@@ -23,6 +23,8 @@ import type {
2323 InternalValidateOptions ,
2424 ValuedNotifyInfo ,
2525 WatchCallBack ,
26+ FilterFunc ,
27+ GetFieldsValueConfig ,
2628} from './interface' ;
2729import { allPromiseFinish } from './utils/asyncUtil' ;
2830import { merge } from 'rc-util/lib/utils/set' ;
@@ -265,15 +267,31 @@ export class FormStore {
265267 } ) ;
266268 } ;
267269
268- private getFieldsValue = ( nameList ?: NamePath [ ] | true , filterFunc ?: ( meta : Meta ) => boolean ) => {
270+ private getFieldsValue = (
271+ nameList ?: NamePath [ ] | true | GetFieldsValueConfig ,
272+ filterFunc ?: FilterFunc ,
273+ ) => {
269274 this . warningUnhooked ( ) ;
270275
271- if ( nameList === true && ! filterFunc ) {
276+ // Fill args
277+ let mergedNameList : NamePath [ ] | true ;
278+ let mergedFilterFunc : FilterFunc ;
279+ let mergedStrict : boolean ;
280+
281+ if ( nameList === true || Array . isArray ( nameList ) ) {
282+ mergedNameList = nameList ;
283+ mergedFilterFunc = filterFunc ;
284+ } else if ( nameList && typeof nameList === 'object' ) {
285+ mergedStrict = nameList . strict ;
286+ mergedFilterFunc = nameList . filter ;
287+ }
288+
289+ if ( mergedNameList === true && ! mergedFilterFunc ) {
272290 return this . store ;
273291 }
274292
275293 const fieldEntities = this . getFieldEntitiesForNamePathList (
276- Array . isArray ( nameList ) ? nameList : null ,
294+ Array . isArray ( mergedNameList ) ? mergedNameList : null ,
277295 ) ;
278296
279297 const filteredNameList : NamePath [ ] = [ ] ;
@@ -283,15 +301,19 @@ export class FormStore {
283301
284302 // Ignore when it's a list item and not specific the namePath,
285303 // since parent field is already take in count
286- if ( ! nameList && ( entity as FieldEntity ) . isListField ?.( ) ) {
304+ if ( mergedStrict ) {
305+ if ( ( entity as FieldEntity ) . isList ?.( ) ) {
306+ return ;
307+ }
308+ } else if ( ! mergedNameList && ( entity as FieldEntity ) . isListField ?.( ) ) {
287309 return ;
288310 }
289311
290- if ( ! filterFunc ) {
312+ if ( ! mergedFilterFunc ) {
291313 filteredNameList . push ( namePath ) ;
292314 } else {
293315 const meta : Meta = 'getMeta' in entity ? entity . getMeta ( ) : null ;
294- if ( filterFunc ( meta ) ) {
316+ if ( mergedFilterFunc ( meta ) ) {
295317 filteredNameList . push ( namePath ) ;
296318 }
297319 }
0 commit comments