@sumaris-net/ngx-components 1.23.6 → 1.23.7
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 +15 -17
- 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/esm2015/src/app/core/table/entities-table-datasource.class.js +2 -2
- package/esm2015/src/app/core/table/table.class.js +15 -14
- package/fesm2015/sumaris-net.ngx-components.js +14 -13
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
|
@@ -26105,7 +26105,7 @@
|
|
|
26105
26105
|
case 2:
|
|
26106
26106
|
// Call service deletion
|
|
26107
26107
|
_b.sent();
|
|
26108
|
-
rowNotDeleted = this.getRows().filter(rows.includes);
|
|
26108
|
+
rowNotDeleted = this.getRows().filter(function (row) { return rows.includes(row); });
|
|
26109
26109
|
if (isNotEmptyArray(rowNotDeleted)) {
|
|
26110
26110
|
console.warn("[table-datasource] Force deletion of " + rowNotDeleted.length + " rows! Please check that data service update the cache, after deletion");
|
|
26111
26111
|
rowNotDeleted
|
|
@@ -26907,7 +26907,6 @@
|
|
|
26907
26907
|
// Stop event
|
|
26908
26908
|
event === null || event === void 0 ? void 0 : event.stopPropagation();
|
|
26909
26909
|
// Confirmation edition or creation
|
|
26910
|
-
//const confirmed = this.dataSource.confirmEditCreate(row);
|
|
26911
26910
|
var confirmed = row.confirmEditCreate();
|
|
26912
26911
|
if (confirmed) {
|
|
26913
26912
|
// If edit finished, forget edited row
|
|
@@ -27144,7 +27143,7 @@
|
|
|
27144
27143
|
AppTable.prototype.deleteRows = function (event, rows, opts) {
|
|
27145
27144
|
var _a;
|
|
27146
27145
|
return __awaiter(this, void 0, void 0, function () {
|
|
27147
|
-
var confirmed, canDelete,
|
|
27146
|
+
var confirmed, canDelete, tempRows, deletedRows, saved, err_2;
|
|
27148
27147
|
var _this = this;
|
|
27149
27148
|
return __generator(this, function (_e) {
|
|
27150
27149
|
switch (_e.label) {
|
|
@@ -27172,20 +27171,21 @@
|
|
|
27172
27171
|
canDelete = _e.sent();
|
|
27173
27172
|
if (!canDelete)
|
|
27174
27173
|
return [2 /*return*/, 0]; // Cannot delete
|
|
27175
|
-
|
|
27176
|
-
// This is a workaround, need because row.delete() has async execution
|
|
27177
|
-
// and index cache is updated with a delay
|
|
27178
|
-
rows = rows.slice()
|
|
27174
|
+
tempRows = rows.slice()
|
|
27179
27175
|
.sort(function (a, b) { return a.id > b.id ? -1 : 1; });
|
|
27176
|
+
deletedRows = [];
|
|
27180
27177
|
if (!this.saveBeforeDelete) return [3 /*break*/, 3];
|
|
27181
27178
|
// Exclude invalid rows (because of save() will fail, when exists some invalid rows)
|
|
27182
|
-
|
|
27179
|
+
tempRows = tempRows.filter(function (row) {
|
|
27183
27180
|
// Delete the row, if newly created row (id = -1), or if invalid and not editing (= not cancellable)
|
|
27184
27181
|
if (row.id === -1 || (!row.valid && !row.editing)) {
|
|
27182
|
+
if (_this.debug)
|
|
27183
|
+
console.debug("[table] Delete row #" + row.id);
|
|
27185
27184
|
row.delete();
|
|
27186
27185
|
_this.visibleRowCount--;
|
|
27187
27186
|
_this.totalRowCount--;
|
|
27188
|
-
|
|
27187
|
+
deletedRows.push(row);
|
|
27188
|
+
return false; // Exclude from the list to delete using the service
|
|
27189
27189
|
}
|
|
27190
27190
|
// Cancel the row (and mark as pristine), when not valid but in edition
|
|
27191
27191
|
else if (!row.valid && row.editing) {
|
|
@@ -27196,7 +27196,7 @@
|
|
|
27196
27196
|
}
|
|
27197
27197
|
return true;
|
|
27198
27198
|
});
|
|
27199
|
-
if (!
|
|
27199
|
+
if (!(deletedRows.length || tempRows.length)) return [3 /*break*/, 3];
|
|
27200
27200
|
return [4 /*yield*/, this.saveBeforeAction('delete')];
|
|
27201
27201
|
case 2:
|
|
27202
27202
|
saved = _e.sent();
|
|
@@ -27207,11 +27207,10 @@
|
|
|
27207
27207
|
_e.label = 3;
|
|
27208
27208
|
case 3:
|
|
27209
27209
|
_e.trys.push([3, 6, , 7]);
|
|
27210
|
-
|
|
27211
|
-
if (!deleteCount) return [3 /*break*/, 5];
|
|
27210
|
+
if (!tempRows.length) return [3 /*break*/, 5];
|
|
27212
27211
|
if (this.debug)
|
|
27213
|
-
console.debug(
|
|
27214
|
-
return [4 /*yield*/, this._dataSource.deleteAll(
|
|
27212
|
+
console.debug("[table] Delete " + tempRows.length + " rows...");
|
|
27213
|
+
return [4 /*yield*/, this._dataSource.deleteAll(tempRows)];
|
|
27215
27214
|
case 4:
|
|
27216
27215
|
_e.sent();
|
|
27217
27216
|
_e.label = 5;
|
|
@@ -27223,9 +27222,8 @@
|
|
|
27223
27222
|
this.editedRow = undefined;
|
|
27224
27223
|
this.markAsDirty({ emitEvent: false /*markForCheck() is called just after*/ });
|
|
27225
27224
|
this.markForCheck();
|
|
27226
|
-
|
|
27227
|
-
|
|
27228
|
-
return [2 /*return*/, deleteCount];
|
|
27225
|
+
this.onAfterDeletedRows.next(rows);
|
|
27226
|
+
return [2 /*return*/, rows.length];
|
|
27229
27227
|
case 6:
|
|
27230
27228
|
err_2 = _e.sent();
|
|
27231
27229
|
this.setError(err_2 && err_2.message || err_2);
|