@sumaris-net/ngx-components 1.23.14 → 1.23.16

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.
@@ -20853,10 +20853,11 @@
20853
20853
  return __generator(this, function (_b) {
20854
20854
  if (this.debug)
20855
20855
  console.debug('[memory-data-service] Stopping...');
20856
- this.savingSubject.next(false);
20857
- this.dirtySubject.next(false);
20858
20856
  this.dataSubject.complete();
20857
+ this.dataSubject.unsubscribe();
20859
20858
  this.dataSubject = new rxjs.BehaviorSubject(null);
20859
+ this.savingSubject.next(false);
20860
+ this.dirtySubject.next(false);
20860
20861
  return [2 /*return*/];
20861
20862
  });
20862
20863
  });
@@ -20886,25 +20887,40 @@
20886
20887
  if (isNil(originalData)) {
20887
20888
  console.warn('[memory-data-service] Cannot load all: no value set. Will return empty result');
20888
20889
  }
20889
- // Wait while idle
20890
- return [4 /*yield*/, this.waitWhileSaving()];
20890
+ _b.label = 1;
20891
20891
  case 1:
20892
- // Wait while idle
20892
+ _b.trys.push([1, , 6, 7]);
20893
+ if (!!this.started) return [3 /*break*/, 3];
20894
+ return [4 /*yield*/, this.ready()];
20895
+ case 2:
20896
+ _b.sent();
20897
+ _b.label = 3;
20898
+ case 3:
20899
+ if (!this.saving) return [3 /*break*/, 5];
20900
+ return [4 /*yield*/, this.waitWhileSaving()];
20901
+ case 4:
20893
20902
  _b.sent();
20903
+ _b.label = 5;
20904
+ case 5: return [3 /*break*/, 7];
20905
+ case 6:
20906
+ if (!this.started)
20907
+ return [2 /*return*/, undefined]; // Stopped (e.g. after saved)
20908
+ return [7 /*endfinally*/];
20909
+ case 7:
20894
20910
  excludedDataByFilter = [];
20895
- _b.label = 2;
20896
- case 2:
20897
- _b.trys.push([2, , 5, 6]);
20911
+ _b.label = 8;
20912
+ case 8:
20913
+ _b.trys.push([8, , 11, 12]);
20898
20914
  if (isEmptyArray(originalData)) {
20899
20915
  return [2 /*return*/, { data: [], total: 0 }];
20900
20916
  }
20901
20917
  data = this._sortFn(originalData, sortBy, sortDirection);
20902
- if (!this._onLoad) return [3 /*break*/, 4];
20918
+ if (!this._onLoad) return [3 /*break*/, 10];
20903
20919
  return [4 /*yield*/, this._onLoad(data)];
20904
- case 3:
20920
+ case 9:
20905
20921
  data = _b.sent();
20906
- _b.label = 4;
20907
- case 4:
20922
+ _b.label = 10;
20923
+ case 10:
20908
20924
  // Apply filter (will update hiddenData)
20909
20925
  data = this.filter(data, filter, excludedDataByFilter);
20910
20926
  total = data.length;
@@ -20961,13 +20977,13 @@
20961
20977
  }); };
20962
20978
  }
20963
20979
  return [2 /*return*/, res];
20964
- case 5:
20980
+ case 11:
20965
20981
  // Remember hidden data
20966
20982
  if (offset === 0) {
20967
20983
  this._hiddenData = !excludedDataByPagination ? excludedDataByFilter : excludedDataByFilter.concat.apply(excludedDataByFilter, __spread(excludedDataByPagination));
20968
20984
  }
20969
20985
  return [7 /*endfinally*/];
20970
- case 6: return [2 /*return*/];
20986
+ case 12: return [2 /*return*/];
20971
20987
  }
20972
20988
  });
20973
20989
  });
@@ -20979,7 +20995,8 @@
20979
20995
  return this.dataSubject
20980
20996
  .pipe(operators.takeUntil(this.stopSubject),
20981
20997
  // Warn if waiting value to be set
20982
- operators.tap(function (data) { return !data && console.debug('[memory-data-service] Waiting value to be set...'); }), operators.filter(isNotNil), operators.mergeMap(function (_) { return _this.loadAll(offset, size, sortBy, sortDirection, filterData, options); }));
20998
+ operators.tap(function (data) { return _this.debug && !data && console.debug('[memory-data-service] Waiting value to be set...'); }), operators.filter(isNotNil), operators.mergeMap(function (_) { return _this.loadAll(offset, size, sortBy, sortDirection, filterData, options); }), operators.filter(isNotNil) // Skip no result (e.g. when stopped)
20999
+ );
20983
21000
  };
20984
21001
  InMemoryEntitiesService.prototype.saveAll = function (data, options) {
20985
21002
  return __awaiter(this, void 0, void 0, function () {