| 1 |
"use strict"; |
| 2 |
Object.defineProperty(exports, "__esModule", { value: true }); |
| 3 |
exports.Header = void 0; |
| 4 |
const tslib_1 = require("tslib"); |
| 5 |
const jsx_runtime_1 = require("react/jsx-runtime"); |
| 6 |
/** |
| 7 |
* header.tsx |
| 8 |
* |
| 9 |
* Forked from reactabular-table version 8.14.0 |
| 10 |
* https://github.com/reactabular/reactabular/tree/v8.14.0/packages/reactabular-table/src |
| 11 |
*/ |
| 12 |
const react_1 = require("react"); |
| 13 |
const provider_1 = require("../../../../components/Table/base/provider"); |
| 14 |
const header_row_1 = require("./header-row"); |
| 15 |
class BaseHeader extends react_1.Component { |
| 16 |
render() { |
| 17 |
const _a = this.props, { children, headerRows, onRow, renderers, columns } = _a, props = tslib_1.__rest(_a, ["children", "headerRows", "onRow", "renderers", "columns"]); |
| 18 |
// If headerRows aren't passed, default to bodyColumns as header rows |
| 19 |
return (0, react_1.createElement)(renderers.header.wrapper, props, [ |
| 20 |
(headerRows || [columns]).map((rowData, rowIndex) => (0, react_1.createElement)(header_row_1.HeaderRow, { |
| 21 |
key: `${rowIndex}-header-row`, |
| 22 |
renderers: renderers.header, |
| 23 |
onRow, |
| 24 |
rowData, |
| 25 |
rowIndex |
| 26 |
})) |
| 27 |
].concat(children)); |
| 28 |
} |
| 29 |
} |
| 30 |
const Header = (props) => ((0, jsx_runtime_1.jsx)(provider_1.ProviderContext.Consumer, { children: ({ columns, renderers }) => (0, jsx_runtime_1.jsx)(BaseHeader, Object.assign({ columns: columns, renderers: renderers }, props)) })); |
| 31 |
exports.Header = Header; |
| 32 |
//# sourceMappingURL=header.js.map |