mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2024-12-29 11:10:27 +01:00
Deal specially with has operator #84
This commit is contained in:
parent
a111599850
commit
a1e1895651
1 changed files with 9 additions and 1 deletions
|
@ -17,7 +17,13 @@ class SingleFilterEditor extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
onFilterPartChanged(filterOp, propertyName, filterArgs) {
|
onFilterPartChanged(filterOp, propertyName, filterArgs) {
|
||||||
const newFilter = [filterOp, propertyName, ...filterArgs]
|
let newFilter = [filterOp, propertyName, ...filterArgs]
|
||||||
|
console.log('filter changed', filterOp, propertyName, filterArgs)
|
||||||
|
if(filterOp === 'has' || filterOp === '!has') {
|
||||||
|
newFilter = [filterOp, propertyName]
|
||||||
|
} else if(filterArgs.length === 0) {
|
||||||
|
newFilter = [filterOp, propertyName, '']
|
||||||
|
}
|
||||||
this.props.onChange(newFilter)
|
this.props.onChange(newFilter)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,12 +48,14 @@ class SingleFilterEditor extends React.Component {
|
||||||
options={otherFilterOps}
|
options={otherFilterOps}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
{filterArgs.length > 0 &&
|
||||||
<div className="maputnik-filter-editor-args">
|
<div className="maputnik-filter-editor-args">
|
||||||
<StringInput
|
<StringInput
|
||||||
value={filterArgs.join(',')}
|
value={filterArgs.join(',')}
|
||||||
onChange={ v=> this.onFilterPartChanged(filterOp, propertyName, v.split(','))}
|
onChange={ v=> this.onFilterPartChanged(filterOp, propertyName, v.split(','))}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue