import { useTranslate } from '@/hooks/commonHooks'; import { CloseOutlined } from '@ant-design/icons'; import { Button, Card, Form, Input, Select, Typography } from 'antd'; import { useUpdateNodeInternals } from 'reactflow'; import { ICategorizeItem } from '../interface'; import { useBuildCategorizeToOptions, useHandleToSelectChange } from './hooks'; interface IProps { nodeId?: string; } const DynamicCategorize = ({ nodeId }: IProps) => { const updateNodeInternals = useUpdateNodeInternals(); const form = Form.useFormInstance(); const buildCategorizeToOptions = useBuildCategorizeToOptions(); const { handleSelectChange } = useHandleToSelectChange(nodeId); const { t } = useTranslate('flow'); return ( <> {(fields, { add, remove }) => { const handleAdd = () => { const idx = fields.length; add({ name: `Categorize ${idx + 1}` }); if (nodeId) updateNodeInternals(nodeId); }; return (
{fields.map((field) => ( { remove(field.name); }} /> } >