| 
									
										
										
										
											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-06-14 20:39:36 +02: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 BaseUIElement from "../BaseUIElement" | 
					
						
							|  |  |  |   import { VariableUiElement } from "../Base/VariableUIElement" | 
					
						
							| 
									
										
										
										
											2023-05-04 23:38:00 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-14 20:39:36 +02:00
										 |  |  |   export let type: ValidatorType | 
					
						
							|  |  |  |   export let value: UIEventSource<string> | 
					
						
							| 
									
										
										
										
											2023-03-29 17:21:20 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-14 20:39:36 +02:00
										 |  |  |   export let feature: Feature | 
					
						
							|  |  |  |   export let args: (string | number | boolean)[] = undefined | 
					
						
							| 
									
										
										
										
											2023-04-16 03:42:26 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-14 20:39:36 +02:00
										 |  |  |   let properties = { feature, args: args ?? [] } | 
					
						
							|  |  |  |   let construct = new UIEventSource<(value, extraProperties) => BaseUIElement>(undefined) | 
					
						
							|  |  |  |   $: { | 
					
						
							|  |  |  |     construct.setData(InputHelpers.AvailableInputHelpers[type]) | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2023-03-29 17:21:20 +02:00
										 |  |  | </script> | 
					
						
							| 
									
										
										
										
											2023-04-16 03:42:26 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | {#if construct !== undefined} | 
					
						
							| 
									
										
										
										
											2023-06-14 20:39:36 +02:00
										 |  |  |   <ToSvelte | 
					
						
							|  |  |  |     construct={() => | 
					
						
							|  |  |  |       new VariableUiElement(construct.mapD((construct) => construct(value, properties)))} | 
					
						
							|  |  |  |   /> | 
					
						
							| 
									
										
										
										
											2023-04-16 03:42:26 +02:00
										 |  |  | {/if} |