"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"] = ColGroup;

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

var _measureScrollbar = _interopRequireDefault(require("../../_util/measureScrollbar"));

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

function ColGroup(props) {
  var table = (0, _react.useContext)(_TableContext["default"]);
  var _table$props = table.props,
      prefixCls = _table$props.prefixCls,
      expandIconAsCell = _table$props.expandIconAsCell;
  var fixed = props.fixed,
      placeholder = props.placeholder;
  var expandCol = expandIconAsCell && fixed !== 'right' ? /*#__PURE__*/_react["default"].createElement("col", {
    className: "".concat(prefixCls, "-expand-icon-col"),
    key: "rc-table-expand-icon-col"
  }) : null;
  var leafColumns;

  if (fixed === 'left') {
    leafColumns = table.columnManager.leftLeafColumns();
  } else if (fixed === 'right') {
    leafColumns = table.columnManager.rightLeafColumns();
  } else {
    leafColumns = table.columnManager.leafColumns();
  }

  var cols = leafColumns.map(function (c) {
    return /*#__PURE__*/_react["default"].createElement("col", {
      key: c.key || c.dataIndex,
      style: {
        width: c.width,
        minWidth: c.minWidth || c.width
      }
    });
  });
  return /*#__PURE__*/_react["default"].createElement("colgroup", null, expandCol, cols, placeholder && /*#__PURE__*/_react["default"].createElement("col", {
    style: {
      width: (0, _measureScrollbar["default"])()
    }
  }));
}
//# sourceMappingURL=ColGroup.js.map
