forked from MapComplete/MapComplete
Studio: first working version for basic layer properties
This commit is contained in:
parent
5a49677d5a
commit
f18a2b9184
41 changed files with 4446 additions and 852 deletions
10
UI/InputElement/Helpers/ImageHelper.svelte
Normal file
10
UI/InputElement/Helpers/ImageHelper.svelte
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<script lang="ts">
|
||||
import {UIEventSource} from "../../../Logic/UIEventSource";
|
||||
|
||||
/**
|
||||
* Simply shows the image
|
||||
*/
|
||||
export let value: UIEventSource<undefined | string>
|
||||
</script>
|
||||
|
||||
<img src={$value}/>
|
||||
|
|
@ -13,6 +13,7 @@ import { Utils } from "../../Utils"
|
|||
import Locale from "../i18n/Locale"
|
||||
import { Feature } from "geojson"
|
||||
import { GeoOperations } from "../../Logic/GeoOperations"
|
||||
import ImageHelper from "./Helpers/ImageHelper.svelte"
|
||||
|
||||
export interface InputHelperProperties {
|
||||
/**
|
||||
|
|
@ -55,6 +56,7 @@ export default class InputHelpers {
|
|||
color: (value) => new SvelteUIElement(ColorInput, { value }),
|
||||
opening_hours: (value) => new OpeningHoursInput(value),
|
||||
wikidata: InputHelpers.constructWikidataHelper,
|
||||
image: (value) => new SvelteUIElement(ImageHelper, { value }),
|
||||
} as const
|
||||
|
||||
/**
|
||||
|
|
@ -87,6 +89,7 @@ export default class InputHelpers {
|
|||
}
|
||||
return mapProperties
|
||||
}
|
||||
|
||||
private static constructWikidataHelper(
|
||||
value: UIEventSource<string>,
|
||||
props: InputHelperProperties
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ import Combine from "../Base/Combine"
|
|||
import Title from "../Base/Title"
|
||||
import SimpleTagValidator from "./Validators/SimpleTagValidator"
|
||||
import ImageUrlValidator from "./Validators/ImageUrlValidator"
|
||||
import TagKeyValidator from "./Validators/TagKeyValidator";
|
||||
import TagKeyValidator from "./Validators/TagKeyValidator"
|
||||
|
||||
export type ValidatorType = (typeof Validators.availableTypes)[number]
|
||||
|
||||
|
|
@ -42,6 +42,9 @@ export default class Validators {
|
|||
"phone",
|
||||
"opening_hours",
|
||||
"color",
|
||||
"image",
|
||||
"simple_tag",
|
||||
"key",
|
||||
] as const
|
||||
|
||||
public static readonly AllValidators: ReadonlyArray<Validator> = [
|
||||
|
|
@ -63,7 +66,7 @@ export default class Validators {
|
|||
new ColorValidator(),
|
||||
new ImageUrlValidator(),
|
||||
new SimpleTagValidator(),
|
||||
new TagKeyValidator()
|
||||
new TagKeyValidator(),
|
||||
]
|
||||
|
||||
private static _byType = Validators._byTypeConstructor()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue