@sumaris-net/ngx-components 18.22.9 → 18.22.10
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.
- package/doc/changelog.md +3 -0
- package/esm2022/src/app/core/table/async-table.class.mjs +14 -7
- package/esm2022/src/app/core/table/table.class.mjs +31 -12
- package/fesm2022/sumaris-net.ngx-components.mjs +43 -17
- package/fesm2022/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
- package/src/app/core/table/async-table.class.d.ts +4 -2
- package/src/app/core/table/table.class.d.ts +3 -1
- package/src/assets/manifest.json +1 -1
|
@@ -38442,62 +38442,79 @@ class AppTable {
|
|
|
38442
38442
|
this.applyFilter(filter, opts);
|
|
38443
38443
|
}
|
|
38444
38444
|
}
|
|
38445
|
-
async confirmAndAdd(event, row) {
|
|
38445
|
+
async confirmAndAdd(event, row, opts) {
|
|
38446
38446
|
if (!this.confirmEditCreate(event, row)) {
|
|
38447
|
+
// If pending: Wait end of validation, then loop
|
|
38448
|
+
if (row.validator?.pending) {
|
|
38449
|
+
return (AppFormUtils.waitWhilePending(row.validator, { stop: this.destroySubject })
|
|
38450
|
+
// Loop after validation completed
|
|
38451
|
+
.then(() => this.confirmAndAdd(event, row, opts)));
|
|
38452
|
+
}
|
|
38453
|
+
// Go back to focusColumn
|
|
38454
|
+
if (opts?.focusColumn) {
|
|
38455
|
+
this.focusColumn = opts?.focusColumn;
|
|
38456
|
+
this.markForCheck();
|
|
38457
|
+
}
|
|
38447
38458
|
return false;
|
|
38448
38459
|
}
|
|
38449
38460
|
// Add row
|
|
38450
|
-
return this.addRow(event);
|
|
38461
|
+
return this.addRow(event, undefined /* insertAt: use default */, opts);
|
|
38451
38462
|
}
|
|
38452
38463
|
confirmAndBackward(event, row, opts) {
|
|
38453
38464
|
if (!this.inlineEdition)
|
|
38454
38465
|
return false;
|
|
38455
|
-
// Deleting edited row, if empty and not dirty
|
|
38456
38466
|
const previousRow = this.editedRow;
|
|
38467
|
+
const focusColumn = opts?.focusColumn ?? this.lastUserColumn;
|
|
38457
38468
|
event?.stopPropagation();
|
|
38469
|
+
// Deleting edited row, if empty and not dirty
|
|
38458
38470
|
if (previousRow) {
|
|
38459
38471
|
// Previous row was a nex row AND invalid: delete it
|
|
38460
38472
|
if (previousRow.id === -1 && previousRow.validator?.invalid && !previousRow.validator?.dirty) {
|
|
38461
38473
|
this.deleteNewRow(event, previousRow);
|
|
38462
38474
|
// Wait deletion is done, then edit previous row (by id, because of reloading)
|
|
38463
|
-
this.waitIdle().then(() => this.editRowById(event, row.id, { focusColumn
|
|
38475
|
+
this.waitIdle().then(() => this.editRowById(event, row.id, { focusColumn }));
|
|
38464
38476
|
return true;
|
|
38465
38477
|
}
|
|
38466
38478
|
// If cannot confirm previous row
|
|
38467
38479
|
else if (!this.confirmEditCreate(event, previousRow)) {
|
|
38468
38480
|
// If pending: Wait end of validation, then loop
|
|
38469
38481
|
if (previousRow.validator?.pending) {
|
|
38470
|
-
return AppFormUtils.waitWhilePending(previousRow.validator, { stop: this.destroySubject })
|
|
38482
|
+
return (AppFormUtils.waitWhilePending(previousRow.validator, { stop: this.destroySubject })
|
|
38483
|
+
// Wait end of validation and loop
|
|
38484
|
+
.then(() => this.confirmAndBackward(event, row, { focusColumn })));
|
|
38471
38485
|
}
|
|
38472
38486
|
// Go back to first column
|
|
38473
|
-
this.focusColumn =
|
|
38487
|
+
this.focusColumn = focusColumn;
|
|
38474
38488
|
this.markForCheck();
|
|
38475
38489
|
return false;
|
|
38476
38490
|
}
|
|
38477
38491
|
}
|
|
38478
38492
|
// Edit row, focusing at the end
|
|
38479
|
-
this.editRow(event, row, { focusColumn
|
|
38493
|
+
this.editRow(event, row, { focusColumn });
|
|
38480
38494
|
return true;
|
|
38481
38495
|
}
|
|
38482
38496
|
confirmAndForward(event, row, opts) {
|
|
38483
38497
|
if (!this.inlineEdition)
|
|
38484
38498
|
return false;
|
|
38485
38499
|
row = row || this.editedRow;
|
|
38500
|
+
const focusColumn = opts?.focusColumn ?? this.firstUserColumn;
|
|
38486
38501
|
event?.stopPropagation();
|
|
38487
38502
|
// If not confirmed
|
|
38488
38503
|
if (!this.confirmEditCreate(event, row)) {
|
|
38489
38504
|
// If pending: Wait end of validation, then loop
|
|
38490
38505
|
if (row.validator?.pending) {
|
|
38491
|
-
return AppFormUtils.waitWhilePending(row.validator, { stop: this.destroySubject })
|
|
38506
|
+
return (AppFormUtils.waitWhilePending(row.validator, { stop: this.destroySubject })
|
|
38507
|
+
// Wait end of validation and loop
|
|
38508
|
+
.then(() => this.confirmAndForward(event, row, { focusColumn })));
|
|
38492
38509
|
}
|
|
38493
38510
|
// Go back to first column
|
|
38494
|
-
this.focusColumn =
|
|
38511
|
+
this.focusColumn = focusColumn;
|
|
38495
38512
|
this.markForCheck();
|
|
38496
38513
|
return false;
|
|
38497
38514
|
}
|
|
38498
38515
|
// Edit next row
|
|
38499
38516
|
const nextRowId = row.id + 1;
|
|
38500
|
-
this.editRowById(event, nextRowId, { focusColumn
|
|
38517
|
+
this.editRowById(event, nextRowId, { focusColumn });
|
|
38501
38518
|
return true;
|
|
38502
38519
|
}
|
|
38503
38520
|
/**
|
|
@@ -38532,7 +38549,9 @@ class AppTable {
|
|
|
38532
38549
|
// If pending: Wait end of validation, then loop
|
|
38533
38550
|
// TODO: remove when using async isValid() function
|
|
38534
38551
|
if (row.validator.pending) {
|
|
38535
|
-
AppFormUtils.waitWhilePending(row.validator)
|
|
38552
|
+
AppFormUtils.waitWhilePending(row.validator)
|
|
38553
|
+
// Wait end of validation and loop
|
|
38554
|
+
.then(() => this.confirmEditCreate(event, row));
|
|
38536
38555
|
return false;
|
|
38537
38556
|
}
|
|
38538
38557
|
// NOT confirmed = row has error
|
|
@@ -41262,14 +41281,20 @@ class AppAsyncTable {
|
|
|
41262
41281
|
this.applyFilter(filter, opts);
|
|
41263
41282
|
}
|
|
41264
41283
|
}
|
|
41265
|
-
async confirmAndAdd(event, row) {
|
|
41284
|
+
async confirmAndAdd(event, row, opts) {
|
|
41266
41285
|
if (!(await this.confirmEditCreate(event, row))) {
|
|
41286
|
+
// Go back to focusColumn
|
|
41287
|
+
if (opts?.focusColumn) {
|
|
41288
|
+
this.focusColumn = opts?.focusColumn;
|
|
41289
|
+
this.markForCheck();
|
|
41290
|
+
}
|
|
41267
41291
|
return false;
|
|
41268
41292
|
}
|
|
41269
41293
|
// Add row
|
|
41270
|
-
return this.addRow(event);
|
|
41294
|
+
return this.addRow(event, undefined /* insertAt: use default */, opts);
|
|
41271
41295
|
}
|
|
41272
41296
|
async confirmAndBackward(event, row, opts) {
|
|
41297
|
+
const focusColumn = opts?.focusColumn ?? this.lastUserColumn;
|
|
41273
41298
|
// Deleting edited row, if empty and not dirty
|
|
41274
41299
|
if (this.dataSource.hasSomeEditingRow()) {
|
|
41275
41300
|
for (const editingRow of this.dataSource.getEditingRows().filter((row) => row.id === -1 && row.invalid && !row.dirty)) {
|
|
@@ -41277,26 +41302,27 @@ class AppAsyncTable {
|
|
|
41277
41302
|
}
|
|
41278
41303
|
// Wait deletion is done, then edit previous row (by id, because of reloading)
|
|
41279
41304
|
await this.waitIdle();
|
|
41280
|
-
await this.editRowById(event, row.id, { focusColumn
|
|
41305
|
+
await this.editRowById(event, row.id, { focusColumn });
|
|
41281
41306
|
return true;
|
|
41282
41307
|
}
|
|
41283
41308
|
// Edit row, focusing at the end
|
|
41284
|
-
await this.editRow(event, row, { focusColumn
|
|
41309
|
+
await this.editRow(event, row, { focusColumn });
|
|
41285
41310
|
return true;
|
|
41286
41311
|
}
|
|
41287
41312
|
async confirmAndForward(event, row, opts) {
|
|
41288
41313
|
if (!this.inlineEdition)
|
|
41289
41314
|
return false;
|
|
41315
|
+
const focusColumn = opts?.focusColumn ?? this.firstUserColumn;
|
|
41290
41316
|
const confirmed = await this.confirmEditCreate(event, row);
|
|
41291
41317
|
// If not confirmed
|
|
41292
41318
|
if (!confirmed) {
|
|
41293
41319
|
// Go back to first column
|
|
41294
|
-
this.focusColumn =
|
|
41320
|
+
this.focusColumn = focusColumn;
|
|
41295
41321
|
this.markForCheck();
|
|
41296
41322
|
return false;
|
|
41297
41323
|
}
|
|
41298
41324
|
// Edit next row
|
|
41299
|
-
await this.editRowById(event, row.id + 1, { focusColumn
|
|
41325
|
+
await this.editRowById(event, row.id + 1, { focusColumn });
|
|
41300
41326
|
return true;
|
|
41301
41327
|
}
|
|
41302
41328
|
/**
|