PromoCursed/node_modules/.cache/babel-loader/a66790c94042c9d26b4ec190f246da57d41f7f7601b0a3ddf2aee944514b4941.json

1 line
7.8 KiB
JSON
Raw Normal View History

2024-08-20 23:25:37 +04:00
{"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.