@sumaris-net/ngx-components 1.23.47 → 1.23.48

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) {
@@ -27146,7 +27146,7 @@
27146
27146
  }
27147
27147
  };
27148
27148
  AppTable.prototype.confirmAndAdd = function (event, row) {
27149
- if (!this.confirmEditCreate(event, row)) {
27149
+ if (row && !this.confirmEditCreate(event, row)) {
27150
27150
  return false;
27151
27151
  }
27152
27152
  // Add row
@@ -27252,22 +27252,31 @@
27252
27252
  }
27253
27253
  };
27254
27254
  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;
27255
+ return __awaiter(this, void 0, void 0, function () {
27256
+ var row;
27257
+ return __generator(this, function (_e) {
27258
+ switch (_e.label) {
27259
+ case 0:
27260
+ if (this.debug)
27261
+ console.debug('[table] Asking for new row...');
27262
+ if (!this._enabled)
27263
+ return [2 /*return*/, false];
27264
+ // Use modal if inline edition is disabled
27265
+ if (!this.inlineEdition) {
27266
+ this.openNewRowDetail(event);
27267
+ return [2 /*return*/, false];
27268
+ }
27269
+ // Try to finish edited row first
27270
+ if (!this.confirmEditCreate()) {
27271
+ return [2 /*return*/, false];
27272
+ }
27273
+ return [4 /*yield*/, this.addRowToTable(insertAt, opts)];
27274
+ case 1:
27275
+ row = _e.sent();
27276
+ return [2 /*return*/, !!row];
27277
+ }
27278
+ });
27279
+ });
27271
27280
  };
27272
27281
  AppTable.prototype.save = function (opts) {
27273
27282
  var _a, _b, _c, _d;
@@ -27347,6 +27356,8 @@
27347
27356
  return [4 /*yield*/, this.addRowToTable(row.id + 1)];
27348
27357
  case 1:
27349
27358
  newRow = _e.sent();
27359
+ if (!newRow)
27360
+ throw new Error('Cannot add new row to table');
27350
27361
  json = Object.assign(Object.assign({}, row.currentData), { id: null });
27351
27362
  // Reset some properties (e.g. rankOrder, etc)
27352
27363
  if (opts && opts.skipProperties) {
@@ -27592,6 +27603,7 @@
27592
27603
  event.preventDefault();
27593
27604
  }
27594
27605
  this.markAsLoading();
27606
+ this.selection.clear();
27595
27607
  this.openRow(row.currentData.id, row)
27596
27608
  .then(function () { return _this.markAsLoaded(); })
27597
27609
  .catch(function () { return _this.markAsLoaded(); });
@@ -28066,7 +28078,13 @@
28066
28078
  var row;
28067
28079
  return __generator(this, function (_e) {
28068
28080
  switch (_e.label) {
28069
- case 0: return [4 /*yield*/, this._dataSource.createNew(insertAt, Object.assign({ editing: true }, opts))];
28081
+ case 0:
28082
+ // Try to finish edited row first
28083
+ if (!this.confirmEditCreate()) {
28084
+ console.warn('[table] Cannot add new row, because the previous edited row cannot be confirmed');
28085
+ return [2 /*return*/, undefined];
28086
+ }
28087
+ return [4 /*yield*/, this._dataSource.createNew(insertAt, { editing: opts === null || opts === void 0 ? void 0 : opts.editing })];
28070
28088
  case 1:
28071
28089
  row = _e.sent();
28072
28090
  if (!row)
@@ -32900,6 +32918,15 @@
32900
32918
  enumerable: false,
32901
32919
  configurable: true
32902
32920
  });
32921
+ Object.defineProperty(UsersPage.prototype, "firstUserColumn", {
32922
+ get: function () {
32923
+ var columnName = this.displayedColumns[RESERVED_START_COLUMNS.length];
32924
+ // Skip avatar column, if present
32925
+ return columnName === 'avatar' && this.displayedColumns[RESERVED_START_COLUMNS.length + 1] || columnName;
32926
+ },
32927
+ enumerable: false,
32928
+ configurable: true
32929
+ });
32903
32930
  UsersPage.prototype.ngOnInit = function () {
32904
32931
  var _this = this;
32905
32932
  _super.prototype.ngOnInit.call(this);