UNPKG

2.63 kBJavaScriptView Raw
1"use strict";
2
3var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4var _typeof = require("@babel/runtime/helpers/typeof");
5Object.defineProperty(exports, "__esModule", {
6 value: true
7});
8exports.default = exports.FooterComponents = void 0;
9var _context = require("@rc-component/context");
10var React = _interopRequireWildcard(require("react"));
11var _TableContext = _interopRequireWildcard(require("../context/TableContext"));
12var _useRenderTimes = _interopRequireDefault(require("../hooks/useRenderTimes"));
13var _Summary = _interopRequireDefault(require("./Summary"));
14var _SummaryContext = _interopRequireDefault(require("./SummaryContext"));
15function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
16function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
17function Footer(props) {
18 if (process.env.NODE_ENV !== 'production') {
19 (0, _useRenderTimes.default)(props);
20 }
21 var children = props.children,
22 stickyOffsets = props.stickyOffsets,
23 flattenColumns = props.flattenColumns;
24 var prefixCls = (0, _context.useContext)(_TableContext.default, 'prefixCls');
25 var lastColumnIndex = flattenColumns.length - 1;
26 var scrollColumn = flattenColumns[lastColumnIndex];
27 var summaryContext = React.useMemo(function () {
28 return {
29 stickyOffsets: stickyOffsets,
30 flattenColumns: flattenColumns,
31 scrollColumnIndex: scrollColumn !== null && scrollColumn !== void 0 && scrollColumn.scrollbar ? lastColumnIndex : null
32 };
33 }, [scrollColumn, flattenColumns, lastColumnIndex, stickyOffsets]);
34 return /*#__PURE__*/React.createElement(_SummaryContext.default.Provider, {
35 value: summaryContext
36 }, /*#__PURE__*/React.createElement("tfoot", {
37 className: "".concat(prefixCls, "-summary")
38 }, children));
39}
40var _default = exports.default = (0, _TableContext.responseImmutable)(Footer);
41var FooterComponents = exports.FooterComponents = _Summary.default;
\No newline at end of file