a0fd89e12a84056de32005b9e18219b5.json
24.1 KB
{"ast":null,"code":"import _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport _typeof from \"@babel/runtime/helpers/typeof\";\nimport _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 CSSMotion from 'rc-motion';\nimport classNames from 'classnames';\nimport ScrollNumber from './ScrollNumber';\nimport Ribbon from './Ribbon';\nimport { ConfigContext } from '../config-provider';\nimport { cloneElement } from '../_util/reactNode';\nimport { isPresetColor } from './utils';\n\nvar Badge = function Badge(_a) {\n var _classNames, _classNames2;\n\n var customizePrefixCls = _a.prefixCls,\n customizeScrollNumberPrefixCls = _a.scrollNumberPrefixCls,\n children = _a.children,\n status = _a.status,\n text = _a.text,\n color = _a.color,\n _a$count = _a.count,\n count = _a$count === void 0 ? null : _a$count,\n _a$overflowCount = _a.overflowCount,\n overflowCount = _a$overflowCount === void 0 ? 99 : _a$overflowCount,\n _a$dot = _a.dot,\n dot = _a$dot === void 0 ? false : _a$dot,\n _a$size = _a.size,\n size = _a$size === void 0 ? 'default' : _a$size,\n title = _a.title,\n offset = _a.offset,\n style = _a.style,\n className = _a.className,\n _a$showZero = _a.showZero,\n showZero = _a$showZero === void 0 ? false : _a$showZero,\n restProps = __rest(_a, [\"prefixCls\", \"scrollNumberPrefixCls\", \"children\", \"status\", \"text\", \"color\", \"count\", \"overflowCount\", \"dot\", \"size\", \"title\", \"offset\", \"style\", \"className\", \"showZero\"]);\n\n var _React$useContext = React.useContext(ConfigContext),\n getPrefixCls = _React$useContext.getPrefixCls,\n direction = _React$useContext.direction;\n\n var prefixCls = getPrefixCls('badge', customizePrefixCls); // ================================ Misc ================================\n\n var numberedDisplayCount = count > overflowCount ? \"\".concat(overflowCount, \"+\") : count;\n var hasStatus = status !== null && status !== undefined || color !== null && color !== undefined;\n var isZero = numberedDisplayCount === '0' || numberedDisplayCount === 0;\n var showAsDot = dot && !isZero || hasStatus;\n var displayCount = showAsDot ? '' : numberedDisplayCount;\n var isHidden = React.useMemo(function () {\n var isEmpty = displayCount === null || displayCount === undefined || displayCount === '';\n return (isEmpty || isZero && !showZero) && !showAsDot;\n }, [displayCount, isZero, showZero, showAsDot]); // We will cache the dot status to avoid shaking on leaved motion\n\n var isDotRef = React.useRef(showAsDot);\n\n if (!isHidden) {\n isDotRef.current = showAsDot;\n } // =============================== Styles ===============================\n\n\n var mergedStyle = React.useMemo(function () {\n if (!offset) {\n return _extends({}, style);\n }\n\n var offsetStyle = {\n marginTop: offset[1]\n };\n\n if (direction === 'rtl') {\n offsetStyle.left = parseInt(offset[0], 10);\n } else {\n offsetStyle.right = -parseInt(offset[0], 10);\n }\n\n return _extends(_extends({}, offsetStyle), style);\n }, [direction, offset, style]); // =============================== Render ===============================\n // >>> Title\n\n var titleNode = title !== null && title !== void 0 ? title : typeof count === 'string' || typeof count === 'number' ? count : undefined; // >>> Status Text\n\n var statusTextNode = isHidden || !text ? null : /*#__PURE__*/React.createElement(\"span\", {\n className: \"\".concat(prefixCls, \"-status-text\")\n }, text); // >>> Display Component\n\n var displayNode = !count || _typeof(count) !== 'object' ? undefined : cloneElement(count, function (oriProps) {\n return {\n style: _extends(_extends({}, mergedStyle), oriProps.style)\n };\n }); // Shared styles\n\n var statusCls = classNames((_classNames = {}, _defineProperty(_classNames, \"\".concat(prefixCls, \"-status-dot\"), hasStatus), _defineProperty(_classNames, \"\".concat(prefixCls, \"-status-\").concat(status), !!status), _defineProperty(_classNames, \"\".concat(prefixCls, \"-status-\").concat(color), isPresetColor(color)), _classNames));\n var statusStyle = {};\n\n if (color && !isPresetColor(color)) {\n statusStyle.background = color;\n }\n\n var badgeClassName = classNames(prefixCls, (_classNames2 = {}, _defineProperty(_classNames2, \"\".concat(prefixCls, \"-status\"), hasStatus), _defineProperty(_classNames2, \"\".concat(prefixCls, \"-not-a-wrapper\"), !children), _defineProperty(_classNames2, \"\".concat(prefixCls, \"-rtl\"), direction === 'rtl'), _classNames2), className); // <Badge status=\"success\" />\n\n if (!children && hasStatus) {\n var statusTextColor = mergedStyle.color;\n return /*#__PURE__*/React.createElement(\"span\", _extends({}, restProps, {\n className: badgeClassName,\n style: mergedStyle\n }), /*#__PURE__*/React.createElement(\"span\", {\n className: statusCls,\n style: statusStyle\n }), /*#__PURE__*/React.createElement(\"span\", {\n style: {\n color: statusTextColor\n },\n className: \"\".concat(prefixCls, \"-status-text\")\n }, text));\n } // <Badge status=\"success\" count={<Icon type=\"xxx\" />}></Badge>\n\n\n return /*#__PURE__*/React.createElement(\"span\", _extends({}, restProps, {\n className: badgeClassName\n }), children, /*#__PURE__*/React.createElement(CSSMotion, {\n visible: !isHidden,\n motionName: \"\".concat(prefixCls, \"-zoom\"),\n motionAppear: false\n }, function (_ref) {\n var _classNames3;\n\n var motionClassName = _ref.className;\n var scrollNumberPrefixCls = getPrefixCls('scroll-number', customizeScrollNumberPrefixCls);\n var isDot = isDotRef.current;\n var scrollNumberCls = classNames((_classNames3 = {}, _defineProperty(_classNames3, \"\".concat(prefixCls, \"-dot\"), isDot), _defineProperty(_classNames3, \"\".concat(prefixCls, \"-count\"), !isDot), _defineProperty(_classNames3, \"\".concat(prefixCls, \"-count-sm\"), size === 'small'), _defineProperty(_classNames3, \"\".concat(prefixCls, \"-multiple-words\"), !isDot && count && count.toString && count.toString().length > 1), _defineProperty(_classNames3, \"\".concat(prefixCls, \"-status-\").concat(status), !!status), _defineProperty(_classNames3, \"\".concat(prefixCls, \"-status-\").concat(color), isPresetColor(color)), _classNames3));\n\n var scrollNumberStyle = _extends({}, mergedStyle);\n\n if (color && !isPresetColor(color)) {\n scrollNumberStyle = scrollNumberStyle || {};\n scrollNumberStyle.background = color;\n }\n\n return /*#__PURE__*/React.createElement(ScrollNumber, {\n prefixCls: scrollNumberPrefixCls,\n show: !isHidden,\n className: classNames(motionClassName, scrollNumberCls),\n count: displayCount,\n title: titleNode,\n style: scrollNumberStyle,\n key: \"scrollNumber\"\n }, displayNode);\n }), statusTextNode);\n};\n\nBadge.Ribbon = Ribbon;\nexport default Badge;","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/antd/es/badge/index.js"],"names":["_defineProperty","_typeof","_extends","__rest","s","e","t","p","Object","prototype","hasOwnProperty","call","indexOf","getOwnPropertySymbols","i","length","propertyIsEnumerable","React","CSSMotion","classNames","ScrollNumber","Ribbon","ConfigContext","cloneElement","isPresetColor","Badge","_a","_classNames","_classNames2","customizePrefixCls","prefixCls","customizeScrollNumberPrefixCls","scrollNumberPrefixCls","children","status","text","color","_a$count","count","_a$overflowCount","overflowCount","_a$dot","dot","_a$size","size","title","offset","style","className","_a$showZero","showZero","restProps","_React$useContext","useContext","getPrefixCls","direction","numberedDisplayCount","concat","hasStatus","undefined","isZero","showAsDot","displayCount","isHidden","useMemo","isEmpty","isDotRef","useRef","current","mergedStyle","offsetStyle","marginTop","left","parseInt","right","titleNode","statusTextNode","createElement","displayNode","oriProps","statusCls","statusStyle","background","badgeClassName","statusTextColor","visible","motionName","motionAppear","_ref","_classNames3","motionClassName","isDot","scrollNumberCls","toString","scrollNumberStyle","show","key"],"mappings":"AAAA,OAAOA,eAAP,MAA4B,uCAA5B;AACA,OAAOC,OAAP,MAAoB,+BAApB;AACA,OAAOC,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,C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aAAa,CAACY,KAAD,CAA5E,CAAre,EAA2jBqD,YAA7jB,EAAhC;;AAEA,QAAIK,iBAAiB,GAAG5F,QAAQ,CAAC,EAAD,EAAKmE,WAAL,CAAhC;;AAEA,QAAIjC,KAAK,IAAI,CAACZ,aAAa,CAACY,KAAD,CAA3B,EAAoC;AAClC0D,MAAAA,iBAAiB,GAAGA,iBAAiB,IAAI,EAAzC;AACAA,MAAAA,iBAAiB,CAACZ,UAAlB,GAA+B9C,KAA/B;AACD;;AAED,WAAO,aAAanB,KAAK,CAAC4D,aAAN,CAAoBzD,YAApB,EAAkC;AACpDU,MAAAA,SAAS,EAAEE,qBADyC;AAEpD+D,MAAAA,IAAI,EAAE,CAAChC,QAF6C;AAGpDf,MAAAA,SAAS,EAAE7B,UAAU,CAACuE,eAAD,EAAkBE,eAAlB,CAH+B;AAIpDtD,MAAAA,KAAK,EAAEwB,YAJ6C;AAKpDjB,MAAAA,KAAK,EAAE8B,SAL6C;AAMpD5B,MAAAA,KAAK,EAAE+C,iBAN6C;AAOpDE,MAAAA,GAAG,EAAE;AAP+C,KAAlC,EAQjBlB,WARiB,CAApB;AASD,GA5B0B,CAFP,EA8BhBF,cA9BgB,CAApB;AA+BD,CAxID;;AA0IAnD,KAAK,CAACJ,MAAN,GAAeA,MAAf;AACA,eAAeI,KAAf","sourcesContent":["import _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport _typeof from \"@babel/runtime/helpers/typeof\";\nimport _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 CSSMotion from 'rc-motion';\nimport classNames from 'classnames';\nimport ScrollNumber from './ScrollNumber';\nimport Ribbon from './Ribbon';\nimport { ConfigContext } from '../config-provider';\nimport { cloneElement } from '../_util/reactNode';\nimport { isPresetColor } from './utils';\n\nvar Badge = function Badge(_a) {\n var _classNames, _classNames2;\n\n var customizePrefixCls = _a.prefixCls,\n customizeScrollNumberPrefixCls = _a.scrollNumberPrefixCls,\n children = _a.children,\n status = _a.status,\n text = _a.text,\n color = _a.color,\n _a$count = _a.count,\n count = _a$count === void 0 ? null : _a$count,\n _a$overflowCount = _a.overflowCount,\n overflowCount = _a$overflowCount === void 0 ? 99 : _a$overflowCount,\n _a$dot = _a.dot,\n dot = _a$dot === void 0 ? false : _a$dot,\n _a$size = _a.size,\n size = _a$size === void 0 ? 'default' : _a$size,\n title = _a.title,\n offset = _a.offset,\n style = _a.style,\n className = _a.className,\n _a$showZero = _a.showZero,\n showZero = _a$showZero === void 0 ? false : _a$showZero,\n restProps = __rest(_a, [\"prefixCls\", \"scrollNumberPrefixCls\", \"children\", \"status\", \"text\", \"color\", \"count\", \"overflowCount\", \"dot\", \"size\", \"title\", \"offset\", \"style\", \"className\", \"showZero\"]);\n\n var _React$useContext = React.useContext(ConfigContext),\n getPrefixCls = _React$useContext.getPrefixCls,\n direction = _React$useContext.direction;\n\n var prefixCls = getPrefixCls('badge', customizePrefixCls); // ================================ Misc ================================\n\n var numberedDisplayCount = count > overflowCount ? \"\".concat(overflowCount, \"+\") : count;\n var hasStatus = status !== null && status !== undefined || color !== null && color !== undefined;\n var isZero = numberedDisplayCount === '0' || numberedDisplayCount === 0;\n var showAsDot = dot && !isZero || hasStatus;\n var displayCount = showAsDot ? '' : numberedDisplayCount;\n var isHidden = React.useMemo(function () {\n var isEmpty = displayCount === null || displayCount === undefined || displayCount === '';\n return (isEmpty || isZero && !showZero) && !showAsDot;\n }, [displayCount, isZero, showZero, showAsDot]); // We will cache the dot status to avoid shaking on leaved motion\n\n var isDotRef = React.useRef(showAsDot);\n\n if (!isHidden) {\n isDotRef.current = showAsDot;\n } // =============================== Styles ===============================\n\n\n var mergedStyle = React.useMemo(function () {\n if (!offset) {\n return _extends({}, style);\n }\n\n var offsetStyle = {\n marginTop: offset[1]\n };\n\n if (direction === 'rtl') {\n offsetStyle.left = parseInt(offset[0], 10);\n } else {\n offsetStyle.right = -parseInt(offset[0], 10);\n }\n\n return _extends(_extends({}, offsetStyle), style);\n }, [direction, offset, style]); // =============================== Render ===============================\n // >>> Title\n\n var titleNode = title !== null && title !== void 0 ? title : typeof count === 'string' || typeof count === 'number' ? count : undefined; // >>> Status Text\n\n var statusTextNode = isHidden || !text ? null : /*#__PURE__*/React.createElement(\"span\", {\n className: \"\".concat(prefixCls, \"-status-text\")\n }, text); // >>> Display Component\n\n var displayNode = !count || _typeof(count) !== 'object' ? undefined : cloneElement(count, function (oriProps) {\n return {\n style: _extends(_extends({}, mergedStyle), oriProps.style)\n };\n }); // Shared styles\n\n var statusCls = classNames((_classNames = {}, _defineProperty(_classNames, \"\".concat(prefixCls, \"-status-dot\"), hasStatus), _defineProperty(_classNames, \"\".concat(prefixCls, \"-status-\").concat(status), !!status), _defineProperty(_classNames, \"\".concat(prefixCls, \"-status-\").concat(color), isPresetColor(color)), _classNames));\n var statusStyle = {};\n\n if (color && !isPresetColor(color)) {\n statusStyle.background = color;\n }\n\n var badgeClassName = classNames(prefixCls, (_classNames2 = {}, _defineProperty(_classNames2, \"\".concat(prefixCls, \"-status\"), hasStatus), _defineProperty(_classNames2, \"\".concat(prefixCls, \"-not-a-wrapper\"), !children), _defineProperty(_classNames2, \"\".concat(prefixCls, \"-rtl\"), direction === 'rtl'), _classNames2), className); // <Badge status=\"success\" />\n\n if (!children && hasStatus) {\n var statusTextColor = mergedStyle.color;\n return /*#__PURE__*/React.createElement(\"span\", _extends({}, restProps, {\n className: badgeClassName,\n style: mergedStyle\n }), /*#__PURE__*/React.createElement(\"span\", {\n className: statusCls,\n style: statusStyle\n }), /*#__PURE__*/React.createElement(\"span\", {\n style: {\n color: statusTextColor\n },\n className: \"\".concat(prefixCls, \"-status-text\")\n }, text));\n } // <Badge status=\"success\" count={<Icon type=\"xxx\" />}></Badge>\n\n\n return /*#__PURE__*/React.createElement(\"span\", _extends({}, restProps, {\n className: badgeClassName\n }), children, /*#__PURE__*/React.createElement(CSSMotion, {\n visible: !isHidden,\n motionName: \"\".concat(prefixCls, \"-zoom\"),\n motionAppear: false\n }, function (_ref) {\n var _classNames3;\n\n var motionClassName = _ref.className;\n var scrollNumberPrefixCls = getPrefixCls('scroll-number', customizeScrollNumberPrefixCls);\n var isDot = isDotRef.current;\n var scrollNumberCls = classNames((_classNames3 = {}, _defineProperty(_classNames3, \"\".concat(prefixCls, \"-dot\"), isDot), _defineProperty(_classNames3, \"\".concat(prefixCls, \"-count\"), !isDot), _defineProperty(_classNames3, \"\".concat(prefixCls, \"-count-sm\"), size === 'small'), _defineProperty(_classNames3, \"\".concat(prefixCls, \"-multiple-words\"), !isDot && count && count.toString && count.toString().length > 1), _defineProperty(_classNames3, \"\".concat(prefixCls, \"-status-\").concat(status), !!status), _defineProperty(_classNames3, \"\".concat(prefixCls, \"-status-\").concat(color), isPresetColor(color)), _classNames3));\n\n var scrollNumberStyle = _extends({}, mergedStyle);\n\n if (color && !isPresetColor(color)) {\n scrollNumberStyle = scrollNumberStyle || {};\n scrollNumberStyle.background = color;\n }\n\n return /*#__PURE__*/React.createElement(ScrollNumber, {\n prefixCls: scrollNumberPrefixCls,\n show: !isHidden,\n className: classNames(motionClassName, scrollNumberCls),\n count: displayCount,\n title: titleNode,\n style: scrollNumberStyle,\n key: \"scrollNumber\"\n }, displayNode);\n }), statusTextNode);\n};\n\nBadge.Ribbon = Ribbon;\nexport default Badge;"]},"metadata":{},"sourceType":"module"}