rc-slider
Advanced tools
Comparing version 8.6.0 to 8.6.1
@@ -91,7 +91,2 @@ import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties'; | ||
_this.onMouseUp = function () { | ||
_this.onEnd(); | ||
_this.removeDocumentEvents(); | ||
}; | ||
_this.onMouseMove = function (e) { | ||
@@ -260,3 +255,2 @@ if (!_this.sliderRef) { | ||
onMouseDown: disabled ? noop : this.onMouseDown, | ||
onMouseUp: disabled ? noop : this.onMouseUp, | ||
onKeyDown: disabled ? noop : this.onKeyDown, | ||
@@ -263,0 +257,0 @@ onFocus: disabled ? noop : this.onFocus, |
@@ -29,3 +29,3 @@ import _extends from 'babel-runtime/helpers/extends'; | ||
var markLabel = markPointIsObject ? markPoint.label : markPoint; | ||
if (!markLabel) { | ||
if (!markLabel && markLabel !== 0) { | ||
return null; | ||
@@ -32,0 +32,0 @@ } |
@@ -22,8 +22,6 @@ import _extends from 'babel-runtime/helpers/extends'; | ||
var elStyle = _extends({ | ||
visibility: included ? 'visible' : 'hidden' | ||
}, style, positonStyle); | ||
return React.createElement('div', { className: className, style: elStyle }); | ||
var elStyle = _extends({}, style, positonStyle); | ||
return included ? React.createElement('div', { className: className, style: elStyle }) : null; | ||
}; | ||
export default Track; |
@@ -50,3 +50,5 @@ import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties'; | ||
placement = _tipProps$placement === undefined ? 'top' : _tipProps$placement, | ||
restTooltipProps = _objectWithoutProperties(tipProps, ['prefixCls', 'overlay', 'placement']); | ||
_tipProps$visible = tipProps.visible, | ||
visible = _tipProps$visible === undefined ? visible || false : _tipProps$visible, | ||
restTooltipProps = _objectWithoutProperties(tipProps, ['prefixCls', 'overlay', 'placement', 'visible']); | ||
@@ -59,3 +61,3 @@ return React.createElement( | ||
placement: placement, | ||
visible: !disabled && (_this.state.visibles[index] || dragging), | ||
visible: !disabled && (_this.state.visibles[index] || dragging) || visible, | ||
key: index | ||
@@ -62,0 +64,0 @@ }), |
@@ -38,4 +38,4 @@ import _extends from 'babel-runtime/helpers/extends'; | ||
var value = props.value !== undefined ? props.value : defaultValue; | ||
var bounds = value.map(function (v) { | ||
return _this.trimAlignValue(v); | ||
var bounds = value.map(function (v, i) { | ||
return _this.trimAlignValue(v, i); | ||
}); | ||
@@ -59,7 +59,8 @@ var recent = bounds[0] === max ? 0 : bounds.length - 1; | ||
} | ||
var bounds = this.state.bounds; | ||
var value = nextProps.value || bounds; | ||
var nextBounds = value.map(function (v) { | ||
return _this2.trimAlignValue(v, nextProps); | ||
var nextBounds = value.map(function (v, i) { | ||
return _this2.trimAlignValue(v, i, nextProps); | ||
}); | ||
@@ -131,4 +132,3 @@ if (nextBounds.length === bounds.length && nextBounds.every(function (v, i) { | ||
if (props.pushable !== false) { | ||
var originalValue = state.bounds[nextHandle]; | ||
this.pushSurroundingHandles(nextBounds, nextHandle, originalValue); | ||
this.pushSurroundingHandles(nextBounds, nextHandle); | ||
} else if (props.allowCross) { | ||
@@ -227,6 +227,7 @@ nextBounds.sort(function (a, b) { | ||
Range.prototype.pushSurroundingHandles = function pushSurroundingHandles(bounds, handle, originalValue) { | ||
Range.prototype.pushSurroundingHandles = function pushSurroundingHandles(bounds, handle) { | ||
var value = bounds[handle]; | ||
var threshold = this.props.pushable; | ||
var value = bounds[handle]; | ||
threshold = Number(threshold); | ||
@@ -249,3 +250,3 @@ var direction = 0; | ||
// revert to original value if pushing is impossible | ||
bounds[handle] = originalValue; | ||
bounds[handle] = bounds[nextHandle] - direction * threshold; | ||
} | ||
@@ -292,25 +293,27 @@ }; | ||
Range.prototype.trimAlignValue = function trimAlignValue(v) { | ||
var nextProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
Range.prototype.trimAlignValue = function trimAlignValue(v, handle) { | ||
var nextProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
var mergedProps = _extends({}, this.props, nextProps); | ||
var valInRange = utils.ensureValueInRange(v, mergedProps); | ||
var valNotConflict = this.ensureValueNotConflict(valInRange, mergedProps); | ||
var valNotConflict = this.ensureValueNotConflict(handle, valInRange, mergedProps); | ||
return utils.ensureValuePrecision(valNotConflict, mergedProps); | ||
}; | ||
Range.prototype.ensureValueNotConflict = function ensureValueNotConflict(val, _ref) { | ||
var allowCross = _ref.allowCross; | ||
Range.prototype.ensureValueNotConflict = function ensureValueNotConflict(handle, val, _ref) { | ||
var allowCross = _ref.allowCross, | ||
thershold = _ref.pushable; | ||
var state = this.state || {}; | ||
var handle = state.handle, | ||
bounds = state.bounds; | ||
var bounds = state.bounds; | ||
handle = handle === undefined ? state.handle : handle; | ||
thershold = Number(thershold); | ||
/* eslint-disable eqeqeq */ | ||
if (!allowCross && handle != null) { | ||
if (handle > 0 && val <= bounds[handle - 1]) { | ||
return bounds[handle - 1]; | ||
if (!allowCross && handle != null && bounds !== undefined) { | ||
if (handle > 0 && val <= bounds[handle - 1] + thershold) { | ||
return bounds[handle - 1] + thershold; | ||
} | ||
if (handle < bounds.length - 1 && val >= bounds[handle + 1]) { | ||
return bounds[handle + 1]; | ||
if (handle < bounds.length - 1 && val >= bounds[handle + 1] - thershold) { | ||
return bounds[handle + 1] - thershold; | ||
} | ||
@@ -317,0 +320,0 @@ } |
@@ -142,7 +142,2 @@ 'use strict'; | ||
_this.onMouseUp = function () { | ||
_this.onEnd(); | ||
_this.removeDocumentEvents(); | ||
}; | ||
_this.onMouseMove = function (e) { | ||
@@ -311,3 +306,2 @@ if (!_this.sliderRef) { | ||
onMouseDown: disabled ? noop : this.onMouseDown, | ||
onMouseUp: disabled ? noop : this.onMouseUp, | ||
onKeyDown: disabled ? noop : this.onKeyDown, | ||
@@ -314,0 +308,0 @@ onFocus: disabled ? noop : this.onFocus, |
@@ -43,3 +43,3 @@ 'use strict'; | ||
var markLabel = markPointIsObject ? markPoint.label : markPoint; | ||
if (!markLabel) { | ||
if (!markLabel && markLabel !== 0) { | ||
return null; | ||
@@ -46,0 +46,0 @@ } |
@@ -32,8 +32,6 @@ 'use strict'; | ||
var elStyle = (0, _extends3['default'])({ | ||
visibility: included ? 'visible' : 'hidden' | ||
}, style, positonStyle); | ||
return _react2['default'].createElement('div', { className: className, style: elStyle }); | ||
var elStyle = (0, _extends3['default'])({}, style, positonStyle); | ||
return included ? _react2['default'].createElement('div', { className: className, style: elStyle }) : null; | ||
}; /* eslint-disable react/prop-types */ | ||
exports['default'] = Track; | ||
module.exports = exports['default']; |
@@ -82,3 +82,5 @@ 'use strict'; | ||
placement = _tipProps$placement === undefined ? 'top' : _tipProps$placement, | ||
restTooltipProps = (0, _objectWithoutProperties3['default'])(tipProps, ['prefixCls', 'overlay', 'placement']); | ||
_tipProps$visible = tipProps.visible, | ||
visible = _tipProps$visible === undefined ? visible || false : _tipProps$visible, | ||
restTooltipProps = (0, _objectWithoutProperties3['default'])(tipProps, ['prefixCls', 'overlay', 'placement', 'visible']); | ||
@@ -92,3 +94,3 @@ | ||
placement: placement, | ||
visible: !disabled && (_this.state.visibles[index] || dragging), | ||
visible: !disabled && (_this.state.visibles[index] || dragging) || visible, | ||
key: index | ||
@@ -95,0 +97,0 @@ }), |
@@ -81,4 +81,4 @@ 'use strict'; | ||
var value = props.value !== undefined ? props.value : defaultValue; | ||
var bounds = value.map(function (v) { | ||
return _this.trimAlignValue(v); | ||
var bounds = value.map(function (v, i) { | ||
return _this.trimAlignValue(v, i); | ||
}); | ||
@@ -102,7 +102,8 @@ var recent = bounds[0] === max ? 0 : bounds.length - 1; | ||
} | ||
var bounds = this.state.bounds; | ||
var value = nextProps.value || bounds; | ||
var nextBounds = value.map(function (v) { | ||
return _this2.trimAlignValue(v, nextProps); | ||
var nextBounds = value.map(function (v, i) { | ||
return _this2.trimAlignValue(v, i, nextProps); | ||
}); | ||
@@ -174,4 +175,3 @@ if (nextBounds.length === bounds.length && nextBounds.every(function (v, i) { | ||
if (props.pushable !== false) { | ||
var originalValue = state.bounds[nextHandle]; | ||
this.pushSurroundingHandles(nextBounds, nextHandle, originalValue); | ||
this.pushSurroundingHandles(nextBounds, nextHandle); | ||
} else if (props.allowCross) { | ||
@@ -270,6 +270,7 @@ nextBounds.sort(function (a, b) { | ||
Range.prototype.pushSurroundingHandles = function pushSurroundingHandles(bounds, handle, originalValue) { | ||
Range.prototype.pushSurroundingHandles = function pushSurroundingHandles(bounds, handle) { | ||
var value = bounds[handle]; | ||
var threshold = this.props.pushable; | ||
var value = bounds[handle]; | ||
threshold = Number(threshold); | ||
@@ -292,3 +293,3 @@ var direction = 0; | ||
// revert to original value if pushing is impossible | ||
bounds[handle] = originalValue; | ||
bounds[handle] = bounds[nextHandle] - direction * threshold; | ||
} | ||
@@ -335,25 +336,27 @@ }; | ||
Range.prototype.trimAlignValue = function trimAlignValue(v) { | ||
var nextProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
Range.prototype.trimAlignValue = function trimAlignValue(v, handle) { | ||
var nextProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
var mergedProps = (0, _extends3['default'])({}, this.props, nextProps); | ||
var valInRange = utils.ensureValueInRange(v, mergedProps); | ||
var valNotConflict = this.ensureValueNotConflict(valInRange, mergedProps); | ||
var valNotConflict = this.ensureValueNotConflict(handle, valInRange, mergedProps); | ||
return utils.ensureValuePrecision(valNotConflict, mergedProps); | ||
}; | ||
Range.prototype.ensureValueNotConflict = function ensureValueNotConflict(val, _ref) { | ||
var allowCross = _ref.allowCross; | ||
Range.prototype.ensureValueNotConflict = function ensureValueNotConflict(handle, val, _ref) { | ||
var allowCross = _ref.allowCross, | ||
thershold = _ref.pushable; | ||
var state = this.state || {}; | ||
var handle = state.handle, | ||
bounds = state.bounds; | ||
var bounds = state.bounds; | ||
handle = handle === undefined ? state.handle : handle; | ||
thershold = Number(thershold); | ||
/* eslint-disable eqeqeq */ | ||
if (!allowCross && handle != null) { | ||
if (handle > 0 && val <= bounds[handle - 1]) { | ||
return bounds[handle - 1]; | ||
if (!allowCross && handle != null && bounds !== undefined) { | ||
if (handle > 0 && val <= bounds[handle - 1] + thershold) { | ||
return bounds[handle - 1] + thershold; | ||
} | ||
if (handle < bounds.length - 1 && val >= bounds[handle + 1]) { | ||
return bounds[handle + 1]; | ||
if (handle < bounds.length - 1 && val >= bounds[handle + 1] - thershold) { | ||
return bounds[handle + 1] - thershold; | ||
} | ||
@@ -360,0 +363,0 @@ } |
{ | ||
"name": "rc-slider", | ||
"version": "8.6.0", | ||
"version": "8.6.1", | ||
"description": "Slider UI component for React", | ||
@@ -55,4 +55,7 @@ "keywords": [ | ||
], | ||
"snapshotSerializers": [ | ||
"enzyme-to-json/serializer" | ||
], | ||
"collectCoverageFrom": [ | ||
"src/*" | ||
"src/**/*.{js,jsx}" | ||
], | ||
@@ -59,0 +62,0 @@ "transform": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
17
932993
11496