mirror of
https://github.com/wassname/slider.git
synced 2026-09-10 12:38:09 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
926d5aeb91 | ||
|
|
b2ae1bc0fc | ||
|
|
80d4ee4794 | ||
|
|
e2504d99fe | ||
|
|
d4ae5a5298 | ||
|
|
ce755ecb4b | ||
|
|
9bc56e993d |
+4
-1
@@ -28,8 +28,11 @@ const CustomizedSlider = React.createClass({
|
||||
value: value,
|
||||
});
|
||||
},
|
||||
onAfterChange: function(value) {
|
||||
console.log(value);
|
||||
},
|
||||
render: function() {
|
||||
return <Slider value={this.state.value} onChange={this.onSliderChange} />;
|
||||
return <Slider value={this.state.value} onChange={this.onSliderChange} onAfterChange={this.onAfterChange} />;
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
+8
-8
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "rc-slider",
|
||||
"version": "3.7.2",
|
||||
"version": "3.8.0",
|
||||
"description": "slider ui component for react",
|
||||
"keywords": [
|
||||
"react",
|
||||
@@ -42,17 +42,17 @@
|
||||
"pre-commit": "1.x",
|
||||
"rc-server": "3.x",
|
||||
"rc-tools": "4.x",
|
||||
"react": "~0.14.0",
|
||||
"react-addons-test-utils": "^0.14.0",
|
||||
"react-dom": "~0.14.0"
|
||||
"react": "^15.2.1",
|
||||
"react-addons-test-utils": "^15.2.1",
|
||||
"react-dom": "^15.2.1"
|
||||
},
|
||||
"pre-commit": [
|
||||
"lint"
|
||||
],
|
||||
"dependencies": {
|
||||
"classnames": "^2.2.1",
|
||||
"rc-tooltip": "3.x",
|
||||
"rc-util": "3.x",
|
||||
"warning": "^2.1.0"
|
||||
"classnames": "^2.2.5",
|
||||
"rc-tooltip": "^3.4.2",
|
||||
"rc-util": "^3.2.1",
|
||||
"warning": "^3.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
+14
-3
@@ -270,7 +270,7 @@ class Slider extends React.Component {
|
||||
|
||||
const points = Object.keys(marks).map(parseFloat);
|
||||
if (step !== null) {
|
||||
const closestStep = Math.round(val / step) * step;
|
||||
const closestStep = (Math.round((val - min) / step) * step) + min;
|
||||
points.push(closestStep);
|
||||
}
|
||||
|
||||
@@ -337,15 +337,26 @@ class Slider extends React.Component {
|
||||
const lowerOffset = this.calcOffset(lowerBound);
|
||||
|
||||
const handleClassName = prefixCls + '-handle';
|
||||
|
||||
const upperClassName = classNames({
|
||||
[handleClassName]: true,
|
||||
[handleClassName + '-upper']: true,
|
||||
});
|
||||
|
||||
const lowerClassName = classNames({
|
||||
[handleClassName]: true,
|
||||
[handleClassName + '-lower']: true,
|
||||
});
|
||||
|
||||
const isNoTip = (step === null) || (tipFormatter === null);
|
||||
|
||||
const upper = cloneElement(customHandle, { className: handleClassName,
|
||||
const upper = cloneElement(customHandle, { className: upperClassName,
|
||||
noTip: isNoTip, tipTransitionName: tipTransitionName, tipFormatter: tipFormatter,
|
||||
vertical: vertical, offset: upperOffset, value: upperBound, dragging: handle === 'upperBound' });
|
||||
|
||||
let lower = null;
|
||||
if (range) {
|
||||
lower = cloneElement(customHandle, { className: handleClassName,
|
||||
lower = cloneElement(customHandle, { className: lowerClassName,
|
||||
noTip: isNoTip, tipTransitionName: tipTransitionName, tipFormatter: tipFormatter,
|
||||
vertical: vertical, offset: lowerOffset, value: lowerBound, dragging: handle === 'lowerBound' });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user