test-nut-ui
Version:
<p align="center"> <img alt="logo" src="https://img11.360buyimg.com/imagetools/jfs/t1/211965/25/7152/22022/61b16785E433119bb/aa41d7a9f7e823f3.png" width="150" style="margin-bottom: 10px;"> </p>
35 lines (34 loc) • 1.02 kB
TypeScript
export interface FormItemRuleWithoutValidator {
[key: string]: any;
regex?: RegExp;
required?: boolean;
message?: string;
}
export type StoreValue = any;
export type NamePath = string | number;
export interface Callbacks<Values = any> {
onValuesChange?: (values: Values) => void;
onFinish?: (values: Values) => void;
onFinishFailed?: (values: Values, errorFields: any) => void;
}
export interface Store {
[name: string]: any;
}
export interface FormInstance<Values = any> {
registerField: (entity: FieldEntity) => () => void;
getFieldValue: (name: NamePath) => StoreValue;
setFieldsValue: (value: any) => void;
resetFields: (fields?: NamePath[]) => void;
submit: () => void;
setCallback: (callbacks: Callbacks) => void;
}
export interface FieldEntity {
onStoreChange: (type?: string) => void;
getNamePath: () => NamePath;
props: {
name: NamePath;
rules?: any[];
dependencies?: NamePath[];
initialValue?: any;
};
}