de6b93d81317c2b197047b6f5081f12f.json 37.5 KB
{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/esm/extends\";\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 _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport * as React from 'react';\nimport { connect } from 'mini-store';\nimport KeyCode from \"rc-util/es/KeyCode\";\nimport createChainedFunction from \"rc-util/es/createChainedFunction\";\nimport toArray from \"rc-util/es/Children/toArray\";\nimport shallowEqual from 'shallowequal';\nimport classNames from 'classnames';\nimport { getKeyFromChildrenIndex, loopMenuItem, noop, menuAllProps, isMobileDevice } from './util';\nimport DOMWrap from './DOMWrap';\n\nfunction allDisabled(arr) {\n  if (!arr.length) {\n    return true;\n  }\n\n  return arr.every(function (c) {\n    return !!c.props.disabled;\n  });\n}\n\nfunction updateActiveKey(store, menuId, activeKey) {\n  var state = store.getState();\n  store.setState({\n    activeKey: _objectSpread(_objectSpread({}, state.activeKey), {}, _defineProperty({}, menuId, activeKey))\n  });\n}\n\nfunction getEventKey(props) {\n  // when eventKey not available ,it's menu and return menu id '0-menu-'\n  return props.eventKey || '0-menu-';\n}\n\nexport function getActiveKey(props, originalActiveKey) {\n  var activeKey = originalActiveKey;\n  var children = props.children,\n      eventKey = props.eventKey;\n\n  if (activeKey) {\n    var found;\n    loopMenuItem(children, function (c, i) {\n      if (c && c.props && !c.props.disabled && activeKey === getKeyFromChildrenIndex(c, eventKey, i)) {\n        found = true;\n      }\n    });\n\n    if (found) {\n      return activeKey;\n    }\n  }\n\n  activeKey = null;\n\n  if (props.defaultActiveFirst) {\n    loopMenuItem(children, function (c, i) {\n      if (!activeKey && c && !c.props.disabled) {\n        activeKey = getKeyFromChildrenIndex(c, eventKey, i);\n      }\n    });\n    return activeKey;\n  }\n\n  return activeKey;\n}\nexport function saveRef(c) {\n  if (c) {\n    var index = this.instanceArray.indexOf(c);\n\n    if (index !== -1) {\n      // update component if it's already inside instanceArray\n      this.instanceArray[index] = c;\n    } else {\n      // add component if it's not in instanceArray yet;\n      this.instanceArray.push(c);\n    }\n  }\n}\nexport var SubPopupMenu = /*#__PURE__*/function (_React$Component) {\n  _inherits(SubPopupMenu, _React$Component);\n\n  var _super = _createSuper(SubPopupMenu);\n\n  function SubPopupMenu(props) {\n    var _this;\n\n    _classCallCheck(this, SubPopupMenu);\n\n    _this = _super.call(this, props);\n    /**\n     * all keyboard events callbacks run from here at first\n     *\n     * note:\n     *  This legacy code that `onKeyDown` is called by parent instead of dom self.\n     *  which need return code to check if this event is handled\n     */\n\n    _this.onKeyDown = function (e, callback) {\n      var keyCode = e.keyCode;\n      var handled;\n\n      _this.getFlatInstanceArray().forEach(function (obj) {\n        if (obj && obj.props.active && obj.onKeyDown) {\n          handled = obj.onKeyDown(e);\n        }\n      });\n\n      if (handled) {\n        return 1;\n      }\n\n      var activeItem = null;\n\n      if (keyCode === KeyCode.UP || keyCode === KeyCode.DOWN) {\n        activeItem = _this.step(keyCode === KeyCode.UP ? -1 : 1);\n      }\n\n      if (activeItem) {\n        e.preventDefault();\n        updateActiveKey(_this.props.store, getEventKey(_this.props), activeItem.props.eventKey);\n\n        if (typeof callback === 'function') {\n          callback(activeItem);\n        }\n\n        return 1;\n      }\n\n      return undefined;\n    };\n\n    _this.onItemHover = function (e) {\n      var key = e.key,\n          hover = e.hover;\n      updateActiveKey(_this.props.store, getEventKey(_this.props), hover ? key : null);\n    };\n\n    _this.onDeselect = function (selectInfo) {\n      _this.props.onDeselect(selectInfo);\n    };\n\n    _this.onSelect = function (selectInfo) {\n      _this.props.onSelect(selectInfo);\n    };\n\n    _this.onClick = function (e) {\n      _this.props.onClick(e);\n    };\n\n    _this.onOpenChange = function (e) {\n      _this.props.onOpenChange(e);\n    };\n\n    _this.onDestroy = function (key) {\n      /* istanbul ignore next */\n      _this.props.onDestroy(key);\n    };\n\n    _this.getFlatInstanceArray = function () {\n      return _this.instanceArray;\n    };\n\n    _this.step = function (direction) {\n      var children = _this.getFlatInstanceArray();\n\n      var activeKey = _this.props.store.getState().activeKey[getEventKey(_this.props)];\n\n      var len = children.length;\n\n      if (!len) {\n        return null;\n      }\n\n      if (direction < 0) {\n        children = children.concat().reverse();\n      } // find current activeIndex\n\n\n      var activeIndex = -1;\n      children.every(function (c, ci) {\n        if (c && c.props.eventKey === activeKey) {\n          activeIndex = ci;\n          return false;\n        }\n\n        return true;\n      });\n\n      if (!_this.props.defaultActiveFirst && activeIndex !== -1 && allDisabled(children.slice(activeIndex, len - 1))) {\n        return undefined;\n      }\n\n      var start = (activeIndex + 1) % len;\n      var i = start;\n\n      do {\n        var child = children[i];\n\n        if (!child || child.props.disabled) {\n          i = (i + 1) % len;\n        } else {\n          return child;\n        }\n      } while (i !== start);\n\n      return null;\n    };\n\n    _this.renderCommonMenuItem = function (child, i, extraProps) {\n      var state = _this.props.store.getState();\n\n      var _assertThisInitialize = _assertThisInitialized(_this),\n          props = _assertThisInitialize.props;\n\n      var key = getKeyFromChildrenIndex(child, props.eventKey, i);\n      var childProps = child.props; // https://github.com/ant-design/ant-design/issues/11517#issuecomment-477403055\n\n      if (!childProps || typeof child.type === 'string') {\n        return child;\n      }\n\n      var isActive = key === state.activeKey;\n\n      var newChildProps = _objectSpread(_objectSpread({\n        mode: childProps.mode || props.mode,\n        level: props.level,\n        inlineIndent: props.inlineIndent,\n        renderMenuItem: _this.renderMenuItem,\n        rootPrefixCls: props.prefixCls,\n        index: i,\n        parentMenu: props.parentMenu,\n        // customized ref function, need to be invoked manually in child's componentDidMount\n        manualRef: childProps.disabled ? undefined : createChainedFunction(child.ref, saveRef.bind(_assertThisInitialized(_this))),\n        eventKey: key,\n        active: !childProps.disabled && isActive,\n        multiple: props.multiple,\n        onClick: function onClick(e) {\n          (childProps.onClick || noop)(e);\n\n          _this.onClick(e);\n        },\n        onItemHover: _this.onItemHover,\n        motion: props.motion,\n        subMenuOpenDelay: props.subMenuOpenDelay,\n        subMenuCloseDelay: props.subMenuCloseDelay,\n        forceSubMenuRender: props.forceSubMenuRender,\n        onOpenChange: _this.onOpenChange,\n        onDeselect: _this.onDeselect,\n        onSelect: _this.onSelect,\n        builtinPlacements: props.builtinPlacements,\n        itemIcon: childProps.itemIcon || _this.props.itemIcon,\n        expandIcon: childProps.expandIcon || _this.props.expandIcon\n      }, extraProps), {}, {\n        direction: props.direction\n      }); // ref: https://github.com/ant-design/ant-design/issues/13943\n\n\n      if (props.mode === 'inline' || isMobileDevice()) {\n        newChildProps.triggerSubMenuAction = 'click';\n      }\n\n      return React.cloneElement(child, _objectSpread(_objectSpread({}, newChildProps), {}, {\n        key: key || i\n      }));\n    };\n\n    _this.renderMenuItem = function (c, i, subMenuKey) {\n      /* istanbul ignore if */\n      if (!c) {\n        return null;\n      }\n\n      var state = _this.props.store.getState();\n\n      var extraProps = {\n        openKeys: state.openKeys,\n        selectedKeys: state.selectedKeys,\n        triggerSubMenuAction: _this.props.triggerSubMenuAction,\n        subMenuKey: subMenuKey\n      };\n      return _this.renderCommonMenuItem(c, i, extraProps);\n    };\n\n    props.store.setState({\n      activeKey: _objectSpread(_objectSpread({}, props.store.getState().activeKey), {}, _defineProperty({}, props.eventKey, getActiveKey(props, props.activeKey)))\n    });\n    _this.instanceArray = [];\n    return _this;\n  }\n\n  _createClass(SubPopupMenu, [{\n    key: \"componentDidMount\",\n    value: function componentDidMount() {\n      // invoke customized ref to expose component to mixin\n      if (this.props.manualRef) {\n        this.props.manualRef(this);\n      }\n    }\n  }, {\n    key: \"shouldComponentUpdate\",\n    value: function shouldComponentUpdate(nextProps) {\n      return this.props.visible || nextProps.visible || this.props.className !== nextProps.className || !shallowEqual(this.props.style, nextProps.style);\n    }\n  }, {\n    key: \"componentDidUpdate\",\n    value: function componentDidUpdate(prevProps) {\n      var props = this.props;\n      var originalActiveKey = 'activeKey' in props ? props.activeKey : props.store.getState().activeKey[getEventKey(props)];\n      var activeKey = getActiveKey(props, originalActiveKey);\n\n      if (activeKey !== originalActiveKey) {\n        updateActiveKey(props.store, getEventKey(props), activeKey);\n      } else if ('activeKey' in prevProps) {\n        // If prev activeKey is not same as current activeKey,\n        // we should set it.\n        var prevActiveKey = getActiveKey(prevProps, prevProps.activeKey);\n\n        if (activeKey !== prevActiveKey) {\n          updateActiveKey(props.store, getEventKey(props), activeKey);\n        }\n      }\n    }\n  }, {\n    key: \"render\",\n    value: function render() {\n      var _this2 = this;\n\n      var props = _extends({}, this.props);\n\n      this.instanceArray = [];\n      var className = classNames(props.prefixCls, props.className, \"\".concat(props.prefixCls, \"-\").concat(props.mode));\n      var domProps = {\n        className: className,\n        // role could be 'select' and by default set to menu\n        role: props.role || 'menu'\n      };\n\n      if (props.id) {\n        domProps.id = props.id;\n      }\n\n      if (props.focusable) {\n        domProps.tabIndex = 0;\n        domProps.onKeyDown = this.onKeyDown;\n      }\n\n      var prefixCls = props.prefixCls,\n          eventKey = props.eventKey,\n          visible = props.visible,\n          level = props.level,\n          mode = props.mode,\n          overflowedIndicator = props.overflowedIndicator,\n          theme = props.theme;\n      menuAllProps.forEach(function (key) {\n        return delete props[key];\n      }); // Otherwise, the propagated click event will trigger another onClick\n\n      delete props.onClick;\n      return React.createElement(DOMWrap, Object.assign({}, props, {\n        prefixCls: prefixCls,\n        mode: mode,\n        tag: \"ul\",\n        level: level,\n        theme: theme,\n        visible: visible,\n        overflowedIndicator: overflowedIndicator\n      }, domProps), toArray(props.children).map(function (c, i) {\n        return _this2.renderMenuItem(c, i, eventKey || '0-menu-');\n      }));\n    }\n  }]);\n\n  return SubPopupMenu;\n}(React.Component);\nSubPopupMenu.defaultProps = {\n  prefixCls: 'rc-menu',\n  className: '',\n  mode: 'vertical',\n  level: 1,\n  inlineIndent: 24,\n  visible: true,\n  focusable: true,\n  style: {},\n  manualRef: noop\n};\nvar connected = connect()(SubPopupMenu);\nexport default connected;","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/rc-menu/es/SubPopupMenu.js"],"names":["_extends","_classCallCheck","_createClass","_assertThisInitialized","_inherits","_createSuper","_defineProperty","_objectSpread","React","connect","KeyCode","createChainedFunction","toArray","shallowEqual","classNames","getKeyFromChildrenIndex","loopMenuItem","noop","menuAllProps","isMobileDevice","DOMWrap","allDisabled","arr","length","every","c","props","disabled","updateActiveKey","store","menuId","activeKey","state","getState","setState","getEventKey","eventKey","getActiveKey","originalActiveKey","children","found","i","defaultActiveFirst","saveRef","index","instanceArray","indexOf","push","SubPopupMenu","_React$Component","_super","_this","call","onKeyDown","e","callback","keyCode","handled","getFlatInstanceArray","forEach","obj","active","activeItem","UP","DOWN","step","preventDefault","undefined","onItemHover","key","hover","onDeselect","selectInfo","onSelect","onClick","onOpenChange","onDestroy","direction","len","concat","reverse","activeIndex","ci","slice","start","child","renderCommonMenuItem","extraProps","_assertThisInitialize","childProps","type","isActive","newChildProps","mode","level","inlineIndent","renderMenuItem","rootPrefixCls","prefixCls","parentMenu","manualRef","ref","bind","multiple","motion","subMenuOpenDelay","subMenuCloseDelay","forceSubMenuRender","builtinPlacements","itemIcon","expandIcon","triggerSubMenuAction","cloneElement","subMenuKey","openKeys","selectedKeys","value","componentDidMount","shouldComponentUpdate","nextProps","visible","className","style","componentDidUpdate","prevProps","prevActiveKey","render","_this2","domProps","role","id","focusable","tabIndex","overflowedIndicator","theme","createElement","Object","assign","tag","map","Component","defaultProps","connected"],"mappings":"AAAA,OAAOA,QAAP,MAAqB,oCAArB;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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B,EAAyBgB,CAAzB,EAA4BL,QAAQ,IAAI,SAAxC,CAAP;AACD,OAFa,CARP,CAAP;AAWD;AA/CA,GAhCwB,CAAf,CAAZ;;AAkFA,SAAOY,YAAP;AACD,CAvSsC,CAuSrCxC,KAAK,CAACoI,SAvS+B,CAAhC;AAwSP5F,YAAY,CAAC6F,YAAb,GAA4B;AAC1B3C,EAAAA,SAAS,EAAE,SADe;AAE1BuB,EAAAA,SAAS,EAAE,EAFe;AAG1B5B,EAAAA,IAAI,EAAE,UAHoB;AAI1BC,EAAAA,KAAK,EAAE,CAJmB;AAK1BC,EAAAA,YAAY,EAAE,EALY;AAM1ByB,EAAAA,OAAO,EAAE,IANiB;AAO1BW,EAAAA,SAAS,EAAE,IAPe;AAQ1BT,EAAAA,KAAK,EAAE,EARmB;AAS1BtB,EAAAA,SAAS,EAAEnF;AATe,CAA5B;AAWA,IAAI6H,SAAS,GAAGrI,OAAO,GAAGuC,YAAH,CAAvB;AACA,eAAe8F,SAAf","sourcesContent":["import _extends from \"@babel/runtime/helpers/esm/extends\";\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 _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport * as React from 'react';\nimport { connect } from 'mini-store';\nimport KeyCode from \"rc-util/es/KeyCode\";\nimport createChainedFunction from \"rc-util/es/createChainedFunction\";\nimport toArray from \"rc-util/es/Children/toArray\";\nimport shallowEqual from 'shallowequal';\nimport classNames from 'classnames';\nimport { getKeyFromChildrenIndex, loopMenuItem, noop, menuAllProps, isMobileDevice } from './util';\nimport DOMWrap from './DOMWrap';\n\nfunction allDisabled(arr) {\n  if (!arr.length) {\n    return true;\n  }\n\n  return arr.every(function (c) {\n    return !!c.props.disabled;\n  });\n}\n\nfunction updateActiveKey(store, menuId, activeKey) {\n  var state = store.getState();\n  store.setState({\n    activeKey: _objectSpread(_objectSpread({}, state.activeKey), {}, _defineProperty({}, menuId, activeKey))\n  });\n}\n\nfunction getEventKey(props) {\n  // when eventKey not available ,it's menu and return menu id '0-menu-'\n  return props.eventKey || '0-menu-';\n}\n\nexport function getActiveKey(props, originalActiveKey) {\n  var activeKey = originalActiveKey;\n  var children = props.children,\n      eventKey = props.eventKey;\n\n  if (activeKey) {\n    var found;\n    loopMenuItem(children, function (c, i) {\n      if (c && c.props && !c.props.disabled && activeKey === getKeyFromChildrenIndex(c, eventKey, i)) {\n        found = true;\n      }\n    });\n\n    if (found) {\n      return activeKey;\n    }\n  }\n\n  activeKey = null;\n\n  if (props.defaultActiveFirst) {\n    loopMenuItem(children, function (c, i) {\n      if (!activeKey && c && !c.props.disabled) {\n        activeKey = getKeyFromChildrenIndex(c, eventKey, i);\n      }\n    });\n    return activeKey;\n  }\n\n  return activeKey;\n}\nexport function saveRef(c) {\n  if (c) {\n    var index = this.instanceArray.indexOf(c);\n\n    if (index !== -1) {\n      // update component if it's already inside instanceArray\n      this.instanceArray[index] = c;\n    } else {\n      // add component if it's not in instanceArray yet;\n      this.instanceArray.push(c);\n    }\n  }\n}\nexport var SubPopupMenu = /*#__PURE__*/function (_React$Component) {\n  _inherits(SubPopupMenu, _React$Component);\n\n  var _super = _createSuper(SubPopupMenu);\n\n  function SubPopupMenu(props) {\n    var _this;\n\n    _classCallCheck(this, SubPopupMenu);\n\n    _this = _super.call(this, props);\n    /**\n     * all keyboard events callbacks run from here at first\n     *\n     * note:\n     *  This legacy code that `onKeyDown` is called by parent instead of dom self.\n     *  which need return code to check if this event is handled\n     */\n\n    _this.onKeyDown = function (e, callback) {\n      var keyCode = e.keyCode;\n      var handled;\n\n      _this.getFlatInstanceArray().forEach(function (obj) {\n        if (obj && obj.props.active && obj.onKeyDown) {\n          handled = obj.onKeyDown(e);\n        }\n      });\n\n      if (handled) {\n        return 1;\n      }\n\n      var activeItem = null;\n\n      if (keyCode === KeyCode.UP || keyCode === KeyCode.DOWN) {\n        activeItem = _this.step(keyCode === KeyCode.UP ? -1 : 1);\n      }\n\n      if (activeItem) {\n        e.preventDefault();\n        updateActiveKey(_this.props.store, getEventKey(_this.props), activeItem.props.eventKey);\n\n        if (typeof callback === 'function') {\n          callback(activeItem);\n        }\n\n        return 1;\n      }\n\n      return undefined;\n    };\n\n    _this.onItemHover = function (e) {\n      var key = e.key,\n          hover = e.hover;\n      updateActiveKey(_this.props.store, getEventKey(_this.props), hover ? key : null);\n    };\n\n    _this.onDeselect = function (selectInfo) {\n      _this.props.onDeselect(selectInfo);\n    };\n\n    _this.onSelect = function (selectInfo) {\n      _this.props.onSelect(selectInfo);\n    };\n\n    _this.onClick = function (e) {\n      _this.props.onClick(e);\n    };\n\n    _this.onOpenChange = function (e) {\n      _this.props.onOpenChange(e);\n    };\n\n    _this.onDestroy = function (key) {\n      /* istanbul ignore next */\n      _this.props.onDestroy(key);\n    };\n\n    _this.getFlatInstanceArray = function () {\n      return _this.instanceArray;\n    };\n\n    _this.step = function (direction) {\n      var children = _this.getFlatInstanceArray();\n\n      var activeKey = _this.props.store.getState().activeKey[getEventKey(_this.props)];\n\n      var len = children.length;\n\n      if (!len) {\n        return null;\n      }\n\n      if (direction < 0) {\n        children = children.concat().reverse();\n      } // find current activeIndex\n\n\n      var activeIndex = -1;\n      children.every(function (c, ci) {\n        if (c && c.props.eventKey === activeKey) {\n          activeIndex = ci;\n          return false;\n        }\n\n        return true;\n      });\n\n      if (!_this.props.defaultActiveFirst && activeIndex !== -1 && allDisabled(children.slice(activeIndex, len - 1))) {\n        return undefined;\n      }\n\n      var start = (activeIndex + 1) % len;\n      var i = start;\n\n      do {\n        var child = children[i];\n\n        if (!child || child.props.disabled) {\n          i = (i + 1) % len;\n        } else {\n          return child;\n        }\n      } while (i !== start);\n\n      return null;\n    };\n\n    _this.renderCommonMenuItem = function (child, i, extraProps) {\n      var state = _this.props.store.getState();\n\n      var _assertThisInitialize = _assertThisInitialized(_this),\n          props = _assertThisInitialize.props;\n\n      var key = getKeyFromChildrenIndex(child, props.eventKey, i);\n      var childProps = child.props; // https://github.com/ant-design/ant-design/issues/11517#issuecomment-477403055\n\n      if (!childProps || typeof child.type === 'string') {\n        return child;\n      }\n\n      var isActive = key === state.activeKey;\n\n      var newChildProps = _objectSpread(_objectSpread({\n        mode: childProps.mode || props.mode,\n        level: props.level,\n        inlineIndent: props.inlineIndent,\n        renderMenuItem: _this.renderMenuItem,\n        rootPrefixCls: props.prefixCls,\n        index: i,\n        parentMenu: props.parentMenu,\n        // customized ref function, need to be invoked manually in child's componentDidMount\n        manualRef: childProps.disabled ? undefined : createChainedFunction(child.ref, saveRef.bind(_assertThisInitialized(_this))),\n        eventKey: key,\n        active: !childProps.disabled && isActive,\n        multiple: props.multiple,\n        onClick: function onClick(e) {\n          (childProps.onClick || noop)(e);\n\n          _this.onClick(e);\n        },\n        onItemHover: _this.onItemHover,\n        motion: props.motion,\n        subMenuOpenDelay: props.subMenuOpenDelay,\n        subMenuCloseDelay: props.subMenuCloseDelay,\n        forceSubMenuRender: props.forceSubMenuRender,\n        onOpenChange: _this.onOpenChange,\n        onDeselect: _this.onDeselect,\n        onSelect: _this.onSelect,\n        builtinPlacements: props.builtinPlacements,\n        itemIcon: childProps.itemIcon || _this.props.itemIcon,\n        expandIcon: childProps.expandIcon || _this.props.expandIcon\n      }, extraProps), {}, {\n        direction: props.direction\n      }); // ref: https://github.com/ant-design/ant-design/issues/13943\n\n\n      if (props.mode === 'inline' || isMobileDevice()) {\n        newChildProps.triggerSubMenuAction = 'click';\n      }\n\n      return React.cloneElement(child, _objectSpread(_objectSpread({}, newChildProps), {}, {\n        key: key || i\n      }));\n    };\n\n    _this.renderMenuItem = function (c, i, subMenuKey) {\n      /* istanbul ignore if */\n      if (!c) {\n        return null;\n      }\n\n      var state = _this.props.store.getState();\n\n      var extraProps = {\n        openKeys: state.openKeys,\n        selectedKeys: state.selectedKeys,\n        triggerSubMenuAction: _this.props.triggerSubMenuAction,\n        subMenuKey: subMenuKey\n      };\n      return _this.renderCommonMenuItem(c, i, extraProps);\n    };\n\n    props.store.setState({\n      activeKey: _objectSpread(_objectSpread({}, props.store.getState().activeKey), {}, _defineProperty({}, props.eventKey, getActiveKey(props, props.activeKey)))\n    });\n    _this.instanceArray = [];\n    return _this;\n  }\n\n  _createClass(SubPopupMenu, [{\n    key: \"componentDidMount\",\n    value: function componentDidMount() {\n      // invoke customized ref to expose component to mixin\n      if (this.props.manualRef) {\n        this.props.manualRef(this);\n      }\n    }\n  }, {\n    key: \"shouldComponentUpdate\",\n    value: function shouldComponentUpdate(nextProps) {\n      return this.props.visible || nextProps.visible || this.props.className !== nextProps.className || !shallowEqual(this.props.style, nextProps.style);\n    }\n  }, {\n    key: \"componentDidUpdate\",\n    value: function componentDidUpdate(prevProps) {\n      var props = this.props;\n      var originalActiveKey = 'activeKey' in props ? props.activeKey : props.store.getState().activeKey[getEventKey(props)];\n      var activeKey = getActiveKey(props, originalActiveKey);\n\n      if (activeKey !== originalActiveKey) {\n        updateActiveKey(props.store, getEventKey(props), activeKey);\n      } else if ('activeKey' in prevProps) {\n        // If prev activeKey is not same as current activeKey,\n        // we should set it.\n        var prevActiveKey = getActiveKey(prevProps, prevProps.activeKey);\n\n        if (activeKey !== prevActiveKey) {\n          updateActiveKey(props.store, getEventKey(props), activeKey);\n        }\n      }\n    }\n  }, {\n    key: \"render\",\n    value: function render() {\n      var _this2 = this;\n\n      var props = _extends({}, this.props);\n\n      this.instanceArray = [];\n      var className = classNames(props.prefixCls, props.className, \"\".concat(props.prefixCls, \"-\").concat(props.mode));\n      var domProps = {\n        className: className,\n        // role could be 'select' and by default set to menu\n        role: props.role || 'menu'\n      };\n\n      if (props.id) {\n        domProps.id = props.id;\n      }\n\n      if (props.focusable) {\n        domProps.tabIndex = 0;\n        domProps.onKeyDown = this.onKeyDown;\n      }\n\n      var prefixCls = props.prefixCls,\n          eventKey = props.eventKey,\n          visible = props.visible,\n          level = props.level,\n          mode = props.mode,\n          overflowedIndicator = props.overflowedIndicator,\n          theme = props.theme;\n      menuAllProps.forEach(function (key) {\n        return delete props[key];\n      }); // Otherwise, the propagated click event will trigger another onClick\n\n      delete props.onClick;\n      return React.createElement(DOMWrap, Object.assign({}, props, {\n        prefixCls: prefixCls,\n        mode: mode,\n        tag: \"ul\",\n        level: level,\n        theme: theme,\n        visible: visible,\n        overflowedIndicator: overflowedIndicator\n      }, domProps), toArray(props.children).map(function (c, i) {\n        return _this2.renderMenuItem(c, i, eventKey || '0-menu-');\n      }));\n    }\n  }]);\n\n  return SubPopupMenu;\n}(React.Component);\nSubPopupMenu.defaultProps = {\n  prefixCls: 'rc-menu',\n  className: '',\n  mode: 'vertical',\n  level: 1,\n  inlineIndent: 24,\n  visible: true,\n  focusable: true,\n  style: {},\n  manualRef: noop\n};\nvar connected = connect()(SubPopupMenu);\nexport default connected;"]},"metadata":{},"sourceType":"module"}