1 line
7.8 KiB
JSON
1 line
7.8 KiB
JSON
{"ast":null,"code":"import _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport cls from 'classnames';\nimport * as React from 'react';\nimport SliderContext from \"../context\";\nimport { getIndex } from \"../util\";\nimport Track from \"./Track\";\nvar Tracks = function Tracks(props) {\n var prefixCls = props.prefixCls,\n style = props.style,\n values = props.values,\n startPoint = props.startPoint,\n onStartMove = props.onStartMove;\n var _React$useContext = React.useContext(SliderContext),\n included = _React$useContext.included,\n range = _React$useContext.range,\n min = _React$useContext.min,\n styles = _React$useContext.styles,\n classNames = _React$useContext.classNames;\n\n // =========================== List ===========================\n var trackList = React.useMemo(function () {\n if (!range) {\n // null value do not have track\n if (values.length === 0) {\n return [];\n }\n var startValue = startPoint !== null && startPoint !== void 0 ? startPoint : min;\n var endValue = values[0];\n return [{\n start: Math.min(startValue, endValue),\n end: Math.max(startValue, endValue)\n }];\n }\n\n // Multiple\n var list = [];\n for (var i = 0; i < values.length - 1; i += 1) {\n list.push({\n start: values[i],\n end: values[i + 1]\n });\n }\n return list;\n }, [values, range, startPoint, min]);\n if (!included) {\n return null;\n }\n\n // ========================== Render ==========================\n var tracksNode = classNames.tracks || styles.tracks ? /*#__PURE__*/React.createElement(Track, {\n index: null,\n prefixCls: prefixCls,\n start: trackList[0].start,\n end: trackList[trackList.length - 1].end,\n replaceCls: cls(classNames.tracks, \"\".concat(prefixCls, \"-tracks\")),\n style: styles.tracks\n }) : null;\n return /*#__PURE__*/React.createElement(React.Fragment, null, tracksNode, trackList.map(function (_ref, index) {\n var start = _ref.start,\n end = _ref.end;\n return /*#__PURE__*/React.createElement(Track, {\n index: index,\n prefixCls: prefixCls,\n style: _objectSpread(_objectSpread({}, getIndex(style, index)), styles.track),\n start: start,\n end: end,\n key: index,\n onStartMove: onStartMove\n });\n }));\n};\nexport default Tracks;","map":{"version":3,"names":["_objectSpread","cls","React","SliderContext","getIndex","Track","Tracks","props","prefixCls","style","values","startPoint","onStartMove","_React$useContext","useContext","included","range","min","styles","classNames","trackList","useMemo","length","startValue","endValue","start","Math","end","max","list","i","push","tracksNode","tracks","createElement","index","replaceCls","concat","Fragment","map","_ref","track","key"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/rc-slider/es/Tracks/index.js"],"sourcesContent":["import _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport cls from 'classnames';\nimport * as React from 'react';\nimport SliderContext from \"../context\";\nimport { getIndex } from \"../util\";\nimport Track from \"./Track\";\nvar Tracks = function Tracks(props) {\n var prefixCls = props.prefixCls,\n style = props.style,\n values = props.values,\n startPoint = props.startPoint,\n onStartMove = props.onStartMove;\n var _React$useContext = React.useContext(SliderContext),\n included = _React$useContext.included,\n range = _React$useContext.range,\n min = _React$useContext.min,\n styles = _React$useContext.styles,\n classNames = _React$useContext.classNames;\n\n // =========================== List ===========================\n var trackList = React.useMemo(function () {\n if (!range) {\n // null value do not have track\n if (values.length === 0) {\n return [];\n }\n var startValue = startPoint !== null && startPoint !== void 0 ? startPoint : min;\n var endValue = values[0];\n return [{\n start: Math.min(startValue, endValue),\n end: Math.max(startValue, endValue)\n }];\n }\n\n // Multiple\n var list = [];\n for (var i = 0; i < values.length - 1; i += 1) {\n list.push({\n start: values[i],\n end: values[i + 1]\n });\n }\n return list;\n }, [values, range, startPoint, min]);\n if (!included) {\n return null;\n }\n\n // ========================== Render ==========================\n var tracksNode = classNames.tracks || styles.tracks ? /*#__PURE__*/React.createElement(Track, {\n index: null,\n prefixCls: prefixCls,\n start: trackList[0].start,\n end: trackList[trackList.length - 1].end,\n replaceCls: cls(classNames.tracks, \"\".concat(prefixCls, \"-tracks\")),\n style: styles.tracks\n }) : null;\n return /*#__PURE__*/React.createElement(React.Fragment, null, tracksNode, trackList.map(function (_ref, index) {\n var start = _ref.start,\n end = _ref.end;\n return /*#__PURE__*/React.createElement(Track, {\n index: index,\n prefixCls: prefixCls,\n style: _objectSpread(_objectSpread({}, getIndex(style, index)), styles.track),\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