1 | import { Reducer } from "redux";
|
2 | import { FieldType } from "../index";
|
3 |
|
4 | export interface FormReducer extends Reducer<FormStateMap> {
|
5 | plugin(reducers: FormReducerMapObject): Reducer<FormStateMap>;
|
6 | }
|
7 |
|
8 | export const reducer: FormReducer;
|
9 |
|
10 | export interface FormReducerMapObject {
|
11 |
|
12 |
|
13 | [formName: string]: Reducer<any>;
|
14 | }
|
15 |
|
16 | export interface FormStateMap {
|
17 | [formName: string]: FormState;
|
18 | }
|
19 |
|
20 | export interface FormState {
|
21 | registeredFields: RegisteredFieldState[];
|
22 | fields?: { [name: string]: FieldState } | undefined;
|
23 | values?: { [fieldName: string]: any } | undefined;
|
24 | active?: string | undefined;
|
25 | anyTouched?: boolean | undefined;
|
26 | error?: any;
|
27 | submitting?: boolean | undefined;
|
28 | submitErrors?: { [fieldName: string]: string } | undefined;
|
29 | submitFailed?: boolean | undefined;
|
30 | }
|
31 |
|
32 | export interface RegisteredFieldState {
|
33 | name: string;
|
34 | type: FieldType;
|
35 | count: number;
|
36 | }
|
37 |
|
38 | export interface FieldState {
|
39 | active?: boolean | undefined;
|
40 | touched?: boolean | undefined;
|
41 | visited?: boolean | undefined;
|
42 | }
|
43 |
|
44 | export default reducer;
|