refactor(flowEditor): 抽离参数表格组件
- 从 EndNodeEditor 和 StartNodeEditor 中提取公共的参数表格逻辑 - 新增 ParamsTable 组件用于渲染参数表格 - 优化了参数表格的添加、编辑和删除功能- 统一了参数表格的样式和交互master
parent
9a4187a8c3
commit
2e5c6bc70b
@ -1,27 +1,28 @@
|
||||
import React from 'react';
|
||||
import { NodeEditorProps } from './index';
|
||||
import { Form, Input } from '@arco-design/web-react';
|
||||
import { Typography } from '@arco-design/web-react';
|
||||
import { IconUnorderedList } from '@arco-design/web-react/icon';
|
||||
import ParamsTable from './ParamsTable';
|
||||
|
||||
|
||||
const StartNodeEditor: React.FC<NodeEditorProps> = ({
|
||||
node,
|
||||
nodeData,
|
||||
updateNodeData
|
||||
}) => {
|
||||
node,
|
||||
nodeData,
|
||||
updateNodeData
|
||||
}) => {
|
||||
return (
|
||||
<Form layout="vertical">
|
||||
<Form.Item label="节点标题">
|
||||
<Input
|
||||
value={nodeData.title || ''}
|
||||
onChange={(value) => updateNodeData('title', value)}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item label="描述">
|
||||
<Input.TextArea
|
||||
value={nodeData.description || ''}
|
||||
onChange={(value) => updateNodeData('description', value)}
|
||||
/>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
<>
|
||||
<Typography.Title heading={5}><IconUnorderedList style={{ marginRight: 5 }} />输出参数</Typography.Title>
|
||||
<ParamsTable
|
||||
initialData={nodeData.parameters.dataOuts || []}
|
||||
onUpdateData={(data) => {
|
||||
updateNodeData('parameters', {
|
||||
...nodeData.parameters,
|
||||
dataOuts: data
|
||||
});
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue