UNPKG

choerodon-ui

Version:

An enterprise-class UI design language and React-based implementation

58 lines (51 loc) 1.74 kB
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray"; import React, { useContext } from 'react'; import TableFooterRow from './TableFooterRow'; import TableContext from './TableContext'; function appendExpandIconColumn(columns) { var expandIconCol = { key: 'expand-icon-placeholder', render: function render() { return null; } }; return [expandIconCol].concat(_toConsumableArray(columns)); } export default function TableFooter(props) { var table = useContext(TableContext); var columnManager = table.columnManager, components = table.components; var _table$props = table.props, prefixCls = _table$props.prefixCls, data = _table$props.data, expandIconAsCell = _table$props.expandIconAsCell; var fixed = props.fixed, onHover = props.onHover; var leafColumns; if (fixed === 'left') { leafColumns = columnManager.leftLeafColumns(); if (expandIconAsCell) { leafColumns = appendExpandIconColumn(leafColumns); } } else if (fixed === 'right') { leafColumns = columnManager.rightLeafColumns(); } else { leafColumns = columnManager.leafColumns(); if (expandIconAsCell) { leafColumns = appendExpandIconColumn(leafColumns); } } var FooterWrapper = components.footer.wrapper; return /*#__PURE__*/React.createElement(FooterWrapper, { className: "".concat(prefixCls, "-tfoot") }, /*#__PURE__*/React.createElement(TableFooterRow, { prefixCls: prefixCls, columns: leafColumns, components: components, fixed: fixed, data: data, onHover: columnManager.isAnyColumnsFixed() ? onHover : null })); } TableFooter.displayName = 'RcTableFooter'; //# sourceMappingURL=TableFooter.js.map