@wallarm-org/design-system 4.19.3-rc-fix-table-header-focus-scroll.1 → 4.19.3-rc-fix-table-header-focus-scroll.2

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.
@@ -6,12 +6,12 @@ import { useTestId } from "../../../utils/testId.js";
6
6
  import { Tooltip, TooltipContent, TooltipTrigger } from "../../Tooltip/index.js";
7
7
  import { DROP_INDICATOR_BASE } from "../classes.js";
8
8
  import { useMasterCell } from "../hooks/index.js";
9
- import { TABLE_EXPAND_COLUMN_ID, getAlignClass, getExpandBorderClass, useColumnDnd, useColumnPinning, useRenderEveryTime, useTableValue } from "../lib/index.js";
9
+ import { TABLE_EXPAND_COLUMN_ID, getAlignClass, getExpandBorderClass, useColumnDndStyle, useColumnPinning, useRenderEveryTime, useTableValue } from "../lib/index.js";
10
10
  import { Td } from "../primitives/index.js";
11
11
  import { useTableContext } from "../TableContext/index.js";
12
12
  import { TableMasterCellActions } from "../TableMasterCellActions.js";
13
13
  const TableBodyCell = (t0)=>{
14
- const $ = c(55);
14
+ const $ = c(54);
15
15
  const { cell, colSpan, className, disablePinnedShadow, lastRow, dragListeners, dragAttributes, dropIndicator, empty } = t0;
16
16
  const { masterColumnId } = useTableContext();
17
17
  const testId = useTestId("body-cell");
@@ -33,7 +33,7 @@ const TableBodyCell = (t0)=>{
33
33
  $[3] = t2;
34
34
  } else t2 = $[3];
35
35
  const size = useTableValue(t2);
36
- const { canDnd, setNodeRef, dndStyle } = useColumnDnd(column);
36
+ const dndStyle = useColumnDndStyle(column.id);
37
37
  const { isPinned, pinningStyles, lastPinnedLeft: lastLeft } = useColumnPinning(column);
38
38
  const { isMasterTrigger, handleClick, tooltipText } = useMasterCell(column.id, cell.row.id);
39
39
  const isCut = column.id === masterColumnId || meta?.resizeType === "cut";
@@ -121,80 +121,77 @@ const TableBodyCell = (t0)=>{
121
121
  } else t6 = $[27];
122
122
  const t7 = "start" === isPinned;
123
123
  const t8 = disablePinnedShadow ? false : lastLeft;
124
- const t9 = canDnd ? setNodeRef : void 0;
125
- const t10 = isMasterTrigger ? handleClick : void 0;
126
- let t11;
124
+ const t9 = isMasterTrigger ? handleClick : void 0;
125
+ let t10;
127
126
  if ($[28] !== isCut) {
128
- t11 = isCut && {
127
+ t10 = isCut && {
129
128
  overflow: "hidden"
130
129
  };
131
130
  $[28] = isCut;
132
- $[29] = t11;
133
- } else t11 = $[29];
134
- let t12;
131
+ $[29] = t10;
132
+ } else t10 = $[29];
133
+ let t11;
135
134
  if ($[30] !== dropIndicator) {
136
- t12 = dropIndicator && {
135
+ t11 = dropIndicator && {
137
136
  overflow: "visible"
138
137
  };
139
138
  $[30] = dropIndicator;
140
- $[31] = t12;
141
- } else t12 = $[31];
142
- let t13;
143
- if ($[32] !== dndStyle || $[33] !== pinningStyles || $[34] !== size || $[35] !== t11 || $[36] !== t12) {
144
- t13 = {
139
+ $[31] = t11;
140
+ } else t11 = $[31];
141
+ let t12;
142
+ if ($[32] !== dndStyle || $[33] !== pinningStyles || $[34] !== size || $[35] !== t10 || $[36] !== t11) {
143
+ t12 = {
145
144
  ...pinningStyles,
146
145
  width: size,
147
146
  ...dndStyle,
148
- ...t11,
149
- ...t12
147
+ ...t10,
148
+ ...t11
150
149
  };
151
150
  $[32] = dndStyle;
152
151
  $[33] = pinningStyles;
153
152
  $[34] = size;
154
- $[35] = t11;
155
- $[36] = t12;
156
- $[37] = t13;
157
- } else t13 = $[37];
158
- let t14;
153
+ $[35] = t10;
154
+ $[36] = t11;
155
+ $[37] = t12;
156
+ } else t12 = $[37];
157
+ let t13;
159
158
  if ($[38] !== empty || $[39] !== renderContent) {
160
- t14 = !empty && renderContent();
159
+ t13 = !empty && renderContent();
161
160
  $[38] = empty;
162
161
  $[39] = renderContent;
163
- $[40] = t14;
164
- } else t14 = $[40];
165
- let t15;
166
- if ($[41] !== colSpan || $[42] !== dragAttributes || $[43] !== dragListeners || $[44] !== isExpandedToggle || $[45] !== lastRow || $[46] !== t10 || $[47] !== t13 || $[48] !== t14 || $[49] !== t6 || $[50] !== t7 || $[51] !== t8 || $[52] !== t9 || $[53] !== testId) {
167
- t15 = /*#__PURE__*/ jsx(Td, {
162
+ $[40] = t13;
163
+ } else t13 = $[40];
164
+ let t14;
165
+ if ($[41] !== colSpan || $[42] !== dragAttributes || $[43] !== dragListeners || $[44] !== isExpandedToggle || $[45] !== lastRow || $[46] !== t12 || $[47] !== t13 || $[48] !== t6 || $[49] !== t7 || $[50] !== t8 || $[51] !== t9 || $[52] !== testId) {
166
+ t14 = /*#__PURE__*/ jsx(Td, {
168
167
  "data-testid": testId,
169
168
  className: t6,
170
169
  pinned: t7,
171
170
  lastPinnedLeft: t8,
172
171
  expanded: isExpandedToggle,
173
172
  lastRow: lastRow,
174
- ref: t9,
175
- onClick: t10,
176
- style: t13,
173
+ onClick: t9,
174
+ style: t12,
177
175
  colSpan: colSpan,
178
176
  ...dragListeners,
179
177
  ...dragAttributes,
180
- children: t14
178
+ children: t13
181
179
  });
182
180
  $[41] = colSpan;
183
181
  $[42] = dragAttributes;
184
182
  $[43] = dragListeners;
185
183
  $[44] = isExpandedToggle;
186
184
  $[45] = lastRow;
187
- $[46] = t10;
185
+ $[46] = t12;
188
186
  $[47] = t13;
189
- $[48] = t14;
190
- $[49] = t6;
191
- $[50] = t7;
192
- $[51] = t8;
193
- $[52] = t9;
194
- $[53] = testId;
195
- $[54] = t15;
196
- } else t15 = $[54];
197
- return t15;
187
+ $[48] = t6;
188
+ $[49] = t7;
189
+ $[50] = t8;
190
+ $[51] = t9;
191
+ $[52] = testId;
192
+ $[53] = t14;
193
+ } else t14 = $[53];
194
+ return t14;
198
195
  };
199
196
  TableBodyCell.displayName = "TableBodyCell";
200
197
  export { TableBodyCell };
@@ -1,12 +1,12 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { c as compiler_runtime_c } from "react/compiler-runtime";
3
- import { useEffect, useRef } from "react";
3
+ import { useEffect, useRef, useState } from "react";
4
4
  import { DndContext, KeyboardSensor, PointerSensor, closestCenter, useSensor, useSensors } from "@dnd-kit/core";
5
5
  import { SortableContext, arrayMove, horizontalListSortingStrategy, sortableKeyboardCoordinates } from "@dnd-kit/sortable";
6
6
  import { useTable } from "@tanstack/react-table";
7
7
  import { useControlled, useIsKeyPressed } from "../../../hooks/index.js";
8
8
  import { useTableState } from "../hooks/index.js";
9
- import { TABLE_DRAG_HANDLE_COLUMN_ID, TABLE_EXPAND_COLUMN_ID, TABLE_MIN_COLUMN_WIDTH, TABLE_SELECT_COLUMN_ID, TABLE_SKELETON_ROWS, TABLE_VIRTUALIZATION_OVERSCAN, createDragHandleColumn, createExpandColumn, createSelectionColumn, dsTableFeatures } from "../lib/index.js";
9
+ import { TABLE_DRAG_HANDLE_COLUMN_ID, TABLE_EXPAND_COLUMN_ID, TABLE_MIN_COLUMN_WIDTH, TABLE_SELECT_COLUMN_ID, TABLE_SKELETON_ROWS, TABLE_VIRTUALIZATION_OVERSCAN, createColumnDndStyles, createDragHandleColumn, createExpandColumn, createSelectionColumn, dsTableFeatures } from "../lib/index.js";
10
10
  import { TableContext } from "./TableContext.js";
11
11
  const toTanStackPinning = (p, pinnedLeft)=>({
12
12
  start: [
@@ -16,7 +16,7 @@ const toTanStackPinning = (p, pinnedLeft)=>({
16
16
  end: p?.right ?? []
17
17
  });
18
18
  const TableProvider = (props)=>{
19
- const $ = compiler_runtime_c(169);
19
+ const $ = compiler_runtime_c(170);
20
20
  const { data, columns, isLoading: t0, isLoadingPrevious: t1, skeletonCount: t2, children, getRowId, sorting: sortingProp, onSortingChange, manualSorting: t3, rowSelection: rowSelectionProp, onRowSelectionChange, enableSelectAllRows: t4, onSelectAllRows, columnSizing: columnSizingProp, onColumnSizingChange, columnPinning: columnPinningProp, onColumnPinningChange, columnOrder: columnOrderProp, onColumnOrderChange, grouping: groupingProp, onGroupingChange, expanded: expandedProp, onExpandedChange, renderGroupRow, groupRowSpan: t5, groupExpandColumn: t6, getSubRows, showEmptyGroups: t7, renderExpandedRow, columnVisibility: columnVisibilityProp, onColumnVisibilityChange, defaultColumnVisibility, defaultColumnOrder, columnGroups, virtualized, stretch: t8, estimateRowHeight, overscan: t9, onEndReached, onEndReachedThreshold, onStartReached, onStartReachedThreshold, initialScrollToRowId, onRowReorder, getRowCanDrag, renderFullWidthRow, onMasterCellClick, activeRowId: activeRowIdProp, onSettingsOpenChange, deferColumnVisibility: t10 } = props;
21
21
  const isLoading = void 0 === t0 ? false : t0;
22
22
  const isLoadingPrevious = void 0 === t1 ? false : t1;
@@ -430,6 +430,7 @@ const TableProvider = (props)=>{
430
430
  const shiftKeyRef = useIsKeyPressed("Shift");
431
431
  const containerRef = useRef(null);
432
432
  const headerScrollRef = useRef(null);
433
+ const [columnDndStyles] = useState(createColumnDndStyles);
433
434
  const tbodyRef = useRef(null);
434
435
  const virtualizerRef = useRef(null);
435
436
  const t46 = !!getSubRows;
@@ -438,7 +439,7 @@ const TableProvider = (props)=>{
438
439
  const t49 = "full" === groupRowSpan ? renderGroupRow : void 0;
439
440
  const t50 = renderFullWidthRow;
440
441
  let t51;
441
- if ($[101] !== allLeafColumns || $[102] !== alwaysPinnedLeft || $[103] !== columnDndEnabled || $[104] !== columnGroups || $[105] !== defaultColumnOrder || $[106] !== defaultColumnVisibility || $[107] !== deferColumnVisibility || $[108] !== enableSelectAllRows || $[109] !== estimateRowHeight || $[110] !== expandingEnabled || $[111] !== groupingEnabled || $[112] !== initialScrollToRowId || $[113] !== isLoading || $[114] !== isLoadingPrevious || $[115] !== masterCellActiveRowId || $[116] !== masterColumnId || $[117] !== onEndReached || $[118] !== onEndReachedThreshold || $[119] !== onMasterCellClick || $[120] !== onRowReorder || $[121] !== onSelectAllRows || $[122] !== onSettingsOpenChange || $[123] !== onStartReached || $[124] !== onStartReachedThreshold || $[125] !== overscan || $[126] !== pinningEnabled || $[127] !== resizingEnabled || $[128] !== rowDndEnabled || $[129] !== selectionEnabled || $[130] !== setColumnOrder || $[131] !== shiftKeyRef || $[132] !== showEmptyGroups || $[133] !== skeletonCount || $[134] !== sortingEnabled || $[135] !== stretch || $[136] !== t46 || $[137] !== t47 || $[138] !== t48 || $[139] !== t49 || $[140] !== t50 || $[141] !== table || $[142] !== virtualized || $[143] !== visibilityEnabled) {
442
+ if ($[101] !== allLeafColumns || $[102] !== alwaysPinnedLeft || $[103] !== columnDndEnabled || $[104] !== columnDndStyles || $[105] !== columnGroups || $[106] !== defaultColumnOrder || $[107] !== defaultColumnVisibility || $[108] !== deferColumnVisibility || $[109] !== enableSelectAllRows || $[110] !== estimateRowHeight || $[111] !== expandingEnabled || $[112] !== groupingEnabled || $[113] !== initialScrollToRowId || $[114] !== isLoading || $[115] !== isLoadingPrevious || $[116] !== masterCellActiveRowId || $[117] !== masterColumnId || $[118] !== onEndReached || $[119] !== onEndReachedThreshold || $[120] !== onMasterCellClick || $[121] !== onRowReorder || $[122] !== onSelectAllRows || $[123] !== onSettingsOpenChange || $[124] !== onStartReached || $[125] !== onStartReachedThreshold || $[126] !== overscan || $[127] !== pinningEnabled || $[128] !== resizingEnabled || $[129] !== rowDndEnabled || $[130] !== selectionEnabled || $[131] !== setColumnOrder || $[132] !== shiftKeyRef || $[133] !== showEmptyGroups || $[134] !== skeletonCount || $[135] !== sortingEnabled || $[136] !== stretch || $[137] !== t46 || $[138] !== t47 || $[139] !== t48 || $[140] !== t49 || $[141] !== t50 || $[142] !== table || $[143] !== virtualized || $[144] !== visibilityEnabled) {
442
443
  t51 = {
443
444
  table,
444
445
  isLoading,
@@ -473,6 +474,7 @@ const TableProvider = (props)=>{
473
474
  onSelectAllRows,
474
475
  containerRef,
475
476
  headerScrollRef,
477
+ columnDndStyles,
476
478
  tbodyRef,
477
479
  virtualizerRef,
478
480
  onEndReached,
@@ -492,52 +494,53 @@ const TableProvider = (props)=>{
492
494
  $[101] = allLeafColumns;
493
495
  $[102] = alwaysPinnedLeft;
494
496
  $[103] = columnDndEnabled;
495
- $[104] = columnGroups;
496
- $[105] = defaultColumnOrder;
497
- $[106] = defaultColumnVisibility;
498
- $[107] = deferColumnVisibility;
499
- $[108] = enableSelectAllRows;
500
- $[109] = estimateRowHeight;
501
- $[110] = expandingEnabled;
502
- $[111] = groupingEnabled;
503
- $[112] = initialScrollToRowId;
504
- $[113] = isLoading;
505
- $[114] = isLoadingPrevious;
506
- $[115] = masterCellActiveRowId;
507
- $[116] = masterColumnId;
508
- $[117] = onEndReached;
509
- $[118] = onEndReachedThreshold;
510
- $[119] = onMasterCellClick;
511
- $[120] = onRowReorder;
512
- $[121] = onSelectAllRows;
513
- $[122] = onSettingsOpenChange;
514
- $[123] = onStartReached;
515
- $[124] = onStartReachedThreshold;
516
- $[125] = overscan;
517
- $[126] = pinningEnabled;
518
- $[127] = resizingEnabled;
519
- $[128] = rowDndEnabled;
520
- $[129] = selectionEnabled;
521
- $[130] = setColumnOrder;
522
- $[131] = shiftKeyRef;
523
- $[132] = showEmptyGroups;
524
- $[133] = skeletonCount;
525
- $[134] = sortingEnabled;
526
- $[135] = stretch;
527
- $[136] = t46;
528
- $[137] = t47;
529
- $[138] = t48;
530
- $[139] = t49;
531
- $[140] = t50;
532
- $[141] = table;
533
- $[142] = virtualized;
534
- $[143] = visibilityEnabled;
535
- $[144] = t51;
536
- } else t51 = $[144];
497
+ $[104] = columnDndStyles;
498
+ $[105] = columnGroups;
499
+ $[106] = defaultColumnOrder;
500
+ $[107] = defaultColumnVisibility;
501
+ $[108] = deferColumnVisibility;
502
+ $[109] = enableSelectAllRows;
503
+ $[110] = estimateRowHeight;
504
+ $[111] = expandingEnabled;
505
+ $[112] = groupingEnabled;
506
+ $[113] = initialScrollToRowId;
507
+ $[114] = isLoading;
508
+ $[115] = isLoadingPrevious;
509
+ $[116] = masterCellActiveRowId;
510
+ $[117] = masterColumnId;
511
+ $[118] = onEndReached;
512
+ $[119] = onEndReachedThreshold;
513
+ $[120] = onMasterCellClick;
514
+ $[121] = onRowReorder;
515
+ $[122] = onSelectAllRows;
516
+ $[123] = onSettingsOpenChange;
517
+ $[124] = onStartReached;
518
+ $[125] = onStartReachedThreshold;
519
+ $[126] = overscan;
520
+ $[127] = pinningEnabled;
521
+ $[128] = resizingEnabled;
522
+ $[129] = rowDndEnabled;
523
+ $[130] = selectionEnabled;
524
+ $[131] = setColumnOrder;
525
+ $[132] = shiftKeyRef;
526
+ $[133] = showEmptyGroups;
527
+ $[134] = skeletonCount;
528
+ $[135] = sortingEnabled;
529
+ $[136] = stretch;
530
+ $[137] = t46;
531
+ $[138] = t47;
532
+ $[139] = t48;
533
+ $[140] = t49;
534
+ $[141] = t50;
535
+ $[142] = table;
536
+ $[143] = virtualized;
537
+ $[144] = visibilityEnabled;
538
+ $[145] = t51;
539
+ } else t51 = $[145];
537
540
  const contextValue = t51;
538
541
  let t52;
539
542
  let t53;
540
- if ($[145] !== selectionEnabled || $[146] !== table) {
543
+ if ($[146] !== selectionEnabled || $[147] !== table) {
541
544
  t52 = ()=>{
542
545
  if (!selectionEnabled) return;
543
546
  const container = containerRef.current;
@@ -552,34 +555,34 @@ const TableProvider = (props)=>{
552
555
  selectionEnabled,
553
556
  table
554
557
  ];
555
- $[145] = selectionEnabled;
556
- $[146] = table;
557
- $[147] = t52;
558
- $[148] = t53;
558
+ $[146] = selectionEnabled;
559
+ $[147] = table;
560
+ $[148] = t52;
561
+ $[149] = t53;
559
562
  } else {
560
- t52 = $[147];
561
- t53 = $[148];
563
+ t52 = $[148];
564
+ t53 = $[149];
562
565
  }
563
566
  useEffect(t52, t53);
564
567
  let t54;
565
- if ($[149] === Symbol.for("react.memo_cache_sentinel")) {
568
+ if ($[150] === Symbol.for("react.memo_cache_sentinel")) {
566
569
  t54 = {
567
570
  activationConstraint: {
568
571
  distance: 5
569
572
  }
570
573
  };
571
- $[149] = t54;
572
- } else t54 = $[149];
574
+ $[150] = t54;
575
+ } else t54 = $[150];
573
576
  let t55;
574
- if ($[150] === Symbol.for("react.memo_cache_sentinel")) {
577
+ if ($[151] === Symbol.for("react.memo_cache_sentinel")) {
575
578
  t55 = {
576
579
  coordinateGetter: sortableKeyboardCoordinates
577
580
  };
578
- $[150] = t55;
579
- } else t55 = $[150];
581
+ $[151] = t55;
582
+ } else t55 = $[151];
580
583
  const sensors = useSensors(useSensor(PointerSensor, t54), useSensor(KeyboardSensor, t55));
581
584
  let t56;
582
- if ($[151] !== setColumnOrder || $[152] !== table) {
585
+ if ($[152] !== setColumnOrder || $[153] !== table) {
583
586
  t56 = (event)=>{
584
587
  const { active, over } = event;
585
588
  if (!over || active.id === over.id) return;
@@ -589,58 +592,58 @@ const TableProvider = (props)=>{
589
592
  const newOrder_0 = arrayMove(currentOrder, oldIndex, newIndex);
590
593
  setColumnOrder(newOrder_0);
591
594
  };
592
- $[151] = setColumnOrder;
593
- $[152] = table;
594
- $[153] = t56;
595
- } else t56 = $[153];
595
+ $[152] = setColumnOrder;
596
+ $[153] = table;
597
+ $[154] = t56;
598
+ } else t56 = $[154];
596
599
  const handleDragEnd = t56;
597
600
  let t57;
598
- if ($[154] !== allLeafColumns || $[155] !== alwaysPinnedLeft || $[156] !== columnDndEnabled) {
601
+ if ($[155] !== allLeafColumns || $[156] !== alwaysPinnedLeft || $[157] !== columnDndEnabled) {
599
602
  t57 = columnDndEnabled ? allLeafColumns.filter((c_0)=>!alwaysPinnedLeft.includes(c_0.id)).map(_temp3) : [];
600
- $[154] = allLeafColumns;
601
- $[155] = alwaysPinnedLeft;
602
- $[156] = columnDndEnabled;
603
- $[157] = t57;
604
- } else t57 = $[157];
603
+ $[155] = allLeafColumns;
604
+ $[156] = alwaysPinnedLeft;
605
+ $[157] = columnDndEnabled;
606
+ $[158] = t57;
607
+ } else t57 = $[158];
605
608
  const columnIds = t57;
606
609
  const t58 = columnDndEnabled ? sensors : void 0;
607
610
  const t59 = columnDndEnabled ? closestCenter : void 0;
608
611
  const t60 = columnDndEnabled ? handleDragEnd : void 0;
609
612
  let t61;
610
- if ($[158] !== children || $[159] !== columnIds) {
613
+ if ($[159] !== children || $[160] !== columnIds) {
611
614
  t61 = /*#__PURE__*/ jsx(SortableContext, {
612
615
  items: columnIds,
613
616
  strategy: horizontalListSortingStrategy,
614
617
  children: children
615
618
  });
616
- $[158] = children;
617
- $[159] = columnIds;
618
- $[160] = t61;
619
- } else t61 = $[160];
619
+ $[159] = children;
620
+ $[160] = columnIds;
621
+ $[161] = t61;
622
+ } else t61 = $[161];
620
623
  let t62;
621
- if ($[161] !== t58 || $[162] !== t59 || $[163] !== t60 || $[164] !== t61) {
624
+ if ($[162] !== t58 || $[163] !== t59 || $[164] !== t60 || $[165] !== t61) {
622
625
  t62 = /*#__PURE__*/ jsx(DndContext, {
623
626
  sensors: t58,
624
627
  collisionDetection: t59,
625
628
  onDragEnd: t60,
626
629
  children: t61
627
630
  });
628
- $[161] = t58;
629
- $[162] = t59;
630
- $[163] = t60;
631
- $[164] = t61;
632
- $[165] = t62;
633
- } else t62 = $[165];
631
+ $[162] = t58;
632
+ $[163] = t59;
633
+ $[164] = t60;
634
+ $[165] = t61;
635
+ $[166] = t62;
636
+ } else t62 = $[166];
634
637
  let t63;
635
- if ($[166] !== contextValue || $[167] !== t62) {
638
+ if ($[167] !== contextValue || $[168] !== t62) {
636
639
  t63 = /*#__PURE__*/ jsx(TableContext.Provider, {
637
640
  value: contextValue,
638
641
  children: t62
639
642
  });
640
- $[166] = contextValue;
641
- $[167] = t62;
642
- $[168] = t63;
643
- } else t63 = $[168];
643
+ $[167] = contextValue;
644
+ $[168] = t62;
645
+ $[169] = t63;
646
+ } else t63 = $[169];
644
647
  return t63;
645
648
  };
646
649
  function _temp() {
@@ -1,7 +1,7 @@
1
1
  import type { ReactNode, RefObject } from 'react';
2
2
  import type { Column, ColumnVisibilityState, ReactTable, Row, RowData } from '@tanstack/react-table';
3
3
  import type { Virtualizer } from '@tanstack/react-virtual';
4
- import type { DSTableFeatures } from '../lib/index.js';
4
+ import type { ColumnDndStyles, DSTableFeatures } from '../lib/index.js';
5
5
  import type { TableColumnGroup, TableProps, TableRowReorderEvent, TableVirtualized } from '../types.js';
6
6
  /**
7
7
  * Union covers both virtualizer flavors used by the Table (`useVirtualizer`
@@ -43,6 +43,7 @@ export interface TableContextValue<T extends RowData> {
43
43
  masterColumnId: string | null;
44
44
  containerRef: RefObject<HTMLDivElement | null>;
45
45
  headerScrollRef: RefObject<HTMLDivElement | null>;
46
+ columnDndStyles: ColumnDndStyles;
46
47
  tbodyRef: RefObject<HTMLTableSectionElement | null>;
47
48
  virtualizerRef: RefObject<TableVirtualizerInstance | null>;
48
49
  onEndReached?: () => void;
@@ -0,0 +1,15 @@
1
+ import { type CSSProperties } from 'react';
2
+ /**
3
+ * A column's drag style, written by its header cell and read by its body
4
+ * cells. Only the header registers the column with dnd-kit: dnd-kit keeps one
5
+ * node per id, so a body cell registering the same id and then unmounting (a
6
+ * virtualized row, a refetched page) dropped the column, and it no longer moved.
7
+ */
8
+ export declare const createColumnDndStyles: () => {
9
+ get: (id: string) => CSSProperties;
10
+ set: (id: string, style: CSSProperties) => void;
11
+ subscribe: (listener: () => void) => () => void;
12
+ };
13
+ export type ColumnDndStyles = ReturnType<typeof createColumnDndStyles>;
14
+ /** The drag style of the column, as its header cell has it. */
15
+ export declare const useColumnDndStyle: (columnId: string) => CSSProperties;
@@ -0,0 +1,38 @@
1
+ import { c } from "react/compiler-runtime";
2
+ import { useSyncExternalStore } from "react";
3
+ import { useTableContext } from "../TableContext/useTableContext.js";
4
+ const NONE = {};
5
+ const createColumnDndStyles = ()=>{
6
+ const styles = new Map();
7
+ const listeners = new Set();
8
+ return {
9
+ get: (id)=>styles.get(id) ?? NONE,
10
+ set: (id, style)=>{
11
+ if (JSON.stringify(styles.get(id) ?? NONE) === JSON.stringify(style)) return;
12
+ styles.set(id, style);
13
+ for (const listener of listeners)listener();
14
+ },
15
+ subscribe: (listener)=>{
16
+ listeners.add(listener);
17
+ return ()=>{
18
+ listeners.delete(listener);
19
+ };
20
+ }
21
+ };
22
+ };
23
+ const useColumnDndStyle = (columnId)=>{
24
+ const $ = c(3);
25
+ const { columnDndStyles } = useTableContext();
26
+ let t0;
27
+ if ($[0] !== columnDndStyles || $[1] !== columnId) {
28
+ t0 = ()=>columnDndStyles.get(columnId);
29
+ $[0] = columnDndStyles;
30
+ $[1] = columnId;
31
+ $[2] = t0;
32
+ } else t0 = $[2];
33
+ return useSyncExternalStore(columnDndStyles.subscribe, t0, _temp);
34
+ };
35
+ function _temp() {
36
+ return NONE;
37
+ }
38
+ export { createColumnDndStyles, useColumnDndStyle };
@@ -1,4 +1,5 @@
1
1
  export { collectDirectChildren } from './collectDirectChildren.js';
2
+ export { type ColumnDndStyles, createColumnDndStyles, useColumnDndStyle, } from './columnDndStyles.js';
2
3
  export { getAlignClass, getExpandBorderClass, SCROLL_EDGE_COOLDOWN_MS, SORT_LABELS, TABLE_DRAG_HANDLE_COLUMN_ID, TABLE_DRAG_HANDLE_COLUMN_WIDTH, TABLE_END_REACHED_THRESHOLD, TABLE_EXPAND_COLUMN_ID, TABLE_EXPAND_COLUMN_WIDTH, TABLE_MIN_COLUMN_WIDTH, TABLE_PREPEND_SKELETON_ROWS, TABLE_SELECT_COLUMN_ID, TABLE_SELECT_COLUMN_WIDTH, TABLE_SKELETON_ROWS, TABLE_START_REACHED_THRESHOLD, TABLE_VIRTUALIZATION_OVERSCAN, } from './constants.js';
3
4
  export { containsDirectChild } from './containsDirectChild.js';
4
5
  export { createDragHandleColumn } from './createDragHandleColumn.js';
@@ -1,4 +1,5 @@
1
1
  export { collectDirectChildren } from "./collectDirectChildren.js";
2
+ export { createColumnDndStyles, useColumnDndStyle } from "./columnDndStyles.js";
2
3
  export { SCROLL_EDGE_COOLDOWN_MS, SORT_LABELS, TABLE_DRAG_HANDLE_COLUMN_ID, TABLE_DRAG_HANDLE_COLUMN_WIDTH, TABLE_END_REACHED_THRESHOLD, TABLE_EXPAND_COLUMN_ID, TABLE_EXPAND_COLUMN_WIDTH, TABLE_MIN_COLUMN_WIDTH, TABLE_PREPEND_SKELETON_ROWS, TABLE_SELECT_COLUMN_ID, TABLE_SELECT_COLUMN_WIDTH, TABLE_SKELETON_ROWS, TABLE_START_REACHED_THRESHOLD, TABLE_VIRTUALIZATION_OVERSCAN, getAlignClass, getExpandBorderClass } from "./constants.js";
3
4
  export { containsDirectChild } from "./containsDirectChild.js";
4
5
  export { createDragHandleColumn } from "./createDragHandleColumn.js";
@@ -1,4 +1,4 @@
1
- import type { CSSProperties } from 'react';
1
+ import { type CSSProperties } from 'react';
2
2
  import { useSortable } from '@dnd-kit/sortable';
3
3
  import type { Column, RowData } from '@tanstack/react-table';
4
4
  import type { DSTableFeatures } from './dsTableFeatures.js';
@@ -11,5 +11,6 @@ interface UseColumnDndResult {
11
11
  attributes: UseSortableReturn['attributes'];
12
12
  listeners: UseSortableReturn['listeners'];
13
13
  }
14
+ /** For the header cell only: it is the one node of the column dnd-kit knows. */
14
15
  export declare const useColumnDnd: <T extends RowData>(column: Column<DSTableFeatures, T, unknown>) => UseColumnDndResult;
15
16
  export {};
@@ -1,11 +1,12 @@
1
1
  import { c } from "react/compiler-runtime";
2
+ import { useLayoutEffect } from "react";
2
3
  import { useSortable } from "@dnd-kit/sortable";
3
4
  import { useTableContext } from "../TableContext/useTableContext.js";
4
5
  import { getDndStyles } from "./getDndStyles.js";
5
6
  import { useTableValue } from "./tableReactivity.js";
6
7
  const useColumnDnd = (column)=>{
7
- const $ = c(25);
8
- const { columnDndEnabled, alwaysPinnedLeft } = useTableContext();
8
+ const $ = c(29);
9
+ const { columnDndEnabled, alwaysPinnedLeft, columnDndStyles } = useTableContext();
9
10
  let t0;
10
11
  if ($[0] !== column) {
11
12
  t0 = ()=>column.getIsPinned();
@@ -59,8 +60,17 @@ const useColumnDnd = (column)=>{
59
60
  } else t5 = $[17];
60
61
  const dndStyle = t5;
61
62
  let t6;
62
- if ($[18] !== attributes || $[19] !== canDnd || $[20] !== dndStyle || $[21] !== isDragging || $[22] !== listeners || $[23] !== setNodeRef) {
63
- t6 = {
63
+ if ($[18] !== column.id || $[19] !== columnDndStyles || $[20] !== dndStyle) {
64
+ t6 = ()=>columnDndStyles.set(column.id, dndStyle);
65
+ $[18] = column.id;
66
+ $[19] = columnDndStyles;
67
+ $[20] = dndStyle;
68
+ $[21] = t6;
69
+ } else t6 = $[21];
70
+ useLayoutEffect(t6);
71
+ let t7;
72
+ if ($[22] !== attributes || $[23] !== canDnd || $[24] !== dndStyle || $[25] !== isDragging || $[26] !== listeners || $[27] !== setNodeRef) {
73
+ t7 = {
64
74
  canDnd,
65
75
  isDragging,
66
76
  setNodeRef,
@@ -68,14 +78,14 @@ const useColumnDnd = (column)=>{
68
78
  attributes,
69
79
  listeners
70
80
  };
71
- $[18] = attributes;
72
- $[19] = canDnd;
73
- $[20] = dndStyle;
74
- $[21] = isDragging;
75
- $[22] = listeners;
76
- $[23] = setNodeRef;
77
- $[24] = t6;
78
- } else t6 = $[24];
79
- return t6;
81
+ $[22] = attributes;
82
+ $[23] = canDnd;
83
+ $[24] = dndStyle;
84
+ $[25] = isDragging;
85
+ $[26] = listeners;
86
+ $[27] = setNodeRef;
87
+ $[28] = t7;
88
+ } else t7 = $[28];
89
+ return t7;
80
90
  };
81
91
  export { useColumnDnd };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": "4.19.2",
3
- "generatedAt": "2026-11-17T10:12:33.379Z",
3
+ "generatedAt": "2026-11-17T12:20:48.193Z",
4
4
  "components": [
5
5
  {
6
6
  "name": "Accordion",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wallarm-org/design-system",
3
- "version": "4.19.3-rc-fix-table-header-focus-scroll.1",
3
+ "version": "4.19.3-rc-fix-table-header-focus-scroll.2",
4
4
  "description": "Core design system library with React components and Storybook documentation",
5
5
  "publishConfig": {
6
6
  "access": "public",