@infinite-table/infinite-react 0.0.2-canary.0 → 0.0.2-canary.4

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
@@ -470,14 +470,14 @@ var require_browser = __commonJS({
470
470
  } else {
471
471
  exports.storage.removeItem("debug");
472
472
  }
473
- } catch (error2) {
473
+ } catch (error3) {
474
474
  }
475
475
  }
476
476
  function load() {
477
477
  let r;
478
478
  try {
479
479
  r = exports.storage.getItem("debug");
480
- } catch (error2) {
480
+ } catch (error3) {
481
481
  }
482
482
  if (!r && typeof process !== "undefined" && "env" in process) {
483
483
  r = process.env.DEBUG;
@@ -487,7 +487,7 @@ var require_browser = __commonJS({
487
487
  function localstorage() {
488
488
  try {
489
489
  return localStorage;
490
- } catch (error2) {
490
+ } catch (error3) {
491
491
  }
492
492
  }
493
493
  module2.exports = require_common()(exports);
@@ -495,8 +495,8 @@ var require_browser = __commonJS({
495
495
  formatters.j = function(v) {
496
496
  try {
497
497
  return JSON.stringify(v);
498
- } catch (error2) {
499
- return "[UnexpectedJSONParseError]: " + error2.message;
498
+ } catch (error3) {
499
+ return "[UnexpectedJSONParseError]: " + error3.message;
500
500
  }
501
501
  };
502
502
  }
@@ -577,18 +577,18 @@ __export(exports, {
577
577
  InfiniteTableClassName: () => InfiniteTableClassName,
578
578
  InfiniteTableComponent: () => InfiniteTableComponent,
579
579
  flatten: () => flatten,
580
+ getComponentStateRoot: () => getComponentStateRoot,
580
581
  group: () => group,
582
+ interceptMap: () => interceptMap,
583
+ useComponentState: () => useComponentState,
581
584
  useDataSource: () => useDataSource
582
585
  });
583
586
 
584
587
  // src/components/InfiniteTable/index.tsx
585
- var React35 = __toModule(require("react"));
586
-
587
- // src/utils/join.ts
588
- var join = (...args) => args.filter((x) => !!`${x}`).join(" ");
588
+ var React36 = __toModule(require("react"));
589
589
 
590
590
  // src/components/InfiniteTable/internalProps.ts
591
- var rootClassName = "ITable";
591
+ var rootClassName = "Infinite";
592
592
  var internalProps = {
593
593
  rootClassName
594
594
  };
@@ -630,19 +630,6 @@ function buildSubscriptionCallback() {
630
630
  return updater;
631
631
  }
632
632
 
633
- // src/components/utils/isControlledValue.ts
634
- function isControlledValue(value) {
635
- const controlled = value !== void 0;
636
- return controlled;
637
- }
638
-
639
- // src/components/utils/isControlled.ts
640
- function isControlled(propName, props) {
641
- const propValue = props[propName];
642
- const controlled = isControlledValue(propValue);
643
- return controlled;
644
- }
645
-
646
633
  // src/components/VirtualBrain/ScrollListener.ts
647
634
  var initialScrollPosition = {
648
635
  scrollLeft: 0,
@@ -701,25 +688,15 @@ function computeColumnGroupsDepths(columnGroups) {
701
688
  }
702
689
 
703
690
  // src/components/InfiniteTable/state/getInitialState.ts
704
- function getInitialState(params) {
705
- var _a, _b, _c, _d, _e, _f;
706
- const { props } = params;
707
- const columnGroups = (_a = isControlled("columnGroups", props) ? props.columnGroups : props.defaultColumnGroups) != null ? _a : new Map();
708
- const pivotColumnGroups = props.pivotColumnGroups;
709
- const collapsedColumnGroups = (_b = isControlled("collapsedColumnGroups", props) ? props.collapsedColumnGroups : props.defaultCollapsedColumnGroups) != null ? _b : new Map();
710
- const computedColumnGroups = pivotColumnGroups || columnGroups;
711
- const columnGroupsDepthsMap = computeColumnGroupsDepths(computedColumnGroups);
712
- const generatedColumns = new Map();
713
- const pivotColumns = props.pivotColumns;
691
+ function initSetupState() {
692
+ const columnsGeneratedForGrouping = new Map();
714
693
  return {
715
- rowHeightComputed: typeof props.rowHeight === "number" ? props.rowHeight : 0,
716
- headerHeight: typeof props.headerHeight === "number" ? props.headerHeight : 0,
694
+ columnShifts: null,
717
695
  domRef: (0, import_react2.createRef)(),
718
- bodyDOMRef: (0, import_react2.createRef)(),
696
+ scrollerDOMRef: (0, import_react2.createRef)(),
719
697
  portalDOMRef: (0, import_react2.createRef)(),
720
- bodySizeRef: (0, import_react2.createRef)(),
721
- onRowHeightChange: buildSubscriptionCallback(),
722
- onHeaderHeightChange: buildSubscriptionCallback(),
698
+ onRowHeightCSSVarChange: buildSubscriptionCallback(),
699
+ onHeaderHeightCSSVarChange: buildSubscriptionCallback(),
723
700
  bodySize: {
724
701
  width: 0,
725
702
  height: 0
@@ -728,65 +705,105 @@ function getInitialState(params) {
728
705
  scrollTop: 0,
729
706
  scrollLeft: 0
730
707
  },
708
+ focused: false,
709
+ focusedWithin: false,
710
+ columnsWhenGrouping: columnsGeneratedForGrouping,
731
711
  draggingColumnId: null,
732
- columns: props.columns,
733
- pivotColumns,
734
- pivotColumnGroups,
735
- generatedColumns,
736
- columnOrder: (_c = isControlled("columnOrder", props) ? props.columnOrder : props.defaultColumnOrder) != null ? _c : true,
737
- computedColumnGroups,
738
712
  pinnedStartScrollListener: new ScrollListener(),
739
713
  pinnedEndScrollListener: new ScrollListener(),
740
- columnGroups,
741
- collapsedColumnGroups,
742
- columnGroupsDepthsMap,
743
- columnGroupsMaxDepth: Math.max(...columnGroupsDepthsMap.values(), 0),
744
- columnVisibility: (_d = isControlled("columnVisibility", props) ? props.columnVisibility : props.defaultColumnVisibility) != null ? _d : new Map(),
745
- columnPinning: (_e = isControlled("columnPinning", props) ? props.columnPinning : props.defaultColumnPinning) != null ? _e : new Map(),
746
- columnAggregations: (_f = isControlled("columnAggregations", props) ? props.columnAggregations : props.defaultColumnAggregations) != null ? _f : new Map(),
747
- columnShifts: null,
748
- computedPivotColumns: void 0
714
+ computedPivotColumns: void 0,
715
+ columnsWhenInlineGroupRenderStrategy: void 0
716
+ };
717
+ }
718
+ var forwardProps = () => {
719
+ return {
720
+ columns: 1,
721
+ components: 1,
722
+ loadingText: 1,
723
+ pivotColumns: 1,
724
+ groupColumn: 1,
725
+ onReady: 1,
726
+ domProps: 1,
727
+ focusedClassName: 1,
728
+ focusedWithinClassName: 1,
729
+ focusedStyle: 1,
730
+ focusedWithinStyle: 1,
731
+ onSelfFocus: 1,
732
+ onFocusWithin: 1,
733
+ onSelfBlur: 1,
734
+ onBlurWithin: 1,
735
+ onScrollToTop: 1,
736
+ onScrollToBottom: 1,
737
+ scrollToBottomOffset: 1,
738
+ rowStyle: 1,
739
+ rowProps: 1,
740
+ rowClassName: 1,
741
+ pinnedStartMaxWidth: 1,
742
+ pinnedEndMaxWidth: 1,
743
+ pivotColumn: 1,
744
+ pivotRowLabelsColumn: 1,
745
+ pivotColumnGroups: 1,
746
+ activeIndex: (activeIndex) => activeIndex != null ? activeIndex : 0,
747
+ columnMinWidth: (columnMinWidth) => columnMinWidth != null ? columnMinWidth : 30,
748
+ columnMaxWidth: (columnMaxWidth) => columnMaxWidth != null ? columnMaxWidth : 2e3,
749
+ columnDefaultWidth: (columnDefaultWidth) => columnDefaultWidth != null ? columnDefaultWidth : 300,
750
+ draggableColumns: (draggableColumns) => draggableColumns != null ? draggableColumns : true,
751
+ sortable: (sortable) => sortable != null ? sortable : true,
752
+ hideEmptyGroupColumns: (hideEmptyGroupColumns) => hideEmptyGroupColumns != null ? hideEmptyGroupColumns : false,
753
+ pivotTotalColumnPosition: (pivotTotalColumnPosition) => pivotTotalColumnPosition != null ? pivotTotalColumnPosition : "end",
754
+ licenseKey: (licenseKey) => licenseKey || globalThis.InfiniteTableLicenseKey || "",
755
+ columnOrder: (columnOrder) => columnOrder != null ? columnOrder : true,
756
+ header: (header) => header != null ? header : true,
757
+ showZebraRows: (showZebraRows) => showZebraRows != null ? showZebraRows : true,
758
+ showHoverRows: (showHoverRows) => showHoverRows != null ? showHoverRows : true,
759
+ virtualizeColumns: (virtualizeColumns) => virtualizeColumns != null ? virtualizeColumns : true,
760
+ rowHeight: (rowHeight) => typeof rowHeight === "number" ? rowHeight : 0,
761
+ headerHeight: (headerHeight) => typeof headerHeight === "number" ? headerHeight : 0,
762
+ columnVisibility: (columnVisibility) => columnVisibility != null ? columnVisibility : new Map(),
763
+ columnPinning: (columnPinning) => columnPinning != null ? columnPinning : new Map(),
764
+ columnAggregations: (columnAggregations) => columnAggregations != null ? columnAggregations : new Map(),
765
+ collapsedColumnGroups: (collapsedColumnGroups) => collapsedColumnGroups != null ? collapsedColumnGroups : new Map(),
766
+ columnGroups: (columnGroups) => columnGroups != null ? columnGroups : new Map()
749
767
  };
768
+ };
769
+ function getGroupRenderStrategy(options) {
770
+ const { groupRowsBy, groupColumn, groupRenderStrategy } = options;
771
+ if (groupRenderStrategy) {
772
+ return groupRenderStrategy;
773
+ }
774
+ if (groupColumn != null && typeof groupColumn === "object") {
775
+ return "single-column";
776
+ }
777
+ const columnsInGroupRowsBy = groupRowsBy.filter((g) => g.column);
778
+ if (columnsInGroupRowsBy.length) {
779
+ return "multi-column";
780
+ }
781
+ return "multi-column";
750
782
  }
751
- function deriveReadOnlyState(params) {
752
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
753
- const { props, state, updated } = params;
754
- const virtualizeColumns = (_a = props.virtualizeColumns) != null ? _a : true;
755
- const header = (_b = props.header) != null ? _b : true;
783
+ var mapPropsToState = (params) => {
784
+ const { props, state, oldState, parentState } = params;
785
+ const { virtualizeColumns, header } = state;
756
786
  const computedColumnGroups = state.pivotColumnGroups || state.columnGroups;
757
787
  const virtualizeHeader = header && virtualizeColumns && (!computedColumnGroups || (computedColumnGroups == null ? void 0 : computedColumnGroups.size) === 0);
758
- const columnGroupsDepthsMap = (updated == null ? void 0 : updated.columnGroups) || (updated == null ? void 0 : updated.pivotColumnGroups) ? computeColumnGroupsDepths(computedColumnGroups) : state.columnGroupsDepthsMap;
759
- const pivotTotalColumnPosition = (_c = props.pivotTotalColumnPosition) != null ? _c : "end";
788
+ const columnGroupsDepthsMap = state.columnGroups && state.columnGroups != (oldState == null ? void 0 : oldState.columnGroups) || state.pivotColumnGroups && state.pivotColumnGroups != (oldState == null ? void 0 : oldState.pivotColumnGroups) ? computeColumnGroupsDepths(computedColumnGroups) : state.columnGroupsDepthsMap;
789
+ const groupRowsBy = parentState == null ? void 0 : parentState.groupRowsBy;
790
+ const groupRenderStrategy = getGroupRenderStrategy({
791
+ groupRenderStrategy: props.groupRenderStrategy,
792
+ groupRowsBy,
793
+ groupColumn: props.groupColumn
794
+ });
760
795
  return {
761
- groupColumn: props.groupColumn,
762
- onReady: props.onReady,
763
- domProps: props.domProps,
764
- showZebraRows: (_d = props.showZebraRows) != null ? _d : true,
765
- virtualizeColumns,
796
+ groupRenderStrategy,
797
+ groupRowsBy,
798
+ computedColumns: state.computedPivotColumns || state.columnsWhenGrouping || state.columnsWhenInlineGroupRenderStrategy || props.columns,
766
799
  virtualizeHeader,
767
- header,
768
- rowStyle: props.rowStyle,
769
- rowProps: props.rowProps,
770
- rowClassName: props.rowClassName,
771
- pinnedStartMaxWidth: props.pinnedStartMaxWidth,
772
- pinnedEndMaxWidth: props.pinnedEndMaxWidth,
773
- groupRenderStrategy: (_e = props.groupRenderStrategy) != null ? _e : "multi-column",
774
- pivotTotalColumnPosition,
775
- columnMinWidth: (_f = props.columnMinWidth) != null ? _f : 30,
776
- columnMaxWidth: (_g = props.columnMaxWidth) != null ? _g : 2e3,
777
- columnDefaultWidth: (_h = props.columnDefaultWidth) != null ? _h : 300,
778
- draggableColumns: (_i = props.draggableColumns) != null ? _i : true,
779
- pivotColumn: props.pivotColumn,
780
- pivotRowLabelsColumn: props.pivotRowLabelsColumn,
781
- sortable: (_j = props.sortable) != null ? _j : true,
782
800
  columnGroupsDepthsMap,
783
- columnGroupsMaxDepth: Math.max(...columnGroupsDepthsMap.values(), 0),
801
+ columnGroupsMaxDepth: columnGroupsDepthsMap != state.columnGroupsDepthsMap ? Math.max(...columnGroupsDepthsMap.values(), 0) : state.columnGroupsMaxDepth,
784
802
  computedColumnGroups,
785
- licenseKey: props.licenseKey || globalThis.InfiniteTableLicenseKey || "",
786
803
  rowHeightCSSVar: typeof props.rowHeight === "string" ? props.rowHeight : "",
787
- headerHeightCSSVar: typeof props.headerHeight === "string" ? props.headerHeight : ""
804
+ headerHeightCSSVar: typeof props.headerHeight === "string" ? props.headerHeight || "--ITableHeader__height" : ""
788
805
  };
789
- }
806
+ };
790
807
 
791
808
  // src/components/ResizeObserver/index.tsx
792
809
  var React = __toModule(require("react"));
@@ -1047,7 +1064,34 @@ var adjustColumnOrderForPinning = (columnOrder, columnPinning) => {
1047
1064
  return columnOrder;
1048
1065
  };
1049
1066
 
1067
+ // src/utils/debug.ts
1068
+ var debug = require_browser();
1069
+ var debugTable = debug(`InfiniteTable`);
1070
+ var dbg = (channelName) => {
1071
+ const result = debugTable.extend(channelName);
1072
+ result.log = console.log.bind(console);
1073
+ return result;
1074
+ };
1075
+ var err = (channelName) => {
1076
+ const result = debugTable.extend(`${channelName}:error`);
1077
+ result.log = console.error.bind(console);
1078
+ return result;
1079
+ };
1080
+ var emptyLogFn = () => emptyLogFn;
1081
+ emptyLogFn.extend = () => emptyLogFn;
1082
+ var Logger = class {
1083
+ constructor(channelName) {
1084
+ this.debug = emptyLogFn;
1085
+ this.error = emptyLogFn;
1086
+ if (false) {
1087
+ this.debug = dbg(channelName);
1088
+ this.error = err(channelName);
1089
+ }
1090
+ }
1091
+ };
1092
+
1050
1093
  // src/components/InfiniteTable/utils/getComputedVisibleColumns.ts
1094
+ var error = err("getComputedVisibleColumns");
1051
1095
  var isColumnVisible = (columnVisibility, _columnVisibilityAssumeVisible, colId) => {
1052
1096
  return !columnVisibility.has(colId) || columnVisibility.get(colId) !== false;
1053
1097
  };
@@ -1058,7 +1102,6 @@ var getComputedPinned = (colId, columnPinning) => {
1058
1102
  };
1059
1103
  var getComputedVisibleColumns = ({
1060
1104
  columns,
1061
- generatedColumns,
1062
1105
  bodySize,
1063
1106
  columnMinWidth,
1064
1107
  columnMaxWidth,
@@ -1076,18 +1119,15 @@ var getComputedVisibleColumns = ({
1076
1119
  columnVisibilityAssumeVisible
1077
1120
  }) => {
1078
1121
  let computedOffset = 0;
1079
- const normalizedColumnOrder = adjustColumnOrderForPinning(columnOrder === true ? Array.from(generatedColumns.keys()).concat(...columns.keys()) : columnOrder, columnPinning);
1122
+ const normalizedColumnOrder = adjustColumnOrderForPinning(columnOrder === true ? [...columns.keys()] : columnOrder, columnPinning);
1080
1123
  const visibleColumnOrder = normalizedColumnOrder.filter(isColumnVisible.bind(null, columnVisibility, columnVisibilityAssumeVisible));
1081
1124
  const columnsArray = visibleColumnOrder.map((columnId) => {
1082
1125
  let col = columns.get(columnId);
1083
1126
  if (!col) {
1084
- col = generatedColumns.get(columnId);
1085
- if (!col) {
1086
- throw `Column with id "${columnId}" specified in columnOrder array cannot be found in the columns map.`;
1087
- }
1127
+ error(`Column with id "${columnId}" specified in columnOrder array cannot be found in the columns map.`);
1088
1128
  }
1089
1129
  return col;
1090
- });
1130
+ }).filter(Boolean);
1091
1131
  const sortedMap = (sortInfo != null ? sortInfo : []).reduce((acc, info, index) => {
1092
1132
  if (info.id) {
1093
1133
  acc[info.id] = { sortInfo: info, index };
@@ -1328,13 +1368,13 @@ function interceptMap(map, fns) {
1328
1368
  // src/components/InfiniteTable/utils/rafFn.ts
1329
1369
  var rafFn = (fn) => {
1330
1370
  let rafId = 0;
1331
- return () => {
1371
+ return (...args) => {
1332
1372
  if (rafId) {
1333
1373
  cancelAnimationFrame(rafId);
1334
1374
  }
1335
1375
  rafId = requestAnimationFrame(() => {
1336
1376
  rafId = 0;
1337
- fn();
1377
+ fn(...args);
1338
1378
  });
1339
1379
  };
1340
1380
  };
@@ -1356,7 +1396,6 @@ var useRerenderOnKeyChange = (map) => {
1356
1396
  // src/components/InfiniteTable/hooks/useComputedVisibleColumns.ts
1357
1397
  var useComputedVisibleColumns = ({
1358
1398
  columns,
1359
- generatedColumns,
1360
1399
  bodySize,
1361
1400
  columnMinWidth,
1362
1401
  columnMaxWidth,
@@ -1394,7 +1433,6 @@ var useComputedVisibleColumns = ({
1394
1433
  } = (0, import_react8.useMemo)(() => {
1395
1434
  return getComputedVisibleColumns({
1396
1435
  columns,
1397
- generatedColumns,
1398
1436
  bodySize,
1399
1437
  columnMinWidth,
1400
1438
  columnMaxWidth,
@@ -1413,7 +1451,6 @@ var useComputedVisibleColumns = ({
1413
1451
  });
1414
1452
  }, [
1415
1453
  columns,
1416
- generatedColumns,
1417
1454
  bodySize.width,
1418
1455
  columnMinWidth,
1419
1456
  columnMaxWidth,
@@ -1456,7 +1493,7 @@ var useComputedVisibleColumns = ({
1456
1493
  var sortAscending = (a, b) => a - b;
1457
1494
 
1458
1495
  // src/components/InfiniteTable/hooks/useComputed.ts
1459
- var import_react18 = __toModule(require("react"));
1496
+ var import_react19 = __toModule(require("react"));
1460
1497
 
1461
1498
  // src/components/InfiniteTable/hooks/useColumnAggregations.ts
1462
1499
  var import_react12 = __toModule(require("react"));
@@ -1489,44 +1526,53 @@ function useDataSourceActions() {
1489
1526
  var React4 = __toModule(require("react"));
1490
1527
  var import_react11 = __toModule(require("react"));
1491
1528
 
1492
- // src/utils/debug.ts
1493
- var debug = require_browser();
1494
- var debugTable = debug(`InfiniteTable`);
1495
- var dbg = (channelName) => {
1496
- const result = debugTable.extend(channelName);
1497
- result.log = console.log.bind(console);
1498
- return result;
1499
- };
1500
- var err = (channelName) => {
1501
- const result = debugTable.extend(`${channelName}:error`);
1502
- result.log = console.error.bind(console);
1503
- return result;
1504
- };
1505
- var emptyLogFn = () => emptyLogFn;
1506
- emptyLogFn.extend = () => emptyLogFn;
1507
- var Logger = class {
1508
- constructor(channelName) {
1509
- this.debug = emptyLogFn;
1510
- this.error = emptyLogFn;
1511
- if (false) {
1512
- this.debug = dbg(channelName);
1513
- this.error = err(channelName);
1514
- }
1529
+ // src/utils/proxyFnCall.ts
1530
+ function proxyFn(fn, config) {
1531
+ const propertyReads = new Set();
1532
+ function proxiedFn(...params) {
1533
+ const paramToProxy = config ? config.getProxyTargetFromArgs(...params) : params[0];
1534
+ propertyReads.clear();
1535
+ const handler = {
1536
+ get: function(obj, prop) {
1537
+ propertyReads.add(prop);
1538
+ return obj[prop];
1539
+ }
1540
+ };
1541
+ const proxy = new Proxy(paramToProxy, handler);
1542
+ const newParams = config ? config.putProxyToArgs(proxy, ...params) : [proxy];
1543
+ return fn.apply(this, newParams);
1515
1544
  }
1516
- };
1545
+ return {
1546
+ fn: proxiedFn,
1547
+ propertyReads
1548
+ };
1549
+ }
1517
1550
 
1518
1551
  // src/utils/toUpperFirst.ts
1519
1552
  var toUpperFirst = (s) => {
1520
1553
  return s ? s.substr(0, 1).toUpperCase() + s.substr(1) : s;
1521
1554
  };
1522
1555
 
1523
- // src/components/hooks/useLatest.ts
1556
+ // src/components/utils/isControlledValue.ts
1557
+ function isControlledValue(value) {
1558
+ const controlled = value !== void 0;
1559
+ return controlled;
1560
+ }
1561
+
1562
+ // src/components/utils/isControlled.ts
1563
+ function isControlled(propName, props) {
1564
+ const propValue = props[propName];
1565
+ const controlled = isControlledValue(propValue);
1566
+ return controlled;
1567
+ }
1568
+
1569
+ // src/components/hooks/useLatest.tsx
1524
1570
  var import_react9 = __toModule(require("react"));
1525
- var useLatest = (value) => {
1571
+ function useLatest(value) {
1526
1572
  const ref = (0, import_react9.useRef)(value);
1527
1573
  ref.current = value;
1528
1574
  return (0, import_react9.useCallback)(() => ref.current, []);
1529
- };
1575
+ }
1530
1576
 
1531
1577
  // src/components/hooks/usePrevious.ts
1532
1578
  var import_react10 = __toModule(require("react"));
@@ -1555,18 +1601,33 @@ function getComponentStateContext() {
1555
1601
  }
1556
1602
  return ComponentContext = (0, import_react11.createContext)(null);
1557
1603
  }
1558
- function getReducerActions(dispatch, state, getProps) {
1604
+ function getReducerActions(dispatch, getState, getProps, propsToForward, allowedControlledPropOverrides) {
1605
+ const state = getState();
1559
1606
  return Object.keys(state).reduce((actions, stateKey) => {
1560
1607
  const key = stateKey;
1561
1608
  const setter = (value) => {
1562
1609
  const props = getProps();
1610
+ const state2 = getState();
1611
+ const currentValue = state2[key];
1612
+ if (currentValue === value) {
1613
+ return;
1614
+ }
1563
1615
  notifyChange(props, stateKey, value);
1564
- if (isControlled(stateKey, props)) {
1616
+ const forwardFn = propsToForward[key];
1617
+ if (typeof forwardFn === "function") {
1618
+ value = forwardFn(value);
1619
+ }
1620
+ const allowControlled = !!(allowedControlledPropOverrides == null ? void 0 : allowedControlledPropOverrides[key]);
1621
+ if (isControlled(stateKey, props) && !allowControlled) {
1565
1622
  return;
1566
1623
  }
1567
1624
  dispatch({
1568
- propertyName: stateKey,
1569
- payload: value
1625
+ payload: {
1626
+ updatedProps: null,
1627
+ mappedState: {
1628
+ [stateKey]: value
1629
+ }
1630
+ }
1570
1631
  });
1571
1632
  };
1572
1633
  Object.defineProperty(actions, stateKey, {
@@ -1575,116 +1636,152 @@ function getReducerActions(dispatch, state, getProps) {
1575
1636
  return actions;
1576
1637
  }, {});
1577
1638
  }
1639
+ function forwardProps2(propsToForward, props) {
1640
+ const mappedState = {};
1641
+ for (let k in propsToForward)
1642
+ if (propsToForward.hasOwnProperty(k)) {
1643
+ const forwardFn = propsToForward[k];
1644
+ let propValue = isControlled(k, props) ? props[k] : props[`default${toUpperFirst(k)}`];
1645
+ if (typeof forwardFn === "function") {
1646
+ propValue = forwardFn(propValue);
1647
+ }
1648
+ mappedState[k] = propValue;
1649
+ }
1650
+ return mappedState;
1651
+ }
1578
1652
  function getComponentStateRoot(config) {
1579
1653
  return React4.memo(function ComponentStateRoot(props) {
1580
- var _a;
1581
- const getParentState = config.getParentState;
1582
- const parentState = (_a = getParentState == null ? void 0 : getParentState()) != null ? _a : null;
1583
- const [{ state: wholeState, initialState }] = (0, import_react11.useState)(() => {
1584
- let initialState2 = config.getInitialState({
1585
- props,
1586
- parentState
1587
- });
1588
- if (config.deriveReadOnlyState) {
1589
- const readOnlyState = config.deriveReadOnlyState({
1654
+ var _a, _b;
1655
+ const propsToStateSetRef = (0, import_react11.useRef)(new Set());
1656
+ const propsToForward = (0, import_react11.useMemo)(() => config.forwardProps ? config.forwardProps() : {}, []);
1657
+ const parentState = (_b = (_a = config.getParentState) == null ? void 0 : _a.call(config)) != null ? _b : null;
1658
+ const getParentState = useLatest(parentState);
1659
+ const [wholeState] = (0, import_react11.useState)(() => {
1660
+ const initialSetupState = config.initSetupState ? config.initSetupState() : {};
1661
+ let mappedState = {};
1662
+ if (propsToForward) {
1663
+ mappedState = forwardProps2(propsToForward, props);
1664
+ }
1665
+ const state2 = __spreadValues(__spreadValues({}, initialSetupState), mappedState);
1666
+ if (config.mapPropsToState) {
1667
+ const { fn: mapPropsToState3, propertyReads } = proxyFn(config.mapPropsToState, {
1668
+ getProxyTargetFromArgs: (initialArg) => initialArg.props,
1669
+ putProxyToArgs: (props2, initialArg) => {
1670
+ return [__spreadProps(__spreadValues({}, initialArg), { props: props2 })];
1671
+ }
1672
+ });
1673
+ propsToStateSetRef.current = new Set([
1674
+ ...propsToStateSetRef.current,
1675
+ ...propertyReads
1676
+ ]);
1677
+ const stateFromProps = mapPropsToState3({
1590
1678
  props,
1591
- state: initialState2,
1592
- updated: null,
1679
+ state: state2,
1680
+ oldState: null,
1593
1681
  parentState
1594
1682
  });
1595
- return {
1596
- state: __spreadValues(__spreadValues({}, initialState2), readOnlyState),
1597
- initialState: initialState2,
1598
- readOnlyState
1599
- };
1683
+ return __spreadValues(__spreadValues({}, state2), stateFromProps);
1600
1684
  }
1601
- return {
1602
- initialState: initialState2,
1603
- readOnlyState: {},
1604
- state: initialState2
1605
- };
1685
+ return state2;
1606
1686
  });
1607
1687
  const getProps = useLatest(props);
1608
- const theReducer = (state2, action) => {
1609
- const previousState = state2;
1610
- let newState = null;
1611
- if (action.propertyName) {
1612
- newState = {
1613
- [action.propertyName]: action.payload
1614
- };
1615
- }
1616
- if (action.newControlledProps) {
1617
- newState = action.payload;
1618
- }
1619
- if (newState !== null) {
1620
- state2 = __spreadValues(__spreadValues({}, state2), newState);
1621
- }
1622
- if (config.deriveReadOnlyState) {
1623
- const derivedState = config.deriveReadOnlyState({
1688
+ const theReducer = (previousState, action) => {
1689
+ var _a2;
1690
+ const parentState2 = (_a2 = getParentState == null ? void 0 : getParentState()) != null ? _a2 : null;
1691
+ const mappedState = action.payload.mappedState;
1692
+ const updatedProps = action.payload.updatedProps;
1693
+ const newState = Object.assign({}, previousState);
1694
+ if (mappedState) {
1695
+ Object.assign(newState, mappedState);
1696
+ }
1697
+ if (config.mapPropsToState) {
1698
+ const { fn: mapPropsToState3, propertyReads } = proxyFn(config.mapPropsToState, {
1699
+ getProxyTargetFromArgs: (initialArg) => initialArg.props,
1700
+ putProxyToArgs: (props2, initialArg) => {
1701
+ return [__spreadProps(__spreadValues({}, initialArg), { props: props2 })];
1702
+ }
1703
+ });
1704
+ propsToStateSetRef.current = new Set([
1705
+ ...propsToStateSetRef.current,
1706
+ ...propertyReads
1707
+ ]);
1708
+ const stateFromProps = mapPropsToState3({
1624
1709
  props: getProps(),
1625
- state: state2,
1626
- updated: newState,
1627
- parentState
1710
+ state: newState,
1711
+ oldState: previousState,
1712
+ parentState: parentState2
1628
1713
  });
1629
- state2 = __spreadValues(__spreadValues({}, state2), derivedState);
1714
+ Object.assign(newState, stateFromProps);
1630
1715
  }
1631
1716
  const result = config.concludeReducer ? config.concludeReducer({
1632
1717
  previousState,
1633
- state: state2,
1634
- updated: newState,
1635
- parentState
1636
- }) : state2;
1718
+ state: newState,
1719
+ updatedProps,
1720
+ parentState: parentState2
1721
+ }) : newState;
1637
1722
  return result;
1638
1723
  };
1639
1724
  const [state, dispatch] = (0, import_react11.useReducer)(theReducer, wholeState);
1640
- const userDefinedActions = (0, import_react11.useMemo)(() => {
1641
- var _a2, _b;
1642
- return (_b = (_a2 = config.getReducerActions) == null ? void 0 : _a2.call(config, dispatch)) != null ? _b : {};
1643
- }, [dispatch]);
1725
+ const getComponentState = useLatest(state);
1726
+ const { allowedControlledPropOverrides } = config;
1644
1727
  const actions = (0, import_react11.useMemo)(() => {
1645
- const generatedActions = getReducerActions(dispatch, initialState, getProps);
1646
- return Object.assign(generatedActions, userDefinedActions);
1647
- }, [dispatch, userDefinedActions]);
1728
+ const generatedActions = getReducerActions(dispatch, getComponentState, getProps, propsToForward, allowedControlledPropOverrides);
1729
+ return generatedActions;
1730
+ }, [
1731
+ dispatch,
1732
+ propsToForward,
1733
+ allowedControlledPropOverrides
1734
+ ]);
1648
1735
  const Context = getComponentStateContext();
1649
- const getComponentState = useLatest(state);
1650
1736
  const contextValue = (0, import_react11.useMemo)(() => ({
1651
1737
  componentState: state,
1652
1738
  componentActions: actions,
1653
- getComponentState,
1654
- updateStateProperty: (propertyName, propertyValue) => {
1655
- dispatch({
1656
- propertyName,
1657
- payload: propertyValue
1658
- });
1659
- }
1739
+ getComponentState
1660
1740
  }), [state, actions, getComponentState]);
1661
1741
  const prevProps = usePrevious(props);
1662
1742
  (0, import_react11.useEffect)(() => {
1663
1743
  const currentProps = props;
1664
- const updatedStateFromProps = {};
1665
- let updatedCount = 0;
1666
- for (var k in wholeState) {
1744
+ const newMappedState = {};
1745
+ let newMappedStateCount = 0;
1746
+ const updatedProps = {};
1747
+ let updatedPropsCount = 0;
1748
+ for (var k in props) {
1667
1749
  const key = k;
1668
- if (wholeState.hasOwnProperty(k) && isControlled(key, props)) {
1669
- const oldValue = prevProps[key];
1670
- let newValue = currentProps[key];
1671
- if (oldValue !== newValue) {
1672
- if (config.onControlledPropertyChange) {
1673
- const modifier = config.onControlledPropertyChange(k, newValue, oldValue);
1674
- if (typeof modifier === "function") {
1675
- newValue = modifier(newValue, oldValue);
1676
- }
1750
+ const oldValue = prevProps[key];
1751
+ const newValue = currentProps[key];
1752
+ if (key === "children") {
1753
+ continue;
1754
+ }
1755
+ if (oldValue === newValue) {
1756
+ continue;
1757
+ }
1758
+ if (isControlled(key, props)) {
1759
+ if (propsToForward.hasOwnProperty(k)) {
1760
+ let valueToSet = newValue;
1761
+ const forwardFn = propsToForward[k];
1762
+ if (typeof forwardFn === "function") {
1763
+ valueToSet = forwardFn(newValue);
1764
+ }
1765
+ if (state[key] !== valueToSet) {
1766
+ newMappedState[key] = valueToSet;
1767
+ newMappedStateCount++;
1677
1768
  }
1678
- updatedStateFromProps[key] = newValue;
1679
- updatedCount++;
1769
+ } else if (propsToStateSetRef.current.has(k)) {
1770
+ updatedProps[key] = currentProps[key];
1771
+ updatedPropsCount++;
1680
1772
  }
1681
1773
  }
1682
1774
  }
1683
- if (updatedCount > 0) {
1684
- debug2("Triggered by new values for the following props", updatedStateFromProps);
1775
+ if (updatedPropsCount > 0 || newMappedStateCount > 0) {
1776
+ debug2("Triggered by new values for the following props", ...[
1777
+ ...Object.keys(newMappedState != null ? newMappedState : {}),
1778
+ ...Object.keys(updatedProps != null ? updatedProps : {})
1779
+ ]);
1685
1780
  dispatch({
1686
- newControlledProps: true,
1687
- payload: updatedStateFromProps
1781
+ payload: {
1782
+ mappedState: newMappedStateCount ? newMappedState : null,
1783
+ updatedProps: updatedPropsCount ? updatedProps : null
1784
+ }
1688
1785
  });
1689
1786
  }
1690
1787
  });
@@ -1711,7 +1808,7 @@ function useColumnAggregations() {
1711
1808
  const componentState = getComponentState();
1712
1809
  columnAggregations.forEach((aggregator, key) => {
1713
1810
  var _a;
1714
- const colField = (_a = componentState.columns.get(key)) == null ? void 0 : _a.field;
1811
+ const colField = (_a = componentState.computedColumns.get(key)) == null ? void 0 : _a.field;
1715
1812
  const newAggregator = __spreadValues({
1716
1813
  getter: (data) => colField ? data[colField] : data
1717
1814
  }, aggregator);
@@ -1794,66 +1891,349 @@ function useColumnGroups() {
1794
1891
  }, [collapsedColumnGroups]);
1795
1892
  }
1796
1893
 
1797
- // src/components/InfiniteTable/hooks/useGeneratedGroupAndPivotColumns.ts
1798
- var import_react17 = __toModule(require("react"));
1894
+ // src/components/InfiniteTable/hooks/useColumnsWhen.ts
1895
+ var import_react18 = __toModule(require("react"));
1799
1896
 
1800
- // src/components/DataSource/index.tsx
1801
- var React6 = __toModule(require("react"));
1897
+ // src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
1898
+ var React7 = __toModule(require("react"));
1802
1899
 
1803
- // src/components/DataSource/privateHooks/useLoadData.ts
1900
+ // src/utils/join.ts
1901
+ var join = (...args) => args.filter((x) => !!`${x}`).join(" ");
1902
+
1903
+ // src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
1904
+ var React6 = __toModule(require("react"));
1804
1905
  var import_react14 = __toModule(require("react"));
1805
1906
 
1806
- // src/components/DataSource/privateHooks/buildDataSourceDataInfo.ts
1807
- function buildDataSourceDataInfo(dataParam) {
1808
- let dataArray = [];
1809
- if (Array.isArray(dataParam.data)) {
1810
- dataArray = dataParam.data;
1811
- } else {
1812
- dataArray = dataParam;
1907
+ // src/components/InfiniteTable/utilities.css.ts
1908
+ var alignItems = { center: "_16lm1iwz", stretch: "_16lm1iw10" };
1909
+ var cssEllipsisClassName = "_16lm1iw18 _16lm1iw19 _16lm1iw14";
1910
+ var cursor = { pointer: "_16lm1iw9" };
1911
+ var display = { flex: "_16lm1iwh", block: "_16lm1iwi", inlineBlock: "_16lm1iwj" };
1912
+ var fill = { currentColor: "_16lm1iw5", accentColor: "_16lm1iw6" };
1913
+ var flex = { "1": "_16lm1iwa", none: "_16lm1iwb" };
1914
+ var flexFlow = { column: "_16lm1iwx", row: "_16lm1iwy" };
1915
+ var justifyContent = { center: "_16lm1iw11", start: "_16lm1iw12", end: "_16lm1iw13" };
1916
+ var left = { "0": "_16lm1iwr", "100%": "_16lm1iws" };
1917
+ var position = { relative: "_16lm1iw1", absolute: "_16lm1iw2", sticky: "_16lm1iw3", fixed: "_16lm1iw4" };
1918
+ var top = { "0": "_16lm1iwp", "100%": "_16lm1iwq" };
1919
+ var transformTranslateZero = "_16lm1iw8";
1920
+ var userSelect = { none: "_16lm1iwk" };
1921
+ var willChange = { transform: "_16lm1iw17" };
1922
+ var zIndex = { "1": "_16lm1iwc", "10": "_16lm1iwd", "1000": "_16lm1iwe", "10000": "_16lm1iwf", "100000": "_16lm1iwg" };
1923
+
1924
+ // src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
1925
+ function ExpanderIcon(props) {
1926
+ var _a;
1927
+ const { size = 24 } = props;
1928
+ const style = __spreadValues({}, props.style);
1929
+ const [expanded, setExpanded] = (0, import_react14.useState)((_a = props.expanded) != null ? _a : props.defaultExpanded);
1930
+ if (expanded) {
1931
+ style.transform = `rotate(90deg)`;
1813
1932
  }
1814
- return {
1815
- originalDataArray: dataArray
1933
+ const onClick = () => {
1934
+ var _a2;
1935
+ (_a2 = props.onChange) == null ? void 0 : _a2.call(props, !expanded);
1936
+ if (!isControlled("expanded", props)) {
1937
+ setExpanded(!expanded);
1938
+ }
1816
1939
  };
1817
- }
1818
-
1819
- // src/components/DataSource/privateHooks/loadDataAsync.ts
1820
- function loadDataAsync(data) {
1821
- return __async(this, null, function* () {
1822
- if (typeof data === "function") {
1823
- data = data();
1940
+ React6.useEffect(() => {
1941
+ if (isControlled("expanded", props)) {
1942
+ setExpanded(props.expanded);
1824
1943
  }
1825
- return buildDataSourceDataInfo(yield data);
1826
- });
1944
+ }, [props.expanded]);
1945
+ return /* @__PURE__ */ React6.createElement("svg", {
1946
+ "data-name": "expander-icon",
1947
+ xmlns: "http://www.w3.org/2000/svg",
1948
+ height: `${size}px`,
1949
+ viewBox: "0 0 24 24",
1950
+ width: `${size}px`,
1951
+ style,
1952
+ onClick,
1953
+ className: join(props.className, fill.currentColor, flex.none, cursor.pointer, expanded ? fill.accentColor : "", "InfiniteIcon", "InfiniteIcon-expander", `InfiniteIcon-expander--${expanded ? "expanded" : "collapsed"}`)
1954
+ }, /* @__PURE__ */ React6.createElement("path", {
1955
+ d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"
1956
+ }));
1827
1957
  }
1828
1958
 
1829
- // src/components/DataSource/privateHooks/useLoadData.ts
1830
- function buildDataSourceInfo(data) {
1831
- return { originalDataArray: data };
1832
- }
1833
- function useLoadData() {
1959
+ // src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
1960
+ function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params) {
1961
+ if (!pivotColumns) {
1962
+ return void 0;
1963
+ }
1834
1964
  const {
1835
- componentActions: actions,
1836
- componentState: { data }
1837
- } = useComponentState();
1838
- const loadData = (data2) => {
1839
- let dataSourceInfo = {
1840
- originalDataArray: []
1841
- };
1842
- if (typeof data2 === "function") {
1843
- data2 = data2();
1965
+ pivotColumn,
1966
+ pivotRowLabelsColumn,
1967
+ pivotBy,
1968
+ groupRowsBy,
1969
+ pivotTotalColumnPosition,
1970
+ toggleGroupRow
1971
+ } = params;
1972
+ const computedPivotColumns = new Map();
1973
+ pivotColumns.forEach((col, key) => {
1974
+ if (col.pivotTotalColumn && pivotTotalColumnPosition === false) {
1975
+ return;
1844
1976
  }
1845
- if (Array.isArray(data2)) {
1846
- dataSourceInfo = buildDataSourceInfo(data2);
1847
- actions.originalDataArray = dataSourceInfo.originalDataArray;
1848
- } else {
1849
- actions.loading = true;
1850
- loadDataAsync(data2).then((dataSourceInfo2) => {
1851
- actions.originalDataArray = dataSourceInfo2.originalDataArray;
1977
+ let column = __spreadValues({}, col);
1978
+ if (pivotColumn) {
1979
+ if (typeof pivotColumn === "function") {
1980
+ column = __spreadValues(__spreadValues({}, column), pivotColumn({
1981
+ column,
1982
+ pivotBy,
1983
+ groupRowsBy
1984
+ }));
1985
+ } else {
1986
+ column = __spreadValues(__spreadValues({}, column), pivotColumn);
1987
+ }
1988
+ }
1989
+ const isPivotRowLabelsColumn = !column.pivotColumn && !column.pivotTotalColumn;
1990
+ if (pivotRowLabelsColumn && isPivotRowLabelsColumn) {
1991
+ if (typeof pivotRowLabelsColumn === "function") {
1992
+ column = __spreadValues(__spreadValues({}, column), pivotRowLabelsColumn({
1993
+ column,
1994
+ pivotBy,
1995
+ groupRowsBy
1996
+ }));
1997
+ } else {
1998
+ column = __spreadValues(__spreadValues({}, column), pivotRowLabelsColumn);
1999
+ }
2000
+ }
2001
+ if (isPivotRowLabelsColumn && !column.render) {
2002
+ column.render = (renderOptions) => {
2003
+ var _a;
2004
+ let { value, rowInfo, column: column2, groupRowsBy: groupRowsBy2 } = renderOptions;
2005
+ if (column2.renderValue) {
2006
+ value = column2.renderValue(renderOptions);
2007
+ }
2008
+ const showExpanderIcon = (((_a = rowInfo.groupKeys) == null ? void 0 : _a.length) || 0) < groupRowsBy2.length;
2009
+ return /* @__PURE__ */ React7.createElement("div", {
2010
+ className: join(display.flex, alignItems.center),
2011
+ style: {
2012
+ paddingInlineStart: `calc(${rowInfo.groupNesting - 1} * var(--ITableRow-group-column-nesting))`
2013
+ }
2014
+ }, showExpanderIcon ? /* @__PURE__ */ React7.createElement(ExpanderIcon, {
2015
+ expanded: !rowInfo.collapsed,
2016
+ onChange: () => {
2017
+ toggleGroupRow(rowInfo.groupKeys);
2018
+ }
2019
+ }) : null, /* @__PURE__ */ React7.createElement("div", {
2020
+ className: cssEllipsisClassName
2021
+ }, value != null ? value : null));
2022
+ };
2023
+ }
2024
+ if (!column.render && column.renderValue) {
2025
+ column.render = (renderOptions) => {
2026
+ return column.renderValue(renderOptions);
2027
+ };
2028
+ }
2029
+ computedPivotColumns.set(key, column);
2030
+ });
2031
+ return computedPivotColumns;
2032
+ }
2033
+
2034
+ // src/components/InfiniteTable/utils/getColumnForGroupBy.tsx
2035
+ var React8 = __toModule(require("react"));
2036
+
2037
+ // node_modules/@vanilla-extract/recipes/createRuntimeFn/dist/vanilla-extract-recipes-createRuntimeFn.esm.js
2038
+ var shouldApplyCompound = (compoundCheck, selections) => {
2039
+ for (const key of Object.keys(compoundCheck)) {
2040
+ if (compoundCheck[key] !== selections[key]) {
2041
+ return false;
2042
+ }
2043
+ }
2044
+ return true;
2045
+ };
2046
+ var createRuntimeFn = (config) => (options) => {
2047
+ let className = config.defaultClassName;
2048
+ const selections = {
2049
+ ...config.defaultVariants,
2050
+ ...options
2051
+ };
2052
+ for (const variantName in selections) {
2053
+ var _selections$variantNa;
2054
+ const variantSelection = (_selections$variantNa = selections[variantName]) !== null && _selections$variantNa !== void 0 ? _selections$variantNa : config.defaultVariants[variantName];
2055
+ if (variantSelection != null) {
2056
+ let selection = variantSelection;
2057
+ if (typeof selection === "boolean") {
2058
+ selection = selection === true ? "true" : "false";
2059
+ }
2060
+ className += " " + config.variantClassNames[variantName][selection];
2061
+ }
2062
+ }
2063
+ for (const [compoundCheck, compoundClassName] of config.compoundVariants) {
2064
+ if (shouldApplyCompound(compoundCheck, selections)) {
2065
+ className += " " + compoundClassName;
2066
+ }
2067
+ }
2068
+ return className;
2069
+ };
2070
+
2071
+ // src/components/InfiniteTable/components/InfiniteTableRow/row.css.ts
2072
+ var GroupRowExpanderCls = "_7pupv0b";
2073
+ var RowClsRecipe = 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: [] });
2074
+ var RowHoverCls = "_7pupv01";
2075
+
2076
+ // src/components/InfiniteTable/utils/getColumnForGroupBy.tsx
2077
+ function getGroupColumnRender({
2078
+ groupIndex,
2079
+ groupRenderStrategy,
2080
+ toggleGroupRow
2081
+ }) {
2082
+ return (renderOptions) => {
2083
+ var _a;
2084
+ let { value, rowInfo, column } = renderOptions;
2085
+ if (column.renderValue) {
2086
+ value = column.renderValue(renderOptions);
2087
+ }
2088
+ let groupRowInfo = groupRenderStrategy !== "inline" ? rowInfo : ((_a = rowInfo.parents) == null ? void 0 : _a[groupIndex]) || rowInfo;
2089
+ if (!groupRowInfo) {
2090
+ return null;
2091
+ }
2092
+ const collapsed = groupRowInfo.collapsed;
2093
+ const groupKeys = groupRowInfo.groupKeys;
2094
+ if (groupRenderStrategy === "inline") {
2095
+ if (groupRowInfo.groupCount === 1) {
2096
+ return value;
2097
+ }
2098
+ if (groupRowInfo.groupNesting === groupIndex && collapsed) {
2099
+ return null;
2100
+ }
2101
+ } else {
2102
+ if (!groupRowInfo.isGroupRow) {
2103
+ return null;
2104
+ }
2105
+ if (groupIndex + 1 !== groupRowInfo.groupNesting) {
2106
+ return null;
2107
+ }
2108
+ }
2109
+ return /* @__PURE__ */ React8.createElement("div", {
2110
+ className: join(display.flex, alignItems.center)
2111
+ }, /* @__PURE__ */ React8.createElement(ExpanderIcon, {
2112
+ expanded: !collapsed,
2113
+ onChange: () => {
2114
+ toggleGroupRow(groupKeys);
2115
+ }
2116
+ }), /* @__PURE__ */ React8.createElement("div", {
2117
+ className: cssEllipsisClassName
2118
+ }, value != null ? value : null));
2119
+ };
2120
+ }
2121
+ function getColumnForGroupBy(options, toggleGroupRow, groupColumnFromProps) {
2122
+ const { groupBy, groupIndex, groupRenderStrategy } = options;
2123
+ let generatedGroupColumn = __spreadValues({
2124
+ header: `Group by ${groupBy.field}`,
2125
+ groupByField: groupBy.field,
2126
+ sortable: false,
2127
+ render: getGroupColumnRender({
2128
+ groupIndex,
2129
+ toggleGroupRow,
2130
+ groupRenderStrategy
2131
+ })
2132
+ }, groupBy.column);
2133
+ if (groupColumnFromProps) {
2134
+ if (typeof groupColumnFromProps === "function") {
2135
+ generatedGroupColumn = __spreadValues(__spreadValues({}, generatedGroupColumn), groupColumnFromProps(options, toggleGroupRow));
2136
+ } else {
2137
+ generatedGroupColumn = __spreadValues(__spreadValues({}, generatedGroupColumn), groupColumnFromProps);
2138
+ }
2139
+ }
2140
+ return generatedGroupColumn;
2141
+ }
2142
+ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
2143
+ let generatedGroupColumn = {
2144
+ header: `Group`,
2145
+ groupByField: options.groupRowsBy.map((g) => g.field),
2146
+ sortable: false,
2147
+ render: (renderOptions) => {
2148
+ let { value, rowInfo, column } = renderOptions;
2149
+ if (!rowInfo.isGroupRow) {
2150
+ return null;
2151
+ }
2152
+ if (column.renderValue) {
2153
+ value = column.renderValue(renderOptions);
2154
+ }
2155
+ return /* @__PURE__ */ React8.createElement("div", {
2156
+ className: join(display.flex, alignItems.center, GroupRowExpanderCls)
2157
+ }, /* @__PURE__ */ React8.createElement(ExpanderIcon, {
2158
+ expanded: !rowInfo.collapsed,
2159
+ onChange: () => {
2160
+ toggleGroupRow(rowInfo.groupKeys);
2161
+ }
2162
+ }), /* @__PURE__ */ React8.createElement("div", {
2163
+ className: cssEllipsisClassName
2164
+ }, value != null ? value : null));
2165
+ }
2166
+ };
2167
+ if (groupColumnFromProps) {
2168
+ if (typeof groupColumnFromProps === "function") {
2169
+ generatedGroupColumn = __spreadValues(__spreadValues({}, generatedGroupColumn), groupColumnFromProps(options, toggleGroupRow));
2170
+ } else {
2171
+ generatedGroupColumn = __spreadValues(__spreadValues({}, generatedGroupColumn), groupColumnFromProps);
2172
+ }
2173
+ }
2174
+ return generatedGroupColumn;
2175
+ }
2176
+
2177
+ // src/components/InfiniteTable/hooks/useToggleGroupRow.ts
2178
+ var import_react17 = __toModule(require("react"));
2179
+
2180
+ // src/components/DataSource/index.tsx
2181
+ var React9 = __toModule(require("react"));
2182
+
2183
+ // src/components/DataSource/privateHooks/useLoadData.ts
2184
+ var import_react15 = __toModule(require("react"));
2185
+
2186
+ // src/components/DataSource/privateHooks/buildDataSourceDataInfo.ts
2187
+ function buildDataSourceDataInfo(dataParam) {
2188
+ let dataArray = [];
2189
+ if (Array.isArray(dataParam.data)) {
2190
+ dataArray = dataParam.data;
2191
+ } else {
2192
+ dataArray = dataParam;
2193
+ }
2194
+ return {
2195
+ originalDataArray: dataArray
2196
+ };
2197
+ }
2198
+
2199
+ // src/components/DataSource/privateHooks/loadDataAsync.ts
2200
+ function loadDataAsync(data) {
2201
+ return __async(this, null, function* () {
2202
+ if (typeof data === "function") {
2203
+ data = data();
2204
+ }
2205
+ return buildDataSourceDataInfo(yield data);
2206
+ });
2207
+ }
2208
+
2209
+ // src/components/DataSource/privateHooks/useLoadData.ts
2210
+ function buildDataSourceInfo(data) {
2211
+ return { originalDataArray: data };
2212
+ }
2213
+ function useLoadData() {
2214
+ const {
2215
+ componentActions: actions,
2216
+ componentState: { data }
2217
+ } = useComponentState();
2218
+ const loadData = (data2) => {
2219
+ let dataSourceInfo = {
2220
+ originalDataArray: []
2221
+ };
2222
+ if (typeof data2 === "function") {
2223
+ data2 = data2();
2224
+ }
2225
+ if (Array.isArray(data2)) {
2226
+ dataSourceInfo = buildDataSourceInfo(data2);
2227
+ actions.originalDataArray = dataSourceInfo.originalDataArray;
2228
+ } else {
2229
+ actions.loading = true;
2230
+ loadDataAsync(data2).then((dataSourceInfo2) => {
2231
+ actions.originalDataArray = dataSourceInfo2.originalDataArray;
1852
2232
  actions.loading = false;
1853
2233
  });
1854
2234
  }
1855
2235
  };
1856
- (0, import_react14.useLayoutEffect)(() => {
2236
+ (0, import_react15.useLayoutEffect)(() => {
1857
2237
  loadData(data);
1858
2238
  }, [data]);
1859
2239
  }
@@ -1865,7 +2245,7 @@ var normalizeSortInfo = (sortInfo) => {
1865
2245
  };
1866
2246
 
1867
2247
  // src/components/hooks/useOnce.ts
1868
- var import_react15 = __toModule(require("react"));
2248
+ var import_react16 = __toModule(require("react"));
1869
2249
  function once(fn) {
1870
2250
  let called = false;
1871
2251
  let result = null;
@@ -1880,7 +2260,7 @@ function once(fn) {
1880
2260
  return onceFn;
1881
2261
  }
1882
2262
  function useOnce(fn) {
1883
- const onceFn = (0, import_react15.useMemo)(() => {
2263
+ const onceFn = (0, import_react16.useMemo)(() => {
1884
2264
  return once(fn);
1885
2265
  }, []);
1886
2266
  return onceFn();
@@ -2242,47 +2622,51 @@ var GroupRowsState = class {
2242
2622
  };
2243
2623
 
2244
2624
  // src/components/DataSource/state/getInitialState.ts
2245
- function getInitialState2(params) {
2246
- var _a, _b, _c, _d, _e;
2247
- const { props: initialProps } = params;
2248
- const dataArray = [];
2249
- const originalDataArray = [];
2250
- const sortInfo = normalizeSortInfo(isControlled("sortInfo", initialProps) ? initialProps.sortInfo : initialProps.defaultSortInfo);
2251
- const groupRowsState = initialProps.groupRowsState || initialProps.defaultGroupRowsState || new GroupRowsState({
2252
- expandedRows: true,
2253
- collapsedRows: []
2254
- });
2625
+ function initSetupState2() {
2255
2626
  const now = Date.now();
2627
+ const originalDataArray = [];
2628
+ const dataArray = [];
2256
2629
  return {
2257
- data: initialProps.data,
2258
- loading: (_b = (_a = initialProps.loading) != null ? _a : initialProps.defaultLoading) != null ? _b : false,
2259
- dataArray,
2630
+ pivotTotalColumnPosition: "end",
2260
2631
  originalDataArray,
2261
- sortInfo,
2262
- groupRowsState,
2632
+ pivotColumns: void 0,
2633
+ pivotColumnGroups: void 0,
2634
+ dataArray,
2263
2635
  updatedAt: now,
2264
2636
  groupedAt: 0,
2265
2637
  sortedAt: 0,
2266
2638
  reducedAt: now,
2267
- pivotColumns: void 0,
2268
- pivotColumnGroups: void 0,
2269
- groupRowsBy: isControlled("groupRowsBy", initialProps) ? (_c = initialProps.groupRowsBy) != null ? _c : [] : (_d = initialProps.defaultGroupRowsBy) != null ? _d : [],
2270
- pivotBy: isControlled("pivotBy", initialProps) ? (_e = initialProps.pivotBy) != null ? _e : [] : initialProps.defaultPivotBy,
2639
+ generateGroupRows: true,
2271
2640
  aggregationReducers: void 0,
2272
- pivotTotalColumnPosition: "end"
2641
+ groupDeepMap: void 0,
2642
+ postSortDataArray: void 0,
2643
+ postGroupDataArray: void 0,
2644
+ lastSortDataArray: void 0,
2645
+ lastGroupDataArray: void 0
2273
2646
  };
2274
2647
  }
2275
- function deriveReadOnlyState2(params) {
2648
+ var forwardProps3 = () => {
2649
+ return {
2650
+ remoteCount: 1,
2651
+ data: 1,
2652
+ pivotBy: 1,
2653
+ primaryKey: 1,
2654
+ loading: (loading) => loading != null ? loading : false,
2655
+ sortInfo: (sortInfo) => normalizeSortInfo(sortInfo),
2656
+ groupRowsBy: (groupRowsBy) => groupRowsBy != null ? groupRowsBy : [],
2657
+ groupRowsState: (groupRowsState) => {
2658
+ return groupRowsState || new GroupRowsState({
2659
+ expandedRows: true,
2660
+ collapsedRows: []
2661
+ });
2662
+ }
2663
+ };
2664
+ };
2665
+ function mapPropsToState2(params) {
2276
2666
  var _a;
2277
- const { props, state } = params;
2278
- const sortInfo = isControlled("sortInfo", props) ? props.sortInfo : (_a = props.defaultSortInfo) != null ? _a : null;
2667
+ const { props } = params;
2279
2668
  return {
2280
- multiSort: Array.isArray(sortInfo),
2281
- sortInfo: normalizeSortInfo(state.sortInfo),
2282
- primaryKey: props.primaryKey,
2283
- groupDeepMap: void 0,
2284
- postSortDataArray: void 0,
2285
- postGroupDataArray: void 0
2669
+ multiSort: Array.isArray((_a = props.sortInfo) != null ? _a : props.defaultSortInfo)
2286
2670
  };
2287
2671
  }
2288
2672
 
@@ -2486,7 +2870,7 @@ function flatten(groupResult) {
2486
2870
  return result;
2487
2871
  }
2488
2872
  function getEnhancedGroupData(options, deepMapValue) {
2489
- const { groupBy, groupKeys, collapsed } = options;
2873
+ const { groupBy, groupKeys, collapsed, parents } = options;
2490
2874
  const groupNesting = groupKeys.length;
2491
2875
  const { items: groupItems, reducerResults, pivotDeepMap } = deepMapValue;
2492
2876
  const enhancedGroupData = {
@@ -2496,6 +2880,10 @@ function getEnhancedGroupData(options, deepMapValue) {
2496
2880
  groupKeys,
2497
2881
  id: groupKeys,
2498
2882
  collapsed,
2883
+ parents,
2884
+ collapsedChildrenCount: 0,
2885
+ collapsedGroupsCount: 0,
2886
+ indexInParentGroups: options.indexInParentGroups,
2499
2887
  indexInGroup: options.indexInGroup,
2500
2888
  indexInAll: options.indexInAll,
2501
2889
  value: groupKeys[groupKeys.length - 1],
@@ -2517,12 +2905,14 @@ function completeReducers(reducers, reducerResults, items) {
2517
2905
  }
2518
2906
  return reducerResults;
2519
2907
  }
2520
- function enhancedFlatten(groupResult, toPrimaryKey, groupRowsState) {
2908
+ function enhancedFlatten(param) {
2909
+ const { groupResult, toPrimaryKey, groupRowsState, generateGroupRows } = param;
2521
2910
  const { groupParams, deepMap, pivot } = groupResult;
2522
2911
  const { groupBy } = groupParams;
2523
2912
  const groupByStrings = groupBy.map((g) => g.field);
2524
2913
  const result = [];
2525
2914
  const parents = [];
2915
+ const indexInParentGroups = [];
2526
2916
  deepMap.visitDepthFirst((deepMapValue, groupKeys, indexInGroup, next) => {
2527
2917
  var _a;
2528
2918
  const items = deepMapValue.items;
@@ -2530,12 +2920,24 @@ function enhancedFlatten(groupResult, toPrimaryKey, groupRowsState) {
2530
2920
  const collapsed = (_a = groupRowsState == null ? void 0 : groupRowsState.isGroupRowCollapsed(groupKeys)) != null ? _a : false;
2531
2921
  const enhancedGroupData = getEnhancedGroupData({
2532
2922
  groupBy: groupByStrings,
2923
+ parents: Array.from(parents),
2533
2924
  indexInGroup,
2925
+ indexInParentGroups: Array.from(indexInParentGroups),
2534
2926
  indexInAll: result.length,
2535
2927
  groupKeys,
2536
2928
  collapsed
2537
2929
  }, deepMapValue);
2538
- result.push(enhancedGroupData);
2930
+ const include = generateGroupRows || collapsed;
2931
+ if (include) {
2932
+ result.push(enhancedGroupData);
2933
+ }
2934
+ if (collapsed) {
2935
+ parents.forEach((parent) => {
2936
+ parent.collapsedChildrenCount += enhancedGroupData.groupCount;
2937
+ parent.collapsedGroupsCount += 1;
2938
+ });
2939
+ }
2940
+ indexInParentGroups.push(indexInGroup);
2539
2941
  parents.push(enhancedGroupData);
2540
2942
  if (!collapsed) {
2541
2943
  if (!next) {
@@ -2547,11 +2949,14 @@ function enhancedFlatten(groupResult, toPrimaryKey, groupRowsState) {
2547
2949
  data: item,
2548
2950
  isGroupRow: false,
2549
2951
  collapsed: false,
2550
- parentGroupKeys: groupKeys,
2952
+ groupKeys,
2953
+ parents: Array.from(parents),
2954
+ indexInParentGroups: [...indexInParentGroups, index],
2551
2955
  indexInGroup: index,
2552
2956
  indexInAll: startIndex + index,
2553
2957
  groupBy: groupByStrings,
2554
- groupNesting
2958
+ groupNesting,
2959
+ groupCount: enhancedGroupData.groupCount
2555
2960
  };
2556
2961
  }));
2557
2962
  }
@@ -2560,6 +2965,7 @@ function enhancedFlatten(groupResult, toPrimaryKey, groupRowsState) {
2560
2965
  }
2561
2966
  }
2562
2967
  parents.pop();
2968
+ indexInParentGroups.pop();
2563
2969
  });
2564
2970
  return {
2565
2971
  data: result
@@ -2574,8 +2980,8 @@ function getPivotColumnsAndColumnGroups(deepMap, pivotBy, pivotTotalColumnPositi
2574
2980
  header: "Row labels",
2575
2981
  valueGetter: (params) => {
2576
2982
  var _a;
2577
- const { enhancedData } = params;
2578
- return enhancedData.groupKeys ? enhancedData.groupKeys[((_a = enhancedData.groupKeys) == null ? void 0 : _a.length) - 1] : null;
2983
+ const { rowInfo } = params;
2984
+ return rowInfo.groupKeys ? rowInfo.groupKeys[((_a = rowInfo.groupKeys) == null ? void 0 : _a.length) - 1] : null;
2579
2985
  }
2580
2986
  }
2581
2987
  ]
@@ -2596,9 +3002,9 @@ function getPivotColumnsAndColumnGroups(deepMap, pivotBy, pivotTotalColumnPositi
2596
3002
  sortable: false,
2597
3003
  columnGroup: parentKeys.length ? `${columnGroupId}` : void 0,
2598
3004
  header: keys[keys.length - 1],
2599
- valueGetter: ({ enhancedData }) => {
3005
+ valueGetter: ({ rowInfo }) => {
2600
3006
  var _a, _b, _c;
2601
- const value = (_c = (_b = (_a = enhancedData.pivotValuesMap) == null ? void 0 : _a.get(keys)) == null ? void 0 : _b.reducerResults[0]) != null ? _c : null;
3007
+ const value = (_c = (_b = (_a = rowInfo.pivotValuesMap) == null ? void 0 : _a.get(keys)) == null ? void 0 : _b.reducerResults[0]) != null ? _c : null;
2602
3008
  return value;
2603
3009
  }
2604
3010
  });
@@ -2617,9 +3023,9 @@ function getPivotColumnsAndColumnGroups(deepMap, pivotBy, pivotTotalColumnPositi
2617
3023
  pivotGroupKeys: keys,
2618
3024
  pivotBy,
2619
3025
  sortable: false,
2620
- valueGetter: ({ enhancedData }) => {
3026
+ valueGetter: ({ rowInfo }) => {
2621
3027
  var _a, _b, _c;
2622
- const value = (_c = (_b = (_a = enhancedData.pivotValuesMap) == null ? void 0 : _a.get(keys)) == null ? void 0 : _b.reducerResults[0]) != null ? _c : null;
3028
+ const value = (_c = (_b = (_a = rowInfo.pivotValuesMap) == null ? void 0 : _a.get(keys)) == null ? void 0 : _b.reducerResults[0]) != null ? _c : null;
2623
3029
  return value;
2624
3030
  }
2625
3031
  });
@@ -2632,9 +3038,9 @@ function getPivotColumnsAndColumnGroups(deepMap, pivotBy, pivotTotalColumnPositi
2632
3038
  if (columns.size === 1) {
2633
3039
  columns.set("single", {
2634
3040
  header: "Reduced",
2635
- valueGetter: ({ enhancedData }) => {
3041
+ valueGetter: ({ rowInfo }) => {
2636
3042
  var _a;
2637
- return (_a = enhancedData.reducerResults) == null ? void 0 : _a[0];
3043
+ return (_a = rowInfo.reducerResults) == null ? void 0 : _a[0];
2638
3044
  }
2639
3045
  });
2640
3046
  }
@@ -2646,26 +3052,26 @@ function getPivotColumnsAndColumnGroups(deepMap, pivotBy, pivotTotalColumnPositi
2646
3052
  }
2647
3053
 
2648
3054
  // src/components/DataSource/state/reducer.ts
2649
- var haveDepsChanged = (updated, deps) => {
2650
- if (!updated) {
2651
- return false;
2652
- }
2653
- for (var i = 0, len = deps.length; i < len; i++) {
2654
- if (updated.hasOwnProperty(deps[i])) {
3055
+ var haveDepsChanged = (state1, state2, deps) => {
3056
+ for (let i = 0, len = deps.length; i < len; i++) {
3057
+ const k = deps[i];
3058
+ const oldValue = state1[k];
3059
+ const newValue = state2[k];
3060
+ if (oldValue !== newValue) {
2655
3061
  return true;
2656
3062
  }
2657
3063
  }
2658
3064
  return false;
2659
3065
  };
2660
- function toEnhancedData(data, id, index) {
3066
+ function toRowInfo(data, id, index) {
2661
3067
  return { data, collapsed: true, id, indexInAll: index, indexInGroup: index };
2662
3068
  }
2663
3069
  function concludeReducer(params) {
2664
3070
  var _a;
2665
- const { state, previousState, updated } = params;
3071
+ const { state, previousState } = params;
2666
3072
  const sortInfo = state.sortInfo;
2667
- const shouldSort = sortInfo == null ? void 0 : sortInfo.length;
2668
- const sortDepsChanged = haveDepsChanged(updated, [
3073
+ const shouldSort = !!(sortInfo == null ? void 0 : sortInfo.length);
3074
+ const sortDepsChanged = haveDepsChanged(previousState, state, [
2669
3075
  "originalDataArray",
2670
3076
  "sortInfo"
2671
3077
  ]);
@@ -2673,7 +3079,8 @@ function concludeReducer(params) {
2673
3079
  const groupBy = state.groupRowsBy;
2674
3080
  const pivotBy = state.pivotBy;
2675
3081
  const shouldGroup = groupBy.length || pivotBy;
2676
- const groupsDepsChanged = haveDepsChanged(updated, [
3082
+ const groupsDepsChanged = haveDepsChanged(previousState, state, [
3083
+ "generateGroupRows",
2677
3084
  "originalDataArray",
2678
3085
  "groupRowsBy",
2679
3086
  "groupRowsState",
@@ -2685,7 +3092,7 @@ function concludeReducer(params) {
2685
3092
  const shouldGroupAgain = shouldGroup && (groupsDepsChanged || !state.lastGroupDataArray);
2686
3093
  const now = Date.now();
2687
3094
  let dataArray = state.originalDataArray;
2688
- let enhancedDataArray = state.dataArray;
3095
+ let rowInfoDataArray = state.dataArray;
2689
3096
  if (shouldSort) {
2690
3097
  dataArray = shouldSortAgain ? multisort(sortInfo, [...dataArray]) : state.lastSortDataArray;
2691
3098
  state.lastSortDataArray = dataArray;
@@ -2703,30 +3110,35 @@ function concludeReducer(params) {
2703
3110
  pivot: pivotBy,
2704
3111
  reducers: state.aggregationReducers
2705
3112
  }, dataArray);
2706
- const flattenResult = enhancedFlatten(groupResult, toPrimaryKey, state.groupRowsState);
2707
- enhancedDataArray = flattenResult.data;
3113
+ const flattenResult = enhancedFlatten({
3114
+ groupResult,
3115
+ toPrimaryKey,
3116
+ groupRowsState: state.groupRowsState,
3117
+ generateGroupRows: state.generateGroupRows
3118
+ });
3119
+ rowInfoDataArray = flattenResult.data;
2708
3120
  state.groupDeepMap = groupResult.deepMap;
2709
3121
  const pivotGroupsAndCols = pivotBy ? getPivotColumnsAndColumnGroups(groupResult.topLevelPivotColumns, pivotBy, (_a = state.pivotTotalColumnPosition) != null ? _a : "end") : void 0;
2710
3122
  state.pivotColumns = pivotGroupsAndCols == null ? void 0 : pivotGroupsAndCols.columns;
2711
3123
  state.pivotColumnGroups = pivotGroupsAndCols == null ? void 0 : pivotGroupsAndCols.columnGroups;
2712
3124
  } else {
2713
- enhancedDataArray = state.lastGroupDataArray;
3125
+ rowInfoDataArray = state.lastGroupDataArray;
2714
3126
  }
2715
- state.lastGroupDataArray = enhancedDataArray;
3127
+ state.lastGroupDataArray = rowInfoDataArray;
2716
3128
  state.groupedAt = now;
2717
3129
  } else {
2718
3130
  state.groupDeepMap = void 0;
2719
3131
  state.pivotColumns = void 0;
2720
3132
  const arrayDifferentAfterSortStep = previousState.postSortDataArray != state.postSortDataArray;
2721
3133
  if (arrayDifferentAfterSortStep) {
2722
- enhancedDataArray = dataArray.map((data, index) => toEnhancedData(data, toPrimaryKey(data), index));
3134
+ rowInfoDataArray = dataArray.map((data, index) => toRowInfo(data, toPrimaryKey(data), index));
2723
3135
  }
2724
3136
  }
2725
- state.postGroupDataArray = enhancedDataArray;
2726
- if (enhancedDataArray !== state.dataArray) {
3137
+ state.postGroupDataArray = rowInfoDataArray;
3138
+ if (rowInfoDataArray !== state.dataArray) {
2727
3139
  state.updatedAt = now;
2728
3140
  }
2729
- state.dataArray = enhancedDataArray;
3141
+ state.dataArray = rowInfoDataArray;
2730
3142
  state.reducedAt = now;
2731
3143
  globalThis.state = state;
2732
3144
  return state;
@@ -2745,12 +3157,13 @@ function DataSourceWithContext(props) {
2745
3157
  if (typeof children === "function") {
2746
3158
  children = children(computedValues);
2747
3159
  }
2748
- return /* @__PURE__ */ React6.createElement(React6.Fragment, null, children);
3160
+ return /* @__PURE__ */ React9.createElement(React9.Fragment, null, children);
2749
3161
  }
2750
3162
  var DataSourceRoot = getComponentStateRoot({
2751
- getInitialState: getInitialState2,
3163
+ initSetupState: initSetupState2,
3164
+ forwardProps: forwardProps3,
2752
3165
  concludeReducer,
2753
- deriveReadOnlyState: deriveReadOnlyState2
3166
+ mapPropsToState: mapPropsToState2
2754
3167
  });
2755
3168
  function DataSourceCmp({ children }) {
2756
3169
  const DataSourceContext = getDataSourceContext();
@@ -2761,445 +3174,319 @@ function DataSourceCmp({ children }) {
2761
3174
  componentActions,
2762
3175
  getState
2763
3176
  };
3177
+ if (false) {
3178
+ globalThis.getDataSourceState = getState;
3179
+ }
2764
3180
  useLoadData();
2765
- return /* @__PURE__ */ React6.createElement(DataSourceContext.Provider, {
3181
+ return /* @__PURE__ */ React9.createElement(DataSourceContext.Provider, {
2766
3182
  value: contextValue
2767
- }, /* @__PURE__ */ React6.createElement(DataSourceWithContext, {
3183
+ }, /* @__PURE__ */ React9.createElement(DataSourceWithContext, {
2768
3184
  children
2769
3185
  }));
2770
3186
  }
2771
3187
  function DataSource(props) {
2772
- return /* @__PURE__ */ React6.createElement(DataSourceRoot, __spreadValues({}, props), /* @__PURE__ */ React6.createElement(DataSourceCmp, {
3188
+ return /* @__PURE__ */ React9.createElement(DataSourceRoot, __spreadValues({}, props), /* @__PURE__ */ React9.createElement(DataSourceCmp, {
2773
3189
  children: props.children
2774
3190
  }));
2775
3191
  }
2776
3192
 
2777
- // src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
2778
- var React8 = __toModule(require("react"));
2779
-
2780
- // src/style/utilities.ts
2781
- var rule = (name, value) => `it__${name}=${value}`;
2782
- var ICSS = {
2783
- variables: {
2784
- space: [
2785
- "--it-space-0",
2786
- "--it-space-1",
2787
- "--it-space-2",
2788
- "--it-space-3",
2789
- "--it-space-4",
2790
- "--it-space-5",
2791
- "--it-space-6",
2792
- "--it-space-7",
2793
- "--it-space-8",
2794
- "--it-space-9",
2795
- "--it-space-10"
2796
- ],
2797
- borderRadius: "--it__border-radius",
2798
- fontSize: [
2799
- "--it-font-size-0",
2800
- "--it-font-size-1",
2801
- "--it-font-size-2",
2802
- "--it-font-size-3",
2803
- "--it-font-size-4",
2804
- "--it-font-size-5",
2805
- "--it-font-size-6",
2806
- "--it-font-size-7"
2807
- ]
2808
- },
2809
- alignItems: {
2810
- center: rule("align-items", "center"),
2811
- stretch: rule("align-items", "stretch")
2812
- },
2813
- justifyContent: {
2814
- center: rule("justify-content", "center"),
2815
- "flex-start": rule("justify-content", "flex-start"),
2816
- flexStart: rule("justify-content", "flex-start"),
2817
- "flex-end": rule("justify-content", "flex-end"),
2818
- flexEnd: rule("justify-content", "flex-end")
2819
- },
2820
- overflow: {
2821
- hidden: rule("overflow", "hidden"),
2822
- visible: rule("overflow", "visible"),
2823
- auto: rule("overflow", "auto")
2824
- },
2825
- overflowX: {
2826
- hidden: rule("overflow-x", "hidden"),
2827
- visible: rule("overflow-x", "visible"),
2828
- auto: rule("overflow-x", "auto")
2829
- },
2830
- overflowY: {
2831
- hidden: rule("overflow-y", "hidden"),
2832
- visible: rule("overflow-y", "visible"),
2833
- auto: rule("overflow-y", "auto")
2834
- },
2835
- cursor: {
2836
- pointer: rule("cursor", "pointer")
2837
- },
2838
- height: {
2839
- 0: rule("height", "0"),
2840
- "100%": rule("height", "100%")
2841
- },
2842
- width: {
2843
- 0: rule("width", "0"),
2844
- "100%": rule("width", "100%")
2845
- },
2846
- top: {
2847
- 0: rule("top", "0"),
2848
- "100%": rule("top", "100%")
2849
- },
2850
- left: {
2851
- 0: rule("left", "0"),
2852
- "100%": rule("left", "100%")
2853
- },
2854
- transform: {
2855
- translate3D000: rule("transform", "translate3D000")
2856
- },
2857
- willChange: {
2858
- transform: rule("will-change", "transform")
2859
- },
2860
- position: {
2861
- relative: rule("position", "relative"),
2862
- absolute: rule("position", "absolute"),
2863
- fixed: rule("position", "fixed")
2864
- },
2865
- display: {
2866
- flex: rule("display", "flex")
2867
- },
2868
- flexFlow: {
2869
- row: rule("flex-flow", "row"),
2870
- column: rule("flex-flow", "column")
2871
- },
2872
- whiteSpace: {
2873
- nowrap: rule("white-space", "nowrap")
2874
- },
2875
- textOverflow: {
2876
- ellipsis: rule("text-overflow", "ellipsis")
2877
- },
2878
- userSelect: {
2879
- none: rule("user-select", "none")
2880
- }
2881
- };
2882
-
2883
- // src/style/css.ts
2884
- var cssEllipsisClassName = `${ICSS.whiteSpace.nowrap} ${ICSS.textOverflow.ellipsis} ${ICSS.overflow.hidden}`;
2885
-
2886
- // src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
2887
- var React7 = __toModule(require("react"));
2888
- var import_react16 = __toModule(require("react"));
2889
- function ExpanderIcon(props) {
2890
- var _a;
2891
- const { size = 24 } = props;
2892
- const style = __spreadValues({}, props.style);
2893
- const [expanded, setExpanded] = (0, import_react16.useState)((_a = props.expanded) != null ? _a : props.defaultExpanded);
2894
- if (expanded) {
2895
- style.transform = `rotate(90deg)`;
2896
- }
2897
- const onClick = () => {
2898
- var _a2;
2899
- (_a2 = props.onChange) == null ? void 0 : _a2.call(props, !expanded);
2900
- if (!isControlled("expanded", props)) {
2901
- setExpanded(!expanded);
2902
- }
2903
- };
2904
- React7.useEffect(() => {
2905
- if (isControlled("expanded", props)) {
2906
- setExpanded(props.expanded);
2907
- }
2908
- }, [props.expanded]);
2909
- return /* @__PURE__ */ React7.createElement("svg", {
2910
- "data-name": "expander-icon",
2911
- xmlns: "http://www.w3.org/2000/svg",
2912
- height: `${size}px`,
2913
- viewBox: "0 0 24 24",
2914
- width: `${size}px`,
2915
- style,
2916
- onClick,
2917
- className: join(props.className, "ITableIcon", "ITableIcon-expander", `ITableIcon-expander--${expanded ? "expanded" : "collapsed"}`)
2918
- }, /* @__PURE__ */ React7.createElement("path", {
2919
- d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"
2920
- }));
3193
+ // src/components/InfiniteTable/hooks/useToggleGroupRow.ts
3194
+ function useToggleGroupRow() {
3195
+ const { getState: getDataSourceState, componentActions: dataSourceActions } = useDataSourceContextValue();
3196
+ const toggleGroupRow = (0, import_react17.useCallback)((groupKeys) => {
3197
+ const newState = new GroupRowsState(getDataSourceState().groupRowsState);
3198
+ newState.toggleGroupRow(groupKeys);
3199
+ dataSourceActions.groupRowsState = newState;
3200
+ }, []);
3201
+ return toggleGroupRow;
2921
3202
  }
2922
3203
 
2923
- // src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
2924
- function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params) {
2925
- if (!pivotColumns) {
2926
- return void 0;
2927
- }
3204
+ // src/components/InfiniteTable/hooks/useColumnsWhen.ts
3205
+ function useGroupRowsMap(groupRowsBy) {
3206
+ const groupRowsMap = (0, import_react18.useMemo)(() => {
3207
+ return groupRowsBy.reduce((acc, groupBy, index) => {
3208
+ acc.set(groupBy.field, {
3209
+ groupBy,
3210
+ groupIndex: index
3211
+ });
3212
+ return acc;
3213
+ }, new Map());
3214
+ }, [groupRowsBy]);
3215
+ return groupRowsMap;
3216
+ }
3217
+ function useColumnsWhen() {
2928
3218
  const {
2929
- pivotColumn,
2930
- pivotRowLabelsColumn,
2931
- pivotBy,
2932
- groupRowsBy,
2933
- pivotTotalColumnPosition,
2934
- toggleGroupRow
2935
- } = params;
2936
- const computedPivotColumns = new Map();
2937
- pivotColumns.forEach((col, key) => {
2938
- if (col.pivotTotalColumn && pivotTotalColumnPosition === false) {
2939
- return;
2940
- }
2941
- let column = __spreadValues({}, col);
2942
- if (pivotColumn) {
2943
- if (typeof pivotColumn === "function") {
2944
- column = __spreadValues(__spreadValues({}, column), pivotColumn({
2945
- column,
2946
- pivotBy,
2947
- groupRowsBy
2948
- }));
2949
- } else {
2950
- column = __spreadValues(__spreadValues({}, column), pivotColumn);
2951
- }
2952
- }
2953
- const isPivotRowLabelsColumn = !column.pivotColumn && !column.pivotTotalColumn;
2954
- if (pivotRowLabelsColumn && isPivotRowLabelsColumn) {
2955
- if (typeof pivotRowLabelsColumn === "function") {
2956
- column = __spreadValues(__spreadValues({}, column), pivotRowLabelsColumn({
2957
- column,
2958
- pivotBy,
2959
- groupRowsBy
2960
- }));
2961
- } else {
2962
- column = __spreadValues(__spreadValues({}, column), pivotRowLabelsColumn);
2963
- }
2964
- }
2965
- if (isPivotRowLabelsColumn && !column.render) {
2966
- column.render = (renderOptions) => {
2967
- var _a;
2968
- let { value, enhancedData, column: column2, groupRowsBy: groupRowsBy2 } = renderOptions;
2969
- if (column2.renderValue) {
2970
- value = column2.renderValue(renderOptions);
2971
- }
2972
- const showExpanderIcon = (((_a = enhancedData.groupKeys) == null ? void 0 : _a.length) || 0) < groupRowsBy2.length;
2973
- return /* @__PURE__ */ React8.createElement("div", {
2974
- className: join(ICSS.display.flex, ICSS.alignItems.center),
2975
- style: {
2976
- paddingInlineStart: `calc(${enhancedData.groupNesting - 1} * var(--ITableRow-group-column-nesting))`
2977
- }
2978
- }, showExpanderIcon ? /* @__PURE__ */ React8.createElement(ExpanderIcon, {
2979
- expanded: !enhancedData.collapsed,
2980
- onChange: () => {
2981
- toggleGroupRow(enhancedData.groupKeys);
2982
- }
2983
- }) : null, /* @__PURE__ */ React8.createElement("div", {
2984
- className: cssEllipsisClassName
2985
- }, value != null ? value : null));
2986
- };
2987
- }
2988
- if (!column.render && column.renderValue) {
2989
- column.render = (renderOptions) => {
2990
- return column.renderValue(renderOptions);
2991
- };
2992
- }
2993
- computedPivotColumns.set(key, column);
2994
- });
2995
- return computedPivotColumns;
3219
+ componentState: { groupRowsBy },
3220
+ componentActions: dataSourceActions
3221
+ } = useDataSourceContextValue();
3222
+ const {
3223
+ componentState: { groupRenderStrategy, pivotTotalColumnPosition }
3224
+ } = useComponentState();
3225
+ const groupRowsMap = useGroupRowsMap(groupRowsBy);
3226
+ (0, import_react18.useEffect)(() => {
3227
+ dataSourceActions.generateGroupRows = groupRenderStrategy !== "inline";
3228
+ }, [groupRenderStrategy]);
3229
+ (0, import_react18.useEffect)(() => {
3230
+ dataSourceActions.pivotTotalColumnPosition = pivotTotalColumnPosition;
3231
+ }, [pivotTotalColumnPosition]);
3232
+ useColumnsWhenInlineGroupRenderStrategy(groupRowsMap);
3233
+ useColumnsWhenPivoting();
3234
+ useColumnsWhenGrouping();
3235
+ useHideEmptyGroupColumns(groupRowsMap);
2996
3236
  }
2997
-
2998
- // src/components/InfiniteTable/utils/getColumnForGroupBy.tsx
2999
- var React9 = __toModule(require("react"));
3000
- function getColumnForGroupBy(options, toggleGroupRow, groupColumnFromProps) {
3001
- const { groupBy, groupIndex } = options;
3002
- let generatedGroupColumn = __spreadValues({
3003
- header: `Group by ${groupBy.field}`,
3004
- groupByField: groupBy.field,
3005
- sortable: false,
3006
- render: (renderOptions) => {
3007
- let { value, enhancedData, column } = renderOptions;
3008
- if (!enhancedData.isGroupRow) {
3009
- return null;
3010
- }
3011
- if (groupIndex + 1 !== enhancedData.groupNesting) {
3012
- return null;
3013
- }
3014
- if (column.renderValue) {
3015
- value = column.renderValue(renderOptions);
3237
+ function useColumnsWhenInlineGroupRenderStrategy(groupRowsMap) {
3238
+ const toggleGroupRow = useToggleGroupRow();
3239
+ const {
3240
+ componentActions,
3241
+ componentState: { columns, groupRenderStrategy }
3242
+ } = useComponentState();
3243
+ function computeColumnsWhenInlineGroupRenderStrategy(columns2, groupRowsMap2, groupRenderStrategy2, toggleGroupRow2) {
3244
+ const computedColumns = new Map();
3245
+ columns2.forEach((column, id) => {
3246
+ let base = {};
3247
+ const groupByForColumn = groupRowsMap2.get(column.field);
3248
+ if (groupByForColumn && groupRenderStrategy2 === "inline") {
3249
+ const { groupIndex } = groupByForColumn;
3250
+ const field = groupByForColumn.groupBy.field;
3251
+ base = {
3252
+ groupByField: field,
3253
+ field,
3254
+ valueGetter: ({ rowInfo }) => {
3255
+ var _a;
3256
+ return (_a = rowInfo.groupKeys) == null ? void 0 : _a[groupIndex];
3257
+ },
3258
+ rowspan: ({ rowInfo, dataArray }) => {
3259
+ const prevRowInfo = dataArray[rowInfo.indexInAll - 1] || {
3260
+ indexInParentGroups: []
3261
+ };
3262
+ const prevIndexes = prevRowInfo.indexInParentGroups || [];
3263
+ const currentIndexes = rowInfo.indexInParentGroups || [];
3264
+ let computeSpan = false;
3265
+ for (let i = 0; i <= groupIndex; i++) {
3266
+ const prev = prevIndexes[i];
3267
+ const current = currentIndexes[i];
3268
+ if (current !== prev) {
3269
+ computeSpan = true;
3270
+ break;
3271
+ }
3272
+ }
3273
+ if (!computeSpan) {
3274
+ return 1;
3275
+ }
3276
+ const parentGroup = rowInfo.parents[groupIndex];
3277
+ const rowspan = parentGroup ? parentGroup.groupCount - (parentGroup.collapsedChildrenCount || 0) + (parentGroup.collapsedGroupsCount || 0) : 1;
3278
+ return rowspan;
3279
+ },
3280
+ render: getGroupColumnRender({
3281
+ groupIndex,
3282
+ groupRenderStrategy: groupRenderStrategy2,
3283
+ toggleGroupRow: toggleGroupRow2
3284
+ })
3285
+ };
3016
3286
  }
3017
- return /* @__PURE__ */ React9.createElement("div", {
3018
- className: join(ICSS.display.flex, ICSS.alignItems.center)
3019
- }, /* @__PURE__ */ React9.createElement(ExpanderIcon, {
3020
- expanded: !enhancedData.collapsed,
3021
- onChange: () => {
3022
- toggleGroupRow(enhancedData.groupKeys);
3023
- }
3024
- }), /* @__PURE__ */ React9.createElement("div", {
3025
- className: cssEllipsisClassName
3026
- }, value != null ? value : null));
3027
- }
3028
- }, groupBy.column);
3029
- if (groupColumnFromProps) {
3030
- if (typeof groupColumnFromProps === "function") {
3031
- generatedGroupColumn = __spreadValues(__spreadValues({}, generatedGroupColumn), groupColumnFromProps(options, toggleGroupRow));
3032
- } else {
3033
- generatedGroupColumn = __spreadValues(__spreadValues({}, generatedGroupColumn), groupColumnFromProps);
3034
- }
3287
+ const clone = __spreadValues(__spreadValues({}, base), column);
3288
+ computedColumns.set(id, clone);
3289
+ });
3290
+ return computedColumns.size === 0 ? void 0 : computedColumns;
3035
3291
  }
3036
- return generatedGroupColumn;
3292
+ (0, import_react18.useEffect)(() => {
3293
+ const update = () => {
3294
+ componentActions.columnsWhenInlineGroupRenderStrategy = computeColumnsWhenInlineGroupRenderStrategy(columns, groupRowsMap, groupRenderStrategy, toggleGroupRow);
3295
+ };
3296
+ update();
3297
+ return interceptMap(columns, {
3298
+ set: update,
3299
+ delete: update,
3300
+ clear: update
3301
+ });
3302
+ }, [columns, groupRowsMap, groupRenderStrategy, toggleGroupRow]);
3037
3303
  }
3038
- function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
3039
- let generatedGroupColumn = {
3040
- header: `Group`,
3041
- groupByField: options.groupRowsBy.map((g) => g.field),
3042
- sortable: false,
3043
- render: (renderOptions) => {
3044
- let { value, enhancedData, column } = renderOptions;
3045
- if (!enhancedData.isGroupRow) {
3046
- return null;
3047
- }
3048
- if (column.renderValue) {
3049
- value = column.renderValue(renderOptions);
3050
- }
3051
- return /* @__PURE__ */ React9.createElement("div", {
3052
- className: join(ICSS.display.flex, ICSS.alignItems.center),
3053
- style: {
3054
- paddingInlineStart: `calc(${enhancedData.groupNesting - 1} * var(--ITableRow-group-column-nesting))`
3055
- }
3056
- }, /* @__PURE__ */ React9.createElement(ExpanderIcon, {
3057
- expanded: !enhancedData.collapsed,
3058
- onChange: () => {
3059
- toggleGroupRow(enhancedData.groupKeys);
3060
- }
3061
- }), /* @__PURE__ */ React9.createElement("div", {
3062
- className: cssEllipsisClassName
3063
- }, value != null ? value : null));
3064
- }
3065
- };
3066
- if (groupColumnFromProps) {
3067
- if (typeof groupColumnFromProps === "function") {
3068
- generatedGroupColumn = __spreadValues(__spreadValues({}, generatedGroupColumn), groupColumnFromProps(options, toggleGroupRow));
3069
- } else {
3070
- generatedGroupColumn = __spreadValues(__spreadValues({}, generatedGroupColumn), groupColumnFromProps);
3304
+ function useColumnsWhenPivoting() {
3305
+ const {
3306
+ componentState: { groupRowsBy, pivotBy }
3307
+ } = useDataSourceContextValue();
3308
+ const {
3309
+ componentActions,
3310
+ componentState: {
3311
+ pivotColumns,
3312
+ pivotColumn,
3313
+ pivotRowLabelsColumn,
3314
+ pivotTotalColumnPosition
3071
3315
  }
3072
- }
3073
- return generatedGroupColumn;
3316
+ } = useComponentState();
3317
+ const toggleGroupRow = useToggleGroupRow();
3318
+ (0, import_react18.useEffect)(() => {
3319
+ const computedPivotColumns = getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, {
3320
+ pivotColumn,
3321
+ pivotRowLabelsColumn,
3322
+ pivotTotalColumnPosition,
3323
+ pivotBy,
3324
+ groupRowsBy,
3325
+ toggleGroupRow
3326
+ });
3327
+ componentActions.computedPivotColumns = computedPivotColumns;
3328
+ }, [pivotColumns, pivotColumn, pivotRowLabelsColumn]);
3074
3329
  }
3075
-
3076
- // src/components/InfiniteTable/hooks/useGeneratedGroupAndPivotColumns.ts
3077
- function getGroupRenderStrategy(options) {
3078
- const { groupRowsBy, groupColumn, groupRenderStrategy } = options;
3079
- if (groupRenderStrategy) {
3080
- return groupRenderStrategy;
3081
- }
3082
- if (groupColumn != null && typeof groupColumn === "object") {
3083
- return "single-column";
3084
- }
3085
- const columnsInGroupRowsBy = groupRowsBy.filter((g) => g.column);
3086
- if (columnsInGroupRowsBy.length) {
3087
- return "multi-column";
3088
- }
3089
- return "multi-column";
3330
+ function useColumnsWhenGrouping() {
3331
+ const {
3332
+ componentState: { groupRowsBy }
3333
+ } = useDataSourceContextValue();
3334
+ const {
3335
+ componentActions,
3336
+ componentState: { columns, groupColumn, groupRenderStrategy, pivotColumns }
3337
+ } = useComponentState();
3338
+ const toggleGroupRow = useToggleGroupRow();
3339
+ (0, import_react18.useEffect)(() => {
3340
+ if (pivotColumns) {
3341
+ return;
3342
+ }
3343
+ const update = () => {
3344
+ componentActions.columnsWhenGrouping = getColumnsWhenGrouping({
3345
+ columns,
3346
+ groupColumn,
3347
+ groupRenderStrategy,
3348
+ groupRowsBy,
3349
+ pivotColumns,
3350
+ toggleGroupRow
3351
+ });
3352
+ };
3353
+ update();
3354
+ return interceptMap(columns, {
3355
+ set: update,
3356
+ delete: update,
3357
+ clear: update
3358
+ });
3359
+ }, [groupRowsBy, groupColumn, groupRenderStrategy, pivotColumns]);
3090
3360
  }
3091
- function useGeneratedGroupAndPivotColumns() {
3361
+ function useHideEmptyGroupColumns(groupRowsMap) {
3092
3362
  const {
3093
- componentState: { groupRowsBy, pivotBy },
3094
- getState: getDataSourceState,
3095
- componentActions: dataSourceActions
3363
+ componentState: { groupRowsBy, groupRowsState },
3364
+ getState: getDataSourceState
3096
3365
  } = useDataSourceContextValue();
3097
3366
  const {
3098
3367
  getComponentState,
3099
3368
  componentActions,
3100
3369
  componentState: {
3101
- groupColumn,
3102
- groupRenderStrategy,
3103
- pivotColumn,
3104
- pivotRowLabelsColumn,
3105
- pivotColumns,
3106
- pivotTotalColumnPosition
3370
+ columnsWhenGrouping: generatedColumns,
3371
+ hideEmptyGroupColumns,
3372
+ groupRenderStrategy
3107
3373
  }
3108
3374
  } = useComponentState();
3109
- const toggleGroupRow = (0, import_react17.useCallback)((groupKeys) => {
3110
- const newState = new GroupRowsState(getDataSourceState().groupRowsState);
3111
- newState.toggleGroupRow(groupKeys);
3112
- dataSourceActions.groupRowsState = newState;
3113
- }, []);
3114
- (0, import_react17.useEffect)(() => {
3375
+ (0, import_react18.useEffect)(() => {
3376
+ if (groupRenderStrategy === "single-column") {
3377
+ return;
3378
+ }
3379
+ const groupsLength = groupRowsBy.length;
3380
+ let expandedGroupsLevel = 0;
3381
+ const { dataArray } = getDataSourceState();
3382
+ const len = dataArray.length;
3383
+ for (let i = 0; i < len; i++) {
3384
+ const data = dataArray[i];
3385
+ expandedGroupsLevel = Math.max(expandedGroupsLevel, data.groupNesting - 1);
3386
+ if (expandedGroupsLevel === groupsLength - 1) {
3387
+ break;
3388
+ }
3389
+ }
3115
3390
  const currentState = getComponentState();
3116
- if (pivotColumns) {
3117
- if (currentState.generatedColumns.size) {
3118
- componentActions.generatedColumns = new Map();
3391
+ const { computedColumns } = currentState;
3392
+ let updated = false;
3393
+ const columnVisibility = new Map(currentState.columnVisibility);
3394
+ const cols = computedColumns;
3395
+ groupRowsBy.forEach(({ field }, index) => {
3396
+ const colId = groupRenderStrategy === "multi-column" ? `group-by-${field}` : field;
3397
+ const col = cols.get(colId);
3398
+ if (!col) {
3399
+ return;
3400
+ }
3401
+ const shouldBeHidden = index > expandedGroupsLevel;
3402
+ updated = true;
3403
+ if (shouldBeHidden && hideEmptyGroupColumns) {
3404
+ columnVisibility.set(colId, false);
3405
+ } else {
3406
+ columnVisibility.delete(colId);
3119
3407
  }
3120
- return;
3121
- }
3122
- componentActions.generatedColumns = getGeneratedGroupColumns({
3123
- groupColumn,
3124
- groupRenderStrategy,
3125
- groupRowsBy,
3126
- pivotColumns,
3127
- toggleGroupRow
3128
- });
3129
- }, [groupRowsBy, groupColumn, groupRenderStrategy, pivotColumns]);
3130
- (0, import_react17.useEffect)(() => {
3131
- dataSourceActions.pivotTotalColumnPosition = pivotTotalColumnPosition;
3132
- }, [pivotTotalColumnPosition]);
3133
- (0, import_react17.useEffect)(() => {
3134
- const computedPivotColumns = getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, {
3135
- pivotColumn,
3136
- pivotRowLabelsColumn,
3137
- pivotTotalColumnPosition,
3138
- pivotBy,
3139
- groupRowsBy,
3140
- toggleGroupRow
3141
3408
  });
3142
- componentActions.computedPivotColumns = computedPivotColumns;
3143
- }, [pivotColumns, pivotColumn, pivotRowLabelsColumn]);
3409
+ if (updated) {
3410
+ componentActions.columnVisibility = columnVisibility;
3411
+ }
3412
+ }, [
3413
+ getDataSourceState,
3414
+ groupRenderStrategy,
3415
+ generatedColumns,
3416
+ groupRowsBy,
3417
+ groupRowsMap,
3418
+ hideEmptyGroupColumns ? groupRowsState : null,
3419
+ hideEmptyGroupColumns
3420
+ ]);
3144
3421
  }
3145
- function getGeneratedGroupColumns(params) {
3422
+ function getColumnsWhenGrouping(params) {
3146
3423
  const {
3147
3424
  pivotColumns,
3148
3425
  groupRowsBy,
3149
3426
  groupColumn,
3150
3427
  groupRenderStrategy,
3151
- toggleGroupRow
3428
+ toggleGroupRow,
3429
+ columns
3152
3430
  } = params;
3153
- const generatedColumns = new Map();
3154
3431
  if (pivotColumns) {
3155
- return generatedColumns;
3432
+ return void 0;
3156
3433
  }
3157
- const strategy = getGroupRenderStrategy({
3158
- groupRowsBy,
3159
- groupColumn,
3160
- groupRenderStrategy
3161
- });
3434
+ if (groupRenderStrategy === "inline") {
3435
+ return void 0;
3436
+ }
3437
+ const computedColumns = new Map();
3162
3438
  if (groupRenderStrategy === "multi-column") {
3163
3439
  groupRowsBy.forEach((groupBy, index, arr) => {
3164
- generatedColumns.set(`group-by-${groupBy.field}`, getColumnForGroupBy({ groupBy, groupRowsBy, groupIndex: index, groupCount: arr.length }, toggleGroupRow, groupColumn));
3440
+ computedColumns.set(`group-by-${groupBy.field}`, getColumnForGroupBy({
3441
+ groupBy,
3442
+ groupRowsBy,
3443
+ groupIndex: index,
3444
+ groupCount: arr.length,
3445
+ groupRenderStrategy
3446
+ }, toggleGroupRow, groupColumn));
3165
3447
  });
3166
- } else if (strategy === "single-column") {
3167
- generatedColumns.set("group-by", getSingleGroupColumn({
3448
+ } else if (groupRenderStrategy === "single-column") {
3449
+ computedColumns.set("group-by", getSingleGroupColumn({
3168
3450
  groupCount: groupRowsBy.length,
3169
3451
  groupRowsBy
3170
3452
  }, toggleGroupRow, groupColumn));
3171
3453
  }
3172
- return generatedColumns;
3454
+ columns.forEach((col, colId) => {
3455
+ computedColumns.set(colId, col);
3456
+ });
3457
+ return computedColumns;
3173
3458
  }
3174
3459
 
3175
3460
  // src/components/InfiniteTable/hooks/useComputed.ts
3176
3461
  function useComputed() {
3177
- const { componentActions, componentState, updateStateProperty } = useComponentState();
3462
+ var _a;
3463
+ const { componentActions, componentState } = useComponentState();
3178
3464
  const {
3179
3465
  componentActions: dataSourceActions,
3180
3466
  componentState: dataSourceState
3181
3467
  } = useDataSourceContextValue();
3182
3468
  const { columnOrder, columnVisibility, columnPinning, bodySize } = componentState;
3183
- (0, import_react18.useState)(() => {
3184
- componentState.onRowHeightChange.onChange((rowHeight) => {
3469
+ (0, import_react19.useState)(() => {
3470
+ componentState.onRowHeightCSSVarChange.onChange((rowHeight) => {
3185
3471
  if (rowHeight) {
3186
- componentActions.rowHeightComputed = rowHeight;
3472
+ componentActions.rowHeight = rowHeight;
3187
3473
  }
3188
3474
  });
3189
- componentState.onHeaderHeightChange.onChange((headerHeight) => {
3475
+ componentState.onHeaderHeightCSSVarChange.onChange((headerHeight) => {
3190
3476
  if (headerHeight) {
3191
- updateStateProperty("headerHeight", headerHeight);
3477
+ componentActions.headerHeight = headerHeight;
3192
3478
  }
3193
3479
  });
3194
3480
  });
3195
3481
  useColumnAggregations();
3196
3482
  const { multiSort } = dataSourceState;
3197
3483
  useColumnGroups();
3198
- useGeneratedGroupAndPivotColumns();
3199
- const setSortInfo = (0, import_react18.useCallback)((sortInfo) => {
3200
- var _a;
3201
- dataSourceActions.sortInfo = multiSort ? sortInfo : (_a = sortInfo[0]) != null ? _a : null;
3202
- }, [multiSort]);
3484
+ useColumnsWhen();
3485
+ const setSortInfo = (0, import_react19.useCallback)((sortInfo) => {
3486
+ var _a2;
3487
+ dataSourceActions.sortInfo = multiSort ? sortInfo : (_a2 = sortInfo[0]) != null ? _a2 : null;
3488
+ }, []);
3489
+ const columns = componentState.computedColumns;
3203
3490
  const {
3204
3491
  computedColumnOrder,
3205
3492
  computedVisibleColumns,
@@ -3216,8 +3503,7 @@ function useComputed() {
3216
3503
  computedPinnedStartWidth,
3217
3504
  computedPinnedEndWidth
3218
3505
  } = useComputedVisibleColumns({
3219
- columns: componentState.computedPivotColumns || componentState.columns,
3220
- generatedColumns: componentState.generatedColumns,
3506
+ columns,
3221
3507
  columnMinWidth: componentState.columnMinWidth,
3222
3508
  columnMaxWidth: componentState.columnMaxWidth,
3223
3509
  columnDefaultWidth: componentState.columnDefaultWidth,
@@ -3226,7 +3512,7 @@ function useComputed() {
3226
3512
  bodySize,
3227
3513
  sortable: componentState.sortable,
3228
3514
  draggableColumns: componentState.draggableColumns,
3229
- sortInfo: dataSourceState.sortInfo,
3515
+ sortInfo: (_a = dataSourceState.sortInfo) != null ? _a : void 0,
3230
3516
  multiSort,
3231
3517
  setSortInfo,
3232
3518
  columnOrder,
@@ -3292,11 +3578,11 @@ var useInternalProps = () => {
3292
3578
 
3293
3579
  // src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx
3294
3580
  var InfiniteTableBody = React10.forwardRef(function InfiniteTableBody2(props, ref) {
3295
- const { rootClassName: rootClassName11 } = useInternalProps();
3581
+ const { rootClassName: rootClassName12 } = useInternalProps();
3296
3582
  return /* @__PURE__ */ React10.createElement("div", __spreadProps(__spreadValues({
3297
3583
  ref
3298
3584
  }, props), {
3299
- className: join(`${rootClassName11}Body`, ICSS.position.relative, ICSS.transform.translate3D000, props.className)
3585
+ className: join(`${rootClassName12}Body`, position.relative, flex["1"], transformTranslateZero, props.className)
3300
3586
  }));
3301
3587
  });
3302
3588
 
@@ -3365,29 +3651,47 @@ function VerticalScrollbarPlaceholderFn(props) {
3365
3651
  }
3366
3652
  var VerticalScrollbarPlaceholder = React11.memo(VerticalScrollbarPlaceholderFn);
3367
3653
 
3654
+ // src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts
3655
+ var CellCls = "_1eexc2a5 _16lm1iwh _16lm1iwy _16lm1iwz _16lm1iw2 _16lm1iw17 _16lm1iw18";
3656
+ var HeaderCellProxy = "_12zfob10";
3657
+ var HeaderCellRecipe = createRuntimeFn({ defaultClassName: "_12zfob1c", variantClassNames: { dragging: { true: "_12zfob1d", false: "_12zfob1e" }, first: { true: "_12zfob1f", false: "_12zfob1g" }, last: { true: "_12zfob1h", false: "_12zfob1i" }, groupByField: { true: "_12zfob1j", false: "_12zfob1k" }, firstInCategory: { true: "_12zfob1l", false: "_12zfob1m" }, lastInCategory: { true: "_12zfob1n", false: "_12zfob1o" }, pinned: { start: "_12zfob1p", end: "_12zfob1q", false: "_12zfob1r" } }, defaultVariants: {}, compoundVariants: [[{ pinned: "start", lastInCategory: true }, "_12zfob1s"], [{ pinned: "end", firstInCategory: true }, "_12zfob1t"], [{ pinned: false, lastInCategory: true }, "_12zfob1u"]] });
3658
+ var HeaderClsRecipe = createRuntimeFn({ defaultClassName: "_12zfob12 _16lm1iwy", variantClassNames: { pinned: { start: "_12zfob13", end: "_12zfob14", false: "_12zfob15" }, virtualized: { true: "_12zfob16", false: "_12zfob17" }, overflow: { true: "_12zfob18", false: "_12zfob19" } }, defaultVariants: {}, compoundVariants: [[{ overflow: true, pinned: "start" }, "_12zfob1a"], [{ overflow: true, pinned: "end" }, "_12zfob1b"]] });
3659
+ var HeaderGroupCls = "_16lm1iwx _16lm1iwh";
3660
+ var HeaderGroup_Children = "_16lm1iwh _16lm1iwy _16lm1iw10 _16lm1iwa";
3661
+ var HeaderGroup_Header = "_12zfob1x _16lm1iwh _16lm1iwy _16lm1iwz";
3662
+ var HeaderSortIconCls = "_12zfob11 _16lm1iw1";
3663
+ var HeaderWrapperCls = "_12zfob1v _16lm1iw14 _16lm1iw1 _16lm1iwh _16lm1iwy";
3664
+
3368
3665
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
3369
3666
  var React18 = __toModule(require("react"));
3370
- var import_react25 = __toModule(require("react"));
3667
+ var import_react26 = __toModule(require("react"));
3371
3668
 
3372
3669
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
3373
3670
  var React14 = __toModule(require("react"));
3374
- var import_react22 = __toModule(require("react"));
3671
+ var import_react23 = __toModule(require("react"));
3375
3672
 
3376
3673
  // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
3377
3674
  var React12 = __toModule(require("react"));
3378
3675
 
3379
3676
  // src/components/InfiniteTable/hooks/useInfiniteTableState.ts
3380
- var import_react19 = __toModule(require("react"));
3677
+ var import_react20 = __toModule(require("react"));
3381
3678
  var useInfiniteTableState = () => {
3382
3679
  const TableContext2 = getInfiniteTableContext();
3383
- const { componentState } = (0, import_react19.useContext)(TableContext2);
3680
+ const { componentState } = (0, import_react20.useContext)(TableContext2);
3384
3681
  return componentState;
3385
3682
  };
3386
3683
 
3684
+ // src/components/InfiniteTable/components/cell.css.ts
3685
+ var CellCls2 = "_1eexc2a5 _16lm1iwh _16lm1iwy _16lm1iwz _16lm1iw2 _16lm1iw17 _16lm1iw18";
3686
+ var CellClsVariants = { shifting: "_1eexc2a3", dragging: "_1eexc2a4" };
3687
+ var ColumnCellRecipe = createRuntimeFn({ defaultClassName: "_16lm1iw2 _16lm1iwm _16lm1iw7 _16lm1iwp", variantClassNames: { dragging: { false: "_1eexc2a7" }, first: { true: "_1eexc2a8", false: "_1eexc2a9" }, last: { true: "_1eexc2aa", false: "_1eexc2ab" }, groupByField: { true: "_1eexc2ac", false: "_1eexc2ad" }, firstInCategory: { true: "_1eexc2ae", false: "_1eexc2af" }, lastInCategory: { true: "_1eexc2ag", false: "_1eexc2ah" }, pinned: { start: "_1eexc2ai", end: "_1eexc2aj", false: "_1eexc2ak" } }, defaultVariants: {}, compoundVariants: [[{ pinned: "start", lastInCategory: true }, "_1eexc2al"], [{ pinned: "end", firstInCategory: true }, "_1eexc2am"]] });
3688
+ var columnAlignCellStyle = { center: "_1eexc2a0", start: "_1eexc2a1", end: "_1eexc2a2" };
3689
+
3387
3690
  // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
3388
3691
  var { rootClassName: rootClassName2 } = internalProps;
3389
3692
  var InfiniteTableCellClassName = `${rootClassName2}Cell`;
3390
3693
  function InfiniteTableCellFn(props) {
3694
+ var _b, _c;
3391
3695
  const _a = props, {
3392
3696
  cssEllipsis = true,
3393
3697
  virtualized = true,
@@ -3429,7 +3733,7 @@ function InfiniteTableCellFn(props) {
3429
3733
  ref: domRef,
3430
3734
  style,
3431
3735
  "data-name": `Cell`,
3432
- className: join(domProps.className, ICSS.display.flex, ICSS.flexFlow.row, ICSS.alignItems.center, ICSS.justifyContent[column.align === "center" ? column.align : `flex-${column.align}`], InfiniteTableCellClassName, shifting ? `${InfiniteTableCellClassName}--shifting` : "")
3736
+ className: join(domProps.className, columnAlignCellStyle[(_b = column.align) != null ? _b : "start"], justifyContent[(_c = column.align) != null ? _c : "start"], InfiniteTableCellClassName, CellCls2, shifting ? `${InfiniteTableCellClassName}--shifting ${CellClsVariants.shifting}` : "")
3433
3737
  }), beforeChildren, cssEllipsis ? /* @__PURE__ */ React12.createElement("div", {
3434
3738
  className: `${rootClassName2}Cell_content ${cssEllipsisClassName}`
3435
3739
  }, children) : children, afterChildren);
@@ -3438,7 +3742,7 @@ var InfiniteTableCell = React12.memo(InfiniteTableCellFn);
3438
3742
 
3439
3743
  // src/components/InfiniteTable/hooks/useColumnPointerEvents.ts
3440
3744
  var import_binary_search = __toModule(require_binary_search());
3441
- var import_react20 = __toModule(require("react"));
3745
+ var import_react21 = __toModule(require("react"));
3442
3746
 
3443
3747
  // src/components/InfiniteTable/utils/moveXatY.ts
3444
3748
  var moveXatY = (arr, dragIndex, dropIndex) => {
@@ -3472,18 +3776,18 @@ var useColumnPointerEvents = ({
3472
3776
  columns,
3473
3777
  computedRemainingSpace
3474
3778
  }) => {
3475
- const [draggingDiff, setDraggingDiff] = (0, import_react20.useState)(null);
3476
- const [proxyOffset, setProxyOffset] = (0, import_react20.useState)(null);
3477
- const breakpointsRef = (0, import_react20.useRef)([]);
3478
- const pointerMoveRef = (0, import_react20.useRef)(null);
3479
- const didDragRef = (0, import_react20.useRef)(false);
3480
- const initialClientPos = (0, import_react20.useRef)(null);
3481
- const currentDropIndexRef = (0, import_react20.useRef)(null);
3779
+ const [draggingDiff, setDraggingDiff] = (0, import_react21.useState)(null);
3780
+ const [proxyOffset, setProxyOffset] = (0, import_react21.useState)(null);
3781
+ const breakpointsRef = (0, import_react21.useRef)([]);
3782
+ const pointerMoveRef = (0, import_react21.useRef)(null);
3783
+ const didDragRef = (0, import_react21.useRef)(false);
3784
+ const initialClientPos = (0, import_react21.useRef)(null);
3785
+ const currentDropIndexRef = (0, import_react21.useRef)(null);
3482
3786
  const dragging = draggingDiff != null;
3483
3787
  const { componentActions, computed } = useInfiniteTable();
3484
3788
  const { computedColumnOrder } = computed;
3485
- const column = (0, import_react20.useMemo)(() => columns.get(columnId), [columnId, columns]);
3486
- const { columnIndex, columnWidth, columnsArray } = (0, import_react20.useMemo)(() => {
3789
+ const column = (0, import_react21.useMemo)(() => columns.get(columnId), [columnId, columns]);
3790
+ const { columnIndex, columnWidth, columnsArray } = (0, import_react21.useMemo)(() => {
3487
3791
  const columnsArray2 = Array.from(columns.values());
3488
3792
  return {
3489
3793
  columnsArray: columnsArray2,
@@ -3491,8 +3795,8 @@ var useColumnPointerEvents = ({
3491
3795
  columnWidth: column.computedWidth
3492
3796
  };
3493
3797
  }, [columns, columnId, column]);
3494
- let cursorRef = (0, import_react20.useRef)("auto");
3495
- const onPointerDown = (0, import_react20.useCallback)((e) => {
3798
+ let cursorRef = (0, import_react21.useRef)("auto");
3799
+ const onPointerDown = (0, import_react21.useCallback)((e) => {
3496
3800
  const target = domRef.current;
3497
3801
  cursorRef.current = target.style.cursor;
3498
3802
  didDragRef.current = false;
@@ -3555,7 +3859,7 @@ var useColumnPointerEvents = ({
3555
3859
  target.addEventListener("pointermove", onPointerMove);
3556
3860
  target.setPointerCapture(e.pointerId);
3557
3861
  }, [columns, column, columnIndex, columnsArray, computedRemainingSpace]);
3558
- const onPointerUp = (0, import_react20.useCallback)((e) => {
3862
+ const onPointerUp = (0, import_react21.useCallback)((e) => {
3559
3863
  const target = domRef.current;
3560
3864
  target.style.cursor = cursorRef.current;
3561
3865
  target.releasePointerCapture(e.pointerId);
@@ -3589,11 +3893,25 @@ var useColumnPointerEvents = ({
3589
3893
  };
3590
3894
 
3591
3895
  // src/components/InfiniteTable/hooks/useCellClassName.ts
3592
- function useCellClassName(column, baseClasses) {
3896
+ function useCellClassName(column, baseClasses, variants, extraFlags) {
3593
3897
  const result = [...baseClasses];
3898
+ const variantObject = {
3899
+ first: column.computedFirst,
3900
+ last: column.computedLast,
3901
+ groupByField: !!column.groupByField,
3902
+ firstInCategory: column.computedFirstInCategory,
3903
+ lastInCategory: column.computedLastInCategory,
3904
+ pinned: column.computedPinned || false,
3905
+ dragging: extraFlags.dragging
3906
+ };
3907
+ const theVariant = variants(variantObject);
3908
+ result.push(theVariant);
3594
3909
  if (column.computedFirst) {
3595
3910
  result.push(...baseClasses.map((c) => `${c}--first`));
3596
3911
  }
3912
+ if (column.groupByField) {
3913
+ result.push(...baseClasses.map((c) => `${c}--group-column`));
3914
+ }
3597
3915
  if (column.computedLast) {
3598
3916
  result.push(...baseClasses.map((c) => `${c}--last`));
3599
3917
  }
@@ -3608,7 +3926,7 @@ function useCellClassName(column, baseClasses) {
3608
3926
  } else {
3609
3927
  result.push(...baseClasses.map((c) => `${c}--unpinned`));
3610
3928
  }
3611
- return result.join(" ");
3929
+ return result.filter(Boolean).join(" ");
3612
3930
  }
3613
3931
 
3614
3932
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
@@ -3616,7 +3934,7 @@ var import_react_dom = __toModule(require("react-dom"));
3616
3934
 
3617
3935
  // src/components/InfiniteTable/components/icons/SortIcon.tsx
3618
3936
  var React13 = __toModule(require("react"));
3619
- var import_react21 = __toModule(require("react"));
3937
+ var import_react22 = __toModule(require("react"));
3620
3938
  var defaultLineStyle = {
3621
3939
  marginTop: 2,
3622
3940
  marginBottom: 2,
@@ -3624,8 +3942,8 @@ var defaultLineStyle = {
3624
3942
  };
3625
3943
  function SortIcon(props) {
3626
3944
  var _a;
3627
- const [rendered, setRendered] = (0, import_react21.useState)(true);
3628
- const [opacity, setOpacity] = (0, import_react21.useState)(0);
3945
+ const [rendered, setRendered] = (0, import_react22.useState)(true);
3946
+ const [opacity, setOpacity] = (0, import_react22.useState)(0);
3629
3947
  const { direction, lineWidth = 1, style, className, index } = props;
3630
3948
  const showIndex = index != null && index > 0;
3631
3949
  const size = (_a = props.size) != null ? _a : 16;
@@ -3639,7 +3957,7 @@ function SortIcon(props) {
3639
3957
  }), props.lineStyle), {
3640
3958
  opacity
3641
3959
  });
3642
- (0, import_react21.useEffect)(() => {
3960
+ (0, import_react22.useEffect)(() => {
3643
3961
  const newOpacity = direction != 0 ? 1 : 0;
3644
3962
  if (!rendered && newOpacity) {
3645
3963
  setRendered(true);
@@ -3713,11 +4031,11 @@ function InfiniteTableHeaderCell(props) {
3713
4031
  header = header != null ? header : column.name;
3714
4032
  const sortTool = /* @__PURE__ */ React14.createElement(SortIcon, {
3715
4033
  index: column.computedMultiSort ? column.computedSortIndex + 1 : void 0,
3716
- className: `${baseCls}__sort-icon`,
4034
+ className: `${baseCls}__sort-icon ${HeaderSortIconCls}`,
3717
4035
  direction: column.computedSorted ? column.computedSortedAsc ? 1 : -1 : 0
3718
4036
  });
3719
- const domRef = (0, import_react22.useRef)(null);
3720
- const ref = (0, import_react22.useCallback)((node) => {
4037
+ const domRef = (0, import_react23.useRef)(null);
4038
+ const ref = (0, import_react23.useCallback)((node) => {
3721
4039
  var _a2;
3722
4040
  domRef.current = node;
3723
4041
  (_a2 = props.domRef) == null ? void 0 : _a2.call(props, node);
@@ -3726,7 +4044,7 @@ function InfiniteTableHeaderCell(props) {
3726
4044
  computed: { computedRemainingSpace },
3727
4045
  componentState: { portalDOMRef }
3728
4046
  } = useInfiniteTable();
3729
- (0, import_react22.useEffect)(() => {
4047
+ (0, import_react23.useEffect)(() => {
3730
4048
  let clearOnResize = null;
3731
4049
  const node = domRef.current;
3732
4050
  if (onResize && node) {
@@ -3750,7 +4068,7 @@ function InfiniteTableHeaderCell(props) {
3750
4068
  let draggingProxy = null;
3751
4069
  if (dragging) {
3752
4070
  draggingProxy = /* @__PURE__ */ React14.createElement("div", {
3753
- className: `${baseCls}Proxy`,
4071
+ className: `${baseCls}Proxy ${HeaderCellProxy}`,
3754
4072
  style: {
3755
4073
  position: "absolute",
3756
4074
  height: headerHeight,
@@ -3771,7 +4089,7 @@ function InfiniteTableHeaderCell(props) {
3771
4089
  offset,
3772
4090
  onPointerDown,
3773
4091
  onPointerUp,
3774
- className: join(baseCls, ICSS.userSelect.none, column.computedSortable ? ICSS.cursor.pointer : "", useCellClassName(column, [baseCls, InfiniteTableCellClassName]), dragging ? `${InfiniteTableCellClassName}--dragging ${baseCls}--dragging` : ""),
4092
+ className: join(baseCls, userSelect.none, column.computedSortable ? cursor.pointer : "", useCellClassName(column, [baseCls, InfiniteTableCellClassName], HeaderCellRecipe, { dragging }), CellCls),
3775
4093
  cssEllipsis: (_d = (_c = column.headerCssEllipsis) != null ? _c : column.cssEllipsis) != null ? _d : true,
3776
4094
  afterChildren: sortTool
3777
4095
  }, header), draggingProxy);
@@ -3779,7 +4097,7 @@ function InfiniteTableHeaderCell(props) {
3779
4097
 
3780
4098
  // src/components/RawList/index.tsx
3781
4099
  var React17 = __toModule(require("react"));
3782
- var import_react24 = __toModule(require("react"));
4100
+ var import_react25 = __toModule(require("react"));
3783
4101
 
3784
4102
  // src/components/RawList/ReactVirtualRenderer.tsx
3785
4103
  var React16 = __toModule(require("react"));
@@ -3898,10 +4216,10 @@ var MappedItems = class extends Logger {
3898
4216
 
3899
4217
  // src/components/RawList/AvoidReactDiff.tsx
3900
4218
  var React15 = __toModule(require("react"));
3901
- var import_react23 = __toModule(require("react"));
4219
+ var import_react24 = __toModule(require("react"));
3902
4220
  function AvoidReactDiffFn(props) {
3903
- const [children, setChildren] = (0, import_react23.useState)(props.updater.get());
3904
- (0, import_react23.useLayoutEffect)(() => {
4221
+ const [children, setChildren] = (0, import_react24.useState)(props.updater.get());
4222
+ (0, import_react24.useLayoutEffect)(() => {
3905
4223
  const remove = props.updater.onChange((children2) => {
3906
4224
  setChildren(children2);
3907
4225
  });
@@ -4053,9 +4371,21 @@ var ReactVirtualRenderer = class extends Logger {
4053
4371
  if (this.destroyed) {
4054
4372
  return;
4055
4373
  }
4374
+ const spanParent = this.brain.getItemSpanParent(itemIndex);
4375
+ let covered = false;
4376
+ if (spanParent !== itemIndex) {
4377
+ covered = true;
4378
+ }
4379
+ const itemSize = this.brain.getItemSize(itemIndex);
4380
+ const itemSpan = this.brain.getItemSpan(itemIndex);
4381
+ const itemSizeWithSpan = itemSpan === 1 ? itemSize : this.brain.getItemSizeWithSpan(itemIndex, itemSpan);
4056
4382
  const renderedNode = renderItem({
4383
+ spanParent,
4057
4384
  itemIndex,
4058
- itemSize: this.brain.getItemSize(itemIndex),
4385
+ itemSize,
4386
+ itemSizeWithSpan,
4387
+ itemSpan,
4388
+ covered,
4059
4389
  domRef: this.itemDOMRefs[elementIndex]
4060
4390
  });
4061
4391
  const itemUpdater = this.updaters[elementIndex];
@@ -4075,7 +4405,7 @@ var ReactVirtualRenderer = class extends Logger {
4075
4405
  // src/components/RawList/index.tsx
4076
4406
  function RawListFn(props) {
4077
4407
  const { renderItem, brain, debugChannel } = props;
4078
- const { onRenderUpdater, renderer } = (0, import_react24.useMemo)(() => {
4408
+ const { onRenderUpdater, renderer } = (0, import_react25.useMemo)(() => {
4079
4409
  const onRenderUpdater2 = buildSubscriptionCallback();
4080
4410
  const renderer2 = new ReactVirtualRenderer(brain, {
4081
4411
  channel: debugChannel
@@ -4083,7 +4413,7 @@ function RawListFn(props) {
4083
4413
  return { onRenderUpdater: onRenderUpdater2, renderer: renderer2 };
4084
4414
  }, []);
4085
4415
  const getRenderItem = useLatest(renderItem);
4086
- (0, import_react24.useEffect)(() => {
4416
+ (0, import_react25.useEffect)(() => {
4087
4417
  const renderRange = brain.getRenderRange();
4088
4418
  renderer.renderRange(renderRange, {
4089
4419
  renderItem,
@@ -4091,7 +4421,7 @@ function RawListFn(props) {
4091
4421
  onRender: onRenderUpdater
4092
4422
  });
4093
4423
  }, [renderItem, onRenderUpdater]);
4094
- (0, import_react24.useEffect)(() => {
4424
+ (0, import_react25.useEffect)(() => {
4095
4425
  const remove = brain.onRenderRangeChange((renderRange) => {
4096
4426
  renderer.renderRange(renderRange, {
4097
4427
  force: false,
@@ -4101,7 +4431,7 @@ function RawListFn(props) {
4101
4431
  });
4102
4432
  return remove;
4103
4433
  }, [brain, onRenderUpdater]);
4104
- (0, import_react24.useEffect)(() => {
4434
+ (0, import_react25.useEffect)(() => {
4105
4435
  return () => {
4106
4436
  renderer.destroy();
4107
4437
  onRenderUpdater.destroy();
@@ -4118,13 +4448,13 @@ var debug3 = dbg("Header");
4118
4448
  var { rootClassName: rootClassName4 } = internalProps;
4119
4449
  var TableHeaderClassName = `${rootClassName4}Header`;
4120
4450
  function InfiniteTableHeaderFn(props) {
4121
- const { repaintId, brain, columns, style, className } = props;
4451
+ const { repaintId, brain, columns, style, className, pinning } = props;
4122
4452
  const {
4123
4453
  computed,
4124
4454
  componentState: { headerHeight }
4125
4455
  } = useInfiniteTable();
4126
4456
  const { computedVisibleColumnsMap } = computed;
4127
- const renderColumn = (0, import_react25.useCallback)(({ domRef: domRef2, itemIndex: columnIndex }) => {
4457
+ const renderColumn = (0, import_react26.useCallback)(({ domRef: domRef2, itemIndex: columnIndex }) => {
4128
4458
  const column = columns[columnIndex];
4129
4459
  if (!column) {
4130
4460
  if (false) {
@@ -4139,17 +4469,22 @@ function InfiniteTableHeaderFn(props) {
4139
4469
  columns: computedVisibleColumnsMap
4140
4470
  });
4141
4471
  }, [computedVisibleColumnsMap, columns, repaintId, headerHeight]);
4142
- (0, import_react25.useEffect)(() => {
4472
+ (0, import_react26.useEffect)(() => {
4143
4473
  const onScroll = (scrollPosition) => {
4144
4474
  domRef.current.style.transform = `translate3d(-${scrollPosition.scrollLeft}px, 0px, 0px)`;
4145
4475
  };
4146
4476
  const removeOnScroll = brain.onScroll(onScroll);
4147
4477
  return removeOnScroll;
4148
4478
  }, [brain]);
4149
- const domRef = (0, import_react25.useRef)(null);
4479
+ const domRef = (0, import_react26.useRef)(null);
4480
+ const headerCls = HeaderClsRecipe({
4481
+ pinned: pinning,
4482
+ overflow: false,
4483
+ virtualized: true
4484
+ });
4150
4485
  const domProps = {
4151
4486
  ref: domRef,
4152
- className: join(ICSS.flexFlow.row, TableHeaderClassName, `${TableHeaderClassName}--virtualized`, className),
4487
+ className: join(TableHeaderClassName, `${TableHeaderClassName}--virtualized`, className, headerCls),
4153
4488
  style
4154
4489
  };
4155
4490
  return /* @__PURE__ */ React18.createElement("div", __spreadValues({}, domProps), /* @__PURE__ */ React18.createElement(RawList, {
@@ -4269,15 +4604,15 @@ function InfiniteTableHeaderGroup(props) {
4269
4604
  };
4270
4605
  return /* @__PURE__ */ React19.createElement("div", {
4271
4606
  "data-group-id": columnGroup.id,
4272
- className: join(ICSS.flexFlow.column, ICSS.display.flex, TableHeaderGroupClassName, `${TableHeaderGroupClassName}--unvirtualized`),
4607
+ className: join(HeaderGroupCls, TableHeaderGroupClassName, `${TableHeaderGroupClassName}--unvirtualized`),
4273
4608
  style
4274
4609
  }, /* @__PURE__ */ React19.createElement("div", {
4275
- className: join(`${TableHeaderGroupClassName}__header`, ICSS.flexFlow.row, ICSS.display.flex, ICSS.alignItems.center),
4610
+ className: join(`${TableHeaderGroupClassName}__header`, HeaderGroup_Header),
4276
4611
  style: { height: headerHeight }
4277
4612
  }, /* @__PURE__ */ React19.createElement("div", {
4278
4613
  className: join(`${TableHeaderGroupClassName}__header-content`, cssEllipsisClassName)
4279
4614
  }, header)), /* @__PURE__ */ React19.createElement("div", {
4280
- className: join(`${TableHeaderGroupClassName}__children`, ICSS.display.flex, ICSS.flexFlow.row, ICSS.alignItems.stretch)
4615
+ className: join(`${TableHeaderGroupClassName}__children`, HeaderGroup_Children)
4281
4616
  }, props.children));
4282
4617
  }
4283
4618
 
@@ -4333,7 +4668,7 @@ function renderColumnHeaderGroups(config) {
4333
4668
  }
4334
4669
 
4335
4670
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderUnvirtualized.tsx
4336
- var import_react26 = __toModule(require("react"));
4671
+ var import_react27 = __toModule(require("react"));
4337
4672
  var { rootClassName: rootClassName5 } = internalProps;
4338
4673
  var TableHeaderClassName2 = `${rootClassName5}Header`;
4339
4674
  var UPDATE_SCROLL = (node, scrollPosition) => {
@@ -4343,17 +4678,17 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
4343
4678
  const _a = props, {
4344
4679
  columns,
4345
4680
  scrollable,
4346
- classNameModifiers,
4347
4681
  brain,
4348
4682
  scrollListener,
4683
+ pinning,
4349
4684
  totalWidth,
4350
4685
  availableWidth
4351
4686
  } = _a, domProps = __objRest(_a, [
4352
4687
  "columns",
4353
4688
  "scrollable",
4354
- "classNameModifiers",
4355
4689
  "brain",
4356
4690
  "scrollListener",
4691
+ "pinning",
4357
4692
  "totalWidth",
4358
4693
  "availableWidth"
4359
4694
  ]);
@@ -4399,7 +4734,7 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
4399
4734
  if (totalWidth != null) {
4400
4735
  style.width = availableWidth;
4401
4736
  }
4402
- (0, import_react26.useEffect)(() => {
4737
+ (0, import_react27.useEffect)(() => {
4403
4738
  const scroller = brain || scrollListener;
4404
4739
  if (!scroller || !scrollable) {
4405
4740
  return;
@@ -4411,11 +4746,15 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
4411
4746
  return removeOnScroll;
4412
4747
  }, [brain, scrollListener]);
4413
4748
  return /* @__PURE__ */ React21.createElement("div", __spreadProps(__spreadValues({}, domProps), {
4414
- className: join(TableHeaderClassName2, `${TableHeaderClassName2}--unvirtualized`, domProps.className, ...(classNameModifiers || []).filter(Boolean).map((modifier) => `${TableHeaderClassName2}--${modifier}`)),
4749
+ className: join(TableHeaderClassName2, `${TableHeaderClassName2}--unvirtualized`, pinning ? `${TableHeaderClassName2}--pinned ${TableHeaderClassName2}-${pinning}` : "", scrollable ? `${TableHeaderClassName2}--overflow` : "", domProps.className, HeaderClsRecipe({
4750
+ pinned: pinning,
4751
+ virtualized: false,
4752
+ overflow: scrollable
4753
+ })),
4415
4754
  style
4416
4755
  }), /* @__PURE__ */ React21.createElement("div", {
4417
4756
  style: { width: totalWidth },
4418
- className: join(ICSS.flexFlow.row, ICSS.display.flex),
4757
+ className: join(flexFlow.row, display.flex),
4419
4758
  ref: domRef
4420
4759
  }, children));
4421
4760
  }
@@ -4453,6 +4792,7 @@ function TableHeaderWrapper(props) {
4453
4792
  columns: computedUnpinnedColumns,
4454
4793
  repaintId: virtualizeHeader ? repaintId : void 0,
4455
4794
  brain,
4795
+ pinning: false,
4456
4796
  style: {
4457
4797
  position: "absolute",
4458
4798
  left: computedPinnedStartWidth,
@@ -4464,14 +4804,14 @@ function TableHeaderWrapper(props) {
4464
4804
  }) : /* @__PURE__ */ React22.createElement(InfiniteTableHeaderUnvirtualized, {
4465
4805
  brain,
4466
4806
  scrollable: true,
4807
+ pinning: false,
4467
4808
  columns: computedUnpinnedColumns,
4468
4809
  availableWidth: computedUnpinnedColumnsWidth,
4469
4810
  totalWidth: computedUnpinnedColumnsWidth
4470
4811
  });
4471
4812
  return /* @__PURE__ */ React22.createElement("div", {
4472
- className: join(ICSS.overflow.hidden, ICSS.position.relative, ICSS.display.flex, ICSS.flexFlow.row),
4813
+ className: HeaderWrapperCls,
4473
4814
  style: {
4474
- background: "var(--ITableHeader__background)",
4475
4815
  height: virtualizeHeader ? height : void 0
4476
4816
  }
4477
4817
  }, hasPinnedStart ? /* @__PURE__ */ React22.createElement(InfiniteTableHeaderUnvirtualized, {
@@ -4484,11 +4824,7 @@ function TableHeaderWrapper(props) {
4484
4824
  totalWidth: computedPinnedStartColumnsWidth,
4485
4825
  columns: computedPinnedStartColumns,
4486
4826
  scrollable: computedPinnedStartOverflow,
4487
- classNameModifiers: [
4488
- "pinned",
4489
- "pinned-start",
4490
- computedPinnedStartOverflow ? "overflow" : ""
4491
- ],
4827
+ pinning: "start",
4492
4828
  scrollListener: computedPinnedStartOverflow ? pinnedStartScrollListener : void 0
4493
4829
  }) : null, header, hasPinnedEnd ? /* @__PURE__ */ React22.createElement(InfiniteTableHeaderUnvirtualized, {
4494
4830
  style: {
@@ -4500,11 +4836,7 @@ function TableHeaderWrapper(props) {
4500
4836
  availableWidth: computedPinnedEndWidth,
4501
4837
  totalWidth: computedPinnedEndColumnsWidth,
4502
4838
  scrollable: computedPinnedEndOverflow,
4503
- classNameModifiers: [
4504
- "pinned",
4505
- "pinned-end",
4506
- computedPinnedEndOverflow ? "overflow" : ""
4507
- ],
4839
+ pinning: "end",
4508
4840
  scrollListener: computedPinnedEndOverflow ? pinnedEndScrollListener : void 0
4509
4841
  }) : null, scrollbars.vertical ? /* @__PURE__ */ React22.createElement(VerticalScrollbarPlaceholder, {
4510
4842
  style: {
@@ -4516,12 +4848,12 @@ function TableHeaderWrapper(props) {
4516
4848
 
4517
4849
  // src/components/VirtualScrollContainer/index.tsx
4518
4850
  var React23 = __toModule(require("react"));
4519
- var import_react28 = __toModule(require("react"));
4851
+ var import_react29 = __toModule(require("react"));
4520
4852
 
4521
4853
  // src/components/hooks/useOnScroll.ts
4522
- var import_react27 = __toModule(require("react"));
4854
+ var import_react28 = __toModule(require("react"));
4523
4855
  var useOnScroll = (domRef, onScroll) => {
4524
- (0, import_react27.useEffect)(() => {
4856
+ (0, import_react28.useEffect)(() => {
4525
4857
  const domNode = domRef == null ? void 0 : domRef.current;
4526
4858
  const scrollFn = (event) => {
4527
4859
  const node = event.target;
@@ -4540,21 +4872,25 @@ var useOnScroll = (domRef, onScroll) => {
4540
4872
  }, [onScroll, domRef == null ? void 0 : domRef.current]);
4541
4873
  };
4542
4874
 
4875
+ // src/components/VirtualScrollContainer/VirtualScrollContainer.css.ts
4876
+ var ScrollableCls = { true: "_1ueijco1", false: "_1ueijco2", visible: "_1ueijco3", auto: "_1ueijco4", hidden: "_1ueijco5" };
4877
+ var ScrollableHorizontalCls = { true: "_1ueijco6", false: "_1ueijco7", visible: "_1ueijco8", auto: "_1ueijco9", hidden: "_1ueijcoa" };
4878
+ var ScrollableVerticalCls = { true: "_1ueijcob", false: "_1ueijcoc", visible: "_1ueijcod", auto: "_1ueijcoe", hidden: "_1ueijcof" };
4879
+ var VirtualScrollContainerCls = "_1ueijco0 _16lm1iw0";
4880
+
4543
4881
  // src/components/VirtualScrollContainer/getScrollableClassName.ts
4544
4882
  var getScrollableClassName = (scrollable) => {
4545
4883
  let scrollableClassName = "";
4546
- if (typeof scrollable === "boolean") {
4547
- scrollableClassName = scrollable ? ICSS.overflow.auto : ICSS.overflow.hidden;
4548
- } else if (typeof scrollable === "string") {
4549
- scrollableClassName = ICSS.overflow[scrollable];
4884
+ if (typeof scrollable === "boolean" || typeof scrollable === "string") {
4885
+ scrollableClassName = ScrollableCls[`${scrollable}`];
4550
4886
  } else {
4551
- scrollableClassName = join(typeof scrollable.horizontal === "boolean" ? scrollable.horizontal ? ICSS.overflowX.auto : ICSS.overflowX.hidden : ICSS.overflowX[scrollable.horizontal], typeof scrollable.vertical === "boolean" ? scrollable.vertical ? ICSS.overflowY.auto : ICSS.overflowY.hidden : ICSS.overflowY[scrollable.vertical]);
4887
+ scrollableClassName = join(ScrollableHorizontalCls[`${scrollable.horizontal}`], ScrollableVerticalCls[`${scrollable.vertical}`]);
4552
4888
  }
4553
4889
  return scrollableClassName;
4554
4890
  };
4555
4891
 
4556
4892
  // src/components/VirtualScrollContainer/index.tsx
4557
- var rootClassName6 = "IT-VirtualScrollContainer";
4893
+ var rootClassName6 = "Infinite-VirtualScrollContainer";
4558
4894
  var VirtualScrollContainer = React23.forwardRef(function VirtualScrollContainer2(props, ref) {
4559
4895
  const {
4560
4896
  children,
@@ -4563,16 +4899,12 @@ var VirtualScrollContainer = React23.forwardRef(function VirtualScrollContainer2
4563
4899
  className,
4564
4900
  style
4565
4901
  } = props;
4566
- const domRef = ref != null ? ref : (0, import_react28.useRef)(null);
4902
+ const domRef = ref != null ? ref : (0, import_react29.useRef)(null);
4567
4903
  useOnScroll(domRef, onContainerScroll);
4568
4904
  return /* @__PURE__ */ React23.createElement("div", {
4569
4905
  ref: domRef,
4570
4906
  style,
4571
- className: [
4572
- className,
4573
- rootClassName6,
4574
- getScrollableClassName(scrollable)
4575
- ].join(" ")
4907
+ className: join(className, rootClassName6, VirtualScrollContainerCls, getScrollableClassName(scrollable))
4576
4908
  }, children);
4577
4909
  });
4578
4910
 
@@ -4598,24 +4930,30 @@ function SpacePlaceholderFn(props) {
4598
4930
  var SpacePlaceholder = React24.memo(SpacePlaceholderFn);
4599
4931
 
4600
4932
  // src/components/InfiniteTable/hooks/useListRendering.tsx
4601
- var import_react39 = __toModule(require("react"));
4933
+ var import_react40 = __toModule(require("react"));
4602
4934
 
4603
4935
  // src/components/InfiniteTable/hooks/useUnpinnedRendering.tsx
4604
4936
  var React30 = __toModule(require("react"));
4605
- var import_react32 = __toModule(require("react"));
4937
+ var import_react33 = __toModule(require("react"));
4606
4938
 
4607
4939
  // src/components/VirtualList/VirtualRowList.tsx
4608
4940
  var React26 = __toModule(require("react"));
4609
4941
 
4610
4942
  // src/components/VirtualList/VirtualList.tsx
4611
4943
  var React25 = __toModule(require("react"));
4612
- var import_react29 = __toModule(require("react"));
4944
+ var import_react30 = __toModule(require("react"));
4945
+
4946
+ // src/components/VirtualList/VirtualList.css.ts
4947
+ var VirtualListCls = "mlx2t0 _16lm1iw0";
4948
+ var VirtualListClsOrientation = { horizontal: "mlx2t1", vertical: "mlx2t2" };
4949
+ var scrollTransformTargetCls = "mlx2t3";
4950
+
4951
+ // src/components/VirtualList/VirtualList.tsx
4613
4952
  var UPDATE_SCROLL2 = (node, scrollPosition) => {
4614
4953
  node.style.transform = `translate3d(${-scrollPosition.scrollLeft}px, ${-scrollPosition.scrollTop}px, 0px)`;
4615
4954
  };
4616
- var CLASSES = join(ICSS.height["0"], ICSS.width["0"], ICSS.willChange.transform);
4617
4955
  var debug4 = dbg("VirtuaList");
4618
- var rootClassName7 = "IList";
4956
+ var rootClassName7 = "InfiniteList";
4619
4957
  var VirtualList = (props) => {
4620
4958
  const _a = props, {
4621
4959
  scrollable,
@@ -4646,11 +4984,11 @@ var VirtualList = (props) => {
4646
4984
  "onContainerScroll",
4647
4985
  "children"
4648
4986
  ]);
4649
- const domRef = (0, import_react29.useRef)(null);
4987
+ const domRef = (0, import_react30.useRef)(null);
4650
4988
  const [, rerender] = useRerender();
4651
- const [totalSize, setTotalSize] = (0, import_react29.useState)(0);
4652
- const renderCountRef = (0, import_react29.useRef)(0);
4653
- (0, import_react29.useEffect)(() => {
4989
+ const [totalSize, setTotalSize] = (0, import_react30.useState)(0);
4990
+ const renderCountRef = (0, import_react30.useRef)(0);
4991
+ (0, import_react30.useEffect)(() => {
4654
4992
  const removeOnRenderCount = virtualBrain.onRenderCountChange((renderCount) => {
4655
4993
  renderCountRef.current = renderCount;
4656
4994
  if (false) {
@@ -4669,7 +5007,7 @@ var VirtualList = (props) => {
4669
5007
  removeOnTotalSizeChange();
4670
5008
  };
4671
5009
  }, [virtualBrain]);
4672
- (0, import_react29.useEffect)(() => {
5010
+ (0, import_react30.useEffect)(() => {
4673
5011
  const onScroll = (scrollPosition) => {
4674
5012
  UPDATE_SCROLL2(domRef.current, scrollPosition);
4675
5013
  };
@@ -4679,7 +5017,7 @@ var VirtualList = (props) => {
4679
5017
  const width = mainAxis === "horizontal" ? totalSize : itemCrossAxisSize != null ? itemCrossAxisSize : 0;
4680
5018
  const height = mainAxis === "vertical" ? totalSize : itemCrossAxisSize != null ? itemCrossAxisSize : 0;
4681
5019
  const domProps = __spreadProps(__spreadValues({}, restDOMProps), {
4682
- className: join(props.className, rootClassName7, `${rootClassName7}--${mainAxis}`, ICSS.transform.translate3D000)
5020
+ className: join(props.className, rootClassName7, `${rootClassName7}--${mainAxis}`, VirtualListCls, VirtualListClsOrientation[mainAxis])
4683
5021
  });
4684
5022
  if (false) {
4685
5023
  domProps["data-cmp-name"] = `VirtualList`;
@@ -4689,7 +5027,7 @@ var VirtualList = (props) => {
4689
5027
  onContainerScroll
4690
5028
  }, /* @__PURE__ */ React25.createElement("div", {
4691
5029
  ref: domRef,
4692
- className: CLASSES,
5030
+ className: scrollTransformTargetCls,
4693
5031
  "data-name": "scroll-transform-target"
4694
5032
  }, /* @__PURE__ */ React25.createElement(RawList, {
4695
5033
  brain: virtualBrain,
@@ -4723,142 +5061,208 @@ var VirtualRowList = (props) => {
4723
5061
 
4724
5062
  // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRow.tsx
4725
5063
  var React28 = __toModule(require("react"));
4726
- var import_react31 = __toModule(require("react"));
5064
+ var import_react32 = __toModule(require("react"));
4727
5065
 
4728
5066
  // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableColumnCell.tsx
4729
5067
  var React27 = __toModule(require("react"));
4730
5068
  var { rootClassName: rootClassName8 } = internalProps;
4731
- var baseCls2 = `${rootClassName8}ColumnCell`;
5069
+ var InfiniteTableColumnCellClassName = `${rootClassName8}ColumnCell`;
4732
5070
  function isColumnWithField(c) {
4733
5071
  return typeof c.field === "string";
4734
5072
  }
4735
- function isColumnWithRender(c) {
4736
- return c.render instanceof Function;
4737
- }
4738
5073
  function InfiniteTableColumnCellFn(props) {
4739
5074
  var _a;
4740
5075
  const {
4741
- enhancedData,
5076
+ rowInfo,
5077
+ getData,
4742
5078
  column,
4743
5079
  offsetProperty,
4744
5080
  toggleGroupRow,
4745
5081
  virtualized,
4746
5082
  rowIndex,
4747
- domRef
5083
+ rowHeight,
5084
+ domRef,
5085
+ hidden
4748
5086
  } = props;
4749
- const { data, isGroupRow, groupBy } = enhancedData;
4750
- let value = isGroupRow && groupBy && column.groupByField ? enhancedData.value : isColumnWithField(column) ? data == null ? void 0 : data[column.field] : null;
5087
+ if (!column) {
5088
+ return null;
5089
+ }
5090
+ const { data, isGroupRow, groupBy } = rowInfo;
5091
+ const groupRowInfo = null;
5092
+ let value = isGroupRow && groupBy && column.groupByField ? rowInfo.value : isColumnWithField(column) ? data == null ? void 0 : data[column.field] : null;
4751
5093
  if (column.valueGetter) {
4752
- value = column.valueGetter({ data, enhancedData });
5094
+ value = column.valueGetter({
5095
+ data,
5096
+ rowInfo,
5097
+ groupRowInfo
5098
+ });
4753
5099
  }
4754
5100
  const { componentState: computedDataSource } = useDataSourceContextValue();
4755
- const renderParam = {
5101
+ const stylingRenderParam = {
4756
5102
  value,
4757
5103
  column,
4758
- enhancedData,
5104
+ rowInfo,
4759
5105
  data
4760
5106
  };
4761
- let renderValue = isColumnWithRender(column) ? column.render({
4762
- value,
4763
- column,
4764
- enhancedData,
4765
- data,
4766
- rowIndex,
4767
- toggleGroupRow,
4768
- toggleCurrentGroupRow: () => toggleGroupRow(enhancedData.groupKeys),
4769
- groupRowsBy: computedDataSource.groupRowsBy
4770
- }) : value;
4771
- const colClassName = column.className ? typeof column.className === "function" ? column.className(renderParam) : column.className : void 0;
4772
- const colStyle = column.style ? typeof column.style === "function" ? column.style(renderParam) : column.style : void 0;
5107
+ let renderValue = value;
5108
+ if (column.render || column.renderValue) {
5109
+ const renderParam = {
5110
+ value,
5111
+ column,
5112
+ rowInfo,
5113
+ groupRowInfo,
5114
+ data,
5115
+ rowIndex,
5116
+ toggleGroupRow,
5117
+ toggleCurrentGroupRow: () => toggleGroupRow(rowInfo.groupKeys),
5118
+ groupRowsBy: computedDataSource.groupRowsBy
5119
+ };
5120
+ if (column.render) {
5121
+ renderValue = column.render(renderParam);
5122
+ } else if (column.renderValue) {
5123
+ renderValue = column.renderValue(renderParam);
5124
+ }
5125
+ }
5126
+ const colClassName = column.className ? typeof column.className === "function" ? column.className(stylingRenderParam) : column.className : void 0;
5127
+ const colStyle = column.style ? typeof column.style === "function" ? column.style(stylingRenderParam) : column.style : void 0;
4773
5128
  const style = colStyle ? __spreadProps(__spreadValues({}, colStyle), {
4774
5129
  width: column.computedWidth
4775
5130
  }) : {
4776
5131
  width: column.computedWidth
4777
5132
  };
4778
- return /* @__PURE__ */ React27.createElement(InfiniteTableCell, {
4779
- domRef,
4780
- offsetProperty,
5133
+ const dataset = {
4781
5134
  "data-name": `Cell`,
4782
5135
  "data-column-id": column.id,
4783
- "data-column-index": column.computedVisibleIndex,
5136
+ "data-column-index": column.computedVisibleIndex
5137
+ };
5138
+ if (typeof column.rowspan === "function") {
5139
+ const rowspan = column.rowspan({
5140
+ dataArray: getData(),
5141
+ column,
5142
+ rowInfo,
5143
+ groupRowInfo,
5144
+ rowIndex,
5145
+ data: rowInfo.data
5146
+ });
5147
+ if (rowspan > 1) {
5148
+ style.height = rowspan * rowHeight;
5149
+ for (let i = 0; i < rowspan; i++) {
5150
+ dataset[`data-hover-${rowIndex + i}`] = true;
5151
+ }
5152
+ }
5153
+ }
5154
+ return /* @__PURE__ */ React27.createElement(InfiniteTableCell, __spreadProps(__spreadValues({
5155
+ domRef,
5156
+ offsetProperty
5157
+ }, dataset), {
4784
5158
  column,
4785
5159
  offset: virtualized ? 0 : column.computedPinningOffset,
4786
5160
  style,
4787
5161
  cssEllipsis: (_a = column.cssEllipsis) != null ? _a : true,
4788
- className: join(ICSS.position.absolute, ICSS.height["100%"], ICSS.top[0], useCellClassName(column, [baseCls2, InfiniteTableCellClassName]), colClassName)
4789
- }, renderValue);
5162
+ className: join(useCellClassName(column, [InfiniteTableColumnCellClassName, InfiniteTableCellClassName], ColumnCellRecipe, { dragging: false }), colClassName)
5163
+ }), hidden ? null : renderValue);
4790
5164
  }
4791
5165
  var InfiniteTableColumnCell = React27.memo(InfiniteTableColumnCellFn);
4792
5166
 
4793
5167
  // src/components/InfiniteTable/components/InfiniteTableRow/useRowDOMProps.ts
4794
- var import_react30 = __toModule(require("react"));
5168
+ var import_react31 = __toModule(require("react"));
4795
5169
 
4796
5170
  // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRowClassName.ts
4797
5171
  var { rootClassName: rootClassName9 } = internalProps;
4798
5172
  var InfiniteTableRowClassName = `${rootClassName9}Row`;
4799
- var InfiniteTableRowClassName__hover = `${InfiniteTableRowClassName}--hover`;
5173
+ var InfiniteTableRowClassName__hover = `${rootClassName9}Element--hover`;
5174
+
5175
+ // src/components/InfiniteTable/theme.css.ts
5176
+ var ThemeVars = { theme: "var(--infinite-theme)", 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)", height: "var(--infinite-header-height)" }, HeaderCell: { draggingBackground: "var(--infinite-header-cell-dragging-background)", background: "var(--infinite-header-cell-background)", padding: "var(--infinite-header-cell-padding)", iconSize: "var(--infinite-header-cell-icon-size)" }, 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)" }, Row: { color: "var(--infinite-row-color)", background: "var(--infinite-row-background)", oddBackground: "var(--infinite-row-odd-background)", 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)" } } };
5177
+
5178
+ // src/utils/stripVar.ts
5179
+ function stripVar(cssVariableWithVarString) {
5180
+ return cssVariableWithVarString.slice(4, -1);
5181
+ }
4800
5182
 
4801
5183
  // src/components/InfiniteTable/components/InfiniteTableRow/useRowDOMProps.ts
4802
- function useRowDOMProps(props, rowProps, rowStyle, rowClassName, tableDOMRef) {
5184
+ function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStrategy, tableDOMRef) {
4803
5185
  const domProps = props.domProps;
4804
5186
  const {
4805
5187
  showZebraRows = false,
5188
+ showHoverRows = false,
4806
5189
  rowIndex,
4807
5190
  domRef: domRefFromProps,
4808
- enhancedData
5191
+ rowInfo
4809
5192
  } = props;
4810
- const domRef = (0, import_react30.useRef)(null);
4811
- const rowDOMRef = (0, import_react30.useCallback)((node) => {
5193
+ const domRef = (0, import_react31.useRef)(null);
5194
+ const rowDOMRef = (0, import_react31.useCallback)((node) => {
4812
5195
  domRefFromProps(node);
4813
5196
  domRef.current = node;
4814
5197
  }, []);
4815
5198
  const rowPropsAndStyleArgs = {
4816
- data: enhancedData.data,
4817
- enhancedData,
5199
+ data: rowInfo.data,
5200
+ rowInfo,
4818
5201
  rowIndex,
4819
- groupRowsBy: enhancedData.groupBy
5202
+ groupRowsBy: rowInfo.groupBy
4820
5203
  };
4821
5204
  if (typeof rowProps === "function") {
4822
5205
  rowProps = rowProps(rowPropsAndStyleArgs);
4823
5206
  }
4824
5207
  let style = rowProps ? rowProps.style : void 0;
5208
+ const inlineGroupRoot = groupRenderStrategy === "inline" && rowInfo.indexInGroup === 0;
4825
5209
  if (rowStyle) {
4826
5210
  style = typeof rowStyle === "function" ? __spreadValues(__spreadValues({}, style), rowStyle(rowPropsAndStyleArgs)) : __spreadValues(__spreadValues({}, style), rowStyle);
4827
5211
  }
4828
- const odd = (enhancedData.indexInAll != null ? enhancedData.indexInAll : rowIndex) % 2 === 1;
5212
+ if (inlineGroupRoot) {
5213
+ style = style || {};
5214
+ style.zIndex = 2e6 - rowInfo.indexInAll;
5215
+ }
5216
+ const odd = (rowInfo.indexInAll != null ? rowInfo.indexInAll : rowIndex) % 2 === 1;
4829
5217
  let rowComputedClassName = typeof rowClassName === "function" ? rowClassName(rowPropsAndStyleArgs) : rowClassName;
4830
- const className = join(ICSS.position.absolute, ICSS.top[0], ICSS.left[0], InfiniteTableRowClassName, `${InfiniteTableRowClassName}--${enhancedData.isGroupRow ? "group" : "normal"}-row`, showZebraRows ? `${InfiniteTableRowClassName}--${odd ? "odd" : "even"}` : null, domProps == null ? void 0 : domProps.className, rowProps == null ? void 0 : rowProps.className, rowComputedClassName);
5218
+ const className = join(InfiniteTableRowClassName, RowClsRecipe({
5219
+ groupRow: rowInfo.isGroupRow,
5220
+ inlineGroupRow: inlineGroupRoot,
5221
+ zebra: showHoverRows ? odd ? "odd" : "even" : false,
5222
+ showHoverRows
5223
+ }), `${InfiniteTableRowClassName}--${rowInfo.isGroupRow ? "group" : "normal"}-row`, inlineGroupRoot ? `${InfiniteTableRowClassName}--inline-group-row` : "", showZebraRows ? `${InfiniteTableRowClassName}--${odd ? "odd" : "even"}` : null, showHoverRows ? `${InfiniteTableRowClassName}--show-hover` : null, domProps == null ? void 0 : domProps.className, rowProps == null ? void 0 : rowProps.className, rowComputedClassName);
4831
5224
  const initialMouseEnter = rowProps == null ? void 0 : rowProps.onMouseEnter;
4832
5225
  const initialMouseLeave = rowProps == null ? void 0 : rowProps.onMouseLeave;
4833
- const onMouseEnter = (0, import_react30.useCallback)((event) => {
5226
+ const onMouseEnter = (0, import_react31.useCallback)((event) => {
4834
5227
  var _a;
4835
5228
  initialMouseEnter == null ? void 0 : initialMouseEnter(event);
4836
- const rowIndex2 = (_a = event.currentTarget) == null ? void 0 : _a.dataset.rowIndex;
5229
+ const rowIndex2 = ((_a = event.currentTarget) == null ? void 0 : _a.dataset.rowIndex) * 1;
4837
5230
  const parentNode = tableDOMRef.current;
4838
- if (!parentNode) {
5231
+ if (!parentNode || !showHoverRows) {
4839
5232
  return;
4840
5233
  }
4841
- const rows = parentNode.querySelectorAll(`.${InfiniteTableRowClassName}[data-row-index="${rowIndex2}"]`);
4842
- rows.forEach((row) => row.classList.add(InfiniteTableRowClassName__hover));
4843
- }, [initialMouseEnter]);
4844
- const onMouseLeave = (0, import_react30.useCallback)((event) => {
5234
+ const hoverSelector = [
5235
+ `.${InfiniteTableRowClassName}[data-hover-index="${rowIndex2}"]`
5236
+ ];
5237
+ const rows = parentNode.querySelectorAll(hoverSelector.join(","));
5238
+ rows.forEach((row) => row.classList.add(InfiniteTableRowClassName__hover, RowHoverCls));
5239
+ }, [initialMouseEnter, showHoverRows]);
5240
+ const onMouseLeave = (0, import_react31.useCallback)((event) => {
4845
5241
  var _a;
4846
5242
  initialMouseLeave == null ? void 0 : initialMouseLeave(event);
4847
5243
  const rowIndex2 = (_a = event.currentTarget) == null ? void 0 : _a.dataset.rowIndex;
4848
5244
  const parentNode = tableDOMRef.current;
4849
- if (!parentNode) {
5245
+ if (!parentNode || !showHoverRows) {
4850
5246
  return;
4851
5247
  }
4852
- const rows = parentNode.querySelectorAll(`.${InfiniteTableRowClassName}[data-row-index="${rowIndex2}"]`);
4853
- rows.forEach((row) => row.classList.remove(InfiniteTableRowClassName__hover));
4854
- }, [initialMouseLeave]);
5248
+ const hoverSelector = [
5249
+ `.${InfiniteTableRowClassName}[data-hover-index="${rowIndex2}"]`
5250
+ ];
5251
+ const rows = parentNode.querySelectorAll(hoverSelector.join(","));
5252
+ rows.forEach((row) => row.classList.remove(InfiniteTableRowClassName__hover, RowHoverCls));
5253
+ }, [initialMouseLeave, showHoverRows]);
5254
+ if (rowInfo.isGroupRow && groupRenderStrategy === "single-column") {
5255
+ style = style || {};
5256
+ style[stripVar(ThemeVars.components.Row.groupNesting)] = rowInfo.groupNesting - 1;
5257
+ }
4855
5258
  return {
4856
5259
  domRef,
4857
5260
  domProps: __spreadProps(__spreadValues(__spreadValues({}, rowProps), domProps), {
4858
5261
  style,
4859
5262
  "data-virtualize-columns": props.virtualizeColumns ? "on" : "off",
4860
5263
  "data-row-index": rowIndex,
4861
- "data-row-id": `${enhancedData.id}`,
5264
+ "data-hover-index": rowIndex,
5265
+ "data-row-id": `${rowInfo.id}`,
4862
5266
  className,
4863
5267
  onMouseEnter,
4864
5268
  onMouseLeave,
@@ -4872,34 +5276,50 @@ function InfiniteTableRowFn(props) {
4872
5276
  const {
4873
5277
  rowWidth,
4874
5278
  rowHeight,
4875
- enhancedData,
5279
+ getData,
5280
+ rowInfo,
4876
5281
  toggleGroupRow,
4877
5282
  rowIndex,
4878
5283
  brain,
5284
+ verticalBrain,
4879
5285
  columns
4880
5286
  } = props;
4881
5287
  const tableContextValue = useInfiniteTable();
4882
5288
  const { componentState } = tableContextValue;
4883
5289
  const { domRef: tableDOMRef } = componentState;
4884
- const { domProps } = useRowDOMProps(props, componentState.rowProps, componentState.rowStyle, componentState.rowClassName, tableDOMRef);
5290
+ const { groupRenderStrategy } = componentState;
5291
+ const { domProps } = useRowDOMProps(props, componentState.rowProps, componentState.rowStyle, componentState.rowClassName, groupRenderStrategy, tableDOMRef);
4885
5292
  const style = __spreadValues({
4886
5293
  width: rowWidth,
4887
5294
  height: rowHeight
4888
5295
  }, domProps.style);
4889
- const renderCellRef = (0, import_react31.useRef)(null);
5296
+ const renderCellRef = (0, import_react32.useRef)(null);
4890
5297
  const renderCell = React28.useCallback(({ domRef, itemIndex }) => {
4891
5298
  const column = columns[itemIndex];
4892
5299
  if (!column) {
4893
5300
  }
5301
+ const hidden = false;
4894
5302
  return /* @__PURE__ */ React28.createElement(InfiniteTableColumnCell, {
4895
- enhancedData,
5303
+ getData,
5304
+ rowInfo,
5305
+ groupRenderStrategy,
4896
5306
  virtualized: true,
5307
+ hidden,
5308
+ rowHeight,
4897
5309
  toggleGroupRow,
4898
5310
  rowIndex,
4899
5311
  domRef,
4900
5312
  column
4901
5313
  });
4902
- }, [columns, rowIndex, enhancedData]);
5314
+ }, [
5315
+ columns,
5316
+ rowIndex,
5317
+ rowInfo,
5318
+ rowHeight,
5319
+ groupRenderStrategy,
5320
+ getData,
5321
+ verticalBrain
5322
+ ]);
4903
5323
  if (renderCellRef.current !== renderCell) {
4904
5324
  renderCellRef.current = renderCell;
4905
5325
  }
@@ -4922,7 +5342,8 @@ function TableRowUnvirtualizedFn(props) {
4922
5342
  const {
4923
5343
  rowHeight,
4924
5344
  rowWidth,
4925
- enhancedData,
5345
+ getData,
5346
+ rowInfo,
4926
5347
  rowIndex,
4927
5348
  columns,
4928
5349
  toggleGroupRow
@@ -4930,17 +5351,22 @@ function TableRowUnvirtualizedFn(props) {
4930
5351
  const tableContextValue = useInfiniteTable();
4931
5352
  const { componentState } = tableContextValue;
4932
5353
  const { domRef: tableDOMRef } = componentState;
4933
- const { domProps } = useRowDOMProps(props, componentState.rowProps, componentState.rowStyle, componentState.rowClassName, tableDOMRef);
5354
+ const { domProps } = useRowDOMProps(props, componentState.rowProps, componentState.rowStyle, componentState.rowClassName, componentState.groupRenderStrategy, tableDOMRef);
4934
5355
  const style = __spreadValues({
4935
5356
  width: rowWidth,
4936
5357
  height: rowHeight
4937
5358
  }, domProps.style);
4938
5359
  const children = columns.map((col) => {
5360
+ const hidden = false;
4939
5361
  return /* @__PURE__ */ React29.createElement(InfiniteTableColumnCell, {
4940
5362
  key: col.id,
4941
5363
  virtualized: false,
5364
+ rowHeight,
5365
+ getData,
5366
+ hidden,
5367
+ groupRenderStrategy: componentState.groupRenderStrategy,
4942
5368
  toggleGroupRow,
4943
- enhancedData,
5369
+ rowInfo,
4944
5370
  rowIndex,
4945
5371
  column: col
4946
5372
  });
@@ -4971,19 +5397,22 @@ function useUnpinnedRendering(params) {
4971
5397
  } = params;
4972
5398
  const { virtualizeColumns } = getState();
4973
5399
  const shouldVirtualizeColumns = typeof virtualizeColumns === "function" ? virtualizeColumns(computedUnpinnedColumns) : virtualizeColumns != null ? virtualizeColumns : true;
4974
- const renderRowUnpinned = (0, import_react32.useCallback)((rowInfo) => {
5400
+ const renderRowUnpinned = (0, import_react33.useCallback)((rowParams) => {
4975
5401
  const dataArray = getData();
4976
- const enhancedData = dataArray[rowInfo.rowIndex];
4977
- const { showZebraRows } = getState();
5402
+ const rowInfo = dataArray[rowParams.rowIndex];
5403
+ const { showZebraRows, showHoverRows } = getState();
4978
5404
  const rowProps = __spreadValues({
4979
- enhancedData,
5405
+ rowInfo,
4980
5406
  showZebraRows,
5407
+ showHoverRows,
5408
+ getData,
4981
5409
  toggleGroupRow,
4982
5410
  virtualizeColumns: shouldVirtualizeColumns,
4983
5411
  brain: null,
5412
+ verticalBrain: verticalVirtualBrain,
4984
5413
  columns: computedUnpinnedColumns,
4985
5414
  rowWidth: computedUnpinnedColumnsWidth
4986
- }, rowInfo);
5415
+ }, rowParams);
4987
5416
  if (shouldVirtualizeColumns) {
4988
5417
  rowProps.brain = horizontalVirtualBrain;
4989
5418
  rowProps.repaintId = repaintId;
@@ -4992,10 +5421,12 @@ function useUnpinnedRendering(params) {
4992
5421
  return /* @__PURE__ */ React30.createElement(TableRowComponent, __spreadValues({}, rowProps));
4993
5422
  }, [
4994
5423
  repaintId,
5424
+ rowHeight,
4995
5425
  computedUnpinnedColumns,
4996
5426
  computedUnpinnedColumnsWidth,
4997
5427
  shouldVirtualizeColumns,
4998
- horizontalVirtualBrain
5428
+ horizontalVirtualBrain,
5429
+ verticalVirtualBrain
4999
5430
  ]);
5000
5431
  const fakeScrollbar = getScrollbarWidth() ? /* @__PURE__ */ React30.createElement("div", {
5001
5432
  "data-name": "horizontal-scrollbar-placeholder--fake",
@@ -5032,18 +5463,45 @@ function useUnpinnedRendering(params) {
5032
5463
  }
5033
5464
 
5034
5465
  // src/components/InfiniteTable/hooks/useOnContainerScroll.ts
5035
- var import_react33 = __toModule(require("react"));
5466
+ var import_react34 = __toModule(require("react"));
5467
+
5468
+ // src/components/InfiniteTable/InfiniteCls.css.ts
5469
+ var FooterCls = "_16lm1iw1";
5470
+ var InfiniteCls = "_1yeub2v0 _16lm1iw1 _16lm1iwh _16lm1iwx _16lm1iw0";
5471
+ var InfiniteClsRecipe = 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: [] });
5472
+ var InfiniteClsScrolling = "_1yeub2v1";
5473
+ var InfiniteClsShiftingColumns = "_16lm1iwk";
5474
+ var PinnedRowsClsVariants = { pinnedStart: "_1yeub2ve", pinnedEnd: "_1yeub2vf", overflow: "_1yeub2vg" };
5475
+ var PinnedRowsContainerClsVariants = createRuntimeFn({ defaultClassName: "", variantClassNames: { pinned: { start: "_1yeub2vh", end: "_1yeub2vi", false: "_1yeub2vj" } }, defaultVariants: {}, compoundVariants: [] });
5476
+
5477
+ // src/components/InfiniteTable/hooks/useOnContainerScroll.ts
5036
5478
  var DELAY = 200;
5037
5479
  var TableClassName = internalProps.rootClassName;
5038
5480
  var TableClassName__Scrolling = `${TableClassName}--scrolling`;
5481
+ var SCROLL_BOTTOM_OFFSET = 0;
5039
5482
  var useOnContainerScroll = ({
5040
5483
  verticalVirtualBrain,
5041
5484
  horizontalVirtualBrain,
5042
- domRef
5485
+ reservedContentHeight
5043
5486
  }) => {
5044
- const timeoutIdRef = (0, import_react33.useRef)(0);
5045
- const scrollingRef = (0, import_react33.useRef)(false);
5046
- const setScrolling = (0, import_react33.useCallback)((scrolling) => {
5487
+ const {
5488
+ componentState: {
5489
+ scrollerDOMRef,
5490
+ domRef,
5491
+ scrollToBottomOffset,
5492
+ onScrollToBottom,
5493
+ onScrollToTop,
5494
+ bodySize
5495
+ }
5496
+ } = useInfiniteTable();
5497
+ const timeoutIdRef = (0, import_react34.useRef)(0);
5498
+ const scrollingRef = (0, import_react34.useRef)(false);
5499
+ const scrollTopMaxRef = (0, import_react34.useRef)(0);
5500
+ (0, import_react34.useEffect)(() => {
5501
+ const { current: node } = scrollerDOMRef;
5502
+ scrollTopMaxRef.current = node.scrollHeight - node.clientHeight;
5503
+ }, [reservedContentHeight, bodySize.height]);
5504
+ const setScrolling = (0, import_react34.useCallback)((scrolling) => {
5047
5505
  var _a;
5048
5506
  const prevScrolling = scrollingRef.current;
5049
5507
  scrollingRef.current = scrolling;
@@ -5062,13 +5520,13 @@ var useOnContainerScroll = ({
5062
5520
  return;
5063
5521
  }
5064
5522
  if (scrolling) {
5065
- classList.add(TableClassName__Scrolling);
5523
+ classList.add(InfiniteClsScrolling, TableClassName__Scrolling);
5066
5524
  } else {
5067
- classList.remove(TableClassName__Scrolling);
5525
+ classList.remove(InfiniteClsScrolling, TableClassName__Scrolling);
5068
5526
  }
5069
5527
  }
5070
5528
  }, []);
5071
- const onContainerScroll = (0, import_react33.useCallback)((scrollInfo) => {
5529
+ const onContainerScroll = (0, import_react34.useCallback)((scrollInfo) => {
5072
5530
  verticalVirtualBrain.setScrollPosition(scrollInfo);
5073
5531
  horizontalVirtualBrain.setScrollPosition(scrollInfo);
5074
5532
  setScrolling(true);
@@ -5078,37 +5536,44 @@ var useOnContainerScroll = ({
5078
5536
  domRef.current,
5079
5537
  setScrolling
5080
5538
  ]);
5081
- const scrollPositionRef = (0, import_react33.useRef)({
5539
+ const scrollPositionRef = (0, import_react34.useRef)({
5082
5540
  scrollLeft: 0,
5083
5541
  scrollTop: 0
5084
5542
  });
5085
- const applyScrollHorizontal = (0, import_react33.useCallback)(({ scrollLeft }) => {
5543
+ const applyScrollHorizontal = (0, import_react34.useCallback)(({ scrollLeft }) => {
5086
5544
  scrollPositionRef.current.scrollLeft = scrollLeft;
5087
5545
  onContainerScroll(scrollPositionRef.current);
5088
5546
  }, [onContainerScroll]);
5089
- const applyScrollVertical = (0, import_react33.useCallback)(({ scrollTop }) => {
5547
+ const applyScrollVertical = (0, import_react34.useCallback)(({ scrollTop }) => {
5090
5548
  scrollPositionRef.current.scrollTop = scrollTop;
5091
5549
  onContainerScroll(scrollPositionRef.current);
5092
- }, [onContainerScroll]);
5550
+ if (scrollTop === 0) {
5551
+ onScrollToTop == null ? void 0 : onScrollToTop();
5552
+ }
5553
+ const offset = scrollToBottomOffset != null ? scrollToBottomOffset : SCROLL_BOTTOM_OFFSET;
5554
+ const isScrollBottom = scrollTop + offset >= scrollTopMaxRef.current;
5555
+ if (isScrollBottom) {
5556
+ onScrollToBottom == null ? void 0 : onScrollToBottom();
5557
+ }
5558
+ }, [onContainerScroll, scrollToBottomOffset, onScrollToBottom, onScrollToTop]);
5093
5559
  return {
5094
5560
  applyScrollHorizontal,
5095
- applyScrollVertical,
5096
- scrollPositionRef
5561
+ applyScrollVertical
5097
5562
  };
5098
5563
  };
5099
5564
 
5100
5565
  // src/components/InfiniteTable/hooks/usePinnedRendering.tsx
5101
5566
  var React32 = __toModule(require("react"));
5102
- var import_react36 = __toModule(require("react"));
5567
+ var import_react37 = __toModule(require("react"));
5103
5568
 
5104
5569
  // src/components/VirtualList/RowListWithExternalScrolling.tsx
5105
5570
  var React31 = __toModule(require("react"));
5106
- var import_react35 = __toModule(require("react"));
5571
+ var import_react36 = __toModule(require("react"));
5107
5572
 
5108
5573
  // src/components/hooks/useOnMount.ts
5109
- var import_react34 = __toModule(require("react"));
5574
+ var import_react35 = __toModule(require("react"));
5110
5575
  function useOnMount(domRef, props) {
5111
- (0, import_react34.useEffect)(() => {
5576
+ (0, import_react35.useEffect)(() => {
5112
5577
  const { onMount, onUnmount } = props;
5113
5578
  const node = domRef == null ? void 0 : domRef.current;
5114
5579
  onMount == null ? void 0 : onMount(node);
@@ -5118,12 +5583,15 @@ function useOnMount(domRef, props) {
5118
5583
  }, []);
5119
5584
  }
5120
5585
 
5586
+ // src/components/VirtualList/InfiniteListRootClassName.ts
5587
+ var InfiniteListRootClassName = "InfiniteList";
5588
+
5121
5589
  // src/components/VirtualList/RowListWithExternalScrolling.tsx
5122
- var rootClassName10 = "IList";
5590
+ var rootClassName10 = InfiniteListRootClassName;
5123
5591
  var defaultClasses = [
5124
- ICSS.willChange.transform,
5125
- ICSS.position.relative,
5126
- ICSS.transform.translate3D000
5592
+ willChange.transform,
5593
+ position.relative,
5594
+ transformTranslateZero
5127
5595
  ];
5128
5596
  var RowListWithExternalScrolling = (props) => {
5129
5597
  const {
@@ -5136,8 +5604,8 @@ var RowListWithExternalScrolling = (props) => {
5136
5604
  onMount,
5137
5605
  onUnmount
5138
5606
  } = props;
5139
- const domRef = (0, import_react35.useRef)(null);
5140
- const renderItem = (0, import_react35.useCallback)((renderProps) => renderRow({
5607
+ const domRef = (0, import_react36.useRef)(null);
5608
+ const renderItem = (0, import_react36.useCallback)((renderProps) => renderRow({
5141
5609
  domRef: renderProps.domRef,
5142
5610
  rowHeight: renderProps.itemSize,
5143
5611
  rowIndex: renderProps.itemIndex
@@ -5146,7 +5614,7 @@ var RowListWithExternalScrolling = (props) => {
5146
5614
  onMount,
5147
5615
  onUnmount
5148
5616
  });
5149
- (0, import_react35.useEffect)(() => {
5617
+ (0, import_react36.useEffect)(() => {
5150
5618
  const onScroll = (scrollPosition) => {
5151
5619
  const node = domRef.current;
5152
5620
  if (node) {
@@ -5170,7 +5638,7 @@ var RowListWithExternalScrolling = (props) => {
5170
5638
  const domProps = {
5171
5639
  ref: domRef,
5172
5640
  style,
5173
- className: join(className, rootClassName10, `${rootClassName10}--vertical`, ...defaultClasses)
5641
+ className: join(className, rootClassName10, `${rootClassName10}--vertical`, VirtualListCls, VirtualListClsOrientation.vertical, ...defaultClasses)
5174
5642
  };
5175
5643
  if (false) {
5176
5644
  domProps["data-cmp-name"] = "RowListWithExternalScrolling";
@@ -5186,7 +5654,7 @@ var RowListWithExternalScrolling = (props) => {
5186
5654
  var UPDATE_SCROLL3 = (node, brainScrollPosition, horizontalPinnedScrollPosition) => {
5187
5655
  node.style.transform = `translate3d(${horizontalPinnedScrollPosition ? -horizontalPinnedScrollPosition.scrollLeft : 0}px, ${-brainScrollPosition.scrollTop}px, 0px)`;
5188
5656
  };
5189
- var PinnedRowsContainerClassName = `ITablePinnedRows`;
5657
+ var PinnedRowsContainerClassName = `InfinitePinnedRows`;
5190
5658
  function PinnedRowsContainer(props) {
5191
5659
  const {
5192
5660
  maxWidth,
@@ -5213,7 +5681,7 @@ function PinnedRowsContainer(props) {
5213
5681
  }
5214
5682
  return result;
5215
5683
  }, [height, rowWidth, pinning, hasOverflow]);
5216
- const updateScroll = (0, import_react36.useCallback)((node, scrollPosition) => {
5684
+ const updateScroll = (0, import_react37.useCallback)((node, scrollPosition) => {
5217
5685
  UPDATE_SCROLL3(node, scrollPosition, hasOverflow ? pinnedScrollListener.getScrollPosition() : void 0);
5218
5686
  }, [hasOverflow, pinnedScrollListener]);
5219
5687
  const rowListProps = {
@@ -5221,7 +5689,7 @@ function PinnedRowsContainer(props) {
5221
5689
  brain,
5222
5690
  renderRow,
5223
5691
  updateScroll,
5224
- className: join(`${PinnedRowsContainerClassName}`, `${PinnedRowsContainerClassName}--pinned-${pinning}`, `${PinnedRowsContainerClassName}--overflow`)
5692
+ className: join(`${PinnedRowsContainerClassName}`, PinnedRowsClsVariants[pinning === "start" ? "pinnedStart" : "pinnedEnd"], `${PinnedRowsContainerClassName}--pinned-${pinning}`, `${PinnedRowsContainerClassName}--overflow`, PinnedRowsClsVariants.overflow)
5225
5693
  };
5226
5694
  if (hasOverflow) {
5227
5695
  return /* @__PURE__ */ React32.createElement(VirtualScrollContainer, {
@@ -5237,7 +5705,9 @@ function PinnedRowsContainer(props) {
5237
5705
  [pinning === "start" ? "right" : "left"]: "unset"
5238
5706
  },
5239
5707
  onContainerScroll: pinnedScrollListener == null ? void 0 : pinnedScrollListener.setScrollPosition,
5240
- className: join(`${PinnedRowsContainerClassName}Container`, `${PinnedRowsContainerClassName}Container--pinned-${pinning}`)
5708
+ className: join(PinnedRowsContainerClsVariants({
5709
+ pinned: pinning
5710
+ }), `${PinnedRowsContainerClassName}Container`, `${PinnedRowsContainerClassName}Container--pinned-${pinning}`)
5241
5711
  }, /* @__PURE__ */ React32.createElement(RowListWithExternalScrolling, __spreadProps(__spreadValues({}, rowListProps), {
5242
5712
  onMount: (node) => {
5243
5713
  pinnedScrollListener == null ? void 0 : pinnedScrollListener.onScroll((scrollPosition) => {
@@ -5252,22 +5722,25 @@ function PinnedRowsContainer(props) {
5252
5722
  return /* @__PURE__ */ React32.createElement(RowListWithExternalScrolling, __spreadValues({}, rowListProps));
5253
5723
  }
5254
5724
  function useRenderPinnedRow(params) {
5255
- const { getData, getState, columnsWidth, columns } = params;
5256
- const renderPinnedRow = (0, import_react36.useCallback)((rowInfo) => {
5725
+ const { getData, getState, columnsWidth, columns, verticalBrain } = params;
5726
+ const renderPinnedRow = (0, import_react37.useCallback)((rowParams) => {
5257
5727
  const dataArray = getData();
5258
- const enhancedData = dataArray[rowInfo.rowIndex];
5259
- const { showZebraRows } = getState();
5728
+ const rowInfo = dataArray[rowParams.rowIndex];
5729
+ const { showZebraRows, showHoverRows } = getState();
5260
5730
  const rowProps = __spreadValues({
5261
- enhancedData,
5731
+ rowInfo,
5732
+ getData,
5262
5733
  showZebraRows,
5734
+ showHoverRows,
5263
5735
  toggleGroupRow: params.toggleGroupRow,
5264
5736
  virtualizeColumns: false,
5737
+ verticalBrain,
5265
5738
  brain: null,
5266
5739
  rowWidth: columnsWidth,
5267
5740
  columns
5268
- }, rowInfo);
5741
+ }, rowParams);
5269
5742
  return /* @__PURE__ */ React32.createElement(TableRowUnvirtualized, __spreadValues({}, rowProps));
5270
- }, [columnsWidth, columns]);
5743
+ }, [columnsWidth, columns, verticalBrain]);
5271
5744
  return renderPinnedRow;
5272
5745
  }
5273
5746
  function usePinnedRenderingForSide(side, params) {
@@ -5305,6 +5778,7 @@ function usePinnedRenderingForSide(side, params) {
5305
5778
  getData,
5306
5779
  getState,
5307
5780
  toggleGroupRow,
5781
+ verticalBrain: verticalVirtualBrain,
5308
5782
  columns,
5309
5783
  columnsWidth
5310
5784
  });
@@ -5363,7 +5837,7 @@ function usePinnedStartRendering(params) {
5363
5837
  }
5364
5838
 
5365
5839
  // src/components/InfiniteTable/hooks/useYourBrain.ts
5366
- var import_react38 = __toModule(require("react"));
5840
+ var import_react39 = __toModule(require("react"));
5367
5841
 
5368
5842
  // src/components/VirtualBrain/index.ts
5369
5843
  var import_binary_search2 = __toModule(require_binary_search());
@@ -5372,6 +5846,7 @@ var initialScrollPosition2 = {
5372
5846
  scrollTop: 0
5373
5847
  };
5374
5848
  var raf = typeof window !== "undefined" ? requestAnimationFrame : (fn) => setTimeout(fn, 0);
5849
+ var ItemIndexBag = Object.seal({ itemIndex: 0 });
5375
5850
  var SORT_ASC = (a, b) => a - b;
5376
5851
  var VirtualBrain = class extends Logger {
5377
5852
  constructor(options) {
@@ -5479,22 +5954,24 @@ var VirtualBrain = class extends Logger {
5479
5954
  this.onRenderRangeChangeFns = this.onRenderRangeChangeFns.filter((f) => f !== fn);
5480
5955
  };
5481
5956
  };
5482
- this.update = (newCount, newItemSize) => {
5483
- const { itemSize, count } = this.options;
5957
+ this.update = (newCount, newItemSize, newItemSpan) => {
5958
+ const { itemSize, count, itemSpan } = this.options;
5484
5959
  const countChange = count !== newCount;
5485
5960
  const itemSizeChange = itemSize !== newItemSize;
5486
- if (!countChange && !itemSizeChange) {
5961
+ const itemSpanChange = itemSpan !== newItemSpan;
5962
+ if (!countChange && !itemSizeChange && !itemSpanChange) {
5487
5963
  return;
5488
5964
  }
5489
5965
  this.options.count = newCount;
5490
5966
  this.options.itemSize = newItemSize;
5967
+ this.options.itemSpan = newItemSpan;
5491
5968
  const size = this.availableSize[this.options.mainAxis === "vertical" ? "height" : "width"];
5492
5969
  const newRenderCount = this.computeRenderCount({
5493
5970
  itemSize: newItemSize,
5494
5971
  count: newCount,
5495
5972
  size
5496
5973
  });
5497
- if (!itemSizeChange && countChange && newCount > count) {
5974
+ if (!itemSizeChange && !itemSpanChange && countChange && newCount > count) {
5498
5975
  const currentRenderCount = this.getRenderCount();
5499
5976
  if (currentRenderCount > newRenderCount) {
5500
5977
  return;
@@ -5519,11 +5996,43 @@ var VirtualBrain = class extends Logger {
5519
5996
  this.updateRenderCount(newRenderCount);
5520
5997
  };
5521
5998
  this.reset = () => {
5999
+ this.itemSpanParent = [];
6000
+ this.itemSpanValue = [];
5522
6001
  this.itemSizeCache = [];
5523
6002
  this.itemOffsetCache = [0];
5524
6003
  this.renderCount = -1;
5525
6004
  this.totalSize = 0;
5526
6005
  };
6006
+ this.computeItemSpanUpTo = (itemIndex) => {
6007
+ const { count, itemSpan } = this.options;
6008
+ if (!itemSpan) {
6009
+ return;
6010
+ }
6011
+ const cache = this.itemSpanParent;
6012
+ const spanResultArr = this.itemSpanValue;
6013
+ if (cache[itemIndex] === void 0) {
6014
+ let i = cache.length;
6015
+ let lastIndex = Math.min(itemIndex, count - 1);
6016
+ for (; i <= lastIndex; i++) {
6017
+ if (cache[i] === void 0) {
6018
+ ItemIndexBag.itemIndex = i;
6019
+ let spanValue = itemSpan(ItemIndexBag);
6020
+ if (false) {
6021
+ this.debug("itemSpan cannot be less than 1 - got %d for index %d", spanValue, i);
6022
+ }
6023
+ cache[i] = i;
6024
+ spanResultArr[i] = spanValue;
6025
+ let spannedItemIndex = i;
6026
+ while (spanValue > 1) {
6027
+ spannedItemIndex += 1;
6028
+ cache[spannedItemIndex] = i;
6029
+ spanResultArr[spannedItemIndex] = 0;
6030
+ spanValue -= 1;
6031
+ }
6032
+ }
6033
+ }
6034
+ }
6035
+ };
5527
6036
  this.computeCacheFor = (itemIndex) => {
5528
6037
  if (typeof this.options.itemSize !== "function") {
5529
6038
  return;
@@ -5543,6 +6052,33 @@ var VirtualBrain = class extends Logger {
5543
6052
  this.itemOffsetCache[itemIndex] = offset;
5544
6053
  }
5545
6054
  };
6055
+ this.getItemSpan = (itemIndex) => {
6056
+ if (!this.options.itemSpan) {
6057
+ return 1;
6058
+ }
6059
+ if (this.itemSpanValue[itemIndex] === void 0) {
6060
+ this.computeItemSpanUpTo(itemIndex);
6061
+ }
6062
+ return this.itemSpanValue[itemIndex] || 1;
6063
+ };
6064
+ this.getItemSpanParent = (itemIndex) => {
6065
+ if (!this.options.itemSpan) {
6066
+ return itemIndex;
6067
+ }
6068
+ if (this.itemSpanParent[itemIndex] === void 0) {
6069
+ this.computeItemSpanUpTo(itemIndex);
6070
+ }
6071
+ return this.itemSpanParent[itemIndex];
6072
+ };
6073
+ this.getItemSizeWithSpan = (itemIndex, itemSpan) => {
6074
+ let itemSize = this.getItemSize(itemIndex);
6075
+ while (itemSpan > 1) {
6076
+ itemIndex += 1;
6077
+ itemSpan -= 1;
6078
+ itemSize += this.getItemSize(itemIndex);
6079
+ }
6080
+ return itemSize;
6081
+ };
5546
6082
  this.getItemSize = (itemIndex) => {
5547
6083
  const { itemSize, count } = this.options;
5548
6084
  if (typeof itemSize !== "function") {
@@ -5689,7 +6225,7 @@ var VirtualBrain = class extends Logger {
5689
6225
  }
5690
6226
  computeRenderRange() {
5691
6227
  const count = this.getOptions().count;
5692
- const renderCount = this.getRenderCount();
6228
+ let renderCount = this.getRenderCount();
5693
6229
  if (renderCount === 0) {
5694
6230
  return {
5695
6231
  renderStartIndex: -1,
@@ -5702,6 +6238,12 @@ var VirtualBrain = class extends Logger {
5702
6238
  renderEndIndex = count - 1;
5703
6239
  renderStartIndex = renderEndIndex - renderCount + 1;
5704
6240
  }
6241
+ if (this.options.itemSpan) {
6242
+ this.computeItemSpanUpTo(renderStartIndex);
6243
+ while (this.itemSpanParent[renderStartIndex] != renderStartIndex) {
6244
+ renderStartIndex--;
6245
+ }
6246
+ }
5705
6247
  return {
5706
6248
  renderStartIndex,
5707
6249
  renderEndIndex
@@ -5713,9 +6255,9 @@ var VirtualBrain = class extends Logger {
5713
6255
  };
5714
6256
 
5715
6257
  // src/components/InfiniteTable/hooks/useColumnSizeFn.ts
5716
- var import_react37 = __toModule(require("react"));
6258
+ var import_react38 = __toModule(require("react"));
5717
6259
  function useColumnSizeFn(computedUnpinnedColumns) {
5718
- const columnSize = (0, import_react37.useCallback)((index) => {
6260
+ const columnSize = (0, import_react38.useCallback)((index) => {
5719
6261
  const column = computedUnpinnedColumns[index];
5720
6262
  if (!column) {
5721
6263
  console.log("cannot find column at index", index, computedUnpinnedColumns);
@@ -5733,7 +6275,8 @@ function useYourBrain(param) {
5733
6275
  computedPinnedStartWidth,
5734
6276
  computedPinnedEndWidth,
5735
6277
  rowHeight,
5736
- bodySize
6278
+ bodySize,
6279
+ rowSpan
5737
6280
  } = param;
5738
6281
  const columnSize = useColumnSizeFn(computedUnpinnedColumns);
5739
6282
  const horizontalVirtualBrain = useOnce(() => {
@@ -5748,20 +6291,21 @@ function useYourBrain(param) {
5748
6291
  const brain = new VirtualBrain({
5749
6292
  count: dataArray.length,
5750
6293
  itemSize: rowHeight,
5751
- mainAxis: "vertical"
6294
+ mainAxis: "vertical",
6295
+ itemSpan: rowSpan
5752
6296
  });
5753
6297
  return brain;
5754
6298
  });
5755
6299
  horizontalVirtualBrain.update(computedUnpinnedColumns.length, columnSize);
5756
- verticalVirtualBrain.update(dataArray.length, rowHeight);
6300
+ verticalVirtualBrain.update(dataArray.length, rowHeight, rowSpan);
5757
6301
  globalThis.verticalVirtualBrain = verticalVirtualBrain;
5758
- (0, import_react38.useEffect)(() => {
6302
+ (0, import_react39.useEffect)(() => {
5759
6303
  verticalVirtualBrain.setAvailableSize({
5760
6304
  height: bodySize.height,
5761
6305
  width: 0
5762
6306
  });
5763
6307
  }, [bodySize, verticalVirtualBrain]);
5764
- (0, import_react38.useEffect)(() => {
6308
+ (0, import_react39.useEffect)(() => {
5765
6309
  horizontalVirtualBrain.setAvailableSize({
5766
6310
  height: 0,
5767
6311
  width: Math.max(bodySize.width - computedPinnedStartWidth - computedPinnedEndWidth, 0)
@@ -5795,7 +6339,7 @@ function shallowEqualObjects(objA, objB) {
5795
6339
 
5796
6340
  // src/components/InfiniteTable/hooks/useListRendering.tsx
5797
6341
  function useListRendering(param) {
5798
- const { computed, domRef, bodySize, columnShifts } = param;
6342
+ const { computed, bodySize, columnShifts } = param;
5799
6343
  const { componentActions, componentState, getState } = useInfiniteTable();
5800
6344
  const prevComputed = usePrevious(computed, null);
5801
6345
  const {
@@ -5808,40 +6352,68 @@ function useListRendering(param) {
5808
6352
  computedUnpinnedColumns,
5809
6353
  computedUnpinnedColumnsWidth,
5810
6354
  computedPinnedStartOverflow,
5811
- computedPinnedEndOverflow
6355
+ computedPinnedEndOverflow,
6356
+ computedVisibleColumns
5812
6357
  } = computed;
5813
6358
  const { componentState: dataSourceState, getState: getDataSourceState } = useDataSourceContextValue();
5814
6359
  const { dataArray } = dataSourceState;
5815
6360
  const getData = useLatest(dataArray);
5816
6361
  const {
5817
- rowHeightComputed: rowHeight,
6362
+ rowHeight,
5818
6363
  pinnedStartMaxWidth,
5819
6364
  pinnedEndMaxWidth,
5820
6365
  pinnedStartScrollListener,
5821
6366
  pinnedEndScrollListener
5822
6367
  } = componentState;
5823
6368
  const prevDataSourceTimestamp = usePrevious(dataSourceState.updatedAt);
5824
- const repaintIdRef = (0, import_react39.useRef)(0);
6369
+ const repaintIdRef = (0, import_react40.useRef)(0);
5825
6370
  if (!shallowEqualObjects(prevComputed, computed) || prevDataSourceTimestamp !== dataSourceState.updatedAt) {
5826
6371
  repaintIdRef.current++;
5827
6372
  }
5828
6373
  const repaintId = repaintIdRef.current;
6374
+ const rowSpan = (0, import_react40.useMemo)(() => {
6375
+ const colsWithRowspan = computedVisibleColumns.filter((col) => typeof col.rowspan === "function");
6376
+ return colsWithRowspan.length ? ({ itemIndex }) => {
6377
+ let maxSpan = 1;
6378
+ const dataArray2 = getData();
6379
+ const rowInfo = dataArray2[itemIndex];
6380
+ const data = rowInfo.data;
6381
+ colsWithRowspan.forEach((column) => {
6382
+ if (!column.rowspan) {
6383
+ return;
6384
+ }
6385
+ const span = column.rowspan({
6386
+ column,
6387
+ data,
6388
+ dataArray: dataArray2,
6389
+ groupRowInfo: null,
6390
+ rowInfo,
6391
+ rowIndex: itemIndex
6392
+ });
6393
+ if (span > maxSpan) {
6394
+ maxSpan = span;
6395
+ }
6396
+ });
6397
+ return maxSpan;
6398
+ } : void 0;
6399
+ }, [computedVisibleColumns]);
5829
6400
  const { horizontalVirtualBrain, verticalVirtualBrain } = useYourBrain({
5830
6401
  computedPinnedStartWidth: computed.computedPinnedStartWidth,
5831
6402
  computedPinnedEndWidth: computed.computedPinnedEndWidth,
5832
6403
  computedUnpinnedColumns: computed.computedUnpinnedColumns,
5833
6404
  rowHeight,
5834
6405
  dataArray,
5835
- bodySize
6406
+ bodySize,
6407
+ rowSpan
5836
6408
  });
5837
6409
  const hasHorizontalScrollbar = computedUnpinnedColumnsWidth > bodySize.width - computedPinnedStartColumnsWidth - computedPinnedEndColumnsWidth;
5838
6410
  const reservedContentHeight = verticalVirtualBrain.getTotalSize() + (hasHorizontalScrollbar ? getScrollbarWidth() : 0);
5839
6411
  const hasVerticalScrollbar = bodySize.height < reservedContentHeight;
5840
- const scrollbars = (0, import_react39.useMemo)(() => ({
6412
+ const scrollbars = (0, import_react40.useMemo)(() => ({
5841
6413
  vertical: hasVerticalScrollbar,
5842
6414
  horizontal: hasHorizontalScrollbar
5843
6415
  }), [hasVerticalScrollbar, hasHorizontalScrollbar]);
5844
- (0, import_react39.useEffect)(() => {
6416
+ (0, import_react40.useEffect)(() => {
5845
6417
  if (!bodySize.height) {
5846
6418
  return;
5847
6419
  }
@@ -5864,10 +6436,10 @@ function useListRendering(param) {
5864
6436
  const { applyScrollHorizontal, applyScrollVertical } = useOnContainerScroll({
5865
6437
  verticalVirtualBrain,
5866
6438
  horizontalVirtualBrain,
5867
- domRef
6439
+ reservedContentHeight
5868
6440
  });
5869
6441
  const { componentActions: dataSourceActions } = useDataSourceContextValue();
5870
- const toggleGroupRow = (0, import_react39.useCallback)((groupKeys) => {
6442
+ const toggleGroupRow = (0, import_react40.useCallback)((groupKeys) => {
5871
6443
  const newState = new GroupRowsState(getDataSourceState().groupRowsState);
5872
6444
  newState.toggleGroupRow(groupKeys);
5873
6445
  dataSourceActions.groupRowsState = newState;
@@ -5902,7 +6474,7 @@ function useListRendering(param) {
5902
6474
  computedUnpinnedColumns
5903
6475
  });
5904
6476
  const [, rerender] = useRerender();
5905
- (0, import_react39.useEffect)(() => {
6477
+ (0, import_react40.useEffect)(() => {
5906
6478
  rerender();
5907
6479
  }, [dataSourceState]);
5908
6480
  const { pinnedStartList, pinnedStartScrollbarPlaceholder } = usePinnedStartRendering(pinnedRenderingParams);
@@ -5926,7 +6498,7 @@ function useListRendering(param) {
5926
6498
 
5927
6499
  // src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
5928
6500
  var React33 = __toModule(require("react"));
5929
- var import_react40 = __toModule(require("react"));
6501
+ var import_react41 = __toModule(require("react"));
5930
6502
 
5931
6503
  // src/components/utils/decamelize.ts
5932
6504
  var import_decamelize = __toModule(require_decamelize());
@@ -5937,7 +6509,7 @@ var decamelize = (input, options) => {
5937
6509
 
5938
6510
  // src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
5939
6511
  var defaultStyle2 = {
5940
- padding: "var(--it-space-2)",
6512
+ padding: ThemeVars.spacing[2],
5941
6513
  textAlign: "end",
5942
6514
  opacity: "1",
5943
6515
  visibility: "visible",
@@ -5963,7 +6535,7 @@ var enforceStyle = (node, style) => {
5963
6535
  }
5964
6536
  };
5965
6537
  var InfiniteTableLicenseFooter = React33.forwardRef(function InfiniteTableLicenseFooter2(props, ref) {
5966
- const { rootClassName: rootClassName11 } = useInternalProps();
6538
+ const { rootClassName: rootClassName12 } = useInternalProps();
5967
6539
  const domRef = React33.useRef(null);
5968
6540
  const domCallback = React33.useCallback((node) => {
5969
6541
  domRef.current = node;
@@ -5976,7 +6548,7 @@ var InfiniteTableLicenseFooter = React33.forwardRef(function InfiniteTableLicens
5976
6548
  ref.current = node;
5977
6549
  }
5978
6550
  }, []);
5979
- (0, import_react40.useEffect)(() => {
6551
+ (0, import_react41.useEffect)(() => {
5980
6552
  const forceStyle = () => {
5981
6553
  requestAnimationFrame(() => {
5982
6554
  var _a;
@@ -5993,7 +6565,7 @@ var InfiniteTableLicenseFooter = React33.forwardRef(function InfiniteTableLicens
5993
6565
  return /* @__PURE__ */ React33.createElement("div", __spreadProps(__spreadValues({
5994
6566
  ref: domCallback
5995
6567
  }, props), {
5996
- className: join(`${rootClassName11}Footer`, ICSS.position.relative, props.className),
6568
+ className: join(`${rootClassName12}-Footer`, FooterCls, props.className),
5997
6569
  style: defaultStyle2
5998
6570
  }), "Powered by", " ", /* @__PURE__ */ React33.createElement("a", {
5999
6571
  href: "https://infinite-table.com",
@@ -6004,7 +6576,7 @@ var InfiniteTableLicenseFooter = React33.forwardRef(function InfiniteTableLicens
6004
6576
  });
6005
6577
 
6006
6578
  // src/components/InfiniteTable/hooks/useLicense/useLicense.ts
6007
- var import_react41 = __toModule(require("react"));
6579
+ var import_react42 = __toModule(require("react"));
6008
6580
 
6009
6581
  // src/components/InfiniteTable/hooks/useLicense/crc32.ts
6010
6582
  var DEFAULT_ReversedPolynomial = 3988292384;
@@ -6149,20 +6721,28 @@ var decode = (licenseKey) => {
6149
6721
  };
6150
6722
 
6151
6723
  // src/components/InfiniteTable/hooks/useLicense/useLicense.ts
6724
+ var SANDBOX_REGEX = /(https):\/\/\d+\-\d+\-\d\-(sandpack\.codesandbox\.io)/g;
6725
+ var origin = typeof window !== "undefined" ? window.location.origin : "";
6726
+ var [_fullUrl, protocol, sandboxUrl] = Array.from(SANDBOX_REGEX.exec(origin) || []);
6727
+ var isInsideSandbox = protocol === "https" && sandboxUrl === "sandpack.codesandbox.io";
6152
6728
  var useLicense = (licenseKey) => {
6153
- const valid = (0, import_react41.useMemo)(() => {
6154
- return isValidLicense(licenseKey, {
6729
+ const valid = (0, import_react42.useMemo)(() => {
6730
+ let valid2 = isValidLicense(licenseKey, {
6155
6731
  publishedAt: 1624970570587,
6156
- version: "0.0.2-canary.0"
6732
+ version: "0.0.2-canary.4"
6157
6733
  });
6734
+ if (!valid2 && isInsideSandbox) {
6735
+ return true;
6736
+ }
6737
+ return valid2;
6158
6738
  }, [licenseKey]);
6159
6739
  return valid;
6160
6740
  };
6161
6741
 
6162
6742
  // src/components/CSSVariableWatch.tsx
6163
6743
  var React34 = __toModule(require("react"));
6164
- var import_react42 = __toModule(require("react"));
6165
- var error = err("CSSVariableWatch");
6744
+ var import_react43 = __toModule(require("react"));
6745
+ var error2 = err("CSSVariableWatch");
6166
6746
  var debug5 = dbg("CSSVariableWatch");
6167
6747
  var WRAPPER_STYLE = {
6168
6748
  position: "absolute",
@@ -6174,7 +6754,7 @@ var WRAPPER_STYLE = {
6174
6754
  overflow: "hidden"
6175
6755
  };
6176
6756
  var useCSSVariableWatch = (params) => {
6177
- const lastValueRef = (0, import_react42.useRef)(0);
6757
+ const lastValueRef = (0, import_react43.useRef)(0);
6178
6758
  const onResize = React34.useCallback(({ height }) => {
6179
6759
  if (height && height !== lastValueRef.current) {
6180
6760
  lastValueRef.current = height;
@@ -6189,12 +6769,12 @@ var useCSSVariableWatch = (params) => {
6189
6769
  debug5(`Variable ${params.varName} found and equals ${value}.`);
6190
6770
  params.onChange(value);
6191
6771
  } else {
6192
- error(`Specified variable ${params.varName} not found or does not have a numeric value.`);
6772
+ error2(`Specified variable ${params.varName} not found or does not have a numeric value.`);
6193
6773
  }
6194
6774
  }, []);
6195
6775
  };
6196
6776
  var CSSVariableWatch = (props) => {
6197
- const domRef = (0, import_react42.useRef)(null);
6777
+ const domRef = (0, import_react43.useRef)(null);
6198
6778
  useCSSVariableWatch(__spreadProps(__spreadValues({}, props), {
6199
6779
  ref: domRef
6200
6780
  }));
@@ -6205,11 +6785,118 @@ var CSSVariableWatch = (props) => {
6205
6785
  }, /* @__PURE__ */ React34.createElement("div", {
6206
6786
  ref: domRef,
6207
6787
  style: {
6208
- height: `var(${props.varName})`
6788
+ height: props.varName.startsWith("var(") ? props.varName : `var(${props.varName})`
6209
6789
  }
6210
6790
  }));
6211
6791
  };
6212
6792
 
6793
+ // src/components/InfiniteTable/hooks/useDOMProps.ts
6794
+ function useDOMProps(initialDOMProps) {
6795
+ const { computed, componentState, componentActions } = useInfiniteTable();
6796
+ const {
6797
+ columnShifts,
6798
+ focused,
6799
+ focusedWithin,
6800
+ domRef,
6801
+ onBlurWithin,
6802
+ onFocusWithin,
6803
+ onSelfFocus,
6804
+ onSelfBlur
6805
+ } = componentState;
6806
+ const { computedPinnedStartColumnsWidth, computedPinnedEndColumnsWidth } = computed;
6807
+ const setFocused = rafFn((focused2) => {
6808
+ componentActions.focused = focused2;
6809
+ });
6810
+ const setFocusedWithin = rafFn((focused2) => {
6811
+ componentActions.focusedWithin = focused2;
6812
+ });
6813
+ const onFocus = (event) => {
6814
+ var _a;
6815
+ (_a = initialDOMProps == null ? void 0 : initialDOMProps.onFocus) == null ? void 0 : _a.call(initialDOMProps, event);
6816
+ if (event.target === domRef.current) {
6817
+ setFocused(true);
6818
+ onSelfFocus == null ? void 0 : onSelfFocus(event);
6819
+ if (focusedWithin) {
6820
+ setFocusedWithin(false);
6821
+ onBlurWithin == null ? void 0 : onBlurWithin(event);
6822
+ }
6823
+ } else {
6824
+ if (!focusedWithin) {
6825
+ setFocusedWithin(true);
6826
+ onFocusWithin == null ? void 0 : onFocusWithin(event);
6827
+ }
6828
+ }
6829
+ };
6830
+ const onBlur = (event) => {
6831
+ var _a, _b;
6832
+ (_a = initialDOMProps == null ? void 0 : initialDOMProps.onBlur) == null ? void 0 : _a.call(initialDOMProps, event);
6833
+ if (event.target === domRef.current) {
6834
+ setFocused(false);
6835
+ onSelfBlur == null ? void 0 : onSelfBlur(event);
6836
+ if (focusedWithin) {
6837
+ setFocusedWithin(false);
6838
+ onBlurWithin == null ? void 0 : onBlurWithin(event);
6839
+ }
6840
+ } else {
6841
+ const contained = (_b = domRef.current) == null ? void 0 : _b.contains(event.relatedTarget);
6842
+ if (!contained) {
6843
+ setFocusedWithin(false);
6844
+ onBlurWithin == null ? void 0 : onBlurWithin(event);
6845
+ }
6846
+ }
6847
+ };
6848
+ const domProps = __spreadProps(__spreadValues({
6849
+ tabIndex: 0
6850
+ }, initialDOMProps), {
6851
+ onFocus,
6852
+ onBlur
6853
+ });
6854
+ const className = join(InfiniteTableClassName, InfiniteCls, columnShifts ? `${InfiniteClsShiftingColumns} ${InfiniteTableClassName}--shifting` : "", domProps == null ? void 0 : domProps.className, computedPinnedStartColumnsWidth ? `${InfiniteTableClassName}--has-pinned-start` : null, computedPinnedEndColumnsWidth ? `${InfiniteTableClassName}--has-pinned-end` : null, focused ? `${InfiniteTableClassName}--focused` : null, focusedWithin ? `${InfiniteTableClassName}--focused-within` : null, focused && componentState.focusedClassName ? componentState.focusedClassName : null, focusedWithin && componentState.focusedWithinClassName ? componentState.focusedWithinClassName : null, computed.computedPinnedStartOverflow ? `${InfiniteTableClassName}--has-pinned-start-overflow` : null, computed.computedPinnedEndOverflow ? `${InfiniteTableClassName}--has-pinned-end-overflow` : null, InfiniteClsRecipe({
6855
+ hasPinnedStart: !!computedPinnedStartColumnsWidth,
6856
+ hasPinnedEnd: !!computedPinnedEndColumnsWidth,
6857
+ hasPinnedStartOverflow: !!computed.computedPinnedStartOverflow,
6858
+ hasPinnedEndOverflow: !!computed.computedPinnedEndOverflow,
6859
+ focused,
6860
+ focusedWithin
6861
+ }));
6862
+ domProps.className = className;
6863
+ domProps.style = __spreadValues({}, initialDOMProps == null ? void 0 : initialDOMProps.style);
6864
+ if (focused) {
6865
+ if (componentState.focusedStyle) {
6866
+ Object.assign(domProps.style, componentState.focusedStyle);
6867
+ }
6868
+ }
6869
+ if (focusedWithin) {
6870
+ if (componentState.focusedWithinStyle) {
6871
+ Object.assign(domProps.style, componentState.focusedWithinStyle);
6872
+ }
6873
+ }
6874
+ return domProps;
6875
+ }
6876
+
6877
+ // src/components/InfiniteTable/components/LoadMask.tsx
6878
+ var React35 = __toModule(require("react"));
6879
+
6880
+ // src/components/InfiniteTable/components/LoadMask.css.ts
6881
+ var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2 _16lm1iwp _16lm1iwr _16lm1iwv _16lm1iwt", hidden: "qy58ya2 qy58ya0 _16lm1iw2 _16lm1iwp _16lm1iwr _16lm1iwv _16lm1iwt" };
6882
+ var LoadMaskOverlayCls = "qy58ya3 _16lm1iw2 _16lm1iwp _16lm1iwr _16lm1iwv _16lm1iwt";
6883
+ var LoadMaskTextCls = "qy58ya4";
6884
+
6885
+ // src/components/InfiniteTable/components/LoadMask.tsx
6886
+ var { rootClassName: rootClassName11 } = internalProps;
6887
+ var baseCls2 = `${rootClassName11}-LoadMask`;
6888
+ function LoadMaskFn(props) {
6889
+ const { visible, children = "Loading" } = props;
6890
+ return /* @__PURE__ */ React35.createElement("div", {
6891
+ className: `${LoadMaskCls[visible ? "visible" : "hidden"]} ${baseCls2}`
6892
+ }, /* @__PURE__ */ React35.createElement("div", {
6893
+ className: `${LoadMaskOverlayCls} ${baseCls2}-Overlay`
6894
+ }), /* @__PURE__ */ React35.createElement("div", {
6895
+ className: `${LoadMaskTextCls} ${baseCls2}-Text`
6896
+ }, children));
6897
+ }
6898
+ var LoadMask = React35.memo(LoadMaskFn);
6899
+
6213
6900
  // src/components/InfiniteTable/index.tsx
6214
6901
  var InfiniteTableClassName = internalProps.rootClassName;
6215
6902
  var ONLY_VERTICAL_SCROLLBAR = {
@@ -6217,26 +6904,33 @@ var ONLY_VERTICAL_SCROLLBAR = {
6217
6904
  vertical: true
6218
6905
  };
6219
6906
  var InfiniteTableRoot = getComponentStateRoot({
6220
- getInitialState,
6221
- deriveReadOnlyState,
6907
+ initSetupState,
6908
+ forwardProps,
6909
+ mapPropsToState,
6910
+ allowedControlledPropOverrides: {
6911
+ rowHeight: true,
6912
+ headerHeight: true
6913
+ },
6222
6914
  getParentState: () => useDataSource()
6223
6915
  });
6224
- var InfiniteTableComponent = React35.memo(function InfiniteTableComponent2() {
6916
+ var InfiniteTableComponent = React36.memo(function InfiniteTableComponent2() {
6917
+ var _a;
6225
6918
  const { componentState, getComputed, computed } = useInfiniteTable();
6226
6919
  const {
6227
- componentState: { dataArray }
6920
+ componentState: { dataArray, loading }
6228
6921
  } = useDataSourceContextValue();
6229
6922
  const {
6230
6923
  domRef,
6231
- bodyDOMRef,
6924
+ scrollerDOMRef,
6232
6925
  portalDOMRef,
6233
- domProps,
6234
6926
  licenseKey,
6927
+ loadingText,
6235
6928
  header,
6236
- onRowHeightChange,
6237
- onHeaderHeightChange,
6929
+ onRowHeightCSSVarChange,
6930
+ onHeaderHeightCSSVarChange,
6238
6931
  rowHeightCSSVar,
6239
- headerHeightCSSVar
6932
+ headerHeightCSSVar,
6933
+ components
6240
6934
  } = componentState;
6241
6935
  const { columnShifts, bodySize } = componentState;
6242
6936
  const {
@@ -6258,39 +6952,40 @@ var InfiniteTableComponent = React35.memo(function InfiniteTableComponent2() {
6258
6952
  computed
6259
6953
  });
6260
6954
  const licenseValid = useLicense(licenseKey);
6261
- const className = join(InfiniteTableClassName, columnShifts ? `${InfiniteTableClassName}--shifting` : "", domProps == null ? void 0 : domProps.className, pinnedStartList ? `${InfiniteTableClassName}--has-pinned-start` : null, pinnedEndList ? `${InfiniteTableClassName}--has-pinned-end` : null, computed.computedPinnedStartOverflow ? `${InfiniteTableClassName}--has-pinned-start-overflow` : null, computed.computedPinnedEndOverflow ? `${InfiniteTableClassName}--has-pinned-end-overflow` : null);
6262
- return /* @__PURE__ */ React35.createElement("div", __spreadProps(__spreadValues({
6955
+ const domProps = useDOMProps(componentState.domProps);
6956
+ const LoadMaskCmp = (_a = components == null ? void 0 : components.LoadMask) != null ? _a : LoadMask;
6957
+ return /* @__PURE__ */ React36.createElement("div", __spreadValues({
6263
6958
  ref: domRef
6264
- }, domProps), {
6265
- className
6266
- }), header ? /* @__PURE__ */ React35.createElement(TableHeaderWrapper, {
6959
+ }, domProps), header ? /* @__PURE__ */ React36.createElement(TableHeaderWrapper, {
6267
6960
  brain: horizontalVirtualBrain,
6268
6961
  repaintId,
6269
6962
  scrollbars
6270
- }) : null, /* @__PURE__ */ React35.createElement(InfiniteTableBody, null, /* @__PURE__ */ React35.createElement(VirtualScrollContainer, {
6271
- ref: bodyDOMRef,
6963
+ }) : null, /* @__PURE__ */ React36.createElement(InfiniteTableBody, null, /* @__PURE__ */ React36.createElement(VirtualScrollContainer, {
6964
+ ref: scrollerDOMRef,
6272
6965
  onContainerScroll: applyScrollVertical,
6273
6966
  scrollable: ONLY_VERTICAL_SCROLLBAR
6274
- }, /* @__PURE__ */ React35.createElement("div", {
6275
- className: ICSS.display.flex
6276
- }, pinnedStartList, centerList, pinnedEndList), /* @__PURE__ */ React35.createElement(SpacePlaceholder, {
6967
+ }, /* @__PURE__ */ React36.createElement("div", {
6968
+ className: display.flex
6969
+ }, pinnedStartList, centerList, pinnedEndList), /* @__PURE__ */ React36.createElement(SpacePlaceholder, {
6277
6970
  count: dataArray.length,
6278
6971
  width: 0,
6279
6972
  height: reservedContentHeight
6280
- })), pinnedStartScrollbarPlaceholder, pinnedEndScrollbarPlaceholder), licenseValid ? null : /* @__PURE__ */ React35.createElement(InfiniteTableLicenseFooter, null), /* @__PURE__ */ React35.createElement("div", {
6973
+ })), pinnedStartScrollbarPlaceholder, pinnedEndScrollbarPlaceholder, /* @__PURE__ */ React36.createElement(LoadMaskCmp, {
6974
+ visible: loading
6975
+ }, loadingText)), licenseValid ? null : /* @__PURE__ */ React36.createElement(InfiniteTableLicenseFooter, null), /* @__PURE__ */ React36.createElement("div", {
6281
6976
  ref: portalDOMRef,
6282
- className: "ITable-Portal"
6283
- }), rowHeightCSSVar ? /* @__PURE__ */ React35.createElement(CSSVariableWatch, {
6977
+ className: join(`${rootClassName}Portal`, zIndex[1e3], position.absolute, top[0], left[0])
6978
+ }), rowHeightCSSVar ? /* @__PURE__ */ React36.createElement(CSSVariableWatch, {
6284
6979
  varName: rowHeightCSSVar,
6285
- onChange: onRowHeightChange
6286
- }) : null, headerHeightCSSVar ? /* @__PURE__ */ React35.createElement(CSSVariableWatch, {
6980
+ onChange: onRowHeightCSSVarChange
6981
+ }) : null, headerHeightCSSVar ? /* @__PURE__ */ React36.createElement(CSSVariableWatch, {
6287
6982
  varName: headerHeightCSSVar,
6288
- onChange: onHeaderHeightChange
6983
+ onChange: onHeaderHeightCSSVarChange
6289
6984
  }) : null);
6290
6985
  });
6291
6986
  function InfiniteTableContextProvider() {
6292
6987
  const { componentActions, componentState } = useComponentState();
6293
- const { bodyDOMRef, bodySizeRef } = componentState;
6988
+ const { scrollerDOMRef } = componentState;
6294
6989
  const computed = useComputed();
6295
6990
  const getComputed = useLatest(computed);
6296
6991
  const getState = useLatest(componentState);
@@ -6305,14 +7000,13 @@ function InfiniteTableContextProvider() {
6305
7000
  getComputed,
6306
7001
  getState
6307
7002
  };
6308
- useResizeObserver(bodyDOMRef, (size) => {
7003
+ useResizeObserver(scrollerDOMRef, (size) => {
6309
7004
  var _a, _b;
6310
7005
  const bodySize = {
6311
7006
  width: size.width,
6312
7007
  height: size.height
6313
7008
  };
6314
- bodySize.width = (_b = (_a = bodyDOMRef.current) == null ? void 0 : _a.scrollWidth) != null ? _b : bodySize.width;
6315
- bodySizeRef.current = bodySize;
7009
+ bodySize.width = (_b = (_a = scrollerDOMRef.current) == null ? void 0 : _a.scrollWidth) != null ? _b : bodySize.width;
6316
7010
  const state = getState();
6317
7011
  if (!state.virtualizeHeader) {
6318
7012
  componentActions.bodySize = bodySize;
@@ -6320,21 +7014,22 @@ function InfiniteTableContextProvider() {
6320
7014
  }
6321
7015
  componentActions.bodySize = bodySize;
6322
7016
  }, { earlyAttach: true });
6323
- React35.useEffect(() => {
7017
+ React36.useEffect(() => {
6324
7018
  return () => {
6325
- componentState.onRowHeightChange.destroy();
6326
- componentState.onHeaderHeightChange.destroy();
7019
+ componentState.onRowHeightCSSVarChange.destroy();
7020
+ componentState.onHeaderHeightCSSVarChange.destroy();
6327
7021
  };
6328
7022
  }, []);
6329
7023
  const TableContext2 = getInfiniteTableContext();
6330
- return /* @__PURE__ */ React35.createElement(TableContext2.Provider, {
7024
+ return /* @__PURE__ */ React36.createElement(TableContext2.Provider, {
6331
7025
  value: contextValue
6332
- }, /* @__PURE__ */ React35.createElement(InfiniteTableComponent, null));
7026
+ }, /* @__PURE__ */ React36.createElement(InfiniteTableComponent, null));
6333
7027
  }
6334
7028
  function InfiniteTable(props) {
6335
- return /* @__PURE__ */ React35.createElement(React35.StrictMode, null, /* @__PURE__ */ React35.createElement(InfiniteTableRoot, __spreadValues({}, props), /* @__PURE__ */ React35.createElement(InfiniteTableContextProvider, null)));
7029
+ const table = /* @__PURE__ */ React36.createElement(InfiniteTableRoot, __spreadValues({}, props), /* @__PURE__ */ React36.createElement(InfiniteTableContextProvider, null));
7030
+ return /* @__PURE__ */ React36.createElement(React36.StrictMode, null, table);
6336
7031
  }
6337
7032
  InfiniteTable.defaultProps = {
6338
7033
  rowHeight: 40,
6339
- headerHeight: "--ITableHeader__height"
7034
+ headerHeight: ThemeVars.components.Header.height
6340
7035
  };