import { useTranslate } from '@/hooks/common-hooks'; import { Form, Input, Select } from 'antd'; import { useMemo } from 'react'; import { BaiduFanyiDomainOptions, BaiduFanyiSourceLangOptions, } from '../constant'; import { IOperatorForm } from '../interface'; const BaiduFanyiForm = ({ onValuesChange, form }: IOperatorForm) => { const { t } = useTranslate('flow'); const options = useMemo(() => { return ['translate', 'fieldtranslate'].map((x) => ({ value: x, label: t(`baiduSecretKeyOptions.${x}`), })); }, [t]); const baiduFanyiOptions = useMemo(() => { return BaiduFanyiDomainOptions.map((x) => ({ value: x, label: t(`baiduDomainOptions.${x}`), })); }, [t]); const baiduFanyiSourceLangOptions = useMemo(() => { return BaiduFanyiSourceLangOptions.map((x) => ({ value: x, label: t(`baiduSourceLangOptions.${x}`), })); }, [t]); return (
{({ getFieldValue }) => getFieldValue('trans_type') === 'fieldtranslate' && ( ) }
); }; export default BaiduFanyiForm;