UNPKG

5.1 kBTypeScriptView Raw
1import { Action } from "redux";
2import { FieldType, FormErrors, FormWarnings } 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(
18 form: string,
19 field: string,
20 index: number,
21 removeNum: number,
22 value: any,
23): FormAction;
24export declare function arraySwap(form: string, field: string, indexA: number, indexB: number): FormAction;
25export declare function arrayUnshift(form: string, field: string, value: any): FormAction;
26export declare function autofill(form: string, field: string, value: any): FormAction;
27export declare function blur(form: string, field: string, value: any, touch?: boolean): FormAction;
28export declare function change(
29 form: string,
30 field: string,
31 value: any,
32 touch?: boolean,
33 persistentSubmitErrors?: boolean,
34): FormAction;
35export declare function destroy(...form: string[]): FormAction;
36export declare function focus(form: string, field: string): FormAction;
37
38export interface InitializeOptions {
39 keepDirty: boolean;
40 keepSubmitSucceeded: boolean;
41 updateUnregisteredFields: boolean;
42 keepValues: boolean;
43}
44
45export declare function initialize(
46 form: string,
47 data: any,
48 keepDirty?: boolean,
49 options?: Partial<InitializeOptions>,
50): FormAction;
51export declare function initialize(form: string, data: any, options?: Partial<InitializeOptions>): FormAction;
52export declare function registerField(form: string, name: string, type: FieldType): FormAction;
53export declare function reset(form: string): FormAction;
54export declare function resetSection(form: string, ...sections: string[]): FormAction;
55export declare function startAsyncValidation(form: string): FormAction;
56export declare function stopAsyncValidation(form: string, errors?: FormErrors<any, any>): FormAction;
57export declare function setSubmitFailed(form: string, ...fields: string[]): FormAction;
58export declare function setSubmitSucceeded(form: string, ...fields: string[]): FormAction;
59export declare function startSubmit(form: string): FormAction;
60export declare function stopSubmit(form: string, errors?: FormErrors<any, any>): FormAction;
61export declare function submit(form: string): FormAction;
62export declare function clearSubmit(form: string): FormAction;
63export declare function clearSubmitErrors(form: string): FormAction;
64export declare function clearAsyncError(form: string, field: string): FormAction;
65export declare function clearFields(
66 form: string,
67 keepTouched: boolean,
68 persistentSubmitErrors: boolean,
69 ...fields: string[]
70): FormAction;
71export declare function touch(form: string, ...fields: string[]): FormAction;
72export declare function unregisterField(form: string, name: string): FormAction;
73export declare function untouch(form: string, ...fields: string[]): FormAction;
74export declare function updateSyncErrors<T = any>(form: string, syncErrors: FormErrors<any, T>, error: T): FormAction;
75export declare function updateSyncWarnings<T = any>(
76 form: string,
77 syncWarnings: FormWarnings<any, T>,
78 warning: T,
79): FormAction;
80
81declare const actions: {
82 arrayInsert: typeof arrayInsert;
83 arrayMove: typeof arrayMove;
84 arrayPop: typeof arrayPop;
85 arrayPush: typeof arrayPush;
86 arrayRemove: typeof arrayRemove;
87 arrayRemoveAll: typeof arrayRemoveAll;
88 arrayShift: typeof arrayShift;
89 arraySplice: typeof arraySplice;
90 arraySwap: typeof arraySwap;
91 arrayUnshift: typeof arrayUnshift;
92 autofill: typeof autofill;
93 blur: typeof blur;
94 change: typeof change;
95 clearSubmit: typeof clearSubmit;
96 clearSubmitErrors: typeof clearSubmitErrors;
97 clearAsyncError: typeof clearAsyncError;
98 clearFields: typeof clearFields;
99 destroy: typeof destroy;
100 focus: typeof focus;
101 initialize: typeof initialize;
102 registerField: typeof registerField;
103 reset: typeof reset;
104 resetSection: typeof resetSection;
105 startAsyncValidation: typeof startAsyncValidation;
106 startSubmit: typeof startSubmit;
107 stopAsyncValidation: typeof stopAsyncValidation;
108 stopSubmit: typeof stopSubmit;
109 submit: typeof submit;
110 setSubmitFailed: typeof setSubmitFailed;
111 setSubmitSucceeded: typeof setSubmitSucceeded;
112 touch: typeof touch;
113 unregisterField: typeof unregisterField;
114 untouch: typeof untouch;
115 updateSyncErrors: typeof updateSyncErrors;
116 updateSyncWarnings: typeof updateSyncWarnings;
117};
118
119export default actions;