forked from MapComplete/MapComplete
Studio: WIP
This commit is contained in:
parent
04ecdad1bb
commit
903e168a89
62 changed files with 19152 additions and 123399 deletions
20
src/UI/InputElement/Helpers/SimpleTagInput.svelte
Normal file
20
src/UI/InputElement/Helpers/SimpleTagInput.svelte
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<script lang="ts">/**
|
||||
* Input helper to create a tag. The tag is JSON-encoded
|
||||
*/
|
||||
import { UIEventSource } from "../../../Logic/UIEventSource";
|
||||
import BasicTagInput from "../../Studio/TagInput/BasicTagInput.svelte";
|
||||
|
||||
export let value: UIEventSource<undefined | string>;
|
||||
export let uploadableOnly: boolean;
|
||||
export let overpassSupportNeeded: boolean;
|
||||
|
||||
/**
|
||||
* Only show the taginfo-statistics if they are suspicious (thus: less then 250 entries)
|
||||
*/
|
||||
export let silent: boolean = false;
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<BasicTagInput {overpassSupportNeeded} {silent} tag={value} {uploadableOnly} />
|
||||
33
src/UI/InputElement/Helpers/TagInput.svelte
Normal file
33
src/UI/InputElement/Helpers/TagInput.svelte
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<script lang="ts">/**
|
||||
* Input helper to create a tag. The tag is JSON-encoded
|
||||
*/
|
||||
import { UIEventSource } from "../../../Logic/UIEventSource";
|
||||
import type { TagConfigJson } from "../../../Models/ThemeConfig/Json/TagConfigJson";
|
||||
import FullTagInput from "../../Studio/TagInput/FullTagInput.svelte";
|
||||
|
||||
export let value: UIEventSource<undefined | string>;
|
||||
export let uploadableOnly: boolean;
|
||||
export let overpassSupportNeeded: boolean;
|
||||
|
||||
/**
|
||||
* Only show the taginfo-statistics if they are suspicious (thus: less then 250 entries)
|
||||
*/
|
||||
export let silent: boolean = false;
|
||||
|
||||
let tag: UIEventSource<string | TagConfigJson> = value.sync(s => {
|
||||
try {
|
||||
return JSON.parse(s);
|
||||
} catch (e) {
|
||||
return s;
|
||||
}
|
||||
}, [], t => {
|
||||
if(typeof t === "string"){
|
||||
return t
|
||||
}
|
||||
return JSON.stringify(t);
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<FullTagInput {overpassSupportNeeded} {silent} {tag} {uploadableOnly} />
|
||||
Loading…
Add table
Add a link
Reference in a new issue