Fixes to JsonForm and json

* Update model when JsonForm.editable set false
* Bugfixes in jsonPatch
This commit is contained in:
2025-09-21 00:00:50 +02:00
parent 123231833d
commit 6e1351d9ab
5 changed files with 65 additions and 6 deletions

View File

@@ -10,7 +10,7 @@
<script type="module">
import { el } from './dom.js';
import { dialog } from './dialog.js';
import { JsonForm, TextField, SelectField } from './jsonform.js';
import { JsonForm, TextField, NumericField } from './jsonform.js';
import { jsonQuery, jsonPatch, tokenizePath } from './json.js';
import { date } from './date.js';
@@ -45,7 +45,7 @@ document.body.appendChild(root);
const userForm = new JsonForm();
userForm.layout.addRow()
.append(new TextField({ label:"Username", width:70, path:".username" }))
.append(new TextField({ label:"ID", path:".id", locked:true }));
.append(new NumericField({ label:"ID", path:".id", locked:true }));
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 }));
@@ -62,6 +62,9 @@ userForm.model = {
btn3.addEventListener('click', () => {
userForm.editable = !userForm.editable;
if (!userForm.editable) {
console.log(userForm.model);
}
});
// console.log(tokenizePath(".foo.bar[1].title"));