import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons'; import { Button, Collapse, Flex, Form, Input, Select } from 'antd'; import { PropsWithChildren, useCallback } from 'react'; import { useTranslation } from 'react-i18next'; import { useBuildComponentIdSelectOptions } from '../../hooks'; import styles from './index.less'; interface IProps { nodeId?: string; } enum VariableType { Reference = 'reference', Input = 'input', } const getVariableName = (type: string) => type === VariableType.Reference ? 'component_id' : 'value'; const DynamicVariableForm = ({ nodeId }: IProps) => { const { t } = useTranslation(); const valueOptions = useBuildComponentIdSelectOptions(nodeId); const form = Form.useFormInstance(); const options = [ { value: VariableType.Reference, label: t('flow.reference') }, { value: VariableType.Input, label: t('flow.input') }, ]; const handleTypeChange = useCallback( (name: number) => () => { setTimeout(() => { form.setFieldValue(['query', name, 'component_id'], undefined); form.setFieldValue(['query', name, 'value'], undefined); }, 0); }, [form], ); return (