mirror of
https://github.com/imdap/ruoyi-plus-vben5.git
synced 2026-04-25 01:48:35 +08:00
feat: Schema 中 componentProps 随注册组件联动类型提示
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
import type {
|
||||
VbenFormSchema as FormSchema,
|
||||
VbenFormProps,
|
||||
} from '@vben/common-ui';
|
||||
import type { VbenFormProps as CoreFormProps } from '@vben/common-ui';
|
||||
|
||||
import type { ComponentType } from './component';
|
||||
import type { VbenFormSchema } from './form-schema';
|
||||
|
||||
import { setupVbenForm, useVbenForm as useForm, z } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
@@ -41,9 +39,14 @@ async function initSetupVbenForm() {
|
||||
});
|
||||
}
|
||||
|
||||
const useVbenForm = useForm<ComponentType>;
|
||||
type VbenFormProps = Omit<CoreFormProps<ComponentType>, 'schema'> & {
|
||||
schema?: VbenFormSchema[];
|
||||
};
|
||||
|
||||
function useVbenForm(options: VbenFormProps) {
|
||||
return useForm<ComponentType>(options as CoreFormProps<ComponentType>);
|
||||
}
|
||||
|
||||
export { initSetupVbenForm, useVbenForm, z };
|
||||
|
||||
export type VbenFormSchema = FormSchema<ComponentType>;
|
||||
export type { VbenFormProps };
|
||||
export type { VbenFormProps, VbenFormSchema };
|
||||
|
||||
Reference in New Issue
Block a user