@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.esm.js CHANGED
@@ -619,7 +619,7 @@ var require_binary_search = __commonJS({
619
619
  // src/components/InfiniteTable/index.tsx
620
620
  import {
621
621
  StrictMode,
622
- createElement as createElement33,
622
+ createElement as createElement32,
623
623
  memo as memo13,
624
624
  useEffect as useEffect24,
625
625
  useLayoutEffect as useLayoutEffect5
@@ -768,7 +768,6 @@ function initSetupState() {
768
768
  draggingColumnId: null,
769
769
  pinnedStartScrollListener: new ScrollListener(),
770
770
  pinnedEndScrollListener: new ScrollListener(),
771
- computedPivotColumns: void 0,
772
771
  columnsWhenInlineGroupRenderStrategy: void 0
773
772
  };
774
773
  }
@@ -799,7 +798,6 @@ var forwardProps = (setupState) => {
799
798
  pinnedStartMaxWidth: 1,
800
799
  pinnedEndMaxWidth: 1,
801
800
  pivotColumn: 1,
802
- pivotRowLabelsColumn: 1,
803
801
  pivotColumnGroups: 1,
804
802
  onScrollbarsChange: 1,
805
803
  scrollStopDelay: (scrollStopDelay) => scrollStopDelay != null ? scrollStopDelay : 100,
@@ -856,7 +854,7 @@ var mapPropsToState = (params) => {
856
854
  groupBy,
857
855
  groupColumn: props.groupColumn
858
856
  });
859
- const computedColumns = state.computedPivotColumns || state.columnsWhenGrouping || state.columnsWhenInlineGroupRenderStrategy || state.columns;
857
+ const computedColumns = state.columnsWhenGrouping || state.columnsWhenInlineGroupRenderStrategy || state.columns;
860
858
  return {
861
859
  groupRenderStrategy,
862
860
  groupBy,
@@ -2048,9 +2046,9 @@ function useColumnGroups() {
2048
2046
  }
2049
2047
 
2050
2048
  // src/components/InfiniteTable/hooks/useColumnsWhen.ts
2051
- import { useEffect as useEffect9, useMemo as useMemo4 } from "react";
2049
+ import { useEffect as useEffect9, useMemo as useMemo5 } from "react";
2052
2050
 
2053
- // src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
2051
+ // src/components/InfiniteTable/utils/getColumnForGroupBy.tsx
2054
2052
  import {
2055
2053
  createElement as createElement4
2056
2054
  } from "react";
@@ -2126,93 +2124,15 @@ var userSelect = { none: "_16lm1iwm" };
2126
2124
  var willChange = { transform: "_16lm1iw19" };
2127
2125
  var zIndex = { "1": "_16lm1iwe", "10": "_16lm1iwf", "1000": "_16lm1iwg", "10000": "_16lm1iwh", "100000": "_16lm1iwi" };
2128
2126
 
2129
- // src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
2130
- function getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, params) {
2131
- if (!pivotColumns) {
2132
- return void 0;
2133
- }
2134
- const {
2135
- pivotColumn,
2136
- pivotRowLabelsColumn,
2137
- pivotBy,
2138
- groupBy,
2139
- pivotTotalColumnPosition,
2140
- toggleGroupRow
2141
- } = params;
2142
- const computedPivotColumns = new Map();
2143
- pivotColumns.forEach((col, key) => {
2144
- if (col.pivotTotalColumn && pivotTotalColumnPosition === false) {
2145
- return;
2146
- }
2147
- let column = __spreadValues({}, col);
2148
- const isPivotRowLabelsColumn = !column.pivotColumn && !column.pivotTotalColumn;
2149
- if (!isPivotRowLabelsColumn) {
2150
- if (pivotColumn) {
2151
- if (typeof pivotColumn === "function") {
2152
- column = __spreadValues(__spreadValues({}, column), pivotColumn({
2153
- column,
2154
- pivotBy,
2155
- groupBy
2156
- }));
2157
- } else {
2158
- column = __spreadValues(__spreadValues({}, column), pivotColumn);
2159
- }
2160
- }
2161
- } else {
2162
- if (pivotRowLabelsColumn) {
2163
- if (typeof pivotRowLabelsColumn === "function") {
2164
- column = __spreadValues(__spreadValues({}, column), pivotRowLabelsColumn({
2165
- column,
2166
- pivotBy,
2167
- groupBy
2168
- }));
2169
- } else {
2170
- column = __spreadValues(__spreadValues({}, column), pivotRowLabelsColumn);
2171
- }
2172
- }
2173
- if (!column.render) {
2174
- column.render = (renderOptions) => {
2175
- var _a;
2176
- let { value, rowInfo, column: column2, groupBy: groupBy2 } = renderOptions;
2177
- if (column2.renderValue) {
2178
- value = column2.renderValue(renderOptions);
2179
- }
2180
- const showExpanderIcon = (((_a = rowInfo.groupKeys) == null ? void 0 : _a.length) || 0) < groupBy2.length;
2181
- return /* @__PURE__ */ createElement4("div", {
2182
- className: join(display.flex, alignItems.center, GroupRowExpanderCls)
2183
- }, showExpanderIcon ? /* @__PURE__ */ createElement4(ExpanderIcon, {
2184
- expanded: !rowInfo.collapsed,
2185
- onChange: () => {
2186
- toggleGroupRow(rowInfo.groupKeys);
2187
- }
2188
- }) : null, /* @__PURE__ */ createElement4("div", {
2189
- className: cssEllipsisClassName
2190
- }, value != null ? value : null));
2191
- };
2192
- }
2193
- }
2194
- if (!column.render && column.renderValue) {
2195
- column.render = (renderOptions) => {
2196
- return column.renderValue(renderOptions);
2197
- };
2198
- }
2199
- computedPivotColumns.set(key, column);
2200
- });
2201
- return computedPivotColumns;
2202
- }
2203
-
2204
2127
  // src/components/InfiniteTable/utils/getColumnForGroupBy.tsx
2205
- import {
2206
- createElement as createElement5
2207
- } from "react";
2208
2128
  function getGroupColumnRender({
2209
2129
  groupIndexForColumn,
2210
2130
  groupRenderStrategy,
2211
2131
  toggleGroupRow
2212
2132
  }) {
2213
2133
  return (renderOptions) => {
2214
- var _a;
2215
- let { value, rowInfo, column } = renderOptions;
2134
+ var _a, _b, _c;
2135
+ let { value, rowInfo, column, groupBy, pivotBy } = renderOptions;
2216
2136
  if (column.renderValue) {
2217
2137
  value = column.renderValue(renderOptions);
2218
2138
  }
@@ -2237,14 +2157,20 @@ function getGroupColumnRender({
2237
2157
  return null;
2238
2158
  }
2239
2159
  }
2240
- return /* @__PURE__ */ createElement5("div", {
2160
+ let icon = null;
2161
+ 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);
2162
+ if (showExpanderIcon) {
2163
+ const defaultIcon = /* @__PURE__ */ createElement4(ExpanderIcon, {
2164
+ expanded: !collapsed,
2165
+ onChange: () => {
2166
+ toggleGroupRow(groupKeys);
2167
+ }
2168
+ });
2169
+ icon = column.renderGroupIcon ? column.renderGroupIcon(Object.assign({ collapsed, groupIcon: defaultIcon }, renderOptions)) : defaultIcon;
2170
+ }
2171
+ return /* @__PURE__ */ createElement4("div", {
2241
2172
  className: join(display.flex, alignItems.center)
2242
- }, /* @__PURE__ */ createElement5(ExpanderIcon, {
2243
- expanded: !collapsed,
2244
- onChange: () => {
2245
- toggleGroupRow(groupKeys);
2246
- }
2247
- }), /* @__PURE__ */ createElement5("div", {
2173
+ }, icon, /* @__PURE__ */ createElement4("div", {
2248
2174
  className: cssEllipsisClassName
2249
2175
  }, value != null ? value : null));
2250
2176
  };
@@ -2280,21 +2206,29 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
2280
2206
  groupByField: options.groupBy.map((g) => g.field),
2281
2207
  sortable: false,
2282
2208
  render: (renderOptions) => {
2283
- let { value, rowInfo, column } = renderOptions;
2209
+ var _a, _b;
2210
+ let { value, rowInfo, column, groupBy, pivotBy } = renderOptions;
2284
2211
  if (!rowInfo.isGroupRow) {
2285
2212
  return null;
2286
2213
  }
2287
2214
  if (column.renderValue) {
2288
2215
  value = column.renderValue(renderOptions);
2289
2216
  }
2290
- return /* @__PURE__ */ createElement5("div", {
2217
+ const collapsed = rowInfo.collapsed;
2218
+ let icon = null;
2219
+ 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);
2220
+ if (showExpanderIcon) {
2221
+ const defaultIcon = /* @__PURE__ */ createElement4(ExpanderIcon, {
2222
+ expanded: !collapsed,
2223
+ onChange: () => {
2224
+ toggleGroupRow(rowInfo.groupKeys);
2225
+ }
2226
+ });
2227
+ icon = column.renderGroupIcon ? column.renderGroupIcon(Object.assign({ collapsed, groupIcon: defaultIcon }, renderOptions)) : defaultIcon;
2228
+ }
2229
+ return /* @__PURE__ */ createElement4("div", {
2291
2230
  className: join(display.flex, alignItems.center, GroupRowExpanderCls)
2292
- }, /* @__PURE__ */ createElement5(ExpanderIcon, {
2293
- expanded: !rowInfo.collapsed,
2294
- onChange: () => {
2295
- toggleGroupRow(rowInfo.groupKeys);
2296
- }
2297
- }), /* @__PURE__ */ createElement5("div", {
2231
+ }, icon, /* @__PURE__ */ createElement4("div", {
2298
2232
  className: cssEllipsisClassName
2299
2233
  }, value != null ? value : null));
2300
2234
  }
@@ -2315,7 +2249,7 @@ import { useCallback as useCallback4 } from "react";
2315
2249
  // src/components/DataSource/index.tsx
2316
2250
  import {
2317
2251
  Fragment,
2318
- createElement as createElement6
2252
+ createElement as createElement5
2319
2253
  } from "react";
2320
2254
 
2321
2255
  // src/utils/multisort/sortTypes.ts
@@ -2393,7 +2327,7 @@ var getMultisortFunction = (sortInfo, get) => {
2393
2327
  };
2394
2328
 
2395
2329
  // src/components/DataSource/privateHooks/useLoadData.ts
2396
- import { useEffect as useEffect8, useRef as useRef6, useState as useState4 } from "react";
2330
+ import { useEffect as useEffect8, useMemo as useMemo4, useRef as useRef6, useState as useState4 } from "react";
2397
2331
 
2398
2332
  // src/utils/DeepMap/once.ts
2399
2333
  function once(fn) {
@@ -2664,6 +2598,7 @@ var DeepMap = class {
2664
2598
 
2665
2599
  // src/utils/groupAndPivot/index.ts
2666
2600
  var LAZY_ROOT_KEY_FOR_GROUPS = "____root____";
2601
+ var NOT_LOADED_YET_KEY_PREFIX = "____not_loaded_yet____";
2667
2602
  function DEFAULT_TO_KEY(value) {
2668
2603
  return value;
2669
2604
  }
@@ -2727,13 +2662,23 @@ function lazyGroup(groupParams, rootData) {
2727
2662
  rootData.visitDepthFirst((lazyGroupRowInfo, keys, _index, next) => {
2728
2663
  const [_rootKey, ...currentGroupKeys] = keys;
2729
2664
  const dataArray = lazyGroupRowInfo.items;
2665
+ if (currentGroupKeys.length == groupBy.length) {
2666
+ const deepMapGroupValue = deepMap.get(currentGroupKeys);
2667
+ if (deepMapGroupValue) {
2668
+ deepMapGroupValue.items = dataArray;
2669
+ }
2670
+ return next == null ? void 0 : next();
2671
+ }
2730
2672
  for (let i = 0, len = dataArray.length; i < len; i++) {
2731
2673
  if (!dataArray[i]) {
2732
2674
  const deepMapGroupValue2 = {
2733
2675
  items: [],
2734
2676
  reducerResults: {}
2735
2677
  };
2736
- deepMap.set([...currentGroupKeys, `not-loaded-yet-${i}`], deepMapGroupValue2);
2678
+ deepMap.set([
2679
+ ...currentGroupKeys,
2680
+ `${NOT_LOADED_YET_KEY_PREFIX}${i}`
2681
+ ], deepMapGroupValue2);
2737
2682
  continue;
2738
2683
  }
2739
2684
  const dataObject = dataArray[i].data;
@@ -2744,6 +2689,7 @@ function lazyGroup(groupParams, rootData) {
2744
2689
  currentGroupKeys.push(key);
2745
2690
  const deepMapGroupValue = {
2746
2691
  items: [],
2692
+ commonData: dataObject,
2747
2693
  reducerResults: dataArray[i].aggregations || {}
2748
2694
  };
2749
2695
  deepMap.set(currentGroupKeys, deepMapGroupValue);
@@ -2879,10 +2825,15 @@ function flatten(groupResult) {
2879
2825
  function getEnhancedGroupData(options, deepMapValue) {
2880
2826
  const { groupBy, groupKeys, collapsed, parents, reducers } = options;
2881
2827
  const groupNesting = groupKeys.length;
2882
- const { items: groupItems, reducerResults, pivotDeepMap } = deepMapValue;
2828
+ const {
2829
+ items: groupItems,
2830
+ reducerResults,
2831
+ pivotDeepMap,
2832
+ commonData
2833
+ } = deepMapValue;
2883
2834
  let data = null;
2884
2835
  if (Object.keys(reducerResults).length > 0) {
2885
- data = {};
2836
+ data = commonData || {};
2886
2837
  for (let key in reducers)
2887
2838
  if (reducers.hasOwnProperty(key)) {
2888
2839
  const reducer = reducers[key];
@@ -2892,12 +2843,16 @@ function getEnhancedGroupData(options, deepMapValue) {
2892
2843
  }
2893
2844
  }
2894
2845
  }
2846
+ let theValue = groupKeys[groupKeys.length - 1];
2847
+ if (typeof theValue === "string" && theValue.startsWith(NOT_LOADED_YET_KEY_PREFIX)) {
2848
+ theValue = null;
2849
+ }
2895
2850
  const enhancedGroupData = {
2896
2851
  data,
2897
2852
  groupCount: groupItems.length,
2898
2853
  groupData: groupItems,
2899
2854
  groupKeys,
2900
- id: groupKeys,
2855
+ id: `${groupKeys}`,
2901
2856
  collapsed,
2902
2857
  parents,
2903
2858
  collapsedChildrenCount: 0,
@@ -2905,7 +2860,7 @@ function getEnhancedGroupData(options, deepMapValue) {
2905
2860
  indexInParentGroups: options.indexInParentGroups,
2906
2861
  indexInGroup: options.indexInGroup,
2907
2862
  indexInAll: options.indexInAll,
2908
- value: groupKeys[groupKeys.length - 1],
2863
+ value: theValue,
2909
2864
  rootGroupBy: groupBy,
2910
2865
  groupBy: groupNesting === groupBy.length ? groupBy : groupBy.slice(0, groupNesting),
2911
2866
  isGroupRow: true,
@@ -2974,7 +2929,7 @@ function enhancedFlatten(param) {
2974
2929
  const startIndex = result.length;
2975
2930
  result.push(...items.map((item, index) => {
2976
2931
  return {
2977
- id: toPrimaryKey(item),
2932
+ id: item ? toPrimaryKey(item) : `${groupKeys}-${index}`,
2978
2933
  data: item,
2979
2934
  isGroupRow: false,
2980
2935
  collapsed: false,
@@ -3029,11 +2984,33 @@ function useEffectWithChanges(fn, deps) {
3029
2984
  }, useEffectDeps);
3030
2985
  }
3031
2986
 
2987
+ // src/components/utils/debounce.ts
2988
+ function debounce(fn, { wait }) {
2989
+ let timeout = null;
2990
+ return function(...args) {
2991
+ const context = this;
2992
+ if (timeout !== null) {
2993
+ clearTimeout(timeout);
2994
+ }
2995
+ timeout = setTimeout(() => {
2996
+ fn.apply(context, args);
2997
+ }, wait);
2998
+ };
2999
+ }
3000
+
3032
3001
  // src/components/DataSource/privateHooks/useLoadData.ts
3002
+ var getRafPromise = () => new Promise((resolve) => {
3003
+ requestAnimationFrame(resolve);
3004
+ });
3033
3005
  var SKIP_DATA_CHANGES_KEYS = {
3034
3006
  originalDataArray: true,
3035
3007
  changes: true
3036
3008
  };
3009
+ function getChangeDetect() {
3010
+ var _a;
3011
+ const perfNow = (_a = getGlobal().performance) == null ? void 0 : _a.now();
3012
+ return `${Date.now()}:${perfNow}`;
3013
+ }
3037
3014
  function buildDataSourceDataParams(componentState, overrides) {
3038
3015
  var _a, _b;
3039
3016
  const sortInfo = componentState.multiSort ? componentState.sortInfo : (_b = (_a = componentState.sortInfo) == null ? void 0 : _a[0]) != null ? _b : null;
@@ -3048,7 +3025,7 @@ function buildDataSourceDataParams(componentState, overrides) {
3048
3025
  dataSourceParams.livePaginationCursor = componentState.livePaginationCursor;
3049
3026
  dataSourceParams.cursorId = componentState.cursorId;
3050
3027
  }
3051
- if (componentState.fullLazyLoad) {
3028
+ if (componentState.lazyLoad) {
3052
3029
  if (componentState.lazyLoadBatchSize != null && componentState.lazyLoadBatchSize > 0) {
3053
3030
  dataSourceParams.lazyLoadBatchSize = componentState.lazyLoadBatchSize;
3054
3031
  dataSourceParams.lazyLoadStartIndex = 0;
@@ -3073,15 +3050,34 @@ function buildDataSourceDataParams(componentState, overrides) {
3073
3050
  }
3074
3051
  function loadData(data, componentState, actions, overrides) {
3075
3052
  const dataParams = buildDataSourceDataParams(componentState, overrides);
3053
+ if (componentState.lazyLoad) {
3054
+ const lazyGroupData = componentState.originalLazyGroupData;
3055
+ const key = [LAZY_ROOT_KEY_FOR_GROUPS, ...dataParams.groupKeys || []];
3056
+ const existingGroupRowInfo = lazyGroupData.get(key);
3057
+ if (existingGroupRowInfo && existingGroupRowInfo.cache) {
3058
+ const items = existingGroupRowInfo.items;
3059
+ const len = items.length;
3060
+ let allLoaded = true;
3061
+ for (let i = 0; i < len; i++) {
3062
+ if (items[i] == null) {
3063
+ allLoaded = false;
3064
+ break;
3065
+ }
3066
+ }
3067
+ if (allLoaded) {
3068
+ return Promise.resolve(true);
3069
+ }
3070
+ }
3071
+ }
3076
3072
  if (typeof data === "function") {
3077
3073
  data = data(dataParams);
3078
3074
  }
3079
3075
  const dataIsPromise = typeof data === "object" && typeof data.then === "function";
3080
- if (dataIsPromise) {
3076
+ if (dataIsPromise && !componentState.lazyLoad) {
3081
3077
  actions.loading = true;
3082
3078
  }
3083
- Promise.resolve(data).then((dataParam) => {
3084
- var _a, _b, _c;
3079
+ return Promise.resolve(data).then((dataParam) => {
3080
+ var _a, _b, _c, _d;
3085
3081
  let dataArray = [];
3086
3082
  let skipAssign = false;
3087
3083
  if (Array.isArray(dataParam.data)) {
@@ -3093,10 +3089,11 @@ function loadData(data, componentState, actions, overrides) {
3093
3089
  if (remoteData.mappings) {
3094
3090
  actions.pivotMappings = remoteData.mappings;
3095
3091
  }
3096
- if (componentState.fullLazyLoad && dataParams.groupKeys) {
3097
- const lazyGroupData = DeepMap.clone(componentState.originalLazyGroupData);
3098
- const key = [LAZY_ROOT_KEY_FOR_GROUPS, ...dataParams.groupKeys];
3092
+ if (componentState.lazyLoad) {
3093
+ const lazyGroupData = componentState.originalLazyGroupData;
3094
+ const key = [LAZY_ROOT_KEY_FOR_GROUPS, ...dataParams.groupKeys || []];
3099
3095
  const newGroupRowInfo = {
3096
+ cache: !!remoteData.cache,
3100
3097
  totalCount: (_a = remoteData.totalCount) != null ? _a : dataArray.length,
3101
3098
  items: dataArray
3102
3099
  };
@@ -3104,11 +3101,15 @@ function loadData(data, componentState, actions, overrides) {
3104
3101
  const existingGroupRowInfo = lazyGroupData.get(key);
3105
3102
  const currentGroupRowInfo = existingGroupRowInfo != null ? existingGroupRowInfo : {
3106
3103
  items: [],
3107
- totalCount: newGroupRowInfo.totalCount
3104
+ totalCount: newGroupRowInfo.totalCount,
3105
+ cache: (_b = newGroupRowInfo.cache) != null ? _b : true
3108
3106
  };
3107
+ if (existingGroupRowInfo) {
3108
+ existingGroupRowInfo.cache = newGroupRowInfo.cache;
3109
+ }
3109
3110
  currentGroupRowInfo.items.length = currentGroupRowInfo.totalCount;
3110
- const start = (_b = dataParams.lazyLoadStartIndex) != null ? _b : 0;
3111
- const end = start + ((_c = dataParams.lazyLoadBatchSize) != null ? _c : dataArray.length);
3111
+ const start = (_c = dataParams.lazyLoadStartIndex) != null ? _c : 0;
3112
+ const end = Math.min((_d = remoteData.totalCount) != null ? _d : start + dataParams.lazyLoadBatchSize);
3112
3113
  for (let i = start; i < end; i++) {
3113
3114
  currentGroupRowInfo.items[i] = newGroupRowInfo.items[i - start];
3114
3115
  }
@@ -3119,7 +3120,11 @@ function loadData(data, componentState, actions, overrides) {
3119
3120
  lazyGroupData.set(key, newGroupRowInfo);
3120
3121
  }
3121
3122
  skipAssign = true;
3122
- actions.originalLazyGroupData = lazyGroupData;
3123
+ actions.originalLazyGroupDataChangeDetect = getChangeDetect();
3124
+ if (!dataParams.groupKeys || !dataParams.groupKeys.length) {
3125
+ const topLevelItems = lazyGroupData.get([LAZY_ROOT_KEY_FOR_GROUPS]);
3126
+ actions.originalDataArray = [...topLevelItems.items];
3127
+ }
3123
3128
  }
3124
3129
  } else {
3125
3130
  dataArray = dataParam;
@@ -3127,7 +3132,7 @@ function loadData(data, componentState, actions, overrides) {
3127
3132
  if (!skipAssign) {
3128
3133
  actions.originalDataArray = dataArray;
3129
3134
  }
3130
- if (dataIsPromise) {
3135
+ if (dataIsPromise && !componentState.lazyLoad) {
3131
3136
  actions.loading = false;
3132
3137
  }
3133
3138
  });
@@ -3146,9 +3151,7 @@ function useLoadData() {
3146
3151
  pivotBy,
3147
3152
  livePagination,
3148
3153
  livePaginationCursor,
3149
- cursorId: stateCursorId,
3150
- lazyLoadBatchSize,
3151
- notifyScrollStop
3154
+ cursorId: stateCursorId
3152
3155
  } = componentState;
3153
3156
  const [scrollbars, setScrollbars] = useState4({
3154
3157
  vertical: false,
@@ -3189,33 +3192,7 @@ function useLoadData() {
3189
3192
  cursorId: livePagination ? stateCursorId : null
3190
3193
  };
3191
3194
  const initialRef = useRef6(true);
3192
- useEffect8(() => {
3193
- if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
3194
- return notifyScrollStop.onChange((param) => {
3195
- console.log("scroll stop", param);
3196
- if (!param) {
3197
- return;
3198
- }
3199
- const componentState2 = getComponentState();
3200
- const {
3201
- firstVisibleRowIndex: startIndex,
3202
- lastVisibleRowIndex: endIndex
3203
- } = param;
3204
- const firstBatchStart = Math.floor(startIndex / lazyLoadBatchSize) * lazyLoadBatchSize;
3205
- const lastBatchStart = Math.floor(endIndex / lazyLoadBatchSize) * lazyLoadBatchSize;
3206
- const isRowLoaded = (index) => componentState2.dataArray[index].data != null;
3207
- for (let batchStartIndex = firstBatchStart; batchStartIndex <= lastBatchStart; batchStartIndex = batchStartIndex + lazyLoadBatchSize) {
3208
- if (!isRowLoaded(batchStartIndex)) {
3209
- loadData(componentState2.data, componentState2, actions, {
3210
- lazyLoadBatchSize,
3211
- lazyLoadStartIndex: batchStartIndex
3212
- });
3213
- }
3214
- }
3215
- });
3216
- }
3217
- return;
3218
- }, [lazyLoadBatchSize]);
3195
+ useLazyLoadRange();
3219
3196
  useEffectWithChanges(() => {
3220
3197
  const componentState2 = getComponentState();
3221
3198
  if (typeof componentState2.data !== "function") {
@@ -3236,6 +3213,126 @@ function useLoadData() {
3236
3213
  }
3237
3214
  }, depsObject);
3238
3215
  }
3216
+ function useLazyLoadRange() {
3217
+ const {
3218
+ getComponentState,
3219
+ componentActions: actions,
3220
+ componentState
3221
+ } = useComponentState();
3222
+ const loadingCache = useMemo4(() => {
3223
+ return new Map();
3224
+ }, [componentState.data]);
3225
+ globalThis.loadingCache = loadingCache;
3226
+ const {
3227
+ lazyLoadBatchSize,
3228
+ notifyRenderRangeChange,
3229
+ dataArray,
3230
+ scrollStopDelayUpdatedByTable
3231
+ } = componentState;
3232
+ const latestRenderRangeRef = useRef6(null);
3233
+ const loadRange = (param, cache = loadingCache) => {
3234
+ const componentState2 = getComponentState();
3235
+ param = param || latestRenderRangeRef.current;
3236
+ if (!param) {
3237
+ return;
3238
+ }
3239
+ const { renderStartIndex: startIndex, renderEndIndex: endIndex } = param;
3240
+ if (!lazyLoadBatchSize || lazyLoadBatchSize <= 0) {
3241
+ return;
3242
+ }
3243
+ lazyLoadRange({
3244
+ startIndex,
3245
+ endIndex,
3246
+ lazyLoadBatchSize,
3247
+ componentState: componentState2,
3248
+ componentActions: actions
3249
+ }, cache);
3250
+ };
3251
+ const debouncedLoadRange = useMemo4(() => debounce(loadRange, { wait: scrollStopDelayUpdatedByTable }), [scrollStopDelayUpdatedByTable]);
3252
+ useEffect8(() => {
3253
+ if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
3254
+ return notifyRenderRangeChange.onChange((param) => {
3255
+ latestRenderRangeRef.current = param;
3256
+ loadRange(param, loadingCache);
3257
+ });
3258
+ }
3259
+ return;
3260
+ }, [lazyLoadBatchSize, loadingCache]);
3261
+ useEffect8(() => {
3262
+ if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
3263
+ debouncedLoadRange();
3264
+ }
3265
+ return;
3266
+ }, [dataArray]);
3267
+ }
3268
+ function lazyLoadRange(options, cache) {
3269
+ const {
3270
+ startIndex,
3271
+ endIndex,
3272
+ lazyLoadBatchSize,
3273
+ componentState,
3274
+ componentActions
3275
+ } = options;
3276
+ const { dataArray } = componentState;
3277
+ const isRowLoaded = (index) => dataArray[index].data != null;
3278
+ const perGroupFnCalls = new DeepMap();
3279
+ const rootGroupKeys = ["_______xxx______"];
3280
+ for (let i = startIndex; i <= endIndex; i++) {
3281
+ const rowInfo = dataArray[i];
3282
+ if (!rowInfo) {
3283
+ continue;
3284
+ }
3285
+ const rowLoaded = rowInfo.data != null;
3286
+ const theGroupKeys = rowInfo.groupKeys ? [...rowInfo.groupKeys] : [];
3287
+ if (rowInfo.groupKeys && rowInfo.isGroupRow) {
3288
+ theGroupKeys.pop();
3289
+ }
3290
+ const cacheKeys = theGroupKeys.length ? theGroupKeys : rootGroupKeys;
3291
+ const indexInGroup = rowInfo.indexInGroup;
3292
+ if (!rowLoaded) {
3293
+ let cachedFnCalls = perGroupFnCalls.get(cacheKeys);
3294
+ const batchStartIndexInGroup = Math.floor(indexInGroup / lazyLoadBatchSize) * lazyLoadBatchSize;
3295
+ const offset = rowInfo.indexInGroup - batchStartIndexInGroup;
3296
+ const absoluteIndexOfBatchStart = dataArray[rowInfo.indexInAll - offset].indexInAll;
3297
+ const batchStartRowLoaded = isRowLoaded(absoluteIndexOfBatchStart);
3298
+ const batchStartRowId = dataArray[absoluteIndexOfBatchStart].id;
3299
+ if (batchStartRowLoaded || (cachedFnCalls == null ? void 0 : cachedFnCalls[batchStartRowId])) {
3300
+ continue;
3301
+ }
3302
+ const shouldSetFnCalls = !cachedFnCalls;
3303
+ cachedFnCalls = cachedFnCalls || {};
3304
+ const currentFnCall = {
3305
+ lazyLoadStartIndex: batchStartIndexInGroup,
3306
+ lazyLoadBatchSize,
3307
+ groupKeys: theGroupKeys
3308
+ };
3309
+ if (!cachedFnCalls[batchStartRowId]) {
3310
+ cachedFnCalls[batchStartRowId] = currentFnCall;
3311
+ }
3312
+ if (shouldSetFnCalls) {
3313
+ perGroupFnCalls.set(cacheKeys, cachedFnCalls);
3314
+ }
3315
+ }
3316
+ }
3317
+ let initialPromise = Promise.resolve(true);
3318
+ const allFnCalls = [];
3319
+ perGroupFnCalls.topDownValues().forEach((record) => {
3320
+ allFnCalls.push(...Object.values(record));
3321
+ });
3322
+ allFnCalls.reduce((promise, fnCall) => {
3323
+ const cacheKey = `${fnCall.groupKeys.join("-")}:${fnCall.lazyLoadStartIndex}`;
3324
+ if (cache && cache.has(cacheKey)) {
3325
+ return promise;
3326
+ }
3327
+ cache == null ? void 0 : cache.set(cacheKey, true);
3328
+ const args = [componentState.data, componentState, componentActions, fnCall];
3329
+ return promise.then(() => getRafPromise()).then(() => loadData(...args)).then(() => {
3330
+ requestAnimationFrame(() => {
3331
+ cache == null ? void 0 : cache.delete(cacheKey);
3332
+ });
3333
+ });
3334
+ }, initialPromise);
3335
+ }
3239
3336
 
3240
3337
  // src/components/DataSource/state/normalizeSortInfo.ts
3241
3338
  var EMPTY_ARRAY = Object.freeze([]);
@@ -3435,8 +3532,11 @@ function initSetupState2() {
3435
3532
  dataParams: void 0,
3436
3533
  notifyScrollbarsChange: buildSubscriptionCallback(),
3437
3534
  notifyScrollStop: buildSubscriptionCallback(),
3535
+ notifyRenderRangeChange: buildSubscriptionCallback(),
3438
3536
  pivotTotalColumnPosition: "end",
3537
+ scrollStopDelayUpdatedByTable: 100,
3439
3538
  originalLazyGroupData,
3539
+ originalLazyGroupDataChangeDetect: 0,
3440
3540
  originalDataArray,
3441
3541
  cursorId: defaultCursorId,
3442
3542
  showSeparatePivotColumnForSingleAggregation: false,
@@ -3467,12 +3567,11 @@ function getCompareObjectForDataParams(dataParams) {
3467
3567
  var forwardProps3 = (setupState) => {
3468
3568
  return {
3469
3569
  onDataParamsChange: (fn) => fn ? discardCallsWithEqualArg(fn, 100, getCompareObjectForDataParams) : void 0,
3470
- fullLazyLoad: 1,
3570
+ lazyLoad: (lazyLoad) => !!lazyLoad,
3471
3571
  data: 1,
3472
3572
  pivotBy: 1,
3473
3573
  primaryKey: 1,
3474
3574
  livePagination: 1,
3475
- lazyLoadBatchSize: (lazyLoadBatchSize) => lazyLoadBatchSize != null ? lazyLoadBatchSize : -1,
3476
3575
  aggregationReducers: 1,
3477
3576
  collapseGroupRowsOnDataFunctionChange: (collapseGroupRowsOnDataFunctionChange) => collapseGroupRowsOnDataFunctionChange != null ? collapseGroupRowsOnDataFunctionChange : true,
3478
3577
  loading: (loading) => loading != null ? loading : false,
@@ -3499,7 +3598,8 @@ function mapPropsToState2(params) {
3499
3598
  const controlledSort = isControlledValue(props.sortInfo);
3500
3599
  const result = {
3501
3600
  controlledSort,
3502
- multiSort: Array.isArray(controlledSort ? props.sortInfo : props.defaultSortInfo)
3601
+ multiSort: Array.isArray(controlledSort ? props.sortInfo : props.defaultSortInfo),
3602
+ lazyLoadBatchSize: typeof props.lazyLoad === "object" ? props.lazyLoad.batchSize : void 0
3503
3603
  };
3504
3604
  if (props.livePagination) {
3505
3605
  const dataArrayChanged = !oldState || oldState.originalDataArray !== state.originalDataArray;
@@ -3512,7 +3612,7 @@ var debugFullLazyLoad = dbg("DataSource:fullLazyLoad");
3512
3612
  function onPropChange(params, props, actions) {
3513
3613
  const { name, newValue } = params;
3514
3614
  if (name === "data" && typeof newValue === "function" && !props.groupRowsState) {
3515
- if (props.fullLazyLoad) {
3615
+ if (props.lazyLoad) {
3516
3616
  debugFullLazyLoad(`"data" function prop has changed`);
3517
3617
  }
3518
3618
  if (props.collapseGroupRowsOnDataFunctionChange !== false) {
@@ -3621,23 +3721,7 @@ function getPivotColumnsAndColumnGroups({
3621
3721
  const aggregationReducers = Object.keys(reducers).map((key) => {
3622
3722
  return __spreadProps(__spreadValues({}, reducers[key]), { id: key });
3623
3723
  });
3624
- const columns = new Map([
3625
- [
3626
- "labels",
3627
- {
3628
- header: "Row labels",
3629
- pivotBy,
3630
- valueGetter: (params) => {
3631
- var _a;
3632
- const { rowInfo } = params;
3633
- if (!rowInfo.data) {
3634
- return "Loading ... TODO replace this with a loading indicator";
3635
- }
3636
- return rowInfo.groupKeys ? rowInfo.groupKeys[((_a = rowInfo.groupKeys) == null ? void 0 : _a.length) - 1] : null;
3637
- }
3638
- }
3639
- ]
3640
- ]);
3724
+ const columns = new Map([]);
3641
3725
  const columnGroups = new Map();
3642
3726
  const isSingleAggregationColumn = !showSeparatePivotColumnForSingleAggregation && aggregationReducers.length === 1;
3643
3727
  deepMap.visitDepthFirst((_value, keys, _indexInGroup, next) => {
@@ -3795,20 +3879,33 @@ function concludeReducer(params) {
3795
3879
  var _a;
3796
3880
  const { state, previousState } = params;
3797
3881
  const sortInfo = state.sortInfo;
3798
- const shouldSort = !!(sortInfo == null ? void 0 : sortInfo.length) && !state.controlledSort;
3799
- const originalDataArrayChanged = haveDepsChanged(previousState, state, [
3882
+ let shouldSort = !!(sortInfo == null ? void 0 : sortInfo.length) && !state.controlledSort;
3883
+ if (state.lazyLoad || state.livePagination) {
3884
+ shouldSort = false;
3885
+ }
3886
+ let originalDataArrayChanged = haveDepsChanged(previousState, state, [
3800
3887
  "originalDataArray"
3801
3888
  ]);
3889
+ const dataSourceChange = previousState && state.data !== previousState.data;
3890
+ let lazyLoadGroupDataChange = state.lazyLoad && previousState && (previousState.groupBy !== state.groupBy || previousState.sortInfo !== state.sortInfo);
3891
+ if (dataSourceChange) {
3892
+ lazyLoadGroupDataChange = true;
3893
+ }
3894
+ if (lazyLoadGroupDataChange) {
3895
+ state.originalLazyGroupData = new DeepMap();
3896
+ originalDataArrayChanged = true;
3897
+ }
3802
3898
  const sortInfoChanged = haveDepsChanged(previousState, state, ["sortInfo"]);
3803
3899
  const sortDepsChanged = originalDataArrayChanged || sortInfoChanged;
3804
3900
  const shouldSortAgain = shouldSort && (sortDepsChanged || !state.lastSortDataArray);
3805
3901
  const groupBy = state.groupBy;
3806
3902
  const pivotBy = state.pivotBy;
3807
3903
  const shouldGroup = groupBy.length || pivotBy;
3808
- const groupsDepsChanged = haveDepsChanged(previousState, state, [
3904
+ const groupsDepsChanged = originalDataArrayChanged || haveDepsChanged(previousState, state, [
3809
3905
  "generateGroupRows",
3810
3906
  "originalDataArray",
3811
3907
  "originalLazyGroupData",
3908
+ "originalLazyGroupDataChangeDetect",
3812
3909
  "groupBy",
3813
3910
  "groupRowsState",
3814
3911
  "pivotBy",
@@ -3829,11 +3926,15 @@ function concludeReducer(params) {
3829
3926
  state.postSortDataArray = dataArray;
3830
3927
  state.groupDeepMap = void 0;
3831
3928
  const toPrimaryKey = (data) => {
3832
- return data[state.primaryKey];
3929
+ const pk = data[state.primaryKey];
3930
+ if (Array.isArray(pk)) {
3931
+ debugger;
3932
+ }
3933
+ return pk;
3833
3934
  };
3834
3935
  if (shouldGroup) {
3835
3936
  if (shouldGroupAgain) {
3836
- const groupResult = state.fullLazyLoad ? lazyGroup({
3937
+ const groupResult = state.lazyLoad ? lazyGroup({
3837
3938
  groupBy,
3838
3939
  pivot: pivotBy,
3839
3940
  mappings: state.pivotMappings,
@@ -3871,7 +3972,7 @@ function concludeReducer(params) {
3871
3972
  state.pivotColumns = void 0;
3872
3973
  const arrayDifferentAfterSortStep = previousState.postSortDataArray != state.postSortDataArray;
3873
3974
  if (arrayDifferentAfterSortStep) {
3874
- rowInfoDataArray = dataArray.map((data, index) => toRowInfo(data, toPrimaryKey(data), index));
3975
+ rowInfoDataArray = dataArray.map((data, index) => toRowInfo(data, data ? toPrimaryKey(data) : index, index));
3875
3976
  }
3876
3977
  }
3877
3978
  state.postGroupDataArray = rowInfoDataArray;
@@ -3899,7 +4000,7 @@ function DataSourceWithContext(props) {
3899
4000
  if (typeof children === "function") {
3900
4001
  children = children(computedValues);
3901
4002
  }
3902
- return /* @__PURE__ */ createElement6(Fragment, null, children);
4003
+ return /* @__PURE__ */ createElement5(Fragment, null, children);
3903
4004
  }
3904
4005
  var DataSourceRoot = getComponentStateRoot({
3905
4006
  initSetupState: initSetupState2,
@@ -3922,14 +4023,14 @@ function DataSourceCmp({ children }) {
3922
4023
  globalThis.getDataSourceState = getState;
3923
4024
  }
3924
4025
  useLoadData();
3925
- return /* @__PURE__ */ createElement6(DataSourceContext.Provider, {
4026
+ return /* @__PURE__ */ createElement5(DataSourceContext.Provider, {
3926
4027
  value: contextValue
3927
- }, /* @__PURE__ */ createElement6(DataSourceWithContext, {
4028
+ }, /* @__PURE__ */ createElement5(DataSourceWithContext, {
3928
4029
  children
3929
4030
  }));
3930
4031
  }
3931
4032
  function DataSource(props) {
3932
- return /* @__PURE__ */ createElement6(DataSourceRoot, __spreadValues({}, props), /* @__PURE__ */ createElement6(DataSourceCmp, {
4033
+ return /* @__PURE__ */ createElement5(DataSourceRoot, __spreadValues({}, props), /* @__PURE__ */ createElement5(DataSourceCmp, {
3933
4034
  children: props.children
3934
4035
  }));
3935
4036
  }
@@ -3942,7 +4043,7 @@ function useToggleGroupRow() {
3942
4043
  const newState = new GroupRowsState(state.groupRowsState);
3943
4044
  newState.toggleGroupRow(groupKeys);
3944
4045
  dataSourceActions.groupRowsState = newState;
3945
- if (state.fullLazyLoad && newState.isGroupRowExpanded(groupKeys)) {
4046
+ if (state.lazyLoad && newState.isGroupRowExpanded(groupKeys)) {
3946
4047
  loadData(state.data, state, dataSourceActions, {
3947
4048
  groupKeys
3948
4049
  });
@@ -3953,7 +4054,7 @@ function useToggleGroupRow() {
3953
4054
 
3954
4055
  // src/components/InfiniteTable/hooks/useColumnsWhen.ts
3955
4056
  function useGroupByMap(groupBy) {
3956
- const groupByMap = useMemo4(() => {
4057
+ const groupByMap = useMemo5(() => {
3957
4058
  return groupBy.reduce((acc, groupBy2, index) => {
3958
4059
  acc.set(groupBy2.field, {
3959
4060
  groupBy: groupBy2,
@@ -3980,9 +4081,9 @@ function useColumnsWhen() {
3980
4081
  dataSourceActions.pivotTotalColumnPosition = pivotTotalColumnPosition;
3981
4082
  }, [pivotTotalColumnPosition]);
3982
4083
  useColumnsWhenInlineGroupRenderStrategy(groupByMap);
3983
- useColumnsWhenPivoting();
3984
- useColumnsWhenGrouping();
3985
- useHideEmptyGroupColumns(groupByMap);
4084
+ const { toggleGroupRow } = useColumnsWhenGrouping();
4085
+ useHideEmptyGroupColumns();
4086
+ return { toggleGroupRow };
3986
4087
  }
3987
4088
  function useColumnsWhenInlineGroupRenderStrategy(groupByMap) {
3988
4089
  const toggleGroupRow = useToggleGroupRow();
@@ -3992,6 +4093,9 @@ function useColumnsWhenInlineGroupRenderStrategy(groupByMap) {
3992
4093
  } = useComponentState();
3993
4094
  function computeColumnsWhenInlineGroupRenderStrategy(columns2, groupByMap2, groupRenderStrategy2, toggleGroupRow2) {
3994
4095
  const computedColumns = new Map();
4096
+ if (groupRenderStrategy2 !== "inline") {
4097
+ return;
4098
+ }
3995
4099
  columns2.forEach((column, id) => {
3996
4100
  let base = {};
3997
4101
  const groupByForColumn = groupByMap2.get(column.field);
@@ -4051,51 +4155,32 @@ function useColumnsWhenInlineGroupRenderStrategy(groupByMap) {
4051
4155
  });
4052
4156
  }, [columns, groupByMap, groupRenderStrategy, toggleGroupRow]);
4053
4157
  }
4054
- function useColumnsWhenPivoting() {
4158
+ function useColumnsWhenGrouping() {
4055
4159
  const {
4056
4160
  componentState: { groupBy, pivotBy }
4057
4161
  } = useDataSourceContextValue();
4058
4162
  const {
4059
4163
  componentActions,
4060
4164
  componentState: {
4165
+ columns,
4166
+ groupColumn,
4167
+ groupRenderStrategy,
4061
4168
  pivotColumns,
4062
4169
  pivotColumn,
4063
- pivotRowLabelsColumn,
4064
4170
  pivotTotalColumnPosition
4065
4171
  }
4066
4172
  } = useComponentState();
4067
4173
  const toggleGroupRow = useToggleGroupRow();
4068
4174
  useEffect9(() => {
4069
- const computedPivotColumns = getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, {
4070
- pivotColumn,
4071
- pivotRowLabelsColumn,
4072
- pivotTotalColumnPosition,
4073
- pivotBy,
4074
- groupBy,
4075
- toggleGroupRow
4076
- });
4077
- componentActions.computedPivotColumns = computedPivotColumns;
4078
- }, [pivotColumns, pivotColumn, pivotRowLabelsColumn]);
4079
- }
4080
- function useColumnsWhenGrouping() {
4081
- const {
4082
- componentState: { groupBy }
4083
- } = useDataSourceContextValue();
4084
- const {
4085
- componentActions,
4086
- componentState: { columns, groupColumn, groupRenderStrategy, pivotColumns }
4087
- } = useComponentState();
4088
- const toggleGroupRow = useToggleGroupRow();
4089
- useEffect9(() => {
4090
- if (pivotColumns) {
4091
- return;
4092
- }
4093
4175
  const update = () => {
4094
4176
  const columnsWhenGrouping = getColumnsWhenGrouping({
4095
4177
  columns,
4096
4178
  groupColumn,
4097
- groupRenderStrategy,
4179
+ pivotColumn,
4180
+ pivotTotalColumnPosition,
4181
+ groupRenderStrategy: groupRenderStrategy === "inline" ? "single-column" : groupRenderStrategy,
4098
4182
  groupBy,
4183
+ pivotBy,
4099
4184
  pivotColumns,
4100
4185
  toggleGroupRow
4101
4186
  });
@@ -4107,11 +4192,25 @@ function useColumnsWhenGrouping() {
4107
4192
  delete: update,
4108
4193
  clear: update
4109
4194
  });
4110
- }, [columns, groupBy, groupColumn, groupRenderStrategy, pivotColumns]);
4195
+ }, [
4196
+ columns,
4197
+ groupBy,
4198
+ pivotBy,
4199
+ groupColumn,
4200
+ groupRenderStrategy,
4201
+ pivotColumns,
4202
+ pivotTotalColumnPosition,
4203
+ pivotColumn
4204
+ ]);
4205
+ return { toggleGroupRow };
4111
4206
  }
4112
- function useHideEmptyGroupColumns(groupRowsMap) {
4207
+ function useHideEmptyGroupColumns() {
4113
4208
  const {
4114
- componentState: { groupBy, groupRowsState },
4209
+ componentState: {
4210
+ groupBy,
4211
+ groupRowsState,
4212
+ originalLazyGroupDataChangeDetect
4213
+ },
4115
4214
  getState: getDataSourceState
4116
4215
  } = useDataSourceContextValue();
4117
4216
  const {
@@ -4164,8 +4263,8 @@ function useHideEmptyGroupColumns(groupRowsMap) {
4164
4263
  getDataSourceState,
4165
4264
  groupRenderStrategy,
4166
4265
  generatedColumns,
4266
+ originalLazyGroupDataChangeDetect,
4167
4267
  groupBy,
4168
- groupRowsMap,
4169
4268
  hideEmptyGroupColumns ? groupRowsState : null,
4170
4269
  hideEmptyGroupColumns
4171
4270
  ]);
@@ -4174,14 +4273,14 @@ function getColumnsWhenGrouping(params) {
4174
4273
  const {
4175
4274
  pivotColumns,
4176
4275
  groupBy,
4276
+ pivotBy,
4177
4277
  groupColumn,
4278
+ pivotTotalColumnPosition,
4279
+ pivotColumn,
4178
4280
  groupRenderStrategy,
4179
4281
  toggleGroupRow,
4180
4282
  columns
4181
4283
  } = params;
4182
- if (pivotColumns) {
4183
- return void 0;
4184
- }
4185
4284
  if (groupRenderStrategy === "inline") {
4186
4285
  return void 0;
4187
4286
  }
@@ -4191,6 +4290,7 @@ function getColumnsWhenGrouping(params) {
4191
4290
  const generatedGroupColumn = getColumnForGroupBy({
4192
4291
  groupByForColumn,
4193
4292
  groupBy,
4293
+ pivotBy,
4194
4294
  groupIndexForColumn,
4195
4295
  groupCount: arr.length,
4196
4296
  groupRenderStrategy
@@ -4201,13 +4301,40 @@ function getColumnsWhenGrouping(params) {
4201
4301
  const singleGroupColumn = getSingleGroupColumn({
4202
4302
  groupCount: groupBy.length,
4203
4303
  groupBy,
4304
+ pivotBy,
4204
4305
  groupRenderStrategy
4205
4306
  }, toggleGroupRow, groupColumn);
4206
4307
  computedColumns.set(singleGroupColumn.id || "group-by", singleGroupColumn);
4207
4308
  }
4208
- columns.forEach((col, colId) => {
4209
- computedColumns.set(colId, col);
4210
- });
4309
+ if (pivotColumns) {
4310
+ pivotColumns.forEach((col, key) => {
4311
+ if (col.pivotTotalColumn && pivotTotalColumnPosition === false) {
4312
+ return;
4313
+ }
4314
+ let column = __spreadValues({}, col);
4315
+ if (pivotColumn) {
4316
+ if (typeof pivotColumn === "function") {
4317
+ column = __spreadValues(__spreadValues({}, column), pivotColumn({
4318
+ column,
4319
+ pivotBy,
4320
+ groupBy
4321
+ }));
4322
+ } else {
4323
+ column = __spreadValues(__spreadValues({}, column), pivotColumn);
4324
+ }
4325
+ }
4326
+ if (!column.render && column.renderValue) {
4327
+ column.render = (renderOptions) => {
4328
+ return column.renderValue(renderOptions);
4329
+ };
4330
+ }
4331
+ computedColumns.set(key, column);
4332
+ });
4333
+ } else {
4334
+ columns.forEach((col, colId) => {
4335
+ computedColumns.set(colId, col);
4336
+ });
4337
+ }
4211
4338
  return computedColumns.size ? computedColumns : void 0;
4212
4339
  }
4213
4340
 
@@ -4246,7 +4373,7 @@ function useComputed() {
4246
4373
  }, [showSeparatePivotColumnForSingleAggregation]);
4247
4374
  const { multiSort } = dataSourceState;
4248
4375
  useColumnGroups();
4249
- useColumnsWhen();
4376
+ const { toggleGroupRow } = useColumnsWhen();
4250
4377
  const setSortInfo = useCallback5((sortInfo) => {
4251
4378
  var _a2;
4252
4379
  const newSortInfo = multiSort ? sortInfo : (_a2 = sortInfo[0]) != null ? _a2 : null;
@@ -4315,6 +4442,7 @@ function useComputed() {
4315
4442
  const computedPinnedStartOverflow = computedPinnedStartWidth ? computedPinnedStartColumnsWidth > computedPinnedStartWidth : false;
4316
4443
  const computedPinnedEndOverflow = computedPinnedEndWidth ? computedPinnedEndColumnsWidth > computedPinnedEndWidth : false;
4317
4444
  return {
4445
+ toggleGroupRow,
4318
4446
  computedPinnedStartOverflow,
4319
4447
  computedPinnedEndOverflow,
4320
4448
  computedPinnedStartWidth,
@@ -4339,7 +4467,7 @@ function useComputed() {
4339
4467
 
4340
4468
  // src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx
4341
4469
  import {
4342
- createElement as createElement7,
4470
+ createElement as createElement6,
4343
4471
  forwardRef
4344
4472
  } from "react";
4345
4473
 
@@ -4351,7 +4479,7 @@ var useInternalProps = () => {
4351
4479
  // src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx
4352
4480
  var InfiniteTableBody = forwardRef(function InfiniteTableBody2(props, ref) {
4353
4481
  const { rootClassName: rootClassName12 } = useInternalProps();
4354
- return /* @__PURE__ */ createElement7("div", __spreadProps(__spreadValues({
4482
+ return /* @__PURE__ */ createElement6("div", __spreadProps(__spreadValues({
4355
4483
  ref
4356
4484
  }, props), {
4357
4485
  className: join(`${rootClassName12}Body`, position.relative, flex["1"], transformTranslateZero, props.className)
@@ -4360,12 +4488,12 @@ var InfiniteTableBody = forwardRef(function InfiniteTableBody2(props, ref) {
4360
4488
 
4361
4489
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx
4362
4490
  import {
4363
- createElement as createElement19
4491
+ createElement as createElement18
4364
4492
  } from "react";
4365
4493
 
4366
4494
  // src/components/InfiniteTable/components/ScrollbarPlaceholder.tsx
4367
4495
  import {
4368
- createElement as createElement8,
4496
+ createElement as createElement7,
4369
4497
  memo as memo2
4370
4498
  } from "react";
4371
4499
  function HorizontalScrollbarPlaceholderFn(props) {
@@ -4373,7 +4501,7 @@ function HorizontalScrollbarPlaceholderFn(props) {
4373
4501
  if (!scrollbarWidth2) {
4374
4502
  return null;
4375
4503
  }
4376
- return /* @__PURE__ */ createElement8("div", {
4504
+ return /* @__PURE__ */ createElement7("div", {
4377
4505
  "data-name": "horizontal-scrollbar-placeholder",
4378
4506
  style: __spreadValues({
4379
4507
  position: "absolute",
@@ -4389,7 +4517,7 @@ function VerticalScrollbarPlaceholderFn(props) {
4389
4517
  if (!scrollbarWidth2) {
4390
4518
  return null;
4391
4519
  }
4392
- return /* @__PURE__ */ createElement8("div", {
4520
+ return /* @__PURE__ */ createElement7("div", {
4393
4521
  "data-name": "vertical-scrollbar-placeholder",
4394
4522
  style: __spreadValues({
4395
4523
  position: "absolute",
@@ -4415,7 +4543,7 @@ var HeaderWrapperCls = "_12zfob1v _16lm1iw16 _16lm1iw1 _16lm1iwj _16lm1iw10";
4415
4543
 
4416
4544
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
4417
4545
  import {
4418
- createElement as createElement15,
4546
+ createElement as createElement14,
4419
4547
  memo as memo6
4420
4548
  } from "react";
4421
4549
  import { useCallback as useCallback8, useEffect as useEffect14, useRef as useRef9 } from "react";
@@ -4423,13 +4551,13 @@ import { useCallback as useCallback8, useEffect as useEffect14, useRef as useRef
4423
4551
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
4424
4552
  import {
4425
4553
  Fragment as Fragment2,
4426
- createElement as createElement11
4554
+ createElement as createElement10
4427
4555
  } from "react";
4428
4556
  import { useCallback as useCallback7, useEffect as useEffect12, useRef as useRef8 } from "react";
4429
4557
 
4430
4558
  // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
4431
4559
  import {
4432
- createElement as createElement9,
4560
+ createElement as createElement8,
4433
4561
  memo as memo3
4434
4562
  } from "react";
4435
4563
 
@@ -4490,12 +4618,12 @@ function InfiniteTableCellFn(props) {
4490
4618
  style.transform = `translate3d(${shiftLeft}px, 0px, 0px)`;
4491
4619
  }
4492
4620
  }
4493
- return /* @__PURE__ */ createElement9("div", __spreadProps(__spreadValues({}, domProps), {
4621
+ return /* @__PURE__ */ createElement8("div", __spreadProps(__spreadValues({}, domProps), {
4494
4622
  ref: domRef,
4495
4623
  style,
4496
4624
  "data-name": `Cell`,
4497
4625
  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}` : "")
4498
- }), beforeChildren, cssEllipsis ? /* @__PURE__ */ createElement9("div", {
4626
+ }), beforeChildren, cssEllipsis ? /* @__PURE__ */ createElement8("div", {
4499
4627
  className: `${rootClassName2}Cell_content ${cssEllipsisClassName}`
4500
4628
  }, children) : children, afterChildren);
4501
4629
  }
@@ -4505,7 +4633,7 @@ var InfiniteTableCell = memo3(InfiniteTableCellFn);
4505
4633
  var import_binary_search = __toModule(require_binary_search());
4506
4634
  import {
4507
4635
  useCallback as useCallback6,
4508
- useMemo as useMemo5,
4636
+ useMemo as useMemo6,
4509
4637
  useRef as useRef7,
4510
4638
  useState as useState6
4511
4639
  } from "react";
@@ -4552,8 +4680,8 @@ var useColumnPointerEvents = ({
4552
4680
  const dragging = draggingDiff != null;
4553
4681
  const { componentActions, computed } = useInfiniteTable();
4554
4682
  const { computedColumnOrder } = computed;
4555
- const column = useMemo5(() => columns.get(columnId), [columnId, columns]);
4556
- const { columnIndex, columnWidth, columnsArray } = useMemo5(() => {
4683
+ const column = useMemo6(() => columns.get(columnId), [columnId, columns]);
4684
+ const { columnIndex, columnWidth, columnsArray } = useMemo6(() => {
4557
4685
  const columnsArray2 = Array.from(columns.values());
4558
4686
  return {
4559
4687
  columnsArray: columnsArray2,
@@ -4700,7 +4828,7 @@ import { createPortal } from "react-dom";
4700
4828
 
4701
4829
  // src/components/InfiniteTable/components/icons/SortIcon.tsx
4702
4830
  import {
4703
- createElement as createElement10
4831
+ createElement as createElement9
4704
4832
  } from "react";
4705
4833
  import { useEffect as useEffect11, useState as useState7 } from "react";
4706
4834
  var defaultLineStyle = {
@@ -4755,18 +4883,18 @@ function SortIcon(props) {
4755
4883
  if (direction === -1) {
4756
4884
  indexStyle.top = "100%";
4757
4885
  }
4758
- return /* @__PURE__ */ createElement10("div", {
4886
+ return /* @__PURE__ */ createElement9("div", {
4759
4887
  style: __spreadProps(__spreadValues({}, style), { width: size }),
4760
4888
  className: join(className, "ITableIcon", "ITableIcon-sort")
4761
- }, showIndex ? /* @__PURE__ */ createElement10("div", {
4889
+ }, showIndex ? /* @__PURE__ */ createElement9("div", {
4762
4890
  "data-name": "index",
4763
4891
  style: indexStyle
4764
- }, index) : null, /* @__PURE__ */ createElement10("div", {
4892
+ }, index) : null, /* @__PURE__ */ createElement9("div", {
4765
4893
  style: __spreadValues({ width: sizes[0] }, lineStyle),
4766
4894
  onTransitionEnd
4767
- }), /* @__PURE__ */ createElement10("div", {
4895
+ }), /* @__PURE__ */ createElement9("div", {
4768
4896
  style: __spreadValues({ width: sizes[1] }, lineStyle)
4769
- }), /* @__PURE__ */ createElement10("div", {
4897
+ }), /* @__PURE__ */ createElement9("div", {
4770
4898
  style: __spreadValues({ width: sizes[2] }, lineStyle)
4771
4899
  }));
4772
4900
  }
@@ -4797,7 +4925,7 @@ function InfiniteTableHeaderCell(props) {
4797
4925
  });
4798
4926
  }
4799
4927
  header = header != null ? header : column.name;
4800
- const sortTool = /* @__PURE__ */ createElement11(SortIcon, {
4928
+ const sortTool = /* @__PURE__ */ createElement10(SortIcon, {
4801
4929
  index: column.computedMultiSort ? column.computedSortIndex + 1 : void 0,
4802
4930
  className: `${baseCls}__sort-icon ${HeaderSortIconCls}`,
4803
4931
  direction: column.computedSorted ? column.computedSortedAsc ? 1 : -1 : 0
@@ -4835,7 +4963,7 @@ function InfiniteTableHeaderCell(props) {
4835
4963
  let offset = offsetFromProps != null ? offsetFromProps : virtualized ? 0 : column.computedPinningOffset;
4836
4964
  let draggingProxy = null;
4837
4965
  if (dragging) {
4838
- draggingProxy = /* @__PURE__ */ createElement11("div", {
4966
+ draggingProxy = /* @__PURE__ */ createElement10("div", {
4839
4967
  className: `${baseCls}Proxy ${HeaderCellProxy}`,
4840
4968
  style: {
4841
4969
  position: "absolute",
@@ -4848,7 +4976,7 @@ function InfiniteTableHeaderCell(props) {
4848
4976
  }, header);
4849
4977
  draggingProxy = createPortal(draggingProxy, portalDOMRef.current);
4850
4978
  }
4851
- return /* @__PURE__ */ createElement11(Fragment2, null, /* @__PURE__ */ createElement11(InfiniteTableCell, {
4979
+ return /* @__PURE__ */ createElement10(Fragment2, null, /* @__PURE__ */ createElement10(InfiniteTableCell, {
4852
4980
  domRef: ref,
4853
4981
  column,
4854
4982
  "data-name": `HeaderCell`,
@@ -4865,7 +4993,7 @@ function InfiniteTableHeaderCell(props) {
4865
4993
 
4866
4994
  // src/components/RawList/index.tsx
4867
4995
  import {
4868
- createElement as createElement14,
4996
+ createElement as createElement13,
4869
4997
  memo as memo5
4870
4998
  } from "react";
4871
4999
  import { useEffect as useEffect13 } from "react";
@@ -4873,7 +5001,7 @@ import { useEffect as useEffect13 } from "react";
4873
5001
  // src/components/RawList/AvoidReactDiff.tsx
4874
5002
  import {
4875
5003
  Fragment as Fragment3,
4876
- createElement as createElement12,
5004
+ createElement as createElement11,
4877
5005
  memo as memo4
4878
5006
  } from "react";
4879
5007
  import { useLayoutEffect as useLayoutEffect3, useState as useState8 } from "react";
@@ -4885,16 +5013,16 @@ function AvoidReactDiffFn(props) {
4885
5013
  });
4886
5014
  return remove;
4887
5015
  }, [props.updater]);
4888
- return /* @__PURE__ */ createElement12(Fragment3, null, children);
5016
+ return /* @__PURE__ */ createElement11(Fragment3, null, children);
4889
5017
  }
4890
5018
  var AvoidReactDiff = memo4(AvoidReactDiffFn);
4891
5019
 
4892
5020
  // src/components/RawList/useVirtualRenderer.ts
4893
- import { useMemo as useMemo6 } from "react";
5021
+ import { useMemo as useMemo7 } from "react";
4894
5022
 
4895
5023
  // src/components/RawList/ReactVirtualRenderer.tsx
4896
5024
  import {
4897
- createElement as createElement13
5025
+ createElement as createElement12
4898
5026
  } from "react";
4899
5027
 
4900
5028
  // src/components/RawList/MappedItems.ts
@@ -5140,7 +5268,7 @@ var ReactVirtualRenderer = class extends Logger {
5140
5268
  };
5141
5269
  this.itemDOMRefs[elementIndex] = domRef;
5142
5270
  this.updaters[elementIndex] = buildSubscriptionCallback();
5143
- const item = /* @__PURE__ */ createElement13(AvoidReactDiff, {
5271
+ const item = /* @__PURE__ */ createElement12(AvoidReactDiff, {
5144
5272
  key: elementIndex,
5145
5273
  name: `${elementIndex}`,
5146
5274
  updater: this.updaters[elementIndex]
@@ -5206,7 +5334,7 @@ function createRenderer(brain) {
5206
5334
  function useVirtualRenderer({
5207
5335
  brain
5208
5336
  }) {
5209
- return useMemo6(() => {
5337
+ return useMemo7(() => {
5210
5338
  return createRenderer(brain);
5211
5339
  }, [brain]);
5212
5340
  }
@@ -5237,7 +5365,7 @@ function RawListFn(props) {
5237
5365
  });
5238
5366
  return remove;
5239
5367
  }, [brain, onRenderUpdater]);
5240
- return /* @__PURE__ */ createElement14(AvoidReactDiff, {
5368
+ return /* @__PURE__ */ createElement13(AvoidReactDiff, {
5241
5369
  updater: onRenderUpdater
5242
5370
  });
5243
5371
  }
@@ -5262,7 +5390,7 @@ function InfiniteTableHeaderFn(props) {
5262
5390
  }
5263
5391
  return null;
5264
5392
  }
5265
- return /* @__PURE__ */ createElement15(InfiniteTableHeaderCell, {
5393
+ return /* @__PURE__ */ createElement14(InfiniteTableHeaderCell, {
5266
5394
  domRef: domRef2,
5267
5395
  column,
5268
5396
  headerHeight,
@@ -5287,7 +5415,7 @@ function InfiniteTableHeaderFn(props) {
5287
5415
  className: join(TableHeaderClassName, `${TableHeaderClassName}--virtualized`, className, headerCls),
5288
5416
  style
5289
5417
  };
5290
- return /* @__PURE__ */ createElement15("div", __spreadValues({}, domProps), /* @__PURE__ */ createElement15(RawList, {
5418
+ return /* @__PURE__ */ createElement14("div", __spreadValues({}, domProps), /* @__PURE__ */ createElement14(RawList, {
5291
5419
  brain,
5292
5420
  renderItem: renderColumn
5293
5421
  }));
@@ -5296,15 +5424,15 @@ var InfiniteTableHeader = memo6(InfiniteTableHeaderFn);
5296
5424
 
5297
5425
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderUnvirtualized.tsx
5298
5426
  import {
5299
- createElement as createElement18,
5427
+ createElement as createElement17,
5300
5428
  memo as memo7,
5301
- useMemo as useMemo7,
5429
+ useMemo as useMemo8,
5302
5430
  useRef as useRef10
5303
5431
  } from "react";
5304
5432
 
5305
5433
  // src/components/InfiniteTable/components/InfiniteTableHeader/renderColumnHeaderGroups.tsx
5306
5434
  import {
5307
- createElement as createElement17
5435
+ createElement as createElement16
5308
5436
  } from "react";
5309
5437
 
5310
5438
  // src/components/InfiniteTable/components/InfiniteTableHeader/buildColumnAndGroupTree.ts
@@ -5396,7 +5524,7 @@ function assignGroupOffsetsAndComputedWidths(items, groupOffset = 0) {
5396
5524
 
5397
5525
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderGroup.tsx
5398
5526
  import {
5399
- createElement as createElement16
5527
+ createElement as createElement15
5400
5528
  } from "react";
5401
5529
  var TableHeaderGroupClassName = `${rootClassName}HeaderGroup`;
5402
5530
  function InfiniteTableHeaderGroup(props) {
@@ -5411,16 +5539,16 @@ function InfiniteTableHeaderGroup(props) {
5411
5539
  width: columnGroup.computedWidth,
5412
5540
  height
5413
5541
  };
5414
- return /* @__PURE__ */ createElement16("div", {
5542
+ return /* @__PURE__ */ createElement15("div", {
5415
5543
  "data-group-id": columnGroup.id,
5416
5544
  className: join(HeaderGroupCls, TableHeaderGroupClassName, `${TableHeaderGroupClassName}--unvirtualized`),
5417
5545
  style
5418
- }, /* @__PURE__ */ createElement16("div", {
5546
+ }, /* @__PURE__ */ createElement15("div", {
5419
5547
  className: join(`${TableHeaderGroupClassName}__header`, HeaderGroup_Header),
5420
5548
  style: { height: headerHeight }
5421
- }, /* @__PURE__ */ createElement16("div", {
5549
+ }, /* @__PURE__ */ createElement15("div", {
5422
5550
  className: join(`${TableHeaderGroupClassName}__header-content`, cssEllipsisClassName)
5423
- }, header)), /* @__PURE__ */ createElement16("div", {
5551
+ }, header)), /* @__PURE__ */ createElement15("div", {
5424
5552
  className: join(`${TableHeaderGroupClassName}__children`, HeaderGroup_Children)
5425
5553
  }, props.children));
5426
5554
  }
@@ -5443,7 +5571,7 @@ function renderColumnHeaderGroups(config) {
5443
5571
  return items2.map((colGroupItem) => {
5444
5572
  if (colGroupItem.type === "column") {
5445
5573
  const col = colGroupItem.ref;
5446
- return /* @__PURE__ */ createElement17(InfiniteTableHeaderCell, {
5574
+ return /* @__PURE__ */ createElement16(InfiniteTableHeaderCell, {
5447
5575
  key: col.id,
5448
5576
  headerHeight: (columnGroupsMaxDepth - colGroupItem.depth + 2) * headerHeight,
5449
5577
  column: col,
@@ -5457,7 +5585,7 @@ function renderColumnHeaderGroups(config) {
5457
5585
  colIds.push(col.id);
5458
5586
  return col;
5459
5587
  });
5460
- return /* @__PURE__ */ createElement17(InfiniteTableHeaderGroup, {
5588
+ return /* @__PURE__ */ createElement16(InfiniteTableHeaderGroup, {
5461
5589
  key: `${colGroupItem.uniqueGroupId.join("/")}`,
5462
5590
  columns: columns2,
5463
5591
  height: (columnGroupsMaxDepth - colGroupItem.depth + 2) * headerHeight,
@@ -5512,7 +5640,7 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
5512
5640
  } = useInfiniteTable();
5513
5641
  const domRef = useRef10(null);
5514
5642
  const hasColumnGroups = computedColumnGroups.size > 0;
5515
- const columnHeaderGroups = useMemo7(() => {
5643
+ const columnHeaderGroups = useMemo8(() => {
5516
5644
  return hasColumnGroups ? renderColumnHeaderGroups({
5517
5645
  columnGroups: computedColumnGroups,
5518
5646
  columnGroupsDepthsMap,
@@ -5531,7 +5659,7 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
5531
5659
  columnGroupsMaxDepth
5532
5660
  ]);
5533
5661
  const children = hasColumnGroups ? columnHeaderGroups : columns.map((c) => {
5534
- return /* @__PURE__ */ createElement18(InfiniteTableHeaderCell, {
5662
+ return /* @__PURE__ */ createElement17(InfiniteTableHeaderCell, {
5535
5663
  key: c.id,
5536
5664
  headerHeight,
5537
5665
  column: c,
@@ -5554,14 +5682,14 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
5554
5682
  const removeOnScroll = scroller.onScroll(onScroll);
5555
5683
  return removeOnScroll;
5556
5684
  }, [brain, scrollListener]);
5557
- return /* @__PURE__ */ createElement18("div", __spreadProps(__spreadValues({}, domProps), {
5685
+ return /* @__PURE__ */ createElement17("div", __spreadProps(__spreadValues({}, domProps), {
5558
5686
  className: join(TableHeaderClassName2, `${TableHeaderClassName2}--unvirtualized`, pinning ? `${TableHeaderClassName2}--pinned ${TableHeaderClassName2}-${pinning}` : "", scrollable ? `${TableHeaderClassName2}--overflow` : "", domProps.className, HeaderClsRecipe({
5559
5687
  pinned: pinning,
5560
5688
  virtualized: false,
5561
5689
  overflow: scrollable
5562
5690
  })),
5563
5691
  style
5564
- }), /* @__PURE__ */ createElement18("div", {
5692
+ }), /* @__PURE__ */ createElement17("div", {
5565
5693
  style: { width: totalWidth },
5566
5694
  className: join(flexFlow.row, display.flex),
5567
5695
  ref: domRef
@@ -5600,7 +5728,7 @@ function TableHeaderWrapper(props) {
5600
5728
  const unvirtualizedStyle = !virtualizeHeader && computedPinnedStartColumnsWidth ? {
5601
5729
  left: computedPinnedStartWidth
5602
5730
  } : void 0;
5603
- const header = virtualizeHeader ? /* @__PURE__ */ createElement19(InfiniteTableHeader, {
5731
+ const header = virtualizeHeader ? /* @__PURE__ */ createElement18(InfiniteTableHeader, {
5604
5732
  columns: computedUnpinnedColumns,
5605
5733
  repaintId: virtualizeHeader ? repaintId : void 0,
5606
5734
  brain,
@@ -5613,7 +5741,7 @@ function TableHeaderWrapper(props) {
5613
5741
  },
5614
5742
  availableWidth: computedUnpinnedColumnsWidth,
5615
5743
  totalWidth: computedUnpinnedColumnsWidth
5616
- }) : /* @__PURE__ */ createElement19(InfiniteTableHeaderUnvirtualized, {
5744
+ }) : /* @__PURE__ */ createElement18(InfiniteTableHeaderUnvirtualized, {
5617
5745
  style: unvirtualizedStyle,
5618
5746
  brain,
5619
5747
  scrollable: true,
@@ -5622,12 +5750,12 @@ function TableHeaderWrapper(props) {
5622
5750
  availableWidth: computedUnpinnedColumnsWidth,
5623
5751
  totalWidth: computedUnpinnedColumnsWidth
5624
5752
  });
5625
- return /* @__PURE__ */ createElement19("div", {
5753
+ return /* @__PURE__ */ createElement18("div", {
5626
5754
  className: HeaderWrapperCls,
5627
5755
  style: {
5628
5756
  height: virtualizeHeader ? height : void 0
5629
5757
  }
5630
- }, hasPinnedStart ? /* @__PURE__ */ createElement19(InfiniteTableHeaderUnvirtualized, {
5758
+ }, hasPinnedStart ? /* @__PURE__ */ createElement18(InfiniteTableHeaderUnvirtualized, {
5631
5759
  style: {
5632
5760
  left: 0,
5633
5761
  position: "absolute",
@@ -5639,7 +5767,7 @@ function TableHeaderWrapper(props) {
5639
5767
  scrollable: computedPinnedStartOverflow,
5640
5768
  pinning: "start",
5641
5769
  scrollListener: computedPinnedStartOverflow ? pinnedStartScrollListener : void 0
5642
- }) : null, header, hasPinnedEnd ? /* @__PURE__ */ createElement19(InfiniteTableHeaderUnvirtualized, {
5770
+ }) : null, header, hasPinnedEnd ? /* @__PURE__ */ createElement18(InfiniteTableHeaderUnvirtualized, {
5643
5771
  style: {
5644
5772
  right: scrollbars.vertical ? getScrollbarWidth() : 0,
5645
5773
  position: "absolute",
@@ -5651,7 +5779,7 @@ function TableHeaderWrapper(props) {
5651
5779
  scrollable: computedPinnedEndOverflow,
5652
5780
  pinning: "end",
5653
5781
  scrollListener: computedPinnedEndOverflow ? pinnedEndScrollListener : void 0
5654
- }) : null, scrollbars.vertical ? /* @__PURE__ */ createElement19(VerticalScrollbarPlaceholder, {
5782
+ }) : null, scrollbars.vertical ? /* @__PURE__ */ createElement18(VerticalScrollbarPlaceholder, {
5655
5783
  style: {
5656
5784
  height: "100%",
5657
5785
  right: 0
@@ -5661,7 +5789,7 @@ function TableHeaderWrapper(props) {
5661
5789
 
5662
5790
  // src/components/VirtualScrollContainer/index.tsx
5663
5791
  import {
5664
- createElement as createElement20,
5792
+ createElement as createElement19,
5665
5793
  forwardRef as forwardRef2
5666
5794
  } from "react";
5667
5795
  import { useRef as useRef11 } from "react";
@@ -5717,7 +5845,7 @@ var VirtualScrollContainer = forwardRef2(function VirtualScrollContainer2(props,
5717
5845
  } = props;
5718
5846
  const domRef = ref != null ? ref : useRef11(null);
5719
5847
  useOnScroll(domRef, onContainerScroll);
5720
- return /* @__PURE__ */ createElement20("div", {
5848
+ return /* @__PURE__ */ createElement19("div", {
5721
5849
  ref: domRef,
5722
5850
  style,
5723
5851
  className: join(className, rootClassName6, VirtualScrollContainerCls, getScrollableClassName(scrollable))
@@ -5726,7 +5854,7 @@ var VirtualScrollContainer = forwardRef2(function VirtualScrollContainer2(props,
5726
5854
 
5727
5855
  // src/components/VirtualList/SpacePlaceholder.tsx
5728
5856
  import {
5729
- createElement as createElement21,
5857
+ createElement as createElement20,
5730
5858
  memo as memo8
5731
5859
  } from "react";
5732
5860
  function SpacePlaceholderFn(props) {
@@ -5738,7 +5866,7 @@ function SpacePlaceholderFn(props) {
5738
5866
  opacity: 0,
5739
5867
  pointerEvents: "none"
5740
5868
  };
5741
- return /* @__PURE__ */ createElement21("div", {
5869
+ return /* @__PURE__ */ createElement20("div", {
5742
5870
  "data-count": count,
5743
5871
  "data-placeholder-width": true ? width : void 0,
5744
5872
  "data-placeholder-height": true ? height : void 0,
@@ -5749,24 +5877,24 @@ function SpacePlaceholderFn(props) {
5749
5877
  var SpacePlaceholder = memo8(SpacePlaceholderFn);
5750
5878
 
5751
5879
  // src/components/InfiniteTable/hooks/useListRendering.tsx
5752
- import { useCallback as useCallback17, useEffect as useEffect22, useMemo as useMemo10, useRef as useRef17 } from "react";
5880
+ import { useEffect as useEffect22, useMemo as useMemo11, useRef as useRef17 } from "react";
5753
5881
 
5754
5882
  // src/components/InfiniteTable/hooks/useUnpinnedRendering.tsx
5755
5883
  import {
5756
- createElement as createElement27
5884
+ createElement as createElement26
5757
5885
  } from "react";
5758
5886
  import { useCallback as useCallback12 } from "react";
5759
5887
 
5760
5888
  // src/components/VirtualList/VirtualRowList.tsx
5761
5889
  import {
5762
- createElement as createElement23,
5890
+ createElement as createElement22,
5763
5891
  useCallback as useCallback9
5764
5892
  } from "react";
5765
5893
 
5766
5894
  // src/components/VirtualList/VirtualList.tsx
5767
5895
  import {
5768
5896
  Fragment as Fragment4,
5769
- createElement as createElement22
5897
+ createElement as createElement21
5770
5898
  } from "react";
5771
5899
  import { useRef as useRef12, useEffect as useEffect17, useState as useState9 } from "react";
5772
5900
 
@@ -5849,19 +5977,19 @@ var VirtualList = (props) => {
5849
5977
  if (true) {
5850
5978
  domProps["data-cmp-name"] = `VirtualList`;
5851
5979
  }
5852
- return /* @__PURE__ */ createElement22(Fragment4, null, /* @__PURE__ */ createElement22("div", __spreadValues({}, domProps), /* @__PURE__ */ createElement22(VirtualScrollContainer, {
5980
+ return /* @__PURE__ */ createElement21(Fragment4, null, /* @__PURE__ */ createElement21("div", __spreadValues({}, domProps), /* @__PURE__ */ createElement21(VirtualScrollContainer, {
5853
5981
  scrollable,
5854
5982
  onContainerScroll
5855
- }, /* @__PURE__ */ createElement22("div", {
5983
+ }, /* @__PURE__ */ createElement21("div", {
5856
5984
  ref: domRef,
5857
5985
  className: scrollTransformTargetCls,
5858
5986
  "data-name": "scroll-transform-target"
5859
- }, /* @__PURE__ */ createElement22(RawList, {
5987
+ }, /* @__PURE__ */ createElement21(RawList, {
5860
5988
  brain: virtualBrain,
5861
5989
  renderItem,
5862
5990
  repaintId,
5863
5991
  debugChannel: "VirtualList-" + mainAxis
5864
- })), children, /* @__PURE__ */ createElement22(SpacePlaceholder, {
5992
+ })), children, /* @__PURE__ */ createElement21(SpacePlaceholder, {
5865
5993
  count,
5866
5994
  width,
5867
5995
  height
@@ -5878,7 +6006,7 @@ var VirtualRowList = (props) => {
5878
6006
  rowIndex: renderProps.itemIndex
5879
6007
  });
5880
6008
  }, [renderRow]);
5881
- return /* @__PURE__ */ createElement23(VirtualList, __spreadProps(__spreadValues({}, listProps), {
6009
+ return /* @__PURE__ */ createElement22(VirtualList, __spreadProps(__spreadValues({}, listProps), {
5882
6010
  renderItem,
5883
6011
  mainAxis: "vertical",
5884
6012
  itemMainAxisSize: rowHeight,
@@ -5888,7 +6016,7 @@ var VirtualRowList = (props) => {
5888
6016
 
5889
6017
  // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRow.tsx
5890
6018
  import {
5891
- createElement as createElement25,
6019
+ createElement as createElement24,
5892
6020
  memo as memo10,
5893
6021
  useCallback as useCallback11
5894
6022
  } from "react";
@@ -5896,7 +6024,7 @@ import { useRef as useRef14 } from "react";
5896
6024
 
5897
6025
  // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableColumnCell.tsx
5898
6026
  import {
5899
- createElement as createElement24,
6027
+ createElement as createElement23,
5900
6028
  memo as memo9
5901
6029
  } from "react";
5902
6030
  var { rootClassName: rootClassName8 } = internalProps;
@@ -5923,9 +6051,6 @@ function InfiniteTableColumnCellFn(props) {
5923
6051
  }
5924
6052
  const { data, isGroupRow, groupBy } = rowInfo;
5925
6053
  const groupRowInfo = null;
5926
- if (rowInfo.indexInAll === 0 && column.groupByField && column.groupByField === "stack") {
5927
- debugger;
5928
- }
5929
6054
  let value = isGroupRow && groupBy && column.groupByField ? rowInfo.value : isColumnWithField(column) ? data == null ? void 0 : data[column.field] : null;
5930
6055
  if (column.valueGetter) {
5931
6056
  value = column.valueGetter(isGroupRow ? {
@@ -5958,7 +6083,8 @@ function InfiniteTableColumnCellFn(props) {
5958
6083
  rowIndex,
5959
6084
  toggleGroupRow,
5960
6085
  toggleCurrentGroupRow: () => toggleGroupRow(rowInfo.groupKeys),
5961
- groupBy: computedDataSource.groupBy
6086
+ groupBy: computedDataSource.groupBy,
6087
+ pivotBy: computedDataSource.pivotBy
5962
6088
  });
5963
6089
  if (column.render) {
5964
6090
  renderValue = column.render(renderParam);
@@ -5994,7 +6120,7 @@ function InfiniteTableColumnCellFn(props) {
5994
6120
  }
5995
6121
  }
5996
6122
  }
5997
- return /* @__PURE__ */ createElement24(InfiniteTableCell, __spreadProps(__spreadValues({
6123
+ return /* @__PURE__ */ createElement23(InfiniteTableCell, __spreadProps(__spreadValues({
5998
6124
  domRef,
5999
6125
  offsetProperty
6000
6126
  }, dataset), {
@@ -6144,7 +6270,7 @@ function InfiniteTableRowFn(props) {
6144
6270
  if (!column) {
6145
6271
  }
6146
6272
  const hidden = false;
6147
- return /* @__PURE__ */ createElement25(InfiniteTableColumnCell, {
6273
+ return /* @__PURE__ */ createElement24(InfiniteTableColumnCell, {
6148
6274
  getData,
6149
6275
  rowInfo,
6150
6276
  groupRenderStrategy,
@@ -6171,9 +6297,9 @@ function InfiniteTableRowFn(props) {
6171
6297
  if (true) {
6172
6298
  domProps["data-cmp-name"] = "ITableRow";
6173
6299
  }
6174
- return /* @__PURE__ */ createElement25("div", __spreadProps(__spreadValues({}, domProps), {
6300
+ return /* @__PURE__ */ createElement24("div", __spreadProps(__spreadValues({}, domProps), {
6175
6301
  style
6176
- }), /* @__PURE__ */ createElement25(RawList, {
6302
+ }), /* @__PURE__ */ createElement24(RawList, {
6177
6303
  brain,
6178
6304
  renderItem: renderCell,
6179
6305
  debugChannel: `${rowIndex}`
@@ -6183,7 +6309,7 @@ var InfiniteTableRow = memo10(InfiniteTableRowFn);
6183
6309
 
6184
6310
  // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRowUnvirtualized.tsx
6185
6311
  import {
6186
- createElement as createElement26,
6312
+ createElement as createElement25,
6187
6313
  memo as memo11
6188
6314
  } from "react";
6189
6315
  function TableRowUnvirtualizedFn(props) {
@@ -6206,7 +6332,7 @@ function TableRowUnvirtualizedFn(props) {
6206
6332
  }, domProps.style);
6207
6333
  const children = columns.map((col) => {
6208
6334
  const hidden = false;
6209
- return /* @__PURE__ */ createElement26(InfiniteTableColumnCell, {
6335
+ return /* @__PURE__ */ createElement25(InfiniteTableColumnCell, {
6210
6336
  key: col.id,
6211
6337
  virtualized: false,
6212
6338
  rowHeight,
@@ -6219,7 +6345,7 @@ function TableRowUnvirtualizedFn(props) {
6219
6345
  column: col
6220
6346
  });
6221
6347
  });
6222
- return /* @__PURE__ */ createElement26("div", __spreadProps(__spreadValues({}, domProps), {
6348
+ return /* @__PURE__ */ createElement25("div", __spreadProps(__spreadValues({}, domProps), {
6223
6349
  style
6224
6350
  }), children);
6225
6351
  }
@@ -6266,7 +6392,7 @@ function useUnpinnedRendering(params) {
6266
6392
  rowProps.repaintId = repaintId;
6267
6393
  }
6268
6394
  const TableRowComponent = shouldVirtualizeColumns ? InfiniteTableRow : TableRowUnvirtualized;
6269
- return /* @__PURE__ */ createElement27(TableRowComponent, __spreadValues({}, rowProps));
6395
+ return /* @__PURE__ */ createElement26(TableRowComponent, __spreadValues({}, rowProps));
6270
6396
  }, [
6271
6397
  repaintId,
6272
6398
  rowHeight,
@@ -6276,7 +6402,7 @@ function useUnpinnedRendering(params) {
6276
6402
  horizontalVirtualBrain,
6277
6403
  verticalVirtualBrain
6278
6404
  ]);
6279
- const fakeScrollbar = getScrollbarWidth() ? /* @__PURE__ */ createElement27("div", {
6405
+ const fakeScrollbar = getScrollbarWidth() ? /* @__PURE__ */ createElement26("div", {
6280
6406
  "data-name": "horizontal-scrollbar-placeholder--fake",
6281
6407
  style: {
6282
6408
  position: "absolute",
@@ -6287,10 +6413,10 @@ function useUnpinnedRendering(params) {
6287
6413
  overflow: "auto",
6288
6414
  visibility: columnShifts ? "visible" : "hidden"
6289
6415
  }
6290
- }, /* @__PURE__ */ createElement27("div", {
6416
+ }, /* @__PURE__ */ createElement26("div", {
6291
6417
  style: { height: "100%", width: computedUnpinnedColumnsWidth }
6292
6418
  })) : null;
6293
- return rowHeight != 0 ? /* @__PURE__ */ createElement27(VirtualRowList, {
6419
+ return rowHeight != 0 ? /* @__PURE__ */ createElement26(VirtualRowList, {
6294
6420
  repaintId: `${repaintId}-unpinned-`,
6295
6421
  brain: verticalVirtualBrain,
6296
6422
  onContainerScroll: applyScrollHorizontal,
@@ -6434,14 +6560,14 @@ var useOnContainerScroll = ({
6434
6560
 
6435
6561
  // src/components/InfiniteTable/hooks/usePinnedRendering.tsx
6436
6562
  import {
6437
- createElement as createElement29,
6438
- useMemo as useMemo8
6563
+ createElement as createElement28,
6564
+ useMemo as useMemo9
6439
6565
  } from "react";
6440
6566
  import { useCallback as useCallback15 } from "react";
6441
6567
 
6442
6568
  // src/components/VirtualList/RowListWithExternalScrolling.tsx
6443
6569
  import {
6444
- createElement as createElement28
6570
+ createElement as createElement27
6445
6571
  } from "react";
6446
6572
  import { useEffect as useEffect20, useCallback as useCallback14, useRef as useRef16 } from "react";
6447
6573
 
@@ -6518,7 +6644,7 @@ var RowListWithExternalScrolling = (props) => {
6518
6644
  if (true) {
6519
6645
  domProps["data-cmp-name"] = "RowListWithExternalScrolling";
6520
6646
  }
6521
- return /* @__PURE__ */ createElement28("div", __spreadValues({}, domProps), /* @__PURE__ */ createElement28(RawList, {
6647
+ return /* @__PURE__ */ createElement27("div", __spreadValues({}, domProps), /* @__PURE__ */ createElement27(RawList, {
6522
6648
  brain,
6523
6649
  renderItem,
6524
6650
  repaintId
@@ -6541,7 +6667,7 @@ function PinnedRowsContainer(props) {
6541
6667
  brain,
6542
6668
  renderRow
6543
6669
  } = props;
6544
- const style = useMemo8(() => {
6670
+ const style = useMemo9(() => {
6545
6671
  const result = pinning === "end" ? {
6546
6672
  width: rowWidth,
6547
6673
  height,
@@ -6567,7 +6693,7 @@ function PinnedRowsContainer(props) {
6567
6693
  className: join(`${PinnedRowsContainerClassName}`, PinnedRowsClsVariants[pinning === "start" ? "pinnedStart" : "pinnedEnd"], `${PinnedRowsContainerClassName}--pinned-${pinning}`, `${PinnedRowsContainerClassName}--overflow`, PinnedRowsClsVariants.overflow)
6568
6694
  };
6569
6695
  if (hasOverflow) {
6570
- return /* @__PURE__ */ createElement29(VirtualScrollContainer, {
6696
+ return /* @__PURE__ */ createElement28(VirtualScrollContainer, {
6571
6697
  scrollable: {
6572
6698
  horizontal: true,
6573
6699
  vertical: false
@@ -6583,18 +6709,18 @@ function PinnedRowsContainer(props) {
6583
6709
  className: join(PinnedRowsContainerClsVariants({
6584
6710
  pinned: pinning
6585
6711
  }), `${PinnedRowsContainerClassName}Container`, `${PinnedRowsContainerClassName}Container--pinned-${pinning}`)
6586
- }, /* @__PURE__ */ createElement29(RowListWithExternalScrolling, __spreadProps(__spreadValues({}, rowListProps), {
6712
+ }, /* @__PURE__ */ createElement28(RowListWithExternalScrolling, __spreadProps(__spreadValues({}, rowListProps), {
6587
6713
  onMount: (node) => {
6588
6714
  pinnedScrollListener == null ? void 0 : pinnedScrollListener.onScroll((scrollPosition) => {
6589
6715
  updateScroll(node, brain.getScrollPosition(), scrollPosition);
6590
6716
  });
6591
6717
  }
6592
- })), /* @__PURE__ */ createElement29(SpacePlaceholder, {
6718
+ })), /* @__PURE__ */ createElement28(SpacePlaceholder, {
6593
6719
  width: rowWidth,
6594
6720
  height: 1
6595
6721
  }));
6596
6722
  }
6597
- return /* @__PURE__ */ createElement29(RowListWithExternalScrolling, __spreadValues({}, rowListProps));
6723
+ return /* @__PURE__ */ createElement28(RowListWithExternalScrolling, __spreadValues({}, rowListProps));
6598
6724
  }
6599
6725
  function useRenderPinnedRow(params) {
6600
6726
  const { getData, getState, columnsWidth, columns, verticalBrain } = params;
@@ -6614,7 +6740,7 @@ function useRenderPinnedRow(params) {
6614
6740
  rowWidth: columnsWidth,
6615
6741
  columns
6616
6742
  }, rowParams);
6617
- return /* @__PURE__ */ createElement29(TableRowUnvirtualized, __spreadValues({}, rowProps));
6743
+ return /* @__PURE__ */ createElement28(TableRowUnvirtualized, __spreadValues({}, rowProps));
6618
6744
  }, [columnsWidth, columns, verticalBrain]);
6619
6745
  return renderPinnedRow;
6620
6746
  }
@@ -6657,7 +6783,7 @@ function usePinnedRenderingForSide(side, params) {
6657
6783
  columns,
6658
6784
  columnsWidth
6659
6785
  });
6660
- const pinnedList = columns.length && rowHeight !== 0 ? /* @__PURE__ */ createElement29(PinnedRowsContainer, {
6786
+ const pinnedList = columns.length && rowHeight !== 0 ? /* @__PURE__ */ createElement28(PinnedRowsContainer, {
6661
6787
  pinning: side,
6662
6788
  pinnedScrollListener,
6663
6789
  hasOverflow,
@@ -6670,7 +6796,7 @@ function usePinnedRenderingForSide(side, params) {
6670
6796
  brain: verticalVirtualBrain,
6671
6797
  renderRow: renderRowPinned
6672
6798
  }) : null;
6673
- const pinnedScrollbarPlaceholder = pinnedList && hasHorizontalScrollbar && !hasOverflow ? /* @__PURE__ */ createElement29(HorizontalScrollbarPlaceholder, {
6799
+ const pinnedScrollbarPlaceholder = pinnedList && hasHorizontalScrollbar && !hasOverflow ? /* @__PURE__ */ createElement28(HorizontalScrollbarPlaceholder, {
6674
6800
  style: side === "end" ? {
6675
6801
  width: columnsWidth,
6676
6802
  right: hasVerticalScrollbar ? getScrollbarWidth() : 0
@@ -6715,9 +6841,9 @@ function usePinnedStartRendering(params) {
6715
6841
  import { useEffect as useEffect21 } from "react";
6716
6842
 
6717
6843
  // src/components/hooks/useOnce.ts
6718
- import { useMemo as useMemo9 } from "react";
6844
+ import { useMemo as useMemo10 } from "react";
6719
6845
  function useOnce(fn) {
6720
- const onceFn = useMemo9(() => {
6846
+ const onceFn = useMemo10(() => {
6721
6847
  return once(fn);
6722
6848
  }, []);
6723
6849
  return onceFn();
@@ -7239,7 +7365,8 @@ function useListRendering(param) {
7239
7365
  computedUnpinnedColumnsWidth,
7240
7366
  computedPinnedStartOverflow,
7241
7367
  computedPinnedEndOverflow,
7242
- computedVisibleColumns
7368
+ computedVisibleColumns,
7369
+ toggleGroupRow
7243
7370
  } = computed;
7244
7371
  const { componentState: dataSourceState, getState: getDataSourceState } = useDataSourceContextValue();
7245
7372
  const { dataArray } = dataSourceState;
@@ -7257,7 +7384,7 @@ function useListRendering(param) {
7257
7384
  repaintIdRef.current++;
7258
7385
  }
7259
7386
  const repaintId = repaintIdRef.current;
7260
- const rowSpan = useMemo10(() => {
7387
+ const rowSpan = useMemo11(() => {
7261
7388
  const colsWithRowspan = computedVisibleColumns.filter((col) => typeof col.rowspan === "function");
7262
7389
  return colsWithRowspan.length ? ({ itemIndex }) => {
7263
7390
  let maxSpan = 1;
@@ -7295,7 +7422,7 @@ function useListRendering(param) {
7295
7422
  const hasHorizontalScrollbar = computedUnpinnedColumnsWidth > bodySize.width - computedPinnedStartColumnsWidth - computedPinnedEndColumnsWidth;
7296
7423
  const reservedContentHeight = verticalVirtualBrain.getTotalSize() + (hasHorizontalScrollbar ? getScrollbarWidth() : 0);
7297
7424
  const hasVerticalScrollbar = bodySize.height > 0 && bodySize.height < reservedContentHeight;
7298
- const scrollbars = useMemo10(() => ({
7425
+ const scrollbars = useMemo11(() => ({
7299
7426
  vertical: hasVerticalScrollbar,
7300
7427
  horizontal: hasHorizontalScrollbar
7301
7428
  }), [hasVerticalScrollbar, hasHorizontalScrollbar]);
@@ -7323,12 +7450,6 @@ function useListRendering(param) {
7323
7450
  horizontalVirtualBrain,
7324
7451
  reservedContentHeight
7325
7452
  });
7326
- const { componentActions: dataSourceActions } = useDataSourceContextValue();
7327
- const toggleGroupRow = useCallback17((groupKeys) => {
7328
- const newState = new GroupRowsState(getDataSourceState().groupRowsState);
7329
- newState.toggleGroupRow(groupKeys);
7330
- dataSourceActions.groupRowsState = newState;
7331
- }, []);
7332
7453
  const pinnedRenderingParams = {
7333
7454
  bodySize,
7334
7455
  scrollbars,
@@ -7383,9 +7504,9 @@ function useListRendering(param) {
7383
7504
 
7384
7505
  // src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
7385
7506
  import {
7386
- createElement as createElement30,
7507
+ createElement as createElement29,
7387
7508
  forwardRef as forwardRef3,
7388
- useCallback as useCallback18,
7509
+ useCallback as useCallback17,
7389
7510
  useRef as useRef18
7390
7511
  } from "react";
7391
7512
  import { useEffect as useEffect23 } from "react";
@@ -7426,7 +7547,7 @@ var enforceStyle = (node, style) => {
7426
7547
  var InfiniteTableLicenseFooter = forwardRef3(function InfiniteTableLicenseFooter2(props, ref) {
7427
7548
  const { rootClassName: rootClassName12 } = useInternalProps();
7428
7549
  const domRef = useRef18(null);
7429
- const domCallback = useCallback18((node) => {
7550
+ const domCallback = useCallback17((node) => {
7430
7551
  domRef.current = node;
7431
7552
  if (!ref) {
7432
7553
  return;
@@ -7451,12 +7572,12 @@ var InfiniteTableLicenseFooter = forwardRef3(function InfiniteTableLicenseFooter
7451
7572
  clearInterval(intervalId);
7452
7573
  };
7453
7574
  }, []);
7454
- return /* @__PURE__ */ createElement30("div", __spreadProps(__spreadValues({
7575
+ return /* @__PURE__ */ createElement29("div", __spreadProps(__spreadValues({
7455
7576
  ref: domCallback
7456
7577
  }, props), {
7457
7578
  className: join(`${rootClassName12}-Footer`, FooterCls, props.className),
7458
7579
  style: defaultStyle2
7459
- }), "Powered by", " ", /* @__PURE__ */ createElement30("a", {
7580
+ }), "Powered by", " ", /* @__PURE__ */ createElement29("a", {
7460
7581
  href: "https://infinite-table.com",
7461
7582
  rel: "noopener noreferrer",
7462
7583
  role: "link",
@@ -7465,7 +7586,7 @@ var InfiniteTableLicenseFooter = forwardRef3(function InfiniteTableLicenseFooter
7465
7586
  });
7466
7587
 
7467
7588
  // src/components/InfiniteTable/hooks/useLicense/useLicense.ts
7468
- import { useMemo as useMemo11 } from "react";
7589
+ import { useMemo as useMemo12 } from "react";
7469
7590
 
7470
7591
  // src/components/InfiniteTable/hooks/useLicense/crc32.ts
7471
7592
  var DEFAULT_ReversedPolynomial = 3988292384;
@@ -7615,10 +7736,10 @@ var origin = typeof window !== "undefined" ? window.location.origin : "";
7615
7736
  var [_fullUrl, protocol, sandboxUrl] = Array.from(SANDBOX_REGEX.exec(origin) || []);
7616
7737
  var isInsideSandbox = protocol === "https" && sandboxUrl === "sandpack.codesandbox.io";
7617
7738
  var useLicense = (licenseKey = "") => {
7618
- const valid = useMemo11(() => {
7739
+ const valid = useMemo12(() => {
7619
7740
  let valid2 = isValidLicense(licenseKey, {
7620
7741
  publishedAt: 1624970570587,
7621
- version: "0.2.0"
7742
+ version: "0.2.4"
7622
7743
  });
7623
7744
  if (!licenseKey && !valid2 && isInsideSandbox) {
7624
7745
  return true;
@@ -7630,8 +7751,8 @@ var useLicense = (licenseKey = "") => {
7630
7751
 
7631
7752
  // src/components/CSSVariableWatch.tsx
7632
7753
  import {
7633
- createElement as createElement31,
7634
- useCallback as useCallback19,
7754
+ createElement as createElement30,
7755
+ useCallback as useCallback18,
7635
7756
  useLayoutEffect as useLayoutEffect4
7636
7757
  } from "react";
7637
7758
  import { useRef as useRef19 } from "react";
@@ -7648,7 +7769,7 @@ var WRAPPER_STYLE = {
7648
7769
  };
7649
7770
  var useCSSVariableWatch = (params) => {
7650
7771
  const lastValueRef = useRef19(0);
7651
- const onResize = useCallback19(({ height }) => {
7772
+ const onResize = useCallback18(({ height }) => {
7652
7773
  if (height && height !== lastValueRef.current) {
7653
7774
  lastValueRef.current = height;
7654
7775
  params.onChange(height);
@@ -7671,11 +7792,11 @@ var CSSVariableWatch = (props) => {
7671
7792
  useCSSVariableWatch(__spreadProps(__spreadValues({}, props), {
7672
7793
  ref: domRef
7673
7794
  }));
7674
- return /* @__PURE__ */ createElement31("div", {
7795
+ return /* @__PURE__ */ createElement30("div", {
7675
7796
  "data-name": "css-variable-watcher",
7676
7797
  "data-var": props.varName,
7677
7798
  style: WRAPPER_STYLE
7678
- }, /* @__PURE__ */ createElement31("div", {
7799
+ }, /* @__PURE__ */ createElement30("div", {
7679
7800
  ref: domRef,
7680
7801
  style: {
7681
7802
  height: props.varName.startsWith("var(") ? props.varName : `var(${props.varName})`
@@ -7769,7 +7890,7 @@ function useDOMProps(initialDOMProps) {
7769
7890
 
7770
7891
  // src/components/InfiniteTable/components/LoadMask.tsx
7771
7892
  import {
7772
- createElement as createElement32,
7893
+ createElement as createElement31,
7773
7894
  memo as memo12
7774
7895
  } from "react";
7775
7896
 
@@ -7783,11 +7904,11 @@ var { rootClassName: rootClassName11 } = internalProps;
7783
7904
  var baseCls2 = `${rootClassName11}-LoadMask`;
7784
7905
  function LoadMaskFn(props) {
7785
7906
  const { visible, children = "Loading" } = props;
7786
- return /* @__PURE__ */ createElement32("div", {
7907
+ return /* @__PURE__ */ createElement31("div", {
7787
7908
  className: `${LoadMaskCls[visible ? "visible" : "hidden"]} ${baseCls2}`
7788
- }, /* @__PURE__ */ createElement32("div", {
7909
+ }, /* @__PURE__ */ createElement31("div", {
7789
7910
  className: `${LoadMaskOverlayCls} ${baseCls2}-Overlay`
7790
- }), /* @__PURE__ */ createElement32("div", {
7911
+ }), /* @__PURE__ */ createElement31("div", {
7791
7912
  className: `${LoadMaskTextCls} ${baseCls2}-Text`
7792
7913
  }, children));
7793
7914
  }
@@ -7820,7 +7941,8 @@ var InfiniteTableComponent = memo13(function InfiniteTableComponent2() {
7820
7941
  } = useInfiniteTable();
7821
7942
  const {
7822
7943
  componentState: { dataArray, loading },
7823
- getState: getDataSourceState
7944
+ getState: getDataSourceState,
7945
+ componentActions: dataSourceActions
7824
7946
  } = useDataSourceContextValue();
7825
7947
  const {
7826
7948
  domRef,
@@ -7833,7 +7955,8 @@ var InfiniteTableComponent = memo13(function InfiniteTableComponent2() {
7833
7955
  onHeaderHeightCSSVarChange,
7834
7956
  rowHeightCSSVar,
7835
7957
  headerHeightCSSVar,
7836
- components
7958
+ components,
7959
+ scrollStopDelay
7837
7960
  } = componentState;
7838
7961
  const { columnShifts, bodySize } = componentState;
7839
7962
  const {
@@ -7846,6 +7969,7 @@ var InfiniteTableComponent = memo13(function InfiniteTableComponent2() {
7846
7969
  scrollbars,
7847
7970
  applyScrollVertical,
7848
7971
  horizontalVirtualBrain,
7972
+ verticalVirtualBrain,
7849
7973
  reservedContentHeight
7850
7974
  } = useListRendering({
7851
7975
  getComputed,
@@ -7854,6 +7978,13 @@ var InfiniteTableComponent = memo13(function InfiniteTableComponent2() {
7854
7978
  bodySize,
7855
7979
  computed
7856
7980
  });
7981
+ useEffect24(() => {
7982
+ const dataSourceState = getDataSourceState();
7983
+ const onChange = debounce((renderRange) => {
7984
+ dataSourceState.notifyRenderRangeChange(renderRange);
7985
+ }, { wait: scrollStopDelay });
7986
+ return verticalVirtualBrain.onRenderRangeChange(onChange);
7987
+ }, [verticalVirtualBrain, scrollStopDelay]);
7857
7988
  const licenseValid = useLicense(licenseKey);
7858
7989
  const domProps = useDOMProps(componentState.domProps);
7859
7990
  const LoadMaskCmp = (_a = components == null ? void 0 : components.LoadMask) != null ? _a : LoadMask;
@@ -7866,31 +7997,34 @@ var InfiniteTableComponent = memo13(function InfiniteTableComponent2() {
7866
7997
  }
7867
7998
  notifyScrollbarsChange(scrollbars);
7868
7999
  }, [scrollbars]);
7869
- return /* @__PURE__ */ createElement33("div", __spreadValues({
8000
+ useEffect24(() => {
8001
+ dataSourceActions.scrollStopDelayUpdatedByTable = scrollStopDelay;
8002
+ }, [scrollStopDelay]);
8003
+ return /* @__PURE__ */ createElement32("div", __spreadValues({
7870
8004
  ref: domRef
7871
- }, domProps), header ? /* @__PURE__ */ createElement33(TableHeaderWrapper, {
8005
+ }, domProps), header ? /* @__PURE__ */ createElement32(TableHeaderWrapper, {
7872
8006
  brain: horizontalVirtualBrain,
7873
8007
  repaintId,
7874
8008
  scrollbars
7875
- }) : null, /* @__PURE__ */ createElement33(InfiniteTableBody, null, /* @__PURE__ */ createElement33(VirtualScrollContainer, {
8009
+ }) : null, /* @__PURE__ */ createElement32(InfiniteTableBody, null, /* @__PURE__ */ createElement32(VirtualScrollContainer, {
7876
8010
  ref: scrollerDOMRef,
7877
8011
  onContainerScroll: applyScrollVertical,
7878
8012
  scrollable: ONLY_VERTICAL_SCROLLBAR
7879
- }, /* @__PURE__ */ createElement33("div", {
8013
+ }, /* @__PURE__ */ createElement32("div", {
7880
8014
  className: display.flex
7881
- }, pinnedStartList, centerList, pinnedEndList), /* @__PURE__ */ createElement33(SpacePlaceholder, {
8015
+ }, pinnedStartList, centerList, pinnedEndList), /* @__PURE__ */ createElement32(SpacePlaceholder, {
7882
8016
  count: dataArray.length,
7883
8017
  width: 0,
7884
8018
  height: reservedContentHeight
7885
- })), pinnedStartScrollbarPlaceholder, pinnedEndScrollbarPlaceholder, /* @__PURE__ */ createElement33(LoadMaskCmp, {
8019
+ })), pinnedStartScrollbarPlaceholder, pinnedEndScrollbarPlaceholder, /* @__PURE__ */ createElement32(LoadMaskCmp, {
7886
8020
  visible: loading
7887
- }, loadingText)), licenseValid ? null : /* @__PURE__ */ createElement33(InfiniteTableLicenseFooter, null), /* @__PURE__ */ createElement33("div", {
8021
+ }, loadingText)), licenseValid ? null : /* @__PURE__ */ createElement32(InfiniteTableLicenseFooter, null), /* @__PURE__ */ createElement32("div", {
7888
8022
  ref: portalDOMRef,
7889
8023
  className: join(`${rootClassName}Portal`, zIndex[1e3], position.absolute, top[0], left[0])
7890
- }), rowHeightCSSVar ? /* @__PURE__ */ createElement33(CSSVariableWatch, {
8024
+ }), rowHeightCSSVar ? /* @__PURE__ */ createElement32(CSSVariableWatch, {
7891
8025
  varName: rowHeightCSSVar,
7892
8026
  onChange: onRowHeightCSSVarChange
7893
- }) : null, headerHeightCSSVar ? /* @__PURE__ */ createElement33(CSSVariableWatch, {
8027
+ }) : null, headerHeightCSSVar ? /* @__PURE__ */ createElement32(CSSVariableWatch, {
7894
8028
  varName: headerHeightCSSVar,
7895
8029
  onChange: onHeaderHeightCSSVarChange
7896
8030
  }) : null);
@@ -7938,13 +8072,13 @@ function InfiniteTableContextProvider() {
7938
8072
  }
7939
8073
  }, [scrollTopId, scrollerDOMRef]);
7940
8074
  const TableContext2 = getInfiniteTableContext();
7941
- return /* @__PURE__ */ createElement33(TableContext2.Provider, {
8075
+ return /* @__PURE__ */ createElement32(TableContext2.Provider, {
7942
8076
  value: contextValue
7943
- }, /* @__PURE__ */ createElement33(InfiniteTableComponent, null));
8077
+ }, /* @__PURE__ */ createElement32(InfiniteTableComponent, null));
7944
8078
  }
7945
8079
  function InfiniteTable(props) {
7946
- const table = /* @__PURE__ */ createElement33(InfiniteTableRoot, __spreadValues({}, props), /* @__PURE__ */ createElement33(InfiniteTableContextProvider, null));
7947
- return /* @__PURE__ */ createElement33(StrictMode, null, table);
8080
+ const table = /* @__PURE__ */ createElement32(InfiniteTableRoot, __spreadValues({}, props), /* @__PURE__ */ createElement32(InfiniteTableContextProvider, null));
8081
+ return /* @__PURE__ */ createElement32(StrictMode, null, table);
7948
8082
  }
7949
8083
  InfiniteTable.defaultProps = {
7950
8084
  rowHeight: 40,