@sumaris-net/ngx-components 1.23.47 → 1.23.49

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.
@@ -1142,7 +1142,7 @@
1142
1142
  return new i0.EventEmitter(true);
1143
1143
  }
1144
1144
  function createPromiseEvent(eventType, promise, initArg) {
1145
- var detail = Object.assign(Object.assign({}, (initArg && initArg.detail || {})), promise);
1145
+ var detail = Object.assign(Object.assign({}, ((initArg === null || initArg === void 0 ? void 0 : initArg.detail) || {})), promise);
1146
1146
  return new CustomEvent(eventType, { detail: detail });
1147
1147
  }
1148
1148
  function emitPromiseEvent(emitter, eventType, initArg) {
@@ -21126,8 +21126,10 @@
21126
21126
  return __generator(this, function (_c) {
21127
21127
  if (this.debug)
21128
21128
  console.debug('[memory-data-service] Stopping...');
21129
- this.dataSubject.complete();
21130
- this.dataSubject.unsubscribe();
21129
+ if (!this.dataSubject.closed) {
21130
+ this.dataSubject.complete();
21131
+ this.dataSubject.unsubscribe();
21132
+ }
21131
21133
  this._hiddenData = null;
21132
21134
  this.markAsSaved();
21133
21135
  this.markAsPristine();
@@ -21279,10 +21281,10 @@
21279
21281
  offset = offset >= 0 ? offset : 0;
21280
21282
  size = size >= 0 ? size : -1;
21281
21283
  return this.dataSubject
21282
- .pipe(operators.takeUntil(this.stopSubject),
21284
+ .pipe(
21283
21285
  // Warn if waiting value to be set
21284
- 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)
21285
- );
21286
+ 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)
21287
+ operators.takeUntil(this.stopSubject));
21286
21288
  };
21287
21289
  InMemoryEntitiesService.prototype.saveAll = function (data, options) {
21288
21290
  return __awaiter(this, void 0, void 0, function () {
@@ -27146,7 +27148,7 @@
27146
27148
  }
27147
27149
  };
27148
27150
  AppTable.prototype.confirmAndAdd = function (event, row) {
27149
- if (!this.confirmEditCreate(event, row)) {
27151
+ if (row && !this.confirmEditCreate(event, row)) {
27150
27152
  return false;
27151
27153
  }
27152
27154
  // Add row
@@ -27252,22 +27254,31 @@
27252
27254
  }
27253
27255
  };
27254
27256
  AppTable.prototype.addRow = function (event, insertAt, opts) {
27255
- if (this.debug)
27256
- console.debug('[table] Asking for new row...');
27257
- if (!this._enabled)
27258
- return false;
27259
- // Use modal if inline edition is disabled
27260
- if (!this.inlineEdition) {
27261
- this.openNewRowDetail(event);
27262
- return false;
27263
- }
27264
- // Try to finish edited row first
27265
- if (!this.confirmEditCreate()) {
27266
- return false;
27267
- }
27268
- // Add new row
27269
- this.addRowToTable(insertAt, opts);
27270
- return true;
27257
+ return __awaiter(this, void 0, void 0, function () {
27258
+ var row;
27259
+ return __generator(this, function (_e) {
27260
+ switch (_e.label) {
27261
+ case 0:
27262
+ if (this.debug)
27263
+ console.debug('[table] Asking for new row...');
27264
+ if (!this._enabled)
27265
+ return [2 /*return*/, false];
27266
+ // Use modal if inline edition is disabled
27267
+ if (!this.inlineEdition) {
27268
+ this.openNewRowDetail(event);
27269
+ return [2 /*return*/, false];
27270
+ }
27271
+ // Try to finish edited row first
27272
+ if (!this.confirmEditCreate()) {
27273
+ return [2 /*return*/, false];
27274
+ }
27275
+ return [4 /*yield*/, this.addRowToTable(insertAt, opts)];
27276
+ case 1:
27277
+ row = _e.sent();
27278
+ return [2 /*return*/, !!row];
27279
+ }
27280
+ });
27281
+ });
27271
27282
  };
27272
27283
  AppTable.prototype.save = function (opts) {
27273
27284
  var _a, _b, _c, _d;
@@ -27347,6 +27358,8 @@
27347
27358
  return [4 /*yield*/, this.addRowToTable(row.id + 1)];
27348
27359
  case 1:
27349
27360
  newRow = _e.sent();
27361
+ if (!newRow)
27362
+ throw new Error('Cannot add new row to table');
27350
27363
  json = Object.assign(Object.assign({}, row.currentData), { id: null });
27351
27364
  // Reset some properties (e.g. rankOrder, etc)
27352
27365
  if (opts && opts.skipProperties) {
@@ -27592,6 +27605,7 @@
27592
27605
  event.preventDefault();
27593
27606
  }
27594
27607
  this.markAsLoading();
27608
+ this.selection.clear();
27595
27609
  this.openRow(row.currentData.id, row)
27596
27610
  .then(function () { return _this.markAsLoaded(); })
27597
27611
  .catch(function () { return _this.markAsLoaded(); });
@@ -28066,7 +28080,13 @@
28066
28080
  var row;
28067
28081
  return __generator(this, function (_e) {
28068
28082
  switch (_e.label) {
28069
- case 0: return [4 /*yield*/, this._dataSource.createNew(insertAt, Object.assign({ editing: true }, opts))];
28083
+ case 0:
28084
+ // Try to finish edited row first
28085
+ if (!this.confirmEditCreate()) {
28086
+ console.warn('[table] Cannot add new row, because the previous edited row cannot be confirmed');
28087
+ return [2 /*return*/, undefined];
28088
+ }
28089
+ return [4 /*yield*/, this._dataSource.createNew(insertAt, { editing: opts === null || opts === void 0 ? void 0 : opts.editing })];
28070
28090
  case 1:
28071
28091
  row = _e.sent();
28072
28092
  if (!row)
@@ -32900,6 +32920,15 @@
32900
32920
  enumerable: false,
32901
32921
  configurable: true
32902
32922
  });
32923
+ Object.defineProperty(UsersPage.prototype, "firstUserColumn", {
32924
+ get: function () {
32925
+ var columnName = this.displayedColumns[RESERVED_START_COLUMNS.length];
32926
+ // Skip avatar column, if present
32927
+ return columnName === 'avatar' && this.displayedColumns[RESERVED_START_COLUMNS.length + 1] || columnName;
32928
+ },
32929
+ enumerable: false,
32930
+ configurable: true
32931
+ });
32903
32932
  UsersPage.prototype.ngOnInit = function () {
32904
32933
  var _this = this;
32905
32934
  _super.prototype.ngOnInit.call(this);