refactor(flowEditor): 重构节点编辑器
- 将 LocalNodeEditor 组件拆分为多个独立的编辑器组件 - 新增 ConditionEditor、AndEditor、OrEditor等多个组件用于不同类型的节点编辑 - 优化节点编辑器的结构和样式,使用 ParamsTable 组件统一参数编辑界面 - 调整 NodeEditorProps接口,使 node 属性可选master
parent
f9a8b66e8c
commit
d92beca5c1
@ -0,0 +1,24 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { NodeEditorProps } from '@/pages/flowEditor/nodeEditors';
|
||||||
|
import { Typography } from '@arco-design/web-react';
|
||||||
|
import { IconUnorderedList } from '@arco-design/web-react/icon';
|
||||||
|
import ParamsTable from './ParamsTable';
|
||||||
|
|
||||||
|
const AndEditor: React.FC<NodeEditorProps> = ({ nodeData, updateNodeData }) => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Typography.Title heading={5}><IconUnorderedList style={{ marginRight: 5 }} />输入参数</Typography.Title>
|
||||||
|
<ParamsTable
|
||||||
|
initialData={nodeData.parameters.dataIns || []}
|
||||||
|
onUpdateData={(data) => {
|
||||||
|
updateNodeData('parameters', {
|
||||||
|
...nodeData.parameters,
|
||||||
|
dataIns: data
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default AndEditor;
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { NodeEditorProps } from '@/pages/flowEditor/nodeEditors';
|
||||||
|
import { Typography } from '@arco-design/web-react';
|
||||||
|
import { IconUnorderedList } from '@arco-design/web-react/icon';
|
||||||
|
import ParamsTable from './ParamsTable';
|
||||||
|
|
||||||
|
const CodeEditor: React.FC<NodeEditorProps> = ({ nodeData, updateNodeData }) => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Typography.Title heading={5}><IconUnorderedList style={{ marginRight: 5 }} />输入参数</Typography.Title>
|
||||||
|
<ParamsTable
|
||||||
|
initialData={nodeData.parameters.dataIns || []}
|
||||||
|
onUpdateData={(data) => {
|
||||||
|
updateNodeData('parameters', {
|
||||||
|
...nodeData.parameters,
|
||||||
|
dataIns: data
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default CodeEditor;
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { NodeEditorProps } from '@/pages/flowEditor/nodeEditors';
|
||||||
|
import { Typography } from '@arco-design/web-react';
|
||||||
|
import { IconUnorderedList } from '@arco-design/web-react/icon';
|
||||||
|
import ParamsTable from './ParamsTable';
|
||||||
|
|
||||||
|
const ConditionEditor: React.FC<NodeEditorProps> = ({ nodeData, updateNodeData }) => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Typography.Title heading={5}><IconUnorderedList style={{ marginRight: 5 }} />输入参数</Typography.Title>
|
||||||
|
<ParamsTable
|
||||||
|
initialData={nodeData.parameters.dataIns || []}
|
||||||
|
onUpdateData={(data) => {
|
||||||
|
updateNodeData('parameters', {
|
||||||
|
...nodeData.parameters,
|
||||||
|
dataIns: data
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ConditionEditor;
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { NodeEditorProps } from '@/pages/flowEditor/nodeEditors';
|
||||||
|
import { Typography } from '@arco-design/web-react';
|
||||||
|
import { IconUnorderedList } from '@arco-design/web-react/icon';
|
||||||
|
import ParamsTable from './ParamsTable';
|
||||||
|
|
||||||
|
const CycleEditor: React.FC<NodeEditorProps> = ({ nodeData, updateNodeData }) => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Typography.Title heading={5}><IconUnorderedList style={{ marginRight: 5 }} />输入参数</Typography.Title>
|
||||||
|
<ParamsTable
|
||||||
|
initialData={nodeData.parameters.dataIns || []}
|
||||||
|
onUpdateData={(data) => {
|
||||||
|
updateNodeData('parameters', {
|
||||||
|
...nodeData.parameters,
|
||||||
|
dataIns: data
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default CycleEditor;
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { NodeEditorProps } from '@/pages/flowEditor/nodeEditors';
|
||||||
|
import { Typography } from '@arco-design/web-react';
|
||||||
|
import { IconUnorderedList } from '@arco-design/web-react/icon';
|
||||||
|
import ParamsTable from './ParamsTable';
|
||||||
|
|
||||||
|
const EventListenEditor: React.FC<NodeEditorProps> = ({ nodeData, updateNodeData }) => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Typography.Title heading={5}><IconUnorderedList style={{ marginRight: 5 }} />输入参数</Typography.Title>
|
||||||
|
<ParamsTable
|
||||||
|
initialData={nodeData.parameters.dataIns || []}
|
||||||
|
onUpdateData={(data) => {
|
||||||
|
updateNodeData('parameters', {
|
||||||
|
...nodeData.parameters,
|
||||||
|
dataIns: data
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default EventListenEditor;
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { NodeEditorProps } from '@/pages/flowEditor/nodeEditors';
|
||||||
|
import { Typography } from '@arco-design/web-react';
|
||||||
|
import { IconUnorderedList } from '@arco-design/web-react/icon';
|
||||||
|
import ParamsTable from './ParamsTable';
|
||||||
|
|
||||||
|
const EventSendEditor: React.FC<NodeEditorProps> = ({ nodeData, updateNodeData }) => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Typography.Title heading={5}><IconUnorderedList style={{ marginRight: 5 }} />输入参数</Typography.Title>
|
||||||
|
<ParamsTable
|
||||||
|
initialData={nodeData.parameters.dataIns || []}
|
||||||
|
onUpdateData={(data) => {
|
||||||
|
updateNodeData('parameters', {
|
||||||
|
...nodeData.parameters,
|
||||||
|
dataIns: data
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default EventSendEditor;
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { NodeEditorProps } from '@/pages/flowEditor/nodeEditors';
|
||||||
|
import { Typography } from '@arco-design/web-react';
|
||||||
|
import { IconUnorderedList } from '@arco-design/web-react/icon';
|
||||||
|
import ParamsTable from './ParamsTable';
|
||||||
|
|
||||||
|
const ImageEditor: React.FC<NodeEditorProps> = ({ nodeData, updateNodeData }) => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Typography.Title heading={5}><IconUnorderedList style={{ marginRight: 5 }} />输入参数</Typography.Title>
|
||||||
|
<ParamsTable
|
||||||
|
initialData={nodeData.parameters.dataIns || []}
|
||||||
|
onUpdateData={(data) => {
|
||||||
|
updateNodeData('parameters', {
|
||||||
|
...nodeData.parameters,
|
||||||
|
dataIns: data
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ImageEditor;
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { NodeEditorProps } from '@/pages/flowEditor/nodeEditors';
|
||||||
|
import { Typography } from '@arco-design/web-react';
|
||||||
|
import { IconUnorderedList } from '@arco-design/web-react/icon';
|
||||||
|
import ParamsTable from './ParamsTable';
|
||||||
|
|
||||||
|
const JsonConvertEditor: React.FC<NodeEditorProps> = ({ nodeData, updateNodeData }) => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Typography.Title heading={5}><IconUnorderedList style={{ marginRight: 5 }} />输入参数</Typography.Title>
|
||||||
|
<ParamsTable
|
||||||
|
initialData={nodeData.parameters.dataIns || []}
|
||||||
|
onUpdateData={(data) => {
|
||||||
|
updateNodeData('parameters', {
|
||||||
|
...nodeData.parameters,
|
||||||
|
dataIns: data
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default JsonConvertEditor;
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { NodeEditorProps } from '@/pages/flowEditor/nodeEditors';
|
||||||
|
import { Typography } from '@arco-design/web-react';
|
||||||
|
import { IconUnorderedList } from '@arco-design/web-react/icon';
|
||||||
|
import ParamsTable from './ParamsTable';
|
||||||
|
|
||||||
|
const JsonToStringEditor: React.FC<NodeEditorProps> = ({ nodeData, updateNodeData }) => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Typography.Title heading={5}><IconUnorderedList style={{ marginRight: 5 }} />输入参数</Typography.Title>
|
||||||
|
<ParamsTable
|
||||||
|
initialData={nodeData.parameters.dataIns || []}
|
||||||
|
onUpdateData={(data) => {
|
||||||
|
updateNodeData('parameters', {
|
||||||
|
...nodeData.parameters,
|
||||||
|
dataIns: data
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default JsonToStringEditor;
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { NodeEditorProps } from '@/pages/flowEditor/nodeEditors';
|
||||||
|
import { Typography } from '@arco-design/web-react';
|
||||||
|
import { IconUnorderedList } from '@arco-design/web-react/icon';
|
||||||
|
import ParamsTable from './ParamsTable';
|
||||||
|
|
||||||
|
const LoopEditor: React.FC<NodeEditorProps> = ({ nodeData, updateNodeData }) => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Typography.Title heading={5}><IconUnorderedList style={{ marginRight: 5 }} />输入参数</Typography.Title>
|
||||||
|
<ParamsTable
|
||||||
|
initialData={nodeData.parameters.dataIns || []}
|
||||||
|
onUpdateData={(data) => {
|
||||||
|
updateNodeData('parameters', {
|
||||||
|
...nodeData.parameters,
|
||||||
|
dataIns: data
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default LoopEditor;
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { NodeEditorProps } from '@/pages/flowEditor/nodeEditors';
|
||||||
|
import { Typography } from '@arco-design/web-react';
|
||||||
|
import { IconUnorderedList } from '@arco-design/web-react/icon';
|
||||||
|
import ParamsTable from './ParamsTable';
|
||||||
|
|
||||||
|
const OrEditor: React.FC<NodeEditorProps> = ({ nodeData, updateNodeData }) => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Typography.Title heading={5}><IconUnorderedList style={{ marginRight: 5 }} />输入参数</Typography.Title>
|
||||||
|
<ParamsTable
|
||||||
|
initialData={nodeData.parameters.dataIns || []}
|
||||||
|
onUpdateData={(data) => {
|
||||||
|
updateNodeData('parameters', {
|
||||||
|
...nodeData.parameters,
|
||||||
|
dataIns: data
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default OrEditor;
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { NodeEditorProps } from '@/pages/flowEditor/nodeEditors';
|
||||||
|
import { Typography } from '@arco-design/web-react';
|
||||||
|
import { IconUnorderedList } from '@arco-design/web-react/icon';
|
||||||
|
import ParamsTable from './ParamsTable';
|
||||||
|
|
||||||
|
const RestEditor: React.FC<NodeEditorProps> = ({ nodeData, updateNodeData }) => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Typography.Title heading={5}><IconUnorderedList style={{ marginRight: 5 }} />输入参数</Typography.Title>
|
||||||
|
<ParamsTable
|
||||||
|
initialData={nodeData.parameters.dataIns || []}
|
||||||
|
onUpdateData={(data) => {
|
||||||
|
updateNodeData('parameters', {
|
||||||
|
...nodeData.parameters,
|
||||||
|
dataIns: data
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default RestEditor;
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { NodeEditorProps } from '@/pages/flowEditor/nodeEditors';
|
||||||
|
import { Typography } from '@arco-design/web-react';
|
||||||
|
import { IconUnorderedList } from '@arco-design/web-react/icon';
|
||||||
|
import ParamsTable from './ParamsTable';
|
||||||
|
|
||||||
|
const ResultEditor: React.FC<NodeEditorProps> = ({ nodeData, updateNodeData }) => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Typography.Title heading={5}><IconUnorderedList style={{ marginRight: 5 }} />输入参数</Typography.Title>
|
||||||
|
<ParamsTable
|
||||||
|
initialData={nodeData.parameters.dataIns || []}
|
||||||
|
onUpdateData={(data) => {
|
||||||
|
updateNodeData('parameters', {
|
||||||
|
...nodeData.parameters,
|
||||||
|
dataIns: data
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ResultEditor;
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { NodeEditorProps } from '@/pages/flowEditor/nodeEditors';
|
||||||
|
import { Typography } from '@arco-design/web-react';
|
||||||
|
import { IconUnorderedList } from '@arco-design/web-react/icon';
|
||||||
|
import ParamsTable from './ParamsTable';
|
||||||
|
|
||||||
|
const StringToJsonEditor: React.FC<NodeEditorProps> = ({ nodeData, updateNodeData }) => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Typography.Title heading={5}><IconUnorderedList style={{ marginRight: 5 }} />输入参数</Typography.Title>
|
||||||
|
<ParamsTable
|
||||||
|
initialData={nodeData.parameters.dataIns || []}
|
||||||
|
onUpdateData={(data) => {
|
||||||
|
updateNodeData('parameters', {
|
||||||
|
...nodeData.parameters,
|
||||||
|
dataIns: data
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default StringToJsonEditor;
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { NodeEditorProps } from '@/pages/flowEditor/nodeEditors';
|
||||||
|
import { Typography } from '@arco-design/web-react';
|
||||||
|
import { IconUnorderedList } from '@arco-design/web-react/icon';
|
||||||
|
import ParamsTable from './ParamsTable';
|
||||||
|
|
||||||
|
const WaitEditor: React.FC<NodeEditorProps> = ({ nodeData, updateNodeData }) => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Typography.Title heading={5}><IconUnorderedList style={{ marginRight: 5 }} />输入参数</Typography.Title>
|
||||||
|
<ParamsTable
|
||||||
|
initialData={nodeData.parameters.dataIns || []}
|
||||||
|
onUpdateData={(data) => {
|
||||||
|
updateNodeData('parameters', {
|
||||||
|
...nodeData.parameters,
|
||||||
|
dataIns: data
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default WaitEditor;
|
||||||
Loading…
Reference in New Issue