mirror of
https://github.com/umap-project/umap.git
synced 2025-05-01 04:22:24 +02:00
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:
commit
7c986e5aea
1 changed files with 15 additions and 0 deletions
|
@ -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()
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue