mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2025-01-30 23:55:32 +01:00
Allow removal of properties.
This commit is contained in:
parent
c3c0c35d8a
commit
2ec6a90dc3
3 changed files with 12 additions and 4 deletions
|
@ -44,6 +44,10 @@ class AutocompleteInput extends React.Component {
|
||||||
this.calcMaxHeight();
|
this.calcMaxHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onChange (v) {
|
||||||
|
this.props.onChange(v === "" ? undefined : v);
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return <div
|
return <div
|
||||||
ref={(el) => {
|
ref={(el) => {
|
||||||
|
@ -68,8 +72,8 @@ class AutocompleteInput extends React.Component {
|
||||||
value={this.props.value}
|
value={this.props.value}
|
||||||
items={this.props.options}
|
items={this.props.options}
|
||||||
getItemValue={(item) => item[0]}
|
getItemValue={(item) => item[0]}
|
||||||
onSelect={v => this.props.onChange(v)}
|
onSelect={v => this.onChange(v)}
|
||||||
onChange={(e, v) => this.props.onChange(v)}
|
onChange={(e, v) => this.onChange(v)}
|
||||||
shouldItemRender={(item, value="") => {
|
shouldItemRender={(item, value="") => {
|
||||||
if (typeof(value) === "string") {
|
if (typeof(value) === "string") {
|
||||||
return item[0].toLowerCase().indexOf(value.toLowerCase()) > -1
|
return item[0].toLowerCase().indexOf(value.toLowerCase()) > -1
|
||||||
|
|
|
@ -20,7 +20,7 @@ class InputBlock extends React.Component {
|
||||||
|
|
||||||
onChange(e) {
|
onChange(e) {
|
||||||
const value = e.target.value
|
const value = e.target.value
|
||||||
return this.props.onChange(value === "" ? null: value)
|
return this.props.onChange(value === "" ? undefined : value)
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
|
@ -31,7 +31,11 @@ export function changeProperty(layer, group, property, newValue) {
|
||||||
if(newValue === undefined) {
|
if(newValue === undefined) {
|
||||||
if(group) {
|
if(group) {
|
||||||
const newLayer = {
|
const newLayer = {
|
||||||
...layer
|
...layer,
|
||||||
|
// Change object so the diff works in ./src/components/map/MapboxGlMap.jsx
|
||||||
|
[group]: {
|
||||||
|
...layer[group]
|
||||||
|
}
|
||||||
};
|
};
|
||||||
delete newLayer[group][property];
|
delete newLayer[group][property];
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue