@sumaris-net/ngx-components 2.5.1 → 2.5.2-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.
- package/esm2020/src/app/core/table/async-table.class.mjs +27 -23
- package/esm2020/src/app/core/table/table.class.mjs +5 -4
- package/fesm2015/sumaris-net.ngx-components.mjs +30 -25
- package/fesm2015/sumaris-net.ngx-components.mjs.map +1 -1
- package/fesm2020/sumaris-net.ngx-components.mjs +30 -25
- package/fesm2020/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -24937,7 +24937,8 @@ class AppTable {
|
|
|
24937
24937
|
this.resetError();
|
|
24938
24938
|
// Keep edited row id (should be done BEFORE confirmEditCreate() )
|
|
24939
24939
|
this.previouslyEditedRowId = opts.keepEditing ? ((this.editedRow?.editing ? this.editedRow.id : undefined) || this.singleSelectedRow?.id) : undefined;
|
|
24940
|
-
const
|
|
24940
|
+
const previouslyEditedRowId = this.previouslyEditedRowId;
|
|
24941
|
+
const previouslyEditedData = opts.keepEditing ? (isNotNil(previouslyEditedRowId) && this.editedRow?.currentData || this.singleSelectedRow?.currentData) : undefined;
|
|
24941
24942
|
if (!this.confirmEditCreate()) {
|
|
24942
24943
|
throw { code: ErrorCodes.TABLE_INVALID_ROW_ERROR, message: 'ERROR.TABLE_INVALID_ROW_ERROR' };
|
|
24943
24944
|
}
|
|
@@ -24959,8 +24960,8 @@ class AppTable {
|
|
|
24959
24960
|
finally {
|
|
24960
24961
|
this.markAsSaved();
|
|
24961
24962
|
// Restore previous row
|
|
24962
|
-
if (isNotNil(
|
|
24963
|
-
await this.selectRowByIdOrData(
|
|
24963
|
+
if (isNotNil(previouslyEditedRowId)) {
|
|
24964
|
+
await this.selectRowByIdOrData(previouslyEditedRowId, previouslyEditedData);
|
|
24964
24965
|
}
|
|
24965
24966
|
}
|
|
24966
24967
|
}
|
|
@@ -30357,25 +30358,28 @@ class AppAsyncTable {
|
|
|
30357
30358
|
this.onConfirmEditCreateRow.next(row);
|
|
30358
30359
|
return true; // Continue
|
|
30359
30360
|
}
|
|
30360
|
-
if (row.validator) {
|
|
30361
|
-
|
|
30362
|
-
|
|
30363
|
-
|
|
30364
|
-
|
|
30365
|
-
|
|
30366
|
-
|
|
30367
|
-
|
|
30368
|
-
|
|
30369
|
-
|
|
30370
|
-
|
|
30371
|
-
|
|
30372
|
-
|
|
30373
|
-
|
|
30374
|
-
|
|
30375
|
-
|
|
30376
|
-
|
|
30377
|
-
|
|
30378
|
-
|
|
30361
|
+
// if (row.validator) {
|
|
30362
|
+
// // If pending: Wait end of validation
|
|
30363
|
+
// // TODO: remove when using async isValid() function
|
|
30364
|
+
// if (row.pending) {
|
|
30365
|
+
// await AppFormUtils.waitWhilePending(row.validator);
|
|
30366
|
+
// }
|
|
30367
|
+
//
|
|
30368
|
+
// // NOT confirmed = row has error
|
|
30369
|
+
// if (this.debug) {
|
|
30370
|
+
// console.warn('[table] Cannot confirm row, because invalid');
|
|
30371
|
+
// AppFormUtils.logFormErrors(row.validator, '[table] ');
|
|
30372
|
+
// }
|
|
30373
|
+
//
|
|
30374
|
+
// // fix: mark all controls as touched to show errors
|
|
30375
|
+
// row.validator.markAllAsTouched();
|
|
30376
|
+
//
|
|
30377
|
+
// // Compute row error, and propagate to table's error
|
|
30378
|
+
// if (this.propagateRowError) {
|
|
30379
|
+
// const error = this.getRowError(row);
|
|
30380
|
+
// this.setError(error);
|
|
30381
|
+
// }
|
|
30382
|
+
// }
|
|
30379
30383
|
// Not confirmed
|
|
30380
30384
|
return false;
|
|
30381
30385
|
}
|
|
@@ -30423,7 +30427,8 @@ class AppAsyncTable {
|
|
|
30423
30427
|
// Keep edited row id (should be done BEFORE confirmEditCreate() )
|
|
30424
30428
|
const editedRow = this.dataSource.getSingleEditingRow();
|
|
30425
30429
|
this.previouslyEditedRowId = opts.keepEditing ? ((editedRow?.editing ? editedRow.id : undefined) || this.singleSelectedRow?.id) : undefined;
|
|
30426
|
-
const
|
|
30430
|
+
const previouslyEditedRowId = this.previouslyEditedRowId;
|
|
30431
|
+
const previouslyEditedData = opts.keepEditing ? (isNotNil(previouslyEditedRowId) && editedRow?.currentData || this.singleSelectedRow?.currentData) : undefined;
|
|
30427
30432
|
if (!await this.confirmEditCreate()) {
|
|
30428
30433
|
throw { code: ErrorCodes.TABLE_INVALID_ROW_ERROR, message: 'ERROR.TABLE_INVALID_ROW_ERROR' };
|
|
30429
30434
|
}
|
|
@@ -30445,8 +30450,8 @@ class AppAsyncTable {
|
|
|
30445
30450
|
finally {
|
|
30446
30451
|
this.markAsSaved();
|
|
30447
30452
|
// Restore previous row
|
|
30448
|
-
if (isNotNil(
|
|
30449
|
-
await this.selectRowByIdOrData(
|
|
30453
|
+
if (isNotNil(previouslyEditedRowId)) {
|
|
30454
|
+
await this.selectRowByIdOrData(previouslyEditedRowId, previouslyEditedData);
|
|
30450
30455
|
}
|
|
30451
30456
|
}
|
|
30452
30457
|
}
|