Add resetSection action, initialize props

This commit is contained in:
Zhang Yijiang
2018-06-01 11:32:19 +08:00
parent 4cce589580
commit eac6ce3cab
3 changed files with 5 additions and 0 deletions
+1
View File
@@ -21,6 +21,7 @@ export interface ActionTypes {
INITIALIZE: string;
REGISTER_FIELD: string;
RESET: string;
RESET_SECTION: string;
SET_SUBMIT_FAILED: string;
SET_SUBMIT_SUCCEEDED: string;
START_ASYNC_VALIDATION: string;
+3
View File
@@ -26,11 +26,14 @@ export declare function focus(form: string, field: string): FormAction;
export interface InitializeOptions {
keepDirty: boolean;
keepSubmitSucceeded: boolean;
updateUnregisteredFields: boolean;
keepValues: boolean;
}
export declare function initialize(form: string, data: any, keepDirty?: boolean | InitializeOptions, options?: InitializeOptions): FormAction;
export declare function registerField(form: string, name: string, type: FieldType): FormAction;
export declare function reset(form: string): FormAction;
export declare function resetSection(form: string, ...sections: string[]): FormAction;
export declare function startAsyncValidation(form: string): FormAction;
export declare function stopAsyncValidation(form: string, errors?: any): FormAction;
export declare function setSubmitFailed(form: string, ...fields: string[]): FormAction;
+1
View File
@@ -133,6 +133,7 @@ export interface FormInstance<FormData, P> extends Component<P> {
pristine: boolean;
registeredFields: RegisteredFieldState[];
reset(): void;
resetSection(...sections: string[]): void;
submit(): Promise<any>;
valid: boolean;
values: Partial<FormData>;