From 9c326d09e173e77f7afcbf4de2d87080dc1aeed0 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Fri, 19 Apr 2024 12:55:35 +0200 Subject: [PATCH] chore: remove the need for makeDirty in U.FormBuilder --- umap/static/umap/js/modules/browser.js | 3 +-- umap/static/umap/js/modules/facets.js | 3 +-- umap/static/umap/js/umap.forms.js | 6 ++---- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/umap/static/umap/js/modules/browser.js b/umap/static/umap/js/modules/browser.js index ac0293da..046324bb 100644 --- a/umap/static/umap/js/modules/browser.js +++ b/umap/static/umap/js/modules/browser.js @@ -142,8 +142,7 @@ export default class Browser { ['options.filter', { handler: 'Input', placeholder: translate('Filter') }], ['options.inBbox', { handler: 'Switch', label: translate('Current map view') }], ] - const builder = new U.FormBuilder(this, fields, { - makeDirty: false, + const builder = new L.FormBuilder(this, fields, { callback: () => this.onFormChange(), }) formContainer.appendChild(builder.build()) diff --git a/umap/static/umap/js/modules/facets.js b/umap/static/umap/js/modules/facets.js index d141e1de..f009ff06 100644 --- a/umap/static/umap/js/modules/facets.js +++ b/umap/static/umap/js/modules/facets.js @@ -103,8 +103,7 @@ export default class Facets { ] }) - const builder = new U.FormBuilder(this, fields, { - makeDirty: false, + const builder = new L.FormBuilder(this, fields, { callback: filterFeatures, callbackContext: this, }) diff --git a/umap/static/umap/js/umap.forms.js b/umap/static/umap/js/umap.forms.js index 42ab4c1a..8f9619e2 100644 --- a/umap/static/umap/js/umap.forms.js +++ b/umap/static/umap/js/umap.forms.js @@ -1117,10 +1117,8 @@ U.FormBuilder = L.FormBuilder.extend({ setter: function (field, value) { L.FormBuilder.prototype.setter.call(this, field, value) - if (this.options.makeDirty !== false) { - this.obj.isDirty = true - if ('render' in this.obj) this.obj.render([field], this) - } + this.obj.isDirty = true + if ('render' in this.obj) this.obj.render([field], this) }, finish: function () {