@synerise/ds-table 1.9.11 → 1.9.13

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.
Files changed (231) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/Cell/Action/ActionCell.d.ts +2 -2
  3. package/dist/Cell/Action/ActionCell.js +15 -18
  4. package/dist/Cell/Action/ActionCell.styles.d.ts +2 -2
  5. package/dist/Cell/Action/ActionCell.styles.js +10 -11
  6. package/dist/Cell/Action/ActionCell.types.d.ts +2 -2
  7. package/dist/Cell/Action/ActionCell.types.js +1 -1
  8. package/dist/Cell/AvatarLabel/AvatarLabel.d.ts +2 -2
  9. package/dist/Cell/AvatarLabel/AvatarLabel.js +32 -43
  10. package/dist/Cell/AvatarLabel/AvatarLabel.styles.d.ts +13 -13
  11. package/dist/Cell/AvatarLabel/AvatarLabel.styles.js +27 -28
  12. package/dist/Cell/AvatarLabel/AvatarLabel.types.d.ts +2 -2
  13. package/dist/Cell/AvatarLabel/AvatarLabel.types.js +1 -1
  14. package/dist/Cell/Copyable/Copyable.styles.d.ts +2 -2
  15. package/dist/Cell/Copyable/Copyable.styles.js +9 -15
  16. package/dist/Cell/Copyable/Copyable.types.d.ts +1 -1
  17. package/dist/Cell/Copyable/Copyable.types.js +1 -1
  18. package/dist/Cell/Copyable/CopyableCell.d.ts +2 -2
  19. package/dist/Cell/Copyable/CopyableCell.js +23 -27
  20. package/dist/Cell/Editable/EditableCell.d.ts +2 -2
  21. package/dist/Cell/Editable/EditableCell.js +26 -39
  22. package/dist/Cell/Editable/EditableCell.styles.d.ts +2 -2
  23. package/dist/Cell/Editable/EditableCell.styles.js +9 -7
  24. package/dist/Cell/Editable/EditableCell.types.d.ts +1 -1
  25. package/dist/Cell/Editable/EditableCell.types.js +1 -1
  26. package/dist/Cell/FlagLabel/FlagLabelCell.d.ts +2 -2
  27. package/dist/Cell/FlagLabel/FlagLabelCell.js +15 -14
  28. package/dist/Cell/FlagLabel/FlagLabelCell.styles.d.ts +1 -1
  29. package/dist/Cell/FlagLabel/FlagLabelCell.styles.js +6 -3
  30. package/dist/Cell/FlagLabel/FlagLabelCell.types.d.ts +2 -2
  31. package/dist/Cell/FlagLabel/FlagLabelCell.types.js +1 -1
  32. package/dist/Cell/IconLabel/IconLabel.d.ts +2 -2
  33. package/dist/Cell/IconLabel/IconLabel.js +14 -15
  34. package/dist/Cell/IconLabel/IconLabel.styles.d.ts +1 -1
  35. package/dist/Cell/IconLabel/IconLabel.styles.js +7 -6
  36. package/dist/Cell/IconLabel/IconLabel.types.d.ts +3 -3
  37. package/dist/Cell/IconLabel/IconLabel.types.js +1 -1
  38. package/dist/Cell/IconTooltipCell/IconTooltipCell.d.ts +2 -2
  39. package/dist/Cell/IconTooltipCell/IconTooltipCell.js +18 -23
  40. package/dist/Cell/IconTooltipCell/IconTooltipCell.styles.d.ts +2 -2
  41. package/dist/Cell/IconTooltipCell/IconTooltipCell.styles.js +9 -11
  42. package/dist/Cell/IconTooltipCell/IconTooltipCell.types.d.ts +4 -4
  43. package/dist/Cell/IconTooltipCell/IconTooltipCell.types.js +1 -1
  44. package/dist/Cell/InputNumber/InputNumberCell.d.ts +2 -2
  45. package/dist/Cell/InputNumber/InputNumberCell.js +10 -17
  46. package/dist/Cell/InputNumber/InputNumberCell.styles.d.ts +1 -1
  47. package/dist/Cell/InputNumber/InputNumberCell.styles.js +9 -5
  48. package/dist/Cell/InputNumber/InputNumberCell.types.d.ts +2 -2
  49. package/dist/Cell/InputNumber/InputNumberCell.types.js +1 -1
  50. package/dist/Cell/LabelsWithShowMore/LabelsWithShowMore.d.ts +3 -3
  51. package/dist/Cell/LabelsWithShowMore/LabelsWithShowMore.js +29 -40
  52. package/dist/Cell/LabelsWithShowMore/LabelsWithShowMore.styles.d.ts +3 -3
  53. package/dist/Cell/LabelsWithShowMore/LabelsWithShowMore.styles.js +11 -8
  54. package/dist/Cell/LabelsWithShowMore/LabelsWithShowMore.types.d.ts +2 -2
  55. package/dist/Cell/LabelsWithShowMore/LabelsWithShowMore.types.js +1 -1
  56. package/dist/Cell/LabelsWithShowMore/Modal/Modal.d.ts +2 -2
  57. package/dist/Cell/LabelsWithShowMore/Modal/Modal.js +35 -64
  58. package/dist/Cell/LabelsWithShowMore/Modal/Modal.types.d.ts +3 -3
  59. package/dist/Cell/LabelsWithShowMore/Modal/Modal.types.js +1 -1
  60. package/dist/Cell/Star/StarCell.d.ts +45 -45
  61. package/dist/Cell/Star/StarCell.js +25 -31
  62. package/dist/Cell/Star/StarCell.styles.d.ts +2 -2
  63. package/dist/Cell/Star/StarCell.styles.js +11 -9
  64. package/dist/Cell/Star/StarCell.types.d.ts +2 -2
  65. package/dist/Cell/Star/StarCell.types.js +1 -1
  66. package/dist/Cell/StatusLabel/StatusLabel.d.ts +2 -2
  67. package/dist/Cell/StatusLabel/StatusLabel.js +17 -19
  68. package/dist/Cell/StatusLabel/StatusLabel.styles.d.ts +2 -2
  69. package/dist/Cell/StatusLabel/StatusLabel.styles.js +9 -9
  70. package/dist/Cell/StatusLabel/StatusLabel.types.d.ts +3 -3
  71. package/dist/Cell/StatusLabel/StatusLabel.types.js +1 -1
  72. package/dist/Cell/TagIcon/TagIcon.d.ts +2 -2
  73. package/dist/Cell/TagIcon/TagIcon.js +9 -13
  74. package/dist/Cell/TagIcon/TagIcon.styles.d.ts +1 -1
  75. package/dist/Cell/TagIcon/TagIcon.styles.js +7 -6
  76. package/dist/Cell/TagIcon/TagIcon.types.d.ts +2 -2
  77. package/dist/Cell/TagIcon/TagIcon.types.js +1 -1
  78. package/dist/Cell/TagsGroup/TagsGroup.d.ts +2 -2
  79. package/dist/Cell/TagsGroup/TagsGroup.js +22 -39
  80. package/dist/Cell/TagsGroup/TagsGroup.styles.d.ts +2 -2
  81. package/dist/Cell/TagsGroup/TagsGroup.styles.js +30 -9
  82. package/dist/Cell/TagsGroup/TagsGroup.types.d.ts +2 -2
  83. package/dist/Cell/TagsGroup/TagsGroup.types.js +1 -1
  84. package/dist/Cell/index.d.ts +12 -12
  85. package/dist/Cell/index.js +28 -14
  86. package/dist/ColumnSortMenu/SortIcons.d.ts +2 -2
  87. package/dist/ColumnSortMenu/SortIcons.js +26 -38
  88. package/dist/ColumnSortMenu/SortRender.styles.d.ts +34 -34
  89. package/dist/ColumnSortMenu/SortRender.styles.js +13 -10
  90. package/dist/ColumnSortMenu/SortRenderer.d.ts +2 -2
  91. package/dist/ColumnSortMenu/SortRenderer.js +74 -108
  92. package/dist/ColumnSortMenu/TitleWithSort.d.ts +2 -2
  93. package/dist/ColumnSortMenu/TitleWithSort.js +19 -16
  94. package/dist/ColumnSortMenu/columnWithSortButtons.d.ts +1 -2
  95. package/dist/ColumnSortMenu/columnWithSortButtons.js +26 -43
  96. package/dist/ColumnSortMenu/groupedColumnsSort.d.ts +3 -3
  97. package/dist/ColumnSortMenu/groupedColumnsSort.js +33 -28
  98. package/dist/ColumnSortMenu/replaceSortButtons.d.ts +1 -1
  99. package/dist/ColumnSortMenu/replaceSortButtons.js +14 -15
  100. package/dist/ColumnSortMenu/useSortState.d.ts +1 -1
  101. package/dist/ColumnSortMenu/useSortState.js +95 -93
  102. package/dist/DefaultTable/DefaultTable.d.ts +2 -2
  103. package/dist/DefaultTable/DefaultTable.js +147 -148
  104. package/dist/FilterTrigger/FilterTrigger.d.ts +2 -2
  105. package/dist/FilterTrigger/FilterTrigger.js +42 -67
  106. package/dist/FilterTrigger/FilterTrigger.styles.d.ts +53 -53
  107. package/dist/FilterTrigger/FilterTrigger.styles.js +19 -32
  108. package/dist/FilterTrigger/FilterTrigger.types.d.ts +1 -1
  109. package/dist/FilterTrigger/FilterTrigger.types.js +1 -1
  110. package/dist/GroupTable/GroupTable.d.ts +3 -4
  111. package/dist/GroupTable/GroupTable.js +97 -118
  112. package/dist/GroupTable/GroupTable.styles.d.ts +25 -25
  113. package/dist/GroupTable/GroupTable.styles.js +40 -37
  114. package/dist/GroupTable/GroupTable.types.d.ts +1 -1
  115. package/dist/GroupTable/GroupTable.types.js +9 -6
  116. package/dist/GroupTable/GroupTableBody/GroupTableBody.d.ts +1 -1
  117. package/dist/GroupTable/GroupTableBody/GroupTableBody.js +83 -107
  118. package/dist/GroupTable/GroupTableBody/GroupTableBody.types.d.ts +3 -3
  119. package/dist/GroupTable/GroupTableBody/GroupTableBody.types.js +1 -1
  120. package/dist/GroupTable/GroupTableHeader/GroupTableHeader.d.ts +1 -1
  121. package/dist/GroupTable/GroupTableHeader/GroupTableHeader.js +25 -28
  122. package/dist/GroupTable/GroupTableHeader/GroupTableHeader.types.js +1 -1
  123. package/dist/InfiniteScroll/BackToTopButton.d.ts +2 -2
  124. package/dist/InfiniteScroll/BackToTopButton.js +7 -15
  125. package/dist/InfiniteScroll/BackToTopButton.styles.d.ts +34 -34
  126. package/dist/InfiniteScroll/BackToTopButton.styles.js +11 -9
  127. package/dist/InfiniteScroll/ErrorItem.d.ts +1 -1
  128. package/dist/InfiniteScroll/ErrorItem.js +19 -23
  129. package/dist/InfiniteScroll/ErrorItem.styles.d.ts +1 -1
  130. package/dist/InfiniteScroll/ErrorItem.styles.js +6 -3
  131. package/dist/InfiniteScroll/InfiniteLoaderItem.d.ts +2 -2
  132. package/dist/InfiniteScroll/InfiniteLoaderItem.js +33 -28
  133. package/dist/InfiniteScroll/InfiniteLoaderItem.styles.d.ts +1 -1
  134. package/dist/InfiniteScroll/InfiniteLoaderItem.styles.js +7 -4
  135. package/dist/InfiniteScroll/InfiniteLoaderItem.types.d.ts +1 -1
  136. package/dist/InfiniteScroll/InfiniteLoaderItem.types.js +1 -1
  137. package/dist/InfiniteScroll/LoadingItem.d.ts +1 -1
  138. package/dist/InfiniteScroll/LoadingItem.js +10 -10
  139. package/dist/InfiniteScroll/NoMoreItem.d.ts +1 -1
  140. package/dist/InfiniteScroll/NoMoreItem.js +10 -10
  141. package/dist/InfiniteScroll/OuterListElement.d.ts +1 -1
  142. package/dist/InfiniteScroll/OuterListElement.js +45 -58
  143. package/dist/InfiniteScroll/constants.js +4 -1
  144. package/dist/InfiniteScroll/utils.d.ts +1 -1
  145. package/dist/InfiniteScroll/utils.js +15 -12
  146. package/dist/ItemsMenu/ItemsMenu.d.ts +2 -2
  147. package/dist/ItemsMenu/ItemsMenu.js +7 -6
  148. package/dist/ItemsMenu/ItemsMenu.styles.d.ts +1 -1
  149. package/dist/ItemsMenu/ItemsMenu.styles.js +6 -3
  150. package/dist/ItemsMenu/ItemsMenu.types.d.ts +1 -1
  151. package/dist/ItemsMenu/ItemsMenu.types.js +1 -1
  152. package/dist/RowSelection/RowSelectionColumn.d.ts +3 -3
  153. package/dist/RowSelection/RowSelectionColumn.js +77 -81
  154. package/dist/RowSelection/RowSelectionColumn.types.d.ts +3 -3
  155. package/dist/RowSelection/RowSelectionColumn.types.js +1 -1
  156. package/dist/RowSelection/index.js +4 -1
  157. package/dist/Table.d.ts +2 -4
  158. package/dist/Table.js +94 -129
  159. package/dist/Table.styles.d.ts +23 -23
  160. package/dist/Table.styles.js +86 -110
  161. package/dist/Table.types.d.ts +7 -7
  162. package/dist/Table.types.js +1 -1
  163. package/dist/TableHeader/TableHeader.d.ts +2 -2
  164. package/dist/TableHeader/TableHeader.js +91 -129
  165. package/dist/TableHeader/TableHeader.types.d.ts +2 -2
  166. package/dist/TableHeader/TableHeader.types.js +1 -1
  167. package/dist/TableHeader/TableLimit/TableLimit.d.ts +2 -2
  168. package/dist/TableHeader/TableLimit/TableLimit.js +44 -36
  169. package/dist/TableHeader/TableLimit/TableLimit.styles.d.ts +4 -4
  170. package/dist/TableHeader/TableLimit/TableLimit.styles.js +15 -13
  171. package/dist/TableHeader/TableLimit/TableLimit.types.d.ts +3 -3
  172. package/dist/TableHeader/TableLimit/TableLimit.types.js +1 -1
  173. package/dist/TableHeader/TableLimit/index.js +4 -2
  174. package/dist/TableHeader/TableSelection.d.ts +2 -2
  175. package/dist/TableHeader/TableSelection.js +163 -180
  176. package/dist/TableHeader/TableSelection.types.d.ts +1 -1
  177. package/dist/TableHeader/TableSelection.types.js +1 -1
  178. package/dist/TreeTable/TreeTable.d.ts +2 -3
  179. package/dist/TreeTable/TreeTable.js +51 -78
  180. package/dist/TreeTable/TreeTable.styles.d.ts +5 -5
  181. package/dist/TreeTable/TreeTable.styles.js +21 -20
  182. package/dist/VirtualTable/VirtualTable.d.ts +3 -3
  183. package/dist/VirtualTable/VirtualTable.js +342 -411
  184. package/dist/VirtualTable/VirtualTable.styles.d.ts +8 -8
  185. package/dist/VirtualTable/VirtualTable.styles.js +30 -40
  186. package/dist/VirtualTable/VirtualTable.types.d.ts +4 -4
  187. package/dist/VirtualTable/VirtualTable.types.js +1 -1
  188. package/dist/VirtualTable/VirtualTableRow.d.ts +4 -4
  189. package/dist/VirtualTable/VirtualTableRow.js +103 -111
  190. package/dist/VirtualTable/constants.js +8 -3
  191. package/dist/assets/style/index-tn0RQdqM.css +0 -0
  192. package/dist/constants/Table.constants.js +11 -6
  193. package/dist/constants/TableSkeleton.constants.d.ts +1 -1
  194. package/dist/constants/TableSkeleton.constants.js +48 -100
  195. package/dist/hooks/useBulkSelection/index.js +4 -1
  196. package/dist/hooks/useBulkSelection/useBulkSelection.d.ts +1 -1
  197. package/dist/hooks/useBulkSelection/useBulkSelection.js +55 -40
  198. package/dist/hooks/useRowKey/index.js +4 -1
  199. package/dist/hooks/useRowKey/useRowKey.js +11 -11
  200. package/dist/hooks/useRowStar/index.js +4 -2
  201. package/dist/hooks/useRowStar/useRowStar.d.ts +1 -1
  202. package/dist/hooks/useRowStar/useRowStar.js +54 -62
  203. package/dist/hooks/useRowStar/useRowStar.types.d.ts +2 -2
  204. package/dist/hooks/useRowStar/useRowStar.types.js +1 -1
  205. package/dist/index.d.ts +4 -4
  206. package/dist/index.js +18 -9
  207. package/dist/modules.d.js +1 -1
  208. package/dist/modules.d.ts +0 -0
  209. package/dist/utils/calculateColumnWidths.d.ts +1 -1
  210. package/dist/utils/calculateColumnWidths.js +17 -16
  211. package/dist/utils/calculatePixels.js +11 -12
  212. package/dist/utils/columnWithCellTooltip.d.ts +1 -1
  213. package/dist/utils/columnWithCellTooltip.js +18 -15
  214. package/dist/utils/getChildrenColumnName.js +6 -3
  215. package/dist/utils/getRecordSelectionStatus.d.ts +1 -1
  216. package/dist/utils/getRecordSelectionStatus.js +11 -7
  217. package/dist/utils/getSkeletonProps.d.ts +1 -1
  218. package/dist/utils/getSkeletonProps.js +26 -36
  219. package/dist/utils/getValueFromPath.js +9 -6
  220. package/dist/utils/index.js +23 -9
  221. package/dist/utils/isGrouped.d.ts +1 -1
  222. package/dist/utils/isGrouped.js +6 -3
  223. package/dist/utils/isRecordSelectable.d.ts +1 -1
  224. package/dist/utils/isRecordSelectable.js +10 -6
  225. package/dist/utils/locale.d.ts +3 -3
  226. package/dist/utils/locale.js +115 -111
  227. package/package.json +31 -31
  228. package/dist/Cell/TagsGroup/TagsGroup.spec.d.ts +0 -1
  229. package/dist/ColumnSortMenu/__spec__/groupedColumnsSort.spec.d.ts +0 -1
  230. package/dist/VirtualTable/VirtualTable.spec.d.ts +0 -1
  231. package/dist/utils/__specs__/getValueFromPath.spec.d.ts +0 -1
