@sumaris-net/ngx-components 1.23.2 → 1.23.5

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.
@@ -22592,24 +22592,17 @@ class EntitiesTableDataSource extends TableDataSource {
22592
22592
  return __awaiter(this, void 0, void 0, function* () {
22593
22593
  this.markAsLoading();
22594
22594
  const data = this.getDataFromRows(rows);
22595
- const rowsById = Beans.collectById(rows);
22596
22595
  try {
22597
22596
  // Call service deletion
22598
22597
  yield this.dataService.deleteAll(data, this.serviceOptions);
22599
22598
  // Workaround, to be sure all rows have been deleted
22600
- // Sometimes, the service miss deletion, or GrapQHl cache remove failed
22601
- const rowNotDeleted = Object.getOwnPropertyNames(rowsById)
22602
- .reduce((res, id) => {
22603
- const row = rowsById[id];
22604
- const present = this.getRow(+id) === row;
22605
- return present ? res.concat(row) : res;
22606
- }, []);
22607
- //this.getRows().filter(row => rows.includes(row));
22608
- // Apply missing deletion
22599
+ // Sometime, the service miss deletion, or GraphQl cache remove failed.
22600
+ // In this case, apply missing deletion using the super.delete() function
22601
+ const rowNotDeleted = this.getRows().filter(rows.includes);
22609
22602
  if (isNotEmptyArray(rowNotDeleted)) {
22610
- console.warn(`[table-datasource] Force deletion of ${rowNotDeleted.length} rows (Is service update the cache ?)`);
22603
+ console.warn(`[table-datasource] Force deletion of ${rowNotDeleted.length} rows! Please check that data service update the cache, after deletion`);
22611
22604
  rowNotDeleted
22612
- // Start from the end
22605
+ // Start at the end
22613
22606
  .sort((a, b) => a.id > b.id ? -1 : 1)
22614
22607
  .forEach(r => _super.delete.call(this, r.id));
22615
22608
  }
@@ -23063,7 +23056,7 @@ class AppTable {
23063
23056
  return of(undefined); // Continue
23064
23057
  }))
23065
23058
  .subscribe(res => this.updateView(res)));
23066
- // Listen dataSource events
23059
+ // Listen dataSource loading events
23067
23060
  if (this._dataSource)
23068
23061
  this.listenDatasourceLoading(this._dataSource);
23069
23062
  }
@@ -24224,8 +24217,9 @@ class AppTable {
24224
24217
  if (this.debug)
24225
24218
  console.debug('[table] Many call to listenDatasource(): Cleaning previous subscriptions...');
24226
24219
  this._dataSourceLoadingSubscription.unsubscribe();
24227
- this._subscription.remove(this._dataSourceLoadingSubscription);
24220
+ this.unregisterSubscription(this._dataSourceLoadingSubscription);
24228
24221
  }
24222
+ // Propage loading to table
24229
24223
  this._dataSourceLoadingSubscription = this._dataSource.loadingSubject
24230
24224
  .pipe(distinctUntilChanged(),
24231
24225
  // If changed to True: propagate as soon as possible
@@ -24233,7 +24227,7 @@ class AppTable {
24233
24227
  // If changed to False: wait 250ms before propagate (to make sure the spinner has been displayed)
24234
24228
  debounceTime(250), tap(loading => !loading && this.setLoading(false)))
24235
24229
  .subscribe();
24236
- this._subscription.add(this._dataSourceLoadingSubscription);
24230
+ this.registerSubscription(this._dataSourceLoadingSubscription);
24237
24231
  }
24238
24232
  startCellValueChanges(name, row) {
24239
24233
  const def = this._cellValueChangesDefs[name];