Implement CheckField visuals

This commit is contained in:
2025-09-21 02:21:45 +02:00
parent a941935336
commit 76f8fc1c65
3 changed files with 81 additions and 4 deletions

View File

@@ -10,7 +10,7 @@
<script type="module">
import { el } from './dom.js';
import { dialog } from './dialog.js';
import { JsonForm, TextField, NumericField } from './jsonform.js';
import { JsonForm, TextField, NumericField, CheckField } from './jsonform.js';
import { jsonQuery, jsonPatch, tokenizePath } from './json.js';
import { date } from './date.js';
@@ -51,7 +51,8 @@ userForm.layout.addRow()
.append(new TextField({ label:"Created", width:50, path:".meta.created", locked:true }))
.append(new TextField({ label:"Updated", width:50, path:".meta.updated", locked:true }));
userForm.layout.addRow()
.append(new NumericField({ label:"Salary", width:30, path:".meta.salary", fixed:2 }));
.append(new NumericField({ label:"Salary", width:30, path:".meta.salary", fixed:2 }))
.append(new CheckField({ label:"Admin", path:".admin" }));
document.body.appendChild(userForm.dom());
// Set the model
@@ -76,7 +77,8 @@ productForm.layout.addRow()
.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" }));
.append(new NumericField({ label:"Limit", width:30, path:".inventory.limit" }))
.append(new CheckField({ label:"Virtual", path:".virtual" }));
productForm.model = {};