fix(plugin-data-viewer): CB-1180 new rows order

This commit is contained in:
Wroud
2021-10-06 12:13:40 +03:00
parent fb1a244190
commit 2eba17cf13
3 changed files with 4 additions and 2 deletions
@@ -54,7 +54,7 @@ export class ResultSetDataAction extends DatabaseDataAction<any, IDatabaseResult
insertRow(row: IResultSetRowKey, value: IResultSetValue[], shift = 0): void {
if (this.result.data?.rows) {
this.result.data.rows.splice(row.index + shift + 1, 0, value);
this.result.data.rows.splice(row.index + shift, 0, value);
}
}
@@ -176,6 +176,8 @@ export class ResultSetEditAction
if (!row) {
row = this.data.getDefaultKey().row;
} else if (!('key' in row)) {
row = { ...row, index: row.index + 1 };
}
if (!column) {
@@ -30,8 +30,8 @@ export class ResultSetViewAction extends DatabaseDataAction<any, IDatabaseResult
get rowKeys(): IResultSetRowKey[] {
return [
...this.data.rows.map((c, index) => ({ index })),
...this.editor.addRows,
...this.data.rows.map((c, index) => ({ index })),
].sort((a, b) => a.index - b.index);
}