feat(book/table): hide promoted attributes

This commit is contained in:
Elian Doran 2025-06-25 19:25:01 +03:00
parent dcb4ebe5d9
commit 4a22e3d2d4
No known key found for this signature in database
2 changed files with 47 additions and 1 deletions

View File

@ -117,7 +117,7 @@ export default class PromotedAttributesWidget extends NoteContextAwareWidget {
// the order of attributes is important as well
ownedAttributes.sort((a, b) => a.position - b.position);
if (promotedDefAttrs.length === 0) {
if (promotedDefAttrs.length === 0 || note.getLabelValue("viewType") === "table") {
this.toggleInt(false);
return;
}

View File

@ -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
}
}