@infinite-table/infinite-react 8.0.1 → 8.0.3
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.d.ts +127 -1
- package/index.dev.js +568 -68
- package/index.dev.mjs +632 -135
- package/index.js +8 -8
- package/index.mjs +8 -8
- package/package.json +2 -2
package/index.dev.mjs
CHANGED
|
@@ -2055,7 +2055,7 @@ function InfiniteTableFooter(props) {
|
|
|
2055
2055
|
|
|
2056
2056
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
|
|
2057
2057
|
import * as React51 from "react";
|
|
2058
|
-
import { useCallback as
|
|
2058
|
+
import { useCallback as useCallback22, useContext as useContext10, useEffect as useEffect16, useRef as useRef21 } from "react";
|
|
2059
2059
|
import { createPortal } from "react-dom";
|
|
2060
2060
|
|
|
2061
2061
|
// src/utils/keyMirror.ts
|
|
@@ -3859,6 +3859,7 @@ function useCellClassName(column, baseClasses, variants, extraFlags) {
|
|
|
3859
3859
|
|
|
3860
3860
|
// src/components/InfiniteTable/hooks/useColumnPointerEvents.ts
|
|
3861
3861
|
import { useCallback as useCallback10, useState as useState6 } from "react";
|
|
3862
|
+
import { flushSync } from "react-dom";
|
|
3862
3863
|
|
|
3863
3864
|
// src/utils/selectParent.ts
|
|
3864
3865
|
function selectParent(el, selector2) {
|
|
@@ -5367,7 +5368,7 @@ var handleOutsideOperation = (operation, interactionTarget) => {
|
|
|
5367
5368
|
if (inside) {
|
|
5368
5369
|
return { left: 0, top: 0 };
|
|
5369
5370
|
}
|
|
5370
|
-
if (index > dragIndex) {
|
|
5371
|
+
if (index > dragIndex && !interactionTarget.getData().preserveDragSpace) {
|
|
5371
5372
|
return orientation === "horizontal" ? { left: -dragItem.rect.width, top: 0 } : { left: 0, top: -dragItem.rect.height };
|
|
5372
5373
|
}
|
|
5373
5374
|
return { left: 0, top: 0 };
|
|
@@ -5396,12 +5397,24 @@ var _DragManager = class _DragManager {
|
|
|
5396
5397
|
activeDragSource,
|
|
5397
5398
|
startPoint
|
|
5398
5399
|
});
|
|
5400
|
+
_DragManager.currentDragOperation = dragOperation;
|
|
5399
5401
|
dragOperation.on("start", _DragManager.onDragStart);
|
|
5400
5402
|
dragOperation.on("move", _DragManager.onDragMove);
|
|
5401
5403
|
dragOperation.on("drop", _DragManager.onDragDrop);
|
|
5402
5404
|
dragOperation.start();
|
|
5403
5405
|
return dragOperation;
|
|
5404
5406
|
}
|
|
5407
|
+
/**
|
|
5408
|
+
* Re-evaluates the current drag position against all interaction targets.
|
|
5409
|
+
* Used when a target list scrolls and its breakpoints change, requiring
|
|
5410
|
+
* the drop index to be recalculated without a new pointer move.
|
|
5411
|
+
*/
|
|
5412
|
+
static retriggerMove() {
|
|
5413
|
+
const op = _DragManager.currentDragOperation;
|
|
5414
|
+
if (op && op.phase === "move") {
|
|
5415
|
+
_DragManager.onDragMove(op);
|
|
5416
|
+
}
|
|
5417
|
+
}
|
|
5405
5418
|
static emit(event, ...params) {
|
|
5406
5419
|
_DragManager.emitter.emit(event, ...params);
|
|
5407
5420
|
}
|
|
@@ -5552,11 +5565,13 @@ var _DragManager = class _DragManager {
|
|
|
5552
5565
|
dragIndex: event?.dragIndex ?? -1,
|
|
5553
5566
|
dropIndex: event?.dropIndex ?? -1
|
|
5554
5567
|
});
|
|
5568
|
+
_DragManager.currentDragOperation = null;
|
|
5555
5569
|
_DragManager.unregisterAll();
|
|
5556
5570
|
}
|
|
5557
5571
|
};
|
|
5558
5572
|
// public static dragInteractionTargets: DragInteractionTarget[] = [];
|
|
5559
5573
|
_DragManager.dragInteractionTargetsMap = /* @__PURE__ */ new Map();
|
|
5574
|
+
_DragManager.currentDragOperation = null;
|
|
5560
5575
|
_DragManager.emitter = new EventEmitter();
|
|
5561
5576
|
var DragManager = _DragManager;
|
|
5562
5577
|
var ActiveDragSource = class _ActiveDragSource {
|
|
@@ -5875,13 +5890,6 @@ var useColumnPointerEvents = ({
|
|
|
5875
5890
|
}
|
|
5876
5891
|
const currentComputedColumnOrder = getComputed().computedColumnOrder;
|
|
5877
5892
|
if (JSON.stringify(columnOrder, currentComputedColumnOrder)) {
|
|
5878
|
-
computedVisibleColumns.forEach((col) => {
|
|
5879
|
-
setInfiniteColumnOffsetWhileReordering(
|
|
5880
|
-
col.computedVisibleIndex,
|
|
5881
|
-
"",
|
|
5882
|
-
rootRef.current
|
|
5883
|
-
);
|
|
5884
|
-
});
|
|
5885
5893
|
actions.columnOrder = adjustColumnOrderForAllColumns({
|
|
5886
5894
|
newColumnOrder: columnOrder,
|
|
5887
5895
|
visibleColumnOrder: getComputed().computedVisibleColumns.map(
|
|
@@ -5942,27 +5950,48 @@ var useColumnPointerEvents = ({
|
|
|
5942
5950
|
requestAnimationFrame(() => {
|
|
5943
5951
|
const { multiSortBehavior } = getState();
|
|
5944
5952
|
const target2 = domRef.current;
|
|
5945
|
-
rootRef.current
|
|
5953
|
+
const rootNode = rootRef.current;
|
|
5954
|
+
rootNode?.classList.remove(InfiniteClsShiftingColumns);
|
|
5946
5955
|
dragger.stop();
|
|
5947
5956
|
brain.update({
|
|
5948
5957
|
...initialAvailableSize
|
|
5949
5958
|
});
|
|
5950
5959
|
discardAlwaysRenderedColumn?.();
|
|
5951
5960
|
restoreRenderRange?.();
|
|
5961
|
+
target2.style.cursor = initialCursor;
|
|
5962
|
+
target2.releasePointerCapture(pointerId);
|
|
5963
|
+
target2.removeEventListener("pointermove", onPointerMove);
|
|
5964
|
+
target2.removeEventListener("pointerup", onPointerUp);
|
|
5965
|
+
setProxyPosition(null);
|
|
5966
|
+
const dragColumnSortable = api.getColumnApi(dragColumn.id)?.isSortable() ?? false;
|
|
5967
|
+
if (!didDragAtLeastOnce && dragColumnSortable) {
|
|
5968
|
+
api.toggleSortingForColumn(dragColumn.id, {
|
|
5969
|
+
multiSortBehavior: multiSortBehavior === "replace" && (e2.ctrlKey || e2.metaKey) ? "append" : multiSortBehavior
|
|
5970
|
+
});
|
|
5971
|
+
}
|
|
5972
|
+
flushSync(() => {
|
|
5973
|
+
if (reorderDragResult) {
|
|
5974
|
+
persistColumnOrder(reorderDragResult);
|
|
5975
|
+
} else if (didDragAtLeastOnce) {
|
|
5976
|
+
if (allowColumnHideOnDrag) {
|
|
5977
|
+
api.setVisibilityForColumn(dragColumn.id, false);
|
|
5978
|
+
}
|
|
5979
|
+
}
|
|
5980
|
+
actions.columnReorderDragColumnId = false;
|
|
5981
|
+
if (horizontalLayoutPageIndex != null) {
|
|
5982
|
+
actions.columnReorderInPageIndex = null;
|
|
5983
|
+
}
|
|
5984
|
+
});
|
|
5952
5985
|
computedVisibleColumns.forEach((col) => {
|
|
5953
5986
|
clearInfiniteColumnReorderDuration(
|
|
5954
5987
|
col.computedVisibleIndex,
|
|
5955
|
-
|
|
5956
|
-
);
|
|
5957
|
-
setInfiniteColumnVisibility(
|
|
5958
|
-
col.computedVisibleIndex,
|
|
5959
|
-
"",
|
|
5960
|
-
rootRef.current
|
|
5988
|
+
rootNode
|
|
5961
5989
|
);
|
|
5990
|
+
setInfiniteColumnVisibility(col.computedVisibleIndex, "", rootNode);
|
|
5962
5991
|
setInfiniteColumnOffsetWhileReordering(
|
|
5963
5992
|
col.computedVisibleIndex,
|
|
5964
5993
|
"",
|
|
5965
|
-
|
|
5994
|
+
rootNode
|
|
5966
5995
|
);
|
|
5967
5996
|
});
|
|
5968
5997
|
setInfiniteColumnZIndex(
|
|
@@ -5971,30 +6000,8 @@ var useColumnPointerEvents = ({
|
|
|
5971
6000
|
pinnedStartColsCount: computedPinnedStartColumns.length,
|
|
5972
6001
|
visibleColsCount: computedVisibleColumns.length
|
|
5973
6002
|
}),
|
|
5974
|
-
|
|
6003
|
+
rootNode
|
|
5975
6004
|
);
|
|
5976
|
-
target2.style.cursor = initialCursor;
|
|
5977
|
-
target2.releasePointerCapture(pointerId);
|
|
5978
|
-
target2.removeEventListener("pointermove", onPointerMove);
|
|
5979
|
-
target2.removeEventListener("pointerup", onPointerUp);
|
|
5980
|
-
setProxyPosition(null);
|
|
5981
|
-
const dragColumnSortable = api.getColumnApi(dragColumn.id)?.isSortable() ?? false;
|
|
5982
|
-
if (!didDragAtLeastOnce && dragColumnSortable) {
|
|
5983
|
-
api.toggleSortingForColumn(dragColumn.id, {
|
|
5984
|
-
multiSortBehavior: multiSortBehavior === "replace" && (e2.ctrlKey || e2.metaKey) ? "append" : multiSortBehavior
|
|
5985
|
-
});
|
|
5986
|
-
}
|
|
5987
|
-
if (reorderDragResult) {
|
|
5988
|
-
persistColumnOrder(reorderDragResult);
|
|
5989
|
-
} else if (didDragAtLeastOnce) {
|
|
5990
|
-
if (allowColumnHideOnDrag) {
|
|
5991
|
-
api.setVisibilityForColumn(dragColumn.id, false);
|
|
5992
|
-
}
|
|
5993
|
-
}
|
|
5994
|
-
actions.columnReorderDragColumnId = false;
|
|
5995
|
-
if (horizontalLayoutPageIndex != null) {
|
|
5996
|
-
actions.columnReorderInPageIndex = null;
|
|
5997
|
-
}
|
|
5998
6005
|
});
|
|
5999
6006
|
};
|
|
6000
6007
|
target.addEventListener("pointermove", onPointerMove);
|
|
@@ -8124,7 +8131,7 @@ function useColumnResizeHandle(column, opts) {
|
|
|
8124
8131
|
|
|
8125
8132
|
// src/components/InfiniteTable/components/draggable/DragList.tsx
|
|
8126
8133
|
import * as React33 from "react";
|
|
8127
|
-
import { useCallback as
|
|
8134
|
+
import { useCallback as useCallback17, useEffect as useEffect10, useState as useState12 } from "react";
|
|
8128
8135
|
|
|
8129
8136
|
// src/components/InfiniteTable/components/draggable/DragList.css.ts
|
|
8130
8137
|
var DragListRecipe = createRuntimeFn({ defaultClassName: "_16lm1iw3a _16lm1iw1", variantClassNames: { dragging: { true: "_16lm1iwn _16lm1iw1x" } }, defaultVariants: {}, compoundVariants: [] });
|
|
@@ -8186,6 +8193,20 @@ var DragInteractionTarget = class extends EventEmitter {
|
|
|
8186
8193
|
}
|
|
8187
8194
|
return result;
|
|
8188
8195
|
}
|
|
8196
|
+
/**
|
|
8197
|
+
* Adjusts breakpoints and listRectangle to compensate for container scroll.
|
|
8198
|
+
* When the container scrolls by `scrollDelta`, items shift in the viewport
|
|
8199
|
+
* but the pointer (in the source-adjusted coordinate space) doesn't change.
|
|
8200
|
+
* Shifting breakpoints keeps the drop index calculation correct.
|
|
8201
|
+
*/
|
|
8202
|
+
adjustForScroll(scrollDelta) {
|
|
8203
|
+
this.breakpoints = this.breakpoints.map((bp) => bp - scrollDelta);
|
|
8204
|
+
if (this.data.orientation === "vertical") {
|
|
8205
|
+
this.data.listRectangle.shift({ top: -scrollDelta, left: 0 });
|
|
8206
|
+
} else {
|
|
8207
|
+
this.data.listRectangle.shift({ top: 0, left: -scrollDelta });
|
|
8208
|
+
}
|
|
8209
|
+
}
|
|
8189
8210
|
move(params) {
|
|
8190
8211
|
this.emit("move", params);
|
|
8191
8212
|
}
|
|
@@ -8241,6 +8262,217 @@ var DragInteractionTarget = class extends EventEmitter {
|
|
|
8241
8262
|
}
|
|
8242
8263
|
};
|
|
8243
8264
|
|
|
8265
|
+
// src/components/InfiniteTable/components/draggable/AutoScroller.ts
|
|
8266
|
+
var defaultAutoScrollerConfig = {
|
|
8267
|
+
startFromPercentage: 0.25,
|
|
8268
|
+
maxScrollAtPercentage: 0.05,
|
|
8269
|
+
maxPixelScroll: 28,
|
|
8270
|
+
ease: (pct) => pct ** 2,
|
|
8271
|
+
durationDampening: {
|
|
8272
|
+
stopDampeningAt: 1200,
|
|
8273
|
+
accelerateAt: 360
|
|
8274
|
+
}
|
|
8275
|
+
};
|
|
8276
|
+
function isScrollable(element, orientation) {
|
|
8277
|
+
const style2 = getComputedStyle(element);
|
|
8278
|
+
const overflowProp = orientation === "vertical" ? style2.overflowY : style2.overflowX;
|
|
8279
|
+
if (overflowProp !== "auto" && overflowProp !== "scroll") {
|
|
8280
|
+
return false;
|
|
8281
|
+
}
|
|
8282
|
+
return orientation === "vertical" ? element.scrollHeight > element.clientHeight : element.scrollWidth > element.clientWidth;
|
|
8283
|
+
}
|
|
8284
|
+
function findScrollableAncestor(element, orientation) {
|
|
8285
|
+
let current = element;
|
|
8286
|
+
while (current) {
|
|
8287
|
+
if (current === document.documentElement || current === document.body) {
|
|
8288
|
+
break;
|
|
8289
|
+
}
|
|
8290
|
+
if (isScrollable(current, orientation)) {
|
|
8291
|
+
return current;
|
|
8292
|
+
}
|
|
8293
|
+
current = current.parentElement;
|
|
8294
|
+
}
|
|
8295
|
+
return null;
|
|
8296
|
+
}
|
|
8297
|
+
function getThresholds(containerSize, config) {
|
|
8298
|
+
return {
|
|
8299
|
+
startScrollingFrom: containerSize * config.startFromPercentage,
|
|
8300
|
+
maxScrollValueAt: containerSize * config.maxScrollAtPercentage
|
|
8301
|
+
};
|
|
8302
|
+
}
|
|
8303
|
+
var MIN_SCROLL = 1;
|
|
8304
|
+
function getValueFromDistance(distanceToEdge, thresholds, config) {
|
|
8305
|
+
if (distanceToEdge > thresholds.startScrollingFrom) {
|
|
8306
|
+
return 0;
|
|
8307
|
+
}
|
|
8308
|
+
if (distanceToEdge <= thresholds.maxScrollValueAt) {
|
|
8309
|
+
return config.maxPixelScroll;
|
|
8310
|
+
}
|
|
8311
|
+
if (distanceToEdge === thresholds.startScrollingFrom) {
|
|
8312
|
+
return MIN_SCROLL;
|
|
8313
|
+
}
|
|
8314
|
+
const percentFromMax = (distanceToEdge - thresholds.maxScrollValueAt) / (thresholds.startScrollingFrom - thresholds.maxScrollValueAt);
|
|
8315
|
+
const percentFromStart = 1 - percentFromMax;
|
|
8316
|
+
return Math.ceil(config.maxPixelScroll * config.ease(percentFromStart));
|
|
8317
|
+
}
|
|
8318
|
+
function dampenByTime(proposedScroll, dragStartTime, config) {
|
|
8319
|
+
const { accelerateAt, stopDampeningAt } = config.durationDampening;
|
|
8320
|
+
const runTime = Date.now() - dragStartTime;
|
|
8321
|
+
if (runTime >= stopDampeningAt) {
|
|
8322
|
+
return proposedScroll;
|
|
8323
|
+
}
|
|
8324
|
+
if (runTime < accelerateAt) {
|
|
8325
|
+
return MIN_SCROLL;
|
|
8326
|
+
}
|
|
8327
|
+
const pct = (runTime - accelerateAt) / (stopDampeningAt - accelerateAt);
|
|
8328
|
+
return Math.ceil(proposedScroll * config.ease(pct));
|
|
8329
|
+
}
|
|
8330
|
+
function getScrollForAxis(point, containerStart, containerEnd, containerSize, config, dragStartTime, shouldUseDampening) {
|
|
8331
|
+
if (point < containerStart || point > containerEnd) {
|
|
8332
|
+
return 0;
|
|
8333
|
+
}
|
|
8334
|
+
const thresholds = getThresholds(containerSize, config);
|
|
8335
|
+
const distToStart = point - containerStart;
|
|
8336
|
+
const distToEnd = containerEnd - point;
|
|
8337
|
+
const closerToEnd = distToEnd < distToStart;
|
|
8338
|
+
let value;
|
|
8339
|
+
if (closerToEnd) {
|
|
8340
|
+
value = getValueFromDistance(distToEnd, thresholds, config);
|
|
8341
|
+
} else {
|
|
8342
|
+
value = -getValueFromDistance(distToStart, thresholds, config);
|
|
8343
|
+
}
|
|
8344
|
+
if (value === 0) {
|
|
8345
|
+
return 0;
|
|
8346
|
+
}
|
|
8347
|
+
if (shouldUseDampening) {
|
|
8348
|
+
const sign = value > 0 ? 1 : -1;
|
|
8349
|
+
return sign * dampenByTime(Math.abs(value), dragStartTime, config);
|
|
8350
|
+
}
|
|
8351
|
+
return value;
|
|
8352
|
+
}
|
|
8353
|
+
var AutoScroller = class {
|
|
8354
|
+
constructor(options) {
|
|
8355
|
+
this.scrollContainer = null;
|
|
8356
|
+
this.rafId = null;
|
|
8357
|
+
this.lastPointer = { left: 0, top: 0 };
|
|
8358
|
+
this.dragStartTime = 0;
|
|
8359
|
+
this.shouldUseDampening = false;
|
|
8360
|
+
this.active = false;
|
|
8361
|
+
// captured at drag start before transforms inflate scrollHeight
|
|
8362
|
+
this.maxScrollTop = 0;
|
|
8363
|
+
this.maxScrollLeft = 0;
|
|
8364
|
+
this.orientation = options.orientation;
|
|
8365
|
+
this.onScroll = options.onScroll;
|
|
8366
|
+
this.config = { ...defaultAutoScrollerConfig, ...options.config };
|
|
8367
|
+
}
|
|
8368
|
+
start(listElement) {
|
|
8369
|
+
this.scrollContainer = findScrollableAncestor(
|
|
8370
|
+
listElement,
|
|
8371
|
+
this.orientation
|
|
8372
|
+
);
|
|
8373
|
+
if (this.scrollContainer) {
|
|
8374
|
+
this.maxScrollTop = this.scrollContainer.scrollHeight - this.scrollContainer.clientHeight;
|
|
8375
|
+
this.maxScrollLeft = this.scrollContainer.scrollWidth - this.scrollContainer.clientWidth;
|
|
8376
|
+
}
|
|
8377
|
+
this.dragStartTime = Date.now();
|
|
8378
|
+
this.shouldUseDampening = true;
|
|
8379
|
+
this.active = true;
|
|
8380
|
+
}
|
|
8381
|
+
getScrollContainer() {
|
|
8382
|
+
return this.scrollContainer;
|
|
8383
|
+
}
|
|
8384
|
+
updatePointer(point) {
|
|
8385
|
+
this.lastPointer = point;
|
|
8386
|
+
if (!this.rafId && this.active) {
|
|
8387
|
+
this.scheduleScroll();
|
|
8388
|
+
}
|
|
8389
|
+
}
|
|
8390
|
+
scheduleScroll() {
|
|
8391
|
+
this.rafId = requestAnimationFrame(() => {
|
|
8392
|
+
this.rafId = null;
|
|
8393
|
+
if (!this.active || !this.scrollContainer) {
|
|
8394
|
+
return;
|
|
8395
|
+
}
|
|
8396
|
+
const delta = this.computeScroll();
|
|
8397
|
+
if (delta.top === 0 && delta.left === 0) {
|
|
8398
|
+
return;
|
|
8399
|
+
}
|
|
8400
|
+
const scrollBefore = {
|
|
8401
|
+
top: this.scrollContainer.scrollTop,
|
|
8402
|
+
left: this.scrollContainer.scrollLeft
|
|
8403
|
+
};
|
|
8404
|
+
const clampedTop = Math.max(
|
|
8405
|
+
0,
|
|
8406
|
+
Math.min(this.maxScrollTop, scrollBefore.top + delta.top)
|
|
8407
|
+
);
|
|
8408
|
+
const clampedLeft = Math.max(
|
|
8409
|
+
0,
|
|
8410
|
+
Math.min(this.maxScrollLeft, scrollBefore.left + delta.left)
|
|
8411
|
+
);
|
|
8412
|
+
this.scrollContainer.scrollTop = clampedTop;
|
|
8413
|
+
this.scrollContainer.scrollLeft = clampedLeft;
|
|
8414
|
+
const actualDelta = {
|
|
8415
|
+
top: this.scrollContainer.scrollTop - scrollBefore.top,
|
|
8416
|
+
left: this.scrollContainer.scrollLeft - scrollBefore.left
|
|
8417
|
+
};
|
|
8418
|
+
const didScroll = actualDelta.top !== 0 || actualDelta.left !== 0;
|
|
8419
|
+
if (didScroll) {
|
|
8420
|
+
this.onScroll(actualDelta);
|
|
8421
|
+
}
|
|
8422
|
+
if (this.active && didScroll) {
|
|
8423
|
+
this.scheduleScroll();
|
|
8424
|
+
}
|
|
8425
|
+
});
|
|
8426
|
+
}
|
|
8427
|
+
computeScroll() {
|
|
8428
|
+
if (!this.scrollContainer) {
|
|
8429
|
+
return { top: 0, left: 0 };
|
|
8430
|
+
}
|
|
8431
|
+
const rect = this.scrollContainer.getBoundingClientRect();
|
|
8432
|
+
if (this.orientation === "vertical") {
|
|
8433
|
+
if (this.lastPointer.left < rect.left || this.lastPointer.left > rect.right) {
|
|
8434
|
+
return { top: 0, left: 0 };
|
|
8435
|
+
}
|
|
8436
|
+
} else {
|
|
8437
|
+
if (this.lastPointer.top < rect.top || this.lastPointer.top > rect.bottom) {
|
|
8438
|
+
return { top: 0, left: 0 };
|
|
8439
|
+
}
|
|
8440
|
+
}
|
|
8441
|
+
let scrollTop2 = 0;
|
|
8442
|
+
let scrollLeft2 = 0;
|
|
8443
|
+
if (this.orientation === "vertical") {
|
|
8444
|
+
scrollTop2 = getScrollForAxis(
|
|
8445
|
+
this.lastPointer.top,
|
|
8446
|
+
rect.top,
|
|
8447
|
+
rect.bottom,
|
|
8448
|
+
rect.height,
|
|
8449
|
+
this.config,
|
|
8450
|
+
this.dragStartTime,
|
|
8451
|
+
this.shouldUseDampening
|
|
8452
|
+
);
|
|
8453
|
+
} else {
|
|
8454
|
+
scrollLeft2 = getScrollForAxis(
|
|
8455
|
+
this.lastPointer.left,
|
|
8456
|
+
rect.left,
|
|
8457
|
+
rect.right,
|
|
8458
|
+
rect.width,
|
|
8459
|
+
this.config,
|
|
8460
|
+
this.dragStartTime,
|
|
8461
|
+
this.shouldUseDampening
|
|
8462
|
+
);
|
|
8463
|
+
}
|
|
8464
|
+
return { top: scrollTop2, left: scrollLeft2 };
|
|
8465
|
+
}
|
|
8466
|
+
stop() {
|
|
8467
|
+
this.active = false;
|
|
8468
|
+
if (this.rafId != null) {
|
|
8469
|
+
cancelAnimationFrame(this.rafId);
|
|
8470
|
+
this.rafId = null;
|
|
8471
|
+
}
|
|
8472
|
+
this.scrollContainer = null;
|
|
8473
|
+
}
|
|
8474
|
+
};
|
|
8475
|
+
|
|
8244
8476
|
// src/components/InfiniteTable/components/draggable/DragList.tsx
|
|
8245
8477
|
var DragListContext = React33.createContext({
|
|
8246
8478
|
dragItemId: null,
|
|
@@ -8266,8 +8498,15 @@ var defaultUpdatePosition = (options) => {
|
|
|
8266
8498
|
var getDraggableItemId = (node) => {
|
|
8267
8499
|
return `${node.getAttribute(DRAG_ITEM_ATTRIBUTE)}`;
|
|
8268
8500
|
};
|
|
8269
|
-
function
|
|
8501
|
+
function getDraggableItemNodes(domRef, dragListId) {
|
|
8270
8502
|
const dragItems = domRef.current?.querySelectorAll(DRAG_ITEM_SELECTOR) ?? [];
|
|
8503
|
+
const result = Array.from(dragItems).filter(
|
|
8504
|
+
(item) => item.getAttribute(DRAG_ITEM_LIST_ATTRIBUTE) === `${dragListId}`
|
|
8505
|
+
);
|
|
8506
|
+
return result;
|
|
8507
|
+
}
|
|
8508
|
+
function getDraggableItems(domRef, dragListId) {
|
|
8509
|
+
const dragItems = getDraggableItemNodes(domRef, dragListId);
|
|
8271
8510
|
if (!dragItems || dragItems.length === 0) {
|
|
8272
8511
|
}
|
|
8273
8512
|
const draggableItems = Array.from(dragItems).map((item) => {
|
|
@@ -8282,15 +8521,34 @@ function getDraggableItems(domRef) {
|
|
|
8282
8521
|
}
|
|
8283
8522
|
function getInteractionTargetData(params) {
|
|
8284
8523
|
const { domRef, orientation, dragListId } = params;
|
|
8285
|
-
const
|
|
8524
|
+
const draggableItems = getDraggableItems(domRef, dragListId);
|
|
8525
|
+
const domRect = domRef.current.getBoundingClientRect();
|
|
8526
|
+
let top2 = domRect.top;
|
|
8527
|
+
let left2 = domRect.left;
|
|
8528
|
+
let bottom = domRect.bottom;
|
|
8529
|
+
let right = domRect.right;
|
|
8530
|
+
for (const item of draggableItems) {
|
|
8531
|
+
const r = item.rect;
|
|
8532
|
+
if (r.top < top2) top2 = r.top;
|
|
8533
|
+
if (r.left < left2) left2 = r.left;
|
|
8534
|
+
if (r.bottom > bottom) bottom = r.bottom;
|
|
8535
|
+
if (r.right > right) right = r.right;
|
|
8536
|
+
}
|
|
8537
|
+
const listRectangle = Rectangle.from({
|
|
8538
|
+
top: top2,
|
|
8539
|
+
left: left2,
|
|
8540
|
+
width: right - left2,
|
|
8541
|
+
height: bottom - top2
|
|
8542
|
+
});
|
|
8286
8543
|
const options = {
|
|
8287
|
-
draggableItems
|
|
8544
|
+
draggableItems,
|
|
8288
8545
|
orientation,
|
|
8289
8546
|
listId: dragListId,
|
|
8290
8547
|
listRectangle,
|
|
8291
8548
|
acceptDropsFrom: params.acceptDropsFrom,
|
|
8292
8549
|
shouldAcceptDrop: params.shouldAcceptDrop,
|
|
8293
|
-
initial: params.initial
|
|
8550
|
+
initial: params.initial,
|
|
8551
|
+
preserveDragSpace: params.preserveDragSpace
|
|
8294
8552
|
};
|
|
8295
8553
|
return options;
|
|
8296
8554
|
}
|
|
@@ -8301,7 +8559,7 @@ function createInteractionTarget(params) {
|
|
|
8301
8559
|
function useInteractionTarget(domRef, props) {
|
|
8302
8560
|
const getProps = useLatest(props);
|
|
8303
8561
|
const [interactionTarget, doSetInteractionTarget] = React33.useState(null);
|
|
8304
|
-
const setInteractionTarget =
|
|
8562
|
+
const setInteractionTarget = useCallback17(
|
|
8305
8563
|
(interactionTarget2) => {
|
|
8306
8564
|
if (interactionTarget2) {
|
|
8307
8565
|
DragManager.registerDragInteractionTarget(interactionTarget2);
|
|
@@ -8348,8 +8606,49 @@ function useInteractionTarget(domRef, props) {
|
|
|
8348
8606
|
getInteractionTarget
|
|
8349
8607
|
};
|
|
8350
8608
|
}
|
|
8609
|
+
function createDefaultProxy(dragItemNode, initialRect) {
|
|
8610
|
+
const proxy = dragItemNode.cloneNode(true);
|
|
8611
|
+
proxy.removeAttribute(DRAG_ITEM_ATTRIBUTE);
|
|
8612
|
+
proxy.style.position = "fixed";
|
|
8613
|
+
proxy.style.top = `${initialRect.top}px`;
|
|
8614
|
+
proxy.style.left = `${initialRect.left}px`;
|
|
8615
|
+
proxy.style.width = `${initialRect.width}px`;
|
|
8616
|
+
proxy.style.height = `${initialRect.height}px`;
|
|
8617
|
+
proxy.style.zIndex = "999999";
|
|
8618
|
+
proxy.style.pointerEvents = "none";
|
|
8619
|
+
proxy.style.margin = "0";
|
|
8620
|
+
proxy.style.boxSizing = "border-box";
|
|
8621
|
+
proxy.style.transform = "none";
|
|
8622
|
+
document.body.appendChild(proxy);
|
|
8623
|
+
return proxy;
|
|
8624
|
+
}
|
|
8625
|
+
function defaultDragProxyMove({
|
|
8626
|
+
proxyElement,
|
|
8627
|
+
dx,
|
|
8628
|
+
dy
|
|
8629
|
+
}) {
|
|
8630
|
+
proxyElement.style.transform = `translate3d(${dx}px, ${dy}px, 0)`;
|
|
8631
|
+
}
|
|
8632
|
+
function cleanupProxy(proxyStateRef) {
|
|
8633
|
+
const state = proxyStateRef.current;
|
|
8634
|
+
if (!state) return;
|
|
8635
|
+
if (state.cleanup) {
|
|
8636
|
+
state.cleanup({ proxyElement: state.proxyElement });
|
|
8637
|
+
} else {
|
|
8638
|
+
state.proxyElement.remove();
|
|
8639
|
+
}
|
|
8640
|
+
state.originalNode.style.visibility = "";
|
|
8641
|
+
proxyStateRef.current = null;
|
|
8642
|
+
}
|
|
8351
8643
|
var DragList = (props) => {
|
|
8352
8644
|
const domRef = React33.useRef(null);
|
|
8645
|
+
const proxyStateRef = React33.useRef(null);
|
|
8646
|
+
const [dragProxyRenderState, setDragProxyRenderState] = useState12(null);
|
|
8647
|
+
const sourceScrollOffsetRef = React33.useRef({ top: 0, left: 0 });
|
|
8648
|
+
const proxyPortalNodeRef = React33.useRef(null);
|
|
8649
|
+
const proxyRefCallback = React33.useCallback((node) => {
|
|
8650
|
+
proxyPortalNodeRef.current = node;
|
|
8651
|
+
}, []);
|
|
8353
8652
|
const { dropTargetListId, dragSourceListId } = useDragDropProvider();
|
|
8354
8653
|
const { updateDragOperationSourceAndTarget, dragItemId, status } = useDragDropProvider();
|
|
8355
8654
|
const getOnDrop = useLatest(props.onDrop);
|
|
@@ -8390,18 +8689,29 @@ var DragList = (props) => {
|
|
|
8390
8689
|
);
|
|
8391
8690
|
const removeOnDragMove = interactionTarget.on(
|
|
8392
8691
|
"move",
|
|
8393
|
-
({ offsetsForItems, items, status: status2 }) => {
|
|
8692
|
+
({ offsetsForItems, items, status: status2, dragItem }) => {
|
|
8394
8693
|
if (status2 === "rejected") {
|
|
8395
8694
|
return;
|
|
8396
8695
|
}
|
|
8397
8696
|
const dragItems = getDragItems();
|
|
8398
8697
|
const updatePosition = getUpdatePosition();
|
|
8698
|
+
const proxyState = proxyStateRef.current;
|
|
8399
8699
|
items.forEach((item, index) => {
|
|
8400
|
-
|
|
8700
|
+
let offset = offsetsForItems[index];
|
|
8401
8701
|
const node = dragItems[index];
|
|
8402
8702
|
if (!node) {
|
|
8403
8703
|
return;
|
|
8404
8704
|
}
|
|
8705
|
+
if (proxyState && item.id === proxyState.dragItemId) {
|
|
8706
|
+
return;
|
|
8707
|
+
}
|
|
8708
|
+
if (!proxyState && item.id === dragItem.id) {
|
|
8709
|
+
const scrollOffset = sourceScrollOffsetRef.current;
|
|
8710
|
+
offset = {
|
|
8711
|
+
left: offset.left + scrollOffset.left,
|
|
8712
|
+
top: offset.top + scrollOffset.top
|
|
8713
|
+
};
|
|
8714
|
+
}
|
|
8405
8715
|
updatePosition({
|
|
8406
8716
|
id: item.id,
|
|
8407
8717
|
node,
|
|
@@ -8439,6 +8749,12 @@ var DragList = (props) => {
|
|
|
8439
8749
|
offset: null
|
|
8440
8750
|
});
|
|
8441
8751
|
});
|
|
8752
|
+
cleanupProxy(proxyStateRef);
|
|
8753
|
+
setDragProxyRenderState((prev) => {
|
|
8754
|
+
if (!prev) return prev;
|
|
8755
|
+
requestAnimationFrame(() => setDragProxyRenderState(null));
|
|
8756
|
+
return { ...prev, dragItemId: null };
|
|
8757
|
+
});
|
|
8442
8758
|
const accepted = status2 === "accepted";
|
|
8443
8759
|
if (dragListId === dropTargetListId2 && dragSourceListId2 !== dragListId) {
|
|
8444
8760
|
if (onAcceptDrop && accepted) {
|
|
@@ -8468,26 +8784,72 @@ var DragList = (props) => {
|
|
|
8468
8784
|
});
|
|
8469
8785
|
}
|
|
8470
8786
|
});
|
|
8787
|
+
let targetAutoScroller = null;
|
|
8788
|
+
let targetScrollContainer = null;
|
|
8789
|
+
let targetScrollHandler = null;
|
|
8790
|
+
let targetPointermoveHandler = null;
|
|
8791
|
+
if (!interactionTarget.getData().initial && domRef.current) {
|
|
8792
|
+
targetAutoScroller = new AutoScroller({
|
|
8793
|
+
orientation: props.orientation,
|
|
8794
|
+
onScroll: () => {
|
|
8795
|
+
}
|
|
8796
|
+
});
|
|
8797
|
+
targetAutoScroller.start(domRef.current);
|
|
8798
|
+
targetScrollContainer = targetAutoScroller.getScrollContainer();
|
|
8799
|
+
if (targetScrollContainer) {
|
|
8800
|
+
let lastScroll = props.orientation === "vertical" ? targetScrollContainer.scrollTop : targetScrollContainer.scrollLeft;
|
|
8801
|
+
targetScrollHandler = () => {
|
|
8802
|
+
const current = props.orientation === "vertical" ? targetScrollContainer.scrollTop : targetScrollContainer.scrollLeft;
|
|
8803
|
+
const delta = current - lastScroll;
|
|
8804
|
+
lastScroll = current;
|
|
8805
|
+
if (delta !== 0) {
|
|
8806
|
+
interactionTarget.adjustForScroll(delta);
|
|
8807
|
+
DragManager.retriggerMove();
|
|
8808
|
+
}
|
|
8809
|
+
};
|
|
8810
|
+
targetScrollContainer.addEventListener("scroll", targetScrollHandler);
|
|
8811
|
+
}
|
|
8812
|
+
targetPointermoveHandler = (e) => {
|
|
8813
|
+
targetAutoScroller.updatePointer({
|
|
8814
|
+
left: e.clientX,
|
|
8815
|
+
top: e.clientY
|
|
8816
|
+
});
|
|
8817
|
+
};
|
|
8818
|
+
getGlobal().addEventListener("pointermove", targetPointermoveHandler);
|
|
8819
|
+
}
|
|
8471
8820
|
return () => {
|
|
8472
8821
|
removeOnDragStart();
|
|
8473
8822
|
removeOnDragMove();
|
|
8474
8823
|
removeOnDragDrop();
|
|
8824
|
+
if (targetAutoScroller) {
|
|
8825
|
+
targetAutoScroller.stop();
|
|
8826
|
+
}
|
|
8827
|
+
if (targetScrollContainer && targetScrollHandler) {
|
|
8828
|
+
targetScrollContainer.removeEventListener(
|
|
8829
|
+
"scroll",
|
|
8830
|
+
targetScrollHandler
|
|
8831
|
+
);
|
|
8832
|
+
}
|
|
8833
|
+
if (targetPointermoveHandler) {
|
|
8834
|
+
getGlobal().removeEventListener(
|
|
8835
|
+
"pointermove",
|
|
8836
|
+
targetPointermoveHandler
|
|
8837
|
+
);
|
|
8838
|
+
}
|
|
8475
8839
|
};
|
|
8476
8840
|
}
|
|
8477
8841
|
return void 0;
|
|
8478
8842
|
}, [interactionTarget, props.dragListId]);
|
|
8479
8843
|
const dragItemsRef = React33.useRef([]);
|
|
8480
|
-
const getDragItems =
|
|
8844
|
+
const getDragItems = useCallback17(() => {
|
|
8481
8845
|
let dragItems = dragItemsRef.current;
|
|
8482
8846
|
if (!dragItems || dragItems.length === 0) {
|
|
8483
|
-
dragItems =
|
|
8484
|
-
domRef.current?.querySelectorAll(DRAG_ITEM_SELECTOR) ?? []
|
|
8485
|
-
);
|
|
8847
|
+
dragItems = getDraggableItemNodes(domRef, props.dragListId);
|
|
8486
8848
|
dragItemsRef.current = dragItems;
|
|
8487
8849
|
}
|
|
8488
8850
|
return dragItems;
|
|
8489
|
-
}, []);
|
|
8490
|
-
const onDragItemPointerDown =
|
|
8851
|
+
}, [props.dragListId]);
|
|
8852
|
+
const onDragItemPointerDown = useCallback17(
|
|
8491
8853
|
(e) => {
|
|
8492
8854
|
const target = e.currentTarget;
|
|
8493
8855
|
let dragItemId2 = target.getAttribute(DRAG_ITEM_ATTRIBUTE);
|
|
@@ -8507,28 +8869,70 @@ var DragList = (props) => {
|
|
|
8507
8869
|
}
|
|
8508
8870
|
dragItemId2 = `${dragItemId2}`;
|
|
8509
8871
|
let dragOperation = null;
|
|
8510
|
-
const dragItems =
|
|
8511
|
-
domRef.current?.querySelectorAll(DRAG_ITEM_SELECTOR) ?? []
|
|
8512
|
-
);
|
|
8872
|
+
const dragItems = getDraggableItemNodes(domRef, props.dragListId);
|
|
8513
8873
|
dragItemsRef.current = dragItems;
|
|
8514
8874
|
const interactionTarget2 = createInteractionTarget({
|
|
8515
8875
|
domRef,
|
|
8516
8876
|
orientation: props.orientation,
|
|
8517
8877
|
dragListId: props.dragListId,
|
|
8518
8878
|
acceptDropsFrom: props.acceptDropsFrom,
|
|
8519
|
-
initial: true
|
|
8879
|
+
initial: true,
|
|
8880
|
+
preserveDragSpace: props.preserveDragSpace
|
|
8520
8881
|
});
|
|
8521
8882
|
const draggableItems = interactionTarget2.getData().draggableItems;
|
|
8522
8883
|
const dragIndex = draggableItems.findIndex(
|
|
8523
8884
|
(item) => item.id === dragItemId2
|
|
8524
8885
|
);
|
|
8525
8886
|
const dragItem = draggableItems[dragIndex];
|
|
8887
|
+
const dragItemNode = dragItems[dragIndex].getAttribute(DRAG_ITEM_ATTRIBUTE) === `${dragItemId2}` ? dragItems[dragIndex] : dragItems.find(
|
|
8888
|
+
(node) => node.getAttribute(DRAG_ITEM_ATTRIBUTE) === `${dragItemId2}`
|
|
8889
|
+
);
|
|
8526
8890
|
setInteractionTarget(interactionTarget2);
|
|
8527
8891
|
const initialCoords = {
|
|
8528
8892
|
left: e.clientX,
|
|
8529
8893
|
top: e.clientY
|
|
8530
8894
|
};
|
|
8895
|
+
let lastPointer = { left: e.clientX, top: e.clientY };
|
|
8896
|
+
sourceScrollOffsetRef.current = { top: 0, left: 0 };
|
|
8897
|
+
const autoScroller = new AutoScroller({
|
|
8898
|
+
orientation: props.orientation,
|
|
8899
|
+
onScroll: () => {
|
|
8900
|
+
}
|
|
8901
|
+
});
|
|
8902
|
+
if (domRef.current) {
|
|
8903
|
+
autoScroller.start(domRef.current);
|
|
8904
|
+
}
|
|
8905
|
+
const scrollContainer = autoScroller.getScrollContainer();
|
|
8906
|
+
let lastSourceScroll = scrollContainer ? props.orientation === "vertical" ? scrollContainer.scrollTop : scrollContainer.scrollLeft : 0;
|
|
8907
|
+
function fireDragMove() {
|
|
8908
|
+
if (!dragOperation) return;
|
|
8909
|
+
dragOperation.move({
|
|
8910
|
+
left: lastPointer.left,
|
|
8911
|
+
top: lastPointer.top
|
|
8912
|
+
});
|
|
8913
|
+
}
|
|
8914
|
+
const onContainerScroll = () => {
|
|
8915
|
+
if (!scrollContainer) return;
|
|
8916
|
+
const current = props.orientation === "vertical" ? scrollContainer.scrollTop : scrollContainer.scrollLeft;
|
|
8917
|
+
const delta = current - lastSourceScroll;
|
|
8918
|
+
lastSourceScroll = current;
|
|
8919
|
+
if (delta !== 0) {
|
|
8920
|
+
interactionTarget2.adjustForScroll(delta);
|
|
8921
|
+
if (props.orientation === "vertical") {
|
|
8922
|
+
sourceScrollOffsetRef.current.top += delta;
|
|
8923
|
+
} else {
|
|
8924
|
+
sourceScrollOffsetRef.current.left += delta;
|
|
8925
|
+
}
|
|
8926
|
+
}
|
|
8927
|
+
fireDragMove();
|
|
8928
|
+
};
|
|
8929
|
+
scrollContainer?.addEventListener("scroll", onContainerScroll);
|
|
8930
|
+
const dragStrategy = props.dragStrategy ?? "proxy";
|
|
8931
|
+
const useProxy = dragStrategy === "proxy" && !props.renderDragProxy;
|
|
8932
|
+
const useRenderProxy = dragStrategy === "proxy" && !!props.renderDragProxy;
|
|
8933
|
+
const proxyMove = props.onDragProxyMove ?? defaultDragProxyMove;
|
|
8531
8934
|
const onPointerMove = (e2) => {
|
|
8935
|
+
lastPointer = { left: e2.clientX, top: e2.clientY };
|
|
8532
8936
|
if (!dragOperation) {
|
|
8533
8937
|
dragOperation = DragManager.startDrag(
|
|
8534
8938
|
{
|
|
@@ -8538,15 +8942,84 @@ var DragList = (props) => {
|
|
|
8538
8942
|
},
|
|
8539
8943
|
initialCoords
|
|
8540
8944
|
);
|
|
8945
|
+
if (dragItemNode && useProxy) {
|
|
8946
|
+
const rect = dragItemNode.getBoundingClientRect();
|
|
8947
|
+
let cachedProxy = null;
|
|
8948
|
+
const setupParams = {
|
|
8949
|
+
dragItemNode,
|
|
8950
|
+
dragItemId: `${dragItemId2}`,
|
|
8951
|
+
initialRect: rect,
|
|
8952
|
+
initialCoords,
|
|
8953
|
+
get proxyElement() {
|
|
8954
|
+
if (!cachedProxy) {
|
|
8955
|
+
cachedProxy = createDefaultProxy(dragItemNode, rect);
|
|
8956
|
+
}
|
|
8957
|
+
return cachedProxy;
|
|
8958
|
+
}
|
|
8959
|
+
};
|
|
8960
|
+
const setupResult = props.onDragProxySetup?.(setupParams);
|
|
8961
|
+
const proxyElement = setupResult?.proxyElement ?? setupParams.proxyElement;
|
|
8962
|
+
dragItemNode.style.visibility = "hidden";
|
|
8963
|
+
proxyStateRef.current = {
|
|
8964
|
+
proxyElement,
|
|
8965
|
+
originalNode: dragItemNode,
|
|
8966
|
+
dragItemId: `${dragItemId2}`,
|
|
8967
|
+
initialRect: rect,
|
|
8968
|
+
cleanup: setupResult?.cleanup
|
|
8969
|
+
};
|
|
8970
|
+
}
|
|
8971
|
+
if (dragItemNode && useRenderProxy) {
|
|
8972
|
+
const rect = dragItemNode.getBoundingClientRect();
|
|
8973
|
+
dragItemNode.style.visibility = "hidden";
|
|
8974
|
+
proxyStateRef.current = {
|
|
8975
|
+
proxyElement: dragItemNode,
|
|
8976
|
+
originalNode: dragItemNode,
|
|
8977
|
+
dragItemId: `${dragItemId2}`,
|
|
8978
|
+
initialRect: rect,
|
|
8979
|
+
// Portal handles its own DOM; only restore visibility.
|
|
8980
|
+
cleanup: () => {
|
|
8981
|
+
}
|
|
8982
|
+
};
|
|
8983
|
+
setDragProxyRenderState({
|
|
8984
|
+
dragItemId: `${dragItemId2}`,
|
|
8985
|
+
initialRect: rect,
|
|
8986
|
+
dx: 0,
|
|
8987
|
+
dy: 0
|
|
8988
|
+
});
|
|
8989
|
+
}
|
|
8541
8990
|
}
|
|
8542
|
-
|
|
8991
|
+
const dx = e2.clientX - initialCoords.left;
|
|
8992
|
+
const dy = e2.clientY - initialCoords.top;
|
|
8993
|
+
if (useRenderProxy) {
|
|
8994
|
+
setDragProxyRenderState(
|
|
8995
|
+
(prev) => prev ? { ...prev, dx, dy } : prev
|
|
8996
|
+
);
|
|
8997
|
+
} else {
|
|
8998
|
+
const proxyState = proxyStateRef.current;
|
|
8999
|
+
if (proxyState) {
|
|
9000
|
+
proxyMove({ proxyElement: proxyState.proxyElement, dx, dy });
|
|
9001
|
+
}
|
|
9002
|
+
}
|
|
9003
|
+
autoScroller.updatePointer({
|
|
8543
9004
|
left: e2.clientX,
|
|
8544
9005
|
top: e2.clientY
|
|
8545
9006
|
});
|
|
9007
|
+
fireDragMove();
|
|
8546
9008
|
};
|
|
8547
9009
|
const onPointerUp = () => {
|
|
9010
|
+
autoScroller.stop();
|
|
9011
|
+
scrollContainer?.removeEventListener("scroll", onContainerScroll);
|
|
8548
9012
|
getGlobal().removeEventListener("pointermove", onPointerMove);
|
|
9013
|
+
if (useRenderProxy) {
|
|
9014
|
+
setDragProxyRenderState(
|
|
9015
|
+
(prev) => prev ? { ...prev, dragItemId: null } : prev
|
|
9016
|
+
);
|
|
9017
|
+
requestAnimationFrame(() => {
|
|
9018
|
+
setDragProxyRenderState(null);
|
|
9019
|
+
});
|
|
9020
|
+
}
|
|
8549
9021
|
if (!dragOperation) {
|
|
9022
|
+
cleanupProxy(proxyStateRef);
|
|
8550
9023
|
setInteractionTarget(null);
|
|
8551
9024
|
return;
|
|
8552
9025
|
}
|
|
@@ -8560,7 +9033,11 @@ var DragList = (props) => {
|
|
|
8560
9033
|
props.orientation,
|
|
8561
9034
|
props.dragListId,
|
|
8562
9035
|
props.acceptDropsFrom,
|
|
8563
|
-
props.removeOnDropOutside
|
|
9036
|
+
props.removeOnDropOutside,
|
|
9037
|
+
props.dragStrategy,
|
|
9038
|
+
props.renderDragProxy,
|
|
9039
|
+
props.onDragProxySetup,
|
|
9040
|
+
props.onDragProxyMove
|
|
8564
9041
|
]
|
|
8565
9042
|
);
|
|
8566
9043
|
const dragging = !!dragItemId;
|
|
@@ -8595,10 +9072,14 @@ var DragList = (props) => {
|
|
|
8595
9072
|
[DRAG_LIST_ATTRIBUTE]: props.dragListId
|
|
8596
9073
|
};
|
|
8597
9074
|
const children = typeof props.children === "function" ? props.children(domProps, contextValue) : props.children;
|
|
8598
|
-
return /* @__PURE__ */ React33.createElement(DragListContext.Provider, { value: contextValue }, children
|
|
9075
|
+
return /* @__PURE__ */ React33.createElement(DragListContext.Provider, { value: contextValue }, children, dragProxyRenderState && props.renderDragProxy ? props.renderDragProxy({
|
|
9076
|
+
...dragProxyRenderState,
|
|
9077
|
+
ref: proxyRefCallback
|
|
9078
|
+
}) : null);
|
|
8599
9079
|
};
|
|
8600
9080
|
var DRAG_LIST_ATTRIBUTE = "data-drag-list-id";
|
|
8601
9081
|
var DRAG_ITEM_ATTRIBUTE = "data-drag-item-id";
|
|
9082
|
+
var DRAG_ITEM_LIST_ATTRIBUTE = "data-drag-item-list-id";
|
|
8602
9083
|
var DRAG_ITEM_SELECTOR = `[${DRAG_ITEM_ATTRIBUTE}]`;
|
|
8603
9084
|
var DragItemContext = React33.createContext({
|
|
8604
9085
|
dragItemId: "",
|
|
@@ -8617,21 +9098,30 @@ var DraggableItem = (props) => {
|
|
|
8617
9098
|
dragSourceListId,
|
|
8618
9099
|
dropTargetListId
|
|
8619
9100
|
} = useDragListContext();
|
|
8620
|
-
const
|
|
9101
|
+
const dragItemListId = props.dragListId ?? dragListId;
|
|
9102
|
+
const active = dragSourceListId === dragItemListId && dragItemId === `${props.id}`;
|
|
8621
9103
|
const contextValue = React33.useMemo(
|
|
8622
9104
|
() => ({
|
|
8623
9105
|
dragItemId: props.id,
|
|
8624
9106
|
active,
|
|
8625
|
-
dragListId,
|
|
9107
|
+
dragListId: dragItemListId,
|
|
8626
9108
|
draggingInProgress,
|
|
8627
9109
|
dragSourceListId,
|
|
8628
9110
|
dropTargetListId
|
|
8629
9111
|
}),
|
|
8630
|
-
[
|
|
9112
|
+
[
|
|
9113
|
+
props.id,
|
|
9114
|
+
active,
|
|
9115
|
+
dragItemListId,
|
|
9116
|
+
draggingInProgress,
|
|
9117
|
+
dragSourceListId,
|
|
9118
|
+
dropTargetListId
|
|
9119
|
+
]
|
|
8631
9120
|
);
|
|
8632
9121
|
const domProps = {
|
|
8633
9122
|
// @ts-ignore
|
|
8634
|
-
|
|
9123
|
+
[DRAG_ITEM_ATTRIBUTE]: `${props.id}`,
|
|
9124
|
+
[DRAG_ITEM_LIST_ATTRIBUTE]: dragItemListId,
|
|
8635
9125
|
onPointerDown: onDragItemPointerDown,
|
|
8636
9126
|
className: join(
|
|
8637
9127
|
"DraggableItem",
|
|
@@ -8678,7 +9168,7 @@ import * as React49 from "react";
|
|
|
8678
9168
|
|
|
8679
9169
|
// src/components/HeadlessTable/index.tsx
|
|
8680
9170
|
import * as React43 from "react";
|
|
8681
|
-
import { useCallback as
|
|
9171
|
+
import { useCallback as useCallback18, useEffect as useEffect14, useRef as useRef18, useState as useState14 } from "react";
|
|
8682
9172
|
|
|
8683
9173
|
// src/components/VirtualList/SpacePlaceholder.tsx
|
|
8684
9174
|
import * as React35 from "react";
|
|
@@ -8795,9 +9285,9 @@ import { useLayoutEffect as useLayoutEffect8, useMemo as useMemo6 } from "react"
|
|
|
8795
9285
|
|
|
8796
9286
|
// src/components/RawList/AvoidReactDiff.tsx
|
|
8797
9287
|
import * as React37 from "react";
|
|
8798
|
-
import { useLayoutEffect as useLayoutEffect7, useRef as useRef15, useState as
|
|
9288
|
+
import { useLayoutEffect as useLayoutEffect7, useRef as useRef15, useState as useState13 } from "react";
|
|
8799
9289
|
function AvoidReactDiffFn(props) {
|
|
8800
|
-
const [children, setChildren] =
|
|
9290
|
+
const [children, setChildren] = useState13(props.updater.get);
|
|
8801
9291
|
const rafId = useRef15(null);
|
|
8802
9292
|
const afterCommitRef = useRef15(props.afterCommit);
|
|
8803
9293
|
afterCommitRef.current = props.afterCommit;
|
|
@@ -12634,7 +13124,7 @@ function HeadlessTable(props) {
|
|
|
12634
13124
|
} = props;
|
|
12635
13125
|
const { autoFocus } = domProps;
|
|
12636
13126
|
const domRef = useRef18(null);
|
|
12637
|
-
const [scrollSize, setTotalScrollSize] =
|
|
13127
|
+
const [scrollSize, setTotalScrollSize] = useState14({
|
|
12638
13128
|
width: 0,
|
|
12639
13129
|
height: 0
|
|
12640
13130
|
});
|
|
@@ -12661,7 +13151,7 @@ function HeadlessTable(props) {
|
|
|
12661
13151
|
const remove = setupResizeObserver(node, onResize, { debounce: 50 });
|
|
12662
13152
|
return remove;
|
|
12663
13153
|
}, [wrapRowsHorizontally, brain]);
|
|
12664
|
-
const updateDOMTransform =
|
|
13154
|
+
const updateDOMTransform = useCallback18((scrollPos) => {
|
|
12665
13155
|
requestAnimationFrame(() => {
|
|
12666
13156
|
if (!domRef.current) {
|
|
12667
13157
|
return;
|
|
@@ -12673,7 +13163,7 @@ function HeadlessTable(props) {
|
|
|
12673
13163
|
return;
|
|
12674
13164
|
});
|
|
12675
13165
|
}, []);
|
|
12676
|
-
const onContainerScroll =
|
|
13166
|
+
const onContainerScroll = useCallback18(
|
|
12677
13167
|
(scrollPos) => {
|
|
12678
13168
|
brain.setScrollPosition(scrollPos, updateDOMTransform);
|
|
12679
13169
|
},
|
|
@@ -12840,23 +13330,23 @@ function assignGroupOffsetsAndComputedWidths(items, groupOffset = 0) {
|
|
|
12840
13330
|
|
|
12841
13331
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
|
|
12842
13332
|
import * as React48 from "react";
|
|
12843
|
-
import { useCallback as
|
|
13333
|
+
import { useCallback as useCallback20, useEffect as useEffect15, useMemo as useMemo7, useRef as useRef20 } from "react";
|
|
12844
13334
|
|
|
12845
13335
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderGroup.tsx
|
|
12846
13336
|
import * as React46 from "react";
|
|
12847
13337
|
|
|
12848
13338
|
// src/components/InfiniteTable/components/InfiniteTableHeader/useColumnGroupResizeHandle.tsx
|
|
12849
13339
|
import * as React45 from "react";
|
|
12850
|
-
import { useCallback as
|
|
13340
|
+
import { useCallback as useCallback19 } from "react";
|
|
12851
13341
|
|
|
12852
13342
|
// src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/GroupResizeHandle.tsx
|
|
12853
|
-
import { useRef as useRef19, useState as
|
|
13343
|
+
import { useRef as useRef19, useState as useState15 } from "react";
|
|
12854
13344
|
import * as React44 from "react";
|
|
12855
13345
|
var { rootClassName: rootClassName8 } = internalProps;
|
|
12856
13346
|
var InfiniteTableHeaderCellResizeHandleCls2 = `${rootClassName8}HeaderCell_ResizeHandle`;
|
|
12857
13347
|
function GroupResizeHandleFn(props) {
|
|
12858
13348
|
const domRef = useRef19(null);
|
|
12859
|
-
const [constrained, setConstrained] =
|
|
13349
|
+
const [constrained, setConstrained] = useState15(false);
|
|
12860
13350
|
const constrainedRef = useRef19(constrained);
|
|
12861
13351
|
constrainedRef.current = constrained;
|
|
12862
13352
|
const col = props.groupColumns[0];
|
|
@@ -12960,7 +13450,7 @@ function useColumnGroupResizeHandle(groupColumns, config) {
|
|
|
12960
13450
|
};
|
|
12961
13451
|
});
|
|
12962
13452
|
const lastColumnInGroup = groupColumns[groupColumns.length - 1];
|
|
12963
|
-
const computeResizeForDiff =
|
|
13453
|
+
const computeResizeForDiff = useCallback19(
|
|
12964
13454
|
(diff) => {
|
|
12965
13455
|
const state = getState();
|
|
12966
13456
|
const { columnSizing, viewportReservedWidth, bodySize } = state;
|
|
@@ -13002,7 +13492,7 @@ function useColumnGroupResizeHandle(groupColumns, config) {
|
|
|
13002
13492
|
},
|
|
13003
13493
|
[lastColumnInGroup]
|
|
13004
13494
|
);
|
|
13005
|
-
const onColumnResize =
|
|
13495
|
+
const onColumnResize = useCallback19(
|
|
13006
13496
|
(diff) => {
|
|
13007
13497
|
const { columnSizing, reservedWidth } = computeResizeForDiff(diff);
|
|
13008
13498
|
actions.viewportReservedWidth = reservedWidth;
|
|
@@ -13168,7 +13658,7 @@ function InfiniteTableInternalHeaderFn(props) {
|
|
|
13168
13658
|
};
|
|
13169
13659
|
});
|
|
13170
13660
|
const domRef = useRef20(null);
|
|
13171
|
-
const updateDOMTransform =
|
|
13661
|
+
const updateDOMTransform = useCallback20((scrollPosition) => {
|
|
13172
13662
|
if (domRef.current) {
|
|
13173
13663
|
domRef.current.style.transform = `translate3d(-${scrollPosition.scrollLeft}px, 0px, 0px)`;
|
|
13174
13664
|
}
|
|
@@ -13213,7 +13703,7 @@ function InfiniteTableInternalHeaderFn(props) {
|
|
|
13213
13703
|
selectionMode
|
|
13214
13704
|
};
|
|
13215
13705
|
}, [allRowsSelected, someRowsSelected, selectionMode]);
|
|
13216
|
-
const renderCell =
|
|
13706
|
+
const renderCell = useCallback20(
|
|
13217
13707
|
(params) => {
|
|
13218
13708
|
const {
|
|
13219
13709
|
rowIndex,
|
|
@@ -13299,6 +13789,7 @@ function InfiniteTableInternalHeaderFn(props) {
|
|
|
13299
13789
|
{
|
|
13300
13790
|
orientation: "horizontal",
|
|
13301
13791
|
dragListId: "header",
|
|
13792
|
+
dragStrategy: "inline",
|
|
13302
13793
|
onDrop: emptyFn3,
|
|
13303
13794
|
updatePosition: emptyFn3
|
|
13304
13795
|
},
|
|
@@ -13550,7 +14041,8 @@ var InfiniteHeaderCellDataAttributes = keyMirror({
|
|
|
13550
14041
|
"data-column-id": "",
|
|
13551
14042
|
"data-sort": "",
|
|
13552
14043
|
"data-sort-index": "",
|
|
13553
|
-
[DRAG_ITEM_ATTRIBUTE]: ""
|
|
14044
|
+
[DRAG_ITEM_ATTRIBUTE]: "",
|
|
14045
|
+
[DRAG_ITEM_LIST_ATTRIBUTE]: ""
|
|
13554
14046
|
});
|
|
13555
14047
|
function InfiniteTableHeaderCellFn(props) {
|
|
13556
14048
|
const column = props.column;
|
|
@@ -13601,7 +14093,7 @@ function InfiniteTableHeaderCellFn(props) {
|
|
|
13601
14093
|
const { onResize, height: height2, width, headerOptions, columnsMap } = props;
|
|
13602
14094
|
const sortInfo = column.computedSortInfo;
|
|
13603
14095
|
const header = column.header;
|
|
13604
|
-
const ref =
|
|
14096
|
+
const ref = useCallback22(
|
|
13605
14097
|
(node) => {
|
|
13606
14098
|
domRef.current = node;
|
|
13607
14099
|
props.domRef?.(node);
|
|
@@ -13865,6 +14357,7 @@ function InfiniteTableHeaderCellFn(props) {
|
|
|
13865
14357
|
"data-field": `${column.field || ""}`,
|
|
13866
14358
|
"data-column-id": column.id,
|
|
13867
14359
|
[DRAG_ITEM_ATTRIBUTE]: column.id,
|
|
14360
|
+
[DRAG_ITEM_LIST_ATTRIBUTE]: "header",
|
|
13868
14361
|
"data-header-align": align2,
|
|
13869
14362
|
"data-name": "HeaderCell",
|
|
13870
14363
|
"data-sort": column.computedSortedAsc ? "asc" : column.computedSortedDesc ? "desc" : "none",
|
|
@@ -13886,7 +14379,7 @@ function InfiniteTableHeaderCellFn(props) {
|
|
|
13886
14379
|
}
|
|
13887
14380
|
) : /* @__PURE__ */ React51.createElement(InfiniteTableColumnHeaderFilterEmpty, null);
|
|
13888
14381
|
renderParam.renderBag.filterEditor = columnFilterEditor;
|
|
13889
|
-
const pointerDown =
|
|
14382
|
+
const pointerDown = useCallback22(
|
|
13890
14383
|
(e) => {
|
|
13891
14384
|
onPointerDown(e);
|
|
13892
14385
|
onDragItemPointerDown(e);
|
|
@@ -16958,7 +17451,7 @@ var Indexer = class {
|
|
|
16958
17451
|
};
|
|
16959
17452
|
|
|
16960
17453
|
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
16961
|
-
import { useEffect as useEffect19, useMemo as useMemo10, useRef as useRef24, useState as
|
|
17454
|
+
import { useEffect as useEffect19, useMemo as useMemo10, useRef as useRef24, useState as useState16 } from "react";
|
|
16962
17455
|
|
|
16963
17456
|
// src/components/hooks/useEffectWithChanges.ts
|
|
16964
17457
|
import { useEffect as useEffect18, useLayoutEffect as useLayoutEffect11, useRef as useRef23 } from "react";
|
|
@@ -20552,7 +21045,7 @@ function useLoadData(options) {
|
|
|
20552
21045
|
filterTypes,
|
|
20553
21046
|
cursorId: stateCursorId
|
|
20554
21047
|
} = dataSourceState;
|
|
20555
|
-
const [scrollbars, setScrollbars] =
|
|
21048
|
+
const [scrollbars, setScrollbars] = useState16({
|
|
20556
21049
|
vertical: false,
|
|
20557
21050
|
horizontal: false
|
|
20558
21051
|
});
|
|
@@ -21912,10 +22405,10 @@ function getDataSourceStateRestoreForDetails(state) {
|
|
|
21912
22405
|
|
|
21913
22406
|
// src/components/DataSource/privateHooks/useDataSource.tsx
|
|
21914
22407
|
import React54, {
|
|
21915
|
-
useCallback as
|
|
22408
|
+
useCallback as useCallback24,
|
|
21916
22409
|
useEffect as useEffect20,
|
|
21917
22410
|
useLayoutEffect as useLayoutEffect12,
|
|
21918
|
-
useState as
|
|
22411
|
+
useState as useState17
|
|
21919
22412
|
} from "react";
|
|
21920
22413
|
|
|
21921
22414
|
// src/components/DataSource/DataSourceStore.ts
|
|
@@ -21937,7 +22430,7 @@ function useDataSourceInternal(props) {
|
|
|
21937
22430
|
} = managedContextValue;
|
|
21938
22431
|
dataSourceState.getDataSourceMasterContextRef.current = getDataSourceMasterContext;
|
|
21939
22432
|
const getDataSourceState = useLatest(dataSourceState);
|
|
21940
|
-
const [dataSourceApi] =
|
|
22433
|
+
const [dataSourceApi] = useState17(
|
|
21941
22434
|
() => getDataSourceApi({
|
|
21942
22435
|
getState: getDataSourceState,
|
|
21943
22436
|
actions: dataSourceActions
|
|
@@ -21954,10 +22447,10 @@ function useDataSourceInternal(props) {
|
|
|
21954
22447
|
const getLatestManagedContextValue = useLatest(managedContextValue);
|
|
21955
22448
|
const getLatestContextValue = useLatest(contextValue);
|
|
21956
22449
|
const DataSourceContext = getDataSourceContext();
|
|
21957
|
-
const DataSource2 =
|
|
22450
|
+
const DataSource2 = useCallback24(
|
|
21958
22451
|
({ children }) => {
|
|
21959
22452
|
const DataSourceStoreContext = getDataSourceStoreContext();
|
|
21960
|
-
const [store] =
|
|
22453
|
+
const [store] = useState17(() => createDataSourceStore());
|
|
21961
22454
|
if (typeof children === "function") {
|
|
21962
22455
|
children = children(getDataSourceState());
|
|
21963
22456
|
}
|
|
@@ -23976,7 +24469,7 @@ function getImperativeApi(context) {
|
|
|
23976
24469
|
import {
|
|
23977
24470
|
useEffect as useEffect21,
|
|
23978
24471
|
useRef as useRef25,
|
|
23979
|
-
useState as
|
|
24472
|
+
useState as useState18
|
|
23980
24473
|
} from "react";
|
|
23981
24474
|
var OFFSET = 10;
|
|
23982
24475
|
function getColumnContentMaxWidths(domRef, options) {
|
|
@@ -24048,7 +24541,7 @@ function useAutoSizeColumns() {
|
|
|
24048
24541
|
componentActions,
|
|
24049
24542
|
componentState: { domRef, ready, autoSizeColumnsKey, brain }
|
|
24050
24543
|
} = useManagedComponentState();
|
|
24051
|
-
const [refreshId, setRefreshId] =
|
|
24544
|
+
const [refreshId, setRefreshId] = useState18(0);
|
|
24052
24545
|
const theKey = typeof autoSizeColumnsKey === "object" ? autoSizeColumnsKey.key : autoSizeColumnsKey;
|
|
24053
24546
|
const getTheKey = useLatest(theKey);
|
|
24054
24547
|
const lastExecutedIdentifierRef = useRef25(null);
|
|
@@ -24110,7 +24603,7 @@ function useAutoSizeColumns() {
|
|
|
24110
24603
|
}
|
|
24111
24604
|
|
|
24112
24605
|
// src/components/InfiniteTable/hooks/useComputed.ts
|
|
24113
|
-
import { useEffect as useEffect24, useMemo as useMemo15, useState as
|
|
24606
|
+
import { useEffect as useEffect24, useMemo as useMemo15, useState as useState20 } from "react";
|
|
24114
24607
|
|
|
24115
24608
|
// src/components/InfiniteTable/utils/MultiCellSelector.ts
|
|
24116
24609
|
var MultiCellSelector = class {
|
|
@@ -24370,10 +24863,10 @@ function useColumnRowspan(computedVisibleColumns) {
|
|
|
24370
24863
|
}
|
|
24371
24864
|
|
|
24372
24865
|
// src/components/InfiniteTable/hooks/useColumnSizeFn.ts
|
|
24373
|
-
import { useCallback as
|
|
24866
|
+
import { useCallback as useCallback25 } from "react";
|
|
24374
24867
|
var debug3 = dbg("useColumnSizeFn");
|
|
24375
24868
|
function useColumnSizeFn(columns) {
|
|
24376
|
-
const columnSize =
|
|
24869
|
+
const columnSize = useCallback25(
|
|
24377
24870
|
(index) => {
|
|
24378
24871
|
const column = columns[index];
|
|
24379
24872
|
if (false) {
|
|
@@ -25209,7 +25702,7 @@ function getColumnVisibilityForHideEmptyGroupColumns(params) {
|
|
|
25209
25702
|
}
|
|
25210
25703
|
|
|
25211
25704
|
// src/components/InfiniteTable/hooks/useToggleGroupRow.ts
|
|
25212
|
-
import { useCallback as
|
|
25705
|
+
import { useCallback as useCallback26 } from "react";
|
|
25213
25706
|
function useToggleGroupRow() {
|
|
25214
25707
|
const { getDataSourceState, dataSourceActions, getDataSourceMasterContext } = useDataSourceSelector((ctx) => {
|
|
25215
25708
|
return {
|
|
@@ -25218,7 +25711,7 @@ function useToggleGroupRow() {
|
|
|
25218
25711
|
getDataSourceMasterContext: ctx.getDataSourceMasterContext
|
|
25219
25712
|
};
|
|
25220
25713
|
});
|
|
25221
|
-
const toggleGroupRow =
|
|
25714
|
+
const toggleGroupRow = useCallback26((groupKeys) => {
|
|
25222
25715
|
const state = getDataSourceState();
|
|
25223
25716
|
const newState = new GroupRowsState(state.groupRowsState);
|
|
25224
25717
|
newState.toggleGroupRow(groupKeys);
|
|
@@ -25920,7 +26413,7 @@ function useComputedRowHeight(param) {
|
|
|
25920
26413
|
}
|
|
25921
26414
|
|
|
25922
26415
|
// src/components/InfiniteTable/hooks/useScrollbars.ts
|
|
25923
|
-
import { useState as
|
|
26416
|
+
import { useState as useState19, useEffect as useEffect23, useLayoutEffect as useLayoutEffect14 } from "react";
|
|
25924
26417
|
var INITIAL_SCROLLBARS = {
|
|
25925
26418
|
vertical: false,
|
|
25926
26419
|
horizontal: false
|
|
@@ -25928,7 +26421,7 @@ var INITIAL_SCROLLBARS = {
|
|
|
25928
26421
|
function useScrollbars(getState) {
|
|
25929
26422
|
const brain = getState().brain;
|
|
25930
26423
|
const { getDataSourceState } = useDataSourceStableContext();
|
|
25931
|
-
const [scrollbars, setScrollbars] =
|
|
26424
|
+
const [scrollbars, setScrollbars] = useState19(INITIAL_SCROLLBARS);
|
|
25932
26425
|
useEffect23(() => {
|
|
25933
26426
|
return brain.onRenderCountChange(() => {
|
|
25934
26427
|
const { scrollTopMax, scrollLeftMax } = brain;
|
|
@@ -26016,7 +26509,7 @@ function useComputed(options) {
|
|
|
26016
26509
|
groupBy: ctx.dataSourceState.groupBy
|
|
26017
26510
|
};
|
|
26018
26511
|
});
|
|
26019
|
-
|
|
26512
|
+
useState20(() => {
|
|
26020
26513
|
onRowHeightCSSVarChange.onChange((rowHeight2) => {
|
|
26021
26514
|
if (rowHeight2) {
|
|
26022
26515
|
componentActions.rowHeight = rowHeight2;
|
|
@@ -26108,7 +26601,7 @@ function useComputed(options) {
|
|
|
26108
26601
|
const scrollbars = useScrollbars(getState);
|
|
26109
26602
|
const computedPinnedStartOverflow = computedPinnedStartWidth ? computedPinnedStartColumnsWidth > computedPinnedStartWidth : false;
|
|
26110
26603
|
const computedPinnedEndOverflow = computedPinnedEndWidth ? computedPinnedEndColumnsWidth > computedPinnedEndWidth : false;
|
|
26111
|
-
const [multiRowSelector] =
|
|
26604
|
+
const [multiRowSelector] = useState20(() => {
|
|
26112
26605
|
const multiRowSelector2 = new MultiRowSelector({
|
|
26113
26606
|
isRowDisabledAt: (index) => {
|
|
26114
26607
|
const dataItem = getDataSourceState().dataArray[index];
|
|
@@ -26122,7 +26615,7 @@ function useComputed(options) {
|
|
|
26122
26615
|
return multiRowSelector2;
|
|
26123
26616
|
});
|
|
26124
26617
|
const getComputedVisibleColumns = useLatest(computedVisibleColumns);
|
|
26125
|
-
const [multiCellSelector] =
|
|
26618
|
+
const [multiCellSelector] = useState20(() => {
|
|
26126
26619
|
return new MultiCellSelector({
|
|
26127
26620
|
getPrimaryKeyByIndex: dataSourceApi.getPrimaryKeyByIndex,
|
|
26128
26621
|
getColumnIdByIndex: (colIndex) => {
|
|
@@ -26380,7 +26873,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
26380
26873
|
}
|
|
26381
26874
|
let valid2 = isValidLicense(licenseKey, {
|
|
26382
26875
|
publishedAt: 1624970570587,
|
|
26383
|
-
version: "8.0.
|
|
26876
|
+
version: "8.0.3"
|
|
26384
26877
|
});
|
|
26385
26878
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
26386
26879
|
return true;
|
|
@@ -26475,7 +26968,7 @@ function createInfiniteTableStore() {
|
|
|
26475
26968
|
var toCSSVarName = (value) => `--infinite-${value}`;
|
|
26476
26969
|
|
|
26477
26970
|
// src/components/InfiniteTable/eventHandlers/index.ts
|
|
26478
|
-
import { useCallback as
|
|
26971
|
+
import { useCallback as useCallback27, useMemo as useMemo17, useEffect as useEffect27 } from "react";
|
|
26479
26972
|
|
|
26480
26973
|
// src/components/InfiniteTable/eventHandlers/onCellClick.ts
|
|
26481
26974
|
function onCellClick(context, event) {
|
|
@@ -27229,7 +27722,7 @@ function subscribeToDOMEvents() {
|
|
|
27229
27722
|
getState: ctx.getState
|
|
27230
27723
|
};
|
|
27231
27724
|
});
|
|
27232
|
-
const onKeyDown2 =
|
|
27725
|
+
const onKeyDown2 = useCallback27((event) => {
|
|
27233
27726
|
getState().keyDown(event);
|
|
27234
27727
|
}, []);
|
|
27235
27728
|
return { onKeyDown: onKeyDown2 };
|
|
@@ -27245,10 +27738,10 @@ import { useEffect as useEffect31 } from "react";
|
|
|
27245
27738
|
// src/components/hooks/useOverlay/index.tsx
|
|
27246
27739
|
import * as React57 from "react";
|
|
27247
27740
|
import {
|
|
27248
|
-
useCallback as
|
|
27741
|
+
useCallback as useCallback28,
|
|
27249
27742
|
useEffect as useEffect29,
|
|
27250
27743
|
useLayoutEffect as useLayoutEffect15,
|
|
27251
|
-
useState as
|
|
27744
|
+
useState as useState21
|
|
27252
27745
|
} from "react";
|
|
27253
27746
|
import { createPortal as createPortal2 } from "react-dom";
|
|
27254
27747
|
|
|
@@ -27440,7 +27933,7 @@ function OverlayContent(props) {
|
|
|
27440
27933
|
"div",
|
|
27441
27934
|
{
|
|
27442
27935
|
style: { position: "absolute", top: 0, left: 0 },
|
|
27443
|
-
ref:
|
|
27936
|
+
ref: useCallback28((node) => {
|
|
27444
27937
|
if (node) {
|
|
27445
27938
|
alignNode(node, props);
|
|
27446
27939
|
}
|
|
@@ -27489,7 +27982,7 @@ async function alignNode(node, params) {
|
|
|
27489
27982
|
}
|
|
27490
27983
|
}
|
|
27491
27984
|
function useOverlayPortal(content, portalContainer) {
|
|
27492
|
-
const [container, setContainer] =
|
|
27985
|
+
const [container, setContainer] = useState21(null);
|
|
27493
27986
|
useLayoutEffect15(() => {
|
|
27494
27987
|
async function getContainer() {
|
|
27495
27988
|
const container2 = portalContainer ? await retrieveElement(portalContainer) : null;
|
|
@@ -27534,10 +28027,10 @@ function injectPortalContainerAndConstrainInMenuChild(children, portalContainer,
|
|
|
27534
28027
|
}
|
|
27535
28028
|
function useOverlay(params) {
|
|
27536
28029
|
const rootParams = params;
|
|
27537
|
-
const [handles] =
|
|
27538
|
-
const [handleToRealign, setHandleToRealign] =
|
|
27539
|
-
const [realignTimestamp, setRealignTimestamp] =
|
|
27540
|
-
const getContentForPortal =
|
|
28030
|
+
const [handles] = useState21(() => /* @__PURE__ */ new Map());
|
|
28031
|
+
const [handleToRealign, setHandleToRealign] = useState21(null);
|
|
28032
|
+
const [realignTimestamp, setRealignTimestamp] = useState21(0);
|
|
28033
|
+
const getContentForPortal = useCallback28(() => {
|
|
27541
28034
|
const contentForPortal = [];
|
|
27542
28035
|
for (const [_2, handle] of handles) {
|
|
27543
28036
|
contentForPortal.push(
|
|
@@ -27551,7 +28044,7 @@ function useOverlay(params) {
|
|
|
27551
28044
|
getContentForPortal(),
|
|
27552
28045
|
params.portalContainer
|
|
27553
28046
|
);
|
|
27554
|
-
const showOverlay =
|
|
28047
|
+
const showOverlay = useCallback28(
|
|
27555
28048
|
(content, params2) => {
|
|
27556
28049
|
const id = params2.id || getIdForReactOnlyChild(content) || getChangeDetect();
|
|
27557
28050
|
const key = `${id}`;
|
|
@@ -27793,10 +28286,10 @@ var deriveStateFromProps2 = (params) => {
|
|
|
27793
28286
|
// src/components/Menu/Menu.tsx
|
|
27794
28287
|
import * as React60 from "react";
|
|
27795
28288
|
import {
|
|
27796
|
-
useCallback as
|
|
28289
|
+
useCallback as useCallback30,
|
|
27797
28290
|
useLayoutEffect as useLayoutEffect16,
|
|
27798
28291
|
useRef as useRef30,
|
|
27799
|
-
useState as
|
|
28292
|
+
useState as useState23
|
|
27800
28293
|
} from "react";
|
|
27801
28294
|
|
|
27802
28295
|
// src/utils/pageGeometry/Triangle.ts
|
|
@@ -28024,7 +28517,7 @@ function useMenuContext() {
|
|
|
28024
28517
|
}
|
|
28025
28518
|
|
|
28026
28519
|
// src/components/hooks/useMounted.ts
|
|
28027
|
-
import { useCallback as
|
|
28520
|
+
import { useCallback as useCallback29, useEffect as useEffect30, useRef as useRef29 } from "react";
|
|
28028
28521
|
function useMounted() {
|
|
28029
28522
|
let mountedRef = useRef29(true);
|
|
28030
28523
|
useEffect30(() => {
|
|
@@ -28033,7 +28526,7 @@ function useMounted() {
|
|
|
28033
28526
|
mountedRef.current = false;
|
|
28034
28527
|
};
|
|
28035
28528
|
}, []);
|
|
28036
|
-
const isMounted =
|
|
28529
|
+
const isMounted = useCallback29(() => mountedRef.current, []);
|
|
28037
28530
|
return isMounted;
|
|
28038
28531
|
}
|
|
28039
28532
|
|
|
@@ -28126,7 +28619,7 @@ function useSubmenus({
|
|
|
28126
28619
|
onItemActivate
|
|
28127
28620
|
}) {
|
|
28128
28621
|
const { getState } = useMenuContext();
|
|
28129
|
-
const [{ onItemEnter, onItemLeave }] =
|
|
28622
|
+
const [{ onItemEnter, onItemLeave }] = useState23(() => {
|
|
28130
28623
|
return new MenuTriangleContext({
|
|
28131
28624
|
parentMenuId: getState().parentMenuId,
|
|
28132
28625
|
onItemActivate: (itemKey) => {
|
|
@@ -28157,8 +28650,8 @@ function useSubmenus({
|
|
|
28157
28650
|
}).getHandlers();
|
|
28158
28651
|
});
|
|
28159
28652
|
return {
|
|
28160
|
-
onItemEnter:
|
|
28161
|
-
onItemLeave:
|
|
28653
|
+
onItemEnter: useCallback30(onItemEnter, []),
|
|
28654
|
+
onItemLeave: useCallback30(onItemLeave, [])
|
|
28162
28655
|
};
|
|
28163
28656
|
}
|
|
28164
28657
|
function MenuComponent(props) {
|
|
@@ -28183,14 +28676,14 @@ function MenuComponent(props) {
|
|
|
28183
28676
|
componentActions,
|
|
28184
28677
|
getState
|
|
28185
28678
|
} = useMenuContext();
|
|
28186
|
-
const setKeyboardActiveItemKey =
|
|
28679
|
+
const setKeyboardActiveItemKey = useCallback30((key) => {
|
|
28187
28680
|
componentActions.keyboardActiveItemKey = key;
|
|
28188
28681
|
}, []);
|
|
28189
|
-
const setActiveItemKey =
|
|
28682
|
+
const setActiveItemKey = useCallback30((key) => {
|
|
28190
28683
|
componentActions.activeItemKey = key;
|
|
28191
28684
|
}, []);
|
|
28192
28685
|
const isMounted = useMounted();
|
|
28193
|
-
const [submenuApi, setSubmenuApi] =
|
|
28686
|
+
const [submenuApi, setSubmenuApi] = useState23(null);
|
|
28194
28687
|
let renderedChildren = null;
|
|
28195
28688
|
useLayoutEffect16(() => {
|
|
28196
28689
|
const { runtimeItems: runtimeItems2 } = getState();
|
|
@@ -28402,7 +28895,7 @@ function MenuComponent(props) {
|
|
|
28402
28895
|
function onMenuBlur() {
|
|
28403
28896
|
componentActions.focused = false;
|
|
28404
28897
|
}
|
|
28405
|
-
const onMenuFocus =
|
|
28898
|
+
const onMenuFocus = useCallback30(function() {
|
|
28406
28899
|
componentActions.focused = true;
|
|
28407
28900
|
setTimeout(() => {
|
|
28408
28901
|
if (shouldSelectFirstItemOnFocus.current && domRef.current && domRef.current === document.activeElement && getState().keyboardActiveItemKey == null) {
|
|
@@ -28413,11 +28906,11 @@ function MenuComponent(props) {
|
|
|
28413
28906
|
});
|
|
28414
28907
|
}, []);
|
|
28415
28908
|
const shouldSelectFirstItemOnFocus = useRef30(true);
|
|
28416
|
-
const hideAll =
|
|
28909
|
+
const hideAll = useCallback30(() => {
|
|
28417
28910
|
const state = getState();
|
|
28418
28911
|
state.onHideIntent?.(state);
|
|
28419
28912
|
}, [getState]);
|
|
28420
|
-
const [api] =
|
|
28913
|
+
const [api] = useState23(() => {
|
|
28421
28914
|
const result2 = {
|
|
28422
28915
|
hideMenu: hideAll,
|
|
28423
28916
|
focus: () => {
|
|
@@ -28436,7 +28929,7 @@ function MenuComponent(props) {
|
|
|
28436
28929
|
};
|
|
28437
28930
|
return result2;
|
|
28438
28931
|
});
|
|
28439
|
-
const refCallback =
|
|
28932
|
+
const refCallback = useCallback30((node) => {
|
|
28440
28933
|
if (node) {
|
|
28441
28934
|
domRef.current = node;
|
|
28442
28935
|
onShow?.(getState(), api);
|
|
@@ -28942,7 +29435,7 @@ function useColumnMenu() {
|
|
|
28942
29435
|
|
|
28943
29436
|
// src/components/InfiniteTable/components/FocusDetect.tsx
|
|
28944
29437
|
import * as React64 from "react";
|
|
28945
|
-
import { useCallback as
|
|
29438
|
+
import { useCallback as useCallback31 } from "react";
|
|
28946
29439
|
var style = {
|
|
28947
29440
|
width: 0,
|
|
28948
29441
|
height: 0,
|
|
@@ -28962,7 +29455,7 @@ function FocusDetect() {
|
|
|
28962
29455
|
} = useInfiniteTableStableContext();
|
|
28963
29456
|
const { getDataSourceState, getDataSourceMasterContext } = useDataSourceStableContext();
|
|
28964
29457
|
const { focusDetectDOMRef } = getState();
|
|
28965
|
-
const onFocus =
|
|
29458
|
+
const onFocus = useCallback31(async () => {
|
|
28966
29459
|
const context = {
|
|
28967
29460
|
getDataSourceState,
|
|
28968
29461
|
getDataSourceMasterContext,
|
|
@@ -29673,14 +30166,14 @@ import { useRef as useRef31 } from "react";
|
|
|
29673
30166
|
import * as React70 from "react";
|
|
29674
30167
|
|
|
29675
30168
|
// src/components/InfiniteTable/hooks/useGridScroll.ts
|
|
29676
|
-
import { useCallback as
|
|
30169
|
+
import { useCallback as useCallback32, useEffect as useEffect35 } from "react";
|
|
29677
30170
|
function useGridScroll(onScroll, deps) {
|
|
29678
30171
|
const { brain } = useInfiniteTableSelector((ctx) => {
|
|
29679
30172
|
return {
|
|
29680
30173
|
brain: ctx.state.brain
|
|
29681
30174
|
};
|
|
29682
30175
|
});
|
|
29683
|
-
const memoizedOnScroll =
|
|
30176
|
+
const memoizedOnScroll = useCallback32(onScroll, deps);
|
|
29684
30177
|
useEffect35(() => {
|
|
29685
30178
|
const removeOnScroll = brain.onScroll(memoizedOnScroll);
|
|
29686
30179
|
return removeOnScroll;
|
|
@@ -30267,7 +30760,7 @@ function useInfinitePortalContainer() {
|
|
|
30267
30760
|
|
|
30268
30761
|
// src/components/InfiniteTable/components/GroupingToolbar/index.tsx
|
|
30269
30762
|
import * as React72 from "react";
|
|
30270
|
-
import { useCallback as
|
|
30763
|
+
import { useCallback as useCallback33 } from "react";
|
|
30271
30764
|
|
|
30272
30765
|
// src/components/InfiniteTable/components/GroupingToolbar/index.css.ts
|
|
30273
30766
|
var GroupingToolbarItemClearCls = "hs68h8j _16lm1iwk _16lm1iwx _16lm1iw2n";
|
|
@@ -30453,7 +30946,7 @@ function GroupingToolbar(props) {
|
|
|
30453
30946
|
});
|
|
30454
30947
|
dataSourceApi.setGroupBy(newGroupBy);
|
|
30455
30948
|
};
|
|
30456
|
-
const shouldAcceptDrop =
|
|
30949
|
+
const shouldAcceptDrop = useCallback33(
|
|
30457
30950
|
(event) => {
|
|
30458
30951
|
const { computedColumnsMap: computedColumnsMap2 } = getComputed();
|
|
30459
30952
|
const columnId = event.dragItem.id;
|
|
@@ -30477,6 +30970,7 @@ function GroupingToolbar(props) {
|
|
|
30477
30970
|
dragListId: GROUPING_TOOLBAR_DRAG_LIST_ID,
|
|
30478
30971
|
acceptDropsFrom: ["header", GROUPING_TOOLBAR_DRAG_LIST_ID],
|
|
30479
30972
|
onDrop,
|
|
30973
|
+
dragStrategy: "inline",
|
|
30480
30974
|
onAcceptDrop,
|
|
30481
30975
|
shouldAcceptDrop
|
|
30482
30976
|
},
|
|
@@ -30515,7 +31009,7 @@ import * as React77 from "react";
|
|
|
30515
31009
|
|
|
30516
31010
|
// src/components/InfiniteTable/hooks/useCellRendering.tsx
|
|
30517
31011
|
import { useMemo as useMemo19 } from "react";
|
|
30518
|
-
import { useCallback as
|
|
31012
|
+
import { useCallback as useCallback34, useEffect as useEffect38, useRef as useRef34 } from "react";
|
|
30519
31013
|
import * as React74 from "react";
|
|
30520
31014
|
|
|
30521
31015
|
// src/components/InfiniteTable/hooks/useYourBrain.ts
|
|
@@ -30912,7 +31406,7 @@ function useCellRendering(param) {
|
|
|
30912
31406
|
cellSelection
|
|
30913
31407
|
};
|
|
30914
31408
|
}, [isNodeReadOnly2, selectionMode, cellSelection]);
|
|
30915
|
-
const renderCell =
|
|
31409
|
+
const renderCell = useCallback34(
|
|
30916
31410
|
(params) => {
|
|
30917
31411
|
const {
|
|
30918
31412
|
rowIndex,
|
|
@@ -32353,6 +32847,7 @@ var components = {
|
|
|
32353
32847
|
NumberFilterEditor
|
|
32354
32848
|
};
|
|
32355
32849
|
export {
|
|
32850
|
+
AutoScroller,
|
|
32356
32851
|
CellSelectionState,
|
|
32357
32852
|
DRAG_ITEM_ATTRIBUTE,
|
|
32358
32853
|
DataClient,
|
|
@@ -32381,9 +32876,11 @@ export {
|
|
|
32381
32876
|
WeakFixedSizeSet,
|
|
32382
32877
|
alignNode,
|
|
32383
32878
|
components,
|
|
32879
|
+
createDefaultProxy,
|
|
32384
32880
|
createFlashingColumnCellComponent,
|
|
32385
32881
|
debounce,
|
|
32386
32882
|
debug,
|
|
32883
|
+
defaultDragProxyMove,
|
|
32387
32884
|
defaultFilterTypes2 as defaultFilterTypes,
|
|
32388
32885
|
eventMatchesKeyboardShortcut,
|
|
32389
32886
|
filterDataArray,
|