@atlaskit/dynamic-table
Version:
A dynamic table displays rows of data with built-in pagination, sorting, and re-ordering functionality.
40 lines • 1.28 kB
JavaScript
import _extends from "@babel/runtime/helpers/extends";
import React from 'react';
import { inlineStylesIfRanking } from '../../internal/inline-styles-if-ranking';
import { RankableTableBodyCell } from '../../styled/rankable/table-cell';
// eslint-disable-next-line @repo/internal/react/no-class-components
export class RankableTableCell extends React.Component {
render() {
const {
cell,
head,
isFixedSize,
isRanking,
refWidth,
innerRef,
testId
} = this.props;
const {
content,
testId: cellTestId,
...restCellProps
} = cell;
const {
shouldTruncate,
width
} = head || {};
const inlineStyles = inlineStylesIfRanking(isRanking, refWidth);
return /*#__PURE__*/React.createElement(RankableTableBodyCell, _extends({}, restCellProps, {
isFixedSize: isFixedSize,
shouldTruncate: shouldTruncate,
width: width,
isRanking: isRanking
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
,
style: inlineStyles,
onKeyDown: e => e.stopPropagation(),
innerRef: innerRef,
"data-testid": cellTestId || testId && `${testId}--rankable--table--body--cell`
}), content);
}
}