forked from MapComplete/MapComplete
Refactoring: switch specialVis constructor to an object
This commit is contained in:
parent
6bb33771b4
commit
be5bcd99d7
37 changed files with 302 additions and 559 deletions
|
|
@ -1,12 +1,8 @@
|
|||
import { SpecialVisualization, SpecialVisualizationState } from "../../SpecialVisualization"
|
||||
import BaseUIElement from "../../BaseUIElement"
|
||||
import { UIEventSource } from "../../../Logic/UIEventSource"
|
||||
import { SpecialVisualisationParams, SpecialVisualizationSvelte } from "../../SpecialVisualization"
|
||||
import SvelteUIElement from "../../Base/SvelteUIElement"
|
||||
import { Feature } from "geojson"
|
||||
import LayerConfig from "../../../Models/ThemeConfig/LayerConfig"
|
||||
import { default as LanguageElementSvelte } from "./LanguageElement.svelte"
|
||||
|
||||
export class LanguageElement extends SpecialVisualization {
|
||||
export class LanguageElement extends SpecialVisualizationSvelte {
|
||||
funcName: string = "language_chooser"
|
||||
needsUrls = []
|
||||
|
||||
|
|
@ -66,14 +62,16 @@ export class LanguageElement extends SpecialVisualization {
|
|||
`
|
||||
|
||||
constr(
|
||||
state: SpecialVisualizationState,
|
||||
tagSource: UIEventSource<Record<string, string>>,
|
||||
argument: string[],
|
||||
feature: Feature,
|
||||
layer: LayerConfig
|
||||
): BaseUIElement {
|
||||
{
|
||||
state,
|
||||
tags,
|
||||
args,
|
||||
feature,
|
||||
layer,
|
||||
}: SpecialVisualisationParams,
|
||||
): SvelteUIElement {
|
||||
let [key, question, item_render, single_render, all_render, on_no_known_languages] =
|
||||
argument
|
||||
args
|
||||
if (item_render === undefined || item_render.trim() === "") {
|
||||
item_render = "{language()}"
|
||||
}
|
||||
|
|
@ -101,7 +99,7 @@ export class LanguageElement extends SpecialVisualization {
|
|||
|
||||
return new SvelteUIElement(LanguageElementSvelte, {
|
||||
key,
|
||||
tags: tagSource,
|
||||
tags,
|
||||
state,
|
||||
feature,
|
||||
layer,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue