forked from MapComplete/MapComplete
Cleanup of NSI feature breanch
This commit is contained in:
parent
f6d93a6ab1
commit
3146fa0d26
14 changed files with 143 additions and 537 deletions
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
function animate(opened: boolean) {
|
||||
const moveToElem = moveTo.data
|
||||
console.log("Animating", debug," to", opened)
|
||||
if (opened) {
|
||||
copySizeOf(targetOuter)
|
||||
elem.style.background = "var(--background-color)"
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@
|
|||
import UserRelatedState from "../../Logic/State/UserRelatedState"
|
||||
import Delete_icon from "../../assets/svg/Delete_icon.svelte"
|
||||
import BackButton from "../Base/BackButton.svelte"
|
||||
import TagRenderingEditableDynamic from "../Popup/TagRendering/TagRenderingEditableDynamic.svelte"
|
||||
|
||||
export let state: SpecialVisualizationState
|
||||
export let selectedElement: Feature
|
||||
|
|
@ -69,7 +68,7 @@
|
|||
tabindex="-1"
|
||||
>
|
||||
{#each $knownTagRenderings as config (config.id)}
|
||||
<TagRenderingEditableDynamic
|
||||
<TagRenderingEditable
|
||||
{tags}
|
||||
{config}
|
||||
{state}
|
||||
|
|
|
|||
22
src/UI/Popup/TagRendering/TagRenderingAnswerDynamic.svelte
Normal file
22
src/UI/Popup/TagRendering/TagRenderingAnswerDynamic.svelte
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<script lang="ts">
|
||||
import TagRenderingConfig, { TagRenderingConfigUtils } from "../../../Models/ThemeConfig/TagRenderingConfig"
|
||||
import type { SpecialVisualizationState } from "../../SpecialVisualization"
|
||||
import type { Feature } from "geojson"
|
||||
import { UIEventSource } from "../../../Logic/UIEventSource"
|
||||
import LayerConfig from "../../../Models/ThemeConfig/LayerConfig"
|
||||
import TagRenderingAnswer from "./TagRenderingAnswer.svelte"
|
||||
|
||||
export let tags: UIEventSource<Record<string, string> | undefined>
|
||||
|
||||
export let state: SpecialVisualizationState
|
||||
export let selectedElement: Feature
|
||||
export let layer: LayerConfig
|
||||
export let config: TagRenderingConfig
|
||||
export let extraClasses: string | undefined = undefined
|
||||
|
||||
export let id: string = undefined
|
||||
let dynamicConfig = TagRenderingConfigUtils.withNameSuggestionIndex(config, tags, selectedElement)
|
||||
|
||||
</script>
|
||||
|
||||
<TagRenderingAnswer {selectedElement} {layer} config={$dynamicConfig} {extraClasses} {id} {tags} {state} />
|
||||
|
|
@ -3,8 +3,6 @@
|
|||
import { Store, UIEventSource } from "../../../Logic/UIEventSource"
|
||||
import type { Feature } from "geojson"
|
||||
import type { SpecialVisualizationState } from "../../SpecialVisualization"
|
||||
import TagRenderingAnswer from "./TagRenderingAnswer.svelte"
|
||||
import { PencilAltIcon } from "@rgossiaux/svelte-heroicons/solid"
|
||||
import TagRenderingQuestion from "./TagRenderingQuestion.svelte"
|
||||
import { onDestroy } from "svelte"
|
||||
import Tr from "../../Base/Tr.svelte"
|
||||
|
|
@ -12,9 +10,8 @@
|
|||
import LayerConfig from "../../../Models/ThemeConfig/LayerConfig"
|
||||
import { Utils } from "../../../Utils"
|
||||
import { twMerge } from "tailwind-merge"
|
||||
import { ariaLabel } from "../../../Utils/ariaLabel"
|
||||
import EditButton from "./EditButton.svelte"
|
||||
import EditItemButton from "../../Studio/EditItemButton.svelte"
|
||||
import TagRenderingAnswerDynamic from "./TagRenderingAnswerDynamic.svelte"
|
||||
|
||||
export let config: TagRenderingConfig
|
||||
export let tags: UIEventSource<Record<string, string>>
|
||||
|
|
@ -103,7 +100,7 @@
|
|||
</TagRenderingQuestion>
|
||||
{:else}
|
||||
<div class="low-interaction flex items-center justify-between overflow-hidden rounded px-2">
|
||||
<TagRenderingAnswer id={answerId} {config} {tags} {selectedElement} {state} {layer} />
|
||||
<TagRenderingAnswerDynamic id={answerId} {config} {tags} {selectedElement} {state} {layer} />
|
||||
<EditButton
|
||||
arialabel={config.editButtonAriaLabel}
|
||||
ariaLabelledBy={answerId}
|
||||
|
|
@ -115,7 +112,7 @@
|
|||
{/if}
|
||||
{:else}
|
||||
<div class="h-full w-full overflow-hidden">
|
||||
<TagRenderingAnswer {config} {tags} {selectedElement} {state} {layer} />
|
||||
<TagRenderingAnswerDynamic {config} {tags} {selectedElement} {state} {layer} />
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,32 +0,0 @@
|
|||
<script lang="ts">/**
|
||||
* Wrapper around 'tagRenderingEditable' but might add mappings dynamically
|
||||
*/
|
||||
import TagRenderingConfig, { TagRenderingConfigUtils } from "../../../Models/ThemeConfig/TagRenderingConfig"
|
||||
import { UIEventSource } from "../../../Logic/UIEventSource"
|
||||
import type { Feature } from "geojson"
|
||||
import type { SpecialVisualizationState } from "../../SpecialVisualization"
|
||||
import LayerConfig from "../../../Models/ThemeConfig/LayerConfig"
|
||||
import TagRenderingEditable from "./TagRenderingEditable.svelte"
|
||||
|
||||
export let config: TagRenderingConfig
|
||||
export let tags: UIEventSource<Record<string, string>>
|
||||
export let selectedElement: Feature | undefined
|
||||
export let state: SpecialVisualizationState
|
||||
export let layer: LayerConfig = undefined
|
||||
|
||||
|
||||
export let highlightedRendering: UIEventSource<string> = undefined
|
||||
export let clss = undefined
|
||||
|
||||
let dynamicConfig = TagRenderingConfigUtils.withNameSuggestionIndex(config, tags, selectedElement)
|
||||
</script>
|
||||
|
||||
<TagRenderingEditable
|
||||
{tags}
|
||||
config={$dynamicConfig}
|
||||
{state}
|
||||
{selectedElement}
|
||||
{layer}
|
||||
{highlightedRendering}
|
||||
{clss}
|
||||
/>
|
||||
|
|
@ -72,7 +72,6 @@
|
|||
/**
|
||||
* Prepares and fills the checkedMappings
|
||||
*/
|
||||
console.log("Initing ", config.id)
|
||||
|
||||
function initialize(tgs: Record<string, string>, confg: TagRenderingConfig): void {
|
||||
mappings = confg.mappings?.filter((m) => {
|
||||
|
|
@ -160,7 +159,6 @@
|
|||
}
|
||||
}
|
||||
if (somethingChanged) {
|
||||
console.log("Updating minimal tags to", newMinimal, "of", config.id)
|
||||
minimalTags.setData(newMinimal)
|
||||
}
|
||||
})
|
||||
|
|
@ -224,7 +222,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
if (extraTags.data) {
|
||||
if (extraTags.data && selectedTags !== undefined) {
|
||||
// Map the extraTags into an array of Tag objects
|
||||
const extraTagsArray = Object.entries(extraTags.data).map(([k, v]) => new Tag(k, v))
|
||||
|
||||
|
|
@ -236,7 +234,7 @@
|
|||
// Add the extraTags to the existing And
|
||||
selectedTags = new And([...selectedTags.and, ...extraTagsArray])
|
||||
} else {
|
||||
console.error("selectedTags is not of type Tag or And")
|
||||
console.error("selectedTags is not of type Tag or And, it is a "+JSON.stringify(selectedTags))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue