"use strict";

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

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

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

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

var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));

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

var _mobxReactLite = require("mobx-react-lite");

var _reactBeautifulDnd = require("react-beautiful-dnd");

var _SubGroups = _interopRequireDefault(require("./SubGroups"));

var _TreeNode = _interopRequireDefault(require("../tree/TreeNode"));

var _TableContext = _interopRequireDefault(require("../../TableContext"));

var _excluded = ["treeNodeRenderer", "treeNodeSuffix", "childrenRecords", "onDragEnd"];

var SubGroup = function SubGroup(props) {
  var treeNodeRenderer = props.treeNodeRenderer,
      treeNodeSuffix = props.treeNodeSuffix,
      childrenRecords = props.childrenRecords,
      onDragEnd = props.onDragEnd,
      rest = (0, _objectWithoutProperties2["default"])(props, _excluded);

  var _useContext = (0, _react.useContext)(_TableContext["default"]),
      tableStore = _useContext.tableStore;

  var treeNode = /*#__PURE__*/_react["default"].createElement(_TreeNode["default"], (0, _extends2["default"])({}, rest, {
    isLeaf: false,
    renderer: treeNodeRenderer,
    suffix: treeNodeSuffix
  }), /*#__PURE__*/_react["default"].createElement(_SubGroups["default"], {
    records: childrenRecords,
    onDragEnd: onDragEnd,
    treeNodeRenderer: treeNodeRenderer,
    treeNodeSuffix: treeNodeSuffix
  }));

  return tableStore.columnDraggable ? /*#__PURE__*/_react["default"].createElement(_reactBeautifulDnd.DragDropContext, {
    onDragEnd: onDragEnd
  }, treeNode) : treeNode;
};

SubGroup.displayName = 'SubGroup';

var _default = (0, _mobxReactLite.observer)(SubGroup);

exports["default"] = _default;
//# sourceMappingURL=SubGroup.js.map
