mirror of
https://github.com/zadam/trilium.git
synced 2026-02-11 00:04:27 +01:00
feat(table): integrate footer buttons into collection properties
This commit is contained in:
parent
1822970e23
commit
0c4de9a5e0
@ -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">>();
|
||||
|
||||
|
||||
@ -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 {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user