Skip to content

Commit f54285e

Browse files
author
xwj02155382
committed
fix: Re encapsulate the importer and export the useContext
1 parent 53e7bbb commit f54285e

File tree

49 files changed

+265
-1969
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+265
-1969
lines changed

packages/studio-flow-editor/src/app/index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ const GraphCanvas: React.FC<ImportorProps> = ({
3030
onReactFlowInit,
3131
} = useInteractive();
3232
const { token } = theme.useToken();
33-
useDynamicStyle(cssStyles, 'graphscope-graph-canvas');
34-
33+
useDynamicStyle(cssStyles, 'graphscope-flow-editor');
3534
const _nodes = nodePositionChange.length === 0 ? nodes : applyNodeChanges(nodePositionChange, nodes);
3635
return (
3736
<div style={{ height: '100%', width: '100%' }}>
@@ -58,7 +57,7 @@ const GraphCanvas: React.FC<ImportorProps> = ({
5857
{showMinimap && <MiniMap style={{ backgroundColor: token.colorBgBase }} />}
5958
<ArrowMarker />
6059
{children}
61-
</ReactFlow>
60+
</ReactFlow>
6261
</div>
6362
</div>
6463
);

packages/studio-flow-editor/src/app/store/index.tsx

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,47 +4,9 @@ import type { Node, Edge } from 'reactflow';
44
import type { Property } from '@graphscope/studio-components';
55
import React, { useContext, useMemo } from 'react';
66
import { v4 as uuidv4 } from 'uuid';
7+
import { ISchemaEdge, ISchemaNode } from '../types';
78

8-
export interface IEdgeData {
9-
label: string;
10-
/** 禁用:saved / binded / xxxx */
11-
disabled?: boolean;
12-
/** 是否保存在服务端 */
13-
saved?: boolean;
14-
properties?: Property[];
15-
source_vertex_fields?: Property;
16-
target_vertex_fields?: Property;
17-
dataFields?: string[];
18-
delimiter?: string;
19-
datatype?: 'csv' | 'odps';
20-
filelocation?: string;
21-
_extra?: {
22-
type?: string;
23-
offset?: string;
24-
isLoop: boolean;
25-
isRevert?: boolean;
26-
isPoly?: boolean;
27-
index?: number;
28-
count?: number;
29-
};
30-
[key: string]: any;
31-
}
32-
33-
export interface INodeData {
34-
label: string;
35-
disabled?: boolean;
36-
properties?: Property[];
37-
dataFields?: string[];
38-
delimiter?: string;
39-
datatype?: 'csv' | 'odps';
40-
filelocation?: string;
41-
[key: string]: any;
42-
}
43-
export type ISchemaNode = Node<INodeData>;
44-
45-
export type ISchemaEdge = Edge<IEdgeData> & { data: IEdgeData };
46-
47-
interface GraphState {
9+
export interface GraphState {
4810
displayMode: 'graph' | 'table';
4911
nodes: ISchemaNode[];
5012
edges: ISchemaEdge[];

packages/studio-flow-editor/src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export { default as GraphEditor } from './app';
2-
export { useGraphStore, GraphProvider } from './app/store';
2+
export * from './app/store';
33
export { useClearCanvas, useAddNode, useExportSvg } from './app/hooks';
44
export {default as AddNode} from './app/button-controller/add-node'
55
export {default as ClearCanvas} from './app/button-controller/clear-canvas'

packages/studio-importor/.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
registry=http://registry.anpm.alibaba-inc.com

packages/studio-importor/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"@graphscope/use-zustand": "workspace:*",
2828
"@graphscope/studio-components": "workspace:*",
2929
"@graphscope/studio-server": "workspace:*",
30+
"@graphscope/studio-flow-editor": "workspace:*",
3031
"d3-force": "latest",
3132
"dagre": "latest",
3233
"localforage": "latest",

packages/studio-importor/src/app/button-controller/add-node.tsx

Lines changed: 0 additions & 57 deletions
This file was deleted.

packages/studio-importor/src/app/button-controller/clear-canvas.tsx

Lines changed: 0 additions & 51 deletions
This file was deleted.

packages/studio-importor/src/app/button-controller/export-image.tsx

Lines changed: 0 additions & 29 deletions
This file was deleted.

packages/studio-importor/src/app/button-controller/import-and-export-config.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Button, Popover, Flex, Typography, Divider, theme, Space } from 'antd';
22
import * as React from 'react';
33
import { Utils, Icons } from '@graphscope/studio-components';
4-
import { useContext } from '@graphscope/use-zustand';
4+
import { useContext } from '../useContext';
55
import { transOptionsToSchema } from '../utils/modeling';
66
import { transformImportOptionsToSchemaMapping } from '../utils/importing';
77
import yaml from 'js-yaml';

packages/studio-importor/src/app/button-controller/index.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
import React from 'react';
22
import { Divider } from 'antd';
3-
import { Toolbar, useCustomToken } from '@graphscope/studio-components';
4-
3+
import { Toolbar } from '@graphscope/studio-components';
4+
import {AddNode,ClearCanvas,ExportSvg} from '@graphscope/studio-flow-editor';
55
import RightButton from './right-button';
6-
import ClearCanvas from './clear-canvas';
7-
import AddNode from './add-node';
8-
import ExportImage from './export-image';
9-
import { useContext } from '@graphscope/use-zustand';
6+
import { useContext } from '../useContext';
107

118
import ParseCSV from './parse-csv';
129
import ImportAndExportConfig from './import-and-export-config';
@@ -28,7 +25,7 @@ const ButtonController: React.FunctionComponent<IButtonControllerProps> = props
2825
<Divider style={{ margin: '0px' }} />
2926
<AddNode />
3027
<ClearCanvas />
31-
<ExportImage />
28+
<ExportSvg />
3229
</Toolbar>
3330
</>
3431
);

0 commit comments

Comments
 (0)