Fix: make sure that a 'hidden' tagRendering cannot be accidentally selected

This commit is contained in:
Pieter Vander Vennet 2023-12-12 03:41:23 +01:00
parent d9b084f7d9
commit 5585f02cad

View file

@ -40,6 +40,9 @@
// Will be bound if a freeform is available // Will be bound if a freeform is available
let freeformInput = new UIEventSource<string>(tags?.[config.freeform?.key]); let freeformInput = new UIEventSource<string>(tags?.[config.freeform?.key]);
let selectedMapping: number = undefined; let selectedMapping: number = undefined;
/**
* A list of booleans, used if multiAnswer is set
*/
let checkedMappings: boolean[]; let checkedMappings: boolean[];
let mappings: Mapping[] = config?.mappings; let mappings: Mapping[] = config?.mappings;
@ -72,12 +75,15 @@
checkedMappings?.length < confg.mappings.length + (confg.freeform ? 1 : 0)) checkedMappings?.length < confg.mappings.length + (confg.freeform ? 1 : 0))
) { ) {
const seenFreeforms = []; const seenFreeforms = [];
TagUtils.FlattenMultiAnswer(); // Initial setup of the mappings
checkedMappings = [ checkedMappings = [
...confg.mappings.map((mapping) => { ...confg.mappings.map((mapping) => {
if(mapping.hideInAnswer === true){
return false
}
const matches = TagUtils.MatchesMultiAnswer(mapping.if, tgs); const matches = TagUtils.MatchesMultiAnswer(mapping.if, tgs);
if (matches && confg.freeform) { if (matches && confg.freeform) {
const newProps = TagUtils.changeAsProperties(mapping.if.asChange()); const newProps = TagUtils.changeAsProperties(mapping.if.asChange({}));
seenFreeforms.push(newProps[confg.freeform.key]); seenFreeforms.push(newProps[confg.freeform.key]);
} }
return matches; return matches;