mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2025-01-30 23:25:29 +01:00
rangeValue -> dirtyValue
This commit is contained in:
parent
655877f67e
commit
2ccd1d227e
1 changed files with 7 additions and 5 deletions
|
@ -139,8 +139,8 @@ class NumberInput extends React.Component {
|
||||||
this.props.min !== undefined && this.props.max !== undefined &&
|
this.props.min !== undefined && this.props.max !== undefined &&
|
||||||
this.props.allowRange
|
this.props.allowRange
|
||||||
) {
|
) {
|
||||||
const value = this.state.value === undefined ? this.props.default : this.state.value;
|
const dirtyValue = this.state.dirtyValue === undefined ? this.props.default : this.state.dirtyValue
|
||||||
const rangeValue = Number.isNaN(parseFloat(value, 10)) ? this.props.default : value;
|
const value = this.state.value === undefined ? "" : this.state.value;
|
||||||
|
|
||||||
return <div className="maputnik-number-container">
|
return <div className="maputnik-number-container">
|
||||||
<input
|
<input
|
||||||
|
@ -151,7 +151,7 @@ class NumberInput extends React.Component {
|
||||||
min={this.props.min}
|
min={this.props.min}
|
||||||
step="any"
|
step="any"
|
||||||
spellCheck="false"
|
spellCheck="false"
|
||||||
value={rangeValue}
|
value={dirtyValue}
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
onChange={this.onChangeRange}
|
onChange={this.onChangeRange}
|
||||||
onKeyDown={() => {
|
onKeyDown={() => {
|
||||||
|
@ -167,7 +167,7 @@ class NumberInput extends React.Component {
|
||||||
spellCheck="false"
|
spellCheck="false"
|
||||||
className="maputnik-number"
|
className="maputnik-number"
|
||||||
placeholder={this.props.default}
|
placeholder={this.props.default}
|
||||||
value={this.state.value === undefined ? "" : this.state.value}
|
value={value}
|
||||||
onChange={e => {
|
onChange={e => {
|
||||||
if (!this.state.editing) {
|
if (!this.state.editing) {
|
||||||
this.changeValue(e.target.value);
|
this.changeValue(e.target.value);
|
||||||
|
@ -178,11 +178,13 @@ class NumberInput extends React.Component {
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
const value = this.state.value === undefined ? "" : this.state.value;
|
||||||
|
|
||||||
return <input
|
return <input
|
||||||
spellCheck="false"
|
spellCheck="false"
|
||||||
className="maputnik-number"
|
className="maputnik-number"
|
||||||
placeholder={this.props.default}
|
placeholder={this.props.default}
|
||||||
value={this.state.value === undefined ? "" : this.state.value}
|
value={value}
|
||||||
onChange={e => this.changeValue(e.target.value)}
|
onChange={e => this.changeValue(e.target.value)}
|
||||||
onBlur={this.resetValue}
|
onBlur={this.resetValue}
|
||||||
required={this.props.required}
|
required={this.props.required}
|
||||||
|
|
Loading…
Reference in a new issue