mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2024-12-29 06:40:25 +01:00
Update mapbox deps, clarify data prop scope
This commit is contained in:
parent
b4292028c2
commit
fa0067ce7b
2 changed files with 11 additions and 17 deletions
|
@ -20,8 +20,8 @@
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"homepage": "https://github.com/maputnik/editor#readme",
|
"homepage": "https://github.com/maputnik/editor#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@mapbox/mapbox-gl-style-spec": "^9.0.0",
|
|
||||||
"@mapbox/mapbox-gl-rtl-text": "^0.1.0",
|
"@mapbox/mapbox-gl-rtl-text": "^0.1.0",
|
||||||
|
"@mapbox/mapbox-gl-style-spec": "^9.0.1",
|
||||||
"classnames": "^2.2.5",
|
"classnames": "^2.2.5",
|
||||||
"codemirror": "^5.18.2",
|
"codemirror": "^5.18.2",
|
||||||
"color": "^1.0.3",
|
"color": "^1.0.3",
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
"lodash.clonedeep": "^4.5.0",
|
"lodash.clonedeep": "^4.5.0",
|
||||||
"lodash.isequal": "^4.4.0",
|
"lodash.isequal": "^4.4.0",
|
||||||
"lodash.throttle": "^4.1.1",
|
"lodash.throttle": "^4.1.1",
|
||||||
"mapbox-gl": "^0.34.0",
|
"mapbox-gl": "^0.40.1",
|
||||||
"mapbox-gl-inspect": "^1.2.3",
|
"mapbox-gl-inspect": "^1.2.3",
|
||||||
"mousetrap": "^1.6.0",
|
"mousetrap": "^1.6.0",
|
||||||
"ol-mapbox-style": "1.0.1",
|
"ol-mapbox-style": "1.0.1",
|
||||||
|
|
|
@ -130,26 +130,20 @@ export default class FunctionSpecProperty extends React.Component {
|
||||||
this.props.onChange(this.props.fieldName, this.props.value)
|
this.props.onChange(this.props.fieldName, this.props.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
getDataInput(value, dataLevel, zoomLevel) {
|
|
||||||
const dataProps = {
|
|
||||||
label: "Data value",
|
|
||||||
value: dataLevel,
|
|
||||||
onChange: newData => this.changeStop(idx, { zoom: zoomLevel, value: newData }, value)
|
|
||||||
}
|
|
||||||
if (this.props.value.type === "categorical") {
|
|
||||||
return <StringInput {...dataProps} />
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return <NumberInput {...dataProps} />
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
renderDataProperty() {
|
renderDataProperty() {
|
||||||
const dataFields = this.props.value.stops.map((stop, idx) => {
|
const dataFields = this.props.value.stops.map((stop, idx) => {
|
||||||
const zoomLevel = stop[0].zoom
|
const zoomLevel = stop[0].zoom
|
||||||
const dataLevel = stop[0].value
|
const dataLevel = stop[0].value
|
||||||
const value = stop[1]
|
const value = stop[1]
|
||||||
const deleteStopBtn = <DeleteStopButton onClick={this.deleteStop.bind(this, idx)} />
|
const deleteStopBtn = <DeleteStopButton onClick={this.deleteStop.bind(this, idx)} />
|
||||||
|
|
||||||
|
const dataProps = {
|
||||||
|
label: "Data value",
|
||||||
|
value: dataLevel,
|
||||||
|
onChange: newData => this.changeStop(idx, { zoom: zoomLevel, value: newData }, value)
|
||||||
|
}
|
||||||
|
const dataInput = this.props.value.type === "categorical" ? <StringInput {...dataProps} /> : <NumberInput {...dataProps} />
|
||||||
|
|
||||||
return <InputBlock key={idx} action={deleteStopBtn}>
|
return <InputBlock key={idx} action={deleteStopBtn}>
|
||||||
<div className="maputnik-data-spec-property-stop-edit">
|
<div className="maputnik-data-spec-property-stop-edit">
|
||||||
<NumberInput
|
<NumberInput
|
||||||
|
@ -160,7 +154,7 @@ export default class FunctionSpecProperty extends React.Component {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="maputnik-data-spec-property-stop-data">
|
<div className="maputnik-data-spec-property-stop-data">
|
||||||
{this.getDataInput(value, dataLevel, zoomLevel)}
|
{dataInput}
|
||||||
</div>
|
</div>
|
||||||
<div className="maputnik-data-spec-property-stop-value">
|
<div className="maputnik-data-spec-property-stop-value">
|
||||||
<SpecField
|
<SpecField
|
||||||
|
|
Loading…
Reference in a new issue