@atlaskit/dynamic-table 14.8.9 → 14.8.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/cjs/components/body.js +5 -22
- package/dist/cjs/components/loading-container-advanced.js +17 -61
- package/dist/cjs/components/loading-container.js +5 -23
- package/dist/cjs/components/managed-pagination.js +7 -28
- package/dist/cjs/components/rankable/body.js +12 -41
- package/dist/cjs/components/rankable/table-cell.js +10 -34
- package/dist/cjs/components/rankable/table-head-cell.js +4 -25
- package/dist/cjs/components/rankable/table-row.js +11 -46
- package/dist/cjs/components/stateful.js +23 -54
- package/dist/cjs/components/stateless.js +31 -84
- package/dist/cjs/components/table-head-cell.js +8 -16
- package/dist/cjs/components/table-head.js +12 -42
- package/dist/cjs/components/table-row.js +13 -23
- package/dist/cjs/hoc/with-dimensions.js +6 -27
- package/dist/cjs/hoc/with-sorted-page-rows.js +27 -64
- package/dist/cjs/index.js +0 -3
- package/dist/cjs/internal/helpers.js +9 -30
- package/dist/cjs/styled/constants.js +3 -9
- package/dist/cjs/styled/dynamic-table.js +4 -20
- package/dist/cjs/styled/empty-body.js +3 -10
- package/dist/cjs/styled/loading-container-advanced.js +5 -15
- package/dist/cjs/styled/loading-container.js +5 -15
- package/dist/cjs/styled/rankable/row-placeholder.js +6 -9
- package/dist/cjs/styled/rankable/table-cell.js +6 -12
- package/dist/cjs/styled/rankable/table-row.js +4 -11
- package/dist/cjs/styled/table-cell.js +8 -15
- package/dist/cjs/styled/table-head.js +12 -31
- package/dist/cjs/styled/table-row.js +5 -11
- package/dist/cjs/theme.js +0 -5
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/body.js +0 -3
- package/dist/es2019/components/loading-container-advanced.js +7 -40
- package/dist/es2019/components/loading-container.js +0 -2
- package/dist/es2019/components/managed-pagination.js +2 -5
- package/dist/es2019/components/rankable/body.js +0 -8
- package/dist/es2019/components/rankable/table-cell.js +0 -1
- package/dist/es2019/components/rankable/table-head-cell.js +0 -3
- package/dist/es2019/components/rankable/table-row.js +2 -7
- package/dist/es2019/components/stateful.js +0 -14
- package/dist/es2019/components/stateless.js +3 -34
- package/dist/es2019/components/table-head-cell.js +2 -4
- package/dist/es2019/components/table-head.js +2 -10
- package/dist/es2019/components/table-row.js +2 -3
- package/dist/es2019/hoc/with-dimensions.js +4 -11
- package/dist/es2019/hoc/with-sorted-page-rows.js +16 -33
- package/dist/es2019/internal/helpers.js +6 -11
- package/dist/es2019/styled/constants.js +3 -3
- package/dist/es2019/styled/dynamic-table.js +1 -5
- package/dist/es2019/styled/empty-body.js +1 -1
- package/dist/es2019/styled/loading-container-advanced.js +3 -5
- package/dist/es2019/styled/loading-container.js +1 -1
- package/dist/es2019/styled/rankable/row-placeholder.js +6 -5
- package/dist/es2019/styled/rankable/table-cell.js +5 -4
- package/dist/es2019/styled/rankable/table-row.js +2 -2
- package/dist/es2019/styled/table-cell.js +7 -5
- package/dist/es2019/styled/table-head.js +4 -5
- package/dist/es2019/styled/table-row.js +2 -2
- package/dist/es2019/types.js +1 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/body.js +5 -15
- package/dist/esm/components/loading-container-advanced.js +17 -65
- package/dist/esm/components/loading-container.js +5 -16
- package/dist/esm/components/managed-pagination.js +7 -23
- package/dist/esm/components/rankable/body.js +12 -30
- package/dist/esm/components/rankable/table-cell.js +10 -21
- package/dist/esm/components/rankable/table-head-cell.js +4 -15
- package/dist/esm/components/rankable/table-row.js +11 -31
- package/dist/esm/components/stateful.js +23 -51
- package/dist/esm/components/stateless.js +31 -70
- package/dist/esm/components/table-head-cell.js +8 -11
- package/dist/esm/components/table-head.js +12 -33
- package/dist/esm/components/table-row.js +13 -18
- package/dist/esm/hoc/with-dimensions.js +6 -22
- package/dist/esm/hoc/with-sorted-page-rows.js +27 -54
- package/dist/esm/internal/helpers.js +9 -16
- package/dist/esm/styled/constants.js +3 -3
- package/dist/esm/styled/dynamic-table.js +4 -10
- package/dist/esm/styled/empty-body.js +3 -3
- package/dist/esm/styled/loading-container-advanced.js +5 -8
- package/dist/esm/styled/loading-container.js +5 -6
- package/dist/esm/styled/rankable/row-placeholder.js +6 -5
- package/dist/esm/styled/rankable/table-cell.js +7 -7
- package/dist/esm/styled/rankable/table-row.js +4 -5
- package/dist/esm/styled/table-cell.js +11 -10
- package/dist/esm/styled/table-head.js +12 -19
- package/dist/esm/styled/table-row.js +5 -6
- package/dist/esm/types.js +1 -0
- package/dist/esm/version.json +1 -1
- package/package.json +2 -2
|
@@ -6,11 +6,8 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
6
6
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
7
7
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
8
8
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
|
-
|
|
10
9
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
11
|
-
|
|
12
10
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
13
|
-
|
|
14
11
|
import React from 'react';
|
|
15
12
|
import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
16
13
|
import noop from '@atlaskit/ds-lib/noop';
|
|
@@ -25,54 +22,41 @@ import ManagedPagination from './managed-pagination';
|
|
|
25
22
|
import RankableTableBody from './rankable/body';
|
|
26
23
|
import TableHead from './table-head';
|
|
27
24
|
var packageName = "@atlaskit/dynamic-table";
|
|
28
|
-
var packageVersion = "14.8.
|
|
29
|
-
|
|
25
|
+
var packageVersion = "14.8.11";
|
|
30
26
|
function toggleSortOrder(currentSortOrder) {
|
|
31
27
|
switch (currentSortOrder) {
|
|
32
28
|
case DESC:
|
|
33
29
|
return ASC;
|
|
34
|
-
|
|
35
30
|
case ASC:
|
|
36
31
|
return DESC;
|
|
37
|
-
|
|
38
32
|
default:
|
|
39
33
|
return currentSortOrder;
|
|
40
34
|
}
|
|
41
35
|
}
|
|
42
|
-
|
|
43
36
|
var DynamicTable = /*#__PURE__*/function (_React$Component) {
|
|
44
37
|
_inherits(DynamicTable, _React$Component);
|
|
45
|
-
|
|
46
38
|
var _super = _createSuper(DynamicTable);
|
|
47
|
-
|
|
48
39
|
function DynamicTable() {
|
|
49
40
|
var _this;
|
|
50
|
-
|
|
51
41
|
_classCallCheck(this, DynamicTable);
|
|
52
|
-
|
|
53
42
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
54
43
|
args[_key] = arguments[_key];
|
|
55
44
|
}
|
|
56
|
-
|
|
57
45
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
58
|
-
|
|
59
46
|
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
60
47
|
isRanking: false
|
|
61
48
|
});
|
|
62
|
-
|
|
63
49
|
_defineProperty(_assertThisInitialized(_this), "onSort", function (item) {
|
|
64
50
|
return function () {
|
|
65
51
|
var _this$props = _this.props,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
52
|
+
sortKey = _this$props.sortKey,
|
|
53
|
+
sortOrder = _this$props.sortOrder,
|
|
54
|
+
onSort = _this$props.onSort,
|
|
55
|
+
isRankable = _this$props.isRankable;
|
|
70
56
|
var key = item.key;
|
|
71
|
-
|
|
72
57
|
if (!key) {
|
|
73
58
|
return;
|
|
74
59
|
}
|
|
75
|
-
|
|
76
60
|
if (onSort && isRankable && key === sortKey && sortOrder === DESC) {
|
|
77
61
|
onSort({
|
|
78
62
|
key: null,
|
|
@@ -81,9 +65,7 @@ var DynamicTable = /*#__PURE__*/function (_React$Component) {
|
|
|
81
65
|
});
|
|
82
66
|
return;
|
|
83
67
|
}
|
|
84
|
-
|
|
85
68
|
var sortOrderFormatted = key !== sortKey ? ASC : toggleSortOrder(sortOrder);
|
|
86
|
-
|
|
87
69
|
if (onSort) {
|
|
88
70
|
onSort({
|
|
89
71
|
key: key,
|
|
@@ -93,69 +75,55 @@ var DynamicTable = /*#__PURE__*/function (_React$Component) {
|
|
|
93
75
|
}
|
|
94
76
|
};
|
|
95
77
|
});
|
|
96
|
-
|
|
97
78
|
_defineProperty(_assertThisInitialized(_this), "onSetPage", function (page, event) {
|
|
98
79
|
var onSetPage = _this.props.onSetPage;
|
|
99
|
-
|
|
100
80
|
if (onSetPage) {
|
|
101
81
|
onSetPage(page, event);
|
|
102
82
|
}
|
|
103
83
|
});
|
|
104
|
-
|
|
105
84
|
_defineProperty(_assertThisInitialized(_this), "onRankStart", function (params) {
|
|
106
85
|
_this.setState({
|
|
107
86
|
isRanking: true
|
|
108
87
|
});
|
|
109
|
-
|
|
110
88
|
if (_this.props.onRankStart) {
|
|
111
89
|
_this.props.onRankStart(params);
|
|
112
90
|
}
|
|
113
91
|
});
|
|
114
|
-
|
|
115
92
|
_defineProperty(_assertThisInitialized(_this), "onRankEnd", function (params) {
|
|
116
93
|
_this.setState({
|
|
117
94
|
isRanking: false
|
|
118
95
|
});
|
|
119
|
-
|
|
120
96
|
if (_this.props.onRankEnd) {
|
|
121
97
|
_this.props.onRankEnd(params);
|
|
122
98
|
}
|
|
123
99
|
});
|
|
124
|
-
|
|
125
100
|
_defineProperty(_assertThisInitialized(_this), "getSpinnerSize", function () {
|
|
126
101
|
var _this$props2 = _this.props,
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
102
|
+
page = _this$props2.page,
|
|
103
|
+
rows = _this$props2.rows,
|
|
104
|
+
rowsPerPage = _this$props2.rowsPerPage,
|
|
105
|
+
loadingSpinnerSize = _this$props2.loadingSpinnerSize;
|
|
132
106
|
if (loadingSpinnerSize) {
|
|
133
107
|
return loadingSpinnerSize;
|
|
134
108
|
}
|
|
135
|
-
|
|
136
109
|
return getPageRows(rows || [], page, rowsPerPage).length > 2 ? LARGE : SMALL;
|
|
137
110
|
});
|
|
138
|
-
|
|
139
111
|
_defineProperty(_assertThisInitialized(_this), "renderEmptyBody", function () {
|
|
140
112
|
var _this$props3 = _this.props,
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
113
|
+
emptyView = _this$props3.emptyView,
|
|
114
|
+
isLoading = _this$props3.isLoading,
|
|
115
|
+
testId = _this$props3.testId;
|
|
145
116
|
if (isLoading) {
|
|
146
117
|
return /*#__PURE__*/React.createElement(EmptyViewWithFixedHeight, {
|
|
147
118
|
testId: testId
|
|
148
119
|
});
|
|
149
120
|
}
|
|
150
|
-
|
|
151
121
|
return emptyView && /*#__PURE__*/React.createElement(EmptyViewContainer, {
|
|
152
122
|
testId: testId
|
|
153
123
|
}, emptyView);
|
|
154
124
|
});
|
|
155
|
-
|
|
156
125
|
return _this;
|
|
157
126
|
}
|
|
158
|
-
|
|
159
127
|
_createClass(DynamicTable, [{
|
|
160
128
|
key: "UNSAFE_componentWillMount",
|
|
161
129
|
value: function UNSAFE_componentWillMount() {
|
|
@@ -168,7 +136,6 @@ var DynamicTable = /*#__PURE__*/function (_React$Component) {
|
|
|
168
136
|
if (this.props.sortKey !== nextProps.sortKey || this.props.head !== nextProps.head) {
|
|
169
137
|
validateSortKey(nextProps.sortKey, nextProps.head);
|
|
170
138
|
}
|
|
171
|
-
|
|
172
139
|
if (this.props.head !== nextProps.head) {
|
|
173
140
|
assertIsSortable(nextProps.head);
|
|
174
141
|
}
|
|
@@ -177,31 +144,29 @@ var DynamicTable = /*#__PURE__*/function (_React$Component) {
|
|
|
177
144
|
key: "render",
|
|
178
145
|
value: function render() {
|
|
179
146
|
var _this2 = this;
|
|
180
|
-
|
|
181
147
|
var _this$props4 = this.props,
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
148
|
+
caption = _this$props4.caption,
|
|
149
|
+
head = _this$props4.head,
|
|
150
|
+
highlightedRowIndex = _this$props4.highlightedRowIndex,
|
|
151
|
+
isFixedSize = _this$props4.isFixedSize,
|
|
152
|
+
page = _this$props4.page,
|
|
153
|
+
rows = _this$props4.rows,
|
|
154
|
+
rowsPerPage = _this$props4.rowsPerPage,
|
|
155
|
+
sortKey = _this$props4.sortKey,
|
|
156
|
+
sortOrder = _this$props4.sortOrder,
|
|
157
|
+
isLoading = _this$props4.isLoading,
|
|
158
|
+
isRankable = _this$props4.isRankable,
|
|
159
|
+
isRankingDisabled = _this$props4.isRankingDisabled,
|
|
160
|
+
paginationi18n = _this$props4.paginationi18n,
|
|
161
|
+
onPageRowsUpdate = _this$props4.onPageRowsUpdate,
|
|
162
|
+
testId = _this$props4.testId,
|
|
163
|
+
passedDownTotalRows = _this$props4.totalRows,
|
|
164
|
+
label = _this$props4.label;
|
|
199
165
|
var rowsLength = rows && rows.length;
|
|
200
|
-
var totalPages;
|
|
166
|
+
var totalPages;
|
|
167
|
+
// set a flag to denote the dynamic table might get only one page of data
|
|
201
168
|
// for paginated data
|
|
202
|
-
|
|
203
169
|
var isTotalPagesControlledExternally = false;
|
|
204
|
-
|
|
205
170
|
if (passedDownTotalRows && Number.isInteger(passedDownTotalRows) && rowsPerPage && rowsLength && rowsLength <= passedDownTotalRows) {
|
|
206
171
|
/**
|
|
207
172
|
* If total number of rows / records have been passed down as prop
|
|
@@ -214,7 +179,6 @@ var DynamicTable = /*#__PURE__*/function (_React$Component) {
|
|
|
214
179
|
} else {
|
|
215
180
|
totalPages = rowsLength && rowsPerPage ? Math.ceil(rowsLength / rowsPerPage) : 0;
|
|
216
181
|
}
|
|
217
|
-
|
|
218
182
|
totalPages = totalPages < 1 ? 1 : totalPages;
|
|
219
183
|
var getPageNumber = page > totalPages ? totalPages : page; // page! required, because typescript can't yet see defaultProps to know that this won't be undefined
|
|
220
184
|
|
|
@@ -279,10 +243,8 @@ var DynamicTable = /*#__PURE__*/function (_React$Component) {
|
|
|
279
243
|
}, emptyBody));
|
|
280
244
|
}
|
|
281
245
|
}]);
|
|
282
|
-
|
|
283
246
|
return DynamicTable;
|
|
284
247
|
}(React.Component);
|
|
285
|
-
|
|
286
248
|
_defineProperty(DynamicTable, "defaultProps", {
|
|
287
249
|
isLoading: false,
|
|
288
250
|
isFixedSize: false,
|
|
@@ -300,7 +262,6 @@ _defineProperty(DynamicTable, "defaultProps", {
|
|
|
300
262
|
label: 'Pagination'
|
|
301
263
|
}
|
|
302
264
|
});
|
|
303
|
-
|
|
304
265
|
export { DynamicTable as DynamicTableWithoutAnalytics };
|
|
305
266
|
var createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
|
|
306
267
|
export default withAnalyticsContext({
|
|
@@ -3,27 +3,24 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
|
|
|
3
3
|
var _excluded = ["content", "inlineStyles", "testId", "isRanking", "innerRef", "isSortable"];
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { HeadCell } from '../styled/table-head';
|
|
6
|
-
|
|
7
6
|
var TableHeadCell = function TableHeadCell(_ref) {
|
|
8
7
|
var content = _ref.content,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
inlineStyles = _ref.inlineStyles,
|
|
9
|
+
testId = _ref.testId,
|
|
10
|
+
isRanking = _ref.isRanking,
|
|
11
|
+
innerRef = _ref.innerRef,
|
|
12
|
+
isSortable = _ref.isSortable,
|
|
13
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
16
14
|
return /*#__PURE__*/React.createElement(HeadCell, _extends({
|
|
17
15
|
style: inlineStyles,
|
|
18
16
|
"data-testid": testId && "".concat(testId, "--head--cell"),
|
|
19
17
|
ref: typeof innerRef !== 'string' ? innerRef : null // string refs must be discarded as LegacyRefs are not compatible with FC forwardRefs
|
|
20
18
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
21
|
-
|
|
22
19
|
}, rest, {
|
|
23
20
|
tabIndex: isSortable ? 0 : undefined,
|
|
24
21
|
isSortable: isSortable
|
|
25
22
|
}), /*#__PURE__*/React.createElement("span", null, content));
|
|
26
|
-
};
|
|
27
|
-
|
|
23
|
+
};
|
|
28
24
|
|
|
25
|
+
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
29
26
|
export default TableHeadCell;
|
|
@@ -8,41 +8,29 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
|
|
|
8
8
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
9
9
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
10
10
|
var _excluded = ["cells"],
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
_excluded2 = ["isSortable", "key"];
|
|
13
12
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
14
|
-
|
|
15
13
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
16
|
-
|
|
17
14
|
import React from 'react';
|
|
18
15
|
import { validateSortKey } from '../internal/helpers';
|
|
19
16
|
import { Head } from '../styled/table-head';
|
|
20
17
|
import RankableHeadCell from './rankable/table-head-cell';
|
|
21
18
|
import HeadCell from './table-head-cell';
|
|
22
|
-
|
|
23
19
|
var TableHead = /*#__PURE__*/function (_React$Component) {
|
|
24
20
|
_inherits(TableHead, _React$Component);
|
|
25
|
-
|
|
26
21
|
var _super = _createSuper(TableHead);
|
|
27
|
-
|
|
28
22
|
function TableHead() {
|
|
29
23
|
var _this;
|
|
30
|
-
|
|
31
24
|
_classCallCheck(this, TableHead);
|
|
32
|
-
|
|
33
25
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
34
26
|
args[_key] = arguments[_key];
|
|
35
27
|
}
|
|
36
|
-
|
|
37
28
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
38
|
-
|
|
39
29
|
_defineProperty(_assertThisInitialized(_this), "canSortOnEnterPressed", function (e, isSortable) {
|
|
40
30
|
return isSortable && e.key === 'Enter';
|
|
41
31
|
});
|
|
42
|
-
|
|
43
32
|
return _this;
|
|
44
33
|
}
|
|
45
|
-
|
|
46
34
|
_createClass(TableHead, [{
|
|
47
35
|
key: "UNSAFE_componentWillMount",
|
|
48
36
|
value: function UNSAFE_componentWillMount() {
|
|
@@ -59,34 +47,28 @@ var TableHead = /*#__PURE__*/function (_React$Component) {
|
|
|
59
47
|
key: "render",
|
|
60
48
|
value: function render() {
|
|
61
49
|
var _this2 = this;
|
|
62
|
-
|
|
63
50
|
var _this$props = this.props,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
51
|
+
head = _this$props.head,
|
|
52
|
+
sortKey = _this$props.sortKey,
|
|
53
|
+
sortOrder = _this$props.sortOrder,
|
|
54
|
+
isFixedSize = _this$props.isFixedSize,
|
|
55
|
+
onSort = _this$props.onSort,
|
|
56
|
+
isRanking = _this$props.isRanking,
|
|
57
|
+
isRankable = _this$props.isRankable,
|
|
58
|
+
testId = _this$props.testId;
|
|
73
59
|
if (!head) {
|
|
74
60
|
return null;
|
|
75
61
|
}
|
|
76
|
-
|
|
77
62
|
var HeadCellComponent = isRankable ? RankableHeadCell : HeadCell;
|
|
78
|
-
|
|
79
63
|
var cells = head.cells,
|
|
80
|
-
|
|
81
|
-
|
|
64
|
+
rest = _objectWithoutProperties(head, _excluded);
|
|
82
65
|
return /*#__PURE__*/React.createElement(Head, _extends({}, rest, {
|
|
83
66
|
isRanking: isRanking,
|
|
84
67
|
"data-testid": testId && "".concat(testId, "--head")
|
|
85
68
|
}), /*#__PURE__*/React.createElement("tr", null, cells.map(function (cell, index) {
|
|
86
69
|
var isSortable = cell.isSortable,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
70
|
+
key = cell.key,
|
|
71
|
+
restCellProps = _objectWithoutProperties(cell, _excluded2);
|
|
90
72
|
return /*#__PURE__*/React.createElement(HeadCellComponent, _extends({
|
|
91
73
|
isFixedSize: isFixedSize,
|
|
92
74
|
isSortable: !!isSortable,
|
|
@@ -102,9 +84,6 @@ var TableHead = /*#__PURE__*/function (_React$Component) {
|
|
|
102
84
|
})));
|
|
103
85
|
}
|
|
104
86
|
}]);
|
|
105
|
-
|
|
106
87
|
return TableHead;
|
|
107
88
|
}(React.Component); // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
108
|
-
|
|
109
|
-
|
|
110
89
|
export default TableHead;
|
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["cells"],
|
|
4
|
-
|
|
4
|
+
_excluded2 = ["content"];
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { TableBodyCell } from '../styled/table-cell';
|
|
7
7
|
import { TableBodyRow } from '../styled/table-row';
|
|
8
|
-
|
|
9
8
|
var Row = function Row(_ref) {
|
|
10
9
|
var row = _ref.row,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
head = _ref.head,
|
|
11
|
+
testId = _ref.testId,
|
|
12
|
+
isFixedSize = _ref.isFixedSize,
|
|
13
|
+
isHighlighted = _ref.isHighlighted;
|
|
16
14
|
var cells = row.cells,
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
restRowProps = _objectWithoutProperties(row, _excluded);
|
|
19
16
|
return /*#__PURE__*/React.createElement(TableBodyRow, _extends({}, restRowProps, {
|
|
20
17
|
isHighlighted: isHighlighted
|
|
21
18
|
}, isHighlighted ? {
|
|
@@ -24,14 +21,12 @@ var Row = function Row(_ref) {
|
|
|
24
21
|
"data-testid": testId && "".concat(testId, "--row-").concat(restRowProps.key)
|
|
25
22
|
}), cells.map(function (cell, cellIndex) {
|
|
26
23
|
var content = cell.content,
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
restCellProps = _objectWithoutProperties(cell, _excluded2);
|
|
29
25
|
var _ref2 = (head || {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
cells: []
|
|
27
|
+
}).cells[cellIndex] || {},
|
|
28
|
+
shouldTruncate = _ref2.shouldTruncate,
|
|
29
|
+
width = _ref2.width;
|
|
35
30
|
return /*#__PURE__*/React.createElement(TableBodyCell, _extends({
|
|
36
31
|
"data-testid": testId && "".concat(testId, "--cell-").concat(cellIndex)
|
|
37
32
|
}, restCellProps, {
|
|
@@ -42,7 +37,7 @@ var Row = function Row(_ref) {
|
|
|
42
37
|
width: width
|
|
43
38
|
}), content);
|
|
44
39
|
}));
|
|
45
|
-
};
|
|
46
|
-
|
|
40
|
+
};
|
|
47
41
|
|
|
42
|
+
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
48
43
|
export default Row;
|
|
@@ -6,51 +6,37 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
6
6
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
7
7
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
8
8
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
|
-
|
|
10
9
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
11
|
-
|
|
12
10
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
13
|
-
|
|
14
11
|
import React from 'react';
|
|
15
12
|
// Compute height and width of wrapped component before ranking
|
|
16
13
|
export default function withDimensions(WrappedComponent) {
|
|
17
14
|
return /*#__PURE__*/function (_React$Component) {
|
|
18
15
|
_inherits(WithDimensions, _React$Component);
|
|
19
|
-
|
|
20
16
|
var _super = _createSuper(WithDimensions);
|
|
21
|
-
|
|
22
17
|
function WithDimensions() {
|
|
23
18
|
var _this;
|
|
24
|
-
|
|
25
19
|
_classCallCheck(this, WithDimensions);
|
|
26
|
-
|
|
27
20
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
28
21
|
args[_key] = arguments[_key];
|
|
29
22
|
}
|
|
30
|
-
|
|
31
23
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
32
|
-
|
|
33
24
|
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
34
25
|
refWidth: 0,
|
|
35
26
|
refHeight: 0
|
|
36
27
|
});
|
|
37
|
-
|
|
38
28
|
_defineProperty(_assertThisInitialized(_this), "innerRef", function (ref) {
|
|
39
29
|
if (ref && !_this.props.isRanking) {
|
|
40
30
|
_this.ref = ref;
|
|
41
31
|
}
|
|
42
32
|
});
|
|
43
|
-
|
|
44
33
|
_defineProperty(_assertThisInitialized(_this), "updateDimensions", function () {
|
|
45
34
|
if (!_this.ref) {
|
|
46
35
|
return;
|
|
47
36
|
}
|
|
48
|
-
|
|
49
37
|
var clientRect = _this.ref.getBoundingClientRect();
|
|
50
|
-
|
|
51
38
|
var width = clientRect.width;
|
|
52
39
|
var height = clientRect.height;
|
|
53
|
-
|
|
54
40
|
if (width !== _this.state.refWidth || height !== _this.state.refHeight) {
|
|
55
41
|
_this.setState({
|
|
56
42
|
refWidth: width,
|
|
@@ -58,16 +44,13 @@ export default function withDimensions(WrappedComponent) {
|
|
|
58
44
|
});
|
|
59
45
|
}
|
|
60
46
|
});
|
|
61
|
-
|
|
62
47
|
return _this;
|
|
63
48
|
}
|
|
64
|
-
|
|
65
49
|
_createClass(WithDimensions, [{
|
|
66
50
|
key: "UNSAFE_componentWillReceiveProps",
|
|
67
51
|
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
68
52
|
var wasRanking = this.props.isRanking;
|
|
69
53
|
var willRanking = nextProps.isRanking;
|
|
70
|
-
|
|
71
54
|
if (willRanking && !wasRanking) {
|
|
72
55
|
this.updateDimensions();
|
|
73
56
|
}
|
|
@@ -76,18 +59,19 @@ export default function withDimensions(WrappedComponent) {
|
|
|
76
59
|
key: "render",
|
|
77
60
|
value: function render() {
|
|
78
61
|
var _this$state = this.state,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
return /*#__PURE__*/React.createElement(WrappedComponent
|
|
62
|
+
refWidth = _this$state.refWidth,
|
|
63
|
+
refHeight = _this$state.refHeight;
|
|
64
|
+
return /*#__PURE__*/React.createElement(WrappedComponent
|
|
65
|
+
//@ts-expect-error TODO Fix legit TypeScript 3.9.6 improved inference error
|
|
82
66
|
, _extends({
|
|
83
|
-
refWidth: refWidth
|
|
67
|
+
refWidth: refWidth
|
|
68
|
+
//@ts-expect-error TODO Fix legit TypeScript 3.9.6 improved inference error
|
|
84
69
|
,
|
|
85
70
|
refHeight: refHeight,
|
|
86
71
|
innerRef: this.innerRef
|
|
87
72
|
}, this.props));
|
|
88
73
|
}
|
|
89
74
|
}]);
|
|
90
|
-
|
|
91
75
|
return WithDimensions;
|
|
92
76
|
}(React.Component);
|
|
93
77
|
}
|