@sumaris-net/ngx-components 1.23.56 → 1.23.58

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.
@@ -2839,7 +2839,9 @@
2839
2839
  return date1 && (!date2 || date1.isSameOrBefore(date2)) ? date1 : date2;
2840
2840
  };
2841
2841
  DateUtils.max = function (date1, date2) {
2842
- return date1 && (!date2 || date1.isSameOrAfter(date2)) ? date1 : date2;
2842
+ var d1 = fromDateISOString(date1);
2843
+ var d2 = fromDateISOString(date2);
2844
+ return d1 && (!d2 || d1.isSameOrAfter(d2)) ? d1 : d2;
2843
2845
  };
2844
2846
  DateUtils.equals = function (date1, date2) {
2845
2847
  return DateUtils.isSame(date1, date2);
@@ -13818,7 +13820,7 @@
13818
13820
  function EntityStore(name, storage, policy) {
13819
13821
  this.name = name;
13820
13822
  this.storage = storage;
13821
- this._onChange = new rxjs.BehaviorSubject(false);
13823
+ this._onChange = new rxjs.BehaviorSubject(true);
13822
13824
  this._dirty = false;
13823
13825
  this.policy = policy || {};
13824
13826
  this.reset({ emitEvent: false });
@@ -13897,9 +13899,7 @@
13897
13899
  console.warn('[entity-store] WARN: Watching full entities, splited by id in entity store. This can be long! Please make sure you need full entities here.');
13898
13900
  return this._onChange
13899
13901
  .pipe(
13900
- // Wait data loaded
13901
- operators.filter(function (_) { return _this._loaded; }),
13902
- // Apply filter and sort
13902
+ // Apply filter on cache
13903
13903
  operators.map(function (_) { return _this.reduceAndSort(_this._cache, variables); }),
13904
13904
  // Then convert into full entities (using parallel jobs - /!\ can use lot of memory)
13905
13905
  operators.mergeMap(function (res) { return Promise.all((res.data || [])
@@ -13910,11 +13910,7 @@
13910
13910
  }
13911
13911
  // Load using entities array
13912
13912
  return this._onChange
13913
- .pipe(
13914
- // Wait data loaded
13915
- operators.filter(function (_) { return _this._loaded; }),
13916
- // Apply filter and sort
13917
- operators.map(function (_) { return _this.reduceAndSort(_this._cache, variables); }));
13913
+ .pipe(operators.map(function (_) { return _this.reduceAndSort(_this._cache, variables); }));
13918
13914
  };
13919
13915
  /**
13920
13916
  * WIll apply a filter, then a sort, then a page slice
@@ -13982,7 +13978,7 @@
13982
13978
  var result;
13983
13979
  console.info("[entity-storage] Saving " + entities.length + " " + this.name + "(s)");
13984
13980
  // First save, or reset using given entities
13985
- if (!this._loaded || !this._cache || (opts === null || opts === void 0 ? void 0 : opts.reset)) {
13981
+ if (isEmptyArray(this._cache) || (opts && opts.reset)) {
13986
13982
  this.setEntities(entities, { emitEvent: false });
13987
13983
  }
13988
13984
  else {