Skip to content

Build your personal knowledge base with Trilium Notes

feat(views): improve style in collections properties

Elian Doran4f0c8b081c8f
diff --git a/apps/client/src/widgets/ribbon_widgets/book_properties.ts b/apps/client/src/widgets/ribbon_widgets/book_properties.ts
index 13df6ce47c..1444914423 100644
--- a/apps/client/src/widgets/ribbon_widgets/book_properties.ts
+++ b/apps/client/src/widgets/ribbon_widgets/book_properties.ts
@@ -23,10 +23,15 @@ const TPL = /*html*/`
align-items: center;
}
- .book-properties-container > * {
+ .book-properties-container > div {
margin-right: 15px;
}
+ .book-properties-container > .type-number > label {
+ display: flex;
+ align-items: baseline;
+ }
+
.book-properties-container input[type="checkbox"] {
margin-right: 5px;
}
@@ -127,6 +132,7 @@ export default class BookPropertiesWidget extends NoteContextAwareWidget {
renderBookProperty(property: BookProperty) {
const $container = $("<div>");
+ $container.addClass(`type-${property.type}`);
const note = this.note;
if (!note) {
return $container;
@@ -173,6 +179,8 @@ export default class BookPropertiesWidget extends NoteContextAwareWidget {
type: "number",
class: "form-control form-control-sm",
value: note.getLabelValue(property.bindToLabel) || "",
+ width: property.width ?? 100,
+ min: property.min ?? 0
});
$numberInput.on("change", () => {
const value = $numberInput.val();
@@ -182,7 +190,10 @@ export default class BookPropertiesWidget extends NoteContextAwareWidget {
attributes.setLabel(note.noteId, property.bindToLabel, String(value));
}
});
- $container.append($("<label>").text(property.label).append($numberInput));
+ $container.append($("<label>")
+ .text(property.label)
+ .append("&nbsp;".repeat(2))
+ .append($numberInput));
break;
}
diff --git a/apps/client/src/widgets/ribbon_widgets/book_properties_config.ts b/apps/client/src/widgets/ribbon_widgets/book_properties_config.ts
index ffa4303d8c..6b8beece97 100644
--- a/apps/client/src/widgets/ribbon_widgets/book_properties_config.ts
+++ b/apps/client/src/widgets/ribbon_widgets/book_properties_config.ts
@@ -26,6 +26,8 @@ interface NumberProperty {
type: "number",
label: string;
bindToLabel: string;
+ width?: number;
+ min?: number;
}
export type BookProperty = CheckBoxProperty | ButtonProperty | NumberProperty;
@@ -93,9 +95,10 @@ export const bookPropertiesConfig: Record<ViewTypeOptions, BookConfig> = {
table: {
properties: [
{
- label: "Max nesting depth",
+ label: "Max nesting depth:",
type: "number",
- bindToLabel: "maxNestingDepth"
+ bindToLabel: "maxNestingDepth",
+ width: 65
}
]
}