@infinite-table/infinite-react 10.1.5 → 10.2.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.mjs CHANGED
@@ -1523,6 +1523,7 @@ var DevToolsTracks = {
1523
1523
  };
1524
1524
 
1525
1525
  // src/utils/devTools/index.ts
1526
+ var MEASURE_NAME_PREFIX = "\u200B";
1526
1527
  var DevToolsMarker = class _DevToolsMarker {
1527
1528
  constructor(debugId) {
1528
1529
  this.debugId = debugId;
@@ -1560,7 +1561,8 @@ var DevToolsMarker = class _DevToolsMarker {
1560
1561
  const tooltip = markerDetails.tooltip || this.markerDetails.tooltip;
1561
1562
  const label = markerDetails.label || this.markerDetails.label || "Unknown";
1562
1563
  const track = markerDetails.track || this.markerDetails.track || "Unknown";
1563
- performance.measure(label, {
1564
+ const measureName = MEASURE_NAME_PREFIX + label;
1565
+ performance.measure(measureName, {
1564
1566
  start,
1565
1567
  end,
1566
1568
  detail: {
@@ -1574,6 +1576,7 @@ var DevToolsMarker = class _DevToolsMarker {
1574
1576
  }
1575
1577
  }
1576
1578
  });
1579
+ performance.clearMeasures(measureName);
1577
1580
  return this;
1578
1581
  };
1579
1582
  this.debugId = debugId;
@@ -5254,6 +5257,7 @@ function reorderColumnsOnDrag(params) {
5254
5257
  setProxyPosition,
5255
5258
  setDragColumnOutside,
5256
5259
  getCurrentDragSourceAndTarget,
5260
+ groupingToolbarDragListId,
5257
5261
  api: imperativeApi,
5258
5262
  horizontalLayoutPageIndex,
5259
5263
  pageWidth
@@ -5546,7 +5550,7 @@ function reorderColumnsOnDrag(params) {
5546
5550
  },
5547
5551
  onMove(mousePosition) {
5548
5552
  const currentColHeaderRect = updatePositionAndDiff(mousePosition);
5549
- if (getCurrentDragSourceAndTarget().dropTargetListId === "grouping-toolbar" || allowColumnHideOnDrag && !acceptDropToReorderRect.containsPoint(
5553
+ if (getCurrentDragSourceAndTarget().dropTargetListId === groupingToolbarDragListId || allowColumnHideOnDrag && !acceptDropToReorderRect.containsPoint(
5550
5554
  currentColHeaderRect.getCenter()
5551
5555
  )) {
5552
5556
  if (allowColumnHideOnDrag) {
@@ -5883,17 +5887,18 @@ var _DragManager = class _DragManager {
5883
5887
  return _DragManager.emitter.on(event, callback);
5884
5888
  }
5885
5889
  static registerDragInteractionTarget(dragInteractionTarget) {
5886
- if (_DragManager.dragInteractionTargetsMap.has(dragInteractionTarget.listId)) {
5890
+ const { listId } = dragInteractionTarget;
5891
+ const current = _DragManager.dragInteractionTargetsMap.get(listId);
5892
+ if (current && current !== dragInteractionTarget) {
5887
5893
  console.warn(
5888
- `DragInteractionTarget with listId ${dragInteractionTarget.listId} already registered`
5894
+ `DragInteractionTarget with listId ${listId} already registered`
5889
5895
  );
5890
5896
  return;
5891
5897
  }
5892
- _DragManager.dragInteractionTargetsMap.set(
5893
- dragInteractionTarget.listId,
5894
- dragInteractionTarget
5895
- );
5896
- _DragManager.emit("register", dragInteractionTarget);
5898
+ if (!current) {
5899
+ _DragManager.dragInteractionTargetsMap.set(listId, dragInteractionTarget);
5900
+ _DragManager.emit("register", dragInteractionTarget);
5901
+ }
5897
5902
  return () => {
5898
5903
  _DragManager.unregisterDragInteractionTarget(dragInteractionTarget);
5899
5904
  };
@@ -5907,13 +5912,11 @@ var _DragManager = class _DragManager {
5907
5912
  if (!dragInteractionTarget) {
5908
5913
  return;
5909
5914
  }
5910
- if (!_DragManager.dragInteractionTargetsMap.has(dragInteractionTarget.listId)) {
5911
- console.warn(
5912
- `DragInteractionTarget with listId ${dragInteractionTarget.listId} not found`
5913
- );
5915
+ const { listId } = dragInteractionTarget;
5916
+ if (_DragManager.dragInteractionTargetsMap.get(listId) !== dragInteractionTarget) {
5914
5917
  return;
5915
5918
  }
5916
- _DragManager.dragInteractionTargetsMap.delete(dragInteractionTarget.listId);
5919
+ _DragManager.dragInteractionTargetsMap.delete(listId);
5917
5920
  dragInteractionTarget.unregister();
5918
5921
  _DragManager.emit("unregister", dragInteractionTarget);
5919
5922
  }
@@ -6010,6 +6013,14 @@ var _DragManager = class _DragManager {
6010
6013
  let insideTargetEvent = null;
6011
6014
  const events = [];
6012
6015
  _DragManager.withDragMove(dragOperation, (interactionTarget, { event: event2 }) => {
6016
+ if (dragOperation.cancelled) {
6017
+ event2 = {
6018
+ ...event2,
6019
+ dropTargetListId: null,
6020
+ dropIndex: -1,
6021
+ outside: false
6022
+ };
6023
+ }
6013
6024
  interactionTarget.drop(event2);
6014
6025
  events.push(event2);
6015
6026
  if (!event2.outside) {
@@ -6075,6 +6086,11 @@ var DragOperation = class extends EventEmitter {
6075
6086
  constructor(options) {
6076
6087
  super(options.listeners);
6077
6088
  this.phase = "start";
6089
+ /**
6090
+ * Whether the drag was cancelled - the browser took the pointer away -
6091
+ * rather than dropped.
6092
+ */
6093
+ this.cancelled = false;
6078
6094
  this.currentOffset = {
6079
6095
  top: 0,
6080
6096
  left: 0
@@ -6103,6 +6119,13 @@ var DragOperation = class extends EventEmitter {
6103
6119
  this.phase = "drop";
6104
6120
  this.emit("drop", this);
6105
6121
  }
6122
+ /**
6123
+ * Ends the drag without a drop.
6124
+ */
6125
+ cancel() {
6126
+ this.cancelled = true;
6127
+ this.drop();
6128
+ }
6106
6129
  move(point) {
6107
6130
  if (this.phase !== "start" && this.phase !== "move") {
6108
6131
  return;
@@ -6141,6 +6164,11 @@ var DragDropProviderContext = React20.createContext({
6141
6164
  var useDragDropProvider = () => {
6142
6165
  return React20.useContext(DragDropProviderContext);
6143
6166
  };
6167
+ var DragDropProviderIdContext = React20.createContext("");
6168
+ var useDragListId = (name) => {
6169
+ const providerId = React20.useContext(DragDropProviderIdContext);
6170
+ return providerId ? `${name}-${providerId}` : name;
6171
+ };
6144
6172
  var DragDropProvider = (props) => {
6145
6173
  const [state, setState] = React20.useState({
6146
6174
  dragSourceListId: null,
@@ -6148,6 +6176,7 @@ var DragDropProvider = (props) => {
6148
6176
  dragItemId: "",
6149
6177
  status: "accepted"
6150
6178
  });
6179
+ const providerId = React20.useId();
6151
6180
  const stateRef = React20.useRef(state);
6152
6181
  stateRef.current = state;
6153
6182
  const getCurrentDragSourceAndTarget = React20.useCallback(() => {
@@ -6205,9 +6234,13 @@ var DragDropProvider = (props) => {
6205
6234
  removeDragDrop();
6206
6235
  };
6207
6236
  }, [DragManager, setState]);
6208
- return /* @__PURE__ */ React20.createElement(DragDropProviderContext.Provider, { value: contextValue }, typeof props.children === "function" ? props.children(contextValue) : props.children);
6237
+ return /* @__PURE__ */ React20.createElement(DragDropProviderIdContext.Provider, { value: providerId }, /* @__PURE__ */ React20.createElement(DragDropProviderContext.Provider, { value: contextValue }, typeof props.children === "function" ? props.children(contextValue) : props.children));
6209
6238
  };
6210
6239
 
6240
+ // src/components/InfiniteTable/components/draggable/dragListNames.ts
6241
+ var HEADER_DRAG_LIST_NAME = "header";
6242
+ var GROUPING_TOOLBAR_DRAG_LIST_NAME = "grouping-toolbar";
6243
+
6211
6244
  // src/components/InfiniteTable/components/InfiniteTableBody/bodyClassName.ts
6212
6245
  var InfiniteTableBodyClassName = `${rootClassName}Body`;
6213
6246
  var getBodyNode = (root) => {
@@ -6254,6 +6287,9 @@ var useColumnPointerEvents = ({
6254
6287
  const [proxyPosition, setProxyPosition] = useState6(null);
6255
6288
  const [dragColumnOutside, setDragColumnOutside] = useState6(false);
6256
6289
  const { getCurrentDragSourceAndTarget } = useDragDropProvider();
6290
+ const groupingToolbarDragListId = useDragListId(
6291
+ GROUPING_TOOLBAR_DRAG_LIST_NAME
6292
+ );
6257
6293
  const { getComputed, getState, api, computedDraggable, rootRef, actions } = useInfiniteTableSelector((ctx) => {
6258
6294
  return {
6259
6295
  actions: ctx.actions,
@@ -6330,6 +6366,7 @@ var useColumnPointerEvents = ({
6330
6366
  dragColumnHeaderTargetRect: targetRect,
6331
6367
  dragColumnId: columnId,
6332
6368
  getCurrentDragSourceAndTarget,
6369
+ groupingToolbarDragListId,
6333
6370
  api,
6334
6371
  infiniteDOMNode: rootRef.current,
6335
6372
  setProxyPosition,
@@ -6470,7 +6507,7 @@ var useColumnPointerEvents = ({
6470
6507
  target.addEventListener("pointerup", onPointerUp);
6471
6508
  target.setPointerCapture(e.pointerId);
6472
6509
  },
6473
- [columnId, horizontalLayoutPageIndex]
6510
+ [columnId, horizontalLayoutPageIndex, groupingToolbarDragListId]
6474
6511
  );
6475
6512
  return {
6476
6513
  onPointerDown: computedDraggable ? onPointerDown : defaultPointerDown,
@@ -12414,7 +12451,7 @@ function dampenByTime(proposedScroll, dragStartTime, config) {
12414
12451
  return MIN_SCROLL;
12415
12452
  }
12416
12453
  const pct = (runTime - accelerateAt) / (stopDampeningAt - accelerateAt);
12417
- return Math.ceil(proposedScroll * config.ease(pct));
12454
+ return Math.max(MIN_SCROLL, Math.ceil(proposedScroll * config.ease(pct)));
12418
12455
  }
12419
12456
  function getScrollForAxis(point, containerStart, containerEnd, containerSize, config, dragStartTime, shouldUseDampening) {
12420
12457
  if (point < containerStart || point > containerEnd) {
@@ -12562,20 +12599,12 @@ var AutoScroller = class {
12562
12599
  }
12563
12600
  };
12564
12601
 
12565
- // src/components/InfiniteTable/components/draggable/DragList.tsx
12566
- var DragListContext = React31.createContext({
12567
- dragItemId: null,
12568
- onDragItemPointerDown: () => {
12569
- },
12570
- draggingInProgress: false,
12571
- dragListId: "",
12572
- status: "accepted",
12573
- dragSourceListId: null,
12574
- dropTargetListId: null
12575
- });
12576
- var useDragListContext = () => {
12577
- return React31.useContext(DragListContext);
12578
- };
12602
+ // src/components/InfiniteTable/components/draggable/dragListController.ts
12603
+ var DRAG_LIST_ATTRIBUTE = "data-drag-list-id";
12604
+ var DRAG_ITEM_ATTRIBUTE = "data-drag-item-id";
12605
+ var DRAG_ITEM_LIST_ATTRIBUTE = "data-drag-item-list-id";
12606
+ var DRAG_ITEM_SELECTOR = `[${DRAG_ITEM_ATTRIBUTE}]`;
12607
+ var RETURN_NULL = () => null;
12579
12608
  var defaultUpdatePosition = (options) => {
12580
12609
  const { node, offset } = options;
12581
12610
  if (!offset) {
@@ -12596,8 +12625,6 @@ function getDraggableItemNodes(domRef, dragListId) {
12596
12625
  }
12597
12626
  function getDraggableItems(domRef, dragListId) {
12598
12627
  const dragItems = getDraggableItemNodes(domRef, dragListId);
12599
- if (!dragItems || dragItems.length === 0) {
12600
- }
12601
12628
  const draggableItems = Array.from(dragItems).map((item) => {
12602
12629
  const id = getDraggableItemId(item);
12603
12630
  const rect = item.getBoundingClientRect();
@@ -12645,55 +12672,54 @@ function createInteractionTarget(params) {
12645
12672
  const target = new DragInteractionTarget(getInteractionTargetData(params));
12646
12673
  return target;
12647
12674
  }
12648
- function useInteractionTarget(domRef, props) {
12649
- const getProps = useLatest(props);
12650
- const [interactionTarget, doSetInteractionTarget] = React31.useState(null);
12651
- const setInteractionTarget = useCallback17(
12652
- (interactionTarget2) => {
12653
- if (interactionTarget2) {
12654
- DragManager.registerDragInteractionTarget(interactionTarget2);
12655
- } else {
12656
- const currentInteractionTarget = getInteractionTarget();
12657
- if (currentInteractionTarget) {
12658
- DragManager.unregisterDragInteractionTarget(currentInteractionTarget);
12659
- }
12660
- }
12661
- doSetInteractionTarget(interactionTarget2);
12662
- },
12663
- []
12675
+ function findDragListElement(domRef, dragListId) {
12676
+ const dragList = document.querySelector(
12677
+ `[${DRAG_LIST_ATTRIBUTE}="${dragListId}"]`
12664
12678
  );
12665
- const getInteractionTarget = useLatest(interactionTarget);
12666
- useEffect11(() => {
12667
- return DragManager.on("register", (interactionTarget2) => {
12668
- const { dragListId, acceptDropsFrom, orientation, shouldAcceptDrop } = getProps();
12669
- const interactionTargetData = interactionTarget2.getData();
12670
- if (!interactionTargetData.initial) {
12671
- return;
12672
- }
12673
- if (interactionTargetData.listId === dragListId) {
12674
- return;
12675
- }
12676
- if (acceptDropsFrom?.includes(interactionTargetData.listId)) {
12677
- const newInteractionTarget = createInteractionTarget({
12678
- domRef,
12679
- orientation,
12680
- dragListId,
12681
- initial: false,
12682
- acceptDropsFrom,
12683
- shouldAcceptDrop
12684
- });
12685
- interactionTarget2.once("unregister", () => {
12686
- setInteractionTarget(null);
12687
- });
12688
- setInteractionTarget(newInteractionTarget);
12689
- }
12690
- });
12691
- }, [getProps]);
12692
- return {
12693
- interactionTarget,
12694
- setInteractionTarget,
12695
- getInteractionTarget
12696
- };
12679
+ if (dragList) {
12680
+ domRef.current = dragList;
12681
+ } else {
12682
+ console.warn(
12683
+ `DragList with id "${dragListId}" not found. You're probably not spreading the domProps to the parent element. Make sure you also include the "className" prop.`
12684
+ );
12685
+ }
12686
+ }
12687
+ function replaceRegisteredInteractionTarget(registeredTargetRef, interactionTarget) {
12688
+ const registeredTarget = registeredTargetRef.current;
12689
+ if (registeredTarget && registeredTarget !== interactionTarget) {
12690
+ DragManager.unregisterDragInteractionTarget(registeredTarget);
12691
+ }
12692
+ registeredTargetRef.current = interactionTarget;
12693
+ if (interactionTarget) {
12694
+ DragManager.registerDragInteractionTarget(interactionTarget);
12695
+ }
12696
+ }
12697
+ function acceptDragsFromOtherLists(options) {
12698
+ const { getProps, domRef, setInteractionTarget } = options;
12699
+ return DragManager.on("register", (interactionTarget) => {
12700
+ const { dragListId, acceptDropsFrom, orientation, shouldAcceptDrop } = getProps();
12701
+ const interactionTargetData = interactionTarget.getData();
12702
+ if (!interactionTargetData.initial) {
12703
+ return;
12704
+ }
12705
+ if (interactionTargetData.listId === dragListId) {
12706
+ return;
12707
+ }
12708
+ if (acceptDropsFrom?.includes(interactionTargetData.listId)) {
12709
+ const newInteractionTarget = createInteractionTarget({
12710
+ domRef,
12711
+ orientation,
12712
+ dragListId,
12713
+ initial: false,
12714
+ acceptDropsFrom,
12715
+ shouldAcceptDrop
12716
+ });
12717
+ interactionTarget.once("unregister", () => {
12718
+ setInteractionTarget(null);
12719
+ });
12720
+ setInteractionTarget(newInteractionTarget);
12721
+ }
12722
+ });
12697
12723
  }
12698
12724
  function createDefaultProxy(dragItemNode, initialRect) {
12699
12725
  const proxy = dragItemNode.cloneNode(true);
@@ -12729,6 +12755,444 @@ function cleanupProxy(proxyStateRef) {
12729
12755
  state.originalNode.style.visibility = "";
12730
12756
  proxyStateRef.current = null;
12731
12757
  }
12758
+ function getDragItemNodes(dragItemsRef, domRef, dragListId) {
12759
+ let dragItems = dragItemsRef.current;
12760
+ if (!dragItems || dragItems.length === 0) {
12761
+ dragItems = getDraggableItemNodes(domRef, dragListId);
12762
+ dragItemsRef.current = dragItems;
12763
+ }
12764
+ return dragItems;
12765
+ }
12766
+ function bindInteractionTarget(interactionTarget, options) {
12767
+ const {
12768
+ dragListId,
12769
+ orientation,
12770
+ domRef,
12771
+ proxyStateRef,
12772
+ sourceScrollOffsetRef,
12773
+ dragItemsRef,
12774
+ getDragItems,
12775
+ getOnDrop,
12776
+ getOnAcceptDrop,
12777
+ getOnRemove,
12778
+ getUpdatePosition,
12779
+ updateDragOperationSourceAndTarget,
12780
+ updateDragProxyRenderState
12781
+ } = options;
12782
+ const removeOnDragStart = interactionTarget.on(
12783
+ "start",
12784
+ ({ dragItem, dragSourceListId, dropTargetListId }) => {
12785
+ updateDragOperationSourceAndTarget({
12786
+ dragSourceListId,
12787
+ dropTargetListId,
12788
+ dragItemId: dragItem.id,
12789
+ status: "accepted"
12790
+ });
12791
+ }
12792
+ );
12793
+ const removeOnDragMove = interactionTarget.on(
12794
+ "move",
12795
+ ({ offsetsForItems, items, status, dragItem }) => {
12796
+ if (status === "rejected") {
12797
+ return;
12798
+ }
12799
+ const dragItems = getDragItems();
12800
+ const updatePosition = getUpdatePosition();
12801
+ const proxyState = proxyStateRef.current;
12802
+ items.forEach((item, index) => {
12803
+ let offset = offsetsForItems[index];
12804
+ const node = dragItems[index];
12805
+ if (!node) {
12806
+ return;
12807
+ }
12808
+ if (proxyState && item.id === proxyState.dragItemId) {
12809
+ return;
12810
+ }
12811
+ if (!proxyState && item.id === dragItem.id) {
12812
+ const scrollOffset = sourceScrollOffsetRef.current;
12813
+ offset = {
12814
+ left: offset.left + scrollOffset.left,
12815
+ top: offset.top + scrollOffset.top
12816
+ };
12817
+ }
12818
+ updatePosition({
12819
+ id: item.id,
12820
+ node,
12821
+ offset
12822
+ });
12823
+ });
12824
+ }
12825
+ );
12826
+ const removeOnDragDrop = interactionTarget.on("drop", (params) => {
12827
+ const {
12828
+ sortedIndexes,
12829
+ dragIndex,
12830
+ dropIndex,
12831
+ dragItem,
12832
+ items,
12833
+ dragSourceListId,
12834
+ dropTargetListId,
12835
+ outside,
12836
+ status
12837
+ } = params;
12838
+ const dragItems = getDragItems();
12839
+ dragItemsRef.current = [];
12840
+ const onAcceptDrop = getOnAcceptDrop();
12841
+ const onRemove = getOnRemove();
12842
+ const onDrop = getOnDrop();
12843
+ const updatePosition = getUpdatePosition();
12844
+ items.forEach((item, index) => {
12845
+ const node = dragItems[index];
12846
+ if (!node) {
12847
+ return;
12848
+ }
12849
+ updatePosition({
12850
+ id: item.id,
12851
+ node,
12852
+ offset: null
12853
+ });
12854
+ });
12855
+ cleanupProxy(proxyStateRef);
12856
+ updateDragProxyRenderState((prev) => {
12857
+ if (!prev) return prev;
12858
+ requestAnimationFrame(() => updateDragProxyRenderState(RETURN_NULL));
12859
+ return { ...prev, dragItemId: null };
12860
+ });
12861
+ const accepted = status === "accepted";
12862
+ if (dragListId === dropTargetListId && dragSourceListId !== dragListId) {
12863
+ if (onAcceptDrop && accepted) {
12864
+ onAcceptDrop({
12865
+ dragItemId: dragItem.id,
12866
+ dragSourceListId,
12867
+ dropTargetListId,
12868
+ dragIndex,
12869
+ dropIndex,
12870
+ dropItemId: items[dropIndex]?.id
12871
+ });
12872
+ }
12873
+ }
12874
+ let callbackFn = null;
12875
+ if (dropIndex === -1 && dragSourceListId === dragListId && dropTargetListId === dragListId && outside) {
12876
+ callbackFn = onRemove;
12877
+ }
12878
+ if (dropIndex !== -1 && dropTargetListId === dragListId && dragSourceListId === dragListId) {
12879
+ callbackFn = onDrop;
12880
+ }
12881
+ if (callbackFn) {
12882
+ callbackFn?.(sortedIndexes, {
12883
+ dragIndex,
12884
+ dropIndex,
12885
+ dragItemId: items[dragIndex].id,
12886
+ dropItemId: items[dropIndex]?.id
12887
+ });
12888
+ }
12889
+ });
12890
+ let targetAutoScroller = null;
12891
+ let targetScrollContainer = null;
12892
+ let targetScrollHandler = null;
12893
+ let targetPointermoveHandler = null;
12894
+ if (!interactionTarget.getData().initial && domRef.current) {
12895
+ targetAutoScroller = new AutoScroller({
12896
+ orientation,
12897
+ onScroll: () => {
12898
+ }
12899
+ });
12900
+ targetAutoScroller.start(domRef.current);
12901
+ targetScrollContainer = targetAutoScroller.getScrollContainer();
12902
+ if (targetScrollContainer) {
12903
+ let lastScroll = orientation === "vertical" ? targetScrollContainer.scrollTop : targetScrollContainer.scrollLeft;
12904
+ targetScrollHandler = () => {
12905
+ const current = orientation === "vertical" ? targetScrollContainer.scrollTop : targetScrollContainer.scrollLeft;
12906
+ const delta = current - lastScroll;
12907
+ lastScroll = current;
12908
+ if (delta !== 0) {
12909
+ interactionTarget.adjustForScroll(delta);
12910
+ DragManager.retriggerMove();
12911
+ }
12912
+ };
12913
+ targetScrollContainer.addEventListener("scroll", targetScrollHandler);
12914
+ }
12915
+ targetPointermoveHandler = (e) => {
12916
+ targetAutoScroller.updatePointer({
12917
+ left: e.clientX,
12918
+ top: e.clientY
12919
+ });
12920
+ };
12921
+ getGlobal().addEventListener("pointermove", targetPointermoveHandler);
12922
+ }
12923
+ return () => {
12924
+ removeOnDragStart();
12925
+ removeOnDragMove();
12926
+ removeOnDragDrop();
12927
+ if (targetAutoScroller) {
12928
+ targetAutoScroller.stop();
12929
+ }
12930
+ if (targetScrollContainer && targetScrollHandler) {
12931
+ targetScrollContainer.removeEventListener("scroll", targetScrollHandler);
12932
+ }
12933
+ if (targetPointermoveHandler) {
12934
+ getGlobal().removeEventListener("pointermove", targetPointermoveHandler);
12935
+ }
12936
+ };
12937
+ }
12938
+ function startDragOnPointerDown(e, props, options) {
12939
+ const {
12940
+ dragListId,
12941
+ orientation,
12942
+ acceptDropsFrom,
12943
+ preserveDragSpace,
12944
+ onDragProxySetup
12945
+ } = props;
12946
+ const {
12947
+ domRef,
12948
+ proxyStateRef,
12949
+ sourceScrollOffsetRef,
12950
+ dragItemsRef,
12951
+ setInteractionTarget,
12952
+ updateDragProxyRenderState
12953
+ } = options;
12954
+ const dragStrategy = props.dragStrategy ?? "proxy";
12955
+ const useProxy = dragStrategy === "proxy" && !props.renderDragProxy;
12956
+ const useRenderProxy = dragStrategy === "proxy" && !!props.renderDragProxy;
12957
+ const proxyMove = props.onDragProxyMove ?? defaultDragProxyMove;
12958
+ const target = e.currentTarget;
12959
+ let dragItemId = target.getAttribute(DRAG_ITEM_ATTRIBUTE);
12960
+ if (dragItemId == null) {
12961
+ const parentDragItem = selectParent(target, DRAG_ITEM_SELECTOR);
12962
+ if (parentDragItem) {
12963
+ dragItemId = parentDragItem.getAttribute(DRAG_ITEM_ATTRIBUTE);
12964
+ }
12965
+ }
12966
+ if (dragItemId == null) {
12967
+ console.warn(
12968
+ `Could not find drag item id for element`,
12969
+ target,
12970
+ `Make sure you have a parent element with a ${DRAG_ITEM_ATTRIBUTE} attribute`
12971
+ );
12972
+ return;
12973
+ }
12974
+ dragItemId = `${dragItemId}`;
12975
+ let dragOperation = null;
12976
+ const dragItems = getDraggableItemNodes(domRef, dragListId);
12977
+ dragItemsRef.current = dragItems;
12978
+ const interactionTarget = createInteractionTarget({
12979
+ domRef,
12980
+ orientation,
12981
+ dragListId,
12982
+ acceptDropsFrom,
12983
+ initial: true,
12984
+ preserveDragSpace
12985
+ });
12986
+ const draggableItems = interactionTarget.getData().draggableItems;
12987
+ const dragIndex = draggableItems.findIndex((item) => item.id === dragItemId);
12988
+ if (dragIndex === -1) {
12989
+ return;
12990
+ }
12991
+ const dragItem = draggableItems[dragIndex];
12992
+ const dragItemNode = dragItems[dragIndex]?.getAttribute(DRAG_ITEM_ATTRIBUTE) === `${dragItemId}` ? dragItems[dragIndex] : dragItems.find(
12993
+ (node) => node.getAttribute(DRAG_ITEM_ATTRIBUTE) === `${dragItemId}`
12994
+ );
12995
+ setInteractionTarget(interactionTarget);
12996
+ const initialCoords = {
12997
+ left: e.clientX,
12998
+ top: e.clientY
12999
+ };
13000
+ let lastPointer = { left: e.clientX, top: e.clientY };
13001
+ sourceScrollOffsetRef.current = { top: 0, left: 0 };
13002
+ const autoScroller = new AutoScroller({
13003
+ orientation,
13004
+ onScroll: () => {
13005
+ }
13006
+ });
13007
+ if (domRef.current) {
13008
+ autoScroller.start(domRef.current);
13009
+ }
13010
+ const scrollContainer = autoScroller.getScrollContainer();
13011
+ let lastSourceScroll = scrollContainer ? orientation === "vertical" ? scrollContainer.scrollTop : scrollContainer.scrollLeft : 0;
13012
+ function fireDragMove() {
13013
+ if (!dragOperation) return;
13014
+ dragOperation.move({
13015
+ left: lastPointer.left,
13016
+ top: lastPointer.top
13017
+ });
13018
+ }
13019
+ const onContainerScroll = () => {
13020
+ if (!scrollContainer) return;
13021
+ const current = orientation === "vertical" ? scrollContainer.scrollTop : scrollContainer.scrollLeft;
13022
+ const delta = current - lastSourceScroll;
13023
+ lastSourceScroll = current;
13024
+ if (delta !== 0) {
13025
+ interactionTarget.adjustForScroll(delta);
13026
+ if (orientation === "vertical") {
13027
+ sourceScrollOffsetRef.current.top += delta;
13028
+ } else {
13029
+ sourceScrollOffsetRef.current.left += delta;
13030
+ }
13031
+ }
13032
+ fireDragMove();
13033
+ };
13034
+ scrollContainer?.addEventListener("scroll", onContainerScroll);
13035
+ const onPointerMove = (e2) => {
13036
+ lastPointer = { left: e2.clientX, top: e2.clientY };
13037
+ if (!dragOperation) {
13038
+ dragOperation = DragManager.startDrag(
13039
+ {
13040
+ listId: dragListId,
13041
+ dragItem,
13042
+ dragIndex
13043
+ },
13044
+ initialCoords
13045
+ );
13046
+ if (dragItemNode && useProxy) {
13047
+ const rect = dragItemNode.getBoundingClientRect();
13048
+ let cachedProxy = null;
13049
+ const setupParams = {
13050
+ dragItemNode,
13051
+ dragItemId: `${dragItemId}`,
13052
+ initialRect: rect,
13053
+ initialCoords,
13054
+ get proxyElement() {
13055
+ if (!cachedProxy) {
13056
+ cachedProxy = createDefaultProxy(dragItemNode, rect);
13057
+ }
13058
+ return cachedProxy;
13059
+ }
13060
+ };
13061
+ const setupResult = onDragProxySetup?.(setupParams);
13062
+ const proxyElement = setupResult?.proxyElement ?? setupParams.proxyElement;
13063
+ dragItemNode.style.visibility = "hidden";
13064
+ proxyStateRef.current = {
13065
+ proxyElement,
13066
+ originalNode: dragItemNode,
13067
+ dragItemId: `${dragItemId}`,
13068
+ initialRect: rect,
13069
+ cleanup: setupResult?.cleanup
13070
+ };
13071
+ }
13072
+ if (dragItemNode && useRenderProxy) {
13073
+ const rect = dragItemNode.getBoundingClientRect();
13074
+ dragItemNode.style.visibility = "hidden";
13075
+ proxyStateRef.current = {
13076
+ proxyElement: dragItemNode,
13077
+ originalNode: dragItemNode,
13078
+ dragItemId: `${dragItemId}`,
13079
+ initialRect: rect,
13080
+ // Portal handles its own DOM; only restore visibility.
13081
+ cleanup: () => {
13082
+ }
13083
+ };
13084
+ const initialRenderState = {
13085
+ dragItemId: `${dragItemId}`,
13086
+ initialRect: rect,
13087
+ dx: 0,
13088
+ dy: 0
13089
+ };
13090
+ updateDragProxyRenderState(() => initialRenderState);
13091
+ }
13092
+ }
13093
+ const dx = e2.clientX - initialCoords.left;
13094
+ const dy = e2.clientY - initialCoords.top;
13095
+ if (useRenderProxy) {
13096
+ updateDragProxyRenderState((prev) => prev ? { ...prev, dx, dy } : prev);
13097
+ } else {
13098
+ const proxyState = proxyStateRef.current;
13099
+ if (proxyState) {
13100
+ proxyMove({ proxyElement: proxyState.proxyElement, dx, dy });
13101
+ }
13102
+ }
13103
+ autoScroller.updatePointer({
13104
+ left: e2.clientX,
13105
+ top: e2.clientY
13106
+ });
13107
+ fireDragMove();
13108
+ };
13109
+ const preventNativeDrag = (e2) => {
13110
+ e2.preventDefault();
13111
+ };
13112
+ const endDrag = (cancelled) => {
13113
+ autoScroller.stop();
13114
+ scrollContainer?.removeEventListener("scroll", onContainerScroll);
13115
+ win.removeEventListener("pointermove", onPointerMove);
13116
+ win.removeEventListener("pointerup", onPointerUp);
13117
+ win.removeEventListener("pointercancel", onPointerCancel);
13118
+ win.removeEventListener("dragstart", preventNativeDrag, true);
13119
+ if (useRenderProxy) {
13120
+ updateDragProxyRenderState(
13121
+ (prev) => prev ? { ...prev, dragItemId: null } : prev
13122
+ );
13123
+ requestAnimationFrame(() => {
13124
+ updateDragProxyRenderState(RETURN_NULL);
13125
+ });
13126
+ }
13127
+ if (!dragOperation) {
13128
+ cleanupProxy(proxyStateRef);
13129
+ setInteractionTarget(null);
13130
+ return;
13131
+ }
13132
+ if (cancelled) {
13133
+ dragOperation.cancel();
13134
+ } else {
13135
+ dragOperation.drop();
13136
+ }
13137
+ dragOperation = null;
13138
+ };
13139
+ const onPointerUp = () => endDrag(false);
13140
+ const onPointerCancel = () => endDrag(true);
13141
+ const win = getGlobal();
13142
+ win.addEventListener("pointermove", onPointerMove);
13143
+ win.addEventListener("pointerup", onPointerUp);
13144
+ win.addEventListener("pointercancel", onPointerCancel);
13145
+ win.addEventListener("dragstart", preventNativeDrag, true);
13146
+ }
13147
+
13148
+ // src/components/InfiniteTable/components/draggable/DragList.tsx
13149
+ var DragListContext = React31.createContext({
13150
+ dragItemId: null,
13151
+ onDragItemPointerDown: () => {
13152
+ },
13153
+ draggingInProgress: false,
13154
+ dragListId: "",
13155
+ status: "accepted",
13156
+ dragSourceListId: null,
13157
+ dropTargetListId: null
13158
+ });
13159
+ var useDragListContext = () => {
13160
+ return React31.useContext(DragListContext);
13161
+ };
13162
+ function useInteractionTarget(domRef, props) {
13163
+ const getProps = useLatest(props);
13164
+ const [interactionTarget, doSetInteractionTarget] = React31.useState(null);
13165
+ const registeredTargetRef = React31.useRef(null);
13166
+ const setInteractionTarget = useCallback17(
13167
+ (interactionTarget2) => {
13168
+ replaceRegisteredInteractionTarget(
13169
+ registeredTargetRef,
13170
+ interactionTarget2
13171
+ );
13172
+ doSetInteractionTarget(interactionTarget2);
13173
+ },
13174
+ []
13175
+ );
13176
+ const getInteractionTarget = useLatest(interactionTarget);
13177
+ useEffect11(() => {
13178
+ return () => {
13179
+ DragManager.unregisterDragInteractionTarget(registeredTargetRef.current);
13180
+ registeredTargetRef.current = null;
13181
+ };
13182
+ }, []);
13183
+ useEffect11(() => {
13184
+ return acceptDragsFromOtherLists({
13185
+ getProps,
13186
+ domRef,
13187
+ setInteractionTarget
13188
+ });
13189
+ }, [getProps]);
13190
+ return {
13191
+ interactionTarget,
13192
+ setInteractionTarget,
13193
+ getInteractionTarget
13194
+ };
13195
+ }
12732
13196
  var DragList = (props) => {
12733
13197
  const domRef = React31.useRef(null);
12734
13198
  const proxyStateRef = React31.useRef(null);
@@ -12751,375 +13215,42 @@ var DragList = (props) => {
12751
13215
  props
12752
13216
  );
12753
13217
  useEffect11(() => {
12754
- const dragList = document.querySelector(
12755
- `[${DRAG_LIST_ATTRIBUTE}="${props.dragListId}"]`
12756
- );
12757
- if (dragList) {
12758
- domRef.current = dragList;
12759
- } else {
12760
- console.warn(
12761
- `DragList with id "${props.dragListId}" not found. You're probably not spreading the domProps to the parent element. Make sure you also include the "className" prop.`
12762
- );
12763
- }
13218
+ findDragListElement(domRef, props.dragListId);
12764
13219
  }, [props.dragListId]);
12765
13220
  useEffect11(() => {
12766
13221
  if (interactionTarget) {
12767
- const dragListId = props.dragListId;
12768
- const removeOnDragStart = interactionTarget.on(
12769
- "start",
12770
- ({ dragItem, dragSourceListId: dragSourceListId2, dropTargetListId: dropTargetListId2 }) => {
12771
- updateDragOperationSourceAndTarget({
12772
- dragSourceListId: dragSourceListId2,
12773
- dropTargetListId: dropTargetListId2,
12774
- dragItemId: dragItem.id,
12775
- status: "accepted"
12776
- });
12777
- }
12778
- );
12779
- const removeOnDragMove = interactionTarget.on(
12780
- "move",
12781
- ({ offsetsForItems, items, status: status2, dragItem }) => {
12782
- if (status2 === "rejected") {
12783
- return;
12784
- }
12785
- const dragItems = getDragItems();
12786
- const updatePosition = getUpdatePosition();
12787
- const proxyState = proxyStateRef.current;
12788
- items.forEach((item, index) => {
12789
- let offset = offsetsForItems[index];
12790
- const node = dragItems[index];
12791
- if (!node) {
12792
- return;
12793
- }
12794
- if (proxyState && item.id === proxyState.dragItemId) {
12795
- return;
12796
- }
12797
- if (!proxyState && item.id === dragItem.id) {
12798
- const scrollOffset = sourceScrollOffsetRef.current;
12799
- offset = {
12800
- left: offset.left + scrollOffset.left,
12801
- top: offset.top + scrollOffset.top
12802
- };
12803
- }
12804
- updatePosition({
12805
- id: item.id,
12806
- node,
12807
- offset
12808
- });
12809
- });
12810
- }
12811
- );
12812
- const removeOnDragDrop = interactionTarget.on("drop", (params) => {
12813
- const {
12814
- sortedIndexes,
12815
- dragIndex,
12816
- dropIndex,
12817
- dragItem,
12818
- items,
12819
- dragSourceListId: dragSourceListId2,
12820
- dropTargetListId: dropTargetListId2,
12821
- outside,
12822
- status: status2
12823
- } = params;
12824
- const dragItems = getDragItems();
12825
- dragItemsRef.current = [];
12826
- const onAcceptDrop = getOnAcceptDrop();
12827
- const onRemove = getOnRemove();
12828
- const onDrop = getOnDrop();
12829
- const updatePosition = getUpdatePosition();
12830
- items.forEach((item, index) => {
12831
- const node = dragItems[index];
12832
- if (!node) {
12833
- return;
12834
- }
12835
- updatePosition({
12836
- id: item.id,
12837
- node,
12838
- offset: null
12839
- });
12840
- });
12841
- cleanupProxy(proxyStateRef);
12842
- setDragProxyRenderState((prev) => {
12843
- if (!prev) return prev;
12844
- requestAnimationFrame(() => setDragProxyRenderState(null));
12845
- return { ...prev, dragItemId: null };
12846
- });
12847
- const accepted = status2 === "accepted";
12848
- if (dragListId === dropTargetListId2 && dragSourceListId2 !== dragListId) {
12849
- if (onAcceptDrop && accepted) {
12850
- onAcceptDrop({
12851
- dragItemId: dragItem.id,
12852
- dragSourceListId: dragSourceListId2,
12853
- dropTargetListId: dropTargetListId2,
12854
- dragIndex,
12855
- dropIndex,
12856
- dropItemId: items[dropIndex]?.id
12857
- });
12858
- }
12859
- }
12860
- let callbackFn = null;
12861
- if (dropIndex === -1 && dragSourceListId2 === dragListId && dropTargetListId2 === dragListId && outside) {
12862
- callbackFn = onRemove;
12863
- }
12864
- if (dropIndex !== -1 && dropTargetListId2 === dragListId && dragSourceListId2 === dragListId) {
12865
- callbackFn = onDrop;
12866
- }
12867
- if (callbackFn) {
12868
- callbackFn?.(sortedIndexes, {
12869
- dragIndex,
12870
- dropIndex,
12871
- dragItemId: items[dragIndex].id,
12872
- dropItemId: items[dropIndex]?.id
12873
- });
12874
- }
13222
+ return bindInteractionTarget(interactionTarget, {
13223
+ dragListId: props.dragListId,
13224
+ orientation: props.orientation,
13225
+ domRef,
13226
+ proxyStateRef,
13227
+ sourceScrollOffsetRef,
13228
+ dragItemsRef,
13229
+ getDragItems,
13230
+ getOnDrop,
13231
+ getOnAcceptDrop,
13232
+ getOnRemove,
13233
+ getUpdatePosition,
13234
+ updateDragOperationSourceAndTarget,
13235
+ updateDragProxyRenderState: setDragProxyRenderState
12875
13236
  });
12876
- let targetAutoScroller = null;
12877
- let targetScrollContainer = null;
12878
- let targetScrollHandler = null;
12879
- let targetPointermoveHandler = null;
12880
- if (!interactionTarget.getData().initial && domRef.current) {
12881
- targetAutoScroller = new AutoScroller({
12882
- orientation: props.orientation,
12883
- onScroll: () => {
12884
- }
12885
- });
12886
- targetAutoScroller.start(domRef.current);
12887
- targetScrollContainer = targetAutoScroller.getScrollContainer();
12888
- if (targetScrollContainer) {
12889
- let lastScroll = props.orientation === "vertical" ? targetScrollContainer.scrollTop : targetScrollContainer.scrollLeft;
12890
- targetScrollHandler = () => {
12891
- const current = props.orientation === "vertical" ? targetScrollContainer.scrollTop : targetScrollContainer.scrollLeft;
12892
- const delta = current - lastScroll;
12893
- lastScroll = current;
12894
- if (delta !== 0) {
12895
- interactionTarget.adjustForScroll(delta);
12896
- DragManager.retriggerMove();
12897
- }
12898
- };
12899
- targetScrollContainer.addEventListener("scroll", targetScrollHandler);
12900
- }
12901
- targetPointermoveHandler = (e) => {
12902
- targetAutoScroller.updatePointer({
12903
- left: e.clientX,
12904
- top: e.clientY
12905
- });
12906
- };
12907
- getGlobal().addEventListener("pointermove", targetPointermoveHandler);
12908
- }
12909
- return () => {
12910
- removeOnDragStart();
12911
- removeOnDragMove();
12912
- removeOnDragDrop();
12913
- if (targetAutoScroller) {
12914
- targetAutoScroller.stop();
12915
- }
12916
- if (targetScrollContainer && targetScrollHandler) {
12917
- targetScrollContainer.removeEventListener(
12918
- "scroll",
12919
- targetScrollHandler
12920
- );
12921
- }
12922
- if (targetPointermoveHandler) {
12923
- getGlobal().removeEventListener(
12924
- "pointermove",
12925
- targetPointermoveHandler
12926
- );
12927
- }
12928
- };
12929
13237
  }
12930
13238
  return void 0;
12931
13239
  }, [interactionTarget, props.dragListId]);
12932
13240
  const dragItemsRef = React31.useRef([]);
12933
13241
  const getDragItems = useCallback17(() => {
12934
- let dragItems = dragItemsRef.current;
12935
- if (!dragItems || dragItems.length === 0) {
12936
- dragItems = getDraggableItemNodes(domRef, props.dragListId);
12937
- dragItemsRef.current = dragItems;
12938
- }
12939
- return dragItems;
13242
+ return getDragItemNodes(dragItemsRef, domRef, props.dragListId);
12940
13243
  }, [props.dragListId]);
12941
13244
  const onDragItemPointerDown = useCallback17(
12942
13245
  (e) => {
12943
- const target = e.currentTarget;
12944
- let dragItemId2 = target.getAttribute(DRAG_ITEM_ATTRIBUTE);
12945
- if (dragItemId2 == null) {
12946
- const parentDragItem = selectParent(target, DRAG_ITEM_SELECTOR);
12947
- if (parentDragItem) {
12948
- dragItemId2 = parentDragItem.getAttribute(DRAG_ITEM_ATTRIBUTE);
12949
- }
12950
- }
12951
- if (dragItemId2 == null) {
12952
- console.warn(
12953
- `Could not find drag item id for element`,
12954
- target,
12955
- `Make sure you have a parent element with a ${DRAG_ITEM_ATTRIBUTE} attribute`
12956
- );
12957
- return;
12958
- }
12959
- dragItemId2 = `${dragItemId2}`;
12960
- let dragOperation = null;
12961
- const dragItems = getDraggableItemNodes(domRef, props.dragListId);
12962
- dragItemsRef.current = dragItems;
12963
- const interactionTarget2 = createInteractionTarget({
13246
+ startDragOnPointerDown(e, props, {
12964
13247
  domRef,
12965
- orientation: props.orientation,
12966
- dragListId: props.dragListId,
12967
- acceptDropsFrom: props.acceptDropsFrom,
12968
- initial: true,
12969
- preserveDragSpace: props.preserveDragSpace
12970
- });
12971
- const draggableItems = interactionTarget2.getData().draggableItems;
12972
- const dragIndex = draggableItems.findIndex(
12973
- (item) => item.id === dragItemId2
12974
- );
12975
- if (dragIndex === -1) {
12976
- return;
12977
- }
12978
- const dragItem = draggableItems[dragIndex];
12979
- const dragItemNode = dragItems[dragIndex]?.getAttribute(DRAG_ITEM_ATTRIBUTE) === `${dragItemId2}` ? dragItems[dragIndex] : dragItems.find(
12980
- (node) => node.getAttribute(DRAG_ITEM_ATTRIBUTE) === `${dragItemId2}`
12981
- );
12982
- setInteractionTarget(interactionTarget2);
12983
- const initialCoords = {
12984
- left: e.clientX,
12985
- top: e.clientY
12986
- };
12987
- let lastPointer = { left: e.clientX, top: e.clientY };
12988
- sourceScrollOffsetRef.current = { top: 0, left: 0 };
12989
- const autoScroller = new AutoScroller({
12990
- orientation: props.orientation,
12991
- onScroll: () => {
12992
- }
13248
+ proxyStateRef,
13249
+ sourceScrollOffsetRef,
13250
+ dragItemsRef,
13251
+ setInteractionTarget,
13252
+ updateDragProxyRenderState: setDragProxyRenderState
12993
13253
  });
12994
- if (domRef.current) {
12995
- autoScroller.start(domRef.current);
12996
- }
12997
- const scrollContainer = autoScroller.getScrollContainer();
12998
- let lastSourceScroll = scrollContainer ? props.orientation === "vertical" ? scrollContainer.scrollTop : scrollContainer.scrollLeft : 0;
12999
- function fireDragMove() {
13000
- if (!dragOperation) return;
13001
- dragOperation.move({
13002
- left: lastPointer.left,
13003
- top: lastPointer.top
13004
- });
13005
- }
13006
- const onContainerScroll = () => {
13007
- if (!scrollContainer) return;
13008
- const current = props.orientation === "vertical" ? scrollContainer.scrollTop : scrollContainer.scrollLeft;
13009
- const delta = current - lastSourceScroll;
13010
- lastSourceScroll = current;
13011
- if (delta !== 0) {
13012
- interactionTarget2.adjustForScroll(delta);
13013
- if (props.orientation === "vertical") {
13014
- sourceScrollOffsetRef.current.top += delta;
13015
- } else {
13016
- sourceScrollOffsetRef.current.left += delta;
13017
- }
13018
- }
13019
- fireDragMove();
13020
- };
13021
- scrollContainer?.addEventListener("scroll", onContainerScroll);
13022
- const dragStrategy = props.dragStrategy ?? "proxy";
13023
- const useProxy = dragStrategy === "proxy" && !props.renderDragProxy;
13024
- const useRenderProxy = dragStrategy === "proxy" && !!props.renderDragProxy;
13025
- const proxyMove = props.onDragProxyMove ?? defaultDragProxyMove;
13026
- const onPointerMove = (e2) => {
13027
- lastPointer = { left: e2.clientX, top: e2.clientY };
13028
- if (!dragOperation) {
13029
- dragOperation = DragManager.startDrag(
13030
- {
13031
- listId: props.dragListId,
13032
- dragItem,
13033
- dragIndex
13034
- },
13035
- initialCoords
13036
- );
13037
- if (dragItemNode && useProxy) {
13038
- const rect = dragItemNode.getBoundingClientRect();
13039
- let cachedProxy = null;
13040
- const setupParams = {
13041
- dragItemNode,
13042
- dragItemId: `${dragItemId2}`,
13043
- initialRect: rect,
13044
- initialCoords,
13045
- get proxyElement() {
13046
- if (!cachedProxy) {
13047
- cachedProxy = createDefaultProxy(dragItemNode, rect);
13048
- }
13049
- return cachedProxy;
13050
- }
13051
- };
13052
- const setupResult = props.onDragProxySetup?.(setupParams);
13053
- const proxyElement = setupResult?.proxyElement ?? setupParams.proxyElement;
13054
- dragItemNode.style.visibility = "hidden";
13055
- proxyStateRef.current = {
13056
- proxyElement,
13057
- originalNode: dragItemNode,
13058
- dragItemId: `${dragItemId2}`,
13059
- initialRect: rect,
13060
- cleanup: setupResult?.cleanup
13061
- };
13062
- }
13063
- if (dragItemNode && useRenderProxy) {
13064
- const rect = dragItemNode.getBoundingClientRect();
13065
- dragItemNode.style.visibility = "hidden";
13066
- proxyStateRef.current = {
13067
- proxyElement: dragItemNode,
13068
- originalNode: dragItemNode,
13069
- dragItemId: `${dragItemId2}`,
13070
- initialRect: rect,
13071
- // Portal handles its own DOM; only restore visibility.
13072
- cleanup: () => {
13073
- }
13074
- };
13075
- setDragProxyRenderState({
13076
- dragItemId: `${dragItemId2}`,
13077
- initialRect: rect,
13078
- dx: 0,
13079
- dy: 0
13080
- });
13081
- }
13082
- }
13083
- const dx = e2.clientX - initialCoords.left;
13084
- const dy = e2.clientY - initialCoords.top;
13085
- if (useRenderProxy) {
13086
- setDragProxyRenderState(
13087
- (prev) => prev ? { ...prev, dx, dy } : prev
13088
- );
13089
- } else {
13090
- const proxyState = proxyStateRef.current;
13091
- if (proxyState) {
13092
- proxyMove({ proxyElement: proxyState.proxyElement, dx, dy });
13093
- }
13094
- }
13095
- autoScroller.updatePointer({
13096
- left: e2.clientX,
13097
- top: e2.clientY
13098
- });
13099
- fireDragMove();
13100
- };
13101
- const onPointerUp = () => {
13102
- autoScroller.stop();
13103
- scrollContainer?.removeEventListener("scroll", onContainerScroll);
13104
- getGlobal().removeEventListener("pointermove", onPointerMove);
13105
- if (useRenderProxy) {
13106
- setDragProxyRenderState(
13107
- (prev) => prev ? { ...prev, dragItemId: null } : prev
13108
- );
13109
- requestAnimationFrame(() => {
13110
- setDragProxyRenderState(null);
13111
- });
13112
- }
13113
- if (!dragOperation) {
13114
- cleanupProxy(proxyStateRef);
13115
- setInteractionTarget(null);
13116
- return;
13117
- }
13118
- dragOperation.drop();
13119
- dragOperation = null;
13120
- };
13121
- getGlobal().addEventListener("pointermove", onPointerMove);
13122
- getGlobal().addEventListener("pointerup", onPointerUp, { once: true });
13123
13254
  },
13124
13255
  [
13125
13256
  props.orientation,
@@ -13169,10 +13300,6 @@ var DragList = (props) => {
13169
13300
  ref: proxyRefCallback
13170
13301
  }) : null);
13171
13302
  };
13172
- var DRAG_LIST_ATTRIBUTE = "data-drag-list-id";
13173
- var DRAG_ITEM_ATTRIBUTE = "data-drag-item-id";
13174
- var DRAG_ITEM_LIST_ATTRIBUTE = "data-drag-item-list-id";
13175
- var DRAG_ITEM_SELECTOR = `[${DRAG_ITEM_ATTRIBUTE}]`;
13176
13303
  var DragItemContext = React31.createContext({
13177
13304
  dragItemId: "",
13178
13305
  dragListId: "",
@@ -14586,13 +14713,13 @@ var MatrixBrain = class extends Logger {
14586
14713
  * transforms that follow the scroll position should use.
14587
14714
  */
14588
14715
  getDOMScrollPosition(scrollPosition = this.getScrollPosition()) {
14589
- const origin2 = this.getScrollOrigin();
14590
- if (!origin2.scrollTop && !origin2.scrollLeft) {
14716
+ const origin = this.getScrollOrigin();
14717
+ if (!origin.scrollTop && !origin.scrollLeft) {
14591
14718
  return scrollPosition;
14592
14719
  }
14593
14720
  return {
14594
- scrollTop: scrollPosition.scrollTop - origin2.scrollTop,
14595
- scrollLeft: scrollPosition.scrollLeft - origin2.scrollLeft
14721
+ scrollTop: scrollPosition.scrollTop - origin.scrollTop,
14722
+ scrollLeft: scrollPosition.scrollLeft - origin.scrollLeft
14596
14723
  };
14597
14724
  }
14598
14725
  // a method (not an arrow property) so subclasses can call it via super
@@ -14626,8 +14753,8 @@ var MatrixBrain = class extends Logger {
14626
14753
  if (this.destroyed) {
14627
14754
  return;
14628
14755
  }
14629
- const origin2 = this.getScrollOrigin();
14630
- this.onScrollOriginChangeFns.forEach((fn) => fn(origin2));
14756
+ const origin = this.getScrollOrigin();
14757
+ this.onScrollOriginChangeFns.forEach((fn) => fn(origin));
14631
14758
  }
14632
14759
  doUpdateRenderCount(which = ALL_DIRECTIONS) {
14633
14760
  if (!this.availableWidth || !this.availableHeight) {
@@ -18176,11 +18303,12 @@ function InfiniteTableInternalHeaderFn(props) {
18176
18303
  dataSourceStatePartialForHeaderCell
18177
18304
  ]
18178
18305
  );
18306
+ const headerDragListId = useDragListId(HEADER_DRAG_LIST_NAME);
18179
18307
  return /* @__PURE__ */ React46.createElement(
18180
18308
  DragList,
18181
18309
  {
18182
18310
  orientation: "horizontal",
18183
- dragListId: "header",
18311
+ dragListId: headerDragListId,
18184
18312
  dragStrategy: "inline",
18185
18313
  onDrop: emptyFn3,
18186
18314
  updatePosition: emptyFn3
@@ -18450,7 +18578,7 @@ function InfiniteTableHeaderCellFn(props) {
18450
18578
  filterDelay
18451
18579
  } = props;
18452
18580
  const { allRowsSelected, someRowsSelected, selectionMode } = dataSourceStatePartialForHeaderCell;
18453
- const { onDragItemPointerDown } = useDragListContext();
18581
+ const { onDragItemPointerDown, dragListId } = useDragListContext();
18454
18582
  const {
18455
18583
  api,
18456
18584
  getComputed,
@@ -18749,7 +18877,7 @@ function InfiniteTableHeaderCellFn(props) {
18749
18877
  "data-field": `${column.field || ""}`,
18750
18878
  "data-column-id": column.id,
18751
18879
  [DRAG_ITEM_ATTRIBUTE]: column.id,
18752
- [DRAG_ITEM_LIST_ATTRIBUTE]: "header",
18880
+ [DRAG_ITEM_LIST_ATTRIBUTE]: dragListId,
18753
18881
  "data-header-align": align2,
18754
18882
  "data-name": "HeaderCell",
18755
18883
  "data-sort": column.computedSortedAsc ? "asc" : column.computedSortedDesc ? "desc" : "none",
@@ -18880,25 +19008,40 @@ function decamelize(str, options) {
18880
19008
  ).toLowerCase();
18881
19009
  }
18882
19010
 
18883
- // src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
18884
- var defaultStyle = {
19011
+ // src/components/InfiniteTable/components/InfiniteTableLicenseFooter/licenseFooterShared.ts
19012
+ var LICENSE_FOOTER_LINK = "https://infinite-table.com";
19013
+ var LICENSE_FOOTER_INVALID_MESSAGE = "Invalid Infinite Table license. See console for details.";
19014
+ var baseFooterStyle = {
18885
19015
  padding: ThemeVars.spacing[2],
18886
19016
  textAlign: "end",
18887
19017
  opacity: "1",
18888
19018
  visibility: "visible",
18889
19019
  display: "block",
18890
- fontSize: "0.85rem",
19020
+ fontSize: "0.85rem"
19021
+ };
19022
+ var missingFooterStyle = {
19023
+ ...baseFooterStyle,
18891
19024
  background: "white",
18892
19025
  color: "black"
18893
19026
  };
18894
- var anchorStyle = {
18895
- opacity: 1,
19027
+ var invalidFooterStyle = {
19028
+ ...baseFooterStyle,
19029
+ // pale red, with dark red text
19030
+ background: "#fee2e2",
19031
+ color: "#991b1b"
19032
+ };
19033
+ var baseAnchorStyle = {
19034
+ opacity: "1",
18896
19035
  visibility: "visible",
18897
19036
  display: "inline-block",
18898
19037
  pointerEvents: "all",
18899
- color: "black",
18900
19038
  textDecoration: "underline"
18901
19039
  };
19040
+ var missingAnchorStyle = { ...baseAnchorStyle, color: "black" };
19041
+ var invalidAnchorStyle = { ...baseAnchorStyle, color: "#991b1b" };
19042
+ function getLicenseFooterStyles(invalid) {
19043
+ return invalid ? { footer: invalidFooterStyle, anchor: invalidAnchorStyle } : { footer: missingFooterStyle, anchor: missingAnchorStyle };
19044
+ }
18902
19045
  var enforceStyle = (node, style2) => {
18903
19046
  if (!node) {
18904
19047
  return;
@@ -18911,8 +19054,26 @@ var enforceStyle = (node, style2) => {
18911
19054
  );
18912
19055
  }
18913
19056
  };
19057
+ function enforceLicenseFooterStyle(getNode, invalid) {
19058
+ const styles = getLicenseFooterStyles(invalid);
19059
+ const forceStyle = () => {
19060
+ setTimeout(() => {
19061
+ const node = getNode();
19062
+ enforceStyle(node, styles.footer);
19063
+ enforceStyle(node?.querySelector("a") ?? null, styles.anchor);
19064
+ });
19065
+ };
19066
+ forceStyle();
19067
+ const intervalId = setInterval(forceStyle, 1e3);
19068
+ return () => {
19069
+ clearInterval(intervalId);
19070
+ };
19071
+ }
19072
+
19073
+ // src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
18914
19074
  var InfiniteTableLicenseFooter = React50.forwardRef(
18915
19075
  function InfiniteTableLicenseFooter2(props, ref) {
19076
+ const { invalid = false, ...domProps } = props;
18916
19077
  const { rootClassName: rootClassName12 } = useInternalProps();
18917
19078
  const domRef = React50.useRef(null);
18918
19079
  const domCallback = React50.useCallback((node) => {
@@ -18927,42 +19088,33 @@ var InfiniteTableLicenseFooter = React50.forwardRef(
18927
19088
  }
18928
19089
  }, []);
18929
19090
  useEffect18(() => {
18930
- const forceStyle = () => {
18931
- setTimeout(() => {
18932
- enforceStyle(domRef.current, defaultStyle);
18933
- enforceStyle(
18934
- domRef.current?.firstElementChild,
18935
- anchorStyle
18936
- );
18937
- });
18938
- };
18939
- forceStyle();
18940
- const intervalId = setInterval(forceStyle, 1e3);
18941
- return () => {
18942
- clearInterval(intervalId);
18943
- };
18944
- }, []);
19091
+ return enforceLicenseFooterStyle(() => domRef.current, invalid);
19092
+ }, [invalid]);
19093
+ const styles = getLicenseFooterStyles(invalid);
18945
19094
  return /* @__PURE__ */ React50.createElement(
18946
19095
  "div",
18947
19096
  {
18948
19097
  ref: domCallback,
18949
- ...props,
19098
+ ...domProps,
18950
19099
  className: join(
18951
19100
  `${rootClassName12}-Footer`,
19101
+ invalid ? `${rootClassName12}-Footer--invalid` : null,
18952
19102
  FooterCls,
18953
- props.className
19103
+ domProps.className
18954
19104
  ),
18955
- style: defaultStyle
19105
+ style: styles.footer
18956
19106
  },
19107
+ invalid ? `${LICENSE_FOOTER_INVALID_MESSAGE} ` : null,
18957
19108
  "Powered by",
18958
19109
  " ",
18959
19110
  /* @__PURE__ */ React50.createElement(
18960
19111
  "a",
18961
19112
  {
18962
- href: "https://infinite-table.com",
19113
+ href: LICENSE_FOOTER_LINK,
18963
19114
  rel: "noopener noreferrer",
18964
19115
  role: "link",
18965
- target: "_blank"
19116
+ target: "_blank",
19117
+ style: styles.anchor
18966
19118
  },
18967
19119
  "Infinite Table"
18968
19120
  )
@@ -25927,6 +26079,7 @@ function concludeReducer(params) {
25927
26079
  } else {
25928
26080
  state.groupDeepMap = void 0;
25929
26081
  state.pivotColumns = void 0;
26082
+ state.pivotColumnGroups = void 0;
25930
26083
  state.groupRowsIndexesInDataArray = void 0;
25931
26084
  const arrayDifferentAfterSortStep = previousState.postSortDataArray != state.postSortDataArray;
25932
26085
  if (arrayDifferentAfterSortStep || groupsDepsChanged || selectionDepsChanged || rowDisabledStateDepsChanged || rowInfoReducersChanged) {
@@ -27588,7 +27741,9 @@ var forwardProps4 = (_setupState) => {
27588
27741
  pivotGrandTotalColumnPosition: 1,
27589
27742
  // groupRenderStrategy: (groupRenderStrategy) =>
27590
27743
  // groupRenderStrategy ?? 'multi-column',
27591
- licenseKey: (licenseKey) => licenseKey || "",
27744
+ // keep undefined - it means "use InfiniteTable.licenseKey", while an
27745
+ // empty string means "no license key"
27746
+ licenseKey: (licenseKey) => licenseKey,
27592
27747
  keyboardSelection: (keyboardSelection) => keyboardSelection ?? true,
27593
27748
  multiRowSelectionWith: (multiRowSelectionWith) => multiRowSelectionWith ?? "checkbox",
27594
27749
  activeRowIndex: 1,
@@ -27691,8 +27846,10 @@ function getMappedCallbacks2() {
27691
27846
  var mapPropsToState = (params) => {
27692
27847
  const { props, state, oldState, parentState } = params;
27693
27848
  const computedColumnGroups = state.pivotColumnGroups || state.columnGroups;
27694
- const columnGroupsDepthsMap = state.columnGroups && state.columnGroups != oldState?.columnGroups || state.columnGroups && state.columnGroupVisibility != oldState?.columnGroupVisibility || state.pivotColumnGroups && state.pivotColumnGroups != oldState?.pivotColumnGroups ? computeColumnGroupsDepths(
27695
- computedColumnGroups,
27849
+ const columnGroupsDepthsMap = state.columnGroups && state.columnGroups != oldState?.columnGroups || state.columnGroups && state.columnGroupVisibility != oldState?.columnGroupVisibility || // also when the pivot column groups go away, as the header has to go back
27850
+ // to the depth of `columnGroups` (or to a single row, when there are none)
27851
+ state.pivotColumnGroups != oldState?.pivotColumnGroups ? computeColumnGroupsDepths(
27852
+ computedColumnGroups ?? EMPTY_OBJECT,
27696
27853
  state.columnGroupVisibility
27697
27854
  ) : state.columnGroupsDepthsMap;
27698
27855
  const groupBy = parentState?.groupBy;
@@ -29196,7 +29353,7 @@ var logLicenseError = (lines, fn = console.error.bind(console)) => {
29196
29353
  });
29197
29354
  fn("*".repeat(max));
29198
29355
  };
29199
- var isValidLicense = (licenseKey = "", packageInfo, fn) => {
29356
+ var checkLicense = (licenseKey = "", packageInfo, fn) => {
29200
29357
  let details;
29201
29358
  try {
29202
29359
  details = decode(licenseKey);
@@ -29209,7 +29366,7 @@ var isValidLicense = (licenseKey = "", packageInfo, fn) => {
29209
29366
  ],
29210
29367
  fn
29211
29368
  );
29212
- return false;
29369
+ return "invalid";
29213
29370
  }
29214
29371
  const currentVersionReleaseDate = new Date(packageInfo.publishedAt);
29215
29372
  const licenseEndDate = new Date(details.end);
@@ -29225,14 +29382,16 @@ Your Infinite Table license has expired on ${licenseEndDate.toDateString()}.
29225
29382
  ],
29226
29383
  fn
29227
29384
  );
29228
- return false;
29385
+ return "expired";
29229
29386
  }
29230
- return true;
29387
+ return "valid";
29231
29388
  };
29232
29389
  var decode = (licenseKey) => {
29233
29390
  let crc = "";
29234
29391
  let fields = licenseKey.split("|").map((part) => {
29235
- let [name, value] = part.split("=");
29392
+ const separatorIndex = part.indexOf("=");
29393
+ const name = separatorIndex === -1 ? part : part.slice(0, separatorIndex);
29394
+ const value = separatorIndex === -1 ? "" : part.slice(separatorIndex + 1);
29236
29395
  if (name === "C") {
29237
29396
  crc = value;
29238
29397
  }
@@ -29269,40 +29428,29 @@ var decode = (licenseKey) => {
29269
29428
  return fieldsToLicenseDetails(fields);
29270
29429
  };
29271
29430
 
29431
+ // src/components/InfiniteTable/hooks/useLicense/getLicenseStatus.ts
29432
+ function getLicenseStatus(licenseKey = "", options) {
29433
+ if (options.isDetail) {
29434
+ return "valid";
29435
+ }
29436
+ const result = checkLicense(licenseKey, {
29437
+ publishedAt: 1794927344373,
29438
+ version: "10.2.0"
29439
+ });
29440
+ if (result === "invalid" && !licenseKey) {
29441
+ return "missing";
29442
+ }
29443
+ return result;
29444
+ }
29445
+
29272
29446
  // src/components/InfiniteTable/hooks/useLicense/useLicense.ts
29273
- var SANDPACK_REGEX = /(https):\/\/\d+\-\d+\-\d+\-(sandpack\.codesandbox\.io)/g;
29274
- var SANDBOX_REGEX = /(https):\/\/\S+(\.csb\.app)/g;
29275
- var origin = typeof window !== "undefined" ? window.location.origin : "";
29276
- var isInsideSandpack = () => {
29277
- const [_fullUrl, protocol, sandpackUrl] = Array.from(
29278
- SANDPACK_REGEX.exec(origin) || []
29279
- );
29280
- return protocol === "https" && sandpackUrl === "sandpack.codesandbox.io";
29281
- };
29282
- var isInsideSandbox = () => {
29283
- const [_fullUrl, protocol, sandboxUrl] = Array.from(
29284
- SANDBOX_REGEX.exec(origin) || []
29285
- );
29286
- return protocol === "https" && sandboxUrl === ".csb.app";
29287
- };
29288
- var isInsidePlayground = isInsideSandbox() || isInsideSandpack();
29289
29447
  var useLicense = (licenseKey = "") => {
29290
29448
  const masterRowInfo = useMasterRowInfo();
29291
29449
  const isDetail = !!masterRowInfo;
29292
- const valid = useMemo17(() => {
29293
- if (isDetail) {
29294
- return true;
29295
- }
29296
- let valid2 = isValidLicense(licenseKey, {
29297
- publishedAt: 1624970570587,
29298
- version: "10.1.5"
29299
- });
29300
- if (!licenseKey && !valid2 && isInsidePlayground) {
29301
- return true;
29302
- }
29303
- return valid2;
29304
- }, [licenseKey, isDetail]);
29305
- return valid;
29450
+ return useMemo17(
29451
+ () => getLicenseStatus(licenseKey, { isDetail }),
29452
+ [licenseKey, isDetail]
29453
+ );
29306
29454
  };
29307
29455
 
29308
29456
  // src/components/InfiniteTable/hooks/useScrollToActiveCell.ts
@@ -33178,7 +33326,7 @@ function useInfinitePortalContainer() {
33178
33326
 
33179
33327
  // src/components/InfiniteTable/components/GroupingToolbar/index.tsx
33180
33328
  import * as React73 from "react";
33181
- import { useCallback as useCallback33 } from "react";
33329
+ import { useCallback as useCallback33, useMemo as useMemo20 } from "react";
33182
33330
 
33183
33331
  // src/components/InfiniteTable/components/GroupingToolbar/index.css.ts
33184
33332
  var GroupingToolbarItemClearCls = "hs68h8j _16lm1iwk _16lm1iwx _16lm1iw2n";
@@ -33250,8 +33398,8 @@ var getFastClickHandler = (callback, prevHandler) => {
33250
33398
  };
33251
33399
  function GroupingToolbarItem(props) {
33252
33400
  const { column, onClear, components: components2, field, id, toggleSorting } = props;
33253
- const { dragSourceListId, dragItemId } = useDragListContext();
33254
- const draggingInProgress = dragSourceListId === GROUPING_TOOLBAR_DRAG_LIST_ID;
33401
+ const { dragSourceListId, dragItemId, dragListId } = useDragListContext();
33402
+ const draggingInProgress = dragSourceListId === dragListId;
33255
33403
  const context = useInfiniteTableStableContext();
33256
33404
  const columnHeader = (column ? getColumnLabel(column.id, context, "grouping-toolbar") : field) ?? id;
33257
33405
  const sortIcon = column ? /* @__PURE__ */ React73.createElement(
@@ -33263,7 +33411,7 @@ function GroupingToolbarItem(props) {
33263
33411
  }
33264
33412
  ) : null;
33265
33413
  const header = /* @__PURE__ */ React73.createElement(React73.Fragment, null, columnHeader, sortIcon);
33266
- const active = dragItemId === id && dragSourceListId === GROUPING_TOOLBAR_DRAG_LIST_ID;
33414
+ const active = dragItemId === id && dragSourceListId === dragListId;
33267
33415
  const className = join(
33268
33416
  GroupingToolbarItemRecipe({
33269
33417
  draggingInProgress,
@@ -33293,7 +33441,6 @@ function GroupingToolbarItem(props) {
33293
33441
  }
33294
33442
  );
33295
33443
  }
33296
- var GROUPING_TOOLBAR_DRAG_LIST_ID = "grouping-toolbar";
33297
33444
  function GroupingToolbar(props) {
33298
33445
  const { groupBy } = useDataSourceSelector((ctx) => {
33299
33446
  return {
@@ -33311,8 +33458,14 @@ function GroupingToolbar(props) {
33311
33458
  );
33312
33459
  const { dropTargetListId, dragSourceListId } = useDragDropProvider();
33313
33460
  const { fieldsToColumn, computedColumnsMap } = getComputed();
33314
- const active = dropTargetListId === GROUPING_TOOLBAR_DRAG_LIST_ID;
33315
- const draggingInProgress = dragSourceListId === GROUPING_TOOLBAR_DRAG_LIST_ID;
33461
+ const dragListId = useDragListId(GROUPING_TOOLBAR_DRAG_LIST_NAME);
33462
+ const headerDragListId = useDragListId(HEADER_DRAG_LIST_NAME);
33463
+ const acceptDropsFrom = useMemo20(
33464
+ () => [headerDragListId, dragListId],
33465
+ [headerDragListId, dragListId]
33466
+ );
33467
+ const active = dropTargetListId === dragListId;
33468
+ const draggingInProgress = dragSourceListId === dragListId;
33316
33469
  const PlaceholderComponent = props.components?.Placeholder ?? PlaceholderDefault;
33317
33470
  const HostComponent = props.components?.Host ?? HostDefault;
33318
33471
  const children = !groupBy.length ? /* @__PURE__ */ React73.createElement(
@@ -33385,8 +33538,8 @@ function GroupingToolbar(props) {
33385
33538
  DragList,
33386
33539
  {
33387
33540
  orientation,
33388
- dragListId: GROUPING_TOOLBAR_DRAG_LIST_ID,
33389
- acceptDropsFrom: ["header", GROUPING_TOOLBAR_DRAG_LIST_ID],
33541
+ dragListId,
33542
+ acceptDropsFrom,
33390
33543
  onDrop,
33391
33544
  dragStrategy: "inline",
33392
33545
  onAcceptDrop,
@@ -33426,7 +33579,7 @@ function GroupingToolbar(props) {
33426
33579
  import * as React78 from "react";
33427
33580
 
33428
33581
  // src/components/InfiniteTable/hooks/useCellRendering.tsx
33429
- import { useMemo as useMemo21 } from "react";
33582
+ import { useMemo as useMemo22 } from "react";
33430
33583
  import { useCallback as useCallback34, useEffect as useEffect39, useRef as useRef33 } from "react";
33431
33584
  import * as React75 from "react";
33432
33585
 
@@ -33471,7 +33624,7 @@ import * as React74 from "react";
33471
33624
  var RowDetailRecipe = createRuntimeFn({ defaultClassName: "evqes20", variantClassNames: {}, defaultVariants: {}, compoundVariants: [] });
33472
33625
 
33473
33626
  // src/components/InfiniteTable/components/InfiniteTableRow/useRegisterDetail.ts
33474
- import { useMemo as useMemo20 } from "react";
33627
+ import { useMemo as useMemo21 } from "react";
33475
33628
 
33476
33629
  // src/components/InfiniteTable/components/InfiniteTableRow/registerDetailShared.ts
33477
33630
  function restoreDetailStateForRowId(rowId, options) {
@@ -33599,11 +33752,11 @@ function useRegisterDetail(props) {
33599
33752
  getMasterState: ctx.getState
33600
33753
  };
33601
33754
  });
33602
- const { currentRowCache, cacheCalledByRowDetailRenderer } = useMemo20(
33755
+ const { currentRowCache, cacheCalledByRowDetailRenderer } = useMemo21(
33603
33756
  () => createCurrentRowCache(rowInfo.id, rowDetailsCache),
33604
33757
  [rowDetailsCache, rowInfo.id]
33605
33758
  );
33606
- const masterDetailContextValue = useMemo20(() => {
33759
+ const masterDetailContextValue = useMemo21(() => {
33607
33760
  return createMasterDetailContextValue({
33608
33761
  rowInfo,
33609
33762
  currentRowCache,
@@ -33747,7 +33900,7 @@ function useCellRendering(param) {
33747
33900
  toggleGroupRow,
33748
33901
  columnSize
33749
33902
  } = computed;
33750
- const visibleColumnIds = useMemo21(
33903
+ const visibleColumnIds = useMemo22(
33751
33904
  () => computedVisibleColumns.map((column) => column.id),
33752
33905
  [computedVisibleColumns]
33753
33906
  );
@@ -33849,7 +34002,7 @@ function useCellRendering(param) {
33849
34002
  onReady({ api: imperativeApi, dataSourceApi });
33850
34003
  }
33851
34004
  }, [ready]);
33852
- const dataSourceStatePartialForCell = useMemo21(() => {
34005
+ const dataSourceStatePartialForCell = useMemo22(() => {
33853
34006
  return {
33854
34007
  isNodeReadOnly: isNodeReadOnly2,
33855
34008
  selectionMode,
@@ -33975,7 +34128,7 @@ function useCellRendering(param) {
33975
34128
  dataSourceStatePartialForCell
33976
34129
  ]
33977
34130
  );
33978
- const renderDetailRow = useMemo21(() => {
34131
+ const renderDetailRow = useMemo22(() => {
33979
34132
  if (!isRowDetailsExpanded) {
33980
34133
  return void 0;
33981
34134
  }
@@ -34087,7 +34240,7 @@ function LoadMaskFn(props) {
34087
34240
  var LoadMask = React77.memo(LoadMaskFn);
34088
34241
 
34089
34242
  // src/components/InfiniteTable/components/InfiniteTableBody/index.tsx
34090
- import { useMemo as useMemo22 } from "react";
34243
+ import { useMemo as useMemo23 } from "react";
34091
34244
  var _HOVERED_CLASS_NAMES = [
34092
34245
  RowHoverCls,
34093
34246
  `${InfiniteTableColumnCellClassName}--hovered`
@@ -34204,7 +34357,7 @@ function InfiniteTableBody(props) {
34204
34357
  });
34205
34358
  const { autoFocus, tabIndex } = domProps ?? {};
34206
34359
  useToggleWrapRowsHorizontally();
34207
- const hoverClassNames = useMemo22(() => {
34360
+ const hoverClassNames = useMemo23(() => {
34208
34361
  if (!showHoverRows) {
34209
34362
  return void 0;
34210
34363
  }
@@ -34327,7 +34480,7 @@ var InfiniteTableComponent = React79.memo(
34327
34480
  activeCellIndex
34328
34481
  } = componentState;
34329
34482
  let { licenseKey } = componentState;
34330
- if (!licenseKey && InfiniteTable.licenseKey) {
34483
+ if (licenseKey === void 0 && InfiniteTable.licenseKey) {
34331
34484
  licenseKey = InfiniteTable.licenseKey;
34332
34485
  }
34333
34486
  useScrollToActiveRow(activeRowIndex, dataArrayLength, api);
@@ -34346,7 +34499,7 @@ var InfiniteTableComponent = React79.memo(
34346
34499
  );
34347
34500
  return brain.onVerticalRenderRangeChange(onChange);
34348
34501
  }, [brain, scrollStopDelay]);
34349
- const licenseValid = useLicense(licenseKey);
34502
+ const licenseStatus = useLicense(licenseKey);
34350
34503
  const {
34351
34504
  // remove autoFocus and tabIndex from the domProps
34352
34505
  // that will be spread on the root DOM element
@@ -34447,7 +34600,7 @@ var InfiniteTableComponent = React79.memo(
34447
34600
  onChange: onColumnHeaderHeightCSSVarChange
34448
34601
  }
34449
34602
  ) : null,
34450
- licenseValid ? null : /* @__PURE__ */ React79.createElement(InfiniteTableLicenseFooter, null),
34603
+ licenseStatus === "valid" ? null : /* @__PURE__ */ React79.createElement(InfiniteTableLicenseFooter, { invalid: licenseStatus === "invalid" }),
34451
34604
  /* @__PURE__ */ React79.createElement(FocusDetect, null)
34452
34605
  );
34453
34606
  }