react-range-slider
Advanced tools
Comparing version 0.0.8 to 0.0.9
48
index.js
@@ -218,15 +218,4 @@ var React = require('react/addons'); | ||
getInitialState: function () { | ||
var range = this.props.range, | ||
range = (range ? (typeof range === 'boolean' ? [range, range] : range) : []), | ||
header = range[0], | ||
tailer = range[1], | ||
min = this.props.min, | ||
max = this.props.max, | ||
min = typeof header === 'number' ? Math.max(header, min) : min, | ||
max = typeof tailer === 'number' ? Math.min(Math.max(tailer, min), max) : max; | ||
this.componentWillReceiveProps(this.props) | ||
return { | ||
min: min, | ||
max: max, | ||
header: header, | ||
tailer: tailer, | ||
index: -1, // TODO: find better solution | ||
@@ -238,3 +227,3 @@ clicked: -1, | ||
maxProp: this.isHorizontal() ? 'right' : 'bottom', | ||
value: valueFormat(this.props.value, max, min) | ||
value: [] | ||
}; | ||
@@ -252,12 +241,22 @@ }, | ||
componentWillReceiveProps: function (nextProps) { | ||
if (nextProps.value) { | ||
this.setState({ | ||
value: valueFormat(nextProps.value, this.props.max, this.props.min) | ||
}, function () { | ||
// Calculate the bound size again, if the bound size less than 0 | ||
if (this.state.upperBound <= 0) { | ||
this.handleResize(); | ||
} | ||
}.bind(this)); | ||
} | ||
var range = nextProps.range || this.props.range, | ||
range = (range ? (typeof range === 'boolean' ? [range, range] : range) : []), | ||
header = range[0], | ||
tailer = range[1], | ||
min = nextProps.min || this.props.min, | ||
max = nextProps.max || this.props.max, | ||
min = typeof header === 'number' ? Math.max(header, min) : min, | ||
max = typeof tailer === 'number' ? Math.min(Math.max(tailer, min), max) : max; | ||
this.setState({ | ||
min: min, | ||
max: max, | ||
header: header, | ||
tailer: tailer, | ||
value: valueFormat(nextProps.value || this.props.value, max, min) | ||
}, function () { | ||
// Calculate the bound size again, if the bound size less than 0 | ||
if (this.state.upperBound <= 0) { | ||
this.handleResize(); | ||
} | ||
}.bind(this)); | ||
}, | ||
@@ -344,3 +343,3 @@ | ||
// var v = value[i - 1].value; | ||
var min = (value[i - 2] ? value[i- 2].value : this.state.min); | ||
var min = (value[i - 2] ? value[i - 2].value : this.state.min); | ||
var max = value[i] ? value[i].value : this.state.max; | ||
@@ -428,2 +427,3 @@ value[i - 1].value = parseInt(Math.max(Math.min(_v, max), min), 10); | ||
calcOffset: function (v) { | ||
if(typeof v === 'undefined') return; | ||
v = typeof v === 'number' ? v : v.value; | ||
@@ -430,0 +430,0 @@ var ratio = (v - this.props.min) / (this.props.max - this.props.min); |
{ | ||
"name": "react-range-slider", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "A flexible slider for reactjs.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22933