Fix: correctly interpret 'hideInAnswer'-conditions, recalculate them dynamically
This commit is contained in:
parent
1b8970b34a
commit
37dc6a7161
1 changed files with 3 additions and 2 deletions
|
@ -38,11 +38,12 @@
|
||||||
let selectedMapping: number = undefined
|
let selectedMapping: number = undefined
|
||||||
let checkedMappings: boolean[]
|
let checkedMappings: boolean[]
|
||||||
$: {
|
$: {
|
||||||
|
let tgs = $tags
|
||||||
mappings = config.mappings?.filter((m) => {
|
mappings = config.mappings?.filter((m) => {
|
||||||
if (typeof m.hideInAnswer === "boolean") {
|
if (typeof m.hideInAnswer === "boolean") {
|
||||||
return !m.hideInAnswer
|
return !m.hideInAnswer
|
||||||
}
|
}
|
||||||
return m.hideInAnswer.matchesProperties(tags.data)
|
return !m.hideInAnswer.matchesProperties(tgs)
|
||||||
})
|
})
|
||||||
// We received a new config -> reinit
|
// We received a new config -> reinit
|
||||||
unit = layer.units.find((unit) => unit.appliesToKeys.has(config.freeform?.key))
|
unit = layer.units.find((unit) => unit.appliesToKeys.has(config.freeform?.key))
|
||||||
|
@ -59,7 +60,7 @@
|
||||||
if (config.freeform?.key) {
|
if (config.freeform?.key) {
|
||||||
if (!config.multiAnswer) {
|
if (!config.multiAnswer) {
|
||||||
// Somehow, setting multianswer freeform values is broken if this is not set
|
// Somehow, setting multianswer freeform values is broken if this is not set
|
||||||
freeformInput.setData(tags.data[config.freeform.key])
|
freeformInput.setData(tgs[config.freeform.key])
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
freeformInput.setData(undefined)
|
freeformInput.setData(undefined)
|
||||||
|
|
Loading…
Reference in a new issue