forked from MapComplete/MapComplete
		
	Fix: make sure that a 'hidden' tagRendering cannot be accidentally selected
This commit is contained in:
		
							parent
							
								
									d9b084f7d9
								
							
						
					
					
						commit
						5585f02cad
					
				
					 1 changed files with 8 additions and 2 deletions
				
			
		| 
						 | 
					@ -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;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue