@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
|
@@ -25394,7 +25394,8 @@ class AppTable {
|
|
|
25394
25394
|
this.resetError();
|
|
25395
25395
|
// Keep edited row id (should be done BEFORE confirmEditCreate() )
|
|
25396
25396
|
this.previouslyEditedRowId = opts.keepEditing ? ((((_a = this.editedRow) === null || _a === void 0 ? void 0 : _a.editing) ? this.editedRow.id : undefined) || ((_b = this.singleSelectedRow) === null || _b === void 0 ? void 0 : _b.id)) : undefined;
|
|
25397
|
-
const
|
|
25397
|
+
const previouslyEditedRowId = this.previouslyEditedRowId;
|
|
25398
|
+
const previouslyEditedData = opts.keepEditing ? (isNotNil(previouslyEditedRowId) && ((_c = this.editedRow) === null || _c === void 0 ? void 0 : _c.currentData) || ((_d = this.singleSelectedRow) === null || _d === void 0 ? void 0 : _d.currentData)) : undefined;
|
|
25398
25399
|
if (!this.confirmEditCreate()) {
|
|
25399
25400
|
throw { code: ErrorCodes.TABLE_INVALID_ROW_ERROR, message: 'ERROR.TABLE_INVALID_ROW_ERROR' };
|
|
25400
25401
|
}
|
|
@@ -25416,8 +25417,8 @@ class AppTable {
|
|
|
25416
25417
|
finally {
|
|
25417
25418
|
this.markAsSaved();
|
|
25418
25419
|
// Restore previous row
|
|
25419
|
-
if (isNotNil(
|
|
25420
|
-
yield this.selectRowByIdOrData(
|
|
25420
|
+
if (isNotNil(previouslyEditedRowId)) {
|
|
25421
|
+
yield this.selectRowByIdOrData(previouslyEditedRowId, previouslyEditedData);
|
|
25421
25422
|
}
|
|
25422
25423
|
}
|
|
25423
25424
|
});
|
|
@@ -31029,25 +31030,28 @@ class AppAsyncTable {
|
|
|
31029
31030
|
this.onConfirmEditCreateRow.next(row);
|
|
31030
31031
|
return true; // Continue
|
|
31031
31032
|
}
|
|
31032
|
-
if (row.validator) {
|
|
31033
|
-
|
|
31034
|
-
|
|
31035
|
-
|
|
31036
|
-
|
|
31037
|
-
|
|
31038
|
-
|
|
31039
|
-
|
|
31040
|
-
|
|
31041
|
-
|
|
31042
|
-
|
|
31043
|
-
|
|
31044
|
-
|
|
31045
|
-
|
|
31046
|
-
|
|
31047
|
-
|
|
31048
|
-
|
|
31049
|
-
|
|
31050
|
-
|
|
31033
|
+
// if (row.validator) {
|
|
31034
|
+
// // If pending: Wait end of validation
|
|
31035
|
+
// // TODO: remove when using async isValid() function
|
|
31036
|
+
// if (row.pending) {
|
|
31037
|
+
// await AppFormUtils.waitWhilePending(row.validator);
|
|
31038
|
+
// }
|
|
31039
|
+
//
|
|
31040
|
+
// // NOT confirmed = row has error
|
|
31041
|
+
// if (this.debug) {
|
|
31042
|
+
// console.warn('[table] Cannot confirm row, because invalid');
|
|
31043
|
+
// AppFormUtils.logFormErrors(row.validator, '[table] ');
|
|
31044
|
+
// }
|
|
31045
|
+
//
|
|
31046
|
+
// // fix: mark all controls as touched to show errors
|
|
31047
|
+
// row.validator.markAllAsTouched();
|
|
31048
|
+
//
|
|
31049
|
+
// // Compute row error, and propagate to table's error
|
|
31050
|
+
// if (this.propagateRowError) {
|
|
31051
|
+
// const error = this.getRowError(row);
|
|
31052
|
+
// this.setError(error);
|
|
31053
|
+
// }
|
|
31054
|
+
// }
|
|
31051
31055
|
// Not confirmed
|
|
31052
31056
|
return false;
|
|
31053
31057
|
});
|
|
@@ -31099,7 +31103,8 @@ class AppAsyncTable {
|
|
|
31099
31103
|
// Keep edited row id (should be done BEFORE confirmEditCreate() )
|
|
31100
31104
|
const editedRow = this.dataSource.getSingleEditingRow();
|
|
31101
31105
|
this.previouslyEditedRowId = opts.keepEditing ? (((editedRow === null || editedRow === void 0 ? void 0 : editedRow.editing) ? editedRow.id : undefined) || ((_a = this.singleSelectedRow) === null || _a === void 0 ? void 0 : _a.id)) : undefined;
|
|
31102
|
-
const
|
|
31106
|
+
const previouslyEditedRowId = this.previouslyEditedRowId;
|
|
31107
|
+
const previouslyEditedData = opts.keepEditing ? (isNotNil(previouslyEditedRowId) && (editedRow === null || editedRow === void 0 ? void 0 : editedRow.currentData) || ((_b = this.singleSelectedRow) === null || _b === void 0 ? void 0 : _b.currentData)) : undefined;
|
|
31103
31108
|
if (!(yield this.confirmEditCreate())) {
|
|
31104
31109
|
throw { code: ErrorCodes.TABLE_INVALID_ROW_ERROR, message: 'ERROR.TABLE_INVALID_ROW_ERROR' };
|
|
31105
31110
|
}
|
|
@@ -31121,8 +31126,8 @@ class AppAsyncTable {
|
|
|
31121
31126
|
finally {
|
|
31122
31127
|
this.markAsSaved();
|
|
31123
31128
|
// Restore previous row
|
|
31124
|
-
if (isNotNil(
|
|
31125
|
-
yield this.selectRowByIdOrData(
|
|
31129
|
+
if (isNotNil(previouslyEditedRowId)) {
|
|
31130
|
+
yield this.selectRowByIdOrData(previouslyEditedRowId, previouslyEditedData);
|
|
31126
31131
|
}
|
|
31127
31132
|
}
|
|
31128
31133
|
});
|