@@ -27,10 +27,8 @@ import {
2727} from './utils/valueUtil' ;
2828
2929interface ChildProps {
30- value ?: StoreValue ;
31- onChange ?: ( ...args : EventArgs ) => void ;
32- onFocus ?: ( ...args : EventArgs ) => void ;
33- onBlur ?: ( ...args : EventArgs ) => void ;
30+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
31+ [ name : string ] : any ;
3432}
3533
3634export interface FieldProps {
@@ -52,6 +50,7 @@ export interface FieldProps {
5250 | ( ( prevValues : Store , nextValues : Store , info : { source ?: string } ) => boolean ) ;
5351 trigger ?: string ;
5452 validateTrigger ?: string | string [ ] | false ;
53+ valuePropName ?: string ;
5554}
5655
5756export interface FieldState {
@@ -65,6 +64,7 @@ class Field extends React.Component<FieldProps, FieldState> implements FieldEnti
6564 public static defaultProps = {
6665 trigger : 'onChange' ,
6766 validateTrigger : 'onChange' ,
67+ valuePropName : 'value' ,
6868 } ;
6969
7070 public state = {
@@ -328,7 +328,7 @@ class Field extends React.Component<FieldProps, FieldState> implements FieldEnti
328328 } ;
329329
330330 public getControlled = ( childProps : ChildProps = { } ) => {
331- const { trigger, validateTrigger, getValueFromEvent, normalize } = this . props ;
331+ const { trigger, validateTrigger, getValueFromEvent, normalize, valuePropName } = this . props ;
332332 const namePath = this . getNamePath ( ) ;
333333 const { getInternalHooks, getFieldsValue } : InternalFormInstance = this . context ;
334334 const { dispatch } = getInternalHooks ( HOOK_MARK ) ;
@@ -339,15 +339,20 @@ class Field extends React.Component<FieldProps, FieldState> implements FieldEnti
339339
340340 const control = {
341341 ...childProps ,
342- value,
342+ [ valuePropName ] : value ,
343343 } ;
344344
345345 // Add trigger
346346 control [ trigger ] = ( ...args : EventArgs ) => {
347347 // Mark as touched
348348 this . touched = true ;
349349
350- let newValue = ( getValueFromEvent || defaultGetValueFromEvent ) ( ...args ) ;
350+ let newValue ;
351+ if ( getValueFromEvent ) {
352+ newValue = getValueFromEvent ( ...args ) ;
353+ } else {
354+ newValue = defaultGetValueFromEvent ( valuePropName , ...args ) ;
355+ }
351356
352357 if ( normalize ) {
353358 newValue = normalize ( newValue , value , getFieldsValue ( ) ) ;
0 commit comments