@infinite-table/infinite-react 5.1.0-canary.1 → 6.0.1

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.
Files changed (7) hide show
  1. package/index.css +363 -160
  2. package/index.d.ts +1195 -60
  3. package/index.dev.js +2613 -406
  4. package/index.dev.mjs +2599 -400
  5. package/index.js +2613 -406
  6. package/index.mjs +2599 -400
  7. package/package.json +2 -2
package/index.dev.mjs CHANGED
@@ -73,7 +73,7 @@ function debounce(fn, { wait }) {
73
73
  }
74
74
 
75
75
  // src/components/InfiniteTable/index.tsx
76
- import * as React68 from "react";
76
+ import * as React69 from "react";
77
77
 
78
78
  // src/utils/join.ts
79
79
  var join = (...args) => args.filter((x) => !!`${x}`).join(" ");
@@ -187,6 +187,18 @@ var DeepMap = class {
187
187
  );
188
188
  return result;
189
189
  }
190
+ getEntriesStartingWith(keys, excludeSelf, depthLimit) {
191
+ const result = [];
192
+ this.getStartingWith(
193
+ keys,
194
+ (keys2, value) => {
195
+ result.push([keys2, value]);
196
+ },
197
+ excludeSelf,
198
+ depthLimit
199
+ );
200
+ return result;
201
+ }
190
202
  getKeysStartingWith(keys, excludeSelf, depthLimit) {
191
203
  const result = [];
192
204
  this.getStartingWith(
@@ -880,16 +892,16 @@ var setupResizeObserver = (node, callback, config = { debounce: 0 }) => {
880
892
  const onResizeCallback = debounceTime ? debounce(callback, { wait: debounceTime }) : callback;
881
893
  const observer = new RO((entries) => {
882
894
  const entry = entries[0];
883
- let { width, height } = entry.contentRect;
895
+ let { width, height: height2 } = entry.contentRect;
884
896
  if (entry.borderBoxSize?.[0]) {
885
- height = entry.borderBoxSize[0].blockSize;
897
+ height2 = entry.borderBoxSize[0].blockSize;
886
898
  width = entry.borderBoxSize[0].inlineSize;
887
899
  } else {
888
900
  const rect = node.getBoundingClientRect();
889
- height = rect.height;
901
+ height2 = rect.height;
890
902
  width = rect.width;
891
903
  }
892
- onResizeCallback({ width, height });
904
+ onResizeCallback({ width, height: height2 });
893
905
  });
894
906
  observer.observe(node);
895
907
  return () => {
@@ -960,10 +972,10 @@ var WRAPPER_STYLE = {
960
972
  var useCSSVariableWatch = (params) => {
961
973
  const lastValueRef = useRef2(0);
962
974
  const onResize = React2.useCallback(
963
- ({ height }) => {
964
- if (height != null && height !== lastValueRef.current) {
965
- lastValueRef.current = height;
966
- params.onChange(height);
975
+ ({ height: height2 }) => {
976
+ if (height2 != null && height2 !== lastValueRef.current) {
977
+ lastValueRef.current = height2;
978
+ params.onChange(height2);
967
979
  }
968
980
  },
969
981
  [params.onChange]
@@ -988,7 +1000,7 @@ var CSSNumericVariableWatch = (props) => {
988
1000
  ...props,
989
1001
  ref: domRef
990
1002
  });
991
- const height = props.varName.startsWith("var(") ? props.varName : `var(${props.varName})`;
1003
+ const height2 = props.varName.startsWith("var(") ? props.varName : `var(${props.varName})`;
992
1004
  const { allowInts = false } = props;
993
1005
  return /* @__PURE__ */ React2.createElement(
994
1006
  "div",
@@ -1002,7 +1014,7 @@ var CSSNumericVariableWatch = (props) => {
1002
1014
  {
1003
1015
  ref: domRef,
1004
1016
  style: {
1005
- height: allowInts ? `calc(1px * ${height})` : height
1017
+ height: allowInts ? `calc(1px * ${height2})` : height2
1006
1018
  // we do multiplication in order to support integer (without px) values as well
1007
1019
  }
1008
1020
  }
@@ -1069,9 +1081,9 @@ import {
1069
1081
  // src/components/VirtualList/SpacePlaceholder.tsx
1070
1082
  import * as React6 from "react";
1071
1083
  function SpacePlaceholderFn(props) {
1072
- const { height, width, count } = props;
1084
+ const { height: height2, width, count } = props;
1073
1085
  const style2 = {
1074
- height,
1086
+ height: height2,
1075
1087
  width,
1076
1088
  zIndex: -1,
1077
1089
  opacity: 0,
@@ -1083,7 +1095,7 @@ function SpacePlaceholderFn(props) {
1083
1095
  {
1084
1096
  "data-count": count,
1085
1097
  "data-placeholder-width": false ? width : void 0,
1086
- "data-placeholder-height": false ? height : void 0,
1098
+ "data-placeholder-height": false ? height2 : void 0,
1087
1099
  "data-name": "SpacePlaceholder",
1088
1100
  style: style2
1089
1101
  }
@@ -1303,7 +1315,8 @@ var internalProps = {
1303
1315
  var InternalVars = { currentColumnTransformX: "var(--currentColumnTransformX__16hkbkc0)", y: "var(--y__16hkbkc1)", currentFlashingBackground: "var(--currentFlashingBackground__16hkbkc2)", currentFlashingDuration: "var(--currentFlashingDuration__16hkbkc3)", activeCellRowOffset: "var(--activeCellRowOffset__16hkbkc4)", activeCellRowOffsetX: "var(--activeCellRowOffsetX__16hkbkc5)", activeCellRowHeight: "var(--activeCellRowHeight__16hkbkc6)", activeCellOffsetX: "var(--activeCellOffsetX__16hkbkc7)", activeCellOffsetY: "var(--activeCellOffsetY__16hkbkc8)", scrollTopForActiveRow: "var(--scrollTopForActiveRow__16hkbkc9)", scrollLeftForActiveRowWhenHorizontalLayout: "var(--scrollLeftForActiveRowWhenHorizontalLayout__16hkbkca)", activeCellColWidth: "var(--activeCellColWidth__16hkbkcb)", activeCellColOffset: "var(--activeCellColOffset__16hkbkcc)", columnReorderEffectDurationAtIndex: "var(--columnReorderEffectDurationAtIndex__16hkbkcd)", columnWidthAtIndex: "var(--columnWidthAtIndex__16hkbkce)", columnOffsetAtIndex: "var(--columnOffsetAtIndex__16hkbkcf)", columnOffsetAtIndexWhileReordering: "var(--columnOffsetAtIndexWhileReordering__16hkbkcg)", columnZIndexAtIndex: "var(--columnZIndexAtIndex__16hkbkch)", pinnedStartWidth: "var(--pinnedStartWidth__16hkbkci)", pinnedEndWidth: "var(--pinnedEndWidth__16hkbkcj)", pinnedEndOffset: "var(--pinnedEndOffset__16hkbkck)", computedVisibleColumnsCount: "var(--computedVisibleColumnsCount__16hkbkcl)", baseZIndexForCells: "var(--baseZIndexForCells__16hkbkcm)", bodyWidth: "var(--bodyWidth__16hkbkcn)", bodyHeight: "var(--bodyHeight__16hkbkco)", scrollbarWidthHorizontal: "var(--scrollbarWidthHorizontal__16hkbkcp)", scrollbarWidthVertical: "var(--scrollbarWidthVertical__16hkbkcq)", scrollLeft: "var(--scrollLeft__16hkbkcr)", scrollTop: "var(--scrollTop__16hkbkcs)" };
1304
1316
 
1305
1317
  // src/components/InfiniteTable/vars.css.ts
1306
- var ThemeVars = { color: { accent: "var(--infinite-accent-color)", success: "var(--infinite-success-color)", error: "var(--infinite-error-color)", color: "var(--infinite-color)" }, spacing: { "0": "var(--infinite-space-0)", "1": "var(--infinite-space-1)", "2": "var(--infinite-space-2)", "3": "var(--infinite-space-3)", "4": "var(--infinite-space-4)", "5": "var(--infinite-space-5)", "6": "var(--infinite-space-6)", "7": "var(--infinite-space-7)", "8": "var(--infinite-space-8)", "9": "var(--infinite-space-9)", "10": "var(--infinite-space-10)" }, fontSize: { "0": "var(--infinite-font-size-0)", "1": "var(--infinite-font-size-1)", "2": "var(--infinite-font-size-2)", "3": "var(--infinite-font-size-3)", "4": "var(--infinite-font-size-4)", "5": "var(--infinite-font-size-5)", "6": "var(--infinite-font-size-6)", "7": "var(--infinite-font-size-7)" }, fontFamily: "var(--infinite-font-family)", minHeight: "var(--infinite-min-height)", borderRadius: "var(--infinite-border-radius)", background: "var(--infinite-background)", iconSize: "var(--infinite-icon-size)", runtime: { bodyWidth: "var(--infinite-runtime-body-content-width)", totalVisibleColumnsWidthValue: "var(--infinite-runtime-total-visible-columns-width)", totalVisibleColumnsWidthVar: "var(--infinite-runtime-total-visible-columns-width-var)", visibleColumnsCount: "var(--infinite-runtime-visible-columns-count)", browserScrollbarWidth: "var(--infinite-runtime-browser-scrollbar-width)" }, components: { LoadMask: { padding: "var(--infinite-load-mask-padding)", color: "var(--infinite-load-mask-color)", textBackground: "var(--infinite-load-mask-text-background)", overlayBackground: "var(--infinite-load-mask-overlay-background)", overlayOpacity: "var(--infinite-load-mask-overlay-opacity)", borderRadius: "var(--infinite-load-mask-border-radius)" }, Header: { background: "var(--infinite-header-background)", color: "var(--infinite-header-color)", columnHeaderHeight: "var(--infinite-column-header-height)" }, HeaderCell: { background: "var(--infinite-header-cell-background)", hoverBackground: "var(--infinite-header-cell-hover-background)", border: "var(--infinite-header-cell-border)", padding: "var(--infinite-header-cell-padding)", paddingX: "var(--infinite-header-cell-padding-x)", paddingY: "var(--infinite-header-cell-padding-y)", iconSize: "var(--infinite-header-cell-icon-size)", menuIconLineWidth: "var(--infinite-header-cell-menu-icon-line-width)", sortIconMargin: "var(--infinite-header-cell-sort-icon-margin)", borderRight: "var(--infinite-header-cell-border-right)", resizeHandleActiveAreaWidth: "var(--infinite-resize-handle-active-area-width)", resizeHandleWidth: "var(--infinite-resize-handle-width)", resizeHandleHoverBackground: "var(--infinite-resize-handle-hover-background)", resizeHandleConstrainedHoverBackground: "var(--infinite-resize-handle-constrained-hover-background)", filterOperatorPaddingX: "var(--infinite-filter-operator-padding-x)", filterEditorPaddingX: "var(--infinite-filter-editor-padding-x)", filterEditorMarginX: "var(--infinite-filter-editor-margin-x)", filterOperatorPaddingY: "var(--infinite-filter-operator-padding-y)", filterEditorPaddingY: "var(--infinite-filter-editor-padding-y)", filterEditorMarginY: "var(--infinite-filter-editor-margin-y)", filterEditorBackground: "var(--infinite-filter-editor-background)", filterEditorBorder: "var(--infinite-filter-editor-border)", filterEditorFocusBorderColor: "var(--infinite-filter-editor-focus-border-color)", filterEditorBorderRadius: "var(--infinite-filter-editor-border-radius)", filterEditorColor: "var(--infinite-filter-editor-color)" }, ActiveCellIndicator: { inset: "var(--infinite-active-cell-indicator-inset)" }, Cell: { flashingDuration: "var(--infinite-flashing-duration)", flashingAnimationName: "var(--infinite-flashing-animation-name)", flashingOverlayZIndex: "var(--infinite-flashing-overlay-z-index)", flashingBackground: "var(--infinite-flashing-background)", flashingUpBackground: "var(--infinite-flashing-up-background)", flashingDownBackground: "var(--infinite-flashing-down-background)", padding: "var(--infinite-cell-padding)", borderWidth: "var(--infinite-cell-border-width)", border: "var(--infinite-cell-border)", borderLeft: "var(--infinite-cell-border-left)", borderRight: "var(--infinite-cell-border-right)", borderTop: "var(--infinite-cell-border-top)", borderInvisible: "var(--infinite-cell-border-invisible)", borderRadius: "var(--infinite-cell-border-radius)", reorderEffectDuration: "var(--infinite-column-reorder-effect-duration)", pinnedBorder: "var(--infinite-pinned-cell-border)", horizontalLayoutColumnReorderDisabledPageOpacity: "var(--infinite-horizontal-layout-column-reorder-disabled-page-opacity)", color: "var(--infinite-cell-color)", selectedBackground: "var(--infinite-selected-cell-background)", selectedBackgroundDefault: "var(--infinite-selected-cell-background-default)", selectedBackgroundAlpha: "var(--infinite-selected-cell-background-alpha)", selectedBackgroundAlphaWhenTableUnfocused: "var(--infinite-selected-cell-background-alpha--table-unfocused)", selectedBorderColor: "var(--infinite-selected-cell-border-color)", selectedBorderWidth: "var(--infinite-selected-cell-border-width)", selectedBorderStyle: "var(--infinite-selected-cell-border-style)", selectedBorder: "var(--infinite-selected-cell-border)", activeBackgroundAlpha: "var(--infinite-active-cell-background-alpha)", activeBackgroundAlphaWhenTableUnfocused: "var(--infinite-active-cell-background-alpha--table-unfocused)", activeBackground: "var(--infinite-active-cell-background)", activeBackgroundDefault: "var(--infinite-active-cell-background-default)", activeBorderColor: "var(--infinite-active-cell-border-color)", activeBorderWidth: "var(--infinite-active-cell-border-width)", activeBorderStyle: "var(--infinite-active-cell-border-style)", activeBorder: "var(--infinite-active-cell-border)" }, SelectionCheckBox: { marginInline: "var(--infinite-selection-checkbox-margin-inline)" }, Menu: { background: "var(--infinite-menu-background)", color: "var(--infinite-menu-color)", separatorColor: "var(--infinite-menu-separator-color)", padding: "var(--infinite-menu-padding)", cellPaddingVertical: "var(--infinite-menu-cell-padding-vertical)", cellPaddingHorizontal: "var(--infinite-menu-cell-padding-horizontal)", cellMarginVertical: "var(--infinite-menu-cell-margin-vertical)", itemDisabledBackground: "var(--infinite-menu-item-disabled-background)", itemActiveBackground: "var(--infinite-menu-item-active-background)", itemActiveOpacity: "var(--infinite-menu-item-active-opacity)", itemPressedOpacity: "var(--infinite-menu-item-pressed-opacity)", itemPressedBackground: "var(--infinite-menu-item-pressed-background)", itemDisabledOpacity: "var(--infinite-menu-item-disabled-opacity)", borderRadius: "var(--infinite-menu-border-radius)", shadowColor: "var(--infinite-menu-shadow-color)" }, RowDetail: { background: "var(--infinite-rowdetail-background)", padding: "var(--infinite-rowdetail-padding)", gridHeight: "var(--infinite-rowdetail-grid-height)" }, Row: { background: "var(--infinite-row-background)", oddBackground: "var(--infinite-row-odd-background)", disabledBackground: "var(--infinite-row-disabled-background)", oddDisabledBackground: "var(--infinite-row-odd-disabled-background)", selectedBackground: "var(--infinite-row-selected-background)", disabledOpacity: "var(--infinite-row-disabled-opacity)", activeBackground: "var(--infinite-active-row-background)", activeBorderColor: "var(--infinite-active-row-border-color)", activeBorderWidth: "var(--infinite-active-row-border-width)", activeBorderStyle: "var(--infinite-active-row-border-style)", activeBorder: "var(--infinite-active-row-border)", activeBackgroundAlpha: "var(--infinite-active-row-background-alpha)", activeBackgroundAlphaWhenTableUnfocused: "var(--infinite-active-row-background-alpha--table-unfocused)", hoverBackground: "var(--infinite-row-hover-background)", selectedHoverBackground: "var(--infinite-row-selected-hover-background)", selectedDisabledBackground: "var(--infinite-row-selected-disabled-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)" } } };
1318
+ var CSS_LOADED_VALUE = "true";
1319
+ var ThemeVars = { loaded: "var(--infinite-loaded)", color: { accent: "var(--infinite-accent-color)", success: "var(--infinite-success-color)", error: "var(--infinite-error-color)", color: "var(--infinite-color)" }, spacing: { "0": "var(--infinite-space-0)", "1": "var(--infinite-space-1)", "2": "var(--infinite-space-2)", "3": "var(--infinite-space-3)", "4": "var(--infinite-space-4)", "5": "var(--infinite-space-5)", "6": "var(--infinite-space-6)", "7": "var(--infinite-space-7)", "8": "var(--infinite-space-8)", "9": "var(--infinite-space-9)", "10": "var(--infinite-space-10)" }, fontSize: { "0": "var(--infinite-font-size-0)", "1": "var(--infinite-font-size-1)", "2": "var(--infinite-font-size-2)", "3": "var(--infinite-font-size-3)", "4": "var(--infinite-font-size-4)", "5": "var(--infinite-font-size-5)", "6": "var(--infinite-font-size-6)", "7": "var(--infinite-font-size-7)" }, fontFamily: "var(--infinite-font-family)", minHeight: "var(--infinite-min-height)", borderRadius: "var(--infinite-border-radius)", background: "var(--infinite-background)", iconSize: "var(--infinite-icon-size)", runtime: { bodyWidth: "var(--infinite-runtime-body-content-width)", totalVisibleColumnsWidthValue: "var(--infinite-runtime-total-visible-columns-width)", totalVisibleColumnsWidthVar: "var(--infinite-runtime-total-visible-columns-width-var)", visibleColumnsCount: "var(--infinite-runtime-visible-columns-count)", browserScrollbarWidth: "var(--infinite-runtime-browser-scrollbar-width)" }, components: { LoadMask: { padding: "var(--infinite-load-mask-padding)", color: "var(--infinite-load-mask-color)", textBackground: "var(--infinite-load-mask-text-background)", overlayBackground: "var(--infinite-load-mask-overlay-background)", overlayOpacity: "var(--infinite-load-mask-overlay-opacity)", borderRadius: "var(--infinite-load-mask-border-radius)" }, Header: { background: "var(--infinite-header-background)", color: "var(--infinite-header-color)", columnHeaderHeight: "var(--infinite-column-header-height)" }, HeaderCell: { background: "var(--infinite-header-cell-background)", hoverBackground: "var(--infinite-header-cell-hover-background)", border: "var(--infinite-header-cell-border)", padding: "var(--infinite-header-cell-padding)", paddingX: "var(--infinite-header-cell-padding-x)", paddingY: "var(--infinite-header-cell-padding-y)", iconSize: "var(--infinite-header-cell-icon-size)", menuIconLineWidth: "var(--infinite-header-cell-menu-icon-line-width)", sortIconMargin: "var(--infinite-header-cell-sort-icon-margin)", borderRight: "var(--infinite-header-cell-border-right)", resizeHandleActiveAreaWidth: "var(--infinite-resize-handle-active-area-width)", resizeHandleWidth: "var(--infinite-resize-handle-width)", resizeHandleHoverBackground: "var(--infinite-resize-handle-hover-background)", resizeHandleConstrainedHoverBackground: "var(--infinite-resize-handle-constrained-hover-background)", filterOperatorPaddingX: "var(--infinite-filter-operator-padding-x)", filterEditorPaddingX: "var(--infinite-filter-editor-padding-x)", filterEditorMarginX: "var(--infinite-filter-editor-margin-x)", filterOperatorPaddingY: "var(--infinite-filter-operator-padding-y)", filterEditorPaddingY: "var(--infinite-filter-editor-padding-y)", filterEditorMarginY: "var(--infinite-filter-editor-margin-y)", filterEditorBackground: "var(--infinite-filter-editor-background)", filterEditorBorder: "var(--infinite-filter-editor-border)", filterEditorFocusBorderColor: "var(--infinite-filter-editor-focus-border-color)", filterEditorBorderRadius: "var(--infinite-filter-editor-border-radius)", filterEditorColor: "var(--infinite-filter-editor-color)" }, ActiveCellIndicator: { inset: "var(--infinite-active-cell-indicator-inset)" }, Cell: { flashingDuration: "var(--infinite-flashing-duration)", flashingAnimationName: "var(--infinite-flashing-animation-name)", flashingOverlayZIndex: "var(--infinite-flashing-overlay-z-index)", flashingBackground: "var(--infinite-flashing-background)", flashingUpBackground: "var(--infinite-flashing-up-background)", flashingDownBackground: "var(--infinite-flashing-down-background)", padding: "var(--infinite-cell-padding)", borderWidth: "var(--infinite-cell-border-width)", border: "var(--infinite-cell-border)", borderLeft: "var(--infinite-cell-border-left)", borderRight: "var(--infinite-cell-border-right)", borderTop: "var(--infinite-cell-border-top)", borderInvisible: "var(--infinite-cell-border-invisible)", borderRadius: "var(--infinite-cell-border-radius)", reorderEffectDuration: "var(--infinite-column-reorder-effect-duration)", pinnedBorder: "var(--infinite-pinned-cell-border)", horizontalLayoutColumnReorderDisabledPageOpacity: "var(--infinite-horizontal-layout-column-reorder-disabled-page-opacity)", color: "var(--infinite-cell-color)", selectedBackground: "var(--infinite-selected-cell-background)", selectedBackgroundDefault: "var(--infinite-selected-cell-background-default)", selectedBackgroundAlpha: "var(--infinite-selected-cell-background-alpha)", selectedBackgroundAlphaWhenTableUnfocused: "var(--infinite-selected-cell-background-alpha--table-unfocused)", selectedBorderColor: "var(--infinite-selected-cell-border-color)", selectedBorderWidth: "var(--infinite-selected-cell-border-width)", selectedBorderStyle: "var(--infinite-selected-cell-border-style)", selectedBorder: "var(--infinite-selected-cell-border)", activeBackgroundAlpha: "var(--infinite-active-cell-background-alpha)", activeBackgroundAlphaWhenTableUnfocused: "var(--infinite-active-cell-background-alpha--table-unfocused)", activeBackground: "var(--infinite-active-cell-background)", activeBackgroundDefault: "var(--infinite-active-cell-background-default)", activeBorderColor: "var(--infinite-active-cell-border-color)", activeBorderWidth: "var(--infinite-active-cell-border-width)", activeBorderStyle: "var(--infinite-active-cell-border-style)", activeBorder: "var(--infinite-active-cell-border)" }, SelectionCheckBox: { marginInline: "var(--infinite-selection-checkbox-margin-inline)" }, Menu: { background: "var(--infinite-menu-background)", color: "var(--infinite-menu-color)", separatorColor: "var(--infinite-menu-separator-color)", padding: "var(--infinite-menu-padding)", cellPaddingVertical: "var(--infinite-menu-cell-padding-vertical)", cellPaddingHorizontal: "var(--infinite-menu-cell-padding-horizontal)", cellMarginVertical: "var(--infinite-menu-cell-margin-vertical)", itemDisabledBackground: "var(--infinite-menu-item-disabled-background)", itemActiveBackground: "var(--infinite-menu-item-active-background)", itemActiveOpacity: "var(--infinite-menu-item-active-opacity)", itemPressedOpacity: "var(--infinite-menu-item-pressed-opacity)", itemPressedBackground: "var(--infinite-menu-item-pressed-background)", itemDisabledOpacity: "var(--infinite-menu-item-disabled-opacity)", borderRadius: "var(--infinite-menu-border-radius)", shadowColor: "var(--infinite-menu-shadow-color)" }, RowDetail: { background: "var(--infinite-rowdetail-background)", padding: "var(--infinite-rowdetail-padding)", gridHeight: "var(--infinite-rowdetail-grid-height)" }, Row: { background: "var(--infinite-row-background)", oddBackground: "var(--infinite-row-odd-background)", disabledBackground: "var(--infinite-row-disabled-background)", oddDisabledBackground: "var(--infinite-row-odd-disabled-background)", selectedBackground: "var(--infinite-row-selected-background)", disabledOpacity: "var(--infinite-row-disabled-opacity)", activeBackground: "var(--infinite-active-row-background)", activeBorderColor: "var(--infinite-active-row-border-color)", activeBorderWidth: "var(--infinite-active-row-border-width)", activeBorderStyle: "var(--infinite-active-row-border-style)", activeBorder: "var(--infinite-active-row-border)", activeBackgroundAlpha: "var(--infinite-active-row-background-alpha)", activeBackgroundAlphaWhenTableUnfocused: "var(--infinite-active-row-background-alpha--table-unfocused)", hoverBackground: "var(--infinite-row-hover-background)", selectedHoverBackground: "var(--infinite-row-selected-hover-background)", selectedDisabledBackground: "var(--infinite-row-selected-disabled-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)" } } };
1307
1320
  var columnHeaderHeightName = "column-header-height";
1308
1321
 
1309
1322
  // src/components/InfiniteTable/utils/infiniteDOMUtils.ts
@@ -1465,7 +1478,41 @@ var ALL_DIRECTIONS = {
1465
1478
  vertical: true
1466
1479
  };
1467
1480
 
1481
+ // src/components/VirtualBrain/getGreatestCountVisibleInSize.ts
1482
+ function getGreatestCountVisibleInSize(availableSize, itemSizes) {
1483
+ const len = itemSizes.length;
1484
+ if (!len) {
1485
+ return 0;
1486
+ }
1487
+ let maxCount = -1;
1488
+ for (let start = 0; start < len; start++) {
1489
+ let sum2 = 0;
1490
+ let count = 0;
1491
+ if (len - start <= maxCount) {
1492
+ break;
1493
+ }
1494
+ for (let i = start; i < len; i++) {
1495
+ sum2 += itemSizes[i];
1496
+ count++;
1497
+ if (sum2 > availableSize) {
1498
+ if (count > maxCount) {
1499
+ maxCount = count;
1500
+ }
1501
+ break;
1502
+ }
1503
+ }
1504
+ }
1505
+ return maxCount < 0 ? len : Math.min(maxCount, len);
1506
+ }
1507
+
1468
1508
  // src/components/VirtualBrain/MatrixBrain.ts
1509
+ var DEFAULT_EXTEND_BY = {
1510
+ start: 0,
1511
+ end: 0
1512
+ };
1513
+ var immediateCallback = (fn) => {
1514
+ fn();
1515
+ };
1469
1516
  var getRenderRangeCellCount = (range) => {
1470
1517
  const { start, end } = range;
1471
1518
  const [startRow, startCol] = start;
@@ -1490,6 +1537,8 @@ var MatrixBrain = class extends Logger {
1490
1537
  const logName = `MatrixBrain${name ? `:${name}` : ""}`;
1491
1538
  super(logName);
1492
1539
  this.scrolling = false;
1540
+ this.RENDER_COUNT_SAFETY_MARGIN_START = 1;
1541
+ this.RENDER_COUNT_SAFETY_MARGIN_END = 1;
1493
1542
  this.availableWidth = 0;
1494
1543
  this.availableRenderWidth = 0;
1495
1544
  this.isHorizontalLayoutBrain = false;
@@ -1506,14 +1555,8 @@ var MatrixBrain = class extends Logger {
1506
1555
  this.horizontalTotalSize = 0;
1507
1556
  this.horizontalRenderCount = void 0;
1508
1557
  this.verticalRenderCount = void 0;
1509
- this.horizontalExtendRangeBy = {
1510
- start: 0,
1511
- end: 0
1512
- };
1513
- this.verticalExtendRangeBy = {
1514
- start: 0,
1515
- end: 0
1516
- };
1558
+ this.horizontalExtendRangeBy = DEFAULT_EXTEND_BY;
1559
+ this.verticalExtendRangeBy = DEFAULT_EXTEND_BY;
1517
1560
  this.horizontalRenderRange = {
1518
1561
  startIndex: 0,
1519
1562
  endIndex: 0
@@ -1619,14 +1662,15 @@ var MatrixBrain = class extends Logger {
1619
1662
  });
1620
1663
  });
1621
1664
  };
1622
- this.notifyVerticalRenderRangeChange = () => {
1665
+ this.notifyVerticalRenderRangeChange = (immediate = false) => {
1623
1666
  if (this.destroyed) {
1624
1667
  return;
1625
1668
  }
1626
1669
  const fns = this.onVerticalRenderRangeChangeFns;
1627
1670
  const range = this.verticalRenderRange;
1671
+ const callback = immediate ? immediateCallback : raf2;
1628
1672
  fns.forEach((fn) => {
1629
- raf2(() => {
1673
+ callback(() => {
1630
1674
  if (this.destroyed) {
1631
1675
  return;
1632
1676
  }
@@ -1636,14 +1680,15 @@ var MatrixBrain = class extends Logger {
1636
1680
  });
1637
1681
  });
1638
1682
  };
1639
- this.notifyHorizontalRenderRangeChange = () => {
1683
+ this.notifyHorizontalRenderRangeChange = (immediate = false) => {
1640
1684
  if (this.destroyed) {
1641
1685
  return;
1642
1686
  }
1643
1687
  const fns = this.onHorizontalRenderRangeChangeFns;
1644
1688
  const range = this.horizontalRenderRange;
1689
+ const callback = immediate ? immediateCallback : raf2;
1645
1690
  fns.forEach((fn) => {
1646
- raf2(() => {
1691
+ callback(() => {
1647
1692
  if (this.destroyed) {
1648
1693
  return;
1649
1694
  }
@@ -1743,7 +1788,7 @@ var MatrixBrain = class extends Logger {
1743
1788
  return [];
1744
1789
  }
1745
1790
  const { scrollTop: scrollTop2 } = this.scrollPosition;
1746
- const { height } = this.getAvailableSize();
1791
+ const { height: height2 } = this.getAvailableSize();
1747
1792
  const offsets = [];
1748
1793
  const heights = [];
1749
1794
  let sum2 = 0;
@@ -1752,7 +1797,7 @@ var MatrixBrain = class extends Logger {
1752
1797
  heights.push(rowHeight);
1753
1798
  sum2 += rowHeight;
1754
1799
  }
1755
- const baseOffset = height - sum2 + (skipScroll ? 0 : scrollTop2);
1800
+ const baseOffset = height2 - sum2 + (skipScroll ? 0 : scrollTop2);
1756
1801
  sum2 = 0;
1757
1802
  let index = 0;
1758
1803
  for (let rowIndex = this.rows - this.fixedRowsEnd; rowIndex < this.rows; rowIndex++) {
@@ -1919,6 +1964,7 @@ var MatrixBrain = class extends Logger {
1919
1964
  };
1920
1965
  };
1921
1966
  this.computeDirectionalRenderRange = (direction) => {
1967
+ const itemSize = direction === "horizontal" ? this.colWidth : this.rowHeight;
1922
1968
  let renderCount = direction === "horizontal" ? this.horizontalRenderCount : this.verticalRenderCount;
1923
1969
  const count = direction === "horizontal" ? this.cols : this.rows;
1924
1970
  if (!renderCount) {
@@ -1930,14 +1976,21 @@ var MatrixBrain = class extends Logger {
1930
1976
  const fixedStartIndex = (direction === "horizontal" ? this.fixedColsStart : this.fixedRowsStart) || 0;
1931
1977
  let scrollPositionForDirection = direction === "horizontal" ? this.scrollPosition.scrollLeft : this.scrollPosition.scrollTop;
1932
1978
  scrollPositionForDirection += this.getFixedStartSize(direction);
1979
+ const isItemSizeConstant = typeof itemSize !== "function";
1933
1980
  const extendBy = direction === "horizontal" ? this.horizontalExtendRangeBy : this.verticalExtendRangeBy;
1934
1981
  let startIndex = this.getItemAt(scrollPositionForDirection, direction);
1935
- if (extendBy.start) {
1936
- startIndex = Math.max(0, startIndex - extendBy.start);
1937
- renderCount += extendBy.start;
1982
+ let extendByStart = extendBy.start || 0;
1983
+ let extendByEnd = extendBy.end || 0;
1984
+ if (!isItemSizeConstant) {
1985
+ extendByStart += this.RENDER_COUNT_SAFETY_MARGIN_START;
1986
+ extendByEnd += this.RENDER_COUNT_SAFETY_MARGIN_END;
1938
1987
  }
1939
- if (extendBy.end) {
1940
- renderCount += extendBy.end;
1988
+ if (extendByStart) {
1989
+ startIndex = Math.max(0, startIndex - extendByStart);
1990
+ renderCount += extendByStart;
1991
+ }
1992
+ if (extendByEnd) {
1993
+ renderCount += extendByEnd;
1941
1994
  }
1942
1995
  let endIndex = startIndex + renderCount;
1943
1996
  const theEnd = Math.max(
@@ -2492,14 +2545,15 @@ var MatrixBrain = class extends Logger {
2492
2545
  this.notifyScrollChange();
2493
2546
  }
2494
2547
  }
2495
- notifyRenderRangeChange() {
2548
+ notifyRenderRangeChange(immediate = false) {
2496
2549
  if (this.destroyed) {
2497
2550
  return;
2498
2551
  }
2499
2552
  const fns = this.onRenderRangeChangeFns;
2500
2553
  const range = this.getRenderRange();
2554
+ const callback = immediate ? immediateCallback : raf2;
2501
2555
  fns.forEach((fn) => {
2502
- raf2(() => {
2556
+ callback(() => {
2503
2557
  if (this.destroyed) {
2504
2558
  return;
2505
2559
  }
@@ -2531,16 +2585,7 @@ var MatrixBrain = class extends Logger {
2531
2585
  for (let i = 0; i < count; i++) {
2532
2586
  sizes.push(this.getItemSize(i, direction));
2533
2587
  }
2534
- sizes.sort(SORT_ASC);
2535
- let sum2 = 0;
2536
- for (let i = 0; i < count; i++) {
2537
- sum2 += sizes[i];
2538
- renderCount++;
2539
- if (sum2 > size) {
2540
- break;
2541
- }
2542
- }
2543
- renderCount += 1;
2588
+ renderCount = getGreatestCountVisibleInSize(size, sizes);
2544
2589
  } else {
2545
2590
  renderCount = (itemSize ? Math.ceil(size / itemSize) : 0) + 1;
2546
2591
  }
@@ -2661,8 +2706,8 @@ var MatrixBrain = class extends Logger {
2661
2706
  this.rowspanParent.clear();
2662
2707
  this.colspanParent.clear();
2663
2708
  this.alwaysRenderedColumns.clear();
2664
- this.horizontalExtendRangeBy = { start: 0, end: 0 };
2665
- this.verticalExtendRangeBy = { start: 0, end: 0 };
2709
+ this.horizontalExtendRangeBy = DEFAULT_EXTEND_BY;
2710
+ this.verticalExtendRangeBy = DEFAULT_EXTEND_BY;
2666
2711
  this.destroyed = true;
2667
2712
  this.onDestroyFns = [];
2668
2713
  this.onScrollFns = [];
@@ -4118,12 +4163,12 @@ var ReactHeadlessTableRenderer = class extends Logger {
4118
4163
  return;
4119
4164
  }
4120
4165
  const covered = false;
4121
- const height = this.brain.getRowHeight(rowIndex);
4166
+ const height2 = this.brain.getRowHeight(rowIndex);
4122
4167
  const rowFixed = this.brain.isRowFixedStart(rowIndex) ? "start" : this.brain.isRowFixedEnd(rowIndex) ? "end" : false;
4123
4168
  const hidden = !!covered;
4124
4169
  const renderedDetailNode = renderDetailRow({
4125
4170
  rowIndex,
4126
- height,
4171
+ height: height2,
4127
4172
  rowFixed,
4128
4173
  hidden,
4129
4174
  onMouseEnter: () => {
@@ -4164,11 +4209,11 @@ var ReactHeadlessTableRenderer = class extends Logger {
4164
4209
  return;
4165
4210
  }
4166
4211
  const covered = this.isCellCovered(rowIndex, colIndex);
4167
- const height = this.brain.getRowHeight(rowIndex);
4212
+ const height2 = this.brain.getRowHeight(rowIndex);
4168
4213
  const width = this.brain.getColWidth(colIndex);
4169
4214
  const rowspan = this.brain.getRowspan(rowIndex, colIndex);
4170
4215
  const colspan = this.brain.getColspan(rowIndex, colIndex);
4171
- const heightWithRowspan = rowspan === 1 ? height : this.brain.getRowHeightWithSpan(rowIndex, colIndex, rowspan);
4216
+ const heightWithRowspan = rowspan === 1 ? height2 : this.brain.getRowHeightWithSpan(rowIndex, colIndex, rowspan);
4172
4217
  const widthWithColspan = colspan === 1 ? width : this.brain.getColWidthWithSpan(rowIndex, colIndex, colspan);
4173
4218
  const { row: rowFixed, col: colFixed } = this.isCellFixed(
4174
4219
  rowIndex,
@@ -4179,7 +4224,7 @@ var ReactHeadlessTableRenderer = class extends Logger {
4179
4224
  const renderedNode = renderCell({
4180
4225
  rowIndex: renderRowIndex,
4181
4226
  colIndex: renderColIndex,
4182
- height,
4227
+ height: height2,
4183
4228
  width,
4184
4229
  rowspan,
4185
4230
  colspan,
@@ -4313,7 +4358,7 @@ function createRenderer(brain) {
4313
4358
 
4314
4359
  // src/components/HeadlessTable/RawTable.tsx
4315
4360
  function RawTableFn(props) {
4316
- const { brain, renderCell, renderDetailRow } = props;
4361
+ const { brain, renderCell, renderDetailRow, forceRerenderTimestamp } = props;
4317
4362
  const { renderer, onRenderUpdater } = useMemo2(() => {
4318
4363
  return props.onRenderUpdater && props.renderer ? {
4319
4364
  renderer: props.renderer,
@@ -4331,7 +4376,14 @@ function RawTableFn(props) {
4331
4376
  renderCell,
4332
4377
  renderDetailRow
4333
4378
  });
4334
- }, [renderer, brain, renderCell, renderDetailRow, onRenderUpdater]);
4379
+ }, [
4380
+ renderer,
4381
+ brain,
4382
+ renderCell,
4383
+ renderDetailRow,
4384
+ onRenderUpdater,
4385
+ forceRerenderTimestamp
4386
+ ]);
4335
4387
  useEffect4(() => {
4336
4388
  const remove = brain.onRenderRangeChange((renderRange) => {
4337
4389
  renderer.renderRange(renderRange, {
@@ -4480,10 +4532,10 @@ var createRuntimeFn = (config) => {
4480
4532
 
4481
4533
  // src/components/InfiniteTable/components/ActiveCellIndicator.css.ts
4482
4534
  var ActiveCellIndicatorRecipe = createRuntimeFn({ defaultClassName: "ActiveCellIndicator_ActiveCellIndicator__nxbq1c1 utilities_pointerEvents_none__16lm1iwl utilities_position_absolute__16lm1iw2", variantClassNames: { visible: { true: "ActiveCellIndicator_ActiveCellIndicatorRecipe_visible_true__nxbq1c3", false: "ActiveCellIndicator_ActiveCellIndicatorRecipe_visible_false__nxbq1c4" } }, defaultVariants: {}, compoundVariants: [] });
4483
- var ActiveIndicatorWrapperCls = "ActiveCellIndicator_ActiveIndicatorWrapperCls__nxbq1c0 utilities_pointerEvents_none__16lm1iwl utilities_position_sticky__16lm1iw4 utilities_left_0__16lm1iw1e utilities_top_0__16lm1iw1c utilities_height_0__16lm1iw18 utilities_zIndex_1000000__16lm1iwu";
4535
+ var ActiveIndicatorWrapperCls = "ActiveCellIndicator_ActiveIndicatorWrapperCls__nxbq1c0 utilities_pointerEvents_none__16lm1iwl utilities_position_sticky__16lm1iw4 utilities_left_0__16lm1iw1f utilities_top_0__16lm1iw1d utilities_height_0__16lm1iw18 utilities_zIndex_1000000__16lm1iwu";
4484
4536
 
4485
4537
  // src/components/InfiniteTable/components/ActiveRowIndicator.css.ts
4486
- var ActiveRowIndicatorRecipe = createRuntimeFn({ defaultClassName: "ActiveRowIndicator_ActiveRowIndicator__j26lrx0 utilities_pointerEvents_none__16lm1iwl utilities_position_absolute__16lm1iw2 utilities_top_0__16lm1iw1c utilities_left_0__16lm1iw1e", variantClassNames: { active: { true: "ActiveRowIndicator_ActiveRowIndicatorRecipe_active_true__j26lrx2", false: "ActiveRowIndicator_ActiveRowIndicatorRecipe_active_false__j26lrx3" } }, defaultVariants: {}, compoundVariants: [] });
4538
+ var ActiveRowIndicatorRecipe = createRuntimeFn({ defaultClassName: "ActiveRowIndicator_ActiveRowIndicator__j26lrx0 utilities_pointerEvents_none__16lm1iwl utilities_position_absolute__16lm1iw2 utilities_top_0__16lm1iw1d utilities_left_0__16lm1iw1f", variantClassNames: { active: { true: "ActiveRowIndicator_ActiveRowIndicatorRecipe_active_true__j26lrx2", false: "ActiveRowIndicator_ActiveRowIndicatorRecipe_active_false__j26lrx3" } }, defaultVariants: {}, compoundVariants: [] });
4487
4539
 
4488
4540
  // src/components/InfiniteTable/components/ActiveRowIndicator.tsx
4489
4541
  var { rootClassName: rootClassName3 } = internalProps;
@@ -4670,6 +4722,7 @@ function HeadlessTable(props) {
4670
4722
  activeCellIndex,
4671
4723
  onRenderUpdater,
4672
4724
  wrapRowsHorizontally,
4725
+ forceRerenderTimestamp,
4673
4726
  ...domProps
4674
4727
  } = props;
4675
4728
  const { autoFocus } = domProps;
@@ -4737,6 +4790,7 @@ function HeadlessTable(props) {
4737
4790
  /* @__PURE__ */ React13.createElement(
4738
4791
  RawTable,
4739
4792
  {
4793
+ forceRerenderTimestamp,
4740
4794
  renderer,
4741
4795
  onRenderUpdater,
4742
4796
  renderCell,
@@ -4950,7 +5004,7 @@ function buildManagedComponent(config) {
4950
5004
  });
4951
5005
  const propsToStateSetRef = useRef11(/* @__PURE__ */ new Set());
4952
5006
  const propsToForward = useMemo3(
4953
- () => config.forwardProps ? config.forwardProps(initialSetupState) : {},
5007
+ () => config.forwardProps ? config.forwardProps(initialSetupState, props) : {},
4954
5008
  [initialSetupState]
4955
5009
  );
4956
5010
  const parentState = useParentStateFn();
@@ -4998,7 +5052,7 @@ function buildManagedComponent(config) {
4998
5052
  const parentState2 = getParentState?.() ?? null;
4999
5053
  const mappedState = action.payload.mappedState;
5000
5054
  const updatedProps = action.payload.updatedPropsToState;
5001
- const newState = Object.assign({}, previousState);
5055
+ const newState = { ...previousState };
5002
5056
  if (mappedState) {
5003
5057
  Object.assign(newState, mappedState);
5004
5058
  }
@@ -5196,22 +5250,23 @@ var useInternalProps = () => {
5196
5250
  };
5197
5251
 
5198
5252
  // src/components/InfiniteTable/utilities.css.ts
5199
- var absoluteCover = "utilities_position_absolute__16lm1iw2 utilities_top_0__16lm1iw1c utilities_left_0__16lm1iw1e utilities_right_0__16lm1iw1j utilities_bottom_0__16lm1iw1h";
5200
- var alignItems = { center: "utilities_alignItems_center__16lm1iw1q", stretch: "utilities_alignItems_stretch__16lm1iw1r" };
5201
- var cssEllipsisClassName = "utilities_whiteSpace_nowrap__16lm1iw23 utilities_textOverflow_ellipsis__16lm1iw24 utilities_overflow_hidden__16lm1iw1x";
5253
+ var absoluteCover = "utilities_position_absolute__16lm1iw2 utilities_top_0__16lm1iw1d utilities_left_0__16lm1iw1f utilities_right_0__16lm1iw1k utilities_bottom_0__16lm1iw1i";
5254
+ var alignItems = { center: "utilities_alignItems_center__16lm1iw1r", stretch: "utilities_alignItems_stretch__16lm1iw1s" };
5255
+ var cssEllipsisClassName = "utilities_whiteSpace_nowrap__16lm1iw24 utilities_textOverflow_ellipsis__16lm1iw25 utilities_overflow_hidden__16lm1iw1y";
5202
5256
  var cursor = { pointer: "utilities_cursor_pointer__16lm1iwi", "default": "utilities_cursor_default__16lm1iwj", colResize: "utilities_cursor_colResize__16lm1iwk" };
5203
5257
  var display = { flex: "utilities_display_flex__16lm1iwz", contents: "utilities_display_contents__16lm1iw10", none: "utilities_display_none__16lm1iw11", block: "utilities_display_block__16lm1iw12", grid: "utilities_display_grid__16lm1iw13", inlineBlock: "utilities_display_inlineBlock__16lm1iw14", inlineFlex: "utilities_display_inlineFlex__16lm1iw15", inlineGrid: "utilities_display_inlineGrid__16lm1iw16" };
5204
5258
  var flex = { "1": "utilities_flex_1__16lm1iwm", none: "utilities_flex_none__16lm1iwn" };
5205
- var flexFlow = { column: "utilities_flexFlow_column__16lm1iw1m", columnReverse: "utilities_flexFlow_columnReverse__16lm1iw1n", row: "utilities_flexFlow_row__16lm1iw1o", rowReverse: "utilities_flexFlow_rowReverse__16lm1iw1p" };
5206
- var justifyContent = { center: "utilities_justifyContent_center__16lm1iw1s", spaceBetween: "utilities_justifyContent_spaceBetween__16lm1iw1t", spaceAround: "utilities_justifyContent_spaceAround__16lm1iw1u", start: "utilities_justifyContent_start__16lm1iw1v", end: "utilities_justifyContent_end__16lm1iw1w" };
5207
- var left = { "0": "utilities_left_0__16lm1iw1e", "100%": "utilities_left_100%__16lm1iw1f", auto: "utilities_left_auto__16lm1iw1g" };
5259
+ var flexFlow = { column: "utilities_flexFlow_column__16lm1iw1n", columnReverse: "utilities_flexFlow_columnReverse__16lm1iw1o", row: "utilities_flexFlow_row__16lm1iw1p", rowReverse: "utilities_flexFlow_rowReverse__16lm1iw1q" };
5260
+ var height = { "0": "utilities_height_0__16lm1iw18", "100%": "utilities_height_100%__16lm1iw19", "50%": "utilities_height_50%__16lm1iw1a" };
5261
+ var justifyContent = { center: "utilities_justifyContent_center__16lm1iw1t", spaceBetween: "utilities_justifyContent_spaceBetween__16lm1iw1u", spaceAround: "utilities_justifyContent_spaceAround__16lm1iw1v", start: "utilities_justifyContent_start__16lm1iw1w", end: "utilities_justifyContent_end__16lm1iw1x" };
5262
+ var left = { "0": "utilities_left_0__16lm1iw1f", "100%": "utilities_left_100%__16lm1iw1g", auto: "utilities_left_auto__16lm1iw1h" };
5208
5263
  var outline = { none: "utilities_outline_none__16lm1iwd" };
5209
- var overflow = { hidden: "utilities_overflow_hidden__16lm1iw1x", auto: "utilities_overflow_auto__16lm1iw1y", visible: "utilities_overflow_visible__16lm1iw1z" };
5264
+ var overflow = { hidden: "utilities_overflow_hidden__16lm1iw1y", auto: "utilities_overflow_auto__16lm1iw1z", visible: "utilities_overflow_visible__16lm1iw20" };
5210
5265
  var position = { relative: "utilities_position_relative__16lm1iw1", absolute: "utilities_position_absolute__16lm1iw2", "static": "utilities_position_static__16lm1iw3", sticky: "utilities_position_sticky__16lm1iw4", fixed: "utilities_position_fixed__16lm1iw5" };
5211
- var top = { "0": "utilities_top_0__16lm1iw1c", "100%": "utilities_top_100%__16lm1iw1d" };
5266
+ var top = { "0": "utilities_top_0__16lm1iw1d", "100%": "utilities_top_100%__16lm1iw1e" };
5212
5267
  var transformTranslateZero = "utilities_transformTranslateZero__16lm1iwe";
5213
5268
  var userSelect = { none: "utilities_userSelect_none__16lm1iw17" };
5214
- var visibility = { visible: "utilities_visibility_visible__16lm1iw20", hidden: "utilities_visibility_hidden__16lm1iw21" };
5269
+ var visibility = { visible: "utilities_visibility_visible__16lm1iw21", hidden: "utilities_visibility_hidden__16lm1iw22" };
5215
5270
  var zIndex = { "1": "utilities_zIndex_1__16lm1iwo", "10": "utilities_zIndex_10__16lm1iwp", "100": "utilities_zIndex_100__16lm1iwq", "1000": "utilities_zIndex_1000__16lm1iwr", "10000": "utilities_zIndex_10000__16lm1iws", "100000": "utilities_zIndex_100000__16lm1iwt", "1000000": "utilities_zIndex_1000000__16lm1iwu", "10000000": "utilities_zIndex_10000000__16lm1iwv", "1k": "utilities_zIndex_1k__16lm1iww", "10k": "utilities_zIndex_10k__16lm1iwx", "100k": "utilities_zIndex_100k__16lm1iwy" };
5216
5271
 
5217
5272
  // src/components/InfiniteTable/components/InfiniteTableFooter/InfiniteTableFooter.tsx
@@ -5358,29 +5413,29 @@ import * as React26 from "react";
5358
5413
  import { useEffect as useEffect10, useLayoutEffect as useLayoutEffect8, useState as useState5 } from "react";
5359
5414
 
5360
5415
  // src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts
5361
- var CellCls = "cell_CellCls__1eexc2a5 utilities_display_flex__16lm1iwz utilities_flexFlow_row__16lm1iw1o utilities_alignItems_center__16lm1iw1q utilities_position_absolute__16lm1iw2 utilities_willChange_transform__16lm1iw22 utilities_whiteSpace_nowrap__16lm1iw23 utilities_userSelect_none__16lm1iw17";
5362
- var HeaderCellContentRecipe = createRuntimeFn({ defaultClassName: "header_HeaderCellContentRecipe__12zfob126 utilities_height_100%__16lm1iw19 utilities_width_100%__16lm1iw1b utilities_display_flex__16lm1iwz utilities_flexFlow_row__16lm1iw1o utilities_alignItems_center__16lm1iw1q utilities_justifyContent_start__16lm1iw1v", variantClassNames: { filtered: { false: "header_HeaderCellContentRecipe_filtered_false__12zfob127", true: "header_HeaderCellContentRecipe_filtered_true__12zfob128" }, verticalAlign: { start: "header_HeaderCellContentRecipe_verticalAlign_start__12zfob129", end: "header_HeaderCellContentRecipe_verticalAlign_end__12zfob12a", center: "header_HeaderCellContentRecipe_verticalAlign_center__12zfob12b" }, align: { start: "header_HeaderCellContentRecipe_align_start__12zfob12c", end: "header_HeaderCellContentRecipe_align_end__12zfob12d", center: "header_HeaderCellContentRecipe_align_center__12zfob12e" } }, defaultVariants: {}, compoundVariants: [] });
5363
- var HeaderCellProxy = "header_HeaderCellProxy__12zfob1n utilities_whiteSpace_nowrap__16lm1iw23 utilities_textOverflow_ellipsis__16lm1iw24 utilities_overflow_hidden__16lm1iw1x";
5364
- var HeaderCellRecipe = createRuntimeFn({ defaultClassName: "header_HeaderCellRecipe__12zfob1o utilities_display_block__16lm1iw12", variantClassNames: { rowActive: { false: "header_HeaderCellRecipe_rowActive_false__12zfob1p", true: "header_HeaderCellRecipe_rowActive_true__12zfob1q" }, cellSelected: { false: "header_HeaderCellRecipe_cellSelected_false__12zfob1r", true: "header_HeaderCellRecipe_cellSelected_true__12zfob1s" }, rowSelected: { false: "header_HeaderCellRecipe_rowSelected_false__12zfob1t", true: "header_HeaderCellRecipe_rowSelected_true__12zfob1u", null: "header_HeaderCellRecipe_rowSelected_null__12zfob1v" }, rowDisabled: { false: "header_HeaderCellRecipe_rowDisabled_false__12zfob1w", true: "header_HeaderCellRecipe_rowDisabled_true__12zfob1x" }, firstRow: { false: "header_HeaderCellRecipe_firstRow_false__12zfob1y", true: "header_HeaderCellRecipe_firstRow_true__12zfob1z" }, firstRowInHorizontalLayoutPage: { false: "header_HeaderCellRecipe_firstRowInHorizontalLayoutPage_false__12zfob110", true: "header_HeaderCellRecipe_firstRowInHorizontalLayoutPage_true__12zfob111" }, groupRow: { false: "header_HeaderCellRecipe_groupRow_false__12zfob112", true: "header_HeaderCellRecipe_groupRow_true__12zfob113" }, groupCell: { false: "header_HeaderCellRecipe_groupCell_false__12zfob114", true: "header_HeaderCellRecipe_groupCell_true__12zfob115" }, align: { start: "header_HeaderCellRecipe_align_start__12zfob116", end: "header_HeaderCellRecipe_align_end__12zfob117", center: "header_HeaderCellRecipe_align_center__12zfob118" }, verticalAlign: { start: "header_HeaderCellRecipe_verticalAlign_start__12zfob119", end: "header_HeaderCellRecipe_verticalAlign_end__12zfob11a", center: "header_HeaderCellRecipe_verticalAlign_center__12zfob11b" }, zebra: { false: "header_HeaderCellRecipe_zebra_false__12zfob11c", even: "header_HeaderCellRecipe_zebra_even__12zfob11d", odd: "header_HeaderCellRecipe_zebra_odd__12zfob11e" }, dragging: { true: "header_HeaderCellRecipe_dragging_true__12zfob11f", false: "header_HeaderCellRecipe_dragging_false__12zfob11g" }, insideDisabledDraggingPage: { true: "header_HeaderCellRecipe_insideDisabledDraggingPage_true__12zfob11h", false: "header_HeaderCellRecipe_insideDisabledDraggingPage_false__12zfob11i" }, first: { true: "header_HeaderCellRecipe_first_true__12zfob11j", false: "header_HeaderCellRecipe_first_false__12zfob11k" }, last: { true: "header_HeaderCellRecipe_last_true__12zfob11l", false: "header_HeaderCellRecipe_last_false__12zfob11m" }, groupByField: { true: "header_HeaderCellRecipe_groupByField_true__12zfob11n", false: "header_HeaderCellRecipe_groupByField_false__12zfob11o" }, firstInCategory: { true: "header_HeaderCellRecipe_firstInCategory_true__12zfob11p", false: "header_HeaderCellRecipe_firstInCategory_false__12zfob11q" }, lastInCategory: { true: "header_HeaderCellRecipe_lastInCategory_true__12zfob11r", false: "header_HeaderCellRecipe_lastInCategory_false__12zfob11s" }, pinned: { start: "header_HeaderCellRecipe_pinned_start__12zfob11t", end: "header_HeaderCellRecipe_pinned_end__12zfob11u", false: "header_HeaderCellRecipe_pinned_false__12zfob11v" }, filtered: { true: "header_HeaderCellRecipe_filtered_true__12zfob11w", false: "header_HeaderCellRecipe_filtered_false__12zfob11x" } }, defaultVariants: {}, compoundVariants: [[{ pinned: "start", lastInCategory: true }, "header_HeaderCellRecipe_compound_0__12zfob11y"], [{ pinned: "end", firstInCategory: true }, "header_HeaderCellRecipe_compound_1__12zfob11z"], [{ pinned: false, lastInCategory: true }, "header_HeaderCellRecipe_compound_2__12zfob120"]] });
5416
+ var CellCls = "cell_CellCls__1eexc2a5 utilities_display_flex__16lm1iwz utilities_flexFlow_row__16lm1iw1p utilities_alignItems_center__16lm1iw1r utilities_position_absolute__16lm1iw2 utilities_willChange_transform__16lm1iw23 utilities_whiteSpace_nowrap__16lm1iw24 utilities_userSelect_none__16lm1iw17";
5417
+ var HeaderCellContentRecipe = createRuntimeFn({ defaultClassName: "header_HeaderCellContentRecipe__12zfob129 utilities_height_100%__16lm1iw19 utilities_width_100%__16lm1iw1c utilities_display_flex__16lm1iwz utilities_flexFlow_row__16lm1iw1p utilities_alignItems_center__16lm1iw1r utilities_justifyContent_start__16lm1iw1w", variantClassNames: { filtered: { false: "header_HeaderCellContentRecipe_filtered_false__12zfob12a", true: "header_HeaderCellContentRecipe_filtered_true__12zfob12b" }, verticalAlign: { start: "header_HeaderCellContentRecipe_verticalAlign_start__12zfob12c", end: "header_HeaderCellContentRecipe_verticalAlign_end__12zfob12d", center: "header_HeaderCellContentRecipe_verticalAlign_center__12zfob12e" }, align: { start: "header_HeaderCellContentRecipe_align_start__12zfob12f", end: "header_HeaderCellContentRecipe_align_end__12zfob12g", center: "header_HeaderCellContentRecipe_align_center__12zfob12h" } }, defaultVariants: {}, compoundVariants: [] });
5418
+ var HeaderCellProxy = "header_HeaderCellProxy__12zfob1n utilities_whiteSpace_nowrap__16lm1iw24 utilities_textOverflow_ellipsis__16lm1iw25 utilities_overflow_hidden__16lm1iw1y";
5419
+ var HeaderCellRecipe = createRuntimeFn({ defaultClassName: "header_HeaderCellRecipe__12zfob1o utilities_display_block__16lm1iw12", variantClassNames: { rowActive: { false: "header_HeaderCellRecipe_rowActive_false__12zfob1p", true: "header_HeaderCellRecipe_rowActive_true__12zfob1q" }, cellSelected: { false: "header_HeaderCellRecipe_cellSelected_false__12zfob1r", true: "header_HeaderCellRecipe_cellSelected_true__12zfob1s" }, rowSelected: { false: "header_HeaderCellRecipe_rowSelected_false__12zfob1t", true: "header_HeaderCellRecipe_rowSelected_true__12zfob1u", null: "header_HeaderCellRecipe_rowSelected_null__12zfob1v" }, rowDisabled: { false: "header_HeaderCellRecipe_rowDisabled_false__12zfob1w", true: "header_HeaderCellRecipe_rowDisabled_true__12zfob1x" }, firstRow: { false: "header_HeaderCellRecipe_firstRow_false__12zfob1y", true: "header_HeaderCellRecipe_firstRow_true__12zfob1z" }, treeNode: { parent: "header_HeaderCellRecipe_treeNode_parent__12zfob110", leaf: "header_HeaderCellRecipe_treeNode_leaf__12zfob111", false: "header_HeaderCellRecipe_treeNode_false__12zfob112" }, firstRowInHorizontalLayoutPage: { false: "header_HeaderCellRecipe_firstRowInHorizontalLayoutPage_false__12zfob113", true: "header_HeaderCellRecipe_firstRowInHorizontalLayoutPage_true__12zfob114" }, groupRow: { false: "header_HeaderCellRecipe_groupRow_false__12zfob115", true: "header_HeaderCellRecipe_groupRow_true__12zfob116" }, groupCell: { false: "header_HeaderCellRecipe_groupCell_false__12zfob117", true: "header_HeaderCellRecipe_groupCell_true__12zfob118" }, align: { start: "header_HeaderCellRecipe_align_start__12zfob119", end: "header_HeaderCellRecipe_align_end__12zfob11a", center: "header_HeaderCellRecipe_align_center__12zfob11b" }, verticalAlign: { start: "header_HeaderCellRecipe_verticalAlign_start__12zfob11c", end: "header_HeaderCellRecipe_verticalAlign_end__12zfob11d", center: "header_HeaderCellRecipe_verticalAlign_center__12zfob11e" }, zebra: { false: "header_HeaderCellRecipe_zebra_false__12zfob11f", even: "header_HeaderCellRecipe_zebra_even__12zfob11g", odd: "header_HeaderCellRecipe_zebra_odd__12zfob11h" }, dragging: { true: "header_HeaderCellRecipe_dragging_true__12zfob11i", false: "header_HeaderCellRecipe_dragging_false__12zfob11j" }, insideDisabledDraggingPage: { true: "header_HeaderCellRecipe_insideDisabledDraggingPage_true__12zfob11k", false: "header_HeaderCellRecipe_insideDisabledDraggingPage_false__12zfob11l" }, first: { true: "header_HeaderCellRecipe_first_true__12zfob11m", false: "header_HeaderCellRecipe_first_false__12zfob11n" }, last: { true: "header_HeaderCellRecipe_last_true__12zfob11o", false: "header_HeaderCellRecipe_last_false__12zfob11p" }, groupByField: { true: "header_HeaderCellRecipe_groupByField_true__12zfob11q", false: "header_HeaderCellRecipe_groupByField_false__12zfob11r" }, firstInCategory: { true: "header_HeaderCellRecipe_firstInCategory_true__12zfob11s", false: "header_HeaderCellRecipe_firstInCategory_false__12zfob11t" }, lastInCategory: { true: "header_HeaderCellRecipe_lastInCategory_true__12zfob11u", false: "header_HeaderCellRecipe_lastInCategory_false__12zfob11v" }, pinned: { start: "header_HeaderCellRecipe_pinned_start__12zfob11w", end: "header_HeaderCellRecipe_pinned_end__12zfob11x", false: "header_HeaderCellRecipe_pinned_false__12zfob11y" }, filtered: { true: "header_HeaderCellRecipe_filtered_true__12zfob11z", false: "header_HeaderCellRecipe_filtered_false__12zfob120" } }, defaultVariants: {}, compoundVariants: [[{ pinned: "start", lastInCategory: true }, "header_HeaderCellRecipe_compound_0__12zfob121"], [{ pinned: "end", firstInCategory: true }, "header_HeaderCellRecipe_compound_1__12zfob122"], [{ pinned: false, lastInCategory: true }, "header_HeaderCellRecipe_compound_2__12zfob123"]] });
5365
5420
  var HeaderClsRecipe = createRuntimeFn({ defaultClassName: "header_HeaderClsRecipe__12zfob19 utilities_display_block__16lm1iw12 utilities_position_absolute__16lm1iw2", variantClassNames: { pinned: { start: "header_HeaderClsRecipe_pinned_start__12zfob1a", end: "header_HeaderClsRecipe_pinned_end__12zfob1b", false: "header_HeaderClsRecipe_pinned_false__12zfob1c" }, firstInCategory: { true: "header_HeaderClsRecipe_firstInCategory_true__12zfob1d", false: "header_HeaderClsRecipe_firstInCategory_false__12zfob1e" }, lastInCategory: { true: "header_HeaderClsRecipe_lastInCategory_true__12zfob1f", false: "header_HeaderClsRecipe_lastInCategory_false__12zfob1g" }, overflow: { true: "header_HeaderClsRecipe_overflow_true__12zfob1h", false: "header_HeaderClsRecipe_overflow_false__12zfob1i" } }, defaultVariants: {}, compoundVariants: [[{ overflow: true, pinned: "start" }, "header_HeaderClsRecipe_compound_0__12zfob1j"], [{ pinned: "start", firstInCategory: true }, "header_HeaderClsRecipe_compound_1__12zfob1k"], [{ overflow: true, pinned: "end" }, "header_HeaderClsRecipe_compound_2__12zfob1l"], [{ pinned: "end", lastInCategory: true }, "header_HeaderClsRecipe_compound_3__12zfob1m"]] });
5366
- var HeaderFilterEditorCls = "header_HeaderFilterEditorCls__12zfob12o utilities_width_100%__16lm1iw1b utilities_height_100%__16lm1iw19";
5421
+ var HeaderFilterEditorCls = "header_HeaderFilterEditorCls__12zfob12r utilities_width_100%__16lm1iw1c utilities_height_100%__16lm1iw19";
5367
5422
  var HeaderFilterIconIndexCls = "header_HeaderFilterIconIndexCls__12zfob17";
5368
- var HeaderFilterOperatorCls = "header_HeaderFilterOperatorCls__12zfob12k utilities_display_flex__16lm1iwz utilities_flexFlow_row__16lm1iw1o utilities_alignItems_center__16lm1iw1q utilities_position_relative__16lm1iw1";
5369
- var HeaderFilterOperatorIconRecipe = createRuntimeFn({ defaultClassName: "header_HeaderFilterOperatorIconRecipe__12zfob12l utilities_position_relative__16lm1iw1 utilities_top_0__16lm1iw1c", variantClassNames: { disabled: { true: "header_HeaderFilterOperatorIconRecipe_disabled_true__12zfob12m", false: "header_HeaderFilterOperatorIconRecipe_disabled_false__12zfob12n" } }, defaultVariants: {}, compoundVariants: [] });
5370
- var HeaderFilterRecipe = createRuntimeFn({ defaultClassName: "header_HeaderFilterRecipe__12zfob12h utilities_display_flex__16lm1iwz utilities_flexFlow_row__16lm1iw1o utilities_alignItems_stretch__16lm1iw1r utilities_position_relative__16lm1iw1", variantClassNames: { active: { true: "header_HeaderFilterRecipe_active_true__12zfob12i", false: "header_HeaderFilterRecipe_active_false__12zfob12j" } }, defaultVariants: {}, compoundVariants: [] });
5371
- var HeaderGroupCls = "header_HeaderGroupCls__12zfob12g utilities_display_flex__16lm1iwz utilities_flexFlow_row__16lm1iw1o utilities_alignItems_center__16lm1iw1q";
5372
- var HeaderMenuIconCls = createRuntimeFn({ defaultClassName: "header_HeaderMenuIconCls__12zfob121 utilities_position_relative__16lm1iw1 utilities_display_flex__16lm1iwz utilities_flexFlow_column__16lm1iw1m utilities_justifyContent_spaceAround__16lm1iw1u utilities_visibility_hidden__16lm1iw21", variantClassNames: { menuVisible: { true: "header_HeaderMenuIconCls_menuVisible_true__12zfob122" }, reserveSpaceWhenHidden: { true: "header_HeaderMenuIconCls_reserveSpaceWhenHidden_true__12zfob123", false: "header_HeaderMenuIconCls_reserveSpaceWhenHidden_false__12zfob124" } }, defaultVariants: {}, compoundVariants: [[{ menuVisible: true, reserveSpaceWhenHidden: false }, "header_HeaderMenuIconCls_compound_0__12zfob125"]] });
5423
+ var HeaderFilterOperatorCls = "header_HeaderFilterOperatorCls__12zfob12n utilities_display_flex__16lm1iwz utilities_flexFlow_row__16lm1iw1p utilities_alignItems_center__16lm1iw1r utilities_position_relative__16lm1iw1";
5424
+ var HeaderFilterOperatorIconRecipe = createRuntimeFn({ defaultClassName: "header_HeaderFilterOperatorIconRecipe__12zfob12o utilities_position_relative__16lm1iw1 utilities_top_0__16lm1iw1d", variantClassNames: { disabled: { true: "header_HeaderFilterOperatorIconRecipe_disabled_true__12zfob12p", false: "header_HeaderFilterOperatorIconRecipe_disabled_false__12zfob12q" } }, defaultVariants: {}, compoundVariants: [] });
5425
+ var HeaderFilterRecipe = createRuntimeFn({ defaultClassName: "header_HeaderFilterRecipe__12zfob12k utilities_display_flex__16lm1iwz utilities_flexFlow_row__16lm1iw1p utilities_alignItems_stretch__16lm1iw1s utilities_position_relative__16lm1iw1", variantClassNames: { active: { true: "header_HeaderFilterRecipe_active_true__12zfob12l", false: "header_HeaderFilterRecipe_active_false__12zfob12m" } }, defaultVariants: {}, compoundVariants: [] });
5426
+ var HeaderGroupCls = "header_HeaderGroupCls__12zfob12j utilities_display_flex__16lm1iwz utilities_flexFlow_row__16lm1iw1p utilities_alignItems_center__16lm1iw1r";
5427
+ var HeaderMenuIconCls = createRuntimeFn({ defaultClassName: "header_HeaderMenuIconCls__12zfob124 utilities_position_relative__16lm1iw1 utilities_display_flex__16lm1iwz utilities_flexFlow_column__16lm1iw1n utilities_justifyContent_spaceAround__16lm1iw1v utilities_visibility_hidden__16lm1iw22", variantClassNames: { menuVisible: { true: "header_HeaderMenuIconCls_menuVisible_true__12zfob125" }, reserveSpaceWhenHidden: { true: "header_HeaderMenuIconCls_reserveSpaceWhenHidden_true__12zfob126", false: "header_HeaderMenuIconCls_reserveSpaceWhenHidden_false__12zfob127" } }, defaultVariants: {}, compoundVariants: [[{ menuVisible: true, reserveSpaceWhenHidden: false }, "header_HeaderMenuIconCls_compound_0__12zfob128"]] });
5373
5428
  var HeaderScrollbarPlaceholderCls = "header_HeaderScrollbarPlaceholderCls__12zfob18 utilities_position_absolute__16lm1iw2";
5374
5429
  var HeaderSortIconCls = "utilities_position_relative__16lm1iw1";
5375
5430
  var HeaderSortIconIndexCls = "header_HeaderSortIconIndexCls__12zfob16";
5376
5431
  var HeaderSortIconRecipe = createRuntimeFn({ defaultClassName: "header__12zfob12", variantClassNames: { align: { start: "header_HeaderSortIconRecipe_align_start__12zfob13", center: "header_HeaderSortIconRecipe_align_center__12zfob14", end: "header_HeaderSortIconRecipe_align_end__12zfob15" } }, defaultVariants: {}, compoundVariants: [] });
5377
- var HeaderWrapperCls = "header_HeaderWrapperCls__12zfob12f utilities_overflow_hidden__16lm1iw1x utilities_position_relative__16lm1iw1 utilities_display_flex__16lm1iwz utilities_flexFlow_row__16lm1iw1o";
5432
+ var HeaderWrapperCls = "header_HeaderWrapperCls__12zfob12i utilities_overflow_hidden__16lm1iw1y utilities_position_relative__16lm1iw1 utilities_display_flex__16lm1iwz utilities_flexFlow_row__16lm1iw1p";
5378
5433
 
5379
5434
  // src/components/InfiniteTable/components/icons/InfiniteTableIconClassName.ts
5380
5435
  var InfiniteTableIconClassName = "InfiniteTableIcon";
5381
5436
 
5382
5437
  // src/components/InfiniteTable/components/icons/FilterIcon.css.ts
5383
- var FilterIconCls = "FilterIcon_FilterIconCls__6aunoi0 utilities_display_flex__16lm1iwz utilities_flexFlow_column__16lm1iw1m utilities_position_relative__16lm1iw1 utilities_justifyContent_spaceAround__16lm1iw1u utilities_alignItems_center__16lm1iw1q";
5438
+ var FilterIconCls = "FilterIcon_FilterIconCls__6aunoi0 utilities_display_flex__16lm1iwz utilities_flexFlow_column__16lm1iw1n utilities_position_relative__16lm1iw1 utilities_justifyContent_spaceAround__16lm1iw1v utilities_alignItems_center__16lm1iw1r";
5384
5439
 
5385
5440
  // src/components/InfiniteTable/components/icons/FilterIcon.tsx
5386
5441
  var defaultLineStyle = {
@@ -6470,6 +6525,7 @@ function getColumnLabel(colIdOrCol, context) {
6470
6525
  horizontalLayoutPageIndex: null,
6471
6526
  column: col,
6472
6527
  columnApi,
6528
+ dataSourceApi,
6473
6529
  insideColumnMenu: true,
6474
6530
  dragging: false,
6475
6531
  columnsMap: computed.computedColumnsMap,
@@ -6567,8 +6623,7 @@ function InfiniteTableColumnHeaderFilterEmpty() {
6567
6623
  onPointerDown: stopPropagation,
6568
6624
  className: `${InfiniteTableColumnHeaderFilterClassName} ${HeaderFilterRecipe(
6569
6625
  { active: false }
6570
- )}`,
6571
- style: { height: "100%" }
6626
+ )} ${height["50%"]}`
6572
6627
  }
6573
6628
  );
6574
6629
  }
@@ -6822,6 +6877,7 @@ function useCellClassName(column, baseClasses, variants, extraFlags) {
6822
6877
  rowDisabled: extraFlags.rowDisabled,
6823
6878
  groupRow: extraFlags.groupRow,
6824
6879
  groupCell: extraFlags.groupCell,
6880
+ treeNode: extraFlags.treeNode,
6825
6881
  verticalAlign: extraFlags.verticalAlign,
6826
6882
  align: extraFlags.align,
6827
6883
  zebra: extraFlags.zebra
@@ -6860,6 +6916,13 @@ function useCellClassName(column, baseClasses, variants, extraFlags) {
6860
6916
  if (extraFlags.rowDisabled) {
6861
6917
  result.push(...baseClasses.map((c) => `${c}--disabled`));
6862
6918
  }
6919
+ if (extraFlags.treeNode) {
6920
+ result.push(
6921
+ ...baseClasses.map(
6922
+ (c) => `${c}--tree-node ${c}-tree-${extraFlags.treeNode}-node`
6923
+ )
6924
+ );
6925
+ }
6863
6926
  if (extraFlags.groupRow) {
6864
6927
  result.push(...baseClasses.map((c) => `${c}--group-row`));
6865
6928
  result.push(
@@ -6883,7 +6946,7 @@ import { useCallback as useCallback8, useState as useState7 } from "react";
6883
6946
 
6884
6947
  // src/components/InfiniteTable/InfiniteCls.css.ts
6885
6948
  var FooterCls = "utilities_position_relative__16lm1iw1";
6886
- var InfiniteCls = "InfiniteCls_InfiniteCls__1yeub2v0 utilities_position_relative__16lm1iw1 utilities_display_flex__16lm1iwz utilities_flexFlow_column__16lm1iw1m utilities_boxSizingBorderBox__16lm1iw0";
6949
+ var InfiniteCls = "InfiniteCls_InfiniteCls__1yeub2v0 utilities_position_relative__16lm1iw1 utilities_display_flex__16lm1iwz utilities_flexFlow_column__16lm1iw1n utilities_boxSizingBorderBox__16lm1iw0";
6887
6950
  var InfiniteClsHasPinnedEnd = "InfiniteCls_InfiniteClsHasPinnedEnd__1yeub2vs";
6888
6951
  var InfiniteClsHasPinnedStart = "InfiniteCls_InfiniteClsHasPinnedStart__1yeub2vr";
6889
6952
  var InfiniteClsRecipe = createRuntimeFn({ defaultClassName: "InfiniteCls__1yeub2v2", variantClassNames: { horizontalLayout: { true: "InfiniteCls_InfiniteClsRecipe_horizontalLayout_true__1yeub2v3", false: "InfiniteCls_InfiniteClsRecipe_horizontalLayout_false__1yeub2v4" }, focused: { true: "InfiniteCls_InfiniteClsRecipe_focused_true__1yeub2v5", false: "InfiniteCls_InfiniteClsRecipe_focused_false__1yeub2v6" }, focusedWithin: { true: "InfiniteCls_InfiniteClsRecipe_focusedWithin_true__1yeub2v7", false: "InfiniteCls_InfiniteClsRecipe_focusedWithin_false__1yeub2v8" }, hasPinnedStart: { true: "InfiniteCls_InfiniteClsRecipe_hasPinnedStart_true__1yeub2v9", false: "InfiniteCls_InfiniteClsRecipe_hasPinnedStart_false__1yeub2va" }, hasPinnedEnd: { true: "InfiniteCls_InfiniteClsRecipe_hasPinnedEnd_true__1yeub2vb", false: "InfiniteCls_InfiniteClsRecipe_hasPinnedEnd_false__1yeub2vc" }, hasPinnedStartOverflow: { true: "InfiniteCls_InfiniteClsRecipe_hasPinnedStartOverflow_true__1yeub2vd", false: "InfiniteCls_InfiniteClsRecipe_hasPinnedStartOverflow_false__1yeub2ve" }, hasPinnedEndOverflow: { true: "InfiniteCls_InfiniteClsRecipe_hasPinnedEndOverflow_true__1yeub2vf", false: "InfiniteCls_InfiniteClsRecipe_hasPinnedEndOverflow_false__1yeub2vg" } }, defaultVariants: {}, compoundVariants: [[{ focused: false, focusedWithin: false }, "InfiniteCls_InfiniteClsRecipe_compound_0__1yeub2vh"]] });
@@ -7719,7 +7782,8 @@ var useColumnPointerEvents = ({
7719
7782
  }, []);
7720
7783
  const onPointerDown = useCallback8(
7721
7784
  (e) => {
7722
- if (e.target?.tagName === "INPUT") {
7785
+ const tagName = e.target?.tagName;
7786
+ if (tagName === "INPUT" || tagName === "BUTTON") {
7723
7787
  return;
7724
7788
  }
7725
7789
  const { brain, draggableColumnsRestrictTo } = getState();
@@ -8028,6 +8092,7 @@ var LoadingIcon = (props) => {
8028
8092
  // src/components/InfiniteTable/components/InfiniteTableRow/row.css.ts
8029
8093
  var GroupRowExpanderCls = createRuntimeFn({ defaultClassName: "row__7pupv01", variantClassNames: { align: { start: "row_GroupRowExpanderCls_align_start__7pupv02", center: "row_GroupRowExpanderCls_align_center__7pupv03", end: "row_GroupRowExpanderCls_align_end__7pupv04" } }, defaultVariants: {}, compoundVariants: [] });
8030
8094
  var RowHoverCls = "row_RowHoverCls__7pupv00";
8095
+ var TreeColumnCellExpanderCls = createRuntimeFn({ defaultClassName: "row__7pupv05", variantClassNames: { align: { start: "row_TreeColumnCellExpanderCls_align_start__7pupv06", center: "row_TreeColumnCellExpanderCls_align_center__7pupv07", end: "row_TreeColumnCellExpanderCls_align_end__7pupv08" } }, defaultVariants: {}, compoundVariants: [] });
8031
8096
 
8032
8097
  // src/components/InfiniteTable/utils/getColumnForGroupBy.tsx
8033
8098
  function styleForGroupColumn({
@@ -8203,8 +8268,8 @@ function objectValuesExcept(obj, exceptList) {
8203
8268
  }
8204
8269
 
8205
8270
  // src/components/InfiniteTable/components/cell.css.ts
8206
- var ColumnCellCls = "cell_ColumnCellCls__1eexc2a6 cell_CellCls__1eexc2a5 utilities_display_flex__16lm1iwz utilities_flexFlow_row__16lm1iw1o utilities_alignItems_center__16lm1iw1q utilities_position_absolute__16lm1iw2 utilities_willChange_transform__16lm1iw22 utilities_whiteSpace_nowrap__16lm1iw23 utilities_userSelect_none__16lm1iw17";
8207
- var ColumnCellRecipe = createRuntimeFn({ defaultClassName: "cell_ColumnCellRecipe__1eexc2am", variantClassNames: { dragging: { false: "cell_ColumnCellRecipe_dragging_false__1eexc2an", true: "cell_ColumnCellRecipe_dragging_true__1eexc2ao" }, insideDisabledDraggingPage: { true: "cell_ColumnCellRecipe_insideDisabledDraggingPage_true__1eexc2ap", false: "cell_ColumnCellRecipe_insideDisabledDraggingPage_false__1eexc2aq" }, cellSelected: { false: "cell_ColumnCellRecipe_cellSelected_false__1eexc2ar", true: "cell_ColumnCellRecipe_cellSelected_true__1eexc2as" }, align: { start: "cell_ColumnCellRecipe_align_start__1eexc2at", end: "cell_ColumnCellRecipe_align_end__1eexc2au", center: "cell_ColumnCellRecipe_align_center__1eexc2av" }, verticalAlign: { start: "cell_ColumnCellRecipe_verticalAlign_start__1eexc2aw", end: "cell_ColumnCellRecipe_verticalAlign_end__1eexc2ax", center: "cell_ColumnCellRecipe_verticalAlign_center__1eexc2ay" }, rowActive: { false: "cell_ColumnCellRecipe_rowActive_false__1eexc2az", true: "cell_ColumnCellRecipe_rowActive_true__1eexc2a10" }, groupRow: { false: "cell_ColumnCellRecipe_groupRow_false__1eexc2a11", true: "cell_ColumnCellRecipe_groupRow_true__1eexc2a12" }, groupCell: { false: "cell_ColumnCellRecipe_groupCell_false__1eexc2a13", true: "cell_ColumnCellRecipe_groupCell_true__1eexc2a14" }, rowDisabled: { false: "cell_ColumnCellRecipe_rowDisabled_false__1eexc2a15", true: "cell_ColumnCellRecipe_rowDisabled_true__1eexc2a16" }, zebra: { false: "cell_ColumnCellRecipe_zebra_false__1eexc2a17", even: "cell_ColumnCellRecipe_zebra_even__1eexc2a18", odd: "cell_ColumnCellRecipe_zebra_odd__1eexc2a19" }, rowSelected: { true: "cell_ColumnCellRecipe_rowSelected_true__1eexc2a1a", false: "cell_ColumnCellRecipe_rowSelected_false__1eexc2a1b", null: "cell_ColumnCellRecipe_rowSelected_null__1eexc2a1c" }, first: { true: "cell_ColumnCellRecipe_first_true__1eexc2a1d", false: "cell_ColumnCellRecipe_first_false__1eexc2a1e" }, last: { true: "cell_ColumnCellRecipe_last_true__1eexc2a1f", false: "cell_ColumnCellRecipe_last_false__1eexc2a1g" }, groupByField: { true: "cell_ColumnCellRecipe_groupByField_true__1eexc2a1h", false: "cell_ColumnCellRecipe_groupByField_false__1eexc2a1i" }, firstInCategory: { true: "cell_ColumnCellRecipe_firstInCategory_true__1eexc2a1j", false: "cell_ColumnCellRecipe_firstInCategory_false__1eexc2a1k" }, firstRow: { true: "cell_ColumnCellRecipe_firstRow_true__1eexc2a1l", false: "cell_ColumnCellRecipe_firstRow_false__1eexc2a1m" }, firstRowInHorizontalLayoutPage: { true: "cell_ColumnCellRecipe_firstRowInHorizontalLayoutPage_true__1eexc2a1n", false: "cell_ColumnCellRecipe_firstRowInHorizontalLayoutPage_false__1eexc2a1o" }, lastInCategory: { true: "cell_ColumnCellRecipe_lastInCategory_true__1eexc2a1p", false: "cell_ColumnCellRecipe_lastInCategory_false__1eexc2a1q" }, pinned: { start: "cell_ColumnCellRecipe_pinned_start__1eexc2a1r", end: "cell_ColumnCellRecipe_pinned_end__1eexc2a1s", false: "cell_ColumnCellRecipe_pinned_false__1eexc2a1t" }, filtered: { true: "cell_ColumnCellRecipe_filtered_true__1eexc2a1u", false: "cell_ColumnCellRecipe_filtered_false__1eexc2a1v" } }, defaultVariants: {}, compoundVariants: [[{ firstRowInHorizontalLayoutPage: true, firstRow: false }, "cell_ColumnCellRecipe_compound_0__1eexc2a1w"], [{ pinned: "start", lastInCategory: true }, "cell_ColumnCellRecipe_compound_1__1eexc2a1x"], [{ pinned: "start", firstInCategory: true }, "cell_ColumnCellRecipe_compound_2__1eexc2a1y"], [{ pinned: "end", firstInCategory: true }, "cell_ColumnCellRecipe_compound_3__1eexc2a1z"], [{ pinned: "end", lastInCategory: true }, "cell_ColumnCellRecipe_compound_4__1eexc2a20"], [{ align: "center", groupCell: false }, "cell_ColumnCellRecipe_compound_5__1eexc2a21"], [{ rowDisabled: true, zebra: "odd" }, "cell_ColumnCellRecipe_compound_6__1eexc2a22"]] });
8271
+ var ColumnCellCls = "cell_ColumnCellCls__1eexc2a6 cell_CellCls__1eexc2a5 utilities_display_flex__16lm1iwz utilities_flexFlow_row__16lm1iw1p utilities_alignItems_center__16lm1iw1r utilities_position_absolute__16lm1iw2 utilities_willChange_transform__16lm1iw23 utilities_whiteSpace_nowrap__16lm1iw24 utilities_userSelect_none__16lm1iw17";
8272
+ var ColumnCellRecipe = createRuntimeFn({ defaultClassName: "cell_ColumnCellRecipe__1eexc2am", variantClassNames: { dragging: { false: "cell_ColumnCellRecipe_dragging_false__1eexc2an", true: "cell_ColumnCellRecipe_dragging_true__1eexc2ao" }, insideDisabledDraggingPage: { true: "cell_ColumnCellRecipe_insideDisabledDraggingPage_true__1eexc2ap", false: "cell_ColumnCellRecipe_insideDisabledDraggingPage_false__1eexc2aq" }, cellSelected: { false: "cell_ColumnCellRecipe_cellSelected_false__1eexc2ar", true: "cell_ColumnCellRecipe_cellSelected_true__1eexc2as" }, treeNode: { parent: "cell_ColumnCellRecipe_treeNode_parent__1eexc2at", leaf: "cell_ColumnCellRecipe_treeNode_leaf__1eexc2au", false: "cell_ColumnCellRecipe_treeNode_false__1eexc2av" }, align: { start: "cell_ColumnCellRecipe_align_start__1eexc2aw", end: "cell_ColumnCellRecipe_align_end__1eexc2ax", center: "cell_ColumnCellRecipe_align_center__1eexc2ay" }, verticalAlign: { start: "cell_ColumnCellRecipe_verticalAlign_start__1eexc2az", end: "cell_ColumnCellRecipe_verticalAlign_end__1eexc2a10", center: "cell_ColumnCellRecipe_verticalAlign_center__1eexc2a11" }, rowActive: { false: "cell_ColumnCellRecipe_rowActive_false__1eexc2a12", true: "cell_ColumnCellRecipe_rowActive_true__1eexc2a13" }, groupRow: { false: "cell_ColumnCellRecipe_groupRow_false__1eexc2a14", true: "cell_ColumnCellRecipe_groupRow_true__1eexc2a15" }, groupCell: { false: "cell_ColumnCellRecipe_groupCell_false__1eexc2a16", true: "cell_ColumnCellRecipe_groupCell_true__1eexc2a17" }, rowDisabled: { false: "cell_ColumnCellRecipe_rowDisabled_false__1eexc2a18", true: "cell_ColumnCellRecipe_rowDisabled_true__1eexc2a19" }, zebra: { false: "cell_ColumnCellRecipe_zebra_false__1eexc2a1a", even: "cell_ColumnCellRecipe_zebra_even__1eexc2a1b", odd: "cell_ColumnCellRecipe_zebra_odd__1eexc2a1c" }, rowSelected: { true: "cell_ColumnCellRecipe_rowSelected_true__1eexc2a1d", false: "cell_ColumnCellRecipe_rowSelected_false__1eexc2a1e", null: "cell_ColumnCellRecipe_rowSelected_null__1eexc2a1f" }, first: { true: "cell_ColumnCellRecipe_first_true__1eexc2a1g", false: "cell_ColumnCellRecipe_first_false__1eexc2a1h" }, last: { true: "cell_ColumnCellRecipe_last_true__1eexc2a1i", false: "cell_ColumnCellRecipe_last_false__1eexc2a1j" }, groupByField: { true: "cell_ColumnCellRecipe_groupByField_true__1eexc2a1k", false: "cell_ColumnCellRecipe_groupByField_false__1eexc2a1l" }, firstInCategory: { true: "cell_ColumnCellRecipe_firstInCategory_true__1eexc2a1m", false: "cell_ColumnCellRecipe_firstInCategory_false__1eexc2a1n" }, firstRow: { true: "cell_ColumnCellRecipe_firstRow_true__1eexc2a1o", false: "cell_ColumnCellRecipe_firstRow_false__1eexc2a1p" }, firstRowInHorizontalLayoutPage: { true: "cell_ColumnCellRecipe_firstRowInHorizontalLayoutPage_true__1eexc2a1q", false: "cell_ColumnCellRecipe_firstRowInHorizontalLayoutPage_false__1eexc2a1r" }, lastInCategory: { true: "cell_ColumnCellRecipe_lastInCategory_true__1eexc2a1s", false: "cell_ColumnCellRecipe_lastInCategory_false__1eexc2a1t" }, pinned: { start: "cell_ColumnCellRecipe_pinned_start__1eexc2a1u", end: "cell_ColumnCellRecipe_pinned_end__1eexc2a1v", false: "cell_ColumnCellRecipe_pinned_false__1eexc2a1w" }, filtered: { true: "cell_ColumnCellRecipe_filtered_true__1eexc2a1x", false: "cell_ColumnCellRecipe_filtered_false__1eexc2a1y" } }, defaultVariants: {}, compoundVariants: [[{ firstRowInHorizontalLayoutPage: true, firstRow: false }, "cell_ColumnCellRecipe_compound_0__1eexc2a1z"], [{ pinned: "start", lastInCategory: true }, "cell_ColumnCellRecipe_compound_1__1eexc2a20"], [{ pinned: "start", firstInCategory: true }, "cell_ColumnCellRecipe_compound_2__1eexc2a21"], [{ pinned: "end", firstInCategory: true }, "cell_ColumnCellRecipe_compound_3__1eexc2a22"], [{ pinned: "end", lastInCategory: true }, "cell_ColumnCellRecipe_compound_4__1eexc2a23"], [{ align: "center", groupCell: false }, "cell_ColumnCellRecipe_compound_5__1eexc2a24"], [{ rowDisabled: true, zebra: "odd" }, "cell_ColumnCellRecipe_compound_6__1eexc2a25"]] });
8208
8273
  var ColumnCellSelectionIndicatorRecipe = createRuntimeFn({ defaultClassName: "cell_ColumnCellSelectionIndicatorRecipe__1eexc2ad", variantClassNames: { right: { true: "cell_ColumnCellSelectionIndicatorRecipe_right_true__1eexc2ae", false: "cell_ColumnCellSelectionIndicatorRecipe_right_false__1eexc2af" }, left: { true: "cell_ColumnCellSelectionIndicatorRecipe_left_true__1eexc2ag", false: "cell_ColumnCellSelectionIndicatorRecipe_left_false__1eexc2ah" }, top: { true: "cell_ColumnCellSelectionIndicatorRecipe_top_true__1eexc2ai", false: "cell_ColumnCellSelectionIndicatorRecipe_top_false__1eexc2aj" }, bottom: { true: "cell_ColumnCellSelectionIndicatorRecipe_bottom_true__1eexc2ak", false: "cell_ColumnCellSelectionIndicatorRecipe_bottom_false__1eexc2al" } }, defaultVariants: {}, compoundVariants: [] });
8209
8274
  var FlashingColumnCellRecipe = createRuntimeFn({ defaultClassName: "cell_FlashingColumnCellRecipe__1eexc2a9", variantClassNames: { direction: { up: "cell_FlashingColumnCellRecipe_direction_up__1eexc2aa", down: "cell_FlashingColumnCellRecipe_direction_down__1eexc2ab", neutral: "cell_FlashingColumnCellRecipe_direction_neutral__1eexc2ac" } }, defaultVariants: {}, compoundVariants: [] });
8210
8275
  var SelectionCheckboxCls = "cell_SelectionCheckboxCls__1eexc2a7";
@@ -8303,7 +8368,7 @@ function getCellContext(context) {
8303
8368
  } = context;
8304
8369
  const { dataArray } = getDataSourceState();
8305
8370
  const rowInfo = dataArray[rowIndex];
8306
- const { isGroupRow } = rowInfo;
8371
+ const { isGroupRow, isTreeNode } = rowInfo;
8307
8372
  const column = getComputed().computedColumnsMap.get(columnId);
8308
8373
  const {
8309
8374
  activeRowIndex,
@@ -8328,7 +8393,9 @@ function getCellContext(context) {
8328
8393
  dataSourceApi,
8329
8394
  column,
8330
8395
  columnApi,
8396
+ isParentNode: false,
8331
8397
  isGroupRow: true,
8398
+ isTreeNode: false,
8332
8399
  rowDetailState: false,
8333
8400
  data: rowInfo.data,
8334
8401
  rowActive,
@@ -8336,11 +8403,45 @@ function getCellContext(context) {
8336
8403
  rowSelected: rowInfo.rowSelected,
8337
8404
  value,
8338
8405
  rawValue
8406
+ } : isTreeNode ? rowInfo.isParentNode ? {
8407
+ api,
8408
+ dataSourceApi,
8409
+ columnApi,
8410
+ column,
8411
+ nodeExpanded: rowInfo.nodeExpanded,
8412
+ isTreeNode: true,
8413
+ isGroupRow: false,
8414
+ isParentNode: true,
8415
+ rowDetailState,
8416
+ data: rowInfo.data,
8417
+ rowActive,
8418
+ rowInfo,
8419
+ rowSelected: rowInfo.rowSelected,
8420
+ value,
8421
+ rawValue
8422
+ } : {
8423
+ api,
8424
+ dataSourceApi,
8425
+ columnApi,
8426
+ column,
8427
+ nodeExpanded: false,
8428
+ isTreeNode: true,
8429
+ isGroupRow: false,
8430
+ isParentNode: false,
8431
+ rowDetailState,
8432
+ data: rowInfo.data,
8433
+ rowActive,
8434
+ rowInfo,
8435
+ rowSelected: rowInfo.rowSelected,
8436
+ value,
8437
+ rawValue
8339
8438
  } : {
8340
8439
  api,
8341
8440
  dataSourceApi,
8342
8441
  columnApi,
8343
8442
  column,
8443
+ isTreeNode: false,
8444
+ isParentNode: false,
8344
8445
  isGroupRow: false,
8345
8446
  rowDetailState,
8346
8447
  data: rowInfo.data,
@@ -8398,6 +8499,9 @@ function getColumnRenderingParams(options) {
8398
8499
  renderGroupIcon: column.renderGroupIcon || groupByColumnReference?.renderGroupIcon,
8399
8500
  renderSelectionCheckBox: column.renderSelectionCheckBox,
8400
8501
  renderRowDetailIcon: column.renderRowDetailIcon,
8502
+ renderTreeIcon: column.renderTreeIcon,
8503
+ renderTreeIconForParentNode: column.renderTreeIconForParentNode,
8504
+ renderTreeIconForLeafNode: column.renderTreeIconForLeafNode,
8401
8505
  renderValue: column.renderValue || groupByColumnReference?.renderValue,
8402
8506
  renderGroupValue: column.renderGroupValue || groupByColumnReference?.renderGroupValue,
8403
8507
  renderLeafValue: column.renderLeafValue || groupByColumnReference?.renderLeafValue
@@ -8434,7 +8538,12 @@ function getColumnRenderParam(options) {
8434
8538
  formattedValueContext
8435
8539
  } = options;
8436
8540
  const { value } = formattedValueContext;
8437
- const { api: imperativeApi, getDataSourceState, getState } = context;
8541
+ const {
8542
+ api: imperativeApi,
8543
+ getDataSourceState,
8544
+ getState,
8545
+ dataSourceApi
8546
+ } = context;
8438
8547
  const { editingCell } = getState();
8439
8548
  const { indexInAll: rowIndex } = rowInfo;
8440
8549
  const dataSourceState = getDataSourceState();
@@ -8462,10 +8571,28 @@ function getColumnRenderParam(options) {
8462
8571
  groupByColumn,
8463
8572
  selectionMode,
8464
8573
  api: imperativeApi,
8574
+ dataSourceApi,
8465
8575
  toggleCurrentRowDetails: () => imperativeApi.rowDetailApi.toggleRowDetail(rowInfo.id),
8466
8576
  toggleRowDetails: imperativeApi.rowDetailApi.toggleRowDetail,
8467
8577
  expandRowDetails: imperativeApi.rowDetailApi.expandRowDetail,
8468
8578
  collapseRowDetails: imperativeApi.rowDetailApi.collapseRowDetail,
8579
+ toggleCurrentTreeNode: () => {
8580
+ dataSourceApi.treeApi.toggleNode(
8581
+ rowInfo.nodePath
8582
+ );
8583
+ },
8584
+ toggleTreeNode: dataSourceApi.treeApi.toggleNode,
8585
+ expandTreeNode: dataSourceApi.treeApi.expandNode,
8586
+ collapseTreeNode: dataSourceApi.treeApi.collapseNode,
8587
+ selectTreeNode: dataSourceApi.treeApi.selectNode,
8588
+ deselectTreeNode: dataSourceApi.treeApi.deselectNode,
8589
+ toggleTreeNodeSelection: dataSourceApi.treeApi.toggleNodeSelection,
8590
+ toggleCurrentTreeNodeSelection: () => {
8591
+ if (!rowInfo.isTreeNode) {
8592
+ return;
8593
+ }
8594
+ dataSourceApi.treeApi.toggleNodeSelection(rowInfo.nodePath);
8595
+ },
8469
8596
  selectRow: imperativeApi.rowSelectionApi.selectRow,
8470
8597
  deselectRow: imperativeApi.rowSelectionApi.deselectRow,
8471
8598
  toggleRowSelection: imperativeApi.rowSelectionApi.toggleRowSelection,
@@ -8489,12 +8616,18 @@ function getColumnRenderParam(options) {
8489
8616
  groupIcon: null
8490
8617
  },
8491
8618
  selectCurrentRow: () => {
8619
+ if (rowInfo.isTreeNode) {
8620
+ return;
8621
+ }
8492
8622
  return imperativeApi.rowSelectionApi.selectRow(
8493
8623
  rowInfo.id,
8494
8624
  rowInfo.dataSourceHasGrouping ? rowInfo.groupKeys : void 0
8495
8625
  );
8496
8626
  },
8497
8627
  deselectCurrentRow: () => {
8628
+ if (rowInfo.isTreeNode) {
8629
+ return;
8630
+ }
8498
8631
  return imperativeApi.rowSelectionApi.deselectRow(
8499
8632
  rowInfo.id,
8500
8633
  rowInfo.dataSourceHasGrouping ? rowInfo.groupKeys : void 0
@@ -8509,7 +8642,7 @@ function getColumnRenderParam(options) {
8509
8642
  toggleGroupRow(rowInfo.groupKeys);
8510
8643
  },
8511
8644
  toggleCurrentRowSelection: () => {
8512
- if (rowInfo.isGroupRow) {
8645
+ if (rowInfo.isGroupRow || rowInfo.isTreeNode) {
8513
8646
  return;
8514
8647
  }
8515
8648
  return imperativeApi.rowSelectionApi.toggleRowSelection(rowInfo.id);
@@ -8554,7 +8687,9 @@ function getFormattedValueParamForCell(value, column, rowInfo, context, rowDetai
8554
8687
  const rowActive = rowIndex === activeRowIndex && keyboardNavigation === "row";
8555
8688
  return rowInfo.isGroupRow ? {
8556
8689
  rowInfo,
8557
- isGroupRow: rowInfo.isGroupRow,
8690
+ isGroupRow: true,
8691
+ isTreeNode: false,
8692
+ isParentNode: false,
8558
8693
  data: rowInfo.data,
8559
8694
  rowDetailState: false,
8560
8695
  rowSelected,
@@ -8562,9 +8697,37 @@ function getFormattedValueParamForCell(value, column, rowInfo, context, rowDetai
8562
8697
  value,
8563
8698
  rawValue: value,
8564
8699
  field: column.field
8700
+ } : rowInfo.isTreeNode ? rowInfo.isParentNode ? {
8701
+ rowInfo,
8702
+ isGroupRow: false,
8703
+ isTreeNode: true,
8704
+ isParentNode: true,
8705
+ nodeExpanded: rowInfo.nodeExpanded,
8706
+ data: rowInfo.data,
8707
+ rowDetailState,
8708
+ rowSelected,
8709
+ rowActive,
8710
+ value,
8711
+ rawValue: value,
8712
+ field: column.field
8713
+ } : {
8714
+ rowInfo,
8715
+ isGroupRow: false,
8716
+ isTreeNode: true,
8717
+ isParentNode: false,
8718
+ nodeExpanded: false,
8719
+ data: rowInfo.data,
8720
+ rowDetailState,
8721
+ rowSelected,
8722
+ rowActive,
8723
+ value,
8724
+ rawValue: value,
8725
+ field: column.field
8565
8726
  } : {
8566
8727
  rowInfo,
8567
- isGroupRow: rowInfo.isGroupRow,
8728
+ isGroupRow: false,
8729
+ isTreeNode: false,
8730
+ isParentNode: false,
8568
8731
  data: rowInfo.data,
8569
8732
  rowDetailState,
8570
8733
  rowSelected,
@@ -8708,6 +8871,13 @@ function InfiniteTableColumnEditor() {
8708
8871
  // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableColumnCell.tsx
8709
8872
  var { rootClassName: rootClassName6 } = internalProps;
8710
8873
  var columnZIndexAtIndex4 = stripVar(InternalVars.columnZIndexAtIndex);
8874
+ function styleForTreeColumn({
8875
+ rowInfo
8876
+ }) {
8877
+ return {
8878
+ [stripVar(ThemeVars.components.Row.groupNesting)]: rowInfo.isTreeNode ? rowInfo.isParentNode ? rowInfo.treeNesting : rowInfo.treeNesting + 1 : 0
8879
+ };
8880
+ }
8711
8881
  var InfiniteTableColumnCellContext = React36.createContext(null);
8712
8882
  var InfiniteTableColumnCellClassName = `${rootClassName6}ColumnCell`;
8713
8883
  var defaultRenderRowDetailIcon = (params) => {
@@ -8723,23 +8893,49 @@ var defaultRenderRowDetailIcon = (params) => {
8723
8893
  }
8724
8894
  );
8725
8895
  };
8896
+ var EXPANDER_STYLE = {
8897
+ display: "inline-block",
8898
+ visibility: "visible"
8899
+ };
8900
+ var defaultRenderTreeIcon = (params) => {
8901
+ const { toggleCurrentTreeNode, nodeExpanded } = params;
8902
+ return /* @__PURE__ */ React36.createElement(
8903
+ ExpanderIcon,
8904
+ {
8905
+ style: EXPANDER_STYLE,
8906
+ expanded: nodeExpanded,
8907
+ onChange: toggleCurrentTreeNode
8908
+ }
8909
+ );
8910
+ };
8726
8911
  var defaultRenderSelectionCheckBox = (params) => {
8727
8912
  const {
8728
8913
  rowInfo,
8729
8914
  selectCurrentRow,
8730
8915
  deselectCurrentRow,
8731
8916
  toggleCurrentGroupRowSelection,
8732
- column
8917
+ column,
8918
+ dataSourceApi,
8919
+ api
8733
8920
  } = params;
8734
8921
  if (rowInfo.isGroupRow && !column.groupByForColumn) {
8735
8922
  }
8923
+ const { components: components2 } = api.getState();
8924
+ const CheckBoxCmp = components2?.CheckBox || InfiniteCheckBox;
8736
8925
  return /* @__PURE__ */ React36.createElement(
8737
- InfiniteCheckBox,
8926
+ CheckBoxCmp,
8738
8927
  {
8739
8928
  domProps: {
8740
8929
  className: SelectionCheckboxCls
8741
8930
  },
8742
8931
  onChange: (selected) => {
8932
+ if (rowInfo.isTreeNode) {
8933
+ dataSourceApi.treeApi.setNodeSelection(
8934
+ rowInfo.nodePath,
8935
+ selected ?? false
8936
+ );
8937
+ return;
8938
+ }
8743
8939
  if (rowInfo.isGroupRow) {
8744
8940
  toggleCurrentGroupRowSelection();
8745
8941
  return;
@@ -8882,6 +9078,10 @@ function InfiniteTableColumnCellFn(props) {
8882
9078
  const cellSelected = renderParam.cellSelected;
8883
9079
  renderParam.domRef = domRef;
8884
9080
  renderParam.htmlElementRef = htmlElementRef;
9081
+ renderParam.toggleCurrentTreeNode = useCallback12(
9082
+ renderParam.toggleCurrentTreeNode,
9083
+ [rowInfo]
9084
+ );
8885
9085
  renderParam.selectCell = useCallback12(renderParam.selectCell, [rowInfo]);
8886
9086
  renderParam.deselectCell = useCallback12(renderParam.deselectCell, [rowInfo]);
8887
9087
  renderParam.selectCurrentRow = useCallback12(renderParam.selectCurrentRow, [
@@ -8902,6 +9102,10 @@ function InfiniteTableColumnCellFn(props) {
8902
9102
  renderParam.toggleCurrentGroupRowSelection,
8903
9103
  [rowInfo]
8904
9104
  );
9105
+ renderParam.toggleCurrentTreeNodeSelection = useCallback12(
9106
+ renderParam.toggleCurrentTreeNodeSelection,
9107
+ [rowInfo]
9108
+ );
8905
9109
  const EditorComponent = column.components?.Editor ?? InfiniteTableColumnEditor;
8906
9110
  const editor = inEdit ? /* @__PURE__ */ React36.createElement(CellEditorContextComponent, { contextValue: renderParam }, /* @__PURE__ */ React36.createElement(EditorComponent, null)) : null;
8907
9111
  const renderChildren = useCallback12(
@@ -8946,6 +9150,31 @@ function InfiniteTableColumnCellFn(props) {
8946
9150
  );
8947
9151
  }
8948
9152
  }
9153
+ if (rowInfo.isTreeNode) {
9154
+ const { isParentNode } = rowInfo;
9155
+ let fn = void 0;
9156
+ const renderForNodeOrLeaf = isParentNode ? renderFunctions.renderTreeIconForParentNode : renderFunctions.renderTreeIconForLeafNode;
9157
+ fn = renderForNodeOrLeaf || // for parents, fallback to the renderTreeIcon as well
9158
+ (isParentNode ? renderFunctions.renderTreeIcon : void 0);
9159
+ if (fn === true) {
9160
+ fn = defaultRenderTreeIcon;
9161
+ }
9162
+ if (!fn) {
9163
+ fn = void 0;
9164
+ }
9165
+ if (fn) {
9166
+ renderParam.renderBag.treeIcon = /* @__PURE__ */ React36.createElement(
9167
+ RenderCellHookComponent,
9168
+ {
9169
+ render: fn,
9170
+ renderParam: {
9171
+ ...renderParam,
9172
+ renderBag: { ...renderParam.renderBag }
9173
+ }
9174
+ }
9175
+ );
9176
+ }
9177
+ }
8949
9178
  if (renderFunctions.renderRowDetailIcon) {
8950
9179
  renderParam.renderBag.rowDetailsIcon = /* @__PURE__ */ React36.createElement(
8951
9180
  RenderCellHookComponent,
@@ -9013,7 +9242,7 @@ function InfiniteTableColumnCellFn(props) {
9013
9242
  if (valueToRender instanceof Date) {
9014
9243
  valueToRender = valueToRender.toLocaleDateString();
9015
9244
  }
9016
- const all = /* @__PURE__ */ React36.createElement(React36.Fragment, null, align2 !== "end" ? renderParam.renderBag.groupIcon : null, align2 !== "end" ? renderParam.renderBag.rowDetailsIcon : null, align2 !== "end" ? renderParam.renderBag.selectionCheckBox : null, valueToRender, align2 === "end" ? renderParam.renderBag.selectionCheckBox : null, align2 === "end" ? renderParam.renderBag.rowDetailsIcon : null, align2 === "end" ? renderParam.renderBag.groupIcon : null);
9245
+ const all = /* @__PURE__ */ React36.createElement(React36.Fragment, null, align2 !== "end" ? renderParam.renderBag.treeIcon : null, align2 !== "end" ? renderParam.renderBag.groupIcon : null, align2 !== "end" ? renderParam.renderBag.rowDetailsIcon : null, align2 !== "end" ? renderParam.renderBag.selectionCheckBox : null, valueToRender, align2 === "end" ? renderParam.renderBag.selectionCheckBox : null, align2 === "end" ? renderParam.renderBag.rowDetailsIcon : null, align2 === "end" ? renderParam.renderBag.groupIcon : null, align2 === "end" ? renderParam.renderBag.treeIcon : null);
9017
9246
  if (column.render) {
9018
9247
  return /* @__PURE__ */ React36.createElement(
9019
9248
  RenderCellHookComponent,
@@ -9043,6 +9272,8 @@ function InfiniteTableColumnCellFn(props) {
9043
9272
  toggleCurrentRowDetails: true,
9044
9273
  toggleCurrentRowSelection: true,
9045
9274
  toggleCurrentGroupRowSelection: true,
9275
+ toggleCurrentTreeNodeSelection: true,
9276
+ toggleCurrentTreeNode: true,
9046
9277
  rowHasSelectedCells: true
9047
9278
  })
9048
9279
  ]
@@ -9062,6 +9293,7 @@ function InfiniteTableColumnCellFn(props) {
9062
9293
  return rowInfo.hasSelectedCells(visibleColumnIds);
9063
9294
  }
9064
9295
  });
9296
+ const columnIsTree = rowInfo.isTreeNode && (column.renderTreeIcon || column.renderTreeIconForLeafNode || column.renderTreeIconForParentNode);
9065
9297
  const rowComputedClassName = typeof rowClassName === "function" ? rowClassName(rowPropsAndStyleArgs) : rowClassName;
9066
9298
  let colClassName = void 0;
9067
9299
  if (groupByColumnReference?.className) {
@@ -9082,10 +9314,21 @@ function InfiniteTableColumnCellFn(props) {
9082
9314
  applyColumnClassName(column.className, stylingParam)
9083
9315
  );
9084
9316
  }
9317
+ if (columnIsTree) {
9318
+ colClassName = join(
9319
+ colClassName,
9320
+ TreeColumnCellExpanderCls({
9321
+ align: align2
9322
+ })
9323
+ );
9324
+ }
9085
9325
  let style2;
9086
9326
  if (rowInfo.dataSourceHasGrouping && column.groupByForColumn) {
9087
9327
  style2 = styleForGroupColumn({ rowInfo });
9088
9328
  }
9329
+ if (columnIsTree) {
9330
+ style2 = styleForTreeColumn({ rowInfo });
9331
+ }
9089
9332
  if (rowStyle) {
9090
9333
  style2 = typeof rowStyle === "function" ? { ...style2, ...rowStyle(rowPropsAndStyleArgs) } : { ...style2, ...rowStyle };
9091
9334
  }
@@ -9169,6 +9412,7 @@ function InfiniteTableColumnCellFn(props) {
9169
9412
  rowActive,
9170
9413
  cellSelected,
9171
9414
  rowSelected,
9415
+ treeNode: rowInfo.isTreeNode ? rowInfo.isParentNode ? "parent" : "leaf" : false,
9172
9416
  firstRow: rowInfo.indexInAll === 0,
9173
9417
  firstRowInHorizontalLayoutPage: rowIndexInHorizontalLayoutPage === 0,
9174
9418
  groupRow: rowInfo.isGroupRow,
@@ -9320,7 +9564,7 @@ import * as React39 from "react";
9320
9564
  import { useEffect as useEffect14, useState as useState10 } from "react";
9321
9565
 
9322
9566
  // src/components/InfiniteTable/components/icons/SortIcon.css.ts
9323
- var SortIconCls = "SortIcon_SortIconCls__1ek6mqy0 utilities_display_flex__16lm1iwz utilities_flexFlow_column__16lm1iw1m utilities_position_relative__16lm1iw1 utilities_justifyContent_spaceAround__16lm1iw1u";
9567
+ var SortIconCls = "SortIcon_SortIconCls__1ek6mqy0 utilities_display_flex__16lm1iwz utilities_flexFlow_column__16lm1iw1n utilities_position_relative__16lm1iw1 utilities_justifyContent_spaceAround__16lm1iw1v";
9324
9568
 
9325
9569
  // src/components/InfiniteTable/components/icons/SortIcon.tsx
9326
9570
  var defaultLineStyle3 = {
@@ -9538,9 +9782,9 @@ function getColumnGroupResizer(colIndexes, config) {
9538
9782
  }
9539
9783
 
9540
9784
  // src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/ResizeHandle.css.ts
9541
- var ResizeHandleCls = "ResizeHandle_ResizeHandleCls__zneyzh0 utilities_position_absolute__16lm1iw2 utilities_top_0__16lm1iw1c utilities_right_0__16lm1iw1j utilities_bottom_0__16lm1iw1h utilities_cursor_colResize__16lm1iwk utilities_overflow_hidden__16lm1iw1x";
9542
- var ResizeHandleDraggerClsRecipe = createRuntimeFn({ defaultClassName: "ResizeHandle_ResizeHandleDraggerClsRecipe__zneyzhc utilities_position_absolute__16lm1iw2 utilities_top_0__16lm1iw1c utilities_bottom_0__16lm1iw1h", variantClassNames: { constrained: { false: "ResizeHandle_ResizeHandleDraggerClsRecipe_constrained_false__zneyzhd", true: "ResizeHandle_ResizeHandleDraggerClsRecipe_constrained_true__zneyzhe" }, computedPinned: { start: "ResizeHandle_ResizeHandleDraggerClsRecipe_computedPinned_start__zneyzhf", end: "ResizeHandle_ResizeHandleDraggerClsRecipe_computedPinned_end__zneyzhg", false: "ResizeHandle_ResizeHandleDraggerClsRecipe_computedPinned_false__zneyzhh" }, computedFirstInCategory: { true: "ResizeHandle_ResizeHandleDraggerClsRecipe_computedFirstInCategory_true__zneyzhi", false: "ResizeHandle_ResizeHandleDraggerClsRecipe_computedFirstInCategory_false__zneyzhj" }, computedLastInCategory: { true: "ResizeHandle_ResizeHandleDraggerClsRecipe_computedLastInCategory_true__zneyzhk", false: "ResizeHandle_ResizeHandleDraggerClsRecipe_computedLastInCategory_false__zneyzhl" } }, defaultVariants: {}, compoundVariants: [[{ computedPinned: "start", computedLastInCategory: true }, "ResizeHandle_ResizeHandleDraggerClsRecipe_compound_0__zneyzhm"], [{ computedPinned: "end", computedFirstInCategory: true }, "ResizeHandle_ResizeHandleDraggerClsRecipe_compound_1__zneyzhn"]] });
9543
- var ResizeHandleRecipeCls = createRuntimeFn({ defaultClassName: "ResizeHandle__zneyzh1", variantClassNames: { computedPinned: { start: "ResizeHandle_ResizeHandleRecipeCls_computedPinned_start__zneyzh2", end: "ResizeHandle_ResizeHandleRecipeCls_computedPinned_end__zneyzh3 utilities_left_0__16lm1iw1e utilities_right_auto__16lm1iw1l", false: "ResizeHandle_ResizeHandleRecipeCls_computedPinned_false__zneyzh4" }, computedFirstInCategory: { true: "ResizeHandle_ResizeHandleRecipeCls_computedFirstInCategory_true__zneyzh5", false: "ResizeHandle_ResizeHandleRecipeCls_computedFirstInCategory_false__zneyzh6" }, computedLastInCategory: { true: "ResizeHandle_ResizeHandleRecipeCls_computedLastInCategory_true__zneyzh7", false: "ResizeHandle_ResizeHandleRecipeCls_computedLastInCategory_false__zneyzh8" } }, defaultVariants: {}, compoundVariants: [[{ computedPinned: "end", computedLastInCategory: false, computedFirstInCategory: true }, "ResizeHandle_ResizeHandleRecipeCls_compound_0__zneyzh9"], [{ computedPinned: false, computedFirstInCategory: false, computedLastInCategory: true }, "ResizeHandle_ResizeHandleRecipeCls_compound_1__zneyzha"], [{ computedPinned: "start", computedFirstInCategory: false, computedLastInCategory: true }, "ResizeHandle_ResizeHandleRecipeCls_compound_2__zneyzhb"]] });
9785
+ var ResizeHandleCls = "ResizeHandle_ResizeHandleCls__zneyzh0 utilities_position_absolute__16lm1iw2 utilities_top_0__16lm1iw1d utilities_right_0__16lm1iw1k utilities_bottom_0__16lm1iw1i utilities_cursor_colResize__16lm1iwk utilities_overflow_hidden__16lm1iw1y";
9786
+ var ResizeHandleDraggerClsRecipe = createRuntimeFn({ defaultClassName: "ResizeHandle_ResizeHandleDraggerClsRecipe__zneyzhc utilities_position_absolute__16lm1iw2 utilities_top_0__16lm1iw1d utilities_bottom_0__16lm1iw1i", variantClassNames: { constrained: { false: "ResizeHandle_ResizeHandleDraggerClsRecipe_constrained_false__zneyzhd", true: "ResizeHandle_ResizeHandleDraggerClsRecipe_constrained_true__zneyzhe" }, computedPinned: { start: "ResizeHandle_ResizeHandleDraggerClsRecipe_computedPinned_start__zneyzhf", end: "ResizeHandle_ResizeHandleDraggerClsRecipe_computedPinned_end__zneyzhg", false: "ResizeHandle_ResizeHandleDraggerClsRecipe_computedPinned_false__zneyzhh" }, computedFirstInCategory: { true: "ResizeHandle_ResizeHandleDraggerClsRecipe_computedFirstInCategory_true__zneyzhi", false: "ResizeHandle_ResizeHandleDraggerClsRecipe_computedFirstInCategory_false__zneyzhj" }, computedLastInCategory: { true: "ResizeHandle_ResizeHandleDraggerClsRecipe_computedLastInCategory_true__zneyzhk", false: "ResizeHandle_ResizeHandleDraggerClsRecipe_computedLastInCategory_false__zneyzhl" } }, defaultVariants: {}, compoundVariants: [[{ computedPinned: "start", computedLastInCategory: true }, "ResizeHandle_ResizeHandleDraggerClsRecipe_compound_0__zneyzhm"], [{ computedPinned: "end", computedFirstInCategory: true }, "ResizeHandle_ResizeHandleDraggerClsRecipe_compound_1__zneyzhn"]] });
9787
+ var ResizeHandleRecipeCls = createRuntimeFn({ defaultClassName: "ResizeHandle__zneyzh1", variantClassNames: { computedPinned: { start: "ResizeHandle_ResizeHandleRecipeCls_computedPinned_start__zneyzh2", end: "ResizeHandle_ResizeHandleRecipeCls_computedPinned_end__zneyzh3 utilities_left_0__16lm1iw1f utilities_right_auto__16lm1iw1m", false: "ResizeHandle_ResizeHandleRecipeCls_computedPinned_false__zneyzh4" }, computedFirstInCategory: { true: "ResizeHandle_ResizeHandleRecipeCls_computedFirstInCategory_true__zneyzh5", false: "ResizeHandle_ResizeHandleRecipeCls_computedFirstInCategory_false__zneyzh6" }, computedLastInCategory: { true: "ResizeHandle_ResizeHandleRecipeCls_computedLastInCategory_true__zneyzh7", false: "ResizeHandle_ResizeHandleRecipeCls_computedLastInCategory_false__zneyzh8" } }, defaultVariants: {}, compoundVariants: [[{ computedPinned: "end", computedLastInCategory: false, computedFirstInCategory: true }, "ResizeHandle_ResizeHandleRecipeCls_compound_0__zneyzh9"], [{ computedPinned: false, computedFirstInCategory: false, computedLastInCategory: true }, "ResizeHandle_ResizeHandleRecipeCls_compound_1__zneyzha"], [{ computedPinned: "start", computedFirstInCategory: false, computedLastInCategory: true }, "ResizeHandle_ResizeHandleRecipeCls_compound_2__zneyzhb"]] });
9544
9788
 
9545
9789
  // src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/index.tsx
9546
9790
  var { rootClassName: rootClassName7 } = internalProps;
@@ -9742,18 +9986,29 @@ function useColumnResizeHandle(column, opts) {
9742
9986
 
9743
9987
  // src/components/InfiniteTable/components/InfiniteTableHeader/headerClassName.ts
9744
9988
  var InfiniteTableHeaderCellClassName = `${rootClassName2}HeaderCell`;
9989
+ var InfiniteTableHeaderWrapperClassName = `${rootClassName2}HeaderWrapper`;
9745
9990
 
9746
9991
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
9747
9992
  var defaultRenderSelectionCheckBox2 = (params) => {
9748
- const { allRowsSelected, someRowsSelected, api } = params;
9993
+ const { allRowsSelected, someRowsSelected, api, dataSourceApi } = params;
9749
9994
  const selected = allRowsSelected ? true : someRowsSelected ? null : false;
9995
+ const { components: components2, isTree } = api.getState();
9996
+ const CheckBoxCmp = components2?.CheckBox || InfiniteCheckBox;
9750
9997
  return /* @__PURE__ */ React42.createElement(
9751
- InfiniteCheckBox,
9998
+ CheckBoxCmp,
9752
9999
  {
9753
10000
  domProps: {
9754
10001
  className: SelectionCheckboxCls
9755
10002
  },
9756
10003
  onChange: (selected2) => {
10004
+ if (isTree) {
10005
+ if (selected2) {
10006
+ dataSourceApi.treeApi.selectAll();
10007
+ } else {
10008
+ dataSourceApi.treeApi.deselectAll();
10009
+ }
10010
+ return;
10011
+ }
9757
10012
  if (selected2) {
9758
10013
  api.rowSelectionApi.selectAll();
9759
10014
  } else {
@@ -9803,7 +10058,7 @@ function InfiniteTableHeaderCell(props) {
9803
10058
  const horizontalLayoutPageIndex = props.horizontalLayoutPageIndex;
9804
10059
  const dragging = columnReorderDragColumnId === column.id;
9805
10060
  const insideDisabledDraggingPage = columnReorderInPageIndex != null ? horizontalLayoutPageIndex !== columnReorderInPageIndex : false;
9806
- const { onResize, height, width, headerOptions, columnsMap } = props;
10061
+ const { onResize, height: height2, width, headerOptions, columnsMap } = props;
9807
10062
  const sortInfo = column.computedSortInfo;
9808
10063
  const header = column.header;
9809
10064
  const ref = useCallback14(
@@ -9866,10 +10121,12 @@ function InfiniteTableHeaderCell(props) {
9866
10121
  };
9867
10122
  const MenuIconCmp = column.components?.MenuIcon || components2?.MenuIcon || MenuIcon;
9868
10123
  const menuIcon = /* @__PURE__ */ React42.createElement(MenuIconCmp, { ...menuIconProps });
10124
+ const domRef = useRef16(null);
9869
10125
  const initialRenderParam = {
9870
10126
  horizontalLayoutPageIndex,
9871
10127
  dragging,
9872
10128
  domRef: ref,
10129
+ htmlElementRef: domRef,
9873
10130
  insideColumnMenu: false,
9874
10131
  column,
9875
10132
  columnsMap,
@@ -9880,6 +10137,7 @@ function InfiniteTableHeaderCell(props) {
9880
10137
  allRowsSelected,
9881
10138
  selectionMode,
9882
10139
  api,
10140
+ dataSourceApi,
9883
10141
  columnApi,
9884
10142
  renderBag: {
9885
10143
  sortIcon,
@@ -10010,7 +10268,6 @@ function InfiniteTableHeaderCell(props) {
10010
10268
  }
10011
10269
  return all;
10012
10270
  };
10013
- const domRef = useRef16(null);
10014
10271
  useEffect15(() => {
10015
10272
  let clearOnResize = null;
10016
10273
  const node = domRef.current;
@@ -10023,7 +10280,7 @@ function InfiniteTableHeaderCell(props) {
10023
10280
  }, [domRef.current, props.onResize]);
10024
10281
  let style2 = {
10025
10282
  // height: column.computedFiltered? height*2: height,
10026
- height
10283
+ height: height2
10027
10284
  };
10028
10285
  if (column.headerStyle) {
10029
10286
  style2 = typeof column.headerStyle === "function" ? { ...style2, ...column.headerStyle(renderParam) || {} } : { ...style2, ...column.headerStyle };
@@ -10043,7 +10300,7 @@ function InfiniteTableHeaderCell(props) {
10043
10300
  className: `${InfiniteTableHeaderCellClassName}Proxy ${HeaderCellProxy}`,
10044
10301
  style: {
10045
10302
  position: "absolute",
10046
- height,
10303
+ height: height2,
10047
10304
  width,
10048
10305
  left: proxyPosition.left ?? 0,
10049
10306
  top: proxyPosition.top ?? 0,
@@ -10088,6 +10345,22 @@ function InfiniteTableHeaderCell(props) {
10088
10345
  "data-sort": column.computedSortedAsc ? "asc" : column.computedSortedDesc ? "desc" : "none",
10089
10346
  "data-sort-index": `${column.computedSortIndex ?? -1}`
10090
10347
  };
10348
+ const columnFilterEditor = column.computedFilterable ? /* @__PURE__ */ React42.createElement(
10349
+ InfiniteTableColumnHeaderFilter,
10350
+ {
10351
+ horizontalLayoutPageIndex,
10352
+ filterEditor: FilterEditor,
10353
+ filterOperatorSwitch: FilterOperatorSwitch ?? InfiniteTableFilterOperatorSwitch,
10354
+ operator,
10355
+ filterTypes,
10356
+ onChange: debouncedOnFilterValueChange,
10357
+ columnFilterType: filterTypeKey,
10358
+ columnLabel: column.field || column.name || column.id,
10359
+ columnFilterValue: column.computedFilterValue,
10360
+ columnHeaderHeight
10361
+ }
10362
+ ) : /* @__PURE__ */ React42.createElement(InfiniteTableColumnHeaderFilterEmpty, null);
10363
+ renderParam.renderBag.filterEditor = columnFilterEditor;
10091
10364
  return /* @__PURE__ */ React42.createElement(ContextProvider, { value: renderParam }, /* @__PURE__ */ React42.createElement(
10092
10365
  InfiniteTableCell,
10093
10366
  {
@@ -10104,7 +10377,7 @@ function InfiniteTableHeaderCell(props) {
10104
10377
  HeaderCellContentRecipe(contentRecipeVariants),
10105
10378
  justifyContent[align2]
10106
10379
  ),
10107
- contentStyle: showColumnFilters ? { height: height / 2 } : void 0,
10380
+ contentStyle: showColumnFilters ? { height: height2 / 2 } : void 0,
10108
10381
  className: join(
10109
10382
  InfiniteTableHeaderCellClassName,
10110
10383
  userSelect.none,
@@ -10126,6 +10399,7 @@ function InfiniteTableHeaderCell(props) {
10126
10399
  rowActive: false,
10127
10400
  firstRow: true,
10128
10401
  firstRowInHorizontalLayoutPage: true,
10402
+ treeNode: false,
10129
10403
  groupCell: false,
10130
10404
  groupRow: false,
10131
10405
  rowExpanded: false
@@ -10134,21 +10408,7 @@ function InfiniteTableHeaderCell(props) {
10134
10408
  CellCls
10135
10409
  ),
10136
10410
  cssEllipsis: headerCSSEllipsis,
10137
- afterChildren: /* @__PURE__ */ React42.createElement(React42.Fragment, null, showColumnFilters ? column.computedFilterable ? /* @__PURE__ */ React42.createElement(
10138
- InfiniteTableColumnHeaderFilter,
10139
- {
10140
- horizontalLayoutPageIndex,
10141
- filterEditor: FilterEditor,
10142
- filterOperatorSwitch: FilterOperatorSwitch ?? InfiniteTableFilterOperatorSwitch,
10143
- operator,
10144
- filterTypes,
10145
- onChange: debouncedOnFilterValueChange,
10146
- columnFilterType: filterTypeKey,
10147
- columnLabel: column.field || column.name || column.id,
10148
- columnFilterValue: column.computedFilterValue,
10149
- columnHeaderHeight
10150
- }
10151
- ) : /* @__PURE__ */ React42.createElement(InfiniteTableColumnHeaderFilterEmpty, null) : null, resizeHandle),
10411
+ afterChildren: /* @__PURE__ */ React42.createElement(React42.Fragment, null, showColumnFilters ? columnFilterEditor : null, resizeHandle),
10152
10412
  renderChildren
10153
10413
  }
10154
10414
  ), draggingProxy);
@@ -10458,7 +10718,7 @@ var TableHeaderGroupClassName = `${rootClassName2}HeaderGroup`;
10458
10718
  var columnWidthAtIndex4 = stripVar(InternalVars.columnWidthAtIndex);
10459
10719
  var columnZIndexAtIndex6 = stripVar(InternalVars.columnZIndexAtIndex);
10460
10720
  function InfiniteTableHeaderGroup(props) {
10461
- const { columnGroup, height, columns, bodyBrain, columnGroupsMaxDepth } = props;
10721
+ const { columnGroup, height: height2, columns, bodyBrain, columnGroupsMaxDepth } = props;
10462
10722
  let { header, style: userStyle } = columnGroup;
10463
10723
  if (header instanceof Function) {
10464
10724
  header = header({
@@ -10468,7 +10728,7 @@ function InfiniteTableHeaderGroup(props) {
10468
10728
  }
10469
10729
  const handle = useColumnGroupResizeHandle(columns, {
10470
10730
  bodyBrain,
10471
- groupHeight: height,
10731
+ groupHeight: height2,
10472
10732
  columnGroup,
10473
10733
  columnGroupsMaxDepth
10474
10734
  });
@@ -10483,7 +10743,7 @@ function InfiniteTableHeaderGroup(props) {
10483
10743
  }) : userStyle;
10484
10744
  style2 = style2 && typeof style2 === "object" ? style2 : {};
10485
10745
  style2.width = width;
10486
- style2.height = height;
10746
+ style2.height = height2;
10487
10747
  return /* @__PURE__ */ React45.createElement(
10488
10748
  "div",
10489
10749
  {
@@ -10559,7 +10819,7 @@ function InfiniteTableHeaderFn(props) {
10559
10819
  rowIndex,
10560
10820
  colIndex,
10561
10821
  domRef: domRef2,
10562
- height,
10822
+ height: height2,
10563
10823
  widthWithColspan,
10564
10824
  heightWithRowspan,
10565
10825
  hidden
@@ -10591,7 +10851,7 @@ function InfiniteTableHeaderFn(props) {
10591
10851
  domRef: domRef2,
10592
10852
  columns: columns2,
10593
10853
  width: widthWithColspan,
10594
- height,
10854
+ height: height2,
10595
10855
  columnGroup: computedColumnGroup
10596
10856
  }
10597
10857
  ) : null;
@@ -10656,7 +10916,7 @@ function TableHeaderWrapper(props) {
10656
10916
  }
10657
10917
  } = tableContextValue;
10658
10918
  const rows = !computedColumnGroups || !Object.keys(computedColumnGroups).length ? 1 : columnGroupsMaxDepth + 2;
10659
- const height = rows * columnHeaderHeight + (showColumnFilters ? columnHeaderHeight : 0);
10919
+ const height2 = rows * columnHeaderHeight + (showColumnFilters ? columnHeaderHeight : 0);
10660
10920
  const columnAndGroupTreeInfo = React47.useMemo(() => {
10661
10921
  if (!computedColumnGroups || !Object.keys(computedColumnGroups).length) {
10662
10922
  return void 0;
@@ -10727,7 +10987,7 @@ function TableHeaderWrapper(props) {
10727
10987
  rowHeight,
10728
10988
  rows,
10729
10989
  cols: computedVisibleColumns.length,
10730
- height,
10990
+ height: height2,
10731
10991
  rowspan,
10732
10992
  colspan
10733
10993
  },
@@ -10742,7 +11002,7 @@ function TableHeaderWrapper(props) {
10742
11002
  columns: computedVisibleColumns,
10743
11003
  headerBrain,
10744
11004
  bodyBrain,
10745
- columnHeaderHeight: height,
11005
+ columnHeaderHeight: height2,
10746
11006
  columnGroupsMaxDepth,
10747
11007
  columnAndGroupTreeInfo
10748
11008
  }
@@ -10760,9 +11020,9 @@ function TableHeaderWrapper(props) {
10760
11020
  return /* @__PURE__ */ React47.createElement(
10761
11021
  "div",
10762
11022
  {
10763
- className: HeaderWrapperCls,
11023
+ className: `${InfiniteTableHeaderWrapperClassName} ${HeaderWrapperCls}`,
10764
11024
  style: {
10765
- height
11025
+ height: height2
10766
11026
  }
10767
11027
  },
10768
11028
  header,
@@ -10877,8 +11137,8 @@ var InfiniteTableLicenseFooter = React48.forwardRef(
10877
11137
  import * as React49 from "react";
10878
11138
 
10879
11139
  // src/components/InfiniteTable/components/LoadMask.css.ts
10880
- var LoadMaskCls = { visible: "LoadMask_LoadMaskCls_visible__qy58ya1 LoadMask_LoadMaskBaseCls__qy58ya0 utilities_position_absolute__16lm1iw2 utilities_top_0__16lm1iw1c utilities_left_0__16lm1iw1e utilities_right_0__16lm1iw1j utilities_bottom_0__16lm1iw1h", hidden: "LoadMask_LoadMaskCls_hidden__qy58ya2 LoadMask_LoadMaskBaseCls__qy58ya0 utilities_position_absolute__16lm1iw2 utilities_top_0__16lm1iw1c utilities_left_0__16lm1iw1e utilities_right_0__16lm1iw1j utilities_bottom_0__16lm1iw1h" };
10881
- var LoadMaskOverlayCls = "LoadMask_LoadMaskOverlayCls__qy58ya3 utilities_position_absolute__16lm1iw2 utilities_top_0__16lm1iw1c utilities_left_0__16lm1iw1e utilities_right_0__16lm1iw1j utilities_bottom_0__16lm1iw1h";
11140
+ var LoadMaskCls = { visible: "LoadMask_LoadMaskCls_visible__qy58ya1 LoadMask_LoadMaskBaseCls__qy58ya0 utilities_position_absolute__16lm1iw2 utilities_top_0__16lm1iw1d utilities_left_0__16lm1iw1f utilities_right_0__16lm1iw1k utilities_bottom_0__16lm1iw1i", hidden: "LoadMask_LoadMaskCls_hidden__qy58ya2 LoadMask_LoadMaskBaseCls__qy58ya0 utilities_position_absolute__16lm1iw2 utilities_top_0__16lm1iw1d utilities_left_0__16lm1iw1f utilities_right_0__16lm1iw1k utilities_bottom_0__16lm1iw1i" };
11141
+ var LoadMaskOverlayCls = "LoadMask_LoadMaskOverlayCls__qy58ya3 utilities_position_absolute__16lm1iw2 utilities_top_0__16lm1iw1d utilities_left_0__16lm1iw1f utilities_right_0__16lm1iw1k utilities_bottom_0__16lm1iw1i";
10882
11142
  var LoadMaskTextCls = "LoadMask_LoadMaskTextCls__qy58ya4";
10883
11143
 
10884
11144
  // src/components/InfiniteTable/components/LoadMask.tsx
@@ -11045,7 +11305,8 @@ function lazyGroup(groupParams, rootData) {
11045
11305
  }
11046
11306
  const res = indexer.indexArray(dataArray, {
11047
11307
  toPrimaryKey,
11048
- cache
11308
+ cache,
11309
+ nodesKey: void 0
11049
11310
  });
11050
11311
  dataArray = res;
11051
11312
  }
@@ -11058,7 +11319,9 @@ function lazyGroup(groupParams, rootData) {
11058
11319
  reducerResults: {},
11059
11320
  cache: false,
11060
11321
  childrenLoading: false,
11061
- childrenAvailable: false
11322
+ childrenAvailable: false,
11323
+ isTree: false,
11324
+ isGroupBy: true
11062
11325
  };
11063
11326
  deepMap.set(
11064
11327
  [
@@ -11082,7 +11345,9 @@ function lazyGroup(groupParams, rootData) {
11082
11345
  childrenAvailable: false,
11083
11346
  commonData: dataObject,
11084
11347
  totalChildrenCount: dataArray[i].totalChildrenCount,
11085
- reducerResults: dataArray[i].aggregations || {}
11348
+ reducerResults: dataArray[i].aggregations || {},
11349
+ isTree: false,
11350
+ isGroupBy: true
11086
11351
  };
11087
11352
  deepMap.set(currentGroupKeys, deepMapGroupValue);
11088
11353
  if (pivot) {
@@ -11172,6 +11437,111 @@ function processGroup(deepMap, currentGroupKeys, currentPivotKeys, item, itemInd
11172
11437
  currentPivotKeys.length = 0;
11173
11438
  }
11174
11439
  }
11440
+ function processTreeNode(treeParams, deepMap, treePaths, parentPath, item, itemIndex, reducers, initialReducerValue) {
11441
+ const { isLeafNode, getNodeChildren, toKey } = treeParams;
11442
+ const id = toKey(item);
11443
+ const nodePath = [...parentPath, id];
11444
+ const isLeaf = isLeafNode(item);
11445
+ treePaths.set(nodePath, true);
11446
+ if (isLeaf) {
11447
+ for (let i = 0, len = parentPath.length; i <= len; i++) {
11448
+ const currentPath = parentPath.slice(0, i);
11449
+ const currentTreeValue = deepMap.get(currentPath);
11450
+ const { reducerResults: reducerResults2, items: currentLeafItems } = currentTreeValue;
11451
+ currentLeafItems.push(item);
11452
+ currentTreeValue.leavesAvailableCount++;
11453
+ currentTreeValue.totalLeafNodesCount++;
11454
+ if (reducers) {
11455
+ computeReducersFor(
11456
+ item,
11457
+ itemIndex,
11458
+ reducers,
11459
+ reducerResults2,
11460
+ currentPath
11461
+ );
11462
+ }
11463
+ }
11464
+ return;
11465
+ }
11466
+ const reducerResults = deepClone(initialReducerValue);
11467
+ const items = [];
11468
+ deepMap.set(nodePath, {
11469
+ items,
11470
+ isTree: true,
11471
+ isGroupBy: false,
11472
+ node: item,
11473
+ reducerResults,
11474
+ cache: false,
11475
+ childrenLoading: false,
11476
+ childrenAvailable: true,
11477
+ totalLeafNodesCount: 0,
11478
+ leavesAvailableCount: 0,
11479
+ treeNesting: parentPath.length
11480
+ });
11481
+ const children = getNodeChildren(item);
11482
+ if (!children || !Array.isArray(children)) {
11483
+ return;
11484
+ }
11485
+ for (let i = 0, len = children.length; i < len; i++) {
11486
+ const child = children[i];
11487
+ processTreeNode(
11488
+ treeParams,
11489
+ deepMap,
11490
+ treePaths,
11491
+ nodePath,
11492
+ child,
11493
+ i,
11494
+ reducers,
11495
+ initialReducerValue
11496
+ );
11497
+ }
11498
+ if (reducers) {
11499
+ completeReducers(reducers, reducerResults, items);
11500
+ }
11501
+ }
11502
+ function tree(treeParams, data) {
11503
+ const { reducers } = treeParams;
11504
+ const initialReducerValue = initReducers(reducers);
11505
+ const globalReducerResults = deepClone(initialReducerValue);
11506
+ const deepMap = new DeepMap();
11507
+ const treePaths = new DeepMap();
11508
+ deepMap.set([], {
11509
+ items: [],
11510
+ isTree: true,
11511
+ isGroupBy: false,
11512
+ reducerResults: globalReducerResults,
11513
+ cache: false,
11514
+ childrenLoading: false,
11515
+ childrenAvailable: true,
11516
+ totalLeafNodesCount: 0,
11517
+ leavesAvailableCount: 0,
11518
+ node: null,
11519
+ treeNesting: -1
11520
+ });
11521
+ for (let i = 0, len = data.length; i < len; i++) {
11522
+ processTreeNode(
11523
+ treeParams,
11524
+ deepMap,
11525
+ treePaths,
11526
+ [],
11527
+ data[i],
11528
+ i,
11529
+ reducers,
11530
+ initialReducerValue
11531
+ );
11532
+ }
11533
+ if (reducers) {
11534
+ completeReducers(reducers, globalReducerResults, data);
11535
+ }
11536
+ const result = {
11537
+ deepMap,
11538
+ treeParams,
11539
+ treePaths,
11540
+ initialData: data,
11541
+ reducerResults: globalReducerResults
11542
+ };
11543
+ return result;
11544
+ }
11175
11545
  function group(groupParams, data) {
11176
11546
  const {
11177
11547
  groupBy,
@@ -11189,6 +11559,8 @@ function group(groupParams, data) {
11189
11559
  if (!groupByLength) {
11190
11560
  const deepMapGroupValue = {
11191
11561
  items: [],
11562
+ isTree: false,
11563
+ isGroupBy: true,
11192
11564
  cache: false,
11193
11565
  childrenLoading: false,
11194
11566
  childrenAvailable: false,
@@ -11224,6 +11596,8 @@ function group(groupParams, data) {
11224
11596
  if (!deepMap.has(currentGroupKeys)) {
11225
11597
  const deepMapGroupValue = {
11226
11598
  items: [],
11599
+ isTree: false,
11600
+ isGroupBy: true,
11227
11601
  cache: false,
11228
11602
  commonData: { ...commonData },
11229
11603
  childrenLoading: false,
@@ -11292,8 +11666,6 @@ function group(groupParams, data) {
11292
11666
  next?.();
11293
11667
  }
11294
11668
  );
11295
- }
11296
- if (reducers) {
11297
11669
  completeReducers(reducers, globalReducerResults, data);
11298
11670
  }
11299
11671
  const result = {
@@ -11370,6 +11742,7 @@ function getEnhancedGroupData(options, deepMapValue) {
11370
11742
  groupCount: groupItems.length,
11371
11743
  groupData: groupItems,
11372
11744
  groupKeys,
11745
+ isTreeNode: false,
11373
11746
  rowSelected: false,
11374
11747
  selectedChildredCount: 0,
11375
11748
  deselectedChildredCount: 0,
@@ -11407,6 +11780,14 @@ function getEnhancedGroupData(options, deepMapValue) {
11407
11780
  };
11408
11781
  return enhancedGroupData;
11409
11782
  }
11783
+ function toDuplicateRow(parent, indexInAll, currentPage) {
11784
+ return {
11785
+ ...parent,
11786
+ id: `duplicate_row_on_page_${currentPage}_for__${parent.id}`,
11787
+ indexInAll,
11788
+ duplicateOf: parent.id
11789
+ };
11790
+ }
11410
11791
  function completeReducers(reducers, reducerResults, items) {
11411
11792
  if (reducers) {
11412
11793
  for (const key in reducers)
@@ -11419,10 +11800,186 @@ function completeReducers(reducers, reducerResults, items) {
11419
11800
  }
11420
11801
  return reducerResults;
11421
11802
  }
11803
+ function flattenTreeNodes(dataArray, parentPath, parents, indexInParentNodes, params, result) {
11804
+ const treeNesting = parentPath.length;
11805
+ const { isLeafNode, getNodeChildren } = params.treeParams;
11806
+ const {
11807
+ toPrimaryKey,
11808
+ treeResult,
11809
+ isRowDisabled,
11810
+ isNodeSelected,
11811
+ withRowInfo,
11812
+ isNodeExpanded,
11813
+ treeSelectionState,
11814
+ repeatWrappedGroupRows,
11815
+ rowsPerPage
11816
+ } = params;
11817
+ const { deepMap } = treeResult;
11818
+ const len = dataArray.length;
11819
+ const currentParent = parents[parents.length - 1];
11820
+ const parentExpanded = currentParent ? currentParent.nodeExpanded : true;
11821
+ for (let i = 0; i < len; i++) {
11822
+ const item = dataArray[i];
11823
+ const key = toPrimaryKey(item, i);
11824
+ const nodePath = [...parentPath, key];
11825
+ const isLeaf = isLeafNode(item);
11826
+ if (isLeaf) {
11827
+ const rowInfo2 = {
11828
+ id: key,
11829
+ nodePath,
11830
+ isGroupRow: false,
11831
+ data: item,
11832
+ treeNesting,
11833
+ totalLeafNodesCount: 0,
11834
+ collapsedLeafNodesCount: 0,
11835
+ isTreeNode: true,
11836
+ isParentNode: false,
11837
+ selfLoaded: true,
11838
+ rowSelected: false,
11839
+ rowDisabled: false,
11840
+ isCellSelected: returnFalse,
11841
+ hasSelectedCells: returnFalse,
11842
+ dataSourceHasGrouping: false,
11843
+ parentNodes: Array.from(parents),
11844
+ indexInParentNodes: [...indexInParentNodes, i],
11845
+ indexInParent: i,
11846
+ indexInAll: parentExpanded ? result.length : -1
11847
+ };
11848
+ if (isNodeSelected) {
11849
+ rowInfo2.rowSelected = isNodeSelected(rowInfo2);
11850
+ }
11851
+ if (isRowDisabled) {
11852
+ rowInfo2.rowDisabled = isRowDisabled(rowInfo2);
11853
+ }
11854
+ if (withRowInfo) {
11855
+ withRowInfo(rowInfo2);
11856
+ }
11857
+ const currentPage = repeatWrappedGroupRows && rowsPerPage != null && rowsPerPage > 0 && rowInfo2.indexInAll % rowsPerPage === 0 ? rowInfo2.indexInAll / rowsPerPage : null;
11858
+ for (let j = 0, len2 = parents.length; j < len2; j++) {
11859
+ const parent = parents[j];
11860
+ if (!parentExpanded) {
11861
+ parent.collapsedLeafNodesCount += 1;
11862
+ }
11863
+ parent.deepRowInfoArray.push(rowInfo2);
11864
+ if (currentPage != null && parentExpanded) {
11865
+ if (typeof repeatWrappedGroupRows === "function" && repeatWrappedGroupRows(parent) !== true) {
11866
+ continue;
11867
+ }
11868
+ const duplicateRowInfo = toDuplicateRow(
11869
+ parent,
11870
+ rowInfo2.indexInAll,
11871
+ currentPage
11872
+ );
11873
+ result[duplicateRowInfo.indexInAll] = duplicateRowInfo;
11874
+ rowInfo2.indexInAll++;
11875
+ }
11876
+ }
11877
+ if (parentExpanded) {
11878
+ result[rowInfo2.indexInAll] = rowInfo2;
11879
+ }
11880
+ continue;
11881
+ }
11882
+ const deepMapValue = deepMap.get(nodePath);
11883
+ const totalLeafNodesCount = deepMapValue?.totalLeafNodesCount ?? 0;
11884
+ const rowInfo = {
11885
+ dataSourceHasGrouping: false,
11886
+ nodeExpanded: false,
11887
+ selfExpanded: false,
11888
+ nodePath,
11889
+ id: key,
11890
+ data: item,
11891
+ indexInAll: result.length,
11892
+ indexInParent: i,
11893
+ indexInParentNodes: [...indexInParentNodes, i],
11894
+ totalLeafNodesCount,
11895
+ treeNesting,
11896
+ selfLoaded: true,
11897
+ isParentNode: true,
11898
+ isTreeNode: true,
11899
+ isGroupRow: false,
11900
+ deepRowInfoArray: [],
11901
+ parentNodes: Array.from(parents),
11902
+ collapsedLeafNodesCount: 0,
11903
+ rowSelected: false,
11904
+ rowDisabled: false,
11905
+ isCellSelected: returnFalse,
11906
+ hasSelectedCells: returnFalse,
11907
+ selectedLeafNodesCount: 0,
11908
+ deselectedLeafNodesCount: 0
11909
+ // selectedLeafNodesCount: 0,
11910
+ // deselectedLeafNodesCount: 0,
11911
+ };
11912
+ if (isNodeSelected) {
11913
+ rowInfo.rowSelected = isNodeSelected(rowInfo);
11914
+ if (treeSelectionState) {
11915
+ const selectionCount = treeSelectionState.getSelectionCountFor(
11916
+ rowInfo.nodePath
11917
+ );
11918
+ rowInfo.selectedLeafNodesCount = selectionCount.selectedCount;
11919
+ rowInfo.deselectedLeafNodesCount = selectionCount.deselectedCount;
11920
+ }
11921
+ }
11922
+ if (isRowDisabled) {
11923
+ rowInfo.rowDisabled = isRowDisabled(rowInfo);
11924
+ }
11925
+ if (withRowInfo) {
11926
+ withRowInfo(rowInfo);
11927
+ }
11928
+ let expanded = true;
11929
+ if (isNodeExpanded) {
11930
+ rowInfo.selfExpanded = expanded = isNodeExpanded(rowInfo);
11931
+ }
11932
+ if (!parentExpanded) {
11933
+ expanded = false;
11934
+ }
11935
+ rowInfo.nodeExpanded = expanded;
11936
+ if (expanded && parentExpanded && repeatWrappedGroupRows && rowsPerPage != null && rowsPerPage > 0) {
11937
+ const indexInAll = rowInfo.indexInAll;
11938
+ const currentParents = rowInfo.parentNodes;
11939
+ if (currentParents.length > 0 && indexInAll % rowsPerPage === 0) {
11940
+ const currentPage = indexInAll / rowsPerPage;
11941
+ let insertCount = 0;
11942
+ currentParents.forEach((parent) => {
11943
+ if (typeof repeatWrappedGroupRows === "function" && repeatWrappedGroupRows(parent) !== true) {
11944
+ return;
11945
+ }
11946
+ result.push(
11947
+ toDuplicateRow(parent, indexInAll + insertCount, currentPage)
11948
+ );
11949
+ insertCount++;
11950
+ rowInfo.indexInAll++;
11951
+ });
11952
+ }
11953
+ }
11954
+ if (parentExpanded) {
11955
+ result[rowInfo.indexInAll] = rowInfo;
11956
+ }
11957
+ const children = getNodeChildren(item);
11958
+ if (Array.isArray(children)) {
11959
+ flattenTreeNodes(
11960
+ children,
11961
+ nodePath,
11962
+ [...parents, rowInfo],
11963
+ rowInfo.indexInParentNodes,
11964
+ params,
11965
+ result
11966
+ );
11967
+ }
11968
+ }
11969
+ return result;
11970
+ }
11971
+ function enhancedTreeFlatten(param) {
11972
+ const { dataArray } = param;
11973
+ const result = [];
11974
+ flattenTreeNodes(dataArray, [], [], [], param, result);
11975
+ return { data: result };
11976
+ }
11422
11977
  function enhancedFlatten(param) {
11423
11978
  const {
11424
11979
  lazyLoad,
11425
11980
  groupResult,
11981
+ rowsPerPage,
11982
+ repeatWrappedGroupRows,
11426
11983
  withRowInfo,
11427
11984
  toPrimaryKey,
11428
11985
  groupRowsState,
@@ -11488,11 +12045,29 @@ function enhancedFlatten(param) {
11488
12045
  include = false;
11489
12046
  }
11490
12047
  if (include) {
11491
- result.push(enhancedGroupData);
11492
- groupRowsIndexes.push(result.length - 1);
11493
- }
11494
- enhancedGroupData.collapsedChildrenCount = 0;
11495
- parents.forEach((parent2) => {
12048
+ if (repeatWrappedGroupRows && rowsPerPage != null && rowsPerPage > 0) {
12049
+ const indexInAll = enhancedGroupData.indexInAll;
12050
+ const currentParents = enhancedGroupData.parents;
12051
+ if (currentParents.length > 0 && indexInAll % rowsPerPage === 0) {
12052
+ const currentPage = indexInAll / rowsPerPage;
12053
+ let insertCount = 0;
12054
+ currentParents.forEach((parent2) => {
12055
+ if (typeof repeatWrappedGroupRows === "function" && repeatWrappedGroupRows(parent2) !== true) {
12056
+ return;
12057
+ }
12058
+ result.push(
12059
+ toDuplicateRow(parent2, indexInAll + insertCount, currentPage)
12060
+ );
12061
+ insertCount++;
12062
+ enhancedGroupData.indexInAll++;
12063
+ });
12064
+ }
12065
+ }
12066
+ result.push(enhancedGroupData);
12067
+ groupRowsIndexes.push(result.length - 1);
12068
+ }
12069
+ enhancedGroupData.collapsedChildrenCount = 0;
12070
+ parents.forEach((parent2) => {
11496
12071
  parent2.deepRowInfoArray.push(enhancedGroupData);
11497
12072
  parent2.collapsedGroupsCount += collapsed ? 1 : 0;
11498
12073
  });
@@ -11507,13 +12082,29 @@ function enhancedFlatten(param) {
11507
12082
  if (continueWithChildren) {
11508
12083
  if (!next) {
11509
12084
  if (!pivot) {
11510
- const startIndex = result.length;
12085
+ let startIndex = result.length;
11511
12086
  if (!collapsed) {
11512
12087
  result.length += items.length;
11513
12088
  }
12089
+ let extraArtificialGroupRows = 0;
11514
12090
  for (let index = 0, len = items.length; index < len; index++) {
11515
12091
  const item = items[index];
11516
- const indexInAll = startIndex + index;
12092
+ if (!collapsed && repeatWrappedGroupRows && rowsPerPage != null && rowsPerPage > 0) {
12093
+ const currentInsertIndex = startIndex + index + extraArtificialGroupRows;
12094
+ if (currentInsertIndex % rowsPerPage === 0) {
12095
+ const currentPage = currentInsertIndex / rowsPerPage;
12096
+ parents.forEach((parent2) => {
12097
+ if (typeof repeatWrappedGroupRows === "function" && repeatWrappedGroupRows(parent2) !== true) {
12098
+ return;
12099
+ }
12100
+ const i = startIndex + index + extraArtificialGroupRows;
12101
+ result[i] = toDuplicateRow(parent2, i, currentPage);
12102
+ extraArtificialGroupRows++;
12103
+ result.length++;
12104
+ });
12105
+ }
12106
+ }
12107
+ const indexInAll = startIndex + index + extraArtificialGroupRows;
11517
12108
  const itemId = item ? toPrimaryKey(item, indexInAll) : `${groupKeys}-${index}`;
11518
12109
  const rowInfo = {
11519
12110
  id: itemId,
@@ -11521,6 +12112,7 @@ function enhancedFlatten(param) {
11521
12112
  isCellSelected: returnFalse,
11522
12113
  hasSelectedCells: returnFalse,
11523
12114
  dataSourceHasGrouping: true,
12115
+ isTreeNode: false,
11524
12116
  isGroupRow: false,
11525
12117
  selfLoaded: !!item,
11526
12118
  rowSelected: false,
@@ -11556,7 +12148,7 @@ function enhancedFlatten(param) {
11556
12148
  parent2.deepRowInfoArray.push(rowInfo);
11557
12149
  });
11558
12150
  if (!collapsed) {
11559
- result[startIndex + index] = rowInfo;
12151
+ result[startIndex + index + extraArtificialGroupRows] = rowInfo;
11560
12152
  }
11561
12153
  }
11562
12154
  }
@@ -11577,6 +12169,73 @@ function enhancedFlatten(param) {
11577
12169
  // src/components/DataSource/index.tsx
11578
12170
  import * as React51 from "react";
11579
12171
 
12172
+ // src/utils/groupAndPivot/treeUtils.ts
12173
+ var emptyFn = () => {
12174
+ };
12175
+ function toTreeDataArray(data, options) {
12176
+ const treeMap = new DeepMap();
12177
+ const nodesKey = options.nodesKey ?? "children";
12178
+ const emptyGroup = options.emptyGroup ?? {};
12179
+ const toPath = typeof options.pathKey === "function" ? options.pathKey : (data2) => data2[options.pathKey];
12180
+ for (const item of data) {
12181
+ const path = toPath(item);
12182
+ for (let i = 0; i < path.length; i++) {
12183
+ const p = path.slice(0, i);
12184
+ if (!treeMap.has(p)) {
12185
+ treeMap.set(p, void 0);
12186
+ }
12187
+ }
12188
+ treeMap.set(path, item);
12189
+ }
12190
+ function traverse(path, arr) {
12191
+ const nextLevelKeys = treeMap.getKeysStartingWith(path, true, 1);
12192
+ for (const nextLevelKey of nextLevelKeys) {
12193
+ const p = [...path, nextLevelKey[nextLevelKey.length - 1]];
12194
+ let item = treeMap.get(p);
12195
+ const children = item ? item[nodesKey] ?? [] : [];
12196
+ traverse(p, children);
12197
+ if (children.length) {
12198
+ if (!item) {
12199
+ item = typeof emptyGroup === "function" ? emptyGroup(p, children) : emptyGroup;
12200
+ }
12201
+ item[nodesKey] = children;
12202
+ }
12203
+ arr.push(item);
12204
+ }
12205
+ return arr;
12206
+ }
12207
+ return traverse([], []);
12208
+ }
12209
+ function traverseTreeNode(traverseParams, treeTraverseOptions, parentPath, item) {
12210
+ const { isLeafNode, getNodeChildren, toKey } = traverseParams;
12211
+ const { onParentNode, onNode, onLeafNode } = treeTraverseOptions;
12212
+ const id = toKey(item);
12213
+ const nodePath = [...parentPath, id];
12214
+ const isLeaf = isLeafNode(item);
12215
+ const next = once(() => {
12216
+ const children = getNodeChildren(item);
12217
+ if (!children || !Array.isArray(children)) {
12218
+ return;
12219
+ }
12220
+ for (let i = 0, len = children.length; i < len; i++) {
12221
+ const child = children[i];
12222
+ traverseTreeNode(traverseParams, treeTraverseOptions, nodePath, child);
12223
+ }
12224
+ });
12225
+ if (isLeaf) {
12226
+ onLeafNode?.(item);
12227
+ onNode?.(item, emptyFn);
12228
+ } else {
12229
+ onParentNode?.(item, next, getNodeChildren(item));
12230
+ onNode?.(item, next);
12231
+ }
12232
+ }
12233
+ function treeTraverse(treeParams, traverseOptions, data) {
12234
+ for (let i = 0, len = data.length; i < len; i++) {
12235
+ traverseTreeNode(treeParams, traverseOptions, [], data[i]);
12236
+ }
12237
+ }
12238
+
11580
12239
  // src/utils/multisort/sortTypes.ts
11581
12240
  var numberComparator = function(first, second) {
11582
12241
  return first - second;
@@ -11597,7 +12256,7 @@ var defaultSortTypes = {
11597
12256
  var sortTypes_default = defaultSortTypes;
11598
12257
 
11599
12258
  // src/utils/multisort/index.ts
11600
- var multisort = (sortInfo, array, get) => {
12259
+ function toPlainSortInfo(sortInfo) {
11601
12260
  const plainSortInfo = sortInfo.map((sortInfo2) => {
11602
12261
  if (Array.isArray(sortInfo2.field)) {
11603
12262
  return sortInfo2.field.map((field, index) => {
@@ -11617,7 +12276,63 @@ var multisort = (sortInfo, array, get) => {
11617
12276
  }
11618
12277
  return sortInfo2;
11619
12278
  }).flat();
11620
- array.sort(getMultisortFunction(plainSortInfo, get));
12279
+ return plainSortInfo;
12280
+ }
12281
+ var multisort = (sortInfo, array, options) => {
12282
+ const get = typeof options === "function" ? options : options?.get;
12283
+ array.sort(getMultisortFunction(toPlainSortInfo(sortInfo), get));
12284
+ return array;
12285
+ };
12286
+ var multisortNested = (sortInfo, array, options) => {
12287
+ const sortFn = getMultisortFunction(
12288
+ toPlainSortInfo(sortInfo),
12289
+ options.get
12290
+ );
12291
+ const depthFirst = options.depthFirst ?? false;
12292
+ const inplace = options.inplace ?? false;
12293
+ if (!depthFirst) {
12294
+ if (inplace) {
12295
+ array.sort(sortFn);
12296
+ } else {
12297
+ array = [...array].sort(sortFn);
12298
+ }
12299
+ }
12300
+ const { nodesKey, toKey } = options;
12301
+ const getNodeChildren = (node) => {
12302
+ return node[nodesKey];
12303
+ };
12304
+ const isLeafNode = (node) => {
12305
+ return node[nodesKey] === void 0;
12306
+ };
12307
+ treeTraverse(
12308
+ {
12309
+ isLeafNode: options.isLeafNode ?? isLeafNode,
12310
+ getNodeChildren: options.getNodeChildren ?? getNodeChildren,
12311
+ toKey
12312
+ },
12313
+ {
12314
+ onParentNode: (item, next, children) => {
12315
+ if (depthFirst) {
12316
+ next();
12317
+ }
12318
+ if (Array.isArray(children)) {
12319
+ const res = inplace ? children.sort(sortFn) : [...children].sort(sortFn);
12320
+ item[nodesKey] = res;
12321
+ }
12322
+ if (!depthFirst) {
12323
+ next();
12324
+ }
12325
+ }
12326
+ },
12327
+ array
12328
+ );
12329
+ if (depthFirst) {
12330
+ if (inplace) {
12331
+ array.sort(sortFn);
12332
+ } else {
12333
+ array = [...array].sort(sortFn);
12334
+ }
12335
+ }
11621
12336
  return array;
11622
12337
  };
11623
12338
  multisort.knownTypes = sortTypes_default;
@@ -12967,7 +13682,7 @@ function getRowSelectionApi(param) {
12967
13682
  const selected = [];
12968
13683
  if (state.lazyLoad) {
12969
13684
  console.error(
12970
- `getSelectedPrimaryKeys should not be called for lazy-loaded datasources as it wont return reliable results`
13685
+ `getSelectedPrimaryKeys should not be called for lazy-loaded datasources as it wont return reliable results`
12971
13686
  );
12972
13687
  }
12973
13688
  state.originalDataArray.forEach((data) => {
@@ -13020,22 +13735,33 @@ function discardCallsWithEqualArg(fn, timeframe = 50, getCompareObject) {
13020
13735
  var Indexer = class {
13021
13736
  constructor() {
13022
13737
  this.primaryKeyToData = /* @__PURE__ */ new Map();
13738
+ this.nodePathsToData = new DeepMap();
13023
13739
  this.add = (primaryKey, data) => {
13024
13740
  this.primaryKeyToData.set(primaryKey, data);
13025
13741
  };
13742
+ this.addNodePath = (nodePath, data) => {
13743
+ this.nodePathsToData.set(nodePath, data);
13744
+ this.add(nodePath[nodePath.length - 1], data);
13745
+ };
13026
13746
  this.clear = () => {
13027
13747
  this.primaryKeyToData.clear();
13748
+ this.nodePathsToData.clear();
13028
13749
  };
13029
13750
  this.getDataForPrimaryKey = (primaryKey) => {
13030
13751
  return this.primaryKeyToData.get(primaryKey);
13031
13752
  };
13753
+ this.getDataForNodePath = (nodePath) => {
13754
+ return this.nodePathsToData.get(nodePath);
13755
+ };
13032
13756
  this.indexArray = (arr, options) => {
13033
- const { cache, toPrimaryKey } = options;
13757
+ const { cache, toPrimaryKey, getNodeChildren, isLeafNode, nodesKey } = options;
13758
+ const isTree = !!getNodeChildren && !!isLeafNode;
13034
13759
  if (cache && cache.shouldResetDataSource()) {
13035
13760
  this.clear();
13036
13761
  arr = [];
13037
13762
  }
13038
- if (cache && !cache.isEmpty()) {
13763
+ const shouldCloneArray = cache && !cache.isEmpty();
13764
+ if (shouldCloneArray) {
13039
13765
  arr = arr.concat();
13040
13766
  }
13041
13767
  if (!arr.length && cache) {
@@ -13045,49 +13771,89 @@ var Indexer = class {
13045
13771
  const info = cacheInfo[cacheIndex];
13046
13772
  if (info.type === "insert") {
13047
13773
  const insertPK = toPrimaryKey(info.data);
13048
- this.add(insertPK, info.data);
13774
+ if (isTree) {
13775
+ this.addNodePath([insertPK], info.data);
13776
+ } else {
13777
+ this.add(insertPK, info.data);
13778
+ }
13049
13779
  arr.push(info.data);
13050
13780
  }
13051
13781
  }
13052
13782
  cache?.removeInfo(void 0);
13053
13783
  }
13054
13784
  } else {
13055
- for (let i = 0; i < arr.length; i++) {
13056
- let item = arr[i];
13057
- let deleted = false;
13058
- if (item != null) {
13059
- const pk = toPrimaryKey(item);
13060
- const cacheInfo = cache?.getMutationsForPrimaryKey(pk);
13061
- if (cacheInfo && cacheInfo.length) {
13062
- for (let cacheIndex = 0, cacheLength = cacheInfo.length; cacheIndex < cacheLength; cacheIndex++) {
13063
- const info = cacheInfo[cacheIndex];
13064
- if (info.type === "delete" && !deleted) {
13065
- this.primaryKeyToData.delete(pk);
13066
- deleted = true;
13067
- arr.splice(i, 1);
13785
+ const indexArray = (arr2, parentPath) => {
13786
+ for (let i = 0; i < arr2.length; i++) {
13787
+ let item = arr2[i];
13788
+ if (shouldCloneArray && isTree && Array.isArray(item[nodesKey])) {
13789
+ item = arr2[i] = { ...item };
13790
+ }
13791
+ let deleted = false;
13792
+ if (item != null) {
13793
+ const pk = toPrimaryKey(item);
13794
+ const nodePath = isTree ? [...parentPath, pk] : void 0;
13795
+ let isTreeModeForNode = isTree && nodePath;
13796
+ let cacheInfo = isTreeModeForNode ? cache?.getMutationsForNodePath(nodePath) : cache?.getMutationsForPrimaryKey(pk);
13797
+ if (cacheInfo && cacheInfo.length) {
13798
+ for (let cacheIndex = 0, cacheLength = cacheInfo.length; cacheIndex < cacheLength; cacheIndex++) {
13799
+ const info = cacheInfo[cacheIndex];
13800
+ if (info.type === "delete" && !deleted) {
13801
+ if (isTreeModeForNode) {
13802
+ this.nodePathsToData.delete(nodePath);
13803
+ } else {
13804
+ this.primaryKeyToData.delete(pk);
13805
+ }
13806
+ deleted = true;
13807
+ arr2.splice(i, 1);
13808
+ i--;
13809
+ }
13810
+ if (info.type === "update" && !deleted) {
13811
+ item = { ...item, ...info.data };
13812
+ arr2[i] = item;
13813
+ }
13814
+ if (info.type === "insert") {
13815
+ const insertPK = toPrimaryKey(info.data);
13816
+ if (isTreeModeForNode) {
13817
+ const currentPath = [...parentPath, insertPK];
13818
+ this.addNodePath(currentPath, info.data);
13819
+ } else {
13820
+ this.add(insertPK, info.data);
13821
+ }
13822
+ if (info.position === "before") {
13823
+ arr2.splice(i, 0, info.data);
13824
+ i--;
13825
+ } else {
13826
+ arr2.splice(i + 1, 0, info.data);
13827
+ }
13828
+ }
13068
13829
  }
13069
- if (info.type === "update" && !deleted) {
13070
- item = { ...item, ...info.data };
13071
- arr[i] = item;
13830
+ if (isTreeModeForNode) {
13831
+ cache?.removeNodePathInfo(nodePath);
13832
+ } else {
13833
+ cache?.removeInfo(pk);
13072
13834
  }
13073
- if (info.type === "insert") {
13074
- const insertPK = toPrimaryKey(info.data);
13075
- this.add(insertPK, info.data);
13076
- if (info.position === "before") {
13077
- arr.splice(i, 0, info.data);
13078
- i--;
13079
- } else {
13080
- arr.splice(i + 1, 0, info.data);
13835
+ }
13836
+ if (!deleted) {
13837
+ if (isTreeModeForNode) {
13838
+ const isLeaf = isLeafNode(item);
13839
+ let children = isLeaf ? null : getNodeChildren(item);
13840
+ if (!isLeaf && Array.isArray(children)) {
13841
+ parentPath.push(pk);
13842
+ if (shouldCloneArray) {
13843
+ item[nodesKey] = children = children.concat();
13844
+ }
13845
+ indexArray(children, parentPath);
13846
+ parentPath.pop();
13081
13847
  }
13848
+ this.addNodePath(nodePath, item);
13849
+ } else {
13850
+ this.add(pk, item);
13082
13851
  }
13083
13852
  }
13084
- cache?.removeInfo(pk);
13085
- }
13086
- if (!deleted) {
13087
- this.add(pk, item);
13088
13853
  }
13089
13854
  }
13090
- }
13855
+ };
13856
+ indexArray(arr, []);
13091
13857
  }
13092
13858
  return arr;
13093
13859
  };
@@ -13355,6 +14121,7 @@ var DataSourceCache = class {
13355
14121
  this.affectedFields = /* @__PURE__ */ new Set();
13356
14122
  this.allFieldsAffected = false;
13357
14123
  this.primaryKeyToData = /* @__PURE__ */ new Map();
14124
+ this.nodePathToData = new DeepMap();
13358
14125
  this.getAffectedFields = () => {
13359
14126
  if (this.allFieldsAffected) {
13360
14127
  return true;
@@ -13373,6 +14140,17 @@ var DataSourceCache = class {
13373
14140
  });
13374
14141
  this.primaryKeyToData.set(pk, value);
13375
14142
  };
14143
+ this.deleteNodePath = (nodePath, originalData, metadata) => {
14144
+ this.allFieldsAffected = true;
14145
+ const value = this.nodePathToData.get(nodePath) || [];
14146
+ value.push({
14147
+ type: "delete",
14148
+ nodePath,
14149
+ originalData,
14150
+ metadata
14151
+ });
14152
+ this.nodePathToData.set(nodePath, value);
14153
+ };
13376
14154
  this.insert = (primaryKey, data, position2, metadata) => {
13377
14155
  const pk = primaryKey;
13378
14156
  const value = this.primaryKeyToData.get(pk) || [];
@@ -13387,6 +14165,19 @@ var DataSourceCache = class {
13387
14165
  });
13388
14166
  this.primaryKeyToData.set(pk, value);
13389
14167
  };
14168
+ this.insertNodePath = (nodePath, data, position2, metadata) => {
14169
+ const value = this.nodePathToData.get(nodePath) || [];
14170
+ this.allFieldsAffected = true;
14171
+ value.push({
14172
+ type: "insert",
14173
+ nodePath,
14174
+ data,
14175
+ position: position2,
14176
+ originalData: null,
14177
+ metadata
14178
+ });
14179
+ this.nodePathToData.set(nodePath, value);
14180
+ };
13390
14181
  this.update = (primaryKey, data, originalData, metadata) => {
13391
14182
  if (!this.allFieldsAffected) {
13392
14183
  const keys = Object.keys(data);
@@ -13403,6 +14194,21 @@ var DataSourceCache = class {
13403
14194
  });
13404
14195
  this.primaryKeyToData.set(primaryKey, value);
13405
14196
  };
14197
+ this.updateNodePath = (nodePath, data, originalData, metadata) => {
14198
+ if (!this.allFieldsAffected) {
14199
+ const keys = Object.keys(data);
14200
+ keys.forEach((key) => this.affectedFields.add(key));
14201
+ }
14202
+ const value = this.nodePathToData.get(nodePath) || [];
14203
+ value.push({
14204
+ type: "update",
14205
+ nodePath,
14206
+ data,
14207
+ originalData,
14208
+ metadata
14209
+ });
14210
+ this.nodePathToData.set(nodePath, value);
14211
+ };
13406
14212
  this.resetDataSource = (metadata) => {
13407
14213
  this.clear();
13408
14214
  this.allFieldsAffected = true;
@@ -13424,21 +14230,31 @@ var DataSourceCache = class {
13424
14230
  this.primaryKeyToData.clear();
13425
14231
  };
13426
14232
  this.isEmpty = () => {
13427
- return this.primaryKeyToData.size === 0;
14233
+ return this.primaryKeyToData.size === 0 && this.nodePathToData.size === 0;
13428
14234
  };
13429
14235
  this.removeInfo = (primaryKey) => {
13430
14236
  this.primaryKeyToData.delete(primaryKey);
13431
14237
  };
14238
+ this.removeNodePathInfo = (nodePath) => {
14239
+ this.nodePathToData.delete(nodePath);
14240
+ };
13432
14241
  this.getMutationsForPrimaryKey = (primaryKey) => {
13433
14242
  const data = this.primaryKeyToData.get(primaryKey);
13434
14243
  return data;
13435
14244
  };
14245
+ this.getMutationsForNodePath = (nodePath) => {
14246
+ const data = this.nodePathToData.get(nodePath);
14247
+ return data;
14248
+ };
13436
14249
  this.getMutationsCount = () => {
13437
14250
  return this.primaryKeyToData.size;
13438
14251
  };
13439
14252
  this.getMutations = () => {
13440
14253
  return new Map(this.primaryKeyToData);
13441
14254
  };
14255
+ this.getTreeMutations = () => {
14256
+ return DeepMap.clone(this.nodePathToData);
14257
+ };
13442
14258
  this.getMutationsArray = () => {
13443
14259
  return Array.from(this.primaryKeyToData.values()).flat();
13444
14260
  };
@@ -13450,6 +14266,7 @@ var DataSourceCache = class {
13450
14266
  clone.primaryKeyToData = light ? cache.primaryKeyToData : new Map(
13451
14267
  cache.primaryKeyToData
13452
14268
  );
14269
+ clone.nodePathToData = light ? cache.nodePathToData : DeepMap.clone(cache.nodePathToData);
13453
14270
  return clone;
13454
14271
  }
13455
14272
  };
@@ -13462,6 +14279,657 @@ function getRowInfoArray(getState) {
13462
14279
  return getState().dataArray;
13463
14280
  }
13464
14281
 
14282
+ // src/components/DataSource/TreeExpandState.ts
14283
+ var TreeExpandState = class {
14284
+ constructor(clone) {
14285
+ this.collapsedPathsMap = new DeepMap();
14286
+ this.expandedPathsMap = new DeepMap();
14287
+ this.collapsedIdsMap = /* @__PURE__ */ new Map();
14288
+ this.expandedIdsMap = /* @__PURE__ */ new Map();
14289
+ this._mode = "path";
14290
+ this.defaultExpanded = false;
14291
+ this.expandAll = () => {
14292
+ this.update({
14293
+ defaultExpanded: true,
14294
+ collapsedPaths: []
14295
+ });
14296
+ };
14297
+ this.collapseAll = () => {
14298
+ this.update({
14299
+ defaultExpanded: false,
14300
+ expandedPaths: []
14301
+ });
14302
+ };
14303
+ const stateObject = clone && clone instanceof Object.getPrototypeOf(this).constructor ? clone.getState() : clone;
14304
+ if (stateObject) {
14305
+ this.update(stateObject);
14306
+ }
14307
+ }
14308
+ get mode() {
14309
+ return this._mode;
14310
+ }
14311
+ reset() {
14312
+ this.collapsedPathsMap.clear();
14313
+ this.expandedPathsMap.clear();
14314
+ this.collapsedIdsMap.clear();
14315
+ this.expandedIdsMap.clear();
14316
+ }
14317
+ destroy() {
14318
+ this.reset();
14319
+ }
14320
+ expandNode(nodePathOrId) {
14321
+ this.setNodeExpanded(nodePathOrId, true);
14322
+ }
14323
+ collapseNode(nodePathOrId) {
14324
+ this.setNodeExpanded(nodePathOrId, false);
14325
+ }
14326
+ setNodeExpanded(nodePathOrId, expanded) {
14327
+ const {
14328
+ collapsedPathsMap,
14329
+ collapsedIdsMap,
14330
+ expandedPathsMap,
14331
+ expandedIdsMap,
14332
+ defaultExpanded,
14333
+ _mode: selectionMode
14334
+ } = this;
14335
+ if (selectionMode === "id" && Array.isArray(nodePathOrId)) {
14336
+ nodePathOrId = nodePathOrId[nodePathOrId.length - 1];
14337
+ }
14338
+ if (expanded === defaultExpanded) {
14339
+ if (expanded) {
14340
+ if (selectionMode === "path" && Array.isArray(nodePathOrId)) {
14341
+ collapsedPathsMap.delete(nodePathOrId);
14342
+ } else {
14343
+ collapsedIdsMap.delete(nodePathOrId);
14344
+ }
14345
+ } else {
14346
+ if (selectionMode === "path" && Array.isArray(nodePathOrId)) {
14347
+ expandedPathsMap.delete(nodePathOrId);
14348
+ } else {
14349
+ expandedIdsMap.delete(nodePathOrId);
14350
+ }
14351
+ }
14352
+ } else {
14353
+ if (expanded) {
14354
+ if (selectionMode === "path" && Array.isArray(nodePathOrId)) {
14355
+ expandedPathsMap.set(nodePathOrId, true);
14356
+ } else {
14357
+ expandedIdsMap.set(nodePathOrId, true);
14358
+ }
14359
+ } else {
14360
+ if (selectionMode === "path" && Array.isArray(nodePathOrId)) {
14361
+ collapsedPathsMap.set(nodePathOrId, true);
14362
+ } else {
14363
+ collapsedIdsMap.set(nodePathOrId, true);
14364
+ }
14365
+ }
14366
+ }
14367
+ }
14368
+ isNodeExpandedByPath(nodePath) {
14369
+ return this.isNodeExpanded(nodePath);
14370
+ }
14371
+ isNodeExpandedById(id) {
14372
+ return this.isNodeExpanded(id);
14373
+ }
14374
+ isNodeExpanded(nodePathOrId) {
14375
+ if (this._mode === "id" && Array.isArray(nodePathOrId)) {
14376
+ nodePathOrId = nodePathOrId[nodePathOrId.length - 1];
14377
+ }
14378
+ if (this._mode === "id" && Array.isArray(nodePathOrId)) {
14379
+ throw `You try to check if a node is expanded by id (${nodePathOrId}) but your TreeExpandState is configured to use node paths.`;
14380
+ }
14381
+ if (this._mode === "path" && !Array.isArray(nodePathOrId)) {
14382
+ throw `You try to check if a node is expanded by path (${nodePathOrId}) but your TreeExpandState is configured to use node ids.`;
14383
+ }
14384
+ if (this.defaultExpanded) {
14385
+ if (this._mode === "path" && Array.isArray(nodePathOrId)) {
14386
+ return !this.collapsedPathsMap.has(nodePathOrId);
14387
+ } else {
14388
+ return !this.collapsedIdsMap.has(nodePathOrId);
14389
+ }
14390
+ }
14391
+ if (this._mode === "path" && Array.isArray(nodePathOrId)) {
14392
+ return this.expandedPathsMap.has(nodePathOrId);
14393
+ }
14394
+ return this.expandedIdsMap.has(nodePathOrId);
14395
+ }
14396
+ update(stateObject) {
14397
+ this.defaultExpanded = stateObject.defaultExpanded;
14398
+ this.reset();
14399
+ if (stateObject.expandedPaths || stateObject.collapsedPaths) {
14400
+ this._mode = "path";
14401
+ const expandedPaths = stateObject.expandedPaths || null;
14402
+ const collapsedPaths = stateObject.collapsedPaths || null;
14403
+ if (expandedPaths) {
14404
+ for (let i = 0, len = expandedPaths.length; i < len; i++) {
14405
+ this.expandedPathsMap.set(expandedPaths[i], true);
14406
+ }
14407
+ }
14408
+ if (collapsedPaths) {
14409
+ for (let i = 0, len = collapsedPaths.length; i < len; i++) {
14410
+ this.collapsedPathsMap.set(collapsedPaths[i], true);
14411
+ }
14412
+ }
14413
+ return;
14414
+ }
14415
+ this._mode = "id";
14416
+ const expandedIds = stateObject.expandedIds || null;
14417
+ const collapsedIds = stateObject.collapsedIds || null;
14418
+ if (expandedIds) {
14419
+ for (let i = 0, len = expandedIds.length; i < len; i++) {
14420
+ this.expandedIdsMap.set(expandedIds[i], true);
14421
+ }
14422
+ }
14423
+ if (collapsedIds) {
14424
+ for (let i = 0, len = collapsedIds.length; i < len; i++) {
14425
+ this.collapsedIdsMap.set(collapsedIds[i], true);
14426
+ }
14427
+ }
14428
+ }
14429
+ getState() {
14430
+ if (this._mode === "path") {
14431
+ const collapsedPaths = Array.from(
14432
+ this.collapsedPathsMap.keys()
14433
+ );
14434
+ const expandedPaths = Array.from(
14435
+ this.expandedPathsMap.keys()
14436
+ );
14437
+ return {
14438
+ defaultExpanded: this.defaultExpanded,
14439
+ collapsedPaths,
14440
+ expandedPaths
14441
+ };
14442
+ }
14443
+ const collapsedIds = Array.from(
14444
+ this.collapsedIdsMap.keys()
14445
+ );
14446
+ const expandedIds = Array.from(
14447
+ this.expandedIdsMap.keys()
14448
+ );
14449
+ return {
14450
+ defaultExpanded: this.defaultExpanded,
14451
+ collapsedIds,
14452
+ expandedIds
14453
+ };
14454
+ }
14455
+ };
14456
+
14457
+ // src/components/DataSource/TreeSelectionState.ts
14458
+ var shortestToLongest = (a, b) => a.length - b.length;
14459
+ var TreeSelectionState = class {
14460
+ constructor(state, getConfig) {
14461
+ this.selectedPaths = null;
14462
+ this.deselectedPaths = null;
14463
+ this.defaultSelection = false;
14464
+ this.selectionMap = new DeepMap();
14465
+ this.cache = new DeepMap();
14466
+ const stateObject = state instanceof Object.getPrototypeOf(this).constructor ? (
14467
+ //@ts-ignore
14468
+ state.getState()
14469
+ ) : state;
14470
+ this.setConfigFn(getConfig);
14471
+ this.update(stateObject);
14472
+ }
14473
+ getTreeDeepMap() {
14474
+ return this.getConfig().treeDeepMap;
14475
+ }
14476
+ isLeafNode(nodePath) {
14477
+ return !this.getTreeDeepMap().has(nodePath);
14478
+ }
14479
+ getLeafNodesCount(nodePath) {
14480
+ const treeDeepMap = this.getTreeDeepMap();
14481
+ const deepMapValue = treeDeepMap.get(nodePath);
14482
+ if (!deepMapValue) {
14483
+ return 1;
14484
+ }
14485
+ return deepMapValue.items.length;
14486
+ }
14487
+ static from(treeSelectionState, getConfig) {
14488
+ return new TreeSelectionState(treeSelectionState, getConfig);
14489
+ }
14490
+ setConfigFn(getConfig) {
14491
+ this.getConfig = getConfig;
14492
+ this.xcache();
14493
+ }
14494
+ xcache() {
14495
+ this.cache.clear();
14496
+ }
14497
+ update(stateObject) {
14498
+ this.selectedPaths = stateObject.selectedPaths || null;
14499
+ this.deselectedPaths = stateObject.deselectedPaths || null;
14500
+ const { selectionMap, selectedPaths, deselectedPaths } = this;
14501
+ selectionMap.clear();
14502
+ selectedPaths?.forEach(
14503
+ (nodePath) => this.setSelectionForPath(nodePath, true)
14504
+ );
14505
+ deselectedPaths?.forEach(
14506
+ (nodePath) => this.setSelectionForPath(nodePath, false)
14507
+ );
14508
+ this.defaultSelection = stateObject.defaultSelection;
14509
+ this.xcache();
14510
+ }
14511
+ setSelectionForPath(nodePath, selected) {
14512
+ this.selectionMap.set(nodePath, selected);
14513
+ }
14514
+ getState() {
14515
+ const selectedPaths = [];
14516
+ const deselectedPaths = [];
14517
+ this.selectionMap.topDownEntries().forEach(([path, value]) => {
14518
+ if (value) {
14519
+ selectedPaths.push(path);
14520
+ } else {
14521
+ deselectedPaths.push(path);
14522
+ }
14523
+ });
14524
+ return {
14525
+ defaultSelection: this.defaultSelection,
14526
+ selectedPaths,
14527
+ deselectedPaths
14528
+ };
14529
+ }
14530
+ deselectAll() {
14531
+ this.update({
14532
+ defaultSelection: false,
14533
+ selectedPaths: [],
14534
+ deselectedPaths: []
14535
+ });
14536
+ }
14537
+ selectAll() {
14538
+ this.update({
14539
+ defaultSelection: true,
14540
+ deselectedPaths: [],
14541
+ selectedPaths: []
14542
+ });
14543
+ }
14544
+ isNodeSelected(nodePath) {
14545
+ return this.isPathSelected(nodePath);
14546
+ }
14547
+ isSelfSelected(nodePath) {
14548
+ return this.selectionMap.get(nodePath) ?? null;
14549
+ }
14550
+ cacheIt(nodePath, state) {
14551
+ this.cache.set(nodePath, state);
14552
+ return state;
14553
+ }
14554
+ getSelectionStateForNode(nodePath, earlyExit) {
14555
+ const cachedResult = this.cache.get(nodePath);
14556
+ if (cachedResult) {
14557
+ return cachedResult;
14558
+ }
14559
+ if (this.isLeafNode(nodePath)) {
14560
+ const selected = this.isSelfSelected(nodePath);
14561
+ if (selected !== null) {
14562
+ return this.cacheIt(nodePath, {
14563
+ selected,
14564
+ selectedCount: selected ? 1 : 0,
14565
+ deselectedCount: selected ? 0 : 1,
14566
+ leafCount: 1
14567
+ });
14568
+ }
14569
+ }
14570
+ const leafCount = this.getLeafNodesCount(nodePath);
14571
+ let currentSelectionState = this.isSelfSelected(nodePath);
14572
+ const { selectionMap } = this;
14573
+ const childPaths = selectionMap.getKeysStartingWith(nodePath, true).sort(shortestToLongest);
14574
+ if (!childPaths.length) {
14575
+ if (currentSelectionState !== null) {
14576
+ const res2 = leafCount ? currentSelectionState : (
14577
+ /* if this has no leaves, we'll consider it deselected */
14578
+ false
14579
+ );
14580
+ return this.cacheIt(nodePath, {
14581
+ selected: res2,
14582
+ selectedCount: res2 ? leafCount : 0,
14583
+ deselectedCount: res2 ? 0 : leafCount,
14584
+ leafCount
14585
+ });
14586
+ }
14587
+ const res = leafCount ? this.getNodeBooleanSelectionStateFromParent(nodePath) : false;
14588
+ return this.cacheIt(nodePath, {
14589
+ selected: res,
14590
+ selectedCount: res ? leafCount : 0,
14591
+ deselectedCount: res ? 0 : leafCount,
14592
+ leafCount
14593
+ });
14594
+ }
14595
+ let selectedCount = 0;
14596
+ let deselectedCount = 0;
14597
+ const selfSelected = this.getNodeBooleanSelectionStateFromParent(nodePath);
14598
+ if (selfSelected) {
14599
+ selectedCount += leafCount;
14600
+ } else {
14601
+ deselectedCount += leafCount;
14602
+ }
14603
+ for (let i = 0, len = childPaths.length; i < len; i++) {
14604
+ const childPath = childPaths[i];
14605
+ const { selectedCount: selCount, deselectedCount: deselCount } = this.getSelectionStateForNode(childPath);
14606
+ if (selfSelected) {
14607
+ selectedCount -= deselCount;
14608
+ deselectedCount += deselCount;
14609
+ } else {
14610
+ deselectedCount -= selCount;
14611
+ selectedCount += selCount;
14612
+ }
14613
+ if (earlyExit && selCount > 0 && deselCount > 0) {
14614
+ return this.cacheIt(nodePath, {
14615
+ selected: null,
14616
+ leafCount,
14617
+ selectedCount,
14618
+ deselectedCount
14619
+ });
14620
+ }
14621
+ }
14622
+ if (!selectedCount && !deselectedCount) {
14623
+ return this.cacheIt(nodePath, {
14624
+ selected: selfSelected,
14625
+ selectedCount: selfSelected ? leafCount : 0,
14626
+ deselectedCount: selfSelected ? 0 : leafCount,
14627
+ leafCount
14628
+ });
14629
+ }
14630
+ if (selectedCount) {
14631
+ const res = selectedCount === leafCount ? true : null;
14632
+ return this.cacheIt(nodePath, {
14633
+ selected: res,
14634
+ selectedCount,
14635
+ deselectedCount,
14636
+ leafCount
14637
+ });
14638
+ }
14639
+ return this.cacheIt(nodePath, {
14640
+ selected: false,
14641
+ selectedCount: 0,
14642
+ deselectedCount: leafCount,
14643
+ leafCount
14644
+ });
14645
+ }
14646
+ isPathSelected(nodePath) {
14647
+ return this.getSelectionStateForNode(nodePath, true).selected;
14648
+ }
14649
+ getNodeBooleanSelectionStateFromParent(initialNodePath) {
14650
+ const { defaultSelection, selectionMap } = this;
14651
+ if (!initialNodePath.length) {
14652
+ return defaultSelection;
14653
+ }
14654
+ const nodePath = [...initialNodePath];
14655
+ do {
14656
+ const currentValue = selectionMap.get(nodePath);
14657
+ if (currentValue !== void 0) {
14658
+ return currentValue;
14659
+ }
14660
+ nodePath.pop();
14661
+ } while (nodePath.length);
14662
+ return defaultSelection;
14663
+ }
14664
+ setNodeSelection(nodePath, selected) {
14665
+ if (!nodePath.length) {
14666
+ return;
14667
+ }
14668
+ const keys = this.selectionMap.getKeysStartingWith(nodePath);
14669
+ keys.forEach((nodePath2) => {
14670
+ this.selectionMap.delete(nodePath2);
14671
+ });
14672
+ if (nodePath.length === 1 && this.defaultSelection === selected) {
14673
+ } else {
14674
+ this.setSelectionForPath(nodePath, selected);
14675
+ if (nodePath.length > 1) {
14676
+ const parentPath = nodePath.slice(0, -1);
14677
+ const parentSelected = this.isNodeSelected(parentPath);
14678
+ if (parentSelected === selected) {
14679
+ this.setNodeSelection(parentPath, selected);
14680
+ }
14681
+ }
14682
+ }
14683
+ }
14684
+ selectNode(nodePath) {
14685
+ this.setNodeSelection(nodePath, true);
14686
+ }
14687
+ deselectNode(nodePath) {
14688
+ this.setNodeSelection(nodePath, false);
14689
+ }
14690
+ toggleNodeSelection(nodePath) {
14691
+ this.setNodeSelection(nodePath, !this.isNodeSelected(nodePath));
14692
+ }
14693
+ getSelectedCount() {
14694
+ return this.getSelectionCountFor([]).selectedCount;
14695
+ }
14696
+ getDeselectedCount() {
14697
+ return this.getSelectionCountFor([]).deselectedCount;
14698
+ }
14699
+ getSelectionCountFor(nodePath = []) {
14700
+ const { selectedCount, deselectedCount } = this.getSelectionStateForNode(nodePath);
14701
+ return {
14702
+ selectedCount,
14703
+ deselectedCount
14704
+ };
14705
+ }
14706
+ destroy() {
14707
+ this.getConfig = null;
14708
+ this.xcache();
14709
+ this.selectionMap.clear();
14710
+ }
14711
+ };
14712
+
14713
+ // src/components/DataSource/getTreeApi.ts
14714
+ function cloneTreeSelection(treeSelection, stateOrGetState) {
14715
+ return new TreeSelectionState(
14716
+ treeSelection,
14717
+ treeSelectionStateConfigGetter(stateOrGetState)
14718
+ );
14719
+ }
14720
+ function treeSelectionStateConfigGetter(stateOrStateGetter) {
14721
+ return () => {
14722
+ const state = typeof stateOrStateGetter === "function" ? stateOrStateGetter() : stateOrStateGetter;
14723
+ return {
14724
+ treeDeepMap: state.treeDeepMap
14725
+ };
14726
+ };
14727
+ }
14728
+ function getTreeApi(param) {
14729
+ const { getState, actions, dataSourceApi } = param;
14730
+ const setNodeSelection = (nodePath, selected) => {
14731
+ const { treeSelectionState: treeSelection, selectionMode } = getState();
14732
+ if (selectionMode === "single-row") {
14733
+ actions.treeSelection = selected ? nodePath[nodePath.length - 1] : null;
14734
+ return;
14735
+ }
14736
+ if (selectionMode !== "multi-row") {
14737
+ throw "Selection mode is not multi-row or single-row";
14738
+ }
14739
+ if (!(treeSelection instanceof TreeSelectionState)) {
14740
+ throw "Invalid tree selection";
14741
+ }
14742
+ const treeSelectionState = new TreeSelectionState(
14743
+ treeSelection,
14744
+ treeSelectionStateConfigGetter(getState)
14745
+ );
14746
+ treeSelectionState.setNodeSelection(nodePath, selected);
14747
+ getState().lastSelectionUpdatedNodePathRef.current = nodePath;
14748
+ actions.treeSelection = treeSelectionState;
14749
+ };
14750
+ const getCallbackParam = (_nodePath) => {
14751
+ return {
14752
+ dataSourceApi
14753
+ };
14754
+ };
14755
+ const api = {
14756
+ get allRowsSelected() {
14757
+ return getState().allRowsSelected;
14758
+ },
14759
+ isNodeExpanded(nodePath) {
14760
+ const state = getState();
14761
+ const { isNodeExpanded, isNodeCollapsed, treeExpandState } = state;
14762
+ const rowInfo = this.getRowInfoByPath(nodePath);
14763
+ if (rowInfo) {
14764
+ if (!rowInfo.isTreeNode || !rowInfo.isParentNode) {
14765
+ return false;
14766
+ }
14767
+ if (isNodeCollapsed) {
14768
+ return !isNodeExpanded(rowInfo);
14769
+ }
14770
+ if (isNodeExpanded) {
14771
+ return isNodeExpanded(rowInfo);
14772
+ }
14773
+ }
14774
+ return treeExpandState.isNodeExpanded(nodePath);
14775
+ },
14776
+ expandAll() {
14777
+ const treeExpandState = new TreeExpandState({
14778
+ defaultExpanded: true,
14779
+ collapsedPaths: []
14780
+ });
14781
+ getState().lastExpandStateInfoRef.current = {
14782
+ state: "expanded",
14783
+ nodePath: null
14784
+ };
14785
+ actions.treeExpandState = treeExpandState;
14786
+ },
14787
+ collapseAll() {
14788
+ const treeExpandState = new TreeExpandState({
14789
+ defaultExpanded: false,
14790
+ expandedPaths: []
14791
+ });
14792
+ getState().lastExpandStateInfoRef.current = {
14793
+ state: "collapsed",
14794
+ nodePath: null
14795
+ };
14796
+ actions.treeExpandState = treeExpandState;
14797
+ },
14798
+ expandNode(nodePath) {
14799
+ const state = getState();
14800
+ const treeExpandState = new TreeExpandState(state.treeExpandState);
14801
+ treeExpandState.expandNode(nodePath);
14802
+ getState().lastExpandStateInfoRef.current = {
14803
+ state: "expanded",
14804
+ nodePath
14805
+ };
14806
+ actions.treeExpandState = treeExpandState;
14807
+ state.onNodeExpand?.(nodePath, getCallbackParam(nodePath));
14808
+ },
14809
+ collapseNode(nodePath) {
14810
+ const state = getState();
14811
+ const treeExpandState = new TreeExpandState(state.treeExpandState);
14812
+ treeExpandState.collapseNode(nodePath);
14813
+ getState().lastExpandStateInfoRef.current = {
14814
+ state: "collapsed",
14815
+ nodePath
14816
+ };
14817
+ actions.treeExpandState = treeExpandState;
14818
+ state.onNodeCollapse?.(nodePath, getCallbackParam(nodePath));
14819
+ },
14820
+ toggleNode(nodePath) {
14821
+ const state = getState();
14822
+ const treeExpandState = new TreeExpandState(state.treeExpandState);
14823
+ const newExpanded = !api.isNodeExpanded(nodePath);
14824
+ treeExpandState.setNodeExpanded(nodePath, newExpanded);
14825
+ getState().lastExpandStateInfoRef.current = {
14826
+ state: newExpanded ? "expanded" : "collapsed",
14827
+ nodePath
14828
+ };
14829
+ actions.treeExpandState = treeExpandState;
14830
+ if (newExpanded) {
14831
+ state.onNodeExpand?.(nodePath, getCallbackParam(nodePath));
14832
+ } else {
14833
+ state.onNodeCollapse?.(nodePath, getCallbackParam(nodePath));
14834
+ }
14835
+ },
14836
+ getNodeDataByPath(nodePath) {
14837
+ const { treeDeepMap } = getState();
14838
+ if (!treeDeepMap || !nodePath.length) {
14839
+ return null;
14840
+ }
14841
+ const rowInfo = api.getRowInfoByPath(nodePath);
14842
+ return rowInfo ? rowInfo.data : null;
14843
+ },
14844
+ getRowInfoByPath(nodePath) {
14845
+ const { pathToIndexDeepMap } = getState();
14846
+ const index = pathToIndexDeepMap.get(nodePath);
14847
+ if (index !== void 0) {
14848
+ return getRowInfoAt(index, getState);
14849
+ }
14850
+ return null;
14851
+ },
14852
+ selectAll() {
14853
+ const { treeSelectionState: treeSelection, selectionMode } = getState();
14854
+ if (selectionMode !== "multi-row") {
14855
+ throw "Selection mode is not multi-row";
14856
+ }
14857
+ if (!(treeSelection instanceof TreeSelectionState)) {
14858
+ throw "Invalid node selection";
14859
+ }
14860
+ const treeSelectionState = new TreeSelectionState(
14861
+ treeSelection,
14862
+ treeSelectionStateConfigGetter(getState)
14863
+ );
14864
+ treeSelectionState.selectAll();
14865
+ getState().lastSelectionUpdatedNodePathRef.current = null;
14866
+ actions.treeSelection = treeSelectionState;
14867
+ },
14868
+ deselectAll() {
14869
+ const { treeSelectionState: treeSelection, selectionMode } = getState();
14870
+ if (selectionMode !== "multi-row") {
14871
+ throw "Selection mode is not multi-row";
14872
+ }
14873
+ if (!(treeSelection instanceof TreeSelectionState)) {
14874
+ throw "Invalid node selection";
14875
+ }
14876
+ const treeSelectionState = new TreeSelectionState(
14877
+ treeSelection,
14878
+ treeSelectionStateConfigGetter(getState)
14879
+ );
14880
+ treeSelectionState.deselectAll();
14881
+ getState().lastSelectionUpdatedNodePathRef.current = null;
14882
+ actions.treeSelection = treeSelectionState;
14883
+ },
14884
+ isNodeSelected(nodePath) {
14885
+ const { treeSelection, selectionMode } = getState();
14886
+ if (selectionMode === "single-row") {
14887
+ const pk = nodePath[nodePath.length - 1];
14888
+ if (Array.isArray(treeSelection)) {
14889
+ return treeSelection.join(",") === nodePath.join(",");
14890
+ }
14891
+ return treeSelection === pk;
14892
+ }
14893
+ if (selectionMode !== "multi-row") {
14894
+ throw "Selection mode is not multi-row or single-row";
14895
+ }
14896
+ if (!(treeSelection instanceof TreeSelectionState)) {
14897
+ throw "Invalid tree selection";
14898
+ }
14899
+ return treeSelection.isNodeSelected(nodePath);
14900
+ },
14901
+ selectNode(nodePath) {
14902
+ setNodeSelection(nodePath, true);
14903
+ },
14904
+ deselectNode(nodePath) {
14905
+ setNodeSelection(nodePath, false);
14906
+ },
14907
+ setNodeSelection(nodePath, selected) {
14908
+ setNodeSelection(nodePath, selected);
14909
+ },
14910
+ toggleNodeSelection(nodePath) {
14911
+ if (this.isNodeSelected(nodePath)) {
14912
+ this.deselectNode(nodePath);
14913
+ } else {
14914
+ this.selectNode(nodePath);
14915
+ }
14916
+ },
14917
+ getDataByNodePath(nodePath) {
14918
+ return dataSourceApi.getDataByNodePath(nodePath);
14919
+ },
14920
+ updateDataByNodePath(data, nodePath, options) {
14921
+ return dataSourceApi.updateDataByNodePath(data, nodePath, options);
14922
+ },
14923
+ getRowInfoByNodePath(nodePath) {
14924
+ return dataSourceApi.getRowInfoByNodePath(nodePath);
14925
+ },
14926
+ getIndexByNodePath(nodePath) {
14927
+ return dataSourceApi.getIndexByNodePath(nodePath);
14928
+ }
14929
+ };
14930
+ return api;
14931
+ }
14932
+
13465
14933
  // src/components/DataSource/BooleanCollectionState.ts
13466
14934
  var BooleanCollectionState = class {
13467
14935
  constructor(state) {
@@ -13681,10 +15149,22 @@ var DataSourceApiImpl = class {
13681
15149
  const index = this.getIndexByPrimaryKey(id);
13682
15150
  return this.getRowInfoByIndex(index);
13683
15151
  };
15152
+ this.getRowInfoByNodePath = (nodePath) => {
15153
+ const index = this.getIndexByNodePath(nodePath);
15154
+ return this.getRowInfoByIndex(index);
15155
+ };
13684
15156
  this.getIndexByPrimaryKey = (id) => {
13685
15157
  const map2 = this.getState().idToIndexMap;
13686
15158
  return map2.get(id) ?? -1;
13687
15159
  };
15160
+ this.getIndexByNodePath = (nodePath) => {
15161
+ const map2 = this.getState().pathToIndexDeepMap;
15162
+ return map2.get(nodePath) ?? -1;
15163
+ };
15164
+ this.getNodePathById = (id) => {
15165
+ const map2 = this.getState().idToPathMap;
15166
+ return map2.get(id) ?? null;
15167
+ };
13688
15168
  this.getPrimaryKeyByIndex = (index) => {
13689
15169
  const rowInfo = this.getRowInfoByIndex(index);
13690
15170
  return rowInfo ? rowInfo.id : void 0;
@@ -13696,6 +15176,10 @@ var DataSourceApiImpl = class {
13696
15176
  const { indexer } = this.getState();
13697
15177
  return indexer.getDataForPrimaryKey(id) ?? null;
13698
15178
  };
15179
+ this.getDataByNodePath = (nodePath) => {
15180
+ const { indexer } = this.getState();
15181
+ return indexer.getDataForNodePath(nodePath) ?? null;
15182
+ };
13699
15183
  /**
13700
15184
  * Replaces all data in the DataSource with the provided data.
13701
15185
  * @param data - The new data to replace the existing data with.
@@ -13726,13 +15210,40 @@ var DataSourceApiImpl = class {
13726
15210
  return this.updateDataArray([data], options);
13727
15211
  };
13728
15212
  this.updateDataArray = (data, options) => {
13729
- const result = this.batchOperation({
15213
+ const isTree = this.getState().isTree;
15214
+ let primaryKeys = !isTree ? data.map((d) => {
15215
+ return this.toPrimaryKey(d);
15216
+ }) : void 0;
15217
+ const nodePaths = isTree ? data.map((d) => {
15218
+ return this.getNodePathById(this.toPrimaryKey(d)) || [];
15219
+ }) : null;
15220
+ const result = primaryKeys ? this.batchOperation({
13730
15221
  type: "update",
13731
15222
  array: data,
13732
15223
  primaryKeys: data.map((d) => {
13733
15224
  return this.toPrimaryKey(d);
13734
15225
  }),
13735
15226
  metadata: options?.metadata
15227
+ }) : this.batchOperation({
15228
+ type: "update",
15229
+ array: data,
15230
+ nodePaths: nodePaths || [],
15231
+ metadata: options?.metadata
15232
+ });
15233
+ if (options?.flush) {
15234
+ this.commit();
15235
+ }
15236
+ return result;
15237
+ };
15238
+ this.updateDataByNodePath = (data, nodePath, options) => {
15239
+ return this.updateDataArrayByNodePath([data], [nodePath], options);
15240
+ };
15241
+ this.updateDataArrayByNodePath = (data, nodePaths, options) => {
15242
+ const result = this.batchOperation({
15243
+ type: "update",
15244
+ array: data,
15245
+ nodePaths,
15246
+ metadata: options?.metadata
13736
15247
  });
13737
15248
  if (options?.flush) {
13738
15249
  this.commit();
@@ -13750,10 +15261,29 @@ var DataSourceApiImpl = class {
13750
15261
  }
13751
15262
  return result;
13752
15263
  };
13753
- this.removeData = (data, options) => {
15264
+ this.removeDataByNodePath = (nodePath, options) => {
13754
15265
  const result = this.batchOperation({
13755
15266
  type: "delete",
13756
- primaryKeys: [this.toPrimaryKey(data)],
15267
+ nodePaths: [nodePath],
15268
+ metadata: options?.metadata
15269
+ });
15270
+ if (options?.flush) {
15271
+ this.commit();
15272
+ }
15273
+ return result;
15274
+ };
15275
+ this.removeData = (data, options) => {
15276
+ const isTree = this.getState().isTree;
15277
+ let primaryKeys = !isTree ? [this.toPrimaryKey(data)] : void 0;
15278
+ const nodePath = isTree ? this.getNodePathById(this.toPrimaryKey(data)) : null;
15279
+ let nodePaths = isTree && nodePath ? [nodePath] : void 0;
15280
+ const result = primaryKeys ? this.batchOperation({
15281
+ type: "delete",
15282
+ primaryKeys,
15283
+ metadata: options?.metadata
15284
+ }) : this.batchOperation({
15285
+ type: "delete",
15286
+ nodePaths: nodePaths || [],
13757
15287
  metadata: options?.metadata
13758
15288
  });
13759
15289
  if (options?.flush) {
@@ -13773,9 +15303,18 @@ var DataSourceApiImpl = class {
13773
15303
  return result;
13774
15304
  };
13775
15305
  this.removeDataArray = (data, options) => {
13776
- const result = this.batchOperation({
15306
+ const isTree = this.getState().isTree;
15307
+ const nodePaths = isTree ? data.map((d) => {
15308
+ return this.getNodePathById(this.toPrimaryKey(d)) || [];
15309
+ }) : null;
15310
+ const primaryKeys = !isTree ? data.map(this.toPrimaryKey) : void 0;
15311
+ const result = isTree ? this.batchOperation({
15312
+ type: "delete",
15313
+ nodePaths: nodePaths || [],
15314
+ metadata: options?.metadata
15315
+ }) : this.batchOperation({
13777
15316
  type: "delete",
13778
- primaryKeys: data.map(this.toPrimaryKey),
15317
+ primaryKeys: primaryKeys || [],
13779
15318
  metadata: options?.metadata
13780
15319
  });
13781
15320
  if (options?.flush) {
@@ -13798,6 +15337,7 @@ var DataSourceApiImpl = class {
13798
15337
  this.insertDataArray = (data, options) => {
13799
15338
  let position2 = "before";
13800
15339
  let primaryKey = void 0;
15340
+ let nodePath = options.nodePath;
13801
15341
  if (options.position === "before" || options.position === "after") {
13802
15342
  position2 = options.position;
13803
15343
  primaryKey = options.primaryKey;
@@ -13811,12 +15351,20 @@ var DataSourceApiImpl = class {
13811
15351
  primaryKey = !arr.length ? void 0 : this.toPrimaryKey(arr[arr.length - 1]);
13812
15352
  }
13813
15353
  }
13814
- const result = this.batchOperation({
15354
+ const isTree = this.getState().isTree;
15355
+ const result = isTree ? this.batchOperation({
15356
+ type: "insert",
15357
+ array: data,
15358
+ position: position2,
15359
+ metadata: options?.metadata,
15360
+ nodePath: this.getNodePathById(primaryKey) || []
15361
+ }) : this.batchOperation({
13815
15362
  type: "insert",
13816
15363
  array: data,
13817
15364
  position: position2,
13818
15365
  metadata: options?.metadata,
13819
- primaryKey
15366
+ primaryKey,
15367
+ nodePath
13820
15368
  });
13821
15369
  if (options?.flush) {
13822
15370
  this.commit();
@@ -13895,7 +15443,9 @@ var DataSourceApiImpl = class {
13895
15443
  return rowDisabledState ? rowDisabledState.areAllDisabled() : false;
13896
15444
  };
13897
15445
  this.getState = param.getState;
15446
+ this.getState().__apiRef.current = this;
13898
15447
  this.actions = param.actions;
15448
+ this.treeApi = getTreeApi({ ...param, dataSourceApi: this });
13899
15449
  }
13900
15450
  batchOperation(operation) {
13901
15451
  if (!this.pendingPromise) {
@@ -13931,34 +15481,77 @@ var DataSourceApiImpl = class {
13931
15481
  switch (operation.type) {
13932
15482
  case "update":
13933
15483
  operation.array.forEach((data, index) => {
13934
- const key = operation.primaryKeys[index];
13935
- const rowInfo = this.getRowInfoByPrimaryKey(key);
13936
- if (rowInfo && !rowInfo.isGroupRow) {
13937
- cache.update(
13938
- operation.primaryKeys[index],
13939
- data,
13940
- rowInfo.data,
13941
- operation.metadata
15484
+ if (operation.primaryKeys) {
15485
+ const key = operation.primaryKeys[index];
15486
+ const rowInfo = this.getRowInfoByPrimaryKey(key);
15487
+ if (rowInfo && !rowInfo.isGroupRow) {
15488
+ cache.update(
15489
+ operation.primaryKeys[index],
15490
+ data,
15491
+ rowInfo.data,
15492
+ operation.metadata
15493
+ );
15494
+ }
15495
+ } else if (operation.nodePaths) {
15496
+ const rowInfo = this.getRowInfoByNodePath(
15497
+ operation.nodePaths[index]
13942
15498
  );
15499
+ if (rowInfo && !rowInfo.isGroupRow) {
15500
+ cache.updateNodePath(
15501
+ operation.nodePaths[index],
15502
+ data,
15503
+ rowInfo.data,
15504
+ operation.metadata
15505
+ );
15506
+ }
13943
15507
  }
13944
15508
  });
13945
15509
  break;
13946
15510
  case "delete":
13947
- operation.primaryKeys.forEach((key) => {
13948
- const rowInfo = this.getRowInfoByPrimaryKey(key);
13949
- if (rowInfo && !rowInfo.isGroupRow) {
13950
- cache.delete(key, rowInfo.data, operation.metadata);
13951
- }
13952
- });
15511
+ if (operation.primaryKeys) {
15512
+ operation.primaryKeys.forEach((key) => {
15513
+ const rowInfo = this.getRowInfoByPrimaryKey(key);
15514
+ if (rowInfo && !rowInfo.isGroupRow) {
15515
+ cache.delete(key, rowInfo.data, operation.metadata);
15516
+ }
15517
+ });
15518
+ } else if (operation.nodePaths) {
15519
+ operation.nodePaths.forEach((nodePath2) => {
15520
+ const rowInfo = this.getRowInfoByNodePath(nodePath2);
15521
+ if (rowInfo && !rowInfo.isGroupRow) {
15522
+ cache.deleteNodePath(
15523
+ nodePath2,
15524
+ rowInfo.data,
15525
+ operation.metadata
15526
+ );
15527
+ }
15528
+ });
15529
+ }
13953
15530
  break;
13954
15531
  case "insert":
13955
15532
  let pk = operation.primaryKey;
13956
15533
  let position2 = operation.position;
13957
- operation.array.forEach((data) => {
13958
- cache.insert(pk, data, position2, operation.metadata);
13959
- pk = this.toPrimaryKey(data);
13960
- position2 = "after";
13961
- });
15534
+ let nodePath = operation.nodePath;
15535
+ if (nodePath) {
15536
+ operation.array.forEach((data) => {
15537
+ cache.insertNodePath(
15538
+ nodePath,
15539
+ data,
15540
+ position2,
15541
+ operation.metadata
15542
+ );
15543
+ pk = this.toPrimaryKey(data);
15544
+ nodePath.pop();
15545
+ nodePath.push(pk);
15546
+ position2 = "after";
15547
+ });
15548
+ } else {
15549
+ operation.array.forEach((data) => {
15550
+ cache.insert(pk, data, position2, operation.metadata);
15551
+ pk = this.toPrimaryKey(data);
15552
+ position2 = "after";
15553
+ });
15554
+ }
13962
15555
  break;
13963
15556
  case "replace-all":
13964
15557
  cache.resetDataSource(operation.metadata);
@@ -13991,16 +15584,25 @@ function getCacheAffectedParts(state) {
13991
15584
  return {
13992
15585
  sortInfo: false,
13993
15586
  groupBy: false,
15587
+ tree: false,
13994
15588
  filterValue: false,
13995
15589
  aggregationReducers: false
13996
15590
  };
13997
15591
  }
13998
15592
  let sortInfoAffected = false;
13999
15593
  let groupByAffected = false;
15594
+ let treeAffected = false;
14000
15595
  let filterAffected = false;
14001
15596
  let aggregationsAffected = false;
14002
15597
  const keys = cache.getAffectedFields();
14003
- const { sortInfo, groupBy, filterValue, aggregationReducers } = state;
15598
+ const {
15599
+ sortInfo,
15600
+ groupBy,
15601
+ filterValue,
15602
+ aggregationReducers,
15603
+ nodesKey,
15604
+ isTree
15605
+ } = state;
14004
15606
  if (sortInfo && sortInfo.length) {
14005
15607
  if (keys === true) {
14006
15608
  sortInfoAffected = true;
@@ -14031,6 +15633,13 @@ function getCacheAffectedParts(state) {
14031
15633
  }
14032
15634
  }
14033
15635
  }
15636
+ if (isTree) {
15637
+ if (keys === true) {
15638
+ treeAffected = true;
15639
+ } else {
15640
+ treeAffected = keys.has(nodesKey);
15641
+ }
15642
+ }
14034
15643
  if (filterValue && filterValue.length) {
14035
15644
  if (keys === true) {
14036
15645
  filterAffected = true;
@@ -14070,7 +15679,8 @@ function getCacheAffectedParts(state) {
14070
15679
  sortInfo: sortInfoAffected,
14071
15680
  groupBy: groupByAffected,
14072
15681
  filterValue: filterAffected,
14073
- aggregationReducers: aggregationsAffected
15682
+ aggregationReducers: aggregationsAffected,
15683
+ tree: treeAffected
14074
15684
  };
14075
15685
  }
14076
15686
 
@@ -14153,6 +15763,7 @@ function returnFalse2() {
14153
15763
  function toRowInfo(data, id, index, isRowSelected, isRowDisabled, cellSelectionState) {
14154
15764
  const rowInfo = {
14155
15765
  dataSourceHasGrouping: false,
15766
+ isTreeNode: false,
14156
15767
  data,
14157
15768
  id,
14158
15769
  indexInAll: index,
@@ -14269,17 +15880,29 @@ function concludeReducer(params) {
14269
15880
  originalDataArrayChanged = true;
14270
15881
  }
14271
15882
  const toPrimaryKey = state.toPrimaryKey;
15883
+ const nodesKey = state.nodesKey;
15884
+ const getNodeChildren = nodesKey ? (node) => {
15885
+ return node[nodesKey];
15886
+ } : void 0;
15887
+ const isLeafNode = nodesKey ? (node) => {
15888
+ return node[nodesKey] === void 0;
15889
+ } : void 0;
14272
15890
  let mutations;
15891
+ let treeMutations;
14273
15892
  const shouldIndex = originalDataArrayChanged;
14274
15893
  if (shouldIndex) {
14275
15894
  state.indexer.clear();
14276
15895
  if (!state.lazyLoad) {
14277
15896
  mutations = cache?.getMutations();
15897
+ treeMutations = cache?.getTreeMutations();
14278
15898
  state.originalDataArray = state.indexer.indexArray(
14279
15899
  state.originalDataArray,
14280
15900
  {
14281
15901
  toPrimaryKey,
14282
- cache
15902
+ cache,
15903
+ getNodeChildren,
15904
+ isLeafNode,
15905
+ nodesKey
14283
15906
  }
14284
15907
  );
14285
15908
  }
@@ -14303,7 +15926,9 @@ function concludeReducer(params) {
14303
15926
  const shouldSortAgain = shouldSort && (sortDepsChanged || !state.lastSortDataArray || cacheAffectedParts.sortInfo);
14304
15927
  const groupBy = state.groupBy;
14305
15928
  const pivotBy = state.pivotBy;
14306
- const shouldGroup = groupBy.length > 0 || !!pivotBy;
15929
+ const isTree = state.isTree;
15930
+ const shouldGroup = !isTree && (groupBy.length > 0 || !!pivotBy);
15931
+ const shouldTree = isTree;
14307
15932
  const rowDisabledStateDepsChanged = haveDepsChanged(previousState, state, [
14308
15933
  "rowDisabledState",
14309
15934
  "isRowDisabled"
@@ -14314,6 +15939,12 @@ function concludeReducer(params) {
14314
15939
  "isRowSelected",
14315
15940
  "originalLazyGroupDataChangeDetect"
14316
15941
  ]);
15942
+ const treeSelectionDepsChanged = haveDepsChanged(previousState, state, [
15943
+ "treeSelection",
15944
+ "cellSelection",
15945
+ "isNodeSelected",
15946
+ "originalLazyGroupDataChangeDetect"
15947
+ ]);
14317
15948
  const groupsDepsChanged = originalDataArrayChanged || sortDepsChanged || haveDepsChanged(previousState, state, [
14318
15949
  "generateGroupRows",
14319
15950
  "originalLazyGroupData",
@@ -14324,12 +15955,25 @@ function concludeReducer(params) {
14324
15955
  "aggregationReducers",
14325
15956
  "pivotTotalColumnPosition",
14326
15957
  "pivotGrandTotalColumnPosition",
14327
- "showSeparatePivotColumnForSingleAggregation"
15958
+ "showSeparatePivotColumnForSingleAggregation",
15959
+ "repeatWrappedGroupRows",
15960
+ "rowsPerPage"
15961
+ ]);
15962
+ const treeDepsChanged = originalDataArrayChanged || sortDepsChanged || haveDepsChanged(previousState, state, [
15963
+ "originalLazyGroupData",
15964
+ "originalLazyGroupDataChangeDetect",
15965
+ "treeExpandState",
15966
+ "isNodeExpanded",
15967
+ "isNodeCollapsed",
15968
+ "aggregationReducers",
15969
+ "repeatWrappedGroupRows",
15970
+ "rowsPerPage"
14328
15971
  ]);
14329
15972
  const rowInfoReducersChanged = haveDepsChanged(previousState, state, [
14330
15973
  "rowInfoReducers"
14331
15974
  ]);
14332
15975
  const shouldGroupAgain = shouldGroup && (groupsDepsChanged || !state.lastGroupDataArray || cacheAffectedParts.groupBy) || selectionDepsChanged || rowDisabledStateDepsChanged || rowInfoReducersChanged;
15976
+ const shouldTreeAgain = shouldTree && (treeDepsChanged || cacheAffectedParts.tree || !state.lastTreeDataArray) || treeSelectionDepsChanged || rowDisabledStateDepsChanged || rowInfoReducersChanged;
14333
15977
  const now = Date.now();
14334
15978
  let dataArray = state.originalDataArray;
14335
15979
  if (!shouldFilter) {
@@ -14353,8 +15997,25 @@ function concludeReducer(params) {
14353
15997
  if (shouldSort) {
14354
15998
  const prevKnownTypes = multisort.knownTypes;
14355
15999
  multisort.knownTypes = { ...prevKnownTypes, ...state.sortTypes };
14356
- const sortFn = state.sortFunction || multisort;
14357
- dataArray = shouldSortAgain ? sortFn(sortInfo, [...dataArray]) : state.lastSortDataArray;
16000
+ if (shouldSortAgain) {
16001
+ if (state.sortFunction) {
16002
+ dataArray = state.sortFunction(sortInfo, [...dataArray]);
16003
+ } else {
16004
+ if (isTree) {
16005
+ dataArray = multisortNested(sortInfo, dataArray, {
16006
+ inplace: false,
16007
+ isLeafNode,
16008
+ getNodeChildren,
16009
+ toKey: toPrimaryKey,
16010
+ nodesKey
16011
+ });
16012
+ } else {
16013
+ dataArray = multisort(sortInfo, [...dataArray]);
16014
+ }
16015
+ }
16016
+ } else {
16017
+ dataArray = state.lastSortDataArray;
16018
+ }
14358
16019
  multisort.knownTypes = prevKnownTypes;
14359
16020
  state.lastSortDataArray = dataArray;
14360
16021
  state.sortedAt = now;
@@ -14362,6 +16023,7 @@ function concludeReducer(params) {
14362
16023
  state.postSortDataArray = dataArray;
14363
16024
  let rowInfoDataArray = state.dataArray;
14364
16025
  const rowSelectionState = state.rowSelection instanceof RowSelectionState ? state.rowSelection : void 0;
16026
+ const treeExpandState = state.treeExpandState instanceof TreeExpandState ? state.treeExpandState : void 0;
14365
16027
  const cellSelectionState = state.cellSelection instanceof CellSelectionState ? state.cellSelection : void 0;
14366
16028
  rowSelectionState?.xcache();
14367
16029
  let isRowSelected = state.selectionMode === "single-row" ? (rowInfo) => {
@@ -14381,6 +16043,19 @@ function concludeReducer(params) {
14381
16043
  state.selectionMode
14382
16044
  );
14383
16045
  }
16046
+ let isNodeExpanded = state.isNodeExpanded;
16047
+ if (state.isNodeCollapsed) {
16048
+ isNodeExpanded = (rowInfo) => !state.isNodeExpanded(rowInfo);
16049
+ }
16050
+ if (!isNodeExpanded) {
16051
+ const defaultIsRowExpanded = (rowInfo) => {
16052
+ if (!rowInfo.isTreeNode || !rowInfo.isParentNode) {
16053
+ return false;
16054
+ }
16055
+ return treeExpandState.isNodeExpanded(rowInfo.nodePath);
16056
+ };
16057
+ isNodeExpanded = defaultIsRowExpanded;
16058
+ }
14384
16059
  const rowInfoReducers = state.rowInfoReducers;
14385
16060
  if (shouldGroup) {
14386
16061
  if (shouldGroupAgain) {
@@ -14435,16 +16110,103 @@ function concludeReducer(params) {
14435
16110
  withRowInfoForReducers,
14436
16111
  withRowInfoForCellSelection
14437
16112
  ) : void 0;
14438
- const flattenResult = enhancedFlatten({
14439
- groupResult,
14440
- lazyLoad: !!state.lazyLoad,
16113
+ const flattenResult = enhancedFlatten({
16114
+ groupResult,
16115
+ lazyLoad: !!state.lazyLoad,
16116
+ reducers: aggregationReducers,
16117
+ toPrimaryKey,
16118
+ isRowSelected,
16119
+ rowSelectionState,
16120
+ withRowInfo,
16121
+ repeatWrappedGroupRows: state.rowsPerPage != null ? state.repeatWrappedGroupRows : false,
16122
+ rowsPerPage: state.rowsPerPage,
16123
+ groupRowsState: state.groupRowsState,
16124
+ generateGroupRows: state.generateGroupRows
16125
+ });
16126
+ rowInfoDataArray = flattenResult.data;
16127
+ state.rowInfoReducerResults = finishRowInfoReducersFor({
16128
+ reducers: rowInfoReducers,
16129
+ results: rowInfoReducerResults,
16130
+ array: rowInfoDataArray
16131
+ });
16132
+ state.groupRowsIndexesInDataArray = flattenResult.groupRowsIndexes;
16133
+ state.reducerResults = groupResult.reducerResults;
16134
+ const pivotGroupsAndCols = pivotBy ? getPivotColumnsAndColumnGroups({
16135
+ deepMap: groupResult.topLevelPivotColumns,
16136
+ pivotBy,
16137
+ pivotTotalColumnPosition: state.pivotTotalColumnPosition ?? "end",
16138
+ pivotGrandTotalColumnPosition: state.pivotGrandTotalColumnPosition ?? false,
16139
+ reducers: state.aggregationReducers,
16140
+ showSeparatePivotColumnForSingleAggregation: state.showSeparatePivotColumnForSingleAggregation
16141
+ }) : void 0;
16142
+ state.pivotColumns = pivotGroupsAndCols?.columns;
16143
+ state.pivotColumnGroups = pivotGroupsAndCols?.columnGroups;
16144
+ } else {
16145
+ rowInfoDataArray = state.lastGroupDataArray;
16146
+ }
16147
+ state.lastGroupDataArray = rowInfoDataArray;
16148
+ state.groupedAt = now;
16149
+ } else if (shouldTree) {
16150
+ if (shouldTreeAgain) {
16151
+ let aggregationReducers = state.aggregationReducers;
16152
+ const treeParams = {
16153
+ isLeafNode,
16154
+ getNodeChildren,
16155
+ toKey: toPrimaryKey,
16156
+ reducers: aggregationReducers
16157
+ };
16158
+ const treeResult = tree(treeParams, dataArray);
16159
+ state.treeDeepMap = treeResult.deepMap;
16160
+ state.treePaths = treeResult.treePaths;
16161
+ const treeSelectionState = state.selectionMode === "multi-row" ? getTreeSelectionState(
16162
+ state.treeSelection,
16163
+ state.selectionMode,
16164
+ state
16165
+ ) : void 0;
16166
+ state.treeSelectionState = treeSelectionState;
16167
+ const rowInfoReducerKeys = Object.keys(
16168
+ rowInfoReducers || {}
16169
+ );
16170
+ const rowInfoReducerResults = initRowInfoReducers(
16171
+ rowInfoReducers
16172
+ );
16173
+ const rowInfoReducersShape = {
16174
+ reducers: rowInfoReducers,
16175
+ results: rowInfoReducerResults,
16176
+ reducerKeys: rowInfoReducerKeys,
16177
+ rowInfo: {}
16178
+ };
16179
+ const withRowInfoForReducers = rowInfoReducerResults ? (rowInfo) => {
16180
+ rowInfoReducersShape.rowInfo = rowInfo;
16181
+ computeRowInfoReducersFor(rowInfoReducersShape);
16182
+ } : void 0;
16183
+ const withRowInfoForCellSelection = cellSelectionState ? (rowInfo) => {
16184
+ rowInfo.isCellSelected = (colId) => {
16185
+ return cellSelectionState.isCellSelected(rowInfo.id, colId);
16186
+ };
16187
+ } : void 0;
16188
+ const withRowInfo = withRowInfoForReducers || withRowInfoForCellSelection ? composeFunctions(
16189
+ withRowInfoForReducers,
16190
+ withRowInfoForCellSelection
16191
+ ) : void 0;
16192
+ let isNodeSelected = state.selectionMode === "single-row" ? (rowInfo) => {
16193
+ return rowInfo.id === state.treeSelection;
16194
+ } : state.selectionMode === "multi-row" ? (rowInfo) => {
16195
+ return treeSelectionState.isNodeSelected(rowInfo.nodePath);
16196
+ } : void 0;
16197
+ const repeatWrappedGroupRows = state.rowsPerPage != null ? state.repeatWrappedGroupRows : false;
16198
+ const flattenResult = enhancedTreeFlatten({
16199
+ treeResult,
16200
+ treeParams,
16201
+ dataArray,
14441
16202
  reducers: aggregationReducers,
14442
16203
  toPrimaryKey,
14443
- isRowSelected,
14444
- rowSelectionState,
16204
+ isNodeSelected,
16205
+ isNodeExpanded,
16206
+ treeSelectionState,
14445
16207
  withRowInfo,
14446
- groupRowsState: state.groupRowsState,
14447
- generateGroupRows: state.generateGroupRows
16208
+ repeatWrappedGroupRows,
16209
+ rowsPerPage: state.rowsPerPage
14448
16210
  });
14449
16211
  rowInfoDataArray = flattenResult.data;
14450
16212
  state.rowInfoReducerResults = finishRowInfoReducersFor({
@@ -14452,23 +16214,13 @@ function concludeReducer(params) {
14452
16214
  results: rowInfoReducerResults,
14453
16215
  array: rowInfoDataArray
14454
16216
  });
14455
- state.groupRowsIndexesInDataArray = flattenResult.groupRowsIndexes;
14456
- state.reducerResults = groupResult.reducerResults;
14457
- const pivotGroupsAndCols = pivotBy ? getPivotColumnsAndColumnGroups({
14458
- deepMap: groupResult.topLevelPivotColumns,
14459
- pivotBy,
14460
- pivotTotalColumnPosition: state.pivotTotalColumnPosition ?? "end",
14461
- pivotGrandTotalColumnPosition: state.pivotGrandTotalColumnPosition ?? false,
14462
- reducers: state.aggregationReducers,
14463
- showSeparatePivotColumnForSingleAggregation: state.showSeparatePivotColumnForSingleAggregation
14464
- }) : void 0;
14465
- state.pivotColumns = pivotGroupsAndCols?.columns;
14466
- state.pivotColumnGroups = pivotGroupsAndCols?.columnGroups;
16217
+ state.reducerResults = treeResult.reducerResults;
16218
+ state.totalLeafNodesCount = treeResult.deepMap.get([])?.totalLeafNodesCount ?? 0;
16219
+ state.treeAt = now;
14467
16220
  } else {
14468
- rowInfoDataArray = state.lastGroupDataArray;
16221
+ rowInfoDataArray = state.lastTreeDataArray;
14469
16222
  }
14470
- state.lastGroupDataArray = rowInfoDataArray;
14471
- state.groupedAt = now;
16223
+ state.lastTreeDataArray = rowInfoDataArray;
14472
16224
  } else {
14473
16225
  state.groupDeepMap = void 0;
14474
16226
  state.pivotColumns = void 0;
@@ -14520,6 +16272,9 @@ function concludeReducer(params) {
14520
16272
  let allRowsSelected = true;
14521
16273
  let someRowsSelected = false;
14522
16274
  state.dataArray.forEach((rowInfo) => {
16275
+ if (rowInfo.isTreeNode) {
16276
+ return;
16277
+ }
14523
16278
  if (rowInfo.isGroupRow && rowInfo.groupKeys.length === 1) {
14524
16279
  const { rowSelected } = rowInfo;
14525
16280
  if (rowSelected !== true) {
@@ -14533,8 +16288,8 @@ function concludeReducer(params) {
14533
16288
  state.allRowsSelected = allRowsSelected;
14534
16289
  state.someRowsSelected = someRowsSelected;
14535
16290
  } else {
14536
- const dataArrayCount = state.filteredCount;
14537
- const selectedRowCount = state.rowSelection.getSelectedCount();
16291
+ const dataArrayCount = state.isTree ? state.totalLeafNodesCount : state.filteredCount;
16292
+ const selectedRowCount = state.isTree ? state.treeSelectionState ? state.treeSelectionState.getSelectedCount() : 0 : state.rowSelection.getSelectedCount();
14538
16293
  state.allRowsSelected = dataArrayCount === selectedRowCount;
14539
16294
  state.someRowsSelected = selectedRowCount > 0;
14540
16295
  }
@@ -14546,7 +16301,8 @@ function concludeReducer(params) {
14546
16301
  if (originalDataArrayChanged) {
14547
16302
  state.originalDataArrayChangedInfo = {
14548
16303
  timestamp: now,
14549
- mutations: mutations?.size ? mutations : void 0
16304
+ mutations: mutations?.size ? mutations : void 0,
16305
+ treeMutations: treeMutations?.size ? treeMutations : void 0
14550
16306
  };
14551
16307
  }
14552
16308
  return state;
@@ -15231,10 +16987,22 @@ function initSetupState() {
15231
16987
  return {
15232
16988
  // TODO cleanup indexer on unmount
15233
16989
  indexer: new Indexer(),
16990
+ totalLeafNodesCount: 0,
16991
+ __apiRef: { current: null },
16992
+ repeatWrappedGroupRows: false,
15234
16993
  destroyedRef: {
15235
16994
  current: false
15236
16995
  },
16996
+ lastSelectionUpdatedNodePathRef: { current: null },
16997
+ lastExpandStateInfoRef: {
16998
+ current: {
16999
+ state: "collapsed",
17000
+ nodePath: null
17001
+ }
17002
+ },
15237
17003
  idToIndexMap: /* @__PURE__ */ new Map(),
17004
+ idToPathMap: /* @__PURE__ */ new Map(),
17005
+ pathToIndexDeepMap: new DeepMap(),
15238
17006
  getDataSourceMasterContextRef: { current: () => void 0 },
15239
17007
  // TODO: cleanup cache on unmount
15240
17008
  cache: void 0,
@@ -15245,6 +17013,7 @@ function initSetupState() {
15245
17013
  timestamp: 0,
15246
17014
  mutations: void 0
15247
17015
  },
17016
+ rowsPerPage: null,
15248
17017
  lazyLoadCacheOfLoadedBatches: new DeepMap(),
15249
17018
  dataParams: void 0,
15250
17019
  onCleanup: buildSubscriptionCallback(),
@@ -15273,6 +17042,7 @@ function initSetupState() {
15273
17042
  updatedAt: now,
15274
17043
  groupedAt: 0,
15275
17044
  sortedAt: 0,
17045
+ treeAt: 0,
15276
17046
  filteredAt: 0,
15277
17047
  reducedAt: now,
15278
17048
  generateGroupRows: true,
@@ -15297,16 +17067,35 @@ function getCompareObjectForDataParams(dataParams) {
15297
17067
  var EMPTY_ARRAY2 = [];
15298
17068
  var cleanupDataSource = (state) => {
15299
17069
  state.destroyedRef.current = true;
17070
+ state.__apiRef.current = null;
17071
+ state.lastSelectionUpdatedNodePathRef.current = null;
17072
+ state.lastExpandStateInfoRef.current = {
17073
+ state: "collapsed",
17074
+ nodePath: null
17075
+ };
17076
+ state.treeExpandState?.destroy();
17077
+ state.treePaths?.clear();
17078
+ state.pathToIndexDeepMap?.clear();
17079
+ state.rowDisabledState?.destroy();
17080
+ state.groupRowsState?.destroy();
17081
+ state.treeSelectionState?.destroy();
17082
+ state.idToPathMap.clear();
17083
+ state.idToIndexMap.clear();
15300
17084
  };
15301
- var forwardProps3 = (setupState) => {
17085
+ var forwardProps3 = (setupState, props) => {
15302
17086
  return {
15303
17087
  onDataParamsChange: (fn) => fn ? discardCallsWithEqualArg(fn, 100, getCompareObjectForDataParams) : void 0,
15304
17088
  lazyLoad: (lazyLoad) => !!lazyLoad,
15305
17089
  data: 1,
15306
17090
  debugId: 1,
17091
+ nodesKey: 1,
17092
+ isNodeExpanded: 1,
17093
+ isNodeCollapsed: 1,
15307
17094
  pivotBy: 1,
15308
17095
  primaryKey: 1,
17096
+ debugMode: 1,
15309
17097
  livePagination: 1,
17098
+ treeSelection: 1,
15310
17099
  refetchKey: (refetchKey) => refetchKey ?? "",
15311
17100
  filterFunction: 1,
15312
17101
  filterValue: 1,
@@ -15326,18 +17115,48 @@ var forwardProps3 = (setupState) => {
15326
17115
  state.idToIndexMap.clear();
15327
17116
  },
15328
17117
  reducer: (_, rowInfo) => {
17118
+ if (props.debugMode && !props.nodesKey && state.idToIndexMap.has(rowInfo.id)) {
17119
+ console.warn(`Duplicate id found in data source: ${rowInfo.id}`);
17120
+ }
15329
17121
  state.idToIndexMap.set(rowInfo.id, rowInfo.indexInAll);
15330
17122
  }
15331
17123
  };
15332
- return reducers ? {
17124
+ const result = reducers ? {
15333
17125
  ...reducers,
15334
17126
  __idToIndex: idToIndexReducer
15335
17127
  } : {
15336
17128
  __idToIndex: idToIndexReducer
15337
17129
  };
17130
+ if (props.nodesKey) {
17131
+ const pathToIndexReducer = {
17132
+ initialValue: () => {
17133
+ state.idToPathMap.clear();
17134
+ state.pathToIndexDeepMap.clear();
17135
+ },
17136
+ reducer: (_, rowInfo) => {
17137
+ if (rowInfo.isTreeNode) {
17138
+ state.idToPathMap.set(rowInfo.id, rowInfo.nodePath);
17139
+ if (props.debugMode && state.pathToIndexDeepMap.has(rowInfo.nodePath)) {
17140
+ console.warn(
17141
+ `Duplicate node path found in data source (debugId: ${props.debugId || "none"}): ${rowInfo.nodePath}`
17142
+ );
17143
+ }
17144
+ state.pathToIndexDeepMap.set(
17145
+ rowInfo.nodePath,
17146
+ rowInfo.indexInAll
17147
+ );
17148
+ }
17149
+ }
17150
+ };
17151
+ result.__pathToIndex = pathToIndexReducer;
17152
+ }
17153
+ return result;
15338
17154
  },
17155
+ onNodeCollapse: 1,
17156
+ onNodeExpand: 1,
15339
17157
  batchOperationDelay: 1,
15340
17158
  isRowSelected: 1,
17159
+ isNodeSelected: 1,
15341
17160
  isRowDisabled: 1,
15342
17161
  rowDisabledState: (rowDisabledState) => {
15343
17162
  if (!rowDisabledState) {
@@ -15359,6 +17178,7 @@ var forwardProps3 = (setupState) => {
15359
17178
  },
15360
17179
  onDataArrayChange: 1,
15361
17180
  onDataMutations: 1,
17181
+ onTreeDataMutations: 1,
15362
17182
  aggregationReducers: 1,
15363
17183
  collapseGroupRowsOnDataFunctionChange: (collapseGroupRowsOnDataFunctionChange) => collapseGroupRowsOnDataFunctionChange ?? true,
15364
17184
  loading: (loading) => loading ?? false,
@@ -15375,8 +17195,64 @@ function getLivePaginationCursorValue(livePaginationCursorProp, state) {
15375
17195
  return livePaginationCursor;
15376
17196
  }
15377
17197
  var weakMap = /* @__PURE__ */ new WeakMap();
17198
+ function toShouldReloadObject(shouldReloadData) {
17199
+ if (typeof shouldReloadData === "boolean") {
17200
+ return {
17201
+ filterValue: shouldReloadData,
17202
+ sortInfo: shouldReloadData,
17203
+ groupBy: shouldReloadData,
17204
+ pivotBy: shouldReloadData
17205
+ };
17206
+ }
17207
+ const result = {};
17208
+ if (shouldReloadData.filterValue != null) {
17209
+ result.filterValue = shouldReloadData.filterValue;
17210
+ }
17211
+ if (shouldReloadData.sortInfo != null) {
17212
+ result.sortInfo = shouldReloadData.sortInfo;
17213
+ }
17214
+ if (shouldReloadData.groupBy != null) {
17215
+ result.groupBy = shouldReloadData.groupBy;
17216
+ }
17217
+ if (shouldReloadData.pivotBy != null) {
17218
+ result.pivotBy = shouldReloadData.pivotBy;
17219
+ }
17220
+ return result;
17221
+ }
17222
+ var treeSelectionStateDefaultObject = {
17223
+ selectedPaths: [],
17224
+ deselectedPaths: [],
17225
+ defaultSelection: false
17226
+ };
17227
+ function getTreeSelectionState(currentTreeSelection, selectionMode, state) {
17228
+ if (selectionMode != "multi-row") {
17229
+ throw new Error(
17230
+ `TreeSelectionState is only supported for multi-row selection. Your current selection mode is "${selectionMode}". See https://infinite-table.com/docs/reference/datasource-props#selectionMode for details.
17231
+
17232
+
17233
+ `
17234
+ );
17235
+ }
17236
+ const config = treeSelectionStateConfigGetter(state);
17237
+ if (currentTreeSelection instanceof TreeSelectionState) {
17238
+ currentTreeSelection.setConfigFn(config);
17239
+ return currentTreeSelection;
17240
+ }
17241
+ if (currentTreeSelection === null || currentTreeSelection === void 0 || typeof currentTreeSelection != "object") {
17242
+ currentTreeSelection = void 0;
17243
+ }
17244
+ const treeSelectionStateObject = currentTreeSelection ?? treeSelectionStateDefaultObject;
17245
+ let instance = weakMap.get(treeSelectionStateObject);
17246
+ if (instance) {
17247
+ instance.setConfigFn(config);
17248
+ }
17249
+ instance = instance ?? new TreeSelectionState(treeSelectionStateObject, config);
17250
+ weakMap.set(treeSelectionStateObject, instance);
17251
+ return instance;
17252
+ }
15378
17253
  function deriveStateFromProps(params) {
15379
17254
  const { props, state, oldState } = params;
17255
+ const isTree = !!state.nodesKey;
15380
17256
  const controlledSort = isControlledValue(props.sortInfo);
15381
17257
  const controlledFilter = isControlledValue(props.filterValue);
15382
17258
  const { filterTypes } = state;
@@ -15409,29 +17285,31 @@ function deriveStateFromProps(params) {
15409
17285
  let cellSelectionState = null;
15410
17286
  let currentRowSelection = props.rowSelection !== void 0 ? props.rowSelection : state.rowSelection === void 0 ? props.defaultRowSelection !== void 0 ? props.defaultRowSelection : null : state.rowSelection;
15411
17287
  let currentCellSelection = props.cellSelection !== void 0 ? props.cellSelection : state.cellSelection === void 0 ? props.defaultCellSelection !== void 0 ? props.defaultCellSelection : null : state.cellSelection || null;
15412
- if (selectionMode !== false) {
15413
- if (selectionMode === "single-row" || selectionMode === "multi-row") {
15414
- if (currentRowSelection === null) {
15415
- rowSelectionState = selectionMode === "single-row" ? null : new RowSelectionState(
15416
- {
15417
- selectedRows: [],
15418
- deselectedRows: [],
15419
- defaultSelection: false
15420
- },
15421
- rowSelectionStateConfigGetter(state)
15422
- );
15423
- } else {
15424
- if (selectionMode === "single-row") {
15425
- rowSelectionState = currentRowSelection;
17288
+ if (!isTree) {
17289
+ if (selectionMode !== false) {
17290
+ if (selectionMode === "single-row" || selectionMode === "multi-row") {
17291
+ if (currentRowSelection === null) {
17292
+ rowSelectionState = selectionMode === "single-row" ? null : new RowSelectionState(
17293
+ {
17294
+ selectedRows: [],
17295
+ deselectedRows: [],
17296
+ defaultSelection: false
17297
+ },
17298
+ rowSelectionStateConfigGetter(state)
17299
+ );
15426
17300
  } else {
15427
- if (currentRowSelection instanceof RowSelectionState) {
17301
+ if (selectionMode === "single-row") {
15428
17302
  rowSelectionState = currentRowSelection;
15429
17303
  } else {
15430
- const instance = new RowSelectionState(
15431
- currentRowSelection,
15432
- rowSelectionStateConfigGetter(state)
15433
- );
15434
- rowSelectionState = instance;
17304
+ if (currentRowSelection instanceof RowSelectionState) {
17305
+ rowSelectionState = currentRowSelection;
17306
+ } else {
17307
+ const instance = new RowSelectionState(
17308
+ currentRowSelection,
17309
+ rowSelectionStateConfigGetter(state)
17310
+ );
17311
+ rowSelectionState = instance;
17312
+ }
15435
17313
  }
15436
17314
  }
15437
17315
  }
@@ -15454,9 +17332,22 @@ function deriveStateFromProps(params) {
15454
17332
  }
15455
17333
  const primaryKeyDescriptor = state.primaryKey;
15456
17334
  const toPrimaryKey = typeof primaryKeyDescriptor === "function" ? (data) => primaryKeyDescriptor(data) : (data) => data[primaryKeyDescriptor];
17335
+ const treeProps = props;
17336
+ let treeExpandState = treeProps.treeExpandState || state.treeExpandState || treeProps.defaultTreeExpandState;
17337
+ if (treeExpandState && !(treeExpandState instanceof TreeExpandState)) {
17338
+ const instance = weakMap.get(treeExpandState) ?? new TreeExpandState(treeExpandState);
17339
+ weakMap.set(treeExpandState, instance);
17340
+ treeExpandState = instance;
17341
+ }
17342
+ treeExpandState = treeExpandState || new TreeExpandState({
17343
+ defaultExpanded: true,
17344
+ collapsedPaths: []
17345
+ });
15457
17346
  let groupRowsState = props.groupRowsState || state.groupRowsState || props.defaultGroupRowsState;
15458
17347
  if (groupRowsState && !(groupRowsState instanceof GroupRowsState)) {
15459
- groupRowsState = new GroupRowsState(groupRowsState);
17348
+ const instance = weakMap.get(groupRowsState) ?? new GroupRowsState(groupRowsState);
17349
+ weakMap.set(groupRowsState, instance);
17350
+ groupRowsState = instance;
15460
17351
  }
15461
17352
  groupRowsState = groupRowsState || new GroupRowsState(
15462
17353
  state.lazyLoad ? { expandedRows: [], collapsedRows: true } : {
@@ -15464,7 +17355,7 @@ function deriveStateFromProps(params) {
15464
17355
  collapsedRows: []
15465
17356
  }
15466
17357
  );
15467
- const { shouldReloadData = {} } = props;
17358
+ const shouldReloadData = toShouldReloadObject(props.shouldReloadData || {});
15468
17359
  const propsGroupMode = props.groupMode ?? (shouldReloadData.groupBy != null ? shouldReloadData.groupBy ? "remote" : "local" : void 0);
15469
17360
  const propsSortMode = props.sortMode ?? shouldReloadData.sortInfo != null ? shouldReloadData.sortInfo ? "remote" : "local" : void 0;
15470
17361
  const propsFilterMode = props.filterMode ?? shouldReloadData.filterValue != null ? shouldReloadData.filterValue ? "remote" : "local" : void 0;
@@ -15507,8 +17398,11 @@ function deriveStateFromProps(params) {
15507
17398
  }
15508
17399
  }
15509
17400
  const result = {
17401
+ isTree,
15510
17402
  selectionMode,
15511
17403
  groupRowsState,
17404
+ treeExpandState,
17405
+ treeExpandMode: treeExpandState.mode,
15512
17406
  shouldReloadData: {
15513
17407
  // #sortMode_vs_shouldReloadData.sortInfo
15514
17408
  // we reconstruct this object
@@ -15517,10 +17411,10 @@ function deriveStateFromProps(params) {
15517
17411
  // since we want a subtle difference between the computed sortMode and shouldReloadData.sortInfo (for example)
15518
17412
  // difference: sortMode will be local when sortFunction is provided, however, the user may want to reload data when sortInfo changes
15519
17413
  // and thus the data will be refetched, but will be sorted locally
15520
- filterValue: props.shouldReloadData?.filterValue ?? filterMode === "remote",
15521
- sortInfo: props.shouldReloadData?.sortInfo ?? sortMode === "remote",
15522
- groupBy: props.shouldReloadData?.groupBy ?? groupMode === "remote",
15523
- pivotBy: props.shouldReloadData?.pivotBy ?? pivotMode === "remote"
17414
+ filterValue: shouldReloadData?.filterValue ?? filterMode === "remote",
17415
+ sortInfo: shouldReloadData?.sortInfo ?? sortMode === "remote",
17416
+ groupBy: shouldReloadData?.groupBy ?? groupMode === "remote",
17417
+ pivotBy: shouldReloadData?.pivotBy ?? pivotMode === "remote"
15524
17418
  },
15525
17419
  isRowDisabled,
15526
17420
  rowSelection: rowSelectionState,
@@ -15579,6 +17473,41 @@ function getMappedCallbacks() {
15579
17473
  ]
15580
17474
  };
15581
17475
  },
17476
+ treeSelection: (treeSelection, state) => {
17477
+ if (state.selectionMode === "single-row") {
17478
+ const callbackParams2 = [
17479
+ treeSelection,
17480
+ { selectionMode: "single-row" }
17481
+ ];
17482
+ return {
17483
+ callbackParams: callbackParams2
17484
+ };
17485
+ }
17486
+ const callbackParams = [
17487
+ treeSelection.getState(),
17488
+ {
17489
+ selectionMode: "multi-row",
17490
+ lastUpdatedNodePath: state.lastSelectionUpdatedNodePathRef.current,
17491
+ dataSourceApi: state.__apiRef.current
17492
+ }
17493
+ ];
17494
+ return {
17495
+ callbackParams
17496
+ };
17497
+ },
17498
+ treeExpandState: (treeExpandState, state) => {
17499
+ const callbackParams = [
17500
+ treeExpandState.getState(),
17501
+ {
17502
+ nodeState: state.lastExpandStateInfoRef.current.state,
17503
+ nodePath: state.lastExpandStateInfoRef.current.nodePath,
17504
+ dataSourceApi: state.__apiRef.current
17505
+ }
17506
+ ];
17507
+ return {
17508
+ callbackParams
17509
+ };
17510
+ },
15582
17511
  cellSelection: (cellSelection, state) => {
15583
17512
  if (state.selectionMode === "single-cell") {
15584
17513
  return {
@@ -15809,6 +17738,14 @@ function useDataSourceInternal(props) {
15809
17738
  timestamp: componentState.originalDataArrayChangedInfo.timestamp
15810
17739
  });
15811
17740
  }
17741
+ if (componentState.onTreeDataMutations && componentState.originalDataArrayChangedInfo.treeMutations && componentState.originalDataArrayChangedInfo.treeMutations.size) {
17742
+ componentState.onTreeDataMutations({
17743
+ nodesKey: componentState.nodesKey ? componentState.nodesKey : void 0,
17744
+ dataArray: componentState.originalDataArray,
17745
+ treeMutations: componentState.originalDataArrayChangedInfo.treeMutations,
17746
+ timestamp: componentState.originalDataArrayChangedInfo.timestamp
17747
+ });
17748
+ }
15812
17749
  }, [componentState.originalDataArrayChangedInfo]);
15813
17750
  useEffect20(() => {
15814
17751
  componentState.onReady?.(api);
@@ -16096,16 +18033,7 @@ function notNullable(value) {
16096
18033
  return true;
16097
18034
  }
16098
18035
 
16099
- // src/components/InfiniteTable/api/getCellSelectionApi.ts
16100
- function ensureSortedPerOrder(arr, sortPattern) {
16101
- const arrSet = new Set(arr);
16102
- return sortPattern.map((item) => {
16103
- if (arrSet.has(item)) {
16104
- return item;
16105
- }
16106
- return null;
16107
- }).filter((x) => x != null);
16108
- }
18036
+ // src/components/types/CellPositionByIndex.ts
16109
18037
  function ensureMinMaxCellPositionByIndex(start, end) {
16110
18038
  let { rowIndex: startRowIndex, colIndex: startColIndex } = start;
16111
18039
  let { rowIndex: endRowIndex, colIndex: endColIndex } = end;
@@ -16116,6 +18044,64 @@ function ensureMinMaxCellPositionByIndex(start, end) {
16116
18044
  { rowIndex: rowEnd, colIndex: colEnd }
16117
18045
  ];
16118
18046
  }
18047
+ function isSamePage(startPosition, endPosition, options) {
18048
+ const { rowsPerPage } = options;
18049
+ return !rowsPerPage ? true : Math.floor(startPosition.rowIndex / rowsPerPage) === Math.floor(endPosition.rowIndex / rowsPerPage);
18050
+ }
18051
+ function getPositionsArrayForRangeInHorizontaLLayout(startPosition, endPosition, options) {
18052
+ if (isSamePage(startPosition, endPosition, options)) {
18053
+ throw "You should not call this when the positions are in the same page";
18054
+ }
18055
+ const { rowsPerPage, columnsPerSet } = options;
18056
+ if (rowsPerPage === 0) {
18057
+ throw "rowsPerPage cannot be 0";
18058
+ }
18059
+ let start = startPosition;
18060
+ let end = endPosition;
18061
+ if (Math.floor(startPosition.rowIndex / rowsPerPage) > Math.floor(endPosition.rowIndex / rowsPerPage)) {
18062
+ start = endPosition;
18063
+ end = startPosition;
18064
+ }
18065
+ let { rowIndex: startRowIndex, colIndex: startColIndex } = start;
18066
+ let { rowIndex: endRowIndex, colIndex: endColIndex } = end;
18067
+ const pageForStartRowIndex = Math.floor(startRowIndex / rowsPerPage);
18068
+ const pageForEndRowIndex = Math.floor(endRowIndex / rowsPerPage);
18069
+ const offsetForStartRowIndex = startRowIndex % rowsPerPage;
18070
+ const offsetForEndRowIndex = endRowIndex % rowsPerPage;
18071
+ const minOffset = Math.min(offsetForStartRowIndex, offsetForEndRowIndex);
18072
+ const maxOffset = Math.max(offsetForStartRowIndex, offsetForEndRowIndex);
18073
+ const positions = [];
18074
+ for (let page = pageForStartRowIndex; page <= pageForEndRowIndex; page++) {
18075
+ for (let offset = minOffset; offset <= maxOffset; offset++) {
18076
+ const rowIndex = page * rowsPerPage + offset;
18077
+ if (page === pageForStartRowIndex) {
18078
+ for (let colIndex = startColIndex; colIndex < columnsPerSet; colIndex++) {
18079
+ positions.push({ rowIndex, colIndex });
18080
+ }
18081
+ } else if (page === pageForEndRowIndex) {
18082
+ for (let colIndex = 0; colIndex <= endColIndex; colIndex++) {
18083
+ positions.push({ rowIndex, colIndex });
18084
+ }
18085
+ } else {
18086
+ for (let colIndex = 0; colIndex < columnsPerSet; colIndex++) {
18087
+ positions.push({ rowIndex, colIndex });
18088
+ }
18089
+ }
18090
+ }
18091
+ }
18092
+ return positions;
18093
+ }
18094
+
18095
+ // src/components/InfiniteTable/api/getCellSelectionApi.ts
18096
+ function ensureSortedPerOrder(arr, sortPattern) {
18097
+ const arrSet = new Set(arr);
18098
+ return sortPattern.map((item) => {
18099
+ if (arrSet.has(item)) {
18100
+ return item;
18101
+ }
18102
+ return null;
18103
+ }).filter((x) => x != null);
18104
+ }
16119
18105
  var InfiniteTableCellSelectionApiImpl = class {
16120
18106
  constructor(param) {
16121
18107
  this.getCellSelectionPosition = (options) => {
@@ -17956,7 +19942,7 @@ var MultiCellSelector = class {
17956
19942
  this.multiSelectEndPosition = void 0;
17957
19943
  }
17958
19944
  }
17959
- multiSelectClick(position2) {
19945
+ multiSelectClick(position2, options) {
17960
19946
  if (!this.multiSelectStartPosition) {
17961
19947
  return;
17962
19948
  }
@@ -17967,13 +19953,39 @@ var MultiCellSelector = class {
17967
19953
  if (this.multiSelectEndPosition) {
17968
19954
  this.deselectRange(
17969
19955
  this.multiSelectStartPosition,
17970
- this.multiSelectEndPosition
19956
+ this.multiSelectEndPosition,
19957
+ options
17971
19958
  );
17972
19959
  }
17973
- this.selectRange(this.multiSelectStartPosition, position2);
19960
+ this.selectRange(this.multiSelectStartPosition, position2, options);
17974
19961
  this.multiSelectEndPosition = position2;
17975
19962
  }
17976
- setRangeSelected(startPosition, endPosition, selected) {
19963
+ setRangeSelected(startPosition, endPosition, selected, options) {
19964
+ if (options.horizontalLayout && !isSamePage(startPosition, endPosition, options)) {
19965
+ const positions = getPositionsArrayForRangeInHorizontaLLayout(
19966
+ startPosition,
19967
+ endPosition,
19968
+ {
19969
+ rowsPerPage: options.rowsPerPage,
19970
+ columnsPerSet: options.columnsPerSet
19971
+ }
19972
+ );
19973
+ positions.forEach((position2) => {
19974
+ const selectionPosition = this.getCellSelectionPosition({
19975
+ rowIndex: position2.rowIndex,
19976
+ colIndex: position2.colIndex
19977
+ });
19978
+ if (!selectionPosition) {
19979
+ return;
19980
+ }
19981
+ if (selected) {
19982
+ this.cellSelectionState.selectCell(...selectionPosition);
19983
+ } else {
19984
+ this.cellSelectionState.deselectCell(...selectionPosition);
19985
+ }
19986
+ });
19987
+ return;
19988
+ }
17977
19989
  const [start, end] = ensureMinMaxCellPositionByIndex(
17978
19990
  startPosition,
17979
19991
  endPosition
@@ -18000,11 +20012,11 @@ var MultiCellSelector = class {
18000
20012
  }
18001
20013
  }
18002
20014
  }
18003
- deselectRange(startPosition, endPosition) {
18004
- this.setRangeSelected(startPosition, endPosition, false);
20015
+ deselectRange(startPosition, endPosition, options) {
20016
+ this.setRangeSelected(startPosition, endPosition, false, options);
18005
20017
  }
18006
- selectRange(startPosition, endPosition) {
18007
- this.setRangeSelected(startPosition, endPosition, true);
20018
+ selectRange(startPosition, endPosition, options) {
20019
+ this.setRangeSelected(startPosition, endPosition, true, options);
18008
20020
  }
18009
20021
  };
18010
20022
 
@@ -18253,7 +20265,7 @@ var HorizontalLayoutMatrixBrain = class extends MatrixBrain {
18253
20265
  }
18254
20266
  }
18255
20267
  computeDirectionalRenderCount(direction, itemSize, count, theRenderSize) {
18256
- if (direction === "vertical") {
20268
+ if (direction === "vertical" || typeof itemSize === "number") {
18257
20269
  return super.computeDirectionalRenderCount(
18258
20270
  direction,
18259
20271
  itemSize,
@@ -18263,15 +20275,6 @@ var HorizontalLayoutMatrixBrain = class extends MatrixBrain {
18263
20275
  }
18264
20276
  let renderCount = 0;
18265
20277
  let size = theRenderSize.width;
18266
- size -= this.getFixedSize("horizontal");
18267
- if (size <= 0) {
18268
- return 0;
18269
- }
18270
- if (typeof itemSize === "number") {
18271
- renderCount = (itemSize ? Math.ceil(size / itemSize) : 0) + 1;
18272
- renderCount = Math.min(count, renderCount);
18273
- return renderCount;
18274
- }
18275
20278
  const pagesInView = Math.floor(size / this.pageWidth);
18276
20279
  renderCount += pagesInView * this.initialCols;
18277
20280
  const remainingSize = size - pagesInView * this.pageWidth;
@@ -18279,16 +20282,10 @@ var HorizontalLayoutMatrixBrain = class extends MatrixBrain {
18279
20282
  for (let i = 0; i < this.initialCols; i++) {
18280
20283
  sizes.push(this.getItemSize(i, direction));
18281
20284
  }
18282
- sizes.sort(SORT_ASC);
18283
- let sum2 = 0;
18284
- for (let i = 0; i < this.initialCols; i++) {
18285
- sum2 += sizes[i];
18286
- renderCount++;
18287
- if (sum2 > remainingSize) {
18288
- break;
18289
- }
18290
- }
18291
- renderCount += 1;
20285
+ renderCount += getGreatestCountVisibleInSize(
20286
+ remainingSize,
20287
+ sizes.concat(sizes)
20288
+ );
18292
20289
  renderCount = Math.min(count, renderCount);
18293
20290
  return renderCount;
18294
20291
  }
@@ -18602,7 +20599,8 @@ function initSetupState2({
18602
20599
  pinnedStartScrollListener: new ScrollListener(),
18603
20600
  pinnedEndScrollListener: new ScrollListener(),
18604
20601
  columnsWhenInlineGroupRenderStrategy: void 0,
18605
- editingCell: null
20602
+ editingCell: null,
20603
+ forceBodyRerenderTimestamp: 0
18606
20604
  };
18607
20605
  }
18608
20606
  var forwardProps4 = (_setupState) => {
@@ -18616,6 +20614,7 @@ var forwardProps4 = (_setupState) => {
18616
20614
  groupColumn: 1,
18617
20615
  onReady: 1,
18618
20616
  domProps: 1,
20617
+ debugMode: 1,
18619
20618
  onKeyDown: 1,
18620
20619
  onCellClick: 1,
18621
20620
  focusedClassName: 1,
@@ -18647,6 +20646,7 @@ var forwardProps4 = (_setupState) => {
18647
20646
  rowProps: 1,
18648
20647
  rowClassName: 1,
18649
20648
  cellClassName: 1,
20649
+ repeatWrappedGroupRows: 1,
18650
20650
  pinnedStartMaxWidth: 1,
18651
20651
  pinnedEndMaxWidth: 1,
18652
20652
  pivotColumn: 1,
@@ -18824,6 +20824,7 @@ var mapPropsToState = (params) => {
18824
20824
  }
18825
20825
  const isRowDetailEnabled = !rowDetailRenderer ? false : props.isRowDetailEnabled || true;
18826
20826
  return {
20827
+ isTree: parentState.isTree,
18827
20828
  rowDetailRenderer,
18828
20829
  rowDetailState,
18829
20830
  isRowDetailExpanded,
@@ -18895,6 +20896,9 @@ function getColumnVisibilityForHideEmptyGroupColumns(params) {
18895
20896
  for (let i = 0; i < len; i++) {
18896
20897
  const groupRowIndex = groupRowsIndexesInDataArray[i];
18897
20898
  const rowInfo = dataArray[groupRowIndex];
20899
+ if (rowInfo.isTreeNode) {
20900
+ continue;
20901
+ }
18898
20902
  if (!rowInfo.isGroupRow) {
18899
20903
  continue;
18900
20904
  }
@@ -19015,7 +21019,7 @@ function useColumnsWhenInlineGroupRenderStrategy(groupByMap) {
19015
21019
  const toggleGroupRow = useToggleGroupRow();
19016
21020
  const {
19017
21021
  componentActions,
19018
- componentState: { columns, groupRenderStrategy }
21022
+ componentState: { columns, groupRenderStrategy, isTree }
19019
21023
  } = useManagedComponentState();
19020
21024
  function computeColumnsWhenInlineGroupRenderStrategy(columns2, groupByMap2, groupRenderStrategy2, toggleGroupRow2) {
19021
21025
  const computedColumns = {};
@@ -19036,6 +21040,9 @@ function useColumnsWhenInlineGroupRenderStrategy(groupByMap) {
19036
21040
  return rowInfo.isGroupRow ? rowInfo.groupKeys?.[groupIndex] : rowInfo.value;
19037
21041
  },
19038
21042
  rowspan: ({ rowInfo, dataArray }) => {
21043
+ if (rowInfo.isTreeNode) {
21044
+ return 1;
21045
+ }
19039
21046
  if (!rowInfo.isGroupRow) {
19040
21047
  return 1;
19041
21048
  }
@@ -19082,7 +21089,7 @@ function useColumnsWhenInlineGroupRenderStrategy(groupByMap) {
19082
21089
  }
19083
21090
  useEffect23(() => {
19084
21091
  const update = () => {
19085
- componentActions.columnsWhenInlineGroupRenderStrategy = computeColumnsWhenInlineGroupRenderStrategy(
21092
+ componentActions.columnsWhenInlineGroupRenderStrategy = isTree ? void 0 : computeColumnsWhenInlineGroupRenderStrategy(
19086
21093
  columns,
19087
21094
  groupByMap,
19088
21095
  groupRenderStrategy,
@@ -20018,7 +22025,7 @@ var useLicense = (licenseKey = "") => {
20018
22025
  }
20019
22026
  let valid2 = isValidLicense(licenseKey, {
20020
22027
  publishedAt: 1624970570587,
20021
- version: "5.1.0-canary.1"
22028
+ version: "6.0.1"
20022
22029
  });
20023
22030
  if (!licenseKey && !valid2 && isInsidePlayground) {
20024
22031
  return true;
@@ -20130,6 +22137,7 @@ function onCellDoubleClick(context, _event) {
20130
22137
  function updateCellSelectionOnCellClick(context, event) {
20131
22138
  const {
20132
22139
  getDataSourceState,
22140
+ getState,
20133
22141
  getComputed,
20134
22142
  rowIndex,
20135
22143
  colIndex,
@@ -20143,7 +22151,10 @@ function updateCellSelectionOnCellClick(context, event) {
20143
22151
  if (selectionMode !== "multi-cell") {
20144
22152
  return;
20145
22153
  }
20146
- const { multiCellSelector } = getComputed();
22154
+ const { multiCellSelector, computedVisibleColumns } = getComputed();
22155
+ const { brain } = getState();
22156
+ const { rowsPerPage } = brain;
22157
+ const columnsPerSet = computedVisibleColumns.length;
20147
22158
  const cellSelection = new CellSelectionState(existingCellSelection);
20148
22159
  multiCellSelector.cellSelectionState = cellSelection;
20149
22160
  const position2 = {
@@ -20153,7 +22164,17 @@ function updateCellSelectionOnCellClick(context, event) {
20153
22164
  if (event.metaKey || event.ctrlKey) {
20154
22165
  multiCellSelector.singleAddClick(position2);
20155
22166
  } else if (event.shiftKey) {
20156
- multiCellSelector.multiSelectClick(position2);
22167
+ const horizontalLayout = !!getState().wrapRowsHorizontally;
22168
+ multiCellSelector.multiSelectClick(
22169
+ position2,
22170
+ horizontalLayout ? {
22171
+ horizontalLayout,
22172
+ rowsPerPage,
22173
+ columnsPerSet
22174
+ } : {
22175
+ horizontalLayout
22176
+ }
22177
+ );
20157
22178
  } else {
20158
22179
  multiCellSelector.resetClick(position2);
20159
22180
  }
@@ -20170,10 +22191,13 @@ function updateRowSelectionOnCellClick(context, event) {
20170
22191
  } = context;
20171
22192
  const { multiRowSelector, renderSelectionCheckBox } = getComputed();
20172
22193
  const dataSourceState = getDataSourceState();
20173
- const { selectionMode, groupBy, dataArray } = dataSourceState;
22194
+ const { selectionMode, groupBy, dataArray, isTree } = dataSourceState;
20174
22195
  if (groupBy.length) {
20175
22196
  return false;
20176
22197
  }
22198
+ if (isTree) {
22199
+ return false;
22200
+ }
20177
22201
  const rowInfo = dataArray[rowIndex];
20178
22202
  if (rowInfo?.rowDisabled) {
20179
22203
  return false;
@@ -20199,7 +22223,8 @@ function updateRowSelectionOnCellClick(context, event) {
20199
22223
  return true;
20200
22224
  }
20201
22225
  } else if (selectionMode === "single-row") {
20202
- const id = dataArray[rowIndex].id;
22226
+ const rowInfo2 = dataArray[rowIndex];
22227
+ const id = rowInfo2.id;
20203
22228
  if (event.metaKey || event.ctrlKey) {
20204
22229
  api.rowSelectionApi.toggleRowSelection(id);
20205
22230
  } else {
@@ -20243,7 +22268,7 @@ function getNextEnabledRowIndex(getDataSourceState, activeRowIndex, direction) {
20243
22268
  return clamp(i, min, max);
20244
22269
  }
20245
22270
  function handleRowNavigation(options, event) {
20246
- const { getState, getDataSourceState, actions, api } = options;
22271
+ const { getState, getDataSourceState, actions, api, dataSourceApi } = options;
20247
22272
  const { key } = event;
20248
22273
  const dataArray = getDataSourceState().dataArray;
20249
22274
  const arrLength = dataArray.length;
@@ -20319,6 +22344,9 @@ function handleRowNavigation(options, event) {
20319
22344
  if (rowInfo && rowInfo.isGroupRow) {
20320
22345
  return api.toggleGroupRow(rowInfo.groupKeys);
20321
22346
  }
22347
+ if (rowInfo && rowInfo.isTreeNode && rowInfo.isParentNode) {
22348
+ return dataSourceApi.treeApi.toggleNode(rowInfo.nodePath);
22349
+ }
20322
22350
  const hasRowDetail = api.rowDetailApi.isRowDetailEnabledForRow(
20323
22351
  rowInfo.id
20324
22352
  );
@@ -20360,6 +22388,7 @@ function handleCellNavigation(options, event) {
20360
22388
  getState,
20361
22389
  getComputed,
20362
22390
  getDataSourceState,
22391
+ dataSourceApi,
20363
22392
  actions
20364
22393
  } = options;
20365
22394
  const { key, shiftKey } = event;
@@ -20433,6 +22462,9 @@ function handleCellNavigation(options, event) {
20433
22462
  if (rowInfo && rowInfo.isGroupRow) {
20434
22463
  return api.toggleGroupRow(rowInfo.groupKeys);
20435
22464
  }
22465
+ if (rowInfo && rowInfo.isTreeNode && rowInfo.isParentNode) {
22466
+ return dataSourceApi.treeApi.toggleNode(rowInfo.nodePath);
22467
+ }
20436
22468
  if (rowInfo && api.rowDetailApi.isRowDetailEnabledForRow(rowInfo.id)) {
20437
22469
  return api.rowDetailApi.toggleRowDetail(rowInfo.id);
20438
22470
  }
@@ -20525,7 +22557,9 @@ function handleKeyboardSelection(context, keyboardEvent) {
20525
22557
  getDataSourceState,
20526
22558
  dataSourceActions,
20527
22559
  api: imperativeApi,
20528
- cloneRowSelection: cloneRowSelection2
22560
+ dataSourceApi,
22561
+ cloneRowSelection: cloneRowSelection2,
22562
+ cloneTreeSelection: cloneTreeSelection2
20529
22563
  } = context;
20530
22564
  const { key, ctrlKey, metaKey } = keyboardEvent;
20531
22565
  if (!validKeys2[key]) {
@@ -20539,7 +22573,13 @@ function handleKeyboardSelection(context, keyboardEvent) {
20539
22573
  keyboardNavigation,
20540
22574
  keyboardSelection
20541
22575
  } = state;
20542
- const { selectionMode, groupBy, rowSelection } = dataSourceState;
22576
+ const {
22577
+ selectionMode,
22578
+ groupBy,
22579
+ rowSelection,
22580
+ treeSelectionState: treeSelection,
22581
+ isTree
22582
+ } = dataSourceState;
20543
22583
  if (keyboardSelection === false) {
20544
22584
  return false;
20545
22585
  }
@@ -20556,6 +22596,14 @@ function handleKeyboardSelection(context, keyboardEvent) {
20556
22596
  return false;
20557
22597
  }
20558
22598
  if (key === "a" && (ctrlKey || metaKey)) {
22599
+ if (isTree && treeSelection) {
22600
+ const treeSelectionState = cloneTreeSelection2(
22601
+ treeSelection
22602
+ );
22603
+ treeSelectionState.selectAll();
22604
+ dataSourceActions.treeSelection = treeSelectionState;
22605
+ return true;
22606
+ }
20559
22607
  const rowSelectionState = cloneRowSelection2(
20560
22608
  rowSelection
20561
22609
  );
@@ -20573,6 +22621,11 @@ function handleKeyboardSelection(context, keyboardEvent) {
20573
22621
  imperativeApi.rowSelectionApi.toggleRowSelection(rowInfo.id);
20574
22622
  }
20575
22623
  return true;
22624
+ } else if (isTree) {
22625
+ if (rowInfo.isTreeNode && rowInfo.nodePath) {
22626
+ dataSourceApi.treeApi.toggleNodeSelection(rowInfo.nodePath);
22627
+ return true;
22628
+ }
20576
22629
  } else {
20577
22630
  const event = { ...keyboardEvent };
20578
22631
  const { renderSelectionCheckBox } = context.getComputed();
@@ -20946,6 +22999,9 @@ async function onKeyDown(context, event) {
20946
22999
  ...context,
20947
23000
  cloneRowSelection: (rowSelection) => {
20948
23001
  return cloneRowSelection(rowSelection, context.getDataSourceState);
23002
+ },
23003
+ cloneTreeSelection: (treeSelection) => {
23004
+ return cloneTreeSelection(treeSelection, context.getDataSourceState);
20949
23005
  }
20950
23006
  };
20951
23007
  if (handleKeyboardSelection(keyboardHandlerContext, event)) {
@@ -21024,6 +23080,9 @@ function useEventHandlersContext() {
21024
23080
  actions,
21025
23081
  getDataSourceState,
21026
23082
  dataSourceActions,
23083
+ cloneTreeSelection: (treeSelection) => {
23084
+ return cloneTreeSelection(treeSelection, getDataSourceState);
23085
+ },
21027
23086
  cloneRowSelection: (rowSelection) => {
21028
23087
  return cloneRowSelection(rowSelection, getDataSourceState);
21029
23088
  }
@@ -21498,7 +23557,7 @@ function OverlayContent(props) {
21498
23557
  useEffect30(() => {
21499
23558
  return props.realign.onChange((handle) => {
21500
23559
  if (nodeRef.current && handle) {
21501
- alignOverlayNode(nodeRef.current, handle);
23560
+ alignNode(nodeRef.current, handle);
21502
23561
  }
21503
23562
  });
21504
23563
  }, [props.realign]);
@@ -21508,7 +23567,7 @@ function OverlayContent(props) {
21508
23567
  style: { position: "absolute", top: 0, left: 0 },
21509
23568
  ref: useCallback24((node) => {
21510
23569
  if (node) {
21511
- alignOverlayNode(node, props);
23570
+ alignNode(node, props);
21512
23571
  }
21513
23572
  nodeRef.current = node;
21514
23573
  }, [])
@@ -21516,7 +23575,7 @@ function OverlayContent(props) {
21516
23575
  typeof props.children === "function" ? props.children() : props.children
21517
23576
  );
21518
23577
  }
21519
- async function alignOverlayNode(node, params) {
23578
+ async function alignNode(node, params) {
21520
23579
  let { constrainTo, alignTo, alignPosition } = params;
21521
23580
  if (Object.keys(alignTo).length === 2 && alignTo.top !== void 0 && alignTo.left !== void 0) {
21522
23581
  alignTo = {
@@ -21624,20 +23683,35 @@ function useOverlay(params) {
21624
23683
  const id = params2.id || getIdForReactOnlyChild(content) || getChangeDetect();
21625
23684
  const key = `${id}`;
21626
23685
  let handle = handles.get(key);
21627
- const childrenFn = () => {
21628
- const children = typeof content === "function" ? content() : content;
21629
- return injectPortalContainerAndConstrainInMenuChild(
21630
- children,
21631
- rootParams.portalContainer,
21632
- params2.constrainTo ?? rootParams.constrainTo
21633
- );
23686
+ const getChildrenFnForContent = (content2) => {
23687
+ return () => {
23688
+ const children = typeof content2 === "function" ? content2() : content2;
23689
+ return injectPortalContainerAndConstrainInMenuChild(
23690
+ children,
23691
+ rootParams.portalContainer,
23692
+ params2.constrainTo ?? rootParams.constrainTo
23693
+ );
23694
+ };
21634
23695
  };
21635
- if (handle) {
21636
- Object.assign(handle, params2, { children: childrenFn });
23696
+ const childrenFn = getChildrenFnForContent(content);
23697
+ const updateOverlay = (overlayContent, options) => {
23698
+ if (!handle) {
23699
+ return;
23700
+ }
23701
+ const childrenFn2 = getChildrenFnForContent(overlayContent);
23702
+ Object.assign(handle, { children: childrenFn2 });
21637
23703
  updateContent();
21638
- setHandleToRealign(handle.key);
21639
- setRealignTimestamp(Date.now());
21640
- return;
23704
+ const skipRealign = !!options?.skipRealign;
23705
+ const shouldRealign = !skipRealign;
23706
+ if (shouldRealign) {
23707
+ setHandleToRealign(handle.key);
23708
+ setRealignTimestamp(Date.now());
23709
+ }
23710
+ };
23711
+ if (handle) {
23712
+ Object.assign(handle, params2);
23713
+ updateOverlay(content);
23714
+ return updateOverlay;
21641
23715
  }
21642
23716
  handle = {
21643
23717
  key,
@@ -21649,7 +23723,7 @@ function useOverlay(params) {
21649
23723
  };
21650
23724
  handles.set(handle.key, handle);
21651
23725
  updateContent();
21652
- return () => updateContent();
23726
+ return updateOverlay;
21653
23727
  },
21654
23728
  [handles, rootParams.portalContainer, updateContent]
21655
23729
  );
@@ -21704,8 +23778,8 @@ MenuItem.defaultProps = {
21704
23778
  };
21705
23779
 
21706
23780
  // src/components/Menu/MenuCls.css.ts
21707
- var MenuCls = "MenuCls_MenuCls__db3arf0 utilities_boxSizingBorderBox__16lm1iw0 utilities_position_relative__16lm1iw1 utilities_display_inlineGrid__16lm1iw16 utilities_flexFlow_column__16lm1iw1m utilities_margin_none__16lm1iw8";
21708
- var MenuItemCls = createRuntimeFn({ defaultClassName: "MenuCls_MenuItemCls__db3arf2 utilities_display_flex__16lm1iwz utilities_alignItems_center__16lm1iw1q utilities_userSelect_none__16lm1iw17", variantClassNames: { disabled: { true: "MenuCls_MenuItemCls_disabled_true__db3arf3 utilities_cursor_default__16lm1iwj utilities_userSelect_none__16lm1iw17", false: "utilities_cursor_pointer__16lm1iwi" }, active: { true: "MenuCls_MenuItemCls_active_true__db3arf5", false: "MenuCls_MenuItemCls_active_false__db3arf6" }, pressed: { false: "MenuCls_MenuItemCls_pressed_false__db3arf7", true: "MenuCls_MenuItemCls_pressed_true__db3arf8" }, keyboardActive: { true: "MenuCls_MenuItemCls_keyboardActive_true__db3arf9", false: "MenuCls_MenuItemCls_keyboardActive_false__db3arfa" } }, defaultVariants: {}, compoundVariants: [[{ active: true, disabled: false }, "MenuCls_MenuItemCls_compound_0__db3arfb"], [{ pressed: true, active: true, disabled: false }, "MenuCls_MenuItemCls_compound_1__db3arfc"]] });
23781
+ var MenuCls = "MenuCls_MenuCls__db3arf0 utilities_boxSizingBorderBox__16lm1iw0 utilities_position_relative__16lm1iw1 utilities_display_inlineGrid__16lm1iw16 utilities_flexFlow_column__16lm1iw1n utilities_margin_none__16lm1iw8";
23782
+ var MenuItemCls = createRuntimeFn({ defaultClassName: "MenuCls_MenuItemCls__db3arf2 utilities_display_flex__16lm1iwz utilities_alignItems_center__16lm1iw1r utilities_userSelect_none__16lm1iw17", variantClassNames: { disabled: { true: "MenuCls_MenuItemCls_disabled_true__db3arf3 utilities_cursor_default__16lm1iwj utilities_userSelect_none__16lm1iw17", false: "utilities_cursor_pointer__16lm1iwi" }, active: { true: "MenuCls_MenuItemCls_active_true__db3arf5", false: "MenuCls_MenuItemCls_active_false__db3arf6" }, pressed: { false: "MenuCls_MenuItemCls_pressed_false__db3arf7", true: "MenuCls_MenuItemCls_pressed_true__db3arf8" }, keyboardActive: { true: "MenuCls_MenuItemCls_keyboardActive_true__db3arf9", false: "MenuCls_MenuItemCls_keyboardActive_false__db3arfa" } }, defaultVariants: {}, compoundVariants: [[{ active: true, disabled: false }, "MenuCls_MenuItemCls_compound_0__db3arfb"], [{ pressed: true, active: true, disabled: false }, "MenuCls_MenuItemCls_compound_1__db3arfc"]] });
21709
23783
  var MenuRowCls = "MenuCls_MenuRowCls__db3arf1";
21710
23784
  var MenuSeparatorCls = "MenuCls_MenuSeparatorCls__db3arfd";
21711
23785
 
@@ -23721,6 +25795,95 @@ function useToggleWrapRowsHorizontally() {
23721
25795
  }, [oldWrapRowsHorizontally, wrapRowsHorizontally]);
23722
25796
  }
23723
25797
 
25798
+ // src/components/InfiniteTable/hooks/useHorizontalLayout.ts
25799
+ import { useEffect as useEffect38 } from "react";
25800
+ function useHorizontalLayout() {
25801
+ const { getState, actions, dataSourceActions, getDataSourceState } = useInfiniteTable();
25802
+ const { groupBy, isTree } = getDataSourceState();
25803
+ const { brain, wrapRowsHorizontally, repeatWrappedGroupRows } = getState();
25804
+ useEffect38(() => {
25805
+ if (!wrapRowsHorizontally) {
25806
+ return;
25807
+ }
25808
+ const onVerticalRenderRangeChange = () => {
25809
+ const {
25810
+ rowsPerPage: currentRowsPerPage,
25811
+ repeatWrappedGroupRows: currentRepeatWrappedGroupRows
25812
+ } = getDataSourceState();
25813
+ let changes = false;
25814
+ const rowsPerPage = brain.rowsPerPage;
25815
+ const newRowsPerPage = (groupBy && groupBy.length > 0 || isTree) && rowsPerPage > 0 ? rowsPerPage : null;
25816
+ if (currentRowsPerPage != newRowsPerPage) {
25817
+ dataSourceActions.rowsPerPage = newRowsPerPage;
25818
+ changes = true;
25819
+ }
25820
+ if (currentRepeatWrappedGroupRows != repeatWrappedGroupRows) {
25821
+ dataSourceActions.repeatWrappedGroupRows = repeatWrappedGroupRows ?? false;
25822
+ changes = true;
25823
+ }
25824
+ return changes;
25825
+ };
25826
+ onVerticalRenderRangeChange();
25827
+ let timeoutId;
25828
+ const off = brain.onVerticalRenderRangeChange(() => {
25829
+ if (onVerticalRenderRangeChange()) {
25830
+ timeoutId = setTimeout(() => {
25831
+ actions.forceBodyRerenderTimestamp = Date.now();
25832
+ });
25833
+ }
25834
+ });
25835
+ return () => {
25836
+ if (timeoutId) {
25837
+ clearTimeout(timeoutId);
25838
+ }
25839
+ off();
25840
+ };
25841
+ }, [brain, wrapRowsHorizontally, groupBy, isTree, repeatWrappedGroupRows]);
25842
+ }
25843
+
25844
+ // src/components/InfiniteTable/hooks/useDebugMode.ts
25845
+ import * as React68 from "react";
25846
+ var logWarning = once(() => {
25847
+ console.warn(
25848
+ `It appears you have not loaded the CSS file for InfiniteTable.
25849
+ In most environments, you should be able to fix this by adding the following line:
25850
+
25851
+ import '@infinite-table/infinite-react/index.css'
25852
+
25853
+ `
25854
+ );
25855
+ });
25856
+ var cssFileLoadedVarName = stripVar(ThemeVars.loaded);
25857
+ function useDebugMode() {
25858
+ const { getState } = useInfiniteTable();
25859
+ React68.useEffect(() => {
25860
+ runDebugMode(getState);
25861
+ }, []);
25862
+ }
25863
+ function runDebugMode(getState) {
25864
+ const state = getState();
25865
+ const { debugMode, domRef } = state;
25866
+ if (debugMode) {
25867
+ if (domRef.current) {
25868
+ const value = getComputedStyle(domRef.current).getPropertyValue(
25869
+ cssFileLoadedVarName
25870
+ );
25871
+ if (value !== `${CSS_LOADED_VALUE}`) {
25872
+ logWarning();
25873
+ }
25874
+ }
25875
+ }
25876
+ }
25877
+
25878
+ // src/components/InfiniteTable/hooks/useInfinitePortalContainer.ts
25879
+ function useInfinitePortalContainer() {
25880
+ const masterContext = useMasterDetailContext();
25881
+ const masterState = masterContext ? masterContext.getMasterState() : null;
25882
+ const infiniteState = useInfiniteTable().getState();
25883
+ const portalContainer = (masterState || infiniteState).portalDOMRef.current;
25884
+ return portalContainer;
25885
+ }
25886
+
23724
25887
  // src/components/InfiniteTable/index.tsx
23725
25888
  var InfiniteTableClassName = internalProps.rootClassName;
23726
25889
  var HOVERED_CLASS_NAMES = [RowHoverCls, "InfiniteColumnCell--hovered"];
@@ -23749,7 +25912,7 @@ function InfiniteTableHeader2() {
23749
25912
  const { state: componentState, getComputed } = context;
23750
25913
  const { header, brain, headerBrain, wrapRowsHorizontally } = componentState;
23751
25914
  const { scrollbars } = getComputed();
23752
- return header ? /* @__PURE__ */ React68.createElement(
25915
+ return header ? /* @__PURE__ */ React69.createElement(
23753
25916
  TableHeaderWrapper,
23754
25917
  {
23755
25918
  wrapRowsHorizontally: !!wrapRowsHorizontally,
@@ -23766,7 +25929,7 @@ var InfiniteTableBodyCls = join(
23766
25929
  transformTranslateZero
23767
25930
  );
23768
25931
  function InfiniteTableBodyContainer(props) {
23769
- return /* @__PURE__ */ React68.createElement(
25932
+ return /* @__PURE__ */ React69.createElement(
23770
25933
  "div",
23771
25934
  {
23772
25935
  ...props,
@@ -23803,7 +25966,7 @@ function InfiniteTableBody() {
23803
25966
  const {
23804
25967
  componentState: { loading }
23805
25968
  } = useDataSourceContextValue();
23806
- const onContextMenu = React68.useCallback((event) => {
25969
+ const onContextMenu = React69.useCallback((event) => {
23807
25970
  const state = context.getState();
23808
25971
  const target = event.target;
23809
25972
  if (!masterContext && event._from_row_detail) {
@@ -23849,9 +26012,10 @@ function InfiniteTableBody() {
23849
26012
  });
23850
26013
  const { autoFocus, tabIndex } = domProps ?? {};
23851
26014
  useToggleWrapRowsHorizontally();
23852
- return /* @__PURE__ */ React68.createElement(InfiniteTableBodyContainer, { onContextMenu }, /* @__PURE__ */ React68.createElement(
26015
+ return /* @__PURE__ */ React69.createElement(InfiniteTableBodyContainer, { onContextMenu }, /* @__PURE__ */ React69.createElement(
23853
26016
  HeadlessTable,
23854
26017
  {
26018
+ forceRerenderTimestamp: componentState.forceBodyRerenderTimestamp,
23855
26019
  debugId,
23856
26020
  tabIndex: tabIndex ?? 0,
23857
26021
  autoFocus: autoFocus ?? void 0,
@@ -23869,9 +26033,9 @@ function InfiniteTableBody() {
23869
26033
  cellHoverClassNames: showHoverRows ? HOVERED_CLASS_NAMES : void 0,
23870
26034
  scrollerDOMRef
23871
26035
  }
23872
- ), /* @__PURE__ */ React68.createElement(LoadMaskCmp, { visible: loading }, loadingText));
26036
+ ), /* @__PURE__ */ React69.createElement(LoadMaskCmp, { visible: loading }, loadingText));
23873
26037
  }
23874
- var InfiniteTableComponent = React68.memo(
26038
+ var InfiniteTableComponent = React69.memo(
23875
26039
  function InfiniteTableComponent2() {
23876
26040
  const context = useInfiniteTable();
23877
26041
  const masterContext = useMasterDetailContext();
@@ -23903,7 +26067,7 @@ var InfiniteTableComponent = React68.memo(
23903
26067
  useScrollToActiveRow(activeRowIndex, dataArray.length, api);
23904
26068
  useScrollToActiveCell(activeCellIndex, dataArray.length, api);
23905
26069
  const { onKeyDown: onKeyDown2 } = useDOMEventHandlers();
23906
- React68.useEffect(() => {
26070
+ React69.useEffect(() => {
23907
26071
  const dataSourceState = getDataSourceState();
23908
26072
  const onChange = debounce(
23909
26073
  (renderRange) => {
@@ -23926,17 +26090,18 @@ var InfiniteTableComponent = React68.memo(
23926
26090
  ...initialDOMProps
23927
26091
  } = componentState.domProps ?? {};
23928
26092
  const domProps = useDOMProps(initialDOMProps);
23929
- React68.useEffect(() => {
26093
+ React69.useEffect(() => {
23930
26094
  brain.setScrollStopDelay(scrollStopDelay);
23931
26095
  dataSourceActions.scrollStopDelayUpdatedByTable = scrollStopDelay;
23932
26096
  }, [scrollStopDelay]);
23933
26097
  useAutoSizeColumns();
26098
+ useHorizontalLayout();
23934
26099
  useEditingCallbackProps();
23935
26100
  const { menuPortal } = useColumnMenu();
23936
26101
  const { menuPortal: cellContextMenuPortal } = useCellContextMenu();
23937
26102
  const { menuPortal: tableContextMenuPortal } = useTableContextMenu();
23938
26103
  const { menuPortal: filterOperatorMenuPortal } = useColumnFilterOperatorMenu();
23939
- React68.useEffect(() => {
26104
+ React69.useEffect(() => {
23940
26105
  if (typeof globalThis.__DO_NOT_USE_UNLESS_YOU_KNOW_WHAT_YOURE_DOING_IS_READY === "function") {
23941
26106
  globalThis.__DO_NOT_USE_UNLESS_YOU_KNOW_WHAT_YOURE_DOING_IS_READY(
23942
26107
  componentState.id,
@@ -23949,13 +26114,14 @@ var InfiniteTableComponent = React68.memo(
23949
26114
  globalThis.infiniteApi = context.api;
23950
26115
  }
23951
26116
  }, [componentState.ready]);
23952
- React68.useEffect(() => {
26117
+ useDebugMode();
26118
+ React69.useEffect(() => {
23953
26119
  if (masterContext) {
23954
26120
  portalDOMRef.current = masterContext.getMasterState().portalDOMRef.current;
23955
26121
  }
23956
26122
  }, []);
23957
- const children = initialChildren ?? /* @__PURE__ */ React68.createElement(React68.Fragment, null, /* @__PURE__ */ React68.createElement(InfiniteTableHeader2, null), /* @__PURE__ */ React68.createElement(InfiniteTableBody, null));
23958
- return /* @__PURE__ */ React68.createElement("div", { onKeyDown: onKeyDown2, ref: domRef, ...domProps }, children, /* @__PURE__ */ React68.createElement(
26123
+ const children = initialChildren ?? /* @__PURE__ */ React69.createElement(React69.Fragment, null, /* @__PURE__ */ React69.createElement(InfiniteTableHeader2, null), /* @__PURE__ */ React69.createElement(InfiniteTableBody, null));
26124
+ return /* @__PURE__ */ React69.createElement("div", { onKeyDown: onKeyDown2, ref: domRef, ...domProps }, children, /* @__PURE__ */ React69.createElement(
23959
26125
  "div",
23960
26126
  {
23961
26127
  ref: portalDOMRef,
@@ -23971,14 +26137,14 @@ var InfiniteTableComponent = React68.memo(
23971
26137
  cellContextMenuPortal,
23972
26138
  tableContextMenuPortal,
23973
26139
  filterOperatorMenuPortal
23974
- ), rowHeightCSSVar ? /* @__PURE__ */ React68.createElement(
26140
+ ), rowHeightCSSVar ? /* @__PURE__ */ React69.createElement(
23975
26141
  CSSNumericVariableWatch,
23976
26142
  {
23977
26143
  key: "row-height",
23978
26144
  varName: rowHeightCSSVar,
23979
26145
  onChange: onRowHeightCSSVarChange
23980
26146
  }
23981
- ) : null, /* @__PURE__ */ React68.createElement(
26147
+ ) : null, /* @__PURE__ */ React69.createElement(
23982
26148
  CSSNumericVariableWatch,
23983
26149
  {
23984
26150
  key: "flashing-duration",
@@ -23986,21 +26152,21 @@ var InfiniteTableComponent = React68.memo(
23986
26152
  varName: ThemeVars.components.Cell.flashingDuration,
23987
26153
  onChange: onFlashingDurationCSSVarChange
23988
26154
  }
23989
- ), rowDetailHeightCSSVar ? /* @__PURE__ */ React68.createElement(
26155
+ ), rowDetailHeightCSSVar ? /* @__PURE__ */ React69.createElement(
23990
26156
  CSSNumericVariableWatch,
23991
26157
  {
23992
26158
  key: "row-detail-height",
23993
26159
  varName: rowDetailHeightCSSVar,
23994
26160
  onChange: onRowDetailHeightCSSVarChange
23995
26161
  }
23996
- ) : null, columnHeaderHeightCSSVar ? /* @__PURE__ */ React68.createElement(
26162
+ ) : null, columnHeaderHeightCSSVar ? /* @__PURE__ */ React69.createElement(
23997
26163
  CSSNumericVariableWatch,
23998
26164
  {
23999
26165
  key: "column-header-height",
24000
26166
  varName: columnHeaderHeightCSSVar,
24001
26167
  onChange: onColumnHeaderHeightCSSVarChange
24002
26168
  }
24003
- ) : null, licenseValid ? null : /* @__PURE__ */ React68.createElement(InfiniteTableLicenseFooter, null), /* @__PURE__ */ React68.createElement(FocusDetect, null));
26169
+ ) : null, licenseValid ? null : /* @__PURE__ */ React69.createElement(InfiniteTableLicenseFooter, null), /* @__PURE__ */ React69.createElement(FocusDetect, null));
24004
26170
  }
24005
26171
  );
24006
26172
  function InfiniteTableContextProvider({
@@ -24024,7 +26190,7 @@ function InfiniteTableContextProvider({
24024
26190
  getDataSourceMasterContext,
24025
26191
  api: dataSourceApi
24026
26192
  } = useDataSourceContextValue();
24027
- const [imperativeApi] = React68.useState(() => {
26193
+ const [imperativeApi] = React69.useState(() => {
24028
26194
  return getImperativeApi({
24029
26195
  getComputed,
24030
26196
  getState,
@@ -24060,38 +26226,52 @@ function InfiniteTableContextProvider({
24060
26226
  },
24061
26227
  { earlyAttach: true, debounce: 50 }
24062
26228
  );
24063
- React68.useEffect(() => {
26229
+ React69.useEffect(() => {
24064
26230
  if (scrollerDOMRef.current) {
24065
26231
  scrollerDOMRef.current.scrollTop = 0;
24066
26232
  }
24067
26233
  }, [scrollTopKey, scrollerDOMRef]);
24068
26234
  const TableContext2 = getInfiniteTableContext();
24069
- return /* @__PURE__ */ React68.createElement(TableContext2.Provider, { value: contextValue }, /* @__PURE__ */ React68.createElement(InfiniteTableComponent, null));
26235
+ return /* @__PURE__ */ React69.createElement(TableContext2.Provider, { value: contextValue }, /* @__PURE__ */ React69.createElement(InfiniteTableComponent, null));
24070
26236
  }
24071
26237
  var DEFAULT_ROW_HEIGHT = 40;
24072
26238
  var DEFAULT_COLUMN_HEADER_HEIGHT = toCSSVarName(columnHeaderHeightName);
24073
26239
  var InfiniteTable = function(props) {
24074
26240
  const table = (
24075
26241
  //@ts-ignore
24076
- /* @__PURE__ */ React68.createElement(
26242
+ /* @__PURE__ */ React69.createElement(
24077
26243
  InfiniteTableRoot,
24078
26244
  {
26245
+ repeatWrappedGroupRows: !!props.wrapRowsHorizontally,
24079
26246
  rowHeight: DEFAULT_ROW_HEIGHT,
24080
26247
  columnHeaderHeight: DEFAULT_COLUMN_HEADER_HEIGHT,
24081
26248
  ...props
24082
26249
  },
24083
- /* @__PURE__ */ React68.createElement(InfiniteTableContextProvider, { children: props.children })
26250
+ /* @__PURE__ */ React69.createElement(InfiniteTableContextProvider, { children: props.children })
24084
26251
  )
24085
26252
  );
24086
26253
  if (false) {
24087
- return /* @__PURE__ */ React68.createElement(React68.StrictMode, null, table);
26254
+ return /* @__PURE__ */ React69.createElement(React69.StrictMode, null, table);
24088
26255
  }
24089
26256
  return table;
24090
26257
  };
24091
26258
  InfiniteTable.Header = InfiniteTableHeader2;
24092
26259
  InfiniteTable.Body = InfiniteTableBody;
24093
26260
  InfiniteTable.HScrollSyncContent = HScrollSyncContent;
24094
- InfiniteTable.Footer = () => /* @__PURE__ */ React68.createElement(InfiniteTableFooter, null);
26261
+ InfiniteTable.Footer = () => /* @__PURE__ */ React69.createElement(InfiniteTableFooter, null);
26262
+
26263
+ // src/components/TreeGrid/TreeDataSource.tsx
26264
+ import * as React70 from "react";
26265
+ function TreeDataSource(props) {
26266
+ const { DataSource: DataSourceComponent } = useDataSourceInternal(props);
26267
+ return /* @__PURE__ */ React70.createElement(DataSourceComponent, { nodesKey: props.nodesKey || "children" }, props.children ?? null);
26268
+ }
26269
+
26270
+ // src/components/TreeGrid/TreeGrid.tsx
26271
+ import * as React71 from "react";
26272
+ function TreeGrid(props) {
26273
+ return /* @__PURE__ */ React71.createElement(InfiniteTable, { ...props });
26274
+ }
24095
26275
 
24096
26276
  // src/components/DataSource/DataLoader/DataQuery.ts
24097
26277
  var logger2 = debug("InfiniteTable:DataQuery");
@@ -24332,7 +26512,7 @@ var keyboardShortcuts = {
24332
26512
  };
24333
26513
 
24334
26514
  // src/components/hooks/useInterceptedMap.ts
24335
- import { useEffect as useEffect39 } from "react";
26515
+ import { useEffect as useEffect41 } from "react";
24336
26516
  function interceptMap(map2, fns) {
24337
26517
  const { set, delete: deleteKey, clear } = map2;
24338
26518
  if (fns.set) {
@@ -24494,7 +26674,7 @@ var WeakFixedSizeSet = _WeakFixedSizeSet;
24494
26674
  WeakFixedSizeSet.DEFAULT_SIZE = 10;
24495
26675
 
24496
26676
  // src/components/hooks/useEffectWhenSameDeps.ts
24497
- import { useEffect as useEffect40, useRef as useRef31 } from "react";
26677
+ import { useEffect as useEffect42, useRef as useRef31 } from "react";
24498
26678
  var isSameDeps = (deps, prevDeps) => {
24499
26679
  return deps.every((dep, index) => dep === prevDeps[index]);
24500
26680
  };
@@ -24508,7 +26688,7 @@ var useEffectWhenSameDeps = (callback, deps) => {
24508
26688
  effectDepsRef.current = effectDeps;
24509
26689
  const callbackRef = useRef31(callback);
24510
26690
  callbackRef.current = callback;
24511
- useEffect40(() => {
26691
+ useEffect42(() => {
24512
26692
  if (isInitialRef.current) {
24513
26693
  isInitialRef.current = false;
24514
26694
  return;
@@ -24518,7 +26698,7 @@ var useEffectWhenSameDeps = (callback, deps) => {
24518
26698
  };
24519
26699
 
24520
26700
  // src/components/hooks/useEffectWhen.ts
24521
- import { useEffect as useEffect41, useRef as useRef32 } from "react";
26701
+ import { useEffect as useEffect43, useRef as useRef32 } from "react";
24522
26702
  var isSameDeps2 = (deps, prevDeps, compare) => {
24523
26703
  return deps.every((dep, index) => {
24524
26704
  if (compare) {
@@ -24548,7 +26728,7 @@ var useEffectWhen = (callback, options) => {
24548
26728
  if (sameRespected && differentRespected) {
24549
26729
  isInitialRef.current = false;
24550
26730
  }
24551
- useEffect41(() => {
26731
+ useEffect43(() => {
24552
26732
  if (isInitialRef.current) {
24553
26733
  return;
24554
26734
  }
@@ -24557,14 +26737,25 @@ var useEffectWhen = (callback, options) => {
24557
26737
  };
24558
26738
 
24559
26739
  // src/components/InfiniteTable/components/InfiniteTableRow/FlashingColumnCell.tsx
24560
- import * as React69 from "react";
26740
+ import * as React72 from "react";
24561
26741
  var currentFlashingDurationVar = stripVar(
24562
26742
  InternalVars.currentFlashingDuration
24563
26743
  );
24564
26744
  var defaultRender = ({ children }) => {
24565
- return /* @__PURE__ */ React69.createElement(React69.Fragment, null, children);
26745
+ return /* @__PURE__ */ React72.createElement(React72.Fragment, null, children);
24566
26746
  };
24567
26747
  var DEFAULT_FLASH_DURATION = 1e3;
26748
+ var INTERNAL_FLASH_CLS_FOR_DIRECTION = {
26749
+ up: FlashingColumnCellRecipe({
26750
+ direction: "up"
26751
+ }).split(" "),
26752
+ down: FlashingColumnCellRecipe({
26753
+ direction: "down"
26754
+ }).split(" "),
26755
+ neutral: FlashingColumnCellRecipe({
26756
+ direction: "neutral"
26757
+ }).split(" ")
26758
+ };
24568
26759
  var createFlashingColumnCellComponent = (options = {}) => {
24569
26760
  const {
24570
26761
  flashDuration: FLASH_DURATION,
@@ -24573,7 +26764,7 @@ var createFlashingColumnCellComponent = (options = {}) => {
24573
26764
  // fadeClassName,
24574
26765
  render = defaultRender
24575
26766
  } = options;
24576
- const FlashingColumnCell2 = React69.forwardRef(
26767
+ const FlashingColumnCell2 = React72.forwardRef(
24577
26768
  (props, _ref) => {
24578
26769
  const cellContext = useInfiniteColumnCell();
24579
26770
  const {
@@ -24583,60 +26774,60 @@ var createFlashingColumnCellComponent = (options = {}) => {
24583
26774
  const { domRef, value, column, rowInfo, htmlElementRef } = cellContext;
24584
26775
  const rowId = rowInfo.id;
24585
26776
  const columnId = column.id;
24586
- const initialRef = React69.useRef(true);
24587
- const oldValueRef = React69.useRef(value);
26777
+ const initialRef = React72.useRef(true);
26778
+ const oldValueRef = React72.useRef(value);
24588
26779
  const oldValue = initialRef.current ? null : oldValueRef.current;
24589
26780
  initialRef.current = false;
24590
- const flashTimeoutIdRef = React69.useRef();
24591
- const fadeTimeoutIdRef = React69.useRef();
26781
+ const flashTimeoutIdRef = React72.useRef();
26782
+ const flashDirectionRef = React72.useRef();
26783
+ const fadeTimeoutIdRef = React72.useRef();
24592
26784
  useEffectWhen(
24593
26785
  () => {
24594
26786
  if (value === oldValueRef.current) {
24595
26787
  return;
24596
26788
  }
24597
- if (flashTimeoutIdRef.current) {
24598
- clearTimeout(flashTimeoutIdRef.current);
24599
- }
24600
- if (fadeTimeoutIdRef.current) {
24601
- clearTimeout(fadeTimeoutIdRef.current);
24602
- }
24603
- const el = htmlElementRef.current;
24604
- oldValueRef.current = value;
24605
- if (!el) {
24606
- return;
24607
- }
24608
- const flashDirection = typeof value === "number" ? value > oldValue ? "up" : "down" : "neutral";
24609
- const internalflashCls = FlashingColumnCellRecipe({
24610
- direction: flashDirection
24611
- }).split(" ");
24612
- el.style.setProperty(currentFlashingDurationVar, `${duration}`);
24613
- if (flashClassName) {
24614
- el.classList.add(flashClassName);
24615
- }
24616
- el.classList.add(...internalflashCls);
24617
- flashTimeoutIdRef.current = setTimeout(() => {
24618
- flashTimeoutIdRef.current = void 0;
24619
- if (flashClassName) {
24620
- el.classList.remove(flashClassName);
24621
- }
24622
- el.classList.remove(...internalflashCls);
24623
- el.style.removeProperty(currentFlashingDurationVar);
24624
- }, duration);
24625
- return () => {
26789
+ const clear = () => {
26790
+ const el2 = htmlElementRef.current;
24626
26791
  if (flashTimeoutIdRef.current) {
24627
26792
  clearTimeout(flashTimeoutIdRef.current);
26793
+ flashTimeoutIdRef.current = void 0;
24628
26794
  }
24629
26795
  if (fadeTimeoutIdRef.current) {
24630
26796
  clearTimeout(fadeTimeoutIdRef.current);
26797
+ fadeTimeoutIdRef.current = void 0;
26798
+ }
26799
+ if (flashDirectionRef.current && el2) {
26800
+ const flashDirection2 = flashDirectionRef.current;
26801
+ const internalflashCls2 = INTERNAL_FLASH_CLS_FOR_DIRECTION[flashDirection2];
26802
+ el2.classList.remove(
26803
+ ...flashClassName ? [flashClassName, ...internalflashCls2] : internalflashCls2
26804
+ );
26805
+ el2.style.removeProperty(currentFlashingDurationVar);
26806
+ flashDirectionRef.current = void 0;
24631
26807
  }
24632
26808
  };
26809
+ oldValueRef.current = value;
26810
+ const el = htmlElementRef.current;
26811
+ if (!el) {
26812
+ return;
26813
+ }
26814
+ clear();
26815
+ const flashDirection = typeof value === "number" ? value > oldValue ? "up" : "down" : "neutral";
26816
+ const internalflashCls = INTERNAL_FLASH_CLS_FOR_DIRECTION[flashDirection];
26817
+ el.style.setProperty(currentFlashingDurationVar, `${duration}`);
26818
+ el.classList.add(
26819
+ ...flashClassName ? [flashClassName, ...internalflashCls] : internalflashCls
26820
+ );
26821
+ flashDirectionRef.current = flashDirection;
26822
+ flashTimeoutIdRef.current = setTimeout(clear, duration);
26823
+ return clear;
24633
26824
  },
24634
26825
  {
24635
26826
  same: [columnId, rowId],
24636
26827
  different: [value]
24637
26828
  }
24638
26829
  );
24639
- return /* @__PURE__ */ React69.createElement("div", { ref: domRef, ...props, className: join(props.className) }, render({ children: props.children, oldValue }));
26830
+ return /* @__PURE__ */ React72.createElement("div", { ref: domRef, ...props, className: join(props.className) }, render({ children: props.children, oldValue }));
24640
26831
  }
24641
26832
  );
24642
26833
  return FlashingColumnCell2;
@@ -24668,7 +26859,12 @@ export {
24668
26859
  RowDetailState,
24669
26860
  RowDisabledState,
24670
26861
  RowSelectionState,
26862
+ TreeDataSource,
26863
+ TreeExpandState,
26864
+ TreeGrid,
26865
+ TreeSelectionState,
24671
26866
  WeakFixedSizeSet,
26867
+ alignNode,
24672
26868
  components,
24673
26869
  createFlashingColumnCellComponent,
24674
26870
  debounce,
@@ -24682,7 +26878,9 @@ export {
24682
26878
  interceptMap,
24683
26879
  keyboardShortcuts,
24684
26880
  multisort,
26881
+ multisortNested,
24685
26882
  queryKeyToCacheKey,
26883
+ toTreeDataArray,
24686
26884
  useManagedComponentState as useComponentState,
24687
26885
  useDataSourceInternal,
24688
26886
  useDataSourceState,
@@ -24695,6 +26893,7 @@ export {
24695
26893
  useInfiniteColumnEditor,
24696
26894
  useInfiniteColumnFilterEditor,
24697
26895
  useInfiniteHeaderCell,
26896
+ useInfinitePortalContainer,
24698
26897
  useManagedDataSource,
24699
26898
  useMasterRowInfo,
24700
26899
  useOverlay,