@semcore/data-table 4.50.2 → 4.51.0-prerelease.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.
Files changed (237) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/lib/cjs/components/AccordionRows/AccordionRows.js +177 -0
  3. package/lib/cjs/components/AccordionRows/AccordionRows.js.map +1 -0
  4. package/lib/cjs/components/Body/Body.js +445 -0
  5. package/lib/cjs/components/Body/Body.js.map +1 -0
  6. package/lib/cjs/components/Body/Body.types.js +2 -0
  7. package/lib/cjs/components/Body/Body.types.js.map +1 -0
  8. package/lib/cjs/components/Body/Cell.js +205 -0
  9. package/lib/cjs/components/Body/Cell.js.map +1 -0
  10. package/lib/cjs/components/Body/Cell.types.js +2 -0
  11. package/lib/cjs/components/Body/Cell.types.js.map +1 -0
  12. package/lib/cjs/components/Body/LimitOverlay.js +191 -0
  13. package/lib/cjs/components/Body/LimitOverlay.js.map +1 -0
  14. package/lib/cjs/components/Body/MergedCells.js +31 -0
  15. package/lib/cjs/components/Body/MergedCells.js.map +1 -0
  16. package/lib/cjs/components/Body/Row.js +630 -0
  17. package/lib/cjs/components/Body/Row.js.map +1 -0
  18. package/lib/cjs/components/Body/Row.types.js +2 -0
  19. package/lib/cjs/components/Body/Row.types.js.map +1 -0
  20. package/lib/cjs/components/Body/RowGroup.js +118 -0
  21. package/lib/cjs/components/Body/RowGroup.js.map +1 -0
  22. package/lib/cjs/components/Body/style.shadow.css +367 -0
  23. package/lib/cjs/components/DataTable/DataTable.js +1303 -0
  24. package/lib/cjs/components/DataTable/DataTable.js.map +1 -0
  25. package/lib/cjs/components/DataTable/DataTable.types.js +2 -0
  26. package/lib/cjs/components/DataTable/DataTable.types.js.map +1 -0
  27. package/lib/cjs/components/DataTable/ScrollBars.js +63 -0
  28. package/lib/cjs/components/DataTable/ScrollBars.js.map +1 -0
  29. package/lib/cjs/components/DataTable/dataTable.shadow.css +43 -0
  30. package/lib/cjs/components/Head/Column.js +350 -0
  31. package/lib/cjs/components/Head/Column.js.map +1 -0
  32. package/lib/cjs/components/Head/Column.types.js +2 -0
  33. package/lib/cjs/components/Head/Column.types.js.map +1 -0
  34. package/lib/cjs/components/Head/Group.js +116 -0
  35. package/lib/cjs/components/Head/Group.js.map +1 -0
  36. package/lib/cjs/components/Head/Group.type.js +2 -0
  37. package/lib/cjs/components/Head/Group.type.js.map +1 -0
  38. package/lib/cjs/components/Head/Head.js +350 -0
  39. package/lib/cjs/components/Head/Head.js.map +1 -0
  40. package/lib/cjs/components/Head/Head.types.js +2 -0
  41. package/lib/cjs/components/Head/Head.types.js.map +1 -0
  42. package/lib/cjs/components/Head/style.shadow.css +292 -0
  43. package/lib/cjs/components/RowSelector/RowsSelector.js +132 -0
  44. package/lib/cjs/components/RowSelector/RowsSelector.js.map +1 -0
  45. package/lib/cjs/components/RowSelector/SRAnnouncer.js +62 -0
  46. package/lib/cjs/components/RowSelector/SRAnnouncer.js.map +1 -0
  47. package/lib/cjs/components/RowSelector/SRReactiveAnnouncer.js +39 -0
  48. package/lib/cjs/components/RowSelector/SRReactiveAnnouncer.js.map +1 -0
  49. package/lib/cjs/enhancers/focusableCell.js +76 -0
  50. package/lib/cjs/enhancers/focusableCell.js.map +1 -0
  51. package/lib/cjs/index.js +38 -15
  52. package/lib/cjs/index.js.map +1 -1
  53. package/lib/cjs/store/SelectableRows.js +211 -0
  54. package/lib/cjs/store/SelectableRows.js.map +1 -0
  55. package/lib/cjs/style/scroll-shadows.shadow.css +50 -5
  56. package/lib/cjs/translations/__intergalactic-dynamic-locales.js +4 -5
  57. package/lib/cjs/translations/__intergalactic-dynamic-locales.js.map +1 -1
  58. package/lib/cjs/translations/de.json +6 -1
  59. package/lib/cjs/translations/en.json +6 -1
  60. package/lib/cjs/translations/es.json +6 -1
  61. package/lib/cjs/translations/fr.json +6 -1
  62. package/lib/cjs/translations/it.json +6 -1
  63. package/lib/cjs/translations/ja.json +6 -1
  64. package/lib/cjs/translations/ko.json +6 -1
  65. package/lib/cjs/translations/nl.json +6 -1
  66. package/lib/cjs/translations/pl.json +6 -1
  67. package/lib/cjs/translations/pt.json +6 -1
  68. package/lib/cjs/translations/sv.json +6 -1
  69. package/lib/cjs/translations/tr.json +6 -1
  70. package/lib/cjs/translations/vi.json +6 -1
  71. package/lib/cjs/translations/zh.json +6 -1
  72. package/lib/es6/components/AccordionRows/AccordionRows.js +171 -0
  73. package/lib/es6/components/AccordionRows/AccordionRows.js.map +1 -0
  74. package/lib/es6/components/Body/Body.js +439 -0
  75. package/lib/es6/components/Body/Body.js.map +1 -0
  76. package/lib/es6/components/Body/Body.types.js +2 -0
  77. package/lib/es6/components/Body/Body.types.js.map +1 -0
  78. package/lib/es6/components/Body/Cell.js +199 -0
  79. package/lib/es6/components/Body/Cell.js.map +1 -0
  80. package/lib/es6/components/Body/Cell.types.js +2 -0
  81. package/lib/es6/components/Body/Cell.types.js.map +1 -0
  82. package/lib/es6/components/Body/LimitOverlay.js +184 -0
  83. package/lib/es6/components/Body/LimitOverlay.js.map +1 -0
  84. package/lib/es6/components/Body/MergedCells.js +24 -0
  85. package/lib/es6/components/Body/MergedCells.js.map +1 -0
  86. package/lib/es6/components/Body/Row.js +624 -0
  87. package/lib/es6/components/Body/Row.js.map +1 -0
  88. package/lib/es6/components/Body/Row.types.js +2 -0
  89. package/lib/es6/components/Body/Row.types.js.map +1 -0
  90. package/lib/es6/components/Body/RowGroup.js +111 -0
  91. package/lib/es6/components/Body/RowGroup.js.map +1 -0
  92. package/lib/es6/components/Body/style.shadow.css +367 -0
  93. package/lib/es6/components/DataTable/DataTable.js +1298 -0
  94. package/lib/es6/components/DataTable/DataTable.js.map +1 -0
  95. package/lib/es6/components/DataTable/DataTable.types.js +2 -0
  96. package/lib/es6/components/DataTable/DataTable.types.js.map +1 -0
  97. package/lib/es6/components/DataTable/ScrollBars.js +57 -0
  98. package/lib/es6/components/DataTable/ScrollBars.js.map +1 -0
  99. package/lib/es6/components/DataTable/dataTable.shadow.css +43 -0
  100. package/lib/es6/components/Head/Column.js +344 -0
  101. package/lib/es6/components/Head/Column.js.map +1 -0
  102. package/lib/es6/components/Head/Column.types.js +2 -0
  103. package/lib/es6/components/Head/Column.types.js.map +1 -0
  104. package/lib/es6/components/Head/Group.js +111 -0
  105. package/lib/es6/components/Head/Group.js.map +1 -0
  106. package/lib/es6/components/Head/Group.type.js +2 -0
  107. package/lib/es6/components/Head/Group.type.js.map +1 -0
  108. package/lib/es6/components/Head/Head.js +345 -0
  109. package/lib/es6/components/Head/Head.js.map +1 -0
  110. package/lib/es6/components/Head/Head.types.js +2 -0
  111. package/lib/es6/components/Head/Head.types.js.map +1 -0
  112. package/lib/es6/components/Head/style.shadow.css +292 -0
  113. package/lib/es6/components/RowSelector/RowsSelector.js +125 -0
  114. package/lib/es6/components/RowSelector/RowsSelector.js.map +1 -0
  115. package/lib/es6/components/RowSelector/SRAnnouncer.js +55 -0
  116. package/lib/es6/components/RowSelector/SRAnnouncer.js.map +1 -0
  117. package/lib/es6/components/RowSelector/SRReactiveAnnouncer.js +32 -0
  118. package/lib/es6/components/RowSelector/SRReactiveAnnouncer.js.map +1 -0
  119. package/lib/es6/enhancers/focusableCell.js +69 -0
  120. package/lib/es6/enhancers/focusableCell.js.map +1 -0
  121. package/lib/es6/index.js +7 -2
  122. package/lib/es6/index.js.map +1 -1
  123. package/lib/es6/store/SelectableRows.js +204 -0
  124. package/lib/es6/store/SelectableRows.js.map +1 -0
  125. package/lib/es6/style/scroll-shadows.shadow.css +50 -5
  126. package/lib/es6/translations/__intergalactic-dynamic-locales.js +2 -2
  127. package/lib/es6/translations/__intergalactic-dynamic-locales.js.map +1 -1
  128. package/lib/es6/translations/de.json +6 -1
  129. package/lib/es6/translations/en.json +6 -1
  130. package/lib/es6/translations/es.json +6 -1
  131. package/lib/es6/translations/fr.json +6 -1
  132. package/lib/es6/translations/it.json +6 -1
  133. package/lib/es6/translations/ja.json +6 -1
  134. package/lib/es6/translations/ko.json +6 -1
  135. package/lib/es6/translations/nl.json +6 -1
  136. package/lib/es6/translations/pl.json +6 -1
  137. package/lib/es6/translations/pt.json +6 -1
  138. package/lib/es6/translations/sv.json +6 -1
  139. package/lib/es6/translations/tr.json +6 -1
  140. package/lib/es6/translations/vi.json +6 -1
  141. package/lib/es6/translations/zh.json +6 -1
  142. package/lib/esm/components/AccordionRows/AccordionRows.mjs +155 -0
  143. package/lib/esm/components/Body/Body.mjs +395 -0
  144. package/lib/esm/components/Body/Cell.mjs +192 -0
  145. package/lib/esm/components/Body/LimitOverlay.mjs +179 -0
  146. package/lib/esm/components/Body/MergedCells.mjs +27 -0
  147. package/lib/esm/components/Body/Row.mjs +556 -0
  148. package/lib/esm/components/Body/RowGroup.mjs +113 -0
  149. package/lib/esm/components/Body/style.shadow.css +367 -0
  150. package/lib/esm/components/DataTable/DataTable.mjs +1216 -0
  151. package/lib/esm/components/DataTable/ScrollBars.mjs +61 -0
  152. package/lib/esm/components/DataTable/dataTable.shadow.css +43 -0
  153. package/lib/esm/components/Head/Column.mjs +321 -0
  154. package/lib/esm/components/Head/Group.mjs +111 -0
  155. package/lib/esm/components/Head/Head.mjs +307 -0
  156. package/lib/esm/components/Head/style.shadow.css +292 -0
  157. package/lib/esm/components/RowSelector/RowsSelector.mjs +105 -0
  158. package/lib/esm/components/RowSelector/SRAnnouncer.mjs +51 -0
  159. package/lib/esm/components/RowSelector/SRReactiveAnnouncer.mjs +31 -0
  160. package/lib/esm/enhancers/focusableCell.mjs +72 -0
  161. package/lib/esm/index.mjs +12 -5
  162. package/lib/esm/store/SelectableRows.mjs +201 -0
  163. package/lib/esm/style/scroll-shadows.shadow.css +50 -5
  164. package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +2 -2
  165. package/lib/esm/translations/de.json.mjs +6 -1
  166. package/lib/esm/translations/en.json.mjs +6 -1
  167. package/lib/esm/translations/es.json.mjs +6 -1
  168. package/lib/esm/translations/fr.json.mjs +6 -1
  169. package/lib/esm/translations/it.json.mjs +6 -1
  170. package/lib/esm/translations/ja.json.mjs +6 -1
  171. package/lib/esm/translations/ko.json.mjs +6 -1
  172. package/lib/esm/translations/nl.json.mjs +6 -1
  173. package/lib/esm/translations/pl.json.mjs +6 -1
  174. package/lib/esm/translations/pt.json.mjs +6 -1
  175. package/lib/esm/translations/sv.json.mjs +6 -1
  176. package/lib/esm/translations/tr.json.mjs +6 -1
  177. package/lib/esm/translations/vi.json.mjs +6 -1
  178. package/lib/esm/translations/zh.json.mjs +6 -1
  179. package/lib/types/components/AccordionRows/AccordionRows.d.ts +41 -0
  180. package/lib/types/components/Body/Body.d.ts +6 -0
  181. package/lib/types/components/Body/Body.types.d.ts +87 -0
  182. package/lib/types/components/Body/Cell.d.ts +1 -0
  183. package/lib/types/components/Body/Cell.types.d.ts +36 -0
  184. package/lib/types/components/Body/LimitOverlay.d.ts +17 -0
  185. package/lib/types/components/Body/MergedCells.d.ts +17 -0
  186. package/lib/types/components/Body/Row.d.ts +47 -0
  187. package/lib/types/components/Body/Row.types.d.ts +74 -0
  188. package/lib/types/components/Body/RowGroup.d.ts +19 -0
  189. package/lib/types/components/DataTable/DataTable.d.ts +14 -0
  190. package/lib/types/components/DataTable/DataTable.types.d.ts +202 -0
  191. package/lib/types/components/DataTable/ScrollBars.d.ts +11 -0
  192. package/lib/types/components/Head/Column.d.ts +39 -0
  193. package/lib/types/components/Head/Column.types.d.ts +85 -0
  194. package/lib/types/components/Head/Group.d.ts +15 -0
  195. package/lib/types/components/Head/Group.type.d.ts +18 -0
  196. package/lib/types/components/Head/Head.d.ts +9 -0
  197. package/lib/types/components/Head/Head.types.d.ts +58 -0
  198. package/lib/types/components/RowSelector/RowsSelector.d.ts +32 -0
  199. package/lib/types/components/RowSelector/SRAnnouncer.d.ts +10 -0
  200. package/lib/types/components/RowSelector/SRReactiveAnnouncer.d.ts +8 -0
  201. package/lib/types/enhancers/focusableCell.d.ts +9 -0
  202. package/lib/types/index.d.ts +10 -2
  203. package/lib/types/store/SelectableRows.d.ts +60 -0
  204. package/lib/types/translations/__intergalactic-dynamic-locales.d.ts +70 -0
  205. package/package.json +6 -6
  206. package/lib/cjs/Body.js +0 -477
  207. package/lib/cjs/Body.js.map +0 -1
  208. package/lib/cjs/DataTable.js +0 -629
  209. package/lib/cjs/DataTable.js.map +0 -1
  210. package/lib/cjs/Head.js +0 -398
  211. package/lib/cjs/Head.js.map +0 -1
  212. package/lib/cjs/style/data-table.shadow.css +0 -413
  213. package/lib/cjs/types.js +0 -4
  214. package/lib/cjs/types.js.map +0 -1
  215. package/lib/cjs/utils.js +0 -57
  216. package/lib/cjs/utils.js.map +0 -1
  217. package/lib/es6/Body.js +0 -469
  218. package/lib/es6/Body.js.map +0 -1
  219. package/lib/es6/DataTable.js +0 -619
  220. package/lib/es6/DataTable.js.map +0 -1
  221. package/lib/es6/Head.js +0 -390
  222. package/lib/es6/Head.js.map +0 -1
  223. package/lib/es6/style/data-table.shadow.css +0 -413
  224. package/lib/es6/types.js +0 -2
  225. package/lib/es6/types.js.map +0 -1
  226. package/lib/es6/utils.js +0 -48
  227. package/lib/es6/utils.js.map +0 -1
  228. package/lib/esm/Body.mjs +0 -430
  229. package/lib/esm/DataTable.mjs +0 -589
  230. package/lib/esm/Head.mjs +0 -368
  231. package/lib/esm/style/data-table.shadow.css +0 -413
  232. package/lib/esm/utils.mjs +0 -52
  233. package/lib/types/Body.d.ts +0 -61
  234. package/lib/types/DataTable.d.ts +0 -205
  235. package/lib/types/Head.d.ts +0 -45
  236. package/lib/types/types.d.ts +0 -73
  237. package/lib/types/utils.d.ts +0 -4
