mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2025-01-15 08:51:19 +01:00
Add filter item
This commit is contained in:
parent
5bb68a38c2
commit
ed9b806143
1 changed files with 13 additions and 0 deletions
|
@ -35,6 +35,7 @@ class CombiningOperatorSelect extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
value: React.PropTypes.string.isRequired,
|
value: React.PropTypes.string.isRequired,
|
||||||
onChange: React.PropTypes.func.isRequired,
|
onChange: React.PropTypes.func.isRequired,
|
||||||
|
style: React.PropTypes.object,
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
@ -46,6 +47,7 @@ class CombiningOperatorSelect extends React.Component {
|
||||||
style={{
|
style={{
|
||||||
marginTop: margins[1],
|
marginTop: margins[1],
|
||||||
marginBottom: margins[1],
|
marginBottom: margins[1],
|
||||||
|
...this.props.style
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<select
|
<select
|
||||||
|
@ -176,6 +178,12 @@ export default class CombiningFilterEditor extends React.Component {
|
||||||
this.props.onChange(newFilter)
|
this.props.onChange(newFilter)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addFilterItem() {
|
||||||
|
const newFilterItem = this.combiningFilter().slice(0)
|
||||||
|
newFilterItem.push(['==', 'name', ''])
|
||||||
|
this.props.onChange(newFilterItem)
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const filter = this.combiningFilter()
|
const filter = this.combiningFilter()
|
||||||
let combiningOp = filter[0]
|
let combiningOp = filter[0]
|
||||||
|
@ -211,7 +219,12 @@ export default class CombiningFilterEditor extends React.Component {
|
||||||
<CombiningOperatorSelect
|
<CombiningOperatorSelect
|
||||||
value={combiningOp}
|
value={combiningOp}
|
||||||
onChange={this.onFilterPartChanged.bind(this, 0)}
|
onChange={this.onFilterPartChanged.bind(this, 0)}
|
||||||
|
style={{
|
||||||
|
display: 'inline-block',
|
||||||
|
width: '80%'
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
|
<Button onClick={this.addFilterItem.bind(this)}>Add filter</Button>
|
||||||
{filterEditors}
|
{filterEditors}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue