feat(table): integrate footer buttons into collection properties

This commit is contained in:
Elian Doran 2026-01-31 12:41:24 +02:00
parent 1822970e23
commit 0c4de9a5e0
No known key found for this signature in database
2 changed files with 10 additions and 16 deletions

View File

@ -49,7 +49,15 @@ export default function TableView({ note, noteIds, notePath, viewConfig, saveCon
return (
<div className="table-view">
<CollectionProperties note={note} />
<CollectionProperties
note={note}
rightChildren={note.type !== "search" &&
<>
<Button triggerCommand="addNewRow" icon="bx bx-plus" text={t("table_view.new-row")} />
<Button triggerCommand="addNewTableColumn" icon="bx bx-carousel" text={t("table_view.new-column")} />
</>
}
/>
{rowData !== undefined && persistenceProps && (
<>
@ -59,7 +67,6 @@ export default function TableView({ note, noteIds, notePath, viewConfig, saveCon
columns={columnDefs ?? []}
data={rowData}
modules={[ SortModule, FormatModule, InteractionModule, EditModule, ResizeColumnsModule, FrozenColumnsModule, PersistenceModule, MoveColumnsModule, MoveRowsModule, DataTreeModule ]}
footerElement={<TableFooter note={note} />}
events={{
...contextMenuEvents,
...rowEditingEvents
@ -72,7 +79,6 @@ export default function TableView({ note, noteIds, notePath, viewConfig, saveCon
rowFormatter={rowFormatter}
{...dataTreeProps}
/>
<TableFooter note={note} />
</>
)}
{attributeDetailWidgetEl}
@ -80,18 +86,6 @@ export default function TableView({ note, noteIds, notePath, viewConfig, saveCon
);
}
function TableFooter({ note }: { note: FNote }) {
return (note.type !== "search" &&
<div className="tabulator-footer">
<div className="tabulator-footer-contents">
<Button triggerCommand="addNewRow" icon="bx bx-plus" text={t("table_view.new-row")} />
{" "}
<Button triggerCommand="addNewTableColumn" icon="bx bx-carousel" text={t("table_view.new-column")} />
</div>
</div>
);
}
function usePersistence(viewConfig: TableConfig | null | undefined, saveConfig: (newConfig: TableConfig) => void) {
const [ persistenceProps, setPersistenceProps ] = useState<Pick<Options, "persistenceReaderFunc" | "persistenceWriterFunc">>();

View File

@ -17,12 +17,12 @@
>div {
display: inline-flex;
align-items: center;
gap: 0.5em;
}
.center-container {
flex-grow: 1;
justify-content: center;
gap: 0.5em;
}
button.btn {