feat(views/table): insert column to the right

This commit is contained in:
Elian Doran
2025-07-14 20:42:37 +03:00
parent e3d306cac3
commit cf31367acd
3 changed files with 20 additions and 1 deletions

View File

@@ -87,6 +87,16 @@ function showColumnContextMenu(_e: UIEvent, column: ColumnComponent, tabulator:
});
console.log("Add col");
}
},
{
title: "Add column to the right",
handler: () => {
getParentComponent(e)?.triggerCommand("addNoteListItem", {
referenceColumn: column,
direction: "after"
});
console.log("Add col after");
}
}
],
selectMenuItemHandler() {},

View File

@@ -234,7 +234,7 @@ export default class TableView extends ViewMode<StateInfo> {
console.log("Save attributes", this.newAttribute);
}
addNoteListItemEvent({ referenceColumn }: { referenceColumn?: ColumnComponent }) {
addNoteListItemEvent({ referenceColumn, direction }: EventData<"addNoteListItem">) {
const attr: Attribute = {
type: "label",
name: "label:myLabel",
@@ -243,6 +243,10 @@ export default class TableView extends ViewMode<StateInfo> {
if (referenceColumn && this.api) {
this.newAttributePosition = this.api.getColumns().indexOf(referenceColumn);
if (direction === "after") {
this.newAttributePosition++;
}
} else {
this.newAttributePosition = undefined;
}