UNPKG

5 kBTypeScriptView Raw
1import { Action } from "redux";
2import { FormErrors, FormWarnings, FieldType } from "../index";
3
4export interface FormAction extends Action {
5 meta?: any;
6 payload?: any;
7 error?: any;
8}
9
10export declare function arrayInsert(form: string, field: string, index: number, value: any): FormAction;
11export declare function arrayMove(form: string, field: string, from: number, to: number): FormAction;
12export declare function arrayPop(form: string, field: string): FormAction;
13export declare function arrayPush(form: string, field: string, value: any): FormAction;
14export declare function arrayRemove(form: string, field: string, index: number): FormAction;
15export declare function arrayRemoveAll(form: string, field: string): FormAction;
16export declare function arrayShift(form: string, field: string): FormAction;
17export declare function arraySplice(form: string, field: string, index: number, removeNum: number, value: any): FormAction;
18export declare function arraySwap(form: string, field: string, indexA: number, indexB: number): FormAction;
19export declare function arrayUnshift(form: string, field: string, value: any): FormAction;
20export declare function autofill(form: string, field: string, value: any): FormAction;
21export declare function blur(form: string, field: string, value: any, touch?: boolean): FormAction;
22export declare function change(form: string, field: string, value: any, touch?: boolean, persistentSubmitErrors?: boolean): FormAction;
23export declare function destroy(...form: string[]): FormAction;
24export declare function focus(form: string, field: string): FormAction;
25
26export interface InitializeOptions {
27 keepDirty: boolean;
28 keepSubmitSucceeded: boolean;
29 updateUnregisteredFields: boolean;
30 keepValues: boolean;
31}
32
33export declare function initialize(form: string, data: any, keepDirty?: boolean, options?: Partial<InitializeOptions>): FormAction;
34export declare function initialize(form: string, data: any, options?: Partial<InitializeOptions>): FormAction;
35export declare function registerField(form: string, name: string, type: FieldType): FormAction;
36export declare function reset(form: string): FormAction;
37export declare function resetSection(form: string, ...sections: string[]): FormAction;
38export declare function startAsyncValidation(form: string): FormAction;
39export declare function stopAsyncValidation(form: string, errors?: FormErrors<any, any>): FormAction;
40export declare function setSubmitFailed(form: string, ...fields: string[]): FormAction;
41export declare function setSubmitSucceeded(form: string, ...fields: string[]): FormAction;
42export declare function startSubmit(form: string): FormAction;
43export declare function stopSubmit(form: string, errors?: FormErrors<any, any>): FormAction;
44export declare function submit(form: string): FormAction;
45export declare function clearSubmit(form: string): FormAction;
46export declare function clearSubmitErrors(form: string): FormAction;
47export declare function clearAsyncError(form: string, field: string): FormAction;
48export declare function clearFields(form: string, keepTouched: boolean, persistentSubmitErrors: boolean, ...fields: string[]): FormAction;
49export declare function touch(form: string, ...fields: string[]): FormAction;
50export declare function unregisterField(form: string, name: string): FormAction;
51export declare function untouch(form: string, ...fields: string[]): FormAction;
52export declare function updateSyncErrors<T = any>(form: string, syncErrors: FormErrors<any, T>, error: T): FormAction;
53export declare function updateSyncWarnings<T = any>(form: string, syncWarnings: FormWarnings<any, T>, warning: T): FormAction;
54
55declare const actions: {
56 arrayInsert: typeof arrayInsert,
57 arrayMove: typeof arrayMove,
58 arrayPop: typeof arrayPop,
59 arrayPush: typeof arrayPush,
60 arrayRemove: typeof arrayRemove,
61 arrayRemoveAll: typeof arrayRemoveAll,
62 arrayShift: typeof arrayShift,
63 arraySplice: typeof arraySplice,
64 arraySwap: typeof arraySwap,
65 arrayUnshift: typeof arrayUnshift,
66 autofill: typeof autofill,
67 blur: typeof blur,
68 change: typeof change,
69 clearSubmit: typeof clearSubmit,
70 clearSubmitErrors: typeof clearSubmitErrors,
71 clearAsyncError: typeof clearAsyncError,
72 clearFields: typeof clearFields,
73 destroy: typeof destroy,
74 focus: typeof focus,
75 initialize: typeof initialize,
76 registerField: typeof registerField,
77 reset: typeof reset,
78 resetSection: typeof resetSection,
79 startAsyncValidation: typeof startAsyncValidation,
80 startSubmit: typeof startSubmit,
81 stopAsyncValidation: typeof stopAsyncValidation,
82 stopSubmit: typeof stopSubmit,
83 submit: typeof submit,
84 setSubmitFailed: typeof setSubmitFailed,
85 setSubmitSucceeded: typeof setSubmitSucceeded,
86 touch: typeof touch,
87 unregisterField: typeof unregisterField,
88 untouch: typeof untouch,
89 updateSyncErrors: typeof updateSyncErrors,
90 updateSyncWarnings: typeof updateSyncWarnings
91};
92
93export default actions;