@sumaris-net/ngx-components 1.23.46 → 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) {
@@ -15148,6 +15148,8 @@
15148
15148
  target.creationDate = toDateISOString(this.creationDate);
15149
15149
  if (opts && opts.keepTypename === false)
15150
15150
  delete target.entityName;
15151
+ if (opts && opts.keepIcon === false)
15152
+ delete target.icon;
15151
15153
  return target;
15152
15154
  };
15153
15155
  BaseReferential.prototype.fromObject = function (source, opts) {
@@ -15162,6 +15164,7 @@
15162
15164
  this.parentId = source.parentId;
15163
15165
  this.creationDate = fromDateISOString(source.creationDate);
15164
15166
  this.entityName = source.entityName;
15167
+ this.icon = source.icon;
15165
15168
  };
15166
15169
  BaseReferential.prototype.equals = function (other) {
15167
15170
  return _super.prototype.equals.call(this, other) && this.entityName === other.entityName;
@@ -27143,7 +27146,7 @@
27143
27146
  }
27144
27147
  };
27145
27148
  AppTable.prototype.confirmAndAdd = function (event, row) {
27146
- if (!this.confirmEditCreate(event, row)) {
27149
+ if (row && !this.confirmEditCreate(event, row)) {
27147
27150
  return false;
27148
27151
  }
27149
27152
  // Add row
@@ -27249,22 +27252,31 @@
27249
27252
  }
27250
27253
  };
27251
27254
  AppTable.prototype.addRow = function (event, insertAt, opts) {
27252
- if (this.debug)
27253
- console.debug('[table] Asking for new row...');
27254
- if (!this._enabled)
27255
- return false;
27256
- // Use modal if inline edition is disabled
27257
- if (!this.inlineEdition) {
27258
- this.openNewRowDetail(event);
27259
- return false;
27260
- }
27261
- // Try to finish edited row first
27262
- if (!this.confirmEditCreate()) {
27263
- return false;
27264
- }
27265
- // Add new row
27266
- this.addRowToTable(insertAt, opts);
27267
- 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
+ });
27268
27280
  };
27269
27281
  AppTable.prototype.save = function (opts) {
27270
27282
  var _a, _b, _c, _d;
@@ -27344,6 +27356,8 @@
27344
27356
  return [4 /*yield*/, this.addRowToTable(row.id + 1)];
27345
27357
  case 1:
27346
27358
  newRow = _e.sent();
27359
+ if (!newRow)
27360
+ throw new Error('Cannot add new row to table');
27347
27361
  json = Object.assign(Object.assign({}, row.currentData), { id: null });
27348
27362
  // Reset some properties (e.g. rankOrder, etc)
27349
27363
  if (opts && opts.skipProperties) {
@@ -27589,6 +27603,7 @@
27589
27603
  event.preventDefault();
27590
27604
  }
27591
27605
  this.markAsLoading();
27606
+ this.selection.clear();
27592
27607
  this.openRow(row.currentData.id, row)
27593
27608
  .then(function () { return _this.markAsLoaded(); })
27594
27609
  .catch(function () { return _this.markAsLoaded(); });
@@ -28063,7 +28078,13 @@
28063
28078
  var row;
28064
28079
  return __generator(this, function (_e) {
28065
28080
  switch (_e.label) {
28066
- 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 })];
28067
28088
  case 1:
28068
28089
  row = _e.sent();
28069
28090
  if (!row)
@@ -32897,6 +32918,15 @@
32897
32918
  enumerable: false,
32898
32919
  configurable: true
32899
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
+ });
32900
32930
  UsersPage.prototype.ngOnInit = function () {
32901
32931
  var _this = this;
32902
32932
  _super.prototype.ngOnInit.call(this);