@infinite-table/infinite-react 0.3.10 → 0.3.13

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.js CHANGED
@@ -665,8 +665,8 @@ function debounce(fn, { wait }) {
665
665
  }
666
666
 
667
667
  // src/components/InfiniteTable/index.tsx
668
- var React32 = __toModule(require("react"));
669
- var import_react45 = __toModule(require("react"));
668
+ var React36 = __toModule(require("react"));
669
+ var import_react49 = __toModule(require("react"));
670
670
 
671
671
  // src/utils/join.ts
672
672
  var join = (...args) => args.filter((x) => !!`${x}`).join(" ");
@@ -694,7 +694,7 @@ var Logger = class {
694
694
  constructor(channelName) {
695
695
  this.debug = emptyLogFn;
696
696
  this.error = emptyLogFn;
697
- if (true) {
697
+ if (false) {
698
698
  this.debug = dbg(channelName);
699
699
  this.error = err(channelName);
700
700
  }
@@ -704,13 +704,16 @@ var Logger = class {
704
704
  // src/components/ResizeObserver/index.tsx
705
705
  var React = __toModule(require("react"));
706
706
  var import_react = __toModule(require("react"));
707
- var setupResizeObserver = (node, callback) => {
707
+ var setupResizeObserver = (node, callback, config = { debounce: 0 }) => {
708
+ var _a;
709
+ const debounceTime = (_a = config.debounce) != null ? _a : 0;
708
710
  const RO = window.ResizeObserver;
711
+ const onResizeCallback = debounceTime ? debounce(callback, { wait: debounceTime }) : callback;
709
712
  const observer = new RO((entries) => {
710
- var _a;
713
+ var _a2;
711
714
  const entry = entries[0];
712
715
  let { width, height } = entry.contentRect;
713
- if ((_a = entry.borderBoxSize) == null ? void 0 : _a[0]) {
716
+ if ((_a2 = entry.borderBoxSize) == null ? void 0 : _a2[0]) {
714
717
  height = entry.borderBoxSize[0].blockSize;
715
718
  width = entry.borderBoxSize[0].inlineSize;
716
719
  } else {
@@ -718,14 +721,17 @@ var setupResizeObserver = (node, callback) => {
718
721
  height = rect.height;
719
722
  width = rect.width;
720
723
  }
721
- callback({ width, height });
724
+ onResizeCallback({ width, height });
722
725
  });
723
726
  observer.observe(node);
724
727
  return () => {
725
728
  observer.disconnect();
726
729
  };
727
730
  };
728
- var useResizeObserver = (ref, callback, config = { earlyAttach: false }) => {
731
+ var useResizeObserver = (ref, callback, config = {
732
+ earlyAttach: false,
733
+ debounce: 0
734
+ }) => {
729
735
  const sizeRef = (0, import_react.useRef)({
730
736
  width: 0,
731
737
  height: 0
@@ -743,7 +749,7 @@ var useResizeObserver = (ref, callback, config = { earlyAttach: false }) => {
743
749
  sizeRef.current = size;
744
750
  callback2(size);
745
751
  }
746
- });
752
+ }, { debounce: config.debounce });
747
753
  }
748
754
  return () => {
749
755
  if (disconnect) {
@@ -757,7 +763,7 @@ var useResizeObserver = (ref, callback, config = { earlyAttach: false }) => {
757
763
  }
758
764
  return () => {
759
765
  };
760
- }, [ref.current, callback, config.earlyAttach]);
766
+ }, [ref.current, callback, config.earlyAttach, config.debounce]);
761
767
  (0, import_react.useLayoutEffect)(() => {
762
768
  if (config.earlyAttach) {
763
769
  return effectFn(callback);
@@ -892,8 +898,8 @@ function SpacePlaceholderFn(props) {
892
898
  };
893
899
  return /* @__PURE__ */ React5.createElement("div", {
894
900
  "data-count": count,
895
- "data-placeholder-width": true ? width : void 0,
896
- "data-placeholder-height": true ? height : void 0,
901
+ "data-placeholder-width": false ? width : void 0,
902
+ "data-placeholder-height": false ? height : void 0,
897
903
  "data-name": "SpacePlaceholder",
898
904
  style
899
905
  });
@@ -1080,6 +1086,73 @@ var cancelRaf = getGlobal().cancelAnimationFrame || ((timeoutId) => {
1080
1086
  return clearTimeout(timeoutId);
1081
1087
  });
1082
1088
 
1089
+ // src/utils/stripVar.ts
1090
+ function stripVar(cssVariableWithVarString) {
1091
+ return cssVariableWithVarString.slice(4, -1);
1092
+ }
1093
+
1094
+ // src/components/InfiniteTable/theme.css.ts
1095
+ 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)" };
1096
+ 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)" } } };
1097
+ var columnHeaderHeightName = "column-header-height";
1098
+
1099
+ // src/utils/selectParent.ts
1100
+ function selectParent(el, selector) {
1101
+ let node = el;
1102
+ if (node && node.matches(selector)) {
1103
+ return node;
1104
+ }
1105
+ while (node = node.parentElement) {
1106
+ if (node.matches(selector)) {
1107
+ return node;
1108
+ }
1109
+ }
1110
+ return null;
1111
+ }
1112
+
1113
+ // src/components/InfiniteTable/internalProps.ts
1114
+ var rootClassName2 = "Infinite";
1115
+ var internalProps = {
1116
+ rootClassName: rootClassName2
1117
+ };
1118
+
1119
+ // src/components/InfiniteTable/utils/infiniteDOMUtils.ts
1120
+ var InfiniteSelector = `.${internalProps.rootClassName}`;
1121
+ function getParentInfiniteNode(node) {
1122
+ return selectParent(node, InfiniteSelector);
1123
+ }
1124
+ var columnWidthAtIndex = stripVar(InternalVars.columnWidthAtIndex);
1125
+ var columnOffsetAtIndex = stripVar(InternalVars.columnOffsetAtIndex);
1126
+ function setInfiniteVarOnRoot(varName, varValue, node) {
1127
+ const infinite = node ? getParentInfiniteNode(node) : document.querySelector(InfiniteSelector);
1128
+ setInfiniteVarOnNode(varName, varValue, infinite);
1129
+ }
1130
+ function setInfiniteVarOnNode(varName, varValue, node) {
1131
+ if (node) {
1132
+ const prop = InternalVars[varName] ? stripVar(InternalVars[varName]) : varName;
1133
+ node.style.setProperty(prop, `${varValue}`);
1134
+ }
1135
+ }
1136
+ function setInfiniteVarsOnNode(vars, node) {
1137
+ if (node) {
1138
+ for (var varName in vars) {
1139
+ node.style.setProperty(InternalVars[varName] ? stripVar(InternalVars[varName]) : varName, `${vars[varName]}`);
1140
+ }
1141
+ }
1142
+ }
1143
+ function setInfiniteColumnWidth(colIndex, colWidth, node) {
1144
+ setInfiniteVarOnRoot(`${columnWidthAtIndex}-${colIndex}`, typeof colWidth === "number" ? colWidth + "px" : colWidth, node);
1145
+ }
1146
+ function setInfiniteColumnOffset(colIndex, colOffset, node) {
1147
+ setInfiniteVarOnRoot(`${columnOffsetAtIndex}-${colIndex}`, typeof colOffset === "number" ? colOffset + "px" : colOffset, node);
1148
+ }
1149
+ function getCSSVarNameForColWidth(colIndex) {
1150
+ return `${columnWidthAtIndex}-${colIndex}`;
1151
+ }
1152
+ function getCSSVarNameForColOffset(colIndex) {
1153
+ return `${columnOffsetAtIndex}-${colIndex}`;
1154
+ }
1155
+
1083
1156
  // src/components/VirtualBrain/MatrixBrain.ts
1084
1157
  var import_binary_search = __toModule(require_binary_search());
1085
1158
  var getRenderRangeCellCount = (range) => {
@@ -1115,13 +1188,13 @@ var MatrixBrain = class extends Logger {
1115
1188
  this.extraSpanCells = [];
1116
1189
  this.scrollPosition = { scrollLeft: 0, scrollTop: 0 };
1117
1190
  this.onScrollFns = [];
1118
- this.onRenderRangeChangeFns = [];
1119
- this.onVerticalRenderRangeChangeFns = [];
1120
- this.onHorizontalRenderRangeChangeFns = [];
1191
+ this.onRenderRangeChangeFns = new Set();
1192
+ this.onVerticalRenderRangeChangeFns = new Set();
1193
+ this.onHorizontalRenderRangeChangeFns = new Set();
1121
1194
  this.onDestroyFns = [];
1122
1195
  this.destroyed = false;
1123
- this.onRenderCountChangeFns = [];
1124
- this.onAvailableSizeChangeFns = [];
1196
+ this.onRenderCountChangeFns = new Set();
1197
+ this.onAvailableSizeChangeFns = new Set();
1125
1198
  this.onScrollStartFns = [];
1126
1199
  this.onScrollStopFns = [];
1127
1200
  this.scrollTimeoutId = 0;
@@ -1166,7 +1239,7 @@ var MatrixBrain = class extends Logger {
1166
1239
  if (colWidthDefined) {
1167
1240
  this.colWidth = colWidth;
1168
1241
  }
1169
- if (true) {
1242
+ if (false) {
1170
1243
  if (widthChanged) {
1171
1244
  this.debug("New available width %d (size is %d,%d)", this.width, this.width, this.height);
1172
1245
  }
@@ -1246,12 +1319,18 @@ var MatrixBrain = class extends Logger {
1246
1319
  }
1247
1320
  };
1248
1321
  this.notifyScrollStart = () => {
1322
+ if (this.destroyed) {
1323
+ return;
1324
+ }
1249
1325
  const fns = this.onScrollStartFns;
1250
1326
  for (let i = 0, len = fns.length; i < len; i++) {
1251
1327
  fns[i]();
1252
1328
  }
1253
1329
  };
1254
1330
  this.notifyScrollStop = () => {
1331
+ if (this.destroyed) {
1332
+ return;
1333
+ }
1255
1334
  const fns = this.onScrollStopFns;
1256
1335
  const scrollPos = this.scrollPosition;
1257
1336
  const range = this.getRenderRange();
@@ -1274,40 +1353,72 @@ var MatrixBrain = class extends Logger {
1274
1353
  }
1275
1354
  };
1276
1355
  this.notifyAvailableSizeChange = () => {
1356
+ if (this.destroyed) {
1357
+ return;
1358
+ }
1277
1359
  const fns = this.onAvailableSizeChangeFns;
1278
1360
  const range = this.getAvailableSize();
1279
- for (let i = 0, len = fns.length; i < len; i++) {
1361
+ fns.forEach((fn) => {
1280
1362
  raf2(() => {
1281
- fns[i](range);
1363
+ if (this.destroyed) {
1364
+ return;
1365
+ }
1366
+ if (fns.has(fn)) {
1367
+ fn(range);
1368
+ }
1282
1369
  });
1283
- }
1370
+ });
1284
1371
  };
1285
1372
  this.notifyRenderRangeChange = () => {
1373
+ if (this.destroyed) {
1374
+ return;
1375
+ }
1286
1376
  const fns = this.onRenderRangeChangeFns;
1287
1377
  const range = this.getRenderRange();
1288
- for (let i = 0, len = fns.length; i < len; i++) {
1378
+ fns.forEach((fn) => {
1289
1379
  raf2(() => {
1290
- fns[i](range);
1380
+ if (this.destroyed) {
1381
+ return;
1382
+ }
1383
+ if (fns.has(fn)) {
1384
+ fn(range);
1385
+ }
1291
1386
  });
1292
- }
1387
+ });
1293
1388
  };
1294
1389
  this.notifyVerticalRenderRangeChange = () => {
1390
+ if (this.destroyed) {
1391
+ return;
1392
+ }
1295
1393
  const fns = this.onVerticalRenderRangeChangeFns;
1296
1394
  const range = this.verticalRenderRange;
1297
- for (let i = 0, len = fns.length; i < len; i++) {
1395
+ fns.forEach((fn) => {
1298
1396
  raf2(() => {
1299
- fns[i]([range.startIndex, range.endIndex]);
1397
+ if (this.destroyed) {
1398
+ return;
1399
+ }
1400
+ if (fns.has(fn)) {
1401
+ fn([range.startIndex, range.endIndex]);
1402
+ }
1300
1403
  });
1301
- }
1404
+ });
1302
1405
  };
1303
1406
  this.notifyHorizontalRenderRangeChange = () => {
1407
+ if (this.destroyed) {
1408
+ return;
1409
+ }
1304
1410
  const fns = this.onHorizontalRenderRangeChangeFns;
1305
1411
  const range = this.horizontalRenderRange;
1306
- for (let i = 0, len = fns.length; i < len; i++) {
1412
+ fns.forEach((fn) => {
1307
1413
  raf2(() => {
1308
- fns[i]([range.startIndex, range.endIndex]);
1414
+ if (this.destroyed) {
1415
+ return;
1416
+ }
1417
+ if (fns.has(fn)) {
1418
+ fn([range.startIndex, range.endIndex]);
1419
+ }
1309
1420
  });
1310
- }
1421
+ });
1311
1422
  };
1312
1423
  this.computeDirectionalRenderCount = (direction, itemSize, count, theSize) => {
1313
1424
  let renderCount = 0;
@@ -1319,11 +1430,11 @@ var MatrixBrain = class extends Logger {
1319
1430
  sizes.push(this.getItemSize(i, direction));
1320
1431
  }
1321
1432
  sizes.sort(SORT_ASC);
1322
- let sum = 0;
1433
+ let sum2 = 0;
1323
1434
  for (let i = 0; i < count; i++) {
1324
- sum += sizes[i];
1435
+ sum2 += sizes[i];
1325
1436
  renderCount++;
1326
- if (sum > size) {
1437
+ if (sum2 > size) {
1327
1438
  break;
1328
1439
  }
1329
1440
  }
@@ -1338,11 +1449,11 @@ var MatrixBrain = class extends Logger {
1338
1449
  if (!this.fixedColsEnd) {
1339
1450
  return 0;
1340
1451
  }
1341
- let sum = 0;
1452
+ let sum2 = 0;
1342
1453
  for (let i = this.cols - this.fixedColsEnd; i < this.cols; i++) {
1343
- sum += this.getColWidth(i);
1454
+ sum2 += this.getColWidth(i);
1344
1455
  }
1345
- return sum;
1456
+ return sum2;
1346
1457
  };
1347
1458
  this.getFixedEndColsOffsets = () => {
1348
1459
  if (!this.fixedColsEnd) {
@@ -1352,19 +1463,19 @@ var MatrixBrain = class extends Logger {
1352
1463
  const { width } = this.getAvailableSize();
1353
1464
  const offsets = [];
1354
1465
  const widths = [];
1355
- let sum = 0;
1466
+ let sum2 = 0;
1356
1467
  for (let colIndex = this.cols - this.fixedColsEnd; colIndex < this.cols; colIndex++) {
1357
1468
  const colWidth = this.getColWidth(colIndex);
1358
1469
  widths.push(colWidth);
1359
- sum += colWidth;
1470
+ sum2 += colWidth;
1360
1471
  }
1361
- const baseOffset = width - sum + scrollLeft;
1362
- sum = 0;
1472
+ const baseOffset = width - sum2 + scrollLeft;
1473
+ sum2 = 0;
1363
1474
  let index = 0;
1364
1475
  for (let colIndex = this.cols - this.fixedColsEnd; colIndex < this.cols; colIndex++) {
1365
- const offset = baseOffset + sum;
1476
+ const offset = baseOffset + sum2;
1366
1477
  offsets[colIndex] = offset;
1367
- sum += widths[index];
1478
+ sum2 += widths[index];
1368
1479
  index++;
1369
1480
  }
1370
1481
  return offsets;
@@ -1377,19 +1488,19 @@ var MatrixBrain = class extends Logger {
1377
1488
  const { height } = this.getAvailableSize();
1378
1489
  const offsets = [];
1379
1490
  const heights = [];
1380
- let sum = 0;
1491
+ let sum2 = 0;
1381
1492
  for (let rowIndex = this.rows - this.fixedRowsEnd; rowIndex < this.rows; rowIndex++) {
1382
1493
  const rowHeight = this.getRowHeight(rowIndex);
1383
1494
  heights.push(rowHeight);
1384
- sum += rowHeight;
1495
+ sum2 += rowHeight;
1385
1496
  }
1386
- const baseOffset = height - sum + scrollTop;
1387
- sum = 0;
1497
+ const baseOffset = height - sum2 + scrollTop;
1498
+ sum2 = 0;
1388
1499
  let index = 0;
1389
1500
  for (let rowIndex = this.rows - this.fixedRowsEnd; rowIndex < this.rows; rowIndex++) {
1390
- const offset = baseOffset + sum;
1501
+ const offset = baseOffset + sum2;
1391
1502
  offsets[rowIndex] = offset;
1392
- sum += heights[index];
1503
+ sum2 += heights[index];
1393
1504
  index++;
1394
1505
  }
1395
1506
  return offsets;
@@ -1398,31 +1509,31 @@ var MatrixBrain = class extends Logger {
1398
1509
  if (!this.fixedColsStart) {
1399
1510
  return 0;
1400
1511
  }
1401
- let sum = 0;
1512
+ let sum2 = 0;
1402
1513
  for (let i = 0; i < this.fixedColsStart; i++) {
1403
- sum += this.getColWidth(i);
1514
+ sum2 += this.getColWidth(i);
1404
1515
  }
1405
- return sum;
1516
+ return sum2;
1406
1517
  };
1407
1518
  this.getFixedEndRowsHeight = () => {
1408
1519
  if (!this.fixedRowsEnd) {
1409
1520
  return 0;
1410
1521
  }
1411
- let sum = 0;
1522
+ let sum2 = 0;
1412
1523
  for (let i = this.rows - this.fixedRowsEnd; i < this.rows; i++) {
1413
- sum += this.getRowHeight(i);
1524
+ sum2 += this.getRowHeight(i);
1414
1525
  }
1415
- return sum;
1526
+ return sum2;
1416
1527
  };
1417
1528
  this.getFixedStartRowsHeight = () => {
1418
1529
  if (!this.fixedRowsStart) {
1419
1530
  return 0;
1420
1531
  }
1421
- let sum = 0;
1532
+ let sum2 = 0;
1422
1533
  for (let i = 0; i < this.fixedRowsStart; i++) {
1423
- sum += this.getRowHeight(i);
1534
+ sum2 += this.getRowHeight(i);
1424
1535
  }
1425
- return sum;
1536
+ return sum2;
1426
1537
  };
1427
1538
  this.computeRenderCount = (which = ALL_DIRECTIONS) => {
1428
1539
  const recomputeHorizontal = which.horizontal;
@@ -1660,7 +1771,7 @@ var MatrixBrain = class extends Logger {
1660
1771
  if (cache[i] === void 0) {
1661
1772
  cell[direction === "horizontal" ? "colIndex" : "rowIndex"] = i;
1662
1773
  let spanValue = itemSpan(cell);
1663
- if (spanValue < 1) {
1774
+ if (false) {
1664
1775
  this.debug(`${direction === "horizontal" ? "colspan" : "rowspan"} cannot be less than 1 - got %d for index %d`, spanValue, i);
1665
1776
  }
1666
1777
  cache[i] = i;
@@ -1853,33 +1964,33 @@ var MatrixBrain = class extends Logger {
1853
1964
  };
1854
1965
  };
1855
1966
  this.onRenderRangeChange = (fn) => {
1856
- this.onRenderRangeChangeFns.push(fn);
1967
+ this.onRenderRangeChangeFns.add(fn);
1857
1968
  return () => {
1858
- this.onRenderRangeChangeFns = this.onRenderRangeChangeFns.filter((f) => f !== fn);
1969
+ this.onRenderRangeChangeFns.delete(fn);
1859
1970
  };
1860
1971
  };
1861
1972
  this.onVerticalRenderRangeChange = (fn) => {
1862
- this.onVerticalRenderRangeChangeFns.push(fn);
1973
+ this.onVerticalRenderRangeChangeFns.add(fn);
1863
1974
  return () => {
1864
- this.onVerticalRenderRangeChangeFns = this.onVerticalRenderRangeChangeFns.filter((f) => f !== fn);
1975
+ this.onVerticalRenderRangeChangeFns.delete(fn);
1865
1976
  };
1866
1977
  };
1867
1978
  this.onHorizontalRenderRangeChange = (fn) => {
1868
- this.onHorizontalRenderRangeChangeFns.push(fn);
1979
+ this.onHorizontalRenderRangeChangeFns.add(fn);
1869
1980
  return () => {
1870
- this.onHorizontalRenderRangeChangeFns = this.onHorizontalRenderRangeChangeFns.filter((f) => f !== fn);
1981
+ this.onHorizontalRenderRangeChangeFns.delete(fn);
1871
1982
  };
1872
1983
  };
1873
1984
  this.onRenderCountChange = (fn) => {
1874
- this.onRenderCountChangeFns.push(fn);
1985
+ this.onRenderCountChangeFns.add(fn);
1875
1986
  return () => {
1876
- this.onRenderCountChangeFns = this.onRenderCountChangeFns.filter((f) => f !== fn);
1987
+ this.onRenderCountChangeFns.delete(fn);
1877
1988
  };
1878
1989
  };
1879
1990
  this.onAvailableSizeChange = (fn) => {
1880
- this.onAvailableSizeChangeFns.push(fn);
1991
+ this.onAvailableSizeChangeFns.add(fn);
1881
1992
  return () => {
1882
- this.onAvailableSizeChangeFns = this.onAvailableSizeChangeFns.filter((f) => f !== fn);
1993
+ this.onAvailableSizeChangeFns.delete(fn);
1883
1994
  };
1884
1995
  };
1885
1996
  this.onDestroy = (fn) => {
@@ -1907,10 +2018,10 @@ var MatrixBrain = class extends Logger {
1907
2018
  this.onScrollFns = [];
1908
2019
  this.onScrollStartFns = [];
1909
2020
  this.onScrollStopFns = [];
1910
- this.onRenderCountChangeFns = [];
1911
- this.onRenderRangeChangeFns = [];
1912
- this.onVerticalRenderRangeChangeFns = [];
1913
- this.onHorizontalRenderRangeChangeFns = [];
2021
+ this.onRenderCountChangeFns = new Set();
2022
+ this.onRenderRangeChangeFns = new Set();
2023
+ this.onVerticalRenderRangeChangeFns = new Set();
2024
+ this.onHorizontalRenderRangeChangeFns = new Set();
1914
2025
  };
1915
2026
  this.reset();
1916
2027
  }
@@ -1956,14 +2067,14 @@ var MatrixBrain = class extends Logger {
1956
2067
  let { width, height } = size;
1957
2068
  width = width != null ? width : this.width;
1958
2069
  height = height != null ? height : this.height;
1959
- const widthSame = size.width === this.width;
1960
- const heightSame = size.height === this.height;
2070
+ const widthSame = width === this.width;
2071
+ const heightSame = height === this.height;
1961
2072
  if (widthSame && heightSame) {
1962
2073
  return;
1963
2074
  }
1964
2075
  this.width = width;
1965
2076
  this.height = height;
1966
- if (true) {
2077
+ if (false) {
1967
2078
  this.debug("New available size: width %d, height %d", this.width, this.height);
1968
2079
  }
1969
2080
  this.notifyAvailableSizeChange();
@@ -1981,6 +2092,9 @@ var MatrixBrain = class extends Logger {
1981
2092
  return totalSize.width - this.width;
1982
2093
  }
1983
2094
  notifyScrollChange() {
2095
+ if (this.destroyed) {
2096
+ return;
2097
+ }
1984
2098
  const { scrollPosition } = this;
1985
2099
  const fns = this.onScrollFns;
1986
2100
  for (let i = 0, len = fns.length; i < len; i++) {
@@ -1997,17 +2111,25 @@ var MatrixBrain = class extends Logger {
1997
2111
  return direction === "horizontal" ? this.getFixedEndColsWidth() : this.getFixedEndRowsHeight();
1998
2112
  }
1999
2113
  notifyRenderCountChange() {
2114
+ if (this.destroyed) {
2115
+ return;
2116
+ }
2000
2117
  const { horizontalRenderCount, verticalRenderCount } = this;
2001
2118
  const renderCount = {
2002
2119
  horizontal: horizontalRenderCount,
2003
2120
  vertical: verticalRenderCount
2004
2121
  };
2005
2122
  const fns = this.onRenderCountChangeFns;
2006
- for (let i = 0, len = fns.length; i < len; i++) {
2123
+ fns.forEach((fn) => {
2007
2124
  raf2(() => {
2008
- fns[i](renderCount);
2125
+ if (this.destroyed) {
2126
+ return;
2127
+ }
2128
+ if (fns.has(fn)) {
2129
+ fn(renderCount);
2130
+ }
2009
2131
  });
2010
- }
2132
+ });
2011
2133
  }
2012
2134
  getItemSizeCacheFor(itemIndex, direction) {
2013
2135
  return (direction === "horizontal" ? this.colWidthCache : this.rowHeightCache)[itemIndex];
@@ -2430,7 +2552,7 @@ var MappedCells = class extends Logger {
2430
2552
  return elementIndex != null ? elementIndex : null;
2431
2553
  };
2432
2554
  this.renderCellAtElement = (rowIndex, colIndex, elementIndex, renderNode) => {
2433
- if (true) {
2555
+ if (false) {
2434
2556
  this.debug(`Render cell ${rowIndex},${colIndex} at element ${elementIndex}`);
2435
2557
  }
2436
2558
  const key = [rowIndex, colIndex];
@@ -2501,18 +2623,31 @@ var MappedCells = class extends Logger {
2501
2623
 
2502
2624
  // src/components/HeadlessTable/ReactHeadlessTableRenderer.tsx
2503
2625
  var ITEM_POSITION_WITH_TRANSFORM = true;
2626
+ var currentColumnTransformY = stripVar(InternalVars.currentColumnTransformY);
2627
+ var columnTransformX = stripVar(InternalVars.columnOffsetAtIndex);
2504
2628
  var ReactHeadlessTableRenderer = class extends Logger {
2505
2629
  constructor(brain) {
2506
2630
  super("ReactHeadlessTableRenderer");
2507
2631
  this.destroyed = false;
2508
2632
  this.scrolling = false;
2509
2633
  this.cellHoverClassNames = [];
2634
+ this.name = "";
2510
2635
  this.itemDOMElements = [];
2511
2636
  this.itemDOMRefs = [];
2512
2637
  this.updaters = [];
2513
2638
  this.items = [];
2514
2639
  this.currentHoveredRow = -1;
2515
2640
  this.hoverRowUpdatesInProgress = new Map();
2641
+ this.infiniteNode = null;
2642
+ this.setTransform = (element, _rowIndex, colIndex, x, y) => {
2643
+ const transformXVar = `${columnTransformX}-${colIndex}`;
2644
+ if (!this.infiniteNode) {
2645
+ this.infiniteNode = getParentInfiniteNode(element);
2646
+ }
2647
+ this.infiniteNode.style.setProperty(transformXVar, `${x}px`);
2648
+ element.style.setProperty(currentColumnTransformY, `${y}px`);
2649
+ element.style.transform = `translate3d(var(${transformXVar}), ${InternalVars.currentColumnTransformY}, 0)`;
2650
+ };
2516
2651
  this.getFullyVisibleRowsRange = () => {
2517
2652
  let {
2518
2653
  start: [startRow],
@@ -2696,7 +2831,7 @@ var ReactHeadlessTableRenderer = class extends Logger {
2696
2831
  return [];
2697
2832
  }
2698
2833
  const { start, end } = range;
2699
- if (true) {
2834
+ if (false) {
2700
2835
  this.debug(`Render range ${start}-${end}. Force ${force}`);
2701
2836
  }
2702
2837
  const { mappedCells } = this;
@@ -2709,13 +2844,13 @@ var ReactHeadlessTableRenderer = class extends Logger {
2709
2844
  extraCellsMap.set(`${rowIndex}:${colIndex}`, true);
2710
2845
  });
2711
2846
  }
2712
- const renderCount = ranges.reduce((sum, range2) => sum + getRenderRangeCellCount(range2), 0);
2847
+ const renderCount = ranges.reduce((sum2, range2) => sum2 + getRenderRangeCellCount(range2), 0);
2713
2848
  if (this.itemDOMElements.length >= renderCount) {
2714
2849
  mappedCells.discardElementsStartingWith(renderCount, (elementIndex) => {
2715
2850
  if (this.updaters[elementIndex]) {
2716
2851
  this.updaters[elementIndex].destroy();
2717
2852
  }
2718
- if (true) {
2853
+ if (false) {
2719
2854
  this.debug(`Discard element ${elementIndex}`);
2720
2855
  }
2721
2856
  });
@@ -2767,7 +2902,7 @@ var ReactHeadlessTableRenderer = class extends Logger {
2767
2902
  }
2768
2903
  const elementIndex = cellRendered ? mappedCells.getElementIndexForCell(row, col) : mappedCells.getElementFromListForColumn(elementsOutsideItemRange, col);
2769
2904
  if (elementIndex == null) {
2770
- if (true) {
2905
+ if (false) {
2771
2906
  this.error(`Cannot find element to render cell ${row}:${col}`);
2772
2907
  }
2773
2908
  continue;
@@ -2786,7 +2921,7 @@ var ReactHeadlessTableRenderer = class extends Logger {
2786
2921
  }
2787
2922
  const elementIndex = elementsOutsideItemRange.pop();
2788
2923
  if (elementIndex == null) {
2789
- if (true) {
2924
+ if (false) {
2790
2925
  this.error(`Cannot find element to render cell ${rowIndex}-${colIndex}`);
2791
2926
  }
2792
2927
  return;
@@ -2963,6 +3098,9 @@ var ReactHeadlessTableRenderer = class extends Logger {
2963
3098
  if (this.scrolling) {
2964
3099
  return;
2965
3100
  }
3101
+ if (false) {
3102
+ return;
3103
+ }
2966
3104
  if (this.hoverRowUpdatesInProgress.has(rowIndex)) {
2967
3105
  return;
2968
3106
  }
@@ -2978,6 +3116,9 @@ var ReactHeadlessTableRenderer = class extends Logger {
2978
3116
  };
2979
3117
  raf(() => {
2980
3118
  checkHoverClass();
3119
+ if (false) {
3120
+ return;
3121
+ }
2981
3122
  this.hoverRowUpdatesInProgress.delete(rowIndex);
2982
3123
  });
2983
3124
  };
@@ -2985,7 +3126,7 @@ var ReactHeadlessTableRenderer = class extends Logger {
2985
3126
  const itemElement = this.itemDOMElements[elementIndex];
2986
3127
  const cell = this.mappedCells.getRenderedCellAtElement(elementIndex);
2987
3128
  if (cell == null) {
2988
- if (true) {
3129
+ if (false) {
2989
3130
  this.error(`Cannot find item for element ${elementIndex}`);
2990
3131
  }
2991
3132
  return;
@@ -2998,16 +3139,14 @@ var ReactHeadlessTableRenderer = class extends Logger {
2998
3139
  const { x, y } = itemPosition;
2999
3140
  if (itemElement) {
3000
3141
  this.updateHoverClassNamesForRow(rowIndex);
3001
- if (true) {
3002
- itemElement.dataset.rowIndex = rowIndex;
3003
- itemElement.dataset.colIndex = colIndex;
3004
- }
3142
+ itemElement.dataset.rowIndex = rowIndex;
3143
+ itemElement.dataset.colIndex = colIndex;
3005
3144
  if (ITEM_POSITION_WITH_TRANSFORM) {
3006
- itemElement.style.transform = `translate3d(${x}px, ${y}px, 0)`;
3145
+ this.setTransform(itemElement, rowIndex, colIndex, x, y);
3007
3146
  itemElement.style.willChange = "transform";
3008
3147
  itemElement.style.backfaceVisibility = "hidden";
3009
3148
  const hidden = options ? options.hidden : !!this.isCellCovered(rowIndex, colIndex);
3010
- itemElement.style.zIndex = hidden ? "-1" : "auto";
3149
+ itemElement.style.zIndex = hidden ? "-1" : itemElement.dataset.zIndex || "auto";
3011
3150
  } else {
3012
3151
  itemElement.style.display = "";
3013
3152
  itemElement.style.left = `${x}px`;
@@ -3048,39 +3187,39 @@ var ReactHeadlessTableRenderer = class extends Logger {
3048
3187
  fn(rowIndex, colIndex, node, itemPosition, scrollPosition);
3049
3188
  }
3050
3189
  }
3051
- function adjustColStart(_rowIndex, colIndex, node, { x, y }, { scrollLeft }) {
3190
+ const adjustColStart = (_rowIndex, colIndex, node, { x, y }, { scrollLeft }) => {
3052
3191
  node.style.zIndex = `${fixedColsStart - colIndex}`;
3053
- node.style.transform = `translate3d(${x + scrollLeft}px, ${y}px, 0)`;
3054
- }
3055
- function adjustRowStart(rowIndex, _colIndex, node, coords, scrollPosition2) {
3192
+ this.setTransform(node, _rowIndex, colIndex, x + scrollLeft, y);
3193
+ };
3194
+ const adjustRowStart = (rowIndex, _colIndex, node, coords, scrollPosition2) => {
3056
3195
  node.style.zIndex = `${fixedRowsStart - rowIndex}`;
3057
- node.style.transform = `translate3d(${coords.x}px, ${coords.y + scrollPosition2.scrollTop}px, 0)`;
3058
- }
3059
- function adjustColEnd(_rowIndex, colIndex, node, { y }) {
3196
+ this.setTransform(node, rowIndex, _colIndex, coords.x, coords.y + scrollPosition2.scrollTop);
3197
+ };
3198
+ const adjustColEnd = (_rowIndex, colIndex, node, { y }) => {
3060
3199
  node.style.zIndex = `${cols - colIndex}`;
3061
3200
  const val = fixedEndColsOffsets[colIndex];
3062
- node.style.transform = `translate3d(${val}px, ${y}px, 0)`;
3063
- }
3064
- function adjustRowEnd(rowIndex, _colIndex, node, coords) {
3201
+ this.setTransform(node, _rowIndex, colIndex, val, y);
3202
+ };
3203
+ const adjustRowEnd = (rowIndex, _colIndex, node, coords) => {
3065
3204
  node.style.zIndex = `${rows - rowIndex}`;
3066
- node.style.transform = `translate3d(${coords.x}px, ${fixedEndRowsOffsets[rowIndex]}px, 0)`;
3067
- }
3068
- function adjustColStartRowStart(_rowIndex, _colIndex, node, { x, y }, scrollPosition2) {
3069
- node.style.zIndex = `10000`;
3070
- node.style.transform = `translate3d(${x + scrollPosition2.scrollLeft}px, ${y + scrollPosition2.scrollTop}px, 0)`;
3071
- }
3072
- function adjustColStartRowEnd(_rowIndex, _colIndex, node, { x }, scrollPosition2) {
3073
- node.style.zIndex = `20000`;
3074
- node.style.transform = `translate3d(${x + scrollPosition2.scrollLeft}px, ${fixedEndRowsOffsets[_rowIndex]}px, 0)`;
3075
- }
3076
- function adjustColEndRowStart(_rowIndex, colIndex, node, coords) {
3077
- node.style.zIndex = `30000`;
3078
- node.style.transform = `translate3d(${fixedEndColsOffsets[colIndex]}px, ${coords.y + scrollPosition.scrollTop}px, 0)`;
3079
- }
3080
- function adjustColEndRowEnd(rowIndex, colIndex, node) {
3081
- node.style.zIndex = `40000`;
3082
- node.style.transform = `translate3d(${fixedEndColsOffsets[colIndex]}px, ${fixedEndRowsOffsets[rowIndex]}px, 0)`;
3083
- }
3205
+ this.setTransform(node, rowIndex, _colIndex, coords.x, fixedEndRowsOffsets[rowIndex]);
3206
+ };
3207
+ const adjustColStartRowStart = (_rowIndex, _colIndex, node, { x, y }, scrollPosition2) => {
3208
+ node.style.zIndex = `1000000`;
3209
+ this.setTransform(node, _rowIndex, _colIndex, x + scrollPosition2.scrollLeft, y + scrollPosition2.scrollTop);
3210
+ };
3211
+ const adjustColStartRowEnd = (_rowIndex, _colIndex, node, { x }, scrollPosition2) => {
3212
+ node.style.zIndex = `2000000`;
3213
+ this.setTransform(node, _rowIndex, _colIndex, x + scrollPosition2.scrollLeft, fixedEndRowsOffsets[_rowIndex]);
3214
+ };
3215
+ const adjustColEndRowStart = (_rowIndex, colIndex, node, coords) => {
3216
+ node.style.zIndex = `3000000`;
3217
+ this.setTransform(node, _rowIndex, colIndex, fixedEndColsOffsets[colIndex], coords.y + scrollPosition.scrollTop);
3218
+ };
3219
+ const adjustColEndRowEnd = (rowIndex, colIndex, node) => {
3220
+ node.style.zIndex = `4000000`;
3221
+ this.setTransform(node, rowIndex, colIndex, fixedEndColsOffsets[colIndex], fixedEndRowsOffsets[rowIndex]);
3222
+ };
3084
3223
  if (fixedColsStart || fixedColsEnd) {
3085
3224
  for (let rowIndex = startRow; rowIndex < endRow; rowIndex++) {
3086
3225
  for (let colIndex = 0; colIndex < fixedColsStart; colIndex++) {
@@ -3141,6 +3280,9 @@ var ReactHeadlessTableRenderer = class extends Logger {
3141
3280
  }
3142
3281
  };
3143
3282
  this.destroy = () => {
3283
+ if (this.destroyed) {
3284
+ return;
3285
+ }
3144
3286
  this.destroyed = true;
3145
3287
  this.reset();
3146
3288
  this.onDestroy();
@@ -3222,7 +3364,7 @@ var ReactHeadlessTableRenderer = class extends Logger {
3222
3364
  return;
3223
3365
  }
3224
3366
  this.mappedCells.renderCellAtElement(rowIndex, colIndex, elementIndex, renderedNode);
3225
- if (true) {
3367
+ if (false) {
3226
3368
  this.debug(`Render cell ${rowIndex},${colIndex} at element ${elementIndex}`);
3227
3369
  }
3228
3370
  itemUpdater(renderedNode);
@@ -3308,14 +3450,12 @@ var useRerender = () => {
3308
3450
  ];
3309
3451
  };
3310
3452
 
3311
- // src/components/InfiniteTable/internalProps.ts
3312
- var rootClassName2 = "Infinite";
3313
- var internalProps = {
3314
- rootClassName: rootClassName2
3315
- };
3453
+ // src/components/InfiniteTable/components/ActiveCellIndicator.css.ts
3454
+ var ActiveCellIndicatorCls = { visible: "nxbq1c2 nxbq1c1 _16lm1iwf _16lm1iw3 _16lm1iwx _16lm1iwv", hidden: "nxbq1c3 nxbq1c1 _16lm1iwf _16lm1iw3 _16lm1iwx _16lm1iwv" };
3455
+ var ActiveIndicatorWrapperCls = "_16lm1iwf _16lm1iw3 _16lm1iwx _16lm1iwv _16lm1iwr";
3316
3456
 
3317
3457
  // src/components/InfiniteTable/components/ActiveRowIndicator.css.ts
3318
- var ActiveRowIndicatorCls = { visible: "j26lrx1 j26lrx0 _16lm1iwe _16lm1iw3 _16lm1iwt _16lm1iwu _16lm1iww", hidden: "j26lrx2 j26lrx0 _16lm1iwe _16lm1iw3 _16lm1iwt _16lm1iwu _16lm1iww" };
3458
+ var ActiveRowIndicatorCls = { visible: "j26lrx1 j26lrx0 _16lm1iwf _16lm1iw3 _16lm1iwu _16lm1iwv _16lm1iwx", hidden: "j26lrx2 j26lrx0 _16lm1iwf _16lm1iw3 _16lm1iwu _16lm1iwv _16lm1iwx" };
3319
3459
 
3320
3460
  // src/components/InfiniteTable/components/ActiveRowIndicator.tsx
3321
3461
  var { rootClassName: rootClassName3 } = internalProps;
@@ -3352,6 +3492,9 @@ var ActiveRowIndicatorFn = (props) => {
3352
3492
  };
3353
3493
  }, [brain]);
3354
3494
  return /* @__PURE__ */ React10.createElement("div", {
3495
+ className: ActiveIndicatorWrapperCls,
3496
+ "data-name": "active-row"
3497
+ }, /* @__PURE__ */ React10.createElement("div", {
3355
3498
  ref: domRef,
3356
3499
  "data-name": "active-row-indicator",
3357
3500
  className: `${baseCls} ${active ? ActiveRowIndicatorCls.visible : ActiveRowIndicatorCls.hidden}`,
@@ -3359,74 +3502,62 @@ var ActiveRowIndicatorFn = (props) => {
3359
3502
  transform: `translate3d(0px, ${-brain.getScrollPosition().scrollTop + state.top}px,0)`,
3360
3503
  height: state.rowHeight
3361
3504
  } : void 0
3362
- });
3505
+ }));
3363
3506
  };
3364
3507
  var ActiveRowIndicator = React10.memo(ActiveRowIndicatorFn);
3365
3508
 
3366
3509
  // src/components/InfiniteTable/components/ActiveCellIndicator.tsx
3367
3510
  var React11 = __toModule(require("react"));
3368
3511
  var import_react10 = __toModule(require("react"));
3369
-
3370
- // src/components/InfiniteTable/components/ActiveCellIndicator.css.ts
3371
- var ActiveCellIndicatorCls = { visible: "nxbq1c1 nxbq1c0 _16lm1iwe _16lm1iw3 _16lm1iww _16lm1iwu", hidden: "nxbq1c2 nxbq1c0 _16lm1iwe _16lm1iw3 _16lm1iww _16lm1iwu" };
3372
-
3373
- // src/components/InfiniteTable/components/ActiveCellIndicator.tsx
3374
3512
  var { rootClassName: rootClassName4 } = internalProps;
3375
3513
  var baseCls2 = `${rootClassName4}-ActiveCellIndicator`;
3514
+ var ActiveStyle = {
3515
+ [stripVar(InternalVars.activeCellOffsetX)]: `calc( ${InternalVars.scrollLeftForActiveCell} + ${InternalVars.activeCellColOffset} )`,
3516
+ [stripVar(InternalVars.activeCellOffsetY)]: `calc( ${InternalVars.scrollTopForActiveCell} + ${InternalVars.activeCellRowOffset} )`,
3517
+ transform: `translate3d(${InternalVars.activeCellOffsetX}, ${InternalVars.activeCellOffsetY}, 0px)`,
3518
+ width: InternalVars.activeCellColWidth,
3519
+ height: InternalVars.activeCellRowHeight
3520
+ };
3376
3521
  var ActiveCellIndicatorFn = (props) => {
3377
3522
  const { brain } = props;
3378
- const [rerenderId, rerender] = useRerender();
3379
- const [state, setState] = (0, import_react10.useState)({
3380
- top: 0,
3381
- rowHeight: 0,
3382
- colWidth: 0,
3383
- left: 0
3384
- });
3385
3523
  const domRef = (0, import_react10.useRef)(null);
3386
- const stateRef = (0, import_react10.useRef)(state);
3387
3524
  const active = props.activeCellIndex != null && brain.getRowCount() > props.activeCellIndex[0];
3388
3525
  (0, import_react10.useLayoutEffect)(() => {
3389
3526
  if (props.activeCellIndex == null) {
3390
3527
  return;
3391
3528
  }
3392
3529
  const rowIndex = props.activeCellIndex[0];
3393
- setState(stateRef.current = {
3394
- top: brain.getItemOffsetFor(rowIndex, "vertical"),
3395
- rowHeight: brain.getRowHeight(rowIndex),
3396
- left: brain.getItemOffsetFor(props.activeCellIndex[1], "horizontal"),
3397
- colWidth: brain.getColWidth(props.activeCellIndex[1])
3398
- });
3399
- }, [props.activeCellIndex, rerenderId]);
3530
+ const activeCellRowHeight = brain.getRowHeight(rowIndex);
3531
+ const activeCellRowOffset = brain.getItemOffsetFor(rowIndex, "vertical");
3532
+ const node = domRef.current;
3533
+ const scrollPosition = brain.getScrollPosition();
3534
+ setInfiniteVarsOnNode({
3535
+ scrollTopForActiveCell: `${-scrollPosition.scrollTop}px`,
3536
+ scrollLeftForActiveCell: `${-scrollPosition.scrollLeft}px`,
3537
+ activeCellRowHeight: `${activeCellRowHeight}px`,
3538
+ activeCellRowOffset: `${activeCellRowOffset}px`
3539
+ }, node);
3540
+ }, [props.activeCellIndex]);
3400
3541
  (0, import_react10.useEffect)(() => {
3401
- const removeOnSCroll = brain.onScroll((scrollPos) => {
3402
- const node = domRef.current;
3403
- const topOffset = stateRef.current.top;
3404
- const leftOffset = stateRef.current.left;
3405
- node.style.transform = `translate3d(${-scrollPos.scrollLeft + leftOffset}px, ${-scrollPos.scrollTop + topOffset}px, 0px)`;
3406
- });
3407
- const removeOnRenderCountChange = brain.onRenderCountChange(() => {
3408
- rerender();
3409
- });
3410
- const removeOnAvailableSizeChange = brain.onAvailableSizeChange(() => {
3411
- rerender();
3542
+ const removeOnSCroll = brain.onScroll((scrollPosition) => {
3543
+ setInfiniteVarsOnNode({
3544
+ scrollTopForActiveCell: `${-scrollPosition.scrollTop}px`,
3545
+ scrollLeftForActiveCell: `${-scrollPosition.scrollLeft}px`
3546
+ }, domRef.current);
3412
3547
  });
3413
3548
  return () => {
3414
- removeOnAvailableSizeChange();
3415
- removeOnRenderCountChange();
3416
3549
  removeOnSCroll();
3417
3550
  };
3418
3551
  }, [brain]);
3419
- const scrollPosition = brain.getScrollPosition();
3420
3552
  return /* @__PURE__ */ React11.createElement("div", {
3553
+ className: ActiveIndicatorWrapperCls,
3554
+ "data-name": "active-cell"
3555
+ }, /* @__PURE__ */ React11.createElement("div", {
3421
3556
  ref: domRef,
3422
3557
  "data-name": "active-cell-indicator",
3423
3558
  className: `${baseCls2} ${active ? ActiveCellIndicatorCls.visible : ActiveCellIndicatorCls.hidden}`,
3424
- style: active ? {
3425
- transform: `translate3d(${-scrollPosition.scrollLeft + state.left}px, ${-scrollPosition.scrollTop + state.top}px,0)`,
3426
- width: state.colWidth,
3427
- height: state.rowHeight
3428
- } : void 0
3429
- });
3559
+ style: active ? ActiveStyle : void 0
3560
+ }));
3430
3561
  };
3431
3562
  var ActiveCellIndicator = React11.memo(ActiveCellIndicatorFn);
3432
3563
 
@@ -3496,7 +3627,7 @@ function HeadlessTable(props) {
3496
3627
  };
3497
3628
  brain.update(size);
3498
3629
  };
3499
- const remove = setupResizeObserver(node, onResize);
3630
+ const remove = setupResizeObserver(node, onResize, { debounce: 50 });
3500
3631
  return remove;
3501
3632
  }, []);
3502
3633
  const onContainerScroll = (0, import_react11.useCallback)((scrollPos) => {
@@ -3823,6 +3954,12 @@ function getComponentStateRoot(config) {
3823
3954
  }
3824
3955
  }
3825
3956
  });
3957
+ (0, import_react14.useEffect)(() => {
3958
+ return () => {
3959
+ var _a2;
3960
+ (_a2 = config.cleanup) == null ? void 0 : _a2.call(config, getComponentState());
3961
+ };
3962
+ }, []);
3826
3963
  return /* @__PURE__ */ React13.createElement(Context.Provider, {
3827
3964
  value: contextValue
3828
3965
  }, props.children);
@@ -3842,45 +3979,45 @@ var useInternalProps = () => {
3842
3979
  };
3843
3980
 
3844
3981
  // src/components/InfiniteTable/utilities.css.ts
3845
- var alignItems = { center: "_16lm1iw14", stretch: "_16lm1iw15" };
3846
- var cssEllipsisClassName = "_16lm1iw1d _16lm1iw1e _16lm1iw19";
3847
- var cursor = { pointer: "_16lm1iwd" };
3848
- var display = { flex: "_16lm1iwm", block: "_16lm1iwn", inlineBlock: "_16lm1iwo" };
3849
- var flex = { "1": "_16lm1iwf", none: "_16lm1iwg" };
3850
- var flexFlow = { column: "_16lm1iw12", row: "_16lm1iw13" };
3851
- var justifyContent = { center: "_16lm1iw16", start: "_16lm1iw17", end: "_16lm1iw18" };
3852
- var left = { "0": "_16lm1iww", "100%": "_16lm1iwx" };
3853
- var overflow = { hidden: "_16lm1iw19", auto: "_16lm1iw1a", visible: "_16lm1iw1b" };
3982
+ var alignItems = { center: "_16lm1iw15", stretch: "_16lm1iw16" };
3983
+ var cssEllipsisClassName = "_16lm1iw1e _16lm1iw1f _16lm1iw1a";
3984
+ var cursor = { pointer: "_16lm1iwd", colResize: "_16lm1iwe" };
3985
+ var display = { flex: "_16lm1iwn", block: "_16lm1iwo", inlineBlock: "_16lm1iwp" };
3986
+ var flex = { "1": "_16lm1iwg", none: "_16lm1iwh" };
3987
+ var flexFlow = { column: "_16lm1iw13", row: "_16lm1iw14" };
3988
+ var justifyContent = { center: "_16lm1iw17", start: "_16lm1iw18", end: "_16lm1iw19" };
3989
+ var left = { "0": "_16lm1iwx", "100%": "_16lm1iwy" };
3990
+ var overflow = { hidden: "_16lm1iw1a", auto: "_16lm1iw1b", visible: "_16lm1iw1c" };
3854
3991
  var position = { relative: "_16lm1iw1", absolute: "_16lm1iw2", sticky: "_16lm1iw3", fixed: "_16lm1iw4" };
3855
- var top = { "0": "_16lm1iwu", "100%": "_16lm1iwv" };
3992
+ var top = { "0": "_16lm1iwv", "100%": "_16lm1iww" };
3856
3993
  var transformTranslateZero = "_16lm1iwa";
3857
- var userSelect = { none: "_16lm1iwp" };
3858
- var zIndex = { "1": "_16lm1iwh", "10": "_16lm1iwi", "1000": "_16lm1iwj", "10000": "_16lm1iwk", "100000": "_16lm1iwl" };
3994
+ var userSelect = { none: "_16lm1iwq" };
3995
+ var zIndex = { "1": "_16lm1iwi", "10": "_16lm1iwj", "1000": "_16lm1iwk", "10000": "_16lm1iwl", "100000": "_16lm1iwm" };
3859
3996
 
3860
3997
  // src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx
3861
3998
  var InfiniteTableBody = React14.forwardRef(function InfiniteTableBody2(props, ref) {
3862
- const { rootClassName: rootClassName11 } = useInternalProps();
3999
+ const { rootClassName: rootClassName13 } = useInternalProps();
3863
4000
  return /* @__PURE__ */ React14.createElement("div", __spreadProps(__spreadValues({
3864
4001
  ref
3865
4002
  }, props), {
3866
- className: join(`${rootClassName11}Body`, position.relative, flex["1"], transformTranslateZero, props.className)
4003
+ className: join(`${rootClassName13}Body`, position.relative, flex["1"], transformTranslateZero, props.className)
3867
4004
  }));
3868
4005
  });
3869
4006
 
3870
4007
  // src/components/InfiniteTable/components/InfiniteTableFooter/InfiniteTableFooter.tsx
3871
4008
  var React15 = __toModule(require("react"));
3872
4009
  var InfiniteTableFooter = React15.forwardRef(function InfiniteTableFooter2(props, ref) {
3873
- const { rootClassName: rootClassName11 } = useInternalProps();
4010
+ const { rootClassName: rootClassName13 } = useInternalProps();
3874
4011
  return /* @__PURE__ */ React15.createElement("div", __spreadProps(__spreadValues({
3875
4012
  ref
3876
4013
  }, props), {
3877
- className: join(`${rootClassName11}Footer`, position.relative, display.flex, flexFlow.row, props.className)
4014
+ className: join(`${rootClassName13}Footer`, position.relative, display.flex, flexFlow.row, props.className)
3878
4015
  }));
3879
4016
  });
3880
4017
 
3881
4018
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
3882
- var React20 = __toModule(require("react"));
3883
- var import_react22 = __toModule(require("react"));
4019
+ var React22 = __toModule(require("react"));
4020
+ var import_react24 = __toModule(require("react"));
3884
4021
  var import_react_dom = __toModule(require("react-dom"));
3885
4022
 
3886
4023
  // src/components/DataSource/defaultFilterTypes.ts
@@ -4040,7 +4177,6 @@ var useColumnPointerEvents = ({
4040
4177
  const [draggingDiff, setDraggingDiff] = (0, import_react17.useState)(null);
4041
4178
  const [proxyOffset, setProxyOffset] = (0, import_react17.useState)(null);
4042
4179
  const breakpointsRef = (0, import_react17.useRef)([]);
4043
- const pointerMoveRef = (0, import_react17.useRef)(null);
4044
4180
  const didDragRef = (0, import_react17.useRef)(false);
4045
4181
  const initialClientPos = (0, import_react17.useRef)(null);
4046
4182
  const currentDropIndexRef = (0, import_react17.useRef)(null);
@@ -4116,35 +4252,40 @@ var useColumnPointerEvents = ({
4116
4252
  }
4117
4253
  setDraggingDiff({ left: diffX, top: diffY });
4118
4254
  };
4119
- pointerMoveRef.current = onPointerMove;
4255
+ const onPointerUp = (e2) => {
4256
+ const target2 = domRef.current;
4257
+ target2.style.cursor = cursorRef.current;
4258
+ target2.releasePointerCapture(e2.pointerId);
4259
+ target2.removeEventListener("pointermove", onPointerMove);
4260
+ target2.removeEventListener("pointerup", onPointerUp);
4261
+ setDraggingDiff(null);
4262
+ componentActions.columnShifts = null;
4263
+ componentActions.draggingColumnId = null;
4264
+ if (!didDragRef.current && column.computedSortable) {
4265
+ column.toggleSort();
4266
+ }
4267
+ const dropIndex = currentDropIndexRef.current;
4268
+ if (dropIndex != null && dropIndex !== columnIndex) {
4269
+ const newOrder = moveXatY(computedColumnOrder, columnIndex, dropIndex > columnIndex ? dropIndex - 1 : dropIndex);
4270
+ componentActions.columnOrder = newOrder;
4271
+ }
4272
+ breakpointsRef.current = [];
4273
+ didDragRef.current = false;
4274
+ initialClientPos.current = null;
4275
+ currentDropIndexRef.current = null;
4276
+ };
4120
4277
  target.addEventListener("pointermove", onPointerMove);
4278
+ target.addEventListener("pointerup", onPointerUp);
4121
4279
  target.setPointerCapture(e.pointerId);
4122
- }, [columns, column, columnIndex, columnsArray, computedRemainingSpace]);
4123
- const onPointerUp = (0, import_react17.useCallback)((e) => {
4124
- const target = domRef.current;
4125
- target.style.cursor = cursorRef.current;
4126
- target.releasePointerCapture(e.pointerId);
4127
- target.removeEventListener("pointermove", pointerMoveRef.current);
4128
- setDraggingDiff(null);
4129
- componentActions.columnShifts = null;
4130
- componentActions.draggingColumnId = null;
4131
- if (!didDragRef.current && column.computedSortable) {
4132
- column.toggleSort();
4133
- }
4134
- const dropIndex = currentDropIndexRef.current;
4135
- if (dropIndex != null && dropIndex !== columnIndex) {
4136
- const newOrder = moveXatY(computedColumnOrder, columnIndex, dropIndex > columnIndex ? dropIndex - 1 : dropIndex);
4137
- componentActions.columnOrder = newOrder;
4138
- }
4139
- breakpointsRef.current = [];
4140
- pointerMoveRef.current = null;
4141
- didDragRef.current = false;
4142
- initialClientPos.current = null;
4143
- currentDropIndexRef.current = null;
4144
- }, [column, columnIndex, componentActions, computedColumnOrder]);
4280
+ }, [
4281
+ columns,
4282
+ column,
4283
+ columnIndex,
4284
+ columnsArray,
4285
+ computedRemainingSpace,
4286
+ computedColumnOrder
4287
+ ]);
4145
4288
  return {
4146
- onPointerUp: column.computedDraggable ? onPointerUp : () => {
4147
- },
4148
4289
  onPointerDown: column.computedDraggable ? onPointerDown : () => {
4149
4290
  },
4150
4291
  dragging,
@@ -4201,19 +4342,19 @@ var import_react19 = __toModule(require("react"));
4201
4342
 
4202
4343
  // src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts
4203
4344
  var import_createRuntimeFn = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
4204
- var CellCls = "_1eexc2a5 _16lm1iwm _16lm1iw13 _16lm1iw14 _16lm1iw2 _16lm1iw1c _16lm1iw1d";
4205
- var HeaderCellContentRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_12zfob117 _16lm1iwr _16lm1iwt _16lm1iwm _16lm1iw13 _16lm1iw14", variantClassNames: { filtered: { false: "_12zfob118", true: "_12zfob119" } }, defaultVariants: {}, compoundVariants: [] });
4345
+ var CellCls = "_1eexc2a5 _16lm1iwn _16lm1iw14 _16lm1iw15 _16lm1iw2 _16lm1iw1d _16lm1iw1e";
4346
+ var HeaderCellContentRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_12zfob117 _16lm1iws _16lm1iwu _16lm1iwn _16lm1iw14 _16lm1iw15", variantClassNames: { filtered: { false: "_12zfob118", true: "_12zfob119" } }, defaultVariants: {}, compoundVariants: [] });
4206
4347
  var HeaderCellProxy = "_12zfob10";
4207
- 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"]] });
4208
- 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"]] });
4209
- var HeaderFilterCls = "_12zfob11c _16lm1iwm _16lm1iw13 _16lm1iw14 _16lm1iw1";
4210
- var HeaderFilterEditorCls = "_16lm1iwt _16lm1iwr";
4211
- var HeaderGroupCls = "_12zfob11b _16lm1iwm _16lm1iw13 _16lm1iw14";
4348
+ 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"]] });
4349
+ 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"]] });
4350
+ var HeaderFilterCls = "_12zfob11c _16lm1iwn _16lm1iw14 _16lm1iw15 _16lm1iw1";
4351
+ var HeaderFilterEditorCls = "_16lm1iwu _16lm1iws";
4352
+ var HeaderGroupCls = "_12zfob11b _16lm1iwn _16lm1iw14 _16lm1iw15";
4212
4353
  var HeaderScrollbarPlaceholderCls = "_12zfob16 _16lm1iw2";
4213
4354
  var HeaderSortIconCls = "_16lm1iw1";
4214
4355
  var HeaderSortIconIndexCls = "_12zfob15";
4215
4356
  var HeaderSortIconRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "", variantClassNames: { align: { start: "_12zfob12", center: "_12zfob13", end: "_12zfob14" } }, defaultVariants: {}, compoundVariants: [] });
4216
- var HeaderWrapperCls = "_12zfob11a _16lm1iw19 _16lm1iw1 _16lm1iwm _16lm1iw13";
4357
+ var HeaderWrapperCls = "_12zfob11a _16lm1iw1a _16lm1iw1 _16lm1iwn _16lm1iw14";
4217
4358
 
4218
4359
  // src/components/InfiniteTable/components/icons/SortIcon.tsx
4219
4360
  var defaultLineStyle = {
@@ -4300,20 +4441,20 @@ var useInfiniteTableState = () => {
4300
4441
  // src/components/InfiniteTable/components/cell.css.ts
4301
4442
  var import_createRuntimeFn2 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
4302
4443
  var CellClsVariants = { shifting: "_1eexc2a3", dragging: "_1eexc2a4" };
4303
- var ColumnCellCls = "_1eexc2a5 _16lm1iwm _16lm1iw13 _16lm1iw14 _16lm1iw2 _16lm1iw1c _16lm1iw1d";
4444
+ var ColumnCellCls = "_1eexc2a5 _16lm1iwn _16lm1iw14 _16lm1iw15 _16lm1iw2 _16lm1iw1d _16lm1iw1e";
4304
4445
  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"]] });
4305
4446
 
4306
4447
  // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
4307
4448
  var { rootClassName: rootClassName5 } = internalProps;
4308
4449
  var InfiniteTableCellClassName = `${rootClassName5}Cell`;
4309
4450
  var InfiniteTableCellContentClassName = `${rootClassName5}Cell_content`;
4451
+ var columnWidthAtIndex2 = stripVar(InternalVars.columnWidthAtIndex);
4310
4452
  function InfiniteTableCellFn(props) {
4311
4453
  var _b, _c, _d;
4312
4454
  const _a = props, {
4313
4455
  cssEllipsis = true,
4314
4456
  virtualized = true,
4315
4457
  skipColumnShifting = false,
4316
- offsetProperty = "left",
4317
4458
  contentStyle,
4318
4459
  column,
4319
4460
  domRef,
@@ -4321,7 +4462,6 @@ function InfiniteTableCellFn(props) {
4321
4462
  contentClassName,
4322
4463
  afterChildren,
4323
4464
  beforeChildren,
4324
- offset,
4325
4465
  cellType,
4326
4466
  cssPosition: _cssPosition,
4327
4467
  renderChildren
@@ -4329,7 +4469,6 @@ function InfiniteTableCellFn(props) {
4329
4469
  "cssEllipsis",
4330
4470
  "virtualized",
4331
4471
  "skipColumnShifting",
4332
- "offsetProperty",
4333
4472
  "contentStyle",
4334
4473
  "column",
4335
4474
  "domRef",
@@ -4337,7 +4476,6 @@ function InfiniteTableCellFn(props) {
4337
4476
  "contentClassName",
4338
4477
  "afterChildren",
4339
4478
  "beforeChildren",
4340
- "offset",
4341
4479
  "cellType",
4342
4480
  "cssPosition",
4343
4481
  "renderChildren"
@@ -4346,10 +4484,10 @@ function InfiniteTableCellFn(props) {
4346
4484
  const { columnShifts } = useInfiniteTableState();
4347
4485
  const shifting = !!columnShifts;
4348
4486
  const style = __spreadValues({
4349
- width
4487
+ width: `var(${columnWidthAtIndex2}-${column.computedVisibleIndex})`
4350
4488
  }, domProps.style);
4351
4489
  if (!skipColumnShifting && columnShifts && columnShifts[column.computedVisibleIndex]) {
4352
- const shiftLeft = columnShifts[column.computedVisibleIndex] + (offset != null ? offset : 0);
4490
+ const shiftLeft = columnShifts[column.computedVisibleIndex];
4353
4491
  if (virtualized) {
4354
4492
  style.left = shiftLeft;
4355
4493
  } else {
@@ -4431,10 +4569,542 @@ function InfiniteTableColumnHeaderFilterEmpty() {
4431
4569
  });
4432
4570
  }
4433
4571
 
4434
- // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
4435
- var InfiniteTableHeaderCellContext = React20.createContext(null);
4572
+ // src/components/InfiniteTable/components/InfiniteTableHeader/useColumnResizeHandle.tsx
4573
+ var React21 = __toModule(require("react"));
4574
+ var import_react23 = __toModule(require("react"));
4575
+
4576
+ // src/components/flexbox/index.ts
4577
+ var computeFlex = (params) => {
4578
+ const {
4579
+ availableSize,
4580
+ items,
4581
+ minSize: defaultMinSize,
4582
+ maxSize: defaultMaxSize
4583
+ } = params;
4584
+ if (availableSize < 0) {
4585
+ throw "The provided availableSize cannot be negative!";
4586
+ }
4587
+ let totalFixedSize = 0;
4588
+ let totalFlex = 0;
4589
+ let totalFlexCount = 0;
4590
+ const minSizes = [];
4591
+ const maxSizes = [];
4592
+ items.forEach((item, i) => {
4593
+ var _a, _b, _c, _d, _e;
4594
+ let maxSize = (_b = (_a = item.maxSize) != null ? _a : defaultMaxSize) != null ? _b : void 0;
4595
+ let minSize = (_d = (_c = item.minSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
4596
+ minSizes.push(minSize);
4597
+ maxSizes.push(maxSize);
4598
+ if (item.size != null) {
4599
+ if (maxSize != null && item.size > maxSize) {
4600
+ item.size = maxSize;
4601
+ }
4602
+ if (minSize != null && item.size < minSize) {
4603
+ item.size = minSize;
4604
+ }
4605
+ }
4606
+ const itemFlex = item.flex == 0 ? null : item.flex;
4607
+ if (item.size == null && itemFlex == null) {
4608
+ throw `Items must specify either a size or a flex property. Item at index ${i} doesn't have either of those.`;
4609
+ }
4610
+ if (itemFlex != null) {
4611
+ totalFlexCount += 1;
4612
+ }
4613
+ totalFlex += itemFlex != null ? itemFlex : 0;
4614
+ totalFixedSize += (_e = item.size) != null ? _e : 0;
4615
+ });
4616
+ let availableSizeForFlex = Math.max(availableSize - totalFixedSize, 0);
4617
+ let sizePerFlex = availableSizeForFlex / totalFlex;
4618
+ let maxxedFlexItems = {};
4619
+ let minnedFlexItems = {};
4620
+ let constrainedCount = 0;
4621
+ items.forEach((item, index) => {
4622
+ var _a, _b, _c, _d;
4623
+ if (item.flex != null) {
4624
+ const approxFlexSize = sizePerFlex * item.flex;
4625
+ let maxSize = (_b = (_a = item.maxSize) != null ? _a : defaultMaxSize) != null ? _b : void 0;
4626
+ let minSize = (_d = (_c = item.minSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
4627
+ let constrained = false;
4628
+ let substractSize = 0;
4629
+ if (maxSize != null && approxFlexSize > maxSize) {
4630
+ maxxedFlexItems[index] = true;
4631
+ constrained = true;
4632
+ substractSize = maxSize;
4633
+ }
4634
+ if (minSize != null && approxFlexSize < minSize) {
4635
+ minnedFlexItems[index] = true;
4636
+ constrained = true;
4637
+ substractSize = minSize;
4638
+ }
4639
+ if (constrained) {
4640
+ constrainedCount += 1;
4641
+ totalFlexCount -= 1;
4642
+ totalFlex -= item.flex;
4643
+ availableSizeForFlex -= substractSize;
4644
+ }
4645
+ }
4646
+ });
4647
+ if (constrainedCount) {
4648
+ sizePerFlex = availableSizeForFlex / totalFlex;
4649
+ }
4650
+ let flexSizes = [];
4651
+ let currentFlexCount = 0;
4652
+ let remainingSizeForFlex = availableSizeForFlex;
4653
+ let remainingFlex = totalFlex;
4654
+ let totalTakenSize = 0;
4655
+ let flexSizeSum = 0;
4656
+ const computedSizes = [];
4657
+ const resultItems = items.map((item, index) => {
4658
+ var _a, _b, _c, _d, _e;
4659
+ const sizedItem = __spreadValues({}, item);
4660
+ let maxSize = (_b = (_a = item.maxSize) != null ? _a : defaultMaxSize) != null ? _b : void 0;
4661
+ let minSize = (_d = (_c = item.minSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
4662
+ let flexSize = 0;
4663
+ const maxxed = maxxedFlexItems[index];
4664
+ const minned = minnedFlexItems[index];
4665
+ const constrained = maxxed || minned;
4666
+ let computedSize = (_e = item.size) != null ? _e : 0;
4667
+ if (item.flex != null) {
4668
+ if (constrained) {
4669
+ if (minned) {
4670
+ flexSize = minSize;
4671
+ }
4672
+ if (maxxed) {
4673
+ flexSize = maxSize;
4674
+ }
4675
+ } else {
4676
+ currentFlexCount += 1;
4677
+ const constrain = (size) => {
4678
+ if (maxSize != null && size > maxSize) {
4679
+ size = maxSize;
4680
+ }
4681
+ if (minSize != null && size < minSize) {
4682
+ size = minSize;
4683
+ }
4684
+ return size;
4685
+ };
4686
+ if (currentFlexCount === totalFlexCount) {
4687
+ flexSize = constrain(remainingSizeForFlex);
4688
+ } else {
4689
+ flexSize = constrain(Math.round(item.flex * sizePerFlex));
4690
+ flexSizeSum += flexSize;
4691
+ remainingSizeForFlex = availableSizeForFlex - flexSizeSum;
4692
+ remainingFlex -= item.flex;
4693
+ sizePerFlex = remainingSizeForFlex / remainingFlex;
4694
+ }
4695
+ }
4696
+ computedSize = flexSize;
4697
+ sizedItem.flexSize = flexSize;
4698
+ }
4699
+ flexSizes.push(flexSize);
4700
+ computedSizes.push(computedSize);
4701
+ sizedItem.computedSize = computedSize;
4702
+ totalTakenSize += computedSize;
4703
+ return sizedItem;
4704
+ });
4705
+ return {
4706
+ items: resultItems,
4707
+ flexSizes,
4708
+ minSizes,
4709
+ maxSizes,
4710
+ computedSizes,
4711
+ remainingSize: Math.round(availableSize - totalTakenSize)
4712
+ };
4713
+ };
4714
+ function resizeClamp(value, min, max, direction) {
4715
+ if (min != null && value <= min) {
4716
+ return { value: min, clamped: "min", diff: (value - min) * direction };
4717
+ }
4718
+ if (max != null && value >= max) {
4719
+ return { value: max, clamped: "max", diff: (max - value) * direction };
4720
+ }
4721
+ return { value, clamped: false, diff: 0 };
4722
+ }
4723
+ var computeResize = (params) => {
4724
+ const { availableSize, reservedWidth = 0 } = params;
4725
+ const columnSizing = Object.keys(params.columnSizing).reduce((acc, key) => {
4726
+ acc[key] = __spreadValues({}, params.columnSizing[key]);
4727
+ return acc;
4728
+ }, {});
4729
+ if (availableSize < 0) {
4730
+ throw "The provided availableSize cannot be negative!";
4731
+ }
4732
+ let dragHandleOffset = params.dragHandleOffset;
4733
+ const firstIndex = params.dragHandlePositionAfter;
4734
+ const secondIndex = params.dragHandlePositionAfter + 1;
4735
+ const firstItem = params.items[firstIndex];
4736
+ const secondItem = params.items[secondIndex];
4737
+ const firstId = firstItem.id;
4738
+ const secondId = secondItem == null ? void 0 : secondItem.id;
4739
+ const firstSize = firstItem.computedWidth;
4740
+ const firstMinSize = firstItem.computedMinWidth;
4741
+ const firstMaxSize = firstItem.computedMaxWidth;
4742
+ const firstPropertyToAdjust = firstItem.computedFlex ? "flex" : "width";
4743
+ const secondSize = secondItem == null ? void 0 : secondItem.computedWidth;
4744
+ const secondMinSize = secondItem == null ? void 0 : secondItem.computedMinWidth;
4745
+ const secondMaxSize = secondItem == null ? void 0 : secondItem.computedMaxWidth;
4746
+ const secondPropertyToAdjust = (secondItem == null ? void 0 : secondItem.computedFlex) ? "flex" : "width";
4747
+ let maxReached = false;
4748
+ let minReached = false;
4749
+ const direction = dragHandleOffset > 0 ? 1 : -1;
4750
+ let {
4751
+ value: firstAdjustedSize,
4752
+ clamped: firstClamped,
4753
+ diff: firstDiff
4754
+ } = resizeClamp(firstSize + dragHandleOffset, firstMinSize, firstMaxSize, direction);
4755
+ if (params.shareSpaceOnResize) {
4756
+ if (secondItem == null) {
4757
+ columnSizing[firstId] = __spreadProps(__spreadValues({}, columnSizing[firstId]), {
4758
+ [firstPropertyToAdjust]: firstAdjustedSize
4759
+ });
4760
+ minReached = firstClamped === "min";
4761
+ maxReached = firstClamped === "max";
4762
+ const adjustedDiff2 = firstAdjustedSize - firstSize;
4763
+ return {
4764
+ adjustedDiff: adjustedDiff2,
4765
+ reservedWidth,
4766
+ columnSizing,
4767
+ minReached,
4768
+ maxReached,
4769
+ constrained: minReached || maxReached
4770
+ };
4771
+ }
4772
+ let {
4773
+ value: secondAdjustedSize,
4774
+ clamped: secondClamped,
4775
+ diff: secondDiff
4776
+ } = resizeClamp(secondSize - dragHandleOffset, secondMinSize, secondMaxSize, direction);
4777
+ if (firstClamped && secondClamped) {
4778
+ if (Math.abs(firstDiff) > Math.abs(secondDiff)) {
4779
+ secondClamped = false;
4780
+ } else {
4781
+ firstClamped = false;
4782
+ }
4783
+ }
4784
+ if (!firstClamped && !secondClamped) {
4785
+ } else if (firstClamped) {
4786
+ const clampResultForSecond = resizeClamp(secondSize - dragHandleOffset - firstDiff, secondMinSize, secondMaxSize, direction);
4787
+ secondAdjustedSize = clampResultForSecond.value;
4788
+ secondClamped = clampResultForSecond.clamped;
4789
+ secondDiff = clampResultForSecond.diff;
4790
+ } else if (secondClamped) {
4791
+ const clampResultForFirst = resizeClamp(firstSize + dragHandleOffset + secondDiff, firstMinSize, firstMaxSize, direction);
4792
+ firstAdjustedSize = clampResultForFirst.value;
4793
+ firstClamped = clampResultForFirst.clamped;
4794
+ firstDiff = clampResultForFirst.diff;
4795
+ }
4796
+ columnSizing[firstId] = __spreadProps(__spreadValues({}, columnSizing[firstId]), {
4797
+ [firstPropertyToAdjust]: firstAdjustedSize
4798
+ });
4799
+ columnSizing[secondId] = __spreadProps(__spreadValues({}, columnSizing[secondId]), {
4800
+ [secondPropertyToAdjust]: secondAdjustedSize
4801
+ });
4802
+ minReached = firstClamped === "min" || secondClamped === "min";
4803
+ maxReached = firstClamped === "max" || secondClamped === "max";
4804
+ } else {
4805
+ columnSizing[firstId] = __spreadProps(__spreadValues({}, columnSizing[firstId]), {
4806
+ [firstPropertyToAdjust]: firstAdjustedSize
4807
+ });
4808
+ minReached = firstClamped === "min";
4809
+ maxReached = firstClamped === "max";
4810
+ }
4811
+ const adjustedDiff = firstAdjustedSize - firstSize;
4812
+ return {
4813
+ adjustedDiff,
4814
+ reservedWidth: !params.shareSpaceOnResize ? reservedWidth - adjustedDiff : reservedWidth,
4815
+ columnSizing,
4816
+ minReached,
4817
+ maxReached,
4818
+ constrained: minReached || maxReached
4819
+ };
4820
+ };
4821
+ function sum(a, b) {
4822
+ return a + b;
4823
+ }
4824
+ function cloneColumnSizing(columnSizing) {
4825
+ const newColumnSizing = Object.keys(columnSizing).reduce((acc, key) => {
4826
+ acc[key] = __spreadValues({}, columnSizing[key]);
4827
+ return acc;
4828
+ }, {});
4829
+ return newColumnSizing;
4830
+ }
4831
+ var computeGroupResize = (params) => {
4832
+ const { availableSize, reservedWidth = 0 } = params;
4833
+ const columnSizing = Object.keys(params.columnSizing).reduce((acc, key) => {
4834
+ acc[key] = __spreadValues({}, params.columnSizing[key]);
4835
+ return acc;
4836
+ }, {});
4837
+ if (availableSize < 0) {
4838
+ throw "The provided availableSize cannot be negative!";
4839
+ }
4840
+ let dragHandleOffset = params.dragHandleOffset;
4841
+ const beforeIndexes = [...new Array(params.columnGroupSize)].map((_, index) => params.dragHandlePositionAfter - index).reverse();
4842
+ const beforeItems = beforeIndexes.map((i) => params.items[i]);
4843
+ const beforeSizes = beforeItems.map((item) => item.computedWidth);
4844
+ const beforePropertiesToAdjust = beforeItems.map((item) => item.computedFlex ? "flex" : "width");
4845
+ let unresizableWidth = 0;
4846
+ const { computedSizes } = computeFlex({
4847
+ items: beforeItems.map((item) => {
4848
+ if (item.resizable === false) {
4849
+ unresizableWidth += item.computedWidth;
4850
+ }
4851
+ return {
4852
+ flex: item.resizable ? item.computedWidth : null,
4853
+ size: 0
4854
+ };
4855
+ }),
4856
+ availableSize: Math.max(beforeSizes.reduce(sum, 0) + dragHandleOffset - unresizableWidth, 0)
4857
+ });
4858
+ const diffsForEachItem = beforeItems.map((item, index) => {
4859
+ return computedSizes[index] - item.computedWidth;
4860
+ });
4861
+ let groupMinReached = true;
4862
+ let groupMaxReached = true;
4863
+ let groupConstrained = true;
4864
+ const adjustedDiffs = [];
4865
+ diffsForEachItem.forEach((diff, i) => {
4866
+ const item = beforeItems[i];
4867
+ if (!item.resizable) {
4868
+ adjustedDiffs.push(0);
4869
+ return;
4870
+ }
4871
+ const propertyToAdjust = beforePropertiesToAdjust[i];
4872
+ const itemSize = beforeSizes[i];
4873
+ const currentColumnSizing = cloneColumnSizing(columnSizing);
4874
+ const { maxReached, minReached, constrained, adjustedDiff: adjustedDiff2 } = computeResize({
4875
+ availableSize: params.availableSize,
4876
+ reservedWidth: params.reservedWidth,
4877
+ dragHandleOffset: diff,
4878
+ dragHandlePositionAfter: beforeIndexes[i],
4879
+ shareSpaceOnResize: false,
4880
+ items: params.items,
4881
+ columnSizing: currentColumnSizing
4882
+ });
4883
+ columnSizing[item.id] = __spreadProps(__spreadValues({}, currentColumnSizing[item.id]), {
4884
+ [propertyToAdjust]: itemSize + adjustedDiff2
4885
+ });
4886
+ adjustedDiffs.push(adjustedDiff2);
4887
+ if (!maxReached) {
4888
+ groupMaxReached = false;
4889
+ }
4890
+ if (!minReached) {
4891
+ groupMinReached = false;
4892
+ }
4893
+ if (!constrained) {
4894
+ groupConstrained = false;
4895
+ }
4896
+ });
4897
+ const adjustedDiff = adjustedDiffs.reduce(sum, 0);
4898
+ return {
4899
+ minReached: groupMinReached,
4900
+ maxReached: groupMaxReached,
4901
+ constrained: groupConstrained,
4902
+ adjustedDiffs,
4903
+ adjustedDiff,
4904
+ columnSizing,
4905
+ reservedWidth: reservedWidth - adjustedDiff
4906
+ };
4907
+ };
4908
+
4909
+ // src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/index.tsx
4910
+ var import_react22 = __toModule(require("react"));
4911
+
4912
+ // src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/columnResizer.ts
4913
+ function getColumnResizer(colIndex, {
4914
+ columns,
4915
+ shareSpaceOnResize,
4916
+ domRef
4917
+ }) {
4918
+ const column = columns[colIndex];
4919
+ return {
4920
+ resize(diff) {
4921
+ setInfiniteColumnWidth(colIndex, column.computedWidth + diff, domRef.current);
4922
+ const nextColIndex = colIndex + 1;
4923
+ if (shareSpaceOnResize) {
4924
+ const nextColumn = columns[nextColIndex];
4925
+ if (!nextColumn) {
4926
+ return;
4927
+ }
4928
+ setInfiniteColumnWidth(nextColIndex, nextColumn.computedWidth - diff, domRef.current);
4929
+ setInfiniteColumnOffset(nextColIndex, nextColumn.computedOffset + diff, domRef.current);
4930
+ return;
4931
+ }
4932
+ for (let i = nextColIndex, len = columns.length; i < len; i++) {
4933
+ setInfiniteColumnOffset(i, columns[i].computedOffset + diff, domRef.current);
4934
+ }
4935
+ }
4936
+ };
4937
+ }
4938
+ function getColumnGroupResizer(colIndexes, config) {
4939
+ const lastColIndex = colIndexes[colIndexes.length - 1];
4940
+ return {
4941
+ resize(diffs) {
4942
+ const { columns, domRef } = config;
4943
+ let offset = columns[colIndexes[0]].computedOffset;
4944
+ let diffSum = 0;
4945
+ const node = domRef.current;
4946
+ diffs.forEach((diff, i) => {
4947
+ diffSum += diff;
4948
+ const colIndex = colIndexes[i];
4949
+ const column = columns[colIndex];
4950
+ const newWidth = column.computedWidth + diff;
4951
+ setInfiniteColumnWidth(colIndex, newWidth, node);
4952
+ if (offset) {
4953
+ setInfiniteColumnOffset(colIndex, offset, node);
4954
+ }
4955
+ offset += newWidth;
4956
+ });
4957
+ for (let i = lastColIndex + 1; i < columns.length; i++) {
4958
+ setInfiniteColumnOffset(i, columns[i].computedOffset + diffSum, node);
4959
+ }
4960
+ }
4961
+ };
4962
+ }
4963
+
4964
+ // src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/ResizeHandle.css.ts
4965
+ var import_createRuntimeFn3 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
4966
+ var ResizeHandleCls = "zneyzh0 _16lm1iw2 _16lm1iwv _16lm1iw11 _16lm1iwz _16lm1iwe";
4967
+ var ResizeHandleDraggerClsRecipe = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "zneyzh1 _16lm1iw2 _16lm1iwv _16lm1iwz", variantClassNames: { constrained: { false: "zneyzh2", true: "zneyzh3" } }, defaultVariants: {}, compoundVariants: [] });
4968
+
4969
+ // src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/index.tsx
4436
4970
  var { rootClassName: rootClassName7 } = internalProps;
4437
- var InfiniteTableHeaderCellClassName = `${rootClassName7}HeaderCell`;
4971
+ var InfiniteTableHeaderCellResizeHandleCls = `${rootClassName7}HeaderCell_ResizeHandle`;
4972
+ function ResizeHandleFn(props) {
4973
+ const domRef = (0, import_react22.useRef)(null);
4974
+ const [constrained, setConstrained] = (0, import_react22.useState)(false);
4975
+ const constrainedRef = (0, import_react22.useRef)(constrained);
4976
+ constrainedRef.current = constrained;
4977
+ const onPointerDown = (e) => {
4978
+ e.stopPropagation();
4979
+ const shareSpaceOnResize = !!e.shiftKey;
4980
+ const pointerId = e.pointerId;
4981
+ const initialX = e.clientX;
4982
+ const target = e.target;
4983
+ target.setPointerCapture(pointerId);
4984
+ const resizer = getColumnResizer(props.columnIndex, {
4985
+ columns: props.columns,
4986
+ shareSpaceOnResize,
4987
+ domRef
4988
+ });
4989
+ const resizeDiff = (diff) => {
4990
+ const { adjustedDiff, constrained: constrained2 } = props.computeResize({
4991
+ diff,
4992
+ shareSpaceOnResize
4993
+ });
4994
+ if (constrainedRef.current !== constrained2) {
4995
+ setConstrained(constrained2);
4996
+ }
4997
+ resizer.resize(adjustedDiff);
4998
+ return adjustedDiff;
4999
+ };
5000
+ const onPointerMove = (e2) => {
5001
+ resizeDiff(Math.round(e2.clientX - initialX));
5002
+ };
5003
+ const onPointerUp = (e2) => {
5004
+ target.releasePointerCapture(pointerId);
5005
+ target.removeEventListener("pointermove", onPointerMove);
5006
+ target.removeEventListener("pointerup", onPointerUp);
5007
+ const diff = Math.round(e2.clientX - initialX);
5008
+ const adjustedDiff = resizeDiff(diff);
5009
+ props.onResize({ diff: adjustedDiff, shareSpaceOnResize });
5010
+ };
5011
+ target.addEventListener("pointermove", onPointerMove);
5012
+ target.addEventListener("pointerup", onPointerUp);
5013
+ };
5014
+ return /* @__PURE__ */ import_react22.default.createElement("div", {
5015
+ ref: domRef,
5016
+ className: `${InfiniteTableHeaderCellResizeHandleCls} ${ResizeHandleCls}`,
5017
+ onPointerDown
5018
+ }, /* @__PURE__ */ import_react22.default.createElement("div", {
5019
+ className: ResizeHandleDraggerClsRecipe({
5020
+ constrained
5021
+ })
5022
+ }));
5023
+ }
5024
+ var ResizeHandle = import_react22.default.memo(ResizeHandleFn);
5025
+
5026
+ // src/components/InfiniteTable/components/InfiniteTableHeader/useColumnResizeHandle.tsx
5027
+ function useColumnResizeHandle(column) {
5028
+ const {
5029
+ computed: { computedVisibleColumns },
5030
+ componentState: { domRef },
5031
+ getState,
5032
+ getComputed,
5033
+ componentActions
5034
+ } = useInfiniteTable();
5035
+ const computeResizeForDiff = (0, import_react23.useCallback)(({
5036
+ diff,
5037
+ shareSpaceOnResize
5038
+ }) => {
5039
+ const state = getState();
5040
+ const { columnSizing, viewportReservedWidth, bodySize, activeCellIndex } = state;
5041
+ const columns = getComputed().computedVisibleColumns;
5042
+ let atLeastOneFlex = false;
5043
+ const columnSizingWithFlex = columns.reduce((acc, col) => {
5044
+ if (col.computedFlex) {
5045
+ acc[col.id] = { flex: col.computedWidth };
5046
+ atLeastOneFlex = true;
5047
+ }
5048
+ return acc;
5049
+ }, {});
5050
+ const columnSizingForResize = atLeastOneFlex ? __spreadValues(__spreadValues({}, columnSizing), columnSizingWithFlex) : columnSizing;
5051
+ const result = computeResize({
5052
+ shareSpaceOnResize,
5053
+ availableSize: bodySize.width,
5054
+ reservedWidth: viewportReservedWidth || 0,
5055
+ dragHandleOffset: diff,
5056
+ dragHandlePositionAfter: column.computedVisibleIndex,
5057
+ columnSizing: columnSizingForResize,
5058
+ items: columns.map((c) => {
5059
+ return {
5060
+ id: c.id,
5061
+ computedFlex: c.computedFlex,
5062
+ computedWidth: c.computedWidth,
5063
+ computedMinWidth: c.computedMinWidth,
5064
+ computedMaxWidth: c.computedMaxWidth
5065
+ };
5066
+ })
5067
+ });
5068
+ if (activeCellIndex && activeCellIndex[1] >= column.computedVisibleIndex) {
5069
+ const activeColumn = columns[activeCellIndex[1]];
5070
+ const currentColumn = columns[column.computedVisibleIndex];
5071
+ if (activeCellIndex[1] === currentColumn.computedVisibleIndex) {
5072
+ setInfiniteColumnWidth(currentColumn.computedVisibleIndex, currentColumn.computedWidth + result.adjustedDiff, domRef.current);
5073
+ } else if (activeColumn) {
5074
+ setInfiniteColumnOffset(activeColumn.computedVisibleIndex, activeColumn.computedOffset + result.adjustedDiff, domRef.current);
5075
+ }
5076
+ if (shareSpaceOnResize && activeCellIndex[1] === currentColumn.computedVisibleIndex + 1 && activeColumn) {
5077
+ setInfiniteColumnWidth(activeColumn.computedVisibleIndex, activeColumn.computedWidth - result.adjustedDiff, domRef.current);
5078
+ }
5079
+ }
5080
+ return result;
5081
+ }, []);
5082
+ const onColumnResize = (0, import_react23.useCallback)(({
5083
+ diff,
5084
+ shareSpaceOnResize
5085
+ }) => {
5086
+ const { columnSizing, reservedWidth } = computeResizeForDiff({
5087
+ diff,
5088
+ shareSpaceOnResize
5089
+ });
5090
+ if (!shareSpaceOnResize) {
5091
+ componentActions.viewportReservedWidth = reservedWidth;
5092
+ }
5093
+ componentActions.columnSizing = columnSizing;
5094
+ }, []);
5095
+ const resizeHandle = column.computedResizable ? /* @__PURE__ */ React21.createElement(ResizeHandle, {
5096
+ columns: computedVisibleColumns,
5097
+ columnIndex: column.computedVisibleIndex,
5098
+ computeResize: computeResizeForDiff,
5099
+ onResize: onColumnResize
5100
+ }) : null;
5101
+ return resizeHandle;
5102
+ }
5103
+
5104
+ // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
5105
+ var InfiniteTableHeaderCellContext = React22.createContext(null);
5106
+ var { rootClassName: rootClassName8 } = internalProps;
5107
+ var InfiniteTableHeaderCellClassName = `${rootClassName8}HeaderCell`;
4438
5108
  function InfiniteTableHeaderCell(props) {
4439
5109
  var _a, _b, _c, _d, _e;
4440
5110
  const column = props.column;
@@ -4442,13 +5112,13 @@ function InfiniteTableHeaderCell(props) {
4442
5112
  const { onResize, height, width, headerOptions } = props;
4443
5113
  const sortInfo = column.computedSortInfo;
4444
5114
  let header = column.header;
4445
- const ref = (0, import_react22.useCallback)((node) => {
5115
+ const ref = (0, import_react24.useCallback)((node) => {
4446
5116
  var _a2;
4447
5117
  domRef.current = node;
4448
5118
  (_a2 = props.domRef) == null ? void 0 : _a2.call(props, node);
4449
5119
  }, [props.domRef]);
4450
5120
  const alwaysShow = headerOptions.alwaysReserveSpaceForSortIcon;
4451
- const sortTool = column.computedSorted || alwaysShow ? /* @__PURE__ */ React20.createElement(SortIcon, {
5121
+ const sortTool = column.computedSorted || alwaysShow ? /* @__PURE__ */ React22.createElement(SortIcon, {
4452
5122
  index: column.computedMultiSort ? column.computedSortIndex + 1 : void 0,
4453
5123
  className: `${InfiniteTableHeaderCellClassName}__sort-icon ${HeaderSortIconCls} ${HeaderSortIconRecipe({
4454
5124
  align: column.align || "start"
@@ -4465,17 +5135,21 @@ function InfiniteTableHeaderCell(props) {
4465
5135
  const align = column.align || "start";
4466
5136
  const renderChildren = () => {
4467
5137
  if (header instanceof Function) {
4468
- header = /* @__PURE__ */ React20.createElement(RenderHookComponent, {
5138
+ header = /* @__PURE__ */ React22.createElement(RenderHookComponent, {
4469
5139
  render: header,
4470
5140
  renderParam
4471
5141
  });
4472
5142
  }
4473
5143
  header = header != null ? header : column.name;
4474
- return /* @__PURE__ */ React20.createElement(React20.Fragment, null, align === "end" ? sortTool : null, header, align !== "end" ? sortTool : null);
5144
+ return /* @__PURE__ */ React22.createElement(React22.Fragment, null, align === "end" ? sortTool : null, header, align !== "end" ? sortTool : null);
4475
5145
  };
4476
- const domRef = (0, import_react22.useRef)(null);
5146
+ const domRef = (0, import_react24.useRef)(null);
4477
5147
  const {
4478
- computed: { computedRemainingSpace, showColumnFilters },
5148
+ computed: {
5149
+ computedRemainingSpace,
5150
+ showColumnFilters,
5151
+ computedVisibleColumns
5152
+ },
4479
5153
  componentState: { portalDOMRef, columnHeaderHeight, filterEditors }
4480
5154
  } = useInfiniteTable();
4481
5155
  const {
@@ -4483,7 +5157,7 @@ function InfiniteTableHeaderCell(props) {
4483
5157
  getState: getDataSourceState,
4484
5158
  componentState: { filterDelay, filterTypes }
4485
5159
  } = useDataSourceContextValue();
4486
- (0, import_react22.useEffect)(() => {
5160
+ (0, import_react24.useEffect)(() => {
4487
5161
  let clearOnResize = null;
4488
5162
  const node = domRef.current;
4489
5163
  if (onResize && node) {
@@ -4496,7 +5170,7 @@ function InfiniteTableHeaderCell(props) {
4496
5170
  const style = {
4497
5171
  height
4498
5172
  };
4499
- const { onPointerDown, onPointerUp, dragging, draggingDiff, proxyOffset } = useColumnPointerEvents({
5173
+ const { onPointerDown, dragging, draggingDiff, proxyOffset } = useColumnPointerEvents({
4500
5174
  computedRemainingSpace,
4501
5175
  columnId: column.id,
4502
5176
  domRef,
@@ -4504,7 +5178,7 @@ function InfiniteTableHeaderCell(props) {
4504
5178
  });
4505
5179
  let draggingProxy = null;
4506
5180
  if (dragging) {
4507
- draggingProxy = /* @__PURE__ */ React20.createElement("div", {
5181
+ draggingProxy = /* @__PURE__ */ React22.createElement("div", {
4508
5182
  className: `${InfiniteTableHeaderCellClassName}Proxy ${HeaderCellProxy}`,
4509
5183
  style: {
4510
5184
  position: "absolute",
@@ -4521,7 +5195,7 @@ function InfiniteTableHeaderCell(props) {
4521
5195
  const contentRecipeVariants = {
4522
5196
  filtered: column.computedFiltered
4523
5197
  };
4524
- const setFilterValue = (0, import_react22.useCallback)((filterValue) => {
5198
+ const setFilterValue = (0, import_react24.useCallback)((filterValue) => {
4525
5199
  var _a2;
4526
5200
  const state = getDataSourceState();
4527
5201
  let newFilterValue = (_a2 = state.filterValue) != null ? _a2 : [];
@@ -4545,7 +5219,7 @@ function InfiniteTableHeaderCell(props) {
4545
5219
  });
4546
5220
  dataSourceActions.filterValue = newFilterValue;
4547
5221
  }, [column, filterTypes]);
4548
- const debouncedOnFilterValueChange = React20.useMemo(() => {
5222
+ const debouncedOnFilterValueChange = React22.useMemo(() => {
4549
5223
  const fn = (filterValue) => {
4550
5224
  let newFilterValueForColumn;
4551
5225
  if (column.computedFilterValue) {
@@ -4582,23 +5256,24 @@ function InfiniteTableHeaderCell(props) {
4582
5256
  ]);
4583
5257
  const filterType = column.computedFilterType;
4584
5258
  const FilterEditor = filterEditors[filterType] || defaultFilterEditors[filterType] || StringFilterEditor;
4585
- return /* @__PURE__ */ React20.createElement(ContextProvider, {
5259
+ const resizeHandle = useColumnResizeHandle(column);
5260
+ return /* @__PURE__ */ React22.createElement(ContextProvider, {
4586
5261
  value: renderParam
4587
- }, /* @__PURE__ */ React20.createElement(InfiniteTableCell, {
5262
+ }, /* @__PURE__ */ React22.createElement(InfiniteTableCell, {
4588
5263
  domRef: ref,
4589
5264
  cellType: "header",
4590
5265
  column,
4591
5266
  "data-name": `HeaderCell`,
4592
5267
  "data-column-id": column.id,
5268
+ "data-z-index": computedVisibleColumns.length * 10 - column.computedVisibleIndex * 10,
4593
5269
  style,
4594
5270
  width,
4595
5271
  onPointerDown,
4596
- onPointerUp,
4597
5272
  contentClassName: join(HeaderCellContentRecipe(contentRecipeVariants), justifyContent[(_c = column.align) != null ? _c : "start"]),
4598
5273
  contentStyle: showColumnFilters ? { height: height / 2 } : void 0,
4599
5274
  className: join(InfiniteTableHeaderCellClassName, userSelect.none, column.computedSortable ? cursor.pointer : "", useCellClassName(column, [InfiniteTableHeaderCellClassName, InfiniteTableCellClassName], HeaderCellRecipe, { dragging, zebra: false, rowActive: false }), CellCls),
4600
5275
  cssEllipsis: (_e = (_d = column.headerCssEllipsis) != null ? _d : column.cssEllipsis) != null ? _e : true,
4601
- afterChildren: showColumnFilters ? column.computedFilterable ? /* @__PURE__ */ React20.createElement(InfiniteTableColumnHeaderFilter, {
5276
+ afterChildren: /* @__PURE__ */ React22.createElement(React22.Fragment, null, showColumnFilters ? column.computedFilterable ? /* @__PURE__ */ React22.createElement(InfiniteTableColumnHeaderFilter, {
4602
5277
  filterEditor: FilterEditor,
4603
5278
  filterTypes,
4604
5279
  onChange: debouncedOnFilterValueChange,
@@ -4606,17 +5281,17 @@ function InfiniteTableHeaderCell(props) {
4606
5281
  columnLabel: column.field || column.name || column.id,
4607
5282
  columnFilterValue: column.computedFilterValue,
4608
5283
  columnHeaderHeight
4609
- }) : /* @__PURE__ */ React20.createElement(InfiniteTableColumnHeaderFilterEmpty, null) : null,
5284
+ }) : /* @__PURE__ */ React22.createElement(InfiniteTableColumnHeaderFilterEmpty, null) : null, resizeHandle),
4610
5285
  renderChildren
4611
5286
  }), draggingProxy);
4612
5287
  }
4613
5288
  function useInfiniteHeaderCell() {
4614
- const result = (0, import_react22.useContext)(InfiniteTableHeaderCellContext);
5289
+ const result = (0, import_react24.useContext)(InfiniteTableHeaderCellContext);
4615
5290
  return result;
4616
5291
  }
4617
5292
 
4618
5293
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx
4619
- var React23 = __toModule(require("react"));
5294
+ var React27 = __toModule(require("react"));
4620
5295
 
4621
5296
  // src/components/utils/getScrollbarWidth.ts
4622
5297
  var scrollbarWidth;
@@ -4702,7 +5377,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap, c
4702
5377
  let groupOffset = 0;
4703
5378
  map2.forEach((item) => {
4704
5379
  if (!item.ref.columnGroup) {
4705
- const itemWidth = item.type === "column" ? item.ref.computedWidth : item.columnItems.reduce((sum, col) => sum + col.ref.computedWidth, 0);
5380
+ const itemWidth = item.type === "column" ? item.ref.computedWidth : item.columnItems.reduce((sum2, col) => sum2 + col.ref.computedWidth, 0);
4706
5381
  item.groupOffset = groupOffset;
4707
5382
  item.computedWidth = itemWidth;
4708
5383
  if (item.type === "group") {
@@ -4727,7 +5402,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap, c
4727
5402
  }
4728
5403
  function assignGroupOffsetsAndComputedWidths(items, groupOffset = 0) {
4729
5404
  items.forEach((item) => {
4730
- const itemWidth = item.type === "column" ? item.ref.computedWidth : item.columnItems.reduce((sum, col) => sum + col.ref.computedWidth, 0);
5405
+ const itemWidth = item.type === "column" ? item.ref.computedWidth : item.columnItems.reduce((sum2, col) => sum2 + col.ref.computedWidth, 0);
4731
5406
  item.computedWidth = itemWidth;
4732
5407
  item.groupOffset = groupOffset;
4733
5408
  if (item.type === "group") {
@@ -4738,36 +5413,186 @@ function assignGroupOffsetsAndComputedWidths(items, groupOffset = 0) {
4738
5413
  }
4739
5414
 
4740
5415
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
4741
- var React22 = __toModule(require("react"));
4742
- var import_react23 = __toModule(require("react"));
5416
+ var React26 = __toModule(require("react"));
5417
+ var import_react27 = __toModule(require("react"));
5418
+
5419
+ // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderGroup.tsx
5420
+ var React25 = __toModule(require("react"));
5421
+
5422
+ // src/components/InfiniteTable/components/InfiniteTableHeader/useColumnGroupResizeHandle.tsx
5423
+ var React24 = __toModule(require("react"));
5424
+ var import_react26 = __toModule(require("react"));
5425
+
5426
+ // src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/GroupResizeHandle.tsx
5427
+ var import_react25 = __toModule(require("react"));
5428
+ var { rootClassName: rootClassName9 } = internalProps;
5429
+ var InfiniteTableHeaderCellResizeHandleCls2 = `${rootClassName9}HeaderCell_ResizeHandle`;
5430
+ function GroupResizeHandleFn(props) {
5431
+ const domRef = (0, import_react25.useRef)(null);
5432
+ const [constrained, setConstrained] = (0, import_react25.useState)(false);
5433
+ const constrainedRef = (0, import_react25.useRef)(constrained);
5434
+ constrainedRef.current = constrained;
5435
+ const onPointerDown = (e) => {
5436
+ e.stopPropagation();
5437
+ const pointerId = e.pointerId;
5438
+ const initialX = e.clientX;
5439
+ const target = e.target;
5440
+ target.setPointerCapture(pointerId);
5441
+ let initialMove = true;
5442
+ const resizer = getColumnGroupResizer(props.groupColumns.map((c) => c.computedVisibleIndex), {
5443
+ columns: props.columns,
5444
+ domRef
5445
+ });
5446
+ const resizeDiff = (diff) => {
5447
+ const { constrained: constrained2, adjustedDiffs, adjustedDiff } = props.computeResize(diff);
5448
+ if (constrainedRef.current !== constrained2) {
5449
+ setConstrained(constrained2);
5450
+ }
5451
+ resizer.resize(adjustedDiffs);
5452
+ return adjustedDiff;
5453
+ };
5454
+ const onPointerMove = (e2) => {
5455
+ if (initialMove) {
5456
+ const maxDiff = props.groupColumns.reduce((diff, col) => {
5457
+ return diff + col.computedWidth - col.computedMinWidth;
5458
+ }, 0);
5459
+ const currentSize = props.brain.getAvailableSize();
5460
+ const newSize = {
5461
+ width: currentSize.width + maxDiff,
5462
+ height: currentSize.height
5463
+ };
5464
+ props.brain.setAvailableSize(newSize);
5465
+ initialMove = false;
5466
+ }
5467
+ resizeDiff(Math.round(e2.clientX - initialX));
5468
+ };
5469
+ const onPointerUp = (e2) => {
5470
+ target.releasePointerCapture(pointerId);
5471
+ target.removeEventListener("pointermove", onPointerMove);
5472
+ target.removeEventListener("pointerup", onPointerUp);
5473
+ const diff = Math.round(e2.clientX - initialX);
5474
+ const adjustedDiffs = resizeDiff(diff);
5475
+ props.onResize(adjustedDiffs);
5476
+ };
5477
+ target.addEventListener("pointermove", onPointerMove);
5478
+ target.addEventListener("pointerup", onPointerUp);
5479
+ };
5480
+ return /* @__PURE__ */ import_react25.default.createElement("div", {
5481
+ ref: domRef,
5482
+ className: `${InfiniteTableHeaderCellResizeHandleCls2} ${ResizeHandleCls}`,
5483
+ onPointerDown
5484
+ }, /* @__PURE__ */ import_react25.default.createElement("div", {
5485
+ style: props.style,
5486
+ className: ResizeHandleDraggerClsRecipe({
5487
+ constrained
5488
+ })
5489
+ }));
5490
+ }
5491
+ var GroupResizeHandle = import_react25.default.memo(GroupResizeHandleFn);
5492
+
5493
+ // src/components/InfiniteTable/components/InfiniteTableHeader/useColumnGroupResizeHandle.tsx
5494
+ function useColumnGroupResizeHandle(groupColumns, config) {
5495
+ const { bodyBrain, groupHeight, columnGroup, columnGroupsMaxDepth } = config;
5496
+ const {
5497
+ computed: { computedVisibleColumns },
5498
+ getState,
5499
+ getComputed,
5500
+ componentActions
5501
+ } = useInfiniteTable();
5502
+ const lastColumnInGroup = groupColumns[groupColumns.length - 1];
5503
+ const computeResizeForDiff = (0, import_react26.useCallback)((diff) => {
5504
+ const state = getState();
5505
+ const { columnSizing, viewportReservedWidth, bodySize } = state;
5506
+ const columns = getComputed().computedVisibleColumns;
5507
+ let atLeastOneFlex = false;
5508
+ const columnSizingWithFlex = columns.reduce((acc, col) => {
5509
+ if (col.computedFlex) {
5510
+ acc[col.id] = { flex: col.computedWidth };
5511
+ atLeastOneFlex = true;
5512
+ }
5513
+ return acc;
5514
+ }, {});
5515
+ const columnSizingForResize = atLeastOneFlex ? __spreadValues(__spreadValues({}, columnSizing), columnSizingWithFlex) : columnSizing;
5516
+ const result = computeGroupResize({
5517
+ availableSize: bodySize.width,
5518
+ reservedWidth: viewportReservedWidth || 0,
5519
+ dragHandleOffset: diff,
5520
+ dragHandlePositionAfter: lastColumnInGroup.computedVisibleIndex,
5521
+ columnSizing: columnSizingForResize,
5522
+ columnGroupSize: groupColumns.length,
5523
+ items: columns.map((c) => {
5524
+ return {
5525
+ id: c.id,
5526
+ resizable: c.computedResizable,
5527
+ computedFlex: c.computedFlex,
5528
+ computedWidth: c.computedWidth,
5529
+ computedMinWidth: c.computedMinWidth,
5530
+ computedMaxWidth: c.computedMaxWidth
5531
+ };
5532
+ })
5533
+ });
5534
+ return result;
5535
+ }, []);
5536
+ const onColumnResize = (0, import_react26.useCallback)((diff) => {
5537
+ const { columnSizing, reservedWidth } = computeResizeForDiff(diff);
5538
+ componentActions.viewportReservedWidth = reservedWidth;
5539
+ componentActions.columnSizing = columnSizing;
5540
+ }, []);
5541
+ const groupResizable = groupColumns.some((c) => c.computedResizable);
5542
+ const resizeHandle = groupResizable ? /* @__PURE__ */ React24.createElement(GroupResizeHandle, {
5543
+ brain: bodyBrain,
5544
+ style: {
5545
+ height: groupHeight * (columnGroupsMaxDepth - columnGroup.depth + 2)
5546
+ },
5547
+ columns: computedVisibleColumns,
5548
+ groupColumns,
5549
+ computeResize: computeResizeForDiff,
5550
+ onResize: onColumnResize
5551
+ }) : null;
5552
+ return resizeHandle;
5553
+ }
4743
5554
 
4744
5555
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderGroup.tsx
4745
- var React21 = __toModule(require("react"));
4746
5556
  var TableHeaderGroupClassName = `${rootClassName2}HeaderGroup`;
5557
+ var columnWidthAtIndex3 = stripVar(InternalVars.columnWidthAtIndex);
4747
5558
  function InfiniteTableHeaderGroup(props) {
4748
- const { columnGroup, height, width } = props;
5559
+ const {
5560
+ computed: { computedVisibleColumns }
5561
+ } = useInfiniteTable();
5562
+ const { columnGroup, height, columns, bodyBrain, columnGroupsMaxDepth } = props;
4749
5563
  let { header } = columnGroup;
4750
5564
  if (header instanceof Function) {
4751
5565
  header = header({
4752
5566
  columnGroup
4753
5567
  });
4754
5568
  }
4755
- return /* @__PURE__ */ React21.createElement("div", {
5569
+ const handle = useColumnGroupResizeHandle(columns, {
5570
+ bodyBrain,
5571
+ groupHeight: height,
5572
+ columnGroup,
5573
+ columnGroupsMaxDepth
5574
+ });
5575
+ const firstColumn = columns[0];
5576
+ const width = columns.length > 1 ? `calc( ` + columns.map((col) => `var(${columnWidthAtIndex3}-${col.computedVisibleIndex})`).join(" + ") + " )" : `var(${columnWidthAtIndex3}-${firstColumn.computedVisibleIndex})`;
5577
+ const zIndex2 = computedVisibleColumns.length * 10 - firstColumn.computedVisibleIndex * 10 + height * (columnGroupsMaxDepth - columnGroup.depth + 2);
5578
+ return /* @__PURE__ */ React25.createElement("div", {
4756
5579
  ref: props.domRef,
4757
5580
  "data-group-id": columnGroup.uniqueGroupId,
4758
5581
  className: join(HeaderGroupCls, TableHeaderGroupClassName),
4759
- style: { width, height }
4760
- }, /* @__PURE__ */ React21.createElement("div", {
5582
+ style: { width, height },
5583
+ "data-z-index": zIndex2
5584
+ }, /* @__PURE__ */ React25.createElement("div", {
4761
5585
  className: join(`${TableHeaderGroupClassName}__header-content`, cssEllipsisClassName)
4762
- }, header));
5586
+ }, header), handle);
4763
5587
  }
4764
5588
 
4765
5589
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
4766
- var { rootClassName: rootClassName8 } = internalProps;
4767
- var TableHeaderClassName = `${rootClassName8}Header`;
5590
+ var { rootClassName: rootClassName10 } = internalProps;
5591
+ var TableHeaderClassName = `${rootClassName10}Header`;
4768
5592
  function InfiniteTableHeaderFn(props) {
4769
5593
  const {
4770
- brain,
5594
+ bodyBrain,
5595
+ headerBrain: brain,
4771
5596
  columns,
4772
5597
  style,
4773
5598
  className,
@@ -4780,7 +5605,7 @@ function InfiniteTableHeaderFn(props) {
4780
5605
  componentState: { headerBrain, headerOptions }
4781
5606
  } = useInfiniteTable();
4782
5607
  const { computedVisibleColumnsMap, showColumnFilters } = computed;
4783
- (0, import_react23.useEffect)(() => {
5608
+ (0, import_react27.useEffect)(() => {
4784
5609
  const onScroll = (scrollPosition) => {
4785
5610
  if (domRef.current) {
4786
5611
  domRef.current.style.transform = `translate3d(-${scrollPosition.scrollLeft}px, 0px, 0px)`;
@@ -4789,7 +5614,7 @@ function InfiniteTableHeaderFn(props) {
4789
5614
  const removeOnScroll = brain.onScroll(onScroll);
4790
5615
  return removeOnScroll;
4791
5616
  }, [brain]);
4792
- const domRef = (0, import_react23.useRef)(null);
5617
+ const domRef = (0, import_react27.useRef)(null);
4793
5618
  const headerCls = HeaderClsRecipe({
4794
5619
  overflow: false,
4795
5620
  virtualized: true
@@ -4799,7 +5624,7 @@ function InfiniteTableHeaderFn(props) {
4799
5624
  className: join(TableHeaderClassName, `${TableHeaderClassName}--virtualized`, className, headerCls),
4800
5625
  style: __spreadProps(__spreadValues({}, style), { height: columnHeaderHeight })
4801
5626
  };
4802
- const renderCell = (0, import_react23.useCallback)((params) => {
5627
+ const renderCell = (0, import_react27.useCallback)((params) => {
4803
5628
  const {
4804
5629
  rowIndex,
4805
5630
  colIndex,
@@ -4824,7 +5649,9 @@ function InfiniteTableHeaderFn(props) {
4824
5649
  computedWidth: colGroupItem.computedWidth,
4825
5650
  groupOffset: colGroupItem.groupOffset
4826
5651
  });
4827
- return /* @__PURE__ */ React22.createElement(InfiniteTableHeaderGroup, {
5652
+ return /* @__PURE__ */ React26.createElement(InfiniteTableHeaderGroup, {
5653
+ bodyBrain,
5654
+ columnGroupsMaxDepth,
4828
5655
  domRef: domRef2,
4829
5656
  columns: columns2,
4830
5657
  width: widthWithColspan,
@@ -4832,7 +5659,7 @@ function InfiniteTableHeaderFn(props) {
4832
5659
  columnGroup: computedColumnGroup
4833
5660
  });
4834
5661
  }
4835
- return /* @__PURE__ */ React22.createElement(InfiniteTableHeaderCell, {
5662
+ return /* @__PURE__ */ React26.createElement(InfiniteTableHeaderCell, {
4836
5663
  domRef: domRef2,
4837
5664
  column,
4838
5665
  headerOptions,
@@ -4848,17 +5675,18 @@ function InfiniteTableHeaderFn(props) {
4848
5675
  columnGroupsMaxDepth,
4849
5676
  showColumnFilters
4850
5677
  ]);
4851
- return /* @__PURE__ */ React22.createElement("div", __spreadValues({}, domProps), /* @__PURE__ */ React22.createElement(RawTable, {
5678
+ return /* @__PURE__ */ React26.createElement("div", __spreadValues({}, domProps), /* @__PURE__ */ React26.createElement(RawTable, {
5679
+ name: "header",
4852
5680
  renderCell,
4853
5681
  brain: headerBrain,
4854
5682
  cellHoverClassNames: []
4855
5683
  }));
4856
5684
  }
4857
- var InfiniteTableHeader = React22.memo(InfiniteTableHeaderFn);
5685
+ var InfiniteTableHeader = React26.memo(InfiniteTableHeaderFn);
4858
5686
 
4859
5687
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx
4860
5688
  function TableHeaderWrapper(props) {
4861
- const { brain, scrollbars } = props;
5689
+ const { headerBrain, bodyBrain, scrollbars } = props;
4862
5690
  const tableContextValue = useInfiniteTable();
4863
5691
  const {
4864
5692
  computedPinnedStartColumns,
@@ -4877,13 +5705,13 @@ function TableHeaderWrapper(props) {
4877
5705
  } = tableContextValue;
4878
5706
  const rows = !computedColumnGroups || !computedColumnGroups.size ? 1 : columnGroupsMaxDepth + 2;
4879
5707
  const height = rows * columnHeaderHeight + (showColumnFilters ? columnHeaderHeight : 0);
4880
- const columnAndGroupTreeInfo = React23.useMemo(() => {
5708
+ const columnAndGroupTreeInfo = React27.useMemo(() => {
4881
5709
  if (!computedColumnGroups || !computedColumnGroups.size) {
4882
5710
  return void 0;
4883
5711
  }
4884
5712
  return buildColumnAndGroupTree(computedVisibleColumns, computedColumnGroups, columnGroupsDepthsMap, columnGroupsMaxDepth);
4885
5713
  }, [computedVisibleColumns, computedColumnGroups, columnGroupsDepthsMap]);
4886
- const cellspan = React23.useCallback(({ rowIndex, colIndex }) => {
5714
+ const cellspan = React27.useCallback(({ rowIndex, colIndex }) => {
4887
5715
  const column = computedVisibleColumns[colIndex];
4888
5716
  const rowspan2 = 1;
4889
5717
  const colspan2 = 1;
@@ -4916,12 +5744,12 @@ function TableHeaderWrapper(props) {
4916
5744
  rows,
4917
5745
  columnGroupsDepthsMap
4918
5746
  ]);
4919
- const rowspan = React23.useCallback(({ rowIndex, colIndex }) => cellspan({ rowIndex, colIndex }).rowspan, [cellspan]);
4920
- const colspan = React23.useCallback(({ rowIndex, colIndex }) => cellspan({ rowIndex, colIndex }).colspan, [cellspan]);
4921
- const rowHeight = React23.useCallback((index) => {
5747
+ const rowspan = React27.useCallback(({ rowIndex, colIndex }) => cellspan({ rowIndex, colIndex }).rowspan, [cellspan]);
5748
+ const colspan = React27.useCallback(({ rowIndex, colIndex }) => cellspan({ rowIndex, colIndex }).colspan, [cellspan]);
5749
+ const rowHeight = React27.useCallback((index) => {
4922
5750
  return showColumnFilters ? index < rows - 1 ? columnHeaderHeight : 2 * columnHeaderHeight : columnHeaderHeight;
4923
5751
  }, [rows, showColumnFilters, columnHeaderHeight]);
4924
- useMatrixBrain(brain, {
5752
+ useMatrixBrain(headerBrain, {
4925
5753
  colWidth: columnSize,
4926
5754
  rowHeight,
4927
5755
  rows,
@@ -4933,21 +5761,22 @@ function TableHeaderWrapper(props) {
4933
5761
  fixedColsEnd: computedPinnedEndColumns.length,
4934
5762
  fixedColsStart: computedPinnedStartColumns.length
4935
5763
  });
4936
- const header = /* @__PURE__ */ React23.createElement(InfiniteTableHeader, {
5764
+ const header = /* @__PURE__ */ React27.createElement(InfiniteTableHeader, {
4937
5765
  columns: computedVisibleColumns,
4938
- brain,
5766
+ headerBrain,
5767
+ bodyBrain,
4939
5768
  columnHeaderHeight: height,
4940
5769
  columnGroupsMaxDepth,
4941
5770
  columnAndGroupTreeInfo
4942
5771
  });
4943
- const verticalScrollbarPlaceholder = scrollbars.vertical && getScrollbarWidth() ? /* @__PURE__ */ React23.createElement("div", {
5772
+ const verticalScrollbarPlaceholder = scrollbars.vertical && getScrollbarWidth() ? /* @__PURE__ */ React27.createElement("div", {
4944
5773
  className: HeaderScrollbarPlaceholderCls,
4945
5774
  style: {
4946
5775
  zIndex: 1e3,
4947
5776
  width: getScrollbarWidth()
4948
5777
  }
4949
5778
  }) : null;
4950
- return /* @__PURE__ */ React23.createElement("div", {
5779
+ return /* @__PURE__ */ React27.createElement("div", {
4951
5780
  className: HeaderWrapperCls,
4952
5781
  style: {
4953
5782
  height
@@ -4956,8 +5785,8 @@ function TableHeaderWrapper(props) {
4956
5785
  }
4957
5786
 
4958
5787
  // src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
4959
- var React24 = __toModule(require("react"));
4960
- var import_react24 = __toModule(require("react"));
5788
+ var React28 = __toModule(require("react"));
5789
+ var import_react28 = __toModule(require("react"));
4961
5790
 
4962
5791
  // src/components/utils/decamelize.ts
4963
5792
  function decamelize(str, options) {
@@ -4965,17 +5794,13 @@ function decamelize(str, options) {
4965
5794
  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();
4966
5795
  }
4967
5796
 
4968
- // src/components/InfiniteTable/theme.css.ts
4969
- 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)" } } };
4970
- var columnHeaderHeightName = "column-header-height";
4971
-
4972
5797
  // src/components/InfiniteTable/InfiniteCls.css.ts
4973
- var import_createRuntimeFn3 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
5798
+ var import_createRuntimeFn4 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
4974
5799
  var FooterCls = "_16lm1iw1";
4975
- var InfiniteCls = "_1yeub2v0 _16lm1iw1 _16lm1iwm _16lm1iw12 _16lm1iw0";
4976
- 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"]] });
4977
- var InfiniteClsShiftingColumns = "_16lm1iwp";
4978
- var PinnedRowsContainerClsVariants = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "", variantClassNames: { pinned: { start: "_1yeub2vi", end: "_1yeub2vj", false: "_1yeub2vk" } }, defaultVariants: {}, compoundVariants: [] });
5800
+ var InfiniteCls = "_1yeub2v0 _16lm1iw1 _16lm1iwn _16lm1iw13 _16lm1iw0";
5801
+ 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"]] });
5802
+ var InfiniteClsShiftingColumns = "_16lm1iwq";
5803
+ var PinnedRowsContainerClsVariants = (0, import_createRuntimeFn4.createRuntimeFn)({ defaultClassName: "", variantClassNames: { pinned: { start: "_1yeub2vi", end: "_1yeub2vj", false: "_1yeub2vk" } }, defaultVariants: {}, compoundVariants: [] });
4979
5804
 
4980
5805
  // src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
4981
5806
  var defaultStyle = {
@@ -5004,10 +5829,10 @@ var enforceStyle = (node, style) => {
5004
5829
  node.style.setProperty(decamelize(propertyName), propertyValue, "important");
5005
5830
  }
5006
5831
  };
5007
- var InfiniteTableLicenseFooter = React24.forwardRef(function InfiniteTableLicenseFooter2(props, ref) {
5008
- const { rootClassName: rootClassName11 } = useInternalProps();
5009
- const domRef = React24.useRef(null);
5010
- const domCallback = React24.useCallback((node) => {
5832
+ var InfiniteTableLicenseFooter = React28.forwardRef(function InfiniteTableLicenseFooter2(props, ref) {
5833
+ const { rootClassName: rootClassName13 } = useInternalProps();
5834
+ const domRef = React28.useRef(null);
5835
+ const domCallback = React28.useCallback((node) => {
5011
5836
  domRef.current = node;
5012
5837
  if (!ref) {
5013
5838
  return;
@@ -5018,7 +5843,7 @@ var InfiniteTableLicenseFooter = React24.forwardRef(function InfiniteTableLicens
5018
5843
  ref.current = node;
5019
5844
  }
5020
5845
  }, []);
5021
- (0, import_react24.useEffect)(() => {
5846
+ (0, import_react28.useEffect)(() => {
5022
5847
  const forceStyle = () => {
5023
5848
  requestAnimationFrame(() => {
5024
5849
  var _a;
@@ -5032,12 +5857,12 @@ var InfiniteTableLicenseFooter = React24.forwardRef(function InfiniteTableLicens
5032
5857
  clearInterval(intervalId);
5033
5858
  };
5034
5859
  }, []);
5035
- return /* @__PURE__ */ React24.createElement("div", __spreadProps(__spreadValues({
5860
+ return /* @__PURE__ */ React28.createElement("div", __spreadProps(__spreadValues({
5036
5861
  ref: domCallback
5037
5862
  }, props), {
5038
- className: join(`${rootClassName11}-Footer`, FooterCls, props.className),
5863
+ className: join(`${rootClassName13}-Footer`, FooterCls, props.className),
5039
5864
  style: defaultStyle
5040
- }), "Powered by", " ", /* @__PURE__ */ React24.createElement("a", {
5865
+ }), "Powered by", " ", /* @__PURE__ */ React28.createElement("a", {
5041
5866
  href: "https://infinite-table.com",
5042
5867
  rel: "noopener noreferrer",
5043
5868
  role: "link",
@@ -5046,11 +5871,11 @@ var InfiniteTableLicenseFooter = React24.forwardRef(function InfiniteTableLicens
5046
5871
  });
5047
5872
 
5048
5873
  // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableColumnCell.tsx
5049
- var React25 = __toModule(require("react"));
5050
- var import_react25 = __toModule(require("react"));
5051
- var { rootClassName: rootClassName9 } = internalProps;
5052
- var InfiniteTableColumnCellContext = React25.createContext(null);
5053
- var InfiniteTableColumnCellClassName = `${rootClassName9}ColumnCell`;
5874
+ var React29 = __toModule(require("react"));
5875
+ var import_react29 = __toModule(require("react"));
5876
+ var { rootClassName: rootClassName11 } = internalProps;
5877
+ var InfiniteTableColumnCellContext = React29.createContext(null);
5878
+ var InfiniteTableColumnCellClassName = `${rootClassName11}ColumnCell`;
5054
5879
  function isColumnWithField(c) {
5055
5880
  return typeof c.field === "string";
5056
5881
  }
@@ -5064,9 +5889,7 @@ function InfiniteTableColumnCellFn(props) {
5064
5889
  column,
5065
5890
  onMouseLeave,
5066
5891
  onMouseEnter,
5067
- offsetProperty,
5068
5892
  toggleGroupRow,
5069
- virtualized,
5070
5893
  rowIndex,
5071
5894
  rowHeight,
5072
5895
  domRef,
@@ -5074,7 +5897,7 @@ function InfiniteTableColumnCellFn(props) {
5074
5897
  showZebraRows
5075
5898
  } = props;
5076
5899
  if (!column) {
5077
- return /* @__PURE__ */ React25.createElement("div", {
5900
+ return /* @__PURE__ */ React29.createElement("div", {
5078
5901
  ref: domRef
5079
5902
  }, "no column");
5080
5903
  }
@@ -5107,7 +5930,7 @@ function InfiniteTableColumnCellFn(props) {
5107
5930
  value
5108
5931
  });
5109
5932
  }
5110
- const onClick = (0, import_react25.useCallback)(() => {
5933
+ const onClick = (0, import_react29.useCallback)(() => {
5111
5934
  if (keyboardNavigation === "row") {
5112
5935
  componentActions.activeRowIndex = rowIndex;
5113
5936
  return;
@@ -5147,7 +5970,7 @@ function InfiniteTableColumnCellFn(props) {
5147
5970
  isGroupRow,
5148
5971
  rowIndex,
5149
5972
  toggleGroupRow,
5150
- toggleCurrentGroupRow: (0, import_react25.useCallback)(() => {
5973
+ toggleCurrentGroupRow: (0, import_react29.useCallback)(() => {
5151
5974
  if (!rowInfo.isGroupRow) {
5152
5975
  return;
5153
5976
  }
@@ -5156,13 +5979,13 @@ function InfiniteTableColumnCellFn(props) {
5156
5979
  groupBy: computedDataSource.groupBy,
5157
5980
  pivotBy: computedDataSource.pivotBy
5158
5981
  });
5159
- const renderChildren = (0, import_react25.useCallback)(() => {
5982
+ const renderChildren = (0, import_react29.useCallback)(() => {
5160
5983
  if (hidden) {
5161
5984
  return null;
5162
5985
  }
5163
5986
  const renderFn = column.render || column.renderValue;
5164
5987
  if (renderFn) {
5165
- return /* @__PURE__ */ React25.createElement(RenderHookComponent, {
5988
+ return /* @__PURE__ */ React29.createElement(RenderHookComponent, {
5166
5989
  render: renderFn,
5167
5990
  renderParam
5168
5991
  });
@@ -5179,18 +6002,15 @@ function InfiniteTableColumnCellFn(props) {
5179
6002
  style = typeof rowStyle === "function" ? __spreadValues(__spreadValues({}, style), rowStyle(rowPropsAndStyleArgs)) : __spreadValues(__spreadValues({}, style), rowStyle);
5180
6003
  }
5181
6004
  style = column.style ? typeof column.style === "function" ? __spreadValues(__spreadValues({}, style), column.style(stylingRenderParam) || {}) : __spreadValues(__spreadValues({}, style), column.style) : style || {};
5182
- style.width = width;
5183
6005
  style.height = rowHeight;
5184
- const memoizedStyle = (0, import_react25.useMemo)(() => style, [!style ? null : JSON.stringify(style)]);
6006
+ const memoizedStyle = (0, import_react29.useMemo)(() => style, [!style ? null : JSON.stringify(style)]);
5185
6007
  const odd = (rowInfo.indexInAll != null ? rowInfo.indexInAll : rowIndex) % 2 === 1;
5186
6008
  const zebra = showZebraRows ? odd ? "odd" : "even" : false;
5187
6009
  const cellProps = {
5188
6010
  domRef,
5189
- offsetProperty,
5190
6011
  cellType: "body",
5191
6012
  column,
5192
6013
  width,
5193
- offset: virtualized ? 0 : column.computedPinningOffset,
5194
6014
  style: memoizedStyle,
5195
6015
  onMouseLeave,
5196
6016
  onMouseEnter,
@@ -5200,44 +6020,44 @@ function InfiniteTableColumnCellFn(props) {
5200
6020
  renderChildren
5201
6021
  };
5202
6022
  const ContextProvider = InfiniteTableColumnCellContext.Provider;
5203
- return /* @__PURE__ */ React25.createElement(ContextProvider, {
6023
+ return /* @__PURE__ */ React29.createElement(ContextProvider, {
5204
6024
  value: renderParam
5205
- }, /* @__PURE__ */ React25.createElement(InfiniteTableCell, __spreadValues({}, cellProps)));
6025
+ }, /* @__PURE__ */ React29.createElement(InfiniteTableCell, __spreadValues({}, cellProps)));
5206
6026
  }
5207
- var InfiniteTableColumnCell = React25.memo(InfiniteTableColumnCellFn);
6027
+ var InfiniteTableColumnCell = React29.memo(InfiniteTableColumnCellFn);
5208
6028
  function useInfiniteColumnCell() {
5209
- const result = (0, import_react25.useContext)(InfiniteTableColumnCellContext);
6029
+ const result = (0, import_react29.useContext)(InfiniteTableColumnCellContext);
5210
6030
  return result;
5211
6031
  }
5212
6032
 
5213
6033
  // src/components/InfiniteTable/components/InfiniteTableRow/row.css.ts
5214
- var import_createRuntimeFn4 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
6034
+ var import_createRuntimeFn5 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
5215
6035
  var GroupRowExpanderCls = "_7pupv0b";
5216
- 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: [] });
6036
+ 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: [] });
5217
6037
  var RowHoverCls = "_7pupv01";
5218
6038
 
5219
6039
  // src/components/InfiniteTable/components/LoadMask.tsx
5220
- var React26 = __toModule(require("react"));
6040
+ var React30 = __toModule(require("react"));
5221
6041
 
5222
6042
  // src/components/InfiniteTable/components/LoadMask.css.ts
5223
- var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2 _16lm1iwu _16lm1iww _16lm1iw10 _16lm1iwy", hidden: "qy58ya2 qy58ya0 _16lm1iw2 _16lm1iwu _16lm1iww _16lm1iw10 _16lm1iwy" };
5224
- var LoadMaskOverlayCls = "qy58ya3 _16lm1iw2 _16lm1iwu _16lm1iww _16lm1iw10 _16lm1iwy";
6043
+ var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2 _16lm1iwv _16lm1iwx _16lm1iw11 _16lm1iwz", hidden: "qy58ya2 qy58ya0 _16lm1iw2 _16lm1iwv _16lm1iwx _16lm1iw11 _16lm1iwz" };
6044
+ var LoadMaskOverlayCls = "qy58ya3 _16lm1iw2 _16lm1iwv _16lm1iwx _16lm1iw11 _16lm1iwz";
5225
6045
  var LoadMaskTextCls = "qy58ya4";
5226
6046
 
5227
6047
  // src/components/InfiniteTable/components/LoadMask.tsx
5228
- var { rootClassName: rootClassName10 } = internalProps;
5229
- var baseCls3 = `${rootClassName10}-LoadMask`;
6048
+ var { rootClassName: rootClassName12 } = internalProps;
6049
+ var baseCls3 = `${rootClassName12}-LoadMask`;
5230
6050
  function LoadMaskFn(props) {
5231
6051
  const { visible, children = "Loading" } = props;
5232
- return /* @__PURE__ */ React26.createElement("div", {
6052
+ return /* @__PURE__ */ React30.createElement("div", {
5233
6053
  className: `${LoadMaskCls[visible ? "visible" : "hidden"]} ${baseCls3}`
5234
- }, /* @__PURE__ */ React26.createElement("div", {
6054
+ }, /* @__PURE__ */ React30.createElement("div", {
5235
6055
  className: `${LoadMaskOverlayCls} ${baseCls3}-Overlay`
5236
- }), /* @__PURE__ */ React26.createElement("div", {
6056
+ }), /* @__PURE__ */ React30.createElement("div", {
5237
6057
  className: `${LoadMaskTextCls} ${baseCls3}-Text`
5238
6058
  }, children));
5239
6059
  }
5240
- var LoadMask = React26.memo(LoadMaskFn);
6060
+ var LoadMask = React30.memo(LoadMaskFn);
5241
6061
 
5242
6062
  // src/components/InfiniteTable/getImperativeApi.ts
5243
6063
  function getImperativeApi(getState, getComputed, getDataSourceState, componentActions) {
@@ -5302,7 +6122,7 @@ function getImperativeApi(getState, getComputed, getDataSourceState, componentAc
5302
6122
  }
5303
6123
 
5304
6124
  // src/components/InfiniteTable/hooks/useAutoSizeColumns.ts
5305
- var import_react26 = __toModule(require("react"));
6125
+ var import_react30 = __toModule(require("react"));
5306
6126
  var OFFSET = 10;
5307
6127
  function getColumnContentMaxWidths(domRef, options) {
5308
6128
  var _a;
@@ -5338,9 +6158,15 @@ function getColumnContentMaxWidths(domRef, options) {
5338
6158
  cell.childNodes.forEach((child) => {
5339
6159
  if (child !== content) {
5340
6160
  const el = child;
5341
- otherElementsLength += Math.max(el.offsetWidth, parseInt(el.style.width, 10));
5342
- const style = getGlobal().getComputedStyle(el);
5343
- otherElementsLength += parseInt(style.marginLeft, 10) + parseInt(style.marginRight, 10);
6161
+ let elWidth = Math.max(el.offsetWidth, parseInt(el.style.width, 10));
6162
+ if (isNaN(elWidth)) {
6163
+ elWidth = 0;
6164
+ }
6165
+ otherElementsLength += elWidth;
6166
+ if (elWidth > 0) {
6167
+ const style = getGlobal().getComputedStyle(el);
6168
+ otherElementsLength += parseInt(style.marginLeft, 10) + parseInt(style.marginRight, 10);
6169
+ }
5344
6170
  }
5345
6171
  });
5346
6172
  measuredWidth += otherElementsLength;
@@ -5362,11 +6188,11 @@ function useAutoSizeColumns() {
5362
6188
  componentActions,
5363
6189
  componentState: { domRef, ready, autoSizeColumnsKey, brain }
5364
6190
  } = useComponentState();
5365
- const [refreshId, setRefreshId] = (0, import_react26.useState)(0);
6191
+ const [refreshId, setRefreshId] = (0, import_react30.useState)(0);
5366
6192
  const theKey = typeof autoSizeColumnsKey === "object" ? autoSizeColumnsKey.key : autoSizeColumnsKey;
5367
6193
  const getTheKey = useLatest(theKey);
5368
- const lastExecutedIdentifierRef = (0, import_react26.useRef)(null);
5369
- (0, import_react26.useEffect)(() => {
6194
+ const lastExecutedIdentifierRef = (0, import_react30.useRef)(null);
6195
+ (0, import_react30.useEffect)(() => {
5370
6196
  const key = getTheKey();
5371
6197
  if (key == null) {
5372
6198
  return;
@@ -5379,7 +6205,7 @@ function useAutoSizeColumns() {
5379
6205
  };
5380
6206
  return brain.onRenderRangeChange(onChange);
5381
6207
  }, [brain]);
5382
- (0, import_react26.useEffect)(() => {
6208
+ (0, import_react30.useEffect)(() => {
5383
6209
  var _a;
5384
6210
  if (theKey == null) {
5385
6211
  return;
@@ -5424,8 +6250,8 @@ function useAutoSizeColumns() {
5424
6250
  }
5425
6251
 
5426
6252
  // src/components/InfiniteTable/hooks/useCellRendering.tsx
5427
- var import_react27 = __toModule(require("react"));
5428
- var import_react28 = __toModule(require("react"));
6253
+ var import_react31 = __toModule(require("react"));
6254
+ var import_react32 = __toModule(require("react"));
5429
6255
 
5430
6256
  // src/components/InfiniteTable/hooks/useYourBrain.ts
5431
6257
  function useYourBrain(param) {
@@ -5495,13 +6321,13 @@ function useCellRendering(param) {
5495
6321
  bodySize,
5496
6322
  rowspan
5497
6323
  });
5498
- const scrollTopMaxRef = (0, import_react27.useRef)(0);
5499
- (0, import_react27.useEffect)(() => {
6324
+ const scrollTopMaxRef = (0, import_react31.useRef)(0);
6325
+ (0, import_react31.useEffect)(() => {
5500
6326
  return brain.onRenderCountChange(() => {
5501
6327
  scrollTopMaxRef.current = brain.scrollTopMax;
5502
6328
  });
5503
6329
  }, [brain]);
5504
- (0, import_react27.useEffect)(() => {
6330
+ (0, import_react31.useEffect)(() => {
5505
6331
  return brain.onScrollStop((scrollPosition) => {
5506
6332
  const { scrollTop } = scrollPosition;
5507
6333
  if (scrollTop === 0) {
@@ -5518,7 +6344,7 @@ function useCellRendering(param) {
5518
6344
  }
5519
6345
  });
5520
6346
  }, [brain, onScrollToTop, onScrollToBottom]);
5521
- (0, import_react27.useEffect)(() => {
6347
+ (0, import_react31.useEffect)(() => {
5522
6348
  if (!bodySize.height) {
5523
6349
  return;
5524
6350
  }
@@ -5529,10 +6355,10 @@ function useCellRendering(param) {
5529
6355
  }
5530
6356
  }, [!!bodySize.height]);
5531
6357
  const [, rerender] = useRerender();
5532
- (0, import_react27.useEffect)(() => {
6358
+ (0, import_react31.useEffect)(() => {
5533
6359
  rerender();
5534
6360
  }, [dataSourceState]);
5535
- const renderCell = (0, import_react27.useCallback)((params) => {
6361
+ const renderCell = (0, import_react31.useCallback)((params) => {
5536
6362
  const {
5537
6363
  rowIndex,
5538
6364
  colIndex,
@@ -5567,7 +6393,7 @@ function useCellRendering(param) {
5567
6393
  rowStyle,
5568
6394
  rowClassName
5569
6395
  };
5570
- return /* @__PURE__ */ import_react28.default.createElement(InfiniteTableColumnCell, __spreadValues({}, cellProps));
6396
+ return /* @__PURE__ */ import_react32.default.createElement(InfiniteTableColumnCell, __spreadValues({}, cellProps));
5571
6397
  }, [
5572
6398
  rowHeight,
5573
6399
  getData,
@@ -5585,13 +6411,13 @@ function useCellRendering(param) {
5585
6411
  }
5586
6412
 
5587
6413
  // src/components/InfiniteTable/hooks/useComputed.ts
5588
- var import_react42 = __toModule(require("react"));
6414
+ var import_react46 = __toModule(require("react"));
5589
6415
 
5590
6416
  // src/components/InfiniteTable/hooks/useColumnGroups.ts
5591
- var import_react30 = __toModule(require("react"));
6417
+ var import_react34 = __toModule(require("react"));
5592
6418
 
5593
6419
  // src/components/hooks/useInterceptedMap.ts
5594
- var import_react29 = __toModule(require("react"));
6420
+ var import_react33 = __toModule(require("react"));
5595
6421
  function interceptMap(map2, fns) {
5596
6422
  const { set, delete: deleteKey, clear } = map2;
5597
6423
  if (fns.set) {
@@ -5642,7 +6468,7 @@ function computeColumnGroupsDepths(columnGroups) {
5642
6468
  while (parentGroupId) {
5643
6469
  const parent = columnGroups.get(parentGroupId);
5644
6470
  if (!parent) {
5645
- if (true) {
6471
+ if (false) {
5646
6472
  console.warn(`Cannot find column group ${parentGroupId}`);
5647
6473
  }
5648
6474
  break;
@@ -5679,7 +6505,7 @@ function useColumnGroups() {
5679
6505
  componentActions,
5680
6506
  getComponentState
5681
6507
  } = useComponentState();
5682
- (0, import_react30.useEffect)(() => {
6508
+ (0, import_react34.useEffect)(() => {
5683
6509
  const recompute = () => {
5684
6510
  componentActions.columnGroupsDepthsMap = computeColumnGroupsDepths(computedColumnGroups);
5685
6511
  };
@@ -5690,7 +6516,7 @@ function useColumnGroups() {
5690
6516
  set: update
5691
6517
  });
5692
6518
  }, [computedColumnGroups]);
5693
- (0, import_react30.useEffect)(() => {
6519
+ (0, import_react34.useEffect)(() => {
5694
6520
  return interceptMap(collapsedColumnGroups, {
5695
6521
  set: (key, visibleCol) => {
5696
6522
  const colIds = key.slice(1);
@@ -5725,10 +6551,10 @@ function useColumnGroups() {
5725
6551
  }
5726
6552
 
5727
6553
  // src/components/InfiniteTable/hooks/useColumnRowspan.ts
5728
- var import_react31 = __toModule(require("react"));
6554
+ var import_react35 = __toModule(require("react"));
5729
6555
  function useColumnRowspan(computedVisibleColumns) {
5730
6556
  const { getState: getDataSourceState } = useDataSourceContextValue();
5731
- const rowspan = (0, import_react31.useMemo)(() => {
6557
+ const rowspan = (0, import_react35.useMemo)(() => {
5732
6558
  const colsWithRowspan = computedVisibleColumns.filter((col) => typeof col.rowspan === "function");
5733
6559
  return colsWithRowspan.length ? ({ rowIndex, colIndex }) => {
5734
6560
  const dataArray = getDataSourceState().dataArray;
@@ -5754,12 +6580,12 @@ function useColumnRowspan(computedVisibleColumns) {
5754
6580
  }
5755
6581
 
5756
6582
  // src/components/InfiniteTable/hooks/useColumnSizeFn.ts
5757
- var import_react32 = __toModule(require("react"));
6583
+ var import_react36 = __toModule(require("react"));
5758
6584
  var debug4 = dbg("useColumnSizeFn");
5759
6585
  function useColumnSizeFn(columns) {
5760
- const columnSize = (0, import_react32.useCallback)((index) => {
6586
+ const columnSize = (0, import_react36.useCallback)((index) => {
5761
6587
  const column = columns[index];
5762
- if (!column) {
6588
+ if (false) {
5763
6589
  debug4("cannot find column at index", index, columns);
5764
6590
  }
5765
6591
  return column ? column.computedWidth : 0;
@@ -5768,15 +6594,10 @@ function useColumnSizeFn(columns) {
5768
6594
  }
5769
6595
 
5770
6596
  // src/components/InfiniteTable/hooks/useColumnsWhen.ts
5771
- var import_react38 = __toModule(require("react"));
6597
+ var import_react42 = __toModule(require("react"));
5772
6598
 
5773
6599
  // src/components/InfiniteTable/utils/getColumnForGroupBy.tsx
5774
- var React30 = __toModule(require("react"));
5775
-
5776
- // src/utils/stripVar.ts
5777
- function stripVar(cssVariableWithVarString) {
5778
- return cssVariableWithVarString.slice(4, -1);
5779
- }
6600
+ var React34 = __toModule(require("react"));
5780
6601
 
5781
6602
  // src/components/DataSource/state/rowInfoStatus.ts
5782
6603
  var showLoadingIcon = (rowInfo) => {
@@ -5787,19 +6608,19 @@ var showLoadingIcon = (rowInfo) => {
5787
6608
  };
5788
6609
 
5789
6610
  // src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
5790
- var React28 = __toModule(require("react"));
5791
- var import_react33 = __toModule(require("react"));
6611
+ var React32 = __toModule(require("react"));
6612
+ var import_react37 = __toModule(require("react"));
5792
6613
 
5793
6614
  // src/components/InfiniteTable/components/icons/ExpanderIcon.css.ts
5794
- var import_createRuntimeFn5 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
5795
- var ExpanderIconCls = "_16lm1iw6 _16lm1iwg _16lm1iwd";
5796
- var ExpanderIconClsVariants = (0, import_createRuntimeFn5.createRuntimeFn)({ defaultClassName: "", variantClassNames: { expanded: { true: "_16lm1iwc", false: "_198z9782" } }, defaultVariants: {}, compoundVariants: [] });
6615
+ var import_createRuntimeFn6 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
6616
+ var ExpanderIconCls = "_16lm1iw6 _16lm1iwh _16lm1iwd";
6617
+ var ExpanderIconClsVariants = (0, import_createRuntimeFn6.createRuntimeFn)({ defaultClassName: "", variantClassNames: { expanded: { true: "_16lm1iwc", false: "_198z9782" } }, defaultVariants: {}, compoundVariants: [] });
5797
6618
 
5798
6619
  // src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
5799
6620
  function ExpanderIcon(props) {
5800
6621
  var _a;
5801
6622
  const { size = 24 } = props;
5802
- const [expanded, setExpanded] = (0, import_react33.useState)((_a = props.expanded) != null ? _a : props.defaultExpanded);
6623
+ const [expanded, setExpanded] = (0, import_react37.useState)((_a = props.expanded) != null ? _a : props.defaultExpanded);
5803
6624
  const onClick = () => {
5804
6625
  var _a2;
5805
6626
  (_a2 = props.onChange) == null ? void 0 : _a2.call(props, !expanded);
@@ -5807,12 +6628,12 @@ function ExpanderIcon(props) {
5807
6628
  setExpanded(!expanded);
5808
6629
  }
5809
6630
  };
5810
- React28.useEffect(() => {
6631
+ React32.useEffect(() => {
5811
6632
  if (isControlled("expanded", props)) {
5812
6633
  setExpanded(props.expanded);
5813
6634
  }
5814
6635
  }, [props.expanded]);
5815
- return /* @__PURE__ */ React28.createElement("svg", {
6636
+ return /* @__PURE__ */ React32.createElement("svg", {
5816
6637
  "data-name": "expander-icon",
5817
6638
  xmlns: "http://www.w3.org/2000/svg",
5818
6639
  height: `${size}px`,
@@ -5823,20 +6644,20 @@ function ExpanderIcon(props) {
5823
6644
  className: join(props.className, ExpanderIconCls, ExpanderIconClsVariants({
5824
6645
  expanded
5825
6646
  }), "InfiniteIcon", "InfiniteIcon-expander", `InfiniteIcon-expander--${expanded ? "expanded" : "collapsed"}`)
5826
- }, /* @__PURE__ */ React28.createElement("path", {
6647
+ }, /* @__PURE__ */ React32.createElement("path", {
5827
6648
  d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"
5828
6649
  }));
5829
6650
  }
5830
6651
 
5831
6652
  // src/components/InfiniteTable/components/icons/LoadingIcon.tsx
5832
- var React29 = __toModule(require("react"));
6653
+ var React33 = __toModule(require("react"));
5833
6654
 
5834
6655
  // src/components/InfiniteTable/components/icons/LoadingIcon.css.ts
5835
- var LoadingIconCls = "_16lm1iw8 _16lm1iwg _16lm1iwd";
6656
+ var LoadingIconCls = "_16lm1iw8 _16lm1iwh _16lm1iwd";
5836
6657
 
5837
6658
  // src/components/InfiniteTable/components/icons/LoadingIcon.tsx
5838
6659
  var LoadingIcon = (props) => {
5839
- return /* @__PURE__ */ React29.createElement("svg", {
6660
+ return /* @__PURE__ */ React33.createElement("svg", {
5840
6661
  xmlns: "http://www.w3.org/2000/svg",
5841
6662
  style: {
5842
6663
  margin: "auto",
@@ -5848,14 +6669,14 @@ var LoadingIcon = (props) => {
5848
6669
  viewBox: "0 0 100 100",
5849
6670
  preserveAspectRatio: "xMidYMid",
5850
6671
  className: join(props.className, LoadingIconCls, "InfiniteIcon", "InfiniteIcon-loading")
5851
- }, /* @__PURE__ */ React29.createElement("circle", {
6672
+ }, /* @__PURE__ */ React33.createElement("circle", {
5852
6673
  cx: "50",
5853
6674
  cy: "50",
5854
6675
  fill: "none",
5855
6676
  strokeWidth: "10",
5856
6677
  r: "35",
5857
6678
  strokeDasharray: "164.93361431346415 56.97787143782138"
5858
- }, /* @__PURE__ */ React29.createElement("animateTransform", {
6679
+ }, /* @__PURE__ */ React33.createElement("animateTransform", {
5859
6680
  attributeName: "transform",
5860
6681
  type: "rotate",
5861
6682
  repeatCount: "indefinite",
@@ -5875,7 +6696,7 @@ function getGroupColumnRender({
5875
6696
  var _a, _b, _c;
5876
6697
  let { value, rowInfo, column, groupBy, pivotBy } = renderOptions;
5877
6698
  if (column.renderValue) {
5878
- value = /* @__PURE__ */ React30.createElement(RenderHookComponent, {
6699
+ value = /* @__PURE__ */ React34.createElement(RenderHookComponent, {
5879
6700
  render: column.renderValue,
5880
6701
  renderParam: renderOptions
5881
6702
  });
@@ -5905,22 +6726,22 @@ function getGroupColumnRender({
5905
6726
  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);
5906
6727
  const isLoading = showLoadingIcon(groupRowInfo);
5907
6728
  if (isLoading) {
5908
- icon = /* @__PURE__ */ React30.createElement(LoadingIcon, null);
6729
+ icon = /* @__PURE__ */ React34.createElement(LoadingIcon, null);
5909
6730
  } else if (showExpanderIcon) {
5910
- const defaultIcon = /* @__PURE__ */ React30.createElement(ExpanderIcon, {
6731
+ const defaultIcon = /* @__PURE__ */ React34.createElement(ExpanderIcon, {
5911
6732
  expanded: !collapsed,
5912
6733
  onChange: () => {
5913
6734
  toggleGroupRow(groupKeys);
5914
6735
  }
5915
6736
  });
5916
- icon = column.renderGroupIcon ? /* @__PURE__ */ React30.createElement(RenderHookComponent, {
6737
+ icon = column.renderGroupIcon ? /* @__PURE__ */ React34.createElement(RenderHookComponent, {
5917
6738
  render: column.renderGroupIcon,
5918
6739
  renderParam: Object.assign({ collapsed, groupIcon: defaultIcon }, renderOptions)
5919
6740
  }) : defaultIcon;
5920
6741
  }
5921
- return /* @__PURE__ */ React30.createElement("div", {
6742
+ return /* @__PURE__ */ React34.createElement("div", {
5922
6743
  className: join(display.flex, alignItems.center)
5923
- }, icon, /* @__PURE__ */ React30.createElement("div", {
6744
+ }, icon, /* @__PURE__ */ React34.createElement("div", {
5924
6745
  className: cssEllipsisClassName
5925
6746
  }, value != null ? value : null));
5926
6747
  };
@@ -5965,9 +6786,9 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
5965
6786
  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;
5966
6787
  const isLoading = showLoadingIcon(rowInfo);
5967
6788
  if (isLoading) {
5968
- icon = /* @__PURE__ */ React30.createElement(LoadingIcon, null);
6789
+ icon = /* @__PURE__ */ React34.createElement(LoadingIcon, null);
5969
6790
  } else if (showExpanderIcon) {
5970
- const defaultIcon = /* @__PURE__ */ React30.createElement(ExpanderIcon, {
6791
+ const defaultIcon = /* @__PURE__ */ React34.createElement(ExpanderIcon, {
5971
6792
  expanded: !collapsed,
5972
6793
  onChange: () => {
5973
6794
  if (!rowInfo.isGroupRow) {
@@ -5982,9 +6803,9 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
5982
6803
  icon = column.renderGroupIcon(renderParam);
5983
6804
  }
5984
6805
  }
5985
- return /* @__PURE__ */ React30.createElement("div", {
6806
+ return /* @__PURE__ */ React34.createElement("div", {
5986
6807
  className: join(display.flex, alignItems.center, GroupRowExpanderCls)
5987
- }, icon, /* @__PURE__ */ React30.createElement("div", {
6808
+ }, icon, /* @__PURE__ */ React34.createElement("div", {
5988
6809
  className: cssEllipsisClassName
5989
6810
  }, value != null ? value : null));
5990
6811
  }
@@ -6000,11 +6821,11 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
6000
6821
  }
6001
6822
 
6002
6823
  // src/components/InfiniteTable/hooks/useEffectWithRaf.ts
6003
- var import_react34 = __toModule(require("react"));
6824
+ var import_react38 = __toModule(require("react"));
6004
6825
  function useEffectWithRaf(fn, deps) {
6005
- const rafId = (0, import_react34.useRef)(0);
6006
- const removeFnRaf = (0, import_react34.useRef)();
6007
- (0, import_react34.useEffect)(() => {
6826
+ const rafId = (0, import_react38.useRef)(0);
6827
+ const removeFnRaf = (0, import_react38.useRef)();
6828
+ (0, import_react38.useEffect)(() => {
6008
6829
  rafId.current = requestAnimationFrame(() => {
6009
6830
  removeFnRaf.current = fn();
6010
6831
  });
@@ -6021,7 +6842,7 @@ function useEffectWithRaf(fn, deps) {
6021
6842
  }
6022
6843
 
6023
6844
  // src/components/InfiniteTable/hooks/useToggleGroupRow.ts
6024
- var import_react37 = __toModule(require("react"));
6845
+ var import_react41 = __toModule(require("react"));
6025
6846
 
6026
6847
  // src/utils/groupAndPivot/index.ts
6027
6848
  var LAZY_ROOT_KEY_FOR_GROUPS = "____root____";
@@ -6474,7 +7295,7 @@ function enhancedFlatten(param) {
6474
7295
  }
6475
7296
 
6476
7297
  // src/components/DataSource/index.tsx
6477
- var React31 = __toModule(require("react"));
7298
+ var React35 = __toModule(require("react"));
6478
7299
 
6479
7300
  // src/utils/multisort/sortTypes.ts
6480
7301
  var numberComparator = function(first, second) {
@@ -6662,15 +7483,15 @@ var GroupRowsState = class {
6662
7483
  };
6663
7484
 
6664
7485
  // src/components/DataSource/privateHooks/useLoadData.ts
6665
- var import_react36 = __toModule(require("react"));
7486
+ var import_react40 = __toModule(require("react"));
6666
7487
 
6667
7488
  // src/components/hooks/useEffectWithChanges.ts
6668
- var import_react35 = __toModule(require("react"));
7489
+ var import_react39 = __toModule(require("react"));
6669
7490
  function useEffectWithChanges(fn, deps) {
6670
- const prevRef = (0, import_react35.useRef)({});
6671
- const oldValuesRef = (0, import_react35.useRef)({});
7491
+ const prevRef = (0, import_react39.useRef)({});
7492
+ const oldValuesRef = (0, import_react39.useRef)({});
6672
7493
  const oldValues = oldValuesRef.current;
6673
- const changesRef = (0, import_react35.useRef)({});
7494
+ const changesRef = (0, import_react39.useRef)({});
6674
7495
  const changes = changesRef.current;
6675
7496
  const useEffectDeps = [];
6676
7497
  for (const k in deps) {
@@ -6683,7 +7504,7 @@ function useEffectWithChanges(fn, deps) {
6683
7504
  }
6684
7505
  }
6685
7506
  prevRef.current = deps;
6686
- (0, import_react35.useEffect)(() => {
7507
+ (0, import_react39.useEffect)(() => {
6687
7508
  const changes2 = changesRef.current;
6688
7509
  const result = fn(changes2, oldValues);
6689
7510
  changesRef.current = {};
@@ -6951,12 +7772,12 @@ function useLoadData() {
6951
7772
  livePaginationCursor,
6952
7773
  cursorId: stateCursorId
6953
7774
  } = componentState;
6954
- const [scrollbars, setScrollbars] = (0, import_react36.useState)({
7775
+ const [scrollbars, setScrollbars] = (0, import_react40.useState)({
6955
7776
  vertical: false,
6956
7777
  horizontal: false
6957
7778
  });
6958
- const scrollbarsRef = (0, import_react36.useRef)(scrollbars);
6959
- (0, import_react36.useEffect)(() => {
7779
+ const scrollbarsRef = (0, import_react40.useRef)(scrollbars);
7780
+ (0, import_react40.useEffect)(() => {
6960
7781
  notifyScrollbarsChange.onChange((scrollbars2) => {
6961
7782
  if (!scrollbars2) {
6962
7783
  return;
@@ -6966,7 +7787,7 @@ function useLoadData() {
6966
7787
  });
6967
7788
  return () => notifyScrollbarsChange.destroy();
6968
7789
  }, [notifyScrollbarsChange]);
6969
- (0, import_react36.useEffect)(() => {
7790
+ (0, import_react40.useEffect)(() => {
6970
7791
  if (!livePagination) {
6971
7792
  return;
6972
7793
  }
@@ -6980,7 +7801,7 @@ function useLoadData() {
6980
7801
  });
6981
7802
  return () => cancelAnimationFrame(frameId);
6982
7803
  }, [livePaginationCursor]);
6983
- (0, import_react36.useEffect)(() => {
7804
+ (0, import_react40.useEffect)(() => {
6984
7805
  if (!livePagination || livePaginationCursor !== void 0) {
6985
7806
  return;
6986
7807
  }
@@ -6994,7 +7815,7 @@ function useLoadData() {
6994
7815
  });
6995
7816
  return () => cancelAnimationFrame(frameId);
6996
7817
  }, [dataArray.length, livePaginationCursor]);
6997
- (0, import_react36.useEffect)(() => {
7818
+ (0, import_react40.useEffect)(() => {
6998
7819
  const state = getComponentState();
6999
7820
  const { livePaginationCursor: livePaginationCursor2, livePagination: livePagination2, dataArray: dataArray2 } = state;
7000
7821
  if (!scrollbars.vertical && livePagination2) {
@@ -7012,7 +7833,7 @@ function useLoadData() {
7012
7833
  filterValue,
7013
7834
  cursorId: livePagination ? stateCursorId : null
7014
7835
  };
7015
- const initialRef = (0, import_react36.useRef)(true);
7836
+ const initialRef = (0, import_react40.useRef)(true);
7016
7837
  useLazyLoadRange();
7017
7838
  useEffectWithChanges(() => {
7018
7839
  const componentState2 = getComponentState();
@@ -7044,7 +7865,7 @@ function useLazyLoadRange() {
7044
7865
  componentActions: actions,
7045
7866
  componentState
7046
7867
  } = useComponentState();
7047
- (0, import_react36.useEffect)(() => {
7868
+ (0, import_react40.useEffect)(() => {
7048
7869
  actions.lazyLoadCacheOfLoadedBatches = new DeepMap();
7049
7870
  }, [componentState.data, componentState.dataParams]);
7050
7871
  const {
@@ -7053,7 +7874,7 @@ function useLazyLoadRange() {
7053
7874
  dataArray,
7054
7875
  scrollStopDelayUpdatedByTable
7055
7876
  } = componentState;
7056
- const latestRenderRangeRef = (0, import_react36.useRef)(null);
7877
+ const latestRenderRangeRef = (0, import_react40.useRef)(null);
7057
7878
  const loadRange = (renderRange, cache = getComponentState().lazyLoadCacheOfLoadedBatches) => {
7058
7879
  const componentState2 = getComponentState();
7059
7880
  renderRange = renderRange || latestRenderRangeRef.current;
@@ -7072,8 +7893,8 @@ function useLazyLoadRange() {
7072
7893
  componentActions: actions
7073
7894
  }, cache);
7074
7895
  };
7075
- const debouncedLoadRange = (0, import_react36.useMemo)(() => debounce(loadRange, { wait: scrollStopDelayUpdatedByTable }), [scrollStopDelayUpdatedByTable]);
7076
- (0, import_react36.useEffect)(() => {
7896
+ const debouncedLoadRange = (0, import_react40.useMemo)(() => debounce(loadRange, { wait: scrollStopDelayUpdatedByTable }), [scrollStopDelayUpdatedByTable]);
7897
+ (0, import_react40.useEffect)(() => {
7077
7898
  if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
7078
7899
  return notifyRenderRangeChange.onChange((renderRange) => {
7079
7900
  latestRenderRangeRef.current = renderRange;
@@ -7082,7 +7903,7 @@ function useLazyLoadRange() {
7082
7903
  }
7083
7904
  return;
7084
7905
  }, [lazyLoadBatchSize]);
7085
- (0, import_react36.useEffect)(() => {
7906
+ (0, import_react40.useEffect)(() => {
7086
7907
  if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
7087
7908
  debouncedLoadRange();
7088
7909
  }
@@ -7866,7 +8687,7 @@ function concludeReducer(params) {
7866
8687
  }
7867
8688
  state.dataArray = rowInfoDataArray;
7868
8689
  state.reducedAt = now;
7869
- if (true) {
8690
+ if (false) {
7870
8691
  globalThis.state = state;
7871
8692
  }
7872
8693
  return state;
@@ -7885,7 +8706,7 @@ function DataSourceWithContext(props) {
7885
8706
  if (typeof children === "function") {
7886
8707
  children = children(computedValues);
7887
8708
  }
7888
- return /* @__PURE__ */ React31.createElement(React31.Fragment, null, children);
8709
+ return /* @__PURE__ */ React35.createElement(React35.Fragment, null, children);
7889
8710
  }
7890
8711
  var DataSourceRoot = getComponentStateRoot({
7891
8712
  initSetupState,
@@ -7904,18 +8725,18 @@ function DataSourceCmp({ children }) {
7904
8725
  componentActions,
7905
8726
  getState
7906
8727
  };
7907
- if (true) {
8728
+ if (false) {
7908
8729
  globalThis.getDataSourceState = getState;
7909
8730
  }
7910
8731
  useLoadData();
7911
- return /* @__PURE__ */ React31.createElement(DataSourceContext.Provider, {
8732
+ return /* @__PURE__ */ React35.createElement(DataSourceContext.Provider, {
7912
8733
  value: contextValue
7913
- }, /* @__PURE__ */ React31.createElement(DataSourceWithContext, {
8734
+ }, /* @__PURE__ */ React35.createElement(DataSourceWithContext, {
7914
8735
  children
7915
8736
  }));
7916
8737
  }
7917
8738
  function DataSource(props) {
7918
- return /* @__PURE__ */ React31.createElement(DataSourceRoot, __spreadValues({}, props), /* @__PURE__ */ React31.createElement(DataSourceCmp, {
8739
+ return /* @__PURE__ */ React35.createElement(DataSourceRoot, __spreadValues({}, props), /* @__PURE__ */ React35.createElement(DataSourceCmp, {
7919
8740
  children: props.children
7920
8741
  }));
7921
8742
  }
@@ -7923,7 +8744,7 @@ function DataSource(props) {
7923
8744
  // src/components/InfiniteTable/hooks/useToggleGroupRow.ts
7924
8745
  function useToggleGroupRow() {
7925
8746
  const { getState: getDataSourceState, componentActions: dataSourceActions } = useDataSourceContextValue();
7926
- const toggleGroupRow = (0, import_react37.useCallback)((groupKeys) => {
8747
+ const toggleGroupRow = (0, import_react41.useCallback)((groupKeys) => {
7927
8748
  const state = getDataSourceState();
7928
8749
  const newState = new GroupRowsState(state.groupRowsState);
7929
8750
  newState.toggleGroupRow(groupKeys);
@@ -7955,7 +8776,7 @@ function useToggleGroupRow() {
7955
8776
 
7956
8777
  // src/components/InfiniteTable/hooks/useColumnsWhen.ts
7957
8778
  function useGroupByMap(groupBy) {
7958
- const groupByMap = (0, import_react38.useMemo)(() => {
8779
+ const groupByMap = (0, import_react42.useMemo)(() => {
7959
8780
  return groupBy.reduce((acc, groupBy2, index) => {
7960
8781
  acc.set(groupBy2.field, {
7961
8782
  groupBy: groupBy2,
@@ -7979,13 +8800,13 @@ function useColumnsWhen() {
7979
8800
  }
7980
8801
  } = useComponentState();
7981
8802
  const groupByMap = useGroupByMap(groupBy);
7982
- (0, import_react38.useEffect)(() => {
8803
+ (0, import_react42.useEffect)(() => {
7983
8804
  dataSourceActions.generateGroupRows = groupRenderStrategy !== "inline";
7984
8805
  }, [groupRenderStrategy]);
7985
- (0, import_react38.useEffect)(() => {
8806
+ (0, import_react42.useEffect)(() => {
7986
8807
  dataSourceActions.pivotTotalColumnPosition = pivotTotalColumnPosition;
7987
8808
  }, [pivotTotalColumnPosition]);
7988
- (0, import_react38.useEffect)(() => {
8809
+ (0, import_react42.useEffect)(() => {
7989
8810
  if (pivotGrandTotalColumnPosition != void 0) {
7990
8811
  dataSourceActions.pivotGrandTotalColumnPosition = pivotGrandTotalColumnPosition;
7991
8812
  }
@@ -8059,7 +8880,7 @@ function useColumnsWhenInlineGroupRenderStrategy(groupByMap) {
8059
8880
  });
8060
8881
  return computedColumns.size === 0 ? void 0 : computedColumns;
8061
8882
  }
8062
- (0, import_react38.useEffect)(() => {
8883
+ (0, import_react42.useEffect)(() => {
8063
8884
  const update = () => {
8064
8885
  componentActions.columnsWhenInlineGroupRenderStrategy = computeColumnsWhenInlineGroupRenderStrategy(columns, groupByMap, groupRenderStrategy, toggleGroupRow);
8065
8886
  };
@@ -8088,7 +8909,7 @@ function useColumnsWhenGrouping() {
8088
8909
  }
8089
8910
  } = useComponentState();
8090
8911
  const toggleGroupRow = useToggleGroupRow();
8091
- (0, import_react38.useEffect)(() => {
8912
+ (0, import_react42.useEffect)(() => {
8092
8913
  const update = () => {
8093
8914
  const columnsWhenGrouping = getColumnsWhenGrouping({
8094
8915
  columns,
@@ -8224,7 +9045,7 @@ function useHideColumns(groupByMap) {
8224
9045
  hideEmptyGroupColumns ? groupRowsState : null,
8225
9046
  hideEmptyGroupColumns
8226
9047
  ]);
8227
- (0, import_react38.useEffect)(() => {
9048
+ (0, import_react42.useEffect)(() => {
8228
9049
  const isGrouped = groupBy.length > 0;
8229
9050
  const currentState = getComponentState();
8230
9051
  const { controlledColumnVisibility, columnVisibility } = currentState;
@@ -8339,139 +9160,7 @@ function getColumnsWhenGrouping(params) {
8339
9160
  }
8340
9161
 
8341
9162
  // src/components/InfiniteTable/hooks/useComputedVisibleColumns.ts
8342
- var import_react40 = __toModule(require("react"));
8343
-
8344
- // src/components/flexbox/index.ts
8345
- var computeFlex = (params) => {
8346
- const {
8347
- availableSize,
8348
- items,
8349
- minSize: defaultMinSize,
8350
- maxSize: defaultMaxSize
8351
- } = params;
8352
- if (availableSize < 0) {
8353
- throw "The provided availableSize cannot be negative!";
8354
- }
8355
- let totalFixedSize = 0;
8356
- let totalFlex = 0;
8357
- let totalFlexCount = 0;
8358
- items.forEach((item, i) => {
8359
- var _a, _b, _c, _d, _e, _f;
8360
- let maxSize = (_b = (_a = item.maxSize) != null ? _a : defaultMaxSize) != null ? _b : void 0;
8361
- let minSize = (_d = (_c = item.minSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
8362
- if (item.size != null) {
8363
- if (maxSize != null && item.size > maxSize) {
8364
- item.size = maxSize;
8365
- }
8366
- if (minSize != null && item.size < minSize) {
8367
- item.size = minSize;
8368
- }
8369
- }
8370
- if (item.size == null && item.flex == null) {
8371
- throw `Items must specify either a size or a flex property. Item at index ${i} doesn't have either of those.`;
8372
- }
8373
- if (item.flex != null) {
8374
- totalFlexCount += 1;
8375
- }
8376
- totalFlex += (_e = item.flex) != null ? _e : 0;
8377
- totalFixedSize += (_f = item.size) != null ? _f : 0;
8378
- });
8379
- let availableSizeForFlex = Math.max(availableSize - totalFixedSize, 0);
8380
- let sizePerFlex = availableSizeForFlex / totalFlex;
8381
- let maxxedFlexItems = {};
8382
- let minnedFlexItems = {};
8383
- let constrainedCount = 0;
8384
- items.forEach((item, index) => {
8385
- var _a, _b, _c, _d;
8386
- if (item.flex != null) {
8387
- const approxFlexSize = sizePerFlex * item.flex;
8388
- let maxSize = (_b = (_a = item.maxSize) != null ? _a : defaultMaxSize) != null ? _b : void 0;
8389
- let minSize = (_d = (_c = item.minSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
8390
- let constrained = false;
8391
- let substractSize = 0;
8392
- if (maxSize != null && approxFlexSize > maxSize) {
8393
- maxxedFlexItems[index] = true;
8394
- constrained = true;
8395
- substractSize = maxSize;
8396
- }
8397
- if (minSize != null && approxFlexSize < minSize) {
8398
- minnedFlexItems[index] = true;
8399
- constrained = true;
8400
- substractSize = minSize;
8401
- }
8402
- if (constrained) {
8403
- constrainedCount += 1;
8404
- totalFlexCount -= 1;
8405
- totalFlex -= item.flex;
8406
- availableSizeForFlex -= substractSize;
8407
- }
8408
- }
8409
- });
8410
- if (constrainedCount) {
8411
- sizePerFlex = availableSizeForFlex / totalFlex;
8412
- }
8413
- let flexSizes = [];
8414
- let currentFlexCount = 0;
8415
- let remainingSizeForFlex = availableSizeForFlex;
8416
- let remainingFlex = totalFlex;
8417
- let totalTakenSize = 0;
8418
- let flexSizeSum = 0;
8419
- const computedSizes = [];
8420
- const resultItems = items.map((item, index) => {
8421
- var _a, _b, _c, _d, _e;
8422
- const sizedItem = __spreadValues({}, item);
8423
- let maxSize = (_b = (_a = item.maxSize) != null ? _a : defaultMaxSize) != null ? _b : void 0;
8424
- let minSize = (_d = (_c = item.minSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
8425
- let flexSize = 0;
8426
- const maxxed = maxxedFlexItems[index];
8427
- const minned = minnedFlexItems[index];
8428
- const constrained = maxxed || minned;
8429
- let computedSize = (_e = item.size) != null ? _e : 0;
8430
- if (item.flex != null) {
8431
- if (constrained) {
8432
- if (minned) {
8433
- flexSize = minSize;
8434
- }
8435
- if (maxxed) {
8436
- flexSize = maxSize;
8437
- }
8438
- } else {
8439
- currentFlexCount += 1;
8440
- const constrain = (size) => {
8441
- if (maxSize != null && size > maxSize) {
8442
- size = maxSize;
8443
- }
8444
- if (minSize != null && size < minSize) {
8445
- size = minSize;
8446
- }
8447
- return size;
8448
- };
8449
- if (currentFlexCount === totalFlexCount) {
8450
- flexSize = constrain(remainingSizeForFlex);
8451
- } else {
8452
- flexSize = constrain(Math.round(item.flex * sizePerFlex));
8453
- flexSizeSum += flexSize;
8454
- remainingSizeForFlex = availableSizeForFlex - flexSizeSum;
8455
- remainingFlex -= item.flex;
8456
- sizePerFlex = remainingSizeForFlex / remainingFlex;
8457
- }
8458
- }
8459
- computedSize = flexSize;
8460
- sizedItem.flexSize = flexSize;
8461
- }
8462
- flexSizes.push(flexSize);
8463
- computedSizes.push(computedSize);
8464
- sizedItem.computedSize = computedSize;
8465
- totalTakenSize += computedSize;
8466
- return sizedItem;
8467
- });
8468
- return {
8469
- items: resultItems,
8470
- flexSizes,
8471
- computedSizes,
8472
- remainingSize: Math.round(availableSize - totalTakenSize)
8473
- };
8474
- };
9163
+ var import_react44 = __toModule(require("react"));
8475
9164
 
8476
9165
  // src/components/InfiniteTable/utils/adjustColumnOrderForPinning.ts
8477
9166
  var order = ["start", void 0, "end"];
@@ -8540,6 +9229,7 @@ var getComputedVisibleColumns = ({
8540
9229
  setSortInfo,
8541
9230
  multiSort,
8542
9231
  viewportReservedWidth,
9232
+ resizableColumns,
8543
9233
  draggableColumns,
8544
9234
  columnOrder,
8545
9235
  columnPinning,
@@ -8624,7 +9314,7 @@ var getComputedVisibleColumns = ({
8624
9314
  };
8625
9315
  })
8626
9316
  });
8627
- const { computedSizes } = flexResult;
9317
+ const { computedSizes, flexSizes, minSizes, maxSizes } = flexResult;
8628
9318
  const computedPinnedStartColumns = [];
8629
9319
  const computedPinnedEndColumns = [];
8630
9320
  const computedUnpinnedColumns = [];
@@ -8652,7 +9342,7 @@ var getComputedVisibleColumns = ({
8652
9342
  });
8653
9343
  const firstPinnedEndAbsoluteOffset = bodySize.width - totalPinnedEndWidth;
8654
9344
  columnsArray.forEach((c, i) => {
8655
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
9345
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
8656
9346
  const id = visibleColumnOrder[i];
8657
9347
  const nextColumnId = visibleColumnOrder[i + 1];
8658
9348
  const colType = getColumnComputedType(c, columnTypes);
@@ -8663,6 +9353,9 @@ var getComputedVisibleColumns = ({
8663
9353
  const computedSortedDesc = computedSorted && !computedSortedAsc;
8664
9354
  const computedSortIndex = (_c = sortingInfo == null ? void 0 : sortingInfo.index) != null ? _c : -1;
8665
9355
  const computedWidth = computedSizes[i];
9356
+ const computedFlex = flexSizes[i] || null;
9357
+ const computedMinWidth = minSizes[i] || 0;
9358
+ const computedMaxWidth = maxSizes[i] || 1e4;
8666
9359
  const computedPinned = getComputedPinned(id, columnPinning);
8667
9360
  const computedLast = i === visibleColumnOrder.length - 1;
8668
9361
  const computedPinningOffset = computedPinned === "start" ? computedPinnedStartColumnsWidth : computedPinned === "end" ? computedPinnedEndColumnsWidth : computedOffset - computedPinnedStartColumnsWidth;
@@ -8696,8 +9389,13 @@ var getComputedVisibleColumns = ({
8696
9389
  render: colType.render,
8697
9390
  style: colType.style,
8698
9391
  components: colType.components,
9392
+ columnGroup: colType.columnGroup,
8699
9393
  field
8700
9394
  }, c), {
9395
+ computedResizable: (_s = (_r = (_q = c.resizable) != null ? _q : colType.resizable) != null ? _r : resizableColumns) != null ? _s : true,
9396
+ computedMinWidth,
9397
+ computedMaxWidth,
9398
+ computedFlex,
8701
9399
  computedDataType,
8702
9400
  computedSortType,
8703
9401
  computedFilterType,
@@ -8719,7 +9417,7 @@ var getComputedVisibleColumns = ({
8719
9417
  computedSortedDesc,
8720
9418
  computedVisibleIndex: i,
8721
9419
  computedPinned,
8722
- computedDraggable: (_r = (_q = c.draggable) != null ? _q : draggableColumns) != null ? _r : true,
9420
+ computedDraggable: (_u = (_t = c.draggable) != null ? _t : draggableColumns) != null ? _u : true,
8723
9421
  computedFirstInCategory,
8724
9422
  computedLastInCategory,
8725
9423
  computedFirst: i === 0,
@@ -8769,7 +9467,7 @@ var getComputedVisibleColumns = ({
8769
9467
  setSortInfo(finalSortInfo);
8770
9468
  },
8771
9469
  id,
8772
- header: (_u = (_t = (_s = c.header) != null ? _s : colType.header) != null ? _t : c.name) != null ? _u : c.field
9470
+ header: (_x = (_w = (_v = c.header) != null ? _v : colType.header) != null ? _w : c.name) != null ? _x : c.field
8773
9471
  });
8774
9472
  computedOffset += computedWidth;
8775
9473
  computedVisibleColumnsMap.set(result2.id, result2);
@@ -8810,10 +9508,10 @@ var getComputedVisibleColumns = ({
8810
9508
  };
8811
9509
 
8812
9510
  // src/components/InfiniteTable/hooks/useRerenderOnKeyChange.ts
8813
- var import_react39 = __toModule(require("react"));
9511
+ var import_react43 = __toModule(require("react"));
8814
9512
  var useRerenderOnKeyChange = (map2) => {
8815
9513
  const [renderId, rerender] = useRerender();
8816
- (0, import_react39.useEffect)(() => {
9514
+ (0, import_react43.useEffect)(() => {
8817
9515
  const update = rafFn(rerender);
8818
9516
  return interceptMap(map2, {
8819
9517
  set: update,
@@ -8845,6 +9543,7 @@ var useComputedVisibleColumns = ({
8845
9543
  pinnedEndMaxWidth,
8846
9544
  pinnedStartMaxWidth,
8847
9545
  viewportReservedWidth,
9546
+ resizableColumns,
8848
9547
  columnVisibility,
8849
9548
  columnVisibilityAssumeVisible,
8850
9549
  columnSizing
@@ -8866,7 +9565,7 @@ var useComputedVisibleColumns = ({
8866
9565
  computedPinnedEndOffset,
8867
9566
  computedPinnedEndWidth,
8868
9567
  computedPinnedStartWidth
8869
- } = (0, import_react40.useMemo)(() => {
9568
+ } = (0, import_react44.useMemo)(() => {
8870
9569
  return getComputedVisibleColumns({
8871
9570
  columns,
8872
9571
  bodySize,
@@ -8876,6 +9575,7 @@ var useComputedVisibleColumns = ({
8876
9575
  columnCssEllipsis,
8877
9576
  columnHeaderCssEllipsis,
8878
9577
  viewportReservedWidth,
9578
+ resizableColumns,
8879
9579
  filterValue,
8880
9580
  sortable,
8881
9581
  sortInfo,
@@ -8897,6 +9597,7 @@ var useComputedVisibleColumns = ({
8897
9597
  columnMinWidth,
8898
9598
  columnMaxWidth,
8899
9599
  columnDefaultWidth,
9600
+ viewportReservedWidth,
8900
9601
  sortable,
8901
9602
  sortInfo,
8902
9603
  setSortInfo,
@@ -8934,7 +9635,7 @@ var useComputedVisibleColumns = ({
8934
9635
  };
8935
9636
 
8936
9637
  // src/components/InfiniteTable/hooks/useScrollbars.ts
8937
- var import_react41 = __toModule(require("react"));
9638
+ var import_react45 = __toModule(require("react"));
8938
9639
  var INITIAL_SCROLLBARS = {
8939
9640
  vertical: false,
8940
9641
  horizontal: false
@@ -8942,8 +9643,8 @@ var INITIAL_SCROLLBARS = {
8942
9643
  function useScrollbars(brain) {
8943
9644
  const { getComponentState: getInfiniteTableState } = useComponentState();
8944
9645
  const { getState: getDataSourceState } = useDataSourceContextValue();
8945
- const [scrollbars, setScrollbars] = (0, import_react41.useState)(INITIAL_SCROLLBARS);
8946
- (0, import_react41.useEffect)(() => {
9646
+ const [scrollbars, setScrollbars] = (0, import_react45.useState)(INITIAL_SCROLLBARS);
9647
+ (0, import_react45.useEffect)(() => {
8947
9648
  return brain.onRenderCountChange(() => {
8948
9649
  const { scrollTopMax, scrollLeftMax } = brain;
8949
9650
  setScrollbars({
@@ -8952,7 +9653,7 @@ function useScrollbars(brain) {
8952
9653
  });
8953
9654
  });
8954
9655
  }, [brain]);
8955
- (0, import_react41.useLayoutEffect)(() => {
9656
+ (0, import_react45.useLayoutEffect)(() => {
8956
9657
  const dataSourceState = getDataSourceState();
8957
9658
  const { onScrollbarsChange } = getInfiniteTableState();
8958
9659
  const { notifyScrollbarsChange } = dataSourceState;
@@ -8983,7 +9684,7 @@ function useComputed() {
8983
9684
  bodySize,
8984
9685
  showSeparatePivotColumnForSingleAggregation
8985
9686
  } = componentState;
8986
- (0, import_react42.useState)(() => {
9687
+ (0, import_react46.useState)(() => {
8987
9688
  componentState.onRowHeightCSSVarChange.onChange((rowHeight) => {
8988
9689
  if (rowHeight) {
8989
9690
  componentActions.rowHeight = rowHeight;
@@ -8995,13 +9696,13 @@ function useComputed() {
8995
9696
  }
8996
9697
  });
8997
9698
  });
8998
- (0, import_react42.useEffect)(() => {
9699
+ (0, import_react46.useEffect)(() => {
8999
9700
  dataSourceActions.showSeparatePivotColumnForSingleAggregation = showSeparatePivotColumnForSingleAggregation;
9000
9701
  }, [showSeparatePivotColumnForSingleAggregation]);
9001
9702
  const { multiSort, filterValue } = dataSourceState;
9002
9703
  useColumnGroups();
9003
9704
  const { toggleGroupRow } = useColumnsWhen();
9004
- const setSortInfo = (0, import_react42.useCallback)((sortInfo) => {
9705
+ const setSortInfo = (0, import_react46.useCallback)((sortInfo) => {
9005
9706
  var _a2;
9006
9707
  const newSortInfo = getDataSourceState().multiSort ? sortInfo : (_a2 = sortInfo[0]) != null ? _a2 : null;
9007
9708
  dataSourceActions.sortInfo = newSortInfo;
@@ -9033,6 +9734,7 @@ function useComputed() {
9033
9734
  pinnedEndMaxWidth: componentState.pinnedEndMaxWidth,
9034
9735
  bodySize,
9035
9736
  viewportReservedWidth: componentState.viewportReservedWidth,
9737
+ resizableColumns: componentState.resizableColumns,
9036
9738
  sortable: componentState.sortable,
9037
9739
  draggableColumns: componentState.draggableColumns,
9038
9740
  sortInfo: (_a = dataSourceState.sortInfo) != null ? _a : void 0,
@@ -9078,6 +9780,10 @@ function useComputed() {
9078
9780
  }
9079
9781
 
9080
9782
  // src/components/InfiniteTable/hooks/useDOMProps.ts
9783
+ var columnWidthAtIndex4 = stripVar(InternalVars.columnWidthAtIndex);
9784
+ var columnOffsetAtIndex2 = stripVar(InternalVars.columnOffsetAtIndex);
9785
+ var activeCellColWidth = stripVar(InternalVars.activeCellColWidth);
9786
+ var activeCellColOffset = stripVar(InternalVars.activeCellColOffset);
9081
9787
  function useDOMProps(initialDOMProps) {
9082
9788
  const { computed, componentState, componentActions } = useInfiniteTable();
9083
9789
  const {
@@ -9088,9 +9794,24 @@ function useDOMProps(initialDOMProps) {
9088
9794
  onBlurWithin,
9089
9795
  onFocusWithin,
9090
9796
  onSelfFocus,
9091
- onSelfBlur
9797
+ onSelfBlur,
9798
+ activeCellIndex
9092
9799
  } = componentState;
9093
- const { computedPinnedStartColumnsWidth, computedPinnedEndColumnsWidth } = computed;
9800
+ const {
9801
+ computedPinnedStartColumnsWidth,
9802
+ computedPinnedEndColumnsWidth,
9803
+ computedVisibleColumns
9804
+ } = computed;
9805
+ const cssVars = computedVisibleColumns.reduce((vars, col) => {
9806
+ const index = col.computedVisibleIndex;
9807
+ vars[`${columnWidthAtIndex4}-${index}`] = col.computedWidth + "px";
9808
+ vars[`${columnOffsetAtIndex2}-${index}`] = col.computedOffset + "px";
9809
+ return vars;
9810
+ }, {});
9811
+ if (activeCellIndex != null) {
9812
+ cssVars[activeCellColWidth] = `var(${getCSSVarNameForColWidth(activeCellIndex[1])})`;
9813
+ cssVars[activeCellColOffset] = `var(${getCSSVarNameForColOffset(activeCellIndex[1])})`;
9814
+ }
9094
9815
  const setFocused = rafFn((focused2) => {
9095
9816
  componentActions.focused = focused2;
9096
9817
  });
@@ -9145,7 +9866,7 @@ function useDOMProps(initialDOMProps) {
9145
9866
  focusedWithin
9146
9867
  }));
9147
9868
  domProps.className = className;
9148
- domProps.style = __spreadValues({}, initialDOMProps == null ? void 0 : initialDOMProps.style);
9869
+ domProps.style = __spreadValues(__spreadValues({}, initialDOMProps == null ? void 0 : initialDOMProps.style), cssVars);
9149
9870
  if (focused) {
9150
9871
  if (componentState.focusedStyle) {
9151
9872
  Object.assign(domProps.style, componentState.focusedStyle);
@@ -9160,7 +9881,7 @@ function useDOMProps(initialDOMProps) {
9160
9881
  }
9161
9882
 
9162
9883
  // src/components/InfiniteTable/hooks/useLicense/useLicense.ts
9163
- var import_react43 = __toModule(require("react"));
9884
+ var import_react47 = __toModule(require("react"));
9164
9885
 
9165
9886
  // src/components/InfiniteTable/hooks/useLicense/crc32.ts
9166
9887
  var DEFAULT_ReversedPolynomial = 3988292384;
@@ -9318,10 +10039,10 @@ var isInsideSandbox = () => {
9318
10039
  };
9319
10040
  var isInsidePlayground = isInsideSandbox() || isInsideSandpack();
9320
10041
  var useLicense = (licenseKey = "") => {
9321
- const valid = (0, import_react43.useMemo)(() => {
10042
+ const valid = (0, import_react47.useMemo)(() => {
9322
10043
  let valid2 = isValidLicense(licenseKey, {
9323
10044
  publishedAt: 1624970570587,
9324
- version: "0.3.10"
10045
+ version: "0.3.13"
9325
10046
  });
9326
10047
  if (!licenseKey && !valid2 && isInsidePlayground) {
9327
10048
  return true;
@@ -9452,10 +10173,23 @@ function handleCellNavigation(options) {
9452
10173
  actions.activeCellIndex = [rowIndex, colIndex];
9453
10174
  return true;
9454
10175
  }
10176
+ var validKeys = {
10177
+ ArrowUp: true,
10178
+ ArrowDown: true,
10179
+ ArrowLeft: true,
10180
+ ArrowRight: true,
10181
+ PageUp: true,
10182
+ PageDown: true,
10183
+ Home: true,
10184
+ End: true
10185
+ };
9455
10186
  function handleKeyboardNavigation(options) {
9456
10187
  const { getState } = options;
9457
10188
  const state = getState();
9458
10189
  const { activeRowIndex, activeCellIndex, keyboardNavigation } = state;
10190
+ if (!validKeys[options.key]) {
10191
+ return false;
10192
+ }
9459
10193
  if (activeRowIndex != null && keyboardNavigation === "row") {
9460
10194
  return handleRowNavigation(options);
9461
10195
  }
@@ -9466,7 +10200,7 @@ function handleKeyboardNavigation(options) {
9466
10200
  }
9467
10201
 
9468
10202
  // src/components/InfiniteTable/state/getInitialState.ts
9469
- var import_react44 = __toModule(require("react"));
10203
+ var import_react48 = __toModule(require("react"));
9470
10204
 
9471
10205
  // src/components/VirtualBrain/ScrollListener.ts
9472
10206
  var initialScrollPosition = {
@@ -9544,14 +10278,15 @@ function initSetupState2() {
9544
10278
  scrollTop: 0
9545
10279
  });
9546
10280
  });
9547
- if (true) {
10281
+ if (false) {
9548
10282
  globalThis.brain = brain;
10283
+ globalThis.headerBrain = headerBrain;
9549
10284
  }
9550
10285
  const { renderer, onRenderUpdater } = createRenderer2(brain);
9551
10286
  brain.onAvailableSizeChange((size) => {
9552
10287
  headerBrain.setAvailableSize({ width: size.width });
9553
10288
  });
9554
- if (true) {
10289
+ if (false) {
9555
10290
  globalThis.renderer = renderer;
9556
10291
  }
9557
10292
  return {
@@ -9561,9 +10296,10 @@ function initSetupState2() {
9561
10296
  brain,
9562
10297
  headerBrain,
9563
10298
  columnShifts: null,
9564
- domRef: (0, import_react44.createRef)(),
9565
- scrollerDOMRef: (0, import_react44.createRef)(),
9566
- portalDOMRef: (0, import_react44.createRef)(),
10299
+ domRef: (0, import_react48.createRef)(),
10300
+ scrollerDOMRef: (0, import_react48.createRef)(),
10301
+ portalDOMRef: (0, import_react48.createRef)(),
10302
+ activeCellIndicatorDOMRef: (0, import_react48.createRef)(),
9567
10303
  onRowHeightCSSVarChange: buildSubscriptionCallback(),
9568
10304
  onColumnHeaderHeightCSSVarChange: buildSubscriptionCallback(),
9569
10305
  bodySize: {
@@ -9617,8 +10353,9 @@ var forwardProps3 = (setupState) => {
9617
10353
  scrollStopDelay: (scrollStopDelay) => scrollStopDelay != null ? scrollStopDelay : 250,
9618
10354
  filterEditors: (filterEditors) => __spreadValues(__spreadValues({}, defaultFilterEditors), filterEditors),
9619
10355
  viewportReservedWidth: (viewportReservedWidth) => viewportReservedWidth != null ? viewportReservedWidth : 0,
10356
+ resizableColumns: (resizableColumns) => resizableColumns != null ? resizableColumns : true,
9620
10357
  columnMinWidth: (columnMinWidth) => columnMinWidth != null ? columnMinWidth : 30,
9621
- columnMaxWidth: (columnMaxWidth) => columnMaxWidth != null ? columnMaxWidth : 2e3,
10358
+ columnMaxWidth: (columnMaxWidth) => columnMaxWidth != null ? columnMaxWidth : 5e3,
9622
10359
  columnDefaultWidth: (columnDefaultWidth) => columnDefaultWidth != null ? columnDefaultWidth : 200,
9623
10360
  columnCssEllipsis: (columnCssEllipsis) => columnCssEllipsis != null ? columnCssEllipsis : true,
9624
10361
  draggableColumns: (draggableColumns) => draggableColumns != null ? draggableColumns : true,
@@ -9664,6 +10401,19 @@ function getGroupRenderStrategy(options) {
9664
10401
  }
9665
10402
  return "multi-column";
9666
10403
  }
10404
+ var cleanupState = (state) => {
10405
+ state.brain.destroy();
10406
+ state.headerBrain.destroy();
10407
+ state.renderer.destroy();
10408
+ state.onRenderUpdater.destroy();
10409
+ state.domRef.current = null;
10410
+ state.scrollerDOMRef.current = null;
10411
+ state.portalDOMRef.current = null;
10412
+ state.onRowHeightCSSVarChange.destroy();
10413
+ state.onColumnHeaderHeightCSSVarChange.destroy();
10414
+ state.pinnedEndScrollListener.destroy();
10415
+ state.pinnedStartScrollListener.destroy();
10416
+ };
9667
10417
  var mapPropsToState2 = (params) => {
9668
10418
  var _a, _b;
9669
10419
  const { props, state, oldState, parentState } = params;
@@ -9700,6 +10450,7 @@ var InfiniteTableRoot = getComponentStateRoot({
9700
10450
  initSetupState: initSetupState2,
9701
10451
  forwardProps: forwardProps3,
9702
10452
  mapPropsToState: mapPropsToState2,
10453
+ cleanup: cleanupState,
9703
10454
  allowedControlledPropOverrides: {
9704
10455
  rowHeight: true,
9705
10456
  columnHeaderHeight: true
@@ -9707,7 +10458,7 @@ var InfiniteTableRoot = getComponentStateRoot({
9707
10458
  getParentState: () => useDataSource(),
9708
10459
  debugName: "InfiniteTable"
9709
10460
  });
9710
- var InfiniteTableComponent = React32.memo(function InfiniteTableComponent2() {
10461
+ var InfiniteTableComponent = React36.memo(function InfiniteTableComponent2() {
9711
10462
  var _a;
9712
10463
  const {
9713
10464
  componentState,
@@ -9721,7 +10472,7 @@ var InfiniteTableComponent = React32.memo(function InfiniteTableComponent2() {
9721
10472
  getState: getDataSourceState,
9722
10473
  componentActions: dataSourceActions
9723
10474
  } = useDataSourceContextValue();
9724
- const [imperativeApi] = (0, import_react45.useState)(() => {
10475
+ const [imperativeApi] = (0, import_react49.useState)(() => {
9725
10476
  return getImperativeApi(getState, getComputed, getDataSourceState, actions);
9726
10477
  });
9727
10478
  const {
@@ -9745,14 +10496,14 @@ var InfiniteTableComponent = React32.memo(function InfiniteTableComponent2() {
9745
10496
  activeCellIndex,
9746
10497
  onRenderUpdater
9747
10498
  } = componentState;
9748
- (0, import_react45.useEffect)(() => {
10499
+ (0, import_react49.useEffect)(() => {
9749
10500
  if (activeRowIndex != null) {
9750
10501
  imperativeApi.scrollRowIntoView(activeRowIndex, {
9751
10502
  offset: 30
9752
10503
  });
9753
10504
  }
9754
10505
  }, [activeRowIndex]);
9755
- (0, import_react45.useEffect)(() => {
10506
+ (0, import_react49.useEffect)(() => {
9756
10507
  if (activeCellIndex != null) {
9757
10508
  imperativeApi.scrollCellIntoView(activeCellIndex[0], activeCellIndex[1], {
9758
10509
  offset: 30
@@ -9769,7 +10520,7 @@ var InfiniteTableComponent = React32.memo(function InfiniteTableComponent2() {
9769
10520
  bodySize,
9770
10521
  computed
9771
10522
  });
9772
- React32.useEffect(() => {
10523
+ React36.useEffect(() => {
9773
10524
  const dataSourceState = getDataSourceState();
9774
10525
  const onChange = debounce((renderRange) => {
9775
10526
  dataSourceState.notifyRenderRangeChange({
@@ -9782,12 +10533,12 @@ var InfiniteTableComponent = React32.memo(function InfiniteTableComponent2() {
9782
10533
  const licenseValid = useLicense(licenseKey);
9783
10534
  const domProps = useDOMProps(componentState.domProps);
9784
10535
  const LoadMaskCmp = (_a = components == null ? void 0 : components.LoadMask) != null ? _a : LoadMask;
9785
- React32.useEffect(() => {
10536
+ React36.useEffect(() => {
9786
10537
  brain.setScrollStopDelay(scrollStopDelay);
9787
10538
  dataSourceActions.scrollStopDelayUpdatedByTable = scrollStopDelay;
9788
10539
  }, [scrollStopDelay]);
9789
10540
  useAutoSizeColumns();
9790
- const onKeyDown = (0, import_react45.useCallback)((event) => {
10541
+ const onKeyDown = (0, import_react49.useCallback)((event) => {
9791
10542
  if (handleKeyboardNavigation({
9792
10543
  getState,
9793
10544
  actions,
@@ -9799,13 +10550,14 @@ var InfiniteTableComponent = React32.memo(function InfiniteTableComponent2() {
9799
10550
  event.preventDefault();
9800
10551
  }
9801
10552
  }, []);
9802
- return /* @__PURE__ */ React32.createElement("div", __spreadValues({
10553
+ return /* @__PURE__ */ React36.createElement("div", __spreadValues({
9803
10554
  onKeyDown,
9804
10555
  ref: domRef
9805
- }, domProps), header ? /* @__PURE__ */ React32.createElement(TableHeaderWrapper, {
9806
- brain: headerBrain,
10556
+ }, domProps), header ? /* @__PURE__ */ React36.createElement(TableHeaderWrapper, {
10557
+ bodyBrain: brain,
10558
+ headerBrain,
9807
10559
  scrollbars
9808
- }) : null, /* @__PURE__ */ React32.createElement(InfiniteTableBody, null, /* @__PURE__ */ React32.createElement(HeadlessTable, {
10560
+ }) : null, /* @__PURE__ */ React36.createElement(InfiniteTableBody, null, /* @__PURE__ */ React36.createElement(HeadlessTable, {
9809
10561
  tabIndex: 0,
9810
10562
  activeRowIndex: componentState.ready && keyboardNavigation === "row" ? activeRowIndex : null,
9811
10563
  activeCellIndex: componentState.ready && keyboardNavigation === "cell" ? activeCellIndex : null,
@@ -9816,18 +10568,18 @@ var InfiniteTableComponent = React32.memo(function InfiniteTableComponent2() {
9816
10568
  renderCell,
9817
10569
  cellHoverClassNames: HOVERED_CLASS_NAMES,
9818
10570
  scrollerDOMRef
9819
- }), /* @__PURE__ */ React32.createElement(LoadMaskCmp, {
10571
+ }), /* @__PURE__ */ React36.createElement(LoadMaskCmp, {
9820
10572
  visible: loading
9821
- }, loadingText)), /* @__PURE__ */ React32.createElement("div", {
10573
+ }, loadingText)), /* @__PURE__ */ React36.createElement("div", {
9822
10574
  ref: portalDOMRef,
9823
10575
  className: join(`${rootClassName2}Portal`, zIndex[1e3], position.absolute, top[0], left[0])
9824
- }), rowHeightCSSVar ? /* @__PURE__ */ React32.createElement(CSSVariableWatch, {
10576
+ }), rowHeightCSSVar ? /* @__PURE__ */ React36.createElement(CSSVariableWatch, {
9825
10577
  varName: rowHeightCSSVar,
9826
10578
  onChange: onRowHeightCSSVarChange
9827
- }) : null, columnHeaderHeightCSSVar ? /* @__PURE__ */ React32.createElement(CSSVariableWatch, {
10579
+ }) : null, columnHeaderHeightCSSVar ? /* @__PURE__ */ React36.createElement(CSSVariableWatch, {
9828
10580
  varName: columnHeaderHeightCSSVar,
9829
10581
  onChange: onColumnHeaderHeightCSSVarChange
9830
- }) : null, /* @__PURE__ */ React32.createElement(InfiniteTableFooter, null), licenseValid ? null : /* @__PURE__ */ React32.createElement(InfiniteTableLicenseFooter, null));
10582
+ }) : null, /* @__PURE__ */ React36.createElement(InfiniteTableFooter, null), licenseValid ? null : /* @__PURE__ */ React36.createElement(InfiniteTableLicenseFooter, null));
9831
10583
  });
9832
10584
  function InfiniteTableContextProvider() {
9833
10585
  const { componentActions, componentState } = useComponentState();
@@ -9835,7 +10587,7 @@ function InfiniteTableContextProvider() {
9835
10587
  const computed = useComputed();
9836
10588
  const getComputed = useLatest(computed);
9837
10589
  const getState = useLatest(componentState);
9838
- if (true) {
10590
+ if (false) {
9839
10591
  globalThis.getState = getState;
9840
10592
  globalThis.getComputed = getComputed;
9841
10593
  }
@@ -9847,33 +10599,34 @@ function InfiniteTableContextProvider() {
9847
10599
  getState
9848
10600
  };
9849
10601
  useResizeObserver(scrollerDOMRef, (size) => {
9850
- var _a, _b;
9851
10602
  const bodySize = {
9852
10603
  width: size.width,
9853
10604
  height: size.height
9854
10605
  };
9855
- bodySize.width = (_b = (_a = scrollerDOMRef.current) == null ? void 0 : _a.scrollWidth) != null ? _b : bodySize.width;
9856
10606
  componentActions.bodySize = bodySize;
9857
- }, { earlyAttach: true });
9858
- React32.useEffect(() => {
10607
+ }, { earlyAttach: true, debounce: 50 });
10608
+ React36.useEffect(() => {
9859
10609
  return () => {
9860
10610
  componentState.onRowHeightCSSVarChange.destroy();
9861
10611
  componentState.onColumnHeaderHeightCSSVarChange.destroy();
9862
10612
  };
9863
10613
  }, []);
9864
- React32.useEffect(() => {
10614
+ React36.useEffect(() => {
9865
10615
  if (scrollerDOMRef.current) {
9866
10616
  scrollerDOMRef.current.scrollTop = 0;
9867
10617
  }
9868
10618
  }, [scrollTopKey, scrollerDOMRef]);
9869
10619
  const TableContext2 = getInfiniteTableContext();
9870
- return /* @__PURE__ */ React32.createElement(TableContext2.Provider, {
10620
+ return /* @__PURE__ */ React36.createElement(TableContext2.Provider, {
9871
10621
  value: contextValue
9872
- }, /* @__PURE__ */ React32.createElement(InfiniteTableComponent, null));
10622
+ }, /* @__PURE__ */ React36.createElement(InfiniteTableComponent, null));
9873
10623
  }
9874
10624
  function InfiniteTable(props) {
9875
- const table = /* @__PURE__ */ React32.createElement(InfiniteTableRoot, __spreadValues({}, props), /* @__PURE__ */ React32.createElement(InfiniteTableContextProvider, null));
9876
- return /* @__PURE__ */ React32.createElement(React32.StrictMode, null, table);
10625
+ const table = /* @__PURE__ */ React36.createElement(InfiniteTableRoot, __spreadValues({}, props), /* @__PURE__ */ React36.createElement(InfiniteTableContextProvider, null));
10626
+ if (false) {
10627
+ return /* @__PURE__ */ React36.createElement(React36.StrictMode, null, table);
10628
+ }
10629
+ return table;
9877
10630
  }
9878
10631
  InfiniteTable.defaultProps = {
9879
10632
  rowHeight: 40,