mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2024-12-28 17:51:16 +01:00
Merge pull request #531 from orangemug/fix/issue-509
Ability to delete properties completely
This commit is contained in:
commit
ff0ece5149
7 changed files with 829 additions and 2187 deletions
2976
package-lock.json
generated
2976
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -35,7 +35,7 @@
|
|||
"lodash.get": "^4.4.2",
|
||||
"lodash.isequal": "^4.5.0",
|
||||
"lodash.throttle": "^4.1.1",
|
||||
"mapbox-gl": "^0.53.1",
|
||||
"mapbox-gl": "^1.1.0-beta.1",
|
||||
"mapbox-gl-inspect": "^1.3.1",
|
||||
"maputnik-design": "github:maputnik/design",
|
||||
"ol": "^6.0.0-beta.8",
|
||||
|
|
|
@ -57,6 +57,10 @@ class ColorField extends React.Component {
|
|||
}
|
||||
}
|
||||
|
||||
onChange (v) {
|
||||
this.props.onChange(v === "" ? undefined : v);
|
||||
}
|
||||
|
||||
render() {
|
||||
const offset = this.calcPickerOffset()
|
||||
var currentColor = this.color.object()
|
||||
|
@ -110,7 +114,7 @@ class ColorField extends React.Component {
|
|||
name={this.props.name}
|
||||
placeholder={this.props.default}
|
||||
value={this.props.value ? this.props.value : ""}
|
||||
onChange={(e) => this.props.onChange(e.target.value)}
|
||||
onChange={(e) => this.onChange(e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
|
|
|
@ -44,6 +44,10 @@ class AutocompleteInput extends React.Component {
|
|||
this.calcMaxHeight();
|
||||
}
|
||||
|
||||
onChange (v) {
|
||||
this.props.onChange(v === "" ? undefined : v);
|
||||
}
|
||||
|
||||
render() {
|
||||
return <div
|
||||
ref={(el) => {
|
||||
|
@ -68,8 +72,8 @@ class AutocompleteInput extends React.Component {
|
|||
value={this.props.value}
|
||||
items={this.props.options}
|
||||
getItemValue={(item) => item[0]}
|
||||
onSelect={v => this.props.onChange(v)}
|
||||
onChange={(e, v) => this.props.onChange(v)}
|
||||
onSelect={v => this.onChange(v)}
|
||||
onChange={(e, v) => this.onChange(v)}
|
||||
shouldItemRender={(item, value="") => {
|
||||
if (typeof(value) === "string") {
|
||||
return item[0].toLowerCase().indexOf(value.toLowerCase()) > -1
|
||||
|
|
|
@ -16,13 +16,25 @@ class FontInput extends React.Component {
|
|||
}
|
||||
|
||||
get values() {
|
||||
return this.props.value || this.props.default.slice(1) || []
|
||||
const out = this.props.value || this.props.default.slice(1) || [""];
|
||||
|
||||
// Always put a "" in the last field to you can keep adding entries
|
||||
if (out[out.length-1] !== ""){
|
||||
return out.concat("");
|
||||
}
|
||||
else {
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
||||
changeFont(idx, newValue) {
|
||||
const changedValues = this.values.slice(0)
|
||||
changedValues[idx] = newValue
|
||||
this.props.onChange(changedValues)
|
||||
const filteredValues = changedValues
|
||||
.filter(v => v !== undefined)
|
||||
.filter(v => v !== "")
|
||||
|
||||
this.props.onChange(filteredValues);
|
||||
}
|
||||
|
||||
render() {
|
||||
|
|
|
@ -20,7 +20,7 @@ class InputBlock extends React.Component {
|
|||
|
||||
onChange(e) {
|
||||
const value = e.target.value
|
||||
return this.props.onChange(value === "" ? null: value)
|
||||
return this.props.onChange(value === "" ? undefined : value)
|
||||
}
|
||||
|
||||
render() {
|
||||
|
|
|
@ -31,7 +31,11 @@ export function changeProperty(layer, group, property, newValue) {
|
|||
if(newValue === undefined) {
|
||||
if(group) {
|
||||
const newLayer = {
|
||||
...layer
|
||||
...layer,
|
||||
// Change object so the diff works in ./src/components/map/MapboxGlMap.jsx
|
||||
[group]: {
|
||||
...layer[group]
|
||||
}
|
||||
};
|
||||
delete newLayer[group][property];
|
||||
|
||||
|
|
Loading…
Reference in a new issue