216769c122d171238ff64d18a5ef0430.json
22 KB
{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/extends\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport _slicedToArray from \"@babel/runtime/helpers/slicedToArray\";\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 CloseOutlined from '@ant-design/icons/CloseOutlined';\nimport CheckCircleOutlined from '@ant-design/icons/CheckCircleOutlined';\nimport ExclamationCircleOutlined from '@ant-design/icons/ExclamationCircleOutlined';\nimport InfoCircleOutlined from '@ant-design/icons/InfoCircleOutlined';\nimport CloseCircleOutlined from '@ant-design/icons/CloseCircleOutlined';\nimport CheckCircleFilled from '@ant-design/icons/CheckCircleFilled';\nimport ExclamationCircleFilled from '@ant-design/icons/ExclamationCircleFilled';\nimport InfoCircleFilled from '@ant-design/icons/InfoCircleFilled';\nimport CloseCircleFilled from '@ant-design/icons/CloseCircleFilled';\nimport CSSMotion from 'rc-motion';\nimport classNames from 'classnames';\nimport { ConfigContext } from '../config-provider';\nimport getDataOrAriaProps from '../_util/getDataOrAriaProps';\nimport ErrorBoundary from './ErrorBoundary';\nimport { replaceElement } from '../_util/reactNode';\nvar iconMapFilled = {\n success: CheckCircleFilled,\n info: InfoCircleFilled,\n error: CloseCircleFilled,\n warning: ExclamationCircleFilled\n};\nvar iconMapOutlined = {\n success: CheckCircleOutlined,\n info: InfoCircleOutlined,\n error: CloseCircleOutlined,\n warning: ExclamationCircleOutlined\n};\n\nvar Alert = function Alert(_a) {\n var _classNames2;\n\n var description = _a.description,\n customizePrefixCls = _a.prefixCls,\n message = _a.message,\n banner = _a.banner,\n _a$className = _a.className,\n className = _a$className === void 0 ? '' : _a$className,\n style = _a.style,\n onMouseEnter = _a.onMouseEnter,\n onMouseLeave = _a.onMouseLeave,\n onClick = _a.onClick,\n afterClose = _a.afterClose,\n showIcon = _a.showIcon,\n closable = _a.closable,\n closeText = _a.closeText,\n action = _a.action,\n props = __rest(_a, [\"description\", \"prefixCls\", \"message\", \"banner\", \"className\", \"style\", \"onMouseEnter\", \"onMouseLeave\", \"onClick\", \"afterClose\", \"showIcon\", \"closable\", \"closeText\", \"action\"]);\n\n var _React$useState = React.useState(false),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n closed = _React$useState2[0],\n setClosed = _React$useState2[1];\n\n var ref = React.useRef();\n\n var _React$useContext = React.useContext(ConfigContext),\n getPrefixCls = _React$useContext.getPrefixCls,\n direction = _React$useContext.direction;\n\n var prefixCls = getPrefixCls('alert', customizePrefixCls);\n\n var handleClose = function handleClose(e) {\n var _a;\n\n setClosed(true);\n (_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props, e);\n };\n\n var getType = function getType() {\n var type = props.type;\n\n if (type !== undefined) {\n return type;\n } // banner 模式默认为警告\n\n\n return banner ? 'warning' : 'info';\n }; // closeable when closeText is assigned\n\n\n var isClosable = closeText ? true : closable;\n var type = getType();\n\n var renderIconNode = function renderIconNode() {\n var icon = props.icon; // use outline icon in alert with description\n\n var iconType = (description ? iconMapOutlined : iconMapFilled)[type] || null;\n\n if (icon) {\n return replaceElement(icon, /*#__PURE__*/React.createElement(\"span\", {\n className: \"\".concat(prefixCls, \"-icon\")\n }, icon), function () {\n return {\n className: classNames(\"\".concat(prefixCls, \"-icon\"), _defineProperty({}, icon.props.className, icon.props.className))\n };\n });\n }\n\n return /*#__PURE__*/React.createElement(iconType, {\n className: \"\".concat(prefixCls, \"-icon\")\n });\n };\n\n var renderCloseIcon = function renderCloseIcon() {\n return isClosable ? /*#__PURE__*/React.createElement(\"button\", {\n type: \"button\",\n onClick: handleClose,\n className: \"\".concat(prefixCls, \"-close-icon\"),\n tabIndex: 0\n }, closeText ? /*#__PURE__*/React.createElement(\"span\", {\n className: \"\".concat(prefixCls, \"-close-text\")\n }, closeText) : /*#__PURE__*/React.createElement(CloseOutlined, null)) : null;\n }; // banner 模式默认有 Icon\n\n\n var isShowIcon = banner && showIcon === undefined ? true : showIcon;\n var alertCls = classNames(prefixCls, \"\".concat(prefixCls, \"-\").concat(type), (_classNames2 = {}, _defineProperty(_classNames2, \"\".concat(prefixCls, \"-with-description\"), !!description), _defineProperty(_classNames2, \"\".concat(prefixCls, \"-no-icon\"), !isShowIcon), _defineProperty(_classNames2, \"\".concat(prefixCls, \"-banner\"), !!banner), _defineProperty(_classNames2, \"\".concat(prefixCls, \"-rtl\"), direction === 'rtl'), _classNames2), className);\n var dataOrAriaProps = getDataOrAriaProps(props);\n return /*#__PURE__*/React.createElement(CSSMotion, {\n visible: !closed,\n motionName: \"\".concat(prefixCls, \"-motion\"),\n motionAppear: false,\n motionEnter: false,\n onLeaveStart: function onLeaveStart(node) {\n return {\n maxHeight: node.offsetHeight\n };\n },\n onLeaveEnd: afterClose\n }, function (_ref) {\n var motionClassName = _ref.className,\n motionStyle = _ref.style;\n return /*#__PURE__*/React.createElement(\"div\", _extends({\n ref: ref,\n \"data-show\": !closed,\n className: classNames(alertCls, motionClassName),\n style: _extends(_extends({}, style), motionStyle),\n onMouseEnter: onMouseEnter,\n onMouseLeave: onMouseLeave,\n onClick: onClick,\n role: \"alert\"\n }, dataOrAriaProps), isShowIcon ? renderIconNode() : null, /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-content\")\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-message\")\n }, message), /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-description\")\n }, description)), action ? /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-action\")\n }, action) : null, renderCloseIcon());\n });\n};\n\nAlert.ErrorBoundary = ErrorBoundary;\nexport default Alert;","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/antd/es/alert/index.js"],"names":["_extends","_defineProperty","_slicedToArray","__rest","s","e","t","p","Object","prototype","hasOwnProperty","call","indexOf","getOwnPropertySymbols","i","length","propertyIsEnumerable","React","CloseOutlined","CheckCircleOutlined","ExclamationCircleOutlined","InfoCircleOutlined","CloseCircleOutlined","CheckCircleFilled","ExclamationCircleFilled","InfoCircleFilled","CloseCircleFilled","CSSMotion","classNames","ConfigContext","getDataOrAriaProps","ErrorBoundary","replaceElement","iconMapFilled","success","info","error","warning","iconMapOutlined","Alert","_a","_classNames2","description","customizePrefixCls","prefixCls","message","banner","_a$className","className","style","onMouseEnter","onMouseLeave","onClick","afterClose","showIcon","closable","closeText","action","props","_React$useState","useState","_React$useState2","closed","setClosed","ref","useRef","_React$useContext","useContext","getPrefixCls","direction","handleClose","onClose","getType","type","undefined","isClosable","renderIconNode","icon","iconType","createElement","concat","renderCloseIcon","tabIndex","isShowIcon","alertCls","dataOrAriaProps","visible","motionName","motionAppear","motionEnter","onLeaveStart","node","maxHeight","offsetHeight","onLeaveEnd","_ref","motionClassName","motionStyle","role"],"mappings":"AAAA,OAAOA,QAAP,MAAqB,gCAArB;AACA,OAAOC,eAAP,MAA4B,uCAA5B;AACA,OAAOC,cAAP,MAA2B,sCAA3B;;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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ACzC/B,MAAAA,SAAS,EAAE,GAAGgC,MAAH,CAAUpC,SAAV,EAAqB,UAArB;AAD8B,KAA3B,EAEbC,OAFa,CAFwD,EAI3D,aAAa5B,KAAK,CAAC8D,aAAN,CAAoB,KAApB,EAA2B;AACnD/B,MAAAA,SAAS,EAAE,GAAGgC,MAAH,CAAUpC,SAAV,EAAqB,cAArB;AADwC,KAA3B,EAEvBF,WAFuB,CAJ8C,CATpD,EAeFe,MAAM,GAAG,aAAaxC,KAAK,CAAC8D,aAAN,CAAoB,KAApB,EAA2B;AACjE/B,MAAAA,SAAS,EAAE,GAAGgC,MAAH,CAAUpC,SAAV,EAAqB,SAArB;AADsD,KAA3B,EAErCa,MAFqC,CAAhB,GAEX,IAjBO,EAiBDwB,eAAe,EAjBd,CAApB;AAkBD,GAhCmB,CAApB;AAiCD,CA3HD;;AA6HA1C,KAAK,CAACR,aAAN,GAAsBA,aAAtB;AACA,eAAeQ,KAAf","sourcesContent":["import _extends from \"@babel/runtime/helpers/extends\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport _slicedToArray from \"@babel/runtime/helpers/slicedToArray\";\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 CloseOutlined from '@ant-design/icons/CloseOutlined';\nimport CheckCircleOutlined from '@ant-design/icons/CheckCircleOutlined';\nimport ExclamationCircleOutlined from '@ant-design/icons/ExclamationCircleOutlined';\nimport InfoCircleOutlined from '@ant-design/icons/InfoCircleOutlined';\nimport CloseCircleOutlined from '@ant-design/icons/CloseCircleOutlined';\nimport CheckCircleFilled from '@ant-design/icons/CheckCircleFilled';\nimport ExclamationCircleFilled from '@ant-design/icons/ExclamationCircleFilled';\nimport InfoCircleFilled from '@ant-design/icons/InfoCircleFilled';\nimport CloseCircleFilled from '@ant-design/icons/CloseCircleFilled';\nimport CSSMotion from 'rc-motion';\nimport classNames from 'classnames';\nimport { ConfigContext } from '../config-provider';\nimport getDataOrAriaProps from '../_util/getDataOrAriaProps';\nimport ErrorBoundary from './ErrorBoundary';\nimport { replaceElement } from '../_util/reactNode';\nvar iconMapFilled = {\n success: CheckCircleFilled,\n info: InfoCircleFilled,\n error: CloseCircleFilled,\n warning: ExclamationCircleFilled\n};\nvar iconMapOutlined = {\n success: CheckCircleOutlined,\n info: InfoCircleOutlined,\n error: CloseCircleOutlined,\n warning: ExclamationCircleOutlined\n};\n\nvar Alert = function Alert(_a) {\n var _classNames2;\n\n var description = _a.description,\n customizePrefixCls = _a.prefixCls,\n message = _a.message,\n banner = _a.banner,\n _a$className = _a.className,\n className = _a$className === void 0 ? '' : _a$className,\n style = _a.style,\n onMouseEnter = _a.onMouseEnter,\n onMouseLeave = _a.onMouseLeave,\n onClick = _a.onClick,\n afterClose = _a.afterClose,\n showIcon = _a.showIcon,\n closable = _a.closable,\n closeText = _a.closeText,\n action = _a.action,\n props = __rest(_a, [\"description\", \"prefixCls\", \"message\", \"banner\", \"className\", \"style\", \"onMouseEnter\", \"onMouseLeave\", \"onClick\", \"afterClose\", \"showIcon\", \"closable\", \"closeText\", \"action\"]);\n\n var _React$useState = React.useState(false),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n closed = _React$useState2[0],\n setClosed = _React$useState2[1];\n\n var ref = React.useRef();\n\n var _React$useContext = React.useContext(ConfigContext),\n getPrefixCls = _React$useContext.getPrefixCls,\n direction = _React$useContext.direction;\n\n var prefixCls = getPrefixCls('alert', customizePrefixCls);\n\n var handleClose = function handleClose(e) {\n var _a;\n\n setClosed(true);\n (_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props, e);\n };\n\n var getType = function getType() {\n var type = props.type;\n\n if (type !== undefined) {\n return type;\n } // banner 模式默认为警告\n\n\n return banner ? 'warning' : 'info';\n }; // closeable when closeText is assigned\n\n\n var isClosable = closeText ? true : closable;\n var type = getType();\n\n var renderIconNode = function renderIconNode() {\n var icon = props.icon; // use outline icon in alert with description\n\n var iconType = (description ? iconMapOutlined : iconMapFilled)[type] || null;\n\n if (icon) {\n return replaceElement(icon, /*#__PURE__*/React.createElement(\"span\", {\n className: \"\".concat(prefixCls, \"-icon\")\n }, icon), function () {\n return {\n className: classNames(\"\".concat(prefixCls, \"-icon\"), _defineProperty({}, icon.props.className, icon.props.className))\n };\n });\n }\n\n return /*#__PURE__*/React.createElement(iconType, {\n className: \"\".concat(prefixCls, \"-icon\")\n });\n };\n\n var renderCloseIcon = function renderCloseIcon() {\n return isClosable ? /*#__PURE__*/React.createElement(\"button\", {\n type: \"button\",\n onClick: handleClose,\n className: \"\".concat(prefixCls, \"-close-icon\"),\n tabIndex: 0\n }, closeText ? /*#__PURE__*/React.createElement(\"span\", {\n className: \"\".concat(prefixCls, \"-close-text\")\n }, closeText) : /*#__PURE__*/React.createElement(CloseOutlined, null)) : null;\n }; // banner 模式默认有 Icon\n\n\n var isShowIcon = banner && showIcon === undefined ? true : showIcon;\n var alertCls = classNames(prefixCls, \"\".concat(prefixCls, \"-\").concat(type), (_classNames2 = {}, _defineProperty(_classNames2, \"\".concat(prefixCls, \"-with-description\"), !!description), _defineProperty(_classNames2, \"\".concat(prefixCls, \"-no-icon\"), !isShowIcon), _defineProperty(_classNames2, \"\".concat(prefixCls, \"-banner\"), !!banner), _defineProperty(_classNames2, \"\".concat(prefixCls, \"-rtl\"), direction === 'rtl'), _classNames2), className);\n var dataOrAriaProps = getDataOrAriaProps(props);\n return /*#__PURE__*/React.createElement(CSSMotion, {\n visible: !closed,\n motionName: \"\".concat(prefixCls, \"-motion\"),\n motionAppear: false,\n motionEnter: false,\n onLeaveStart: function onLeaveStart(node) {\n return {\n maxHeight: node.offsetHeight\n };\n },\n onLeaveEnd: afterClose\n }, function (_ref) {\n var motionClassName = _ref.className,\n motionStyle = _ref.style;\n return /*#__PURE__*/React.createElement(\"div\", _extends({\n ref: ref,\n \"data-show\": !closed,\n className: classNames(alertCls, motionClassName),\n style: _extends(_extends({}, style), motionStyle),\n onMouseEnter: onMouseEnter,\n onMouseLeave: onMouseLeave,\n onClick: onClick,\n role: \"alert\"\n }, dataOrAriaProps), isShowIcon ? renderIconNode() : null, /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-content\")\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-message\")\n }, message), /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-description\")\n }, description)), action ? /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-action\")\n }, action) : null, renderCloseIcon());\n });\n};\n\nAlert.ErrorBoundary = ErrorBoundary;\nexport default Alert;"]},"metadata":{},"sourceType":"module"}