@infinite-table/infinite-react 0.0.2-canary.1 → 0.0.2-canary.5

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
  }
@@ -579,18 +579,16 @@ __export(exports, {
579
579
  flatten: () => flatten,
580
580
  getComponentStateRoot: () => getComponentStateRoot,
581
581
  group: () => group,
582
+ interceptMap: () => interceptMap,
582
583
  useComponentState: () => useComponentState,
583
584
  useDataSource: () => useDataSource
584
585
  });
585
586
 
586
587
  // src/components/InfiniteTable/index.tsx
587
- var React35 = __toModule(require("react"));
588
-
589
- // src/utils/join.ts
590
- var join = (...args) => args.filter((x) => !!`${x}`).join(" ");
588
+ var React36 = __toModule(require("react"));
591
589
 
592
590
  // src/components/InfiniteTable/internalProps.ts
593
- var rootClassName = "ITable";
591
+ var rootClassName = "Infinite";
594
592
  var internalProps = {
595
593
  rootClassName
596
594
  };
@@ -632,19 +630,6 @@ function buildSubscriptionCallback() {
632
630
  return updater;
633
631
  }
634
632
 
635
- // src/components/utils/isControlledValue.ts
636
- function isControlledValue(value) {
637
- const controlled = value !== void 0;
638
- return controlled;
639
- }
640
-
641
- // src/components/utils/isControlled.ts
642
- function isControlled(propName, props) {
643
- const propValue = props[propName];
644
- const controlled = isControlledValue(propValue);
645
- return controlled;
646
- }
647
-
648
633
  // src/components/VirtualBrain/ScrollListener.ts
