diff --git a/src/pages/flowEditor/index.tsx b/src/pages/flowEditor/index.tsx
index be985b3..c774e29 100644
--- a/src/pages/flowEditor/index.tsx
+++ b/src/pages/flowEditor/index.tsx
@@ -36,14 +36,14 @@ const initialNodes: Node[] = [
},
{
id: 'end-node',
- position: { x: 300, y: 200 },
+ position: { x: 1000, y: 0 },
data: { label: '结束' },
type: 'end'
},
{
id: 'node-1',
type: 'textUpdater',
- position: { x: 150, y: 0 },
+ position: { x: 400, y: 0 },
data: { value: 123 }
}
];
@@ -111,14 +111,14 @@ const FlowEditor: React.FC = () => {
const position = reactFlowInstance.screenToFlowPosition({
x: event.clientX,
- y: event.clientY,
+ y: event.clientY
});
const newNode = {
id: `${type}-${Date.now()}`,
type,
position,
- data: { label: `${type} node` },
+ data: { label: `${type} node` }
};
setNodes((nds) => nds.concat(newNode));
diff --git a/src/pages/flowEditor/node/endNode/EndNode.tsx b/src/pages/flowEditor/node/endNode/EndNode.tsx
index 4f21b88..ea7d654 100644
--- a/src/pages/flowEditor/node/endNode/EndNode.tsx
+++ b/src/pages/flowEditor/node/endNode/EndNode.tsx
@@ -1,22 +1,96 @@
import React from 'react';
import { Handle, Position } from '@xyflow/react';
+import styles from '@/pages/flowEditor/node/style/base.module.less';
+
+interface EndNodeData {
+ title?: string;
+ parameters?: {
+ inputs?: any[];
+ outputs?: any[];
+ };
+ showFooter?: boolean;
+
+ [key: string]: any;
+}
+
+const EndNode = ({ data }: { data: EndNodeData }) => {
+ const title = data.title || '结束';
+ const inputs = data.parameters?.inputs || [];
+ const outputs = data.parameters?.outputs || [];
+ const showFooter = data.showFooter || false;
-const EndNode = ({ data }: { data: any }) => {
return (
-
-
结束
+
+
+ {title}
+
+
+
+ {inputs.length > 0 && (
+
+ {inputs.map((input, index) => (
+
+ {input.name || `输入${index + 1}`}
+
+ ))}
+
+ )}
+
+ {outputs.length > 0 && (
+
+ {outputs.map((output, index) => (
+
+ {output.name || `输出${index + 1}`}
+
+ ))}
+
+ )}
+
+
+ {showFooter && (
+
+ 暂定的footer
+
+ )}
+
+ {/* Dynamic handles based on parameters */}
+
+ {/* Add additional handles based on parameters */}
+ {inputs.map((_, index) => (
+
+ ))}
+
+ {outputs.map((_, index) => (
+
+ ))}
);
};
diff --git a/src/pages/flowEditor/node/startNode/StartNode.tsx b/src/pages/flowEditor/node/startNode/StartNode.tsx
index 8e55995..1c92f1a 100644
--- a/src/pages/flowEditor/node/startNode/StartNode.tsx
+++ b/src/pages/flowEditor/node/startNode/StartNode.tsx
@@ -1,22 +1,96 @@
import React from 'react';
import { Handle, Position } from '@xyflow/react';
+import styles from '@/pages/flowEditor/node/style/base.module.less';
-const StartNode = ({ data }: { data: any }) => {
+interface StartNodeData {
+ title?: string;
+ parameters?: {
+ inputs?: any[];
+ outputs?: any[];
+ };
+ showFooter?: boolean;
+
+ [key: string]: any;
+}
+
+const StartNode = ({ data }: { data: StartNodeData }) => {
+ const title = data.title || '开始';
+ const inputs = data.parameters?.inputs || [];
+ const outputs = data.parameters?.outputs || [];
+ const showFooter = data.showFooter || false;
return (
-
-
开始
+
+
+ {title}
+
+
+
+
+ {inputs.length > 0 && (
+
+ {inputs.map((input, index) => (
+
+ {input.name || `输入${index + 1}`}
+
+ ))}
+
+ )}
+
+ {outputs.length > 0 && (
+
+ {outputs.map((output, index) => (
+
+ {output.name || `输出${index + 1}`}
+
+ ))}
+
+ )}
+
+
+ {showFooter && (
+
+ 暂定的footer
+
+ )}
+
+ {/* Dynamic handles based on parameters */}
+
+ {/* Add additional handles based on parameters */}
+ {inputs.map((_, index) => (
+
+ ))}
+
+ {outputs.map((_, index) => (
+
+ ))}
);
};
diff --git a/src/pages/flowEditor/node/style/base.module.less b/src/pages/flowEditor/node/style/base.module.less
new file mode 100644
index 0000000..611bcb4
--- /dev/null
+++ b/src/pages/flowEditor/node/style/base.module.less
@@ -0,0 +1,47 @@
+.node-container {
+ border-radius: 10px;
+ overflow: hidden;
+ color: white;
+ min-width: 150px;
+ font-size: 14px;
+
+ .node-header {
+ padding: 5px 15px;
+ border-bottom: 1px solid rgba(255, 255, 255, 0.2);
+ }
+
+ .node-content {
+ display: flex;
+ background-color: #ffffff;
+ color: #000000;
+ padding: 15px 5px;
+ min-height: 10px;
+
+ .node-inputs,
+ .node-outputs {
+ flex: 1;
+
+ .node-input-label {
+ font-size: 12px;
+ padding: 2px 0;
+ }
+ }
+
+ .node-inputs {
+ margin-bottom: 5px;
+ margin-right: 30px;
+ }
+
+ .node-outputs {
+ text-align: right;
+ }
+ }
+
+ .node-footer {
+ background-color: #ffffff;
+ color: #000000;
+ padding: 5px 20px;
+ border-top: 1px solid rgba(204, 204, 204, 0.18);
+ min-height: 20px;
+ }
+}
\ No newline at end of file