@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
|
@@ -22601,7 +22601,7 @@ class EntitiesTableDataSource extends TableDataSource {
|
|
|
22601
22601
|
// Workaround, to be sure all rows have been deleted
|
|
22602
22602
|
// Sometime, the service miss deletion, or GraphQl cache remove failed.
|
|
22603
22603
|
// In this case, apply missing deletion using the super.delete() function
|
|
22604
|
-
const rowNotDeleted = this.getRows().filter(rows.includes);
|
|
22604
|
+
const rowNotDeleted = this.getRows().filter(row => rows.includes(row));
|
|
22605
22605
|
if (isNotEmptyArray(rowNotDeleted)) {
|
|
22606
22606
|
console.warn(`[table-datasource] Force deletion of ${rowNotDeleted.length} rows! Please check that data service update the cache, after deletion`);
|
|
22607
22607
|
rowNotDeleted
|
|
@@ -23262,7 +23262,6 @@ class AppTable {
|
|
|
23262
23262
|
// Stop event
|
|
23263
23263
|
event === null || event === void 0 ? void 0 : event.stopPropagation();
|
|
23264
23264
|
// Confirmation edition or creation
|
|
23265
|
-
//const confirmed = this.dataSource.confirmEditCreate(row);
|
|
23266
23265
|
const confirmed = row.confirmEditCreate();
|
|
23267
23266
|
if (confirmed) {
|
|
23268
23267
|
// If edit finished, forget edited row
|
|
@@ -23487,18 +23486,22 @@ class AppTable {
|
|
|
23487
23486
|
// Reverse row order (on a copy)
|
|
23488
23487
|
// This is a workaround, need because row.delete() has async execution
|
|
23489
23488
|
// and index cache is updated with a delay
|
|
23490
|
-
|
|
23489
|
+
let tempRows = rows.slice()
|
|
23491
23490
|
.sort((a, b) => a.id > b.id ? -1 : 1);
|
|
23491
|
+
let deletedRows = [];
|
|
23492
23492
|
// If data need to be saved first
|
|
23493
23493
|
if (this.saveBeforeDelete) {
|
|
23494
23494
|
// Exclude invalid rows (because of save() will fail, when exists some invalid rows)
|
|
23495
|
-
|
|
23495
|
+
tempRows = tempRows.filter(row => {
|
|
23496
23496
|
// Delete the row, if newly created row (id = -1), or if invalid and not editing (= not cancellable)
|
|
23497
23497
|
if (row.id === -1 || (!row.valid && !row.editing)) {
|
|
23498
|
+
if (this.debug)
|
|
23499
|
+
console.debug(`[table] Delete row #${row.id}`);
|
|
23498
23500
|
row.delete();
|
|
23499
23501
|
this.visibleRowCount--;
|
|
23500
23502
|
this.totalRowCount--;
|
|
23501
|
-
|
|
23503
|
+
deletedRows.push(row);
|
|
23504
|
+
return false; // Exclude from the list to delete using the service
|
|
23502
23505
|
}
|
|
23503
23506
|
// Cancel the row (and mark as pristine), when not valid but in edition
|
|
23504
23507
|
else if (!row.valid && row.editing) {
|
|
@@ -23511,7 +23514,7 @@ class AppTable {
|
|
|
23511
23514
|
});
|
|
23512
23515
|
// Apply save, only if there is still some rows to delete
|
|
23513
23516
|
// WARN: If no more rows (e.g. because all has been cancelled) then continue anyway to clear editedRow and selection (issue IMAGINE-669)
|
|
23514
|
-
if (
|
|
23517
|
+
if (deletedRows.length || tempRows.length) {
|
|
23515
23518
|
// Save data (e.g. when using memory service)
|
|
23516
23519
|
const saved = yield this.saveBeforeAction('delete');
|
|
23517
23520
|
if (!saved) {
|
|
@@ -23521,13 +23524,12 @@ class AppTable {
|
|
|
23521
23524
|
}
|
|
23522
23525
|
}
|
|
23523
23526
|
try {
|
|
23524
|
-
const deleteCount = rows.length;
|
|
23525
23527
|
// Apply deletion on datasource
|
|
23526
23528
|
// If no more rows to delete, continue anyway to clear editedRow and selection (issue IMAGINE-669)
|
|
23527
|
-
if (
|
|
23529
|
+
if (tempRows.length) {
|
|
23528
23530
|
if (this.debug)
|
|
23529
|
-
console.debug(
|
|
23530
|
-
yield this._dataSource.deleteAll(
|
|
23531
|
+
console.debug(`[table] Delete ${tempRows.length} rows...`);
|
|
23532
|
+
yield this._dataSource.deleteAll(tempRows);
|
|
23531
23533
|
}
|
|
23532
23534
|
// DO not update manually, because watchALl().subscribe() will update this count
|
|
23533
23535
|
//this.totalRowCount -= deleteCount;
|
|
@@ -23536,9 +23538,8 @@ class AppTable {
|
|
|
23536
23538
|
this.editedRow = undefined;
|
|
23537
23539
|
this.markAsDirty({ emitEvent: false /*markForCheck() is called just after*/ });
|
|
23538
23540
|
this.markForCheck();
|
|
23539
|
-
|
|
23540
|
-
|
|
23541
|
-
return deleteCount;
|
|
23541
|
+
this.onAfterDeletedRows.next(rows);
|
|
23542
|
+
return rows.length;
|
|
23542
23543
|
}
|
|
23543
23544
|
catch (err) {
|
|
23544
23545
|
this.setError(err && err.message || err);
|