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:
2025-09-21 00:45:34 +02:00
parent 6e1351d9ab
commit bd7b7ac498
7 changed files with 95 additions and 20 deletions

View File

@@ -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);
}