@infinite-table/infinite-react 0.3.11 → 0.3.14

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.
package/index.esm.js CHANGED
@@ -636,11 +636,11 @@ function debounce(fn, { wait }) {
636
636
  // src/components/InfiniteTable/index.tsx
637
637
  import {
638
638
  StrictMode,
639
- createElement as createElement26,
639
+ createElement as createElement28,
640
640
  memo as memo11,
641
641
  useEffect as useEffect26
642
642
  } from "react";
643
- import { useCallback as useCallback16, useEffect as useEffect27, useState as useState15 } from "react";
643
+ import { useCallback as useCallback18, useEffect as useEffect27, useState as useState16 } from "react";
644
644
 
645
645
  // src/utils/join.ts
646
646
  var join = (...args) => args.filter((x) => !!`${x}`).join(" ");
@@ -690,13 +690,16 @@ import {
690
690
  useLayoutEffect,
691
691
  useCallback
692
692
  } from "react";
693
- var setupResizeObserver = (node, callback) => {
693
+ var setupResizeObserver = (node, callback, config = { debounce: 0 }) => {
694
+ var _a;
695
+ const debounceTime = (_a = config.debounce) != null ? _a : 0;
694
696
  const RO = window.ResizeObserver;
697
+ const onResizeCallback = debounceTime ? debounce(callback, { wait: debounceTime }) : callback;
695
698
  const observer = new RO((entries) => {
696
- var _a;
699
+ var _a2;
697
700
  const entry = entries[0];
698
701
  let { width, height } = entry.contentRect;
699
- if ((_a = entry.borderBoxSize) == null ? void 0 : _a[0]) {
702
+ if ((_a2 = entry.borderBoxSize) == null ? void 0 : _a2[0]) {
700
703
  height = entry.borderBoxSize[0].blockSize;
701
704
  width = entry.borderBoxSize[0].inlineSize;
702
705
  } else {
@@ -704,14 +707,17 @@ var setupResizeObserver = (node, callback) => {
704
707
  height = rect.height;
705
708
  width = rect.width;
706
709
  }
707
- callback({ width, height });
710
+ onResizeCallback({ width, height });
708
711
  });
709
712
  observer.observe(node);
710
713
  return () => {
711
714
  observer.disconnect();
712
715
  };
713
716
  };
714
- var useResizeObserver = (ref, callback, config = { earlyAttach: false }) => {
717
+ var useResizeObserver = (ref, callback, config = {
718
+ earlyAttach: false,
719
+ debounce: 0
720
+ }) => {
715
721
  const sizeRef = useRef({
716
722
  width: 0,
717
723
  height: 0
@@ -729,7 +735,7 @@ var useResizeObserver = (ref, callback, config = { earlyAttach: false }) => {
729
735
  sizeRef.current = size;
730
736
  callback2(size);
731
737
  }
732
- });
738
+ }, { debounce: config.debounce });
733
739
  }
734
740
  return () => {
735
741
  if (disconnect) {
@@ -743,7 +749,7 @@ var useResizeObserver = (ref, callback, config = { earlyAttach: false }) => {
743
749
  }
744
750
  return () => {
745
751
  };
746
- }, [ref.current, callback, config.earlyAttach]);
752
+ }, [ref.current, callback, config.earlyAttach, config.debounce]);
747
753
  useLayoutEffect(() => {
748
754
  if (config.earlyAttach) {
749
755
  return effectFn(callback);
@@ -872,7 +878,7 @@ import {
872
878
  useCallback as useCallback4,
873
879
  useEffect as useEffect7,
874
880
  useRef as useRef7,
875
- useState as useState5
881
+ useState as useState4
876
882
  } from "react";
877
883
 
878
884
  // src/components/VirtualList/SpacePlaceholder.tsx
@@ -1088,6 +1094,73 @@ var cancelRaf = getGlobal().cancelAnimationFrame || ((timeoutId) => {
1088
1094
  return clearTimeout(timeoutId);
1089
1095
  });
1090
1096
 
1097
+ // src/utils/stripVar.ts
1098
+ function stripVar(cssVariableWithVarString) {
1099
+ return cssVariableWithVarString.slice(4, -1);
1100
+ }
1101
+
1102
+ // src/components/InfiniteTable/theme.css.ts
1103
+ var InternalVars = { currentColumnWidth: "var(--_1slvgu90)", currentColumnTransformX: "var(--_1slvgu91)", currentColumnTransformY: "var(--_1slvgu92)", activeCellRowOffset: "var(--_1slvgu93)", activeCellRowHeight: "var(--_1slvgu94)", activeCellOffsetX: "var(--_1slvgu95)", activeCellOffsetY: "var(--_1slvgu96)", scrollLeftForActiveCell: "var(--_1slvgu97)", scrollTopForActiveCell: "var(--_1slvgu98)", activeCellColWidth: "var(--_1slvgu99)", activeCellColOffset: "var(--_1slvgu9a)", columnWidthAtIndex: "var(--_1slvgu9b)", columnOffsetAtIndex: "var(--_1slvgu9c)" };
1104
+ var ThemeVars = { color: { accent: "var(--infinite-accent-color)", error: "var(--infinite-error-color)", color: "var(--infinite-color)" }, spacing: { "0": "var(--infinite-space-0)", "1": "var(--infinite-space-1)", "2": "var(--infinite-space-2)", "3": "var(--infinite-space-3)", "4": "var(--infinite-space-4)", "5": "var(--infinite-space-5)", "6": "var(--infinite-space-6)", "7": "var(--infinite-space-7)", "8": "var(--infinite-space-8)", "9": "var(--infinite-space-9)", "10": "var(--infinite-space-10)" }, fontSize: { "0": "var(--infinite-font-size-0)", "1": "var(--infinite-font-size-1)", "2": "var(--infinite-font-size-2)", "3": "var(--infinite-font-size-3)", "4": "var(--infinite-font-size-4)", "5": "var(--infinite-font-size-5)", "6": "var(--infinite-font-size-6)", "7": "var(--infinite-font-size-7)" }, fontFamily: "var(--infinite-font-family)", minHeight: "var(--infinite-min-height)", borderRadius: "var(--infinite-border-radius)", background: "var(--infinite-background)", components: { LoadMask: { padding: "var(--infinite-load-mask-padding)", color: "var(--infinite-load-mask-color)", textBackground: "var(--infinite-load-mask-text-background)", overlayBackground: "var(--infinite-load-mask-overlay-background)", overlayOpacity: "var(--infinite-load-mask-overlay-opacity)", borderRadius: "var(--infinite-load-mask-border-radius)" }, Header: { background: "var(--infinite-header-background)", color: "var(--infinite-header-color)", columnHeaderHeight: "var(--infinite-column-header-height)" }, HeaderCell: { draggingBackground: "var(--infinite-header-cell-dragging-background)", background: "var(--infinite-header-cell-background)", hoverBackground: "var(--infinite-header-cell-hover-background)", padding: "var(--infinite-header-cell-padding)", paddingX: "var(--infinite-header-cell-padding-x)", paddingY: "var(--infinite-header-cell-padding-y)", iconSize: "var(--infinite-header-cell-icon-size)", sortIconMargin: "var(--infinite-header-cell-sort-icon-margin)", resizeHandleActiveAreaWidth: "var(--infinite-resize-handle-active-area-width)", resizeHandleWidth: "var(--infinite-resize-handle-width)", resizeHandleHoverBackground: "var(--infinite-resize-handle-hover-background)", resizeHandleConstrainedHoverBackground: "var(--infinite-resize-handle-constrained-hover-background)" }, Cell: { padding: "var(--infinite-cell-padding)", borderWidth: "var(--infinite-cell-border-width)", border: "var(--infinite-cell-border)", borderInvisible: "var(--infinite-cell-border-invisible)", borderRadius: "var(--infinite-cell-border-radius)", color: "var(--infinite-cell-color)", activeBorderColor_R: "var(--infinite-active-cell-border-color--r)", activeBorderColor_G: "var(--infinite-active-cell-border-color--g)", activeBorderColor_B: "var(--infinite-active-cell-border-color--b)", activeBackgroundAlpha: "var(--infinite-active-cell-background-alpha)", activeBackgroundAlphaWhenTableUnfocused: "var(--infinite-active-cell-background-alpha--table-unfocused)", activeBackground: "var(--infinite-active-cell-background)", activeBorderColor: "var(--infinite-active-cell-border-color)", activeBorderWidth: "var(--infinite-active-cell-border-width)", activeBorderStyle: "var(--infinite-active-cell-border-style)", activeBorder: "var(--infinite-active-cell-border)" }, Row: { background: "var(--infinite-row-background)", oddBackground: "var(--infinite-row-odd-background)", activeBackground: "var(--infinite-active-row-background)", activeBorderColor: "var(--infinite-active-row-border-color)", activeBorderWidth: "var(--infinite-active-row-border-width)", activeBorderStyle: "var(--infinite-active-row-border-style)", activeBorder: "var(--infinite-active-row-border)", activeBackgroundAlpha: "var(--infinite-active-row-background-alpha)", activeBackgroundAlphaWhenTableUnfocused: "var(--infinite-active-row-background-alpha--table-unfocused)", hoverBackground: "var(--infinite-row-hover-background)", groupRowBackground: "var(--infinite-group-row-background)", groupRowColumnNesting: "var(--infinite-group-row-column-nesting)", groupNesting: "var(--infinite-dont-override-group-row-nesting-length)", pointerEventsWhileScrolling: "var(--infinite-row-pointer-events-while-scrolling)" }, ColumnCell: { background: "var(--infinite-column-cell-bg-dont-override)" } } };
1105
+ var columnHeaderHeightName = "column-header-height";
1106
+
1107
+ // src/utils/selectParent.ts
1108
+ function selectParent(el, selector) {
1109
+ let node = el;
1110
+ if (node && node.matches(selector)) {
1111
+ return node;
1112
+ }
1113
+ while (node = node.parentElement) {
1114
+ if (node.matches(selector)) {
1115
+ return node;
1116
+ }
1117
+ }
1118
+ return null;
1119
+ }
1120
+
1121
+ // src/components/InfiniteTable/internalProps.ts
1122
+ var rootClassName2 = "Infinite";
1123
+ var internalProps = {
1124
+ rootClassName: rootClassName2
1125
+ };
1126
+
1127
+ // src/components/InfiniteTable/utils/infiniteDOMUtils.ts
1128
+ var InfiniteSelector = `.${internalProps.rootClassName}`;
1129
+ function getParentInfiniteNode(node) {
1130
+ return selectParent(node, InfiniteSelector);
1131
+ }
1132
+ var columnWidthAtIndex = stripVar(InternalVars.columnWidthAtIndex);
1133
+ var columnOffsetAtIndex = stripVar(InternalVars.columnOffsetAtIndex);
1134
+ function setInfiniteVarOnRoot(varName, varValue, node) {
1135
+ const infinite = node ? getParentInfiniteNode(node) : document.querySelector(InfiniteSelector);
1136
+ setInfiniteVarOnNode(varName, varValue, infinite);
1137
+ }
1138
+ function setInfiniteVarOnNode(varName, varValue, node) {
1139
+ if (node) {
1140
+ const prop = InternalVars[varName] ? stripVar(InternalVars[varName]) : varName;
1141
+ node.style.setProperty(prop, `${varValue}`);
1142
+ }
1143
+ }
1144
+ function setInfiniteVarsOnNode(vars, node) {
1145
+ if (node) {
1146
+ for (var varName in vars) {
1147
+ node.style.setProperty(InternalVars[varName] ? stripVar(InternalVars[varName]) : varName, `${vars[varName]}`);
1148
+ }
1149
+ }
1150
+ }
1151
+ function setInfiniteColumnWidth(colIndex, colWidth, node) {
1152
+ setInfiniteVarOnRoot(`${columnWidthAtIndex}-${colIndex}`, typeof colWidth === "number" ? colWidth + "px" : colWidth, node);
1153
+ }
1154
+ function setInfiniteColumnOffset(colIndex, colOffset, node) {
1155
+ setInfiniteVarOnRoot(`${columnOffsetAtIndex}-${colIndex}`, typeof colOffset === "number" ? colOffset + "px" : colOffset, node);
1156
+ }
1157
+ function getCSSVarNameForColWidth(colIndex) {
1158
+ return `${columnWidthAtIndex}-${colIndex}`;
1159
+ }
1160
+ function getCSSVarNameForColOffset(colIndex) {
1161
+ return `${columnOffsetAtIndex}-${colIndex}`;
1162
+ }
1163
+
1091
1164
  // src/components/VirtualBrain/MatrixBrain.ts
1092
1165
  var import_binary_search = __toModule(require_binary_search());
1093
1166
  var getRenderRangeCellCount = (range) => {
@@ -1123,13 +1196,13 @@ var MatrixBrain = class extends Logger {
1123
1196
  this.extraSpanCells = [];
1124
1197
  this.scrollPosition = { scrollLeft: 0, scrollTop: 0 };
1125
1198
  this.onScrollFns = [];
1126
- this.onRenderRangeChangeFns = [];
1127
- this.onVerticalRenderRangeChangeFns = [];
1128
- this.onHorizontalRenderRangeChangeFns = [];
1199
+ this.onRenderRangeChangeFns = new Set();
1200
+ this.onVerticalRenderRangeChangeFns = new Set();
1201
+ this.onHorizontalRenderRangeChangeFns = new Set();
1129
1202
  this.onDestroyFns = [];
1130
1203
  this.destroyed = false;
1131
- this.onRenderCountChangeFns = [];
1132
- this.onAvailableSizeChangeFns = [];
1204
+ this.onRenderCountChangeFns = new Set();
1205
+ this.onAvailableSizeChangeFns = new Set();
1133
1206
  this.onScrollStartFns = [];
1134
1207
  this.onScrollStopFns = [];
1135
1208
  this.scrollTimeoutId = 0;
@@ -1293,14 +1366,16 @@ var MatrixBrain = class extends Logger {
1293
1366
  }
1294
1367
  const fns = this.onAvailableSizeChangeFns;
1295
1368
  const range = this.getAvailableSize();
1296
- for (let i = 0, len = fns.length; i < len; i++) {
1369
+ fns.forEach((fn) => {
1297
1370
  raf2(() => {
1298
1371
  if (this.destroyed) {
1299
1372
  return;
1300
1373
  }
1301
- fns[i](range);
1374
+ if (fns.has(fn)) {
1375
+ fn(range);
1376
+ }
1302
1377
  });
1303
- }
1378
+ });
1304
1379
  };
1305
1380
  this.notifyRenderRangeChange = () => {
1306
1381
  if (this.destroyed) {
@@ -1308,14 +1383,16 @@ var MatrixBrain = class extends Logger {
1308
1383
  }
1309
1384
  const fns = this.onRenderRangeChangeFns;
1310
1385
  const range = this.getRenderRange();
1311
- for (let i = 0, len = fns.length; i < len; i++) {
1386
+ fns.forEach((fn) => {
1312
1387
  raf2(() => {
1313
1388
  if (this.destroyed) {
1314
1389
  return;
1315
1390
  }
1316
- fns[i](range);
1391
+ if (fns.has(fn)) {
1392
+ fn(range);
1393
+ }
1317
1394
  });
1318
- }
1395
+ });
1319
1396
  };
1320
1397
  this.notifyVerticalRenderRangeChange = () => {
1321
1398
  if (this.destroyed) {
@@ -1323,14 +1400,16 @@ var MatrixBrain = class extends Logger {
1323
1400
  }
1324
1401
  const fns = this.onVerticalRenderRangeChangeFns;
1325
1402
  const range = this.verticalRenderRange;
1326
- for (let i = 0, len = fns.length; i < len; i++) {
1403
+ fns.forEach((fn) => {
1327
1404
  raf2(() => {
1328
1405
  if (this.destroyed) {
1329
1406
  return;
1330
1407
  }
1331
- fns[i]([range.startIndex, range.endIndex]);
1408
+ if (fns.has(fn)) {
1409
+ fn([range.startIndex, range.endIndex]);
1410
+ }
1332
1411
  });
1333
- }
1412
+ });
1334
1413
  };
1335
1414
  this.notifyHorizontalRenderRangeChange = () => {
1336
1415
  if (this.destroyed) {
@@ -1338,14 +1417,16 @@ var MatrixBrain = class extends Logger {
1338
1417
  }
1339
1418
  const fns = this.onHorizontalRenderRangeChangeFns;
1340
1419
  const range = this.horizontalRenderRange;
1341
- for (let i = 0, len = fns.length; i < len; i++) {
1420
+ fns.forEach((fn) => {
1342
1421
  raf2(() => {
1343
1422
  if (this.destroyed) {
1344
1423
  return;
1345
1424
  }
1346
- fns[i]([range.startIndex, range.endIndex]);
1425
+ if (fns.has(fn)) {
1426
+ fn([range.startIndex, range.endIndex]);
1427
+ }
1347
1428
  });
1348
- }
1429
+ });
1349
1430
  };
1350
1431
  this.computeDirectionalRenderCount = (direction, itemSize, count, theSize) => {
1351
1432
  let renderCount = 0;
@@ -1357,11 +1438,11 @@ var MatrixBrain = class extends Logger {
1357
1438
  sizes.push(this.getItemSize(i, direction));
1358
1439
  }
1359
1440
  sizes.sort(SORT_ASC);
1360
- let sum = 0;
1441
+ let sum2 = 0;
1361
1442
  for (let i = 0; i < count; i++) {
1362
- sum += sizes[i];
1443
+ sum2 += sizes[i];
1363
1444
  renderCount++;
1364
- if (sum > size) {
1445
+ if (sum2 > size) {
1365
1446
  break;
1366
1447
  }
1367
1448
  }
@@ -1376,11 +1457,11 @@ var MatrixBrain = class extends Logger {
1376
1457
  if (!this.fixedColsEnd) {
1377
1458
  return 0;
1378
1459
  }
1379
- let sum = 0;
1460
+ let sum2 = 0;
1380
1461
  for (let i = this.cols - this.fixedColsEnd; i < this.cols; i++) {
1381
- sum += this.getColWidth(i);
1462
+ sum2 += this.getColWidth(i);
1382
1463
  }
1383
- return sum;
1464
+ return sum2;
1384
1465
  };
1385
1466
  this.getFixedEndColsOffsets = () => {
1386
1467
  if (!this.fixedColsEnd) {
@@ -1390,19 +1471,19 @@ var MatrixBrain = class extends Logger {
1390
1471
  const { width } = this.getAvailableSize();
1391
1472
  const offsets = [];
1392
1473
  const widths = [];
1393
- let sum = 0;
1474
+ let sum2 = 0;
1394
1475
  for (let colIndex = this.cols - this.fixedColsEnd; colIndex < this.cols; colIndex++) {
1395
1476
  const colWidth = this.getColWidth(colIndex);
1396
1477
  widths.push(colWidth);
1397
- sum += colWidth;
1478
+ sum2 += colWidth;
1398
1479
  }
1399
- const baseOffset = width - sum + scrollLeft;
1400
- sum = 0;
1480
+ const baseOffset = width - sum2 + scrollLeft;
1481
+ sum2 = 0;
1401
1482
  let index = 0;
1402
1483
  for (let colIndex = this.cols - this.fixedColsEnd; colIndex < this.cols; colIndex++) {
1403
- const offset = baseOffset + sum;
1484
+ const offset = baseOffset + sum2;
1404
1485
  offsets[colIndex] = offset;
1405
- sum += widths[index];
1486
+ sum2 += widths[index];
1406
1487
  index++;
1407
1488
  }
1408
1489
  return offsets;
@@ -1415,19 +1496,19 @@ var MatrixBrain = class extends Logger {
1415
1496
  const { height } = this.getAvailableSize();
1416
1497
  const offsets = [];
1417
1498
  const heights = [];
1418
- let sum = 0;
1499
+ let sum2 = 0;
1419
1500
  for (let rowIndex = this.rows - this.fixedRowsEnd; rowIndex < this.rows; rowIndex++) {
1420
1501
  const rowHeight = this.getRowHeight(rowIndex);
1421
1502
  heights.push(rowHeight);
1422
- sum += rowHeight;
1503
+ sum2 += rowHeight;
1423
1504
  }
1424
- const baseOffset = height - sum + scrollTop;
1425
- sum = 0;
1505
+ const baseOffset = height - sum2 + scrollTop;
1506
+ sum2 = 0;
1426
1507
  let index = 0;
1427
1508
  for (let rowIndex = this.rows - this.fixedRowsEnd; rowIndex < this.rows; rowIndex++) {
1428
- const offset = baseOffset + sum;
1509
+ const offset = baseOffset + sum2;
1429
1510
  offsets[rowIndex] = offset;
1430
- sum += heights[index];
1511
+ sum2 += heights[index];
1431
1512
  index++;
1432
1513
  }
1433
1514
  return offsets;
@@ -1436,31 +1517,31 @@ var MatrixBrain = class extends Logger {
1436
1517
  if (!this.fixedColsStart) {
1437
1518
  return 0;
1438
1519
  }
1439
- let sum = 0;
1520
+ let sum2 = 0;
1440
1521
  for (let i = 0; i < this.fixedColsStart; i++) {
1441
- sum += this.getColWidth(i);
1522
+ sum2 += this.getColWidth(i);
1442
1523
  }
1443
- return sum;
1524
+ return sum2;
1444
1525
  };
1445
1526
  this.getFixedEndRowsHeight = () => {
1446
1527
  if (!this.fixedRowsEnd) {
1447
1528
  return 0;
1448
1529
  }
1449
- let sum = 0;
1530
+ let sum2 = 0;
1450
1531
  for (let i = this.rows - this.fixedRowsEnd; i < this.rows; i++) {
1451
- sum += this.getRowHeight(i);
1532
+ sum2 += this.getRowHeight(i);
1452
1533
  }
1453
- return sum;
1534
+ return sum2;
1454
1535
  };
1455
1536
  this.getFixedStartRowsHeight = () => {
1456
1537
  if (!this.fixedRowsStart) {
1457
1538
  return 0;
1458
1539
  }
1459
- let sum = 0;
1540
+ let sum2 = 0;
1460
1541
  for (let i = 0; i < this.fixedRowsStart; i++) {
1461
- sum += this.getRowHeight(i);
1542
+ sum2 += this.getRowHeight(i);
1462
1543
  }
1463
- return sum;
1544
+ return sum2;
1464
1545
  };
1465
1546
  this.computeRenderCount = (which = ALL_DIRECTIONS) => {
1466
1547
  const recomputeHorizontal = which.horizontal;
@@ -1891,33 +1972,33 @@ var MatrixBrain = class extends Logger {
1891
1972
  };
1892
1973
  };
1893
1974
  this.onRenderRangeChange = (fn) => {
1894
- this.onRenderRangeChangeFns.push(fn);
1975
+ this.onRenderRangeChangeFns.add(fn);
1895
1976
  return () => {
1896
- this.onRenderRangeChangeFns = this.onRenderRangeChangeFns.filter((f) => f !== fn);
1977
+ this.onRenderRangeChangeFns.delete(fn);
1897
1978
  };
1898
1979
  };
1899
1980
  this.onVerticalRenderRangeChange = (fn) => {
1900
- this.onVerticalRenderRangeChangeFns.push(fn);
1981
+ this.onVerticalRenderRangeChangeFns.add(fn);
1901
1982
  return () => {
1902
- this.onVerticalRenderRangeChangeFns = this.onVerticalRenderRangeChangeFns.filter((f) => f !== fn);
1983
+ this.onVerticalRenderRangeChangeFns.delete(fn);
1903
1984
  };
1904
1985
  };
1905
1986
  this.onHorizontalRenderRangeChange = (fn) => {
1906
- this.onHorizontalRenderRangeChangeFns.push(fn);
1987
+ this.onHorizontalRenderRangeChangeFns.add(fn);
1907
1988
  return () => {
1908
- this.onHorizontalRenderRangeChangeFns = this.onHorizontalRenderRangeChangeFns.filter((f) => f !== fn);
1989
+ this.onHorizontalRenderRangeChangeFns.delete(fn);
1909
1990
  };
1910
1991
  };
1911
1992
  this.onRenderCountChange = (fn) => {
1912
- this.onRenderCountChangeFns.push(fn);
1993
+ this.onRenderCountChangeFns.add(fn);
1913
1994
  return () => {
1914
- this.onRenderCountChangeFns = this.onRenderCountChangeFns.filter((f) => f !== fn);
1995
+ this.onRenderCountChangeFns.delete(fn);
1915
1996
  };
1916
1997
  };
1917
1998
  this.onAvailableSizeChange = (fn) => {
1918
- this.onAvailableSizeChangeFns.push(fn);
1999
+ this.onAvailableSizeChangeFns.add(fn);
1919
2000
  return () => {
1920
- this.onAvailableSizeChangeFns = this.onAvailableSizeChangeFns.filter((f) => f !== fn);
2001
+ this.onAvailableSizeChangeFns.delete(fn);
1921
2002
  };
1922
2003
  };
1923
2004
  this.onDestroy = (fn) => {
@@ -1945,10 +2026,10 @@ var MatrixBrain = class extends Logger {
1945
2026
  this.onScrollFns = [];
1946
2027
  this.onScrollStartFns = [];
1947
2028
  this.onScrollStopFns = [];
1948
- this.onRenderCountChangeFns = [];
1949
- this.onRenderRangeChangeFns = [];
1950
- this.onVerticalRenderRangeChangeFns = [];
1951
- this.onHorizontalRenderRangeChangeFns = [];
2029
+ this.onRenderCountChangeFns = new Set();
2030
+ this.onRenderRangeChangeFns = new Set();
2031
+ this.onVerticalRenderRangeChangeFns = new Set();
2032
+ this.onHorizontalRenderRangeChangeFns = new Set();
1952
2033
  };
1953
2034
  this.reset();
1954
2035
  }
@@ -1994,8 +2075,8 @@ var MatrixBrain = class extends Logger {
1994
2075
  let { width, height } = size;
1995
2076
  width = width != null ? width : this.width;
1996
2077
  height = height != null ? height : this.height;
1997
- const widthSame = size.width === this.width;
1998
- const heightSame = size.height === this.height;
2078
+ const widthSame = width === this.width;
2079
+ const heightSame = height === this.height;
1999
2080
  if (widthSame && heightSame) {
2000
2081
  return;
2001
2082
  }
@@ -2047,14 +2128,16 @@ var MatrixBrain = class extends Logger {
2047
2128
  vertical: verticalRenderCount
2048
2129
  };
2049
2130
  const fns = this.onRenderCountChangeFns;
2050
- for (let i = 0, len = fns.length; i < len; i++) {
2131
+ fns.forEach((fn) => {
2051
2132
  raf2(() => {
2052
2133
  if (this.destroyed) {
2053
2134
  return;
2054
2135
  }
2055
- fns[i](renderCount);
2136
+ if (fns.has(fn)) {
2137
+ fn(renderCount);
2138
+ }
2056
2139
  });
2057
- }
2140
+ });
2058
2141
  }
2059
2142
  getItemSizeCacheFor(itemIndex, direction) {
2060
2143
  return (direction === "horizontal" ? this.colWidthCache : this.rowHeightCache)[itemIndex];
@@ -2548,18 +2631,31 @@ var MappedCells = class extends Logger {
2548
2631
 
2549
2632
  // src/components/HeadlessTable/ReactHeadlessTableRenderer.tsx
2550
2633
  var ITEM_POSITION_WITH_TRANSFORM = true;
2634
+ var currentColumnTransformY = stripVar(InternalVars.currentColumnTransformY);
2635
+ var columnTransformX = stripVar(InternalVars.columnOffsetAtIndex);
2551
2636
  var ReactHeadlessTableRenderer = class extends Logger {
2552
2637
  constructor(brain) {
2553
2638
  super("ReactHeadlessTableRenderer");
2554
2639
  this.destroyed = false;
2555
2640
  this.scrolling = false;
2556
2641
  this.cellHoverClassNames = [];
2642
+ this.name = "";
2557
2643
  this.itemDOMElements = [];
2558
2644
  this.itemDOMRefs = [];
2559
2645
  this.updaters = [];
2560
2646
  this.items = [];
2561
2647
  this.currentHoveredRow = -1;
2562
2648
  this.hoverRowUpdatesInProgress = new Map();
2649
+ this.infiniteNode = null;
2650
+ this.setTransform = (element, _rowIndex, colIndex, x, y) => {
2651
+ const transformXVar = `${columnTransformX}-${colIndex}`;
2652
+ if (!this.infiniteNode) {
2653
+ this.infiniteNode = getParentInfiniteNode(element);
2654
+ }
2655
+ this.infiniteNode.style.setProperty(transformXVar, `${x}px`);
2656
+ element.style.setProperty(currentColumnTransformY, `${y}px`);
2657
+ element.style.transform = `translate3d(var(${transformXVar}), ${InternalVars.currentColumnTransformY}, 0)`;
2658
+ };
2563
2659
  this.getFullyVisibleRowsRange = () => {
2564
2660
  let {
2565
2661
  start: [startRow],
@@ -2756,7 +2852,7 @@ var ReactHeadlessTableRenderer = class extends Logger {
2756
2852
  extraCellsMap.set(`${rowIndex}:${colIndex}`, true);
2757
2853
  });
2758
2854
  }
2759
- const renderCount = ranges.reduce((sum, range2) => sum + getRenderRangeCellCount(range2), 0);
2855
+ const renderCount = ranges.reduce((sum2, range2) => sum2 + getRenderRangeCellCount(range2), 0);
2760
2856
  if (this.itemDOMElements.length >= renderCount) {
2761
2857
  mappedCells.discardElementsStartingWith(renderCount, (elementIndex) => {
2762
2858
  if (this.updaters[elementIndex]) {
@@ -3010,6 +3106,9 @@ var ReactHeadlessTableRenderer = class extends Logger {
3010
3106
  if (this.scrolling) {
3011
3107
  return;
3012
3108
  }
3109
+ if (false) {
3110
+ return;
3111
+ }
3013
3112
  if (this.hoverRowUpdatesInProgress.has(rowIndex)) {
3014
3113
  return;
3015
3114
  }
@@ -3025,6 +3124,9 @@ var ReactHeadlessTableRenderer = class extends Logger {
3025
3124
  };
3026
3125
  raf(() => {
3027
3126
  checkHoverClass();
3127
+ if (false) {
3128
+ return;
3129
+ }
3028
3130
  this.hoverRowUpdatesInProgress.delete(rowIndex);
3029
3131
  });
3030
3132
  };
@@ -3045,12 +3147,10 @@ var ReactHeadlessTableRenderer = class extends Logger {
3045
3147
  const { x, y } = itemPosition;
3046
3148
  if (itemElement) {
3047
3149
  this.updateHoverClassNamesForRow(rowIndex);
3048
- if (false) {
3049
- itemElement.dataset.rowIndex = rowIndex;
3050
- itemElement.dataset.colIndex = colIndex;
3051
- }
3150
+ itemElement.dataset.rowIndex = rowIndex;
3151
+ itemElement.dataset.colIndex = colIndex;
3052
3152
  if (ITEM_POSITION_WITH_TRANSFORM) {
3053
- itemElement.style.transform = `translate3d(${x}px, ${y}px, 0)`;
3153
+ this.setTransform(itemElement, rowIndex, colIndex, x, y);
3054
3154
  itemElement.style.willChange = "transform";
3055
3155
  itemElement.style.backfaceVisibility = "hidden";
3056
3156
  const hidden = options ? options.hidden : !!this.isCellCovered(rowIndex, colIndex);
@@ -3095,39 +3195,39 @@ var ReactHeadlessTableRenderer = class extends Logger {
3095
3195
  fn(rowIndex, colIndex, node, itemPosition, scrollPosition);
3096
3196
  }
3097
3197
  }
3098
- function adjustColStart(_rowIndex, colIndex, node, { x, y }, { scrollLeft }) {
3198
+ const adjustColStart = (_rowIndex, colIndex, node, { x, y }, { scrollLeft }) => {
3099
3199
  node.style.zIndex = `${fixedColsStart - colIndex}`;
3100
- node.style.transform = `translate3d(${x + scrollLeft}px, ${y}px, 0)`;
3101
- }
3102
- function adjustRowStart(rowIndex, _colIndex, node, coords, scrollPosition2) {
3200
+ this.setTransform(node, _rowIndex, colIndex, x + scrollLeft, y);
3201
+ };
3202
+ const adjustRowStart = (rowIndex, _colIndex, node, coords, scrollPosition2) => {
3103
3203
  node.style.zIndex = `${fixedRowsStart - rowIndex}`;
3104
- node.style.transform = `translate3d(${coords.x}px, ${coords.y + scrollPosition2.scrollTop}px, 0)`;
3105
- }
3106
- function adjustColEnd(_rowIndex, colIndex, node, { y }) {
3204
+ this.setTransform(node, rowIndex, _colIndex, coords.x, coords.y + scrollPosition2.scrollTop);
3205
+ };
3206
+ const adjustColEnd = (_rowIndex, colIndex, node, { y }) => {
3107
3207
  node.style.zIndex = `${cols - colIndex}`;
3108
3208
  const val = fixedEndColsOffsets[colIndex];
3109
- node.style.transform = `translate3d(${val}px, ${y}px, 0)`;
3110
- }
3111
- function adjustRowEnd(rowIndex, _colIndex, node, coords) {
3209
+ this.setTransform(node, _rowIndex, colIndex, val, y);
3210
+ };
3211
+ const adjustRowEnd = (rowIndex, _colIndex, node, coords) => {
3112
3212
  node.style.zIndex = `${rows - rowIndex}`;
3113
- node.style.transform = `translate3d(${coords.x}px, ${fixedEndRowsOffsets[rowIndex]}px, 0)`;
3114
- }
3115
- function adjustColStartRowStart(_rowIndex, _colIndex, node, { x, y }, scrollPosition2) {
3213
+ this.setTransform(node, rowIndex, _colIndex, coords.x, fixedEndRowsOffsets[rowIndex]);
3214
+ };
3215
+ const adjustColStartRowStart = (_rowIndex, _colIndex, node, { x, y }, scrollPosition2) => {
3116
3216
  node.style.zIndex = `1000000`;
3117
- node.style.transform = `translate3d(${x + scrollPosition2.scrollLeft}px, ${y + scrollPosition2.scrollTop}px, 0)`;
3118
- }
3119
- function adjustColStartRowEnd(_rowIndex, _colIndex, node, { x }, scrollPosition2) {
3217
+ this.setTransform(node, _rowIndex, _colIndex, x + scrollPosition2.scrollLeft, y + scrollPosition2.scrollTop);
3218
+ };
3219
+ const adjustColStartRowEnd = (_rowIndex, _colIndex, node, { x }, scrollPosition2) => {
3120
3220
  node.style.zIndex = `2000000`;
3121
- node.style.transform = `translate3d(${x + scrollPosition2.scrollLeft}px, ${fixedEndRowsOffsets[_rowIndex]}px, 0)`;
3122
- }
3123
- function adjustColEndRowStart(_rowIndex, colIndex, node, coords) {
3221
+ this.setTransform(node, _rowIndex, _colIndex, x + scrollPosition2.scrollLeft, fixedEndRowsOffsets[_rowIndex]);
3222
+ };
3223
+ const adjustColEndRowStart = (_rowIndex, colIndex, node, coords) => {
3124
3224
  node.style.zIndex = `3000000`;
3125
- node.style.transform = `translate3d(${fixedEndColsOffsets[colIndex]}px, ${coords.y + scrollPosition.scrollTop}px, 0)`;
3126
- }
3127
- function adjustColEndRowEnd(rowIndex, colIndex, node) {
3225
+ this.setTransform(node, _rowIndex, colIndex, fixedEndColsOffsets[colIndex], coords.y + scrollPosition.scrollTop);
3226
+ };
3227
+ const adjustColEndRowEnd = (rowIndex, colIndex, node) => {
3128
3228
  node.style.zIndex = `4000000`;
3129
- node.style.transform = `translate3d(${fixedEndColsOffsets[colIndex]}px, ${fixedEndRowsOffsets[rowIndex]}px, 0)`;
3130
- }
3229
+ this.setTransform(node, rowIndex, colIndex, fixedEndColsOffsets[colIndex], fixedEndRowsOffsets[rowIndex]);
3230
+ };
3131
3231
  if (fixedColsStart || fixedColsEnd) {
3132
3232
  for (let rowIndex = startRow; rowIndex < endRow; rowIndex++) {
3133
3233
  for (let colIndex = 0; colIndex < fixedColsStart; colIndex++) {
@@ -3188,6 +3288,9 @@ var ReactHeadlessTableRenderer = class extends Logger {
3188
3288
  }
3189
3289
  };
3190
3290
  this.destroy = () => {
3291
+ if (this.destroyed) {
3292
+ return;
3293
+ }
3191
3294
  this.destroyed = true;
3192
3295
  this.reset();
3193
3296
  this.onDestroy();
@@ -3358,14 +3461,12 @@ var useRerender = () => {
3358
3461
  ];
3359
3462
  };
3360
3463
 
3361
- // src/components/InfiniteTable/internalProps.ts
3362
- var rootClassName2 = "Infinite";
3363
- var internalProps = {
3364
- rootClassName: rootClassName2
3365
- };
3464
+ // src/components/InfiniteTable/components/ActiveCellIndicator.css.ts
3465
+ var ActiveCellIndicatorCls = { visible: "nxbq1c2 nxbq1c1 _16lm1iwf _16lm1iw3 _16lm1iwx _16lm1iwv", hidden: "nxbq1c3 nxbq1c1 _16lm1iwf _16lm1iw3 _16lm1iwx _16lm1iwv" };
3466
+ var ActiveIndicatorWrapperCls = "_16lm1iwf _16lm1iw3 _16lm1iwx _16lm1iwv _16lm1iwr";
3366
3467
 
3367
3468
  // src/components/InfiniteTable/components/ActiveRowIndicator.css.ts
3368
- var ActiveRowIndicatorCls = { visible: "j26lrx1 j26lrx0 _16lm1iwe _16lm1iw3 _16lm1iwt _16lm1iwu _16lm1iww", hidden: "j26lrx2 j26lrx0 _16lm1iwe _16lm1iw3 _16lm1iwt _16lm1iwu _16lm1iww" };
3469
+ var ActiveRowIndicatorCls = { visible: "j26lrx1 j26lrx0 _16lm1iwf _16lm1iw3 _16lm1iwu _16lm1iwv _16lm1iwx", hidden: "j26lrx2 j26lrx0 _16lm1iwf _16lm1iw3 _16lm1iwu _16lm1iwv _16lm1iwx" };
3369
3470
 
3370
3471
  // src/components/InfiniteTable/components/ActiveRowIndicator.tsx
3371
3472
  var { rootClassName: rootClassName3 } = internalProps;
@@ -3402,6 +3503,9 @@ var ActiveRowIndicatorFn = (props) => {
3402
3503
  };
3403
3504
  }, [brain]);
3404
3505
  return /* @__PURE__ */ createElement6("div", {
3506
+ className: ActiveIndicatorWrapperCls,
3507
+ "data-name": "active-row"
3508
+ }, /* @__PURE__ */ createElement6("div", {
3405
3509
  ref: domRef,
3406
3510
  "data-name": "active-row-indicator",
3407
3511
  className: `${baseCls} ${active ? ActiveRowIndicatorCls.visible : ActiveRowIndicatorCls.hidden}`,
@@ -3409,7 +3513,7 @@ var ActiveRowIndicatorFn = (props) => {
3409
3513
  transform: `translate3d(0px, ${-brain.getScrollPosition().scrollTop + state.top}px,0)`,
3410
3514
  height: state.rowHeight
3411
3515
  } : void 0
3412
- });
3516
+ }));
3413
3517
  };
3414
3518
  var ActiveRowIndicator = memo4(ActiveRowIndicatorFn);
3415
3519
 
@@ -3418,68 +3522,56 @@ import {
3418
3522
  createElement as createElement7,
3419
3523
  memo as memo5
3420
3524
  } from "react";
3421
- import { useEffect as useEffect6, useLayoutEffect as useLayoutEffect4, useRef as useRef6, useState as useState4 } from "react";
3422
-
3423
- // src/components/InfiniteTable/components/ActiveCellIndicator.css.ts
3424
- var ActiveCellIndicatorCls = { visible: "nxbq1c1 nxbq1c0 _16lm1iwe _16lm1iw3 _16lm1iww _16lm1iwu", hidden: "nxbq1c2 nxbq1c0 _16lm1iwe _16lm1iw3 _16lm1iww _16lm1iwu" };
3425
-
3426
- // src/components/InfiniteTable/components/ActiveCellIndicator.tsx
3525
+ import { useEffect as useEffect6, useLayoutEffect as useLayoutEffect4, useRef as useRef6 } from "react";
3427
3526
  var { rootClassName: rootClassName4 } = internalProps;
3428
3527
  var baseCls2 = `${rootClassName4}-ActiveCellIndicator`;
3528
+ var ActiveStyle = {
3529
+ [stripVar(InternalVars.activeCellOffsetX)]: `calc( ${InternalVars.scrollLeftForActiveCell} + ${InternalVars.activeCellColOffset} )`,
3530
+ [stripVar(InternalVars.activeCellOffsetY)]: `calc( ${InternalVars.scrollTopForActiveCell} + ${InternalVars.activeCellRowOffset} )`,
3531
+ transform: `translate3d(${InternalVars.activeCellOffsetX}, ${InternalVars.activeCellOffsetY}, 0px)`,
3532
+ width: InternalVars.activeCellColWidth,
3533
+ height: InternalVars.activeCellRowHeight
3534
+ };
3429
3535
  var ActiveCellIndicatorFn = (props) => {
3430
3536
  const { brain } = props;
3431
- const [rerenderId, rerender] = useRerender();
3432
- const [state, setState] = useState4({
3433
- top: 0,
3434
- rowHeight: 0,
3435
- colWidth: 0,
3436
- left: 0
3437
- });
3438
3537
  const domRef = useRef6(null);
3439
- const stateRef = useRef6(state);
3440
3538
  const active = props.activeCellIndex != null && brain.getRowCount() > props.activeCellIndex[0];
3441
3539
  useLayoutEffect4(() => {
3442
3540
  if (props.activeCellIndex == null) {
3443
3541
  return;
3444
3542
  }
3445
3543
  const rowIndex = props.activeCellIndex[0];
3446
- setState(stateRef.current = {
3447
- top: brain.getItemOffsetFor(rowIndex, "vertical"),
3448
- rowHeight: brain.getRowHeight(rowIndex),
3449
- left: brain.getItemOffsetFor(props.activeCellIndex[1], "horizontal"),
3450
- colWidth: brain.getColWidth(props.activeCellIndex[1])
3451
- });
3452
- }, [props.activeCellIndex, rerenderId]);
3544
+ const activeCellRowHeight = brain.getRowHeight(rowIndex);
3545
+ const activeCellRowOffset = brain.getItemOffsetFor(rowIndex, "vertical");
3546
+ const node = domRef.current;
3547
+ const scrollPosition = brain.getScrollPosition();
3548
+ setInfiniteVarsOnNode({
3549
+ scrollTopForActiveCell: `${-scrollPosition.scrollTop}px`,
3550
+ scrollLeftForActiveCell: `${-scrollPosition.scrollLeft}px`,
3551
+ activeCellRowHeight: `${activeCellRowHeight}px`,
3552
+ activeCellRowOffset: `${activeCellRowOffset}px`
3553
+ }, node);
3554
+ }, [props.activeCellIndex]);
3453
3555
  useEffect6(() => {
3454
- const removeOnSCroll = brain.onScroll((scrollPos) => {
3455
- const node = domRef.current;
3456
- const topOffset = stateRef.current.top;
3457
- const leftOffset = stateRef.current.left;
3458
- node.style.transform = `translate3d(${-scrollPos.scrollLeft + leftOffset}px, ${-scrollPos.scrollTop + topOffset}px, 0px)`;
3459
- });
3460
- const removeOnRenderCountChange = brain.onRenderCountChange(() => {
3461
- rerender();
3462
- });
3463
- const removeOnAvailableSizeChange = brain.onAvailableSizeChange(() => {
3464
- rerender();
3556
+ const removeOnSCroll = brain.onScroll((scrollPosition) => {
3557
+ setInfiniteVarsOnNode({
3558
+ scrollTopForActiveCell: `${-scrollPosition.scrollTop}px`,
3559
+ scrollLeftForActiveCell: `${-scrollPosition.scrollLeft}px`
3560
+ }, domRef.current);
3465
3561
  });
3466
3562
  return () => {
3467
- removeOnAvailableSizeChange();
3468
- removeOnRenderCountChange();
3469
3563
  removeOnSCroll();
3470
3564
  };
3471
3565
  }, [brain]);
3472
- const scrollPosition = brain.getScrollPosition();
3473
3566
  return /* @__PURE__ */ createElement7("div", {
3567
+ className: ActiveIndicatorWrapperCls,
3568
+ "data-name": "active-cell"
3569
+ }, /* @__PURE__ */ createElement7("div", {
3474
3570
  ref: domRef,
3475
3571
  "data-name": "active-cell-indicator",
3476
3572
  className: `${baseCls2} ${active ? ActiveCellIndicatorCls.visible : ActiveCellIndicatorCls.hidden}`,
3477
- style: active ? {
3478
- transform: `translate3d(${-scrollPosition.scrollLeft + state.left}px, ${-scrollPosition.scrollTop + state.top}px,0)`,
3479
- width: state.colWidth,
3480
- height: state.rowHeight
3481
- } : void 0
3482
- });
3573
+ style: active ? ActiveStyle : void 0
3574
+ }));
3483
3575
  };
3484
3576
  var ActiveCellIndicator = memo5(ActiveCellIndicatorFn);
3485
3577
 
@@ -3527,7 +3619,7 @@ function HeadlessTable(props) {
3527
3619
  "onRenderUpdater"
3528
3620
  ]);
3529
3621
  const domRef = useRef7(null);
3530
- const [scrollSize, setTotalScrollSize] = useState5({
3622
+ const [scrollSize, setTotalScrollSize] = useState4({
3531
3623
  width: 0,
3532
3624
  height: 0
3533
3625
  });
@@ -3549,7 +3641,7 @@ function HeadlessTable(props) {
3549
3641
  };
3550
3642
  brain.update(size);
3551
3643
  };
3552
- const remove = setupResizeObserver(node, onResize);
3644
+ const remove = setupResizeObserver(node, onResize, { debounce: 50 });
3553
3645
  return remove;
3554
3646
  }, []);
3555
3647
  const onContainerScroll = useCallback4((scrollPos) => {
@@ -3601,7 +3693,7 @@ import {
3601
3693
  createContext as createContext2,
3602
3694
  useMemo as useMemo3,
3603
3695
  useEffect as useEffect8,
3604
- useState as useState6,
3696
+ useState as useState5,
3605
3697
  useRef as useRef10
3606
3698
  } from "react";
3607
3699
 
@@ -3739,14 +3831,14 @@ function forwardProps(propsToForward, props) {
3739
3831
  function getComponentStateRoot(config) {
3740
3832
  return memo6(function ComponentStateRoot(props) {
3741
3833
  var _a, _b;
3742
- const [initialSetupState] = useState6(() => {
3834
+ const [initialSetupState] = useState5(() => {
3743
3835
  return config.initSetupState ? config.initSetupState() : {};
3744
3836
  });
3745
3837
  const propsToStateSetRef = useRef10(new Set());
3746
3838
  const propsToForward = useMemo3(() => config.forwardProps ? config.forwardProps(initialSetupState) : {}, [initialSetupState]);
3747
3839
  const parentState = (_b = (_a = config.getParentState) == null ? void 0 : _a.call(config)) != null ? _b : null;
3748
3840
  const getParentState = useLatest(parentState);
3749
- const [wholeState] = useState6(() => {
3841
+ const [wholeState] = useState5(() => {
3750
3842
  let mappedState = {};
3751
3843
  if (propsToForward) {
3752
3844
  mappedState = forwardProps(propsToForward, props);
@@ -3887,6 +3979,12 @@ function getComponentStateRoot(config) {
3887
3979
  }
3888
3980
  }
3889
3981
  });
3982
+ useEffect8(() => {
3983
+ return () => {
3984
+ var _a2;
3985
+ (_a2 = config.cleanup) == null ? void 0 : _a2.call(config, getComponentState());
3986
+ };
3987
+ }, []);
3890
3988
  return /* @__PURE__ */ createElement9(Context.Provider, {
3891
3989
  value: contextValue
3892
3990
  }, props.children);
@@ -3909,28 +4007,28 @@ var useInternalProps = () => {
3909
4007
  };
3910
4008
 
3911
4009
  // src/components/InfiniteTable/utilities.css.ts
3912
- var alignItems = { center: "_16lm1iw14", stretch: "_16lm1iw15" };
3913
- var cssEllipsisClassName = "_16lm1iw1d _16lm1iw1e _16lm1iw19";
3914
- var cursor = { pointer: "_16lm1iwd" };
3915
- var display = { flex: "_16lm1iwm", block: "_16lm1iwn", inlineBlock: "_16lm1iwo" };
3916
- var flex = { "1": "_16lm1iwf", none: "_16lm1iwg" };
3917
- var flexFlow = { column: "_16lm1iw12", row: "_16lm1iw13" };
3918
- var justifyContent = { center: "_16lm1iw16", start: "_16lm1iw17", end: "_16lm1iw18" };
3919
- var left = { "0": "_16lm1iww", "100%": "_16lm1iwx" };
3920
- var overflow = { hidden: "_16lm1iw19", auto: "_16lm1iw1a", visible: "_16lm1iw1b" };
4010
+ var alignItems = { center: "_16lm1iw15", stretch: "_16lm1iw16" };
4011
+ var cssEllipsisClassName = "_16lm1iw1e _16lm1iw1f _16lm1iw1a";
4012
+ var cursor = { pointer: "_16lm1iwd", colResize: "_16lm1iwe" };
4013
+ var display = { flex: "_16lm1iwn", block: "_16lm1iwo", inlineBlock: "_16lm1iwp" };
4014
+ var flex = { "1": "_16lm1iwg", none: "_16lm1iwh" };
4015
+ var flexFlow = { column: "_16lm1iw13", row: "_16lm1iw14" };
4016
+ var justifyContent = { center: "_16lm1iw17", start: "_16lm1iw18", end: "_16lm1iw19" };
4017
+ var left = { "0": "_16lm1iwx", "100%": "_16lm1iwy" };
4018
+ var overflow = { hidden: "_16lm1iw1a", auto: "_16lm1iw1b", visible: "_16lm1iw1c" };
3921
4019
  var position = { relative: "_16lm1iw1", absolute: "_16lm1iw2", sticky: "_16lm1iw3", fixed: "_16lm1iw4" };
3922
- var top = { "0": "_16lm1iwu", "100%": "_16lm1iwv" };
4020
+ var top = { "0": "_16lm1iwv", "100%": "_16lm1iww" };
3923
4021
  var transformTranslateZero = "_16lm1iwa";
3924
- var userSelect = { none: "_16lm1iwp" };
3925
- var zIndex = { "1": "_16lm1iwh", "10": "_16lm1iwi", "1000": "_16lm1iwj", "10000": "_16lm1iwk", "100000": "_16lm1iwl" };
4022
+ var userSelect = { none: "_16lm1iwq" };
4023
+ var zIndex = { "1": "_16lm1iwi", "10": "_16lm1iwj", "1000": "_16lm1iwk", "10000": "_16lm1iwl", "100000": "_16lm1iwm" };
3926
4024
 
3927
4025
  // src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx
3928
4026
  var InfiniteTableBody = forwardRef2(function InfiniteTableBody2(props, ref) {
3929
- const { rootClassName: rootClassName11 } = useInternalProps();
4027
+ const { rootClassName: rootClassName13 } = useInternalProps();
3930
4028
  return /* @__PURE__ */ createElement10("div", __spreadProps(__spreadValues({
3931
4029
  ref
3932
4030
  }, props), {
3933
- className: join(`${rootClassName11}Body`, position.relative, flex["1"], transformTranslateZero, props.className)
4031
+ className: join(`${rootClassName13}Body`, position.relative, flex["1"], transformTranslateZero, props.className)
3934
4032
  }));
3935
4033
  });
3936
4034
 
@@ -3940,11 +4038,11 @@ import {
3940
4038
  forwardRef as forwardRef3
3941
4039
  } from "react";
3942
4040
  var InfiniteTableFooter = forwardRef3(function InfiniteTableFooter2(props, ref) {
3943
- const { rootClassName: rootClassName11 } = useInternalProps();
4041
+ const { rootClassName: rootClassName13 } = useInternalProps();
3944
4042
  return /* @__PURE__ */ createElement11("div", __spreadProps(__spreadValues({
3945
4043
  ref
3946
4044
  }, props), {
3947
- className: join(`${rootClassName11}Footer`, position.relative, display.flex, flexFlow.row, props.className)
4045
+ className: join(`${rootClassName13}Footer`, position.relative, display.flex, flexFlow.row, props.className)
3948
4046
  }));
3949
4047
  });
3950
4048
 
@@ -3952,10 +4050,10 @@ var InfiniteTableFooter = forwardRef3(function InfiniteTableFooter2(props, ref)
3952
4050
  import {
3953
4051
  Fragment as Fragment2,
3954
4052
  createContext as createContext4,
3955
- createElement as createElement15,
4053
+ createElement as createElement16,
3956
4054
  useMemo as useMemo5
3957
4055
  } from "react";
3958
- import { useCallback as useCallback7, useContext as useContext5, useEffect as useEffect11, useRef as useRef12 } from "react";
4056
+ import { useCallback as useCallback8, useContext as useContext5, useEffect as useEffect11, useRef as useRef13 } from "react";
3959
4057
  import { createPortal } from "react-dom";
3960
4058
 
3961
4059
  // src/components/DataSource/defaultFilterTypes.ts
@@ -4063,7 +4161,7 @@ import {
4063
4161
  useCallback as useCallback6,
4064
4162
  useMemo as useMemo4,
4065
4163
  useRef as useRef11,
4066
- useState as useState7
4164
+ useState as useState6
4067
4165
  } from "react";
4068
4166
 
4069
4167
  // src/components/InfiniteTable/hooks/useInfiniteTable.ts
@@ -4117,10 +4215,9 @@ var useColumnPointerEvents = ({
4117
4215
  columns,
4118
4216
  computedRemainingSpace
4119
4217
  }) => {
4120
- const [draggingDiff, setDraggingDiff] = useState7(null);
4121
- const [proxyOffset, setProxyOffset] = useState7(null);
4218
+ const [draggingDiff, setDraggingDiff] = useState6(null);
4219
+ const [proxyOffset, setProxyOffset] = useState6(null);
4122
4220
  const breakpointsRef = useRef11([]);
4123
- const pointerMoveRef = useRef11(null);
4124
4221
  const didDragRef = useRef11(false);
4125
4222
  const initialClientPos = useRef11(null);
4126
4223
  const currentDropIndexRef = useRef11(null);
@@ -4196,35 +4293,40 @@ var useColumnPointerEvents = ({
4196
4293
  }
4197
4294
  setDraggingDiff({ left: diffX, top: diffY });
4198
4295
  };
4199
- pointerMoveRef.current = onPointerMove;
4296
+ const onPointerUp = (e2) => {
4297
+ const target2 = domRef.current;
4298
+ target2.style.cursor = cursorRef.current;
4299
+ target2.releasePointerCapture(e2.pointerId);
4300
+ target2.removeEventListener("pointermove", onPointerMove);
4301
+ target2.removeEventListener("pointerup", onPointerUp);
4302
+ setDraggingDiff(null);
4303
+ componentActions.columnShifts = null;
4304
+ componentActions.draggingColumnId = null;
4305
+ if (!didDragRef.current && column.computedSortable) {
4306
+ column.toggleSort();
4307
+ }
4308
+ const dropIndex = currentDropIndexRef.current;
4309
+ if (dropIndex != null && dropIndex !== columnIndex) {
4310
+ const newOrder = moveXatY(computedColumnOrder, columnIndex, dropIndex > columnIndex ? dropIndex - 1 : dropIndex);
4311
+ componentActions.columnOrder = newOrder;
4312
+ }
4313
+ breakpointsRef.current = [];
4314
+ didDragRef.current = false;
4315
+ initialClientPos.current = null;
4316
+ currentDropIndexRef.current = null;
4317
+ };
4200
4318
  target.addEventListener("pointermove", onPointerMove);
4319
+ target.addEventListener("pointerup", onPointerUp);
4201
4320
  target.setPointerCapture(e.pointerId);
4202
- }, [columns, column, columnIndex, columnsArray, computedRemainingSpace]);
4203
- const onPointerUp = useCallback6((e) => {
4204
- const target = domRef.current;
4205
- target.style.cursor = cursorRef.current;
4206
- target.releasePointerCapture(e.pointerId);
4207
- target.removeEventListener("pointermove", pointerMoveRef.current);
4208
- setDraggingDiff(null);
4209
- componentActions.columnShifts = null;
4210
- componentActions.draggingColumnId = null;
4211
- if (!didDragRef.current && column.computedSortable) {
4212
- column.toggleSort();
4213
- }
4214
- const dropIndex = currentDropIndexRef.current;
4215
- if (dropIndex != null && dropIndex !== columnIndex) {
4216
- const newOrder = moveXatY(computedColumnOrder, columnIndex, dropIndex > columnIndex ? dropIndex - 1 : dropIndex);
4217
- componentActions.columnOrder = newOrder;
4218
- }
4219
- breakpointsRef.current = [];
4220
- pointerMoveRef.current = null;
4221
- didDragRef.current = false;
4222
- initialClientPos.current = null;
4223
- currentDropIndexRef.current = null;
4224
- }, [column, columnIndex, componentActions, computedColumnOrder]);
4321
+ }, [
4322
+ columns,
4323
+ column,
4324
+ columnIndex,
4325
+ columnsArray,
4326
+ computedRemainingSpace,
4327
+ computedColumnOrder
4328
+ ]);
4225
4329
  return {
4226
- onPointerUp: column.computedDraggable ? onPointerUp : () => {
4227
- },
4228
4330
  onPointerDown: column.computedDraggable ? onPointerDown : () => {
4229
4331
  },
4230
4332
  dragging,
@@ -4279,23 +4381,23 @@ function NumberFilterEditor(props) {
4279
4381
  import {
4280
4382
  createElement as createElement12
4281
4383
  } from "react";
4282
- import { useEffect as useEffect9, useState as useState8 } from "react";
4384
+ import { useEffect as useEffect9, useState as useState7 } from "react";
4283
4385
 
4284
4386
  // src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts
4285
4387
  var import_createRuntimeFn = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
4286
- var CellCls = "_1eexc2a5 _16lm1iwm _16lm1iw13 _16lm1iw14 _16lm1iw2 _16lm1iw1c _16lm1iw1d";
4287
- var HeaderCellContentRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_12zfob117 _16lm1iwr _16lm1iwt _16lm1iwm _16lm1iw13 _16lm1iw14", variantClassNames: { filtered: { false: "_12zfob118", true: "_12zfob119" } }, defaultVariants: {}, compoundVariants: [] });
4388
+ var CellCls = "_1eexc2a5 _16lm1iwn _16lm1iw14 _16lm1iw15 _16lm1iw2 _16lm1iw1d _16lm1iw1e";
4389
+ var HeaderCellContentRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_12zfob117 _16lm1iws _16lm1iwu _16lm1iwn _16lm1iw14 _16lm1iw15", variantClassNames: { filtered: { false: "_12zfob118", true: "_12zfob119" } }, defaultVariants: {}, compoundVariants: [] });
4288
4390
  var HeaderCellProxy = "_12zfob10";
4289
- var HeaderCellRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_12zfob1h _16lm1iwn", variantClassNames: { rowActive: { false: "_12zfob1i", true: "_12zfob1j" }, zebra: { false: "_12zfob1k", even: "_12zfob1l", odd: "_12zfob1m" }, dragging: { true: "_12zfob1n", false: "_12zfob1o" }, first: { true: "_12zfob1p", false: "_12zfob1q" }, last: { true: "_12zfob1r", false: "_12zfob1s" }, groupByField: { true: "_12zfob1t", false: "_12zfob1u" }, firstInCategory: { true: "_12zfob1v", false: "_12zfob1w" }, lastInCategory: { true: "_12zfob1x", false: "_12zfob1y" }, pinned: { start: "_12zfob1z", end: "_12zfob110", false: "_12zfob111" }, filtered: { true: "_12zfob112", false: "_12zfob113" } }, defaultVariants: {}, compoundVariants: [[{ pinned: "start", lastInCategory: true }, "_12zfob114"], [{ pinned: "end", firstInCategory: true }, "_12zfob115"], [{ pinned: false, lastInCategory: true }, "_12zfob116"]] });
4290
- var HeaderClsRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_12zfob17 _16lm1iwn _16lm1iw2", variantClassNames: { pinned: { start: "_12zfob18", end: "_12zfob19", false: "_12zfob1a" }, virtualized: { true: "_12zfob1b", false: "_12zfob1c" }, overflow: { true: "_12zfob1d", false: "_12zfob1e" } }, defaultVariants: {}, compoundVariants: [[{ overflow: true, pinned: "start" }, "_12zfob1f"], [{ overflow: true, pinned: "end" }, "_12zfob1g"]] });
4291
- var HeaderFilterCls = "_12zfob11c _16lm1iwm _16lm1iw13 _16lm1iw14 _16lm1iw1";
4292
- var HeaderFilterEditorCls = "_16lm1iwt _16lm1iwr";
4293
- var HeaderGroupCls = "_12zfob11b _16lm1iwm _16lm1iw13 _16lm1iw14";
4391
+ var HeaderCellRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_12zfob1h _16lm1iwo", variantClassNames: { rowActive: { false: "_12zfob1i", true: "_12zfob1j" }, zebra: { false: "_12zfob1k", even: "_12zfob1l", odd: "_12zfob1m" }, dragging: { true: "_12zfob1n", false: "_12zfob1o" }, first: { true: "_12zfob1p", false: "_12zfob1q" }, last: { true: "_12zfob1r", false: "_12zfob1s" }, groupByField: { true: "_12zfob1t", false: "_12zfob1u" }, firstInCategory: { true: "_12zfob1v", false: "_12zfob1w" }, lastInCategory: { true: "_12zfob1x", false: "_12zfob1y" }, pinned: { start: "_12zfob1z", end: "_12zfob110", false: "_12zfob111" }, filtered: { true: "_12zfob112", false: "_12zfob113" } }, defaultVariants: {}, compoundVariants: [[{ pinned: "start", lastInCategory: true }, "_12zfob114"], [{ pinned: "end", firstInCategory: true }, "_12zfob115"], [{ pinned: false, lastInCategory: true }, "_12zfob116"]] });
4392
+ var HeaderClsRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_12zfob17 _16lm1iwo _16lm1iw2", variantClassNames: { pinned: { start: "_12zfob18", end: "_12zfob19", false: "_12zfob1a" }, virtualized: { true: "_12zfob1b", false: "_12zfob1c" }, overflow: { true: "_12zfob1d", false: "_12zfob1e" } }, defaultVariants: {}, compoundVariants: [[{ overflow: true, pinned: "start" }, "_12zfob1f"], [{ overflow: true, pinned: "end" }, "_12zfob1g"]] });
4393
+ var HeaderFilterCls = "_12zfob11c _16lm1iwn _16lm1iw14 _16lm1iw15 _16lm1iw1";
4394
+ var HeaderFilterEditorCls = "_16lm1iwu _16lm1iws";
4395
+ var HeaderGroupCls = "_12zfob11b _16lm1iwn _16lm1iw14 _16lm1iw15";
4294
4396
  var HeaderScrollbarPlaceholderCls = "_12zfob16 _16lm1iw2";
4295
4397
  var HeaderSortIconCls = "_16lm1iw1";
4296
4398
  var HeaderSortIconIndexCls = "_12zfob15";
4297
4399
  var HeaderSortIconRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "", variantClassNames: { align: { start: "_12zfob12", center: "_12zfob13", end: "_12zfob14" } }, defaultVariants: {}, compoundVariants: [] });
4298
- var HeaderWrapperCls = "_12zfob11a _16lm1iw19 _16lm1iw1 _16lm1iwm _16lm1iw13";
4400
+ var HeaderWrapperCls = "_12zfob11a _16lm1iw1a _16lm1iw1 _16lm1iwn _16lm1iw14";
4299
4401
 
4300
4402
  // src/components/InfiniteTable/components/icons/SortIcon.tsx
4301
4403
  var defaultLineStyle = {
@@ -4306,8 +4408,8 @@ var defaultLineStyle = {
4306
4408
  var InfiniteTableIconClassName = "InfiniteTableIcon";
4307
4409
  function SortIcon(props) {
4308
4410
  var _a;
4309
- const [rendered, setRendered] = useState8(true);
4310
- const [opacity, setOpacity] = useState8(0);
4411
+ const [rendered, setRendered] = useState7(true);
4412
+ const [opacity, setOpacity] = useState7(0);
4311
4413
  const { direction, lineWidth = 1, style, className, index } = props;
4312
4414
  const showIndex = index != null && index > 0;
4313
4415
  const size = (_a = props.size) != null ? _a : 16;
@@ -4386,20 +4488,20 @@ var useInfiniteTableState = () => {
4386
4488
  // src/components/InfiniteTable/components/cell.css.ts
4387
4489
  var import_createRuntimeFn2 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
4388
4490
  var CellClsVariants = { shifting: "_1eexc2a3", dragging: "_1eexc2a4" };
4389
- var ColumnCellCls = "_1eexc2a5 _16lm1iwm _16lm1iw13 _16lm1iw14 _16lm1iw2 _16lm1iw1c _16lm1iw1d";
4491
+ var ColumnCellCls = "_1eexc2a5 _16lm1iwn _16lm1iw14 _16lm1iw15 _16lm1iw2 _16lm1iw1d _16lm1iw1e";
4390
4492
  var ColumnCellRecipe = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "_1eexc2a7", variantClassNames: { dragging: { false: "_1eexc2a8", true: "_1eexc2a9" }, rowActive: { false: "_1eexc2aa", true: "_1eexc2ab" }, zebra: { false: "_1eexc2ac", even: "_1eexc2ad", odd: "_1eexc2ae" }, first: { true: "_1eexc2af", false: "_1eexc2ag" }, last: { true: "_1eexc2ah", false: "_1eexc2ai" }, groupByField: { true: "_1eexc2aj", false: "_1eexc2ak" }, firstInCategory: { true: "_1eexc2al", false: "_1eexc2am" }, lastInCategory: { true: "_1eexc2an", false: "_1eexc2ao" }, pinned: { start: "_1eexc2ap", end: "_1eexc2aq", false: "_1eexc2ar" }, filtered: { true: "_1eexc2as", false: "_1eexc2at" } }, defaultVariants: {}, compoundVariants: [[{ pinned: "start", lastInCategory: true }, "_1eexc2au"], [{ pinned: "end", firstInCategory: true }, "_1eexc2av"]] });
4391
4493
 
4392
4494
  // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
4393
4495
  var { rootClassName: rootClassName5 } = internalProps;
4394
4496
  var InfiniteTableCellClassName = `${rootClassName5}Cell`;
4395
4497
  var InfiniteTableCellContentClassName = `${rootClassName5}Cell_content`;
4498
+ var columnWidthAtIndex2 = stripVar(InternalVars.columnWidthAtIndex);
4396
4499
  function InfiniteTableCellFn(props) {
4397
4500
  var _b, _c, _d;
4398
4501
  const _a = props, {
4399
4502
  cssEllipsis = true,
4400
4503
  virtualized = true,
4401
4504
  skipColumnShifting = false,
4402
- offsetProperty = "left",
4403
4505
  contentStyle,
4404
4506
  column,
4405
4507
  domRef,
@@ -4407,7 +4509,6 @@ function InfiniteTableCellFn(props) {
4407
4509
  contentClassName,
4408
4510
  afterChildren,
4409
4511
  beforeChildren,
4410
- offset,
4411
4512
  cellType,
4412
4513
  cssPosition: _cssPosition,
4413
4514
  renderChildren
@@ -4415,7 +4516,6 @@ function InfiniteTableCellFn(props) {
4415
4516
  "cssEllipsis",
4416
4517
  "virtualized",
4417
4518
  "skipColumnShifting",
4418
- "offsetProperty",
4419
4519
  "contentStyle",
4420
4520
  "column",
4421
4521
  "domRef",
@@ -4423,7 +4523,6 @@ function InfiniteTableCellFn(props) {
4423
4523
  "contentClassName",
4424
4524
  "afterChildren",
4425
4525
  "beforeChildren",
4426
- "offset",
4427
4526
  "cellType",
4428
4527
  "cssPosition",
4429
4528
  "renderChildren"
@@ -4432,10 +4531,10 @@ function InfiniteTableCellFn(props) {
4432
4531
  const { columnShifts } = useInfiniteTableState();
4433
4532
  const shifting = !!columnShifts;
4434
4533
  const style = __spreadValues({
4435
- width
4534
+ width: `var(${columnWidthAtIndex2}-${column.computedVisibleIndex})`
4436
4535
  }, domProps.style);
4437
4536
  if (!skipColumnShifting && columnShifts && columnShifts[column.computedVisibleIndex]) {
4438
- const shiftLeft = columnShifts[column.computedVisibleIndex] + (offset != null ? offset : 0);
4537
+ const shiftLeft = columnShifts[column.computedVisibleIndex];
4439
4538
  if (virtualized) {
4440
4539
  style.left = shiftLeft;
4441
4540
  } else {
@@ -4465,13 +4564,13 @@ var InfiniteTableCell = memo7(InfiniteTableCellFn);
4465
4564
  import {
4466
4565
  createElement as createElement14
4467
4566
  } from "react";
4468
- import { useEffect as useEffect10, useState as useState9 } from "react";
4567
+ import { useEffect as useEffect10, useState as useState8 } from "react";
4469
4568
  var { rootClassName: rootClassName6 } = internalProps;
4470
4569
  var InfiniteTableColumnHeaderFilterClassName = `${rootClassName6}HeaderCell__filter`;
4471
4570
  var stopPropagation = (e) => e.stopPropagation();
4472
4571
  function InfiniteTableColumnHeaderFilter(props) {
4473
4572
  var _a, _b, _c, _d;
4474
- const [theValue, setTheValue] = useState9((_b = (_a = props.columnFilterValue) == null ? void 0 : _a.filterValue) != null ? _b : "");
4573
+ const [theValue, setTheValue] = useState8((_b = (_a = props.columnFilterValue) == null ? void 0 : _a.filterValue) != null ? _b : "");
4475
4574
  const onInputChange = (filterValue) => {
4476
4575
  setTheValue(filterValue);
4477
4576
  props.onChange(filterValue);
@@ -4519,10 +4618,547 @@ function InfiniteTableColumnHeaderFilterEmpty() {
4519
4618
  });
4520
4619
  }
4521
4620
 
4621
+ // src/components/InfiniteTable/components/InfiniteTableHeader/useColumnResizeHandle.tsx
4622
+ import {
4623
+ createElement as createElement15
4624
+ } from "react";
4625
+ import { useCallback as useCallback7 } from "react";
4626
+
4627
+ // src/components/flexbox/index.ts
4628
+ var computeFlex = (params) => {
4629
+ const {
4630
+ availableSize,
4631
+ items,
4632
+ minSize: defaultMinSize,
4633
+ maxSize: defaultMaxSize
4634
+ } = params;
4635
+ if (availableSize < 0) {
4636
+ throw "The provided availableSize cannot be negative!";
4637
+ }
4638
+ let totalFixedSize = 0;
4639
+ let totalFlex = 0;
4640
+ let totalFlexCount = 0;
4641
+ const minSizes = [];
4642
+ const maxSizes = [];
4643
+ items.forEach((item, i) => {
4644
+ var _a, _b, _c, _d, _e;
4645
+ let maxSize = (_b = (_a = item.maxSize) != null ? _a : defaultMaxSize) != null ? _b : void 0;
4646
+ let minSize = (_d = (_c = item.minSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
4647
+ minSizes.push(minSize);
4648
+ maxSizes.push(maxSize);
4649
+ if (item.size != null) {
4650
+ if (maxSize != null && item.size > maxSize) {
4651
+ item.size = maxSize;
4652
+ }
4653
+ if (minSize != null && item.size < minSize) {
4654
+ item.size = minSize;
4655
+ }
4656
+ }
4657
+ const itemFlex = item.flex == 0 ? null : item.flex;
4658
+ if (item.size == null && itemFlex == null) {
4659
+ throw `Items must specify either a size or a flex property. Item at index ${i} doesn't have either of those.`;
4660
+ }
4661
+ if (itemFlex != null) {
4662
+ totalFlexCount += 1;
4663
+ }
4664
+ totalFlex += itemFlex != null ? itemFlex : 0;
4665
+ totalFixedSize += (_e = item.size) != null ? _e : 0;
4666
+ });
4667
+ let availableSizeForFlex = params.computeSpecialSpaceDistribution ? Math.max(availableSize, 0) : Math.max(availableSize - totalFixedSize, 0);
4668
+ let sizePerFlex = availableSizeForFlex / totalFlex;
4669
+ let maxxedFlexItems = {};
4670
+ let minnedFlexItems = {};
4671
+ let constrainedCount = 0;
4672
+ items.forEach((item, index) => {
4673
+ var _a, _b, _c, _d;
4674
+ if (item.flex != null) {
4675
+ const approxFlexSize = sizePerFlex * item.flex;
4676
+ let maxSize = (_b = (_a = item.maxSize) != null ? _a : defaultMaxSize) != null ? _b : void 0;
4677
+ let minSize = (_d = (_c = item.minSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
4678
+ let constrained = false;
4679
+ let substractSize = 0;
4680
+ if (maxSize != null && approxFlexSize > maxSize) {
4681
+ maxxedFlexItems[index] = true;
4682
+ constrained = true;
4683
+ substractSize = maxSize;
4684
+ }
4685
+ if (minSize != null && approxFlexSize < minSize) {
4686
+ minnedFlexItems[index] = true;
4687
+ constrained = true;
4688
+ substractSize = minSize;
4689
+ }
4690
+ if (constrained) {
4691
+ constrainedCount += 1;
4692
+ totalFlexCount -= 1;
4693
+ totalFlex -= item.flex;
4694
+ availableSizeForFlex -= substractSize;
4695
+ }
4696
+ }
4697
+ });
4698
+ if (constrainedCount) {
4699
+ sizePerFlex = availableSizeForFlex / totalFlex;
4700
+ }
4701
+ let flexSizes = [];
4702
+ let currentFlexCount = 0;
4703
+ let remainingSizeForFlex = availableSizeForFlex;
4704
+ let remainingFlex = totalFlex;
4705
+ let totalTakenSize = 0;
4706
+ let flexSizeSum = 0;
4707
+ const computedSizes = [];
4708
+ const resultItems = items.map((item, index) => {
4709
+ var _a, _b, _c, _d, _e;
4710
+ const sizedItem = __spreadValues({}, item);
4711
+ let maxSize = (_b = (_a = item.maxSize) != null ? _a : defaultMaxSize) != null ? _b : void 0;
4712
+ let minSize = (_d = (_c = item.minSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
4713
+ let flexSize = 0;
4714
+ const maxxed = maxxedFlexItems[index];
4715
+ const minned = minnedFlexItems[index];
4716
+ const constrained = maxxed || minned;
4717
+ let computedSize = (_e = item.size) != null ? _e : 0;
4718
+ if (item.flex != null) {
4719
+ if (constrained) {
4720
+ if (minned) {
4721
+ flexSize = minSize;
4722
+ }
4723
+ if (maxxed) {
4724
+ flexSize = maxSize;
4725
+ }
4726
+ } else {
4727
+ currentFlexCount += 1;
4728
+ const constrain = (size) => {
4729
+ if (maxSize != null && size > maxSize) {
4730
+ size = maxSize;
4731
+ }
4732
+ if (minSize != null && size < minSize) {
4733
+ size = minSize;
4734
+ }
4735
+ return size;
4736
+ };
4737
+ if (currentFlexCount === totalFlexCount) {
4738
+ flexSize = constrain(remainingSizeForFlex);
4739
+ } else {
4740
+ flexSize = constrain(Math.round(item.flex * sizePerFlex));
4741
+ flexSizeSum += flexSize;
4742
+ remainingSizeForFlex = availableSizeForFlex - flexSizeSum;
4743
+ remainingFlex -= item.flex;
4744
+ sizePerFlex = remainingSizeForFlex / remainingFlex;
4745
+ }
4746
+ }
4747
+ computedSize = flexSize;
4748
+ sizedItem.flexSize = flexSize;
4749
+ }
4750
+ flexSizes.push(flexSize);
4751
+ computedSizes.push(computedSize);
4752
+ sizedItem.computedSize = computedSize;
4753
+ totalTakenSize += computedSize;
4754
+ return sizedItem;
4755
+ });
4756
+ return {
4757
+ items: resultItems,
4758
+ flexSizes,
4759
+ minSizes,
4760
+ maxSizes,
4761
+ computedSizes,
4762
+ remainingSize: Math.round(availableSize - totalTakenSize)
4763
+ };
4764
+ };
4765
+ function resizeClamp(value, min, max, direction) {
4766
+ if (min != null && value <= min) {
4767
+ return { value: min, clamped: "min", diff: (value - min) * direction };
4768
+ }
4769
+ if (max != null && value >= max) {
4770
+ return { value: max, clamped: "max", diff: (max - value) * direction };
4771
+ }
4772
+ return { value, clamped: false, diff: 0 };
4773
+ }
4774
+ var computeResize = (params) => {
4775
+ const { availableSize, reservedWidth = 0 } = params;
4776
+ const columnSizing = Object.keys(params.columnSizing).reduce((acc, key) => {
4777
+ acc[key] = __spreadValues({}, params.columnSizing[key]);
4778
+ return acc;
4779
+ }, {});
4780
+ if (availableSize < 0) {
4781
+ throw "The provided availableSize cannot be negative!";
4782
+ }
4783
+ let dragHandleOffset = params.dragHandleOffset;
4784
+ const firstIndex = params.dragHandlePositionAfter;
4785
+ const secondIndex = params.dragHandlePositionAfter + 1;
4786
+ const firstItem = params.items[firstIndex];
4787
+ const secondItem = params.items[secondIndex];
4788
+ const firstId = firstItem.id;
4789
+ const secondId = secondItem == null ? void 0 : secondItem.id;
4790
+ const firstSize = firstItem.computedWidth;
4791
+ const firstMinSize = firstItem.computedMinWidth;
4792
+ const firstMaxSize = firstItem.computedMaxWidth;
4793
+ const firstPropertyToAdjust = firstItem.computedFlex ? "flex" : "width";
4794
+ const secondSize = secondItem == null ? void 0 : secondItem.computedWidth;
4795
+ const secondMinSize = secondItem == null ? void 0 : secondItem.computedMinWidth;
4796
+ const secondMaxSize = secondItem == null ? void 0 : secondItem.computedMaxWidth;
4797
+ const secondPropertyToAdjust = (secondItem == null ? void 0 : secondItem.computedFlex) ? "flex" : "width";
4798
+ let maxReached = false;
4799
+ let minReached = false;
4800
+ const direction = dragHandleOffset > 0 ? 1 : -1;
4801
+ let {
4802
+ value: firstAdjustedSize,
4803
+ clamped: firstClamped,
4804
+ diff: firstDiff
4805
+ } = resizeClamp(firstSize + dragHandleOffset, firstMinSize, firstMaxSize, direction);
4806
+ if (params.shareSpaceOnResize) {
4807
+ if (secondItem == null) {
4808
+ columnSizing[firstId] = __spreadProps(__spreadValues({}, columnSizing[firstId]), {
4809
+ [firstPropertyToAdjust]: firstAdjustedSize
4810
+ });
4811
+ minReached = firstClamped === "min";
4812
+ maxReached = firstClamped === "max";
4813
+ const adjustedDiff2 = firstAdjustedSize - firstSize;
4814
+ return {
4815
+ adjustedDiff: adjustedDiff2,
4816
+ reservedWidth,
4817
+ columnSizing,
4818
+ minReached,
4819
+ maxReached,
4820
+ constrained: minReached || maxReached
4821
+ };
4822
+ }
4823
+ let {
4824
+ value: secondAdjustedSize,
4825
+ clamped: secondClamped,
4826
+ diff: secondDiff
4827
+ } = resizeClamp(secondSize - dragHandleOffset, secondMinSize, secondMaxSize, direction);
4828
+ if (firstClamped && secondClamped) {
4829
+ if (Math.abs(firstDiff) > Math.abs(secondDiff)) {
4830
+ secondClamped = false;
4831
+ } else {
4832
+ firstClamped = false;
4833
+ }
4834
+ }
4835
+ if (!firstClamped && !secondClamped) {
4836
+ } else if (firstClamped) {
4837
+ const clampResultForSecond = resizeClamp(secondSize - dragHandleOffset - firstDiff, secondMinSize, secondMaxSize, direction);
4838
+ secondAdjustedSize = clampResultForSecond.value;
4839
+ secondClamped = clampResultForSecond.clamped;
4840
+ secondDiff = clampResultForSecond.diff;
4841
+ } else if (secondClamped) {
4842
+ const clampResultForFirst = resizeClamp(firstSize + dragHandleOffset + secondDiff, firstMinSize, firstMaxSize, direction);
4843
+ firstAdjustedSize = clampResultForFirst.value;
4844
+ firstClamped = clampResultForFirst.clamped;
4845
+ firstDiff = clampResultForFirst.diff;
4846
+ }
4847
+ columnSizing[firstId] = __spreadProps(__spreadValues({}, columnSizing[firstId]), {
4848
+ [firstPropertyToAdjust]: firstAdjustedSize
4849
+ });
4850
+ columnSizing[secondId] = __spreadProps(__spreadValues({}, columnSizing[secondId]), {
4851
+ [secondPropertyToAdjust]: secondAdjustedSize
4852
+ });
4853
+ minReached = firstClamped === "min" || secondClamped === "min";
4854
+ maxReached = firstClamped === "max" || secondClamped === "max";
4855
+ } else {
4856
+ columnSizing[firstId] = __spreadProps(__spreadValues({}, columnSizing[firstId]), {
4857
+ [firstPropertyToAdjust]: firstAdjustedSize
4858
+ });
4859
+ minReached = firstClamped === "min";
4860
+ maxReached = firstClamped === "max";
4861
+ }
4862
+ const adjustedDiff = firstAdjustedSize - firstSize;
4863
+ return {
4864
+ adjustedDiff,
4865
+ reservedWidth: !params.shareSpaceOnResize ? reservedWidth - adjustedDiff : reservedWidth,
4866
+ columnSizing,
4867
+ minReached,
4868
+ maxReached,
4869
+ constrained: minReached || maxReached
4870
+ };
4871
+ };
4872
+ function sum(a, b) {
4873
+ return a + b;
4874
+ }
4875
+ function cloneColumnSizing(columnSizing) {
4876
+ const newColumnSizing = Object.keys(columnSizing).reduce((acc, key) => {
4877
+ acc[key] = __spreadValues({}, columnSizing[key]);
4878
+ return acc;
4879
+ }, {});
4880
+ return newColumnSizing;
4881
+ }
4882
+ var computeGroupResize = (params) => {
4883
+ const { availableSize, reservedWidth = 0 } = params;
4884
+ const columnSizing = Object.keys(params.columnSizing).reduce((acc, key) => {
4885
+ acc[key] = __spreadValues({}, params.columnSizing[key]);
4886
+ return acc;
4887
+ }, {});
4888
+ if (availableSize < 0) {
4889
+ throw "The provided availableSize cannot be negative!";
4890
+ }
4891
+ let dragHandleOffset = params.dragHandleOffset;
4892
+ const beforeIndexes = [...new Array(params.columnGroupSize)].map((_, index) => params.dragHandlePositionAfter - index).reverse();
4893
+ const beforeItems = beforeIndexes.map((i) => params.items[i]);
4894
+ const beforeSizes = beforeItems.map((item) => item.computedWidth);
4895
+ const beforePropertiesToAdjust = beforeItems.map((item) => item.computedFlex ? "flex" : "width");
4896
+ let unresizableWidth = 0;
4897
+ const { computedSizes } = computeFlex({
4898
+ items: beforeItems.map((item) => {
4899
+ if (item.resizable === false) {
4900
+ unresizableWidth += item.computedWidth;
4901
+ }
4902
+ return {
4903
+ maxSize: item.computedMaxWidth,
4904
+ minSize: item.computedMinWidth,
4905
+ flex: item.resizable ? item.computedWidth : null,
4906
+ size: 0
4907
+ };
4908
+ }),
4909
+ computeSpecialSpaceDistribution: true,
4910
+ availableSize: Math.max(beforeSizes.reduce(sum, 0) + dragHandleOffset - unresizableWidth, 0)
4911
+ });
4912
+ const diffsForEachItem = beforeItems.map((item, index) => {
4913
+ return computedSizes[index] - item.computedWidth;
4914
+ });
4915
+ let groupMinReached = true;
4916
+ let groupMaxReached = true;
4917
+ let groupConstrained = true;
4918
+ const adjustedDiffs = [];
4919
+ diffsForEachItem.forEach((diff, i) => {
4920
+ const item = beforeItems[i];
4921
+ if (!item.resizable) {
4922
+ adjustedDiffs.push(0);
4923
+ return;
4924
+ }
4925
+ const propertyToAdjust = beforePropertiesToAdjust[i];
4926
+ const itemSize = beforeSizes[i];
4927
+ const currentColumnSizing = cloneColumnSizing(columnSizing);
4928
+ const { maxReached, minReached, constrained, adjustedDiff: adjustedDiff2 } = computeResize({
4929
+ availableSize: params.availableSize,
4930
+ reservedWidth: params.reservedWidth,
4931
+ dragHandleOffset: diff,
4932
+ dragHandlePositionAfter: beforeIndexes[i],
4933
+ shareSpaceOnResize: false,
4934
+ items: params.items,
4935
+ columnSizing: currentColumnSizing
4936
+ });
4937
+ columnSizing[item.id] = __spreadProps(__spreadValues({}, currentColumnSizing[item.id]), {
4938
+ [propertyToAdjust]: itemSize + adjustedDiff2
4939
+ });
4940
+ adjustedDiffs.push(adjustedDiff2);
4941
+ if (!maxReached) {
4942
+ groupMaxReached = false;
4943
+ }
4944
+ if (!minReached) {
4945
+ groupMinReached = false;
4946
+ }
4947
+ if (!constrained) {
4948
+ groupConstrained = false;
4949
+ }
4950
+ });
4951
+ const adjustedDiff = adjustedDiffs.reduce(sum, 0);
4952
+ return {
4953
+ minReached: groupMinReached,
4954
+ maxReached: groupMaxReached,
4955
+ constrained: groupConstrained,
4956
+ adjustedDiffs,
4957
+ adjustedDiff,
4958
+ columnSizing,
4959
+ reservedWidth: reservedWidth - adjustedDiff
4960
+ };
4961
+ };
4962
+
4963
+ // src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/index.tsx
4964
+ import React20, { useRef as useRef12, useState as useState9 } from "react";
4965
+
4966
+ // src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/columnResizer.ts
4967
+ function getColumnResizer(colIndex, {
4968
+ columns,
4969
+ shareSpaceOnResize,
4970
+ domRef
4971
+ }) {
4972
+ const column = columns[colIndex];
4973
+ return {
4974
+ resize(diff) {
4975
+ setInfiniteColumnWidth(colIndex, column.computedWidth + diff, domRef.current);
4976
+ const nextColIndex = colIndex + 1;
4977
+ if (shareSpaceOnResize) {
4978
+ const nextColumn = columns[nextColIndex];
4979
+ if (!nextColumn) {
4980
+ return;
4981
+ }
4982
+ setInfiniteColumnWidth(nextColIndex, nextColumn.computedWidth - diff, domRef.current);
4983
+ setInfiniteColumnOffset(nextColIndex, nextColumn.computedOffset + diff, domRef.current);
4984
+ return;
4985
+ }
4986
+ for (let i = nextColIndex, len = columns.length; i < len; i++) {
4987
+ setInfiniteColumnOffset(i, columns[i].computedOffset + diff, domRef.current);
4988
+ }
4989
+ }
4990
+ };
4991
+ }
4992
+ function getColumnGroupResizer(colIndexes, config) {
4993
+ const lastColIndex = colIndexes[colIndexes.length - 1];
4994
+ return {
4995
+ resize(diffs) {
4996
+ const { columns, domRef } = config;
4997
+ let offset = columns[colIndexes[0]].computedOffset;
4998
+ let diffSum = 0;
4999
+ const node = domRef.current;
5000
+ diffs.forEach((diff, i) => {
5001
+ diffSum += diff;
5002
+ const colIndex = colIndexes[i];
5003
+ const column = columns[colIndex];
5004
+ const newWidth = column.computedWidth + diff;
5005
+ setInfiniteColumnWidth(colIndex, newWidth, node);
5006
+ if (offset) {
5007
+ setInfiniteColumnOffset(colIndex, offset, node);
5008
+ }
5009
+ offset += newWidth;
5010
+ });
5011
+ for (let i = lastColIndex + 1; i < columns.length; i++) {
5012
+ setInfiniteColumnOffset(i, columns[i].computedOffset + diffSum, node);
5013
+ }
5014
+ }
5015
+ };
5016
+ }
5017
+
5018
+ // src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/ResizeHandle.css.ts
5019
+ var import_createRuntimeFn3 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
5020
+ var ResizeHandleCls = "zneyzh0 _16lm1iw2 _16lm1iwv _16lm1iw11 _16lm1iwz _16lm1iwe";
5021
+ var ResizeHandleDraggerClsRecipe = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "zneyzh1 _16lm1iw2 _16lm1iwv _16lm1iwz", variantClassNames: { constrained: { false: "zneyzh2", true: "zneyzh3" } }, defaultVariants: {}, compoundVariants: [] });
5022
+
5023
+ // src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/index.tsx
5024
+ var { rootClassName: rootClassName7 } = internalProps;
5025
+ var InfiniteTableHeaderCellResizeHandleCls = `${rootClassName7}HeaderCell_ResizeHandle`;
5026
+ function ResizeHandleFn(props) {
5027
+ const domRef = useRef12(null);
5028
+ const [constrained, setConstrained] = useState9(false);
5029
+ const constrainedRef = useRef12(constrained);
5030
+ constrainedRef.current = constrained;
5031
+ const onPointerDown = (e) => {
5032
+ e.stopPropagation();
5033
+ const shareSpaceOnResize = !!e.shiftKey;
5034
+ const pointerId = e.pointerId;
5035
+ const initialX = e.clientX;
5036
+ const target = e.target;
5037
+ target.setPointerCapture(pointerId);
5038
+ const resizer = getColumnResizer(props.columnIndex, {
5039
+ columns: props.columns,
5040
+ shareSpaceOnResize,
5041
+ domRef
5042
+ });
5043
+ const resizeDiff = (diff) => {
5044
+ const { adjustedDiff, constrained: constrained2 } = props.computeResize({
5045
+ diff,
5046
+ shareSpaceOnResize
5047
+ });
5048
+ if (constrainedRef.current !== constrained2) {
5049
+ setConstrained(constrained2);
5050
+ }
5051
+ resizer.resize(adjustedDiff);
5052
+ return adjustedDiff;
5053
+ };
5054
+ const onPointerMove = (e2) => {
5055
+ resizeDiff(Math.round(e2.clientX - initialX));
5056
+ };
5057
+ const onPointerUp = (e2) => {
5058
+ target.releasePointerCapture(pointerId);
5059
+ target.removeEventListener("pointermove", onPointerMove);
5060
+ target.removeEventListener("pointerup", onPointerUp);
5061
+ const diff = Math.round(e2.clientX - initialX);
5062
+ const adjustedDiff = resizeDiff(diff);
5063
+ props.onResize({ diff: adjustedDiff, shareSpaceOnResize });
5064
+ };
5065
+ target.addEventListener("pointermove", onPointerMove);
5066
+ target.addEventListener("pointerup", onPointerUp);
5067
+ };
5068
+ return /* @__PURE__ */ React20.createElement("div", {
5069
+ ref: domRef,
5070
+ className: `${InfiniteTableHeaderCellResizeHandleCls} ${ResizeHandleCls}`,
5071
+ onPointerDown
5072
+ }, /* @__PURE__ */ React20.createElement("div", {
5073
+ className: ResizeHandleDraggerClsRecipe({
5074
+ constrained
5075
+ })
5076
+ }));
5077
+ }
5078
+ var ResizeHandle = React20.memo(ResizeHandleFn);
5079
+
5080
+ // src/components/InfiniteTable/components/InfiniteTableHeader/useColumnResizeHandle.tsx
5081
+ function useColumnResizeHandle(column) {
5082
+ const {
5083
+ computed: { computedVisibleColumns },
5084
+ componentState: { domRef },
5085
+ getState,
5086
+ getComputed,
5087
+ componentActions
5088
+ } = useInfiniteTable();
5089
+ const computeResizeForDiff = useCallback7(({
5090
+ diff,
5091
+ shareSpaceOnResize
5092
+ }) => {
5093
+ const state = getState();
5094
+ const { columnSizing, viewportReservedWidth, bodySize, activeCellIndex } = state;
5095
+ const columns = getComputed().computedVisibleColumns;
5096
+ let atLeastOneFlex = false;
5097
+ const columnSizingWithFlex = columns.reduce((acc, col) => {
5098
+ if (col.computedFlex) {
5099
+ acc[col.id] = __spreadProps(__spreadValues({}, columnSizing[col.id]), { flex: col.computedWidth });
5100
+ atLeastOneFlex = true;
5101
+ }
5102
+ return acc;
5103
+ }, {});
5104
+ const columnSizingForResize = atLeastOneFlex ? __spreadValues(__spreadValues({}, columnSizing), columnSizingWithFlex) : columnSizing;
5105
+ const result = computeResize({
5106
+ shareSpaceOnResize,
5107
+ availableSize: bodySize.width,
5108
+ reservedWidth: viewportReservedWidth || 0,
5109
+ dragHandleOffset: diff,
5110
+ dragHandlePositionAfter: column.computedVisibleIndex,
5111
+ columnSizing: columnSizingForResize,
5112
+ items: columns.map((c) => {
5113
+ return {
5114
+ id: c.id,
5115
+ computedFlex: c.computedFlex,
5116
+ computedWidth: c.computedWidth,
5117
+ computedMinWidth: c.computedMinWidth,
5118
+ computedMaxWidth: c.computedMaxWidth
5119
+ };
5120
+ })
5121
+ });
5122
+ if (activeCellIndex && activeCellIndex[1] >= column.computedVisibleIndex) {
5123
+ const activeColumn = columns[activeCellIndex[1]];
5124
+ const currentColumn = columns[column.computedVisibleIndex];
5125
+ if (activeCellIndex[1] === currentColumn.computedVisibleIndex) {
5126
+ setInfiniteColumnWidth(currentColumn.computedVisibleIndex, currentColumn.computedWidth + result.adjustedDiff, domRef.current);
5127
+ } else if (activeColumn) {
5128
+ setInfiniteColumnOffset(activeColumn.computedVisibleIndex, activeColumn.computedOffset + result.adjustedDiff, domRef.current);
5129
+ }
5130
+ if (shareSpaceOnResize && activeCellIndex[1] === currentColumn.computedVisibleIndex + 1 && activeColumn) {
5131
+ setInfiniteColumnWidth(activeColumn.computedVisibleIndex, activeColumn.computedWidth - result.adjustedDiff, domRef.current);
5132
+ }
5133
+ }
5134
+ return result;
5135
+ }, []);
5136
+ const onColumnResize = useCallback7(({
5137
+ diff,
5138
+ shareSpaceOnResize
5139
+ }) => {
5140
+ const { columnSizing, reservedWidth } = computeResizeForDiff({
5141
+ diff,
5142
+ shareSpaceOnResize
5143
+ });
5144
+ if (!shareSpaceOnResize) {
5145
+ componentActions.viewportReservedWidth = reservedWidth;
5146
+ }
5147
+ componentActions.columnSizing = columnSizing;
5148
+ }, []);
5149
+ const resizeHandle = column.computedResizable ? /* @__PURE__ */ createElement15(ResizeHandle, {
5150
+ columns: computedVisibleColumns,
5151
+ columnIndex: column.computedVisibleIndex,
5152
+ computeResize: computeResizeForDiff,
5153
+ onResize: onColumnResize
5154
+ }) : null;
5155
+ return resizeHandle;
5156
+ }
5157
+
4522
5158
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
4523
5159
  var InfiniteTableHeaderCellContext = createContext4(null);
4524
- var { rootClassName: rootClassName7 } = internalProps;
4525
- var InfiniteTableHeaderCellClassName = `${rootClassName7}HeaderCell`;
5160
+ var { rootClassName: rootClassName8 } = internalProps;
5161
+ var InfiniteTableHeaderCellClassName = `${rootClassName8}HeaderCell`;
4526
5162
  function InfiniteTableHeaderCell(props) {
4527
5163
  var _a, _b, _c, _d, _e;
4528
5164
  const column = props.column;
@@ -4530,13 +5166,13 @@ function InfiniteTableHeaderCell(props) {
4530
5166
  const { onResize, height, width, headerOptions } = props;
4531
5167
  const sortInfo = column.computedSortInfo;
4532
5168
  let header = column.header;
4533
- const ref = useCallback7((node) => {
5169
+ const ref = useCallback8((node) => {
4534
5170
  var _a2;
4535
5171
  domRef.current = node;
4536
5172
  (_a2 = props.domRef) == null ? void 0 : _a2.call(props, node);
4537
5173
  }, [props.domRef]);
4538
5174
  const alwaysShow = headerOptions.alwaysReserveSpaceForSortIcon;
4539
- const sortTool = column.computedSorted || alwaysShow ? /* @__PURE__ */ createElement15(SortIcon, {
5175
+ const sortTool = column.computedSorted || alwaysShow ? /* @__PURE__ */ createElement16(SortIcon, {
4540
5176
  index: column.computedMultiSort ? column.computedSortIndex + 1 : void 0,
4541
5177
  className: `${InfiniteTableHeaderCellClassName}__sort-icon ${HeaderSortIconCls} ${HeaderSortIconRecipe({
4542
5178
  align: column.align || "start"
@@ -4553,15 +5189,15 @@ function InfiniteTableHeaderCell(props) {
4553
5189
  const align = column.align || "start";
4554
5190
  const renderChildren = () => {
4555
5191
  if (header instanceof Function) {
4556
- header = /* @__PURE__ */ createElement15(RenderHookComponent, {
5192
+ header = /* @__PURE__ */ createElement16(RenderHookComponent, {
4557
5193
  render: header,
4558
5194
  renderParam
4559
5195
  });
4560
5196
  }
4561
5197
  header = header != null ? header : column.name;
4562
- return /* @__PURE__ */ createElement15(Fragment2, null, align === "end" ? sortTool : null, header, align !== "end" ? sortTool : null);
5198
+ return /* @__PURE__ */ createElement16(Fragment2, null, align === "end" ? sortTool : null, header, align !== "end" ? sortTool : null);
4563
5199
  };
4564
- const domRef = useRef12(null);
5200
+ const domRef = useRef13(null);
4565
5201
  const {
4566
5202
  computed: {
4567
5203
  computedRemainingSpace,
@@ -4588,7 +5224,7 @@ function InfiniteTableHeaderCell(props) {
4588
5224
  const style = {
4589
5225
  height
4590
5226
  };
4591
- const { onPointerDown, onPointerUp, dragging, draggingDiff, proxyOffset } = useColumnPointerEvents({
5227
+ const { onPointerDown, dragging, draggingDiff, proxyOffset } = useColumnPointerEvents({
4592
5228
  computedRemainingSpace,
4593
5229
  columnId: column.id,
4594
5230
  domRef,
@@ -4596,7 +5232,7 @@ function InfiniteTableHeaderCell(props) {
4596
5232
  });
4597
5233
  let draggingProxy = null;
4598
5234
  if (dragging) {
4599
- draggingProxy = /* @__PURE__ */ createElement15("div", {
5235
+ draggingProxy = /* @__PURE__ */ createElement16("div", {
4600
5236
  className: `${InfiniteTableHeaderCellClassName}Proxy ${HeaderCellProxy}`,
4601
5237
  style: {
4602
5238
  position: "absolute",
@@ -4613,7 +5249,7 @@ function InfiniteTableHeaderCell(props) {
4613
5249
  const contentRecipeVariants = {
4614
5250
  filtered: column.computedFiltered
4615
5251
  };
4616
- const setFilterValue = useCallback7((filterValue) => {
5252
+ const setFilterValue = useCallback8((filterValue) => {
4617
5253
  var _a2;
4618
5254
  const state = getDataSourceState();
4619
5255
  let newFilterValue = (_a2 = state.filterValue) != null ? _a2 : [];
@@ -4674,10 +5310,10 @@ function InfiniteTableHeaderCell(props) {
4674
5310
  ]);
4675
5311
  const filterType = column.computedFilterType;
4676
5312
  const FilterEditor = filterEditors[filterType] || defaultFilterEditors[filterType] || StringFilterEditor;
4677
- const resizeHandle = null;
4678
- return /* @__PURE__ */ createElement15(ContextProvider, {
5313
+ const resizeHandle = useColumnResizeHandle(column);
5314
+ return /* @__PURE__ */ createElement16(ContextProvider, {
4679
5315
  value: renderParam
4680
- }, /* @__PURE__ */ createElement15(InfiniteTableCell, {
5316
+ }, /* @__PURE__ */ createElement16(InfiniteTableCell, {
4681
5317
  domRef: ref,
4682
5318
  cellType: "header",
4683
5319
  column,
@@ -4687,12 +5323,11 @@ function InfiniteTableHeaderCell(props) {
4687
5323
  style,
4688
5324
  width,
4689
5325
  onPointerDown,
4690
- onPointerUp,
4691
5326
  contentClassName: join(HeaderCellContentRecipe(contentRecipeVariants), justifyContent[(_c = column.align) != null ? _c : "start"]),
4692
5327
  contentStyle: showColumnFilters ? { height: height / 2 } : void 0,
4693
5328
  className: join(InfiniteTableHeaderCellClassName, userSelect.none, column.computedSortable ? cursor.pointer : "", useCellClassName(column, [InfiniteTableHeaderCellClassName, InfiniteTableCellClassName], HeaderCellRecipe, { dragging, zebra: false, rowActive: false }), CellCls),
4694
5329
  cssEllipsis: (_e = (_d = column.headerCssEllipsis) != null ? _d : column.cssEllipsis) != null ? _e : true,
4695
- afterChildren: /* @__PURE__ */ createElement15(Fragment2, null, showColumnFilters ? column.computedFilterable ? /* @__PURE__ */ createElement15(InfiniteTableColumnHeaderFilter, {
5330
+ afterChildren: /* @__PURE__ */ createElement16(Fragment2, null, showColumnFilters ? column.computedFilterable ? /* @__PURE__ */ createElement16(InfiniteTableColumnHeaderFilter, {
4696
5331
  filterEditor: FilterEditor,
4697
5332
  filterTypes,
4698
5333
  onChange: debouncedOnFilterValueChange,
@@ -4700,7 +5335,7 @@ function InfiniteTableHeaderCell(props) {
4700
5335
  columnLabel: column.field || column.name || column.id,
4701
5336
  columnFilterValue: column.computedFilterValue,
4702
5337
  columnHeaderHeight
4703
- }) : /* @__PURE__ */ createElement15(InfiniteTableColumnHeaderFilterEmpty, null) : null, resizeHandle),
5338
+ }) : /* @__PURE__ */ createElement16(InfiniteTableColumnHeaderFilterEmpty, null) : null, resizeHandle),
4704
5339
  renderChildren
4705
5340
  }), draggingProxy);
4706
5341
  }
@@ -4711,8 +5346,8 @@ function useInfiniteHeaderCell() {
4711
5346
 
4712
5347
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx
4713
5348
  import {
4714
- createElement as createElement18,
4715
- useCallback as useCallback9,
5349
+ createElement as createElement20,
5350
+ useCallback as useCallback11,
4716
5351
  useMemo as useMemo6
4717
5352
  } from "react";
4718
5353
 
@@ -4800,7 +5435,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap, c
4800
5435
  let groupOffset = 0;
4801
5436
  map2.forEach((item) => {
4802
5437
  if (!item.ref.columnGroup) {
4803
- const itemWidth = item.type === "column" ? item.ref.computedWidth : item.columnItems.reduce((sum, col) => sum + col.ref.computedWidth, 0);
5438
+ const itemWidth = item.type === "column" ? item.ref.computedWidth : item.columnItems.reduce((sum2, col) => sum2 + col.ref.computedWidth, 0);
4804
5439
  item.groupOffset = groupOffset;
4805
5440
  item.computedWidth = itemWidth;
4806
5441
  if (item.type === "group") {
@@ -4825,7 +5460,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap, c
4825
5460
  }
4826
5461
  function assignGroupOffsetsAndComputedWidths(items, groupOffset = 0) {
4827
5462
  items.forEach((item) => {
4828
- const itemWidth = item.type === "column" ? item.ref.computedWidth : item.columnItems.reduce((sum, col) => sum + col.ref.computedWidth, 0);
5463
+ const itemWidth = item.type === "column" ? item.ref.computedWidth : item.columnItems.reduce((sum2, col) => sum2 + col.ref.computedWidth, 0);
4829
5464
  item.computedWidth = itemWidth;
4830
5465
  item.groupOffset = groupOffset;
4831
5466
  if (item.type === "group") {
@@ -4837,40 +5472,192 @@ function assignGroupOffsetsAndComputedWidths(items, groupOffset = 0) {
4837
5472
 
4838
5473
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
4839
5474
  import {
4840
- createElement as createElement17,
5475
+ createElement as createElement19,
4841
5476
  memo as memo8
4842
5477
  } from "react";
4843
- import { useCallback as useCallback8, useEffect as useEffect12, useRef as useRef13 } from "react";
5478
+ import { useCallback as useCallback10, useEffect as useEffect12, useRef as useRef15 } from "react";
4844
5479
 
4845
5480
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderGroup.tsx
4846
5481
  import {
4847
- createElement as createElement16
5482
+ createElement as createElement18
5483
+ } from "react";
5484
+
5485
+ // src/components/InfiniteTable/components/InfiniteTableHeader/useColumnGroupResizeHandle.tsx
5486
+ import {
5487
+ createElement as createElement17
4848
5488
  } from "react";
5489
+ import { useCallback as useCallback9 } from "react";
5490
+
5491
+ // src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/GroupResizeHandle.tsx
5492
+ import React23, { useRef as useRef14, useState as useState10 } from "react";
5493
+ var { rootClassName: rootClassName9 } = internalProps;
5494
+ var InfiniteTableHeaderCellResizeHandleCls2 = `${rootClassName9}HeaderCell_ResizeHandle`;
5495
+ function GroupResizeHandleFn(props) {
5496
+ const domRef = useRef14(null);
5497
+ const [constrained, setConstrained] = useState10(false);
5498
+ const constrainedRef = useRef14(constrained);
5499
+ constrainedRef.current = constrained;
5500
+ const onPointerDown = (e) => {
5501
+ e.stopPropagation();
5502
+ const pointerId = e.pointerId;
5503
+ const initialX = e.clientX;
5504
+ const target = e.target;
5505
+ target.setPointerCapture(pointerId);
5506
+ let initialMove = true;
5507
+ const resizer = getColumnGroupResizer(props.groupColumns.map((c) => c.computedVisibleIndex), {
5508
+ columns: props.columns,
5509
+ domRef
5510
+ });
5511
+ const resizeDiff = (diff) => {
5512
+ const { constrained: constrained2, adjustedDiffs, adjustedDiff } = props.computeResize(diff);
5513
+ if (constrainedRef.current !== constrained2) {
5514
+ setConstrained(constrained2);
5515
+ }
5516
+ resizer.resize(adjustedDiffs);
5517
+ return adjustedDiff;
5518
+ };
5519
+ const onPointerMove = (e2) => {
5520
+ if (initialMove) {
5521
+ const maxDiff = props.groupColumns.reduce((diff, col) => {
5522
+ return diff + col.computedWidth - col.computedMinWidth;
5523
+ }, 0);
5524
+ const currentSize = props.brain.getAvailableSize();
5525
+ const newSize = {
5526
+ width: currentSize.width + maxDiff,
5527
+ height: currentSize.height
5528
+ };
5529
+ props.brain.setAvailableSize(newSize);
5530
+ initialMove = false;
5531
+ }
5532
+ resizeDiff(Math.round(e2.clientX - initialX));
5533
+ };
5534
+ const onPointerUp = (e2) => {
5535
+ target.releasePointerCapture(pointerId);
5536
+ target.removeEventListener("pointermove", onPointerMove);
5537
+ target.removeEventListener("pointerup", onPointerUp);
5538
+ const diff = Math.round(e2.clientX - initialX);
5539
+ const adjustedDiffs = resizeDiff(diff);
5540
+ props.onResize(adjustedDiffs);
5541
+ };
5542
+ target.addEventListener("pointermove", onPointerMove);
5543
+ target.addEventListener("pointerup", onPointerUp);
5544
+ };
5545
+ return /* @__PURE__ */ React23.createElement("div", {
5546
+ ref: domRef,
5547
+ className: `${InfiniteTableHeaderCellResizeHandleCls2} ${ResizeHandleCls}`,
5548
+ onPointerDown
5549
+ }, /* @__PURE__ */ React23.createElement("div", {
5550
+ style: props.style,
5551
+ className: ResizeHandleDraggerClsRecipe({
5552
+ constrained
5553
+ })
5554
+ }));
5555
+ }
5556
+ var GroupResizeHandle = React23.memo(GroupResizeHandleFn);
5557
+
5558
+ // src/components/InfiniteTable/components/InfiniteTableHeader/useColumnGroupResizeHandle.tsx
5559
+ function useColumnGroupResizeHandle(groupColumns, config) {
5560
+ const { bodyBrain, groupHeight, columnGroup, columnGroupsMaxDepth } = config;
5561
+ const {
5562
+ computed: { computedVisibleColumns },
5563
+ getState,
5564
+ getComputed,
5565
+ componentActions
5566
+ } = useInfiniteTable();
5567
+ const lastColumnInGroup = groupColumns[groupColumns.length - 1];
5568
+ const computeResizeForDiff = useCallback9((diff) => {
5569
+ const state = getState();
5570
+ const { columnSizing, viewportReservedWidth, bodySize } = state;
5571
+ const columns = getComputed().computedVisibleColumns;
5572
+ let atLeastOneFlex = false;
5573
+ const columnSizingWithFlex = columns.reduce((acc, col) => {
5574
+ if (col.computedFlex) {
5575
+ acc[col.id] = __spreadProps(__spreadValues({}, columnSizing[col.id]), { flex: col.computedWidth });
5576
+ atLeastOneFlex = true;
5577
+ }
5578
+ return acc;
5579
+ }, {});
5580
+ const columnSizingForResize = atLeastOneFlex ? __spreadValues(__spreadValues({}, columnSizing), columnSizingWithFlex) : columnSizing;
5581
+ const result = computeGroupResize({
5582
+ availableSize: bodySize.width,
5583
+ reservedWidth: viewportReservedWidth || 0,
5584
+ dragHandleOffset: diff,
5585
+ dragHandlePositionAfter: lastColumnInGroup.computedVisibleIndex,
5586
+ columnSizing: columnSizingForResize,
5587
+ columnGroupSize: groupColumns.length,
5588
+ items: columns.map((c) => {
5589
+ return {
5590
+ id: c.id,
5591
+ resizable: c.computedResizable,
5592
+ computedFlex: c.computedFlex,
5593
+ computedWidth: c.computedWidth,
5594
+ computedMinWidth: c.computedMinWidth,
5595
+ computedMaxWidth: c.computedMaxWidth
5596
+ };
5597
+ })
5598
+ });
5599
+ return result;
5600
+ }, []);
5601
+ const onColumnResize = useCallback9((diff) => {
5602
+ const { columnSizing, reservedWidth } = computeResizeForDiff(diff);
5603
+ componentActions.viewportReservedWidth = reservedWidth;
5604
+ componentActions.columnSizing = columnSizing;
5605
+ }, []);
5606
+ const groupResizable = groupColumns.some((c) => c.computedResizable);
5607
+ const resizeHandle = groupResizable ? /* @__PURE__ */ createElement17(GroupResizeHandle, {
5608
+ brain: bodyBrain,
5609
+ style: {
5610
+ height: groupHeight * (columnGroupsMaxDepth - columnGroup.depth + 2)
5611
+ },
5612
+ columns: computedVisibleColumns,
5613
+ groupColumns,
5614
+ computeResize: computeResizeForDiff,
5615
+ onResize: onColumnResize
5616
+ }) : null;
5617
+ return resizeHandle;
5618
+ }
5619
+
5620
+ // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderGroup.tsx
4849
5621
  var TableHeaderGroupClassName = `${rootClassName2}HeaderGroup`;
5622
+ var columnWidthAtIndex3 = stripVar(InternalVars.columnWidthAtIndex);
4850
5623
  function InfiniteTableHeaderGroup(props) {
4851
- const { columnGroup, height, width } = props;
5624
+ const {
5625
+ computed: { computedVisibleColumns }
5626
+ } = useInfiniteTable();
5627
+ const { columnGroup, height, columns, bodyBrain, columnGroupsMaxDepth } = props;
4852
5628
  let { header } = columnGroup;
4853
5629
  if (header instanceof Function) {
4854
5630
  header = header({
4855
5631
  columnGroup
4856
5632
  });
4857
5633
  }
4858
- return /* @__PURE__ */ createElement16("div", {
5634
+ const handle = useColumnGroupResizeHandle(columns, {
5635
+ bodyBrain,
5636
+ groupHeight: height,
5637
+ columnGroup,
5638
+ columnGroupsMaxDepth
5639
+ });
5640
+ const firstColumn = columns[0];
5641
+ const width = columns.length > 1 ? `calc( ` + columns.map((col) => `var(${columnWidthAtIndex3}-${col.computedVisibleIndex})`).join(" + ") + " )" : `var(${columnWidthAtIndex3}-${firstColumn.computedVisibleIndex})`;
5642
+ const zIndex2 = computedVisibleColumns.length * 10 - firstColumn.computedVisibleIndex * 10 + height * (columnGroupsMaxDepth - columnGroup.depth + 2);
5643
+ return /* @__PURE__ */ createElement18("div", {
4859
5644
  ref: props.domRef,
4860
5645
  "data-group-id": columnGroup.uniqueGroupId,
4861
5646
  className: join(HeaderGroupCls, TableHeaderGroupClassName),
4862
- style: { width, height }
4863
- }, /* @__PURE__ */ createElement16("div", {
5647
+ style: { width, height },
5648
+ "data-z-index": zIndex2
5649
+ }, /* @__PURE__ */ createElement18("div", {
4864
5650
  className: join(`${TableHeaderGroupClassName}__header-content`, cssEllipsisClassName)
4865
- }, header));
5651
+ }, header), handle);
4866
5652
  }
4867
5653
 
4868
5654
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
4869
- var { rootClassName: rootClassName8 } = internalProps;
4870
- var TableHeaderClassName = `${rootClassName8}Header`;
5655
+ var { rootClassName: rootClassName10 } = internalProps;
5656
+ var TableHeaderClassName = `${rootClassName10}Header`;
4871
5657
  function InfiniteTableHeaderFn(props) {
4872
5658
  const {
4873
- brain,
5659
+ bodyBrain,
5660
+ headerBrain: brain,
4874
5661
  columns,
4875
5662
  style,
4876
5663
  className,
@@ -4892,7 +5679,7 @@ function InfiniteTableHeaderFn(props) {
4892
5679
  const removeOnScroll = brain.onScroll(onScroll);
4893
5680
  return removeOnScroll;
4894
5681
  }, [brain]);
4895
- const domRef = useRef13(null);
5682
+ const domRef = useRef15(null);
4896
5683
  const headerCls = HeaderClsRecipe({
4897
5684
  overflow: false,
4898
5685
  virtualized: true
@@ -4902,7 +5689,7 @@ function InfiniteTableHeaderFn(props) {
4902
5689
  className: join(TableHeaderClassName, `${TableHeaderClassName}--virtualized`, className, headerCls),
4903
5690
  style: __spreadProps(__spreadValues({}, style), { height: columnHeaderHeight })
4904
5691
  };
4905
- const renderCell = useCallback8((params) => {
5692
+ const renderCell = useCallback10((params) => {
4906
5693
  const {
4907
5694
  rowIndex,
4908
5695
  colIndex,
@@ -4927,7 +5714,9 @@ function InfiniteTableHeaderFn(props) {
4927
5714
  computedWidth: colGroupItem.computedWidth,
4928
5715
  groupOffset: colGroupItem.groupOffset
4929
5716
  });
4930
- return /* @__PURE__ */ createElement17(InfiniteTableHeaderGroup, {
5717
+ return /* @__PURE__ */ createElement19(InfiniteTableHeaderGroup, {
5718
+ bodyBrain,
5719
+ columnGroupsMaxDepth,
4931
5720
  domRef: domRef2,
4932
5721
  columns: columns2,
4933
5722
  width: widthWithColspan,
@@ -4935,7 +5724,7 @@ function InfiniteTableHeaderFn(props) {
4935
5724
  columnGroup: computedColumnGroup
4936
5725
  });
4937
5726
  }
4938
- return /* @__PURE__ */ createElement17(InfiniteTableHeaderCell, {
5727
+ return /* @__PURE__ */ createElement19(InfiniteTableHeaderCell, {
4939
5728
  domRef: domRef2,
4940
5729
  column,
4941
5730
  headerOptions,
@@ -4951,7 +5740,8 @@ function InfiniteTableHeaderFn(props) {
4951
5740
  columnGroupsMaxDepth,
4952
5741
  showColumnFilters
4953
5742
  ]);
4954
- return /* @__PURE__ */ createElement17("div", __spreadValues({}, domProps), /* @__PURE__ */ createElement17(RawTable, {
5743
+ return /* @__PURE__ */ createElement19("div", __spreadValues({}, domProps), /* @__PURE__ */ createElement19(RawTable, {
5744
+ name: "header",
4955
5745
  renderCell,
4956
5746
  brain: headerBrain,
4957
5747
  cellHoverClassNames: []
@@ -4961,7 +5751,7 @@ var InfiniteTableHeader = memo8(InfiniteTableHeaderFn);
4961
5751
 
4962
5752
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx
4963
5753
  function TableHeaderWrapper(props) {
4964
- const { brain, scrollbars } = props;
5754
+ const { headerBrain, bodyBrain, scrollbars } = props;
4965
5755
  const tableContextValue = useInfiniteTable();
4966
5756
  const {
4967
5757
  computedPinnedStartColumns,
@@ -4986,7 +5776,7 @@ function TableHeaderWrapper(props) {
4986
5776
  }
4987
5777
  return buildColumnAndGroupTree(computedVisibleColumns, computedColumnGroups, columnGroupsDepthsMap, columnGroupsMaxDepth);
4988
5778
  }, [computedVisibleColumns, computedColumnGroups, columnGroupsDepthsMap]);
4989
- const cellspan = useCallback9(({ rowIndex, colIndex }) => {
5779
+ const cellspan = useCallback11(({ rowIndex, colIndex }) => {
4990
5780
  const column = computedVisibleColumns[colIndex];
4991
5781
  const rowspan2 = 1;
4992
5782
  const colspan2 = 1;
@@ -5019,12 +5809,12 @@ function TableHeaderWrapper(props) {
5019
5809
  rows,
5020
5810
  columnGroupsDepthsMap
5021
5811
  ]);
5022
- const rowspan = useCallback9(({ rowIndex, colIndex }) => cellspan({ rowIndex, colIndex }).rowspan, [cellspan]);
5023
- const colspan = useCallback9(({ rowIndex, colIndex }) => cellspan({ rowIndex, colIndex }).colspan, [cellspan]);
5024
- const rowHeight = useCallback9((index) => {
5812
+ const rowspan = useCallback11(({ rowIndex, colIndex }) => cellspan({ rowIndex, colIndex }).rowspan, [cellspan]);
5813
+ const colspan = useCallback11(({ rowIndex, colIndex }) => cellspan({ rowIndex, colIndex }).colspan, [cellspan]);
5814
+ const rowHeight = useCallback11((index) => {
5025
5815
  return showColumnFilters ? index < rows - 1 ? columnHeaderHeight : 2 * columnHeaderHeight : columnHeaderHeight;
5026
5816
  }, [rows, showColumnFilters, columnHeaderHeight]);
5027
- useMatrixBrain(brain, {
5817
+ useMatrixBrain(headerBrain, {
5028
5818
  colWidth: columnSize,
5029
5819
  rowHeight,
5030
5820
  rows,
@@ -5036,21 +5826,22 @@ function TableHeaderWrapper(props) {
5036
5826
  fixedColsEnd: computedPinnedEndColumns.length,
5037
5827
  fixedColsStart: computedPinnedStartColumns.length
5038
5828
  });
5039
- const header = /* @__PURE__ */ createElement18(InfiniteTableHeader, {
5829
+ const header = /* @__PURE__ */ createElement20(InfiniteTableHeader, {
5040
5830
  columns: computedVisibleColumns,
5041
- brain,
5831
+ headerBrain,
5832
+ bodyBrain,
5042
5833
  columnHeaderHeight: height,
5043
5834
  columnGroupsMaxDepth,
5044
5835
  columnAndGroupTreeInfo
5045
5836
  });
5046
- const verticalScrollbarPlaceholder = scrollbars.vertical && getScrollbarWidth() ? /* @__PURE__ */ createElement18("div", {
5837
+ const verticalScrollbarPlaceholder = scrollbars.vertical && getScrollbarWidth() ? /* @__PURE__ */ createElement20("div", {
5047
5838
  className: HeaderScrollbarPlaceholderCls,
5048
5839
  style: {
5049
5840
  zIndex: 1e3,
5050
5841
  width: getScrollbarWidth()
5051
5842
  }
5052
5843
  }) : null;
5053
- return /* @__PURE__ */ createElement18("div", {
5844
+ return /* @__PURE__ */ createElement20("div", {
5054
5845
  className: HeaderWrapperCls,
5055
5846
  style: {
5056
5847
  height
@@ -5060,10 +5851,10 @@ function TableHeaderWrapper(props) {
5060
5851
 
5061
5852
  // src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
5062
5853
  import {
5063
- createElement as createElement19,
5854
+ createElement as createElement21,
5064
5855
  forwardRef as forwardRef4,
5065
- useCallback as useCallback10,
5066
- useRef as useRef14
5856
+ useCallback as useCallback12,
5857
+ useRef as useRef16
5067
5858
  } from "react";
5068
5859
  import { useEffect as useEffect13 } from "react";
5069
5860
 
@@ -5073,17 +5864,13 @@ function decamelize(str, options) {
5073
5864
  return str.replace(/([a-z\d])([A-Z])/g, "$1" + separator + "$2").replace(new RegExp("(" + separator + "[A-Z])([A-Z])", "g"), "$1" + separator + "$2").toLowerCase();
5074
5865
  }
5075
5866
 
5076
- // src/components/InfiniteTable/theme.css.ts
5077
- var ThemeVars = { color: { accent: "var(--infinite-accent-color)", color: "var(--infinite-color)" }, spacing: { "0": "var(--infinite-space-0)", "1": "var(--infinite-space-1)", "2": "var(--infinite-space-2)", "3": "var(--infinite-space-3)", "4": "var(--infinite-space-4)", "5": "var(--infinite-space-5)", "6": "var(--infinite-space-6)", "7": "var(--infinite-space-7)", "8": "var(--infinite-space-8)", "9": "var(--infinite-space-9)", "10": "var(--infinite-space-10)" }, fontSize: { "0": "var(--infinite-font-size-0)", "1": "var(--infinite-font-size-1)", "2": "var(--infinite-font-size-2)", "3": "var(--infinite-font-size-3)", "4": "var(--infinite-font-size-4)", "5": "var(--infinite-font-size-5)", "6": "var(--infinite-font-size-6)", "7": "var(--infinite-font-size-7)" }, fontFamily: "var(--infinite-font-family)", minHeight: "var(--infinite-min-height)", borderRadius: "var(--infinite-border-radius)", background: "var(--infinite-background)", components: { LoadMask: { padding: "var(--infinite-load-mask-padding)", color: "var(--infinite-load-mask-color)", textBackground: "var(--infinite-load-mask-text-background)", overlayBackground: "var(--infinite-load-mask-overlay-background)", overlayOpacity: "var(--infinite-load-mask-overlay-opacity)", borderRadius: "var(--infinite-load-mask-border-radius)" }, Header: { background: "var(--infinite-header-background)", color: "var(--infinite-header-color)", columnHeaderHeight: "var(--infinite-column-header-height)" }, HeaderCell: { draggingBackground: "var(--infinite-header-cell-dragging-background)", background: "var(--infinite-header-cell-background)", padding: "var(--infinite-header-cell-padding)", paddingX: "var(--infinite-header-cell-padding-x)", paddingY: "var(--infinite-header-cell-padding-y)", iconSize: "var(--infinite-header-cell-icon-size)", sortIconMargin: "var(--infinite-header-cell-sort-icon-margin)" }, Cell: { padding: "var(--infinite-cell-padding)", borderWidth: "var(--infinite-cell-border-width)", border: "var(--infinite-cell-border)", borderInvisible: "var(--infinite-cell-border-invisible)", borderRadius: "var(--infinite-cell-border-radius)", color: "var(--infinite-cell-color)", activeBorderColor_R: "var(--infinite-active-cell-border-color--r)", activeBorderColor_G: "var(--infinite-active-cell-border-color--g)", activeBorderColor_B: "var(--infinite-active-cell-border-color--b)", activeBackgroundAlpha: "var(--infinite-active-cell-background-alpha)", activeBackgroundAlphaWhenTableUnfocused: "var(--infinite-active-cell-background-alpha--table-unfocused)", activeBackground: "var(--infinite-active-cell-background)", activeBorderColor: "var(--infinite-active-cell-border-color)", activeBorderWidth: "var(--infinite-active-cell-border-width)", activeBorderStyle: "var(--infinite-active-cell-border-style)", activeBorder: "var(--infinite-active-cell-border)" }, Row: { background: "var(--infinite-row-background)", oddBackground: "var(--infinite-row-odd-background)", activeBackground: "var(--infinite-active-row-background)", activeBorderColor: "var(--infinite-active-row-border-color)", activeBorderWidth: "var(--infinite-active-row-border-width)", activeBorderStyle: "var(--infinite-active-row-border-style)", activeBorder: "var(--infinite-active-row-border)", activeBackgroundAlpha: "var(--infinite-active-row-background-alpha)", activeBackgroundAlphaWhenTableUnfocused: "var(--infinite-active-row-background-alpha--table-unfocused)", hoverBackground: "var(--infinite-row-hover-background)", groupRowBackground: "var(--infinite-group-row-background)", groupRowColumnNesting: "var(--infinite-group-row-column-nesting)", groupNesting: "var(--infinite-dont-override-group-row-nesting-length)", pointerEventsWhileScrolling: "var(--infinite-row-pointer-events-while-scrolling)" }, ColumnCell: { background: "var(--infinite-column-cell-bg-dont-override)" } } };
5078
- var columnHeaderHeightName = "column-header-height";
5079
-
5080
5867
  // src/components/InfiniteTable/InfiniteCls.css.ts
5081
- var import_createRuntimeFn3 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
5868
+ var import_createRuntimeFn4 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
5082
5869
  var FooterCls = "_16lm1iw1";
5083
- var InfiniteCls = "_1yeub2v0 _16lm1iw1 _16lm1iwm _16lm1iw12 _16lm1iw0";
5084
- var InfiniteClsRecipe = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "", variantClassNames: { focused: { true: "_1yeub2v2", false: "_1yeub2v3" }, focusedWithin: { true: "_1yeub2v4", false: "_1yeub2v5" }, hasPinnedStart: { true: "_1yeub2v6", false: "_1yeub2v7" }, hasPinnedEnd: { true: "_1yeub2v8", false: "_1yeub2v9" }, hasPinnedStartOverflow: { true: "_1yeub2va", false: "_1yeub2vb" }, hasPinnedEndOverflow: { true: "_1yeub2vc", false: "_1yeub2vd" } }, defaultVariants: {}, compoundVariants: [[{ focused: false, focusedWithin: false }, "_1yeub2ve"]] });
5085
- var InfiniteClsShiftingColumns = "_16lm1iwp";
5086
- var PinnedRowsContainerClsVariants = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "", variantClassNames: { pinned: { start: "_1yeub2vi", end: "_1yeub2vj", false: "_1yeub2vk" } }, defaultVariants: {}, compoundVariants: [] });
5870
+ var InfiniteCls = "_1yeub2v0 _16lm1iw1 _16lm1iwn _16lm1iw13 _16lm1iw0";
5871
+ var InfiniteClsRecipe = (0, import_createRuntimeFn4.createRuntimeFn)({ defaultClassName: "", variantClassNames: { focused: { true: "_1yeub2v2", false: "_1yeub2v3" }, focusedWithin: { true: "_1yeub2v4", false: "_1yeub2v5" }, hasPinnedStart: { true: "_1yeub2v6", false: "_1yeub2v7" }, hasPinnedEnd: { true: "_1yeub2v8", false: "_1yeub2v9" }, hasPinnedStartOverflow: { true: "_1yeub2va", false: "_1yeub2vb" }, hasPinnedEndOverflow: { true: "_1yeub2vc", false: "_1yeub2vd" } }, defaultVariants: {}, compoundVariants: [[{ focused: false, focusedWithin: false }, "_1yeub2ve"]] });
5872
+ var InfiniteClsShiftingColumns = "_16lm1iwq";
5873
+ var PinnedRowsContainerClsVariants = (0, import_createRuntimeFn4.createRuntimeFn)({ defaultClassName: "", variantClassNames: { pinned: { start: "_1yeub2vi", end: "_1yeub2vj", false: "_1yeub2vk" } }, defaultVariants: {}, compoundVariants: [] });
5087
5874
 
5088
5875
  // src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
5089
5876
  var defaultStyle = {
@@ -5113,9 +5900,9 @@ var enforceStyle = (node, style) => {
5113
5900
  }
5114
5901
  };
5115
5902
  var InfiniteTableLicenseFooter = forwardRef4(function InfiniteTableLicenseFooter2(props, ref) {
5116
- const { rootClassName: rootClassName11 } = useInternalProps();
5117
- const domRef = useRef14(null);
5118
- const domCallback = useCallback10((node) => {
5903
+ const { rootClassName: rootClassName13 } = useInternalProps();
5904
+ const domRef = useRef16(null);
5905
+ const domCallback = useCallback12((node) => {
5119
5906
  domRef.current = node;
5120
5907
  if (!ref) {
5121
5908
  return;
@@ -5140,12 +5927,12 @@ var InfiniteTableLicenseFooter = forwardRef4(function InfiniteTableLicenseFooter
5140
5927
  clearInterval(intervalId);
5141
5928
  };
5142
5929
  }, []);
5143
- return /* @__PURE__ */ createElement19("div", __spreadProps(__spreadValues({
5930
+ return /* @__PURE__ */ createElement21("div", __spreadProps(__spreadValues({
5144
5931
  ref: domCallback
5145
5932
  }, props), {
5146
- className: join(`${rootClassName11}-Footer`, FooterCls, props.className),
5933
+ className: join(`${rootClassName13}-Footer`, FooterCls, props.className),
5147
5934
  style: defaultStyle
5148
- }), "Powered by", " ", /* @__PURE__ */ createElement19("a", {
5935
+ }), "Powered by", " ", /* @__PURE__ */ createElement21("a", {
5149
5936
  href: "https://infinite-table.com",
5150
5937
  rel: "noopener noreferrer",
5151
5938
  role: "link",
@@ -5156,13 +5943,13 @@ var InfiniteTableLicenseFooter = forwardRef4(function InfiniteTableLicenseFooter
5156
5943
  // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableColumnCell.tsx
5157
5944
  import {
5158
5945
  createContext as createContext5,
5159
- createElement as createElement20,
5946
+ createElement as createElement22,
5160
5947
  memo as memo9
5161
5948
  } from "react";
5162
- import { useCallback as useCallback11, useContext as useContext6, useMemo as useMemo7 } from "react";
5163
- var { rootClassName: rootClassName9 } = internalProps;
5949
+ import { useCallback as useCallback13, useContext as useContext6, useMemo as useMemo7 } from "react";
5950
+ var { rootClassName: rootClassName11 } = internalProps;
5164
5951
  var InfiniteTableColumnCellContext = createContext5(null);
5165
- var InfiniteTableColumnCellClassName = `${rootClassName9}ColumnCell`;
5952
+ var InfiniteTableColumnCellClassName = `${rootClassName11}ColumnCell`;
5166
5953
  function isColumnWithField(c) {
5167
5954
  return typeof c.field === "string";
5168
5955
  }
@@ -5176,9 +5963,7 @@ function InfiniteTableColumnCellFn(props) {
5176
5963
  column,
5177
5964
  onMouseLeave,
5178
5965
  onMouseEnter,
5179
- offsetProperty,
5180
5966
  toggleGroupRow,
5181
- virtualized,
5182
5967
  rowIndex,
5183
5968
  rowHeight,
5184
5969
  domRef,
@@ -5186,7 +5971,7 @@ function InfiniteTableColumnCellFn(props) {
5186
5971
  showZebraRows
5187
5972
  } = props;
5188
5973
  if (!column) {
5189
- return /* @__PURE__ */ createElement20("div", {
5974
+ return /* @__PURE__ */ createElement22("div", {
5190
5975
  ref: domRef
5191
5976
  }, "no column");
5192
5977
  }
@@ -5219,7 +6004,7 @@ function InfiniteTableColumnCellFn(props) {
5219
6004
  value
5220
6005
  });
5221
6006
  }
5222
- const onClick = useCallback11(() => {
6007
+ const onClick = useCallback13(() => {
5223
6008
  if (keyboardNavigation === "row") {
5224
6009
  componentActions.activeRowIndex = rowIndex;
5225
6010
  return;
@@ -5259,7 +6044,7 @@ function InfiniteTableColumnCellFn(props) {
5259
6044
  isGroupRow,
5260
6045
  rowIndex,
5261
6046
  toggleGroupRow,
5262
- toggleCurrentGroupRow: useCallback11(() => {
6047
+ toggleCurrentGroupRow: useCallback13(() => {
5263
6048
  if (!rowInfo.isGroupRow) {
5264
6049
  return;
5265
6050
  }
@@ -5268,13 +6053,13 @@ function InfiniteTableColumnCellFn(props) {
5268
6053
  groupBy: computedDataSource.groupBy,
5269
6054
  pivotBy: computedDataSource.pivotBy
5270
6055
  });
5271
- const renderChildren = useCallback11(() => {
6056
+ const renderChildren = useCallback13(() => {
5272
6057
  if (hidden) {
5273
6058
  return null;
5274
6059
  }
5275
6060
  const renderFn = column.render || column.renderValue;
5276
6061
  if (renderFn) {
5277
- return /* @__PURE__ */ createElement20(RenderHookComponent, {
6062
+ return /* @__PURE__ */ createElement22(RenderHookComponent, {
5278
6063
  render: renderFn,
5279
6064
  renderParam
5280
6065
  });
@@ -5291,18 +6076,15 @@ function InfiniteTableColumnCellFn(props) {
5291
6076
  style = typeof rowStyle === "function" ? __spreadValues(__spreadValues({}, style), rowStyle(rowPropsAndStyleArgs)) : __spreadValues(__spreadValues({}, style), rowStyle);
5292
6077
  }
5293
6078
  style = column.style ? typeof column.style === "function" ? __spreadValues(__spreadValues({}, style), column.style(stylingRenderParam) || {}) : __spreadValues(__spreadValues({}, style), column.style) : style || {};
5294
- style.width = width;
5295
6079
  style.height = rowHeight;
5296
6080
  const memoizedStyle = useMemo7(() => style, [!style ? null : JSON.stringify(style)]);
5297
6081
  const odd = (rowInfo.indexInAll != null ? rowInfo.indexInAll : rowIndex) % 2 === 1;
5298
6082
  const zebra = showZebraRows ? odd ? "odd" : "even" : false;
5299
6083
  const cellProps = {
5300
6084
  domRef,
5301
- offsetProperty,
5302
6085
  cellType: "body",
5303
6086
  column,
5304
6087
  width,
5305
- offset: virtualized ? 0 : column.computedPinningOffset,
5306
6088
  style: memoizedStyle,
5307
6089
  onMouseLeave,
5308
6090
  onMouseEnter,
@@ -5312,9 +6094,9 @@ function InfiniteTableColumnCellFn(props) {
5312
6094
  renderChildren
5313
6095
  };
5314
6096
  const ContextProvider = InfiniteTableColumnCellContext.Provider;
5315
- return /* @__PURE__ */ createElement20(ContextProvider, {
6097
+ return /* @__PURE__ */ createElement22(ContextProvider, {
5316
6098
  value: renderParam
5317
- }, /* @__PURE__ */ createElement20(InfiniteTableCell, __spreadValues({}, cellProps)));
6099
+ }, /* @__PURE__ */ createElement22(InfiniteTableCell, __spreadValues({}, cellProps)));
5318
6100
  }
5319
6101
  var InfiniteTableColumnCell = memo9(InfiniteTableColumnCellFn);
5320
6102
  function useInfiniteColumnCell() {
@@ -5323,32 +6105,32 @@ function useInfiniteColumnCell() {
5323
6105
  }
5324
6106
 
5325
6107
  // src/components/InfiniteTable/components/InfiniteTableRow/row.css.ts
5326
- var import_createRuntimeFn4 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
6108
+ var import_createRuntimeFn5 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
5327
6109
  var GroupRowExpanderCls = "_7pupv0b";
5328
- var RowClsRecipe = (0, import_createRuntimeFn4.createRuntimeFn)({ defaultClassName: "_7pupv00", variantClassNames: { zebra: { false: "_7pupv02", even: "_7pupv03", odd: "_7pupv04" }, groupRow: { true: "_7pupv05", false: "_7pupv06" }, inlineGroupRow: { true: "_7pupv07", false: "_7pupv08" }, showHoverRows: { true: "_7pupv09", false: "_7pupv0a" } }, defaultVariants: {}, compoundVariants: [] });
6110
+ var RowClsRecipe = (0, import_createRuntimeFn5.createRuntimeFn)({ defaultClassName: "_7pupv00", variantClassNames: { zebra: { false: "_7pupv02", even: "_7pupv03", odd: "_7pupv04" }, groupRow: { true: "_7pupv05", false: "_7pupv06" }, inlineGroupRow: { true: "_7pupv07", false: "_7pupv08" }, showHoverRows: { true: "_7pupv09", false: "_7pupv0a" } }, defaultVariants: {}, compoundVariants: [] });
5329
6111
  var RowHoverCls = "_7pupv01";
5330
6112
 
5331
6113
  // src/components/InfiniteTable/components/LoadMask.tsx
5332
6114
  import {
5333
- createElement as createElement21,
6115
+ createElement as createElement23,
5334
6116
  memo as memo10
5335
6117
  } from "react";
5336
6118
 
5337
6119
  // src/components/InfiniteTable/components/LoadMask.css.ts
5338
- var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2 _16lm1iwu _16lm1iww _16lm1iw10 _16lm1iwy", hidden: "qy58ya2 qy58ya0 _16lm1iw2 _16lm1iwu _16lm1iww _16lm1iw10 _16lm1iwy" };
5339
- var LoadMaskOverlayCls = "qy58ya3 _16lm1iw2 _16lm1iwu _16lm1iww _16lm1iw10 _16lm1iwy";
6120
+ var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2 _16lm1iwv _16lm1iwx _16lm1iw11 _16lm1iwz", hidden: "qy58ya2 qy58ya0 _16lm1iw2 _16lm1iwv _16lm1iwx _16lm1iw11 _16lm1iwz" };
6121
+ var LoadMaskOverlayCls = "qy58ya3 _16lm1iw2 _16lm1iwv _16lm1iwx _16lm1iw11 _16lm1iwz";
5340
6122
  var LoadMaskTextCls = "qy58ya4";
5341
6123
 
5342
6124
  // src/components/InfiniteTable/components/LoadMask.tsx
5343
- var { rootClassName: rootClassName10 } = internalProps;
5344
- var baseCls3 = `${rootClassName10}-LoadMask`;
6125
+ var { rootClassName: rootClassName12 } = internalProps;
6126
+ var baseCls3 = `${rootClassName12}-LoadMask`;
5345
6127
  function LoadMaskFn(props) {
5346
6128
  const { visible, children = "Loading" } = props;
5347
- return /* @__PURE__ */ createElement21("div", {
6129
+ return /* @__PURE__ */ createElement23("div", {
5348
6130
  className: `${LoadMaskCls[visible ? "visible" : "hidden"]} ${baseCls3}`
5349
- }, /* @__PURE__ */ createElement21("div", {
6131
+ }, /* @__PURE__ */ createElement23("div", {
5350
6132
  className: `${LoadMaskOverlayCls} ${baseCls3}-Overlay`
5351
- }), /* @__PURE__ */ createElement21("div", {
6133
+ }), /* @__PURE__ */ createElement23("div", {
5352
6134
  className: `${LoadMaskTextCls} ${baseCls3}-Text`
5353
6135
  }, children));
5354
6136
  }
@@ -5419,8 +6201,8 @@ function getImperativeApi(getState, getComputed, getDataSourceState, componentAc
5419
6201
  // src/components/InfiniteTable/hooks/useAutoSizeColumns.ts
5420
6202
  import {
5421
6203
  useEffect as useEffect14,
5422
- useRef as useRef15,
5423
- useState as useState10
6204
+ useRef as useRef17,
6205
+ useState as useState11
5424
6206
  } from "react";
5425
6207
  var OFFSET = 10;
5426
6208
  function getColumnContentMaxWidths(domRef, options) {
@@ -5457,9 +6239,15 @@ function getColumnContentMaxWidths(domRef, options) {
5457
6239
  cell.childNodes.forEach((child) => {
5458
6240
  if (child !== content) {
5459
6241
  const el = child;
5460
- otherElementsLength += Math.max(el.offsetWidth, parseInt(el.style.width, 10));
5461
- const style = getGlobal().getComputedStyle(el);
5462
- otherElementsLength += parseInt(style.marginLeft, 10) + parseInt(style.marginRight, 10);
6242
+ let elWidth = Math.max(el.offsetWidth, parseInt(el.style.width, 10));
6243
+ if (isNaN(elWidth)) {
6244
+ elWidth = 0;
6245
+ }
6246
+ otherElementsLength += elWidth;
6247
+ if (elWidth > 0) {
6248
+ const style = getGlobal().getComputedStyle(el);
6249
+ otherElementsLength += parseInt(style.marginLeft, 10) + parseInt(style.marginRight, 10);
6250
+ }
5463
6251
  }
5464
6252
  });
5465
6253
  measuredWidth += otherElementsLength;
@@ -5481,10 +6269,10 @@ function useAutoSizeColumns() {
5481
6269
  componentActions,
5482
6270
  componentState: { domRef, ready, autoSizeColumnsKey, brain }
5483
6271
  } = useComponentState();
5484
- const [refreshId, setRefreshId] = useState10(0);
6272
+ const [refreshId, setRefreshId] = useState11(0);
5485
6273
  const theKey = typeof autoSizeColumnsKey === "object" ? autoSizeColumnsKey.key : autoSizeColumnsKey;
5486
6274
  const getTheKey = useLatest(theKey);
5487
- const lastExecutedIdentifierRef = useRef15(null);
6275
+ const lastExecutedIdentifierRef = useRef17(null);
5488
6276
  useEffect14(() => {
5489
6277
  const key = getTheKey();
5490
6278
  if (key == null) {
@@ -5543,8 +6331,8 @@ function useAutoSizeColumns() {
5543
6331
  }
5544
6332
 
5545
6333
  // src/components/InfiniteTable/hooks/useCellRendering.tsx
5546
- import { useCallback as useCallback12, useEffect as useEffect15, useRef as useRef16 } from "react";
5547
- import React27 from "react";
6334
+ import { useCallback as useCallback14, useEffect as useEffect15, useRef as useRef18 } from "react";
6335
+ import React31 from "react";
5548
6336
 
5549
6337
  // src/components/InfiniteTable/hooks/useYourBrain.ts
5550
6338
  function useYourBrain(param) {
@@ -5614,7 +6402,7 @@ function useCellRendering(param) {
5614
6402
  bodySize,
5615
6403
  rowspan
5616
6404
  });
5617
- const scrollTopMaxRef = useRef16(0);
6405
+ const scrollTopMaxRef = useRef18(0);
5618
6406
  useEffect15(() => {
5619
6407
  return brain.onRenderCountChange(() => {
5620
6408
  scrollTopMaxRef.current = brain.scrollTopMax;
@@ -5651,7 +6439,7 @@ function useCellRendering(param) {
5651
6439
  useEffect15(() => {
5652
6440
  rerender();
5653
6441
  }, [dataSourceState]);
5654
- const renderCell = useCallback12((params) => {
6442
+ const renderCell = useCallback14((params) => {
5655
6443
  const {
5656
6444
  rowIndex,
5657
6445
  colIndex,
@@ -5686,7 +6474,7 @@ function useCellRendering(param) {
5686
6474
  rowStyle,
5687
6475
  rowClassName
5688
6476
  };
5689
- return /* @__PURE__ */ React27.createElement(InfiniteTableColumnCell, __spreadValues({}, cellProps));
6477
+ return /* @__PURE__ */ React31.createElement(InfiniteTableColumnCell, __spreadValues({}, cellProps));
5690
6478
  }, [
5691
6479
  rowHeight,
5692
6480
  getData,
@@ -5704,7 +6492,7 @@ function useCellRendering(param) {
5704
6492
  }
5705
6493
 
5706
6494
  // src/components/InfiniteTable/hooks/useComputed.ts
5707
- import { useCallback as useCallback15, useEffect as useEffect25, useState as useState14 } from "react";
6495
+ import { useCallback as useCallback17, useEffect as useEffect25, useState as useState15 } from "react";
5708
6496
 
5709
6497
  // src/components/InfiniteTable/hooks/useColumnGroups.ts
5710
6498
  import { useEffect as useEffect17 } from "react";
@@ -5873,10 +6661,10 @@ function useColumnRowspan(computedVisibleColumns) {
5873
6661
  }
5874
6662
 
5875
6663
  // src/components/InfiniteTable/hooks/useColumnSizeFn.ts
5876
- import { useCallback as useCallback13 } from "react";
6664
+ import { useCallback as useCallback15 } from "react";
5877
6665
  var debug4 = dbg("useColumnSizeFn");
5878
6666
  function useColumnSizeFn(columns) {
5879
- const columnSize = useCallback13((index) => {
6667
+ const columnSize = useCallback15((index) => {
5880
6668
  const column = columns[index];
5881
6669
  if (false) {
5882
6670
  debug4("cannot find column at index", index, columns);
@@ -5891,14 +6679,9 @@ import { useEffect as useEffect22, useMemo as useMemo10 } from "react";
5891
6679
 
5892
6680
  // src/components/InfiniteTable/utils/getColumnForGroupBy.tsx
5893
6681
  import {
5894
- createElement as createElement24
6682
+ createElement as createElement26
5895
6683
  } from "react";
5896
6684
 
5897
- // src/utils/stripVar.ts
5898
- function stripVar(cssVariableWithVarString) {
5899
- return cssVariableWithVarString.slice(4, -1);
5900
- }
5901
-
5902
6685
  // src/components/DataSource/state/rowInfoStatus.ts
5903
6686
  var showLoadingIcon = (rowInfo) => {
5904
6687
  if (rowInfo.dataSourceHasGrouping) {
@@ -5909,21 +6692,21 @@ var showLoadingIcon = (rowInfo) => {
5909
6692
 
5910
6693
  // src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
5911
6694
  import {
5912
- createElement as createElement22,
6695
+ createElement as createElement24,
5913
6696
  useEffect as useEffect18
5914
6697
  } from "react";
5915
- import { useState as useState11 } from "react";
6698
+ import { useState as useState12 } from "react";
5916
6699
 
5917
6700
  // src/components/InfiniteTable/components/icons/ExpanderIcon.css.ts
5918
- var import_createRuntimeFn5 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
5919
- var ExpanderIconCls = "_16lm1iw6 _16lm1iwg _16lm1iwd";
5920
- var ExpanderIconClsVariants = (0, import_createRuntimeFn5.createRuntimeFn)({ defaultClassName: "", variantClassNames: { expanded: { true: "_16lm1iwc", false: "_198z9782" } }, defaultVariants: {}, compoundVariants: [] });
6701
+ var import_createRuntimeFn6 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
6702
+ var ExpanderIconCls = "_16lm1iw6 _16lm1iwh _16lm1iwd";
6703
+ var ExpanderIconClsVariants = (0, import_createRuntimeFn6.createRuntimeFn)({ defaultClassName: "", variantClassNames: { expanded: { true: "_16lm1iwc", false: "_198z9782" } }, defaultVariants: {}, compoundVariants: [] });
5921
6704
 
5922
6705
  // src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
5923
6706
  function ExpanderIcon(props) {
5924
6707
  var _a;
5925
6708
  const { size = 24 } = props;
5926
- const [expanded, setExpanded] = useState11((_a = props.expanded) != null ? _a : props.defaultExpanded);
6709
+ const [expanded, setExpanded] = useState12((_a = props.expanded) != null ? _a : props.defaultExpanded);
5927
6710
  const onClick = () => {
5928
6711
  var _a2;
5929
6712
  (_a2 = props.onChange) == null ? void 0 : _a2.call(props, !expanded);
@@ -5936,7 +6719,7 @@ function ExpanderIcon(props) {
5936
6719
  setExpanded(props.expanded);
5937
6720
  }
5938
6721
  }, [props.expanded]);
5939
- return /* @__PURE__ */ createElement22("svg", {
6722
+ return /* @__PURE__ */ createElement24("svg", {
5940
6723
  "data-name": "expander-icon",
5941
6724
  xmlns: "http://www.w3.org/2000/svg",
5942
6725
  height: `${size}px`,
@@ -5947,22 +6730,22 @@ function ExpanderIcon(props) {
5947
6730
  className: join(props.className, ExpanderIconCls, ExpanderIconClsVariants({
5948
6731
  expanded
5949
6732
  }), "InfiniteIcon", "InfiniteIcon-expander", `InfiniteIcon-expander--${expanded ? "expanded" : "collapsed"}`)
5950
- }, /* @__PURE__ */ createElement22("path", {
6733
+ }, /* @__PURE__ */ createElement24("path", {
5951
6734
  d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"
5952
6735
  }));
5953
6736
  }
5954
6737
 
5955
6738
  // src/components/InfiniteTable/components/icons/LoadingIcon.tsx
5956
6739
  import {
5957
- createElement as createElement23
6740
+ createElement as createElement25
5958
6741
  } from "react";
5959
6742
 
5960
6743
  // src/components/InfiniteTable/components/icons/LoadingIcon.css.ts
5961
- var LoadingIconCls = "_16lm1iw8 _16lm1iwg _16lm1iwd";
6744
+ var LoadingIconCls = "_16lm1iw8 _16lm1iwh _16lm1iwd";
5962
6745
 
5963
6746
  // src/components/InfiniteTable/components/icons/LoadingIcon.tsx
5964
6747
  var LoadingIcon = (props) => {
5965
- return /* @__PURE__ */ createElement23("svg", {
6748
+ return /* @__PURE__ */ createElement25("svg", {
5966
6749
  xmlns: "http://www.w3.org/2000/svg",
5967
6750
  style: {
5968
6751
  margin: "auto",
@@ -5974,14 +6757,14 @@ var LoadingIcon = (props) => {
5974
6757
  viewBox: "0 0 100 100",
5975
6758
  preserveAspectRatio: "xMidYMid",
5976
6759
  className: join(props.className, LoadingIconCls, "InfiniteIcon", "InfiniteIcon-loading")
5977
- }, /* @__PURE__ */ createElement23("circle", {
6760
+ }, /* @__PURE__ */ createElement25("circle", {
5978
6761
  cx: "50",
5979
6762
  cy: "50",
5980
6763
  fill: "none",
5981
6764
  strokeWidth: "10",
5982
6765
  r: "35",
5983
6766
  strokeDasharray: "164.93361431346415 56.97787143782138"
5984
- }, /* @__PURE__ */ createElement23("animateTransform", {
6767
+ }, /* @__PURE__ */ createElement25("animateTransform", {
5985
6768
  attributeName: "transform",
5986
6769
  type: "rotate",
5987
6770
  repeatCount: "indefinite",
@@ -6001,7 +6784,7 @@ function getGroupColumnRender({
6001
6784
  var _a, _b, _c;
6002
6785
  let { value, rowInfo, column, groupBy, pivotBy } = renderOptions;
6003
6786
  if (column.renderValue) {
6004
- value = /* @__PURE__ */ createElement24(RenderHookComponent, {
6787
+ value = /* @__PURE__ */ createElement26(RenderHookComponent, {
6005
6788
  render: column.renderValue,
6006
6789
  renderParam: renderOptions
6007
6790
  });
@@ -6031,22 +6814,22 @@ function getGroupColumnRender({
6031
6814
  const showExpanderIcon = pivotBy ? (((_b = groupRowInfo.groupKeys) == null ? void 0 : _b.length) || 0) < (groupBy == null ? void 0 : groupBy.length) : (((_c = groupRowInfo.groupKeys) == null ? void 0 : _c.length) || 0) <= (groupBy == null ? void 0 : groupBy.length);
6032
6815
  const isLoading = showLoadingIcon(groupRowInfo);
6033
6816
  if (isLoading) {
6034
- icon = /* @__PURE__ */ createElement24(LoadingIcon, null);
6817
+ icon = /* @__PURE__ */ createElement26(LoadingIcon, null);
6035
6818
  } else if (showExpanderIcon) {
6036
- const defaultIcon = /* @__PURE__ */ createElement24(ExpanderIcon, {
6819
+ const defaultIcon = /* @__PURE__ */ createElement26(ExpanderIcon, {
6037
6820
  expanded: !collapsed,
6038
6821
  onChange: () => {
6039
6822
  toggleGroupRow(groupKeys);
6040
6823
  }
6041
6824
  });
6042
- icon = column.renderGroupIcon ? /* @__PURE__ */ createElement24(RenderHookComponent, {
6825
+ icon = column.renderGroupIcon ? /* @__PURE__ */ createElement26(RenderHookComponent, {
6043
6826
  render: column.renderGroupIcon,
6044
6827
  renderParam: Object.assign({ collapsed, groupIcon: defaultIcon }, renderOptions)
6045
6828
  }) : defaultIcon;
6046
6829
  }
6047
- return /* @__PURE__ */ createElement24("div", {
6830
+ return /* @__PURE__ */ createElement26("div", {
6048
6831
  className: join(display.flex, alignItems.center)
6049
- }, icon, /* @__PURE__ */ createElement24("div", {
6832
+ }, icon, /* @__PURE__ */ createElement26("div", {
6050
6833
  className: cssEllipsisClassName
6051
6834
  }, value != null ? value : null));
6052
6835
  };
@@ -6091,9 +6874,9 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
6091
6874
  const showExpanderIcon = rowInfo.isGroupRow ? pivotBy ? (((_a = rowInfo.groupKeys) == null ? void 0 : _a.length) || 0) < (groupBy == null ? void 0 : groupBy.length) : (((_b = rowInfo.groupKeys) == null ? void 0 : _b.length) || 0) <= (groupBy == null ? void 0 : groupBy.length) : false;
6092
6875
  const isLoading = showLoadingIcon(rowInfo);
6093
6876
  if (isLoading) {
6094
- icon = /* @__PURE__ */ createElement24(LoadingIcon, null);
6877
+ icon = /* @__PURE__ */ createElement26(LoadingIcon, null);
6095
6878
  } else if (showExpanderIcon) {
6096
- const defaultIcon = /* @__PURE__ */ createElement24(ExpanderIcon, {
6879
+ const defaultIcon = /* @__PURE__ */ createElement26(ExpanderIcon, {
6097
6880
  expanded: !collapsed,
6098
6881
  onChange: () => {
6099
6882
  if (!rowInfo.isGroupRow) {
@@ -6108,9 +6891,9 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
6108
6891
  icon = column.renderGroupIcon(renderParam);
6109
6892
  }
6110
6893
  }
6111
- return /* @__PURE__ */ createElement24("div", {
6894
+ return /* @__PURE__ */ createElement26("div", {
6112
6895
  className: join(display.flex, alignItems.center, GroupRowExpanderCls)
6113
- }, icon, /* @__PURE__ */ createElement24("div", {
6896
+ }, icon, /* @__PURE__ */ createElement26("div", {
6114
6897
  className: cssEllipsisClassName
6115
6898
  }, value != null ? value : null));
6116
6899
  }
@@ -6126,10 +6909,10 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
6126
6909
  }
6127
6910
 
6128
6911
  // src/components/InfiniteTable/hooks/useEffectWithRaf.ts
6129
- import { useEffect as useEffect19, useRef as useRef17 } from "react";
6912
+ import { useEffect as useEffect19, useRef as useRef19 } from "react";
6130
6913
  function useEffectWithRaf(fn, deps) {
6131
- const rafId = useRef17(0);
6132
- const removeFnRaf = useRef17();
6914
+ const rafId = useRef19(0);
6915
+ const removeFnRaf = useRef19();
6133
6916
  useEffect19(() => {
6134
6917
  rafId.current = requestAnimationFrame(() => {
6135
6918
  removeFnRaf.current = fn();
@@ -6147,7 +6930,7 @@ function useEffectWithRaf(fn, deps) {
6147
6930
  }
6148
6931
 
6149
6932
  // src/components/InfiniteTable/hooks/useToggleGroupRow.ts
6150
- import { useCallback as useCallback14 } from "react";
6933
+ import { useCallback as useCallback16 } from "react";
6151
6934
 
6152
6935
  // src/utils/groupAndPivot/index.ts
6153
6936
  var LAZY_ROOT_KEY_FOR_GROUPS = "____root____";
@@ -6602,7 +7385,7 @@ function enhancedFlatten(param) {
6602
7385
  // src/components/DataSource/index.tsx
6603
7386
  import {
6604
7387
  Fragment as Fragment3,
6605
- createElement as createElement25
7388
+ createElement as createElement27
6606
7389
  } from "react";
6607
7390
 
6608
7391
  // src/utils/multisort/sortTypes.ts
@@ -6791,15 +7574,15 @@ var GroupRowsState = class {
6791
7574
  };
6792
7575
 
6793
7576
  // src/components/DataSource/privateHooks/useLoadData.ts
6794
- import { useEffect as useEffect21, useMemo as useMemo9, useRef as useRef19, useState as useState12 } from "react";
7577
+ import { useEffect as useEffect21, useMemo as useMemo9, useRef as useRef21, useState as useState13 } from "react";
6795
7578
 
6796
7579
  // src/components/hooks/useEffectWithChanges.ts
6797
- import { useEffect as useEffect20, useRef as useRef18 } from "react";
7580
+ import { useEffect as useEffect20, useRef as useRef20 } from "react";
6798
7581
  function useEffectWithChanges(fn, deps) {
6799
- const prevRef = useRef18({});
6800
- const oldValuesRef = useRef18({});
7582
+ const prevRef = useRef20({});
7583
+ const oldValuesRef = useRef20({});
6801
7584
  const oldValues = oldValuesRef.current;
6802
- const changesRef = useRef18({});
7585
+ const changesRef = useRef20({});
6803
7586
  const changes = changesRef.current;
6804
7587
  const useEffectDeps = [];
6805
7588
  for (const k in deps) {
@@ -7080,11 +7863,11 @@ function useLoadData() {
7080
7863
  livePaginationCursor,
7081
7864
  cursorId: stateCursorId
7082
7865
  } = componentState;
7083
- const [scrollbars, setScrollbars] = useState12({
7866
+ const [scrollbars, setScrollbars] = useState13({
7084
7867
  vertical: false,
7085
7868
  horizontal: false
7086
7869
  });
7087
- const scrollbarsRef = useRef19(scrollbars);
7870
+ const scrollbarsRef = useRef21(scrollbars);
7088
7871
  useEffect21(() => {
7089
7872
  notifyScrollbarsChange.onChange((scrollbars2) => {
7090
7873
  if (!scrollbars2) {
@@ -7141,7 +7924,7 @@ function useLoadData() {
7141
7924
  filterValue,
7142
7925
  cursorId: livePagination ? stateCursorId : null
7143
7926
  };
7144
- const initialRef = useRef19(true);
7927
+ const initialRef = useRef21(true);
7145
7928
  useLazyLoadRange();
7146
7929
  useEffectWithChanges(() => {
7147
7930
  const componentState2 = getComponentState();
@@ -7182,7 +7965,7 @@ function useLazyLoadRange() {
7182
7965
  dataArray,
7183
7966
  scrollStopDelayUpdatedByTable
7184
7967
  } = componentState;
7185
- const latestRenderRangeRef = useRef19(null);
7968
+ const latestRenderRangeRef = useRef21(null);
7186
7969
  const loadRange = (renderRange, cache = getComponentState().lazyLoadCacheOfLoadedBatches) => {
7187
7970
  const componentState2 = getComponentState();
7188
7971
  renderRange = renderRange || latestRenderRangeRef.current;
@@ -8014,7 +8797,7 @@ function DataSourceWithContext(props) {
8014
8797
  if (typeof children === "function") {
8015
8798
  children = children(computedValues);
8016
8799
  }
8017
- return /* @__PURE__ */ createElement25(Fragment3, null, children);
8800
+ return /* @__PURE__ */ createElement27(Fragment3, null, children);
8018
8801
  }
8019
8802
  var DataSourceRoot = getComponentStateRoot({
8020
8803
  initSetupState,
@@ -8037,14 +8820,14 @@ function DataSourceCmp({ children }) {
8037
8820
  globalThis.getDataSourceState = getState;
8038
8821
  }
8039
8822
  useLoadData();
8040
- return /* @__PURE__ */ createElement25(DataSourceContext.Provider, {
8823
+ return /* @__PURE__ */ createElement27(DataSourceContext.Provider, {
8041
8824
  value: contextValue
8042
- }, /* @__PURE__ */ createElement25(DataSourceWithContext, {
8825
+ }, /* @__PURE__ */ createElement27(DataSourceWithContext, {
8043
8826
  children
8044
8827
  }));
8045
8828
  }
8046
8829
  function DataSource(props) {
8047
- return /* @__PURE__ */ createElement25(DataSourceRoot, __spreadValues({}, props), /* @__PURE__ */ createElement25(DataSourceCmp, {
8830
+ return /* @__PURE__ */ createElement27(DataSourceRoot, __spreadValues({}, props), /* @__PURE__ */ createElement27(DataSourceCmp, {
8048
8831
  children: props.children
8049
8832
  }));
8050
8833
  }
@@ -8052,7 +8835,7 @@ function DataSource(props) {
8052
8835
  // src/components/InfiniteTable/hooks/useToggleGroupRow.ts
8053
8836
  function useToggleGroupRow() {
8054
8837
  const { getState: getDataSourceState, componentActions: dataSourceActions } = useDataSourceContextValue();
8055
- const toggleGroupRow = useCallback14((groupKeys) => {
8838
+ const toggleGroupRow = useCallback16((groupKeys) => {
8056
8839
  const state = getDataSourceState();
8057
8840
  const newState = new GroupRowsState(state.groupRowsState);
8058
8841
  newState.toggleGroupRow(groupKeys);
@@ -8470,144 +9253,6 @@ function getColumnsWhenGrouping(params) {
8470
9253
  // src/components/InfiniteTable/hooks/useComputedVisibleColumns.ts
8471
9254
  import { useMemo as useMemo11 } from "react";
8472
9255
 
8473
- // src/components/flexbox/index.ts
8474
- var computeFlex = (params) => {
8475
- const {
8476
- availableSize,
8477
- items,
8478
- minSize: defaultMinSize,
8479
- maxSize: defaultMaxSize
8480
- } = params;
8481
- if (availableSize < 0) {
8482
- throw "The provided availableSize cannot be negative!";
8483
- }
8484
- let totalFixedSize = 0;
8485
- let totalFlex = 0;
8486
- let totalFlexCount = 0;
8487
- const minSizes = [];
8488
- const maxSizes = [];
8489
- items.forEach((item, i) => {
8490
- var _a, _b, _c, _d, _e, _f;
8491
- let maxSize = (_b = (_a = item.maxSize) != null ? _a : defaultMaxSize) != null ? _b : void 0;
8492
- let minSize = (_d = (_c = item.minSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
8493
- minSizes.push(minSize);
8494
- maxSizes.push(maxSize);
8495
- if (item.size != null) {
8496
- if (maxSize != null && item.size > maxSize) {
8497
- item.size = maxSize;
8498
- }
8499
- if (minSize != null && item.size < minSize) {
8500
- item.size = minSize;
8501
- }
8502
- }
8503
- if (item.size == null && item.flex == null) {
8504
- throw `Items must specify either a size or a flex property. Item at index ${i} doesn't have either of those.`;
8505
- }
8506
- if (item.flex != null) {
8507
- totalFlexCount += 1;
8508
- }
8509
- totalFlex += (_e = item.flex) != null ? _e : 0;
8510
- totalFixedSize += (_f = item.size) != null ? _f : 0;
8511
- });
8512
- let availableSizeForFlex = Math.max(availableSize - totalFixedSize, 0);
8513
- let sizePerFlex = availableSizeForFlex / totalFlex;
8514
- let maxxedFlexItems = {};
8515
- let minnedFlexItems = {};
8516
- let constrainedCount = 0;
8517
- items.forEach((item, index) => {
8518
- var _a, _b, _c, _d;
8519
- if (item.flex != null) {
8520
- const approxFlexSize = sizePerFlex * item.flex;
8521
- let maxSize = (_b = (_a = item.maxSize) != null ? _a : defaultMaxSize) != null ? _b : void 0;
8522
- let minSize = (_d = (_c = item.minSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
8523
- let constrained = false;
8524
- let substractSize = 0;
8525
- if (maxSize != null && approxFlexSize > maxSize) {
8526
- maxxedFlexItems[index] = true;
8527
- constrained = true;
8528
- substractSize = maxSize;
8529
- }
8530
- if (minSize != null && approxFlexSize < minSize) {
8531
- minnedFlexItems[index] = true;
8532
- constrained = true;
8533
- substractSize = minSize;
8534
- }
8535
- if (constrained) {
8536
- constrainedCount += 1;
8537
- totalFlexCount -= 1;
8538
- totalFlex -= item.flex;
8539
- availableSizeForFlex -= substractSize;
8540
- }
8541
- }
8542
- });
8543
- if (constrainedCount) {
8544
- sizePerFlex = availableSizeForFlex / totalFlex;
8545
- }
8546
- let flexSizes = [];
8547
- let currentFlexCount = 0;
8548
- let remainingSizeForFlex = availableSizeForFlex;
8549
- let remainingFlex = totalFlex;
8550
- let totalTakenSize = 0;
8551
- let flexSizeSum = 0;
8552
- const computedSizes = [];
8553
- const resultItems = items.map((item, index) => {
8554
- var _a, _b, _c, _d, _e;
8555
- const sizedItem = __spreadValues({}, item);
8556
- let maxSize = (_b = (_a = item.maxSize) != null ? _a : defaultMaxSize) != null ? _b : void 0;
8557
- let minSize = (_d = (_c = item.minSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
8558
- let flexSize = 0;
8559
- const maxxed = maxxedFlexItems[index];
8560
- const minned = minnedFlexItems[index];
8561
- const constrained = maxxed || minned;
8562
- let computedSize = (_e = item.size) != null ? _e : 0;
8563
- if (item.flex != null) {
8564
- if (constrained) {
8565
- if (minned) {
8566
- flexSize = minSize;
8567
- }
8568
- if (maxxed) {
8569
- flexSize = maxSize;
8570
- }
8571
- } else {
8572
- currentFlexCount += 1;
8573
- const constrain = (size) => {
8574
- if (maxSize != null && size > maxSize) {
8575
- size = maxSize;
8576
- }
8577
- if (minSize != null && size < minSize) {
8578
- size = minSize;
8579
- }
8580
- return size;
8581
- };
8582
- if (currentFlexCount === totalFlexCount) {
8583
- flexSize = constrain(remainingSizeForFlex);
8584
- } else {
8585
- flexSize = constrain(Math.round(item.flex * sizePerFlex));
8586
- flexSizeSum += flexSize;
8587
- remainingSizeForFlex = availableSizeForFlex - flexSizeSum;
8588
- remainingFlex -= item.flex;
8589
- sizePerFlex = remainingSizeForFlex / remainingFlex;
8590
- }
8591
- }
8592
- computedSize = flexSize;
8593
- sizedItem.flexSize = flexSize;
8594
- }
8595
- flexSizes.push(flexSize);
8596
- computedSizes.push(computedSize);
8597
- sizedItem.computedSize = computedSize;
8598
- totalTakenSize += computedSize;
8599
- return sizedItem;
8600
- });
8601
- return {
8602
- items: resultItems,
8603
- flexSizes,
8604
- minSizes,
8605
- maxSizes,
8606
- computedSizes,
8607
- remainingSize: Math.round(availableSize - totalTakenSize)
8608
- };
8609
- };
8610
-
8611
9256
  // src/components/InfiniteTable/utils/adjustColumnOrderForPinning.ts
8612
9257
  var order = ["start", void 0, "end"];
8613
9258
  var adjustColumnOrderForPinning = (columnOrder, columnPinning) => {
@@ -8800,8 +9445,8 @@ var getComputedVisibleColumns = ({
8800
9445
  const computedSortIndex = (_c = sortingInfo == null ? void 0 : sortingInfo.index) != null ? _c : -1;
8801
9446
  const computedWidth = computedSizes[i];
8802
9447
  const computedFlex = flexSizes[i] || null;
8803
- const computedMinWidth = minSizes[i] || null;
8804
- const computedMaxWidth = maxSizes[i] || null;
9448
+ const computedMinWidth = minSizes[i] || 0;
9449
+ const computedMaxWidth = maxSizes[i] || 1e4;
8805
9450
  const computedPinned = getComputedPinned(id, columnPinning);
8806
9451
  const computedLast = i === visibleColumnOrder.length - 1;
8807
9452
  const computedPinningOffset = computedPinned === "start" ? computedPinnedStartColumnsWidth : computedPinned === "end" ? computedPinnedEndColumnsWidth : computedOffset - computedPinnedStartColumnsWidth;
@@ -9043,6 +9688,7 @@ var useComputedVisibleColumns = ({
9043
9688
  columnMinWidth,
9044
9689
  columnMaxWidth,
9045
9690
  columnDefaultWidth,
9691
+ viewportReservedWidth,
9046
9692
  sortable,
9047
9693
  sortInfo,
9048
9694
  setSortInfo,
@@ -9051,6 +9697,7 @@ var useComputedVisibleColumns = ({
9051
9697
  columnOrder,
9052
9698
  columnVisibility,
9053
9699
  columnVisibilityAssumeVisible,
9700
+ resizableColumns,
9054
9701
  pinnedEndMaxWidth,
9055
9702
  pinnedStartMaxWidth,
9056
9703
  columnSizing,
@@ -9080,7 +9727,7 @@ var useComputedVisibleColumns = ({
9080
9727
  };
9081
9728
 
9082
9729
  // src/components/InfiniteTable/hooks/useScrollbars.ts
9083
- import { useState as useState13, useEffect as useEffect24, useLayoutEffect as useLayoutEffect6 } from "react";
9730
+ import { useState as useState14, useEffect as useEffect24, useLayoutEffect as useLayoutEffect6 } from "react";
9084
9731
  var INITIAL_SCROLLBARS = {
9085
9732
  vertical: false,
9086
9733
  horizontal: false
@@ -9088,7 +9735,7 @@ var INITIAL_SCROLLBARS = {
9088
9735
  function useScrollbars(brain) {
9089
9736
  const { getComponentState: getInfiniteTableState } = useComponentState();
9090
9737
  const { getState: getDataSourceState } = useDataSourceContextValue();
9091
- const [scrollbars, setScrollbars] = useState13(INITIAL_SCROLLBARS);
9738
+ const [scrollbars, setScrollbars] = useState14(INITIAL_SCROLLBARS);
9092
9739
  useEffect24(() => {
9093
9740
  return brain.onRenderCountChange(() => {
9094
9741
  const { scrollTopMax, scrollLeftMax } = brain;
@@ -9129,7 +9776,7 @@ function useComputed() {
9129
9776
  bodySize,
9130
9777
  showSeparatePivotColumnForSingleAggregation
9131
9778
  } = componentState;
9132
- useState14(() => {
9779
+ useState15(() => {
9133
9780
  componentState.onRowHeightCSSVarChange.onChange((rowHeight) => {
9134
9781
  if (rowHeight) {
9135
9782
  componentActions.rowHeight = rowHeight;
@@ -9147,7 +9794,7 @@ function useComputed() {
9147
9794
  const { multiSort, filterValue } = dataSourceState;
9148
9795
  useColumnGroups();
9149
9796
  const { toggleGroupRow } = useColumnsWhen();
9150
- const setSortInfo = useCallback15((sortInfo) => {
9797
+ const setSortInfo = useCallback17((sortInfo) => {
9151
9798
  var _a2;
9152
9799
  const newSortInfo = getDataSourceState().multiSort ? sortInfo : (_a2 = sortInfo[0]) != null ? _a2 : null;
9153
9800
  dataSourceActions.sortInfo = newSortInfo;
@@ -9225,6 +9872,10 @@ function useComputed() {
9225
9872
  }
9226
9873
 
9227
9874
  // src/components/InfiniteTable/hooks/useDOMProps.ts
9875
+ var columnWidthAtIndex4 = stripVar(InternalVars.columnWidthAtIndex);
9876
+ var columnOffsetAtIndex2 = stripVar(InternalVars.columnOffsetAtIndex);
9877
+ var activeCellColWidth = stripVar(InternalVars.activeCellColWidth);
9878
+ var activeCellColOffset = stripVar(InternalVars.activeCellColOffset);
9228
9879
  function useDOMProps(initialDOMProps) {
9229
9880
  const { computed, componentState, componentActions } = useInfiniteTable();
9230
9881
  const {
@@ -9235,9 +9886,24 @@ function useDOMProps(initialDOMProps) {
9235
9886
  onBlurWithin,
9236
9887
  onFocusWithin,
9237
9888
  onSelfFocus,
9238
- onSelfBlur
9889
+ onSelfBlur,
9890
+ activeCellIndex
9239
9891
  } = componentState;
9240
- const { computedPinnedStartColumnsWidth, computedPinnedEndColumnsWidth } = computed;
9892
+ const {
9893
+ computedPinnedStartColumnsWidth,
9894
+ computedPinnedEndColumnsWidth,
9895
+ computedVisibleColumns
9896
+ } = computed;
9897
+ const cssVars = computedVisibleColumns.reduce((vars, col) => {
9898
+ const index = col.computedVisibleIndex;
9899
+ vars[`${columnWidthAtIndex4}-${index}`] = col.computedWidth + "px";
9900
+ vars[`${columnOffsetAtIndex2}-${index}`] = col.computedOffset + "px";
9901
+ return vars;
9902
+ }, {});
9903
+ if (activeCellIndex != null) {
9904
+ cssVars[activeCellColWidth] = `var(${getCSSVarNameForColWidth(activeCellIndex[1])})`;
9905
+ cssVars[activeCellColOffset] = `var(${getCSSVarNameForColOffset(activeCellIndex[1])})`;
9906
+ }
9241
9907
  const setFocused = rafFn((focused2) => {
9242
9908
  componentActions.focused = focused2;
9243
9909
  });
@@ -9292,7 +9958,7 @@ function useDOMProps(initialDOMProps) {
9292
9958
  focusedWithin
9293
9959
  }));
9294
9960
  domProps.className = className;
9295
- domProps.style = __spreadValues({}, initialDOMProps == null ? void 0 : initialDOMProps.style);
9961
+ domProps.style = __spreadValues(__spreadValues({}, initialDOMProps == null ? void 0 : initialDOMProps.style), cssVars);
9296
9962
  if (focused) {
9297
9963
  if (componentState.focusedStyle) {
9298
9964
  Object.assign(domProps.style, componentState.focusedStyle);
@@ -9468,7 +10134,7 @@ var useLicense = (licenseKey = "") => {
9468
10134
  const valid = useMemo12(() => {
9469
10135
  let valid2 = isValidLicense(licenseKey, {
9470
10136
  publishedAt: 1624970570587,
9471
- version: "0.3.11"
10137
+ version: "0.3.14"
9472
10138
  });
9473
10139
  if (!licenseKey && !valid2 && isInsidePlayground) {
9474
10140
  return true;
@@ -9599,10 +10265,23 @@ function handleCellNavigation(options) {
9599
10265
  actions.activeCellIndex = [rowIndex, colIndex];
9600
10266
  return true;
9601
10267
  }
10268
+ var validKeys = {
10269
+ ArrowUp: true,
10270
+ ArrowDown: true,
10271
+ ArrowLeft: true,
10272
+ ArrowRight: true,
10273
+ PageUp: true,
10274
+ PageDown: true,
10275
+ Home: true,
10276
+ End: true
10277
+ };
9602
10278
  function handleKeyboardNavigation(options) {
9603
10279
  const { getState } = options;
9604
10280
  const state = getState();
9605
10281
  const { activeRowIndex, activeCellIndex, keyboardNavigation } = state;
10282
+ if (!validKeys[options.key]) {
10283
+ return false;
10284
+ }
9606
10285
  if (activeRowIndex != null && keyboardNavigation === "row") {
9607
10286
  return handleRowNavigation(options);
9608
10287
  }
@@ -9693,6 +10372,7 @@ function initSetupState2() {
9693
10372
  });
9694
10373
  if (false) {
9695
10374
  globalThis.brain = brain;
10375
+ globalThis.headerBrain = headerBrain;
9696
10376
  }
9697
10377
  const { renderer, onRenderUpdater } = createRenderer2(brain);
9698
10378
  brain.onAvailableSizeChange((size) => {
@@ -9711,6 +10391,7 @@ function initSetupState2() {
9711
10391
  domRef: createRef(),
9712
10392
  scrollerDOMRef: createRef(),
9713
10393
  portalDOMRef: createRef(),
10394
+ activeCellIndicatorDOMRef: createRef(),
9714
10395
  onRowHeightCSSVarChange: buildSubscriptionCallback(),
9715
10396
  onColumnHeaderHeightCSSVarChange: buildSubscriptionCallback(),
9716
10397
  bodySize: {
@@ -9766,7 +10447,7 @@ var forwardProps3 = (setupState) => {
9766
10447
  viewportReservedWidth: (viewportReservedWidth) => viewportReservedWidth != null ? viewportReservedWidth : 0,
9767
10448
  resizableColumns: (resizableColumns) => resizableColumns != null ? resizableColumns : true,
9768
10449
  columnMinWidth: (columnMinWidth) => columnMinWidth != null ? columnMinWidth : 30,
9769
- columnMaxWidth: (columnMaxWidth) => columnMaxWidth != null ? columnMaxWidth : 2e3,
10450
+ columnMaxWidth: (columnMaxWidth) => columnMaxWidth != null ? columnMaxWidth : 5e3,
9770
10451
  columnDefaultWidth: (columnDefaultWidth) => columnDefaultWidth != null ? columnDefaultWidth : 200,
9771
10452
  columnCssEllipsis: (columnCssEllipsis) => columnCssEllipsis != null ? columnCssEllipsis : true,
9772
10453
  draggableColumns: (draggableColumns) => draggableColumns != null ? draggableColumns : true,
@@ -9812,6 +10493,19 @@ function getGroupRenderStrategy(options) {
9812
10493
  }
9813
10494
  return "multi-column";
9814
10495
  }
10496
+ var cleanupState = (state) => {
10497
+ state.brain.destroy();
10498
+ state.headerBrain.destroy();
10499
+ state.renderer.destroy();
10500
+ state.onRenderUpdater.destroy();
10501
+ state.domRef.current = null;
10502
+ state.scrollerDOMRef.current = null;
10503
+ state.portalDOMRef.current = null;
10504
+ state.onRowHeightCSSVarChange.destroy();
10505
+ state.onColumnHeaderHeightCSSVarChange.destroy();
10506
+ state.pinnedEndScrollListener.destroy();
10507
+ state.pinnedStartScrollListener.destroy();
10508
+ };
9815
10509
  var mapPropsToState2 = (params) => {
9816
10510
  var _a, _b;
9817
10511
  const { props, state, oldState, parentState } = params;
@@ -9848,6 +10542,7 @@ var InfiniteTableRoot = getComponentStateRoot({
9848
10542
  initSetupState: initSetupState2,
9849
10543
  forwardProps: forwardProps3,
9850
10544
  mapPropsToState: mapPropsToState2,
10545
+ cleanup: cleanupState,
9851
10546
  allowedControlledPropOverrides: {
9852
10547
  rowHeight: true,
9853
10548
  columnHeaderHeight: true
@@ -9869,7 +10564,7 @@ var InfiniteTableComponent = memo11(function InfiniteTableComponent2() {
9869
10564
  getState: getDataSourceState,
9870
10565
  componentActions: dataSourceActions
9871
10566
  } = useDataSourceContextValue();
9872
- const [imperativeApi] = useState15(() => {
10567
+ const [imperativeApi] = useState16(() => {
9873
10568
  return getImperativeApi(getState, getComputed, getDataSourceState, actions);
9874
10569
  });
9875
10570
  const {
@@ -9935,7 +10630,7 @@ var InfiniteTableComponent = memo11(function InfiniteTableComponent2() {
9935
10630
  dataSourceActions.scrollStopDelayUpdatedByTable = scrollStopDelay;
9936
10631
  }, [scrollStopDelay]);
9937
10632
  useAutoSizeColumns();
9938
- const onKeyDown = useCallback16((event) => {
10633
+ const onKeyDown = useCallback18((event) => {
9939
10634
  if (handleKeyboardNavigation({
9940
10635
  getState,
9941
10636
  actions,
@@ -9947,13 +10642,14 @@ var InfiniteTableComponent = memo11(function InfiniteTableComponent2() {
9947
10642
  event.preventDefault();
9948
10643
  }
9949
10644
  }, []);
9950
- return /* @__PURE__ */ createElement26("div", __spreadValues({
10645
+ return /* @__PURE__ */ createElement28("div", __spreadValues({
9951
10646
  onKeyDown,
9952
10647
  ref: domRef
9953
- }, domProps), header ? /* @__PURE__ */ createElement26(TableHeaderWrapper, {
9954
- brain: headerBrain,
10648
+ }, domProps), header ? /* @__PURE__ */ createElement28(TableHeaderWrapper, {
10649
+ bodyBrain: brain,
10650
+ headerBrain,
9955
10651
  scrollbars
9956
- }) : null, /* @__PURE__ */ createElement26(InfiniteTableBody, null, /* @__PURE__ */ createElement26(HeadlessTable, {
10652
+ }) : null, /* @__PURE__ */ createElement28(InfiniteTableBody, null, /* @__PURE__ */ createElement28(HeadlessTable, {
9957
10653
  tabIndex: 0,
9958
10654
  activeRowIndex: componentState.ready && keyboardNavigation === "row" ? activeRowIndex : null,
9959
10655
  activeCellIndex: componentState.ready && keyboardNavigation === "cell" ? activeCellIndex : null,
@@ -9964,18 +10660,18 @@ var InfiniteTableComponent = memo11(function InfiniteTableComponent2() {
9964
10660
  renderCell,
9965
10661
  cellHoverClassNames: HOVERED_CLASS_NAMES,
9966
10662
  scrollerDOMRef
9967
- }), /* @__PURE__ */ createElement26(LoadMaskCmp, {
10663
+ }), /* @__PURE__ */ createElement28(LoadMaskCmp, {
9968
10664
  visible: loading
9969
- }, loadingText)), /* @__PURE__ */ createElement26("div", {
10665
+ }, loadingText)), /* @__PURE__ */ createElement28("div", {
9970
10666
  ref: portalDOMRef,
9971
10667
  className: join(`${rootClassName2}Portal`, zIndex[1e3], position.absolute, top[0], left[0])
9972
- }), rowHeightCSSVar ? /* @__PURE__ */ createElement26(CSSVariableWatch, {
10668
+ }), rowHeightCSSVar ? /* @__PURE__ */ createElement28(CSSVariableWatch, {
9973
10669
  varName: rowHeightCSSVar,
9974
10670
  onChange: onRowHeightCSSVarChange
9975
- }) : null, columnHeaderHeightCSSVar ? /* @__PURE__ */ createElement26(CSSVariableWatch, {
10671
+ }) : null, columnHeaderHeightCSSVar ? /* @__PURE__ */ createElement28(CSSVariableWatch, {
9976
10672
  varName: columnHeaderHeightCSSVar,
9977
10673
  onChange: onColumnHeaderHeightCSSVarChange
9978
- }) : null, /* @__PURE__ */ createElement26(InfiniteTableFooter, null), licenseValid ? null : /* @__PURE__ */ createElement26(InfiniteTableLicenseFooter, null));
10674
+ }) : null, /* @__PURE__ */ createElement28(InfiniteTableFooter, null), licenseValid ? null : /* @__PURE__ */ createElement28(InfiniteTableLicenseFooter, null));
9979
10675
  });
9980
10676
  function InfiniteTableContextProvider() {
9981
10677
  const { componentActions, componentState } = useComponentState();
@@ -9995,14 +10691,12 @@ function InfiniteTableContextProvider() {
9995
10691
  getState
9996
10692
  };
9997
10693
  useResizeObserver(scrollerDOMRef, (size) => {
9998
- var _a, _b;
9999
10694
  const bodySize = {
10000
10695
  width: size.width,
10001
10696
  height: size.height
10002
10697
  };
10003
- bodySize.width = (_b = (_a = scrollerDOMRef.current) == null ? void 0 : _a.scrollWidth) != null ? _b : bodySize.width;
10004
10698
  componentActions.bodySize = bodySize;
10005
- }, { earlyAttach: true });
10699
+ }, { earlyAttach: true, debounce: 50 });
10006
10700
  useEffect26(() => {
10007
10701
  return () => {
10008
10702
  componentState.onRowHeightCSSVarChange.destroy();
@@ -10015,13 +10709,16 @@ function InfiniteTableContextProvider() {
10015
10709
  }
10016
10710
  }, [scrollTopKey, scrollerDOMRef]);
10017
10711
  const TableContext2 = getInfiniteTableContext();
10018
- return /* @__PURE__ */ createElement26(TableContext2.Provider, {
10712
+ return /* @__PURE__ */ createElement28(TableContext2.Provider, {
10019
10713
  value: contextValue
10020
- }, /* @__PURE__ */ createElement26(InfiniteTableComponent, null));
10714
+ }, /* @__PURE__ */ createElement28(InfiniteTableComponent, null));
10021
10715
  }
10022
10716
  function InfiniteTable(props) {
10023
- const table = /* @__PURE__ */ createElement26(InfiniteTableRoot, __spreadValues({}, props), /* @__PURE__ */ createElement26(InfiniteTableContextProvider, null));
10024
- return /* @__PURE__ */ createElement26(StrictMode, null, table);
10717
+ const table = /* @__PURE__ */ createElement28(InfiniteTableRoot, __spreadValues({}, props), /* @__PURE__ */ createElement28(InfiniteTableContextProvider, null));
10718
+ if (false) {
10719
+ return /* @__PURE__ */ createElement28(StrictMode, null, table);
10720
+ }
10721
+ return table;
10025
10722
  }
10026
10723
  InfiniteTable.defaultProps = {
10027
10724
  rowHeight: 40,