forked from MapComplete/MapComplete
Improvements to wikidata element
This commit is contained in:
parent
6897b88817
commit
b795273974
3 changed files with 4 additions and 6 deletions
|
|
@ -69,11 +69,10 @@ export default class InputHelpers {
|
||||||
) {
|
) {
|
||||||
const inputHelperOptions = props
|
const inputHelperOptions = props
|
||||||
const args = inputHelperOptions.args ?? []
|
const args = inputHelperOptions.args ?? []
|
||||||
const searchKey = <string>args[0] ?? "name"
|
const searchKey: string = <string>args[0] ?? "name"
|
||||||
|
|
||||||
const searchFor = <string>(
|
const searchFor: string = searchKey.split(";").map(k => inputHelperOptions.feature?.properties[k]?.toLowerCase())
|
||||||
(inputHelperOptions.feature?.properties[searchKey]?.toLowerCase() ?? "")
|
.find(foundValue => !!foundValue) ?? ""
|
||||||
)
|
|
||||||
|
|
||||||
let searchForValue: UIEventSource<string> = new UIEventSource(searchFor)
|
let searchForValue: UIEventSource<string> = new UIEventSource(searchFor)
|
||||||
const options: any = args[1]
|
const options: any = args[1]
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,5 @@
|
||||||
{value}
|
{value}
|
||||||
{state}
|
{state}
|
||||||
on:submit
|
on:submit
|
||||||
{unvalidatedText}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ export default class WikidataSearchBox extends InputElement<string> {
|
||||||
new Table(
|
new Table(
|
||||||
["name", "doc"],
|
["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",
|
"options",
|
||||||
new Combine([
|
new Combine([
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue