Skip to content

Commit

Permalink
fix: update graphScope package
Browse files Browse the repository at this point in the history
  • Loading branch information
baizn committed Jan 27, 2021
1 parent 0c51364 commit ccd2cf0
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
10 changes: 9 additions & 1 deletion packages/graphin-graphscope/docs/demo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,15 @@ export default () => {
return (
<div>
<div ref={domRef}></div>
<GraphScopeComponent graphDOM={domRef.current} data={data} width={1000} height={400} neighbors={queryNeighbors} />
<GraphScopeComponent
graphDOM={domRef.current}
data={data}
width={1000}
height={400}
neighbors={queryNeighbors}
hasContextMenu={true}
hasMinimap={false}
/>
</div>
);
};
4 changes: 2 additions & 2 deletions packages/graphin-graphscope/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/graphin-graphscope",
"version": "0.0.10",
"version": "0.0.16",
"description": "An Example for GraphScope",
"main": "lib/index.js",
"module": "es/index.js",
Expand All @@ -13,7 +13,7 @@
},
"dependencies": {
"@antv/graphin": "^2.0.0-beta.5",
"@antv/graphin-components": "^2.0.0-beta.5",
"@antv/graphin-components": "^2.0.0-beta.6",
"@antv/graphin-icons": "^1.0.0",
"antd": "^4.10.3",
"react": "^16.9.0",
Expand Down
12 changes: 9 additions & 3 deletions packages/graphin-graphscope/src/graph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ interface IGraphProps {
hasMinimap?: boolean;
hasContextMenu?: boolean;
hasFishEye?: boolean;
hasLayoutSelector?: boolean;
zoomCanvas?: boolean;
// 节点 label 上显示的字段属性名称
nodeLabel?: string;
}
Expand All @@ -188,6 +190,8 @@ const GraphScope: React.FC<IGraphProps> = ({
hasMinimap = true,
hasContextMenu = true,
hasFishEye = true,
hasLayoutSelector = true,
zoomCanvas = true,
nodeLabel = 'id',
}) => {
const [state, setState] = useState({
Expand Down Expand Up @@ -330,10 +334,12 @@ const GraphScope: React.FC<IGraphProps> = ({
return (
<div>
<Graphin graphDOM={graphDOM} data={state.data as any} layout={layout} width={width} height={height}>
<ZoomCanvas enableOptimize />
<ZoomCanvas disabled={zoomCanvas} enableOptimize />
<DragNode />
{hasMinimap && <MiniMap visible options={{ padding: 20, size: [140, 70] }} />}
<LayoutSelector onChange={handleChangeLayout} value={state.layout.type} options={layouts} />
{hasLayoutSelector && (
<LayoutSelector onChange={handleChangeLayout} value={state.layout.type} options={layouts} />
)}
{hasContextMenu && (
<>
<ContextMenu style={{ width: 90 }}>
Expand All @@ -347,7 +353,7 @@ const GraphScope: React.FC<IGraphProps> = ({
</ContextMenu>
</>
)}
{hasContextMenu && <FishEye options={{ showLabel: false }} visible={visible} handleEscListener={handleClose} />}
{hasFishEye && <FishEye options={{ showLabel: false }} visible={visible} handleEscListener={handleClose} />}
</Graphin>
</div>
);
Expand Down
1 change: 1 addition & 0 deletions packages/graphin-graphscope/src/layoutSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
CustomerServiceFilled,
ShareAltOutlined,
} from '@ant-design/icons';
import 'antd/dist/antd.css';

const iconMap = {
'graphin-force': <ShareAltOutlined />,
Expand Down

0 comments on commit ccd2cf0

Please sign in to comment.