Bugfixes, dialog improvements
* It is now possible to pass an element as the dialog message to have it inserted as the body.
This commit is contained in:
14
jsonform.js
14
jsonform.js
@@ -119,6 +119,7 @@ class FormRow {
|
||||
updateModel(model) {
|
||||
this.#fields.forEach(field => {
|
||||
if (!field.options.path) return;
|
||||
field.value = field.getValue();
|
||||
model = jsonPatch(model, field.options.path, field.value);
|
||||
});
|
||||
return model;
|
||||
@@ -206,9 +207,14 @@ class TextField extends FormField {
|
||||
this.#input.innerText = this.value;
|
||||
}
|
||||
valueUpdated() {
|
||||
if (!this.#input) return;
|
||||
this.#input.innerText = this.value;
|
||||
}
|
||||
getValue() {
|
||||
if (this.#input.innerText === '') {
|
||||
if (this.options.nullable !== false)
|
||||
return null;
|
||||
}
|
||||
return this.#input.innerText;
|
||||
}
|
||||
setEditable(state) {
|
||||
@@ -231,9 +237,17 @@ class NumericField extends FormField {
|
||||
this.#input.innerText = this.value;
|
||||
}
|
||||
valueUpdated() {
|
||||
if (!this.#input) return;
|
||||
this.#input.innerText = this.value;
|
||||
}
|
||||
getValue() {
|
||||
if (this.#input.innerText === '') {
|
||||
if (this.options.nullable !== false)
|
||||
return null;
|
||||
}
|
||||
if (this.options.fixed && typeof this.options.fixed == 'number') {
|
||||
return parseFloat(this.#input.innerText).toFixed(this.options.fixed);
|
||||
}
|
||||
if (this.options.float) {
|
||||
return parseFloat(this.#input.innerText);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user