/// /** * 层级 */ export interface ILevel { key?: number; name?: string; } export interface IObject { [key: string]: T; } export declare type TinitialValueType = null | undefined | string | number | boolean; /** * 每一个单元格的信息 */ export interface IFormItemData { /** 每个formItem的值 */ value: TinitialValueType; /** 每个formItem的错误信息 */ errorMsg: string | undefined; /** 每个formItem的校验方法, 返回值为该formItem的错误信息,同时会在formItem下面显示错误信息 */ checkItem: () => string | undefined; /** 给某个formItem设置值 */ setItemValue: (value: TinitialValueType, callback?: () => void) => void; } export interface IForm { /** 记录每一层级的顺序 */ dataLevel: IObject; /** 整个form的数据,{content.0: { id: IFormItemData, value: IFormItemData }} */ formData: IFormData; /** 先校验,并将结果返回 */ validateFields: () => Promise; /** 获取form表单的数据 */ getFieldsValue: () => object; /** 获取formItem的数据 */ getFieldValue: (field: Array) => any; /** 给某些formItem设置数据 */ setFieldsValue: (fileds: IObject) => void; } /** * TntdForm的props */ export interface ITntdFormProps { form: IForm; initialValues: object; children: React.ReactNode; } export interface IUpdateObj { shouldUpdateList: Array; dependencies: IObject; } export interface IFormContext { form?: IForm; initialValues?: IObject; updateRefs: React.MutableRefObject; compsRefs: React.MutableRefObject void>>; } /** formList的props */ export interface IFormListProps { name: string[] | string; children: (dataLevel: ILevel[], { add, remove }: { add: TAddOrRemove; remove: TAddOrRemove; }) => void; } /** 增删事件 */ export declare type TAddOrRemove = (index: number) => void; export declare type IFormItem = { name: string[] | string; children: React.ReactChild | React.ReactChild[]; style: React.CSSProperties; rules: ValidationRule; shouldUpdate: boolean; initialValue: TinitialValueType; dependencies?: Array; } & IFormContext; export interface ValidationRule { /** validation error message */ message?: React.ReactNode; /** indicates whether field is required */ required?: boolean; /** custom validate function (Note: callback must be called) */ validator?: (rule: any, value: any, callback: any) => any; } export interface IFormData { [name: string]: { [attr: string]: IFormItemData; }; } export interface IChildrenCompFun { onRefresh: () => void; } //# sourceMappingURL=interface.d.ts.map