mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2024-12-29 07:30:32 +01:00
Moved data-wd-key onto element
This commit is contained in:
parent
41329ec2f8
commit
911549aca3
3 changed files with 14 additions and 6 deletions
|
@ -10,6 +10,7 @@ class NumberInput extends React.Component {
|
||||||
onChange: PropTypes.func,
|
onChange: PropTypes.func,
|
||||||
allowRange: PropTypes.bool,
|
allowRange: PropTypes.bool,
|
||||||
rangeStep: PropTypes.number,
|
rangeStep: PropTypes.number,
|
||||||
|
wdKey: PropTypes.string,
|
||||||
}
|
}
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
|
@ -107,6 +108,13 @@ class NumberInput extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
let wdProps = {};
|
||||||
|
if (this.props.wdKey) {
|
||||||
|
wdProps = {
|
||||||
|
"data-wd-key": this.props.wdKey
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
if(
|
if(
|
||||||
this.props.hasOwnProperty("min") && this.props.hasOwnProperty("max") &&
|
this.props.hasOwnProperty("min") && this.props.hasOwnProperty("max") &&
|
||||||
this.props.min !== undefined && this.props.max !== undefined &&
|
this.props.min !== undefined && this.props.max !== undefined &&
|
||||||
|
@ -146,6 +154,7 @@ class NumberInput extends React.Component {
|
||||||
this.changeValue(e.target.value)
|
this.changeValue(e.target.value)
|
||||||
}}
|
}}
|
||||||
onBlur={this.resetValue}
|
onBlur={this.resetValue}
|
||||||
|
{...wdProps}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
@ -159,6 +168,7 @@ class NumberInput extends React.Component {
|
||||||
value={this.state.value}
|
value={this.state.value}
|
||||||
onChange={e => this.changeValue(e.target.value)}
|
onChange={e => this.changeValue(e.target.value)}
|
||||||
onBlur={this.resetValue}
|
onBlur={this.resetValue}
|
||||||
|
{...wdProps}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,10 +12,9 @@ class MaxZoomBlock extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return <InputBlock label={"Max Zoom"} doc={latest.layer.maxzoom.doc}
|
return <InputBlock label={"Max Zoom"} doc={latest.layer.maxzoom.doc}>
|
||||||
data-wd-key="max-zoom"
|
|
||||||
>
|
|
||||||
<NumberInput
|
<NumberInput
|
||||||
|
wdKey="max-zoom"
|
||||||
allowRange={true}
|
allowRange={true}
|
||||||
value={this.props.value}
|
value={this.props.value}
|
||||||
onChange={this.props.onChange}
|
onChange={this.props.onChange}
|
||||||
|
|
|
@ -12,10 +12,9 @@ class MinZoomBlock extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return <InputBlock label={"Min Zoom"} doc={latest.layer.minzoom.doc}
|
return <InputBlock label={"Min Zoom"} doc={latest.layer.minzoom.doc}>
|
||||||
data-wd-key="min-zoom"
|
|
||||||
>
|
|
||||||
<NumberInput
|
<NumberInput
|
||||||
|
wdKey="min-zoom"
|
||||||
allowRange={true}
|
allowRange={true}
|
||||||
value={this.props.value}
|
value={this.props.value}
|
||||||
onChange={this.props.onChange}
|
onChange={this.props.onChange}
|
||||||
|
|
Loading…
Reference in a new issue