@infinite-table/infinite-react 10.1.2 → 10.1.4
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 +88 -1
- package/index.dev.js +597 -182
- package/index.dev.mjs +556 -135
- package/index.js +8 -8
- package/index.mjs +8 -8
- package/package.json +2 -2
package/index.dev.js
CHANGED
|
@@ -5175,6 +5175,79 @@ var Rectangle = class _Rectangle extends PolyWithPoints {
|
|
|
5175
5175
|
}
|
|
5176
5176
|
};
|
|
5177
5177
|
|
|
5178
|
+
// src/components/VirtualBrain/largeContent.ts
|
|
5179
|
+
var LARGE_CONTENT_PROBE_THRESHOLD = 4e6;
|
|
5180
|
+
var SCROLL_ORIGIN_REBASE_DISTANCE = 1e6;
|
|
5181
|
+
var PROBE_START = 1e6;
|
|
5182
|
+
var PROBE_MAX = 64e6;
|
|
5183
|
+
var maxElementSize;
|
|
5184
|
+
function probeMaxElementSize() {
|
|
5185
|
+
if (typeof document === "undefined" || !document.body) {
|
|
5186
|
+
return Infinity;
|
|
5187
|
+
}
|
|
5188
|
+
const div = document.createElement("div");
|
|
5189
|
+
div.style.cssText = "position:absolute;top:0;left:0;width:1px;visibility:hidden;pointer-events:none";
|
|
5190
|
+
document.body.appendChild(div);
|
|
5191
|
+
const applies = (size2) => {
|
|
5192
|
+
div.style.height = `${size2}px`;
|
|
5193
|
+
return Math.abs(div.getBoundingClientRect().height - size2) < 1;
|
|
5194
|
+
};
|
|
5195
|
+
let size = PROBE_START;
|
|
5196
|
+
if (!applies(size)) {
|
|
5197
|
+
div.remove();
|
|
5198
|
+
return Infinity;
|
|
5199
|
+
}
|
|
5200
|
+
while (size < PROBE_MAX && applies(size * 2)) {
|
|
5201
|
+
size *= 2;
|
|
5202
|
+
}
|
|
5203
|
+
div.remove();
|
|
5204
|
+
return size;
|
|
5205
|
+
}
|
|
5206
|
+
function getMaxElementSize() {
|
|
5207
|
+
if (maxElementSize === void 0) {
|
|
5208
|
+
maxElementSize = probeMaxElementSize();
|
|
5209
|
+
}
|
|
5210
|
+
return maxElementSize;
|
|
5211
|
+
}
|
|
5212
|
+
function isLargeContentSize(contentSize) {
|
|
5213
|
+
if (contentSize <= LARGE_CONTENT_PROBE_THRESHOLD) {
|
|
5214
|
+
return false;
|
|
5215
|
+
}
|
|
5216
|
+
return contentSize > getMaxElementSize();
|
|
5217
|
+
}
|
|
5218
|
+
function computeScrollRatio(contentSize, viewportSize) {
|
|
5219
|
+
if (!isLargeContentSize(contentSize)) {
|
|
5220
|
+
return 1;
|
|
5221
|
+
}
|
|
5222
|
+
const nativeScrollMax = getMaxElementSize() - viewportSize;
|
|
5223
|
+
const contentScrollMax = contentSize - viewportSize;
|
|
5224
|
+
return nativeScrollMax > 0 && contentScrollMax > 0 ? contentScrollMax / nativeScrollMax : 1;
|
|
5225
|
+
}
|
|
5226
|
+
function createSteppedScrollPosition(options) {
|
|
5227
|
+
let requested = null;
|
|
5228
|
+
return {
|
|
5229
|
+
get value() {
|
|
5230
|
+
const actual = options.getScrollPosition();
|
|
5231
|
+
const ratio = options.getScrollRatio();
|
|
5232
|
+
if (ratio > 1 && requested !== null && Math.abs(requested - actual) <= ratio) {
|
|
5233
|
+
return requested;
|
|
5234
|
+
}
|
|
5235
|
+
requested = null;
|
|
5236
|
+
return actual;
|
|
5237
|
+
},
|
|
5238
|
+
set value(value) {
|
|
5239
|
+
requested = value;
|
|
5240
|
+
options.setScrollPosition(value);
|
|
5241
|
+
}
|
|
5242
|
+
};
|
|
5243
|
+
}
|
|
5244
|
+
function computeScrollOrigin(scroll, currentOrigin, align2 = Math.floor) {
|
|
5245
|
+
if (Math.abs(scroll - currentOrigin) <= SCROLL_ORIGIN_REBASE_DISTANCE) {
|
|
5246
|
+
return currentOrigin;
|
|
5247
|
+
}
|
|
5248
|
+
return align2(scroll);
|
|
5249
|
+
}
|
|
5250
|
+
|
|
5178
5251
|
// src/components/InfiniteTable/hooks/reorderColumnsOnDrag.ts
|
|
5179
5252
|
var PROXY_OFFSET = 10;
|
|
5180
5253
|
var pinnedStartWidthCSSVar2 = stripVar(InternalVars.pinnedStartWidth);
|
|
@@ -5472,6 +5545,13 @@ function reorderColumnsOnDrag(params) {
|
|
|
5472
5545
|
scrollOffsetStart: pinnedStartColsRight,
|
|
5473
5546
|
scrollOffsetEnd: pinnedEndColsLeft
|
|
5474
5547
|
});
|
|
5548
|
+
const autoScrollLeft = createSteppedScrollPosition({
|
|
5549
|
+
getScrollPosition: () => brain.getScrollPosition().scrollLeft,
|
|
5550
|
+
setScrollPosition: (value) => {
|
|
5551
|
+
imperativeApi.scrollLeft = value;
|
|
5552
|
+
},
|
|
5553
|
+
getScrollRatio: () => brain.getScrollRatio("horizontal")
|
|
5554
|
+
});
|
|
5475
5555
|
updatePositionAndDiff(initialMousePosition);
|
|
5476
5556
|
return {
|
|
5477
5557
|
speedScroller,
|
|
@@ -5491,10 +5571,10 @@ function reorderColumnsOnDrag(params) {
|
|
|
5491
5571
|
speedScroller.scroll({
|
|
5492
5572
|
mousePosition: currentMousePosition,
|
|
5493
5573
|
get scrollLeft() {
|
|
5494
|
-
return
|
|
5574
|
+
return autoScrollLeft.value;
|
|
5495
5575
|
},
|
|
5496
5576
|
set scrollLeft(value) {
|
|
5497
|
-
|
|
5577
|
+
autoScrollLeft.value = value;
|
|
5498
5578
|
}
|
|
5499
5579
|
});
|
|
5500
5580
|
const breakpoints = getBreakPoints(computedVisibleColumns, {
|
|
@@ -13419,6 +13499,18 @@ var MatrixBrain = class extends Logger {
|
|
|
13419
13499
|
};
|
|
13420
13500
|
this.extraSpanCells = [];
|
|
13421
13501
|
this.scrollPosition = { scrollLeft: 0, scrollTop: 0 };
|
|
13502
|
+
/**
|
|
13503
|
+
* Content larger than the browser can lay out - see largeContent.ts.
|
|
13504
|
+
* Recomputed when sizes change (updateRenderCount), not on scroll.
|
|
13505
|
+
*/
|
|
13506
|
+
this.largeContent = { vertical: false, horizontal: false };
|
|
13507
|
+
this.scrollRatio = { vertical: 1, horizontal: 1 };
|
|
13508
|
+
/**
|
|
13509
|
+
* DOM offsets are written relative to this (content px) - see
|
|
13510
|
+
* "scroll origin" in largeContent.ts. Always 0 unless the content is large.
|
|
13511
|
+
*/
|
|
13512
|
+
this.scrollOrigin = { scrollLeft: 0, scrollTop: 0 };
|
|
13513
|
+
this.onScrollOriginChangeFns = /* @__PURE__ */ new Set();
|
|
13422
13514
|
this.onScrollFns = [];
|
|
13423
13515
|
// private onTotalSizeChangeFns: OnSizeChangeFn[] = [];
|
|
13424
13516
|
this.onRenderRangeChangeFns = /* @__PURE__ */ new Set();
|
|
@@ -13457,6 +13549,13 @@ var MatrixBrain = class extends Logger {
|
|
|
13457
13549
|
this.getColCount = () => {
|
|
13458
13550
|
return this.cols;
|
|
13459
13551
|
};
|
|
13552
|
+
/**
|
|
13553
|
+
* Called (synchronously) when the scroll origin moves - every DOM offset
|
|
13554
|
+
* relative to it has to be written again (in the same frame).
|
|
13555
|
+
*/
|
|
13556
|
+
this.onScrollOriginChange = (fn) => {
|
|
13557
|
+
return this.onScrollOriginChangeForBrain(fn);
|
|
13558
|
+
};
|
|
13460
13559
|
this.setScrolling = (scrolling) => {
|
|
13461
13560
|
const prevScrolling = this.scrolling;
|
|
13462
13561
|
this.scrolling = scrolling;
|
|
@@ -14369,6 +14468,143 @@ var MatrixBrain = class extends Logger {
|
|
|
14369
14468
|
updateRenderCount(which = ALL_DIRECTIONS) {
|
|
14370
14469
|
this.reset(which);
|
|
14371
14470
|
this.doUpdateRenderCount(which);
|
|
14471
|
+
this.updateLargeContent();
|
|
14472
|
+
}
|
|
14473
|
+
// -------------------------------------------------------------------------
|
|
14474
|
+
// very large content - see largeContent.ts for the why and the how
|
|
14475
|
+
// -------------------------------------------------------------------------
|
|
14476
|
+
/**
|
|
14477
|
+
* The axes on which this brain handles content larger than the browser
|
|
14478
|
+
* can lay out. The normal layout: vertical (horizontal offsets come from
|
|
14479
|
+
* column CSS vars computed by the table, not from the brain).
|
|
14480
|
+
*/
|
|
14481
|
+
supportsLargeContent(direction) {
|
|
14482
|
+
return direction === "vertical";
|
|
14483
|
+
}
|
|
14484
|
+
/**
|
|
14485
|
+
* Where the origin can be placed - see HorizontalLayoutMatrixBrain, which
|
|
14486
|
+
* needs whole pages
|
|
14487
|
+
*/
|
|
14488
|
+
alignScrollOrigin(_direction, value) {
|
|
14489
|
+
return Math.floor(value);
|
|
14490
|
+
}
|
|
14491
|
+
updateLargeContent() {
|
|
14492
|
+
const size = this.getVirtualizedContentSize();
|
|
14493
|
+
const vertical = this.supportsLargeContent("vertical") && isLargeContentSize(size.height);
|
|
14494
|
+
const horizontal = this.supportsLargeContent("horizontal") && isLargeContentSize(size.width);
|
|
14495
|
+
this.largeContent = { vertical, horizontal };
|
|
14496
|
+
this.scrollRatio = {
|
|
14497
|
+
vertical: vertical ? computeScrollRatio(size.height, this.availableHeight) : 1,
|
|
14498
|
+
horizontal: horizontal ? computeScrollRatio(size.width, this.availableWidth) : 1
|
|
14499
|
+
};
|
|
14500
|
+
this.updateScrollOrigin();
|
|
14501
|
+
}
|
|
14502
|
+
isLargeContent(direction) {
|
|
14503
|
+
return this.largeContent[direction];
|
|
14504
|
+
}
|
|
14505
|
+
/**
|
|
14506
|
+
* native scroll px -> content px (1 when the content fits)
|
|
14507
|
+
*/
|
|
14508
|
+
getScrollRatio(direction) {
|
|
14509
|
+
return this.scrollRatio[direction];
|
|
14510
|
+
}
|
|
14511
|
+
/**
|
|
14512
|
+
* The size for the scroll spacer - the content size, capped at what the
|
|
14513
|
+
* browser supports on large axes.
|
|
14514
|
+
*/
|
|
14515
|
+
getNativeScrollSize() {
|
|
14516
|
+
const size = this.getVirtualizedContentSize();
|
|
14517
|
+
const { largeContent } = this;
|
|
14518
|
+
if (!largeContent.vertical && !largeContent.horizontal) {
|
|
14519
|
+
return size;
|
|
14520
|
+
}
|
|
14521
|
+
const max = getMaxElementSize();
|
|
14522
|
+
return {
|
|
14523
|
+
width: largeContent.horizontal ? max : size.width,
|
|
14524
|
+
height: largeContent.vertical ? max : size.height
|
|
14525
|
+
};
|
|
14526
|
+
}
|
|
14527
|
+
/**
|
|
14528
|
+
* The native scroll position of the scroll container -> the content scroll
|
|
14529
|
+
* position (what the brain and the API work with)
|
|
14530
|
+
*/
|
|
14531
|
+
toContentScrollPosition(nativeScrollPosition) {
|
|
14532
|
+
const { vertical, horizontal } = this.scrollRatio;
|
|
14533
|
+
if (vertical === 1 && horizontal === 1) {
|
|
14534
|
+
return nativeScrollPosition;
|
|
14535
|
+
}
|
|
14536
|
+
return {
|
|
14537
|
+
scrollTop: nativeScrollPosition.scrollTop * vertical,
|
|
14538
|
+
scrollLeft: nativeScrollPosition.scrollLeft * horizontal
|
|
14539
|
+
};
|
|
14540
|
+
}
|
|
14541
|
+
/**
|
|
14542
|
+
* Content scroll position -> what to set on the scroll container
|
|
14543
|
+
*/
|
|
14544
|
+
toNativeScrollPosition(contentScrollPosition) {
|
|
14545
|
+
const { vertical, horizontal } = this.scrollRatio;
|
|
14546
|
+
if (vertical === 1 && horizontal === 1) {
|
|
14547
|
+
return contentScrollPosition;
|
|
14548
|
+
}
|
|
14549
|
+
return {
|
|
14550
|
+
scrollTop: contentScrollPosition.scrollTop / vertical,
|
|
14551
|
+
scrollLeft: contentScrollPosition.scrollLeft / horizontal
|
|
14552
|
+
};
|
|
14553
|
+
}
|
|
14554
|
+
/**
|
|
14555
|
+
* DOM offsets (transforms, CSS vars) are relative to this. Always 0,0
|
|
14556
|
+
* unless the content is large.
|
|
14557
|
+
*/
|
|
14558
|
+
getScrollOrigin() {
|
|
14559
|
+
return this.scrollOrigin;
|
|
14560
|
+
}
|
|
14561
|
+
/**
|
|
14562
|
+
* The scroll position relative to the scroll origin - this is what
|
|
14563
|
+
* transforms that follow the scroll position should use.
|
|
14564
|
+
*/
|
|
14565
|
+
getDOMScrollPosition(scrollPosition = this.getScrollPosition()) {
|
|
14566
|
+
const origin2 = this.getScrollOrigin();
|
|
14567
|
+
if (!origin2.scrollTop && !origin2.scrollLeft) {
|
|
14568
|
+
return scrollPosition;
|
|
14569
|
+
}
|
|
14570
|
+
return {
|
|
14571
|
+
scrollTop: scrollPosition.scrollTop - origin2.scrollTop,
|
|
14572
|
+
scrollLeft: scrollPosition.scrollLeft - origin2.scrollLeft
|
|
14573
|
+
};
|
|
14574
|
+
}
|
|
14575
|
+
// a method (not an arrow property) so subclasses can call it via super
|
|
14576
|
+
onScrollOriginChangeForBrain(fn) {
|
|
14577
|
+
this.onScrollOriginChangeFns.add(fn);
|
|
14578
|
+
return () => {
|
|
14579
|
+
this.onScrollOriginChangeFns.delete(fn);
|
|
14580
|
+
};
|
|
14581
|
+
}
|
|
14582
|
+
updateScrollOrigin() {
|
|
14583
|
+
const { scrollPosition, largeContent, scrollOrigin } = this;
|
|
14584
|
+
const alignVertical = (value) => this.alignScrollOrigin("vertical", value);
|
|
14585
|
+
const alignHorizontal = (value) => this.alignScrollOrigin("horizontal", value);
|
|
14586
|
+
const scrollTop2 = largeContent.vertical ? computeScrollOrigin(
|
|
14587
|
+
scrollPosition.scrollTop,
|
|
14588
|
+
alignVertical(scrollOrigin.scrollTop),
|
|
14589
|
+
alignVertical
|
|
14590
|
+
) : 0;
|
|
14591
|
+
const scrollLeft2 = largeContent.horizontal ? computeScrollOrigin(
|
|
14592
|
+
scrollPosition.scrollLeft,
|
|
14593
|
+
alignHorizontal(scrollOrigin.scrollLeft),
|
|
14594
|
+
alignHorizontal
|
|
14595
|
+
) : 0;
|
|
14596
|
+
if (scrollTop2 === scrollOrigin.scrollTop && scrollLeft2 === scrollOrigin.scrollLeft) {
|
|
14597
|
+
return;
|
|
14598
|
+
}
|
|
14599
|
+
this.scrollOrigin = { scrollTop: scrollTop2, scrollLeft: scrollLeft2 };
|
|
14600
|
+
this.notifyScrollOriginChange();
|
|
14601
|
+
}
|
|
14602
|
+
notifyScrollOriginChange() {
|
|
14603
|
+
if (this.destroyed) {
|
|
14604
|
+
return;
|
|
14605
|
+
}
|
|
14606
|
+
const origin2 = this.getScrollOrigin();
|
|
14607
|
+
this.onScrollOriginChangeFns.forEach((fn) => fn(origin2));
|
|
14372
14608
|
}
|
|
14373
14609
|
doUpdateRenderCount(which = ALL_DIRECTIONS) {
|
|
14374
14610
|
if (!this.availableWidth || !this.availableHeight) {
|
|
@@ -14400,6 +14636,7 @@ var MatrixBrain = class extends Logger {
|
|
|
14400
14636
|
const changeVertical = scrollPosition.scrollTop !== this.scrollPosition.scrollTop;
|
|
14401
14637
|
this.scrollPosition = scrollPosition;
|
|
14402
14638
|
if (changeHorizontal || changeVertical) {
|
|
14639
|
+
this.updateScrollOrigin();
|
|
14403
14640
|
callback?.(scrollPosition);
|
|
14404
14641
|
this.updateRenderRange({
|
|
14405
14642
|
horizontal: changeHorizontal,
|
|
@@ -14589,6 +14826,7 @@ var MatrixBrain = class extends Logger {
|
|
|
14589
14826
|
this.onScrollStartFns = [];
|
|
14590
14827
|
this.onScrollStopFns = [];
|
|
14591
14828
|
this.onRenderCountChangeFns.clear();
|
|
14829
|
+
this.onScrollOriginChangeFns.clear();
|
|
14592
14830
|
this.onRenderRangeChangeFns.clear();
|
|
14593
14831
|
this.onVerticalRenderRangeChangeFns.clear();
|
|
14594
14832
|
this.onHorizontalRenderRangeChangeFns.clear();
|
|
@@ -15124,6 +15362,9 @@ var GridRenderer = class extends Logger {
|
|
|
15124
15362
|
scrollTop: scrollTop2,
|
|
15125
15363
|
scrollLeft: scrollLeft2
|
|
15126
15364
|
}) => {
|
|
15365
|
+
if (!scrollTop2) {
|
|
15366
|
+
y -= this.brain.getScrollOrigin().scrollTop;
|
|
15367
|
+
}
|
|
15127
15368
|
element.style.setProperty(
|
|
15128
15369
|
currentTransformY,
|
|
15129
15370
|
scrollTop2 ? `calc( ${y}px + var(${scrollTopCSSVar}) )` : `${y}px`
|
|
@@ -15140,7 +15381,7 @@ var GridRenderer = class extends Logger {
|
|
|
15140
15381
|
}, zIndex2) => {
|
|
15141
15382
|
const columnOffsetX = InternalVarUtils.columnOffsets.get(colIndex);
|
|
15142
15383
|
const columnOffsetXWhileReordering = `${columnOffsetAtIndexWhileReordering2}-${colIndex}`;
|
|
15143
|
-
const currentTransformYValue = scrollTop2 ? `calc( ${y}px + var(${scrollTopCSSVar}) )` : `${y}px`;
|
|
15384
|
+
const currentTransformYValue = scrollTop2 ? `calc( ${y}px + var(${scrollTopCSSVar}) )` : `${y - this.brain.getScrollOrigin().scrollTop}px`;
|
|
15144
15385
|
if (element.__currentTransformY !== currentTransformYValue) {
|
|
15145
15386
|
element.__currentTransformY = currentTransformYValue;
|
|
15146
15387
|
element.style.setProperty(currentTransformY, currentTransformYValue);
|
|
@@ -15153,6 +15394,24 @@ var GridRenderer = class extends Logger {
|
|
|
15153
15394
|
if (zIndex2 != null) {
|
|
15154
15395
|
}
|
|
15155
15396
|
};
|
|
15397
|
+
/**
|
|
15398
|
+
* The scroll origin moved (huge content only - see largeContent.ts): every
|
|
15399
|
+
* rendered cell / detail row is positioned relative to it, so they all
|
|
15400
|
+
* need to be repositioned now - synchronously, so it's in the same frame
|
|
15401
|
+
* as the scroll layer transform, which uses the new origin too.
|
|
15402
|
+
*/
|
|
15403
|
+
this.onScrollOriginChange = () => {
|
|
15404
|
+
if (this.destroyed) {
|
|
15405
|
+
return;
|
|
15406
|
+
}
|
|
15407
|
+
this.cellManager.getAllCells().forEach((cell) => {
|
|
15408
|
+
this.updateElementPosition(cell, void 0, { immediate: true });
|
|
15409
|
+
});
|
|
15410
|
+
this.rowManager.forEachAttachedRow((row) => {
|
|
15411
|
+
this.updateDetailElementPosition(row);
|
|
15412
|
+
});
|
|
15413
|
+
this.adjustFixedElementsOnScroll();
|
|
15414
|
+
};
|
|
15156
15415
|
this.getFullyVisibleRowsRange = () => {
|
|
15157
15416
|
let {
|
|
15158
15417
|
start: [startRow],
|
|
@@ -15620,7 +15879,7 @@ var GridRenderer = class extends Logger {
|
|
|
15620
15879
|
this.hoverRowUpdatesInProgress.delete(rowIndex);
|
|
15621
15880
|
});
|
|
15622
15881
|
};
|
|
15623
|
-
this.updateElementPosition = (cell, options) => {
|
|
15882
|
+
this.updateElementPosition = (cell, options, config) => {
|
|
15624
15883
|
if (this.destroyed) {
|
|
15625
15884
|
return;
|
|
15626
15885
|
}
|
|
@@ -15661,7 +15920,7 @@ var GridRenderer = class extends Logger {
|
|
|
15661
15920
|
itemElement.style.top = `${y}px`;
|
|
15662
15921
|
}
|
|
15663
15922
|
};
|
|
15664
|
-
if (this.scrolling && this.brain.isHorizontalLayoutBrain) {
|
|
15923
|
+
if (this.scrolling && this.brain.isHorizontalLayoutBrain && !config?.immediate) {
|
|
15665
15924
|
cell.setPendingAfterCommitWork(applyPosition);
|
|
15666
15925
|
} else {
|
|
15667
15926
|
applyPosition();
|
|
@@ -15690,7 +15949,7 @@ var GridRenderer = class extends Logger {
|
|
|
15690
15949
|
if (ITEM_POSITION_WITH_TRANSFORM) {
|
|
15691
15950
|
this.setDetailTransform(itemElement, rowIndex, {
|
|
15692
15951
|
y,
|
|
15693
|
-
scrollLeft: this.brain.
|
|
15952
|
+
scrollLeft: this.brain.getDOMScrollPosition().scrollLeft
|
|
15694
15953
|
});
|
|
15695
15954
|
itemElement.style.willChange = "transform";
|
|
15696
15955
|
itemElement.style.backfaceVisibility = "hidden";
|
|
@@ -15708,6 +15967,7 @@ var GridRenderer = class extends Logger {
|
|
|
15708
15967
|
};
|
|
15709
15968
|
this.onScrollStop = () => {
|
|
15710
15969
|
this.scrolling = false;
|
|
15970
|
+
this.flushPendingAfterCommitWork();
|
|
15711
15971
|
if (this.lastEnteredRow != -1) {
|
|
15712
15972
|
this.addHoverClass(this.lastEnteredRow);
|
|
15713
15973
|
}
|
|
@@ -15734,7 +15994,7 @@ var GridRenderer = class extends Logger {
|
|
|
15734
15994
|
}
|
|
15735
15995
|
this.setDetailTransform(node, rowIndex, {
|
|
15736
15996
|
y,
|
|
15737
|
-
scrollLeft: scrollPosition.scrollLeft
|
|
15997
|
+
scrollLeft: brain.getDOMScrollPosition(scrollPosition).scrollLeft
|
|
15738
15998
|
});
|
|
15739
15999
|
}
|
|
15740
16000
|
});
|
|
@@ -15745,7 +16005,9 @@ var GridRenderer = class extends Logger {
|
|
|
15745
16005
|
const attachedCell = this.cellManager.getOneAttachedCell();
|
|
15746
16006
|
if (attachedCell) {
|
|
15747
16007
|
setInfiniteScrollPosition(
|
|
15748
|
-
|
|
16008
|
+
// fixed cells are positioned with these, inside the scroll layer
|
|
16009
|
+
// which is translated relative to the scroll origin
|
|
16010
|
+
brain.getDOMScrollPosition(scrollPosition),
|
|
15749
16011
|
this.getInfiniteNode(attachedCell.getElement())
|
|
15750
16012
|
);
|
|
15751
16013
|
}
|
|
@@ -15967,7 +16229,11 @@ var GridRenderer = class extends Logger {
|
|
|
15967
16229
|
});
|
|
15968
16230
|
const removeOnScrollStart = brain.onScrollStart(this.onScrollStart);
|
|
15969
16231
|
const removeOnScrollStop = brain.onScrollStop(this.onScrollStop);
|
|
16232
|
+
const removeOnScrollOriginChange = brain.onScrollOriginChange(
|
|
16233
|
+
this.onScrollOriginChange
|
|
16234
|
+
);
|
|
15970
16235
|
this.onDestroy = () => {
|
|
16236
|
+
removeOnScrollOriginChange();
|
|
15971
16237
|
removeOnScroll();
|
|
15972
16238
|
removeOnSizeChange();
|
|
15973
16239
|
removeOnScrollStart();
|
|
@@ -16321,9 +16587,7 @@ var HorizontalLayoutTableRenderer = class extends GridRenderer {
|
|
|
16321
16587
|
colIndex
|
|
16322
16588
|
);
|
|
16323
16589
|
const { y } = options;
|
|
16324
|
-
const pageIndex = Math.floor(
|
|
16325
|
-
horizontalLayoutCoords.rowIndex / this.brain.rowsPerPage
|
|
16326
|
-
);
|
|
16590
|
+
const pageIndex = Math.floor(horizontalLayoutCoords.rowIndex / this.brain.rowsPerPage) - this.brain.getScrollOriginPageIndex();
|
|
16327
16591
|
const pageWidth = ThemeVars.runtime.totalVisibleColumnsWidthVar;
|
|
16328
16592
|
const pageOffset = pageIndex ? `calc(${pageWidth} * ${pageIndex})` : "0px";
|
|
16329
16593
|
const columnOffsetX = InternalVarUtils.columnOffsets.get(
|
|
@@ -16962,6 +17226,58 @@ var ActiveIndicatorWrapperCls = "nxbq1c0 _16lm1iwz _16lm1iw4 _16lm1iw26 _16lm1iw
|
|
|
16962
17226
|
// src/components/InfiniteTable/components/ActiveRowIndicator.css.ts
|
|
16963
17227
|
var ActiveRowIndicatorRecipe = createRuntimeFn({ defaultClassName: "j26lrx0 _16lm1iwz _16lm1iw2 _16lm1iw23 _16lm1iw26", variantClassNames: { active: { true: "j26lrx2", false: "j26lrx3" } }, defaultVariants: {}, compoundVariants: [] });
|
|
16964
17228
|
|
|
17229
|
+
// src/components/InfiniteTable/components/activeIndicatorOffsets.ts
|
|
17230
|
+
function getPageOffsetX(brain, pageIndex) {
|
|
17231
|
+
const relativePageIndex = pageIndex - brain.getScrollOriginPageIndex();
|
|
17232
|
+
return relativePageIndex ? `calc(${ThemeVars.runtime.totalVisibleColumnsWidthVar} * ${relativePageIndex})` : null;
|
|
17233
|
+
}
|
|
17234
|
+
function getActiveRowIndicatorVars(brain, activeRowIndex) {
|
|
17235
|
+
let activeCellRowOffsetX = "0px";
|
|
17236
|
+
let rowIndex = activeRowIndex;
|
|
17237
|
+
if (brain.isHorizontalLayoutBrain && brain.rowsPerPage) {
|
|
17238
|
+
activeCellRowOffsetX = getPageOffsetX(brain, brain.getPageIndexForRow(rowIndex)) ?? "0px";
|
|
17239
|
+
rowIndex = rowIndex % brain.rowsPerPage;
|
|
17240
|
+
}
|
|
17241
|
+
const activeCellRowHeight = brain.getRowHeight(rowIndex);
|
|
17242
|
+
const activeCellRowOffset = brain.getItemOffsetFor(rowIndex, "vertical") - brain.getScrollOrigin().scrollTop;
|
|
17243
|
+
return {
|
|
17244
|
+
activeCellRowHeight: `${activeCellRowHeight}px`,
|
|
17245
|
+
activeCellRowOffset: `${activeCellRowOffset}px`,
|
|
17246
|
+
activeCellRowOffsetX
|
|
17247
|
+
};
|
|
17248
|
+
}
|
|
17249
|
+
function getActiveRowIndicatorScrollVars(brain, scrollPosition) {
|
|
17250
|
+
const { scrollTop: scrollTop2, scrollLeft: scrollLeft2 } = brain.getDOMScrollPosition(scrollPosition);
|
|
17251
|
+
return {
|
|
17252
|
+
scrollTopForActiveRow: `${-scrollTop2}px`,
|
|
17253
|
+
scrollLeftForActiveRowWhenHorizontalLayout: brain.isHorizontalLayoutBrain ? `${-scrollLeft2}px` : "0px"
|
|
17254
|
+
};
|
|
17255
|
+
}
|
|
17256
|
+
function getActiveCellIndicatorVars(brain, activeCellIndex, rowHeight) {
|
|
17257
|
+
let [rowIndex] = activeCellIndex;
|
|
17258
|
+
const colIndex = activeCellIndex[1];
|
|
17259
|
+
let activeCellColOffset2;
|
|
17260
|
+
if (brain.isHorizontalLayoutBrain && brain.rowsPerPage) {
|
|
17261
|
+
const columnOffset = InternalVarUtils.columnOffsets.get(colIndex);
|
|
17262
|
+
const pageOffset = getPageOffsetX(
|
|
17263
|
+
brain,
|
|
17264
|
+
brain.getPageIndexForRow(rowIndex)
|
|
17265
|
+
);
|
|
17266
|
+
activeCellColOffset2 = pageOffset ? `calc( ${pageOffset} + ${columnOffset})` : columnOffset;
|
|
17267
|
+
rowIndex = rowIndex % brain.rowsPerPage;
|
|
17268
|
+
}
|
|
17269
|
+
const activeCellRowHeight = typeof rowHeight === "function" ? rowHeight(rowIndex) : rowHeight ?? brain.getRowHeight(rowIndex);
|
|
17270
|
+
const activeCellRowOffset = brain.getItemOffsetFor(rowIndex, "vertical") - brain.getScrollOrigin().scrollTop;
|
|
17271
|
+
const vars = {
|
|
17272
|
+
activeCellRowHeight: `${activeCellRowHeight}px`,
|
|
17273
|
+
activeCellRowOffset: `${activeCellRowOffset}px`
|
|
17274
|
+
};
|
|
17275
|
+
if (activeCellColOffset2 !== void 0) {
|
|
17276
|
+
vars.activeCellColOffset = activeCellColOffset2;
|
|
17277
|
+
}
|
|
17278
|
+
return vars;
|
|
17279
|
+
}
|
|
17280
|
+
|
|
16965
17281
|
// src/components/InfiniteTable/components/ActiveRowIndicator.tsx
|
|
16966
17282
|
var { rootClassName: rootClassName6 } = internalProps;
|
|
16967
17283
|
var baseCls = `${rootClassName6}-ActiveRowIndicator`;
|
|
@@ -16979,43 +17295,32 @@ var ActiveRowIndicatorFn = (props) => {
|
|
|
16979
17295
|
const domRef = (0, import_react30.useRef)(null);
|
|
16980
17296
|
const active = props.activeRowIndex != null && brain.getInitialRows() > props.activeRowIndex;
|
|
16981
17297
|
const [_rerenderId, rerender] = useRerender();
|
|
16982
|
-
(0, import_react30.
|
|
16983
|
-
|
|
17298
|
+
const activeRowIndexRef = (0, import_react30.useRef)(props.activeRowIndex);
|
|
17299
|
+
activeRowIndexRef.current = props.activeRowIndex;
|
|
17300
|
+
const reposition2 = () => {
|
|
17301
|
+
const activeRowIndex = activeRowIndexRef.current;
|
|
17302
|
+
if (activeRowIndex == null || !domRef.current) {
|
|
16984
17303
|
return;
|
|
16985
17304
|
}
|
|
16986
|
-
|
|
16987
|
-
|
|
16988
|
-
|
|
16989
|
-
|
|
16990
|
-
|
|
16991
|
-
|
|
16992
|
-
}
|
|
16993
|
-
rowIndex = rowIndex % brain.rowsPerPage;
|
|
16994
|
-
}
|
|
16995
|
-
const activeCellRowHeight = brain.getRowHeight(rowIndex);
|
|
16996
|
-
const activeCellRowOffset = brain.getItemOffsetFor(rowIndex, "vertical");
|
|
16997
|
-
const node = domRef.current;
|
|
16998
|
-
const vars = {
|
|
16999
|
-
activeCellRowHeight: `${activeCellRowHeight}px`,
|
|
17000
|
-
activeCellRowOffset: `${activeCellRowOffset}px`,
|
|
17001
|
-
activeCellRowOffsetX
|
|
17002
|
-
};
|
|
17003
|
-
setInfiniteVarsOnNode(vars, node);
|
|
17004
|
-
}, [props.activeRowIndex, brain]);
|
|
17305
|
+
setInfiniteVarsOnNode(
|
|
17306
|
+
getActiveRowIndicatorVars(brain, activeRowIndex),
|
|
17307
|
+
domRef.current
|
|
17308
|
+
);
|
|
17309
|
+
};
|
|
17310
|
+
(0, import_react30.useLayoutEffect)(reposition2, [props.activeRowIndex, brain]);
|
|
17005
17311
|
(0, import_react30.useEffect)(() => {
|
|
17006
17312
|
const updateVars = (scrollPosition) => {
|
|
17007
17313
|
setInfiniteVarsOnNode(
|
|
17008
|
-
|
|
17009
|
-
scrollTopForActiveRow: `${-scrollPosition.scrollTop}px`,
|
|
17010
|
-
scrollLeftForActiveRowWhenHorizontalLayout: brain.isHorizontalLayoutBrain ? `${-scrollPosition.scrollLeft}px` : "0px"
|
|
17011
|
-
},
|
|
17314
|
+
getActiveRowIndicatorScrollVars(brain, scrollPosition),
|
|
17012
17315
|
domRef.current
|
|
17013
17316
|
);
|
|
17014
17317
|
};
|
|
17015
17318
|
updateVars(brain.getScrollPosition());
|
|
17016
17319
|
const removeOnScroll = brain.onScroll(updateVars);
|
|
17017
17320
|
const removeOnRenderCountChange = brain.onRenderCountChange(rerender);
|
|
17321
|
+
const removeOnScrollOriginChange = brain.onScrollOriginChange(reposition2);
|
|
17018
17322
|
return () => {
|
|
17323
|
+
removeOnScrollOriginChange();
|
|
17019
17324
|
removeOnRenderCountChange();
|
|
17020
17325
|
removeOnScroll();
|
|
17021
17326
|
};
|
|
@@ -17049,19 +17354,9 @@ var reposition = (brain, activeCellIndex, rowHeight, domRef) => {
|
|
|
17049
17354
|
if (activeCellIndex == null) {
|
|
17050
17355
|
return;
|
|
17051
17356
|
}
|
|
17052
|
-
let [rowIndex] = activeCellIndex;
|
|
17053
|
-
if (brain.isHorizontalLayoutBrain && brain.rowsPerPage) {
|
|
17054
|
-
rowIndex = rowIndex % brain.rowsPerPage;
|
|
17055
|
-
}
|
|
17056
|
-
const activeCellRowHeight = typeof rowHeight === "function" ? rowHeight(rowIndex) : rowHeight ?? brain.getRowHeight(rowIndex);
|
|
17057
|
-
const activeCellRowOffset = brain.getItemOffsetFor(rowIndex, "vertical");
|
|
17058
|
-
const node = domRef.current;
|
|
17059
17357
|
setInfiniteVarsOnNode(
|
|
17060
|
-
|
|
17061
|
-
|
|
17062
|
-
activeCellRowOffset: `${activeCellRowOffset}px`
|
|
17063
|
-
},
|
|
17064
|
-
node
|
|
17358
|
+
getActiveCellIndicatorVars(brain, activeCellIndex, rowHeight),
|
|
17359
|
+
domRef.current
|
|
17065
17360
|
);
|
|
17066
17361
|
};
|
|
17067
17362
|
var ActiveCellIndicatorFn = (props) => {
|
|
@@ -17072,12 +17367,19 @@ var ActiveCellIndicatorFn = (props) => {
|
|
|
17072
17367
|
(0, import_react31.useLayoutEffect)(() => {
|
|
17073
17368
|
reposition(brain, props.activeCellIndex, props.rowHeight, domRef);
|
|
17074
17369
|
}, [props.activeCellIndex, props.rowHeight, brain]);
|
|
17370
|
+
const propsRef = (0, import_react31.useRef)(props);
|
|
17371
|
+
propsRef.current = props;
|
|
17075
17372
|
(0, import_react31.useEffect)(() => {
|
|
17076
17373
|
const removeOnRenderCountChange = brain.onRenderCountChange(() => {
|
|
17077
17374
|
rerender();
|
|
17078
17375
|
});
|
|
17376
|
+
const removeOnScrollOriginChange = brain.onScrollOriginChange(() => {
|
|
17377
|
+
const { activeCellIndex, rowHeight } = propsRef.current;
|
|
17378
|
+
reposition(brain, activeCellIndex, rowHeight, domRef);
|
|
17379
|
+
});
|
|
17079
17380
|
return () => {
|
|
17080
17381
|
removeOnRenderCountChange();
|
|
17382
|
+
removeOnScrollOriginChange();
|
|
17081
17383
|
};
|
|
17082
17384
|
}, [brain]);
|
|
17083
17385
|
return (
|
|
@@ -17186,34 +17488,61 @@ function HeadlessTable(props) {
|
|
|
17186
17488
|
const remove = setupResizeObserver(node, onResize, { debounce: 50 });
|
|
17187
17489
|
return remove;
|
|
17188
17490
|
}, [wrapRowsHorizontally, brain]);
|
|
17189
|
-
const updateDOMTransform = (0, import_react32.useCallback)(
|
|
17190
|
-
|
|
17191
|
-
|
|
17491
|
+
const updateDOMTransform = (0, import_react32.useCallback)(
|
|
17492
|
+
(contentScrollPos) => {
|
|
17493
|
+
const scrollPos = brain.getDOMScrollPosition(contentScrollPos);
|
|
17494
|
+
requestAnimationFrame(() => {
|
|
17495
|
+
if (!domRef.current) {
|
|
17496
|
+
return;
|
|
17497
|
+
}
|
|
17498
|
+
domRef.current.style.setProperty(
|
|
17499
|
+
"transform",
|
|
17500
|
+
`translate3d(${-scrollPos.scrollLeft}px, ${-scrollPos.scrollTop}px, 0px)`
|
|
17501
|
+
);
|
|
17192
17502
|
return;
|
|
17193
|
-
}
|
|
17194
|
-
|
|
17195
|
-
|
|
17196
|
-
|
|
17197
|
-
);
|
|
17198
|
-
return;
|
|
17199
|
-
});
|
|
17200
|
-
}, []);
|
|
17503
|
+
});
|
|
17504
|
+
},
|
|
17505
|
+
[brain]
|
|
17506
|
+
);
|
|
17201
17507
|
const onContainerScroll = (0, import_react32.useCallback)(
|
|
17202
|
-
(
|
|
17203
|
-
brain.setScrollPosition(
|
|
17508
|
+
(nativeScrollPos) => {
|
|
17509
|
+
brain.setScrollPosition(
|
|
17510
|
+
brain.toContentScrollPosition(nativeScrollPos),
|
|
17511
|
+
updateDOMTransform
|
|
17512
|
+
);
|
|
17204
17513
|
},
|
|
17205
17514
|
[brain, updateDOMTransform]
|
|
17206
17515
|
);
|
|
17207
17516
|
(0, import_react32.useEffect)(() => {
|
|
17208
17517
|
const removeOnRenderCount = brain.onRenderCountChange(() => {
|
|
17209
|
-
setTotalScrollSize(brain.
|
|
17518
|
+
setTotalScrollSize(brain.getNativeScrollSize());
|
|
17210
17519
|
});
|
|
17211
|
-
setTotalScrollSize(brain.
|
|
17520
|
+
setTotalScrollSize(brain.getNativeScrollSize());
|
|
17212
17521
|
updateDOMTransform(
|
|
17213
17522
|
brain.getScrollPosition() || { scrollLeft: 0, scrollTop: 0 }
|
|
17214
17523
|
);
|
|
17215
17524
|
return removeOnRenderCount;
|
|
17216
17525
|
}, [brain]);
|
|
17526
|
+
const scrollRatioRef = (0, import_react32.useRef)({ brain, vertical: 1, horizontal: 1 });
|
|
17527
|
+
(0, import_react32.useLayoutEffect)(() => {
|
|
17528
|
+
const prev = scrollRatioRef.current;
|
|
17529
|
+
const vertical = brain.getScrollRatio("vertical");
|
|
17530
|
+
const horizontal = brain.getScrollRatio("horizontal");
|
|
17531
|
+
scrollRatioRef.current = { brain, vertical, horizontal };
|
|
17532
|
+
const scroller = domRef.current?.parentElement;
|
|
17533
|
+
if (!scroller || prev.brain !== brain || prev.vertical === vertical && prev.horizontal === horizontal) {
|
|
17534
|
+
return;
|
|
17535
|
+
}
|
|
17536
|
+
const nativeScrollPos = brain.toNativeScrollPosition(
|
|
17537
|
+
brain.getScrollPosition()
|
|
17538
|
+
);
|
|
17539
|
+
if (prev.vertical !== vertical) {
|
|
17540
|
+
scroller.scrollTop = nativeScrollPos.scrollTop;
|
|
17541
|
+
}
|
|
17542
|
+
if (prev.horizontal !== horizontal) {
|
|
17543
|
+
scroller.scrollLeft = nativeScrollPos.scrollLeft;
|
|
17544
|
+
}
|
|
17545
|
+
}, [scrollSize, brain]);
|
|
17217
17546
|
return /* @__PURE__ */ React41.createElement(
|
|
17218
17547
|
VirtualScrollContainer,
|
|
17219
17548
|
{
|
|
@@ -17694,11 +18023,15 @@ function InfiniteTableInternalHeaderFn(props) {
|
|
|
17694
18023
|
};
|
|
17695
18024
|
});
|
|
17696
18025
|
const domRef = (0, import_react36.useRef)(null);
|
|
17697
|
-
const updateDOMTransform = (0, import_react36.useCallback)(
|
|
17698
|
-
|
|
17699
|
-
domRef.current
|
|
17700
|
-
|
|
17701
|
-
|
|
18026
|
+
const updateDOMTransform = (0, import_react36.useCallback)(
|
|
18027
|
+
(scrollPosition) => {
|
|
18028
|
+
if (domRef.current) {
|
|
18029
|
+
const { scrollLeft: scrollLeft2 } = headerBrain.getDOMScrollPosition(scrollPosition);
|
|
18030
|
+
domRef.current.style.transform = `translate3d(${-scrollLeft2}px, 0px, 0px)`;
|
|
18031
|
+
}
|
|
18032
|
+
},
|
|
18033
|
+
[headerBrain]
|
|
18034
|
+
);
|
|
17702
18035
|
(0, import_react36.useEffect)(() => {
|
|
17703
18036
|
const removeOnScroll = headerBrain.onScroll(updateDOMTransform);
|
|
17704
18037
|
updateDOMTransform(
|
|
@@ -20876,10 +21209,10 @@ var InfiniteTableApiImpl = class {
|
|
|
20876
21209
|
return false;
|
|
20877
21210
|
}
|
|
20878
21211
|
if (newScrollPosition.scrollLeft !== currentScrollPosition.scrollLeft && !cantScrollLeft) {
|
|
20879
|
-
|
|
21212
|
+
this.setNativeScroll({ scrollLeft: newScrollPosition.scrollLeft });
|
|
20880
21213
|
}
|
|
20881
21214
|
if (newScrollPosition.scrollTop !== currentScrollPosition.scrollTop && !cantScrollTop) {
|
|
20882
|
-
|
|
21215
|
+
this.setNativeScroll({ scrollTop: newScrollPosition.scrollTop });
|
|
20883
21216
|
}
|
|
20884
21217
|
return true;
|
|
20885
21218
|
};
|
|
@@ -21310,6 +21643,29 @@ var InfiniteTableApiImpl = class {
|
|
|
21310
21643
|
get scrollContainer() {
|
|
21311
21644
|
return this.getState().scrollerDOMRef.current;
|
|
21312
21645
|
}
|
|
21646
|
+
/**
|
|
21647
|
+
* All scroll positions in the API are content positions. The scroll
|
|
21648
|
+
* container can be shorter than the content (when the content is larger
|
|
21649
|
+
* than what browsers support), so writes go through the brain's ratio -
|
|
21650
|
+
* see VirtualBrain/largeContent.ts. Identity when the content fits.
|
|
21651
|
+
*/
|
|
21652
|
+
setNativeScroll(contentScroll) {
|
|
21653
|
+
const state = this.getState();
|
|
21654
|
+
const scroller = state.scrollerDOMRef.current;
|
|
21655
|
+
if (!scroller) {
|
|
21656
|
+
return;
|
|
21657
|
+
}
|
|
21658
|
+
const native = state.brain.toNativeScrollPosition({
|
|
21659
|
+
scrollTop: contentScroll.scrollTop ?? 0,
|
|
21660
|
+
scrollLeft: contentScroll.scrollLeft ?? 0
|
|
21661
|
+
});
|
|
21662
|
+
if (contentScroll.scrollTop !== void 0) {
|
|
21663
|
+
scroller.scrollTop = native.scrollTop;
|
|
21664
|
+
}
|
|
21665
|
+
if (contentScroll.scrollLeft !== void 0) {
|
|
21666
|
+
scroller.scrollLeft = native.scrollLeft;
|
|
21667
|
+
}
|
|
21668
|
+
}
|
|
21313
21669
|
get scrollLeftMax() {
|
|
21314
21670
|
const scrollLeftMax = this.getState().brain.scrollLeftMax;
|
|
21315
21671
|
return scrollLeftMax;
|
|
@@ -21323,20 +21679,14 @@ var InfiniteTableApiImpl = class {
|
|
|
21323
21679
|
return state.brain.getScrollPosition().scrollLeft;
|
|
21324
21680
|
}
|
|
21325
21681
|
set scrollLeft(scrollLeft2) {
|
|
21326
|
-
|
|
21327
|
-
if (state.scrollerDOMRef.current) {
|
|
21328
|
-
state.scrollerDOMRef.current.scrollLeft = Math.max(scrollLeft2, 0);
|
|
21329
|
-
}
|
|
21682
|
+
this.setNativeScroll({ scrollLeft: Math.max(scrollLeft2, 0) });
|
|
21330
21683
|
}
|
|
21331
21684
|
get scrollTop() {
|
|
21332
21685
|
const state = this.getState();
|
|
21333
21686
|
return state.brain.getScrollPosition().scrollTop;
|
|
21334
21687
|
}
|
|
21335
21688
|
set scrollTop(scrollTop2) {
|
|
21336
|
-
|
|
21337
|
-
if (state.scrollerDOMRef.current) {
|
|
21338
|
-
state.scrollerDOMRef.current.scrollTop = Math.max(scrollTop2, 0);
|
|
21339
|
-
}
|
|
21689
|
+
this.setNativeScroll({ scrollTop: Math.max(scrollTop2, 0) });
|
|
21340
21690
|
}
|
|
21341
21691
|
scrollRowIntoView(rowIndex, config = { offset: 0 }) {
|
|
21342
21692
|
const state = this.getState();
|
|
@@ -21362,10 +21712,10 @@ var InfiniteTableApiImpl = class {
|
|
|
21362
21712
|
return false;
|
|
21363
21713
|
}
|
|
21364
21714
|
if (scrollTopValid && scrollPosition.scrollTop !== currentScrollPosition.scrollTop) {
|
|
21365
|
-
|
|
21715
|
+
this.setNativeScroll({ scrollTop: scrollPosition.scrollTop });
|
|
21366
21716
|
}
|
|
21367
21717
|
if (scrollLeftChanged) {
|
|
21368
|
-
|
|
21718
|
+
this.setNativeScroll({ scrollLeft: scrollPosition.scrollLeft });
|
|
21369
21719
|
}
|
|
21370
21720
|
return true;
|
|
21371
21721
|
}
|
|
@@ -21387,7 +21737,7 @@ var InfiniteTableApiImpl = class {
|
|
|
21387
21737
|
return false;
|
|
21388
21738
|
}
|
|
21389
21739
|
if (scrollPosition.scrollLeft !== currentScrollPosition.scrollLeft) {
|
|
21390
|
-
|
|
21740
|
+
this.setNativeScroll({ scrollLeft: scrollPosition.scrollLeft });
|
|
21391
21741
|
}
|
|
21392
21742
|
return true;
|
|
21393
21743
|
}
|
|
@@ -26629,6 +26979,12 @@ var HorizontalLayoutMatrixBrain = class extends MatrixBrain {
|
|
|
26629
26979
|
this.onTotalPageCountChangeFns.delete(fn);
|
|
26630
26980
|
};
|
|
26631
26981
|
};
|
|
26982
|
+
this.onScrollOriginChange = (fn) => {
|
|
26983
|
+
if (this.options?.masterBrain) {
|
|
26984
|
+
return this.options.masterBrain.onScrollOriginChange(fn);
|
|
26985
|
+
}
|
|
26986
|
+
return super.onScrollOriginChangeForBrain(fn);
|
|
26987
|
+
};
|
|
26632
26988
|
this.options = opts;
|
|
26633
26989
|
if (this.options.masterBrain) {
|
|
26634
26990
|
this.options.masterBrain.onTotalPageCountChange(() => {
|
|
@@ -26870,6 +27226,46 @@ var HorizontalLayoutMatrixBrain = class extends MatrixBrain {
|
|
|
26870
27226
|
this.options.masterBrain = void 0;
|
|
26871
27227
|
this.onTotalPageCountChangeFns.clear();
|
|
26872
27228
|
}
|
|
27229
|
+
// -------------------------------------------------------------------------
|
|
27230
|
+
// very large content - see largeContent.ts
|
|
27231
|
+
//
|
|
27232
|
+
// Here the rows become width (pageWidth x totalPageCount) while the height
|
|
27233
|
+
// always fits the viewport, so it's the horizontal axis that can get larger
|
|
27234
|
+
// than the browser supports - with way fewer rows than in the normal layout.
|
|
27235
|
+
// -------------------------------------------------------------------------
|
|
27236
|
+
supportsLargeContent(direction) {
|
|
27237
|
+
return direction === "horizontal";
|
|
27238
|
+
}
|
|
27239
|
+
/**
|
|
27240
|
+
* The horizontal origin is a whole number of pages: cells are positioned at
|
|
27241
|
+
* `calc(pageWidth * (pageIndex - originPageIndex))`, with pageWidth being a
|
|
27242
|
+
* CSS var (so column resizes keep working without rewriting every cell).
|
|
27243
|
+
*/
|
|
27244
|
+
alignScrollOrigin(direction, value) {
|
|
27245
|
+
if (direction === "vertical" || !this.pageWidth) {
|
|
27246
|
+
return Math.floor(value);
|
|
27247
|
+
}
|
|
27248
|
+
return Math.floor(value / this.pageWidth) * this.pageWidth;
|
|
27249
|
+
}
|
|
27250
|
+
/**
|
|
27251
|
+
* The page at the horizontal scroll origin - page offsets in the DOM are
|
|
27252
|
+
* relative to it.
|
|
27253
|
+
*/
|
|
27254
|
+
getScrollOriginPageIndex() {
|
|
27255
|
+
const pageWidth = this.getPageWidth();
|
|
27256
|
+
return pageWidth ? Math.round(this.getScrollOrigin().scrollLeft / pageWidth) : 0;
|
|
27257
|
+
}
|
|
27258
|
+
// the header brain follows the body brain (its master) - same origin, so
|
|
27259
|
+
// the header and the body cells stay aligned
|
|
27260
|
+
getScrollOrigin() {
|
|
27261
|
+
return this.options?.masterBrain ? this.options.masterBrain.getScrollOrigin() : super.getScrollOrigin();
|
|
27262
|
+
}
|
|
27263
|
+
updateScrollOrigin() {
|
|
27264
|
+
if (this.options?.masterBrain) {
|
|
27265
|
+
return;
|
|
27266
|
+
}
|
|
27267
|
+
super.updateScrollOrigin();
|
|
27268
|
+
}
|
|
26873
27269
|
getVirtualizedContentSizeFor(direction) {
|
|
26874
27270
|
if (direction === "vertical") {
|
|
26875
27271
|
const rowHeight = this.getInitialRowHeight();
|
|
@@ -27033,6 +27429,8 @@ var forwardProps4 = (_setupState) => {
|
|
|
27033
27429
|
getColumnMenuItems: 1,
|
|
27034
27430
|
getCellContextMenuItems: 1,
|
|
27035
27431
|
getContextMenuItems: 1,
|
|
27432
|
+
menuPortalContainer: 1,
|
|
27433
|
+
menuConstrainTo: 1,
|
|
27036
27434
|
columnPinning: 1,
|
|
27037
27435
|
editable: 1,
|
|
27038
27436
|
columnDefaultEditable: 1,
|
|
@@ -28777,7 +29175,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
28777
29175
|
}
|
|
28778
29176
|
let valid2 = isValidLicense(licenseKey, {
|
|
28779
29177
|
publishedAt: 1624970570587,
|
|
28780
|
-
version: "10.1.
|
|
29178
|
+
version: "10.1.4"
|
|
28781
29179
|
});
|
|
28782
29180
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
28783
29181
|
return true;
|
|
@@ -29486,7 +29884,7 @@ function useDOMEventHandlers() {
|
|
|
29486
29884
|
}
|
|
29487
29885
|
|
|
29488
29886
|
// src/components/InfiniteTable/hooks/useColumnMenu.ts
|
|
29489
|
-
var
|
|
29887
|
+
var import_react60 = require("react");
|
|
29490
29888
|
|
|
29491
29889
|
// src/components/hooks/useOverlay/index.tsx
|
|
29492
29890
|
var React57 = __toESM(require("react"));
|
|
@@ -29745,7 +30143,9 @@ function useOverlayPortal(content, portalContainer) {
|
|
|
29745
30143
|
}
|
|
29746
30144
|
getContainer();
|
|
29747
30145
|
}, [portalContainer]);
|
|
29748
|
-
|
|
30146
|
+
const currentContainer = typeof portalContainer === "function" ? portalContainer() : null;
|
|
30147
|
+
const targetContainer = isHTMLElement2(currentContainer) ? currentContainer : container;
|
|
30148
|
+
return portalContainer ? targetContainer ? (0, import_react_dom3.createPortal)(content, targetContainer) : (
|
|
29749
30149
|
// we're probably still fetching the container
|
|
29750
30150
|
/* @__PURE__ */ React57.createElement(React57.Fragment, null)
|
|
29751
30151
|
) : portalContainer === null || portalContainer === false ? content : /* @__PURE__ */ React57.createElement(DefaultOverlayPortal, null, content);
|
|
@@ -31099,6 +31499,41 @@ function getMenuForColumn(columnId, context, onHideIntent) {
|
|
|
31099
31499
|
);
|
|
31100
31500
|
}
|
|
31101
31501
|
|
|
31502
|
+
// src/components/InfiniteTable/utils/menuOverlayTargets.ts
|
|
31503
|
+
function resolveMenuElement(element) {
|
|
31504
|
+
return typeof element === "function" ? element() : element;
|
|
31505
|
+
}
|
|
31506
|
+
function getMenuConstrainTo(state) {
|
|
31507
|
+
return resolveMenuElement(state.menuConstrainTo) ?? state.domRef.current;
|
|
31508
|
+
}
|
|
31509
|
+
function getMenuPortalContainer(getState, menuPortalContainer, defaultContainer) {
|
|
31510
|
+
if (!menuPortalContainer) {
|
|
31511
|
+
return defaultContainer || false;
|
|
31512
|
+
}
|
|
31513
|
+
return () => resolveMenuElement(menuPortalContainer) ?? (defaultContainer || getState().portalDOMRef.current);
|
|
31514
|
+
}
|
|
31515
|
+
|
|
31516
|
+
// src/components/InfiniteTable/hooks/useMenuPortalContainer.ts
|
|
31517
|
+
var import_react59 = require("react");
|
|
31518
|
+
function useMenuPortalContainer() {
|
|
31519
|
+
const { getState, menuPortalContainer } = useInfiniteTableSelector((ctx) => {
|
|
31520
|
+
return {
|
|
31521
|
+
getState: ctx.getState,
|
|
31522
|
+
menuPortalContainer: ctx.state.menuPortalContainer
|
|
31523
|
+
};
|
|
31524
|
+
});
|
|
31525
|
+
const { portalDOMRef } = useDataSourceMasterDetailSelector((ctx) => {
|
|
31526
|
+
return {
|
|
31527
|
+
portalDOMRef: ctx.getMasterState().portalDOMRef
|
|
31528
|
+
};
|
|
31529
|
+
}) || {};
|
|
31530
|
+
const defaultContainer = portalDOMRef?.current;
|
|
31531
|
+
return (0, import_react59.useMemo)(
|
|
31532
|
+
() => getMenuPortalContainer(getState, menuPortalContainer, defaultContainer),
|
|
31533
|
+
[getState, menuPortalContainer, defaultContainer]
|
|
31534
|
+
);
|
|
31535
|
+
}
|
|
31536
|
+
|
|
31102
31537
|
// src/components/InfiniteTable/hooks/useColumnMenu.ts
|
|
31103
31538
|
var menuIconSelector2 = `[${MenuIconDataAttributes["data-name"]}="${MenuIconDataAttributesValues["data-name"]}"]`;
|
|
31104
31539
|
function showMenuForColumn(options) {
|
|
@@ -31128,7 +31563,7 @@ function showMenuForColumn(options) {
|
|
|
31128
31563
|
}
|
|
31129
31564
|
columnMenuTargetRef.current = null;
|
|
31130
31565
|
showOverlay(() => getMenuForColumn(columnId, context, onHideIntent), {
|
|
31131
|
-
constrainTo:
|
|
31566
|
+
constrainTo: getMenuConstrainTo(getState()),
|
|
31132
31567
|
id: "column-menu",
|
|
31133
31568
|
alignTo: target,
|
|
31134
31569
|
alignPosition: [
|
|
@@ -31152,19 +31587,14 @@ function useColumnMenu() {
|
|
|
31152
31587
|
columnMenuVisibleKey: ctx.state.columnMenuVisibleKey
|
|
31153
31588
|
};
|
|
31154
31589
|
});
|
|
31155
|
-
const { portalDOMRef } = useDataSourceMasterDetailSelector((ctx) => {
|
|
31156
|
-
return {
|
|
31157
|
-
portalDOMRef: ctx.getMasterState().portalDOMRef
|
|
31158
|
-
};
|
|
31159
|
-
}) || {};
|
|
31160
31590
|
const {
|
|
31161
31591
|
showOverlay,
|
|
31162
31592
|
portal: menuPortal,
|
|
31163
31593
|
clearAll
|
|
31164
31594
|
} = useOverlay({
|
|
31165
|
-
portalContainer:
|
|
31595
|
+
portalContainer: useMenuPortalContainer()
|
|
31166
31596
|
});
|
|
31167
|
-
(0,
|
|
31597
|
+
(0, import_react60.useEffect)(() => {
|
|
31168
31598
|
const state = getState();
|
|
31169
31599
|
return state.onColumnMenuClick.onChange((info) => {
|
|
31170
31600
|
if (!info) {
|
|
@@ -31177,7 +31607,7 @@ function useColumnMenu() {
|
|
|
31177
31607
|
actions.columnMenuVisibleForColumnId = info.column.id;
|
|
31178
31608
|
});
|
|
31179
31609
|
}, []);
|
|
31180
|
-
(0,
|
|
31610
|
+
(0, import_react60.useEffect)(() => {
|
|
31181
31611
|
const { columnMenuVisibleForColumnId: columnMenuVisibleForColumnId2, columnMenuTargetRef } = getState();
|
|
31182
31612
|
if (columnMenuVisibleForColumnId2) {
|
|
31183
31613
|
let handleMouseDown2 = function(event) {
|
|
@@ -31212,7 +31642,7 @@ function useColumnMenu() {
|
|
|
31212
31642
|
|
|
31213
31643
|
// src/components/InfiniteTable/components/FocusDetect.tsx
|
|
31214
31644
|
var React65 = __toESM(require("react"));
|
|
31215
|
-
var
|
|
31645
|
+
var import_react61 = require("react");
|
|
31216
31646
|
var style = {
|
|
31217
31647
|
width: 0,
|
|
31218
31648
|
height: 0,
|
|
@@ -31232,7 +31662,7 @@ function FocusDetect() {
|
|
|
31232
31662
|
} = useInfiniteTableStableContext();
|
|
31233
31663
|
const { getDataSourceState, getDataSourceMasterContext } = useDataSourceStableContext();
|
|
31234
31664
|
const { focusDetectDOMRef } = getState();
|
|
31235
|
-
const onFocus = (0,
|
|
31665
|
+
const onFocus = (0, import_react61.useCallback)(async () => {
|
|
31236
31666
|
const context = {
|
|
31237
31667
|
getDataSourceState,
|
|
31238
31668
|
getDataSourceMasterContext,
|
|
@@ -31257,7 +31687,7 @@ function FocusDetect() {
|
|
|
31257
31687
|
}
|
|
31258
31688
|
|
|
31259
31689
|
// src/components/InfiniteTable/hooks/useEditingCallbackProps.ts
|
|
31260
|
-
var
|
|
31690
|
+
var import_react62 = require("react");
|
|
31261
31691
|
function useOnEditCancelled() {
|
|
31262
31692
|
const context = useInfiniteTableStableContext();
|
|
31263
31693
|
const { getState, editingCell } = useInfiniteTableSelector((ctx) => {
|
|
@@ -31267,7 +31697,7 @@ function useOnEditCancelled() {
|
|
|
31267
31697
|
};
|
|
31268
31698
|
});
|
|
31269
31699
|
const cancelled = editingCell && !editingCell.active ? editingCell.cancelled : void 0;
|
|
31270
|
-
(0,
|
|
31700
|
+
(0, import_react62.useEffect)(() => {
|
|
31271
31701
|
if (cancelled) {
|
|
31272
31702
|
const { onEditCancelled } = getState();
|
|
31273
31703
|
const editingCell2 = getState().editingCell;
|
|
@@ -31295,7 +31725,7 @@ function useOnEditRejected() {
|
|
|
31295
31725
|
};
|
|
31296
31726
|
});
|
|
31297
31727
|
const rejected = editingCell && !editingCell.active && editingCell.accepted instanceof Error ? editingCell.accepted : void 0;
|
|
31298
|
-
(0,
|
|
31728
|
+
(0, import_react62.useEffect)(() => {
|
|
31299
31729
|
if (rejected) {
|
|
31300
31730
|
const { onEditRejected } = getState();
|
|
31301
31731
|
const editingCell2 = getState().editingCell;
|
|
@@ -31325,7 +31755,7 @@ function useFocusOnEditStop() {
|
|
|
31325
31755
|
});
|
|
31326
31756
|
const active = editingCell?.active;
|
|
31327
31757
|
const prevActive = usePrevious(active);
|
|
31328
|
-
(0,
|
|
31758
|
+
(0, import_react62.useEffect)(() => {
|
|
31329
31759
|
if (!active && prevActive) {
|
|
31330
31760
|
context.api.focus();
|
|
31331
31761
|
}
|
|
@@ -31340,7 +31770,7 @@ function useOnEditAccepted() {
|
|
|
31340
31770
|
};
|
|
31341
31771
|
});
|
|
31342
31772
|
const accepted = editingCell && !editingCell.active && !editingCell.cancelled && editingCell.accepted === true;
|
|
31343
|
-
(0,
|
|
31773
|
+
(0, import_react62.useEffect)(() => {
|
|
31344
31774
|
if (accepted) {
|
|
31345
31775
|
const { onEditAccepted } = getState();
|
|
31346
31776
|
const editingCell2 = getState().editingCell;
|
|
@@ -31366,7 +31796,7 @@ function useOnEditPersisted() {
|
|
|
31366
31796
|
};
|
|
31367
31797
|
});
|
|
31368
31798
|
const persisted = editingCell ? editingCell.persisted : void 0;
|
|
31369
|
-
(0,
|
|
31799
|
+
(0, import_react62.useEffect)(() => {
|
|
31370
31800
|
if (persisted) {
|
|
31371
31801
|
const { editingCell: editingCell2, onEditPersistError, onEditPersistSuccess } = getState();
|
|
31372
31802
|
if (!editingCell2) {
|
|
@@ -31403,7 +31833,7 @@ function useEditingCallbackProps() {
|
|
|
31403
31833
|
}
|
|
31404
31834
|
|
|
31405
31835
|
// src/components/InfiniteTable/hooks/useColumnFilterOperatorMenu.ts
|
|
31406
|
-
var
|
|
31836
|
+
var import_react63 = require("react");
|
|
31407
31837
|
|
|
31408
31838
|
// src/components/InfiniteTable/utils/getFilterOperatorMenuForColumn.tsx
|
|
31409
31839
|
var React68 = __toESM(require("react"));
|
|
@@ -31532,11 +31962,6 @@ function getFilterOperatorMenuForColumn(columnId, context, onHideIntent) {
|
|
|
31532
31962
|
// src/components/InfiniteTable/hooks/useColumnFilterOperatorMenu.ts
|
|
31533
31963
|
var OFFSET2 = 10;
|
|
31534
31964
|
function useColumnFilterOperatorMenu() {
|
|
31535
|
-
const { portalDOMRef } = useDataSourceMasterDetailSelector((ctx) => {
|
|
31536
|
-
return {
|
|
31537
|
-
portalDOMRef: ctx.getMasterState().portalDOMRef
|
|
31538
|
-
};
|
|
31539
|
-
}) || {};
|
|
31540
31965
|
const stableContext = useInfiniteTableStableContext();
|
|
31541
31966
|
const { getState, actions } = stableContext;
|
|
31542
31967
|
const {
|
|
@@ -31544,9 +31969,9 @@ function useColumnFilterOperatorMenu() {
|
|
|
31544
31969
|
portal: menuPortal,
|
|
31545
31970
|
clearAll
|
|
31546
31971
|
} = useOverlay({
|
|
31547
|
-
portalContainer:
|
|
31972
|
+
portalContainer: useMenuPortalContainer()
|
|
31548
31973
|
});
|
|
31549
|
-
(0,
|
|
31974
|
+
(0, import_react63.useEffect)(() => {
|
|
31550
31975
|
const state = getState();
|
|
31551
31976
|
return state.onFilterOperatorMenuClick.onChange((info) => {
|
|
31552
31977
|
if (!info) {
|
|
@@ -31570,7 +31995,7 @@ function useColumnFilterOperatorMenu() {
|
|
|
31570
31995
|
onHideIntent
|
|
31571
31996
|
),
|
|
31572
31997
|
{
|
|
31573
|
-
constrainTo: getState()
|
|
31998
|
+
constrainTo: getMenuConstrainTo(getState()),
|
|
31574
31999
|
id: "filter-operator-menu",
|
|
31575
32000
|
alignTo: rect,
|
|
31576
32001
|
alignPosition: [
|
|
@@ -31585,7 +32010,7 @@ function useColumnFilterOperatorMenu() {
|
|
|
31585
32010
|
actions.filterOperatorMenuVisibleForColumnId = column.id;
|
|
31586
32011
|
});
|
|
31587
32012
|
}, []);
|
|
31588
|
-
(0,
|
|
32013
|
+
(0, import_react63.useEffect)(() => {
|
|
31589
32014
|
const { filterOperatorMenuVisibleForColumnId } = getState();
|
|
31590
32015
|
if (filterOperatorMenuVisibleForColumnId) {
|
|
31591
32016
|
let handleMouseDown2 = function(event) {
|
|
@@ -31612,7 +32037,7 @@ function useColumnFilterOperatorMenu() {
|
|
|
31612
32037
|
}
|
|
31613
32038
|
|
|
31614
32039
|
// src/components/InfiniteTable/hooks/useContextMenu.ts
|
|
31615
|
-
var
|
|
32040
|
+
var import_react64 = require("react");
|
|
31616
32041
|
|
|
31617
32042
|
// src/components/InfiniteTable/utils/getCellContextMenu.tsx
|
|
31618
32043
|
var React70 = __toESM(require("react"));
|
|
@@ -31774,20 +32199,15 @@ var ALIGN_POSITIONS = [
|
|
|
31774
32199
|
];
|
|
31775
32200
|
function useCellContextMenu() {
|
|
31776
32201
|
const context = useInfiniteTableStableContext();
|
|
31777
|
-
const { portalDOMRef } = useDataSourceMasterDetailSelector((ctx) => {
|
|
31778
|
-
return {
|
|
31779
|
-
portalDOMRef: ctx.getMasterState().portalDOMRef
|
|
31780
|
-
};
|
|
31781
|
-
}) || {};
|
|
31782
32202
|
const { getState, actions } = context;
|
|
31783
32203
|
const {
|
|
31784
32204
|
showOverlay,
|
|
31785
32205
|
portal: menuPortal,
|
|
31786
32206
|
clearAll
|
|
31787
32207
|
} = useOverlay({
|
|
31788
|
-
portalContainer:
|
|
32208
|
+
portalContainer: useMenuPortalContainer()
|
|
31789
32209
|
});
|
|
31790
|
-
(0,
|
|
32210
|
+
(0, import_react64.useEffect)(() => {
|
|
31791
32211
|
const { actions: actions2, getState: getState2, getDataSourceState } = context;
|
|
31792
32212
|
const state = getState2();
|
|
31793
32213
|
return state.cellContextMenu.onChange((info) => {
|
|
@@ -31811,7 +32231,7 @@ function useCellContextMenu() {
|
|
|
31811
32231
|
rect.width += OFFSET3;
|
|
31812
32232
|
rect.height += OFFSET3;
|
|
31813
32233
|
showOverlay(menu, {
|
|
31814
|
-
constrainTo: getState2()
|
|
32234
|
+
constrainTo: getMenuConstrainTo(getState2()),
|
|
31815
32235
|
id: "cell-context-menu",
|
|
31816
32236
|
alignTo: rect,
|
|
31817
32237
|
alignPosition: ALIGN_POSITIONS
|
|
@@ -31838,7 +32258,7 @@ function useCellContextMenu() {
|
|
|
31838
32258
|
}
|
|
31839
32259
|
});
|
|
31840
32260
|
}, []);
|
|
31841
|
-
(0,
|
|
32261
|
+
(0, import_react64.useEffect)(() => {
|
|
31842
32262
|
const { cellContextMenuVisibleFor } = getState();
|
|
31843
32263
|
if (cellContextMenuVisibleFor) {
|
|
31844
32264
|
let handleMouseDown2 = function(event) {
|
|
@@ -31865,20 +32285,15 @@ function useCellContextMenu() {
|
|
|
31865
32285
|
}
|
|
31866
32286
|
function useTableContextMenu() {
|
|
31867
32287
|
const context = useInfiniteTableStableContext();
|
|
31868
|
-
const { portalDOMRef } = useDataSourceMasterDetailSelector((ctx) => {
|
|
31869
|
-
return {
|
|
31870
|
-
portalDOMRef: ctx.getMasterState().portalDOMRef
|
|
31871
|
-
};
|
|
31872
|
-
}) || {};
|
|
31873
32288
|
const { getState, actions } = context;
|
|
31874
32289
|
const {
|
|
31875
32290
|
showOverlay,
|
|
31876
32291
|
portal: menuPortal,
|
|
31877
32292
|
clearAll
|
|
31878
32293
|
} = useOverlay({
|
|
31879
|
-
portalContainer:
|
|
32294
|
+
portalContainer: useMenuPortalContainer()
|
|
31880
32295
|
});
|
|
31881
|
-
(0,
|
|
32296
|
+
(0, import_react64.useEffect)(() => {
|
|
31882
32297
|
const { actions: actions2, getState: getState2 } = context;
|
|
31883
32298
|
const state = getState2();
|
|
31884
32299
|
return state.contextMenu.onChange((info) => {
|
|
@@ -31903,7 +32318,7 @@ function useTableContextMenu() {
|
|
|
31903
32318
|
rect.width += OFFSET3;
|
|
31904
32319
|
rect.height += OFFSET3;
|
|
31905
32320
|
showOverlay(menu, {
|
|
31906
|
-
constrainTo: getState2()
|
|
32321
|
+
constrainTo: getMenuConstrainTo(getState2()),
|
|
31907
32322
|
id: "table-context-menu",
|
|
31908
32323
|
alignTo: rect,
|
|
31909
32324
|
alignPosition: ALIGN_POSITIONS
|
|
@@ -31927,7 +32342,7 @@ function useTableContextMenu() {
|
|
|
31927
32342
|
}
|
|
31928
32343
|
});
|
|
31929
32344
|
}, []);
|
|
31930
|
-
(0,
|
|
32345
|
+
(0, import_react64.useEffect)(() => {
|
|
31931
32346
|
const { contextMenuVisibleFor } = getState();
|
|
31932
32347
|
if (contextMenuVisibleFor) {
|
|
31933
32348
|
let handleMouseDown2 = function(event) {
|
|
@@ -31954,19 +32369,19 @@ function useTableContextMenu() {
|
|
|
31954
32369
|
}
|
|
31955
32370
|
|
|
31956
32371
|
// src/components/InfiniteTable/components/HScrollSyncContent.tsx
|
|
31957
|
-
var
|
|
32372
|
+
var import_react66 = require("react");
|
|
31958
32373
|
var React71 = __toESM(require("react"));
|
|
31959
32374
|
|
|
31960
32375
|
// src/components/InfiniteTable/hooks/useGridScroll.ts
|
|
31961
|
-
var
|
|
32376
|
+
var import_react65 = require("react");
|
|
31962
32377
|
function useGridScroll(onScroll, deps) {
|
|
31963
32378
|
const { brain } = useInfiniteTableSelector((ctx) => {
|
|
31964
32379
|
return {
|
|
31965
32380
|
brain: ctx.state.brain
|
|
31966
32381
|
};
|
|
31967
32382
|
});
|
|
31968
|
-
const memoizedOnScroll = (0,
|
|
31969
|
-
(0,
|
|
32383
|
+
const memoizedOnScroll = (0, import_react65.useCallback)(onScroll, deps);
|
|
32384
|
+
(0, import_react65.useEffect)(() => {
|
|
31970
32385
|
const removeOnScroll = brain.onScroll(memoizedOnScroll);
|
|
31971
32386
|
return removeOnScroll;
|
|
31972
32387
|
}, [brain, memoizedOnScroll]);
|
|
@@ -31978,7 +32393,7 @@ var HScrollSyncContentCls = "yzx0vj0";
|
|
|
31978
32393
|
// src/components/InfiniteTable/components/HScrollSyncContent.tsx
|
|
31979
32394
|
function HScrollSyncContent(props) {
|
|
31980
32395
|
const { width, maxWidth, minWidth, scrollable, ...domProps } = props;
|
|
31981
|
-
const domRef = (0,
|
|
32396
|
+
const domRef = (0, import_react66.useRef)(null);
|
|
31982
32397
|
useGridScroll(
|
|
31983
32398
|
(scrollPos) => {
|
|
31984
32399
|
if (domRef.current && scrollable !== false) {
|
|
@@ -32040,7 +32455,7 @@ function useVisibleColumnSizes() {
|
|
|
32040
32455
|
var DEBUG_NAME = "InfiniteTable";
|
|
32041
32456
|
|
|
32042
32457
|
// src/components/InfiniteTable/hooks/useHorizontalLayout.ts
|
|
32043
|
-
var
|
|
32458
|
+
var import_react67 = require("react");
|
|
32044
32459
|
function useHorizontalLayout() {
|
|
32045
32460
|
const { getState, actions, dataSourceActions, getDataSourceState } = useInfiniteTableSelector((ctx) => {
|
|
32046
32461
|
return {
|
|
@@ -32057,7 +32472,7 @@ function useHorizontalLayout() {
|
|
|
32057
32472
|
if (!wrapRowsHorizontally) {
|
|
32058
32473
|
repeatWrappedGroupRows = false;
|
|
32059
32474
|
}
|
|
32060
|
-
(0,
|
|
32475
|
+
(0, import_react67.useEffect)(() => {
|
|
32061
32476
|
if (!wrapRowsHorizontally) {
|
|
32062
32477
|
if (getDataSourceState().repeatWrappedGroupRows) {
|
|
32063
32478
|
dataSourceActions.repeatWrappedGroupRows = false;
|
|
@@ -32101,7 +32516,7 @@ function useHorizontalLayout() {
|
|
|
32101
32516
|
}
|
|
32102
32517
|
|
|
32103
32518
|
// src/components/InfiniteTable/hooks/useDebugMode.ts
|
|
32104
|
-
var
|
|
32519
|
+
var import_react68 = require("react");
|
|
32105
32520
|
|
|
32106
32521
|
// src/utils/themeVarsUtils.ts
|
|
32107
32522
|
function collectThemeVarNames() {
|
|
@@ -32303,7 +32718,7 @@ function useDebugMode() {
|
|
|
32303
32718
|
}
|
|
32304
32719
|
}
|
|
32305
32720
|
}
|
|
32306
|
-
(0,
|
|
32721
|
+
(0, import_react68.useEffect)(() => {
|
|
32307
32722
|
const dataSourceState = getDataSourceState();
|
|
32308
32723
|
if (dataSourceState.debugId !== debugId) {
|
|
32309
32724
|
dataSourceActions.debugId = debugId;
|
|
@@ -32555,9 +32970,9 @@ function useDevTools() {
|
|
|
32555
32970
|
});
|
|
32556
32971
|
const state = getState();
|
|
32557
32972
|
const debugId = state.debugId;
|
|
32558
|
-
const debugIdRef = (0,
|
|
32973
|
+
const debugIdRef = (0, import_react68.useRef)(debugId);
|
|
32559
32974
|
debugIdRef.current = debugId;
|
|
32560
|
-
(0,
|
|
32975
|
+
(0, import_react68.useEffect)(() => {
|
|
32561
32976
|
const debugId2 = debugIdRef.current;
|
|
32562
32977
|
if (!debugId2) {
|
|
32563
32978
|
return;
|
|
@@ -32585,7 +33000,7 @@ function useDevTools() {
|
|
|
32585
33000
|
withHookFn(hookFn2);
|
|
32586
33001
|
});
|
|
32587
33002
|
}, []);
|
|
32588
|
-
(0,
|
|
33003
|
+
(0, import_react68.useEffect)(() => {
|
|
32589
33004
|
const debugId2 = debugIdRef.current;
|
|
32590
33005
|
if (!debugId2) {
|
|
32591
33006
|
return;
|
|
@@ -32603,7 +33018,7 @@ function useDevTools() {
|
|
|
32603
33018
|
});
|
|
32604
33019
|
}
|
|
32605
33020
|
});
|
|
32606
|
-
(0,
|
|
33021
|
+
(0, import_react68.useEffect)(() => {
|
|
32607
33022
|
if (!debugId) {
|
|
32608
33023
|
return;
|
|
32609
33024
|
}
|
|
@@ -32633,7 +33048,7 @@ function useInfinitePortalContainer() {
|
|
|
32633
33048
|
|
|
32634
33049
|
// src/components/InfiniteTable/components/GroupingToolbar/index.tsx
|
|
32635
33050
|
var React73 = __toESM(require("react"));
|
|
32636
|
-
var
|
|
33051
|
+
var import_react69 = require("react");
|
|
32637
33052
|
|
|
32638
33053
|
// src/components/InfiniteTable/components/GroupingToolbar/index.css.ts
|
|
32639
33054
|
var GroupingToolbarItemClearCls = "hs68h8j _16lm1iwk _16lm1iwx _16lm1iw2n";
|
|
@@ -32819,7 +33234,7 @@ function GroupingToolbar(props) {
|
|
|
32819
33234
|
});
|
|
32820
33235
|
dataSourceApi.setGroupBy(newGroupBy);
|
|
32821
33236
|
};
|
|
32822
|
-
const shouldAcceptDrop = (0,
|
|
33237
|
+
const shouldAcceptDrop = (0, import_react69.useCallback)(
|
|
32823
33238
|
(event) => {
|
|
32824
33239
|
const { computedColumnsMap: computedColumnsMap2 } = getComputed();
|
|
32825
33240
|
const columnId = event.dragItem.id;
|
|
@@ -32881,8 +33296,8 @@ function GroupingToolbar(props) {
|
|
|
32881
33296
|
var React78 = __toESM(require("react"));
|
|
32882
33297
|
|
|
32883
33298
|
// src/components/InfiniteTable/hooks/useCellRendering.tsx
|
|
32884
|
-
var import_react70 = require("react");
|
|
32885
33299
|
var import_react71 = require("react");
|
|
33300
|
+
var import_react72 = require("react");
|
|
32886
33301
|
var React75 = __toESM(require("react"));
|
|
32887
33302
|
|
|
32888
33303
|
// src/components/InfiniteTable/hooks/useYourBrain.ts
|
|
@@ -32926,7 +33341,7 @@ var React74 = __toESM(require("react"));
|
|
|
32926
33341
|
var RowDetailRecipe = createRuntimeFn({ defaultClassName: "evqes20", variantClassNames: {}, defaultVariants: {}, compoundVariants: [] });
|
|
32927
33342
|
|
|
32928
33343
|
// src/components/InfiniteTable/components/InfiniteTableRow/useRegisterDetail.ts
|
|
32929
|
-
var
|
|
33344
|
+
var import_react70 = require("react");
|
|
32930
33345
|
|
|
32931
33346
|
// src/components/InfiniteTable/components/InfiniteTableRow/registerDetailShared.ts
|
|
32932
33347
|
function restoreDetailStateForRowId(rowId, options) {
|
|
@@ -33054,11 +33469,11 @@ function useRegisterDetail(props) {
|
|
|
33054
33469
|
getMasterState: ctx.getState
|
|
33055
33470
|
};
|
|
33056
33471
|
});
|
|
33057
|
-
const { currentRowCache, cacheCalledByRowDetailRenderer } = (0,
|
|
33472
|
+
const { currentRowCache, cacheCalledByRowDetailRenderer } = (0, import_react70.useMemo)(
|
|
33058
33473
|
() => createCurrentRowCache(rowInfo.id, rowDetailsCache),
|
|
33059
33474
|
[rowDetailsCache, rowInfo.id]
|
|
33060
33475
|
);
|
|
33061
|
-
const masterDetailContextValue = (0,
|
|
33476
|
+
const masterDetailContextValue = (0, import_react70.useMemo)(() => {
|
|
33062
33477
|
return createMasterDetailContextValue({
|
|
33063
33478
|
rowInfo,
|
|
33064
33479
|
currentRowCache,
|
|
@@ -33202,7 +33617,7 @@ function useCellRendering(param) {
|
|
|
33202
33617
|
toggleGroupRow,
|
|
33203
33618
|
columnSize
|
|
33204
33619
|
} = computed;
|
|
33205
|
-
const visibleColumnIds = (0,
|
|
33620
|
+
const visibleColumnIds = (0, import_react71.useMemo)(
|
|
33206
33621
|
() => computedVisibleColumns.map((column) => column.id),
|
|
33207
33622
|
[computedVisibleColumns]
|
|
33208
33623
|
);
|
|
@@ -33239,18 +33654,18 @@ function useCellRendering(param) {
|
|
|
33239
33654
|
bodySize,
|
|
33240
33655
|
rowspan
|
|
33241
33656
|
});
|
|
33242
|
-
const scrollTopMaxRef = (0,
|
|
33243
|
-
(0,
|
|
33657
|
+
const scrollTopMaxRef = (0, import_react72.useRef)(0);
|
|
33658
|
+
(0, import_react72.useEffect)(() => {
|
|
33244
33659
|
return brain.onRenderCountChange(() => {
|
|
33245
33660
|
scrollTopMaxRef.current = brain.scrollTopMax;
|
|
33246
33661
|
});
|
|
33247
33662
|
}, [brain]);
|
|
33248
|
-
(0,
|
|
33663
|
+
(0, import_react72.useEffect)(() => {
|
|
33249
33664
|
return brain.onRenderRangeChange((range) => {
|
|
33250
33665
|
getState().onRenderRangeChange?.(range);
|
|
33251
33666
|
});
|
|
33252
33667
|
}, [brain]);
|
|
33253
|
-
(0,
|
|
33668
|
+
(0, import_react72.useEffect)(() => {
|
|
33254
33669
|
return brain.onScrollStop((scrollPosition) => {
|
|
33255
33670
|
const { scrollTop: scrollTop2, scrollLeft: scrollLeft2 } = scrollPosition;
|
|
33256
33671
|
if (scrollTop2 === 0) {
|
|
@@ -33290,13 +33705,13 @@ function useCellRendering(param) {
|
|
|
33290
33705
|
}
|
|
33291
33706
|
});
|
|
33292
33707
|
}, [brain, onScrollToTop, onScrollToBottom, onScrollStop]);
|
|
33293
|
-
(0,
|
|
33708
|
+
(0, import_react72.useEffect)(() => {
|
|
33294
33709
|
if (!bodySize.height) {
|
|
33295
33710
|
return;
|
|
33296
33711
|
}
|
|
33297
33712
|
actions.ready = true;
|
|
33298
33713
|
}, [!!bodySize.height]);
|
|
33299
|
-
(0,
|
|
33714
|
+
(0, import_react72.useEffect)(() => {
|
|
33300
33715
|
if (!ready) {
|
|
33301
33716
|
}
|
|
33302
33717
|
const { onReady } = getState();
|
|
@@ -33304,14 +33719,14 @@ function useCellRendering(param) {
|
|
|
33304
33719
|
onReady({ api: imperativeApi, dataSourceApi });
|
|
33305
33720
|
}
|
|
33306
33721
|
}, [ready]);
|
|
33307
|
-
const dataSourceStatePartialForCell = (0,
|
|
33722
|
+
const dataSourceStatePartialForCell = (0, import_react71.useMemo)(() => {
|
|
33308
33723
|
return {
|
|
33309
33724
|
isNodeReadOnly: isNodeReadOnly2,
|
|
33310
33725
|
selectionMode,
|
|
33311
33726
|
cellSelection
|
|
33312
33727
|
};
|
|
33313
33728
|
}, [isNodeReadOnly2, selectionMode, cellSelection]);
|
|
33314
|
-
const renderCell = (0,
|
|
33729
|
+
const renderCell = (0, import_react72.useCallback)(
|
|
33315
33730
|
(params) => {
|
|
33316
33731
|
const {
|
|
33317
33732
|
rowIndex,
|
|
@@ -33430,7 +33845,7 @@ function useCellRendering(param) {
|
|
|
33430
33845
|
dataSourceStatePartialForCell
|
|
33431
33846
|
]
|
|
33432
33847
|
);
|
|
33433
|
-
const renderDetailRow = (0,
|
|
33848
|
+
const renderDetailRow = (0, import_react71.useMemo)(() => {
|
|
33434
33849
|
if (!isRowDetailsExpanded) {
|
|
33435
33850
|
return void 0;
|
|
33436
33851
|
}
|
|
@@ -33470,7 +33885,7 @@ function useCellRendering(param) {
|
|
|
33470
33885
|
}
|
|
33471
33886
|
|
|
33472
33887
|
// src/components/InfiniteTable/hooks/useToggleWrapRowsHorizontally.ts
|
|
33473
|
-
var
|
|
33888
|
+
var import_react73 = require("react");
|
|
33474
33889
|
function useToggleWrapRowsHorizontally() {
|
|
33475
33890
|
const { state, getState, actions } = useInfiniteTableSelector((ctx) => {
|
|
33476
33891
|
return {
|
|
@@ -33481,7 +33896,7 @@ function useToggleWrapRowsHorizontally() {
|
|
|
33481
33896
|
});
|
|
33482
33897
|
const { wrapRowsHorizontally } = state;
|
|
33483
33898
|
const oldWrapRowsHorizontally = usePrevious(wrapRowsHorizontally);
|
|
33484
|
-
(0,
|
|
33899
|
+
(0, import_react73.useEffect)(() => {
|
|
33485
33900
|
if (oldWrapRowsHorizontally !== wrapRowsHorizontally) {
|
|
33486
33901
|
const { brain, headerBrain, renderer, onRenderUpdater } = getState();
|
|
33487
33902
|
brain.destroy();
|
|
@@ -33542,7 +33957,7 @@ function LoadMaskFn(props) {
|
|
|
33542
33957
|
var LoadMask = React77.memo(LoadMaskFn);
|
|
33543
33958
|
|
|
33544
33959
|
// src/components/InfiniteTable/components/InfiniteTableBody/index.tsx
|
|
33545
|
-
var
|
|
33960
|
+
var import_react74 = require("react");
|
|
33546
33961
|
var _HOVERED_CLASS_NAMES = [
|
|
33547
33962
|
RowHoverCls,
|
|
33548
33963
|
`${InfiniteTableColumnCellClassName}--hovered`
|
|
@@ -33659,7 +34074,7 @@ function InfiniteTableBody(props) {
|
|
|
33659
34074
|
});
|
|
33660
34075
|
const { autoFocus, tabIndex } = domProps ?? {};
|
|
33661
34076
|
useToggleWrapRowsHorizontally();
|
|
33662
|
-
const hoverClassNames = (0,
|
|
34077
|
+
const hoverClassNames = (0, import_react74.useMemo)(() => {
|
|
33663
34078
|
if (!showHoverRows) {
|
|
33664
34079
|
return void 0;
|
|
33665
34080
|
}
|
|
@@ -34318,7 +34733,7 @@ var keyboardShortcuts = {
|
|
|
34318
34733
|
};
|
|
34319
34734
|
|
|
34320
34735
|
// src/components/hooks/useInterceptedMap.ts
|
|
34321
|
-
var
|
|
34736
|
+
var import_react75 = require("react");
|
|
34322
34737
|
function interceptMap(map2, fns) {
|
|
34323
34738
|
const { set, delete: deleteKey, clear } = map2;
|
|
34324
34739
|
if (fns.set) {
|
|
@@ -34480,21 +34895,21 @@ _WeakFixedSizeSet.DEFAULT_SIZE = 10;
|
|
|
34480
34895
|
var WeakFixedSizeSet = _WeakFixedSizeSet;
|
|
34481
34896
|
|
|
34482
34897
|
// src/components/hooks/useEffectWhenSameDeps.ts
|
|
34483
|
-
var
|
|
34898
|
+
var import_react76 = require("react");
|
|
34484
34899
|
var isSameDeps = (deps, prevDeps) => {
|
|
34485
34900
|
return deps.every((dep, index) => dep === prevDeps[index]);
|
|
34486
34901
|
};
|
|
34487
34902
|
var useEffectWhenSameDeps = (callback, deps) => {
|
|
34488
|
-
const depsRef = (0,
|
|
34903
|
+
const depsRef = (0, import_react76.useRef)(deps);
|
|
34489
34904
|
const sameDeps = isSameDeps(deps, depsRef.current);
|
|
34490
|
-
const isInitialRef = (0,
|
|
34905
|
+
const isInitialRef = (0, import_react76.useRef)(true);
|
|
34491
34906
|
depsRef.current = deps;
|
|
34492
|
-
const effectDepsRef = (0,
|
|
34907
|
+
const effectDepsRef = (0, import_react76.useRef)(["same"]);
|
|
34493
34908
|
const effectDeps = sameDeps ? [Date.now()] : effectDepsRef.current;
|
|
34494
34909
|
effectDepsRef.current = effectDeps;
|
|
34495
|
-
const callbackRef = (0,
|
|
34910
|
+
const callbackRef = (0, import_react76.useRef)(callback);
|
|
34496
34911
|
callbackRef.current = callback;
|
|
34497
|
-
(0,
|
|
34912
|
+
(0, import_react76.useEffect)(() => {
|
|
34498
34913
|
if (isInitialRef.current) {
|
|
34499
34914
|
isInitialRef.current = false;
|
|
34500
34915
|
return;
|
|
@@ -34504,7 +34919,7 @@ var useEffectWhenSameDeps = (callback, deps) => {
|
|
|
34504
34919
|
};
|
|
34505
34920
|
|
|
34506
34921
|
// src/components/hooks/useEffectWhen.ts
|
|
34507
|
-
var
|
|
34922
|
+
var import_react77 = require("react");
|
|
34508
34923
|
var isSameDeps2 = (deps, prevDeps, compare) => {
|
|
34509
34924
|
return deps.every((dep, index) => {
|
|
34510
34925
|
if (compare) {
|
|
@@ -34515,26 +34930,26 @@ var isSameDeps2 = (deps, prevDeps, compare) => {
|
|
|
34515
34930
|
};
|
|
34516
34931
|
var useEffectWhen = (callback, options) => {
|
|
34517
34932
|
const { same: depsForSame, different: depsForDifferent, compare } = options;
|
|
34518
|
-
const sameDepsRef = (0,
|
|
34519
|
-
const differentDepsRef = (0,
|
|
34933
|
+
const sameDepsRef = (0, import_react77.useRef)(depsForSame);
|
|
34934
|
+
const differentDepsRef = (0, import_react77.useRef)(depsForDifferent);
|
|
34520
34935
|
const sameRespected = isSameDeps2(depsForSame, sameDepsRef.current, compare);
|
|
34521
34936
|
const differentRespected = !isSameDeps2(
|
|
34522
34937
|
depsForDifferent,
|
|
34523
34938
|
differentDepsRef.current,
|
|
34524
34939
|
compare
|
|
34525
34940
|
);
|
|
34526
|
-
const isInitialRef = (0,
|
|
34941
|
+
const isInitialRef = (0, import_react77.useRef)(true);
|
|
34527
34942
|
sameDepsRef.current = depsForSame;
|
|
34528
34943
|
differentDepsRef.current = depsForDifferent;
|
|
34529
|
-
const effectDepsRef = (0,
|
|
34944
|
+
const effectDepsRef = (0, import_react77.useRef)(["same"]);
|
|
34530
34945
|
const effectDeps = sameRespected && differentRespected ? [Date.now()] : effectDepsRef.current;
|
|
34531
34946
|
effectDepsRef.current = effectDeps;
|
|
34532
|
-
const callbackRef = (0,
|
|
34947
|
+
const callbackRef = (0, import_react77.useRef)(callback);
|
|
34533
34948
|
callbackRef.current = callback;
|
|
34534
34949
|
if (sameRespected && differentRespected) {
|
|
34535
34950
|
isInitialRef.current = false;
|
|
34536
34951
|
}
|
|
34537
|
-
(0,
|
|
34952
|
+
(0, import_react77.useEffect)(() => {
|
|
34538
34953
|
if (isInitialRef.current) {
|
|
34539
34954
|
return;
|
|
34540
34955
|
}
|
|
@@ -34648,11 +35063,11 @@ var FlashingColumnCell = createFlashingColumnCellComponent();
|
|
|
34648
35063
|
|
|
34649
35064
|
// src/components/HeadlessTable/MatrixDebugger.tsx
|
|
34650
35065
|
var React83 = __toESM(require("react"));
|
|
34651
|
-
var
|
|
35066
|
+
var import_react78 = require("react");
|
|
34652
35067
|
var import_react_dom4 = require("react-dom");
|
|
34653
35068
|
function INTERNAL_MatrixDebugger(props) {
|
|
34654
35069
|
const [getState, setGetState] = React83.useState(null);
|
|
34655
|
-
(0,
|
|
35070
|
+
(0, import_react78.useEffect)(() => {
|
|
34656
35071
|
const { debugTarget } = props;
|
|
34657
35072
|
const intervalId = setInterval(() => {
|
|
34658
35073
|
if (globalThis.INFINITE && globalThis.INFINITE[debugTarget]) {
|
|
@@ -34675,7 +35090,7 @@ function MatrixDebuggerUI() {
|
|
|
34675
35090
|
const { getState } = contextValue;
|
|
34676
35091
|
const [, rerender] = useRerender();
|
|
34677
35092
|
const cellManager = getState().renderer.cellManager;
|
|
34678
|
-
(0,
|
|
35093
|
+
(0, import_react78.useEffect)(() => {
|
|
34679
35094
|
const delayedRerender = debounce(
|
|
34680
35095
|
() => {
|
|
34681
35096
|
console.log("rerender");
|
|
@@ -34687,8 +35102,8 @@ function MatrixDebuggerUI() {
|
|
|
34687
35102
|
}, [cellManager, rerender]);
|
|
34688
35103
|
const rowIndexes = cellManager.getRowsWithCells();
|
|
34689
35104
|
const columnsIndexes = cellManager.getColumnsWithCells();
|
|
34690
|
-
const domRef = (0,
|
|
34691
|
-
const displayTimeoutRef = (0,
|
|
35105
|
+
const domRef = (0, import_react78.useRef)(null);
|
|
35106
|
+
const displayTimeoutRef = (0, import_react78.useRef)(null);
|
|
34692
35107
|
return /* @__PURE__ */ React83.createElement("div", { style: { overflow: "auto" } }, (0, import_react_dom4.createPortal)(
|
|
34693
35108
|
/* @__PURE__ */ React83.createElement(
|
|
34694
35109
|
"div",
|