3971d840d79de2928a776a8e734f4f6f.json
28.2 KB
{"ast":null,"code":"import _regeneratorRuntime from \"@babel/runtime/regenerator\";\nimport _extends from \"@babel/runtime/helpers/extends\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\n\nvar __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {\n function adopt(value) {\n return value instanceof P ? value : new P(function (resolve) {\n resolve(value);\n });\n }\n\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n }\n\n function rejected(value) {\n try {\n step(generator[\"throw\"](value));\n } catch (e) {\n reject(e);\n }\n }\n\n function step(result) {\n result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n }\n\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\n\nimport * as React from 'react';\nimport Notification from 'rc-notification';\nimport CloseOutlined from '@ant-design/icons/CloseOutlined';\nimport classNames from 'classnames';\nimport CheckCircleOutlined from '@ant-design/icons/CheckCircleOutlined';\nimport CloseCircleOutlined from '@ant-design/icons/CloseCircleOutlined';\nimport ExclamationCircleOutlined from '@ant-design/icons/ExclamationCircleOutlined';\nimport InfoCircleOutlined from '@ant-design/icons/InfoCircleOutlined';\nimport createUseNotification from './hooks/useNotification';\nvar notificationInstance = {};\nvar defaultDuration = 4.5;\nvar defaultTop = 24;\nvar defaultBottom = 24;\nvar defaultPrefixCls = 'ant-notification';\nvar defaultPlacement = 'topRight';\nvar defaultGetContainer;\nvar defaultCloseIcon;\nvar rtl = false;\n\nfunction setNotificationConfig(options) {\n var duration = options.duration,\n placement = options.placement,\n bottom = options.bottom,\n top = options.top,\n getContainer = options.getContainer,\n closeIcon = options.closeIcon,\n prefixCls = options.prefixCls;\n\n if (prefixCls !== undefined) {\n defaultPrefixCls = prefixCls;\n }\n\n if (duration !== undefined) {\n defaultDuration = duration;\n }\n\n if (placement !== undefined) {\n defaultPlacement = placement;\n } else if (options.rtl) {\n defaultPlacement = 'topLeft';\n }\n\n if (bottom !== undefined) {\n defaultBottom = bottom;\n }\n\n if (top !== undefined) {\n defaultTop = top;\n }\n\n if (getContainer !== undefined) {\n defaultGetContainer = getContainer;\n }\n\n if (closeIcon !== undefined) {\n defaultCloseIcon = closeIcon;\n }\n\n if (options.rtl !== undefined) {\n rtl = options.rtl;\n }\n}\n\nfunction getPlacementStyle(placement) {\n var top = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultTop;\n var bottom = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultBottom;\n var style;\n\n switch (placement) {\n case 'topLeft':\n style = {\n left: 0,\n top: top,\n bottom: 'auto'\n };\n break;\n\n case 'topRight':\n style = {\n right: 0,\n top: top,\n bottom: 'auto'\n };\n break;\n\n case 'bottomLeft':\n style = {\n left: 0,\n top: 'auto',\n bottom: bottom\n };\n break;\n\n default:\n style = {\n right: 0,\n top: 'auto',\n bottom: bottom\n };\n break;\n }\n\n return style;\n}\n\nfunction getNotificationInstance(args, callback) {\n var _args$placement = args.placement,\n placement = _args$placement === void 0 ? defaultPlacement : _args$placement,\n top = args.top,\n bottom = args.bottom,\n _args$getContainer = args.getContainer,\n getContainer = _args$getContainer === void 0 ? defaultGetContainer : _args$getContainer,\n _args$closeIcon = args.closeIcon,\n closeIcon = _args$closeIcon === void 0 ? defaultCloseIcon : _args$closeIcon;\n var outerPrefixCls = args.prefixCls || defaultPrefixCls;\n var prefixCls = \"\".concat(outerPrefixCls, \"-notice\");\n var cacheKey = \"\".concat(outerPrefixCls, \"-\").concat(placement);\n var cacheInstance = notificationInstance[cacheKey];\n\n if (cacheInstance) {\n Promise.resolve(cacheInstance).then(function (instance) {\n callback({\n prefixCls: prefixCls,\n instance: instance\n });\n });\n return;\n }\n\n var closeIconToRender = /*#__PURE__*/React.createElement(\"span\", {\n className: \"\".concat(outerPrefixCls, \"-close-x\")\n }, closeIcon || /*#__PURE__*/React.createElement(CloseOutlined, {\n className: \"\".concat(outerPrefixCls, \"-close-icon\")\n }));\n var notificationClass = classNames(\"\".concat(outerPrefixCls, \"-\").concat(placement), _defineProperty({}, \"\".concat(outerPrefixCls, \"-rtl\"), rtl === true));\n notificationInstance[cacheKey] = new Promise(function (resolve) {\n Notification.newInstance({\n prefixCls: outerPrefixCls,\n className: notificationClass,\n style: getPlacementStyle(placement, top, bottom),\n getContainer: getContainer,\n closeIcon: closeIconToRender\n }, function (notification) {\n resolve(notification);\n callback({\n prefixCls: prefixCls,\n instance: notification\n });\n });\n });\n}\n\nvar typeToIcon = {\n success: CheckCircleOutlined,\n info: InfoCircleOutlined,\n error: CloseCircleOutlined,\n warning: ExclamationCircleOutlined\n};\n\nfunction getRCNoticeProps(args, prefixCls) {\n var duration = args.duration === undefined ? defaultDuration : args.duration;\n var iconNode = null;\n\n if (args.icon) {\n iconNode = /*#__PURE__*/React.createElement(\"span\", {\n className: \"\".concat(prefixCls, \"-icon\")\n }, args.icon);\n } else if (args.type) {\n iconNode = /*#__PURE__*/React.createElement(typeToIcon[args.type] || null, {\n className: \"\".concat(prefixCls, \"-icon \").concat(prefixCls, \"-icon-\").concat(args.type)\n });\n }\n\n var autoMarginTag = !args.description && iconNode ? /*#__PURE__*/React.createElement(\"span\", {\n className: \"\".concat(prefixCls, \"-message-single-line-auto-margin\")\n }) : null;\n return {\n content: /*#__PURE__*/React.createElement(\"div\", {\n className: iconNode ? \"\".concat(prefixCls, \"-with-icon\") : '',\n role: \"alert\"\n }, iconNode, /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-message\")\n }, autoMarginTag, args.message), /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-description\")\n }, args.description), args.btn ? /*#__PURE__*/React.createElement(\"span\", {\n className: \"\".concat(prefixCls, \"-btn\")\n }, args.btn) : null),\n duration: duration,\n closable: true,\n onClose: args.onClose,\n onClick: args.onClick,\n key: args.key,\n style: args.style || {},\n className: args.className\n };\n}\n\nfunction notice(args) {\n getNotificationInstance(args, function (_ref) {\n var prefixCls = _ref.prefixCls,\n instance = _ref.instance;\n instance.notice(getRCNoticeProps(args, prefixCls));\n });\n}\n\nvar api = {\n open: notice,\n close: function close(key) {\n Object.keys(notificationInstance).forEach(function (cacheKey) {\n return Promise.resolve(notificationInstance[cacheKey]).then(function (instance) {\n instance.removeNotice(key);\n });\n });\n },\n config: setNotificationConfig,\n destroy: function destroy() {\n Object.keys(notificationInstance).forEach(function (cacheKey) {\n Promise.resolve(notificationInstance[cacheKey]).then(function (instance) {\n instance.destroy();\n });\n delete notificationInstance[cacheKey]; // lgtm[js/missing-await]\n });\n }\n};\n['success', 'info', 'warning', 'error'].forEach(function (type) {\n api[type] = function (args) {\n return api.open(_extends(_extends({}, args), {\n type: type\n }));\n };\n});\napi.warn = api.warning;\napi.useNotification = createUseNotification(getNotificationInstance, getRCNoticeProps);\n/** @private test only function. Not work on production */\n\nexport var getInstance = function getInstance(cacheKey) {\n return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {\n return _regeneratorRuntime.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n return _context.abrupt(\"return\", process.env.NODE_ENV === 'test' ? notificationInstance[cacheKey] : null);\n\n case 1:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n }));\n};\nexport default api;","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/antd/es/notification/index.js"],"names":["_regeneratorRuntime","_extends","_defineProperty","__awaiter","thisArg","_arguments","P","generator","adopt","value","resolve","Promise","reject","fulfilled","step","next","e","rejected","result","done","then","apply","React","Notification","CloseOutlined","classNames","CheckCircleOutlined","CloseCircleOutlined","ExclamationCircleOutlined","InfoCircleOutlined","createUseNotification","notificationInstance","defaultDuration","defaultTop","defaultBottom","defaultPrefixCls","defaultPlacement","defaultGetContainer","defaultCloseIcon","rtl","setNotificationConfig","options","duration","placement","bottom","top","getContainer","closeIcon","prefixCls","undefined","getPlacementStyle","arguments","length","style","left","right","getNotificationInstance","args","callback","_args$placement","_args$getContainer","_args$closeIcon","outerPrefixCls","concat","cacheKey","cacheInstance","instance","closeIconToRender","createElement","className","notificationClass","newInstance","notification","typeToIcon","success","info","error","warning","getRCNoticeProps","iconNode","icon","type","autoMarginTag","description","content","role","message","btn","closable","onClose","onClick","key","notice","_ref","api","open","close","Object","keys","forEach","removeNotice","config","destroy","warn","useNotification","getInstance","mark","_callee","wrap","_callee$","_context","prev","abrupt","process","env","NODE_ENV","stop"],"mappings":"AAAA,OAAOA,mBAAP,MAAgC,4BAAhC;AACA,OAAOC,QAAP,MAAqB,gCAArB;AACA,OAAOC,eAAP,MAA4B,uCAA5B;;AAEA,IAAIC,SAAS,GAAG,QAAQ,KAAKA,SAAb,IAA0B,UAAUC,OAAV,EAAmBC,UAAnB,EAA+BC,CAA/B,EAAkCC,SAAlC,EAA6C;AACrF,WAASC,KAAT,CAAeC,KAAf,EAAsB;AACpB,WAAOA,KAAK,YAAYH,CAAjB,GAAqBG,KAArB,GAA6B,IAAIH,CAAJ,CAAM,UAAUI,OAAV,EAAmB;AAC3DA,MAAAA,OAAO,CAACD,KAAD,CAAP;AACD,KAFmC,CAApC;AAGD;;AAED,SAAO,KAAKH,CAAC,KAAKA,CAAC,GAAGK,OAAT,CAAN,EAAyB,UAAUD,OAAV,EAAmBE,MAAnB,EAA2B;AACzD,aAASC,SAAT,CAAmBJ,KAAnB,EAA0B;AACxB,UAAI;AACFK,QAAAA,IAAI,CAACP,SAAS,CAACQ,IAAV,CAAeN,KAAf,CAAD,CAAJ;AACD,OAFD,CAEE,OAAOO,CAAP,EAAU;AACVJ,QAAAA,MAAM,CAACI,CAAD,CAAN;AACD;AACF;;AAED,aAASC,QAAT,CAAkBR,KAAlB,EAAyB;AACvB,UAAI;AACFK,QAAAA,IAAI,CAACP,SAAS,CAAC,OAAD,CAAT,CAAmBE,KAAnB,CAAD,CAAJ;AACD,OAFD,CAEE,OAAO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K,CAAL;AACE,mBAAO+F,QAAQ,CAACE,MAAT,CAAgB,QAAhB,EAA0BC,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,MAAzB,GAAkCpF,oBAAoB,CAACiC,QAAD,CAAtD,GAAmE,IAA7F,CAAP;;AAEF,eAAK,CAAL;AACA,eAAK,KAAL;AACE,mBAAO8C,QAAQ,CAACM,IAAT,EAAP;AANJ;AAQD;AACF,KAXM,EAWJT,OAXI,CAAP;AAYD,GAbqD,CAAtC,CAAhB;AAcD,CAfM;AAgBP,eAAeb,GAAf","sourcesContent":["import _regeneratorRuntime from \"@babel/runtime/regenerator\";\nimport _extends from \"@babel/runtime/helpers/extends\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\n\nvar __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {\n function adopt(value) {\n return value instanceof P ? value : new P(function (resolve) {\n resolve(value);\n });\n }\n\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n }\n\n function rejected(value) {\n try {\n step(generator[\"throw\"](value));\n } catch (e) {\n reject(e);\n }\n }\n\n function step(result) {\n result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n }\n\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\n\nimport * as React from 'react';\nimport Notification from 'rc-notification';\nimport CloseOutlined from '@ant-design/icons/CloseOutlined';\nimport classNames from 'classnames';\nimport CheckCircleOutlined from '@ant-design/icons/CheckCircleOutlined';\nimport CloseCircleOutlined from '@ant-design/icons/CloseCircleOutlined';\nimport ExclamationCircleOutlined from '@ant-design/icons/ExclamationCircleOutlined';\nimport InfoCircleOutlined from '@ant-design/icons/InfoCircleOutlined';\nimport createUseNotification from './hooks/useNotification';\nvar notificationInstance = {};\nvar defaultDuration = 4.5;\nvar defaultTop = 24;\nvar defaultBottom = 24;\nvar defaultPrefixCls = 'ant-notification';\nvar defaultPlacement = 'topRight';\nvar defaultGetContainer;\nvar defaultCloseIcon;\nvar rtl = false;\n\nfunction setNotificationConfig(options) {\n var duration = options.duration,\n placement = options.placement,\n bottom = options.bottom,\n top = options.top,\n getContainer = options.getContainer,\n closeIcon = options.closeIcon,\n prefixCls = options.prefixCls;\n\n if (prefixCls !== undefined) {\n defaultPrefixCls = prefixCls;\n }\n\n if (duration !== undefined) {\n defaultDuration = duration;\n }\n\n if (placement !== undefined) {\n defaultPlacement = placement;\n } else if (options.rtl) {\n defaultPlacement = 'topLeft';\n }\n\n if (bottom !== undefined) {\n defaultBottom = bottom;\n }\n\n if (top !== undefined) {\n defaultTop = top;\n }\n\n if (getContainer !== undefined) {\n defaultGetContainer = getContainer;\n }\n\n if (closeIcon !== undefined) {\n defaultCloseIcon = closeIcon;\n }\n\n if (options.rtl !== undefined) {\n rtl = options.rtl;\n }\n}\n\nfunction getPlacementStyle(placement) {\n var top = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultTop;\n var bottom = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultBottom;\n var style;\n\n switch (placement) {\n case 'topLeft':\n style = {\n left: 0,\n top: top,\n bottom: 'auto'\n };\n break;\n\n case 'topRight':\n style = {\n right: 0,\n top: top,\n bottom: 'auto'\n };\n break;\n\n case 'bottomLeft':\n style = {\n left: 0,\n top: 'auto',\n bottom: bottom\n };\n break;\n\n default:\n style = {\n right: 0,\n top: 'auto',\n bottom: bottom\n };\n break;\n }\n\n return style;\n}\n\nfunction getNotificationInstance(args, callback) {\n var _args$placement = args.placement,\n placement = _args$placement === void 0 ? defaultPlacement : _args$placement,\n top = args.top,\n bottom = args.bottom,\n _args$getContainer = args.getContainer,\n getContainer = _args$getContainer === void 0 ? defaultGetContainer : _args$getContainer,\n _args$closeIcon = args.closeIcon,\n closeIcon = _args$closeIcon === void 0 ? defaultCloseIcon : _args$closeIcon;\n var outerPrefixCls = args.prefixCls || defaultPrefixCls;\n var prefixCls = \"\".concat(outerPrefixCls, \"-notice\");\n var cacheKey = \"\".concat(outerPrefixCls, \"-\").concat(placement);\n var cacheInstance = notificationInstance[cacheKey];\n\n if (cacheInstance) {\n Promise.resolve(cacheInstance).then(function (instance) {\n callback({\n prefixCls: prefixCls,\n instance: instance\n });\n });\n return;\n }\n\n var closeIconToRender = /*#__PURE__*/React.createElement(\"span\", {\n className: \"\".concat(outerPrefixCls, \"-close-x\")\n }, closeIcon || /*#__PURE__*/React.createElement(CloseOutlined, {\n className: \"\".concat(outerPrefixCls, \"-close-icon\")\n }));\n var notificationClass = classNames(\"\".concat(outerPrefixCls, \"-\").concat(placement), _defineProperty({}, \"\".concat(outerPrefixCls, \"-rtl\"), rtl === true));\n notificationInstance[cacheKey] = new Promise(function (resolve) {\n Notification.newInstance({\n prefixCls: outerPrefixCls,\n className: notificationClass,\n style: getPlacementStyle(placement, top, bottom),\n getContainer: getContainer,\n closeIcon: closeIconToRender\n }, function (notification) {\n resolve(notification);\n callback({\n prefixCls: prefixCls,\n instance: notification\n });\n });\n });\n}\n\nvar typeToIcon = {\n success: CheckCircleOutlined,\n info: InfoCircleOutlined,\n error: CloseCircleOutlined,\n warning: ExclamationCircleOutlined\n};\n\nfunction getRCNoticeProps(args, prefixCls) {\n var duration = args.duration === undefined ? defaultDuration : args.duration;\n var iconNode = null;\n\n if (args.icon) {\n iconNode = /*#__PURE__*/React.createElement(\"span\", {\n className: \"\".concat(prefixCls, \"-icon\")\n }, args.icon);\n } else if (args.type) {\n iconNode = /*#__PURE__*/React.createElement(typeToIcon[args.type] || null, {\n className: \"\".concat(prefixCls, \"-icon \").concat(prefixCls, \"-icon-\").concat(args.type)\n });\n }\n\n var autoMarginTag = !args.description && iconNode ? /*#__PURE__*/React.createElement(\"span\", {\n className: \"\".concat(prefixCls, \"-message-single-line-auto-margin\")\n }) : null;\n return {\n content: /*#__PURE__*/React.createElement(\"div\", {\n className: iconNode ? \"\".concat(prefixCls, \"-with-icon\") : '',\n role: \"alert\"\n }, iconNode, /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-message\")\n }, autoMarginTag, args.message), /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-description\")\n }, args.description), args.btn ? /*#__PURE__*/React.createElement(\"span\", {\n className: \"\".concat(prefixCls, \"-btn\")\n }, args.btn) : null),\n duration: duration,\n closable: true,\n onClose: args.onClose,\n onClick: args.onClick,\n key: args.key,\n style: args.style || {},\n className: args.className\n };\n}\n\nfunction notice(args) {\n getNotificationInstance(args, function (_ref) {\n var prefixCls = _ref.prefixCls,\n instance = _ref.instance;\n instance.notice(getRCNoticeProps(args, prefixCls));\n });\n}\n\nvar api = {\n open: notice,\n close: function close(key) {\n Object.keys(notificationInstance).forEach(function (cacheKey) {\n return Promise.resolve(notificationInstance[cacheKey]).then(function (instance) {\n instance.removeNotice(key);\n });\n });\n },\n config: setNotificationConfig,\n destroy: function destroy() {\n Object.keys(notificationInstance).forEach(function (cacheKey) {\n Promise.resolve(notificationInstance[cacheKey]).then(function (instance) {\n instance.destroy();\n });\n delete notificationInstance[cacheKey]; // lgtm[js/missing-await]\n });\n }\n};\n['success', 'info', 'warning', 'error'].forEach(function (type) {\n api[type] = function (args) {\n return api.open(_extends(_extends({}, args), {\n type: type\n }));\n };\n});\napi.warn = api.warning;\napi.useNotification = createUseNotification(getNotificationInstance, getRCNoticeProps);\n/** @private test only function. Not work on production */\n\nexport var getInstance = function getInstance(cacheKey) {\n return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {\n return _regeneratorRuntime.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n return _context.abrupt(\"return\", process.env.NODE_ENV === 'test' ? notificationInstance[cacheKey] : null);\n\n case 1:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n }));\n};\nexport default api;"]},"metadata":{},"sourceType":"module"}