@infinite-table/infinite-react 0.2.3 → 0.2.7

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 +28 -13
  2. package/index.esm.js +189 -90
  3. package/index.js +173 -74
  4. package/package.json +2 -2
package/index.esm.js CHANGED
@@ -856,6 +856,7 @@ var mapPropsToState = (params) => {
856
856
  });
857
857
  const computedColumns = state.columnsWhenGrouping || state.columnsWhenInlineGroupRenderStrategy || state.columns;
858
858
  return {
859
+ controlledColumnVisibility: !!props.columnVisibility,
859
860
  groupRenderStrategy,
860
861
  groupBy,
861
862
  computedColumns,
@@ -1389,6 +1390,7 @@ var getComputedVisibleColumns = ({
1389
1390
  const result2 = __spreadProps(__spreadValues({
1390
1391
  align: colType.align,
1391
1392
  verticalAlign: colType.verticalAlign,
1393
+ defaultHiddenWhenGroupedBy: colType.defaultHiddenWhenGroupedBy,
1392
1394
  valueGetter: colType.valueGetter,
1393
1395
  renderValue: colType.renderValue,
1394
1396
  render: colType.render
@@ -1647,7 +1649,7 @@ var useComputedVisibleColumns = ({
1647
1649
  var sortAscending = (a, b) => a - b;
1648
1650
 
1649
1651
  // src/components/InfiniteTable/hooks/useComputed.ts
1650
- import { useCallback as useCallback5, useEffect as useEffect10, useState as useState5 } from "react";
1652
+ import { useCallback as useCallback5, useEffect as useEffect10, useMemo as useMemo6, useState as useState5 } from "react";
1651
1653
 
1652
1654
  // src/components/hooks/useComponentState.tsx
1653
1655
  import {
@@ -2855,6 +2857,7 @@ function getEnhancedGroupData(options, deepMapValue) {
2855
2857
  id: `${groupKeys}`,
2856
2858
  collapsed,
2857
2859
  parents,
2860
+ flatRowInfoList: [],
2858
2861
  collapsedChildrenCount: 0,
2859
2862
  collapsedGroupsCount: 0,
2860
2863
  indexInParentGroups: options.indexInParentGroups,
@@ -2917,9 +2920,14 @@ function enhancedFlatten(param) {
2917
2920
  }
2918
2921
  if (collapsed) {
2919
2922
  parents.forEach((parent) => {
2923
+ parent.flatRowInfoList.push(enhancedGroupData);
2920
2924
  parent.collapsedChildrenCount += enhancedGroupData.groupCount;
2921
2925
  parent.collapsedGroupsCount += 1;
2922
2926
  });
2927
+ } else {
2928
+ parents.forEach((parent) => {
2929
+ parent.flatRowInfoList.push(enhancedGroupData);
2930
+ });
2923
2931
  }
2924
2932
  indexInParentGroups.push(indexInGroup);
2925
2933
  parents.push(enhancedGroupData);
@@ -3025,7 +3033,7 @@ function buildDataSourceDataParams(componentState, overrides) {
3025
3033
  dataSourceParams.livePaginationCursor = componentState.livePaginationCursor;
3026
3034
  dataSourceParams.cursorId = componentState.cursorId;
3027
3035
  }
3028
- if (componentState.fullLazyLoad) {
3036
+ if (componentState.lazyLoad) {
3029
3037
  if (componentState.lazyLoadBatchSize != null && componentState.lazyLoadBatchSize > 0) {
3030
3038
  dataSourceParams.lazyLoadBatchSize = componentState.lazyLoadBatchSize;
3031
3039
  dataSourceParams.lazyLoadStartIndex = 0;
@@ -3050,9 +3058,9 @@ function buildDataSourceDataParams(componentState, overrides) {
3050
3058
  }
3051
3059
  function loadData(data, componentState, actions, overrides) {
3052
3060
  const dataParams = buildDataSourceDataParams(componentState, overrides);
3053
- if (componentState.fullLazyLoad && dataParams.groupKeys) {
3061
+ if (componentState.lazyLoad) {
3054
3062
  const lazyGroupData = componentState.originalLazyGroupData;
3055
- const key = [LAZY_ROOT_KEY_FOR_GROUPS, ...dataParams.groupKeys];
3063
+ const key = [LAZY_ROOT_KEY_FOR_GROUPS, ...dataParams.groupKeys || []];
3056
3064
  const existingGroupRowInfo = lazyGroupData.get(key);
3057
3065
  if (existingGroupRowInfo && existingGroupRowInfo.cache) {
3058
3066
  const items = existingGroupRowInfo.items;
@@ -3073,7 +3081,7 @@ function loadData(data, componentState, actions, overrides) {
3073
3081
  data = data(dataParams);
3074
3082
  }
3075
3083
  const dataIsPromise = typeof data === "object" && typeof data.then === "function";
3076
- if (dataIsPromise && !componentState.fullLazyLoad) {
3084
+ if (dataIsPromise && !componentState.lazyLoad) {
3077
3085
  actions.loading = true;
3078
3086
  }
3079
3087
  return Promise.resolve(data).then((dataParam) => {
@@ -3089,9 +3097,9 @@ function loadData(data, componentState, actions, overrides) {
3089
3097
  if (remoteData.mappings) {
3090
3098
  actions.pivotMappings = remoteData.mappings;
3091
3099
  }
3092
- if (componentState.fullLazyLoad && dataParams.groupKeys) {
3100
+ if (componentState.lazyLoad) {
3093
3101
  const lazyGroupData = componentState.originalLazyGroupData;
3094
- const key = [LAZY_ROOT_KEY_FOR_GROUPS, ...dataParams.groupKeys];
3102
+ const key = [LAZY_ROOT_KEY_FOR_GROUPS, ...dataParams.groupKeys || []];
3095
3103
  const newGroupRowInfo = {
3096
3104
  cache: !!remoteData.cache,
3097
3105
  totalCount: (_a = remoteData.totalCount) != null ? _a : dataArray.length,
@@ -3121,6 +3129,10 @@ function loadData(data, componentState, actions, overrides) {
3121
3129
  }
3122
3130
  skipAssign = true;
3123
3131
  actions.originalLazyGroupDataChangeDetect = getChangeDetect();
3132
+ if (!dataParams.groupKeys || !dataParams.groupKeys.length) {
3133
+ const topLevelItems = lazyGroupData.get([LAZY_ROOT_KEY_FOR_GROUPS]);
3134
+ actions.originalDataArray = [...topLevelItems.items];
3135
+ }
3124
3136
  }
3125
3137
  } else {
3126
3138
  dataArray = dataParam;
@@ -3128,7 +3140,7 @@ function loadData(data, componentState, actions, overrides) {
3128
3140
  if (!skipAssign) {
3129
3141
  actions.originalDataArray = dataArray;
3130
3142
  }
3131
- if (dataIsPromise && !componentState.fullLazyLoad) {
3143
+ if (dataIsPromise && !componentState.lazyLoad) {
3132
3144
  actions.loading = false;
3133
3145
  }
3134
3146
  });
@@ -3286,27 +3298,27 @@ function lazyLoadRange(options, cache) {
3286
3298
  const cacheKeys = theGroupKeys.length ? theGroupKeys : rootGroupKeys;
3287
3299
  const indexInGroup = rowInfo.indexInGroup;
3288
3300
  if (!rowLoaded) {
3289
- let fnCalls = perGroupFnCalls.get(cacheKeys);
3301
+ let cachedFnCalls = perGroupFnCalls.get(cacheKeys);
3290
3302
  const batchStartIndexInGroup = Math.floor(indexInGroup / lazyLoadBatchSize) * lazyLoadBatchSize;
3291
3303
  const offset = rowInfo.indexInGroup - batchStartIndexInGroup;
3292
3304
  const absoluteIndexOfBatchStart = dataArray[rowInfo.indexInAll - offset].indexInAll;
3293
3305
  const batchStartRowLoaded = isRowLoaded(absoluteIndexOfBatchStart);
3294
3306
  const batchStartRowId = dataArray[absoluteIndexOfBatchStart].id;
3295
- if (batchStartRowLoaded || (fnCalls == null ? void 0 : fnCalls[batchStartRowId])) {
3307
+ if (batchStartRowLoaded || (cachedFnCalls == null ? void 0 : cachedFnCalls[batchStartRowId])) {
3296
3308
  continue;
3297
3309
  }
3298
- const shouldSetFnCalls = !fnCalls;
3299
- fnCalls = fnCalls || {};
3310
+ const shouldSetFnCalls = !cachedFnCalls;
3311
+ cachedFnCalls = cachedFnCalls || {};
3300
3312
  const currentFnCall = {
3301
3313
  lazyLoadStartIndex: batchStartIndexInGroup,
3302
3314
  lazyLoadBatchSize,
3303
3315
  groupKeys: theGroupKeys
3304
3316
  };
3305
- if (!fnCalls[batchStartRowId]) {
3306
- fnCalls[batchStartRowId] = currentFnCall;
3317
+ if (!cachedFnCalls[batchStartRowId]) {
3318
+ cachedFnCalls[batchStartRowId] = currentFnCall;
3307
3319
  }
3308
3320
  if (shouldSetFnCalls) {
3309
- perGroupFnCalls.set(cacheKeys, fnCalls);
3321
+ perGroupFnCalls.set(cacheKeys, cachedFnCalls);
3310
3322
  }
3311
3323
  }
3312
3324
  }
@@ -3563,12 +3575,11 @@ function getCompareObjectForDataParams(dataParams) {
3563
3575
  var forwardProps3 = (setupState) => {
3564
3576
  return {
3565
3577
  onDataParamsChange: (fn) => fn ? discardCallsWithEqualArg(fn, 100, getCompareObjectForDataParams) : void 0,
3566
- fullLazyLoad: 1,
3578
+ lazyLoad: (lazyLoad) => !!lazyLoad,
3567
3579
  data: 1,
3568
3580
  pivotBy: 1,
3569
3581
  primaryKey: 1,
3570
3582
  livePagination: 1,
3571
- lazyLoadBatchSize: (lazyLoadBatchSize) => lazyLoadBatchSize != null ? lazyLoadBatchSize : -1,
3572
3583
  aggregationReducers: 1,
3573
3584
  collapseGroupRowsOnDataFunctionChange: (collapseGroupRowsOnDataFunctionChange) => collapseGroupRowsOnDataFunctionChange != null ? collapseGroupRowsOnDataFunctionChange : true,
3574
3585
  loading: (loading) => loading != null ? loading : false,
@@ -3595,7 +3606,8 @@ function mapPropsToState2(params) {
3595
3606
  const controlledSort = isControlledValue(props.sortInfo);
3596
3607
  const result = {
3597
3608
  controlledSort,
3598
- multiSort: Array.isArray(controlledSort ? props.sortInfo : props.defaultSortInfo)
3609
+ multiSort: Array.isArray(controlledSort ? props.sortInfo : props.defaultSortInfo),
3610
+ lazyLoadBatchSize: typeof props.lazyLoad === "object" ? props.lazyLoad.batchSize : void 0
3599
3611
  };
3600
3612
  if (props.livePagination) {
3601
3613
  const dataArrayChanged = !oldState || oldState.originalDataArray !== state.originalDataArray;
@@ -3608,7 +3620,7 @@ var debugFullLazyLoad = dbg("DataSource:fullLazyLoad");
3608
3620
  function onPropChange(params, props, actions) {
3609
3621
  const { name, newValue } = params;
3610
3622
  if (name === "data" && typeof newValue === "function" && !props.groupRowsState) {
3611
- if (props.fullLazyLoad) {
3623
+ if (props.lazyLoad) {
3612
3624
  debugFullLazyLoad(`"data" function prop has changed`);
3613
3625
  }
3614
3626
  if (props.collapseGroupRowsOnDataFunctionChange !== false) {
@@ -3875,17 +3887,29 @@ function concludeReducer(params) {
3875
3887
  var _a;
3876
3888
  const { state, previousState } = params;
3877
3889
  const sortInfo = state.sortInfo;
3878
- const shouldSort = !!(sortInfo == null ? void 0 : sortInfo.length) && !state.controlledSort;
3879
- const originalDataArrayChanged = haveDepsChanged(previousState, state, [
3890
+ let shouldSort = !!(sortInfo == null ? void 0 : sortInfo.length) && !state.controlledSort;
3891
+ if (state.lazyLoad || state.livePagination) {
3892
+ shouldSort = false;
3893
+ }
3894
+ let originalDataArrayChanged = haveDepsChanged(previousState, state, [
3880
3895
  "originalDataArray"
3881
3896
  ]);
3897
+ const dataSourceChange = previousState && state.data !== previousState.data;
3898
+ let lazyLoadGroupDataChange = state.lazyLoad && previousState && (previousState.groupBy !== state.groupBy || previousState.sortInfo !== state.sortInfo);
3899
+ if (dataSourceChange) {
3900
+ lazyLoadGroupDataChange = true;
3901
+ }
3902
+ if (lazyLoadGroupDataChange) {
3903
+ state.originalLazyGroupData = new DeepMap();
3904
+ originalDataArrayChanged = true;
3905
+ }
3882
3906
  const sortInfoChanged = haveDepsChanged(previousState, state, ["sortInfo"]);
3883
3907
  const sortDepsChanged = originalDataArrayChanged || sortInfoChanged;
3884
3908
  const shouldSortAgain = shouldSort && (sortDepsChanged || !state.lastSortDataArray);
3885
3909
  const groupBy = state.groupBy;
3886
3910
  const pivotBy = state.pivotBy;
3887
3911
  const shouldGroup = groupBy.length || pivotBy;
3888
- const groupsDepsChanged = haveDepsChanged(previousState, state, [
3912
+ const groupsDepsChanged = originalDataArrayChanged || haveDepsChanged(previousState, state, [
3889
3913
  "generateGroupRows",
3890
3914
  "originalDataArray",
3891
3915
  "originalLazyGroupData",
@@ -3918,7 +3942,7 @@ function concludeReducer(params) {
3918
3942
  };
3919
3943
  if (shouldGroup) {
3920
3944
  if (shouldGroupAgain) {
3921
- const groupResult = state.fullLazyLoad ? lazyGroup({
3945
+ const groupResult = state.lazyLoad ? lazyGroup({
3922
3946
  groupBy,
3923
3947
  pivot: pivotBy,
3924
3948
  mappings: state.pivotMappings,
@@ -3955,7 +3979,7 @@ function concludeReducer(params) {
3955
3979
  state.groupDeepMap = void 0;
3956
3980
  state.pivotColumns = void 0;
3957
3981
  const arrayDifferentAfterSortStep = previousState.postSortDataArray != state.postSortDataArray;
3958
- if (arrayDifferentAfterSortStep) {
3982
+ if (arrayDifferentAfterSortStep || groupsDepsChanged) {
3959
3983
  rowInfoDataArray = dataArray.map((data, index) => toRowInfo(data, data ? toPrimaryKey(data) : index, index));
3960
3984
  }
3961
3985
  }
@@ -4027,7 +4051,7 @@ function useToggleGroupRow() {
4027
4051
  const newState = new GroupRowsState(state.groupRowsState);
4028
4052
  newState.toggleGroupRow(groupKeys);
4029
4053
  dataSourceActions.groupRowsState = newState;
4030
- if (state.fullLazyLoad && newState.isGroupRowExpanded(groupKeys)) {
4054
+ if (state.lazyLoad && newState.isGroupRowExpanded(groupKeys)) {
4031
4055
  loadData(state.data, state, dataSourceActions, {
4032
4056
  groupKeys
4033
4057
  });
@@ -4066,7 +4090,7 @@ function useColumnsWhen() {
4066
4090
  }, [pivotTotalColumnPosition]);
4067
4091
  useColumnsWhenInlineGroupRenderStrategy(groupByMap);
4068
4092
  const { toggleGroupRow } = useColumnsWhenGrouping();
4069
- useHideEmptyGroupColumns();
4093
+ useHideColumns(groupByMap);
4070
4094
  return { toggleGroupRow };
4071
4095
  }
4072
4096
  function useColumnsWhenInlineGroupRenderStrategy(groupByMap) {
@@ -4188,9 +4212,10 @@ function useColumnsWhenGrouping() {
4188
4212
  ]);
4189
4213
  return { toggleGroupRow };
4190
4214
  }
4191
- function useHideEmptyGroupColumns() {
4215
+ function useHideColumns(groupByMap) {
4192
4216
  const {
4193
4217
  componentState: {
4218
+ dataArray,
4194
4219
  groupBy,
4195
4220
  groupRowsState,
4196
4221
  originalLazyGroupDataChangeDetect
@@ -4201,18 +4226,49 @@ function useHideEmptyGroupColumns() {
4201
4226
  getComponentState,
4202
4227
  componentActions,
4203
4228
  componentState: {
4204
- columnsWhenGrouping: generatedColumns,
4229
+ columnTypes,
4230
+ computedColumns,
4205
4231
  hideEmptyGroupColumns,
4206
4232
  groupRenderStrategy
4207
4233
  }
4208
4234
  } = useComponentState();
4235
+ const prevHideEmptyGroupColumns = usePrevious(hideEmptyGroupColumns);
4209
4236
  useEffect9(() => {
4210
4237
  if (groupRenderStrategy !== "multi-column") {
4211
4238
  return;
4212
4239
  }
4240
+ const currentState = getComponentState();
4241
+ const computedGroupColumns = new Map();
4242
+ computedColumns.forEach((column, colId) => {
4243
+ if (typeof column.groupByField !== "string") {
4244
+ return;
4245
+ }
4246
+ const { groupByField } = column;
4247
+ const field = groupByField;
4248
+ const groupInfoForColumn = groupByMap.get(field);
4249
+ if (!groupInfoForColumn) {
4250
+ return;
4251
+ }
4252
+ computedGroupColumns.set(colId, column);
4253
+ });
4254
+ if (!hideEmptyGroupColumns) {
4255
+ if (prevHideEmptyGroupColumns) {
4256
+ let updated2 = false;
4257
+ const columnVisibility2 = __spreadValues({}, currentState.columnVisibility);
4258
+ computedGroupColumns.forEach((_column, colId) => {
4259
+ if (columnVisibility2[colId] === false) {
4260
+ updated2 = true;
4261
+ delete columnVisibility2[colId];
4262
+ }
4263
+ });
4264
+ if (updated2) {
4265
+ componentActions.columnVisibility = columnVisibility2;
4266
+ }
4267
+ }
4268
+ return;
4269
+ }
4213
4270
  const groupsLength = groupBy.length;
4214
4271
  let expandedGroupsLevel = 0;
4215
- const { dataArray } = getDataSourceState();
4216
4272
  const len = dataArray.length;
4217
4273
  for (let i = 0; i < len; i++) {
4218
4274
  const data = dataArray[i];
@@ -4221,23 +4277,24 @@ function useHideEmptyGroupColumns() {
4221
4277
  break;
4222
4278
  }
4223
4279
  }
4224
- const currentState = getComponentState();
4225
- const { computedColumns } = currentState;
4226
4280
  let updated = false;
4227
4281
  const columnVisibility = __spreadValues({}, currentState.columnVisibility);
4228
- const cols = computedColumns;
4229
- groupBy.forEach(({ field, column: groupColumn }, index) => {
4230
- const colId = (groupColumn == null ? void 0 : groupColumn.id) || `group-by-${field}`;
4231
- let col = cols.get(colId);
4232
- if (!col) {
4233
- return;
4234
- }
4282
+ computedGroupColumns.forEach((column, colId) => {
4283
+ const { groupByField } = column;
4284
+ const field = groupByField;
4285
+ const groupInfoForColumn = groupByMap.get(field);
4286
+ const index = groupInfoForColumn.groupIndex;
4235
4287
  const shouldBeHidden = index > expandedGroupsLevel && hideEmptyGroupColumns;
4236
- updated = true;
4237
4288
  if (shouldBeHidden) {
4238
- columnVisibility[colId] = false;
4289
+ if (columnVisibility[colId] !== false) {
4290
+ updated = true;
4291
+ columnVisibility[colId] = false;
4292
+ }
4239
4293
  } else {
4240
- delete columnVisibility[colId];
4294
+ if (columnVisibility.hasOwnProperty(colId)) {
4295
+ updated = true;
4296
+ delete columnVisibility[colId];
4297
+ }
4241
4298
  }
4242
4299
  });
4243
4300
  if (updated) {
@@ -4246,12 +4303,41 @@ function useHideEmptyGroupColumns() {
4246
4303
  }, [
4247
4304
  getDataSourceState,
4248
4305
  groupRenderStrategy,
4249
- generatedColumns,
4250
4306
  originalLazyGroupDataChangeDetect,
4251
4307
  groupBy,
4308
+ groupByMap,
4309
+ computedColumns,
4310
+ hideEmptyGroupColumns ? dataArray : null,
4252
4311
  hideEmptyGroupColumns ? groupRowsState : null,
4253
4312
  hideEmptyGroupColumns
4254
4313
  ]);
4314
+ useEffect9(() => {
4315
+ const isGrouped = groupBy.length > 0;
4316
+ const currentState = getComponentState();
4317
+ const { controlledColumnVisibility, columnVisibility } = currentState;
4318
+ if (controlledColumnVisibility) {
4319
+ return;
4320
+ }
4321
+ const newColumnVisibility = __spreadValues({}, columnVisibility);
4322
+ let updated = false;
4323
+ computedColumns.forEach((col, id) => {
4324
+ if (col.defaultHiddenWhenGroupedBy) {
4325
+ const nowHidden = columnVisibility[id] === false;
4326
+ const shouldBeHidden = col.defaultHiddenWhenGroupedBy === "*" && isGrouped || typeof col.defaultHiddenWhenGroupedBy === "string" && groupByMap.get(col.defaultHiddenWhenGroupedBy) || typeof col.defaultHiddenWhenGroupedBy === "object" && Object.keys(col.defaultHiddenWhenGroupedBy).reduce((acc, field) => acc || groupByMap.has(field), false);
4327
+ if (nowHidden !== shouldBeHidden) {
4328
+ updated = true;
4329
+ if (shouldBeHidden) {
4330
+ newColumnVisibility[id] = false;
4331
+ } else {
4332
+ delete newColumnVisibility[id];
4333
+ }
4334
+ }
4335
+ }
4336
+ });
4337
+ if (updated) {
4338
+ componentActions.columnVisibility = newColumnVisibility;
4339
+ }
4340
+ }, [computedColumns, columnTypes, groupBy, groupByMap]);
4255
4341
  }
4256
4342
  function getColumnsWhenGrouping(params) {
4257
4343
  const {
@@ -4400,6 +4486,32 @@ function useComputed() {
4400
4486
  columnSizing,
4401
4487
  columnTypes
4402
4488
  });
4489
+ const rowSpan = useMemo6(() => {
4490
+ const colsWithRowspan = computedVisibleColumns.filter((col) => typeof col.rowspan === "function");
4491
+ return colsWithRowspan.length ? ({ itemIndex }) => {
4492
+ let maxSpan = 1;
4493
+ const dataArray = getDataSourceState().dataArray;
4494
+ const rowInfo = dataArray[itemIndex];
4495
+ const data = rowInfo.data;
4496
+ colsWithRowspan.forEach((column) => {
4497
+ if (!column.rowspan) {
4498
+ return;
4499
+ }
4500
+ const span = column.rowspan({
4501
+ column,
4502
+ data,
4503
+ dataArray,
4504
+ groupRowInfo: null,
4505
+ rowInfo,
4506
+ rowIndex: itemIndex
4507
+ });
4508
+ if (span > maxSpan) {
4509
+ maxSpan = span;
4510
+ }
4511
+ });
4512
+ return maxSpan;
4513
+ } : void 0;
4514
+ }, [computedVisibleColumns]);
4403
4515
  const unpinnedColumnWidths = computedUnpinnedColumns.map((c) => c.computedWidth);
4404
4516
  let sortedUnpinnedColumnWidths = [...unpinnedColumnWidths].sort(sortAscending);
4405
4517
  let unpinnedColumnRenderCount = 0;
@@ -4426,6 +4538,7 @@ function useComputed() {
4426
4538
  const computedPinnedStartOverflow = computedPinnedStartWidth ? computedPinnedStartColumnsWidth > computedPinnedStartWidth : false;
4427
4539
  const computedPinnedEndOverflow = computedPinnedEndWidth ? computedPinnedEndColumnsWidth > computedPinnedEndWidth : false;
4428
4540
  return {
4541
+ rowSpan,
4429
4542
  toggleGroupRow,
4430
4543
  computedPinnedStartOverflow,
4431
4544
  computedPinnedEndOverflow,
@@ -4617,7 +4730,7 @@ var InfiniteTableCell = memo3(InfiniteTableCellFn);
4617
4730
  var import_binary_search = __toModule(require_binary_search());
4618
4731
  import {
4619
4732
  useCallback as useCallback6,
4620
- useMemo as useMemo6,
4733
+ useMemo as useMemo7,
4621
4734
  useRef as useRef7,
4622
4735
  useState as useState6
4623
4736
  } from "react";
@@ -4664,8 +4777,8 @@ var useColumnPointerEvents = ({
4664
4777
  const dragging = draggingDiff != null;
4665
4778
  const { componentActions, computed } = useInfiniteTable();
4666
4779
  const { computedColumnOrder } = computed;
4667
- const column = useMemo6(() => columns.get(columnId), [columnId, columns]);
4668
- const { columnIndex, columnWidth, columnsArray } = useMemo6(() => {
4780
+ const column = useMemo7(() => columns.get(columnId), [columnId, columns]);
4781
+ const { columnIndex, columnWidth, columnsArray } = useMemo7(() => {
4669
4782
  const columnsArray2 = Array.from(columns.values());
4670
4783
  return {
4671
4784
  columnsArray: columnsArray2,
@@ -5002,7 +5115,7 @@ function AvoidReactDiffFn(props) {
5002
5115
  var AvoidReactDiff = memo4(AvoidReactDiffFn);
5003
5116
 
5004
5117
  // src/components/RawList/useVirtualRenderer.ts
5005
- import { useMemo as useMemo7 } from "react";
5118
+ import { useMemo as useMemo8 } from "react";
5006
5119
 
5007
5120
  // src/components/RawList/ReactVirtualRenderer.tsx
5008
5121
  import {
@@ -5318,7 +5431,7 @@ function createRenderer(brain) {
5318
5431
  function useVirtualRenderer({
5319
5432
  brain
5320
5433
  }) {
5321
- return useMemo7(() => {
5434
+ return useMemo8(() => {
5322
5435
  return createRenderer(brain);
5323
5436
  }, [brain]);
5324
5437
  }
@@ -5410,7 +5523,7 @@ var InfiniteTableHeader = memo6(InfiniteTableHeaderFn);
5410
5523
  import {
5411
5524
  createElement as createElement17,
5412
5525
  memo as memo7,
5413
- useMemo as useMemo8,
5526
+ useMemo as useMemo9,
5414
5527
  useRef as useRef10
5415
5528
  } from "react";
5416
5529
 
@@ -5624,7 +5737,7 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
5624
5737
  } = useInfiniteTable();
5625
5738
  const domRef = useRef10(null);
5626
5739
  const hasColumnGroups = computedColumnGroups.size > 0;
5627
- const columnHeaderGroups = useMemo8(() => {
5740
+ const columnHeaderGroups = useMemo9(() => {
5628
5741
  return hasColumnGroups ? renderColumnHeaderGroups({
5629
5742
  columnGroups: computedColumnGroups,
5630
5743
  columnGroupsDepthsMap,
@@ -5861,7 +5974,7 @@ function SpacePlaceholderFn(props) {
5861
5974
  var SpacePlaceholder = memo8(SpacePlaceholderFn);
5862
5975
 
5863
5976
  // src/components/InfiniteTable/hooks/useListRendering.tsx
5864
- import { useEffect as useEffect22, useMemo as useMemo11, useRef as useRef17 } from "react";
5977
+ import { useEffect as useEffect22, useMemo as useMemo12, useRef as useRef17 } from "react";
5865
5978
 
5866
5979
  // src/components/InfiniteTable/hooks/useUnpinnedRendering.tsx
5867
5980
  import {
@@ -6144,7 +6257,8 @@ function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStra
6144
6257
  showHoverRows = false,
6145
6258
  rowIndex,
6146
6259
  domRef: domRefFromProps,
6147
- rowInfo
6260
+ rowInfo,
6261
+ rowSpan
6148
6262
  } = props;
6149
6263
  const domRef = useRef13(null);
6150
6264
  const rowDOMRef = useCallback10((node) => {
@@ -6164,7 +6278,7 @@ function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStra
6164
6278
  if (rowStyle) {
6165
6279
  style = typeof rowStyle === "function" ? __spreadValues(__spreadValues({}, style), rowStyle(rowPropsAndStyleArgs)) : __spreadValues(__spreadValues({}, style), rowStyle);
6166
6280
  }
6167
- if (inlineGroupRoot) {
6281
+ if (inlineGroupRoot || rowSpan) {
6168
6282
  style = style || {};
6169
6283
  style.zIndex = 2e6 - rowInfo.indexInAll;
6170
6284
  }
@@ -6351,6 +6465,7 @@ function useUnpinnedRendering(params) {
6351
6465
  computedPinnedStartWidth,
6352
6466
  computedPinnedEndWidth,
6353
6467
  computedUnpinnedColumns,
6468
+ rowSpan,
6354
6469
  getState
6355
6470
  } = params;
6356
6471
  const { virtualizeColumns } = getState();
@@ -6364,6 +6479,7 @@ function useUnpinnedRendering(params) {
6364
6479
  showZebraRows,
6365
6480
  showHoverRows,
6366
6481
  getData,
6482
+ rowSpan,
6367
6483
  toggleGroupRow,
6368
6484
  virtualizeColumns: shouldVirtualizeColumns,
6369
6485
  brain: null,
@@ -6380,6 +6496,7 @@ function useUnpinnedRendering(params) {
6380
6496
  }, [
6381
6497
  repaintId,
6382
6498
  rowHeight,
6499
+ rowSpan,
6383
6500
  computedUnpinnedColumns,
6384
6501
  computedUnpinnedColumnsWidth,
6385
6502
  shouldVirtualizeColumns,
@@ -6545,7 +6662,7 @@ var useOnContainerScroll = ({
6545
6662
  // src/components/InfiniteTable/hooks/usePinnedRendering.tsx
6546
6663
  import {
6547
6664
  createElement as createElement28,
6548
- useMemo as useMemo9
6665
+ useMemo as useMemo10
6549
6666
  } from "react";
6550
6667
  import { useCallback as useCallback15 } from "react";
6551
6668
 
@@ -6651,7 +6768,7 @@ function PinnedRowsContainer(props) {
6651
6768
  brain,
6652
6769
  renderRow
6653
6770
  } = props;
6654
- const style = useMemo9(() => {
6771
+ const style = useMemo10(() => {
6655
6772
  const result = pinning === "end" ? {
6656
6773
  width: rowWidth,
6657
6774
  height,
@@ -6707,7 +6824,7 @@ function PinnedRowsContainer(props) {
6707
6824
  return /* @__PURE__ */ createElement28(RowListWithExternalScrolling, __spreadValues({}, rowListProps));
6708
6825
  }
6709
6826
  function useRenderPinnedRow(params) {
6710
- const { getData, getState, columnsWidth, columns, verticalBrain } = params;
6827
+ const { getData, getState, columnsWidth, columns, rowSpan, verticalBrain } = params;
6711
6828
  const renderPinnedRow = useCallback15((rowParams) => {
6712
6829
  const dataArray = getData();
6713
6830
  const rowInfo = dataArray[rowParams.rowIndex];
@@ -6721,6 +6838,7 @@ function useRenderPinnedRow(params) {
6721
6838
  virtualizeColumns: false,
6722
6839
  verticalBrain,
6723
6840
  brain: null,
6841
+ rowSpan,
6724
6842
  rowWidth: columnsWidth,
6725
6843
  columns
6726
6844
  }, rowParams);
@@ -6745,6 +6863,7 @@ function usePinnedRenderingForSide(side, params) {
6745
6863
  computedPinnedStartOverflow,
6746
6864
  pinnedStartScrollListener,
6747
6865
  pinnedEndScrollListener,
6866
+ rowSpan,
6748
6867
  repaintId,
6749
6868
  toggleGroupRow,
6750
6869
  scrollbars: {
@@ -6763,6 +6882,7 @@ function usePinnedRenderingForSide(side, params) {
6763
6882
  getData,
6764
6883
  getState,
6765
6884
  toggleGroupRow,
6885
+ rowSpan,
6766
6886
  verticalBrain: verticalVirtualBrain,
6767
6887
  columns,
6768
6888
  columnsWidth
@@ -6825,9 +6945,9 @@ function usePinnedStartRendering(params) {
6825
6945
  import { useEffect as useEffect21 } from "react";
6826
6946
 
6827
6947
  // src/components/hooks/useOnce.ts
6828
- import { useMemo as useMemo10 } from "react";
6948
+ import { useMemo as useMemo11 } from "react";
6829
6949
  function useOnce(fn) {
6830
- const onceFn = useMemo10(() => {
6950
+ const onceFn = useMemo11(() => {
6831
6951
  return once(fn);
6832
6952
  }, []);
6833
6953
  return onceFn();
@@ -7126,7 +7246,7 @@ var VirtualBrain = class extends Logger {
7126
7246
  this.computeCacheFor(lastSizeIndex);
7127
7247
  _prev = lastOffset;
7128
7248
  lastOffset = this.itemOffsetCache[lastSizeIndex];
7129
- if (_prev === lastOffset) {
7249
+ if (_prev === lastOffset && _prev != 0) {
7130
7250
  return count - 1;
7131
7251
  }
7132
7252
  }
@@ -7318,6 +7438,10 @@ function useYourBrain(param) {
7318
7438
  }, []);
7319
7439
  horizontalVirtualBrain.update(computedUnpinnedColumns.length, columnSize);
7320
7440
  verticalVirtualBrain.update(dataArray.length, rowHeight, rowSpan);
7441
+ if (true) {
7442
+ globalThis.verticalVirtualBrain = verticalVirtualBrain;
7443
+ globalThis.horizontalVirtualBrain = horizontalVirtualBrain;
7444
+ }
7321
7445
  useEffect21(() => {
7322
7446
  verticalVirtualBrain.setAvailableSize({
7323
7447
  height: bodySize.height,
@@ -7349,7 +7473,7 @@ function useListRendering(param) {
7349
7473
  computedUnpinnedColumnsWidth,
7350
7474
  computedPinnedStartOverflow,
7351
7475
  computedPinnedEndOverflow,
7352
- computedVisibleColumns,
7476
+ rowSpan,
7353
7477
  toggleGroupRow
7354
7478
  } = computed;
7355
7479
  const { componentState: dataSourceState, getState: getDataSourceState } = useDataSourceContextValue();
@@ -7368,32 +7492,6 @@ function useListRendering(param) {
7368
7492
  repaintIdRef.current++;
7369
7493
  }
7370
7494
  const repaintId = repaintIdRef.current;
7371
- const rowSpan = useMemo11(() => {
7372
- const colsWithRowspan = computedVisibleColumns.filter((col) => typeof col.rowspan === "function");
7373
- return colsWithRowspan.length ? ({ itemIndex }) => {
7374
- let maxSpan = 1;
7375
- const dataArray2 = getData();
7376
- const rowInfo = dataArray2[itemIndex];
7377
- const data = rowInfo.data;
7378
- colsWithRowspan.forEach((column) => {
7379
- if (!column.rowspan) {
7380
- return;
7381
- }
7382
- const span = column.rowspan({
7383
- column,
7384
- data,
7385
- dataArray: dataArray2,
7386
- groupRowInfo: null,
7387
- rowInfo,
7388
- rowIndex: itemIndex
7389
- });
7390
- if (span > maxSpan) {
7391
- maxSpan = span;
7392
- }
7393
- });
7394
- return maxSpan;
7395
- } : void 0;
7396
- }, [computedVisibleColumns]);
7397
7495
  const { horizontalVirtualBrain, verticalVirtualBrain } = useYourBrain({
7398
7496
  computedPinnedStartWidth: computed.computedPinnedStartWidth,
7399
7497
  computedPinnedEndWidth: computed.computedPinnedEndWidth,
@@ -7406,7 +7504,7 @@ function useListRendering(param) {
7406
7504
  const hasHorizontalScrollbar = computedUnpinnedColumnsWidth > bodySize.width - computedPinnedStartColumnsWidth - computedPinnedEndColumnsWidth;
7407
7505
  const reservedContentHeight = verticalVirtualBrain.getTotalSize() + (hasHorizontalScrollbar ? getScrollbarWidth() : 0);
7408
7506
  const hasVerticalScrollbar = bodySize.height > 0 && bodySize.height < reservedContentHeight;
7409
- const scrollbars = useMemo11(() => ({
7507
+ const scrollbars = useMemo12(() => ({
7410
7508
  vertical: hasVerticalScrollbar,
7411
7509
  horizontal: hasHorizontalScrollbar
7412
7510
  }), [hasVerticalScrollbar, hasHorizontalScrollbar]);
@@ -7454,7 +7552,8 @@ function useListRendering(param) {
7454
7552
  rowHeight,
7455
7553
  verticalVirtualBrain,
7456
7554
  pinnedStartScrollListener,
7457
- pinnedEndScrollListener
7555
+ pinnedEndScrollListener,
7556
+ rowSpan
7458
7557
  };
7459
7558
  const centerRenderingParams = __spreadProps(__spreadValues({}, pinnedRenderingParams), {
7460
7559
  columnShifts,
@@ -7570,7 +7669,7 @@ var InfiniteTableLicenseFooter = forwardRef3(function InfiniteTableLicenseFooter
7570
7669
  });
7571
7670
 
7572
7671
  // src/components/InfiniteTable/hooks/useLicense/useLicense.ts
7573
- import { useMemo as useMemo12 } from "react";
7672
+ import { useMemo as useMemo13 } from "react";
7574
7673
 
7575
7674
  // src/components/InfiniteTable/hooks/useLicense/crc32.ts
7576
7675
  var DEFAULT_ReversedPolynomial = 3988292384;
@@ -7720,10 +7819,10 @@ var origin = typeof window !== "undefined" ? window.location.origin : "";
7720
7819
  var [_fullUrl, protocol, sandboxUrl] = Array.from(SANDBOX_REGEX.exec(origin) || []);
7721
7820
  var isInsideSandbox = protocol === "https" && sandboxUrl === "sandpack.codesandbox.io";
7722
7821
  var useLicense = (licenseKey = "") => {
7723
- const valid = useMemo12(() => {
7822
+ const valid = useMemo13(() => {
7724
7823
  let valid2 = isValidLicense(licenseKey, {
7725
7824
  publishedAt: 1624970570587,
7726
- version: "0.2.3"
7825
+ version: "0.2.7"
7727
7826
  });
7728
7827
  if (!licenseKey && !valid2 && isInsideSandbox) {
7729
7828
  return true;