@synerise/ds-table 0.49.0 → 0.49.1
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 +11 -0
- package/dist/Cell/AvatarLabel/AvatarLabel.d.ts +1 -1
- package/dist/Cell/AvatarLabel/AvatarLabel.js +6 -8
- package/dist/Cell/AvatarLabel/AvatarLabel.styles.d.ts +2 -2
- package/dist/Cell/AvatarLabel/AvatarLabel.styles.js +12 -10
- package/dist/ColumnSortMenu/replaceSortButtons.js +1 -1
- package/dist/DefaultTable/DefaultTable.js +8 -8
- package/dist/GroupTable/GroupTableBody/GroupTableBody.js +1 -1
- package/dist/InfiniteScroll/OuterListElement.js +5 -5
- package/dist/Table.js +1 -1
- package/dist/TreeTable/TreeTable.js +3 -3
- package/dist/VirtualTable/VirtualTable.js +20 -20
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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.49.1](https://github.com/synerise/synerise-design/compare/@synerise/ds-table@0.49.0...@synerise/ds-table@0.49.1) (2024-04-17)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **table:** avatar label cell styles ([2602587](https://github.com/synerise/synerise-design/commit/2602587d1afc2a1b4bef67d1aed712c6ed6e2507))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [0.49.0](https://github.com/synerise/synerise-design/compare/@synerise/ds-table@0.48.6...@synerise/ds-table@0.49.0) (2024-04-17)
|
|
7
18
|
|
|
8
19
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { AvatarLabelProps } from './AvatarLabel.types';
|
|
2
|
-
declare const AvatarLabel: ({ avatar, avatarAction, avatarLink, title, labels, icon,
|
|
2
|
+
declare const AvatarLabel: ({ avatar, avatarAction, avatarLink, title, labels, icon, ellipsis, maxWidth, avatarSize, loader, }: AvatarLabelProps) => JSX.Element;
|
|
3
3
|
export default AvatarLabel;
|
|
@@ -11,8 +11,6 @@ var AvatarLabel = function AvatarLabel(_ref) {
|
|
|
11
11
|
title = _ref.title,
|
|
12
12
|
labels = _ref.labels,
|
|
13
13
|
icon = _ref.icon,
|
|
14
|
-
_ref$textSize = _ref.textSize,
|
|
15
|
-
textSize = _ref$textSize === void 0 ? 'default' : _ref$textSize,
|
|
16
14
|
ellipsis = _ref.ellipsis,
|
|
17
15
|
maxWidth = _ref.maxWidth,
|
|
18
16
|
avatarSize = _ref.avatarSize,
|
|
@@ -37,14 +35,14 @@ var AvatarLabel = function AvatarLabel(_ref) {
|
|
|
37
35
|
hasEllipsis: ellipsis,
|
|
38
36
|
maxWidth: maxWidth,
|
|
39
37
|
avatarSize: avatarSize
|
|
40
|
-
}), title), labels == null ? void 0 : labels.
|
|
38
|
+
}), title), (labels == null ? void 0 : labels.length) && /*#__PURE__*/React.createElement(S.Labels, {
|
|
39
|
+
ellipsis: Boolean(ellipsis),
|
|
40
|
+
maxWidth: maxWidth
|
|
41
|
+
}, labels == null ? void 0 : labels.map(function (label) {
|
|
41
42
|
return /*#__PURE__*/React.createElement(S.Label, {
|
|
42
|
-
key: uuid()
|
|
43
|
-
textSize: textSize,
|
|
44
|
-
ellipsis: Boolean(ellipsis),
|
|
45
|
-
maxWidth: maxWidth
|
|
43
|
+
key: uuid()
|
|
46
44
|
}, label);
|
|
47
|
-
}), loader && /*#__PURE__*/React.createElement(S.Loader, null, loader)));
|
|
45
|
+
})), loader && /*#__PURE__*/React.createElement(S.Loader, null, loader)));
|
|
48
46
|
return /*#__PURE__*/React.createElement(S.AvatarLabel, {
|
|
49
47
|
onClick: avatarAction
|
|
50
48
|
}, avatarLink ? /*#__PURE__*/React.createElement(S.AvatarLink, {
|
|
@@ -17,10 +17,10 @@ export declare const Title: import("styled-components").StyledComponent<({ size,
|
|
|
17
17
|
maxWidth: number | undefined;
|
|
18
18
|
avatarSize?: string | undefined;
|
|
19
19
|
}, never>;
|
|
20
|
-
export declare const
|
|
21
|
-
textSize: 'small' | 'default';
|
|
20
|
+
export declare const Labels: import("styled-components").StyledComponent<"span", any, {
|
|
22
21
|
ellipsis: boolean;
|
|
23
22
|
maxWidth: number | undefined;
|
|
24
23
|
}, never>;
|
|
24
|
+
export declare const Label: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
25
25
|
export declare const Icon: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
26
26
|
export declare const Loader: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -15,34 +15,36 @@ export var Avatar = styled.div.withConfig({
|
|
|
15
15
|
export var Description = styled.div.withConfig({
|
|
16
16
|
displayName: "AvatarLabelstyles__Description",
|
|
17
17
|
componentId: "sc-1485c9p-2"
|
|
18
|
-
})(["display:flex;min-width:0;flex-direction:column;align-items:flex-start;justify-content:center;"]);
|
|
18
|
+
})(["display:flex;min-width:0;flex-direction:column;align-items:flex-start;justify-content:center;max-height:40px;overflow:hidden;"]);
|
|
19
19
|
export var AvatarLink = styled.a.withConfig({
|
|
20
20
|
displayName: "AvatarLabelstyles__AvatarLink",
|
|
21
21
|
componentId: "sc-1485c9p-3"
|
|
22
|
-
})(["display:flex;min-width:0;&:hover,&:active,&:focus{text-decoration:none;}"]);
|
|
22
|
+
})(["display:flex;min-width:0;color:inherit;&:hover,&:active,&:focus{text-decoration:none;color:inherit;}"]);
|
|
23
23
|
export var Title = styled(Text).withConfig({
|
|
24
24
|
displayName: "AvatarLabelstyles__Title",
|
|
25
25
|
componentId: "sc-1485c9p-4"
|
|
26
|
-
})(["font-size:14px;line-height:20px;
|
|
26
|
+
})(["font-size:14px;line-height:20px;color:", ";font-weight:500;", ";"], function (props) {
|
|
27
27
|
return props.theme.palette['grey-700'];
|
|
28
28
|
}, function (props) {
|
|
29
29
|
return Boolean(props.ellipsis) && css(["max-width:", ";"], props.maxWidth ? props.maxWidth + "px" : '100%');
|
|
30
30
|
});
|
|
31
|
-
export var
|
|
32
|
-
displayName: "
|
|
31
|
+
export var Labels = styled.span.withConfig({
|
|
32
|
+
displayName: "AvatarLabelstyles__Labels",
|
|
33
33
|
componentId: "sc-1485c9p-5"
|
|
34
|
-
})(["font-size:13px;line-height:1.38;
|
|
34
|
+
})(["font-size:13px;line-height:1.38;font-weight:400;color:", ";", ";"], function (props) {
|
|
35
35
|
return props.theme.palette['grey-700'];
|
|
36
|
-
}, function (props) {
|
|
37
|
-
return props.textSize === 'default' ? '4px' : '0px';
|
|
38
36
|
}, function (props) {
|
|
39
37
|
return props.ellipsis && css(["text-overflow:ellipsis;overflow:hidden;max-width:", ";"], props.maxWidth ? props.maxWidth + "px" : '100%');
|
|
40
38
|
});
|
|
39
|
+
export var Label = styled.span.withConfig({
|
|
40
|
+
displayName: "AvatarLabelstyles__Label",
|
|
41
|
+
componentId: "sc-1485c9p-6"
|
|
42
|
+
})([""]);
|
|
41
43
|
export var Icon = styled.div.withConfig({
|
|
42
44
|
displayName: "AvatarLabelstyles__Icon",
|
|
43
|
-
componentId: "sc-1485c9p-
|
|
45
|
+
componentId: "sc-1485c9p-7"
|
|
44
46
|
})(["margin-right:8px;"]);
|
|
45
47
|
export var Loader = styled.div.withConfig({
|
|
46
48
|
displayName: "AvatarLabelstyles__Loader",
|
|
47
|
-
componentId: "sc-1485c9p-
|
|
49
|
+
componentId: "sc-1485c9p-8"
|
|
48
50
|
})([""]);
|
|
@@ -4,7 +4,7 @@ var createReplaceButtonsPortal = function createReplaceButtonsPortal(columnTitle
|
|
|
4
4
|
return function () {
|
|
5
5
|
var _columnTitleElement$p;
|
|
6
6
|
|
|
7
|
-
var sortContainerElem = columnTitleElement == null
|
|
7
|
+
var sortContainerElem = columnTitleElement == null || (_columnTitleElement$p = columnTitleElement.parentElement) == null ? void 0 : _columnTitleElement$p.nextSibling;
|
|
8
8
|
|
|
9
9
|
if (!sortContainerElem) {
|
|
10
10
|
return null;
|
|
@@ -101,8 +101,8 @@ function DefaultTable(props) {
|
|
|
101
101
|
}, {});
|
|
102
102
|
var selectedRecords = React.useMemo(function () {
|
|
103
103
|
if (selection) {
|
|
104
|
-
var
|
|
105
|
-
selectedRowKeys =
|
|
104
|
+
var _ref4 = selection,
|
|
105
|
+
selectedRowKeys = _ref4.selectedRowKeys;
|
|
106
106
|
var selectedRows = [];
|
|
107
107
|
dataSource && dataSource.forEach(function (row) {
|
|
108
108
|
var key = getRowKey(row);
|
|
@@ -127,11 +127,11 @@ function DefaultTable(props) {
|
|
|
127
127
|
return [];
|
|
128
128
|
}, [dataSource, getRowKey, selection]);
|
|
129
129
|
var renderRowSelection = React.useCallback(function (key, record) {
|
|
130
|
-
var
|
|
131
|
-
selectedRowKeys =
|
|
132
|
-
limit =
|
|
133
|
-
independentSelectionExpandedRows =
|
|
134
|
-
onChange =
|
|
130
|
+
var _ref5 = selection,
|
|
131
|
+
selectedRowKeys = _ref5.selectedRowKeys,
|
|
132
|
+
limit = _ref5.limit,
|
|
133
|
+
independentSelectionExpandedRows = _ref5.independentSelectionExpandedRows,
|
|
134
|
+
onChange = _ref5.onChange;
|
|
135
135
|
return /*#__PURE__*/React.createElement(RowSelectionColumn, {
|
|
136
136
|
rowKey: rowKey,
|
|
137
137
|
record: record,
|
|
@@ -171,7 +171,7 @@ function DefaultTable(props) {
|
|
|
171
171
|
}, decoratedComponents) // @ts-ignore
|
|
172
172
|
,
|
|
173
173
|
rowSelection: selection && _objectSpread({}, selection, {
|
|
174
|
-
selections: selection == null
|
|
174
|
+
selections: selection == null || (_selection$selections = selection.selections) == null ? void 0 : _selection$selections.filter(Boolean),
|
|
175
175
|
columnWidth: 64,
|
|
176
176
|
renderCell: renderRowSelection
|
|
177
177
|
})
|
|
@@ -30,7 +30,7 @@ function GroupTableBody(_ref) {
|
|
|
30
30
|
var selectedRowsNumber = React.useMemo(function () {
|
|
31
31
|
var _selection$selectedRo;
|
|
32
32
|
|
|
33
|
-
return (selection == null
|
|
33
|
+
return (selection == null || (_selection$selectedRo = selection.selectedRowKeys) == null ? void 0 : _selection$selectedRo.filter(function (key) {
|
|
34
34
|
return allRowKeys.includes(key);
|
|
35
35
|
}).length) || 0;
|
|
36
36
|
}, [allRowKeys, selection]);
|
|
@@ -40,10 +40,10 @@ var OuterListElement = function OuterListElement(containerRef, isSticky) {
|
|
|
40
40
|
|
|
41
41
|
var onWheelHandler = function onWheelHandler(event) {
|
|
42
42
|
if (header) {
|
|
43
|
-
var _event$currentTarget
|
|
43
|
+
var _event$currentTarget;
|
|
44
44
|
|
|
45
45
|
header.scrollTo({
|
|
46
|
-
left: (_event$currentTarget = event.currentTarget) == null
|
|
46
|
+
left: (_event$currentTarget = event.currentTarget) == null || (_event$currentTarget = _event$currentTarget.parentElement) == null ? void 0 : _event$currentTarget.scrollLeft
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
|
|
@@ -52,9 +52,9 @@ var OuterListElement = function OuterListElement(containerRef, isSticky) {
|
|
|
52
52
|
|
|
53
53
|
if (isSticky) {
|
|
54
54
|
// uses native browser scroll
|
|
55
|
-
var
|
|
56
|
-
height =
|
|
57
|
-
rest = _objectWithoutPropertiesLoose(
|
|
55
|
+
var _ref3 = style || {},
|
|
56
|
+
height = _ref3.height,
|
|
57
|
+
rest = _objectWithoutPropertiesLoose(_ref3, _excluded);
|
|
58
58
|
|
|
59
59
|
return /*#__PURE__*/React.createElement("div", {
|
|
60
60
|
ref: ref,
|
package/dist/Table.js
CHANGED
|
@@ -91,7 +91,7 @@ function DSTable(props) {
|
|
|
91
91
|
showTotal: function showTotal(total, range) {
|
|
92
92
|
var _tableLocale$paginati, _tableLocale$paginati2;
|
|
93
93
|
|
|
94
|
-
return !hideTitlePart ? /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("strong", null, formatValue(range[0])), "-", /*#__PURE__*/React.createElement("strong", null, formatValue(range[1])), " of", ' ', /*#__PURE__*/React.createElement("strong", null, formatValue(total)), ' ', grouped ? tableLocale == null
|
|
94
|
+
return !hideTitlePart ? /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("strong", null, formatValue(range[0])), "-", /*#__PURE__*/React.createElement("strong", null, formatValue(range[1])), " of", ' ', /*#__PURE__*/React.createElement("strong", null, formatValue(total)), ' ', grouped ? tableLocale == null || (_tableLocale$paginati = tableLocale.pagination) == null ? void 0 : _tableLocale$paginati.groups : tableLocale == null || (_tableLocale$paginati2 = tableLocale.pagination) == null ? void 0 : _tableLocale$paginati2.items) : /*#__PURE__*/React.createElement("div", {
|
|
95
95
|
style: {
|
|
96
96
|
width: '150px'
|
|
97
97
|
}
|
|
@@ -22,11 +22,11 @@ function TreeTable(props) {
|
|
|
22
22
|
}, []);
|
|
23
23
|
var RenderCell = React.useCallback( // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
24
24
|
function (cell) {
|
|
25
|
-
var _cell$children
|
|
25
|
+
var _cell$children$;
|
|
26
26
|
|
|
27
|
-
var indentLevel = (_cell$children$ = cell.children[0]) == null
|
|
27
|
+
var indentLevel = (_cell$children$ = cell.children[0]) == null || (_cell$children$ = _cell$children$.props) == null || (_cell$children$ = _cell$children$.children[0]) == null || (_cell$children$ = _cell$children$.props) == null || (_cell$children$ = _cell$children$.className.split(' ').find(function (value) {
|
|
28
28
|
return value.includes('indent-level-');
|
|
29
|
-
})) == null ? void 0 : _cell$children
|
|
29
|
+
})) == null ? void 0 : _cell$children$.split('-').pop();
|
|
30
30
|
|
|
31
31
|
if (indentLevel === undefined) {
|
|
32
32
|
return /*#__PURE__*/React.createElement("td", {
|
|
@@ -136,7 +136,7 @@ var VirtualTable = function VirtualTable(props, forwardedRef) {
|
|
|
136
136
|
if (listRef.current && infiniteScroll != null && (_infiniteScroll$prevP = infiniteScroll.prevPage) != null && _infiniteScroll$prevP.hasMore) {
|
|
137
137
|
listRef.current.scrollTo(INFINITE_LOADED_ITEM_HEIGHT);
|
|
138
138
|
}
|
|
139
|
-
}, [listRef, infiniteScroll == null
|
|
139
|
+
}, [listRef, infiniteScroll == null || (_infiniteScroll$prevP2 = infiniteScroll.prevPage) == null ? void 0 : _infiniteScroll$prevP2.hasMore]);
|
|
140
140
|
useImperativeHandle(forwardedRef, function () {
|
|
141
141
|
return {
|
|
142
142
|
virtualListRef: listRef,
|
|
@@ -187,8 +187,8 @@ var VirtualTable = function VirtualTable(props, forwardedRef) {
|
|
|
187
187
|
|
|
188
188
|
function getSelectedRecords() {
|
|
189
189
|
if (selection) {
|
|
190
|
-
var
|
|
191
|
-
selectedRowKeys =
|
|
190
|
+
var _ref2 = selection,
|
|
191
|
+
selectedRowKeys = _ref2.selectedRowKeys;
|
|
192
192
|
var selectedRows = [];
|
|
193
193
|
allData.forEach(function (row) {
|
|
194
194
|
var key = getRowKey(row);
|
|
@@ -214,11 +214,11 @@ var VirtualTable = function VirtualTable(props, forwardedRef) {
|
|
|
214
214
|
}
|
|
215
215
|
|
|
216
216
|
var renderRowSelection = useCallback(function (key, record) {
|
|
217
|
-
var
|
|
218
|
-
selectedRowKeys =
|
|
219
|
-
limit =
|
|
220
|
-
independentSelectionExpandedRows =
|
|
221
|
-
onChange =
|
|
217
|
+
var _ref3 = selection,
|
|
218
|
+
selectedRowKeys = _ref3.selectedRowKeys,
|
|
219
|
+
limit = _ref3.limit,
|
|
220
|
+
independentSelectionExpandedRows = _ref3.independentSelectionExpandedRows,
|
|
221
|
+
onChange = _ref3.onChange;
|
|
222
222
|
return /*#__PURE__*/React.createElement(RowSelectionColumn, {
|
|
223
223
|
rowKey: rowKey,
|
|
224
224
|
record: record,
|
|
@@ -239,13 +239,13 @@ var VirtualTable = function VirtualTable(props, forwardedRef) {
|
|
|
239
239
|
}, !!rowStar && rowStarColumn].concat(columns));
|
|
240
240
|
}, [selection, renderRowSelection, rowStar, rowStarColumn, columns]);
|
|
241
241
|
var mergedColumns = useMemo(function () {
|
|
242
|
-
var widthColumnCount = virtualColumns.filter(function (
|
|
243
|
-
var width =
|
|
242
|
+
var widthColumnCount = virtualColumns.filter(function (_ref4) {
|
|
243
|
+
var width = _ref4.width;
|
|
244
244
|
return !width;
|
|
245
245
|
}).length;
|
|
246
246
|
var rowWidth = tableWidth || initialWidth;
|
|
247
|
-
var definedWidth = virtualColumns.reduce(function (total,
|
|
248
|
-
var width =
|
|
247
|
+
var definedWidth = virtualColumns.reduce(function (total, _ref5) {
|
|
248
|
+
var width = _ref5.width;
|
|
249
249
|
var widthInPx = calculatePixels(width) || 0;
|
|
250
250
|
return total + widthInPx;
|
|
251
251
|
}, 0);
|
|
@@ -315,9 +315,9 @@ var VirtualTable = function VirtualTable(props, forwardedRef) {
|
|
|
315
315
|
|
|
316
316
|
return [].concat(fixedLeft, remaining, fixedRight);
|
|
317
317
|
}, [virtualColumns, tableWidth, initialWidth]);
|
|
318
|
-
var listInnerElementType = forwardRef(function (
|
|
319
|
-
var style =
|
|
320
|
-
rest = _objectWithoutPropertiesLoose(
|
|
318
|
+
var listInnerElementType = forwardRef(function (_ref6, innerElementRef) {
|
|
319
|
+
var style = _ref6.style,
|
|
320
|
+
rest = _objectWithoutPropertiesLoose(_ref6, _excluded);
|
|
321
321
|
|
|
322
322
|
return /*#__PURE__*/React.createElement(S.InnerListElement, _extends({
|
|
323
323
|
ref: innerElementRef,
|
|
@@ -403,9 +403,9 @@ var VirtualTable = function VirtualTable(props, forwardedRef) {
|
|
|
403
403
|
var listHeight = data.length * cellHeight - scroll.y + infiniteLoaderItemHeight;
|
|
404
404
|
var listMaxScroll = stickyScrollThreshold && infiniteScroll != null && infiniteScroll.maxScroll ? (infiniteScroll == null ? void 0 : infiniteScroll.maxScroll) - stickyScrollThreshold : listHeight;
|
|
405
405
|
|
|
406
|
-
var handleListScroll = function handleListScroll(
|
|
407
|
-
var scrollOffset =
|
|
408
|
-
scrollDirection =
|
|
406
|
+
var handleListScroll = function handleListScroll(_ref7) {
|
|
407
|
+
var scrollOffset = _ref7.scrollOffset,
|
|
408
|
+
scrollDirection = _ref7.scrollDirection;
|
|
409
409
|
|
|
410
410
|
if (loading || listMaxScroll <= 0) {
|
|
411
411
|
return;
|
|
@@ -528,8 +528,8 @@ var VirtualTable = function VirtualTable(props, forwardedRef) {
|
|
|
528
528
|
key: "relative-container",
|
|
529
529
|
ref: containerRef
|
|
530
530
|
}, /*#__PURE__*/React.createElement(ResizeObserver, {
|
|
531
|
-
onResize: function onResize(
|
|
532
|
-
var offsetWidth =
|
|
531
|
+
onResize: function onResize(_ref8) {
|
|
532
|
+
var offsetWidth = _ref8.offsetWidth;
|
|
533
533
|
setTableWidth(offsetWidth);
|
|
534
534
|
}
|
|
535
535
|
}, /*#__PURE__*/React.createElement(DSTable, _extends({}, props, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-table",
|
|
3
|
-
"version": "0.49.
|
|
3
|
+
"version": "0.49.1",
|
|
4
4
|
"description": "Table UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "synerise/synerise-design",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@synerise/ds-button": "^0.19.7",
|
|
39
39
|
"@synerise/ds-button-group": "^0.6.47",
|
|
40
40
|
"@synerise/ds-checkbox": "^0.11.63",
|
|
41
|
-
"@synerise/ds-column-manager": "^0.11.
|
|
41
|
+
"@synerise/ds-column-manager": "^0.11.43",
|
|
42
42
|
"@synerise/ds-data-format": "^0.4.8",
|
|
43
43
|
"@synerise/ds-dropdown": "^0.17.105",
|
|
44
44
|
"@synerise/ds-flag": "^0.4.3",
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@testing-library/react": "10.0.1"
|
|
81
81
|
},
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "2b3ed7503dacc36c207049a5a3e81bfe190de0be"
|
|
83
83
|
}
|