forked from MapComplete/MapComplete
refactoring: fix special renderings (partly), deprecate
This commit is contained in:
parent
9b2f92dedc
commit
aaaaf1948d
15 changed files with 160 additions and 95 deletions
|
@ -1,18 +1,21 @@
|
|||
import { TagRenderingConfigJson } from "../Json/TagRenderingConfigJson"
|
||||
import { Utils } from "../../../Utils"
|
||||
import SpecialVisualizations from "../../../UI/SpecialVisualizations"
|
||||
import { SpecialVisualization } from "../../../UI/SpecialVisualization"
|
||||
|
||||
export default class ValidationUtils {
|
||||
/**
|
||||
* Gives all the (function names of) used special visualisations
|
||||
* @param renderingConfig
|
||||
*/
|
||||
public static getSpecialVisualisations(renderingConfig: TagRenderingConfigJson): string[] {
|
||||
public static getSpecialVisualisations(
|
||||
renderingConfig: TagRenderingConfigJson
|
||||
): SpecialVisualization[] {
|
||||
const translations: any[] = Utils.NoNull([
|
||||
renderingConfig.render,
|
||||
...(renderingConfig.mappings ?? []).map((m) => m.then),
|
||||
])
|
||||
const all: string[] = []
|
||||
const all: SpecialVisualization[] = []
|
||||
for (let translation of translations) {
|
||||
if (typeof translation == "string") {
|
||||
translation = { "*": translation }
|
||||
|
@ -27,7 +30,7 @@ export default class ValidationUtils {
|
|||
const parts = SpecialVisualizations.constructSpecification(template)
|
||||
const specials = parts
|
||||
.filter((p) => typeof p !== "string")
|
||||
.map((special) => special["func"].funcName)
|
||||
.map((special) => special["func"])
|
||||
all.push(...specials)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue