@infinite-table/infinite-react 0.2.17 → 0.2.20

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 (3) hide show
  1. package/index.esm.js +12 -14
  2. package/index.js +12 -14
  3. package/package.json +2 -2
package/index.esm.js CHANGED
@@ -1289,7 +1289,7 @@ var forwardProps = (setupState) => {
1289
1289
  pivotColumnGroups: 1,
1290
1290
  onScrollbarsChange: 1,
1291
1291
  autoSizeColumnsKey: 1,
1292
- scrollStopDelay: (scrollStopDelay) => scrollStopDelay != null ? scrollStopDelay : 100,
1292
+ scrollStopDelay: (scrollStopDelay) => scrollStopDelay != null ? scrollStopDelay : 250,
1293
1293
  viewportReservedWidth: (viewportReservedWidth) => viewportReservedWidth != null ? viewportReservedWidth : 0,
1294
1294
  activeIndex: (activeIndex) => activeIndex != null ? activeIndex : 0,
1295
1295
  columnMinWidth: (columnMinWidth) => columnMinWidth != null ? columnMinWidth : 30,
@@ -3667,9 +3667,13 @@ function loadData(data, componentState, actions, overrides) {
3667
3667
  }
3668
3668
  currentGroupRowInfo.items.length = currentGroupRowInfo.totalCount;
3669
3669
  const start = (_c = dataParams.lazyLoadStartIndex) != null ? _c : 0;
3670
- const end = Math.min((_d = remoteData.totalCount) != null ? _d : start + dataParams.lazyLoadBatchSize);
3670
+ const end = Math.min((_d = remoteData.totalCount) != null ? _d : dataArray.length, start + dataParams.lazyLoadBatchSize);
3671
3671
  for (let i = start; i < end; i++) {
3672
- currentGroupRowInfo.items[i] = newGroupRowInfo.items[i - start];
3672
+ const it = newGroupRowInfo.items[i - start];
3673
+ if (!it) {
3674
+ throw `lazily loaded item not found at index ${i - start}`;
3675
+ }
3676
+ currentGroupRowInfo.items[i] = it;
3673
3677
  }
3674
3678
  if (!existingGroupRowInfo) {
3675
3679
  lazyGroupData.set(key, currentGroupRowInfo);
@@ -3784,7 +3788,7 @@ function useLazyLoadRange() {
3784
3788
  } = useComponentState();
3785
3789
  const loadingCache = useMemo4(() => {
3786
3790
  return new Map();
3787
- }, [componentState.data]);
3791
+ }, [componentState.data, componentState.dataParams]);
3788
3792
  const {
3789
3793
  lazyLoadBatchSize,
3790
3794
  notifyRenderRangeChange,
@@ -3888,11 +3892,7 @@ function lazyLoadRange(options, cache) {
3888
3892
  }
3889
3893
  cache == null ? void 0 : cache.set(cacheKey, true);
3890
3894
  const args = [componentState.data, componentState, componentActions, fnCall];
3891
- return promise.then(() => getRafPromise()).then(() => loadData(...args)).then(() => {
3892
- requestAnimationFrame(() => {
3893
- cache == null ? void 0 : cache.delete(cacheKey);
3894
- });
3895
- });
3895
+ return promise.then(() => getRafPromise()).then(() => loadData(...args));
3896
3896
  }, initialPromise);
3897
3897
  }
3898
3898
 
