mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 23:29:02 +02:00
feat(book/table): hide promoted attributes
This commit is contained in:
parent
dcb4ebe5d9
commit
4a22e3d2d4
@ -117,7 +117,7 @@ export default class PromotedAttributesWidget extends NoteContextAwareWidget {
|
|||||||
// the order of attributes is important as well
|
// the order of attributes is important as well
|
||||||
ownedAttributes.sort((a, b) => a.position - b.position);
|
ownedAttributes.sort((a, b) => a.position - b.position);
|
||||||
|
|
||||||
if (promotedDefAttrs.length === 0) {
|
if (promotedDefAttrs.length === 0 || note.getLabelValue("viewType") === "table") {
|
||||||
this.toggleInt(false);
|
this.toggleInt(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user