rc-slider
Advanced tools
Comparing version 3.5.0 to 3.5.1
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { | ||
value: true | ||
value: true | ||
}); | ||
@@ -22,43 +22,46 @@ | ||
var Marks = function Marks(_ref) { | ||
var className = _ref.className; | ||
var marks = _ref.marks; | ||
var included = _ref.included; | ||
var upperBound = _ref.upperBound; | ||
var lowerBound = _ref.lowerBound; | ||
var max = _ref.max; | ||
var min = _ref.min; | ||
var className = _ref.className; | ||
var marks = _ref.marks; | ||
var included = _ref.included; | ||
var upperBound = _ref.upperBound; | ||
var lowerBound = _ref.lowerBound; | ||
var max = _ref.max; | ||
var min = _ref.min; | ||
var marksKeys = Object.keys(marks); | ||
var marksCount = marksKeys.length; | ||
var unit = 100 / (marksCount - 1); | ||
var markWidth = unit * 0.9; | ||
var marksKeys = Object.keys(marks); | ||
var marksCount = marksKeys.length; | ||
var unit = 100 / (marksCount - 1); | ||
var markWidth = unit * 0.9; | ||
var range = max - min; | ||
var elements = marksKeys.map(parseFloat).sort(function (a, b) { | ||
return a - b; | ||
}).map(function (point) { | ||
var _classNames; | ||
var range = max - min; | ||
var elements = marksKeys.map(parseFloat).sort(function (a, b) { | ||
return a - b; | ||
}).map(function (point) { | ||
var _classNames; | ||
var isActived = !included && point === upperBound || included && point <= upperBound && point >= lowerBound; | ||
var markClassName = (0, _classnames2['default'])((_classNames = {}, _defineProperty(_classNames, className + '-text', true), _defineProperty(_classNames, className + '-text-active', isActived), _classNames)); | ||
var isActived = !included && point === upperBound || included && point <= upperBound && point >= lowerBound; | ||
var markClassName = (0, _classnames2['default'])((_classNames = {}, _defineProperty(_classNames, className + '-text', true), _defineProperty(_classNames, className + '-text-active', isActived), _classNames)); | ||
var style = { width: markWidth + '%' }; | ||
style.left = (point - min) / range * 100 - markWidth / 2 + '%'; | ||
var style = { | ||
width: markWidth + '%', | ||
marginLeft: -markWidth / 2 + '%' | ||
}; | ||
style.left = (point - min) / range * 100 + '%'; | ||
var markPoint = marks[point]; | ||
var markPointIsObject = typeof markPoint === 'object' && !_react2['default'].isValidElement(markPoint); | ||
var markLabel = markPointIsObject ? markPoint.label : markPoint; | ||
var markStyle = markPointIsObject ? _extends({}, style, markPoint.style) : style; | ||
return _react2['default'].createElement( | ||
'span', | ||
{ className: markClassName, style: markStyle, key: point }, | ||
markLabel | ||
); | ||
}); | ||
var markPoint = marks[point]; | ||
var markPointIsObject = typeof markPoint === 'object' && !_react2['default'].isValidElement(markPoint); | ||
var markLabel = markPointIsObject ? markPoint.label : markPoint; | ||
var markStyle = markPointIsObject ? _extends({}, style, markPoint.style) : style; | ||
return _react2['default'].createElement( | ||
'span', | ||
{ className: markClassName, style: markStyle, key: point }, | ||
markLabel | ||
); | ||
}); | ||
return _react2['default'].createElement( | ||
'div', | ||
{ className: className }, | ||
elements | ||
); | ||
return _react2['default'].createElement( | ||
'div', | ||
{ className: className }, | ||
elements | ||
); | ||
}; | ||
@@ -65,0 +68,0 @@ |
{ | ||
"name": "rc-slider", | ||
"version": "3.5.0", | ||
"version": "3.5.1", | ||
"description": "slider ui component for react", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
914
42321