@sumaris-net/ngx-components 1.23.0-rc1 → 1.23.0-rc2

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.
@@ -26125,7 +26125,8 @@
26125
26125
  EntitiesTableDataSource.prototype.getRows = function () {
26126
26126
  return this.rowsSubject.getValue();
26127
26127
  };
26128
- EntitiesTableDataSource.prototype.createNew = function (insertAt) {
26128
+ EntitiesTableDataSource.prototype.createNew = function (insertAt, options) {
26129
+ if (options === void 0) { options = { editing: true }; }
26129
26130
  var _super = Object.create(null, {
26130
26131
  createNew: { get: function () { return _super_1.prototype.createNew; } }
26131
26132
  });
@@ -26141,7 +26142,7 @@
26141
26142
  _b.label = 1;
26142
26143
  case 1:
26143
26144
  _b.trys.push([1, , 7, 8]);
26144
- return [4 /*yield*/, _super.createNew.call(this, insertAt)];
26145
+ return [4 /*yield*/, _super.createNew.call(this, insertAt, options)];
26145
26146
  case 2:
26146
26147
  row = _b.sent();
26147
26148
  if (!row)
@@ -26160,7 +26161,8 @@
26160
26161
  console.error(err_2 && err_2.message || err_2, err_2);
26161
26162
  return [3 /*break*/, 6];
26162
26163
  case 6:
26163
- this._editingRowCount++;
26164
+ if (row.editing)
26165
+ this._editingRowCount++;
26164
26166
  return [2 /*return*/, row];
26165
26167
  case 7:
26166
26168
  this._creating = false;
@@ -26872,7 +26874,7 @@
26872
26874
  if (id < 0)
26873
26875
  return [2 /*return*/];
26874
26876
  if (!(id >= this.visibleRowCount)) return [3 /*break*/, 1];
26875
- this.addRow(event, undefined, opts);
26877
+ this.addRow(event, undefined, Object.assign(Object.assign({}, opts), { editing: true }));
26876
26878
  return [3 /*break*/, 3];
26877
26879
  case 1: return [4 /*yield*/, this.dataSource.getRow(id)];
26878
26880
  case 2:
@@ -27772,22 +27774,27 @@
27772
27774
  };
27773
27775
  AppTable.prototype.addRowToTable = function (insertAt, opts) {
27774
27776
  return __awaiter(this, void 0, void 0, function () {
27777
+ var row;
27775
27778
  return __generator(this, function (_e) {
27776
27779
  switch (_e.label) {
27777
27780
  case 0:
27778
27781
  this.focusFirstColumn = true;
27779
27782
  this.focusColumn = (opts === null || opts === void 0 ? void 0 : opts.focusColumn) || this.firstUserColumn;
27780
- return [4 /*yield*/, this._dataSource.createNew(insertAt)];
27783
+ return [4 /*yield*/, this._dataSource.createNew(insertAt, Object.assign({ editing: true }, opts))];
27781
27784
  case 1:
27782
- _e.sent();
27783
- this.editedRow = this._dataSource.getRow(-1);
27785
+ row = _e.sent();
27786
+ if (!row)
27787
+ return [2 /*return*/, undefined];
27784
27788
  // Emit start editing event
27785
- this.onStartEditingRow.emit(this.editedRow);
27789
+ if (row.editing) {
27790
+ this.editedRow = row;
27791
+ this.onStartEditingRow.emit(this.editedRow);
27792
+ }
27786
27793
  this.totalRowCount++;
27787
27794
  this.visibleRowCount++;
27788
27795
  this.markAsDirty({ emitEvent: false /*markForCheck() is called just after*/ });
27789
27796
  this.markForCheck();
27790
- return [2 /*return*/, this.editedRow];
27797
+ return [2 /*return*/, row];
27791
27798
  }
27792
27799
  });
27793
27800
  });
@@ -27994,18 +28001,13 @@
27994
28001
  return __awaiter(this, void 0, void 0, function () {
27995
28002
  var rows, pristine;
27996
28003
  return __generator(this, function (_e) {
27997
- switch (_e.label) {
27998
- case 0:
27999
- if (!this.dirty)
28000
- return [2 /*return*/]; // Already pristine
28001
- return [4 /*yield*/, this._dataSource.getRows()];
28002
- case 1:
28003
- rows = _e.sent();
28004
- pristine = (rows || []).findIndex(function (row) { var _a; return (_a = row.validator) === null || _a === void 0 ? void 0 : _a.dirty; }) === -1;
28005
- if (pristine)
28006
- this.markAsPristine(opts);
28007
- return [2 /*return*/];
28008
- }
28004
+ if (!this.dirty)
28005
+ return [2 /*return*/]; // Already pristine
28006
+ rows = this._dataSource.getRows();
28007
+ pristine = (rows || []).findIndex(function (row) { var _a; return (_a = row.validator) === null || _a === void 0 ? void 0 : _a.dirty; }) === -1;
28008
+ if (pristine)
28009
+ this.markAsPristine(opts);
28010
+ return [2 /*return*/];
28009
28011
  });
28010
28012
  });
28011
28013
  };