@infinite-table/infinite-react 0.0.5 → 0.0.9

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.esm.js CHANGED
@@ -48,26 +48,6 @@ var __reExport = (target, module, desc) => {
48
48
  var __toModule = (module) => {
49
49
  return __reExport(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, "default", module && module.__esModule && "default" in module ? { get: () => module.default, enumerable: true } : { value: module, enumerable: true })), module);
50
50
  };
51
- var __async = (__this, __arguments, generator) => {
52
- return new Promise((resolve, reject) => {
53
- var fulfilled = (value) => {
54
- try {
55
- step(generator.next(value));
56
- } catch (e) {
57
- reject(e);
58
- }
59
- };
60
- var rejected = (value) => {
61
- try {
62
- step(generator.throw(value));
63
- } catch (e) {
64
- reject(e);
65
- }
66
- };
67
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
68
- step((generator = generator.apply(__this, __arguments)).next());
69
- });
70
- };
71
51
 
72
52
  // node_modules/ms/index.js
73
53
  var require_ms = __commonJS({
@@ -211,6 +191,8 @@ var require_common = __commonJS({
211
191
  function createDebug(namespace) {
212
192
  let prevTime;
213
193
  let enableOverride = null;
194
+ let namespacesCache;
195
+ let enabledCache;
214
196
  function debug6(...args) {
215
197
  if (!debug6.enabled) {
216
198
  return;
@@ -253,7 +235,16 @@ var require_common = __commonJS({
253
235
  Object.defineProperty(debug6, "enabled", {
254
236
  enumerable: true,
255
237
  configurable: false,
256
- get: () => enableOverride === null ? createDebug.enabled(namespace) : enableOverride,
238
+ get: () => {
239
+ if (enableOverride !== null) {
240
+ return enableOverride;
241
+ }
242
+ if (namespacesCache !== createDebug.namespaces) {
243
+ namespacesCache = createDebug.namespaces;
244
+ enabledCache = createDebug.enabled(namespace);
245
+ }
246
+ return enabledCache;
247
+ },
257
248
  set: (v) => {
258
249
  enableOverride = v;
259
250
  }
@@ -270,6 +261,7 @@ var require_common = __commonJS({
270
261
  }
271
262
  function enable(namespaces) {
272
263
  createDebug.save(namespaces);
264
+ createDebug.namespaces = namespaces;
273
265
  createDebug.names = [];
274
266
  createDebug.skips = [];
275
267
  let i;
@@ -465,14 +457,14 @@ var require_browser = __commonJS({
465
457
  } else {
466
458
  exports.storage.removeItem("debug");
467
459
  }
468
- } catch (error3) {
460
+ } catch (error2) {
469
461
  }
470
462
  }
471
463
  function load() {
472
464
  let r;
473
465
  try {
474
466
  r = exports.storage.getItem("debug");
475
- } catch (error3) {
467
+ } catch (error2) {
476
468
  }
477
469
  if (!r && typeof process !== "undefined" && "env" in process) {
478
470
  r = process.env.DEBUG;
@@ -482,7 +474,7 @@ var require_browser = __commonJS({
482
474
  function localstorage() {
483
475
  try {
484
476
  return localStorage;
485
- } catch (error3) {
477
+ } catch (error2) {
486
478
  }
487
479
  }
488
480
  module.exports = require_common()(exports);
@@ -490,13 +482,106 @@ var require_browser = __commonJS({
490
482
  formatters.j = function(v) {
491
483
  try {
492
484
  return JSON.stringify(v);
493
- } catch (error3) {
494
- return "[UnexpectedJSONParseError]: " + error3.message;
485
+ } catch (error2) {
486
+ return "[UnexpectedJSONParseError]: " + error2.message;
495
487
  }
496
488
  };
497
489
  }
498
490
  });
499
491
 
492
+ // node_modules/@vanilla-extract/recipes/createRuntimeFn/dist/vanilla-extract-recipes-createRuntimeFn.cjs.dev.js
493
+ var require_vanilla_extract_recipes_createRuntimeFn_cjs_dev = __commonJS({
494
+ "node_modules/@vanilla-extract/recipes/createRuntimeFn/dist/vanilla-extract-recipes-createRuntimeFn.cjs.dev.js"(exports) {
495
+ "use strict";
496
+ Object.defineProperty(exports, "__esModule", { value: true });
497
+ function _defineProperty(obj, key, value) {
498
+ if (key in obj) {
499
+ Object.defineProperty(obj, key, {
500
+ value,
501
+ enumerable: true,
502
+ configurable: true,
503
+ writable: true
504
+ });
505
+ } else {
506
+ obj[key] = value;
507
+ }
508
+ return obj;
509
+ }
510
+ function ownKeys(object, enumerableOnly) {
511
+ var keys = Object.keys(object);
512
+ if (Object.getOwnPropertySymbols) {
513
+ var symbols = Object.getOwnPropertySymbols(object);
514
+ if (enumerableOnly) {
515
+ symbols = symbols.filter(function(sym) {
516
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
517
+ });
518
+ }
519
+ keys.push.apply(keys, symbols);
520
+ }
521
+ return keys;
522
+ }
523
+ function _objectSpread2(target) {
524
+ for (var i = 1; i < arguments.length; i++) {
525
+ var source = arguments[i] != null ? arguments[i] : {};
526
+ if (i % 2) {
527
+ ownKeys(Object(source), true).forEach(function(key) {
528
+ _defineProperty(target, key, source[key]);
529
+ });
530
+ } else if (Object.getOwnPropertyDescriptors) {
531
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
532
+ } else {
533
+ ownKeys(Object(source)).forEach(function(key) {
534
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
535
+ });
536
+ }
537
+ }
538
+ return target;
539
+ }
540
+ var shouldApplyCompound = (compoundCheck, selections) => {
541
+ for (var key of Object.keys(compoundCheck)) {
542
+ if (compoundCheck[key] !== selections[key]) {
543
+ return false;
544
+ }
545
+ }
546
+ return true;
547
+ };
548
+ var createRuntimeFn = (config) => (options) => {
549
+ var className = config.defaultClassName;
550
+ var selections = _objectSpread2(_objectSpread2({}, config.defaultVariants), options);
551
+ for (var variantName in selections) {
552
+ var _selections$variantNa;
553
+ var variantSelection = (_selections$variantNa = selections[variantName]) !== null && _selections$variantNa !== void 0 ? _selections$variantNa : config.defaultVariants[variantName];
554
+ if (variantSelection != null) {
555
+ var selection = variantSelection;
556
+ if (typeof selection === "boolean") {
557
+ selection = selection === true ? "true" : "false";
558
+ }
559
+ className += " " + config.variantClassNames[variantName][selection];
560
+ }
561
+ }
562
+ for (var [compoundCheck, compoundClassName] of config.compoundVariants) {
563
+ if (shouldApplyCompound(compoundCheck, selections)) {
564
+ className += " " + compoundClassName;
565
+ }
566
+ }
567
+ return className;
568
+ };
569
+ exports.createRuntimeFn = createRuntimeFn;
570
+ }
571
+ });
572
+
573
+ // node_modules/@vanilla-extract/recipes/createRuntimeFn/dist/vanilla-extract-recipes-createRuntimeFn.cjs.js
574
+ var require_vanilla_extract_recipes_createRuntimeFn_cjs = __commonJS({
575
+ "node_modules/@vanilla-extract/recipes/createRuntimeFn/dist/vanilla-extract-recipes-createRuntimeFn.cjs.js"(exports, module) {
576
+ "use strict";
577
+ if (false) {
578
+ module.exports = null;
579
+ } else {
580
+ module.exports = require_vanilla_extract_recipes_createRuntimeFn_cjs_dev();
581
+ }
582
+ }
583
+ });
584
+
500
585
  // node_modules/binary-search/index.js
501
586
  var require_binary_search = __commonJS({
502
587
  "node_modules/binary-search/index.js"(exports, module) {
@@ -558,7 +643,7 @@ var require_decamelize = __commonJS({
558
643
  if (preserveConsecutiveUppercase) {
559
644
  return handlePreserveConsecutiveUppercase(decamelized, separator);
560
645
  }
561
- return decamelized.replace(/(\p{Uppercase_Letter}+)(\p{Uppercase_Letter}\p{Lowercase_Letter}+)/gu, replacement).toLowerCase();
646
+ return decamelized.replace(/(\p{Uppercase_Letter})(\p{Uppercase_Letter}\p{Lowercase_Letter}+)/gu, replacement).toLowerCase();
562
647
  };
563
648
  }
564
649
  });
@@ -568,7 +653,8 @@ import {
568
653
  StrictMode,
569
654
  createElement as createElement33,
570
655
  memo as memo13,
571
- useEffect as useEffect22
656
+ useEffect as useEffect24,
657
+ useLayoutEffect as useLayoutEffect6
572
658
  } from "react";
573
659
 
574
660
  // src/components/InfiniteTable/internalProps.ts
@@ -651,7 +737,7 @@ var ScrollListener = class {
651
737
 
652
738
  // src/components/InfiniteTable/state/computeColumnGroupsDepths.ts
653
739
  function computeColumnGroupsDepths(columnGroups) {
654
- const map = new Map();
740
+ const map2 = new Map();
655
741
  columnGroups.forEach((colGroup, colGroupId) => {
656
742
  let parentGroupId = colGroup.columnGroup;
657
743
  let depth = 0;
@@ -666,12 +752,24 @@ function computeColumnGroupsDepths(columnGroups) {
666
752
  depth++;
667
753
  parentGroupId = parent.columnGroup;
668
754
  }
669
- map.set(colGroupId, depth);
755
+ map2.set(colGroupId, depth);
670
756
  });
671
- return map;
757
+ return map2;
672
758
  }
673
759
 
674
760
  // src/components/InfiniteTable/state/getInitialState.ts
761
+ function toMap(mapOrObject) {
762
+ if (!mapOrObject) {
763
+ return new Map();
764
+ }
765
+ if (mapOrObject instanceof Map) {
766
+ return mapOrObject;
767
+ }
768
+ return new Map(Object.entries(mapOrObject));
769
+ }
770
+ function toColumnTypesMap(mapOrObject) {
771
+ return toMap(mapOrObject);
772
+ }
675
773
  function initSetupState() {
676
774
  const columnsGeneratedForGrouping = new Map();
677
775
  return {
@@ -701,7 +799,11 @@ function initSetupState() {
701
799
  }
702
800
  var forwardProps = () => {
703
801
  return {
704
- columns: 1,
802
+ columns: (columns) => {
803
+ var _a;
804
+ return (_a = toMap(columns)) != null ? _a : new Map();
805
+ },
806
+ scrollTopId: 1,
705
807
  components: 1,
706
808
  loadingText: 1,
707
809
  pivotColumns: 1,
@@ -727,15 +829,17 @@ var forwardProps = () => {
727
829
  pivotColumn: 1,
728
830
  pivotRowLabelsColumn: 1,
729
831
  pivotColumnGroups: 1,
832
+ onScrollbarsChange: 1,
833
+ viewportReservedWidth: (viewportReservedWidth) => viewportReservedWidth != null ? viewportReservedWidth : 0,
730
834
  activeIndex: (activeIndex) => activeIndex != null ? activeIndex : 0,
731
835
  columnMinWidth: (columnMinWidth) => columnMinWidth != null ? columnMinWidth : 30,
732
836
  columnMaxWidth: (columnMaxWidth) => columnMaxWidth != null ? columnMaxWidth : 2e3,
733
- columnDefaultWidth: (columnDefaultWidth) => columnDefaultWidth != null ? columnDefaultWidth : 300,
837
+ columnDefaultWidth: (columnDefaultWidth) => columnDefaultWidth != null ? columnDefaultWidth : 200,
734
838
  draggableColumns: (draggableColumns) => draggableColumns != null ? draggableColumns : true,
735
839
  sortable: (sortable) => sortable != null ? sortable : true,
736
840
  hideEmptyGroupColumns: (hideEmptyGroupColumns) => hideEmptyGroupColumns != null ? hideEmptyGroupColumns : false,
737
841
  pivotTotalColumnPosition: (pivotTotalColumnPosition) => pivotTotalColumnPosition != null ? pivotTotalColumnPosition : "end",
738
- licenseKey: (licenseKey) => licenseKey || globalThis.InfiniteTableLicenseKey || "",
842
+ licenseKey: (licenseKey) => licenseKey || "",
739
843
  columnOrder: (columnOrder) => columnOrder != null ? columnOrder : true,
740
844
  header: (header) => header != null ? header : true,
741
845
  showZebraRows: (showZebraRows) => showZebraRows != null ? showZebraRows : true,
@@ -745,6 +849,14 @@ var forwardProps = () => {
745
849
  headerHeight: (headerHeight) => typeof headerHeight === "number" ? headerHeight : 0,
746
850
  columnVisibility: (columnVisibility) => columnVisibility != null ? columnVisibility : new Map(),
747
851
  columnPinning: (columnPinning) => columnPinning != null ? columnPinning : new Map(),
852
+ columnSizing: (columnSizing) => {
853
+ var _a;
854
+ return (_a = toMap(columnSizing)) != null ? _a : new Map();
855
+ },
856
+ columnTypes: (columnTypes) => {
857
+ var _a;
858
+ return (_a = toColumnTypesMap(columnTypes)) != null ? _a : new Map();
859
+ },
748
860
  columnAggregations: (columnAggregations) => columnAggregations != null ? columnAggregations : new Map(),
749
861
  collapsedColumnGroups: (collapsedColumnGroups) => collapsedColumnGroups != null ? collapsedColumnGroups : new Map(),
750
862
  columnGroups: (columnGroups) => columnGroups != null ? columnGroups : new Map()
@@ -779,7 +891,7 @@ var mapPropsToState = (params) => {
779
891
  return {
780
892
  groupRenderStrategy,
781
893
  groupRowsBy,
782
- computedColumns: state.computedPivotColumns || state.columnsWhenGrouping || state.columnsWhenInlineGroupRenderStrategy || props.columns,
894
+ computedColumns: state.computedPivotColumns || state.columnsWhenGrouping || state.columnsWhenInlineGroupRenderStrategy || state.columns,
783
895
  virtualizeHeader,
784
896
  columnGroupsDepthsMap,
785
897
  columnGroupsMaxDepth: columnGroupsDepthsMap != state.columnGroupsDepthsMap ? Math.max(...columnGroupsDepthsMap.values(), 0) : state.columnGroupsMaxDepth,
@@ -919,7 +1031,7 @@ var computeFlex = (params) => {
919
1031
  items.forEach((item, i) => {
920
1032
  var _a, _b, _c, _d, _e, _f;
921
1033
  let maxSize = (_b = (_a = item.maxSize) != null ? _a : defaultMaxSize) != null ? _b : void 0;
922
- let minSize = (_d = (_c = item.maxSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
1034
+ let minSize = (_d = (_c = item.minSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
923
1035
  if (item.size != null) {
924
1036
  if (maxSize != null && item.size > maxSize) {
925
1037
  item.size = maxSize;
@@ -947,7 +1059,7 @@ var computeFlex = (params) => {
947
1059
  if (item.flex != null) {
948
1060
  const approxFlexSize = sizePerFlex * item.flex;
949
1061
  let maxSize = (_b = (_a = item.maxSize) != null ? _a : defaultMaxSize) != null ? _b : void 0;
950
- let minSize = (_d = (_c = item.maxSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
1062
+ let minSize = (_d = (_c = item.minSize) != null ? _c : defaultMinSize) != null ? _d : void 0;
951
1063
  let constrained = false;
952
1064
  let substractSize = 0;
953
1065
  if (maxSize != null && approxFlexSize > maxSize) {
@@ -1082,8 +1194,52 @@ var Logger = class {
1082
1194
  }
1083
1195
  };
1084
1196
 
1197
+ // src/utils/getGlobal.ts
1198
+ function getGlobal() {
1199
+ return globalThis;
1200
+ }
1201
+
1202
+ // src/components/utils/getScrollbarWidth.ts
1203
+ var scrollbarWidth;
1204
+ function getScrollbarWidth() {
1205
+ var _a, _b;
1206
+ if (scrollbarWidth != null) {
1207
+ return scrollbarWidth;
1208
+ }
1209
+ const doc = (_a = getGlobal().document) != null ? _a : null;
1210
+ if (!doc) {
1211
+ return 0;
1212
+ }
1213
+ const outer = doc.createElement("div");
1214
+ outer.style.visibility = "hidden";
1215
+ outer.style.overflow = "scroll";
1216
+ doc.body.appendChild(outer);
1217
+ const inner = doc.createElement("div");
1218
+ outer.appendChild(inner);
1219
+ scrollbarWidth = outer.offsetWidth - inner.offsetWidth;
1220
+ (_b = outer.parentNode) == null ? void 0 : _b.removeChild(outer);
1221
+ return scrollbarWidth;
1222
+ }
1223
+
1224
+ // src/components/InfiniteTable/utils/getColumnComputedType.ts
1225
+ var emptyType = Object.freeze({});
1226
+ function getColumnComputedType(column, columnTypes) {
1227
+ const defaultType = columnTypes.get("default") || emptyType;
1228
+ if (column.type === void 0) {
1229
+ return defaultType;
1230
+ }
1231
+ if (column.type === null) {
1232
+ return emptyType;
1233
+ }
1234
+ if (typeof column.type === "string") {
1235
+ const type = columnTypes.get(column.type) || emptyType;
1236
+ return type;
1237
+ }
1238
+ return column.type.reduce((acc, columnType) => Object.assign(acc, columnTypes.get(columnType)), {});
1239
+ }
1240
+
1085
1241
  // src/components/InfiniteTable/utils/getComputedVisibleColumns.ts
1086
- var error = err("getComputedVisibleColumns");
1242
+ var logError = err("getComputedVisibleColumns");
1087
1243
  var isColumnVisible = (columnVisibility, _columnVisibilityAssumeVisible, colId) => {
1088
1244
  return !columnVisibility.has(colId) || columnVisibility.get(colId) !== false;
1089
1245
  };
@@ -1104,22 +1260,26 @@ var getComputedVisibleColumns = ({
1104
1260
  sortInfo,
1105
1261
  setSortInfo,
1106
1262
  multiSort,
1263
+ viewportReservedWidth,
1107
1264
  draggableColumns,
1108
1265
  columnOrder,
1109
1266
  columnPinning,
1267
+ columnSizing,
1268
+ columnTypes,
1110
1269
  columnVisibility,
1111
1270
  columnVisibilityAssumeVisible
1112
1271
  }) => {
1113
1272
  let computedOffset = 0;
1114
1273
  const normalizedColumnOrder = adjustColumnOrderForPinning(columnOrder === true ? [...columns.keys()] : columnOrder, columnPinning);
1115
- const visibleColumnOrder = normalizedColumnOrder.filter(isColumnVisible.bind(null, columnVisibility, columnVisibilityAssumeVisible));
1116
- const columnsArray = visibleColumnOrder.map((columnId) => {
1117
- let col = columns.get(columnId);
1274
+ const visibleColumnOrder = normalizedColumnOrder.filter((colId) => {
1275
+ let col = columns.get(colId);
1118
1276
  if (!col) {
1119
- error(`Column with id "${columnId}" specified in columnOrder array cannot be found in the columns map.`);
1277
+ logError(`Column with id "${colId}" specified in columnOrder array cannot be found in the columns map.`);
1278
+ return false;
1120
1279
  }
1121
- return col;
1122
- }).filter(Boolean);
1280
+ return isColumnVisible(columnVisibility, columnVisibilityAssumeVisible, colId);
1281
+ });
1282
+ const columnsArray = visibleColumnOrder.map((columnId) => columns.get(columnId)).filter(Boolean);
1123
1283
  const sortedMap = (sortInfo != null ? sortInfo : []).reduce((acc, info, index) => {
1124
1284
  if (info.id) {
1125
1285
  acc[info.id] = { sortInfo: info, index };
@@ -1133,20 +1293,39 @@ var getComputedVisibleColumns = ({
1133
1293
  return acc;
1134
1294
  }, {});
1135
1295
  const flexResult = computeFlex({
1136
- availableSize: bodySize.width,
1296
+ availableSize: Math.max(bodySize.width - (viewportReservedWidth != null ? viewportReservedWidth : 0) - getScrollbarWidth(), 0),
1137
1297
  maxSize: columnMaxWidth,
1138
1298
  minSize: columnMinWidth,
1139
- items: columnsArray.map((col) => {
1140
- var _a, _b;
1141
- let size = col.flex != null ? void 0 : (_a = col.width) != null ? _a : columnDefaultWidth;
1142
- if (!size && col.flex == null) {
1143
- size = (_b = col.minWidth) != null ? _b : columnMinWidth;
1299
+ items: visibleColumnOrder.map((colId) => {
1300
+ var _a, _b, _c, _d;
1301
+ const column = columns.get(colId);
1302
+ const colType = getColumnComputedType(column, columnTypes);
1303
+ const colTypeSizing = {
1304
+ minWidth: colType == null ? void 0 : colType.minWidth,
1305
+ maxWidth: colType == null ? void 0 : colType.maxWidth,
1306
+ width: colType == null ? void 0 : colType.width,
1307
+ flex: colType == null ? void 0 : colType.flex
1308
+ };
1309
+ let colSizing = columnSizing.get(colId) || {};
1310
+ if (colSizing.width != null) {
1311
+ delete colTypeSizing.flex;
1312
+ }
1313
+ if (colSizing.flex != null) {
1314
+ delete colTypeSizing.width;
1315
+ }
1316
+ colSizing = Object.assign(colTypeSizing, colSizing);
1317
+ let colFlex = (_a = colSizing.flex) != null ? _a : void 0;
1318
+ const colMinWidth = (_b = colSizing.minWidth) != null ? _b : columnMinWidth;
1319
+ const colMaxWidth = (_c = colSizing.maxWidth) != null ? _c : columnMaxWidth;
1320
+ let size = colFlex != void 0 ? void 0 : (_d = colSizing.width) != null ? _d : columnDefaultWidth;
1321
+ if (!size && colFlex == void 0) {
1322
+ size = colMinWidth;
1144
1323
  }
1145
1324
  return {
1146
1325
  size,
1147
- flex: col.flex,
1148
- minSize: col.minWidth,
1149
- maxSize: col.maxWidth
1326
+ flex: colFlex,
1327
+ minSize: colMinWidth,
1328
+ maxSize: colMaxWidth
1150
1329
  };
1151
1330
  })
1152
1331
  });
@@ -1181,6 +1360,7 @@ var getComputedVisibleColumns = ({
1181
1360
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
1182
1361
  const id = visibleColumnOrder[i];
1183
1362
  const nextColumnId = visibleColumnOrder[i + 1];
1363
+ const colType = getColumnComputedType(c, columnTypes);
1184
1364
  const sortingInfo = sortedMap[id] ? sortedMap[id] : c.field ? (_a = sortedMap[c.field]) != null ? _a : null : null;
1185
1365
  const computedSortInfo = (_b = sortingInfo == null ? void 0 : sortingInfo.sortInfo) != null ? _b : null;
1186
1366
  const computedSorted = !!computedSortInfo;
@@ -1236,8 +1416,10 @@ var getComputedVisibleColumns = ({
1236
1416
  const computedFirstInCategory = computedPinned !== prevPinned;
1237
1417
  const computedLastInCategory = computedLast || computedPinned !== getComputedPinned(nextColumnId, columnPinning);
1238
1418
  const result2 = __spreadProps(__spreadValues({
1239
- align: "start",
1240
- verticalAlign: "center"
1419
+ align: colType.align,
1420
+ verticalAlign: colType.verticalAlign,
1421
+ renderValue: colType.renderValue,
1422
+ render: colType.render
1241
1423
  }, c), {
1242
1424
  computedWidth,
1243
1425
  computedAbsoluteOffset,
@@ -1316,28 +1498,28 @@ var useRerender = () => {
1316
1498
 
1317
1499
  // src/components/hooks/useInterceptedMap.ts
1318
1500
  import { useEffect as useEffect2 } from "react";
1319
- function interceptMap(map, fns) {
1320
- const { set, delete: deleteKey, clear } = map;
1501
+ function interceptMap(map2, fns) {
1502
+ const { set, delete: deleteKey, clear } = map2;
1321
1503
  if (fns.set) {
1322
- map.set = (key, value) => {
1323
- set.call(map, key, value);
1504
+ map2.set = (key, value) => {
1505
+ set.call(map2, key, value);
1324
1506
  fns.set(key, value);
1325
- return map;
1507
+ return map2;
1326
1508
  };
1327
1509
  }
1328
1510
  if (fns.delete) {
1329
- map.delete = (key) => {
1330
- const removed = deleteKey.call(map, key);
1511
+ map2.delete = (key) => {
1512
+ const removed = deleteKey.call(map2, key);
1331
1513
  fns.delete(key);
1332
1514
  return removed;
1333
1515
  };
1334
1516
  }
1335
1517
  if (fns.clear || fns.beforeClear) {
1336
- map.clear = () => {
1518
+ map2.clear = () => {
1337
1519
  if (fns.beforeClear) {
1338
- fns.beforeClear(map);
1520
+ fns.beforeClear(map2);
1339
1521
  }
1340
- const result = clear.call(map);
1522
+ const result = clear.call(map2);
1341
1523
  if (fns.clear) {
1342
1524
  fns.clear();
1343
1525
  }
@@ -1346,13 +1528,13 @@ function interceptMap(map, fns) {
1346
1528
  }
1347
1529
  return () => {
1348
1530
  if (set) {
1349
- map.set = set;
1531
+ map2.set = set;
1350
1532
  }
1351
1533
  if (deleteKey) {
1352
- map.delete = deleteKey;
1534
+ map2.delete = deleteKey;
1353
1535
  }
1354
1536
  if (clear) {
1355
- map.clear = clear;
1537
+ map2.clear = clear;
1356
1538
  }
1357
1539
  };
1358
1540
  }
@@ -1372,16 +1554,16 @@ var rafFn = (fn) => {
1372
1554
  };
1373
1555
 
1374
1556
  // src/components/InfiniteTable/hooks/useRerenderOnKeyChange.ts
1375
- var useRerenderOnKeyChange = (map) => {
1557
+ var useRerenderOnKeyChange = (map2) => {
1376
1558
  const [renderId, rerender] = useRerender();
1377
1559
  useEffect3(() => {
1378
1560
  const update = rafFn(rerender);
1379
- return interceptMap(map, {
1561
+ return interceptMap(map2, {
1380
1562
  set: update,
1381
1563
  clear: update,
1382
1564
  delete: update
1383
1565
  });
1384
- }, [map]);
1566
+ }, [map2]);
1385
1567
  return renderId;
1386
1568
  };
1387
1569
 
@@ -1399,11 +1581,16 @@ var useComputedVisibleColumns = ({
1399
1581
  setSortInfo,
1400
1582
  columnOrder,
1401
1583
  columnPinning,
1584
+ columnTypes,
1402
1585
  pinnedEndMaxWidth,
1403
1586
  pinnedStartMaxWidth,
1587
+ viewportReservedWidth,
1404
1588
  columnVisibility,
1405
- columnVisibilityAssumeVisible
1589
+ columnVisibilityAssumeVisible,
1590
+ columnSizing
1406
1591
  }) => {
1592
+ const columnsSizingRenderId = useRerenderOnKeyChange(columnSizing);
1593
+ const columnTypesRenderId = useRerenderOnKeyChange(columnTypes);
1407
1594
  const columnsRenderId = useRerenderOnKeyChange(columns);
1408
1595
  const visibilityRenderId = useRerenderOnKeyChange(columnVisibility);
1409
1596
  const pinningRenderId = useRerenderOnKeyChange(columnPinning);
@@ -1429,6 +1616,7 @@ var useComputedVisibleColumns = ({
1429
1616
  columnMinWidth,
1430
1617
  columnMaxWidth,
1431
1618
  columnDefaultWidth,
1619
+ viewportReservedWidth,
1432
1620
  sortable,
1433
1621
  sortInfo,
1434
1622
  setSortInfo,
@@ -1438,6 +1626,8 @@ var useComputedVisibleColumns = ({
1438
1626
  draggableColumns,
1439
1627
  columnOrder,
1440
1628
  columnPinning,
1629
+ columnSizing,
1630
+ columnTypes,
1441
1631
  columnVisibility,
1442
1632
  columnVisibilityAssumeVisible: columnVisibilityAssumeVisible != null ? columnVisibilityAssumeVisible : true
1443
1633
  });
@@ -1459,7 +1649,9 @@ var useComputedVisibleColumns = ({
1459
1649
  columnPinning,
1460
1650
  columnsRenderId,
1461
1651
  visibilityRenderId,
1462
- pinningRenderId
1652
+ columnsSizingRenderId,
1653
+ pinningRenderId,
1654
+ columnTypesRenderId
1463
1655
  ]);
1464
1656
  const result = {
1465
1657
  columns,
@@ -1485,7 +1677,7 @@ var useComputedVisibleColumns = ({
1485
1677
  var sortAscending = (a, b) => a - b;
1486
1678
 
1487
1679
  // src/components/InfiniteTable/hooks/useComputed.ts
1488
- import { useCallback as useCallback5, useState as useState4 } from "react";
1680
+ import { useCallback as useCallback5, useState as useState5 } from "react";
1489
1681
 
1490
1682
  // src/components/InfiniteTable/hooks/useColumnAggregations.ts
1491
1683
  import { useEffect as useEffect5 } from "react";
@@ -1608,7 +1800,7 @@ function getComponentStateContext() {
1608
1800
  }
1609
1801
  return ComponentContext = createContext3(null);
1610
1802
  }
1611
- function getReducerActions(dispatch, getState, getProps, propsToForward, allowedControlledPropOverrides) {
1803
+ function getReducerGeneratedActions(dispatch, getState, getProps, propsToForward, allowedControlledPropOverrides, interceptedActions) {
1612
1804
  const state = getState();
1613
1805
  return Object.keys(state).reduce((actions, stateKey) => {
1614
1806
  const key = stateKey;
@@ -1620,6 +1812,9 @@ function getReducerActions(dispatch, getState, getProps, propsToForward, allowed
1620
1812
  return;
1621
1813
  }
1622
1814
  notifyChange(props, stateKey, value);
1815
+ if (interceptedActions && typeof interceptedActions[key] === "function") {
1816
+ interceptedActions[key](value, { actions, state: state2 });
1817
+ }
1623
1818
  const forwardFn = propsToForward[key];
1624
1819
  if (typeof forwardFn === "function") {
1625
1820
  value = forwardFn(value);
@@ -1732,7 +1927,7 @@ function getComponentStateRoot(config) {
1732
1927
  const getComponentState = useLatest(state);
1733
1928
  const { allowedControlledPropOverrides } = config;
1734
1929
  const actions = useMemo3(() => {
1735
- const generatedActions = getReducerActions(dispatch, getComponentState, getProps, propsToForward, allowedControlledPropOverrides);
1930
+ const generatedActions = getReducerGeneratedActions(dispatch, getComponentState, getProps, propsToForward, allowedControlledPropOverrides, config.interceptActions);
1736
1931
  return generatedActions;
1737
1932
  }, [
1738
1933
  dispatch,
@@ -1901,7 +2096,7 @@ function useColumnGroups() {
1901
2096
  }
1902
2097
 
1903
2098
  // src/components/InfiniteTable/hooks/useColumnsWhen.ts
1904
- import { useEffect as useEffect8, useMemo as useMemo5 } from "react";
2099
+ import { useEffect as useEffect10, useMemo as useMemo5 } from "react";
1905
2100
 
1906
2101
  // src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
1907
2102
  import {
@@ -1967,43 +2162,10 @@ function ExpanderIcon(props) {
1967
2162
  }));
1968
2163
  }
1969
2164
 
1970
- // node_modules/@vanilla-extract/recipes/createRuntimeFn/dist/vanilla-extract-recipes-createRuntimeFn.esm.js
1971
- var shouldApplyCompound = (compoundCheck, selections) => {
1972
- for (const key of Object.keys(compoundCheck)) {
1973
- if (compoundCheck[key] !== selections[key]) {
1974
- return false;
1975
- }
1976
- }
1977
- return true;
1978
- };
1979
- var createRuntimeFn = (config) => (options) => {
1980
- let className = config.defaultClassName;
1981
- const selections = {
1982
- ...config.defaultVariants,
1983
- ...options
1984
- };
1985
- for (const variantName in selections) {
1986
- var _selections$variantNa;
1987
- const variantSelection = (_selections$variantNa = selections[variantName]) !== null && _selections$variantNa !== void 0 ? _selections$variantNa : config.defaultVariants[variantName];
1988
- if (variantSelection != null) {
1989
- let selection = variantSelection;
1990
- if (typeof selection === "boolean") {
1991
- selection = selection === true ? "true" : "false";
1992
- }
1993
- className += " " + config.variantClassNames[variantName][selection];
1994
- }
1995
- }
1996
- for (const [compoundCheck, compoundClassName] of config.compoundVariants) {
1997
- if (shouldApplyCompound(compoundCheck, selections)) {
1998
- className += " " + compoundClassName;
1999
- }
2000
- }
2001
- return className;
2002
- };
2003
-
2004
2165
  // src/components/InfiniteTable/components/InfiniteTableRow/row.css.ts
2166
+ var import_createRuntimeFn = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
2005
2167
  var GroupRowExpanderCls = "_7pupv0b";
2006
- 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: [] });
2168
+ 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: [] });
2007
2169
  var RowHoverCls = "_7pupv01";
2008
2170
 
2009
2171
  // src/components/InfiniteTable/state/getComputedPivotColumnsFromDataSourcePivotColumns.tsx
@@ -2198,62 +2360,231 @@ import {
2198
2360
  createElement as createElement6
2199
2361
  } from "react";
2200
2362
 
2201
- // src/components/DataSource/privateHooks/useLoadData.ts
2202
- import { useLayoutEffect as useLayoutEffect3 } from "react";
2363
+ // src/utils/multisort/sortTypes.ts
2364
+ var numberComparator = function(first, second) {
2365
+ return first - second;
2366
+ };
2367
+ var stringComparator = function(first, second) {
2368
+ first = `${first}`;
2369
+ second = `${second}`;
2370
+ return first.localeCompare(second);
2371
+ };
2372
+ var sortTypes = {
2373
+ number: numberComparator,
2374
+ string: stringComparator
2375
+ };
2376
+ var sortTypes_default = sortTypes;
2203
2377
 
2204
- // src/components/DataSource/privateHooks/buildDataSourceDataInfo.ts
2205
- function buildDataSourceDataInfo(dataParam) {
2206
- let dataArray = [];
2207
- if (Array.isArray(dataParam.data)) {
2208
- dataArray = dataParam.data;
2209
- } else {
2210
- dataArray = dataParam;
2378
+ // src/utils/multisort/index.ts
2379
+ var multisort = (sortInfo, array, get) => {
2380
+ array.sort(getMultisortFunction(sortInfo, get));
2381
+ return array;
2382
+ };
2383
+ multisort.knownTypes = sortTypes_default;
2384
+ var getSingleSortFunction = (info) => {
2385
+ if (!info) {
2386
+ return;
2211
2387
  }
2212
- return {
2213
- originalDataArray: dataArray
2388
+ const field = info.field;
2389
+ var dir = info.dir < 0 ? -1 : info.dir > 0 ? 1 : 0;
2390
+ if (!dir) {
2391
+ return;
2392
+ }
2393
+ let fn = info.fn;
2394
+ if (!fn && info.type) {
2395
+ fn = multisort.knownTypes[info.type];
2396
+ if (!fn) {
2397
+ console.warn(`Unknown sort type "${info.type}" - please pass one of ${Object.keys(multisort.knownTypes).join(", ")}`);
2398
+ }
2399
+ }
2400
+ if (!fn) {
2401
+ fn = sortTypes_default.string;
2402
+ }
2403
+ return (first, second) => {
2404
+ const a = field ? first[field] : first;
2405
+ const b = field ? second[field] : second;
2406
+ return dir * fn(a, b);
2214
2407
  };
2215
- }
2216
-
2217
- // src/components/DataSource/privateHooks/loadDataAsync.ts
2218
- function loadDataAsync(data) {
2219
- return __async(this, null, function* () {
2220
- if (typeof data === "function") {
2221
- data = data();
2408
+ };
2409
+ var getSortFunctions = (sortInfo) => {
2410
+ return sortInfo.map(getSingleSortFunction).filter((fn) => fn instanceof Function);
2411
+ };
2412
+ var getMultisortFunction = (sortInfo, get) => {
2413
+ const fns = getSortFunctions(sortInfo);
2414
+ return (first, second) => {
2415
+ if (get) {
2416
+ first = get(first);
2417
+ second = get(second);
2222
2418
  }
2223
- return buildDataSourceDataInfo(yield data);
2224
- });
2419
+ let result = 0;
2420
+ let i = 0;
2421
+ let fn;
2422
+ const len = fns.length;
2423
+ for (; i < len; i++) {
2424
+ fn = fns[i];
2425
+ if (!fn) {
2426
+ continue;
2427
+ }
2428
+ result = fn(first, second);
2429
+ if (result !== 0) {
2430
+ return result;
2431
+ }
2432
+ }
2433
+ return result;
2434
+ };
2435
+ };
2436
+
2437
+ // src/components/DataSource/privateHooks/useLoadData.ts
2438
+ import { useEffect as useEffect9, useLayoutEffect as useLayoutEffect3, useRef as useRef6, useState as useState4 } from "react";
2439
+
2440
+ // src/components/hooks/useEffectWithChanges.ts
2441
+ import { useEffect as useEffect8, useRef as useRef5 } from "react";
2442
+ function useEffectWithChanges(fn, deps) {
2443
+ const prevRef = useRef5({});
2444
+ const oldValuesRef = useRef5({});
2445
+ const oldValues = oldValuesRef.current;
2446
+ const changesRef = useRef5({});
2447
+ const changes = changesRef.current;
2448
+ const useEffectDeps = [];
2449
+ for (let k in deps) {
2450
+ if (deps.hasOwnProperty(k)) {
2451
+ if (deps[k] !== prevRef.current[k]) {
2452
+ changes[k] = deps[k];
2453
+ oldValues[k] = prevRef.current[k];
2454
+ }
2455
+ useEffectDeps.push(deps[k]);
2456
+ }
2457
+ }
2458
+ prevRef.current = deps;
2459
+ useEffect8(() => {
2460
+ const changes2 = changesRef.current;
2461
+ const result = fn(changes2, oldValues);
2462
+ changesRef.current = {};
2463
+ oldValuesRef.current = {};
2464
+ return result;
2465
+ }, useEffectDeps);
2225
2466
  }
2226
2467
 
2227
2468
  // src/components/DataSource/privateHooks/useLoadData.ts
2228
- function buildDataSourceInfo(data) {
2229
- return { originalDataArray: data };
2469
+ function buildDataSourceDataParams(componentState) {
2470
+ var _a, _b;
2471
+ const sortInfo = componentState.multiSort ? componentState.sortInfo : (_b = (_a = componentState.sortInfo) == null ? void 0 : _a[0]) != null ? _b : null;
2472
+ const dataSourceParams = {
2473
+ originalDataArray: componentState.originalDataArray,
2474
+ sortInfo,
2475
+ groupRowsBy: componentState.groupRowsBy,
2476
+ pivotBy: componentState.pivotBy
2477
+ };
2478
+ if (componentState.livePagination !== void 0) {
2479
+ dataSourceParams.livePaginationCursor = componentState.livePaginationCursor;
2480
+ }
2481
+ return dataSourceParams;
2482
+ }
2483
+ function notifyDataParamsChanged(componentState, actions) {
2484
+ var _a;
2485
+ if (typeof componentState.data === "function") {
2486
+ loadData(componentState.data, componentState, actions);
2487
+ }
2488
+ const dataParams = buildDataSourceDataParams(componentState);
2489
+ (_a = componentState.onDataParamsChange) == null ? void 0 : _a.call(componentState, dataParams);
2490
+ }
2491
+ function loadData(data, componentState, actions) {
2492
+ const dataParams = buildDataSourceDataParams(componentState);
2493
+ if (typeof data === "function") {
2494
+ data = data(dataParams);
2495
+ }
2496
+ const dataIsPromise = typeof data === "object" && typeof data.then === "function";
2497
+ if (dataIsPromise) {
2498
+ actions.loading = true;
2499
+ }
2500
+ Promise.resolve(data).then((dataParam) => {
2501
+ let dataArray = [];
2502
+ if (Array.isArray(dataParam.data)) {
2503
+ const remoteData = dataParam;
2504
+ dataArray = remoteData.data;
2505
+ if (remoteData.livePaginationCursor !== void 0) {
2506
+ actions.livePaginationCursor = remoteData.livePaginationCursor;
2507
+ }
2508
+ } else {
2509
+ dataArray = dataParam;
2510
+ }
2511
+ actions.originalDataArray = dataArray;
2512
+ if (dataIsPromise) {
2513
+ actions.loading = false;
2514
+ }
2515
+ });
2230
2516
  }
2231
2517
  function useLoadData() {
2232
2518
  const {
2519
+ getComponentState,
2233
2520
  componentActions: actions,
2234
2521
  componentState: { data }
2235
2522
  } = useComponentState();
2236
- const loadData = (data2) => {
2237
- let dataSourceInfo = {
2238
- originalDataArray: []
2239
- };
2240
- if (typeof data2 === "function") {
2241
- data2 = data2();
2242
- }
2243
- if (Array.isArray(data2)) {
2244
- dataSourceInfo = buildDataSourceInfo(data2);
2245
- actions.originalDataArray = dataSourceInfo.originalDataArray;
2246
- } else {
2247
- actions.loading = true;
2248
- loadDataAsync(data2).then((dataSourceInfo2) => {
2249
- actions.originalDataArray = dataSourceInfo2.originalDataArray;
2250
- actions.loading = false;
2251
- });
2252
- }
2253
- };
2254
2523
  useLayoutEffect3(() => {
2255
- loadData(data);
2524
+ loadData(data, getComponentState(), actions);
2256
2525
  }, [data]);
2526
+ useLivePagination();
2527
+ }
2528
+ function useLivePagination() {
2529
+ const {
2530
+ getComponentState,
2531
+ componentActions: actions,
2532
+ componentState
2533
+ } = useComponentState();
2534
+ const {
2535
+ notifyScrollbarsChange,
2536
+ sortInfo,
2537
+ groupRowsBy,
2538
+ pivotBy,
2539
+ livePaginationCursor,
2540
+ scrollBottomId
2541
+ } = componentState;
2542
+ const [scrollbars, setScrollbars] = useState4({
2543
+ vertical: false,
2544
+ horizontal: false
2545
+ });
2546
+ const scrollbarsRef = useRef6(scrollbars);
2547
+ useEffect9(() => {
2548
+ notifyScrollbarsChange.onChange((scrollbars2) => {
2549
+ if (!scrollbars2) {
2550
+ return;
2551
+ }
2552
+ scrollbarsRef.current = scrollbars2;
2553
+ setScrollbars(scrollbars2);
2554
+ });
2555
+ return () => notifyScrollbarsChange.destroy();
2556
+ }, [notifyScrollbarsChange]);
2557
+ const [cursorId, updateCursorId] = useState4(void 0);
2558
+ useEffect9(() => {
2559
+ const frameId = requestAnimationFrame(() => {
2560
+ var _a;
2561
+ if (!((_a = scrollbarsRef.current) == null ? void 0 : _a.vertical)) {
2562
+ updateCursorId(livePaginationCursor);
2563
+ }
2564
+ });
2565
+ return () => cancelAnimationFrame(frameId);
2566
+ }, [livePaginationCursor]);
2567
+ useEffect9(() => {
2568
+ const { livePaginationCursor: livePaginationCursor2, livePagination } = getComponentState();
2569
+ if (!scrollbars.vertical && livePagination) {
2570
+ updateCursorId(livePaginationCursor2);
2571
+ }
2572
+ }, [scrollbars.vertical]);
2573
+ useEffect9(() => {
2574
+ updateCursorId(scrollBottomId);
2575
+ }, [scrollBottomId]);
2576
+ const depsObject = {
2577
+ sortInfo,
2578
+ groupRowsBy,
2579
+ pivotBy,
2580
+ cursorId
2581
+ };
2582
+ useEffectWithChanges(() => {
2583
+ if (cursorId === void 0) {
2584
+ return;
2585
+ }
2586
+ notifyDataParamsChanged(getComponentState(), actions);
2587
+ }, depsObject);
2257
2588
  }
2258
2589
 
2259
2590
  // src/components/DataSource/state/normalizeSortInfo.ts
@@ -2307,9 +2638,9 @@ var DeepMap = class {
2307
2638
  if (!pair) {
2308
2639
  return;
2309
2640
  }
2310
- const { map } = pair;
2641
+ const { map: map2 } = pair;
2311
2642
  const keys = [...parentKeys, key];
2312
- const next = map ? () => this.visitWithNext(keys, fn, map) : void 0;
2643
+ const next = map2 ? () => this.visitWithNext(keys, fn, map2) : void 0;
2313
2644
  if (pair.hasOwnProperty("value")) {
2314
2645
  fn(pair.value, keys, i, next);
2315
2646
  i++;
@@ -2375,14 +2706,14 @@ var DeepMap = class {
2375
2706
  return this.length;
2376
2707
  }
2377
2708
  clear() {
2378
- const clearMap = (map) => {
2379
- map.forEach((value, _key) => {
2380
- const { map: map2 } = value;
2381
- if (map2) {
2382
- clearMap(map2);
2709
+ const clearMap = (map2) => {
2710
+ map2.forEach((value, _key) => {
2711
+ const { map: map3 } = value;
2712
+ if (map3) {
2713
+ clearMap(map3);
2383
2714
  }
2384
2715
  });
2385
- map.clear();
2716
+ map2.clear();
2386
2717
  };
2387
2718
  clearMap(this.map);
2388
2719
  this.length = 0;
@@ -2427,9 +2758,9 @@ var DeepMap = class {
2427
2758
  }
2428
2759
  }
2429
2760
  while (maps.length) {
2430
- let map = maps.pop();
2761
+ let map2 = maps.pop();
2431
2762
  let key = keys.pop();
2432
- if (key && (map == null ? void 0 : map.size) === 0) {
2763
+ if (key && (map2 == null ? void 0 : map2.size) === 0) {
2433
2764
  let parentMap = maps[maps.length - 1];
2434
2765
  let pair = parentMap == null ? void 0 : parentMap.get(key);
2435
2766
  if (pair) {
@@ -2468,12 +2799,12 @@ var DeepMap = class {
2468
2799
  if (!pair) {
2469
2800
  return;
2470
2801
  }
2471
- const { map } = pair;
2802
+ const { map: map2 } = pair;
2472
2803
  const keys = [...parentKeys, key];
2473
2804
  const next = once(() => {
2474
- if (map) {
2475
- map.forEach((_, k) => {
2476
- this.visitKey(k, map, keys, fn);
2805
+ if (map2) {
2806
+ map2.forEach((_, k) => {
2807
+ this.visitKey(k, map2, keys, fn);
2477
2808
  });
2478
2809
  }
2479
2810
  });
@@ -2639,14 +2970,68 @@ var GroupRowsState = class {
2639
2970
  }
2640
2971
  };
2641
2972
 
2973
+ // src/utils/shallowEqualObjects.ts
2974
+ function shallowEqualObjects(objA, objB) {
2975
+ if (objA === objB) {
2976
+ return true;
2977
+ }
2978
+ if (!objA || !objB) {
2979
+ return false;
2980
+ }
2981
+ var aKeys = Object.keys(objA);
2982
+ var bKeys = Object.keys(objB);
2983
+ var len = aKeys.length;
2984
+ if (bKeys.length !== len) {
2985
+ return false;
2986
+ }
2987
+ for (var i = 0; i < len; i++) {
2988
+ var key = aKeys[i];
2989
+ if (objA[key] !== objB[key] || !Object.prototype.hasOwnProperty.call(objB, key)) {
2990
+ return false;
2991
+ }
2992
+ }
2993
+ return true;
2994
+ }
2995
+
2996
+ // src/components/utils/discardCallsWithEqualArg.ts
2997
+ var map = new WeakMap();
2998
+ var getCompareDefault = (a) => a;
2999
+ function discardCallsWithEqualArg(fn, timeframe = 50, getCompareObject2) {
3000
+ map.set(fn, {
3001
+ lastCallTime: 0,
3002
+ lastCallArg: null
3003
+ });
3004
+ const getCompare = getCompareObject2 != null ? getCompareObject2 : getCompareDefault;
3005
+ return (arg) => {
3006
+ const { lastCallTime, lastCallArg } = map.get(fn) || {
3007
+ lastCallTime: 0,
3008
+ lastCallArg: null
3009
+ };
3010
+ const now = Date.now();
3011
+ const diff = now - lastCallTime;
3012
+ const objectsEqual = shallowEqualObjects(getCompare(lastCallArg), getCompare(arg));
3013
+ if (diff < timeframe && objectsEqual) {
3014
+ return;
3015
+ }
3016
+ map.set(fn, {
3017
+ lastCallTime: now,
3018
+ lastCallArg: arg
3019
+ });
3020
+ fn(arg);
3021
+ };
3022
+ }
3023
+
2642
3024
  // src/components/DataSource/state/getInitialState.ts
2643
3025
  function initSetupState2() {
2644
3026
  const now = Date.now();
2645
3027
  const originalDataArray = [];
2646
3028
  const dataArray = [];
2647
3029
  return {
3030
+ dataParams: void 0,
3031
+ notifyScrollbarsChange: buildSubscriptionCallback(),
2648
3032
  pivotTotalColumnPosition: "end",
2649
3033
  originalDataArray,
3034
+ scrollBottomId: Symbol("scrollBottomId"),
2650
3035
  pivotColumns: void 0,
2651
3036
  pivotColumnGroups: void 0,
2652
3037
  dataArray,
@@ -2663,12 +3048,20 @@ function initSetupState2() {
2663
3048
  lastGroupDataArray: void 0
2664
3049
  };
2665
3050
  }
3051
+ function getCompareObject(dataParams) {
3052
+ const obj = __spreadValues({}, dataParams);
3053
+ delete obj.originalDataArray;
3054
+ return obj;
3055
+ }
2666
3056
  var forwardProps3 = () => {
2667
3057
  return {
3058
+ onDataParamsChange: (fn) => fn ? discardCallsWithEqualArg(fn, 100, getCompareObject) : void 0,
2668
3059
  remoteCount: 1,
2669
3060
  data: 1,
2670
3061
  pivotBy: 1,
2671
3062
  primaryKey: 1,
3063
+ livePagination: 1,
3064
+ livePaginationCursor: 1,
2672
3065
  loading: (loading) => loading != null ? loading : false,
2673
3066
  sortInfo: (sortInfo) => normalizeSortInfo(sortInfo),
2674
3067
  groupRowsBy: (groupRowsBy) => groupRowsBy != null ? groupRowsBy : [],
@@ -2681,10 +3074,20 @@ var forwardProps3 = () => {
2681
3074
  };
2682
3075
  };
2683
3076
  function mapPropsToState2(params) {
2684
- var _a;
2685
3077
  const { props } = params;
3078
+ const controlledSort = isControlledValue(props.sortInfo);
2686
3079
  return {
2687
- multiSort: Array.isArray((_a = props.sortInfo) != null ? _a : props.defaultSortInfo)
3080
+ controlledSort,
3081
+ multiSort: Array.isArray(controlledSort ? props.sortInfo : props.defaultSortInfo)
3082
+ };
3083
+ }
3084
+ function getInterceptActions() {
3085
+ return {
3086
+ sortInfo: (sortInfo, { actions, state }) => {
3087
+ const dataParams = buildDataSourceDataParams(state);
3088
+ dataParams.sortInfo = sortInfo;
3089
+ actions.dataParams = dataParams;
3090
+ }
2688
3091
  };
2689
3092
  }
2690
3093
 
@@ -2871,124 +3274,52 @@ function enhancedFlatten(param) {
2871
3274
  indexInParentGroups: Array.from(indexInParentGroups),
2872
3275
  indexInAll: result.length,
2873
3276
  groupKeys,
2874
- collapsed
2875
- }, deepMapValue);
2876
- const include = generateGroupRows || collapsed;
2877
- if (include) {
2878
- result.push(enhancedGroupData);
2879
- }
2880
- if (collapsed) {
2881
- parents.forEach((parent) => {
2882
- parent.collapsedChildrenCount += enhancedGroupData.groupCount;
2883
- parent.collapsedGroupsCount += 1;
2884
- });
2885
- }
2886
- indexInParentGroups.push(indexInGroup);
2887
- parents.push(enhancedGroupData);
2888
- if (!collapsed) {
2889
- if (!next) {
2890
- if (!pivot) {
2891
- const startIndex = result.length;
2892
- result.push(...items.map((item, index) => {
2893
- return {
2894
- id: toPrimaryKey(item),
2895
- data: item,
2896
- isGroupRow: false,
2897
- collapsed: false,
2898
- groupKeys,
2899
- parents: Array.from(parents),
2900
- indexInParentGroups: [...indexInParentGroups, index],
2901
- indexInGroup: index,
2902
- indexInAll: startIndex + index,
2903
- groupBy: groupByStrings,
2904
- groupNesting,
2905
- groupCount: enhancedGroupData.groupCount
2906
- };
2907
- }));
2908
- }
2909
- } else {
2910
- next();
2911
- }
2912
- }
2913
- parents.pop();
2914
- indexInParentGroups.pop();
2915
- });
2916
- return {
2917
- data: result
2918
- };
2919
- }
2920
-
2921
- // src/utils/multisort/sortTypes.ts
2922
- var sortTypes = {
2923
- number: function(first, second) {
2924
- return first - second;
2925
- },
2926
- string: function(first, second) {
2927
- first = `${first}`;
2928
- second = `${second}`;
2929
- return first.localeCompare(second);
2930
- }
2931
- };
2932
- var sortTypes_default = sortTypes;
2933
-
2934
- // src/utils/multisort/index.ts
2935
- var multisort = (sortInfo, array, get) => {
2936
- array.sort(getMultisortFunction(sortInfo, get));
2937
- return array;
2938
- };
2939
- multisort.knownTypes = sortTypes_default;
2940
- var getSingleSortFunction = (info) => {
2941
- if (!info) {
2942
- return;
2943
- }
2944
- const field = info.field;
2945
- var dir = info.dir < 0 ? -1 : info.dir > 0 ? 1 : 0;
2946
- if (!dir) {
2947
- return;
2948
- }
2949
- let fn = info.fn;
2950
- if (!fn && info.type) {
2951
- fn = multisort.knownTypes[info.type];
2952
- if (!fn) {
2953
- console.warn(`Unknown sort type "${info.type}" - please pass one of ${Object.keys(multisort.knownTypes).join(", ")}`);
2954
- }
2955
- }
2956
- if (!fn) {
2957
- fn = sortTypes_default.string;
2958
- }
2959
- return (first, second) => {
2960
- const a = field ? first[field] : first;
2961
- const b = field ? second[field] : second;
2962
- return dir * fn(a, b);
2963
- };
2964
- };
2965
- var getSortFunctions = (sortInfo) => {
2966
- return sortInfo.map(getSingleSortFunction).filter((fn) => fn instanceof Function);
2967
- };
2968
- var getMultisortFunction = (sortInfo, get) => {
2969
- const fns = getSortFunctions(sortInfo);
2970
- return (first, second) => {
2971
- if (get) {
2972
- first = get(first);
2973
- second = get(second);
3277
+ collapsed
3278
+ }, deepMapValue);
3279
+ const include = generateGroupRows || collapsed;
3280
+ if (include) {
3281
+ result.push(enhancedGroupData);
2974
3282
  }
2975
- let result = 0;
2976
- let i = 0;
2977
- let fn;
2978
- const len = fns.length;
2979
- for (; i < len; i++) {
2980
- fn = fns[i];
2981
- if (!fn) {
2982
- continue;
2983
- }
2984
- result = fn(first, second);
2985
- if (result !== 0) {
2986
- return result;
3283
+ if (collapsed) {
3284
+ parents.forEach((parent) => {
3285
+ parent.collapsedChildrenCount += enhancedGroupData.groupCount;
3286
+ parent.collapsedGroupsCount += 1;
3287
+ });
3288
+ }
3289
+ indexInParentGroups.push(indexInGroup);
3290
+ parents.push(enhancedGroupData);
3291
+ if (!collapsed) {
3292
+ if (!next) {
3293
+ if (!pivot) {
3294
+ const startIndex = result.length;
3295
+ result.push(...items.map((item, index) => {
3296
+ return {
3297
+ id: toPrimaryKey(item),
3298
+ data: item,
3299
+ isGroupRow: false,
3300
+ collapsed: false,
3301
+ groupKeys,
3302
+ parents: Array.from(parents),
3303
+ indexInParentGroups: [...indexInParentGroups, index],
3304
+ indexInGroup: index,
3305
+ indexInAll: startIndex + index,
3306
+ groupBy: groupByStrings,
3307
+ groupNesting,
3308
+ groupCount: enhancedGroupData.groupCount
3309
+ };
3310
+ }));
3311
+ }
3312
+ } else {
3313
+ next();
2987
3314
  }
2988
3315
  }
2989
- return result;
3316
+ parents.pop();
3317
+ indexInParentGroups.pop();
3318
+ });
3319
+ return {
3320
+ data: result
2990
3321
  };
2991
- };
3322
+ }
2992
3323
 
2993
3324
  // src/utils/groupAndPivot/getPivotColumnsAndColumnGroups.ts
2994
3325
  function getPivotColumnsAndColumnGroups(deepMap, pivotBy, pivotTotalColumnPosition) {
@@ -3114,7 +3445,7 @@ function concludeReducer(params) {
3114
3445
  var _a;
3115
3446
  const { state, previousState } = params;
3116
3447
  const sortInfo = state.sortInfo;
3117
- const shouldSort = !!(sortInfo == null ? void 0 : sortInfo.length);
3448
+ const shouldSort = !!(sortInfo == null ? void 0 : sortInfo.length) && !state.controlledSort;
3118
3449
  const sortDepsChanged = haveDepsChanged(previousState, state, [
3119
3450
  "originalDataArray",
3120
3451
  "sortInfo"
@@ -3184,7 +3515,9 @@ function concludeReducer(params) {
3184
3515
  }
3185
3516
  state.dataArray = rowInfoDataArray;
3186
3517
  state.reducedAt = now;
3187
- globalThis.state = state;
3518
+ if (true) {
3519
+ globalThis.state = state;
3520
+ }
3188
3521
  return state;
3189
3522
  }
3190
3523
 
@@ -3207,7 +3540,8 @@ var DataSourceRoot = getComponentStateRoot({
3207
3540
  initSetupState: initSetupState2,
3208
3541
  forwardProps: forwardProps3,
3209
3542
  concludeReducer,
3210
- mapPropsToState: mapPropsToState2
3543
+ mapPropsToState: mapPropsToState2,
3544
+ interceptActions: getInterceptActions()
3211
3545
  });
3212
3546
  function DataSourceCmp({ children }) {
3213
3547
  const DataSourceContext = getDataSourceContext();
@@ -3267,10 +3601,10 @@ function useColumnsWhen() {
3267
3601
  componentState: { groupRenderStrategy, pivotTotalColumnPosition }
3268
3602
  } = useComponentState();
3269
3603
  const groupRowsMap = useGroupRowsMap(groupRowsBy);
3270
- useEffect8(() => {
3604
+ useEffect10(() => {
3271
3605
  dataSourceActions.generateGroupRows = groupRenderStrategy !== "inline";
3272
3606
  }, [groupRenderStrategy]);
3273
- useEffect8(() => {
3607
+ useEffect10(() => {
3274
3608
  dataSourceActions.pivotTotalColumnPosition = pivotTotalColumnPosition;
3275
3609
  }, [pivotTotalColumnPosition]);
3276
3610
  useColumnsWhenInlineGroupRenderStrategy(groupRowsMap);
@@ -3333,7 +3667,7 @@ function useColumnsWhenInlineGroupRenderStrategy(groupRowsMap) {
3333
3667
  });
3334
3668
  return computedColumns.size === 0 ? void 0 : computedColumns;
3335
3669
  }
3336
- useEffect8(() => {
3670
+ useEffect10(() => {
3337
3671
  const update = () => {
3338
3672
  componentActions.columnsWhenInlineGroupRenderStrategy = computeColumnsWhenInlineGroupRenderStrategy(columns, groupRowsMap, groupRenderStrategy, toggleGroupRow);
3339
3673
  };
@@ -3359,7 +3693,7 @@ function useColumnsWhenPivoting() {
3359
3693
  }
3360
3694
  } = useComponentState();
3361
3695
  const toggleGroupRow = useToggleGroupRow();
3362
- useEffect8(() => {
3696
+ useEffect10(() => {
3363
3697
  const computedPivotColumns = getComputedPivotColumnsFromDataSourcePivotColumns(pivotColumns, {
3364
3698
  pivotColumn,
3365
3699
  pivotRowLabelsColumn,
@@ -3380,7 +3714,7 @@ function useColumnsWhenGrouping() {
3380
3714
  componentState: { columns, groupColumn, groupRenderStrategy, pivotColumns }
3381
3715
  } = useComponentState();
3382
3716
  const toggleGroupRow = useToggleGroupRow();
3383
- useEffect8(() => {
3717
+ useEffect10(() => {
3384
3718
  if (pivotColumns) {
3385
3719
  return;
3386
3720
  }
@@ -3417,7 +3751,7 @@ function useHideEmptyGroupColumns(groupRowsMap) {
3417
3751
  groupRenderStrategy
3418
3752
  }
3419
3753
  } = useComponentState();
3420
- useEffect8(() => {
3754
+ useEffect10(() => {
3421
3755
  if (groupRenderStrategy === "single-column") {
3422
3756
  return;
3423
3757
  }
@@ -3482,25 +3816,27 @@ function getColumnsWhenGrouping(params) {
3482
3816
  const computedColumns = new Map();
3483
3817
  if (groupRenderStrategy === "multi-column") {
3484
3818
  groupRowsBy.forEach((groupByForColumn, groupIndexForColumn, arr) => {
3485
- computedColumns.set(`group-by-${groupByForColumn.field}`, getColumnForGroupBy({
3819
+ const generatedGroupColumn = getColumnForGroupBy({
3486
3820
  groupByForColumn,
3487
3821
  groupRowsBy,
3488
3822
  groupIndexForColumn,
3489
3823
  groupCount: arr.length,
3490
3824
  groupRenderStrategy
3491
- }, toggleGroupRow, groupColumn));
3825
+ }, toggleGroupRow, groupColumn);
3826
+ computedColumns.set(generatedGroupColumn.id || `group-by-${groupByForColumn.field}`, generatedGroupColumn);
3492
3827
  });
3493
3828
  } else if (groupRenderStrategy === "single-column") {
3494
- computedColumns.set("group-by", getSingleGroupColumn({
3829
+ const singleGroupColumn = getSingleGroupColumn({
3495
3830
  groupCount: groupRowsBy.length,
3496
3831
  groupRowsBy,
3497
3832
  groupRenderStrategy
3498
- }, toggleGroupRow, groupColumn));
3833
+ }, toggleGroupRow, groupColumn);
3834
+ computedColumns.set(singleGroupColumn.id || "group-by", singleGroupColumn);
3499
3835
  }
3500
3836
  columns.forEach((col, colId) => {
3501
3837
  computedColumns.set(colId, col);
3502
3838
  });
3503
- return computedColumns;
3839
+ return computedColumns.size ? computedColumns : void 0;
3504
3840
  }
3505
3841
 
3506
3842
  // src/components/InfiniteTable/hooks/useComputed.ts
@@ -3511,8 +3847,15 @@ function useComputed() {
3511
3847
  componentActions: dataSourceActions,
3512
3848
  componentState: dataSourceState
3513
3849
  } = useDataSourceContextValue();
3514
- const { columnOrder, columnVisibility, columnPinning, bodySize } = componentState;
3515
- useState4(() => {
3850
+ const {
3851
+ columnOrder,
3852
+ columnVisibility,
3853
+ columnPinning,
3854
+ columnSizing,
3855
+ columnTypes,
3856
+ bodySize
3857
+ } = componentState;
3858
+ useState5(() => {
3516
3859
  componentState.onRowHeightCSSVarChange.onChange((rowHeight) => {
3517
3860
  if (rowHeight) {
3518
3861
  componentActions.rowHeight = rowHeight;
@@ -3530,7 +3873,8 @@ function useComputed() {
3530
3873
  useColumnsWhen();
3531
3874
  const setSortInfo = useCallback5((sortInfo) => {
3532
3875
  var _a2;
3533
- dataSourceActions.sortInfo = multiSort ? sortInfo : (_a2 = sortInfo[0]) != null ? _a2 : null;
3876
+ const newSortInfo = multiSort ? sortInfo : (_a2 = sortInfo[0]) != null ? _a2 : null;
3877
+ dataSourceActions.sortInfo = newSortInfo;
3534
3878
  }, []);
3535
3879
  const columns = componentState.computedColumns;
3536
3880
  const {
@@ -3556,6 +3900,7 @@ function useComputed() {
3556
3900
  pinnedStartMaxWidth: componentState.pinnedStartMaxWidth,
3557
3901
  pinnedEndMaxWidth: componentState.pinnedEndMaxWidth,
3558
3902
  bodySize,
3903
+ viewportReservedWidth: componentState.viewportReservedWidth,
3559
3904
  sortable: componentState.sortable,
3560
3905
  draggableColumns: componentState.draggableColumns,
3561
3906
  sortInfo: (_a = dataSourceState.sortInfo) != null ? _a : void 0,
@@ -3564,7 +3909,9 @@ function useComputed() {
3564
3909
  columnOrder,
3565
3910
  columnVisibility,
3566
3911
  columnVisibilityAssumeVisible: true,
3567
- columnPinning
3912
+ columnPinning,
3913
+ columnSizing,
3914
+ columnTypes
3568
3915
  });
3569
3916
  const unpinnedColumnWidths = computedUnpinnedColumns.map((c) => c.computedWidth);
3570
3917
  let sortedUnpinnedColumnWidths = [...unpinnedColumnWidths].sort(sortAscending);
@@ -3640,33 +3987,6 @@ import {
3640
3987
  createElement as createElement19
3641
3988
  } from "react";
3642
3989
 
3643
- // src/utils/getGlobal.ts
3644
- function getGlobal() {
3645
- return globalThis;
3646
- }
3647
-
3648
- // src/components/utils/getScrollbarWidth.ts
3649
- var scrollbarWidth;
3650
- function getScrollbarWidth() {
3651
- var _a, _b;
3652
- if (scrollbarWidth != null) {
3653
- return scrollbarWidth;
3654
- }
3655
- const doc = (_a = getGlobal().document) != null ? _a : null;
3656
- if (!doc) {
3657
- return 0;
3658
- }
3659
- const outer = doc.createElement("div");
3660
- outer.style.visibility = "hidden";
3661
- outer.style.overflow = "scroll";
3662
- doc.body.appendChild(outer);
3663
- const inner = doc.createElement("div");
3664
- outer.appendChild(inner);
3665
- scrollbarWidth = outer.offsetWidth - inner.offsetWidth;
3666
- (_b = outer.parentNode) == null ? void 0 : _b.removeChild(outer);
3667
- return scrollbarWidth;
3668
- }
3669
-
3670
3990
  // src/components/InfiniteTable/components/ScrollbarPlaceholder.tsx
3671
3991
  import {
3672
3992
  createElement as createElement8,
@@ -3706,10 +4026,11 @@ function VerticalScrollbarPlaceholderFn(props) {
3706
4026
  var VerticalScrollbarPlaceholder = memo2(VerticalScrollbarPlaceholderFn);
3707
4027
 
3708
4028
  // src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts
4029
+ var import_createRuntimeFn2 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
3709
4030
  var CellCls = "_1eexc2a5 _16lm1iwj _16lm1iw10 _16lm1iw11 _16lm1iw2 _16lm1iw19 _16lm1iw1a";
3710
4031
  var HeaderCellProxy = "_12zfob10";
3711
- 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"]] });
3712
- 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"]] });
4032
+ 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"]] });
4033
+ 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"]] });
3713
4034
  var HeaderGroupCls = "_16lm1iwz _16lm1iwj";
3714
4035
  var HeaderGroup_Children = "_16lm1iwj _16lm1iw10 _16lm1iw12 _16lm1iwc";
3715
4036
  var HeaderGroup_Header = "_12zfob1x _16lm1iwj _16lm1iw10 _16lm1iw11";
@@ -3721,14 +4042,14 @@ import {
3721
4042
  createElement as createElement15,
3722
4043
  memo as memo6
3723
4044
  } from "react";
3724
- import { useCallback as useCallback8, useEffect as useEffect12, useRef as useRef7 } from "react";
4045
+ import { useCallback as useCallback8, useEffect as useEffect14, useRef as useRef9 } from "react";
3725
4046
 
3726
4047
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
3727
4048
  import {
3728
4049
  Fragment as Fragment2,
3729
4050
  createElement as createElement11
3730
4051
  } from "react";
3731
- import { useCallback as useCallback7, useEffect as useEffect10, useRef as useRef6 } from "react";
4052
+ import { useCallback as useCallback7, useEffect as useEffect12, useRef as useRef8 } from "react";
3732
4053
 
3733
4054
  // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
3734
4055
  import {
@@ -3745,9 +4066,10 @@ var useInfiniteTableState = () => {
3745
4066
  };
3746
4067
 
3747
4068
  // src/components/InfiniteTable/components/cell.css.ts
4069
+ var import_createRuntimeFn3 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
3748
4070
  var CellCls2 = "_1eexc2a5 _16lm1iwj _16lm1iw10 _16lm1iw11 _16lm1iw2 _16lm1iw19 _16lm1iw1a";
3749
4071
  var CellClsVariants = { shifting: "_1eexc2a3", dragging: "_1eexc2a4" };
3750
- 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"]] });
4072
+ 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"]] });
3751
4073
  var columnAlignCellStyle = { center: "_1eexc2a0", start: "_1eexc2a1", end: "_1eexc2a2" };
3752
4074
 
3753
4075
  // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
@@ -3808,8 +4130,8 @@ var import_binary_search = __toModule(require_binary_search());
3808
4130
  import {
3809
4131
  useCallback as useCallback6,
3810
4132
  useMemo as useMemo6,
3811
- useRef as useRef5,
3812
- useState as useState5
4133
+ useRef as useRef7,
4134
+ useState as useState6
3813
4135
  } from "react";
3814
4136
 
3815
4137
  // src/components/InfiniteTable/utils/moveXatY.ts
@@ -3844,13 +4166,13 @@ var useColumnPointerEvents = ({
3844
4166
  columns,
3845
4167
  computedRemainingSpace
3846
4168
  }) => {
3847
- const [draggingDiff, setDraggingDiff] = useState5(null);
3848
- const [proxyOffset, setProxyOffset] = useState5(null);
3849
- const breakpointsRef = useRef5([]);
3850
- const pointerMoveRef = useRef5(null);
3851
- const didDragRef = useRef5(false);
3852
- const initialClientPos = useRef5(null);
3853
- const currentDropIndexRef = useRef5(null);
4169
+ const [draggingDiff, setDraggingDiff] = useState6(null);
4170
+ const [proxyOffset, setProxyOffset] = useState6(null);
4171
+ const breakpointsRef = useRef7([]);
4172
+ const pointerMoveRef = useRef7(null);
4173
+ const didDragRef = useRef7(false);
4174
+ const initialClientPos = useRef7(null);
4175
+ const currentDropIndexRef = useRef7(null);
3854
4176
  const dragging = draggingDiff != null;
3855
4177
  const { componentActions, computed } = useInfiniteTable();
3856
4178
  const { computedColumnOrder } = computed;
@@ -3863,7 +4185,7 @@ var useColumnPointerEvents = ({
3863
4185
  columnWidth: column.computedWidth
3864
4186
  };
3865
4187
  }, [columns, columnId, column]);
3866
- let cursorRef = useRef5("auto");
4188
+ let cursorRef = useRef7("auto");
3867
4189
  const onPointerDown = useCallback6((e) => {
3868
4190
  const target = domRef.current;
3869
4191
  cursorRef.current = target.style.cursor;
@@ -4004,7 +4326,7 @@ import { createPortal } from "react-dom";
4004
4326
  import {
4005
4327
  createElement as createElement10
4006
4328
  } from "react";
4007
- import { useEffect as useEffect9, useState as useState6 } from "react";
4329
+ import { useEffect as useEffect11, useState as useState7 } from "react";
4008
4330
  var defaultLineStyle = {
4009
4331
  marginTop: 2,
4010
4332
  marginBottom: 2,
@@ -4012,8 +4334,8 @@ var defaultLineStyle = {
4012
4334
  };
4013
4335
  function SortIcon(props) {
4014
4336
  var _a;
4015
- const [rendered, setRendered] = useState6(true);
4016
- const [opacity, setOpacity] = useState6(0);
4337
+ const [rendered, setRendered] = useState7(true);
4338
+ const [opacity, setOpacity] = useState7(0);
4017
4339
  const { direction, lineWidth = 1, style, className, index } = props;
4018
4340
  const showIndex = index != null && index > 0;
4019
4341
  const size = (_a = props.size) != null ? _a : 16;
@@ -4027,7 +4349,7 @@ function SortIcon(props) {
4027
4349
  }), props.lineStyle), {
4028
4350
  opacity
4029
4351
  });
4030
- useEffect9(() => {
4352
+ useEffect11(() => {
4031
4353
  const newOpacity = direction != 0 ? 1 : 0;
4032
4354
  if (!rendered && newOpacity) {
4033
4355
  setRendered(true);
@@ -4104,7 +4426,7 @@ function InfiniteTableHeaderCell(props) {
4104
4426
  className: `${baseCls}__sort-icon ${HeaderSortIconCls}`,
4105
4427
  direction: column.computedSorted ? column.computedSortedAsc ? 1 : -1 : 0
4106
4428
  });
4107
- const domRef = useRef6(null);
4429
+ const domRef = useRef8(null);
4108
4430
  const ref = useCallback7((node) => {
4109
4431
  var _a2;
4110
4432
  domRef.current = node;
@@ -4114,7 +4436,7 @@ function InfiniteTableHeaderCell(props) {
4114
4436
  computed: { computedRemainingSpace },
4115
4437
  componentState: { portalDOMRef }
4116
4438
  } = useInfiniteTable();
4117
- useEffect10(() => {
4439
+ useEffect12(() => {
4118
4440
  let clearOnResize = null;
4119
4441
  const node = domRef.current;
4120
4442
  if (onResize && node) {
@@ -4170,7 +4492,29 @@ import {
4170
4492
  createElement as createElement14,
4171
4493
  memo as memo5
4172
4494
  } from "react";
4173
- import { useMemo as useMemo7, useEffect as useEffect11 } from "react";
4495
+ import { useEffect as useEffect13 } from "react";
4496
+
4497
+ // src/components/RawList/AvoidReactDiff.tsx
4498
+ import {
4499
+ Fragment as Fragment3,
4500
+ createElement as createElement12,
4501
+ memo as memo4
4502
+ } from "react";
4503
+ import { useLayoutEffect as useLayoutEffect4, useState as useState8 } from "react";
4504
+ function AvoidReactDiffFn(props) {
4505
+ const [children, setChildren] = useState8(props.updater.get());
4506
+ useLayoutEffect4(() => {
4507
+ const remove = props.updater.onChange((children2) => {
4508
+ setChildren(children2);
4509
+ });
4510
+ return remove;
4511
+ }, [props.updater]);
4512
+ return /* @__PURE__ */ createElement12(Fragment3, null, children);
4513
+ }
4514
+ var AvoidReactDiff = memo4(AvoidReactDiffFn);
4515
+
4516
+ // src/components/RawList/useVirtualRenderer.ts
4517
+ import { useMemo as useMemo7 } from "react";
4174
4518
 
4175
4519
  // src/components/RawList/ReactVirtualRenderer.tsx
4176
4520
  import {
@@ -4191,10 +4535,10 @@ var MappedItems = class extends Logger {
4191
4535
  return result;
4192
4536
  };
4193
4537
  this.getElementsOutsideItemRange = (startIndex, endIndex) => {
4194
- const map = this.elementIndexToItemIndex;
4538
+ const map2 = this.elementIndexToItemIndex;
4195
4539
  const result = [];
4196
- for (const elementIndex in map) {
4197
- const itemIndex = map[elementIndex];
4540
+ for (const elementIndex in map2) {
4541
+ const itemIndex = map2[elementIndex];
4198
4542
  if (itemIndex < startIndex || itemIndex > endIndex) {
4199
4543
  result.push(elementIndex >> 0);
4200
4544
  }
@@ -4270,6 +4614,9 @@ var MappedItems = class extends Logger {
4270
4614
  this.itemIndexToElementIndex = {};
4271
4615
  this.renderedElements = {};
4272
4616
  }
4617
+ reset() {
4618
+ this.init();
4619
+ }
4273
4620
  destroy() {
4274
4621
  this.init();
4275
4622
  }
@@ -4289,25 +4636,6 @@ var MappedItems = class extends Logger {
4289
4636
  }
4290
4637
  };
4291
4638
 
4292
- // src/components/RawList/AvoidReactDiff.tsx
4293
- import {
4294
- Fragment as Fragment3,
4295
- createElement as createElement12,
4296
- memo as memo4
4297
- } from "react";
4298
- import { useLayoutEffect as useLayoutEffect4, useState as useState7 } from "react";
4299
- function AvoidReactDiffFn(props) {
4300
- const [children, setChildren] = useState7(props.updater.get());
4301
- useLayoutEffect4(() => {
4302
- const remove = props.updater.onChange((children2) => {
4303
- setChildren(children2);
4304
- });
4305
- return remove;
4306
- }, [props.updater]);
4307
- return /* @__PURE__ */ createElement12(Fragment3, null, children);
4308
- }
4309
- var AvoidReactDiff = memo4(AvoidReactDiffFn);
4310
-
4311
4639
  // src/components/RawList/ReactVirtualRenderer.tsx
4312
4640
  var ITEM_POSITION_WITH_TRANSFORM = true;
4313
4641
  var ReactVirtualRenderer = class extends Logger {
@@ -4414,17 +4742,12 @@ var ReactVirtualRenderer = class extends Logger {
4414
4742
  }
4415
4743
  };
4416
4744
  this.destroy = () => {
4417
- if (true) {
4418
- return;
4419
- }
4420
4745
  this.destroyed = true;
4421
- this.mappedItems.destroy();
4422
- this.itemDOMElements = [];
4423
- this.itemDOMRefs = [];
4424
- this.updaters = [];
4746
+ this.reset();
4425
4747
  this.onRender = null;
4426
4748
  this.renderItem = null;
4427
4749
  this.brain = null;
4750
+ this.mappedItems = null;
4428
4751
  };
4429
4752
  if (onRender) {
4430
4753
  this.onRender = onRender;
@@ -4482,28 +4805,53 @@ var ReactVirtualRenderer = class extends Logger {
4482
4805
  itemUpdater(renderedNode);
4483
4806
  this.updateElementPosition(elementIndex);
4484
4807
  }
4808
+ reset() {
4809
+ this.itemDOMElements = {};
4810
+ this.itemDOMRefs = {};
4811
+ this.updaters = {};
4812
+ this.items = [];
4813
+ this.mappedItems.reset();
4814
+ }
4485
4815
  };
4486
4816
 
4817
+ // src/components/RawList/useVirtualRenderer.ts
4818
+ function createRenderer(brain) {
4819
+ const renderer = new ReactVirtualRenderer(brain, {});
4820
+ const onRenderUpdater = buildSubscriptionCallback();
4821
+ brain.onDestroy(() => {
4822
+ renderer.destroy();
4823
+ onRenderUpdater.destroy();
4824
+ });
4825
+ return {
4826
+ renderer,
4827
+ onRenderUpdater
4828
+ };
4829
+ }
4830
+ function useVirtualRenderer({
4831
+ brain
4832
+ }) {
4833
+ return useMemo7(() => {
4834
+ return createRenderer(brain);
4835
+ }, [brain]);
4836
+ }
4837
+
4487
4838
  // src/components/RawList/index.tsx
4488
4839
  function RawListFn(props) {
4489
4840
  const { renderItem, brain, debugChannel } = props;
4490
- const { onRenderUpdater, renderer } = useMemo7(() => {
4491
- const onRenderUpdater2 = buildSubscriptionCallback();
4492
- const renderer2 = new ReactVirtualRenderer(brain, {
4493
- channel: debugChannel
4494
- });
4495
- return { onRenderUpdater: onRenderUpdater2, renderer: renderer2 };
4496
- }, []);
4841
+ const { onRenderUpdater, renderer } = useVirtualRenderer({
4842
+ brain,
4843
+ debugChannel
4844
+ });
4497
4845
  const getRenderItem = useLatest(renderItem);
4498
- useEffect11(() => {
4846
+ useEffect13(() => {
4499
4847
  const renderRange = brain.getRenderRange();
4500
4848
  renderer.renderRange(renderRange, {
4501
4849
  renderItem,
4502
4850
  force: true,
4503
4851
  onRender: onRenderUpdater
4504
4852
  });
4505
- }, [renderItem, onRenderUpdater]);
4506
- useEffect11(() => {
4853
+ }, [brain, renderItem, onRenderUpdater]);
4854
+ useEffect13(() => {
4507
4855
  const remove = brain.onRenderRangeChange((renderRange) => {
4508
4856
  renderer.renderRange(renderRange, {
4509
4857
  force: false,
@@ -4513,12 +4861,6 @@ function RawListFn(props) {
4513
4861
  });
4514
4862
  return remove;
4515
4863
  }, [brain, onRenderUpdater]);
4516
- useEffect11(() => {
4517
- return () => {
4518
- renderer.destroy();
4519
- onRenderUpdater.destroy();
4520
- };
4521
- }, [renderer, onRenderUpdater]);
4522
4864
  return /* @__PURE__ */ createElement14(AvoidReactDiff, {
4523
4865
  updater: onRenderUpdater
4524
4866
  });
@@ -4551,14 +4893,14 @@ function InfiniteTableHeaderFn(props) {
4551
4893
  columns: computedVisibleColumnsMap
4552
4894
  });
4553
4895
  }, [computedVisibleColumnsMap, columns, repaintId, headerHeight]);
4554
- useEffect12(() => {
4896
+ useEffect14(() => {
4555
4897
  const onScroll = (scrollPosition) => {
4556
4898
  domRef.current.style.transform = `translate3d(-${scrollPosition.scrollLeft}px, 0px, 0px)`;
4557
4899
  };
4558
4900
  const removeOnScroll = brain.onScroll(onScroll);
4559
4901
  return removeOnScroll;
4560
4902
  }, [brain]);
4561
- const domRef = useRef7(null);
4903
+ const domRef = useRef9(null);
4562
4904
  const headerCls = HeaderClsRecipe({
4563
4905
  pinned: pinning,
4564
4906
  overflow: false,
@@ -4581,7 +4923,7 @@ import {
4581
4923
  createElement as createElement18,
4582
4924
  memo as memo7,
4583
4925
  useMemo as useMemo8,
4584
- useRef as useRef8
4926
+ useRef as useRef10
4585
4927
  } from "react";
4586
4928
 
4587
4929
  // src/components/InfiniteTable/components/InfiniteTableHeader/renderColumnHeaderGroups.tsx
@@ -4591,7 +4933,7 @@ import {
4591
4933
 
4592
4934
  // src/components/InfiniteTable/components/InfiniteTableHeader/buildColumnAndGroupTree.ts
4593
4935
  function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
4594
- const map = new Map();
4936
+ const map2 = new Map();
4595
4937
  const temporaryMap = new Map();
4596
4938
  const mapOfAllParentGroupsForColumns = new Map();
4597
4939
  columns.forEach((col, index) => {
@@ -4609,7 +4951,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
4609
4951
  computedWidth: col.computedWidth,
4610
4952
  depth: col.columnGroup ? ((_d = columnGroupsDepthsMap.get(col.columnGroup)) != null ? _d : 0) + 1 : 0
4611
4953
  };
4612
- map.set([colId], colItem);
4954
+ map2.set([colId], colItem);
4613
4955
  let groupId = col.columnGroup;
4614
4956
  let colGroupItem;
4615
4957
  let prevGroupItem = colItem;
@@ -4631,7 +4973,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
4631
4973
  computedWidth: 0,
4632
4974
  depth: (_e = columnGroupsDepthsMap.get(groupId)) != null ? _e : 0
4633
4975
  };
4634
- map.set(groupAbsoluteId, colGroupItem);
4976
+ map2.set(groupAbsoluteId, colGroupItem);
4635
4977
  temporaryMap.set(groupId, colGroupItem);
4636
4978
  }
4637
4979
  colGroupItem.columnItems.push(colItem);
@@ -4648,7 +4990,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
4648
4990
  });
4649
4991
  const result = [];
4650
4992
  let groupOffset = 0;
4651
- map.forEach((item) => {
4993
+ map2.forEach((item) => {
4652
4994
  if (!item.ref.columnGroup) {
4653
4995
  const itemWidth = item.type === "column" ? item.ref.computedWidth : item.columnItems.reduce((sum, col) => sum + col.ref.computedWidth, 0);
4654
4996
  item.groupOffset = groupOffset;
@@ -4660,7 +5002,7 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap) {
4660
5002
  groupOffset += itemWidth;
4661
5003
  }
4662
5004
  });
4663
- map.clear();
5005
+ map2.clear();
4664
5006
  temporaryMap.clear();
4665
5007
  return result;
4666
5008
  }
@@ -4759,7 +5101,7 @@ function renderColumnHeaderGroups(config) {
4759
5101
  }
4760
5102
 
4761
5103
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderUnvirtualized.tsx
4762
- import { useEffect as useEffect13 } from "react";
5104
+ import { useEffect as useEffect15 } from "react";
4763
5105
  var { rootClassName: rootClassName5 } = internalProps;
4764
5106
  var TableHeaderClassName2 = `${rootClassName5}Header`;
4765
5107
  var UPDATE_SCROLL = (node, scrollPosition) => {
@@ -4792,7 +5134,7 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
4792
5134
  },
4793
5135
  computed: { computedVisibleColumnsMap: columnsMap }
4794
5136
  } = useInfiniteTable();
4795
- const domRef = useRef8(null);
5137
+ const domRef = useRef10(null);
4796
5138
  const hasColumnGroups = computedColumnGroups.size > 0;
4797
5139
  const columnHeaderGroups = useMemo8(() => {
4798
5140
  return hasColumnGroups ? renderColumnHeaderGroups({
@@ -4825,7 +5167,7 @@ function InfiniteTableHeaderUnvirtualizedFn(props) {
4825
5167
  if (totalWidth != null) {
4826
5168
  style.width = availableWidth;
4827
5169
  }
4828
- useEffect13(() => {
5170
+ useEffect15(() => {
4829
5171
  const scroller = brain || scrollListener;
4830
5172
  if (!scroller || !scrollable) {
4831
5173
  return;
@@ -4942,12 +5284,12 @@ import {
4942
5284
  createElement as createElement20,
4943
5285
  forwardRef as forwardRef2
4944
5286
  } from "react";
4945
- import { useRef as useRef9 } from "react";
5287
+ import { useRef as useRef11 } from "react";
4946
5288
 
4947
5289
  // src/components/hooks/useOnScroll.ts
4948
- import { useEffect as useEffect14 } from "react";
5290
+ import { useEffect as useEffect16 } from "react";
4949
5291
  var useOnScroll = (domRef, onScroll) => {
4950
- useEffect14(() => {
5292
+ useEffect16(() => {
4951
5293
  const domNode = domRef == null ? void 0 : domRef.current;
4952
5294
  const scrollFn = (event) => {
4953
5295
  const node = event.target;
@@ -4993,7 +5335,7 @@ var VirtualScrollContainer = forwardRef2(function VirtualScrollContainer2(props,
4993
5335
  className,
4994
5336
  style
4995
5337
  } = props;
4996
- const domRef = ref != null ? ref : useRef9(null);
5338
+ const domRef = ref != null ? ref : useRef11(null);
4997
5339
  useOnScroll(domRef, onContainerScroll);
4998
5340
  return /* @__PURE__ */ createElement20("div", {
4999
5341
  ref: domRef,
@@ -5027,7 +5369,7 @@ function SpacePlaceholderFn(props) {
5027
5369
  var SpacePlaceholder = memo8(SpacePlaceholderFn);
5028
5370
 
5029
5371
  // src/components/InfiniteTable/hooks/useListRendering.tsx
5030
- import { useCallback as useCallback17, useEffect as useEffect20, useMemo as useMemo10, useRef as useRef15 } from "react";
5372
+ import { useCallback as useCallback17, useEffect as useEffect22, useMemo as useMemo10, useRef as useRef17 } from "react";
5031
5373
 
5032
5374
  // src/components/InfiniteTable/hooks/useUnpinnedRendering.tsx
5033
5375
  import {
@@ -5046,7 +5388,7 @@ import {
5046
5388
  Fragment as Fragment4,
5047
5389
  createElement as createElement22
5048
5390
  } from "react";
5049
- import { useRef as useRef10, useEffect as useEffect15, useState as useState8 } from "react";
5391
+ import { useRef as useRef12, useEffect as useEffect17, useState as useState9 } from "react";
5050
5392
 
5051
5393
  // src/components/VirtualList/VirtualList.css.ts
5052
5394
  var VirtualListCls = "mlx2t0 _16lm1iw0";
@@ -5089,11 +5431,11 @@ var VirtualList = (props) => {
5089
5431
  "onContainerScroll",
5090
5432
  "children"
5091
5433
  ]);
5092
- const domRef = useRef10(null);
5434
+ const domRef = useRef12(null);
5093
5435
  const [, rerender] = useRerender();
5094
- const [totalSize, setTotalSize] = useState8(0);
5095
- const renderCountRef = useRef10(0);
5096
- useEffect15(() => {
5436
+ const [totalSize, setTotalSize] = useState9(0);
5437
+ const renderCountRef = useRef12(0);
5438
+ useEffect17(() => {
5097
5439
  const removeOnRenderCount = virtualBrain.onRenderCountChange((renderCount) => {
5098
5440
  renderCountRef.current = renderCount;
5099
5441
  if (true) {
@@ -5112,7 +5454,7 @@ var VirtualList = (props) => {
5112
5454
  removeOnTotalSizeChange();
5113
5455
  };
5114
5456
  }, [virtualBrain]);
5115
- useEffect15(() => {
5457
+ useEffect17(() => {
5116
5458
  const onScroll = (scrollPosition) => {
5117
5459
  UPDATE_SCROLL2(domRef.current, scrollPosition);
5118
5460
  };
@@ -5138,7 +5480,7 @@ var VirtualList = (props) => {
5138
5480
  brain: virtualBrain,
5139
5481
  renderItem,
5140
5482
  repaintId,
5141
- debugChannel: "VirtualList"
5483
+ debugChannel: "VirtualList-" + mainAxis
5142
5484
  })), children, /* @__PURE__ */ createElement22(SpacePlaceholder, {
5143
5485
  count,
5144
5486
  width,
@@ -5170,7 +5512,7 @@ import {
5170
5512
  memo as memo10,
5171
5513
  useCallback as useCallback11
5172
5514
  } from "react";
5173
- import { useRef as useRef12 } from "react";
5515
+ import { useRef as useRef14 } from "react";
5174
5516
 
5175
5517
  // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableColumnCell.tsx
5176
5518
  import {
@@ -5279,7 +5621,7 @@ var InfiniteTableColumnCell = memo9(InfiniteTableColumnCellFn);
5279
5621
  // src/components/InfiniteTable/components/InfiniteTableRow/useRowDOMProps.ts
5280
5622
  import {
5281
5623
  useCallback as useCallback10,
5282
- useRef as useRef11
5624
+ useRef as useRef13
5283
5625
  } from "react";
5284
5626
 
5285
5627
  // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableRowClassName.ts
@@ -5305,7 +5647,7 @@ function useRowDOMProps(props, rowProps, rowStyle, rowClassName, groupRenderStra
5305
5647
  domRef: domRefFromProps,
5306
5648
  rowInfo
5307
5649
  } = props;
5308
- const domRef = useRef11(null);
5650
+ const domRef = useRef13(null);
5309
5651
  const rowDOMRef = useCallback10((node) => {
5310
5652
  domRefFromProps(node);
5311
5653
  domRef.current = node;
@@ -5408,7 +5750,7 @@ function InfiniteTableRowFn(props) {
5408
5750
  width: rowWidth,
5409
5751
  height: rowHeight
5410
5752
  }, domProps.style);
5411
- const renderCellRef = useRef12(null);
5753
+ const renderCellRef = useRef14(null);
5412
5754
  const renderCell = useCallback11(({ domRef, itemIndex }) => {
5413
5755
  const column = columns[itemIndex];
5414
5756
  if (!column) {
@@ -5581,22 +5923,23 @@ function useUnpinnedRendering(params) {
5581
5923
  }
5582
5924
 
5583
5925
  // src/components/InfiniteTable/hooks/useOnContainerScroll.ts
5584
- import { useCallback as useCallback13, useEffect as useEffect16, useRef as useRef13 } from "react";
5926
+ import { useCallback as useCallback13, useEffect as useEffect18, useRef as useRef15 } from "react";
5585
5927
 
5586
5928
  // src/components/InfiniteTable/InfiniteCls.css.ts
5929
+ var import_createRuntimeFn4 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
5587
5930
  var FooterCls = "_16lm1iw1";
5588
5931
  var InfiniteCls = "_1yeub2v0 _16lm1iw1 _16lm1iwj _16lm1iwz _16lm1iw0";
5589
- 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: [] });
5932
+ 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: [] });
5590
5933
  var InfiniteClsScrolling = "_1yeub2v1";
5591
5934
  var InfiniteClsShiftingColumns = "_16lm1iwm";
5592
5935
  var PinnedRowsClsVariants = { pinnedStart: "_1yeub2ve", pinnedEnd: "_1yeub2vf", overflow: "_1yeub2vg" };
5593
- var PinnedRowsContainerClsVariants = createRuntimeFn({ defaultClassName: "", variantClassNames: { pinned: { start: "_1yeub2vh", end: "_1yeub2vi", false: "_1yeub2vj" } }, defaultVariants: {}, compoundVariants: [] });
5936
+ var PinnedRowsContainerClsVariants = (0, import_createRuntimeFn4.createRuntimeFn)({ defaultClassName: "", variantClassNames: { pinned: { start: "_1yeub2vh", end: "_1yeub2vi", false: "_1yeub2vj" } }, defaultVariants: {}, compoundVariants: [] });
5594
5937
 
5595
5938
  // src/components/InfiniteTable/hooks/useOnContainerScroll.ts
5596
5939
  var DELAY = 200;
5597
5940
  var TableClassName = internalProps.rootClassName;
5598
5941
  var TableClassName__Scrolling = `${TableClassName}--scrolling`;
5599
- var SCROLL_BOTTOM_OFFSET = 0;
5942
+ var SCROLL_BOTTOM_OFFSET = 1;
5600
5943
  var useOnContainerScroll = ({
5601
5944
  verticalVirtualBrain,
5602
5945
  horizontalVirtualBrain,
@@ -5612,10 +5955,11 @@ var useOnContainerScroll = ({
5612
5955
  bodySize
5613
5956
  }
5614
5957
  } = useInfiniteTable();
5615
- const timeoutIdRef = useRef13(0);
5616
- const scrollingRef = useRef13(false);
5617
- const scrollTopMaxRef = useRef13(0);
5618
- useEffect16(() => {
5958
+ const { componentActions: dataSourceActions, getState: getDataSourceState } = useDataSourceContextValue();
5959
+ const timeoutIdRef = useRef15(0);
5960
+ const scrollingRef = useRef15(false);
5961
+ const scrollTopMaxRef = useRef15(0);
5962
+ useEffect18(() => {
5619
5963
  const { current: node } = scrollerDOMRef;
5620
5964
  scrollTopMaxRef.current = node.scrollHeight - node.clientHeight;
5621
5965
  }, [reservedContentHeight, bodySize.height]);
@@ -5654,7 +5998,7 @@ var useOnContainerScroll = ({
5654
5998
  domRef.current,
5655
5999
  setScrolling
5656
6000
  ]);
5657
- const scrollPositionRef = useRef13({
6001
+ const scrollPositionRef = useRef15({
5658
6002
  scrollLeft: 0,
5659
6003
  scrollTop: 0
5660
6004
  });
@@ -5672,6 +6016,9 @@ var useOnContainerScroll = ({
5672
6016
  const isScrollBottom = scrollTop + offset >= scrollTopMaxRef.current;
5673
6017
  if (isScrollBottom) {
5674
6018
  onScrollToBottom == null ? void 0 : onScrollToBottom();
6019
+ if (getDataSourceState().livePagination) {
6020
+ dataSourceActions.scrollBottomId = Date.now();
6021
+ }
5675
6022
  }
5676
6023
  }, [onContainerScroll, scrollToBottomOffset, onScrollToBottom, onScrollToTop]);
5677
6024
  return {
@@ -5691,12 +6038,12 @@ import { useCallback as useCallback15 } from "react";
5691
6038
  import {
5692
6039
  createElement as createElement28
5693
6040
  } from "react";
5694
- import { useEffect as useEffect18, useCallback as useCallback14, useRef as useRef14 } from "react";
6041
+ import { useEffect as useEffect20, useCallback as useCallback14, useRef as useRef16 } from "react";
5695
6042
 
5696
6043
  // src/components/hooks/useOnMount.ts
5697
- import { useEffect as useEffect17 } from "react";
6044
+ import { useEffect as useEffect19 } from "react";
5698
6045
  function useOnMount(domRef, props) {
5699
- useEffect17(() => {
6046
+ useEffect19(() => {
5700
6047
  const { onMount, onUnmount } = props;
5701
6048
  const node = domRef == null ? void 0 : domRef.current;
5702
6049
  onMount == null ? void 0 : onMount(node);
@@ -5727,7 +6074,7 @@ var RowListWithExternalScrolling = (props) => {
5727
6074
  onMount,
5728
6075
  onUnmount
5729
6076
  } = props;
5730
- const domRef = useRef14(null);
6077
+ const domRef = useRef16(null);
5731
6078
  const renderItem = useCallback14((renderProps) => renderRow({
5732
6079
  domRef: renderProps.domRef,
5733
6080
  rowHeight: renderProps.itemSize,
@@ -5737,7 +6084,7 @@ var RowListWithExternalScrolling = (props) => {
5737
6084
  onMount,
5738
6085
  onUnmount
5739
6086
  });
5740
- useEffect18(() => {
6087
+ useEffect20(() => {
5741
6088
  const onScroll = (scrollPosition) => {
5742
6089
  const node = domRef.current;
5743
6090
  if (node) {
@@ -5960,7 +6307,7 @@ function usePinnedStartRendering(params) {
5960
6307
  }
5961
6308
 
5962
6309
  // src/components/InfiniteTable/hooks/useYourBrain.ts
5963
- import { useEffect as useEffect19 } from "react";
6310
+ import { useEffect as useEffect21 } from "react";
5964
6311
 
5965
6312
  // src/components/VirtualBrain/index.ts
5966
6313
  var import_binary_search2 = __toModule(require_binary_search());
@@ -5976,11 +6323,13 @@ var VirtualBrain = class extends Logger {
5976
6323
  super(`VirtualBrain:${options.mainAxis}`);
5977
6324
  this.scrollPosition = initialScrollPosition2;
5978
6325
  this.scrollPositionOnMainAxis = 0;
6326
+ this.destroyed = false;
5979
6327
  this.totalSize = 0;
5980
6328
  this.onScrollFns = [];
5981
6329
  this.onTotalSizeChangeFns = [];
5982
6330
  this.onRenderCountChangeFns = [];
5983
6331
  this.onRenderRangeChangeFns = [];
6332
+ this.onDestroyFns = [];
5984
6333
  this.renderCount = 0;
5985
6334
  this.renderRange = {
5986
6335
  renderStartIndex: -1,
@@ -6077,6 +6426,12 @@ var VirtualBrain = class extends Logger {
6077
6426
  this.onRenderRangeChangeFns = this.onRenderRangeChangeFns.filter((f) => f !== fn);
6078
6427
  };
6079
6428
  };
6429
+ this.onDestroy = (fn) => {
6430
+ this.onDestroyFns.push(fn);
6431
+ return () => {
6432
+ this.onDestroyFns = this.onDestroyFns.filter((f) => f !== fn);
6433
+ };
6434
+ };
6080
6435
  this.update = (newCount, newItemSize, newItemSpan) => {
6081
6436
  const { itemSize, count, itemSpan } = this.options;
6082
6437
  const countChange = count !== newCount;
@@ -6273,7 +6628,13 @@ var VirtualBrain = class extends Logger {
6273
6628
  return result;
6274
6629
  };
6275
6630
  this.destroy = () => {
6631
+ if (this.destroyed) {
6632
+ return;
6633
+ }
6634
+ this.notifyDestroy();
6276
6635
  this.reset();
6636
+ this.destroyed = true;
6637
+ this.onDestroyFns = [];
6277
6638
  this.onScrollFns = [];
6278
6639
  this.onTotalSizeChangeFns = [];
6279
6640
  this.onRenderCountChangeFns = [];
@@ -6309,6 +6670,12 @@ var VirtualBrain = class extends Logger {
6309
6670
  fns[i](scrollPosition);
6310
6671
  }
6311
6672
  }
6673
+ notifyDestroy() {
6674
+ const fns = this.onDestroyFns;
6675
+ for (let i = 0, len = fns.length; i < len; i++) {
6676
+ fns[i]();
6677
+ }
6678
+ }
6312
6679
  notifyTotalSizeChange() {
6313
6680
  const totalSize = this.getTotalSize();
6314
6681
  const fns = this.onTotalSizeChangeFns;
@@ -6419,16 +6786,21 @@ function useYourBrain(param) {
6419
6786
  });
6420
6787
  return brain;
6421
6788
  });
6789
+ useEffect21(() => {
6790
+ return () => {
6791
+ horizontalVirtualBrain.destroy();
6792
+ verticalVirtualBrain.destroy();
6793
+ };
6794
+ }, []);
6422
6795
  horizontalVirtualBrain.update(computedUnpinnedColumns.length, columnSize);
6423
6796
  verticalVirtualBrain.update(dataArray.length, rowHeight, rowSpan);
6424
- globalThis.verticalVirtualBrain = verticalVirtualBrain;
6425
- useEffect19(() => {
6797
+ useEffect21(() => {
6426
6798
  verticalVirtualBrain.setAvailableSize({
6427
6799
  height: bodySize.height,
6428
6800
  width: 0
6429
6801
  });
6430
6802
  }, [bodySize, verticalVirtualBrain]);
6431
- useEffect19(() => {
6803
+ useEffect21(() => {
6432
6804
  horizontalVirtualBrain.setAvailableSize({
6433
6805
  height: 0,
6434
6806
  width: Math.max(bodySize.width - computedPinnedStartWidth - computedPinnedEndWidth, 0)
@@ -6437,29 +6809,6 @@ function useYourBrain(param) {
6437
6809
  return { horizontalVirtualBrain, verticalVirtualBrain };
6438
6810
  }
6439
6811
 
6440
- // src/utils/shallowEqualObjects.ts
6441
- function shallowEqualObjects(objA, objB) {
6442
- if (objA === objB) {
6443
- return true;
6444
- }
6445
- if (!objA || !objB) {
6446
- return false;
6447
- }
6448
- var aKeys = Object.keys(objA);
6449
- var bKeys = Object.keys(objB);
6450
- var len = aKeys.length;
6451
- if (bKeys.length !== len) {
6452
- return false;
6453
- }
6454
- for (var i = 0; i < len; i++) {
6455
- var key = aKeys[i];
6456
- if (objA[key] !== objB[key] || !Object.prototype.hasOwnProperty.call(objB, key)) {
6457
- return false;
6458
- }
6459
- }
6460
- return true;
6461
- }
6462
-
6463
6812
  // src/components/InfiniteTable/hooks/useListRendering.tsx
6464
6813
  function useListRendering(param) {
6465
6814
  const { computed, bodySize, columnShifts } = param;
@@ -6489,7 +6838,7 @@ function useListRendering(param) {
6489
6838
  pinnedEndScrollListener
6490
6839
  } = componentState;
6491
6840
  const prevDataSourceTimestamp = usePrevious(dataSourceState.updatedAt);
6492
- const repaintIdRef = useRef15(0);
6841
+ const repaintIdRef = useRef17(0);
6493
6842
  if (!shallowEqualObjects(prevComputed, computed) || prevDataSourceTimestamp !== dataSourceState.updatedAt) {
6494
6843
  repaintIdRef.current++;
6495
6844
  }
@@ -6531,12 +6880,12 @@ function useListRendering(param) {
6531
6880
  });
6532
6881
  const hasHorizontalScrollbar = computedUnpinnedColumnsWidth > bodySize.width - computedPinnedStartColumnsWidth - computedPinnedEndColumnsWidth;
6533
6882
  const reservedContentHeight = verticalVirtualBrain.getTotalSize() + (hasHorizontalScrollbar ? getScrollbarWidth() : 0);
6534
- const hasVerticalScrollbar = bodySize.height < reservedContentHeight;
6883
+ const hasVerticalScrollbar = bodySize.height > 0 && bodySize.height < reservedContentHeight;
6535
6884
  const scrollbars = useMemo10(() => ({
6536
6885
  vertical: hasVerticalScrollbar,
6537
6886
  horizontal: hasHorizontalScrollbar
6538
6887
  }), [hasVerticalScrollbar, hasHorizontalScrollbar]);
6539
- useEffect20(() => {
6888
+ useEffect22(() => {
6540
6889
  if (!bodySize.height) {
6541
6890
  return;
6542
6891
  }
@@ -6597,7 +6946,7 @@ function useListRendering(param) {
6597
6946
  computedUnpinnedColumns
6598
6947
  });
6599
6948
  const [, rerender] = useRerender();
6600
- useEffect20(() => {
6949
+ useEffect22(() => {
6601
6950
  rerender();
6602
6951
  }, [dataSourceState]);
6603
6952
  const { pinnedStartList, pinnedStartScrollbarPlaceholder } = usePinnedStartRendering(pinnedRenderingParams);
@@ -6624,9 +6973,9 @@ import {
6624
6973
  createElement as createElement30,
6625
6974
  forwardRef as forwardRef3,
6626
6975
  useCallback as useCallback18,
6627
- useRef as useRef16
6976
+ useRef as useRef18
6628
6977
  } from "react";
6629
- import { useEffect as useEffect21 } from "react";
6978
+ import { useEffect as useEffect23 } from "react";
6630
6979
 
6631
6980
  // src/components/utils/decamelize.ts
6632
6981
  var import_decamelize = __toModule(require_decamelize());
@@ -6664,7 +7013,7 @@ var enforceStyle = (node, style) => {
6664
7013
  };
6665
7014
  var InfiniteTableLicenseFooter = forwardRef3(function InfiniteTableLicenseFooter2(props, ref) {
6666
7015
  const { rootClassName: rootClassName12 } = useInternalProps();
6667
- const domRef = useRef16(null);
7016
+ const domRef = useRef18(null);
6668
7017
  const domCallback = useCallback18((node) => {
6669
7018
  domRef.current = node;
6670
7019
  if (!ref) {
@@ -6676,7 +7025,7 @@ var InfiniteTableLicenseFooter = forwardRef3(function InfiniteTableLicenseFooter
6676
7025
  ref.current = node;
6677
7026
  }
6678
7027
  }, []);
6679
- useEffect21(() => {
7028
+ useEffect23(() => {
6680
7029
  const forceStyle = () => {
6681
7030
  requestAnimationFrame(() => {
6682
7031
  var _a;
@@ -6853,11 +7202,11 @@ var SANDBOX_REGEX = /(https):\/\/\d+\-\d+\-\d\-(sandpack\.codesandbox\.io)/g;
6853
7202
  var origin = typeof window !== "undefined" ? window.location.origin : "";
6854
7203
  var [_fullUrl, protocol, sandboxUrl] = Array.from(SANDBOX_REGEX.exec(origin) || []);
6855
7204
  var isInsideSandbox = protocol === "https" && sandboxUrl === "sandpack.codesandbox.io";
6856
- var useLicense = (licenseKey) => {
7205
+ var useLicense = (licenseKey = "") => {
6857
7206
  const valid = useMemo11(() => {
6858
7207
  let valid2 = isValidLicense(licenseKey, {
6859
7208
  publishedAt: 1624970570587,
6860
- version: "0.0.5"
7209
+ version: "0.0.9"
6861
7210
  });
6862
7211
  if (!licenseKey && !valid2 && isInsideSandbox) {
6863
7212
  return true;
@@ -6873,8 +7222,8 @@ import {
6873
7222
  useCallback as useCallback19,
6874
7223
  useLayoutEffect as useLayoutEffect5
6875
7224
  } from "react";
6876
- import { useRef as useRef17 } from "react";
6877
- var error2 = err("CSSVariableWatch");
7225
+ import { useRef as useRef19 } from "react";
7226
+ var error = err("CSSVariableWatch");
6878
7227
  var debug5 = dbg("CSSVariableWatch");
6879
7228
  var WRAPPER_STYLE = {
6880
7229
  position: "absolute",
@@ -6886,7 +7235,7 @@ var WRAPPER_STYLE = {
6886
7235
  overflow: "hidden"
6887
7236
  };
6888
7237
  var useCSSVariableWatch = (params) => {
6889
- const lastValueRef = useRef17(0);
7238
+ const lastValueRef = useRef19(0);
6890
7239
  const onResize = useCallback19(({ height }) => {
6891
7240
  if (height && height !== lastValueRef.current) {
6892
7241
  lastValueRef.current = height;
@@ -6901,12 +7250,12 @@ var useCSSVariableWatch = (params) => {
6901
7250
  debug5(`Variable ${params.varName} found and equals ${value}.`);
6902
7251
  params.onChange(value);
6903
7252
  } else {
6904
- error2(`Specified variable ${params.varName} not found or does not have a numeric value.`);
7253
+ error(`Specified variable ${params.varName} not found or does not have a numeric value.`);
6905
7254
  }
6906
7255
  }, []);
6907
7256
  };
6908
7257
  var CSSVariableWatch = (props) => {
6909
- const domRef = useRef17(null);
7258
+ const domRef = useRef19(null);
6910
7259
  useCSSVariableWatch(__spreadProps(__spreadValues({}, props), {
6911
7260
  ref: domRef
6912
7261
  }));
@@ -7051,9 +7400,15 @@ var InfiniteTableRoot = getComponentStateRoot({
7051
7400
  });
7052
7401
  var InfiniteTableComponent = memo13(function InfiniteTableComponent2() {
7053
7402
  var _a;
7054
- const { componentState, getComputed, computed } = useInfiniteTable();
7055
7403
  const {
7056
- componentState: { dataArray, loading }
7404
+ componentState,
7405
+ getComputed,
7406
+ computed,
7407
+ getState: getInfiniteTableState
7408
+ } = useInfiniteTable();
7409
+ const {
7410
+ componentState: { dataArray, loading },
7411
+ getState: getDataSourceState
7057
7412
  } = useDataSourceContextValue();
7058
7413
  const {
7059
7414
  domRef,
@@ -7090,6 +7445,15 @@ var InfiniteTableComponent = memo13(function InfiniteTableComponent2() {
7090
7445
  const licenseValid = useLicense(licenseKey);
7091
7446
  const domProps = useDOMProps(componentState.domProps);
7092
7447
  const LoadMaskCmp = (_a = components == null ? void 0 : components.LoadMask) != null ? _a : LoadMask;
7448
+ useLayoutEffect6(() => {
7449
+ const dataSourceState = getDataSourceState();
7450
+ const { onScrollbarsChange } = getInfiniteTableState();
7451
+ const { notifyScrollbarsChange } = dataSourceState;
7452
+ if (onScrollbarsChange && dataSourceState.updatedAt && dataSourceState.dataArray.length) {
7453
+ onScrollbarsChange(scrollbars);
7454
+ }
7455
+ notifyScrollbarsChange(scrollbars);
7456
+ }, [scrollbars]);
7093
7457
  return /* @__PURE__ */ createElement33("div", __spreadValues({
7094
7458
  ref: domRef
7095
7459
  }, domProps), header ? /* @__PURE__ */ createElement33(TableHeaderWrapper, {
@@ -7121,7 +7485,7 @@ var InfiniteTableComponent = memo13(function InfiniteTableComponent2() {
7121
7485
  });
7122
7486
  function InfiniteTableContextProvider() {
7123
7487
  const { componentActions, componentState } = useComponentState();
7124
- const { scrollerDOMRef } = componentState;
7488
+ const { scrollerDOMRef, scrollTopId } = componentState;
7125
7489
  const computed = useComputed();
7126
7490
  const getComputed = useLatest(computed);
7127
7491
  const getState = useLatest(componentState);
@@ -7150,12 +7514,17 @@ function InfiniteTableContextProvider() {
7150
7514
  }
7151
7515
  componentActions.bodySize = bodySize;
7152
7516
  }, { earlyAttach: true });
7153
- useEffect22(() => {
7517
+ useEffect24(() => {
7154
7518
  return () => {
7155
7519
  componentState.onRowHeightCSSVarChange.destroy();
7156
7520
  componentState.onHeaderHeightCSSVarChange.destroy();
7157
7521
  };
7158
7522
  }, []);
7523
+ useEffect24(() => {
7524
+ if (scrollerDOMRef.current) {
7525
+ scrollerDOMRef.current.scrollTop = 0;
7526
+ }
7527
+ }, [scrollTopId, scrollerDOMRef]);
7159
7528
  const TableContext2 = getInfiniteTableContext();
7160
7529
  return /* @__PURE__ */ createElement33(TableContext2.Provider, {
7161
7530
  value: contextValue
@@ -7180,6 +7549,7 @@ export {
7180
7549
  getComponentStateRoot,
7181
7550
  group,
7182
7551
  interceptMap,
7552
+ multisort,
7183
7553
  useComponentState,
7184
7554
  useDataSource
7185
7555
  };