@synerise/ds-table 0.41.3 → 0.42.3
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 +32 -0
- package/dist/Cell/Action/ActionCell.js +1 -1
- package/dist/Cell/Action/ActionCell.styles.js +1 -1
- package/dist/Cell/Action/ActionCell.types.js +1 -0
- package/dist/Cell/AvatarLabel/AvatarLabel.js +5 -5
- package/dist/Cell/AvatarLabel/AvatarLabel.styles.js +2 -2
- package/dist/Cell/AvatarLabel/AvatarLabel.types.js +1 -0
- package/dist/Cell/Copyable/Copyable.styles.js +1 -1
- package/dist/Cell/Copyable/Copyable.types.js +1 -0
- package/dist/Cell/Copyable/CopyableCell.js +6 -20
- package/dist/Cell/Editable/EditableCell.js +13 -26
- package/dist/Cell/Editable/EditableCell.styles.js +1 -1
- package/dist/Cell/Editable/EditableCell.types.js +1 -0
- package/dist/Cell/FlagLabel/FlagLabelCell.js +2 -2
- package/dist/Cell/FlagLabel/FlagLabelCell.types.js +1 -0
- package/dist/Cell/IconLabel/IconLabel.js +1 -1
- package/dist/Cell/IconLabel/IconLabel.styles.js +1 -1
- package/dist/Cell/IconLabel/IconLabel.types.d.ts +1 -1
- package/dist/Cell/IconLabel/IconLabel.types.js +1 -0
- package/dist/Cell/IconTooltipCell/IconTooltipCell.js +2 -2
- package/dist/Cell/IconTooltipCell/IconTooltipCell.types.d.ts +1 -1
- package/dist/Cell/IconTooltipCell/IconTooltipCell.types.js +1 -0
- package/dist/Cell/LabelsWithShowMore/LabelsWithShowMore.js +6 -19
- package/dist/Cell/LabelsWithShowMore/LabelsWithShowMore.types.js +1 -0
- package/dist/Cell/LabelsWithShowMore/Modal/Modal.js +6 -19
- package/dist/Cell/LabelsWithShowMore/Modal/Modal.types.js +1 -0
- package/dist/Cell/Star/StarCell.js +7 -8
- package/dist/Cell/Star/StarCell.styles.d.ts +1 -1
- package/dist/Cell/Star/StarCell.styles.js +1 -1
- package/dist/Cell/Star/StarCell.types.js +1 -0
- package/dist/Cell/StatusLabel/StatusLabel.js +2 -2
- package/dist/Cell/StatusLabel/StatusLabel.types.js +1 -0
- package/dist/Cell/TagIcon/TagIcon.js +1 -1
- package/dist/Cell/TagIcon/TagIcon.types.js +1 -0
- package/dist/ColumnSortMenu/SortIcons.js +15 -16
- package/dist/ColumnSortMenu/SortRenderer.js +40 -55
- package/dist/ColumnSortMenu/TitleWithSort.js +5 -5
- package/dist/ColumnSortMenu/columnWithSortButtons.js +7 -5
- package/dist/ColumnSortMenu/groupedColumnsSort.js +5 -17
- package/dist/ColumnSortMenu/replaceSortButtons.js +1 -1
- package/dist/ColumnSortMenu/useSortState.js +38 -43
- package/dist/DefaultTable/DefaultTable.js +35 -54
- package/dist/FilterTrigger/FilterTrigger.js +18 -32
- package/dist/FilterTrigger/FilterTrigger.styles.js +1 -1
- package/dist/FilterTrigger/FilterTrigger.types.js +1 -0
- package/dist/GroupTable/GroupTable.js +16 -38
- package/dist/GroupTable/GroupTable.styles.js +2 -2
- package/dist/GroupTable/GroupTable.types.js +1 -0
- package/dist/GroupTable/GroupTableBody/GroupTableBody.js +23 -37
- package/dist/GroupTable/GroupTableBody/GroupTableBody.types.js +1 -0
- package/dist/GroupTable/GroupTableHeader/GroupTableHeader.js +3 -3
- package/dist/GroupTable/GroupTableHeader/GroupTableHeader.types.js +1 -0
- package/dist/InfiniteScroll/BackToTopButton.js +4 -5
- package/dist/InfiniteScroll/InfiniteLoaderItem.js +12 -13
- package/dist/ItemsMenu/ItemsMenu.js +1 -1
- package/dist/ItemsMenu/ItemsMenu.types.js +1 -0
- package/dist/Table.js +26 -38
- package/dist/Table.styles.js +2 -2
- package/dist/Table.types.js +1 -0
- package/dist/TableHeader/TableHeader.js +14 -27
- package/dist/TableHeader/TableHeader.types.js +1 -0
- package/dist/TableHeader/TableLimit/TableLimit.js +4 -4
- package/dist/TableHeader/TableLimit/TableLimit.types.js +1 -0
- package/dist/TableHeader/TableSelection.js +29 -40
- package/dist/TableHeader/TableSelection.types.js +1 -0
- package/dist/TreeTable/TreeTable.js +15 -30
- package/dist/TreeTable/TreeTable.styles.js +2 -2
- package/dist/VirtualTable/VirtualTable.js +46 -66
- package/dist/VirtualTable/VirtualTable.styles.js +1 -1
- package/dist/VirtualTable/VirtualTable.types.js +1 -0
- package/dist/VirtualTable/VirtualTableRow.js +53 -76
- package/dist/hooks/useRowStar.js +7 -7
- package/dist/hooks/useRowStar.types.js +1 -0
- package/dist/style/index.css +1 -1
- package/dist/utils/calculatePixels.js +1 -1
- package/dist/utils/locale.js +1 -1
- package/package.json +20 -20
|
@@ -1,35 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
var _excluded = ["style"];
|
|
2
2
|
|
|
3
|
-
function
|
|
3
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
4
|
|
|
5
5
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
6
6
|
|
|
7
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
8
|
-
|
|
9
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
|
-
|
|
11
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
|
|
12
|
-
|
|
13
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
14
|
-
|
|
15
7
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
16
8
|
|
|
17
9
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
18
10
|
|
|
19
11
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
20
12
|
|
|
21
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
22
|
-
|
|
23
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
24
|
-
|
|
25
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
26
|
-
|
|
27
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
28
|
-
|
|
29
|
-
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
30
|
-
|
|
31
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
32
|
-
|
|
33
13
|
import * as React from 'react';
|
|
34
14
|
import { FixedSizeList as List } from 'react-window';
|
|
35
15
|
import ResizeObserver from 'rc-resize-observer';
|
|
@@ -59,12 +39,11 @@ var CustomScrollbar = function CustomScrollbar(containerRef) {
|
|
|
59
39
|
style = _ref.style;
|
|
60
40
|
|
|
61
41
|
var _React$useState = React.useState(null),
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
setHeader = _React$useState2[1];
|
|
42
|
+
header = _React$useState[0],
|
|
43
|
+
setHeader = _React$useState[1];
|
|
65
44
|
|
|
66
45
|
React.useEffect(function () {
|
|
67
|
-
if (containerRef
|
|
46
|
+
if (containerRef != null && containerRef.current) {
|
|
68
47
|
var headerElement = containerRef.current.querySelector('.ant-table-header');
|
|
69
48
|
headerElement && setHeader(headerElement);
|
|
70
49
|
}
|
|
@@ -78,11 +57,11 @@ var CustomScrollbar = function CustomScrollbar(containerRef) {
|
|
|
78
57
|
|
|
79
58
|
onScroll && onScroll(e);
|
|
80
59
|
}, [onScroll, header]);
|
|
81
|
-
return React.createElement(Scrollbar, {
|
|
60
|
+
return /*#__PURE__*/React.createElement(Scrollbar, {
|
|
82
61
|
ref: ref,
|
|
83
62
|
onScroll: onScrollHandler,
|
|
84
63
|
absolute: true,
|
|
85
|
-
maxHeight: style
|
|
64
|
+
maxHeight: style == null ? void 0 : style.height
|
|
86
65
|
}, children);
|
|
87
66
|
});
|
|
88
67
|
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -112,12 +91,11 @@ function VirtualTable(props) {
|
|
|
112
91
|
var listRef = React.useRef(null);
|
|
113
92
|
var containerRef = React.useRef(null);
|
|
114
93
|
|
|
115
|
-
var _React$
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
setTableWidth = _React$useState4[1];
|
|
94
|
+
var _React$useState2 = React.useState(initialWidth),
|
|
95
|
+
tableWidth = _React$useState2[0],
|
|
96
|
+
setTableWidth = _React$useState2[1];
|
|
119
97
|
|
|
120
|
-
var _useRowStar = useRowStar((rowStar
|
|
98
|
+
var _useRowStar = useRowStar((rowStar == null ? void 0 : rowStar.starredRowKeys) || []),
|
|
121
99
|
getRowStarColumn = _useRowStar.getRowStarColumn;
|
|
122
100
|
|
|
123
101
|
React.useEffect(function () {
|
|
@@ -129,7 +107,7 @@ function VirtualTable(props) {
|
|
|
129
107
|
onClick: function onClick(e) {
|
|
130
108
|
e.stopPropagation();
|
|
131
109
|
|
|
132
|
-
if (typeof (rowStar
|
|
110
|
+
if (typeof (rowStar == null ? void 0 : rowStar.onClick) === 'function') {
|
|
133
111
|
rowStar.onClick(e);
|
|
134
112
|
}
|
|
135
113
|
}
|
|
@@ -155,24 +133,24 @@ function VirtualTable(props) {
|
|
|
155
133
|
var recordKey = getRowKey(record);
|
|
156
134
|
var allChildsChecked = // @ts-expect-error: Property 'children' does not exist on type 'T'.ts(2339)
|
|
157
135
|
Array.isArray(record.children) && // @ts-expect-error: Property 'children' does not exist on type 'T'.ts(2339)
|
|
158
|
-
((_record$children = record.children)
|
|
136
|
+
((_record$children = record.children) == null ? void 0 : _record$children.filter(function (child) {
|
|
159
137
|
var childKey = getRowKey(child);
|
|
160
|
-
return childKey && (selection
|
|
138
|
+
return childKey && (selection == null ? void 0 : selection.selectedRowKeys.indexOf(childKey)) < 0;
|
|
161
139
|
}).length) === 0;
|
|
162
140
|
var checkedChilds = // @ts-expect-error: Property 'children' does not exist on type 'T'.ts(2339)
|
|
163
|
-
((_record$children2 = record.children)
|
|
141
|
+
((_record$children2 = record.children) == null ? void 0 : _record$children2.filter(function (child) {
|
|
164
142
|
var childKey = getRowKey(child);
|
|
165
|
-
return childKey && (selection
|
|
143
|
+
return childKey && (selection == null ? void 0 : selection.selectedRowKeys.indexOf(childKey)) >= 0;
|
|
166
144
|
})) || [];
|
|
167
145
|
var isIndeterminate = // @ts-expect-error: Property 'children' does not exist on type 'T'.ts(2339)
|
|
168
146
|
Array.isArray(record.children) && checkedChilds.length > 0 && // @ts-expect-error: Property 'children' does not exist on type 'T'.ts(2339)
|
|
169
|
-
checkedChilds.length < (((_record$children3 = record.children)
|
|
147
|
+
checkedChilds.length < (((_record$children3 = record.children) == null ? void 0 : _record$children3.length) || 0);
|
|
170
148
|
var checked = recordKey !== undefined && selection.selectedRowKeys && selection.selectedRowKeys.indexOf(recordKey) >= 0 || allChildsChecked;
|
|
171
|
-
return recordKey !== undefined && React.createElement(Tooltip, {
|
|
172
|
-
title: tableLocale
|
|
149
|
+
return recordKey !== undefined && /*#__PURE__*/React.createElement(Tooltip, {
|
|
150
|
+
title: tableLocale == null ? void 0 : tableLocale.selectRowTooltip,
|
|
173
151
|
mouseLeaveDelay: 0
|
|
174
|
-
}, React.createElement(Button.Checkbox, {
|
|
175
|
-
key: "checkbox-"
|
|
152
|
+
}, /*#__PURE__*/React.createElement(Button.Checkbox, {
|
|
153
|
+
key: "checkbox-" + recordKey,
|
|
176
154
|
checked: checked,
|
|
177
155
|
disabled: !checked && Boolean(selection.limit && selection.limit <= selection.selectedRowKeys.length),
|
|
178
156
|
indeterminate: isIndeterminate,
|
|
@@ -191,14 +169,14 @@ function VirtualTable(props) {
|
|
|
191
169
|
var k = getRowKey(child);
|
|
192
170
|
|
|
193
171
|
if (k && selectedRowKeys.indexOf(k) >= 0) {
|
|
194
|
-
selectedRows = [].concat(
|
|
172
|
+
selectedRows = [].concat(selectedRows, [child]);
|
|
195
173
|
}
|
|
196
174
|
});
|
|
197
175
|
} else {
|
|
198
176
|
var k = getRowKey(row);
|
|
199
177
|
|
|
200
178
|
if (k && selectedRowKeys.indexOf(k) >= 0) {
|
|
201
|
-
selectedRows = [].concat(
|
|
179
|
+
selectedRows = [].concat(selectedRows, [row]);
|
|
202
180
|
}
|
|
203
181
|
}
|
|
204
182
|
});
|
|
@@ -207,9 +185,9 @@ function VirtualTable(props) {
|
|
|
207
185
|
// @ts-expect-error: Property 'children' does not exist on type 'T'.ts(2339)
|
|
208
186
|
if (Array.isArray(record.children)) {
|
|
209
187
|
// @ts-expect-error: Property 'children' does not exist on type 'T'.ts(2339)
|
|
210
|
-
selectedRows = [].concat(
|
|
188
|
+
selectedRows = [].concat(selectedRows, record.children);
|
|
211
189
|
} else {
|
|
212
|
-
selectedRows = [].concat(
|
|
190
|
+
selectedRows = [].concat(selectedRows, [record]);
|
|
213
191
|
} // @ts-expect-error: Property 'children' does not exist on type 'T'.ts(2339)
|
|
214
192
|
|
|
215
193
|
} else if (Array.isArray(record.children)) {
|
|
@@ -226,14 +204,14 @@ function VirtualTable(props) {
|
|
|
226
204
|
});
|
|
227
205
|
}
|
|
228
206
|
|
|
229
|
-
selectedRows =
|
|
207
|
+
selectedRows = [].concat(new Set(selectedRows));
|
|
230
208
|
onChange && onChange(selectedRows.map(function (selected) {
|
|
231
209
|
return getRowKey(selected);
|
|
232
210
|
}), selectedRows);
|
|
233
211
|
}
|
|
234
212
|
}));
|
|
235
213
|
}
|
|
236
|
-
}, !!rowStar && rowStarColumn].concat(
|
|
214
|
+
}, !!rowStar && rowStarColumn].concat(columns));
|
|
237
215
|
}, [columns, selection, rowStar, rowStarColumn, getRowKey, dataSource, tableLocale]);
|
|
238
216
|
var mergedColumns = React.useMemo(function () {
|
|
239
217
|
var widthColumnCount = virtualColumns.filter(function (_ref2) {
|
|
@@ -248,7 +226,7 @@ function VirtualTable(props) {
|
|
|
248
226
|
var width = _ref4.width;
|
|
249
227
|
return total + width;
|
|
250
228
|
}, 0);
|
|
251
|
-
return virtualColumns
|
|
229
|
+
return virtualColumns == null ? void 0 : virtualColumns.map(function (column) {
|
|
252
230
|
if (column.width) {
|
|
253
231
|
return _objectSpread({}, column, {
|
|
254
232
|
width: calculatePixels(column.width)
|
|
@@ -262,12 +240,12 @@ function VirtualTable(props) {
|
|
|
262
240
|
}, [virtualColumns, tableWidth, initialWidth]);
|
|
263
241
|
var listInnerElementType = React.forwardRef(function (_ref5, ref) {
|
|
264
242
|
var style = _ref5.style,
|
|
265
|
-
rest =
|
|
243
|
+
rest = _objectWithoutPropertiesLoose(_ref5, _excluded);
|
|
266
244
|
|
|
267
|
-
return React.createElement("div", _extends({
|
|
245
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
268
246
|
ref: ref,
|
|
269
247
|
style: _objectSpread({}, style, {
|
|
270
|
-
height:
|
|
248
|
+
height: Number(style == null ? void 0 : style.height) + infiniteLoaderItemHeight + "px"
|
|
271
249
|
})
|
|
272
250
|
}, rest));
|
|
273
251
|
});
|
|
@@ -294,16 +272,16 @@ function VirtualTable(props) {
|
|
|
294
272
|
var scrollOffset = _ref6.scrollOffset,
|
|
295
273
|
scrollDirection = _ref6.scrollDirection;
|
|
296
274
|
|
|
297
|
-
if (scrollDirection === 'forward' && scrollOffset >= listHeight && typeof (infiniteScroll
|
|
275
|
+
if (scrollDirection === 'forward' && scrollOffset >= listHeight && typeof (infiniteScroll == null ? void 0 : infiniteScroll.onScrollEndReach) === 'function') {
|
|
298
276
|
infiniteScroll.onScrollEndReach();
|
|
299
277
|
}
|
|
300
278
|
|
|
301
|
-
if (scrollDirection === 'backward' && scrollOffset === 0 && typeof (infiniteScroll
|
|
279
|
+
if (scrollDirection === 'backward' && scrollOffset === 0 && typeof (infiniteScroll == null ? void 0 : infiniteScroll.onScrollTopReach) === 'function') {
|
|
302
280
|
infiniteScroll.onScrollTopReach();
|
|
303
281
|
}
|
|
304
282
|
};
|
|
305
283
|
|
|
306
|
-
return React.createElement(List, {
|
|
284
|
+
return /*#__PURE__*/React.createElement(List, {
|
|
307
285
|
ref: listRef,
|
|
308
286
|
onScroll: handleListScroll,
|
|
309
287
|
className: "virtual-grid",
|
|
@@ -329,21 +307,23 @@ function VirtualTable(props) {
|
|
|
329
307
|
}, VirtualTableRow);
|
|
330
308
|
};
|
|
331
309
|
|
|
332
|
-
if (expandable
|
|
310
|
+
if (expandable != null && (_expandable$expandedR = expandable.expandedRowKeys) != null && _expandable$expandedR.length) {
|
|
333
311
|
var expandedRows = rawData.reduce(function (result, currentRow) {
|
|
334
312
|
var _expandable$expandedR2;
|
|
335
313
|
|
|
336
314
|
var key = getRowKey(currentRow);
|
|
337
315
|
|
|
338
|
-
if (key !== undefined &&
|
|
316
|
+
if (key !== undefined && expandable != null && (_expandable$expandedR2 = expandable.expandedRowKeys) != null && _expandable$expandedR2.includes(key) && // @ts-expect-error: Property 'children' does not exist on type 'T'.ts(2339)
|
|
339
317
|
Array.isArray(currentRow.children) && // @ts-expect-error: Property 'children' does not exist on type 'T'.ts(2339)
|
|
340
318
|
currentRow.children.length) {
|
|
341
|
-
return [].concat(
|
|
342
|
-
|
|
343
|
-
|
|
319
|
+
return [].concat(result, [currentRow], currentRow.children.map(function (child) {
|
|
320
|
+
var _objectSpread2;
|
|
321
|
+
|
|
322
|
+
return _objectSpread({}, child, (_objectSpread2 = {}, _objectSpread2[EXPANDED_ROW_PROPERTY] = true, _objectSpread2));
|
|
323
|
+
}));
|
|
344
324
|
}
|
|
345
325
|
|
|
346
|
-
return [].concat(
|
|
326
|
+
return [].concat(result, [currentRow]);
|
|
347
327
|
}, []);
|
|
348
328
|
return renderVirtualList(expandedRows);
|
|
349
329
|
}
|
|
@@ -352,16 +332,16 @@ function VirtualTable(props) {
|
|
|
352
332
|
};
|
|
353
333
|
|
|
354
334
|
var columnsSliceStartIndex = Number(!!selection) + Number(!!rowStar);
|
|
355
|
-
return React.createElement(RelativeContainer, {
|
|
335
|
+
return /*#__PURE__*/React.createElement(RelativeContainer, {
|
|
356
336
|
key: "relative-container",
|
|
357
337
|
ref: containerRef,
|
|
358
338
|
style: relativeInlineStyle
|
|
359
|
-
}, React.createElement(ResizeObserver, {
|
|
339
|
+
}, /*#__PURE__*/React.createElement(ResizeObserver, {
|
|
360
340
|
onResize: function onResize(_ref7) {
|
|
361
341
|
var offsetWidth = _ref7.offsetWidth;
|
|
362
342
|
setTableWidth(offsetWidth);
|
|
363
343
|
}
|
|
364
|
-
}, React.createElement(DSTable, _extends({}, props, {
|
|
344
|
+
}, /*#__PURE__*/React.createElement(DSTable, _extends({}, props, {
|
|
365
345
|
className: classNames(className, 'virtual-table', !!infiniteScroll && 'virtual-table-infinite-scroll') // Remove columns which cause header columns indent
|
|
366
346
|
,
|
|
367
347
|
columns: mergedColumns.slice(columnsSliceStartIndex),
|
|
@@ -370,7 +350,7 @@ function VirtualTable(props) {
|
|
|
370
350
|
body: renderBody
|
|
371
351
|
},
|
|
372
352
|
locale: tableLocale
|
|
373
|
-
}))), !!(infiniteScroll
|
|
353
|
+
}))), !!(infiniteScroll != null && infiniteScroll.showBackToTopButton) && /*#__PURE__*/React.createElement(BackToTopButton, {
|
|
374
354
|
onClick: handleBackToTopClick
|
|
375
355
|
}, tableLocale.infiniteScrollBackToTop));
|
|
376
356
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,30 +1,10 @@
|
|
|
1
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
2
|
-
|
|
3
1
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
4
2
|
|
|
5
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
6
4
|
|
|
7
5
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
6
|
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
12
|
-
|
|
13
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
14
|
-
|
|
15
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
16
|
-
|
|
17
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
18
|
-
|
|
19
|
-
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
20
|
-
|
|
21
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
22
|
-
|
|
23
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
24
|
-
|
|
25
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
26
|
-
|
|
27
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
7
|
+
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
|
28
8
|
|
|
29
9
|
import * as React from 'react';
|
|
30
10
|
import classNames from 'classnames';
|
|
@@ -44,65 +24,62 @@ var calculateToPixelsIfDefined = function calculateToPixelsIfDefined(value) {
|
|
|
44
24
|
};
|
|
45
25
|
|
|
46
26
|
var VirtualTableRow = /*#__PURE__*/function (_React$PureComponent) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
var _super = _createSuper(VirtualTableRow);
|
|
27
|
+
_inheritsLoose(VirtualTableRow, _React$PureComponent);
|
|
50
28
|
|
|
51
29
|
function VirtualTableRow() {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return _super.apply(this, arguments);
|
|
30
|
+
return _React$PureComponent.apply(this, arguments) || this;
|
|
55
31
|
}
|
|
56
32
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
33
|
+
var _proto = VirtualTableRow.prototype;
|
|
34
|
+
|
|
35
|
+
_proto.render = function render() {
|
|
36
|
+
var _this$props = this.props,
|
|
37
|
+
index = _this$props.index,
|
|
38
|
+
style = _this$props.style,
|
|
39
|
+
data = _this$props.data;
|
|
40
|
+
var mergedColumns = data.mergedColumns,
|
|
41
|
+
onRowClick = data.onRowClick,
|
|
42
|
+
selection = data.selection,
|
|
43
|
+
dataSource = data.dataSource,
|
|
44
|
+
cellHeight = data.cellHeight,
|
|
45
|
+
infiniteScroll = data.infiniteScroll,
|
|
46
|
+
defaultTableProps = data.defaultTableProps;
|
|
47
|
+
var rowData = dataSource[index];
|
|
48
|
+
return (
|
|
49
|
+
/*#__PURE__*/
|
|
50
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
51
|
+
React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(S.RowWrapper, {
|
|
52
|
+
className: classNames('virtual-table-row', {
|
|
53
|
+
'ds-expanded-row': rowData[EXPANDED_ROW_PROPERTY]
|
|
54
|
+
}),
|
|
55
|
+
style: style,
|
|
56
|
+
onClick: function onClick() {
|
|
57
|
+
return onRowClick && onRowClick(rowData);
|
|
58
|
+
}
|
|
59
|
+
}, mergedColumns.map(function (column, columnIndex) {
|
|
60
|
+
return /*#__PURE__*/React.createElement(S.ColWrapper, {
|
|
61
|
+
className: classNames('virtual-table-cell', {
|
|
62
|
+
'virtual-table-cell-last': columnIndex === mergedColumns.length - 1,
|
|
63
|
+
'ant-table-selection-column': columnIndex === 0 && selection,
|
|
64
|
+
'ds-expanded-row-first': rowData[EXPANDED_ROW_PROPERTY] && columnIndex === 0,
|
|
65
|
+
'ds-expanded-row-data': rowData[EXPANDED_ROW_PROPERTY] && (columnIndex === 1 && selection || columnIndex === 0 && !selection)
|
|
66
|
+
}, isColumnSortingActive((defaultTableProps == null ? void 0 : defaultTableProps.columns) || [], column) && 'ant-table-column-sort', column.className),
|
|
67
|
+
key: "row-" + index + "-column-" + (column.dataIndex || column.key),
|
|
68
|
+
minWidth: calculateToPixelsIfDefined(column == null ? void 0 : column.minWidth),
|
|
69
|
+
width: column.width,
|
|
70
|
+
maxWidth: calculateToPixelsIfDefined(column == null ? void 0 : column.maxWidth)
|
|
71
|
+
}, column.render ? column.render(rowData[column.dataIndex], rowData) : rowData[column.dataIndex]);
|
|
72
|
+
})), infiniteScroll && index === dataSource.length - 1 && /*#__PURE__*/React.createElement(S.RowWrapper, {
|
|
73
|
+
style: _objectSpread({}, style, {
|
|
74
|
+
top: Number(style.top) + cellHeight + "px",
|
|
75
|
+
height: '64px',
|
|
76
|
+
padding: '16px 24px'
|
|
77
|
+
})
|
|
78
|
+
}, /*#__PURE__*/React.createElement(InfiniteLoaderItem, {
|
|
79
|
+
infiniteScroll: infiniteScroll
|
|
80
|
+
})))
|
|
81
|
+
);
|
|
82
|
+
};
|
|
106
83
|
|
|
107
84
|
return VirtualTableRow;
|
|
108
85
|
}(React.PureComponent);
|
package/dist/hooks/useRowStar.js
CHANGED
|
@@ -13,24 +13,24 @@ var createRowStarColumn = function createRowStarColumn(_ref) {
|
|
|
13
13
|
selection = _ref2.selection;
|
|
14
14
|
return {
|
|
15
15
|
key: '_row-star',
|
|
16
|
-
className:
|
|
16
|
+
className: ((rowStar == null ? void 0 : rowStar.className) || '') + " ds-table-star-column",
|
|
17
17
|
width: !!selection && !!rowStar ? STAR_COL_WIDTH_SELECTON : STAR_COL_WIDTH_SINGLE,
|
|
18
|
-
render: (rowStar
|
|
18
|
+
render: (rowStar == null ? void 0 : rowStar.renderCell) || function (value, _ref3) {
|
|
19
19
|
var key = _ref3.key;
|
|
20
20
|
var keyString = String(key);
|
|
21
|
-
return React.createElement(Tooltip, {
|
|
22
|
-
title: locale
|
|
23
|
-
}, React.createElement(Button.Star, {
|
|
21
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
22
|
+
title: locale == null ? void 0 : locale.starRowTooltip
|
|
23
|
+
}, /*#__PURE__*/React.createElement(Button.Star, {
|
|
24
24
|
"data-testid": "ds-table-star-button",
|
|
25
25
|
active: isStarred(keyString),
|
|
26
26
|
onClick: function onClick(e) {
|
|
27
27
|
var newStarredRowKeys = toggleStarred(keyString);
|
|
28
28
|
|
|
29
|
-
if (typeof (rowStar
|
|
29
|
+
if (typeof (rowStar == null ? void 0 : rowStar.onChange) === 'function') {
|
|
30
30
|
rowStar.onChange(newStarredRowKeys);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
if (typeof (rowStar
|
|
33
|
+
if (typeof (rowStar == null ? void 0 : rowStar.onClick) === 'function') {
|
|
34
34
|
rowStar.onClick(e);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|