forked from MapComplete/MapComplete
		
	Refactoring: moved pointRenderingConfig into seperate part of the configuration, removed roaming rendering capabilities
This commit is contained in:
		
							parent
							
								
									584ade8e61
								
							
						
					
					
						commit
						1852eb8e52
					
				
					 74 changed files with 1868 additions and 193 deletions
				
			
		|  | @ -27,7 +27,6 @@ export default class PointRenderingConfig extends WithContextLoader { | |||
|         this.iconOverlays = (json.iconOverlays ?? []).map((overlay, i) => { | ||||
|             let tr = new TagRenderingConfig( | ||||
|                 overlay.then, | ||||
|                 undefined, | ||||
|                 `iconoverlays.${i}` | ||||
|             ); | ||||
|             if ( | ||||
|  | @ -93,15 +92,6 @@ export default class PointRenderingConfig extends WithContextLoader { | |||
|             return n; | ||||
|         } | ||||
| 
 | ||||
|         function rendernum(tr: TagRenderingConfig, deflt: number) { | ||||
|             const str = Number(render(tr, "" + deflt)); | ||||
|             const n = Number(str); | ||||
|             if (isNaN(n)) { | ||||
|                 return deflt; | ||||
|             } | ||||
|             return n; | ||||
|         } | ||||
| 
 | ||||
|         function render(tr: TagRenderingConfig, deflt?: string) { | ||||
|             if (tags === undefined) { | ||||
|                 return deflt | ||||
|  |  | |||
|  | @ -37,9 +37,8 @@ export default class TagRenderingConfig { | |||
|         readonly then: Translation | ||||
|         readonly hideInAnswer: boolean | TagsFilter | ||||
|     }[] | ||||
|     readonly roaming: boolean; | ||||
| 
 | ||||
|     constructor(json: string | TagRenderingConfigJson, conditionIfRoaming: TagsFilter, context?: string) { | ||||
|     constructor(json: string | TagRenderingConfigJson, context?: string) { | ||||
| 
 | ||||
|         if (json === "questions") { | ||||
|             // Very special value
 | ||||
|  | @ -61,13 +60,7 @@ export default class TagRenderingConfig { | |||
|         this.id = json.id ?? ""; | ||||
|         this.render = Translations.T(json.render, context + ".render"); | ||||
|         this.question = Translations.T(json.question, context + ".question"); | ||||
|         this.roaming = json.roaming ?? false; | ||||
|         const condition = TagUtils.Tag(json.condition ?? {"and": []}, `${context}.condition`); | ||||
|         if (this.roaming && conditionIfRoaming !== undefined) { | ||||
|             this.condition = new And([condition, conditionIfRoaming]); | ||||
|         } else { | ||||
|             this.condition = condition; | ||||
|         } | ||||
|         this.condition = TagUtils.Tag(json.condition ?? {"and": []}, `${context}.condition`); | ||||
|         if (json.freeform) { | ||||
| 
 | ||||
|             if(json.freeform.addExtraTags !== undefined && json.freeform.addExtraTags.map === undefined){ | ||||
|  |  | |||
|  | @ -24,7 +24,6 @@ export default class WithContextLoader { | |||
|             } | ||||
|             return new TagRenderingConfig( | ||||
|                 deflt, | ||||
|                 undefined, | ||||
|                 `${this._context}.${key}.default value` | ||||
|             ); | ||||
|         } | ||||
|  | @ -36,7 +35,6 @@ export default class WithContextLoader { | |||
|         } | ||||
|         return new TagRenderingConfig( | ||||
|             v, | ||||
|             undefined, | ||||
|             `${this._context}.${key}` | ||||
|         ); | ||||
|     } | ||||
|  | @ -72,7 +70,7 @@ export default class WithContextLoader { | |||
|                         )}`;
 | ||||
|                     } | ||||
| 
 | ||||
|                     const tr = new TagRenderingConfig("questions", undefined, context); | ||||
|                     const tr = new TagRenderingConfig("questions",  context); | ||||
|                 renderings.push(tr) | ||||
|                     continue; | ||||
|                 } | ||||
|  | @ -81,7 +79,6 @@ export default class WithContextLoader { | |||
|                     const sharedJson = SharedTagRenderings.SharedTagRenderingJson.get(renderingId) | ||||
|                     const tr = new TagRenderingConfig( | ||||
|                         Utils.Merge(renderingJson["override"], sharedJson), | ||||
|                         undefined, | ||||
|                         `${context}.tagrendering[${i}]+override` | ||||
|                     ); | ||||
|                     renderings.push(tr) | ||||
|  | @ -106,7 +103,6 @@ export default class WithContextLoader { | |||
| 
 | ||||
|             const tr = new TagRenderingConfig( | ||||
|                 <TagRenderingConfigJson>renderingJson, | ||||
|                 undefined, | ||||
|                 `${context}.tagrendering[${i}]` | ||||
|             ); | ||||
|             renderings.push(tr) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue