cd3df8c11dda12b1d68be36df68838cc.json 3.8 KB
{"ast":null,"code":"import _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport * as React from 'react';\nimport Notice from './Notice';\nexport default function useNotification(notificationInstance) {\n  var createdRef = React.useRef({});\n\n  var _React$useState = React.useState([]),\n      _React$useState2 = _slicedToArray(_React$useState, 2),\n      elements = _React$useState2[0],\n      setElements = _React$useState2[1];\n\n  function notify(noticeProps) {\n    notificationInstance.add(noticeProps, function (div, props) {\n      var key = props.key;\n\n      if (div && !createdRef.current[key]) {\n        var noticeEle = React.createElement(Notice, Object.assign({}, props, {\n          holder: div\n        }));\n        createdRef.current[key] = noticeEle;\n        setElements(function (originElements) {\n          return [].concat(_toConsumableArray(originElements), [noticeEle]);\n        });\n      }\n    });\n  }\n\n  return [notify, React.createElement(React.Fragment, null, elements)];\n}","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/rc-notification/es/useNotification.js"],"names":["_toConsumableArray","_slicedToArray","React","Notice","useNotification","notificationInstance","createdRef","useRef","_React$useState","useState","_React$useState2","elements","setElements","notify","noticeProps","add","div","props","key","current","noticeEle","createElement","Object","assign","holder","originElements","concat","Fragment"],"mappings":"AAAA,OAAOA,kBAAP,MAA+B,8CAA/B;AACA,OAAOC,cAAP,MAA2B,0CAA3B;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,OAAOC,MAAP,MAAmB,UAAnB;AACA,eAAe,SAASC,eAAT,CAAyBC,oBAAzB,EAA+C;AAC5D,MAAIC,UAAU,GAAGJ,KAAK,CAACK,MAAN,CAAa,EAAb,CAAjB;;AAEA,MAAIC,eAAe,GAAGN,KAAK,CAACO,QAAN,CAAe,EAAf,CAAtB;AAAA,MACIC,gBAAgB,GAAGT,cAAc,CAACO,eAAD,EAAkB,CAAlB,CADrC;AAAA,MAEIG,QAAQ,GAAGD,gBAAgB,CAAC,CAAD,CAF/B;AAAA,MAGIE,WAAW,GAAGF,gBAAgB,CAAC,CAAD,CAHlC;;AAKA,WAASG,MAAT,CAAgBC,WAAhB,EAA6B;AAC3BT,IAAAA,oBAAoB,CAACU,GAArB,CAAyBD,WAAzB,EAAsC,UAAUE,GAAV,EAAeC,KAAf,EAAsB;AAC1D,UAAIC,GAAG,GAAGD,KAAK,CAACC,GAAhB;;AAEA,UAAIF,GAAG,IAAI,CAACV,UAAU,CAACa,OAAX,CAAmBD,GAAnB,CAAZ,EAAqC;AACnC,YAAIE,SAAS,GAAGlB,KAAK,CAACmB,aAAN,CAAoBlB,MAApB,EAA4BmB,MAAM,CAACC,MAAP,CAAc,EAAd,EAAkBN,KAAlB,EAAyB;AACnEO,UAAAA,MAAM,EAAER;AAD2D,SAAzB,CAA5B,CAAhB;AAGAV,QAAAA,UAAU,CAACa,OAAX,CAAmBD,GAAnB,IAA0BE,SAA1B;AACAR,QAAAA,WAAW,CAAC,UAAUa,cAAV,EAA0B;AACpC,iBAAO,GAAGC,MAAH,CAAU1B,kBAAkB,CAACyB,cAAD,CAA5B,EAA8C,CAACL,SAAD,CAA9C,CAAP;AACD,SAFU,CAAX;AAGD;AACF,KAZD;AAaD;;AAED,SAAO,CAACP,MAAD,EAASX,KAAK,CAACmB,aAAN,CAAoBnB,KAAK,CAACyB,QAA1B,EAAoC,IAApC,EAA0ChB,QAA1C,CAAT,CAAP;AACD","sourcesContent":["import _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport * as React from 'react';\nimport Notice from './Notice';\nexport default function useNotification(notificationInstance) {\n  var createdRef = React.useRef({});\n\n  var _React$useState = React.useState([]),\n      _React$useState2 = _slicedToArray(_React$useState, 2),\n      elements = _React$useState2[0],\n      setElements = _React$useState2[1];\n\n  function notify(noticeProps) {\n    notificationInstance.add(noticeProps, function (div, props) {\n      var key = props.key;\n\n      if (div && !createdRef.current[key]) {\n        var noticeEle = React.createElement(Notice, Object.assign({}, props, {\n          holder: div\n        }));\n        createdRef.current[key] = noticeEle;\n        setElements(function (originElements) {\n          return [].concat(_toConsumableArray(originElements), [noticeEle]);\n        });\n      }\n    });\n  }\n\n  return [notify, React.createElement(React.Fragment, null, elements)];\n}"]},"metadata":{},"sourceType":"module"}