UNPKG

@atlaskit/dynamic-table

Version:

A dynamic table displays rows of data with built-in pagination, sorting, and re-ordering functionality.

36 lines (35 loc) 1.26 kB
import _extends from "@babel/runtime/helpers/extends"; import React from 'react'; import withSortedPageRows from '../hoc/with-sorted-page-rows'; import TableRow from './table-row'; // eslint-disable-next-line @repo/internal/react/no-class-components class BodyComponent extends React.Component { render() { const { pageRows, head, isFixedSize, highlightedRowIndex, testId, forwardedRef } = this.props; return /*#__PURE__*/React.createElement("tbody", { "data-testid": testId && `${testId}--body`, ref: forwardedRef }, pageRows.map((row, rowIndex) => /*#__PURE__*/React.createElement(TableRow, { head: head, isFixedSize: isFixedSize, key: row.key || rowIndex, row: row, isHighlighted: row.isHighlighted || !!highlightedRowIndex && (typeof highlightedRowIndex === 'number' ? highlightedRowIndex === rowIndex : highlightedRowIndex.indexOf(rowIndex) > -1), testId: testId }))); } } const Body = withSortedPageRows( /*#__PURE__*/React.forwardRef((props, ref) => { return /*#__PURE__*/React.createElement(BodyComponent, _extends({}, props, { forwardedRef: ref })); })); // eslint-disable-next-line @repo/internal/react/require-jsdoc export default Body;