forked from MapComplete/MapComplete
Chore: formatting
This commit is contained in:
parent
6c3c67af56
commit
286578bfc7
58 changed files with 2199 additions and 1915 deletions
|
|
@ -1,44 +1,48 @@
|
|||
<script lang="ts">
|
||||
import type { ConfigMeta } from "./configMeta";
|
||||
import EditLayerState from "./EditLayerState";
|
||||
import type {
|
||||
QuestionableTagRenderingConfigJson
|
||||
} from "../../Models/ThemeConfig/Json/QuestionableTagRenderingConfigJson";
|
||||
import { UIEventSource } from "../../Logic/UIEventSource";
|
||||
import TagRenderingEditable from "../Popup/TagRendering/TagRenderingEditable.svelte";
|
||||
import TagRenderingConfig from "../../Models/ThemeConfig/TagRenderingConfig";
|
||||
import type { ConfigMeta } from "./configMeta"
|
||||
import EditLayerState from "./EditLayerState"
|
||||
import type { QuestionableTagRenderingConfigJson } from "../../Models/ThemeConfig/Json/QuestionableTagRenderingConfigJson"
|
||||
import { UIEventSource } from "../../Logic/UIEventSource"
|
||||
import TagRenderingEditable from "../Popup/TagRendering/TagRenderingEditable.svelte"
|
||||
import TagRenderingConfig from "../../Models/ThemeConfig/TagRenderingConfig"
|
||||
|
||||
export let schema: ConfigMeta;
|
||||
export let state: EditLayerState;
|
||||
export let path: (string | number)[] = [];
|
||||
export let schema: ConfigMeta
|
||||
export let state: EditLayerState
|
||||
export let path: (string | number)[] = []
|
||||
|
||||
const configJson: QuestionableTagRenderingConfigJson = {
|
||||
mappings: schema.hints.suggestions,
|
||||
multiAnswer: true,
|
||||
id: "multi_anwser_"+path.join("_"),
|
||||
question: schema.hints.question
|
||||
id: "multi_anwser_" + path.join("_"),
|
||||
question: schema.hints.question,
|
||||
}
|
||||
const tags = new UIEventSource({})
|
||||
|
||||
{
|
||||
// Setting the initial value
|
||||
const v = <string[]> state.getCurrentValueFor(path)
|
||||
if(v && v.length > 0){
|
||||
tags.setData({value: v.join(";")})
|
||||
const v = <string[]>state.getCurrentValueFor(path)
|
||||
if (v && v.length > 0) {
|
||||
tags.setData({ value: v.join(";") })
|
||||
}
|
||||
}
|
||||
|
||||
tags.addCallbackD(tags => {
|
||||
|
||||
tags.addCallbackD((tags) => {
|
||||
const values = tags["value"]?.split(";")
|
||||
if(!values){
|
||||
if (!values) {
|
||||
return
|
||||
}
|
||||
state.setValueAt(path, values)
|
||||
})
|
||||
|
||||
|
||||
const config = new TagRenderingConfig(configJson)
|
||||
</script>
|
||||
|
||||
<div>
|
||||
<TagRenderingEditable {config} selectedElement={undefined} showQuestionIfUnknown={true} {state} {tags} />
|
||||
<TagRenderingEditable
|
||||
{config}
|
||||
selectedElement={undefined}
|
||||
showQuestionIfUnknown={true}
|
||||
{state}
|
||||
{tags}
|
||||
/>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue