@semcore/data-table 16.5.3-prerelease.4 → 17.0.0-prerelease.17

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