@@ -172,13 +172,27 @@ export class FormStore {
172172 return [ ] ;
173173 } ;
174174
175- private isFieldsTouched = ( nameList ?: NamePath [ ] ) => {
176- let namePathList : InternalNamePath [ ] | null = null ;
177- if ( nameList ) {
178- namePathList = nameList . map ( getNamePath ) ;
175+ private isFieldsTouched = ( ...args ) => {
176+ const [ arg0 , arg1 ] = args ;
177+ let namePathList : InternalNamePath [ ] | null ;
178+ let isAllFieldsTouched = false ;
179+
180+ if ( args . length === 0 ) {
181+ namePathList = null ;
182+ } else if ( args . length === 1 ) {
183+ if ( Array . isArray ( arg0 ) ) {
184+ namePathList = arg0 . map ( getNamePath ) ;
185+ isAllFieldsTouched = false ;
186+ } else {
187+ namePathList = null ;
188+ isAllFieldsTouched = arg0 ;
189+ }
190+ } else {
191+ namePathList = arg0 . map ( getNamePath ) ;
192+ isAllFieldsTouched = arg1 ;
179193 }
180194
181- return this . getFieldEntities ( ) . some ( ( field : FieldEntity ) => {
195+ const testTouched = ( field : FieldEntity ) => {
182196 // Not provide `nameList` will check all the fields
183197 if ( ! namePathList ) {
184198 return field . isFieldTouched ( ) ;
@@ -189,7 +203,11 @@ export class FormStore {
189203 return field . isFieldTouched ( ) ;
190204 }
191205 return false ;
192- } ) ;
206+ } ;
207+
208+ return isAllFieldsTouched
209+ ? this . getFieldEntities ( ) . every ( testTouched )
210+ : this . getFieldEntities ( ) . some ( testTouched ) ;
193211 } ;
194212
195213 private isFieldTouched = ( name : NamePath ) => this . isFieldsTouched ( [ name ] ) ;
0 commit comments