MultiAnswer option with rendering only shows up once
This commit is contained in:
parent
5af94b012c
commit
857e4fe114
1 changed files with 9 additions and 1 deletions
|
@ -44,17 +44,25 @@ export default class TagRenderingAnswer extends UIElement {
|
||||||
|
|
||||||
// The render value doesn't work well with multi-answers (checkboxes), so we have to check for them manually
|
// The render value doesn't work well with multi-answers (checkboxes), so we have to check for them manually
|
||||||
if (this._configuration.multiAnswer) {
|
if (this._configuration.multiAnswer) {
|
||||||
|
|
||||||
|
let freeformKeyUsed = this._configuration.freeform?.key === undefined; // If it is undefined, it is "used" already, or at least we don't have to check for it anymore
|
||||||
const applicableThens: Translation[] = Utils.NoNull(this._configuration.mappings.map(mapping => {
|
const applicableThens: Translation[] = Utils.NoNull(this._configuration.mappings.map(mapping => {
|
||||||
if (mapping.if === undefined) {
|
if (mapping.if === undefined) {
|
||||||
return mapping.then;
|
return mapping.then;
|
||||||
}
|
}
|
||||||
if (TagUtils.MatchesMultiAnswer(mapping.if, tags)) {
|
if (TagUtils.MatchesMultiAnswer(mapping.if, tags)) {
|
||||||
|
if(!freeformKeyUsed){
|
||||||
|
if(mapping.if.usedKeys().indexOf(this._configuration.freeform.key) >= 0){
|
||||||
|
freeformKeyUsed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
return mapping.then;
|
return mapping.then;
|
||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
}))
|
}))
|
||||||
|
|
||||||
if (this._configuration.freeform !== undefined && tags[this._configuration.freeform.key] !== undefined) {
|
if (!freeformKeyUsed
|
||||||
|
&& tags[this._configuration.freeform.key] !== undefined) {
|
||||||
applicableThens.push(this._configuration.render)
|
applicableThens.push(this._configuration.render)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue