@infinite-table/infinite-react 0.2.0 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/index.d.ts +150 -135
  2. package/index.esm.js +497 -363
  3. package/index.js +502 -366
  4. package/package.json +2 -2
package/index.js CHANGED
@@ -640,7 +640,7 @@ __export(exports, {
640
640
  });
641
641
 
642
642
  // src/components/InfiniteTable/index.tsx
643
- var React35 = __toModule(require("react"));
643
+ var React34 = __toModule(require("react"));
644
644
 
645
645
  // src/components/InfiniteTable/internalProps.ts
646
646
  var rootClassName = "Infinite";
@@ -785,7 +785,6 @@ function initSetupState() {
785
785
  draggingColumnId: null,
786
786
  pinnedStartScrollListener: new ScrollListener(),
787
787
  pinnedEndScrollListener: new ScrollListener(),
788
- computedPivotColumns: void 0,
789
788
  columnsWhenInlineGroupRenderStrategy: void 0
790
789
  };
791
790
  }
@@ -816,7 +815,6 @@ var forwardProps = (setupState) => {
816
815
  pinnedStartMaxWidth: 1,
817
816
  pinnedEndMaxWidth: 1,
818
817
  pivotColumn: 1,
819
- pivotRowLabelsColumn: 1,
820
818
  pivotColumnGroups: 1,
821
819
  onScrollbarsChange: 1,
822
820
  scrollStopDelay: (scrollStopDelay) => scrollStopDelay != null ? scrollStopDelay : 100,
@@ -873,7 +871,7 @@ var mapPropsToState = (params) => {
873
871
  groupBy,
874
872
  groupColumn: props.groupColumn
875
873
  });
