chore(react/collections/table): reintroduce column context menu

This commit is contained in:
Elian Doran
2025-09-11 19:25:17 +03:00
parent 2b452a18df
commit 803164791f
5 changed files with 58 additions and 39 deletions

View File

@@ -1,12 +1,18 @@
import { BoardViewData } from ".";
import FNote from "../../../entities/fnote";
import attributes from "../../../services/attributes";
import { executeBulkActions } from "../../../services/bulk_action";
import note_create from "../../../services/note_create";
import { ColumnMap } from "./data";
export default class BoardApi {
constructor(
private byColumn: ColumnMap | undefined,
private parentNote: FNote,
private statusAttribute: string
private statusAttribute: string,
private viewConfig: BoardViewData,
private saveConfig: (newConfig: BoardViewData) => void
) {};
async createNewItem(column: string) {
@@ -36,5 +42,19 @@ export default class BoardApi {
await attributes.setLabel(noteId, this.statusAttribute, newColumn);
}
async removeColumn(column: string) {
// Remove the value from the notes.
const noteIds = this.byColumn?.get(column)?.map(item => item.note.noteId) || [];
await executeBulkActions(noteIds, [
{
name: "deleteLabel",
labelName: this.statusAttribute
}
]);
this.viewConfig.columns = (this.viewConfig.columns ?? []).filter(col => col.value !== column);
this.saveConfig(this.viewConfig);
}
}