@synerise/ds-table 0.51.3 → 0.52.0
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 +19 -0
- package/dist/Cell/AvatarLabel/AvatarLabel.d.ts +2 -1
- package/dist/Cell/AvatarLabel/AvatarLabel.styles.d.ts +1 -1
- package/dist/GroupTable/GroupTableBody/GroupTableBody.d.ts +1 -0
- package/dist/GroupTable/GroupTableHeader/GroupTableHeader.d.ts +1 -0
- package/dist/InfiniteScroll/InfiniteLoaderItem.styles.d.ts +2 -1
- package/dist/VirtualTable/VirtualTable.js +48 -18
- package/dist/VirtualTable/VirtualTable.styles.d.ts +1 -0
- package/dist/VirtualTable/VirtualTable.styles.js +6 -6
- package/package.json +24 -24
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [0.52.0](https://github.com/synerise/synerise-design/compare/@synerise/ds-table@0.51.4...@synerise/ds-table@0.52.0) (2024-05-31)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **table:** reveal table header in sticky virtual table ([315b0f8](https://github.com/synerise/synerise-design/commit/315b0f8b3068362881f23133966ac0a59003e253))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [0.51.4](https://github.com/synerise/synerise-design/compare/@synerise/ds-table@0.51.3...@synerise/ds-table@0.51.4) (2024-05-29)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @synerise/ds-table
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## [0.51.3](https://github.com/synerise/synerise-design/compare/@synerise/ds-table@0.51.2...@synerise/ds-table@0.51.3) (2024-05-23)
|
|
7
26
|
|
|
8
27
|
**Note:** Version bump only for package @synerise/ds-table
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { AvatarLabelProps } from './AvatarLabel.types';
|
|
2
|
-
declare const AvatarLabel: ({ avatar, avatarAction, avatarLink, title, labels, icon, ellipsis, maxWidth, avatarSize, loader, }: AvatarLabelProps) => JSX.Element;
|
|
3
|
+
declare const AvatarLabel: ({ avatar, avatarAction, avatarLink, title, labels, icon, ellipsis, maxWidth, avatarSize, loader, }: AvatarLabelProps) => React.JSX.Element;
|
|
3
4
|
export default AvatarLabel;
|
|
@@ -12,7 +12,7 @@ export declare const Title: import("styled-components").StyledComponent<({ size,
|
|
|
12
12
|
ellipsis?: import("@synerise/ds-typography/dist/Ellipsis").EllipsisProps | undefined;
|
|
13
13
|
children?: import("react").ReactNode;
|
|
14
14
|
className?: string | undefined;
|
|
15
|
-
}) => JSX.Element, any, {
|
|
15
|
+
}) => import("react").JSX.Element, any, {
|
|
16
16
|
hasEllipsis?: boolean | undefined;
|
|
17
17
|
maxWidth: number | undefined;
|
|
18
18
|
avatarSize?: string | undefined;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { Props } from './GroupTableBody.types';
|
|
2
3
|
declare function GroupTableBody<T extends unknown>({ group, columns, rowKey, selection, allItems, expanded, expandGroup, addItem, activeGroup, hideGroupExpander, }: Props<T>): JSX.Element;
|
|
3
4
|
export default GroupTableBody;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const Loader: import("styled-components").StyledComponent<({ size, label, labelPosition, color, percent, percentFormatter, text, fontSize, mode, className, }: import("@synerise/ds-loader/dist/Loader.types").LoaderProps) => import("react").JSX.Element, any, {}, never>;
|
|
@@ -59,18 +59,24 @@ var VirtualTable = function VirtualTable(props, forwardedRef) {
|
|
|
59
59
|
var intl = useIntl();
|
|
60
60
|
var tableLocale = useTableLocale(intl, locale);
|
|
61
61
|
var listRef = useRef(null);
|
|
62
|
+
var listScrollTopRef = useRef(0);
|
|
62
63
|
var outerListRef = useRef(null);
|
|
63
64
|
var containerRef = useRef(null);
|
|
64
65
|
var horizontalScrollRef = useRef(null);
|
|
65
66
|
var customBodyOnScrollRef = useRef();
|
|
67
|
+
|
|
68
|
+
var _useState = useState(false),
|
|
69
|
+
isHeaderVisible = _useState[0],
|
|
70
|
+
setIsHeaderVisible = _useState[1];
|
|
71
|
+
|
|
72
|
+
var _useState2 = useState(null),
|
|
73
|
+
firstItem = _useState2[0],
|
|
74
|
+
setFirstItem = _useState2[1];
|
|
75
|
+
|
|
66
76
|
var hasInfiniteScroll = Boolean(infiniteScroll);
|
|
67
77
|
var isSticky = Boolean(sticky);
|
|
68
78
|
var stickyScrollThreshold = sticky && sticky.scrollThreshold;
|
|
69
|
-
|
|
70
|
-
var _React$useState = React.useState(null),
|
|
71
|
-
firstItem = _React$useState[0],
|
|
72
|
-
setFirstItem = _React$useState[1];
|
|
73
|
-
|
|
79
|
+
var dataSourceEmpty = dataSource.length === 0;
|
|
74
80
|
var updateFirstItem = useCallback(function (findFirstItem) {
|
|
75
81
|
var prevFirstItemIndex = dataSource.findIndex(findFirstItem);
|
|
76
82
|
setFirstItem(dataSource[0]);
|
|
@@ -86,9 +92,14 @@ var VirtualTable = function VirtualTable(props, forwardedRef) {
|
|
|
86
92
|
}
|
|
87
93
|
}
|
|
88
94
|
}, [dataSource, setFirstItem, onScrollToRecordIndex]);
|
|
89
|
-
|
|
95
|
+
useEffect(function () {
|
|
96
|
+
if (dataSourceEmpty) {
|
|
97
|
+
setIsHeaderVisible(false);
|
|
98
|
+
}
|
|
99
|
+
}, [dataSourceEmpty]);
|
|
100
|
+
useEffect(function () {
|
|
90
101
|
try {
|
|
91
|
-
if (!(infiniteScroll != null && infiniteScroll.prevPage) ||
|
|
102
|
+
if (!(infiniteScroll != null && infiniteScroll.prevPage) || dataSourceEmpty) {
|
|
92
103
|
return;
|
|
93
104
|
}
|
|
94
105
|
|
|
@@ -129,8 +140,8 @@ var VirtualTable = function VirtualTable(props, forwardedRef) {
|
|
|
129
140
|
} catch (error) {
|
|
130
141
|
throw new Error('Cannot find firs item');
|
|
131
142
|
}
|
|
132
|
-
}, [dataSource,
|
|
133
|
-
|
|
143
|
+
}, [dataSource, dataSourceEmpty, rowKey, firstItem, infiniteScroll, updateFirstItem]);
|
|
144
|
+
useEffect(function () {
|
|
134
145
|
var _infiniteScroll$prevP;
|
|
135
146
|
|
|
136
147
|
if (listRef.current && infiniteScroll != null && (_infiniteScroll$prevP = infiniteScroll.prevPage) != null && _infiniteScroll$prevP.hasMore) {
|
|
@@ -147,13 +158,13 @@ var VirtualTable = function VirtualTable(props, forwardedRef) {
|
|
|
147
158
|
};
|
|
148
159
|
});
|
|
149
160
|
|
|
150
|
-
var
|
|
151
|
-
tableWidth =
|
|
152
|
-
setTableWidth =
|
|
161
|
+
var _useState3 = useState(initialWidth),
|
|
162
|
+
tableWidth = _useState3[0],
|
|
163
|
+
setTableWidth = _useState3[1];
|
|
153
164
|
|
|
154
|
-
var
|
|
155
|
-
scrollWidth =
|
|
156
|
-
setScrollWidth =
|
|
165
|
+
var _useState4 = useState(initialWidth),
|
|
166
|
+
scrollWidth = _useState4[0],
|
|
167
|
+
setScrollWidth = _useState4[1];
|
|
157
168
|
|
|
158
169
|
var _useRowStar = useRowStar((rowStar == null ? void 0 : rowStar.starredRowKeys) || []),
|
|
159
170
|
getRowStarColumn = _useRowStar.getRowStarColumn; // deprecated, verify if not used and remove
|
|
@@ -219,17 +230,26 @@ var VirtualTable = function VirtualTable(props, forwardedRef) {
|
|
|
219
230
|
limit = _ref3.limit,
|
|
220
231
|
independentSelectionExpandedRows = _ref3.independentSelectionExpandedRows,
|
|
221
232
|
onChange = _ref3.onChange;
|
|
233
|
+
|
|
234
|
+
var handleChange = function handleChange(keys, records) {
|
|
235
|
+
if (isSticky && listScrollTopRef.current) {
|
|
236
|
+
setIsHeaderVisible(true);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
onChange(keys, records);
|
|
240
|
+
};
|
|
241
|
+
|
|
222
242
|
return /*#__PURE__*/React.createElement(RowSelectionColumn, {
|
|
223
243
|
rowKey: rowKey,
|
|
224
244
|
record: record,
|
|
225
245
|
limit: limit,
|
|
226
246
|
selectedRowKeys: selectedRowKeys,
|
|
227
247
|
independentSelectionExpandedRows: independentSelectionExpandedRows,
|
|
228
|
-
onChange:
|
|
248
|
+
onChange: handleChange,
|
|
229
249
|
selectedRecords: selectedRecords,
|
|
230
250
|
tableLocale: locale
|
|
231
251
|
});
|
|
232
|
-
}, [locale, rowKey, selectedRecords, selection]);
|
|
252
|
+
}, [isSticky, locale, rowKey, selectedRecords, selection]);
|
|
233
253
|
var virtualColumns = useMemo(function () {
|
|
234
254
|
return compact([!!selection && {
|
|
235
255
|
width: 64,
|
|
@@ -407,6 +427,15 @@ var VirtualTable = function VirtualTable(props, forwardedRef) {
|
|
|
407
427
|
}
|
|
408
428
|
|
|
409
429
|
var roundedOffset = Math.ceil(scrollOffset);
|
|
430
|
+
listScrollTopRef.current = roundedOffset;
|
|
431
|
+
|
|
432
|
+
if (isSticky && scrollDirection === 'forward' && containerRef.current) {
|
|
433
|
+
setIsHeaderVisible(false);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
if (isSticky && scrollDirection === 'backward' && containerRef.current) {
|
|
437
|
+
setIsHeaderVisible(roundedOffset > 0);
|
|
438
|
+
}
|
|
410
439
|
|
|
411
440
|
if (scrollDirection === 'forward' && roundedOffset >= listMaxScroll - LOAD_DATA_OFFSET && typeof (infiniteScroll == null ? void 0 : infiniteScroll.onScrollEndReach) === 'function') {
|
|
412
441
|
infiniteScroll.onScrollEndReach();
|
|
@@ -521,7 +550,8 @@ var VirtualTable = function VirtualTable(props, forwardedRef) {
|
|
|
521
550
|
isSticky: isSticky,
|
|
522
551
|
style: isSticky ? {} : relativeInlineStyle,
|
|
523
552
|
key: "relative-container",
|
|
524
|
-
ref: containerRef
|
|
553
|
+
ref: containerRef,
|
|
554
|
+
isHeaderVisible: isHeaderVisible
|
|
525
555
|
}, /*#__PURE__*/React.createElement(ResizeObserver, {
|
|
526
556
|
onResize: function onResize(_ref6) {
|
|
527
557
|
var offsetWidth = _ref6.offsetWidth;
|
|
@@ -23,5 +23,6 @@ export declare const StickyScrollbarContent: import("styled-components").StyledC
|
|
|
23
23
|
export declare const ColWrapper: import("styled-components").StyledComponent<"div", any, ColWrapperProps, never>;
|
|
24
24
|
export declare const VirtualTableWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
25
25
|
isSticky: boolean;
|
|
26
|
+
isHeaderVisible?: boolean | undefined;
|
|
26
27
|
}, never>;
|
|
27
28
|
export {};
|
|
@@ -27,19 +27,19 @@ export var VirtualListWrapper = styled.div.withConfig({
|
|
|
27
27
|
displayName: "VirtualTablestyles__VirtualListWrapper",
|
|
28
28
|
componentId: "aehkhc-3"
|
|
29
29
|
})(["", " overscroll-behavior-x:contain;"], function (props) {
|
|
30
|
-
return props.isSticky && css(["width:", "
|
|
30
|
+
return props.isSticky && css(["width:", ";overflow:overlay hidden;scrollbar-color:transparent;scrollbar-width:none;::-webkit-scrollbar-thumb{background-color:transparent;}::-webkit-scrollbar{display:none;}:after{content:'';width:10px;height:", ";display:block;}"], numberToPixels(props.listWidth), numberToPixels(props.listHeight));
|
|
31
31
|
});
|
|
32
32
|
export var StickyScrollbar = styled(Scrollbar).withConfig({
|
|
33
33
|
displayName: "VirtualTablestyles__StickyScrollbar",
|
|
34
34
|
componentId: "aehkhc-4"
|
|
35
|
-
})(["position:sticky;bottom:0;z-index:2;transform:translate(5px,", "
|
|
36
|
-
return props.offset;
|
|
35
|
+
})(["position:sticky;bottom:0;z-index:2;transform:translate(5px,", ");"], function (props) {
|
|
36
|
+
return numberToPixels(props.offset);
|
|
37
37
|
});
|
|
38
38
|
export var StickyScrollbarContent = styled.div.withConfig({
|
|
39
39
|
displayName: "VirtualTablestyles__StickyScrollbarContent",
|
|
40
40
|
componentId: "aehkhc-5"
|
|
41
|
-
})(["width:", "
|
|
42
|
-
return props.scrollWidth;
|
|
41
|
+
})(["width:", ";height:10px;"], function (props) {
|
|
42
|
+
return numberToPixels(props.scrollWidth);
|
|
43
43
|
});
|
|
44
44
|
export var ColWrapper = styled.div.withConfig({
|
|
45
45
|
displayName: "VirtualTablestyles__ColWrapper",
|
|
@@ -56,5 +56,5 @@ export var VirtualTableWrapper = styled.div.withConfig({
|
|
|
56
56
|
displayName: "VirtualTablestyles__VirtualTableWrapper",
|
|
57
57
|
componentId: "aehkhc-7"
|
|
58
58
|
})(["", ""], function (props) {
|
|
59
|
-
return props.isSticky ?
|
|
59
|
+
return props.isSticky ? css([".ant-table-title{position:sticky;top:-96px;z-index:99;}.ant-table-title,.ant-table-sticky-header{transition:top 0.3s ease-in-out;}", ";"], props.isHeaderVisible && css([".ant-table-title{top:-24px;}.ant-table-sticky-header{top:48px !important;}"])) : css(["position:relative;"]);
|
|
60
60
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-table",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.52.0",
|
|
4
4
|
"description": "Table UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "synerise/synerise-design",
|
|
@@ -33,31 +33,31 @@
|
|
|
33
33
|
],
|
|
34
34
|
"types": "dist/index.d.ts",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@synerise/ds-alert": "^0.8.
|
|
37
|
-
"@synerise/ds-badge": "^0.7.
|
|
38
|
-
"@synerise/ds-button": "^0.20.
|
|
39
|
-
"@synerise/ds-button-group": "^0.7.
|
|
40
|
-
"@synerise/ds-checkbox": "^0.12.
|
|
41
|
-
"@synerise/ds-column-manager": "^0.11.
|
|
36
|
+
"@synerise/ds-alert": "^0.8.14",
|
|
37
|
+
"@synerise/ds-badge": "^0.7.1",
|
|
38
|
+
"@synerise/ds-button": "^0.20.1",
|
|
39
|
+
"@synerise/ds-button-group": "^0.7.1",
|
|
40
|
+
"@synerise/ds-checkbox": "^0.12.1",
|
|
41
|
+
"@synerise/ds-column-manager": "^0.11.57",
|
|
42
42
|
"@synerise/ds-data-format": "^0.5.0",
|
|
43
|
-
"@synerise/ds-dropdown": "^0.
|
|
43
|
+
"@synerise/ds-dropdown": "^0.18.0",
|
|
44
44
|
"@synerise/ds-flag": "^0.5.0",
|
|
45
|
-
"@synerise/ds-icon": "^0.
|
|
46
|
-
"@synerise/ds-input": "^0.21.
|
|
47
|
-
"@synerise/ds-loader": "^0.3.
|
|
48
|
-
"@synerise/ds-menu": "^0.
|
|
49
|
-
"@synerise/ds-modal": "^0.17.
|
|
50
|
-
"@synerise/ds-pagination": "^0.7.
|
|
51
|
-
"@synerise/ds-result": "^0.6.
|
|
52
|
-
"@synerise/ds-scrollbar": "^0.
|
|
53
|
-
"@synerise/ds-search": "^0.8.
|
|
54
|
-
"@synerise/ds-select": "^0.16.
|
|
55
|
-
"@synerise/ds-skeleton": "^0.6.
|
|
56
|
-
"@synerise/ds-status": "^0.6.
|
|
57
|
-
"@synerise/ds-tags": "^0.
|
|
58
|
-
"@synerise/ds-tooltip": "^0.14.
|
|
45
|
+
"@synerise/ds-icon": "^0.62.0",
|
|
46
|
+
"@synerise/ds-input": "^0.21.5",
|
|
47
|
+
"@synerise/ds-loader": "^0.3.9",
|
|
48
|
+
"@synerise/ds-menu": "^0.19.0",
|
|
49
|
+
"@synerise/ds-modal": "^0.17.30",
|
|
50
|
+
"@synerise/ds-pagination": "^0.7.51",
|
|
51
|
+
"@synerise/ds-result": "^0.6.56",
|
|
52
|
+
"@synerise/ds-scrollbar": "^0.11.0",
|
|
53
|
+
"@synerise/ds-search": "^0.8.92",
|
|
54
|
+
"@synerise/ds-select": "^0.16.2",
|
|
55
|
+
"@synerise/ds-skeleton": "^0.6.1",
|
|
56
|
+
"@synerise/ds-status": "^0.6.8",
|
|
57
|
+
"@synerise/ds-tags": "^0.9.0",
|
|
58
|
+
"@synerise/ds-tooltip": "^0.14.29",
|
|
59
59
|
"@synerise/ds-typography": "^0.15.0",
|
|
60
|
-
"@synerise/ds-utils": "^0.
|
|
60
|
+
"@synerise/ds-utils": "^0.27.0",
|
|
61
61
|
"@types/react-window": "^1.8.5",
|
|
62
62
|
"classnames": "2.3.2",
|
|
63
63
|
"copy-to-clipboard": "^3.3.1",
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@testing-library/react": "10.0.1"
|
|
81
81
|
},
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "9293cda82b432c10af1d230262afcc6f08f3dd99"
|
|
83
83
|
}
|