876
- const computedColumns = state.computedPivotColumns || state.columnsWhenGrouping || state.columnsWhenInlineGroupRenderStrategy || state.columns;
874
+ const computedColumns = state.columnsWhenGrouping || state.columnsWhenInlineGroupRenderStrategy || state.columns;
877
875
  return {
878
876
  groupRenderStrategy,
879
877
  groupBy,
@@ -2044,7 +2042,7 @@ function useColumnGroups() {
2044
2042
  // src/components/InfiniteTable/hooks/useColumnsWhen.ts
2045
2043
  var import_react17 = __toModule(require("react"));
2046
2044
 
2047
- // src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
2045
+ // src/components/InfiniteTable/utils/getColumnForGroupBy.tsx
2048
2046
  var React6 = __toModule(require("react"));
2049
2047
 
2050
2048
  // src/utils/join.ts
@@ -2115,91 +2113,15 @@ var userSelect = { none: "_16lm1iwm" };
2115
2113
  var willChange = { transform: "_16lm1iw19" };
2116
2114
  var zIndex = { "1": "_16lm1iwe", "10": "_16lm1iwf", "1000": "_16lm1iwg", "10000": "_16lm1iwh", "100000": "_16lm1iwi" };
2117
2115
 
2118
- // src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
2119
- function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params) {
2120
- if (!pivotColumns) {
2121
- return void 0;
2122
- }
2123
- const {
2124
- pivotColumn,
2125
- pivotRowLabelsColumn,
2126
- pivotBy,
2127
- groupBy,
2128
- pivotTotalColumnPosition,
2129
- toggleGroupRow
2130
- } = params;
2131
- const computedPivotColumns = new Map();
2132
- pivotColumns.forEach((col, key) => {
2133
- if (col.pivotTotalColumn && pivotTotalColumnPosition === false) {
2134
- return;
2135
- }
2136
- let column = __spreadValues({}, col);
2137
- const isPivotRowLabelsColumn = !column.pivotColumn && !column.pivotTotalColumn;
2138
- if (!isPivotRowLabelsColumn) {
2139
- if (pivotColumn) {
2140
- if (typeof pivotColumn === "function") {
2141
- column = __spreadValues(__spreadValues({}, column), pivotColumn({
2142
- column,
2143
- pivotBy,
2144
- groupBy
2145
- }));
2146
- } else {
2147
- column = __spreadValues(__spreadValues({}, column), pivotColumn);
2148
- }
2149
- }
2150
- } else {
2151
- if (pivotRowLabelsColumn) {
2152
- if (typeof pivotRowLabelsColumn === "function") {
2153
- column = __spreadValues(__spreadValues({}, column), pivotRowLabelsColumn({
2154
- column,
2155
- pivotBy,
2156
- groupBy
2157
- }));
2158
- } else {
2159
- column = __spreadValues(__spreadValues({}, column), pivotRowLabelsColumn);
2160
- }
2161
- }
2162
- if (!column.render) {
2163
- column.render = (renderOptions) => {
2164
- var _a;
2165
- let { value, rowInfo, column: column2, groupBy: groupBy2 } = renderOptions;
2166
- if (column2.renderValue) {
2167
- value = column2.renderValue(renderOptions);
2168
- }
2169
- const showExpanderIcon = (((_a = rowInfo.groupKeys) == null ? void 0 : _a.length) || 0) < groupBy2.length;
2170
- return /* @__PURE__ */ React6.createElement("div", {
2171
- className: join(display.flex, alignItems.center, GroupRowExpanderCls)
2172
- }, showExpanderIcon ? /* @__PURE__ */ React6.createElement(ExpanderIcon, {
2173
- expanded: !rowInfo.collapsed,
2174
- onChange: () => {
2175
- toggleGroupRow(rowInfo.groupKeys);
2176
- }
2177
- }) : null, /* @__PURE__ */ React6.createElement("div", {
2178
- className: cssEllipsisClassName
2179
- }, value != null ? value : null));
2180
- };
2181
- }
2182
- }
2183
- if (!column.render && column.renderValue) {
2184
- column.render = (renderOptions) => {
2185
- return column.renderValue(renderOptions);
2186
- };
2187
- }
2188
- computedPivotColumns.set(key, column);
2189
- });
2190
- return computedPivotColumns;
2191
- }
2192
-
2193
2116
  // src/components/InfiniteTable/utils/getColumnForGroupBy.tsx
2194
- var React7 = __toModule(require("react"));
2195
2117
  function getGroupColumnRender({
2196
2118
  groupIndexForColumn,
2197
2119
  groupRenderStrategy,
2198
2120
  toggleGroupRow
2199
2121
  }) {
2200
2122
  return (renderOptions) => {
2201
- var _a;
2202
- let { value, rowInfo, column } = renderOptions;
2123
+ var _a, _b, _c;
2124
+ let { value, rowInfo, column, groupBy, pivotBy } = renderOptions;
2203
2125
  if (column.renderValue) {
2204
2126
  value = column.renderValue(renderOptions);
2205
2127
  }
@@ -2224,14 +2146,20 @@ function getGroupColumnRender({
2224
2146
  return null;
2225
2147
  }
2226
2148
  }
2227
- return /* @__PURE__ */ React7.createElement("div", {
2149
+ let icon = null;
2150
+ const showExpanderIcon = pivotBy ? (((_b = groupRowInfo.groupKeys) == null ? void 0 : _b.length) || 0) < (groupBy == null ? void 0 : groupBy.length) : (((_c = groupRowInfo.groupKeys) == null ? void 0 : _c.length) || 0) <= (groupBy == null ? void 0 : groupBy.length);
2151
+ if (showExpanderIcon) {
2152
+ const defaultIcon = /* @__PURE__ */ React6.createElement(ExpanderIcon, {
2153
+ expanded: !collapsed,
2154
+ onChange: () => {
2155
+ toggleGroupRow(groupKeys);
2156
+ }
2157
+ });
2158
+ icon = column.renderGroupIcon ? column.renderGroupIcon(Object.assign({ collapsed, groupIcon: defaultIcon }, renderOptions)) : defaultIcon;
2159
+ }
2160
+ return /* @__PURE__ */ React6.createElement("div", {
2228
2161
  className: join(display.flex, alignItems.center)
2229
- }, /* @__PURE__ */ React7.createElement(ExpanderIcon, {
2230
- expanded: !collapsed,
2231
- onChange: () => {
2232
- toggleGroupRow(groupKeys);
2233
- }
2234
- }), /* @__PURE__ */ React7.createElement("div", {
2162
+ }, icon, /* @__PURE__ */ React6.createElement("div", {
2235
2163
  className: cssEllipsisClassName
2236
2164
  }, value != null ? value : null));
2237
2165
  };
@@ -2267,21 +2195,29 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
2267
2195
  groupByField: options.groupBy.map((g) => g.field),
2268
2196
  sortable: false,
2269
2197
  render: (renderOptions) => {
2270
- let { value, rowInfo, column } = renderOptions;
2198
+ var _a, _b;
2199
+ let { value, rowInfo, column, groupBy, pivotBy } = renderOptions;
2271
2200
  if (!rowInfo.isGroupRow) {
2272
2201
  return null;
2273
2202
  }
2274
2203
  if (column.renderValue) {
2275
2204
  value = column.renderValue(renderOptions);
2276
2205
  }
2277
- return /* @__PURE__ */ React7.createElement("div", {
2206
+ const collapsed = rowInfo.collapsed;
2207
+ let icon = null;
2208
+ const showExpanderIcon = pivotBy ? (((_a = rowInfo.groupKeys) == null ? void 0 : _a.length) || 0) < (groupBy == null ? void 0 : groupBy.length) : (((_b = rowInfo.groupKeys) == null ? void 0 : _b.length) || 0) <= (groupBy == null ? void 0 : groupBy.length);
2209
+ if (showExpanderIcon) {
2210
+ const defaultIcon = /* @__PURE__ */ React6.createElement(ExpanderIcon, {
2211
+ expanded: !collapsed,
2212
+ onChange: () => {
2213
+ toggleGroupRow(rowInfo.groupKeys);
2214
+ }
2215
+ });
2216
+ icon = column.renderGroupIcon ? column.renderGroupIcon(Object.assign({ collapsed, groupIcon: defaultIcon }, renderOptions)) : defaultIcon;
2217
+ }
2218
+ return /* @__PURE__ */ React6.createElement("div", {
2278
2219
  className: join(display.flex, alignItems.center, GroupRowExpanderCls)
2279
- }, /* @__PURE__ */ React7.createElement(ExpanderIcon, {
2280
- expanded: !rowInfo.collapsed,
2281
- onChange: () => {
2282
- toggleGroupRow(rowInfo.groupKeys);
2283
- }
2284
- }), /* @__PURE__ */ React7.createElement("div", {
2220
+ }, icon, /* @__PURE__ */ React6.createElement("div", {
2285
2221
  className: cssEllipsisClassName
2286
2222
  }, value != null ? value : null));
2287
2223
  }
@@ -2300,7 +2236,7 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
2300
2236
  var import_react16 = __toModule(require("react"));
2301
2237
 
2302
2238
  // src/components/DataSource/index.tsx
2303
- var React8 = __toModule(require("react"));
2239
+ var React7 = __toModule(require("react"));
2304
2240
 
2305
2241
  // src/utils/multisort/sortTypes.ts
2306
2242
  var numberComparator = function(first, second) {
@@ -2648,6 +2584,7 @@ var DeepMap = class {
2648
2584
 
2649
2585
  // src/utils/groupAndPivot/index.ts
2650
2586
  var LAZY_ROOT_KEY_FOR_GROUPS = "____root____";
2587
+ var NOT_LOADED_YET_KEY_PREFIX = "____not_loaded_yet____";
2651
2588
  function DEFAULT_TO_KEY(value) {
2652
2589
  return value;
2653
2590
  }
@@ -2711,13 +2648,23 @@ function lazyGroup(groupParams, rootData) {
2711
2648
  rootData.visitDepthFirst((lazyGroupRowInfo, keys, _index, next) => {
2712
2649
  const [_rootKey, ...currentGroupKeys] = keys;
2713
2650
  const dataArray = lazyGroupRowInfo.items;
2651
+ if (currentGroupKeys.length == groupBy.length) {
2652
+ const deepMapGroupValue = deepMap.get(currentGroupKeys);
2653
+ if (deepMapGroupValue) {
2654
+ deepMapGroupValue.items = dataArray;
2655
+ }
2656
+ return next == null ? void 0 : next();
2657
+ }
2714
2658
  for (let i = 0, len = dataArray.length; i < len; i++) {
2715
2659
  if (!dataArray[i]) {
2716
2660
  const deepMapGroupValue2 = {
2717
2661
  items: [],
2718
2662
  reducerResults: {}
2719
2663
  };
2720
- deepMap.set([...currentGroupKeys, `not-loaded-yet-${i}`], deepMapGroupValue2);
2664
+ deepMap.set([
2665
+ ...currentGroupKeys,
2666
+ `${NOT_LOADED_YET_KEY_PREFIX}${i}`
2667
+ ], deepMapGroupValue2);
2721
2668
  continue;
2722
2669
  }
2723
2670
  const dataObject = dataArray[i].data;
@@ -2728,6 +2675,7 @@ function lazyGroup(groupParams, rootData) {
2728
2675
  currentGroupKeys.push(key);
2729
2676
  const deepMapGroupValue = {
2730
2677
  items: [],
2678
+ commonData: dataObject,
2731
2679
  reducerResults: dataArray[i].aggregations || {}
2732
2680
  };
2733
2681
  deepMap.set(currentGroupKeys, deepMapGroupValue);
@@ -2863,10 +2811,15 @@ function flatten(groupResult) {
2863
2811
  function getEnhancedGroupData(options, deepMapValue) {
2864
2812
  const { groupBy, groupKeys, collapsed, parents, reducers } = options;
2865
2813
  const groupNesting = groupKeys.length;
2866
- const { items: groupItems, reducerResults, pivotDeepMap } = deepMapValue;
2814
+ const {
2815
+ items: groupItems,
2816
+ reducerResults,
2817
+ pivotDeepMap,
2818
+ commonData
2819
+ } = deepMapValue;
2867
2820
  let data = null;
2868
2821
  if (Object.keys(reducerResults).length > 0) {
2869
- data = {};
2822
+ data = commonData || {};
2870
2823
  for (let key in reducers)
2871
2824
  if (reducers.hasOwnProperty(key)) {
2872
2825
  const reducer = reducers[key];
@@ -2876,12 +2829,16 @@ function getEnhancedGroupData(options, deepMapValue) {
2876
2829
  }
2877
2830
  }
2878
2831
  }
2832
+ let theValue = groupKeys[groupKeys.length - 1];
2833
+ if (typeof theValue === "string" && theValue.startsWith(NOT_LOADED_YET_KEY_PREFIX)) {
2834
+ theValue = null;
2835
+ }
2879
2836
  const enhancedGroupData = {
2880
2837
  data,
2881
2838
  groupCount: groupItems.length,
2882
2839
  groupData: groupItems,
2883
2840
  groupKeys,
2884
- id: groupKeys,
2841
+ id: `${groupKeys}`,
2885
2842
  collapsed,
2886
2843
  parents,
2887
2844
  collapsedChildrenCount: 0,
@@ -2889,7 +2846,7 @@ function getEnhancedGroupData(options, deepMapValue) {
2889
2846
  indexInParentGroups: options.indexInParentGroups,
2890
2847
  indexInGroup: options.indexInGroup,
2891
2848
  indexInAll: options.indexInAll,
2892
- value: groupKeys[groupKeys.length - 1],
2849
+ value: theValue,
2893
2850
  rootGroupBy: groupBy,
2894
2851
  groupBy: groupNesting === groupBy.length ? groupBy : groupBy.slice(0, groupNesting),
2895
2852
  isGroupRow: true,
@@ -2958,7 +2915,7 @@ function enhancedFlatten(param) {
2958
2915
  const startIndex = result.length;
2959
2916
  result.push(...items.map((item, index) => {
2960
2917
  return {
2961
- id: toPrimaryKey(item),
2918
+ id: item ? toPrimaryKey(item) : `${groupKeys}-${index}`,
2962
2919
  data: item,
2963
2920
  isGroupRow: false,
2964
2921
  collapsed: false,
@@ -3013,11 +2970,33 @@ function useEffectWithChanges(fn, deps) {
3013
2970
  }, useEffectDeps);
3014
2971
  }
3015
2972
 
2973
+ // src/components/utils/debounce.ts
2974
+ function debounce(fn, { wait }) {
2975
+ let timeout = null;
2976
+ return function(...args) {
2977
+ const context = this;
2978
+ if (timeout !== null) {
2979
+ clearTimeout(timeout);
2980
+ }
2981
+ timeout = setTimeout(() => {
2982
+ fn.apply(context, args);
2983
+ }, wait);
2984
+ };
2985
+ }
2986
+
3016
2987
  // src/components/DataSource/privateHooks/useLoadData.ts
2988
+ var getRafPromise = () => new Promise((resolve) => {
2989
+ requestAnimationFrame(resolve);
2990
+ });
3017
2991
  var SKIP_DATA_CHANGES_KEYS = {
3018
2992
  originalDataArray: true,
3019
2993
  changes: true
3020
2994
  };
2995
+ function getChangeDetect() {
2996
+ var _a;
2997
+ const perfNow = (_a = getGlobal().performance) == null ? void 0 : _a.now();
2998
+ return `${Date.now()}:${perfNow}`;
2999
+ }
3021
3000
  function buildDataSourceDataParams(componentState, overrides) {
3022
3001
  var _a, _b;
3023
3002
  const sortInfo = componentState.multiSort ? componentState.sortInfo : (_b = (_a = componentState.sortInfo) == null ? void 0 : _a[0]) != null ? _b : null;
@@ -3032,7 +3011,7 @@ function buildDataSourceDataParams(componentState, overrides) {
3032
3011
  dataSourceParams.livePaginationCursor = componentState.livePaginationCursor;
3033
3012
  dataSourceParams.cursorId = componentState.cursorId;
3034
3013
  }
3035
- if (componentState.fullLazyLoad) {
3014
+ if (componentState.lazyLoad) {
3036
3015
  if (componentState.lazyLoadBatchSize != null && componentState.lazyLoadBatchSize > 0) {
3037
3016
  dataSourceParams.lazyLoadBatchSize = componentState.lazyLoadBatchSize;
3038
3017
  dataSourceParams.lazyLoadStartIndex = 0;
@@ -3057,15 +3036,34 @@ function buildDataSourceDataParams(componentState, overrides) {
3057
3036
  }
3058
3037
  function loadData(data, componentState, actions, overrides) {
3059
3038
  const dataParams = buildDataSourceDataParams(componentState, overrides);
3039
+ if (componentState.lazyLoad) {
3040
+ const lazyGroupData = componentState.originalLazyGroupData;
3041
+ const key = [LAZY_ROOT_KEY_FOR_GROUPS, ...dataParams.groupKeys || []];
3042
+ const existingGroupRowInfo = lazyGroupData.get(key);
3043
+ if (existingGroupRowInfo && existingGroupRowInfo.cache) {
3044
+ const items = existingGroupRowInfo.items;
3045
+ const len = items.length;
3046
+ let allLoaded = true;
3047
+ for (let i = 0; i < len; i++) {
3048
+ if (items[i] == null) {
3049
+ allLoaded = false;
3050
+ break;
3051
+ }
3052
+ }
3053
+ if (allLoaded) {
3054
+ return Promise.resolve(true);
3055
+ }
3056
+ }
3057
+ }
3060
3058
  if (typeof data === "function") {
3061
3059
  data = data(dataParams);
3062
3060
  }
3063
3061
  const dataIsPromise = typeof data === "object" && typeof data.then === "function";
3064
- if (dataIsPromise) {
3062
+ if (dataIsPromise && !componentState.lazyLoad) {
3065
3063
  actions.loading = true;
3066
3064
  }
3067
- Promise.resolve(data).then((dataParam) => {
3068
- var _a, _b, _c;
3065
+ return Promise.resolve(data).then((dataParam) => {
3066
+ var _a, _b, _c, _d;
3069
3067
  let dataArray = [];
3070
3068
  let skipAssign = false;
3071
3069
  if (Array.isArray(dataParam.data)) {
@@ -3077,10 +3075,11 @@ function loadData(data, componentState, actions, overrides) {
3077
3075
  if (remoteData.mappings) {
3078
3076
  actions.pivotMappings = remoteData.mappings;
3079
3077
  }
3080
- if (componentState.fullLazyLoad && dataParams.groupKeys) {
3081
- const lazyGroupData = DeepMap.clone(componentState.originalLazyGroupData);
3082
- const key = [LAZY_ROOT_KEY_FOR_GROUPS, ...dataParams.groupKeys];
3078
+ if (componentState.lazyLoad) {
3079
+ const lazyGroupData = componentState.originalLazyGroupData;
3080
+ const key = [LAZY_ROOT_KEY_FOR_GROUPS, ...dataParams.groupKeys || []];
3083
3081
  const newGroupRowInfo = {
3082
+ cache: !!remoteData.cache,
3084
3083
  totalCount: (_a = remoteData.totalCount) != null ? _a : dataArray.length,
3085
3084
  items: dataArray
3086
3085
  };
@@ -3088,11 +3087,15 @@ function loadData(data, componentState, actions, overrides) {
3088
3087
  const existingGroupRowInfo = lazyGroupData.get(key);
3089
3088
  const currentGroupRowInfo = existingGroupRowInfo != null ? existingGroupRowInfo : {
3090
3089
  items: [],
3091
- totalCount: newGroupRowInfo.totalCount
3090
+ totalCount: newGroupRowInfo.totalCount,
3091
+ cache: (_b = newGroupRowInfo.cache) != null ? _b : true
3092
3092
  };
3093
+ if (existingGroupRowInfo) {
3094
+ existingGroupRowInfo.cache = newGroupRowInfo.cache;
3095
+ }
3093
3096
  currentGroupRowInfo.items.length = currentGroupRowInfo.totalCount;
3094
- const start = (_b = dataParams.lazyLoadStartIndex) != null ? _b : 0;
3095
- const end = start + ((_c = dataParams.lazyLoadBatchSize) != null ? _c : dataArray.length);
3097
+ const start = (_c = dataParams.lazyLoadStartIndex) != null ? _c : 0;
3098
+ const end = Math.min((_d = remoteData.totalCount) != null ? _d : start + dataParams.lazyLoadBatchSize);
3096
3099
  for (let i = start; i < end; i++) {
3097
3100
  currentGroupRowInfo.items[i] = newGroupRowInfo.items[i - start];
3098
3101
  }
@@ -3103,7 +3106,11 @@ function loadData(data, componentState, actions, overrides) {
3103
3106
  lazyGroupData.set(key, newGroupRowInfo);
3104
3107
  }
3105
3108
  skipAssign = true;
3106
- actions.originalLazyGroupData = lazyGroupData;
3109
+ actions.originalLazyGroupDataChangeDetect = getChangeDetect();
3110
+ if (!dataParams.groupKeys || !dataParams.groupKeys.length) {
3111
+ const topLevelItems = lazyGroupData.get([LAZY_ROOT_KEY_FOR_GROUPS]);
3112
+ actions.originalDataArray = [...topLevelItems.items];
3113
+ }
3107
3114
  }
3108
3115
  } else {
3109
3116
  dataArray = dataParam;
@@ -3111,7 +3118,7 @@ function loadData(data, componentState, actions, overrides) {
3111
3118
  if (!skipAssign) {
3112
3119
  actions.originalDataArray = dataArray;
3113
3120
  }
3114
- if (dataIsPromise) {
3121
+ if (dataIsPromise && !componentState.lazyLoad) {
3115
3122
  actions.loading = false;
3116
3123
  }
3117
3124
  });
@@ -3130,9 +3137,7 @@ function useLoadData() {
3130
3137
  pivotBy,
3131
3138
  livePagination,
3132
3139
  livePaginationCursor,
3133
- cursorId: stateCursorId,
3134
- lazyLoadBatchSize,
3135
- notifyScrollStop
3140
+ cursorId: stateCursorId
3136
3141
  } = componentState;
3137
3142
  const [scrollbars, setScrollbars] = (0, import_react15.useState)({
3138
3143
  vertical: false,
@@ -3173,33 +3178,7 @@ function useLoadData() {
3173
3178
  cursorId: livePagination ? stateCursorId : null
3174
3179
  };
3175
3180
  const initialRef = (0, import_react15.useRef)(true);
3176
- (0, import_react15.useEffect)(() => {
3177
- if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
3178
- return notifyScrollStop.onChange((param) => {
3179
- console.log("scroll stop", param);
3180
- if (!param) {
3181
- return;
3182
- }
3183
- const componentState2 = getComponentState();
3184
- const {
3185
- firstVisibleRowIndex: startIndex,
3186
- lastVisibleRowIndex: endIndex
3187
- } = param;
3188
- const firstBatchStart = Math.floor(startIndex / lazyLoadBatchSize) * lazyLoadBatchSize;
3189
- const lastBatchStart = Math.floor(endIndex / lazyLoadBatchSize) * lazyLoadBatchSize;
3190
- const isRowLoaded = (index) => componentState2.dataArray[index].data != null;
3191
- for (let batchStartIndex = firstBatchStart; batchStartIndex <= lastBatchStart; batchStartIndex = batchStartIndex + lazyLoadBatchSize) {
3192
- if (!isRowLoaded(batchStartIndex)) {
3193
- loadData(componentState2.data, componentState2, actions, {
3194
- lazyLoadBatchSize,
3195
- lazyLoadStartIndex: batchStartIndex
3196
- });
3197
- }
3198
- }
3199
- });
3200
- }
3201
- return;
3202
- }, [lazyLoadBatchSize]);
3181
+ useLazyLoadRange();
3203
3182
  useEffectWithChanges(() => {
3204
3183
  const componentState2 = getComponentState();
3205
3184
  if (typeof componentState2.data !== "function") {
@@ -3220,6 +3199,126 @@ function useLoadData() {
3220
3199
  }
3221
3200
  }, depsObject);
3222
3201
  }
3202
+ function useLazyLoadRange() {
3203
+ const {
3204
+ getComponentState,
3205
+ componentActions: actions,
3206
+ componentState
3207
+ } = useComponentState();
3208
+ const loadingCache = (0, import_react15.useMemo)(() => {
3209
+ return new Map();
3210
+ }, [componentState.data]);
3211
+ globalThis.loadingCache = loadingCache;
3212
+ const {
3213
+ lazyLoadBatchSize,
3214
+ notifyRenderRangeChange,
3215
+ dataArray,
3216
+ scrollStopDelayUpdatedByTable
3217
+ } = componentState;
3218
+ const latestRenderRangeRef = (0, import_react15.useRef)(null);
3219
+ const loadRange = (param, cache = loadingCache) => {
3220
+ const componentState2 = getComponentState();
3221
+ param = param || latestRenderRangeRef.current;
3222
+ if (!param) {
3223
+ return;
3224
+ }
3225
+ const { renderStartIndex: startIndex, renderEndIndex: endIndex } = param;
3226
+ if (!lazyLoadBatchSize || lazyLoadBatchSize <= 0) {
3227
+ return;
3228
+ }
3229
+ lazyLoadRange({
3230
+ startIndex,
3231
+ endIndex,
3232
+ lazyLoadBatchSize,
3233
+ componentState: componentState2,
3234
+ componentActions: actions
3235
+ }, cache);
3236
+ };
3237
+ const debouncedLoadRange = (0, import_react15.useMemo)(() => debounce(loadRange, { wait: scrollStopDelayUpdatedByTable }), [scrollStopDelayUpdatedByTable]);
3238
+ (0, import_react15.useEffect)(() => {
3239
+ if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
3240
+ return notifyRenderRangeChange.onChange((param) => {
3241
+ latestRenderRangeRef.current = param;
3242
+ loadRange(param, loadingCache);
3243
+ });
3244
+ }
3245
+ return;
3246
+ }, [lazyLoadBatchSize, loadingCache]);
3247
+ (0, import_react15.useEffect)(() => {
3248
+ if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
3249
+ debouncedLoadRange();
3250
+ }
3251
+ return;
3252
+ }, [dataArray]);
3253
+ }
3254
+ function lazyLoadRange(options, cache) {
3255
+ const {
3256
+ startIndex,
3257
+ endIndex,
3258
+ lazyLoadBatchSize,
3259
+ componentState,
3260
+ componentActions
3261
+ } = options;
3262
+ const { dataArray } = componentState;
3263
+ const isRowLoaded = (index) => dataArray[index].data != null;
3264
+ const perGroupFnCalls = new DeepMap();
3265
+ const rootGroupKeys = ["_______xxx______"];
3266
+ for (let i = startIndex; i <= endIndex; i++) {
3267
+ const rowInfo = dataArray[i];
3268
+ if (!rowInfo) {
3269
+ continue;
3270
+ }
3271
+ const rowLoaded = rowInfo.data != null;
3272
+ const theGroupKeys = rowInfo.groupKeys ? [...rowInfo.groupKeys] : [];
3273
+ if (rowInfo.groupKeys && rowInfo.isGroupRow) {
3274
+ theGroupKeys.pop();
3275
+ }
3276
+ const cacheKeys = theGroupKeys.length ? theGroupKeys : rootGroupKeys;
3277
+ const indexInGroup = rowInfo.indexInGroup;
3278
+ if (!rowLoaded) {
3279
+ let cachedFnCalls = perGroupFnCalls.get(cacheKeys);
3280
+ const batchStartIndexInGroup = Math.floor(indexInGroup / lazyLoadBatchSize) * lazyLoadBatchSize;
3281
+ const offset = rowInfo.indexInGroup - batchStartIndexInGroup;
3282
+ const absoluteIndexOfBatchStart = dataArray[rowInfo.indexInAll - offset].indexInAll;
3283
+ const batchStartRowLoaded = isRowLoaded(absoluteIndexOfBatchStart);
3284
+ const batchStartRowId = dataArray[absoluteIndexOfBatchStart].id;
3285
+ if (batchStartRowLoaded || (cachedFnCalls == null ? void 0 : cachedFnCalls[batchStartRowId])) {
3286
+ continue;
3287
+ }
3288
+ const shouldSetFnCalls = !cachedFnCalls;
3289
+ cachedFnCalls = cachedFnCalls || {};
3290
+ const currentFnCall = {
3291
+ lazyLoadStartIndex: batchStartIndexInGroup,
3292
+ lazyLoadBatchSize,
3293
+ groupKeys: theGroupKeys
3294
+ };
3295
+ if (!cachedFnCalls[batchStartRowId]) {
3296
+ cachedFnCalls[batchStartRowId] = currentFnCall;
3297
+ }
3298
+ if (shouldSetFnCalls) {
3299
+ perGroupFnCalls.set(cacheKeys, cachedFnCalls);
3300
+ }
3301
+ }
3302
+ }
3303
+ let initialPromise = Promise.resolve(true);
3304
+ const allFnCalls = [];
3305
+ perGroupFnCalls.topDownValues().forEach((record) => {
3306
+ allFnCalls.push(...Object.values(record));
3307
+ });
3308
+ allFnCalls.reduce((promise, fnCall) => {
3309
+ const cacheKey = `${fnCall.groupKeys.join("-")}:${fnCall.lazyLoadStartIndex}`;
3310
+ if (cache && cache.has(cacheKey)) {
3311
+ return promise;
3312
+ }
3313
+ cache == null ? void 0 : cache.set(cacheKey, true);
3314
+ const args = [componentState.data, componentState, componentActions, fnCall];
3315
+ return promise.then(() => getRafPromise()).then(() => loadData(...args)).then(() => {
3316
+ requestAnimationFrame(() => {
3317
+ cache == null ? void 0 : cache.delete(cacheKey);
3318
+ });
3319
+ });
3320
+ }, initialPromise);
3321
+ }
3223
3322
 
3224
3323
  // src/components/DataSource/state/normalizeSortInfo.ts
3225
3324
  var EMPTY_ARRAY = Object.freeze([]);
@@ -3419,8 +3518,11 @@ function initSetupState2() {
3419
3518
  dataParams: void 0,
3420
3519
  notifyScrollbarsChange: buildSubscriptionCallback(),
3421
3520
  notifyScrollStop: buildSubscriptionCallback(),
3521
+ notifyRenderRangeChange: buildSubscriptionCallback(),
3422
3522
  pivotTotalColumnPosition: "end",
3523
+ scrollStopDelayUpdatedByTable: 100,
3423
3524
  originalLazyGroupData,
3525
+ originalLazyGroupDataChangeDetect: 0,
3424
3526
  originalDataArray,
3425
3527
  cursorId: defaultCursorId,
3426
3528
  showSeparatePivotColumnForSingleAggregation: false,
@@ -3451,12 +3553,11 @@ function getCompareObjectForDataParams(dataParams) {
3451
3553
  var forwardProps3 = (setupState) => {
3452
3554
  return {
3453
3555
  onDataParamsChange: (fn) => fn ? discardCallsWithEqualArg(fn, 100, getCompareObjectForDataParams) : void 0,
3454
- fullLazyLoad: 1,
3556
+ lazyLoad: (lazyLoad) => !!lazyLoad,
3455
3557
  data: 1,
3456
3558
  pivotBy: 1,
3457
3559
  primaryKey: 1,
3458
3560
  livePagination: 1,
3459
- lazyLoadBatchSize: (lazyLoadBatchSize) => lazyLoadBatchSize != null ? lazyLoadBatchSize : -1,
3460
3561
  aggregationReducers: 1,
3461
3562
  collapseGroupRowsOnDataFunctionChange: (collapseGroupRowsOnDataFunctionChange) => collapseGroupRowsOnDataFunctionChange != null ? collapseGroupRowsOnDataFunctionChange : true,
3462
3563
  loading: (loading) => loading != null ? loading : false,
@@ -3483,7 +3584,8 @@ function mapPropsToState2(params) {
3483
3584
  const controlledSort = isControlledValue(props.sortInfo);
3484
3585
  const result = {
3485
3586
  controlledSort,
3486
- multiSort: Array.isArray(controlledSort ? props.sortInfo : props.defaultSortInfo)
3587
+ multiSort: Array.isArray(controlledSort ? props.sortInfo : props.defaultSortInfo),
3588
+ lazyLoadBatchSize: typeof props.lazyLoad === "object" ? props.lazyLoad.batchSize : void 0
3487
3589
  };
3488
3590
  if (props.livePagination) {
3489
3591
  const dataArrayChanged = !oldState || oldState.originalDataArray !== state.originalDataArray;
@@ -3496,7 +3598,7 @@ var debugFullLazyLoad = dbg("DataSource:fullLazyLoad");
3496
3598
  function onPropChange(params, props, actions) {
3497
3599
  const { name, newValue } = params;
3498
3600
  if (name === "data" && typeof newValue === "function" && !props.groupRowsState) {
3499
- if (props.fullLazyLoad) {
3601
+ if (props.lazyLoad) {
3500
3602
  debugFullLazyLoad(`"data" function prop has changed`);
3501
3603
  }
3502
3604
  if (props.collapseGroupRowsOnDataFunctionChange !== false) {
@@ -3605,23 +3707,7 @@ function getPivotColumnsAndColumnGroups({
3605
3707
  const aggregationReducers = Object.keys(reducers).map((key) => {
3606
3708
  return __spreadProps(__spreadValues({}, reducers[key]), { id: key });
3607
3709
  });
3608
- const columns = new Map([
3609
- [
3610
- "labels",
3611
- {
3612
- header: "Row labels",
3613
- pivotBy,
3614
- valueGetter: (params) => {
3615
- var _a;
3616
- const { rowInfo } = params;
3617
- if (!rowInfo.data) {
3618
- return "Loading ... TODO replace this with a loading indicator";
3619
- }
3620
- return rowInfo.groupKeys ? rowInfo.groupKeys[((_a = rowInfo.groupKeys) == null ? void 0 : _a.length) - 1] : null;
3621
- }
3622
- }
3623
- ]
3624
- ]);
3710
+ const columns = new Map([]);
3625
3711
  const columnGroups = new Map();
3626
3712
  const isSingleAggregationColumn = !showSeparatePivotColumnForSingleAggregation && aggregationReducers.length === 1;
3627
3713
  deepMap.visitDepthFirst((_value, keys, _indexInGroup, next) => {
@@ -3779,20 +3865,33 @@ function concludeReducer(params) {
3779
3865
  var _a;
3780
3866
  const { state, previousState } = params;
3781
3867
  const sortInfo = state.sortInfo;
3782
- const shouldSort = !!(sortInfo == null ? void 0 : sortInfo.length) && !state.controlledSort;
3783
- const originalDataArrayChanged = haveDepsChanged(previousState, state, [
3868
+ let shouldSort = !!(sortInfo == null ? void 0 : sortInfo.length) && !state.controlledSort;
3869
+ if (state.lazyLoad || state.livePagination) {
3870
+ shouldSort = false;
3871
+ }
3872
+ let originalDataArrayChanged = haveDepsChanged(previousState, state, [
3784
3873
  "originalDataArray"
3785
3874
  ]);
3875
+ const dataSourceChange = previousState && state.data !== previousState.data;
3876
+ let lazyLoadGroupDataChange = state.lazyLoad && previousState && (previousState.groupBy !== state.groupBy || previousState.sortInfo !== state.sortInfo);
3877
+ if (dataSourceChange) {
3878
+ lazyLoadGroupDataChange = true;
3879
+ }
3880
+ if (lazyLoadGroupDataChange) {
3881
+ state.originalLazyGroupData = new DeepMap();
3882
+ originalDataArrayChanged = true;
3883
+ }
3786
3884
  const sortInfoChanged = haveDepsChanged(previousState, state, ["sortInfo"]);
3787
3885
  const sortDepsChanged = originalDataArrayChanged || sortInfoChanged;
3788
3886
  const shouldSortAgain = shouldSort && (sortDepsChanged || !state.lastSortDataArray);
3789
3887
  const groupBy = state.groupBy;
3790
3888
  const pivotBy = state.pivotBy;
3791
3889
  const shouldGroup = groupBy.length || pivotBy;
3792
- const groupsDepsChanged = haveDepsChanged(previousState, state, [
3890
+ const groupsDepsChanged = originalDataArrayChanged || haveDepsChanged(previousState, state, [
3793
3891
  "generateGroupRows",
3794
3892
  "originalDataArray",
3795
3893
  "originalLazyGroupData",
3894
+ "originalLazyGroupDataChangeDetect",
3796
3895
  "groupBy",
3797
3896
  "groupRowsState",
3798
3897
  "pivotBy",
@@ -3813,11 +3912,15 @@ function concludeReducer(params) {
3813
3912
  state.postSortDataArray = dataArray;
3814
3913
  state.groupDeepMap = void 0;
3815
3914
  const toPrimaryKey = (data) => {
3816
- return data[state.primaryKey];
3915
+ const pk = data[state.primaryKey];
3916
+ if (Array.isArray(pk)) {
3917
+ debugger;
3918
+ }
3919
+ return pk;
3817
3920
  };
3818
3921
  if (shouldGroup) {
3819
3922
  if (shouldGroupAgain) {
3820
- const groupResult = state.fullLazyLoad ? lazyGroup({
3923
+ const groupResult = state.lazyLoad ? lazyGroup({
3821
3924
  groupBy,
3822
3925
  pivot: pivotBy,
3823
3926
  mappings: state.pivotMappings,
@@ -3855,7 +3958,7 @@ function concludeReducer(params) {
3855
3958
  state.pivotColumns = void 0;
3856
3959
  const arrayDifferentAfterSortStep = previousState.postSortDataArray != state.postSortDataArray;
3857
3960
  if (arrayDifferentAfterSortStep) {
3858
- rowInfoDataArray = dataArray.map((data, index) => toRowInfo(data, toPrimaryKey(data), index));
3961
+ rowInfoDataArray = dataArray.map((data, index) => toRowInfo(data, data ? toPrimaryKey(data) : index, index));
3859
3962
  }
3860
3963
  }
3861
3964
  state.postGroupDataArray = rowInfoDataArray;
@@ -3883,7 +3986,7 @@ function DataSourceWithContext(props) {
3883
3986
  if (typeof children === "function") {
3884
3987
  children = children(computedValues);
3885
3988
  }
3886
- return /* @__PURE__ */ React8.createElement(React8.Fragment, null, children);
3989
+ return /* @__PURE__ */ React7.createElement(React7.Fragment, null, children);
3887
3990
  }
3888
3991
  var DataSourceRoot = getComponentStateRoot({
3889
3992
  initSetupState: initSetupState2,
@@ -3906,14 +4009,14 @@ function DataSourceCmp({ children }) {
3906
4009
  globalThis.getDataSourceState = getState;
3907
4010
  }
3908
4011
  useLoadData();
3909
- return /* @__PURE__ */ React8.createElement(DataSourceContext.Provider, {
4012
+ return /* @__PURE__ */ React7.createElement(DataSourceContext.Provider, {
3910
4013
  value: contextValue
3911
- }, /* @__PURE__ */ React8.createElement(DataSourceWithContext, {
4014
+ }, /* @__PURE__ */ React7.createElement(DataSourceWithContext, {
3912
4015
  children
3913
4016
  }));
3914
4017
  }
3915
4018
  function DataSource(props) {
3916
- return /* @__PURE__ */ React8.createElement(DataSourceRoot, __spreadValues({}, props), /* @__PURE__ */ React8.createElement(DataSourceCmp, {
4019
+ return /* @__PURE__ */ React7.createElement(DataSourceRoot, __spreadValues({}, props), /* @__PURE__ */ React7.createElement(DataSourceCmp, {
3917
4020
  children: props.children
3918
4021
  }));
3919
4022
  }
@@ -3926,7 +4029,7 @@ function useToggleGroupRow() {
3926
4029
  const newState = new GroupRowsState(state.groupRowsState);
3927
4030
  newState.toggleGroupRow(groupKeys);
3928
4031
  dataSourceActions.groupRowsState = newState;
3929
- if (state.fullLazyLoad && newState.isGroupRowExpanded(groupKeys)) {
4032
+ if (state.lazyLoad && newState.isGroupRowExpanded(groupKeys)) {
3930
4033
  loadData(state.data, state, dataSourceActions, {
3931
4034
  groupKeys
3932
4035
  });
@@ -3964,9 +4067,9 @@ function useColumnsWhen() {
3964
4067
  dataSourceActions.pivotTotalColumnPosition = pivotTotalColumnPosition;
3965
4068
  }, [pivotTotalColumnPosition]);
3966
4069
  useColumnsWhenInlineGroupRenderStrategy(groupByMap);
3967
- useColumnsWhenPivoting();
3968
- useColumnsWhenGrouping();
3969
- useHideEmptyGroupColumns(groupByMap);
4070
+ const { toggleGroupRow } = useColumnsWhenGrouping();
4071
+ useHideEmptyGroupColumns();
4072
+ return { toggleGroupRow };
3970
4073
  }
3971
4074
  function useColumnsWhenInlineGroupRenderStrategy(groupByMap) {
3972
4075
  const toggleGroupRow = useToggleGroupRow();
@@ -3976,6 +4079,9 @@ function useColumnsWhenInlineGroupRenderStrategy(groupByMap) {
3976
4079
  } = useComponentState();
3977
4080
  function computeColumnsWhenInlineGroupRenderStrategy(columns2, groupByMap2, groupRenderStrategy2, toggleGroupRow2) {
3978
4081
  const computedColumns = new Map();
4082
+ if (groupRenderStrategy2 !== "inline") {
4083
+ return;
4084
+ }
3979
4085
  columns2.forEach((column, id) => {
3980
4086
  let base = {};
3981
4087
  const groupByForColumn = groupByMap2.get(column.field);
@@ -4035,51 +4141,32 @@ function useColumnsWhenInlineGroupRenderStrategy(groupByMap) {
4035
4141
  });
4036
4142
  }, [columns, groupByMap, groupRenderStrategy, toggleGroupRow]);
4037
4143
  }
4038
- function useColumnsWhenPivoting() {
4144
+ function useColumnsWhenGrouping() {
4039
4145
  const {
4040
4146
  componentState: { groupBy, pivotBy }
4041
4147
  } = useDataSourceContextValue();
4042
4148
  const {
4043
4149
  componentActions,
4044
4150
  componentState: {
4151
+ columns,
4152
+ groupColumn,
4153
+ groupRenderStrategy,
4045
4154
  pivotColumns,
4046
4155
  pivotColumn,
4047
- pivotRowLabelsColumn,
4048
4156
  pivotTotalColumnPosition
4049
4157
  }
4050
4158
  } = useComponentState();
4051
4159
  const toggleGroupRow = useToggleGroupRow();
4052
4160
  (0, import_react17.useEffect)(() => {
4053
- const computedPivotColumns = getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, {
4054
- pivotColumn,
4055
- pivotRowLabelsColumn,
4056
- pivotTotalColumnPosition,
4057
- pivotBy,
4058
- groupBy,
4059
- toggleGroupRow
4060
- });
4061
- componentActions.computedPivotColumns = computedPivotColumns;
4062
- }, [pivotColumns, pivotColumn, pivotRowLabelsColumn]);
4063
- }
4064
- function useColumnsWhenGrouping() {
4065
- const {
4066
- componentState: { groupBy }
4067
- } = useDataSourceContextValue();
4068
- const {
4069
- componentActions,
4070
- componentState: { columns, groupColumn, groupRenderStrategy, pivotColumns }
4071
- } = useComponentState();
4072
- const toggleGroupRow = useToggleGroupRow();
4073
- (0, import_react17.useEffect)(() => {
4074
- if (pivotColumns) {
4075
- return;
4076
- }
4077
4161
  const update = () => {
4078
4162
  const columnsWhenGrouping = getColumnsWhenGrouping({
4079
4163
  columns,
4080
4164
  groupColumn,
4081
- groupRenderStrategy,
4165
+ pivotColumn,
4166
+ pivotTotalColumnPosition,
4167
+ groupRenderStrategy: groupRenderStrategy === "inline" ? "single-column" : groupRenderStrategy,
4082
4168
  groupBy,
4169
+ pivotBy,
4083
4170
  pivotColumns,
4084
4171
  toggleGroupRow
4085
4172
  });
@@ -4091,11 +4178,25 @@ function useColumnsWhenGrouping() {
4091
4178
  delete: update,
4092
4179
  clear: update
4093
4180
  });
4094
- }, [columns, groupBy, groupColumn, groupRenderStrategy, pivotColumns]);
4181
+ }, [
4182
+ columns,
4183
+ groupBy,
4184
+ pivotBy,
4185
+ groupColumn,
4186
+ groupRenderStrategy,
4187
+ pivotColumns,
4188
+ pivotTotalColumnPosition,
4189
+ pivotColumn
4190
+ ]);
4191
+ return { toggleGroupRow };
4095
4192
  }
4096
- function useHideEmptyGroupColumns(groupRowsMap) {
4193
+ function useHideEmptyGroupColumns() {
4097
4194
  const {
4098
- componentState: { groupBy, groupRowsState },
4195
+ componentState: {
4196
+ groupBy,
4197
+ groupRowsState,
4198
+ originalLazyGroupDataChangeDetect
4199
+ },
4099
4200
  getState: getDataSourceState
4100
4201
  } = useDataSourceContextValue();
4101
4202
  const {
@@ -4148,8 +4249,8 @@ function useHideEmptyGroupColumns(groupRowsMap) {
4148
4249
  getDataSourceState,
4149
4250
  groupRenderStrategy,
4150
4251
  generatedColumns,
4252
+ originalLazyGroupDataChangeDetect,
4151
4253
  groupBy,
4152
- groupRowsMap,
4153
4254
  hideEmptyGroupColumns ? groupRowsState : null,
4154
4255
  hideEmptyGroupColumns
4155
4256
  ]);
@@ -4158,14 +4259,14 @@ function getColumnsWhenGrouping(params) {
4158
4259
  const {
4159
4260
  pivotColumns,
4160
4261
  groupBy,
4262
+ pivotBy,
4161
4263
  groupColumn,
4264
+ pivotTotalColumnPosition,
4265
+ pivotColumn,
4162
4266
  groupRenderStrategy,
4163
4267
  toggleGroupRow,
4164
4268
  columns
4165
4269
  } = params;
4166
- if (pivotColumns) {
4167
- return void 0;
4168
- }
4169
4270
  if (groupRenderStrategy === "inline") {
4170
4271
  return void 0;
4171
4272
  }
@@ -4175,6 +4276,7 @@ function getColumnsWhenGrouping(params) {
4175
4276
  const generatedGroupColumn = getColumnForGroupBy({
4176
4277
  groupByForColumn,
4177
4278
  groupBy,
4279
+ pivotBy,
4178
4280
  groupIndexForColumn,
4179
4281
  groupCount: arr.length,
4180
4282
  groupRenderStrategy
@@ -4185,13 +4287,40 @@ function getColumnsWhenGrouping(params) {
4185
4287
  const singleGroupColumn = getSingleGroupColumn({
4186
4288
  groupCount: groupBy.length,
4187
4289
  groupBy,
4290
+ pivotBy,
4188
4291
  groupRenderStrategy
4189
4292
  }, toggleGroupRow, groupColumn);
4190
4293
  computedColumns.set(singleGroupColumn.id || "group-by", singleGroupColumn);
4191
4294
  }
4192
- columns.forEach((col, colId) => {
4193
- computedColumns.set(colId, col);
4194
- });
4295
+ if (pivotColumns) {
4296
+ pivotColumns.forEach((col, key) => {
4297
+ if (col.pivotTotalColumn && pivotTotalColumnPosition === false) {
4298
+ return;
4299
+ }
4300
+ let column = __spreadValues({}, col);
4301
+ if (pivotColumn) {
4302
+ if (typeof pivotColumn === "function") {
4303
+ column = __spreadValues(__spreadValues({}, column), pivotColumn({
4304
+ column,
4305
+ pivotBy,
4306
+ groupBy
4307
+ }));
4308
+ } else {
4309
+ column = __spreadValues(__spreadValues({}, column), pivotColumn);
4310
+ }
4311
+ }
4312
+ if (!column.render && column.renderValue) {
4313
+ column.render = (renderOptions) => {
4314
+ return column.renderValue(renderOptions);
4315
+ };
4316
+ }
4317
+ computedColumns.set(key, column);
4318
+ });
4319
+ } else {
4320
+ columns.forEach((col, colId) => {
4321
+ computedColumns.set(colId, col);
4322
+ });
4323
+ }
4195
4324
  return computedColumns.size ? computedColumns : void 0;
4196
4325
  }
4197
4326
 
@@ -4230,7 +4359,7 @@ function useComputed() {
4230
4359
  }, [showSeparatePivotColumnForSingleAggregation]);
4231
4360
  const { multiSort } = dataSourceState;
4232
4361
  useColumnGroups();
4233
- useColumnsWhen();
4362
+ const { toggleGroupRow } = useColumnsWhen();
4234
4363
  const setSortInfo = (0, import_react18.useCallback)((sortInfo) => {
4235
4364
  var _a2;
4236
4365
  const newSortInfo = multiSort ? sortInfo : (_a2 = sortInfo[0]) != null ? _a2 : null;
@@ -4299,6 +4428,7 @@ function useComputed() {
4299
4428
  const computedPinnedStartOverflow = computedPinnedStartWidth ? computedPinnedStartColumnsWidth > computedPinnedStartWidth : false;
4300
4429
  const computedPinnedEndOverflow = computedPinnedEndWidth ? computedPinnedEndColumnsWidth > computedPinnedEndWidth : false;
4301
4430
  return {
4431
+ toggleGroupRow,
4302
4432
  computedPinnedStartOverflow,
4303
4433
  computedPinnedEndOverflow,
4304
4434
  computedPinnedStartWidth,
@@ -4322,7 +4452,7 @@ function useComputed() {
4322
4452
  }
4323
4453
 
4324
4454
  // src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx
4325
- var React9 = __toModule(require("react"));
4455
+ var React8 = __toModule(require("react"));
4326
4456
 
4327
4457
  // src/components/InfiniteTable/hooks/useInternalProps.ts
4328
4458
  var useInternalProps = () => {
@@ -4330,9 +4460,9 @@ var useInternalProps = () => {
4330
4460
  };
4331
4461
 
4332
4462
  // src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx
4333
- var InfiniteTableBody = React9.forwardRef(function InfiniteTableBody2(props, ref) {
4463
+ var InfiniteTableBody = React8.forwardRef(function InfiniteTableBody2(props, ref) {
4334
4464
  const { rootClassName: rootClassName12 } = useInternalProps();
4335
- return /* @__PURE__ */ React9.createElement("div", __spreadProps(__spreadValues({
4465
+ return /* @__PURE__ */ React8.createElement("div", __spreadProps(__spreadValues({
4336
4466
  ref
4337
4467
  }, props), {
4338
4468
  className: join(`${rootClassName12}Body`, position.relative, flex["1"], transformTranslateZero, props.className)
@@ -4340,16 +4470,16 @@ var InfiniteTableBody = React9.forwardRef(function InfiniteTableBody2(props, ref
4340
4470
  });
4341
4471
 
4342
4472
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx
4343
- var React21 = __toModule(require("react"));
4473
+ var React20 = __toModule(require("react"));
4344
4474
 
4345
4475
  // src/components/InfiniteTable/components/ScrollbarPlaceholder.tsx
4346
- var React10 = __toModule(require("react"));
4476
+ var React9 = __toModule(require("react"));
4347
4477
  function HorizontalScrollbarPlaceholderFn(props) {
4348
4478
  const scrollbarWidth2 = getScrollbarWidth();
4349
4479
  if (!scrollbarWidth2) {
4350
4480
  return null;
4351
4481
  }
4352
- return /* @__PURE__ */ React10.createElement("div", {
4482
+ return /* @__PURE__ */ React9.createElement("div", {
4353
4483
  "data-name": "horizontal-scrollbar-placeholder",
4354
4484
  style: __spreadValues({
4355
4485
  position: "absolute",
@@ -4359,13 +4489,13 @@ function HorizontalScrollbarPlaceholderFn(props) {
4359
4489
  }, props.style)
4360
4490
  });
4361
4491
  }
4362
- var HorizontalScrollbarPlaceholder = React10.memo(HorizontalScrollbarPlaceholderFn);
4492
+ var HorizontalScrollbarPlaceholder = React9.memo(HorizontalScrollbarPlaceholderFn);
4363
4493
  function VerticalScrollbarPlaceholderFn(props) {
4364
4494
  const scrollbarWidth2 = getScrollbarWidth();
4365
4495
  if (!scrollbarWidth2) {
4366
4496
  return null;
4367
4497
  }
4368
- return /* @__PURE__ */ React10.createElement("div", {
4498
+ return /* @__PURE__ */ React9.createElement("div", {
4369
4499
  "data-name": "vertical-scrollbar-placeholder",
4370
4500
  style: __spreadValues({
4371
4501
  position: "absolute",
@@ -4375,7 +4505,7 @@ function VerticalScrollbarPlaceholderFn(props) {
4375
4505
  }, props.style)
4376
4506
  });
4377
4507
  }
4378
- var VerticalScrollbarPlaceholder = React10.memo(VerticalScrollbarPlaceholderFn);
4508
+ var VerticalScrollbarPlaceholder = React9.memo(VerticalScrollbarPlaceholderFn);
4379
4509
 
4380
4510
  // src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts
4381
4511
  var import_createRuntimeFn3 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
@@ -4390,15 +4520,15 @@ var HeaderSortIconCls = "_12zfob11 _16lm1iw1";
4390
4520
  var HeaderWrapperCls = "_12zfob1v _16lm1iw16 _16lm1iw1 _16lm1iwj _16lm1iw10";
4391
4521
 
4392
4522
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
4393
- var React17 = __toModule(require("react"));
4523
+ var React16 = __toModule(require("react"));
4394
4524
  var import_react26 = __toModule(require("react"));
4395
4525
 
4396
4526
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
4397
- var React13 = __toModule(require("react"));
4527
+ var React12 = __toModule(require("react"));
4398
4528
  var import_react22 = __toModule(require("react"));
4399
4529
 
4400
4530
  // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
4401
- var React11 = __toModule(require("react"));
4531
+ var React10 = __toModule(require("react"));
4402
4532
 
4403
4533
  // src/components/InfiniteTable/hooks/useInfiniteTableState.ts
4404
4534
  var import_react19 = __toModule(require("react"));
@@ -4457,16 +4587,16 @@ function InfiniteTableCellFn(props) {
4457
4587
  style.transform = `translate3d(${shiftLeft}px, 0px, 0px)`;
4458
4588
  }
4459
4589
  }
4460
- return /* @__PURE__ */ React11.createElement("div", __spreadProps(__spreadValues({}, domProps), {
4590
+ return /* @__PURE__ */ React10.createElement("div", __spreadProps(__spreadValues({}, domProps), {
4461
4591
  ref: domRef,
4462
4592
  style,
4463
4593
  "data-name": `Cell`,
4464
4594
  className: join(domProps.className, columnAlignCellStyle[(_b = column.align) != null ? _b : "start"], justifyContent[(_c = column.align) != null ? _c : "start"], InfiniteTableCellClassName, CellCls2, shifting ? `${InfiniteTableCellClassName}--shifting ${CellClsVariants.shifting}` : "")
4465
- }), beforeChildren, cssEllipsis ? /* @__PURE__ */ React11.createElement("div", {
4595
+ }), beforeChildren, cssEllipsis ? /* @__PURE__ */ React10.createElement("div", {
4466
4596
  className: `${rootClassName2}Cell_content ${cssEllipsisClassName}`
4467
4597
  }, children) : children, afterChildren);
4468
4598
  }
4469
- var InfiniteTableCell = React11.memo(InfiniteTableCellFn);
4599
+ var InfiniteTableCell = React10.memo(InfiniteTableCellFn);
4470
4600
 
4471
4601
  // src/components/InfiniteTable/hooks/useColumnPointerEvents.ts
4472
4602
  var import_binary_search = __toModule(require_binary_search());
@@ -4661,7 +4791,7 @@ function useCellClassName(column, baseClasses, variants, extraFlags) {
4661
4791
  var import_react_dom = __toModule(require("react-dom"));
4662
4792
 
4663
4793
  // src/components/InfiniteTable/components/icons/SortIcon.tsx
4664
- var React12 = __toModule(require("react"));
4794
+ var React11 = __toModule(require("react"));
4665
4795
  var import_react21 = __toModule(require("react"));
4666
4796
  var defaultLineStyle = {
4667
4797
  marginTop: 2,
@@ -4715,18 +4845,18 @@ function SortIcon(props) {
4715
4845
  if (direction === -1) {
4716
4846
  indexStyle.top = "100%";
4717
4847
  }
4718
- return /* @__PURE__ */ React12.createElement("div", {
4848
+ return /* @__PURE__ */ React11.createElement("div", {
4719
4849
  style: __spreadProps(__spreadValues({}, style), { width: size }),
4720
4850
  className: join(className, "ITableIcon", "ITableIcon-sort")
4721
- }, showIndex ? /* @__PURE__ */ React12.createElement("div", {
4851
+ }, showIndex ? /* @__PURE__ */ React11.createElement("div", {
4722
4852
  "data-name": "index",
4723
4853
  style: indexStyle
4724
- }, index) : null, /* @__PURE__ */ React12.createElement("div", {
4854
+ }, index) : null, /* @__PURE__ */ React11.createElement("div", {
4725
4855
  style: __spreadValues({ width: sizes[0] }, lineStyle),
4726
4856
  onTransitionEnd
4727
- }), /* @__PURE__ */ React12.createElement("div", {
4857
+ }), /* @__PURE__ */ React11.createElement("div", {
4728
4858
  style: __spreadValues({ width: sizes[1] }, lineStyle)
4729
- }), /* @__PURE__ */ React12.createElement("div", {
4859
+ }), /* @__PURE__ */ React11.createElement("div", {
4730
4860
  style: __spreadValues({ width: sizes[2] }, lineStyle)
4731
4861
  }));
4732
4862
  }
@@ -4757,7 +4887,7 @@ function InfiniteTableHeaderCell(props) {
4757
4887
  });
4758
4888
  }
4759
4889
  header = header != null ? header : column.name;
4760
- const sortTool = /* @__PURE__ */ React13.createElement(SortIcon, {
4890
+ const sortTool = /* @__PURE__ */ React12.createElement(SortIcon, {
4761
4891
  index: column.computedMultiSort ? column.computedSortIndex + 1 : void 0,
4762
4892
  className: `${baseCls}__sort-icon ${HeaderSortIconCls}`,
4763
4893
  direction: column.computedSorted ? column.computedSortedAsc ? 1 : -1 : 0
@@ -4795,7 +4925,7 @@ function InfiniteTableHeaderCell(props) {
4795
4925
  let offset = offsetFromProps != null ? offsetFromProps : virtualized ? 0 : column.computedPinningOffset;
4796
4926
  let draggingProxy = null;
4797
4927
  if (dragging) {
4798
- draggingProxy = /* @__PURE__ */ React13.createElement("div", {
4928
+ draggingProxy = /* @__PURE__ */ React12.createElement("div", {
4799
4929
  className: `${baseCls}Proxy ${HeaderCellProxy}`,
4800
4930
  style: {
4801
4931
  position: "absolute",
@@ -4808,7 +4938,7 @@ function InfiniteTableHeaderCell(props) {
4808
4938
  }, header);
4809
4939
  draggingProxy = (0, import_react_dom.createPortal)(draggingProxy, portalDOMRef.current);
4810
4940
  }
4811
- return /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(InfiniteTableCell, {
4941
+ return /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(InfiniteTableCell, {
4812
4942
  domRef: ref,
4813
4943
  column,
4814
4944
  "data-name": `HeaderCell`,
@@ -4824,11 +4954,11 @@ function InfiniteTableHeaderCell(props) {
4824
4954
  }
4825
4955
 
4826
4956
  // src/components/RawList/index.tsx
4827
- var React16 = __toModule(require("react"));
4957
+ var React15 = __toModule(require("react"));
4828
4958
  var import_react25 = __toModule(require("react"));
4829
4959
 
4830
4960
  // src/components/RawList/AvoidReactDiff.tsx
4831
- var React14 = __toModule(require("react"));
4961
+ var React13 = __toModule(require("react"));
4832
4962
  var import_react23 = __toModule(require("react"));
4833
4963
  function AvoidReactDiffFn(props) {
4834
4964
  const [children, setChildren] = (0, import_react23.useState)(props.updater.get());
@@ -4838,15 +4968,15 @@ function AvoidReactDiffFn(props) {
4838
4968
  });
4839
4969
  return remove;
4840
4970
  }, [props.updater]);
4841
- return /* @__PURE__ */ React14.createElement(React14.Fragment, null, children);
4971
+ return /* @__PURE__ */ React13.createElement(React13.Fragment, null, children);
4842
4972
  }
4843
- var AvoidReactDiff = React14.memo(AvoidReactDiffFn);
4973
+ var AvoidReactDiff = React13.memo(AvoidReactDiffFn);
4844
4974
 
4845
4975
  // src/components/RawList/useVirtualRenderer.ts
4846
4976
  var import_react24 = __toModule(require("react"));
4847
4977
 
4848
4978
  // src/components/RawList/ReactVirtualRenderer.tsx
4849
- var React15 = __toModule(require("react"));
4979
+ var React14 = __toModule(require("react"));
4850
4980
 
4851
4981
  // src/components/RawList/MappedItems.ts
4852
4982
  var MappedItems = class extends Logger {
@@ -5091,7 +5221,7 @@ var ReactVirtualRenderer = class extends Logger {
5091
5221
  };
5092
5222
  this.itemDOMRefs[elementIndex] = domRef;
5093
5223
  this.updaters[elementIndex] = buildSubscriptionCallback();
5094
- const item = /* @__PURE__ */ React15.createElement(AvoidReactDiff, {
5224
+ const item = /* @__PURE__ */ React14.createElement(AvoidReactDiff, {
5095
5225
  key: elementIndex,
5096
5226
  name: `${elementIndex}`,
5097
5227
  updater: this.updaters[elementIndex]
@@ -5188,11 +5318,11 @@ function RawListFn(props) {
5188
5318
  });
5189
5319
  return remove;
5190
5320
  }, [brain, onRenderUpdater]);
5191
- return /* @__PURE__ */ React16.createElement(AvoidReactDiff, {
5321
+ return /* @__PURE__ */ React15.createElement(AvoidReactDiff, {
5192
5322
  updater: onRenderUpdater
5193
5323
  });
5194
5324
  }
5195
- var RawList = React16.memo(RawListFn);
5325
+ var RawList = React15.memo(RawListFn);
5196
5326
 
5197
5327
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
5198
5328
  var debug3 = dbg("Header");
@@ -5213,7 +5343,7 @@ function InfiniteTableHeaderFn(props) {
5213
5343
  }
5214
5344
  return null;
5215
5345
  }
5216
- return /* @__PURE__ */ React17.createElement(InfiniteTableHeaderCell, {
5346
+ return /* @__PURE__ */ React16.createElement(InfiniteTableHeaderCell, {
5217
5347
  domRef: domRef2,
5218
5348
  column,
5219
5349
  headerHeight,
@@ -5238,18 +5368,18 @@ function InfiniteTableHeaderFn(props) {
5238
5368
  className: join(TableHeaderClassName, `${TableHeaderClassName}--virtualized`, className, headerCls),
5239
5369
  style
5240
5370
  };
5241
- return /* @__PURE__ */ React17.createElement("div", __spreadValues({}, domProps), /* @__PURE__ */ React17.createElement(RawList, {
5371
+ return /* @__PURE__ */ React16.createElement("div", __spreadValues({}, domProps), /* @__PURE__ */ React16.createElement(RawList, {
5242
5372
  brain,
5243
5373
  renderItem: renderColumn
5244
5374
  }));
5245
5375
  }
5246
- var InfiniteTableHeader = React17.memo(InfiniteTableHeaderFn);
5376
+ var InfiniteTableHeader = React16.memo(InfiniteTableHeaderFn);
5247
5377
 
5248
5378
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderUnvirtualized.tsx
5249
- var React20 = __toModule(require("react"));
5379
+ var React19 = __toModule(require("react"));
5250
5380
 
5251
5381
  // src/components/InfiniteTable/components/InfiniteTableHeader/renderColumnHeaderGroups.tsx
5252
- var React19 = __toModule(require("react"));
5382
+ var React18 = __toModule(require("react"));
5253
5383
 
5254
5384
  // src/components/InfiniteTable/components/InfiniteTableHeader/buildColumnAndGroupTree.ts
5255
5385
  function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
@@ -5339,7 +5469,7 @@ function assignGroupOffsetsAndComputedWidths(items, groupOffset = 0) {
5339
5469
  }
5340
5470
 
5341
5471
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderGroup.tsx
5342
- var React18 = __toModule(require("react"));
5472
+ var React17 = __toModule(require("react"));
5343
5473
  var TableHeaderGroupClassName = `${rootClassName}HeaderGroup`;
5344
5474
  function InfiniteTableHeaderGroup(props) {
5345
5475
  const { columnGroup, height, headerHeight } = props;
@@ -5353,16 +5483,16 @@ function InfiniteTableHeaderGroup(props) {
5353
5483
  width: columnGroup.computedWidth,
5354
5484
  height
5355
5485
  };
5356
- return /* @__PURE__ */ React18.createElement("div", {
5486
+ return /* @__PURE__ */ React17.createElement("div", {
5357
5487
  "data-group-id": columnGroup.id,
5358
5488
  className: join(HeaderGroupCls, TableHeaderGroupClassName, `${TableHeaderGroupClassName}--unvirtualized`),
5359
5489
  style
5360
- }, /* @__PURE__ */ React18.createElement("div", {
5490
+ }, /* @__PURE__ */ React17.createElement("div", {
5361
5491
  className: join(`${TableHeaderGroupClassName}__header`, HeaderGroup_Header),
5362
5492
  style: { height: headerHeight }
5363
- }, /* @__PURE__ */ React18.createElement("div", {
5493
+ }, /* @__PURE__ */ React17.createElement("div", {
5364
5494
  className: join(`${TableHeaderGroupClassName}__header-content`, cssEllipsisClassName)
5365
- }, header)), /* @__PURE__ */ React18.createElement("div", {
5495
+ }, header)), /* @__PURE__ */ React17.createElement("div", {
5366
5496
  className: join(`${TableHeaderGroupClassName}__children`, HeaderGroup_Children)
5367
5497
  }, props.children));
5368
5498
  }
@@ -5385,7 +5515,7 @@ function renderColumnHeaderGroups(config) {
5385
5515
  return items2.map((colGroupItem) => {
5386
5516
  if (colGroupItem.type === "column") {
5387
5517
  const col = colGroupItem.ref;
5388
- return /* @__PURE__ */ React19.createElement(InfiniteTableHeaderCell, {
5518
+ return /* @__PURE__ */ React18.createElement(InfiniteTableHeaderCell, {
5389
5519
  key: col.id,
5390
5520
  headerHeight: (columnGroupsMaxDepth - colGroupItem.depth + 2) * headerHeight,
5391
5521
  column: col,
@@ -5399,7 +5529,7 @@ function renderColumnHeaderGroups(config) {
5399
5529
  colIds.push(col.id);
5400
5530
  return col;
5401
5531
  });
5402
- return /* @__PURE__ */ React19.createElement(InfiniteTableHeaderGroup, {
5532
+ return /* @__PURE__ */ React18.createElement(InfiniteTableHeaderGroup, {
5403
5533
  key: `${colGroupItem.uniqueGroupId.join("/")}`,
5404
5534
  columns: columns2,
5405
5535
  height: (columnGroupsMaxDepth - colGroupItem.depth + 2) * headerHeight,
@@ -5452,9 +5582,9 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
5452
5582
  },
5453
5583
  computed: { computedVisibleColumnsMap: columnsMap }
5454
5584
  } = useInfiniteTable();
5455
- const domRef = React20.useRef(null);
5585
+ const domRef = React19.useRef(null);
5456
5586
  const hasColumnGroups = computedColumnGroups.size > 0;
5457
- const columnHeaderGroups = React20.useMemo(() => {
5587
+ const columnHeaderGroups = React19.useMemo(() => {
5458
5588
  return hasColumnGroups ? renderColumnHeaderGroups({
5459
5589
  columnGroups: computedColumnGroups,
5460
5590
  columnGroupsDepthsMap,
@@ -5473,7 +5603,7 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
5473
5603
  columnGroupsMaxDepth
5474
5604
  ]);
5475
5605
  const children = hasColumnGroups ? columnHeaderGroups : columns.map((c) => {
5476
- return /* @__PURE__ */ React20.createElement(InfiniteTableHeaderCell, {
5606
+ return /* @__PURE__ */ React19.createElement(InfiniteTableHeaderCell, {
5477
5607
  key: c.id,
5478
5608
  headerHeight,
5479
5609
  column: c,
@@ -5496,20 +5626,20 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
5496
5626
  const removeOnScroll = scroller.onScroll(onScroll);
5497
5627
  return removeOnScroll;
5498
5628
  }, [brain, scrollListener]);
5499
- return /* @__PURE__ */ React20.createElement("div", __spreadProps(__spreadValues({}, domProps), {
5629
+ return /* @__PURE__ */ React19.createElement("div", __spreadProps(__spreadValues({}, domProps), {
5500
5630
  className: join(TableHeaderClassName2, `${TableHeaderClassName2}--unvirtualized`, pinning ? `${TableHeaderClassName2}--pinned ${TableHeaderClassName2}-${pinning}` : "", scrollable ? `${TableHeaderClassName2}--overflow` : "", domProps.className, HeaderClsRecipe({
5501
5631
  pinned: pinning,
5502
5632
  virtualized: false,
5503
5633
  overflow: scrollable
5504
5634
  })),
5505
5635
  style
5506
- }), /* @__PURE__ */ React20.createElement("div", {
5636
+ }), /* @__PURE__ */ React19.createElement("div", {
5507
5637
  style: { width: totalWidth },
5508
5638
  className: join(flexFlow.row, display.flex),
5509
5639
  ref: domRef
5510
5640
  }, children));
5511
5641
  }
5512
- var InfiniteTableHeaderUnvirtualized = React20.memo(InfiniteTableHeaderUnvirtualizedFn);
5642
+ var InfiniteTableHeaderUnvirtualized = React19.memo(InfiniteTableHeaderUnvirtualizedFn);
5513
5643
 
5514
5644
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx
5515
5645
  function TableHeaderWrapper(props) {
@@ -5542,7 +5672,7 @@ function TableHeaderWrapper(props) {
5542
5672
  const unvirtualizedStyle = !virtualizeHeader && computedPinnedStartColumnsWidth ? {
5543
5673
  left: computedPinnedStartWidth
5544
5674
  } : void 0;
5545
- const header = virtualizeHeader ? /* @__PURE__ */ React21.createElement(InfiniteTableHeader, {
5675
+ const header = virtualizeHeader ? /* @__PURE__ */ React20.createElement(InfiniteTableHeader, {
5546
5676
  columns: computedUnpinnedColumns,
5547
5677
  repaintId: virtualizeHeader ? repaintId : void 0,
5548
5678
  brain,
@@ -5555,7 +5685,7 @@ function TableHeaderWrapper(props) {
5555
5685
  },
5556
5686
  availableWidth: computedUnpinnedColumnsWidth,
5557
5687
  totalWidth: computedUnpinnedColumnsWidth
5558
- }) : /* @__PURE__ */ React21.createElement(InfiniteTableHeaderUnvirtualized, {
5688
+ }) : /* @__PURE__ */ React20.createElement(InfiniteTableHeaderUnvirtualized, {
5559
5689
  style: unvirtualizedStyle,
5560
5690
  brain,
5561
5691
  scrollable: true,
@@ -5564,12 +5694,12 @@ function TableHeaderWrapper(props) {
5564
5694
  availableWidth: computedUnpinnedColumnsWidth,
5565
5695
  totalWidth: computedUnpinnedColumnsWidth
5566
5696
  });
5567
- return /* @__PURE__ */ React21.createElement("div", {
5697
+ return /* @__PURE__ */ React20.createElement("div", {
5568
5698
  className: HeaderWrapperCls,
5569
5699
  style: {
5570
5700
  height: virtualizeHeader ? height : void 0
5571
5701
  }
5572
- }, hasPinnedStart ? /* @__PURE__ */ React21.createElement(InfiniteTableHeaderUnvirtualized, {
5702
+ }, hasPinnedStart ? /* @__PURE__ */ React20.createElement(InfiniteTableHeaderUnvirtualized, {
5573
5703
  style: {
5574
5704
  left: 0,
5575
5705
  position: "absolute",
@@ -5581,7 +5711,7 @@ function TableHeaderWrapper(props) {
5581
5711
  scrollable: computedPinnedStartOverflow,
5582
5712
  pinning: "start",
5583
5713
  scrollListener: computedPinnedStartOverflow ? pinnedStartScrollListener : void 0
5584
- }) : null, header, hasPinnedEnd ? /* @__PURE__ */ React21.createElement(InfiniteTableHeaderUnvirtualized, {
5714
+ }) : null, header, hasPinnedEnd ? /* @__PURE__ */ React20.createElement(InfiniteTableHeaderUnvirtualized, {
5585
5715
  style: {
5586
5716
  right: scrollbars.vertical ? getScrollbarWidth() : 0,
5587
5717
  position: "absolute",
@@ -5593,7 +5723,7 @@ function TableHeaderWrapper(props) {
5593
5723
  scrollable: computedPinnedEndOverflow,
5594
5724
  pinning: "end",
5595
5725
  scrollListener: computedPinnedEndOverflow ? pinnedEndScrollListener : void 0
5596
- }) : null, scrollbars.vertical ? /* @__PURE__ */ React21.createElement(VerticalScrollbarPlaceholder, {
5726
+ }) : null, scrollbars.vertical ? /* @__PURE__ */ React20.createElement(VerticalScrollbarPlaceholder, {
5597
5727
  style: {
5598
5728
  height: "100%",
5599
5729
  right: 0
@@ -5602,7 +5732,7 @@ function TableHeaderWrapper(props) {
5602
5732
  }
5603
5733
 
5604
5734
  // src/components/VirtualScrollContainer/index.tsx
5605
- var React22 = __toModule(require("react"));
5735
+ var React21 = __toModule(require("react"));
5606
5736
  var import_react29 = __toModule(require("react"));
5607
5737
 
5608
5738
  // src/components/hooks/useOnScroll.ts
@@ -5646,7 +5776,7 @@ var getScrollableClassName = (scrollable) => {
5646
5776
 
5647
5777
  // src/components/VirtualScrollContainer/index.tsx
5648
5778
  var rootClassName6 = "InfiniteVirtualScrollContainer";
5649
- var VirtualScrollContainer = React22.forwardRef(function VirtualScrollContainer2(props, ref) {
5779
+ var VirtualScrollContainer = React21.forwardRef(function VirtualScrollContainer2(props, ref) {
5650
5780
  const {
5651
5781
  children,
5652
5782
  scrollable = true,
@@ -5656,7 +5786,7 @@ var VirtualScrollContainer = React22.forwardRef(function VirtualScrollContainer2
5656
5786
  } = props;
5657
5787
  const domRef = ref != null ? ref : (0, import_react29.useRef)(null);
5658
5788
  useOnScroll(domRef, onContainerScroll);
5659
- return /* @__PURE__ */ React22.createElement("div", {
5789
+ return /* @__PURE__ */ React21.createElement("div", {
5660
5790
  ref: domRef,
5661
5791
  style,
5662
5792
  className: join(className, rootClassName6, VirtualScrollContainerCls, getScrollableClassName(scrollable))
@@ -5664,7 +5794,7 @@ var VirtualScrollContainer = React22.forwardRef(function VirtualScrollContainer2
5664
5794
  });
5665
5795
 
5666
5796
  // src/components/VirtualList/SpacePlaceholder.tsx
5667
- var React23 = __toModule(require("react"));
5797
+ var React22 = __toModule(require("react"));
5668
5798
  function SpacePlaceholderFn(props) {
5669
5799
  const { height, width, count } = props;
5670
5800
  const style = {
@@ -5674,7 +5804,7 @@ function SpacePlaceholderFn(props) {
5674
5804
  opacity: 0,
5675
5805
  pointerEvents: "none"
5676
5806
  };
5677
- return /* @__PURE__ */ React23.createElement("div", {
5807
+ return /* @__PURE__ */ React22.createElement("div", {
5678
5808
  "data-count": count,
5679
5809
  "data-placeholder-width": true ? width : void 0,
5680
5810
  "data-placeholder-height": true ? height : void 0,
@@ -5682,20 +5812,20 @@ function SpacePlaceholderFn(props) {
5682
5812
  style
5683
5813
  });
5684
5814
  }
5685
- var SpacePlaceholder = React23.memo(SpacePlaceholderFn);
5815
+ var SpacePlaceholder = React22.memo(SpacePlaceholderFn);
5686
5816
 
5687
5817
  // src/components/InfiniteTable/hooks/useListRendering.tsx
5688
5818
  var import_react41 = __toModule(require("react"));
5689
5819
 
5690
5820
  // src/components/InfiniteTable/hooks/useUnpinnedRendering.tsx
5691
- var React29 = __toModule(require("react"));
5821
+ var React28 = __toModule(require("react"));
5692
5822
  var import_react33 = __toModule(require("react"));
5693
5823
 
5694
5824
  // src/components/VirtualList/VirtualRowList.tsx
5695
- var React25 = __toModule(require("react"));
5825
+ var React24 = __toModule(require("react"));
5696
5826
 
5697
5827
  // src/components/VirtualList/VirtualList.tsx
5698
- var React24 = __toModule(require("react"));
5828
+ var React23 = __toModule(require("react"));
5699
5829
  var import_react30 = __toModule(require("react"));
5700
5830
 
5701
5831
  // src/components/VirtualList/VirtualList.css.ts
@@ -5777,19 +5907,19 @@ var VirtualList = (props) => {
5777
5907
  if (true) {
5778
5908
  domProps["data-cmp-name"] = `VirtualList`;
5779
5909
  }
5780
- return /* @__PURE__ */ React24.createElement(React24.Fragment, null, /* @__PURE__ */ React24.createElement("div", __spreadValues({}, domProps), /* @__PURE__ */ React24.createElement(VirtualScrollContainer, {
5910
+ return /* @__PURE__ */ React23.createElement(React23.Fragment, null, /* @__PURE__ */ React23.createElement("div", __spreadValues({}, domProps), /* @__PURE__ */ React23.createElement(VirtualScrollContainer, {
5781
5911
  scrollable,
5782
5912
  onContainerScroll
5783
- }, /* @__PURE__ */ React24.createElement("div", {
5913
+ }, /* @__PURE__ */ React23.createElement("div", {
5784
5914
  ref: domRef,
5785
5915
  className: scrollTransformTargetCls,
5786
5916
  "data-name": "scroll-transform-target"
5787
- }, /* @__PURE__ */ React24.createElement(RawList, {
5917
+ }, /* @__PURE__ */ React23.createElement(RawList, {
5788
5918
  brain: virtualBrain,
5789
5919
  renderItem,
5790
5920
  repaintId,
5791
5921
  debugChannel: "VirtualList-" + mainAxis
5792
- })), children, /* @__PURE__ */ React24.createElement(SpacePlaceholder, {
5922
+ })), children, /* @__PURE__ */ React23.createElement(SpacePlaceholder, {
5793
5923
  count,
5794
5924
  width,
5795
5925
  height
@@ -5799,14 +5929,14 @@ var VirtualList = (props) => {
5799
5929
  // src/components/VirtualList/VirtualRowList.tsx
5800
5930
  var VirtualRowList = (props) => {
5801
5931
  const _a = props, { rowWidth, rowHeight, renderRow } = _a, listProps = __objRest(_a, ["rowWidth", "rowHeight", "renderRow"]);
5802
- const renderItem = React25.useCallback((renderProps) => {
5932
+ const renderItem = React24.useCallback((renderProps) => {
5803
5933
  return renderRow({
5804
5934
  domRef: renderProps.domRef,
5805
5935
  rowHeight: renderProps.itemSize,
5806
5936
  rowIndex: renderProps.itemIndex
5807
5937
  });
5808
5938
  }, [renderRow]);
5809
- return /* @__PURE__ */ React25.createElement(VirtualList, __spreadProps(__spreadValues({}, listProps), {
5939
+ return /* @__PURE__ */ React24.createElement(VirtualList, __spreadProps(__spreadValues({}, listProps), {
5810
5940
  renderItem,
5811
5941
  mainAxis: "vertical",
5812
5942
  itemMainAxisSize: rowHeight,
@@ -5815,11 +5945,11 @@ var VirtualRowList = (props) => {
5815
5945
  };
5816
5946
 
5817
5947
  // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRow.tsx
5818
- var React27 = __toModule(require("react"));
5948
+ var React26 = __toModule(require("react"));
5819
5949
  var import_react32 = __toModule(require("react"));
5820
5950
 
5821
5951
  // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableColumnCell.tsx
5822
- var React26 = __toModule(require("react"));
5952
+ var React25 = __toModule(require("react"));
5823
5953
  var { rootClassName: rootClassName8 } = internalProps;
5824
5954
  var InfiniteTableColumnCellClassName = `${rootClassName8}ColumnCell`;
5825
5955
  function isColumnWithField(c) {
@@ -5844,9 +5974,6 @@ function InfiniteTableColumnCellFn(props) {
5844
5974
  }
5845
5975
  const { data, isGroupRow, groupBy } = rowInfo;
5846
5976
  const groupRowInfo = null;
5847
- if (rowInfo.indexInAll === 0 && column.groupByField && column.groupByField === "stack") {
5848
- debugger;
5849
- }
5850
5977
  let value = isGroupRow && groupBy && column.groupByField ? rowInfo.value : isColumnWithField(column) ? data == null ? void 0 : data[column.field] : null;
5851
5978
  if (column.valueGetter) {
5852
5979
  value = column.valueGetter(isGroupRow ? {
@@ -5879,7 +6006,8 @@ function InfiniteTableColumnCellFn(props) {
5879
6006
  rowIndex,
5880
6007
  toggleGroupRow,
5881
6008
  toggleCurrentGroupRow: () => toggleGroupRow(rowInfo.groupKeys),
5882
- groupBy: computedDataSource.groupBy
6009
+ groupBy: computedDataSource.groupBy,
6010
+ pivotBy: computedDataSource.pivotBy
5883
6011
  });
5884
6012
  if (column.render) {
5885
6013
  renderValue = column.render(renderParam);
@@ -5915,7 +6043,7 @@ function InfiniteTableColumnCellFn(props) {
5915
6043
  }
5916
6044
  }
5917
6045
  }
5918
- return /* @__PURE__ */ React26.createElement(InfiniteTableCell, __spreadProps(__spreadValues({
6046
+ return /* @__PURE__ */ React25.createElement(InfiniteTableCell, __spreadProps(__spreadValues({
5919
6047
  domRef,
5920
6048
  offsetProperty
5921
6049
  }, dataset), {
@@ -5926,7 +6054,7 @@ function InfiniteTableColumnCellFn(props) {
5926
6054
  className: join(useCellClassName(column, [InfiniteTableColumnCellClassName, InfiniteTableCellClassName], ColumnCellRecipe, { dragging: false }), colClassName)
5927
6055
  }), hidden ? null : renderValue);
5928
6056
  }
5929
- var InfiniteTableColumnCell = React26.memo(InfiniteTableColumnCellFn);
6057
+ var InfiniteTableColumnCell = React25.memo(InfiniteTableColumnCellFn);
5930
6058
 
5931
6059
  // src/components/InfiniteTable/components/InfiniteTableRow/useRowDOMProps.ts
5932
6060
  var import_react31 = __toModule(require("react"));
@@ -6057,12 +6185,12 @@ function InfiniteTableRowFn(props) {
6057
6185
  height: rowHeight
6058
6186
  }, domProps.style);
6059
6187
  const renderCellRef = (0, import_react32.useRef)(null);
6060
- const renderCell = React27.useCallback(({ domRef, itemIndex }) => {
6188
+ const renderCell = React26.useCallback(({ domRef, itemIndex }) => {
6061
6189
  const column = columns[itemIndex];
6062
6190
  if (!column) {
6063
6191
  }
6064
6192
  const hidden = false;
6065
- return /* @__PURE__ */ React27.createElement(InfiniteTableColumnCell, {
6193
+ return /* @__PURE__ */ React26.createElement(InfiniteTableColumnCell, {
6066
6194
  getData,
6067
6195
  rowInfo,
6068
6196
  groupRenderStrategy,
@@ -6089,18 +6217,18 @@ function InfiniteTableRowFn(props) {
6089
6217
  if (true) {
6090
6218
  domProps["data-cmp-name"] = "ITableRow";
6091
6219
  }
6092
- return /* @__PURE__ */ React27.createElement("div", __spreadProps(__spreadValues({}, domProps), {
6220
+ return /* @__PURE__ */ React26.createElement("div", __spreadProps(__spreadValues({}, domProps), {
6093
6221
  style
6094
- }), /* @__PURE__ */ React27.createElement(RawList, {
6222
+ }), /* @__PURE__ */ React26.createElement(RawList, {
6095
6223
  brain,
6096
6224
  renderItem: renderCell,
6097
6225
  debugChannel: `${rowIndex}`
6098
6226
  }));
6099
6227
  }
6100
- var InfiniteTableRow = React27.memo(InfiniteTableRowFn);
6228
+ var InfiniteTableRow = React26.memo(InfiniteTableRowFn);
6101
6229
 
6102
6230
  // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRowUnvirtualized.tsx
6103
- var React28 = __toModule(require("react"));
6231
+ var React27 = __toModule(require("react"));
6104
6232
  function TableRowUnvirtualizedFn(props) {
6105
6233
  const {
6106
6234
  rowHeight,
@@ -6121,7 +6249,7 @@ function TableRowUnvirtualizedFn(props) {
6121
6249
  }, domProps.style);
6122
6250
  const children = columns.map((col) => {
6123
6251
  const hidden = false;
6124
- return /* @__PURE__ */ React28.createElement(InfiniteTableColumnCell, {
6252
+ return /* @__PURE__ */ React27.createElement(InfiniteTableColumnCell, {
6125
6253
  key: col.id,
6126
6254
  virtualized: false,
6127
6255
  rowHeight,
@@ -6134,11 +6262,11 @@ function TableRowUnvirtualizedFn(props) {
6134
6262
  column: col
6135
6263
  });
6136
6264
  });
6137
- return /* @__PURE__ */ React28.createElement("div", __spreadProps(__spreadValues({}, domProps), {
6265
+ return /* @__PURE__ */ React27.createElement("div", __spreadProps(__spreadValues({}, domProps), {
6138
6266
  style
6139
6267
  }), children);
6140
6268
  }
6141
- var TableRowUnvirtualized = React28.memo(TableRowUnvirtualizedFn);
6269
+ var TableRowUnvirtualized = React27.memo(TableRowUnvirtualizedFn);
6142
6270
 
6143
6271
  // src/components/InfiniteTable/hooks/useUnpinnedRendering.tsx
6144
6272
  function useUnpinnedRendering(params) {
@@ -6181,7 +6309,7 @@ function useUnpinnedRendering(params) {
6181
6309
  rowProps.repaintId = repaintId;
6182
6310
  }
6183
6311
  const TableRowComponent = shouldVirtualizeColumns ? InfiniteTableRow : TableRowUnvirtualized;
6184
- return /* @__PURE__ */ React29.createElement(TableRowComponent, __spreadValues({}, rowProps));
6312
+ return /* @__PURE__ */ React28.createElement(TableRowComponent, __spreadValues({}, rowProps));
6185
6313
  }, [
6186
6314
  repaintId,
6187
6315
  rowHeight,
@@ -6191,7 +6319,7 @@ function useUnpinnedRendering(params) {
6191
6319
  horizontalVirtualBrain,
6192
6320
  verticalVirtualBrain
6193
6321
  ]);
6194
- const fakeScrollbar = getScrollbarWidth() ? /* @__PURE__ */ React29.createElement("div", {
6322
+ const fakeScrollbar = getScrollbarWidth() ? /* @__PURE__ */ React28.createElement("div", {
6195
6323
  "data-name": "horizontal-scrollbar-placeholder--fake",
6196
6324
  style: {
6197
6325
  position: "absolute",
@@ -6202,10 +6330,10 @@ function useUnpinnedRendering(params) {
6202
6330
  overflow: "auto",
6203
6331
  visibility: columnShifts ? "visible" : "hidden"
6204
6332
  }
6205
- }, /* @__PURE__ */ React29.createElement("div", {
6333
+ }, /* @__PURE__ */ React28.createElement("div", {
6206
6334
  style: { height: "100%", width: computedUnpinnedColumnsWidth }
6207
6335
  })) : null;
6208
- return rowHeight != 0 ? /* @__PURE__ */ React29.createElement(VirtualRowList, {
6336
+ return rowHeight != 0 ? /* @__PURE__ */ React28.createElement(VirtualRowList, {
6209
6337
  repaintId: `${repaintId}-unpinned-`,
6210
6338
  brain: verticalVirtualBrain,
6211
6339
  onContainerScroll: applyScrollHorizontal,
@@ -6348,11 +6476,11 @@ var useOnContainerScroll = ({
6348
6476
  };
6349
6477
 
6350
6478
  // src/components/InfiniteTable/hooks/usePinnedRendering.tsx
6351
- var React31 = __toModule(require("react"));
6479
+ var React30 = __toModule(require("react"));
6352
6480
  var import_react37 = __toModule(require("react"));
6353
6481
 
6354
6482
  // src/components/VirtualList/RowListWithExternalScrolling.tsx
6355
- var React30 = __toModule(require("react"));
6483
+ var React29 = __toModule(require("react"));
6356
6484
  var import_react36 = __toModule(require("react"));
6357
6485
 
6358
6486
  // src/components/hooks/useOnMount.ts
@@ -6428,7 +6556,7 @@ var RowListWithExternalScrolling = (props) => {
6428
6556
  if (true) {
6429
6557
  domProps["data-cmp-name"] = "RowListWithExternalScrolling";
6430
6558
  }
6431
- return /* @__PURE__ */ React30.createElement("div", __spreadValues({}, domProps), /* @__PURE__ */ React30.createElement(RawList, {
6559
+ return /* @__PURE__ */ React29.createElement("div", __spreadValues({}, domProps), /* @__PURE__ */ React29.createElement(RawList, {
6432
6560
  brain,
6433
6561
  renderItem,
6434
6562
  repaintId
@@ -6451,7 +6579,7 @@ function PinnedRowsContainer(props) {
6451
6579
  brain,
6452
6580
  renderRow
6453
6581
  } = props;
6454
- const style = React31.useMemo(() => {
6582
+ const style = React30.useMemo(() => {
6455
6583
  const result = pinning === "end" ? {
6456
6584
  width: rowWidth,
6457
6585
  height,
@@ -6477,7 +6605,7 @@ function PinnedRowsContainer(props) {
6477
6605
  className: join(`${PinnedRowsContainerClassName}`, PinnedRowsClsVariants[pinning === "start" ? "pinnedStart" : "pinnedEnd"], `${PinnedRowsContainerClassName}--pinned-${pinning}`, `${PinnedRowsContainerClassName}--overflow`, PinnedRowsClsVariants.overflow)
6478
6606
  };
6479
6607
  if (hasOverflow) {
6480
- return /* @__PURE__ */ React31.createElement(VirtualScrollContainer, {
6608
+ return /* @__PURE__ */ React30.createElement(VirtualScrollContainer, {
6481
6609
  scrollable: {
6482
6610
  horizontal: true,
6483
6611
  vertical: false
@@ -6493,18 +6621,18 @@ function PinnedRowsContainer(props) {
6493
6621
  className: join(PinnedRowsContainerClsVariants({
6494
6622
  pinned: pinning
6495
6623
  }), `${PinnedRowsContainerClassName}Container`, `${PinnedRowsContainerClassName}Container--pinned-${pinning}`)
6496
- }, /* @__PURE__ */ React31.createElement(RowListWithExternalScrolling, __spreadProps(__spreadValues({}, rowListProps), {
6624
+ }, /* @__PURE__ */ React30.createElement(RowListWithExternalScrolling, __spreadProps(__spreadValues({}, rowListProps), {
6497
6625
  onMount: (node) => {
6498
6626
  pinnedScrollListener == null ? void 0 : pinnedScrollListener.onScroll((scrollPosition) => {
6499
6627
  updateScroll(node, brain.getScrollPosition(), scrollPosition);
6500
6628
  });
6501
6629
  }
6502
- })), /* @__PURE__ */ React31.createElement(SpacePlaceholder, {
6630
+ })), /* @__PURE__ */ React30.createElement(SpacePlaceholder, {
6503
6631
  width: rowWidth,
6504
6632
  height: 1
6505
6633
  }));
6506
6634
  }
6507
- return /* @__PURE__ */ React31.createElement(RowListWithExternalScrolling, __spreadValues({}, rowListProps));
6635
+ return /* @__PURE__ */ React30.createElement(RowListWithExternalScrolling, __spreadValues({}, rowListProps));
6508
6636
  }
6509
6637
  function useRenderPinnedRow(params) {
6510
6638
  const { getData, getState, columnsWidth, columns, verticalBrain } = params;
@@ -6524,7 +6652,7 @@ function useRenderPinnedRow(params) {
6524
6652
  rowWidth: columnsWidth,
6525
6653
  columns
6526
6654
  }, rowParams);
6527
- return /* @__PURE__ */ React31.createElement(TableRowUnvirtualized, __spreadValues({}, rowProps));
6655
+ return /* @__PURE__ */ React30.createElement(TableRowUnvirtualized, __spreadValues({}, rowProps));
6528
6656
  }, [columnsWidth, columns, verticalBrain]);
6529
6657
  return renderPinnedRow;
6530
6658
  }
@@ -6567,7 +6695,7 @@ function usePinnedRenderingForSide(side, params) {
6567
6695
  columns,
6568
6696
  columnsWidth
6569
6697
  });
6570
- const pinnedList = columns.length && rowHeight !== 0 ? /* @__PURE__ */ React31.createElement(PinnedRowsContainer, {
6698
+ const pinnedList = columns.length && rowHeight !== 0 ? /* @__PURE__ */ React30.createElement(PinnedRowsContainer, {
6571
6699
  pinning: side,
6572
6700
  pinnedScrollListener,
6573
6701
  hasOverflow,
@@ -6580,7 +6708,7 @@ function usePinnedRenderingForSide(side, params) {
6580
6708
  brain: verticalVirtualBrain,
6581
6709
  renderRow: renderRowPinned
6582
6710
  }) : null;
6583
- const pinnedScrollbarPlaceholder = pinnedList && hasHorizontalScrollbar && !hasOverflow ? /* @__PURE__ */ React31.createElement(HorizontalScrollbarPlaceholder, {
6711
+ const pinnedScrollbarPlaceholder = pinnedList && hasHorizontalScrollbar && !hasOverflow ? /* @__PURE__ */ React30.createElement(HorizontalScrollbarPlaceholder, {
6584
6712
  style: side === "end" ? {
6585
6713
  width: columnsWidth,
6586
6714
  right: hasVerticalScrollbar ? getScrollbarWidth() : 0
@@ -7149,7 +7277,8 @@ function useListRendering(param) {
7149
7277
  computedUnpinnedColumnsWidth,
7150
7278
  computedPinnedStartOverflow,
7151
7279
  computedPinnedEndOverflow,
7152
- computedVisibleColumns
7280
+ computedVisibleColumns,
7281
+ toggleGroupRow
7153
7282
  } = computed;
7154
7283
  const { componentState: dataSourceState, getState: getDataSourceState } = useDataSourceContextValue();
7155
7284
  const { dataArray } = dataSourceState;
@@ -7233,12 +7362,6 @@ function useListRendering(param) {
7233
7362
  horizontalVirtualBrain,
7234
7363
  reservedContentHeight
7235
7364
  });
7236
- const { componentActions: dataSourceActions } = useDataSourceContextValue();
7237
- const toggleGroupRow = (0, import_react41.useCallback)((groupKeys) => {
7238
- const newState = new GroupRowsState(getDataSourceState().groupRowsState);
7239
- newState.toggleGroupRow(groupKeys);
7240
- dataSourceActions.groupRowsState = newState;
7241
- }, []);
7242
7365
  const pinnedRenderingParams = {
7243
7366
  bodySize,
7244
7367
  scrollbars,
@@ -7292,7 +7415,7 @@ function useListRendering(param) {
7292
7415
  }
7293
7416
 
7294
7417
  // src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
7295
- var React32 = __toModule(require("react"));
7418
+ var React31 = __toModule(require("react"));
7296
7419
  var import_react42 = __toModule(require("react"));
7297
7420
 
7298
7421
  // src/components/utils/decamelize.ts
@@ -7328,10 +7451,10 @@ var enforceStyle = (node, style) => {
7328
7451
  node.style.setProperty(decamelize(propertyName), propertyValue, "important");
7329
7452
  }
7330
7453
  };
7331
- var InfiniteTableLicenseFooter = React32.forwardRef(function InfiniteTableLicenseFooter2(props, ref) {
7454
+ var InfiniteTableLicenseFooter = React31.forwardRef(function InfiniteTableLicenseFooter2(props, ref) {
7332
7455
  const { rootClassName: rootClassName12 } = useInternalProps();
7333
- const domRef = React32.useRef(null);
7334
- const domCallback = React32.useCallback((node) => {
7456
+ const domRef = React31.useRef(null);
7457
+ const domCallback = React31.useCallback((node) => {
7335
7458
  domRef.current = node;
7336
7459
  if (!ref) {
7337
7460
  return;
@@ -7356,12 +7479,12 @@ var InfiniteTableLicenseFooter = React32.forwardRef(function InfiniteTableLicens
7356
7479
  clearInterval(intervalId);
7357
7480
  };
7358
7481
  }, []);
7359
- return /* @__PURE__ */ React32.createElement("div", __spreadProps(__spreadValues({
7482
+ return /* @__PURE__ */ React31.createElement("div", __spreadProps(__spreadValues({
7360
7483
  ref: domCallback
7361
7484
  }, props), {
7362
7485
  className: join(`${rootClassName12}-Footer`, FooterCls, props.className),
7363
7486
  style: defaultStyle2
7364
- }), "Powered by", " ", /* @__PURE__ */ React32.createElement("a", {
7487
+ }), "Powered by", " ", /* @__PURE__ */ React31.createElement("a", {
7365
7488
  href: "https://infinite-table.com",
7366
7489
  rel: "noopener noreferrer",
7367
7490
  role: "link",
@@ -7523,7 +7646,7 @@ var useLicense = (licenseKey = "") => {
7523
7646
  const valid = (0, import_react43.useMemo)(() => {
7524
7647
  let valid2 = isValidLicense(licenseKey, {
7525
7648
  publishedAt: 1624970570587,
7526
- version: "0.2.0"
7649
+ version: "0.2.4"
7527
7650
  });
7528
7651
  if (!licenseKey && !valid2 && isInsideSandbox) {
7529
7652
  return true;
@@ -7534,7 +7657,7 @@ var useLicense = (licenseKey = "") => {
7534
7657
  };
7535
7658
 
7536
7659
  // src/components/CSSVariableWatch.tsx
7537
- var React33 = __toModule(require("react"));
7660
+ var React32 = __toModule(require("react"));
7538
7661
  var import_react44 = __toModule(require("react"));
7539
7662
  var error = err("CSSVariableWatch");
7540
7663
  var debug5 = dbg("CSSVariableWatch");
@@ -7549,14 +7672,14 @@ var WRAPPER_STYLE = {
7549
7672
  };
7550
7673
  var useCSSVariableWatch = (params) => {
7551
7674
  const lastValueRef = (0, import_react44.useRef)(0);
7552
- const onResize = React33.useCallback(({ height }) => {
7675
+ const onResize = React32.useCallback(({ height }) => {
7553
7676
  if (height && height !== lastValueRef.current) {
7554
7677
  lastValueRef.current = height;
7555
7678
  params.onChange(height);
7556
7679
  }
7557
7680
  }, [params.onChange]);
7558
7681
  useResizeObserver(params.ref, onResize, { earlyAttach: true });
7559
- React33.useLayoutEffect(() => {
7682
+ React32.useLayoutEffect(() => {
7560
7683
  const value = params.ref.current.getBoundingClientRect().height;
7561
7684
  if (value) {
7562
7685
  lastValueRef.current = value;
@@ -7572,11 +7695,11 @@ var CSSVariableWatch = (props) => {
7572
7695
  useCSSVariableWatch(__spreadProps(__spreadValues({}, props), {
7573
7696
  ref: domRef
7574
7697
  }));
7575
- return /* @__PURE__ */ React33.createElement("div", {
7698
+ return /* @__PURE__ */ React32.createElement("div", {
7576
7699
  "data-name": "css-variable-watcher",
7577
7700
  "data-var": props.varName,
7578
7701
  style: WRAPPER_STYLE
7579
- }, /* @__PURE__ */ React33.createElement("div", {
7702
+ }, /* @__PURE__ */ React32.createElement("div", {
7580
7703
  ref: domRef,
7581
7704
  style: {
7582
7705
  height: props.varName.startsWith("var(") ? props.varName : `var(${props.varName})`
@@ -7669,7 +7792,7 @@ function useDOMProps(initialDOMProps) {
7669
7792
  }
7670
7793
 
7671
7794
  // src/components/InfiniteTable/components/LoadMask.tsx
7672
- var React34 = __toModule(require("react"));
7795
+ var React33 = __toModule(require("react"));
7673
7796
 
7674
7797
  // src/components/InfiniteTable/components/LoadMask.css.ts
7675
7798
  var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2 _16lm1iwr _16lm1iwt _16lm1iwx _16lm1iwv", hidden: "qy58ya2 qy58ya0 _16lm1iw2 _16lm1iwr _16lm1iwt _16lm1iwx _16lm1iwv" };
@@ -7681,15 +7804,15 @@ var { rootClassName: rootClassName11 } = internalProps;
7681
7804
  var baseCls2 = `${rootClassName11}-LoadMask`;
7682
7805
  function LoadMaskFn(props) {
7683
7806
  const { visible, children = "Loading" } = props;
7684
- return /* @__PURE__ */ React34.createElement("div", {
7807
+ return /* @__PURE__ */ React33.createElement("div", {
7685
7808
  className: `${LoadMaskCls[visible ? "visible" : "hidden"]} ${baseCls2}`
7686
- }, /* @__PURE__ */ React34.createElement("div", {
7809
+ }, /* @__PURE__ */ React33.createElement("div", {
7687
7810
  className: `${LoadMaskOverlayCls} ${baseCls2}-Overlay`
7688
- }), /* @__PURE__ */ React34.createElement("div", {
7811
+ }), /* @__PURE__ */ React33.createElement("div", {
7689
7812
  className: `${LoadMaskTextCls} ${baseCls2}-Text`
7690
7813
  }, children));
7691
7814
  }
7692
- var LoadMask = React34.memo(LoadMaskFn);
7815
+ var LoadMask = React33.memo(LoadMaskFn);
7693
7816
 
7694
7817
  // src/components/InfiniteTable/index.tsx
7695
7818
  var InfiniteTableClassName = internalProps.rootClassName;
@@ -7708,7 +7831,7 @@ var InfiniteTableRoot = getComponentStateRoot({
7708
7831
  getParentState: () => useDataSource(),
7709
7832
  debugName: "InfiniteTable"
7710
7833
  });
7711
- var InfiniteTableComponent = React35.memo(function InfiniteTableComponent2() {
7834
+ var InfiniteTableComponent = React34.memo(function InfiniteTableComponent2() {
7712
7835
  var _a;
7713
7836
  const {
7714
7837
  componentState,
@@ -7718,7 +7841,8 @@ var InfiniteTableComponent = React35.memo(function InfiniteTableComponent2() {
7718
7841
  } = useInfiniteTable();
7719
7842
  const {
7720
7843
  componentState: { dataArray, loading },
7721
- getState: getDataSourceState
7844
+ getState: getDataSourceState,
7845
+ componentActions: dataSourceActions
7722
7846
  } = useDataSourceContextValue();
7723
7847
  const {
7724
7848
  domRef,
@@ -7731,7 +7855,8 @@ var InfiniteTableComponent = React35.memo(function InfiniteTableComponent2() {
7731
7855
  onHeaderHeightCSSVarChange,
7732
7856
  rowHeightCSSVar,
7733
7857
  headerHeightCSSVar,
7734
- components
7858
+ components,
7859
+ scrollStopDelay
7735
7860
  } = componentState;
7736
7861
  const { columnShifts, bodySize } = componentState;
7737
7862
  const {
@@ -7744,6 +7869,7 @@ var InfiniteTableComponent = React35.memo(function InfiniteTableComponent2() {
7744
7869
  scrollbars,
7745
7870
  applyScrollVertical,
7746
7871
  horizontalVirtualBrain,
7872
+ verticalVirtualBrain,
7747
7873
  reservedContentHeight
7748
7874
  } = useListRendering({
7749
7875
  getComputed,
@@ -7752,10 +7878,17 @@ var InfiniteTableComponent = React35.memo(function InfiniteTableComponent2() {
7752
7878
  bodySize,
7753
7879
  computed
7754
7880
  });
7881
+ React34.useEffect(() => {
7882
+ const dataSourceState = getDataSourceState();
7883
+ const onChange = debounce((renderRange) => {
7884
+ dataSourceState.notifyRenderRangeChange(renderRange);
7885
+ }, { wait: scrollStopDelay });
7886
+ return verticalVirtualBrain.onRenderRangeChange(onChange);
7887
+ }, [verticalVirtualBrain, scrollStopDelay]);
7755
7888
  const licenseValid = useLicense(licenseKey);
7756
7889
  const domProps = useDOMProps(componentState.domProps);
7757
7890
  const LoadMaskCmp = (_a = components == null ? void 0 : components.LoadMask) != null ? _a : LoadMask;
7758
- React35.useLayoutEffect(() => {
7891
+ React34.useLayoutEffect(() => {
7759
7892
  const dataSourceState = getDataSourceState();
7760
7893
  const { onScrollbarsChange } = getInfiniteTableState();
7761
7894
  const { notifyScrollbarsChange } = dataSourceState;
@@ -7764,31 +7897,34 @@ var InfiniteTableComponent = React35.memo(function InfiniteTableComponent2() {
7764
7897
  }
7765
7898
  notifyScrollbarsChange(scrollbars);
7766
7899
  }, [scrollbars]);
7767
- return /* @__PURE__ */ React35.createElement("div", __spreadValues({
7900
+ React34.useEffect(() => {
7901
+ dataSourceActions.scrollStopDelayUpdatedByTable = scrollStopDelay;
7902
+ }, [scrollStopDelay]);
7903
+ return /* @__PURE__ */ React34.createElement("div", __spreadValues({
7768
7904
  ref: domRef
7769
- }, domProps), header ? /* @__PURE__ */ React35.createElement(TableHeaderWrapper, {
7905
+ }, domProps), header ? /* @__PURE__ */ React34.createElement(TableHeaderWrapper, {
7770
7906
  brain: horizontalVirtualBrain,
7771
7907
  repaintId,
7772
7908
  scrollbars
7773
- }) : null, /* @__PURE__ */ React35.createElement(InfiniteTableBody, null, /* @__PURE__ */ React35.createElement(VirtualScrollContainer, {
7909
+ }) : null, /* @__PURE__ */ React34.createElement(InfiniteTableBody, null, /* @__PURE__ */ React34.createElement(VirtualScrollContainer, {
7774
7910
  ref: scrollerDOMRef,
7775
7911
  onContainerScroll: applyScrollVertical,
7776
7912
  scrollable: ONLY_VERTICAL_SCROLLBAR
7777
- }, /* @__PURE__ */ React35.createElement("div", {
7913
+ }, /* @__PURE__ */ React34.createElement("div", {
7778
7914
  className: display.flex
7779
- }, pinnedStartList, centerList, pinnedEndList), /* @__PURE__ */ React35.createElement(SpacePlaceholder, {
7915
+ }, pinnedStartList, centerList, pinnedEndList), /* @__PURE__ */ React34.createElement(SpacePlaceholder, {
7780
7916
  count: dataArray.length,
7781
7917
  width: 0,
7782
7918
  height: reservedContentHeight
7783
- })), pinnedStartScrollbarPlaceholder, pinnedEndScrollbarPlaceholder, /* @__PURE__ */ React35.createElement(LoadMaskCmp, {
7919
+ })), pinnedStartScrollbarPlaceholder, pinnedEndScrollbarPlaceholder, /* @__PURE__ */ React34.createElement(LoadMaskCmp, {
7784
7920
  visible: loading
7785
- }, loadingText)), licenseValid ? null : /* @__PURE__ */ React35.createElement(InfiniteTableLicenseFooter, null), /* @__PURE__ */ React35.createElement("div", {
7921
+ }, loadingText)), licenseValid ? null : /* @__PURE__ */ React34.createElement(InfiniteTableLicenseFooter, null), /* @__PURE__ */ React34.createElement("div", {
7786
7922
  ref: portalDOMRef,
7787
7923
  className: join(`${rootClassName}Portal`, zIndex[1e3], position.absolute, top[0], left[0])
7788
- }), rowHeightCSSVar ? /* @__PURE__ */ React35.createElement(CSSVariableWatch, {
7924
+ }), rowHeightCSSVar ? /* @__PURE__ */ React34.createElement(CSSVariableWatch, {
7789
7925
  varName: rowHeightCSSVar,
7790
7926
  onChange: onRowHeightCSSVarChange
7791
- }) : null, headerHeightCSSVar ? /* @__PURE__ */ React35.createElement(CSSVariableWatch, {
7927
+ }) : null, headerHeightCSSVar ? /* @__PURE__ */ React34.createElement(CSSVariableWatch, {
7792
7928
  varName: headerHeightCSSVar,
7793
7929
  onChange: onHeaderHeightCSSVarChange
7794
7930
  }) : null);
@@ -7824,25 +7960,25 @@ function InfiniteTableContextProvider() {
7824
7960
  }
7825
7961
  componentActions.bodySize = bodySize;
7826
7962
  }, { earlyAttach: true });
7827
- React35.useEffect(() => {
7963
+ React34.useEffect(() => {
7828
7964
  return () => {
7829
7965
  componentState.onRowHeightCSSVarChange.destroy();
7830
7966
  componentState.onHeaderHeightCSSVarChange.destroy();
7831
7967
  };
7832
7968
  }, []);
7833
- React35.useEffect(() => {
7969
+ React34.useEffect(() => {
7834
7970
  if (scrollerDOMRef.current) {
7835
7971
  scrollerDOMRef.current.scrollTop = 0;
7836
7972
  }
7837
7973
  }, [scrollTopId, scrollerDOMRef]);
7838
7974
  const TableContext2 = getInfiniteTableContext();
7839
- return /* @__PURE__ */ React35.createElement(TableContext2.Provider, {
7975
+ return /* @__PURE__ */ React34.createElement(TableContext2.Provider, {
7840
7976
  value: contextValue
7841
- }, /* @__PURE__ */ React35.createElement(InfiniteTableComponent, null));
7977
+ }, /* @__PURE__ */ React34.createElement(InfiniteTableComponent, null));
7842
7978
  }
7843
7979
  function InfiniteTable(props) {
7844
- const table = /* @__PURE__ */ React35.createElement(InfiniteTableRoot, __spreadValues({}, props), /* @__PURE__ */ React35.createElement(InfiniteTableContextProvider, null));
7845
- return /* @__PURE__ */ React35.createElement(React35.StrictMode, null, table);
7980
+ const table = /* @__PURE__ */ React34.createElement(InfiniteTableRoot, __spreadValues({}, props), /* @__PURE__ */ React34.createElement(InfiniteTableContextProvider, null));
7981
+ return /* @__PURE__ */ React34.createElement(React34.StrictMode, null, table);
7846
7982
  }
7847
7983
  InfiniteTable.defaultProps = {
7848
7984
  rowHeight: 40,