@@ -0,0 +1,1298 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
4
+ import _createForOfIteratorHelper from "@babel/runtime/helpers/createForOfIteratorHelper";
5
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
6
+ import _createClass from "@babel/runtime/helpers/createClass";
7
+ import _callSuper from "@babel/runtime/helpers/callSuper";
8
+ import _inherits from "@babel/runtime/helpers/inherits";
9
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
10
+ import { sstyled as _sstyled2 } from "@semcore/core";
11
+ import { sstyled as _sstyled } from "@semcore/core";
12
+ import { assignProps as _assignProps } from "@semcore/core";
13
+ import { Box, ScrollArea } from '@semcore/base-components';
14
+ import { Component, createComponent, lastInteraction, Root, sstyled } from '@semcore/core';
15
+ import canUseDOM from '@semcore/core/lib/utils/canUseDOM';
16
+ import i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';
17
+ import { hasParent } from '@semcore/core/lib/utils/hasParent';
18
+ import trottle from '@semcore/core/lib/utils/rafTrottle';
19
+ import { forkRef } from '@semcore/core/lib/utils/ref';
20
+ import uniqueIDEnhancement from '@semcore/core/lib/utils/uniqueID';
21
+ import { isFocusInside, hasFocusableIn } from '@semcore/core/lib/utils/use/useFocusLock';
22
+ import { NoData } from '@semcore/widget-empty';
23
+ import * as React from 'react';
24
+ /*!__reshadow-styles__:"./dataTable.shadow.css"*/
25
+ var style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/"@keyframes moveBarWithScroll_pypp4{0%{transform:translateY(0)}to{transform:translateY(calc(var(--global-scroll-to) - var(--global-header-height)))}}.___SDataTable_pypp4_gg_{display:grid;align-items:start;min-width:-moz-fit-content;min-width:fit-content;grid-auto-rows:min-content;scroll-behavior:smooth}.___SDataTable_pypp4_gg_.__isDataEmpty_pypp4_gg_{display:block;align-items:initial;min-width:initial}.___SDataTable_pypp4_gg_.__gridTemplateColumns_pypp4_gg_{grid-template-columns:var(--gridTemplateColumns_pypp4)}.___SDataTable_pypp4_gg_.__gridTemplateAreas_pypp4_gg_{grid-template-areas:var(--gridTemplateAreas_pypp4)}.___SDataTable_pypp4_gg_.__gridTemplateRows_pypp4_gg_{grid-template-rows:var(--gridTemplateRows_pypp4)}.___SScrollAreaBarInHeader_pypp4_gg_.__withAnimation_pypp4_gg_{animation-name:moveBarWithScroll_pypp4;animation-timeline:--table-sticky-timeline;animation-range-start:exit-crossing calc(-1*var(--global-header-top));animation-range-end:exit-crossing calc(100% - var(--global-header-top) - var(--global-header-height));animation-timing-function:linear;animation-fill-mode:both}", /*__inner_css_end__*/"pypp4_gg_"),
26
+ /*__reshadow_css_end__*/
27
+ {
28
+ "__SDataTable": "___SDataTable_pypp4_gg_",
29
+ "_isDataEmpty": "__isDataEmpty_pypp4_gg_",
30
+ "_gridTemplateColumns": "__gridTemplateColumns_pypp4_gg_",
31
+ "--gridTemplateColumns": "--gridTemplateColumns_pypp4",
32
+ "_gridTemplateAreas": "__gridTemplateAreas_pypp4_gg_",
33
+ "--gridTemplateAreas": "--gridTemplateAreas_pypp4",
34
+ "_gridTemplateRows": "__gridTemplateRows_pypp4_gg_",
35
+ "--gridTemplateRows": "--gridTemplateRows_pypp4",
36
+ "__SScrollAreaBarInHeader": "___SScrollAreaBarInHeader_pypp4_gg_",
37
+ "_withAnimation": "__withAnimation_pypp4_gg_",
38
+ "@moveBarWithScroll": "moveBarWithScroll_pypp4"
39
+ });
40
+ import { ScrollBars } from './ScrollBars';
41
+ import { SelectableRows } from '../../store/SelectableRows';
42
+ /*!__reshadow-styles__:"../../style/scroll-shadows.shadow.css"*/
43
+ var scrollStyles = (/*__reshadow_css_start__*/_sstyled2.insert(/*__inner_css_start__*/".___SScrollArea_1aftg_gg_{width:-moz-fit-content;width:fit-content;view-timeline:--table-sticky-timeline block}.___SScrollArea_1aftg_gg_ .___SContainer_1aftg_gg_{overflow:visible;overflow:initial}.___SScrollArea_1aftg_gg_ .___SContainer_1aftg_gg_._scrollDirection_both_1aftg_gg_{overflow:auto}.___SScrollArea_1aftg_gg_ .___SContainer_1aftg_gg_._scrollDirection_both_1aftg_gg_.__loading_1aftg_gg_,.___SScrollArea_1aftg_gg_ .___SContainer_1aftg_gg_._scrollDirection_horizontal_1aftg_gg_.__loading_1aftg_gg_,.___SScrollArea_1aftg_gg_ .___SContainer_1aftg_gg_._scrollDirection_vertical_1aftg_gg_.__loading_1aftg_gg_{overflow:hidden}.___SScrollArea_1aftg_gg_ .___SContainer_1aftg_gg_._scrollDirection_horizontal_1aftg_gg_{overflow-x:auto;overflow-y:initial}.___SScrollArea_1aftg_gg_ .___SContainer_1aftg_gg_._scrollDirection_vertical_1aftg_gg_{overflow-x:initial;overflow-y:auto}.___SScrollArea_1aftg_gg_ .___SContainer_1aftg_gg_.__headerHeight_1aftg_gg_{scroll-padding-top:var(--headerHeight_1aftg)}.___SScrollArea_1aftg_gg_ .___SContainer_1aftg_gg_.__leftScrollPadding_1aftg_gg_{scroll-padding-left:var(--leftScrollPadding_1aftg)}.___SScrollArea_1aftg_gg_ .___SContainer_1aftg_gg_.__rightScrollPadding_1aftg_gg_{scroll-padding-right:var(--rightScrollPadding_1aftg)}.___SScrollArea_1aftg_gg_ .___SShadowHorizontal_1aftg_gg_::before,.___SScrollArea_1aftg_gg_ .___SShadowHorizontal_1aftg_gg_:after,.___SScrollArea_1aftg_gg_ .___SShadowVertical_1aftg_gg_::after{z-index:20}.___SScrollArea_1aftg_gg_ .___SShadowHorizontal_1aftg_gg_.__leftOffset_1aftg_gg_::before,.___SScrollArea_1aftg_gg_ .___SShadowHorizontal_1aftg_gg_.__rightOffset_1aftg_gg_::after,.___SScrollArea_1aftg_gg_ .___SShadowVertical_1aftg_gg_::before{display:none}", /*__inner_css_end__*/"1aftg_gg_"),
44
+ /*__reshadow_css_end__*/
45
+ {
46
+ "__SScrollArea": "___SScrollArea_1aftg_gg_",
47
+ "__SContainer": "___SContainer_1aftg_gg_",
48
+ "_scrollDirection_both": "_scrollDirection_both_1aftg_gg_",
49
+ "_loading": "__loading_1aftg_gg_",
50
+ "_scrollDirection_horizontal": "_scrollDirection_horizontal_1aftg_gg_",
51
+ "_scrollDirection_vertical": "_scrollDirection_vertical_1aftg_gg_",
52
+ "_headerHeight": "__headerHeight_1aftg_gg_",
53
+ "--headerHeight": "--headerHeight_1aftg",
54
+ "_leftScrollPadding": "__leftScrollPadding_1aftg_gg_",
55
+ "--leftScrollPadding": "--leftScrollPadding_1aftg",
56
+ "_rightScrollPadding": "__rightScrollPadding_1aftg_gg_",
57
+ "--rightScrollPadding": "--rightScrollPadding_1aftg",
58
+ "__SShadowVertical": "___SShadowVertical_1aftg_gg_",
59
+ "__SShadowHorizontal": "___SShadowHorizontal_1aftg_gg_",
60
+ "_leftOffset": "__leftOffset_1aftg_gg_",
61
+ "_rightOffset": "__rightOffset_1aftg_gg_"
62
+ });
63
+ import { localizedMessages } from '../../translations/__intergalactic-dynamic-locales';
64
+ import { Body } from '../Body/Body';
65
+ import { MergedColumnsCell, MergedRowsCell } from '../Body/MergedCells';
66
+ import { Head } from '../Head/Head';
67
+ import { SRAnnouncer } from '../RowSelector/SRAnnouncer';
68
+ import { SRReactiveAnnouncer } from '../RowSelector/SRReactiveAnnouncer';
69
+ export var ACCORDION = Symbol('accordion');
70
+ export var ROW_GROUP = Symbol('ROW_GROUP');
71
+ export var UNIQ_ROW_KEY = Symbol('UNIQ_ROW_KEY');
72
+ export var IS_EMPTY_DATA_ROW = Symbol('IS_EMPTY_DATA_ROW');
73
+ export var SELECT_ALL = 'SELECT_ALL_ROWS';
74
+ export var ROW_INDEX = Symbol('ROW_INDEX');
75
+ export var GRID_ROW_INDEX = Symbol('GRID_ROW_INDEX');
76
+ var DataTableRoot = /*#__PURE__*/function (_Component) {
77
+ function DataTableRoot(props) {
78
+ var _this;
79
+ _classCallCheck(this, DataTableRoot);
80
+ _this = _callSuper(this, DataTableRoot, [props]);
81
+ _defineProperty(_this, "columns", []);
82
+ _defineProperty(_this, "treeColumns", []);
83
+ _defineProperty(_this, "hasGroups", false);
84
+ _defineProperty(_this, "hasFixedColumn", false);
85
+ _defineProperty(_this, "focusedCell", [-1, -1]);
86
+ _defineProperty(_this, "scrollAreaRef", /*#__PURE__*/React.createRef());
87
+ _defineProperty(_this, "tableContainerRef", /*#__PURE__*/React.createRef());
88
+ _defineProperty(_this, "tableRef", /*#__PURE__*/React.createRef());
89
+ _defineProperty(_this, "headerRef", /*#__PURE__*/React.createRef());
90
+ _defineProperty(_this, "spinnerRef", /*#__PURE__*/React.createRef());
91
+ _defineProperty(_this, "containerResizeEndTimeoutId", null);
92
+ _defineProperty(_this, "gridAreaGroupMap", new Map());
93
+ _defineProperty(_this, "columnsSplitter", '/');
94
+ _defineProperty(_this, "tmpData", void 0);
95
+ _defineProperty(_this, "calculatedRows", void 0);
96
+ _defineProperty(_this, "flatRows", void 0);
97
+ _defineProperty(_this, "gridSettings", {
98
+ gridTemplateColumns: [],
99
+ gridTemplateAreas: []
100
+ });
101
+ _defineProperty(_this, "headerNodesMap", new Map());
102
+ _defineProperty(_this, "selectedRowsContainer", void 0);
103
+ _defineProperty(_this, "lastSelectedRowKey", void 0);
104
+ _defineProperty(_this, "state", {
105
+ scrollTop: 0,
106
+ scrollDirection: 'down',
107
+ selectAllMessage: '',
108
+ shadowVertical: '',
109
+ expandedRows: new Set()
110
+ });
111
+ _defineProperty(_this, "handleDocumentScroll", trottle(function () {
112
+ var _headerProps$top, _this$scrollAreaRef$c;
113
+ var tableContainer = _this.tableContainerRef.current;
114
+ if (!tableContainer) return;
115
+ var tableRect = tableContainer.getBoundingClientRect();
116
+ var tableContainerTop = tableRect.top;
117
+ var headerProps = _this.asProps.headerProps;
118
+ var headerContainer = _this.headerRef.current;
119
+ var top = tableContainerTop - ((_headerProps$top = headerProps === null || headerProps === void 0 ? void 0 : headerProps.top) !== null && _headerProps$top !== void 0 ? _headerProps$top : 0);
120
+ var headerScrollBar = headerProps !== null && headerProps !== void 0 && headerProps.withScrollBar ? (_this$scrollAreaRef$c = _this.scrollAreaRef.current) === null || _this$scrollAreaRef$c === void 0 ? void 0 : _this$scrollAreaRef$c.querySelector("[role=scrollbar][aria-orientation=horizontal]") : undefined;
121
+ if (top && top < 0 && Math.abs(top) <= tableContainer.clientHeight) {
122
+ var translate = "translateY(".concat(Math.abs(top), "px)");
123
+ if (tableRect.bottom <= _this.getHeaderHeight()) {
124
+ translate = "translateY(".concat(Math.abs(top) - _this.getHeaderHeight() - tableRect.bottom, "px)");
125
+ }
126
+ if (headerContainer instanceof HTMLElement) {
127
+ headerContainer.style.setProperty('--global-scroll-translate', "".concat(Math.abs(top), "px"));
128
+ }
129
+ if (headerScrollBar instanceof HTMLElement) {
130
+ headerScrollBar.style.setProperty('transform', translate);
131
+ }
132
+ } else {
133
+ if (headerContainer instanceof HTMLElement) {
134
+ headerContainer.style.removeProperty('--global-scroll-translate');
135
+ }
136
+ if (headerScrollBar instanceof HTMLElement) {
137
+ headerScrollBar.style.removeProperty('transform');
138
+ }
139
+ }
140
+ }));
141
+ _defineProperty(_this, "handleCellClick", function (e, opt) {
142
+ if (lastInteraction.isMouse()) {
143
+ _this.initFocusableCell([_this.hasFocusableInHeader() ? opt.rowIndex + 1 : opt.rowIndex, opt.colIndex]);
144
+ }
145
+ });
146
+ _defineProperty(_this, "handleSelectAllRows", function (selectedRows, event) {
147
+ if (!('onSelectedRowsChange' in _this.asProps) || !_this.asProps.onSelectedRowsChange || !Array.isArray(selectedRows)) return;
148
+ _this.asProps.onSelectedRowsChange(selectedRows, event);
149
+ });
150
+ _defineProperty(_this, "handleSelectRow", function (isSelected, selectedRowIndex, row, event) {
151
+ var selectedRows = _this.asProps.selectedRows;
152
+ if (!selectedRows || !('onSelectedRowsChange' in _this.asProps) || !_this.asProps.onSelectedRowsChange || !Array.isArray(selectedRows)) return;
153
+ var onSelectedRowsChange = _this.asProps.onSelectedRowsChange;
154
+ var selectedRowsSet = new Set(selectedRows);
155
+ if (_this.selectedRowsContainer.isPressedShift && selectedRowsSet.size > 0 && _this.lastSelectedRowKey && (isSelected ? selectedRowsSet.has(_this.lastSelectedRowKey) : true)) {
156
+ var select = false;
157
+ var firstColumnKey = _this.columns[0].name;
158
+ var isMerged = _this.flatRows.some(function (item) {
159
+ return item[firstColumnKey] instanceof MergedRowsCell;
160
+ });
161
+ var _iterator = _createForOfIteratorHelper(_this.flatRows),
162
+ _step;
163
+ try {
164
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
165
+ var item = _step.value;
166
+ if (isMerged && !item[firstColumnKey]) continue;
167
+ if (!select && (item[UNIQ_ROW_KEY] === row[UNIQ_ROW_KEY] || item[UNIQ_ROW_KEY] === _this.lastSelectedRowKey)) {
168
+ select = true;
169
+ if (isSelected) {
170
+ selectedRowsSet.add(item[UNIQ_ROW_KEY]);
171
+ } else {
172
+ selectedRowsSet["delete"](item[UNIQ_ROW_KEY]);
173
+ }
174
+ continue;
175
+ }
176
+ if (select) {
177
+ if (isSelected) {
178
+ selectedRowsSet.add(item[UNIQ_ROW_KEY]);
179
+ } else {
180
+ selectedRowsSet["delete"](item[UNIQ_ROW_KEY]);
181
+ }
182
+ }
183
+ if (select && (item[UNIQ_ROW_KEY] === row[UNIQ_ROW_KEY] || item[UNIQ_ROW_KEY] === _this.lastSelectedRowKey)) {
184
+ break;
185
+ }
186
+ }
187
+ } catch (err) {
188
+ _iterator.e(err);
189
+ } finally {
190
+ _iterator.f();
191
+ }
192
+ } else {
193
+ if (selectedRowsSet.has(row[UNIQ_ROW_KEY])) {
194
+ selectedRowsSet["delete"](row[UNIQ_ROW_KEY]);
195
+ } else {
196
+ selectedRowsSet.add(row[UNIQ_ROW_KEY]);
197
+ }
198
+ }
199
+ _this.lastSelectedRowKey = row[UNIQ_ROW_KEY];
200
+ onSelectedRowsChange(Array.from(selectedRowsSet), event, {
201
+ selectedRowIndex: selectedRowIndex,
202
+ isSelected: isSelected,
203
+ row: row
204
+ });
205
+ });
206
+ _defineProperty(_this, "getRow", function (index) {
207
+ var _this$tableRef$curren;
208
+ return (_this$tableRef$curren = _this.tableRef.current) === null || _this$tableRef$curren === void 0 ? void 0 : _this$tableRef$curren.querySelector(":scope [aria-rowindex=\"".concat(index + 1, "\"]:not([aria-hidden=\"true\"]):not(:scope [data-ui-name=\"DataTable\"] [aria-rowindex=\"").concat(index + 1, "\"]:not([aria-hidden=\"true\"])"));
209
+ });
210
+ _defineProperty(_this, "hasFocusableInHeader", function () {
211
+ return _this.headerRef.current && hasFocusableIn(_this.headerRef.current) || _this.columns.some(function (column) {
212
+ return column.sortable;
213
+ });
214
+ });
215
+ _defineProperty(_this, "onExpandRow", function (expandedRow) {
216
+ var _this$asProps = _this.asProps,
217
+ onAccordionToggle = _this$asProps.onAccordionToggle,
218
+ accordionMode = _this$asProps.accordionMode;
219
+ var expandedRows = _this.state.expandedRows;
220
+ if (expandedRows.has(expandedRow[UNIQ_ROW_KEY])) {
221
+ expandedRows["delete"](expandedRow[UNIQ_ROW_KEY]);
222
+ onAccordionToggle === null || onAccordionToggle === void 0 || onAccordionToggle('close', expandedRow[UNIQ_ROW_KEY], expandedRow[ROW_INDEX]);
223
+ } else {
224
+ expandedRows.add(expandedRow[UNIQ_ROW_KEY]);
225
+ onAccordionToggle === null || onAccordionToggle === void 0 || onAccordionToggle('open', expandedRow[UNIQ_ROW_KEY], expandedRow[ROW_INDEX]);
226
+ if (accordionMode === 'toggle') {
227
+ var rowIndex = expandedRow[ROW_INDEX];
228
+ var colIndex = _this.focusedCell[1];
229
+ _this.initFocusableCell([_this.hasFocusableInHeader() ? rowIndex + 1 : rowIndex, colIndex]);
230
+ }
231
+ }
232
+ });
233
+ _defineProperty(_this, "changeFocusCell", function (rowIndex, colIndex, direction) {
234
+ var _this$tableRef$curren2, _this$tableRef$curren3;
235
+ var limit = _this.asProps.limit;
236
+ var hasFocusable = _this.hasFocusableInHeader();
237
+ var maxCol = _this.columns.length - 1;
238
+ var maxRow = _this.totalRows || 1;
239
+ var currentRow = (_this$tableRef$curren2 = _this.tableRef.current) === null || _this$tableRef$curren2 === void 0 ? void 0 : _this$tableRef$curren2.querySelector("[aria-rowindex=\"".concat(_this.focusedCell[0] + 1, "\"]"));
240
+ var headerCells = (_this$tableRef$curren3 = _this.tableRef.current) === null || _this$tableRef$curren3 === void 0 ? void 0 : _this$tableRef$curren3.querySelectorAll('[role=columnheader]');
241
+ var currentCell = currentRow === null || currentRow === void 0 ? void 0 : currentRow.querySelector("[role=gridcell][aria-colindex='".concat(_this.focusedCell[1] + 1, "']"));
242
+ var currentHeaderCell = headerCells === null || headerCells === void 0 ? void 0 : headerCells.item(_this.focusedCell[1]);
243
+ var changed = true;
244
+ var newRow = _this.focusedCell[0] + rowIndex;
245
+ var newCol = _this.focusedCell[1] + colIndex;
246
+ if ((hasFocusable && newRow < 0 || !hasFocusable && newRow < 1 || newRow > maxRow) && newRow !== _this.focusedCell[0]) {
247
+ changed = false;
248
+ }
249
+ if ((newCol < 0 || newCol > maxCol) && newCol !== _this.focusedCell[1]) {
250
+ changed = false;
251
+ }
252
+ if (!changed) return;
253
+ var row = _this.getRow(newRow);
254
+ var cell = row === null || row === void 0 ? void 0 : row.querySelector(":scope > div > [role=gridcell][aria-colindex=\"".concat(newCol + 1, "\"]:not([aria-hidden=\"true\"]), :scope > [role=columnheader][aria-colindex=\"").concat(newCol + 1, "\"]:not([aria-hidden=\"true\"]), :scope > div > [role=columnheader][aria-colindex=\"").concat(newCol + 1, "\"]:not([aria-hidden=\"true\"])"));
255
+ if (cell instanceof HTMLElement && currentCell !== cell) {
256
+ _this.focusedCell = [newRow, newCol];
257
+ currentCell === null || currentCell === void 0 || currentCell.setAttribute('inert', '');
258
+ if (currentCell !== currentHeaderCell) {
259
+ currentCell === null || currentCell === void 0 || currentCell.removeAttribute('aria-describedby');
260
+ }
261
+ var headerCell = headerCells === null || headerCells === void 0 ? void 0 : headerCells.item(newCol);
262
+ var describedBy = headerCell === null || headerCell === void 0 ? void 0 : headerCell.getAttribute('aria-describedby');
263
+ cell.removeAttribute('inert');
264
+ if (headerCell !== cell && describedBy) {
265
+ cell.setAttribute('aria-describedby', describedBy);
266
+ }
267
+ cell === null || cell === void 0 || cell.focus({
268
+ focusVisible: true
269
+ });
270
+ if (newRow !== 0) {
271
+ currentHeaderCell === null || currentHeaderCell === void 0 || currentHeaderCell.setAttribute('inert', '');
272
+ var _headerCell = headerCells === null || headerCells === void 0 ? void 0 : headerCells.item(newCol);
273
+ _headerCell === null || _headerCell === void 0 || _headerCell.removeAttribute('inert');
274
+ }
275
+ } else if (cell === null && currentCell instanceof HTMLElement) {
276
+ var rowI = rowIndex;
277
+ var colI = colIndex;
278
+ var colspan = Number(currentCell.getAttribute('aria-colspan'));
279
+ var rowspan = Number(currentCell.getAttribute('aria-rowspan'));
280
+ if (direction === 'left' || direction === 'right') {
281
+ var _currentCell$parentEl;
282
+ // we need to skip Collapse Element with one big component from keyboard left/right pressing
283
+ if (((_currentCell$parentEl = currentCell.parentElement) === null || _currentCell$parentEl === void 0 || (_currentCell$parentEl = _currentCell$parentEl.parentElement) === null || _currentCell$parentEl === void 0 ? void 0 : _currentCell$parentEl.dataset.uiName) === 'Collapse') {
284
+ return;
285
+ }
286
+ // skipping x-axis movement of the focus within limit overlay and there is only limit by rows
287
+ if ((limit === null || limit === void 0 ? void 0 : limit.fromRow) !== undefined && limit.fromColumn === undefined && newCol === limit.fromRow) {
288
+ return;
289
+ }
290
+ var hasRowSpanUpper = row instanceof HTMLElement && Number(row.dataset.filledColumns) < _this.columns.length;
291
+ if (colspan > 0) {
292
+ if (direction === 'right' && (limit === null || limit === void 0 ? void 0 : limit.fromColumn) !== undefined && newCol === limit.fromColumn) {
293
+ rowI = rowI - 1;
294
+ } else {
295
+ colI = direction === 'left' ? colI - colspan + 1 : colI + colspan - 1;
296
+ }
297
+ } else if (hasRowSpanUpper || direction === 'right' && ((limit === null || limit === void 0 ? void 0 : limit.fromColumn) !== undefined || (limit === null || limit === void 0 ? void 0 : limit.fromRow) !== undefined)) {
298
+ rowI = rowI - 1;
299
+ } else {
300
+ colI = direction === 'left' ? colI - 1 : colI + 1;
301
+ }
302
+ } else if (direction === 'up' || direction === 'down') {
303
+ // top/bottom
304
+ if (rowspan > 0) {
305
+ rowI = direction === 'up' ? rowI - rowspan + 1 : rowI + rowspan - 1;
306
+ } else if (Number(currentCell.getAttribute('aria-colindex')) === 1) {
307
+ rowI = direction === 'up' ? rowI - 1 : rowI + 1;
308
+ } else {
309
+ var _limit$fromRow;
310
+ var areLimitsDefined = (limit === null || limit === void 0 ? void 0 : limit.fromRow) !== undefined || (limit === null || limit === void 0 ? void 0 : limit.fromColumn) !== undefined;
311
+ if (areLimitsDefined && newRow > ((_limit$fromRow = limit === null || limit === void 0 ? void 0 : limit.fromRow) !== null && _limit$fromRow !== void 0 ? _limit$fromRow : 0) + 1) {
312
+ return;
313
+ }
314
+ var _hasRowSpanUpper = row instanceof HTMLElement && currentRow instanceof HTMLElement && row.dataset.filledColumns !== currentRow.dataset.filledColumns;
315
+ if (direction === 'up' && _hasRowSpanUpper) {
316
+ rowI = rowI - 1;
317
+ } else {
318
+ colI = colI - 1;
319
+ }
320
+ }
321
+ }
322
+ _this.changeFocusCell(rowI, colI, direction);
323
+ } else if (cell === null && currentHeaderCell instanceof HTMLElement && direction === 'down') {
324
+ var _colI = colIndex - 1;
325
+ _this.changeFocusCell(rowIndex, _colI, direction);
326
+ } else if (row === null && _this.focusedCell[0] === 0 && direction === 'down' && _this.asProps.virtualScroll) {
327
+ _this.changeFocusCell(rowIndex + 1, colIndex, direction);
328
+ }
329
+ });
330
+ _defineProperty(_this, "handleKeyDown", function (e) {
331
+ switch (e.key) {
332
+ case 'Tab':
333
+ {
334
+ _this.setInert(true);
335
+ break;
336
+ }
337
+ case 'ArrowLeft':
338
+ {
339
+ e.preventDefault();
340
+ _this.changeFocusCell(0, -1, 'left');
341
+ break;
342
+ }
343
+ case 'ArrowRight':
344
+ {
345
+ e.preventDefault();
346
+ _this.changeFocusCell(0, 1, 'right');
347
+ break;
348
+ }
349
+ case 'ArrowUp':
350
+ {
351
+ e.preventDefault();
352
+ _this.changeFocusCell(-1, 0, 'up');
353
+ break;
354
+ }
355
+ case 'ArrowDown':
356
+ {
357
+ e.preventDefault();
358
+ _this.changeFocusCell(1, 0, 'down');
359
+ break;
360
+ }
361
+ case 'Shift':
362
+ {
363
+ _this.selectedRowsContainer.isPressedShift = true;
364
+ }
365
+ }
366
+ });
367
+ _defineProperty(_this, "handleKeyUp", function (e) {
368
+ if (e.key === 'Shift') {
369
+ _this.selectedRowsContainer.isPressedShift = false;
370
+ }
371
+ });
372
+ _defineProperty(_this, "handleScroll", trottle(function (e) {
373
+ if (_this.asProps.virtualScroll) {
374
+ var scrollTop = e.target.scrollTop;
375
+ var scrollDirection = scrollTop > _this.state.scrollTop ? 'down' : 'up';
376
+ _this.setState({
377
+ scrollTop: scrollTop,
378
+ scrollDirection: scrollDirection
379
+ });
380
+ }
381
+ if (_this.hasFixedColumn) {
382
+ _this.calculateVerticalShadow();
383
+ }
384
+ }));
385
+ _defineProperty(_this, "calculateVerticalShadow", function () {
386
+ if (!_this.tableContainerRef.current) return;
387
+ var _this$tableContainerR = _this.tableContainerRef.current,
388
+ scrollWidth = _this$tableContainerR.scrollWidth,
389
+ clientWidth = _this$tableContainerR.clientWidth,
390
+ scrollLeft = _this$tableContainerR.scrollLeft;
391
+ var maxScrollRight = scrollWidth - clientWidth;
392
+ var roundedScroll = Math.round(scrollLeft);
393
+ var roundedMaxScroll = Math.round(maxScrollRight);
394
+ var shadow = '';
395
+ // not scroll
396
+ if (roundedMaxScroll <= 0) {
397
+ // start scroll
398
+ } else if (roundedScroll <= 0) {
399
+ shadow = 'end';
400
+ // end scroll
401
+ } else if (roundedScroll >= roundedMaxScroll) {
402
+ shadow = 'start';
403
+ // median scroll
404
+ } else if (roundedScroll > 0) {
405
+ shadow = 'median';
406
+ }
407
+ _this.setState({
408
+ shadowVertical: shadow
409
+ });
410
+ });
411
+ _defineProperty(_this, "handleFocus", function (e) {
412
+ if (_this.asProps.loading) {
413
+ var _this$spinnerRef$curr;
414
+ (_this$spinnerRef$curr = _this.spinnerRef.current) === null || _this$spinnerRef$curr === void 0 || _this$spinnerRef$curr.focus();
415
+ e.currentTarget.setAttribute('tabIndex', '-1');
416
+ if (_this.isDataEmpty) {
417
+ var _this$headerRef$curre;
418
+ (_this$headerRef$curre = _this.headerRef.current) === null || _this$headerRef$curre === void 0 || _this$headerRef$curre.setAttribute('tabIndex', '-1');
419
+ }
420
+ } else if ((!e.relatedTarget || !isFocusInside(e.currentTarget, e.relatedTarget)) && lastInteraction.isKeyboard()) {
421
+ var _row;
422
+ if (_this.focusedCell[0] === -1 && _this.focusedCell[1] === -1) {
423
+ _this.initFocusableCell();
424
+ }
425
+ _this.setInert(true);
426
+ var row = _this.getRow(_this.focusedCell[0]);
427
+ if (!row) {
428
+ _this.initFocusableCell();
429
+ row = _this.getRow(_this.focusedCell[0]);
430
+ }
431
+ if (!row && _this.asProps.virtualScroll) {
432
+ var _this$tableRef$curren4, _firstAvailableCell$p;
433
+ var firstAvailableCell = (_this$tableRef$curren4 = _this.tableRef.current) === null || _this$tableRef$curren4 === void 0 ? void 0 : _this$tableRef$curren4.querySelector("[role=\"gridcell\"]");
434
+ var firstAvailableRow = firstAvailableCell === null || firstAvailableCell === void 0 || (_firstAvailableCell$p = firstAvailableCell.parentElement) === null || _firstAvailableCell$p === void 0 ? void 0 : _firstAvailableCell$p.parentElement;
435
+ if (firstAvailableCell && firstAvailableRow) {
436
+ var _firstAvailableCell$g, _firstAvailableRow$ge;
437
+ var colIndex = Number((_firstAvailableCell$g = firstAvailableCell.getAttribute('aria-colindex')) !== null && _firstAvailableCell$g !== void 0 ? _firstAvailableCell$g : 1) - 1;
438
+ var rowIndex = Number((_firstAvailableRow$ge = firstAvailableRow.getAttribute('aria-rowindex')) !== null && _firstAvailableRow$ge !== void 0 ? _firstAvailableRow$ge : 1) - 1;
439
+ _this.focusedCell[0] = rowIndex;
440
+ _this.focusedCell[1] = colIndex;
441
+ row = firstAvailableRow;
442
+ }
443
+ }
444
+ var colindex = _this.focusedCell[1];
445
+ var cell = colindex > -1 ? (_row = row) === null || _row === void 0 ? void 0 : _row.querySelector("[role=gridcell][aria-colindex=\"".concat(colindex + 1, "\"]:not([aria-hidden=\"true\"]), [role=columnheader][aria-colindex=\"").concat(colindex + 1, "\"]:not([aria-hidden=\"true\"])")) : undefined;
446
+ cell === null || cell === void 0 || cell.removeAttribute('inert');
447
+ if (cell instanceof HTMLElement) {
448
+ if (hasParent(e.target, cell) && !e.target.dataset.skipTargetFocus) {
449
+ e.target.focus({
450
+ focusVisible: true
451
+ });
452
+ } else {
453
+ cell.focus({
454
+ focusVisible: true
455
+ });
456
+ }
457
+ }
458
+ if (_this.isDataEmpty) {
459
+ var _this$headerRef$curre2;
460
+ (_this$headerRef$curre2 = _this.headerRef.current) === null || _this$headerRef$curre2 === void 0 || _this$headerRef$curre2.setAttribute('tabIndex', '-1');
461
+ }
462
+ e.currentTarget.setAttribute('tabIndex', '-1');
463
+ }
464
+ });
465
+ _defineProperty(_this, "handleBlur", function (e) {
466
+ var relatedTarget = e.relatedTarget;
467
+ var tableElement = _this.tableRef.current;
468
+ if (tableElement && (!relatedTarget || !isFocusInside(tableElement, relatedTarget) || !lastInteraction.isKeyboard())) {
469
+ _this.setInert(false);
470
+ tableElement.setAttribute('tabIndex', '0');
471
+ if (_this.isDataEmpty) {
472
+ var _this$headerRef$curre3;
473
+ (_this$headerRef$curre3 = _this.headerRef.current) === null || _this$headerRef$curre3 === void 0 || _this$headerRef$curre3.setAttribute('tabIndex', '0');
474
+ }
475
+ }
476
+ });
477
+ _defineProperty(_this, "handleMouseMove", function () {
478
+ _this.setInert(false);
479
+ });
480
+ _defineProperty(_this, "handleBackFromAccordion", function (key) {
481
+ var cellIndex = _this.columns.findIndex(function (c) {
482
+ return c.name === key;
483
+ });
484
+ _this.changeFocusCell(-1, cellIndex === -1 ? 0 : cellIndex, 'up');
485
+ });
486
+ _defineProperty(_this, "handleContainerResizeEnd", function (entries, observer) {
487
+ var _this$asProps$onResiz, _this$asProps2;
488
+ if (_this.containerResizeEndTimeoutId) {
489
+ clearTimeout(_this.containerResizeEndTimeoutId);
490
+ }
491
+ _this.containerResizeEndTimeoutId = setTimeout(function () {
492
+ _this.calculateVerticalShadow();
493
+ _this.calculateStickyHeaderAnimation();
494
+ }, 0);
495
+ (_this$asProps$onResiz = (_this$asProps2 = _this.asProps).onResize) === null || _this$asProps$onResiz === void 0 || _this$asProps$onResiz.call(_this$asProps2, entries, observer);
496
+ });
497
+ _defineProperty(_this, "getScrollOffsetValue", function () {
498
+ if (!_this.headerRef.current) {
499
+ return [0, 0];
500
+ }
501
+ var setToMap = function setToMap(element) {
502
+ if (element.getAttribute('name') && element.dataset.uiName === 'Head.Column') {
503
+ var name = element.getAttribute('name');
504
+ if (name) {
505
+ _this.headerNodesMap.set(name, element);
506
+ }
507
+ }
508
+ };
509
+ _this.headerRef.current.childNodes.forEach(function (node) {
510
+ if (node instanceof HTMLElement) {
511
+ if (node.classList.value.includes('SGroupContainer')) {
512
+ node.childNodes.forEach(function (columnNode) {
513
+ if (columnNode instanceof HTMLElement) {
514
+ setToMap(columnNode);
515
+ }
516
+ });
517
+ } else {
518
+ setToMap(node);
519
+ }
520
+ }
521
+ });
522
+ return _this.columns.reduce(function (acc, column) {
523
+ if (column.fixed === 'left') {
524
+ var _this$headerNodesMap$, _this$headerNodesMap$2;
525
+ acc[0] += (_this$headerNodesMap$ = (_this$headerNodesMap$2 = _this.headerNodesMap.get(column.name)) === null || _this$headerNodesMap$2 === void 0 ? void 0 : _this$headerNodesMap$2.getBoundingClientRect().width) !== null && _this$headerNodesMap$ !== void 0 ? _this$headerNodesMap$ : 0;
526
+ }
527
+ if (column.fixed === 'right') {
528
+ var _this$headerNodesMap$3, _this$headerNodesMap$4;
529
+ acc[1] += (_this$headerNodesMap$3 = (_this$headerNodesMap$4 = _this.headerNodesMap.get(column.name)) === null || _this$headerNodesMap$4 === void 0 ? void 0 : _this$headerNodesMap$4.getBoundingClientRect().width) !== null && _this$headerNodesMap$3 !== void 0 ? _this$headerNodesMap$3 : 0;
530
+ }
531
+ return acc;
532
+ }, [0, 0]);
533
+ });
534
+ _defineProperty(_this, "getFixedStyle", function (cell) {
535
+ var side = cell.fixed;
536
+ if (!side) return [undefined, undefined];
537
+ var names = cell.name.split('/');
538
+ var nameSideMap = {
539
+ left: names[0],
540
+ right: names[names.length - 1]
541
+ };
542
+ var name = nameSideMap[side];
543
+ var index = _this.columns.findIndex(function (column) {
544
+ return column.name === name;
545
+ });
546
+ if (index === -1) return [undefined, undefined];
547
+ var startIndexSideMap = {
548
+ left: 0,
549
+ right: index + 1
550
+ };
551
+ var endIndexSideMap = {
552
+ left: index,
553
+ right: _this.columns.length
554
+ };
555
+ var columnsFixed = _this.columns.slice(startIndexSideMap[side], endIndexSideMap[side]);
556
+ if (columnsFixed.length < 1) return [side, 0];
557
+ var sum = columnsFixed.reduce(function (acc, column) {
558
+ var _this$headerNodesMap$5;
559
+ return acc + ((_this$headerNodesMap$5 = _this.headerNodesMap.get(column.name)) === null || _this$headerNodesMap$5 === void 0 ? void 0 : _this$headerNodesMap$5.getBoundingClientRect().width);
560
+ }, 0);
561
+ return [side, "".concat(sum, "px")];
562
+ });
563
+ var cols = _this.calculateColumnsFromConfig();
564
+ _this.columns = cols[0];
565
+ _this.treeColumns = cols[1];
566
+ _this.calculatedRows = _this.getRows();
567
+ _this.flatRows = _this.calculatedRows.flat();
568
+ _this.tmpData = props.data;
569
+ if (Array.isArray(props.selectedRows) || !props.selectedRows) {
570
+ _this.selectedRowsContainer = new SelectableRows();
571
+ } else {
572
+ _this.selectedRowsContainer = props.selectedRows;
573
+ }
574
+ return _this;
575
+ }
576
+ _inherits(DataTableRoot, _Component);
577
+ return _createClass(DataTableRoot, [{
578
+ key: "componentDidMount",
579
+ value: function componentDidMount() {
580
+ var _this2 = this;
581
+ var _this$asProps3 = this.asProps,
582
+ headerProps = _this$asProps3.headerProps,
583
+ loading = _this$asProps3.loading;
584
+ if (headerProps !== null && headerProps !== void 0 && headerProps.sticky && !headerProps.h || loading || this.hasFixedColumn) {
585
+ requestAnimationFrame(function () {
586
+ _this2.forceUpdate();
587
+ _this2.calculateVerticalShadow();
588
+ });
589
+ }
590
+ if (headerProps !== null && headerProps !== void 0 && headerProps.sticky && canUseDOM() && this.scrollDirection === 'horizontal') {
591
+ if (!this.withAnimation) {
592
+ document.addEventListener('scroll', this.handleDocumentScroll, {
593
+ passive: true
594
+ });
595
+ } else {
596
+ this.calculateStickyHeaderAnimation();
597
+ }
598
+ }
599
+ }
600
+ }, {
601
+ key: "componentDidUpdate",
602
+ value: function componentDidUpdate(prevProps) {
603
+ var _this$asProps4 = this.asProps,
604
+ data = _this$asProps4.data,
605
+ selectedRows = _this$asProps4.selectedRows,
606
+ columns = _this$asProps4.columns;
607
+ if (prevProps.columns !== columns) {
608
+ var cols = this.calculateColumnsFromConfig();
609
+ this.columns = cols[0];
610
+ this.treeColumns = cols[1];
611
+ this.forceUpdate();
612
+ }
613
+ if (prevProps.data !== data || prevProps.columns !== columns) {
614
+ if (this.hasFixedColumn) {
615
+ this.calculateVerticalShadow();
616
+ }
617
+ }
618
+ if (prevProps.selectedRows !== selectedRows && selectedRows !== undefined && !Array.isArray(selectedRows)) {
619
+ this.selectedRowsContainer = selectedRows;
620
+ }
621
+ }
622
+ }, {
623
+ key: "componentWillUnmount",
624
+ value: function componentWillUnmount() {
625
+ var _this$state$expandedR;
626
+ if (canUseDOM()) {
627
+ document.removeEventListener('scroll', this.handleDocumentScroll);
628
+ }
629
+ (_this$state$expandedR = this.state.expandedRows) === null || _this$state$expandedR === void 0 || _this$state$expandedR.clear();
630
+ }
631
+ }, {
632
+ key: "calculateStickyHeaderAnimation",
633
+ value: function calculateStickyHeaderAnimation() {
634
+ var headerProps = this.asProps.headerProps;
635
+ var scrollArea = this.scrollAreaRef.current;
636
+ var table = this.tableContainerRef.current;
637
+ if (scrollArea && table) {
638
+ var _headerProps$top2;
639
+ var currentHeaderHeight = scrollArea.style.getPropertyValue('--global-header-height');
640
+ var newHeaderHeight = "".concat(this.getHeaderHeight(), "px");
641
+ scrollArea.style.setProperty('--global-scroll-to', "".concat(table.offsetHeight, "px"));
642
+ scrollArea.style.setProperty('--global-header-top', "".concat((_headerProps$top2 = headerProps === null || headerProps === void 0 ? void 0 : headerProps.top) !== null && _headerProps$top2 !== void 0 ? _headerProps$top2 : 0, "px"));
643
+ scrollArea.style.setProperty('--global-header-height', newHeaderHeight);
644
+ if (currentHeaderHeight && currentHeaderHeight !== newHeaderHeight) {
645
+ this.forceUpdate();
646
+ }
647
+ }
648
+ }
649
+ }, {
650
+ key: "withAnimation",
651
+ get: function get() {
652
+ if (canUseDOM()) {
653
+ return CSS.supports('(animation-timeline: view()) and (animation-range: normal)');
654
+ }
655
+ return false;
656
+ }
657
+ }, {
658
+ key: "totalRows",
659
+ get: function get() {
660
+ var totalRows = this.asProps.totalRows;
661
+ var flatRows = this.getFlatRows();
662
+ var expandedRows = this.state.expandedRows;
663
+ var expandedRowsCount = Array.from(expandedRows).reduce(function (acc, rowKey) {
664
+ var dtRow = flatRows.find(function (el) {
665
+ return el[UNIQ_ROW_KEY] === rowKey;
666
+ });
667
+ if (dtRow) {
668
+ var _expandedRows = dtRow[ACCORDION];
669
+ if (Array.isArray(_expandedRows)) {
670
+ acc = acc + _expandedRows.length;
671
+ } else {
672
+ acc = acc + 1;
673
+ }
674
+ }
675
+ return acc;
676
+ }, 0);
677
+ if (totalRows !== undefined) {
678
+ return totalRows + expandedRowsCount;
679
+ }
680
+ var rows = this.getRows().reduce(function (acc, item) {
681
+ if (Array.isArray(item)) {
682
+ acc = acc + item.length;
683
+ } else {
684
+ acc = acc + 1;
685
+ }
686
+ return acc;
687
+ }, 0);
688
+ return rows + expandedRowsCount;
689
+ }
690
+ }, {
691
+ key: "scrollDirection",
692
+ get: function get() {
693
+ var _this$asProps5 = this.asProps,
694
+ w = _this$asProps5.w,
695
+ wMax = _this$asProps5.wMax,
696
+ h = _this$asProps5.h,
697
+ hMax = _this$asProps5.hMax;
698
+ var scrollDirection = undefined;
699
+ var hasWidthSettings = Boolean(w) || Boolean(wMax);
700
+ var hasHeightSettings = Boolean(h) && h !== 'fit-content' || Boolean(hMax);
701
+ if (hasWidthSettings && !hasHeightSettings) {
702
+ scrollDirection = 'horizontal';
703
+ } else if (hasHeightSettings && !hasWidthSettings) {
704
+ scrollDirection = 'vertical';
705
+ } else if (hasWidthSettings && hasHeightSettings) {
706
+ scrollDirection = 'both';
707
+ }
708
+ return scrollDirection;
709
+ }
710
+ }, {
711
+ key: "isDataEmpty",
712
+ get: function get() {
713
+ return this.asProps.data.length === 0;
714
+ }
715
+ }, {
716
+ key: "getHeadProps",
717
+ value: function getHeadProps() {
718
+ var _this$asProps6 = this.asProps,
719
+ use = _this$asProps6.use,
720
+ compact = _this$asProps6.compact,
721
+ sort = _this$asProps6.sort,
722
+ onSortChange = _this$asProps6.onSortChange,
723
+ getI18nText = _this$asProps6.getI18nText,
724
+ uid = _this$asProps6.uid,
725
+ headerProps = _this$asProps6.headerProps,
726
+ selectedRows = _this$asProps6.selectedRows,
727
+ sideIndents = _this$asProps6.sideIndents,
728
+ variant = _this$asProps6.variant;
729
+ var _this$gridSettings = this.gridSettings,
730
+ gridTemplateColumns = _this$gridSettings.gridTemplateColumns,
731
+ gridTemplateAreas = _this$gridSettings.gridTemplateAreas;
732
+ var shadowVertical = this.state.shadowVertical;
733
+ var sideIndentsValue = variant === 'card' ? 'wide' : sideIndents;
734
+ return _objectSpread(_objectSpread({}, headerProps), {}, {
735
+ columns: this.columns,
736
+ treeColumns: this.treeColumns,
737
+ use: use,
738
+ tableRef: this.tableRef,
739
+ compact: Boolean(compact),
740
+ sort: sort,
741
+ onSortChange: onSortChange,
742
+ getI18nText: getI18nText,
743
+ uid: uid,
744
+ ref: headerProps !== null && headerProps !== void 0 && headerProps.ref ? forkRef(this.headerRef, headerProps.ref) : this.headerRef,
745
+ gridAreaGroupMap: this.gridAreaGroupMap,
746
+ gridTemplateColumns: gridTemplateColumns,
747
+ gridTemplateAreas: gridTemplateAreas,
748
+ sideIndents: sideIndentsValue,
749
+ totalRows: this.totalRows,
750
+ selectedRows: selectedRows,
751
+ flatRows: this.getFlatRows(),
752
+ onChangeSelectAll: Array.isArray(selectedRows) ? this.handleSelectAllRows : undefined,
753
+ getFixedStyle: this.getFixedStyle,
754
+ onCellClick: this.handleCellClick,
755
+ shadowVertical: shadowVertical,
756
+ scrollDirection: this.scrollDirection,
757
+ isDataEmpty: this.isDataEmpty,
758
+ withAnimation: this.withAnimation && this.scrollDirection === 'horizontal' && !this.isDataEmpty
759
+ });
760
+ }
761
+ }, {
762
+ key: "getBodyProps",
763
+ value: function getBodyProps() {
764
+ var _this$asProps7 = this.asProps,
765
+ use = _this$asProps7.use,
766
+ compact = _this$asProps7.compact,
767
+ loading = _this$asProps7.loading,
768
+ getI18nText = _this$asProps7.getI18nText,
769
+ virtualScroll = _this$asProps7.virtualScroll,
770
+ uid = _this$asProps7.uid,
771
+ rowProps = _this$asProps7.rowProps,
772
+ renderCell = _this$asProps7.renderCell,
773
+ headerProps = _this$asProps7.headerProps,
774
+ renderEmptyData = _this$asProps7.renderEmptyData,
775
+ sideIndents = _this$asProps7.sideIndents,
776
+ selectedRows = _this$asProps7.selectedRows,
777
+ accordionDuration = _this$asProps7.accordionDuration,
778
+ accordionMode = _this$asProps7.accordionMode,
779
+ rawData = _this$asProps7.data,
780
+ renderCellOverlay = _this$asProps7.renderCellOverlay,
781
+ limit = _this$asProps7.limit,
782
+ variant = _this$asProps7.variant,
783
+ totalRows = _this$asProps7.totalRows,
784
+ accordionAnimationRows = _this$asProps7.accordionAnimationRows;
785
+ var _this$gridSettings2 = this.gridSettings,
786
+ gridTemplateColumns = _this$gridSettings2.gridTemplateColumns,
787
+ gridTemplateAreas = _this$gridSettings2.gridTemplateAreas;
788
+ var shadowVertical = this.state.shadowVertical;
789
+ return {
790
+ accordionDuration: accordionDuration,
791
+ accordionAnimationRows: accordionAnimationRows,
792
+ accordionMode: accordionMode,
793
+ columns: this.columns,
794
+ rows: this.getRows(),
795
+ flatRows: this.getFlatRows(),
796
+ use: use,
797
+ compact: Boolean(compact),
798
+ gridTemplateColumns: gridTemplateColumns,
799
+ gridTemplateAreas: gridTemplateAreas,
800
+ loading: loading,
801
+ headerHeight: this.getHeaderHeight(),
802
+ stickyHeader: headerProps === null || headerProps === void 0 ? void 0 : headerProps.sticky,
803
+ getI18nText: getI18nText,
804
+ expandedRows: this.state.expandedRows,
805
+ onExpandRow: this.onExpandRow,
806
+ spinnerRef: this.spinnerRef,
807
+ scrollTop: this.state.scrollTop,
808
+ scrollDirection: this.state.scrollDirection,
809
+ tableContainerRef: this.tableContainerRef,
810
+ tableRef: this.tableRef,
811
+ scrollAreaRef: this.scrollAreaRef,
812
+ onBackFromAccordion: this.handleBackFromAccordion,
813
+ virtualScroll: virtualScroll,
814
+ hasGroups: this.hasGroups,
815
+ uid: uid,
816
+ rowProps: this.getRows().length > 0 ? rowProps : undefined,
817
+ renderCell: this.getRows().length > 0 ? renderCell : undefined,
818
+ renderEmptyData: renderEmptyData,
819
+ sideIndents: sideIndents,
820
+ selectedRows: selectedRows,
821
+ onSelectRow: Array.isArray(selectedRows) ? this.handleSelectRow : undefined,
822
+ getFixedStyle: this.getFixedStyle,
823
+ onCellClick: this.handleCellClick,
824
+ rawData: rawData,
825
+ shadowVertical: shadowVertical,
826
+ renderCellOverlay: renderCellOverlay,
827
+ limit: limit,
828
+ variant: variant,
829
+ totalRows: totalRows
830
+ };
831
+ }
832
+ }, {
833
+ key: "setInert",
834
+ value: function setInert(value) {
835
+ var _this$tableRef$curren5;
836
+ var cells = (_this$tableRef$curren5 = this.tableRef.current) === null || _this$tableRef$curren5 === void 0 ? void 0 : _this$tableRef$curren5.querySelectorAll('[role=gridcell], [role=columnheader]');
837
+ cells === null || cells === void 0 || cells.forEach(function (cell) {
838
+ if (value === true) {
839
+ cell.setAttribute('inert', '');
840
+ } else {
841
+ cell.removeAttribute('inert');
842
+ }
843
+ });
844
+ }
845
+ }, {
846
+ key: "initFocusableCell",
847
+ value: function initFocusableCell(initCell) {
848
+ var _initCell$, _initCell$2;
849
+ var hasFocusable = this.hasFocusableInHeader();
850
+ var initRow = (_initCell$ = initCell === null || initCell === void 0 ? void 0 : initCell[0]) !== null && _initCell$ !== void 0 ? _initCell$ : 0;
851
+ var initCol = (_initCell$2 = initCell === null || initCell === void 0 ? void 0 : initCell[1]) !== null && _initCell$2 !== void 0 ? _initCell$2 : 0;
852
+ if (hasFocusable) {
853
+ this.focusedCell = [initRow, initCol];
854
+ } else {
855
+ this.focusedCell = [initRow + 1, initCol];
856
+ }
857
+ }
858
+ }, {
859
+ key: "render",
860
+ value: function render() {
861
+ var _ref = this.asProps,
862
+ _ref2;
863
+ var SDataTable = Box;
864
+ var _this$asProps8 = this.asProps,
865
+ Children = _this$asProps8.Children,
866
+ styles = _this$asProps8.styles,
867
+ w = _this$asProps8.w,
868
+ wMax = _this$asProps8.wMax,
869
+ wMin = _this$asProps8.wMin,
870
+ h = _this$asProps8.h,
871
+ hMax = _this$asProps8.hMax,
872
+ hMin = _this$asProps8.hMin,
873
+ virtualScroll = _this$asProps8.virtualScroll,
874
+ children = _this$asProps8.children,
875
+ headerProps = _this$asProps8.headerProps,
876
+ loading = _this$asProps8.loading,
877
+ selectedRows = _this$asProps8.selectedRows,
878
+ getI18nText = _this$asProps8.getI18nText,
879
+ data = _this$asProps8.data;
880
+ var _this$getScrollOffset = this.getScrollOffsetValue(),
881
+ _this$getScrollOffset2 = _slicedToArray(_this$getScrollOffset, 2),
882
+ offsetLeftSum = _this$getScrollOffset2[0],
883
+ offsetRightSum = _this$getScrollOffset2[1];
884
+ var _this$gridSettings3 = this.gridSettings,
885
+ gridTemplateColumns = _this$gridSettings3.gridTemplateColumns,
886
+ gridTemplateAreas = _this$gridSettings3.gridTemplateAreas;
887
+ var headerHeight = (headerProps === null || headerProps === void 0 ? void 0 : headerProps.h) || this.getHeaderHeight();
888
+ var topOffset = headerProps !== null && headerProps !== void 0 && headerProps.sticky || headerProps !== null && headerProps !== void 0 && headerProps.withScrollBar ? headerHeight : undefined;
889
+ var width = w !== null && w !== void 0 ? w : this.columns.some(function (c) {
890
+ return c.gtcWidth === 'auto' || c.gtcWidth === '1fr';
891
+ }) ? '100%' : undefined;
892
+ var gridTemplateRows = undefined;
893
+ if (virtualScroll && typeof virtualScroll !== 'boolean' && 'rowHeight' in virtualScroll) {
894
+ gridTemplateRows = "auto auto repeat(".concat(this.totalRows, ", minmax(").concat(virtualScroll.rowHeight, "px, auto))");
895
+ }
896
+ return _ref2 = sstyled(styles), /*#__PURE__*/React.createElement(ScrollArea, _ref2.cn("ScrollArea", {
897
+ "leftOffset": offsetLeftSum,
898
+ "rightOffset": offsetRightSum,
899
+ "topOffset": topOffset,
900
+ "w": width,
901
+ "wMax": wMax,
902
+ "wMin": wMin,
903
+ "h": h,
904
+ "hMax": hMax,
905
+ "hMin": hMin,
906
+ "shadow": true,
907
+ "ref": this.scrollAreaRef,
908
+ "container": this.tableContainerRef,
909
+ "styles": scrollStyles,
910
+ "onScroll": this.handleScroll,
911
+ "disableAutofocusToContent": true,
912
+ "onResize": this.handleContainerResizeEnd
913
+ }), /*#__PURE__*/React.createElement(ScrollArea.Container, {
914
+ tabIndex: -1
915
+ // @ts-ignore
916
+ ,
917
+ scrollDirection: this.scrollDirection
918
+ // @ts-ignore
919
+ ,
920
+ loading: loading,
921
+ headerHeight: "".concat(headerHeight, "px"),
922
+ leftScrollPadding: "".concat(offsetLeftSum, "px"),
923
+ rightScrollPadding: "".concat(offsetRightSum, "px")
924
+ }, /*#__PURE__*/React.createElement(SDataTable, _ref2.cn("SDataTable", _objectSpread({}, _assignProps({
925
+ "ref": forkRef(this.tableRef, this.tableContainerRef),
926
+ "role": 'grid',
927
+ "onKeyDown": this.handleKeyDown,
928
+ "onKeyUp": this.handleKeyUp,
929
+ "onMouseMove": this.handleMouseMove,
930
+ "tabIndex": 0,
931
+ "onFocus": this.handleFocus,
932
+ "onBlur": this.handleBlur,
933
+ "isDataEmpty": this.isDataEmpty,
934
+ "aria-rowcount": this.totalRows,
935
+ "aria-colcount": this.columns.length,
936
+ "gridTemplateColumns": gridTemplateColumns.join(' '),
937
+ "gridTemplateAreas": gridTemplateAreas.join(' '),
938
+ "gridTemplateRows": gridTemplateRows,
939
+ "w": '100%',
940
+ "use:data": undefined,
941
+ "use:w": undefined,
942
+ "use:wMax": undefined,
943
+ "use:wMin": undefined,
944
+ "use:h": undefined,
945
+ "use:hMax": undefined,
946
+ "use:hMin": undefined
947
+ }, _ref))), children ? /*#__PURE__*/React.createElement(Children, _ref2.cn("Children", {})) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DataTable.Head, null), /*#__PURE__*/React.createElement(DataTable.Body, null)))), /*#__PURE__*/React.createElement(ScrollBars, _ref2.cn("ScrollBars", {
948
+ "loading": loading,
949
+ "topOffset": topOffset,
950
+ "withHeaderScrollBar": headerProps === null || headerProps === void 0 ? void 0 : headerProps.withScrollBar,
951
+ "withAnimation": this.withAnimation
952
+ })), selectedRows !== undefined && !Array.isArray(selectedRows) && /*#__PURE__*/React.createElement(SRReactiveAnnouncer, _ref2.cn("SRReactiveAnnouncer", {
953
+ "selectedRows": selectedRows,
954
+ "getI18nText": getI18nText
955
+ })), selectedRows !== undefined && Array.isArray(selectedRows) && /*#__PURE__*/React.createElement(SRAnnouncer, _ref2.cn("SRAnnouncer", {
956
+ "selectedRows": selectedRows,
957
+ "getI18nText": getI18nText,
958
+ "data": data,
959
+ "flatRows": this.flatRows
960
+ })));
961
+ }
962
+ }, {
963
+ key: "calculateColumnsFromConfig",
964
+ value: function calculateColumnsFromConfig() {
965
+ var _this3 = this;
966
+ var _this$props = this.props,
967
+ columns = _this$props.columns,
968
+ data = _this$props.data,
969
+ selectedRows = _this$props.selectedRows;
970
+ this.hasGroups = columns.some(function (column) {
971
+ return 'columns' in column && column.columns.some(function (col) {
972
+ return col.children !== null;
973
+ });
974
+ });
975
+ var groupIndex = 0;
976
+ var gridColumnIndex = selectedRows ? 2 : 1;
977
+ var calculateGridTemplateColumn = this.calculateGridTemplateColumn.bind(this);
978
+ var calculatedColumns = [];
979
+ var treeColumns = [];
980
+ if (selectedRows) {
981
+ var column = {
982
+ name: SELECT_ALL,
983
+ gtcWidth: 'min-content',
984
+ alignItems: 'flex-start',
985
+ children: ''
986
+ };
987
+ calculatedColumns.push(column);
988
+ }
989
+ var makeColumn = function makeColumn(columnElement, parent, isFirst, isLast, hasGroups) {
990
+ var _columnElement$fixed, _ref3, _columnElement$border;
991
+ var leftBordersFromParent = isFirst && ((parent === null || parent === void 0 ? void 0 : parent.borders) === 'both' || (parent === null || parent === void 0 ? void 0 : parent.borders) === 'left') ? 'left' : undefined;
992
+ var rightBordersFromParent = isLast && ((parent === null || parent === void 0 ? void 0 : parent.borders) === 'both' || (parent === null || parent === void 0 ? void 0 : parent.borders) === 'right') ? 'right' : undefined;
993
+ var column = _objectSpread(_objectSpread({}, columnElement), {}, {
994
+ name: childIsColumn(columnElement) ? columnElement.name : '',
995
+ gtcWidth: childIsColumn(columnElement) ? calculateGridTemplateColumn(columnElement) : '',
996
+ fixed: (_columnElement$fixed = columnElement.fixed) !== null && _columnElement$fixed !== void 0 ? _columnElement$fixed : hasGroups ? parent === null || parent === void 0 ? void 0 : parent.fixed : undefined,
997
+ borders: (_ref3 = (_columnElement$border = columnElement.borders) !== null && _columnElement$border !== void 0 ? _columnElement$border : leftBordersFromParent) !== null && _ref3 !== void 0 ? _ref3 : rightBordersFromParent,
998
+ parent: parent
999
+ });
1000
+ if (column.fixed) {
1001
+ _this3.hasFixedColumn = true;
1002
+ }
1003
+ return column;
1004
+ };
1005
+ var childIsColumn = function childIsColumn(child) {
1006
+ return !('columns' in child);
1007
+ };
1008
+ var childIsGroup = function childIsGroup(child) {
1009
+ return 'columns' in child;
1010
+ };
1011
+ var setShowShadows = function setShowShadows(col, i) {
1012
+ var prevCol = treeColumns[i - 1];
1013
+ if ('columns' in prevCol && prevCol.columns) {
1014
+ prevCol = prevCol.columns[prevCol.columns.length - 1];
1015
+ }
1016
+ if (prevCol.fixed && !col.fixed) {
1017
+ prevCol.showShadowVertical = true;
1018
+ } else if (!prevCol.fixed && col.fixed) {
1019
+ col.showShadowVertical = true;
1020
+ }
1021
+ };
1022
+ columns.forEach(function (child, i) {
1023
+ if (childIsColumn(child)) {
1024
+ var col = makeColumn(child);
1025
+ col.gridArea = "1 / ".concat(gridColumnIndex, " / ").concat(_this3.hasGroups ? '3' : '2', " / ").concat(gridColumnIndex + 1);
1026
+ gridColumnIndex++;
1027
+ calculatedColumns.push(col);
1028
+ treeColumns.push(col);
1029
+ if (i > 0) {
1030
+ setShowShadows(col, i);
1031
+ }
1032
+ } else if (childIsGroup(child)) {
1033
+ var Group = makeColumn(child);
1034
+ var childCount = child.columns.length;
1035
+ var initGridColumn = gridColumnIndex;
1036
+ var groupedRow = _this3.hasGroups ? 2 : 1;
1037
+ Group.columns = [];
1038
+ Group.children = child.children;
1039
+ child.columns.forEach(function (child, j) {
1040
+ var _Group$columns;
1041
+ var isFirst = j === 0;
1042
+ var isLast = j === childCount - 1;
1043
+ var col = makeColumn(child, Group, isFirst, isLast, _this3.hasGroups);
1044
+ if (i === 0 && j === 0 && data.some(function (d) {
1045
+ return d[ACCORDION];
1046
+ })) {
1047
+ gridColumnIndex++;
1048
+ col.gridArea = "".concat(groupedRow, " / ").concat(gridColumnIndex - 1, " / ").concat(groupedRow + 1, " / ").concat(gridColumnIndex + 1);
1049
+ } else {
1050
+ col.gridArea = "".concat(groupedRow, " / ").concat(gridColumnIndex, " / ").concat(groupedRow + 1, " / ").concat(gridColumnIndex + 1);
1051
+ }
1052
+ col.gridArea = "".concat(groupedRow, " / ").concat(gridColumnIndex, " / ").concat(groupedRow + 1, " / ").concat(gridColumnIndex + 1);
1053
+ gridColumnIndex++;
1054
+ calculatedColumns.push(col);
1055
+ if (isFirst && i > 0) {
1056
+ setShowShadows(col, i);
1057
+ }
1058
+ (_Group$columns = Group.columns) === null || _Group$columns === void 0 || _Group$columns.push(col);
1059
+ });
1060
+ treeColumns.push(Group);
1061
+ _this3.gridAreaGroupMap.set(groupIndex, "1 / ".concat(initGridColumn, " / 2 / ").concat(gridColumnIndex));
1062
+ groupIndex++;
1063
+ }
1064
+ });
1065
+ var gridTemplateColumns = calculatedColumns.map(function (c) {
1066
+ return c.gtcWidth;
1067
+ });
1068
+ var gridTemplateAreas = calculatedColumns.map(function (c) {
1069
+ return c.name;
1070
+ });
1071
+ this.gridSettings = {
1072
+ gridTemplateColumns: gridTemplateColumns,
1073
+ gridTemplateAreas: gridTemplateAreas
1074
+ };
1075
+ return [calculatedColumns, treeColumns];
1076
+ }
1077
+ }, {
1078
+ key: "getFlatRows",
1079
+ value: function getFlatRows() {
1080
+ var data = this.props.data;
1081
+ if (this.tmpData === data && this.flatRows) {
1082
+ return this.flatRows;
1083
+ }
1084
+ this.flatRows = this.getRows().flat();
1085
+ return this.flatRows;
1086
+ }
1087
+ }, {
1088
+ key: "getRows",
1089
+ value: function getRows() {
1090
+ var _this4 = this;
1091
+ var columns = this.columns;
1092
+ // @ts-ignore
1093
+ var _this$props2 = this.props,
1094
+ data = _this$props2.data,
1095
+ uid = _this$props2.uid,
1096
+ uniqueRowKey = _this$props2.uniqueRowKey,
1097
+ selectedRows = _this$props2.selectedRows;
1098
+ if (this.tmpData === data) {
1099
+ return this.calculatedRows;
1100
+ }
1101
+ this.tmpData = data;
1102
+ var availableRowKeys = [];
1103
+ var rows = [];
1104
+ var columnNames = columns.map(function (column) {
1105
+ return column.name;
1106
+ });
1107
+ var rowIndex = 0;
1108
+ var gridRowIndex = 0;
1109
+ var id = 100000000; // need this for gen keys by toString(36)
1110
+
1111
+ var _makeDtRow = function makeDtRow(row, excludeColumns) {
1112
+ var columns = new Set(columnNames);
1113
+ var accordionInCell = null;
1114
+ var rowKey = row[UNIQ_ROW_KEY];
1115
+ if (!rowKey) {
1116
+ if (uniqueRowKey) {
1117
+ // @ts-ignore
1118
+ var keyValue = row[uniqueRowKey];
1119
+ if (keyValue instanceof MergedRowsCell) {
1120
+ rowKey = keyValue.value;
1121
+ } else {
1122
+ rowKey = keyValue;
1123
+ }
1124
+ } else {
1125
+ rowKey = "".concat(uid, "_").concat((rowIndex + id).toString(36));
1126
+ }
1127
+ }
1128
+ var initData = _defineProperty(_defineProperty(_defineProperty({}, UNIQ_ROW_KEY, rowKey), ROW_INDEX, rowIndex), GRID_ROW_INDEX, gridRowIndex);
1129
+ var dtRow = Object.entries(row).reduce(function (acc, _ref4) {
1130
+ var _ref5 = _slicedToArray(_ref4, 2),
1131
+ key = _ref5[0],
1132
+ value = _ref5[1];
1133
+ var columnsToRow = key.split(_this4.columnsSplitter);
1134
+ if (columnsToRow.length === 1) {
1135
+ acc[key] = value !== null && value !== void 0 ? value : '';
1136
+ columns["delete"](key);
1137
+ } else {
1138
+ acc[columnsToRow[0]] = new MergedColumnsCell(value, {
1139
+ dataKey: key,
1140
+ size: columnsToRow.length
1141
+ });
1142
+ columnsToRow.forEach(function (value) {
1143
+ columns["delete"](value);
1144
+ });
1145
+ }
1146
+ if (value !== null && value !== void 0 && value[ACCORDION]) {
1147
+ accordionInCell = value[ACCORDION];
1148
+ }
1149
+ return acc;
1150
+ }, initData);
1151
+ gridRowIndex++;
1152
+ if (row[ACCORDION]) {
1153
+ if (Array.isArray(row[ACCORDION])) {
1154
+ dtRow[ACCORDION] = row[ACCORDION].map(function (item) {
1155
+ return _makeDtRow(item);
1156
+ });
1157
+ } else if (/*#__PURE__*/React.isValidElement(row[ACCORDION])) {
1158
+ dtRow[ACCORDION] = row[ACCORDION];
1159
+ gridRowIndex++;
1160
+ }
1161
+ } else if (accordionInCell) {
1162
+ gridRowIndex++;
1163
+ }
1164
+ excludeColumns === null || excludeColumns === void 0 || excludeColumns.forEach(function (value) {
1165
+ columns["delete"](value);
1166
+ });
1167
+ if (columns.size > 0) {
1168
+ columns.forEach(function (value) {
1169
+ dtRow[value] = '';
1170
+ });
1171
+ }
1172
+ if (!excludeColumns) {
1173
+ // we should add only the main row in mergedRows or default rows
1174
+ availableRowKeys.push(dtRow[UNIQ_ROW_KEY]);
1175
+ }
1176
+ return dtRow;
1177
+ };
1178
+ data.forEach(function (row) {
1179
+ var groupedRows = row[ROW_GROUP];
1180
+ if (groupedRows && groupedRows.length > 1) {
1181
+ var innerRows = [];
1182
+ var groupedKeys = [];
1183
+ var groupedRowData = Object.entries(row).reduce(function (acc, _ref6) {
1184
+ var _ref7 = _slicedToArray(_ref6, 2),
1185
+ key = _ref7[0],
1186
+ value = _ref7[1];
1187
+ var accordion = Array.isArray(row[ACCORDION]) ? row[ACCORDION].map(function (item) {
1188
+ return _makeDtRow(item);
1189
+ }) : row[ACCORDION];
1190
+ acc[key] = new MergedRowsCell(value, groupedRows.length, accordion);
1191
+ var columnsToRow = key.split(_this4.columnsSplitter);
1192
+ if (columnsToRow.length === 1) {
1193
+ groupedKeys.push(key);
1194
+ } else {
1195
+ groupedKeys.push.apply(groupedKeys, _toConsumableArray(columnsToRow));
1196
+ }
1197
+ return acc;
1198
+ }, _defineProperty(_defineProperty({}, UNIQ_ROW_KEY, ''), ROW_INDEX, -1));
1199
+ groupedRows.forEach(function (childRow, index) {
1200
+ var dtRow;
1201
+ if (index === 0) {
1202
+ var rowData = _objectSpread(_objectSpread({}, childRow), groupedRowData);
1203
+ dtRow = _makeDtRow(rowData);
1204
+ dtRow[ROW_GROUP] = new Set();
1205
+ } else {
1206
+ var _innerRows$;
1207
+ dtRow = _makeDtRow(childRow, groupedKeys);
1208
+ (_innerRows$ = innerRows[0]) === null || _innerRows$ === void 0 || (_innerRows$ = _innerRows$[ROW_GROUP]) === null || _innerRows$ === void 0 || _innerRows$.add(dtRow[UNIQ_ROW_KEY]);
1209
+ }
1210
+ innerRows.push(dtRow);
1211
+ if (index === groupedRows.length - 1 && row[ACCORDION]) {
1212
+ gridRowIndex = Array.isArray(row[ACCORDION]) ? gridRowIndex + row[ACCORDION].length : gridRowIndex + 1;
1213
+ }
1214
+ rowIndex++;
1215
+ });
1216
+ rows.push(innerRows);
1217
+ } else if ((groupedRows === null || groupedRows === void 0 ? void 0 : groupedRows.length) === 1) {
1218
+ var dtRow = _makeDtRow(_objectSpread(_objectSpread({}, groupedRows[0]), row));
1219
+ rows.push(dtRow);
1220
+ rowIndex++;
1221
+ } else {
1222
+ var _dtRow = _makeDtRow(row);
1223
+ rows.push(_dtRow);
1224
+ rowIndex++;
1225
+ }
1226
+ });
1227
+ this.calculatedRows = rows;
1228
+ if (selectedRows && !Array.isArray(selectedRows)) {
1229
+ selectedRows.setAvailableKeys(availableRowKeys);
1230
+ }
1231
+ return rows;
1232
+ }
1233
+ }, {
1234
+ key: "calculateGridTemplateColumn",
1235
+ value: function calculateGridTemplateColumn(c) {
1236
+ var _ref8;
1237
+ return (_ref8 = /*#__PURE__*/React.isValidElement(c) ? c.props.gtcWidth : c.gtcWidth) !== null && _ref8 !== void 0 ? _ref8 : this.props.defaultGridTemplateColumnWidth;
1238
+ }
1239
+ }, {
1240
+ key: "getHeaderHeight",
1241
+ value: function getHeaderHeight() {
1242
+ var _this$headerRef$curre4;
1243
+ var header = (_this$headerRef$curre4 = this.headerRef.current) === null || _this$headerRef$curre4 === void 0 ? void 0 : _this$headerRef$curre4.children;
1244
+ var height = 0;
1245
+ for (var i = 0; i < ((_header$length = header === null || header === void 0 ? void 0 : header.length) !== null && _header$length !== void 0 ? _header$length : 0); i++) {
1246
+ var _header$length;
1247
+ var item = header === null || header === void 0 ? void 0 : header.item(i);
1248
+ var columnHeight = item === null || item === void 0 ? void 0 : item.getBoundingClientRect().height;
1249
+ if (item instanceof HTMLElement && item.dataset.groupContainer) {
1250
+ var _item$children$item$g, _item$children$item, _item$children$item$g2, _item$children$item2;
1251
+ var groupHeight = (_item$children$item$g = (_item$children$item = item.children.item(0)) === null || _item$children$item === void 0 ? void 0 : _item$children$item.getBoundingClientRect().height) !== null && _item$children$item$g !== void 0 ? _item$children$item$g : 0;
1252
+ var cellHeight = (_item$children$item$g2 = (_item$children$item2 = item.children.item(1)) === null || _item$children$item2 === void 0 ? void 0 : _item$children$item2.getBoundingClientRect().height) !== null && _item$children$item$g2 !== void 0 ? _item$children$item$g2 : 0;
1253
+ columnHeight = groupHeight + cellHeight;
1254
+ }
1255
+ if (columnHeight) {
1256
+ height = columnHeight;
1257
+ break;
1258
+ }
1259
+ }
1260
+ return height;
1261
+ }
1262
+ }], [{
1263
+ key: "getDerivedStateFromProps",
1264
+ value: function getDerivedStateFromProps(props, state) {
1265
+ if (props.expandedRows === state.expandedRows || props.expandedRows === undefined) {
1266
+ return null;
1267
+ }
1268
+ return {
1269
+ expandedRows: props.expandedRows
1270
+ };
1271
+ }
1272
+ }]);
1273
+ }(Component);
1274
+ _defineProperty(DataTableRoot, "displayName", 'DataTable');
1275
+ _defineProperty(DataTableRoot, "style", style);
1276
+ _defineProperty(DataTableRoot, "enhance", [uniqueIDEnhancement(), i18nEnhance(localizedMessages)]);
1277
+ _defineProperty(DataTableRoot, "defaultProps", {
1278
+ use: 'primary',
1279
+ defaultGridTemplateColumnWidth: 'auto',
1280
+ defaultSelectedRows: undefined,
1281
+ h: 'fit-content',
1282
+ renderEmptyData: function renderEmptyData() {
1283
+ return /*#__PURE__*/React.createElement(NoData, {
1284
+ py: 10,
1285
+ type: "nothing-found",
1286
+ description: "",
1287
+ w: "100%"
1288
+ });
1289
+ },
1290
+ variant: 'default',
1291
+ accordionAnimationRows: 40,
1292
+ accordionDuration: 200
1293
+ });
1294
+ export var DataTable = createComponent(DataTableRoot, {
1295
+ Head: Head,
1296
+ Body: Body
1297
+ });
1298
+ //# sourceMappingURL=DataTable.js.map