feat(views): improve style in collections properties

This commit is contained in:
Elian Doran 2025-07-17 19:54:30 +03:00
parent a5db5298a0
commit 4f0c8b081c
No known key found for this signature in database
2 changed files with 18 additions and 4 deletions

View file

@ -23,10 +23,15 @@ const TPL = /*html*/`
align-items: center; align-items: center;
} }
.book-properties-container > * { .book-properties-container > div {
margin-right: 15px; margin-right: 15px;
} }
.book-properties-container > .type-number > label {
display: flex;
align-items: baseline;
}
.book-properties-container input[type="checkbox"] { .book-properties-container input[type="checkbox"] {
margin-right: 5px; margin-right: 5px;
} }
@ -127,6 +132,7 @@ export default class BookPropertiesWidget extends NoteContextAwareWidget {
renderBookProperty(property: BookProperty) { renderBookProperty(property: BookProperty) {
const $container = $("<div>"); const $container = $("<div>");
$container.addClass(`type-${property.type}`);
const note = this.note; const note = this.note;
if (!note) { if (!note) {
return $container; return $container;
@ -173,6 +179,8 @@ export default class BookPropertiesWidget extends NoteContextAwareWidget {
type: "number", type: "number",
class: "form-control form-control-sm", class: "form-control form-control-sm",
value: note.getLabelValue(property.bindToLabel) || "", value: note.getLabelValue(property.bindToLabel) || "",
width: property.width ?? 100,
min: property.min ?? 0
}); });
$numberInput.on("change", () => { $numberInput.on("change", () => {
const value = $numberInput.val(); const value = $numberInput.val();
@ -182,7 +190,10 @@ export default class BookPropertiesWidget extends NoteContextAwareWidget {
attributes.setLabel(note.noteId, property.bindToLabel, String(value)); 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; break;
} }

View file

@ -26,6 +26,8 @@ interface NumberProperty {
type: "number", type: "number",
label: string; label: string;
bindToLabel: string; bindToLabel: string;
width?: number;
min?: number;
} }
export type BookProperty = CheckBoxProperty | ButtonProperty | NumberProperty; export type BookProperty = CheckBoxProperty | ButtonProperty | NumberProperty;
@ -93,9 +95,10 @@ export const bookPropertiesConfig: Record<ViewTypeOptions, BookConfig> = {
table: { table: {
properties: [ properties: [
{ {
label: "Max nesting depth", label: "Max nesting depth:",
type: "number", type: "number",
bindToLabel: "maxNestingDepth" bindToLabel: "maxNestingDepth",
width: 65
} }
] ]
} }