@sumaris-net/ngx-components 1.10.0 → 1.10.1
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.
- package/bundles/sumaris-net.ngx-components.umd.js +19 -14
- package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
- package/doc/changelog.md +4 -0
- package/esm2015/src/app/core/table/table.class.js +31 -19
- package/fesm2015/sumaris-net.ngx-components.js +29 -17
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
|
@@ -25622,7 +25622,7 @@
|
|
|
25622
25622
|
AppTable.prototype.deleteRows = function (event, rows, opts) {
|
|
25623
25623
|
var _a;
|
|
25624
25624
|
return __awaiter(this, void 0, void 0, function () {
|
|
25625
|
-
var confirmed, canDelete, saved,
|
|
25625
|
+
var confirmed, canDelete, saved, deleteCount, err_2;
|
|
25626
25626
|
var _this = this;
|
|
25627
25627
|
return __generator(this, function (_e) {
|
|
25628
25628
|
switch (_e.label) {
|
|
@@ -25658,13 +25658,16 @@
|
|
|
25658
25658
|
if (deleted) {
|
|
25659
25659
|
_this.visibleRowCount--;
|
|
25660
25660
|
_this.totalRowCount--;
|
|
25661
|
+
// Forget is was the edited row
|
|
25662
|
+
if (row === _this.editedRow) {
|
|
25663
|
+
_this.editedRow = undefined;
|
|
25664
|
+
}
|
|
25661
25665
|
return res;
|
|
25662
25666
|
}
|
|
25663
25667
|
}
|
|
25664
25668
|
return res.concat(row);
|
|
25665
25669
|
}, []);
|
|
25666
|
-
if (
|
|
25667
|
-
return [2 /*return*/, 0];
|
|
25670
|
+
if (!isNotEmptyArray(rows)) return [3 /*break*/, 3];
|
|
25668
25671
|
return [4 /*yield*/, this.saveBeforeAction('delete')];
|
|
25669
25672
|
case 2:
|
|
25670
25673
|
saved = _e.sent();
|
|
@@ -25674,20 +25677,21 @@
|
|
|
25674
25677
|
}
|
|
25675
25678
|
_e.label = 3;
|
|
25676
25679
|
case 3:
|
|
25680
|
+
_e.trys.push([3, 6, , 7]);
|
|
25681
|
+
deleteCount = rows.length;
|
|
25682
|
+
if (!deleteCount) return [3 /*break*/, 5];
|
|
25677
25683
|
if (this.debug)
|
|
25678
|
-
console.debug('[table] Delete
|
|
25679
|
-
|
|
25680
|
-
|
|
25681
|
-
|
|
25682
|
-
|
|
25684
|
+
console.debug('[table] Delete selected rows...');
|
|
25685
|
+
// Reverse row order (on a copy)
|
|
25686
|
+
// This is a workaround, need because row.delete() has async execution
|
|
25687
|
+
// and index cache is updated with a delay
|
|
25688
|
+
rows = rows.slice()
|
|
25683
25689
|
.sort(function (a, b) { return a.id > b.id ? -1 : 1; });
|
|
25684
|
-
|
|
25690
|
+
return [4 /*yield*/, this._dataSource.deleteAll(rows)];
|
|
25685
25691
|
case 4:
|
|
25686
|
-
_e.trys.push([4, 6, , 7]);
|
|
25687
|
-
deleteCount = rowsToDelete.length;
|
|
25688
|
-
return [4 /*yield*/, this._dataSource.deleteAll(rowsToDelete)];
|
|
25689
|
-
case 5:
|
|
25690
25692
|
_e.sent();
|
|
25693
|
+
_e.label = 5;
|
|
25694
|
+
case 5:
|
|
25691
25695
|
// DO not update manually, because watchALl().subscribe() will update this count
|
|
25692
25696
|
//this.totalRowCount -= deleteCount;
|
|
25693
25697
|
//this.visibleRowCount -= deleteCount;
|
|
@@ -25695,7 +25699,8 @@
|
|
|
25695
25699
|
this.editedRow = undefined;
|
|
25696
25700
|
this.markAsDirty({ emitEvent: false /*markForCheck() is called just after*/ });
|
|
25697
25701
|
this.markForCheck();
|
|
25698
|
-
|
|
25702
|
+
if (deleteCount)
|
|
25703
|
+
this.onAfterDeletedRows.next(rows);
|
|
25699
25704
|
return [2 /*return*/, deleteCount];
|
|
25700
25705
|
case 6:
|
|
25701
25706
|
err_2 = _e.sent();
|