@sumaris-net/ngx-components 18.22.8 → 18.22.9

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.
@@ -38321,7 +38321,8 @@ class AppTable {
38321
38321
  }
38322
38322
  if (this.debug)
38323
38323
  console.debug('[table] Calling dataSource.watchAll()...');
38324
- return this._dataSource.watchAll(this.pageOffset, this.pageSize, this.sortActive, this.sortDirection, this._filter)
38324
+ return this._dataSource
38325
+ .watchAll(this.pageOffset, this.pageSize, this.sortActive, this.sortDirection, this._filter)
38325
38326
  .pipe(takeUntil(this.onRefresh));
38326
38327
  }), catchError((err) => {
38327
38328
  if (this.debug)
@@ -38448,7 +38449,9 @@ class AppTable {
38448
38449
  // Add row
38449
38450
  return this.addRow(event);
38450
38451
  }
38451
- confirmAndBackward(event, row) {
38452
+ confirmAndBackward(event, row, opts) {
38453
+ if (!this.inlineEdition)
38454
+ return false;
38452
38455
  // Deleting edited row, if empty and not dirty
38453
38456
  const previousRow = this.editedRow;
38454
38457
  event?.stopPropagation();
@@ -38464,35 +38467,37 @@ class AppTable {
38464
38467
  else if (!this.confirmEditCreate(event, previousRow)) {
38465
38468
  // If pending: Wait end of validation, then loop
38466
38469
  if (previousRow.validator?.pending) {
38467
- return AppFormUtils.waitWhilePending(previousRow.validator).then(() => this.confirmAndBackward(event, row));
38470
+ return AppFormUtils.waitWhilePending(previousRow.validator, { stop: this.destroySubject }).then(() => this.confirmAndBackward(event, row));
38468
38471
  }
38469
38472
  // Go back to first column
38470
- this.focusColumn = this.lastUserColumn;
38473
+ this.focusColumn = opts?.focusColumn ?? this.lastUserColumn;
38471
38474
  this.markForCheck();
38472
38475
  return false;
38473
38476
  }
38474
38477
  }
38475
38478
  // Edit row, focusing at the end
38476
- this.editRow(event, row, { focusColumn: this.lastUserColumn });
38479
+ this.editRow(event, row, { focusColumn: opts?.focusColumn ?? this.lastUserColumn });
38477
38480
  return true;
38478
38481
  }
38479
- confirmAndForward(event, row) {
38482
+ confirmAndForward(event, row, opts) {
38480
38483
  if (!this.inlineEdition)
38481
38484
  return false;
38482
38485
  row = row || this.editedRow;
38483
38486
  event?.stopPropagation();
38487
+ // If not confirmed
38484
38488
  if (!this.confirmEditCreate(event, row)) {
38485
38489
  // If pending: Wait end of validation, then loop
38486
38490
  if (row.validator?.pending) {
38487
- return AppFormUtils.waitWhilePending(row.validator).then(() => this.confirmAndForward(event, row));
38491
+ return AppFormUtils.waitWhilePending(row.validator, { stop: this.destroySubject }).then(() => this.confirmAndForward(event, row));
38488
38492
  }
38489
38493
  // Go back to first column
38490
- this.focusColumn = this.firstUserColumn;
38494
+ this.focusColumn = opts?.focusColumn ?? this.firstUserColumn;
38491
38495
  this.markForCheck();
38492
38496
  return false;
38493
38497
  }
38494
38498
  // Edit next row
38495
- this.editRowById(event, row.id + 1, { focusColumn: this.firstUserColumn });
38499
+ const nextRowId = row.id + 1;
38500
+ this.editRowById(event, nextRowId, { focusColumn: opts?.focusColumn ?? this.firstUserColumn });
38496
38501
  return true;
38497
38502
  }
38498
38503
  /**
@@ -39012,7 +39017,7 @@ class AppTable {
39012
39017
  if (!confirmed)
39013
39018
  return false;
39014
39019
  if (!row.editing && !this.loading) {
39015
- this.focusColumn = (opts && opts.focusColumn) || this.focusColumn;
39020
+ this.focusColumn = opts?.focusColumn ?? this.focusColumn;
39016
39021
  this._dataSource.startEdit(row);
39017
39022
  }
39018
39023
  this.editedRow = row;
@@ -41264,7 +41269,7 @@ class AppAsyncTable {
41264
41269
  // Add row
41265
41270
  return this.addRow(event);
41266
41271
  }
41267
- async confirmAndBackward(event, row) {
41272
+ async confirmAndBackward(event, row, opts) {
41268
41273
  // Deleting edited row, if empty and not dirty
41269
41274
  if (this.dataSource.hasSomeEditingRow()) {
41270
41275
  for (const editingRow of this.dataSource.getEditingRows().filter((row) => row.id === -1 && row.invalid && !row.dirty)) {
@@ -41272,21 +41277,26 @@ class AppAsyncTable {
41272
41277
  }
41273
41278
  // Wait deletion is done, then edit previous row (by id, because of reloading)
41274
41279
  await this.waitIdle();
41275
- await this.editRowById(event, row.id, { focusColumn: this.lastUserColumn });
41280
+ await this.editRowById(event, row.id, { focusColumn: opts?.focusColumn ?? this.lastUserColumn });
41276
41281
  return true;
41277
41282
  }
41278
41283
  // Edit row, focusing at the end
41279
- await this.editRow(event, row, { focusColumn: this.lastUserColumn });
41284
+ await this.editRow(event, row, { focusColumn: opts?.focusColumn ?? this.lastUserColumn });
41280
41285
  return true;
41281
41286
  }
41282
- async confirmAndForward(event, row) {
41287
+ async confirmAndForward(event, row, opts) {
41283
41288
  if (!this.inlineEdition)
41284
41289
  return false;
41285
41290
  const confirmed = await this.confirmEditCreate(event, row);
41286
- if (!confirmed)
41287
- return false; // Not confirmed
41291
+ // If not confirmed
41292
+ if (!confirmed) {
41293
+ // Go back to first column
41294
+ this.focusColumn = opts?.focusColumn ?? this.firstUserColumn;
41295
+ this.markForCheck();
41296
+ return false;
41297
+ }
41288
41298
  // Edit next row
41289
- await this.editRowById(event, row.id + 1, { focusColumn: this.firstUserColumn });
41299
+ await this.editRowById(event, row.id + 1, { focusColumn: opts?.focusColumn ?? this.firstUserColumn });
41290
41300
  return true;
41291
41301
  }
41292
41302
  /**
@@ -41789,7 +41799,7 @@ class AppAsyncTable {
41789
41799
  return false;
41790
41800
  }
41791
41801
  if (!row.editing && !this.loading) {
41792
- this.focusColumn = (opts && opts.focusColumn) || this.focusColumn;
41802
+ this.focusColumn = opts?.focusColumn ?? this.focusColumn;
41793
41803
  await this._dataSource.startEdit(row);
41794
41804
  }
41795
41805
  this.onStartEditingRow.emit(row);