@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.js CHANGED
@@ -1598,6 +1598,7 @@ var DevToolsTracks = {
1598
1598
  };
1599
1599
 
1600
1600
  // src/utils/devTools/index.ts
1601
+ var MEASURE_NAME_PREFIX = "\u200B";
1601
1602
  var DevToolsMarker = class _DevToolsMarker {
1602
1603
  constructor(debugId) {
1603
1604
  this.debugId = debugId;
@@ -1635,7 +1636,8 @@ var DevToolsMarker = class _DevToolsMarker {
1635
1636
  const tooltip = markerDetails.tooltip || this.markerDetails.tooltip;
1636
1637
  const label = markerDetails.label || this.markerDetails.label || "Unknown";
1637
1638
  const track = markerDetails.track || this.markerDetails.track || "Unknown";
1638
- performance.measure(label, {
1639
+ const measureName = MEASURE_NAME_PREFIX + label;
1640
+ performance.measure(measureName, {
1639
1641
  start,
1640
1642
  end,
1641
1643
  detail: {
@@ -1649,6 +1651,7 @@ var DevToolsMarker = class _DevToolsMarker {
1649
1651
  }
1650
1652
  }
1651
1653
  });
1654
+ performance.clearMeasures(measureName);
1652
1655
  return this;
1653
1656
  };
1654
1657
  this.debugId = debugId;
@@ -5329,6 +5332,7 @@ function reorderColumnsOnDrag(params) {
5329
5332
  setProxyPosition,
5330
5333
  setDragColumnOutside,
5331
5334
  getCurrentDragSourceAndTarget,
5335
+ groupingToolbarDragListId,
5332
5336
  api: imperativeApi,
5333
5337
  horizontalLayoutPageIndex,
5334
5338
  pageWidth
@@ -5621,7 +5625,7 @@ function reorderColumnsOnDrag(params) {
5621
5625
  },
5622
5626
  onMove(mousePosition) {
5623
5627
  const currentColHeaderRect = updatePositionAndDiff(mousePosition);
5624
- if (getCurrentDragSourceAndTarget().dropTargetListId === "grouping-toolbar" || allowColumnHideOnDrag && !acceptDropToReorderRect.containsPoint(
5628
+ if (getCurrentDragSourceAndTarget().dropTargetListId === groupingToolbarDragListId || allowColumnHideOnDrag && !acceptDropToReorderRect.containsPoint(
5625
5629
  currentColHeaderRect.getCenter()
5626
5630
  )) {
5627
5631
  if (allowColumnHideOnDrag) {
@@ -5958,17 +5962,18 @@ var _DragManager = class _DragManager {
5958
5962
  return _DragManager.emitter.on(event, callback);
5959
5963
  }
5960
5964
  static registerDragInteractionTarget(dragInteractionTarget) {
5961
- if (_DragManager.dragInteractionTargetsMap.has(dragInteractionTarget.listId)) {
5965
+ const { listId } = dragInteractionTarget;
5966
+ const current = _DragManager.dragInteractionTargetsMap.get(listId);
5967
+ if (current && current !== dragInteractionTarget) {
5962
5968
  console.warn(
5963
- `DragInteractionTarget with listId ${dragInteractionTarget.listId} already registered`
5969
+ `DragInteractionTarget with listId ${listId} already registered`
5964
5970
  );
5965
5971
  return;
5966
5972
  }
5967
- _DragManager.dragInteractionTargetsMap.set(
5968
- dragInteractionTarget.listId,
5969
- dragInteractionTarget
5970
- );
5971
- _DragManager.emit("register", dragInteractionTarget);
5973
+ if (!current) {
5974
+ _DragManager.dragInteractionTargetsMap.set(listId, dragInteractionTarget);
5975
+ _DragManager.emit("register", dragInteractionTarget);
5976
+ }
5972
5977
  return () => {
5973
5978
  _DragManager.unregisterDragInteractionTarget(dragInteractionTarget);
5974
5979
  };
@@ -5982,13 +5987,11 @@ var _DragManager = class _DragManager {
5982
5987
  if (!dragInteractionTarget) {
5983
5988
  return;
5984
5989
  }
5985
- if (!_DragManager.dragInteractionTargetsMap.has(dragInteractionTarget.listId)) {
5986
- console.warn(
5987
- `DragInteractionTarget with listId ${dragInteractionTarget.listId} not found`
5988
- );
5990
+ const { listId } = dragInteractionTarget;
5991
+ if (_DragManager.dragInteractionTargetsMap.get(listId) !== dragInteractionTarget) {
5989
5992
  return;
5990
5993
  }
5991
- _DragManager.dragInteractionTargetsMap.delete(dragInteractionTarget.listId);
5994
+ _DragManager.dragInteractionTargetsMap.delete(listId);
5992
5995
  dragInteractionTarget.unregister();
5993
5996
  _DragManager.emit("unregister", dragInteractionTarget);
5994
5997
  }
@@ -6085,6 +6088,14 @@ var _DragManager = class _DragManager {
6085
6088
  let insideTargetEvent = null;
6086
6089
  const events = [];
6087
6090
  _DragManager.withDragMove(dragOperation, (interactionTarget, { event: event2 }) => {
6091
+ if (dragOperation.cancelled) {
6092
+ event2 = {
6093
+ ...event2,
6094
+ dropTargetListId: null,
6095
+ dropIndex: -1,
6096
+ outside: false
6097
+ };
6098
+ }
6088
6099
  interactionTarget.drop(event2);
6089
6100
  events.push(event2);
6090
6101
  if (!event2.outside) {
@@ -6150,6 +6161,11 @@ var DragOperation = class extends EventEmitter {
6150
6161
  constructor(options) {
6151
6162
  super(options.listeners);
6152
6163
  this.phase = "start";
6164
+ /**
6165
+ * Whether the drag was cancelled - the browser took the pointer away -
6166
+ * rather than dropped.
6167
+ */
6168
+ this.cancelled = false;
6153
6169
  this.currentOffset = {
6154
6170
  top: 0,
6155
6171
  left: 0
@@ -6178,6 +6194,13 @@ var DragOperation = class extends EventEmitter {
6178
6194
  this.phase = "drop";
6179
6195
  this.emit("drop", this);
6180
6196
  }
6197
+ /**
6198
+ * Ends the drag without a drop.
6199
+ */
6200
+ cancel() {
6201
+ this.cancelled = true;
6202
+ this.drop();
6203
+ }
6181
6204
  move(point) {
6182
6205
  if (this.phase !== "start" && this.phase !== "move") {
6183
6206
  return;
@@ -6216,6 +6239,11 @@ var DragDropProviderContext = React20.createContext({
6216
6239
  var useDragDropProvider = () => {
6217
6240
  return React20.useContext(DragDropProviderContext);
6218
6241
  };
6242
+ var DragDropProviderIdContext = React20.createContext("");
6243
+ var useDragListId = (name) => {
6244
+ const providerId = React20.useContext(DragDropProviderIdContext);
6245
+ return providerId ? `${name}-${providerId}` : name;
6246
+ };
6219
6247
  var DragDropProvider = (props) => {
6220
6248
  const [state, setState] = React20.useState({
6221
6249
  dragSourceListId: null,
@@ -6223,6 +6251,7 @@ var DragDropProvider = (props) => {
6223
6251
  dragItemId: "",
6224
6252
  status: "accepted"
6225
6253
  });
6254
+ const providerId = React20.useId();
6226
6255
  const stateRef = React20.useRef(state);
6227
6256
  stateRef.current = state;
6228
6257
  const getCurrentDragSourceAndTarget = React20.useCallback(() => {
@@ -6280,9 +6309,13 @@ var DragDropProvider = (props) => {
6280
6309
  removeDragDrop();
6281
6310
  };
6282
6311
  }, [DragManager, setState]);
6283
- return /* @__PURE__ */ React20.createElement(DragDropProviderContext.Provider, { value: contextValue }, typeof props.children === "function" ? props.children(contextValue) : props.children);
6312
+ return /* @__PURE__ */ React20.createElement(DragDropProviderIdContext.Provider, { value: providerId }, /* @__PURE__ */ React20.createElement(DragDropProviderContext.Provider, { value: contextValue }, typeof props.children === "function" ? props.children(contextValue) : props.children));
6284
6313
  };
6285
6314
 
6315
+ // src/components/InfiniteTable/components/draggable/dragListNames.ts
6316
+ var HEADER_DRAG_LIST_NAME = "header";
6317
+ var GROUPING_TOOLBAR_DRAG_LIST_NAME = "grouping-toolbar";
6318
+
6286
6319
  // src/components/InfiniteTable/components/InfiniteTableBody/bodyClassName.ts
6287
6320
  var InfiniteTableBodyClassName = `${rootClassName}Body`;
6288
6321
  var getBodyNode = (root) => {
@@ -6329,6 +6362,9 @@ var useColumnPointerEvents = ({
6329
6362
  const [proxyPosition, setProxyPosition] = (0, import_react16.useState)(null);
6330
6363
  const [dragColumnOutside, setDragColumnOutside] = (0, import_react16.useState)(false);
6331
6364
  const { getCurrentDragSourceAndTarget } = useDragDropProvider();
6365
+ const groupingToolbarDragListId = useDragListId(
6366
+ GROUPING_TOOLBAR_DRAG_LIST_NAME
6367
+ );
6332
6368
  const { getComputed, getState, api, computedDraggable, rootRef, actions } = useInfiniteTableSelector((ctx) => {
6333
6369
  return {
6334
6370
  actions: ctx.actions,
@@ -6405,6 +6441,7 @@ var useColumnPointerEvents = ({
6405
6441
  dragColumnHeaderTargetRect: targetRect,
6406
6442
  dragColumnId: columnId,
6407
6443
  getCurrentDragSourceAndTarget,
6444
+ groupingToolbarDragListId,
6408
6445
  api,
6409
6446
  infiniteDOMNode: rootRef.current,
6410
6447
  setProxyPosition,
@@ -6545,7 +6582,7 @@ var useColumnPointerEvents = ({
6545
6582
  target.addEventListener("pointerup", onPointerUp);
6546
6583
  target.setPointerCapture(e.pointerId);
6547
6584
  },
6548
- [columnId, horizontalLayoutPageIndex]
6585
+ [columnId, horizontalLayoutPageIndex, groupingToolbarDragListId]
6549
6586
  );
6550
6587
  return {
6551
6588
  onPointerDown: computedDraggable ? onPointerDown : defaultPointerDown,
@@ -12482,7 +12519,7 @@ function dampenByTime(proposedScroll, dragStartTime, config) {
12482
12519
  return MIN_SCROLL;
12483
12520
  }
12484
12521
  const pct = (runTime - accelerateAt) / (stopDampeningAt - accelerateAt);
12485
- return Math.ceil(proposedScroll * config.ease(pct));
12522
+ return Math.max(MIN_SCROLL, Math.ceil(proposedScroll * config.ease(pct)));
12486
12523
  }
12487
12524
  function getScrollForAxis(point, containerStart, containerEnd, containerSize, config, dragStartTime, shouldUseDampening) {
12488
12525
  if (point < containerStart || point > containerEnd) {
@@ -12630,20 +12667,12 @@ var AutoScroller = class {
12630
12667
  }
12631
12668
  };
12632
12669
 
12633
- // src/components/InfiniteTable/components/draggable/DragList.tsx
12634
- var DragListContext = React31.createContext({
12635
- dragItemId: null,
12636
- onDragItemPointerDown: () => {
12637
- },
12638
- draggingInProgress: false,
12639
- dragListId: "",
12640
- status: "accepted",
12641
- dragSourceListId: null,
12642
- dropTargetListId: null
12643
- });
12644
- var useDragListContext = () => {
12645
- return React31.useContext(DragListContext);
12646
- };
12670
+ // src/components/InfiniteTable/components/draggable/dragListController.ts
12671
+ var DRAG_LIST_ATTRIBUTE = "data-drag-list-id";
12672
+ var DRAG_ITEM_ATTRIBUTE = "data-drag-item-id";
12673
+ var DRAG_ITEM_LIST_ATTRIBUTE = "data-drag-item-list-id";
12674
+ var DRAG_ITEM_SELECTOR = `[${DRAG_ITEM_ATTRIBUTE}]`;
12675
+ var RETURN_NULL = () => null;
12647
12676
  var defaultUpdatePosition = (options) => {
12648
12677
  const { node, offset } = options;
12649
12678
  if (!offset) {
@@ -12664,8 +12693,6 @@ function getDraggableItemNodes(domRef, dragListId) {
12664
12693
  }
12665
12694
  function getDraggableItems(domRef, dragListId) {
12666
12695
  const dragItems = getDraggableItemNodes(domRef, dragListId);
12667
- if (!dragItems || dragItems.length === 0) {
12668
- }
12669
12696
  const draggableItems = Array.from(dragItems).map((item) => {
12670
12697
  const id = getDraggableItemId(item);
12671
12698
  const rect = item.getBoundingClientRect();
@@ -12713,55 +12740,54 @@ function createInteractionTarget(params) {
12713
12740
  const target = new DragInteractionTarget(getInteractionTargetData(params));
12714
12741
  return target;
12715
12742
  }
12716
- function useInteractionTarget(domRef, props) {
12717
- const getProps = useLatest(props);
12718
- const [interactionTarget, doSetInteractionTarget] = React31.useState(null);
12719
- const setInteractionTarget = (0, import_react24.useCallback)(
12720
- (interactionTarget2) => {
12721
- if (interactionTarget2) {
12722
- DragManager.registerDragInteractionTarget(interactionTarget2);
12723
- } else {
12724
- const currentInteractionTarget = getInteractionTarget();
12725
- if (currentInteractionTarget) {
12726
- DragManager.unregisterDragInteractionTarget(currentInteractionTarget);
12727
- }
12728
- }
12729
- doSetInteractionTarget(interactionTarget2);
12730
- },
12731
- []
12743
+ function findDragListElement(domRef, dragListId) {
12744
+ const dragList = document.querySelector(
12745
+ `[${DRAG_LIST_ATTRIBUTE}="${dragListId}"]`
12732
12746
  );
12733
- const getInteractionTarget = useLatest(interactionTarget);
12734
- (0, import_react24.useEffect)(() => {
12735
- return DragManager.on("register", (interactionTarget2) => {
12736
- const { dragListId, acceptDropsFrom, orientation, shouldAcceptDrop } = getProps();
12737
- const interactionTargetData = interactionTarget2.getData();
12738
- if (!interactionTargetData.initial) {
12739
- return;
12740
- }
12741
- if (interactionTargetData.listId === dragListId) {
12742
- return;
12743
- }
12744
- if (acceptDropsFrom?.includes(interactionTargetData.listId)) {
12745
- const newInteractionTarget = createInteractionTarget({
12746
- domRef,
12747
- orientation,
12748
- dragListId,
12749
- initial: false,
12750
- acceptDropsFrom,
12751
- shouldAcceptDrop
12752
- });
12753
- interactionTarget2.once("unregister", () => {
12754
- setInteractionTarget(null);
12755
- });
12756
- setInteractionTarget(newInteractionTarget);
12757
- }
12758
- });
12759
- }, [getProps]);
12760
- return {
12761
- interactionTarget,
12762
- setInteractionTarget,
12763
- getInteractionTarget
12764
- };
12747
+ if (dragList) {
12748
+ domRef.current = dragList;
12749
+ } else {
12750
+ console.warn(
12751
+ `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.`
12752
+ );
12753
+ }
12754
+ }
12755
+ function replaceRegisteredInteractionTarget(registeredTargetRef, interactionTarget) {
12756
+ const registeredTarget = registeredTargetRef.current;
12757
+ if (registeredTarget && registeredTarget !== interactionTarget) {
12758
+ DragManager.unregisterDragInteractionTarget(registeredTarget);
12759
+ }
12760
+ registeredTargetRef.current = interactionTarget;
12761
+ if (interactionTarget) {
12762
+ DragManager.registerDragInteractionTarget(interactionTarget);
12763
+ }
12764
+ }
12765
+ function acceptDragsFromOtherLists(options) {
12766
+ const { getProps, domRef, setInteractionTarget } = options;
12767
+ return DragManager.on("register", (interactionTarget) => {
12768
+ const { dragListId, acceptDropsFrom, orientation, shouldAcceptDrop } = getProps();
12769
+ const interactionTargetData = interactionTarget.getData();
12770
+ if (!interactionTargetData.initial) {
12771
+ return;
12772
+ }
12773
+ if (interactionTargetData.listId === dragListId) {
12774
+ return;
12775
+ }
12776
+ if (acceptDropsFrom?.includes(interactionTargetData.listId)) {
12777
+ const newInteractionTarget = createInteractionTarget({
12778
+ domRef,
12779
+ orientation,
12780
+ dragListId,
12781
+ initial: false,
12782
+ acceptDropsFrom,
12783
+ shouldAcceptDrop
12784
+ });
12785
+ interactionTarget.once("unregister", () => {
12786
+ setInteractionTarget(null);
12787
+ });
12788
+ setInteractionTarget(newInteractionTarget);
12789
+ }
12790
+ });
12765
12791
  }
12766
12792
  function createDefaultProxy(dragItemNode, initialRect) {
12767
12793
  const proxy = dragItemNode.cloneNode(true);
@@ -12797,6 +12823,444 @@ function cleanupProxy(proxyStateRef) {
12797
12823
  state.originalNode.style.visibility = "";
12798
12824
  proxyStateRef.current = null;
12799
12825
  }
12826
+ function getDragItemNodes(dragItemsRef, domRef, dragListId) {
12827
+ let dragItems = dragItemsRef.current;
12828
+ if (!dragItems || dragItems.length === 0) {
12829
+ dragItems = getDraggableItemNodes(domRef, dragListId);
12830
+ dragItemsRef.current = dragItems;
12831
+ }
12832
+ return dragItems;
12833
+ }
12834
+ function bindInteractionTarget(interactionTarget, options) {
12835
+ const {
12836
+ dragListId,
12837
+ orientation,
12838
+ domRef,
12839
+ proxyStateRef,
12840
+ sourceScrollOffsetRef,
12841
+ dragItemsRef,
12842
+ getDragItems,
12843
+ getOnDrop,
12844
+ getOnAcceptDrop,
12845
+ getOnRemove,
12846
+ getUpdatePosition,
12847
+ updateDragOperationSourceAndTarget,
12848
+ updateDragProxyRenderState
12849
+ } = options;
12850
+ const removeOnDragStart = interactionTarget.on(
12851
+ "start",
12852
+ ({ dragItem, dragSourceListId, dropTargetListId }) => {
12853
+ updateDragOperationSourceAndTarget({
12854
+ dragSourceListId,
12855
+ dropTargetListId,
12856
+ dragItemId: dragItem.id,
12857
+ status: "accepted"
12858
+ });
12859
+ }
12860
+ );
12861
+ const removeOnDragMove = interactionTarget.on(
12862
+ "move",
12863
+ ({ offsetsForItems, items, status, dragItem }) => {
12864
+ if (status === "rejected") {
12865
+ return;
12866
+ }
12867
+ const dragItems = getDragItems();
12868
+ const updatePosition = getUpdatePosition();
12869
+ const proxyState = proxyStateRef.current;
12870
+ items.forEach((item, index) => {
12871
+ let offset = offsetsForItems[index];
12872
+ const node = dragItems[index];
12873
+ if (!node) {
12874
+ return;
12875
+ }
12876
+ if (proxyState && item.id === proxyState.dragItemId) {
12877
+ return;
12878
+ }
12879
+ if (!proxyState && item.id === dragItem.id) {
12880
+ const scrollOffset = sourceScrollOffsetRef.current;
12881
+ offset = {
12882
+ left: offset.left + scrollOffset.left,
12883
+ top: offset.top + scrollOffset.top
12884
+ };
12885
+ }
12886
+ updatePosition({
12887
+ id: item.id,
12888
+ node,
12889
+ offset
12890
+ });
12891
+ });
12892
+ }
12893
+ );
12894
+ const removeOnDragDrop = interactionTarget.on("drop", (params) => {
12895
+ const {
12896
+ sortedIndexes,
12897
+ dragIndex,
12898
+ dropIndex,
12899
+ dragItem,
12900
+ items,
12901
+ dragSourceListId,
12902
+ dropTargetListId,
12903
+ outside,
12904
+ status
12905
+ } = params;
12906
+ const dragItems = getDragItems();
12907
+ dragItemsRef.current = [];
12908
+ const onAcceptDrop = getOnAcceptDrop();
12909
+ const onRemove = getOnRemove();
12910
+ const onDrop = getOnDrop();
12911
+ const updatePosition = getUpdatePosition();
12912
+ items.forEach((item, index) => {
12913
+ const node = dragItems[index];
12914
+ if (!node) {
12915
+ return;
12916
+ }
12917
+ updatePosition({
12918
+ id: item.id,
12919
+ node,
12920
+ offset: null
12921
+ });
12922
+ });
12923
+ cleanupProxy(proxyStateRef);
12924
+ updateDragProxyRenderState((prev) => {
12925
+ if (!prev) return prev;
12926
+ requestAnimationFrame(() => updateDragProxyRenderState(RETURN_NULL));
12927
+ return { ...prev, dragItemId: null };
12928
+ });
12929
+ const accepted = status === "accepted";
12930
+ if (dragListId === dropTargetListId && dragSourceListId !== dragListId) {
12931
+ if (onAcceptDrop && accepted) {
12932
+ onAcceptDrop({
12933
+ dragItemId: dragItem.id,
12934
+ dragSourceListId,
12935
+ dropTargetListId,
12936
+ dragIndex,
12937
+ dropIndex,
12938
+ dropItemId: items[dropIndex]?.id
12939
+ });
12940
+ }
12941
+ }
12942
+ let callbackFn = null;
12943
+ if (dropIndex === -1 && dragSourceListId === dragListId && dropTargetListId === dragListId && outside) {
12944
+ callbackFn = onRemove;
12945
+ }
12946
+ if (dropIndex !== -1 && dropTargetListId === dragListId && dragSourceListId === dragListId) {
12947
+ callbackFn = onDrop;
12948
+ }
12949
+ if (callbackFn) {
12950
+ callbackFn?.(sortedIndexes, {
12951
+ dragIndex,
12952
+ dropIndex,
12953
+ dragItemId: items[dragIndex].id,
12954
+ dropItemId: items[dropIndex]?.id
12955
+ });
12956
+ }
12957
+ });
12958
+ let targetAutoScroller = null;
12959
+ let targetScrollContainer = null;
12960
+ let targetScrollHandler = null;
12961
+ let targetPointermoveHandler = null;
12962
+ if (!interactionTarget.getData().initial && domRef.current) {
12963
+ targetAutoScroller = new AutoScroller({
12964
+ orientation,
12965
+ onScroll: () => {
12966
+ }
12967
+ });
12968
+ targetAutoScroller.start(domRef.current);
12969
+ targetScrollContainer = targetAutoScroller.getScrollContainer();
12970
+ if (targetScrollContainer) {
12971
+ let lastScroll = orientation === "vertical" ? targetScrollContainer.scrollTop : targetScrollContainer.scrollLeft;
12972
+ targetScrollHandler = () => {
12973
+ const current = orientation === "vertical" ? targetScrollContainer.scrollTop : targetScrollContainer.scrollLeft;
12974
+ const delta = current - lastScroll;
12975
+ lastScroll = current;
12976
+ if (delta !== 0) {
12977
+ interactionTarget.adjustForScroll(delta);
12978
+ DragManager.retriggerMove();
12979
+ }
12980
+ };
12981
+ targetScrollContainer.addEventListener("scroll", targetScrollHandler);
12982
+ }
12983
+ targetPointermoveHandler = (e) => {
12984
+ targetAutoScroller.updatePointer({
12985
+ left: e.clientX,
12986
+ top: e.clientY
12987
+ });
12988
+ };
12989
+ getGlobal().addEventListener("pointermove", targetPointermoveHandler);
12990
+ }
12991
+ return () => {
12992
+ removeOnDragStart();
12993
+ removeOnDragMove();
12994
+ removeOnDragDrop();
12995
+ if (targetAutoScroller) {
12996
+ targetAutoScroller.stop();
12997
+ }
12998
+ if (targetScrollContainer && targetScrollHandler) {
12999
+ targetScrollContainer.removeEventListener("scroll", targetScrollHandler);
13000
+ }
13001
+ if (targetPointermoveHandler) {
13002
+ getGlobal().removeEventListener("pointermove", targetPointermoveHandler);
13003
+ }
13004
+ };
13005
+ }
13006
+ function startDragOnPointerDown(e, props, options) {
13007
+ const {
13008
+ dragListId,
13009
+ orientation,
13010
+ acceptDropsFrom,
13011
+ preserveDragSpace,
13012
+ onDragProxySetup
13013
+ } = props;
13014
+ const {
13015
+ domRef,
13016
+ proxyStateRef,
13017
+ sourceScrollOffsetRef,
13018
+ dragItemsRef,
13019
+ setInteractionTarget,
13020
+ updateDragProxyRenderState
13021
+ } = options;
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 target = e.currentTarget;
13027
+ let dragItemId = target.getAttribute(DRAG_ITEM_ATTRIBUTE);
13028
+ if (dragItemId == null) {
13029
+ const parentDragItem = selectParent(target, DRAG_ITEM_SELECTOR);
13030
+ if (parentDragItem) {
13031
+ dragItemId = parentDragItem.getAttribute(DRAG_ITEM_ATTRIBUTE);
13032
+ }
13033
+ }
13034
+ if (dragItemId == null) {
13035
+ console.warn(
13036
+ `Could not find drag item id for element`,
13037
+ target,
13038
+ `Make sure you have a parent element with a ${DRAG_ITEM_ATTRIBUTE} attribute`
13039
+ );
13040
+ return;
13041
+ }
13042
+ dragItemId = `${dragItemId}`;
13043
+ let dragOperation = null;
13044
+ const dragItems = getDraggableItemNodes(domRef, dragListId);
13045
+ dragItemsRef.current = dragItems;
13046
+ const interactionTarget = createInteractionTarget({
13047
+ domRef,
13048
+ orientation,
13049
+ dragListId,
13050
+ acceptDropsFrom,
13051
+ initial: true,
13052
+ preserveDragSpace
13053
+ });
13054
+ const draggableItems = interactionTarget.getData().draggableItems;
13055
+ const dragIndex = draggableItems.findIndex((item) => item.id === dragItemId);
13056
+ if (dragIndex === -1) {
13057
+ return;
13058
+ }
13059
+ const dragItem = draggableItems[dragIndex];
13060
+ const dragItemNode = dragItems[dragIndex]?.getAttribute(DRAG_ITEM_ATTRIBUTE) === `${dragItemId}` ? dragItems[dragIndex] : dragItems.find(
13061
+ (node) => node.getAttribute(DRAG_ITEM_ATTRIBUTE) === `${dragItemId}`
13062
+ );
13063
+ setInteractionTarget(interactionTarget);
13064
+ const initialCoords = {
13065
+ left: e.clientX,
13066
+ top: e.clientY
13067
+ };
13068
+ let lastPointer = { left: e.clientX, top: e.clientY };
13069
+ sourceScrollOffsetRef.current = { top: 0, left: 0 };
13070
+ const autoScroller = new AutoScroller({
13071
+ orientation,
13072
+ onScroll: () => {
13073
+ }
13074
+ });
13075
+ if (domRef.current) {
13076
+ autoScroller.start(domRef.current);
13077
+ }
13078
+ const scrollContainer = autoScroller.getScrollContainer();
13079
+ let lastSourceScroll = scrollContainer ? orientation === "vertical" ? scrollContainer.scrollTop : scrollContainer.scrollLeft : 0;
13080
+ function fireDragMove() {
13081
+ if (!dragOperation) return;
13082
+ dragOperation.move({
13083
+ left: lastPointer.left,
13084
+ top: lastPointer.top
13085
+ });
13086
+ }
13087
+ const onContainerScroll = () => {
13088
+ if (!scrollContainer) return;
13089
+ const current = orientation === "vertical" ? scrollContainer.scrollTop : scrollContainer.scrollLeft;
13090
+ const delta = current - lastSourceScroll;
13091
+ lastSourceScroll = current;
13092
+ if (delta !== 0) {
13093
+ interactionTarget.adjustForScroll(delta);
13094
+ if (orientation === "vertical") {
13095
+ sourceScrollOffsetRef.current.top += delta;
13096
+ } else {
13097
+ sourceScrollOffsetRef.current.left += delta;
13098
+ }
13099
+ }
13100
+ fireDragMove();
13101
+ };
13102
+ scrollContainer?.addEventListener("scroll", onContainerScroll);
13103
+ const onPointerMove = (e2) => {
13104
+ lastPointer = { left: e2.clientX, top: e2.clientY };
13105
+ if (!dragOperation) {
13106
+ dragOperation = DragManager.startDrag(
13107
+ {
13108
+ listId: dragListId,
13109
+ dragItem,
13110
+ dragIndex
13111
+ },
13112
+ initialCoords
13113
+ );
13114
+ if (dragItemNode && useProxy) {
13115
+ const rect = dragItemNode.getBoundingClientRect();
13116
+ let cachedProxy = null;
13117
+ const setupParams = {
13118
+ dragItemNode,
13119
+ dragItemId: `${dragItemId}`,
13120
+ initialRect: rect,
13121
+ initialCoords,
13122
+ get proxyElement() {
13123
+ if (!cachedProxy) {
13124
+ cachedProxy = createDefaultProxy(dragItemNode, rect);
13125
+ }
13126
+ return cachedProxy;
13127
+ }
13128
+ };
13129
+ const setupResult = onDragProxySetup?.(setupParams);
13130
+ const proxyElement = setupResult?.proxyElement ?? setupParams.proxyElement;
13131
+ dragItemNode.style.visibility = "hidden";
13132
+ proxyStateRef.current = {
13133
+ proxyElement,
13134
+ originalNode: dragItemNode,
13135
+ dragItemId: `${dragItemId}`,
13136
+ initialRect: rect,
13137
+ cleanup: setupResult?.cleanup
13138
+ };
13139
+ }
13140
+ if (dragItemNode && useRenderProxy) {
13141
+ const rect = dragItemNode.getBoundingClientRect();
13142
+ dragItemNode.style.visibility = "hidden";
13143
+ proxyStateRef.current = {
13144
+ proxyElement: dragItemNode,
13145
+ originalNode: dragItemNode,
13146
+ dragItemId: `${dragItemId}`,
13147
+ initialRect: rect,
13148
+ // Portal handles its own DOM; only restore visibility.
13149
+ cleanup: () => {
13150
+ }
13151
+ };
13152
+ const initialRenderState = {
13153
+ dragItemId: `${dragItemId}`,
13154
+ initialRect: rect,
13155
+ dx: 0,
13156
+ dy: 0
13157
+ };
13158
+ updateDragProxyRenderState(() => initialRenderState);
13159
+ }
13160
+ }
13161
+ const dx = e2.clientX - initialCoords.left;
13162
+ const dy = e2.clientY - initialCoords.top;
13163
+ if (useRenderProxy) {
13164
+ updateDragProxyRenderState((prev) => prev ? { ...prev, dx, dy } : prev);
13165
+ } else {
13166
+ const proxyState = proxyStateRef.current;
13167
+ if (proxyState) {
13168
+ proxyMove({ proxyElement: proxyState.proxyElement, dx, dy });
13169
+ }
13170
+ }
13171
+ autoScroller.updatePointer({
13172
+ left: e2.clientX,
13173
+ top: e2.clientY
13174
+ });
13175
+ fireDragMove();
13176
+ };
13177
+ const preventNativeDrag = (e2) => {
13178
+ e2.preventDefault();
13179
+ };
13180
+ const endDrag = (cancelled) => {
13181
+ autoScroller.stop();
13182
+ scrollContainer?.removeEventListener("scroll", onContainerScroll);
13183
+ win.removeEventListener("pointermove", onPointerMove);
13184
+ win.removeEventListener("pointerup", onPointerUp);
13185
+ win.removeEventListener("pointercancel", onPointerCancel);
13186
+ win.removeEventListener("dragstart", preventNativeDrag, true);
13187
+ if (useRenderProxy) {
13188
+ updateDragProxyRenderState(
13189
+ (prev) => prev ? { ...prev, dragItemId: null } : prev
13190
+ );
13191
+ requestAnimationFrame(() => {
13192
+ updateDragProxyRenderState(RETURN_NULL);
13193
+ });
13194
+ }
13195
+ if (!dragOperation) {
13196
+ cleanupProxy(proxyStateRef);
13197
+ setInteractionTarget(null);
13198
+ return;
13199
+ }
13200
+ if (cancelled) {
13201
+ dragOperation.cancel();
13202
+ } else {
13203
+ dragOperation.drop();
13204
+ }
13205
+ dragOperation = null;
13206
+ };
13207
+ const onPointerUp = () => endDrag(false);
13208
+ const onPointerCancel = () => endDrag(true);
13209
+ const win = getGlobal();
13210
+ win.addEventListener("pointermove", onPointerMove);
13211
+ win.addEventListener("pointerup", onPointerUp);
13212
+ win.addEventListener("pointercancel", onPointerCancel);
13213
+ win.addEventListener("dragstart", preventNativeDrag, true);
13214
+ }
13215
+
13216
+ // src/components/InfiniteTable/components/draggable/DragList.tsx
13217
+ var DragListContext = React31.createContext({
13218
+ dragItemId: null,
13219
+ onDragItemPointerDown: () => {
13220
+ },
13221
+ draggingInProgress: false,
13222
+ dragListId: "",
13223
+ status: "accepted",
13224
+ dragSourceListId: null,
13225
+ dropTargetListId: null
13226
+ });
13227
+ var useDragListContext = () => {
13228
+ return React31.useContext(DragListContext);
13229
+ };
13230
+ function useInteractionTarget(domRef, props) {
13231
+ const getProps = useLatest(props);
13232
+ const [interactionTarget, doSetInteractionTarget] = React31.useState(null);
13233
+ const registeredTargetRef = React31.useRef(null);
13234
+ const setInteractionTarget = (0, import_react24.useCallback)(
13235
+ (interactionTarget2) => {
13236
+ replaceRegisteredInteractionTarget(
13237
+ registeredTargetRef,
13238
+ interactionTarget2
13239
+ );
13240
+ doSetInteractionTarget(interactionTarget2);
13241
+ },
13242
+ []
13243
+ );
13244
+ const getInteractionTarget = useLatest(interactionTarget);
13245
+ (0, import_react24.useEffect)(() => {
13246
+ return () => {
13247
+ DragManager.unregisterDragInteractionTarget(registeredTargetRef.current);
13248
+ registeredTargetRef.current = null;
13249
+ };
13250
+ }, []);
13251
+ (0, import_react24.useEffect)(() => {
13252
+ return acceptDragsFromOtherLists({
13253
+ getProps,
13254
+ domRef,
13255
+ setInteractionTarget
13256
+ });
13257
+ }, [getProps]);
13258
+ return {
13259
+ interactionTarget,
13260
+ setInteractionTarget,
13261
+ getInteractionTarget
13262
+ };
13263
+ }
12800
13264
  var DragList = (props) => {
12801
13265
  const domRef = React31.useRef(null);
12802
13266
  const proxyStateRef = React31.useRef(null);
@@ -12819,375 +13283,42 @@ var DragList = (props) => {
12819
13283
  props
12820
13284
  );
12821
13285
  (0, import_react24.useEffect)(() => {
12822
- const dragList = document.querySelector(
12823
- `[${DRAG_LIST_ATTRIBUTE}="${props.dragListId}"]`
12824
- );
12825
- if (dragList) {
12826
- domRef.current = dragList;
12827
- } else {
12828
- console.warn(
12829
- `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.`
12830
- );
12831
- }
13286
+ findDragListElement(domRef, props.dragListId);
12832
13287
  }, [props.dragListId]);
12833
13288
  (0, import_react24.useEffect)(() => {
12834
13289
  if (interactionTarget) {
12835
- const dragListId = props.dragListId;
12836
- const removeOnDragStart = interactionTarget.on(
12837
- "start",
12838
- ({ dragItem, dragSourceListId: dragSourceListId2, dropTargetListId: dropTargetListId2 }) => {
12839
- updateDragOperationSourceAndTarget({
12840
- dragSourceListId: dragSourceListId2,
12841
- dropTargetListId: dropTargetListId2,
12842
- dragItemId: dragItem.id,
12843
- status: "accepted"
12844
- });
12845
- }
12846
- );
12847
- const removeOnDragMove = interactionTarget.on(
12848
- "move",
12849
- ({ offsetsForItems, items, status: status2, dragItem }) => {
12850
- if (status2 === "rejected") {
12851
- return;
12852
- }
12853
- const dragItems = getDragItems();
12854
- const updatePosition = getUpdatePosition();
12855
- const proxyState = proxyStateRef.current;
12856
- items.forEach((item, index) => {
12857
- let offset = offsetsForItems[index];
12858
- const node = dragItems[index];
12859
- if (!node) {
12860
- return;
12861
- }
12862
- if (proxyState && item.id === proxyState.dragItemId) {
12863
- return;
12864
- }
12865
- if (!proxyState && item.id === dragItem.id) {
12866
- const scrollOffset = sourceScrollOffsetRef.current;
12867
- offset = {
12868
- left: offset.left + scrollOffset.left,
12869
- top: offset.top + scrollOffset.top
12870
- };
12871
- }
12872
- updatePosition({
12873
- id: item.id,
12874
- node,
12875
- offset
12876
- });
12877
- });
12878
- }
12879
- );
12880
- const removeOnDragDrop = interactionTarget.on("drop", (params) => {
12881
- const {
12882
- sortedIndexes,
12883
- dragIndex,
12884
- dropIndex,
12885
- dragItem,
12886
- items,
12887
- dragSourceListId: dragSourceListId2,
12888
- dropTargetListId: dropTargetListId2,
12889
- outside,
12890
- status: status2
12891
- } = params;
12892
- const dragItems = getDragItems();
12893
- dragItemsRef.current = [];
12894
- const onAcceptDrop = getOnAcceptDrop();
12895
- const onRemove = getOnRemove();
12896
- const onDrop = getOnDrop();
12897
- const updatePosition = getUpdatePosition();
12898
- items.forEach((item, index) => {
12899
- const node = dragItems[index];
12900
- if (!node) {
12901
- return;
12902
- }
12903
- updatePosition({
12904
- id: item.id,
12905
- node,
12906
- offset: null
12907
- });
12908
- });
12909
- cleanupProxy(proxyStateRef);
12910
- setDragProxyRenderState((prev) => {
12911
- if (!prev) return prev;
12912
- requestAnimationFrame(() => setDragProxyRenderState(null));
12913
- return { ...prev, dragItemId: null };
12914
- });
12915
- const accepted = status2 === "accepted";
12916
- if (dragListId === dropTargetListId2 && dragSourceListId2 !== dragListId) {
12917
- if (onAcceptDrop && accepted) {
12918
- onAcceptDrop({
12919
- dragItemId: dragItem.id,
12920
- dragSourceListId: dragSourceListId2,
12921
- dropTargetListId: dropTargetListId2,
12922
- dragIndex,
12923
- dropIndex,
12924
- dropItemId: items[dropIndex]?.id
12925
- });
12926
- }
12927
- }
12928
- let callbackFn = null;
12929
- if (dropIndex === -1 && dragSourceListId2 === dragListId && dropTargetListId2 === dragListId && outside) {
12930
- callbackFn = onRemove;
12931
- }
12932
- if (dropIndex !== -1 && dropTargetListId2 === dragListId && dragSourceListId2 === dragListId) {
12933
- callbackFn = onDrop;
12934
- }
12935
- if (callbackFn) {
12936
- callbackFn?.(sortedIndexes, {
12937
- dragIndex,
12938
- dropIndex,
12939
- dragItemId: items[dragIndex].id,
12940
- dropItemId: items[dropIndex]?.id
12941
- });
12942
- }
13290
+ return bindInteractionTarget(interactionTarget, {
13291
+ dragListId: props.dragListId,
13292
+ orientation: props.orientation,
13293
+ domRef,
13294
+ proxyStateRef,
13295
+ sourceScrollOffsetRef,
13296
+ dragItemsRef,
13297
+ getDragItems,
13298
+ getOnDrop,
13299
+ getOnAcceptDrop,
13300
+ getOnRemove,
13301
+ getUpdatePosition,
13302
+ updateDragOperationSourceAndTarget,
13303
+ updateDragProxyRenderState: setDragProxyRenderState
12943
13304
  });
12944
- let targetAutoScroller = null;
12945
- let targetScrollContainer = null;
12946
- let targetScrollHandler = null;
12947
- let targetPointermoveHandler = null;
12948
- if (!interactionTarget.getData().initial && domRef.current) {
12949
- targetAutoScroller = new AutoScroller({
12950
- orientation: props.orientation,
12951
- onScroll: () => {
12952
- }
12953
- });
12954
- targetAutoScroller.start(domRef.current);
12955
- targetScrollContainer = targetAutoScroller.getScrollContainer();
12956
- if (targetScrollContainer) {
12957
- let lastScroll = props.orientation === "vertical" ? targetScrollContainer.scrollTop : targetScrollContainer.scrollLeft;
12958
- targetScrollHandler = () => {
12959
- const current = props.orientation === "vertical" ? targetScrollContainer.scrollTop : targetScrollContainer.scrollLeft;
12960
- const delta = current - lastScroll;
12961
- lastScroll = current;
12962
- if (delta !== 0) {
12963
- interactionTarget.adjustForScroll(delta);
12964
- DragManager.retriggerMove();
12965
- }
12966
- };
12967
- targetScrollContainer.addEventListener("scroll", targetScrollHandler);
12968
- }
12969
- targetPointermoveHandler = (e) => {
12970
- targetAutoScroller.updatePointer({
12971
- left: e.clientX,
12972
- top: e.clientY
12973
- });
12974
- };
12975
- getGlobal().addEventListener("pointermove", targetPointermoveHandler);
12976
- }
12977
- return () => {
12978
- removeOnDragStart();
12979
- removeOnDragMove();
12980
- removeOnDragDrop();
12981
- if (targetAutoScroller) {
12982
- targetAutoScroller.stop();
12983
- }
12984
- if (targetScrollContainer && targetScrollHandler) {
12985
- targetScrollContainer.removeEventListener(
12986
- "scroll",
12987
- targetScrollHandler
12988
- );
12989
- }
12990
- if (targetPointermoveHandler) {
12991
- getGlobal().removeEventListener(
12992
- "pointermove",
12993
- targetPointermoveHandler
12994
- );
12995
- }
12996
- };
12997
13305
  }
12998
13306
  return void 0;
12999
13307
  }, [interactionTarget, props.dragListId]);
13000
13308
  const dragItemsRef = React31.useRef([]);
13001
13309
  const getDragItems = (0, import_react24.useCallback)(() => {
13002
- let dragItems = dragItemsRef.current;
13003
- if (!dragItems || dragItems.length === 0) {
13004
- dragItems = getDraggableItemNodes(domRef, props.dragListId);
13005
- dragItemsRef.current = dragItems;
13006
- }
13007
- return dragItems;
13310
+ return getDragItemNodes(dragItemsRef, domRef, props.dragListId);
13008
13311
  }, [props.dragListId]);
13009
13312
  const onDragItemPointerDown = (0, import_react24.useCallback)(
13010
13313
  (e) => {
13011
- const target = e.currentTarget;
13012
- let dragItemId2 = target.getAttribute(DRAG_ITEM_ATTRIBUTE);
13013
- if (dragItemId2 == null) {
13014
- const parentDragItem = selectParent(target, DRAG_ITEM_SELECTOR);
13015
- if (parentDragItem) {
13016
- dragItemId2 = parentDragItem.getAttribute(DRAG_ITEM_ATTRIBUTE);
13017
- }
13018
- }
13019
- if (dragItemId2 == null) {
13020
- console.warn(
13021
- `Could not find drag item id for element`,
13022
- target,
13023
- `Make sure you have a parent element with a ${DRAG_ITEM_ATTRIBUTE} attribute`
13024
- );
13025
- return;
13026
- }
13027
- dragItemId2 = `${dragItemId2}`;
13028
- let dragOperation = null;
13029
- const dragItems = getDraggableItemNodes(domRef, props.dragListId);
13030
- dragItemsRef.current = dragItems;
13031
- const interactionTarget2 = createInteractionTarget({
13314
+ startDragOnPointerDown(e, props, {
13032
13315
  domRef,
13033
- orientation: props.orientation,
13034
- dragListId: props.dragListId,
13035
- acceptDropsFrom: props.acceptDropsFrom,
13036
- initial: true,
13037
- preserveDragSpace: props.preserveDragSpace
13038
- });
13039
- const draggableItems = interactionTarget2.getData().draggableItems;
13040
- const dragIndex = draggableItems.findIndex(
13041
- (item) => item.id === dragItemId2
13042
- );
13043
- if (dragIndex === -1) {
13044
- return;
13045
- }
13046
- const dragItem = draggableItems[dragIndex];
13047
- const dragItemNode = dragItems[dragIndex]?.getAttribute(DRAG_ITEM_ATTRIBUTE) === `${dragItemId2}` ? dragItems[dragIndex] : dragItems.find(
13048
- (node) => node.getAttribute(DRAG_ITEM_ATTRIBUTE) === `${dragItemId2}`
13049
- );
13050
- setInteractionTarget(interactionTarget2);
13051
- const initialCoords = {
13052
- left: e.clientX,
13053
- top: e.clientY
13054
- };
13055
- let lastPointer = { left: e.clientX, top: e.clientY };
13056
- sourceScrollOffsetRef.current = { top: 0, left: 0 };
13057
- const autoScroller = new AutoScroller({
13058
- orientation: props.orientation,
13059
- onScroll: () => {
13060
- }
13316
+ proxyStateRef,
13317
+ sourceScrollOffsetRef,
13318
+ dragItemsRef,
13319
+ setInteractionTarget,
13320
+ updateDragProxyRenderState: setDragProxyRenderState
13061
13321
  });
13062
- if (domRef.current) {
13063
- autoScroller.start(domRef.current);
13064
- }
13065
- const scrollContainer = autoScroller.getScrollContainer();
13066
- let lastSourceScroll = scrollContainer ? props.orientation === "vertical" ? scrollContainer.scrollTop : scrollContainer.scrollLeft : 0;
13067
- function fireDragMove() {
13068
- if (!dragOperation) return;
13069
- dragOperation.move({
13070
- left: lastPointer.left,
13071
- top: lastPointer.top
13072
- });
13073
- }
13074
- const onContainerScroll = () => {
13075
- if (!scrollContainer) return;
13076
- const current = props.orientation === "vertical" ? scrollContainer.scrollTop : scrollContainer.scrollLeft;
13077
- const delta = current - lastSourceScroll;
13078
- lastSourceScroll = current;
13079
- if (delta !== 0) {
13080
- interactionTarget2.adjustForScroll(delta);
13081
- if (props.orientation === "vertical") {
13082
- sourceScrollOffsetRef.current.top += delta;
13083
- } else {
13084
- sourceScrollOffsetRef.current.left += delta;
13085
- }
13086
- }
13087
- fireDragMove();
13088
- };
13089
- scrollContainer?.addEventListener("scroll", onContainerScroll);
13090
- const dragStrategy = props.dragStrategy ?? "proxy";
13091
- const useProxy = dragStrategy === "proxy" && !props.renderDragProxy;
13092
- const useRenderProxy = dragStrategy === "proxy" && !!props.renderDragProxy;
13093
- const proxyMove = props.onDragProxyMove ?? defaultDragProxyMove;
13094
- const onPointerMove = (e2) => {
13095
- lastPointer = { left: e2.clientX, top: e2.clientY };
13096
- if (!dragOperation) {
13097
- dragOperation = DragManager.startDrag(
13098
- {
13099
- listId: props.dragListId,
13100
- dragItem,
13101
- dragIndex
13102
- },
13103
- initialCoords
13104
- );
13105
- if (dragItemNode && useProxy) {
13106
- const rect = dragItemNode.getBoundingClientRect();
13107
- let cachedProxy = null;
13108
- const setupParams = {
13109
- dragItemNode,
13110
- dragItemId: `${dragItemId2}`,
13111
- initialRect: rect,
13112
- initialCoords,
13113
- get proxyElement() {
13114
- if (!cachedProxy) {
13115
- cachedProxy = createDefaultProxy(dragItemNode, rect);
13116
- }
13117
- return cachedProxy;
13118
- }
13119
- };
13120
- const setupResult = props.onDragProxySetup?.(setupParams);
13121
- const proxyElement = setupResult?.proxyElement ?? setupParams.proxyElement;
13122
- dragItemNode.style.visibility = "hidden";
13123
- proxyStateRef.current = {
13124
- proxyElement,
13125
- originalNode: dragItemNode,
13126
- dragItemId: `${dragItemId2}`,
13127
- initialRect: rect,
13128
- cleanup: setupResult?.cleanup
13129
- };
13130
- }
13131
- if (dragItemNode && useRenderProxy) {
13132
- const rect = dragItemNode.getBoundingClientRect();
13133
- dragItemNode.style.visibility = "hidden";
13134
- proxyStateRef.current = {
13135
- proxyElement: dragItemNode,
13136
- originalNode: dragItemNode,
13137
- dragItemId: `${dragItemId2}`,
13138
- initialRect: rect,
13139
- // Portal handles its own DOM; only restore visibility.
13140
- cleanup: () => {
13141
- }
13142
- };
13143
- setDragProxyRenderState({
13144
- dragItemId: `${dragItemId2}`,
13145
- initialRect: rect,
13146
- dx: 0,
13147
- dy: 0
13148
- });
13149
- }
13150
- }
13151
- const dx = e2.clientX - initialCoords.left;
13152
- const dy = e2.clientY - initialCoords.top;
13153
- if (useRenderProxy) {
13154
- setDragProxyRenderState(
13155
- (prev) => prev ? { ...prev, dx, dy } : prev
13156
- );
13157
- } else {
13158
- const proxyState = proxyStateRef.current;
13159
- if (proxyState) {
13160
- proxyMove({ proxyElement: proxyState.proxyElement, dx, dy });
13161
- }
13162
- }
13163
- autoScroller.updatePointer({
13164
- left: e2.clientX,
13165
- top: e2.clientY
13166
- });
13167
- fireDragMove();
13168
- };
13169
- const onPointerUp = () => {
13170
- autoScroller.stop();
13171
- scrollContainer?.removeEventListener("scroll", onContainerScroll);
13172
- getGlobal().removeEventListener("pointermove", onPointerMove);
13173
- if (useRenderProxy) {
13174
- setDragProxyRenderState(
13175
- (prev) => prev ? { ...prev, dragItemId: null } : prev
13176
- );
13177
- requestAnimationFrame(() => {
13178
- setDragProxyRenderState(null);
13179
- });
13180
- }
13181
- if (!dragOperation) {
13182
- cleanupProxy(proxyStateRef);
13183
- setInteractionTarget(null);
13184
- return;
13185
- }
13186
- dragOperation.drop();
13187
- dragOperation = null;
13188
- };
13189
- getGlobal().addEventListener("pointermove", onPointerMove);
13190
- getGlobal().addEventListener("pointerup", onPointerUp, { once: true });
13191
13322
  },
13192
13323
  [
13193
13324
  props.orientation,
@@ -13237,10 +13368,6 @@ var DragList = (props) => {
13237
13368
  ref: proxyRefCallback
13238
13369
  }) : null);
13239
13370
  };
13240
- var DRAG_LIST_ATTRIBUTE = "data-drag-list-id";
13241
- var DRAG_ITEM_ATTRIBUTE = "data-drag-item-id";
13242
- var DRAG_ITEM_LIST_ATTRIBUTE = "data-drag-item-list-id";
13243
- var DRAG_ITEM_SELECTOR = `[${DRAG_ITEM_ATTRIBUTE}]`;
13244
13371
  var DragItemContext = React31.createContext({
13245
13372
  dragItemId: "",
13246
13373
  dragListId: "",
@@ -14648,13 +14775,13 @@ var MatrixBrain = class extends Logger {
14648
14775
  * transforms that follow the scroll position should use.
14649
14776
  */
14650
14777
  getDOMScrollPosition(scrollPosition = this.getScrollPosition()) {
14651
- const origin2 = this.getScrollOrigin();
14652
- if (!origin2.scrollTop && !origin2.scrollLeft) {
14778
+ const origin = this.getScrollOrigin();
14779
+ if (!origin.scrollTop && !origin.scrollLeft) {
14653
14780
  return scrollPosition;
14654
14781
  }
14655
14782
  return {
14656
- scrollTop: scrollPosition.scrollTop - origin2.scrollTop,
14657
- scrollLeft: scrollPosition.scrollLeft - origin2.scrollLeft
14783
+ scrollTop: scrollPosition.scrollTop - origin.scrollTop,
14784
+ scrollLeft: scrollPosition.scrollLeft - origin.scrollLeft
14658
14785
  };
14659
14786
  }
14660
14787
  // a method (not an arrow property) so subclasses can call it via super
@@ -14688,8 +14815,8 @@ var MatrixBrain = class extends Logger {
14688
14815
  if (this.destroyed) {
14689
14816
  return;
14690
14817
  }
14691
- const origin2 = this.getScrollOrigin();
14692
- this.onScrollOriginChangeFns.forEach((fn) => fn(origin2));
14818
+ const origin = this.getScrollOrigin();
14819
+ this.onScrollOriginChangeFns.forEach((fn) => fn(origin));
14693
14820
  }
14694
14821
  doUpdateRenderCount(which = ALL_DIRECTIONS) {
14695
14822
  if (!this.availableWidth || !this.availableHeight) {
@@ -15425,6 +15552,7 @@ var ListRowManager = class extends Logger {
15425
15552
  var ITEM_POSITION_WITH_TRANSFORM = true;
15426
15553
  var currentTransformY = stripVar(InternalVars.y);
15427
15554
  var scrollTopCSSVar = stripVar(InternalVars.scrollTop);
15555
+ var scrollLeftCSSVar2 = stripVar(InternalVars.scrollLeft);
15428
15556
  var columnOffsetAtIndex2 = stripVar(InternalVars.columnOffsetAtIndex);
15429
15557
  var columnOffsetAtIndexWhileReordering2 = stripVar(
15430
15558
  InternalVars.columnOffsetAtIndexWhileReordering
@@ -15438,6 +15566,16 @@ var GridRenderer = class extends Logger {
15438
15566
  this.scrolling = false;
15439
15567
  this.cellHoverClassNames = [];
15440
15568
  this.cellDetachedClassNames = [];
15569
+ /**
15570
+ * Inside InfiniteTable, the table owns the CSS vars that position the
15571
+ * cells horizontally (one offset var per column, plus the scroll position
15572
+ * vars used by pinned cells) and sets them on its root node.
15573
+ *
15574
+ * A HeadlessTable used on its own has nobody to set them. With this on,
15575
+ * the renderer writes each cell's x from the brain, and sets the scroll
15576
+ * position vars itself, on the parent node of the cells.
15577
+ */
15578
+ this.ownsPositionVars = false;
15441
15579
  this.lastEnteredRow = -1;
15442
15580
  this.lastExitedRow = -1;
15443
15581
  this.hoverRowUpdatesInProgress = /* @__PURE__ */ new Map();
@@ -15457,26 +15595,30 @@ var GridRenderer = class extends Logger {
15457
15595
  element.style.transform = `translate3d(${scrollLeft2 || 0}px, var(${currentTransformY}), 0)`;
15458
15596
  };
15459
15597
  this.setTransform = (element, _rowIndex, colIndex, {
15460
- //@ts-ignore
15461
15598
  x,
15462
15599
  y,
15463
- //@ts-ignore
15464
15600
  scrollLeft: scrollLeft2,
15465
15601
  scrollTop: scrollTop2
15466
15602
  }, zIndex2) => {
15467
15603
  const columnOffsetX = InternalVarUtils.columnOffsets.get(colIndex);
15468
15604
  const columnOffsetXWhileReordering = `${columnOffsetAtIndexWhileReordering2}-${colIndex}`;
15469
- const currentTransformYValue = scrollTop2 ? `calc( ${y}px + var(${scrollTopCSSVar}) )` : `${y - this.brain.getScrollOrigin().scrollTop}px`;
15605
+ const currentTransformYValue = scrollTop2 ? `calc( ${y}px + var(${scrollTopCSSVar}, 0px) )` : `${y - this.brain.getScrollOrigin().scrollTop}px`;
15470
15606
  if (element.__currentTransformY !== currentTransformYValue) {
15471
15607
  element.__currentTransformY = currentTransformYValue;
15472
15608
  element.style.setProperty(currentTransformY, currentTransformYValue);
15473
15609
  }
15474
- const transformValue = `translate3d(var(${columnOffsetXWhileReordering}, ${columnOffsetX}), var(${currentTransformY}), 0)`;
15610
+ const transformX2 = this.ownsPositionVars ? scrollLeft2 ? `calc( ${x}px + var(${scrollLeftCSSVar2}, 0px) )` : `${x - this.brain.getScrollOrigin().scrollLeft}px` : `var(${columnOffsetXWhileReordering}, ${columnOffsetX})`;
15611
+ const transformValue = `translate3d(${transformX2}, var(${currentTransformY}), 0)`;
15475
15612
  if (element.__transformValue !== transformValue) {
15476
15613
  element.__transformValue = transformValue;
15477
15614
  element.style.transform = transformValue;
15478
15615
  }
15479
- if (zIndex2 != null) {
15616
+ if (zIndex2 != null && this.ownsPositionVars) {
15617
+ const zIndexValue = `${zIndex2}`;
15618
+ if (element.__zIndex !== zIndexValue) {
15619
+ element.__zIndex = zIndexValue;
15620
+ element.style.zIndex = zIndexValue;
15621
+ }
15480
15622
  }
15481
15623
  };
15482
15624
  /**
@@ -15497,6 +15639,17 @@ var GridRenderer = class extends Logger {
15497
15639
  });
15498
15640
  this.adjustFixedElementsOnScroll();
15499
15641
  };
15642
+ /**
15643
+ * While a render pass is in progress, the cells it detaches are collected
15644
+ * here and only get the detached class names when the pass ends - if they
15645
+ * are still detached by then.
15646
+ *
15647
+ * Most of the cells detached by a render pass (while scrolling, all of
15648
+ * them) are re-attached at another position by the same pass, so they
15649
+ * would get the class names added and then removed, with no visible effect
15650
+ * - only the cost of the DOM writes and of the style invalidations.
15651
+ */
15652
+ this.cellsDetachedInRenderPass = null;
15500
15653
  this.getFullyVisibleRowsRange = () => {
15501
15654
  let {
15502
15655
  start: [startRow],
@@ -15986,11 +16139,18 @@ var GridRenderer = class extends Logger {
15986
16139
  itemElement.dataset.rowIndex = realCoords.rowIndex;
15987
16140
  itemElement.dataset.colIndex = realCoords.colIndex;
15988
16141
  if (ITEM_POSITION_WITH_TRANSFORM) {
15989
- this.setTransform(itemElement, rowIndex, colIndex, { x, y }, null);
16142
+ const fixedPlacement = this.ownsPositionVars ? this.getFixedCellPlacement(rowIndex, colIndex, { x, y }) : null;
16143
+ this.setTransform(
16144
+ itemElement,
16145
+ rowIndex,
16146
+ colIndex,
16147
+ fixedPlacement ?? { x, y },
16148
+ null
16149
+ );
15990
16150
  itemElement.style.willChange = "transform";
15991
16151
  itemElement.style.backfaceVisibility = "hidden";
15992
16152
  const hidden = options ? options.hidden : !!this.isCellCovered(rowIndex, colIndex);
15993
- const zIndex2 = hidden ? "-1" : (
16153
+ const zIndex2 = hidden ? "-1" : fixedPlacement ? `${fixedPlacement.zIndex}` : (
15994
16154
  // #updatezindex - we need to allow elements use their own zIndex, so we
15995
16155
  // resort to allowing them to have it as a data-z-index attribute
15996
16156
  itemElement.dataset.zIndex || "auto"
@@ -16093,126 +16253,51 @@ var GridRenderer = class extends Logger {
16093
16253
  // fixed cells are positioned with these, inside the scroll layer
16094
16254
  // which is translated relative to the scroll origin
16095
16255
  brain.getDOMScrollPosition(scrollPosition),
16096
- this.getInfiniteNode(attachedCell.getElement())
16256
+ this.ownsPositionVars ? (
16257
+ // null on the first render pass, before the cells are in the DOM:
16258
+ // the cells fall back to a scroll position of 0 - see setTransform
16259
+ attachedCell.getElement()?.parentElement ?? null
16260
+ ) : this.getInfiniteNode(attachedCell.getElement())
16097
16261
  );
16098
16262
  }
16099
- const fixedEndColsOffsets = this.brain.getFixedEndColsOffsets({
16100
- skipScroll: true
16101
- });
16102
- const fixedEndRowsOffsets = this.brain.getFixedEndRowsOffsets({
16103
- skipScroll: true
16104
- });
16263
+ const fixedEndOffsets = {
16264
+ cols: this.brain.getFixedEndColsOffsets({ skipScroll: true }),
16265
+ rows: this.brain.getFixedEndRowsOffsets({ skipScroll: true })
16266
+ };
16105
16267
  const { start, end } = this.brain.getRenderRange();
16106
16268
  const [startRow, startCol] = start;
16107
16269
  const [endRow, endCol] = end;
16108
- function adjustElementPosition(rowIndex, colIndex, fn) {
16109
- const cell = cellManager.getCellAt([rowIndex, colIndex]);
16110
- if (cell == null) {
16270
+ const adjust = (rowIndex, colIndex) => {
16271
+ const node = cellManager.getCellAt([rowIndex, colIndex])?.getElement();
16272
+ const itemPosition = node ? brain.getCellOffset(rowIndex, colIndex) : null;
16273
+ if (!node || !itemPosition) {
16111
16274
  return;
16112
16275
  }
16113
- const itemPosition = brain.getCellOffset(rowIndex, colIndex);
16114
- const node = cell.getElement();
16115
- if (node && itemPosition) {
16116
- fn(rowIndex, colIndex, node, itemPosition);
16117
- }
16118
- }
16119
- const adjustColStart = (_rowIndex, colIndex, node, { x, y }) => {
16120
- this.setTransform(
16121
- node,
16122
- _rowIndex,
16123
- colIndex,
16124
- { x, y, scrollLeft: true },
16125
- fixedColsStart - colIndex
16126
- );
16127
- };
16128
- const adjustRowStart = (rowIndex, _colIndex, node, coords) => {
16129
- this.setTransform(
16130
- node,
16131
- rowIndex,
16132
- _colIndex,
16133
- { x: coords.x, y: coords.y, scrollTop: true },
16134
- fixedRowsStart - rowIndex
16135
- );
16136
- };
16137
- const adjustColEnd = (_rowIndex, colIndex, node, { y }) => {
16138
- const val = fixedEndColsOffsets[colIndex];
16139
- this.setTransform(
16140
- node,
16141
- _rowIndex,
16142
- colIndex,
16143
- { x: val, y, scrollLeft: true },
16144
- cols - colIndex
16145
- );
16146
- };
16147
- const adjustRowEnd = (rowIndex, _colIndex, node, coords) => {
16148
- this.setTransform(
16149
- node,
16150
- rowIndex,
16151
- _colIndex,
16152
- { x: coords.x, y: fixedEndRowsOffsets[rowIndex], scrollTop: true },
16153
- rows - rowIndex
16154
- );
16155
- };
16156
- const adjustColStartRowStart = (_rowIndex, _colIndex, node, { x, y }) => {
16157
- this.setTransform(
16158
- node,
16159
- _rowIndex,
16160
- _colIndex,
16161
- { x, scrollLeft: true, y, scrollTop: true },
16162
- 1e5
16163
- );
16164
- };
16165
- const adjustColStartRowEnd = (_rowIndex, _colIndex, node, { x }) => {
16166
- this.setTransform(
16167
- node,
16168
- _rowIndex,
16169
- _colIndex,
16170
- {
16171
- x,
16172
- scrollLeft: true,
16173
- y: fixedEndRowsOffsets[_rowIndex],
16174
- scrollTop: true
16175
- },
16176
- 2e5
16177
- );
16178
- };
16179
- const adjustColEndRowStart = (_rowIndex, colIndex, node, coords) => {
16180
- this.setTransform(
16181
- node,
16182
- _rowIndex,
16183
- colIndex,
16184
- {
16185
- x: fixedEndColsOffsets[colIndex],
16186
- y: coords.y,
16187
- scrollLeft: true,
16188
- scrollTop: true
16189
- },
16190
- 3e5
16191
- );
16192
- };
16193
- const adjustColEndRowEnd = (rowIndex, colIndex, node) => {
16194
- this.setTransform(
16195
- node,
16276
+ const placement = this.getFixedCellPlacement(
16196
16277
  rowIndex,
16197
16278
  colIndex,
16198
- {
16199
- x: fixedEndColsOffsets[colIndex],
16200
- y: fixedEndRowsOffsets[rowIndex],
16201
- scrollLeft: true,
16202
- scrollTop: true
16203
- },
16204
- 4e5
16279
+ itemPosition,
16280
+ fixedEndOffsets
16205
16281
  );
16282
+ if (placement) {
16283
+ this.setTransform(
16284
+ node,
16285
+ rowIndex,
16286
+ colIndex,
16287
+ placement,
16288
+ placement.zIndex
16289
+ );
16290
+ }
16206
16291
  };
16207
16292
  if (fixedColsStart || fixedColsEnd) {
16208
16293
  for (let rowIndex = startRow; rowIndex < endRow; rowIndex++) {
16209
16294
  for (let colIndex = 0; colIndex < fixedColsStart; colIndex++) {
16210
- adjustElementPosition(rowIndex, colIndex, adjustColStart);
16295
+ adjust(rowIndex, colIndex);
16211
16296
  }
16212
16297
  if (fixedColsEnd) {
16213
16298
  const firstColFixedEnd = cols - fixedColsEnd;
16214
16299
  for (let colIndex = firstColFixedEnd; colIndex < cols; colIndex++) {
16215
- adjustElementPosition(rowIndex, colIndex, adjustColEnd);
16300
+ adjust(rowIndex, colIndex);
16216
16301
  }
16217
16302
  }
16218
16303
  }
@@ -16220,12 +16305,12 @@ var GridRenderer = class extends Logger {
16220
16305
  if (fixedRowsStart || fixedRowsEnd) {
16221
16306
  for (let colIndex = startCol; colIndex < endCol; colIndex++) {
16222
16307
  for (let rowIndex = 0; rowIndex < fixedRowsStart; rowIndex++) {
16223
- adjustElementPosition(rowIndex, colIndex, adjustRowStart);
16308
+ adjust(rowIndex, colIndex);
16224
16309
  }
16225
16310
  if (fixedRowsEnd) {
16226
16311
  const firstRowFixedEnd = rows - fixedRowsEnd;
16227
16312
  for (let rowIndex = firstRowFixedEnd; rowIndex < rows; rowIndex++) {
16228
- adjustElementPosition(rowIndex, colIndex, adjustRowEnd);
16313
+ adjust(rowIndex, colIndex);
16229
16314
  }
16230
16315
  }
16231
16316
  }
@@ -16233,7 +16318,7 @@ var GridRenderer = class extends Logger {
16233
16318
  if (fixedColsStart && fixedRowsStart) {
16234
16319
  for (let rowIndex = 0; rowIndex < fixedRowsStart; rowIndex++) {
16235
16320
  for (let colIndex = 0; colIndex < fixedColsStart; colIndex++) {
16236
- adjustElementPosition(rowIndex, colIndex, adjustColStartRowStart);
16321
+ adjust(rowIndex, colIndex);
16237
16322
  }
16238
16323
  }
16239
16324
  }
@@ -16241,7 +16326,7 @@ var GridRenderer = class extends Logger {
16241
16326
  const firstRowFixedEnd = rows - fixedRowsEnd;
16242
16327
  for (let rowIndex = firstRowFixedEnd; rowIndex < rows; rowIndex++) {
16243
16328
  for (let colIndex = 0; colIndex < fixedColsStart; colIndex++) {
16244
- adjustElementPosition(rowIndex, colIndex, adjustColStartRowEnd);
16329
+ adjust(rowIndex, colIndex);
16245
16330
  }
16246
16331
  }
16247
16332
  }
@@ -16249,7 +16334,7 @@ var GridRenderer = class extends Logger {
16249
16334
  const firstColFixedEnd = cols - fixedColsEnd;
16250
16335
  for (let rowIndex = 0; rowIndex < fixedRowsStart; rowIndex++) {
16251
16336
  for (let colIndex = firstColFixedEnd; colIndex < cols; colIndex++) {
16252
- adjustElementPosition(rowIndex, colIndex, adjustColEndRowStart);
16337
+ adjust(rowIndex, colIndex);
16253
16338
  }
16254
16339
  }
16255
16340
  }
@@ -16258,7 +16343,7 @@ var GridRenderer = class extends Logger {
16258
16343
  const firstColFixedEnd = cols - fixedColsEnd;
16259
16344
  for (let rowIndex = firstRowFixedEnd; rowIndex < rows; rowIndex++) {
16260
16345
  for (let colIndex = firstColFixedEnd; colIndex < cols; colIndex++) {
16261
- adjustElementPosition(rowIndex, colIndex, adjustColEndRowEnd);
16346
+ adjust(rowIndex, colIndex);
16262
16347
  }
16263
16348
  }
16264
16349
  }
@@ -16332,6 +16417,9 @@ var GridRenderer = class extends Logger {
16332
16417
  return this.infiniteNode;
16333
16418
  }
16334
16419
  onCellAttached(cell) {
16420
+ if (this.cellsDetachedInRenderPass?.delete(cell)) {
16421
+ return;
16422
+ }
16335
16423
  if (this.cellDetachedClassNames.length) {
16336
16424
  const el = cell.getElement();
16337
16425
  if (el) {
@@ -16342,6 +16430,13 @@ var GridRenderer = class extends Logger {
16342
16430
  }
16343
16431
  }
16344
16432
  onCellDetached(cell) {
16433
+ if (this.cellsDetachedInRenderPass) {
16434
+ this.cellsDetachedInRenderPass.add(cell);
16435
+ return;
16436
+ }
16437
+ this.addDetachedClassNames(cell);
16438
+ }
16439
+ addDetachedClassNames(cell) {
16345
16440
  if (this.cellDetachedClassNames.length) {
16346
16441
  const el = cell.getElement();
16347
16442
  if (el) {
@@ -16378,10 +16473,22 @@ var GridRenderer = class extends Logger {
16378
16473
  mapped: rendered
16379
16474
  };
16380
16475
  }
16381
- renderRange(range, { renderCell, renderDetailRow, force, onRender }) {
16476
+ renderRange(range, options) {
16382
16477
  if (this.destroyed) {
16383
16478
  return [];
16384
16479
  }
16480
+ if (this.cellsDetachedInRenderPass) {
16481
+ return this.renderRangeInternal(range, options);
16482
+ }
16483
+ const detachedCells = this.cellsDetachedInRenderPass = /* @__PURE__ */ new Set();
16484
+ try {
16485
+ return this.renderRangeInternal(range, options);
16486
+ } finally {
16487
+ this.cellsDetachedInRenderPass = null;
16488
+ detachedCells.forEach((cell) => this.addDetachedClassNames(cell));
16489
+ }
16490
+ }
16491
+ renderRangeInternal(range, { renderCell, renderDetailRow, force, onRender }) {
16385
16492
  const { start, end } = range;
16386
16493
  const horizontalLayout = this.brain.isHorizontalLayoutBrain;
16387
16494
  if (false) {
@@ -16656,6 +16763,34 @@ var GridRenderer = class extends Logger {
16656
16763
  this.updateElementPosition(cell, { hidden, rowspan, colspan });
16657
16764
  return;
16658
16765
  }
16766
+ /**
16767
+ * Where a fixed (pinned) cell goes: its x and/or y relative to the viewport
16768
+ * (`scrollLeft` / `scrollTop: true` - see setTransform), and its z-index:
16769
+ * the corners above the pinned rows and columns, those above the cells
16770
+ * scrolling under them. null for a cell that is not fixed.
16771
+ */
16772
+ getFixedCellPlacement(rowIndex, colIndex, { x, y }, fixedEndOffsets) {
16773
+ const { fixedRowsStart, fixedRowsEnd, fixedColsStart, fixedColsEnd } = this.brain.getFixedCellInfo();
16774
+ const cols = this.brain.getColCount();
16775
+ const rows = this.brain.getRowCount();
16776
+ const colStart = colIndex < fixedColsStart;
16777
+ const colEnd = !colStart && !!fixedColsEnd && colIndex >= cols - fixedColsEnd;
16778
+ const rowStart = rowIndex < fixedRowsStart;
16779
+ const rowEnd = !rowStart && !!fixedRowsEnd && rowIndex >= rows - fixedRowsEnd;
16780
+ const colFixed = colStart || colEnd;
16781
+ const rowFixed = rowStart || rowEnd;
16782
+ if (!colFixed && !rowFixed) {
16783
+ return null;
16784
+ }
16785
+ if (colEnd) {
16786
+ x = (fixedEndOffsets?.cols ?? this.brain.getFixedEndColsOffsets({ skipScroll: true }))[colIndex];
16787
+ }
16788
+ if (rowEnd) {
16789
+ y = (fixedEndOffsets?.rows ?? this.brain.getFixedEndRowsOffsets({ skipScroll: true }))[rowIndex];
16790
+ }
16791
+ const zIndex2 = colFixed && rowFixed ? colStart ? rowStart ? 1e5 : 2e5 : rowStart ? 3e5 : 4e5 : colStart ? fixedColsStart - colIndex : colEnd ? cols - colIndex : rowStart ? fixedRowsStart - rowIndex : rows - rowIndex;
16792
+ return { x, y, scrollLeft: colFixed, scrollTop: rowFixed, zIndex: zIndex2 };
16793
+ }
16659
16794
  reset() {
16660
16795
  this.cellManager.reset();
16661
16796
  this.rowManager.reset();
@@ -17247,13 +17382,18 @@ function createRenderer(brain) {
17247
17382
  }
17248
17383
 
17249
17384
  // src/components/HeadlessTable/RawTable.tsx
17385
+ function createOwnRenderer(brain) {
17386
+ const result = createRenderer(brain);
17387
+ result.renderer.ownsPositionVars = true;
17388
+ return result;
17389
+ }
17250
17390
  function RawTableFn(props) {
17251
17391
  const { brain, renderCell, renderDetailRow, forceRerenderTimestamp } = props;
17252
17392
  const { renderer, onRenderUpdater } = (0, import_react29.useMemo)(() => {
17253
17393
  return props.onRenderUpdater && props.renderer ? {
17254
17394
  renderer: props.renderer,
17255
17395
  onRenderUpdater: props.onRenderUpdater
17256
- } : createRenderer(brain);
17396
+ } : createOwnRenderer(brain);
17257
17397
  }, [brain, props.onRenderUpdater, props.renderer]);
17258
17398
  (0, import_react29.useLayoutEffect)(() => {
17259
17399
  renderer.cellHoverClassNames = props.cellHoverClassNames || [];
@@ -18238,11 +18378,12 @@ function InfiniteTableInternalHeaderFn(props) {
18238
18378
  dataSourceStatePartialForHeaderCell
18239
18379
  ]
18240
18380
  );
18381
+ const headerDragListId = useDragListId(HEADER_DRAG_LIST_NAME);
18241
18382
  return /* @__PURE__ */ React46.createElement(
18242
18383
  DragList,
18243
18384
  {
18244
18385
  orientation: "horizontal",
18245
- dragListId: "header",
18386
+ dragListId: headerDragListId,
18246
18387
  dragStrategy: "inline",
18247
18388
  onDrop: emptyFn3,
18248
18389
  updatePosition: emptyFn3
@@ -18512,7 +18653,7 @@ function InfiniteTableHeaderCellFn(props) {
18512
18653
  filterDelay
18513
18654
  } = props;
18514
18655
  const { allRowsSelected, someRowsSelected, selectionMode } = dataSourceStatePartialForHeaderCell;
18515
- const { onDragItemPointerDown } = useDragListContext();
18656
+ const { onDragItemPointerDown, dragListId } = useDragListContext();
18516
18657
  const {
18517
18658
  api,
18518
18659
  getComputed,
@@ -18811,7 +18952,7 @@ function InfiniteTableHeaderCellFn(props) {
18811
18952
  "data-field": `${column.field || ""}`,
18812
18953
  "data-column-id": column.id,
18813
18954
  [DRAG_ITEM_ATTRIBUTE]: column.id,
18814
- [DRAG_ITEM_LIST_ATTRIBUTE]: "header",
18955
+ [DRAG_ITEM_LIST_ATTRIBUTE]: dragListId,
18815
18956
  "data-header-align": align2,
18816
18957
  "data-name": "HeaderCell",
18817
18958
  "data-sort": column.computedSortedAsc ? "asc" : column.computedSortedDesc ? "desc" : "none",
@@ -18942,25 +19083,40 @@ function decamelize(str, options) {
18942
19083
  ).toLowerCase();
18943
19084
  }
18944
19085
 
18945
- // src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
18946
- var defaultStyle = {
19086
+ // src/components/InfiniteTable/components/InfiniteTableLicenseFooter/licenseFooterShared.ts
19087
+ var LICENSE_FOOTER_LINK = "https://infinite-table.com";
19088
+ var LICENSE_FOOTER_INVALID_MESSAGE = "Invalid Infinite Table license. See console for details.";
19089
+ var baseFooterStyle = {
18947
19090
  padding: ThemeVars.spacing[2],
18948
19091
  textAlign: "end",
18949
19092
  opacity: "1",
18950
19093
  visibility: "visible",
18951
19094
  display: "block",
18952
- fontSize: "0.85rem",
19095
+ fontSize: "0.85rem"
19096
+ };
19097
+ var missingFooterStyle = {
19098
+ ...baseFooterStyle,
18953
19099
  background: "white",
18954
19100
  color: "black"
18955
19101
  };
18956
- var anchorStyle = {
18957
- opacity: 1,
19102
+ var invalidFooterStyle = {
19103
+ ...baseFooterStyle,
19104
+ // pale red, with dark red text
19105
+ background: "#fee2e2",
19106
+ color: "#991b1b"
19107
+ };
19108
+ var baseAnchorStyle = {
19109
+ opacity: "1",
18958
19110
  visibility: "visible",
18959
19111
  display: "inline-block",
18960
19112
  pointerEvents: "all",
18961
- color: "black",
18962
19113
  textDecoration: "underline"
18963
19114
  };
19115
+ var missingAnchorStyle = { ...baseAnchorStyle, color: "black" };
19116
+ var invalidAnchorStyle = { ...baseAnchorStyle, color: "#991b1b" };
19117
+ function getLicenseFooterStyles(invalid) {
19118
+ return invalid ? { footer: invalidFooterStyle, anchor: invalidAnchorStyle } : { footer: missingFooterStyle, anchor: missingAnchorStyle };
19119
+ }
18964
19120
  var enforceStyle = (node, style2) => {
18965
19121
  if (!node) {
18966
19122
  return;
@@ -18973,8 +19129,26 @@ var enforceStyle = (node, style2) => {
18973
19129
  );
18974
19130
  }
18975
19131
  };
19132
+ function enforceLicenseFooterStyle(getNode, invalid) {
19133
+ const styles = getLicenseFooterStyles(invalid);
19134
+ const forceStyle = () => {
19135
+ setTimeout(() => {
19136
+ const node = getNode();
19137
+ enforceStyle(node, styles.footer);
19138
+ enforceStyle(node?.querySelector("a") ?? null, styles.anchor);
19139
+ });
19140
+ };
19141
+ forceStyle();
19142
+ const intervalId = setInterval(forceStyle, 1e3);
19143
+ return () => {
19144
+ clearInterval(intervalId);
19145
+ };
19146
+ }
19147
+
19148
+ // src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
18976
19149
  var InfiniteTableLicenseFooter = React50.forwardRef(
18977
19150
  function InfiniteTableLicenseFooter2(props, ref) {
19151
+ const { invalid = false, ...domProps } = props;
18978
19152
  const { rootClassName: rootClassName12 } = useInternalProps();
18979
19153
  const domRef = React50.useRef(null);
18980
19154
  const domCallback = React50.useCallback((node) => {
@@ -18989,42 +19163,33 @@ var InfiniteTableLicenseFooter = React50.forwardRef(
18989
19163
  }
18990
19164
  }, []);
18991
19165
  (0, import_react38.useEffect)(() => {
18992
- const forceStyle = () => {
18993
- setTimeout(() => {
18994
- enforceStyle(domRef.current, defaultStyle);
18995
- enforceStyle(
18996
- domRef.current?.firstElementChild,
18997
- anchorStyle
18998
- );
18999
- });
19000
- };
19001
- forceStyle();
19002
- const intervalId = setInterval(forceStyle, 1e3);
19003
- return () => {
19004
- clearInterval(intervalId);
19005
- };
19006
- }, []);
19166
+ return enforceLicenseFooterStyle(() => domRef.current, invalid);
19167
+ }, [invalid]);
19168
+ const styles = getLicenseFooterStyles(invalid);
19007
19169
  return /* @__PURE__ */ React50.createElement(
19008
19170
  "div",
19009
19171
  {
19010
19172
  ref: domCallback,
19011
- ...props,
19173
+ ...domProps,
19012
19174
  className: join(
19013
19175
  `${rootClassName12}-Footer`,
19176
+ invalid ? `${rootClassName12}-Footer--invalid` : null,
19014
19177
  FooterCls,
19015
- props.className
19178
+ domProps.className
19016
19179
  ),
19017
- style: defaultStyle
19180
+ style: styles.footer
19018
19181
  },
19182
+ invalid ? `${LICENSE_FOOTER_INVALID_MESSAGE} ` : null,
19019
19183
  "Powered by",
19020
19184
  " ",
19021
19185
  /* @__PURE__ */ React50.createElement(
19022
19186
  "a",
19023
19187
  {
19024
- href: "https://infinite-table.com",
19188
+ href: LICENSE_FOOTER_LINK,
19025
19189
  rel: "noopener noreferrer",
19026
19190
  role: "link",
19027
- target: "_blank"
19191
+ target: "_blank",
19192
+ style: styles.anchor
19028
19193
  },
19029
19194
  "Infinite Table"
19030
19195
  )
@@ -22354,6 +22519,80 @@ function treeTraverse(treeParams, traverseOptions, data) {
22354
22519
  }
22355
22520
  }
22356
22521
 
22522
+ // src/utils/multisort/sortByNumber.ts
22523
+ var SORT_BY_NUMBER_MIN_LENGTH = 1e3;
22524
+ var IS_LITTLE_ENDIAN = new Uint8Array(new Uint32Array([1]).buffer)[0] === 1;
22525
+ function sortByNumber(array, getValue, dir) {
22526
+ const len = array.length;
22527
+ const keys = new Float64Array(len);
22528
+ for (let i = 0; i < len; i++) {
22529
+ const value = getValue(array[i]);
22530
+ if (typeof value !== "number" || value !== value) {
22531
+ return false;
22532
+ }
22533
+ keys[i] = (dir < 0 ? -value : value) + 0;
22534
+ }
22535
+ if (len < 2) {
22536
+ return true;
22537
+ }
22538
+ const words = new Uint32Array(keys.buffer);
22539
+ const LOW = IS_LITTLE_ENDIAN ? 0 : 1;
22540
+ const HIGH = IS_LITTLE_ENDIAN ? 1 : 0;
22541
+ const counts = new Uint32Array(8 * 256);
22542
+ for (let i = 0; i < len; i++) {
22543
+ let low = words[2 * i + LOW];
22544
+ let high = words[2 * i + HIGH];
22545
+ if (high & 2147483648) {
22546
+ high = ~high >>> 0;
22547
+ low = ~low >>> 0;
22548
+ words[2 * i + LOW] = low;
22549
+ } else {
22550
+ high = (high | 2147483648) >>> 0;
22551
+ }
22552
+ words[2 * i + HIGH] = high;
22553
+ counts[low & 255]++;
22554
+ counts[256 + (low >>> 8 & 255)]++;
22555
+ counts[512 + (low >>> 16 & 255)]++;
22556
+ counts[768 + (low >>> 24)]++;
22557
+ counts[1024 + (high & 255)]++;
22558
+ counts[1280 + (high >>> 8 & 255)]++;
22559
+ counts[1536 + (high >>> 16 & 255)]++;
22560
+ counts[1792 + (high >>> 24)]++;
22561
+ }
22562
+ let indexes = new Uint32Array(len);
22563
+ let nextIndexes = new Uint32Array(len);
22564
+ for (let i = 0; i < len; i++) {
22565
+ indexes[i] = i;
22566
+ }
22567
+ for (let digitIndex = 0; digitIndex < 8; digitIndex++) {
22568
+ const word = digitIndex < 4 ? LOW : HIGH;
22569
+ const shift = digitIndex % 4 * 8;
22570
+ const countsOffset = digitIndex * 256;
22571
+ if (counts[countsOffset + (words[word] >>> shift & 255)] === len) {
22572
+ continue;
22573
+ }
22574
+ let position2 = 0;
22575
+ for (let digit = 0; digit < 256; digit++) {
22576
+ const count = counts[countsOffset + digit];
22577
+ counts[countsOffset + digit] = position2;
22578
+ position2 += count;
22579
+ }
22580
+ for (let i = 0; i < len; i++) {
22581
+ const index = indexes[i];
22582
+ const digit = words[2 * index + word] >>> shift & 255;
22583
+ nextIndexes[counts[countsOffset + digit]++] = index;
22584
+ }
22585
+ const previousIndexes = indexes;
22586
+ indexes = nextIndexes;
22587
+ nextIndexes = previousIndexes;
22588
+ }
22589
+ const items = array.slice();
22590
+ for (let i = 0; i < len; i++) {
22591
+ array[i] = items[indexes[i]];
22592
+ }
22593
+ return true;
22594
+ }
22595
+
22357
22596
  // src/utils/multisort/sortTypes.ts
22358
22597
  var numberComparator = function(first, second) {
22359
22598
  return first - second;
@@ -22439,7 +22678,10 @@ var multisort = (sortInfo, array, options) => {
22439
22678
  if (marker) {
22440
22679
  marker.start();
22441
22680
  }
22442
- array.sort(getMultisortFunction(toPlainSortInfo(sortInfo), get));
22681
+ const plainSortInfo = toPlainSortInfo(sortInfo);
22682
+ if (!sortByNumberIfPossible(plainSortInfo, array, get)) {
22683
+ array.sort(getMultisortFunction(plainSortInfo, get));
22684
+ }
22443
22685
  if (marker) {
22444
22686
  marker.end();
22445
22687
  }
@@ -22505,6 +22747,30 @@ var multisortNested = (sortInfo, array, options) => {
22505
22747
  return array;
22506
22748
  };
22507
22749
  multisort.knownTypes = sortTypes_default;
22750
+ function sortByNumberIfPossible(sortInfo, array, get) {
22751
+ if (sortInfo.length !== 1 || array.length < SORT_BY_NUMBER_MIN_LENGTH) {
22752
+ return false;
22753
+ }
22754
+ const info = sortInfo[0];
22755
+ if (!info || info.fn || !info.type || info.dir !== 1 && info.dir !== -1) {
22756
+ return false;
22757
+ }
22758
+ const type = Array.isArray(info.type) ? info.type[0] : info.type;
22759
+ if (multisort.knownTypes[type] !== numberComparator) {
22760
+ return false;
22761
+ }
22762
+ const { field, valueGetter } = info;
22763
+ return sortByNumber(
22764
+ array,
22765
+ (item) => {
22766
+ if (get) {
22767
+ item = get(item);
22768
+ }
22769
+ return valueGetter ? valueGetter(item) : field ? item[field] : item;
22770
+ },
22771
+ info.dir
22772
+ );
22773
+ }
22508
22774
  var getSingleSortFunction = (info) => {
22509
22775
  if (!info) {
22510
22776
  return;
@@ -25989,6 +26255,7 @@ function concludeReducer(params) {
25989
26255
  } else {
25990
26256
  state.groupDeepMap = void 0;
25991
26257
  state.pivotColumns = void 0;
26258
+ state.pivotColumnGroups = void 0;
25992
26259
  state.groupRowsIndexesInDataArray = void 0;
25993
26260
  const arrayDifferentAfterSortStep = previousState.postSortDataArray != state.postSortDataArray;
25994
26261
  if (arrayDifferentAfterSortStep || groupsDepsChanged || selectionDepsChanged || rowDisabledStateDepsChanged || rowInfoReducersChanged) {
@@ -27645,7 +27912,9 @@ var forwardProps4 = (_setupState) => {
27645
27912
  pivotGrandTotalColumnPosition: 1,
27646
27913
  // groupRenderStrategy: (groupRenderStrategy) =>
27647
27914
  // groupRenderStrategy ?? 'multi-column',
27648
- licenseKey: (licenseKey) => licenseKey || "",
27915
+ // keep undefined - it means "use InfiniteTable.licenseKey", while an
27916
+ // empty string means "no license key"
27917
+ licenseKey: (licenseKey) => licenseKey,
27649
27918
  keyboardSelection: (keyboardSelection) => keyboardSelection ?? true,
27650
27919
  multiRowSelectionWith: (multiRowSelectionWith) => multiRowSelectionWith ?? "checkbox",
27651
27920
  activeRowIndex: 1,
@@ -27748,8 +28017,10 @@ function getMappedCallbacks2() {
27748
28017
  var mapPropsToState = (params) => {
27749
28018
  const { props, state, oldState, parentState } = params;
27750
28019
  const computedColumnGroups = state.pivotColumnGroups || state.columnGroups;
27751
- const columnGroupsDepthsMap = state.columnGroups && state.columnGroups != oldState?.columnGroups || state.columnGroups && state.columnGroupVisibility != oldState?.columnGroupVisibility || state.pivotColumnGroups && state.pivotColumnGroups != oldState?.pivotColumnGroups ? computeColumnGroupsDepths(
27752
- computedColumnGroups,
28020
+ 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
28021
+ // to the depth of `columnGroups` (or to a single row, when there are none)
28022
+ state.pivotColumnGroups != oldState?.pivotColumnGroups ? computeColumnGroupsDepths(
28023
+ computedColumnGroups ?? EMPTY_OBJECT,
27753
28024
  state.columnGroupVisibility
27754
28025
  ) : state.columnGroupsDepthsMap;
27755
28026
  const groupBy = parentState?.groupBy;
@@ -29253,7 +29524,7 @@ var logLicenseError = (lines, fn = console.error.bind(console)) => {
29253
29524
  });
29254
29525
  fn("*".repeat(max));
29255
29526
  };
29256
- var isValidLicense = (licenseKey = "", packageInfo, fn) => {
29527
+ var checkLicense = (licenseKey = "", packageInfo, fn) => {
29257
29528
  let details;
29258
29529
  try {
29259
29530
  details = decode(licenseKey);
@@ -29266,7 +29537,7 @@ var isValidLicense = (licenseKey = "", packageInfo, fn) => {
29266
29537
  ],
29267
29538
  fn
29268
29539
  );
29269
- return false;
29540
+ return "invalid";
29270
29541
  }
29271
29542
  const currentVersionReleaseDate = new Date(packageInfo.publishedAt);
29272
29543
  const licenseEndDate = new Date(details.end);
@@ -29282,14 +29553,16 @@ Your Infinite Table license has expired on ${licenseEndDate.toDateString()}.
29282
29553
  ],
29283
29554
  fn
29284
29555
  );
29285
- return false;
29556
+ return "expired";
29286
29557
  }
29287
- return true;
29558
+ return "valid";
29288
29559
  };
29289
29560
  var decode = (licenseKey) => {
29290
29561
  let crc = "";
29291
29562
  let fields = licenseKey.split("|").map((part) => {
29292
- let [name, value] = part.split("=");
29563
+ const separatorIndex = part.indexOf("=");
29564
+ const name = separatorIndex === -1 ? part : part.slice(0, separatorIndex);
29565
+ const value = separatorIndex === -1 ? "" : part.slice(separatorIndex + 1);
29293
29566
  if (name === "C") {
29294
29567
  crc = value;
29295
29568
  }
@@ -29326,40 +29599,29 @@ var decode = (licenseKey) => {
29326
29599
  return fieldsToLicenseDetails(fields);
29327
29600
  };
29328
29601
 
29602
+ // src/components/InfiniteTable/hooks/useLicense/getLicenseStatus.ts
29603
+ function getLicenseStatus(licenseKey = "", options) {
29604
+ if (options.isDetail) {
29605
+ return "valid";
29606
+ }
29607
+ const result = checkLicense(licenseKey, {
29608
+ publishedAt: 1795523603652,
29609
+ version: "10.2.1"
29610
+ });
29611
+ if (result === "invalid" && !licenseKey) {
29612
+ return "missing";
29613
+ }
29614
+ return result;
29615
+ }
29616
+
29329
29617
  // src/components/InfiniteTable/hooks/useLicense/useLicense.ts
29330
- var SANDPACK_REGEX = /(https):\/\/\d+\-\d+\-\d+\-(sandpack\.codesandbox\.io)/g;
29331
- var SANDBOX_REGEX = /(https):\/\/\S+(\.csb\.app)/g;
29332
- var origin = typeof window !== "undefined" ? window.location.origin : "";
29333
- var isInsideSandpack = () => {
29334
- const [_fullUrl, protocol, sandpackUrl] = Array.from(
29335
- SANDPACK_REGEX.exec(origin) || []
29336
- );
29337
- return protocol === "https" && sandpackUrl === "sandpack.codesandbox.io";
29338
- };
29339
- var isInsideSandbox = () => {
29340
- const [_fullUrl, protocol, sandboxUrl] = Array.from(
29341
- SANDBOX_REGEX.exec(origin) || []
29342
- );
29343
- return protocol === "https" && sandboxUrl === ".csb.app";
29344
- };
29345
- var isInsidePlayground = isInsideSandbox() || isInsideSandpack();
29346
29618
  var useLicense = (licenseKey = "") => {
29347
29619
  const masterRowInfo = useMasterRowInfo();
29348
29620
  const isDetail = !!masterRowInfo;
29349
- const valid = (0, import_react51.useMemo)(() => {
29350
- if (isDetail) {
29351
- return true;
29352
- }
29353
- let valid2 = isValidLicense(licenseKey, {
29354
- publishedAt: 1624970570587,
29355
- version: "10.1.5"
29356
- });
29357
- if (!licenseKey && !valid2 && isInsidePlayground) {
29358
- return true;
29359
- }
29360
- return valid2;
29361
- }, [licenseKey, isDetail]);
29362
- return valid;
29621
+ return (0, import_react51.useMemo)(
29622
+ () => getLicenseStatus(licenseKey, { isDetail }),
29623
+ [licenseKey, isDetail]
29624
+ );
29363
29625
  };
29364
29626
 
29365
29627
  // src/components/InfiniteTable/hooks/useScrollToActiveCell.ts
@@ -33297,8 +33559,8 @@ var getFastClickHandler = (callback, prevHandler) => {
33297
33559
  };
33298
33560
  function GroupingToolbarItem(props) {
33299
33561
  const { column, onClear, components: components2, field, id, toggleSorting } = props;
33300
- const { dragSourceListId, dragItemId } = useDragListContext();
33301
- const draggingInProgress = dragSourceListId === GROUPING_TOOLBAR_DRAG_LIST_ID;
33562
+ const { dragSourceListId, dragItemId, dragListId } = useDragListContext();
33563
+ const draggingInProgress = dragSourceListId === dragListId;
33302
33564
  const context = useInfiniteTableStableContext();
33303
33565
  const columnHeader = (column ? getColumnLabel(column.id, context, "grouping-toolbar") : field) ?? id;
33304
33566
  const sortIcon = column ? /* @__PURE__ */ React73.createElement(
@@ -33310,7 +33572,7 @@ function GroupingToolbarItem(props) {
33310
33572
  }
33311
33573
  ) : null;
33312
33574
  const header = /* @__PURE__ */ React73.createElement(React73.Fragment, null, columnHeader, sortIcon);
33313
- const active = dragItemId === id && dragSourceListId === GROUPING_TOOLBAR_DRAG_LIST_ID;
33575
+ const active = dragItemId === id && dragSourceListId === dragListId;
33314
33576
  const className = join(
33315
33577
  GroupingToolbarItemRecipe({
33316
33578
  draggingInProgress,
@@ -33340,7 +33602,6 @@ function GroupingToolbarItem(props) {
33340
33602
  }
33341
33603
  );
33342
33604
  }
33343
- var GROUPING_TOOLBAR_DRAG_LIST_ID = "grouping-toolbar";
33344
33605
  function GroupingToolbar(props) {
33345
33606
  const { groupBy } = useDataSourceSelector((ctx) => {
33346
33607
  return {
@@ -33358,8 +33619,14 @@ function GroupingToolbar(props) {
33358
33619
  );
33359
33620
  const { dropTargetListId, dragSourceListId } = useDragDropProvider();
33360
33621
  const { fieldsToColumn, computedColumnsMap } = getComputed();
33361
- const active = dropTargetListId === GROUPING_TOOLBAR_DRAG_LIST_ID;
33362
- const draggingInProgress = dragSourceListId === GROUPING_TOOLBAR_DRAG_LIST_ID;
33622
+ const dragListId = useDragListId(GROUPING_TOOLBAR_DRAG_LIST_NAME);
33623
+ const headerDragListId = useDragListId(HEADER_DRAG_LIST_NAME);
33624
+ const acceptDropsFrom = (0, import_react69.useMemo)(
33625
+ () => [headerDragListId, dragListId],
33626
+ [headerDragListId, dragListId]
33627
+ );
33628
+ const active = dropTargetListId === dragListId;
33629
+ const draggingInProgress = dragSourceListId === dragListId;
33363
33630
  const PlaceholderComponent = props.components?.Placeholder ?? PlaceholderDefault;
33364
33631
  const HostComponent = props.components?.Host ?? HostDefault;
33365
33632
  const children = !groupBy.length ? /* @__PURE__ */ React73.createElement(
@@ -33432,8 +33699,8 @@ function GroupingToolbar(props) {
33432
33699
  DragList,
33433
33700
  {
33434
33701
  orientation,
33435
- dragListId: GROUPING_TOOLBAR_DRAG_LIST_ID,
33436
- acceptDropsFrom: ["header", GROUPING_TOOLBAR_DRAG_LIST_ID],
33702
+ dragListId,
33703
+ acceptDropsFrom,
33437
33704
  onDrop,
33438
33705
  dragStrategy: "inline",
33439
33706
  onAcceptDrop,
@@ -34374,7 +34641,7 @@ var InfiniteTableComponent = React79.memo(
34374
34641
  activeCellIndex
34375
34642
  } = componentState;
34376
34643
  let { licenseKey } = componentState;
34377
- if (!licenseKey && InfiniteTable.licenseKey) {
34644
+ if (licenseKey === void 0 && InfiniteTable.licenseKey) {
34378
34645
  licenseKey = InfiniteTable.licenseKey;
34379
34646
  }
34380
34647
  useScrollToActiveRow(activeRowIndex, dataArrayLength, api);
@@ -34393,7 +34660,7 @@ var InfiniteTableComponent = React79.memo(
34393
34660
  );
34394
34661
  return brain.onVerticalRenderRangeChange(onChange);
34395
34662
  }, [brain, scrollStopDelay]);
34396
- const licenseValid = useLicense(licenseKey);
34663
+ const licenseStatus = useLicense(licenseKey);
34397
34664
  const {
34398
34665
  // remove autoFocus and tabIndex from the domProps
34399
34666
  // that will be spread on the root DOM element
@@ -34494,7 +34761,7 @@ var InfiniteTableComponent = React79.memo(
34494
34761
  onChange: onColumnHeaderHeightCSSVarChange
34495
34762
  }
34496
34763
  ) : null,
34497
- licenseValid ? null : /* @__PURE__ */ React79.createElement(InfiniteTableLicenseFooter, null),
34764
+ licenseStatus === "valid" ? null : /* @__PURE__ */ React79.createElement(InfiniteTableLicenseFooter, { invalid: licenseStatus === "invalid" }),
34498
34765
  /* @__PURE__ */ React79.createElement(FocusDetect, null)
34499
34766
  );
34500
34767
  }