2023-06-18 00:44:57 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								<script lang="ts">
							 | 
						
					
						
							
								
									
										
										
										
											2023-11-09 16:30:26 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  import type { ConfigMeta } from "./configMeta"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  import SchemaBasedField from "./SchemaBasedField.svelte"
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-02 19:06:14 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  import { EditJsonState } from "./EditLayerState"
							 | 
						
					
						
							
								
									
										
										
										
											2023-11-09 16:30:26 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  import SchemaBasedArray from "./SchemaBasedArray.svelte"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  import SchemaBasedMultiType from "./SchemaBasedMultiType.svelte"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  import ArrayMultiAnswer from "./ArrayMultiAnswer.svelte"
							 | 
						
					
						
							
								
									
										
										
										
											2023-10-07 03:07:32 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-02 19:06:14 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  export let state: EditJsonState<any>
							 | 
						
					
						
							
								
									
										
										
										
											2023-11-09 16:30:26 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  export let path: (string | number)[] = []
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-02 19:06:14 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  console.log("Fetched schema:", path, state.getSchema(<any> path))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  let schema: ConfigMeta = state.getSchema(<any> path)[0]
							 | 
						
					
						
							
								
									
										
										
										
											2023-11-09 16:30:26 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  let expertMode = state.expertMode
							 | 
						
					
						
							
								
									
										
										
										
											2023-06-18 00:44:57 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								</script>
							 | 
						
					
						
							
								
									
										
										
										
											2023-11-09 16:30:26 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2023-11-09 15:42:15 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								{#if (schema.hints?.group !== "expert" || $expertMode) && schema.hints.group !== "hidden"}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  {#if schema.hints?.typehint?.endsWith("[]")}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    <!-- We cheat a bit here by matching this 'magical' type... -->
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    <SchemaBasedArray {path} {state} {schema} />
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  {:else if schema.type === "array" && schema.hints.multianswer === "true"}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    <ArrayMultiAnswer {path} {state} {schema} />
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  {:else if schema.type === "array"}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    <SchemaBasedArray {path} {state} {schema} />
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  {:else if schema.hints?.types}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    <SchemaBasedMultiType {path} {state} {schema} />
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  {:else}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    <SchemaBasedField {path} {state} {schema} />
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  {/if}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{:else if window.location.hostname === "127.0.0.1"}
							 | 
						
					
						
							
								
									
										
										
										
											2023-11-09 16:30:26 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  <div class="subtle">
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    Not showing SBI {schema.path.join(".")} due to group {schema.hints.group}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  </div>
							 | 
						
					
						
							
								
									
										
										
										
											2023-06-18 00:44:57 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{/if}
							 |