Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
refactor(views/table): clean up
Elian Dorancd338085fb50
diff --git a/apps/client/src/widgets/view_widgets/table_view/columns.ts b/apps/client/src/widgets/view_widgets/table_view/columns.tsindex ca0adc2f04..db42425c56 100644--- a/apps/client/src/widgets/view_widgets/table_view/columns.ts+++ b/apps/client/src/widgets/view_widgets/table_view/columns.ts@@ -1,6 +1,5 @@import { RelationEditor } from "./relation_editor.js";import { NoteFormatter, NoteTitleFormatter, RowNumberFormatter } from "./formatters.js";-import { applyHeaderMenu } from "./header-menu.js";import type { ColumnDefinition, Tabulator } from "tabulator-tables";import { LabelType } from "../../../services/promoted_attribute_definition_parser.js";@@ -86,7 +85,6 @@ export function buildColumnDefinitions(info: AttributeDefinitionInformation[], mseenFields.add(field);}- applyHeaderMenu(columnDefs);if (existingColumnData) {restoreExistingData(columnDefs, existingColumnData);}diff --git a/apps/client/src/widgets/view_widgets/table_view/header-menu.ts b/apps/client/src/widgets/view_widgets/table_view/header-menu.tsdeleted file mode 100644index 7f098fa99c..0000000000--- a/apps/client/src/widgets/view_widgets/table_view/header-menu.ts+++ /dev/null@@ -1,53 +0,0 @@-import type { ColumnComponent, ColumnDefinition, MenuObject, Tabulator } from "tabulator-tables";--export function applyHeaderMenu(columns: ColumnDefinition[]) {- for (let column of columns) {- if (column.headerSort !== false) {- column.headerMenu = headerMenu;- }- }-}--function headerMenu(this: Tabulator) {- const menu: MenuObject<ColumnComponent>[] = [];- const columns = this.getColumns();-- for (let column of columns) {- //create checkbox element using font awesome icons- let icon = document.createElement("i");- icon.classList.add("bx");- icon.classList.add(column.isVisible() ? "bx-check" : "bx-empty");-- //build label- let label = document.createElement("span");- let title = document.createElement("span");-- title.textContent = " " + column.getDefinition().title;-- label.appendChild(icon);- label.appendChild(title);-- //create menu item- menu.push({- label: label,- action: function (e) {- //prevent menu closing- e.stopPropagation();-- //toggle current column visibility- column.toggle();-- //change menu item icon- if (column.isVisible()) {- icon.classList.remove("bx-empty");- icon.classList.add("bx-check");- } else {- icon.classList.remove("bx-check");- icon.classList.add("bx-empty");- }- }- });- }-- return menu;-};diff --git a/apps/client/src/widgets/view_widgets/table_view/index.ts b/apps/client/src/widgets/view_widgets/table_view/index.tsindex bcb6744204..4ab8366857 100644--- a/apps/client/src/widgets/view_widgets/table_view/index.ts+++ b/apps/client/src/widgets/view_widgets/table_view/index.ts@@ -106,8 +106,6 @@ export default class TableView extends ViewMode<StateInfo> {private api?: Tabulator;private newAttribute?: Attribute;private persistentData: StateInfo["tableData"];- /** If set to a note ID, whenever the rows will be updated, the title of the note will be automatically focused for editing. */- private branchIdToEdit?: string;constructor(args: ViewModeArgs) {super(args, "table");