mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-11 15:47:09 -07:00
parent
3beac03c00
commit
54e9f88648
89 changed files with 2354 additions and 995 deletions
|
@ -8,12 +8,23 @@ class NumberInput extends Component {
|
|||
// Listeners
|
||||
|
||||
onChange = ({ name, value }) => {
|
||||
const {
|
||||
min,
|
||||
max
|
||||
} = this.props;
|
||||
|
||||
let newValue = null;
|
||||
|
||||
if (value) {
|
||||
newValue = this.props.isFloat ? parseFloat(value) : parseInt(value);
|
||||
}
|
||||
|
||||
if (min != null && newValue < min) {
|
||||
newValue = min;
|
||||
} else if (max != null && newValue > max) {
|
||||
newValue = max;
|
||||
}
|
||||
|
||||
this.props.onChange({
|
||||
name,
|
||||
value: newValue
|
||||
|
@ -40,6 +51,8 @@ class NumberInput extends Component {
|
|||
|
||||
NumberInput.propTypes = {
|
||||
value: PropTypes.number,
|
||||
min: PropTypes.number,
|
||||
max: PropTypes.number,
|
||||
isFloat: PropTypes.bool.isRequired,
|
||||
onChange: PropTypes.func.isRequired
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue