0ee71f1d2ceb00aa7afc069b98073004.json
6.68 KB
{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/extends\";\nimport _slicedToArray from \"@babel/runtime/helpers/slicedToArray\";\nimport * as React from 'react';\nimport useRCNotification from \"rc-notification/es/useNotification\";\nimport { ConfigConsumer } from '../../config-provider';\nexport default function createUseNotification(getNotificationInstance, getRCNoticeProps) {\n var useNotification = function useNotification() {\n // We can only get content by render\n var getPrefixCls; // We create a proxy to handle delay created instance\n\n var innerInstance = null;\n var proxy = {\n add: function add(noticeProps, holderCallback) {\n innerInstance === null || innerInstance === void 0 ? void 0 : innerInstance.component.add(noticeProps, holderCallback);\n }\n };\n\n var _useRCNotification = useRCNotification(proxy),\n _useRCNotification2 = _slicedToArray(_useRCNotification, 2),\n hookNotify = _useRCNotification2[0],\n holder = _useRCNotification2[1];\n\n function notify(args) {\n var customizePrefixCls = args.prefixCls;\n var mergedPrefixCls = getPrefixCls('notification', customizePrefixCls);\n getNotificationInstance(_extends(_extends({}, args), {\n prefixCls: mergedPrefixCls\n }), function (_ref) {\n var prefixCls = _ref.prefixCls,\n instance = _ref.instance;\n innerInstance = instance;\n hookNotify(getRCNoticeProps(args, prefixCls));\n });\n } // Fill functions\n\n\n var hookApiRef = React.useRef({});\n hookApiRef.current.open = notify;\n ['success', 'info', 'warning', 'error'].forEach(function (type) {\n hookApiRef.current[type] = function (args) {\n return hookApiRef.current.open(_extends(_extends({}, args), {\n type: type\n }));\n };\n });\n return [hookApiRef.current, /*#__PURE__*/React.createElement(ConfigConsumer, {\n key: \"holder\"\n }, function (context) {\n getPrefixCls = context.getPrefixCls;\n return holder;\n })];\n };\n\n return useNotification;\n}","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/antd/es/notification/hooks/useNotification.js"],"names":["_extends","_slicedToArray","React","useRCNotification","ConfigConsumer","createUseNotification","getNotificationInstance","getRCNoticeProps","useNotification","getPrefixCls","innerInstance","proxy","add","noticeProps","holderCallback","component","_useRCNotification","_useRCNotification2","hookNotify","holder","notify","args","customizePrefixCls","prefixCls","mergedPrefixCls","_ref","instance","hookApiRef","useRef","current","open","forEach","type","createElement","key","context"],"mappings":"AAAA,OAAOA,QAAP,MAAqB,gCAArB;AACA,OAAOC,cAAP,MAA2B,sCAA3B;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,OAAOC,iBAAP,MAA8B,oCAA9B;AACA,SAASC,cAAT,QAA+B,uBAA/B;AACA,eAAe,SAASC,qBAAT,CAA+BC,uBAA/B,EAAwDC,gBAAxD,EAA0E;AACvF,MAAIC,eAAe,GAAG,SAASA,eAAT,GAA2B;AAC/C;AACA,QAAIC,YAAJ,CAF+C,CAE7B;;AAElB,QAAIC,aAAa,GAAG,IAApB;AACA,QAAIC,KAAK,GAAG;AACVC,MAAAA,GAAG,EAAE,SAASA,GAAT,CAAaC,WAAb,EAA0BC,cAA1B,EAA0C;AAC7CJ,QAAAA,aAAa,KAAK,IAAlB,IAA0BA,aAAa,KAAK,KAAK,CAAjD,GAAqD,KAAK,CAA1D,GAA8DA,aAAa,CAACK,SAAd,CAAwBH,GAAxB,CAA4BC,WAA5B,EAAyCC,cAAzC,CAA9D;AACD;AAHS,KAAZ;;AAMA,QAAIE,kBAAkB,GAAGb,iBAAiB,CAACQ,KAAD,CAA1C;AAAA,QACIM,mBAAmB,GAAGhB,cAAc,CAACe,kBAAD,EAAqB,CAArB,CADxC;AAAA,QAEIE,UAAU,GAAGD,mBAAmB,CAAC,CAAD,CAFpC;AAAA,QAGIE,MAAM,GAAGF,mBAAmB,CAAC,CAAD,CAHhC;;AAKA,aAASG,MAAT,CAAgBC,IAAhB,EAAsB;AACpB,UAAIC,kBAAkB,GAAGD,IAAI,CAACE,SAA9B;AACA,UAAIC,eAAe,GAAGf,YAAY,CAAC,cAAD,EAAiBa,kBAAjB,CAAlC;AACAhB,MAAAA,uBAAuB,CAACN,QAAQ,CAACA,QAAQ,CAAC,EAAD,EAAKqB,IAAL,CAAT,EAAqB;AACnDE,QAAAA,SAAS,EAAEC;AADwC,OAArB,CAAT,EAEnB,UAAUC,IAAV,EAAgB;AAClB,YAAIF,SAAS,GAAGE,IAAI,CAACF,SAArB;AAAA,YACIG,QAAQ,GAAGD,IAAI,CAACC,QADpB;AAEAhB,QAAAA,aAAa,GAAGgB,QAAhB;AACAR,QAAAA,UAAU,CAACX,gBAAgB,CAACc,IAAD,EAAOE,SAAP,CAAjB,CAAV;AACD,OAPsB,CAAvB;AAQD,KA3B8C,CA2B7C;;;AAGF,QAAII,UAAU,GAAGzB,KAAK,CAAC0B,MAAN,CAAa,EAAb,CAAjB;AACAD,IAAAA,UAAU,CAACE,OAAX,CAAmBC,IAAnB,GAA0BV,MAA1B;AACA,KAAC,SAAD,EAAY,MAAZ,EAAoB,SAApB,EAA+B,OAA/B,EAAwCW,OAAxC,CAAgD,UAAUC,IAAV,EAAgB;AAC9DL,MAAAA,UAAU,CAACE,OAAX,CAAmBG,IAAnB,IAA2B,UAAUX,IAAV,EAAgB;AACzC,eAAOM,UAAU,CAACE,OAAX,CAAmBC,IAAnB,CAAwB9B,QAAQ,CAACA,QAAQ,CAAC,EAAD,EAAKqB,IAAL,CAAT,EAAqB;AAC1DW,UAAAA,IAAI,EAAEA;AADoD,SAArB,CAAhC,CAAP;AAGD,OAJD;AAKD,KAND;AAOA,WAAO,CAACL,UAAU,CAACE,OAAZ,EAAqB,aAAa3B,KAAK,CAAC+B,aAAN,CAAoB7B,cAApB,EAAoC;AAC3E8B,MAAAA,GAAG,EAAE;AADsE,KAApC,EAEtC,UAAUC,OAAV,EAAmB;AACpB1B,MAAAA,YAAY,GAAG0B,OAAO,CAAC1B,YAAvB;AACA,aAAOU,MAAP;AACD,KALwC,CAAlC,CAAP;AAMD,GA7CD;;AA+CA,SAAOX,eAAP;AACD","sourcesContent":["import _extends from \"@babel/runtime/helpers/extends\";\nimport _slicedToArray from \"@babel/runtime/helpers/slicedToArray\";\nimport * as React from 'react';\nimport useRCNotification from \"rc-notification/es/useNotification\";\nimport { ConfigConsumer } from '../../config-provider';\nexport default function createUseNotification(getNotificationInstance, getRCNoticeProps) {\n var useNotification = function useNotification() {\n // We can only get content by render\n var getPrefixCls; // We create a proxy to handle delay created instance\n\n var innerInstance = null;\n var proxy = {\n add: function add(noticeProps, holderCallback) {\n innerInstance === null || innerInstance === void 0 ? void 0 : innerInstance.component.add(noticeProps, holderCallback);\n }\n };\n\n var _useRCNotification = useRCNotification(proxy),\n _useRCNotification2 = _slicedToArray(_useRCNotification, 2),\n hookNotify = _useRCNotification2[0],\n holder = _useRCNotification2[1];\n\n function notify(args) {\n var customizePrefixCls = args.prefixCls;\n var mergedPrefixCls = getPrefixCls('notification', customizePrefixCls);\n getNotificationInstance(_extends(_extends({}, args), {\n prefixCls: mergedPrefixCls\n }), function (_ref) {\n var prefixCls = _ref.prefixCls,\n instance = _ref.instance;\n innerInstance = instance;\n hookNotify(getRCNoticeProps(args, prefixCls));\n });\n } // Fill functions\n\n\n var hookApiRef = React.useRef({});\n hookApiRef.current.open = notify;\n ['success', 'info', 'warning', 'error'].forEach(function (type) {\n hookApiRef.current[type] = function (args) {\n return hookApiRef.current.open(_extends(_extends({}, args), {\n type: type\n }));\n };\n });\n return [hookApiRef.current, /*#__PURE__*/React.createElement(ConfigConsumer, {\n key: \"holder\"\n }, function (context) {\n getPrefixCls = context.getPrefixCls;\n return holder;\n })];\n };\n\n return useNotification;\n}"]},"metadata":{},"sourceType":"module"}