d757b64a0c7c3e984401aef5596a0b42.json 8.51 KB
{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/extends\";\nimport _classCallCheck from \"@babel/runtime/helpers/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/createClass\";\nimport _inherits from \"@babel/runtime/helpers/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/createSuper\";\nimport * as React from 'react';\nimport { SubMenu as RcSubMenu } from 'rc-menu';\nimport classNames from 'classnames';\nimport omit from 'omit.js';\nimport MenuContext from './MenuContext';\nimport { isValidElement } from '../_util/reactNode';\n\nvar SubMenu = /*#__PURE__*/function (_React$Component) {\n  _inherits(SubMenu, _React$Component);\n\n  var _super = _createSuper(SubMenu);\n\n  function SubMenu() {\n    _classCallCheck(this, SubMenu);\n\n    return _super.apply(this, arguments);\n  }\n\n  _createClass(SubMenu, [{\n    key: \"renderTitle\",\n    value: function renderTitle(inlineCollapsed) {\n      var _this$props = this.props,\n          icon = _this$props.icon,\n          title = _this$props.title,\n          level = _this$props.level,\n          rootPrefixCls = _this$props.rootPrefixCls;\n\n      if (!icon) {\n        return inlineCollapsed && level === 1 && title && typeof title === 'string' ? /*#__PURE__*/React.createElement(\"div\", {\n          className: \"\".concat(rootPrefixCls, \"-inline-collapsed-noicon\")\n        }, title.charAt(0)) : title;\n      } // inline-collapsed.md demo 依赖 span 来隐藏文字,有 icon 属性,则内部包裹一个 span\n      // ref: https://github.com/ant-design/ant-design/pull/23456\n\n\n      var titleIsSpan = isValidElement(title) && title.type === 'span';\n      return /*#__PURE__*/React.createElement(React.Fragment, null, icon, titleIsSpan ? title : /*#__PURE__*/React.createElement(\"span\", null, title));\n    }\n  }, {\n    key: \"render\",\n    value: function render() {\n      var _this = this;\n\n      var _this$props2 = this.props,\n          rootPrefixCls = _this$props2.rootPrefixCls,\n          popupClassName = _this$props2.popupClassName;\n      return /*#__PURE__*/React.createElement(MenuContext.Consumer, null, function (_ref) {\n        var inlineCollapsed = _ref.inlineCollapsed,\n            antdMenuTheme = _ref.antdMenuTheme;\n        return /*#__PURE__*/React.createElement(RcSubMenu, _extends({}, omit(_this.props, ['icon']), {\n          title: _this.renderTitle(inlineCollapsed),\n          popupClassName: classNames(rootPrefixCls, \"\".concat(rootPrefixCls, \"-\").concat(antdMenuTheme), popupClassName)\n        }));\n      });\n    }\n  }]);\n\n  return SubMenu;\n}(React.Component);\n\nSubMenu.contextType = MenuContext; // fix issue:https://github.com/ant-design/ant-design/issues/8666\n\nSubMenu.isSubMenu = 1;\nexport default SubMenu;","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/antd/es/menu/SubMenu.js"],"names":["_extends","_classCallCheck","_createClass","_inherits","_createSuper","React","SubMenu","RcSubMenu","classNames","omit","MenuContext","isValidElement","_React$Component","_super","apply","arguments","key","value","renderTitle","inlineCollapsed","_this$props","props","icon","title","level","rootPrefixCls","createElement","className","concat","charAt","titleIsSpan","type","Fragment","render","_this","_this$props2","popupClassName","Consumer","_ref","antdMenuTheme","Component","contextType","isSubMenu"],"mappings":"AAAA,OAAOA,QAAP,MAAqB,gCAArB;AACA,OAAOC,eAAP,MAA4B,uCAA5B;AACA,OAAOC,YAAP,MAAyB,oCAAzB;AACA,OAAOC,SAAP,MAAsB,iCAAtB;AACA,OAAOC,YAAP,MAAyB,oCAAzB;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,SAASC,OAAO,IAAIC,SAApB,QAAqC,SAArC;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,IAAP,MAAiB,SAAjB;AACA,OAAOC,WAAP,MAAwB,eAAxB;AACA,SAASC,cAAT,QAA+B,oBAA/B;;AAEA,IAAIL,OAAO,GAAG,aAAa,UAAUM,gBAAV,EAA4B;AACrDT,EAAAA,SAAS,CAACG,OAAD,EAAUM,gBAAV,CAAT;;AAEA,MAAIC,MAAM,GAAGT,YAAY,CAACE,OAAD,CAAzB;;AAEA,WAASA,OAAT,GAAmB;AACjBL,IAAA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T,GAAkB;AACvB,UAAIC,KAAK,GAAG,IAAZ;;AAEA,UAAIC,YAAY,GAAG,KAAKd,KAAxB;AAAA,UACII,aAAa,GAAGU,YAAY,CAACV,aADjC;AAAA,UAEIW,cAAc,GAAGD,YAAY,CAACC,cAFlC;AAGA,aAAO,aAAa/B,KAAK,CAACqB,aAAN,CAAoBhB,WAAW,CAAC2B,QAAhC,EAA0C,IAA1C,EAAgD,UAAUC,IAAV,EAAgB;AAClF,YAAInB,eAAe,GAAGmB,IAAI,CAACnB,eAA3B;AAAA,YACIoB,aAAa,GAAGD,IAAI,CAACC,aADzB;AAEA,eAAO,aAAalC,KAAK,CAACqB,aAAN,CAAoBnB,SAApB,EAA+BP,QAAQ,CAAC,EAAD,EAAKS,IAAI,CAACyB,KAAK,CAACb,KAAP,EAAc,CAAC,MAAD,CAAd,CAAT,EAAkC;AAC3FE,UAAAA,KAAK,EAAEW,KAAK,CAAChB,WAAN,CAAkBC,eAAlB,CADoF;AAE3FiB,UAAAA,cAAc,EAAE5B,UAAU,CAACiB,aAAD,EAAgB,GAAGG,MAAH,CAAUH,aAAV,EAAyB,GAAzB,EAA8BG,MAA9B,CAAqCW,aAArC,CAAhB,EAAqEH,cAArE;AAFiE,SAAlC,CAAvC,CAApB;AAID,OAPmB,CAApB;AAQD;AAhBA,GApBmB,CAAV,CAAZ;;AAuCA,SAAO9B,OAAP;AACD,CAnD0B,CAmDzBD,KAAK,CAACmC,SAnDmB,CAA3B;;AAqDAlC,OAAO,CAACmC,WAAR,GAAsB/B,WAAtB,C,CAAmC;;AAEnCJ,OAAO,CAACoC,SAAR,GAAoB,CAApB;AACA,eAAepC,OAAf","sourcesContent":["import _extends from \"@babel/runtime/helpers/extends\";\nimport _classCallCheck from \"@babel/runtime/helpers/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/createClass\";\nimport _inherits from \"@babel/runtime/helpers/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/createSuper\";\nimport * as React from 'react';\nimport { SubMenu as RcSubMenu } from 'rc-menu';\nimport classNames from 'classnames';\nimport omit from 'omit.js';\nimport MenuContext from './MenuContext';\nimport { isValidElement } from '../_util/reactNode';\n\nvar SubMenu = /*#__PURE__*/function (_React$Component) {\n  _inherits(SubMenu, _React$Component);\n\n  var _super = _createSuper(SubMenu);\n\n  function SubMenu() {\n    _classCallCheck(this, SubMenu);\n\n    return _super.apply(this, arguments);\n  }\n\n  _createClass(SubMenu, [{\n    key: \"renderTitle\",\n    value: function renderTitle(inlineCollapsed) {\n      var _this$props = this.props,\n          icon = _this$props.icon,\n          title = _this$props.title,\n          level = _this$props.level,\n          rootPrefixCls = _this$props.rootPrefixCls;\n\n      if (!icon) {\n        return inlineCollapsed && level === 1 && title && typeof title === 'string' ? /*#__PURE__*/React.createElement(\"div\", {\n          className: \"\".concat(rootPrefixCls, \"-inline-collapsed-noicon\")\n        }, title.charAt(0)) : title;\n      } // inline-collapsed.md demo 依赖 span 来隐藏文字,有 icon 属性,则内部包裹一个 span\n      // ref: https://github.com/ant-design/ant-design/pull/23456\n\n\n      var titleIsSpan = isValidElement(title) && title.type === 'span';\n      return /*#__PURE__*/React.createElement(React.Fragment, null, icon, titleIsSpan ? title : /*#__PURE__*/React.createElement(\"span\", null, title));\n    }\n  }, {\n    key: \"render\",\n    value: function render() {\n      var _this = this;\n\n      var _this$props2 = this.props,\n          rootPrefixCls = _this$props2.rootPrefixCls,\n          popupClassName = _this$props2.popupClassName;\n      return /*#__PURE__*/React.createElement(MenuContext.Consumer, null, function (_ref) {\n        var inlineCollapsed = _ref.inlineCollapsed,\n            antdMenuTheme = _ref.antdMenuTheme;\n        return /*#__PURE__*/React.createElement(RcSubMenu, _extends({}, omit(_this.props, ['icon']), {\n          title: _this.renderTitle(inlineCollapsed),\n          popupClassName: classNames(rootPrefixCls, \"\".concat(rootPrefixCls, \"-\").concat(antdMenuTheme), popupClassName)\n        }));\n      });\n    }\n  }]);\n\n  return SubMenu;\n}(React.Component);\n\nSubMenu.contextType = MenuContext; // fix issue:https://github.com/ant-design/ant-design/issues/8666\n\nSubMenu.isSubMenu = 1;\nexport default SubMenu;"]},"metadata":{},"sourceType":"module"}