Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(views/table): integrate depth limit into collection properties
Elian Dorana5db5298a03a
diff --git a/apps/client/src/widgets/ribbon_widgets/book_properties.ts b/apps/client/src/widgets/ribbon_widgets/book_properties.tsindex 39c4e92b20..13df6ce47c 100644--- a/apps/client/src/widgets/ribbon_widgets/book_properties.ts+++ b/apps/client/src/widgets/ribbon_widgets/book_properties.ts@@ -168,6 +168,22 @@ export default class BookPropertiesWidget extends NoteContextAwareWidget {});$container.append($button);break;+ case "number":+ const $numberInput = $("<input>", {+ type: "number",+ class: "form-control form-control-sm",+ value: note.getLabelValue(property.bindToLabel) || "",+ });+ $numberInput.on("change", () => {+ const value = $numberInput.val();+ if (value === "") {+ attributes.removeOwnedLabelByName(note, property.bindToLabel);+ } else {+ attributes.setLabel(note.noteId, property.bindToLabel, String(value));+ }+ });+ $container.append($("<label>").text(property.label).append($numberInput));+ break;}return $container;diff --git a/apps/client/src/widgets/ribbon_widgets/book_properties_config.ts b/apps/client/src/widgets/ribbon_widgets/book_properties_config.tsindex 6a5ac710ad..ffa4303d8c 100644--- a/apps/client/src/widgets/ribbon_widgets/book_properties_config.ts+++ b/apps/client/src/widgets/ribbon_widgets/book_properties_config.ts@@ -4,8 +4,6 @@ import attributes from "../../services/attributes";import { ViewTypeOptions } from "../../services/note_list_renderer"import NoteContextAwareWidget from "../note_context_aware_widget";-export type BookProperty = CheckBoxProperty | ButtonProperty;-interface BookConfig {properties: BookProperty[];}@@ -24,6 +22,14 @@ interface ButtonProperty {onClick: (context: BookContext) => void;}+interface NumberProperty {+ type: "number",+ label: string;+ bindToLabel: string;+}++export type BookProperty = CheckBoxProperty | ButtonProperty | NumberProperty;+interface BookContext {note: FNote;triggerCommand: NoteContextAwareWidget["triggerCommand"];@@ -85,6 +91,12 @@ export const bookPropertiesConfig: Record<ViewTypeOptions, BookConfig> = {properties: []},table: {- properties: []+ properties: [+ {+ label: "Max nesting depth",+ type: "number",+ bindToLabel: "maxNestingDepth"+ }+ ]}};