| 
									
										
										
										
											2023-03-29 17:21:20 +02:00
										 |  |  | <script lang="ts"> | 
					
						
							| 
									
										
										
										
											2023-06-14 20:39:36 +02:00
										 |  |  |   /** | 
					
						
							|  |  |  |    * Constructs an input helper element for the given type. | 
					
						
							|  |  |  |    * Note that all values are stringified | 
					
						
							|  |  |  |    */ | 
					
						
							| 
									
										
										
										
											2023-04-16 03:42:26 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-09 16:30:26 +01:00
										 |  |  |   import { UIEventSource } from "../../Logic/UIEventSource" | 
					
						
							|  |  |  |   import type { ValidatorType } from "./Validators" | 
					
						
							|  |  |  |   import InputHelpers from "./InputHelpers" | 
					
						
							|  |  |  |   import ToSvelte from "../Base/ToSvelte.svelte" | 
					
						
							|  |  |  |   import type { Feature } from "geojson" | 
					
						
							|  |  |  |   import { createEventDispatcher } from "svelte" | 
					
						
							|  |  |  |   import ImageHelper from "./Helpers/ImageHelper.svelte" | 
					
						
							|  |  |  |   import TranslationInput from "./Helpers/TranslationInput.svelte" | 
					
						
							|  |  |  |   import TagInput from "./Helpers/TagInput.svelte" | 
					
						
							|  |  |  |   import SimpleTagInput from "./Helpers/SimpleTagInput.svelte" | 
					
						
							|  |  |  |   import DirectionInput from "./Helpers/DirectionInput.svelte" | 
					
						
							|  |  |  |   import DateInput from "./Helpers/DateInput.svelte" | 
					
						
							|  |  |  |   import ColorInput from "./Helpers/ColorInput.svelte" | 
					
						
							|  |  |  |   import OpeningHoursInput from "./Helpers/OpeningHoursInput.svelte" | 
					
						
							| 
									
										
										
										
											2023-09-15 01:16:33 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-09 16:30:26 +01:00
										 |  |  |   export let type: ValidatorType | 
					
						
							|  |  |  |   export let value: UIEventSource<string | object> | 
					
						
							| 
									
										
										
										
											2023-09-15 01:16:33 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-09 16:30:26 +01:00
										 |  |  |   export let feature: Feature | 
					
						
							|  |  |  |   export let args: (string | number | boolean)[] = undefined | 
					
						
							| 
									
										
										
										
											2023-09-15 01:16:33 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-09 16:30:26 +01:00
										 |  |  |   let properties = { feature, args: args ?? [] } | 
					
						
							| 
									
										
										
										
											2023-10-20 19:04:55 +02:00
										 |  |  |   let dispatch = createEventDispatcher<{ | 
					
						
							| 
									
										
										
										
											2023-10-24 22:01:10 +02:00
										 |  |  |     selected | 
					
						
							| 
									
										
										
										
											2023-11-09 16:30:26 +01:00
										 |  |  |   }>() | 
					
						
							| 
									
										
										
										
											2023-03-29 17:21:20 +02:00
										 |  |  | </script> | 
					
						
							| 
									
										
										
										
											2023-04-16 03:42:26 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-09 16:30:26 +01:00
										 |  |  | {#if type === "translation"} | 
					
						
							| 
									
										
										
										
											2023-10-24 22:01:10 +02:00
										 |  |  |   <TranslationInput {value} on:submit {args} /> | 
					
						
							| 
									
										
										
										
											2023-09-15 01:16:33 +02:00
										 |  |  | {:else if type === "direction"} | 
					
						
							|  |  |  |   <DirectionInput {value} mapProperties={InputHelpers.constructMapProperties(properties)} /> | 
					
						
							|  |  |  | {:else if type === "date"} | 
					
						
							| 
									
										
										
										
											2023-11-09 16:30:26 +01:00
										 |  |  |   <DateInput {value} /> | 
					
						
							| 
									
										
										
										
											2023-09-15 01:16:33 +02:00
										 |  |  | {:else if type === "color"} | 
					
						
							| 
									
										
										
										
											2023-11-09 16:30:26 +01:00
										 |  |  |   <ColorInput {value} /> | 
					
						
							| 
									
										
										
										
											2023-09-15 01:16:33 +02:00
										 |  |  | {:else if type === "image"} | 
					
						
							| 
									
										
										
										
											2023-11-09 16:30:26 +01:00
										 |  |  |   <ImageHelper {value} /> | 
					
						
							| 
									
										
										
										
											2023-09-15 01:16:33 +02:00
										 |  |  | {:else if type === "tag"} | 
					
						
							| 
									
										
										
										
											2023-11-09 16:30:26 +01:00
										 |  |  |   <TagInput {value} on:submit /> | 
					
						
							| 
									
										
										
										
											2023-09-15 01:16:33 +02:00
										 |  |  | {:else if type === "simple_tag"} | 
					
						
							| 
									
										
										
										
											2023-11-09 16:30:26 +01:00
										 |  |  |   <SimpleTagInput {value} {args} on:submit /> | 
					
						
							| 
									
										
										
										
											2023-10-20 19:04:55 +02:00
										 |  |  | {:else if type === "opening_hours"} | 
					
						
							| 
									
										
										
										
											2023-11-09 16:30:26 +01:00
										 |  |  |   <OpeningHoursInput {value} /> | 
					
						
							| 
									
										
										
										
											2023-10-20 19:04:55 +02:00
										 |  |  | {:else if type === "wikidata"} | 
					
						
							|  |  |  |   <ToSvelte construct={() => InputHelpers.constructWikidataHelper(value, properties)} /> | 
					
						
							| 
									
										
										
										
											2023-04-16 03:42:26 +02:00
										 |  |  | {/if} |