UNPKG

@atlaskit/dynamic-table

Version:

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

43 lines (42 loc) 1.64 kB
import _extends from "@babel/runtime/helpers/extends"; import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; var _excluded = ["cells"], _excluded2 = ["content", "testId"]; import React from 'react'; import { TableBodyCell } from '../styled/table-cell'; import { TableBodyRow } from '../styled/table-row'; var Row = function Row(_ref) { var row = _ref.row, head = _ref.head, testId = _ref.testId, isFixedSize = _ref.isFixedSize, isHighlighted = _ref.isHighlighted; var cells = row.cells, restRowProps = _objectWithoutProperties(row, _excluded); return /*#__PURE__*/React.createElement(TableBodyRow, _extends({}, restRowProps, { isHighlighted: isHighlighted }, isHighlighted ? { 'data-ts--dynamic-table--table-row--highlighted': true } : null, { testId: row.testId || testId && "".concat(testId, "--row-").concat(restRowProps.key) }), cells.map(function (cell, cellIndex) { var content = cell.content, cellTestId = cell.testId, restCellProps = _objectWithoutProperties(cell, _excluded2); var _ref2 = (head || { cells: [] }).cells[cellIndex] || {}, shouldTruncate = _ref2.shouldTruncate, width = _ref2.width; return /*#__PURE__*/React.createElement(TableBodyCell, _extends({ "data-testid": cellTestId || testId && "".concat(testId, "--cell-").concat(cellIndex) }, restCellProps, { isFixedSize: isFixedSize, key: cellIndex, shouldTruncate: shouldTruncate, width: width }), content); })); }; // eslint-disable-next-line @repo/internal/react/require-jsdoc export default Row;