diff --git a/src/pages/flowEditor/index.tsx b/src/pages/flowEditor/index.tsx index be0c542..63bf0b8 100644 --- a/src/pages/flowEditor/index.tsx +++ b/src/pages/flowEditor/index.tsx @@ -18,6 +18,7 @@ import TextUpdaterNode from './node/textUpdateNode/TextUpdaterNode'; import StartNode from './node/startNode/StartNode'; import EndNode from './node/endNode/EndNode'; import DraggableNode from './node/draggableNode/DraggableNode'; +import BasicNode from './node/basicNode/BasicNode'; import SideBar from './sideBar/sideBar'; import { convertFlowData } from '@/utils/convertFlowData'; import { exampleFlowData } from '@/pages/flowEditor/test/exampleFlowData'; @@ -26,7 +27,8 @@ const nodeTypes: NodeTypes = { textUpdater: TextUpdaterNode, start: StartNode, end: EndNode, - draggable: DraggableNode + draggable: DraggableNode, + BASIC: BasicNode }; const { nodes: convertedNodes, edges: convertedEdges } = convertFlowData(exampleFlowData); diff --git a/src/pages/flowEditor/node/basicNode/BasicNode.tsx b/src/pages/flowEditor/node/basicNode/BasicNode.tsx new file mode 100644 index 0000000..d0747c4 --- /dev/null +++ b/src/pages/flowEditor/node/basicNode/BasicNode.tsx @@ -0,0 +1,29 @@ +import React from 'react'; +import styles from '@/pages/flowEditor/node/style/base.module.less'; +import NodeContent from '@/pages/flowEditor/components/nodeContent'; + +interface BasicNodeData { + title?: string; + parameters?: { + inputs?: any[]; + outputs?: any[]; + }; + showFooter?: boolean; + + [key: string]: any; +} + +const BasicNode = ({ data }: { data: BasicNodeData }) => { + const title = data.title || '基础节点'; + return ( +
+
+ {title} +
+ + +
+ ); +}; + +export default BasicNode; \ No newline at end of file diff --git a/src/utils/convertFlowData.ts b/src/utils/convertFlowData.ts index f5f5de7..821a766 100644 --- a/src/utils/convertFlowData.ts +++ b/src/utils/convertFlowData.ts @@ -51,7 +51,8 @@ export const convertFlowData = (flowData: any) => { dataType: output.dataType, defaultValue: output.defaultValue })) || [] - } + }, + type: nodeType, } };