Commit 2536783d authored by LAVENIER's avatar LAVENIER
Browse files

Release v0.11.10

[enh] Table: allow to cancelOrDelete() with keepEditing forced to false
parent 67d7ea9f
{
"name": "@sumaris-net/ngx-components",
"description": "SUMARiS Angular components",
"version": "0.11.9",
"version": "0.11.10",
"author": "contact@e-is.pro",
"license": "AGPL-3.0",
"readmeFilename": "README.md",
......
......@@ -746,7 +746,7 @@ export abstract class AppTable<
return false;
}
cancelOrDelete(event: Event, row: TableElement<T>, opts?: { interactive?: boolean; }) {
cancelOrDelete(event: Event, row: TableElement<T>, opts?: { interactive?: boolean; keepEditing?: boolean; }) {
if (row.id === -1) {
this.deleteNewRow(event, row);
} else {
......@@ -814,7 +814,7 @@ export abstract class AppTable<
this.dataSource.waitIdle()
.then(() => this.dataSource.getRow(editedRowId))
// Select by row id
.then(row => row && this.clickRow(null, row))
.then(row => row && this.clickRow(null, row));
} else {
// TODO: find a way to restore the row (find it by data ?)
}
......@@ -1105,7 +1105,7 @@ export abstract class AppTable<
else {
// cancel (if confirmation)
if (this.confirmBeforeCancel) {
this.cancelExistingRow(event, row);
this.cancelExistingRow(event, row, {keepEditing: false});
}
// Or validate, if no confirmation
else {
......@@ -1517,7 +1517,7 @@ export abstract class AppTable<
this.visibleRowCount--;
}
private cancelExistingRow(event: Event|undefined, row: TableElement<T>, opts?: { interactive?: boolean; }) {
private cancelExistingRow(event: Event|undefined, row: TableElement<T>, opts?: { interactive?: boolean; keepEditing?: boolean; }) {
const confirmed = (!opts || opts.interactive !== false);
......@@ -1532,7 +1532,7 @@ export abstract class AppTable<
return;
}
const keepEditing = row.editing;
const keepEditing = row.editing && (!opts || opts.keepEditing !== false);
this.editedRow = undefined; // unselect row
this._dataSource.cancelOrDelete(row);
this.onCancelOrDeleteRow.next(row);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment