@@ -23,6 +23,37 @@ const defaultStrategy = {
23
23
getFieldFromState,
24
24
} ;
25
25
26
+ const propTypes = {
27
+ // Computed props
28
+ modelValue : PropTypes . any ,
29
+ formValue : PropTypes . object ,
30
+ fieldValue : PropTypes . object ,
31
+
32
+ // Provided props
33
+ model : PropTypes . string . isRequired ,
34
+ messages : PropTypes . objectOf ( PropTypes . oneOfType ( [
35
+ PropTypes . string ,
36
+ PropTypes . func ,
37
+ PropTypes . bool ,
38
+ ] ) ) ,
39
+ show : PropTypes . any ,
40
+ wrapper : PropTypes . oneOfType ( [
41
+ PropTypes . string ,
42
+ PropTypes . func ,
43
+ PropTypes . element ,
44
+ ] ) ,
45
+ component : PropTypes . oneOfType ( [
46
+ PropTypes . string ,
47
+ PropTypes . func ,
48
+ PropTypes . element ,
49
+ ] ) ,
50
+ dispatch : PropTypes . func ,
51
+ dynamic : PropTypes . oneOfType ( [
52
+ PropTypes . bool ,
53
+ PropTypes . arrayOf ( PropTypes . string ) ,
54
+ ] ) ,
55
+ } ;
56
+
26
57
function showErrors ( field , form , show = true ) {
27
58
if ( typeof show === 'function' ) {
28
59
return show ( field , form ) ;
@@ -123,7 +154,7 @@ function createErrorsClass(s = defaultStrategy) {
123
154
124
155
const allowedProps = typeof wrapper === 'function'
125
156
? this . props
126
- : omit ( this . props , Object . keys ( Errors . propTypes ) ) ;
157
+ : omit ( this . props , Object . keys ( propTypes ) ) ;
127
158
128
159
if ( ! showErrors ( fieldValue , formValue , show ) ) {
129
160
return null ;
@@ -142,36 +173,7 @@ function createErrorsClass(s = defaultStrategy) {
142
173
}
143
174
}
144
175
145
- Errors . propTypes = {
146
- // Computed props
147
- modelValue : PropTypes . any ,
148
- formValue : PropTypes . object ,
149
- fieldValue : PropTypes . object ,
150
-
151
- // Provided props
152
- model : PropTypes . string . isRequired ,
153
- messages : PropTypes . objectOf ( PropTypes . oneOfType ( [
154
- PropTypes . string ,
155
- PropTypes . func ,
156
- PropTypes . bool ,
157
- ] ) ) ,
158
- show : PropTypes . any ,
159
- wrapper : PropTypes . oneOfType ( [
160
- PropTypes . string ,
161
- PropTypes . func ,
162
- PropTypes . element ,
163
- ] ) ,
164
- component : PropTypes . oneOfType ( [
165
- PropTypes . string ,
166
- PropTypes . func ,
167
- PropTypes . element ,
168
- ] ) ,
169
- dispatch : PropTypes . func ,
170
- dynamic : PropTypes . oneOfType ( [
171
- PropTypes . bool ,
172
- PropTypes . arrayOf ( PropTypes . string ) ,
173
- ] ) ,
174
- } ;
176
+ Errors . propTypes = propTypes ;
175
177
176
178
Errors . defaultProps = {
177
179
wrapper : 'div' ,
0 commit comments