import _extends from "@babel/runtime/helpers/extends";
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
import _createClass from "@babel/runtime/helpers/createClass";
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
import _inherits from "@babel/runtime/helpers/inherits";
import _createSuper from "@babel/runtime/helpers/createSuper";
import _defineProperty from "@babel/runtime/helpers/defineProperty";
import React, { Children, Component } from 'react';
import { menuAllProps } from './util';

var MenuItemGroup = /*#__PURE__*/function (_Component) {
  _inherits(MenuItemGroup, _Component);

  var _super = _createSuper(MenuItemGroup);

  function MenuItemGroup() {
    var _this;

    _classCallCheck(this, MenuItemGroup);

    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    _this = _super.call.apply(_super, [this].concat(args));

    _defineProperty(_assertThisInitialized(_this), "renderInnerMenuItem", function (item) {
      var _this$props = _this.props,
          renderMenuItem = _this$props.renderMenuItem,
          index = _this$props.index;
      return renderMenuItem(item, index, _this.props.subMenuKey);
    });

    return _this;
  }

  _createClass(MenuItemGroup, [{
    key: "render",
    value: function render() {
      var props = _extends({}, this.props);

      var _props$className = props.className,
          className = _props$className === void 0 ? '' : _props$className,
          rootPrefixCls = props.rootPrefixCls;
      var titleClassName = "".concat(rootPrefixCls, "-item-group-title");
      var listClassName = "".concat(rootPrefixCls, "-item-group-list");
      var title = props.title,
          children = props.children;
      menuAllProps.forEach(function (key) {
        return delete props[key];
      }); // Set onClick to null, to ignore propagated onClick event

      delete props.onClick;
      return /*#__PURE__*/React.createElement("li", _extends({}, props, {
        className: "".concat(className, " ").concat(rootPrefixCls, "-item-group")
      }), /*#__PURE__*/React.createElement("div", {
        className: titleClassName,
        title: typeof title === 'string' ? title : undefined
      }, title), /*#__PURE__*/React.createElement("ul", {
        className: listClassName
      }, Children.map(children, this.renderInnerMenuItem)));
    }
  }]);

  return MenuItemGroup;
}(Component);

_defineProperty(MenuItemGroup, "defaultProps", {
  disabled: true
});

MenuItemGroup.isMenuItemGroup = true;
export default MenuItemGroup;
//# sourceMappingURL=MenuItemGroup.js.map
