import React, { useContext } from 'react';
import measureScrollbar from '../../_util/measureScrollbar';
import BaseTable from './BaseTable';
import TableContext from './TableContext';
export default function FootTable(props) {
  var table = useContext(TableContext);
  var _table$props = table.props,
      prefixCls = _table$props.prefixCls,
      scroll = _table$props.scroll,
      showHeader = _table$props.showHeader;
  var columns = props.columns,
      fixed = props.fixed,
      tableClassName = props.tableClassName,
      handleBodyScrollLeft = props.handleBodyScrollLeft,
      expander = props.expander;
  var saveRef = table.saveRef,
      columnManager = table.columnManager;
  var useFixedHeader = table.props.useFixedHeader;
  var footStyle = {};

  if (scroll.y) {
    useFixedHeader = true; // Add negative margin bottom for scroll bar overflow bug

    var scrollbarWidth = measureScrollbar('horizontal');

    if (scrollbarWidth > 0 && !fixed) {
      footStyle.marginBottom = "-".concat(scrollbarWidth, "px");
      footStyle.paddingBottom = '0px';
    }
  }

  if (!useFixedHeader || !showHeader || !columnManager.hasFooter()) {
    return null;
  }

  return /*#__PURE__*/React.createElement("div", {
    key: "footTable",
    ref: fixed ? null : saveRef('footTable'),
    className: "".concat(prefixCls, "-column-footer"),
    style: footStyle,
    onScroll: handleBodyScrollLeft
  }, /*#__PURE__*/React.createElement(BaseTable, {
    tableClassName: tableClassName,
    hasHead: false,
    hasBody: false,
    hasFoot: true,
    fixed: fixed,
    columns: columns,
    expander: expander
  }));
}
//# sourceMappingURL=FootTable.js.map
