fix: teach FormBuilder where to look for default values (#2374)

UMap will look into the schema for default values, but untill now
FormBuilder wasn't.
This fix is not the real fix we want, but let's make this last until
then.
The real fix is to refactor schema and make obj.properties a Proxy
object that will then be consumed by FormBuilder as it is now.
This commit is contained in:
Yohan Boniface 2024-12-17 18:19:07 +01:00 committed by GitHub
commit 7c986e5aea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1192,6 +1192,21 @@ U.FormBuilder = L.FormBuilder.extend({
} }
}, },
getter: function (field) {
const path = field.split('.')
let value = this.obj
let sub
for (sub of path) {
try {
value = value[sub]
} catch {
console.log(field)
}
}
if (value === undefined) values = U.SCHEMA[sub]?.default
return value
},
finish: (event) => { finish: (event) => {
event.helper?.input?.blur() event.helper?.input?.blur()
}, },