1
- import toChildrenArray from 'rc-util/lib/Children/toArray' ;
2
- import isEqual from 'rc-util/lib/isEqual' ;
3
- import warning from 'rc-util/lib/warning' ;
1
+ import toChildrenArray from '@ rc-component/ util/lib/Children/toArray' ;
2
+ import isEqual from '@ rc-component/ util/lib/isEqual' ;
3
+ import warning from '@ rc-component/ util/lib/warning' ;
4
4
import * as React from 'react' ;
5
5
import FieldContext , { HOOK_MARK } from './FieldContext' ;
6
6
import type {
@@ -112,11 +112,6 @@ export interface FieldState {
112
112
class Field extends React . Component < InternalFieldProps , FieldState > implements FieldEntity {
113
113
public static contextType = FieldContext ;
114
114
115
- public static defaultProps = {
116
- trigger : 'onChange' ,
117
- valuePropName : 'value' ,
118
- } ;
119
-
120
115
public state = {
121
116
resetCount : 0 ,
122
117
} ;
@@ -548,9 +543,10 @@ class Field extends React.Component<InternalFieldProps, FieldState> implements F
548
543
}
549
544
550
545
// Filed element only
551
- const childList = toChildrenArray ( children ) ;
546
+ const childList = toChildrenArray ( children as any ) ;
547
+
552
548
if ( childList . length !== 1 || ! React . isValidElement ( childList [ 0 ] ) ) {
553
- return { child : childList , isFunction : false } ;
549
+ return { child : childList as React . ReactNode , isFunction : false } ;
554
550
}
555
551
556
552
return { child : childList [ 0 ] , isFunction : false } ;
@@ -566,11 +562,11 @@ class Field extends React.Component<InternalFieldProps, FieldState> implements F
566
562
public getControlled = ( childProps : ChildProps = { } ) => {
567
563
const {
568
564
name,
569
- trigger,
565
+ trigger = 'onChange' ,
570
566
validateTrigger,
571
567
getValueFromEvent,
572
568
normalize,
573
- valuePropName,
569
+ valuePropName = 'value' ,
574
570
getValueProps,
575
571
fieldContext,
576
572
} = this . props ;
0 commit comments