import _extends from "@babel/runtime/helpers/extends";
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
import _defineProperty from "@babel/runtime/helpers/defineProperty";
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
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";
var _excluded = ["fixed", "width", "left", "height", "style", "classPrefix", "className", "children", "rowDraggable", "provided", "snapshot"];
// @ts-nocheck
import * as React from 'react';
import classNames from 'classnames';
import { defaultClassPrefix, getUnhandledProps, prefix } from './utils';
import TableContext from './TableContext';
var propTypeKeys = ['fixed', 'width', 'height', 'left', 'style', 'className', 'classPrefix', 'rowDraggable', 'snapshot', 'provided'];

var CellGroup = /*#__PURE__*/function (_React$PureComponent) {
  _inherits(CellGroup, _React$PureComponent);

  var _super = _createSuper(CellGroup);

  function CellGroup() {
    var _this;

    _classCallCheck(this, CellGroup);

    _this = _super.apply(this, arguments);

    _this.addPrefix = function (name) {
      return prefix(_this.props.classPrefix)(name);
    };

    return _this;
  }

  _createClass(CellGroup, [{
    key: "render",
    value: function render() {
      var _classNames;

      var _this$props = this.props,
          fixed = _this$props.fixed,
          width = _this$props.width,
          left = _this$props.left,
          height = _this$props.height,
          style = _this$props.style,
          classPrefix = _this$props.classPrefix,
          className = _this$props.className,
          children = _this$props.children,
          rowDraggable = _this$props.rowDraggable,
          provided = _this$props.provided,
          snapshot = _this$props.snapshot,
          rest = _objectWithoutProperties(_this$props, _excluded);

      var classes = classNames(classPrefix, className, (_classNames = {}, _defineProperty(_classNames, this.addPrefix("fixed-".concat(fixed || '')), fixed), _defineProperty(_classNames, this.addPrefix('scroll'), !fixed), _classNames));

      var styles = _objectSpread({
        width: width,
        height: height
      }, style);

      var unhandledProps = getUnhandledProps(propTypeKeys, rest);
      var childArr = [];

      if (rowDraggable) {
        React.Children.forEach(children, function (child) {
          childArr.push( /*#__PURE__*/React.cloneElement(child, {
            provided: provided,
            isDragging: snapshot ? snapshot.isDragging : false
          }));
        });
      }

      var cloneChildren = rowDraggable ? childArr : children;
      return /*#__PURE__*/React.createElement(TableContext.Consumer, null, function (_ref) {
        var translateDOMPositionXY = _ref.translateDOMPositionXY;

        if (translateDOMPositionXY) {
          translateDOMPositionXY(styles, left, 0);
        }

        return /*#__PURE__*/React.createElement("div", _extends({}, unhandledProps, {
          className: classes,
          style: styles
        }), cloneChildren);
      });
    }
  }]);

  return CellGroup;
}(React.PureComponent);

CellGroup.defaultProps = {
  classPrefix: defaultClassPrefix('performance-table-cell-group')
};
export default CellGroup;
//# sourceMappingURL=CellGroup.js.map
