import type { EasyFlowFormProps, EasyFlowFormSchema as FormSchema, } from '@easyflow/common-ui'; import type { ComponentType } from './component'; import { setupEasyFlowForm, useEasyFlowForm as useForm, z, } from '@easyflow/common-ui'; import { $t } from '@easyflow/locales'; async function initSetupEasyFlowForm() { setupEasyFlowForm({ config: { modelPropNameMap: { Upload: 'fileList', CheckboxGroup: 'model-value', }, }, defineRules: { required: (value, _params, ctx) => { if (value === undefined || value === null || value.length === 0) { return $t('ui.formRules.required', [ctx.label]); } return true; }, selectRequired: (value, _params, ctx) => { if (value === undefined || value === null) { return $t('ui.formRules.selectRequired', [ctx.label]); } return true; }, }, }); } const useEasyFlowForm = useForm; export { initSetupEasyFlowForm, useEasyFlowForm, z }; export type EasyFlowFormSchema = FormSchema; export type { EasyFlowFormProps };