0bfca8ef782d7d8c1a15c816f02be944.json
15.3 KB
{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/extends\";\n\nvar __rest = this && this.__rest || function (s, e) {\n var t = {};\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n }\n\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n};\n\nimport * as React from 'react';\nimport { presetPrimaryColors } from '@ant-design/colors';\nimport { validProgress, getSuccessPercent } from './utils';\n/**\n * {\n * '0%': '#afc163',\n * '75%': '#009900',\n * '50%': 'green', ====> '#afc163 0%, #66FF00 25%, #00CC00 50%, #009900 75%, #ffffff 100%'\n * '25%': '#66FF00',\n * '100%': '#ffffff'\n * }\n */\n\nexport var sortGradient = function sortGradient(gradients) {\n var tempArr = [];\n Object.keys(gradients).forEach(function (key) {\n var formattedKey = parseFloat(key.replace(/%/g, ''));\n\n if (!isNaN(formattedKey)) {\n tempArr.push({\n key: formattedKey,\n value: gradients[key]\n });\n }\n });\n tempArr = tempArr.sort(function (a, b) {\n return a.key - b.key;\n });\n return tempArr.map(function (_ref) {\n var key = _ref.key,\n value = _ref.value;\n return \"\".concat(value, \" \").concat(key, \"%\");\n }).join(', ');\n};\n/**\n * {\n * '0%': '#afc163',\n * '25%': '#66FF00',\n * '50%': '#00CC00', ====> linear-gradient(to right, #afc163 0%, #66FF00 25%,\n * '75%': '#009900', #00CC00 50%, #009900 75%, #ffffff 100%)\n * '100%': '#ffffff'\n * }\n *\n * Then this man came to realize the truth:\n * Besides six pence, there is the moon.\n * Besides bread and butter, there is the bug.\n * And...\n * Besides women, there is the code.\n */\n\nexport var handleGradient = function handleGradient(strokeColor, directionConfig) {\n var _strokeColor$from = strokeColor.from,\n from = _strokeColor$from === void 0 ? presetPrimaryColors.blue : _strokeColor$from,\n _strokeColor$to = strokeColor.to,\n to = _strokeColor$to === void 0 ? presetPrimaryColors.blue : _strokeColor$to,\n _strokeColor$directio = strokeColor.direction,\n direction = _strokeColor$directio === void 0 ? directionConfig === 'rtl' ? 'to left' : 'to right' : _strokeColor$directio,\n rest = __rest(strokeColor, [\"from\", \"to\", \"direction\"]);\n\n if (Object.keys(rest).length !== 0) {\n var sortedGradients = sortGradient(rest);\n return {\n backgroundImage: \"linear-gradient(\".concat(direction, \", \").concat(sortedGradients, \")\")\n };\n }\n\n return {\n backgroundImage: \"linear-gradient(\".concat(direction, \", \").concat(from, \", \").concat(to, \")\")\n };\n};\n\nvar Line = function Line(props) {\n var prefixCls = props.prefixCls,\n directionConfig = props.direction,\n percent = props.percent,\n strokeWidth = props.strokeWidth,\n size = props.size,\n strokeColor = props.strokeColor,\n strokeLinecap = props.strokeLinecap,\n children = props.children,\n trailColor = props.trailColor,\n success = props.success;\n var backgroundProps = strokeColor && typeof strokeColor !== 'string' ? handleGradient(strokeColor, directionConfig) : {\n background: strokeColor\n };\n var trailStyle = trailColor ? {\n backgroundColor: trailColor\n } : undefined;\n\n var percentStyle = _extends({\n width: \"\".concat(validProgress(percent), \"%\"),\n height: strokeWidth || (size === 'small' ? 6 : 8),\n borderRadius: strokeLinecap === 'square' ? 0 : ''\n }, backgroundProps);\n\n var successPercent = getSuccessPercent(props);\n var successPercentStyle = {\n width: \"\".concat(validProgress(successPercent), \"%\"),\n height: strokeWidth || (size === 'small' ? 6 : 8),\n borderRadius: strokeLinecap === 'square' ? 0 : '',\n backgroundColor: success === null || success === void 0 ? void 0 : success.strokeColor\n };\n var successSegment = successPercent !== undefined ? /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-success-bg\"),\n style: successPercentStyle\n }) : null;\n return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-outer\")\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-inner\"),\n style: trailStyle\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-bg\"),\n style: percentStyle\n }), successSegment)), children);\n};\n\nexport default Line;","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/antd/es/progress/Line.js"],"names":["_extends","__rest","s","e","t","p","Object","prototype","hasOwnProperty","call","indexOf","getOwnPropertySymbols","i","length","propertyIsEnumerable","React","presetPrimaryColors","validProgress","getSuccessPercent","sortGradient","gradients","tempArr","keys","forEach","key","formattedKey","parseFloat","replace","isNaN","push","value","sort","a","b","map","_ref","concat","join","handleGradient","strokeColor","directionConfig","_strokeColor$from","from","blue","_strokeColor$to","to","_strokeColor$directio","direction","rest","sortedGradients","backgroundImage","Line","props","prefixCls","percent","strokeWidth","size","strokeLinecap","children","trailColor","success","backgroundProps","background","trailStyle","backgroundColor","undefined","percentStyle","width","height","borderRadius","successPercent","successPercentStyle","successSegment","createElement","className","style","Fragment"],"mappings":"AAAA,OAAOA,QAAP,MAAqB,gCAArB;;AAEA,IAAIC,MAAM,GAAG,QAAQ,KAAKA,MAAb,IAAuB,UAAUC,CAAV,EAAaC,CAAb,EAAgB;AAClD,MAAIC,CAAC,GAAG,EAAR;;AAEA,OAAK,IAAIC,CAAT,IAAcH,CAAd,EAAiB;AACf,QAAII,MAAM,CAACC,SAAP,CAAiBC,cAAjB,CAAgCC,IAAhC,CAAqCP,CAArC,EAAwCG,CAAxC,KAA8CF,CAAC,CAACO,OAAF,CAAUL,CAAV,IAAe,CAAjE,EAAoED,CAAC,CAACC,CAAD,CAAD,GAAOH,CAAC,CAACG,CAAD,CAAR;AACrE;;AAED,MAAIH,CAAC,IAAI,IAAL,IAAa,OAAOI,MAAM,CAACK,qBAAd,KAAwC,UAAzD,EAAqE,KAAK,IAAIC,CAAC,GAAG,CAAR,EAAWP,CAAC,GAAGC,MAAM,CAACK,q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tC,MAAH,CAAUiB,SAAV,EAAqB,QAArB,CAD8B;AAEzCsB,IAAAA,KAAK,EAAEZ;AAFkC,GAA3B,EAGb,aAAahD,KAAK,CAAC0D,aAAN,CAAoB,KAApB,EAA2B;AACzCC,IAAAA,SAAS,EAAE,GAAGtC,MAAH,CAAUiB,SAAV,EAAqB,KAArB,CAD8B;AAEzCsB,IAAAA,KAAK,EAAET;AAFkC,GAA3B,CAHA,EAMZM,cANY,CAF2D,CAAvD,EAQEd,QARF,CAApB;AASD,CA5CD;;AA8CA,eAAeP,IAAf","sourcesContent":["import _extends from \"@babel/runtime/helpers/extends\";\n\nvar __rest = this && this.__rest || function (s, e) {\n var t = {};\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n }\n\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n};\n\nimport * as React from 'react';\nimport { presetPrimaryColors } from '@ant-design/colors';\nimport { validProgress, getSuccessPercent } from './utils';\n/**\n * {\n * '0%': '#afc163',\n * '75%': '#009900',\n * '50%': 'green', ====> '#afc163 0%, #66FF00 25%, #00CC00 50%, #009900 75%, #ffffff 100%'\n * '25%': '#66FF00',\n * '100%': '#ffffff'\n * }\n */\n\nexport var sortGradient = function sortGradient(gradients) {\n var tempArr = [];\n Object.keys(gradients).forEach(function (key) {\n var formattedKey = parseFloat(key.replace(/%/g, ''));\n\n if (!isNaN(formattedKey)) {\n tempArr.push({\n key: formattedKey,\n value: gradients[key]\n });\n }\n });\n tempArr = tempArr.sort(function (a, b) {\n return a.key - b.key;\n });\n return tempArr.map(function (_ref) {\n var key = _ref.key,\n value = _ref.value;\n return \"\".concat(value, \" \").concat(key, \"%\");\n }).join(', ');\n};\n/**\n * {\n * '0%': '#afc163',\n * '25%': '#66FF00',\n * '50%': '#00CC00', ====> linear-gradient(to right, #afc163 0%, #66FF00 25%,\n * '75%': '#009900', #00CC00 50%, #009900 75%, #ffffff 100%)\n * '100%': '#ffffff'\n * }\n *\n * Then this man came to realize the truth:\n * Besides six pence, there is the moon.\n * Besides bread and butter, there is the bug.\n * And...\n * Besides women, there is the code.\n */\n\nexport var handleGradient = function handleGradient(strokeColor, directionConfig) {\n var _strokeColor$from = strokeColor.from,\n from = _strokeColor$from === void 0 ? presetPrimaryColors.blue : _strokeColor$from,\n _strokeColor$to = strokeColor.to,\n to = _strokeColor$to === void 0 ? presetPrimaryColors.blue : _strokeColor$to,\n _strokeColor$directio = strokeColor.direction,\n direction = _strokeColor$directio === void 0 ? directionConfig === 'rtl' ? 'to left' : 'to right' : _strokeColor$directio,\n rest = __rest(strokeColor, [\"from\", \"to\", \"direction\"]);\n\n if (Object.keys(rest).length !== 0) {\n var sortedGradients = sortGradient(rest);\n return {\n backgroundImage: \"linear-gradient(\".concat(direction, \", \").concat(sortedGradients, \")\")\n };\n }\n\n return {\n backgroundImage: \"linear-gradient(\".concat(direction, \", \").concat(from, \", \").concat(to, \")\")\n };\n};\n\nvar Line = function Line(props) {\n var prefixCls = props.prefixCls,\n directionConfig = props.direction,\n percent = props.percent,\n strokeWidth = props.strokeWidth,\n size = props.size,\n strokeColor = props.strokeColor,\n strokeLinecap = props.strokeLinecap,\n children = props.children,\n trailColor = props.trailColor,\n success = props.success;\n var backgroundProps = strokeColor && typeof strokeColor !== 'string' ? handleGradient(strokeColor, directionConfig) : {\n background: strokeColor\n };\n var trailStyle = trailColor ? {\n backgroundColor: trailColor\n } : undefined;\n\n var percentStyle = _extends({\n width: \"\".concat(validProgress(percent), \"%\"),\n height: strokeWidth || (size === 'small' ? 6 : 8),\n borderRadius: strokeLinecap === 'square' ? 0 : ''\n }, backgroundProps);\n\n var successPercent = getSuccessPercent(props);\n var successPercentStyle = {\n width: \"\".concat(validProgress(successPercent), \"%\"),\n height: strokeWidth || (size === 'small' ? 6 : 8),\n borderRadius: strokeLinecap === 'square' ? 0 : '',\n backgroundColor: success === null || success === void 0 ? void 0 : success.strokeColor\n };\n var successSegment = successPercent !== undefined ? /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-success-bg\"),\n style: successPercentStyle\n }) : null;\n return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-outer\")\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-inner\"),\n style: trailStyle\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-bg\"),\n style: percentStyle\n }), successSegment)), children);\n};\n\nexport default Line;"]},"metadata":{},"sourceType":"module"}