mirror of
https://github.com/maputnik/editor.git
synced 2026-08-27 07:27:33 +00:00
Deal specially with has operator #84
This commit is contained in:
@@ -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>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user