-
-
Notifications
You must be signed in to change notification settings - Fork 112
/
Copy pathNumeric.js
51 lines (47 loc) · 1.41 KB
/
Numeric.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import Field from './Field';
import NumericInput from '../widgets/NumericInput';
import PropTypes from 'prop-types';
import React, {Component} from 'react';
import {connectToContainer} from 'lib';
export class UnconnectedNumeric extends Component {
render() {
let fullValue = this.props.fullValue;
let placeholder;
if (this.props.multiValued) {
placeholder = fullValue;
fullValue = '';
}
return (
<Field {...this.props} noDefaultIndicator={this.props.noDefaultIndicator}>
<NumericInput
value={fullValue}
defaultValue={this.props.defaultValue}
placeholder={placeholder}
step={this.props.step}
stepmode={this.props.stepmode}
min={this.props.min}
max={this.props.max}
onChange={this.props.updatePlot}
onUpdate={this.props.updatePlot}
showArrows={!this.props.hideArrows}
showSlider={this.props.showSlider}
/>
</Field>
);
}
}
UnconnectedNumeric.propTypes = {
defaultValue: PropTypes.any,
fullValue: PropTypes.any,
min: PropTypes.number,
max: PropTypes.number,
multiValued: PropTypes.bool,
hideArrows: PropTypes.bool,
showSlider: PropTypes.bool,
step: PropTypes.number,
stepmode: PropTypes.string,
updatePlot: PropTypes.func,
noDefaultIndicator: PropTypes.bool,
...Field.propTypes,
};
export default connectToContainer(UnconnectedNumeric);