@infinite-table/infinite-react 10.1.5 → 10.2.1

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
13248
+ proxyStateRef,
13249
+ sourceScrollOffsetRef,
13250
+ dragItemsRef,
13251
+ setInteractionTarget,
13252
+ updateDragProxyRenderState: setDragProxyRenderState
12970
13253
  });
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
- }
12993
- });
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) {
@@ -15363,6 +15490,7 @@ var ListRowManager = class extends Logger {
15363
15490
  var ITEM_POSITION_WITH_TRANSFORM = true;
15364
15491
  var currentTransformY = stripVar(InternalVars.y);
15365
15492
  var scrollTopCSSVar = stripVar(InternalVars.scrollTop);
15493
+ var scrollLeftCSSVar2 = stripVar(InternalVars.scrollLeft);
15366
15494
  var columnOffsetAtIndex2 = stripVar(InternalVars.columnOffsetAtIndex);
15367
15495
  var columnOffsetAtIndexWhileReordering2 = stripVar(
15368
15496
  InternalVars.columnOffsetAtIndexWhileReordering
@@ -15376,6 +15504,16 @@ var GridRenderer = class extends Logger {
15376
15504
  this.scrolling = false;
15377
15505
  this.cellHoverClassNames = [];
15378
15506
  this.cellDetachedClassNames = [];
15507
+ /**
15508
+ * Inside InfiniteTable, the table owns the CSS vars that position the
15509
+ * cells horizontally (one offset var per column, plus the scroll position
15510
+ * vars used by pinned cells) and sets them on its root node.
15511
+ *
15512
+ * A HeadlessTable used on its own has nobody to set them. With this on,
15513
+ * the renderer writes each cell's x from the brain, and sets the scroll
15514
+ * position vars itself, on the parent node of the cells.
15515
+ */
15516
+ this.ownsPositionVars = false;
15379
15517
  this.lastEnteredRow = -1;
15380
15518
  this.lastExitedRow = -1;
15381
15519
  this.hoverRowUpdatesInProgress = /* @__PURE__ */ new Map();
@@ -15395,26 +15533,30 @@ var GridRenderer = class extends Logger {
15395
15533
  element.style.transform = `translate3d(${scrollLeft2 || 0}px, var(${currentTransformY}), 0)`;
15396
15534
  };
15397
15535
  this.setTransform = (element, _rowIndex, colIndex, {
15398
- //@ts-ignore
15399
15536
  x,
15400
15537
  y,
15401
- //@ts-ignore
15402
15538
  scrollLeft: scrollLeft2,
15403
15539
  scrollTop: scrollTop2
15404
15540
  }, zIndex2) => {
15405
15541
  const columnOffsetX = InternalVarUtils.columnOffsets.get(colIndex);
15406
15542
  const columnOffsetXWhileReordering = `${columnOffsetAtIndexWhileReordering2}-${colIndex}`;
15407
- const currentTransformYValue = scrollTop2 ? `calc( ${y}px + var(${scrollTopCSSVar}) )` : `${y - this.brain.getScrollOrigin().scrollTop}px`;
15543
+ const currentTransformYValue = scrollTop2 ? `calc( ${y}px + var(${scrollTopCSSVar}, 0px) )` : `${y - this.brain.getScrollOrigin().scrollTop}px`;
15408
15544
  if (element.__currentTransformY !== currentTransformYValue) {
15409
15545
  element.__currentTransformY = currentTransformYValue;
15410
15546
  element.style.setProperty(currentTransformY, currentTransformYValue);
15411
15547
  }
15412
- const transformValue = `translate3d(var(${columnOffsetXWhileReordering}, ${columnOffsetX}), var(${currentTransformY}), 0)`;
15548
+ const transformX2 = this.ownsPositionVars ? scrollLeft2 ? `calc( ${x}px + var(${scrollLeftCSSVar2}, 0px) )` : `${x - this.brain.getScrollOrigin().scrollLeft}px` : `var(${columnOffsetXWhileReordering}, ${columnOffsetX})`;
15549
+ const transformValue = `translate3d(${transformX2}, var(${currentTransformY}), 0)`;
15413
15550
  if (element.__transformValue !== transformValue) {
15414
15551
  element.__transformValue = transformValue;
15415
15552
  element.style.transform = transformValue;
15416
15553
  }
15417
- if (zIndex2 != null) {
15554
+ if (zIndex2 != null && this.ownsPositionVars) {
15555
+ const zIndexValue = `${zIndex2}`;
15556
+ if (element.__zIndex !== zIndexValue) {
15557
+ element.__zIndex = zIndexValue;
15558
+ element.style.zIndex = zIndexValue;
15559
+ }
15418
15560
  }
15419
15561
  };
15420
15562
  /**
@@ -15435,6 +15577,17 @@ var GridRenderer = class extends Logger {
15435
15577
  });
15436
15578
  this.adjustFixedElementsOnScroll();
15437
15579
  };
15580
+ /**
15581
+ * While a render pass is in progress, the cells it detaches are collected
15582
+ * here and only get the detached class names when the pass ends - if they
15583
+ * are still detached by then.
15584
+ *
15585
+ * Most of the cells detached by a render pass (while scrolling, all of
15586
+ * them) are re-attached at another position by the same pass, so they
15587
+ * would get the class names added and then removed, with no visible effect
15588
+ * - only the cost of the DOM writes and of the style invalidations.
15589
+ */
15590
+ this.cellsDetachedInRenderPass = null;
15438
15591
  this.getFullyVisibleRowsRange = () => {
15439
15592
  let {
15440
15593
  start: [startRow],
@@ -15924,11 +16077,18 @@ var GridRenderer = class extends Logger {
15924
16077
  itemElement.dataset.rowIndex = realCoords.rowIndex;
15925
16078
  itemElement.dataset.colIndex = realCoords.colIndex;
15926
16079
  if (ITEM_POSITION_WITH_TRANSFORM) {
15927
- this.setTransform(itemElement, rowIndex, colIndex, { x, y }, null);
16080
+ const fixedPlacement = this.ownsPositionVars ? this.getFixedCellPlacement(rowIndex, colIndex, { x, y }) : null;
16081
+ this.setTransform(
16082
+ itemElement,
16083
+ rowIndex,
16084
+ colIndex,
16085
+ fixedPlacement ?? { x, y },
16086
+ null
16087
+ );
15928
16088
  itemElement.style.willChange = "transform";
15929
16089
  itemElement.style.backfaceVisibility = "hidden";
15930
16090
  const hidden = options ? options.hidden : !!this.isCellCovered(rowIndex, colIndex);
15931
- const zIndex2 = hidden ? "-1" : (
16091
+ const zIndex2 = hidden ? "-1" : fixedPlacement ? `${fixedPlacement.zIndex}` : (
15932
16092
  // #updatezindex - we need to allow elements use their own zIndex, so we
15933
16093
  // resort to allowing them to have it as a data-z-index attribute
15934
16094
  itemElement.dataset.zIndex || "auto"
@@ -16031,126 +16191,51 @@ var GridRenderer = class extends Logger {
16031
16191
  // fixed cells are positioned with these, inside the scroll layer
16032
16192
  // which is translated relative to the scroll origin
16033
16193
  brain.getDOMScrollPosition(scrollPosition),
16034
- this.getInfiniteNode(attachedCell.getElement())
16194
+ this.ownsPositionVars ? (
16195
+ // null on the first render pass, before the cells are in the DOM:
16196
+ // the cells fall back to a scroll position of 0 - see setTransform
16197
+ attachedCell.getElement()?.parentElement ?? null
16198
+ ) : this.getInfiniteNode(attachedCell.getElement())
16035
16199
  );
16036
16200
  }
16037
- const fixedEndColsOffsets = this.brain.getFixedEndColsOffsets({
16038
- skipScroll: true
16039
- });
16040
- const fixedEndRowsOffsets = this.brain.getFixedEndRowsOffsets({
16041
- skipScroll: true
16042
- });
16201
+ const fixedEndOffsets = {
16202
+ cols: this.brain.getFixedEndColsOffsets({ skipScroll: true }),
16203
+ rows: this.brain.getFixedEndRowsOffsets({ skipScroll: true })
16204
+ };
16043
16205
  const { start, end } = this.brain.getRenderRange();
16044
16206
  const [startRow, startCol] = start;
16045
16207
  const [endRow, endCol] = end;
16046
- function adjustElementPosition(rowIndex, colIndex, fn) {
16047
- const cell = cellManager.getCellAt([rowIndex, colIndex]);
16048
- if (cell == null) {
16208
+ const adjust = (rowIndex, colIndex) => {
16209
+ const node = cellManager.getCellAt([rowIndex, colIndex])?.getElement();
16210
+ const itemPosition = node ? brain.getCellOffset(rowIndex, colIndex) : null;
16211
+ if (!node || !itemPosition) {
16049
16212
  return;
16050
16213
  }
16051
- const itemPosition = brain.getCellOffset(rowIndex, colIndex);
16052
- const node = cell.getElement();
16053
- if (node && itemPosition) {
16054
- fn(rowIndex, colIndex, node, itemPosition);
16055
- }
16056
- }
16057
- const adjustColStart = (_rowIndex, colIndex, node, { x, y }) => {
16058
- this.setTransform(
16059
- node,
16060
- _rowIndex,
16061
- colIndex,
16062
- { x, y, scrollLeft: true },
16063
- fixedColsStart - colIndex
16064
- );
16065
- };
16066
- const adjustRowStart = (rowIndex, _colIndex, node, coords) => {
16067
- this.setTransform(
16068
- node,
16069
- rowIndex,
16070
- _colIndex,
16071
- { x: coords.x, y: coords.y, scrollTop: true },
16072
- fixedRowsStart - rowIndex
16073
- );
16074
- };
16075
- const adjustColEnd = (_rowIndex, colIndex, node, { y }) => {
16076
- const val = fixedEndColsOffsets[colIndex];
16077
- this.setTransform(
16078
- node,
16079
- _rowIndex,
16080
- colIndex,
16081
- { x: val, y, scrollLeft: true },
16082
- cols - colIndex
16083
- );
16084
- };
16085
- const adjustRowEnd = (rowIndex, _colIndex, node, coords) => {
16086
- this.setTransform(
16087
- node,
16088
- rowIndex,
16089
- _colIndex,
16090
- { x: coords.x, y: fixedEndRowsOffsets[rowIndex], scrollTop: true },
16091
- rows - rowIndex
16092
- );
16093
- };
16094
- const adjustColStartRowStart = (_rowIndex, _colIndex, node, { x, y }) => {
16095
- this.setTransform(
16096
- node,
16097
- _rowIndex,
16098
- _colIndex,
16099
- { x, scrollLeft: true, y, scrollTop: true },
16100
- 1e5
16101
- );
16102
- };
16103
- const adjustColStartRowEnd = (_rowIndex, _colIndex, node, { x }) => {
16104
- this.setTransform(
16105
- node,
16106
- _rowIndex,
16107
- _colIndex,
16108
- {
16109
- x,
16110
- scrollLeft: true,
16111
- y: fixedEndRowsOffsets[_rowIndex],
16112
- scrollTop: true
16113
- },
16114
- 2e5
16115
- );
16116
- };
16117
- const adjustColEndRowStart = (_rowIndex, colIndex, node, coords) => {
16118
- this.setTransform(
16119
- node,
16120
- _rowIndex,
16121
- colIndex,
16122
- {
16123
- x: fixedEndColsOffsets[colIndex],
16124
- y: coords.y,
16125
- scrollLeft: true,
16126
- scrollTop: true
16127
- },
16128
- 3e5
16129
- );
16130
- };
16131
- const adjustColEndRowEnd = (rowIndex, colIndex, node) => {
16132
- this.setTransform(
16133
- node,
16214
+ const placement = this.getFixedCellPlacement(
16134
16215
  rowIndex,
16135
16216
  colIndex,
16136
- {
16137
- x: fixedEndColsOffsets[colIndex],
16138
- y: fixedEndRowsOffsets[rowIndex],
16139
- scrollLeft: true,
16140
- scrollTop: true
16141
- },
16142
- 4e5
16217
+ itemPosition,
16218
+ fixedEndOffsets
16143
16219
  );
16220
+ if (placement) {
16221
+ this.setTransform(
16222
+ node,
16223
+ rowIndex,
16224
+ colIndex,
16225
+ placement,
16226
+ placement.zIndex
16227
+ );
16228
+ }
16144
16229
  };
16145
16230
  if (fixedColsStart || fixedColsEnd) {
16146
16231
  for (let rowIndex = startRow; rowIndex < endRow; rowIndex++) {
16147
16232
  for (let colIndex = 0; colIndex < fixedColsStart; colIndex++) {
16148
- adjustElementPosition(rowIndex, colIndex, adjustColStart);
16233
+ adjust(rowIndex, colIndex);
16149
16234
  }
16150
16235
  if (fixedColsEnd) {
16151
16236
  const firstColFixedEnd = cols - fixedColsEnd;
16152
16237
  for (let colIndex = firstColFixedEnd; colIndex < cols; colIndex++) {
16153
- adjustElementPosition(rowIndex, colIndex, adjustColEnd);
16238
+ adjust(rowIndex, colIndex);
16154
16239
  }
16155
16240
  }
16156
16241
  }
@@ -16158,12 +16243,12 @@ var GridRenderer = class extends Logger {
16158
16243
  if (fixedRowsStart || fixedRowsEnd) {
16159
16244
  for (let colIndex = startCol; colIndex < endCol; colIndex++) {
16160
16245
  for (let rowIndex = 0; rowIndex < fixedRowsStart; rowIndex++) {
16161
- adjustElementPosition(rowIndex, colIndex, adjustRowStart);
16246
+ adjust(rowIndex, colIndex);
16162
16247
  }
16163
16248
  if (fixedRowsEnd) {
16164
16249
  const firstRowFixedEnd = rows - fixedRowsEnd;
16165
16250
  for (let rowIndex = firstRowFixedEnd; rowIndex < rows; rowIndex++) {
16166
- adjustElementPosition(rowIndex, colIndex, adjustRowEnd);
16251
+ adjust(rowIndex, colIndex);
16167
16252
  }
16168
16253
  }
16169
16254
  }
@@ -16171,7 +16256,7 @@ var GridRenderer = class extends Logger {
16171
16256
  if (fixedColsStart && fixedRowsStart) {
16172
16257
  for (let rowIndex = 0; rowIndex < fixedRowsStart; rowIndex++) {
16173
16258
  for (let colIndex = 0; colIndex < fixedColsStart; colIndex++) {
16174
- adjustElementPosition(rowIndex, colIndex, adjustColStartRowStart);
16259
+ adjust(rowIndex, colIndex);
16175
16260
  }
16176
16261
  }
16177
16262
  }
@@ -16179,7 +16264,7 @@ var GridRenderer = class extends Logger {
16179
16264
  const firstRowFixedEnd = rows - fixedRowsEnd;
16180
16265
  for (let rowIndex = firstRowFixedEnd; rowIndex < rows; rowIndex++) {
16181
16266
  for (let colIndex = 0; colIndex < fixedColsStart; colIndex++) {
16182
- adjustElementPosition(rowIndex, colIndex, adjustColStartRowEnd);
16267
+ adjust(rowIndex, colIndex);
16183
16268
  }
16184
16269
  }
16185
16270
  }
@@ -16187,7 +16272,7 @@ var GridRenderer = class extends Logger {
16187
16272
  const firstColFixedEnd = cols - fixedColsEnd;
16188
16273
  for (let rowIndex = 0; rowIndex < fixedRowsStart; rowIndex++) {
16189
16274
  for (let colIndex = firstColFixedEnd; colIndex < cols; colIndex++) {
16190
- adjustElementPosition(rowIndex, colIndex, adjustColEndRowStart);
16275
+ adjust(rowIndex, colIndex);
16191
16276
  }
16192
16277
  }
16193
16278
  }
@@ -16196,7 +16281,7 @@ var GridRenderer = class extends Logger {
16196
16281
  const firstColFixedEnd = cols - fixedColsEnd;
16197
16282
  for (let rowIndex = firstRowFixedEnd; rowIndex < rows; rowIndex++) {
16198
16283
  for (let colIndex = firstColFixedEnd; colIndex < cols; colIndex++) {
16199
- adjustElementPosition(rowIndex, colIndex, adjustColEndRowEnd);
16284
+ adjust(rowIndex, colIndex);
16200
16285
  }
16201
16286
  }
16202
16287
  }
@@ -16270,6 +16355,9 @@ var GridRenderer = class extends Logger {
16270
16355
  return this.infiniteNode;
16271
16356
  }
16272
16357
  onCellAttached(cell) {
16358
+ if (this.cellsDetachedInRenderPass?.delete(cell)) {
16359
+ return;
16360
+ }
16273
16361
  if (this.cellDetachedClassNames.length) {
16274
16362
  const el = cell.getElement();
16275
16363
  if (el) {
@@ -16280,6 +16368,13 @@ var GridRenderer = class extends Logger {
16280
16368
  }
16281
16369
  }
16282
16370
  onCellDetached(cell) {
16371
+ if (this.cellsDetachedInRenderPass) {
16372
+ this.cellsDetachedInRenderPass.add(cell);
16373
+ return;
16374
+ }
16375
+ this.addDetachedClassNames(cell);
16376
+ }
16377
+ addDetachedClassNames(cell) {
16283
16378
  if (this.cellDetachedClassNames.length) {
16284
16379
  const el = cell.getElement();
16285
16380
  if (el) {
@@ -16316,10 +16411,22 @@ var GridRenderer = class extends Logger {
16316
16411
  mapped: rendered
16317
16412
  };
16318
16413
  }
16319
- renderRange(range, { renderCell, renderDetailRow, force, onRender }) {
16414
+ renderRange(range, options) {
16320
16415
  if (this.destroyed) {
16321
16416
  return [];
16322
16417
  }
16418
+ if (this.cellsDetachedInRenderPass) {
16419
+ return this.renderRangeInternal(range, options);
16420
+ }
16421
+ const detachedCells = this.cellsDetachedInRenderPass = /* @__PURE__ */ new Set();
16422
+ try {
16423
+ return this.renderRangeInternal(range, options);
16424
+ } finally {
16425
+ this.cellsDetachedInRenderPass = null;
16426
+ detachedCells.forEach((cell) => this.addDetachedClassNames(cell));
16427
+ }
16428
+ }
16429
+ renderRangeInternal(range, { renderCell, renderDetailRow, force, onRender }) {
16323
16430
  const { start, end } = range;
16324
16431
  const horizontalLayout = this.brain.isHorizontalLayoutBrain;
16325
16432
  if (false) {
@@ -16594,6 +16701,34 @@ var GridRenderer = class extends Logger {
16594
16701
  this.updateElementPosition(cell, { hidden, rowspan, colspan });
16595
16702
  return;
16596
16703
  }
16704
+ /**
16705
+ * Where a fixed (pinned) cell goes: its x and/or y relative to the viewport
16706
+ * (`scrollLeft` / `scrollTop: true` - see setTransform), and its z-index:
16707
+ * the corners above the pinned rows and columns, those above the cells
16708
+ * scrolling under them. null for a cell that is not fixed.
16709
+ */
16710
+ getFixedCellPlacement(rowIndex, colIndex, { x, y }, fixedEndOffsets) {
16711
+ const { fixedRowsStart, fixedRowsEnd, fixedColsStart, fixedColsEnd } = this.brain.getFixedCellInfo();
16712
+ const cols = this.brain.getColCount();
16713
+ const rows = this.brain.getRowCount();
16714
+ const colStart = colIndex < fixedColsStart;
16715
+ const colEnd = !colStart && !!fixedColsEnd && colIndex >= cols - fixedColsEnd;
16716
+ const rowStart = rowIndex < fixedRowsStart;
16717
+ const rowEnd = !rowStart && !!fixedRowsEnd && rowIndex >= rows - fixedRowsEnd;
16718
+ const colFixed = colStart || colEnd;
16719
+ const rowFixed = rowStart || rowEnd;
16720
+ if (!colFixed && !rowFixed) {
16721
+ return null;
16722
+ }
16723
+ if (colEnd) {
16724
+ x = (fixedEndOffsets?.cols ?? this.brain.getFixedEndColsOffsets({ skipScroll: true }))[colIndex];
16725
+ }
16726
+ if (rowEnd) {
16727
+ y = (fixedEndOffsets?.rows ?? this.brain.getFixedEndRowsOffsets({ skipScroll: true }))[rowIndex];
16728
+ }
16729
+ const zIndex2 = colFixed && rowFixed ? colStart ? rowStart ? 1e5 : 2e5 : rowStart ? 3e5 : 4e5 : colStart ? fixedColsStart - colIndex : colEnd ? cols - colIndex : rowStart ? fixedRowsStart - rowIndex : rows - rowIndex;
16730
+ return { x, y, scrollLeft: colFixed, scrollTop: rowFixed, zIndex: zIndex2 };
16731
+ }
16597
16732
  reset() {
16598
16733
  this.cellManager.reset();
16599
16734
  this.rowManager.reset();
@@ -17185,13 +17320,18 @@ function createRenderer(brain) {
17185
17320
  }
17186
17321
 
17187
17322
  // src/components/HeadlessTable/RawTable.tsx
17323
+ function createOwnRenderer(brain) {
17324
+ const result = createRenderer(brain);
17325
+ result.renderer.ownsPositionVars = true;
17326
+ return result;
17327
+ }
17188
17328
  function RawTableFn(props) {
17189
17329
  const { brain, renderCell, renderDetailRow, forceRerenderTimestamp } = props;
17190
17330
  const { renderer, onRenderUpdater } = useMemo7(() => {
17191
17331
  return props.onRenderUpdater && props.renderer ? {
17192
17332
  renderer: props.renderer,
17193
17333
  onRenderUpdater: props.onRenderUpdater
17194
- } : createRenderer(brain);
17334
+ } : createOwnRenderer(brain);
17195
17335
  }, [brain, props.onRenderUpdater, props.renderer]);
17196
17336
  useLayoutEffect8(() => {
17197
17337
  renderer.cellHoverClassNames = props.cellHoverClassNames || [];
@@ -18176,11 +18316,12 @@ function InfiniteTableInternalHeaderFn(props) {
18176
18316
  dataSourceStatePartialForHeaderCell
18177
18317
  ]
18178
18318
  );
18319
+ const headerDragListId = useDragListId(HEADER_DRAG_LIST_NAME);
18179
18320
  return /* @__PURE__ */ React46.createElement(
18180
18321
  DragList,
18181
18322
  {
18182
18323
  orientation: "horizontal",
18183
- dragListId: "header",
18324
+ dragListId: headerDragListId,
18184
18325
  dragStrategy: "inline",
18185
18326
  onDrop: emptyFn3,
18186
18327
  updatePosition: emptyFn3
@@ -18450,7 +18591,7 @@ function InfiniteTableHeaderCellFn(props) {
18450
18591
  filterDelay
18451
18592
  } = props;
18452
18593
  const { allRowsSelected, someRowsSelected, selectionMode } = dataSourceStatePartialForHeaderCell;
18453
- const { onDragItemPointerDown } = useDragListContext();
18594
+ const { onDragItemPointerDown, dragListId } = useDragListContext();
18454
18595
  const {
18455
18596
  api,
18456
18597
  getComputed,
@@ -18749,7 +18890,7 @@ function InfiniteTableHeaderCellFn(props) {
18749
18890
  "data-field": `${column.field || ""}`,
18750
18891
  "data-column-id": column.id,
18751
18892
  [DRAG_ITEM_ATTRIBUTE]: column.id,
18752
- [DRAG_ITEM_LIST_ATTRIBUTE]: "header",
18893
+ [DRAG_ITEM_LIST_ATTRIBUTE]: dragListId,
18753
18894
  "data-header-align": align2,
18754
18895
  "data-name": "HeaderCell",
18755
18896
  "data-sort": column.computedSortedAsc ? "asc" : column.computedSortedDesc ? "desc" : "none",
@@ -18880,25 +19021,40 @@ function decamelize(str, options) {
18880
19021
  ).toLowerCase();
18881
19022
  }
18882
19023
 
18883
- // src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
18884
- var defaultStyle = {
19024
+ // src/components/InfiniteTable/components/InfiniteTableLicenseFooter/licenseFooterShared.ts
19025
+ var LICENSE_FOOTER_LINK = "https://infinite-table.com";
19026
+ var LICENSE_FOOTER_INVALID_MESSAGE = "Invalid Infinite Table license. See console for details.";
19027
+ var baseFooterStyle = {
18885
19028
  padding: ThemeVars.spacing[2],
18886
19029
  textAlign: "end",
18887
19030
  opacity: "1",
18888
19031
  visibility: "visible",
18889
19032
  display: "block",
18890
- fontSize: "0.85rem",
19033
+ fontSize: "0.85rem"
19034
+ };
19035
+ var missingFooterStyle = {
19036
+ ...baseFooterStyle,
18891
19037
  background: "white",
18892
19038
  color: "black"
18893
19039
  };
18894
- var anchorStyle = {
18895
- opacity: 1,
19040
+ var invalidFooterStyle = {
19041
+ ...baseFooterStyle,
19042
+ // pale red, with dark red text
19043
+ background: "#fee2e2",
19044
+ color: "#991b1b"
19045
+ };
19046
+ var baseAnchorStyle = {
19047
+ opacity: "1",
18896
19048
  visibility: "visible",
18897
19049
  display: "inline-block",
18898
19050
  pointerEvents: "all",
18899
- color: "black",
18900
19051
  textDecoration: "underline"
18901
19052
  };
19053
+ var missingAnchorStyle = { ...baseAnchorStyle, color: "black" };
19054
+ var invalidAnchorStyle = { ...baseAnchorStyle, color: "#991b1b" };
19055
+ function getLicenseFooterStyles(invalid) {
19056
+ return invalid ? { footer: invalidFooterStyle, anchor: invalidAnchorStyle } : { footer: missingFooterStyle, anchor: missingAnchorStyle };
19057
+ }
18902
19058
  var enforceStyle = (node, style2) => {
18903
19059
  if (!node) {
18904
19060
  return;
@@ -18911,8 +19067,26 @@ var enforceStyle = (node, style2) => {
18911
19067
  );
18912
19068
  }
18913
19069
  };
19070
+ function enforceLicenseFooterStyle(getNode, invalid) {
19071
+ const styles = getLicenseFooterStyles(invalid);
19072
+ const forceStyle = () => {
19073
+ setTimeout(() => {
19074
+ const node = getNode();
19075
+ enforceStyle(node, styles.footer);
19076
+ enforceStyle(node?.querySelector("a") ?? null, styles.anchor);
19077
+ });
19078
+ };
19079
+ forceStyle();
19080
+ const intervalId = setInterval(forceStyle, 1e3);
19081
+ return () => {
19082
+ clearInterval(intervalId);
19083
+ };
19084
+ }
19085
+
19086
+ // src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
18914
19087
  var InfiniteTableLicenseFooter = React50.forwardRef(
18915
19088
  function InfiniteTableLicenseFooter2(props, ref) {
19089
+ const { invalid = false, ...domProps } = props;
18916
19090
  const { rootClassName: rootClassName12 } = useInternalProps();
18917
19091
  const domRef = React50.useRef(null);
18918
19092
  const domCallback = React50.useCallback((node) => {
@@ -18927,42 +19101,33 @@ var InfiniteTableLicenseFooter = React50.forwardRef(
18927
19101
  }
18928
19102
  }, []);
18929
19103
  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
- }, []);
19104
+ return enforceLicenseFooterStyle(() => domRef.current, invalid);
19105
+ }, [invalid]);
19106
+ const styles = getLicenseFooterStyles(invalid);
18945
19107
  return /* @__PURE__ */ React50.createElement(
18946
19108
  "div",
18947
19109
  {
18948
19110
  ref: domCallback,
18949
- ...props,
19111
+ ...domProps,
18950
19112
  className: join(
18951
19113
  `${rootClassName12}-Footer`,
19114
+ invalid ? `${rootClassName12}-Footer--invalid` : null,
18952
19115
  FooterCls,
18953
- props.className
19116
+ domProps.className
18954
19117
  ),
18955
- style: defaultStyle
19118
+ style: styles.footer
18956
19119
  },
19120
+ invalid ? `${LICENSE_FOOTER_INVALID_MESSAGE} ` : null,
18957
19121
  "Powered by",
18958
19122
  " ",
18959
19123
  /* @__PURE__ */ React50.createElement(
18960
19124
  "a",
18961
19125
  {
18962
- href: "https://infinite-table.com",
19126
+ href: LICENSE_FOOTER_LINK,
18963
19127
  rel: "noopener noreferrer",
18964
19128
  role: "link",
18965
- target: "_blank"
19129
+ target: "_blank",
19130
+ style: styles.anchor
18966
19131
  },
18967
19132
  "Infinite Table"
18968
19133
  )
@@ -22292,6 +22457,80 @@ function treeTraverse(treeParams, traverseOptions, data) {
22292
22457
  }
22293
22458
  }
22294
22459
 
22460
+ // src/utils/multisort/sortByNumber.ts
22461
+ var SORT_BY_NUMBER_MIN_LENGTH = 1e3;
22462
+ var IS_LITTLE_ENDIAN = new Uint8Array(new Uint32Array([1]).buffer)[0] === 1;
22463
+ function sortByNumber(array, getValue, dir) {
22464
+ const len = array.length;
22465
+ const keys = new Float64Array(len);
22466
+ for (let i = 0; i < len; i++) {
22467
+ const value = getValue(array[i]);
22468
+ if (typeof value !== "number" || value !== value) {
22469
+ return false;
22470
+ }
22471
+ keys[i] = (dir < 0 ? -value : value) + 0;
22472
+ }
22473
+ if (len < 2) {
22474
+ return true;
22475
+ }
22476
+ const words = new Uint32Array(keys.buffer);
22477
+ const LOW = IS_LITTLE_ENDIAN ? 0 : 1;
22478
+ const HIGH = IS_LITTLE_ENDIAN ? 1 : 0;
22479
+ const counts = new Uint32Array(8 * 256);
22480
+ for (let i = 0; i < len; i++) {
22481
+ let low = words[2 * i + LOW];
22482
+ let high = words[2 * i + HIGH];
22483
+ if (high & 2147483648) {
22484
+ high = ~high >>> 0;
22485
+ low = ~low >>> 0;
22486
+ words[2 * i + LOW] = low;
22487
+ } else {
22488
+ high = (high | 2147483648) >>> 0;
22489
+ }
22490
+ words[2 * i + HIGH] = high;
22491
+ counts[low & 255]++;
22492
+ counts[256 + (low >>> 8 & 255)]++;
22493
+ counts[512 + (low >>> 16 & 255)]++;
22494
+ counts[768 + (low >>> 24)]++;
22495
+ counts[1024 + (high & 255)]++;
22496
+ counts[1280 + (high >>> 8 & 255)]++;
22497
+ counts[1536 + (high >>> 16 & 255)]++;
22498
+ counts[1792 + (high >>> 24)]++;
22499
+ }
22500
+ let indexes = new Uint32Array(len);
22501
+ let nextIndexes = new Uint32Array(len);
22502
+ for (let i = 0; i < len; i++) {
22503
+ indexes[i] = i;
22504
+ }
22505
+ for (let digitIndex = 0; digitIndex < 8; digitIndex++) {
22506
+ const word = digitIndex < 4 ? LOW : HIGH;
22507
+ const shift = digitIndex % 4 * 8;
22508
+ const countsOffset = digitIndex * 256;
22509
+ if (counts[countsOffset + (words[word] >>> shift & 255)] === len) {
22510
+ continue;
22511
+ }
22512
+ let position2 = 0;
22513
+ for (let digit = 0; digit < 256; digit++) {
22514
+ const count = counts[countsOffset + digit];
22515
+ counts[countsOffset + digit] = position2;
22516
+ position2 += count;
22517
+ }
22518
+ for (let i = 0; i < len; i++) {
22519
+ const index = indexes[i];
22520
+ const digit = words[2 * index + word] >>> shift & 255;
22521
+ nextIndexes[counts[countsOffset + digit]++] = index;
22522
+ }
22523
+ const previousIndexes = indexes;
22524
+ indexes = nextIndexes;
22525
+ nextIndexes = previousIndexes;
22526
+ }
22527
+ const items = array.slice();
22528
+ for (let i = 0; i < len; i++) {
22529
+ array[i] = items[indexes[i]];
22530
+ }
22531
+ return true;
22532
+ }
22533
+
22295
22534
  // src/utils/multisort/sortTypes.ts
22296
22535
  var numberComparator = function(first, second) {
22297
22536
  return first - second;
@@ -22377,7 +22616,10 @@ var multisort = (sortInfo, array, options) => {
22377
22616
  if (marker) {
22378
22617
  marker.start();
22379
22618
  }
22380
- array.sort(getMultisortFunction(toPlainSortInfo(sortInfo), get));
22619
+ const plainSortInfo = toPlainSortInfo(sortInfo);
22620
+ if (!sortByNumberIfPossible(plainSortInfo, array, get)) {
22621
+ array.sort(getMultisortFunction(plainSortInfo, get));
22622
+ }
22381
22623
  if (marker) {
22382
22624
  marker.end();
22383
22625
  }
@@ -22443,6 +22685,30 @@ var multisortNested = (sortInfo, array, options) => {
22443
22685
  return array;
22444
22686
  };
22445
22687
  multisort.knownTypes = sortTypes_default;
22688
+ function sortByNumberIfPossible(sortInfo, array, get) {
22689
+ if (sortInfo.length !== 1 || array.length < SORT_BY_NUMBER_MIN_LENGTH) {
22690
+ return false;
22691
+ }
22692
+ const info = sortInfo[0];
22693
+ if (!info || info.fn || !info.type || info.dir !== 1 && info.dir !== -1) {
22694
+ return false;
22695
+ }
22696
+ const type = Array.isArray(info.type) ? info.type[0] : info.type;
22697
+ if (multisort.knownTypes[type] !== numberComparator) {
22698
+ return false;
22699
+ }
22700
+ const { field, valueGetter } = info;
22701
+ return sortByNumber(
22702
+ array,
22703
+ (item) => {
22704
+ if (get) {
22705
+ item = get(item);
22706
+ }
22707
+ return valueGetter ? valueGetter(item) : field ? item[field] : item;
22708
+ },
22709
+ info.dir
22710
+ );
22711
+ }
22446
22712
  var getSingleSortFunction = (info) => {
22447
22713
  if (!info) {
22448
22714
  return;
@@ -25927,6 +26193,7 @@ function concludeReducer(params) {
25927
26193
  } else {
25928
26194
  state.groupDeepMap = void 0;
25929
26195
  state.pivotColumns = void 0;
26196
+ state.pivotColumnGroups = void 0;
25930
26197
  state.groupRowsIndexesInDataArray = void 0;
25931
26198
  const arrayDifferentAfterSortStep = previousState.postSortDataArray != state.postSortDataArray;
25932
26199
  if (arrayDifferentAfterSortStep || groupsDepsChanged || selectionDepsChanged || rowDisabledStateDepsChanged || rowInfoReducersChanged) {
@@ -27588,7 +27855,9 @@ var forwardProps4 = (_setupState) => {
27588
27855
  pivotGrandTotalColumnPosition: 1,
27589
27856
  // groupRenderStrategy: (groupRenderStrategy) =>
27590
27857
  // groupRenderStrategy ?? 'multi-column',
27591
- licenseKey: (licenseKey) => licenseKey || "",
27858
+ // keep undefined - it means "use InfiniteTable.licenseKey", while an
27859
+ // empty string means "no license key"
27860
+ licenseKey: (licenseKey) => licenseKey,
27592
27861
  keyboardSelection: (keyboardSelection) => keyboardSelection ?? true,
27593
27862
  multiRowSelectionWith: (multiRowSelectionWith) => multiRowSelectionWith ?? "checkbox",
27594
27863
  activeRowIndex: 1,
@@ -27691,8 +27960,10 @@ function getMappedCallbacks2() {
27691
27960
  var mapPropsToState = (params) => {
27692
27961
  const { props, state, oldState, parentState } = params;
27693
27962
  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,
27963
+ 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
27964
+ // to the depth of `columnGroups` (or to a single row, when there are none)
27965
+ state.pivotColumnGroups != oldState?.pivotColumnGroups ? computeColumnGroupsDepths(
27966
+ computedColumnGroups ?? EMPTY_OBJECT,
27696
27967
  state.columnGroupVisibility
27697
27968
  ) : state.columnGroupsDepthsMap;
27698
27969
  const groupBy = parentState?.groupBy;
@@ -29196,7 +29467,7 @@ var logLicenseError = (lines, fn = console.error.bind(console)) => {
29196
29467
  });
29197
29468
  fn("*".repeat(max));
29198
29469
  };
29199
- var isValidLicense = (licenseKey = "", packageInfo, fn) => {
29470
+ var checkLicense = (licenseKey = "", packageInfo, fn) => {
29200
29471
  let details;
29201
29472
  try {
29202
29473
  details = decode(licenseKey);
@@ -29209,7 +29480,7 @@ var isValidLicense = (licenseKey = "", packageInfo, fn) => {
29209
29480
  ],
29210
29481
  fn
29211
29482
  );
29212
- return false;
29483
+ return "invalid";
29213
29484
  }
29214
29485
  const currentVersionReleaseDate = new Date(packageInfo.publishedAt);
29215
29486
  const licenseEndDate = new Date(details.end);
@@ -29225,14 +29496,16 @@ Your Infinite Table license has expired on ${licenseEndDate.toDateString()}.
29225
29496
  ],
29226
29497
  fn
29227
29498
  );
29228
- return false;
29499
+ return "expired";
29229
29500
  }
29230
- return true;
29501
+ return "valid";
29231
29502
  };
29232
29503
  var decode = (licenseKey) => {
29233
29504
  let crc = "";
29234
29505
  let fields = licenseKey.split("|").map((part) => {
29235
- let [name, value] = part.split("=");
29506
+ const separatorIndex = part.indexOf("=");
29507
+ const name = separatorIndex === -1 ? part : part.slice(0, separatorIndex);
29508
+ const value = separatorIndex === -1 ? "" : part.slice(separatorIndex + 1);
29236
29509
  if (name === "C") {
29237
29510
  crc = value;
29238
29511
  }
@@ -29269,40 +29542,29 @@ var decode = (licenseKey) => {
29269
29542
  return fieldsToLicenseDetails(fields);
29270
29543
  };
29271
29544
 
29545
+ // src/components/InfiniteTable/hooks/useLicense/getLicenseStatus.ts
29546
+ function getLicenseStatus(licenseKey = "", options) {
29547
+ if (options.isDetail) {
29548
+ return "valid";
29549
+ }
29550
+ const result = checkLicense(licenseKey, {
29551
+ publishedAt: 1795523603652,
29552
+ version: "10.2.1"
29553
+ });
29554
+ if (result === "invalid" && !licenseKey) {
29555
+ return "missing";
29556
+ }
29557
+ return result;
29558
+ }
29559
+
29272
29560
  // 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
29561
  var useLicense = (licenseKey = "") => {
29290
29562
  const masterRowInfo = useMasterRowInfo();
29291
29563
  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;
29564
+ return useMemo17(
29565
+ () => getLicenseStatus(licenseKey, { isDetail }),
29566
+ [licenseKey, isDetail]
29567
+ );
29306
29568
  };
29307
29569
 
29308
29570
  // src/components/InfiniteTable/hooks/useScrollToActiveCell.ts
@@ -33178,7 +33440,7 @@ function useInfinitePortalContainer() {
33178
33440
 
33179
33441
  // src/components/InfiniteTable/components/GroupingToolbar/index.tsx
33180
33442
  import * as React73 from "react";
33181
- import { useCallback as useCallback33 } from "react";
33443
+ import { useCallback as useCallback33, useMemo as useMemo20 } from "react";
33182
33444
 
33183
33445
  // src/components/InfiniteTable/components/GroupingToolbar/index.css.ts
33184
33446
  var GroupingToolbarItemClearCls = "hs68h8j _16lm1iwk _16lm1iwx _16lm1iw2n";
@@ -33250,8 +33512,8 @@ var getFastClickHandler = (callback, prevHandler) => {
33250
33512
  };
33251
33513
  function GroupingToolbarItem(props) {
33252
33514
  const { column, onClear, components: components2, field, id, toggleSorting } = props;
33253
- const { dragSourceListId, dragItemId } = useDragListContext();
33254
- const draggingInProgress = dragSourceListId === GROUPING_TOOLBAR_DRAG_LIST_ID;
33515
+ const { dragSourceListId, dragItemId, dragListId } = useDragListContext();
33516
+ const draggingInProgress = dragSourceListId === dragListId;
33255
33517
  const context = useInfiniteTableStableContext();
33256
33518
  const columnHeader = (column ? getColumnLabel(column.id, context, "grouping-toolbar") : field) ?? id;
33257
33519
  const sortIcon = column ? /* @__PURE__ */ React73.createElement(
@@ -33263,7 +33525,7 @@ function GroupingToolbarItem(props) {
33263
33525
  }
33264
33526
  ) : null;
33265
33527
  const header = /* @__PURE__ */ React73.createElement(React73.Fragment, null, columnHeader, sortIcon);
33266
- const active = dragItemId === id && dragSourceListId === GROUPING_TOOLBAR_DRAG_LIST_ID;
33528
+ const active = dragItemId === id && dragSourceListId === dragListId;
33267
33529
  const className = join(
33268
33530
  GroupingToolbarItemRecipe({
33269
33531
  draggingInProgress,
@@ -33293,7 +33555,6 @@ function GroupingToolbarItem(props) {
33293
33555
  }
33294
33556
  );
33295
33557
  }
33296
- var GROUPING_TOOLBAR_DRAG_LIST_ID = "grouping-toolbar";
33297
33558
  function GroupingToolbar(props) {
33298
33559
  const { groupBy } = useDataSourceSelector((ctx) => {
33299
33560
  return {
@@ -33311,8 +33572,14 @@ function GroupingToolbar(props) {
33311
33572
  );
33312
33573
  const { dropTargetListId, dragSourceListId } = useDragDropProvider();
33313
33574
  const { fieldsToColumn, computedColumnsMap } = getComputed();
33314
- const active = dropTargetListId === GROUPING_TOOLBAR_DRAG_LIST_ID;
33315
- const draggingInProgress = dragSourceListId === GROUPING_TOOLBAR_DRAG_LIST_ID;
33575
+ const dragListId = useDragListId(GROUPING_TOOLBAR_DRAG_LIST_NAME);
33576
+ const headerDragListId = useDragListId(HEADER_DRAG_LIST_NAME);
33577
+ const acceptDropsFrom = useMemo20(
33578
+ () => [headerDragListId, dragListId],
33579
+ [headerDragListId, dragListId]
33580
+ );
33581
+ const active = dropTargetListId === dragListId;
33582
+ const draggingInProgress = dragSourceListId === dragListId;
33316
33583
  const PlaceholderComponent = props.components?.Placeholder ?? PlaceholderDefault;
33317
33584
  const HostComponent = props.components?.Host ?? HostDefault;
33318
33585
  const children = !groupBy.length ? /* @__PURE__ */ React73.createElement(
@@ -33385,8 +33652,8 @@ function GroupingToolbar(props) {
33385
33652
  DragList,
33386
33653
  {
33387
33654
  orientation,
33388
- dragListId: GROUPING_TOOLBAR_DRAG_LIST_ID,
33389
- acceptDropsFrom: ["header", GROUPING_TOOLBAR_DRAG_LIST_ID],
33655
+ dragListId,
33656
+ acceptDropsFrom,
33390
33657
  onDrop,
33391
33658
  dragStrategy: "inline",
33392
33659
  onAcceptDrop,
@@ -33426,7 +33693,7 @@ function GroupingToolbar(props) {
33426
33693
  import * as React78 from "react";
33427
33694
 
33428
33695
  // src/components/InfiniteTable/hooks/useCellRendering.tsx
33429
- import { useMemo as useMemo21 } from "react";
33696
+ import { useMemo as useMemo22 } from "react";
33430
33697
  import { useCallback as useCallback34, useEffect as useEffect39, useRef as useRef33 } from "react";
33431
33698
  import * as React75 from "react";
33432
33699
 
@@ -33471,7 +33738,7 @@ import * as React74 from "react";
33471
33738
  var RowDetailRecipe = createRuntimeFn({ defaultClassName: "evqes20", variantClassNames: {}, defaultVariants: {}, compoundVariants: [] });
33472
33739
 
33473
33740
  // src/components/InfiniteTable/components/InfiniteTableRow/useRegisterDetail.ts
33474
- import { useMemo as useMemo20 } from "react";
33741
+ import { useMemo as useMemo21 } from "react";
33475
33742
 
33476
33743
  // src/components/InfiniteTable/components/InfiniteTableRow/registerDetailShared.ts
33477
33744
  function restoreDetailStateForRowId(rowId, options) {
@@ -33599,11 +33866,11 @@ function useRegisterDetail(props) {
33599
33866
  getMasterState: ctx.getState
33600
33867
  };
33601
33868
  });
33602
- const { currentRowCache, cacheCalledByRowDetailRenderer } = useMemo20(
33869
+ const { currentRowCache, cacheCalledByRowDetailRenderer } = useMemo21(
33603
33870
  () => createCurrentRowCache(rowInfo.id, rowDetailsCache),
33604
33871
  [rowDetailsCache, rowInfo.id]
33605
33872
  );
33606
- const masterDetailContextValue = useMemo20(() => {
33873
+ const masterDetailContextValue = useMemo21(() => {
33607
33874
  return createMasterDetailContextValue({
33608
33875
  rowInfo,
33609
33876
  currentRowCache,
@@ -33747,7 +34014,7 @@ function useCellRendering(param) {
33747
34014
  toggleGroupRow,
33748
34015
  columnSize
33749
34016
  } = computed;
33750
- const visibleColumnIds = useMemo21(
34017
+ const visibleColumnIds = useMemo22(
33751
34018
  () => computedVisibleColumns.map((column) => column.id),
33752
34019
  [computedVisibleColumns]
33753
34020
  );
@@ -33849,7 +34116,7 @@ function useCellRendering(param) {
33849
34116
  onReady({ api: imperativeApi, dataSourceApi });
33850
34117
  }
33851
34118
  }, [ready]);
33852
- const dataSourceStatePartialForCell = useMemo21(() => {
34119
+ const dataSourceStatePartialForCell = useMemo22(() => {
33853
34120
  return {
33854
34121
  isNodeReadOnly: isNodeReadOnly2,
33855
34122
  selectionMode,
@@ -33975,7 +34242,7 @@ function useCellRendering(param) {
33975
34242
  dataSourceStatePartialForCell
33976
34243
  ]
33977
34244
  );
33978
- const renderDetailRow = useMemo21(() => {
34245
+ const renderDetailRow = useMemo22(() => {
33979
34246
  if (!isRowDetailsExpanded) {
33980
34247
  return void 0;
33981
34248
  }
@@ -34087,7 +34354,7 @@ function LoadMaskFn(props) {
34087
34354
  var LoadMask = React77.memo(LoadMaskFn);
34088
34355
 
34089
34356
  // src/components/InfiniteTable/components/InfiniteTableBody/index.tsx
34090
- import { useMemo as useMemo22 } from "react";
34357
+ import { useMemo as useMemo23 } from "react";
34091
34358
  var _HOVERED_CLASS_NAMES = [
34092
34359
  RowHoverCls,
34093
34360
  `${InfiniteTableColumnCellClassName}--hovered`
@@ -34204,7 +34471,7 @@ function InfiniteTableBody(props) {
34204
34471
  });
34205
34472
  const { autoFocus, tabIndex } = domProps ?? {};
34206
34473
  useToggleWrapRowsHorizontally();
34207
- const hoverClassNames = useMemo22(() => {
34474
+ const hoverClassNames = useMemo23(() => {
34208
34475
  if (!showHoverRows) {
34209
34476
  return void 0;
34210
34477
  }
@@ -34327,7 +34594,7 @@ var InfiniteTableComponent = React79.memo(
34327
34594
  activeCellIndex
34328
34595
  } = componentState;
34329
34596
  let { licenseKey } = componentState;
34330
- if (!licenseKey && InfiniteTable.licenseKey) {
34597
+ if (licenseKey === void 0 && InfiniteTable.licenseKey) {
34331
34598
  licenseKey = InfiniteTable.licenseKey;
34332
34599
  }
34333
34600
  useScrollToActiveRow(activeRowIndex, dataArrayLength, api);
@@ -34346,7 +34613,7 @@ var InfiniteTableComponent = React79.memo(
34346
34613
  );
34347
34614
  return brain.onVerticalRenderRangeChange(onChange);
34348
34615
  }, [brain, scrollStopDelay]);
34349
- const licenseValid = useLicense(licenseKey);
34616
+ const licenseStatus = useLicense(licenseKey);
34350
34617
  const {
34351
34618
  // remove autoFocus and tabIndex from the domProps
34352
34619
  // that will be spread on the root DOM element
@@ -34447,7 +34714,7 @@ var InfiniteTableComponent = React79.memo(
34447
34714
  onChange: onColumnHeaderHeightCSSVarChange
34448
34715
  }
34449
34716
  ) : null,
34450
- licenseValid ? null : /* @__PURE__ */ React79.createElement(InfiniteTableLicenseFooter, null),
34717
+ licenseStatus === "valid" ? null : /* @__PURE__ */ React79.createElement(InfiniteTableLicenseFooter, { invalid: licenseStatus === "invalid" }),
34451
34718
  /* @__PURE__ */ React79.createElement(FocusDetect, null)
34452
34719
  );
34453
34720
  }