2023-03-28 05:13:48 +02:00
|
|
|
<script lang="ts">
|
2023-06-14 20:39:36 +02:00
|
|
|
import type { Feature } from "geojson"
|
|
|
|
import { UIEventSource } from "../../Logic/UIEventSource"
|
|
|
|
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-03-28 05:13:48 +02:00
|
|
|
|
2023-06-14 20:39:36 +02:00
|
|
|
export let state: SpecialVisualizationState
|
|
|
|
export let layer: LayerConfig
|
|
|
|
export let selectedElement: Feature
|
|
|
|
export let tags: UIEventSource<Record<string, string>>
|
|
|
|
export let highlightedRendering: UIEventSource<string> = undefined
|
2023-04-07 02:13:57 +02:00
|
|
|
|
2023-06-14 20:39:36 +02:00
|
|
|
let _metatags: Record<string, string>
|
|
|
|
onDestroy(
|
|
|
|
state.userRelatedState.preferencesAsTags.addCallbackAndRun((tags) => {
|
|
|
|
_metatags = tags
|
|
|
|
})
|
|
|
|
)
|
2023-11-12 10:14:51 +01:00
|
|
|
|
|
|
|
|
|
|
|
let knownTagRenderings = layer.tagRenderings
|
|
|
|
.filter(config => (config.condition?.matchesProperties($tags) ?? true) && (config.metacondition?.matchesProperties({ ...$tags, ..._metatags } ?? true)
|
|
|
|
&& config.IsKnown($tags)))
|
2023-11-13 01:20:38 +01:00
|
|
|
$: {
|
|
|
|
knownTagRenderings = layer.tagRenderings
|
|
|
|
.filter(config => (config.condition?.matchesProperties($tags) ?? true) && (config.metacondition?.matchesProperties({ ...$tags, ..._metatags } ?? true)
|
|
|
|
&& config.IsKnown($tags)))
|
|
|
|
}
|
2023-03-28 05:13:48 +02:00
|
|
|
</script>
|
|
|
|
|
2023-10-06 02:57:53 +02:00
|
|
|
{#if $tags._deleted === "yes"}
|
2023-06-14 20:39:36 +02:00
|
|
|
<Tr t={Translations.t.delete.isDeleted} />
|
|
|
|
<button class="w-full" on:click={() => state.selectedElement.setData(undefined)}>
|
|
|
|
<Tr t={Translations.t.general.returnToTheMap} />
|
|
|
|
</button>
|
2023-04-20 17:42:07 +02:00
|
|
|
{:else}
|
2023-11-09 16:30:26 +01:00
|
|
|
<div class="flex h-full flex-col gap-y-2 overflow-y-auto p-1 px-2">
|
2023-11-12 10:14:51 +01:00
|
|
|
{#each knownTagRenderings as config (config.id)}
|
2023-06-14 20:39:36 +02:00
|
|
|
<TagRenderingEditable
|
|
|
|
{tags}
|
|
|
|
{config}
|
|
|
|
{state}
|
|
|
|
{selectedElement}
|
|
|
|
{layer}
|
|
|
|
{highlightedRendering}
|
2023-11-12 10:14:51 +01:00
|
|
|
clss={knownTagRenderings.length === 1 ? "h-full" : "tr-length-"+knownTagRenderings.length}
|
2023-06-14 20:39:36 +02:00
|
|
|
/>
|
|
|
|
{/each}
|
|
|
|
</div>
|
2023-04-20 17:42:07 +02:00
|
|
|
{/if}
|