| 
									
										
										
										
											2023-03-28 05:13:48 +02:00
										 |  |  | <script lang="ts"> | 
					
						
							| 
									
										
										
										
											2023-06-14 20:39:36 +02:00
										 |  |  |   import type { Feature } from "geojson" | 
					
						
							| 
									
										
										
										
											2023-12-19 22:08:00 +01:00
										 |  |  |   import { Store, UIEventSource } from "../../Logic/UIEventSource" | 
					
						
							| 
									
										
										
										
											2023-06-14 20:39:36 +02:00
										 |  |  |   import LayerConfig from "../../Models/ThemeConfig/LayerConfig" | 
					
						
							|  |  |  |   import type { SpecialVisualizationState } from "../SpecialVisualization" | 
					
						
							|  |  |  |   import TagRenderingEditable from "../Popup/TagRendering/TagRenderingEditable.svelte" | 
					
						
							|  |  |  |   import { onDestroy } from "svelte" | 
					
						
							|  |  |  |   import Translations from "../i18n/Translations" | 
					
						
							|  |  |  |   import Tr from "../Base/Tr.svelte" | 
					
						
							| 
									
										
										
										
											2023-12-19 22:08:00 +01:00
										 |  |  |   import TagRenderingConfig from "../../Models/ThemeConfig/TagRenderingConfig" | 
					
						
							| 
									
										
										
										
											2024-03-08 17:51:50 +01:00
										 |  |  |   import UserRelatedState from "../../Logic/State/UserRelatedState" | 
					
						
							| 
									
										
										
										
											2024-03-11 16:00:22 +01:00
										 |  |  |   import Delete_icon from "../../assets/svg/Delete_icon.svelte" | 
					
						
							|  |  |  |   import BackButton from "../Base/BackButton.svelte" | 
					
						
							| 
									
										
										
										
											2023-03-28 05:13:48 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-14 20:39:36 +02:00
										 |  |  |   export let state: SpecialVisualizationState | 
					
						
							|  |  |  |   export let selectedElement: Feature | 
					
						
							|  |  |  |   export let highlightedRendering: UIEventSource<string> = undefined | 
					
						
							| 
									
										
										
										
											2023-04-07 02:13:57 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-02-22 18:58:34 +01:00
										 |  |  |   export let tags: UIEventSource<Record<string, string>> = state?.featureProperties?.getStore( | 
					
						
							| 
									
										
										
										
											2023-12-19 22:08:00 +01:00
										 |  |  |     selectedElement.properties.id | 
					
						
							|  |  |  |   ) | 
					
						
							| 
									
										
										
										
											2024-02-28 02:09:27 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-13 02:40:21 +02:00
										 |  |  |   let layer: LayerConfig = | 
					
						
							|  |  |  |     selectedElement.properties.id === "settings" | 
					
						
							|  |  |  |       ? UserRelatedState.usersettingsConfig | 
					
						
							|  |  |  |       : state.layout.getMatchingLayer(tags.data) | 
					
						
							| 
									
										
										
										
											2024-03-11 16:00:22 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-13 02:40:21 +02:00
										 |  |  |   let stillMatches = tags.map( | 
					
						
							|  |  |  |     (tags) => !layer?.source?.osmTags || layer.source.osmTags?.matchesProperties(tags) | 
					
						
							|  |  |  |   ) | 
					
						
							| 
									
										
										
										
											2023-12-07 21:57:20 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-14 20:39:36 +02:00
										 |  |  |   let _metatags: Record<string, string> | 
					
						
							| 
									
										
										
										
											2024-04-13 02:40:21 +02:00
										 |  |  |   if (state?.userRelatedState?.preferencesAsTags) { | 
					
						
							|  |  |  |     onDestroy( | 
					
						
							|  |  |  |       state.userRelatedState.preferencesAsTags.addCallbackAndRun((tags) => { | 
					
						
							|  |  |  |         _metatags = tags | 
					
						
							|  |  |  |       }) | 
					
						
							|  |  |  |     ) | 
					
						
							| 
									
										
										
										
											2024-02-22 18:58:34 +01:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2023-11-23 15:47:16 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-19 22:08:00 +01:00
										 |  |  |   let knownTagRenderings: Store<TagRenderingConfig[]> = tags.mapD((tgs) => | 
					
						
							|  |  |  |     layer.tagRenderings.filter( | 
					
						
							|  |  |  |       (config) => | 
					
						
							|  |  |  |         (config.condition?.matchesProperties(tgs) ?? true) && | 
					
						
							|  |  |  |         (config.metacondition?.matchesProperties({ ...tgs, ..._metatags }) ?? true) && | 
					
						
							| 
									
										
										
										
											2024-04-13 02:40:21 +02:00
										 |  |  |         config.IsKnown(tgs) | 
					
						
							|  |  |  |     ) | 
					
						
							| 
									
										
										
										
											2023-12-19 22:08:00 +01:00
										 |  |  |   ) | 
					
						
							| 
									
										
										
										
											2023-03-28 05:13:48 +02:00
										 |  |  | </script> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-02-20 23:47:49 +01:00
										 |  |  | {#if !$stillMatches} | 
					
						
							| 
									
										
										
										
											2024-03-11 16:00:22 +01:00
										 |  |  |   <div class="alert" aria-live="assertive"> | 
					
						
							|  |  |  |     <Tr t={Translations.t.delete.isChanged} /> | 
					
						
							| 
									
										
										
										
											2024-02-20 23:47:49 +01:00
										 |  |  |   </div> | 
					
						
							|  |  |  | {:else if $tags._deleted === "yes"} | 
					
						
							| 
									
										
										
										
											2024-03-11 16:00:22 +01:00
										 |  |  |   <div class="flex w-full flex-col p-2"> | 
					
						
							|  |  |  |     <div aria-live="assertive" class="alert flex items-center justify-center self-stretch"> | 
					
						
							| 
									
										
										
										
											2024-04-13 02:40:21 +02:00
										 |  |  |       <Delete_icon class="m-2 h-8 w-8" /> | 
					
						
							| 
									
										
										
										
											2024-03-11 16:00:22 +01:00
										 |  |  |       <Tr t={Translations.t.delete.isDeleted} /> | 
					
						
							|  |  |  |     </div> | 
					
						
							|  |  |  |     <BackButton clss="self-stretch mt-4" on:click={() => state.selectedElement.setData(undefined)}> | 
					
						
							|  |  |  |       <Tr t={Translations.t.general.returnToTheMap} /> | 
					
						
							|  |  |  |     </BackButton> | 
					
						
							| 
									
										
										
										
											2023-12-25 19:59:58 +01:00
										 |  |  |   </div> | 
					
						
							| 
									
										
										
										
											2023-04-20 17:42:07 +02:00
										 |  |  | {:else} | 
					
						
							| 
									
										
										
										
											2024-02-20 13:33:38 +01:00
										 |  |  |   <div | 
					
						
							|  |  |  |     class="selected-element-view flex h-full w-full flex-col gap-y-2 overflow-y-auto p-1 px-4" | 
					
						
							|  |  |  |     tabindex="-1" | 
					
						
							|  |  |  |   > | 
					
						
							| 
									
										
										
										
											2023-12-06 17:27:30 +01:00
										 |  |  |     {#each $knownTagRenderings as config (config.id)} | 
					
						
							| 
									
										
										
										
											2023-11-23 15:47:16 +01:00
										 |  |  |       <TagRenderingEditable | 
					
						
							|  |  |  |         {tags} | 
					
						
							|  |  |  |         {config} | 
					
						
							|  |  |  |         {state} | 
					
						
							|  |  |  |         {selectedElement} | 
					
						
							|  |  |  |         {layer} | 
					
						
							|  |  |  |         {highlightedRendering} | 
					
						
							| 
									
										
										
										
											2023-12-19 22:08:00 +01:00
										 |  |  |         clss={$knownTagRenderings.length === 1 | 
					
						
							|  |  |  |           ? "h-full" | 
					
						
							|  |  |  |           : "tr-length-" + $knownTagRenderings.length} | 
					
						
							| 
									
										
										
										
											2023-11-23 15:47:16 +01:00
										 |  |  |       /> | 
					
						
							| 
									
										
										
										
											2023-06-14 20:39:36 +02:00
										 |  |  |     {/each} | 
					
						
							|  |  |  |   </div> | 
					
						
							| 
									
										
										
										
											2023-04-20 17:42:07 +02:00
										 |  |  | {/if} |