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