1 line
8.2 KiB
JSON
1 line
8.2 KiB
JSON
|
{"ast":null,"code":"import _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport cls from 'classnames';\nimport * as React from 'react';\nimport SliderContext from \"../context\";\nimport { getOffset } from \"../util\";\nvar Track = function Track(props) {\n var prefixCls = props.prefixCls,\n style = props.style,\n start = props.start,\n end = props.end,\n index = props.index,\n onStartMove = props.onStartMove,\n replaceCls = props.replaceCls;\n var _React$useContext = React.useContext(SliderContext),\n direction = _React$useContext.direction,\n min = _React$useContext.min,\n max = _React$useContext.max,\n disabled = _React$useContext.disabled,\n range = _React$useContext.range,\n classNames = _React$useContext.classNames;\n var trackPrefixCls = \"\".concat(prefixCls, \"-track\");\n var offsetStart = getOffset(start, min, max);\n var offsetEnd = getOffset(end, min, max);\n\n // ============================ Events ============================\n var onInternalStartMove = function onInternalStartMove(e) {\n if (!disabled && onStartMove) {\n onStartMove(e, -1);\n }\n };\n\n // ============================ Render ============================\n var positionStyle = {};\n switch (direction) {\n case 'rtl':\n positionStyle.right = \"\".concat(offsetStart * 100, \"%\");\n positionStyle.width = \"\".concat(offsetEnd * 100 - offsetStart * 100, \"%\");\n break;\n case 'btt':\n positionStyle.bottom = \"\".concat(offsetStart * 100, \"%\");\n positionStyle.height = \"\".concat(offsetEnd * 100 - offsetStart * 100, \"%\");\n break;\n case 'ttb':\n positionStyle.top = \"\".concat(offsetStart * 100, \"%\");\n positionStyle.height = \"\".concat(offsetEnd * 100 - offsetStart * 100, \"%\");\n break;\n default:\n positionStyle.left = \"\".concat(offsetStart * 100, \"%\");\n positionStyle.width = \"\".concat(offsetEnd * 100 - offsetStart * 100, \"%\");\n }\n var className = replaceCls || cls(trackPrefixCls, _defineProperty(_defineProperty({}, \"\".concat(trackPrefixCls, \"-\").concat(index + 1), index !== null && range), \"\".concat(prefixCls, \"-track-draggable\"), onStartMove), classNames.track);\n return /*#__PURE__*/React.createElement(\"div\", {\n className: className,\n style: _objectSpread(_objectSpread({}, positionStyle), style),\n onMouseDown: onInternalStartMove,\n onTouchStart: onInternalStartMove\n });\n};\nexport default Track;","map":{"version":3,"names":["_objectSpread","_defineProperty","cls","React","SliderContext","getOffset","Track","props","prefixCls","style","start","end","index","onStartMove","replaceCls","_React$useContext","useContext","direction","min","max","disabled","range","classNames","trackPrefixCls","concat","offsetStart","offsetEnd","onInternalStartMove","e","positionStyle","right","width","bottom","height","top","left","className","track","createElement","onMouseDown","onTouchStart"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/rc-slider/es/Tracks/Track.js"],"sourcesContent":["import _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport cls from 'classnames';\nimport * as React from 'react';\nimport SliderContext from \"../context\";\nimport { getOffset } from \"../util\";\nvar Track = function Track(props) {\n var prefixCls = props.prefixCls,\n style = props.style,\n start = props.start,\n end = props.end,\n index = props.index,\n onStartMove = props.onStartMove,\n replaceCls = props.replaceCls;\n var _React$useContext = React.useContext(SliderContext),\n direction = _React$useContext.direction,\n min = _React$useContext.min,\n max = _React$useContext.max,\n disabled = _React$useContext.disabled,\n range = _React$useContext.range,\n classNames = _React$useContext.classNames;\n var trackPrefixCls = \"\".concat(prefixCls, \"-track
|