mirror of
https://github.com/zadam/trilium.git
synced 2025-11-02 12:39:04 +01:00
chore(react/collections/table): react to nesting depth change
This commit is contained in:
parent
ab6fc9303b
commit
0c7f926421
@ -134,7 +134,7 @@ function useData(note: FNote, noteIds: string[], viewConfig: TableConfig | undef
|
||||
});
|
||||
}
|
||||
|
||||
useEffect(refresh, [ note, noteIds ]);
|
||||
useEffect(refresh, [ note, noteIds, maxDepth ]);
|
||||
|
||||
// React to column changes.
|
||||
useTriliumEvent("entitiesReloaded", ({ loadResults}) => {
|
||||
|
||||
@ -3,7 +3,6 @@ import attributes from "../../../services/attributes.js";
|
||||
import SpacedUpdate from "../../../services/spaced_update.js";
|
||||
import type { EventData } from "../../../components/app_context.js";
|
||||
|
||||
import { canReorderRows, configureReorderingRows } from "./dragging.js";
|
||||
import buildFooter from "./footer.js";
|
||||
import getAttributeDefinitionInformation, { buildRowDefinitions } from "./rows.js";
|
||||
import { AttributeDefinitionInformation, buildColumnDefinitions } from "./columns.js";
|
||||
@ -49,14 +48,6 @@ export default class TableView extends ViewMode<StateInfo> {
|
||||
return this.$root;
|
||||
}
|
||||
|
||||
private async renderTable(el: HTMLElement) {
|
||||
for (const module of modules) {
|
||||
Tabulator.registerModule(module);
|
||||
}
|
||||
|
||||
this.initialize(el, info);
|
||||
}
|
||||
|
||||
private async initialize(el: HTMLElement, info: AttributeDefinitionInformation[]) {
|
||||
const viewStorage = await this.viewStorage.restore();
|
||||
this.persistentData = viewStorage?.tableData || {};
|
||||
@ -66,9 +57,6 @@ export default class TableView extends ViewMode<StateInfo> {
|
||||
this.colEditing = new TableColumnEditing(this.args.$parent, this.args.parentNote, this.api);
|
||||
this.rowEditing = new TableRowEditing(this.api, this.args.parentNotePath!);
|
||||
|
||||
if (movableRows) {
|
||||
configureReorderingRows(this.api);
|
||||
}
|
||||
setupContextMenu(this.api, this.parentNote);
|
||||
}
|
||||
|
||||
@ -82,21 +70,6 @@ export default class TableView extends ViewMode<StateInfo> {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Refresh if promoted attributes get changed.
|
||||
if (loadResults.getAttributeRows().find(attr =>
|
||||
attr.type === "label" &&
|
||||
(attr.name?.startsWith("label:") || attr.name?.startsWith("relation:")) &&
|
||||
attributes.isAffecting(attr, this.parentNote))) {
|
||||
this.#manageColumnUpdate();
|
||||
//return await this.#manageRowsUpdate();
|
||||
}
|
||||
|
||||
// Refresh max depth
|
||||
if (loadResults.getAttributeRows().find(attr => attr.type === "label" && attr.name === "maxNestingDepth" && attributes.isAffecting(attr, this.parentNote))) {
|
||||
this.maxDepth = parseInt(this.parentNote.getLabelValue("maxNestingDepth") ?? "-1", 10);
|
||||
return await this.#manageRowsUpdate();
|
||||
}
|
||||
|
||||
if (loadResults.getBranchRows().some(branch => branch.parentNoteId === this.parentNote.noteId || this.noteIds.includes(branch.parentNoteId ?? ""))
|
||||
|| loadResults.getNoteIds().some(noteId => this.noteIds.includes(noteId))
|
||||
|| loadResults.getAttributeRows().some(attr => this.noteIds.includes(attr.noteId!))) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user