@sumaris-net/ngx-components 1.5.10 → 1.5.11

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.
@@ -21524,16 +21524,21 @@ class AppTable {
21524
21524
  return 0; // Cannot delete
21525
21525
  if (this.saveBeforeDelete) {
21526
21526
  // Cancel invalid rows (because of save() will fail, if invalid rows exists)
21527
- rows.filter(row => { var _a; return !((_a = row.validator) === null || _a === void 0 ? void 0 : _a.valid); })
21528
- .forEach(row => {
21529
- const deleted = row.id === -1;
21530
- row.cancelOrDelete();
21531
- // When deleted (= newly created row) : decrement counter
21532
- if (deleted) {
21533
- this.visibleRowCount--;
21534
- this.totalRowCount--;
21527
+ rows = rows.reduce((res, row) => {
21528
+ if (row.validator && !row.validator.valid) {
21529
+ const deleted = row.id === -1;
21530
+ row.cancelOrDelete();
21531
+ // When deleted (= newly created row) : decrement counter
21532
+ if (deleted) {
21533
+ this.visibleRowCount--;
21534
+ this.totalRowCount--;
21535
+ return res;
21536
+ }
21535
21537
  }
21536
- });
21538
+ return res.concat(row);
21539
+ }, []);
21540
+ if (isEmptyArray(rows))
21541
+ return 0;
21537
21542
  // If data need to be saved first: do it
21538
21543
  const saved = yield this.saveBeforeAction('delete');
21539
21544
  if (!saved) {