"use strict";

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));

var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));

var _react = _interopRequireWildcard(require("react"));

var _classnames = _interopRequireDefault(require("classnames"));

var _menu = require("../rc-components/menu");

var _MenuContext = _interopRequireDefault(require("./MenuContext"));

var SubMenu = /*#__PURE__*/function (_PureComponent) {
  (0, _inherits2["default"])(SubMenu, _PureComponent);

  var _super = (0, _createSuper2["default"])(SubMenu);

  function SubMenu() {
    var _this;

    (0, _classCallCheck2["default"])(this, SubMenu);
    _this = _super.apply(this, arguments);

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

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

    return _this;
  }

  (0, _createClass2["default"])(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["default"].createElement(_menu.SubMenu, (0, _extends2["default"])({}, this.props, {
        ref: this.saveSubMenu,
        popupClassName: (0, _classnames["default"])("".concat(rootPrefixCls, "-").concat(menuTheme), className)
      }));
    }
  }], [{
    key: "contextType",
    get: function get() {
      return _MenuContext["default"];
    }
  }]);
  return SubMenu;
}(_react.PureComponent);

SubMenu.isSubMenu = 1;
var _default = SubMenu;
exports["default"] = _default;
//# sourceMappingURL=SubMenu.js.map
