70af1b1b9345b574250ff0b67b1a823f.json 35.6 KB
{"ast":null,"code":"import _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport ResizeObserver from 'resize-observer-polyfill';\nimport SubMenu from './SubMenu';\nimport { getWidth, setStyle, menuAllProps } from './util';\nvar MENUITEM_OVERFLOWED_CLASSNAME = 'menuitem-overflowed';\nvar FLOAT_PRECISION_ADJUST = 0.5;\n\nvar DOMWrap = /*#__PURE__*/function (_React$Component) {\n  _inherits(DOMWrap, _React$Component);\n\n  var _super = _createSuper(DOMWrap);\n\n  function DOMWrap() {\n    var _this;\n\n    _classCallCheck(this, DOMWrap);\n\n    _this = _super.apply(this, arguments);\n    _this.resizeObserver = null;\n    _this.mutationObserver = null; // original scroll size of the list\n\n    _this.originalTotalWidth = 0; // copy of overflowed items\n\n    _this.overflowedItems = []; // cache item of the original items (so we can track the size and order)\n\n    _this.menuItemSizes = [];\n    _this.cancelFrameId = null;\n    _this.state = {\n      lastVisibleIndex: undefined\n    }; // get all valid menuItem nodes\n\n    _this.getMenuItemNodes = function () {\n      var prefixCls = _this.props.prefixCls;\n      var ul = ReactDOM.findDOMNode(_assertThisInitialized(_this));\n\n      if (!ul) {\n        return [];\n      } // filter out all overflowed indicator placeholder\n\n\n      return [].slice.call(ul.children).filter(function (node) {\n        return node.className.split(' ').indexOf(\"\".concat(prefixCls, \"-overflowed-submenu\")) < 0;\n      });\n    };\n\n    _this.getOverflowedSubMenuItem = function (keyPrefix, overflowedItems, renderPlaceholder) {\n      var _this$props = _this.props,\n          overflowedIndicator = _this$props.overflowedIndicator,\n          level = _this$props.level,\n          mode = _this$props.mode,\n          prefixCls = _this$props.prefixCls,\n          theme = _this$props.theme;\n\n      if (level !== 1 || mode !== 'horizontal') {\n        return null;\n      } // put all the overflowed item inside a submenu\n      // with a title of overflow indicator ('...')\n\n\n      var copy = _this.props.children[0];\n\n      var _copy$props = copy.props,\n          throwAway = _copy$props.children,\n          title = _copy$props.title,\n          propStyle = _copy$props.style,\n          rest = _objectWithoutProperties(_copy$props, [\"children\", \"title\", \"style\"]);\n\n      var style = _objectSpread({}, propStyle);\n\n      var key = \"\".concat(keyPrefix, \"-overflowed-indicator\");\n      var eventKey = \"\".concat(keyPrefix, \"-overflowed-indicator\");\n\n      if (overflowedItems.length === 0 && renderPlaceholder !== true) {\n        style = _objectSpread(_objectSpread({}, style), {}, {\n          display: 'none'\n        });\n      } else if (renderPlaceholder) {\n        style = _objectSpread(_objectSpread({}, style), {}, {\n          visibility: 'hidden',\n          // prevent from taking normal dom space\n          position: 'absolute'\n        });\n        key = \"\".concat(key, \"-placeholder\");\n        eventKey = \"\".concat(eventKey, \"-placeholder\");\n      }\n\n      var popupClassName = theme ? \"\".concat(prefixCls, \"-\").concat(theme) : '';\n      var props = {};\n      menuAllProps.forEach(function (k) {\n        if (rest[k] !== undefined) {\n          props[k] = rest[k];\n        }\n      });\n      return React.createElement(SubMenu, Object.assign({\n        title: overflowedIndicator,\n        className: \"\".concat(prefixCls, \"-overflowed-submenu\"),\n        popupClassName: popupClassName\n      }, props, {\n        key: key,\n        eventKey: eventKey,\n        disabled: false,\n        style: style\n      }), overflowedItems);\n    }; // memorize rendered menuSize\n\n\n    _this.setChildrenWidthAndResize = function () {\n      if (_this.props.mode !== 'horizontal') {\n        return;\n      }\n\n      var ul = ReactDOM.findDOMNode(_assertThisInitialized(_this));\n\n      if (!ul) {\n        return;\n      }\n\n      var ulChildrenNodes = ul.children;\n\n      if (!ulChildrenNodes || ulChildrenNodes.length === 0) {\n        return;\n      }\n\n      var lastOverflowedIndicatorPlaceholder = ul.children[ulChildrenNodes.length - 1]; // need last overflowed indicator for calculating length;\n\n      setStyle(lastOverflowedIndicatorPlaceholder, 'display', 'inline-block');\n\n      var menuItemNodes = _this.getMenuItemNodes(); // reset display attribute for all hidden elements caused by overflow to calculate updated width\n      // and then reset to original state after width calculation\n\n\n      var overflowedItems = menuItemNodes.filter(function (c) {\n        return c.className.split(' ').indexOf(MENUITEM_OVERFLOWED_CLASSNAME) >= 0;\n      });\n      overflowedItems.forEach(function (c) {\n        setStyle(c, 'display', 'inline-block');\n      });\n      _this.menuItemSizes = menuItemNodes.map(function (c) {\n        return getWidth(c, true);\n      });\n      overflowedItems.forEach(function (c) {\n        setStyle(c, 'display', 'none');\n      });\n      _this.overflowedIndicatorWidth = getWidth(ul.children[ul.children.length - 1], true);\n      _this.originalTotalWidth = _this.menuItemSizes.reduce(function (acc, cur) {\n        return acc + cur;\n      }, 0);\n\n      _this.handleResize(); // prevent the overflowed indicator from taking space;\n\n\n      setStyle(lastOverflowedIndicatorPlaceholder, 'display', 'none');\n    };\n\n    _this.handleResize = function () {\n      if (_this.props.mode !== 'horizontal') {\n        return;\n      }\n\n      var ul = ReactDOM.findDOMNode(_assertThisInitialized(_this));\n\n      if (!ul) {\n        return;\n      }\n\n      var width = getWidth(ul);\n      _this.overflowedItems = [];\n      var currentSumWidth = 0; // index for last visible child in horizontal mode\n\n      var lastVisibleIndex; // float number comparison could be problematic\n      // e.g. 0.1 + 0.2 > 0.3 =====> true\n      // thus using FLOAT_PRECISION_ADJUST as buffer to help the situation\n\n      if (_this.originalTotalWidth > width + FLOAT_PRECISION_ADJUST) {\n        lastVisibleIndex = -1;\n\n        _this.menuItemSizes.forEach(function (liWidth) {\n          currentSumWidth += liWidth;\n\n          if (currentSumWidth + _this.overflowedIndicatorWidth <= width) {\n            lastVisibleIndex += 1;\n          }\n        });\n      }\n\n      _this.setState({\n        lastVisibleIndex: lastVisibleIndex\n      });\n    };\n\n    return _this;\n  }\n\n  _createClass(DOMWrap, [{\n    key: \"componentDidMount\",\n    value: function componentDidMount() {\n      var _this2 = this;\n\n      this.setChildrenWidthAndResize();\n\n      if (this.props.level === 1 && this.props.mode === 'horizontal') {\n        var menuUl = ReactDOM.findDOMNode(this);\n\n        if (!menuUl) {\n          return;\n        }\n\n        this.resizeObserver = new ResizeObserver(function (entries) {\n          entries.forEach(function () {\n            var cancelFrameId = _this2.cancelFrameId;\n            cancelAnimationFrame(cancelFrameId);\n            _this2.cancelFrameId = requestAnimationFrame(_this2.setChildrenWidthAndResize);\n          });\n        });\n        [].slice.call(menuUl.children).concat(menuUl).forEach(function (el) {\n          _this2.resizeObserver.observe(el);\n        });\n\n        if (typeof MutationObserver !== 'undefined') {\n          this.mutationObserver = new MutationObserver(function () {\n            _this2.resizeObserver.disconnect();\n\n            [].slice.call(menuUl.children).concat(menuUl).forEach(function (el) {\n              _this2.resizeObserver.observe(el);\n            });\n\n            _this2.setChildrenWidthAndResize();\n          });\n          this.mutationObserver.observe(menuUl, {\n            attributes: false,\n            childList: true,\n            subTree: false\n          });\n        }\n      }\n    }\n  }, {\n    key: \"componentWillUnmount\",\n    value: function componentWillUnmount() {\n      if (this.resizeObserver) {\n        this.resizeObserver.disconnect();\n      }\n\n      if (this.mutationObserver) {\n        this.mutationObserver.disconnect();\n      }\n\n      cancelAnimationFrame(this.cancelFrameId);\n    }\n  }, {\n    key: \"renderChildren\",\n    value: function renderChildren(children) {\n      var _this3 = this; // need to take care of overflowed items in horizontal mode\n\n\n      var lastVisibleIndex = this.state.lastVisibleIndex;\n      return (children || []).reduce(function (acc, childNode, index) {\n        var item = childNode;\n\n        if (_this3.props.mode === 'horizontal') {\n          var overflowed = _this3.getOverflowedSubMenuItem(childNode.props.eventKey, []);\n\n          if (lastVisibleIndex !== undefined && _this3.props.className.indexOf(\"\".concat(_this3.props.prefixCls, \"-root\")) !== -1) {\n            if (index > lastVisibleIndex) {\n              item = React.cloneElement(childNode, // 这里修改 eventKey 是为了防止隐藏状态下还会触发 openkeys 事件\n              {\n                style: {\n                  display: 'none'\n                },\n                eventKey: \"\".concat(childNode.props.eventKey, \"-hidden\"),\n\n                /**\n                 * Legacy code. Here `className` never used:\n                 * https://github.com/react-component/menu/commit/4cd6b49fce9d116726f4ea00dda85325d6f26500#diff-e2fa48f75c2dd2318295cde428556a76R240\n                 */\n                className: \"\".concat(MENUITEM_OVERFLOWED_CLASSNAME)\n              });\n            }\n\n            if (index === lastVisibleIndex + 1) {\n              _this3.overflowedItems = children.slice(lastVisibleIndex + 1).map(function (c) {\n                return React.cloneElement(c, // children[index].key will become '.$key' in clone by default,\n                // we have to overwrite with the correct key explicitly\n                {\n                  key: c.props.eventKey,\n                  mode: 'vertical-left'\n                });\n              });\n              overflowed = _this3.getOverflowedSubMenuItem(childNode.props.eventKey, _this3.overflowedItems);\n            }\n          }\n\n          var ret = [].concat(_toConsumableArray(acc), [overflowed, item]);\n\n          if (index === children.length - 1) {\n            // need a placeholder for calculating overflowed indicator width\n            ret.push(_this3.getOverflowedSubMenuItem(childNode.props.eventKey, [], true));\n          }\n\n          return ret;\n        }\n\n        return [].concat(_toConsumableArray(acc), [item]);\n      }, []);\n    }\n  }, {\n    key: \"render\",\n    value: function render() {\n      var _this$props2 = this.props,\n          visible = _this$props2.visible,\n          prefixCls = _this$props2.prefixCls,\n          overflowedIndicator = _this$props2.overflowedIndicator,\n          mode = _this$props2.mode,\n          level = _this$props2.level,\n          tag = _this$props2.tag,\n          children = _this$props2.children,\n          theme = _this$props2.theme,\n          rest = _objectWithoutProperties(_this$props2, [\"visible\", \"prefixCls\", \"overflowedIndicator\", \"mode\", \"level\", \"tag\", \"children\", \"theme\"]);\n\n      var Tag = tag;\n      return React.createElement(Tag, Object.assign({}, rest), this.renderChildren(children));\n    }\n  }]);\n\n  return DOMWrap;\n}(React.Component);\n\nDOMWrap.defaultProps = {\n  tag: 'div',\n  className: ''\n};\nexport default DOMWrap;","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/rc-menu/es/DOMWrap.js"],"names":["_toConsumableArray","_objectSpread","_objectWithoutProperties","_classCallCheck","_createClass","_assertThisInitialized","_inherits","_createSuper","React","ReactDOM","ResizeObserver","SubMenu","getWidth","setStyle","menuAllProps","MENUITEM_OVERFLOWED_CLASSNAME","FLOAT_PRECISION_ADJUST","DOMWrap","_React$Component","_super","_this","apply","arguments","resizeObserver","mutationObserver","originalTotalWidth","overflowedItems","menuItemSizes","cancelFrameId","state","lastVisibleIndex","undefined","getMenuItemNodes","prefixCls","props","ul","findDOMNode","slice","call","children","filter","node","className","split","indexOf","concat","getOverflowedSubMenuItem","keyPrefix","renderPlaceholder","_this$props","overflowedIndicator","level","mode","theme","copy","_copy$props","throwAway","title","propStyle","style","rest","key","eventKey","length","display","visibility","position","popupClassName","forEach","k","createElement","Object","assign","disabled","setChildrenWidthAndResize","ulChildrenNodes","lastOverflowedIndicatorPlaceholder","menuItemNodes","c","map","overflowedIndicatorWidth","reduce","acc","cur","handleResize","width","currentSumWidth","liWidth","setState","value","componentDidMount","_this2","menuUl","entries","cancelAnimationFrame","requestAnimationFrame","el","observe","MutationObserver","disconnect","attributes","childList","subTree","componentWillUnmount","renderChildren","_this3","childNode","index","item","overflowed","cloneElement","ret","push","render","_this$props2","visible","tag","Tag","Component","defaultProps"],"mappings":"AAAA,OAAOA,kBAAP,MAA+B,8CAA/B;AACA,OAAOC,aAAP,MAA0B,0CAA1B;AACA,OAAOC,wBAAP,MAAqC,oDAArC;AACA,OAAOC,eAAP,MAA4B,2CAA5B;AACA,OAAOC,YAAP,MAAyB,wCAAzB;AACA,OAAOC,sBAAP,MAAmC,kDAAnC;AACA,OAAOC,SAAP,MAAsB,qCAAtB;AACA,OAAOC,YAAP,MAAyB,wCAAzB;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,OAAO,KAAKC,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,OAD3B;AAAA,UAEIlF,SAAS,GAAGiF,YAAY,CAACjF,SAF7B;AAAA,UAGIiB,mBAAmB,GAAGgE,YAAY,CAAChE,mBAHvC;AAAA,UAIIE,IAAI,GAAG8D,YAAY,CAAC9D,IAJxB;AAAA,UAKID,KAAK,GAAG+D,YAAY,CAAC/D,KALzB;AAAA,UAMIiE,GAAG,GAAGF,YAAY,CAACE,GANvB;AAAA,UAOI7E,QAAQ,GAAG2E,YAAY,CAAC3E,QAP5B;AAAA,UAQIc,KAAK,GAAG6D,YAAY,CAAC7D,KARzB;AAAA,UASIO,IAAI,GAAG1D,wBAAwB,CAACgH,YAAD,EAAe,CAAC,SAAD,EAAY,WAAZ,EAAyB,qBAAzB,EAAgD,MAAhD,EAAwD,OAAxD,EAAiE,KAAjE,EAAwE,UAAxE,EAAoF,OAApF,CAAf,CATnC;;AAWA,UAAIG,GAAG,GAAGD,GAAV;AACA,aAAO5G,KAAK,CAAC8D,aAAN,CAAoB+C,GAApB,EAAyB9C,MAAM,CAACC,MAAP,CAAc,EAAd,EAAkBZ,IAAlB,CAAzB,EAAkD,KAAK4C,cAAL,CAAoBjE,QAApB,CAAlD,CAAP;AACD;AAhBA,GAhHmB,CAAV,CAAZ;;AAmIA,SAAOtB,OAAP;AACD,CA9T0B,CA8TzBT,KAAK,CAAC8G,SA9TmB,CAA3B;;AAgUArG,OAAO,CAACsG,YAAR,GAAuB;AACrBH,EAAAA,GAAG,EAAE,KADgB;AAErB1E,EAAAA,SAAS,EAAE;AAFU,CAAvB;AAIA,eAAezB,OAAf","sourcesContent":["import _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport ResizeObserver from 'resize-observer-polyfill';\nimport SubMenu from './SubMenu';\nimport { getWidth, setStyle, menuAllProps } from './util';\nvar MENUITEM_OVERFLOWED_CLASSNAME = 'menuitem-overflowed';\nvar FLOAT_PRECISION_ADJUST = 0.5;\n\nvar DOMWrap = /*#__PURE__*/function (_React$Component) {\n  _inherits(DOMWrap, _React$Component);\n\n  var _super = _createSuper(DOMWrap);\n\n  function DOMWrap() {\n    var _this;\n\n    _classCallCheck(this, DOMWrap);\n\n    _this = _super.apply(this, arguments);\n    _this.resizeObserver = null;\n    _this.mutationObserver = null; // original scroll size of the list\n\n    _this.originalTotalWidth = 0; // copy of overflowed items\n\n    _this.overflowedItems = []; // cache item of the original items (so we can track the size and order)\n\n    _this.menuItemSizes = [];\n    _this.cancelFrameId = null;\n    _this.state = {\n      lastVisibleIndex: undefined\n    }; // get all valid menuItem nodes\n\n    _this.getMenuItemNodes = function () {\n      var prefixCls = _this.props.prefixCls;\n      var ul = ReactDOM.findDOMNode(_assertThisInitialized(_this));\n\n      if (!ul) {\n        return [];\n      } // filter out all overflowed indicator placeholder\n\n\n      return [].slice.call(ul.children).filter(function (node) {\n        return node.className.split(' ').indexOf(\"\".concat(prefixCls, \"-overflowed-submenu\")) < 0;\n      });\n    };\n\n    _this.getOverflowedSubMenuItem = function (keyPrefix, overflowedItems, renderPlaceholder) {\n      var _this$props = _this.props,\n          overflowedIndicator = _this$props.overflowedIndicator,\n          level = _this$props.level,\n          mode = _this$props.mode,\n          prefixCls = _this$props.prefixCls,\n          theme = _this$props.theme;\n\n      if (level !== 1 || mode !== 'horizontal') {\n        return null;\n      } // put all the overflowed item inside a submenu\n      // with a title of overflow indicator ('...')\n\n\n      var copy = _this.props.children[0];\n\n      var _copy$props = copy.props,\n          throwAway = _copy$props.children,\n          title = _copy$props.title,\n          propStyle = _copy$props.style,\n          rest = _objectWithoutProperties(_copy$props, [\"children\", \"title\", \"style\"]);\n\n      var style = _objectSpread({}, propStyle);\n\n      var key = \"\".concat(keyPrefix, \"-overflowed-indicator\");\n      var eventKey = \"\".concat(keyPrefix, \"-overflowed-indicator\");\n\n      if (overflowedItems.length === 0 && renderPlaceholder !== true) {\n        style = _objectSpread(_objectSpread({}, style), {}, {\n          display: 'none'\n        });\n      } else if (renderPlaceholder) {\n        style = _objectSpread(_objectSpread({}, style), {}, {\n          visibility: 'hidden',\n          // prevent from taking normal dom space\n          position: 'absolute'\n        });\n        key = \"\".concat(key, \"-placeholder\");\n        eventKey = \"\".concat(eventKey, \"-placeholder\");\n      }\n\n      var popupClassName = theme ? \"\".concat(prefixCls, \"-\").concat(theme) : '';\n      var props = {};\n      menuAllProps.forEach(function (k) {\n        if (rest[k] !== undefined) {\n          props[k] = rest[k];\n        }\n      });\n      return React.createElement(SubMenu, Object.assign({\n        title: overflowedIndicator,\n        className: \"\".concat(prefixCls, \"-overflowed-submenu\"),\n        popupClassName: popupClassName\n      }, props, {\n        key: key,\n        eventKey: eventKey,\n        disabled: false,\n        style: style\n      }), overflowedItems);\n    }; // memorize rendered menuSize\n\n\n    _this.setChildrenWidthAndResize = function () {\n      if (_this.props.mode !== 'horizontal') {\n        return;\n      }\n\n      var ul = ReactDOM.findDOMNode(_assertThisInitialized(_this));\n\n      if (!ul) {\n        return;\n      }\n\n      var ulChildrenNodes = ul.children;\n\n      if (!ulChildrenNodes || ulChildrenNodes.length === 0) {\n        return;\n      }\n\n      var lastOverflowedIndicatorPlaceholder = ul.children[ulChildrenNodes.length - 1]; // need last overflowed indicator for calculating length;\n\n      setStyle(lastOverflowedIndicatorPlaceholder, 'display', 'inline-block');\n\n      var menuItemNodes = _this.getMenuItemNodes(); // reset display attribute for all hidden elements caused by overflow to calculate updated width\n      // and then reset to original state after width calculation\n\n\n      var overflowedItems = menuItemNodes.filter(function (c) {\n        return c.className.split(' ').indexOf(MENUITEM_OVERFLOWED_CLASSNAME) >= 0;\n      });\n      overflowedItems.forEach(function (c) {\n        setStyle(c, 'display', 'inline-block');\n      });\n      _this.menuItemSizes = menuItemNodes.map(function (c) {\n        return getWidth(c, true);\n      });\n      overflowedItems.forEach(function (c) {\n        setStyle(c, 'display', 'none');\n      });\n      _this.overflowedIndicatorWidth = getWidth(ul.children[ul.children.length - 1], true);\n      _this.originalTotalWidth = _this.menuItemSizes.reduce(function (acc, cur) {\n        return acc + cur;\n      }, 0);\n\n      _this.handleResize(); // prevent the overflowed indicator from taking space;\n\n\n      setStyle(lastOverflowedIndicatorPlaceholder, 'display', 'none');\n    };\n\n    _this.handleResize = function () {\n      if (_this.props.mode !== 'horizontal') {\n        return;\n      }\n\n      var ul = ReactDOM.findDOMNode(_assertThisInitialized(_this));\n\n      if (!ul) {\n        return;\n      }\n\n      var width = getWidth(ul);\n      _this.overflowedItems = [];\n      var currentSumWidth = 0; // index for last visible child in horizontal mode\n\n      var lastVisibleIndex; // float number comparison could be problematic\n      // e.g. 0.1 + 0.2 > 0.3 =====> true\n      // thus using FLOAT_PRECISION_ADJUST as buffer to help the situation\n\n      if (_this.originalTotalWidth > width + FLOAT_PRECISION_ADJUST) {\n        lastVisibleIndex = -1;\n\n        _this.menuItemSizes.forEach(function (liWidth) {\n          currentSumWidth += liWidth;\n\n          if (currentSumWidth + _this.overflowedIndicatorWidth <= width) {\n            lastVisibleIndex += 1;\n          }\n        });\n      }\n\n      _this.setState({\n        lastVisibleIndex: lastVisibleIndex\n      });\n    };\n\n    return _this;\n  }\n\n  _createClass(DOMWrap, [{\n    key: \"componentDidMount\",\n    value: function componentDidMount() {\n      var _this2 = this;\n\n      this.setChildrenWidthAndResize();\n\n      if (this.props.level === 1 && this.props.mode === 'horizontal') {\n        var menuUl = ReactDOM.findDOMNode(this);\n\n        if (!menuUl) {\n          return;\n        }\n\n        this.resizeObserver = new ResizeObserver(function (entries) {\n          entries.forEach(function () {\n            var cancelFrameId = _this2.cancelFrameId;\n            cancelAnimationFrame(cancelFrameId);\n            _this2.cancelFrameId = requestAnimationFrame(_this2.setChildrenWidthAndResize);\n          });\n        });\n        [].slice.call(menuUl.children).concat(menuUl).forEach(function (el) {\n          _this2.resizeObserver.observe(el);\n        });\n\n        if (typeof MutationObserver !== 'undefined') {\n          this.mutationObserver = new MutationObserver(function () {\n            _this2.resizeObserver.disconnect();\n\n            [].slice.call(menuUl.children).concat(menuUl).forEach(function (el) {\n              _this2.resizeObserver.observe(el);\n            });\n\n            _this2.setChildrenWidthAndResize();\n          });\n          this.mutationObserver.observe(menuUl, {\n            attributes: false,\n            childList: true,\n            subTree: false\n          });\n        }\n      }\n    }\n  }, {\n    key: \"componentWillUnmount\",\n    value: function componentWillUnmount() {\n      if (this.resizeObserver) {\n        this.resizeObserver.disconnect();\n      }\n\n      if (this.mutationObserver) {\n        this.mutationObserver.disconnect();\n      }\n\n      cancelAnimationFrame(this.cancelFrameId);\n    }\n  }, {\n    key: \"renderChildren\",\n    value: function renderChildren(children) {\n      var _this3 = this;\n\n      // need to take care of overflowed items in horizontal mode\n      var lastVisibleIndex = this.state.lastVisibleIndex;\n      return (children || []).reduce(function (acc, childNode, index) {\n        var item = childNode;\n\n        if (_this3.props.mode === 'horizontal') {\n          var overflowed = _this3.getOverflowedSubMenuItem(childNode.props.eventKey, []);\n\n          if (lastVisibleIndex !== undefined && _this3.props.className.indexOf(\"\".concat(_this3.props.prefixCls, \"-root\")) !== -1) {\n            if (index > lastVisibleIndex) {\n              item = React.cloneElement(childNode, // 这里修改 eventKey 是为了防止隐藏状态下还会触发 openkeys 事件\n              {\n                style: {\n                  display: 'none'\n                },\n                eventKey: \"\".concat(childNode.props.eventKey, \"-hidden\"),\n\n                /**\n                 * Legacy code. Here `className` never used:\n                 * https://github.com/react-component/menu/commit/4cd6b49fce9d116726f4ea00dda85325d6f26500#diff-e2fa48f75c2dd2318295cde428556a76R240\n                 */\n                className: \"\".concat(MENUITEM_OVERFLOWED_CLASSNAME)\n              });\n            }\n\n            if (index === lastVisibleIndex + 1) {\n              _this3.overflowedItems = children.slice(lastVisibleIndex + 1).map(function (c) {\n                return React.cloneElement(c, // children[index].key will become '.$key' in clone by default,\n                // we have to overwrite with the correct key explicitly\n                {\n                  key: c.props.eventKey,\n                  mode: 'vertical-left'\n                });\n              });\n              overflowed = _this3.getOverflowedSubMenuItem(childNode.props.eventKey, _this3.overflowedItems);\n            }\n          }\n\n          var ret = [].concat(_toConsumableArray(acc), [overflowed, item]);\n\n          if (index === children.length - 1) {\n            // need a placeholder for calculating overflowed indicator width\n            ret.push(_this3.getOverflowedSubMenuItem(childNode.props.eventKey, [], true));\n          }\n\n          return ret;\n        }\n\n        return [].concat(_toConsumableArray(acc), [item]);\n      }, []);\n    }\n  }, {\n    key: \"render\",\n    value: function render() {\n      var _this$props2 = this.props,\n          visible = _this$props2.visible,\n          prefixCls = _this$props2.prefixCls,\n          overflowedIndicator = _this$props2.overflowedIndicator,\n          mode = _this$props2.mode,\n          level = _this$props2.level,\n          tag = _this$props2.tag,\n          children = _this$props2.children,\n          theme = _this$props2.theme,\n          rest = _objectWithoutProperties(_this$props2, [\"visible\", \"prefixCls\", \"overflowedIndicator\", \"mode\", \"level\", \"tag\", \"children\", \"theme\"]);\n\n      var Tag = tag;\n      return React.createElement(Tag, Object.assign({}, rest), this.renderChildren(children));\n    }\n  }]);\n\n  return DOMWrap;\n}(React.Component);\n\nDOMWrap.defaultProps = {\n  tag: 'div',\n  className: ''\n};\nexport default DOMWrap;"]},"metadata":{},"sourceType":"module"}