1 | "use strict";
|
2 |
|
3 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4 | var _typeof = require("@babel/runtime/helpers/typeof");
|
5 | Object.defineProperty(exports, "__esModule", {
|
6 | value: true
|
7 | });
|
8 | exports.default = exports.FooterComponents = void 0;
|
9 | var _context = require("@rc-component/context");
|
10 | var React = _interopRequireWildcard(require("react"));
|
11 | var _TableContext = _interopRequireWildcard(require("../context/TableContext"));
|
12 | var _useRenderTimes = _interopRequireDefault(require("../hooks/useRenderTimes"));
|
13 | var _Summary = _interopRequireDefault(require("./Summary"));
|
14 | var _SummaryContext = _interopRequireDefault(require("./SummaryContext"));
|
15 | function _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); }
|
16 | function _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; }
|
17 | function 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 React.createElement(_SummaryContext.default.Provider, {
|
35 | value: summaryContext
|
36 | }, React.createElement("tfoot", {
|
37 | className: "".concat(prefixCls, "-summary")
|
38 | }, children));
|
39 | }
|
40 | var _default = exports.default = (0, _TableContext.responseImmutable)(Footer);
|
41 | var FooterComponents = exports.FooterComponents = _Summary.default; |
\ | No newline at end of file |