mirror of
https://github.com/zadam/trilium.git
synced 2025-09-29 18:15:39 +08:00
feat(views): improve style in collections properties
This commit is contained in:
parent
a5db5298a0
commit
4f0c8b081c
2 changed files with 18 additions and 4 deletions
|
@ -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(" ".repeat(2))
|
||||
.append($numberInput));
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue