Browse Source

CategoryOverpassFilter: replace 'defaultQuery' by 'emptyQuery'

master
parent
commit
7b7aad625b
  1. 2
      doc/Filters.md
  2. 11
      src/CategoryOverpassFilter.js

2
doc/Filters.md

@ -37,7 +37,7 @@ Each filter can define the following values:
* 'strsearch' query string parts (e.g. "kai keb" would match "Kaiser Kebap") and query character variants (e.g. "cafe" would match "café").
* show_default: if true, this filter will be shown by default, others need to be added via the select box.
* placeholder: a text which is shown as placeholder (Twig enabled)
* defaultQuery: A filter query which is added when no value is selected.
* emptyQuery: A Overpass filter query which is added, when no value is selected.
### Values
#### Array

11
src/CategoryOverpassFilter.js

@ -169,7 +169,7 @@ class CategoryOverpassFilter {
let d = this.data[k]
if (values === null) {
return null
return d.emptyQuery
}
if (!Array.isArray(values)) {
@ -233,15 +233,6 @@ class CategoryOverpassFilter {
}
}).filter(f => f) // remove null values
const defaultQueries = Object.keys(this.data)
.map(k => {
if (!param[k]) {
return this.data[k].defaultQuery
}
})
.filter(f => f)
this.additionalFilter = this.additionalFilter.concat(defaultQueries)
if (this.additionalFilter.length === 0) {
this.additionalFilter = []
} else if (this.additionalFilter.length === 1) {

Loading…
Cancel
Save