forked from MapComplete/MapComplete
Merge develop
This commit is contained in:
commit
fec3608ca4
57 changed files with 1160 additions and 594 deletions
|
|
@ -86,17 +86,29 @@ export default class Constants {
|
|||
static distanceToChangeObjectBins = [25, 50, 100, 500, 1000, 5000, Number.MAX_VALUE]
|
||||
static themeOrder = [
|
||||
"personal",
|
||||
|
||||
"cyclofix",
|
||||
"waste",
|
||||
"etymology",
|
||||
"waste",
|
||||
|
||||
"food",
|
||||
"cafes_and_pubs",
|
||||
"shops",
|
||||
"playgrounds",
|
||||
"hailhydrant",
|
||||
"toilets",
|
||||
"aed",
|
||||
"healthcare",
|
||||
"sports",
|
||||
|
||||
"artwork",
|
||||
"bookcases",
|
||||
"playgrounds",
|
||||
"drinking_water",
|
||||
"toilets",
|
||||
"vending_machine",
|
||||
"aed",
|
||||
"clock",
|
||||
|
||||
"surveillance",
|
||||
"advertising",
|
||||
"circular_economy",
|
||||
]
|
||||
/**
|
||||
* Upon initialization, the GPS will search the location.
|
||||
|
|
|
|||
|
|
@ -131,6 +131,13 @@ export default class FilteredLayer {
|
|||
return values
|
||||
}
|
||||
|
||||
/**
|
||||
* import Translations from "../UI/i18n/Translations"
|
||||
* import { RegexTag } from "../Logic/Tags/RegexTag"
|
||||
*
|
||||
* const option: FilterConfigOption = {question: Translations.T("question"), osmTags: undefined, originalTagsSpec: "key~.*{search}.*", fields: [{name: "search", type: "string"}] }
|
||||
* FilteredLayer.fieldsToTags(option, {search: "value_regex"}) // => new RegexTag("key", /^(.*(value_regex).*)$/)
|
||||
*/
|
||||
private static fieldsToTags(
|
||||
option: FilterConfigOption,
|
||||
fieldstate: string | Record<string, string>
|
||||
|
|
@ -153,7 +160,7 @@ export default class FilteredLayer {
|
|||
}
|
||||
|
||||
for (const key in properties) {
|
||||
v = (<string>v).replace("{" + key + "}", properties[key])
|
||||
v = (<string>v).replace("{" + key + "}", "(" + properties[key] + ")")
|
||||
}
|
||||
|
||||
return v
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ export default class FilterConfig {
|
|||
}
|
||||
|
||||
const fields: { name: string; type: ValidatorType }[] = (option.fields ?? []).map((f, i) => {
|
||||
const type = <ValidatorType> f.type ?? "string"
|
||||
const type = <ValidatorType> f.type ?? "regex"
|
||||
if(Validators.availableTypes.indexOf(type) < 0){
|
||||
throw `Invalid filter: type is not a valid validator. Did you mean one of ${Utils.sortedByLevenshteinDistance(type, <any>Validators.availableTypes, x => x).slice(0, 3)}`
|
||||
}
|
||||
|
|
@ -70,12 +70,12 @@ export default class FilterConfig {
|
|||
}
|
||||
return {
|
||||
name: f.name,
|
||||
type,
|
||||
type
|
||||
}
|
||||
})
|
||||
|
||||
for (const field of fields) {
|
||||
for (let ln in question.translations) {
|
||||
for (const ln in question.translations) {
|
||||
const txt = question.translations[ln]
|
||||
if (ln.startsWith("_")) {
|
||||
continue
|
||||
|
|
@ -226,7 +226,7 @@ export default class FilterConfig {
|
|||
opt.osmTags?.asHumanString() ?? "",
|
||||
opt.fields?.length > 0
|
||||
? opt.fields.map((f) => f.name + " (" + f.type + ")").join(" ")
|
||||
: undefined,
|
||||
: undefined
|
||||
])
|
||||
)
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue