2
2
3
3
Object . defineProperty ( exports , '__esModule' , { value : true } ) ;
4
4
5
- function _interopDefault ( ex ) { return ( ex && ( typeof ex === 'object' ) && 'default' in ex ) ? ex [ 'default' ] : ex ; }
6
-
7
5
var reactFormutil = require ( 'react-formutil' ) ;
8
6
var React = require ( 'react' ) ;
9
- var React__default = _interopDefault ( React ) ;
10
- var reactIs = require ( 'react-is' ) ;
11
- var PropTypes = _interopDefault ( require ( 'prop-types' ) ) ;
7
+ var PropTypes = require ( 'prop-types' ) ;
12
8
var reactBootstrap = require ( 'react-bootstrap' ) ;
13
- var isEqual = _interopDefault ( require ( 'react-fast-compare' ) ) ;
9
+ var reactIs = require ( 'react-is' ) ;
10
+ var isEqual = require ( 'react-fast-compare' ) ;
11
+
12
+ function _interopDefaultLegacy ( e ) { return e && typeof e === 'object' && 'default' in e ? e : { 'default' : e } ; }
13
+
14
+ var React__default = /*#__PURE__*/ _interopDefaultLegacy ( React ) ;
15
+ var PropTypes__default = /*#__PURE__*/ _interopDefaultLegacy ( PropTypes ) ;
16
+ var reactIs__default = /*#__PURE__*/ _interopDefaultLegacy ( reactIs ) ;
17
+ var isEqual__default = /*#__PURE__*/ _interopDefaultLegacy ( isEqual ) ;
14
18
15
19
function _defineProperty ( obj , key , value ) {
16
20
if ( key in obj ) {
@@ -175,6 +179,36 @@ function _createClass(Constructor, protoProps, staticProps) {
175
179
176
180
var createClass = _createClass ;
177
181
182
+ var setPrototypeOf = createCommonjsModule ( function ( module ) {
183
+ function _setPrototypeOf ( o , p ) {
184
+ module . exports = _setPrototypeOf = Object . setPrototypeOf || function _setPrototypeOf ( o , p ) {
185
+ o . __proto__ = p ;
186
+ return o ;
187
+ } ;
188
+
189
+ return _setPrototypeOf ( o , p ) ;
190
+ }
191
+
192
+ module . exports = _setPrototypeOf ;
193
+ } ) ;
194
+
195
+ function _inherits ( subClass , superClass ) {
196
+ if ( typeof superClass !== "function" && superClass !== null ) {
197
+ throw new TypeError ( "Super expression must either be null or a function" ) ;
198
+ }
199
+
200
+ subClass . prototype = Object . create ( superClass && superClass . prototype , {
201
+ constructor : {
202
+ value : subClass ,
203
+ writable : true ,
204
+ configurable : true
205
+ }
206
+ } ) ;
207
+ if ( superClass ) setPrototypeOf ( subClass , superClass ) ;
208
+ }
209
+
210
+ var inherits = _inherits ;
211
+
178
212
var getPrototypeOf = createCommonjsModule ( function ( module ) {
179
213
function _getPrototypeOf ( o ) {
180
214
module . exports = _getPrototypeOf = Object . setPrototypeOf ? Object . getPrototypeOf : function _getPrototypeOf ( o ) {
@@ -222,11 +256,12 @@ function _possibleConstructorReturn(self, call) {
222
256
var possibleConstructorReturn = _possibleConstructorReturn ;
223
257
224
258
function _createSuper ( Derived ) {
225
- return function ( ) {
259
+ var hasNativeReflectConstruct = isNativeReflectConstruct ( ) ;
260
+ return function _createSuperInternal ( ) {
226
261
var Super = getPrototypeOf ( Derived ) ,
227
262
result ;
228
263
229
- if ( isNativeReflectConstruct ( ) ) {
264
+ if ( hasNativeReflectConstruct ) {
230
265
var NewTarget = getPrototypeOf ( this ) . constructor ;
231
266
result = Reflect . construct ( Super , arguments , NewTarget ) ;
232
267
} else {
@@ -239,36 +274,6 @@ function _createSuper(Derived) {
239
274
240
275
var createSuper = _createSuper ;
241
276
242
- var setPrototypeOf = createCommonjsModule ( function ( module ) {
243
- function _setPrototypeOf ( o , p ) {
244
- module . exports = _setPrototypeOf = Object . setPrototypeOf || function _setPrototypeOf ( o , p ) {
245
- o . __proto__ = p ;
246
- return o ;
247
- } ;
248
-
249
- return _setPrototypeOf ( o , p ) ;
250
- }
251
-
252
- module . exports = _setPrototypeOf ;
253
- } ) ;
254
-
255
- function _inherits ( subClass , superClass ) {
256
- if ( typeof superClass !== "function" && superClass !== null ) {
257
- throw new TypeError ( "Super expression must either be null or a function" ) ;
258
- }
259
-
260
- subClass . prototype = Object . create ( superClass && superClass . prototype , {
261
- constructor : {
262
- value : subClass ,
263
- writable : true ,
264
- configurable : true
265
- }
266
- } ) ;
267
- if ( superClass ) setPrototypeOf ( subClass , superClass ) ;
268
- }
269
-
270
- var inherits = _inherits ;
271
-
272
277
var CheckboxGroup = /*#__PURE__*/ function ( _Component ) {
273
278
inherits ( CheckboxGroup , _Component ) ;
274
279
@@ -305,7 +310,7 @@ var CheckboxGroup = /*#__PURE__*/function (_Component) {
305
310
306
311
return React . Children . map ( children , function ( child ) {
307
312
var childValue = child . props . value ;
308
- return React . cloneElement ( child , {
313
+ return /*#__PURE__*/ React . cloneElement ( child , {
309
314
isValid : isValid ,
310
315
isInvalid : isInvalid ,
311
316
checked : ! ! value && value . indexOf ( childValue ) > - 1 ,
@@ -323,10 +328,10 @@ var CheckboxGroup = /*#__PURE__*/function (_Component) {
323
328
324
329
CheckboxGroup . formutilType = 'array' ;
325
330
CheckboxGroup . propTypes = {
326
- onChange : PropTypes . func ,
327
- onFocus : PropTypes . func ,
328
- onBlur : PropTypes . func ,
329
- value : PropTypes . array
331
+ onChange : PropTypes__default [ 'default' ] . func ,
332
+ onFocus : PropTypes__default [ 'default' ] . func ,
333
+ onBlur : PropTypes__default [ 'default' ] . func ,
334
+ value : PropTypes__default [ 'default' ] . array
330
335
} ;
331
336
332
337
var styleSheet ;
@@ -348,7 +353,9 @@ function insertRule(selector, content) {
348
353
}
349
354
}
350
355
351
- var _createContext = React . createContext ( { } ) ,
356
+ var isValidElementType = reactIs__default [ 'default' ] . isValidElementType ;
357
+
358
+ var _createContext = /*#__PURE__*/ React . createContext ( { } ) ,
352
359
Consumer = _createContext . Consumer ,
353
360
Provider = _createContext . Provider ;
354
361
@@ -368,7 +375,7 @@ function getChildComponent(children) {
368
375
if ( children ) {
369
376
var childrenType = children . type ;
370
377
371
- if ( reactIs . isValidElementType ( childrenType ) ) {
378
+ if ( isValidElementType ( childrenType ) ) {
372
379
// SomeComponent.formutiType = xx
373
380
if ( childrenType . formutilType ) {
374
381
return childrenType . formutilType ;
@@ -473,10 +480,10 @@ var _FormGroup = /*#__PURE__*/function (_Component) {
473
480
return {
474
481
groupProps : groupProps ,
475
482
validationProps : validationProps ,
476
- error : hasError ? /*#__PURE__*/ React__default . createElement ( HelpBlock , {
483
+ error : hasError ? /*#__PURE__*/ React__default [ 'default' ] . createElement ( HelpBlock , {
477
484
type : "invalid"
478
485
} , Array . isArray ( $errors ) ? $errors . map ( function ( err , index ) {
479
- return /*#__PURE__*/ React__default . createElement ( "div" , {
486
+ return /*#__PURE__*/ React__default [ 'default' ] . createElement ( "div" , {
480
487
key : index
481
488
} , err ) ;
482
489
} ) : $errors ) : null
@@ -529,14 +536,14 @@ var _FormGroup = /*#__PURE__*/function (_Component) {
529
536
var groupAsProps = ! as && ( labelCol || wrapperCol ) ? reactBootstrap . Row : as ;
530
537
531
538
if ( label ) {
532
- if ( React . isValidElement ( label ) ) {
539
+ if ( /*#__PURE__*/ React . isValidElement ( label ) ) {
533
540
if ( labelCol ) {
534
- label = React . cloneElement ( label , objectSpread2 ( {
541
+ label = /*#__PURE__*/ React . cloneElement ( label , objectSpread2 ( {
535
542
column : true
536
543
} , labelCol ) ) ;
537
544
}
538
545
} else {
539
- label = /*#__PURE__*/ React__default . createElement ( reactBootstrap . FormLabel , Object . assign ( {
546
+ label = /*#__PURE__*/ React__default [ 'default' ] . createElement ( reactBootstrap . FormLabel , Object . assign ( {
540
547
column : ! ! labelCol
541
548
} , labelCol ) , label ) ;
542
549
}
@@ -549,18 +556,18 @@ var _FormGroup = /*#__PURE__*/function (_Component) {
549
556
550
557
if ( addons ) {
551
558
if ( addons . pre ) {
552
- addons . pre = /*#__PURE__*/ React__default . createElement ( reactBootstrap . InputGroup . Prepend , null , React . isValidElement ( addons . pre ) ? addons . pre : /*#__PURE__*/ React__default . createElement ( reactBootstrap . InputGroup . Text , null , addons . pre ) ) ;
559
+ addons . pre = /*#__PURE__*/ React__default [ 'default' ] . createElement ( reactBootstrap . InputGroup . Prepend , null , /*#__PURE__*/ React . isValidElement ( addons . pre ) ? addons . pre : /*#__PURE__*/ React__default [ 'default' ] . createElement ( reactBootstrap . InputGroup . Text , null , addons . pre ) ) ;
553
560
}
554
561
555
562
if ( addons . end ) {
556
- addons . end = /*#__PURE__*/ React__default . createElement ( reactBootstrap . InputGroup . Append , null , React . isValidElement ( addons . end ) ? addons . end : /*#__PURE__*/ React__default . createElement ( reactBootstrap . InputGroup . Text , null , addons . end ) ) ;
563
+ addons . end = /*#__PURE__*/ React__default [ 'default' ] . createElement ( reactBootstrap . InputGroup . Append , null , /*#__PURE__*/ React . isValidElement ( addons . end ) ? addons . end : /*#__PURE__*/ React__default [ 'default' ] . createElement ( reactBootstrap . InputGroup . Text , null , addons . end ) ) ;
557
564
}
558
565
} else {
559
566
addons = { } ;
560
567
}
561
568
562
- if ( helper && ! React . isValidElement ( helper ) ) {
563
- helper = /*#__PURE__*/ React__default . createElement ( reactBootstrap . FormText , {
569
+ if ( helper && ! /*#__PURE__*/ React . isValidElement ( helper ) ) {
570
+ helper = /*#__PURE__*/ React__default [ 'default' ] . createElement ( reactBootstrap . FormText , {
564
571
className : "text-muted"
565
572
} , helper ) ;
566
573
}
@@ -575,15 +582,15 @@ var _FormGroup = /*#__PURE__*/function (_Component) {
575
582
576
583
577
584
Promise . resolve ( ) . then ( function ( ) {
578
- if ( ! isEqual ( _this2 . latestValidationProps , _this2 . fetchCurrentValidationProps ( errorLevel ) ) ) {
585
+ if ( ! isEqual__default [ 'default' ] ( _this2 . latestValidationProps , _this2 . fetchCurrentValidationProps ( errorLevel ) ) ) {
579
586
_this2 . forceUpdate ( ) ;
580
587
}
581
588
} ) ;
582
- return /*#__PURE__*/ React__default . createElement ( Provider , {
589
+ return /*#__PURE__*/ React__default [ 'default' ] . createElement ( Provider , {
583
590
value : this . registerField
584
- } , /*#__PURE__*/ React__default . createElement ( reactBootstrap . FormGroup , Object . assign ( { } , fieldProps , groupProps , {
591
+ } , /*#__PURE__*/ React__default [ 'default' ] . createElement ( reactBootstrap . FormGroup , Object . assign ( { } , fieldProps , groupProps , {
585
592
as : groupAsProps
586
- } ) , label , /*#__PURE__*/ React__default . createElement ( Wrapper , wrapperCol , /*#__PURE__*/ React__default . createElement ( AddonWrapper , addonWrapperProps , addons . pre , typeof childList === 'function' ? childList ( ) : childList , addons . end ) , error || helper ) , extraNode ) ) ;
593
+ } ) , label , /*#__PURE__*/ React__default [ 'default' ] . createElement ( Wrapper , wrapperCol , /*#__PURE__*/ React__default [ 'default' ] . createElement ( AddonWrapper , addonWrapperProps , addons . pre , typeof childList === 'function' ? childList ( ) : childList , addons . end ) , error || helper ) , extraNode ) ) ;
587
594
} // If $memo is true, pass the children to Field for SCU diffing.
588
595
589
596
@@ -629,7 +636,7 @@ var _FormGroup = /*#__PURE__*/function (_Component) {
629
636
break ;
630
637
}
631
638
632
- return /*#__PURE__*/ React__default . createElement ( reactFormutil . EasyField , Object . assign ( { } , fieldProps , {
639
+ return /*#__PURE__*/ React__default [ 'default' ] . createElement ( reactFormutil . EasyField , Object . assign ( { } , fieldProps , {
633
640
passUtil : "$fieldutil" ,
634
641
render : function render ( $handleProps ) {
635
642
var _childProps , _Object$assign ;
@@ -725,17 +732,17 @@ var _FormGroup = /*#__PURE__*/function (_Component) {
725
732
error = _this2$getValidationP . error ;
726
733
727
734
childProps = Object . assign ( ( _Object$assign = { } , defineProperty ( _Object$assign , focusPropName , onFocus ) , defineProperty ( _Object$assign , blurPropName , onBlur ) , _Object$assign ) , childProps , validationProps ) ;
728
- var fieldInstance = typeof children === 'function' ? children ( childProps ) : React . cloneElement ( children , childProps ) ;
729
- return /*#__PURE__*/ React__default . createElement ( Consumer , null , function ( registerField ) {
735
+ var fieldInstance = typeof children === 'function' ? children ( childProps ) : /*#__PURE__*/ React . cloneElement ( children , childProps ) ;
736
+ return /*#__PURE__*/ React__default [ 'default' ] . createElement ( Consumer , null , function ( registerField ) {
730
737
if ( noStyle ) {
731
738
_this2 . $fieldutil = $fieldutil ;
732
739
_this2 . registerAncestorField = registerField ;
733
740
return fieldInstance ;
734
741
}
735
742
736
- return /*#__PURE__*/ React__default . createElement ( reactBootstrap . FormGroup , Object . assign ( { } , restProps , groupProps , {
743
+ return /*#__PURE__*/ React__default [ 'default' ] . createElement ( reactBootstrap . FormGroup , Object . assign ( { } , restProps , groupProps , {
737
744
as : groupAsProps
738
- } ) , label , /*#__PURE__*/ React__default . createElement ( Wrapper , wrapperCol , /*#__PURE__*/ React__default . createElement ( AddonWrapper , addonWrapperProps , addons . pre , fieldInstance , addons . end ) , error || helper ) , extraNode ) ;
745
+ } ) , label , /*#__PURE__*/ React__default [ 'default' ] . createElement ( Wrapper , wrapperCol , /*#__PURE__*/ React__default [ 'default' ] . createElement ( AddonWrapper , addonWrapperProps , addons . pre , fieldInstance , addons . end ) , error || helper ) , extraNode ) ;
739
746
} ) ;
740
747
}
741
748
} ) ) ;
@@ -756,20 +763,20 @@ _FormGroup.propTypes = {
756
763
if ( 'name' in props ) {
757
764
var _PropTypes$oneOfType ;
758
765
759
- return ( _PropTypes$oneOfType = PropTypes . oneOfType ( [ PropTypes . element , PropTypes . func ] ) ) . isRequired . apply ( _PropTypes$oneOfType , [ props ] . concat ( args ) ) ;
766
+ return ( _PropTypes$oneOfType = PropTypes__default [ 'default' ] . oneOfType ( [ PropTypes__default [ 'default' ] . element , PropTypes__default [ 'default' ] . func ] ) ) . isRequired . apply ( _PropTypes$oneOfType , [ props ] . concat ( args ) ) ;
760
767
}
761
768
762
- return ( _PropTypes$node = PropTypes . node ) . isRequired . apply ( _PropTypes$node , [ props ] . concat ( args ) ) ;
769
+ return ( _PropTypes$node = PropTypes__default [ 'default' ] . node ) . isRequired . apply ( _PropTypes$node , [ props ] . concat ( args ) ) ;
763
770
} ,
764
- label : PropTypes . any ,
765
- helper : PropTypes . any ,
766
- labelCol : PropTypes . object ,
767
- wrapperCol : PropTypes . object ,
768
- addons : PropTypes . object ,
769
- extra : PropTypes . node ,
770
- feedback : PropTypes . bool ,
771
- noStyle : PropTypes . bool ,
772
- errorLevel : PropTypes . oneOf ( [ 0 , 1 , 2 , 'off' ] ) // $parser $formatter checked unchecked $validators validMessage等传递给 EasyField 组件的额外参数
771
+ label : PropTypes__default [ 'default' ] . any ,
772
+ helper : PropTypes__default [ 'default' ] . any ,
773
+ labelCol : PropTypes__default [ 'default' ] . object ,
774
+ wrapperCol : PropTypes__default [ 'default' ] . object ,
775
+ addons : PropTypes__default [ 'default' ] . object ,
776
+ extra : PropTypes__default [ 'default' ] . node ,
777
+ feedback : PropTypes__default [ 'default' ] . bool ,
778
+ noStyle : PropTypes__default [ 'default' ] . bool ,
779
+ errorLevel : PropTypes__default [ 'default' ] . oneOf ( [ 0 , 1 , 2 , 'off' ] ) // $parser $formatter checked unchecked $validators validMessage等传递给 EasyField 组件的额外参数
773
780
774
781
} ;
775
782
insertRule ( '.valid-feedback:empty,.invalid-feedback:empty' , 'display: none !important' ) ;
@@ -805,7 +812,7 @@ var RadioGroup = /*#__PURE__*/function (_Component) {
805
812
806
813
return React . Children . map ( children , function ( child ) {
807
814
var childValue = child . props . value ;
808
- return React . cloneElement ( child , {
815
+ return /*#__PURE__*/ React . cloneElement ( child , {
809
816
isValid : isValid ,
810
817
isInvalid : isInvalid ,
811
818
checked : value === childValue ,
@@ -822,10 +829,10 @@ var RadioGroup = /*#__PURE__*/function (_Component) {
822
829
} ( React . Component ) ;
823
830
824
831
RadioGroup . propTypes = {
825
- onChange : PropTypes . func ,
826
- onFocus : PropTypes . func ,
827
- onBlur : PropTypes . func ,
828
- value : PropTypes . string
832
+ onChange : PropTypes__default [ 'default' ] . func ,
833
+ onFocus : PropTypes__default [ 'default' ] . func ,
834
+ onBlur : PropTypes__default [ 'default' ] . func ,
835
+ value : PropTypes__default [ 'default' ] . string
829
836
} ;
830
837
831
838
Object . keys ( reactFormutil ) . forEach ( function ( k ) {
0 commit comments