@synerise/ds-table 0.60.2 → 0.60.4
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 +16 -0
- package/dist/Cell/Action/ActionCell.js +5 -11
- package/dist/Cell/Action/ActionCell.styles.js +2 -1
- package/dist/Cell/AvatarLabel/AvatarLabel.js +10 -18
- package/dist/Cell/Copyable/Copyable.styles.js +2 -1
- package/dist/Cell/Copyable/CopyableCell.js +6 -12
- package/dist/Cell/Editable/EditableCell.js +7 -14
- package/dist/Cell/FlagLabel/FlagLabelCell.js +2 -7
- package/dist/Cell/FlagLabel/FlagLabelCell.styles.js +2 -1
- package/dist/Cell/IconLabel/IconLabel.js +2 -7
- package/dist/Cell/IconLabel/IconLabel.styles.js +2 -1
- package/dist/Cell/IconTooltipCell/IconTooltipCell.js +7 -13
- package/dist/Cell/LabelsWithShowMore/LabelsWithShowMore.js +8 -14
- package/dist/Cell/LabelsWithShowMore/Modal/Modal.js +8 -12
- package/dist/Cell/Star/StarCell.d.ts +4 -3
- package/dist/Cell/Star/StarCell.js +5 -10
- package/dist/Cell/StatusLabel/StatusLabel.js +3 -8
- package/dist/Cell/TagIcon/TagIcon.js +1 -6
- package/dist/Cell/TagIcon/TagIcon.styles.js +2 -1
- package/dist/ColumnSortMenu/SortIcons.js +3 -15
- package/dist/ColumnSortMenu/SortRenderer.d.ts +2 -2
- package/dist/ColumnSortMenu/SortRenderer.js +40 -38
- package/dist/ColumnSortMenu/TitleWithSort.js +3 -7
- package/dist/ColumnSortMenu/columnWithSortButtons.js +0 -10
- package/dist/ColumnSortMenu/groupedColumnsSort.js +2 -15
- package/dist/ColumnSortMenu/replaceSortButtons.js +0 -7
- package/dist/ColumnSortMenu/useSortState.js +4 -40
- package/dist/DefaultTable/DefaultTable.js +26 -50
- package/dist/FilterTrigger/FilterTrigger.js +16 -20
- package/dist/GroupTable/GroupTable.js +24 -40
- package/dist/GroupTable/GroupTable.styles.js +2 -2
- package/dist/GroupTable/GroupTableBody/GroupTableBody.js +12 -17
- package/dist/GroupTable/GroupTableHeader/GroupTableHeader.js +6 -7
- package/dist/InfiniteScroll/BackToTopButton.js +0 -1
- package/dist/InfiniteScroll/InfiniteLoaderItem.js +9 -12
- package/dist/InfiniteScroll/OuterListElement.js +7 -25
- package/dist/InfiniteScroll/utils.js +2 -2
- package/dist/ItemsMenu/ItemsMenu.js +0 -2
- package/dist/ItemsMenu/ItemsMenu.styles.js +2 -1
- package/dist/RowSelection/RowSelectionColumn.js +12 -22
- package/dist/Table.js +26 -40
- package/dist/TableHeader/TableHeader.js +21 -28
- package/dist/TableHeader/TableLimit/TableLimit.js +4 -7
- package/dist/TableHeader/TableSelection.d.ts +6 -5
- package/dist/TableHeader/TableSelection.js +53 -68
- package/dist/TreeTable/TreeTable.js +9 -11
- package/dist/TreeTable/TreeTable.styles.js +0 -2
- package/dist/VirtualTable/VirtualTable.js +101 -178
- package/dist/VirtualTable/VirtualTable.styles.js +0 -3
- package/dist/VirtualTable/VirtualTableRow.js +10 -26
- package/dist/constants/TableSkeleton.constants.js +0 -1
- package/dist/hooks/useRowKey/useRowKey.js +3 -1
- package/dist/hooks/useRowStar/useRowStar.js +6 -12
- package/dist/utils/calculateColumnWidths.js +0 -5
- package/dist/utils/calculatePixels.js +4 -10
- package/dist/utils/getRecordSelectionStatus.js +2 -3
- package/dist/utils/getSkeletonProps.js +7 -15
- package/dist/utils/getValueFromPath.js +2 -1
- package/dist/utils/isRecordSelectable.js +2 -4
- package/dist/utils/locale.js +0 -5
- package/package.json +23 -23
|
@@ -4,37 +4,32 @@ import * as S from '../Table.styles';
|
|
|
4
4
|
import FilterTrigger from '../FilterTrigger/FilterTrigger';
|
|
5
5
|
import TableSelection from './TableSelection';
|
|
6
6
|
import { TableLimit } from './TableLimit';
|
|
7
|
-
|
|
8
7
|
var TableHeader = function TableHeader(_ref) {
|
|
9
8
|
var title = _ref.title,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
9
|
+
filters = _ref.filters,
|
|
10
|
+
searchComponent = _ref.searchComponent,
|
|
11
|
+
filterComponent = _ref.filterComponent,
|
|
12
|
+
selectedRows = _ref.selectedRows,
|
|
13
|
+
itemsMenu = _ref.itemsMenu,
|
|
14
|
+
selection = _ref.selection,
|
|
15
|
+
dataSource = _ref.dataSource,
|
|
16
|
+
dataSourceFull = _ref.dataSourceFull,
|
|
17
|
+
dataSourceTotalCount = _ref.dataSourceTotalCount,
|
|
18
|
+
rowKey = _ref.rowKey,
|
|
19
|
+
withBorderTop = _ref.withBorderTop,
|
|
20
|
+
headerButton = _ref.headerButton,
|
|
21
|
+
locale = _ref.locale,
|
|
22
|
+
renderSelectionTitle = _ref.renderSelectionTitle,
|
|
23
|
+
hideTitlePart = _ref.hideTitlePart,
|
|
24
|
+
childrenColumnName = _ref.childrenColumnName,
|
|
25
|
+
isLoading = _ref.isLoading;
|
|
28
26
|
var _useDataFormat = useDataFormat(),
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
formatValue = _useDataFormat.formatValue;
|
|
31
28
|
var renderLeftSide = useMemo(function () {
|
|
32
29
|
var _locale$pagination;
|
|
33
|
-
|
|
34
30
|
var _ref2 = selection || {},
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
limit = _ref2.limit,
|
|
32
|
+
hideSelectAll = _ref2.hideSelectAll;
|
|
38
33
|
if (limit) return /*#__PURE__*/React.createElement(TableLimit, {
|
|
39
34
|
total: dataSourceTotalCount || dataSource.length,
|
|
40
35
|
selection: selection,
|
|
@@ -86,8 +81,7 @@ var TableHeader = function TableHeader(_ref) {
|
|
|
86
81
|
iconComponent: filter.icon,
|
|
87
82
|
tooltips: filter.tooltips,
|
|
88
83
|
openedLabel: filter.openedLabel
|
|
89
|
-
/* eslint-disable-next-line react/jsx-handler-names
|
|
90
|
-
,
|
|
84
|
+
/* eslint-disable-next-line react/jsx-handler-names */,
|
|
91
85
|
handleClear: filter.handleClear,
|
|
92
86
|
show: filter.show,
|
|
93
87
|
showList: filter.showList,
|
|
@@ -96,5 +90,4 @@ var TableHeader = function TableHeader(_ref) {
|
|
|
96
90
|
});
|
|
97
91
|
}), filterComponent, searchComponent));
|
|
98
92
|
};
|
|
99
|
-
|
|
100
93
|
export default TableHeader;
|
|
@@ -4,13 +4,11 @@ import { useDataFormat } from '@synerise/ds-data-format';
|
|
|
4
4
|
import * as S from './TableLimit.styles';
|
|
5
5
|
export function TableLimit(_ref) {
|
|
6
6
|
var total = _ref.total,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
locale = _ref.locale,
|
|
8
|
+
itemsMenu = _ref.itemsMenu,
|
|
9
|
+
selection = _ref.selection;
|
|
11
10
|
var _useDataFormat = useDataFormat(),
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
formatValue = _useDataFormat.formatValue;
|
|
14
12
|
var selectedRows = useMemo(function () {
|
|
15
13
|
return (selection == null ? void 0 : selection.selectedRowKeys.length) || 0;
|
|
16
14
|
}, [selection]);
|
|
@@ -22,7 +20,6 @@ export function TableLimit(_ref) {
|
|
|
22
20
|
}, [locale, selectedRows, selection]);
|
|
23
21
|
var selected = useMemo(function () {
|
|
24
22
|
var _locale$pagination, _locale$pagination2;
|
|
25
|
-
|
|
26
23
|
return selectedRows > 0 ? /*#__PURE__*/React.createElement(S.Title, null, /*#__PURE__*/React.createElement("strong", null, formatValue(selectedRows)), " ", locale.selected, " /", ' ', formatValue(total) + " " + ((_locale$pagination = locale.pagination) == null ? void 0 : _locale$pagination.items)) : /*#__PURE__*/React.createElement(S.Title, null, /*#__PURE__*/React.createElement("strong", null, formatValue(total)), " ", (_locale$pagination2 = locale.pagination) == null ? void 0 : _locale$pagination2.items);
|
|
27
24
|
}, [formatValue, locale.pagination, locale.selected, selectedRows, total]);
|
|
28
25
|
return /*#__PURE__*/React.createElement(S.TableLimit, null, selected, limitReachedInfo, selectedRows > 0 && /*#__PURE__*/React.createElement(S.ItemsMenu, null, itemsMenu));
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ReactText } from 'react';
|
|
3
|
+
import type { Props } from './TableSelection.types';
|
|
4
|
+
declare const TableSelection: <T extends {
|
|
4
5
|
key: ReactText;
|
|
5
|
-
children?: T[];
|
|
6
|
-
}>({ dataSource, dataSourceFull, selection, rowKey, locale, childrenColumnName, }: Props<T>)
|
|
6
|
+
children?: T[] | undefined;
|
|
7
|
+
}>({ dataSource, dataSourceFull, selection, rowKey, locale, childrenColumnName, }: Props<T>) => React.JSX.Element | null;
|
|
7
8
|
export default TableSelection;
|
|
@@ -1,25 +1,26 @@
|
|
|
1
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
3
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
5
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
1
6
|
import React, { useCallback, useMemo } from 'react';
|
|
2
7
|
import Dropdown from '@synerise/ds-dropdown';
|
|
3
|
-
import Menu from '@synerise/ds-menu';
|
|
4
8
|
import Button from '@synerise/ds-button';
|
|
5
9
|
import Tooltip from '@synerise/ds-tooltip';
|
|
6
10
|
import Icon, { OptionVerticalM } from '@synerise/ds-icon';
|
|
7
11
|
import * as S from '../Table.styles';
|
|
8
12
|
import { SELECTION_ALL, SELECTION_INVERT } from '../Table';
|
|
9
13
|
import { useRowKey } from '../hooks/useRowKey';
|
|
10
|
-
import { isRecordSelectable } from '../utils';
|
|
11
|
-
|
|
12
|
-
function TableSelection(_ref) {
|
|
14
|
+
import { isRecordSelectable } from '../utils';
|
|
15
|
+
var TableSelection = function TableSelection(_ref) {
|
|
13
16
|
var dataSource = _ref.dataSource,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
dataSourceFull = _ref.dataSourceFull,
|
|
18
|
+
selection = _ref.selection,
|
|
19
|
+
rowKey = _ref.rowKey,
|
|
20
|
+
locale = _ref.locale,
|
|
21
|
+
childrenColumnName = _ref.childrenColumnName;
|
|
20
22
|
var _useRowKey = useRowKey(rowKey),
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
getRowKey = _useRowKey.getRowKey;
|
|
23
24
|
var allData = dataSourceFull || dataSource;
|
|
24
25
|
var isShowingSubset = dataSourceFull && dataSourceFull.length !== dataSource.length;
|
|
25
26
|
var getRowsForKeys = useCallback(function (keys) {
|
|
@@ -27,20 +28,16 @@ function TableSelection(_ref) {
|
|
|
27
28
|
var rows = [];
|
|
28
29
|
allData.forEach(function (record) {
|
|
29
30
|
var rowChildren = record[childrenColumnName];
|
|
30
|
-
|
|
31
31
|
if (Array.isArray(rowChildren)) {
|
|
32
32
|
rowChildren.forEach(function (child) {
|
|
33
33
|
var key = getRowKey(child);
|
|
34
|
-
|
|
35
34
|
if (rowChildren && key && keys.includes(key)) {
|
|
36
35
|
rows = [].concat(rows, [record]);
|
|
37
36
|
}
|
|
38
37
|
});
|
|
39
38
|
}
|
|
40
|
-
|
|
41
39
|
if (!Array.isArray(rowChildren) || selection.independentSelectionExpandedRows) {
|
|
42
40
|
var key = getRowKey(record);
|
|
43
|
-
|
|
44
41
|
if (key && keys.includes(key)) {
|
|
45
42
|
rows = [].concat(rows, [record]);
|
|
46
43
|
}
|
|
@@ -48,24 +45,21 @@ function TableSelection(_ref) {
|
|
|
48
45
|
});
|
|
49
46
|
return rows;
|
|
50
47
|
}
|
|
51
|
-
|
|
52
48
|
return [];
|
|
53
49
|
}, [allData, getRowKey, selection, childrenColumnName]);
|
|
54
50
|
var selectAll = useCallback(function () {
|
|
55
51
|
if (dataSource && selection) {
|
|
56
52
|
var selectedRowKeys = selection.selectedRowKeys,
|
|
57
|
-
|
|
53
|
+
checkRowSelectionStatus = selection.checkRowSelectionStatus;
|
|
58
54
|
var keys = isShowingSubset ? [].concat(selectedRowKeys) : [];
|
|
59
55
|
dataSource.forEach(function (record) {
|
|
60
56
|
var rowChildren = record[childrenColumnName];
|
|
61
|
-
|
|
62
57
|
if (Array.isArray(rowChildren)) {
|
|
63
58
|
keys = [].concat(keys, rowChildren.reduce(function (acc, child) {
|
|
64
59
|
var key = getRowKey(child);
|
|
65
60
|
return key && isRecordSelectable(child, checkRowSelectionStatus) ? [].concat(acc, [key]) : acc;
|
|
66
61
|
}, []));
|
|
67
62
|
}
|
|
68
|
-
|
|
69
63
|
if (!Array.isArray(rowChildren) || selection.independentSelectionExpandedRows) {
|
|
70
64
|
var key = getRowKey(record);
|
|
71
65
|
keys = key !== undefined && isRecordSelectable(record, checkRowSelectionStatus) ? [].concat(keys, [key]) : [].concat(keys);
|
|
@@ -83,14 +77,12 @@ function TableSelection(_ref) {
|
|
|
83
77
|
var keysToUnselect = [];
|
|
84
78
|
dataSource.forEach(function (record) {
|
|
85
79
|
var rowChildren = record[childrenColumnName];
|
|
86
|
-
|
|
87
80
|
if (Array.isArray(rowChildren)) {
|
|
88
81
|
keysToUnselect = [].concat(keysToUnselect, rowChildren.reduce(function (acc, child) {
|
|
89
82
|
var key = getRowKey(child);
|
|
90
83
|
return key ? [].concat(acc, [key]) : acc;
|
|
91
84
|
}, []));
|
|
92
85
|
}
|
|
93
|
-
|
|
94
86
|
if (!Array.isArray(rowChildren) || selection.independentSelectionExpandedRows) {
|
|
95
87
|
var key = getRowKey(record);
|
|
96
88
|
keysToUnselect = key !== undefined ? [].concat(keysToUnselect, [key]) : [].concat(keysToUnselect);
|
|
@@ -111,22 +103,21 @@ function TableSelection(_ref) {
|
|
|
111
103
|
return children ? children.filter(function (child) {
|
|
112
104
|
return isRecordSelectable(child, selectionStatusValidator) && getRowKey(child) !== undefined;
|
|
113
105
|
}) : [];
|
|
114
|
-
},
|
|
106
|
+
},
|
|
107
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
115
108
|
[getRowKey, selection == null ? void 0 : selection.checkRowSelectionStatus]);
|
|
116
109
|
var selectInvert = useCallback(function () {
|
|
117
110
|
if (dataSource && selection) {
|
|
118
111
|
var selectedRowKeys = selection.selectedRowKeys,
|
|
119
|
-
|
|
112
|
+
checkRowSelectionStatus = selection.checkRowSelectionStatus;
|
|
120
113
|
var keys = isShowingSubset ? [].concat(selectedRowKeys) : [];
|
|
121
114
|
dataSource.forEach(function (record) {
|
|
122
115
|
var rowChildren = record[childrenColumnName];
|
|
123
116
|
var hasChildren = Array.isArray(rowChildren);
|
|
124
117
|
var selectableChildren = hasChildren ? getSelectableChildren(rowChildren) : false;
|
|
125
|
-
|
|
126
118
|
if (selectableChildren) {
|
|
127
119
|
selectableChildren.forEach(function (child) {
|
|
128
120
|
var key = getRowKey(child);
|
|
129
|
-
|
|
130
121
|
if (selectedRowKeys.includes(key)) {
|
|
131
122
|
if (isShowingSubset) keys.splice(keys.indexOf(key), 1);
|
|
132
123
|
} else {
|
|
@@ -134,10 +125,8 @@ function TableSelection(_ref) {
|
|
|
134
125
|
}
|
|
135
126
|
});
|
|
136
127
|
}
|
|
137
|
-
|
|
138
128
|
if (!selectableChildren || selection.independentSelectionExpandedRows) {
|
|
139
129
|
var key = getRowKey(record);
|
|
140
|
-
|
|
141
130
|
if (selectedRowKeys.includes(key)) {
|
|
142
131
|
if (isShowingSubset) keys.splice(keys.indexOf(key), 1);
|
|
143
132
|
} else if (isRecordSelectable(record, checkRowSelectionStatus)) {
|
|
@@ -155,15 +144,13 @@ function TableSelection(_ref) {
|
|
|
155
144
|
var allSelectableRecordsCount = useMemo(function () {
|
|
156
145
|
if (isEmpty || !selection) return 0;
|
|
157
146
|
var independentSelectionExpandedRows = selection.independentSelectionExpandedRows,
|
|
158
|
-
|
|
147
|
+
checkRowSelectionStatus = selection.checkRowSelectionStatus;
|
|
159
148
|
return dataSource.reduce(function (count, record) {
|
|
160
149
|
var isSelectable = +isRecordSelectable(record, checkRowSelectionStatus);
|
|
161
150
|
var rowChildren = record[childrenColumnName];
|
|
162
|
-
|
|
163
151
|
if (independentSelectionExpandedRows) {
|
|
164
152
|
return Array.isArray(rowChildren) ? count + getSelectableChildren(rowChildren).length + isSelectable : count + isSelectable;
|
|
165
153
|
}
|
|
166
|
-
|
|
167
154
|
return Array.isArray(rowChildren) ? count + getSelectableChildren(rowChildren).length : count + isSelectable;
|
|
168
155
|
}, 0);
|
|
169
156
|
}, [childrenColumnName, dataSource, getSelectableChildren, isEmpty, selection]);
|
|
@@ -172,24 +159,52 @@ function TableSelection(_ref) {
|
|
|
172
159
|
var selectedRowKeys = selection.selectedRowKeys;
|
|
173
160
|
var selectedKeysInDataSourceCount = isShowingSubset ? dataSource.reduce(function (count, record) {
|
|
174
161
|
var rowChildren = record[childrenColumnName];
|
|
175
|
-
|
|
176
162
|
if (Array.isArray(rowChildren)) {
|
|
177
163
|
return rowChildren.reduce(function (childCount, child) {
|
|
178
164
|
var key = getRowKey(child);
|
|
179
165
|
return selectedRowKeys.includes(key) ? childCount + 1 : childCount;
|
|
180
166
|
}, 0);
|
|
181
167
|
}
|
|
182
|
-
|
|
183
168
|
if (!Array.isArray(rowChildren) || selection.independentSelectionExpandedRows) {
|
|
184
169
|
var key = getRowKey(record);
|
|
185
170
|
return selectedRowKeys.includes(key) ? count + 1 : count;
|
|
186
171
|
}
|
|
187
|
-
|
|
188
172
|
return count;
|
|
189
173
|
}, 0) : selectedRowKeys.length;
|
|
190
174
|
return allSelectableRecordsCount === selectedKeysInDataSourceCount;
|
|
191
175
|
}, [isEmpty, selection, isShowingSubset, dataSource, allSelectableRecordsCount, childrenColumnName, getRowKey]);
|
|
192
176
|
var selectionTooltipTitle = !allSelected ? locale == null ? void 0 : locale.selectAllTooltip : locale == null ? void 0 : locale.unselectAll;
|
|
177
|
+
var menuDataSource = useMemo(function () {
|
|
178
|
+
var _selection$selections;
|
|
179
|
+
return selection == null || (_selection$selections = selection.selections) == null ? void 0 : _selection$selections.filter(Boolean).map(function (selectionMenuElement) {
|
|
180
|
+
switch (selectionMenuElement) {
|
|
181
|
+
case SELECTION_ALL:
|
|
182
|
+
{
|
|
183
|
+
return !allSelected ? {
|
|
184
|
+
onClick: selectAll,
|
|
185
|
+
text: locale == null ? void 0 : locale.selectAll
|
|
186
|
+
} : {
|
|
187
|
+
onClick: unselectAll,
|
|
188
|
+
text: locale == null ? void 0 : locale.unselectAll
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
case SELECTION_INVERT:
|
|
192
|
+
{
|
|
193
|
+
return {
|
|
194
|
+
onClick: selectInvert,
|
|
195
|
+
text: locale == null ? void 0 : locale.selectInvert
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
default:
|
|
199
|
+
{
|
|
200
|
+
var sel = selectionMenuElement;
|
|
201
|
+
return _objectSpread({}, sel, {
|
|
202
|
+
text: sel.label
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
}, [allSelected, locale == null ? void 0 : locale.selectAll, locale == null ? void 0 : locale.selectInvert, locale == null ? void 0 : locale.unselectAll, selectAll, selectInvert, selection == null ? void 0 : selection.selections, unselectAll]);
|
|
193
208
|
return selection != null && selection.selectedRowKeys ? /*#__PURE__*/React.createElement(S.Selection, {
|
|
194
209
|
"data-popup-container": true
|
|
195
210
|
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
@@ -209,38 +224,9 @@ function TableSelection(_ref) {
|
|
|
209
224
|
})), (selection == null ? void 0 : selection.selections) && /*#__PURE__*/React.createElement(Dropdown, {
|
|
210
225
|
disabled: isEmpty || allSelectableRecordsCount === 0,
|
|
211
226
|
trigger: ['click'],
|
|
212
|
-
overlay: /*#__PURE__*/React.createElement(S.SelectionMenu,
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
{
|
|
216
|
-
return !allSelected ? /*#__PURE__*/React.createElement(Menu.Item, {
|
|
217
|
-
onClick: selectAll
|
|
218
|
-
}, locale == null ? void 0 : locale.selectAll) : /*#__PURE__*/React.createElement(Menu.Item, {
|
|
219
|
-
onClick: unselectAll
|
|
220
|
-
}, locale == null ? void 0 : locale.unselectAll);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
case SELECTION_INVERT:
|
|
224
|
-
{
|
|
225
|
-
return /*#__PURE__*/React.createElement(Menu.Item, {
|
|
226
|
-
onClick: selectInvert
|
|
227
|
-
}, locale == null ? void 0 : locale.selectInvert);
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
default:
|
|
231
|
-
{
|
|
232
|
-
var sel = selectionMenuElement;
|
|
233
|
-
return (
|
|
234
|
-
/*#__PURE__*/
|
|
235
|
-
// eslint-disable-next-line react/jsx-handler-names
|
|
236
|
-
React.createElement(Menu.Item, {
|
|
237
|
-
key: sel.key,
|
|
238
|
-
onClick: sel.onClick
|
|
239
|
-
}, sel.label)
|
|
240
|
-
);
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
}))
|
|
227
|
+
overlay: /*#__PURE__*/React.createElement(S.SelectionMenu, {
|
|
228
|
+
dataSource: menuDataSource
|
|
229
|
+
})
|
|
244
230
|
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
245
231
|
title: locale == null ? void 0 : locale.selectionOptionsTooltip
|
|
246
232
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
@@ -249,6 +235,5 @@ function TableSelection(_ref) {
|
|
|
249
235
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
250
236
|
component: /*#__PURE__*/React.createElement(OptionVerticalM, null)
|
|
251
237
|
}))))) : null;
|
|
252
|
-
}
|
|
253
|
-
|
|
238
|
+
};
|
|
254
239
|
export default TableSelection;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
|
|
2
|
-
|
|
3
2
|
import React from 'react';
|
|
4
3
|
import '@synerise/ds-core/dist/js/style';
|
|
5
4
|
import classNames from 'classnames';
|
|
@@ -9,31 +8,31 @@ import { theme } from '@synerise/ds-core';
|
|
|
9
8
|
import { v4 as uuid } from 'uuid';
|
|
10
9
|
import DSTable from '../Table';
|
|
11
10
|
import * as S from './TreeTable.styles';
|
|
12
|
-
var INDENT_SIZE = 42;
|
|
11
|
+
var INDENT_SIZE = 42;
|
|
13
12
|
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
14
|
function TreeTable(props) {
|
|
15
15
|
var className = props.className,
|
|
16
|
-
|
|
16
|
+
selection = props.selection;
|
|
17
17
|
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
19
|
var RenderRow = React.useCallback(function (row) {
|
|
19
20
|
return /*#__PURE__*/React.createElement(S.TreeTableRow, {
|
|
20
21
|
className: row.className + " ds-table-row"
|
|
21
22
|
}, row.children);
|
|
22
23
|
}, []);
|
|
23
|
-
var RenderCell = React.useCallback(
|
|
24
|
+
var RenderCell = React.useCallback(
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
24
26
|
function (cell) {
|
|
25
27
|
var _cell$children$;
|
|
26
|
-
|
|
27
28
|
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
29
|
return value.includes('indent-level-');
|
|
29
30
|
})) == null ? void 0 : _cell$children$.split('-').pop();
|
|
30
|
-
|
|
31
31
|
if (indentLevel === undefined) {
|
|
32
32
|
return /*#__PURE__*/React.createElement("td", {
|
|
33
33
|
className: cell.className
|
|
34
34
|
}, cell.children);
|
|
35
35
|
}
|
|
36
|
-
|
|
37
36
|
var maxIndent = parseInt(indentLevel, 10);
|
|
38
37
|
var indents = [].concat(new Array(maxIndent)).map(function (indentElement, index) {
|
|
39
38
|
return /*#__PURE__*/React.createElement(S.Indent, {
|
|
@@ -63,9 +62,9 @@ function TreeTable(props) {
|
|
|
63
62
|
},
|
|
64
63
|
expandIcon: function expandIcon(expandIconProps) {
|
|
65
64
|
var expandable = expandIconProps.expandable,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
expanded = expandIconProps.expanded,
|
|
66
|
+
onExpand = expandIconProps.onExpand,
|
|
67
|
+
record = expandIconProps.record;
|
|
69
68
|
return expandable ? /*#__PURE__*/React.createElement(S.RowExpander, null, /*#__PURE__*/React.createElement(Button.Expander, {
|
|
70
69
|
expanded: expanded,
|
|
71
70
|
onClick: function onClick(e) {
|
|
@@ -81,5 +80,4 @@ function TreeTable(props) {
|
|
|
81
80
|
})
|
|
82
81
|
}));
|
|
83
82
|
}
|
|
84
|
-
|
|
85
83
|
export default TreeTable;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
2
|
var LEVELS = ['yellow', 'green', 'cyan', 'violet', 'orange', 'purple', 'blue', 'grey'];
|
|
3
|
-
|
|
4
3
|
var getColor = function getColor(active, level) {
|
|
5
4
|
if (level === LEVELS.indexOf('cyan') && active) return '500';
|
|
6
5
|
return active ? '600' : '200';
|
|
7
6
|
};
|
|
8
|
-
|
|
9
7
|
export var Indents = styled.div.withConfig({
|
|
10
8
|
displayName: "TreeTablestyles__Indents",
|
|
11
9
|
componentId: "sc-14bdrex-0"
|