diff --git a/web/components/flow/canvas-node.tsx b/web/components/flow/canvas-node.tsx index cb696220d..108952323 100644 --- a/web/components/flow/canvas-node.tsx +++ b/web/components/flow/canvas-node.tsx @@ -23,7 +23,6 @@ type CanvasNodeProps = { function TypeLabel({ label }: { label: string }) { return
{label}
; } -const forceTypeList = ['file', 'multiple_files', 'time','images','csv_file']; const CanvasNode: React.FC = ({ data }) => { const node = data; @@ -135,10 +134,7 @@ const CanvasNode: React.FC = ({ data }) => { function onParameterValuesChange(changedValues: any, allValues: any) { const [changedKey, changedVal] = Object.entries(changedValues)[0]; - - if (!allValues?.force && forceTypeList.includes(changedKey)) { - return; - } + updateCurrentNodeValue(changedKey, changedVal); if (changedVal) { updateDependsNodeValue(changedKey, changedVal); diff --git a/web/components/flow/node-param-handler.tsx b/web/components/flow/node-param-handler.tsx index 901f428f9..db497e6b4 100644 --- a/web/components/flow/node-param-handler.tsx +++ b/web/components/flow/node-param-handler.tsx @@ -103,7 +103,7 @@ const NodeParamHandler: React.FC = ({ formValuesChange,no case 'slider': return renderSlider(data); case 'date_picker': - return renderDatePicker( data ); + return renderDatePicker({ data,formValuesChange }); case 'time_picker': return renderTimePicker({ data,formValuesChange }); case 'tree_select': diff --git a/web/components/flow/node-renderer/date-picker.tsx b/web/components/flow/node-renderer/date-picker.tsx index 752f5a394..f3ccc610a 100644 --- a/web/components/flow/node-renderer/date-picker.tsx +++ b/web/components/flow/node-renderer/date-picker.tsx @@ -1,9 +1,23 @@ import { IFlowNodeParameter } from '@/types/flow'; import { convertKeysToCamelCase } from '@/utils/flow'; import { DatePicker } from 'antd'; +import type { DatePickerProps } from 'antd'; -export const renderDatePicker = (data: IFlowNodeParameter) => { +type Props = { + formValuesChange:any, + data: IFlowNodeParameter; + onChange?: (value: any) => void; +}; +export const renderDatePicker = (params: Props) => { + const { data ,formValuesChange} = params; const attr = convertKeysToCamelCase(data.ui?.attr || {}); - return ; + const onChange: DatePickerProps['onChange'] = (date, dateString) => { + formValuesChange({ + [data.name]:dateString + }) + }; + + + return ; }; diff --git a/web/components/flow/node-renderer/time-picker.tsx b/web/components/flow/node-renderer/time-picker.tsx index fe77bc90a..932828a3b 100644 --- a/web/components/flow/node-renderer/time-picker.tsx +++ b/web/components/flow/node-renderer/time-picker.tsx @@ -15,8 +15,8 @@ export const renderTimePicker = (params: Props) => { const onChangeTime: TimePickerProps['onChange'] = (time, timeString) => { formValuesChange({ - time:timeString - },{force:true}) + [data.name]:timeString + }) }; return ; diff --git a/web/components/flow/node-renderer/upload.tsx b/web/components/flow/node-renderer/upload.tsx index 49ed4a615..51cbaa94c 100644 --- a/web/components/flow/node-renderer/upload.tsx +++ b/web/components/flow/node-renderer/upload.tsx @@ -15,21 +15,19 @@ export const renderUpload = (params: Props) => { const { t } = useTranslation(); const urlList = useRef([]); const { data ,formValuesChange} = params; - const form = Form.useFormInstance() - + const attr = convertKeysToCamelCase(data.ui?.attr || {}); const [uploading, setUploading] = useState(false); const [uploadType, setUploadType] = useState(''); - const getUploadSuccessUrl = (url: string) => { if (urlList.current.length === data.ui.attr.max_count) { urlList.current.pop(); } urlList.current.push(url); if (data.ui.attr.max_count === 1) { - formValuesChange({file:urlList.current.toString()},{force:true}) + formValuesChange({[data.name]:urlList.current.toString()}) }else{ - formValuesChange({multiple_files:JSON.stringify(urlList.current)},{force:true}) + formValuesChange({[data.name]:urlList.current}) } }; @@ -38,10 +36,11 @@ export const renderUpload = (params: Props) => { if (index !== -1) { urlList.current.splice(index, 1); } + setUploading(false); if (data.ui.attr.max_count === 1) { - formValuesChange({file:urlList.current.toString()},{force:true}) + formValuesChange({[data.name]:urlList.current.toString()}) }else{ - formValuesChange({multiple_files:JSON.stringify(urlList.current)},{force:true}) + formValuesChange({[data.name]:urlList.current}) } }; @@ -54,6 +53,7 @@ export const renderUpload = (params: Props) => { onChange(info) { setUploading(true); if (info.file.status !== 'uploading') { + setUploading(false); } if (info.file.status === 'done') { setUploading(false);