@infinite-table/infinite-react 8.0.1 → 8.0.2
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 +126 -1
- package/index.dev.js +540 -55
- package/index.dev.mjs +604 -122
- 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,
|
|
@@ -8282,15 +8514,34 @@ function getDraggableItems(domRef) {
|
|
|
8282
8514
|
}
|
|
8283
8515
|
function getInteractionTargetData(params) {
|
|
8284
8516
|
const { domRef, orientation, dragListId } = params;
|
|
8285
|
-
const
|
|
8517
|
+
const draggableItems = getDraggableItems(domRef);
|
|
8518
|
+
const domRect = domRef.current.getBoundingClientRect();
|
|
8519
|
+
let top2 = domRect.top;
|
|
8520
|
+
let left2 = domRect.left;
|
|
8521
|
+
let bottom = domRect.bottom;
|
|
8522
|
+
let right = domRect.right;
|
|
8523
|
+
for (const item of draggableItems) {
|
|
8524
|
+
const r = item.rect;
|
|
8525
|
+
if (r.top < top2) top2 = r.top;
|
|
8526
|
+
if (r.left < left2) left2 = r.left;
|
|
8527
|
+
if (r.bottom > bottom) bottom = r.bottom;
|
|
8528
|
+
if (r.right > right) right = r.right;
|
|
8529
|
+
}
|
|
8530
|
+
const listRectangle = Rectangle.from({
|
|
8531
|
+
top: top2,
|
|
8532
|
+
left: left2,
|
|
8533
|
+
width: right - left2,
|
|
8534
|
+
height: bottom - top2
|
|
8535
|
+
});
|
|
8286
8536
|
const options = {
|
|
8287
|
-
draggableItems
|
|
8537
|
+
draggableItems,
|
|
8288
8538
|
orientation,
|
|
8289
8539
|
listId: dragListId,
|
|
8290
8540
|
listRectangle,
|
|
8291
8541
|
acceptDropsFrom: params.acceptDropsFrom,
|
|
8292
8542
|
shouldAcceptDrop: params.shouldAcceptDrop,
|
|
8293
|
-
initial: params.initial
|
|
8543
|
+
initial: params.initial,
|
|
8544
|
+
preserveDragSpace: params.preserveDragSpace
|
|
8294
8545
|
};
|
|
8295
8546
|
return options;
|
|
8296
8547
|
}
|
|
@@ -8301,7 +8552,7 @@ function createInteractionTarget(params) {
|
|
|
8301
8552
|
function useInteractionTarget(domRef, props) {
|
|
8302
8553
|
const getProps = useLatest(props);
|
|
8303
8554
|
const [interactionTarget, doSetInteractionTarget] = React33.useState(null);
|
|
8304
|
-
const setInteractionTarget =
|
|
8555
|
+
const setInteractionTarget = useCallback17(
|
|
8305
8556
|
(interactionTarget2) => {
|
|
8306
8557
|
if (interactionTarget2) {
|
|
8307
8558
|
DragManager.registerDragInteractionTarget(interactionTarget2);
|
|
@@ -8348,8 +8599,49 @@ function useInteractionTarget(domRef, props) {
|
|
|
8348
8599
|
getInteractionTarget
|
|
8349
8600
|
};
|
|
8350
8601
|
}
|
|
8602
|
+
function createDefaultProxy(dragItemNode, initialRect) {
|
|
8603
|
+
const proxy = dragItemNode.cloneNode(true);
|
|
8604
|
+
proxy.removeAttribute(DRAG_ITEM_ATTRIBUTE);
|
|
8605
|
+
proxy.style.position = "fixed";
|
|
8606
|
+
proxy.style.top = `${initialRect.top}px`;
|
|
8607
|
+
proxy.style.left = `${initialRect.left}px`;
|
|
8608
|
+
proxy.style.width = `${initialRect.width}px`;
|
|
8609
|
+
proxy.style.height = `${initialRect.height}px`;
|
|
8610
|
+
proxy.style.zIndex = "999999";
|
|
8611
|
+
proxy.style.pointerEvents = "none";
|
|
8612
|
+
proxy.style.margin = "0";
|
|
8613
|
+
proxy.style.boxSizing = "border-box";
|
|
8614
|
+
proxy.style.transform = "none";
|
|
8615
|
+
document.body.appendChild(proxy);
|
|
8616
|
+
return proxy;
|
|
8617
|
+
}
|
|
8618
|
+
function defaultDragProxyMove({
|
|
8619
|
+
proxyElement,
|
|
8620
|
+
dx,
|
|
8621
|
+
dy
|
|
8622
|
+
}) {
|
|
8623
|
+
proxyElement.style.transform = `translate3d(${dx}px, ${dy}px, 0)`;
|
|
8624
|
+
}
|
|
8625
|
+
function cleanupProxy(proxyStateRef) {
|
|
8626
|
+
const state = proxyStateRef.current;
|
|
8627
|
+
if (!state) return;
|
|
8628
|
+
if (state.cleanup) {
|
|
8629
|
+
state.cleanup({ proxyElement: state.proxyElement });
|
|
8630
|
+
} else {
|
|
8631
|
+
state.proxyElement.remove();
|
|
8632
|
+
}
|
|
8633
|
+
state.originalNode.style.visibility = "";
|
|
8634
|
+
proxyStateRef.current = null;
|
|
8635
|
+
}
|
|
8351
8636
|
var DragList = (props) => {
|
|
8352
8637
|
const domRef = React33.useRef(null);
|
|
8638
|
+
const proxyStateRef = React33.useRef(null);
|
|
8639
|
+
const [dragProxyRenderState, setDragProxyRenderState] = useState12(null);
|
|
8640
|
+
const sourceScrollOffsetRef = React33.useRef({ top: 0, left: 0 });
|
|
8641
|
+
const proxyPortalNodeRef = React33.useRef(null);
|
|
8642
|
+
const proxyRefCallback = React33.useCallback((node) => {
|
|
8643
|
+
proxyPortalNodeRef.current = node;
|
|
8644
|
+
}, []);
|
|
8353
8645
|
const { dropTargetListId, dragSourceListId } = useDragDropProvider();
|
|
8354
8646
|
const { updateDragOperationSourceAndTarget, dragItemId, status } = useDragDropProvider();
|
|
8355
8647
|
const getOnDrop = useLatest(props.onDrop);
|
|
@@ -8390,18 +8682,29 @@ var DragList = (props) => {
|
|
|
8390
8682
|
);
|
|
8391
8683
|
const removeOnDragMove = interactionTarget.on(
|
|
8392
8684
|
"move",
|
|
8393
|
-
({ offsetsForItems, items, status: status2 }) => {
|
|
8685
|
+
({ offsetsForItems, items, status: status2, dragItem }) => {
|
|
8394
8686
|
if (status2 === "rejected") {
|
|
8395
8687
|
return;
|
|
8396
8688
|
}
|
|
8397
8689
|
const dragItems = getDragItems();
|
|
8398
8690
|
const updatePosition = getUpdatePosition();
|
|
8691
|
+
const proxyState = proxyStateRef.current;
|
|
8399
8692
|
items.forEach((item, index) => {
|
|
8400
|
-
|
|
8693
|
+
let offset = offsetsForItems[index];
|
|
8401
8694
|
const node = dragItems[index];
|
|
8402
8695
|
if (!node) {
|
|
8403
8696
|
return;
|
|
8404
8697
|
}
|
|
8698
|
+
if (proxyState && item.id === proxyState.dragItemId) {
|
|
8699
|
+
return;
|
|
8700
|
+
}
|
|
8701
|
+
if (!proxyState && item.id === dragItem.id) {
|
|
8702
|
+
const scrollOffset = sourceScrollOffsetRef.current;
|
|
8703
|
+
offset = {
|
|
8704
|
+
left: offset.left + scrollOffset.left,
|
|
8705
|
+
top: offset.top + scrollOffset.top
|
|
8706
|
+
};
|
|
8707
|
+
}
|
|
8405
8708
|
updatePosition({
|
|
8406
8709
|
id: item.id,
|
|
8407
8710
|
node,
|
|
@@ -8439,6 +8742,12 @@ var DragList = (props) => {
|
|
|
8439
8742
|
offset: null
|
|
8440
8743
|
});
|
|
8441
8744
|
});
|
|
8745
|
+
cleanupProxy(proxyStateRef);
|
|
8746
|
+
setDragProxyRenderState((prev) => {
|
|
8747
|
+
if (!prev) return prev;
|
|
8748
|
+
requestAnimationFrame(() => setDragProxyRenderState(null));
|
|
8749
|
+
return { ...prev, dragItemId: null };
|
|
8750
|
+
});
|
|
8442
8751
|
const accepted = status2 === "accepted";
|
|
8443
8752
|
if (dragListId === dropTargetListId2 && dragSourceListId2 !== dragListId) {
|
|
8444
8753
|
if (onAcceptDrop && accepted) {
|
|
@@ -8468,16 +8777,64 @@ var DragList = (props) => {
|
|
|
8468
8777
|
});
|
|
8469
8778
|
}
|
|
8470
8779
|
});
|
|
8780
|
+
let targetAutoScroller = null;
|
|
8781
|
+
let targetScrollContainer = null;
|
|
8782
|
+
let targetScrollHandler = null;
|
|
8783
|
+
let targetPointermoveHandler = null;
|
|
8784
|
+
if (!interactionTarget.getData().initial && domRef.current) {
|
|
8785
|
+
targetAutoScroller = new AutoScroller({
|
|
8786
|
+
orientation: props.orientation,
|
|
8787
|
+
onScroll: () => {
|
|
8788
|
+
}
|
|
8789
|
+
});
|
|
8790
|
+
targetAutoScroller.start(domRef.current);
|
|
8791
|
+
targetScrollContainer = targetAutoScroller.getScrollContainer();
|
|
8792
|
+
if (targetScrollContainer) {
|
|
8793
|
+
let lastScroll = props.orientation === "vertical" ? targetScrollContainer.scrollTop : targetScrollContainer.scrollLeft;
|
|
8794
|
+
targetScrollHandler = () => {
|
|
8795
|
+
const current = props.orientation === "vertical" ? targetScrollContainer.scrollTop : targetScrollContainer.scrollLeft;
|
|
8796
|
+
const delta = current - lastScroll;
|
|
8797
|
+
lastScroll = current;
|
|
8798
|
+
if (delta !== 0) {
|
|
8799
|
+
interactionTarget.adjustForScroll(delta);
|
|
8800
|
+
DragManager.retriggerMove();
|
|
8801
|
+
}
|
|
8802
|
+
};
|
|
8803
|
+
targetScrollContainer.addEventListener("scroll", targetScrollHandler);
|
|
8804
|
+
}
|
|
8805
|
+
targetPointermoveHandler = (e) => {
|
|
8806
|
+
targetAutoScroller.updatePointer({
|
|
8807
|
+
left: e.clientX,
|
|
8808
|
+
top: e.clientY
|
|
8809
|
+
});
|
|
8810
|
+
};
|
|
8811
|
+
getGlobal().addEventListener("pointermove", targetPointermoveHandler);
|
|
8812
|
+
}
|
|
8471
8813
|
return () => {
|
|
8472
8814
|
removeOnDragStart();
|
|
8473
8815
|
removeOnDragMove();
|
|
8474
8816
|
removeOnDragDrop();
|
|
8817
|
+
if (targetAutoScroller) {
|
|
8818
|
+
targetAutoScroller.stop();
|
|
8819
|
+
}
|
|
8820
|
+
if (targetScrollContainer && targetScrollHandler) {
|
|
8821
|
+
targetScrollContainer.removeEventListener(
|
|
8822
|
+
"scroll",
|
|
8823
|
+
targetScrollHandler
|
|
8824
|
+
);
|
|
8825
|
+
}
|
|
8826
|
+
if (targetPointermoveHandler) {
|
|
8827
|
+
getGlobal().removeEventListener(
|
|
8828
|
+
"pointermove",
|
|
8829
|
+
targetPointermoveHandler
|
|
8830
|
+
);
|
|
8831
|
+
}
|
|
8475
8832
|
};
|
|
8476
8833
|
}
|
|
8477
8834
|
return void 0;
|
|
8478
8835
|
}, [interactionTarget, props.dragListId]);
|
|
8479
8836
|
const dragItemsRef = React33.useRef([]);
|
|
8480
|
-
const getDragItems =
|
|
8837
|
+
const getDragItems = useCallback17(() => {
|
|
8481
8838
|
let dragItems = dragItemsRef.current;
|
|
8482
8839
|
if (!dragItems || dragItems.length === 0) {
|
|
8483
8840
|
dragItems = Array.from(
|
|
@@ -8487,7 +8844,7 @@ var DragList = (props) => {
|
|
|
8487
8844
|
}
|
|
8488
8845
|
return dragItems;
|
|
8489
8846
|
}, []);
|
|
8490
|
-
const onDragItemPointerDown =
|
|
8847
|
+
const onDragItemPointerDown = useCallback17(
|
|
8491
8848
|
(e) => {
|
|
8492
8849
|
const target = e.currentTarget;
|
|
8493
8850
|
let dragItemId2 = target.getAttribute(DRAG_ITEM_ATTRIBUTE);
|
|
@@ -8516,19 +8873,63 @@ var DragList = (props) => {
|
|
|
8516
8873
|
orientation: props.orientation,
|
|
8517
8874
|
dragListId: props.dragListId,
|
|
8518
8875
|
acceptDropsFrom: props.acceptDropsFrom,
|
|
8519
|
-
initial: true
|
|
8876
|
+
initial: true,
|
|
8877
|
+
preserveDragSpace: props.preserveDragSpace
|
|
8520
8878
|
});
|
|
8521
8879
|
const draggableItems = interactionTarget2.getData().draggableItems;
|
|
8522
8880
|
const dragIndex = draggableItems.findIndex(
|
|
8523
8881
|
(item) => item.id === dragItemId2
|
|
8524
8882
|
);
|
|
8525
8883
|
const dragItem = draggableItems[dragIndex];
|
|
8884
|
+
const dragItemNode = dragItems[dragIndex].getAttribute(DRAG_ITEM_ATTRIBUTE) === `${dragItemId2}` ? dragItems[dragIndex] : dragItems.find(
|
|
8885
|
+
(node) => node.getAttribute(DRAG_ITEM_ATTRIBUTE) === `${dragItemId2}`
|
|
8886
|
+
);
|
|
8526
8887
|
setInteractionTarget(interactionTarget2);
|
|
8527
8888
|
const initialCoords = {
|
|
8528
8889
|
left: e.clientX,
|
|
8529
8890
|
top: e.clientY
|
|
8530
8891
|
};
|
|
8892
|
+
let lastPointer = { left: e.clientX, top: e.clientY };
|
|
8893
|
+
sourceScrollOffsetRef.current = { top: 0, left: 0 };
|
|
8894
|
+
const autoScroller = new AutoScroller({
|
|
8895
|
+
orientation: props.orientation,
|
|
8896
|
+
onScroll: () => {
|
|
8897
|
+
}
|
|
8898
|
+
});
|
|
8899
|
+
if (domRef.current) {
|
|
8900
|
+
autoScroller.start(domRef.current);
|
|
8901
|
+
}
|
|
8902
|
+
const scrollContainer = autoScroller.getScrollContainer();
|
|
8903
|
+
let lastSourceScroll = scrollContainer ? props.orientation === "vertical" ? scrollContainer.scrollTop : scrollContainer.scrollLeft : 0;
|
|
8904
|
+
function fireDragMove() {
|
|
8905
|
+
if (!dragOperation) return;
|
|
8906
|
+
dragOperation.move({
|
|
8907
|
+
left: lastPointer.left,
|
|
8908
|
+
top: lastPointer.top
|
|
8909
|
+
});
|
|
8910
|
+
}
|
|
8911
|
+
const onContainerScroll = () => {
|
|
8912
|
+
if (!scrollContainer) return;
|
|
8913
|
+
const current = props.orientation === "vertical" ? scrollContainer.scrollTop : scrollContainer.scrollLeft;
|
|
8914
|
+
const delta = current - lastSourceScroll;
|
|
8915
|
+
lastSourceScroll = current;
|
|
8916
|
+
if (delta !== 0) {
|
|
8917
|
+
interactionTarget2.adjustForScroll(delta);
|
|
8918
|
+
if (props.orientation === "vertical") {
|
|
8919
|
+
sourceScrollOffsetRef.current.top += delta;
|
|
8920
|
+
} else {
|
|
8921
|
+
sourceScrollOffsetRef.current.left += delta;
|
|
8922
|
+
}
|
|
8923
|
+
}
|
|
8924
|
+
fireDragMove();
|
|
8925
|
+
};
|
|
8926
|
+
scrollContainer?.addEventListener("scroll", onContainerScroll);
|
|
8927
|
+
const dragStrategy = props.dragStrategy ?? "proxy";
|
|
8928
|
+
const useProxy = dragStrategy === "proxy" && !props.renderDragProxy;
|
|
8929
|
+
const useRenderProxy = dragStrategy === "proxy" && !!props.renderDragProxy;
|
|
8930
|
+
const proxyMove = props.onDragProxyMove ?? defaultDragProxyMove;
|
|
8531
8931
|
const onPointerMove = (e2) => {
|
|
8932
|
+
lastPointer = { left: e2.clientX, top: e2.clientY };
|
|
8532
8933
|
if (!dragOperation) {
|
|
8533
8934
|
dragOperation = DragManager.startDrag(
|
|
8534
8935
|
{
|
|
@@ -8538,15 +8939,84 @@ var DragList = (props) => {
|
|
|
8538
8939
|
},
|
|
8539
8940
|
initialCoords
|
|
8540
8941
|
);
|
|
8942
|
+
if (dragItemNode && useProxy) {
|
|
8943
|
+
const rect = dragItemNode.getBoundingClientRect();
|
|
8944
|
+
let cachedProxy = null;
|
|
8945
|
+
const setupParams = {
|
|
8946
|
+
dragItemNode,
|
|
8947
|
+
dragItemId: `${dragItemId2}`,
|
|
8948
|
+
initialRect: rect,
|
|
8949
|
+
initialCoords,
|
|
8950
|
+
get proxyElement() {
|
|
8951
|
+
if (!cachedProxy) {
|
|
8952
|
+
cachedProxy = createDefaultProxy(dragItemNode, rect);
|
|
8953
|
+
}
|
|
8954
|
+
return cachedProxy;
|
|
8955
|
+
}
|
|
8956
|
+
};
|
|
8957
|
+
const setupResult = props.onDragProxySetup?.(setupParams);
|
|
8958
|
+
const proxyElement = setupResult?.proxyElement ?? setupParams.proxyElement;
|
|
8959
|
+
dragItemNode.style.visibility = "hidden";
|
|
8960
|
+
proxyStateRef.current = {
|
|
8961
|
+
proxyElement,
|
|
8962
|
+
originalNode: dragItemNode,
|
|
8963
|
+
dragItemId: `${dragItemId2}`,
|
|
8964
|
+
initialRect: rect,
|
|
8965
|
+
cleanup: setupResult?.cleanup
|
|
8966
|
+
};
|
|
8967
|
+
}
|
|
8968
|
+
if (dragItemNode && useRenderProxy) {
|
|
8969
|
+
const rect = dragItemNode.getBoundingClientRect();
|
|
8970
|
+
dragItemNode.style.visibility = "hidden";
|
|
8971
|
+
proxyStateRef.current = {
|
|
8972
|
+
proxyElement: dragItemNode,
|
|
8973
|
+
originalNode: dragItemNode,
|
|
8974
|
+
dragItemId: `${dragItemId2}`,
|
|
8975
|
+
initialRect: rect,
|
|
8976
|
+
// Portal handles its own DOM; only restore visibility.
|
|
8977
|
+
cleanup: () => {
|
|
8978
|
+
}
|
|
8979
|
+
};
|
|
8980
|
+
setDragProxyRenderState({
|
|
8981
|
+
dragItemId: `${dragItemId2}`,
|
|
8982
|
+
initialRect: rect,
|
|
8983
|
+
dx: 0,
|
|
8984
|
+
dy: 0
|
|
8985
|
+
});
|
|
8986
|
+
}
|
|
8541
8987
|
}
|
|
8542
|
-
|
|
8988
|
+
const dx = e2.clientX - initialCoords.left;
|
|
8989
|
+
const dy = e2.clientY - initialCoords.top;
|
|
8990
|
+
if (useRenderProxy) {
|
|
8991
|
+
setDragProxyRenderState(
|
|
8992
|
+
(prev) => prev ? { ...prev, dx, dy } : prev
|
|
8993
|
+
);
|
|
8994
|
+
} else {
|
|
8995
|
+
const proxyState = proxyStateRef.current;
|
|
8996
|
+
if (proxyState) {
|
|
8997
|
+
proxyMove({ proxyElement: proxyState.proxyElement, dx, dy });
|
|
8998
|
+
}
|
|
8999
|
+
}
|
|
9000
|
+
autoScroller.updatePointer({
|
|
8543
9001
|
left: e2.clientX,
|
|
8544
9002
|
top: e2.clientY
|
|
8545
9003
|
});
|
|
9004
|
+
fireDragMove();
|
|
8546
9005
|
};
|
|
8547
9006
|
const onPointerUp = () => {
|
|
9007
|
+
autoScroller.stop();
|
|
9008
|
+
scrollContainer?.removeEventListener("scroll", onContainerScroll);
|
|
8548
9009
|
getGlobal().removeEventListener("pointermove", onPointerMove);
|
|
9010
|
+
if (useRenderProxy) {
|
|
9011
|
+
setDragProxyRenderState(
|
|
9012
|
+
(prev) => prev ? { ...prev, dragItemId: null } : prev
|
|
9013
|
+
);
|
|
9014
|
+
requestAnimationFrame(() => {
|
|
9015
|
+
setDragProxyRenderState(null);
|
|
9016
|
+
});
|
|
9017
|
+
}
|
|
8549
9018
|
if (!dragOperation) {
|
|
9019
|
+
cleanupProxy(proxyStateRef);
|
|
8550
9020
|
setInteractionTarget(null);
|
|
8551
9021
|
return;
|
|
8552
9022
|
}
|
|
@@ -8560,7 +9030,11 @@ var DragList = (props) => {
|
|
|
8560
9030
|
props.orientation,
|
|
8561
9031
|
props.dragListId,
|
|
8562
9032
|
props.acceptDropsFrom,
|
|
8563
|
-
props.removeOnDropOutside
|
|
9033
|
+
props.removeOnDropOutside,
|
|
9034
|
+
props.dragStrategy,
|
|
9035
|
+
props.renderDragProxy,
|
|
9036
|
+
props.onDragProxySetup,
|
|
9037
|
+
props.onDragProxyMove
|
|
8564
9038
|
]
|
|
8565
9039
|
);
|
|
8566
9040
|
const dragging = !!dragItemId;
|
|
@@ -8595,7 +9069,10 @@ var DragList = (props) => {
|
|
|
8595
9069
|
[DRAG_LIST_ATTRIBUTE]: props.dragListId
|
|
8596
9070
|
};
|
|
8597
9071
|
const children = typeof props.children === "function" ? props.children(domProps, contextValue) : props.children;
|
|
8598
|
-
return /* @__PURE__ */ React33.createElement(DragListContext.Provider, { value: contextValue }, children
|
|
9072
|
+
return /* @__PURE__ */ React33.createElement(DragListContext.Provider, { value: contextValue }, children, dragProxyRenderState && props.renderDragProxy ? props.renderDragProxy({
|
|
9073
|
+
...dragProxyRenderState,
|
|
9074
|
+
ref: proxyRefCallback
|
|
9075
|
+
}) : null);
|
|
8599
9076
|
};
|
|
8600
9077
|
var DRAG_LIST_ATTRIBUTE = "data-drag-list-id";
|
|
8601
9078
|
var DRAG_ITEM_ATTRIBUTE = "data-drag-item-id";
|
|
@@ -8678,7 +9155,7 @@ import * as React49 from "react";
|
|
|
8678
9155
|
|
|
8679
9156
|
// src/components/HeadlessTable/index.tsx
|
|
8680
9157
|
import * as React43 from "react";
|
|
8681
|
-
import { useCallback as
|
|
9158
|
+
import { useCallback as useCallback18, useEffect as useEffect14, useRef as useRef18, useState as useState14 } from "react";
|
|
8682
9159
|
|
|
8683
9160
|
// src/components/VirtualList/SpacePlaceholder.tsx
|
|
8684
9161
|
import * as React35 from "react";
|
|
@@ -8795,9 +9272,9 @@ import { useLayoutEffect as useLayoutEffect8, useMemo as useMemo6 } from "react"
|
|
|
8795
9272
|
|
|
8796
9273
|
// src/components/RawList/AvoidReactDiff.tsx
|
|
8797
9274
|
import * as React37 from "react";
|
|
8798
|
-
import { useLayoutEffect as useLayoutEffect7, useRef as useRef15, useState as
|
|
9275
|
+
import { useLayoutEffect as useLayoutEffect7, useRef as useRef15, useState as useState13 } from "react";
|
|
8799
9276
|
function AvoidReactDiffFn(props) {
|
|
8800
|
-
const [children, setChildren] =
|
|
9277
|
+
const [children, setChildren] = useState13(props.updater.get);
|
|
8801
9278
|
const rafId = useRef15(null);
|
|
8802
9279
|
const afterCommitRef = useRef15(props.afterCommit);
|
|
8803
9280
|
afterCommitRef.current = props.afterCommit;
|
|
@@ -12634,7 +13111,7 @@ function HeadlessTable(props) {
|
|
|
12634
13111
|
} = props;
|
|
12635
13112
|
const { autoFocus } = domProps;
|
|
12636
13113
|
const domRef = useRef18(null);
|
|
12637
|
-
const [scrollSize, setTotalScrollSize] =
|
|
13114
|
+
const [scrollSize, setTotalScrollSize] = useState14({
|
|
12638
13115
|
width: 0,
|
|
12639
13116
|
height: 0
|
|
12640
13117
|
});
|
|
@@ -12661,7 +13138,7 @@ function HeadlessTable(props) {
|
|
|
12661
13138
|
const remove = setupResizeObserver(node, onResize, { debounce: 50 });
|
|
12662
13139
|
return remove;
|
|
12663
13140
|
}, [wrapRowsHorizontally, brain]);
|
|
12664
|
-
const updateDOMTransform =
|
|
13141
|
+
const updateDOMTransform = useCallback18((scrollPos) => {
|
|
12665
13142
|
requestAnimationFrame(() => {
|
|
12666
13143
|
if (!domRef.current) {
|
|
12667
13144
|
return;
|
|
@@ -12673,7 +13150,7 @@ function HeadlessTable(props) {
|
|
|
12673
13150
|
return;
|
|
12674
13151
|
});
|
|
12675
13152
|
}, []);
|
|
12676
|
-
const onContainerScroll =
|
|
13153
|
+
const onContainerScroll = useCallback18(
|
|
12677
13154
|
(scrollPos) => {
|
|
12678
13155
|
brain.setScrollPosition(scrollPos, updateDOMTransform);
|
|
12679
13156
|
},
|
|
@@ -12840,23 +13317,23 @@ function assignGroupOffsetsAndComputedWidths(items, groupOffset = 0) {
|
|
|
12840
13317
|
|
|
12841
13318
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
|
|
12842
13319
|
import * as React48 from "react";
|
|
12843
|
-
import { useCallback as
|
|
13320
|
+
import { useCallback as useCallback20, useEffect as useEffect15, useMemo as useMemo7, useRef as useRef20 } from "react";
|
|
12844
13321
|
|
|
12845
13322
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderGroup.tsx
|
|
12846
13323
|
import * as React46 from "react";
|
|
12847
13324
|
|
|
12848
13325
|
// src/components/InfiniteTable/components/InfiniteTableHeader/useColumnGroupResizeHandle.tsx
|
|
12849
13326
|
import * as React45 from "react";
|
|
12850
|
-
import { useCallback as
|
|
13327
|
+
import { useCallback as useCallback19 } from "react";
|
|
12851
13328
|
|
|
12852
13329
|
// src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/GroupResizeHandle.tsx
|
|
12853
|
-
import { useRef as useRef19, useState as
|
|
13330
|
+
import { useRef as useRef19, useState as useState15 } from "react";
|
|
12854
13331
|
import * as React44 from "react";
|
|
12855
13332
|
var { rootClassName: rootClassName8 } = internalProps;
|
|
12856
13333
|
var InfiniteTableHeaderCellResizeHandleCls2 = `${rootClassName8}HeaderCell_ResizeHandle`;
|
|
12857
13334
|
function GroupResizeHandleFn(props) {
|
|
12858
13335
|
const domRef = useRef19(null);
|
|
12859
|
-
const [constrained, setConstrained] =
|
|
13336
|
+
const [constrained, setConstrained] = useState15(false);
|
|
12860
13337
|
const constrainedRef = useRef19(constrained);
|
|
12861
13338
|
constrainedRef.current = constrained;
|
|
12862
13339
|
const col = props.groupColumns[0];
|
|
@@ -12960,7 +13437,7 @@ function useColumnGroupResizeHandle(groupColumns, config) {
|
|
|
12960
13437
|
};
|
|
12961
13438
|
});
|
|
12962
13439
|
const lastColumnInGroup = groupColumns[groupColumns.length - 1];
|
|
12963
|
-
const computeResizeForDiff =
|
|
13440
|
+
const computeResizeForDiff = useCallback19(
|
|
12964
13441
|
(diff) => {
|
|
12965
13442
|
const state = getState();
|
|
12966
13443
|
const { columnSizing, viewportReservedWidth, bodySize } = state;
|
|
@@ -13002,7 +13479,7 @@ function useColumnGroupResizeHandle(groupColumns, config) {
|
|
|
13002
13479
|
},
|
|
13003
13480
|
[lastColumnInGroup]
|
|
13004
13481
|
);
|
|
13005
|
-
const onColumnResize =
|
|
13482
|
+
const onColumnResize = useCallback19(
|
|
13006
13483
|
(diff) => {
|
|
13007
13484
|
const { columnSizing, reservedWidth } = computeResizeForDiff(diff);
|
|
13008
13485
|
actions.viewportReservedWidth = reservedWidth;
|
|
@@ -13168,7 +13645,7 @@ function InfiniteTableInternalHeaderFn(props) {
|
|
|
13168
13645
|
};
|
|
13169
13646
|
});
|
|
13170
13647
|
const domRef = useRef20(null);
|
|
13171
|
-
const updateDOMTransform =
|
|
13648
|
+
const updateDOMTransform = useCallback20((scrollPosition) => {
|
|
13172
13649
|
if (domRef.current) {
|
|
13173
13650
|
domRef.current.style.transform = `translate3d(-${scrollPosition.scrollLeft}px, 0px, 0px)`;
|
|
13174
13651
|
}
|
|
@@ -13213,7 +13690,7 @@ function InfiniteTableInternalHeaderFn(props) {
|
|
|
13213
13690
|
selectionMode
|
|
13214
13691
|
};
|
|
13215
13692
|
}, [allRowsSelected, someRowsSelected, selectionMode]);
|
|
13216
|
-
const renderCell =
|
|
13693
|
+
const renderCell = useCallback20(
|
|
13217
13694
|
(params) => {
|
|
13218
13695
|
const {
|
|
13219
13696
|
rowIndex,
|
|
@@ -13299,6 +13776,7 @@ function InfiniteTableInternalHeaderFn(props) {
|
|
|
13299
13776
|
{
|
|
13300
13777
|
orientation: "horizontal",
|
|
13301
13778
|
dragListId: "header",
|
|
13779
|
+
dragStrategy: "inline",
|
|
13302
13780
|
onDrop: emptyFn3,
|
|
13303
13781
|
updatePosition: emptyFn3
|
|
13304
13782
|
},
|
|
@@ -13601,7 +14079,7 @@ function InfiniteTableHeaderCellFn(props) {
|
|
|
13601
14079
|
const { onResize, height: height2, width, headerOptions, columnsMap } = props;
|
|
13602
14080
|
const sortInfo = column.computedSortInfo;
|
|
13603
14081
|
const header = column.header;
|
|
13604
|
-
const ref =
|
|
14082
|
+
const ref = useCallback22(
|
|
13605
14083
|
(node) => {
|
|
13606
14084
|
domRef.current = node;
|
|
13607
14085
|
props.domRef?.(node);
|
|
@@ -13886,7 +14364,7 @@ function InfiniteTableHeaderCellFn(props) {
|
|
|
13886
14364
|
}
|
|
13887
14365
|
) : /* @__PURE__ */ React51.createElement(InfiniteTableColumnHeaderFilterEmpty, null);
|
|
13888
14366
|
renderParam.renderBag.filterEditor = columnFilterEditor;
|
|
13889
|
-
const pointerDown =
|
|
14367
|
+
const pointerDown = useCallback22(
|
|
13890
14368
|
(e) => {
|
|
13891
14369
|
onPointerDown(e);
|
|
13892
14370
|
onDragItemPointerDown(e);
|
|
@@ -16958,7 +17436,7 @@ var Indexer = class {
|
|
|
16958
17436
|
};
|
|
16959
17437
|
|
|
16960
17438
|
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
16961
|
-
import { useEffect as useEffect19, useMemo as useMemo10, useRef as useRef24, useState as
|
|
17439
|
+
import { useEffect as useEffect19, useMemo as useMemo10, useRef as useRef24, useState as useState16 } from "react";
|
|
16962
17440
|
|
|
16963
17441
|
// src/components/hooks/useEffectWithChanges.ts
|
|
16964
17442
|
import { useEffect as useEffect18, useLayoutEffect as useLayoutEffect11, useRef as useRef23 } from "react";
|
|
@@ -20552,7 +21030,7 @@ function useLoadData(options) {
|
|
|
20552
21030
|
filterTypes,
|
|
20553
21031
|
cursorId: stateCursorId
|
|
20554
21032
|
} = dataSourceState;
|
|
20555
|
-
const [scrollbars, setScrollbars] =
|
|
21033
|
+
const [scrollbars, setScrollbars] = useState16({
|
|
20556
21034
|
vertical: false,
|
|
20557
21035
|
horizontal: false
|
|
20558
21036
|
});
|
|
@@ -21912,10 +22390,10 @@ function getDataSourceStateRestoreForDetails(state) {
|
|
|
21912
22390
|
|
|
21913
22391
|
// src/components/DataSource/privateHooks/useDataSource.tsx
|
|
21914
22392
|
import React54, {
|
|
21915
|
-
useCallback as
|
|
22393
|
+
useCallback as useCallback24,
|
|
21916
22394
|
useEffect as useEffect20,
|
|
21917
22395
|
useLayoutEffect as useLayoutEffect12,
|
|
21918
|
-
useState as
|
|
22396
|
+
useState as useState17
|
|
21919
22397
|
} from "react";
|
|
21920
22398
|
|
|
21921
22399
|
// src/components/DataSource/DataSourceStore.ts
|
|
@@ -21937,7 +22415,7 @@ function useDataSourceInternal(props) {
|
|
|
21937
22415
|
} = managedContextValue;
|
|
21938
22416
|
dataSourceState.getDataSourceMasterContextRef.current = getDataSourceMasterContext;
|
|
21939
22417
|
const getDataSourceState = useLatest(dataSourceState);
|
|
21940
|
-
const [dataSourceApi] =
|
|
22418
|
+
const [dataSourceApi] = useState17(
|
|
21941
22419
|
() => getDataSourceApi({
|
|
21942
22420
|
getState: getDataSourceState,
|
|
21943
22421
|
actions: dataSourceActions
|
|
@@ -21954,10 +22432,10 @@ function useDataSourceInternal(props) {
|
|
|
21954
22432
|
const getLatestManagedContextValue = useLatest(managedContextValue);
|
|
21955
22433
|
const getLatestContextValue = useLatest(contextValue);
|
|
21956
22434
|
const DataSourceContext = getDataSourceContext();
|
|
21957
|
-
const DataSource2 =
|
|
22435
|
+
const DataSource2 = useCallback24(
|
|
21958
22436
|
({ children }) => {
|
|
21959
22437
|
const DataSourceStoreContext = getDataSourceStoreContext();
|
|
21960
|
-
const [store] =
|
|
22438
|
+
const [store] = useState17(() => createDataSourceStore());
|
|
21961
22439
|
if (typeof children === "function") {
|
|
21962
22440
|
children = children(getDataSourceState());
|
|
21963
22441
|
}
|
|
@@ -23976,7 +24454,7 @@ function getImperativeApi(context) {
|
|
|
23976
24454
|
import {
|
|
23977
24455
|
useEffect as useEffect21,
|
|
23978
24456
|
useRef as useRef25,
|
|
23979
|
-
useState as
|
|
24457
|
+
useState as useState18
|
|
23980
24458
|
} from "react";
|
|
23981
24459
|
var OFFSET = 10;
|
|
23982
24460
|
function getColumnContentMaxWidths(domRef, options) {
|
|
@@ -24048,7 +24526,7 @@ function useAutoSizeColumns() {
|
|
|
24048
24526
|
componentActions,
|
|
24049
24527
|
componentState: { domRef, ready, autoSizeColumnsKey, brain }
|
|
24050
24528
|
} = useManagedComponentState();
|
|
24051
|
-
const [refreshId, setRefreshId] =
|
|
24529
|
+
const [refreshId, setRefreshId] = useState18(0);
|
|
24052
24530
|
const theKey = typeof autoSizeColumnsKey === "object" ? autoSizeColumnsKey.key : autoSizeColumnsKey;
|
|
24053
24531
|
const getTheKey = useLatest(theKey);
|
|
24054
24532
|
const lastExecutedIdentifierRef = useRef25(null);
|
|
@@ -24110,7 +24588,7 @@ function useAutoSizeColumns() {
|
|
|
24110
24588
|
}
|
|
24111
24589
|
|
|
24112
24590
|
// src/components/InfiniteTable/hooks/useComputed.ts
|
|
24113
|
-
import { useEffect as useEffect24, useMemo as useMemo15, useState as
|
|
24591
|
+
import { useEffect as useEffect24, useMemo as useMemo15, useState as useState20 } from "react";
|
|
24114
24592
|
|
|
24115
24593
|
// src/components/InfiniteTable/utils/MultiCellSelector.ts
|
|
24116
24594
|
var MultiCellSelector = class {
|
|
@@ -24370,10 +24848,10 @@ function useColumnRowspan(computedVisibleColumns) {
|
|
|
24370
24848
|
}
|
|
24371
24849
|
|
|
24372
24850
|
// src/components/InfiniteTable/hooks/useColumnSizeFn.ts
|
|
24373
|
-
import { useCallback as
|
|
24851
|
+
import { useCallback as useCallback25 } from "react";
|
|
24374
24852
|
var debug3 = dbg("useColumnSizeFn");
|
|
24375
24853
|
function useColumnSizeFn(columns) {
|
|
24376
|
-
const columnSize =
|
|
24854
|
+
const columnSize = useCallback25(
|
|
24377
24855
|
(index) => {
|
|
24378
24856
|
const column = columns[index];
|
|
24379
24857
|
if (false) {
|
|
@@ -25209,7 +25687,7 @@ function getColumnVisibilityForHideEmptyGroupColumns(params) {
|
|
|
25209
25687
|
}
|
|
25210
25688
|
|
|
25211
25689
|
// src/components/InfiniteTable/hooks/useToggleGroupRow.ts
|
|
25212
|
-
import { useCallback as
|
|
25690
|
+
import { useCallback as useCallback26 } from "react";
|
|
25213
25691
|
function useToggleGroupRow() {
|
|
25214
25692
|
const { getDataSourceState, dataSourceActions, getDataSourceMasterContext } = useDataSourceSelector((ctx) => {
|
|
25215
25693
|
return {
|
|
@@ -25218,7 +25696,7 @@ function useToggleGroupRow() {
|
|
|
25218
25696
|
getDataSourceMasterContext: ctx.getDataSourceMasterContext
|
|
25219
25697
|
};
|
|
25220
25698
|
});
|
|
25221
|
-
const toggleGroupRow =
|
|
25699
|
+
const toggleGroupRow = useCallback26((groupKeys) => {
|
|
25222
25700
|
const state = getDataSourceState();
|
|
25223
25701
|
const newState = new GroupRowsState(state.groupRowsState);
|
|
25224
25702
|
newState.toggleGroupRow(groupKeys);
|
|
@@ -25920,7 +26398,7 @@ function useComputedRowHeight(param) {
|
|
|
25920
26398
|
}
|
|
25921
26399
|
|
|
25922
26400
|
// src/components/InfiniteTable/hooks/useScrollbars.ts
|
|
25923
|
-
import { useState as
|
|
26401
|
+
import { useState as useState19, useEffect as useEffect23, useLayoutEffect as useLayoutEffect14 } from "react";
|
|
25924
26402
|
var INITIAL_SCROLLBARS = {
|
|
25925
26403
|
vertical: false,
|
|
25926
26404
|
horizontal: false
|
|
@@ -25928,7 +26406,7 @@ var INITIAL_SCROLLBARS = {
|
|
|
25928
26406
|
function useScrollbars(getState) {
|
|
25929
26407
|
const brain = getState().brain;
|
|
25930
26408
|
const { getDataSourceState } = useDataSourceStableContext();
|
|
25931
|
-
const [scrollbars, setScrollbars] =
|
|
26409
|
+
const [scrollbars, setScrollbars] = useState19(INITIAL_SCROLLBARS);
|
|
25932
26410
|
useEffect23(() => {
|
|
25933
26411
|
return brain.onRenderCountChange(() => {
|
|
25934
26412
|
const { scrollTopMax, scrollLeftMax } = brain;
|
|
@@ -26016,7 +26494,7 @@ function useComputed(options) {
|
|
|
26016
26494
|
groupBy: ctx.dataSourceState.groupBy
|
|
26017
26495
|
};
|
|
26018
26496
|
});
|
|
26019
|
-
|
|
26497
|
+
useState20(() => {
|
|
26020
26498
|
onRowHeightCSSVarChange.onChange((rowHeight2) => {
|
|
26021
26499
|
if (rowHeight2) {
|
|
26022
26500
|
componentActions.rowHeight = rowHeight2;
|
|
@@ -26108,7 +26586,7 @@ function useComputed(options) {
|
|
|
26108
26586
|
const scrollbars = useScrollbars(getState);
|
|
26109
26587
|
const computedPinnedStartOverflow = computedPinnedStartWidth ? computedPinnedStartColumnsWidth > computedPinnedStartWidth : false;
|
|
26110
26588
|
const computedPinnedEndOverflow = computedPinnedEndWidth ? computedPinnedEndColumnsWidth > computedPinnedEndWidth : false;
|
|
26111
|
-
const [multiRowSelector] =
|
|
26589
|
+
const [multiRowSelector] = useState20(() => {
|
|
26112
26590
|
const multiRowSelector2 = new MultiRowSelector({
|
|
26113
26591
|
isRowDisabledAt: (index) => {
|
|
26114
26592
|
const dataItem = getDataSourceState().dataArray[index];
|
|
@@ -26122,7 +26600,7 @@ function useComputed(options) {
|
|
|
26122
26600
|
return multiRowSelector2;
|
|
26123
26601
|
});
|
|
26124
26602
|
const getComputedVisibleColumns = useLatest(computedVisibleColumns);
|
|
26125
|
-
const [multiCellSelector] =
|
|
26603
|
+
const [multiCellSelector] = useState20(() => {
|
|
26126
26604
|
return new MultiCellSelector({
|
|
26127
26605
|
getPrimaryKeyByIndex: dataSourceApi.getPrimaryKeyByIndex,
|
|
26128
26606
|
getColumnIdByIndex: (colIndex) => {
|
|
@@ -26380,7 +26858,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
26380
26858
|
}
|
|
26381
26859
|
let valid2 = isValidLicense(licenseKey, {
|
|
26382
26860
|
publishedAt: 1624970570587,
|
|
26383
|
-
version: "8.0.
|
|
26861
|
+
version: "8.0.2"
|
|
26384
26862
|
});
|
|
26385
26863
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
26386
26864
|
return true;
|
|
@@ -26475,7 +26953,7 @@ function createInfiniteTableStore() {
|
|
|
26475
26953
|
var toCSSVarName = (value) => `--infinite-${value}`;
|
|
26476
26954
|
|
|
26477
26955
|
// src/components/InfiniteTable/eventHandlers/index.ts
|
|
26478
|
-
import { useCallback as
|
|
26956
|
+
import { useCallback as useCallback27, useMemo as useMemo17, useEffect as useEffect27 } from "react";
|
|
26479
26957
|
|
|
26480
26958
|
// src/components/InfiniteTable/eventHandlers/onCellClick.ts
|
|
26481
26959
|
function onCellClick(context, event) {
|
|
@@ -27229,7 +27707,7 @@ function subscribeToDOMEvents() {
|
|
|
27229
27707
|
getState: ctx.getState
|
|
27230
27708
|
};
|
|
27231
27709
|
});
|
|
27232
|
-
const onKeyDown2 =
|
|
27710
|
+
const onKeyDown2 = useCallback27((event) => {
|
|
27233
27711
|
getState().keyDown(event);
|
|
27234
27712
|
}, []);
|
|
27235
27713
|
return { onKeyDown: onKeyDown2 };
|
|
@@ -27245,10 +27723,10 @@ import { useEffect as useEffect31 } from "react";
|
|
|
27245
27723
|
// src/components/hooks/useOverlay/index.tsx
|
|
27246
27724
|
import * as React57 from "react";
|
|
27247
27725
|
import {
|
|
27248
|
-
useCallback as
|
|
27726
|
+
useCallback as useCallback28,
|
|
27249
27727
|
useEffect as useEffect29,
|
|
27250
27728
|
useLayoutEffect as useLayoutEffect15,
|
|
27251
|
-
useState as
|
|
27729
|
+
useState as useState21
|
|
27252
27730
|
} from "react";
|
|
27253
27731
|
import { createPortal as createPortal2 } from "react-dom";
|
|
27254
27732
|
|
|
@@ -27440,7 +27918,7 @@ function OverlayContent(props) {
|
|
|
27440
27918
|
"div",
|
|
27441
27919
|
{
|
|
27442
27920
|
style: { position: "absolute", top: 0, left: 0 },
|
|
27443
|
-
ref:
|
|
27921
|
+
ref: useCallback28((node) => {
|
|
27444
27922
|
if (node) {
|
|
27445
27923
|
alignNode(node, props);
|
|
27446
27924
|
}
|
|
@@ -27489,7 +27967,7 @@ async function alignNode(node, params) {
|
|
|
27489
27967
|
}
|
|
27490
27968
|
}
|
|
27491
27969
|
function useOverlayPortal(content, portalContainer) {
|
|
27492
|
-
const [container, setContainer] =
|
|
27970
|
+
const [container, setContainer] = useState21(null);
|
|
27493
27971
|
useLayoutEffect15(() => {
|
|
27494
27972
|
async function getContainer() {
|
|
27495
27973
|
const container2 = portalContainer ? await retrieveElement(portalContainer) : null;
|
|
@@ -27534,10 +28012,10 @@ function injectPortalContainerAndConstrainInMenuChild(children, portalContainer,
|
|
|
27534
28012
|
}
|
|
27535
28013
|
function useOverlay(params) {
|
|
27536
28014
|
const rootParams = params;
|
|
27537
|
-
const [handles] =
|
|
27538
|
-
const [handleToRealign, setHandleToRealign] =
|
|
27539
|
-
const [realignTimestamp, setRealignTimestamp] =
|
|
27540
|
-
const getContentForPortal =
|
|
28015
|
+
const [handles] = useState21(() => /* @__PURE__ */ new Map());
|
|
28016
|
+
const [handleToRealign, setHandleToRealign] = useState21(null);
|
|
28017
|
+
const [realignTimestamp, setRealignTimestamp] = useState21(0);
|
|
28018
|
+
const getContentForPortal = useCallback28(() => {
|
|
27541
28019
|
const contentForPortal = [];
|
|
27542
28020
|
for (const [_2, handle] of handles) {
|
|
27543
28021
|
contentForPortal.push(
|
|
@@ -27551,7 +28029,7 @@ function useOverlay(params) {
|
|
|
27551
28029
|
getContentForPortal(),
|
|
27552
28030
|
params.portalContainer
|
|
27553
28031
|
);
|
|
27554
|
-
const showOverlay =
|
|
28032
|
+
const showOverlay = useCallback28(
|
|
27555
28033
|
(content, params2) => {
|
|
27556
28034
|
const id = params2.id || getIdForReactOnlyChild(content) || getChangeDetect();
|
|
27557
28035
|
const key = `${id}`;
|
|
@@ -27793,10 +28271,10 @@ var deriveStateFromProps2 = (params) => {
|
|
|
27793
28271
|
// src/components/Menu/Menu.tsx
|
|
27794
28272
|
import * as React60 from "react";
|
|
27795
28273
|
import {
|
|
27796
|
-
useCallback as
|
|
28274
|
+
useCallback as useCallback30,
|
|
27797
28275
|
useLayoutEffect as useLayoutEffect16,
|
|
27798
28276
|
useRef as useRef30,
|
|
27799
|
-
useState as
|
|
28277
|
+
useState as useState23
|
|
27800
28278
|
} from "react";
|
|
27801
28279
|
|
|
27802
28280
|
// src/utils/pageGeometry/Triangle.ts
|
|
@@ -28024,7 +28502,7 @@ function useMenuContext() {
|
|
|
28024
28502
|
}
|
|
28025
28503
|
|
|
28026
28504
|
// src/components/hooks/useMounted.ts
|
|
28027
|
-
import { useCallback as
|
|
28505
|
+
import { useCallback as useCallback29, useEffect as useEffect30, useRef as useRef29 } from "react";
|
|
28028
28506
|
function useMounted() {
|
|
28029
28507
|
let mountedRef = useRef29(true);
|
|
28030
28508
|
useEffect30(() => {
|
|
@@ -28033,7 +28511,7 @@ function useMounted() {
|
|
|
28033
28511
|
mountedRef.current = false;
|
|
28034
28512
|
};
|
|
28035
28513
|
}, []);
|
|
28036
|
-
const isMounted =
|
|
28514
|
+
const isMounted = useCallback29(() => mountedRef.current, []);
|
|
28037
28515
|
return isMounted;
|
|
28038
28516
|
}
|
|
28039
28517
|
|
|
@@ -28126,7 +28604,7 @@ function useSubmenus({
|
|
|
28126
28604
|
onItemActivate
|
|
28127
28605
|
}) {
|
|
28128
28606
|
const { getState } = useMenuContext();
|
|
28129
|
-
const [{ onItemEnter, onItemLeave }] =
|
|
28607
|
+
const [{ onItemEnter, onItemLeave }] = useState23(() => {
|
|
28130
28608
|
return new MenuTriangleContext({
|
|
28131
28609
|
parentMenuId: getState().parentMenuId,
|
|
28132
28610
|
onItemActivate: (itemKey) => {
|
|
@@ -28157,8 +28635,8 @@ function useSubmenus({
|
|
|
28157
28635
|
}).getHandlers();
|
|
28158
28636
|
});
|
|
28159
28637
|
return {
|
|
28160
|
-
onItemEnter:
|
|
28161
|
-
onItemLeave:
|
|
28638
|
+
onItemEnter: useCallback30(onItemEnter, []),
|
|
28639
|
+
onItemLeave: useCallback30(onItemLeave, [])
|
|
28162
28640
|
};
|
|
28163
28641
|
}
|
|
28164
28642
|
function MenuComponent(props) {
|
|
@@ -28183,14 +28661,14 @@ function MenuComponent(props) {
|
|
|
28183
28661
|
componentActions,
|
|
28184
28662
|
getState
|
|
28185
28663
|
} = useMenuContext();
|
|
28186
|
-
const setKeyboardActiveItemKey =
|
|
28664
|
+
const setKeyboardActiveItemKey = useCallback30((key) => {
|
|
28187
28665
|
componentActions.keyboardActiveItemKey = key;
|
|
28188
28666
|
}, []);
|
|
28189
|
-
const setActiveItemKey =
|
|
28667
|
+
const setActiveItemKey = useCallback30((key) => {
|
|
28190
28668
|
componentActions.activeItemKey = key;
|
|
28191
28669
|
}, []);
|
|
28192
28670
|
const isMounted = useMounted();
|
|
28193
|
-
const [submenuApi, setSubmenuApi] =
|
|
28671
|
+
const [submenuApi, setSubmenuApi] = useState23(null);
|
|
28194
28672
|
let renderedChildren = null;
|
|
28195
28673
|
useLayoutEffect16(() => {
|
|
28196
28674
|
const { runtimeItems: runtimeItems2 } = getState();
|
|
@@ -28402,7 +28880,7 @@ function MenuComponent(props) {
|
|
|
28402
28880
|
function onMenuBlur() {
|
|
28403
28881
|
componentActions.focused = false;
|
|
28404
28882
|
}
|
|
28405
|
-
const onMenuFocus =
|
|
28883
|
+
const onMenuFocus = useCallback30(function() {
|
|
28406
28884
|
componentActions.focused = true;
|
|
28407
28885
|
setTimeout(() => {
|
|
28408
28886
|
if (shouldSelectFirstItemOnFocus.current && domRef.current && domRef.current === document.activeElement && getState().keyboardActiveItemKey == null) {
|
|
@@ -28413,11 +28891,11 @@ function MenuComponent(props) {
|
|
|
28413
28891
|
});
|
|
28414
28892
|
}, []);
|
|
28415
28893
|
const shouldSelectFirstItemOnFocus = useRef30(true);
|
|
28416
|
-
const hideAll =
|
|
28894
|
+
const hideAll = useCallback30(() => {
|
|
28417
28895
|
const state = getState();
|
|
28418
28896
|
state.onHideIntent?.(state);
|
|
28419
28897
|
}, [getState]);
|
|
28420
|
-
const [api] =
|
|
28898
|
+
const [api] = useState23(() => {
|
|
28421
28899
|
const result2 = {
|
|
28422
28900
|
hideMenu: hideAll,
|
|
28423
28901
|
focus: () => {
|
|
@@ -28436,7 +28914,7 @@ function MenuComponent(props) {
|
|
|
28436
28914
|
};
|
|
28437
28915
|
return result2;
|
|
28438
28916
|
});
|
|
28439
|
-
const refCallback =
|
|
28917
|
+
const refCallback = useCallback30((node) => {
|
|
28440
28918
|
if (node) {
|
|
28441
28919
|
domRef.current = node;
|
|
28442
28920
|
onShow?.(getState(), api);
|
|
@@ -28942,7 +29420,7 @@ function useColumnMenu() {
|
|
|
28942
29420
|
|
|
28943
29421
|
// src/components/InfiniteTable/components/FocusDetect.tsx
|
|
28944
29422
|
import * as React64 from "react";
|
|
28945
|
-
import { useCallback as
|
|
29423
|
+
import { useCallback as useCallback31 } from "react";
|
|
28946
29424
|
var style = {
|
|
28947
29425
|
width: 0,
|
|
28948
29426
|
height: 0,
|
|
@@ -28962,7 +29440,7 @@ function FocusDetect() {
|
|
|
28962
29440
|
} = useInfiniteTableStableContext();
|
|
28963
29441
|
const { getDataSourceState, getDataSourceMasterContext } = useDataSourceStableContext();
|
|
28964
29442
|
const { focusDetectDOMRef } = getState();
|
|
28965
|
-
const onFocus =
|
|
29443
|
+
const onFocus = useCallback31(async () => {
|
|
28966
29444
|
const context = {
|
|
28967
29445
|
getDataSourceState,
|
|
28968
29446
|
getDataSourceMasterContext,
|
|
@@ -29673,14 +30151,14 @@ import { useRef as useRef31 } from "react";
|
|
|
29673
30151
|
import * as React70 from "react";
|
|
29674
30152
|
|
|
29675
30153
|
// src/components/InfiniteTable/hooks/useGridScroll.ts
|
|
29676
|
-
import { useCallback as
|
|
30154
|
+
import { useCallback as useCallback32, useEffect as useEffect35 } from "react";
|
|
29677
30155
|
function useGridScroll(onScroll, deps) {
|
|
29678
30156
|
const { brain } = useInfiniteTableSelector((ctx) => {
|
|
29679
30157
|
return {
|
|
29680
30158
|
brain: ctx.state.brain
|
|
29681
30159
|
};
|
|
29682
30160
|
});
|
|
29683
|
-
const memoizedOnScroll =
|
|
30161
|
+
const memoizedOnScroll = useCallback32(onScroll, deps);
|
|
29684
30162
|
useEffect35(() => {
|
|
29685
30163
|
const removeOnScroll = brain.onScroll(memoizedOnScroll);
|
|
29686
30164
|
return removeOnScroll;
|
|
@@ -30267,7 +30745,7 @@ function useInfinitePortalContainer() {
|
|
|
30267
30745
|
|
|
30268
30746
|
// src/components/InfiniteTable/components/GroupingToolbar/index.tsx
|
|
30269
30747
|
import * as React72 from "react";
|
|
30270
|
-
import { useCallback as
|
|
30748
|
+
import { useCallback as useCallback33 } from "react";
|
|
30271
30749
|
|
|
30272
30750
|
// src/components/InfiniteTable/components/GroupingToolbar/index.css.ts
|
|
30273
30751
|
var GroupingToolbarItemClearCls = "hs68h8j _16lm1iwk _16lm1iwx _16lm1iw2n";
|
|
@@ -30453,7 +30931,7 @@ function GroupingToolbar(props) {
|
|
|
30453
30931
|
});
|
|
30454
30932
|
dataSourceApi.setGroupBy(newGroupBy);
|
|
30455
30933
|
};
|
|
30456
|
-
const shouldAcceptDrop =
|
|
30934
|
+
const shouldAcceptDrop = useCallback33(
|
|
30457
30935
|
(event) => {
|
|
30458
30936
|
const { computedColumnsMap: computedColumnsMap2 } = getComputed();
|
|
30459
30937
|
const columnId = event.dragItem.id;
|
|
@@ -30477,6 +30955,7 @@ function GroupingToolbar(props) {
|
|
|
30477
30955
|
dragListId: GROUPING_TOOLBAR_DRAG_LIST_ID,
|
|
30478
30956
|
acceptDropsFrom: ["header", GROUPING_TOOLBAR_DRAG_LIST_ID],
|
|
30479
30957
|
onDrop,
|
|
30958
|
+
dragStrategy: "inline",
|
|
30480
30959
|
onAcceptDrop,
|
|
30481
30960
|
shouldAcceptDrop
|
|
30482
30961
|
},
|
|
@@ -30515,7 +30994,7 @@ import * as React77 from "react";
|
|
|
30515
30994
|
|
|
30516
30995
|
// src/components/InfiniteTable/hooks/useCellRendering.tsx
|
|
30517
30996
|
import { useMemo as useMemo19 } from "react";
|
|
30518
|
-
import { useCallback as
|
|
30997
|
+
import { useCallback as useCallback34, useEffect as useEffect38, useRef as useRef34 } from "react";
|
|
30519
30998
|
import * as React74 from "react";
|
|
30520
30999
|
|
|
30521
31000
|
// src/components/InfiniteTable/hooks/useYourBrain.ts
|
|
@@ -30912,7 +31391,7 @@ function useCellRendering(param) {
|
|
|
30912
31391
|
cellSelection
|
|
30913
31392
|
};
|
|
30914
31393
|
}, [isNodeReadOnly2, selectionMode, cellSelection]);
|
|
30915
|
-
const renderCell =
|
|
31394
|
+
const renderCell = useCallback34(
|
|
30916
31395
|
(params) => {
|
|
30917
31396
|
const {
|
|
30918
31397
|
rowIndex,
|
|
@@ -32353,6 +32832,7 @@ var components = {
|
|
|
32353
32832
|
NumberFilterEditor
|
|
32354
32833
|
};
|
|
32355
32834
|
export {
|
|
32835
|
+
AutoScroller,
|
|
32356
32836
|
CellSelectionState,
|
|
32357
32837
|
DRAG_ITEM_ATTRIBUTE,
|
|
32358
32838
|
DataClient,
|
|
@@ -32381,9 +32861,11 @@ export {
|
|
|
32381
32861
|
WeakFixedSizeSet,
|
|
32382
32862
|
alignNode,
|
|
32383
32863
|
components,
|
|
32864
|
+
createDefaultProxy,
|
|
32384
32865
|
createFlashingColumnCellComponent,
|
|
32385
32866
|
debounce,
|
|
32386
32867
|
debug,
|
|
32868
|
+
defaultDragProxyMove,
|
|
32387
32869
|
defaultFilterTypes2 as defaultFilterTypes,
|
|
32388
32870
|
eventMatchesKeyboardShortcut,
|
|
32389
32871
|
filterDataArray,
|