1
This commit is contained in:
parent
4889312eb3
commit
fe58ec3759
@ -1,4 +1,4 @@
|
||||
import React, { useEffect } from 'react';
|
||||
import React, { useEffect, ReactNode } from 'react';
|
||||
import { Drawer, Form, Input, Select, Button, Space, Divider, Tooltip } from 'antd';
|
||||
import { InfoCircleOutlined } from '@ant-design/icons';
|
||||
import { Cell } from '@antv/x6';
|
||||
@ -32,12 +32,14 @@ const NodeConfigDrawer: React.FC<NodeConfigDrawerProps> = ({
|
||||
|
||||
useEffect(() => {
|
||||
if (visible && node && nodeDefinition) {
|
||||
const currentConfig = {
|
||||
const currentConfig = node.getProp('config') || {};
|
||||
if (!currentConfig.name) {
|
||||
currentConfig.name = nodeDefinition.name;
|
||||
}
|
||||
form.setFieldsValue({
|
||||
code: node.getProp('code') === undefined ? nodeDefinition.graphConfig.code : node.getProp('code'),
|
||||
...node.getProp('config'),
|
||||
};
|
||||
form.setFieldsValue(currentConfig || {});
|
||||
console.log('NodeConfigModal - form values after set:', form.getFieldsValue());
|
||||
...currentConfig
|
||||
});
|
||||
}
|
||||
}, [visible, node, nodeDefinition, form]);
|
||||
|
||||
@ -125,7 +127,7 @@ const NodeConfigDrawer: React.FC<NodeConfigDrawerProps> = ({
|
||||
const { configSchema } = nodeDefinition.graphConfig;
|
||||
console.log('NodeConfigModal - Rendering form items with schema:', configSchema);
|
||||
|
||||
const formItems = [];
|
||||
const formItems: ReactNode[] = [];
|
||||
|
||||
// 根据 configSchema 生成表单项
|
||||
if (configSchema.properties) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user