UNPKG

6.48 kBJavaScriptView Raw
1"use strict";
2
3var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
5exports.__esModule = true;
6exports["default"] = exports.fieldArrayPropTypes = exports.fieldPropTypes = exports.fieldArrayFieldsPropTypes = exports.fieldArrayMetaPropTypes = exports.fieldMetaPropTypes = exports.fieldInputPropTypes = exports.formPropTypes = void 0;
7
8var _propTypes = _interopRequireDefault(require("prop-types"));
9
10var any = _propTypes["default"].any,
11 bool = _propTypes["default"].bool,
12 func = _propTypes["default"].func,
13 shape = _propTypes["default"].shape,
14 string = _propTypes["default"].string,
15 oneOfType = _propTypes["default"].oneOfType,
16 object = _propTypes["default"].object,
17 number = _propTypes["default"].number;
18var formPropTypes = {
19 // State:
20 anyTouched: bool.isRequired,
21 // true if any of the fields have been marked as touched
22 asyncValidating: oneOfType([bool, string]).isRequired,
23 // true if async validation is running, a string if a field triggered async validation
24 dirty: bool.isRequired,
25 // true if any values are different from initialValues
26 error: any,
27 // form-wide error from '_error' key in validation result
28 form: string.isRequired,
29 // the name of the form
30 invalid: bool.isRequired,
31 // true if there are any validation errors
32 initialized: bool.isRequired,
33 // true if the form has been initialized
34 initialValues: object,
35 // the initialValues object passed to reduxForm
36 pristine: bool.isRequired,
37 // true if the values are the same as initialValues
38 pure: bool.isRequired,
39 // if true, implements shouldComponentUpdate
40 submitting: bool.isRequired,
41 // true if the form is in the process of being submitted
42 submitAsSideEffect: bool.isRequired,
43 // true if onSubmit result will be dispatched
44 submitFailed: bool.isRequired,
45 // true if the form was submitted and failed for any reason
46 submitSucceeded: bool.isRequired,
47 // true if the form was successfully submitted
48 valid: bool.isRequired,
49 // true if there are no validation errors
50 warning: any,
51 // form-wide warning from '_warning' key in validation result
52 // Actions:
53 array: shape({
54 insert: func.isRequired,
55 // function to insert a value into an array field
56 move: func.isRequired,
57 // function to move a value within an array field
58 pop: func.isRequired,
59 // function to pop a value off of an array field
60 push: func.isRequired,
61 // function to push a value onto an array field
62 remove: func.isRequired,
63 // function to remove a value from an array field
64 removeAll: func.isRequired,
65 // function to remove all the values from an array field
66 shift: func.isRequired,
67 // function to shift a value out of an array field
68 splice: func.isRequired,
69 // function to splice a value into an array field
70 swap: func.isRequired,
71 // function to swap values in an array field
72 unshift: func.isRequired // function to unshift a value into an array field
73
74 }),
75 asyncValidate: func.isRequired,
76 // function to trigger async validation
77 autofill: func.isRequired,
78 // action to set a value of a field and mark it as autofilled
79 blur: func.isRequired,
80 // action to mark a field as blurred
81 change: func.isRequired,
82 // action to change the value of a field
83 clearAsyncError: func.isRequired,
84 // action to clear the async error of a field
85 clearFields: func.isRequired,
86 // action to clean fields values for all fields
87 clearSubmitErrors: func.isRequired,
88 // action to remove submitErrors and error
89 destroy: func.isRequired,
90 // action to destroy the form's data in Redux
91 dispatch: func.isRequired,
92 // the Redux dispatch action
93 handleSubmit: func.isRequired,
94 // function to submit the form
95 initialize: func.isRequired,
96 // action to initialize form data
97 reset: func.isRequired,
98 // action to reset the form data to previously initialized values
99 resetSection: func.isRequired,
100 // action to reset the form sections data to previously initialized values
101 touch: func.isRequired,
102 // action to mark fields as touched
103 submit: func.isRequired,
104 // action to trigger a submission of the specified form
105 untouch: func.isRequired,
106 // action to mark fields as untouched
107 // triggerSubmit
108 triggerSubmit: bool,
109 // if true, submits the form on componentWillReceiveProps
110 clearSubmit: func.isRequired // called before a triggered submit, by default clears triggerSubmit
111
112};
113exports.formPropTypes = formPropTypes;
114var fieldInputPropTypes = {
115 checked: bool,
116 name: string.isRequired,
117 onBlur: func.isRequired,
118 onChange: func.isRequired,
119 onDragStart: func.isRequired,
120 onDrop: func.isRequired,
121 onFocus: func.isRequired,
122 value: any
123};
124exports.fieldInputPropTypes = fieldInputPropTypes;
125var fieldMetaPropTypes = {
126 active: bool.isRequired,
127 asyncValidating: bool.isRequired,
128 autofilled: bool.isRequired,
129 dirty: bool.isRequired,
130 dispatch: func.isRequired,
131 error: any,
132 form: string.isRequired,
133 invalid: bool.isRequired,
134 pristine: bool.isRequired,
135 submitting: bool.isRequired,
136 submitFailed: bool.isRequired,
137 touched: bool.isRequired,
138 valid: bool.isRequired,
139 visited: bool.isRequired,
140 warning: string
141};
142exports.fieldMetaPropTypes = fieldMetaPropTypes;
143var fieldArrayMetaPropTypes = {
144 dirty: bool.isRequired,
145 error: any,
146 form: string.isRequired,
147 invalid: bool.isRequired,
148 pristine: bool.isRequired,
149 submitFailed: bool,
150 submitting: bool,
151 valid: bool.isRequired,
152 warning: string
153};
154exports.fieldArrayMetaPropTypes = fieldArrayMetaPropTypes;
155var fieldArrayFieldsPropTypes = {
156 name: string.isRequired,
157 forEach: func.isRequired,
158 get: func.isRequired,
159 getAll: func.isRequired,
160 insert: func.isRequired,
161 length: number.isRequired,
162 map: func.isRequired,
163 move: func.isRequired,
164 pop: func.isRequired,
165 push: func.isRequired,
166 reduce: func.isRequired,
167 remove: func.isRequired,
168 removeAll: func.isRequired,
169 shift: func.isRequired,
170 swap: func.isRequired,
171 unshift: func.isRequired
172};
173exports.fieldArrayFieldsPropTypes = fieldArrayFieldsPropTypes;
174var fieldPropTypes = {
175 input: shape(fieldInputPropTypes).isRequired,
176 meta: shape(fieldMetaPropTypes).isRequired
177};
178exports.fieldPropTypes = fieldPropTypes;
179var fieldArrayPropTypes = {
180 fields: shape(fieldArrayFieldsPropTypes).isRequired,
181 meta: shape(fieldArrayMetaPropTypes).isRequired
182};
183exports.fieldArrayPropTypes = fieldArrayPropTypes;
184var _default = formPropTypes;
185exports["default"] = _default;
\No newline at end of file