@@ -4423,7 +4423,6 @@ function getPivotColumnsAndColumnGroups({
4423
4423
  if (!pivotLength && pivotTotalColumnPosition === "end" || pivotGrandTotalColumnPosition === "end") {
4424
4424
  addGrandTotalColumns();
4425
4425
  }
4426
- console.log(columns.keys());
4427
4426
  const result = {
4428
4427
  columns,
4429
4428
  columnGroups
@@ -7221,7 +7220,6 @@ var useOnContainerScroll = ({
7221
7220
  componentState: {
7222
7221
  scrollStopDelay,
7223
7222
  scrollerDOMRef,
7224
- domRef,
7225
7223
  scrollToBottomOffset,
7226
7224
  onScrollToBottom,
7227
7225
  onScrollToTop,
@@ -7267,7 +7265,7 @@ var useOnContainerScroll = ({
7267
7265
  lastVisibleRowIndex: range.renderEndIndex
7268
7266
  });
7269
7267
  }
7270
- const classList = (_a = domRef.current) == null ? void 0 : _a.classList;
7268
+ const classList = (_a = scrollerDOMRef.current) == null ? void 0 : _a.classList;
7271
7269
  if (!classList) {
7272
7270
  return;
7273
7271
  }
@@ -7285,7 +7283,7 @@ var useOnContainerScroll = ({
7285
7283
  }, [
7286
7284
  horizontalVirtualBrain,
7287
7285
  verticalVirtualBrain,
7288
- domRef.current,
7286
+ scrollerDOMRef.current,
7289
7287
  setScrolling
7290
7288
  ]);
7291
7289
  const scrollPositionRef = useRef16({
@@ -8030,7 +8028,7 @@ var useLicense = (licenseKey = "") => {
8030
8028
  const valid = useMemo12(() => {
8031
8029
  let valid2 = isValidLicense(licenseKey, {
8032
8030
  publishedAt: 1624970570587,
8033
- version: "0.2.17"
8031
+ version: "0.2.20"
8034
8032
  });
8035
8033
  if (!licenseKey && !valid2 && isInsidePlayground) {
8036
8034
  return true;
package/index.js CHANGED
@@ -1309,7 +1309,7 @@ var forwardProps = (setupState) => {
1309
1309
  pivotColumnGroups: 1,
1310
1310
  onScrollbarsChange: 1,
1311
1311
  autoSizeColumnsKey: 1,
1312
- scrollStopDelay: (scrollStopDelay) => scrollStopDelay != null ? scrollStopDelay : 100,
1312
+ scrollStopDelay: (scrollStopDelay) => scrollStopDelay != null ? scrollStopDelay : 250,
1313
1313
  viewportReservedWidth: (viewportReservedWidth) => viewportReservedWidth != null ? viewportReservedWidth : 0,
1314
1314
  activeIndex: (activeIndex) => activeIndex != null ? activeIndex : 0,
1315
1315
  columnMinWidth: (columnMinWidth) => columnMinWidth != null ? columnMinWidth : 30,
@@ -3656,9 +3656,13 @@ function loadData(data, componentState, actions, overrides) {
3656
3656
  }
3657
3657
  currentGroupRowInfo.items.length = currentGroupRowInfo.totalCount;
3658
3658
  const start = (_c = dataParams.lazyLoadStartIndex) != null ? _c : 0;
3659
- const end = Math.min((_d = remoteData.totalCount) != null ? _d : start + dataParams.lazyLoadBatchSize);
3659
+ const end = Math.min((_d = remoteData.totalCount) != null ? _d : dataArray.length, start + dataParams.lazyLoadBatchSize);
3660
3660
  for (let i = start; i < end; i++) {
3661
- currentGroupRowInfo.items[i] = newGroupRowInfo.items[i - start];
3661
+ const it = newGroupRowInfo.items[i - start];
3662
+ if (!it) {
3663
+ throw `lazily loaded item not found at index ${i - start}`;
3664
+ }
3665
+ currentGroupRowInfo.items[i] = it;
3662
3666
  }
3663
3667
  if (!existingGroupRowInfo) {
3664
3668
  lazyGroupData.set(key, currentGroupRowInfo);
@@ -3773,7 +3777,7 @@ function useLazyLoadRange() {
3773
3777
  } = useComponentState();
3774
3778
  const loadingCache = (0, import_react16.useMemo)(() => {
3775
3779
  return new Map();
3776
- }, [componentState.data]);
3780
+ }, [componentState.data, componentState.dataParams]);
3777
3781
  const {
3778
3782
  lazyLoadBatchSize,
3779
3783
  notifyRenderRangeChange,
@@ -3877,11 +3881,7 @@ function lazyLoadRange(options, cache) {
3877
3881
  }
3878
3882
  cache == null ? void 0 : cache.set(cacheKey, true);
3879
3883
  const args = [componentState.data, componentState, componentActions, fnCall];
3880
- return promise.then(() => getRafPromise()).then(() => loadData(...args)).then(() => {
3881
- requestAnimationFrame(() => {
3882
- cache == null ? void 0 : cache.delete(cacheKey);
3883
- });
3884
- });
3884
+ return promise.then(() => getRafPromise()).then(() => loadData(...args));
3885
3885
  }, initialPromise);
3886
3886
  }
3887
3887
 
@@ -4412,7 +4412,6 @@ function getPivotColumnsAndColumnGroups({
4412
4412
  if (!pivotLength && pivotTotalColumnPosition === "end" || pivotGrandTotalColumnPosition === "end") {
4413
4413
  addGrandTotalColumns();
4414
4414
  }
4415
- console.log(columns.keys());
4416
4415
  const result = {
4417
4416
  columns,
4418
4417
  columnGroups
@@ -7139,7 +7138,6 @@ var useOnContainerScroll = ({
7139
7138
  componentState: {
7140
7139
  scrollStopDelay,
7141
7140
  scrollerDOMRef,
7142
- domRef,
7143
7141
  scrollToBottomOffset,
7144
7142
  onScrollToBottom,
7145
7143
  onScrollToTop,
@@ -7185,7 +7183,7 @@ var useOnContainerScroll = ({
7185
7183
  lastVisibleRowIndex: range.renderEndIndex
7186
7184
  });
7187
7185
  }
7188
- const classList = (_a = domRef.current) == null ? void 0 : _a.classList;
7186
+ const classList = (_a = scrollerDOMRef.current) == null ? void 0 : _a.classList;
7189
7187
  if (!classList) {
7190
7188
  return;
7191
7189
  }
@@ -7203,7 +7201,7 @@ var useOnContainerScroll = ({
7203
7201
  }, [
7204
7202
  horizontalVirtualBrain,
7205
7203
  verticalVirtualBrain,
7206
- domRef.current,
7204
+ scrollerDOMRef.current,
7207
7205
  setScrolling
7208
7206
  ]);
7209
7207
  const scrollPositionRef = (0, import_react36.useRef)({
@@ -7938,7 +7936,7 @@ var useLicense = (licenseKey = "") => {
7938
7936
  const valid = (0, import_react44.useMemo)(() => {
7939
7937
  let valid2 = isValidLicense(licenseKey, {
7940
7938
  publishedAt: 1624970570587,
7941
- version: "0.2.17"
7939
+ version: "0.2.20"
7942
7940
  });
7943
7941
  if (!licenseKey && !valid2 && isInsidePlayground) {
7944
7942
  return true;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@infinite-table/infinite-react",
3
3
  "description": "Infinite Table for React",
4
- "version": "0.2.17",
4
+ "version": "0.2.20",
5
5
  "main": "index.js",
6
6
  "module": "index.esm.js",
7
7
  "typings": "index.d.ts",
@@ -14,5 +14,5 @@
14
14
  },
15
15
  "license": "Commercial & Open Source",
16
16
  "//": "will be updated at build time",
17
- "publishedAt": 1648554753079
17
+ "publishedAt": 1649171966292
18
18
  }