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 = void 0;
|
9 | var _context = require("@rc-component/context");
|
10 | var React = _interopRequireWildcard(require("react"));
|
11 | var _Cell = _interopRequireDefault(require("../Cell"));
|
12 | var _TableContext = _interopRequireDefault(require("../context/TableContext"));
|
13 | var _useRenderTimes = _interopRequireDefault(require("../hooks/useRenderTimes"));
|
14 | 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); }
|
15 | 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; }
|
16 | function ExpandedRow(props) {
|
17 | if (process.env.NODE_ENV !== 'production') {
|
18 | (0, _useRenderTimes.default)(props);
|
19 | }
|
20 | var prefixCls = props.prefixCls,
|
21 | children = props.children,
|
22 | Component = props.component,
|
23 | cellComponent = props.cellComponent,
|
24 | className = props.className,
|
25 | expanded = props.expanded,
|
26 | colSpan = props.colSpan,
|
27 | isEmpty = props.isEmpty;
|
28 | var _useContext = (0, _context.useContext)(_TableContext.default, ['scrollbarSize', 'fixHeader', 'fixColumn', 'componentWidth', 'horizonScroll']),
|
29 | scrollbarSize = _useContext.scrollbarSize,
|
30 | fixHeader = _useContext.fixHeader,
|
31 | fixColumn = _useContext.fixColumn,
|
32 | componentWidth = _useContext.componentWidth,
|
33 | horizonScroll = _useContext.horizonScroll;
|
34 |
|
35 |
|
36 | var contentNode = children;
|
37 | if (isEmpty ? horizonScroll && componentWidth : fixColumn) {
|
38 | contentNode = React.createElement("div", {
|
39 | style: {
|
40 | width: componentWidth - (fixHeader && !isEmpty ? scrollbarSize : 0),
|
41 | position: 'sticky',
|
42 | left: 0,
|
43 | overflow: 'hidden'
|
44 | },
|
45 | className: "".concat(prefixCls, "-expanded-row-fixed")
|
46 | }, contentNode);
|
47 | }
|
48 | return React.createElement(Component, {
|
49 | className: className,
|
50 | style: {
|
51 | display: expanded ? null : 'none'
|
52 | }
|
53 | }, React.createElement(_Cell.default, {
|
54 | component: cellComponent,
|
55 | prefixCls: prefixCls,
|
56 | colSpan: colSpan
|
57 | }, contentNode));
|
58 | }
|
59 | var _default = exports.default = ExpandedRow; |
\ | No newline at end of file |