@atlaskit/dynamic-table
Version:
A dynamic table displays rows of data with built-in pagination, sorting, and re-ordering functionality.
50 lines (48 loc) • 2.02 kB
JavaScript
;
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var _react = _interopRequireDefault(require("react"));
var _tableCell = require("../styled/table-cell");
var _tableRow = require("../styled/table-row");
var _excluded = ["cells"],
_excluded2 = ["content", "testId"];
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 = (0, _objectWithoutProperties2.default)(row, _excluded);
return /*#__PURE__*/_react.default.createElement(_tableRow.TableBodyRow, (0, _extends2.default)({}, 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 = (0, _objectWithoutProperties2.default)(cell, _excluded2);
var _ref2 = (head || {
cells: []
}).cells[cellIndex] || {},
shouldTruncate = _ref2.shouldTruncate,
width = _ref2.width;
return /*#__PURE__*/_react.default.createElement(_tableCell.TableBodyCell, (0, _extends2.default)({
"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
var _default = exports.default = Row;