diff --git a/src/Handle.jsx b/src/Handle.jsx
index fb54e42..8a5449e 100644
--- a/src/Handle.jsx
+++ b/src/Handle.jsx
@@ -23,34 +23,49 @@ export default class Handle extends React.Component {
}
render() {
- const props = this.props;
- const {className, tipTransitionName, tipFormatter, vertical, offset, value} = props;
- const {dragging, noTip} = props;
+ const {
+ prefixCls,
+ className,
+ tipTransitionName,
+ tipFormatter,
+ vertical,
+ offset,
+ value,
+ dragging,
+ noTip,
+ } = this.props;
const style = vertical ? { bottom: offset + '%' } : { left: offset + '%' };
- const handle = (
);
+ const handle = (
+
+ );
if (noTip) {
return handle;
}
const isTooltipVisible = dragging || this.state.isTooltipVisible;
- return (
{tipFormatter(value)}}
- delay={0}
- transitionName={tipTransitionName}>
- {handle}
- );
+ return (
+
{tipFormatter(value)}}
+ delay={0}
+ transitionName={tipTransitionName}
+ >
+ {handle}
+
+ );
}
}
Handle.propTypes = {
+ prefixCls: React.PropTypes.string,
className: React.PropTypes.string,
vertical: React.PropTypes.bool,
offset: React.PropTypes.number,
diff --git a/src/Slider.jsx b/src/Slider.jsx
index 117ff68..4dcf1fb 100644
--- a/src/Slider.jsx
+++ b/src/Slider.jsx
@@ -327,9 +327,26 @@ class Slider extends React.Component {
}
render() {
- const {handle, upperBound, lowerBound} = this.state;
- const {className, prefixCls, disabled, vertical, dots, included, range, step,
- marks, max, min, tipTransitionName, tipFormatter, children} = this.props;
+ const {
+ handle,
+ upperBound,
+ lowerBound,
+ } = this.state;
+ const {
+ className,
+ prefixCls,
+ disabled,
+ vertical,
+ dots,
+ included,
+ range,
+ step,
+ marks,
+ max, min,
+ tipTransitionName,
+ tipFormatter,
+ children,
+ } = this.props;
const customHandle = this.props.handle;
@@ -350,15 +367,31 @@ class Slider extends React.Component {
const isNoTip = (step === null) || (tipFormatter === null);
- const upper = cloneElement(customHandle, { className: upperClassName,
- noTip: isNoTip, tipTransitionName: tipTransitionName, tipFormatter: tipFormatter,
- vertical: vertical, offset: upperOffset, value: upperBound, dragging: handle === 'upperBound' });
+ const commonHandleProps = {
+ prefixCls,
+ noTip: isNoTip,
+ tipTransitionName,
+ tipFormatter,
+ vertical,
+ };
+
+ const upper = cloneElement(customHandle, {
+ ...commonHandleProps,
+ className: upperClassName,
+ value: upperBound,
+ offset: upperOffset,
+ dragging: handle === 'upperBound',
+ });
let lower = null;
if (range) {
- lower = cloneElement(customHandle, { className: lowerClassName,
- noTip: isNoTip, tipTransitionName: tipTransitionName, tipFormatter: tipFormatter,
- vertical: vertical, offset: lowerOffset, value: lowerBound, dragging: handle === 'lowerBound' });
+ lower = cloneElement(customHandle, {
+ ...commonHandleProps,
+ className: lowerClassName,
+ value: lowerBound,
+ offset: lowerOffset,
+ dragging: handle === 'lowerBound',
+ });
}
const sliderClassName = classNames({
@@ -370,18 +403,19 @@ class Slider extends React.Component {
const isIncluded = included || range;
return (
+ onTouchStart={disabled ? noop : this.onTouchStart.bind(this)}
+ onMouseDown={disabled ? noop : this.onMouseDown.bind(this)}
+ >
{upper}
{lower}
+ offset={lowerOffset} length={upperOffset - lowerOffset} />
+ included={isIncluded} lowerBound={lowerBound}
+ upperBound={upperBound} max={max} min={min} />
+ included={isIncluded} lowerBound={lowerBound}
+ upperBound={upperBound} max={max} min={min} />
{children}
);