7e34ec24787f043747b7b758faa086a8.json 12.9 KB
{"ast":null,"code":"import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport * as React from 'react';\nimport { Component } from 'react';\nimport ReactDOM from 'react-dom';\nimport classNames from 'classnames';\n\nvar Notice = /*#__PURE__*/function (_Component) {\n  _inherits(Notice, _Component);\n\n  var _super = _createSuper(Notice);\n\n  function Notice() {\n    var _this;\n\n    _classCallCheck(this, Notice);\n\n    _this = _super.apply(this, arguments);\n    _this.closeTimer = null;\n\n    _this.close = function (e) {\n      if (e) {\n        e.stopPropagation();\n      }\n\n      _this.clearCloseTimer();\n\n      var _this$props = _this.props,\n          onClose = _this$props.onClose,\n          noticeKey = _this$props.noticeKey;\n\n      if (onClose) {\n        onClose(noticeKey);\n      }\n    };\n\n    _this.startCloseTimer = function () {\n      if (_this.props.duration) {\n        _this.closeTimer = window.setTimeout(function () {\n          _this.close();\n        }, _this.props.duration * 1000);\n      }\n    };\n\n    _this.clearCloseTimer = function () {\n      if (_this.closeTimer) {\n        clearTimeout(_this.closeTimer);\n        _this.closeTimer = null;\n      }\n    };\n\n    return _this;\n  }\n\n  _createClass(Notice, [{\n    key: \"componentDidMount\",\n    value: function componentDidMount() {\n      this.startCloseTimer();\n    }\n  }, {\n    key: \"componentDidUpdate\",\n    value: function componentDidUpdate(prevProps) {\n      if (this.props.duration !== prevProps.duration || this.props.updateMark !== prevProps.updateMark) {\n        this.restartCloseTimer();\n      }\n    }\n  }, {\n    key: \"componentWillUnmount\",\n    value: function componentWillUnmount() {\n      this.clearCloseTimer();\n    }\n  }, {\n    key: \"restartCloseTimer\",\n    value: function restartCloseTimer() {\n      this.clearCloseTimer();\n      this.startCloseTimer();\n    }\n  }, {\n    key: \"render\",\n    value: function render() {\n      var _this2 = this;\n\n      var _this$props2 = this.props,\n          prefixCls = _this$props2.prefixCls,\n          className = _this$props2.className,\n          closable = _this$props2.closable,\n          closeIcon = _this$props2.closeIcon,\n          style = _this$props2.style,\n          onClick = _this$props2.onClick,\n          children = _this$props2.children,\n          holder = _this$props2.holder;\n      var componentClass = \"\".concat(prefixCls, \"-notice\");\n      var dataOrAriaAttributeProps = Object.keys(this.props).reduce(function (acc, key) {\n        if (key.substr(0, 5) === 'data-' || key.substr(0, 5) === 'aria-' || key === 'role') {\n          acc[key] = _this2.props[key];\n        }\n\n        return acc;\n      }, {});\n      var node = React.createElement(\"div\", Object.assign({\n        className: classNames(componentClass, className, _defineProperty({}, \"\".concat(componentClass, \"-closable\"), closable)),\n        style: style,\n        onMouseEnter: this.clearCloseTimer,\n        onMouseLeave: this.startCloseTimer,\n        onClick: onClick\n      }, dataOrAriaAttributeProps), React.createElement(\"div\", {\n        className: \"\".concat(componentClass, \"-content\")\n      }, children), closable ? React.createElement(\"a\", {\n        tabIndex: 0,\n        onClick: this.close,\n        className: \"\".concat(componentClass, \"-close\")\n      }, closeIcon || React.createElement(\"span\", {\n        className: \"\".concat(componentClass, \"-close-x\")\n      })) : null);\n\n      if (holder) {\n        return ReactDOM.createPortal(node, holder);\n      }\n\n      return node;\n    }\n  }]);\n\n  return Notice;\n}(Component);\n\nexport { Notice as default };\nNotice.defaultProps = {\n  onClose: function onClose() {},\n  duration: 1.5\n};","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/rc-notification/es/Notice.js"],"names":["_defineProperty","_classCallCheck","_createClass","_inherits","_createSuper","React","Component","ReactDOM","classNames","Notice","_Component","_super","_this","apply","arguments","closeTimer","close","e","stopPropagation","clearCloseTimer","_this$props","props","onClose","noticeKey","startCloseTimer","duration","window","setTimeout","clearTimeout","key","value","componentDidMount","componentDidUpdate","prevProps","updateMark","restartCloseTimer","componentWillUnmount","render","_this2","_this$props2","prefixCls","className","closable","closeIcon","style","onClick","children","holder","componentClass","concat","dataOrAriaAttributeProps","Object","keys","reduce","acc","substr","node","createElement","assign","onMouseEnter","onMouseLeave","tabIndex","createPortal","default","defaultProps"],"mappings":"AAAA,OAAOA,eAAP,MAA4B,2CAA5B;AACA,OAAOC,eAAP,MAA4B,2CAA5B;AACA,OAAOC,YAAP,MAAyB,wCAAzB;AACA,OAAOC,SAAP,MAAsB,qCAAtB;AACA,OAAOC,YAAP,MAAyB,wCAAzB;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,SAASC,SAAT,QAA0B,OAA1B;AACA,OAAOC,QAAP,MAAqB,WAArB;AACA,OAAOC,UAAP,MAAuB,YAAvB;;AAEA,IAAIC,MAAM,GAAG,aAAa,UAAUC,UAAV,EAAsB;AAC9CP,EAAAA,SAAS,CAACM,MAAD,EAASC,UAAT,CAAT;;AAEA,MAAIC,MAAM,GAAGP,YAAY,CAACK,MAAD,CAAzB;;AAEA,WAASA,MAAT,GAAkB;AAChB,QAAIG,KAAJ;;AAEAX,IAAAA,eAAe,CAAC,IAAD,EAAOQ,MAAP,CAAf;;AAEAG,IAAAA,KAAK,GAAGD,MAAM,CAACE,KAAP,CAAa,IAAb,EAAmBC,SAAnB,CAAR;AACAF,IAAAA,KAAK,CAACG,UAAN,GAAmB,IAAnB;;AAEAH,IAAAA,KAAK,CAACI,KAAN,GAAc,UAAUC,CAAV,EAAa;AACzB,UAAIA,CAAJ,EAAO;AACLA,QAAAA,CAAC,CAACC,eAAF;AACD;;AAEDN,MAAAA,KAAK,CAACO,eAAN;;AAEA,UAAIC,WAAW,GAAGR,KAAK,CAACS,KAAxB;AAAA,UACIC,OAAO,GAAGF,WAAW,CAACE,OAD1B;AAAA,UAEIC,SAAS,GAAGH,WAAW,CAACG,SAF5B;;AAIA,UAAID,OAAJ,EAAa;AACXA,QAAAA,OAAO,CAACC,SAAD,CAAP;AACD;AACF,KAdD;;AAgBAX,IAAAA,KAAK,CAACY,eAAN,G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Property\";\nimport _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport * as React from 'react';\nimport { Component } from 'react';\nimport ReactDOM from 'react-dom';\nimport classNames from 'classnames';\n\nvar Notice = /*#__PURE__*/function (_Component) {\n  _inherits(Notice, _Component);\n\n  var _super = _createSuper(Notice);\n\n  function Notice() {\n    var _this;\n\n    _classCallCheck(this, Notice);\n\n    _this = _super.apply(this, arguments);\n    _this.closeTimer = null;\n\n    _this.close = function (e) {\n      if (e) {\n        e.stopPropagation();\n      }\n\n      _this.clearCloseTimer();\n\n      var _this$props = _this.props,\n          onClose = _this$props.onClose,\n          noticeKey = _this$props.noticeKey;\n\n      if (onClose) {\n        onClose(noticeKey);\n      }\n    };\n\n    _this.startCloseTimer = function () {\n      if (_this.props.duration) {\n        _this.closeTimer = window.setTimeout(function () {\n          _this.close();\n        }, _this.props.duration * 1000);\n      }\n    };\n\n    _this.clearCloseTimer = function () {\n      if (_this.closeTimer) {\n        clearTimeout(_this.closeTimer);\n        _this.closeTimer = null;\n      }\n    };\n\n    return _this;\n  }\n\n  _createClass(Notice, [{\n    key: \"componentDidMount\",\n    value: function componentDidMount() {\n      this.startCloseTimer();\n    }\n  }, {\n    key: \"componentDidUpdate\",\n    value: function componentDidUpdate(prevProps) {\n      if (this.props.duration !== prevProps.duration || this.props.updateMark !== prevProps.updateMark) {\n        this.restartCloseTimer();\n      }\n    }\n  }, {\n    key: \"componentWillUnmount\",\n    value: function componentWillUnmount() {\n      this.clearCloseTimer();\n    }\n  }, {\n    key: \"restartCloseTimer\",\n    value: function restartCloseTimer() {\n      this.clearCloseTimer();\n      this.startCloseTimer();\n    }\n  }, {\n    key: \"render\",\n    value: function render() {\n      var _this2 = this;\n\n      var _this$props2 = this.props,\n          prefixCls = _this$props2.prefixCls,\n          className = _this$props2.className,\n          closable = _this$props2.closable,\n          closeIcon = _this$props2.closeIcon,\n          style = _this$props2.style,\n          onClick = _this$props2.onClick,\n          children = _this$props2.children,\n          holder = _this$props2.holder;\n      var componentClass = \"\".concat(prefixCls, \"-notice\");\n      var dataOrAriaAttributeProps = Object.keys(this.props).reduce(function (acc, key) {\n        if (key.substr(0, 5) === 'data-' || key.substr(0, 5) === 'aria-' || key === 'role') {\n          acc[key] = _this2.props[key];\n        }\n\n        return acc;\n      }, {});\n      var node = React.createElement(\"div\", Object.assign({\n        className: classNames(componentClass, className, _defineProperty({}, \"\".concat(componentClass, \"-closable\"), closable)),\n        style: style,\n        onMouseEnter: this.clearCloseTimer,\n        onMouseLeave: this.startCloseTimer,\n        onClick: onClick\n      }, dataOrAriaAttributeProps), React.createElement(\"div\", {\n        className: \"\".concat(componentClass, \"-content\")\n      }, children), closable ? React.createElement(\"a\", {\n        tabIndex: 0,\n        onClick: this.close,\n        className: \"\".concat(componentClass, \"-close\")\n      }, closeIcon || React.createElement(\"span\", {\n        className: \"\".concat(componentClass, \"-close-x\")\n      })) : null);\n\n      if (holder) {\n        return ReactDOM.createPortal(node, holder);\n      }\n\n      return node;\n    }\n  }]);\n\n  return Notice;\n}(Component);\n\nexport { Notice as default };\nNotice.defaultProps = {\n  onClose: function onClose() {},\n  duration: 1.5\n};"]},"metadata":{},"sourceType":"module"}