@atlaskit/dynamic-table
Version:
A dynamic table displays rows of data with built-in pagination, sorting, and re-ordering functionality.
55 lines • 2.85 kB
JavaScript
import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
import _createClass from "@babel/runtime/helpers/createClass";
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
import _inherits from "@babel/runtime/helpers/inherits";
var _excluded = ["content", "testId"];
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
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 var RankableTableCell = /*#__PURE__*/function (_React$Component) {
function RankableTableCell() {
_classCallCheck(this, RankableTableCell);
return _callSuper(this, RankableTableCell, arguments);
}
_inherits(RankableTableCell, _React$Component);
return _createClass(RankableTableCell, [{
key: "render",
value: function render() {
var _this$props = this.props,
cell = _this$props.cell,
head = _this$props.head,
isFixedSize = _this$props.isFixedSize,
isRanking = _this$props.isRanking,
refWidth = _this$props.refWidth,
innerRef = _this$props.innerRef,
testId = _this$props.testId;
var content = cell.content,
cellTestId = cell.testId,
restCellProps = _objectWithoutProperties(cell, _excluded);
var _ref = head || {},
shouldTruncate = _ref.shouldTruncate,
width = _ref.width;
var 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: function onKeyDown(e) {
return e.stopPropagation();
},
innerRef: innerRef,
"data-testid": cellTestId || testId && "".concat(testId, "--rankable--table--body--cell")
}), content);
}
}]);
}(React.Component);