forked from MapComplete/MapComplete
refactoring: more fixes, first attempt at tagRenderingAnswer
This commit is contained in:
parent
aaaaf1948d
commit
29372c465e
24 changed files with 278 additions and 113 deletions
|
@ -3,7 +3,7 @@ import { LayerConfigJson } from "../Json/LayerConfigJson"
|
|||
import LayerConfig from "../LayerConfig"
|
||||
import { Utils } from "../../../Utils"
|
||||
import Constants from "../../Constants"
|
||||
import { Translation, TypedTranslation } from "../../../UI/i18n/Translation"
|
||||
import { Translation } from "../../../UI/i18n/Translation"
|
||||
import { LayoutConfigJson } from "../Json/LayoutConfigJson"
|
||||
import LayoutConfig from "../LayoutConfig"
|
||||
import { TagRenderingConfigJson } from "../Json/TagRenderingConfigJson"
|
||||
|
@ -16,7 +16,6 @@ import FilterConfigJson from "../Json/FilterConfigJson"
|
|||
import DeleteConfig from "../DeleteConfig"
|
||||
import { QuestionableTagRenderingConfigJson } from "../Json/QuestionableTagRenderingConfigJson"
|
||||
import Validators from "../../../UI/InputElement/Validators"
|
||||
import xml2js from "xml2js"
|
||||
|
||||
class ValidateLanguageCompleteness extends DesugaringStep<any> {
|
||||
private readonly _languages: string[]
|
||||
|
@ -631,14 +630,14 @@ class MiscTagRenderingChecks extends DesugaringStep<TagRenderingConfigJson> {
|
|||
}
|
||||
const freeformType = json["freeform"]?.["type"]
|
||||
if (freeformType) {
|
||||
if (Validators.AvailableTypes().indexOf(freeformType) < 0) {
|
||||
if (Validators.availableTypes.indexOf(freeformType) < 0) {
|
||||
throw (
|
||||
"At " +
|
||||
context +
|
||||
".freeform.type is an unknown type: " +
|
||||
freeformType +
|
||||
"; try one of " +
|
||||
Validators.AvailableTypes().join(", ")
|
||||
Validators.availableTypes.join(", ")
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -943,9 +942,9 @@ export class ValidateFilter extends DesugaringStep<FilterConfigJson> {
|
|||
for (let i = 0; i < option.fields.length; i++) {
|
||||
const field = option.fields[i]
|
||||
const type = field.type ?? "string"
|
||||
if (Validators.AvailableTypes().find((t) => t === type) === undefined) {
|
||||
if (Validators.availableTypes.find((t) => t === type) === undefined) {
|
||||
const err = `Invalid filter: ${type} is not a valid textfield type (at ${context}.fields[${i}])\n\tTry one of ${Array.from(
|
||||
Validators.AvailableTypes()
|
||||
Validators.availableTypes
|
||||
).join(",")}`
|
||||
errors.push(err)
|
||||
}
|
||||
|
|
|
@ -119,10 +119,20 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
const indexedElements = this.indexedFeatures
|
||||
this.featureProperties = new FeaturePropertiesStore(indexedElements)
|
||||
const perLayer = new PerLayerFeatureSourceSplitter(
|
||||
Array.from(this.layerState.filteredLayers.values()),
|
||||
Array.from(this.layerState.filteredLayers.values()).filter(
|
||||
(l) => l.layerDef.source !== null
|
||||
),
|
||||
indexedElements,
|
||||
{
|
||||
constructStore: (features, layer) => new GeoIndexedStoreForLayer(features, layer),
|
||||
handleLeftovers: (features) => {
|
||||
console.warn(
|
||||
"Got ",
|
||||
features.length,
|
||||
"leftover features, such as",
|
||||
features[0].properties
|
||||
)
|
||||
},
|
||||
}
|
||||
)
|
||||
this.perLayer = perLayer.perLayer
|
||||
|
@ -141,16 +151,7 @@ export default class ThemeViewState implements SpecialVisualizationState {
|
|||
(fs.layer.isDisplayed?.data ?? true) && z >= (fs.layer.layerDef?.minzoom ?? 0),
|
||||
[fs.layer.isDisplayed]
|
||||
)
|
||||
doShowLayer.addCallbackAndRunD((doShow) =>
|
||||
console.log(
|
||||
"Layer",
|
||||
fs.layer.layerDef.id,
|
||||
"is",
|
||||
doShow,
|
||||
this.mapProperties.zoom.data,
|
||||
fs.layer.layerDef.minzoom
|
||||
)
|
||||
)
|
||||
|
||||
new ShowDataLayer(this.map, {
|
||||
layer: fs.layer.layerDef,
|
||||
features: filtered,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue