Skip to content

Commit

Permalink
chore: update code
Browse files Browse the repository at this point in the history
  • Loading branch information
pomelo-nwu committed Sep 7, 2023
1 parent bc1c023 commit 2c83868
Show file tree
Hide file tree
Showing 24 changed files with 482 additions and 245 deletions.

This file was deleted.

18 changes: 0 additions & 18 deletions packages/gi-assets-advance/src/components/EdgeBundling/index.tsx

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ReloadOutlined } from '@ant-design/icons';
import { connectedComponent, iLouvain, kCore, louvain } from '@antv/algorithm';
import { useContext } from '@antv/gi-sdk';
import type { GraphinData } from '@antv/graphin';
import Graphin, { Behaviors } from '@antv/graphin';
import { Behaviors } from '@antv/graphin';
import { Button, Empty, InputNumber, Radio, Spin, message } from 'antd';
import { cloneDeep } from 'lodash';
import React, { memo, useEffect, useState } from 'react';
Expand Down Expand Up @@ -440,19 +440,18 @@ const CommunityDetection: React.FunctionComponent<CommunityDetectionProps> = pro
{$i18n.get({ id: 'gi-assets-algorithm.src.CommunityDetection.Component.AnalysisResults', dm: '分析结果' })}
</p>
<div className="community-detection-graph-container">
<Graphin
{/* <Graphin
data={resData}
height={300}
layout={{
type: 'preset',
}}
fitView
animate={false}
minZoom={0.1}
layoutCache
>
<ClickSelect disabled />
</Graphin>
</Graphin> */}
</div>
</div>
);
Expand Down
34 changes: 16 additions & 18 deletions packages/gi-assets-algorithm/src/PatternMatch/patternEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,18 @@ import Algorithm from '@antv/algorithm';
import { uniqueId } from '@antv/algorithm/lib/util';
import { IItemBase } from '@antv/g6';
import { extra, IEdgeSchema, INodeSchema, useContext } from '@antv/gi-sdk';
import Graphin, { Behaviors, GraphinData, Utils as GraphinUtils } from '@antv/graphin';
import { Button, Col, Divider, Input, Layout, Menu, message, Row, Tabs } from 'antd';
import { Behaviors, GraphinData, Utils as GraphinUtils } from '@antv/graphin';
import { Button, Col, Divider, Input, Layout, message, Row, Tabs } from 'antd';
import deepmerge from 'deepmerge';
import { cloneDeep } from 'lodash';
import React, { useEffect, useRef, useState } from 'react';
import $i18n from '../i18n';
import Util from '../utils';
import AddRelation from './AddRelation';
import EditDrawer, { TypeInfo } from './editDrawer';
import './index.less';
import { ITEM_STATE, SPLITOR } from './registerMeta';
import templates from './templates';
import { formatDataModels } from './util';
import $i18n from '../i18n';

const { TabPane } = Tabs;
const { Search } = Input;
Expand Down Expand Up @@ -744,7 +743,7 @@ const PatternEditor: React.FC<Props> = ({
style={{ width: 200 }}
/>
<div className="kg-pattern-match-schema-graph-wrapper">
<Graphin
{/* <Graphin
data={{
nodes: schemaNodes,
edges: [],
Expand All @@ -756,24 +755,23 @@ const PatternEditor: React.FC<Props> = ({
width: 200,
nodeSize: 50,
}}
animate={false}
modes={{
default: [
{
type: 'scroll-canvas',
direction: 'y',
scalableRange: -0.99,
},
],
}}
// modes={{
// default: [
// {
// type: 'scroll-canvas',
// direction: 'y',
// scalableRange: -0.99,
// },
// ],
// }}
>
<ClickSelect disabled />
<ZoomCanvas disabled />
<DragCanvas disabled />
<LassoSelect disabled />
<DragNode disabled />
<DragCombo disabled />
</Graphin>
</Graphin> */}
</div>
</TabPane>
<TabPane
Expand All @@ -798,7 +796,7 @@ const PatternEditor: React.FC<Props> = ({
</Tabs>
</Sider>
<Content>
<Graphin
{/* <Graphin
data={graphData}
ref={graphRef as any}
layout={{
Expand Down Expand Up @@ -859,7 +857,7 @@ const PatternEditor: React.FC<Props> = ({
</Menu>
)}
</div>
</Graphin>
</Graphin> */}
</Content>
</Layout>
<EditDrawer
Expand Down
12 changes: 6 additions & 6 deletions packages/gi-assets-algorithm/src/PatternMatch/patternPane.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { DownOutlined } from '@ant-design/icons';
import { IEdgeSchema, useContext } from '@antv/gi-sdk';
import Graphin, { Behaviors, GraphinData } from '@antv/graphin';
import { Dropdown, Empty, Menu, message, Tooltip, Upload } from 'antd';
import { Behaviors, GraphinData } from '@antv/graphin';
import { Dropdown, Empty, Menu, Tooltip, Upload, message } from 'antd';
import React, { useEffect, useMemo, useRef } from 'react';
import $i18n from '../i18n';
import Util from '../utils';
import './index.less';
import { formatData } from './util';
import $i18n from '../i18n';

const { exportGraphData } = Util;

Expand Down Expand Up @@ -125,17 +125,17 @@ const PatternPane: React.FC<Props> = ({ id, data, schemaEdgeMap, editPattern, ex
<DownOutlined />
</a>
</Dropdown>
<Graphin
{/* <Graphin
width={388}
height={246}
data={graphData}
ref={graphRef as any}
animate={false}
// animate={false}
minZoom={0.001}
fitView={true}
>
<ClickSelect disabled />
</Graphin>
</Graphin> */}
</div>
) : (
<Empty
Expand Down
Original file line number Diff line number Diff line change
@@ -1,49 +1,48 @@
import { G6 } from '@antv/graphin';
import * as React from 'react';
interface PatternGraphProps {
pattern: any;
}

const PatternGraph: React.FunctionComponent<PatternGraphProps> = props => {
const { pattern } = props;
React.useEffect(() => {
const patternGraph = new G6.Graph({
container: 'gi-pattern-match-graph-container',
width: 380,
height: 250,
fitView: true,
defaultEdge: {
size: 2,
style: {
endArrow: {
path: G6.Arrow.triangle(10, 10),
},
},
labelCfg: {
autoRotate: true,
style: {
stroke: '#fff',
lineWidth: 2,
},
},
},
defaultNode: {
labelCfg: {
position: 'right',
},
},
layout: {
type: 'dagre',
ranksep: 20,
},
});
const clonePattern = JSON.parse(JSON.stringify(pattern));
patternGraph.data(clonePattern);
patternGraph.render();
return () => {
patternGraph.destroy();
};
}, [pattern]);
// React.useEffect(() => {
// const patternGraph = new Graph({
// container: 'gi-pattern-match-graph-container',
// width: 380,
// height: 250,
// fitView: true,
// defaultEdge: {
// size: 2,
// style: {
// endArrow: {
// path: G6.Arrow.triangle(10, 10),
// },
// },
// labelCfg: {
// autoRotate: true,
// style: {
// stroke: '#fff',
// lineWidth: 2,
// },
// },
// },
// defaultNode: {
// labelCfg: {
// position: 'right',
// },
// },
// layout: {
// type: 'dagre',
// ranksep: 20,
// },
// });
// const clonePattern = JSON.parse(JSON.stringify(pattern));
// patternGraph.data(clonePattern);
// patternGraph.render();
// return () => {
// patternGraph.destroy();
// };
// }, [pattern]);
return (
<div>
<div id="gi-pattern-match-graph-container"></div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import React, { memo } from 'react';
import CanvasClick from './CanvasClick';
import CanvasDoubleClick from './CanvasDoubleClick';

const { DragCanvas, ZoomCanvas, BrushSelect, Hoverable, ActivateRelations } = Behaviors;
const { DragCanvas, ZoomCanvas, BrushSelect } = Behaviors;

export interface CanvasSettingProps {
dragCanvas: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { utils } from '@antv/gi-sdk';
import { Components } from '@antv/graphin';
import React, { memo } from 'react';

const { getPositionStyles } = utils;

const { Legend } = Components;
// const { Legend } = Components;

export interface ComponentProps {
sortKey: string;
Expand All @@ -19,11 +18,11 @@ const Component: React.FunctionComponent<ComponentProps> = props => {

return (
<div>
<Legend bindType="node" sortKey={`data.${sortKey}`} style={positionStyles}>
{/* <Legend bindType="node" sortKey={`data.${sortKey}`} style={positionStyles}>
{renderProps => {
return <Legend.Node {...renderProps} />;
}}
</Legend>
</Legend> */}
</div>
);
};
Expand Down
3 changes: 1 addition & 2 deletions packages/gi-assets-testing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
"peerDependencies": {
"react": "17.x",
"react-dom": "17.x",
"antd": "4.x",
"@antv/graphin": "^2.7.21"
"antd": "4.x"
},
"devDependencies": {
"@types/react": "^17.x",
Expand Down
1 change: 0 additions & 1 deletion packages/gi-assets-xlab
Submodule gi-assets-xlab deleted from 207352
2 changes: 1 addition & 1 deletion packages/gi-sdk/src/GISDK.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ const GISDK = (props: Props) => {
}
}
};
console.log(' graphinRef.current', graphinRef.current);
console.log('graphinRef.current', graphinRef.current);
const HAS_GRAPH = graphinRef.current?.graph && !graphinRef.current.graph.destroyed;

const ContextValue = {
Expand Down
1 change: 0 additions & 1 deletion packages/gi-site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@
"perf_hooks": "^0.0.1"
},
"peerDependencies": {
"@antv/graphin": "^2.7.21",
"antd": "4.x",
"react": "17.x",
"react-dom": "17.x"
Expand Down
Loading

0 comments on commit 2c83868

Please sign in to comment.