forked from MapComplete/MapComplete
		
	Add placeholder options for freeform keys
This commit is contained in:
		
							parent
							
								
									73984ad462
								
							
						
					
					
						commit
						400756cdea
					
				
					 3 changed files with 9 additions and 1 deletions
				
			
		|  | @ -56,6 +56,11 @@ export interface TagRenderingConfigJson { | ||||||
|          * See Docs/SpecialInputElements.md and UI/Input/ValidatedTextField.ts for supported values |          * See Docs/SpecialInputElements.md and UI/Input/ValidatedTextField.ts for supported values | ||||||
|          */ |          */ | ||||||
|         type?: string, |         type?: string, | ||||||
|  |         /** | ||||||
|  |          * A (translated) text that is shown (as gray text) within the textfield | ||||||
|  |          */ | ||||||
|  |         placeholder: string | any | ||||||
|  |          | ||||||
|         /** |         /** | ||||||
|          * Extra parameters to initialize the input helper arguments. |          * Extra parameters to initialize the input helper arguments. | ||||||
|          * For semantics, see the 'SpecialInputElements.md' |          * For semantics, see the 'SpecialInputElements.md' | ||||||
|  |  | ||||||
|  | @ -30,6 +30,7 @@ export default class TagRenderingConfig { | ||||||
|     readonly freeform?: { |     readonly freeform?: { | ||||||
|         readonly key: string, |         readonly key: string, | ||||||
|         readonly type: string, |         readonly type: string, | ||||||
|  |         readonly placeholder: Translation, | ||||||
|         readonly addExtraTags: TagsFilter[]; |         readonly addExtraTags: TagsFilter[]; | ||||||
|         readonly inline: boolean, |         readonly inline: boolean, | ||||||
|         readonly default?: string, |         readonly default?: string, | ||||||
|  | @ -93,6 +94,7 @@ export default class TagRenderingConfig { | ||||||
|             this.freeform = { |             this.freeform = { | ||||||
|                 key: json.freeform.key, |                 key: json.freeform.key, | ||||||
|                 type: json.freeform.type ?? "string", |                 type: json.freeform.type ?? "string", | ||||||
|  |                 placeholder: Translations.T(json.freeform.placeholder ?? (json.freeform.key + "(" + (json.freeform.type ?? "string") + ")")), | ||||||
|                 addExtraTags: json.freeform.addExtraTags?.map((tg, i) => |                 addExtraTags: json.freeform.addExtraTags?.map((tg, i) => | ||||||
|                     TagUtils.Tag(tg, `${context}.extratag[${i}]`)) ?? [], |                     TagUtils.Tag(tg, `${context}.extratag[${i}]`)) ?? [], | ||||||
|                 inline: json.freeform.inline ?? false, |                 inline: json.freeform.inline ?? false, | ||||||
|  |  | ||||||
|  | @ -425,7 +425,8 @@ export default class TagRenderingQuestion extends Combine { | ||||||
|             mapBackgroundLayer: state.backgroundLayer, |             mapBackgroundLayer: state.backgroundLayer, | ||||||
|             unit: applicableUnit, |             unit: applicableUnit, | ||||||
|             args: configuration.freeform.helperArgs, |             args: configuration.freeform.helperArgs, | ||||||
|             feature: feature |             feature: feature, | ||||||
|  |             placeholder: configuration.freeform.placeholder | ||||||
|         }); |         }); | ||||||
| 
 | 
 | ||||||
|         input.GetValue().setData(tagsData[freeform.key] ?? freeform.default); |         input.GetValue().setData(tagsData[freeform.key] ?? freeform.default); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue