@sumaris-net/ngx-components 0.18.8 → 0.18.12

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.
@@ -12199,6 +12199,7 @@
12199
12199
  label: 'REFERENTIAL.STATUS_ENUM.TEMPORARY'
12200
12200
  }
12201
12201
  ]);
12202
+ var StatusById = Object.freeze(splitById(StatusList));
12202
12203
  //@dynamic
12203
12204
  var BaseReferential = /** @class */ (function (_super) {
12204
12205
  __extends(BaseReferential, _super);
@@ -16301,7 +16302,6 @@
16301
16302
  get: function () {
16302
16303
  return this.data;
16303
16304
  },
16304
- // TODO add test see sub-batches.modal.ts onLoadData & _hiddenData
16305
16305
  set: function (data) {
16306
16306
  this.setValue(data);
16307
16307
  },
@@ -16334,52 +16334,53 @@
16334
16334
  }
16335
16335
  return this._onChange
16336
16336
  .pipe(operators.filter(isNotNil), operators.mergeMap(function (_) { return __awaiter(_this, void 0, void 0, function () {
16337
- var data, promiseOrData, _a, total, hiddenData;
16338
- var _b, _c, _d, _e;
16339
- return __generator(this, function (_f) {
16340
- switch (_f.label) {
16337
+ var excludedDataByFilter, excludedDataByPagination, data, promiseOrData, _a, total;
16338
+ return __generator(this, function (_b) {
16339
+ switch (_b.label) {
16341
16340
  case 0:
16342
- this._hiddenData = [];
16341
+ excludedDataByFilter = [];
16342
+ _b.label = 1;
16343
+ case 1:
16344
+ _b.trys.push([1, , 6, 7]);
16343
16345
  if (isEmptyArray(this.data)) {
16344
16346
  return [2 /*return*/, { data: [], total: 0 }];
16345
16347
  }
16346
16348
  data = this._sortFn(this.data || [], sortBy, sortDirection);
16347
- if (!this._onLoad) return [3 /*break*/, 4];
16349
+ if (!this._onLoad) return [3 /*break*/, 5];
16348
16350
  promiseOrData = this._onLoad(data);
16349
- if (!((promiseOrData instanceof Promise))) return [3 /*break*/, 2];
16351
+ if (!((promiseOrData instanceof Promise))) return [3 /*break*/, 3];
16350
16352
  return [4 /*yield*/, promiseOrData];
16351
- case 1:
16352
- _a = _f.sent();
16353
- return [3 /*break*/, 3];
16354
16353
  case 2:
16355
- _a = promiseOrData;
16356
- _f.label = 3;
16354
+ _a = _b.sent();
16355
+ return [3 /*break*/, 4];
16357
16356
  case 3:
16358
- data = _a;
16359
- _f.label = 4;
16357
+ _a = promiseOrData;
16358
+ _b.label = 4;
16360
16359
  case 4:
16360
+ data = _a;
16361
+ _b.label = 5;
16362
+ case 5:
16361
16363
  // Apply filter (will update hiddenData)
16362
- data = this.filter(data, filterData, this._hiddenData);
16364
+ data = this.filter(data, filterData, excludedDataByFilter);
16363
16365
  total = data.length;
16364
16366
  // If page size=0 (e.g. only need total)
16365
16367
  if (size === 0) {
16366
- (_b = this._hiddenData).push.apply(_b, __spread(data));
16368
+ excludedDataByPagination = data;
16367
16369
  return [2 /*return*/, { data: [], total: total }];
16368
16370
  }
16369
16371
  // Slice in a page (using offset and size)
16370
16372
  if (offset > 0) {
16371
16373
  // Offset after the end: no result
16372
16374
  if (offset >= data.length) {
16373
- (_c = this._hiddenData).push.apply(_c, __spread(data));
16375
+ excludedDataByPagination = data;
16374
16376
  data = [];
16375
16377
  }
16376
16378
  else {
16377
- hiddenData = (size > 0 && ((offset + size) < data.length)) ?
16379
+ excludedDataByPagination = (size > 0 && ((offset + size) < data.length)) ?
16378
16380
  // Slice using limit to size
16379
16381
  data.slice(0, offset - 1).concat(data.slice(offset + size)) :
16380
16382
  // Slice without limit
16381
16383
  data.slice(0, offset - 1);
16382
- (_d = this._hiddenData).push.apply(_d, __spread(hiddenData));
16383
16384
  data = (size > 0 && ((offset + size) < data.length)) ?
16384
16385
  // Slice using limit to size
16385
16386
  data.slice(offset, offset + size) :
@@ -16389,7 +16390,7 @@
16389
16390
  }
16390
16391
  // Apply a limit
16391
16392
  else if (size > 0) {
16392
- (_e = this._hiddenData).push.apply(_e, __spread(data.slice(size)));
16393
+ excludedDataByPagination = data.slice(size);
16393
16394
  data = data.slice(0, size);
16394
16395
  }
16395
16396
  // No limit:
@@ -16402,6 +16403,11 @@
16402
16403
  data = data.slice(0);
16403
16404
  }
16404
16405
  return [2 /*return*/, { data: data, total: total }];
16406
+ case 6:
16407
+ // Remember hidden data
16408
+ this._hiddenData = __spread(excludedDataByFilter, excludedDataByPagination);
16409
+ return [7 /*endfinally*/];
16410
+ case 7: return [2 /*return*/];
16405
16411
  }
16406
16412
  });
16407
16413
  }); }));
@@ -16445,9 +16451,11 @@
16445
16451
  return __generator(this, function (_a) {
16446
16452
  if (!this.data)
16447
16453
  throw new Error('[memory-service] Could not delete, because value not set');
16454
+ if (!this._equalsFn)
16455
+ throw new Error("[memory-service] Could not delete, because no 'options.equals' has been set in the memory service");
16448
16456
  updatedData = this.data.filter(function (entity) {
16449
- var shouldRemoved = dataToRemove.findIndex(function (entityToRemove) { return _this._equalsFn(entityToRemove, entity); }) !== -1;
16450
- return !shouldRemoved;
16457
+ var removed = dataToRemove.findIndex(function (entityToRemove) { return _this._equalsFn(entityToRemove, entity); }) !== -1;
16458
+ return !removed;
16451
16459
  });
16452
16460
  deleteCount = this.data.length - updatedData.length;
16453
16461
  if (deleteCount > 0) {
@@ -18065,7 +18073,7 @@
18065
18073
  });
18066
18074
  }
18067
18075
  /**
18068
- * Wait end of async validation
18076
+ * Wait end of async validation (not pending)
18069
18077
  * return false
18070
18078
  */
18071
18079
  function waitWhilePending(form, opts) {
@@ -18078,7 +18086,7 @@
18078
18086
  * @param opts
18079
18087
  */
18080
18088
  function waitIdle(form, opts) {
18081
- var predicate = function () { return form.loading !== false; };
18089
+ var predicate = function () { return form.loading !== true; };
18082
18090
  return waitFor(predicate, opts);
18083
18091
  }
18084
18092
  function isControlHasInput(controls, controlName) {
@@ -26009,9 +26017,6 @@
26009
26017
  // eslint-disable-next-line @angular-eslint/directive-class-suffix
26010
26018
  var AppInMemoryTable = /** @class */ (function (_super) {
26011
26019
  __extends(AppInMemoryTable, _super);
26012
- /* get dirty(): boolean {
26013
- return this._dirty || this.memoryDataService.dirty;
26014
- }*/
26015
26020
  function AppInMemoryTable(injector, columns, dataType, memoryDataService, validatorService, options, filter) {
26016
26021
  var _this = _super.call(this, injector.get(i3.ActivatedRoute), injector.get(i3.Router), injector.get(i1$5.Platform), injector.get(i1$4.Location), injector.get(i1$5.ModalController), injector.get(LocalSettingsService), columns, new EntitiesTableDataSource(dataType, memoryDataService, validatorService, options), filter, injector) || this;
26017
26022
  _this.injector = injector;
@@ -26043,10 +26048,8 @@
26043
26048
  this.setError(null);
26044
26049
  this.markForCheck();
26045
26050
  }
26046
- var firstCall = isEmptyArray(this.memoryDataService.value);
26047
- var emitRefreshEvent = firstCall || (opts && opts.emitEvent !== false);
26048
- this.memoryDataService.setValue(value, { emitEvent: !firstCall && !emitRefreshEvent });
26049
- if (emitRefreshEvent) {
26051
+ this.memoryDataService.value = value;
26052
+ if (!opts || opts.emitEvent !== false) {
26050
26053
  this.onRefresh.emit();
26051
26054
  }
26052
26055
  };
@@ -26961,9 +26964,9 @@
26961
26964
  _this.cd = cd;
26962
26965
  _this.canEdit = false;
26963
26966
  _this.profiles = __spread(PRIORITIZED_AUTHORITIES).reverse();
26964
- _this.statusList = StatusList;
26965
- _this.statusById = splitById(StatusList);
26966
26967
  _this.filterCriteriaCount = 0;
26968
+ _this.statusList = StatusList;
26969
+ _this.statusById = StatusById;
26967
26970
  _this.referentialToString = referentialToString;
26968
26971
  _this.inlineEdition = accountService.isAdmin(); // Allow inline edition only if admin
26969
26972
  _this.canEdit = accountService.isAdmin();