@ziadshalaby/ngx-zs-component 3.2.25 → 3.2.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1328,8 +1328,7 @@ class Form {
1328
1328
  }
1329
1329
  return result;
1330
1330
  }
1331
- submit(callback, allowEmptyFields = [], allowInvalidFields = []) {
1332
- this.markAllTouched();
1331
+ canSubmit(allowEmptyFields = [], allowInvalidFields = []) {
1333
1332
  const filled = this.allFilled();
1334
1333
  const validations = this.getValidations();
1335
1334
  const allFilled = Object.keys(filled).every((key) => {
@@ -1342,7 +1341,11 @@ class Form {
1342
1341
  return true;
1343
1342
  return validations[key];
1344
1343
  });
1345
- if (!allFilled || !allValid)
1344
+ return allFilled && allValid;
1345
+ }
1346
+ submit(callback, allowEmptyFields = [], allowInvalidFields = []) {
1347
+ this.markAllTouched();
1348
+ if (!this.canSubmit(allowEmptyFields, allowInvalidFields))
1346
1349
  return;
1347
1350
  callback(this.getValues());
1348
1351
  }