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