Refactoring, styles, example

This commit is contained in:
2025-09-21 01:26:06 +02:00
parent bd7b7ac498
commit a941935336
3 changed files with 24 additions and 6 deletions

View File

@@ -8,6 +8,17 @@
inherits: true; inherits: true;
initial-value: #444; initial-value: #444;
} }
@property --jsl-dialog-button-normal {
syntax: "<color>";
inherits: true;
initial-value: #e0e0e0;
}
@property --jsl-dialog-button-hover {
syntax: "<color>";
inherits: true;
initial-value: #f0f0f0;
}
.jsl-dialog { .jsl-dialog {
@@ -65,6 +76,7 @@
border: 0px; border: 0px;
background: transparent; background: transparent;
color: red; color: red;
cursor: pointer;
} }
.-content { .-content {
@@ -76,17 +88,20 @@
text-align: right; text-align: right;
.action { .action {
font-size: 105%; font-size: 102%;
border: solid 1px #666; border: solid 1px #666;
border-radius: 0.25rem; border-radius: 0.25rem;
padding: 0.45rem 0.8rem; padding: 0.45rem 0.8rem;
margin: 0px 0.25rem; margin: 0px 0.25rem;
background: #eee; background: var(--jsl-dialog-button-normal);
box-shadow: inset -1px -1px 1px 0px #bbb, inset 1px 1px 1px 0px #fff;
&.default-action { &.default-action {
outline: solid 1px #666; outline: solid 1px #666;
} }
&:hover {
background: var(--jsl-dialog-button-hover);
text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}
&:active { &:active {
outline: solid 1px #444; outline: solid 1px #444;
} }

4
dom.js
View File

@@ -19,7 +19,7 @@ class DomHelper {
* @param {array|Element|string} children Children or single child/text to apply * @param {array|Element|string} children Children or single child/text to apply
* @returns Element * @returns Element
*/ */
createEl(tag, attr = {}, children = []) { create(tag, attr = {}, children = []) {
//console.debug(`create: ${tag}`, attr, children); //console.debug(`create: ${tag}`, attr, children);
let el = document.createElement(tag); let el = document.createElement(tag);
this.apply(el, attr); this.apply(el, attr);
@@ -101,7 +101,7 @@ const el = new Proxy(dom, {
get(target,name) { get(target,name) {
return name in target return name in target
? target[name] ? target[name]
: (attr = {}, children = []) => target.createEl(name, attr, children); : (attr = {}, children = []) => target.create(name, attr, children);
} }
}); });

View File

@@ -74,6 +74,9 @@ const productForm = new JsonForm();
productForm.layout.addRow() productForm.layout.addRow()
.append(new TextField({ label:"Product", width:60, path:".product.name" })) .append(new TextField({ label:"Product", width:60, path:".product.name" }))
.append(new NumericField({ label:"Price", path:".product.price", fixed:2 })); .append(new NumericField({ label:"Price", path:".product.price", fixed:2 }));
productForm.layout.addRow()
.append(new NumericField({ label:"Inventory", width:30, path:".inventory.count" }))
.append(new NumericField({ label:"Limit", width:30, path:".inventory.limit" }));
productForm.model = {}; productForm.model = {};