diff --git a/web/src/pages/flow/form/categorize-form/dynamic-categorize.tsx b/web/src/pages/flow/form/categorize-form/dynamic-categorize.tsx index ada0b43a1..7d3987971 100644 --- a/web/src/pages/flow/form/categorize-form/dynamic-categorize.tsx +++ b/web/src/pages/flow/form/categorize-form/dynamic-categorize.tsx @@ -3,7 +3,7 @@ import { CloseOutlined, PlusOutlined } from '@ant-design/icons'; import { useUpdateNodeInternals } from '@xyflow/react'; import { Button, - Card, + Collapse, Flex, Form, FormListFieldData, @@ -97,13 +97,65 @@ const NameInput = ({ ); }; -const DynamicCategorize = ({ nodeId }: IProps) => { - const updateNodeInternals = useUpdateNodeInternals(); +const FormSet = ({ nodeId, field }: IProps & { field: FormListFieldData }) => { const form = Form.useFormInstance(); + const { t } = useTranslate('flow'); const buildCategorizeToOptions = useBuildFormSelectOptions( Operator.Categorize, nodeId, ); + + return ( +
+ + + form.setFields([ + { + name: ['items', field.name, 'name'], + errors, + }, + ]) + } + > + + + + + + + + + + +
+ ); +}; + +const DynamicCategorize = ({ nodeId }: IProps) => { + const updateNodeInternals = useUpdateNodeInternals(); + const form = Form.useFormInstance(); + const { t } = useTranslate('flow'); return ( @@ -122,74 +174,35 @@ const DynamicCategorize = ({ nodeId }: IProps) => { }); if (nodeId) updateNodeInternals(nodeId); }; + return ( {fields.map((field) => ( - { - remove(field.name); - }} - /> - } - > - - - form.setFields([ - { - name: ['items', field.name, 'name'], - errors, - }, - ]) - } - > - - - - - - - - - - - + items={[ + { + key: field.key, + label: ( +
+ + {form.getFieldValue(['items', field.name, 'name'])} + + { + remove(field.name); + }} + /> +
+ ), + children: ( + + ), + }, + ]} + > ))}