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
feat(book/table): hide promoted attributes
Elian Doran4a22e3d2d4dc
diff --git a/apps/client/src/widgets/ribbon_widgets/promoted_attributes.ts b/apps/client/src/widgets/ribbon_widgets/promoted_attributes.tsindex d94cfdbd12..33341dd3fa 100644--- a/apps/client/src/widgets/ribbon_widgets/promoted_attributes.ts+++ b/apps/client/src/widgets/ribbon_widgets/promoted_attributes.ts@@ -117,7 +117,7 @@ export default class PromotedAttributesWidget extends NoteContextAwareWidget {// the order of attributes is important as wellownedAttributes.sort((a, b) => a.position - b.position);- if (promotedDefAttrs.length === 0) {+ if (promotedDefAttrs.length === 0 || note.getLabelValue("viewType") === "table") {this.toggleInt(false);return;}diff --git a/apps/client/src/widgets/view_widgets/table_view/header-add-column-button.ts b/apps/client/src/widgets/view_widgets/table_view/header-add-column-button.tsnew file mode 100644index 0000000000..cf02950c3c--- /dev/null+++ b/apps/client/src/widgets/view_widgets/table_view/header-add-column-button.ts@@ -0,0 +1,46 @@+import {+ IHeaderParams,+ IHeaderComp,+} from 'ag-grid-community';++export default class TableAddColumnButton implements IHeaderComp {+ private eGui!: HTMLElement;+ private params!: IHeaderParams;++ public init(params: IHeaderParams): void {+ this.params = params;++ const container = document.createElement('div');+ container.style.display = 'flex';+ container.style.justifyContent = 'space-between';+ container.style.alignItems = 'center';++ const label = document.createElement('span');+ label.innerText = params.displayName;++ const button = document.createElement('button');+ button.textContent = '+';+ button.title = 'Add Row';+ button.onclick = () => {+ alert(`Add row for column: ${params.displayName}`);+ // Optionally trigger insert logic here+ };++ container.appendChild(label);+ container.appendChild(button);++ this.eGui = container;+ }++ public getGui(): HTMLElement {+ return this.eGui;+ }++ refresh(params: IHeaderParams): boolean {+ return false;+ }++ public destroy(): void {+ // Optional: clean up if needed+ }+}