import NumberInput from '@/components/originui/number-input'; import { SelectWithSearch } from '@/components/originui/select-with-search'; import { ButtonLoading } from '@/components/ui/button'; import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage, } from '@/components/ui/form'; import { Input } from '@/components/ui/input'; import { useTranslate } from '@/hooks/common-hooks'; import { zodResolver } from '@hookform/resolvers/zod'; import { memo } from 'react'; import { useForm, useFormContext } from 'react-hook-form'; import { z } from 'zod'; import { initialExeSqlValues } from '../../constant'; import { useFormValues } from '../../hooks/use-form-values'; import { useWatchFormChange } from '../../hooks/use-watch-form-change'; import { INextOperatorForm } from '../../interface'; import { ExeSQLOptions } from '../../options'; import { FormWrapper } from '../components/form-wrapper'; import { QueryVariable } from '../components/query-variable'; import { FormSchema, useSubmitForm } from './use-submit-form'; export function ExeSQLFormWidgets({ loading }: { loading: boolean }) { const form = useFormContext(); const { t } = useTranslate('flow'); return ( <> ( {t('dbType')} )} /> ( {t('database')} )} /> ( {t('username')} )} /> ( {t('host')} )} /> ( {t('port')} )} /> ( {t('password')} )} /> ( {t('maxRecords')} )} />
Test
); } function ExeSQLForm({ node }: INextOperatorForm) { const defaultValues = useFormValues(initialExeSqlValues, node); const { onSubmit, loading } = useSubmitForm(); const form = useForm>({ resolver: zodResolver(FormSchema), defaultValues, }); useWatchFormChange(node?.id, form); return (
); } export default memo(ExeSQLForm);