初始化

This commit is contained in:
2026-02-22 18:56:10 +08:00
commit 26677972a6
3112 changed files with 255972 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
import type {
EasyFlowFormSchema as FormSchema,
EasyFlowFormProps,
} 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<ComponentType>({
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<ComponentType>;
export { initSetupEasyFlowForm, useEasyFlowForm, z };
export type EasyFlowFormSchema = FormSchema<ComponentType>;
export type { EasyFlowFormProps };