@infinite-table/infinite-react 0.0.6 → 0.0.10

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
@@ -53,26 +53,6 @@ var __reExport = (target, module2, desc) => {
53
53
  var __toModule = (module2) => {
54
54
  return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
55
55
  };
56
- var __async = (__this, __arguments, generator) => {
57
- return new Promise((resolve, reject) => {
58
- var fulfilled = (value) => {
59
- try {
60
- step(generator.next(value));
61
- } catch (e) {
62
- reject(e);
63
- }
64
- };
65
- var rejected = (value) => {
66
- try {
67
- step(generator.throw(value));
68
- } catch (e) {
69
- reject(e);
70
- }
71
- };
72
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
73
- step((generator = generator.apply(__this, __arguments)).next());
74
- });
75
- };
76
56
 
77
57
  // node_modules/ms/index.js
78
58
  var require_ms = __commonJS({
@@ -216,6 +196,8 @@ var require_common = __commonJS({
216
196
  function createDebug(namespace) {
217
197
  let prevTime;
218
198
  let enableOverride = null;
199
+ let namespacesCache;
200
+ let enabledCache;
219
201
  function debug6(...args) {
220
202
  if (!debug6.enabled) {
221
203
  return;
@@ -258,7 +240,16 @@ var require_common = __commonJS({
258
240
  Object.defineProperty(debug6, "enabled", {
259
241
  enumerable: true,
260
242
  configurable: false,
261
- get: () => enableOverride === null ? createDebug.enabled(namespace) : enableOverride,
243
+ get: () => {
244
+ if (enableOverride !== null) {
245
+ return enableOverride;
246
+ }
247
+ if (namespacesCache !== createDebug.namespaces) {
248
+ namespacesCache = createDebug.namespaces;
249
+ enabledCache = createDebug.enabled(namespace);
250
+ }
251
+ return enabledCache;
252
+ },
262
253
  set: (v) => {
263
254
  enableOverride = v;
264
255
  }
@@ -275,6 +266,7 @@ var require_common = __commonJS({
275
266
  }
276
267
  function enable(namespaces) {
277
268
  createDebug.save(namespaces);
269
+ createDebug.namespaces = namespaces;
278
270
  createDebug.names = [];
279
271
  createDebug.skips = [];
280
272
  let i;
@@ -470,14 +462,14 @@ var require_browser = __commonJS({
470
462
  } else {
471
463
  exports.storage.removeItem("debug");
472
464
  }
473
- } catch (error3) {
465
+ } catch (error2) {
474
466
  }
475
467
  }
476
468
  function load() {
477
469
  let r;
478
470
  try {
479
471
  r = exports.storage.getItem("debug");
480
- } catch (error3) {
472
+ } catch (error2) {
481
473
  }
482
474
  if (!r && typeof process !== "undefined" && "env" in process) {
483
475
  r = process.env.DEBUG;
@@ -487,7 +479,7 @@ var require_browser = __commonJS({
487
479
  function localstorage() {
488
480
  try {
489
481
  return localStorage;
490
- } catch (error3) {
482
+ } catch (error2) {
491
483
  }
492
484
  }
493
485
  module2.exports = require_common()(exports);
@@ -495,10 +487,103 @@ var require_browser = __commonJS({
495
487
  formatters.j = function(v) {
496
488
  try {
497
489
  return JSON.stringify(v);
498
- } catch (error3) {
499
- return "[UnexpectedJSONParseError]: " + error3.message;
490
+ } catch (error2) {
491
+ return "[UnexpectedJSONParseError]: " + error2.message;
492
+ }
493
+ };
494
+ }
495
+ });
496
+
497
+ // node_modules/@vanilla-extract/recipes/createRuntimeFn/dist/vanilla-extract-recipes-createRuntimeFn.cjs.dev.js
498
+ var require_vanilla_extract_recipes_createRuntimeFn_cjs_dev = __commonJS({
499
+ "node_modules/@vanilla-extract/recipes/createRuntimeFn/dist/vanilla-extract-recipes-createRuntimeFn.cjs.dev.js"(exports) {
500
+ "use strict";
501
+ Object.defineProperty(exports, "__esModule", { value: true });
502
+ function _defineProperty(obj, key, value) {
503
+ if (key in obj) {
504
+ Object.defineProperty(obj, key, {
505
+ value,
506
+ enumerable: true,
507
+ configurable: true,
508
+ writable: true
509
+ });
510
+ } else {
511
+ obj[key] = value;
512
+ }
513
+ return obj;
514
+ }
515
+ function ownKeys(object, enumerableOnly) {
516
+ var keys = Object.keys(object);
517
+ if (Object.getOwnPropertySymbols) {
518
+ var symbols = Object.getOwnPropertySymbols(object);
519
+ if (enumerableOnly) {
520
+ symbols = symbols.filter(function(sym) {
521
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
522
+ });
523
+ }
524
+ keys.push.apply(keys, symbols);
500
525
  }
526
+ return keys;
527
+ }
528
+ function _objectSpread2(target) {
529
+ for (var i = 1; i < arguments.length; i++) {
530
+ var source = arguments[i] != null ? arguments[i] : {};
531
+ if (i % 2) {
532
+ ownKeys(Object(source), true).forEach(function(key) {
533
+ _defineProperty(target, key, source[key]);
534
+ });
535
+ } else if (Object.getOwnPropertyDescriptors) {
536
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
537
+ } else {
538
+ ownKeys(Object(source)).forEach(function(key) {
539
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
540
+ });
541
+ }
542
+ }
543
+ return target;
544
+ }
545
+ var shouldApplyCompound = (compoundCheck, selections) => {
546
+ for (var key of Object.keys(compoundCheck)) {
547
+ if (compoundCheck[key] !== selections[key]) {
548
+ return false;
549
+ }
550
+ }
551
+ return true;
552
+ };
553
+ var createRuntimeFn = (config) => (options) => {
554
+ var className = config.defaultClassName;
555
+ var selections = _objectSpread2(_objectSpread2({}, config.defaultVariants), options);
556
+ for (var variantName in selections) {
557
+ var _selections$variantNa;
558
+ var variantSelection = (_selections$variantNa = selections[variantName]) !== null && _selections$variantNa !== void 0 ? _selections$variantNa : config.defaultVariants[variantName];
559
+ if (variantSelection != null) {
560
+ var selection = variantSelection;
561
+ if (typeof selection === "boolean") {
562
+ selection = selection === true ? "true" : "false";
563
+ }
564
+ className += " " + config.variantClassNames[variantName][selection];
565
+ }
566
+ }
567
+ for (var [compoundCheck, compoundClassName] of config.compoundVariants) {
568
+ if (shouldApplyCompound(compoundCheck, selections)) {
569
+ className += " " + compoundClassName;
570
+ }
571
+ }
572
+ return className;
501
573
  };
574
+ exports.createRuntimeFn = createRuntimeFn;
575
+ }
576
+ });
577
+
578
+ // node_modules/@vanilla-extract/recipes/createRuntimeFn/dist/vanilla-extract-recipes-createRuntimeFn.cjs.js
579
+ var require_vanilla_extract_recipes_createRuntimeFn_cjs = __commonJS({
580
+ "node_modules/@vanilla-extract/recipes/createRuntimeFn/dist/vanilla-extract-recipes-createRuntimeFn.cjs.js"(exports, module2) {
581
+ "use strict";
582
+ if (false) {
583
+ module2.exports = null;
584
+ } else {
585
+ module2.exports = require_vanilla_extract_recipes_createRuntimeFn_cjs_dev();
586
+ }
502
587
  }
503
588
  });
504
589
 
@@ -536,38 +621,6 @@ var require_binary_search = __commonJS({
536
621
  }
537
622
  });
538
623
 
539
- // node_modules/decamelize/index.js
540
- var require_decamelize = __commonJS({
541
- "node_modules/decamelize/index.js"(exports, module2) {
542
- "use strict";
543
- var handlePreserveConsecutiveUppercase = (decamelized, separator) => {
544
- decamelized = decamelized.replace(/((?<![\p{Uppercase_Letter}\d])[\p{Uppercase_Letter}\d](?![\p{Uppercase_Letter}\d]))/gu, ($0) => {
545
- return $0.toLowerCase();
546
- });
547
- return decamelized.replace(/(\p{Uppercase_Letter}+)(\p{Uppercase_Letter}\p{Lowercase_Letter}+)/gu, (_, $1, $2) => {
548
- return $1 + separator + $2.toLowerCase();
549
- });
550
- };
551
- module2.exports = (text, {
552
- separator = "_",
553
- preserveConsecutiveUppercase = false
554
- } = {}) => {
555
- if (!(typeof text === "string" && typeof separator === "string")) {
556
- throw new TypeError("The `text` and `separator` arguments should be of type `string`");
557
- }
558
- if (text.length < 2) {
559
- return preserveConsecutiveUppercase ? text : text.toLowerCase();
560
- }
561
- const replacement = `$1${separator}$2`;
562
- const decamelized = text.replace(/([\p{Lowercase_Letter}\d])(\p{Uppercase_Letter})/gu, replacement);
563
- if (preserveConsecutiveUppercase) {
564
- return handlePreserveConsecutiveUppercase(decamelized, separator);
565
- }
566
- return decamelized.replace(/(\p{Uppercase_Letter}+)(\p{Uppercase_Letter}\p{Lowercase_Letter}+)/gu, replacement).toLowerCase();
567
- };
568
- }
569
- });
570
-
571
624
  // src/index.tsx
572
625
  __export(exports, {
573
626
  DataSource: () => DataSource,
@@ -580,6 +633,7 @@ __export(exports, {
580
633
  getComponentStateRoot: () => getComponentStateRoot,
581
634
  group: () => group,
582
635
  interceptMap: () => interceptMap,
636
+ multisort: () => multisort,
583
637
  useComponentState: () => useComponentState,
584
638
  useDataSource: () => useDataSource
585
639
  });
@@ -667,7 +721,7 @@ var ScrollListener = class {
667
721
 
668
722
  // src/components/InfiniteTable/state/computeColumnGroupsDepths.ts
669
723
  function computeColumnGroupsDepths(columnGroups) {
670
- const map = new Map();
724
+ const map2 = new Map();
671
725
  columnGroups.forEach((colGroup, colGroupId) => {
672
726
  let parentGroupId = colGroup.columnGroup;
673
727
  let depth = 0;
@@ -682,12 +736,24 @@ function computeColumnGroupsDepths(columnGroups) {
682
736
  depth++;
683
737
  parentGroupId = parent.columnGroup;
684
738
  }
685
- map.set(colGroupId, depth);
739
+ map2.set(colGroupId, depth);
686
740
  });
687
- return map;
741
+ return map2;
688
742
  }
689
743
 
690
744
  // src/components/InfiniteTable/state/getInitialState.ts
745
+ function toMap(mapOrObject) {
746
+ if (!mapOrObject) {
747
+ return new Map();
748
+ }
749
+ if (mapOrObject instanceof Map) {
750
+ return mapOrObject;
751
+ }
752
+ return new Map(Object.entries(mapOrObject));
753
+ }
754
+ function toColumnTypesMap(mapOrObject) {
755
+ return toMap(mapOrObject);
756
+ }
691
757
  function initSetupState() {
692
758
  const columnsGeneratedForGrouping = new Map();
693
759
  return {
@@ -717,7 +783,11 @@ function initSetupState() {
717
783
  }
718
784
  var forwardProps = () => {
719
785
  return {
720
- columns: 1,
786
+ columns: (columns) => {
787
+ var _a;
788
+ return (_a = toMap(columns)) != null ? _a : new Map();
789
+ },
790
+ scrollTopId: 1,
721
791
  components: 1,
722
792
  loadingText: 1,
723
793
  pivotColumns: 1,
@@ -743,15 +813,17 @@ var forwardProps = () => {
743
813
  pivotColumn: 1,
744
814
  pivotRowLabelsColumn: 1,
745
815
  pivotColumnGroups: 1,
816
+ onScrollbarsChange: 1,
817
+ viewportReservedWidth: (viewportReservedWidth) => viewportReservedWidth != null ? viewportReservedWidth : 0,
746
818
  activeIndex: (activeIndex) => activeIndex != null ? activeIndex : 0,
747
819
  columnMinWidth: (columnMinWidth) => columnMinWidth != null ? columnMinWidth : 30,
748
820
  columnMaxWidth: (columnMaxWidth) => columnMaxWidth != null ? columnMaxWidth : 2e3,
749
- columnDefaultWidth: (columnDefaultWidth) => columnDefaultWidth != null ? columnDefaultWidth : 300,
821
+ columnDefaultWidth: (columnDefaultWidth) => columnDefaultWidth != null ? columnDefaultWidth : 200,
750
822
  draggableColumns: (draggableColumns) => draggableColumns != null ? draggableColumns : true,
751
823
  sortable: (sortable) => sortable != null ? sortable : true,
752
824
  hideEmptyGroupColumns: (hideEmptyGroupColumns) => hideEmptyGroupColumns != null ? hideEmptyGroupColumns : false,
753
825
  pivotTotalColumnPosition: (pivotTotalColumnPosition) => pivotTotalColumnPosition != null ? pivotTotalColumnPosition : "end",
754
- licenseKey: (licenseKey) => licenseKey || globalThis.InfiniteTableLicenseKey || "",
826
+ licenseKey: (licenseKey) => licenseKey || "",
755
827
  columnOrder: (columnOrder) => columnOrder != null ? columnOrder : true,
756
828
  header: (header) => header != null ? header : true,
757
829
  showZebraRows: (showZebraRows) => showZebraRows != null ? showZebraRows : true,
@@ -761,6 +833,14 @@ var forwardProps = () => {
761
833
  headerHeight: (headerHeight) => typeof headerHeight === "number" ? headerHeight : 0,
762
834
  columnVisibility: (columnVisibility) => columnVisibility != null ? columnVisibility : new Map(),
763
835
  columnPinning: (columnPinning) => columnPinning != null ? columnPinning : new Map(),
836
+ columnSizing: (columnSizing) => {
837
+ var _a;
838
+ return (_a = toMap(columnSizing)) != null ? _a : new Map();
839
+ },
840
+ columnTypes: (columnTypes) => {
841
+ var _a;
842
+ return (_a = toColumnTypesMap(columnTypes)) != null ? _a : new Map();
843
+ },
764
844
  columnAggregations: (columnAggregations) => columnAggregations != null ? columnAggregations : new Map(),
765
845
  collapsedColumnGroups: (collapsedColumnGroups) => collapsedColumnGroups != null ? collapsedColumnGroups : new Map(),
766
846
  columnGroups: (columnGroups) => columnGroups != null ? columnGroups : new Map()
@@ -795,7 +875,7 @@ var mapPropsToState = (params) => {
795
875
  return {
796
876
  groupRenderStrategy,
797
877
  groupRowsBy,
798
- computedColumns: state.computedPivotColumns || state.columnsWhenGrouping || state.columnsWhenInlineGroupRenderStrategy || props.columns,
878
+ computedColumns: state.computedPivotColumns || state.columnsWhenGrouping || state.columnsWhenInlineGroupRenderStrategy || state.columns,
799
879
  virtualizeHeader,
800
880
  columnGroupsDepthsMap,
801
881
  columnGroupsMaxDepth: columnGroupsDepthsMap != state.columnGroupsDepthsMap ? Math.max(...columnGroupsDepthsMap.values(), 0) : state.columnGroupsMaxDepth,
@@ -927,7 +1007,7 @@ var computeFlex = (params) => {
927
1007
  items.forEach((item, i) => {
928
1008
  var _a, _b, _c, _d, _e, _f;
929
1009
  let maxSize = (_b = (_a = item.maxSize) != null ? _a : defaultMaxSize) != null ? _b : void 0;
930
- let minSize = (_d = (_c = item.maxSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
1010
+ let minSize = (_d = (_c = item.minSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
931
1011
  if (item.size != null) {
932
1012
  if (maxSize != null && item.size > maxSize) {
933
1013
  item.size = maxSize;
@@ -955,7 +1035,7 @@ var computeFlex = (params) => {
955
1035
  if (item.flex != null) {
956
1036
  const approxFlexSize = sizePerFlex * item.flex;
957
1037
  let maxSize = (_b = (_a = item.maxSize) != null ? _a : defaultMaxSize) != null ? _b : void 0;
958
- let minSize = (_d = (_c = item.maxSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
1038
+ let minSize = (_d = (_c = item.minSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
959
1039
  let constrained = false;
960
1040
  let substractSize = 0;
961
1041
  if (maxSize != null && approxFlexSize > maxSize) {
@@ -1090,8 +1170,52 @@ var Logger = class {
1090
1170
  }
1091
1171
  };
1092
1172
 
1173
+ // src/utils/getGlobal.ts
1174
+ function getGlobal() {
1175
+ return globalThis;
1176
+ }
1177
+
1178
+ // src/components/utils/getScrollbarWidth.ts
1179
+ var scrollbarWidth;
1180
+ function getScrollbarWidth() {
1181
+ var _a, _b;
1182
+ if (scrollbarWidth != null) {
1183
+ return scrollbarWidth;
1184
+ }
1185
+ const doc = (_a = getGlobal().document) != null ? _a : null;
1186
+ if (!doc) {
1187
+ return 0;
1188
+ }
1189
+ const outer = doc.createElement("div");
1190
+ outer.style.visibility = "hidden";
1191
+ outer.style.overflow = "scroll";
1192
+ doc.body.appendChild(outer);
1193
+ const inner = doc.createElement("div");
1194
+ outer.appendChild(inner);
1195
+ scrollbarWidth = outer.offsetWidth - inner.offsetWidth;
1196
+ (_b = outer.parentNode) == null ? void 0 : _b.removeChild(outer);
1197
+ return scrollbarWidth;
1198
+ }
1199
+
1200
+ // src/components/InfiniteTable/utils/getColumnComputedType.ts
1201
+ var emptyType = Object.freeze({});
1202
+ function getColumnComputedType(column, columnTypes) {
1203
+ const defaultType = columnTypes.get("default") || emptyType;
1204
+ if (column.type === void 0) {
1205
+ return defaultType;
1206
+ }
1207
+ if (column.type === null) {
1208
+ return emptyType;
1209
+ }
1210
+ if (typeof column.type === "string") {
1211
+ const type = columnTypes.get(column.type) || emptyType;
1212
+ return type;
1213
+ }
1214
+ return column.type.reduce((acc, columnType) => Object.assign(acc, columnTypes.get(columnType)), {});
1215
+ }
1216
+
1093
1217
  // src/components/InfiniteTable/utils/getComputedVisibleColumns.ts
1094
- var error = err("getComputedVisibleColumns");
1218
+ var logError = err("getComputedVisibleColumns");
1095
1219
  var isColumnVisible = (columnVisibility, _columnVisibilityAssumeVisible, colId) => {
1096
1220
  return !columnVisibility.has(colId) || columnVisibility.get(colId) !== false;
1097
1221
  };
@@ -1112,22 +1236,26 @@ var getComputedVisibleColumns = ({
1112
1236
  sortInfo,
1113
1237
  setSortInfo,
1114
1238
  multiSort,
1239
+ viewportReservedWidth,
1115
1240
  draggableColumns,
1116
1241
  columnOrder,
1117
1242
  columnPinning,
1243
+ columnSizing,
1244
+ columnTypes,
1118
1245
  columnVisibility,
1119
1246
  columnVisibilityAssumeVisible
1120
1247
  }) => {
1121
1248
  let computedOffset = 0;
1122
1249
  const normalizedColumnOrder = adjustColumnOrderForPinning(columnOrder === true ? [...columns.keys()] : columnOrder, columnPinning);
1123
- const visibleColumnOrder = normalizedColumnOrder.filter(isColumnVisible.bind(null, columnVisibility, columnVisibilityAssumeVisible));
1124
- const columnsArray = visibleColumnOrder.map((columnId) => {
1125
- let col = columns.get(columnId);
1250
+ const visibleColumnOrder = normalizedColumnOrder.filter((colId) => {
1251
+ let col = columns.get(colId);
1126
1252
  if (!col) {
1127
- error(`Column with id "${columnId}" specified in columnOrder array cannot be found in the columns map.`);
1253
+ logError(`Column with id "${colId}" specified in columnOrder array cannot be found in the columns map.`);
1254
+ return false;
1128
1255
  }
1129
- return col;
1130
- }).filter(Boolean);
1256
+ return isColumnVisible(columnVisibility, columnVisibilityAssumeVisible, colId);
1257
+ });
1258
+ const columnsArray = visibleColumnOrder.map((columnId) => columns.get(columnId)).filter(Boolean);
1131
1259
  const sortedMap = (sortInfo != null ? sortInfo : []).reduce((acc, info, index) => {
1132
1260
  if (info.id) {
1133
1261
  acc[info.id] = { sortInfo: info, index };
@@ -1141,20 +1269,39 @@ var getComputedVisibleColumns = ({
1141
1269
  return acc;
1142
1270
  }, {});
1143
1271
  const flexResult = computeFlex({
1144
- availableSize: bodySize.width,
1272
+ availableSize: Math.max(bodySize.width - (viewportReservedWidth != null ? viewportReservedWidth : 0) - getScrollbarWidth(), 0),
1145
1273
  maxSize: columnMaxWidth,
1146
1274
  minSize: columnMinWidth,
1147
- items: columnsArray.map((col) => {
1148
- var _a, _b;
1149
- let size = col.flex != null ? void 0 : (_a = col.width) != null ? _a : columnDefaultWidth;
1150
- if (!size && col.flex == null) {
1151
- size = (_b = col.minWidth) != null ? _b : columnMinWidth;
1275
+ items: visibleColumnOrder.map((colId) => {
1276
+ var _a, _b, _c, _d;
1277
+ const column = columns.get(colId);
1278
+ const colType = getColumnComputedType(column, columnTypes);
1279
+ const colTypeSizing = {
1280
+ minWidth: colType == null ? void 0 : colType.minWidth,
1281
+ maxWidth: colType == null ? void 0 : colType.maxWidth,
1282
+ width: colType == null ? void 0 : colType.width,
1283
+ flex: colType == null ? void 0 : colType.flex
1284
+ };
1285
+ let colSizing = columnSizing.get(colId) || {};
1286
+ if (colSizing.width != null) {
1287
+ delete colTypeSizing.flex;
1288
+ }
1289
+ if (colSizing.flex != null) {
1290
+ delete colTypeSizing.width;
1291
+ }
1292
+ colSizing = Object.assign(colTypeSizing, colSizing);
1293
+ let colFlex = (_a = colSizing.flex) != null ? _a : void 0;
1294
+ const colMinWidth = (_b = colSizing.minWidth) != null ? _b : columnMinWidth;
1295
+ const colMaxWidth = (_c = colSizing.maxWidth) != null ? _c : columnMaxWidth;
1296
+ let size = colFlex != void 0 ? void 0 : (_d = colSizing.width) != null ? _d : columnDefaultWidth;
1297
+ if (!size && colFlex == void 0) {
1298
+ size = colMinWidth;
1152
1299
  }
1153
1300
  return {
1154
1301
  size,
1155
- flex: col.flex,
1156
- minSize: col.minWidth,
1157
- maxSize: col.maxWidth
1302
+ flex: colFlex,
1303
+ minSize: colMinWidth,
1304
+ maxSize: colMaxWidth
1158
1305
  };
1159
1306
  })
1160
1307
  });
@@ -1189,6 +1336,7 @@ var getComputedVisibleColumns = ({
1189
1336
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
1190
1337
  const id = visibleColumnOrder[i];
1191
1338
  const nextColumnId = visibleColumnOrder[i + 1];
1339
+ const colType = getColumnComputedType(c, columnTypes);
1192
1340
  const sortingInfo = sortedMap[id] ? sortedMap[id] : c.field ? (_a = sortedMap[c.field]) != null ? _a : null : null;
1193
1341
  const computedSortInfo = (_b = sortingInfo == null ? void 0 : sortingInfo.sortInfo) != null ? _b : null;
1194
1342
  const computedSorted = !!computedSortInfo;
@@ -1244,8 +1392,10 @@ var getComputedVisibleColumns = ({
1244
1392
  const computedFirstInCategory = computedPinned !== prevPinned;
1245
1393
  const computedLastInCategory = computedLast || computedPinned !== getComputedPinned(nextColumnId, columnPinning);
1246
1394
  const result2 = __spreadProps(__spreadValues({
1247
- align: "start",
1248
- verticalAlign: "center"
1395
+ align: colType.align,
1396
+ verticalAlign: colType.verticalAlign,
1397
+ renderValue: colType.renderValue,
1398
+ render: colType.render
1249
1399
  }, c), {
1250
1400
  computedWidth,
1251
1401
  computedAbsoluteOffset,
@@ -1324,28 +1474,28 @@ var useRerender = () => {
1324
1474
 
1325
1475
  // src/components/hooks/useInterceptedMap.ts
1326
1476
  var import_react6 = __toModule(require("react"));
1327
- function interceptMap(map, fns) {
1328
- const { set, delete: deleteKey, clear } = map;
1477
+ function interceptMap(map2, fns) {
1478
+ const { set, delete: deleteKey, clear } = map2;
1329
1479
  if (fns.set) {
1330
- map.set = (key, value) => {
1331
- set.call(map, key, value);
1480
+ map2.set = (key, value) => {
1481
+ set.call(map2, key, value);
1332
1482
  fns.set(key, value);
1333
- return map;
1483
+ return map2;
1334
1484
  };
1335
1485
  }
1336
1486
  if (fns.delete) {
1337
- map.delete = (key) => {
1338
- const removed = deleteKey.call(map, key);
1487
+ map2.delete = (key) => {
1488
+ const removed = deleteKey.call(map2, key);
1339
1489
  fns.delete(key);
1340
1490
  return removed;
1341
1491
  };
1342
1492
  }
1343
1493
  if (fns.clear || fns.beforeClear) {
1344
- map.clear = () => {
1494
+ map2.clear = () => {
1345
1495
  if (fns.beforeClear) {
1346
- fns.beforeClear(map);
1496
+ fns.beforeClear(map2);
1347
1497
  }
1348
- const result = clear.call(map);
1498
+ const result = clear.call(map2);
1349
1499
  if (fns.clear) {
1350
1500
  fns.clear();
1351
1501
  }
@@ -1354,13 +1504,13 @@ function interceptMap(map, fns) {
1354
1504
  }
1355
1505
  return () => {
1356
1506
  if (set) {
1357
- map.set = set;
1507
+ map2.set = set;
1358
1508
  }
1359
1509
  if (deleteKey) {
1360
- map.delete = deleteKey;
1510
+ map2.delete = deleteKey;
1361
1511
  }
1362
1512
  if (clear) {
1363
- map.clear = clear;
1513
+ map2.clear = clear;
1364
1514
  }
1365
1515
  };
1366
1516
  }
@@ -1380,16 +1530,16 @@ var rafFn = (fn) => {
1380
1530
  };
1381
1531
 
1382
1532
  // src/components/InfiniteTable/hooks/useRerenderOnKeyChange.ts
1383
- var useRerenderOnKeyChange = (map) => {
1533
+ var useRerenderOnKeyChange = (map2) => {
1384
1534
  const [renderId, rerender] = useRerender();
1385
1535
  (0, import_react7.useEffect)(() => {
1386
1536
  const update = rafFn(rerender);
1387
- return interceptMap(map, {
1537
+ return interceptMap(map2, {
1388
1538
  set: update,
1389
1539
  clear: update,
1390
1540
  delete: update
1391
1541
  });
1392
- }, [map]);
1542
+ }, [map2]);
1393
1543
  return renderId;
1394
1544
  };
1395
1545
 
@@ -1407,11 +1557,16 @@ var useComputedVisibleColumns = ({
1407
1557
  setSortInfo,
1408
1558
  columnOrder,
1409
1559
  columnPinning,
1560
+ columnTypes,
1410
1561
  pinnedEndMaxWidth,
1411
1562
  pinnedStartMaxWidth,
1563
+ viewportReservedWidth,
1412
1564
  columnVisibility,
1413
- columnVisibilityAssumeVisible
1565
+ columnVisibilityAssumeVisible,
1566
+ columnSizing
1414
1567
  }) => {
1568
+ const columnsSizingRenderId = useRerenderOnKeyChange(columnSizing);
1569
+ const columnTypesRenderId = useRerenderOnKeyChange(columnTypes);
1415
1570
  const columnsRenderId = useRerenderOnKeyChange(columns);
1416
1571
  const visibilityRenderId = useRerenderOnKeyChange(columnVisibility);
1417
1572
  const pinningRenderId = useRerenderOnKeyChange(columnPinning);
@@ -1437,6 +1592,7 @@ var useComputedVisibleColumns = ({
1437
1592
  columnMinWidth,
1438
1593
  columnMaxWidth,
1439
1594
  columnDefaultWidth,
1595
+ viewportReservedWidth,
1440
1596
  sortable,
1441
1597
  sortInfo,
1442
1598
  setSortInfo,
@@ -1446,6 +1602,8 @@ var useComputedVisibleColumns = ({
1446
1602
  draggableColumns,
1447
1603
  columnOrder,
1448
1604
  columnPinning,
1605
+ columnSizing,
1606
+ columnTypes,
1449
1607
  columnVisibility,
1450
1608
  columnVisibilityAssumeVisible: columnVisibilityAssumeVisible != null ? columnVisibilityAssumeVisible : true
1451
1609
  });
@@ -1467,7 +1625,9 @@ var useComputedVisibleColumns = ({
1467
1625
  columnPinning,
1468
1626
  columnsRenderId,
1469
1627
  visibilityRenderId,
1470
- pinningRenderId
1628
+ columnsSizingRenderId,
1629
+ pinningRenderId,
1630
+ columnTypesRenderId
1471
1631
  ]);
1472
1632
  const result = {
1473
1633
  columns,
@@ -1493,7 +1653,7 @@ var useComputedVisibleColumns = ({
1493
1653
  var sortAscending = (a, b) => a - b;
1494
1654
 
1495
1655
  // src/components/InfiniteTable/hooks/useComputed.ts
1496
- var import_react19 = __toModule(require("react"));
1656
+ var import_react20 = __toModule(require("react"));
1497
1657
 
1498
1658
  // src/components/InfiniteTable/hooks/useColumnAggregations.ts
1499
1659
  var import_react12 = __toModule(require("react"));
@@ -1601,7 +1761,7 @@ function getComponentStateContext() {
1601
1761
  }
1602
1762
  return ComponentContext = (0, import_react11.createContext)(null);
1603
1763
  }
1604
- function getReducerActions(dispatch, getState, getProps, propsToForward, allowedControlledPropOverrides) {
1764
+ function getReducerGeneratedActions(dispatch, getState, getProps, propsToForward, allowedControlledPropOverrides, interceptedActions) {
1605
1765
  const state = getState();
1606
1766
  return Object.keys(state).reduce((actions, stateKey) => {
1607
1767
  const key = stateKey;
@@ -1613,6 +1773,9 @@ function getReducerActions(dispatch, getState, getProps, propsToForward, allowed
1613
1773
  return;
1614
1774
  }
1615
1775
  notifyChange(props, stateKey, value);
1776
+ if (interceptedActions && typeof interceptedActions[key] === "function") {
1777
+ interceptedActions[key](value, { actions, state: state2 });
1778
+ }
1616
1779
  const forwardFn = propsToForward[key];
1617
1780
  if (typeof forwardFn === "function") {
1618
1781
  value = forwardFn(value);
@@ -1725,7 +1888,7 @@ function getComponentStateRoot(config) {
1725
1888
  const getComponentState = useLatest(state);
1726
1889
  const { allowedControlledPropOverrides } = config;
1727
1890
  const actions = (0, import_react11.useMemo)(() => {
1728
- const generatedActions = getReducerActions(dispatch, getComponentState, getProps, propsToForward, allowedControlledPropOverrides);
1891
+ const generatedActions = getReducerGeneratedActions(dispatch, getComponentState, getProps, propsToForward, allowedControlledPropOverrides, config.interceptActions);
1729
1892
  return generatedActions;
1730
1893
  }, [
1731
1894
  dispatch,
@@ -1892,7 +2055,7 @@ function useColumnGroups() {
1892
2055
  }
1893
2056
 
1894
2057
  // src/components/InfiniteTable/hooks/useColumnsWhen.ts
1895
- var import_react18 = __toModule(require("react"));
2058
+ var import_react19 = __toModule(require("react"));
1896
2059
 
1897
2060
  // src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
1898
2061
  var React7 = __toModule(require("react"));
@@ -1953,43 +2116,10 @@ function ExpanderIcon(props) {
1953
2116
  }));
1954
2117
  }
1955
2118
 
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
2119
  // src/components/InfiniteTable/components/InfiniteTableRow/row.css.ts
2120
+ var import_createRuntimeFn = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
1991
2121
  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: [] });
2122
+ 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
2123
  var RowHoverCls = "_7pupv01";
1994
2124
 
1995
2125
  // src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
@@ -2174,67 +2304,236 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
2174
2304
  }
2175
2305
 
2176
2306
  // src/components/InfiniteTable/hooks/useToggleGroupRow.ts
2177
- var import_react17 = __toModule(require("react"));
2307
+ var import_react18 = __toModule(require("react"));
2178
2308
 
2179
2309
  // src/components/DataSource/index.tsx
2180
2310
  var React9 = __toModule(require("react"));
2181
2311
 
2182
- // src/components/DataSource/privateHooks/useLoadData.ts
2183
- var import_react15 = __toModule(require("react"));
2312
+ // src/utils/multisort/sortTypes.ts
2313
+ var numberComparator = function(first, second) {
2314
+ return first - second;
2315
+ };
2316
+ var stringComparator = function(first, second) {
2317
+ first = `${first}`;
2318
+ second = `${second}`;
2319
+ return first.localeCompare(second);
2320
+ };
2321
+ var sortTypes = {
2322
+ number: numberComparator,
2323
+ string: stringComparator
2324
+ };
2325
+ var sortTypes_default = sortTypes;
2184
2326
 
2185
- // src/components/DataSource/privateHooks/buildDataSourceDataInfo.ts
2186
- function buildDataSourceDataInfo(dataParam) {
2187
- let dataArray = [];
2188
- if (Array.isArray(dataParam.data)) {
2189
- dataArray = dataParam.data;
2190
- } else {
2191
- dataArray = dataParam;
2327
+ // src/utils/multisort/index.ts
2328
+ var multisort = (sortInfo, array, get) => {
2329
+ array.sort(getMultisortFunction(sortInfo, get));
2330
+ return array;
2331
+ };
2332
+ multisort.knownTypes = sortTypes_default;
2333
+ var getSingleSortFunction = (info) => {
2334
+ if (!info) {
2335
+ return;
2192
2336
  }
2193
- return {
2194
- originalDataArray: dataArray
2337
+ const field = info.field;
2338
+ var dir = info.dir < 0 ? -1 : info.dir > 0 ? 1 : 0;
2339
+ if (!dir) {
2340
+ return;
2341
+ }
2342
+ let fn = info.fn;
2343
+ if (!fn && info.type) {
2344
+ fn = multisort.knownTypes[info.type];
2345
+ if (!fn) {
2346
+ console.warn(`Unknown sort type "${info.type}" - please pass one of ${Object.keys(multisort.knownTypes).join(", ")}`);
2347
+ }
2348
+ }
2349
+ if (!fn) {
2350
+ fn = sortTypes_default.string;
2351
+ }
2352
+ return (first, second) => {
2353
+ const a = field ? first[field] : first;
2354
+ const b = field ? second[field] : second;
2355
+ return dir * fn(a, b);
2195
2356
  };
2196
- }
2197
-
2198
- // src/components/DataSource/privateHooks/loadDataAsync.ts
2199
- function loadDataAsync(data) {
2200
- return __async(this, null, function* () {
2201
- if (typeof data === "function") {
2202
- data = data();
2357
+ };
2358
+ var getSortFunctions = (sortInfo) => {
2359
+ return sortInfo.map(getSingleSortFunction).filter((fn) => fn instanceof Function);
2360
+ };
2361
+ var getMultisortFunction = (sortInfo, get) => {
2362
+ const fns = getSortFunctions(sortInfo);
2363
+ return (first, second) => {
2364
+ if (get) {
2365
+ first = get(first);
2366
+ second = get(second);
2203
2367
  }
2204
- return buildDataSourceDataInfo(yield data);
2205
- });
2368
+ let result = 0;
2369
+ let i = 0;
2370
+ let fn;
2371
+ const len = fns.length;
2372
+ for (; i < len; i++) {
2373
+ fn = fns[i];
2374
+ if (!fn) {
2375
+ continue;
2376
+ }
2377
+ result = fn(first, second);
2378
+ if (result !== 0) {
2379
+ return result;
2380
+ }
2381
+ }
2382
+ return result;
2383
+ };
2384
+ };
2385
+
2386
+ // src/components/DataSource/privateHooks/useLoadData.ts
2387
+ var import_react16 = __toModule(require("react"));
2388
+
2389
+ // src/components/hooks/useEffectWithChanges.ts
2390
+ var import_react15 = __toModule(require("react"));
2391
+ function useEffectWithChanges(fn, deps) {
2392
+ const prevRef = (0, import_react15.useRef)({});
2393
+ const oldValuesRef = (0, import_react15.useRef)({});
2394
+ const oldValues = oldValuesRef.current;
2395
+ const changesRef = (0, import_react15.useRef)({});
2396
+ const changes = changesRef.current;
2397
+ const useEffectDeps = [];
2398
+ for (let k in deps) {
2399
+ if (deps.hasOwnProperty(k)) {
2400
+ if (deps[k] !== prevRef.current[k]) {
2401
+ changes[k] = deps[k];
2402
+ oldValues[k] = prevRef.current[k];
2403
+ }
2404
+ useEffectDeps.push(deps[k]);
2405
+ }
2406
+ }
2407
+ prevRef.current = deps;
2408
+ (0, import_react15.useEffect)(() => {
2409
+ const changes2 = changesRef.current;
2410
+ const result = fn(changes2, oldValues);
2411
+ changesRef.current = {};
2412
+ oldValuesRef.current = {};
2413
+ return result;
2414
+ }, useEffectDeps);
2206
2415
  }
2207
2416
 
2208
2417
  // src/components/DataSource/privateHooks/useLoadData.ts
2209
- function buildDataSourceInfo(data) {
2210
- return { originalDataArray: data };
2418
+ function buildDataSourceDataParams(componentState) {
2419
+ var _a, _b;
2420
+ const sortInfo = componentState.multiSort ? componentState.sortInfo : (_b = (_a = componentState.sortInfo) == null ? void 0 : _a[0]) != null ? _b : null;
2421
+ const dataSourceParams = {
2422
+ originalDataArray: componentState.originalDataArray,
2423
+ sortInfo,
2424
+ groupRowsBy: componentState.groupRowsBy,
2425
+ pivotBy: componentState.pivotBy
2426
+ };
2427
+ if (componentState.livePagination !== void 0) {
2428
+ dataSourceParams.livePaginationCursor = componentState.livePaginationCursor;
2429
+ }
2430
+ return dataSourceParams;
2431
+ }
2432
+ function notifyDataParamsChanged(componentState, actions) {
2433
+ var _a;
2434
+ if (typeof componentState.data === "function") {
2435
+ loadData(componentState.data, componentState, actions);
2436
+ }
2437
+ const dataParams = buildDataSourceDataParams(componentState);
2438
+ (_a = componentState.onDataParamsChange) == null ? void 0 : _a.call(componentState, dataParams);
2439
+ }
2440
+ function loadData(data, componentState, actions) {
2441
+ const dataParams = buildDataSourceDataParams(componentState);
2442
+ if (typeof data === "function") {
2443
+ data = data(dataParams);
2444
+ }
2445
+ const dataIsPromise = typeof data === "object" && typeof data.then === "function";
2446
+ if (dataIsPromise) {
2447
+ actions.loading = true;
2448
+ }
2449
+ Promise.resolve(data).then((dataParam) => {
2450
+ let dataArray = [];
2451
+ if (Array.isArray(dataParam.data)) {
2452
+ const remoteData = dataParam;
2453
+ dataArray = remoteData.data;
2454
+ if (remoteData.livePaginationCursor !== void 0) {
2455
+ actions.livePaginationCursor = remoteData.livePaginationCursor;
2456
+ }
2457
+ } else {
2458
+ dataArray = dataParam;
2459
+ }
2460
+ actions.originalDataArray = dataArray;
2461
+ if (dataIsPromise) {
2462
+ actions.loading = false;
2463
+ }
2464
+ });
2211
2465
  }
2212
2466
  function useLoadData() {
2213
2467
  const {
2468
+ getComponentState,
2214
2469
  componentActions: actions,
2215
2470
  componentState: { data }
2216
2471
  } = useComponentState();
2217
- const loadData = (data2) => {
2218
- let dataSourceInfo = {
2219
- originalDataArray: []
2220
- };
2221
- if (typeof data2 === "function") {
2222
- data2 = data2();
2223
- }
2224
- if (Array.isArray(data2)) {
2225
- dataSourceInfo = buildDataSourceInfo(data2);
2226
- actions.originalDataArray = dataSourceInfo.originalDataArray;
2227
- } else {
2228
- actions.loading = true;
2229
- loadDataAsync(data2).then((dataSourceInfo2) => {
2230
- actions.originalDataArray = dataSourceInfo2.originalDataArray;
2231
- actions.loading = false;
2232
- });
2233
- }
2234
- };
2235
- (0, import_react15.useLayoutEffect)(() => {
2236
- loadData(data);
2472
+ (0, import_react16.useLayoutEffect)(() => {
2473
+ loadData(data, getComponentState(), actions);
2237
2474
  }, [data]);
2475
+ useLivePagination();
2476
+ }
2477
+ function useLivePagination() {
2478
+ const {
2479
+ getComponentState,
2480
+ componentActions: actions,
2481
+ componentState
2482
+ } = useComponentState();
2483
+ const {
2484
+ notifyScrollbarsChange,
2485
+ sortInfo,
2486
+ groupRowsBy,
2487
+ pivotBy,
2488
+ livePaginationCursor,
2489
+ scrollBottomId
2490
+ } = componentState;
2491
+ const [scrollbars, setScrollbars] = (0, import_react16.useState)({
2492
+ vertical: false,
2493
+ horizontal: false
2494
+ });
2495
+ const scrollbarsRef = (0, import_react16.useRef)(scrollbars);
2496
+ (0, import_react16.useEffect)(() => {
2497
+ notifyScrollbarsChange.onChange((scrollbars2) => {
2498
+ if (!scrollbars2) {
2499
+ return;
2500
+ }
2501
+ scrollbarsRef.current = scrollbars2;
2502
+ setScrollbars(scrollbars2);
2503
+ });
2504
+ return () => notifyScrollbarsChange.destroy();
2505
+ }, [notifyScrollbarsChange]);
2506
+ const [cursorId, updateCursorId] = (0, import_react16.useState)(void 0);
2507
+ (0, import_react16.useEffect)(() => {
2508
+ const frameId = requestAnimationFrame(() => {
2509
+ var _a;
2510
+ if (!((_a = scrollbarsRef.current) == null ? void 0 : _a.vertical)) {
2511
+ updateCursorId(livePaginationCursor);
2512
+ }
2513
+ });
2514
+ return () => cancelAnimationFrame(frameId);
2515
+ }, [livePaginationCursor]);
2516
+ (0, import_react16.useEffect)(() => {
2517
+ const { livePaginationCursor: livePaginationCursor2, livePagination } = getComponentState();
2518
+ if (!scrollbars.vertical && livePagination) {
2519
+ updateCursorId(livePaginationCursor2);
2520
+ }
2521
+ }, [scrollbars.vertical]);
2522
+ (0, import_react16.useEffect)(() => {
2523
+ updateCursorId(scrollBottomId);
2524
+ }, [scrollBottomId]);
2525
+ const depsObject = {
2526
+ sortInfo,
2527
+ groupRowsBy,
2528
+ pivotBy,
2529
+ cursorId
2530
+ };
2531
+ useEffectWithChanges(() => {
2532
+ if (cursorId === void 0) {
2533
+ return;
2534
+ }
2535
+ notifyDataParamsChanged(getComponentState(), actions);
2536
+ }, depsObject);
2238
2537
  }
2239
2538
 
2240
2539
  // src/components/DataSource/state/normalizeSortInfo.ts
@@ -2244,7 +2543,7 @@ var normalizeSortInfo = (sortInfo) => {
2244
2543
  };
2245
2544
 
2246
2545
  // src/components/hooks/useOnce.ts
2247
- var import_react16 = __toModule(require("react"));
2546
+ var import_react17 = __toModule(require("react"));
2248
2547
  function once(fn) {
2249
2548
  let called = false;
2250
2549
  let result = null;
@@ -2259,7 +2558,7 @@ function once(fn) {
2259
2558
  return onceFn;
2260
2559
  }
2261
2560
  function useOnce(fn) {
2262
- const onceFn = (0, import_react16.useMemo)(() => {
2561
+ const onceFn = (0, import_react17.useMemo)(() => {
2263
2562
  return once(fn);
2264
2563
  }, []);
2265
2564
  return onceFn();
@@ -2288,9 +2587,9 @@ var DeepMap = class {
2288
2587
  if (!pair) {
2289
2588
  return;
2290
2589
  }
2291
- const { map } = pair;
2590
+ const { map: map2 } = pair;
2292
2591
  const keys = [...parentKeys, key];
2293
- const next = map ? () => this.visitWithNext(keys, fn, map) : void 0;
2592
+ const next = map2 ? () => this.visitWithNext(keys, fn, map2) : void 0;
2294
2593
  if (pair.hasOwnProperty("value")) {
2295
2594
  fn(pair.value, keys, i, next);
2296
2595
  i++;
@@ -2356,14 +2655,14 @@ var DeepMap = class {
2356
2655
  return this.length;
2357
2656
  }
2358
2657
  clear() {
2359
- const clearMap = (map) => {
2360
- map.forEach((value, _key) => {
2361
- const { map: map2 } = value;
2362
- if (map2) {
2363
- clearMap(map2);
2658
+ const clearMap = (map2) => {
2659
+ map2.forEach((value, _key) => {
2660
+ const { map: map3 } = value;
2661
+ if (map3) {
2662
+ clearMap(map3);
2364
2663
  }
2365
2664
  });
2366
- map.clear();
2665
+ map2.clear();
2367
2666
  };
2368
2667
  clearMap(this.map);
2369
2668
  this.length = 0;
@@ -2408,9 +2707,9 @@ var DeepMap = class {
2408
2707
  }
2409
2708
  }
2410
2709
  while (maps.length) {
2411
- let map = maps.pop();
2710
+ let map2 = maps.pop();
2412
2711
  let key = keys.pop();
2413
- if (key && (map == null ? void 0 : map.size) === 0) {
2712
+ if (key && (map2 == null ? void 0 : map2.size) === 0) {
2414
2713
  let parentMap = maps[maps.length - 1];
2415
2714
  let pair = parentMap == null ? void 0 : parentMap.get(key);
2416
2715
  if (pair) {
@@ -2449,12 +2748,12 @@ var DeepMap = class {
2449
2748
  if (!pair) {
2450
2749
  return;
2451
2750
  }
2452
- const { map } = pair;
2751
+ const { map: map2 } = pair;
2453
2752
  const keys = [...parentKeys, key];
2454
2753
  const next = once(() => {
2455
- if (map) {
2456
- map.forEach((_, k) => {
2457
- this.visitKey(k, map, keys, fn);
2754
+ if (map2) {
2755
+ map2.forEach((_, k) => {
2756
+ this.visitKey(k, map2, keys, fn);
2458
2757
  });
2459
2758
  }
2460
2759
  });
@@ -2620,14 +2919,68 @@ var GroupRowsState = class {
2620
2919
  }
2621
2920
  };
2622
2921
 
2922
+ // src/utils/shallowEqualObjects.ts
2923
+ function shallowEqualObjects(objA, objB) {
2924
+ if (objA === objB) {
2925
+ return true;
2926
+ }
2927
+ if (!objA || !objB) {
2928
+ return false;
2929
+ }
2930
+ var aKeys = Object.keys(objA);
2931
+ var bKeys = Object.keys(objB);
2932
+ var len = aKeys.length;
2933
+ if (bKeys.length !== len) {
2934
+ return false;
2935
+ }
2936
+ for (var i = 0; i < len; i++) {
2937
+ var key = aKeys[i];
2938
+ if (objA[key] !== objB[key] || !Object.prototype.hasOwnProperty.call(objB, key)) {
2939
+ return false;
2940
+ }
2941
+ }
2942
+ return true;
2943
+ }
2944
+
2945
+ // src/components/utils/discardCallsWithEqualArg.ts
2946
+ var map = new WeakMap();
2947
+ var getCompareDefault = (a) => a;
2948
+ function discardCallsWithEqualArg(fn, timeframe = 50, getCompareObject2) {
2949
+ map.set(fn, {
2950
+ lastCallTime: 0,
2951
+ lastCallArg: null
2952
+ });
2953
+ const getCompare = getCompareObject2 != null ? getCompareObject2 : getCompareDefault;
2954
+ return (arg) => {
2955
+ const { lastCallTime, lastCallArg } = map.get(fn) || {
2956
+ lastCallTime: 0,
2957
+ lastCallArg: null
2958
+ };
2959
+ const now = Date.now();
2960
+ const diff = now - lastCallTime;
2961
+ const objectsEqual = shallowEqualObjects(getCompare(lastCallArg), getCompare(arg));
2962
+ if (diff < timeframe && objectsEqual) {
2963
+ return;
2964
+ }
2965
+ map.set(fn, {
2966
+ lastCallTime: now,
2967
+ lastCallArg: arg
2968
+ });
2969
+ fn(arg);
2970
+ };
2971
+ }
2972
+
2623
2973
  // src/components/DataSource/state/getInitialState.ts
2624
2974
  function initSetupState2() {
2625
2975
  const now = Date.now();
2626
2976
  const originalDataArray = [];
2627
2977
  const dataArray = [];
2628
2978
  return {
2979
+ dataParams: void 0,
2980
+ notifyScrollbarsChange: buildSubscriptionCallback(),
2629
2981
  pivotTotalColumnPosition: "end",
2630
2982
  originalDataArray,
2983
+ scrollBottomId: Symbol("scrollBottomId"),
2631
2984
  pivotColumns: void 0,
2632
2985
  pivotColumnGroups: void 0,
2633
2986
  dataArray,
@@ -2644,12 +2997,20 @@ function initSetupState2() {
2644
2997
  lastGroupDataArray: void 0
2645
2998
  };
2646
2999
  }
3000
+ function getCompareObject(dataParams) {
3001
+ const obj = __spreadValues({}, dataParams);
3002
+ delete obj.originalDataArray;
3003
+ return obj;
3004
+ }
2647
3005
  var forwardProps3 = () => {
2648
3006
  return {
3007
+ onDataParamsChange: (fn) => fn ? discardCallsWithEqualArg(fn, 100, getCompareObject) : void 0,
2649
3008
  remoteCount: 1,
2650
3009
  data: 1,
2651
3010
  pivotBy: 1,
2652
3011
  primaryKey: 1,
3012
+ livePagination: 1,
3013
+ livePaginationCursor: 1,
2653
3014
  loading: (loading) => loading != null ? loading : false,
2654
3015
  sortInfo: (sortInfo) => normalizeSortInfo(sortInfo),
2655
3016
  groupRowsBy: (groupRowsBy) => groupRowsBy != null ? groupRowsBy : [],
@@ -2662,10 +3023,20 @@ var forwardProps3 = () => {
2662
3023
  };
2663
3024
  };
2664
3025
  function mapPropsToState2(params) {
2665
- var _a;
2666
3026
  const { props } = params;
3027
+ const controlledSort = isControlledValue(props.sortInfo);
3028
+ return {
3029
+ controlledSort,
3030
+ multiSort: Array.isArray(controlledSort ? props.sortInfo : props.defaultSortInfo)
3031
+ };
3032
+ }
3033
+ function getInterceptActions() {
2667
3034
  return {
2668
- multiSort: Array.isArray((_a = props.sortInfo) != null ? _a : props.defaultSortInfo)
3035
+ sortInfo: (sortInfo, { actions, state }) => {
3036
+ const dataParams = buildDataSourceDataParams(state);
3037
+ dataParams.sortInfo = sortInfo;
3038
+ actions.dataParams = dataParams;
3039
+ }
2669
3040
  };
2670
3041
  }
2671
3042
 
@@ -2847,129 +3218,57 @@ function enhancedFlatten(param) {
2847
3218
  const collapsed = (_a = groupRowsState == null ? void 0 : groupRowsState.isGroupRowCollapsed(groupKeys)) != null ? _a : false;
2848
3219
  const enhancedGroupData = getEnhancedGroupData({
2849
3220
  groupBy: groupByStrings,
2850
- parents: Array.from(parents),
2851
- indexInGroup,
2852
- indexInParentGroups: Array.from(indexInParentGroups),
2853
- indexInAll: result.length,
2854
- groupKeys,
2855
- collapsed
2856
- }, deepMapValue);
2857
- const include = generateGroupRows || collapsed;
2858
- if (include) {
2859
- result.push(enhancedGroupData);
2860
- }
2861
- if (collapsed) {
2862
- parents.forEach((parent) => {
2863
- parent.collapsedChildrenCount += enhancedGroupData.groupCount;
2864
- parent.collapsedGroupsCount += 1;
2865
- });
2866
- }
2867
- indexInParentGroups.push(indexInGroup);
2868
- parents.push(enhancedGroupData);
2869
- if (!collapsed) {
2870
- if (!next) {
2871
- if (!pivot) {
2872
- const startIndex = result.length;
2873
- result.push(...items.map((item, index) => {
2874
- return {
2875
- id: toPrimaryKey(item),
2876
- data: item,
2877
- isGroupRow: false,
2878
- collapsed: false,
2879
- groupKeys,
2880
- parents: Array.from(parents),
2881
- indexInParentGroups: [...indexInParentGroups, index],
2882
- indexInGroup: index,
2883
- indexInAll: startIndex + index,
2884
- groupBy: groupByStrings,
2885
- groupNesting,
2886
- groupCount: enhancedGroupData.groupCount
2887
- };
2888
- }));
2889
- }
2890
- } else {
2891
- next();
2892
- }
2893
- }
2894
- parents.pop();
2895
- indexInParentGroups.pop();
2896
- });
2897
- return {
2898
- data: result
2899
- };
2900
- }
2901
-
2902
- // src/utils/multisort/sortTypes.ts
2903
- var sortTypes = {
2904
- number: function(first, second) {
2905
- return first - second;
2906
- },
2907
- string: function(first, second) {
2908
- first = `${first}`;
2909
- second = `${second}`;
2910
- return first.localeCompare(second);
2911
- }
2912
- };
2913
- var sortTypes_default = sortTypes;
2914
-
2915
- // src/utils/multisort/index.ts
2916
- var multisort = (sortInfo, array, get) => {
2917
- array.sort(getMultisortFunction(sortInfo, get));
2918
- return array;
2919
- };
2920
- multisort.knownTypes = sortTypes_default;
2921
- var getSingleSortFunction = (info) => {
2922
- if (!info) {
2923
- return;
2924
- }
2925
- const field = info.field;
2926
- var dir = info.dir < 0 ? -1 : info.dir > 0 ? 1 : 0;
2927
- if (!dir) {
2928
- return;
2929
- }
2930
- let fn = info.fn;
2931
- if (!fn && info.type) {
2932
- fn = multisort.knownTypes[info.type];
2933
- if (!fn) {
2934
- console.warn(`Unknown sort type "${info.type}" - please pass one of ${Object.keys(multisort.knownTypes).join(", ")}`);
2935
- }
2936
- }
2937
- if (!fn) {
2938
- fn = sortTypes_default.string;
2939
- }
2940
- return (first, second) => {
2941
- const a = field ? first[field] : first;
2942
- const b = field ? second[field] : second;
2943
- return dir * fn(a, b);
2944
- };
2945
- };
2946
- var getSortFunctions = (sortInfo) => {
2947
- return sortInfo.map(getSingleSortFunction).filter((fn) => fn instanceof Function);
2948
- };
2949
- var getMultisortFunction = (sortInfo, get) => {
2950
- const fns = getSortFunctions(sortInfo);
2951
- return (first, second) => {
2952
- if (get) {
2953
- first = get(first);
2954
- second = get(second);
3221
+ parents: Array.from(parents),
3222
+ indexInGroup,
3223
+ indexInParentGroups: Array.from(indexInParentGroups),
3224
+ indexInAll: result.length,
3225
+ groupKeys,
3226
+ collapsed
3227
+ }, deepMapValue);
3228
+ const include = generateGroupRows || collapsed;
3229
+ if (include) {
3230
+ result.push(enhancedGroupData);
2955
3231
  }
2956
- let result = 0;
2957
- let i = 0;
2958
- let fn;
2959
- const len = fns.length;
2960
- for (; i < len; i++) {
2961
- fn = fns[i];
2962
- if (!fn) {
2963
- continue;
2964
- }
2965
- result = fn(first, second);
2966
- if (result !== 0) {
2967
- return result;
3232
+ if (collapsed) {
3233
+ parents.forEach((parent) => {
3234
+ parent.collapsedChildrenCount += enhancedGroupData.groupCount;
3235
+ parent.collapsedGroupsCount += 1;
3236
+ });
3237
+ }
3238
+ indexInParentGroups.push(indexInGroup);
3239
+ parents.push(enhancedGroupData);
3240
+ if (!collapsed) {
3241
+ if (!next) {
3242
+ if (!pivot) {
3243
+ const startIndex = result.length;
3244
+ result.push(...items.map((item, index) => {
3245
+ return {
3246
+ id: toPrimaryKey(item),
3247
+ data: item,
3248
+ isGroupRow: false,
3249
+ collapsed: false,
3250
+ groupKeys,
3251
+ parents: Array.from(parents),
3252
+ indexInParentGroups: [...indexInParentGroups, index],
3253
+ indexInGroup: index,
3254
+ indexInAll: startIndex + index,
3255
+ groupBy: groupByStrings,
3256
+ groupNesting,
3257
+ groupCount: enhancedGroupData.groupCount
3258
+ };
3259
+ }));
3260
+ }
3261
+ } else {
3262
+ next();
2968
3263
  }
2969
3264
  }
2970
- return result;
3265
+ parents.pop();
3266
+ indexInParentGroups.pop();
3267
+ });
3268
+ return {
3269
+ data: result
2971
3270
  };
2972
- };
3271
+ }
2973
3272
 
2974
3273
  // src/utils/groupAndPivot/getPivotColumnsAndColumnGroups.ts
2975
3274
  function getPivotColumnsAndColumnGroups(deepMap, pivotBy, pivotTotalColumnPosition) {
@@ -3095,7 +3394,7 @@ function concludeReducer(params) {
3095
3394
  var _a;
3096
3395
  const { state, previousState } = params;
3097
3396
  const sortInfo = state.sortInfo;
3098
- const shouldSort = !!(sortInfo == null ? void 0 : sortInfo.length);
3397
+ const shouldSort = !!(sortInfo == null ? void 0 : sortInfo.length) && !state.controlledSort;
3099
3398
  const sortDepsChanged = haveDepsChanged(previousState, state, [
3100
3399
  "originalDataArray",
3101
3400
  "sortInfo"
@@ -3165,7 +3464,9 @@ function concludeReducer(params) {
3165
3464
  }
3166
3465
  state.dataArray = rowInfoDataArray;
3167
3466
  state.reducedAt = now;
3168
- globalThis.state = state;
3467
+ if (true) {
3468
+ globalThis.state = state;
3469
+ }
3169
3470
  return state;
3170
3471
  }
3171
3472
 
@@ -3188,7 +3489,8 @@ var DataSourceRoot = getComponentStateRoot({
3188
3489
  initSetupState: initSetupState2,
3189
3490
  forwardProps: forwardProps3,
3190
3491
  concludeReducer,
3191
- mapPropsToState: mapPropsToState2
3492
+ mapPropsToState: mapPropsToState2,
3493
+ interceptActions: getInterceptActions()
3192
3494
  });
3193
3495
  function DataSourceCmp({ children }) {
3194
3496
  const DataSourceContext = getDataSourceContext();
@@ -3218,7 +3520,7 @@ function DataSource(props) {
3218
3520
  // src/components/InfiniteTable/hooks/useToggleGroupRow.ts
3219
3521
  function useToggleGroupRow() {
3220
3522
  const { getState: getDataSourceState, componentActions: dataSourceActions } = useDataSourceContextValue();
3221
- const toggleGroupRow = (0, import_react17.useCallback)((groupKeys) => {
3523
+ const toggleGroupRow = (0, import_react18.useCallback)((groupKeys) => {
3222
3524
  const newState = new GroupRowsState(getDataSourceState().groupRowsState);
3223
3525
  newState.toggleGroupRow(groupKeys);
3224
3526
  dataSourceActions.groupRowsState = newState;
@@ -3228,7 +3530,7 @@ function useToggleGroupRow() {
3228
3530
 
3229
3531
  // src/components/InfiniteTable/hooks/useColumnsWhen.ts
3230
3532
  function useGroupRowsMap(groupRowsBy) {
3231
- const groupRowsMap = (0, import_react18.useMemo)(() => {
3533
+ const groupRowsMap = (0, import_react19.useMemo)(() => {
3232
3534
  return groupRowsBy.reduce((acc, groupBy, index) => {
3233
3535
  acc.set(groupBy.field, {
3234
3536
  groupBy,
@@ -3248,10 +3550,10 @@ function useColumnsWhen() {
3248
3550
  componentState: { groupRenderStrategy, pivotTotalColumnPosition }
3249
3551
  } = useComponentState();
3250
3552
  const groupRowsMap = useGroupRowsMap(groupRowsBy);
3251
- (0, import_react18.useEffect)(() => {
3553
+ (0, import_react19.useEffect)(() => {
3252
3554
  dataSourceActions.generateGroupRows = groupRenderStrategy !== "inline";
3253
3555
  }, [groupRenderStrategy]);
3254
- (0, import_react18.useEffect)(() => {
3556
+ (0, import_react19.useEffect)(() => {
3255
3557
  dataSourceActions.pivotTotalColumnPosition = pivotTotalColumnPosition;
3256
3558
  }, [pivotTotalColumnPosition]);
3257
3559
  useColumnsWhenInlineGroupRenderStrategy(groupRowsMap);
@@ -3314,7 +3616,7 @@ function useColumnsWhenInlineGroupRenderStrategy(groupRowsMap) {
3314
3616
  });
3315
3617
  return computedColumns.size === 0 ? void 0 : computedColumns;
3316
3618
  }
3317
- (0, import_react18.useEffect)(() => {
3619
+ (0, import_react19.useEffect)(() => {
3318
3620
  const update = () => {
3319
3621
  componentActions.columnsWhenInlineGroupRenderStrategy = computeColumnsWhenInlineGroupRenderStrategy(columns, groupRowsMap, groupRenderStrategy, toggleGroupRow);
3320
3622
  };
@@ -3340,7 +3642,7 @@ function useColumnsWhenPivoting() {
3340
3642
  }
3341
3643
  } = useComponentState();
3342
3644
  const toggleGroupRow = useToggleGroupRow();
3343
- (0, import_react18.useEffect)(() => {
3645
+ (0, import_react19.useEffect)(() => {
3344
3646
  const computedPivotColumns = getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, {
3345
3647
  pivotColumn,
3346
3648
  pivotRowLabelsColumn,
@@ -3361,7 +3663,7 @@ function useColumnsWhenGrouping() {
3361
3663
  componentState: { columns, groupColumn, groupRenderStrategy, pivotColumns }
3362
3664
  } = useComponentState();
3363
3665
  const toggleGroupRow = useToggleGroupRow();
3364
- (0, import_react18.useEffect)(() => {
3666
+ (0, import_react19.useEffect)(() => {
3365
3667
  if (pivotColumns) {
3366
3668
  return;
3367
3669
  }
@@ -3398,7 +3700,7 @@ function useHideEmptyGroupColumns(groupRowsMap) {
3398
3700
  groupRenderStrategy
3399
3701
  }
3400
3702
  } = useComponentState();
3401
- (0, import_react18.useEffect)(() => {
3703
+ (0, import_react19.useEffect)(() => {
3402
3704
  if (groupRenderStrategy === "single-column") {
3403
3705
  return;
3404
3706
  }
@@ -3463,25 +3765,27 @@ function getColumnsWhenGrouping(params) {
3463
3765
  const computedColumns = new Map();
3464
3766
  if (groupRenderStrategy === "multi-column") {
3465
3767
  groupRowsBy.forEach((groupByForColumn, groupIndexForColumn, arr) => {
3466
- computedColumns.set(`group-by-${groupByForColumn.field}`, getColumnForGroupBy({
3768
+ const generatedGroupColumn = getColumnForGroupBy({
3467
3769
  groupByForColumn,
3468
3770
  groupRowsBy,
3469
3771
  groupIndexForColumn,
3470
3772
  groupCount: arr.length,
3471
3773
  groupRenderStrategy
3472
- }, toggleGroupRow, groupColumn));
3774
+ }, toggleGroupRow, groupColumn);
3775
+ computedColumns.set(generatedGroupColumn.id || `group-by-${groupByForColumn.field}`, generatedGroupColumn);
3473
3776
  });
3474
3777
  } else if (groupRenderStrategy === "single-column") {
3475
- computedColumns.set("group-by", getSingleGroupColumn({
3778
+ const singleGroupColumn = getSingleGroupColumn({
3476
3779
  groupCount: groupRowsBy.length,
3477
3780
  groupRowsBy,
3478
3781
  groupRenderStrategy
3479
- }, toggleGroupRow, groupColumn));
3782
+ }, toggleGroupRow, groupColumn);
3783
+ computedColumns.set(singleGroupColumn.id || "group-by", singleGroupColumn);
3480
3784
  }
3481
3785
  columns.forEach((col, colId) => {
3482
3786
  computedColumns.set(colId, col);
3483
3787
  });
3484
- return computedColumns;
3788
+ return computedColumns.size ? computedColumns : void 0;
3485
3789
  }
3486
3790
 
3487
3791
  // src/components/InfiniteTable/hooks/useComputed.ts
@@ -3492,8 +3796,15 @@ function useComputed() {
3492
3796
  componentActions: dataSourceActions,
3493
3797
  componentState: dataSourceState
3494
3798
  } = useDataSourceContextValue();
3495
- const { columnOrder, columnVisibility, columnPinning, bodySize } = componentState;
3496
- (0, import_react19.useState)(() => {
3799
+ const {
3800
+ columnOrder,
3801
+ columnVisibility,
3802
+ columnPinning,
3803
+ columnSizing,
3804
+ columnTypes,
3805
+ bodySize
3806
+ } = componentState;
3807
+ (0, import_react20.useState)(() => {
3497
3808
  componentState.onRowHeightCSSVarChange.onChange((rowHeight) => {
3498
3809
  if (rowHeight) {
3499
3810
  componentActions.rowHeight = rowHeight;
@@ -3509,9 +3820,10 @@ function useComputed() {
3509
3820
  const { multiSort } = dataSourceState;
3510
3821
  useColumnGroups();
3511
3822
  useColumnsWhen();
3512
- const setSortInfo = (0, import_react19.useCallback)((sortInfo) => {
3823
+ const setSortInfo = (0, import_react20.useCallback)((sortInfo) => {
3513
3824
  var _a2;
3514
- dataSourceActions.sortInfo = multiSort ? sortInfo : (_a2 = sortInfo[0]) != null ? _a2 : null;
3825
+ const newSortInfo = multiSort ? sortInfo : (_a2 = sortInfo[0]) != null ? _a2 : null;
3826
+ dataSourceActions.sortInfo = newSortInfo;
3515
3827
  }, []);
3516
3828
  const columns = componentState.computedColumns;
3517
3829
  const {
@@ -3537,6 +3849,7 @@ function useComputed() {
3537
3849
  pinnedStartMaxWidth: componentState.pinnedStartMaxWidth,
3538
3850
  pinnedEndMaxWidth: componentState.pinnedEndMaxWidth,
3539
3851
  bodySize,
3852
+ viewportReservedWidth: componentState.viewportReservedWidth,
3540
3853
  sortable: componentState.sortable,
3541
3854
  draggableColumns: componentState.draggableColumns,
3542
3855
  sortInfo: (_a = dataSourceState.sortInfo) != null ? _a : void 0,
@@ -3545,7 +3858,9 @@ function useComputed() {
3545
3858
  columnOrder,
3546
3859
  columnVisibility,
3547
3860
  columnVisibilityAssumeVisible: true,
3548
- columnPinning
3861
+ columnPinning,
3862
+ columnSizing,
3863
+ columnTypes
3549
3864
  });
3550
3865
  const unpinnedColumnWidths = computedUnpinnedColumns.map((c) => c.computedWidth);
3551
3866
  let sortedUnpinnedColumnWidths = [...unpinnedColumnWidths].sort(sortAscending);
@@ -3616,33 +3931,6 @@ var InfiniteTableBody = React10.forwardRef(function InfiniteTableBody2(props, re
3616
3931
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx
3617
3932
  var React22 = __toModule(require("react"));
3618
3933
 
3619
- // src/utils/getGlobal.ts
3620
- function getGlobal() {
3621
- return globalThis;
3622
- }
3623
-
3624
- // src/components/utils/getScrollbarWidth.ts
3625
- var scrollbarWidth;
3626
- function getScrollbarWidth() {
3627
- var _a, _b;
3628
- if (scrollbarWidth != null) {
3629
- return scrollbarWidth;
3630
- }
3631
- const doc = (_a = getGlobal().document) != null ? _a : null;
3632
- if (!doc) {
3633
- return 0;
3634
- }
3635
- const outer = doc.createElement("div");
3636
- outer.style.visibility = "hidden";
3637
- outer.style.overflow = "scroll";
3638
- doc.body.appendChild(outer);
3639
- const inner = doc.createElement("div");
3640
- outer.appendChild(inner);
3641
- scrollbarWidth = outer.offsetWidth - inner.offsetWidth;
3642
- (_b = outer.parentNode) == null ? void 0 : _b.removeChild(outer);
3643
- return scrollbarWidth;
3644
- }
3645
-
3646
3934
  // src/components/InfiniteTable/components/ScrollbarPlaceholder.tsx
3647
3935
  var React11 = __toModule(require("react"));
3648
3936
  function HorizontalScrollbarPlaceholderFn(props) {
@@ -3679,10 +3967,11 @@ function VerticalScrollbarPlaceholderFn(props) {
3679
3967
  var VerticalScrollbarPlaceholder = React11.memo(VerticalScrollbarPlaceholderFn);
3680
3968
 
3681
3969
  // src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts
3970
+ var import_createRuntimeFn2 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
3682
3971
  var CellCls = "_1eexc2a5 _16lm1iwj _16lm1iw10 _16lm1iw11 _16lm1iw2 _16lm1iw19 _16lm1iw1a";
3683
3972
  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"]] });
3973
+ 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"]] });
3974
+ 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
3975
  var HeaderGroupCls = "_16lm1iwz _16lm1iwj";
3687
3976
  var HeaderGroup_Children = "_16lm1iwj _16lm1iw10 _16lm1iw12 _16lm1iwc";
3688
3977
  var HeaderGroup_Header = "_12zfob1x _16lm1iwj _16lm1iw10 _16lm1iw11";
@@ -3691,27 +3980,28 @@ var HeaderWrapperCls = "_12zfob1v _16lm1iw16 _16lm1iw1 _16lm1iwj _16lm1iw10";
3691
3980
 
3692
3981
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
3693
3982
  var React18 = __toModule(require("react"));
3694
- var import_react26 = __toModule(require("react"));
3983
+ var import_react28 = __toModule(require("react"));
3695
3984
 
3696
3985
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
3697
3986
  var React14 = __toModule(require("react"));
3698
- var import_react23 = __toModule(require("react"));
3987
+ var import_react24 = __toModule(require("react"));
3699
3988
 
3700
3989
  // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
3701
3990
  var React12 = __toModule(require("react"));
3702
3991
 
3703
3992
  // src/components/InfiniteTable/hooks/useInfiniteTableState.ts
3704
- var import_react20 = __toModule(require("react"));
3993
+ var import_react21 = __toModule(require("react"));
3705
3994
  var useInfiniteTableState = () => {
3706
3995
  const TableContext2 = getInfiniteTableContext();
3707
- const { componentState } = (0, import_react20.useContext)(TableContext2);
3996
+ const { componentState } = (0, import_react21.useContext)(TableContext2);
3708
3997
  return componentState;
3709
3998
  };
3710
3999
 
3711
4000
  // src/components/InfiniteTable/components/cell.css.ts
4001
+ var import_createRuntimeFn3 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
3712
4002
  var CellCls2 = "_1eexc2a5 _16lm1iwj _16lm1iw10 _16lm1iw11 _16lm1iw2 _16lm1iw19 _16lm1iw1a";
3713
4003
  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"]] });
4004
+ 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
4005
  var columnAlignCellStyle = { center: "_1eexc2a0", start: "_1eexc2a1", end: "_1eexc2a2" };
3716
4006
 
3717
4007
  // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
@@ -3769,7 +4059,7 @@ var InfiniteTableCell = React12.memo(InfiniteTableCellFn);
3769
4059
 
3770
4060
  // src/components/InfiniteTable/hooks/useColumnPointerEvents.ts
3771
4061
  var import_binary_search = __toModule(require_binary_search());
3772
- var import_react21 = __toModule(require("react"));
4062
+ var import_react22 = __toModule(require("react"));
3773
4063
 
3774
4064
  // src/components/InfiniteTable/utils/moveXatY.ts
3775
4065
  var moveXatY = (arr, dragIndex, dropIndex) => {
@@ -3803,18 +4093,18 @@ var useColumnPointerEvents = ({
3803
4093
  columns,
3804
4094
  computedRemainingSpace
3805
4095
  }) => {
3806
- const [draggingDiff, setDraggingDiff] = (0, import_react21.useState)(null);
3807
- const [proxyOffset, setProxyOffset] = (0, import_react21.useState)(null);
3808
- const breakpointsRef = (0, import_react21.useRef)([]);
3809
- const pointerMoveRef = (0, import_react21.useRef)(null);
3810
- const didDragRef = (0, import_react21.useRef)(false);
3811
- const initialClientPos = (0, import_react21.useRef)(null);
3812
- const currentDropIndexRef = (0, import_react21.useRef)(null);
4096
+ const [draggingDiff, setDraggingDiff] = (0, import_react22.useState)(null);
4097
+ const [proxyOffset, setProxyOffset] = (0, import_react22.useState)(null);
4098
+ const breakpointsRef = (0, import_react22.useRef)([]);
4099
+ const pointerMoveRef = (0, import_react22.useRef)(null);
4100
+ const didDragRef = (0, import_react22.useRef)(false);
4101
+ const initialClientPos = (0, import_react22.useRef)(null);
4102
+ const currentDropIndexRef = (0, import_react22.useRef)(null);
3813
4103
  const dragging = draggingDiff != null;
3814
4104
  const { componentActions, computed } = useInfiniteTable();
3815
4105
  const { computedColumnOrder } = computed;
3816
- const column = (0, import_react21.useMemo)(() => columns.get(columnId), [columnId, columns]);
3817
- const { columnIndex, columnWidth, columnsArray } = (0, import_react21.useMemo)(() => {
4106
+ const column = (0, import_react22.useMemo)(() => columns.get(columnId), [columnId, columns]);
4107
+ const { columnIndex, columnWidth, columnsArray } = (0, import_react22.useMemo)(() => {
3818
4108
  const columnsArray2 = Array.from(columns.values());
3819
4109
  return {
3820
4110
  columnsArray: columnsArray2,
@@ -3822,8 +4112,8 @@ var useColumnPointerEvents = ({
3822
4112
  columnWidth: column.computedWidth
3823
4113
  };
3824
4114
  }, [columns, columnId, column]);
3825
- let cursorRef = (0, import_react21.useRef)("auto");
3826
- const onPointerDown = (0, import_react21.useCallback)((e) => {
4115
+ let cursorRef = (0, import_react22.useRef)("auto");
4116
+ const onPointerDown = (0, import_react22.useCallback)((e) => {
3827
4117
  const target = domRef.current;
3828
4118
  cursorRef.current = target.style.cursor;
3829
4119
  didDragRef.current = false;
@@ -3886,7 +4176,7 @@ var useColumnPointerEvents = ({
3886
4176
  target.addEventListener("pointermove", onPointerMove);
3887
4177
  target.setPointerCapture(e.pointerId);
3888
4178
  }, [columns, column, columnIndex, columnsArray, computedRemainingSpace]);
3889
- const onPointerUp = (0, import_react21.useCallback)((e) => {
4179
+ const onPointerUp = (0, import_react22.useCallback)((e) => {
3890
4180
  const target = domRef.current;
3891
4181
  target.style.cursor = cursorRef.current;
3892
4182
  target.releasePointerCapture(e.pointerId);
@@ -3961,7 +4251,7 @@ var import_react_dom = __toModule(require("react-dom"));
3961
4251
 
3962
4252
  // src/components/InfiniteTable/components/icons/SortIcon.tsx
3963
4253
  var React13 = __toModule(require("react"));
3964
- var import_react22 = __toModule(require("react"));
4254
+ var import_react23 = __toModule(require("react"));
3965
4255
  var defaultLineStyle = {
3966
4256
  marginTop: 2,
3967
4257
  marginBottom: 2,
@@ -3969,8 +4259,8 @@ var defaultLineStyle = {
3969
4259
  };
3970
4260
  function SortIcon(props) {
3971
4261
  var _a;
3972
- const [rendered, setRendered] = (0, import_react22.useState)(true);
3973
- const [opacity, setOpacity] = (0, import_react22.useState)(0);
4262
+ const [rendered, setRendered] = (0, import_react23.useState)(true);
4263
+ const [opacity, setOpacity] = (0, import_react23.useState)(0);
3974
4264
  const { direction, lineWidth = 1, style, className, index } = props;
3975
4265
  const showIndex = index != null && index > 0;
3976
4266
  const size = (_a = props.size) != null ? _a : 16;
@@ -3984,7 +4274,7 @@ function SortIcon(props) {
3984
4274
  }), props.lineStyle), {
3985
4275
  opacity
3986
4276
  });
3987
- (0, import_react22.useEffect)(() => {
4277
+ (0, import_react23.useEffect)(() => {
3988
4278
  const newOpacity = direction != 0 ? 1 : 0;
3989
4279
  if (!rendered && newOpacity) {
3990
4280
  setRendered(true);
@@ -4061,8 +4351,8 @@ function InfiniteTableHeaderCell(props) {
4061
4351
  className: `${baseCls}__sort-icon ${HeaderSortIconCls}`,
4062
4352
  direction: column.computedSorted ? column.computedSortedAsc ? 1 : -1 : 0
4063
4353
  });
4064
- const domRef = (0, import_react23.useRef)(null);
4065
- const ref = (0, import_react23.useCallback)((node) => {
4354
+ const domRef = (0, import_react24.useRef)(null);
4355
+ const ref = (0, import_react24.useCallback)((node) => {
4066
4356
  var _a2;
4067
4357
  domRef.current = node;
4068
4358
  (_a2 = props.domRef) == null ? void 0 : _a2.call(props, node);
@@ -4071,7 +4361,7 @@ function InfiniteTableHeaderCell(props) {
4071
4361
  computed: { computedRemainingSpace },
4072
4362
  componentState: { portalDOMRef }
4073
4363
  } = useInfiniteTable();
4074
- (0, import_react23.useEffect)(() => {
4364
+ (0, import_react24.useEffect)(() => {
4075
4365
  let clearOnResize = null;
4076
4366
  const node = domRef.current;
4077
4367
  if (onResize && node) {
@@ -4124,7 +4414,25 @@ function InfiniteTableHeaderCell(props) {
4124
4414
 
4125
4415
  // src/components/RawList/index.tsx
4126
4416
  var React17 = __toModule(require("react"));
4417
+ var import_react27 = __toModule(require("react"));
4418
+
4419
+ // src/components/RawList/AvoidReactDiff.tsx
4420
+ var React15 = __toModule(require("react"));
4127
4421
  var import_react25 = __toModule(require("react"));
4422
+ function AvoidReactDiffFn(props) {
4423
+ const [children, setChildren] = (0, import_react25.useState)(props.updater.get());
4424
+ (0, import_react25.useLayoutEffect)(() => {
4425
+ const remove = props.updater.onChange((children2) => {
4426
+ setChildren(children2);
4427
+ });
4428
+ return remove;
4429
+ }, [props.updater]);
4430
+ return /* @__PURE__ */ React15.createElement(React15.Fragment, null, children);
4431
+ }
4432
+ var AvoidReactDiff = React15.memo(AvoidReactDiffFn);
4433
+
4434
+ // src/components/RawList/useVirtualRenderer.ts
4435
+ var import_react26 = __toModule(require("react"));
4128
4436
 
4129
4437
  // src/components/RawList/ReactVirtualRenderer.tsx
4130
4438
  var React16 = __toModule(require("react"));
@@ -4143,10 +4451,10 @@ var MappedItems = class extends Logger {
4143
4451
  return result;
4144
4452
  };
4145
4453
  this.getElementsOutsideItemRange = (startIndex, endIndex) => {
4146
- const map = this.elementIndexToItemIndex;
4454
+ const map2 = this.elementIndexToItemIndex;
4147
4455
  const result = [];
4148
- for (const elementIndex in map) {
4149
- const itemIndex = map[elementIndex];
4456
+ for (const elementIndex in map2) {
4457
+ const itemIndex = map2[elementIndex];
4150
4458
  if (itemIndex < startIndex || itemIndex > endIndex) {
4151
4459
  result.push(elementIndex >> 0);
4152
4460
  }
@@ -4222,6 +4530,9 @@ var MappedItems = class extends Logger {
4222
4530
  this.itemIndexToElementIndex = {};
4223
4531
  this.renderedElements = {};
4224
4532
  }
4533
+ reset() {
4534
+ this.init();
4535
+ }
4225
4536
  destroy() {
4226
4537
  this.init();
4227
4538
  }
@@ -4241,21 +4552,6 @@ var MappedItems = class extends Logger {
4241
4552
  }
4242
4553
  };
4243
4554
 
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
4555
  // src/components/RawList/ReactVirtualRenderer.tsx
4260
4556
  var ITEM_POSITION_WITH_TRANSFORM = true;
4261
4557
  var ReactVirtualRenderer = class extends Logger {
@@ -4362,17 +4658,12 @@ var ReactVirtualRenderer = class extends Logger {
4362
4658
  }
4363
4659
  };
4364
4660
  this.destroy = () => {
4365
- if (true) {
4366
- return;
4367
- }
4368
4661
  this.destroyed = true;
4369
- this.mappedItems.destroy();
4370
- this.itemDOMElements = [];
4371
- this.itemDOMRefs = [];
4372
- this.updaters = [];
4662
+ this.reset();
4373
4663
  this.onRender = null;
4374
4664
  this.renderItem = null;
4375
4665
  this.brain = null;
4666
+ this.mappedItems = null;
4376
4667
  };
4377
4668
  if (onRender) {
4378
4669
  this.onRender = onRender;
@@ -4430,28 +4721,53 @@ var ReactVirtualRenderer = class extends Logger {
4430
4721
  itemUpdater(renderedNode);
4431
4722
  this.updateElementPosition(elementIndex);
4432
4723
  }
4724
+ reset() {
4725
+ this.itemDOMElements = {};
4726
+ this.itemDOMRefs = {};
4727
+ this.updaters = {};
4728
+ this.items = [];
4729
+ this.mappedItems.reset();
4730
+ }
4433
4731
  };
4434
4732
 
4733
+ // src/components/RawList/useVirtualRenderer.ts
4734
+ function createRenderer(brain) {
4735
+ const renderer = new ReactVirtualRenderer(brain, {});
4736
+ const onRenderUpdater = buildSubscriptionCallback();
4737
+ brain.onDestroy(() => {
4738
+ renderer.destroy();
4739
+ onRenderUpdater.destroy();
4740
+ });
4741
+ return {
4742
+ renderer,
4743
+ onRenderUpdater
4744
+ };
4745
+ }
4746
+ function useVirtualRenderer({
4747
+ brain
4748
+ }) {
4749
+ return (0, import_react26.useMemo)(() => {
4750
+ return createRenderer(brain);
4751
+ }, [brain]);
4752
+ }
4753
+
4435
4754
  // src/components/RawList/index.tsx
4436
4755
  function RawListFn(props) {
4437
4756
  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
- }, []);
4757
+ const { onRenderUpdater, renderer } = useVirtualRenderer({
4758
+ brain,
4759
+ debugChannel
4760
+ });
4445
4761
  const getRenderItem = useLatest(renderItem);
4446
- (0, import_react25.useEffect)(() => {
4762
+ (0, import_react27.useEffect)(() => {
4447
4763
  const renderRange = brain.getRenderRange();
4448
4764
  renderer.renderRange(renderRange, {
4449
4765
  renderItem,
4450
4766
  force: true,
4451
4767
  onRender: onRenderUpdater
4452
4768
  });
4453
- }, [renderItem, onRenderUpdater]);
4454
- (0, import_react25.useEffect)(() => {
4769
+ }, [brain, renderItem, onRenderUpdater]);
4770
+ (0, import_react27.useEffect)(() => {
4455
4771
  const remove = brain.onRenderRangeChange((renderRange) => {
4456
4772
  renderer.renderRange(renderRange, {
4457
4773
  force: false,
@@ -4461,12 +4777,6 @@ function RawListFn(props) {
4461
4777
  });
4462
4778
  return remove;
4463
4779
  }, [brain, onRenderUpdater]);
4464
- (0, import_react25.useEffect)(() => {
4465
- return () => {
4466
- renderer.destroy();
4467
- onRenderUpdater.destroy();
4468
- };
4469
- }, [renderer, onRenderUpdater]);
4470
4780
  return /* @__PURE__ */ React17.createElement(AvoidReactDiff, {
4471
4781
  updater: onRenderUpdater
4472
4782
  });
@@ -4484,7 +4794,7 @@ function InfiniteTableHeaderFn(props) {
4484
4794
  componentState: { headerHeight }
4485
4795
  } = useInfiniteTable();
4486
4796
  const { computedVisibleColumnsMap } = computed;
4487
- const renderColumn = (0, import_react26.useCallback)(({ domRef: domRef2, itemIndex: columnIndex }) => {
4797
+ const renderColumn = (0, import_react28.useCallback)(({ domRef: domRef2, itemIndex: columnIndex }) => {
4488
4798
  const column = columns[columnIndex];
4489
4799
  if (!column) {
4490
4800
  if (true) {
@@ -4499,14 +4809,14 @@ function InfiniteTableHeaderFn(props) {
4499
4809
  columns: computedVisibleColumnsMap
4500
4810
  });
4501
4811
  }, [computedVisibleColumnsMap, columns, repaintId, headerHeight]);
4502
- (0, import_react26.useEffect)(() => {
4812
+ (0, import_react28.useEffect)(() => {
4503
4813
  const onScroll = (scrollPosition) => {
4504
4814
  domRef.current.style.transform = `translate3d(-${scrollPosition.scrollLeft}px, 0px, 0px)`;
4505
4815
  };
4506
4816
  const removeOnScroll = brain.onScroll(onScroll);
4507
4817
  return removeOnScroll;
4508
4818
  }, [brain]);
4509
- const domRef = (0, import_react26.useRef)(null);
4819
+ const domRef = (0, import_react28.useRef)(null);
4510
4820
  const headerCls = HeaderClsRecipe({
4511
4821
  pinned: pinning,
4512
4822
  overflow: false,
@@ -4532,7 +4842,7 @@ var React20 = __toModule(require("react"));
4532
4842
 
4533
4843
  // src/components/InfiniteTable/components/InfiniteTableHeader/buildColumnAndGroupTree.ts
4534
4844
  function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
4535
- const map = new Map();
4845
+ const map2 = new Map();
4536
4846
  const temporaryMap = new Map();
4537
4847
  const mapOfAllParentGroupsForColumns = new Map();
4538
4848
  columns.forEach((col, index) => {
@@ -4550,7 +4860,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
4550
4860
  computedWidth: col.computedWidth,
4551
4861
  depth: col.columnGroup ? ((_d = columnGroupsDepthsMap.get(col.columnGroup)) != null ? _d : 0) + 1 : 0
4552
4862
  };
4553
- map.set([colId], colItem);
4863
+ map2.set([colId], colItem);
4554
4864
  let groupId = col.columnGroup;
4555
4865
  let colGroupItem;
4556
4866
  let prevGroupItem = colItem;
@@ -4572,7 +4882,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
4572
4882
  computedWidth: 0,
4573
4883
  depth: (_e = columnGroupsDepthsMap.get(groupId)) != null ? _e : 0
4574
4884
  };
4575
- map.set(groupAbsoluteId, colGroupItem);
4885
+ map2.set(groupAbsoluteId, colGroupItem);
4576
4886
  temporaryMap.set(groupId, colGroupItem);
4577
4887
  }
4578
4888
  colGroupItem.columnItems.push(colItem);
@@ -4589,7 +4899,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
4589
4899
  });
4590
4900
  const result = [];
4591
4901
  let groupOffset = 0;
4592
- map.forEach((item) => {
4902
+ map2.forEach((item) => {
4593
4903
  if (!item.ref.columnGroup) {
4594
4904
  const itemWidth = item.type === "column" ? item.ref.computedWidth : item.columnItems.reduce((sum, col) => sum + col.ref.computedWidth, 0);
4595
4905
  item.groupOffset = groupOffset;
@@ -4601,7 +4911,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
4601
4911
  groupOffset += itemWidth;
4602
4912
  }
4603
4913
  });
4604
- map.clear();
4914
+ map2.clear();
4605
4915
  temporaryMap.clear();
4606
4916
  return result;
4607
4917
  }
@@ -4698,7 +5008,7 @@ function renderColumnHeaderGroups(config) {
4698
5008
  }
4699
5009
 
4700
5010
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderUnvirtualized.tsx
4701
- var import_react27 = __toModule(require("react"));
5011
+ var import_react29 = __toModule(require("react"));
4702
5012
  var { rootClassName: rootClassName5 } = internalProps;
4703
5013
  var TableHeaderClassName2 = `${rootClassName5}Header`;
4704
5014
  var UPDATE_SCROLL = (node, scrollPosition) => {
@@ -4764,7 +5074,7 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
4764
5074
  if (totalWidth != null) {
4765
5075
  style.width = availableWidth;
4766
5076
  }
4767
- (0, import_react27.useEffect)(() => {
5077
+ (0, import_react29.useEffect)(() => {
4768
5078
  const scroller = brain || scrollListener;
4769
5079
  if (!scroller || !scrollable) {
4770
5080
  return;
@@ -4878,12 +5188,12 @@ function TableHeaderWrapper(props) {
4878
5188
 
4879
5189
  // src/components/VirtualScrollContainer/index.tsx
4880
5190
  var React23 = __toModule(require("react"));
4881
- var import_react29 = __toModule(require("react"));
5191
+ var import_react31 = __toModule(require("react"));
4882
5192
 
4883
5193
  // src/components/hooks/useOnScroll.ts
4884
- var import_react28 = __toModule(require("react"));
5194
+ var import_react30 = __toModule(require("react"));
4885
5195
  var useOnScroll = (domRef, onScroll) => {
4886
- (0, import_react28.useEffect)(() => {
5196
+ (0, import_react30.useEffect)(() => {
4887
5197
  const domNode = domRef == null ? void 0 : domRef.current;
4888
5198
  const scrollFn = (event) => {
4889
5199
  const node = event.target;
@@ -4929,7 +5239,7 @@ var VirtualScrollContainer = React23.forwardRef(function VirtualScrollContainer2
4929
5239
  className,
4930
5240
  style
4931
5241
  } = props;
4932
- const domRef = ref != null ? ref : (0, import_react29.useRef)(null);
5242
+ const domRef = ref != null ? ref : (0, import_react31.useRef)(null);
4933
5243
  useOnScroll(domRef, onContainerScroll);
4934
5244
  return /* @__PURE__ */ React23.createElement("div", {
4935
5245
  ref: domRef,
@@ -4960,18 +5270,18 @@ function SpacePlaceholderFn(props) {
4960
5270
  var SpacePlaceholder = React24.memo(SpacePlaceholderFn);
4961
5271
 
4962
5272
  // src/components/InfiniteTable/hooks/useListRendering.tsx
4963
- var import_react40 = __toModule(require("react"));
5273
+ var import_react42 = __toModule(require("react"));
4964
5274
 
4965
5275
  // src/components/InfiniteTable/hooks/useUnpinnedRendering.tsx
4966
5276
  var React30 = __toModule(require("react"));
4967
- var import_react33 = __toModule(require("react"));
5277
+ var import_react35 = __toModule(require("react"));
4968
5278
 
4969
5279
  // src/components/VirtualList/VirtualRowList.tsx
4970
5280
  var React26 = __toModule(require("react"));
4971
5281
 
4972
5282
  // src/components/VirtualList/VirtualList.tsx
4973
5283
  var React25 = __toModule(require("react"));
4974
- var import_react30 = __toModule(require("react"));
5284
+ var import_react32 = __toModule(require("react"));
4975
5285
 
4976
5286
  // src/components/VirtualList/VirtualList.css.ts
4977
5287
  var VirtualListCls = "mlx2t0 _16lm1iw0";
@@ -5014,11 +5324,11 @@ var VirtualList = (props) => {
5014
5324
  "onContainerScroll",
5015
5325
  "children"
5016
5326
  ]);
5017
- const domRef = (0, import_react30.useRef)(null);
5327
+ const domRef = (0, import_react32.useRef)(null);
5018
5328
  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)(() => {
5329
+ const [totalSize, setTotalSize] = (0, import_react32.useState)(0);
5330
+ const renderCountRef = (0, import_react32.useRef)(0);
5331
+ (0, import_react32.useEffect)(() => {
5022
5332
  const removeOnRenderCount = virtualBrain.onRenderCountChange((renderCount) => {
5023
5333
  renderCountRef.current = renderCount;
5024
5334
  if (true) {
@@ -5037,7 +5347,7 @@ var VirtualList = (props) => {
5037
5347
  removeOnTotalSizeChange();
5038
5348
  };
5039
5349
  }, [virtualBrain]);
5040
- (0, import_react30.useEffect)(() => {
5350
+ (0, import_react32.useEffect)(() => {
5041
5351
  const onScroll = (scrollPosition) => {
5042
5352
  UPDATE_SCROLL2(domRef.current, scrollPosition);
5043
5353
  };
@@ -5063,7 +5373,7 @@ var VirtualList = (props) => {
5063
5373
  brain: virtualBrain,
5064
5374
  renderItem,
5065
5375
  repaintId,
5066
- debugChannel: "VirtualList"
5376
+ debugChannel: "VirtualList-" + mainAxis
5067
5377
  })), children, /* @__PURE__ */ React25.createElement(SpacePlaceholder, {
5068
5378
  count,
5069
5379
  width,
@@ -5091,7 +5401,7 @@ var VirtualRowList = (props) => {
5091
5401
 
5092
5402
  // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRow.tsx
5093
5403
  var React28 = __toModule(require("react"));
5094
- var import_react32 = __toModule(require("react"));
5404
+ var import_react34 = __toModule(require("react"));
5095
5405
 
5096
5406
  // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableColumnCell.tsx
5097
5407
  var React27 = __toModule(require("react"));
@@ -5195,7 +5505,7 @@ function InfiniteTableColumnCellFn(props) {
5195
5505
  var InfiniteTableColumnCell = React27.memo(InfiniteTableColumnCellFn);
5196
5506
 
5197
5507
  // src/components/InfiniteTable/components/InfiniteTableRow/useRowDOMProps.ts
5198
- var import_react31 = __toModule(require("react"));
5508
+ var import_react33 = __toModule(require("react"));
5199
5509
 
5200
5510
  // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRowClassName.ts
5201
5511
  var { rootClassName: rootClassName9 } = internalProps;
@@ -5220,8 +5530,8 @@ function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStra
5220
5530
  domRef: domRefFromProps,
5221
5531
  rowInfo
5222
5532
  } = props;
5223
- const domRef = (0, import_react31.useRef)(null);
5224
- const rowDOMRef = (0, import_react31.useCallback)((node) => {
5533
+ const domRef = (0, import_react33.useRef)(null);
5534
+ const rowDOMRef = (0, import_react33.useCallback)((node) => {
5225
5535
  domRefFromProps(node);
5226
5536
  domRef.current = node;
5227
5537
  }, []);
@@ -5253,7 +5563,7 @@ function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStra
5253
5563
  }), `${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
5564
  const initialMouseEnter = rowProps == null ? void 0 : rowProps.onMouseEnter;
5255
5565
  const initialMouseLeave = rowProps == null ? void 0 : rowProps.onMouseLeave;
5256
- const onMouseEnter = (0, import_react31.useCallback)((event) => {
5566
+ const onMouseEnter = (0, import_react33.useCallback)((event) => {
5257
5567
  var _a;
5258
5568
  initialMouseEnter == null ? void 0 : initialMouseEnter(event);
5259
5569
  const rowIndex2 = ((_a = event.currentTarget) == null ? void 0 : _a.dataset.rowIndex) * 1;
@@ -5267,7 +5577,7 @@ function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStra
5267
5577
  const rows = parentNode.querySelectorAll(hoverSelector.join(","));
5268
5578
  rows.forEach((row) => row.classList.add(InfiniteTableRowClassName__hover, RowHoverCls));
5269
5579
  }, [initialMouseEnter, showHoverRows]);
5270
- const onMouseLeave = (0, import_react31.useCallback)((event) => {
5580
+ const onMouseLeave = (0, import_react33.useCallback)((event) => {
5271
5581
  var _a;
5272
5582
  initialMouseLeave == null ? void 0 : initialMouseLeave(event);
5273
5583
  const rowIndex2 = (_a = event.currentTarget) == null ? void 0 : _a.dataset.rowIndex;
@@ -5323,7 +5633,7 @@ function InfiniteTableRowFn(props) {
5323
5633
  width: rowWidth,
5324
5634
  height: rowHeight
5325
5635
  }, domProps.style);
5326
- const renderCellRef = (0, import_react32.useRef)(null);
5636
+ const renderCellRef = (0, import_react34.useRef)(null);
5327
5637
  const renderCell = React28.useCallback(({ domRef, itemIndex }) => {
5328
5638
  const column = columns[itemIndex];
5329
5639
  if (!column) {
@@ -5427,7 +5737,7 @@ function useUnpinnedRendering(params) {
5427
5737
  } = params;
5428
5738
  const { virtualizeColumns } = getState();
5429
5739
  const shouldVirtualizeColumns = typeof virtualizeColumns === "function" ? virtualizeColumns(computedUnpinnedColumns) : virtualizeColumns != null ? virtualizeColumns : true;
5430
- const renderRowUnpinned = (0, import_react33.useCallback)((rowParams) => {
5740
+ const renderRowUnpinned = (0, import_react35.useCallback)((rowParams) => {
5431
5741
  const dataArray = getData();
5432
5742
  const rowInfo = dataArray[rowParams.rowIndex];
5433
5743
  const { showZebraRows, showHoverRows } = getState();
@@ -5493,22 +5803,23 @@ function useUnpinnedRendering(params) {
5493
5803
  }
5494
5804
 
5495
5805
  // src/components/InfiniteTable/hooks/useOnContainerScroll.ts
5496
- var import_react34 = __toModule(require("react"));
5806
+ var import_react36 = __toModule(require("react"));
5497
5807
 
5498
5808
  // src/components/InfiniteTable/InfiniteCls.css.ts
5809
+ var import_createRuntimeFn4 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
5499
5810
  var FooterCls = "_16lm1iw1";
5500
5811
  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: [] });
5812
+ 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
5813
  var InfiniteClsScrolling = "_1yeub2v1";
5503
5814
  var InfiniteClsShiftingColumns = "_16lm1iwm";
5504
5815
  var PinnedRowsClsVariants = { pinnedStart: "_1yeub2ve", pinnedEnd: "_1yeub2vf", overflow: "_1yeub2vg" };
5505
- var PinnedRowsContainerClsVariants = createRuntimeFn({ defaultClassName: "", variantClassNames: { pinned: { start: "_1yeub2vh", end: "_1yeub2vi", false: "_1yeub2vj" } }, defaultVariants: {}, compoundVariants: [] });
5816
+ var PinnedRowsContainerClsVariants = (0, import_createRuntimeFn4.createRuntimeFn)({ defaultClassName: "", variantClassNames: { pinned: { start: "_1yeub2vh", end: "_1yeub2vi", false: "_1yeub2vj" } }, defaultVariants: {}, compoundVariants: [] });
5506
5817
 
5507
5818
  // src/components/InfiniteTable/hooks/useOnContainerScroll.ts
5508
5819
  var DELAY = 200;
5509
5820
  var TableClassName = internalProps.rootClassName;
5510
5821
  var TableClassName__Scrolling = `${TableClassName}--scrolling`;
5511
- var SCROLL_BOTTOM_OFFSET = 0;
5822
+ var SCROLL_BOTTOM_OFFSET = 1;
5512
5823
  var useOnContainerScroll = ({
5513
5824
  verticalVirtualBrain,
5514
5825
  horizontalVirtualBrain,
@@ -5524,14 +5835,15 @@ var useOnContainerScroll = ({
5524
5835
  bodySize
5525
5836
  }
5526
5837
  } = 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)(() => {
5838
+ const { componentActions: dataSourceActions, getState: getDataSourceState } = useDataSourceContextValue();
5839
+ const timeoutIdRef = (0, import_react36.useRef)(0);
5840
+ const scrollingRef = (0, import_react36.useRef)(false);
5841
+ const scrollTopMaxRef = (0, import_react36.useRef)(0);
5842
+ (0, import_react36.useEffect)(() => {
5531
5843
  const { current: node } = scrollerDOMRef;
5532
5844
  scrollTopMaxRef.current = node.scrollHeight - node.clientHeight;
5533
5845
  }, [reservedContentHeight, bodySize.height]);
5534
- const setScrolling = (0, import_react34.useCallback)((scrolling) => {
5846
+ const setScrolling = (0, import_react36.useCallback)((scrolling) => {
5535
5847
  var _a;
5536
5848
  const prevScrolling = scrollingRef.current;
5537
5849
  scrollingRef.current = scrolling;
@@ -5556,7 +5868,7 @@ var useOnContainerScroll = ({
5556
5868
  }
5557
5869
  }
5558
5870
  }, []);
5559
- const onContainerScroll = (0, import_react34.useCallback)((scrollInfo) => {
5871
+ const onContainerScroll = (0, import_react36.useCallback)((scrollInfo) => {
5560
5872
  verticalVirtualBrain.setScrollPosition(scrollInfo);
5561
5873
  horizontalVirtualBrain.setScrollPosition(scrollInfo);
5562
5874
  setScrolling(true);
@@ -5566,15 +5878,15 @@ var useOnContainerScroll = ({
5566
5878
  domRef.current,
5567
5879
  setScrolling
5568
5880
  ]);
5569
- const scrollPositionRef = (0, import_react34.useRef)({
5881
+ const scrollPositionRef = (0, import_react36.useRef)({
5570
5882
  scrollLeft: 0,
5571
5883
  scrollTop: 0
5572
5884
  });
5573
- const applyScrollHorizontal = (0, import_react34.useCallback)(({ scrollLeft }) => {
5885
+ const applyScrollHorizontal = (0, import_react36.useCallback)(({ scrollLeft }) => {
5574
5886
  scrollPositionRef.current.scrollLeft = scrollLeft;
5575
5887
  onContainerScroll(scrollPositionRef.current);
5576
5888
  }, [onContainerScroll]);
5577
- const applyScrollVertical = (0, import_react34.useCallback)(({ scrollTop }) => {
5889
+ const applyScrollVertical = (0, import_react36.useCallback)(({ scrollTop }) => {
5578
5890
  scrollPositionRef.current.scrollTop = scrollTop;
5579
5891
  onContainerScroll(scrollPositionRef.current);
5580
5892
  if (scrollTop === 0) {
@@ -5584,6 +5896,9 @@ var useOnContainerScroll = ({
5584
5896
  const isScrollBottom = scrollTop + offset >= scrollTopMaxRef.current;
5585
5897
  if (isScrollBottom) {
5586
5898
  onScrollToBottom == null ? void 0 : onScrollToBottom();
5899
+ if (getDataSourceState().livePagination) {
5900
+ dataSourceActions.scrollBottomId = Date.now();
5901
+ }
5587
5902
  }
5588
5903
  }, [onContainerScroll, scrollToBottomOffset, onScrollToBottom, onScrollToTop]);
5589
5904
  return {
@@ -5594,16 +5909,16 @@ var useOnContainerScroll = ({
5594
5909
 
5595
5910
  // src/components/InfiniteTable/hooks/usePinnedRendering.tsx
5596
5911
  var React32 = __toModule(require("react"));
5597
- var import_react37 = __toModule(require("react"));
5912
+ var import_react39 = __toModule(require("react"));
5598
5913
 
5599
5914
  // src/components/VirtualList/RowListWithExternalScrolling.tsx
5600
5915
  var React31 = __toModule(require("react"));
5601
- var import_react36 = __toModule(require("react"));
5916
+ var import_react38 = __toModule(require("react"));
5602
5917
 
5603
5918
  // src/components/hooks/useOnMount.ts
5604
- var import_react35 = __toModule(require("react"));
5919
+ var import_react37 = __toModule(require("react"));
5605
5920
  function useOnMount(domRef, props) {
5606
- (0, import_react35.useEffect)(() => {
5921
+ (0, import_react37.useEffect)(() => {
5607
5922
  const { onMount, onUnmount } = props;
5608
5923
  const node = domRef == null ? void 0 : domRef.current;
5609
5924
  onMount == null ? void 0 : onMount(node);
@@ -5634,8 +5949,8 @@ var RowListWithExternalScrolling = (props) => {
5634
5949
  onMount,
5635
5950
  onUnmount
5636
5951
  } = props;
5637
- const domRef = (0, import_react36.useRef)(null);
5638
- const renderItem = (0, import_react36.useCallback)((renderProps) => renderRow({
5952
+ const domRef = (0, import_react38.useRef)(null);
5953
+ const renderItem = (0, import_react38.useCallback)((renderProps) => renderRow({
5639
5954
  domRef: renderProps.domRef,
5640
5955
  rowHeight: renderProps.itemSize,
5641
5956
  rowIndex: renderProps.itemIndex
@@ -5644,7 +5959,7 @@ var RowListWithExternalScrolling = (props) => {
5644
5959
  onMount,
5645
5960
  onUnmount
5646
5961
  });
5647
- (0, import_react36.useEffect)(() => {
5962
+ (0, import_react38.useEffect)(() => {
5648
5963
  const onScroll = (scrollPosition) => {
5649
5964
  const node = domRef.current;
5650
5965
  if (node) {
@@ -5711,7 +6026,7 @@ function PinnedRowsContainer(props) {
5711
6026
  }
5712
6027
  return result;
5713
6028
  }, [height, rowWidth, pinning, hasOverflow]);
5714
- const updateScroll = (0, import_react37.useCallback)((node, scrollPosition) => {
6029
+ const updateScroll = (0, import_react39.useCallback)((node, scrollPosition) => {
5715
6030
  UPDATE_SCROLL3(node, scrollPosition, hasOverflow ? pinnedScrollListener.getScrollPosition() : void 0);
5716
6031
  }, [hasOverflow, pinnedScrollListener]);
5717
6032
  const rowListProps = {
@@ -5753,7 +6068,7 @@ function PinnedRowsContainer(props) {
5753
6068
  }
5754
6069
  function useRenderPinnedRow(params) {
5755
6070
  const { getData, getState, columnsWidth, columns, verticalBrain } = params;
5756
- const renderPinnedRow = (0, import_react37.useCallback)((rowParams) => {
6071
+ const renderPinnedRow = (0, import_react39.useCallback)((rowParams) => {
5757
6072
  const dataArray = getData();
5758
6073
  const rowInfo = dataArray[rowParams.rowIndex];
5759
6074
  const { showZebraRows, showHoverRows } = getState();
@@ -5867,7 +6182,7 @@ function usePinnedStartRendering(params) {
5867
6182
  }
5868
6183
 
5869
6184
  // src/components/InfiniteTable/hooks/useYourBrain.ts
5870
- var import_react39 = __toModule(require("react"));
6185
+ var import_react41 = __toModule(require("react"));
5871
6186
 
5872
6187
  // src/components/VirtualBrain/index.ts
5873
6188
  var import_binary_search2 = __toModule(require_binary_search());
@@ -5883,11 +6198,13 @@ var VirtualBrain = class extends Logger {
5883
6198
  super(`VirtualBrain:${options.mainAxis}`);
5884
6199
  this.scrollPosition = initialScrollPosition2;
5885
6200
  this.scrollPositionOnMainAxis = 0;
6201
+ this.destroyed = false;
5886
6202
  this.totalSize = 0;
5887
6203
  this.onScrollFns = [];
5888
6204
  this.onTotalSizeChangeFns = [];
5889
6205
  this.onRenderCountChangeFns = [];
5890
6206
  this.onRenderRangeChangeFns = [];
6207
+ this.onDestroyFns = [];
5891
6208
  this.renderCount = 0;
5892
6209
  this.renderRange = {
5893
6210
  renderStartIndex: -1,
@@ -5984,6 +6301,12 @@ var VirtualBrain = class extends Logger {
5984
6301
  this.onRenderRangeChangeFns = this.onRenderRangeChangeFns.filter((f) => f !== fn);
5985
6302
  };
5986
6303
  };
6304
+ this.onDestroy = (fn) => {
6305
+ this.onDestroyFns.push(fn);
6306
+ return () => {
6307
+ this.onDestroyFns = this.onDestroyFns.filter((f) => f !== fn);
6308
+ };
6309
+ };
5987
6310
  this.update = (newCount, newItemSize, newItemSpan) => {
5988
6311
  const { itemSize, count, itemSpan } = this.options;
5989
6312
  const countChange = count !== newCount;
@@ -6180,7 +6503,13 @@ var VirtualBrain = class extends Logger {
6180
6503
  return result;
6181
6504
  };
6182
6505
  this.destroy = () => {
6506
+ if (this.destroyed) {
6507
+ return;
6508
+ }
6509
+ this.notifyDestroy();
6183
6510
  this.reset();
6511
+ this.destroyed = true;
6512
+ this.onDestroyFns = [];
6184
6513
  this.onScrollFns = [];
6185
6514
  this.onTotalSizeChangeFns = [];
6186
6515
  this.onRenderCountChangeFns = [];
@@ -6216,6 +6545,12 @@ var VirtualBrain = class extends Logger {
6216
6545
  fns[i](scrollPosition);
6217
6546
  }
6218
6547
  }
6548
+ notifyDestroy() {
6549
+ const fns = this.onDestroyFns;
6550
+ for (let i = 0, len = fns.length; i < len; i++) {
6551
+ fns[i]();
6552
+ }
6553
+ }
6219
6554
  notifyTotalSizeChange() {
6220
6555
  const totalSize = this.getTotalSize();
6221
6556
  const fns = this.onTotalSizeChangeFns;
@@ -6285,9 +6620,9 @@ var VirtualBrain = class extends Logger {
6285
6620
  };
6286
6621
 
6287
6622
  // src/components/InfiniteTable/hooks/useColumnSizeFn.ts
6288
- var import_react38 = __toModule(require("react"));
6623
+ var import_react40 = __toModule(require("react"));
6289
6624
  function useColumnSizeFn(computedUnpinnedColumns) {
6290
- const columnSize = (0, import_react38.useCallback)((index) => {
6625
+ const columnSize = (0, import_react40.useCallback)((index) => {
6291
6626
  const column = computedUnpinnedColumns[index];
6292
6627
  if (!column) {
6293
6628
  console.log("cannot find column at index", index, computedUnpinnedColumns);
@@ -6326,16 +6661,21 @@ function useYourBrain(param) {
6326
6661
  });
6327
6662
  return brain;
6328
6663
  });
6664
+ (0, import_react41.useEffect)(() => {
6665
+ return () => {
6666
+ horizontalVirtualBrain.destroy();
6667
+ verticalVirtualBrain.destroy();
6668
+ };
6669
+ }, []);
6329
6670
  horizontalVirtualBrain.update(computedUnpinnedColumns.length, columnSize);
6330
6671
  verticalVirtualBrain.update(dataArray.length, rowHeight, rowSpan);
6331
- globalThis.verticalVirtualBrain = verticalVirtualBrain;
6332
- (0, import_react39.useEffect)(() => {
6672
+ (0, import_react41.useEffect)(() => {
6333
6673
  verticalVirtualBrain.setAvailableSize({
6334
6674
  height: bodySize.height,
6335
6675
  width: 0
6336
6676
  });
6337
6677
  }, [bodySize, verticalVirtualBrain]);
6338
- (0, import_react39.useEffect)(() => {
6678
+ (0, import_react41.useEffect)(() => {
6339
6679
  horizontalVirtualBrain.setAvailableSize({
6340
6680
  height: 0,
6341
6681
  width: Math.max(bodySize.width - computedPinnedStartWidth - computedPinnedEndWidth, 0)
@@ -6344,29 +6684,6 @@ function useYourBrain(param) {
6344
6684
  return { horizontalVirtualBrain, verticalVirtualBrain };
6345
6685
  }
6346
6686
 
6347
- // src/utils/shallowEqualObjects.ts
6348
- function shallowEqualObjects(objA, objB) {
6349
- if (objA === objB) {
6350
- return true;
6351
- }
6352
- if (!objA || !objB) {
6353
- return false;
6354
- }
6355
- var aKeys = Object.keys(objA);
6356
- var bKeys = Object.keys(objB);
6357
- var len = aKeys.length;
6358
- if (bKeys.length !== len) {
6359
- return false;
6360
- }
6361
- for (var i = 0; i < len; i++) {
6362
- var key = aKeys[i];
6363
- if (objA[key] !== objB[key] || !Object.prototype.hasOwnProperty.call(objB, key)) {
6364
- return false;
6365
- }
6366
- }
6367
- return true;
6368
- }
6369
-
6370
6687
  // src/components/InfiniteTable/hooks/useListRendering.tsx
6371
6688
  function useListRendering(param) {
6372
6689
  const { computed, bodySize, columnShifts } = param;
@@ -6396,12 +6713,12 @@ function useListRendering(param) {
6396
6713
  pinnedEndScrollListener
6397
6714
  } = componentState;
6398
6715
  const prevDataSourceTimestamp = usePrevious(dataSourceState.updatedAt);
6399
- const repaintIdRef = (0, import_react40.useRef)(0);
6716
+ const repaintIdRef = (0, import_react42.useRef)(0);
6400
6717
  if (!shallowEqualObjects(prevComputed, computed) || prevDataSourceTimestamp !== dataSourceState.updatedAt) {
6401
6718
  repaintIdRef.current++;
6402
6719
  }
6403
6720
  const repaintId = repaintIdRef.current;
6404
- const rowSpan = (0, import_react40.useMemo)(() => {
6721
+ const rowSpan = (0, import_react42.useMemo)(() => {
6405
6722
  const colsWithRowspan = computedVisibleColumns.filter((col) => typeof col.rowspan === "function");
6406
6723
  return colsWithRowspan.length ? ({ itemIndex }) => {
6407
6724
  let maxSpan = 1;
@@ -6438,12 +6755,12 @@ function useListRendering(param) {
6438
6755
  });
6439
6756
  const hasHorizontalScrollbar = computedUnpinnedColumnsWidth > bodySize.width - computedPinnedStartColumnsWidth - computedPinnedEndColumnsWidth;
6440
6757
  const reservedContentHeight = verticalVirtualBrain.getTotalSize() + (hasHorizontalScrollbar ? getScrollbarWidth() : 0);
6441
- const hasVerticalScrollbar = bodySize.height < reservedContentHeight;
6442
- const scrollbars = (0, import_react40.useMemo)(() => ({
6758
+ const hasVerticalScrollbar = bodySize.height > 0 && bodySize.height < reservedContentHeight;
6759
+ const scrollbars = (0, import_react42.useMemo)(() => ({
6443
6760
  vertical: hasVerticalScrollbar,
6444
6761
  horizontal: hasHorizontalScrollbar
6445
6762
  }), [hasVerticalScrollbar, hasHorizontalScrollbar]);
6446
- (0, import_react40.useEffect)(() => {
6763
+ (0, import_react42.useEffect)(() => {
6447
6764
  if (!bodySize.height) {
6448
6765
  return;
6449
6766
  }
@@ -6469,7 +6786,7 @@ function useListRendering(param) {
6469
6786
  reservedContentHeight
6470
6787
  });
6471
6788
  const { componentActions: dataSourceActions } = useDataSourceContextValue();
6472
- const toggleGroupRow = (0, import_react40.useCallback)((groupKeys) => {
6789
+ const toggleGroupRow = (0, import_react42.useCallback)((groupKeys) => {
6473
6790
  const newState = new GroupRowsState(getDataSourceState().groupRowsState);
6474
6791
  newState.toggleGroupRow(groupKeys);
6475
6792
  dataSourceActions.groupRowsState = newState;
@@ -6504,7 +6821,7 @@ function useListRendering(param) {
6504
6821
  computedUnpinnedColumns
6505
6822
  });
6506
6823
  const [, rerender] = useRerender();
6507
- (0, import_react40.useEffect)(() => {
6824
+ (0, import_react42.useEffect)(() => {
6508
6825
  rerender();
6509
6826
  }, [dataSourceState]);
6510
6827
  const { pinnedStartList, pinnedStartScrollbarPlaceholder } = usePinnedStartRendering(pinnedRenderingParams);
@@ -6528,14 +6845,13 @@ function useListRendering(param) {
6528
6845
 
6529
6846
  // src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
6530
6847
  var React33 = __toModule(require("react"));
6531
- var import_react41 = __toModule(require("react"));
6848
+ var import_react43 = __toModule(require("react"));
6532
6849
 
6533
6850
  // src/components/utils/decamelize.ts
6534
- var import_decamelize = __toModule(require_decamelize());
6535
- var decamelize = (input, options) => {
6536
- var _a;
6537
- return (0, import_decamelize.default)(input, { separator: (_a = options == null ? void 0 : options.separator) != null ? _a : "-" });
6538
- };
6851
+ function decamelize(str, options) {
6852
+ const { separator } = options != null ? options : { separator: "-" };
6853
+ return str.replace(/([a-z\d])([A-Z])/g, "$1" + separator + "$2").replace(new RegExp("(" + separator + "[A-Z])([A-Z])", "g"), "$1" + separator + "$2").toLowerCase();
6854
+ }
6539
6855
 
6540
6856
  // src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
6541
6857
  var defaultStyle2 = {
@@ -6578,7 +6894,7 @@ var InfiniteTableLicenseFooter = React33.forwardRef(function InfiniteTableLicens
6578
6894
  ref.current = node;
6579
6895
  }
6580
6896
  }, []);
6581
- (0, import_react41.useEffect)(() => {
6897
+ (0, import_react43.useEffect)(() => {
6582
6898
  const forceStyle = () => {
6583
6899
  requestAnimationFrame(() => {
6584
6900
  var _a;
@@ -6606,7 +6922,7 @@ var InfiniteTableLicenseFooter = React33.forwardRef(function InfiniteTableLicens
6606
6922
  });
6607
6923
 
6608
6924
  // src/components/InfiniteTable/hooks/useLicense/useLicense.ts
6609
- var import_react42 = __toModule(require("react"));
6925
+ var import_react44 = __toModule(require("react"));
6610
6926
 
6611
6927
  // src/components/InfiniteTable/hooks/useLicense/crc32.ts
6612
6928
  var DEFAULT_ReversedPolynomial = 3988292384;
@@ -6755,11 +7071,11 @@ var SANDBOX_REGEX = /(https):\/\/\d+\-\d+\-\d\-(sandpack\.codesandbox\.io)/g;
6755
7071
  var origin = typeof window !== "undefined" ? window.location.origin : "";
6756
7072
  var [_fullUrl, protocol, sandboxUrl] = Array.from(SANDBOX_REGEX.exec(origin) || []);
6757
7073
  var isInsideSandbox = protocol === "https" && sandboxUrl === "sandpack.codesandbox.io";
6758
- var useLicense = (licenseKey) => {
6759
- const valid = (0, import_react42.useMemo)(() => {
7074
+ var useLicense = (licenseKey = "") => {
7075
+ const valid = (0, import_react44.useMemo)(() => {
6760
7076
  let valid2 = isValidLicense(licenseKey, {
6761
7077
  publishedAt: 1624970570587,
6762
- version: "0.0.6"
7078
+ version: "0.0.10"
6763
7079
  });
6764
7080
  if (!licenseKey && !valid2 && isInsideSandbox) {
6765
7081
  return true;
@@ -6771,8 +7087,8 @@ var useLicense = (licenseKey) => {
6771
7087
 
6772
7088
  // src/components/CSSVariableWatch.tsx
6773
7089
  var React34 = __toModule(require("react"));
6774
- var import_react43 = __toModule(require("react"));
6775
- var error2 = err("CSSVariableWatch");
7090
+ var import_react45 = __toModule(require("react"));
7091
+ var error = err("CSSVariableWatch");
6776
7092
  var debug5 = dbg("CSSVariableWatch");
6777
7093
  var WRAPPER_STYLE = {
6778
7094
  position: "absolute",
@@ -6784,7 +7100,7 @@ var WRAPPER_STYLE = {
6784
7100
  overflow: "hidden"
6785
7101
  };
6786
7102
  var useCSSVariableWatch = (params) => {
6787
- const lastValueRef = (0, import_react43.useRef)(0);
7103
+ const lastValueRef = (0, import_react45.useRef)(0);
6788
7104
  const onResize = React34.useCallback(({ height }) => {
6789
7105
  if (height && height !== lastValueRef.current) {
6790
7106
  lastValueRef.current = height;
@@ -6799,12 +7115,12 @@ var useCSSVariableWatch = (params) => {
6799
7115
  debug5(`Variable ${params.varName} found and equals ${value}.`);
6800
7116
  params.onChange(value);
6801
7117
  } else {
6802
- error2(`Specified variable ${params.varName} not found or does not have a numeric value.`);
7118
+ error(`Specified variable ${params.varName} not found or does not have a numeric value.`);
6803
7119
  }
6804
7120
  }, []);
6805
7121
  };
6806
7122
  var CSSVariableWatch = (props) => {
6807
- const domRef = (0, import_react43.useRef)(null);
7123
+ const domRef = (0, import_react45.useRef)(null);
6808
7124
  useCSSVariableWatch(__spreadProps(__spreadValues({}, props), {
6809
7125
  ref: domRef
6810
7126
  }));
@@ -6946,9 +7262,15 @@ var InfiniteTableRoot = getComponentStateRoot({
6946
7262
  });
6947
7263
  var InfiniteTableComponent = React36.memo(function InfiniteTableComponent2() {
6948
7264
  var _a;
6949
- const { componentState, getComputed, computed } = useInfiniteTable();
6950
7265
  const {
6951
- componentState: { dataArray, loading }
7266
+ componentState,
7267
+ getComputed,
7268
+ computed,
7269
+ getState: getInfiniteTableState
7270
+ } = useInfiniteTable();
7271
+ const {
7272
+ componentState: { dataArray, loading },
7273
+ getState: getDataSourceState
6952
7274
  } = useDataSourceContextValue();
6953
7275
  const {
6954
7276
  domRef,
@@ -6985,6 +7307,15 @@ var InfiniteTableComponent = React36.memo(function InfiniteTableComponent2() {
6985
7307
  const licenseValid = useLicense(licenseKey);
6986
7308
  const domProps = useDOMProps(componentState.domProps);
6987
7309
  const LoadMaskCmp = (_a = components == null ? void 0 : components.LoadMask) != null ? _a : LoadMask;
7310
+ React36.useLayoutEffect(() => {
7311
+ const dataSourceState = getDataSourceState();
7312
+ const { onScrollbarsChange } = getInfiniteTableState();
7313
+ const { notifyScrollbarsChange } = dataSourceState;
7314
+ if (onScrollbarsChange && dataSourceState.updatedAt && dataSourceState.dataArray.length) {
7315
+ onScrollbarsChange(scrollbars);
7316
+ }
7317
+ notifyScrollbarsChange(scrollbars);
7318
+ }, [scrollbars]);
6988
7319
  return /* @__PURE__ */ React36.createElement("div", __spreadValues({
6989
7320
  ref: domRef
6990
7321
  }, domProps), header ? /* @__PURE__ */ React36.createElement(TableHeaderWrapper, {
@@ -7016,7 +7347,7 @@ var InfiniteTableComponent = React36.memo(function InfiniteTableComponent2() {
7016
7347
  });
7017
7348
  function InfiniteTableContextProvider() {
7018
7349
  const { componentActions, componentState } = useComponentState();
7019
- const { scrollerDOMRef } = componentState;
7350
+ const { scrollerDOMRef, scrollTopId } = componentState;
7020
7351
  const computed = useComputed();
7021
7352
  const getComputed = useLatest(computed);
7022
7353
  const getState = useLatest(componentState);
@@ -7051,6 +7382,11 @@ function InfiniteTableContextProvider() {
7051
7382
  componentState.onHeaderHeightCSSVarChange.destroy();
7052
7383
  };
7053
7384
  }, []);
7385
+ React36.useEffect(() => {
7386
+ if (scrollerDOMRef.current) {
7387
+ scrollerDOMRef.current.scrollTop = 0;
7388
+ }
7389
+ }, [scrollTopId, scrollerDOMRef]);
7054
7390
  const TableContext2 = getInfiniteTableContext();
7055
7391
  return /* @__PURE__ */ React36.createElement(TableContext2.Provider, {
7056
7392
  value: contextValue