@semcore/data-table 4.50.2-prerelease.0 → 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
@@ -1,619 +0,0 @@
1
- import _objectSpread from "@babel/runtime/helpers/objectSpread2";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- import _createForOfIteratorHelper from "@babel/runtime/helpers/createForOfIteratorHelper";
4
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
5
- import _createClass from "@babel/runtime/helpers/createClass";
6
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
7
- import _inherits from "@babel/runtime/helpers/inherits";
8
- import _createSuper from "@babel/runtime/helpers/createSuper";
9
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
10
- import { sstyled as _sstyled } from "@semcore/utils/lib/core/index";
11
- import { assignProps as _assignProps } from "@semcore/core";
12
- var _excluded = ["children", "name", "fixed", "resizable", "sortable", "flex", "vBorders", "active"],
13
- _excluded2 = ["name", "children"];
14
- import React from 'react';
15
- import createComponent, { Component, Root, sstyled } from '@semcore/core';
16
- import { Box } from '@semcore/flex-box';
17
- import syncScroll from '@semcore/utils/lib/syncScroll';
18
- import { callAllEventHandlers } from '@semcore/utils/lib/assignProps';
19
- import fire from '@semcore/utils/lib/fire';
20
- import { flattenColumns } from './utils';
21
- import Head from './Head';
22
- import Body from './Body';
23
- import uniqueIDEnhancement from '@semcore/utils/lib/uniqueID';
24
- import { localizedMessages } from './translations/__intergalactic-dynamic-locales';
25
- import i18nEnhance from '@semcore/utils/lib/enhances/i18nEnhance';
26
- /*!__reshadow-styles__:"./style/data-table.shadow.css"*/
27
- var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/".___SDataTable_1pye4_gg_,.___SHeadWrapper_1pye4_gg_{position:relative}.___SDataTable_1pye4_gg_.__compact_1pye4_gg_ .___SCell_1pye4_gg_,.___SDataTable_1pye4_gg_.__compact_1pye4_gg_ .___SColumn_1pye4_gg_{padding:var(--intergalactic-spacing-3x, 12px) var(--intergalactic-spacing-2x, 8px)}.___SHeadWrapper_1pye4_gg_.__animationsDisabled_1pye4_gg_ .___SColumn_1pye4_gg_{transition:none}.___SHeadWrapper_1pye4_gg_.__sticky_1pye4_gg_{position:sticky;top:0;z-index:2}.___SHead_1pye4_gg_{display:flex;position:relative;flex-direction:row;min-width:-moz-fit-content;min-width:fit-content;z-index:0}.___SColumn_1pye4_gg_{display:flex;align-items:flex-start;flex-grow:1;font-size:var(--intergalactic-fs-100, 12px);line-height:var(--intergalactic-lh-100, 133%);color:var(--intergalactic-text-primary, #191b23);box-sizing:border-box;position:relative;transition:width calc(var(--intergalactic-duration-extra-fast, 100)*1ms) ease-in-out,min-width calc(var(--intergalactic-duration-extra-fast, 100)*1ms) ease-in-out,max-width calc(var(--intergalactic-duration-extra-fast, 100)*1ms) ease-in-out}.___SColumn_1pye4_gg_:focus-visible{outline:0;box-shadow:inset var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5))}.___SColumn_1pye4_gg_.__hidden_1pye4_gg_{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border-width:0!important}.___SColumn_1pye4_gg_._use_primary_1pye4_gg_{padding:var(--intergalactic-spacing-3x, 12px);border-bottom:1px solid var(--intergalactic-border-secondary, #e0e1e9);background-color:var(--intergalactic-table-th-primary-cell, #f4f5f9)}.___SColumn_1pye4_gg_._use_secondary_1pye4_gg_{padding:var(--intergalactic-spacing-2x, 8px);border-bottom:1px solid var(--intergalactic-border-table-accent, #a9abb6);background-color:var(--intergalactic-table-th-secondary-cell, #ffffff)}.___SColumn_1pye4_gg_.__group_1pye4_gg_.__use_1pye4_gg_{display:flex;flex-wrap:wrap;flex-direction:column;align-items:normal;border-bottom:none;padding:0}.___SColumn_1pye4_gg_.__groupHead_1pye4_gg_{justify-content:center;z-index:1;border-bottom:none}.___SColumn_1pye4_gg_.__sortable_1pye4_gg_{cursor:pointer}.___SColumn_1pye4_gg_.__sortable_1pye4_gg_._use_primary_1pye4_gg_:focus{background-color:var(--intergalactic-table-th-primary-cell-hover, #e0e1e9)}@media (hover:hover){.___SColumn_1pye4_gg_.__sortable_1pye4_gg_._use_primary_1pye4_gg_:hover{background-color:var(--intergalactic-table-th-primary-cell-hover, #e0e1e9)}}.___SColumn_1pye4_gg_.__sortable_1pye4_gg_._justifyContent_right_1pye4_gg_:focus .___SSortWrapper_1pye4_gg_{position:absolute;flex-basis:0;right:var(--intergalactic-spacing-3x, 12px)}@media (hover:hover){.___SColumn_1pye4_gg_.__sortable_1pye4_gg_._justifyContent_right_1pye4_gg_:hover .___SSortWrapper_1pye4_gg_{position:absolute;flex-basis:0;right:var(--intergalactic-spacing-3x, 12px)}}.___SColumn_1pye4_gg_.__sortable_1pye4_gg_._justifyContent_right_1pye4_gg_.__active_1pye4_gg_ .___SSortWrapper_1pye4_gg_{position:relative;flex-basis:inherit;right:0}.___SColumn_1pye4_gg_.__sortable_1pye4_gg_.__active_1pye4_gg_ .___SSortWrapper_1pye4_gg_,.___SColumn_1pye4_gg_.__sortable_1pye4_gg_:focus .___SSortWrapper_1pye4_gg_{flex-basis:calc(var(--intergalactic-spacing-1x, 4px) + 16px);opacity:1}@media (hover:hover){.___SColumn_1pye4_gg_.__sortable_1pye4_gg_:hover .___SSortWrapper_1pye4_gg_{flex-basis:calc(var(--intergalactic-spacing-1x, 4px) + 16px);opacity:1}}.___SColumn_1pye4_gg_.__sortable_1pye4_gg_.__active_1pye4_gg_ .___SSortWrapper_1pye4_gg_:before,.___SColumn_1pye4_gg_.__sortable_1pye4_gg_:focus .___SSortIcon_1pye4_gg_,.___SColumn_1pye4_gg_.__sortable_1pye4_gg_:focus .___SSortWrapper_1pye4_gg_:before{display:block;opacity:1}@media (hover:hover){.___SColumn_1pye4_gg_.__sortable_1pye4_gg_:hover .___SSortWrapper_1pye4_gg_:before{display:block;opacity:1}}@media (hover:hover){.___SColumn_1pye4_gg_.__sortable_1pye4_gg_:hover .___SSortIcon_1pye4_gg_{display:block;opacity:1}}.___SColumn_1pye4_gg_._use_primary_1pye4_gg_.__active_1pye4_gg_{background-color:var(--intergalactic-table-th-primary-cell-active, #e0e1e9);width:100%}.___SColumn_1pye4_gg_.__active_1pye4_gg_ .___SSortIcon_1pye4_gg_{display:block;opacity:1}.___SColumn_1pye4_gg_.__resizable_1pye4_gg_{border-right:1px solid transparent}@media (hover:hover){.___SColumn_1pye4_gg_.__resizable_1pye4_gg_:hover:after{border-right-color:var(--intergalactic-border-table-accent, #a9abb6)}}.___SColumn_1pye4_gg_.__resizable_1pye4_gg_:after{content:\"\";position:absolute;bottom:0;right:-1px;height:100%;width:5px;background:0 0;cursor:col-resize;border-right:1px solid transparent}.___SColumn_1pye4_gg_.__fixed_1pye4_gg_{position:sticky;z-index:2}.___SCell_1pye4_gg_.__borderLeft_1pye4_gg_,.___SColumn_1pye4_gg_.__borderLeft_1pye4_gg_{border-left:1px solid var(--intergalactic-border-secondary, #e0e1e9)}.___SCell_1pye4_gg_.__borderRight_1pye4_gg_,.___SColumn_1pye4_gg_.__borderRight_1pye4_gg_{border-right:1px solid var(--intergalactic-border-secondary, #e0e1e9)}.___SSortWrapper_1pye4_gg_{flex-shrink:1;position:relative;flex-basis:0;min-height:16px;opacity:0;transition:all calc(var(--intergalactic-duration-extra-fast, 100)*1ms) ease-in-out}.___SSortIcon_1pye4_gg_,.___SSortWrapper_1pye4_gg_:before{display:none;position:absolute;right:0;opacity:0;transition:opacity .3s ease}.___SSortWrapper_1pye4_gg_:before{content:\"\";top:0;width:20px;height:100%}.___SSortIcon_1pye4_gg_{fill:var(--intergalactic-icon-secondary-neutral-hover-active, #878992);top:calc(1em*1.25 - 16px);margin-left:var(--intergalactic-spacing-1x, 4px)}.___SColumn_1pye4_gg_._use_primary_1pye4_gg_ .___SSortWrapper_1pye4_gg_:before{background:linear-gradient(270deg,var(--intergalactic-table-th-primary-cell-hover, #e0e1e9) 67.5%,rgba(224,225,233,0) 105%)}.___SColumn_1pye4_gg_._use_secondary_1pye4_gg_ .___SSortWrapper_1pye4_gg_:before{background:linear-gradient(270deg,var(--intergalactic-table-th-secondary-cell, #ffffff) 67.5%,rgba(255,255,255,0) 105%)}.___SBodyWrapper_1pye4_gg_{position:relative}.___SBody_1pye4_gg_{display:flex;flex-direction:column;position:relative;min-width:-moz-fit-content;min-width:fit-content}.___SRow_1pye4_gg_{display:flex;flex-direction:row;position:relative}.___SRow_1pye4_gg_.__active_1pye4_gg_>.___SCell_1pye4_gg_:not(.__theme_1pye4_gg_),.___SRow_1pye4_gg_._theme_muted_1pye4_gg_.__active_1pye4_gg_>.___SCell_1pye4_gg_:not(.__theme_1pye4_gg_){background-color:var(--intergalactic-table-td-cell-active, #e6e7ed)}@media (hover:hover){.___SRow_1pye4_gg_ .___SCell_1pye4_gg_:hover+.___SGroupCell_1pye4_gg_ .___SCell_1pye4_gg_:not(.__theme_1pye4_gg_),.___SRow_1pye4_gg_:hover>.___SCell_1pye4_gg_:not(.__theme_1pye4_gg_){background-color:var(--intergalactic-table-td-cell-hover, #f0f0f4)}}.___SRow_1pye4_gg_._theme_muted_1pye4_gg_ .___SCell_1pye4_gg_:not(.__theme_1pye4_gg_){background-color:var(--intergalactic-table-td-cell-unread, #f4f5f9)}@media (hover:hover){.___SRow_1pye4_gg_._theme_muted_1pye4_gg_ .___SCell_1pye4_gg_:hover+.___SGroupCell_1pye4_gg_ .___SCell_1pye4_gg_:not(.__theme_1pye4_gg_),.___SRow_1pye4_gg_._theme_muted_1pye4_gg_:hover>.___SCell_1pye4_gg_:not(.__theme_1pye4_gg_),.___SRow_1pye4_gg_:hover>.___SCell_1pye4_gg_._theme_muted_1pye4_gg_{background-color:var(--intergalactic-table-td-cell-hover, #f0f0f4)}}.___SRow_1pye4_gg_._theme_info_1pye4_gg_ .___SCell_1pye4_gg_:not(.__theme_1pye4_gg_){background-color:var(--intergalactic-table-td-cell-selected, #e9f7ff)}.___SRow_1pye4_gg_._theme_info_1pye4_gg_.__active_1pye4_gg_>.___SCell_1pye4_gg_:not(.__theme_1pye4_gg_){background-color:var(--intergalactic-table-td-cell-selected-active, #c4e5fe)}@media (hover:hover){.___SRow_1pye4_gg_._theme_info_1pye4_gg_ .___SCell_1pye4_gg_:hover+.___SGroupCell_1pye4_gg_ .___SCell_1pye4_gg_:not(.__theme_1pye4_gg_),.___SRow_1pye4_gg_._theme_info_1pye4_gg_:hover>.___SCell_1pye4_gg_:not(.__theme_1pye4_gg_),.___SRow_1pye4_gg_:hover>.___SCell_1pye4_gg_._theme_info_1pye4_gg_{background-color:var(--intergalactic-table-td-cell-selected-hover, #c4e5fe)}}.___SRow_1pye4_gg_._theme_success_1pye4_gg_ .___SCell_1pye4_gg_:not(.__theme_1pye4_gg_){background-color:var(--intergalactic-table-td-cell-new, #dbfee8)}.___SRow_1pye4_gg_._theme_success_1pye4_gg_.__active_1pye4_gg_>.___SCell_1pye4_gg_:not(.__theme_1pye4_gg_){background-color:var(--intergalactic-table-td-cell-new-active, #9ef2c9)}@media (hover:hover){.___SRow_1pye4_gg_._theme_success_1pye4_gg_ .___SCell_1pye4_gg_:hover+.___SGroupCell_1pye4_gg_ .___SCell_1pye4_gg_:not(.__theme_1pye4_gg_),.___SRow_1pye4_gg_._theme_success_1pye4_gg_:hover>.___SCell_1pye4_gg_:not(.__theme_1pye4_gg_),.___SRow_1pye4_gg_:hover>.___SCell_1pye4_gg_._theme_success_1pye4_gg_{background-color:var(--intergalactic-table-td-cell-new-hover, #9ef2c9)}}.___SRow_1pye4_gg_._theme_warning_1pye4_gg_ .___SCell_1pye4_gg_:not(.__theme_1pye4_gg_){background-color:var(--intergalactic-table-td-cell-warning, #fff3d9)}.___SRow_1pye4_gg_._theme_warning_1pye4_gg_.__active_1pye4_gg_>.___SCell_1pye4_gg_:not(.__theme_1pye4_gg_){background-color:var(--intergalactic-table-td-cell-warning-active, #ffdca2)}@media (hover:hover){.___SRow_1pye4_gg_._theme_warning_1pye4_gg_ .___SCell_1pye4_gg_:hover+.___SGroupCell_1pye4_gg_ .___SCell_1pye4_gg_:not(.__theme_1pye4_gg_),.___SRow_1pye4_gg_._theme_warning_1pye4_gg_:hover>.___SCell_1pye4_gg_:not(.__theme_1pye4_gg_),.___SRow_1pye4_gg_:hover>.___SCell_1pye4_gg_._theme_warning_1pye4_gg_{background-color:var(--intergalactic-table-td-cell-warning-hover, #ffdca2)}}.___SRow_1pye4_gg_._theme_danger_1pye4_gg_ .___SCell_1pye4_gg_:not(.__theme_1pye4_gg_){background-color:var(--intergalactic-table-td-cell-critical, #fff0f7)}.___SRow_1pye4_gg_._theme_danger_1pye4_gg_.__active_1pye4_gg_>.___SCell_1pye4_gg_:not(.__theme_1pye4_gg_){background-color:var(--intergalactic-table-td-cell-critical-active, #ffd7df)}@media (hover:hover){.___SRow_1pye4_gg_._theme_danger_1pye4_gg_ .___SCell_1pye4_gg_:hover+.___SGroupCell_1pye4_gg_ .___SCell_1pye4_gg_:not(.__theme_1pye4_gg_),.___SRow_1pye4_gg_._theme_danger_1pye4_gg_:hover>.___SCell_1pye4_gg_:not(.__theme_1pye4_gg_),.___SRow_1pye4_gg_:hover>.___SCell_1pye4_gg_._theme_danger_1pye4_gg_{background-color:var(--intergalactic-table-td-cell-critical-hover, #ffd7df)}}.___SRow_1pye4_gg_.__positioned_1pye4_gg_{position:absolute}.___SBody_1pye4_gg_.__animationsDisabled_1pye4_gg_ .___SCell_1pye4_gg_{transition:none}.___SCell_1pye4_gg_{display:flex;flex:1;flex-basis:auto;font-size:var(--intergalactic-fs-200, 14px);line-height:var(--intergalactic-lh-200, 142%);color:var(--intergalactic-text-primary, #191b23);box-sizing:border-box;border-bottom:1px solid var(--intergalactic-border-secondary, #e0e1e9);overflow:hidden;white-space:nowrap;font-feature-settings:\"tnum\";font-variant-numeric:tabular-nums;transition:width calc(var(--intergalactic-duration-extra-fast, 100)*1ms) ease-in-out;outline:0}.___SCell_1pye4_gg_._use_primary_1pye4_gg_{padding:var(--intergalactic-spacing-3x, 12px);min-height:45px;background-color:var(--intergalactic-bg-primary-neutral, #ffffff)}.___SCell_1pye4_gg_._use_secondary_1pye4_gg_{padding:var(--intergalactic-spacing-2x, 8px);min-height:37px;background-color:var(--intergalactic-bg-primary-neutral, #ffffff)}.___SCell_1pye4_gg_.__fixed_1pye4_gg_{position:sticky;z-index:1}.___SCell_1pye4_gg_._theme_muted_1pye4_gg_{background-color:var(--intergalactic-table-td-cell-unread, #f4f5f9)}.___SCell_1pye4_gg_._theme_info_1pye4_gg_{background-color:var(--intergalactic-table-td-cell-selected, #e9f7ff)}.___SCell_1pye4_gg_._theme_success_1pye4_gg_{background-color:var(--intergalactic-table-td-cell-new, #dbfee8)}.___SCell_1pye4_gg_._theme_warning_1pye4_gg_{background-color:var(--intergalactic-table-td-cell-warning, #fff3d9)}.___SCell_1pye4_gg_._theme_danger_1pye4_gg_{background-color:var(--intergalactic-table-td-cell-critical, #fff0f7)}.___SCell_1pye4_gg_:focus-visible:not(.__fixed_1pye4_gg_){position:relative}.___SCell_1pye4_gg_:focus-visible::after{position:absolute;display:block;content:\"\";top:3px;right:3px;bottom:3px;left:3px;box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5));pointer-events:none}.___SHeightHold_1pye4_gg_{position:absolute;top:0;width:100%;pointer-events:none;z-index:-1}", /*__inner_css_end__*/"1pye4_gg_"),
28
- /*__reshadow_css_end__*/
29
- {
30
- "__SDataTable": "___SDataTable_1pye4_gg_",
31
- "__SHeadWrapper": "___SHeadWrapper_1pye4_gg_",
32
- "_sticky": "__sticky_1pye4_gg_",
33
- "__SHead": "___SHead_1pye4_gg_",
34
- "__SColumn": "___SColumn_1pye4_gg_",
35
- "_hidden": "__hidden_1pye4_gg_",
36
- "_use_primary": "_use_primary_1pye4_gg_",
37
- "_use_secondary": "_use_secondary_1pye4_gg_",
38
- "_group": "__group_1pye4_gg_",
39
- "_use": "__use_1pye4_gg_",
40
- "_groupHead": "__groupHead_1pye4_gg_",
41
- "_active": "__active_1pye4_gg_",
42
- "__SSortIcon": "___SSortIcon_1pye4_gg_",
43
- "_fixed": "__fixed_1pye4_gg_",
44
- "_borderLeft": "__borderLeft_1pye4_gg_",
45
- "__SCell": "___SCell_1pye4_gg_",
46
- "_borderRight": "__borderRight_1pye4_gg_",
47
- "__SSortWrapper": "___SSortWrapper_1pye4_gg_",
48
- "__SBodyWrapper": "___SBodyWrapper_1pye4_gg_",
49
- "__SBody": "___SBody_1pye4_gg_",
50
- "__SRow": "___SRow_1pye4_gg_",
51
- "_theme": "__theme_1pye4_gg_",
52
- "__SGroupCell": "___SGroupCell_1pye4_gg_",
53
- "_theme_muted": "_theme_muted_1pye4_gg_",
54
- "_theme_info": "_theme_info_1pye4_gg_",
55
- "_theme_success": "_theme_success_1pye4_gg_",
56
- "_theme_warning": "_theme_warning_1pye4_gg_",
57
- "_theme_danger": "_theme_danger_1pye4_gg_",
58
- "_positioned": "__positioned_1pye4_gg_",
59
- "_animationsDisabled": "__animationsDisabled_1pye4_gg_",
60
- "__SHeightHold": "___SHeightHold_1pye4_gg_",
61
- "_compact": "__compact_1pye4_gg_",
62
- "_sortable": "__sortable_1pye4_gg_",
63
- "_justifyContent_right": "_justifyContent_right_1pye4_gg_",
64
- "_resizable": "__resizable_1pye4_gg_"
65
- });
66
- import { isFocusInside } from '@semcore/utils/lib/use/useFocusLock';
67
- import { hasFocusableIn } from '@semcore/utils/lib/use/useFocusLock';
68
- import focusSourceEnhance from '@semcore/utils/lib/enhances/focusSourceEnhance';
69
- var reversedSortDirection = {
70
- desc: 'asc',
71
- asc: 'desc'
72
- };
73
- var defaultSortDirection = 'desc';
74
- var ROW_GROUP = Symbol('ROW_GROUP');
75
- var cssVarReg = /[:;\W]/g;
76
- var createCssVarForWidth = function createCssVarForWidth(name) {
77
- return "--".concat(name.replace(cssVarReg, '_'), "_width");
78
- };
79
- function setBorderGroupColumns(columns, side) {
80
- var firstColumn = columns[0];
81
- var lastColumn = columns[columns.length - 1];
82
- if (firstColumn && (!side || side === 'left')) {
83
- firstColumn.borderLeft = true;
84
- if (firstColumn.columns) {
85
- setBorderGroupColumns(firstColumn.columns, 'left');
86
- }
87
- }
88
- if (lastColumn && (!side || side === 'right')) {
89
- lastColumn.borderRight = true;
90
- if (lastColumn.columns) {
91
- setBorderGroupColumns(lastColumn.columns, 'right');
92
- }
93
- }
94
- }
95
- var RootDefinitionTable = /*#__PURE__*/function (_Component) {
96
- _inherits(RootDefinitionTable, _Component);
97
- var _super = _createSuper(RootDefinitionTable);
98
- function RootDefinitionTable(props) {
99
- var _this;
100
- _classCallCheck(this, RootDefinitionTable);
101
- _this = _super.call(this, props);
102
- _defineProperty(_assertThisInitialized(_this), "focusedCell", [-1, -1]);
103
- _defineProperty(_assertThisInitialized(_this), "columns", []);
104
- _defineProperty(_assertThisInitialized(_this), "tableRef", /*#__PURE__*/React.createRef());
105
- _defineProperty(_assertThisInitialized(_this), "scrollBodyRef", null);
106
- _defineProperty(_assertThisInitialized(_this), "scrollHeadRef", null);
107
- _defineProperty(_assertThisInitialized(_this), "handlerSortClick", function (name, event) {
108
- var column = _this.columns.find(function (column) {
109
- return column.name === name;
110
- });
111
- return fire(_assertThisInitialized(_this), 'onSortChange', [column.name, column.active ? reversedSortDirection[column.sortDirection] : column.sortDirection], event);
112
- });
113
- _defineProperty(_assertThisInitialized(_this), "handlerResize", function () {
114
- _this.forceUpdate();
115
- });
116
- _defineProperty(_assertThisInitialized(_this), "scrollToUp", function () {
117
- var _this$tableRef, _this$tableRef$curren;
118
- (_this$tableRef = _this.tableRef) === null || _this$tableRef === void 0 ? void 0 : (_this$tableRef$curren = _this$tableRef.current) === null || _this$tableRef$curren === void 0 ? void 0 : _this$tableRef$curren.scrollIntoView({
119
- block: 'nearest',
120
- inline: 'nearest',
121
- behavior: 'smooth'
122
- });
123
- });
124
- _defineProperty(_assertThisInitialized(_this), "hasFocusableInHeader", function () {
125
- var hasFocusable = _this.columns.some(function (column) {
126
- var columnElement = column.props.ref.current;
127
- return column.sortable || columnElement && hasFocusableIn(columnElement);
128
- });
129
- return hasFocusable;
130
- });
131
- _defineProperty(_assertThisInitialized(_this), "changeFocusCell", function (rowIndex, colIndex) {
132
- var _this$tableRef$curren2, _this$tableRef$curren3;
133
- var hasFocusable = _this.hasFocusableInHeader();
134
- var maxCol = _this.columns.length - 1;
135
- var maxRow = _this.totalRows;
136
- 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, "\"]"));
137
- var headerRow = (_this$tableRef$curren3 = _this.tableRef.current) === null || _this$tableRef$curren3 === void 0 ? void 0 : _this$tableRef$curren3.querySelector('[aria-rowindex="1"]');
138
- var headerCells = headerRow === null || headerRow === void 0 ? void 0 : headerRow.querySelectorAll('[role=columnheader]');
139
- var currentCell = currentRow === null || currentRow === void 0 ? void 0 : currentRow.querySelectorAll('[role=gridcell]').item(_this.focusedCell[1]);
140
- var currentHeaderCell = headerCells === null || headerCells === void 0 ? void 0 : headerCells.item(_this.focusedCell[1]);
141
- var changed = true;
142
- var newRow = _this.focusedCell[0] + rowIndex;
143
- var newCol = _this.focusedCell[1] + colIndex;
144
- if ((hasFocusable && newRow < 0 || !hasFocusable && newRow < 1 || newRow > maxRow) && newRow !== _this.focusedCell[0]) {
145
- changed = false;
146
- }
147
- if ((newCol < 0 || newCol > maxCol) && newCol !== _this.focusedCell[1]) {
148
- changed = false;
149
- }
150
- if (!changed) return;
151
- _this.focusedCell = [newRow, newCol];
152
- var row = _this.getRow(newRow);
153
- var cell = row === null || row === void 0 ? void 0 : row.querySelectorAll('[role=gridcell], [role=columnheader]').item(newCol);
154
- if (cell instanceof HTMLElement && currentCell !== cell) {
155
- currentCell === null || currentCell === void 0 ? void 0 : currentCell.setAttribute('inert', '');
156
- if (currentCell !== currentHeaderCell) {
157
- currentCell === null || currentCell === void 0 ? void 0 : currentCell.removeAttribute('aria-describedby');
158
- }
159
- var headerCell = headerCells === null || headerCells === void 0 ? void 0 : headerCells.item(newCol);
160
- var describedBy = headerCell === null || headerCell === void 0 ? void 0 : headerCell.getAttribute('aria-describedby');
161
- cell.removeAttribute('inert');
162
- if (headerCell !== cell && describedBy) {
163
- cell.setAttribute('aria-describedby', describedBy);
164
- }
165
- cell === null || cell === void 0 ? void 0 : cell.focus();
166
- if (newRow !== 0) {
167
- currentHeaderCell === null || currentHeaderCell === void 0 ? void 0 : currentHeaderCell.setAttribute('inert', '');
168
- var _headerCell = headerCells === null || headerCells === void 0 ? void 0 : headerCells.item(newCol);
169
- _headerCell === null || _headerCell === void 0 ? void 0 : _headerCell.removeAttribute('inert');
170
- }
171
- } else if (currentCell === cell) {
172
- _this.changeFocusCell(rowIndex, colIndex);
173
- }
174
- });
175
- _defineProperty(_assertThisInitialized(_this), "handleKeyDown", function (e) {
176
- switch (e.key) {
177
- case 'Tab':
178
- {
179
- _this.setInert(true);
180
- break;
181
- }
182
- case 'ArrowLeft':
183
- {
184
- e.preventDefault();
185
- _this.changeFocusCell(0, -1);
186
- break;
187
- }
188
- case 'ArrowRight':
189
- {
190
- e.preventDefault();
191
- _this.changeFocusCell(0, 1);
192
- break;
193
- }
194
- case 'ArrowUp':
195
- {
196
- e.preventDefault();
197
- _this.changeFocusCell(-1, 0);
198
- break;
199
- }
200
- case 'ArrowDown':
201
- {
202
- e.preventDefault();
203
- _this.changeFocusCell(1, 0);
204
- break;
205
- }
206
- }
207
- });
208
- _defineProperty(_assertThisInitialized(_this), "initFocusableCell", function () {
209
- var hasFocusable = _this.hasFocusableInHeader();
210
- if (hasFocusable) {
211
- _this.focusedCell = [0, 0];
212
- } else {
213
- _this.focusedCell = [1, 0];
214
- }
215
- });
216
- _defineProperty(_assertThisInitialized(_this), "getRow", function (index) {
217
- var _this$tableRef$curren4, _this$tableRef$curren5;
218
- return index === 0 ? (_this$tableRef$curren4 = _this.tableRef.current) === null || _this$tableRef$curren4 === void 0 ? void 0 : _this$tableRef$curren4.querySelector('[role=row]') : (_this$tableRef$curren5 = _this.tableRef.current) === null || _this$tableRef$curren5 === void 0 ? void 0 : _this$tableRef$curren5.querySelector("[aria-rowindex=\"".concat(index + 1, "\"]"));
219
- });
220
- _defineProperty(_assertThisInitialized(_this), "handleFocus", function (e) {
221
- var _this$asProps$focusSo;
222
- if ((!e.relatedTarget || !isFocusInside(e.currentTarget, e.relatedTarget)) && ((_this$asProps$focusSo = _this.asProps.focusSourceRef) === null || _this$asProps$focusSo === void 0 ? void 0 : _this$asProps$focusSo.current) === 'keyboard') {
223
- var _row2;
224
- if (_this.focusedCell[0] === -1 && _this.focusedCell[1] === -1) {
225
- _this.initFocusableCell();
226
- }
227
- _this.setInert(true);
228
- var _row = _this.getRow(_this.focusedCell[0]);
229
- if (!_row) {
230
- _this.initFocusableCell();
231
- _row = _this.getRow(_this.focusedCell[0]);
232
- }
233
- var cell = (_row2 = _row) === null || _row2 === void 0 ? void 0 : _row2.querySelectorAll('[role=gridcell], [role=columnheader]').item(_this.focusedCell[1]);
234
- cell === null || cell === void 0 ? void 0 : cell.removeAttribute('inert');
235
- cell instanceof HTMLElement && cell.focus();
236
- e.currentTarget.setAttribute('tabIndex', '-1');
237
- }
238
- });
239
- _defineProperty(_assertThisInitialized(_this), "handleBlur", function (e) {
240
- var _this$asProps$focusSo2;
241
- var relatedTarget = e.relatedTarget;
242
- var tableElement = _this.tableRef.current;
243
- if (tableElement && (!relatedTarget || !isFocusInside(tableElement, relatedTarget) || ((_this$asProps$focusSo2 = _this.asProps.focusSourceRef) === null || _this$asProps$focusSo2 === void 0 ? void 0 : _this$asProps$focusSo2.current) !== 'keyboard')) {
244
- _this.setInert(false);
245
- tableElement.setAttribute('tabIndex', '0');
246
- }
247
- });
248
- _defineProperty(_assertThisInitialized(_this), "handleMouseMove", function () {
249
- _this.setInert(false);
250
- });
251
- var createRef = syncScroll();
252
- // first create body ref for master scroll
253
- _this.scrollBodyRef = createRef('body');
254
- _this.scrollHeadRef = createRef('head');
255
- return _this;
256
- }
257
- _createClass(RootDefinitionTable, [{
258
- key: "setVarStyle",
259
- value: function setVarStyle(columns) {
260
- var _this2 = this;
261
- var animations = columns.flatMap(function (column) {
262
- var _column$props$ref$cur, _column$props$ref$cur2;
263
- return (_column$props$ref$cur = column.props.ref.current) === null || _column$props$ref$cur === void 0 ? void 0 : (_column$props$ref$cur2 = _column$props$ref$cur.getAnimations) === null || _column$props$ref$cur2 === void 0 ? void 0 : _column$props$ref$cur2.call(_column$props$ref$cur);
264
- }).filter(function (a) {
265
- return a !== undefined;
266
- });
267
- var animationPromise = Promise.resolve();
268
- if (animations.length > 0) {
269
- animationPromise = Promise.all(animations.map(function (animation) {
270
- return animation.finished;
271
- }));
272
- }
273
- animationPromise.then(function () {
274
- var _iterator = _createForOfIteratorHelper(columns),
275
- _step;
276
- try {
277
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
278
- var column = _step.value;
279
- if (column.setVar) {
280
- var _this2$tableRef$curre;
281
- (_this2$tableRef$curre = _this2.tableRef.current) === null || _this2$tableRef$curre === void 0 ? void 0 : _this2$tableRef$curre.style.setProperty(column.varWidth, "".concat(column.width, "px"));
282
- }
283
- }
284
- } catch (err) {
285
- _iterator.e(err);
286
- } finally {
287
- _iterator.f();
288
- }
289
- })["catch"](function (err) {
290
- console.error(err);
291
- });
292
- }
293
- }, {
294
- key: "childrenToColumns",
295
- value: function childrenToColumns(children) {
296
- var _this3 = this;
297
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
298
- fixed: undefined
299
- };
300
- var sort = this.asProps.sort;
301
- var columnsChildren = [];
302
- React.Children.forEach(children, function (child) {
303
- var _column$props;
304
- if (! /*#__PURE__*/React.isValidElement(child)) return;
305
- if (child.type !== DefinitionTable.Column) return;
306
- var _ref3 = child.props,
307
- children = _ref3.children,
308
- name = _ref3.name,
309
- _ref3$fixed = _ref3.fixed,
310
- fixed = _ref3$fixed === void 0 ? options.fixed : _ref3$fixed,
311
- resizable = _ref3.resizable,
312
- sortable = _ref3.sortable,
313
- flex = _ref3.flex,
314
- vBorders = _ref3.vBorders,
315
- active = _ref3.active,
316
- props = _objectWithoutProperties(_ref3, _excluded);
317
- var lastColumnChildren = columnsChildren[columnsChildren.length - 1];
318
- var isGroup = !name;
319
- var columns;
320
- if (isGroup) {
321
- columns = _this3.childrenToColumns(children, {
322
- fixed: fixed
323
- });
324
- active = typeof active === 'boolean' ? active : columns.some(function (c) {
325
- return c.active;
326
- });
327
- if (vBorders) {
328
- setBorderGroupColumns(columns);
329
- }
330
- name = flattenColumns(columns).map(function (_ref4) {
331
- var name = _ref4.name;
332
- return name;
333
- }).join('/');
334
- if (!columns.length) return;
335
- children = React.Children.toArray(children).filter(function (child) {
336
- return !( /*#__PURE__*/React.isValidElement(child) && child.type === DefinitionTable.Column);
337
- });
338
- }
339
- var column = _this3.columns.find(function (column) {
340
- return column.name === name;
341
- });
342
- var columnChildren = {
343
- get width() {
344
- var _this$props$ref$curre;
345
- // @ts-ignore
346
- return ((_this$props$ref$curre = this.props.ref.current) === null || _this$props$ref$curre === void 0 ? void 0 : _this$props$ref$curre.getBoundingClientRect().width) || 0;
347
- },
348
- name: name,
349
- varWidth: createCssVarForWidth(name),
350
- setVar: flex !== 'inherit',
351
- fixed: fixed,
352
- resizable: resizable,
353
- active: typeof active === 'boolean' ? active : sort[0] === name,
354
- sortable: sortable,
355
- borderLeft: (lastColumnChildren === null || lastColumnChildren === void 0 ? void 0 : lastColumnChildren.borderRight) === true ? false : vBorders,
356
- borderRight: vBorders,
357
- sortDirection: sort[0] === name ? sort[1] : (column === null || column === void 0 ? void 0 : column.sortDirection) || (typeof sortable === 'string' ? sortable : defaultSortDirection),
358
- props: _objectSpread(_objectSpread({
359
- name: name,
360
- flex: flex === 'inherit' ? undefined : flex
361
- }, props), {}, {
362
- // @ts-ignore
363
- forwardRef: child.ref,
364
- children: children,
365
- ref: (column === null || column === void 0 ? void 0 : (_column$props = column.props) === null || _column$props === void 0 ? void 0 : _column$props.ref) || /*#__PURE__*/React.createRef()
366
- }),
367
- parentColumns: []
368
- };
369
- if (columns) {
370
- columnChildren.columns = columns;
371
- columns.forEach(function (column) {
372
- return column.parentColumns.unshift(columnChildren);
373
- });
374
- }
375
- columnsChildren.push(columnChildren);
376
- });
377
- return columnsChildren;
378
- }
379
- }, {
380
- key: "getHeadProps",
381
- value: function getHeadProps(props) {
382
- var _this$asProps = this.asProps,
383
- use = _this$asProps.use,
384
- uid = _this$asProps.uid,
385
- getI18nText = _this$asProps.getI18nText;
386
- var columnsChildren = this.childrenToColumns(props.children);
387
- this.columns = flattenColumns(columnsChildren);
388
- return {
389
- $onSortClick: callAllEventHandlers(this.handlerSortClick, this.scrollToUp),
390
- columnsChildren: columnsChildren,
391
- use: use,
392
- onResize: this.handlerResize,
393
- $scrollRef: this.scrollHeadRef,
394
- uid: uid,
395
- getI18nText: getI18nText
396
- };
397
- }
398
- }, {
399
- key: "getBodyProps",
400
- value: function getBodyProps(props) {
401
- var _this$asProps2 = this.asProps,
402
- data = _this$asProps2.data,
403
- use = _this$asProps2.use,
404
- uniqueKey = _this$asProps2.uniqueKey,
405
- uid = _this$asProps2.uid;
406
- var cellPropsLayers = {};
407
- var rowPropsLayers = [];
408
- React.Children.forEach(props.children, function (child) {
409
- if ( /*#__PURE__*/React.isValidElement(child)) {
410
- var _ref5 = child.props,
411
- name = _ref5.name,
412
- children = _ref5.children,
413
- other = _objectWithoutProperties(_ref5, _excluded2);
414
- if (child.type === DefinitionTable.Cell && name) {
415
- name.split('/').forEach(function (name) {
416
- cellPropsLayers[name] = cellPropsLayers[name] || [];
417
- cellPropsLayers[name].push(_objectSpread(_objectSpread({}, other), {}, {
418
- childrenPropsGetter: children
419
- }));
420
- });
421
- }
422
- if (child.type === DefinitionTable.Row) {
423
- rowPropsLayers.push(_objectSpread(_objectSpread({}, other), {}, {
424
- childrenPropsGetter: children
425
- }));
426
- }
427
- }
428
- });
429
- return {
430
- columns: this.columns,
431
- rows: this.dataToRows(data, cellPropsLayers),
432
- uniqueKey: uniqueKey,
433
- use: use,
434
- rowPropsLayers: rowPropsLayers,
435
- $scrollRef: this.scrollBodyRef,
436
- uid: uid
437
- };
438
- }
439
- }, {
440
- key: "dataToRows",
441
- value: function dataToRows(data, cellPropsLayers) {
442
- var _this4 = this;
443
- var parseData = function parseData(data, exclude) {
444
- return data.map(function (row) {
445
- var groupByName = {};
446
- var columnsWithoutRowGroup = {};
447
- for (var rowKey in row) {
448
- var columnNames = rowKey.split('/');
449
- if (columnNames.length >= 2) {
450
- var _iterator2 = _createForOfIteratorHelper(columnNames),
451
- _step2;
452
- try {
453
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
454
- var column = _step2.value;
455
- groupByName[column] = {
456
- groupedColumns: columnNames,
457
- groupData: row[rowKey]
458
- };
459
- columnsWithoutRowGroup[column] = true;
460
- }
461
- } catch (err) {
462
- _iterator2.e(err);
463
- } finally {
464
- _iterator2.f();
465
- }
466
- } else {
467
- columnsWithoutRowGroup[rowKey] = true;
468
- }
469
- }
470
- var rowsGroup = row[ROW_GROUP] || [];
471
- var rowsGroupedNames = Object.fromEntries(rowsGroup.flatMap(function (subRow) {
472
- return Object.keys(subRow);
473
- }).flatMap(function (key) {
474
- return key.split('/');
475
- }).map(function (key) {
476
- return [key, true];
477
- }));
478
- var isGroup = false;
479
- var cells = _this4.columns.map(function (column) {
480
- if (groupByName[column.name]) {
481
- var _groupByName$column$n = groupByName[column.name],
482
- groupedColumns = _groupByName$column$n.groupedColumns,
483
- groupData = _groupByName$column$n.groupData;
484
- if (groupedColumns[0] === column.name) {
485
- return {
486
- name: groupedColumns.join('/'),
487
- cssVar: groupedColumns.map(createCssVarForWidth),
488
- fixed: column.fixed,
489
- data: groupData,
490
- cellPropsLayers: cellPropsLayers[column.name] || []
491
- };
492
- }
493
- } else if (column.name in row) {
494
- return {
495
- name: column.name,
496
- cssVar: column.varWidth,
497
- fixed: column.fixed,
498
- data: row[column.name],
499
- cellPropsLayers: cellPropsLayers[column.name] || []
500
- };
501
- } else if (!isGroup && rowsGroupedNames[column.name]) {
502
- // TODO: make it work not only with first group
503
- isGroup = true;
504
- return parseData(rowsGroup, _objectSpread(_objectSpread({}, exclude), columnsWithoutRowGroup));
505
- } else if (!exclude[column.name] && !rowsGroupedNames[column.name]) {
506
- // add empty cell if it is not present in data
507
- return {
508
- name: column.name,
509
- cssVar: column.varWidth,
510
- fixed: column.fixed,
511
- data: null,
512
- cellPropsLayers: cellPropsLayers[column.name] || []
513
- };
514
- }
515
- }).filter(function (column) {
516
- return column;
517
- }).map(function (column) {
518
- return column;
519
- });
520
- cells.flatRowData = row;
521
- return cells;
522
- });
523
- };
524
- return parseData(data, {});
525
- }
526
- }, {
527
- key: "componentDidMount",
528
- value: function componentDidMount() {
529
- this.setVarStyle(this.columns);
530
- }
531
- }, {
532
- key: "componentDidUpdate",
533
- value: function componentDidUpdate(prevProps) {
534
- this.setVarStyle(this.columns);
535
- if (prevProps.data !== this.props.data) {
536
- var focusedRow = this.focusedCell[0];
537
- var isFocusInHeader = focusedRow === 0 && this.hasFocusableInHeader();
538
- if (this.tableRef.current && !isFocusInside(this.tableRef.current) && !isFocusInHeader) {
539
- this.focusedCell = [-1, -1];
540
- }
541
- }
542
- }
543
- }, {
544
- key: "totalRows",
545
- get: function get() {
546
- var _this$asProps3 = this.asProps,
547
- data = _this$asProps3.data,
548
- totalRows = _this$asProps3.totalRows;
549
- return totalRows !== null && totalRows !== void 0 ? totalRows : (data !== null && data !== void 0 ? data : []).length;
550
- }
551
- }, {
552
- key: "setInert",
553
- value: function setInert(value) {
554
- var _this$tableRef$curren6;
555
- var cells = (_this$tableRef$curren6 = this.tableRef.current) === null || _this$tableRef$curren6 === void 0 ? void 0 : _this$tableRef$curren6.querySelectorAll('[role=gridcell], [role=columnheader]');
556
- cells === null || cells === void 0 ? void 0 : cells.forEach(function (cell) {
557
- if (value === true) {
558
- cell.setAttribute('inert', '');
559
- } else {
560
- cell.removeAttribute('inert');
561
- }
562
- });
563
- }
564
- }, {
565
- key: "render",
566
- value: function render() {
567
- var _ref = this.asProps,
568
- _ref2;
569
- var SDataTable = Box;
570
- var _this$asProps4 = this.asProps,
571
- Children = _this$asProps4.Children,
572
- styles = _this$asProps4.styles;
573
- return _ref2 = sstyled(styles), /*#__PURE__*/React.createElement(SDataTable, _ref2.cn("SDataTable", _objectSpread({}, _assignProps({
574
- "__excludeProps": ['data'],
575
- "ref": this.tableRef,
576
- "role": 'grid',
577
- "onKeyDown": this.handleKeyDown,
578
- "onMouseMove": this.handleMouseMove,
579
- "tabIndex": 0,
580
- "onFocus": this.handleFocus,
581
- "onBlur": this.handleBlur,
582
- "aria-rowcount": this.totalRows,
583
- "aria-colcount": this.columns.length
584
- }, _ref))), /*#__PURE__*/React.createElement(Children, _ref2.cn("Children", {})));
585
- }
586
- }]);
587
- return RootDefinitionTable;
588
- }(Component);
589
- _defineProperty(RootDefinitionTable, "displayName", 'DefinitionTable');
590
- _defineProperty(RootDefinitionTable, "style", style);
591
- _defineProperty(RootDefinitionTable, "enhance", [uniqueIDEnhancement(), i18nEnhance(localizedMessages), focusSourceEnhance()]);
592
- _defineProperty(RootDefinitionTable, "defaultProps", {
593
- use: 'primary',
594
- uniqueKey: 'id',
595
- sort: [],
596
- data: []
597
- });
598
- function ComponentDefinition() {
599
- return null;
600
- }
601
- var DefinitionTable = createComponent(RootDefinitionTable, {
602
- Head: Head,
603
- Body: Body,
604
- Column: ComponentDefinition,
605
- Cell: ComponentDefinition,
606
- Row: ComponentDefinition
607
- }, {});
608
- export { ROW_GROUP };
609
- export default DefinitionTable;
610
- export var wrapDataTable = function wrapDataTable(wrapper) {
611
- return wrapper;
612
- };
613
- export var wrapDataTableRow = function wrapDataTableRow(wrapper) {
614
- return wrapper;
615
- };
616
- export var wrapDataTableCell = function wrapDataTableCell(wrapper) {
617
- return wrapper;
618
- };
619
- //# sourceMappingURL=DataTable.js.map