"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 _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));

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

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

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));

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

var _util = require("./util");

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

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

  function MenuItemGroup() {
    var _this;

    (0, _classCallCheck2["default"])(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));
    (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_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;
  }

  (0, _createClass2["default"])(MenuItemGroup, [{
    key: "render",
    value: function render() {
      var props = (0, _extends2["default"])({}, 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;

      _util.menuAllProps.forEach(function (key) {
        return delete props[key];
      }); // Set onClick to null, to ignore propagated onClick event


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

(0, _defineProperty2["default"])(MenuItemGroup, "defaultProps", {
  disabled: true
});
MenuItemGroup.isMenuItemGroup = true;
var _default = MenuItemGroup;
exports["default"] = _default;
//# sourceMappingURL=MenuItemGroup.js.map