649
634
  var initialScrollPosition = {
650
635
  scrollLeft: 0,
@@ -703,25 +688,15 @@ function computeColumnGroupsDepths(columnGroups) {
703
688
  }
704
689
 
705
690
  // src/components/InfiniteTable/state/getInitialState.ts
706
- function getInitialState(params) {
707
- var _a, _b, _c, _d, _e, _f;
708
- const { props } = params;
709
- const columnGroups = (_a = isControlled("columnGroups", props) ? props.columnGroups : props.defaultColumnGroups) != null ? _a : new Map();
710
- const pivotColumnGroups = props.pivotColumnGroups;
711
- const collapsedColumnGroups = (_b = isControlled("collapsedColumnGroups", props) ? props.collapsedColumnGroups : props.defaultCollapsedColumnGroups) != null ? _b : new Map();
712
- const computedColumnGroups = pivotColumnGroups || columnGroups;
713
- const columnGroupsDepthsMap = computeColumnGroupsDepths(computedColumnGroups);
714
- const generatedColumns = new Map();
715
- const pivotColumns = props.pivotColumns;
691
+ function initSetupState() {
692
+ const columnsGeneratedForGrouping = new Map();
716
693
  return {
717
- rowHeightComputed: typeof props.rowHeight === "number" ? props.rowHeight : 0,
718
- headerHeight: typeof props.headerHeight === "number" ? props.headerHeight : 0,
694
+ columnShifts: null,
719
695
  domRef: (0, import_react2.createRef)(),
720
- bodyDOMRef: (0, import_react2.createRef)(),
696
+ scrollerDOMRef: (0, import_react2.createRef)(),
721
697
  portalDOMRef: (0, import_react2.createRef)(),
722
- bodySizeRef: (0, import_react2.createRef)(),
723
- onRowHeightChange: buildSubscriptionCallback(),
724
- onHeaderHeightChange: buildSubscriptionCallback(),
698
+ onRowHeightCSSVarChange: buildSubscriptionCallback(),
699
+ onHeaderHeightCSSVarChange: buildSubscriptionCallback(),
725
700
  bodySize: {
726
701
  width: 0,
727
702
  height: 0
@@ -730,65 +705,105 @@ function getInitialState(params) {
730
705
  scrollTop: 0,
731
706
  scrollLeft: 0
732
707
  },
708
+ focused: false,
709
+ focusedWithin: false,
710
+ columnsWhenGrouping: columnsGeneratedForGrouping,
733
711
  draggingColumnId: null,
734
- columns: props.columns,
735
- pivotColumns,
736
- pivotColumnGroups,
737
- generatedColumns,
738
- columnOrder: (_c = isControlled("columnOrder", props) ? props.columnOrder : props.defaultColumnOrder) != null ? _c : true,
739
- computedColumnGroups,
740
712
  pinnedStartScrollListener: new ScrollListener(),
741
713
  pinnedEndScrollListener: new ScrollListener(),
742
- columnGroups,
743
- collapsedColumnGroups,
744
- columnGroupsDepthsMap,
745
- columnGroupsMaxDepth: Math.max(...columnGroupsDepthsMap.values(), 0),
746
- columnVisibility: (_d = isControlled("columnVisibility", props) ? props.columnVisibility : props.defaultColumnVisibility) != null ? _d : new Map(),
747
- columnPinning: (_e = isControlled("columnPinning", props) ? props.columnPinning : props.defaultColumnPinning) != null ? _e : new Map(),
748
- columnAggregations: (_f = isControlled("columnAggregations", props) ? props.columnAggregations : props.defaultColumnAggregations) != null ? _f : new Map(),
749
- columnShifts: null,
750
- 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()
751
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";
752
782
  }
753
- function deriveReadOnlyState(params) {
754
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
755
- const { props, state, updated } = params;
756
- const virtualizeColumns = (_a = props.virtualizeColumns) != null ? _a : true;
757
- const header = (_b = props.header) != null ? _b : true;
783
+ var mapPropsToState = (params) => {
784
+ const { props, state, oldState, parentState } = params;
785
+ const { virtualizeColumns, header } = state;
758
786
  const computedColumnGroups = state.pivotColumnGroups || state.columnGroups;
759
787
  const virtualizeHeader = header && virtualizeColumns && (!computedColumnGroups || (computedColumnGroups == null ? void 0 : computedColumnGroups.size) === 0);
760
- const columnGroupsDepthsMap = (updated == null ? void 0 : updated.columnGroups) || (updated == null ? void 0 : updated.pivotColumnGroups) ? computeColumnGroupsDepths(computedColumnGroups) : state.columnGroupsDepthsMap;
761
- 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
+ });
762
795
  return {
763
- groupColumn: props.groupColumn,
764
- onReady: props.onReady,
765
- domProps: props.domProps,
766
- showZebraRows: (_d = props.showZebraRows) != null ? _d : true,
767
- virtualizeColumns,
796
+ groupRenderStrategy,
797
+ groupRowsBy,
798
+ computedColumns: state.computedPivotColumns || state.columnsWhenGrouping || state.columnsWhenInlineGroupRenderStrategy || props.columns,
768
799
  virtualizeHeader,
769
- header,
770
- rowStyle: props.rowStyle,
771
- rowProps: props.rowProps,
772
- rowClassName: props.rowClassName,
773
- pinnedStartMaxWidth: props.pinnedStartMaxWidth,
774
- pinnedEndMaxWidth: props.pinnedEndMaxWidth,
775
- groupRenderStrategy: (_e = props.groupRenderStrategy) != null ? _e : "multi-column",
776
- pivotTotalColumnPosition,
777
- columnMinWidth: (_f = props.columnMinWidth) != null ? _f : 30,
778
- columnMaxWidth: (_g = props.columnMaxWidth) != null ? _g : 2e3,
779
- columnDefaultWidth: (_h = props.columnDefaultWidth) != null ? _h : 300,
780
- draggableColumns: (_i = props.draggableColumns) != null ? _i : true,
781
- pivotColumn: props.pivotColumn,
782
- pivotRowLabelsColumn: props.pivotRowLabelsColumn,
783
- sortable: (_j = props.sortable) != null ? _j : true,
784
800
  columnGroupsDepthsMap,
785
- columnGroupsMaxDepth: Math.max(...columnGroupsDepthsMap.values(), 0),
801
+ columnGroupsMaxDepth: columnGroupsDepthsMap != state.columnGroupsDepthsMap ? Math.max(...columnGroupsDepthsMap.values(), 0) : state.columnGroupsMaxDepth,
786
802
  computedColumnGroups,
787
- licenseKey: props.licenseKey || globalThis.InfiniteTableLicenseKey || "",
788
803
  rowHeightCSSVar: typeof props.rowHeight === "string" ? props.rowHeight : "",
789
- headerHeightCSSVar: typeof props.headerHeight === "string" ? props.headerHeight : ""
804
+ headerHeightCSSVar: typeof props.headerHeight === "string" ? props.headerHeight || "--ITableHeader__height" : ""
790
805
  };
791
- }
806
+ };
792
807
 
793
808
  // src/components/ResizeObserver/index.tsx
794
809
  var React = __toModule(require("react"));
@@ -1049,7 +1064,34 @@ var adjustColumnOrderForPinning = (columnOrder, columnPinning) => {
1049
1064
  return columnOrder;
1050
1065
  };
1051
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
+
1052
1093
  // src/components/InfiniteTable/utils/getComputedVisibleColumns.ts
1094
+ var error = err("getComputedVisibleColumns");
1053
1095
  var isColumnVisible = (columnVisibility, _columnVisibilityAssumeVisible, colId) => {
1054
1096
  return !columnVisibility.has(colId) || columnVisibility.get(colId) !== false;
1055
1097
  };
@@ -1060,7 +1102,6 @@ var getComputedPinned = (colId, columnPinning) => {
1060
1102
  };
1061
1103
  var getComputedVisibleColumns = ({
1062
1104
  columns,
1063
- generatedColumns,
1064
1105
  bodySize,
1065
1106
  columnMinWidth,
1066
1107
  columnMaxWidth,
@@ -1078,18 +1119,15 @@ var getComputedVisibleColumns = ({
1078
1119
  columnVisibilityAssumeVisible
1079
1120
  }) => {
1080
1121
  let computedOffset = 0;
1081
- const normalizedColumnOrder = adjustColumnOrderForPinning(columnOrder === true ? Array.from(generatedColumns.keys()).concat(...columns.keys()) : columnOrder, columnPinning);
1122
+ const normalizedColumnOrder = adjustColumnOrderForPinning(columnOrder === true ? [...columns.keys()] : columnOrder, columnPinning);
1082
1123
  const visibleColumnOrder = normalizedColumnOrder.filter(isColumnVisible.bind(null, columnVisibility, columnVisibilityAssumeVisible));
1083
1124
  const columnsArray = visibleColumnOrder.map((columnId) => {
1084
1125
  let col = columns.get(columnId);
1085
1126
  if (!col) {
1086
- col = generatedColumns.get(columnId);
1087
- if (!col) {
1088
- throw `Column with id "${columnId}" specified in columnOrder array cannot be found in the columns map.`;
1089
- }
1127
+ error(`Column with id "${columnId}" specified in columnOrder array cannot be found in the columns map.`);
1090
1128
  }
1091
1129
  return col;
1092
- });
1130
+ }).filter(Boolean);
1093
1131
  const sortedMap = (sortInfo != null ? sortInfo : []).reduce((acc, info, index) => {
1094
1132
  if (info.id) {
1095
1133
  acc[info.id] = { sortInfo: info, index };
@@ -1330,13 +1368,13 @@ function interceptMap(map, fns) {
1330
1368
  // src/components/InfiniteTable/utils/rafFn.ts
1331
1369
  var rafFn = (fn) => {
1332
1370
  let rafId = 0;
1333
- return () => {
1371
+ return (...args) => {
1334
1372
  if (rafId) {
1335
1373
  cancelAnimationFrame(rafId);
1336
1374
  }
1337
1375
  rafId = requestAnimationFrame(() => {
1338
1376
  rafId = 0;
1339
- fn();
1377
+ fn(...args);
1340
1378
  });
1341
1379
  };
1342
1380
  };
@@ -1358,7 +1396,6 @@ var useRerenderOnKeyChange = (map) => {
1358
1396
  // src/components/InfiniteTable/hooks/useComputedVisibleColumns.ts
1359
1397
  var useComputedVisibleColumns = ({
1360
1398
  columns,
1361
- generatedColumns,
1362
1399
  bodySize,
1363
1400
  columnMinWidth,
1364
1401
  columnMaxWidth,
@@ -1396,7 +1433,6 @@ var useComputedVisibleColumns = ({
1396
1433
  } = (0, import_react8.useMemo)(() => {
1397
1434
  return getComputedVisibleColumns({
1398
1435
  columns,
1399
- generatedColumns,
1400
1436
  bodySize,
1401
1437
  columnMinWidth,
1402
1438
  columnMaxWidth,
@@ -1415,7 +1451,6 @@ var useComputedVisibleColumns = ({
1415
1451
  });
1416
1452
  }, [
1417
1453
  columns,
1418
- generatedColumns,
1419
1454
  bodySize.width,
1420
1455
  columnMinWidth,
1421
1456
  columnMaxWidth,
@@ -1458,7 +1493,7 @@ var useComputedVisibleColumns = ({
1458
1493
  var sortAscending = (a, b) => a - b;
1459
1494
 
1460
1495
  // src/components/InfiniteTable/hooks/useComputed.ts
1461
- var import_react18 = __toModule(require("react"));
1496
+ var import_react19 = __toModule(require("react"));
1462
1497
 
1463
1498
  // src/components/InfiniteTable/hooks/useColumnAggregations.ts
1464
1499
  var import_react12 = __toModule(require("react"));
@@ -1491,44 +1526,53 @@ function useDataSourceActions() {
1491
1526
  var React4 = __toModule(require("react"));
1492
1527
  var import_react11 = __toModule(require("react"));
1493
1528
 
1494
- // src/utils/debug.ts
1495
- var debug = require_browser();
1496
- var debugTable = debug(`InfiniteTable`);
1497
- var dbg = (channelName) => {
1498
- const result = debugTable.extend(channelName);
1499
- result.log = console.log.bind(console);
1500
- return result;
1501
- };
1502
- var err = (channelName) => {
1503
- const result = debugTable.extend(`${channelName}:error`);
1504
- result.log = console.error.bind(console);
1505
- return result;
1506
- };
1507
- var emptyLogFn = () => emptyLogFn;
1508
- emptyLogFn.extend = () => emptyLogFn;
1509
- var Logger = class {
1510
- constructor(channelName) {
1511
- this.debug = emptyLogFn;
1512
- this.error = emptyLogFn;
1513
- if (false) {
1514
- this.debug = dbg(channelName);
1515
- this.error = err(channelName);
1516
- }
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);
1517
1544
  }
1518
- };
1545
+ return {
1546
+ fn: proxiedFn,
1547
+ propertyReads
1548
+ };
1549
+ }
1519
1550
 
1520
1551
  // src/utils/toUpperFirst.ts
1521
1552
  var toUpperFirst = (s) => {
1522
1553
  return s ? s.substr(0, 1).toUpperCase() + s.substr(1) : s;
1523
1554
  };
1524
1555
 
1525
- // 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
1526
1570
  var import_react9 = __toModule(require("react"));
1527
- var useLatest = (value) => {
1571
+ function useLatest(value) {
1528
1572
  const ref = (0, import_react9.useRef)(value);
1529
1573
  ref.current = value;
1530
1574
  return (0, import_react9.useCallback)(() => ref.current, []);
1531
- };
1575
+ }
1532
1576
 
1533
1577
  // src/components/hooks/usePrevious.ts
1534
1578
  var import_react10 = __toModule(require("react"));
@@ -1557,18 +1601,33 @@ function getComponentStateContext() {
1557
1601
  }
1558
1602
  return ComponentContext = (0, import_react11.createContext)(null);
1559
1603
  }
1560
- function getReducerActions(dispatch, state, getProps) {
1604
+ function getReducerActions(dispatch, getState, getProps, propsToForward, allowedControlledPropOverrides) {
1605
+ const state = getState();
1561
1606
  return Object.keys(state).reduce((actions, stateKey) => {
1562
1607
  const key = stateKey;
1563
1608
  const setter = (value) => {
1564
1609
  const props = getProps();
1610
+ const state2 = getState();
1611
+ const currentValue = state2[key];
1612
+ if (currentValue === value) {
1613
+ return;
1614
+ }
1565
1615
  notifyChange(props, stateKey, value);
1566
- 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) {
1567
1622
  return;
1568
1623
  }
1569
1624
  dispatch({
1570
- propertyName: stateKey,
1571
- payload: value
1625
+ payload: {
1626
+ updatedProps: null,
1627
+ mappedState: {
1628
+ [stateKey]: value
1629
+ }
1630
+ }
1572
1631
  });
1573
1632
  };
1574
1633
  Object.defineProperty(actions, stateKey, {
@@ -1577,116 +1636,152 @@ function getReducerActions(dispatch, state, getProps) {
1577
1636
  return actions;
1578
1637
  }, {});
1579
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
+ }
1580
1652
  function getComponentStateRoot(config) {
1581
1653
  return React4.memo(function ComponentStateRoot(props) {
1582
- var _a;
1583
- const getParentState = config.getParentState;
1584
- const parentState = (_a = getParentState == null ? void 0 : getParentState()) != null ? _a : null;
1585
- const [{ state: wholeState, initialState }] = (0, import_react11.useState)(() => {
1586
- let initialState2 = config.getInitialState({
1587
- props,
1588
- parentState
1589
- });
1590
- if (config.deriveReadOnlyState) {
1591
- 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({
1592
1678
  props,
1593
- state: initialState2,
1594
- updated: null,
1679
+ state: state2,
1680
+ oldState: null,
1595
1681
  parentState
1596
1682
  });
1597
- return {
1598
- state: __spreadValues(__spreadValues({}, initialState2), readOnlyState),
1599
- initialState: initialState2,
1600
- readOnlyState
1601
- };
1683
+ return __spreadValues(__spreadValues({}, state2), stateFromProps);
1602
1684
  }
1603
- return {
1604
- initialState: initialState2,
1605
- readOnlyState: {},
1606
- state: initialState2
1607
- };
1685
+ return state2;
1608
1686
  });
1609
1687
  const getProps = useLatest(props);
1610
- const theReducer = (state2, action) => {
1611
- const previousState = state2;
1612
- let newState = null;
1613
- if (action.propertyName) {
1614
- newState = {
1615
- [action.propertyName]: action.payload
1616
- };
1617
- }
1618
- if (action.newControlledProps) {
1619
- newState = action.payload;
1620
- }
1621
- if (newState !== null) {
1622
- state2 = __spreadValues(__spreadValues({}, state2), newState);
1623
- }
1624
- if (config.deriveReadOnlyState) {
1625
- 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({
1626
1709
  props: getProps(),
1627
- state: state2,
1628
- updated: newState,
1629
- parentState
1710
+ state: newState,
1711
+ oldState: previousState,
1712
+ parentState: parentState2
1630
1713
  });
1631
- state2 = __spreadValues(__spreadValues({}, state2), derivedState);
1714
+ Object.assign(newState, stateFromProps);
1632
1715
  }
1633
1716
  const result = config.concludeReducer ? config.concludeReducer({
1634
1717
  previousState,
1635
- state: state2,
1636
- updated: newState,
1637
- parentState
1638
- }) : state2;
1718
+ state: newState,
1719
+ updatedProps,
1720
+ parentState: parentState2
1721
+ }) : newState;
1639
1722
  return result;
1640
1723
  };
1641
1724
  const [state, dispatch] = (0, import_react11.useReducer)(theReducer, wholeState);
1642
- const userDefinedActions = (0, import_react11.useMemo)(() => {
1643
- var _a2, _b;
1644
- return (_b = (_a2 = config.getReducerActions) == null ? void 0 : _a2.call(config, dispatch)) != null ? _b : {};
1645
- }, [dispatch]);
1725
+ const getComponentState = useLatest(state);
1726
+ const { allowedControlledPropOverrides } = config;
1646
1727
  const actions = (0, import_react11.useMemo)(() => {
1647
- const generatedActions = getReducerActions(dispatch, initialState, getProps);
1648
- return Object.assign(generatedActions, userDefinedActions);
1649
- }, [dispatch, userDefinedActions]);
1728
+ const generatedActions = getReducerActions(dispatch, getComponentState, getProps, propsToForward, allowedControlledPropOverrides);
1729
+ return generatedActions;
1730
+ }, [
1731
+ dispatch,
1732
+ propsToForward,
1733
+ allowedControlledPropOverrides
1734
+ ]);
1650
1735
  const Context = getComponentStateContext();
1651
- const getComponentState = useLatest(state);
1652
1736
  const contextValue = (0, import_react11.useMemo)(() => ({
1653
1737
  componentState: state,
1654
1738
  componentActions: actions,
1655
- getComponentState,
1656
- updateStateProperty: (propertyName, propertyValue) => {
1657
- dispatch({
1658
- propertyName,
1659
- payload: propertyValue
1660
- });
1661
- }
1739
+ getComponentState
1662
1740
  }), [state, actions, getComponentState]);
1663
1741
  const prevProps = usePrevious(props);
1664
1742
  (0, import_react11.useEffect)(() => {
1665
1743
  const currentProps = props;
1666
- const updatedStateFromProps = {};
1667
- let updatedCount = 0;
1668
- 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) {
1669
1749
  const key = k;
1670
- if (wholeState.hasOwnProperty(k) && isControlled(key, props)) {
1671
- const oldValue = prevProps[key];
1672
- let newValue = currentProps[key];
1673
- if (oldValue !== newValue) {
1674
- if (config.onControlledPropertyChange) {
1675
- const modifier = config.onControlledPropertyChange(k, newValue, oldValue);
1676
- if (typeof modifier === "function") {
1677
- newValue = modifier(newValue, oldValue);
1678
- }
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++;
1679
1768
  }
1680
- updatedStateFromProps[key] = newValue;
1681
- updatedCount++;
1769
+ } else if (propsToStateSetRef.current.has(k)) {
1770
+ updatedProps[key] = currentProps[key];
1771
+ updatedPropsCount++;
1682
1772
  }
1683
1773
  }
1684
1774
  }
1685
- if (updatedCount > 0) {
1686
- 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
+ ]);
1687
1780
  dispatch({
1688
- newControlledProps: true,
1689
- payload: updatedStateFromProps
1781
+ payload: {
1782
+ mappedState: newMappedStateCount ? newMappedState : null,
1783
+ updatedProps: updatedPropsCount ? updatedProps : null
1784
+ }
1690
1785
  });
1691
1786
  }
1692
1787
  });
@@ -1713,7 +1808,7 @@ function useColumnAggregations() {
1713
1808
  const componentState = getComponentState();
1714
1809
  columnAggregations.forEach((aggregator, key) => {
1715
1810
  var _a;
1716
- 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;
1717
1812
  const newAggregator = __spreadValues({
1718
1813
  getter: (data) => colField ? data[colField] : data
1719
1814
  }, aggregator);
@@ -1796,66 +1891,349 @@ function useColumnGroups() {
1796
1891
  }, [collapsedColumnGroups]);
1797
1892
  }
1798
1893
 
1799
- // src/components/InfiniteTable/hooks/useGeneratedGroupAndPivotColumns.ts
1800
- var import_react17 = __toModule(require("react"));
1894
+ // src/components/InfiniteTable/hooks/useColumnsWhen.ts
1895
+ var import_react18 = __toModule(require("react"));
1801
1896
 
1802
- // src/components/DataSource/index.tsx
1803
- var React6 = __toModule(require("react"));
1897
+ // src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
1898
+ var React7 = __toModule(require("react"));
1804
1899
 
1805
- // 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"));
1806
1905
  var import_react14 = __toModule(require("react"));
1807
1906
 
1808
- // src/components/DataSource/privateHooks/buildDataSourceDataInfo.ts
1809
- function buildDataSourceDataInfo(dataParam) {
1810
- let dataArray = [];
1811
- if (Array.isArray(dataParam.data)) {
1812
- dataArray = dataParam.data;
1813
- } else {
1814
- 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)`;
1815
1932
  }
1816
- return {
1817
- 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
+ }
1818
1939
  };
1819
- }
1820
-
1821
- // src/components/DataSource/privateHooks/loadDataAsync.ts
1822
- function loadDataAsync(data) {
1823
- return __async(this, null, function* () {
1824
- if (typeof data === "function") {
1825
- data = data();
1940
+ React6.useEffect(() => {
1941
+ if (isControlled("expanded", props)) {
1942
+ setExpanded(props.expanded);
1826
1943
  }
1827
- return buildDataSourceDataInfo(yield data);
1828
- });
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
+ }));
1829
1957
  }
1830
1958
 
1831
- // src/components/DataSource/privateHooks/useLoadData.ts
1832
- function buildDataSourceInfo(data) {
1833
- return { originalDataArray: data };
1834
- }
1835
- function useLoadData() {
1959
+ // src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
1960
+ function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params) {
1961
+ if (!pivotColumns) {
1962
+ return void 0;
1963
+ }
1836
1964
  const {
1837
- componentActions: actions,
1838
- componentState: { data }
1839
- } = useComponentState();
1840
- const loadData = (data2) => {
1841
- let dataSourceInfo = {
1842
- originalDataArray: []
1843
- };
1844
- if (typeof data2 === "function") {
1845
- 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;
1846
1976
  }
1847
- if (Array.isArray(data2)) {
1848
- dataSourceInfo = buildDataSourceInfo(data2);
1849
- actions.originalDataArray = dataSourceInfo.originalDataArray;
1850
- } else {
1851
- actions.loading = true;
1852
- loadDataAsync(data2).then((dataSourceInfo2) => {
1853
- 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;
1854
2232
  actions.loading = false;
1855
2233
  });
1856
2234
  }
1857
2235
  };
1858
- (0, import_react14.useLayoutEffect)(() => {
2236
+ (0, import_react15.useLayoutEffect)(() => {
1859
2237
  loadData(data);
1860
2238
  }, [data]);
1861
2239
  }
@@ -1867,7 +2245,7 @@ var normalizeSortInfo = (sortInfo) => {
1867
2245
  };
1868
2246
 
1869
2247
  // src/components/hooks/useOnce.ts
1870
- var import_react15 = __toModule(require("react"));
2248
+ var import_react16 = __toModule(require("react"));
1871
2249
  function once(fn) {
1872
2250
  let called = false;
1873
2251
  let result = null;
@@ -1882,7 +2260,7 @@ function once(fn) {
1882
2260
  return onceFn;
1883
2261
  }
1884
2262
  function useOnce(fn) {
1885
- const onceFn = (0, import_react15.useMemo)(() => {
2263
+ const onceFn = (0, import_react16.useMemo)(() => {
1886
2264
  return once(fn);
1887
2265
  }, []);
1888
2266
  return onceFn();
@@ -2244,47 +2622,51 @@ var GroupRowsState = class {
2244
2622
  };
2245
2623
 
2246
2624
  // src/components/DataSource/state/getInitialState.ts
2247
- function getInitialState2(params) {
2248
- var _a, _b, _c, _d, _e;
2249
- const { props: initialProps } = params;
2250
- const dataArray = [];
2251
- const originalDataArray = [];
2252
- const sortInfo = normalizeSortInfo(isControlled("sortInfo", initialProps) ? initialProps.sortInfo : initialProps.defaultSortInfo);
2253
- const groupRowsState = initialProps.groupRowsState || initialProps.defaultGroupRowsState || new GroupRowsState({
2254
- expandedRows: true,
2255
- collapsedRows: []
2256
- });
2625
+ function initSetupState2() {
2257
2626
  const now = Date.now();
2627
+ const originalDataArray = [];
2628
+ const dataArray = [];
2258
2629
  return {
2259
- data: initialProps.data,
2260
- loading: (_b = (_a = initialProps.loading) != null ? _a : initialProps.defaultLoading) != null ? _b : false,
2261
- dataArray,
2630
+ pivotTotalColumnPosition: "end",
2262
2631
  originalDataArray,
2263
- sortInfo,
2264
- groupRowsState,
2632
+ pivotColumns: void 0,
2633
+ pivotColumnGroups: void 0,
2634
+ dataArray,
2265
2635
  updatedAt: now,
2266
2636
  groupedAt: 0,
2267
2637
  sortedAt: 0,
2268
2638
  reducedAt: now,
2269
- pivotColumns: void 0,
2270
- pivotColumnGroups: void 0,
2271
- groupRowsBy: isControlled("groupRowsBy", initialProps) ? (_c = initialProps.groupRowsBy) != null ? _c : [] : (_d = initialProps.defaultGroupRowsBy) != null ? _d : [],
2272
- pivotBy: isControlled("pivotBy", initialProps) ? (_e = initialProps.pivotBy) != null ? _e : [] : initialProps.defaultPivotBy,
2639
+ generateGroupRows: true,
2273
2640
  aggregationReducers: void 0,
2274
- pivotTotalColumnPosition: "end"
2641
+ groupDeepMap: void 0,
2642
+ postSortDataArray: void 0,
2643
+ postGroupDataArray: void 0,
2644
+ lastSortDataArray: void 0,
2645
+ lastGroupDataArray: void 0
2275
2646
  };
2276
2647
  }
2277
- 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) {
2278
2666
  var _a;
2279
- const { props, state } = params;
2280
- const sortInfo = isControlled("sortInfo", props) ? props.sortInfo : (_a = props.defaultSortInfo) != null ? _a : null;
2667
+ const { props } = params;
2281
2668
  return {
2282
- multiSort: Array.isArray(sortInfo),
2283
- sortInfo: normalizeSortInfo(state.sortInfo),
2284
- primaryKey: props.primaryKey,
2285
- groupDeepMap: void 0,
2286
- postSortDataArray: void 0,
2287
- postGroupDataArray: void 0
2669
+ multiSort: Array.isArray((_a = props.sortInfo) != null ? _a : props.defaultSortInfo)
2288
2670
  };
2289
2671
  }
2290
2672
 
@@ -2488,7 +2870,7 @@ function flatten(groupResult) {
2488
2870
  return result;
2489
2871
  }
2490
2872
  function getEnhancedGroupData(options, deepMapValue) {
2491
- const { groupBy, groupKeys, collapsed } = options;
2873
+ const { groupBy, groupKeys, collapsed, parents } = options;
2492
2874
  const groupNesting = groupKeys.length;
2493
2875
  const { items: groupItems, reducerResults, pivotDeepMap } = deepMapValue;
2494
2876
  const enhancedGroupData = {
@@ -2498,6 +2880,10 @@ function getEnhancedGroupData(options, deepMapValue) {
2498
2880
  groupKeys,
2499
2881
  id: groupKeys,
2500
2882
  collapsed,
2883
+ parents,
2884
+ collapsedChildrenCount: 0,
2885
+ collapsedGroupsCount: 0,
2886
+ indexInParentGroups: options.indexInParentGroups,
2501
2887
  indexInGroup: options.indexInGroup,
2502
2888
  indexInAll: options.indexInAll,
2503
2889
  value: groupKeys[groupKeys.length - 1],
@@ -2519,12 +2905,14 @@ function completeReducers(reducers, reducerResults, items) {
2519
2905
  }
2520
2906
  return reducerResults;
2521
2907
  }
2522
- function enhancedFlatten(groupResult, toPrimaryKey, groupRowsState) {
2908
+ function enhancedFlatten(param) {
2909
+ const { groupResult, toPrimaryKey, groupRowsState, generateGroupRows } = param;
2523
2910
  const { groupParams, deepMap, pivot } = groupResult;
2524
2911
  const { groupBy } = groupParams;
2525
2912
  const groupByStrings = groupBy.map((g) => g.field);
2526
2913
  const result = [];
2527
2914
  const parents = [];
2915
+ const indexInParentGroups = [];
2528
2916
  deepMap.visitDepthFirst((deepMapValue, groupKeys, indexInGroup, next) => {
2529
2917
  var _a;
2530
2918
  const items = deepMapValue.items;
@@ -2532,12 +2920,24 @@ function enhancedFlatten(groupResult, toPrimaryKey, groupRowsState) {
2532
2920
  const collapsed = (_a = groupRowsState == null ? void 0 : groupRowsState.isGroupRowCollapsed(groupKeys)) != null ? _a : false;
2533
2921
  const enhancedGroupData = getEnhancedGroupData({
2534
2922
  groupBy: groupByStrings,
2923
+ parents: Array.from(parents),
2535
2924
  indexInGroup,
2925
+ indexInParentGroups: Array.from(indexInParentGroups),
2536
2926
  indexInAll: result.length,
2537
2927
  groupKeys,
2538
2928
  collapsed
2539
2929
  }, deepMapValue);
2540
- 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);
2541
2941
  parents.push(enhancedGroupData);
2542
2942
  if (!collapsed) {
2543
2943
  if (!next) {
@@ -2549,11 +2949,14 @@ function enhancedFlatten(groupResult, toPrimaryKey, groupRowsState) {
2549
2949
  data: item,
2550
2950
  isGroupRow: false,
2551
2951
  collapsed: false,
2552
- parentGroupKeys: groupKeys,
2952
+ groupKeys,
2953
+ parents: Array.from(parents),
2954
+ indexInParentGroups: [...indexInParentGroups, index],
2553
2955
  indexInGroup: index,
2554
2956
  indexInAll: startIndex + index,
2555
2957
  groupBy: groupByStrings,
2556
- groupNesting
2958
+ groupNesting,
2959
+ groupCount: enhancedGroupData.groupCount
2557
2960
  };
2558
2961
  }));
2559
2962
  }
@@ -2562,6 +2965,7 @@ function enhancedFlatten(groupResult, toPrimaryKey, groupRowsState) {
2562
2965
  }
2563
2966
  }
2564
2967
  parents.pop();
2968
+ indexInParentGroups.pop();
2565
2969
  });
2566
2970
  return {
2567
2971
  data: result
@@ -2576,8 +2980,8 @@ function getPivotColumnsAndColumnGroups(deepMap, pivotBy, pivotTotalColumnPositi
2576
2980
  header: "Row labels",
2577
2981
  valueGetter: (params) => {
2578
2982
  var _a;
2579
- const { enhancedData } = params;
2580
- 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;
2581
2985
  }
2582
2986
  }
2583
2987
  ]
@@ -2598,9 +3002,9 @@ function getPivotColumnsAndColumnGroups(deepMap, pivotBy, pivotTotalColumnPositi
2598
3002
  sortable: false,
2599
3003
  columnGroup: parentKeys.length ? `${columnGroupId}` : void 0,
2600
3004
  header: keys[keys.length - 1],
2601
- valueGetter: ({ enhancedData }) => {
3005
+ valueGetter: ({ rowInfo }) => {
2602
3006
  var _a, _b, _c;
2603
- 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;
2604
3008
  return value;
2605
3009
  }
2606
3010
  });
@@ -2619,9 +3023,9 @@ function getPivotColumnsAndColumnGroups(deepMap, pivotBy, pivotTotalColumnPositi
2619
3023
  pivotGroupKeys: keys,
2620
3024
  pivotBy,
2621
3025
  sortable: false,
2622
- valueGetter: ({ enhancedData }) => {
3026
+ valueGetter: ({ rowInfo }) => {
2623
3027
  var _a, _b, _c;
2624
- 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;
2625
3029
  return value;
2626
3030
  }
2627
3031
  });
@@ -2634,9 +3038,9 @@ function getPivotColumnsAndColumnGroups(deepMap, pivotBy, pivotTotalColumnPositi
2634
3038
  if (columns.size === 1) {
2635
3039
  columns.set("single", {
2636
3040
  header: "Reduced",
2637
- valueGetter: ({ enhancedData }) => {
3041
+ valueGetter: ({ rowInfo }) => {
2638
3042
  var _a;
2639
- return (_a = enhancedData.reducerResults) == null ? void 0 : _a[0];
3043
+ return (_a = rowInfo.reducerResults) == null ? void 0 : _a[0];
2640
3044
  }
2641
3045
  });
2642
3046
  }
@@ -2648,26 +3052,26 @@ function getPivotColumnsAndColumnGroups(deepMap, pivotBy, pivotTotalColumnPositi
2648
3052
  }
2649
3053
 
2650
3054
  // src/components/DataSource/state/reducer.ts
2651
- var haveDepsChanged = (updated, deps) => {
2652
- if (!updated) {
2653
- return false;
2654
- }
2655
- for (var i = 0, len = deps.length; i < len; i++) {
2656
- 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) {
2657
3061
  return true;
2658
3062
  }
2659
3063
  }
2660
3064
  return false;
2661
3065
  };
2662
- function toEnhancedData(data, id, index) {
3066
+ function toRowInfo(data, id, index) {
2663
3067
  return { data, collapsed: true, id, indexInAll: index, indexInGroup: index };
2664
3068
  }
2665
3069
  function concludeReducer(params) {
2666
3070
  var _a;
2667
- const { state, previousState, updated } = params;
3071
+ const { state, previousState } = params;
2668
3072
  const sortInfo = state.sortInfo;
2669
- const shouldSort = sortInfo == null ? void 0 : sortInfo.length;
2670
- const sortDepsChanged = haveDepsChanged(updated, [
3073
+ const shouldSort = !!(sortInfo == null ? void 0 : sortInfo.length);
3074
+ const sortDepsChanged = haveDepsChanged(previousState, state, [
2671
3075
  "originalDataArray",
2672
3076
  "sortInfo"
2673
3077
  ]);
@@ -2675,7 +3079,8 @@ function concludeReducer(params) {
2675
3079
  const groupBy = state.groupRowsBy;
2676
3080
  const pivotBy = state.pivotBy;
2677
3081
  const shouldGroup = groupBy.length || pivotBy;
2678
- const groupsDepsChanged = haveDepsChanged(updated, [
3082
+ const groupsDepsChanged = haveDepsChanged(previousState, state, [
3083
+ "generateGroupRows",
2679
3084
  "originalDataArray",
2680
3085
  "groupRowsBy",
2681
3086
  "groupRowsState",
@@ -2687,7 +3092,7 @@ function concludeReducer(params) {
2687
3092
  const shouldGroupAgain = shouldGroup && (groupsDepsChanged || !state.lastGroupDataArray);
2688
3093
  const now = Date.now();
2689
3094
  let dataArray = state.originalDataArray;
2690
- let enhancedDataArray = state.dataArray;
3095
+ let rowInfoDataArray = state.dataArray;
2691
3096
  if (shouldSort) {
2692
3097
  dataArray = shouldSortAgain ? multisort(sortInfo, [...dataArray]) : state.lastSortDataArray;
2693
3098
  state.lastSortDataArray = dataArray;
@@ -2705,30 +3110,35 @@ function concludeReducer(params) {
2705
3110
  pivot: pivotBy,
2706
3111
  reducers: state.aggregationReducers
2707
3112
  }, dataArray);
2708
- const flattenResult = enhancedFlatten(groupResult, toPrimaryKey, state.groupRowsState);
2709
- enhancedDataArray = flattenResult.data;
3113
+ const flattenResult = enhancedFlatten({
3114
+ groupResult,
3115
+ toPrimaryKey,
3116
+ groupRowsState: state.groupRowsState,
3117
+ generateGroupRows: state.generateGroupRows
3118
+ });
3119
+ rowInfoDataArray = flattenResult.data;
2710
3120
  state.groupDeepMap = groupResult.deepMap;
2711
3121
  const pivotGroupsAndCols = pivotBy ? getPivotColumnsAndColumnGroups(groupResult.topLevelPivotColumns, pivotBy, (_a = state.pivotTotalColumnPosition) != null ? _a : "end") : void 0;
2712
3122
  state.pivotColumns = pivotGroupsAndCols == null ? void 0 : pivotGroupsAndCols.columns;
2713
3123
  state.pivotColumnGroups = pivotGroupsAndCols == null ? void 0 : pivotGroupsAndCols.columnGroups;
2714
3124
  } else {
2715
- enhancedDataArray = state.lastGroupDataArray;
3125
+ rowInfoDataArray = state.lastGroupDataArray;
2716
3126
  }
2717
- state.lastGroupDataArray = enhancedDataArray;
3127
+ state.lastGroupDataArray = rowInfoDataArray;
2718
3128
  state.groupedAt = now;
2719
3129
  } else {
2720
3130
  state.groupDeepMap = void 0;
2721
3131
  state.pivotColumns = void 0;
2722
3132
  const arrayDifferentAfterSortStep = previousState.postSortDataArray != state.postSortDataArray;
2723
3133
  if (arrayDifferentAfterSortStep) {
2724
- enhancedDataArray = dataArray.map((data, index) => toEnhancedData(data, toPrimaryKey(data), index));
3134
+ rowInfoDataArray = dataArray.map((data, index) => toRowInfo(data, toPrimaryKey(data), index));
2725
3135
  }
2726
3136
  }
2727
- state.postGroupDataArray = enhancedDataArray;
2728
- if (enhancedDataArray !== state.dataArray) {
3137
+ state.postGroupDataArray = rowInfoDataArray;
3138
+ if (rowInfoDataArray !== state.dataArray) {
2729
3139
  state.updatedAt = now;
2730
3140
  }
2731
- state.dataArray = enhancedDataArray;
3141
+ state.dataArray = rowInfoDataArray;
2732
3142
  state.reducedAt = now;
2733
3143
  globalThis.state = state;
2734
3144
  return state;
@@ -2747,12 +3157,13 @@ function DataSourceWithContext(props) {
2747
3157
  if (typeof children === "function") {
2748
3158
  children = children(computedValues);
2749
3159
  }
2750
- return /* @__PURE__ */ React6.createElement(React6.Fragment, null, children);
3160
+ return /* @__PURE__ */ React9.createElement(React9.Fragment, null, children);
2751
3161
  }
2752
3162
  var DataSourceRoot = getComponentStateRoot({
2753
- getInitialState: getInitialState2,
3163
+ initSetupState: initSetupState2,
3164
+ forwardProps: forwardProps3,
2754
3165
  concludeReducer,
2755
- deriveReadOnlyState: deriveReadOnlyState2
3166
+ mapPropsToState: mapPropsToState2
2756
3167
  });
2757
3168
  function DataSourceCmp({ children }) {
2758
3169
  const DataSourceContext = getDataSourceContext();
@@ -2763,445 +3174,319 @@ function DataSourceCmp({ children }) {
2763
3174
  componentActions,
2764
3175
  getState
2765
3176
  };
3177
+ if (false) {
3178
+ globalThis.getDataSourceState = getState;
3179
+ }
2766
3180
  useLoadData();
2767
- return /* @__PURE__ */ React6.createElement(DataSourceContext.Provider, {
3181
+ return /* @__PURE__ */ React9.createElement(DataSourceContext.Provider, {
2768
3182
  value: contextValue
2769
- }, /* @__PURE__ */ React6.createElement(DataSourceWithContext, {
3183
+ }, /* @__PURE__ */ React9.createElement(DataSourceWithContext, {
2770
3184
  children
2771
3185
  }));
2772
3186
  }
2773
3187
  function DataSource(props) {
2774
- return /* @__PURE__ */ React6.createElement(DataSourceRoot, __spreadValues({}, props), /* @__PURE__ */ React6.createElement(DataSourceCmp, {
3188
+ return /* @__PURE__ */ React9.createElement(DataSourceRoot, __spreadValues({}, props), /* @__PURE__ */ React9.createElement(DataSourceCmp, {
2775
3189
  children: props.children
2776
3190
  }));
2777
3191
  }
2778
3192
 
2779
- // src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
2780
- var React8 = __toModule(require("react"));
2781
-
2782
- // src/style/utilities.ts
2783
- var rule = (name, value) => `it__${name}=${value}`;
2784
- var ICSS = {
2785
- variables: {
2786
- space: [
2787
- "--it-space-0",
2788
- "--it-space-1",
2789
- "--it-space-2",
2790
- "--it-space-3",
2791
- "--it-space-4",
2792
- "--it-space-5",
2793
- "--it-space-6",
2794
- "--it-space-7",
2795
- "--it-space-8",
2796
- "--it-space-9",
2797
- "--it-space-10"
2798
- ],
2799
- borderRadius: "--it__border-radius",
2800
- fontSize: [
2801
- "--it-font-size-0",
2802
- "--it-font-size-1",
2803
- "--it-font-size-2",
2804
- "--it-font-size-3",
2805
- "--it-font-size-4",
2806
- "--it-font-size-5",
2807
- "--it-font-size-6",
2808
- "--it-font-size-7"
2809
- ]
2810
- },
2811
- alignItems: {
2812
- center: rule("align-items", "center"),
2813
- stretch: rule("align-items", "stretch")
2814
- },
2815
- justifyContent: {
2816
- center: rule("justify-content", "center"),
2817
- "flex-start": rule("justify-content", "flex-start"),
2818
- flexStart: rule("justify-content", "flex-start"),
2819
- "flex-end": rule("justify-content", "flex-end"),
2820
- flexEnd: rule("justify-content", "flex-end")
2821
- },
2822
- overflow: {
2823
- hidden: rule("overflow", "hidden"),
2824
- visible: rule("overflow", "visible"),
2825
- auto: rule("overflow", "auto")
2826
- },
2827
- overflowX: {
2828
- hidden: rule("overflow-x", "hidden"),
2829
- visible: rule("overflow-x", "visible"),
2830
- auto: rule("overflow-x", "auto")
2831
- },
2832
- overflowY: {
2833
- hidden: rule("overflow-y", "hidden"),
2834
- visible: rule("overflow-y", "visible"),
2835
- auto: rule("overflow-y", "auto")
2836
- },
2837
- cursor: {
2838
- pointer: rule("cursor", "pointer")
2839
- },
2840
- height: {
2841
- 0: rule("height", "0"),
2842
- "100%": rule("height", "100%")
2843
- },
2844
- width: {
2845
- 0: rule("width", "0"),
2846
- "100%": rule("width", "100%")
2847
- },
2848
- top: {
2849
- 0: rule("top", "0"),
2850
- "100%": rule("top", "100%")
2851
- },
2852
- left: {
2853
- 0: rule("left", "0"),
2854
- "100%": rule("left", "100%")
2855
- },
2856
- transform: {
2857
- translate3D000: rule("transform", "translate3D000")
2858
- },
2859
- willChange: {
2860
- transform: rule("will-change", "transform")
2861
- },
2862
- position: {
2863
- relative: rule("position", "relative"),
2864
- absolute: rule("position", "absolute"),
2865
- fixed: rule("position", "fixed")
2866
- },
2867
- display: {
2868
- flex: rule("display", "flex")
2869
- },
2870
- flexFlow: {
2871
- row: rule("flex-flow", "row"),
2872
- column: rule("flex-flow", "column")
2873
- },
2874
- whiteSpace: {
2875
- nowrap: rule("white-space", "nowrap")
2876
- },
2877
- textOverflow: {
2878
- ellipsis: rule("text-overflow", "ellipsis")
2879
- },
2880
- userSelect: {
2881
- none: rule("user-select", "none")
2882
- }
2883
- };
2884
-
2885
- // src/style/css.ts
2886
- var cssEllipsisClassName = `${ICSS.whiteSpace.nowrap} ${ICSS.textOverflow.ellipsis} ${ICSS.overflow.hidden}`;
2887
-
2888
- // src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
2889
- var React7 = __toModule(require("react"));
2890
- var import_react16 = __toModule(require("react"));
2891
- function ExpanderIcon(props) {
2892
- var _a;
2893
- const { size = 24 } = props;
2894
- const style = __spreadValues({}, props.style);
2895
- const [expanded, setExpanded] = (0, import_react16.useState)((_a = props.expanded) != null ? _a : props.defaultExpanded);
2896
- if (expanded) {
2897
- style.transform = `rotate(90deg)`;
2898
- }
2899
- const onClick = () => {
2900
- var _a2;
2901
- (_a2 = props.onChange) == null ? void 0 : _a2.call(props, !expanded);
2902
- if (!isControlled("expanded", props)) {
2903
- setExpanded(!expanded);
2904
- }
2905
- };
2906
- React7.useEffect(() => {
2907
- if (isControlled("expanded", props)) {
2908
- setExpanded(props.expanded);
2909
- }
2910
- }, [props.expanded]);
2911
- return /* @__PURE__ */ React7.createElement("svg", {
2912
- "data-name": "expander-icon",
2913
- xmlns: "http://www.w3.org/2000/svg",
2914
- height: `${size}px`,
2915
- viewBox: "0 0 24 24",
2916
- width: `${size}px`,
2917
- style,
2918
- onClick,
2919
- className: join(props.className, "ITableIcon", "ITableIcon-expander", `ITableIcon-expander--${expanded ? "expanded" : "collapsed"}`)
2920
- }, /* @__PURE__ */ React7.createElement("path", {
2921
- d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"
2922
- }));
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;
2923
3202
  }
2924
3203
 
2925
- // src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
2926
- function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params) {
2927
- if (!pivotColumns) {
2928
- return void 0;
2929
- }
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() {
2930
3218
  const {
2931
- pivotColumn,
2932
- pivotRowLabelsColumn,
2933
- pivotBy,
2934
- groupRowsBy,
2935
- pivotTotalColumnPosition,
2936
- toggleGroupRow
2937
- } = params;
2938
- const computedPivotColumns = new Map();
2939
- pivotColumns.forEach((col, key) => {
2940
- if (col.pivotTotalColumn && pivotTotalColumnPosition === false) {
2941
- return;
2942
- }
2943
- let column = __spreadValues({}, col);
2944
- if (pivotColumn) {
2945
- if (typeof pivotColumn === "function") {
2946
- column = __spreadValues(__spreadValues({}, column), pivotColumn({
2947
- column,
2948
- pivotBy,
2949
- groupRowsBy
2950
- }));
2951
- } else {
2952
- column = __spreadValues(__spreadValues({}, column), pivotColumn);
2953
- }
2954
- }
2955
- const isPivotRowLabelsColumn = !column.pivotColumn && !column.pivotTotalColumn;
2956
- if (pivotRowLabelsColumn && isPivotRowLabelsColumn) {
2957
- if (typeof pivotRowLabelsColumn === "function") {
2958
- column = __spreadValues(__spreadValues({}, column), pivotRowLabelsColumn({
2959
- column,
2960
- pivotBy,
2961
- groupRowsBy
2962
- }));
2963
- } else {
2964
- column = __spreadValues(__spreadValues({}, column), pivotRowLabelsColumn);
2965
- }
2966
- }
2967
- if (isPivotRowLabelsColumn && !column.render) {
2968
- column.render = (renderOptions) => {
2969
- var _a;
2970
- let { value, enhancedData, column: column2, groupRowsBy: groupRowsBy2 } = renderOptions;
2971
- if (column2.renderValue) {
2972
- value = column2.renderValue(renderOptions);
2973
- }
2974
- const showExpanderIcon = (((_a = enhancedData.groupKeys) == null ? void 0 : _a.length) || 0) < groupRowsBy2.length;
2975
- return /* @__PURE__ */ React8.createElement("div", {
2976
- className: join(ICSS.display.flex, ICSS.alignItems.center),
2977
- style: {
2978
- paddingInlineStart: `calc(${enhancedData.groupNesting - 1} * var(--ITableRow-group-column-nesting))`
2979
- }
2980
- }, showExpanderIcon ? /* @__PURE__ */ React8.createElement(ExpanderIcon, {
2981
- expanded: !enhancedData.collapsed,
2982
- onChange: () => {
2983
- toggleGroupRow(enhancedData.groupKeys);
2984
- }
2985
- }) : null, /* @__PURE__ */ React8.createElement("div", {
2986
- className: cssEllipsisClassName
2987
- }, value != null ? value : null));
2988
- };
2989
- }
2990
- if (!column.render && column.renderValue) {
2991
- column.render = (renderOptions) => {
2992
- return column.renderValue(renderOptions);
2993
- };
2994
- }
2995
- computedPivotColumns.set(key, column);
2996
- });
2997
- 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);
2998
3236
  }
2999
-
3000
- // src/components/InfiniteTable/utils/getColumnForGroupBy.tsx
3001
- var React9 = __toModule(require("react"));
3002
- function getColumnForGroupBy(options, toggleGroupRow, groupColumnFromProps) {
3003
- const { groupBy, groupIndex } = options;
3004
- let generatedGroupColumn = __spreadValues({
3005
- header: `Group by ${groupBy.field}`,
3006
- groupByField: groupBy.field,
3007
- sortable: false,
3008
- render: (renderOptions) => {
3009
- let { value, enhancedData, column } = renderOptions;
3010
- if (!enhancedData.isGroupRow) {
3011
- return null;
3012
- }
3013
- if (groupIndex + 1 !== enhancedData.groupNesting) {
3014
- return null;
3015
- }
3016
- if (column.renderValue) {
3017
- 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
+ };
3018
3286
  }
3019
- return /* @__PURE__ */ React9.createElement("div", {
3020
- className: join(ICSS.display.flex, ICSS.alignItems.center)
3021
- }, /* @__PURE__ */ React9.createElement(ExpanderIcon, {
3022
- expanded: !enhancedData.collapsed,
3023
- onChange: () => {
3024
- toggleGroupRow(enhancedData.groupKeys);
3025
- }
3026
- }), /* @__PURE__ */ React9.createElement("div", {
3027
- className: cssEllipsisClassName
3028
- }, value != null ? value : null));
3029
- }
3030
- }, groupBy.column);
3031
- if (groupColumnFromProps) {
3032
- if (typeof groupColumnFromProps === "function") {
3033
- generatedGroupColumn = __spreadValues(__spreadValues({}, generatedGroupColumn), groupColumnFromProps(options, toggleGroupRow));
3034
- } else {
3035
- generatedGroupColumn = __spreadValues(__spreadValues({}, generatedGroupColumn), groupColumnFromProps);
3036
- }
3287
+ const clone = __spreadValues(__spreadValues({}, base), column);
3288
+ computedColumns.set(id, clone);
3289
+ });
3290
+ return computedColumns.size === 0 ? void 0 : computedColumns;
3037
3291
  }
3038
- 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]);
3039
3303
  }
3040
- function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
3041
- let generatedGroupColumn = {
3042
- header: `Group`,
3043
- groupByField: options.groupRowsBy.map((g) => g.field),
3044
- sortable: false,
3045
- render: (renderOptions) => {
3046
- let { value, enhancedData, column } = renderOptions;
3047
- if (!enhancedData.isGroupRow) {
3048
- return null;
3049
- }
3050
- if (column.renderValue) {
3051
- value = column.renderValue(renderOptions);
3052
- }
3053
- return /* @__PURE__ */ React9.createElement("div", {
3054
- className: join(ICSS.display.flex, ICSS.alignItems.center),
3055
- style: {
3056
- paddingInlineStart: `calc(${enhancedData.groupNesting - 1} * var(--ITableRow-group-column-nesting))`
3057
- }
3058
- }, /* @__PURE__ */ React9.createElement(ExpanderIcon, {
3059
- expanded: !enhancedData.collapsed,
3060
- onChange: () => {
3061
- toggleGroupRow(enhancedData.groupKeys);
3062
- }
3063
- }), /* @__PURE__ */ React9.createElement("div", {
3064
- className: cssEllipsisClassName
3065
- }, value != null ? value : null));
3066
- }
3067
- };
3068
- if (groupColumnFromProps) {
3069
- if (typeof groupColumnFromProps === "function") {
3070
- generatedGroupColumn = __spreadValues(__spreadValues({}, generatedGroupColumn), groupColumnFromProps(options, toggleGroupRow));
3071
- } else {
3072
- 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
3073
3315
  }
3074
- }
3075
- 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]);
3076
3329
  }
3077
-
3078
- // src/components/InfiniteTable/hooks/useGeneratedGroupAndPivotColumns.ts
3079
- function getGroupRenderStrategy(options) {
3080
- const { groupRowsBy, groupColumn, groupRenderStrategy } = options;
3081
- if (groupRenderStrategy) {
3082
- return groupRenderStrategy;
3083
- }
3084
- if (groupColumn != null && typeof groupColumn === "object") {
3085
- return "single-column";
3086
- }
3087
- const columnsInGroupRowsBy = groupRowsBy.filter((g) => g.column);
3088
- if (columnsInGroupRowsBy.length) {
3089
- return "multi-column";
3090
- }
3091
- 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]);
3092
3360
  }
3093
- function useGeneratedGroupAndPivotColumns() {
3361
+ function useHideEmptyGroupColumns(groupRowsMap) {
3094
3362
  const {
3095
- componentState: { groupRowsBy, pivotBy },
3096
- getState: getDataSourceState,
3097
- componentActions: dataSourceActions
3363
+ componentState: { groupRowsBy, groupRowsState },
3364
+ getState: getDataSourceState
3098
3365
  } = useDataSourceContextValue();
3099
3366
  const {
3100
3367
  getComponentState,
3101
3368
  componentActions,
3102
3369
  componentState: {
3103
- groupColumn,
3104
- groupRenderStrategy,
3105
- pivotColumn,
3106
- pivotRowLabelsColumn,
3107
- pivotColumns,
3108
- pivotTotalColumnPosition
3370
+ columnsWhenGrouping: generatedColumns,
3371
+ hideEmptyGroupColumns,
3372
+ groupRenderStrategy
3109
3373
  }
3110
3374
  } = useComponentState();
3111
- const toggleGroupRow = (0, import_react17.useCallback)((groupKeys) => {
3112
- const newState = new GroupRowsState(getDataSourceState().groupRowsState);
3113
- newState.toggleGroupRow(groupKeys);
3114
- dataSourceActions.groupRowsState = newState;
3115
- }, []);
3116
- (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
+ }
3117
3390
  const currentState = getComponentState();
3118
- if (pivotColumns) {
3119
- if (currentState.generatedColumns.size) {
3120
- 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);
3121
3407
  }
3122
- return;
3123
- }
3124
- componentActions.generatedColumns = getGeneratedGroupColumns({
3125
- groupColumn,
3126
- groupRenderStrategy,
3127
- groupRowsBy,
3128
- pivotColumns,
3129
- toggleGroupRow
3130
- });
3131
- }, [groupRowsBy, groupColumn, groupRenderStrategy, pivotColumns]);
3132
- (0, import_react17.useEffect)(() => {
3133
- dataSourceActions.pivotTotalColumnPosition = pivotTotalColumnPosition;
3134
- }, [pivotTotalColumnPosition]);
3135
- (0, import_react17.useEffect)(() => {
3136
- const computedPivotColumns = getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, {
3137
- pivotColumn,
3138
- pivotRowLabelsColumn,
3139
- pivotTotalColumnPosition,
3140
- pivotBy,
3141
- groupRowsBy,
3142
- toggleGroupRow
3143
3408
  });
3144
- componentActions.computedPivotColumns = computedPivotColumns;
3145
- }, [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
+ ]);
3146
3421
  }
3147
- function getGeneratedGroupColumns(params) {
3422
+ function getColumnsWhenGrouping(params) {
3148
3423
  const {
3149
3424
  pivotColumns,
3150
3425
  groupRowsBy,
3151
3426
  groupColumn,
3152
3427
  groupRenderStrategy,
3153
- toggleGroupRow
3428
+ toggleGroupRow,
3429
+ columns
3154
3430
  } = params;
3155
- const generatedColumns = new Map();
3156
3431
  if (pivotColumns) {
3157
- return generatedColumns;
3432
+ return void 0;
3158
3433
  }
3159
- const strategy = getGroupRenderStrategy({
3160
- groupRowsBy,
3161
- groupColumn,
3162
- groupRenderStrategy
3163
- });
3434
+ if (groupRenderStrategy === "inline") {
3435
+ return void 0;
3436
+ }
3437
+ const computedColumns = new Map();
3164
3438
  if (groupRenderStrategy === "multi-column") {
3165
3439
  groupRowsBy.forEach((groupBy, index, arr) => {
3166
- 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));
3167
3447
  });
3168
- } else if (strategy === "single-column") {
3169
- generatedColumns.set("group-by", getSingleGroupColumn({
3448
+ } else if (groupRenderStrategy === "single-column") {
3449
+ computedColumns.set("group-by", getSingleGroupColumn({
3170
3450
  groupCount: groupRowsBy.length,
3171
3451
  groupRowsBy
3172
3452
  }, toggleGroupRow, groupColumn));
3173
3453
  }
3174
- return generatedColumns;
3454
+ columns.forEach((col, colId) => {
3455
+ computedColumns.set(colId, col);
3456
+ });
3457
+ return computedColumns;
3175
3458
  }
3176
3459
 
3177
3460
  // src/components/InfiniteTable/hooks/useComputed.ts
3178
3461
  function useComputed() {
3179
- const { componentActions, componentState, updateStateProperty } = useComponentState();
3462
+ var _a;
3463
+ const { componentActions, componentState } = useComponentState();
3180
3464
  const {
3181
3465
  componentActions: dataSourceActions,
3182
3466
  componentState: dataSourceState
3183
3467
  } = useDataSourceContextValue();
3184
3468
  const { columnOrder, columnVisibility, columnPinning, bodySize } = componentState;
3185
- (0, import_react18.useState)(() => {
3186
- componentState.onRowHeightChange.onChange((rowHeight) => {
3469
+ (0, import_react19.useState)(() => {
3470
+ componentState.onRowHeightCSSVarChange.onChange((rowHeight) => {
3187
3471
  if (rowHeight) {
3188
- componentActions.rowHeightComputed = rowHeight;
3472
+ componentActions.rowHeight = rowHeight;
3189
3473
  }
3190
3474
  });
3191
- componentState.onHeaderHeightChange.onChange((headerHeight) => {
3475
+ componentState.onHeaderHeightCSSVarChange.onChange((headerHeight) => {
3192
3476
  if (headerHeight) {
3193
- updateStateProperty("headerHeight", headerHeight);
3477
+ componentActions.headerHeight = headerHeight;
3194
3478
  }
3195
3479
  });
3196
3480
  });
3197
3481
  useColumnAggregations();
3198
3482
  const { multiSort } = dataSourceState;
3199
3483
  useColumnGroups();
3200
- useGeneratedGroupAndPivotColumns();
3201
- const setSortInfo = (0, import_react18.useCallback)((sortInfo) => {
3202
- var _a;
3203
- dataSourceActions.sortInfo = multiSort ? sortInfo : (_a = sortInfo[0]) != null ? _a : null;
3204
- }, [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;
3205
3490
  const {
3206
3491
  computedColumnOrder,
3207
3492
  computedVisibleColumns,
@@ -3218,8 +3503,7 @@ function useComputed() {
3218
3503
  computedPinnedStartWidth,
3219
3504
  computedPinnedEndWidth
3220
3505
  } = useComputedVisibleColumns({
3221
- columns: componentState.computedPivotColumns || componentState.columns,
3222
- generatedColumns: componentState.generatedColumns,
3506
+ columns,
3223
3507
  columnMinWidth: componentState.columnMinWidth,
3224
3508
  columnMaxWidth: componentState.columnMaxWidth,
3225
3509
  columnDefaultWidth: componentState.columnDefaultWidth,
@@ -3228,7 +3512,7 @@ function useComputed() {
3228
3512
  bodySize,
3229
3513
  sortable: componentState.sortable,
3230
3514
  draggableColumns: componentState.draggableColumns,
3231
- sortInfo: dataSourceState.sortInfo,
3515
+ sortInfo: (_a = dataSourceState.sortInfo) != null ? _a : void 0,
3232
3516
  multiSort,
3233
3517
  setSortInfo,
3234
3518
  columnOrder,
@@ -3294,11 +3578,11 @@ var useInternalProps = () => {
3294
3578
 
3295
3579
  // src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx
3296
3580
  var InfiniteTableBody = React10.forwardRef(function InfiniteTableBody2(props, ref) {
3297
- const { rootClassName: rootClassName11 } = useInternalProps();
3581
+ const { rootClassName: rootClassName12 } = useInternalProps();
3298
3582
  return /* @__PURE__ */ React10.createElement("div", __spreadProps(__spreadValues({
3299
3583
  ref
3300
3584
  }, props), {
3301
- className: join(`${rootClassName11}Body`, ICSS.position.relative, ICSS.transform.translate3D000, props.className)
3585
+ className: join(`${rootClassName12}Body`, position.relative, flex["1"], transformTranslateZero, props.className)
3302
3586
  }));
3303
3587
  });
3304
3588
 
@@ -3367,29 +3651,47 @@ function VerticalScrollbarPlaceholderFn(props) {
3367
3651
  }
3368
3652
  var VerticalScrollbarPlaceholder = React11.memo(VerticalScrollbarPlaceholderFn);
3369
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
+
3370
3665
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
3371
3666
  var React18 = __toModule(require("react"));
3372
- var import_react25 = __toModule(require("react"));
3667
+ var import_react26 = __toModule(require("react"));
3373
3668
 
3374
3669
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
3375
3670
  var React14 = __toModule(require("react"));
3376
- var import_react22 = __toModule(require("react"));
3671
+ var import_react23 = __toModule(require("react"));
3377
3672
 
3378
3673
  // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
3379
3674
  var React12 = __toModule(require("react"));
3380
3675
 
3381
3676
  // src/components/InfiniteTable/hooks/useInfiniteTableState.ts
3382
- var import_react19 = __toModule(require("react"));
3677
+ var import_react20 = __toModule(require("react"));
3383
3678
  var useInfiniteTableState = () => {
3384
3679
  const TableContext2 = getInfiniteTableContext();
3385
- const { componentState } = (0, import_react19.useContext)(TableContext2);
3680
+ const { componentState } = (0, import_react20.useContext)(TableContext2);
3386
3681
  return componentState;
3387
3682
  };
3388
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
+
3389
3690
  // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
3390
3691
  var { rootClassName: rootClassName2 } = internalProps;
3391
3692
  var InfiniteTableCellClassName = `${rootClassName2}Cell`;
3392
3693
  function InfiniteTableCellFn(props) {
3694
+ var _b, _c;
3393
3695
  const _a = props, {
3394
3696
  cssEllipsis = true,
3395
3697
  virtualized = true,
@@ -3431,7 +3733,7 @@ function InfiniteTableCellFn(props) {
3431
3733
  ref: domRef,
3432
3734
  style,
3433
3735
  "data-name": `Cell`,
3434
- 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}` : "")
3435
3737
  }), beforeChildren, cssEllipsis ? /* @__PURE__ */ React12.createElement("div", {
3436
3738
  className: `${rootClassName2}Cell_content ${cssEllipsisClassName}`
3437
3739
  }, children) : children, afterChildren);
@@ -3440,7 +3742,7 @@ var InfiniteTableCell = React12.memo(InfiniteTableCellFn);
3440
3742
 
3441
3743
  // src/components/InfiniteTable/hooks/useColumnPointerEvents.ts
3442
3744
  var import_binary_search = __toModule(require_binary_search());
3443
- var import_react20 = __toModule(require("react"));
3745
+ var import_react21 = __toModule(require("react"));
3444
3746
 
3445
3747
  // src/components/InfiniteTable/utils/moveXatY.ts
3446
3748
  var moveXatY = (arr, dragIndex, dropIndex) => {
@@ -3474,18 +3776,18 @@ var useColumnPointerEvents = ({
3474
3776
  columns,
3475
3777
  computedRemainingSpace
3476
3778
  }) => {
3477
- const [draggingDiff, setDraggingDiff] = (0, import_react20.useState)(null);
3478
- const [proxyOffset, setProxyOffset] = (0, import_react20.useState)(null);
3479
- const breakpointsRef = (0, import_react20.useRef)([]);
3480
- const pointerMoveRef = (0, import_react20.useRef)(null);
3481
- const didDragRef = (0, import_react20.useRef)(false);
3482
- const initialClientPos = (0, import_react20.useRef)(null);
3483
- 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);
3484
3786
  const dragging = draggingDiff != null;
3485
3787
  const { componentActions, computed } = useInfiniteTable();
3486
3788
  const { computedColumnOrder } = computed;
3487
- const column = (0, import_react20.useMemo)(() => columns.get(columnId), [columnId, columns]);
3488
- 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)(() => {
3489
3791
  const columnsArray2 = Array.from(columns.values());
3490
3792
  return {
3491
3793
  columnsArray: columnsArray2,
@@ -3493,8 +3795,8 @@ var useColumnPointerEvents = ({
3493
3795
  columnWidth: column.computedWidth
3494
3796
  };
3495
3797
  }, [columns, columnId, column]);
3496
- let cursorRef = (0, import_react20.useRef)("auto");
3497
- const onPointerDown = (0, import_react20.useCallback)((e) => {
3798
+ let cursorRef = (0, import_react21.useRef)("auto");
3799
+ const onPointerDown = (0, import_react21.useCallback)((e) => {
3498
3800
  const target = domRef.current;
3499
3801
  cursorRef.current = target.style.cursor;
3500
3802
  didDragRef.current = false;
@@ -3557,7 +3859,7 @@ var useColumnPointerEvents = ({
3557
3859
  target.addEventListener("pointermove", onPointerMove);
3558
3860
  target.setPointerCapture(e.pointerId);
3559
3861
  }, [columns, column, columnIndex, columnsArray, computedRemainingSpace]);
3560
- const onPointerUp = (0, import_react20.useCallback)((e) => {
3862
+ const onPointerUp = (0, import_react21.useCallback)((e) => {
3561
3863
  const target = domRef.current;
3562
3864
  target.style.cursor = cursorRef.current;
3563
3865
  target.releasePointerCapture(e.pointerId);
@@ -3591,11 +3893,25 @@ var useColumnPointerEvents = ({
3591
3893
  };
3592
3894
 
3593
3895
  // src/components/InfiniteTable/hooks/useCellClassName.ts
3594
- function useCellClassName(column, baseClasses) {
3896
+ function useCellClassName(column, baseClasses, variants, extraFlags) {
3595
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);
3596
3909
  if (column.computedFirst) {
3597
3910
  result.push(...baseClasses.map((c) => `${c}--first`));
3598
3911
  }
3912
+ if (column.groupByField) {
3913
+ result.push(...baseClasses.map((c) => `${c}--group-column`));
3914
+ }
3599
3915
  if (column.computedLast) {
3600
3916
  result.push(...baseClasses.map((c) => `${c}--last`));
3601
3917
  }
@@ -3610,7 +3926,7 @@ function useCellClassName(column, baseClasses) {
3610
3926
  } else {
3611
3927
  result.push(...baseClasses.map((c) => `${c}--unpinned`));
3612
3928
  }
3613
- return result.join(" ");
3929
+ return result.filter(Boolean).join(" ");
3614
3930
  }
3615
3931
 
3616
3932
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
@@ -3618,7 +3934,7 @@ var import_react_dom = __toModule(require("react-dom"));
3618
3934
 
3619
3935
  // src/components/InfiniteTable/components/icons/SortIcon.tsx
3620
3936
  var React13 = __toModule(require("react"));
3621
- var import_react21 = __toModule(require("react"));
3937
+ var import_react22 = __toModule(require("react"));
3622
3938
  var defaultLineStyle = {
3623
3939
  marginTop: 2,
3624
3940
  marginBottom: 2,
@@ -3626,8 +3942,8 @@ var defaultLineStyle = {
3626
3942
  };
3627
3943
  function SortIcon(props) {
3628
3944
  var _a;
3629
- const [rendered, setRendered] = (0, import_react21.useState)(true);
3630
- 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);
3631
3947
  const { direction, lineWidth = 1, style, className, index } = props;
3632
3948
  const showIndex = index != null && index > 0;
3633
3949
  const size = (_a = props.size) != null ? _a : 16;
@@ -3641,7 +3957,7 @@ function SortIcon(props) {
3641
3957
  }), props.lineStyle), {
3642
3958
  opacity
3643
3959
  });
3644
- (0, import_react21.useEffect)(() => {
3960
+ (0, import_react22.useEffect)(() => {
3645
3961
  const newOpacity = direction != 0 ? 1 : 0;
3646
3962
  if (!rendered && newOpacity) {
3647
3963
  setRendered(true);
@@ -3715,11 +4031,11 @@ function InfiniteTableHeaderCell(props) {
3715
4031
  header = header != null ? header : column.name;
3716
4032
  const sortTool = /* @__PURE__ */ React14.createElement(SortIcon, {
3717
4033
  index: column.computedMultiSort ? column.computedSortIndex + 1 : void 0,
3718
- className: `${baseCls}__sort-icon`,
4034
+ className: `${baseCls}__sort-icon ${HeaderSortIconCls}`,
3719
4035
  direction: column.computedSorted ? column.computedSortedAsc ? 1 : -1 : 0
3720
4036
  });
3721
- const domRef = (0, import_react22.useRef)(null);
3722
- const ref = (0, import_react22.useCallback)((node) => {
4037
+ const domRef = (0, import_react23.useRef)(null);
4038
+ const ref = (0, import_react23.useCallback)((node) => {
3723
4039
  var _a2;
3724
4040
  domRef.current = node;
3725
4041
  (_a2 = props.domRef) == null ? void 0 : _a2.call(props, node);
@@ -3728,7 +4044,7 @@ function InfiniteTableHeaderCell(props) {
3728
4044
  computed: { computedRemainingSpace },
3729
4045
  componentState: { portalDOMRef }
3730
4046
  } = useInfiniteTable();
3731
- (0, import_react22.useEffect)(() => {
4047
+ (0, import_react23.useEffect)(() => {
3732
4048
  let clearOnResize = null;
3733
4049
  const node = domRef.current;
3734
4050
  if (onResize && node) {
@@ -3752,7 +4068,7 @@ function InfiniteTableHeaderCell(props) {
3752
4068
  let draggingProxy = null;
3753
4069
  if (dragging) {
3754
4070
  draggingProxy = /* @__PURE__ */ React14.createElement("div", {
3755
- className: `${baseCls}Proxy`,
4071
+ className: `${baseCls}Proxy ${HeaderCellProxy}`,
3756
4072
  style: {
3757
4073
  position: "absolute",
3758
4074
  height: headerHeight,
@@ -3773,7 +4089,7 @@ function InfiniteTableHeaderCell(props) {
3773
4089
  offset,
3774
4090
  onPointerDown,
3775
4091
  onPointerUp,
3776
- 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),
3777
4093
  cssEllipsis: (_d = (_c = column.headerCssEllipsis) != null ? _c : column.cssEllipsis) != null ? _d : true,
3778
4094
  afterChildren: sortTool
3779
4095
  }, header), draggingProxy);
@@ -3781,7 +4097,7 @@ function InfiniteTableHeaderCell(props) {
3781
4097
 
3782
4098
  // src/components/RawList/index.tsx
3783
4099
  var React17 = __toModule(require("react"));
3784
- var import_react24 = __toModule(require("react"));
4100
+ var import_react25 = __toModule(require("react"));
3785
4101
 
3786
4102
  // src/components/RawList/ReactVirtualRenderer.tsx
3787
4103
  var React16 = __toModule(require("react"));
@@ -3900,10 +4216,10 @@ var MappedItems = class extends Logger {
3900
4216
 
3901
4217
  // src/components/RawList/AvoidReactDiff.tsx
3902
4218
  var React15 = __toModule(require("react"));
3903
- var import_react23 = __toModule(require("react"));
4219
+ var import_react24 = __toModule(require("react"));
3904
4220
  function AvoidReactDiffFn(props) {
3905
- const [children, setChildren] = (0, import_react23.useState)(props.updater.get());
3906
- (0, import_react23.useLayoutEffect)(() => {
4221
+ const [children, setChildren] = (0, import_react24.useState)(props.updater.get());
4222
+ (0, import_react24.useLayoutEffect)(() => {
3907
4223
  const remove = props.updater.onChange((children2) => {
3908
4224
  setChildren(children2);
3909
4225
  });
@@ -4055,9 +4371,21 @@ var ReactVirtualRenderer = class extends Logger {
4055
4371
  if (this.destroyed) {
4056
4372
  return;
4057
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);
4058
4382
  const renderedNode = renderItem({
4383
+ spanParent,
4059
4384
  itemIndex,
4060
- itemSize: this.brain.getItemSize(itemIndex),
4385
+ itemSize,
4386
+ itemSizeWithSpan,
4387
+ itemSpan,
4388
+ covered,
4061
4389
  domRef: this.itemDOMRefs[elementIndex]
4062
4390
  });
4063
4391
  const itemUpdater = this.updaters[elementIndex];
@@ -4077,7 +4405,7 @@ var ReactVirtualRenderer = class extends Logger {
4077
4405
  // src/components/RawList/index.tsx
4078
4406
  function RawListFn(props) {
4079
4407
  const { renderItem, brain, debugChannel } = props;
4080
- const { onRenderUpdater, renderer } = (0, import_react24.useMemo)(() => {
4408
+ const { onRenderUpdater, renderer } = (0, import_react25.useMemo)(() => {
4081
4409
  const onRenderUpdater2 = buildSubscriptionCallback();
4082
4410
  const renderer2 = new ReactVirtualRenderer(brain, {
4083
4411
  channel: debugChannel
@@ -4085,7 +4413,7 @@ function RawListFn(props) {
4085
4413
  return { onRenderUpdater: onRenderUpdater2, renderer: renderer2 };
4086
4414
  }, []);
4087
4415
  const getRenderItem = useLatest(renderItem);
4088
- (0, import_react24.useEffect)(() => {
4416
+ (0, import_react25.useEffect)(() => {
4089
4417
  const renderRange = brain.getRenderRange();
4090
4418
  renderer.renderRange(renderRange, {
4091
4419
  renderItem,
@@ -4093,7 +4421,7 @@ function RawListFn(props) {
4093
4421
  onRender: onRenderUpdater
4094
4422
  });
4095
4423
  }, [renderItem, onRenderUpdater]);
4096
- (0, import_react24.useEffect)(() => {
4424
+ (0, import_react25.useEffect)(() => {
4097
4425
  const remove = brain.onRenderRangeChange((renderRange) => {
4098
4426
  renderer.renderRange(renderRange, {
4099
4427
  force: false,
@@ -4103,7 +4431,7 @@ function RawListFn(props) {
4103
4431
  });
4104
4432
  return remove;
4105
4433
  }, [brain, onRenderUpdater]);
4106
- (0, import_react24.useEffect)(() => {
4434
+ (0, import_react25.useEffect)(() => {
4107
4435
  return () => {
4108
4436
  renderer.destroy();
4109
4437
  onRenderUpdater.destroy();
@@ -4120,13 +4448,13 @@ var debug3 = dbg("Header");
4120
4448
  var { rootClassName: rootClassName4 } = internalProps;
4121
4449
  var TableHeaderClassName = `${rootClassName4}Header`;
4122
4450
  function InfiniteTableHeaderFn(props) {
4123
- const { repaintId, brain, columns, style, className } = props;
4451
+ const { repaintId, brain, columns, style, className, pinning } = props;
4124
4452
  const {
4125
4453
  computed,
4126
4454
  componentState: { headerHeight }
4127
4455
  } = useInfiniteTable();
4128
4456
  const { computedVisibleColumnsMap } = computed;
4129
- const renderColumn = (0, import_react25.useCallback)(({ domRef: domRef2, itemIndex: columnIndex }) => {
4457
+ const renderColumn = (0, import_react26.useCallback)(({ domRef: domRef2, itemIndex: columnIndex }) => {
4130
4458
  const column = columns[columnIndex];
4131
4459
  if (!column) {
4132
4460
  if (false) {
@@ -4141,17 +4469,22 @@ function InfiniteTableHeaderFn(props) {
4141
4469
  columns: computedVisibleColumnsMap
4142
4470
  });
4143
4471
  }, [computedVisibleColumnsMap, columns, repaintId, headerHeight]);
4144
- (0, import_react25.useEffect)(() => {
4472
+ (0, import_react26.useEffect)(() => {
4145
4473
  const onScroll = (scrollPosition) => {
4146
4474
  domRef.current.style.transform = `translate3d(-${scrollPosition.scrollLeft}px, 0px, 0px)`;
4147
4475
  };
4148
4476
  const removeOnScroll = brain.onScroll(onScroll);
4149
4477
  return removeOnScroll;
4150
4478
  }, [brain]);
4151
- 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
+ });
4152
4485
  const domProps = {
4153
4486
  ref: domRef,
4154
- className: join(ICSS.flexFlow.row, TableHeaderClassName, `${TableHeaderClassName}--virtualized`, className),
4487
+ className: join(TableHeaderClassName, `${TableHeaderClassName}--virtualized`, className, headerCls),
4155
4488
  style
4156
4489
  };
4157
4490
  return /* @__PURE__ */ React18.createElement("div", __spreadValues({}, domProps), /* @__PURE__ */ React18.createElement(RawList, {
@@ -4271,15 +4604,15 @@ function InfiniteTableHeaderGroup(props) {
4271
4604
  };
4272
4605
  return /* @__PURE__ */ React19.createElement("div", {
4273
4606
  "data-group-id": columnGroup.id,
4274
- className: join(ICSS.flexFlow.column, ICSS.display.flex, TableHeaderGroupClassName, `${TableHeaderGroupClassName}--unvirtualized`),
4607
+ className: join(HeaderGroupCls, TableHeaderGroupClassName, `${TableHeaderGroupClassName}--unvirtualized`),
4275
4608
  style
4276
4609
  }, /* @__PURE__ */ React19.createElement("div", {
4277
- className: join(`${TableHeaderGroupClassName}__header`, ICSS.flexFlow.row, ICSS.display.flex, ICSS.alignItems.center),
4610
+ className: join(`${TableHeaderGroupClassName}__header`, HeaderGroup_Header),
4278
4611
  style: { height: headerHeight }
4279
4612
  }, /* @__PURE__ */ React19.createElement("div", {
4280
4613
  className: join(`${TableHeaderGroupClassName}__header-content`, cssEllipsisClassName)
4281
4614
  }, header)), /* @__PURE__ */ React19.createElement("div", {
4282
- className: join(`${TableHeaderGroupClassName}__children`, ICSS.display.flex, ICSS.flexFlow.row, ICSS.alignItems.stretch)
4615
+ className: join(`${TableHeaderGroupClassName}__children`, HeaderGroup_Children)
4283
4616
  }, props.children));
4284
4617
  }
4285
4618
 
@@ -4335,7 +4668,7 @@ function renderColumnHeaderGroups(config) {
4335
4668
  }
4336
4669
 
4337
4670
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderUnvirtualized.tsx
4338
- var import_react26 = __toModule(require("react"));
4671
+ var import_react27 = __toModule(require("react"));
4339
4672
  var { rootClassName: rootClassName5 } = internalProps;
4340
4673
  var TableHeaderClassName2 = `${rootClassName5}Header`;
4341
4674
  var UPDATE_SCROLL = (node, scrollPosition) => {
@@ -4345,17 +4678,17 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
4345
4678
  const _a = props, {
4346
4679
  columns,
4347
4680
  scrollable,
4348
- classNameModifiers,
4349
4681
  brain,
4350
4682
  scrollListener,
4683
+ pinning,
4351
4684
  totalWidth,
4352
4685
  availableWidth
4353
4686
  } = _a, domProps = __objRest(_a, [
4354
4687
  "columns",
4355
4688
  "scrollable",
4356
- "classNameModifiers",
4357
4689
  "brain",
4358
4690
  "scrollListener",
4691
+ "pinning",
4359
4692
  "totalWidth",
4360
4693
  "availableWidth"
4361
4694
  ]);
@@ -4401,7 +4734,7 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
4401
4734
  if (totalWidth != null) {
4402
4735
  style.width = availableWidth;
4403
4736
  }
4404
- (0, import_react26.useEffect)(() => {
4737
+ (0, import_react27.useEffect)(() => {
4405
4738
  const scroller = brain || scrollListener;
4406
4739
  if (!scroller || !scrollable) {
4407
4740
  return;
@@ -4413,11 +4746,15 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
4413
4746
  return removeOnScroll;
4414
4747
  }, [brain, scrollListener]);
4415
4748
  return /* @__PURE__ */ React21.createElement("div", __spreadProps(__spreadValues({}, domProps), {
4416
- 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
+ })),
4417
4754
  style
4418
4755
  }), /* @__PURE__ */ React21.createElement("div", {
4419
4756
  style: { width: totalWidth },
4420
- className: join(ICSS.flexFlow.row, ICSS.display.flex),
4757
+ className: join(flexFlow.row, display.flex),
4421
4758
  ref: domRef
4422
4759
  }, children));
4423
4760
  }
@@ -4455,6 +4792,7 @@ function TableHeaderWrapper(props) {
4455
4792
  columns: computedUnpinnedColumns,
4456
4793
  repaintId: virtualizeHeader ? repaintId : void 0,
4457
4794
  brain,
4795
+ pinning: false,
4458
4796
  style: {
4459
4797
  position: "absolute",
4460
4798
  left: computedPinnedStartWidth,
@@ -4466,14 +4804,14 @@ function TableHeaderWrapper(props) {
4466
4804
  }) : /* @__PURE__ */ React22.createElement(InfiniteTableHeaderUnvirtualized, {
4467
4805
  brain,
4468
4806
  scrollable: true,
4807
+ pinning: false,
4469
4808
  columns: computedUnpinnedColumns,
4470
4809
  availableWidth: computedUnpinnedColumnsWidth,
4471
4810
  totalWidth: computedUnpinnedColumnsWidth
4472
4811
  });
4473
4812
  return /* @__PURE__ */ React22.createElement("div", {
4474
- className: join(ICSS.overflow.hidden, ICSS.position.relative, ICSS.display.flex, ICSS.flexFlow.row),
4813
+ className: HeaderWrapperCls,
4475
4814
  style: {
4476
- background: "var(--ITableHeader__background)",
4477
4815
  height: virtualizeHeader ? height : void 0
4478
4816
  }
4479
4817
  }, hasPinnedStart ? /* @__PURE__ */ React22.createElement(InfiniteTableHeaderUnvirtualized, {
@@ -4486,11 +4824,7 @@ function TableHeaderWrapper(props) {
4486
4824
  totalWidth: computedPinnedStartColumnsWidth,
4487
4825
  columns: computedPinnedStartColumns,
4488
4826
  scrollable: computedPinnedStartOverflow,
4489
- classNameModifiers: [
4490
- "pinned",
4491
- "pinned-start",
4492
- computedPinnedStartOverflow ? "overflow" : ""
4493
- ],
4827
+ pinning: "start",
4494
4828
  scrollListener: computedPinnedStartOverflow ? pinnedStartScrollListener : void 0
4495
4829
  }) : null, header, hasPinnedEnd ? /* @__PURE__ */ React22.createElement(InfiniteTableHeaderUnvirtualized, {
4496
4830
  style: {
@@ -4502,11 +4836,7 @@ function TableHeaderWrapper(props) {
4502
4836
  availableWidth: computedPinnedEndWidth,
4503
4837
  totalWidth: computedPinnedEndColumnsWidth,
4504
4838
  scrollable: computedPinnedEndOverflow,
4505
- classNameModifiers: [
4506
- "pinned",
4507
- "pinned-end",
4508
- computedPinnedEndOverflow ? "overflow" : ""
4509
- ],
4839
+ pinning: "end",
4510
4840
  scrollListener: computedPinnedEndOverflow ? pinnedEndScrollListener : void 0
4511
4841
  }) : null, scrollbars.vertical ? /* @__PURE__ */ React22.createElement(VerticalScrollbarPlaceholder, {
4512
4842
  style: {
@@ -4518,12 +4848,12 @@ function TableHeaderWrapper(props) {
4518
4848
 
4519
4849
  // src/components/VirtualScrollContainer/index.tsx
4520
4850
  var React23 = __toModule(require("react"));
4521
- var import_react28 = __toModule(require("react"));
4851
+ var import_react29 = __toModule(require("react"));
4522
4852
 
4523
4853
  // src/components/hooks/useOnScroll.ts
4524
- var import_react27 = __toModule(require("react"));
4854
+ var import_react28 = __toModule(require("react"));
4525
4855
  var useOnScroll = (domRef, onScroll) => {
4526
- (0, import_react27.useEffect)(() => {
4856
+ (0, import_react28.useEffect)(() => {
4527
4857
  const domNode = domRef == null ? void 0 : domRef.current;
4528
4858
  const scrollFn = (event) => {
4529
4859
  const node = event.target;
@@ -4542,21 +4872,25 @@ var useOnScroll = (domRef, onScroll) => {
4542
4872
  }, [onScroll, domRef == null ? void 0 : domRef.current]);
4543
4873
  };
4544
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
+
4545
4881
  // src/components/VirtualScrollContainer/getScrollableClassName.ts
4546
4882
  var getScrollableClassName = (scrollable) => {
4547
4883
  let scrollableClassName = "";
4548
- if (typeof scrollable === "boolean") {
4549
- scrollableClassName = scrollable ? ICSS.overflow.auto : ICSS.overflow.hidden;
4550
- } else if (typeof scrollable === "string") {
4551
- scrollableClassName = ICSS.overflow[scrollable];
4884
+ if (typeof scrollable === "boolean" || typeof scrollable === "string") {
4885
+ scrollableClassName = ScrollableCls[`${scrollable}`];
4552
4886
  } else {
4553
- 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}`]);
4554
4888
  }
4555
4889
  return scrollableClassName;
4556
4890
  };
4557
4891
 
4558
4892
  // src/components/VirtualScrollContainer/index.tsx
4559
- var rootClassName6 = "IT-VirtualScrollContainer";
4893
+ var rootClassName6 = "Infinite-VirtualScrollContainer";
4560
4894
  var VirtualScrollContainer = React23.forwardRef(function VirtualScrollContainer2(props, ref) {
4561
4895
  const {
4562
4896
  children,
@@ -4565,16 +4899,12 @@ var VirtualScrollContainer = React23.forwardRef(function VirtualScrollContainer2
4565
4899
  className,
4566
4900
  style
4567
4901
  } = props;
4568
- const domRef = ref != null ? ref : (0, import_react28.useRef)(null);
4902
+ const domRef = ref != null ? ref : (0, import_react29.useRef)(null);
4569
4903
  useOnScroll(domRef, onContainerScroll);
4570
4904
  return /* @__PURE__ */ React23.createElement("div", {
4571
4905
  ref: domRef,
4572
4906
  style,
4573
- className: [
4574
- className,
4575
- rootClassName6,
4576
- getScrollableClassName(scrollable)
4577
- ].join(" ")
4907
+ className: join(className, rootClassName6, VirtualScrollContainerCls, getScrollableClassName(scrollable))
4578
4908
  }, children);
4579
4909
  });
4580
4910
 
@@ -4600,24 +4930,30 @@ function SpacePlaceholderFn(props) {
4600
4930
  var SpacePlaceholder = React24.memo(SpacePlaceholderFn);
4601
4931
 
4602
4932
  // src/components/InfiniteTable/hooks/useListRendering.tsx
4603
- var import_react39 = __toModule(require("react"));
4933
+ var import_react40 = __toModule(require("react"));
4604
4934
 
4605
4935
  // src/components/InfiniteTable/hooks/useUnpinnedRendering.tsx
4606
4936
  var React30 = __toModule(require("react"));
4607
- var import_react32 = __toModule(require("react"));
4937
+ var import_react33 = __toModule(require("react"));
4608
4938
 
4609
4939
  // src/components/VirtualList/VirtualRowList.tsx
4610
4940
  var React26 = __toModule(require("react"));
4611
4941
 
4612
4942
  // src/components/VirtualList/VirtualList.tsx
4613
4943
  var React25 = __toModule(require("react"));
4614
- 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
4615
4952
  var UPDATE_SCROLL2 = (node, scrollPosition) => {
4616
4953
  node.style.transform = `translate3d(${-scrollPosition.scrollLeft}px, ${-scrollPosition.scrollTop}px, 0px)`;
4617
4954
  };
4618
- var CLASSES = join(ICSS.height["0"], ICSS.width["0"], ICSS.willChange.transform);
4619
4955
  var debug4 = dbg("VirtuaList");
4620
- var rootClassName7 = "IList";
4956
+ var rootClassName7 = "InfiniteList";
4621
4957
  var VirtualList = (props) => {
4622
4958
  const _a = props, {
4623
4959
  scrollable,
@@ -4648,11 +4984,11 @@ var VirtualList = (props) => {
4648
4984
  "onContainerScroll",
4649
4985
  "children"
4650
4986
  ]);
4651
- const domRef = (0, import_react29.useRef)(null);
4987
+ const domRef = (0, import_react30.useRef)(null);
4652
4988
  const [, rerender] = useRerender();
4653
- const [totalSize, setTotalSize] = (0, import_react29.useState)(0);
4654
- const renderCountRef = (0, import_react29.useRef)(0);
4655
- (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)(() => {
4656
4992
  const removeOnRenderCount = virtualBrain.onRenderCountChange((renderCount) => {
4657
4993
  renderCountRef.current = renderCount;
4658
4994
  if (false) {
@@ -4671,7 +5007,7 @@ var VirtualList = (props) => {
4671
5007
  removeOnTotalSizeChange();
4672
5008
  };
4673
5009
  }, [virtualBrain]);
4674
- (0, import_react29.useEffect)(() => {
5010
+ (0, import_react30.useEffect)(() => {
4675
5011
  const onScroll = (scrollPosition) => {
4676
5012
  UPDATE_SCROLL2(domRef.current, scrollPosition);
4677
5013
  };
@@ -4681,7 +5017,7 @@ var VirtualList = (props) => {
4681
5017
  const width = mainAxis === "horizontal" ? totalSize : itemCrossAxisSize != null ? itemCrossAxisSize : 0;
4682
5018
  const height = mainAxis === "vertical" ? totalSize : itemCrossAxisSize != null ? itemCrossAxisSize : 0;
4683
5019
  const domProps = __spreadProps(__spreadValues({}, restDOMProps), {
4684
- className: join(props.className, rootClassName7, `${rootClassName7}--${mainAxis}`, ICSS.transform.translate3D000)
5020
+ className: join(props.className, rootClassName7, `${rootClassName7}--${mainAxis}`, VirtualListCls, VirtualListClsOrientation[mainAxis])
4685
5021
  });
4686
5022
  if (false) {
4687
5023
  domProps["data-cmp-name"] = `VirtualList`;
@@ -4691,7 +5027,7 @@ var VirtualList = (props) => {
4691
5027
  onContainerScroll
4692
5028
  }, /* @__PURE__ */ React25.createElement("div", {
4693
5029
  ref: domRef,
4694
- className: CLASSES,
5030
+ className: scrollTransformTargetCls,
4695
5031
  "data-name": "scroll-transform-target"
4696
5032
  }, /* @__PURE__ */ React25.createElement(RawList, {
4697
5033
  brain: virtualBrain,
@@ -4725,142 +5061,208 @@ var VirtualRowList = (props) => {
4725
5061
 
4726
5062
  // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRow.tsx
4727
5063
  var React28 = __toModule(require("react"));
4728
- var import_react31 = __toModule(require("react"));
5064
+ var import_react32 = __toModule(require("react"));
4729
5065
 
4730
5066
  // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableColumnCell.tsx
4731
5067
  var React27 = __toModule(require("react"));
4732
5068
  var { rootClassName: rootClassName8 } = internalProps;
4733
- var baseCls2 = `${rootClassName8}ColumnCell`;
5069
+ var InfiniteTableColumnCellClassName = `${rootClassName8}ColumnCell`;
4734
5070
  function isColumnWithField(c) {
4735
5071
  return typeof c.field === "string";
4736
5072
  }
4737
- function isColumnWithRender(c) {
4738
- return c.render instanceof Function;
4739
- }
4740
5073
  function InfiniteTableColumnCellFn(props) {
4741
5074
  var _a;
4742
5075
  const {
4743
- enhancedData,
5076
+ rowInfo,
5077
+ getData,
4744
5078
  column,
4745
5079
  offsetProperty,
4746
5080
  toggleGroupRow,
4747
5081
  virtualized,
4748
5082
  rowIndex,
4749
- domRef
5083
+ rowHeight,
5084
+ domRef,
5085
+ hidden
4750
5086
  } = props;
4751
- const { data, isGroupRow, groupBy } = enhancedData;
4752
- 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;
4753
5093
  if (column.valueGetter) {
4754
- value = column.valueGetter({ data, enhancedData });
5094
+ value = column.valueGetter({
5095
+ data,
5096
+ rowInfo,
5097
+ groupRowInfo
5098
+ });
4755
5099
  }
4756
5100
  const { componentState: computedDataSource } = useDataSourceContextValue();
4757
- const renderParam = {
5101
+ const stylingRenderParam = {
4758
5102
  value,
4759
5103
  column,
4760
- enhancedData,
5104
+ rowInfo,
4761
5105
  data
4762
5106
  };
4763
- let renderValue = isColumnWithRender(column) ? column.render({
4764
- value,
4765
- column,
4766
- enhancedData,
4767
- data,
4768
- rowIndex,
4769
- toggleGroupRow,
4770
- toggleCurrentGroupRow: () => toggleGroupRow(enhancedData.groupKeys),
4771
- groupRowsBy: computedDataSource.groupRowsBy
4772
- }) : value;
4773
- const colClassName = column.className ? typeof column.className === "function" ? column.className(renderParam) : column.className : void 0;
4774
- 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;
4775
5128
  const style = colStyle ? __spreadProps(__spreadValues({}, colStyle), {
4776
5129
  width: column.computedWidth
4777
5130
  }) : {
4778
5131
  width: column.computedWidth
4779
5132
  };
4780
- return /* @__PURE__ */ React27.createElement(InfiniteTableCell, {
4781
- domRef,
4782
- offsetProperty,
5133
+ const dataset = {
4783
5134
  "data-name": `Cell`,
4784
5135
  "data-column-id": column.id,
4785
- "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), {
4786
5158
  column,
4787
5159
  offset: virtualized ? 0 : column.computedPinningOffset,
4788
5160
  style,
4789
5161
  cssEllipsis: (_a = column.cssEllipsis) != null ? _a : true,
4790
- className: join(ICSS.position.absolute, ICSS.height["100%"], ICSS.top[0], useCellClassName(column, [baseCls2, InfiniteTableCellClassName]), colClassName)
4791
- }, renderValue);
5162
+ className: join(useCellClassName(column, [InfiniteTableColumnCellClassName, InfiniteTableCellClassName], ColumnCellRecipe, { dragging: false }), colClassName)
5163
+ }), hidden ? null : renderValue);
4792
5164
  }
4793
5165
  var InfiniteTableColumnCell = React27.memo(InfiniteTableColumnCellFn);
4794
5166
 
4795
5167
  // src/components/InfiniteTable/components/InfiniteTableRow/useRowDOMProps.ts
4796
- var import_react30 = __toModule(require("react"));
5168
+ var import_react31 = __toModule(require("react"));
4797
5169
 
4798
5170
  // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRowClassName.ts
4799
5171
  var { rootClassName: rootClassName9 } = internalProps;
4800
5172
  var InfiniteTableRowClassName = `${rootClassName9}Row`;
4801
- var InfiniteTableRowClassName__hover = `${InfiniteTableRowClassName}--hover`;
5173
+ var InfiniteTableRowClassName__hover = `${rootClassName9}Element--hover`;
5174
+
5175
+ // src/components/InfiniteTable/theme.css.ts
5176
+ var ThemeVars = { color: { accent: "var(--infinite-accent-color)", color: "var(--infinite-color)" }, spacing: { "0": "var(--infinite-space-0)", "1": "var(--infinite-space-1)", "2": "var(--infinite-space-2)", "3": "var(--infinite-space-3)", "4": "var(--infinite-space-4)", "5": "var(--infinite-space-5)", "6": "var(--infinite-space-6)", "7": "var(--infinite-space-7)", "8": "var(--infinite-space-8)", "9": "var(--infinite-space-9)", "10": "var(--infinite-space-10)" }, fontSize: { "0": "var(--infinite-font-size-0)", "1": "var(--infinite-font-size-1)", "2": "var(--infinite-font-size-2)", "3": "var(--infinite-font-size-3)", "4": "var(--infinite-font-size-4)", "5": "var(--infinite-font-size-5)", "6": "var(--infinite-font-size-6)", "7": "var(--infinite-font-size-7)" }, fontFamily: "var(--infinite-font-family)", minHeight: "var(--infinite-min-height)", borderRadius: "var(--infinite-border-radius)", background: "var(--infinite-background)", components: { LoadMask: { padding: "var(--infinite-load-mask-padding)", color: "var(--infinite-load-mask-color)", textBackground: "var(--infinite-load-mask-text-background)", overlayBackground: "var(--infinite-load-mask-overlay-background)", overlayOpacity: "var(--infinite-load-mask-overlay-opacity)", borderRadius: "var(--infinite-load-mask-border-radius)" }, Header: { background: "var(--infinite-header-background)", color: "var(--infinite-header-color)", 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
+ }
4802
5182
 
4803
5183
  // src/components/InfiniteTable/components/InfiniteTableRow/useRowDOMProps.ts
4804
- function useRowDOMProps(props, rowProps, rowStyle, rowClassName, tableDOMRef) {
5184
+ function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStrategy, tableDOMRef) {
4805
5185
  const domProps = props.domProps;
4806
5186
  const {
4807
5187
  showZebraRows = false,
5188
+ showHoverRows = false,
4808
5189
  rowIndex,
4809
5190
  domRef: domRefFromProps,
4810
- enhancedData
5191
+ rowInfo
4811
5192
  } = props;
4812
- const domRef = (0, import_react30.useRef)(null);
4813
- const rowDOMRef = (0, import_react30.useCallback)((node) => {
5193
+ const domRef = (0, import_react31.useRef)(null);
5194
+ const rowDOMRef = (0, import_react31.useCallback)((node) => {
4814
5195
  domRefFromProps(node);
4815
5196
  domRef.current = node;
4816
5197
  }, []);
4817
5198
  const rowPropsAndStyleArgs = {
4818
- data: enhancedData.data,
4819
- enhancedData,
5199
+ data: rowInfo.data,
5200
+ rowInfo,
4820
5201
  rowIndex,
4821
- groupRowsBy: enhancedData.groupBy
5202
+ groupRowsBy: rowInfo.groupBy
4822
5203
  };
4823
5204
  if (typeof rowProps === "function") {
4824
5205
  rowProps = rowProps(rowPropsAndStyleArgs);
4825
5206
  }
4826
5207
  let style = rowProps ? rowProps.style : void 0;
5208
+ const inlineGroupRoot = groupRenderStrategy === "inline" && rowInfo.indexInGroup === 0;
4827
5209
  if (rowStyle) {
4828
5210
  style = typeof rowStyle === "function" ? __spreadValues(__spreadValues({}, style), rowStyle(rowPropsAndStyleArgs)) : __spreadValues(__spreadValues({}, style), rowStyle);
4829
5211
  }
4830
- 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;
4831
5217
  let rowComputedClassName = typeof rowClassName === "function" ? rowClassName(rowPropsAndStyleArgs) : rowClassName;
4832
- 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);
4833
5224
  const initialMouseEnter = rowProps == null ? void 0 : rowProps.onMouseEnter;
4834
5225
  const initialMouseLeave = rowProps == null ? void 0 : rowProps.onMouseLeave;
4835
- const onMouseEnter = (0, import_react30.useCallback)((event) => {
5226
+ const onMouseEnter = (0, import_react31.useCallback)((event) => {
4836
5227
  var _a;
4837
5228
  initialMouseEnter == null ? void 0 : initialMouseEnter(event);
4838
- const rowIndex2 = (_a = event.currentTarget) == null ? void 0 : _a.dataset.rowIndex;
5229
+ const rowIndex2 = ((_a = event.currentTarget) == null ? void 0 : _a.dataset.rowIndex) * 1;
4839
5230
  const parentNode = tableDOMRef.current;
4840
- if (!parentNode) {
5231
+ if (!parentNode || !showHoverRows) {
4841
5232
  return;
4842
5233
  }
4843
- const rows = parentNode.querySelectorAll(`.${InfiniteTableRowClassName}[data-row-index="${rowIndex2}"]`);
4844
- rows.forEach((row) => row.classList.add(InfiniteTableRowClassName__hover));
4845
- }, [initialMouseEnter]);
4846
- 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) => {
4847
5241
  var _a;
4848
5242
  initialMouseLeave == null ? void 0 : initialMouseLeave(event);
4849
5243
  const rowIndex2 = (_a = event.currentTarget) == null ? void 0 : _a.dataset.rowIndex;
4850
5244
  const parentNode = tableDOMRef.current;
4851
- if (!parentNode) {
5245
+ if (!parentNode || !showHoverRows) {
4852
5246
  return;
4853
5247
  }
4854
- const rows = parentNode.querySelectorAll(`.${InfiniteTableRowClassName}[data-row-index="${rowIndex2}"]`);
4855
- rows.forEach((row) => row.classList.remove(InfiniteTableRowClassName__hover));
4856
- }, [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
+ }
4857
5258
  return {
4858
5259
  domRef,
4859
5260
  domProps: __spreadProps(__spreadValues(__spreadValues({}, rowProps), domProps), {
4860
5261
  style,
4861
5262
  "data-virtualize-columns": props.virtualizeColumns ? "on" : "off",
4862
5263
  "data-row-index": rowIndex,
4863
- "data-row-id": `${enhancedData.id}`,
5264
+ "data-hover-index": rowIndex,
5265
+ "data-row-id": `${rowInfo.id}`,
4864
5266
  className,
4865
5267
  onMouseEnter,
4866
5268
  onMouseLeave,
@@ -4874,34 +5276,50 @@ function InfiniteTableRowFn(props) {
4874
5276
  const {
4875
5277
  rowWidth,
4876
5278
  rowHeight,
4877
- enhancedData,
5279
+ getData,
5280
+ rowInfo,
4878
5281
  toggleGroupRow,
4879
5282
  rowIndex,
4880
5283
  brain,
5284
+ verticalBrain,
4881
5285
  columns
4882
5286
  } = props;
4883
5287
  const tableContextValue = useInfiniteTable();
4884
5288
  const { componentState } = tableContextValue;
4885
5289
  const { domRef: tableDOMRef } = componentState;
4886
- 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);
4887
5292
  const style = __spreadValues({
4888
5293
  width: rowWidth,
4889
5294
  height: rowHeight
4890
5295
  }, domProps.style);
4891
- const renderCellRef = (0, import_react31.useRef)(null);
5296
+ const renderCellRef = (0, import_react32.useRef)(null);
4892
5297
  const renderCell = React28.useCallback(({ domRef, itemIndex }) => {
4893
5298
  const column = columns[itemIndex];
4894
5299
  if (!column) {
4895
5300
  }
5301
+ const hidden = false;
4896
5302
  return /* @__PURE__ */ React28.createElement(InfiniteTableColumnCell, {
4897
- enhancedData,
5303
+ getData,
5304
+ rowInfo,
5305
+ groupRenderStrategy,
4898
5306
  virtualized: true,
5307
+ hidden,
5308
+ rowHeight,
4899
5309
  toggleGroupRow,
4900
5310
  rowIndex,
4901
5311
  domRef,
4902
5312
  column
4903
5313
  });
4904
- }, [columns, rowIndex, enhancedData]);
5314
+ }, [
5315
+ columns,
5316
+ rowIndex,
5317
+ rowInfo,
5318
+ rowHeight,
5319
+ groupRenderStrategy,
5320
+ getData,
5321
+ verticalBrain
5322
+ ]);
4905
5323
  if (renderCellRef.current !== renderCell) {
4906
5324
  renderCellRef.current = renderCell;
4907
5325
  }
@@ -4924,7 +5342,8 @@ function TableRowUnvirtualizedFn(props) {
4924
5342
  const {
4925
5343
  rowHeight,
4926
5344
  rowWidth,
4927
- enhancedData,
5345
+ getData,
5346
+ rowInfo,
4928
5347
  rowIndex,
4929
5348
  columns,
4930
5349
  toggleGroupRow
@@ -4932,17 +5351,22 @@ function TableRowUnvirtualizedFn(props) {
4932
5351
  const tableContextValue = useInfiniteTable();
4933
5352
  const { componentState } = tableContextValue;
4934
5353
  const { domRef: tableDOMRef } = componentState;
4935
- 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);
4936
5355
  const style = __spreadValues({
4937
5356
  width: rowWidth,
4938
5357
  height: rowHeight
4939
5358
  }, domProps.style);
4940
5359
  const children = columns.map((col) => {
5360
+ const hidden = false;
4941
5361
  return /* @__PURE__ */ React29.createElement(InfiniteTableColumnCell, {
4942
5362
  key: col.id,
4943
5363
  virtualized: false,
5364
+ rowHeight,
5365
+ getData,
5366
+ hidden,
5367
+ groupRenderStrategy: componentState.groupRenderStrategy,
4944
5368
  toggleGroupRow,
4945
- enhancedData,
5369
+ rowInfo,
4946
5370
  rowIndex,
4947
5371
  column: col
4948
5372
  });
@@ -4973,19 +5397,22 @@ function useUnpinnedRendering(params) {
4973
5397
  } = params;
4974
5398
  const { virtualizeColumns } = getState();
4975
5399
  const shouldVirtualizeColumns = typeof virtualizeColumns === "function" ? virtualizeColumns(computedUnpinnedColumns) : virtualizeColumns != null ? virtualizeColumns : true;
4976
- const renderRowUnpinned = (0, import_react32.useCallback)((rowInfo) => {
5400
+ const renderRowUnpinned = (0, import_react33.useCallback)((rowParams) => {
4977
5401
  const dataArray = getData();
4978
- const enhancedData = dataArray[rowInfo.rowIndex];
4979
- const { showZebraRows } = getState();
5402
+ const rowInfo = dataArray[rowParams.rowIndex];
5403
+ const { showZebraRows, showHoverRows } = getState();
4980
5404
  const rowProps = __spreadValues({
4981
- enhancedData,
5405
+ rowInfo,
4982
5406
  showZebraRows,
5407
+ showHoverRows,
5408
+ getData,
4983
5409
  toggleGroupRow,
4984
5410
  virtualizeColumns: shouldVirtualizeColumns,
4985
5411
  brain: null,
5412
+ verticalBrain: verticalVirtualBrain,
4986
5413
  columns: computedUnpinnedColumns,
4987
5414
  rowWidth: computedUnpinnedColumnsWidth
4988
- }, rowInfo);
5415
+ }, rowParams);
4989
5416
  if (shouldVirtualizeColumns) {
4990
5417
  rowProps.brain = horizontalVirtualBrain;
4991
5418
  rowProps.repaintId = repaintId;
@@ -4994,10 +5421,12 @@ function useUnpinnedRendering(params) {
4994
5421
  return /* @__PURE__ */ React30.createElement(TableRowComponent, __spreadValues({}, rowProps));
4995
5422
  }, [
4996
5423
  repaintId,
5424
+ rowHeight,
4997
5425
  computedUnpinnedColumns,
4998
5426
  computedUnpinnedColumnsWidth,
4999
5427
  shouldVirtualizeColumns,
5000
- horizontalVirtualBrain
5428
+ horizontalVirtualBrain,
5429
+ verticalVirtualBrain
5001
5430
  ]);
5002
5431
  const fakeScrollbar = getScrollbarWidth() ? /* @__PURE__ */ React30.createElement("div", {
5003
5432
  "data-name": "horizontal-scrollbar-placeholder--fake",
@@ -5034,18 +5463,45 @@ function useUnpinnedRendering(params) {
5034
5463
  }
5035
5464
 
5036
5465
  // src/components/InfiniteTable/hooks/useOnContainerScroll.ts
5037
- 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
5038
5478
  var DELAY = 200;
5039
5479
  var TableClassName = internalProps.rootClassName;
5040
5480
  var TableClassName__Scrolling = `${TableClassName}--scrolling`;
5481
+ var SCROLL_BOTTOM_OFFSET = 0;
5041
5482
  var useOnContainerScroll = ({
5042
5483
  verticalVirtualBrain,
5043
5484
  horizontalVirtualBrain,
5044
- domRef
5485
+ reservedContentHeight
5045
5486
  }) => {
5046
- const timeoutIdRef = (0, import_react33.useRef)(0);
5047
- const scrollingRef = (0, import_react33.useRef)(false);
5048
- 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) => {
5049
5505
  var _a;
5050
5506
  const prevScrolling = scrollingRef.current;
5051
5507
  scrollingRef.current = scrolling;
@@ -5064,13 +5520,13 @@ var useOnContainerScroll = ({
5064
5520
  return;
5065
5521
  }
5066
5522
  if (scrolling) {
5067
- classList.add(TableClassName__Scrolling);
5523
+ classList.add(InfiniteClsScrolling, TableClassName__Scrolling);
5068
5524
  } else {
5069
- classList.remove(TableClassName__Scrolling);
5525
+ classList.remove(InfiniteClsScrolling, TableClassName__Scrolling);
5070
5526
  }
5071
5527
  }
5072
5528
  }, []);
5073
- const onContainerScroll = (0, import_react33.useCallback)((scrollInfo) => {
5529
+ const onContainerScroll = (0, import_react34.useCallback)((scrollInfo) => {
5074
5530
  verticalVirtualBrain.setScrollPosition(scrollInfo);
5075
5531
  horizontalVirtualBrain.setScrollPosition(scrollInfo);
5076
5532
  setScrolling(true);
@@ -5080,37 +5536,44 @@ var useOnContainerScroll = ({
5080
5536
  domRef.current,
5081
5537
  setScrolling
5082
5538
  ]);
5083
- const scrollPositionRef = (0, import_react33.useRef)({
5539
+ const scrollPositionRef = (0, import_react34.useRef)({
5084
5540
  scrollLeft: 0,
5085
5541
  scrollTop: 0
5086
5542
  });
5087
- const applyScrollHorizontal = (0, import_react33.useCallback)(({ scrollLeft }) => {
5543
+ const applyScrollHorizontal = (0, import_react34.useCallback)(({ scrollLeft }) => {
5088
5544
  scrollPositionRef.current.scrollLeft = scrollLeft;
5089
5545
  onContainerScroll(scrollPositionRef.current);
5090
5546
  }, [onContainerScroll]);
5091
- const applyScrollVertical = (0, import_react33.useCallback)(({ scrollTop }) => {
5547
+ const applyScrollVertical = (0, import_react34.useCallback)(({ scrollTop }) => {
5092
5548
  scrollPositionRef.current.scrollTop = scrollTop;
5093
5549
  onContainerScroll(scrollPositionRef.current);
5094
- }, [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]);
5095
5559
  return {
5096
5560
  applyScrollHorizontal,
5097
- applyScrollVertical,
5098
- scrollPositionRef
5561
+ applyScrollVertical
5099
5562
  };
5100
5563
  };
5101
5564
 
5102
5565
  // src/components/InfiniteTable/hooks/usePinnedRendering.tsx
5103
5566
  var React32 = __toModule(require("react"));
5104
- var import_react36 = __toModule(require("react"));
5567
+ var import_react37 = __toModule(require("react"));
5105
5568
 
5106
5569
  // src/components/VirtualList/RowListWithExternalScrolling.tsx
5107
5570
  var React31 = __toModule(require("react"));
5108
- var import_react35 = __toModule(require("react"));
5571
+ var import_react36 = __toModule(require("react"));
5109
5572
 
5110
5573
  // src/components/hooks/useOnMount.ts
5111
- var import_react34 = __toModule(require("react"));
5574
+ var import_react35 = __toModule(require("react"));
5112
5575
  function useOnMount(domRef, props) {
5113
- (0, import_react34.useEffect)(() => {
5576
+ (0, import_react35.useEffect)(() => {
5114
5577
  const { onMount, onUnmount } = props;
5115
5578
  const node = domRef == null ? void 0 : domRef.current;
5116
5579
  onMount == null ? void 0 : onMount(node);
@@ -5120,12 +5583,15 @@ function useOnMount(domRef, props) {
5120
5583
  }, []);
5121
5584
  }
5122
5585
 
5586
+ // src/components/VirtualList/InfiniteListRootClassName.ts
5587
+ var InfiniteListRootClassName = "InfiniteList";
5588
+
5123
5589
  // src/components/VirtualList/RowListWithExternalScrolling.tsx
5124
- var rootClassName10 = "IList";
5590
+ var rootClassName10 = InfiniteListRootClassName;
5125
5591
  var defaultClasses = [
5126
- ICSS.willChange.transform,
5127
- ICSS.position.relative,
5128
- ICSS.transform.translate3D000
5592
+ willChange.transform,
5593
+ position.relative,
5594
+ transformTranslateZero
5129
5595
  ];
5130
5596
  var RowListWithExternalScrolling = (props) => {
5131
5597
  const {
@@ -5138,8 +5604,8 @@ var RowListWithExternalScrolling = (props) => {
5138
5604
  onMount,
5139
5605
  onUnmount
5140
5606
  } = props;
5141
- const domRef = (0, import_react35.useRef)(null);
5142
- 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({
5143
5609
  domRef: renderProps.domRef,
5144
5610
  rowHeight: renderProps.itemSize,
5145
5611
  rowIndex: renderProps.itemIndex
@@ -5148,7 +5614,7 @@ var RowListWithExternalScrolling = (props) => {
5148
5614
  onMount,
5149
5615
  onUnmount
5150
5616
  });
5151
- (0, import_react35.useEffect)(() => {
5617
+ (0, import_react36.useEffect)(() => {
5152
5618
  const onScroll = (scrollPosition) => {
5153
5619
  const node = domRef.current;
5154
5620
  if (node) {
@@ -5172,7 +5638,7 @@ var RowListWithExternalScrolling = (props) => {
5172
5638
  const domProps = {
5173
5639
  ref: domRef,
5174
5640
  style,
5175
- className: join(className, rootClassName10, `${rootClassName10}--vertical`, ...defaultClasses)
5641
+ className: join(className, rootClassName10, `${rootClassName10}--vertical`, VirtualListCls, VirtualListClsOrientation.vertical, ...defaultClasses)
5176
5642
  };
5177
5643
  if (false) {
5178
5644
  domProps["data-cmp-name"] = "RowListWithExternalScrolling";
@@ -5188,7 +5654,7 @@ var RowListWithExternalScrolling = (props) => {
5188
5654
  var UPDATE_SCROLL3 = (node, brainScrollPosition, horizontalPinnedScrollPosition) => {
5189
5655
  node.style.transform = `translate3d(${horizontalPinnedScrollPosition ? -horizontalPinnedScrollPosition.scrollLeft : 0}px, ${-brainScrollPosition.scrollTop}px, 0px)`;
5190
5656
  };
5191
- var PinnedRowsContainerClassName = `ITablePinnedRows`;
5657
+ var PinnedRowsContainerClassName = `InfinitePinnedRows`;
5192
5658
  function PinnedRowsContainer(props) {
5193
5659
  const {
5194
5660
  maxWidth,
@@ -5215,7 +5681,7 @@ function PinnedRowsContainer(props) {
5215
5681
  }
5216
5682
  return result;
5217
5683
  }, [height, rowWidth, pinning, hasOverflow]);
5218
- const updateScroll = (0, import_react36.useCallback)((node, scrollPosition) => {
5684
+ const updateScroll = (0, import_react37.useCallback)((node, scrollPosition) => {
5219
5685
  UPDATE_SCROLL3(node, scrollPosition, hasOverflow ? pinnedScrollListener.getScrollPosition() : void 0);
5220
5686
  }, [hasOverflow, pinnedScrollListener]);
5221
5687
  const rowListProps = {
@@ -5223,7 +5689,7 @@ function PinnedRowsContainer(props) {
5223
5689
  brain,
5224
5690
  renderRow,
5225
5691
  updateScroll,
5226
- className: join(`${PinnedRowsContainerClassName}`, `${PinnedRowsContainerClassName}--pinned-${pinning}`, `${PinnedRowsContainerClassName}--overflow`)
5692
+ className: join(`${PinnedRowsContainerClassName}`, PinnedRowsClsVariants[pinning === "start" ? "pinnedStart" : "pinnedEnd"], `${PinnedRowsContainerClassName}--pinned-${pinning}`, `${PinnedRowsContainerClassName}--overflow`, PinnedRowsClsVariants.overflow)
5227
5693
  };
5228
5694
  if (hasOverflow) {
5229
5695
  return /* @__PURE__ */ React32.createElement(VirtualScrollContainer, {
@@ -5239,7 +5705,9 @@ function PinnedRowsContainer(props) {
5239
5705
  [pinning === "start" ? "right" : "left"]: "unset"
5240
5706
  },
5241
5707
  onContainerScroll: pinnedScrollListener == null ? void 0 : pinnedScrollListener.setScrollPosition,
5242
- className: join(`${PinnedRowsContainerClassName}Container`, `${PinnedRowsContainerClassName}Container--pinned-${pinning}`)
5708
+ className: join(PinnedRowsContainerClsVariants({
5709
+ pinned: pinning
5710
+ }), `${PinnedRowsContainerClassName}Container`, `${PinnedRowsContainerClassName}Container--pinned-${pinning}`)
5243
5711
  }, /* @__PURE__ */ React32.createElement(RowListWithExternalScrolling, __spreadProps(__spreadValues({}, rowListProps), {
5244
5712
  onMount: (node) => {
5245
5713
  pinnedScrollListener == null ? void 0 : pinnedScrollListener.onScroll((scrollPosition) => {
@@ -5254,22 +5722,25 @@ function PinnedRowsContainer(props) {
5254
5722
  return /* @__PURE__ */ React32.createElement(RowListWithExternalScrolling, __spreadValues({}, rowListProps));
5255
5723
  }
5256
5724
  function useRenderPinnedRow(params) {
5257
- const { getData, getState, columnsWidth, columns } = params;
5258
- const renderPinnedRow = (0, import_react36.useCallback)((rowInfo) => {
5725
+ const { getData, getState, columnsWidth, columns, verticalBrain } = params;
5726
+ const renderPinnedRow = (0, import_react37.useCallback)((rowParams) => {
5259
5727
  const dataArray = getData();
5260
- const enhancedData = dataArray[rowInfo.rowIndex];
5261
- const { showZebraRows } = getState();
5728
+ const rowInfo = dataArray[rowParams.rowIndex];
5729
+ const { showZebraRows, showHoverRows } = getState();
5262
5730
  const rowProps = __spreadValues({
5263
- enhancedData,
5731
+ rowInfo,
5732
+ getData,
5264
5733
  showZebraRows,
5734
+ showHoverRows,
5265
5735
  toggleGroupRow: params.toggleGroupRow,
5266
5736
  virtualizeColumns: false,
5737
+ verticalBrain,
5267
5738
  brain: null,
5268
5739
  rowWidth: columnsWidth,
5269
5740
  columns
5270
- }, rowInfo);
5741
+ }, rowParams);
5271
5742
  return /* @__PURE__ */ React32.createElement(TableRowUnvirtualized, __spreadValues({}, rowProps));
5272
- }, [columnsWidth, columns]);
5743
+ }, [columnsWidth, columns, verticalBrain]);
5273
5744
  return renderPinnedRow;
5274
5745
  }
5275
5746
  function usePinnedRenderingForSide(side, params) {
@@ -5307,6 +5778,7 @@ function usePinnedRenderingForSide(side, params) {
5307
5778
  getData,
5308
5779
  getState,
5309
5780
  toggleGroupRow,
5781
+ verticalBrain: verticalVirtualBrain,
5310
5782
  columns,
5311
5783
  columnsWidth
5312
5784
  });
@@ -5365,7 +5837,7 @@ function usePinnedStartRendering(params) {
5365
5837
  }
5366
5838
 
5367
5839
  // src/components/InfiniteTable/hooks/useYourBrain.ts
5368
- var import_react38 = __toModule(require("react"));
5840
+ var import_react39 = __toModule(require("react"));
5369
5841
 
5370
5842
  // src/components/VirtualBrain/index.ts
5371
5843
  var import_binary_search2 = __toModule(require_binary_search());
@@ -5374,6 +5846,7 @@ var initialScrollPosition2 = {
5374
5846
  scrollTop: 0
5375
5847
  };
5376
5848
  var raf = typeof window !== "undefined" ? requestAnimationFrame : (fn) => setTimeout(fn, 0);
5849
+ var ItemIndexBag = Object.seal({ itemIndex: 0 });
5377
5850
  var SORT_ASC = (a, b) => a - b;
5378
5851
  var VirtualBrain = class extends Logger {
5379
5852
  constructor(options) {
@@ -5481,22 +5954,24 @@ var VirtualBrain = class extends Logger {
5481
5954
  this.onRenderRangeChangeFns = this.onRenderRangeChangeFns.filter((f) => f !== fn);
5482
5955
  };
5483
5956
  };
5484
- this.update = (newCount, newItemSize) => {
5485
- const { itemSize, count } = this.options;
5957
+ this.update = (newCount, newItemSize, newItemSpan) => {
5958
+ const { itemSize, count, itemSpan } = this.options;
5486
5959
  const countChange = count !== newCount;
5487
5960
  const itemSizeChange = itemSize !== newItemSize;
5488
- if (!countChange && !itemSizeChange) {
5961
+ const itemSpanChange = itemSpan !== newItemSpan;
5962
+ if (!countChange && !itemSizeChange && !itemSpanChange) {
5489
5963
  return;
5490
5964
  }
5491
5965
  this.options.count = newCount;
5492
5966
  this.options.itemSize = newItemSize;
5967
+ this.options.itemSpan = newItemSpan;
5493
5968
  const size = this.availableSize[this.options.mainAxis === "vertical" ? "height" : "width"];
5494
5969
  const newRenderCount = this.computeRenderCount({
5495
5970
  itemSize: newItemSize,
5496
5971
  count: newCount,
5497
5972
  size
5498
5973
  });
5499
- if (!itemSizeChange && countChange && newCount > count) {
5974
+ if (!itemSizeChange && !itemSpanChange && countChange && newCount > count) {
5500
5975
  const currentRenderCount = this.getRenderCount();
5501
5976
  if (currentRenderCount > newRenderCount) {
5502
5977
  return;
@@ -5521,11 +5996,43 @@ var VirtualBrain = class extends Logger {
5521
5996
  this.updateRenderCount(newRenderCount);
5522
5997
  };
5523
5998
  this.reset = () => {
5999
+ this.itemSpanParent = [];
6000
+ this.itemSpanValue = [];
5524
6001
  this.itemSizeCache = [];
5525
6002
  this.itemOffsetCache = [0];
5526
6003
  this.renderCount = -1;
5527
6004
  this.totalSize = 0;
5528
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
+ };
5529
6036
  this.computeCacheFor = (itemIndex) => {
5530
6037
  if (typeof this.options.itemSize !== "function") {
5531
6038
  return;
@@ -5545,6 +6052,33 @@ var VirtualBrain = class extends Logger {
5545
6052
  this.itemOffsetCache[itemIndex] = offset;
5546
6053
  }
5547
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
+ };
5548
6082
  this.getItemSize = (itemIndex) => {
5549
6083
  const { itemSize, count } = this.options;
5550
6084
  if (typeof itemSize !== "function") {
@@ -5691,7 +6225,7 @@ var VirtualBrain = class extends Logger {
5691
6225
  }
5692
6226
  computeRenderRange() {
5693
6227
  const count = this.getOptions().count;
5694
- const renderCount = this.getRenderCount();
6228
+ let renderCount = this.getRenderCount();
5695
6229
  if (renderCount === 0) {
5696
6230
  return {
5697
6231
  renderStartIndex: -1,
@@ -5704,6 +6238,12 @@ var VirtualBrain = class extends Logger {
5704
6238
  renderEndIndex = count - 1;
5705
6239
  renderStartIndex = renderEndIndex - renderCount + 1;
5706
6240
  }
6241
+ if (this.options.itemSpan) {
6242
+ this.computeItemSpanUpTo(renderStartIndex);
6243
+ while (this.itemSpanParent[renderStartIndex] != renderStartIndex) {
6244
+ renderStartIndex--;
6245
+ }
6246
+ }
5707
6247
  return {
5708
6248
  renderStartIndex,
5709
6249
  renderEndIndex
@@ -5715,9 +6255,9 @@ var VirtualBrain = class extends Logger {
5715
6255
  };
5716
6256
 
5717
6257
  // src/components/InfiniteTable/hooks/useColumnSizeFn.ts
5718
- var import_react37 = __toModule(require("react"));
6258
+ var import_react38 = __toModule(require("react"));
5719
6259
  function useColumnSizeFn(computedUnpinnedColumns) {
5720
- const columnSize = (0, import_react37.useCallback)((index) => {
6260
+ const columnSize = (0, import_react38.useCallback)((index) => {
5721
6261
  const column = computedUnpinnedColumns[index];
5722
6262
  if (!column) {
5723
6263
  console.log("cannot find column at index", index, computedUnpinnedColumns);
@@ -5735,7 +6275,8 @@ function useYourBrain(param) {
5735
6275
  computedPinnedStartWidth,
5736
6276
  computedPinnedEndWidth,
5737
6277
  rowHeight,
5738
- bodySize
6278
+ bodySize,
6279
+ rowSpan
5739
6280
  } = param;
5740
6281
  const columnSize = useColumnSizeFn(computedUnpinnedColumns);
5741
6282
  const horizontalVirtualBrain = useOnce(() => {
@@ -5750,20 +6291,21 @@ function useYourBrain(param) {
5750
6291
  const brain = new VirtualBrain({
5751
6292
  count: dataArray.length,
5752
6293
  itemSize: rowHeight,
5753
- mainAxis: "vertical"
6294
+ mainAxis: "vertical",
6295
+ itemSpan: rowSpan
5754
6296
  });
5755
6297
  return brain;
5756
6298
  });
5757
6299
  horizontalVirtualBrain.update(computedUnpinnedColumns.length, columnSize);
5758
- verticalVirtualBrain.update(dataArray.length, rowHeight);
6300
+ verticalVirtualBrain.update(dataArray.length, rowHeight, rowSpan);
5759
6301
  globalThis.verticalVirtualBrain = verticalVirtualBrain;
5760
- (0, import_react38.useEffect)(() => {
6302
+ (0, import_react39.useEffect)(() => {
5761
6303
  verticalVirtualBrain.setAvailableSize({
5762
6304
  height: bodySize.height,
5763
6305
  width: 0
5764
6306
  });
5765
6307
  }, [bodySize, verticalVirtualBrain]);
5766
- (0, import_react38.useEffect)(() => {
6308
+ (0, import_react39.useEffect)(() => {
5767
6309
  horizontalVirtualBrain.setAvailableSize({
5768
6310
  height: 0,
5769
6311
  width: Math.max(bodySize.width - computedPinnedStartWidth - computedPinnedEndWidth, 0)
@@ -5797,7 +6339,7 @@ function shallowEqualObjects(objA, objB) {
5797
6339
 
5798
6340
  // src/components/InfiniteTable/hooks/useListRendering.tsx
5799
6341
  function useListRendering(param) {
5800
- const { computed, domRef, bodySize, columnShifts } = param;
6342
+ const { computed, bodySize, columnShifts } = param;
5801
6343
  const { componentActions, componentState, getState } = useInfiniteTable();
5802
6344
  const prevComputed = usePrevious(computed, null);
5803
6345
  const {
@@ -5810,40 +6352,68 @@ function useListRendering(param) {
5810
6352
  computedUnpinnedColumns,
5811
6353
  computedUnpinnedColumnsWidth,
5812
6354
  computedPinnedStartOverflow,
5813
- computedPinnedEndOverflow
6355
+ computedPinnedEndOverflow,
6356
+ computedVisibleColumns
5814
6357
  } = computed;
5815
6358
  const { componentState: dataSourceState, getState: getDataSourceState } = useDataSourceContextValue();
5816
6359
  const { dataArray } = dataSourceState;
5817
6360
  const getData = useLatest(dataArray);
5818
6361
  const {
5819
- rowHeightComputed: rowHeight,
6362
+ rowHeight,
5820
6363
  pinnedStartMaxWidth,
5821
6364
  pinnedEndMaxWidth,
5822
6365
  pinnedStartScrollListener,
5823
6366
  pinnedEndScrollListener
5824
6367
  } = componentState;
5825
6368
  const prevDataSourceTimestamp = usePrevious(dataSourceState.updatedAt);
5826
- const repaintIdRef = (0, import_react39.useRef)(0);
6369
+ const repaintIdRef = (0, import_react40.useRef)(0);
5827
6370
  if (!shallowEqualObjects(prevComputed, computed) || prevDataSourceTimestamp !== dataSourceState.updatedAt) {
5828
6371
  repaintIdRef.current++;
5829
6372
  }
5830
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]);
5831
6400
  const { horizontalVirtualBrain, verticalVirtualBrain } = useYourBrain({
5832
6401
  computedPinnedStartWidth: computed.computedPinnedStartWidth,
5833
6402
  computedPinnedEndWidth: computed.computedPinnedEndWidth,
5834
6403
  computedUnpinnedColumns: computed.computedUnpinnedColumns,
5835
6404
  rowHeight,
5836
6405
  dataArray,
5837
- bodySize
6406
+ bodySize,
6407
+ rowSpan
5838
6408
  });
5839
6409
  const hasHorizontalScrollbar = computedUnpinnedColumnsWidth > bodySize.width - computedPinnedStartColumnsWidth - computedPinnedEndColumnsWidth;
5840
6410
  const reservedContentHeight = verticalVirtualBrain.getTotalSize() + (hasHorizontalScrollbar ? getScrollbarWidth() : 0);
5841
6411
  const hasVerticalScrollbar = bodySize.height < reservedContentHeight;
5842
- const scrollbars = (0, import_react39.useMemo)(() => ({
6412
+ const scrollbars = (0, import_react40.useMemo)(() => ({
5843
6413
  vertical: hasVerticalScrollbar,
5844
6414
  horizontal: hasHorizontalScrollbar
5845
6415
  }), [hasVerticalScrollbar, hasHorizontalScrollbar]);
5846
- (0, import_react39.useEffect)(() => {
6416
+ (0, import_react40.useEffect)(() => {
5847
6417
  if (!bodySize.height) {
5848
6418
  return;
5849
6419
  }
@@ -5866,10 +6436,10 @@ function useListRendering(param) {
5866
6436
  const { applyScrollHorizontal, applyScrollVertical } = useOnContainerScroll({
5867
6437
  verticalVirtualBrain,
5868
6438
  horizontalVirtualBrain,
5869
- domRef
6439
+ reservedContentHeight
5870
6440
  });
5871
6441
  const { componentActions: dataSourceActions } = useDataSourceContextValue();
5872
- const toggleGroupRow = (0, import_react39.useCallback)((groupKeys) => {
6442
+ const toggleGroupRow = (0, import_react40.useCallback)((groupKeys) => {
5873
6443
  const newState = new GroupRowsState(getDataSourceState().groupRowsState);
5874
6444
  newState.toggleGroupRow(groupKeys);
5875
6445
  dataSourceActions.groupRowsState = newState;
@@ -5904,7 +6474,7 @@ function useListRendering(param) {
5904
6474
  computedUnpinnedColumns
5905
6475
  });
5906
6476
  const [, rerender] = useRerender();
5907
- (0, import_react39.useEffect)(() => {
6477
+ (0, import_react40.useEffect)(() => {
5908
6478
  rerender();
5909
6479
  }, [dataSourceState]);
5910
6480
  const { pinnedStartList, pinnedStartScrollbarPlaceholder } = usePinnedStartRendering(pinnedRenderingParams);
@@ -5928,7 +6498,7 @@ function useListRendering(param) {
5928
6498
 
5929
6499
  // src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
5930
6500
  var React33 = __toModule(require("react"));
5931
- var import_react40 = __toModule(require("react"));
6501
+ var import_react41 = __toModule(require("react"));
5932
6502
 
5933
6503
  // src/components/utils/decamelize.ts
5934
6504
  var import_decamelize = __toModule(require_decamelize());
@@ -5939,7 +6509,7 @@ var decamelize = (input, options) => {
5939
6509
 
5940
6510
  // src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
5941
6511
  var defaultStyle2 = {
5942
- padding: "var(--it-space-2)",
6512
+ padding: ThemeVars.spacing[2],
5943
6513
  textAlign: "end",
5944
6514
  opacity: "1",
5945
6515
  visibility: "visible",
@@ -5965,7 +6535,7 @@ var enforceStyle = (node, style) => {
5965
6535
  }
5966
6536
  };
5967
6537
  var InfiniteTableLicenseFooter = React33.forwardRef(function InfiniteTableLicenseFooter2(props, ref) {
5968
- const { rootClassName: rootClassName11 } = useInternalProps();
6538
+ const { rootClassName: rootClassName12 } = useInternalProps();
5969
6539
  const domRef = React33.useRef(null);
5970
6540
  const domCallback = React33.useCallback((node) => {
5971
6541
  domRef.current = node;
@@ -5978,7 +6548,7 @@ var InfiniteTableLicenseFooter = React33.forwardRef(function InfiniteTableLicens
5978
6548
  ref.current = node;
5979
6549
  }
5980
6550
  }, []);
5981
- (0, import_react40.useEffect)(() => {
6551
+ (0, import_react41.useEffect)(() => {
5982
6552
  const forceStyle = () => {
5983
6553
  requestAnimationFrame(() => {
5984
6554
  var _a;
@@ -5995,7 +6565,7 @@ var InfiniteTableLicenseFooter = React33.forwardRef(function InfiniteTableLicens
5995
6565
  return /* @__PURE__ */ React33.createElement("div", __spreadProps(__spreadValues({
5996
6566
  ref: domCallback
5997
6567
  }, props), {
5998
- className: join(`${rootClassName11}Footer`, ICSS.position.relative, props.className),
6568
+ className: join(`${rootClassName12}-Footer`, FooterCls, props.className),
5999
6569
  style: defaultStyle2
6000
6570
  }), "Powered by", " ", /* @__PURE__ */ React33.createElement("a", {
6001
6571
  href: "https://infinite-table.com",
@@ -6006,7 +6576,7 @@ var InfiniteTableLicenseFooter = React33.forwardRef(function InfiniteTableLicens
6006
6576
  });
6007
6577
 
6008
6578
  // src/components/InfiniteTable/hooks/useLicense/useLicense.ts
6009
- var import_react41 = __toModule(require("react"));
6579
+ var import_react42 = __toModule(require("react"));
6010
6580
 
6011
6581
  // src/components/InfiniteTable/hooks/useLicense/crc32.ts
6012
6582
  var DEFAULT_ReversedPolynomial = 3988292384;
@@ -6151,20 +6721,28 @@ var decode = (licenseKey) => {
6151
6721
  };
6152
6722
 
6153
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";
6154
6728
  var useLicense = (licenseKey) => {
6155
- const valid = (0, import_react41.useMemo)(() => {
6156
- return isValidLicense(licenseKey, {
6729
+ const valid = (0, import_react42.useMemo)(() => {
6730
+ let valid2 = isValidLicense(licenseKey, {
6157
6731
  publishedAt: 1624970570587,
6158
- version: "0.0.2-canary.1"
6732
+ version: "0.0.2-canary.5"
6159
6733
  });
6734
+ if (!valid2 && isInsideSandbox) {
6735
+ return true;
6736
+ }
6737
+ return valid2;
6160
6738
  }, [licenseKey]);
6161
6739
  return valid;
6162
6740
  };
6163
6741
 
6164
6742
  // src/components/CSSVariableWatch.tsx
6165
6743
  var React34 = __toModule(require("react"));
6166
- var import_react42 = __toModule(require("react"));
6167
- var error = err("CSSVariableWatch");
6744
+ var import_react43 = __toModule(require("react"));
6745
+ var error2 = err("CSSVariableWatch");
6168
6746
  var debug5 = dbg("CSSVariableWatch");
6169
6747
  var WRAPPER_STYLE = {
6170
6748
  position: "absolute",
@@ -6176,7 +6754,7 @@ var WRAPPER_STYLE = {
6176
6754
  overflow: "hidden"
6177
6755
  };
6178
6756
  var useCSSVariableWatch = (params) => {
6179
- const lastValueRef = (0, import_react42.useRef)(0);
6757
+ const lastValueRef = (0, import_react43.useRef)(0);
6180
6758
  const onResize = React34.useCallback(({ height }) => {
6181
6759
  if (height && height !== lastValueRef.current) {
6182
6760
  lastValueRef.current = height;
@@ -6191,12 +6769,12 @@ var useCSSVariableWatch = (params) => {
6191
6769
  debug5(`Variable ${params.varName} found and equals ${value}.`);
6192
6770
  params.onChange(value);
6193
6771
  } else {
6194
- 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.`);
6195
6773
  }
6196
6774
  }, []);
6197
6775
  };
6198
6776
  var CSSVariableWatch = (props) => {
6199
- const domRef = (0, import_react42.useRef)(null);
6777
+ const domRef = (0, import_react43.useRef)(null);
6200
6778
  useCSSVariableWatch(__spreadProps(__spreadValues({}, props), {
6201
6779
  ref: domRef
6202
6780
  }));
@@ -6207,11 +6785,118 @@ var CSSVariableWatch = (props) => {
6207
6785
  }, /* @__PURE__ */ React34.createElement("div", {
6208
6786
  ref: domRef,
6209
6787
  style: {
6210
- height: `var(${props.varName})`
6788
+ height: props.varName.startsWith("var(") ? props.varName : `var(${props.varName})`
6211
6789
  }
6212
6790
  }));
6213
6791
  };
6214
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
+
6215
6900
  // src/components/InfiniteTable/index.tsx
6216
6901
  var InfiniteTableClassName = internalProps.rootClassName;
6217
6902
  var ONLY_VERTICAL_SCROLLBAR = {
@@ -6219,26 +6904,33 @@ var ONLY_VERTICAL_SCROLLBAR = {
6219
6904
  vertical: true
6220
6905
  };
6221
6906
  var InfiniteTableRoot = getComponentStateRoot({
6222
- getInitialState,
6223
- deriveReadOnlyState,
6907
+ initSetupState,
6908
+ forwardProps,
6909
+ mapPropsToState,
6910
+ allowedControlledPropOverrides: {
6911
+ rowHeight: true,
6912
+ headerHeight: true
6913
+ },
6224
6914
  getParentState: () => useDataSource()
6225
6915
  });
6226
- var InfiniteTableComponent = React35.memo(function InfiniteTableComponent2() {
6916
+ var InfiniteTableComponent = React36.memo(function InfiniteTableComponent2() {
6917
+ var _a;
6227
6918
  const { componentState, getComputed, computed } = useInfiniteTable();
6228
6919
  const {
6229
- componentState: { dataArray }
6920
+ componentState: { dataArray, loading }
6230
6921
  } = useDataSourceContextValue();
6231
6922
  const {
6232
6923
  domRef,
6233
- bodyDOMRef,
6924
+ scrollerDOMRef,
6234
6925
  portalDOMRef,
6235
- domProps,
6236
6926
  licenseKey,
6927
+ loadingText,
6237
6928
  header,
6238
- onRowHeightChange,
6239
- onHeaderHeightChange,
6929
+ onRowHeightCSSVarChange,
6930
+ onHeaderHeightCSSVarChange,
6240
6931
  rowHeightCSSVar,
6241
- headerHeightCSSVar
6932
+ headerHeightCSSVar,
6933
+ components
6242
6934
  } = componentState;
6243
6935
  const { columnShifts, bodySize } = componentState;
6244
6936
  const {
@@ -6260,39 +6952,40 @@ var InfiniteTableComponent = React35.memo(function InfiniteTableComponent2() {
6260
6952
  computed
6261
6953
  });
6262
6954
  const licenseValid = useLicense(licenseKey);
6263
- 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);
6264
- 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({
6265
6958
  ref: domRef
6266
- }, domProps), {
6267
- className
6268
- }), header ? /* @__PURE__ */ React35.createElement(TableHeaderWrapper, {
6959
+ }, domProps), header ? /* @__PURE__ */ React36.createElement(TableHeaderWrapper, {
6269
6960
  brain: horizontalVirtualBrain,
6270
6961
  repaintId,
6271
6962
  scrollbars
6272
- }) : null, /* @__PURE__ */ React35.createElement(InfiniteTableBody, null, /* @__PURE__ */ React35.createElement(VirtualScrollContainer, {
6273
- ref: bodyDOMRef,
6963
+ }) : null, /* @__PURE__ */ React36.createElement(InfiniteTableBody, null, /* @__PURE__ */ React36.createElement(VirtualScrollContainer, {
6964
+ ref: scrollerDOMRef,
6274
6965
  onContainerScroll: applyScrollVertical,
6275
6966
  scrollable: ONLY_VERTICAL_SCROLLBAR
6276
- }, /* @__PURE__ */ React35.createElement("div", {
6277
- className: ICSS.display.flex
6278
- }, pinnedStartList, centerList, pinnedEndList), /* @__PURE__ */ React35.createElement(SpacePlaceholder, {
6967
+ }, /* @__PURE__ */ React36.createElement("div", {
6968
+ className: display.flex
6969
+ }, pinnedStartList, centerList, pinnedEndList), /* @__PURE__ */ React36.createElement(SpacePlaceholder, {
6279
6970
  count: dataArray.length,
6280
6971
  width: 0,
6281
6972
  height: reservedContentHeight
6282
- })), 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", {
6283
6976
  ref: portalDOMRef,
6284
- className: "ITable-Portal"
6285
- }), rowHeightCSSVar ? /* @__PURE__ */ React35.createElement(CSSVariableWatch, {
6977
+ className: join(`${rootClassName}Portal`, zIndex[1e3], position.absolute, top[0], left[0])
6978
+ }), rowHeightCSSVar ? /* @__PURE__ */ React36.createElement(CSSVariableWatch, {
6286
6979
  varName: rowHeightCSSVar,
6287
- onChange: onRowHeightChange
6288
- }) : null, headerHeightCSSVar ? /* @__PURE__ */ React35.createElement(CSSVariableWatch, {
6980
+ onChange: onRowHeightCSSVarChange
6981
+ }) : null, headerHeightCSSVar ? /* @__PURE__ */ React36.createElement(CSSVariableWatch, {
6289
6982
  varName: headerHeightCSSVar,
6290
- onChange: onHeaderHeightChange
6983
+ onChange: onHeaderHeightCSSVarChange
6291
6984
  }) : null);
6292
6985
  });
6293
6986
  function InfiniteTableContextProvider() {
6294
6987
  const { componentActions, componentState } = useComponentState();
6295
- const { bodyDOMRef, bodySizeRef } = componentState;
6988
+ const { scrollerDOMRef } = componentState;
6296
6989
  const computed = useComputed();
6297
6990
  const getComputed = useLatest(computed);
6298
6991
  const getState = useLatest(componentState);
@@ -6307,14 +7000,13 @@ function InfiniteTableContextProvider() {
6307
7000
  getComputed,
6308
7001
  getState
6309
7002
  };
6310
- useResizeObserver(bodyDOMRef, (size) => {
7003
+ useResizeObserver(scrollerDOMRef, (size) => {
6311
7004
  var _a, _b;
6312
7005
  const bodySize = {
6313
7006
  width: size.width,
6314
7007
  height: size.height
6315
7008
  };
6316
- bodySize.width = (_b = (_a = bodyDOMRef.current) == null ? void 0 : _a.scrollWidth) != null ? _b : bodySize.width;
6317
- bodySizeRef.current = bodySize;
7009
+ bodySize.width = (_b = (_a = scrollerDOMRef.current) == null ? void 0 : _a.scrollWidth) != null ? _b : bodySize.width;
6318
7010
  const state = getState();
6319
7011
  if (!state.virtualizeHeader) {
6320
7012
  componentActions.bodySize = bodySize;
@@ -6322,21 +7014,22 @@ function InfiniteTableContextProvider() {
6322
7014
  }
6323
7015
  componentActions.bodySize = bodySize;
6324
7016
  }, { earlyAttach: true });
6325
- React35.useEffect(() => {
7017
+ React36.useEffect(() => {
6326
7018
  return () => {
6327
- componentState.onRowHeightChange.destroy();
6328
- componentState.onHeaderHeightChange.destroy();
7019
+ componentState.onRowHeightCSSVarChange.destroy();
7020
+ componentState.onHeaderHeightCSSVarChange.destroy();
6329
7021
  };
6330
7022
  }, []);
6331
7023
  const TableContext2 = getInfiniteTableContext();
6332
- return /* @__PURE__ */ React35.createElement(TableContext2.Provider, {
7024
+ return /* @__PURE__ */ React36.createElement(TableContext2.Provider, {
6333
7025
  value: contextValue
6334
- }, /* @__PURE__ */ React35.createElement(InfiniteTableComponent, null));
7026
+ }, /* @__PURE__ */ React36.createElement(InfiniteTableComponent, null));
6335
7027
  }
6336
7028
  function InfiniteTable(props) {
6337
- 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);
6338
7031
  }
6339
7032
  InfiniteTable.defaultProps = {
6340
7033
  rowHeight: 40,
6341
- headerHeight: "--ITableHeader__height"
7034
+ headerHeight: ThemeVars.components.Header.height
6342
7035
  };