@semcore/data-table 17.0.0-prerelease.36 → 17.0.0-prerelease.37

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.
@@ -1,6 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import { createComponent, Component, lastInteraction, sstyled, assignProps } from "@semcore/core";
3
- import { ScrollArea, Box, ScreenReaderOnly } from "@semcore/base-components";
2
+ import { sstyled, Component, lastInteraction, assignProps, createComponent } from "@semcore/core";
3
+ import { Box, ScrollArea, ScreenReaderOnly } from "@semcore/base-components";
4
4
  import canUseDOM from "@semcore/core/lib/utils/canUseDOM";
5
5
  import i18nEnhance from "@semcore/core/lib/utils/enhances/i18nEnhance";
6
6
  import findComponent from "@semcore/core/lib/utils/findComponent";
@@ -16,7 +16,6 @@ import { localizedMessages } from "../../translations/__intergalactic-dynamic-lo
16
16
  import { Body } from "../Body/Body.mjs";
17
17
  import { MergedRowsCell, MergedColumnsCell } from "../Body/MergedCells.mjs";
18
18
  import { Head } from "../Head/Head.mjs";
19
- /*!__reshadow-styles__:"./dataTable.shadow.css"*/
20
19
  const style = (
21
20
  /*__reshadow_css_start__*/
22
21
  (sstyled.insert(
@@ -36,7 +35,6 @@ const style = (
36
35
  "--gridTemplateRows": "--gridTemplateRows_wo0cb"
37
36
  })
38
37
  );
39
- /*!__reshadow-styles__:"../../style/scroll-shadows.shadow.css"*/
40
38
  const scrollStyles = (
41
39
  /*__reshadow_css_start__*/
42
40
  (sstyled.insert(
@@ -64,13 +62,13 @@ const scrollStyles = (
64
62
  "_rightOffset": "__rightOffset_j4820_gg_"
65
63
  })
66
64
  );
67
- const ACCORDION = Symbol("accordion");
68
- const ROW_GROUP = Symbol("ROW_GROUP");
69
- const UNIQ_ROW_KEY = Symbol("UNIQ_ROW_KEY");
70
- const IS_EMPTY_DATA_ROW = Symbol("IS_EMPTY_DATA_ROW");
71
- const SELECT_ALL = Symbol("SELECT_ALL");
72
- const ROW_INDEX = Symbol("ROW_INDEX");
73
- const GRID_ROW_INDEX = Symbol("GRID_ROW_INDEX");
65
+ const ACCORDION = /* @__PURE__ */ Symbol("accordion");
66
+ const ROW_GROUP = /* @__PURE__ */ Symbol("ROW_GROUP");
67
+ const UNIQ_ROW_KEY = /* @__PURE__ */ Symbol("UNIQ_ROW_KEY");
68
+ const IS_EMPTY_DATA_ROW = /* @__PURE__ */ Symbol("IS_EMPTY_DATA_ROW");
69
+ const SELECT_ALL = /* @__PURE__ */ Symbol("SELECT_ALL");
70
+ const ROW_INDEX = /* @__PURE__ */ Symbol("ROW_INDEX");
71
+ const GRID_ROW_INDEX = /* @__PURE__ */ Symbol("GRID_ROW_INDEX");
74
72
  const SCROLL_BAR_HEIGHT = 12;
75
73
  class DataTableRoot extends Component {
76
74
  static getDerivedStateFromProps(props, state) {
@@ -115,7 +113,6 @@ class DataTableRoot extends Component {
115
113
  expandedRows: /* @__PURE__ */ new Set()
116
114
  });
117
115
  _defineProperty(this, "handleDocumentScroll", trottle(() => {
118
- var _a;
119
116
  const tableContainer = this.tableContainerRef.current;
120
117
  if (!tableContainer) return;
121
118
  const tableContainerTop = tableContainer.getBoundingClientRect().top;
@@ -123,12 +120,12 @@ class DataTableRoot extends Component {
123
120
  headerProps
124
121
  } = this.asProps;
125
122
  const headerContainer = this.headerRef.current;
126
- const elements = headerContainer == null ? void 0 : headerContainer.querySelectorAll('[role="columnheader"], [data-ui-name="Head.Group"]');
127
- const top = tableContainerTop - ((headerProps == null ? void 0 : headerProps.top) ?? 0);
128
- const headerScrollBar = (headerProps == null ? void 0 : headerProps.withScrollBar) ? (_a = this.scrollAreaRef.current) == null ? void 0 : _a.querySelector(`[role=scrollbar][aria-orientation=horizontal]`) : void 0;
123
+ const elements = headerContainer?.querySelectorAll('[role="columnheader"], [data-ui-name="Head.Group"]');
124
+ const top = tableContainerTop - (headerProps?.top ?? 0);
125
+ const headerScrollBar = headerProps?.withScrollBar ? this.scrollAreaRef.current?.querySelector(`[role=scrollbar][aria-orientation=horizontal]`) : void 0;
129
126
  if (top && top < 0) {
130
127
  const translate = `translateY(${Math.abs(top)}px)`;
131
- elements == null ? void 0 : elements.forEach((column) => {
128
+ elements?.forEach((column) => {
132
129
  if (column instanceof HTMLElement) {
133
130
  column.style.setProperty("transform", translate);
134
131
  }
@@ -137,7 +134,7 @@ class DataTableRoot extends Component {
137
134
  headerScrollBar.style.setProperty("transform", translate);
138
135
  }
139
136
  } else {
140
- elements == null ? void 0 : elements.forEach((column) => {
137
+ elements?.forEach((column) => {
141
138
  if (column instanceof HTMLElement) {
142
139
  column.style.removeProperty("transform");
143
140
  }
@@ -223,8 +220,7 @@ class DataTableRoot extends Component {
223
220
  }, 5e3);
224
221
  });
225
222
  _defineProperty(this, "getRow", (index) => {
226
- var _a;
227
- 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"])`);
223
+ return this.tableRef.current?.querySelector(`:scope [aria-rowindex="${index + 1}"]:not([aria-hidden="true"]):not(:scope [data-ui-name="DataTable"] [aria-rowindex="${index + 1}"]:not([aria-hidden="true"])`);
228
224
  });
229
225
  _defineProperty(this, "hasFocusableInHeader", () => {
230
226
  return this.headerRef.current && hasFocusableIn(this.headerRef.current) || this.columns.some((column) => column.sortable);
@@ -237,10 +233,10 @@ class DataTableRoot extends Component {
237
233
  const expandedRows = this.state.expandedRows;
238
234
  if (expandedRows.has(expandedRow[UNIQ_ROW_KEY])) {
239
235
  expandedRows.delete(expandedRow[UNIQ_ROW_KEY]);
240
- onAccordionToggle == null ? void 0 : onAccordionToggle("close", expandedRow[UNIQ_ROW_KEY], expandedRow[ROW_INDEX]);
236
+ onAccordionToggle?.("close", expandedRow[UNIQ_ROW_KEY], expandedRow[ROW_INDEX]);
241
237
  } else {
242
238
  expandedRows.add(expandedRow[UNIQ_ROW_KEY]);
243
- onAccordionToggle == null ? void 0 : onAccordionToggle("open", expandedRow[UNIQ_ROW_KEY], expandedRow[ROW_INDEX]);
239
+ onAccordionToggle?.("open", expandedRow[UNIQ_ROW_KEY], expandedRow[ROW_INDEX]);
244
240
  if (accordionMode === "toggle") {
245
241
  const rowIndex = expandedRow[ROW_INDEX];
246
242
  const colIndex = this.focusedCell[1];
@@ -249,17 +245,16 @@ class DataTableRoot extends Component {
249
245
  }
250
246
  });
251
247
  _defineProperty(this, "changeFocusCell", (rowIndex, colIndex, direction) => {
252
- var _a, _b, _c, _d;
253
248
  const {
254
249
  limit
255
250
  } = this.asProps;
256
251
  const hasFocusable = this.hasFocusableInHeader();
257
252
  const maxCol = this.columns.length - 1;
258
253
  const maxRow = this.totalRows || 1;
259
- const currentRow = (_a = this.tableRef.current) == null ? void 0 : _a.querySelector(`[aria-rowindex="${this.focusedCell[0] + 1}"]`);
260
- const headerCells = (_b = this.tableRef.current) == null ? void 0 : _b.querySelectorAll("[role=columnheader]");
261
- const currentCell = currentRow == null ? void 0 : currentRow.querySelector(`[role=gridcell][aria-colindex='${this.focusedCell[1] + 1}']`);
262
- const currentHeaderCell = headerCells == null ? void 0 : headerCells.item(this.focusedCell[1]);
254
+ const currentRow = this.tableRef.current?.querySelector(`[aria-rowindex="${this.focusedCell[0] + 1}"]`);
255
+ const headerCells = this.tableRef.current?.querySelectorAll("[role=columnheader]");
256
+ const currentCell = currentRow?.querySelector(`[role=gridcell][aria-colindex='${this.focusedCell[1] + 1}']`);
257
+ const currentHeaderCell = headerCells?.item(this.focusedCell[1]);
263
258
  let changed = true;
264
259
  const newRow = this.focusedCell[0] + rowIndex;
265
260
  const newCol = this.focusedCell[1] + colIndex;
@@ -271,26 +266,26 @@ class DataTableRoot extends Component {
271
266
  }
272
267
  if (!changed) return;
273
268
  const row = this.getRow(newRow);
274
- 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"])`);
269
+ const cell = 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"])`);
275
270
  if (cell instanceof HTMLElement && currentCell !== cell) {
276
271
  this.focusedCell = [newRow, newCol];
277
- currentCell == null ? void 0 : currentCell.setAttribute("inert", "");
272
+ currentCell?.setAttribute("inert", "");
278
273
  if (currentCell !== currentHeaderCell) {
279
- currentCell == null ? void 0 : currentCell.removeAttribute("aria-describedby");
274
+ currentCell?.removeAttribute("aria-describedby");
280
275
  }
281
- const headerCell = headerCells == null ? void 0 : headerCells.item(newCol);
282
- const describedBy = headerCell == null ? void 0 : headerCell.getAttribute("aria-describedby");
276
+ const headerCell = headerCells?.item(newCol);
277
+ const describedBy = headerCell?.getAttribute("aria-describedby");
283
278
  cell.removeAttribute("inert");
284
279
  if (headerCell !== cell && describedBy) {
285
280
  cell.setAttribute("aria-describedby", describedBy);
286
281
  }
287
- cell == null ? void 0 : cell.focus({
282
+ cell?.focus({
288
283
  focusVisible: true
289
284
  });
290
285
  if (newRow !== 0) {
291
- currentHeaderCell == null ? void 0 : currentHeaderCell.setAttribute("inert", "");
292
- const headerCell2 = headerCells == null ? void 0 : headerCells.item(newCol);
293
- headerCell2 == null ? void 0 : headerCell2.removeAttribute("inert");
286
+ currentHeaderCell?.setAttribute("inert", "");
287
+ const headerCell2 = headerCells?.item(newCol);
288
+ headerCell2?.removeAttribute("inert");
294
289
  }
295
290
  } else if (cell === null && currentCell instanceof HTMLElement) {
296
291
  let rowI = rowIndex;
@@ -298,20 +293,20 @@ class DataTableRoot extends Component {
298
293
  const colspan = Number(currentCell.getAttribute("aria-colspan"));
299
294
  const rowspan = Number(currentCell.getAttribute("aria-rowspan"));
300
295
  if (direction === "left" || direction === "right") {
301
- if (((_d = (_c = currentCell.parentElement) == null ? void 0 : _c.parentElement) == null ? void 0 : _d.dataset.uiName) === "Collapse") {
296
+ if (currentCell.parentElement?.parentElement?.dataset.uiName === "Collapse") {
302
297
  return;
303
298
  }
304
- if ((limit == null ? void 0 : limit.fromRow) !== void 0 && limit.fromColumn === void 0 && newCol === limit.fromRow) {
299
+ if (limit?.fromRow !== void 0 && limit.fromColumn === void 0 && newCol === limit.fromRow) {
305
300
  return;
306
301
  }
307
302
  const hasRowSpanUpper = row instanceof HTMLElement && Number(row.dataset.filledColumns) < this.columns.length;
308
303
  if (colspan > 0) {
309
- if (direction === "right" && (limit == null ? void 0 : limit.fromColumn) !== void 0 && newCol === limit.fromColumn) {
304
+ if (direction === "right" && limit?.fromColumn !== void 0 && newCol === limit.fromColumn) {
310
305
  rowI = rowI - 1;
311
306
  } else {
312
307
  colI = direction === "left" ? colI - colspan + 1 : colI + colspan - 1;
313
308
  }
314
- } else if (hasRowSpanUpper || direction === "right" && ((limit == null ? void 0 : limit.fromColumn) !== void 0 || (limit == null ? void 0 : limit.fromRow) !== void 0)) {
309
+ } else if (hasRowSpanUpper || direction === "right" && (limit?.fromColumn !== void 0 || limit?.fromRow !== void 0)) {
315
310
  rowI = rowI - 1;
316
311
  } else {
317
312
  colI = direction === "left" ? colI - 1 : colI + 1;
@@ -322,8 +317,8 @@ class DataTableRoot extends Component {
322
317
  } else if (Number(currentCell.getAttribute("aria-colindex")) === 1) {
323
318
  rowI = direction === "up" ? rowI - 1 : rowI + 1;
324
319
  } else {
325
- const areLimitsDefined = (limit == null ? void 0 : limit.fromRow) !== void 0 || (limit == null ? void 0 : limit.fromColumn) !== void 0;
326
- if (areLimitsDefined && newRow > ((limit == null ? void 0 : limit.fromRow) ?? 0) + 1) {
320
+ const areLimitsDefined = limit?.fromRow !== void 0 || limit?.fromColumn !== void 0;
321
+ if (areLimitsDefined && newRow > (limit?.fromRow ?? 0) + 1) {
327
322
  return;
328
323
  }
329
324
  const hasRowSpanUpper = row instanceof HTMLElement && currentRow instanceof HTMLElement && row.dataset.filledColumns !== currentRow.dataset.filledColumns;
@@ -402,8 +397,8 @@ class DataTableRoot extends Component {
402
397
  const roundedScroll = Math.round(scrollLeft);
403
398
  const roundedMaxScroll = Math.round(maxScrollRight);
404
399
  let shadow = "";
405
- if (roundedMaxScroll <= 0) ;
406
- else if (roundedScroll <= 0) {
400
+ if (roundedMaxScroll <= 0) {
401
+ } else if (roundedScroll <= 0) {
407
402
  shadow = "end";
408
403
  } else if (roundedScroll >= roundedMaxScroll) {
409
404
  shadow = "start";
@@ -415,12 +410,11 @@ class DataTableRoot extends Component {
415
410
  });
416
411
  });
417
412
  _defineProperty(this, "handleFocus", (e) => {
418
- var _a, _b, _c, _d, _e;
419
413
  if (this.asProps.loading) {
420
- (_a = this.spinnerRef.current) == null ? void 0 : _a.focus();
414
+ this.spinnerRef.current?.focus();
421
415
  e.currentTarget.setAttribute("tabIndex", "-1");
422
416
  if (this.isDataEmpty) {
423
- (_b = this.headerRef.current) == null ? void 0 : _b.setAttribute("tabIndex", "-1");
417
+ this.headerRef.current?.setAttribute("tabIndex", "-1");
424
418
  }
425
419
  } else if ((!e.relatedTarget || !isFocusInside(e.currentTarget, e.relatedTarget)) && lastInteraction.isKeyboard()) {
426
420
  if (this.focusedCell[0] === -1 && this.focusedCell[1] === -1) {
@@ -433,8 +427,8 @@ class DataTableRoot extends Component {
433
427
  row = this.getRow(this.focusedCell[0]);
434
428
  }
435
429
  if (!row && this.asProps.virtualScroll) {
436
- const firstAvailableCell = (_c = this.tableRef.current) == null ? void 0 : _c.querySelector(`[role="gridcell"]`);
437
- const firstAvailableRow = (_d = firstAvailableCell == null ? void 0 : firstAvailableCell.parentElement) == null ? void 0 : _d.parentElement;
430
+ const firstAvailableCell = this.tableRef.current?.querySelector(`[role="gridcell"]`);
431
+ const firstAvailableRow = firstAvailableCell?.parentElement?.parentElement;
438
432
  if (firstAvailableCell && firstAvailableRow) {
439
433
  const colIndex = Number(firstAvailableCell.getAttribute("aria-colindex") ?? 1) - 1;
440
434
  const rowIndex = Number(firstAvailableRow.getAttribute("aria-rowindex") ?? 1) - 1;
@@ -444,8 +438,8 @@ class DataTableRoot extends Component {
444
438
  }
445
439
  }
446
440
  const colindex = this.focusedCell[1];
447
- 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;
448
- cell == null ? void 0 : cell.removeAttribute("inert");
441
+ const cell = colindex > -1 ? row?.querySelector(`[role=gridcell][aria-colindex="${colindex + 1}"]:not([aria-hidden="true"]), [role=columnheader][aria-colindex="${colindex + 1}"]:not([aria-hidden="true"])`) : void 0;
442
+ cell?.removeAttribute("inert");
449
443
  if (cell instanceof HTMLElement) {
450
444
  if (hasParent(e.target, cell) && !e.target.dataset.skipTargetFocus) {
451
445
  e.target.focus({
@@ -458,20 +452,19 @@ class DataTableRoot extends Component {
458
452
  }
459
453
  }
460
454
  if (this.isDataEmpty) {
461
- (_e = this.headerRef.current) == null ? void 0 : _e.setAttribute("tabIndex", "-1");
455
+ this.headerRef.current?.setAttribute("tabIndex", "-1");
462
456
  }
463
457
  e.currentTarget.setAttribute("tabIndex", "-1");
464
458
  }
465
459
  });
466
460
  _defineProperty(this, "handleBlur", (e) => {
467
- var _a;
468
461
  const relatedTarget = e.relatedTarget;
469
462
  const tableElement = this.tableRef.current;
470
463
  if (tableElement && (!relatedTarget || !isFocusInside(tableElement, relatedTarget) || !lastInteraction.isKeyboard())) {
471
464
  this.setInert(false);
472
465
  tableElement.setAttribute("tabIndex", "0");
473
466
  if (this.isDataEmpty) {
474
- (_a = this.headerRef.current) == null ? void 0 : _a.setAttribute("tabIndex", "0");
467
+ this.headerRef.current?.setAttribute("tabIndex", "0");
475
468
  }
476
469
  }
477
470
  });
@@ -483,12 +476,11 @@ class DataTableRoot extends Component {
483
476
  this.changeFocusCell(-1, cellIndex === -1 ? 0 : cellIndex, "up");
484
477
  });
485
478
  _defineProperty(this, "handleContainerResizeEnd", (entries, observer) => {
486
- var _a, _b;
487
479
  if (this.containerResizeEndTimeoutId) {
488
480
  clearTimeout(this.containerResizeEndTimeoutId);
489
481
  }
490
482
  this.containerResizeEndTimeoutId = setTimeout(this.calculateVerticalShadow, 0);
491
- (_b = (_a = this.asProps).onResize) == null ? void 0 : _b.call(_a, entries, observer);
483
+ this.asProps.onResize?.(entries, observer);
492
484
  });
493
485
  _defineProperty(this, "getScrollOffsetValue", () => {
494
486
  if (!this.headerRef.current) {
@@ -516,12 +508,11 @@ class DataTableRoot extends Component {
516
508
  }
517
509
  });
518
510
  return this.columns.reduce((acc, column) => {
519
- var _a, _b;
520
511
  if (column.fixed === "left") {
521
- acc[0] += ((_a = this.headerNodesMap.get(column.name)) == null ? void 0 : _a.getBoundingClientRect().width) ?? 0;
512
+ acc[0] += this.headerNodesMap.get(column.name)?.getBoundingClientRect().width ?? 0;
522
513
  }
523
514
  if (column.fixed === "right") {
524
- acc[1] += ((_b = this.headerNodesMap.get(column.name)) == null ? void 0 : _b.getBoundingClientRect().width) ?? 0;
515
+ acc[1] += this.headerNodesMap.get(column.name)?.getBoundingClientRect().width ?? 0;
525
516
  }
526
517
  return acc;
527
518
  }, [0, 0]);
@@ -547,10 +538,7 @@ class DataTableRoot extends Component {
547
538
  };
548
539
  const columnsFixed = this.columns.slice(startIndexSideMap[side], endIndexSideMap[side]);
549
540
  if (columnsFixed.length < 1) return [side, 0];
550
- const sum = columnsFixed.reduce((acc, column) => {
551
- var _a;
552
- return acc + ((_a = this.headerNodesMap.get(column.name)) == null ? void 0 : _a.getBoundingClientRect().width);
553
- }, 0);
541
+ const sum = columnsFixed.reduce((acc, column) => acc + this.headerNodesMap.get(column.name)?.getBoundingClientRect().width, 0);
554
542
  return [side, `${sum}px`];
555
543
  });
556
544
  const cols = this.calculateColumnsFromConfig();
@@ -570,13 +558,13 @@ class DataTableRoot extends Component {
570
558
  headerProps,
571
559
  loading
572
560
  } = this.asProps;
573
- if ((headerProps == null ? void 0 : headerProps.sticky) && !headerProps.h || loading || this.hasFixedColumn) {
561
+ if (headerProps?.sticky && !headerProps.h || loading || this.hasFixedColumn) {
574
562
  requestAnimationFrame(() => {
575
563
  this.forceUpdate();
576
564
  this.calculateVerticalShadow();
577
565
  });
578
566
  }
579
- if ((headerProps == null ? void 0 : headerProps.sticky) && canUseDOM() && this.scrollDirection === "horizontal") {
567
+ if (headerProps?.sticky && canUseDOM() && this.scrollDirection === "horizontal") {
580
568
  document.addEventListener("scroll", this.handleDocumentScroll);
581
569
  }
582
570
  }
@@ -619,11 +607,10 @@ class DataTableRoot extends Component {
619
607
  }
620
608
  }
621
609
  componentWillUnmount() {
622
- var _a;
623
610
  if (canUseDOM()) {
624
611
  document.removeEventListener("scroll", this.handleDocumentScroll);
625
612
  }
626
- (_a = this.state.expandedRows) == null ? void 0 : _a.clear();
613
+ this.state.expandedRows?.clear();
627
614
  }
628
615
  get totalRows() {
629
616
  const {
@@ -710,7 +697,7 @@ class DataTableRoot extends Component {
710
697
  onSortChange,
711
698
  getI18nText,
712
699
  uid,
713
- ref: (headerProps == null ? void 0 : headerProps.ref) ? forkRef(this.headerRef, headerProps.ref) : this.headerRef,
700
+ ref: headerProps?.ref ? forkRef(this.headerRef, headerProps.ref) : this.headerRef,
714
701
  gridAreaGroupMap: this.gridAreaGroupMap,
715
702
  gridTemplateColumns,
716
703
  gridTemplateAreas,
@@ -769,7 +756,7 @@ class DataTableRoot extends Component {
769
756
  gridTemplateAreas,
770
757
  loading,
771
758
  headerHeight: this.getHeaderHeight(),
772
- stickyHeader: headerProps == null ? void 0 : headerProps.sticky,
759
+ stickyHeader: headerProps?.sticky,
773
760
  getI18nText,
774
761
  expandedRows: this.state.expandedRows,
775
762
  onExpandRow: this.onExpandRow,
@@ -800,9 +787,8 @@ class DataTableRoot extends Component {
800
787
  };
801
788
  }
802
789
  setInert(value) {
803
- var _a;
804
- const cells = (_a = this.tableRef.current) == null ? void 0 : _a.querySelectorAll("[role=gridcell], [role=columnheader]");
805
- cells == null ? void 0 : cells.forEach((cell) => {
790
+ const cells = this.tableRef.current?.querySelectorAll("[role=gridcell], [role=columnheader]");
791
+ cells?.forEach((cell) => {
806
792
  if (value === true) {
807
793
  cell.setAttribute("inert", "");
808
794
  } else {
@@ -812,8 +798,8 @@ class DataTableRoot extends Component {
812
798
  }
813
799
  initFocusableCell(initCell) {
814
800
  const hasFocusable = this.hasFocusableInHeader();
815
- const initRow = (initCell == null ? void 0 : initCell[0]) ?? 0;
816
- const initCol = (initCell == null ? void 0 : initCell[1]) ?? 0;
801
+ const initRow = initCell?.[0] ?? 0;
802
+ const initCol = initCell?.[1] ?? 0;
817
803
  if (hasFocusable) {
818
804
  this.focusedCell = [initRow, initCol];
819
805
  } else {
@@ -844,9 +830,9 @@ class DataTableRoot extends Component {
844
830
  gridTemplateAreas
845
831
  } = this.gridSettings;
846
832
  const Head2 = findComponent(Children, ["DataTable.Head"]);
847
- const headerPropsToCheck = headerProps ?? (Head2 == null ? void 0 : Head2.props);
848
- const headerHeight = (headerProps == null ? void 0 : headerProps.h) || this.getHeaderHeight();
849
- const topOffset = (headerPropsToCheck == null ? void 0 : headerPropsToCheck.sticky) || (headerPropsToCheck == null ? void 0 : headerPropsToCheck.withScrollBar) ? headerHeight : void 0;
833
+ const headerPropsToCheck = headerProps ?? Head2?.props;
834
+ const headerHeight = headerProps?.h || this.getHeaderHeight();
835
+ const topOffset = headerPropsToCheck?.sticky || headerPropsToCheck?.withScrollBar ? headerHeight : void 0;
850
836
  const width = w ?? (this.columns.some((c) => c.gtcWidth === "auto" || c.gtcWidth === "1fr") ? "100%" : void 0);
851
837
  let gridTemplateRows = void 0;
852
838
  if (virtualScroll && typeof virtualScroll !== "boolean" && "rowHeight" in virtualScroll) {
@@ -901,7 +887,7 @@ class DataTableRoot extends Component {
901
887
  "use:hMax": void 0,
902
888
  "use:hMin": void 0
903
889
  }, _ref)
904
- }), 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, {
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?.withScrollBar && topOffset && !loading && /* @__PURE__ */ React.createElement(ScrollArea.Bar, {
905
891
  orientation: "horizontal",
906
892
  top: topOffset - SCROLL_BAR_HEIGHT,
907
893
  zIndex: 20
@@ -942,13 +928,13 @@ class DataTableRoot extends Component {
942
928
  calculatedColumns.push(column);
943
929
  }
944
930
  const makeColumn = (columnElement, parent, isFirst, isLast, hasGroups) => {
945
- const leftBordersFromParent = isFirst && ((parent == null ? void 0 : parent.borders) === "both" || (parent == null ? void 0 : parent.borders) === "left") ? "left" : void 0;
946
- const rightBordersFromParent = isLast && ((parent == null ? void 0 : parent.borders) === "both" || (parent == null ? void 0 : parent.borders) === "right") ? "right" : void 0;
931
+ const leftBordersFromParent = isFirst && (parent?.borders === "both" || parent?.borders === "left") ? "left" : void 0;
932
+ const rightBordersFromParent = isLast && (parent?.borders === "both" || parent?.borders === "right") ? "right" : void 0;
947
933
  const column = {
948
934
  ...columnElement,
949
935
  name: childIsColumn(columnElement) ? columnElement.name : "",
950
936
  gtcWidth: childIsColumn(columnElement) ? calculateGridTemplateColumn(columnElement) : "",
951
- fixed: columnElement.fixed ?? (hasGroups ? parent == null ? void 0 : parent.fixed : void 0),
937
+ fixed: columnElement.fixed ?? (hasGroups ? parent?.fixed : void 0),
952
938
  borders: columnElement.borders ?? leftBordersFromParent ?? rightBordersFromParent,
953
939
  parent
954
940
  };
@@ -992,7 +978,6 @@ class DataTableRoot extends Component {
992
978
  Group.columns = [];
993
979
  Group.children = child.children;
994
980
  child.columns.forEach((child2, j) => {
995
- var _a;
996
981
  const isFirst = j === 0;
997
982
  const isLast = j === childCount - 1;
998
983
  const col = makeColumn(child2, Group, isFirst, isLast, this.hasGroups);
@@ -1008,7 +993,7 @@ class DataTableRoot extends Component {
1008
993
  if (isFirst && i > 0) {
1009
994
  setShowShadows(col, i);
1010
995
  }
1011
- (_a = Group.columns) == null ? void 0 : _a.push(col);
996
+ Group.columns?.push(col);
1012
997
  });
1013
998
  treeColumns.push(Group);
1014
999
  this.gridAreaGroupMap.set(groupIndex, `1 / ${initGridColumn} / 2 / ${gridColumnIndex}`);
@@ -1091,7 +1076,7 @@ class DataTableRoot extends Component {
1091
1076
  columns2.delete(value2);
1092
1077
  });
1093
1078
  }
1094
- if (value == null ? void 0 : value[ACCORDION]) {
1079
+ if (value?.[ACCORDION]) {
1095
1080
  accordionInCell = value[ACCORDION];
1096
1081
  }
1097
1082
  return acc;
@@ -1107,7 +1092,7 @@ class DataTableRoot extends Component {
1107
1092
  } else if (accordionInCell) {
1108
1093
  gridRowIndex++;
1109
1094
  }
1110
- excludeColumns == null ? void 0 : excludeColumns.forEach((value) => {
1095
+ excludeColumns?.forEach((value) => {
1111
1096
  columns2.delete(value);
1112
1097
  });
1113
1098
  if (columns2.size > 0) {
@@ -1141,7 +1126,6 @@ class DataTableRoot extends Component {
1141
1126
  [ROW_INDEX]: -1
1142
1127
  });
1143
1128
  groupedRows.forEach((childRow, index) => {
1144
- var _a, _b;
1145
1129
  let dtRow;
1146
1130
  if (index === 0) {
1147
1131
  const rowData = {
@@ -1152,7 +1136,7 @@ class DataTableRoot extends Component {
1152
1136
  dtRow[ROW_GROUP] = /* @__PURE__ */ new Set();
1153
1137
  } else {
1154
1138
  dtRow = makeDtRow(childRow, groupedKeys);
1155
- (_b = (_a = innerRows[0]) == null ? void 0 : _a[ROW_GROUP]) == null ? void 0 : _b.add(dtRow[UNIQ_ROW_KEY]);
1139
+ innerRows[0]?.[ROW_GROUP]?.add(dtRow[UNIQ_ROW_KEY]);
1156
1140
  }
1157
1141
  innerRows.push(dtRow);
1158
1142
  if (index === groupedRows.length - 1 && row[ACCORDION]) {
@@ -1161,7 +1145,7 @@ class DataTableRoot extends Component {
1161
1145
  rowIndex++;
1162
1146
  });
1163
1147
  rows.push(innerRows);
1164
- } else if ((groupedRows == null ? void 0 : groupedRows.length) === 1) {
1148
+ } else if (groupedRows?.length === 1) {
1165
1149
  const dtRow = makeDtRow({
1166
1150
  ...groupedRows[0],
1167
1151
  ...row
@@ -1184,15 +1168,14 @@ class DataTableRoot extends Component {
1184
1168
  return (/* @__PURE__ */ React.isValidElement(c) ? c.props.gtcWidth : c.gtcWidth) ?? this.props.defaultGridTemplateColumnWidth;
1185
1169
  }
1186
1170
  getHeaderHeight() {
1187
- var _a, _b, _c;
1188
- const header = (_a = this.headerRef.current) == null ? void 0 : _a.children;
1171
+ const header = this.headerRef.current?.children;
1189
1172
  let height = 0;
1190
- for (let i = 0; i < ((header == null ? void 0 : header.length) ?? 0); i++) {
1191
- const item = header == null ? void 0 : header.item(i);
1192
- let columnHeight = item == null ? void 0 : item.getBoundingClientRect().height;
1173
+ for (let i = 0; i < (header?.length ?? 0); i++) {
1174
+ const item = header?.item(i);
1175
+ let columnHeight = item?.getBoundingClientRect().height;
1193
1176
  if (item instanceof HTMLElement && item.dataset.groupContainer) {
1194
- const groupHeight = ((_b = item.children.item(0)) == null ? void 0 : _b.getBoundingClientRect().height) ?? 0;
1195
- const cellHeight = ((_c = item.children.item(1)) == null ? void 0 : _c.getBoundingClientRect().height) ?? 0;
1177
+ const groupHeight = item.children.item(0)?.getBoundingClientRect().height ?? 0;
1178
+ const cellHeight = item.children.item(1)?.getBoundingClientRect().height ?? 0;
1196
1179
  columnHeight = groupHeight + cellHeight;
1197
1180
  }
1198
1181
  if (columnHeight) {
@@ -1,5 +1,5 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import { Component, lastInteraction, sstyled, assignProps } from "@semcore/core";
2
+ import { sstyled, Component, lastInteraction, assignProps } from "@semcore/core";
3
3
  import { Flex } from "@semcore/base-components";
4
4
  import { ButtonLink } from "@semcore/button";
5
5
  import canUseDOM from "@semcore/core/lib/utils/canUseDOM";
@@ -11,7 +11,6 @@ import SortAsc from "@semcore/icon/SortAsc/m";
11
11
  import SortDesc from "@semcore/icon/SortDesc/m";
12
12
  import * as React from "react";
13
13
  import { handleKeydownFocusCell, handleFocusCell } from "../../enhancers/focusableCell.mjs";
14
- /*!__reshadow-styles__:"./style.shadow.css"*/
15
14
  const style = (
16
15
  /*__reshadow_css_start__*/
17
16
  (sstyled.insert(
@@ -82,7 +81,6 @@ class Column extends Component {
82
81
  sortVisible: false
83
82
  });
84
83
  _defineProperty(this, "calculateActiveColumnMinWidth", () => {
85
- var _a;
86
84
  const node = this.columnRef.current;
87
85
  if (node) {
88
86
  const clonedColumn = document.createElement("div");
@@ -101,7 +99,7 @@ class Column extends Component {
101
99
  document.body.appendChild(clonedColumn);
102
100
  const computedWidth = Math.ceil(clonedColumn.getBoundingClientRect().width);
103
101
  document.body.removeChild(clonedColumn);
104
- const defaultNodeWidth = ((_a = this.columnRef.current) == null ? void 0 : _a.clientWidth) ?? 0;
102
+ const defaultNodeWidth = this.columnRef.current?.clientWidth ?? 0;
105
103
  if (computedWidth >= defaultNodeWidth) {
106
104
  return defaultNodeWidth + SORT_ICON_WIDTH;
107
105
  } else {
@@ -139,7 +137,7 @@ class Column extends Component {
139
137
  sortable
140
138
  } = this.asProps;
141
139
  if (sortable && onSortChange) {
142
- const sortDirection = (sort == null ? void 0 : sort[0]) === name ? reversedSortDirection[sort[1]] : this.defaultDirection;
140
+ const sortDirection = sort?.[0] === name ? reversedSortDirection[sort[1]] : this.defaultDirection;
143
141
  onSortChange([name, sortDirection], e);
144
142
  }
145
143
  });
@@ -153,7 +151,6 @@ class Column extends Component {
153
151
  handleKeydownFocusCell(this.lockedCell, e);
154
152
  });
155
153
  _defineProperty(this, "handleFocusableCellFocus", (e) => {
156
- var _a;
157
154
  const cellElement = e.currentTarget;
158
155
  const target = e.target;
159
156
  if (lastInteraction.isKeyboard()) {
@@ -163,7 +160,7 @@ class Column extends Component {
163
160
  handleFocusCell(this.lockedCell, target, cellElement);
164
161
  });
165
162
  } else {
166
- const focusableChildren = Array.from(((_a = this.columnRef.current) == null ? void 0 : _a.children) ?? []).flatMap((node) => getFocusableIn(node));
163
+ const focusableChildren = Array.from(this.columnRef.current?.children ?? []).flatMap((node) => getFocusableIn(node));
167
164
  if (isInteractiveElement(e.target) && this.columnRef.current && focusableChildren.length > 1) {
168
165
  this.lockedCell[0] = this.columnRef.current;
169
166
  this.lockedCell[1] = true;
@@ -171,7 +168,6 @@ class Column extends Component {
171
168
  }
172
169
  });
173
170
  _defineProperty(this, "handleClick", (e) => {
174
- var _a;
175
171
  const {
176
172
  sortable,
177
173
  onClick,
@@ -180,19 +176,18 @@ class Column extends Component {
180
176
  if (sortable) {
181
177
  this.handleSort(e);
182
178
  }
183
- const focusableChildren = Array.from(((_a = this.columnRef.current) == null ? void 0 : _a.children) ?? []).flatMap((node) => getFocusableIn(node));
179
+ const focusableChildren = Array.from(this.columnRef.current?.children ?? []).flatMap((node) => getFocusableIn(node));
184
180
  if (isInteractiveElement(e.target) && this.columnRef.current && focusableChildren.length > 1) {
185
181
  this.lockedCell[0] = this.columnRef.current;
186
182
  this.lockedCell[1] = true;
187
183
  }
188
- onClick == null ? void 0 : onClick(e, {
184
+ onClick?.(e, {
189
185
  rowIndex: -1,
190
186
  colIndex: columnIndex
191
187
  });
192
188
  });
193
189
  }
194
190
  componentDidMount() {
195
- var _a;
196
191
  const {
197
192
  parent,
198
193
  sticky,
@@ -203,18 +198,17 @@ class Column extends Component {
203
198
  } = this.asProps;
204
199
  if (parent && sticky && scrollDirection !== "horizontal") {
205
200
  const columnElement = this.columnRef.current;
206
- const groupElement = (_a = columnElement == null ? void 0 : columnElement.parentElement) == null ? void 0 : _a.children.item(0);
207
- const groupRectHeight = (groupElement == null ? void 0 : groupElement.getBoundingClientRect().height) ?? 0;
201
+ const groupElement = columnElement?.parentElement?.children.item(0);
202
+ const groupRectHeight = groupElement?.getBoundingClientRect().height ?? 0;
208
203
  const topOffset = groupElement instanceof HTMLElement ? cssToIntDefault(groupElement.style.top) : 0;
209
- columnElement == null ? void 0 : columnElement.style.setProperty("top", `${groupRectHeight + topOffset}px`);
204
+ columnElement?.style.setProperty("top", `${groupRectHeight + topOffset}px`);
210
205
  }
211
- if (canUseDOM() && changeSortSize && (sort == null ? void 0 : sort[0]) === name) {
206
+ if (canUseDOM() && changeSortSize && sort?.[0] === name) {
212
207
  this.changeTemplateColumnBySort();
213
208
  }
214
209
  }
215
210
  componentDidUpdate(prevProps) {
216
- var _a, _b;
217
- if (this.asProps.changeSortSize && canUseDOM() && ((_a = prevProps.sort) == null ? void 0 : _a[0]) !== ((_b = this.asProps.sort) == null ? void 0 : _b[0])) {
211
+ if (this.asProps.changeSortSize && canUseDOM() && prevProps.sort?.[0] !== this.asProps.sort?.[0]) {
218
212
  this.changeTemplateColumnBySort();
219
213
  }
220
214
  }
@@ -226,7 +220,7 @@ class Column extends Component {
226
220
  sort,
227
221
  name
228
222
  } = this.asProps;
229
- if ((sort == null ? void 0 : sort[0]) === name) {
223
+ if (sort?.[0] === name) {
230
224
  const newWidth = this.calculateActiveColumnMinWidth();
231
225
  setTimeout(() => {
232
226
  if (tableRef.current && newWidth !== null) {
@@ -238,7 +232,7 @@ class Column extends Component {
238
232
  }).join(" "));
239
233
  }
240
234
  });
241
- } else if ((sort == null ? void 0 : sort[0]) !== name) {
235
+ } else if (sort?.[0] !== name) {
242
236
  setTimeout(() => {
243
237
  if (tableRef.current) {
244
238
  const currentGridTemplateColumns = tableRef.current.style.getPropertyValue("grid-template-columns");
@@ -1,11 +1,10 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
- import { Component, sstyled, assignProps } from "@semcore/core";
3
+ import { sstyled, Component, assignProps } from "@semcore/core";
4
4
  import { Box } from "@semcore/base-components";
5
5
  import uniqueIDEnhancement from "@semcore/core/lib/utils/uniqueID";
6
6
  import React__default from "react";
7
7
  import { DataTable } from "../DataTable/DataTable.mjs";
8
- /*!__reshadow-styles__:"./style.shadow.css"*/
9
8
  const style = (
10
9
  /*__reshadow_css_start__*/
11
10
  (sstyled.insert(