Merge master

This commit is contained in:
Pieter Vander Vennet 2024-09-17 02:51:54 +02:00
commit 8f54ec1093
11 changed files with 112 additions and 87 deletions

View file

@ -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

View file

@ -8,9 +8,6 @@ import { UIEventSource } from "../../Logic/UIEventSource"
import { QueryParameters } from "../../Logic/Web/QueryParameters"
import { Utils } from "../../Utils"
import { RegexTag } from "../../Logic/Tags/RegexTag"
import BaseUIElement from "../../UI/BaseUIElement"
import Table from "../../UI/Base/Table"
import Combine from "../../UI/Base/Combine"
import MarkdownUtils from "../../Utils/MarkdownUtils"
import Validators, { ValidatorType } from "../../UI/InputElement/Validators"
@ -70,12 +67,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
@ -111,7 +108,7 @@ export default class FilterConfig {
question: question,
osmTags: osmTags,
fields,
originalTagsSpec: option.osmTags,
originalTagsSpec: option.osmTags
}
})
@ -223,7 +220,7 @@ export default class FilterConfig {
opt.osmTags?.asHumanString() ?? "",
opt.fields?.length > 0
? opt.fields.map((f) => f.name + " (" + f.type + ")").join(" ")
: undefined,
: undefined
])
)
})