@infinite-table/infinite-react 6.2.10 → 7.0.0

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.dev.js CHANGED
@@ -143,7 +143,7 @@ function debounce(fn, { wait }) {
143
143
  }
144
144
 
145
145
  // src/components/InfiniteTable/index.tsx
146
- var React71 = __toESM(require("react"));
146
+ var React70 = __toESM(require("react"));
147
147
 
148
148
  // src/utils/join.ts
149
149
  var join = (...args) => args.filter((x) => !!`${x}`).join(" ");
@@ -152,6 +152,49 @@ var join = (...args) => args.filter((x) => !!`${x}`).join(" ");
152
152
  var React2 = __toESM(require("react"));
153
153
  var import_react2 = require("react");
154
154
 
155
+ // src/components/utils/buildSubscriptionCallback.tsx
156
+ function buildSubscriptionCallback(withRaf = false) {
157
+ let lastCallValue = null;
158
+ let fns = [];
159
+ let rafId = null;
160
+ const updater = (items, callback) => {
161
+ const results = [];
162
+ if (withRaf) {
163
+ if (rafId != null) {
164
+ cancelAnimationFrame(rafId);
165
+ rafId = null;
166
+ }
167
+ requestAnimationFrame(() => {
168
+ lastCallValue = items;
169
+ rafId = null;
170
+ for (let i = 0, len = fns.length; i < len; i++) {
171
+ results.push(fns[i](items));
172
+ }
173
+ callback?.(results);
174
+ });
175
+ } else {
176
+ lastCallValue = items;
177
+ for (let i = 0, len = fns.length; i < len; i++) {
178
+ results.push(fns[i](items));
179
+ }
180
+ callback?.(results);
181
+ }
182
+ };
183
+ updater.get = () => lastCallValue;
184
+ updater.onChange = (fn) => {
185
+ fns.push(fn);
186
+ return () => {
187
+ fns = fns.filter((f) => f !== fn);
188
+ };
189
+ };
190
+ updater.destroy = () => {
191
+ updater(null);
192
+ fns.length = 0;
193
+ };
194
+ updater.getListenersCount = () => fns.length;
195
+ return updater;
196
+ }
197
+
155
198
  // src/utils/DeepMap/once.ts
156
199
  function once(fn) {
157
200
  let called = false;
@@ -782,6 +825,7 @@ var COLORS = [
782
825
  ];
783
826
  var COLOR_SYMBOL = Symbol("color");
784
827
  var USED_COLORS_MAP = /* @__PURE__ */ new WeakMap();
828
+ var GLOBAL_LOG_INTENT = buildSubscriptionCallback();
785
829
  function initUsedColors(colors = COLORS) {
786
830
  USED_COLORS_MAP.set(
787
831
  colors,
@@ -832,7 +876,7 @@ function isChannelTargeted(channel, permissionToken) {
832
876
  }
833
877
  return void 0;
834
878
  }
835
- function isLoggingEnabled(channel, permissions) {
879
+ function isChannelEnabled(channel, permissions) {
836
880
  const cacheKey = `channel=${channel}_permissions=${permissions}`;
837
881
  if (enabledChannelsCache.has(cacheKey)) {
838
882
  return enabledChannelsCache.get(cacheKey);
@@ -893,20 +937,32 @@ function debugPackage(channelName) {
893
937
  function debugFactory(channelName2, parentChannel) {
894
938
  const channel = parentChannel ? `${parentChannel}${CHANNEL_SEPARATOR}${channelName2}` : channelName2;
895
939
  const channelParts = channel.split(CHANNEL_SEPARATOR);
896
- if (loggers.has(channelParts)) {
897
- return loggers.get(channelParts);
940
+ const foundLogger = loggers.get(channelParts);
941
+ if (foundLogger) {
942
+ return foundLogger;
898
943
  }
899
944
  const parentLogger = loggers.get(channelParts.slice(0, -1));
900
945
  const defaultLogFn = (parentLogger ? parentLogger.logFn : debug.logFn) ?? defaultLogger;
901
946
  let logFn = defaultLogFn;
902
947
  let enabled;
903
948
  let lastMessageTimestamp = 0;
904
- const isEnabled = () => enabled ?? isLoggingEnabled(channel, storageKeyValue);
949
+ const isEnabled = () => enabled ?? isChannelEnabled(channel, storageKeyValue);
905
950
  const color = getNextColor(debug.colors);
906
- const logger3 = Object.defineProperties(
951
+ const logger2 = Object.defineProperties(
907
952
  (...args) => {
908
- if (isLoggingEnabled(channel, storageKeyValue)) {
909
- const now = Date.now();
953
+ const intentListenersCount = GLOBAL_LOG_INTENT.getListenersCount();
954
+ let now;
955
+ if (intentListenersCount > 0) {
956
+ now = now ?? Date.now();
957
+ GLOBAL_LOG_INTENT({
958
+ color,
959
+ channel,
960
+ args,
961
+ timestamp: now
962
+ });
963
+ }
964
+ if (isEnabled()) {
965
+ now = now ?? Date.now();
910
966
  if (lastMessageTimestamp && logDiffs) {
911
967
  const diff = now - lastMessageTimestamp;
912
968
  logFn(`%c[${channel}]`, `color: ${color}`, `+${diff}ms:`);
@@ -964,7 +1020,10 @@ function debugPackage(channelName) {
964
1020
  }
965
1021
  },
966
1022
  enabled: {
967
- get: () => isEnabled()
1023
+ get: () => isEnabled(),
1024
+ set: (value) => {
1025
+ enabled = value;
1026
+ }
968
1027
  },
969
1028
  logFn: {
970
1029
  configurable: false,
@@ -980,8 +1039,8 @@ function debugPackage(channelName) {
980
1039
  }
981
1040
  }
982
1041
  );
983
- loggers.set(channelParts, logger3);
984
- return logger3;
1042
+ loggers.set(channelParts, logger2);
1043
+ return logger2;
985
1044
  }
986
1045
  return debugFactory(channelName);
987
1046
  }
@@ -997,22 +1056,45 @@ Object.defineProperty(debugPackage, "enable", {
997
1056
  var debug = debugPackage;
998
1057
  debug.colors = COLORS;
999
1058
  debug.logFn = defaultLogger;
1059
+ var onLogIntentGlobal = (intentChannel, fn) => {
1060
+ return GLOBAL_LOG_INTENT.onChange((options) => {
1061
+ if (!options) {
1062
+ return;
1063
+ }
1064
+ const { channel, args, color, timestamp } = options;
1065
+ if (isChannelTargeted(channel, intentChannel)) {
1066
+ fn({
1067
+ channel,
1068
+ color,
1069
+ args,
1070
+ timestamp
1071
+ });
1072
+ }
1073
+ });
1074
+ };
1075
+ debug.onLogIntent = onLogIntentGlobal;
1000
1076
  debug.destroyAll = () => {
1001
1077
  initUsedColors();
1002
1078
  initUsedColors(debug.colors);
1003
1079
  loggers.clear();
1004
1080
  enabledChannelsCache.clear();
1005
1081
  };
1082
+ if (false) {
1083
+ globalThis.debugPackage = debug;
1084
+ }
1006
1085
 
1007
- // src/utils/debug.ts
1008
- var debugTable = debug(`InfiniteTable`);
1086
+ // src/utils/debugLoggers.ts
1009
1087
  var dbg = (channelName) => {
1010
- const result = debugTable.extend(channelName);
1088
+ const result = debug(
1089
+ channelName ? `${channelName}:TYPE=debug` : "TYPE=debug"
1090
+ );
1011
1091
  result.logFn = console.log.bind(console);
1012
1092
  return result;
1013
1093
  };
1014
1094
  var err = (channelName) => {
1015
- const result = debugTable.extend(`${channelName}:error`);
1095
+ const result = debug(
1096
+ channelName ? `${channelName}:TYPE=error` : "TYPE=error"
1097
+ );
1016
1098
  result.logFn = console.error.bind(console);
1017
1099
  return result;
1018
1100
  };
@@ -1363,49 +1445,6 @@ function AvoidReactDiffFn(props) {
1363
1445
  }
1364
1446
  var AvoidReactDiff = React8.memo(AvoidReactDiffFn);
1365
1447
 
1366
- // src/components/utils/buildSubscriptionCallback.tsx
1367
- function buildSubscriptionCallback(withRaf = false) {
1368
- let lastCallValue = null;
1369
- let fns = [];
1370
- let rafId = null;
1371
- const updater = (items, callback) => {
1372
- const results = [];
1373
- if (withRaf) {
1374
- if (rafId != null) {
1375
- cancelAnimationFrame(rafId);
1376
- rafId = null;
1377
- }
1378
- requestAnimationFrame(() => {
1379
- lastCallValue = items;
1380
- rafId = null;
1381
- for (let i = 0, len = fns.length; i < len; i++) {
1382
- results.push(fns[i](items));
1383
- }
1384
- callback?.(results);
1385
- });
1386
- } else {
1387
- lastCallValue = items;
1388
- for (let i = 0, len = fns.length; i < len; i++) {
1389
- results.push(fns[i](items));
1390
- }
1391
- callback?.(results);
1392
- }
1393
- };
1394
- updater.get = () => lastCallValue;
1395
- updater.onChange = (fn) => {
1396
- fns.push(fn);
1397
- return () => {
1398
- fns = fns.filter((f) => f !== fn);
1399
- };
1400
- };
1401
- updater.destroy = () => {
1402
- updater(null);
1403
- fns.length = 0;
1404
- };
1405
- updater.getListenersCount = () => fns.length;
1406
- return updater;
1407
- }
1408
-
1409
1448
  // src/utils/selectParent.ts
1410
1449
  function selectParent(el, selector2) {
1411
1450
  let node = el;
@@ -1453,7 +1492,7 @@ var internalProps = {
1453
1492
  };
1454
1493
 
1455
1494
  // src/components/InfiniteTable/internalVars.css.ts
1456
- var InternalVars = { currentColumnTransformX: "var(--_16hkbkc0)", y: "var(--_16hkbkc1)", currentFlashingBackground: "var(--_16hkbkc2)", currentFlashingDuration: "var(--_16hkbkc3)", activeCellRowOffset: "var(--_16hkbkc4)", activeCellRowOffsetX: "var(--_16hkbkc5)", activeCellRowHeight: "var(--_16hkbkc6)", activeCellOffsetX: "var(--_16hkbkc7)", activeCellOffsetY: "var(--_16hkbkc8)", scrollTopForActiveRow: "var(--_16hkbkc9)", scrollLeftForActiveRowWhenHorizontalLayout: "var(--_16hkbkca)", activeCellColWidth: "var(--_16hkbkcb)", activeCellColOffset: "var(--_16hkbkcc)", columnReorderEffectDurationAtIndex: "var(--_16hkbkcd)", columnWidthAtIndex: "var(--_16hkbkce)", columnOffsetAtIndex: "var(--_16hkbkcf)", columnOffsetAtIndexWhileReordering: "var(--_16hkbkcg)", columnZIndexAtIndex: "var(--_16hkbkch)", pinnedStartWidth: "var(--_16hkbkci)", pinnedEndWidth: "var(--_16hkbkcj)", pinnedEndOffset: "var(--_16hkbkck)", computedVisibleColumnsCount: "var(--_16hkbkcl)", baseZIndexForCells: "var(--_16hkbkcm)", bodyWidth: "var(--_16hkbkcn)", bodyHeight: "var(--_16hkbkco)", scrollbarWidthHorizontal: "var(--_16hkbkcp)", scrollbarWidthVertical: "var(--_16hkbkcq)", scrollLeft: "var(--_16hkbkcr)", scrollTop: "var(--_16hkbkcs)", virtualScrollLeftOffset: "var(--_16hkbkct)", virtualScrollTopOffset: "var(--_16hkbkcu)" };
1495
+ var InternalVars = { currentColumnTransformX: "var(--_16hkbkc0)", y: "var(--_16hkbkc1)", currentFlashingBackground: "var(--_16hkbkc2)", currentFlashingDuration: "var(--_16hkbkc3)", activeCellRowOffset: "var(--_16hkbkc4)", activeCellRowOffsetX: "var(--_16hkbkc5)", activeCellRowHeight: "var(--_16hkbkc6)", activeCellOffsetX: "var(--_16hkbkc7)", activeCellOffsetY: "var(--_16hkbkc8)", scrollTopForActiveRow: "var(--_16hkbkc9)", scrollLeftForActiveRowWhenHorizontalLayout: "var(--_16hkbkca)", activeCellColWidth: "var(--_16hkbkcb)", activeCellColOffset: "var(--_16hkbkcc)", columnReorderEffectDurationAtIndex: "var(--_16hkbkcd)", columnWidthAtIndex: "var(--_16hkbkce)", columnOffsetAtIndex: "var(--_16hkbkcf)", columnOffsetAtIndexWhileReordering: "var(--_16hkbkcg)", columnZIndexAtIndex: "var(--_16hkbkch)", pinnedStartWidth: "var(--_16hkbkci)", pinnedEndWidth: "var(--_16hkbkcj)", pinnedEndOffset: "var(--_16hkbkck)", computedVisibleColumnsCount: "var(--_16hkbkcl)", baseZIndexForCells: "var(--_16hkbkcm)", bodyWidth: "var(--_16hkbkcn)", bodyHeight: "var(--_16hkbkco)", scrollbarWidthHorizontal: "var(--_16hkbkcp)", scrollbarWidthVertical: "var(--_16hkbkcq)", scrollLeft: "var(--_16hkbkcr)", scrollTop: "var(--_16hkbkcs)" };
1457
1496
 
1458
1497
  // src/components/InfiniteTable/vars.css.ts
1459
1498
  var CSS_LOADED_VALUE = "true";
@@ -1623,6 +1662,15 @@ function getGreatestCountVisibleInSize(availableSize, itemSizes) {
1623
1662
  return maxCount < 0 ? len : Math.min(maxCount, len);
1624
1663
  }
1625
1664
 
1665
+ // src/utils/debugChannel.ts
1666
+ var PREFIX = "DebugID=";
1667
+ function getDebugChannel(debugId, channel) {
1668
+ if (channel && channel.startsWith(PREFIX)) {
1669
+ return channel;
1670
+ }
1671
+ return channel ? `${PREFIX}${debugId}:${channel}` : `${PREFIX}${debugId}`;
1672
+ }
1673
+
1626
1674
  // src/components/VirtualBrain/MatrixBrain.ts
1627
1675
  var DEFAULT_EXTEND_BY = {
1628
1676
  start: 0,
@@ -1652,7 +1700,7 @@ function defaultShouldUpdateRenderCount(options) {
1652
1700
  }
1653
1701
  var MatrixBrain = class extends Logger {
1654
1702
  constructor(name) {
1655
- const logName = `MatrixBrain${name ? `:${name}` : ""}`;
1703
+ const logName = getDebugChannel(name, `${name}:MatrixBrain`);
1656
1704
  super(logName);
1657
1705
  this.scrolling = false;
1658
1706
  this.RENDER_COUNT_SAFETY_MARGIN_START = 1;
@@ -2442,7 +2490,7 @@ var MatrixBrain = class extends Logger {
2442
2490
  height: this.availableRenderHeight ?? this.availableHeight
2443
2491
  };
2444
2492
  };
2445
- this.name = name || "MatrixBrain";
2493
+ this.name = logName;
2446
2494
  this.update = this.update.bind(this);
2447
2495
  this.destroy = this.destroy.bind(this);
2448
2496
  this.getCellOffset = this.getCellOffset.bind(this);
@@ -5044,9 +5092,9 @@ var HorizontalLayoutTableRenderer = class extends GridRenderer {
5044
5092
 
5045
5093
  // src/components/HeadlessTable/createRenderer.ts
5046
5094
  function createRenderer(brain) {
5047
- const renderer = !brain.isHorizontalLayoutBrain ? new GridRenderer(brain, `ReactHeadlessTableRenderer:${brain.name}`) : new HorizontalLayoutTableRenderer(
5095
+ const renderer = !brain.isHorizontalLayoutBrain ? new GridRenderer(brain, `${brain.name}:ReactHeadlessTableRenderer`) : new HorizontalLayoutTableRenderer(
5048
5096
  brain,
5049
- `HorizontalLayoutTableRenderer:${brain.name}`
5097
+ `${brain.name}:HorizontalLayoutTableRenderer`
5050
5098
  );
5051
5099
  const onRenderUpdater = buildSubscriptionCallback();
5052
5100
  brain.onDestroy(() => {
@@ -5407,8 +5455,6 @@ var CELL_DETACHED_CLASSNAMES = [
5407
5455
  ];
5408
5456
 
5409
5457
  // src/components/HeadlessTable/index.tsx
5410
- var virtualScrollLeftOffset = stripVar(InternalVars.virtualScrollLeftOffset);
5411
- var virtualScrollTopOffset = stripVar(InternalVars.virtualScrollTopOffset);
5412
5458
  function useMatrixBrain(brain, brainOptions, fixedCellsInfo) {
5413
5459
  if (fixedCellsInfo && (fixedCellsInfo.fixedColsStart || fixedCellsInfo.fixedColsEnd || fixedCellsInfo.fixedRowsStart || fixedCellsInfo.fixedRowsEnd)) {
5414
5460
  brain.updateFixedCells({
@@ -5482,25 +5528,14 @@ function HeadlessTable(props) {
5482
5528
  }, [wrapRowsHorizontally, brain]);
5483
5529
  const updateDOMTransform = (0, import_react10.useCallback)((scrollPos) => {
5484
5530
  requestAnimationFrame(() => {
5485
- const scrollVarHost = scrollVarHostRef?.current;
5486
- if (!scrollVarHost) {
5487
- if (!domRef.current) {
5488
- return;
5489
- }
5490
- domRef.current.style.setProperty(
5491
- "transform",
5492
- `translate3d(${-scrollPos.scrollLeft}px, ${-scrollPos.scrollTop}px, 0px)`
5493
- );
5531
+ if (!domRef.current) {
5494
5532
  return;
5495
5533
  }
5496
- scrollVarHost.style.setProperty(
5497
- virtualScrollLeftOffset,
5498
- `-${scrollPos.scrollLeft}px`
5499
- );
5500
- scrollVarHost.style.setProperty(
5501
- virtualScrollTopOffset,
5502
- `-${scrollPos.scrollTop}px`
5534
+ domRef.current.style.setProperty(
5535
+ "transform",
5536
+ `translate3d(${-scrollPos.scrollLeft}px, ${-scrollPos.scrollTop}px, 0px)`
5503
5537
  );
5538
+ return;
5504
5539
  });
5505
5540
  }, []);
5506
5541
  const onContainerScroll = (0, import_react10.useCallback)(
@@ -5918,8 +5953,10 @@ function buildManagedComponent(config) {
5918
5953
  }
5919
5954
  });
5920
5955
  if (updatedPropsToStateCount > 0 || newMappedStateCount > 0) {
5921
- const logger3 = config.debugName ? dbg(`${config.debugName}:rerender`) : dbg("rerender");
5922
- logger3(
5956
+ const logger2 = config.debugName ? dbg(
5957
+ typeof config.debugName === "function" ? `${config.debugName(currentProps)}:rerender` : `${config.debugName}:rerender`
5958
+ ) : dbg("rerender");
5959
+ logger2(
5923
5960
  "Triggered by new values for the following props",
5924
5961
  ...[
5925
5962
  ...Object.keys(newMappedState ?? {}),
@@ -9718,6 +9755,8 @@ function InfiniteTableColumnCellFn(props) {
9718
9755
  column,
9719
9756
  onMouseLeave,
9720
9757
  onMouseEnter,
9758
+ onRowMouseEnter,
9759
+ onRowMouseLeave,
9721
9760
  // toggleGroupRow,
9722
9761
  rowIndex,
9723
9762
  rowHeight,
@@ -9789,6 +9828,24 @@ function InfiniteTableColumnCellFn(props) {
9789
9828
  const { align: align2, verticalAlign } = renderParams;
9790
9829
  const renderParam = renderParams;
9791
9830
  const renderParamRef = React37.useRef(renderParam);
9831
+ const handleMouseEnter = onRowMouseEnter && onMouseEnter ? (event) => {
9832
+ const rowInfoDiscriminator = formattedValueContext;
9833
+ const rowContext = {
9834
+ ...rowInfoDiscriminator,
9835
+ rowIndex
9836
+ };
9837
+ onRowMouseEnter(rowContext, event);
9838
+ onMouseEnter(event);
9839
+ } : onMouseEnter;
9840
+ const handleMouseLeave = onRowMouseLeave && onMouseLeave ? (event) => {
9841
+ const rowContext = {
9842
+ ...formattedValueContext,
9843
+ rowIndex,
9844
+ rowInfo
9845
+ };
9846
+ onRowMouseLeave(rowContext, event);
9847
+ onMouseLeave(event);
9848
+ } : onMouseLeave;
9792
9849
  const onClick = (0, import_react24.useCallback)(
9793
9850
  (event) => {
9794
9851
  const colIndex = column.computedVisibleIndex;
@@ -10142,8 +10199,8 @@ function InfiniteTableColumnCellFn(props) {
10142
10199
  rowId: rowInfo.id,
10143
10200
  horizontalLayoutPageIndex,
10144
10201
  style: memoizedStyle,
10145
- onMouseLeave,
10146
- onMouseEnter,
10202
+ onMouseLeave: handleMouseLeave,
10203
+ onMouseEnter: handleMouseEnter,
10147
10204
  onClick,
10148
10205
  afterChildren,
10149
10206
  onMouseDown,
@@ -11543,6 +11600,18 @@ function InfiniteTableHeaderFn(props) {
11543
11600
  } = useInfiniteTable();
11544
11601
  const { computedColumnsMap } = computed;
11545
11602
  const domRef = (0, import_react31.useRef)(null);
11603
+ const updateDOMTransform = (0, import_react31.useCallback)((scrollPosition) => {
11604
+ if (domRef.current) {
11605
+ domRef.current.style.transform = `translate3d(-${scrollPosition.scrollLeft}px, 0px, 0px)`;
11606
+ }
11607
+ }, []);
11608
+ (0, import_react31.useEffect)(() => {
11609
+ const removeOnScroll = headerBrain.onScroll(updateDOMTransform);
11610
+ updateDOMTransform(
11611
+ headerBrain.getScrollPosition() || { scrollLeft: 0, scrollTop: 0 }
11612
+ );
11613
+ return removeOnScroll;
11614
+ }, [headerBrain]);
11546
11615
  const domProps = {
11547
11616
  ref: domRef,
11548
11617
  className: join(
@@ -13835,7 +13904,6 @@ var RowSelectionState = class {
13835
13904
  };
13836
13905
 
13837
13906
  // src/components/DataSource/CellSelectionState.ts
13838
- var debug3 = dbg("CellSelectionState");
13839
13907
  var WILDCARD = "*";
13840
13908
  var CellSelectionState = class {
13841
13909
  constructor(clone) {
@@ -13846,6 +13914,7 @@ var CellSelectionState = class {
13846
13914
  this.deselectedRowsToColumns = /* @__PURE__ */ new Map();
13847
13915
  this.deselectedColumnsToRows = /* @__PURE__ */ new Map();
13848
13916
  this.defaultSelection = false;
13917
+ this.debugId = "";
13849
13918
  this.deselectAll = () => {
13850
13919
  this.update({
13851
13920
  defaultSelection: false,
@@ -14091,12 +14160,17 @@ var CellSelectionState = class {
14091
14160
  }
14092
14161
  return false;
14093
14162
  }
14163
+ // private debug(message: string) {
14164
+ // const debug = dbg(`${this.debugId}:CellSelectionState`);
14165
+ // debug(message);
14166
+ // }
14167
+ error(message) {
14168
+ const error4 = err(`${this.debugId}:CellSelectionState`);
14169
+ error4(message);
14170
+ }
14094
14171
  isCellSelected(rowId, colId) {
14095
14172
  if (rowId === this.wildcard || colId === this.wildcard) {
14096
- console.error(
14097
- `CellSelectionState.isCellSelected should not be called with wildcard`
14098
- );
14099
- debug3(
14173
+ this.error(
14100
14174
  `CellSelectionState.isCellSelected should not be called with wildcard`
14101
14175
  );
14102
14176
  return false;
@@ -14179,6 +14253,7 @@ var CellSelectionState = class {
14179
14253
 
14180
14254
  // src/utils/logger.ts
14181
14255
  var log = debug("InfiniteTable");
14256
+ var COLOR_ERROR_VALUE = `#dc3545`;
14182
14257
  var COLOR_WARN_VALUE = `#eb9316`;
14183
14258
  var warnChannel = "Warn";
14184
14259
  var errorChannel = "Error";
@@ -14191,9 +14266,18 @@ var warnLogger = logger.extend(warnChannel);
14191
14266
  var errorLogger = logger.extend(errorChannel);
14192
14267
  var successLogger = logger.extend(successChannel);
14193
14268
  var logColorWarn = COLOR_WARN_VALUE;
14194
- var warn = (message, logger3) => {
14195
- logger3 = logger3 ? logger3.extend(warnChannel) : warnLogger;
14196
- logger3(log.color(logColorWarn, message));
14269
+ var logColorError = COLOR_ERROR_VALUE;
14270
+ var warn = (message, logger2) => {
14271
+ logger2 = logger2 ? logger2.extend ? logger2.extend(warnChannel) : logger2 : warnLogger;
14272
+ logger2(
14273
+ typeof logger2.color === "function" ? logger2.color(logColorWarn, message) : message
14274
+ );
14275
+ };
14276
+ var error2 = (message, logger2) => {
14277
+ logger2 = logger2 ? logger2.extend ? logger2.extend(errorChannel) : logger2 : errorLogger;
14278
+ logger2(
14279
+ typeof logger2.color === "function" ? logger2.color(logColorError, message) : message
14280
+ );
14197
14281
  };
14198
14282
  var doOnceFlags = new DeepMap();
14199
14283
  var doOnce = (func, ...keys) => {
@@ -14203,8 +14287,11 @@ var doOnce = (func, ...keys) => {
14203
14287
  doOnceFlags.set(keys, true);
14204
14288
  func();
14205
14289
  };
14206
- var warnOnce = (message, key = message, logger3) => {
14207
- doOnce(() => warn(message, logger3), key, "warn");
14290
+ var warnOnce = (message, key = message, logger2) => {
14291
+ doOnce(() => warn(message, logger2), key, "warn");
14292
+ };
14293
+ var errorOnce = (message, key = message, logger2) => {
14294
+ doOnce(() => error2(message, logger2), key, "error");
14208
14295
  };
14209
14296
 
14210
14297
  // src/components/InfiniteTable/api/getRowSelectionApi.ts
@@ -16108,12 +16195,12 @@ var DataSourceApiImpl = class {
16108
16195
  }
16109
16196
  return this.waitForNodePath(nodePath, { timeout }).then((okay) => {
16110
16197
  if (!okay) {
16111
- const error2 = `Cannot find node path "${nodePath.join(
16198
+ const error4 = `Cannot find node path "${nodePath.join(
16112
16199
  "/"
16113
16200
  )}" (we waited for it ${timeout}ms)`;
16114
- console.error(error2);
16201
+ console.error(error4);
16115
16202
  return fn({
16116
- error: error2,
16203
+ error: error4,
16117
16204
  resolved: false
16118
16205
  });
16119
16206
  }
@@ -16130,8 +16217,8 @@ var DataSourceApiImpl = class {
16130
16217
  this.updateChildrenByNodePath = (childrenOrFn, nodePath, options) => {
16131
16218
  return this.withWaitForNode(
16132
16219
  nodePath,
16133
- ({ error: error2 }) => {
16134
- if (error2) {
16220
+ ({ error: error4 }) => {
16221
+ if (error4) {
16135
16222
  return false;
16136
16223
  }
16137
16224
  return this.updateChildrenByNodePath_Internal(
@@ -16159,8 +16246,8 @@ var DataSourceApiImpl = class {
16159
16246
  if (!this.isNodePathAvailable(nodePath)) {
16160
16247
  return this.withWaitForNode(
16161
16248
  nodePath,
16162
- ({ error: error2 }) => {
16163
- if (error2) {
16249
+ ({ error: error4 }) => {
16250
+ if (error4) {
16164
16251
  return false;
16165
16252
  }
16166
16253
  return this.updateDataArrayByNodePath_Internal(
@@ -16193,7 +16280,7 @@ var DataSourceApiImpl = class {
16193
16280
  const allNodePaths = updateInfo.map((info) => info.nodePath);
16194
16281
  const promiseWithAll = Promise.allSettled(
16195
16282
  allNodePaths.map((nodePath) => {
16196
- return this.withWaitForNode(nodePath, ({ error: error2 }) => !error2, options);
16283
+ return this.withWaitForNode(nodePath, ({ error: error4 }) => !error4, options);
16197
16284
  })
16198
16285
  );
16199
16286
  return promiseWithAll.then((allGood) => {
@@ -16312,8 +16399,8 @@ var DataSourceApiImpl = class {
16312
16399
  if (isTree && nodePath?.length) {
16313
16400
  return this.withWaitForNode(
16314
16401
  nodePath,
16315
- ({ error: error2 }) => {
16316
- if (error2) {
16402
+ ({ error: error4 }) => {
16403
+ if (error4) {
16317
16404
  return false;
16318
16405
  }
16319
16406
  if (options.position === "before" || options.position === "after") {
@@ -16376,8 +16463,8 @@ var DataSourceApiImpl = class {
16376
16463
  if (nodePath.length && !this.isNodePathAvailable(nodePath)) {
16377
16464
  return this.withWaitForNode(
16378
16465
  nodePath,
16379
- ({ error: error2 }) => {
16380
- if (error2) {
16466
+ ({ error: error4 }) => {
16467
+ if (error4) {
16381
16468
  return false;
16382
16469
  }
16383
16470
  const result2 = this.batchOperation({
@@ -16416,6 +16503,9 @@ var DataSourceApiImpl = class {
16416
16503
  this.actions.sortInfo = sortInfo;
16417
16504
  return;
16418
16505
  };
16506
+ this.setGroupBy = (groupBy) => {
16507
+ this.actions.groupBy = groupBy;
16508
+ };
16419
16509
  this.isRowDisabledAt = (rowIndex) => {
16420
16510
  const rowInfo = this.getRowInfoByIndex(rowIndex);
16421
16511
  return rowInfo?.rowDisabled ?? false;
@@ -17162,20 +17252,31 @@ function concludeReducer(params) {
17162
17252
  }
17163
17253
  if (shouldFilterClientSide) {
17164
17254
  state.unfilteredCount = dataArray.length;
17165
- dataArray = shouldFilterAgain ? filterDataSource({
17166
- // tree-related stuff
17167
- getNodeChildren,
17168
- isLeafNode,
17169
- nodesKey,
17170
- treeFilterFunction,
17171
- // ---
17172
- dataArray,
17173
- toPrimaryKey,
17174
- filterTypes,
17175
- operatorsByFilterType,
17176
- filterFunction,
17177
- filterValue
17178
- }) : state.lastFilterDataArray;
17255
+ let filterTimestamp = now;
17256
+ if (shouldFilterAgain) {
17257
+ if (state.devToolsDetected) {
17258
+ filterTimestamp = Date.now();
17259
+ }
17260
+ dataArray = filterDataSource({
17261
+ // tree-related stuff
17262
+ getNodeChildren,
17263
+ isLeafNode,
17264
+ nodesKey,
17265
+ treeFilterFunction,
17266
+ // ---
17267
+ dataArray,
17268
+ toPrimaryKey,
17269
+ filterTypes,
17270
+ operatorsByFilterType,
17271
+ filterFunction,
17272
+ filterValue
17273
+ });
17274
+ if (state.devToolsDetected) {
17275
+ state.debugTimings.set("filter", Date.now() - filterTimestamp);
17276
+ }
17277
+ } else {
17278
+ dataArray = state.lastFilterDataArray;
17279
+ }
17179
17280
  state.lastFilterDataArray = dataArray;
17180
17281
  state.filteredAt = now;
17181
17282
  }
@@ -17185,6 +17286,10 @@ function concludeReducer(params) {
17185
17286
  const prevKnownTypes = multisort.knownTypes;
17186
17287
  multisort.knownTypes = { ...prevKnownTypes, ...state.sortTypes };
17187
17288
  if (shouldSortAgain) {
17289
+ let sortTimestamp = now;
17290
+ if (state.devToolsDetected) {
17291
+ sortTimestamp = Date.now();
17292
+ }
17188
17293
  if (state.sortFunction) {
17189
17294
  dataArray = state.sortFunction(sortInfo, [...dataArray]);
17190
17295
  } else {
@@ -17200,6 +17305,10 @@ function concludeReducer(params) {
17200
17305
  dataArray = multisort(sortInfo, [...dataArray]);
17201
17306
  }
17202
17307
  }
17308
+ if (state.devToolsDetected) {
17309
+ const sortDuration = Date.now() - sortTimestamp;
17310
+ state.debugTimings.set("sort", sortDuration);
17311
+ }
17203
17312
  } else {
17204
17313
  dataArray = state.lastSortDataArray;
17205
17314
  }
@@ -17246,6 +17355,10 @@ function concludeReducer(params) {
17246
17355
  const rowInfoReducers = state.rowInfoReducers;
17247
17356
  if (shouldGroup) {
17248
17357
  if (shouldGroupAgain) {
17358
+ let groupTimestamp = now;
17359
+ if (state.devToolsDetected) {
17360
+ groupTimestamp = Date.now();
17361
+ }
17249
17362
  let aggregationReducers = state.aggregationReducers;
17250
17363
  const groupResult = state.lazyLoad ? lazyGroup(
17251
17364
  {
@@ -17328,6 +17441,9 @@ function concludeReducer(params) {
17328
17441
  }) : void 0;
17329
17442
  state.pivotColumns = pivotGroupsAndCols?.columns;
17330
17443
  state.pivotColumnGroups = pivotGroupsAndCols?.columnGroups;
17444
+ if (state.devToolsDetected) {
17445
+ state.debugTimings.set("group-and-pivot", Date.now() - groupTimestamp);
17446
+ }
17331
17447
  } else {
17332
17448
  rowInfoDataArray = state.lastGroupDataArray;
17333
17449
  }
@@ -17335,6 +17451,10 @@ function concludeReducer(params) {
17335
17451
  state.groupedAt = now;
17336
17452
  } else if (shouldTree) {
17337
17453
  if (shouldTreeAgain) {
17454
+ let treeTimestamp = now;
17455
+ if (state.devToolsDetected) {
17456
+ treeTimestamp = Date.now();
17457
+ }
17338
17458
  let aggregationReducers = state.aggregationReducers;
17339
17459
  const treeParams = {
17340
17460
  isLeafNode,
@@ -17404,6 +17524,9 @@ function concludeReducer(params) {
17404
17524
  state.reducerResults = treeResult.reducerResults;
17405
17525
  state.totalLeafNodesCount = treeResult.deepMap.get([])?.totalLeafNodesCount ?? 0;
17406
17526
  state.treeAt = now;
17527
+ if (state.devToolsDetected) {
17528
+ state.debugTimings.set("tree", Date.now() - treeTimestamp);
17529
+ }
17407
17530
  } else {
17408
17531
  rowInfoDataArray = state.lastTreeDataArray;
17409
17532
  }
@@ -17501,6 +17624,155 @@ function getChangeDetect() {
17501
17624
  return `${Date.now()}:${perfNow}`;
17502
17625
  }
17503
17626
 
17627
+ // src/components/InfiniteTable/errorCodes.ts
17628
+ function buildErrorPayload(code, message, type) {
17629
+ message = message.replaceAll("$ERR_CODE", code);
17630
+ message = `${message}
17631
+
17632
+ ERROR_CODE = ${code}
17633
+
17634
+ See http://infinite-table.com/docs/reference/error-codes#${code} for more info.`;
17635
+ return {
17636
+ code,
17637
+ message,
17638
+ type: type ?? "error"
17639
+ };
17640
+ }
17641
+ function buildErrors(errors) {
17642
+ return Object.entries(errors).reduce((acc, [key, message]) => {
17643
+ const code = key;
17644
+ const payload = buildErrorPayload(
17645
+ code,
17646
+ typeof message === "string" ? message : message.message,
17647
+ typeof message === "string" ? void 0 : message.type
17648
+ );
17649
+ acc[code] = payload;
17650
+ return acc;
17651
+ }, {});
17652
+ }
17653
+ function warn2(strings) {
17654
+ return {
17655
+ message: strings.join(""),
17656
+ type: "warning"
17657
+ };
17658
+ }
17659
+ function error3(strings) {
17660
+ return {
17661
+ message: strings.join(""),
17662
+ type: "error"
17663
+ };
17664
+ }
17665
+ var DS_ERROR_CODES = buildErrors({
17666
+ DS001: warn2`The "data" prop of your DataSource seems to be updating too frequently.
17667
+ Make sure you don't pass a new reference on every render.`
17668
+ });
17669
+ var INFINITE_ERROR_CODES = buildErrors({
17670
+ CSS001_CSS: error3`It appears you have not loaded the CSS file for InfiniteTable.
17671
+ In most environments, you should be able to fix this by adding the following line:
17672
+
17673
+ import '@infinite-table/infinite-react/index.css'
17674
+ `
17675
+ });
17676
+ var ERROR_CODES = {
17677
+ ...DS_ERROR_CODES,
17678
+ ...INFINITE_ERROR_CODES
17679
+ };
17680
+
17681
+ // src/DEV_TOOLS_OVERRIDES.ts
17682
+ var DEV_TOOLS_INFINITE_OVERRIDES = /* @__PURE__ */ new Map();
17683
+ var DEV_TOOLS_DATASOURCE_OVERRIDES = /* @__PURE__ */ new Map();
17684
+ var DEV_TOOLS_INFINITE_INITIALS = /* @__PURE__ */ new Map();
17685
+ var DEV_TOOLS_DATASOURCE_INITIALS = /* @__PURE__ */ new Map();
17686
+
17687
+ // src/utils/debugModeUtils.ts
17688
+ var INSTANCES = /* @__PURE__ */ new Map();
17689
+ var deleteInstanceFromDevTools = (debugId) => {
17690
+ INSTANCES.delete(debugId);
17691
+ DEV_TOOLS_INFINITE_INITIALS.delete(debugId);
17692
+ DEV_TOOLS_INFINITE_OVERRIDES.delete(debugId);
17693
+ DEV_TOOLS_DATASOURCE_INITIALS.delete(debugId);
17694
+ DEV_TOOLS_DATASOURCE_OVERRIDES.delete(debugId);
17695
+ };
17696
+ function setDevToolInfinitePropertyOverride(debugId, property, value) {
17697
+ const instance = INSTANCES.get(debugId);
17698
+ if (!instance) {
17699
+ return;
17700
+ }
17701
+ const initial = DEV_TOOLS_INFINITE_INITIALS.get(debugId);
17702
+ if (!initial || !Object.hasOwn(initial, property)) {
17703
+ DEV_TOOLS_INFINITE_INITIALS.set(debugId, {
17704
+ ...initial || {},
17705
+ [property]: instance.getState()[property]
17706
+ });
17707
+ }
17708
+ DEV_TOOLS_INFINITE_OVERRIDES.set(debugId, {
17709
+ ...DEV_TOOLS_INFINITE_OVERRIDES.get(debugId) || {},
17710
+ [property]: value
17711
+ });
17712
+ instance.actions[property] = value;
17713
+ }
17714
+ function setDevToolDataSourcePropertyOverride(debugId, property, value) {
17715
+ const instance = INSTANCES.get(debugId);
17716
+ if (!instance) {
17717
+ return;
17718
+ }
17719
+ const initial = DEV_TOOLS_DATASOURCE_INITIALS.get(debugId);
17720
+ if (!initial || !Object.hasOwn(initial, property)) {
17721
+ DEV_TOOLS_DATASOURCE_INITIALS.set(debugId, {
17722
+ ...initial || {},
17723
+ [property]: instance.getDataSourceState()[property]
17724
+ });
17725
+ }
17726
+ DEV_TOOLS_DATASOURCE_OVERRIDES.set(debugId, {
17727
+ ...DEV_TOOLS_DATASOURCE_OVERRIDES.get(debugId) || {},
17728
+ [property]: value
17729
+ });
17730
+ instance.dataSourceActions[property] = value;
17731
+ }
17732
+ var warnKnownErrorOnce = (error4) => {
17733
+ const logger2 = error4.type === "error" ? err(error4.debugId) : dbg(error4.debugId);
17734
+ const onceLogger = error4.type === "error" ? errorOnce : warnOnce;
17735
+ const onceKey = error4.debugId ? `${error4.code}-${error4.debugId}` : error4.code;
17736
+ let message = error4.message;
17737
+ if (error4.debugId) {
17738
+ message = `${message}
17739
+
17740
+ Component DEBUG_ID = "${error4.debugId}"`;
17741
+ }
17742
+ onceLogger(message, onceKey, logger2);
17743
+ };
17744
+ var logDevToolsWarning = (options) => {
17745
+ const { debugId, key } = options;
17746
+ const knownError = ERROR_CODES[key];
17747
+ if (!knownError) {
17748
+ return;
17749
+ }
17750
+ warnKnownErrorOnce({ ...knownError, debugId });
17751
+ if (debugId && key) {
17752
+ const instance = INSTANCES.get(debugId);
17753
+ if (instance && instance.getState().devToolsDetected && knownError) {
17754
+ instance.getState().debugWarnings.set(key, {
17755
+ ...knownError,
17756
+ debugId,
17757
+ status: "new"
17758
+ });
17759
+ updateDevToolsForInstance(debugId);
17760
+ }
17761
+ }
17762
+ };
17763
+ globalThis.logDevToolsWarning = logDevToolsWarning;
17764
+ var updateDevToolsForInstance = (debugId) => {
17765
+ const hookFn = window.__INFINITE_TABLE_DEVTOOLS_HOOK__;
17766
+ if (!hookFn) {
17767
+ return;
17768
+ }
17769
+ const instance = INSTANCES.get(debugId);
17770
+ if (!instance) {
17771
+ return;
17772
+ }
17773
+ hookFn(debugId, instance);
17774
+ };
17775
+
17504
17776
  // src/components/DataSource/privateHooks/useLoadData.ts
17505
17777
  var CACHE_DEFAULT = true;
17506
17778
  var getRafPromise = () => new Promise((resolve) => {
@@ -17658,7 +17930,7 @@ function loadData(data, componentState, actions, overrides, masterContext) {
17658
17930
  const theKey = [LAZY_ROOT_KEY_FOR_GROUPS, ...keys];
17659
17931
  const dataArray2 = remoteData2.data;
17660
17932
  const newGroupRowInfo = {
17661
- cache: !!remoteData2.cache,
17933
+ cache: remoteData2.cache ?? CACHE_DEFAULT,
17662
17934
  childrenLoading: false,
17663
17935
  childrenAvailable: true,
17664
17936
  totalCount: remoteData2.totalCount ?? dataArray2.length,
@@ -17891,11 +18163,10 @@ function useLoadData(options) {
17891
18163
  timestamps.push(now);
17892
18164
  const timeDiff = now - timestamps[0];
17893
18165
  if (timeDiff < 200 && timestamps.length >= 10) {
17894
- console.warn(
17895
- `The "data" prop of your DataSource seems to be updating too frequently.
17896
- Make sure you don't pass a new reference on every render. ERROR_CODE = DS001
17897
- See http://infinite-table.com/docs/reference/error-codes#DS001 for more info.`
17898
- );
18166
+ logDevToolsWarning({
18167
+ debugId: componentState2.debugId,
18168
+ key: "DS001"
18169
+ });
17899
18170
  }
17900
18171
  if (typeof componentState2.data !== "function") {
17901
18172
  loadData(
@@ -18164,7 +18435,6 @@ var normalizeSortInfo = (initialSortInfo, weakMap3) => {
18164
18435
  };
18165
18436
 
18166
18437
  // src/components/DataSource/state/getInitialState.ts
18167
- var DataSourceLogger = dbg("DataSource");
18168
18438
  var defaultCursorId = Symbol("cursorId");
18169
18439
  var isNodeReadOnly = (rowInfo) => {
18170
18440
  return rowInfo.totalLeafNodesCount === 0;
@@ -18172,12 +18442,17 @@ var isNodeReadOnly = (rowInfo) => {
18172
18442
  var isNodeSelectable = (rowInfo) => {
18173
18443
  return rowInfo.isParentNode ? !isNodeReadOnly(rowInfo) : true;
18174
18444
  };
18175
- function initSetupState() {
18445
+ function initSetupState(props) {
18176
18446
  const now = Date.now();
18177
18447
  const originalDataArray = [];
18178
18448
  const dataArray = [];
18179
18449
  const originalLazyGroupData = new DeepMap();
18450
+ const DataSourceLogger = dbg(`${props.debugId}:DataSource`);
18180
18451
  return {
18452
+ logger: DataSourceLogger,
18453
+ debugTimings: /* @__PURE__ */ new Map(),
18454
+ debugWarnings: /* @__PURE__ */ new Map(),
18455
+ devToolsDetected: !!globalThis.__INFINITE_TABLE_DEVTOOLS_HOOK__,
18181
18456
  // TODO cleanup indexer on unmount
18182
18457
  indexer: new Indexer(),
18183
18458
  totalLeafNodesCount: 0,
@@ -18248,7 +18523,8 @@ function initSetupState() {
18248
18523
  postSortDataArray: void 0,
18249
18524
  postGroupDataArray: void 0,
18250
18525
  lastSortDataArray: void 0,
18251
- lastGroupDataArray: void 0
18526
+ lastGroupDataArray: void 0,
18527
+ forceRerenderTimestamp: 0
18252
18528
  };
18253
18529
  }
18254
18530
  function getCompareObjectForDataParams(dataParams) {
@@ -18284,13 +18560,11 @@ var forwardProps3 = (setupState, props) => {
18284
18560
  isNodeReadOnly: (isReadOnly) => isReadOnly ?? isNodeReadOnly,
18285
18561
  isNodeSelectable: (isSelectable) => isSelectable ?? isNodeSelectable,
18286
18562
  data: 1,
18287
- debugId: 1,
18288
18563
  nodesKey: 1,
18289
18564
  isNodeExpanded: 1,
18290
18565
  isNodeCollapsed: 1,
18291
18566
  pivotBy: 1,
18292
18567
  primaryKey: 1,
18293
- debugMode: 1,
18294
18568
  livePagination: 1,
18295
18569
  treeSelection: 1,
18296
18570
  refetchKey: (refetchKey) => refetchKey ?? "",
@@ -18313,7 +18587,7 @@ var forwardProps3 = (setupState, props) => {
18313
18587
  state.idToIndexMap.clear();
18314
18588
  },
18315
18589
  reducer: (_, rowInfo) => {
18316
- if (props.debugMode && !props.nodesKey && state.idToIndexMap.has(rowInfo.id)) {
18590
+ if (props.debugId && !props.nodesKey && state.idToIndexMap.has(rowInfo.id)) {
18317
18591
  console.warn(`Duplicate id found in data source: ${rowInfo.id}`);
18318
18592
  }
18319
18593
  state.idToIndexMap.set(rowInfo.id, rowInfo.indexInAll);
@@ -18334,7 +18608,7 @@ var forwardProps3 = (setupState, props) => {
18334
18608
  reducer: (_, rowInfo) => {
18335
18609
  if (rowInfo.isTreeNode) {
18336
18610
  state.idToPathMap.set(rowInfo.id, rowInfo.nodePath);
18337
- if (props.debugMode && state.pathToIndexMap.has(rowInfo.nodePath)) {
18611
+ if (props.debugId && state.pathToIndexMap.has(rowInfo.nodePath)) {
18338
18612
  console.warn(
18339
18613
  `Duplicate node path found in data source (debugId: ${props.debugId || "none"}): ${rowInfo.nodePath}`
18340
18614
  );
@@ -18564,21 +18838,21 @@ function deriveStateFromProps(params) {
18564
18838
  warnOnce(
18565
18839
  `"groupMode" prop is deprecated for the <DataSource />, use "shouldReloadData.groupBy: true|false" instead`,
18566
18840
  "groupMode deprecated",
18567
- DataSourceLogger
18841
+ state.logger
18568
18842
  );
18569
18843
  }
18570
18844
  if (props.sortMode) {
18571
18845
  warnOnce(
18572
18846
  `"sortMode" prop is deprecated for the <DataSource />, use "shouldReloadData.sortInfo: true|false" instead`,
18573
18847
  "sortMode deprecated",
18574
- DataSourceLogger
18848
+ state.logger
18575
18849
  );
18576
18850
  }
18577
18851
  if (props.filterMode) {
18578
18852
  warnOnce(
18579
18853
  `"filterMode" prop is deprecated for the <DataSource />, use "shouldReloadData.filterValue: true|false" instead`,
18580
18854
  "filterMode deprecated",
18581
- DataSourceLogger
18855
+ state.logger
18582
18856
  );
18583
18857
  }
18584
18858
  const groupMode = typeof props.data === "function" ? propsGroupMode ?? "local" : "local";
@@ -18598,7 +18872,8 @@ function deriveStateFromProps(params) {
18598
18872
  weakMap.set(rowDisabledState, isRowDisabled);
18599
18873
  }
18600
18874
  }
18601
- const result = {
18875
+ let result = {
18876
+ debugId: state.debugId ?? props.debugId,
18602
18877
  isTree,
18603
18878
  selectionMode,
18604
18879
  groupRowsState,
@@ -18638,6 +18913,17 @@ function deriveStateFromProps(params) {
18638
18913
  const livePaginationCursor = typeof props.livePaginationCursor === "function" ? dataArrayChanged ? getLivePaginationCursorValue(props.livePaginationCursor, state) : state.livePaginationCursor : props.livePaginationCursor;
18639
18914
  result.livePaginationCursor = livePaginationCursor;
18640
18915
  }
18916
+ if (state.devToolsDetected && state.debugId) {
18917
+ const devToolsDataSourceOverrides = DEV_TOOLS_DATASOURCE_OVERRIDES.get(
18918
+ state.debugId
18919
+ );
18920
+ if (devToolsDataSourceOverrides) {
18921
+ result = {
18922
+ ...result,
18923
+ ...devToolsDataSourceOverrides
18924
+ };
18925
+ }
18926
+ }
18641
18927
  return result;
18642
18928
  }
18643
18929
  var debugFullLazyLoad = dbg("DataSource:fullLazyLoad");
@@ -18655,7 +18941,6 @@ function onPropChange(params, props, actions) {
18655
18941
  }
18656
18942
  }
18657
18943
  }
18658
- var debugDataParams = dbg("DataSource:dataParams");
18659
18944
  function getMappedCallbacks() {
18660
18945
  return {
18661
18946
  rowSelection: (rowSelection, state) => {
@@ -18831,6 +19116,9 @@ function getInterceptActions() {
18831
19116
  )) {
18832
19117
  return false;
18833
19118
  }
19119
+ const debugDataParams = dbg(
19120
+ getDebugChannel(state.debugId, "DataSource:dataParams")
19121
+ );
18834
19122
  debugDataParams(
18835
19123
  "onDataParamsChange triggered because the following values have changed",
18836
19124
  dataParams?.changes
@@ -19312,6 +19600,7 @@ var InfiniteTableCellSelectionApiImpl = class {
19312
19600
  return;
19313
19601
  }
19314
19602
  const newCellSelection = new CellSelectionState(cellSelection);
19603
+ newCellSelection.debugId = dataSourceState.debugId ?? "";
19315
19604
  const [startRowId, startColId] = this.getCellSelectionPosition(startOptions);
19316
19605
  const [endRowId, endColId] = this.getCellSelectionPosition(endOptions);
19317
19606
  const startCol = this.getComputed().computedVisibleColumnsMap.get(startColId);
@@ -19403,6 +19692,7 @@ var InfiniteTableCellSelectionApiImpl = class {
19403
19692
  return;
19404
19693
  }
19405
19694
  const newCellSelection = new CellSelectionState(cellSelection);
19695
+ newCellSelection.debugId = dataSourceState.debugId ?? "";
19406
19696
  newCellSelection.deselectAll();
19407
19697
  this.dataSourceActions.cellSelection = newCellSelection;
19408
19698
  };
@@ -19416,6 +19706,7 @@ var InfiniteTableCellSelectionApiImpl = class {
19416
19706
  return;
19417
19707
  }
19418
19708
  const newCellSelection = new CellSelectionState(cellSelection);
19709
+ newCellSelection.debugId = dataSourceState.debugId ?? "";
19419
19710
  newCellSelection.selectAll();
19420
19711
  this.dataSourceActions.cellSelection = newCellSelection;
19421
19712
  };
@@ -19430,22 +19721,26 @@ var InfiniteTableCellSelectionApiImpl = class {
19430
19721
  return this.getDataSourceState().cellSelection?.isCellSelected(pk, colId) ?? false;
19431
19722
  };
19432
19723
  this.selectCell = (options) => {
19433
- const cellSelection = this.getDataSourceState().cellSelection;
19724
+ const dataSourceState = this.getDataSourceState();
19725
+ const cellSelection = dataSourceState.cellSelection;
19434
19726
  if (!cellSelection) {
19435
19727
  return;
19436
19728
  }
19437
19729
  const [pk, colId] = this.getCellSelectionPosition(options);
19438
19730
  const newCellSelection = options.clear ? new CellSelectionState() : new CellSelectionState(cellSelection);
19731
+ newCellSelection.debugId = dataSourceState.debugId ?? "";
19439
19732
  newCellSelection.selectCell(pk, colId);
19440
19733
  this.dataSourceActions.cellSelection = newCellSelection;
19441
19734
  };
19442
19735
  this.deselectCell = (options) => {
19443
- const cellSelection = this.getDataSourceState().cellSelection;
19736
+ const dataSourceState = this.getDataSourceState();
19737
+ const cellSelection = dataSourceState.cellSelection;
19444
19738
  if (!cellSelection) {
19445
19739
  return;
19446
19740
  }
19447
19741
  const [pk, colId] = this.getCellSelectionPosition(options);
19448
19742
  const newCellSelection = new CellSelectionState(cellSelection);
19743
+ newCellSelection.debugId = dataSourceState.debugId ?? "";
19449
19744
  newCellSelection.deselectCell(pk, colId);
19450
19745
  this.dataSourceActions.cellSelection = newCellSelection;
19451
19746
  };
@@ -19453,20 +19748,24 @@ var InfiniteTableCellSelectionApiImpl = class {
19453
19748
  if (options?.clear) {
19454
19749
  this.deselectAll();
19455
19750
  }
19456
- const cellSelection = this.getDataSourceState().cellSelection;
19751
+ const dataSourceState = this.getDataSourceState();
19752
+ const cellSelection = dataSourceState.cellSelection;
19457
19753
  if (!cellSelection) {
19458
19754
  return;
19459
19755
  }
19460
19756
  const newCellSelection = new CellSelectionState(cellSelection);
19757
+ newCellSelection.debugId = dataSourceState.debugId ?? "";
19461
19758
  newCellSelection.selectColumn(colId);
19462
19759
  this.dataSourceActions.cellSelection = newCellSelection;
19463
19760
  };
19464
19761
  this.deselectColumn = (colId) => {
19465
- const cellSelection = this.getDataSourceState().cellSelection;
19762
+ const dataSourceState = this.getDataSourceState();
19763
+ const cellSelection = dataSourceState.cellSelection;
19466
19764
  if (!cellSelection) {
19467
19765
  return;
19468
19766
  }
19469
19767
  const newCellSelection = new CellSelectionState(cellSelection);
19768
+ newCellSelection.debugId = dataSourceState.debugId ?? "";
19470
19769
  newCellSelection.deselectColumn(colId);
19471
19770
  this.dataSourceActions.cellSelection = newCellSelection;
19472
19771
  };
@@ -19964,6 +20263,9 @@ var InfiniteTableApiImpl = class {
19964
20263
  this.hideFilterOperatorMenu = () => {
19965
20264
  this.actions.filterOperatorMenuVisibleForColumnId = null;
19966
20265
  };
20266
+ this.setGroupRenderStrategy = (groupRenderStrategy) => {
20267
+ this.actions.groupRenderStrategy = groupRenderStrategy;
20268
+ };
19967
20269
  this.getColumnOrder = () => {
19968
20270
  return this.getComputed().computedColumnOrder;
19969
20271
  };
@@ -21235,6 +21537,8 @@ function useCellRendering(param) {
21235
21537
  const {
21236
21538
  rowHeight,
21237
21539
  rowDetailHeight,
21540
+ onRowMouseEnter,
21541
+ onRowMouseLeave,
21238
21542
  groupRenderStrategy,
21239
21543
  brain,
21240
21544
  showZebraRows,
@@ -21376,6 +21680,8 @@ function useCellRendering(param) {
21376
21680
  rowDetailState,
21377
21681
  onMouseEnter,
21378
21682
  onMouseLeave,
21683
+ onRowMouseEnter,
21684
+ onRowMouseLeave,
21379
21685
  domRef,
21380
21686
  width,
21381
21687
  column,
@@ -21391,6 +21697,8 @@ function useCellRendering(param) {
21391
21697
  [
21392
21698
  rowHeight,
21393
21699
  rowDetailHeight,
21700
+ onRowMouseEnter,
21701
+ onRowMouseLeave,
21394
21702
  computedRowSizeCacheForDetails,
21395
21703
  computedRowHeight,
21396
21704
  isRowDetailsExpanded,
@@ -21709,13 +22017,13 @@ function useColumnRowspan(computedVisibleColumns) {
21709
22017
 
21710
22018
  // src/components/InfiniteTable/hooks/useColumnSizeFn.ts
21711
22019
  var import_react41 = require("react");
21712
- var debug4 = dbg("useColumnSizeFn");
22020
+ var debug3 = dbg("useColumnSizeFn");
21713
22021
  function useColumnSizeFn(columns) {
21714
22022
  const columnSize = (0, import_react41.useCallback)(
21715
22023
  (index) => {
21716
22024
  const column = columns[index];
21717
22025
  if (false) {
21718
- debug4("cannot find column at index", index, columns);
22026
+ debug3("cannot find column at index", index, columns);
21719
22027
  }
21720
22028
  return column ? column.computedWidth : 0;
21721
22029
  },
@@ -21807,7 +22115,7 @@ function getRowDetailRendererFromComponent(RowDetail) {
21807
22115
  // src/components/VirtualBrain/HorizontalLayoutMatrixBrain.ts
21808
22116
  var HorizontalLayoutMatrixBrain = class extends MatrixBrain {
21809
22117
  constructor(name, opts) {
21810
- super(`HorizontalLayout${name ? `:${name}` : ""}`);
22118
+ super(`${name}:HorizontalLayout`);
21811
22119
  this.visiblePageCount = 0;
21812
22120
  this.isHorizontalLayoutBrain = true;
21813
22121
  this._totalPageCount = 0;
@@ -22086,10 +22394,11 @@ function getCellSelector(cellPosition) {
22086
22394
  return selector2;
22087
22395
  }
22088
22396
  function createBrains(debugId, wrapRowsHorizontally) {
22089
- const brain = !wrapRowsHorizontally ? new MatrixBrain(debugId) : new HorizontalLayoutMatrixBrain(debugId, {
22397
+ const debugChannel = getDebugChannel(debugId);
22398
+ const brain = !wrapRowsHorizontally ? new MatrixBrain(debugChannel) : new HorizontalLayoutMatrixBrain(debugChannel, {
22090
22399
  isHeader: false
22091
22400
  });
22092
- const headerBrain = !wrapRowsHorizontally ? new MatrixBrain("header") : new HorizontalLayoutMatrixBrain("header", {
22401
+ const headerBrain = !wrapRowsHorizontally ? new MatrixBrain(debugChannel) : new HorizontalLayoutMatrixBrain(debugChannel, {
22093
22402
  isHeader: true,
22094
22403
  masterBrain: brain
22095
22404
  });
@@ -22120,8 +22429,10 @@ function initSetupState2({
22120
22429
  );
22121
22430
  const domRef = (0, import_react42.createRef)();
22122
22431
  return {
22432
+ debugWarnings: /* @__PURE__ */ new Map(),
22123
22433
  renderer,
22124
22434
  onRenderUpdater,
22435
+ devToolsDetected: !!globalThis.__INFINITE_TABLE_DEVTOOLS_HOOK__,
22125
22436
  propsCache: /* @__PURE__ */ new Map([]),
22126
22437
  lastRowToCollapseRef: { current: null },
22127
22438
  lastRowToExpandRef: { current: null },
@@ -22191,7 +22502,6 @@ var forwardProps4 = (_setupState) => {
22191
22502
  groupColumn: 1,
22192
22503
  onReady: 1,
22193
22504
  domProps: 1,
22194
- debugMode: 1,
22195
22505
  onKeyDown: 1,
22196
22506
  onCellClick: 1,
22197
22507
  onCellDoubleClick: 1,
@@ -22206,6 +22516,8 @@ var forwardProps4 = (_setupState) => {
22206
22516
  onContextMenu: 1,
22207
22517
  onCellContextMenu: 1,
22208
22518
  onRenderRangeChange: 1,
22519
+ onRowMouseEnter: 1,
22520
+ onRowMouseLeave: 1,
22209
22521
  onScrollToTop: 1,
22210
22522
  onScrollToBottom: 1,
22211
22523
  onScrollStop: 1,
@@ -22401,7 +22713,7 @@ var mapPropsToState = (params) => {
22401
22713
  }
22402
22714
  }
22403
22715
  const isRowDetailEnabled = !rowDetailRenderer ? false : props.isRowDetailEnabled || true;
22404
- return {
22716
+ let result = {
22405
22717
  isTree: parentState.isTree,
22406
22718
  rowDetailRenderer,
22407
22719
  rowDetailState,
@@ -22426,6 +22738,16 @@ var mapPropsToState = (params) => {
22426
22738
  rowDetailHeightCSSVar: typeof props.rowDetailHeight === "string" ? props.rowDetailHeight : "",
22427
22739
  columnHeaderHeightCSSVar: typeof props.columnHeaderHeight === "string" ? props.columnHeaderHeight || ThemeVars.components.Header.columnHeaderHeight : ""
22428
22740
  };
22741
+ if (state.devToolsDetected && state.debugId) {
22742
+ const devToolsOverrides = DEV_TOOLS_INFINITE_OVERRIDES.get(state.debugId);
22743
+ if (devToolsOverrides) {
22744
+ result = {
22745
+ ...result,
22746
+ ...devToolsOverrides
22747
+ };
22748
+ }
22749
+ }
22750
+ return result;
22429
22751
  };
22430
22752
 
22431
22753
  // src/components/InfiniteTable/state/getColumnVisibilityForHideEmptyGroupColumns.ts
@@ -23603,7 +23925,7 @@ var useLicense = (licenseKey = "") => {
23603
23925
  }
23604
23926
  let valid2 = isValidLicense(licenseKey, {
23605
23927
  publishedAt: 1624970570587,
23606
- version: "6.2.10"
23928
+ version: "7.0.0"
23607
23929
  });
23608
23930
  if (!licenseKey && !valid2 && isInsidePlayground) {
23609
23931
  return true;
@@ -23743,10 +24065,11 @@ function updateCellSelectionOnCellClick(context, event) {
23743
24065
  return;
23744
24066
  }
23745
24067
  const { multiCellSelector, computedVisibleColumns } = getComputed();
23746
- const { brain } = getState();
24068
+ const { brain, debugId } = getState();
23747
24069
  const { rowsPerPage } = brain;
23748
24070
  const columnsPerSet = computedVisibleColumns.length;
23749
24071
  const cellSelection = new CellSelectionState(existingCellSelection);
24072
+ cellSelection.debugId = debugId ?? "";
23750
24073
  multiCellSelector.cellSelectionState = cellSelection;
23751
24074
  const position2 = {
23752
24075
  rowIndex,
@@ -27165,37 +27488,414 @@ function useHorizontalLayout() {
27165
27488
  }
27166
27489
 
27167
27490
  // src/components/InfiniteTable/hooks/useDebugMode.ts
27168
- var React70 = __toESM(require("react"));
27169
- var logWarning = once(() => {
27170
- console.warn(
27171
- `It appears you have not loaded the CSS file for InfiniteTable.
27172
- In most environments, you should be able to fix this by adding the following line:
27491
+ var import_react66 = require("react");
27173
27492
 
27174
- import '@infinite-table/infinite-react/index.css'
27493
+ // src/components/InfiniteTable/hooks/debugModeDevToolsOverlay.css.ts
27494
+ var DevToolsOverlay = createRuntimeFn({ defaultClassName: "_143ofgf0", variantClassNames: { active: { true: "_143ofgf1", false: "_143ofgf2" } }, defaultVariants: {}, compoundVariants: [] });
27495
+ var DevToolsOverlayBg = "_143ofgf5";
27496
+ var DevToolsOverlayText = "_143ofgf3";
27175
27497
 
27176
- `
27177
- );
27178
- });
27498
+ // src/components/InfiniteTable/hooks/useDebugMode.ts
27179
27499
  var cssFileLoadedVarName = stripVar(ThemeVars.loaded);
27180
- function useDebugMode() {
27181
- const { getState } = useInfiniteTable();
27182
- React70.useEffect(() => {
27183
- runDebugMode(getState);
27184
- }, []);
27500
+ var messageBase = {
27501
+ source: "infinite-table-page",
27502
+ target: "infinite-table-devtools-background"
27503
+ };
27504
+ function buildMessageForExtension(params, options) {
27505
+ const { type, debugId } = params;
27506
+ if (type === "unmount") {
27507
+ return {
27508
+ ...messageBase,
27509
+ url: getPageUrlOfWindow(),
27510
+ type,
27511
+ payload: {
27512
+ debugId
27513
+ }
27514
+ };
27515
+ }
27516
+ const opts = options;
27517
+ const computedValues = opts.getComputed();
27518
+ const dataSourceState = opts.getDataSourceState();
27519
+ const state = opts.getState();
27520
+ const message = {
27521
+ ...messageBase,
27522
+ url: getPageUrlOfWindow(),
27523
+ type,
27524
+ payload: {
27525
+ debugId,
27526
+ columnVisibility: state.columnVisibility,
27527
+ columnOrder: computedValues.computedColumnOrder,
27528
+ visibleColumnIds: computedValues.computedVisibleColumns.map((c) => c.id),
27529
+ selectionMode: dataSourceState.selectionMode,
27530
+ columns: Object.fromEntries(
27531
+ computedValues.computedVisibleColumns.map((c) => [
27532
+ c.id,
27533
+ {
27534
+ field: c.field,
27535
+ dataType: c.computedDataType,
27536
+ sortType: c.computedSortType,
27537
+ filtered: c.computedFiltered,
27538
+ sorted: c.computedSorted,
27539
+ width: c.computedWidth
27540
+ }
27541
+ ])
27542
+ ),
27543
+ groupRenderStrategy: state.groupRenderStrategy,
27544
+ groupBy: dataSourceState.groupBy.map(
27545
+ (g) => g.field ? `${g.field}` : "<fn>"
27546
+ ),
27547
+ sortInfo: (dataSourceState.sortInfo || []).filter((sortInfo) => typeof sortInfo.field === "string").map((s) => {
27548
+ return {
27549
+ field: `${s.field}`,
27550
+ dir: s.dir,
27551
+ type: Array.isArray(s.type) ? s.type[0] : s.type ?? "string"
27552
+ };
27553
+ }),
27554
+ multiSort: dataSourceState.multiSort,
27555
+ devToolsDetected: state.devToolsDetected,
27556
+ debugTimings: Object.fromEntries(dataSourceState.debugTimings),
27557
+ debugWarnings: {
27558
+ ...Object.fromEntries(dataSourceState.debugWarnings),
27559
+ ...Object.fromEntries(state.debugWarnings)
27560
+ }
27561
+ }
27562
+ };
27563
+ return message;
27185
27564
  }
27186
- function runDebugMode(getState) {
27565
+ var getPageUrlOfWindow = once(function() {
27566
+ const url = new URL(window.location.href);
27567
+ return url.origin + url.pathname;
27568
+ });
27569
+ function postMessage(message) {
27570
+ window.postMessage(message);
27571
+ }
27572
+ var setupHook = once(() => {
27573
+ console.log("Infinite Table DevTools detected!");
27574
+ const hookFn = (debugId, options) => {
27575
+ if (options) {
27576
+ INSTANCES.set(debugId, options);
27577
+ const { devToolsDetected } = options.getState();
27578
+ if (!devToolsDetected) {
27579
+ options.actions.devToolsDetected = true;
27580
+ }
27581
+ const dataSourceState = options.getDataSourceState();
27582
+ if (dataSourceState.debugId !== debugId) {
27583
+ options.dataSourceActions.debugId = debugId;
27584
+ }
27585
+ if (!dataSourceState.devToolsDetected) {
27586
+ options.dataSourceActions.devToolsDetected = true;
27587
+ }
27588
+ window.postMessage(
27589
+ buildMessageForExtension({ type: "update", debugId }, options)
27590
+ );
27591
+ } else {
27592
+ deleteInstanceFromDevTools(debugId);
27593
+ window.postMessage(
27594
+ buildMessageForExtension({ type: "unmount", debugId }, null)
27595
+ );
27596
+ }
27597
+ };
27598
+ window.__INFINITE_TABLE_DEVTOOLS_HOOK__ = hookFn;
27599
+ debug.onLogIntent("*", (options) => {
27600
+ postMessage({
27601
+ ...messageBase,
27602
+ url: getPageUrlOfWindow(),
27603
+ type: "log",
27604
+ payload: {
27605
+ debugId: void 0,
27606
+ channel: options.channel,
27607
+ color: options.color,
27608
+ args: options.args.map((arg) => {
27609
+ if (typeof arg === "object" && arg !== null) {
27610
+ return JSON.stringify(arg);
27611
+ }
27612
+ return String(arg);
27613
+ }),
27614
+ timestamp: options.timestamp
27615
+ }
27616
+ });
27617
+ });
27618
+ return hookFn;
27619
+ });
27620
+ function useDebugMode() {
27621
+ const { getState, getDataSourceState, dataSourceActions } = useInfiniteTable();
27187
27622
  const state = getState();
27188
- const { debugMode, domRef } = state;
27189
- if (debugMode) {
27623
+ const { domRef, debugId } = state;
27624
+ if (debugId) {
27190
27625
  if (domRef.current) {
27191
27626
  const value = getComputedStyle(domRef.current).getPropertyValue(
27192
27627
  cssFileLoadedVarName
27193
27628
  );
27194
27629
  if (value !== `${CSS_LOADED_VALUE}`) {
27195
- logWarning();
27630
+ logDevToolsWarning({
27631
+ debugId,
27632
+ key: "CSS001_CSS"
27633
+ });
27196
27634
  }
27197
27635
  }
27198
27636
  }
27637
+ (0, import_react66.useEffect)(() => {
27638
+ const dataSourceState = getDataSourceState();
27639
+ if (dataSourceState.debugId !== debugId) {
27640
+ dataSourceActions.debugId = debugId;
27641
+ }
27642
+ }, [debugId]);
27643
+ return useDevTools();
27644
+ }
27645
+ var HOOK_FN_SETUP_CALLBACK = buildSubscriptionCallback();
27646
+ var DEVTOOLS_MESSAGES = {
27647
+ revertAll: (payload) => {
27648
+ const instance = INSTANCES.get(payload.debugId);
27649
+ if (instance) {
27650
+ const infiniteInitials = DEV_TOOLS_INFINITE_INITIALS.get(payload.debugId);
27651
+ DEV_TOOLS_INFINITE_INITIALS.delete(payload.debugId);
27652
+ DEV_TOOLS_INFINITE_OVERRIDES.delete(payload.debugId);
27653
+ if (infiniteInitials) {
27654
+ Object.keys(infiniteInitials).forEach((key) => {
27655
+ instance.actions[key] = infiniteInitials[key];
27656
+ delete infiniteInitials[key];
27657
+ });
27658
+ }
27659
+ const dataSourceInitials = DEV_TOOLS_DATASOURCE_INITIALS.get(
27660
+ payload.debugId
27661
+ );
27662
+ DEV_TOOLS_DATASOURCE_INITIALS.delete(payload.debugId);
27663
+ DEV_TOOLS_DATASOURCE_OVERRIDES.delete(payload.debugId);
27664
+ if (dataSourceInitials) {
27665
+ Object.keys(dataSourceInitials).forEach((key) => {
27666
+ instance.dataSourceActions[key] = dataSourceInitials[key];
27667
+ delete dataSourceInitials[key];
27668
+ });
27669
+ }
27670
+ }
27671
+ },
27672
+ revertProperty: (payload) => {
27673
+ const instance = INSTANCES.get(payload.debugId);
27674
+ if (instance) {
27675
+ const property = payload.property;
27676
+ const infiniteOverrides = DEV_TOOLS_INFINITE_OVERRIDES.get(
27677
+ payload.debugId
27678
+ );
27679
+ const infiniteInitials = DEV_TOOLS_INFINITE_INITIALS.get(payload.debugId);
27680
+ const dataSourceOverrides = DEV_TOOLS_DATASOURCE_OVERRIDES.get(
27681
+ payload.debugId
27682
+ );
27683
+ const dataSourceInitials = DEV_TOOLS_DATASOURCE_INITIALS.get(
27684
+ payload.debugId
27685
+ );
27686
+ const infiniteStateProp = property;
27687
+ if (infiniteInitials && infiniteOverrides && infiniteOverrides[infiniteStateProp] !== void 0) {
27688
+ delete infiniteOverrides[infiniteStateProp];
27689
+ instance.actions[infiniteStateProp] = infiniteInitials[infiniteStateProp];
27690
+ delete infiniteInitials[infiniteStateProp];
27691
+ }
27692
+ const dataSourceStateProp = property;
27693
+ if (dataSourceInitials && dataSourceOverrides && dataSourceOverrides[dataSourceStateProp] !== void 0) {
27694
+ const dataSourceInitials2 = DEV_TOOLS_DATASOURCE_INITIALS.get(payload.debugId) || {};
27695
+ delete dataSourceOverrides[dataSourceStateProp];
27696
+ instance.dataSourceActions[dataSourceStateProp] = dataSourceInitials2[dataSourceStateProp];
27697
+ delete dataSourceInitials2[dataSourceStateProp];
27698
+ }
27699
+ }
27700
+ },
27701
+ discardWarning: (payload) => {
27702
+ const instance = INSTANCES.get(payload.debugId);
27703
+ if (instance) {
27704
+ const dsWarningKey = payload.warning;
27705
+ const dsWarnings = instance.getDataSourceState().debugWarnings;
27706
+ const obj = dsWarnings.get(dsWarningKey);
27707
+ if (obj) {
27708
+ dsWarnings.delete(dsWarningKey);
27709
+ updateDevToolsForInstance(payload.debugId);
27710
+ } else {
27711
+ const itWarningKey = payload.warning;
27712
+ const infiniteWarnings = instance.getState().debugWarnings;
27713
+ const obj2 = infiniteWarnings.get(itWarningKey);
27714
+ if (obj2) {
27715
+ infiniteWarnings.delete(itWarningKey);
27716
+ updateDevToolsForInstance(payload.debugId);
27717
+ }
27718
+ }
27719
+ }
27720
+ },
27721
+ discardAllWarnings: (payload) => {
27722
+ const instance = INSTANCES.get(payload.debugId);
27723
+ if (instance) {
27724
+ instance.getDataSourceState().debugWarnings.clear();
27725
+ instance.getState().debugWarnings.clear();
27726
+ updateDevToolsForInstance(payload.debugId);
27727
+ }
27728
+ },
27729
+ setColumnVisibility: (payload) => {
27730
+ setDevToolInfinitePropertyOverride(
27731
+ payload.debugId,
27732
+ "columnVisibility",
27733
+ payload.columnVisibility
27734
+ );
27735
+ },
27736
+ setGroupBy: (payload) => {
27737
+ setDevToolDataSourcePropertyOverride(
27738
+ payload.debugId,
27739
+ "groupBy",
27740
+ payload.groupBy
27741
+ );
27742
+ },
27743
+ setGroupRenderStrategy: (payload) => {
27744
+ setDevToolInfinitePropertyOverride(
27745
+ payload.debugId,
27746
+ "groupRenderStrategy",
27747
+ payload.groupRenderStrategy
27748
+ );
27749
+ },
27750
+ setSortInfo: (payload) => {
27751
+ setDevToolDataSourcePropertyOverride(
27752
+ payload.debugId,
27753
+ "sortInfo",
27754
+ payload.sortInfo
27755
+ );
27756
+ },
27757
+ setMultiSort: (payload) => {
27758
+ setDevToolDataSourcePropertyOverride(
27759
+ payload.debugId,
27760
+ "multiSort",
27761
+ payload.multiSort
27762
+ );
27763
+ },
27764
+ highlight: (payload) => {
27765
+ const instance = INSTANCES.get(payload.debugId);
27766
+ if (instance) {
27767
+ const domNode = instance.getState().domRef.current;
27768
+ if (domNode) {
27769
+ const rect = domNode.getBoundingClientRect();
27770
+ let overlay = document.querySelector(
27771
+ `.${DevToolsOverlay.classNames.base}`
27772
+ );
27773
+ if (!overlay) {
27774
+ overlay = document.createElement("div");
27775
+ overlay.classList.add(DevToolsOverlay.classNames.base);
27776
+ overlay.innerHTML = [
27777
+ `<div class="${DevToolsOverlayText}"></div>`,
27778
+ `<div class="${DevToolsOverlayBg}"></div>`
27779
+ ].join("");
27780
+ document.body.appendChild(overlay);
27781
+ }
27782
+ let textDiv = overlay.firstElementChild;
27783
+ if (overlay) {
27784
+ overlay.style.left = `${rect.left}px`;
27785
+ overlay.style.top = `${rect.top}px`;
27786
+ overlay.style.width = `${rect.width}px`;
27787
+ overlay.style.height = `${rect.height}px`;
27788
+ textDiv.innerHTML = payload.debugId;
27789
+ const overlayBg = overlay.lastElementChild;
27790
+ const handleAnimationEnd = () => {
27791
+ overlay.classList.remove(
27792
+ DevToolsOverlay.classNames.variants.active.true
27793
+ );
27794
+ overlayBg.removeEventListener("animationend", handleAnimationEnd);
27795
+ };
27796
+ overlayBg.addEventListener("animationend", handleAnimationEnd);
27797
+ overlay.classList.add(
27798
+ DevToolsOverlay.classNames.variants.active.true
27799
+ );
27800
+ }
27801
+ }
27802
+ }
27803
+ }
27804
+ };
27805
+ function listenForDevTools() {
27806
+ if (typeof window !== "undefined") {
27807
+ window.addEventListener("message", (event) => {
27808
+ if (event.data.source.startsWith("infinite-table-devtools-contentscript") && event.data.target === "infinite-table-page") {
27809
+ if (!window.__INFINITE_TABLE_DEVTOOLS_HOOK__) {
27810
+ setupHook();
27811
+ HOOK_FN_SETUP_CALLBACK(
27812
+ window.__INFINITE_TABLE_DEVTOOLS_HOOK__
27813
+ );
27814
+ }
27815
+ if (typeof event.data.type === "string") {
27816
+ const eventType = event.data.type;
27817
+ const fn = DEVTOOLS_MESSAGES[eventType];
27818
+ if (fn) {
27819
+ fn(event.data.payload);
27820
+ }
27821
+ }
27822
+ }
27823
+ });
27824
+ }
27825
+ }
27826
+ listenForDevTools();
27827
+ function useDevTools() {
27828
+ const {
27829
+ getState,
27830
+ getComputed,
27831
+ getDataSourceState,
27832
+ dataSourceActions,
27833
+ actions,
27834
+ dataSourceApi,
27835
+ api
27836
+ } = useInfiniteTable();
27837
+ const state = getState();
27838
+ const debugId = state.debugId;
27839
+ const debugIdRef = (0, import_react66.useRef)(debugId);
27840
+ debugIdRef.current = debugId;
27841
+ (0, import_react66.useEffect)(() => {
27842
+ const debugId2 = debugIdRef.current;
27843
+ if (!debugId2) {
27844
+ return;
27845
+ }
27846
+ const withHookFn = (hookFn2) => {
27847
+ hookFn2(debugId2, {
27848
+ getState,
27849
+ getDataSourceState,
27850
+ getComputed,
27851
+ dataSourceActions,
27852
+ actions,
27853
+ api,
27854
+ dataSourceApi
27855
+ });
27856
+ };
27857
+ const hookFn = HOOK_FN_SETUP_CALLBACK.get();
27858
+ if (hookFn) {
27859
+ withHookFn(hookFn);
27860
+ return;
27861
+ }
27862
+ return HOOK_FN_SETUP_CALLBACK.onChange((hookFn2) => {
27863
+ if (!hookFn2) {
27864
+ return;
27865
+ }
27866
+ withHookFn(hookFn2);
27867
+ });
27868
+ }, []);
27869
+ (0, import_react66.useEffect)(() => {
27870
+ const debugId2 = debugIdRef.current;
27871
+ if (!debugId2) {
27872
+ return;
27873
+ }
27874
+ const hookFn = HOOK_FN_SETUP_CALLBACK.get();
27875
+ if (hookFn) {
27876
+ hookFn(debugId2, {
27877
+ getState,
27878
+ getDataSourceState,
27879
+ getComputed,
27880
+ dataSourceActions,
27881
+ actions,
27882
+ api,
27883
+ dataSourceApi
27884
+ });
27885
+ }
27886
+ });
27887
+ (0, import_react66.useEffect)(() => {
27888
+ if (!debugId) {
27889
+ return;
27890
+ }
27891
+ return () => {
27892
+ const devtoolsHookFn = globalThis.__INFINITE_TABLE_DEVTOOLS_HOOK__;
27893
+ if (devtoolsHookFn) {
27894
+ devtoolsHookFn(debugId, null);
27895
+ }
27896
+ };
27897
+ }, [debugId]);
27898
+ return debugId;
27199
27899
  }
27200
27900
 
27201
27901
  // src/components/InfiniteTable/hooks/useInfinitePortalContainer.ts
@@ -27228,14 +27928,16 @@ var { ManagedComponentContextProvider: InfiniteTableRoot } = buildManagedCompone
27228
27928
  mappedCallbacks: getMappedCallbacks2(),
27229
27929
  // @ts-ignore
27230
27930
  getParentState: () => useDataSourceState(),
27231
- debugName: DEBUG_NAME
27931
+ debugName: (props) => {
27932
+ return getDebugChannel(props.debugId, DEBUG_NAME);
27933
+ }
27232
27934
  });
27233
27935
  function InfiniteTableHeader2() {
27234
27936
  const context = useInfiniteTable();
27235
27937
  const { state: componentState, getComputed } = context;
27236
27938
  const { header, brain, headerBrain, wrapRowsHorizontally } = componentState;
27237
27939
  const { scrollbars } = getComputed();
27238
- return header ? /* @__PURE__ */ React71.createElement(
27940
+ return header ? /* @__PURE__ */ React70.createElement(
27239
27941
  TableHeaderWrapper,
27240
27942
  {
27241
27943
  wrapRowsHorizontally: !!wrapRowsHorizontally,
@@ -27252,7 +27954,7 @@ var InfiniteTableBodyCls = join(
27252
27954
  transformTranslateZero
27253
27955
  );
27254
27956
  function InfiniteTableBodyContainer(props) {
27255
- return /* @__PURE__ */ React71.createElement(
27957
+ return /* @__PURE__ */ React70.createElement(
27256
27958
  "div",
27257
27959
  {
27258
27960
  ...props,
@@ -27290,7 +27992,7 @@ function InfiniteTableBody() {
27290
27992
  const {
27291
27993
  componentState: { loading }
27292
27994
  } = useDataSourceContextValue();
27293
- const onContextMenu = React71.useCallback((event) => {
27995
+ const onContextMenu = React70.useCallback((event) => {
27294
27996
  const state = context.getState();
27295
27997
  const target = event.target;
27296
27998
  if (!masterContext && event._from_row_detail) {
@@ -27336,7 +28038,7 @@ function InfiniteTableBody() {
27336
28038
  });
27337
28039
  const { autoFocus, tabIndex } = domProps ?? {};
27338
28040
  useToggleWrapRowsHorizontally();
27339
- return /* @__PURE__ */ React71.createElement(InfiniteTableBodyContainer, { onContextMenu }, /* @__PURE__ */ React71.createElement(
28041
+ return /* @__PURE__ */ React70.createElement(InfiniteTableBodyContainer, { onContextMenu }, /* @__PURE__ */ React70.createElement(
27340
28042
  HeadlessTable,
27341
28043
  {
27342
28044
  forceRerenderTimestamp: componentState.forceBodyRerenderTimestamp,
@@ -27358,9 +28060,9 @@ function InfiniteTableBody() {
27358
28060
  scrollerDOMRef,
27359
28061
  scrollVarHostRef: domRef
27360
28062
  }
27361
- ), /* @__PURE__ */ React71.createElement(LoadMaskCmp, { visible: loading }, loadingText));
28063
+ ), /* @__PURE__ */ React70.createElement(LoadMaskCmp, { visible: loading }, loadingText));
27362
28064
  }
27363
- var InfiniteTableComponent = React71.memo(
28065
+ var InfiniteTableComponent = React70.memo(
27364
28066
  function InfiniteTableComponent2() {
27365
28067
  const context = useInfiniteTable();
27366
28068
  const masterContext = useMasterDetailContext();
@@ -27392,7 +28094,7 @@ var InfiniteTableComponent = React71.memo(
27392
28094
  useScrollToActiveRow(activeRowIndex, dataArray.length, api);
27393
28095
  useScrollToActiveCell(activeCellIndex, dataArray.length, api);
27394
28096
  const { onKeyDown: onKeyDown2 } = useDOMEventHandlers();
27395
- React71.useEffect(() => {
28097
+ React70.useEffect(() => {
27396
28098
  const dataSourceState = getDataSourceState();
27397
28099
  const onChange = debounce(
27398
28100
  (renderRange) => {
@@ -27415,7 +28117,7 @@ var InfiniteTableComponent = React71.memo(
27415
28117
  ...initialDOMProps
27416
28118
  } = componentState.domProps ?? {};
27417
28119
  const domProps = useDOMProps(initialDOMProps);
27418
- React71.useEffect(() => {
28120
+ React70.useEffect(() => {
27419
28121
  brain.setScrollStopDelay(scrollStopDelay);
27420
28122
  dataSourceActions.scrollStopDelayUpdatedByTable = scrollStopDelay;
27421
28123
  }, [scrollStopDelay]);
@@ -27426,7 +28128,7 @@ var InfiniteTableComponent = React71.memo(
27426
28128
  const { menuPortal: cellContextMenuPortal } = useCellContextMenu();
27427
28129
  const { menuPortal: tableContextMenuPortal } = useTableContextMenu();
27428
28130
  const { menuPortal: filterOperatorMenuPortal } = useColumnFilterOperatorMenu();
27429
- React71.useEffect(() => {
28131
+ React70.useEffect(() => {
27430
28132
  if (typeof globalThis.__DO_NOT_USE_UNLESS_YOU_KNOW_WHAT_YOURE_DOING_IS_READY === "function") {
27431
28133
  globalThis.__DO_NOT_USE_UNLESS_YOU_KNOW_WHAT_YOURE_DOING_IS_READY(
27432
28134
  componentState.id,
@@ -27439,59 +28141,75 @@ var InfiniteTableComponent = React71.memo(
27439
28141
  globalThis.infiniteApi = context.api;
27440
28142
  }
27441
28143
  }, [componentState.ready]);
27442
- useDebugMode();
27443
- React71.useEffect(() => {
28144
+ const debugId = useDebugMode();
28145
+ React70.useEffect(() => {
27444
28146
  if (masterContext) {
27445
28147
  portalDOMRef.current = masterContext.getMasterState().portalDOMRef.current;
27446
28148
  }
27447
28149
  }, []);
27448
- const children = initialChildren ?? /* @__PURE__ */ React71.createElement(React71.Fragment, null, /* @__PURE__ */ React71.createElement(InfiniteTableHeader2, null), /* @__PURE__ */ React71.createElement(InfiniteTableBody, null));
27449
- return /* @__PURE__ */ React71.createElement("div", { onKeyDown: onKeyDown2, ref: domRef, ...domProps }, children, /* @__PURE__ */ React71.createElement(
28150
+ const children = initialChildren ?? /* @__PURE__ */ React70.createElement(React70.Fragment, null, /* @__PURE__ */ React70.createElement(InfiniteTableHeader2, null), /* @__PURE__ */ React70.createElement(InfiniteTableBody, null));
28151
+ return /* @__PURE__ */ React70.createElement(
27450
28152
  "div",
27451
28153
  {
27452
- ref: portalDOMRef,
27453
- className: join(
27454
- `${rootClassName2}Portal`,
27455
- zIndex[1e7],
27456
- position.absolute,
27457
- top[0],
27458
- left[0]
27459
- )
28154
+ "data-debug-id": debugId,
28155
+ onKeyDown: onKeyDown2,
28156
+ ref: domRef,
28157
+ ...domProps
27460
28158
  },
27461
- menuPortal,
27462
- cellContextMenuPortal,
27463
- tableContextMenuPortal,
27464
- filterOperatorMenuPortal
27465
- ), rowHeightCSSVar ? /* @__PURE__ */ React71.createElement(
27466
- CSSNumericVariableWatch,
27467
- {
27468
- key: "row-height",
27469
- varName: rowHeightCSSVar,
27470
- onChange: onRowHeightCSSVarChange
27471
- }
27472
- ) : null, /* @__PURE__ */ React71.createElement(
27473
- CSSNumericVariableWatch,
27474
- {
27475
- key: "flashing-duration",
27476
- allowInts: true,
27477
- varName: ThemeVars.components.Cell.flashingDuration,
27478
- onChange: onFlashingDurationCSSVarChange
27479
- }
27480
- ), rowDetailHeightCSSVar ? /* @__PURE__ */ React71.createElement(
27481
- CSSNumericVariableWatch,
27482
- {
27483
- key: "row-detail-height",
27484
- varName: rowDetailHeightCSSVar,
27485
- onChange: onRowDetailHeightCSSVarChange
27486
- }
27487
- ) : null, columnHeaderHeightCSSVar ? /* @__PURE__ */ React71.createElement(
27488
- CSSNumericVariableWatch,
27489
- {
27490
- key: "column-header-height",
27491
- varName: columnHeaderHeightCSSVar,
27492
- onChange: onColumnHeaderHeightCSSVarChange
27493
- }
27494
- ) : null, licenseValid ? null : /* @__PURE__ */ React71.createElement(InfiniteTableLicenseFooter, null), /* @__PURE__ */ React71.createElement(FocusDetect, null));
28159
+ children,
28160
+ /* @__PURE__ */ React70.createElement(
28161
+ "div",
28162
+ {
28163
+ ref: portalDOMRef,
28164
+ className: join(
28165
+ `${rootClassName2}Portal`,
28166
+ zIndex[1e7],
28167
+ position.absolute,
28168
+ top[0],
28169
+ left[0]
28170
+ )
28171
+ },
28172
+ menuPortal,
28173
+ cellContextMenuPortal,
28174
+ tableContextMenuPortal,
28175
+ filterOperatorMenuPortal
28176
+ ),
28177
+ rowHeightCSSVar ? /* @__PURE__ */ React70.createElement(
28178
+ CSSNumericVariableWatch,
28179
+ {
28180
+ key: "row-height",
28181
+ varName: rowHeightCSSVar,
28182
+ onChange: onRowHeightCSSVarChange
28183
+ }
28184
+ ) : null,
28185
+ /* @__PURE__ */ React70.createElement(
28186
+ CSSNumericVariableWatch,
28187
+ {
28188
+ key: "flashing-duration",
28189
+ allowInts: true,
28190
+ varName: ThemeVars.components.Cell.flashingDuration,
28191
+ onChange: onFlashingDurationCSSVarChange
28192
+ }
28193
+ ),
28194
+ rowDetailHeightCSSVar ? /* @__PURE__ */ React70.createElement(
28195
+ CSSNumericVariableWatch,
28196
+ {
28197
+ key: "row-detail-height",
28198
+ varName: rowDetailHeightCSSVar,
28199
+ onChange: onRowDetailHeightCSSVarChange
28200
+ }
28201
+ ) : null,
28202
+ columnHeaderHeightCSSVar ? /* @__PURE__ */ React70.createElement(
28203
+ CSSNumericVariableWatch,
28204
+ {
28205
+ key: "column-header-height",
28206
+ varName: columnHeaderHeightCSSVar,
28207
+ onChange: onColumnHeaderHeightCSSVarChange
28208
+ }
28209
+ ) : null,
28210
+ licenseValid ? null : /* @__PURE__ */ React70.createElement(InfiniteTableLicenseFooter, null),
28211
+ /* @__PURE__ */ React70.createElement(FocusDetect, null)
28212
+ );
27495
28213
  }
27496
28214
  );
27497
28215
  function InfiniteTableContextProvider({
@@ -27508,6 +28226,16 @@ function InfiniteTableContextProvider({
27508
28226
  globalThis.getComputed = getComputed;
27509
28227
  globalThis.componentActions = componentActions;
27510
28228
  globalThis.masterBrain = componentState.brain;
28229
+ globalThis.INFINITE = globalThis.INFINITE || {};
28230
+ if (getState().debugId) {
28231
+ const debugId = getState().debugId;
28232
+ globalThis.INFINITE[debugId] = {
28233
+ // @ts-ignore
28234
+ ...globalThis.INFINITE[debugId] || {},
28235
+ getState,
28236
+ actions: componentActions
28237
+ };
28238
+ }
27511
28239
  }
27512
28240
  const {
27513
28241
  getState: getDataSourceState,
@@ -27515,7 +28243,7 @@ function InfiniteTableContextProvider({
27515
28243
  getDataSourceMasterContext,
27516
28244
  api: dataSourceApi
27517
28245
  } = useDataSourceContextValue();
27518
- const [imperativeApi] = React71.useState(() => {
28246
+ const [imperativeApi] = React70.useState(() => {
27519
28247
  return getImperativeApi({
27520
28248
  getComputed,
27521
28249
  getState,
@@ -27551,20 +28279,20 @@ function InfiniteTableContextProvider({
27551
28279
  },
27552
28280
  { earlyAttach: true, debounce: 50 }
27553
28281
  );
27554
- React71.useEffect(() => {
28282
+ React70.useEffect(() => {
27555
28283
  if (scrollerDOMRef.current) {
27556
28284
  scrollerDOMRef.current.scrollTop = 0;
27557
28285
  }
27558
28286
  }, [scrollTopKey, scrollerDOMRef]);
27559
28287
  const TableContext2 = getInfiniteTableContext();
27560
- return /* @__PURE__ */ React71.createElement(TableContext2.Provider, { value: contextValue }, /* @__PURE__ */ React71.createElement(InfiniteTableComponent, null));
28288
+ return /* @__PURE__ */ React70.createElement(TableContext2.Provider, { value: contextValue }, /* @__PURE__ */ React70.createElement(InfiniteTableComponent, null));
27561
28289
  }
27562
28290
  var DEFAULT_ROW_HEIGHT = 40;
27563
28291
  var DEFAULT_COLUMN_HEADER_HEIGHT = toCSSVarName(columnHeaderHeightName);
27564
28292
  var InfiniteTable = function(props) {
27565
28293
  const table = (
27566
28294
  //@ts-ignore
27567
- /* @__PURE__ */ React71.createElement(
28295
+ /* @__PURE__ */ React70.createElement(
27568
28296
  InfiniteTableRoot,
27569
28297
  {
27570
28298
  repeatWrappedGroupRows: !!props.wrapRowsHorizontally,
@@ -27572,34 +28300,33 @@ var InfiniteTable = function(props) {
27572
28300
  columnHeaderHeight: DEFAULT_COLUMN_HEADER_HEIGHT,
27573
28301
  ...props
27574
28302
  },
27575
- /* @__PURE__ */ React71.createElement(InfiniteTableContextProvider, { children: props.children })
28303
+ /* @__PURE__ */ React70.createElement(InfiniteTableContextProvider, { children: props.children })
27576
28304
  )
27577
28305
  );
27578
28306
  if (false) {
27579
- return /* @__PURE__ */ React71.createElement(React71.StrictMode, null, table);
28307
+ return /* @__PURE__ */ React70.createElement(React70.StrictMode, null, table);
27580
28308
  }
27581
28309
  return table;
27582
28310
  };
27583
28311
  InfiniteTable.Header = InfiniteTableHeader2;
27584
28312
  InfiniteTable.Body = InfiniteTableBody;
27585
28313
  InfiniteTable.HScrollSyncContent = HScrollSyncContent;
27586
- InfiniteTable.Footer = () => /* @__PURE__ */ React71.createElement(InfiniteTableFooter, null);
28314
+ InfiniteTable.Footer = () => /* @__PURE__ */ React70.createElement(InfiniteTableFooter, null);
27587
28315
 
27588
28316
  // src/components/TreeGrid/TreeDataSource.tsx
27589
- var React72 = __toESM(require("react"));
28317
+ var React71 = __toESM(require("react"));
27590
28318
  function TreeDataSource(props) {
27591
28319
  const { DataSource: DataSourceComponent } = useDataSourceInternal({ nodesKey: "children", ...props });
27592
- return /* @__PURE__ */ React72.createElement(DataSourceComponent, null, props.children ?? null);
28320
+ return /* @__PURE__ */ React71.createElement(DataSourceComponent, null, props.children ?? null);
27593
28321
  }
27594
28322
 
27595
28323
  // src/components/TreeGrid/TreeGrid.tsx
27596
- var React73 = __toESM(require("react"));
28324
+ var React72 = __toESM(require("react"));
27597
28325
  function TreeGrid(props) {
27598
- return /* @__PURE__ */ React73.createElement(InfiniteTable, { ...props });
28326
+ return /* @__PURE__ */ React72.createElement(InfiniteTable, { ...props });
27599
28327
  }
27600
28328
 
27601
28329
  // src/components/DataSource/DataLoader/DataQuery.ts
27602
- var logger2 = debug("InfiniteTable:DataQuery");
27603
28330
  var DataQuery = class {
27604
28331
  constructor(debugName) {
27605
28332
  this.state = "idle";
@@ -27613,21 +28340,21 @@ var DataQuery = class {
27613
28340
  let resolvePending = () => {
27614
28341
  };
27615
28342
  try {
27616
- logger2(`Fetching query ${this.debugName}...`);
28343
+ this.logger(`Fetching query ${this.debugName}...`);
27617
28344
  this.pendingPromise = new Promise((resolve) => {
27618
28345
  resolvePending = resolve;
27619
28346
  });
27620
28347
  this.result = await loadFn(...key);
27621
28348
  this.state = "success";
27622
- } catch (error2) {
28349
+ } catch (error4) {
27623
28350
  this.result = void 0;
27624
- this.error = error2;
28351
+ this.error = error4;
27625
28352
  this.state = "error";
27626
28353
  }
27627
28354
  this.doneAt = Date.now();
27628
28355
  this.pendingPromise = void 0;
27629
28356
  resolvePending(this);
27630
- logger2(`Fetched query ${this.debugName}. State: ${this.state}.`);
28357
+ this.logger(`Fetched query ${this.debugName}. State: ${this.state}.`);
27631
28358
  return this.getDoneSnapshot();
27632
28359
  };
27633
28360
  this.getCurrentSnapshot = () => {
@@ -27667,6 +28394,7 @@ var DataQuery = class {
27667
28394
  this.isDone = () => this.state === "success" || this.state === "error";
27668
28395
  this.isSuccess = () => this.state === "success";
27669
28396
  this.debugName = debugName || "";
28397
+ this.logger = debug(`${debugName}:DataQuery`);
27670
28398
  }
27671
28399
  };
27672
28400
 
@@ -27725,7 +28453,7 @@ var _DataClient = class {
27725
28453
  this.removeQueryIfErrored(cachedQuery, stringifiedCacheKey);
27726
28454
  }
27727
28455
  }
27728
- const dataQuery = new DataQuery(options.name || "");
28456
+ const dataQuery = new DataQuery(`${this.name}:${options.name}`);
27729
28457
  this.queryCache.set(stringifiedCacheKey, dataQuery);
27730
28458
  dataQuery.fetch(options.fn, options.key);
27731
28459
  dataQuery.getCurrentSnapshot().promise?.then(() => {
@@ -27837,7 +28565,7 @@ var keyboardShortcuts = {
27837
28565
  };
27838
28566
 
27839
28567
  // src/components/hooks/useInterceptedMap.ts
27840
- var import_react66 = require("react");
28568
+ var import_react67 = require("react");
27841
28569
  function interceptMap(map2, fns) {
27842
28570
  const { set, delete: deleteKey, clear } = map2;
27843
28571
  if (fns.set) {
@@ -27999,21 +28727,21 @@ var WeakFixedSizeSet = _WeakFixedSizeSet;
27999
28727
  WeakFixedSizeSet.DEFAULT_SIZE = 10;
28000
28728
 
28001
28729
  // src/components/hooks/useEffectWhenSameDeps.ts
28002
- var import_react67 = require("react");
28730
+ var import_react68 = require("react");
28003
28731
  var isSameDeps = (deps, prevDeps) => {
28004
28732
  return deps.every((dep, index) => dep === prevDeps[index]);
28005
28733
  };
28006
28734
  var useEffectWhenSameDeps = (callback, deps) => {
28007
- const depsRef = (0, import_react67.useRef)(deps);
28735
+ const depsRef = (0, import_react68.useRef)(deps);
28008
28736
  const sameDeps = isSameDeps(deps, depsRef.current);
28009
- const isInitialRef = (0, import_react67.useRef)(true);
28737
+ const isInitialRef = (0, import_react68.useRef)(true);
28010
28738
  depsRef.current = deps;
28011
- const effectDepsRef = (0, import_react67.useRef)(["same"]);
28739
+ const effectDepsRef = (0, import_react68.useRef)(["same"]);
28012
28740
  const effectDeps = sameDeps ? [Date.now()] : effectDepsRef.current;
28013
28741
  effectDepsRef.current = effectDeps;
28014
- const callbackRef = (0, import_react67.useRef)(callback);
28742
+ const callbackRef = (0, import_react68.useRef)(callback);
28015
28743
  callbackRef.current = callback;
28016
- (0, import_react67.useEffect)(() => {
28744
+ (0, import_react68.useEffect)(() => {
28017
28745
  if (isInitialRef.current) {
28018
28746
  isInitialRef.current = false;
28019
28747
  return;
@@ -28023,7 +28751,7 @@ var useEffectWhenSameDeps = (callback, deps) => {
28023
28751
  };
28024
28752
 
28025
28753
  // src/components/hooks/useEffectWhen.ts
28026
- var import_react68 = require("react");
28754
+ var import_react69 = require("react");
28027
28755
  var isSameDeps2 = (deps, prevDeps, compare) => {
28028
28756
  return deps.every((dep, index) => {
28029
28757
  if (compare) {
@@ -28034,26 +28762,26 @@ var isSameDeps2 = (deps, prevDeps, compare) => {
28034
28762
  };
28035
28763
  var useEffectWhen = (callback, options) => {
28036
28764
  const { same: depsForSame, different: depsForDifferent, compare } = options;
28037
- const sameDepsRef = (0, import_react68.useRef)(depsForSame);
28038
- const differentDepsRef = (0, import_react68.useRef)(depsForDifferent);
28765
+ const sameDepsRef = (0, import_react69.useRef)(depsForSame);
28766
+ const differentDepsRef = (0, import_react69.useRef)(depsForDifferent);
28039
28767
  const sameRespected = isSameDeps2(depsForSame, sameDepsRef.current, compare);
28040
28768
  const differentRespected = !isSameDeps2(
28041
28769
  depsForDifferent,
28042
28770
  differentDepsRef.current,
28043
28771
  compare
28044
28772
  );
28045
- const isInitialRef = (0, import_react68.useRef)(true);
28773
+ const isInitialRef = (0, import_react69.useRef)(true);
28046
28774
  sameDepsRef.current = depsForSame;
28047
28775
  differentDepsRef.current = depsForDifferent;
28048
- const effectDepsRef = (0, import_react68.useRef)(["same"]);
28776
+ const effectDepsRef = (0, import_react69.useRef)(["same"]);
28049
28777
  const effectDeps = sameRespected && differentRespected ? [Date.now()] : effectDepsRef.current;
28050
28778
  effectDepsRef.current = effectDeps;
28051
- const callbackRef = (0, import_react68.useRef)(callback);
28779
+ const callbackRef = (0, import_react69.useRef)(callback);
28052
28780
  callbackRef.current = callback;
28053
28781
  if (sameRespected && differentRespected) {
28054
28782
  isInitialRef.current = false;
28055
28783
  }
28056
- (0, import_react68.useEffect)(() => {
28784
+ (0, import_react69.useEffect)(() => {
28057
28785
  if (isInitialRef.current) {
28058
28786
  return;
28059
28787
  }
@@ -28062,12 +28790,12 @@ var useEffectWhen = (callback, options) => {
28062
28790
  };
28063
28791
 
28064
28792
  // src/components/InfiniteTable/components/InfiniteTableRow/FlashingColumnCell.tsx
28065
- var React74 = __toESM(require("react"));
28793
+ var React73 = __toESM(require("react"));
28066
28794
  var currentFlashingDurationVar = stripVar(
28067
28795
  InternalVars.currentFlashingDuration
28068
28796
  );
28069
28797
  var defaultRender = ({ children }) => {
28070
- return /* @__PURE__ */ React74.createElement(React74.Fragment, null, children);
28798
+ return /* @__PURE__ */ React73.createElement(React73.Fragment, null, children);
28071
28799
  };
28072
28800
  var DEFAULT_FLASH_DURATION = 1e3;
28073
28801
  var INTERNAL_FLASH_CLS_FOR_DIRECTION = {
@@ -28089,7 +28817,7 @@ var createFlashingColumnCellComponent = (options = {}) => {
28089
28817
  // fadeClassName,
28090
28818
  render = defaultRender
28091
28819
  } = options;
28092
- const FlashingColumnCell2 = React74.forwardRef(
28820
+ const FlashingColumnCell2 = React73.forwardRef(
28093
28821
  (props, _ref) => {
28094
28822
  const cellContext = useInfiniteColumnCell();
28095
28823
  const {
@@ -28099,13 +28827,13 @@ var createFlashingColumnCellComponent = (options = {}) => {
28099
28827
  const { domRef, value, column, rowInfo, htmlElementRef } = cellContext;
28100
28828
  const rowId = rowInfo.id;
28101
28829
  const columnId = column.id;
28102
- const initialRef = React74.useRef(true);
28103
- const oldValueRef = React74.useRef(value);
28830
+ const initialRef = React73.useRef(true);
28831
+ const oldValueRef = React73.useRef(value);
28104
28832
  const oldValue = initialRef.current ? null : oldValueRef.current;
28105
28833
  initialRef.current = false;
28106
- const flashTimeoutIdRef = React74.useRef();
28107
- const flashDirectionRef = React74.useRef();
28108
- const fadeTimeoutIdRef = React74.useRef();
28834
+ const flashTimeoutIdRef = React73.useRef();
28835
+ const flashDirectionRef = React73.useRef();
28836
+ const fadeTimeoutIdRef = React73.useRef();
28109
28837
  useEffectWhen(
28110
28838
  () => {
28111
28839
  if (value === oldValueRef.current) {
@@ -28152,7 +28880,7 @@ var createFlashingColumnCellComponent = (options = {}) => {
28152
28880
  different: [value]
28153
28881
  }
28154
28882
  );
28155
- return /* @__PURE__ */ React74.createElement("div", { ref: domRef, ...props, className: join(props.className) }, render({ children: props.children, oldValue }));
28883
+ return /* @__PURE__ */ React73.createElement("div", { ref: domRef, ...props, className: join(props.className) }, render({ children: props.children, oldValue }));
28156
28884
  }
28157
28885
  );
28158
28886
  return FlashingColumnCell2;