@infinite-table/infinite-react 0.0.2-canary.2 → 0.0.2-canary.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.esm.js CHANGED
@@ -465,14 +465,14 @@ var require_browser = __commonJS({
465
465
  } else {
466
466
  exports.storage.removeItem("debug");
467
467
  }
468
- } catch (error2) {
468
+ } catch (error3) {
469
469
  }
470
470
  }
471
471
  function load() {
472
472
  let r;
473
473
  try {
474
474
  r = exports.storage.getItem("debug");
475
- } catch (error2) {
475
+ } catch (error3) {
476
476
  }
477
477
  if (!r && typeof process !== "undefined" && "env" in process) {
478
478
  r = process.env.DEBUG;
@@ -482,7 +482,7 @@ var require_browser = __commonJS({
482
482
  function localstorage() {
483
483
  try {
484
484
  return localStorage;
485
- } catch (error2) {
485
+ } catch (error3) {
486
486
  }
487
487
  }
488
488
  module.exports = require_common()(exports);
@@ -490,8 +490,8 @@ var require_browser = __commonJS({
490
490
  formatters.j = function(v) {
491
491
  try {
492
492
  return JSON.stringify(v);
493
- } catch (error2) {
494
- return "[UnexpectedJSONParseError]: " + error2.message;
493
+ } catch (error3) {
494
+ return "[UnexpectedJSONParseError]: " + error3.message;
495
495
  }
496
496
  };
497
497
  }
@@ -566,16 +566,13 @@ var require_decamelize = __commonJS({
566
566
  // src/components/InfiniteTable/index.tsx
567
567
  import {
568
568
  StrictMode,
569
- createElement as createElement32,
570
- memo as memo12,
571
- useEffect as useEffect21
569
+ createElement as createElement33,
570
+ memo as memo13,
571
+ useEffect as useEffect22
572
572
  } from "react";
573
573
 
574
- // src/utils/join.ts
575
- var join = (...args) => args.filter((x) => !!`${x}`).join(" ");
576
-
577
574
  // src/components/InfiniteTable/internalProps.ts
578
- var rootClassName = "ITable";
575
+ var rootClassName = "Infinite";
579
576
  var internalProps = {
580
577
  rootClassName
581
578
  };
@@ -617,19 +614,6 @@ function buildSubscriptionCallback() {
617
614
  return updater;
618
615
  }
619
616
 
620
- // src/components/utils/isControlledValue.ts
621
- function isControlledValue(value) {
622
- const controlled = value !== void 0;
623
- return controlled;
624
- }
625
-
626
- // src/components/utils/isControlled.ts
627
- function isControlled(propName, props) {
628
- const propValue = props[propName];
629
- const controlled = isControlledValue(propValue);
630
- return controlled;
631
- }
632
-
633
617
  // src/components/VirtualBrain/ScrollListener.ts
634
618
  var initialScrollPosition = {
635
619
  scrollLeft: 0,
@@ -688,25 +672,15 @@ function computeColumnGroupsDepths(columnGroups) {
688
672
  }
689
673
 
690
674
  // src/components/InfiniteTable/state/getInitialState.ts
691
- function getInitialState(params) {
692
- var _a, _b, _c, _d, _e, _f;
693
- const { props } = params;
694
- const columnGroups = (_a = isControlled("columnGroups", props) ? props.columnGroups : props.defaultColumnGroups) != null ? _a : new Map();
695
- const pivotColumnGroups = props.pivotColumnGroups;
696
- const collapsedColumnGroups = (_b = isControlled("collapsedColumnGroups", props) ? props.collapsedColumnGroups : props.defaultCollapsedColumnGroups) != null ? _b : new Map();
697
- const computedColumnGroups = pivotColumnGroups || columnGroups;
698
- const columnGroupsDepthsMap = computeColumnGroupsDepths(computedColumnGroups);
699
- const generatedColumns = new Map();
700
- const pivotColumns = props.pivotColumns;
675
+ function initSetupState() {
676
+ const columnsGeneratedForGrouping = new Map();
701
677
  return {
702
- rowHeightComputed: typeof props.rowHeight === "number" ? props.rowHeight : 0,
703
- headerHeight: typeof props.headerHeight === "number" ? props.headerHeight : 0,
678
+ columnShifts: null,
704
679
  domRef: createRef(),
705
- bodyDOMRef: createRef(),
680
+ scrollerDOMRef: createRef(),
706
681
  portalDOMRef: createRef(),
707
- bodySizeRef: createRef(),
708
- onRowHeightChange: buildSubscriptionCallback(),
709
- onHeaderHeightChange: buildSubscriptionCallback(),
682
+ onRowHeightCSSVarChange: buildSubscriptionCallback(),
683
+ onHeaderHeightCSSVarChange: buildSubscriptionCallback(),
710
684
  bodySize: {
711
685
  width: 0,
712
686
  height: 0
@@ -715,65 +689,105 @@ function getInitialState(params) {
715
689
  scrollTop: 0,
716
690
  scrollLeft: 0
717
691
  },
692
+ focused: false,
693
+ focusedWithin: false,
694
+ columnsWhenGrouping: columnsGeneratedForGrouping,
718
695
  draggingColumnId: null,
719
- columns: props.columns,
720
- pivotColumns,
721
- pivotColumnGroups,
722
- generatedColumns,
723
- columnOrder: (_c = isControlled("columnOrder", props) ? props.columnOrder : props.defaultColumnOrder) != null ? _c : true,
724
- computedColumnGroups,
725
696
  pinnedStartScrollListener: new ScrollListener(),
726
697
  pinnedEndScrollListener: new ScrollListener(),
727
- columnGroups,
728
- collapsedColumnGroups,
729
- columnGroupsDepthsMap,
730
- columnGroupsMaxDepth: Math.max(...columnGroupsDepthsMap.values(), 0),
731
- columnVisibility: (_d = isControlled("columnVisibility", props) ? props.columnVisibility : props.defaultColumnVisibility) != null ? _d : new Map(),
732
- columnPinning: (_e = isControlled("columnPinning", props) ? props.columnPinning : props.defaultColumnPinning) != null ? _e : new Map(),
733
- columnAggregations: (_f = isControlled("columnAggregations", props) ? props.columnAggregations : props.defaultColumnAggregations) != null ? _f : new Map(),
734
- columnShifts: null,
735
- computedPivotColumns: void 0
698
+ computedPivotColumns: void 0,
699
+ columnsWhenInlineGroupRenderStrategy: void 0
700
+ };
701
+ }
702
+ var forwardProps = () => {
703
+ return {
704
+ columns: 1,
705
+ components: 1,
706
+ loadingText: 1,
707
+ pivotColumns: 1,
708
+ groupColumn: 1,
709
+ onReady: 1,
710
+ domProps: 1,
711
+ focusedClassName: 1,
712
+ focusedWithinClassName: 1,
713
+ focusedStyle: 1,
714
+ focusedWithinStyle: 1,
715
+ onSelfFocus: 1,
716
+ onFocusWithin: 1,
717
+ onSelfBlur: 1,
718
+ onBlurWithin: 1,
719
+ onScrollToTop: 1,
720
+ onScrollToBottom: 1,
721
+ scrollToBottomOffset: 1,
722
+ rowStyle: 1,
723
+ rowProps: 1,
724
+ rowClassName: 1,
725
+ pinnedStartMaxWidth: 1,
726
+ pinnedEndMaxWidth: 1,
727
+ pivotColumn: 1,
728
+ pivotRowLabelsColumn: 1,
729
+ pivotColumnGroups: 1,
730
+ activeIndex: (activeIndex) => activeIndex != null ? activeIndex : 0,
731
+ columnMinWidth: (columnMinWidth) => columnMinWidth != null ? columnMinWidth : 30,
732
+ columnMaxWidth: (columnMaxWidth) => columnMaxWidth != null ? columnMaxWidth : 2e3,
733
+ columnDefaultWidth: (columnDefaultWidth) => columnDefaultWidth != null ? columnDefaultWidth : 300,
734
+ draggableColumns: (draggableColumns) => draggableColumns != null ? draggableColumns : true,
735
+ sortable: (sortable) => sortable != null ? sortable : true,
736
+ hideEmptyGroupColumns: (hideEmptyGroupColumns) => hideEmptyGroupColumns != null ? hideEmptyGroupColumns : false,
737
+ pivotTotalColumnPosition: (pivotTotalColumnPosition) => pivotTotalColumnPosition != null ? pivotTotalColumnPosition : "end",
738
+ licenseKey: (licenseKey) => licenseKey || globalThis.InfiniteTableLicenseKey || "",
739
+ columnOrder: (columnOrder) => columnOrder != null ? columnOrder : true,
740
+ header: (header) => header != null ? header : true,
741
+ showZebraRows: (showZebraRows) => showZebraRows != null ? showZebraRows : true,
742
+ showHoverRows: (showHoverRows) => showHoverRows != null ? showHoverRows : true,
743
+ virtualizeColumns: (virtualizeColumns) => virtualizeColumns != null ? virtualizeColumns : true,
744
+ rowHeight: (rowHeight) => typeof rowHeight === "number" ? rowHeight : 0,
745
+ headerHeight: (headerHeight) => typeof headerHeight === "number" ? headerHeight : 0,
746
+ columnVisibility: (columnVisibility) => columnVisibility != null ? columnVisibility : new Map(),
747
+ columnPinning: (columnPinning) => columnPinning != null ? columnPinning : new Map(),
748
+ columnAggregations: (columnAggregations) => columnAggregations != null ? columnAggregations : new Map(),
749
+ collapsedColumnGroups: (collapsedColumnGroups) => collapsedColumnGroups != null ? collapsedColumnGroups : new Map(),
750
+ columnGroups: (columnGroups) => columnGroups != null ? columnGroups : new Map()
736
751
  };
752
+ };
753
+ function getGroupRenderStrategy(options) {
754
+ const { groupRowsBy, groupColumn, groupRenderStrategy } = options;
755
+ if (groupRenderStrategy) {
756
+ return groupRenderStrategy;
757
+ }
758
+ if (groupColumn != null && typeof groupColumn === "object") {
759
+ return "single-column";
760
+ }
761
+ const columnsInGroupRowsBy = groupRowsBy.filter((g) => g.column);
762
+ if (columnsInGroupRowsBy.length) {
763
+ return "multi-column";
764
+ }
765
+ return "multi-column";
737
766
  }
738
- function deriveReadOnlyState(params) {
739
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
740
- const { props, state, updated } = params;
741
- const virtualizeColumns = (_a = props.virtualizeColumns) != null ? _a : true;
742
- const header = (_b = props.header) != null ? _b : true;
767
+ var mapPropsToState = (params) => {
768
+ const { props, state, oldState, parentState } = params;
769
+ const { virtualizeColumns, header } = state;
743
770
  const computedColumnGroups = state.pivotColumnGroups || state.columnGroups;
744
771
  const virtualizeHeader = header && virtualizeColumns && (!computedColumnGroups || (computedColumnGroups == null ? void 0 : computedColumnGroups.size) === 0);
745
- const columnGroupsDepthsMap = (updated == null ? void 0 : updated.columnGroups) || (updated == null ? void 0 : updated.pivotColumnGroups) ? computeColumnGroupsDepths(computedColumnGroups) : state.columnGroupsDepthsMap;
746
- const pivotTotalColumnPosition = (_c = props.pivotTotalColumnPosition) != null ? _c : "end";
772
+ 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;
773
+ const groupRowsBy = parentState == null ? void 0 : parentState.groupRowsBy;
774
+ const groupRenderStrategy = getGroupRenderStrategy({
775
+ groupRenderStrategy: props.groupRenderStrategy,
776
+ groupRowsBy,
777
+ groupColumn: props.groupColumn
778
+ });
747
779
  return {
748
- groupColumn: props.groupColumn,
749
- onReady: props.onReady,
750
- domProps: props.domProps,
751
- showZebraRows: (_d = props.showZebraRows) != null ? _d : true,
752
- virtualizeColumns,
780
+ groupRenderStrategy,
781
+ groupRowsBy,
782
+ computedColumns: state.computedPivotColumns || state.columnsWhenGrouping || state.columnsWhenInlineGroupRenderStrategy || props.columns,
753
783
  virtualizeHeader,
754
- header,
755
- rowStyle: props.rowStyle,
756
- rowProps: props.rowProps,
757
- rowClassName: props.rowClassName,
758
- pinnedStartMaxWidth: props.pinnedStartMaxWidth,
759
- pinnedEndMaxWidth: props.pinnedEndMaxWidth,
760
- groupRenderStrategy: (_e = props.groupRenderStrategy) != null ? _e : "multi-column",
761
- pivotTotalColumnPosition,
762
- columnMinWidth: (_f = props.columnMinWidth) != null ? _f : 30,
763
- columnMaxWidth: (_g = props.columnMaxWidth) != null ? _g : 2e3,
764
- columnDefaultWidth: (_h = props.columnDefaultWidth) != null ? _h : 300,
765
- draggableColumns: (_i = props.draggableColumns) != null ? _i : true,
766
- pivotColumn: props.pivotColumn,
767
- pivotRowLabelsColumn: props.pivotRowLabelsColumn,
768
- sortable: (_j = props.sortable) != null ? _j : true,
769
784
  columnGroupsDepthsMap,
770
- columnGroupsMaxDepth: Math.max(...columnGroupsDepthsMap.values(), 0),
785
+ columnGroupsMaxDepth: columnGroupsDepthsMap != state.columnGroupsDepthsMap ? Math.max(...columnGroupsDepthsMap.values(), 0) : state.columnGroupsMaxDepth,
771
786
  computedColumnGroups,
772
- licenseKey: props.licenseKey || globalThis.InfiniteTableLicenseKey || "",
773
787
  rowHeightCSSVar: typeof props.rowHeight === "string" ? props.rowHeight : "",
774
- headerHeightCSSVar: typeof props.headerHeight === "string" ? props.headerHeight : ""
788
+ headerHeightCSSVar: typeof props.headerHeight === "string" ? props.headerHeight || "--ITableHeader__height" : ""
775
789
  };
776
- }
790
+ };
777
791
 
778
792
  // src/components/ResizeObserver/index.tsx
779
793
  import {
@@ -1042,10 +1056,34 @@ var adjustColumnOrderForPinning = (columnOrder, columnPinning) => {
1042
1056
  return columnOrder;
1043
1057
  };
1044
1058
 
1045
- // src/components/InfiniteTable/utils/getComputedVisibleColumns.ts
1046
- var IS_GROUP_COLUMN_ID = (columnId) => {
1047
- return columnId.startsWith("group-by");
1059
+ // src/utils/debug.ts
1060
+ var debug = require_browser();
1061
+ var debugTable = debug(`InfiniteTable`);
1062
+ var dbg = (channelName) => {
1063
+ const result = debugTable.extend(channelName);
1064
+ result.log = console.log.bind(console);
1065
+ return result;
1066
+ };
1067
+ var err = (channelName) => {
1068
+ const result = debugTable.extend(`${channelName}:error`);
1069
+ result.log = console.error.bind(console);
1070
+ return result;
1071
+ };
1072
+ var emptyLogFn = () => emptyLogFn;
1073
+ emptyLogFn.extend = () => emptyLogFn;
1074
+ var Logger = class {
1075
+ constructor(channelName) {
1076
+ this.debug = emptyLogFn;
1077
+ this.error = emptyLogFn;
1078
+ if (false) {
1079
+ this.debug = dbg(channelName);
1080
+ this.error = err(channelName);
1081
+ }
1082
+ }
1048
1083
  };
1084
+
1085
+ // src/components/InfiniteTable/utils/getComputedVisibleColumns.ts
1086
+ var error = err("getComputedVisibleColumns");
1049
1087
  var isColumnVisible = (columnVisibility, _columnVisibilityAssumeVisible, colId) => {
1050
1088
  return !columnVisibility.has(colId) || columnVisibility.get(colId) !== false;
1051
1089
  };
@@ -1056,7 +1094,6 @@ var getComputedPinned = (colId, columnPinning) => {
1056
1094
  };
1057
1095
  var getComputedVisibleColumns = ({
1058
1096
  columns,
1059
- generatedColumns,
1060
1097
  bodySize,
1061
1098
  columnMinWidth,
1062
1099
  columnMaxWidth,
@@ -1074,15 +1111,12 @@ var getComputedVisibleColumns = ({
1074
1111
  columnVisibilityAssumeVisible
1075
1112
  }) => {
1076
1113
  let computedOffset = 0;
1077
- const normalizedColumnOrder = adjustColumnOrderForPinning(columnOrder === true ? Array.from(generatedColumns.keys()).concat(...columns.keys()) : columnOrder, columnPinning);
1114
+ const normalizedColumnOrder = adjustColumnOrderForPinning(columnOrder === true ? [...columns.keys()] : columnOrder, columnPinning);
1078
1115
  const visibleColumnOrder = normalizedColumnOrder.filter(isColumnVisible.bind(null, columnVisibility, columnVisibilityAssumeVisible));
1079
1116
  const columnsArray = visibleColumnOrder.map((columnId) => {
1080
1117
  let col = columns.get(columnId);
1081
1118
  if (!col) {
1082
- col = generatedColumns.get(columnId);
1083
- if (!col && !IS_GROUP_COLUMN_ID(columnId)) {
1084
- throw `Column with id "${columnId}" specified in columnOrder array cannot be found in the columns map.`;
1085
- }
1119
+ error(`Column with id "${columnId}" specified in columnOrder array cannot be found in the columns map.`);
1086
1120
  }
1087
1121
  return col;
1088
1122
  }).filter(Boolean);
@@ -1326,13 +1360,13 @@ function interceptMap(map, fns) {
1326
1360
  // src/components/InfiniteTable/utils/rafFn.ts
1327
1361
  var rafFn = (fn) => {
1328
1362
  let rafId = 0;
1329
- return () => {
1363
+ return (...args) => {
1330
1364
  if (rafId) {
1331
1365
  cancelAnimationFrame(rafId);
1332
1366
  }
1333
1367
  rafId = requestAnimationFrame(() => {
1334
1368
  rafId = 0;
1335
- fn();
1369
+ fn(...args);
1336
1370
  });
1337
1371
  };
1338
1372
  };
@@ -1354,7 +1388,6 @@ var useRerenderOnKeyChange = (map) => {
1354
1388
  // src/components/InfiniteTable/hooks/useComputedVisibleColumns.ts
1355
1389
  var useComputedVisibleColumns = ({
1356
1390
  columns,
1357
- generatedColumns,
1358
1391
  bodySize,
1359
1392
  columnMinWidth,
1360
1393
  columnMaxWidth,
@@ -1392,7 +1425,6 @@ var useComputedVisibleColumns = ({
1392
1425
  } = useMemo2(() => {
1393
1426
  return getComputedVisibleColumns({
1394
1427
  columns,
1395
- generatedColumns,
1396
1428
  bodySize,
1397
1429
  columnMinWidth,
1398
1430
  columnMaxWidth,
@@ -1411,7 +1443,6 @@ var useComputedVisibleColumns = ({
1411
1443
  });
1412
1444
  }, [
1413
1445
  columns,
1414
- generatedColumns,
1415
1446
  bodySize.width,
1416
1447
  columnMinWidth,
1417
1448
  columnMaxWidth,
@@ -1493,46 +1524,62 @@ import {
1493
1524
  memo,
1494
1525
  useContext as useContext3
1495
1526
  } from "react";
1496
- import { useReducer, createContext as createContext3, useMemo as useMemo3, useEffect as useEffect4, useState as useState2 } from "react";
1527
+ import {
1528
+ useReducer,
1529
+ createContext as createContext3,
1530
+ useMemo as useMemo3,
1531
+ useEffect as useEffect4,
1532
+ useState as useState2,
1533
+ useRef as useRef4
1534
+ } from "react";
1497
1535
 
1498
- // src/utils/debug.ts
1499
- var debug = require_browser();
1500
- var debugTable = debug(`InfiniteTable`);
1501
- var dbg = (channelName) => {
1502
- const result = debugTable.extend(channelName);
1503
- result.log = console.log.bind(console);
1504
- return result;
1505
- };
1506
- var err = (channelName) => {
1507
- const result = debugTable.extend(`${channelName}:error`);
1508
- result.log = console.error.bind(console);
1509
- return result;
1510
- };
1511
- var emptyLogFn = () => emptyLogFn;
1512
- emptyLogFn.extend = () => emptyLogFn;
1513
- var Logger = class {
1514
- constructor(channelName) {
1515
- this.debug = emptyLogFn;
1516
- this.error = emptyLogFn;
1517
- if (false) {
1518
- this.debug = dbg(channelName);
1519
- this.error = err(channelName);
1520
- }
1536
+ // src/utils/proxyFnCall.ts
1537
+ function proxyFn(fn, config) {
1538
+ const propertyReads = new Set();
1539
+ function proxiedFn(...params) {
1540
+ const paramToProxy = config ? config.getProxyTargetFromArgs(...params) : params[0];
1541
+ propertyReads.clear();
1542
+ const handler = {
1543
+ get: function(obj, prop) {
1544
+ propertyReads.add(prop);
1545
+ return obj[prop];
1546
+ }
1547
+ };
1548
+ const proxy = new Proxy(paramToProxy, handler);
1549
+ const newParams = config ? config.putProxyToArgs(proxy, ...params) : [proxy];
1550
+ return fn.apply(this, newParams);
1521
1551
  }
1522
- };
1552
+ return {
1553
+ fn: proxiedFn,
1554
+ propertyReads
1555
+ };
1556
+ }
1523
1557
 
1524
1558
  // src/utils/toUpperFirst.ts
1525
1559
  var toUpperFirst = (s) => {
1526
1560
  return s ? s.substr(0, 1).toUpperCase() + s.substr(1) : s;
1527
1561
  };
1528
1562
 
1529
- // src/components/hooks/useLatest.ts
1563
+ // src/components/utils/isControlledValue.ts
1564
+ function isControlledValue(value) {
1565
+ const controlled = value !== void 0;
1566
+ return controlled;
1567
+ }
1568
+
1569
+ // src/components/utils/isControlled.ts
1570
+ function isControlled(propName, props) {
1571
+ const propValue = props[propName];
1572
+ const controlled = isControlledValue(propValue);
1573
+ return controlled;
1574
+ }
1575
+
1576
+ // src/components/hooks/useLatest.tsx
1530
1577
  import { useCallback as useCallback3, useRef as useRef2 } from "react";
1531
- var useLatest = (value) => {
1578
+ function useLatest(value) {
1532
1579
  const ref = useRef2(value);
1533
1580
  ref.current = value;
1534
1581
  return useCallback3(() => ref.current, []);
1535
- };
1582
+ }
1536
1583
 
1537
1584
  // src/components/hooks/usePrevious.ts
1538
1585
  import { useRef as useRef3, useLayoutEffect as useLayoutEffect2 } from "react";
@@ -1561,18 +1608,33 @@ function getComponentStateContext() {
1561
1608
  }
1562
1609
  return ComponentContext = createContext3(null);
1563
1610
  }
1564
- function getReducerActions(dispatch, state, getProps) {
1611
+ function getReducerActions(dispatch, getState, getProps, propsToForward, allowedControlledPropOverrides) {
1612
+ const state = getState();
1565
1613
  return Object.keys(state).reduce((actions, stateKey) => {
1566
1614
  const key = stateKey;
1567
1615
  const setter = (value) => {
1568
1616
  const props = getProps();
1617
+ const state2 = getState();
1618
+ const currentValue = state2[key];
1619
+ if (currentValue === value) {
1620
+ return;
1621
+ }
1569
1622
  notifyChange(props, stateKey, value);
1570
- if (isControlled(stateKey, props)) {
1623
+ const forwardFn = propsToForward[key];
1624
+ if (typeof forwardFn === "function") {
1625
+ value = forwardFn(value);
1626
+ }
1627
+ const allowControlled = !!(allowedControlledPropOverrides == null ? void 0 : allowedControlledPropOverrides[key]);
1628
+ if (isControlled(stateKey, props) && !allowControlled) {
1571
1629
  return;
1572
1630
  }
1573
1631
  dispatch({
1574
- propertyName: stateKey,
1575
- payload: value
1632
+ payload: {
1633
+ updatedProps: null,
1634
+ mappedState: {
1635
+ [stateKey]: value
1636
+ }
1637
+ }
1576
1638
  });
1577
1639
  };
1578
1640
  Object.defineProperty(actions, stateKey, {
@@ -1581,116 +1643,152 @@ function getReducerActions(dispatch, state, getProps) {
1581
1643
  return actions;
1582
1644
  }, {});
1583
1645
  }
1646
+ function forwardProps2(propsToForward, props) {
1647
+ const mappedState = {};
1648
+ for (let k in propsToForward)
1649
+ if (propsToForward.hasOwnProperty(k)) {
1650
+ const forwardFn = propsToForward[k];
1651
+ let propValue = isControlled(k, props) ? props[k] : props[`default${toUpperFirst(k)}`];
1652
+ if (typeof forwardFn === "function") {
1653
+ propValue = forwardFn(propValue);
1654
+ }
1655
+ mappedState[k] = propValue;
1656
+ }
1657
+ return mappedState;
1658
+ }
1584
1659
  function getComponentStateRoot(config) {
1585
1660
  return memo(function ComponentStateRoot(props) {
1586
- var _a;
1587
- const getParentState = config.getParentState;
1588
- const parentState = (_a = getParentState == null ? void 0 : getParentState()) != null ? _a : null;
1589
- const [{ state: wholeState, initialState }] = useState2(() => {
1590
- let initialState2 = config.getInitialState({
1591
- props,
1592
- parentState
1593
- });
1594
- if (config.deriveReadOnlyState) {
1595
- const readOnlyState = config.deriveReadOnlyState({
1661
+ var _a, _b;
1662
+ const propsToStateSetRef = useRef4(new Set());
1663
+ const propsToForward = useMemo3(() => config.forwardProps ? config.forwardProps() : {}, []);
1664
+ const parentState = (_b = (_a = config.getParentState) == null ? void 0 : _a.call(config)) != null ? _b : null;
1665
+ const getParentState = useLatest(parentState);
1666
+ const [wholeState] = useState2(() => {
1667
+ const initialSetupState = config.initSetupState ? config.initSetupState() : {};
1668
+ let mappedState = {};
1669
+ if (propsToForward) {
1670
+ mappedState = forwardProps2(propsToForward, props);
1671
+ }
1672
+ const state2 = __spreadValues(__spreadValues({}, initialSetupState), mappedState);
1673
+ if (config.mapPropsToState) {
1674
+ const { fn: mapPropsToState3, propertyReads } = proxyFn(config.mapPropsToState, {
1675
+ getProxyTargetFromArgs: (initialArg) => initialArg.props,
1676
+ putProxyToArgs: (props2, initialArg) => {
1677
+ return [__spreadProps(__spreadValues({}, initialArg), { props: props2 })];
1678
+ }
1679
+ });
1680
+ propsToStateSetRef.current = new Set([
1681
+ ...propsToStateSetRef.current,
1682
+ ...propertyReads
1683
+ ]);
1684
+ const stateFromProps = mapPropsToState3({
1596
1685
  props,
1597
- state: initialState2,
1598
- updated: null,
1686
+ state: state2,
1687
+ oldState: null,
1599
1688
  parentState
1600
1689
  });
1601
- return {
1602
- state: __spreadValues(__spreadValues({}, initialState2), readOnlyState),
1603
- initialState: initialState2,
1604
- readOnlyState
1605
- };
1690
+ return __spreadValues(__spreadValues({}, state2), stateFromProps);
1606
1691
  }
1607
- return {
1608
- initialState: initialState2,
1609
- readOnlyState: {},
1610
- state: initialState2
1611
- };
1692
+ return state2;
1612
1693
  });
1613
1694
  const getProps = useLatest(props);
1614
- const theReducer = (state2, action) => {
1615
- const previousState = state2;
1616
- let newState = null;
1617
- if (action.propertyName) {
1618
- newState = {
1619
- [action.propertyName]: action.payload
1620
- };
1621
- }
1622
- if (action.newControlledProps) {
1623
- newState = action.payload;
1624
- }
1625
- if (newState !== null) {
1626
- state2 = __spreadValues(__spreadValues({}, state2), newState);
1627
- }
1628
- if (config.deriveReadOnlyState) {
1629
- const derivedState = config.deriveReadOnlyState({
1695
+ const theReducer = (previousState, action) => {
1696
+ var _a2;
1697
+ const parentState2 = (_a2 = getParentState == null ? void 0 : getParentState()) != null ? _a2 : null;
1698
+ const mappedState = action.payload.mappedState;
1699
+ const updatedProps = action.payload.updatedProps;
1700
+ const newState = Object.assign({}, previousState);
1701
+ if (mappedState) {
1702
+ Object.assign(newState, mappedState);
1703
+ }
1704
+ if (config.mapPropsToState) {
1705
+ const { fn: mapPropsToState3, propertyReads } = proxyFn(config.mapPropsToState, {
1706
+ getProxyTargetFromArgs: (initialArg) => initialArg.props,
1707
+ putProxyToArgs: (props2, initialArg) => {
1708
+ return [__spreadProps(__spreadValues({}, initialArg), { props: props2 })];
1709
+ }
1710
+ });
1711
+ propsToStateSetRef.current = new Set([
1712
+ ...propsToStateSetRef.current,
1713
+ ...propertyReads
1714
+ ]);
1715
+ const stateFromProps = mapPropsToState3({
1630
1716
  props: getProps(),
1631
- state: state2,
1632
- updated: newState,
1633
- parentState
1717
+ state: newState,
1718
+ oldState: previousState,
1719
+ parentState: parentState2
1634
1720
  });
1635
- state2 = __spreadValues(__spreadValues({}, state2), derivedState);
1721
+ Object.assign(newState, stateFromProps);
1636
1722
  }
1637
1723
  const result = config.concludeReducer ? config.concludeReducer({
1638
1724
  previousState,
1639
- state: state2,
1640
- updated: newState,
1641
- parentState
1642
- }) : state2;
1725
+ state: newState,
1726
+ updatedProps,
1727
+ parentState: parentState2
1728
+ }) : newState;
1643
1729
  return result;
1644
1730
  };
1645
1731
  const [state, dispatch] = useReducer(theReducer, wholeState);
1646
- const userDefinedActions = useMemo3(() => {
1647
- var _a2, _b;
1648
- return (_b = (_a2 = config.getReducerActions) == null ? void 0 : _a2.call(config, dispatch)) != null ? _b : {};
1649
- }, [dispatch]);
1732
+ const getComponentState = useLatest(state);
1733
+ const { allowedControlledPropOverrides } = config;
1650
1734
  const actions = useMemo3(() => {
1651
- const generatedActions = getReducerActions(dispatch, initialState, getProps);
1652
- return Object.assign(generatedActions, userDefinedActions);
1653
- }, [dispatch, userDefinedActions]);
1735
+ const generatedActions = getReducerActions(dispatch, getComponentState, getProps, propsToForward, allowedControlledPropOverrides);
1736
+ return generatedActions;
1737
+ }, [
1738
+ dispatch,
1739
+ propsToForward,
1740
+ allowedControlledPropOverrides
1741
+ ]);
1654
1742
  const Context = getComponentStateContext();
1655
- const getComponentState = useLatest(state);
1656
1743
  const contextValue = useMemo3(() => ({
1657
1744
  componentState: state,
1658
1745
  componentActions: actions,
1659
- getComponentState,
1660
- updateStateProperty: (propertyName, propertyValue) => {
1661
- dispatch({
1662
- propertyName,
1663
- payload: propertyValue
1664
- });
1665
- }
1746
+ getComponentState
1666
1747
  }), [state, actions, getComponentState]);
1667
1748
  const prevProps = usePrevious(props);
1668
1749
  useEffect4(() => {
1669
1750
  const currentProps = props;
1670
- const updatedStateFromProps = {};
1671
- let updatedCount = 0;
1672
- for (var k in wholeState) {
1751
+ const newMappedState = {};
1752
+ let newMappedStateCount = 0;
1753
+ const updatedProps = {};
1754
+ let updatedPropsCount = 0;
1755
+ for (var k in props) {
1673
1756
  const key = k;
1674
- if (wholeState.hasOwnProperty(k) && isControlled(key, props)) {
1675
- const oldValue = prevProps[key];
1676
- let newValue = currentProps[key];
1677
- if (oldValue !== newValue) {
1678
- if (config.onControlledPropertyChange) {
1679
- const modifier = config.onControlledPropertyChange(k, newValue, oldValue);
1680
- if (typeof modifier === "function") {
1681
- newValue = modifier(newValue, oldValue);
1682
- }
1757
+ const oldValue = prevProps[key];
1758
+ const newValue = currentProps[key];
1759
+ if (key === "children") {
1760
+ continue;
1761
+ }
1762
+ if (oldValue === newValue) {
1763
+ continue;
1764
+ }
1765
+ if (isControlled(key, props)) {
1766
+ if (propsToForward.hasOwnProperty(k)) {
1767
+ let valueToSet = newValue;
1768
+ const forwardFn = propsToForward[k];
1769
+ if (typeof forwardFn === "function") {
1770
+ valueToSet = forwardFn(newValue);
1683
1771
  }
1684
- updatedStateFromProps[key] = newValue;
1685
- updatedCount++;
1772
+ if (state[key] !== valueToSet) {
1773
+ newMappedState[key] = valueToSet;
1774
+ newMappedStateCount++;
1775
+ }
1776
+ } else if (propsToStateSetRef.current.has(k)) {
1777
+ updatedProps[key] = currentProps[key];
1778
+ updatedPropsCount++;
1686
1779
  }
1687
1780
  }
1688
1781
  }
1689
- if (updatedCount > 0) {
1690
- debug2("Triggered by new values for the following props", updatedStateFromProps);
1782
+ if (updatedPropsCount > 0 || newMappedStateCount > 0) {
1783
+ debug2("Triggered by new values for the following props", ...[
1784
+ ...Object.keys(newMappedState != null ? newMappedState : {}),
1785
+ ...Object.keys(updatedProps != null ? updatedProps : {})
1786
+ ]);
1691
1787
  dispatch({
1692
- newControlledProps: true,
1693
- payload: updatedStateFromProps
1788
+ payload: {
1789
+ mappedState: newMappedStateCount ? newMappedState : null,
1790
+ updatedProps: updatedPropsCount ? updatedProps : null
1791
+ }
1694
1792
  });
1695
1793
  }
1696
1794
  });
@@ -1717,7 +1815,7 @@ function useColumnAggregations() {
1717
1815
  const componentState = getComponentState();
1718
1816
  columnAggregations.forEach((aggregator, key) => {
1719
1817
  var _a;
1720
- const colField = (_a = componentState.columns.get(key)) == null ? void 0 : _a.field;
1818
+ const colField = (_a = componentState.computedColumns.get(key)) == null ? void 0 : _a.field;
1721
1819
  const newAggregator = __spreadValues({
1722
1820
  getter: (data) => colField ? data[colField] : data
1723
1821
  }, aggregator);
@@ -1802,62 +1900,352 @@ function useColumnGroups() {
1802
1900
  }, [collapsedColumnGroups]);
1803
1901
  }
1804
1902
 
1805
- // src/components/InfiniteTable/hooks/useGeneratedGroupAndPivotColumns.ts
1806
- import { useCallback as useCallback4, useEffect as useEffect8 } from "react";
1903
+ // src/components/InfiniteTable/hooks/useColumnsWhen.ts
1904
+ import { useEffect as useEffect8, useMemo as useMemo5 } from "react";
1807
1905
 
1808
- // src/components/DataSource/index.tsx
1906
+ // src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
1809
1907
  import {
1810
- Fragment,
1811
- createElement as createElement3
1908
+ createElement as createElement4
1812
1909
  } from "react";
1813
1910
 
1814
- // src/components/DataSource/privateHooks/useLoadData.ts
1815
- import { useLayoutEffect as useLayoutEffect3 } from "react";
1911
+ // src/utils/join.ts
1912
+ var join = (...args) => args.filter((x) => !!`${x}`).join(" ");
1816
1913
 
1817
- // src/components/DataSource/privateHooks/buildDataSourceDataInfo.ts
1818
- function buildDataSourceDataInfo(dataParam) {
1819
- let dataArray = [];
1820
- if (Array.isArray(dataParam.data)) {
1821
- dataArray = dataParam.data;
1822
- } else {
1823
- dataArray = dataParam;
1914
+ // src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
1915
+ import {
1916
+ createElement as createElement3,
1917
+ useEffect as useEffect7
1918
+ } from "react";
1919
+ import { useState as useState3 } from "react";
1920
+
1921
+ // src/components/InfiniteTable/utilities.css.ts
1922
+ var alignItems = { center: "_16lm1iwz", stretch: "_16lm1iw10" };
1923
+ var cssEllipsisClassName = "_16lm1iw18 _16lm1iw19 _16lm1iw14";
1924
+ var cursor = { pointer: "_16lm1iw9" };
1925
+ var display = { flex: "_16lm1iwh", block: "_16lm1iwi", inlineBlock: "_16lm1iwj" };
1926
+ var fill = { currentColor: "_16lm1iw5", accentColor: "_16lm1iw6" };
1927
+ var flex = { "1": "_16lm1iwa", none: "_16lm1iwb" };
1928
+ var flexFlow = { column: "_16lm1iwx", row: "_16lm1iwy" };
1929
+ var justifyContent = { center: "_16lm1iw11", start: "_16lm1iw12", end: "_16lm1iw13" };
1930
+ var left = { "0": "_16lm1iwr", "100%": "_16lm1iws" };
1931
+ var position = { relative: "_16lm1iw1", absolute: "_16lm1iw2", sticky: "_16lm1iw3", fixed: "_16lm1iw4" };
1932
+ var top = { "0": "_16lm1iwp", "100%": "_16lm1iwq" };
1933
+ var transformTranslateZero = "_16lm1iw8";
1934
+ var userSelect = { none: "_16lm1iwk" };
1935
+ var willChange = { transform: "_16lm1iw17" };
1936
+ var zIndex = { "1": "_16lm1iwc", "10": "_16lm1iwd", "1000": "_16lm1iwe", "10000": "_16lm1iwf", "100000": "_16lm1iwg" };
1937
+
1938
+ // src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
1939
+ function ExpanderIcon(props) {
1940
+ var _a;
1941
+ const { size = 24 } = props;
1942
+ const style = __spreadValues({}, props.style);
1943
+ const [expanded, setExpanded] = useState3((_a = props.expanded) != null ? _a : props.defaultExpanded);
1944
+ if (expanded) {
1945
+ style.transform = `rotate(90deg)`;
1824
1946
  }
1825
- return {
1826
- originalDataArray: dataArray
1947
+ const onClick = () => {
1948
+ var _a2;
1949
+ (_a2 = props.onChange) == null ? void 0 : _a2.call(props, !expanded);
1950
+ if (!isControlled("expanded", props)) {
1951
+ setExpanded(!expanded);
1952
+ }
1827
1953
  };
1828
- }
1829
-
1830
- // src/components/DataSource/privateHooks/loadDataAsync.ts
1831
- function loadDataAsync(data) {
1832
- return __async(this, null, function* () {
1833
- if (typeof data === "function") {
1834
- data = data();
1954
+ useEffect7(() => {
1955
+ if (isControlled("expanded", props)) {
1956
+ setExpanded(props.expanded);
1835
1957
  }
1836
- return buildDataSourceDataInfo(yield data);
1837
- });
1958
+ }, [props.expanded]);
1959
+ return /* @__PURE__ */ createElement3("svg", {
1960
+ "data-name": "expander-icon",
1961
+ xmlns: "http://www.w3.org/2000/svg",
1962
+ height: `${size}px`,
1963
+ viewBox: "0 0 24 24",
1964
+ width: `${size}px`,
1965
+ style,
1966
+ onClick,
1967
+ className: join(props.className, fill.currentColor, flex.none, cursor.pointer, expanded ? fill.accentColor : "", "InfiniteIcon", "InfiniteIcon-expander", `InfiniteIcon-expander--${expanded ? "expanded" : "collapsed"}`)
1968
+ }, /* @__PURE__ */ createElement3("path", {
1969
+ d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"
1970
+ }));
1838
1971
  }
1839
1972
 
1840
- // src/components/DataSource/privateHooks/useLoadData.ts
1841
- function buildDataSourceInfo(data) {
1842
- return { originalDataArray: data };
1843
- }
1844
- function useLoadData() {
1973
+ // src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
1974
+ function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params) {
1975
+ if (!pivotColumns) {
1976
+ return void 0;
1977
+ }
1845
1978
  const {
1846
- componentActions: actions,
1847
- componentState: { data }
1848
- } = useComponentState();
1849
- const loadData = (data2) => {
1850
- let dataSourceInfo = {
1851
- originalDataArray: []
1852
- };
1853
- if (typeof data2 === "function") {
1854
- data2 = data2();
1979
+ pivotColumn,
1980
+ pivotRowLabelsColumn,
1981
+ pivotBy,
1982
+ groupRowsBy,
1983
+ pivotTotalColumnPosition,
1984
+ toggleGroupRow
1985
+ } = params;
1986
+ const computedPivotColumns = new Map();
1987
+ pivotColumns.forEach((col, key) => {
1988
+ if (col.pivotTotalColumn && pivotTotalColumnPosition === false) {
1989
+ return;
1855
1990
  }
1856
- if (Array.isArray(data2)) {
1857
- dataSourceInfo = buildDataSourceInfo(data2);
1858
- actions.originalDataArray = dataSourceInfo.originalDataArray;
1859
- } else {
1860
- actions.loading = true;
1991
+ let column = __spreadValues({}, col);
1992
+ if (pivotColumn) {
1993
+ if (typeof pivotColumn === "function") {
1994
+ column = __spreadValues(__spreadValues({}, column), pivotColumn({
1995
+ column,
1996
+ pivotBy,
1997
+ groupRowsBy
1998
+ }));
1999
+ } else {
2000
+ column = __spreadValues(__spreadValues({}, column), pivotColumn);
2001
+ }
2002
+ }
2003
+ const isPivotRowLabelsColumn = !column.pivotColumn && !column.pivotTotalColumn;
2004
+ if (pivotRowLabelsColumn && isPivotRowLabelsColumn) {
2005
+ if (typeof pivotRowLabelsColumn === "function") {
2006
+ column = __spreadValues(__spreadValues({}, column), pivotRowLabelsColumn({
2007
+ column,
2008
+ pivotBy,
2009
+ groupRowsBy
2010
+ }));
2011
+ } else {
2012
+ column = __spreadValues(__spreadValues({}, column), pivotRowLabelsColumn);
2013
+ }
2014
+ }
2015
+ if (isPivotRowLabelsColumn && !column.render) {
2016
+ column.render = (renderOptions) => {
2017
+ var _a;
2018
+ let { value, rowInfo, column: column2, groupRowsBy: groupRowsBy2 } = renderOptions;
2019
+ if (column2.renderValue) {
2020
+ value = column2.renderValue(renderOptions);
2021
+ }
2022
+ const showExpanderIcon = (((_a = rowInfo.groupKeys) == null ? void 0 : _a.length) || 0) < groupRowsBy2.length;
2023
+ return /* @__PURE__ */ createElement4("div", {
2024
+ className: join(display.flex, alignItems.center),
2025
+ style: {
2026
+ paddingInlineStart: `calc(${rowInfo.groupNesting - 1} * var(--ITableRow-group-column-nesting))`
2027
+ }
2028
+ }, showExpanderIcon ? /* @__PURE__ */ createElement4(ExpanderIcon, {
2029
+ expanded: !rowInfo.collapsed,
2030
+ onChange: () => {
2031
+ toggleGroupRow(rowInfo.groupKeys);
2032
+ }
2033
+ }) : null, /* @__PURE__ */ createElement4("div", {
2034
+ className: cssEllipsisClassName
2035
+ }, value != null ? value : null));
2036
+ };
2037
+ }
2038
+ if (!column.render && column.renderValue) {
2039
+ column.render = (renderOptions) => {
2040
+ return column.renderValue(renderOptions);
2041
+ };
2042
+ }
2043
+ computedPivotColumns.set(key, column);
2044
+ });
2045
+ return computedPivotColumns;
2046
+ }
2047
+
2048
+ // src/components/InfiniteTable/utils/getColumnForGroupBy.tsx
2049
+ import {
2050
+ createElement as createElement5
2051
+ } from "react";
2052
+
2053
+ // node_modules/@vanilla-extract/recipes/createRuntimeFn/dist/vanilla-extract-recipes-createRuntimeFn.esm.js
2054
+ var shouldApplyCompound = (compoundCheck, selections) => {
2055
+ for (const key of Object.keys(compoundCheck)) {
2056
+ if (compoundCheck[key] !== selections[key]) {
2057
+ return false;
2058
+ }
2059
+ }
2060
+ return true;
2061
+ };
2062
+ var createRuntimeFn = (config) => (options) => {
2063
+ let className = config.defaultClassName;
2064
+ const selections = {
2065
+ ...config.defaultVariants,
2066
+ ...options
2067
+ };
2068
+ for (const variantName in selections) {
2069
+ var _selections$variantNa;
2070
+ const variantSelection = (_selections$variantNa = selections[variantName]) !== null && _selections$variantNa !== void 0 ? _selections$variantNa : config.defaultVariants[variantName];
2071
+ if (variantSelection != null) {
2072
+ let selection = variantSelection;
2073
+ if (typeof selection === "boolean") {
2074
+ selection = selection === true ? "true" : "false";
2075
+ }
2076
+ className += " " + config.variantClassNames[variantName][selection];
2077
+ }
2078
+ }
2079
+ for (const [compoundCheck, compoundClassName] of config.compoundVariants) {
2080
+ if (shouldApplyCompound(compoundCheck, selections)) {
2081
+ className += " " + compoundClassName;
2082
+ }
2083
+ }
2084
+ return className;
2085
+ };
2086
+
2087
+ // src/components/InfiniteTable/components/InfiniteTableRow/row.css.ts
2088
+ var GroupRowExpanderCls = "_7pupv0b";
2089
+ 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: [] });
2090
+ var RowHoverCls = "_7pupv01";
2091
+
2092
+ // src/components/InfiniteTable/utils/getColumnForGroupBy.tsx
2093
+ function getGroupColumnRender({
2094
+ groupIndex,
2095
+ groupRenderStrategy,
2096
+ toggleGroupRow
2097
+ }) {
2098
+ return (renderOptions) => {
2099
+ var _a;
2100
+ let { value, rowInfo, column } = renderOptions;
2101
+ if (column.renderValue) {
2102
+ value = column.renderValue(renderOptions);
2103
+ }
2104
+ let groupRowInfo = groupRenderStrategy !== "inline" ? rowInfo : ((_a = rowInfo.parents) == null ? void 0 : _a[groupIndex]) || rowInfo;
2105
+ if (!groupRowInfo) {
2106
+ return null;
2107
+ }
2108
+ const collapsed = groupRowInfo.collapsed;
2109
+ const groupKeys = groupRowInfo.groupKeys;
2110
+ if (groupRenderStrategy === "inline") {
2111
+ if (groupRowInfo.groupCount === 1) {
2112
+ return value;
2113
+ }
2114
+ if (groupRowInfo.groupNesting === groupIndex && collapsed) {
2115
+ return null;
2116
+ }
2117
+ } else {
2118
+ if (!groupRowInfo.isGroupRow) {
2119
+ return null;
2120
+ }
2121
+ if (groupIndex + 1 !== groupRowInfo.groupNesting) {
2122
+ return null;
2123
+ }
2124
+ }
2125
+ return /* @__PURE__ */ createElement5("div", {
2126
+ className: join(display.flex, alignItems.center)
2127
+ }, /* @__PURE__ */ createElement5(ExpanderIcon, {
2128
+ expanded: !collapsed,
2129
+ onChange: () => {
2130
+ toggleGroupRow(groupKeys);
2131
+ }
2132
+ }), /* @__PURE__ */ createElement5("div", {
2133
+ className: cssEllipsisClassName
2134
+ }, value != null ? value : null));
2135
+ };
2136
+ }
2137
+ function getColumnForGroupBy(options, toggleGroupRow, groupColumnFromProps) {
2138
+ const { groupBy, groupIndex, groupRenderStrategy } = options;
2139
+ let generatedGroupColumn = __spreadValues({
2140
+ header: `Group by ${groupBy.field}`,
2141
+ groupByField: groupBy.field,
2142
+ sortable: false,
2143
+ render: getGroupColumnRender({
2144
+ groupIndex,
2145
+ toggleGroupRow,
2146
+ groupRenderStrategy
2147
+ })
2148
+ }, groupBy.column);
2149
+ if (groupColumnFromProps) {
2150
+ if (typeof groupColumnFromProps === "function") {
2151
+ generatedGroupColumn = __spreadValues(__spreadValues({}, generatedGroupColumn), groupColumnFromProps(options, toggleGroupRow));
2152
+ } else {
2153
+ generatedGroupColumn = __spreadValues(__spreadValues({}, generatedGroupColumn), groupColumnFromProps);
2154
+ }
2155
+ }
2156
+ return generatedGroupColumn;
2157
+ }
2158
+ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
2159
+ let generatedGroupColumn = {
2160
+ header: `Group`,
2161
+ groupByField: options.groupRowsBy.map((g) => g.field),
2162
+ sortable: false,
2163
+ render: (renderOptions) => {
2164
+ let { value, rowInfo, column } = renderOptions;
2165
+ if (!rowInfo.isGroupRow) {
2166
+ return null;
2167
+ }
2168
+ if (column.renderValue) {
2169
+ value = column.renderValue(renderOptions);
2170
+ }
2171
+ return /* @__PURE__ */ createElement5("div", {
2172
+ className: join(display.flex, alignItems.center, GroupRowExpanderCls)
2173
+ }, /* @__PURE__ */ createElement5(ExpanderIcon, {
2174
+ expanded: !rowInfo.collapsed,
2175
+ onChange: () => {
2176
+ toggleGroupRow(rowInfo.groupKeys);
2177
+ }
2178
+ }), /* @__PURE__ */ createElement5("div", {
2179
+ className: cssEllipsisClassName
2180
+ }, value != null ? value : null));
2181
+ }
2182
+ };
2183
+ if (groupColumnFromProps) {
2184
+ if (typeof groupColumnFromProps === "function") {
2185
+ generatedGroupColumn = __spreadValues(__spreadValues({}, generatedGroupColumn), groupColumnFromProps(options, toggleGroupRow));
2186
+ } else {
2187
+ generatedGroupColumn = __spreadValues(__spreadValues({}, generatedGroupColumn), groupColumnFromProps);
2188
+ }
2189
+ }
2190
+ return generatedGroupColumn;
2191
+ }
2192
+
2193
+ // src/components/InfiniteTable/hooks/useToggleGroupRow.ts
2194
+ import { useCallback as useCallback4 } from "react";
2195
+
2196
+ // src/components/DataSource/index.tsx
2197
+ import {
2198
+ Fragment,
2199
+ createElement as createElement6
2200
+ } from "react";
2201
+
2202
+ // src/components/DataSource/privateHooks/useLoadData.ts
2203
+ import { useLayoutEffect as useLayoutEffect3 } from "react";
2204
+
2205
+ // src/components/DataSource/privateHooks/buildDataSourceDataInfo.ts
2206
+ function buildDataSourceDataInfo(dataParam) {
2207
+ let dataArray = [];
2208
+ if (Array.isArray(dataParam.data)) {
2209
+ dataArray = dataParam.data;
2210
+ } else {
2211
+ dataArray = dataParam;
2212
+ }
2213
+ return {
2214
+ originalDataArray: dataArray
2215
+ };
2216
+ }
2217
+
2218
+ // src/components/DataSource/privateHooks/loadDataAsync.ts
2219
+ function loadDataAsync(data) {
2220
+ return __async(this, null, function* () {
2221
+ if (typeof data === "function") {
2222
+ data = data();
2223
+ }
2224
+ return buildDataSourceDataInfo(yield data);
2225
+ });
2226
+ }
2227
+
2228
+ // src/components/DataSource/privateHooks/useLoadData.ts
2229
+ function buildDataSourceInfo(data) {
2230
+ return { originalDataArray: data };
2231
+ }
2232
+ function useLoadData() {
2233
+ const {
2234
+ componentActions: actions,
2235
+ componentState: { data }
2236
+ } = useComponentState();
2237
+ const loadData = (data2) => {
2238
+ let dataSourceInfo = {
2239
+ originalDataArray: []
2240
+ };
2241
+ if (typeof data2 === "function") {
2242
+ data2 = data2();
2243
+ }
2244
+ if (Array.isArray(data2)) {
2245
+ dataSourceInfo = buildDataSourceInfo(data2);
2246
+ actions.originalDataArray = dataSourceInfo.originalDataArray;
2247
+ } else {
2248
+ actions.loading = true;
1861
2249
  loadDataAsync(data2).then((dataSourceInfo2) => {
1862
2250
  actions.originalDataArray = dataSourceInfo2.originalDataArray;
1863
2251
  actions.loading = false;
@@ -2253,47 +2641,51 @@ var GroupRowsState = class {
2253
2641
  };
2254
2642
 
2255
2643
  // src/components/DataSource/state/getInitialState.ts
2256
- function getInitialState2(params) {
2257
- var _a, _b, _c, _d, _e;
2258
- const { props: initialProps } = params;
2259
- const dataArray = [];
2260
- const originalDataArray = [];
2261
- const sortInfo = normalizeSortInfo(isControlled("sortInfo", initialProps) ? initialProps.sortInfo : initialProps.defaultSortInfo);
2262
- const groupRowsState = initialProps.groupRowsState || initialProps.defaultGroupRowsState || new GroupRowsState({
2263
- expandedRows: true,
2264
- collapsedRows: []
2265
- });
2644
+ function initSetupState2() {
2266
2645
  const now = Date.now();
2646
+ const originalDataArray = [];
2647
+ const dataArray = [];
2267
2648
  return {
2268
- data: initialProps.data,
2269
- loading: (_b = (_a = initialProps.loading) != null ? _a : initialProps.defaultLoading) != null ? _b : false,
2270
- dataArray,
2649
+ pivotTotalColumnPosition: "end",
2271
2650
  originalDataArray,
2272
- sortInfo,
2273
- groupRowsState,
2651
+ pivotColumns: void 0,
2652
+ pivotColumnGroups: void 0,
2653
+ dataArray,
2274
2654
  updatedAt: now,
2275
2655
  groupedAt: 0,
2276
2656
  sortedAt: 0,
2277
2657
  reducedAt: now,
2278
- pivotColumns: void 0,
2279
- pivotColumnGroups: void 0,
2280
- groupRowsBy: isControlled("groupRowsBy", initialProps) ? (_c = initialProps.groupRowsBy) != null ? _c : [] : (_d = initialProps.defaultGroupRowsBy) != null ? _d : [],
2281
- pivotBy: isControlled("pivotBy", initialProps) ? (_e = initialProps.pivotBy) != null ? _e : [] : initialProps.defaultPivotBy,
2658
+ generateGroupRows: true,
2282
2659
  aggregationReducers: void 0,
2283
- pivotTotalColumnPosition: "end"
2660
+ groupDeepMap: void 0,
2661
+ postSortDataArray: void 0,
2662
+ postGroupDataArray: void 0,
2663
+ lastSortDataArray: void 0,
2664
+ lastGroupDataArray: void 0
2284
2665
  };
2285
2666
  }
2286
- function deriveReadOnlyState2(params) {
2667
+ var forwardProps3 = () => {
2668
+ return {
2669
+ remoteCount: 1,
2670
+ data: 1,
2671
+ pivotBy: 1,
2672
+ primaryKey: 1,
2673
+ loading: (loading) => loading != null ? loading : false,
2674
+ sortInfo: (sortInfo) => normalizeSortInfo(sortInfo),
2675
+ groupRowsBy: (groupRowsBy) => groupRowsBy != null ? groupRowsBy : [],
2676
+ groupRowsState: (groupRowsState) => {
2677
+ return groupRowsState || new GroupRowsState({
2678
+ expandedRows: true,
2679
+ collapsedRows: []
2680
+ });
2681
+ }
2682
+ };
2683
+ };
2684
+ function mapPropsToState2(params) {
2287
2685
  var _a;
2288
- const { props, state } = params;
2289
- const sortInfo = isControlled("sortInfo", props) ? props.sortInfo : (_a = props.defaultSortInfo) != null ? _a : null;
2686
+ const { props } = params;
2290
2687
  return {
2291
- multiSort: Array.isArray(sortInfo),
2292
- sortInfo: normalizeSortInfo(state.sortInfo),
2293
- primaryKey: props.primaryKey,
2294
- groupDeepMap: void 0,
2295
- postSortDataArray: void 0,
2296
- postGroupDataArray: void 0
2688
+ multiSort: Array.isArray((_a = props.sortInfo) != null ? _a : props.defaultSortInfo)
2297
2689
  };
2298
2690
  }
2299
2691
 
@@ -2497,7 +2889,7 @@ function flatten(groupResult) {
2497
2889
  return result;
2498
2890
  }
2499
2891
  function getEnhancedGroupData(options, deepMapValue) {
2500
- const { groupBy, groupKeys, collapsed } = options;
2892
+ const { groupBy, groupKeys, collapsed, parents } = options;
2501
2893
  const groupNesting = groupKeys.length;
2502
2894
  const { items: groupItems, reducerResults, pivotDeepMap } = deepMapValue;
2503
2895
  const enhancedGroupData = {
@@ -2507,6 +2899,10 @@ function getEnhancedGroupData(options, deepMapValue) {
2507
2899
  groupKeys,
2508
2900
  id: groupKeys,
2509
2901
  collapsed,
2902
+ parents,
2903
+ collapsedChildrenCount: 0,
2904
+ collapsedGroupsCount: 0,
2905
+ indexInParentGroups: options.indexInParentGroups,
2510
2906
  indexInGroup: options.indexInGroup,
2511
2907
  indexInAll: options.indexInAll,
2512
2908
  value: groupKeys[groupKeys.length - 1],
@@ -2528,12 +2924,14 @@ function completeReducers(reducers, reducerResults, items) {
2528
2924
  }
2529
2925
  return reducerResults;
2530
2926
  }
2531
- function enhancedFlatten(groupResult, toPrimaryKey, groupRowsState) {
2927
+ function enhancedFlatten(param) {
2928
+ const { groupResult, toPrimaryKey, groupRowsState, generateGroupRows } = param;
2532
2929
  const { groupParams, deepMap, pivot } = groupResult;
2533
2930
  const { groupBy } = groupParams;
2534
2931
  const groupByStrings = groupBy.map((g) => g.field);
2535
2932
  const result = [];
2536
2933
  const parents = [];
2934
+ const indexInParentGroups = [];
2537
2935
  deepMap.visitDepthFirst((deepMapValue, groupKeys, indexInGroup, next) => {
2538
2936
  var _a;
2539
2937
  const items = deepMapValue.items;
@@ -2541,12 +2939,24 @@ function enhancedFlatten(groupResult, toPrimaryKey, groupRowsState) {
2541
2939
  const collapsed = (_a = groupRowsState == null ? void 0 : groupRowsState.isGroupRowCollapsed(groupKeys)) != null ? _a : false;
2542
2940
  const enhancedGroupData = getEnhancedGroupData({
2543
2941
  groupBy: groupByStrings,
2942
+ parents: Array.from(parents),
2544
2943
  indexInGroup,
2944
+ indexInParentGroups: Array.from(indexInParentGroups),
2545
2945
  indexInAll: result.length,
2546
2946
  groupKeys,
2547
2947
  collapsed
2548
2948
  }, deepMapValue);
2549
- result.push(enhancedGroupData);
2949
+ const include = generateGroupRows || collapsed;
2950
+ if (include) {
2951
+ result.push(enhancedGroupData);
2952
+ }
2953
+ if (collapsed) {
2954
+ parents.forEach((parent) => {
2955
+ parent.collapsedChildrenCount += enhancedGroupData.groupCount;
2956
+ parent.collapsedGroupsCount += 1;
2957
+ });
2958
+ }
2959
+ indexInParentGroups.push(indexInGroup);
2550
2960
  parents.push(enhancedGroupData);
2551
2961
  if (!collapsed) {
2552
2962
  if (!next) {
@@ -2558,11 +2968,14 @@ function enhancedFlatten(groupResult, toPrimaryKey, groupRowsState) {
2558
2968
  data: item,
2559
2969
  isGroupRow: false,
2560
2970
  collapsed: false,
2561
- parentGroupKeys: groupKeys,
2971
+ groupKeys,
2972
+ parents: Array.from(parents),
2973
+ indexInParentGroups: [...indexInParentGroups, index],
2562
2974
  indexInGroup: index,
2563
2975
  indexInAll: startIndex + index,
2564
2976
  groupBy: groupByStrings,
2565
- groupNesting
2977
+ groupNesting,
2978
+ groupCount: enhancedGroupData.groupCount
2566
2979
  };
2567
2980
  }));
2568
2981
  }
@@ -2571,6 +2984,7 @@ function enhancedFlatten(groupResult, toPrimaryKey, groupRowsState) {
2571
2984
  }
2572
2985
  }
2573
2986
  parents.pop();
2987
+ indexInParentGroups.pop();
2574
2988
  });
2575
2989
  return {
2576
2990
  data: result
@@ -2585,8 +2999,8 @@ function getPivotColumnsAndColumnGroups(deepMap, pivotBy, pivotTotalColumnPositi
2585
2999
  header: "Row labels",
2586
3000
  valueGetter: (params) => {
2587
3001
  var _a;
2588
- const { enhancedData } = params;
2589
- return enhancedData.groupKeys ? enhancedData.groupKeys[((_a = enhancedData.groupKeys) == null ? void 0 : _a.length) - 1] : null;
3002
+ const { rowInfo } = params;
3003
+ return rowInfo.groupKeys ? rowInfo.groupKeys[((_a = rowInfo.groupKeys) == null ? void 0 : _a.length) - 1] : null;
2590
3004
  }
2591
3005
  }
2592
3006
  ]
@@ -2607,9 +3021,9 @@ function getPivotColumnsAndColumnGroups(deepMap, pivotBy, pivotTotalColumnPositi
2607
3021
  sortable: false,
2608
3022
  columnGroup: parentKeys.length ? `${columnGroupId}` : void 0,
2609
3023
  header: keys[keys.length - 1],
2610
- valueGetter: ({ enhancedData }) => {
3024
+ valueGetter: ({ rowInfo }) => {
2611
3025
  var _a, _b, _c;
2612
- const value = (_c = (_b = (_a = enhancedData.pivotValuesMap) == null ? void 0 : _a.get(keys)) == null ? void 0 : _b.reducerResults[0]) != null ? _c : null;
3026
+ const value = (_c = (_b = (_a = rowInfo.pivotValuesMap) == null ? void 0 : _a.get(keys)) == null ? void 0 : _b.reducerResults[0]) != null ? _c : null;
2613
3027
  return value;
2614
3028
  }
2615
3029
  });
@@ -2628,9 +3042,9 @@ function getPivotColumnsAndColumnGroups(deepMap, pivotBy, pivotTotalColumnPositi
2628
3042
  pivotGroupKeys: keys,
2629
3043
  pivotBy,
2630
3044
  sortable: false,
2631
- valueGetter: ({ enhancedData }) => {
3045
+ valueGetter: ({ rowInfo }) => {
2632
3046
  var _a, _b, _c;
2633
- const value = (_c = (_b = (_a = enhancedData.pivotValuesMap) == null ? void 0 : _a.get(keys)) == null ? void 0 : _b.reducerResults[0]) != null ? _c : null;
3047
+ const value = (_c = (_b = (_a = rowInfo.pivotValuesMap) == null ? void 0 : _a.get(keys)) == null ? void 0 : _b.reducerResults[0]) != null ? _c : null;
2634
3048
  return value;
2635
3049
  }
2636
3050
  });
@@ -2643,9 +3057,9 @@ function getPivotColumnsAndColumnGroups(deepMap, pivotBy, pivotTotalColumnPositi
2643
3057
  if (columns.size === 1) {
2644
3058
  columns.set("single", {
2645
3059
  header: "Reduced",
2646
- valueGetter: ({ enhancedData }) => {
3060
+ valueGetter: ({ rowInfo }) => {
2647
3061
  var _a;
2648
- return (_a = enhancedData.reducerResults) == null ? void 0 : _a[0];
3062
+ return (_a = rowInfo.reducerResults) == null ? void 0 : _a[0];
2649
3063
  }
2650
3064
  });
2651
3065
  }
@@ -2657,26 +3071,26 @@ function getPivotColumnsAndColumnGroups(deepMap, pivotBy, pivotTotalColumnPositi
2657
3071
  }
2658
3072
 
2659
3073
  // src/components/DataSource/state/reducer.ts
2660
- var haveDepsChanged = (updated, deps) => {
2661
- if (!updated) {
2662
- return false;
2663
- }
2664
- for (var i = 0, len = deps.length; i < len; i++) {
2665
- if (updated.hasOwnProperty(deps[i])) {
3074
+ var haveDepsChanged = (state1, state2, deps) => {
3075
+ for (let i = 0, len = deps.length; i < len; i++) {
3076
+ const k = deps[i];
3077
+ const oldValue = state1[k];
3078
+ const newValue = state2[k];
3079
+ if (oldValue !== newValue) {
2666
3080
  return true;
2667
3081
  }
2668
3082
  }
2669
3083
  return false;
2670
3084
  };
2671
- function toEnhancedData(data, id, index) {
3085
+ function toRowInfo(data, id, index) {
2672
3086
  return { data, collapsed: true, id, indexInAll: index, indexInGroup: index };
2673
3087
  }
2674
3088
  function concludeReducer(params) {
2675
3089
  var _a;
2676
- const { state, previousState, updated } = params;
3090
+ const { state, previousState } = params;
2677
3091
  const sortInfo = state.sortInfo;
2678
- const shouldSort = sortInfo == null ? void 0 : sortInfo.length;
2679
- const sortDepsChanged = haveDepsChanged(updated, [
3092
+ const shouldSort = !!(sortInfo == null ? void 0 : sortInfo.length);
3093
+ const sortDepsChanged = haveDepsChanged(previousState, state, [
2680
3094
  "originalDataArray",
2681
3095
  "sortInfo"
2682
3096
  ]);
@@ -2684,7 +3098,8 @@ function concludeReducer(params) {
2684
3098
  const groupBy = state.groupRowsBy;
2685
3099
  const pivotBy = state.pivotBy;
2686
3100
  const shouldGroup = groupBy.length || pivotBy;
2687
- const groupsDepsChanged = haveDepsChanged(updated, [
3101
+ const groupsDepsChanged = haveDepsChanged(previousState, state, [
3102
+ "generateGroupRows",
2688
3103
  "originalDataArray",
2689
3104
  "groupRowsBy",
2690
3105
  "groupRowsState",
@@ -2696,7 +3111,7 @@ function concludeReducer(params) {
2696
3111
  const shouldGroupAgain = shouldGroup && (groupsDepsChanged || !state.lastGroupDataArray);
2697
3112
  const now = Date.now();
2698
3113
  let dataArray = state.originalDataArray;
2699
- let enhancedDataArray = state.dataArray;
3114
+ let rowInfoDataArray = state.dataArray;
2700
3115
  if (shouldSort) {
2701
3116
  dataArray = shouldSortAgain ? multisort(sortInfo, [...dataArray]) : state.lastSortDataArray;
2702
3117
  state.lastSortDataArray = dataArray;
@@ -2714,30 +3129,35 @@ function concludeReducer(params) {
2714
3129
  pivot: pivotBy,
2715
3130
  reducers: state.aggregationReducers
2716
3131
  }, dataArray);
2717
- const flattenResult = enhancedFlatten(groupResult, toPrimaryKey, state.groupRowsState);
2718
- enhancedDataArray = flattenResult.data;
3132
+ const flattenResult = enhancedFlatten({
3133
+ groupResult,
3134
+ toPrimaryKey,
3135
+ groupRowsState: state.groupRowsState,
3136
+ generateGroupRows: state.generateGroupRows
3137
+ });
3138
+ rowInfoDataArray = flattenResult.data;
2719
3139
  state.groupDeepMap = groupResult.deepMap;
2720
3140
  const pivotGroupsAndCols = pivotBy ? getPivotColumnsAndColumnGroups(groupResult.topLevelPivotColumns, pivotBy, (_a = state.pivotTotalColumnPosition) != null ? _a : "end") : void 0;
2721
3141
  state.pivotColumns = pivotGroupsAndCols == null ? void 0 : pivotGroupsAndCols.columns;
2722
3142
  state.pivotColumnGroups = pivotGroupsAndCols == null ? void 0 : pivotGroupsAndCols.columnGroups;
2723
3143
  } else {
2724
- enhancedDataArray = state.lastGroupDataArray;
3144
+ rowInfoDataArray = state.lastGroupDataArray;
2725
3145
  }
2726
- state.lastGroupDataArray = enhancedDataArray;
3146
+ state.lastGroupDataArray = rowInfoDataArray;
2727
3147
  state.groupedAt = now;
2728
3148
  } else {
2729
3149
  state.groupDeepMap = void 0;
2730
3150
  state.pivotColumns = void 0;
2731
3151
  const arrayDifferentAfterSortStep = previousState.postSortDataArray != state.postSortDataArray;
2732
3152
  if (arrayDifferentAfterSortStep) {
2733
- enhancedDataArray = dataArray.map((data, index) => toEnhancedData(data, toPrimaryKey(data), index));
3153
+ rowInfoDataArray = dataArray.map((data, index) => toRowInfo(data, toPrimaryKey(data), index));
2734
3154
  }
2735
3155
  }
2736
- state.postGroupDataArray = enhancedDataArray;
2737
- if (enhancedDataArray !== state.dataArray) {
3156
+ state.postGroupDataArray = rowInfoDataArray;
3157
+ if (rowInfoDataArray !== state.dataArray) {
2738
3158
  state.updatedAt = now;
2739
3159
  }
2740
- state.dataArray = enhancedDataArray;
3160
+ state.dataArray = rowInfoDataArray;
2741
3161
  state.reducedAt = now;
2742
3162
  globalThis.state = state;
2743
3163
  return state;
@@ -2756,12 +3176,13 @@ function DataSourceWithContext(props) {
2756
3176
  if (typeof children === "function") {
2757
3177
  children = children(computedValues);
2758
3178
  }
2759
- return /* @__PURE__ */ createElement3(Fragment, null, children);
3179
+ return /* @__PURE__ */ createElement6(Fragment, null, children);
2760
3180
  }
2761
3181
  var DataSourceRoot = getComponentStateRoot({
2762
- getInitialState: getInitialState2,
3182
+ initSetupState: initSetupState2,
3183
+ forwardProps: forwardProps3,
2763
3184
  concludeReducer,
2764
- deriveReadOnlyState: deriveReadOnlyState2
3185
+ mapPropsToState: mapPropsToState2
2765
3186
  });
2766
3187
  function DataSourceCmp({ children }) {
2767
3188
  const DataSourceContext = getDataSourceContext();
@@ -2772,382 +3193,147 @@ function DataSourceCmp({ children }) {
2772
3193
  componentActions,
2773
3194
  getState
2774
3195
  };
3196
+ if (false) {
3197
+ globalThis.getDataSourceState = getState;
3198
+ }
2775
3199
  useLoadData();
2776
- return /* @__PURE__ */ createElement3(DataSourceContext.Provider, {
3200
+ return /* @__PURE__ */ createElement6(DataSourceContext.Provider, {
2777
3201
  value: contextValue
2778
- }, /* @__PURE__ */ createElement3(DataSourceWithContext, {
3202
+ }, /* @__PURE__ */ createElement6(DataSourceWithContext, {
2779
3203
  children
2780
3204
  }));
2781
3205
  }
2782
3206
  function DataSource(props) {
2783
- return /* @__PURE__ */ createElement3(DataSourceRoot, __spreadValues({}, props), /* @__PURE__ */ createElement3(DataSourceCmp, {
3207
+ return /* @__PURE__ */ createElement6(DataSourceRoot, __spreadValues({}, props), /* @__PURE__ */ createElement6(DataSourceCmp, {
2784
3208
  children: props.children
2785
3209
  }));
2786
3210
  }
2787
3211
 
2788
- // src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
2789
- import {
2790
- createElement as createElement5
2791
- } from "react";
2792
-
2793
- // src/style/utilities.ts
2794
- var rule = (name, value) => `it__${name}=${value}`;
2795
- var ICSS = {
2796
- variables: {
2797
- space: [
2798
- "--it-space-0",
2799
- "--it-space-1",
2800
- "--it-space-2",
2801
- "--it-space-3",
2802
- "--it-space-4",
2803
- "--it-space-5",
2804
- "--it-space-6",
2805
- "--it-space-7",
2806
- "--it-space-8",
2807
- "--it-space-9",
2808
- "--it-space-10"
2809
- ],
2810
- borderRadius: "--it__border-radius",
2811
- fontSize: [
2812
- "--it-font-size-0",
2813
- "--it-font-size-1",
2814
- "--it-font-size-2",
2815
- "--it-font-size-3",
2816
- "--it-font-size-4",
2817
- "--it-font-size-5",
2818
- "--it-font-size-6",
2819
- "--it-font-size-7"
2820
- ]
2821
- },
2822
- alignItems: {
2823
- center: rule("align-items", "center"),
2824
- stretch: rule("align-items", "stretch")
2825
- },
2826
- justifyContent: {
2827
- center: rule("justify-content", "center"),
2828
- "flex-start": rule("justify-content", "flex-start"),
2829
- flexStart: rule("justify-content", "flex-start"),
2830
- "flex-end": rule("justify-content", "flex-end"),
2831
- flexEnd: rule("justify-content", "flex-end")
2832
- },
2833
- overflow: {
2834
- hidden: rule("overflow", "hidden"),
2835
- visible: rule("overflow", "visible"),
2836
- auto: rule("overflow", "auto")
2837
- },
2838
- overflowX: {
2839
- hidden: rule("overflow-x", "hidden"),
2840
- visible: rule("overflow-x", "visible"),
2841
- auto: rule("overflow-x", "auto")
2842
- },
2843
- overflowY: {
2844
- hidden: rule("overflow-y", "hidden"),
2845
- visible: rule("overflow-y", "visible"),
2846
- auto: rule("overflow-y", "auto")
2847
- },
2848
- cursor: {
2849
- pointer: rule("cursor", "pointer")
2850
- },
2851
- height: {
2852
- 0: rule("height", "0"),
2853
- "100%": rule("height", "100%")
2854
- },
2855
- width: {
2856
- 0: rule("width", "0"),
2857
- "100%": rule("width", "100%")
2858
- },
2859
- top: {
2860
- 0: rule("top", "0"),
2861
- "100%": rule("top", "100%")
2862
- },
2863
- left: {
2864
- 0: rule("left", "0"),
2865
- "100%": rule("left", "100%")
2866
- },
2867
- transform: {
2868
- translate3D000: rule("transform", "translate3D000")
2869
- },
2870
- willChange: {
2871
- transform: rule("will-change", "transform")
2872
- },
2873
- position: {
2874
- relative: rule("position", "relative"),
2875
- absolute: rule("position", "absolute"),
2876
- fixed: rule("position", "fixed")
2877
- },
2878
- display: {
2879
- flex: rule("display", "flex")
2880
- },
2881
- flexFlow: {
2882
- row: rule("flex-flow", "row"),
2883
- column: rule("flex-flow", "column")
2884
- },
2885
- whiteSpace: {
2886
- nowrap: rule("white-space", "nowrap")
2887
- },
2888
- textOverflow: {
2889
- ellipsis: rule("text-overflow", "ellipsis")
2890
- },
2891
- userSelect: {
2892
- none: rule("user-select", "none")
2893
- }
2894
- };
2895
-
2896
- // src/style/css.ts
2897
- var cssEllipsisClassName = `${ICSS.whiteSpace.nowrap} ${ICSS.textOverflow.ellipsis} ${ICSS.overflow.hidden}`;
2898
-
2899
- // src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
2900
- import {
2901
- createElement as createElement4,
2902
- useEffect as useEffect7
2903
- } from "react";
2904
- import { useState as useState3 } from "react";
2905
- function ExpanderIcon(props) {
2906
- var _a;
2907
- const { size = 24 } = props;
2908
- const style = __spreadValues({}, props.style);
2909
- const [expanded, setExpanded] = useState3((_a = props.expanded) != null ? _a : props.defaultExpanded);
2910
- if (expanded) {
2911
- style.transform = `rotate(90deg)`;
2912
- }
2913
- const onClick = () => {
2914
- var _a2;
2915
- (_a2 = props.onChange) == null ? void 0 : _a2.call(props, !expanded);
2916
- if (!isControlled("expanded", props)) {
2917
- setExpanded(!expanded);
2918
- }
2919
- };
2920
- useEffect7(() => {
2921
- if (isControlled("expanded", props)) {
2922
- setExpanded(props.expanded);
2923
- }
2924
- }, [props.expanded]);
2925
- return /* @__PURE__ */ createElement4("svg", {
2926
- "data-name": "expander-icon",
2927
- xmlns: "http://www.w3.org/2000/svg",
2928
- height: `${size}px`,
2929
- viewBox: "0 0 24 24",
2930
- width: `${size}px`,
2931
- style,
2932
- onClick,
2933
- className: join(props.className, "ITableIcon", "ITableIcon-expander", `ITableIcon-expander--${expanded ? "expanded" : "collapsed"}`)
2934
- }, /* @__PURE__ */ createElement4("path", {
2935
- d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"
2936
- }));
3212
+ // src/components/InfiniteTable/hooks/useToggleGroupRow.ts
3213
+ function useToggleGroupRow() {
3214
+ const { getState: getDataSourceState, componentActions: dataSourceActions } = useDataSourceContextValue();
3215
+ const toggleGroupRow = useCallback4((groupKeys) => {
3216
+ const newState = new GroupRowsState(getDataSourceState().groupRowsState);
3217
+ newState.toggleGroupRow(groupKeys);
3218
+ dataSourceActions.groupRowsState = newState;
3219
+ }, []);
3220
+ return toggleGroupRow;
2937
3221
  }
2938
3222
 
2939
- // src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
2940
- function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params) {
2941
- if (!pivotColumns) {
2942
- return void 0;
2943
- }
2944
- const {
2945
- pivotColumn,
2946
- pivotRowLabelsColumn,
2947
- pivotBy,
2948
- groupRowsBy,
2949
- pivotTotalColumnPosition,
2950
- toggleGroupRow
2951
- } = params;
2952
- const computedPivotColumns = new Map();
2953
- pivotColumns.forEach((col, key) => {
2954
- if (col.pivotTotalColumn && pivotTotalColumnPosition === false) {
2955
- return;
2956
- }
2957
- let column = __spreadValues({}, col);
2958
- if (pivotColumn) {
2959
- if (typeof pivotColumn === "function") {
2960
- column = __spreadValues(__spreadValues({}, column), pivotColumn({
2961
- column,
2962
- pivotBy,
2963
- groupRowsBy
2964
- }));
2965
- } else {
2966
- column = __spreadValues(__spreadValues({}, column), pivotColumn);
2967
- }
2968
- }
2969
- const isPivotRowLabelsColumn = !column.pivotColumn && !column.pivotTotalColumn;
2970
- if (pivotRowLabelsColumn && isPivotRowLabelsColumn) {
2971
- if (typeof pivotRowLabelsColumn === "function") {
2972
- column = __spreadValues(__spreadValues({}, column), pivotRowLabelsColumn({
2973
- column,
2974
- pivotBy,
2975
- groupRowsBy
2976
- }));
2977
- } else {
2978
- column = __spreadValues(__spreadValues({}, column), pivotRowLabelsColumn);
2979
- }
2980
- }
2981
- if (isPivotRowLabelsColumn && !column.render) {
2982
- column.render = (renderOptions) => {
2983
- var _a;
2984
- let { value, enhancedData, column: column2, groupRowsBy: groupRowsBy2 } = renderOptions;
2985
- if (column2.renderValue) {
2986
- value = column2.renderValue(renderOptions);
2987
- }
2988
- const showExpanderIcon = (((_a = enhancedData.groupKeys) == null ? void 0 : _a.length) || 0) < groupRowsBy2.length;
2989
- return /* @__PURE__ */ createElement5("div", {
2990
- className: join(ICSS.display.flex, ICSS.alignItems.center),
2991
- style: {
2992
- paddingInlineStart: `calc(${enhancedData.groupNesting - 1} * var(--ITableRow-group-column-nesting))`
2993
- }
2994
- }, showExpanderIcon ? /* @__PURE__ */ createElement5(ExpanderIcon, {
2995
- expanded: !enhancedData.collapsed,
2996
- onChange: () => {
2997
- toggleGroupRow(enhancedData.groupKeys);
2998
- }
2999
- }) : null, /* @__PURE__ */ createElement5("div", {
3000
- className: cssEllipsisClassName
3001
- }, value != null ? value : null));
3002
- };
3003
- }
3004
- if (!column.render && column.renderValue) {
3005
- column.render = (renderOptions) => {
3006
- return column.renderValue(renderOptions);
3007
- };
3008
- }
3009
- computedPivotColumns.set(key, column);
3010
- });
3011
- return computedPivotColumns;
3223
+ // src/components/InfiniteTable/hooks/useColumnsWhen.ts
3224
+ function useGroupRowsMap(groupRowsBy) {
3225
+ const groupRowsMap = useMemo5(() => {
3226
+ return groupRowsBy.reduce((acc, groupBy, index) => {
3227
+ acc.set(groupBy.field, {
3228
+ groupBy,
3229
+ groupIndex: index
3230
+ });
3231
+ return acc;
3232
+ }, new Map());
3233
+ }, [groupRowsBy]);
3234
+ return groupRowsMap;
3012
3235
  }
3013
-
3014
- // src/components/InfiniteTable/utils/getColumnForGroupBy.tsx
3015
- import {
3016
- createElement as createElement6
3017
- } from "react";
3018
- function getColumnForGroupBy(options, toggleGroupRow, groupColumnFromProps) {
3019
- const { groupBy, groupIndex } = options;
3020
- let generatedGroupColumn = __spreadValues({
3021
- header: `Group by ${groupBy.field}`,
3022
- groupByField: groupBy.field,
3023
- sortable: false,
3024
- render: (renderOptions) => {
3025
- let { value, enhancedData, column } = renderOptions;
3026
- if (!enhancedData.isGroupRow) {
3027
- return null;
3028
- }
3029
- if (groupIndex + 1 !== enhancedData.groupNesting) {
3030
- return null;
3031
- }
3032
- if (column.renderValue) {
3033
- value = column.renderValue(renderOptions);
3034
- }
3035
- return /* @__PURE__ */ createElement6("div", {
3036
- className: join(ICSS.display.flex, ICSS.alignItems.center)
3037
- }, /* @__PURE__ */ createElement6(ExpanderIcon, {
3038
- expanded: !enhancedData.collapsed,
3039
- onChange: () => {
3040
- toggleGroupRow(enhancedData.groupKeys);
3041
- }
3042
- }), /* @__PURE__ */ createElement6("div", {
3043
- className: cssEllipsisClassName
3044
- }, value != null ? value : null));
3045
- }
3046
- }, groupBy.column);
3047
- if (groupColumnFromProps) {
3048
- if (typeof groupColumnFromProps === "function") {
3049
- generatedGroupColumn = __spreadValues(__spreadValues({}, generatedGroupColumn), groupColumnFromProps(options, toggleGroupRow));
3050
- } else {
3051
- generatedGroupColumn = __spreadValues(__spreadValues({}, generatedGroupColumn), groupColumnFromProps);
3052
- }
3053
- }
3054
- return generatedGroupColumn;
3236
+ function useColumnsWhen() {
3237
+ const {
3238
+ componentState: { groupRowsBy },
3239
+ componentActions: dataSourceActions
3240
+ } = useDataSourceContextValue();
3241
+ const {
3242
+ componentState: { groupRenderStrategy, pivotTotalColumnPosition }
3243
+ } = useComponentState();
3244
+ const groupRowsMap = useGroupRowsMap(groupRowsBy);
3245
+ useEffect8(() => {
3246
+ dataSourceActions.generateGroupRows = groupRenderStrategy !== "inline";
3247
+ }, [groupRenderStrategy]);
3248
+ useEffect8(() => {
3249
+ dataSourceActions.pivotTotalColumnPosition = pivotTotalColumnPosition;
3250
+ }, [pivotTotalColumnPosition]);
3251
+ useColumnsWhenInlineGroupRenderStrategy(groupRowsMap);
3252
+ useColumnsWhenPivoting();
3253
+ useColumnsWhenGrouping();
3254
+ useHideEmptyGroupColumns(groupRowsMap);
3055
3255
  }
3056
- function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
3057
- let generatedGroupColumn = {
3058
- header: `Group`,
3059
- groupByField: options.groupRowsBy.map((g) => g.field),
3060
- sortable: false,
3061
- render: (renderOptions) => {
3062
- let { value, enhancedData, column } = renderOptions;
3063
- if (!enhancedData.isGroupRow) {
3064
- return null;
3065
- }
3066
- if (column.renderValue) {
3067
- value = column.renderValue(renderOptions);
3256
+ function useColumnsWhenInlineGroupRenderStrategy(groupRowsMap) {
3257
+ const toggleGroupRow = useToggleGroupRow();
3258
+ const {
3259
+ componentActions,
3260
+ componentState: { columns, groupRenderStrategy }
3261
+ } = useComponentState();
3262
+ function computeColumnsWhenInlineGroupRenderStrategy(columns2, groupRowsMap2, groupRenderStrategy2, toggleGroupRow2) {
3263
+ const computedColumns = new Map();
3264
+ columns2.forEach((column, id) => {
3265
+ let base = {};
3266
+ const groupByForColumn = groupRowsMap2.get(column.field);
3267
+ if (groupByForColumn && groupRenderStrategy2 === "inline") {
3268
+ const { groupIndex } = groupByForColumn;
3269
+ const field = groupByForColumn.groupBy.field;
3270
+ base = {
3271
+ groupByField: field,
3272
+ field,
3273
+ valueGetter: ({ rowInfo }) => {
3274
+ var _a;
3275
+ return (_a = rowInfo.groupKeys) == null ? void 0 : _a[groupIndex];
3276
+ },
3277
+ rowspan: ({ rowInfo, dataArray }) => {
3278
+ const prevRowInfo = dataArray[rowInfo.indexInAll - 1] || {
3279
+ indexInParentGroups: []
3280
+ };
3281
+ const prevIndexes = prevRowInfo.indexInParentGroups || [];
3282
+ const currentIndexes = rowInfo.indexInParentGroups || [];
3283
+ let computeSpan = false;
3284
+ for (let i = 0; i <= groupIndex; i++) {
3285
+ const prev = prevIndexes[i];
3286
+ const current = currentIndexes[i];
3287
+ if (current !== prev) {
3288
+ computeSpan = true;
3289
+ break;
3290
+ }
3291
+ }
3292
+ if (!computeSpan) {
3293
+ return 1;
3294
+ }
3295
+ const parentGroup = rowInfo.parents[groupIndex];
3296
+ const rowspan = parentGroup ? parentGroup.groupCount - (parentGroup.collapsedChildrenCount || 0) + (parentGroup.collapsedGroupsCount || 0) : 1;
3297
+ return rowspan;
3298
+ },
3299
+ render: getGroupColumnRender({
3300
+ groupIndex,
3301
+ groupRenderStrategy: groupRenderStrategy2,
3302
+ toggleGroupRow: toggleGroupRow2
3303
+ })
3304
+ };
3068
3305
  }
3069
- return /* @__PURE__ */ createElement6("div", {
3070
- className: join(ICSS.display.flex, ICSS.alignItems.center),
3071
- style: {
3072
- paddingInlineStart: `calc(${enhancedData.groupNesting - 1} * var(--ITableRow-group-column-nesting))`
3073
- }
3074
- }, /* @__PURE__ */ createElement6(ExpanderIcon, {
3075
- expanded: !enhancedData.collapsed,
3076
- onChange: () => {
3077
- toggleGroupRow(enhancedData.groupKeys);
3078
- }
3079
- }), /* @__PURE__ */ createElement6("div", {
3080
- className: cssEllipsisClassName
3081
- }, value != null ? value : null));
3082
- }
3083
- };
3084
- if (groupColumnFromProps) {
3085
- if (typeof groupColumnFromProps === "function") {
3086
- generatedGroupColumn = __spreadValues(__spreadValues({}, generatedGroupColumn), groupColumnFromProps(options, toggleGroupRow));
3087
- } else {
3088
- generatedGroupColumn = __spreadValues(__spreadValues({}, generatedGroupColumn), groupColumnFromProps);
3089
- }
3090
- }
3091
- return generatedGroupColumn;
3092
- }
3093
-
3094
- // src/components/InfiniteTable/hooks/useGeneratedGroupAndPivotColumns.ts
3095
- function getGroupRenderStrategy(options) {
3096
- const { groupRowsBy, groupColumn, groupRenderStrategy } = options;
3097
- if (groupRenderStrategy) {
3098
- return groupRenderStrategy;
3099
- }
3100
- if (groupColumn != null && typeof groupColumn === "object") {
3101
- return "single-column";
3102
- }
3103
- const columnsInGroupRowsBy = groupRowsBy.filter((g) => g.column);
3104
- if (columnsInGroupRowsBy.length) {
3105
- return "multi-column";
3306
+ const clone = __spreadValues(__spreadValues({}, base), column);
3307
+ computedColumns.set(id, clone);
3308
+ });
3309
+ return computedColumns.size === 0 ? void 0 : computedColumns;
3106
3310
  }
3107
- return "multi-column";
3311
+ useEffect8(() => {
3312
+ const update = () => {
3313
+ componentActions.columnsWhenInlineGroupRenderStrategy = computeColumnsWhenInlineGroupRenderStrategy(columns, groupRowsMap, groupRenderStrategy, toggleGroupRow);
3314
+ };
3315
+ update();
3316
+ return interceptMap(columns, {
3317
+ set: update,
3318
+ delete: update,
3319
+ clear: update
3320
+ });
3321
+ }, [columns, groupRowsMap, groupRenderStrategy, toggleGroupRow]);
3108
3322
  }
3109
- function useGeneratedGroupAndPivotColumns() {
3323
+ function useColumnsWhenPivoting() {
3110
3324
  const {
3111
- componentState: { groupRowsBy, pivotBy },
3112
- getState: getDataSourceState,
3113
- componentActions: dataSourceActions
3325
+ componentState: { groupRowsBy, pivotBy }
3114
3326
  } = useDataSourceContextValue();
3115
3327
  const {
3116
- getComponentState,
3117
3328
  componentActions,
3118
3329
  componentState: {
3119
- groupColumn,
3120
- groupRenderStrategy,
3330
+ pivotColumns,
3121
3331
  pivotColumn,
3122
3332
  pivotRowLabelsColumn,
3123
- pivotColumns,
3124
3333
  pivotTotalColumnPosition
3125
3334
  }
3126
3335
  } = useComponentState();
3127
- const toggleGroupRow = useCallback4((groupKeys) => {
3128
- const newState = new GroupRowsState(getDataSourceState().groupRowsState);
3129
- newState.toggleGroupRow(groupKeys);
3130
- dataSourceActions.groupRowsState = newState;
3131
- }, []);
3132
- useEffect8(() => {
3133
- const currentState = getComponentState();
3134
- if (pivotColumns) {
3135
- if (currentState.generatedColumns.size) {
3136
- componentActions.generatedColumns = new Map();
3137
- }
3138
- return;
3139
- }
3140
- componentActions.generatedColumns = getGeneratedGroupColumns({
3141
- groupColumn,
3142
- groupRenderStrategy,
3143
- groupRowsBy,
3144
- pivotColumns,
3145
- toggleGroupRow
3146
- });
3147
- }, [groupRowsBy, groupColumn, groupRenderStrategy, pivotColumns]);
3148
- useEffect8(() => {
3149
- dataSourceActions.pivotTotalColumnPosition = pivotTotalColumnPosition;
3150
- }, [pivotTotalColumnPosition]);
3336
+ const toggleGroupRow = useToggleGroupRow();
3151
3337
  useEffect8(() => {
3152
3338
  const computedPivotColumns = getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, {
3153
3339
  pivotColumn,
@@ -3160,64 +3346,166 @@ function useGeneratedGroupAndPivotColumns() {
3160
3346
  componentActions.computedPivotColumns = computedPivotColumns;
3161
3347
  }, [pivotColumns, pivotColumn, pivotRowLabelsColumn]);
3162
3348
  }
3163
- function getGeneratedGroupColumns(params) {
3349
+ function useColumnsWhenGrouping() {
3350
+ const {
3351
+ componentState: { groupRowsBy }
3352
+ } = useDataSourceContextValue();
3353
+ const {
3354
+ componentActions,
3355
+ componentState: { columns, groupColumn, groupRenderStrategy, pivotColumns }
3356
+ } = useComponentState();
3357
+ const toggleGroupRow = useToggleGroupRow();
3358
+ useEffect8(() => {
3359
+ if (pivotColumns) {
3360
+ return;
3361
+ }
3362
+ const update = () => {
3363
+ componentActions.columnsWhenGrouping = getColumnsWhenGrouping({
3364
+ columns,
3365
+ groupColumn,
3366
+ groupRenderStrategy,
3367
+ groupRowsBy,
3368
+ pivotColumns,
3369
+ toggleGroupRow
3370
+ });
3371
+ };
3372
+ update();
3373
+ return interceptMap(columns, {
3374
+ set: update,
3375
+ delete: update,
3376
+ clear: update
3377
+ });
3378
+ }, [groupRowsBy, groupColumn, groupRenderStrategy, pivotColumns]);
3379
+ }
3380
+ function useHideEmptyGroupColumns(groupRowsMap) {
3381
+ const {
3382
+ componentState: { groupRowsBy, groupRowsState },
3383
+ getState: getDataSourceState
3384
+ } = useDataSourceContextValue();
3385
+ const {
3386
+ getComponentState,
3387
+ componentActions,
3388
+ componentState: {
3389
+ columnsWhenGrouping: generatedColumns,
3390
+ hideEmptyGroupColumns,
3391
+ groupRenderStrategy
3392
+ }
3393
+ } = useComponentState();
3394
+ useEffect8(() => {
3395
+ if (groupRenderStrategy === "single-column") {
3396
+ return;
3397
+ }
3398
+ const groupsLength = groupRowsBy.length;
3399
+ let expandedGroupsLevel = 0;
3400
+ const { dataArray } = getDataSourceState();
3401
+ const len = dataArray.length;
3402
+ for (let i = 0; i < len; i++) {
3403
+ const data = dataArray[i];
3404
+ expandedGroupsLevel = Math.max(expandedGroupsLevel, data.groupNesting - 1);
3405
+ if (expandedGroupsLevel === groupsLength - 1) {
3406
+ break;
3407
+ }
3408
+ }
3409
+ const currentState = getComponentState();
3410
+ const { computedColumns } = currentState;
3411
+ let updated = false;
3412
+ const columnVisibility = new Map(currentState.columnVisibility);
3413
+ const cols = computedColumns;
3414
+ groupRowsBy.forEach(({ field }, index) => {
3415
+ const colId = groupRenderStrategy === "multi-column" ? `group-by-${field}` : field;
3416
+ const col = cols.get(colId);
3417
+ if (!col) {
3418
+ return;
3419
+ }
3420
+ const shouldBeHidden = index > expandedGroupsLevel;
3421
+ updated = true;
3422
+ if (shouldBeHidden && hideEmptyGroupColumns) {
3423
+ columnVisibility.set(colId, false);
3424
+ } else {
3425
+ columnVisibility.delete(colId);
3426
+ }
3427
+ });
3428
+ if (updated) {
3429
+ componentActions.columnVisibility = columnVisibility;
3430
+ }
3431
+ }, [
3432
+ getDataSourceState,
3433
+ groupRenderStrategy,
3434
+ generatedColumns,
3435
+ groupRowsBy,
3436
+ groupRowsMap,
3437
+ hideEmptyGroupColumns ? groupRowsState : null,
3438
+ hideEmptyGroupColumns
3439
+ ]);
3440
+ }
3441
+ function getColumnsWhenGrouping(params) {
3164
3442
  const {
3165
3443
  pivotColumns,
3166
3444
  groupRowsBy,
3167
3445
  groupColumn,
3168
3446
  groupRenderStrategy,
3169
- toggleGroupRow
3447
+ toggleGroupRow,
3448
+ columns
3170
3449
  } = params;
3171
- const generatedColumns = new Map();
3172
3450
  if (pivotColumns) {
3173
- return generatedColumns;
3451
+ return void 0;
3174
3452
  }
3175
- const strategy = getGroupRenderStrategy({
3176
- groupRowsBy,
3177
- groupColumn,
3178
- groupRenderStrategy
3179
- });
3453
+ if (groupRenderStrategy === "inline") {
3454
+ return void 0;
3455
+ }
3456
+ const computedColumns = new Map();
3180
3457
  if (groupRenderStrategy === "multi-column") {
3181
3458
  groupRowsBy.forEach((groupBy, index, arr) => {
3182
- generatedColumns.set(`group-by-${groupBy.field}`, getColumnForGroupBy({ groupBy, groupRowsBy, groupIndex: index, groupCount: arr.length }, toggleGroupRow, groupColumn));
3459
+ computedColumns.set(`group-by-${groupBy.field}`, getColumnForGroupBy({
3460
+ groupBy,
3461
+ groupRowsBy,
3462
+ groupIndex: index,
3463
+ groupCount: arr.length,
3464
+ groupRenderStrategy
3465
+ }, toggleGroupRow, groupColumn));
3183
3466
  });
3184
- } else if (strategy === "single-column") {
3185
- generatedColumns.set("group-by", getSingleGroupColumn({
3467
+ } else if (groupRenderStrategy === "single-column") {
3468
+ computedColumns.set("group-by", getSingleGroupColumn({
3186
3469
  groupCount: groupRowsBy.length,
3187
3470
  groupRowsBy
3188
3471
  }, toggleGroupRow, groupColumn));
3189
3472
  }
3190
- return generatedColumns;
3473
+ columns.forEach((col, colId) => {
3474
+ computedColumns.set(colId, col);
3475
+ });
3476
+ return computedColumns;
3191
3477
  }
3192
3478
 
3193
3479
  // src/components/InfiniteTable/hooks/useComputed.ts
3194
3480
  function useComputed() {
3195
- const { componentActions, componentState, updateStateProperty } = useComponentState();
3481
+ var _a;
3482
+ const { componentActions, componentState } = useComponentState();
3196
3483
  const {
3197
3484
  componentActions: dataSourceActions,
3198
3485
  componentState: dataSourceState
3199
3486
  } = useDataSourceContextValue();
3200
3487
  const { columnOrder, columnVisibility, columnPinning, bodySize } = componentState;
3201
3488
  useState4(() => {
3202
- componentState.onRowHeightChange.onChange((rowHeight) => {
3489
+ componentState.onRowHeightCSSVarChange.onChange((rowHeight) => {
3203
3490
  if (rowHeight) {
3204
- componentActions.rowHeightComputed = rowHeight;
3491
+ componentActions.rowHeight = rowHeight;
3205
3492
  }
3206
3493
  });
3207
- componentState.onHeaderHeightChange.onChange((headerHeight) => {
3494
+ componentState.onHeaderHeightCSSVarChange.onChange((headerHeight) => {
3208
3495
  if (headerHeight) {
3209
- updateStateProperty("headerHeight", headerHeight);
3496
+ componentActions.headerHeight = headerHeight;
3210
3497
  }
3211
3498
  });
3212
3499
  });
3213
3500
  useColumnAggregations();
3214
3501
  const { multiSort } = dataSourceState;
3215
3502
  useColumnGroups();
3216
- useGeneratedGroupAndPivotColumns();
3503
+ useColumnsWhen();
3217
3504
  const setSortInfo = useCallback5((sortInfo) => {
3218
- var _a;
3219
- dataSourceActions.sortInfo = multiSort ? sortInfo : (_a = sortInfo[0]) != null ? _a : null;
3220
- }, [multiSort]);
3505
+ var _a2;
3506
+ dataSourceActions.sortInfo = multiSort ? sortInfo : (_a2 = sortInfo[0]) != null ? _a2 : null;
3507
+ }, []);
3508
+ const columns = componentState.computedColumns;
3221
3509
  const {
3222
3510
  computedColumnOrder,
3223
3511
  computedVisibleColumns,
@@ -3234,8 +3522,7 @@ function useComputed() {
3234
3522
  computedPinnedStartWidth,
3235
3523
  computedPinnedEndWidth
3236
3524
  } = useComputedVisibleColumns({
3237
- columns: componentState.computedPivotColumns || componentState.columns,
3238
- generatedColumns: componentState.generatedColumns,
3525
+ columns,
3239
3526
  columnMinWidth: componentState.columnMinWidth,
3240
3527
  columnMaxWidth: componentState.columnMaxWidth,
3241
3528
  columnDefaultWidth: componentState.columnDefaultWidth,
@@ -3244,7 +3531,7 @@ function useComputed() {
3244
3531
  bodySize,
3245
3532
  sortable: componentState.sortable,
3246
3533
  draggableColumns: componentState.draggableColumns,
3247
- sortInfo: dataSourceState.sortInfo,
3534
+ sortInfo: (_a = dataSourceState.sortInfo) != null ? _a : void 0,
3248
3535
  multiSort,
3249
3536
  setSortInfo,
3250
3537
  columnOrder,
@@ -3313,11 +3600,11 @@ var useInternalProps = () => {
3313
3600
 
3314
3601
  // src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx
3315
3602
  var InfiniteTableBody = forwardRef(function InfiniteTableBody2(props, ref) {
3316
- const { rootClassName: rootClassName11 } = useInternalProps();
3603
+ const { rootClassName: rootClassName12 } = useInternalProps();
3317
3604
  return /* @__PURE__ */ createElement7("div", __spreadProps(__spreadValues({
3318
3605
  ref
3319
3606
  }, props), {
3320
- className: join(`${rootClassName11}Body`, ICSS.position.relative, ICSS.transform.translate3D000, props.className)
3607
+ className: join(`${rootClassName12}Body`, position.relative, flex["1"], transformTranslateZero, props.className)
3321
3608
  }));
3322
3609
  });
3323
3610
 
@@ -3391,19 +3678,30 @@ function VerticalScrollbarPlaceholderFn(props) {
3391
3678
  }
3392
3679
  var VerticalScrollbarPlaceholder = memo2(VerticalScrollbarPlaceholderFn);
3393
3680
 
3681
+ // src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts
3682
+ var CellCls = "_1eexc2a5 _16lm1iwh _16lm1iwy _16lm1iwz _16lm1iw2 _16lm1iw17 _16lm1iw18";
3683
+ var HeaderCellProxy = "_12zfob10";
3684
+ 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"]] });
3685
+ 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"]] });
3686
+ var HeaderGroupCls = "_16lm1iwx _16lm1iwh";
3687
+ var HeaderGroup_Children = "_16lm1iwh _16lm1iwy _16lm1iw10 _16lm1iwa";
3688
+ var HeaderGroup_Header = "_12zfob1x _16lm1iwh _16lm1iwy _16lm1iwz";
3689
+ var HeaderSortIconCls = "_12zfob11 _16lm1iw1";
3690
+ var HeaderWrapperCls = "_12zfob1v _16lm1iw14 _16lm1iw1 _16lm1iwh _16lm1iwy";
3691
+
3394
3692
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
3395
3693
  import {
3396
3694
  createElement as createElement15,
3397
3695
  memo as memo6
3398
3696
  } from "react";
3399
- import { useCallback as useCallback8, useEffect as useEffect12, useRef as useRef6 } from "react";
3697
+ import { useCallback as useCallback8, useEffect as useEffect12, useRef as useRef7 } from "react";
3400
3698
 
3401
3699
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
3402
3700
  import {
3403
3701
  Fragment as Fragment2,
3404
3702
  createElement as createElement11
3405
3703
  } from "react";
3406
- import { useCallback as useCallback7, useEffect as useEffect10, useRef as useRef5 } from "react";
3704
+ import { useCallback as useCallback7, useEffect as useEffect10, useRef as useRef6 } from "react";
3407
3705
 
3408
3706
  // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
3409
3707
  import {
@@ -3419,10 +3717,17 @@ var useInfiniteTableState = () => {
3419
3717
  return componentState;
3420
3718
  };
3421
3719
 
3720
+ // src/components/InfiniteTable/components/cell.css.ts
3721
+ var CellCls2 = "_1eexc2a5 _16lm1iwh _16lm1iwy _16lm1iwz _16lm1iw2 _16lm1iw17 _16lm1iw18";
3722
+ var CellClsVariants = { shifting: "_1eexc2a3", dragging: "_1eexc2a4" };
3723
+ 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"]] });
3724
+ var columnAlignCellStyle = { center: "_1eexc2a0", start: "_1eexc2a1", end: "_1eexc2a2" };
3725
+
3422
3726
  // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
3423
3727
  var { rootClassName: rootClassName2 } = internalProps;
3424
3728
  var InfiniteTableCellClassName = `${rootClassName2}Cell`;
3425
3729
  function InfiniteTableCellFn(props) {
3730
+ var _b, _c;
3426
3731
  const _a = props, {
3427
3732
  cssEllipsis = true,
3428
3733
  virtualized = true,
@@ -3464,7 +3769,7 @@ function InfiniteTableCellFn(props) {
3464
3769
  ref: domRef,
3465
3770
  style,
3466
3771
  "data-name": `Cell`,
3467
- 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` : "")
3772
+ 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}` : "")
3468
3773
  }), beforeChildren, cssEllipsis ? /* @__PURE__ */ createElement9("div", {
3469
3774
  className: `${rootClassName2}Cell_content ${cssEllipsisClassName}`
3470
3775
  }, children) : children, afterChildren);
@@ -3475,8 +3780,8 @@ var InfiniteTableCell = memo3(InfiniteTableCellFn);
3475
3780
  var import_binary_search = __toModule(require_binary_search());
3476
3781
  import {
3477
3782
  useCallback as useCallback6,
3478
- useMemo as useMemo5,
3479
- useRef as useRef4,
3783
+ useMemo as useMemo6,
3784
+ useRef as useRef5,
3480
3785
  useState as useState5
3481
3786
  } from "react";
3482
3787
 
@@ -3514,16 +3819,16 @@ var useColumnPointerEvents = ({
3514
3819
  }) => {
3515
3820
  const [draggingDiff, setDraggingDiff] = useState5(null);
3516
3821
  const [proxyOffset, setProxyOffset] = useState5(null);
3517
- const breakpointsRef = useRef4([]);
3518
- const pointerMoveRef = useRef4(null);
3519
- const didDragRef = useRef4(false);
3520
- const initialClientPos = useRef4(null);
3521
- const currentDropIndexRef = useRef4(null);
3822
+ const breakpointsRef = useRef5([]);
3823
+ const pointerMoveRef = useRef5(null);
3824
+ const didDragRef = useRef5(false);
3825
+ const initialClientPos = useRef5(null);
3826
+ const currentDropIndexRef = useRef5(null);
3522
3827
  const dragging = draggingDiff != null;
3523
3828
  const { componentActions, computed } = useInfiniteTable();
3524
3829
  const { computedColumnOrder } = computed;
3525
- const column = useMemo5(() => columns.get(columnId), [columnId, columns]);
3526
- const { columnIndex, columnWidth, columnsArray } = useMemo5(() => {
3830
+ const column = useMemo6(() => columns.get(columnId), [columnId, columns]);
3831
+ const { columnIndex, columnWidth, columnsArray } = useMemo6(() => {
3527
3832
  const columnsArray2 = Array.from(columns.values());
3528
3833
  return {
3529
3834
  columnsArray: columnsArray2,
@@ -3531,7 +3836,7 @@ var useColumnPointerEvents = ({
3531
3836
  columnWidth: column.computedWidth
3532
3837
  };
3533
3838
  }, [columns, columnId, column]);
3534
- let cursorRef = useRef4("auto");
3839
+ let cursorRef = useRef5("auto");
3535
3840
  const onPointerDown = useCallback6((e) => {
3536
3841
  const target = domRef.current;
3537
3842
  cursorRef.current = target.style.cursor;
@@ -3629,11 +3934,25 @@ var useColumnPointerEvents = ({
3629
3934
  };
3630
3935
 
3631
3936
  // src/components/InfiniteTable/hooks/useCellClassName.ts
3632
- function useCellClassName(column, baseClasses) {
3937
+ function useCellClassName(column, baseClasses, variants, extraFlags) {
3633
3938
  const result = [...baseClasses];
3939
+ const variantObject = {
3940
+ first: column.computedFirst,
3941
+ last: column.computedLast,
3942
+ groupByField: !!column.groupByField,
3943
+ firstInCategory: column.computedFirstInCategory,
3944
+ lastInCategory: column.computedLastInCategory,
3945
+ pinned: column.computedPinned || false,
3946
+ dragging: extraFlags.dragging
3947
+ };
3948
+ const theVariant = variants(variantObject);
3949
+ result.push(theVariant);
3634
3950
  if (column.computedFirst) {
3635
3951
  result.push(...baseClasses.map((c) => `${c}--first`));
3636
3952
  }
3953
+ if (column.groupByField) {
3954
+ result.push(...baseClasses.map((c) => `${c}--group-column`));
3955
+ }
3637
3956
  if (column.computedLast) {
3638
3957
  result.push(...baseClasses.map((c) => `${c}--last`));
3639
3958
  }
@@ -3648,7 +3967,7 @@ function useCellClassName(column, baseClasses) {
3648
3967
  } else {
3649
3968
  result.push(...baseClasses.map((c) => `${c}--unpinned`));
3650
3969
  }
3651
- return result.join(" ");
3970
+ return result.filter(Boolean).join(" ");
3652
3971
  }
3653
3972
 
3654
3973
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
@@ -3755,10 +4074,10 @@ function InfiniteTableHeaderCell(props) {
3755
4074
  header = header != null ? header : column.name;
3756
4075
  const sortTool = /* @__PURE__ */ createElement11(SortIcon, {
3757
4076
  index: column.computedMultiSort ? column.computedSortIndex + 1 : void 0,
3758
- className: `${baseCls}__sort-icon`,
4077
+ className: `${baseCls}__sort-icon ${HeaderSortIconCls}`,
3759
4078
  direction: column.computedSorted ? column.computedSortedAsc ? 1 : -1 : 0
3760
4079
  });
3761
- const domRef = useRef5(null);
4080
+ const domRef = useRef6(null);
3762
4081
  const ref = useCallback7((node) => {
3763
4082
  var _a2;
3764
4083
  domRef.current = node;
@@ -3792,7 +4111,7 @@ function InfiniteTableHeaderCell(props) {
3792
4111
  let draggingProxy = null;
3793
4112
  if (dragging) {
3794
4113
  draggingProxy = /* @__PURE__ */ createElement11("div", {
3795
- className: `${baseCls}Proxy`,
4114
+ className: `${baseCls}Proxy ${HeaderCellProxy}`,
3796
4115
  style: {
3797
4116
  position: "absolute",
3798
4117
  height: headerHeight,
@@ -3813,7 +4132,7 @@ function InfiniteTableHeaderCell(props) {
3813
4132
  offset,
3814
4133
  onPointerDown,
3815
4134
  onPointerUp,
3816
- className: join(baseCls, ICSS.userSelect.none, column.computedSortable ? ICSS.cursor.pointer : "", useCellClassName(column, [baseCls, InfiniteTableCellClassName]), dragging ? `${InfiniteTableCellClassName}--dragging ${baseCls}--dragging` : ""),
4135
+ className: join(baseCls, userSelect.none, column.computedSortable ? cursor.pointer : "", useCellClassName(column, [baseCls, InfiniteTableCellClassName], HeaderCellRecipe, { dragging }), CellCls),
3817
4136
  cssEllipsis: (_d = (_c = column.headerCssEllipsis) != null ? _c : column.cssEllipsis) != null ? _d : true,
3818
4137
  afterChildren: sortTool
3819
4138
  }, header), draggingProxy);
@@ -3824,7 +4143,7 @@ import {
3824
4143
  createElement as createElement14,
3825
4144
  memo as memo5
3826
4145
  } from "react";
3827
- import { useMemo as useMemo6, useEffect as useEffect11 } from "react";
4146
+ import { useMemo as useMemo7, useEffect as useEffect11 } from "react";
3828
4147
 
3829
4148
  // src/components/RawList/ReactVirtualRenderer.tsx
3830
4149
  import {
@@ -4104,9 +4423,21 @@ var ReactVirtualRenderer = class extends Logger {
4104
4423
  if (this.destroyed) {
4105
4424
  return;
4106
4425
  }
4426
+ const spanParent = this.brain.getItemSpanParent(itemIndex);
4427
+ let covered = false;
4428
+ if (spanParent !== itemIndex) {
4429
+ covered = true;
4430
+ }
4431
+ const itemSize = this.brain.getItemSize(itemIndex);
4432
+ const itemSpan = this.brain.getItemSpan(itemIndex);
4433
+ const itemSizeWithSpan = itemSpan === 1 ? itemSize : this.brain.getItemSizeWithSpan(itemIndex, itemSpan);
4107
4434
  const renderedNode = renderItem({
4435
+ spanParent,
4108
4436
  itemIndex,
4109
- itemSize: this.brain.getItemSize(itemIndex),
4437
+ itemSize,
4438
+ itemSizeWithSpan,
4439
+ itemSpan,
4440
+ covered,
4110
4441
  domRef: this.itemDOMRefs[elementIndex]
4111
4442
  });
4112
4443
  const itemUpdater = this.updaters[elementIndex];
@@ -4126,7 +4457,7 @@ var ReactVirtualRenderer = class extends Logger {
4126
4457
  // src/components/RawList/index.tsx
4127
4458
  function RawListFn(props) {
4128
4459
  const { renderItem, brain, debugChannel } = props;
4129
- const { onRenderUpdater, renderer } = useMemo6(() => {
4460
+ const { onRenderUpdater, renderer } = useMemo7(() => {
4130
4461
  const onRenderUpdater2 = buildSubscriptionCallback();
4131
4462
  const renderer2 = new ReactVirtualRenderer(brain, {
4132
4463
  channel: debugChannel
@@ -4169,7 +4500,7 @@ var debug3 = dbg("Header");
4169
4500
  var { rootClassName: rootClassName4 } = internalProps;
4170
4501
  var TableHeaderClassName = `${rootClassName4}Header`;
4171
4502
  function InfiniteTableHeaderFn(props) {
4172
- const { repaintId, brain, columns, style, className } = props;
4503
+ const { repaintId, brain, columns, style, className, pinning } = props;
4173
4504
  const {
4174
4505
  computed,
4175
4506
  componentState: { headerHeight }
@@ -4197,10 +4528,15 @@ function InfiniteTableHeaderFn(props) {
4197
4528
  const removeOnScroll = brain.onScroll(onScroll);
4198
4529
  return removeOnScroll;
4199
4530
  }, [brain]);
4200
- const domRef = useRef6(null);
4531
+ const domRef = useRef7(null);
4532
+ const headerCls = HeaderClsRecipe({
4533
+ pinned: pinning,
4534
+ overflow: false,
4535
+ virtualized: true
4536
+ });
4201
4537
  const domProps = {
4202
4538
  ref: domRef,
4203
- className: join(ICSS.flexFlow.row, TableHeaderClassName, `${TableHeaderClassName}--virtualized`, className),
4539
+ className: join(TableHeaderClassName, `${TableHeaderClassName}--virtualized`, className, headerCls),
4204
4540
  style
4205
4541
  };
4206
4542
  return /* @__PURE__ */ createElement15("div", __spreadValues({}, domProps), /* @__PURE__ */ createElement15(RawList, {
@@ -4214,8 +4550,8 @@ var InfiniteTableHeader = memo6(InfiniteTableHeaderFn);
4214
4550
  import {
4215
4551
  createElement as createElement18,
4216
4552
  memo as memo7,
4217
- useMemo as useMemo7,
4218
- useRef as useRef7
4553
+ useMemo as useMemo8,
4554
+ useRef as useRef8
4219
4555
  } from "react";
4220
4556
 
4221
4557
  // src/components/InfiniteTable/components/InfiniteTableHeader/renderColumnHeaderGroups.tsx
@@ -4329,15 +4665,15 @@ function InfiniteTableHeaderGroup(props) {
4329
4665
  };
4330
4666
  return /* @__PURE__ */ createElement16("div", {
4331
4667
  "data-group-id": columnGroup.id,
4332
- className: join(ICSS.flexFlow.column, ICSS.display.flex, TableHeaderGroupClassName, `${TableHeaderGroupClassName}--unvirtualized`),
4668
+ className: join(HeaderGroupCls, TableHeaderGroupClassName, `${TableHeaderGroupClassName}--unvirtualized`),
4333
4669
  style
4334
4670
  }, /* @__PURE__ */ createElement16("div", {
4335
- className: join(`${TableHeaderGroupClassName}__header`, ICSS.flexFlow.row, ICSS.display.flex, ICSS.alignItems.center),
4671
+ className: join(`${TableHeaderGroupClassName}__header`, HeaderGroup_Header),
4336
4672
  style: { height: headerHeight }
4337
4673
  }, /* @__PURE__ */ createElement16("div", {
4338
4674
  className: join(`${TableHeaderGroupClassName}__header-content`, cssEllipsisClassName)
4339
4675
  }, header)), /* @__PURE__ */ createElement16("div", {
4340
- className: join(`${TableHeaderGroupClassName}__children`, ICSS.display.flex, ICSS.flexFlow.row, ICSS.alignItems.stretch)
4676
+ className: join(`${TableHeaderGroupClassName}__children`, HeaderGroup_Children)
4341
4677
  }, props.children));
4342
4678
  }
4343
4679
 
@@ -4403,17 +4739,17 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
4403
4739
  const _a = props, {
4404
4740
  columns,
4405
4741
  scrollable,
4406
- classNameModifiers,
4407
4742
  brain,
4408
4743
  scrollListener,
4744
+ pinning,
4409
4745
  totalWidth,
4410
4746
  availableWidth
4411
4747
  } = _a, domProps = __objRest(_a, [
4412
4748
  "columns",
4413
4749
  "scrollable",
4414
- "classNameModifiers",
4415
4750
  "brain",
4416
4751
  "scrollListener",
4752
+ "pinning",
4417
4753
  "totalWidth",
4418
4754
  "availableWidth"
4419
4755
  ]);
@@ -4426,9 +4762,9 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
4426
4762
  },
4427
4763
  computed: { computedVisibleColumnsMap: columnsMap }
4428
4764
  } = useInfiniteTable();
4429
- const domRef = useRef7(null);
4765
+ const domRef = useRef8(null);
4430
4766
  const hasColumnGroups = computedColumnGroups.size > 0;
4431
- const columnHeaderGroups = useMemo7(() => {
4767
+ const columnHeaderGroups = useMemo8(() => {
4432
4768
  return hasColumnGroups ? renderColumnHeaderGroups({
4433
4769
  columnGroups: computedColumnGroups,
4434
4770
  columnGroupsDepthsMap,
@@ -4471,11 +4807,15 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
4471
4807
  return removeOnScroll;
4472
4808
  }, [brain, scrollListener]);
4473
4809
  return /* @__PURE__ */ createElement18("div", __spreadProps(__spreadValues({}, domProps), {
4474
- className: join(TableHeaderClassName2, `${TableHeaderClassName2}--unvirtualized`, domProps.className, ...(classNameModifiers || []).filter(Boolean).map((modifier) => `${TableHeaderClassName2}--${modifier}`)),
4810
+ className: join(TableHeaderClassName2, `${TableHeaderClassName2}--unvirtualized`, pinning ? `${TableHeaderClassName2}--pinned ${TableHeaderClassName2}-${pinning}` : "", scrollable ? `${TableHeaderClassName2}--overflow` : "", domProps.className, HeaderClsRecipe({
4811
+ pinned: pinning,
4812
+ virtualized: false,
4813
+ overflow: scrollable
4814
+ })),
4475
4815
  style
4476
4816
  }), /* @__PURE__ */ createElement18("div", {
4477
4817
  style: { width: totalWidth },
4478
- className: join(ICSS.flexFlow.row, ICSS.display.flex),
4818
+ className: join(flexFlow.row, display.flex),
4479
4819
  ref: domRef
4480
4820
  }, children));
4481
4821
  }
@@ -4513,6 +4853,7 @@ function TableHeaderWrapper(props) {
4513
4853
  columns: computedUnpinnedColumns,
4514
4854
  repaintId: virtualizeHeader ? repaintId : void 0,
4515
4855
  brain,
4856
+ pinning: false,
4516
4857
  style: {
4517
4858
  position: "absolute",
4518
4859
  left: computedPinnedStartWidth,
@@ -4524,14 +4865,14 @@ function TableHeaderWrapper(props) {
4524
4865
  }) : /* @__PURE__ */ createElement19(InfiniteTableHeaderUnvirtualized, {
4525
4866
  brain,
4526
4867
  scrollable: true,
4868
+ pinning: false,
4527
4869
  columns: computedUnpinnedColumns,
4528
4870
  availableWidth: computedUnpinnedColumnsWidth,
4529
4871
  totalWidth: computedUnpinnedColumnsWidth
4530
4872
  });
4531
4873
  return /* @__PURE__ */ createElement19("div", {
4532
- className: join(ICSS.overflow.hidden, ICSS.position.relative, ICSS.display.flex, ICSS.flexFlow.row),
4874
+ className: HeaderWrapperCls,
4533
4875
  style: {
4534
- background: "var(--ITableHeader__background)",
4535
4876
  height: virtualizeHeader ? height : void 0
4536
4877
  }
4537
4878
  }, hasPinnedStart ? /* @__PURE__ */ createElement19(InfiniteTableHeaderUnvirtualized, {
@@ -4544,11 +4885,7 @@ function TableHeaderWrapper(props) {
4544
4885
  totalWidth: computedPinnedStartColumnsWidth,
4545
4886
  columns: computedPinnedStartColumns,
4546
4887
  scrollable: computedPinnedStartOverflow,
4547
- classNameModifiers: [
4548
- "pinned",
4549
- "pinned-start",
4550
- computedPinnedStartOverflow ? "overflow" : ""
4551
- ],
4888
+ pinning: "start",
4552
4889
  scrollListener: computedPinnedStartOverflow ? pinnedStartScrollListener : void 0
4553
4890
  }) : null, header, hasPinnedEnd ? /* @__PURE__ */ createElement19(InfiniteTableHeaderUnvirtualized, {
4554
4891
  style: {
@@ -4560,11 +4897,7 @@ function TableHeaderWrapper(props) {
4560
4897
  availableWidth: computedPinnedEndWidth,
4561
4898
  totalWidth: computedPinnedEndColumnsWidth,
4562
4899
  scrollable: computedPinnedEndOverflow,
4563
- classNameModifiers: [
4564
- "pinned",
4565
- "pinned-end",
4566
- computedPinnedEndOverflow ? "overflow" : ""
4567
- ],
4900
+ pinning: "end",
4568
4901
  scrollListener: computedPinnedEndOverflow ? pinnedEndScrollListener : void 0
4569
4902
  }) : null, scrollbars.vertical ? /* @__PURE__ */ createElement19(VerticalScrollbarPlaceholder, {
4570
4903
  style: {
@@ -4579,7 +4912,7 @@ import {
4579
4912
  createElement as createElement20,
4580
4913
  forwardRef as forwardRef2
4581
4914
  } from "react";
4582
- import { useRef as useRef8 } from "react";
4915
+ import { useRef as useRef9 } from "react";
4583
4916
 
4584
4917
  // src/components/hooks/useOnScroll.ts
4585
4918
  import { useEffect as useEffect14 } from "react";
@@ -4603,21 +4936,25 @@ var useOnScroll = (domRef, onScroll) => {
4603
4936
  }, [onScroll, domRef == null ? void 0 : domRef.current]);
4604
4937
  };
4605
4938
 
4939
+ // src/components/VirtualScrollContainer/VirtualScrollContainer.css.ts
4940
+ var ScrollableCls = { true: "_1ueijco1", false: "_1ueijco2", visible: "_1ueijco3", auto: "_1ueijco4", hidden: "_1ueijco5" };
4941
+ var ScrollableHorizontalCls = { true: "_1ueijco6", false: "_1ueijco7", visible: "_1ueijco8", auto: "_1ueijco9", hidden: "_1ueijcoa" };
4942
+ var ScrollableVerticalCls = { true: "_1ueijcob", false: "_1ueijcoc", visible: "_1ueijcod", auto: "_1ueijcoe", hidden: "_1ueijcof" };
4943
+ var VirtualScrollContainerCls = "_1ueijco0 _16lm1iw0";
4944
+
4606
4945
  // src/components/VirtualScrollContainer/getScrollableClassName.ts
4607
4946
  var getScrollableClassName = (scrollable) => {
4608
4947
  let scrollableClassName = "";
4609
- if (typeof scrollable === "boolean") {
4610
- scrollableClassName = scrollable ? ICSS.overflow.auto : ICSS.overflow.hidden;
4611
- } else if (typeof scrollable === "string") {
4612
- scrollableClassName = ICSS.overflow[scrollable];
4948
+ if (typeof scrollable === "boolean" || typeof scrollable === "string") {
4949
+ scrollableClassName = ScrollableCls[`${scrollable}`];
4613
4950
  } else {
4614
- 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]);
4951
+ scrollableClassName = join(ScrollableHorizontalCls[`${scrollable.horizontal}`], ScrollableVerticalCls[`${scrollable.vertical}`]);
4615
4952
  }
4616
4953
  return scrollableClassName;
4617
4954
  };
4618
4955
 
4619
4956
  // src/components/VirtualScrollContainer/index.tsx
4620
- var rootClassName6 = "IT-VirtualScrollContainer";
4957
+ var rootClassName6 = "Infinite-VirtualScrollContainer";
4621
4958
  var VirtualScrollContainer = forwardRef2(function VirtualScrollContainer2(props, ref) {
4622
4959
  const {
4623
4960
  children,
@@ -4626,16 +4963,12 @@ var VirtualScrollContainer = forwardRef2(function VirtualScrollContainer2(props,
4626
4963
  className,
4627
4964
  style
4628
4965
  } = props;
4629
- const domRef = ref != null ? ref : useRef8(null);
4966
+ const domRef = ref != null ? ref : useRef9(null);
4630
4967
  useOnScroll(domRef, onContainerScroll);
4631
4968
  return /* @__PURE__ */ createElement20("div", {
4632
4969
  ref: domRef,
4633
4970
  style,
4634
- className: [
4635
- className,
4636
- rootClassName6,
4637
- getScrollableClassName(scrollable)
4638
- ].join(" ")
4971
+ className: join(className, rootClassName6, VirtualScrollContainerCls, getScrollableClassName(scrollable))
4639
4972
  }, children);
4640
4973
  });
4641
4974
 
@@ -4664,7 +4997,7 @@ function SpacePlaceholderFn(props) {
4664
4997
  var SpacePlaceholder = memo8(SpacePlaceholderFn);
4665
4998
 
4666
4999
  // src/components/InfiniteTable/hooks/useListRendering.tsx
4667
- import { useCallback as useCallback17, useEffect as useEffect19, useMemo as useMemo9, useRef as useRef14 } from "react";
5000
+ import { useCallback as useCallback17, useEffect as useEffect20, useMemo as useMemo10, useRef as useRef15 } from "react";
4668
5001
 
4669
5002
  // src/components/InfiniteTable/hooks/useUnpinnedRendering.tsx
4670
5003
  import {
@@ -4683,13 +5016,19 @@ import {
4683
5016
  Fragment as Fragment4,
4684
5017
  createElement as createElement22
4685
5018
  } from "react";
4686
- import { useRef as useRef9, useEffect as useEffect15, useState as useState8 } from "react";
5019
+ import { useRef as useRef10, useEffect as useEffect15, useState as useState8 } from "react";
5020
+
5021
+ // src/components/VirtualList/VirtualList.css.ts
5022
+ var VirtualListCls = "mlx2t0 _16lm1iw0";
5023
+ var VirtualListClsOrientation = { horizontal: "mlx2t1", vertical: "mlx2t2" };
5024
+ var scrollTransformTargetCls = "mlx2t3";
5025
+
5026
+ // src/components/VirtualList/VirtualList.tsx
4687
5027
  var UPDATE_SCROLL2 = (node, scrollPosition) => {
4688
5028
  node.style.transform = `translate3d(${-scrollPosition.scrollLeft}px, ${-scrollPosition.scrollTop}px, 0px)`;
4689
5029
  };
4690
- var CLASSES = join(ICSS.height["0"], ICSS.width["0"], ICSS.willChange.transform);
4691
5030
  var debug4 = dbg("VirtuaList");
4692
- var rootClassName7 = "IList";
5031
+ var rootClassName7 = "InfiniteList";
4693
5032
  var VirtualList = (props) => {
4694
5033
  const _a = props, {
4695
5034
  scrollable,
@@ -4720,10 +5059,10 @@ var VirtualList = (props) => {
4720
5059
  "onContainerScroll",
4721
5060
  "children"
4722
5061
  ]);
4723
- const domRef = useRef9(null);
5062
+ const domRef = useRef10(null);
4724
5063
  const [, rerender] = useRerender();
4725
5064
  const [totalSize, setTotalSize] = useState8(0);
4726
- const renderCountRef = useRef9(0);
5065
+ const renderCountRef = useRef10(0);
4727
5066
  useEffect15(() => {
4728
5067
  const removeOnRenderCount = virtualBrain.onRenderCountChange((renderCount) => {
4729
5068
  renderCountRef.current = renderCount;
@@ -4753,7 +5092,7 @@ var VirtualList = (props) => {
4753
5092
  const width = mainAxis === "horizontal" ? totalSize : itemCrossAxisSize != null ? itemCrossAxisSize : 0;
4754
5093
  const height = mainAxis === "vertical" ? totalSize : itemCrossAxisSize != null ? itemCrossAxisSize : 0;
4755
5094
  const domProps = __spreadProps(__spreadValues({}, restDOMProps), {
4756
- className: join(props.className, rootClassName7, `${rootClassName7}--${mainAxis}`, ICSS.transform.translate3D000)
5095
+ className: join(props.className, rootClassName7, `${rootClassName7}--${mainAxis}`, VirtualListCls, VirtualListClsOrientation[mainAxis])
4757
5096
  });
4758
5097
  if (false) {
4759
5098
  domProps["data-cmp-name"] = `VirtualList`;
@@ -4763,7 +5102,7 @@ var VirtualList = (props) => {
4763
5102
  onContainerScroll
4764
5103
  }, /* @__PURE__ */ createElement22("div", {
4765
5104
  ref: domRef,
4766
- className: CLASSES,
5105
+ className: scrollTransformTargetCls,
4767
5106
  "data-name": "scroll-transform-target"
4768
5107
  }, /* @__PURE__ */ createElement22(RawList, {
4769
5108
  brain: virtualBrain,
@@ -4801,7 +5140,7 @@ import {
4801
5140
  memo as memo10,
4802
5141
  useCallback as useCallback11
4803
5142
  } from "react";
4804
- import { useRef as useRef11 } from "react";
5143
+ import { useRef as useRef12 } from "react";
4805
5144
 
4806
5145
  // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableColumnCell.tsx
4807
5146
  import {
@@ -4809,140 +5148,206 @@ import {
4809
5148
  memo as memo9
4810
5149
  } from "react";
4811
5150
  var { rootClassName: rootClassName8 } = internalProps;
4812
- var baseCls2 = `${rootClassName8}ColumnCell`;
5151
+ var InfiniteTableColumnCellClassName = `${rootClassName8}ColumnCell`;
4813
5152
  function isColumnWithField(c) {
4814
5153
  return typeof c.field === "string";
4815
5154
  }
4816
- function isColumnWithRender(c) {
4817
- return c.render instanceof Function;
4818
- }
4819
5155
  function InfiniteTableColumnCellFn(props) {
4820
5156
  var _a;
4821
5157
  const {
4822
- enhancedData,
5158
+ rowInfo,
5159
+ getData,
4823
5160
  column,
4824
5161
  offsetProperty,
4825
5162
  toggleGroupRow,
4826
5163
  virtualized,
4827
5164
  rowIndex,
4828
- domRef
5165
+ rowHeight,
5166
+ domRef,
5167
+ hidden
4829
5168
  } = props;
4830
- const { data, isGroupRow, groupBy } = enhancedData;
4831
- let value = isGroupRow && groupBy && column.groupByField ? enhancedData.value : isColumnWithField(column) ? data == null ? void 0 : data[column.field] : null;
5169
+ if (!column) {
5170
+ return null;
5171
+ }
5172
+ const { data, isGroupRow, groupBy } = rowInfo;
5173
+ const groupRowInfo = null;
5174
+ let value = isGroupRow && groupBy && column.groupByField ? rowInfo.value : isColumnWithField(column) ? data == null ? void 0 : data[column.field] : null;
4832
5175
  if (column.valueGetter) {
4833
- value = column.valueGetter({ data, enhancedData });
5176
+ value = column.valueGetter({
5177
+ data,
5178
+ rowInfo,
5179
+ groupRowInfo
5180
+ });
4834
5181
  }
4835
5182
  const { componentState: computedDataSource } = useDataSourceContextValue();
4836
- const renderParam = {
5183
+ const stylingRenderParam = {
4837
5184
  value,
4838
5185
  column,
4839
- enhancedData,
5186
+ rowInfo,
4840
5187
  data
4841
5188
  };
4842
- let renderValue = isColumnWithRender(column) ? column.render({
4843
- value,
4844
- column,
4845
- enhancedData,
4846
- data,
4847
- rowIndex,
4848
- toggleGroupRow,
4849
- toggleCurrentGroupRow: () => toggleGroupRow(enhancedData.groupKeys),
4850
- groupRowsBy: computedDataSource.groupRowsBy
4851
- }) : value;
4852
- const colClassName = column.className ? typeof column.className === "function" ? column.className(renderParam) : column.className : void 0;
4853
- const colStyle = column.style ? typeof column.style === "function" ? column.style(renderParam) : column.style : void 0;
5189
+ let renderValue = value;
5190
+ if (column.render || column.renderValue) {
5191
+ const renderParam = {
5192
+ value,
5193
+ column,
5194
+ rowInfo,
5195
+ groupRowInfo,
5196
+ data,
5197
+ rowIndex,
5198
+ toggleGroupRow,
5199
+ toggleCurrentGroupRow: () => toggleGroupRow(rowInfo.groupKeys),
5200
+ groupRowsBy: computedDataSource.groupRowsBy
5201
+ };
5202
+ if (column.render) {
5203
+ renderValue = column.render(renderParam);
5204
+ } else if (column.renderValue) {
5205
+ renderValue = column.renderValue(renderParam);
5206
+ }
5207
+ }
5208
+ const colClassName = column.className ? typeof column.className === "function" ? column.className(stylingRenderParam) : column.className : void 0;
5209
+ const colStyle = column.style ? typeof column.style === "function" ? column.style(stylingRenderParam) : column.style : void 0;
4854
5210
  const style = colStyle ? __spreadProps(__spreadValues({}, colStyle), {
4855
5211
  width: column.computedWidth
4856
5212
  }) : {
4857
5213
  width: column.computedWidth
4858
5214
  };
4859
- return /* @__PURE__ */ createElement24(InfiniteTableCell, {
4860
- domRef,
4861
- offsetProperty,
5215
+ const dataset = {
4862
5216
  "data-name": `Cell`,
4863
5217
  "data-column-id": column.id,
4864
- "data-column-index": column.computedVisibleIndex,
5218
+ "data-column-index": column.computedVisibleIndex
5219
+ };
5220
+ if (typeof column.rowspan === "function") {
5221
+ const rowspan = column.rowspan({
5222
+ dataArray: getData(),
5223
+ column,
5224
+ rowInfo,
5225
+ groupRowInfo,
5226
+ rowIndex,
5227
+ data: rowInfo.data
5228
+ });
5229
+ if (rowspan > 1) {
5230
+ style.height = rowspan * rowHeight;
5231
+ for (let i = 0; i < rowspan; i++) {
5232
+ dataset[`data-hover-${rowIndex + i}`] = true;
5233
+ }
5234
+ }
5235
+ }
5236
+ return /* @__PURE__ */ createElement24(InfiniteTableCell, __spreadProps(__spreadValues({
5237
+ domRef,
5238
+ offsetProperty
5239
+ }, dataset), {
4865
5240
  column,
4866
5241
  offset: virtualized ? 0 : column.computedPinningOffset,
4867
5242
  style,
4868
5243
  cssEllipsis: (_a = column.cssEllipsis) != null ? _a : true,
4869
- className: join(ICSS.position.absolute, ICSS.height["100%"], ICSS.top[0], useCellClassName(column, [baseCls2, InfiniteTableCellClassName]), colClassName)
4870
- }, renderValue);
5244
+ className: join(useCellClassName(column, [InfiniteTableColumnCellClassName, InfiniteTableCellClassName], ColumnCellRecipe, { dragging: false }), colClassName)
5245
+ }), hidden ? null : renderValue);
4871
5246
  }
4872
5247
  var InfiniteTableColumnCell = memo9(InfiniteTableColumnCellFn);
4873
5248
 
4874
5249
  // src/components/InfiniteTable/components/InfiniteTableRow/useRowDOMProps.ts
4875
5250
  import {
4876
5251
  useCallback as useCallback10,
4877
- useRef as useRef10
5252
+ useRef as useRef11
4878
5253
  } from "react";
4879
5254
 
4880
5255
  // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRowClassName.ts
4881
5256
  var { rootClassName: rootClassName9 } = internalProps;
4882
5257
  var InfiniteTableRowClassName = `${rootClassName9}Row`;
4883
- var InfiniteTableRowClassName__hover = `${InfiniteTableRowClassName}--hover`;
5258
+ var InfiniteTableRowClassName__hover = `${rootClassName9}Element--hover`;
5259
+
5260
+ // src/components/InfiniteTable/theme.css.ts
5261
+ var ThemeVars = { theme: "var(--infinite-theme)", color: { accent: "var(--infinite-accent-color)", color: "var(--infinite-color)" }, spacing: { "0": "var(--infinite-space-0)", "1": "var(--infinite-space-1)", "2": "var(--infinite-space-2)", "3": "var(--infinite-space-3)", "4": "var(--infinite-space-4)", "5": "var(--infinite-space-5)", "6": "var(--infinite-space-6)", "7": "var(--infinite-space-7)", "8": "var(--infinite-space-8)", "9": "var(--infinite-space-9)", "10": "var(--infinite-space-10)" }, fontSize: { "0": "var(--infinite-font-size-0)", "1": "var(--infinite-font-size-1)", "2": "var(--infinite-font-size-2)", "3": "var(--infinite-font-size-3)", "4": "var(--infinite-font-size-4)", "5": "var(--infinite-font-size-5)", "6": "var(--infinite-font-size-6)", "7": "var(--infinite-font-size-7)" }, fontFamily: "var(--infinite-font-family)", minHeight: "var(--infinite-min-height)", borderRadius: "var(--infinite-border-radius)", background: "var(--infinite-background)", components: { LoadMask: { padding: "var(--infinite-load-mask-padding)", color: "var(--infinite-load-mask-color)", textBackground: "var(--infinite-load-mask-text-background)", overlayBackground: "var(--infinite-load-mask-overlay-background)", overlayOpacity: "var(--infinite-load-mask-overlay-opacity)", borderRadius: "var(--infinite-load-mask-border-radius)" }, Header: { background: "var(--infinite-header-background)", color: "var(--infinite-header-color)", height: "var(--infinite-header-height)" }, HeaderCell: { draggingBackground: "var(--infinite-header-cell-dragging-background)", background: "var(--infinite-header-cell-background)", padding: "var(--infinite-header-cell-padding)", iconSize: "var(--infinite-header-cell-icon-size)" }, Cell: { padding: "var(--infinite-cell-padding)", borderWidth: "var(--infinite-cell-border-width)", border: "var(--infinite-cell-border)", borderInvisible: "var(--infinite-cell-border-invisible)", borderRadius: "var(--infinite-cell-border-radius)" }, Row: { color: "var(--infinite-row-color)", background: "var(--infinite-row-background)", oddBackground: "var(--infinite-row-odd-background)", hoverBackground: "var(--infinite-row-hover-background)", groupRowBackground: "var(--infinite-group-row-background)", groupRowColumnNesting: "var(--infinite-group-row-column-nesting)", groupNesting: "var(--infinite-dont-override-group-row-nesting-length)", pointerEventsWhileScrolling: "var(--infinite-row-pointer-events-while-scrolling)" }, ColumnCell: { background: "var(--infinite-column-cell-bg-dont-override)" } } };
5262
+
5263
+ // src/utils/stripVar.ts
5264
+ function stripVar(cssVariableWithVarString) {
5265
+ return cssVariableWithVarString.slice(4, -1);
5266
+ }
4884
5267
 
4885
5268
  // src/components/InfiniteTable/components/InfiniteTableRow/useRowDOMProps.ts
4886
- function useRowDOMProps(props, rowProps, rowStyle, rowClassName, tableDOMRef) {
5269
+ function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStrategy, tableDOMRef) {
4887
5270
  const domProps = props.domProps;
4888
5271
  const {
4889
5272
  showZebraRows = false,
5273
+ showHoverRows = false,
4890
5274
  rowIndex,
4891
5275
  domRef: domRefFromProps,
4892
- enhancedData
5276
+ rowInfo
4893
5277
  } = props;
4894
- const domRef = useRef10(null);
5278
+ const domRef = useRef11(null);
4895
5279
  const rowDOMRef = useCallback10((node) => {
4896
5280
  domRefFromProps(node);
4897
5281
  domRef.current = node;
4898
5282
  }, []);
4899
5283
  const rowPropsAndStyleArgs = {
4900
- data: enhancedData.data,
4901
- enhancedData,
5284
+ data: rowInfo.data,
5285
+ rowInfo,
4902
5286
  rowIndex,
4903
- groupRowsBy: enhancedData.groupBy
5287
+ groupRowsBy: rowInfo.groupBy
4904
5288
  };
4905
5289
  if (typeof rowProps === "function") {
4906
5290
  rowProps = rowProps(rowPropsAndStyleArgs);
4907
5291
  }
4908
5292
  let style = rowProps ? rowProps.style : void 0;
5293
+ const inlineGroupRoot = groupRenderStrategy === "inline" && rowInfo.indexInGroup === 0;
4909
5294
  if (rowStyle) {
4910
5295
  style = typeof rowStyle === "function" ? __spreadValues(__spreadValues({}, style), rowStyle(rowPropsAndStyleArgs)) : __spreadValues(__spreadValues({}, style), rowStyle);
4911
5296
  }
4912
- const odd = (enhancedData.indexInAll != null ? enhancedData.indexInAll : rowIndex) % 2 === 1;
5297
+ if (inlineGroupRoot) {
5298
+ style = style || {};
5299
+ style.zIndex = 2e6 - rowInfo.indexInAll;
5300
+ }
5301
+ const odd = (rowInfo.indexInAll != null ? rowInfo.indexInAll : rowIndex) % 2 === 1;
4913
5302
  let rowComputedClassName = typeof rowClassName === "function" ? rowClassName(rowPropsAndStyleArgs) : rowClassName;
4914
- 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);
5303
+ const className = join(InfiniteTableRowClassName, RowClsRecipe({
5304
+ groupRow: rowInfo.isGroupRow,
5305
+ inlineGroupRow: inlineGroupRoot,
5306
+ zebra: showHoverRows ? odd ? "odd" : "even" : false,
5307
+ showHoverRows
5308
+ }), `${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);
4915
5309
  const initialMouseEnter = rowProps == null ? void 0 : rowProps.onMouseEnter;
4916
5310
  const initialMouseLeave = rowProps == null ? void 0 : rowProps.onMouseLeave;
4917
5311
  const onMouseEnter = useCallback10((event) => {
4918
5312
  var _a;
4919
5313
  initialMouseEnter == null ? void 0 : initialMouseEnter(event);
4920
- const rowIndex2 = (_a = event.currentTarget) == null ? void 0 : _a.dataset.rowIndex;
5314
+ const rowIndex2 = ((_a = event.currentTarget) == null ? void 0 : _a.dataset.rowIndex) * 1;
4921
5315
  const parentNode = tableDOMRef.current;
4922
- if (!parentNode) {
5316
+ if (!parentNode || !showHoverRows) {
4923
5317
  return;
4924
5318
  }
4925
- const rows = parentNode.querySelectorAll(`.${InfiniteTableRowClassName}[data-row-index="${rowIndex2}"]`);
4926
- rows.forEach((row) => row.classList.add(InfiniteTableRowClassName__hover));
4927
- }, [initialMouseEnter]);
5319
+ const hoverSelector = [
5320
+ `.${InfiniteTableRowClassName}[data-hover-index="${rowIndex2}"]`
5321
+ ];
5322
+ const rows = parentNode.querySelectorAll(hoverSelector.join(","));
5323
+ rows.forEach((row) => row.classList.add(InfiniteTableRowClassName__hover, RowHoverCls));
5324
+ }, [initialMouseEnter, showHoverRows]);
4928
5325
  const onMouseLeave = useCallback10((event) => {
4929
5326
  var _a;
4930
5327
  initialMouseLeave == null ? void 0 : initialMouseLeave(event);
4931
5328
  const rowIndex2 = (_a = event.currentTarget) == null ? void 0 : _a.dataset.rowIndex;
4932
5329
  const parentNode = tableDOMRef.current;
4933
- if (!parentNode) {
5330
+ if (!parentNode || !showHoverRows) {
4934
5331
  return;
4935
5332
  }
4936
- const rows = parentNode.querySelectorAll(`.${InfiniteTableRowClassName}[data-row-index="${rowIndex2}"]`);
4937
- rows.forEach((row) => row.classList.remove(InfiniteTableRowClassName__hover));
4938
- }, [initialMouseLeave]);
5333
+ const hoverSelector = [
5334
+ `.${InfiniteTableRowClassName}[data-hover-index="${rowIndex2}"]`
5335
+ ];
5336
+ const rows = parentNode.querySelectorAll(hoverSelector.join(","));
5337
+ rows.forEach((row) => row.classList.remove(InfiniteTableRowClassName__hover, RowHoverCls));
5338
+ }, [initialMouseLeave, showHoverRows]);
5339
+ if (rowInfo.isGroupRow && groupRenderStrategy === "single-column") {
5340
+ style = style || {};
5341
+ style[stripVar(ThemeVars.components.Row.groupNesting)] = rowInfo.groupNesting - 1;
5342
+ }
4939
5343
  return {
4940
5344
  domRef,
4941
5345
  domProps: __spreadProps(__spreadValues(__spreadValues({}, rowProps), domProps), {
4942
5346
  style,
4943
5347
  "data-virtualize-columns": props.virtualizeColumns ? "on" : "off",
4944
5348
  "data-row-index": rowIndex,
4945
- "data-row-id": `${enhancedData.id}`,
5349
+ "data-hover-index": rowIndex,
5350
+ "data-row-id": `${rowInfo.id}`,
4946
5351
  className,
4947
5352
  onMouseEnter,
4948
5353
  onMouseLeave,
@@ -4956,34 +5361,50 @@ function InfiniteTableRowFn(props) {
4956
5361
  const {
4957
5362
  rowWidth,
4958
5363
  rowHeight,
4959
- enhancedData,
5364
+ getData,
5365
+ rowInfo,
4960
5366
  toggleGroupRow,
4961
5367
  rowIndex,
4962
5368
  brain,
5369
+ verticalBrain,
4963
5370
  columns
4964
5371
  } = props;
4965
5372
  const tableContextValue = useInfiniteTable();
4966
5373
  const { componentState } = tableContextValue;
4967
5374
  const { domRef: tableDOMRef } = componentState;
4968
- const { domProps } = useRowDOMProps(props, componentState.rowProps, componentState.rowStyle, componentState.rowClassName, tableDOMRef);
5375
+ const { groupRenderStrategy } = componentState;
5376
+ const { domProps } = useRowDOMProps(props, componentState.rowProps, componentState.rowStyle, componentState.rowClassName, groupRenderStrategy, tableDOMRef);
4969
5377
  const style = __spreadValues({
4970
5378
  width: rowWidth,
4971
5379
  height: rowHeight
4972
5380
  }, domProps.style);
4973
- const renderCellRef = useRef11(null);
5381
+ const renderCellRef = useRef12(null);
4974
5382
  const renderCell = useCallback11(({ domRef, itemIndex }) => {
4975
5383
  const column = columns[itemIndex];
4976
5384
  if (!column) {
4977
5385
  }
5386
+ const hidden = false;
4978
5387
  return /* @__PURE__ */ createElement25(InfiniteTableColumnCell, {
4979
- enhancedData,
5388
+ getData,
5389
+ rowInfo,
5390
+ groupRenderStrategy,
4980
5391
  virtualized: true,
5392
+ hidden,
5393
+ rowHeight,
4981
5394
  toggleGroupRow,
4982
5395
  rowIndex,
4983
5396
  domRef,
4984
5397
  column
4985
5398
  });
4986
- }, [columns, rowIndex, enhancedData]);
5399
+ }, [
5400
+ columns,
5401
+ rowIndex,
5402
+ rowInfo,
5403
+ rowHeight,
5404
+ groupRenderStrategy,
5405
+ getData,
5406
+ verticalBrain
5407
+ ]);
4987
5408
  if (renderCellRef.current !== renderCell) {
4988
5409
  renderCellRef.current = renderCell;
4989
5410
  }
@@ -5009,7 +5430,8 @@ function TableRowUnvirtualizedFn(props) {
5009
5430
  const {
5010
5431
  rowHeight,
5011
5432
  rowWidth,
5012
- enhancedData,
5433
+ getData,
5434
+ rowInfo,
5013
5435
  rowIndex,
5014
5436
  columns,
5015
5437
  toggleGroupRow
@@ -5017,17 +5439,22 @@ function TableRowUnvirtualizedFn(props) {
5017
5439
  const tableContextValue = useInfiniteTable();
5018
5440
  const { componentState } = tableContextValue;
5019
5441
  const { domRef: tableDOMRef } = componentState;
5020
- const { domProps } = useRowDOMProps(props, componentState.rowProps, componentState.rowStyle, componentState.rowClassName, tableDOMRef);
5442
+ const { domProps } = useRowDOMProps(props, componentState.rowProps, componentState.rowStyle, componentState.rowClassName, componentState.groupRenderStrategy, tableDOMRef);
5021
5443
  const style = __spreadValues({
5022
5444
  width: rowWidth,
5023
5445
  height: rowHeight
5024
5446
  }, domProps.style);
5025
5447
  const children = columns.map((col) => {
5448
+ const hidden = false;
5026
5449
  return /* @__PURE__ */ createElement26(InfiniteTableColumnCell, {
5027
5450
  key: col.id,
5028
5451
  virtualized: false,
5452
+ rowHeight,
5453
+ getData,
5454
+ hidden,
5455
+ groupRenderStrategy: componentState.groupRenderStrategy,
5029
5456
  toggleGroupRow,
5030
- enhancedData,
5457
+ rowInfo,
5031
5458
  rowIndex,
5032
5459
  column: col
5033
5460
  });
@@ -5058,19 +5485,22 @@ function useUnpinnedRendering(params) {
5058
5485
  } = params;
5059
5486
  const { virtualizeColumns } = getState();
5060
5487
  const shouldVirtualizeColumns = typeof virtualizeColumns === "function" ? virtualizeColumns(computedUnpinnedColumns) : virtualizeColumns != null ? virtualizeColumns : true;
5061
- const renderRowUnpinned = useCallback12((rowInfo) => {
5488
+ const renderRowUnpinned = useCallback12((rowParams) => {
5062
5489
  const dataArray = getData();
5063
- const enhancedData = dataArray[rowInfo.rowIndex];
5064
- const { showZebraRows } = getState();
5490
+ const rowInfo = dataArray[rowParams.rowIndex];
5491
+ const { showZebraRows, showHoverRows } = getState();
5065
5492
  const rowProps = __spreadValues({
5066
- enhancedData,
5493
+ rowInfo,
5067
5494
  showZebraRows,
5495
+ showHoverRows,
5496
+ getData,
5068
5497
  toggleGroupRow,
5069
5498
  virtualizeColumns: shouldVirtualizeColumns,
5070
5499
  brain: null,
5500
+ verticalBrain: verticalVirtualBrain,
5071
5501
  columns: computedUnpinnedColumns,
5072
5502
  rowWidth: computedUnpinnedColumnsWidth
5073
- }, rowInfo);
5503
+ }, rowParams);
5074
5504
  if (shouldVirtualizeColumns) {
5075
5505
  rowProps.brain = horizontalVirtualBrain;
5076
5506
  rowProps.repaintId = repaintId;
@@ -5079,10 +5509,12 @@ function useUnpinnedRendering(params) {
5079
5509
  return /* @__PURE__ */ createElement27(TableRowComponent, __spreadValues({}, rowProps));
5080
5510
  }, [
5081
5511
  repaintId,
5512
+ rowHeight,
5082
5513
  computedUnpinnedColumns,
5083
5514
  computedUnpinnedColumnsWidth,
5084
5515
  shouldVirtualizeColumns,
5085
- horizontalVirtualBrain
5516
+ horizontalVirtualBrain,
5517
+ verticalVirtualBrain
5086
5518
  ]);
5087
5519
  const fakeScrollbar = getScrollbarWidth() ? /* @__PURE__ */ createElement27("div", {
5088
5520
  "data-name": "horizontal-scrollbar-placeholder--fake",
@@ -5119,17 +5551,44 @@ function useUnpinnedRendering(params) {
5119
5551
  }
5120
5552
 
5121
5553
  // src/components/InfiniteTable/hooks/useOnContainerScroll.ts
5122
- import { useCallback as useCallback13, useRef as useRef12 } from "react";
5554
+ import { useCallback as useCallback13, useEffect as useEffect16, useRef as useRef13 } from "react";
5555
+
5556
+ // src/components/InfiniteTable/InfiniteCls.css.ts
5557
+ var FooterCls = "_16lm1iw1";
5558
+ var InfiniteCls = "_1yeub2v0 _16lm1iw1 _16lm1iwh _16lm1iwx _16lm1iw0";
5559
+ 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: [] });
5560
+ var InfiniteClsScrolling = "_1yeub2v1";
5561
+ var InfiniteClsShiftingColumns = "_16lm1iwk";
5562
+ var PinnedRowsClsVariants = { pinnedStart: "_1yeub2ve", pinnedEnd: "_1yeub2vf", overflow: "_1yeub2vg" };
5563
+ var PinnedRowsContainerClsVariants = createRuntimeFn({ defaultClassName: "", variantClassNames: { pinned: { start: "_1yeub2vh", end: "_1yeub2vi", false: "_1yeub2vj" } }, defaultVariants: {}, compoundVariants: [] });
5564
+
5565
+ // src/components/InfiniteTable/hooks/useOnContainerScroll.ts
5123
5566
  var DELAY = 200;
5124
5567
  var TableClassName = internalProps.rootClassName;
5125
5568
  var TableClassName__Scrolling = `${TableClassName}--scrolling`;
5569
+ var SCROLL_BOTTOM_OFFSET = 0;
5126
5570
  var useOnContainerScroll = ({
5127
5571
  verticalVirtualBrain,
5128
5572
  horizontalVirtualBrain,
5129
- domRef
5573
+ reservedContentHeight
5130
5574
  }) => {
5131
- const timeoutIdRef = useRef12(0);
5132
- const scrollingRef = useRef12(false);
5575
+ const {
5576
+ componentState: {
5577
+ scrollerDOMRef,
5578
+ domRef,
5579
+ scrollToBottomOffset,
5580
+ onScrollToBottom,
5581
+ onScrollToTop,
5582
+ bodySize
5583
+ }
5584
+ } = useInfiniteTable();
5585
+ const timeoutIdRef = useRef13(0);
5586
+ const scrollingRef = useRef13(false);
5587
+ const scrollTopMaxRef = useRef13(0);
5588
+ useEffect16(() => {
5589
+ const { current: node } = scrollerDOMRef;
5590
+ scrollTopMaxRef.current = node.scrollHeight - node.clientHeight;
5591
+ }, [reservedContentHeight, bodySize.height]);
5133
5592
  const setScrolling = useCallback13((scrolling) => {
5134
5593
  var _a;
5135
5594
  const prevScrolling = scrollingRef.current;
@@ -5149,9 +5608,9 @@ var useOnContainerScroll = ({
5149
5608
  return;
5150
5609
  }
5151
5610
  if (scrolling) {
5152
- classList.add(TableClassName__Scrolling);
5611
+ classList.add(InfiniteClsScrolling, TableClassName__Scrolling);
5153
5612
  } else {
5154
- classList.remove(TableClassName__Scrolling);
5613
+ classList.remove(InfiniteClsScrolling, TableClassName__Scrolling);
5155
5614
  }
5156
5615
  }
5157
5616
  }, []);
@@ -5165,7 +5624,7 @@ var useOnContainerScroll = ({
5165
5624
  domRef.current,
5166
5625
  setScrolling
5167
5626
  ]);
5168
- const scrollPositionRef = useRef12({
5627
+ const scrollPositionRef = useRef13({
5169
5628
  scrollLeft: 0,
5170
5629
  scrollTop: 0
5171
5630
  });
@@ -5176,18 +5635,25 @@ var useOnContainerScroll = ({
5176
5635
  const applyScrollVertical = useCallback13(({ scrollTop }) => {
5177
5636
  scrollPositionRef.current.scrollTop = scrollTop;
5178
5637
  onContainerScroll(scrollPositionRef.current);
5179
- }, [onContainerScroll]);
5638
+ if (scrollTop === 0) {
5639
+ onScrollToTop == null ? void 0 : onScrollToTop();
5640
+ }
5641
+ const offset = scrollToBottomOffset != null ? scrollToBottomOffset : SCROLL_BOTTOM_OFFSET;
5642
+ const isScrollBottom = scrollTop + offset >= scrollTopMaxRef.current;
5643
+ if (isScrollBottom) {
5644
+ onScrollToBottom == null ? void 0 : onScrollToBottom();
5645
+ }
5646
+ }, [onContainerScroll, scrollToBottomOffset, onScrollToBottom, onScrollToTop]);
5180
5647
  return {
5181
5648
  applyScrollHorizontal,
5182
- applyScrollVertical,
5183
- scrollPositionRef
5649
+ applyScrollVertical
5184
5650
  };
5185
5651
  };
5186
5652
 
5187
5653
  // src/components/InfiniteTable/hooks/usePinnedRendering.tsx
5188
5654
  import {
5189
5655
  createElement as createElement29,
5190
- useMemo as useMemo8
5656
+ useMemo as useMemo9
5191
5657
  } from "react";
5192
5658
  import { useCallback as useCallback15 } from "react";
5193
5659
 
@@ -5195,12 +5661,12 @@ import { useCallback as useCallback15 } from "react";
5195
5661
  import {
5196
5662
  createElement as createElement28
5197
5663
  } from "react";
5198
- import { useEffect as useEffect17, useCallback as useCallback14, useRef as useRef13 } from "react";
5664
+ import { useEffect as useEffect18, useCallback as useCallback14, useRef as useRef14 } from "react";
5199
5665
 
5200
5666
  // src/components/hooks/useOnMount.ts
5201
- import { useEffect as useEffect16 } from "react";
5667
+ import { useEffect as useEffect17 } from "react";
5202
5668
  function useOnMount(domRef, props) {
5203
- useEffect16(() => {
5669
+ useEffect17(() => {
5204
5670
  const { onMount, onUnmount } = props;
5205
5671
  const node = domRef == null ? void 0 : domRef.current;
5206
5672
  onMount == null ? void 0 : onMount(node);
@@ -5210,12 +5676,15 @@ function useOnMount(domRef, props) {
5210
5676
  }, []);
5211
5677
  }
5212
5678
 
5679
+ // src/components/VirtualList/InfiniteListRootClassName.ts
5680
+ var InfiniteListRootClassName = "InfiniteList";
5681
+
5213
5682
  // src/components/VirtualList/RowListWithExternalScrolling.tsx
5214
- var rootClassName10 = "IList";
5683
+ var rootClassName10 = InfiniteListRootClassName;
5215
5684
  var defaultClasses = [
5216
- ICSS.willChange.transform,
5217
- ICSS.position.relative,
5218
- ICSS.transform.translate3D000
5685
+ willChange.transform,
5686
+ position.relative,
5687
+ transformTranslateZero
5219
5688
  ];
5220
5689
  var RowListWithExternalScrolling = (props) => {
5221
5690
  const {
@@ -5228,7 +5697,7 @@ var RowListWithExternalScrolling = (props) => {
5228
5697
  onMount,
5229
5698
  onUnmount
5230
5699
  } = props;
5231
- const domRef = useRef13(null);
5700
+ const domRef = useRef14(null);
5232
5701
  const renderItem = useCallback14((renderProps) => renderRow({
5233
5702
  domRef: renderProps.domRef,
5234
5703
  rowHeight: renderProps.itemSize,
@@ -5238,7 +5707,7 @@ var RowListWithExternalScrolling = (props) => {
5238
5707
  onMount,
5239
5708
  onUnmount
5240
5709
  });
5241
- useEffect17(() => {
5710
+ useEffect18(() => {
5242
5711
  const onScroll = (scrollPosition) => {
5243
5712
  const node = domRef.current;
5244
5713
  if (node) {
@@ -5262,7 +5731,7 @@ var RowListWithExternalScrolling = (props) => {
5262
5731
  const domProps = {
5263
5732
  ref: domRef,
5264
5733
  style,
5265
- className: join(className, rootClassName10, `${rootClassName10}--vertical`, ...defaultClasses)
5734
+ className: join(className, rootClassName10, `${rootClassName10}--vertical`, VirtualListCls, VirtualListClsOrientation.vertical, ...defaultClasses)
5266
5735
  };
5267
5736
  if (false) {
5268
5737
  domProps["data-cmp-name"] = "RowListWithExternalScrolling";
@@ -5278,7 +5747,7 @@ var RowListWithExternalScrolling = (props) => {
5278
5747
  var UPDATE_SCROLL3 = (node, brainScrollPosition, horizontalPinnedScrollPosition) => {
5279
5748
  node.style.transform = `translate3d(${horizontalPinnedScrollPosition ? -horizontalPinnedScrollPosition.scrollLeft : 0}px, ${-brainScrollPosition.scrollTop}px, 0px)`;
5280
5749
  };
5281
- var PinnedRowsContainerClassName = `ITablePinnedRows`;
5750
+ var PinnedRowsContainerClassName = `InfinitePinnedRows`;
5282
5751
  function PinnedRowsContainer(props) {
5283
5752
  const {
5284
5753
  maxWidth,
@@ -5290,7 +5759,7 @@ function PinnedRowsContainer(props) {
5290
5759
  brain,
5291
5760
  renderRow
5292
5761
  } = props;
5293
- const style = useMemo8(() => {
5762
+ const style = useMemo9(() => {
5294
5763
  const result = pinning === "end" ? {
5295
5764
  width: rowWidth,
5296
5765
  height,
@@ -5313,7 +5782,7 @@ function PinnedRowsContainer(props) {
5313
5782
  brain,
5314
5783
  renderRow,
5315
5784
  updateScroll,
5316
- className: join(`${PinnedRowsContainerClassName}`, `${PinnedRowsContainerClassName}--pinned-${pinning}`, `${PinnedRowsContainerClassName}--overflow`)
5785
+ className: join(`${PinnedRowsContainerClassName}`, PinnedRowsClsVariants[pinning === "start" ? "pinnedStart" : "pinnedEnd"], `${PinnedRowsContainerClassName}--pinned-${pinning}`, `${PinnedRowsContainerClassName}--overflow`, PinnedRowsClsVariants.overflow)
5317
5786
  };
5318
5787
  if (hasOverflow) {
5319
5788
  return /* @__PURE__ */ createElement29(VirtualScrollContainer, {
@@ -5329,7 +5798,9 @@ function PinnedRowsContainer(props) {
5329
5798
  [pinning === "start" ? "right" : "left"]: "unset"
5330
5799
  },
5331
5800
  onContainerScroll: pinnedScrollListener == null ? void 0 : pinnedScrollListener.setScrollPosition,
5332
- className: join(`${PinnedRowsContainerClassName}Container`, `${PinnedRowsContainerClassName}Container--pinned-${pinning}`)
5801
+ className: join(PinnedRowsContainerClsVariants({
5802
+ pinned: pinning
5803
+ }), `${PinnedRowsContainerClassName}Container`, `${PinnedRowsContainerClassName}Container--pinned-${pinning}`)
5333
5804
  }, /* @__PURE__ */ createElement29(RowListWithExternalScrolling, __spreadProps(__spreadValues({}, rowListProps), {
5334
5805
  onMount: (node) => {
5335
5806
  pinnedScrollListener == null ? void 0 : pinnedScrollListener.onScroll((scrollPosition) => {
@@ -5344,22 +5815,25 @@ function PinnedRowsContainer(props) {
5344
5815
  return /* @__PURE__ */ createElement29(RowListWithExternalScrolling, __spreadValues({}, rowListProps));
5345
5816
  }
5346
5817
  function useRenderPinnedRow(params) {
5347
- const { getData, getState, columnsWidth, columns } = params;
5348
- const renderPinnedRow = useCallback15((rowInfo) => {
5818
+ const { getData, getState, columnsWidth, columns, verticalBrain } = params;
5819
+ const renderPinnedRow = useCallback15((rowParams) => {
5349
5820
  const dataArray = getData();
5350
- const enhancedData = dataArray[rowInfo.rowIndex];
5351
- const { showZebraRows } = getState();
5821
+ const rowInfo = dataArray[rowParams.rowIndex];
5822
+ const { showZebraRows, showHoverRows } = getState();
5352
5823
  const rowProps = __spreadValues({
5353
- enhancedData,
5824
+ rowInfo,
5825
+ getData,
5354
5826
  showZebraRows,
5827
+ showHoverRows,
5355
5828
  toggleGroupRow: params.toggleGroupRow,
5356
5829
  virtualizeColumns: false,
5830
+ verticalBrain,
5357
5831
  brain: null,
5358
5832
  rowWidth: columnsWidth,
5359
5833
  columns
5360
- }, rowInfo);
5834
+ }, rowParams);
5361
5835
  return /* @__PURE__ */ createElement29(TableRowUnvirtualized, __spreadValues({}, rowProps));
5362
- }, [columnsWidth, columns]);
5836
+ }, [columnsWidth, columns, verticalBrain]);
5363
5837
  return renderPinnedRow;
5364
5838
  }
5365
5839
  function usePinnedRenderingForSide(side, params) {
@@ -5397,6 +5871,7 @@ function usePinnedRenderingForSide(side, params) {
5397
5871
  getData,
5398
5872
  getState,
5399
5873
  toggleGroupRow,
5874
+ verticalBrain: verticalVirtualBrain,
5400
5875
  columns,
5401
5876
  columnsWidth
5402
5877
  });
@@ -5455,7 +5930,7 @@ function usePinnedStartRendering(params) {
5455
5930
  }
5456
5931
 
5457
5932
  // src/components/InfiniteTable/hooks/useYourBrain.ts
5458
- import { useEffect as useEffect18 } from "react";
5933
+ import { useEffect as useEffect19 } from "react";
5459
5934
 
5460
5935
  // src/components/VirtualBrain/index.ts
5461
5936
  var import_binary_search2 = __toModule(require_binary_search());
@@ -5464,6 +5939,7 @@ var initialScrollPosition2 = {
5464
5939
  scrollTop: 0
5465
5940
  };
5466
5941
  var raf = typeof window !== "undefined" ? requestAnimationFrame : (fn) => setTimeout(fn, 0);
5942
+ var ItemIndexBag = Object.seal({ itemIndex: 0 });
5467
5943
  var SORT_ASC = (a, b) => a - b;
5468
5944
  var VirtualBrain = class extends Logger {
5469
5945
  constructor(options) {
@@ -5571,22 +6047,24 @@ var VirtualBrain = class extends Logger {
5571
6047
  this.onRenderRangeChangeFns = this.onRenderRangeChangeFns.filter((f) => f !== fn);
5572
6048
  };
5573
6049
  };
5574
- this.update = (newCount, newItemSize) => {
5575
- const { itemSize, count } = this.options;
6050
+ this.update = (newCount, newItemSize, newItemSpan) => {
6051
+ const { itemSize, count, itemSpan } = this.options;
5576
6052
  const countChange = count !== newCount;
5577
6053
  const itemSizeChange = itemSize !== newItemSize;
5578
- if (!countChange && !itemSizeChange) {
6054
+ const itemSpanChange = itemSpan !== newItemSpan;
6055
+ if (!countChange && !itemSizeChange && !itemSpanChange) {
5579
6056
  return;
5580
6057
  }
5581
6058
  this.options.count = newCount;
5582
6059
  this.options.itemSize = newItemSize;
6060
+ this.options.itemSpan = newItemSpan;
5583
6061
  const size = this.availableSize[this.options.mainAxis === "vertical" ? "height" : "width"];
5584
6062
  const newRenderCount = this.computeRenderCount({
5585
6063
  itemSize: newItemSize,
5586
6064
  count: newCount,
5587
6065
  size
5588
6066
  });
5589
- if (!itemSizeChange && countChange && newCount > count) {
6067
+ if (!itemSizeChange && !itemSpanChange && countChange && newCount > count) {
5590
6068
  const currentRenderCount = this.getRenderCount();
5591
6069
  if (currentRenderCount > newRenderCount) {
5592
6070
  return;
@@ -5611,11 +6089,43 @@ var VirtualBrain = class extends Logger {
5611
6089
  this.updateRenderCount(newRenderCount);
5612
6090
  };
5613
6091
  this.reset = () => {
6092
+ this.itemSpanParent = [];
6093
+ this.itemSpanValue = [];
5614
6094
  this.itemSizeCache = [];
5615
6095
  this.itemOffsetCache = [0];
5616
6096
  this.renderCount = -1;
5617
6097
  this.totalSize = 0;
5618
6098
  };
6099
+ this.computeItemSpanUpTo = (itemIndex) => {
6100
+ const { count, itemSpan } = this.options;
6101
+ if (!itemSpan) {
6102
+ return;
6103
+ }
6104
+ const cache = this.itemSpanParent;
6105
+ const spanResultArr = this.itemSpanValue;
6106
+ if (cache[itemIndex] === void 0) {
6107
+ let i = cache.length;
6108
+ let lastIndex = Math.min(itemIndex, count - 1);
6109
+ for (; i <= lastIndex; i++) {
6110
+ if (cache[i] === void 0) {
6111
+ ItemIndexBag.itemIndex = i;
6112
+ let spanValue = itemSpan(ItemIndexBag);
6113
+ if (false) {
6114
+ this.debug("itemSpan cannot be less than 1 - got %d for index %d", spanValue, i);
6115
+ }
6116
+ cache[i] = i;
6117
+ spanResultArr[i] = spanValue;
6118
+ let spannedItemIndex = i;
6119
+ while (spanValue > 1) {
6120
+ spannedItemIndex += 1;
6121
+ cache[spannedItemIndex] = i;
6122
+ spanResultArr[spannedItemIndex] = 0;
6123
+ spanValue -= 1;
6124
+ }
6125
+ }
6126
+ }
6127
+ }
6128
+ };
5619
6129
  this.computeCacheFor = (itemIndex) => {
5620
6130
  if (typeof this.options.itemSize !== "function") {
5621
6131
  return;
@@ -5635,6 +6145,33 @@ var VirtualBrain = class extends Logger {
5635
6145
  this.itemOffsetCache[itemIndex] = offset;
5636
6146
  }
5637
6147
  };
6148
+ this.getItemSpan = (itemIndex) => {
6149
+ if (!this.options.itemSpan) {
6150
+ return 1;
6151
+ }
6152
+ if (this.itemSpanValue[itemIndex] === void 0) {
6153
+ this.computeItemSpanUpTo(itemIndex);
6154
+ }
6155
+ return this.itemSpanValue[itemIndex] || 1;
6156
+ };
6157
+ this.getItemSpanParent = (itemIndex) => {
6158
+ if (!this.options.itemSpan) {
6159
+ return itemIndex;
6160
+ }
6161
+ if (this.itemSpanParent[itemIndex] === void 0) {
6162
+ this.computeItemSpanUpTo(itemIndex);
6163
+ }
6164
+ return this.itemSpanParent[itemIndex];
6165
+ };
6166
+ this.getItemSizeWithSpan = (itemIndex, itemSpan) => {
6167
+ let itemSize = this.getItemSize(itemIndex);
6168
+ while (itemSpan > 1) {
6169
+ itemIndex += 1;
6170
+ itemSpan -= 1;
6171
+ itemSize += this.getItemSize(itemIndex);
6172
+ }
6173
+ return itemSize;
6174
+ };
5638
6175
  this.getItemSize = (itemIndex) => {
5639
6176
  const { itemSize, count } = this.options;
5640
6177
  if (typeof itemSize !== "function") {
@@ -5781,7 +6318,7 @@ var VirtualBrain = class extends Logger {
5781
6318
  }
5782
6319
  computeRenderRange() {
5783
6320
  const count = this.getOptions().count;
5784
- const renderCount = this.getRenderCount();
6321
+ let renderCount = this.getRenderCount();
5785
6322
  if (renderCount === 0) {
5786
6323
  return {
5787
6324
  renderStartIndex: -1,
@@ -5794,6 +6331,12 @@ var VirtualBrain = class extends Logger {
5794
6331
  renderEndIndex = count - 1;
5795
6332
  renderStartIndex = renderEndIndex - renderCount + 1;
5796
6333
  }
6334
+ if (this.options.itemSpan) {
6335
+ this.computeItemSpanUpTo(renderStartIndex);
6336
+ while (this.itemSpanParent[renderStartIndex] != renderStartIndex) {
6337
+ renderStartIndex--;
6338
+ }
6339
+ }
5797
6340
  return {
5798
6341
  renderStartIndex,
5799
6342
  renderEndIndex
@@ -5825,7 +6368,8 @@ function useYourBrain(param) {
5825
6368
  computedPinnedStartWidth,
5826
6369
  computedPinnedEndWidth,
5827
6370
  rowHeight,
5828
- bodySize
6371
+ bodySize,
6372
+ rowSpan
5829
6373
  } = param;
5830
6374
  const columnSize = useColumnSizeFn(computedUnpinnedColumns);
5831
6375
  const horizontalVirtualBrain = useOnce(() => {
@@ -5840,20 +6384,21 @@ function useYourBrain(param) {
5840
6384
  const brain = new VirtualBrain({
5841
6385
  count: dataArray.length,
5842
6386
  itemSize: rowHeight,
5843
- mainAxis: "vertical"
6387
+ mainAxis: "vertical",
6388
+ itemSpan: rowSpan
5844
6389
  });
5845
6390
  return brain;
5846
6391
  });
5847
6392
  horizontalVirtualBrain.update(computedUnpinnedColumns.length, columnSize);
5848
- verticalVirtualBrain.update(dataArray.length, rowHeight);
6393
+ verticalVirtualBrain.update(dataArray.length, rowHeight, rowSpan);
5849
6394
  globalThis.verticalVirtualBrain = verticalVirtualBrain;
5850
- useEffect18(() => {
6395
+ useEffect19(() => {
5851
6396
  verticalVirtualBrain.setAvailableSize({
5852
6397
  height: bodySize.height,
5853
6398
  width: 0
5854
6399
  });
5855
6400
  }, [bodySize, verticalVirtualBrain]);
5856
- useEffect18(() => {
6401
+ useEffect19(() => {
5857
6402
  horizontalVirtualBrain.setAvailableSize({
5858
6403
  height: 0,
5859
6404
  width: Math.max(bodySize.width - computedPinnedStartWidth - computedPinnedEndWidth, 0)
@@ -5887,7 +6432,7 @@ function shallowEqualObjects(objA, objB) {
5887
6432
 
5888
6433
  // src/components/InfiniteTable/hooks/useListRendering.tsx
5889
6434
  function useListRendering(param) {
5890
- const { computed, domRef, bodySize, columnShifts } = param;
6435
+ const { computed, bodySize, columnShifts } = param;
5891
6436
  const { componentActions, componentState, getState } = useInfiniteTable();
5892
6437
  const prevComputed = usePrevious(computed, null);
5893
6438
  const {
@@ -5900,40 +6445,68 @@ function useListRendering(param) {
5900
6445
  computedUnpinnedColumns,
5901
6446
  computedUnpinnedColumnsWidth,
5902
6447
  computedPinnedStartOverflow,
5903
- computedPinnedEndOverflow
6448
+ computedPinnedEndOverflow,
6449
+ computedVisibleColumns
5904
6450
  } = computed;
5905
6451
  const { componentState: dataSourceState, getState: getDataSourceState } = useDataSourceContextValue();
5906
6452
  const { dataArray } = dataSourceState;
5907
6453
  const getData = useLatest(dataArray);
5908
6454
  const {
5909
- rowHeightComputed: rowHeight,
6455
+ rowHeight,
5910
6456
  pinnedStartMaxWidth,
5911
6457
  pinnedEndMaxWidth,
5912
6458
  pinnedStartScrollListener,
5913
6459
  pinnedEndScrollListener
5914
6460
  } = componentState;
5915
6461
  const prevDataSourceTimestamp = usePrevious(dataSourceState.updatedAt);
5916
- const repaintIdRef = useRef14(0);
6462
+ const repaintIdRef = useRef15(0);
5917
6463
  if (!shallowEqualObjects(prevComputed, computed) || prevDataSourceTimestamp !== dataSourceState.updatedAt) {
5918
6464
  repaintIdRef.current++;
5919
6465
  }
5920
6466
  const repaintId = repaintIdRef.current;
6467
+ const rowSpan = useMemo10(() => {
6468
+ const colsWithRowspan = computedVisibleColumns.filter((col) => typeof col.rowspan === "function");
6469
+ return colsWithRowspan.length ? ({ itemIndex }) => {
6470
+ let maxSpan = 1;
6471
+ const dataArray2 = getData();
6472
+ const rowInfo = dataArray2[itemIndex];
6473
+ const data = rowInfo.data;
6474
+ colsWithRowspan.forEach((column) => {
6475
+ if (!column.rowspan) {
6476
+ return;
6477
+ }
6478
+ const span = column.rowspan({
6479
+ column,
6480
+ data,
6481
+ dataArray: dataArray2,
6482
+ groupRowInfo: null,
6483
+ rowInfo,
6484
+ rowIndex: itemIndex
6485
+ });
6486
+ if (span > maxSpan) {
6487
+ maxSpan = span;
6488
+ }
6489
+ });
6490
+ return maxSpan;
6491
+ } : void 0;
6492
+ }, [computedVisibleColumns]);
5921
6493
  const { horizontalVirtualBrain, verticalVirtualBrain } = useYourBrain({
5922
6494
  computedPinnedStartWidth: computed.computedPinnedStartWidth,
5923
6495
  computedPinnedEndWidth: computed.computedPinnedEndWidth,
5924
6496
  computedUnpinnedColumns: computed.computedUnpinnedColumns,
5925
6497
  rowHeight,
5926
6498
  dataArray,
5927
- bodySize
6499
+ bodySize,
6500
+ rowSpan
5928
6501
  });
5929
6502
  const hasHorizontalScrollbar = computedUnpinnedColumnsWidth > bodySize.width - computedPinnedStartColumnsWidth - computedPinnedEndColumnsWidth;
5930
6503
  const reservedContentHeight = verticalVirtualBrain.getTotalSize() + (hasHorizontalScrollbar ? getScrollbarWidth() : 0);
5931
6504
  const hasVerticalScrollbar = bodySize.height < reservedContentHeight;
5932
- const scrollbars = useMemo9(() => ({
6505
+ const scrollbars = useMemo10(() => ({
5933
6506
  vertical: hasVerticalScrollbar,
5934
6507
  horizontal: hasHorizontalScrollbar
5935
6508
  }), [hasVerticalScrollbar, hasHorizontalScrollbar]);
5936
- useEffect19(() => {
6509
+ useEffect20(() => {
5937
6510
  if (!bodySize.height) {
5938
6511
  return;
5939
6512
  }
@@ -5956,7 +6529,7 @@ function useListRendering(param) {
5956
6529
  const { applyScrollHorizontal, applyScrollVertical } = useOnContainerScroll({
5957
6530
  verticalVirtualBrain,
5958
6531
  horizontalVirtualBrain,
5959
- domRef
6532
+ reservedContentHeight
5960
6533
  });
5961
6534
  const { componentActions: dataSourceActions } = useDataSourceContextValue();
5962
6535
  const toggleGroupRow = useCallback17((groupKeys) => {
@@ -5994,7 +6567,7 @@ function useListRendering(param) {
5994
6567
  computedUnpinnedColumns
5995
6568
  });
5996
6569
  const [, rerender] = useRerender();
5997
- useEffect19(() => {
6570
+ useEffect20(() => {
5998
6571
  rerender();
5999
6572
  }, [dataSourceState]);
6000
6573
  const { pinnedStartList, pinnedStartScrollbarPlaceholder } = usePinnedStartRendering(pinnedRenderingParams);
@@ -6021,9 +6594,9 @@ import {
6021
6594
  createElement as createElement30,
6022
6595
  forwardRef as forwardRef3,
6023
6596
  useCallback as useCallback18,
6024
- useRef as useRef15
6597
+ useRef as useRef16
6025
6598
  } from "react";
6026
- import { useEffect as useEffect20 } from "react";
6599
+ import { useEffect as useEffect21 } from "react";
6027
6600
 
6028
6601
  // src/components/utils/decamelize.ts
6029
6602
  var import_decamelize = __toModule(require_decamelize());
@@ -6034,7 +6607,7 @@ var decamelize = (input, options) => {
6034
6607
 
6035
6608
  // src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
6036
6609
  var defaultStyle2 = {
6037
- padding: "var(--it-space-2)",
6610
+ padding: ThemeVars.spacing[2],
6038
6611
  textAlign: "end",
6039
6612
  opacity: "1",
6040
6613
  visibility: "visible",
@@ -6060,8 +6633,8 @@ var enforceStyle = (node, style) => {
6060
6633
  }
6061
6634
  };
6062
6635
  var InfiniteTableLicenseFooter = forwardRef3(function InfiniteTableLicenseFooter2(props, ref) {
6063
- const { rootClassName: rootClassName11 } = useInternalProps();
6064
- const domRef = useRef15(null);
6636
+ const { rootClassName: rootClassName12 } = useInternalProps();
6637
+ const domRef = useRef16(null);
6065
6638
  const domCallback = useCallback18((node) => {
6066
6639
  domRef.current = node;
6067
6640
  if (!ref) {
@@ -6073,7 +6646,7 @@ var InfiniteTableLicenseFooter = forwardRef3(function InfiniteTableLicenseFooter
6073
6646
  ref.current = node;
6074
6647
  }
6075
6648
  }, []);
6076
- useEffect20(() => {
6649
+ useEffect21(() => {
6077
6650
  const forceStyle = () => {
6078
6651
  requestAnimationFrame(() => {
6079
6652
  var _a;
@@ -6090,7 +6663,7 @@ var InfiniteTableLicenseFooter = forwardRef3(function InfiniteTableLicenseFooter
6090
6663
  return /* @__PURE__ */ createElement30("div", __spreadProps(__spreadValues({
6091
6664
  ref: domCallback
6092
6665
  }, props), {
6093
- className: join(`${rootClassName11}Footer`, ICSS.position.relative, props.className),
6666
+ className: join(`${rootClassName12}-Footer`, FooterCls, props.className),
6094
6667
  style: defaultStyle2
6095
6668
  }), "Powered by", " ", /* @__PURE__ */ createElement30("a", {
6096
6669
  href: "https://infinite-table.com",
@@ -6101,7 +6674,7 @@ var InfiniteTableLicenseFooter = forwardRef3(function InfiniteTableLicenseFooter
6101
6674
  });
6102
6675
 
6103
6676
  // src/components/InfiniteTable/hooks/useLicense/useLicense.ts
6104
- import { useMemo as useMemo10 } from "react";
6677
+ import { useMemo as useMemo11 } from "react";
6105
6678
 
6106
6679
  // src/components/InfiniteTable/hooks/useLicense/crc32.ts
6107
6680
  var DEFAULT_ReversedPolynomial = 3988292384;
@@ -6246,12 +6819,20 @@ var decode = (licenseKey) => {
6246
6819
  };
6247
6820
 
6248
6821
  // src/components/InfiniteTable/hooks/useLicense/useLicense.ts
6822
+ var SANDBOX_REGEX = /(https):\/\/\d+\-\d+\-\d\-(sandpack\.codesandbox\.io)/g;
6823
+ var origin = typeof window !== "undefined" ? window.location.origin : "";
6824
+ var [_fullUrl, protocol, sandboxUrl] = Array.from(SANDBOX_REGEX.exec(origin) || []);
6825
+ var isInsideSandbox = protocol === "https" && sandboxUrl === "sandpack.codesandbox.io";
6249
6826
  var useLicense = (licenseKey) => {
6250
- const valid = useMemo10(() => {
6251
- return isValidLicense(licenseKey, {
6827
+ const valid = useMemo11(() => {
6828
+ let valid2 = isValidLicense(licenseKey, {
6252
6829
  publishedAt: 1624970570587,
6253
- version: "0.0.2-canary.2"
6830
+ version: "0.0.2-canary.3"
6254
6831
  });
6832
+ if (!valid2 && isInsideSandbox) {
6833
+ return true;
6834
+ }
6835
+ return valid2;
6255
6836
  }, [licenseKey]);
6256
6837
  return valid;
6257
6838
  };
@@ -6262,8 +6843,8 @@ import {
6262
6843
  useCallback as useCallback19,
6263
6844
  useLayoutEffect as useLayoutEffect5
6264
6845
  } from "react";
6265
- import { useRef as useRef16 } from "react";
6266
- var error = err("CSSVariableWatch");
6846
+ import { useRef as useRef17 } from "react";
6847
+ var error2 = err("CSSVariableWatch");
6267
6848
  var debug5 = dbg("CSSVariableWatch");
6268
6849
  var WRAPPER_STYLE = {
6269
6850
  position: "absolute",
@@ -6275,7 +6856,7 @@ var WRAPPER_STYLE = {
6275
6856
  overflow: "hidden"
6276
6857
  };
6277
6858
  var useCSSVariableWatch = (params) => {
6278
- const lastValueRef = useRef16(0);
6859
+ const lastValueRef = useRef17(0);
6279
6860
  const onResize = useCallback19(({ height }) => {
6280
6861
  if (height && height !== lastValueRef.current) {
6281
6862
  lastValueRef.current = height;
@@ -6290,12 +6871,12 @@ var useCSSVariableWatch = (params) => {
6290
6871
  debug5(`Variable ${params.varName} found and equals ${value}.`);
6291
6872
  params.onChange(value);
6292
6873
  } else {
6293
- error(`Specified variable ${params.varName} not found or does not have a numeric value.`);
6874
+ error2(`Specified variable ${params.varName} not found or does not have a numeric value.`);
6294
6875
  }
6295
6876
  }, []);
6296
6877
  };
6297
6878
  var CSSVariableWatch = (props) => {
6298
- const domRef = useRef16(null);
6879
+ const domRef = useRef17(null);
6299
6880
  useCSSVariableWatch(__spreadProps(__spreadValues({}, props), {
6300
6881
  ref: domRef
6301
6882
  }));
@@ -6306,11 +6887,121 @@ var CSSVariableWatch = (props) => {
6306
6887
  }, /* @__PURE__ */ createElement31("div", {
6307
6888
  ref: domRef,
6308
6889
  style: {
6309
- height: `var(${props.varName})`
6890
+ height: props.varName.startsWith("var(") ? props.varName : `var(${props.varName})`
6310
6891
  }
6311
6892
  }));
6312
6893
  };
6313
6894
 
6895
+ // src/components/InfiniteTable/hooks/useDOMProps.ts
6896
+ function useDOMProps(initialDOMProps) {
6897
+ const { computed, componentState, componentActions } = useInfiniteTable();
6898
+ const {
6899
+ columnShifts,
6900
+ focused,
6901
+ focusedWithin,
6902
+ domRef,
6903
+ onBlurWithin,
6904
+ onFocusWithin,
6905
+ onSelfFocus,
6906
+ onSelfBlur
6907
+ } = componentState;
6908
+ const { computedPinnedStartColumnsWidth, computedPinnedEndColumnsWidth } = computed;
6909
+ const setFocused = rafFn((focused2) => {
6910
+ componentActions.focused = focused2;
6911
+ });
6912
+ const setFocusedWithin = rafFn((focused2) => {
6913
+ componentActions.focusedWithin = focused2;
6914
+ });
6915
+ const onFocus = (event) => {
6916
+ var _a;
6917
+ (_a = initialDOMProps == null ? void 0 : initialDOMProps.onFocus) == null ? void 0 : _a.call(initialDOMProps, event);
6918
+ if (event.target === domRef.current) {
6919
+ setFocused(true);
6920
+ onSelfFocus == null ? void 0 : onSelfFocus(event);
6921
+ if (focusedWithin) {
6922
+ setFocusedWithin(false);
6923
+ onBlurWithin == null ? void 0 : onBlurWithin(event);
6924
+ }
6925
+ } else {
6926
+ if (!focusedWithin) {
6927
+ setFocusedWithin(true);
6928
+ onFocusWithin == null ? void 0 : onFocusWithin(event);
6929
+ }
6930
+ }
6931
+ };
6932
+ const onBlur = (event) => {
6933
+ var _a, _b;
6934
+ (_a = initialDOMProps == null ? void 0 : initialDOMProps.onBlur) == null ? void 0 : _a.call(initialDOMProps, event);
6935
+ if (event.target === domRef.current) {
6936
+ setFocused(false);
6937
+ onSelfBlur == null ? void 0 : onSelfBlur(event);
6938
+ if (focusedWithin) {
6939
+ setFocusedWithin(false);
6940
+ onBlurWithin == null ? void 0 : onBlurWithin(event);
6941
+ }
6942
+ } else {
6943
+ const contained = (_b = domRef.current) == null ? void 0 : _b.contains(event.relatedTarget);
6944
+ if (!contained) {
6945
+ setFocusedWithin(false);
6946
+ onBlurWithin == null ? void 0 : onBlurWithin(event);
6947
+ }
6948
+ }
6949
+ };
6950
+ const domProps = __spreadProps(__spreadValues({
6951
+ tabIndex: 0
6952
+ }, initialDOMProps), {
6953
+ onFocus,
6954
+ onBlur
6955
+ });
6956
+ 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({
6957
+ hasPinnedStart: !!computedPinnedStartColumnsWidth,
6958
+ hasPinnedEnd: !!computedPinnedEndColumnsWidth,
6959
+ hasPinnedStartOverflow: !!computed.computedPinnedStartOverflow,
6960
+ hasPinnedEndOverflow: !!computed.computedPinnedEndOverflow,
6961
+ focused,
6962
+ focusedWithin
6963
+ }));
6964
+ domProps.className = className;
6965
+ domProps.style = __spreadValues({}, initialDOMProps == null ? void 0 : initialDOMProps.style);
6966
+ if (focused) {
6967
+ if (componentState.focusedStyle) {
6968
+ Object.assign(domProps.style, componentState.focusedStyle);
6969
+ }
6970
+ }
6971
+ if (focusedWithin) {
6972
+ if (componentState.focusedWithinStyle) {
6973
+ Object.assign(domProps.style, componentState.focusedWithinStyle);
6974
+ }
6975
+ }
6976
+ return domProps;
6977
+ }
6978
+
6979
+ // src/components/InfiniteTable/components/LoadMask.tsx
6980
+ import {
6981
+ createElement as createElement32,
6982
+ memo as memo12
6983
+ } from "react";
6984
+
6985
+ // src/components/InfiniteTable/components/LoadMask.css.ts
6986
+ var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2 _16lm1iwp _16lm1iwr _16lm1iwv _16lm1iwt", hidden: "qy58ya2 qy58ya0 _16lm1iw2 _16lm1iwp _16lm1iwr _16lm1iwv _16lm1iwt" };
6987
+ var LoadMaskOverlayCls = "qy58ya3 _16lm1iw2 _16lm1iwp _16lm1iwr _16lm1iwv _16lm1iwt";
6988
+ var LoadMaskTextCls = "qy58ya4";
6989
+
6990
+ // src/components/InfiniteTable/components/LoadMask.tsx
6991
+ var { rootClassName: rootClassName11 } = internalProps;
6992
+ var baseCls2 = `${rootClassName11}-LoadMask`;
6993
+ function LoadMaskFn(props) {
6994
+ const { visible, children = "Loading" } = props;
6995
+ return /* @__PURE__ */ createElement32("div", {
6996
+ className: `${LoadMaskCls[visible ? "visible" : "hidden"]} ${baseCls2}`
6997
+ }, /* @__PURE__ */ createElement32("div", {
6998
+ className: `${LoadMaskOverlayCls} ${baseCls2}-Overlay`
6999
+ }), /* @__PURE__ */ createElement32("div", {
7000
+ className: `${LoadMaskTextCls} ${baseCls2}-Text`
7001
+ }, children));
7002
+ }
7003
+ var LoadMask = memo12(LoadMaskFn);
7004
+
6314
7005
  // src/components/InfiniteTable/index.tsx
6315
7006
  var InfiniteTableClassName = internalProps.rootClassName;
6316
7007
  var ONLY_VERTICAL_SCROLLBAR = {
@@ -6318,26 +7009,33 @@ var ONLY_VERTICAL_SCROLLBAR = {
6318
7009
  vertical: true
6319
7010
  };
6320
7011
  var InfiniteTableRoot = getComponentStateRoot({
6321
- getInitialState,
6322
- deriveReadOnlyState,
7012
+ initSetupState,
7013
+ forwardProps,
7014
+ mapPropsToState,
7015
+ allowedControlledPropOverrides: {
7016
+ rowHeight: true,
7017
+ headerHeight: true
7018
+ },
6323
7019
  getParentState: () => useDataSource()
6324
7020
  });
6325
- var InfiniteTableComponent = memo12(function InfiniteTableComponent2() {
7021
+ var InfiniteTableComponent = memo13(function InfiniteTableComponent2() {
7022
+ var _a;
6326
7023
  const { componentState, getComputed, computed } = useInfiniteTable();
6327
7024
  const {
6328
- componentState: { dataArray }
7025
+ componentState: { dataArray, loading }
6329
7026
  } = useDataSourceContextValue();
6330
7027
  const {
6331
7028
  domRef,
6332
- bodyDOMRef,
7029
+ scrollerDOMRef,
6333
7030
  portalDOMRef,
6334
- domProps,
6335
7031
  licenseKey,
7032
+ loadingText,
6336
7033
  header,
6337
- onRowHeightChange,
6338
- onHeaderHeightChange,
7034
+ onRowHeightCSSVarChange,
7035
+ onHeaderHeightCSSVarChange,
6339
7036
  rowHeightCSSVar,
6340
- headerHeightCSSVar
7037
+ headerHeightCSSVar,
7038
+ components
6341
7039
  } = componentState;
6342
7040
  const { columnShifts, bodySize } = componentState;
6343
7041
  const {
@@ -6359,39 +7057,40 @@ var InfiniteTableComponent = memo12(function InfiniteTableComponent2() {
6359
7057
  computed
6360
7058
  });
6361
7059
  const licenseValid = useLicense(licenseKey);
6362
- 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);
6363
- return /* @__PURE__ */ createElement32("div", __spreadProps(__spreadValues({
7060
+ const domProps = useDOMProps(componentState.domProps);
7061
+ const LoadMaskCmp = (_a = components == null ? void 0 : components.LoadMask) != null ? _a : LoadMask;
7062
+ return /* @__PURE__ */ createElement33("div", __spreadValues({
6364
7063
  ref: domRef
6365
- }, domProps), {
6366
- className
6367
- }), header ? /* @__PURE__ */ createElement32(TableHeaderWrapper, {
7064
+ }, domProps), header ? /* @__PURE__ */ createElement33(TableHeaderWrapper, {
6368
7065
  brain: horizontalVirtualBrain,
6369
7066
  repaintId,
6370
7067
  scrollbars
6371
- }) : null, /* @__PURE__ */ createElement32(InfiniteTableBody, null, /* @__PURE__ */ createElement32(VirtualScrollContainer, {
6372
- ref: bodyDOMRef,
7068
+ }) : null, /* @__PURE__ */ createElement33(InfiniteTableBody, null, /* @__PURE__ */ createElement33(VirtualScrollContainer, {
7069
+ ref: scrollerDOMRef,
6373
7070
  onContainerScroll: applyScrollVertical,
6374
7071
  scrollable: ONLY_VERTICAL_SCROLLBAR
6375
- }, /* @__PURE__ */ createElement32("div", {
6376
- className: ICSS.display.flex
6377
- }, pinnedStartList, centerList, pinnedEndList), /* @__PURE__ */ createElement32(SpacePlaceholder, {
7072
+ }, /* @__PURE__ */ createElement33("div", {
7073
+ className: display.flex
7074
+ }, pinnedStartList, centerList, pinnedEndList), /* @__PURE__ */ createElement33(SpacePlaceholder, {
6378
7075
  count: dataArray.length,
6379
7076
  width: 0,
6380
7077
  height: reservedContentHeight
6381
- })), pinnedStartScrollbarPlaceholder, pinnedEndScrollbarPlaceholder), licenseValid ? null : /* @__PURE__ */ createElement32(InfiniteTableLicenseFooter, null), /* @__PURE__ */ createElement32("div", {
7078
+ })), pinnedStartScrollbarPlaceholder, pinnedEndScrollbarPlaceholder, /* @__PURE__ */ createElement33(LoadMaskCmp, {
7079
+ visible: loading
7080
+ }, loadingText)), licenseValid ? null : /* @__PURE__ */ createElement33(InfiniteTableLicenseFooter, null), /* @__PURE__ */ createElement33("div", {
6382
7081
  ref: portalDOMRef,
6383
- className: "ITable-Portal"
6384
- }), rowHeightCSSVar ? /* @__PURE__ */ createElement32(CSSVariableWatch, {
7082
+ className: join(`${rootClassName}Portal`, zIndex[1e3], position.absolute, top[0], left[0])
7083
+ }), rowHeightCSSVar ? /* @__PURE__ */ createElement33(CSSVariableWatch, {
6385
7084
  varName: rowHeightCSSVar,
6386
- onChange: onRowHeightChange
6387
- }) : null, headerHeightCSSVar ? /* @__PURE__ */ createElement32(CSSVariableWatch, {
7085
+ onChange: onRowHeightCSSVarChange
7086
+ }) : null, headerHeightCSSVar ? /* @__PURE__ */ createElement33(CSSVariableWatch, {
6388
7087
  varName: headerHeightCSSVar,
6389
- onChange: onHeaderHeightChange
7088
+ onChange: onHeaderHeightCSSVarChange
6390
7089
  }) : null);
6391
7090
  });
6392
7091
  function InfiniteTableContextProvider() {
6393
7092
  const { componentActions, componentState } = useComponentState();
6394
- const { bodyDOMRef, bodySizeRef } = componentState;
7093
+ const { scrollerDOMRef } = componentState;
6395
7094
  const computed = useComputed();
6396
7095
  const getComputed = useLatest(computed);
6397
7096
  const getState = useLatest(componentState);
@@ -6406,14 +7105,13 @@ function InfiniteTableContextProvider() {
6406
7105
  getComputed,
6407
7106
  getState
6408
7107
  };
6409
- useResizeObserver(bodyDOMRef, (size) => {
7108
+ useResizeObserver(scrollerDOMRef, (size) => {
6410
7109
  var _a, _b;
6411
7110
  const bodySize = {
6412
7111
  width: size.width,
6413
7112
  height: size.height
6414
7113
  };
6415
- bodySize.width = (_b = (_a = bodyDOMRef.current) == null ? void 0 : _a.scrollWidth) != null ? _b : bodySize.width;
6416
- bodySizeRef.current = bodySize;
7114
+ bodySize.width = (_b = (_a = scrollerDOMRef.current) == null ? void 0 : _a.scrollWidth) != null ? _b : bodySize.width;
6417
7115
  const state = getState();
6418
7116
  if (!state.virtualizeHeader) {
6419
7117
  componentActions.bodySize = bodySize;
@@ -6421,23 +7119,24 @@ function InfiniteTableContextProvider() {
6421
7119
  }
6422
7120
  componentActions.bodySize = bodySize;
6423
7121
  }, { earlyAttach: true });
6424
- useEffect21(() => {
7122
+ useEffect22(() => {
6425
7123
  return () => {
6426
- componentState.onRowHeightChange.destroy();
6427
- componentState.onHeaderHeightChange.destroy();
7124
+ componentState.onRowHeightCSSVarChange.destroy();
7125
+ componentState.onHeaderHeightCSSVarChange.destroy();
6428
7126
  };
6429
7127
  }, []);
6430
7128
  const TableContext2 = getInfiniteTableContext();
6431
- return /* @__PURE__ */ createElement32(TableContext2.Provider, {
7129
+ return /* @__PURE__ */ createElement33(TableContext2.Provider, {
6432
7130
  value: contextValue
6433
- }, /* @__PURE__ */ createElement32(InfiniteTableComponent, null));
7131
+ }, /* @__PURE__ */ createElement33(InfiniteTableComponent, null));
6434
7132
  }
6435
7133
  function InfiniteTable(props) {
6436
- return /* @__PURE__ */ createElement32(StrictMode, null, /* @__PURE__ */ createElement32(InfiniteTableRoot, __spreadValues({}, props), /* @__PURE__ */ createElement32(InfiniteTableContextProvider, null)));
7134
+ const table = /* @__PURE__ */ createElement33(InfiniteTableRoot, __spreadValues({}, props), /* @__PURE__ */ createElement33(InfiniteTableContextProvider, null));
7135
+ return /* @__PURE__ */ createElement33(StrictMode, null, table);
6437
7136
  }
6438
7137
  InfiniteTable.defaultProps = {
6439
7138
  rowHeight: 40,
6440
- headerHeight: "--ITableHeader__height"
7139
+ headerHeight: ThemeVars.components.Header.height
6441
7140
  };
6442
7141
  export {
6443
7142
  DataSource,