Improvements to wikidata element

This commit is contained in:
Pieter Vander Vennet 2024-02-28 02:13:56 +01:00
parent 6897b88817
commit b795273974
3 changed files with 4 additions and 6 deletions

View file

@ -69,11 +69,10 @@ export default class InputHelpers {
) {
const inputHelperOptions = props
const args = inputHelperOptions.args ?? []
const searchKey = <string>args[0] ?? "name"
const searchKey: string = <string>args[0] ?? "name"
const searchFor = <string>(
(inputHelperOptions.feature?.properties[searchKey]?.toLowerCase() ?? "")
)
const searchFor: string = searchKey.split(";").map(k => inputHelperOptions.feature?.properties[k]?.toLowerCase())
.find(foundValue => !!foundValue) ?? ""
let searchForValue: UIEventSource<string> = new UIEventSource(searchFor)
const options: any = args[1]

View file

@ -76,6 +76,5 @@
{value}
{state}
on:submit
{unvalidatedText}
/>
</div>

View file

@ -20,7 +20,7 @@ export default class WikidataSearchBox extends InputElement<string> {
new Table(
["name", "doc"],
[
["key", "the value of this tag will initialize search (default: name)"],
["key", "the value of this tag will initialize search (default: name). This can be a ';'-separated list in which case every key will be inspected. The non-null value will be used as search"],
[
"options",
new Combine([