@antdv/pro-utils
Version:
@antdv/pro-utils
19 lines (18 loc) • 940 B
TypeScript
import type { FormInstance } from 'ant-design-vue';
import type { NamePath } from 'ant-design-vue/lib/form/interface';
import type { Ref } from 'vue';
export interface ProFormInstanceMethods<T = any> {
getFieldsFormatValue?: (nameList?: true, omitNil?: boolean) => T;
getFieldFormatValue?: (nameList?: NamePath) => T;
getFieldFormatValueObject?: (nameList?: NamePath) => T;
validateFieldsReturnFormatValue?: (nameList?: NamePath[]) => Promise<T>;
setFieldsValue: (values: Record<string, any>) => void;
setFieldValue: (name: NamePath, value: any) => void;
}
export interface ProFormContextProp<T = any> {
formRef: Ref<FormInstance | undefined>;
formModel: Ref<Record<string, any>>;
formMethods?: ProFormInstanceMethods<T>;
}
export declare function useProvideProFormContext<T = any>(props: ProFormContextProp<T>): void;
export declare function useInjectProFormContext<T = any>(): ProFormContextProp<any>;