import _extends from "@babel/runtime/helpers/extends";
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
import _createClass from "@babel/runtime/helpers/createClass";
import _inherits from "@babel/runtime/helpers/inherits";
import _createSuper from "@babel/runtime/helpers/createSuper";
import React, { PureComponent } from 'react';
import classNames from 'classnames';
import { SubMenu as RcSubMenu } from '../rc-components/menu';
import MenuContext from './MenuContext';

var SubMenu = /*#__PURE__*/function (_PureComponent) {
  _inherits(SubMenu, _PureComponent);

  var _super = _createSuper(SubMenu);

  function SubMenu() {
    var _this;

    _classCallCheck(this, SubMenu);

    _this = _super.apply(this, arguments);

    _this.onKeyDown = function (e) {
      _this.subMenu.onKeyDown(e);
    };

    _this.saveSubMenu = function (subMenu) {
      _this.subMenu = subMenu;
    };

    return _this;
  }

  _createClass(SubMenu, [{
    key: "render",
    value: function render() {
      var _this$props = this.props,
          rootPrefixCls = _this$props.rootPrefixCls,
          className = _this$props.className;
      var menuTheme = this.context.menuTheme;
      return /*#__PURE__*/React.createElement(RcSubMenu, _extends({}, this.props, {
        ref: this.saveSubMenu,
        popupClassName: classNames("".concat(rootPrefixCls, "-").concat(menuTheme), className)
      }));
    }
  }], [{
    key: "contextType",
    get: function get() {
      return MenuContext;
    }
  }]);

  return SubMenu;
}(PureComponent);

SubMenu.isSubMenu = 1;
export default SubMenu;
//# sourceMappingURL=SubMenu.js.map
