@sumaris-net/ngx-components 0.18.11 → 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.
@@ -16302,7 +16302,6 @@
16302
16302
  get: function () {
16303
16303
  return this.data;
16304
16304
  },
16305
- // TODO add test see sub-batches.modal.ts onLoadData & _hiddenData
16306
16305
  set: function (data) {
16307
16306
  this.setValue(data);
16308
16307
  },
@@ -16335,52 +16334,53 @@
16335
16334
  }
16336
16335
  return this._onChange
16337
16336
  .pipe(operators.filter(isNotNil), operators.mergeMap(function (_) { return __awaiter(_this, void 0, void 0, function () {
16338
- var data, promiseOrData, _a, total, hiddenData;
16339
- var _b, _c, _d, _e;
16340
- return __generator(this, function (_f) {
16341
- switch (_f.label) {
16337
+ var excludedDataByFilter, excludedDataByPagination, data, promiseOrData, _a, total;
16338
+ return __generator(this, function (_b) {
16339
+ switch (_b.label) {
16342
16340
  case 0:
16343
- this._hiddenData = [];
16341
+ excludedDataByFilter = [];
16342
+ _b.label = 1;
16343
+ case 1:
16344
+ _b.trys.push([1, , 6, 7]);
16344
16345
  if (isEmptyArray(this.data)) {
16345
16346
  return [2 /*return*/, { data: [], total: 0 }];
16346
16347
  }
16347
16348
  data = this._sortFn(this.data || [], sortBy, sortDirection);
16348
- if (!this._onLoad) return [3 /*break*/, 4];
16349
+ if (!this._onLoad) return [3 /*break*/, 5];
16349
16350
  promiseOrData = this._onLoad(data);
16350
- if (!((promiseOrData instanceof Promise))) return [3 /*break*/, 2];
16351
+ if (!((promiseOrData instanceof Promise))) return [3 /*break*/, 3];
16351
16352
  return [4 /*yield*/, promiseOrData];
16352
- case 1:
16353
- _a = _f.sent();
16354
- return [3 /*break*/, 3];
16355
16353
  case 2:
16356
- _a = promiseOrData;
16357
- _f.label = 3;
16354
+ _a = _b.sent();
16355
+ return [3 /*break*/, 4];
16358
16356
  case 3:
16359
- data = _a;
16360
- _f.label = 4;
16357
+ _a = promiseOrData;
16358
+ _b.label = 4;
16361
16359
  case 4:
16360
+ data = _a;
16361
+ _b.label = 5;
16362
+ case 5:
16362
16363
  // Apply filter (will update hiddenData)
16363
- data = this.filter(data, filterData, this._hiddenData);
16364
+ data = this.filter(data, filterData, excludedDataByFilter);
16364
16365
  total = data.length;
16365
16366
  // If page size=0 (e.g. only need total)
16366
16367
  if (size === 0) {
16367
- (_b = this._hiddenData).push.apply(_b, __spread(data));
16368
+ excludedDataByPagination = data;
16368
16369
  return [2 /*return*/, { data: [], total: total }];
16369
16370
  }
16370
16371
  // Slice in a page (using offset and size)
16371
16372
  if (offset > 0) {
16372
16373
  // Offset after the end: no result
16373
16374
  if (offset >= data.length) {
16374
- (_c = this._hiddenData).push.apply(_c, __spread(data));
16375
+ excludedDataByPagination = data;
16375
16376
  data = [];
16376
16377
  }
16377
16378
  else {
16378
- hiddenData = (size > 0 && ((offset + size) < data.length)) ?
16379
+ excludedDataByPagination = (size > 0 && ((offset + size) < data.length)) ?
16379
16380
  // Slice using limit to size
16380
16381
  data.slice(0, offset - 1).concat(data.slice(offset + size)) :
16381
16382
  // Slice without limit
16382
16383
  data.slice(0, offset - 1);
16383
- (_d = this._hiddenData).push.apply(_d, __spread(hiddenData));
16384
16384
  data = (size > 0 && ((offset + size) < data.length)) ?
16385
16385
  // Slice using limit to size
16386
16386
  data.slice(offset, offset + size) :
@@ -16390,7 +16390,7 @@
16390
16390
  }
16391
16391
  // Apply a limit
16392
16392
  else if (size > 0) {
16393
- (_e = this._hiddenData).push.apply(_e, __spread(data.slice(size)));
16393
+ excludedDataByPagination = data.slice(size);
16394
16394
  data = data.slice(0, size);
16395
16395
  }
16396
16396
  // No limit:
@@ -16403,6 +16403,11 @@
16403
16403
  data = data.slice(0);
16404
16404
  }
16405
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*/];
16406
16411
  }
16407
16412
  });
16408
16413
  }); }));
@@ -16446,9 +16451,11 @@
16446
16451
  return __generator(this, function (_a) {
16447
16452
  if (!this.data)
16448
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");
16449
16456
  updatedData = this.data.filter(function (entity) {
16450
- var shouldRemoved = dataToRemove.findIndex(function (entityToRemove) { return _this._equalsFn(entityToRemove, entity); }) !== -1;
16451
- return !shouldRemoved;
16457
+ var removed = dataToRemove.findIndex(function (entityToRemove) { return _this._equalsFn(entityToRemove, entity); }) !== -1;
16458
+ return !removed;
16452
16459
  });
16453
16460
  deleteCount = this.data.length - updatedData.length;
16454
16461
  if (deleteCount > 0) {