import React, { useContext } from 'react';
import measureScrollbar from '../../_util/measureScrollbar';
import TableContext from './TableContext';
export default function ColGroup(props) {
  var table = useContext(TableContext);
  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.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.createElement("col", {
      key: c.key || c.dataIndex,
      style: {
        width: c.width,
        minWidth: c.minWidth || c.width
      }
    });
  });
  return /*#__PURE__*/React.createElement("colgroup", null, expandCol, cols, placeholder && /*#__PURE__*/React.createElement("col", {
    style: {
      width: measureScrollbar()
    }
  }));
}
//# sourceMappingURL=ColGroup.js.map
