Update mapbox deps, clarify data prop scope

This commit is contained in:
pjsier 2017-10-11 08:01:55 -05:00
parent b4292028c2
commit fa0067ce7b
2 changed files with 11 additions and 17 deletions

View file

@ -20,8 +20,8 @@
"license": "MIT",
"homepage": "https://github.com/maputnik/editor#readme",
"dependencies": {
"@mapbox/mapbox-gl-style-spec": "^9.0.0",
"@mapbox/mapbox-gl-rtl-text": "^0.1.0",
"@mapbox/mapbox-gl-style-spec": "^9.0.1",
"classnames": "^2.2.5",
"codemirror": "^5.18.2",
"color": "^1.0.3",
@ -32,7 +32,7 @@
"lodash.clonedeep": "^4.5.0",
"lodash.isequal": "^4.4.0",
"lodash.throttle": "^4.1.1",
"mapbox-gl": "^0.34.0",
"mapbox-gl": "^0.40.1",
"mapbox-gl-inspect": "^1.2.3",
"mousetrap": "^1.6.0",
"ol-mapbox-style": "1.0.1",

View file

@ -130,26 +130,20 @@ export default class FunctionSpecProperty extends React.Component {
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() {
const dataFields = this.props.value.stops.map((stop, idx) => {
const zoomLevel = stop[0].zoom
const dataLevel = stop[0].value
const value = stop[1]
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}>
<div className="maputnik-data-spec-property-stop-edit">
<NumberInput
@ -160,7 +154,7 @@ export default class FunctionSpecProperty extends React.Component {
/>
</div>
<div className="maputnik-data-spec-property-stop-data">
{this.getDataInput(value, dataLevel, zoomLevel)}
{dataInput}
</div>
<div className="maputnik-data-spec-property-stop-value">
<SpecField