@infinite-table/infinite-react 0.0.6 → 0.0.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.
package/index.js CHANGED
@@ -216,6 +216,8 @@ var require_common = __commonJS({
216
216
  function createDebug(namespace) {
217
217
  let prevTime;
218
218
  let enableOverride = null;
219
+ let namespacesCache;
220
+ let enabledCache;
219
221
  function debug6(...args) {
220
222
  if (!debug6.enabled) {
221
223
  return;
@@ -258,7 +260,16 @@ var require_common = __commonJS({
258
260
  Object.defineProperty(debug6, "enabled", {
259
261
  enumerable: true,
260
262
  configurable: false,
261
- get: () => enableOverride === null ? createDebug.enabled(namespace) : enableOverride,
263
+ get: () => {
264
+ if (enableOverride !== null) {
265
+ return enableOverride;
266
+ }
267
+ if (namespacesCache !== createDebug.namespaces) {
268
+ namespacesCache = createDebug.namespaces;
269
+ enabledCache = createDebug.enabled(namespace);
270
+ }
271
+ return enabledCache;
272
+ },
262
273
  set: (v) => {
263
274
  enableOverride = v;
264
275
  }
@@ -275,6 +286,7 @@ var require_common = __commonJS({
275
286
  }
276
287
  function enable(namespaces) {
277
288
  createDebug.save(namespaces);
289
+ createDebug.namespaces = namespaces;
278
290
  createDebug.names = [];
279
291
  createDebug.skips = [];
280
292
  let i;
@@ -502,6 +514,99 @@ var require_browser = __commonJS({
502
514
  }
503
515
  });
504
516
 
517
+ // node_modules/@vanilla-extract/recipes/createRuntimeFn/dist/vanilla-extract-recipes-createRuntimeFn.cjs.dev.js
518
+ var require_vanilla_extract_recipes_createRuntimeFn_cjs_dev = __commonJS({
519
+ "node_modules/@vanilla-extract/recipes/createRuntimeFn/dist/vanilla-extract-recipes-createRuntimeFn.cjs.dev.js"(exports) {
520
+ "use strict";
521
+ Object.defineProperty(exports, "__esModule", { value: true });
522
+ function _defineProperty(obj, key, value) {
523
+ if (key in obj) {
524
+ Object.defineProperty(obj, key, {
525
+ value,
526
+ enumerable: true,
527
+ configurable: true,
528
+ writable: true
529
+ });
530
+ } else {
531
+ obj[key] = value;
532
+ }
533
+ return obj;
534
+ }
535
+ function ownKeys(object, enumerableOnly) {
536
+ var keys = Object.keys(object);
537
+ if (Object.getOwnPropertySymbols) {
538
+ var symbols = Object.getOwnPropertySymbols(object);
539
+ if (enumerableOnly) {
540
+ symbols = symbols.filter(function(sym) {
541
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
542
+ });
543
+ }
544
+ keys.push.apply(keys, symbols);
545
+ }
546
+ return keys;
547
+ }
548
+ function _objectSpread2(target) {
549
+ for (var i = 1; i < arguments.length; i++) {
550
+ var source = arguments[i] != null ? arguments[i] : {};
551
+ if (i % 2) {
552
+ ownKeys(Object(source), true).forEach(function(key) {
553
+ _defineProperty(target, key, source[key]);
554
+ });
555
+ } else if (Object.getOwnPropertyDescriptors) {
556
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
557
+ } else {
558
+ ownKeys(Object(source)).forEach(function(key) {
559
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
560
+ });
561
+ }
562
+ }
563
+ return target;
564
+ }
565
+ var shouldApplyCompound = (compoundCheck, selections) => {
566
+ for (var key of Object.keys(compoundCheck)) {
567
+ if (compoundCheck[key] !== selections[key]) {
568
+ return false;
569
+ }
570
+ }
571
+ return true;
572
+ };
573
+ var createRuntimeFn = (config) => (options) => {
574
+ var className = config.defaultClassName;
575
+ var selections = _objectSpread2(_objectSpread2({}, config.defaultVariants), options);
576
+ for (var variantName in selections) {
577
+ var _selections$variantNa;
578
+ var variantSelection = (_selections$variantNa = selections[variantName]) !== null && _selections$variantNa !== void 0 ? _selections$variantNa : config.defaultVariants[variantName];
579
+ if (variantSelection != null) {
580
+ var selection = variantSelection;
581
+ if (typeof selection === "boolean") {
582
+ selection = selection === true ? "true" : "false";
583
+ }
584
+ className += " " + config.variantClassNames[variantName][selection];
585
+ }
586
+ }
587
+ for (var [compoundCheck, compoundClassName] of config.compoundVariants) {
588
+ if (shouldApplyCompound(compoundCheck, selections)) {
589
+ className += " " + compoundClassName;
590
+ }
591
+ }
592
+ return className;
593
+ };
594
+ exports.createRuntimeFn = createRuntimeFn;
595
+ }
596
+ });
597
+
598
+ // node_modules/@vanilla-extract/recipes/createRuntimeFn/dist/vanilla-extract-recipes-createRuntimeFn.cjs.js
599
+ var require_vanilla_extract_recipes_createRuntimeFn_cjs = __commonJS({
600
+ "node_modules/@vanilla-extract/recipes/createRuntimeFn/dist/vanilla-extract-recipes-createRuntimeFn.cjs.js"(exports, module2) {
601
+ "use strict";
602
+ if (false) {
603
+ module2.exports = null;
604
+ } else {
605
+ module2.exports = require_vanilla_extract_recipes_createRuntimeFn_cjs_dev();
606
+ }
607
+ }
608
+ });
609
+
505
610
  // node_modules/binary-search/index.js
506
611
  var require_binary_search = __commonJS({
507
612
  "node_modules/binary-search/index.js"(exports, module2) {
@@ -563,7 +668,7 @@ var require_decamelize = __commonJS({
563
668
  if (preserveConsecutiveUppercase) {
564
669
  return handlePreserveConsecutiveUppercase(decamelized, separator);
565
670
  }
566
- return decamelized.replace(/(\p{Uppercase_Letter}+)(\p{Uppercase_Letter}\p{Lowercase_Letter}+)/gu, replacement).toLowerCase();
671
+ return decamelized.replace(/(\p{Uppercase_Letter})(\p{Uppercase_Letter}\p{Lowercase_Letter}+)/gu, replacement).toLowerCase();
567
672
  };
568
673
  }
569
674
  });
@@ -1953,43 +2058,10 @@ function ExpanderIcon(props) {
1953
2058
  }));
1954
2059
  }
1955
2060
 
1956
- // node_modules/@vanilla-extract/recipes/createRuntimeFn/dist/vanilla-extract-recipes-createRuntimeFn.esm.js
1957
- var shouldApplyCompound = (compoundCheck, selections) => {
1958
- for (const key of Object.keys(compoundCheck)) {
1959
- if (compoundCheck[key] !== selections[key]) {
1960
- return false;
1961
- }
1962
- }
1963
- return true;
1964
- };
1965
- var createRuntimeFn = (config) => (options) => {
1966
- let className = config.defaultClassName;
1967
- const selections = {
1968
- ...config.defaultVariants,
1969
- ...options
1970
- };
1971
- for (const variantName in selections) {
1972
- var _selections$variantNa;
1973
- const variantSelection = (_selections$variantNa = selections[variantName]) !== null && _selections$variantNa !== void 0 ? _selections$variantNa : config.defaultVariants[variantName];
1974
- if (variantSelection != null) {
1975
- let selection = variantSelection;
1976
- if (typeof selection === "boolean") {
1977
- selection = selection === true ? "true" : "false";
1978
- }
1979
- className += " " + config.variantClassNames[variantName][selection];
1980
- }
1981
- }
1982
- for (const [compoundCheck, compoundClassName] of config.compoundVariants) {
1983
- if (shouldApplyCompound(compoundCheck, selections)) {
1984
- className += " " + compoundClassName;
1985
- }
1986
- }
1987
- return className;
1988
- };
1989
-
1990
2061
  // src/components/InfiniteTable/components/InfiniteTableRow/row.css.ts
2062
+ var import_createRuntimeFn = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
1991
2063
  var GroupRowExpanderCls = "_7pupv0b";
1992
- var RowClsRecipe = createRuntimeFn({ defaultClassName: "_7pupv00", variantClassNames: { zebra: { false: "_7pupv02", even: "_7pupv03", odd: "_7pupv04" }, groupRow: { true: "_7pupv05", false: "_7pupv06" }, inlineGroupRow: { true: "_7pupv07", false: "_7pupv08" }, showHoverRows: { true: "_7pupv09", false: "_7pupv0a" } }, defaultVariants: {}, compoundVariants: [] });
2064
+ var RowClsRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_7pupv00", variantClassNames: { zebra: { false: "_7pupv02", even: "_7pupv03", odd: "_7pupv04" }, groupRow: { true: "_7pupv05", false: "_7pupv06" }, inlineGroupRow: { true: "_7pupv07", false: "_7pupv08" }, showHoverRows: { true: "_7pupv09", false: "_7pupv0a" } }, defaultVariants: {}, compoundVariants: [] });
1993
2065
  var RowHoverCls = "_7pupv01";
1994
2066
 
1995
2067
  // src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
@@ -3481,7 +3553,7 @@ function getColumnsWhenGrouping(params) {
3481
3553
  columns.forEach((col, colId) => {
3482
3554
  computedColumns.set(colId, col);
3483
3555
  });
3484
- return computedColumns;
3556
+ return computedColumns.size ? computedColumns : void 0;
3485
3557
  }
3486
3558
 
3487
3559
  // src/components/InfiniteTable/hooks/useComputed.ts
@@ -3679,10 +3751,11 @@ function VerticalScrollbarPlaceholderFn(props) {
3679
3751
  var VerticalScrollbarPlaceholder = React11.memo(VerticalScrollbarPlaceholderFn);
3680
3752
 
3681
3753
  // src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts
3754
+ var import_createRuntimeFn2 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
3682
3755
  var CellCls = "_1eexc2a5 _16lm1iwj _16lm1iw10 _16lm1iw11 _16lm1iw2 _16lm1iw19 _16lm1iw1a";
3683
3756
  var HeaderCellProxy = "_12zfob10";
3684
- var HeaderCellRecipe = createRuntimeFn({ defaultClassName: "_12zfob1c", variantClassNames: { dragging: { true: "_12zfob1d", false: "_12zfob1e" }, first: { true: "_12zfob1f", false: "_12zfob1g" }, last: { true: "_12zfob1h", false: "_12zfob1i" }, groupByField: { true: "_12zfob1j", false: "_12zfob1k" }, firstInCategory: { true: "_12zfob1l", false: "_12zfob1m" }, lastInCategory: { true: "_12zfob1n", false: "_12zfob1o" }, pinned: { start: "_12zfob1p", end: "_12zfob1q", false: "_12zfob1r" } }, defaultVariants: {}, compoundVariants: [[{ pinned: "start", lastInCategory: true }, "_12zfob1s"], [{ pinned: "end", firstInCategory: true }, "_12zfob1t"], [{ pinned: false, lastInCategory: true }, "_12zfob1u"]] });
3685
- var HeaderClsRecipe = createRuntimeFn({ defaultClassName: "_12zfob12 _16lm1iw10", variantClassNames: { pinned: { start: "_12zfob13", end: "_12zfob14", false: "_12zfob15" }, virtualized: { true: "_12zfob16", false: "_12zfob17" }, overflow: { true: "_12zfob18", false: "_12zfob19" } }, defaultVariants: {}, compoundVariants: [[{ overflow: true, pinned: "start" }, "_12zfob1a"], [{ overflow: true, pinned: "end" }, "_12zfob1b"]] });
3757
+ var HeaderCellRecipe = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "_12zfob1c", variantClassNames: { dragging: { true: "_12zfob1d", false: "_12zfob1e" }, first: { true: "_12zfob1f", false: "_12zfob1g" }, last: { true: "_12zfob1h", false: "_12zfob1i" }, groupByField: { true: "_12zfob1j", false: "_12zfob1k" }, firstInCategory: { true: "_12zfob1l", false: "_12zfob1m" }, lastInCategory: { true: "_12zfob1n", false: "_12zfob1o" }, pinned: { start: "_12zfob1p", end: "_12zfob1q", false: "_12zfob1r" } }, defaultVariants: {}, compoundVariants: [[{ pinned: "start", lastInCategory: true }, "_12zfob1s"], [{ pinned: "end", firstInCategory: true }, "_12zfob1t"], [{ pinned: false, lastInCategory: true }, "_12zfob1u"]] });
3758
+ var HeaderClsRecipe = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "_12zfob12 _16lm1iw10", variantClassNames: { pinned: { start: "_12zfob13", end: "_12zfob14", false: "_12zfob15" }, virtualized: { true: "_12zfob16", false: "_12zfob17" }, overflow: { true: "_12zfob18", false: "_12zfob19" } }, defaultVariants: {}, compoundVariants: [[{ overflow: true, pinned: "start" }, "_12zfob1a"], [{ overflow: true, pinned: "end" }, "_12zfob1b"]] });
3686
3759
  var HeaderGroupCls = "_16lm1iwz _16lm1iwj";
3687
3760
  var HeaderGroup_Children = "_16lm1iwj _16lm1iw10 _16lm1iw12 _16lm1iwc";
3688
3761
  var HeaderGroup_Header = "_12zfob1x _16lm1iwj _16lm1iw10 _16lm1iw11";
@@ -3691,7 +3764,7 @@ var HeaderWrapperCls = "_12zfob1v _16lm1iw16 _16lm1iw1 _16lm1iwj _16lm1iw10";
3691
3764
 
3692
3765
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
3693
3766
  var React18 = __toModule(require("react"));
3694
- var import_react26 = __toModule(require("react"));
3767
+ var import_react27 = __toModule(require("react"));
3695
3768
 
3696
3769
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
3697
3770
  var React14 = __toModule(require("react"));
@@ -3709,9 +3782,10 @@ var useInfiniteTableState = () => {
3709
3782
  };
3710
3783
 
3711
3784
  // src/components/InfiniteTable/components/cell.css.ts
3785
+ var import_createRuntimeFn3 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
3712
3786
  var CellCls2 = "_1eexc2a5 _16lm1iwj _16lm1iw10 _16lm1iw11 _16lm1iw2 _16lm1iw19 _16lm1iw1a";
3713
3787
  var CellClsVariants = { shifting: "_1eexc2a3", dragging: "_1eexc2a4" };
3714
- var ColumnCellRecipe = createRuntimeFn({ defaultClassName: "_16lm1iw2 _16lm1iwo _16lm1iw7 _16lm1iwr", variantClassNames: { dragging: { false: "_1eexc2a7" }, first: { true: "_1eexc2a8", false: "_1eexc2a9" }, last: { true: "_1eexc2aa", false: "_1eexc2ab" }, groupByField: { true: "_1eexc2ac", false: "_1eexc2ad" }, firstInCategory: { true: "_1eexc2ae", false: "_1eexc2af" }, lastInCategory: { true: "_1eexc2ag", false: "_1eexc2ah" }, pinned: { start: "_1eexc2ai", end: "_1eexc2aj", false: "_1eexc2ak" } }, defaultVariants: {}, compoundVariants: [[{ pinned: "start", lastInCategory: true }, "_1eexc2al"], [{ pinned: "end", firstInCategory: true }, "_1eexc2am"]] });
3788
+ var ColumnCellRecipe = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "_16lm1iw2 _16lm1iwo _16lm1iw7 _16lm1iwr", variantClassNames: { dragging: { false: "_1eexc2a7" }, first: { true: "_1eexc2a8", false: "_1eexc2a9" }, last: { true: "_1eexc2aa", false: "_1eexc2ab" }, groupByField: { true: "_1eexc2ac", false: "_1eexc2ad" }, firstInCategory: { true: "_1eexc2ae", false: "_1eexc2af" }, lastInCategory: { true: "_1eexc2ag", false: "_1eexc2ah" }, pinned: { start: "_1eexc2ai", end: "_1eexc2aj", false: "_1eexc2ak" } }, defaultVariants: {}, compoundVariants: [[{ pinned: "start", lastInCategory: true }, "_1eexc2al"], [{ pinned: "end", firstInCategory: true }, "_1eexc2am"]] });
3715
3789
  var columnAlignCellStyle = { center: "_1eexc2a0", start: "_1eexc2a1", end: "_1eexc2a2" };
3716
3790
 
3717
3791
  // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
@@ -4124,6 +4198,24 @@ function InfiniteTableHeaderCell(props) {
4124
4198
 
4125
4199
  // src/components/RawList/index.tsx
4126
4200
  var React17 = __toModule(require("react"));
4201
+ var import_react26 = __toModule(require("react"));
4202
+
4203
+ // src/components/RawList/AvoidReactDiff.tsx
4204
+ var React15 = __toModule(require("react"));
4205
+ var import_react24 = __toModule(require("react"));
4206
+ function AvoidReactDiffFn(props) {
4207
+ const [children, setChildren] = (0, import_react24.useState)(props.updater.get());
4208
+ (0, import_react24.useLayoutEffect)(() => {
4209
+ const remove = props.updater.onChange((children2) => {
4210
+ setChildren(children2);
4211
+ });
4212
+ return remove;
4213
+ }, [props.updater]);
4214
+ return /* @__PURE__ */ React15.createElement(React15.Fragment, null, children);
4215
+ }
4216
+ var AvoidReactDiff = React15.memo(AvoidReactDiffFn);
4217
+
4218
+ // src/components/RawList/useVirtualRenderer.ts
4127
4219
  var import_react25 = __toModule(require("react"));
4128
4220
 
4129
4221
  // src/components/RawList/ReactVirtualRenderer.tsx
@@ -4222,6 +4314,9 @@ var MappedItems = class extends Logger {
4222
4314
  this.itemIndexToElementIndex = {};
4223
4315
  this.renderedElements = {};
4224
4316
  }
4317
+ reset() {
4318
+ this.init();
4319
+ }
4225
4320
  destroy() {
4226
4321
  this.init();
4227
4322
  }
@@ -4241,21 +4336,6 @@ var MappedItems = class extends Logger {
4241
4336
  }
4242
4337
  };
4243
4338
 
4244
- // src/components/RawList/AvoidReactDiff.tsx
4245
- var React15 = __toModule(require("react"));
4246
- var import_react24 = __toModule(require("react"));
4247
- function AvoidReactDiffFn(props) {
4248
- const [children, setChildren] = (0, import_react24.useState)(props.updater.get());
4249
- (0, import_react24.useLayoutEffect)(() => {
4250
- const remove = props.updater.onChange((children2) => {
4251
- setChildren(children2);
4252
- });
4253
- return remove;
4254
- }, [props.updater]);
4255
- return /* @__PURE__ */ React15.createElement(React15.Fragment, null, children);
4256
- }
4257
- var AvoidReactDiff = React15.memo(AvoidReactDiffFn);
4258
-
4259
4339
  // src/components/RawList/ReactVirtualRenderer.tsx
4260
4340
  var ITEM_POSITION_WITH_TRANSFORM = true;
4261
4341
  var ReactVirtualRenderer = class extends Logger {
@@ -4362,17 +4442,12 @@ var ReactVirtualRenderer = class extends Logger {
4362
4442
  }
4363
4443
  };
4364
4444
  this.destroy = () => {
4365
- if (true) {
4366
- return;
4367
- }
4368
4445
  this.destroyed = true;
4369
- this.mappedItems.destroy();
4370
- this.itemDOMElements = [];
4371
- this.itemDOMRefs = [];
4372
- this.updaters = [];
4446
+ this.reset();
4373
4447
  this.onRender = null;
4374
4448
  this.renderItem = null;
4375
4449
  this.brain = null;
4450
+ this.mappedItems = null;
4376
4451
  };
4377
4452
  if (onRender) {
4378
4453
  this.onRender = onRender;
@@ -4430,28 +4505,53 @@ var ReactVirtualRenderer = class extends Logger {
4430
4505
  itemUpdater(renderedNode);
4431
4506
  this.updateElementPosition(elementIndex);
4432
4507
  }
4508
+ reset() {
4509
+ this.itemDOMElements = {};
4510
+ this.itemDOMRefs = {};
4511
+ this.updaters = {};
4512
+ this.items = [];
4513
+ this.mappedItems.reset();
4514
+ }
4433
4515
  };
4434
4516
 
4517
+ // src/components/RawList/useVirtualRenderer.ts
4518
+ function createRenderer(brain) {
4519
+ const renderer = new ReactVirtualRenderer(brain, {});
4520
+ const onRenderUpdater = buildSubscriptionCallback();
4521
+ brain.onDestroy(() => {
4522
+ renderer.destroy();
4523
+ onRenderUpdater.destroy();
4524
+ });
4525
+ return {
4526
+ renderer,
4527
+ onRenderUpdater
4528
+ };
4529
+ }
4530
+ function useVirtualRenderer({
4531
+ brain
4532
+ }) {
4533
+ return (0, import_react25.useMemo)(() => {
4534
+ return createRenderer(brain);
4535
+ }, [brain]);
4536
+ }
4537
+
4435
4538
  // src/components/RawList/index.tsx
4436
4539
  function RawListFn(props) {
4437
4540
  const { renderItem, brain, debugChannel } = props;
4438
- const { onRenderUpdater, renderer } = (0, import_react25.useMemo)(() => {
4439
- const onRenderUpdater2 = buildSubscriptionCallback();
4440
- const renderer2 = new ReactVirtualRenderer(brain, {
4441
- channel: debugChannel
4442
- });
4443
- return { onRenderUpdater: onRenderUpdater2, renderer: renderer2 };
4444
- }, []);
4541
+ const { onRenderUpdater, renderer } = useVirtualRenderer({
4542
+ brain,
4543
+ debugChannel
4544
+ });
4445
4545
  const getRenderItem = useLatest(renderItem);
4446
- (0, import_react25.useEffect)(() => {
4546
+ (0, import_react26.useEffect)(() => {
4447
4547
  const renderRange = brain.getRenderRange();
4448
4548
  renderer.renderRange(renderRange, {
4449
4549
  renderItem,
4450
4550
  force: true,
4451
4551
  onRender: onRenderUpdater
4452
4552
  });
4453
- }, [renderItem, onRenderUpdater]);
4454
- (0, import_react25.useEffect)(() => {
4553
+ }, [brain, renderItem, onRenderUpdater]);
4554
+ (0, import_react26.useEffect)(() => {
4455
4555
  const remove = brain.onRenderRangeChange((renderRange) => {
4456
4556
  renderer.renderRange(renderRange, {
4457
4557
  force: false,
@@ -4461,12 +4561,6 @@ function RawListFn(props) {
4461
4561
  });
4462
4562
  return remove;
4463
4563
  }, [brain, onRenderUpdater]);
4464
- (0, import_react25.useEffect)(() => {
4465
- return () => {
4466
- renderer.destroy();
4467
- onRenderUpdater.destroy();
4468
- };
4469
- }, [renderer, onRenderUpdater]);
4470
4564
  return /* @__PURE__ */ React17.createElement(AvoidReactDiff, {
4471
4565
  updater: onRenderUpdater
4472
4566
  });
@@ -4484,7 +4578,7 @@ function InfiniteTableHeaderFn(props) {
4484
4578
  componentState: { headerHeight }
4485
4579
  } = useInfiniteTable();
4486
4580
  const { computedVisibleColumnsMap } = computed;
4487
- const renderColumn = (0, import_react26.useCallback)(({ domRef: domRef2, itemIndex: columnIndex }) => {
4581
+ const renderColumn = (0, import_react27.useCallback)(({ domRef: domRef2, itemIndex: columnIndex }) => {
4488
4582
  const column = columns[columnIndex];
4489
4583
  if (!column) {
4490
4584
  if (true) {
@@ -4499,14 +4593,14 @@ function InfiniteTableHeaderFn(props) {
4499
4593
  columns: computedVisibleColumnsMap
4500
4594
  });
4501
4595
  }, [computedVisibleColumnsMap, columns, repaintId, headerHeight]);
4502
- (0, import_react26.useEffect)(() => {
4596
+ (0, import_react27.useEffect)(() => {
4503
4597
  const onScroll = (scrollPosition) => {
4504
4598
  domRef.current.style.transform = `translate3d(-${scrollPosition.scrollLeft}px, 0px, 0px)`;
4505
4599
  };
4506
4600
  const removeOnScroll = brain.onScroll(onScroll);
4507
4601
  return removeOnScroll;
4508
4602
  }, [brain]);
4509
- const domRef = (0, import_react26.useRef)(null);
4603
+ const domRef = (0, import_react27.useRef)(null);
4510
4604
  const headerCls = HeaderClsRecipe({
4511
4605
  pinned: pinning,
4512
4606
  overflow: false,
@@ -4698,7 +4792,7 @@ function renderColumnHeaderGroups(config) {
4698
4792
  }
4699
4793
 
4700
4794
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderUnvirtualized.tsx
4701
- var import_react27 = __toModule(require("react"));
4795
+ var import_react28 = __toModule(require("react"));
4702
4796
  var { rootClassName: rootClassName5 } = internalProps;
4703
4797
  var TableHeaderClassName2 = `${rootClassName5}Header`;
4704
4798
  var UPDATE_SCROLL = (node, scrollPosition) => {
@@ -4764,7 +4858,7 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
4764
4858
  if (totalWidth != null) {
4765
4859
  style.width = availableWidth;
4766
4860
  }
4767
- (0, import_react27.useEffect)(() => {
4861
+ (0, import_react28.useEffect)(() => {
4768
4862
  const scroller = brain || scrollListener;
4769
4863
  if (!scroller || !scrollable) {
4770
4864
  return;
@@ -4878,12 +4972,12 @@ function TableHeaderWrapper(props) {
4878
4972
 
4879
4973
  // src/components/VirtualScrollContainer/index.tsx
4880
4974
  var React23 = __toModule(require("react"));
4881
- var import_react29 = __toModule(require("react"));
4975
+ var import_react30 = __toModule(require("react"));
4882
4976
 
4883
4977
  // src/components/hooks/useOnScroll.ts
4884
- var import_react28 = __toModule(require("react"));
4978
+ var import_react29 = __toModule(require("react"));
4885
4979
  var useOnScroll = (domRef, onScroll) => {
4886
- (0, import_react28.useEffect)(() => {
4980
+ (0, import_react29.useEffect)(() => {
4887
4981
  const domNode = domRef == null ? void 0 : domRef.current;
4888
4982
  const scrollFn = (event) => {
4889
4983
  const node = event.target;
@@ -4929,7 +5023,7 @@ var VirtualScrollContainer = React23.forwardRef(function VirtualScrollContainer2
4929
5023
  className,
4930
5024
  style
4931
5025
  } = props;
4932
- const domRef = ref != null ? ref : (0, import_react29.useRef)(null);
5026
+ const domRef = ref != null ? ref : (0, import_react30.useRef)(null);
4933
5027
  useOnScroll(domRef, onContainerScroll);
4934
5028
  return /* @__PURE__ */ React23.createElement("div", {
4935
5029
  ref: domRef,
@@ -4960,18 +5054,18 @@ function SpacePlaceholderFn(props) {
4960
5054
  var SpacePlaceholder = React24.memo(SpacePlaceholderFn);
4961
5055
 
4962
5056
  // src/components/InfiniteTable/hooks/useListRendering.tsx
4963
- var import_react40 = __toModule(require("react"));
5057
+ var import_react41 = __toModule(require("react"));
4964
5058
 
4965
5059
  // src/components/InfiniteTable/hooks/useUnpinnedRendering.tsx
4966
5060
  var React30 = __toModule(require("react"));
4967
- var import_react33 = __toModule(require("react"));
5061
+ var import_react34 = __toModule(require("react"));
4968
5062
 
4969
5063
  // src/components/VirtualList/VirtualRowList.tsx
4970
5064
  var React26 = __toModule(require("react"));
4971
5065
 
4972
5066
  // src/components/VirtualList/VirtualList.tsx
4973
5067
  var React25 = __toModule(require("react"));
4974
- var import_react30 = __toModule(require("react"));
5068
+ var import_react31 = __toModule(require("react"));
4975
5069
 
4976
5070
  // src/components/VirtualList/VirtualList.css.ts
4977
5071
  var VirtualListCls = "mlx2t0 _16lm1iw0";
@@ -5014,11 +5108,11 @@ var VirtualList = (props) => {
5014
5108
  "onContainerScroll",
5015
5109
  "children"
5016
5110
  ]);
5017
- const domRef = (0, import_react30.useRef)(null);
5111
+ const domRef = (0, import_react31.useRef)(null);
5018
5112
  const [, rerender] = useRerender();
5019
- const [totalSize, setTotalSize] = (0, import_react30.useState)(0);
5020
- const renderCountRef = (0, import_react30.useRef)(0);
5021
- (0, import_react30.useEffect)(() => {
5113
+ const [totalSize, setTotalSize] = (0, import_react31.useState)(0);
5114
+ const renderCountRef = (0, import_react31.useRef)(0);
5115
+ (0, import_react31.useEffect)(() => {
5022
5116
  const removeOnRenderCount = virtualBrain.onRenderCountChange((renderCount) => {
5023
5117
  renderCountRef.current = renderCount;
5024
5118
  if (true) {
@@ -5037,7 +5131,7 @@ var VirtualList = (props) => {
5037
5131
  removeOnTotalSizeChange();
5038
5132
  };
5039
5133
  }, [virtualBrain]);
5040
- (0, import_react30.useEffect)(() => {
5134
+ (0, import_react31.useEffect)(() => {
5041
5135
  const onScroll = (scrollPosition) => {
5042
5136
  UPDATE_SCROLL2(domRef.current, scrollPosition);
5043
5137
  };
@@ -5063,7 +5157,7 @@ var VirtualList = (props) => {
5063
5157
  brain: virtualBrain,
5064
5158
  renderItem,
5065
5159
  repaintId,
5066
- debugChannel: "VirtualList"
5160
+ debugChannel: "VirtualList-" + mainAxis
5067
5161
  })), children, /* @__PURE__ */ React25.createElement(SpacePlaceholder, {
5068
5162
  count,
5069
5163
  width,
@@ -5091,7 +5185,7 @@ var VirtualRowList = (props) => {
5091
5185
 
5092
5186
  // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRow.tsx
5093
5187
  var React28 = __toModule(require("react"));
5094
- var import_react32 = __toModule(require("react"));
5188
+ var import_react33 = __toModule(require("react"));
5095
5189
 
5096
5190
  // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableColumnCell.tsx
5097
5191
  var React27 = __toModule(require("react"));
@@ -5195,7 +5289,7 @@ function InfiniteTableColumnCellFn(props) {
5195
5289
  var InfiniteTableColumnCell = React27.memo(InfiniteTableColumnCellFn);
5196
5290
 
5197
5291
  // src/components/InfiniteTable/components/InfiniteTableRow/useRowDOMProps.ts
5198
- var import_react31 = __toModule(require("react"));
5292
+ var import_react32 = __toModule(require("react"));
5199
5293
 
5200
5294
  // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRowClassName.ts
5201
5295
  var { rootClassName: rootClassName9 } = internalProps;
@@ -5220,8 +5314,8 @@ function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStra
5220
5314
  domRef: domRefFromProps,
5221
5315
  rowInfo
5222
5316
  } = props;
5223
- const domRef = (0, import_react31.useRef)(null);
5224
- const rowDOMRef = (0, import_react31.useCallback)((node) => {
5317
+ const domRef = (0, import_react32.useRef)(null);
5318
+ const rowDOMRef = (0, import_react32.useCallback)((node) => {
5225
5319
  domRefFromProps(node);
5226
5320
  domRef.current = node;
5227
5321
  }, []);
@@ -5253,7 +5347,7 @@ function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStra
5253
5347
  }), `${InfiniteTableRowClassName}--${rowInfo.isGroupRow ? "group" : "normal"}-row`, inlineGroupRoot ? `${InfiniteTableRowClassName}--inline-group-row` : "", showZebraRows ? `${InfiniteTableRowClassName}--${odd ? "odd" : "even"}` : null, showHoverRows ? `${InfiniteTableRowClassName}--show-hover` : null, domProps == null ? void 0 : domProps.className, rowProps == null ? void 0 : rowProps.className, rowComputedClassName);
5254
5348
  const initialMouseEnter = rowProps == null ? void 0 : rowProps.onMouseEnter;
5255
5349
  const initialMouseLeave = rowProps == null ? void 0 : rowProps.onMouseLeave;
5256
- const onMouseEnter = (0, import_react31.useCallback)((event) => {
5350
+ const onMouseEnter = (0, import_react32.useCallback)((event) => {
5257
5351
  var _a;
5258
5352
  initialMouseEnter == null ? void 0 : initialMouseEnter(event);
5259
5353
  const rowIndex2 = ((_a = event.currentTarget) == null ? void 0 : _a.dataset.rowIndex) * 1;
@@ -5267,7 +5361,7 @@ function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStra
5267
5361
  const rows = parentNode.querySelectorAll(hoverSelector.join(","));
5268
5362
  rows.forEach((row) => row.classList.add(InfiniteTableRowClassName__hover, RowHoverCls));
5269
5363
  }, [initialMouseEnter, showHoverRows]);
5270
- const onMouseLeave = (0, import_react31.useCallback)((event) => {
5364
+ const onMouseLeave = (0, import_react32.useCallback)((event) => {
5271
5365
  var _a;
5272
5366
  initialMouseLeave == null ? void 0 : initialMouseLeave(event);
5273
5367
  const rowIndex2 = (_a = event.currentTarget) == null ? void 0 : _a.dataset.rowIndex;
@@ -5323,7 +5417,7 @@ function InfiniteTableRowFn(props) {
5323
5417
  width: rowWidth,
5324
5418
  height: rowHeight
5325
5419
  }, domProps.style);
5326
- const renderCellRef = (0, import_react32.useRef)(null);
5420
+ const renderCellRef = (0, import_react33.useRef)(null);
5327
5421
  const renderCell = React28.useCallback(({ domRef, itemIndex }) => {
5328
5422
  const column = columns[itemIndex];
5329
5423
  if (!column) {
@@ -5427,7 +5521,7 @@ function useUnpinnedRendering(params) {
5427
5521
  } = params;
5428
5522
  const { virtualizeColumns } = getState();
5429
5523
  const shouldVirtualizeColumns = typeof virtualizeColumns === "function" ? virtualizeColumns(computedUnpinnedColumns) : virtualizeColumns != null ? virtualizeColumns : true;
5430
- const renderRowUnpinned = (0, import_react33.useCallback)((rowParams) => {
5524
+ const renderRowUnpinned = (0, import_react34.useCallback)((rowParams) => {
5431
5525
  const dataArray = getData();
5432
5526
  const rowInfo = dataArray[rowParams.rowIndex];
5433
5527
  const { showZebraRows, showHoverRows } = getState();
@@ -5493,16 +5587,17 @@ function useUnpinnedRendering(params) {
5493
5587
  }
5494
5588
 
5495
5589
  // src/components/InfiniteTable/hooks/useOnContainerScroll.ts
5496
- var import_react34 = __toModule(require("react"));
5590
+ var import_react35 = __toModule(require("react"));
5497
5591
 
5498
5592
  // src/components/InfiniteTable/InfiniteCls.css.ts
5593
+ var import_createRuntimeFn4 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
5499
5594
  var FooterCls = "_16lm1iw1";
5500
5595
  var InfiniteCls = "_1yeub2v0 _16lm1iw1 _16lm1iwj _16lm1iwz _16lm1iw0";
5501
- var InfiniteClsRecipe = createRuntimeFn({ defaultClassName: "", variantClassNames: { focused: { true: "_1yeub2v2", false: "_1yeub2v3" }, focusedWithin: { true: "_1yeub2v4", false: "_1yeub2v5" }, hasPinnedStart: { true: "_1yeub2v6", false: "_1yeub2v7" }, hasPinnedEnd: { true: "_1yeub2v8", false: "_1yeub2v9" }, hasPinnedStartOverflow: { true: "_1yeub2va", false: "_1yeub2vb" }, hasPinnedEndOverflow: { true: "_1yeub2vc", false: "_1yeub2vd" } }, defaultVariants: {}, compoundVariants: [] });
5596
+ var InfiniteClsRecipe = (0, import_createRuntimeFn4.createRuntimeFn)({ defaultClassName: "", variantClassNames: { focused: { true: "_1yeub2v2", false: "_1yeub2v3" }, focusedWithin: { true: "_1yeub2v4", false: "_1yeub2v5" }, hasPinnedStart: { true: "_1yeub2v6", false: "_1yeub2v7" }, hasPinnedEnd: { true: "_1yeub2v8", false: "_1yeub2v9" }, hasPinnedStartOverflow: { true: "_1yeub2va", false: "_1yeub2vb" }, hasPinnedEndOverflow: { true: "_1yeub2vc", false: "_1yeub2vd" } }, defaultVariants: {}, compoundVariants: [] });
5502
5597
  var InfiniteClsScrolling = "_1yeub2v1";
5503
5598
  var InfiniteClsShiftingColumns = "_16lm1iwm";
5504
5599
  var PinnedRowsClsVariants = { pinnedStart: "_1yeub2ve", pinnedEnd: "_1yeub2vf", overflow: "_1yeub2vg" };
5505
- var PinnedRowsContainerClsVariants = createRuntimeFn({ defaultClassName: "", variantClassNames: { pinned: { start: "_1yeub2vh", end: "_1yeub2vi", false: "_1yeub2vj" } }, defaultVariants: {}, compoundVariants: [] });
5600
+ var PinnedRowsContainerClsVariants = (0, import_createRuntimeFn4.createRuntimeFn)({ defaultClassName: "", variantClassNames: { pinned: { start: "_1yeub2vh", end: "_1yeub2vi", false: "_1yeub2vj" } }, defaultVariants: {}, compoundVariants: [] });
5506
5601
 
5507
5602
  // src/components/InfiniteTable/hooks/useOnContainerScroll.ts
5508
5603
  var DELAY = 200;
@@ -5524,14 +5619,14 @@ var useOnContainerScroll = ({
5524
5619
  bodySize
5525
5620
  }
5526
5621
  } = useInfiniteTable();
5527
- const timeoutIdRef = (0, import_react34.useRef)(0);
5528
- const scrollingRef = (0, import_react34.useRef)(false);
5529
- const scrollTopMaxRef = (0, import_react34.useRef)(0);
5530
- (0, import_react34.useEffect)(() => {
5622
+ const timeoutIdRef = (0, import_react35.useRef)(0);
5623
+ const scrollingRef = (0, import_react35.useRef)(false);
5624
+ const scrollTopMaxRef = (0, import_react35.useRef)(0);
5625
+ (0, import_react35.useEffect)(() => {
5531
5626
  const { current: node } = scrollerDOMRef;
5532
5627
  scrollTopMaxRef.current = node.scrollHeight - node.clientHeight;
5533
5628
  }, [reservedContentHeight, bodySize.height]);
5534
- const setScrolling = (0, import_react34.useCallback)((scrolling) => {
5629
+ const setScrolling = (0, import_react35.useCallback)((scrolling) => {
5535
5630
  var _a;
5536
5631
  const prevScrolling = scrollingRef.current;
5537
5632
  scrollingRef.current = scrolling;
@@ -5556,7 +5651,7 @@ var useOnContainerScroll = ({
5556
5651
  }
5557
5652
  }
5558
5653
  }, []);
5559
- const onContainerScroll = (0, import_react34.useCallback)((scrollInfo) => {
5654
+ const onContainerScroll = (0, import_react35.useCallback)((scrollInfo) => {
5560
5655
  verticalVirtualBrain.setScrollPosition(scrollInfo);
5561
5656
  horizontalVirtualBrain.setScrollPosition(scrollInfo);
5562
5657
  setScrolling(true);
@@ -5566,15 +5661,15 @@ var useOnContainerScroll = ({
5566
5661
  domRef.current,
5567
5662
  setScrolling
5568
5663
  ]);
5569
- const scrollPositionRef = (0, import_react34.useRef)({
5664
+ const scrollPositionRef = (0, import_react35.useRef)({
5570
5665
  scrollLeft: 0,
5571
5666
  scrollTop: 0
5572
5667
  });
5573
- const applyScrollHorizontal = (0, import_react34.useCallback)(({ scrollLeft }) => {
5668
+ const applyScrollHorizontal = (0, import_react35.useCallback)(({ scrollLeft }) => {
5574
5669
  scrollPositionRef.current.scrollLeft = scrollLeft;
5575
5670
  onContainerScroll(scrollPositionRef.current);
5576
5671
  }, [onContainerScroll]);
5577
- const applyScrollVertical = (0, import_react34.useCallback)(({ scrollTop }) => {
5672
+ const applyScrollVertical = (0, import_react35.useCallback)(({ scrollTop }) => {
5578
5673
  scrollPositionRef.current.scrollTop = scrollTop;
5579
5674
  onContainerScroll(scrollPositionRef.current);
5580
5675
  if (scrollTop === 0) {
@@ -5594,16 +5689,16 @@ var useOnContainerScroll = ({
5594
5689
 
5595
5690
  // src/components/InfiniteTable/hooks/usePinnedRendering.tsx
5596
5691
  var React32 = __toModule(require("react"));
5597
- var import_react37 = __toModule(require("react"));
5692
+ var import_react38 = __toModule(require("react"));
5598
5693
 
5599
5694
  // src/components/VirtualList/RowListWithExternalScrolling.tsx
5600
5695
  var React31 = __toModule(require("react"));
5601
- var import_react36 = __toModule(require("react"));
5696
+ var import_react37 = __toModule(require("react"));
5602
5697
 
5603
5698
  // src/components/hooks/useOnMount.ts
5604
- var import_react35 = __toModule(require("react"));
5699
+ var import_react36 = __toModule(require("react"));
5605
5700
  function useOnMount(domRef, props) {
5606
- (0, import_react35.useEffect)(() => {
5701
+ (0, import_react36.useEffect)(() => {
5607
5702
  const { onMount, onUnmount } = props;
5608
5703
  const node = domRef == null ? void 0 : domRef.current;
5609
5704
  onMount == null ? void 0 : onMount(node);
@@ -5634,8 +5729,8 @@ var RowListWithExternalScrolling = (props) => {
5634
5729
  onMount,
5635
5730
  onUnmount
5636
5731
  } = props;
5637
- const domRef = (0, import_react36.useRef)(null);
5638
- const renderItem = (0, import_react36.useCallback)((renderProps) => renderRow({
5732
+ const domRef = (0, import_react37.useRef)(null);
5733
+ const renderItem = (0, import_react37.useCallback)((renderProps) => renderRow({
5639
5734
  domRef: renderProps.domRef,
5640
5735
  rowHeight: renderProps.itemSize,
5641
5736
  rowIndex: renderProps.itemIndex
@@ -5644,7 +5739,7 @@ var RowListWithExternalScrolling = (props) => {
5644
5739
  onMount,
5645
5740
  onUnmount
5646
5741
  });
5647
- (0, import_react36.useEffect)(() => {
5742
+ (0, import_react37.useEffect)(() => {
5648
5743
  const onScroll = (scrollPosition) => {
5649
5744
  const node = domRef.current;
5650
5745
  if (node) {
@@ -5711,7 +5806,7 @@ function PinnedRowsContainer(props) {
5711
5806
  }
5712
5807
  return result;
5713
5808
  }, [height, rowWidth, pinning, hasOverflow]);
5714
- const updateScroll = (0, import_react37.useCallback)((node, scrollPosition) => {
5809
+ const updateScroll = (0, import_react38.useCallback)((node, scrollPosition) => {
5715
5810
  UPDATE_SCROLL3(node, scrollPosition, hasOverflow ? pinnedScrollListener.getScrollPosition() : void 0);
5716
5811
  }, [hasOverflow, pinnedScrollListener]);
5717
5812
  const rowListProps = {
@@ -5753,7 +5848,7 @@ function PinnedRowsContainer(props) {
5753
5848
  }
5754
5849
  function useRenderPinnedRow(params) {
5755
5850
  const { getData, getState, columnsWidth, columns, verticalBrain } = params;
5756
- const renderPinnedRow = (0, import_react37.useCallback)((rowParams) => {
5851
+ const renderPinnedRow = (0, import_react38.useCallback)((rowParams) => {
5757
5852
  const dataArray = getData();
5758
5853
  const rowInfo = dataArray[rowParams.rowIndex];
5759
5854
  const { showZebraRows, showHoverRows } = getState();
@@ -5867,7 +5962,7 @@ function usePinnedStartRendering(params) {
5867
5962
  }
5868
5963
 
5869
5964
  // src/components/InfiniteTable/hooks/useYourBrain.ts
5870
- var import_react39 = __toModule(require("react"));
5965
+ var import_react40 = __toModule(require("react"));
5871
5966
 
5872
5967
  // src/components/VirtualBrain/index.ts
5873
5968
  var import_binary_search2 = __toModule(require_binary_search());
@@ -5883,11 +5978,13 @@ var VirtualBrain = class extends Logger {
5883
5978
  super(`VirtualBrain:${options.mainAxis}`);
5884
5979
  this.scrollPosition = initialScrollPosition2;
5885
5980
  this.scrollPositionOnMainAxis = 0;
5981
+ this.destroyed = false;
5886
5982
  this.totalSize = 0;
5887
5983
  this.onScrollFns = [];
5888
5984
  this.onTotalSizeChangeFns = [];
5889
5985
  this.onRenderCountChangeFns = [];
5890
5986
  this.onRenderRangeChangeFns = [];
5987
+ this.onDestroyFns = [];
5891
5988
  this.renderCount = 0;
5892
5989
  this.renderRange = {
5893
5990
  renderStartIndex: -1,
@@ -5984,6 +6081,12 @@ var VirtualBrain = class extends Logger {
5984
6081
  this.onRenderRangeChangeFns = this.onRenderRangeChangeFns.filter((f) => f !== fn);
5985
6082
  };
5986
6083
  };
6084
+ this.onDestroy = (fn) => {
6085
+ this.onDestroyFns.push(fn);
6086
+ return () => {
6087
+ this.onDestroyFns = this.onDestroyFns.filter((f) => f !== fn);
6088
+ };
6089
+ };
5987
6090
  this.update = (newCount, newItemSize, newItemSpan) => {
5988
6091
  const { itemSize, count, itemSpan } = this.options;
5989
6092
  const countChange = count !== newCount;
@@ -6180,7 +6283,13 @@ var VirtualBrain = class extends Logger {
6180
6283
  return result;
6181
6284
  };
6182
6285
  this.destroy = () => {
6286
+ if (this.destroyed) {
6287
+ return;
6288
+ }
6289
+ this.notifyDestroy();
6183
6290
  this.reset();
6291
+ this.destroyed = true;
6292
+ this.onDestroyFns = [];
6184
6293
  this.onScrollFns = [];
6185
6294
  this.onTotalSizeChangeFns = [];
6186
6295
  this.onRenderCountChangeFns = [];
@@ -6216,6 +6325,12 @@ var VirtualBrain = class extends Logger {
6216
6325
  fns[i](scrollPosition);
6217
6326
  }
6218
6327
  }
6328
+ notifyDestroy() {
6329
+ const fns = this.onDestroyFns;
6330
+ for (let i = 0, len = fns.length; i < len; i++) {
6331
+ fns[i]();
6332
+ }
6333
+ }
6219
6334
  notifyTotalSizeChange() {
6220
6335
  const totalSize = this.getTotalSize();
6221
6336
  const fns = this.onTotalSizeChangeFns;
@@ -6285,9 +6400,9 @@ var VirtualBrain = class extends Logger {
6285
6400
  };
6286
6401
 
6287
6402
  // src/components/InfiniteTable/hooks/useColumnSizeFn.ts
6288
- var import_react38 = __toModule(require("react"));
6403
+ var import_react39 = __toModule(require("react"));
6289
6404
  function useColumnSizeFn(computedUnpinnedColumns) {
6290
- const columnSize = (0, import_react38.useCallback)((index) => {
6405
+ const columnSize = (0, import_react39.useCallback)((index) => {
6291
6406
  const column = computedUnpinnedColumns[index];
6292
6407
  if (!column) {
6293
6408
  console.log("cannot find column at index", index, computedUnpinnedColumns);
@@ -6326,16 +6441,21 @@ function useYourBrain(param) {
6326
6441
  });
6327
6442
  return brain;
6328
6443
  });
6444
+ (0, import_react40.useEffect)(() => {
6445
+ return () => {
6446
+ horizontalVirtualBrain.destroy();
6447
+ verticalVirtualBrain.destroy();
6448
+ };
6449
+ }, []);
6329
6450
  horizontalVirtualBrain.update(computedUnpinnedColumns.length, columnSize);
6330
6451
  verticalVirtualBrain.update(dataArray.length, rowHeight, rowSpan);
6331
- globalThis.verticalVirtualBrain = verticalVirtualBrain;
6332
- (0, import_react39.useEffect)(() => {
6452
+ (0, import_react40.useEffect)(() => {
6333
6453
  verticalVirtualBrain.setAvailableSize({
6334
6454
  height: bodySize.height,
6335
6455
  width: 0
6336
6456
  });
6337
6457
  }, [bodySize, verticalVirtualBrain]);
6338
- (0, import_react39.useEffect)(() => {
6458
+ (0, import_react40.useEffect)(() => {
6339
6459
  horizontalVirtualBrain.setAvailableSize({
6340
6460
  height: 0,
6341
6461
  width: Math.max(bodySize.width - computedPinnedStartWidth - computedPinnedEndWidth, 0)
@@ -6396,12 +6516,12 @@ function useListRendering(param) {
6396
6516
  pinnedEndScrollListener
6397
6517
  } = componentState;
6398
6518
  const prevDataSourceTimestamp = usePrevious(dataSourceState.updatedAt);
6399
- const repaintIdRef = (0, import_react40.useRef)(0);
6519
+ const repaintIdRef = (0, import_react41.useRef)(0);
6400
6520
  if (!shallowEqualObjects(prevComputed, computed) || prevDataSourceTimestamp !== dataSourceState.updatedAt) {
6401
6521
  repaintIdRef.current++;
6402
6522
  }
6403
6523
  const repaintId = repaintIdRef.current;
6404
- const rowSpan = (0, import_react40.useMemo)(() => {
6524
+ const rowSpan = (0, import_react41.useMemo)(() => {
6405
6525
  const colsWithRowspan = computedVisibleColumns.filter((col) => typeof col.rowspan === "function");
6406
6526
  return colsWithRowspan.length ? ({ itemIndex }) => {
6407
6527
  let maxSpan = 1;
@@ -6439,11 +6559,11 @@ function useListRendering(param) {
6439
6559
  const hasHorizontalScrollbar = computedUnpinnedColumnsWidth > bodySize.width - computedPinnedStartColumnsWidth - computedPinnedEndColumnsWidth;
6440
6560
  const reservedContentHeight = verticalVirtualBrain.getTotalSize() + (hasHorizontalScrollbar ? getScrollbarWidth() : 0);
6441
6561
  const hasVerticalScrollbar = bodySize.height < reservedContentHeight;
6442
- const scrollbars = (0, import_react40.useMemo)(() => ({
6562
+ const scrollbars = (0, import_react41.useMemo)(() => ({
6443
6563
  vertical: hasVerticalScrollbar,
6444
6564
  horizontal: hasHorizontalScrollbar
6445
6565
  }), [hasVerticalScrollbar, hasHorizontalScrollbar]);
6446
- (0, import_react40.useEffect)(() => {
6566
+ (0, import_react41.useEffect)(() => {
6447
6567
  if (!bodySize.height) {
6448
6568
  return;
6449
6569
  }
@@ -6469,7 +6589,7 @@ function useListRendering(param) {
6469
6589
  reservedContentHeight
6470
6590
  });
6471
6591
  const { componentActions: dataSourceActions } = useDataSourceContextValue();
6472
- const toggleGroupRow = (0, import_react40.useCallback)((groupKeys) => {
6592
+ const toggleGroupRow = (0, import_react41.useCallback)((groupKeys) => {
6473
6593
  const newState = new GroupRowsState(getDataSourceState().groupRowsState);
6474
6594
  newState.toggleGroupRow(groupKeys);
6475
6595
  dataSourceActions.groupRowsState = newState;
@@ -6504,7 +6624,7 @@ function useListRendering(param) {
6504
6624
  computedUnpinnedColumns
6505
6625
  });
6506
6626
  const [, rerender] = useRerender();
6507
- (0, import_react40.useEffect)(() => {
6627
+ (0, import_react41.useEffect)(() => {
6508
6628
  rerender();
6509
6629
  }, [dataSourceState]);
6510
6630
  const { pinnedStartList, pinnedStartScrollbarPlaceholder } = usePinnedStartRendering(pinnedRenderingParams);
@@ -6528,7 +6648,7 @@ function useListRendering(param) {
6528
6648
 
6529
6649
  // src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
6530
6650
  var React33 = __toModule(require("react"));
6531
- var import_react41 = __toModule(require("react"));
6651
+ var import_react42 = __toModule(require("react"));
6532
6652
 
6533
6653
  // src/components/utils/decamelize.ts
6534
6654
  var import_decamelize = __toModule(require_decamelize());
@@ -6578,7 +6698,7 @@ var InfiniteTableLicenseFooter = React33.forwardRef(function InfiniteTableLicens
6578
6698
  ref.current = node;
6579
6699
  }
6580
6700
  }, []);
6581
- (0, import_react41.useEffect)(() => {
6701
+ (0, import_react42.useEffect)(() => {
6582
6702
  const forceStyle = () => {
6583
6703
  requestAnimationFrame(() => {
6584
6704
  var _a;
@@ -6606,7 +6726,7 @@ var InfiniteTableLicenseFooter = React33.forwardRef(function InfiniteTableLicens
6606
6726
  });
6607
6727
 
6608
6728
  // src/components/InfiniteTable/hooks/useLicense/useLicense.ts
6609
- var import_react42 = __toModule(require("react"));
6729
+ var import_react43 = __toModule(require("react"));
6610
6730
 
6611
6731
  // src/components/InfiniteTable/hooks/useLicense/crc32.ts
6612
6732
  var DEFAULT_ReversedPolynomial = 3988292384;
@@ -6756,10 +6876,10 @@ var origin = typeof window !== "undefined" ? window.location.origin : "";
6756
6876
  var [_fullUrl, protocol, sandboxUrl] = Array.from(SANDBOX_REGEX.exec(origin) || []);
6757
6877
  var isInsideSandbox = protocol === "https" && sandboxUrl === "sandpack.codesandbox.io";
6758
6878
  var useLicense = (licenseKey) => {
6759
- const valid = (0, import_react42.useMemo)(() => {
6879
+ const valid = (0, import_react43.useMemo)(() => {
6760
6880
  let valid2 = isValidLicense(licenseKey, {
6761
6881
  publishedAt: 1624970570587,
6762
- version: "0.0.6"
6882
+ version: "0.0.7"
6763
6883
  });
6764
6884
  if (!licenseKey && !valid2 && isInsideSandbox) {
6765
6885
  return true;
@@ -6771,7 +6891,7 @@ var useLicense = (licenseKey) => {
6771
6891
 
6772
6892
  // src/components/CSSVariableWatch.tsx
6773
6893
  var React34 = __toModule(require("react"));
6774
- var import_react43 = __toModule(require("react"));
6894
+ var import_react44 = __toModule(require("react"));
6775
6895
  var error2 = err("CSSVariableWatch");
6776
6896
  var debug5 = dbg("CSSVariableWatch");
6777
6897
  var WRAPPER_STYLE = {
@@ -6784,7 +6904,7 @@ var WRAPPER_STYLE = {
6784
6904
  overflow: "hidden"
6785
6905
  };
6786
6906
  var useCSSVariableWatch = (params) => {
6787
- const lastValueRef = (0, import_react43.useRef)(0);
6907
+ const lastValueRef = (0, import_react44.useRef)(0);
6788
6908
  const onResize = React34.useCallback(({ height }) => {
6789
6909
  if (height && height !== lastValueRef.current) {
6790
6910
  lastValueRef.current = height;
@@ -6804,7 +6924,7 @@ var useCSSVariableWatch = (params) => {
6804
6924
  }, []);
6805
6925
  };
6806
6926
  var CSSVariableWatch = (props) => {
6807
- const domRef = (0, import_react43.useRef)(null);
6927
+ const domRef = (0, import_react44.useRef)(null);
6808
6928
  useCSSVariableWatch(__spreadProps(__spreadValues({}, props), {
6809
6929
  ref: domRef
6810
6930
  }));