@@ -1,44 +1,52 @@
1
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
- import React, { useCallback, useMemo } from 'react';
3
- import Button from '@synerise/ds-button';
4
- import { DropdownMenu } from '@synerise/ds-dropdown';
5
- import Icon, { OptionVerticalM } from '@synerise/ds-icon';
6
- import Tooltip from '@synerise/ds-tooltip';
7
- import * as S from '../Table.styles';
8
- import { SELECTION_ALL, SELECTION_INVERT } from '../constants/Table.constants';
9
- import { useBulkSelectionCount } from '../hooks/useBulkSelection';
10
- import { useRowKey } from '../hooks/useRowKey';
11
- import { isRecordSelectable } from '../utils';
12
- var TableSelection = function TableSelection(_ref) {
13
- var _selection$globalSele7;
14
- var dataSource = _ref.dataSource,
15
- dataSourceFull = _ref.dataSourceFull,
16
- selection = _ref.selection,
17
- rowKey = _ref.rowKey,
18
- locale = _ref.locale,
19
- hasSelectionLimit = _ref.hasSelectionLimit,
20
- childrenColumnName = _ref.childrenColumnName;
21
- var _useRowKey = useRowKey(rowKey),
22
- getRowKey = _useRowKey.getRowKey;
23
- var allData = dataSourceFull || dataSource;
24
- var isShowingSubset = dataSourceFull && dataSourceFull.length !== dataSource.length;
25
- var getRowsForKeys = useCallback(function (keys) {
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { useCallback, useMemo } from "react";
3
+ import Button from "@synerise/ds-button";
4
+ import { DropdownMenu } from "@synerise/ds-dropdown";
5
+ import Icon, { OptionVerticalM } from "@synerise/ds-icon";
6
+ import Tooltip from "@synerise/ds-tooltip";
7
+ import { Selection } from "../Table.styles.js";
8
+ import { SELECTION_INVERT, SELECTION_ALL } from "../constants/Table.constants.js";
9
+ import { useBulkSelectionCount } from "../hooks/useBulkSelection/useBulkSelection.js";
10
+ import { useRowKey } from "../hooks/useRowKey/useRowKey.js";
11
+ import "unit-to-px";
12
+ import "@synerise/ds-skeleton";
13
+ import "uuid";
14
+ import "styled-components";
15
+ import "@synerise/ds-typography";
16
+ import "ramda";
17
+ import { isRecordSelectable } from "../utils/isRecordSelectable.js";
18
+ import "../utils/locale.js";
19
+ const TableSelection = ({
20
+ dataSource,
21
+ dataSourceFull,
22
+ selection,
23
+ rowKey,
24
+ locale,
25
+ hasSelectionLimit,
26
+ childrenColumnName
27
+ }) => {
28
+ const {
29
+ getRowKey
30
+ } = useRowKey(rowKey);
31
+ const allData = dataSourceFull || dataSource;
32
+ const isShowingSubset = dataSourceFull && dataSourceFull.length !== dataSource.length;
33
+ const getRowsForKeys = useCallback((keys) => {
26
34
  if (selection) {
27
- var rows = [];
28
- allData.forEach(function (record) {
29
- var rowChildren = record[childrenColumnName];
35
+ let rows = [];
36
+ allData.forEach((record) => {
37
+ const rowChildren = record[childrenColumnName];
30
38
  if (Array.isArray(rowChildren)) {
31
- rowChildren.forEach(function (child) {
32
- var key = getRowKey(child);
39
+ rowChildren.forEach((child) => {
40
+ const key = getRowKey(child);
33
41
  if (rowChildren && key && keys.includes(key)) {
34
- rows = [].concat(rows, [record]);
42
+ rows = [...rows, record];
35
43
  }
36
44
  });
37
45
  }
38
46
  if (!Array.isArray(rowChildren) || selection.independentSelectionExpandedRows) {
39
- var key = getRowKey(record);
47
+ const key = getRowKey(record);
40
48
  if (key && keys.includes(key)) {
41
- rows = [].concat(rows, [record]);
49
+ rows = [...rows, record];
42
50
  }
43
51
  }
44
52
  });
@@ -46,211 +54,186 @@ var TableSelection = function TableSelection(_ref) {
46
54
  }
47
55
  return [];
48
56
  }, [allData, getRowKey, selection, childrenColumnName]);
49
- var selectAll = useCallback(function () {
57
+ const selectAll = useCallback(() => {
50
58
  if (dataSource && selection) {
51
- var _selection$globalSele;
52
- var selectedRowKeys = selection.selectedRowKeys,
53
- checkRowSelectionStatus = selection.checkRowSelectionStatus;
54
- var keys = isShowingSubset ? [].concat(selectedRowKeys) : [];
55
- dataSource.forEach(function (record) {
56
- var rowChildren = record[childrenColumnName];
59
+ const {
60
+ selectedRowKeys,
61
+ checkRowSelectionStatus
62
+ } = selection;
63
+ let keys = isShowingSubset ? [...selectedRowKeys] : [];
64
+ dataSource.forEach((record) => {
65
+ const rowChildren = record[childrenColumnName];
57
66
  if (Array.isArray(rowChildren)) {
58
- keys = [].concat(keys, rowChildren.reduce(function (acc, child) {
59
- var key = getRowKey(child);
60
- return key && (isRecordSelectable(child, checkRowSelectionStatus) || selectedRowKeys.includes(key)) ? [].concat(acc, [key]) : acc;
61
- }, []));
67
+ keys = [...keys, ...rowChildren.reduce((acc, child) => {
68
+ const key = getRowKey(child);
69
+ return key && (isRecordSelectable(child, checkRowSelectionStatus) || selectedRowKeys.includes(key)) ? [...acc, key] : acc;
70
+ }, [])];
62
71
  }
63
72
  if (!Array.isArray(rowChildren) || selection.independentSelectionExpandedRows) {
64
- var key = getRowKey(record);
65
- keys = key !== undefined && (isRecordSelectable(record, checkRowSelectionStatus) || selectedRowKeys.includes(key)) ? [].concat(keys, [key]) : [].concat(keys);
73
+ const key = getRowKey(record);
74
+ keys = key !== void 0 && (isRecordSelectable(record, checkRowSelectionStatus) || selectedRowKeys.includes(key)) ? [...keys, key] : [...keys];
66
75
  }
67
76
  });
68
- var uniqueKeys = Array.from(new Set(keys));
69
- var rows = getRowsForKeys(uniqueKeys);
70
- (_selection$globalSele = selection.globalSelection) == null || _selection$globalSele.onChange(false);
77
+ const uniqueKeys = Array.from(new Set(keys));
78
+ const rows = getRowsForKeys(uniqueKeys);
79
+ selection.globalSelection?.onChange(false);
71
80
  selection.onChange(uniqueKeys, rows);
72
81
  }
73
82
  }, [childrenColumnName, dataSource, selection, isShowingSubset, getRowsForKeys, getRowKey]);
74
- var unselectAll = useCallback(function () {
83
+ const unselectAll = useCallback(() => {
75
84
  if (selection) {
76
- var selectedRowKeys = selection.selectedRowKeys,
77
- checkRowSelectionStatus = selection.checkRowSelectionStatus;
78
- var keysToUnselect = [];
79
- dataSource.forEach(function (record) {
80
- var rowChildren = record[childrenColumnName];
85
+ const {
86
+ selectedRowKeys,
87
+ checkRowSelectionStatus
88
+ } = selection;
89
+ let keysToUnselect = [];
90
+ dataSource.forEach((record) => {
91
+ const rowChildren = record[childrenColumnName];
81
92
  if (Array.isArray(rowChildren)) {
82
- keysToUnselect = [].concat(keysToUnselect, rowChildren.reduce(function (acc, child) {
83
- var key = getRowKey(child);
84
- return key && isRecordSelectable(child, checkRowSelectionStatus) ? [].concat(acc, [key]) : acc;
85
- }, []));
93
+ keysToUnselect = [...keysToUnselect, ...rowChildren.reduce((acc, child) => {
94
+ const key = getRowKey(child);
95
+ return key && isRecordSelectable(child, checkRowSelectionStatus) ? [...acc, key] : acc;
96
+ }, [])];
86
97
  }
87
98
  if (!Array.isArray(rowChildren) || selection.independentSelectionExpandedRows) {
88
- var key = getRowKey(record);
89
- keysToUnselect = key !== undefined && isRecordSelectable(record, checkRowSelectionStatus) ? [].concat(keysToUnselect, [key]) : [].concat(keysToUnselect);
99
+ const key = getRowKey(record);
100
+ keysToUnselect = key !== void 0 && isRecordSelectable(record, checkRowSelectionStatus) ? [...keysToUnselect, key] : [...keysToUnselect];
90
101
  }
91
102
  });
92
- var keysLeft = selectedRowKeys.filter(function (key) {
93
- return !keysToUnselect.includes(key);
94
- });
95
- var rows = getRowsForKeys(keysLeft);
103
+ const keysLeft = selectedRowKeys.filter((key) => !keysToUnselect.includes(key));
104
+ const rows = getRowsForKeys(keysLeft);
96
105
  selection.onChange(keysLeft, rows);
97
106
  }
98
107
  }, [dataSource, getRowKey, getRowsForKeys, selection, childrenColumnName]);
99
- var selectGlobalAll = useCallback(function () {
100
- var _selection$globalSele2;
108
+ const selectGlobalAll = useCallback(() => {
101
109
  unselectAll();
102
- (_selection$globalSele2 = selection.globalSelection) == null || _selection$globalSele2.onChange(true);
110
+ selection.globalSelection?.onChange(true);
103
111
  }, [unselectAll, selection.globalSelection]);
104
- var unselectGlobalAll = useCallback(function () {
105
- var _selection$globalSele3;
106
- (_selection$globalSele3 = selection.globalSelection) == null || _selection$globalSele3.onChange(false);
112
+ const unselectGlobalAll = useCallback(() => {
113
+ selection.globalSelection?.onChange(false);
107
114
  }, [selection.globalSelection]);
108
- var getSelectableChildren = useCallback(function (children) {
109
- var selectionStatusValidator = (selection == null ? void 0 : selection.checkRowSelectionStatus) || undefined;
110
- return children ? children.filter(function (child) {
111
- return isRecordSelectable(child, selectionStatusValidator) && getRowKey(child) !== undefined;
112
- }) : [];
113
- }, [getRowKey, selection == null ? void 0 : selection.checkRowSelectionStatus]);
114
- var selectInvert = useCallback(function () {
115
+ const getSelectableChildren = useCallback((children) => {
116
+ const selectionStatusValidator = selection?.checkRowSelectionStatus || void 0;
117
+ return children ? children.filter((child) => isRecordSelectable(child, selectionStatusValidator) && getRowKey(child) !== void 0) : [];
118
+ }, [getRowKey, selection?.checkRowSelectionStatus]);
119
+ const selectInvert = useCallback(() => {
115
120
  if (dataSource && selection) {
116
- var selectedRowKeys = selection.selectedRowKeys,
117
- checkRowSelectionStatus = selection.checkRowSelectionStatus;
118
- var keys = [].concat(selectedRowKeys);
119
- dataSource.forEach(function (record) {
120
- var rowChildren = record[childrenColumnName];
121
- var hasChildren = Array.isArray(rowChildren);
122
- var selectableChildren = hasChildren ? getSelectableChildren(rowChildren) : false;
121
+ const {
122
+ selectedRowKeys,
123
+ checkRowSelectionStatus
124
+ } = selection;
125
+ let keys = [...selectedRowKeys];
126
+ dataSource.forEach((record) => {
127
+ const rowChildren = record[childrenColumnName];
128
+ const hasChildren = Array.isArray(rowChildren);
129
+ const selectableChildren = hasChildren ? getSelectableChildren(rowChildren) : false;
123
130
  if (selectableChildren) {
124
- selectableChildren.forEach(function (child) {
125
- var key = getRowKey(child);
131
+ selectableChildren.forEach((child) => {
132
+ const key = getRowKey(child);
126
133
  if (selectedRowKeys.includes(key)) {
127
134
  keys.splice(keys.indexOf(key), 1);
128
135
  } else {
129
- keys = [].concat(keys, [key]);
136
+ keys = [...keys, key];
130
137
  }
131
138
  });
132
139
  }
133
140
  if (!selectableChildren || selection.independentSelectionExpandedRows) {
134
- var key = getRowKey(record);
135
- var isSelectable = isRecordSelectable(record, checkRowSelectionStatus);
141
+ const key = getRowKey(record);
142
+ const isSelectable = isRecordSelectable(record, checkRowSelectionStatus);
136
143
  if (!isSelectable) {
137
144
  return;
138
145
  }
139
146
  if (selectedRowKeys.includes(key)) {
140
147
  keys.splice(keys.indexOf(key), 1);
141
148
  } else {
142
- keys = [].concat(keys, [key]);
149
+ keys = [...keys, key];
143
150
  }
144
151
  }
145
152
  });
146
- var rows = getRowsForKeys(keys);
153
+ const rows = getRowsForKeys(keys);
147
154
  selection.onChange(keys, rows);
148
155
  }
149
156
  }, [childrenColumnName, dataSource, selection, getRowsForKeys, getSelectableChildren, getRowKey]);
150
- var _useBulkSelectionCoun = useBulkSelectionCount({
151
- dataSource: dataSource,
152
- selection: selection,
153
- childrenColumnName: childrenColumnName,
154
- rowKey: rowKey
155
- }),
156
- allRecordsCount = _useBulkSelectionCoun.allRecordsCount,
157
- selectableRecordsCount = _useBulkSelectionCoun.selectableRecordsCount,
158
- selectableAndSelectedRecordsCount = _useBulkSelectionCoun.selectableAndSelectedRecordsCount,
159
- selectedRecordsCount = _useBulkSelectionCoun.selectedRecordsCount;
160
- var isIndeterminate = selectedRecordsCount > 0 && selectableRecordsCount !== selectableAndSelectedRecordsCount;
161
- var disabledBulkSelection = allRecordsCount === 0 || selectableRecordsCount === 0 || hasSelectionLimit && selectedRecordsCount === 0;
162
- var isAllSelected = !disabledBulkSelection && selectableRecordsCount === selectableAndSelectedRecordsCount;
163
- var isAnySelected = allRecordsCount > 0 && selectedRecordsCount > 0;
164
- var selectionTooltipTitle = useMemo(function () {
157
+ const {
158
+ allRecordsCount,
159
+ selectableRecordsCount,
160
+ selectableAndSelectedRecordsCount,
161
+ selectedRecordsCount
162
+ } = useBulkSelectionCount({
163
+ dataSource,
164
+ selection,
165
+ childrenColumnName,
166
+ rowKey
167
+ });
168
+ const isIndeterminate = selectedRecordsCount > 0 && selectableRecordsCount !== selectableAndSelectedRecordsCount;
169
+ const disabledBulkSelection = allRecordsCount === 0 || selectableRecordsCount === 0 || hasSelectionLimit && selectedRecordsCount === 0;
170
+ const isAllSelected = !disabledBulkSelection && selectableRecordsCount === selectableAndSelectedRecordsCount;
171
+ const isAnySelected = allRecordsCount > 0 && selectedRecordsCount > 0;
172
+ const selectionTooltipTitle = useMemo(() => {
165
173
  if (selection.globalSelection) {
166
- return selection.globalSelection.isSelected ? locale == null ? void 0 : locale.unselectGlobalAll : locale == null ? void 0 : locale.selectGlobalAll;
174
+ return selection.globalSelection.isSelected ? locale?.unselectGlobalAll : locale?.selectGlobalAll;
167
175
  }
168
- return isAllSelected ? locale == null ? void 0 : locale.unselectAll : locale == null ? void 0 : locale.selectAllTooltip;
169
- }, [isAllSelected, locale == null ? void 0 : locale.selectAllTooltip, locale == null ? void 0 : locale.selectGlobalAll, locale == null ? void 0 : locale.unselectAll, locale == null ? void 0 : locale.unselectGlobalAll, selection.globalSelection]);
170
- var dropdownDataSource = useMemo(function () {
171
- var _selection$globalSele4, _selection$selections;
172
- var isGlobalAllSelected = (_selection$globalSele4 = selection.globalSelection) == null ? void 0 : _selection$globalSele4.isSelected;
173
- var globalSelectionItem = selection.globalSelection ? [isGlobalAllSelected ? {
176
+ return isAllSelected ? locale?.unselectAll : locale?.selectAllTooltip;
177
+ }, [isAllSelected, locale?.selectAllTooltip, locale?.selectGlobalAll, locale?.unselectAll, locale?.unselectGlobalAll, selection.globalSelection]);
178
+ const dropdownDataSource = useMemo(() => {
179
+ const isGlobalAllSelected = selection.globalSelection?.isSelected;
180
+ const globalSelectionItem = selection.globalSelection ? [isGlobalAllSelected ? {
174
181
  onClick: unselectGlobalAll,
175
- text: locale == null ? void 0 : locale.unselectGlobalAll
182
+ text: locale?.unselectGlobalAll
176
183
  } : {
177
184
  onClick: selectGlobalAll,
178
- text: locale == null ? void 0 : locale.selectGlobalAll
185
+ text: locale?.selectGlobalAll
179
186
  }] : [];
180
- var menuItems = selection == null || (_selection$selections = selection.selections) == null ? void 0 : _selection$selections.filter(Boolean).flatMap(function (selectionMenuElement) {
187
+ const menuItems = selection?.selections?.filter(Boolean).flatMap((selectionMenuElement) => {
181
188
  switch (selectionMenuElement) {
182
- case SELECTION_ALL:
183
- {
184
- var items = [];
185
- if (!isAllSelected && !hasSelectionLimit) {
186
- items.push({
187
- onClick: selectAll,
188
- text: locale == null ? void 0 : locale.selectAll
189
- });
190
- }
191
- if (isAnySelected) {
192
- items.push({
193
- onClick: unselectAll,
194
- text: locale == null ? void 0 : locale.unselectAll
195
- });
196
- }
197
- return items;
198
- }
199
- case SELECTION_INVERT:
200
- {
201
- return !hasSelectionLimit ? {
202
- onClick: selectInvert,
203
- text: locale == null ? void 0 : locale.selectInvert
204
- } : [];
189
+ case SELECTION_ALL: {
190
+ const items = [];
191
+ if (!isAllSelected && !hasSelectionLimit) {
192
+ items.push({
193
+ onClick: selectAll,
194
+ text: locale?.selectAll
195
+ });
205
196
  }
206
- default:
207
- {
208
- var sel = selectionMenuElement;
209
- return _extends({}, sel, {
210
- text: sel.label
197
+ if (isAnySelected) {
198
+ items.push({
199
+ onClick: unselectAll,
200
+ text: locale?.unselectAll
211
201
  });
212
202
  }
203
+ return items;
204
+ }
205
+ case SELECTION_INVERT: {
206
+ return !hasSelectionLimit ? {
207
+ onClick: selectInvert,
208
+ text: locale?.selectInvert
209
+ } : [];
210
+ }
211
+ default: {
212
+ const sel = selectionMenuElement;
213
+ return {
214
+ ...sel,
215
+ text: sel.label
216
+ };
217
+ }
213
218
  }
214
219
  });
215
- return [].concat(globalSelectionItem, menuItems || []);
216
- }, [selection.globalSelection, selection == null ? void 0 : selection.selections, unselectGlobalAll, locale == null ? void 0 : locale.unselectGlobalAll, locale == null ? void 0 : locale.selectGlobalAll, locale == null ? void 0 : locale.selectAll, locale == null ? void 0 : locale.unselectAll, locale == null ? void 0 : locale.selectInvert, selectGlobalAll, isAllSelected, hasSelectionLimit, isAnySelected, selectAll, unselectAll, selectInvert]);
217
- var handleBatchSelectionChange = function handleBatchSelectionChange() {
218
- var _selection$globalSele5, _selection$globalSele6;
219
- var isSelected = (_selection$globalSele5 = (_selection$globalSele6 = selection.globalSelection) == null ? void 0 : _selection$globalSele6.isSelected) != null ? _selection$globalSele5 : isAllSelected;
220
+ return [...globalSelectionItem, ...menuItems || []];
221
+ }, [selection.globalSelection, selection?.selections, unselectGlobalAll, locale?.unselectGlobalAll, locale?.selectGlobalAll, locale?.selectAll, locale?.unselectAll, locale?.selectInvert, selectGlobalAll, isAllSelected, hasSelectionLimit, isAnySelected, selectAll, unselectAll, selectInvert]);
222
+ const handleBatchSelectionChange = () => {
223
+ const isSelected = selection.globalSelection?.isSelected ?? isAllSelected;
220
224
  if (selection.globalSelection) {
221
225
  isSelected ? unselectGlobalAll() : selectGlobalAll();
222
226
  } else {
223
227
  isSelected ? unselectAll() : selectAll();
224
228
  }
225
229
  };
226
- return selection != null && selection.selectedRowKeys ? /*#__PURE__*/React.createElement(S.Selection, {
227
- "data-popup-container": true
228
- }, !hasSelectionLimit && /*#__PURE__*/React.createElement(Tooltip, {
229
- title: selectionTooltipTitle
230
- }, /*#__PURE__*/React.createElement(Button.Checkbox, {
231
- disabled: disabledBulkSelection,
232
- "data-testid": "ds-table-batch-selection-button",
233
- checked: ((_selection$globalSele7 = selection.globalSelection) == null ? void 0 : _selection$globalSele7.isSelected) || isAllSelected,
234
- onChange: handleBatchSelectionChange,
235
- indeterminate: isIndeterminate
236
- })), selection.selections && /*#__PURE__*/React.createElement(DropdownMenu, {
237
- disabled: disabledBulkSelection || (dropdownDataSource == null ? void 0 : dropdownDataSource.length) === 0,
238
- getPopupContainer: function getPopupContainer() {
239
- return document.body;
240
- },
241
- dataSource: dropdownDataSource || [],
242
- popoverProps: {
243
- testId: 'table-selection'
244
- }
245
- }, /*#__PURE__*/React.createElement(Tooltip, {
246
- title: locale == null ? void 0 : locale.selectionOptionsTooltip
247
- }, /*#__PURE__*/React.createElement(Button, {
248
- disabled: disabledBulkSelection || (dropdownDataSource == null ? void 0 : dropdownDataSource.length) === 0,
249
- mode: "single-icon",
250
- type: "ghost",
251
- "data-testid": "ds-table-batch-selection-options"
252
- }, /*#__PURE__*/React.createElement(Icon, {
253
- component: /*#__PURE__*/React.createElement(OptionVerticalM, null)
254
- }))))) : null;
230
+ return selection?.selectedRowKeys ? /* @__PURE__ */ jsxs(Selection, { "data-popup-container": true, children: [
231
+ !hasSelectionLimit && /* @__PURE__ */ jsx(Tooltip, { title: selectionTooltipTitle, children: /* @__PURE__ */ jsx(Button.Checkbox, { disabled: disabledBulkSelection, "data-testid": "ds-table-batch-selection-button", checked: selection.globalSelection?.isSelected || isAllSelected, onChange: handleBatchSelectionChange, indeterminate: isIndeterminate }) }),
232
+ selection.selections && /* @__PURE__ */ jsx(DropdownMenu, { disabled: disabledBulkSelection || dropdownDataSource?.length === 0, getPopupContainer: () => document.body, dataSource: dropdownDataSource || [], popoverProps: {
233
+ testId: "table-selection"
234
+ }, children: /* @__PURE__ */ jsx(Tooltip, { title: locale?.selectionOptionsTooltip, children: /* @__PURE__ */ jsx(Button, { disabled: disabledBulkSelection || dropdownDataSource?.length === 0, mode: "single-icon", type: "ghost", "data-testid": "ds-table-batch-selection-options", children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(OptionVerticalM, {}) }) }) }) })
235
+ ] }) : null;
236
+ };
237
+ export {
238
+ TableSelection as default
255
239
  };
256
- export default TableSelection;
@@ -1,4 +1,4 @@
1
- import type { Locale, RowSelection } from '../Table.types';
1
+ import { Locale, RowSelection } from '../Table.types';
2
2
  export type TableSelectionProps<T extends object> = {
3
3
  selection: RowSelection<T>;
4
4
  dataSource: readonly T[];
@@ -1 +1 @@
1
- export {};
1
+
@@ -1,5 +1,4 @@
1
- import React from 'react';
2
- import '@synerise/ds-core/dist/js/style';
3
- import { type DSTableProps } from '../Table.types';
1
+ import { default as React } from 'react';
2
+ import { DSTableProps } from '../Table.types';
4
3
  declare function TreeTable<T extends object = any>(props: DSTableProps<T>): React.ReactElement;
5
4
  export default TreeTable;
@@ -1,83 +1,56 @@
1
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
- import classNames from 'classnames';
3
- import React from 'react';
4
- import { v4 as uuid } from 'uuid';
5
- import Button from '@synerise/ds-button';
6
- import { theme } from '@synerise/ds-core';
7
- import '@synerise/ds-core/dist/js/style';
8
- import Icon, { ChildRowLeftDownM } from '@synerise/ds-icon';
9
- import DSTable from '../Table';
10
- import * as S from './TreeTable.styles';
11
- var INDENT_SIZE = 42;
12
-
13
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import classNames from "classnames";
3
+ import React from "react";
4
+ import { v4 } from "uuid";
5
+ import Button from "@synerise/ds-button";
6
+ import { theme } from "@synerise/ds-core";
7
+ import Icon, { ChildRowLeftDownM } from "@synerise/ds-icon";
8
+ import DSTable from "../Table.js";
9
+ import { TreeTableRow, Indent, TreeTableCell, Indents, RowExpander } from "./TreeTable.styles.js";
10
+ const INDENT_SIZE = 42;
14
11
  function TreeTable(props) {
15
- var className = props.className,
16
- selection = props.selection;
17
-
18
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
19
- var RenderRow = React.useCallback(function (row) {
20
- return /*#__PURE__*/React.createElement(S.TreeTableRow, {
21
- className: row.className + " ds-table-row"
22
- }, row.children);
12
+ const {
13
+ className,
14
+ selection
15
+ } = props;
16
+ const RenderRow = React.useCallback((row) => {
17
+ return /* @__PURE__ */ jsx(TreeTableRow, { className: `${row.className} ds-table-row`, children: row.children });
23
18
  }, []);
24
- var RenderCell = React.useCallback(
25
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
26
- function (cell) {
27
- var _cell$children$;
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) {
29
- return value.includes('indent-level-');
30
- })) == null ? void 0 : _cell$children$.split('-').pop();
31
- if (indentLevel === undefined) {
32
- return /*#__PURE__*/React.createElement("td", {
33
- className: cell.className
34
- }, cell.children);
35
- }
36
- var maxIndent = parseInt(indentLevel, 10);
37
- var indents = [].concat(new Array(maxIndent)).map(function (indentElement, index) {
38
- return /*#__PURE__*/React.createElement(S.Indent, {
39
- key: uuid(),
40
- width: INDENT_SIZE,
41
- level: index,
42
- active: index + 1 === maxIndent
43
- });
44
- });
45
- return /*#__PURE__*/React.createElement(S.TreeTableCell, {
46
- className: cell.className + " ds-table-cell"
47
- }, /*#__PURE__*/React.createElement(S.Indents, {
48
- width: indents.length * INDENT_SIZE,
49
- withSelection: Boolean(selection)
50
- }, indents), cell.children);
51
- }, [selection]);
52
- return /*#__PURE__*/React.createElement(DSTable, _extends({}, props, {
53
- indentSize: INDENT_SIZE,
54
- components: {
55
- body: {
56
- row: RenderRow,
57
- cell: RenderCell
19
+ const RenderCell = React.useCallback(
20
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
21
+ (cell) => {
22
+ const indentLevel = cell.children[0]?.props?.children[0]?.props?.className.split(" ").find((value) => value.includes("indent-level-"))?.split("-").pop();
23
+ if (indentLevel === void 0) {
24
+ return /* @__PURE__ */ jsx("td", { className: cell.className, children: cell.children });
58
25
  }
26
+ const maxIndent = parseInt(indentLevel, 10);
27
+ const indents = [...new Array(maxIndent)].map((indentElement, index) => /* @__PURE__ */ jsx(Indent, { width: INDENT_SIZE, level: index, active: index + 1 === maxIndent }, v4()));
28
+ return /* @__PURE__ */ jsxs(TreeTableCell, { className: `${cell.className} ds-table-cell`, children: [
29
+ /* @__PURE__ */ jsx(Indents, { width: indents.length * INDENT_SIZE, withSelection: Boolean(selection), children: indents }),
30
+ cell.children
31
+ ] });
59
32
  },
60
- expandable: {
61
- expandIconColumnIndex: 0
62
- },
63
- expandIcon: function expandIcon(expandIconProps) {
64
- var expandable = expandIconProps.expandable,
65
- expanded = expandIconProps.expanded,
66
- onExpand = expandIconProps.onExpand,
67
- record = expandIconProps.record;
68
- return expandable ? /*#__PURE__*/React.createElement(S.RowExpander, null, /*#__PURE__*/React.createElement(Button.Expander, {
69
- expanded: expanded,
70
- onClick: function onClick(e) {
71
- return onExpand(record, e);
72
- }
73
- })) : /*#__PURE__*/React.createElement(S.RowExpander, null, /*#__PURE__*/React.createElement(Icon, {
74
- component: /*#__PURE__*/React.createElement(ChildRowLeftDownM, null),
75
- color: theme.palette['grey-400']
76
- }));
77
- },
78
- className: classNames(className, 'ds-tree-table', {
79
- 'ds-tree-table-with-selection': Boolean(selection)
80
- })
81
- }));
33
+ [selection]
34
+ );
35
+ return /* @__PURE__ */ jsx(DSTable, { ...props, indentSize: INDENT_SIZE, components: {
36
+ body: {
37
+ row: RenderRow,
38
+ cell: RenderCell
39
+ }
40
+ }, expandable: {
41
+ expandIconColumnIndex: 0
42
+ }, expandIcon: (expandIconProps) => {
43
+ const {
44
+ expandable,
45
+ expanded,
46
+ onExpand,
47
+ record
48
+ } = expandIconProps;
49
+ return expandable ? /* @__PURE__ */ jsx(RowExpander, { children: /* @__PURE__ */ jsx(Button.Expander, { expanded, onClick: (e) => onExpand(record, e) }) }) : /* @__PURE__ */ jsx(RowExpander, { children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(ChildRowLeftDownM, {}), color: theme.palette["grey-400"] }) });
50
+ }, className: classNames(className, "ds-tree-table", {
51
+ "ds-tree-table-with-selection": Boolean(selection)
52
+ }) });
82
53
  }
83
- export default TreeTable;
54
+ export {
55
+ TreeTable as default
56
+ };
@@ -1,12 +1,12 @@
1
- export declare const Indents: import("styled-components").StyledComponent<"div", any, {
1
+ export declare const Indents: import('styled-components').StyledComponent<"div", any, {
2
2
  width: number;
3
3
  withSelection: boolean;
4
4
  }, never>;
5
- export declare const Indent: import("styled-components").StyledComponent<"span", any, {
5
+ export declare const Indent: import('styled-components').StyledComponent<"span", any, {
6
6
  width: number;
7
7
  active: boolean;
8
8
  level: number;
9
9
  }, never>;
10
- export declare const RowExpander: import("styled-components").StyledComponent<"span", any, {}, never>;
11
- export declare const TreeTableRow: import("styled-components").StyledComponent<"tr", any, {}, never>;
12
- export declare const TreeTableCell: import("styled-components").StyledComponent<"td", any, {}, never>;
10
+ export declare const RowExpander: import('styled-components').StyledComponent<"span", any, {}, never>;
11
+ export declare const TreeTableRow: import('styled-components').StyledComponent<"tr", any, {}, never>;
12
+ export declare const TreeTableCell: import('styled-components').StyledComponent<"td", any, {}, never>;