@sumaris-net/ngx-components 1.23.5 → 1.23.8
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 +28 -22
- package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js +2 -2
- package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
- package/doc/changelog.md +5 -0
- package/esm2015/src/app/core/form/editor.class.js +6 -3
- package/esm2015/src/app/core/form/form.class.js +5 -2
- package/esm2015/src/app/core/table/entities-table-datasource.class.js +2 -2
- package/esm2015/src/app/core/table/table.class.js +21 -18
- package/fesm2015/sumaris-net.ngx-components.js +27 -18
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/core/form/editor.class.d.ts +2 -1
- package/src/app/core/form/form.class.d.ts +2 -1
- package/src/app/core/table/table.class.d.ts +1 -1
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -17509,6 +17509,7 @@ class AppForm {
|
|
|
17509
17509
|
this._subscription = new Subscription();
|
|
17510
17510
|
this._enable = false;
|
|
17511
17511
|
this.i18nFieldPrefix = null;
|
|
17512
|
+
this.destroySubject = new Subject();
|
|
17512
17513
|
this.readySubject = new BehaviorSubject(false);
|
|
17513
17514
|
this.loadingSubject = new BehaviorSubject(true);
|
|
17514
17515
|
this.errorSubject = new BehaviorSubject(undefined);
|
|
@@ -17630,6 +17631,8 @@ class AppForm {
|
|
|
17630
17631
|
this.errorSubject.unsubscribe();
|
|
17631
17632
|
this.onCancel.unsubscribe();
|
|
17632
17633
|
this.onSubmit.unsubscribe();
|
|
17634
|
+
this.destroySubject.next();
|
|
17635
|
+
this.destroySubject.unsubscribe();
|
|
17633
17636
|
}
|
|
17634
17637
|
cancel() {
|
|
17635
17638
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -22598,7 +22601,7 @@ class EntitiesTableDataSource extends TableDataSource {
|
|
|
22598
22601
|
// Workaround, to be sure all rows have been deleted
|
|
22599
22602
|
// Sometime, the service miss deletion, or GraphQl cache remove failed.
|
|
22600
22603
|
// In this case, apply missing deletion using the super.delete() function
|
|
22601
|
-
const rowNotDeleted = this.getRows().filter(rows.includes);
|
|
22604
|
+
const rowNotDeleted = this.getRows().filter(row => rows.includes(row));
|
|
22602
22605
|
if (isNotEmptyArray(rowNotDeleted)) {
|
|
22603
22606
|
console.warn(`[table-datasource] Force deletion of ${rowNotDeleted.length} rows! Please check that data service update the cache, after deletion`);
|
|
22604
22607
|
rowNotDeleted
|
|
@@ -22729,8 +22732,8 @@ class AppTable {
|
|
|
22729
22732
|
this._subscription = new Subscription();
|
|
22730
22733
|
this._cellValueChangesDefs = {};
|
|
22731
22734
|
this._enabled = true;
|
|
22732
|
-
this._destroy$ = new Subject();
|
|
22733
22735
|
this.allowRowDetail = true;
|
|
22736
|
+
this.destroySubject = new Subject();
|
|
22734
22737
|
this.excludesColumns = [];
|
|
22735
22738
|
this.totalRowCount = null;
|
|
22736
22739
|
this.readySubject = new BehaviorSubject(false);
|
|
@@ -23025,7 +23028,7 @@ class AppTable {
|
|
|
23025
23028
|
// Stop if next another row, or destroying
|
|
23026
23029
|
combineLatest([
|
|
23027
23030
|
this.onStartEditingRow,
|
|
23028
|
-
this.
|
|
23031
|
+
this.destroySubject
|
|
23029
23032
|
])
|
|
23030
23033
|
// DEBUG
|
|
23031
23034
|
//.pipe(
|
|
@@ -23122,8 +23125,8 @@ class AppTable {
|
|
|
23122
23125
|
this.onSort.unsubscribe();
|
|
23123
23126
|
this.onDirty.unsubscribe();
|
|
23124
23127
|
this.onError.unsubscribe();
|
|
23125
|
-
this.
|
|
23126
|
-
this.
|
|
23128
|
+
this.destroySubject.next();
|
|
23129
|
+
this.destroySubject.unsubscribe();
|
|
23127
23130
|
(_a = this._dataSource) === null || _a === void 0 ? void 0 : _a.ngOnDestroy();
|
|
23128
23131
|
}
|
|
23129
23132
|
updateView(res, opts) {
|
|
@@ -23259,7 +23262,6 @@ class AppTable {
|
|
|
23259
23262
|
// Stop event
|
|
23260
23263
|
event === null || event === void 0 ? void 0 : event.stopPropagation();
|
|
23261
23264
|
// Confirmation edition or creation
|
|
23262
|
-
//const confirmed = this.dataSource.confirmEditCreate(row);
|
|
23263
23265
|
const confirmed = row.confirmEditCreate();
|
|
23264
23266
|
if (confirmed) {
|
|
23265
23267
|
// If edit finished, forget edited row
|
|
@@ -23484,18 +23486,24 @@ class AppTable {
|
|
|
23484
23486
|
// Reverse row order (on a copy)
|
|
23485
23487
|
// This is a workaround, need because row.delete() has async execution
|
|
23486
23488
|
// and index cache is updated with a delay
|
|
23487
|
-
|
|
23489
|
+
let tempRows = rows.slice()
|
|
23488
23490
|
.sort((a, b) => a.id > b.id ? -1 : 1);
|
|
23491
|
+
let deletedRows = [];
|
|
23489
23492
|
// If data need to be saved first
|
|
23490
23493
|
if (this.saveBeforeDelete) {
|
|
23491
23494
|
// Exclude invalid rows (because of save() will fail, when exists some invalid rows)
|
|
23492
|
-
|
|
23495
|
+
tempRows = tempRows.filter(row => {
|
|
23493
23496
|
// Delete the row, if newly created row (id = -1), or if invalid and not editing (= not cancellable)
|
|
23494
23497
|
if (row.id === -1 || (!row.valid && !row.editing)) {
|
|
23498
|
+
if (this.debug)
|
|
23499
|
+
console.debug(`[table] Delete row #${row.id}`);
|
|
23495
23500
|
row.delete();
|
|
23496
23501
|
this.visibleRowCount--;
|
|
23497
23502
|
this.totalRowCount--;
|
|
23498
|
-
|
|
23503
|
+
deletedRows.push(row);
|
|
23504
|
+
if (this.editedRow === row)
|
|
23505
|
+
this.editedRow = undefined;
|
|
23506
|
+
return false; // Exclude from the list to delete using the service
|
|
23499
23507
|
}
|
|
23500
23508
|
// Cancel the row (and mark as pristine), when not valid but in edition
|
|
23501
23509
|
else if (!row.valid && row.editing) {
|
|
@@ -23508,7 +23516,7 @@ class AppTable {
|
|
|
23508
23516
|
});
|
|
23509
23517
|
// Apply save, only if there is still some rows to delete
|
|
23510
23518
|
// WARN: If no more rows (e.g. because all has been cancelled) then continue anyway to clear editedRow and selection (issue IMAGINE-669)
|
|
23511
|
-
if (
|
|
23519
|
+
if (deletedRows.length || tempRows.length) {
|
|
23512
23520
|
// Save data (e.g. when using memory service)
|
|
23513
23521
|
const saved = yield this.saveBeforeAction('delete');
|
|
23514
23522
|
if (!saved) {
|
|
@@ -23518,13 +23526,12 @@ class AppTable {
|
|
|
23518
23526
|
}
|
|
23519
23527
|
}
|
|
23520
23528
|
try {
|
|
23521
|
-
const deleteCount = rows.length;
|
|
23522
23529
|
// Apply deletion on datasource
|
|
23523
23530
|
// If no more rows to delete, continue anyway to clear editedRow and selection (issue IMAGINE-669)
|
|
23524
|
-
if (
|
|
23531
|
+
if (tempRows.length) {
|
|
23525
23532
|
if (this.debug)
|
|
23526
|
-
console.debug(
|
|
23527
|
-
yield this._dataSource.deleteAll(
|
|
23533
|
+
console.debug(`[table] Delete ${tempRows.length} rows...`);
|
|
23534
|
+
yield this._dataSource.deleteAll(tempRows);
|
|
23528
23535
|
}
|
|
23529
23536
|
// DO not update manually, because watchALl().subscribe() will update this count
|
|
23530
23537
|
//this.totalRowCount -= deleteCount;
|
|
@@ -23533,9 +23540,8 @@ class AppTable {
|
|
|
23533
23540
|
this.editedRow = undefined;
|
|
23534
23541
|
this.markAsDirty({ emitEvent: false /*markForCheck() is called just after*/ });
|
|
23535
23542
|
this.markForCheck();
|
|
23536
|
-
|
|
23537
|
-
|
|
23538
|
-
return deleteCount;
|
|
23543
|
+
this.onAfterDeletedRows.next(rows);
|
|
23544
|
+
return rows.length;
|
|
23539
23545
|
}
|
|
23540
23546
|
catch (err) {
|
|
23541
23547
|
this.setError(err && err.message || err);
|
|
@@ -24342,6 +24348,7 @@ class AppEditor {
|
|
|
24342
24348
|
this._subscription = new Subscription();
|
|
24343
24349
|
this._enabled = false;
|
|
24344
24350
|
this._dirty = false;
|
|
24351
|
+
this.destroySubject = new Subject();
|
|
24345
24352
|
this.readySubject = new BehaviorSubject(false);
|
|
24346
24353
|
this.loadingSubject = new BehaviorSubject(true);
|
|
24347
24354
|
this.errorSubject = new BehaviorSubject(undefined);
|
|
@@ -24426,13 +24433,15 @@ class AppEditor {
|
|
|
24426
24433
|
}
|
|
24427
24434
|
}
|
|
24428
24435
|
ngAfterViewInit() {
|
|
24429
|
-
// Can be
|
|
24436
|
+
// Can be overridden by subclasses
|
|
24430
24437
|
}
|
|
24431
24438
|
ngOnDestroy() {
|
|
24432
24439
|
this._subscription.unsubscribe();
|
|
24433
24440
|
this.readySubject.unsubscribe();
|
|
24434
24441
|
this.loadingSubject.unsubscribe();
|
|
24435
24442
|
this.errorSubject.unsubscribe();
|
|
24443
|
+
this.destroySubject.next();
|
|
24444
|
+
this.destroySubject.unsubscribe();
|
|
24436
24445
|
}
|
|
24437
24446
|
addChildForm(form) {
|
|
24438
24447
|
if (!form)
|