@infinite-table/infinite-react 10.1.3 → 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 +70 -0
- package/index.dev.js +478 -82
- package/index.dev.mjs +499 -97
- package/index.js +8 -8
- package/index.mjs +8 -8
- package/package.json +2 -2
package/index.dev.mjs
CHANGED
|
@@ -5100,6 +5100,79 @@ var Rectangle = class _Rectangle extends PolyWithPoints {
|
|
|
5100
5100
|
}
|
|
5101
5101
|
};
|
|
5102
5102
|
|
|
5103
|
+
// src/components/VirtualBrain/largeContent.ts
|
|
5104
|
+
var LARGE_CONTENT_PROBE_THRESHOLD = 4e6;
|
|
5105
|
+
var SCROLL_ORIGIN_REBASE_DISTANCE = 1e6;
|
|
5106
|
+
var PROBE_START = 1e6;
|
|
5107
|
+
var PROBE_MAX = 64e6;
|
|
5108
|
+
var maxElementSize;
|
|
5109
|
+
function probeMaxElementSize() {
|
|
5110
|
+
if (typeof document === "undefined" || !document.body) {
|
|
5111
|
+
return Infinity;
|
|
5112
|
+
}
|
|
5113
|
+
const div = document.createElement("div");
|
|
5114
|
+
div.style.cssText = "position:absolute;top:0;left:0;width:1px;visibility:hidden;pointer-events:none";
|
|
5115
|
+
document.body.appendChild(div);
|
|
5116
|
+
const applies = (size2) => {
|
|
5117
|
+
div.style.height = `${size2}px`;
|
|
5118
|
+
return Math.abs(div.getBoundingClientRect().height - size2) < 1;
|
|
5119
|
+
};
|
|
5120
|
+
let size = PROBE_START;
|
|
5121
|
+
if (!applies(size)) {
|
|
5122
|
+
div.remove();
|
|
5123
|
+
return Infinity;
|
|
5124
|
+
}
|
|
5125
|
+
while (size < PROBE_MAX && applies(size * 2)) {
|
|
5126
|
+
size *= 2;
|
|
5127
|
+
}
|
|
5128
|
+
div.remove();
|
|
5129
|
+
return size;
|
|
5130
|
+
}
|
|
5131
|
+
function getMaxElementSize() {
|
|
5132
|
+
if (maxElementSize === void 0) {
|
|
5133
|
+
maxElementSize = probeMaxElementSize();
|
|
5134
|
+
}
|
|
5135
|
+
return maxElementSize;
|
|
5136
|
+
}
|
|
5137
|
+
function isLargeContentSize(contentSize) {
|
|
5138
|
+
if (contentSize <= LARGE_CONTENT_PROBE_THRESHOLD) {
|
|
5139
|
+
return false;
|
|
5140
|
+
}
|
|
5141
|
+
return contentSize > getMaxElementSize();
|
|
5142
|
+
}
|
|
5143
|
+
function computeScrollRatio(contentSize, viewportSize) {
|
|
5144
|
+
if (!isLargeContentSize(contentSize)) {
|
|
5145
|
+
return 1;
|
|
5146
|
+
}
|
|
5147
|
+
const nativeScrollMax = getMaxElementSize() - viewportSize;
|
|
5148
|
+
const contentScrollMax = contentSize - viewportSize;
|
|
5149
|
+
return nativeScrollMax > 0 && contentScrollMax > 0 ? contentScrollMax / nativeScrollMax : 1;
|
|
5150
|
+
}
|
|
5151
|
+
function createSteppedScrollPosition(options) {
|
|
5152
|
+
let requested = null;
|
|
5153
|
+
return {
|
|
5154
|
+
get value() {
|
|
5155
|
+
const actual = options.getScrollPosition();
|
|
5156
|
+
const ratio = options.getScrollRatio();
|
|
5157
|
+
if (ratio > 1 && requested !== null && Math.abs(requested - actual) <= ratio) {
|
|
5158
|
+
return requested;
|
|
5159
|
+
}
|
|
5160
|
+
requested = null;
|
|
5161
|
+
return actual;
|
|
5162
|
+
},
|
|
5163
|
+
set value(value) {
|
|
5164
|
+
requested = value;
|
|
5165
|
+
options.setScrollPosition(value);
|
|
5166
|
+
}
|
|
5167
|
+
};
|
|
5168
|
+
}
|
|
5169
|
+
function computeScrollOrigin(scroll, currentOrigin, align2 = Math.floor) {
|
|
5170
|
+
if (Math.abs(scroll - currentOrigin) <= SCROLL_ORIGIN_REBASE_DISTANCE) {
|
|
5171
|
+
return currentOrigin;
|
|
5172
|
+
}
|
|
5173
|
+
return align2(scroll);
|
|
5174
|
+
}
|
|
5175
|
+
|
|
5103
5176
|
// src/components/InfiniteTable/hooks/reorderColumnsOnDrag.ts
|
|
5104
5177
|
var PROXY_OFFSET = 10;
|
|
5105
5178
|
var pinnedStartWidthCSSVar2 = stripVar(InternalVars.pinnedStartWidth);
|
|
@@ -5397,6 +5470,13 @@ function reorderColumnsOnDrag(params) {
|
|
|
5397
5470
|
scrollOffsetStart: pinnedStartColsRight,
|
|
5398
5471
|
scrollOffsetEnd: pinnedEndColsLeft
|
|
5399
5472
|
});
|
|
5473
|
+
const autoScrollLeft = createSteppedScrollPosition({
|
|
5474
|
+
getScrollPosition: () => brain.getScrollPosition().scrollLeft,
|
|
5475
|
+
setScrollPosition: (value) => {
|
|
5476
|
+
imperativeApi.scrollLeft = value;
|
|
5477
|
+
},
|
|
5478
|
+
getScrollRatio: () => brain.getScrollRatio("horizontal")
|
|
5479
|
+
});
|
|
5400
5480
|
updatePositionAndDiff(initialMousePosition);
|
|
5401
5481
|
return {
|
|
5402
5482
|
speedScroller,
|
|
@@ -5416,10 +5496,10 @@ function reorderColumnsOnDrag(params) {
|
|
|
5416
5496
|
speedScroller.scroll({
|
|
5417
5497
|
mousePosition: currentMousePosition,
|
|
5418
5498
|
get scrollLeft() {
|
|
5419
|
-
return
|
|
5499
|
+
return autoScrollLeft.value;
|
|
5420
5500
|
},
|
|
5421
5501
|
set scrollLeft(value) {
|
|
5422
|
-
|
|
5502
|
+
autoScrollLeft.value = value;
|
|
5423
5503
|
}
|
|
5424
5504
|
});
|
|
5425
5505
|
const breakpoints = getBreakPoints(computedVisibleColumns, {
|
|
@@ -13095,7 +13175,13 @@ import * as React47 from "react";
|
|
|
13095
13175
|
|
|
13096
13176
|
// src/components/HeadlessTable/index.tsx
|
|
13097
13177
|
import * as React41 from "react";
|
|
13098
|
-
import {
|
|
13178
|
+
import {
|
|
13179
|
+
useCallback as useCallback18,
|
|
13180
|
+
useEffect as useEffect15,
|
|
13181
|
+
useLayoutEffect as useLayoutEffect11,
|
|
13182
|
+
useRef as useRef18,
|
|
13183
|
+
useState as useState14
|
|
13184
|
+
} from "react";
|
|
13099
13185
|
|
|
13100
13186
|
// src/components/VirtualList/SpacePlaceholder.tsx
|
|
13101
13187
|
import * as React33 from "react";
|
|
@@ -13351,6 +13437,18 @@ var MatrixBrain = class extends Logger {
|
|
|
13351
13437
|
};
|
|
13352
13438
|
this.extraSpanCells = [];
|
|
13353
13439
|
this.scrollPosition = { scrollLeft: 0, scrollTop: 0 };
|
|
13440
|
+
/**
|
|
13441
|
+
* Content larger than the browser can lay out - see largeContent.ts.
|
|
13442
|
+
* Recomputed when sizes change (updateRenderCount), not on scroll.
|
|
13443
|
+
*/
|
|
13444
|
+
this.largeContent = { vertical: false, horizontal: false };
|
|
13445
|
+
this.scrollRatio = { vertical: 1, horizontal: 1 };
|
|
13446
|
+
/**
|
|
13447
|
+
* DOM offsets are written relative to this (content px) - see
|
|
13448
|
+
* "scroll origin" in largeContent.ts. Always 0 unless the content is large.
|
|
13449
|
+
*/
|
|
13450
|
+
this.scrollOrigin = { scrollLeft: 0, scrollTop: 0 };
|
|
13451
|
+
this.onScrollOriginChangeFns = /* @__PURE__ */ new Set();
|
|
13354
13452
|
this.onScrollFns = [];
|
|
13355
13453
|
// private onTotalSizeChangeFns: OnSizeChangeFn[] = [];
|
|
13356
13454
|
this.onRenderRangeChangeFns = /* @__PURE__ */ new Set();
|
|
@@ -13389,6 +13487,13 @@ var MatrixBrain = class extends Logger {
|
|
|
13389
13487
|
this.getColCount = () => {
|
|
13390
13488
|
return this.cols;
|
|
13391
13489
|
};
|
|
13490
|
+
/**
|
|
13491
|
+
* Called (synchronously) when the scroll origin moves - every DOM offset
|
|
13492
|
+
* relative to it has to be written again (in the same frame).
|
|
13493
|
+
*/
|
|
13494
|
+
this.onScrollOriginChange = (fn) => {
|
|
13495
|
+
return this.onScrollOriginChangeForBrain(fn);
|
|
13496
|
+
};
|
|
13392
13497
|
this.setScrolling = (scrolling) => {
|
|
13393
13498
|
const prevScrolling = this.scrolling;
|
|
13394
13499
|
this.scrolling = scrolling;
|
|
@@ -14301,6 +14406,143 @@ var MatrixBrain = class extends Logger {
|
|
|
14301
14406
|
updateRenderCount(which = ALL_DIRECTIONS) {
|
|
14302
14407
|
this.reset(which);
|
|
14303
14408
|
this.doUpdateRenderCount(which);
|
|
14409
|
+
this.updateLargeContent();
|
|
14410
|
+
}
|
|
14411
|
+
// -------------------------------------------------------------------------
|
|
14412
|
+
// very large content - see largeContent.ts for the why and the how
|
|
14413
|
+
// -------------------------------------------------------------------------
|
|
14414
|
+
/**
|
|
14415
|
+
* The axes on which this brain handles content larger than the browser
|
|
14416
|
+
* can lay out. The normal layout: vertical (horizontal offsets come from
|
|
14417
|
+
* column CSS vars computed by the table, not from the brain).
|
|
14418
|
+
*/
|
|
14419
|
+
supportsLargeContent(direction) {
|
|
14420
|
+
return direction === "vertical";
|
|
14421
|
+
}
|
|
14422
|
+
/**
|
|
14423
|
+
* Where the origin can be placed - see HorizontalLayoutMatrixBrain, which
|
|
14424
|
+
* needs whole pages
|
|
14425
|
+
*/
|
|
14426
|
+
alignScrollOrigin(_direction, value) {
|
|
14427
|
+
return Math.floor(value);
|
|
14428
|
+
}
|
|
14429
|
+
updateLargeContent() {
|
|
14430
|
+
const size = this.getVirtualizedContentSize();
|
|
14431
|
+
const vertical = this.supportsLargeContent("vertical") && isLargeContentSize(size.height);
|
|
14432
|
+
const horizontal = this.supportsLargeContent("horizontal") && isLargeContentSize(size.width);
|
|
14433
|
+
this.largeContent = { vertical, horizontal };
|
|
14434
|
+
this.scrollRatio = {
|
|
14435
|
+
vertical: vertical ? computeScrollRatio(size.height, this.availableHeight) : 1,
|
|
14436
|
+
horizontal: horizontal ? computeScrollRatio(size.width, this.availableWidth) : 1
|
|
14437
|
+
};
|
|
14438
|
+
this.updateScrollOrigin();
|
|
14439
|
+
}
|
|
14440
|
+
isLargeContent(direction) {
|
|
14441
|
+
return this.largeContent[direction];
|
|
14442
|
+
}
|
|
14443
|
+
/**
|
|
14444
|
+
* native scroll px -> content px (1 when the content fits)
|
|
14445
|
+
*/
|
|
14446
|
+
getScrollRatio(direction) {
|
|
14447
|
+
return this.scrollRatio[direction];
|
|
14448
|
+
}
|
|
14449
|
+
/**
|
|
14450
|
+
* The size for the scroll spacer - the content size, capped at what the
|
|
14451
|
+
* browser supports on large axes.
|
|
14452
|
+
*/
|
|
14453
|
+
getNativeScrollSize() {
|
|
14454
|
+
const size = this.getVirtualizedContentSize();
|
|
14455
|
+
const { largeContent } = this;
|
|
14456
|
+
if (!largeContent.vertical && !largeContent.horizontal) {
|
|
14457
|
+
return size;
|
|
14458
|
+
}
|
|
14459
|
+
const max = getMaxElementSize();
|
|
14460
|
+
return {
|
|
14461
|
+
width: largeContent.horizontal ? max : size.width,
|
|
14462
|
+
height: largeContent.vertical ? max : size.height
|
|
14463
|
+
};
|
|
14464
|
+
}
|
|
14465
|
+
/**
|
|
14466
|
+
* The native scroll position of the scroll container -> the content scroll
|
|
14467
|
+
* position (what the brain and the API work with)
|
|
14468
|
+
*/
|
|
14469
|
+
toContentScrollPosition(nativeScrollPosition) {
|
|
14470
|
+
const { vertical, horizontal } = this.scrollRatio;
|
|
14471
|
+
if (vertical === 1 && horizontal === 1) {
|
|
14472
|
+
return nativeScrollPosition;
|
|
14473
|
+
}
|
|
14474
|
+
return {
|
|
14475
|
+
scrollTop: nativeScrollPosition.scrollTop * vertical,
|
|
14476
|
+
scrollLeft: nativeScrollPosition.scrollLeft * horizontal
|
|
14477
|
+
};
|
|
14478
|
+
}
|
|
14479
|
+
/**
|
|
14480
|
+
* Content scroll position -> what to set on the scroll container
|
|
14481
|
+
*/
|
|
14482
|
+
toNativeScrollPosition(contentScrollPosition) {
|
|
14483
|
+
const { vertical, horizontal } = this.scrollRatio;
|
|
14484
|
+
if (vertical === 1 && horizontal === 1) {
|
|
14485
|
+
return contentScrollPosition;
|
|
14486
|
+
}
|
|
14487
|
+
return {
|
|
14488
|
+
scrollTop: contentScrollPosition.scrollTop / vertical,
|
|
14489
|
+
scrollLeft: contentScrollPosition.scrollLeft / horizontal
|
|
14490
|
+
};
|
|
14491
|
+
}
|
|
14492
|
+
/**
|
|
14493
|
+
* DOM offsets (transforms, CSS vars) are relative to this. Always 0,0
|
|
14494
|
+
* unless the content is large.
|
|
14495
|
+
*/
|
|
14496
|
+
getScrollOrigin() {
|
|
14497
|
+
return this.scrollOrigin;
|
|
14498
|
+
}
|
|
14499
|
+
/**
|
|
14500
|
+
* The scroll position relative to the scroll origin - this is what
|
|
14501
|
+
* transforms that follow the scroll position should use.
|
|
14502
|
+
*/
|
|
14503
|
+
getDOMScrollPosition(scrollPosition = this.getScrollPosition()) {
|
|
14504
|
+
const origin2 = this.getScrollOrigin();
|
|
14505
|
+
if (!origin2.scrollTop && !origin2.scrollLeft) {
|
|
14506
|
+
return scrollPosition;
|
|
14507
|
+
}
|
|
14508
|
+
return {
|
|
14509
|
+
scrollTop: scrollPosition.scrollTop - origin2.scrollTop,
|
|
14510
|
+
scrollLeft: scrollPosition.scrollLeft - origin2.scrollLeft
|
|
14511
|
+
};
|
|
14512
|
+
}
|
|
14513
|
+
// a method (not an arrow property) so subclasses can call it via super
|
|
14514
|
+
onScrollOriginChangeForBrain(fn) {
|
|
14515
|
+
this.onScrollOriginChangeFns.add(fn);
|
|
14516
|
+
return () => {
|
|
14517
|
+
this.onScrollOriginChangeFns.delete(fn);
|
|
14518
|
+
};
|
|
14519
|
+
}
|
|
14520
|
+
updateScrollOrigin() {
|
|
14521
|
+
const { scrollPosition, largeContent, scrollOrigin } = this;
|
|
14522
|
+
const alignVertical = (value) => this.alignScrollOrigin("vertical", value);
|
|
14523
|
+
const alignHorizontal = (value) => this.alignScrollOrigin("horizontal", value);
|
|
14524
|
+
const scrollTop2 = largeContent.vertical ? computeScrollOrigin(
|
|
14525
|
+
scrollPosition.scrollTop,
|
|
14526
|
+
alignVertical(scrollOrigin.scrollTop),
|
|
14527
|
+
alignVertical
|
|
14528
|
+
) : 0;
|
|
14529
|
+
const scrollLeft2 = largeContent.horizontal ? computeScrollOrigin(
|
|
14530
|
+
scrollPosition.scrollLeft,
|
|
14531
|
+
alignHorizontal(scrollOrigin.scrollLeft),
|
|
14532
|
+
alignHorizontal
|
|
14533
|
+
) : 0;
|
|
14534
|
+
if (scrollTop2 === scrollOrigin.scrollTop && scrollLeft2 === scrollOrigin.scrollLeft) {
|
|
14535
|
+
return;
|
|
14536
|
+
}
|
|
14537
|
+
this.scrollOrigin = { scrollTop: scrollTop2, scrollLeft: scrollLeft2 };
|
|
14538
|
+
this.notifyScrollOriginChange();
|
|
14539
|
+
}
|
|
14540
|
+
notifyScrollOriginChange() {
|
|
14541
|
+
if (this.destroyed) {
|
|
14542
|
+
return;
|
|
14543
|
+
}
|
|
14544
|
+
const origin2 = this.getScrollOrigin();
|
|
14545
|
+
this.onScrollOriginChangeFns.forEach((fn) => fn(origin2));
|
|
14304
14546
|
}
|
|
14305
14547
|
doUpdateRenderCount(which = ALL_DIRECTIONS) {
|
|
14306
14548
|
if (!this.availableWidth || !this.availableHeight) {
|
|
@@ -14332,6 +14574,7 @@ var MatrixBrain = class extends Logger {
|
|
|
14332
14574
|
const changeVertical = scrollPosition.scrollTop !== this.scrollPosition.scrollTop;
|
|
14333
14575
|
this.scrollPosition = scrollPosition;
|
|
14334
14576
|
if (changeHorizontal || changeVertical) {
|
|
14577
|
+
this.updateScrollOrigin();
|
|
14335
14578
|
callback?.(scrollPosition);
|
|
14336
14579
|
this.updateRenderRange({
|
|
14337
14580
|
horizontal: changeHorizontal,
|
|
@@ -14521,6 +14764,7 @@ var MatrixBrain = class extends Logger {
|
|
|
14521
14764
|
this.onScrollStartFns = [];
|
|
14522
14765
|
this.onScrollStopFns = [];
|
|
14523
14766
|
this.onRenderCountChangeFns.clear();
|
|
14767
|
+
this.onScrollOriginChangeFns.clear();
|
|
14524
14768
|
this.onRenderRangeChangeFns.clear();
|
|
14525
14769
|
this.onVerticalRenderRangeChangeFns.clear();
|
|
14526
14770
|
this.onHorizontalRenderRangeChangeFns.clear();
|
|
@@ -15056,6 +15300,9 @@ var GridRenderer = class extends Logger {
|
|
|
15056
15300
|
scrollTop: scrollTop2,
|
|
15057
15301
|
scrollLeft: scrollLeft2
|
|
15058
15302
|
}) => {
|
|
15303
|
+
if (!scrollTop2) {
|
|
15304
|
+
y -= this.brain.getScrollOrigin().scrollTop;
|
|
15305
|
+
}
|
|
15059
15306
|
element.style.setProperty(
|
|
15060
15307
|
currentTransformY,
|
|
15061
15308
|
scrollTop2 ? `calc( ${y}px + var(${scrollTopCSSVar}) )` : `${y}px`
|
|
@@ -15072,7 +15319,7 @@ var GridRenderer = class extends Logger {
|
|
|
15072
15319
|
}, zIndex2) => {
|
|
15073
15320
|
const columnOffsetX = InternalVarUtils.columnOffsets.get(colIndex);
|
|
15074
15321
|
const columnOffsetXWhileReordering = `${columnOffsetAtIndexWhileReordering2}-${colIndex}`;
|
|
15075
|
-
const currentTransformYValue = scrollTop2 ? `calc( ${y}px + var(${scrollTopCSSVar}) )` : `${y}px`;
|
|
15322
|
+
const currentTransformYValue = scrollTop2 ? `calc( ${y}px + var(${scrollTopCSSVar}) )` : `${y - this.brain.getScrollOrigin().scrollTop}px`;
|
|
15076
15323
|
if (element.__currentTransformY !== currentTransformYValue) {
|
|
15077
15324
|
element.__currentTransformY = currentTransformYValue;
|
|
15078
15325
|
element.style.setProperty(currentTransformY, currentTransformYValue);
|
|
@@ -15085,6 +15332,24 @@ var GridRenderer = class extends Logger {
|
|
|
15085
15332
|
if (zIndex2 != null) {
|
|
15086
15333
|
}
|
|
15087
15334
|
};
|
|
15335
|
+
/**
|
|
15336
|
+
* The scroll origin moved (huge content only - see largeContent.ts): every
|
|
15337
|
+
* rendered cell / detail row is positioned relative to it, so they all
|
|
15338
|
+
* need to be repositioned now - synchronously, so it's in the same frame
|
|
15339
|
+
* as the scroll layer transform, which uses the new origin too.
|
|
15340
|
+
*/
|
|
15341
|
+
this.onScrollOriginChange = () => {
|
|
15342
|
+
if (this.destroyed) {
|
|
15343
|
+
return;
|
|
15344
|
+
}
|
|
15345
|
+
this.cellManager.getAllCells().forEach((cell) => {
|
|
15346
|
+
this.updateElementPosition(cell, void 0, { immediate: true });
|
|
15347
|
+
});
|
|
15348
|
+
this.rowManager.forEachAttachedRow((row) => {
|
|
15349
|
+
this.updateDetailElementPosition(row);
|
|
15350
|
+
});
|
|
15351
|
+
this.adjustFixedElementsOnScroll();
|
|
15352
|
+
};
|
|
15088
15353
|
this.getFullyVisibleRowsRange = () => {
|
|
15089
15354
|
let {
|
|
15090
15355
|
start: [startRow],
|
|
@@ -15552,7 +15817,7 @@ var GridRenderer = class extends Logger {
|
|
|
15552
15817
|
this.hoverRowUpdatesInProgress.delete(rowIndex);
|
|
15553
15818
|
});
|
|
15554
15819
|
};
|
|
15555
|
-
this.updateElementPosition = (cell, options) => {
|
|
15820
|
+
this.updateElementPosition = (cell, options, config) => {
|
|
15556
15821
|
if (this.destroyed) {
|
|
15557
15822
|
return;
|
|
15558
15823
|
}
|
|
@@ -15593,7 +15858,7 @@ var GridRenderer = class extends Logger {
|
|
|
15593
15858
|
itemElement.style.top = `${y}px`;
|
|
15594
15859
|
}
|
|
15595
15860
|
};
|
|
15596
|
-
if (this.scrolling && this.brain.isHorizontalLayoutBrain) {
|
|
15861
|
+
if (this.scrolling && this.brain.isHorizontalLayoutBrain && !config?.immediate) {
|
|
15597
15862
|
cell.setPendingAfterCommitWork(applyPosition);
|
|
15598
15863
|
} else {
|
|
15599
15864
|
applyPosition();
|
|
@@ -15622,7 +15887,7 @@ var GridRenderer = class extends Logger {
|
|
|
15622
15887
|
if (ITEM_POSITION_WITH_TRANSFORM) {
|
|
15623
15888
|
this.setDetailTransform(itemElement, rowIndex, {
|
|
15624
15889
|
y,
|
|
15625
|
-
scrollLeft: this.brain.
|
|
15890
|
+
scrollLeft: this.brain.getDOMScrollPosition().scrollLeft
|
|
15626
15891
|
});
|
|
15627
15892
|
itemElement.style.willChange = "transform";
|
|
15628
15893
|
itemElement.style.backfaceVisibility = "hidden";
|
|
@@ -15640,6 +15905,7 @@ var GridRenderer = class extends Logger {
|
|
|
15640
15905
|
};
|
|
15641
15906
|
this.onScrollStop = () => {
|
|
15642
15907
|
this.scrolling = false;
|
|
15908
|
+
this.flushPendingAfterCommitWork();
|
|
15643
15909
|
if (this.lastEnteredRow != -1) {
|
|
15644
15910
|
this.addHoverClass(this.lastEnteredRow);
|
|
15645
15911
|
}
|
|
@@ -15666,7 +15932,7 @@ var GridRenderer = class extends Logger {
|
|
|
15666
15932
|
}
|
|
15667
15933
|
this.setDetailTransform(node, rowIndex, {
|
|
15668
15934
|
y,
|
|
15669
|
-
scrollLeft: scrollPosition.scrollLeft
|
|
15935
|
+
scrollLeft: brain.getDOMScrollPosition(scrollPosition).scrollLeft
|
|
15670
15936
|
});
|
|
15671
15937
|
}
|
|
15672
15938
|
});
|
|
@@ -15677,7 +15943,9 @@ var GridRenderer = class extends Logger {
|
|
|
15677
15943
|
const attachedCell = this.cellManager.getOneAttachedCell();
|
|
15678
15944
|
if (attachedCell) {
|
|
15679
15945
|
setInfiniteScrollPosition(
|
|
15680
|
-
|
|
15946
|
+
// fixed cells are positioned with these, inside the scroll layer
|
|
15947
|
+
// which is translated relative to the scroll origin
|
|
15948
|
+
brain.getDOMScrollPosition(scrollPosition),
|
|
15681
15949
|
this.getInfiniteNode(attachedCell.getElement())
|
|
15682
15950
|
);
|
|
15683
15951
|
}
|
|
@@ -15899,7 +16167,11 @@ var GridRenderer = class extends Logger {
|
|
|
15899
16167
|
});
|
|
15900
16168
|
const removeOnScrollStart = brain.onScrollStart(this.onScrollStart);
|
|
15901
16169
|
const removeOnScrollStop = brain.onScrollStop(this.onScrollStop);
|
|
16170
|
+
const removeOnScrollOriginChange = brain.onScrollOriginChange(
|
|
16171
|
+
this.onScrollOriginChange
|
|
16172
|
+
);
|
|
15902
16173
|
this.onDestroy = () => {
|
|
16174
|
+
removeOnScrollOriginChange();
|
|
15903
16175
|
removeOnScroll();
|
|
15904
16176
|
removeOnSizeChange();
|
|
15905
16177
|
removeOnScrollStart();
|
|
@@ -16253,9 +16525,7 @@ var HorizontalLayoutTableRenderer = class extends GridRenderer {
|
|
|
16253
16525
|
colIndex
|
|
16254
16526
|
);
|
|
16255
16527
|
const { y } = options;
|
|
16256
|
-
const pageIndex = Math.floor(
|
|
16257
|
-
horizontalLayoutCoords.rowIndex / this.brain.rowsPerPage
|
|
16258
|
-
);
|
|
16528
|
+
const pageIndex = Math.floor(horizontalLayoutCoords.rowIndex / this.brain.rowsPerPage) - this.brain.getScrollOriginPageIndex();
|
|
16259
16529
|
const pageWidth = ThemeVars.runtime.totalVisibleColumnsWidthVar;
|
|
16260
16530
|
const pageOffset = pageIndex ? `calc(${pageWidth} * ${pageIndex})` : "0px";
|
|
16261
16531
|
const columnOffsetX = InternalVarUtils.columnOffsets.get(
|
|
@@ -16894,6 +17164,58 @@ var ActiveIndicatorWrapperCls = "nxbq1c0 _16lm1iwz _16lm1iw4 _16lm1iw26 _16lm1iw
|
|
|
16894
17164
|
// src/components/InfiniteTable/components/ActiveRowIndicator.css.ts
|
|
16895
17165
|
var ActiveRowIndicatorRecipe = createRuntimeFn({ defaultClassName: "j26lrx0 _16lm1iwz _16lm1iw2 _16lm1iw23 _16lm1iw26", variantClassNames: { active: { true: "j26lrx2", false: "j26lrx3" } }, defaultVariants: {}, compoundVariants: [] });
|
|
16896
17166
|
|
|
17167
|
+
// src/components/InfiniteTable/components/activeIndicatorOffsets.ts
|
|
17168
|
+
function getPageOffsetX(brain, pageIndex) {
|
|
17169
|
+
const relativePageIndex = pageIndex - brain.getScrollOriginPageIndex();
|
|
17170
|
+
return relativePageIndex ? `calc(${ThemeVars.runtime.totalVisibleColumnsWidthVar} * ${relativePageIndex})` : null;
|
|
17171
|
+
}
|
|
17172
|
+
function getActiveRowIndicatorVars(brain, activeRowIndex) {
|
|
17173
|
+
let activeCellRowOffsetX = "0px";
|
|
17174
|
+
let rowIndex = activeRowIndex;
|
|
17175
|
+
if (brain.isHorizontalLayoutBrain && brain.rowsPerPage) {
|
|
17176
|
+
activeCellRowOffsetX = getPageOffsetX(brain, brain.getPageIndexForRow(rowIndex)) ?? "0px";
|
|
17177
|
+
rowIndex = rowIndex % brain.rowsPerPage;
|
|
17178
|
+
}
|
|
17179
|
+
const activeCellRowHeight = brain.getRowHeight(rowIndex);
|
|
17180
|
+
const activeCellRowOffset = brain.getItemOffsetFor(rowIndex, "vertical") - brain.getScrollOrigin().scrollTop;
|
|
17181
|
+
return {
|
|
17182
|
+
activeCellRowHeight: `${activeCellRowHeight}px`,
|
|
17183
|
+
activeCellRowOffset: `${activeCellRowOffset}px`,
|
|
17184
|
+
activeCellRowOffsetX
|
|
17185
|
+
};
|
|
17186
|
+
}
|
|
17187
|
+
function getActiveRowIndicatorScrollVars(brain, scrollPosition) {
|
|
17188
|
+
const { scrollTop: scrollTop2, scrollLeft: scrollLeft2 } = brain.getDOMScrollPosition(scrollPosition);
|
|
17189
|
+
return {
|
|
17190
|
+
scrollTopForActiveRow: `${-scrollTop2}px`,
|
|
17191
|
+
scrollLeftForActiveRowWhenHorizontalLayout: brain.isHorizontalLayoutBrain ? `${-scrollLeft2}px` : "0px"
|
|
17192
|
+
};
|
|
17193
|
+
}
|
|
17194
|
+
function getActiveCellIndicatorVars(brain, activeCellIndex, rowHeight) {
|
|
17195
|
+
let [rowIndex] = activeCellIndex;
|
|
17196
|
+
const colIndex = activeCellIndex[1];
|
|
17197
|
+
let activeCellColOffset2;
|
|
17198
|
+
if (brain.isHorizontalLayoutBrain && brain.rowsPerPage) {
|
|
17199
|
+
const columnOffset = InternalVarUtils.columnOffsets.get(colIndex);
|
|
17200
|
+
const pageOffset = getPageOffsetX(
|
|
17201
|
+
brain,
|
|
17202
|
+
brain.getPageIndexForRow(rowIndex)
|
|
17203
|
+
);
|
|
17204
|
+
activeCellColOffset2 = pageOffset ? `calc( ${pageOffset} + ${columnOffset})` : columnOffset;
|
|
17205
|
+
rowIndex = rowIndex % brain.rowsPerPage;
|
|
17206
|
+
}
|
|
17207
|
+
const activeCellRowHeight = typeof rowHeight === "function" ? rowHeight(rowIndex) : rowHeight ?? brain.getRowHeight(rowIndex);
|
|
17208
|
+
const activeCellRowOffset = brain.getItemOffsetFor(rowIndex, "vertical") - brain.getScrollOrigin().scrollTop;
|
|
17209
|
+
const vars = {
|
|
17210
|
+
activeCellRowHeight: `${activeCellRowHeight}px`,
|
|
17211
|
+
activeCellRowOffset: `${activeCellRowOffset}px`
|
|
17212
|
+
};
|
|
17213
|
+
if (activeCellColOffset2 !== void 0) {
|
|
17214
|
+
vars.activeCellColOffset = activeCellColOffset2;
|
|
17215
|
+
}
|
|
17216
|
+
return vars;
|
|
17217
|
+
}
|
|
17218
|
+
|
|
16897
17219
|
// src/components/InfiniteTable/components/ActiveRowIndicator.tsx
|
|
16898
17220
|
var { rootClassName: rootClassName6 } = internalProps;
|
|
16899
17221
|
var baseCls = `${rootClassName6}-ActiveRowIndicator`;
|
|
@@ -16911,43 +17233,32 @@ var ActiveRowIndicatorFn = (props) => {
|
|
|
16911
17233
|
const domRef = useRef16(null);
|
|
16912
17234
|
const active = props.activeRowIndex != null && brain.getInitialRows() > props.activeRowIndex;
|
|
16913
17235
|
const [_rerenderId, rerender] = useRerender();
|
|
16914
|
-
|
|
16915
|
-
|
|
17236
|
+
const activeRowIndexRef = useRef16(props.activeRowIndex);
|
|
17237
|
+
activeRowIndexRef.current = props.activeRowIndex;
|
|
17238
|
+
const reposition2 = () => {
|
|
17239
|
+
const activeRowIndex = activeRowIndexRef.current;
|
|
17240
|
+
if (activeRowIndex == null || !domRef.current) {
|
|
16916
17241
|
return;
|
|
16917
17242
|
}
|
|
16918
|
-
|
|
16919
|
-
|
|
16920
|
-
|
|
16921
|
-
|
|
16922
|
-
|
|
16923
|
-
|
|
16924
|
-
}
|
|
16925
|
-
rowIndex = rowIndex % brain.rowsPerPage;
|
|
16926
|
-
}
|
|
16927
|
-
const activeCellRowHeight = brain.getRowHeight(rowIndex);
|
|
16928
|
-
const activeCellRowOffset = brain.getItemOffsetFor(rowIndex, "vertical");
|
|
16929
|
-
const node = domRef.current;
|
|
16930
|
-
const vars = {
|
|
16931
|
-
activeCellRowHeight: `${activeCellRowHeight}px`,
|
|
16932
|
-
activeCellRowOffset: `${activeCellRowOffset}px`,
|
|
16933
|
-
activeCellRowOffsetX
|
|
16934
|
-
};
|
|
16935
|
-
setInfiniteVarsOnNode(vars, node);
|
|
16936
|
-
}, [props.activeRowIndex, brain]);
|
|
17243
|
+
setInfiniteVarsOnNode(
|
|
17244
|
+
getActiveRowIndicatorVars(brain, activeRowIndex),
|
|
17245
|
+
domRef.current
|
|
17246
|
+
);
|
|
17247
|
+
};
|
|
17248
|
+
useLayoutEffect9(reposition2, [props.activeRowIndex, brain]);
|
|
16937
17249
|
useEffect13(() => {
|
|
16938
17250
|
const updateVars = (scrollPosition) => {
|
|
16939
17251
|
setInfiniteVarsOnNode(
|
|
16940
|
-
|
|
16941
|
-
scrollTopForActiveRow: `${-scrollPosition.scrollTop}px`,
|
|
16942
|
-
scrollLeftForActiveRowWhenHorizontalLayout: brain.isHorizontalLayoutBrain ? `${-scrollPosition.scrollLeft}px` : "0px"
|
|
16943
|
-
},
|
|
17252
|
+
getActiveRowIndicatorScrollVars(brain, scrollPosition),
|
|
16944
17253
|
domRef.current
|
|
16945
17254
|
);
|
|
16946
17255
|
};
|
|
16947
17256
|
updateVars(brain.getScrollPosition());
|
|
16948
17257
|
const removeOnScroll = brain.onScroll(updateVars);
|
|
16949
17258
|
const removeOnRenderCountChange = brain.onRenderCountChange(rerender);
|
|
17259
|
+
const removeOnScrollOriginChange = brain.onScrollOriginChange(reposition2);
|
|
16950
17260
|
return () => {
|
|
17261
|
+
removeOnScrollOriginChange();
|
|
16951
17262
|
removeOnRenderCountChange();
|
|
16952
17263
|
removeOnScroll();
|
|
16953
17264
|
};
|
|
@@ -16981,19 +17292,9 @@ var reposition = (brain, activeCellIndex, rowHeight, domRef) => {
|
|
|
16981
17292
|
if (activeCellIndex == null) {
|
|
16982
17293
|
return;
|
|
16983
17294
|
}
|
|
16984
|
-
let [rowIndex] = activeCellIndex;
|
|
16985
|
-
if (brain.isHorizontalLayoutBrain && brain.rowsPerPage) {
|
|
16986
|
-
rowIndex = rowIndex % brain.rowsPerPage;
|
|
16987
|
-
}
|
|
16988
|
-
const activeCellRowHeight = typeof rowHeight === "function" ? rowHeight(rowIndex) : rowHeight ?? brain.getRowHeight(rowIndex);
|
|
16989
|
-
const activeCellRowOffset = brain.getItemOffsetFor(rowIndex, "vertical");
|
|
16990
|
-
const node = domRef.current;
|
|
16991
17295
|
setInfiniteVarsOnNode(
|
|
16992
|
-
|
|
16993
|
-
|
|
16994
|
-
activeCellRowOffset: `${activeCellRowOffset}px`
|
|
16995
|
-
},
|
|
16996
|
-
node
|
|
17296
|
+
getActiveCellIndicatorVars(brain, activeCellIndex, rowHeight),
|
|
17297
|
+
domRef.current
|
|
16997
17298
|
);
|
|
16998
17299
|
};
|
|
16999
17300
|
var ActiveCellIndicatorFn = (props) => {
|
|
@@ -17004,12 +17305,19 @@ var ActiveCellIndicatorFn = (props) => {
|
|
|
17004
17305
|
useLayoutEffect10(() => {
|
|
17005
17306
|
reposition(brain, props.activeCellIndex, props.rowHeight, domRef);
|
|
17006
17307
|
}, [props.activeCellIndex, props.rowHeight, brain]);
|
|
17308
|
+
const propsRef = useRef17(props);
|
|
17309
|
+
propsRef.current = props;
|
|
17007
17310
|
useEffect14(() => {
|
|
17008
17311
|
const removeOnRenderCountChange = brain.onRenderCountChange(() => {
|
|
17009
17312
|
rerender();
|
|
17010
17313
|
});
|
|
17314
|
+
const removeOnScrollOriginChange = brain.onScrollOriginChange(() => {
|
|
17315
|
+
const { activeCellIndex, rowHeight } = propsRef.current;
|
|
17316
|
+
reposition(brain, activeCellIndex, rowHeight, domRef);
|
|
17317
|
+
});
|
|
17011
17318
|
return () => {
|
|
17012
17319
|
removeOnRenderCountChange();
|
|
17320
|
+
removeOnScrollOriginChange();
|
|
17013
17321
|
};
|
|
17014
17322
|
}, [brain]);
|
|
17015
17323
|
return (
|
|
@@ -17118,34 +17426,61 @@ function HeadlessTable(props) {
|
|
|
17118
17426
|
const remove = setupResizeObserver(node, onResize, { debounce: 50 });
|
|
17119
17427
|
return remove;
|
|
17120
17428
|
}, [wrapRowsHorizontally, brain]);
|
|
17121
|
-
const updateDOMTransform = useCallback18(
|
|
17122
|
-
|
|
17123
|
-
|
|
17429
|
+
const updateDOMTransform = useCallback18(
|
|
17430
|
+
(contentScrollPos) => {
|
|
17431
|
+
const scrollPos = brain.getDOMScrollPosition(contentScrollPos);
|
|
17432
|
+
requestAnimationFrame(() => {
|
|
17433
|
+
if (!domRef.current) {
|
|
17434
|
+
return;
|
|
17435
|
+
}
|
|
17436
|
+
domRef.current.style.setProperty(
|
|
17437
|
+
"transform",
|
|
17438
|
+
`translate3d(${-scrollPos.scrollLeft}px, ${-scrollPos.scrollTop}px, 0px)`
|
|
17439
|
+
);
|
|
17124
17440
|
return;
|
|
17125
|
-
}
|
|
17126
|
-
|
|
17127
|
-
|
|
17128
|
-
|
|
17129
|
-
);
|
|
17130
|
-
return;
|
|
17131
|
-
});
|
|
17132
|
-
}, []);
|
|
17441
|
+
});
|
|
17442
|
+
},
|
|
17443
|
+
[brain]
|
|
17444
|
+
);
|
|
17133
17445
|
const onContainerScroll = useCallback18(
|
|
17134
|
-
(
|
|
17135
|
-
brain.setScrollPosition(
|
|
17446
|
+
(nativeScrollPos) => {
|
|
17447
|
+
brain.setScrollPosition(
|
|
17448
|
+
brain.toContentScrollPosition(nativeScrollPos),
|
|
17449
|
+
updateDOMTransform
|
|
17450
|
+
);
|
|
17136
17451
|
},
|
|
17137
17452
|
[brain, updateDOMTransform]
|
|
17138
17453
|
);
|
|
17139
17454
|
useEffect15(() => {
|
|
17140
17455
|
const removeOnRenderCount = brain.onRenderCountChange(() => {
|
|
17141
|
-
setTotalScrollSize(brain.
|
|
17456
|
+
setTotalScrollSize(brain.getNativeScrollSize());
|
|
17142
17457
|
});
|
|
17143
|
-
setTotalScrollSize(brain.
|
|
17458
|
+
setTotalScrollSize(brain.getNativeScrollSize());
|
|
17144
17459
|
updateDOMTransform(
|
|
17145
17460
|
brain.getScrollPosition() || { scrollLeft: 0, scrollTop: 0 }
|
|
17146
17461
|
);
|
|
17147
17462
|
return removeOnRenderCount;
|
|
17148
17463
|
}, [brain]);
|
|
17464
|
+
const scrollRatioRef = useRef18({ brain, vertical: 1, horizontal: 1 });
|
|
17465
|
+
useLayoutEffect11(() => {
|
|
17466
|
+
const prev = scrollRatioRef.current;
|
|
17467
|
+
const vertical = brain.getScrollRatio("vertical");
|
|
17468
|
+
const horizontal = brain.getScrollRatio("horizontal");
|
|
17469
|
+
scrollRatioRef.current = { brain, vertical, horizontal };
|
|
17470
|
+
const scroller = domRef.current?.parentElement;
|
|
17471
|
+
if (!scroller || prev.brain !== brain || prev.vertical === vertical && prev.horizontal === horizontal) {
|
|
17472
|
+
return;
|
|
17473
|
+
}
|
|
17474
|
+
const nativeScrollPos = brain.toNativeScrollPosition(
|
|
17475
|
+
brain.getScrollPosition()
|
|
17476
|
+
);
|
|
17477
|
+
if (prev.vertical !== vertical) {
|
|
17478
|
+
scroller.scrollTop = nativeScrollPos.scrollTop;
|
|
17479
|
+
}
|
|
17480
|
+
if (prev.horizontal !== horizontal) {
|
|
17481
|
+
scroller.scrollLeft = nativeScrollPos.scrollLeft;
|
|
17482
|
+
}
|
|
17483
|
+
}, [scrollSize, brain]);
|
|
17149
17484
|
return /* @__PURE__ */ React41.createElement(
|
|
17150
17485
|
VirtualScrollContainer,
|
|
17151
17486
|
{
|
|
@@ -17626,11 +17961,15 @@ function InfiniteTableInternalHeaderFn(props) {
|
|
|
17626
17961
|
};
|
|
17627
17962
|
});
|
|
17628
17963
|
const domRef = useRef20(null);
|
|
17629
|
-
const updateDOMTransform = useCallback20(
|
|
17630
|
-
|
|
17631
|
-
domRef.current
|
|
17632
|
-
|
|
17633
|
-
|
|
17964
|
+
const updateDOMTransform = useCallback20(
|
|
17965
|
+
(scrollPosition) => {
|
|
17966
|
+
if (domRef.current) {
|
|
17967
|
+
const { scrollLeft: scrollLeft2 } = headerBrain.getDOMScrollPosition(scrollPosition);
|
|
17968
|
+
domRef.current.style.transform = `translate3d(${-scrollLeft2}px, 0px, 0px)`;
|
|
17969
|
+
}
|
|
17970
|
+
},
|
|
17971
|
+
[headerBrain]
|
|
17972
|
+
);
|
|
17634
17973
|
useEffect16(() => {
|
|
17635
17974
|
const removeOnScroll = headerBrain.onScroll(updateDOMTransform);
|
|
17636
17975
|
updateDOMTransform(
|
|
@@ -20808,10 +21147,10 @@ var InfiniteTableApiImpl = class {
|
|
|
20808
21147
|
return false;
|
|
20809
21148
|
}
|
|
20810
21149
|
if (newScrollPosition.scrollLeft !== currentScrollPosition.scrollLeft && !cantScrollLeft) {
|
|
20811
|
-
|
|
21150
|
+
this.setNativeScroll({ scrollLeft: newScrollPosition.scrollLeft });
|
|
20812
21151
|
}
|
|
20813
21152
|
if (newScrollPosition.scrollTop !== currentScrollPosition.scrollTop && !cantScrollTop) {
|
|
20814
|
-
|
|
21153
|
+
this.setNativeScroll({ scrollTop: newScrollPosition.scrollTop });
|
|
20815
21154
|
}
|
|
20816
21155
|
return true;
|
|
20817
21156
|
};
|
|
@@ -21242,6 +21581,29 @@ var InfiniteTableApiImpl = class {
|
|
|
21242
21581
|
get scrollContainer() {
|
|
21243
21582
|
return this.getState().scrollerDOMRef.current;
|
|
21244
21583
|
}
|
|
21584
|
+
/**
|
|
21585
|
+
* All scroll positions in the API are content positions. The scroll
|
|
21586
|
+
* container can be shorter than the content (when the content is larger
|
|
21587
|
+
* than what browsers support), so writes go through the brain's ratio -
|
|
21588
|
+
* see VirtualBrain/largeContent.ts. Identity when the content fits.
|
|
21589
|
+
*/
|
|
21590
|
+
setNativeScroll(contentScroll) {
|
|
21591
|
+
const state = this.getState();
|
|
21592
|
+
const scroller = state.scrollerDOMRef.current;
|
|
21593
|
+
if (!scroller) {
|
|
21594
|
+
return;
|
|
21595
|
+
}
|
|
21596
|
+
const native = state.brain.toNativeScrollPosition({
|
|
21597
|
+
scrollTop: contentScroll.scrollTop ?? 0,
|
|
21598
|
+
scrollLeft: contentScroll.scrollLeft ?? 0
|
|
21599
|
+
});
|
|
21600
|
+
if (contentScroll.scrollTop !== void 0) {
|
|
21601
|
+
scroller.scrollTop = native.scrollTop;
|
|
21602
|
+
}
|
|
21603
|
+
if (contentScroll.scrollLeft !== void 0) {
|
|
21604
|
+
scroller.scrollLeft = native.scrollLeft;
|
|
21605
|
+
}
|
|
21606
|
+
}
|
|
21245
21607
|
get scrollLeftMax() {
|
|
21246
21608
|
const scrollLeftMax = this.getState().brain.scrollLeftMax;
|
|
21247
21609
|
return scrollLeftMax;
|
|
@@ -21255,20 +21617,14 @@ var InfiniteTableApiImpl = class {
|
|
|
21255
21617
|
return state.brain.getScrollPosition().scrollLeft;
|
|
21256
21618
|
}
|
|
21257
21619
|
set scrollLeft(scrollLeft2) {
|
|
21258
|
-
|
|
21259
|
-
if (state.scrollerDOMRef.current) {
|
|
21260
|
-
state.scrollerDOMRef.current.scrollLeft = Math.max(scrollLeft2, 0);
|
|
21261
|
-
}
|
|
21620
|
+
this.setNativeScroll({ scrollLeft: Math.max(scrollLeft2, 0) });
|
|
21262
21621
|
}
|
|
21263
21622
|
get scrollTop() {
|
|
21264
21623
|
const state = this.getState();
|
|
21265
21624
|
return state.brain.getScrollPosition().scrollTop;
|
|
21266
21625
|
}
|
|
21267
21626
|
set scrollTop(scrollTop2) {
|
|
21268
|
-
|
|
21269
|
-
if (state.scrollerDOMRef.current) {
|
|
21270
|
-
state.scrollerDOMRef.current.scrollTop = Math.max(scrollTop2, 0);
|
|
21271
|
-
}
|
|
21627
|
+
this.setNativeScroll({ scrollTop: Math.max(scrollTop2, 0) });
|
|
21272
21628
|
}
|
|
21273
21629
|
scrollRowIntoView(rowIndex, config = { offset: 0 }) {
|
|
21274
21630
|
const state = this.getState();
|
|
@@ -21294,10 +21650,10 @@ var InfiniteTableApiImpl = class {
|
|
|
21294
21650
|
return false;
|
|
21295
21651
|
}
|
|
21296
21652
|
if (scrollTopValid && scrollPosition.scrollTop !== currentScrollPosition.scrollTop) {
|
|
21297
|
-
|
|
21653
|
+
this.setNativeScroll({ scrollTop: scrollPosition.scrollTop });
|
|
21298
21654
|
}
|
|
21299
21655
|
if (scrollLeftChanged) {
|
|
21300
|
-
|
|
21656
|
+
this.setNativeScroll({ scrollLeft: scrollPosition.scrollLeft });
|
|
21301
21657
|
}
|
|
21302
21658
|
return true;
|
|
21303
21659
|
}
|
|
@@ -21319,7 +21675,7 @@ var InfiniteTableApiImpl = class {
|
|
|
21319
21675
|
return false;
|
|
21320
21676
|
}
|
|
21321
21677
|
if (scrollPosition.scrollLeft !== currentScrollPosition.scrollLeft) {
|
|
21322
|
-
|
|
21678
|
+
this.setNativeScroll({ scrollLeft: scrollPosition.scrollLeft });
|
|
21323
21679
|
}
|
|
21324
21680
|
return true;
|
|
21325
21681
|
}
|
|
@@ -25600,7 +25956,7 @@ function concludeReducer(params) {
|
|
|
25600
25956
|
import React52, {
|
|
25601
25957
|
useCallback as useCallback24,
|
|
25602
25958
|
useEffect as useEffect22,
|
|
25603
|
-
useLayoutEffect as
|
|
25959
|
+
useLayoutEffect as useLayoutEffect13,
|
|
25604
25960
|
useState as useState18
|
|
25605
25961
|
} from "react";
|
|
25606
25962
|
|
|
@@ -25613,7 +25969,7 @@ function createDataSourceStore() {
|
|
|
25613
25969
|
import { useEffect as useEffect21, useMemo as useMemo11, useRef as useRef25, useState as useState17 } from "react";
|
|
25614
25970
|
|
|
25615
25971
|
// src/components/hooks/useEffectWithChanges.ts
|
|
25616
|
-
import { useEffect as useEffect20, useLayoutEffect as
|
|
25972
|
+
import { useEffect as useEffect20, useLayoutEffect as useLayoutEffect12, useRef as useRef24 } from "react";
|
|
25617
25973
|
function useEffectWithChanges(fn, deps) {
|
|
25618
25974
|
const prevRef = useRef24({});
|
|
25619
25975
|
const oldValuesRef = useRef24({});
|
|
@@ -25659,7 +26015,7 @@ function useLayoutEffectWithChanges(fn, deps) {
|
|
|
25659
26015
|
}
|
|
25660
26016
|
}
|
|
25661
26017
|
prevRef.current = deps;
|
|
25662
|
-
|
|
26018
|
+
useLayoutEffect12(() => {
|
|
25663
26019
|
const changes2 = changesRef.current;
|
|
25664
26020
|
let result = void 0;
|
|
25665
26021
|
if (Object.keys(changes2).length !== 0) {
|
|
@@ -26161,7 +26517,7 @@ function useDataSourceInternal(props) {
|
|
|
26161
26517
|
}
|
|
26162
26518
|
const contextValue2 = getLatestContextValue();
|
|
26163
26519
|
store.setSnapshot(contextValue2);
|
|
26164
|
-
|
|
26520
|
+
useLayoutEffect13(() => {
|
|
26165
26521
|
store.notify();
|
|
26166
26522
|
});
|
|
26167
26523
|
return /* @__PURE__ */ React52.createElement(
|
|
@@ -26175,13 +26531,13 @@ function useDataSourceInternal(props) {
|
|
|
26175
26531
|
},
|
|
26176
26532
|
[ContextComponent, isDetail, key]
|
|
26177
26533
|
);
|
|
26178
|
-
|
|
26534
|
+
useLayoutEffect13(() => {
|
|
26179
26535
|
const masterContext = getDataSourceMasterContext();
|
|
26180
26536
|
if (masterContext) {
|
|
26181
26537
|
masterContext.registerDetail(contextValue);
|
|
26182
26538
|
}
|
|
26183
26539
|
}, []);
|
|
26184
|
-
|
|
26540
|
+
useLayoutEffect13(() => {
|
|
26185
26541
|
return () => {
|
|
26186
26542
|
const state = getDataSourceState();
|
|
26187
26543
|
state.onCleanup(state);
|
|
@@ -26465,7 +26821,7 @@ function useColumnSizeFn(columns) {
|
|
|
26465
26821
|
}
|
|
26466
26822
|
|
|
26467
26823
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
26468
|
-
import { useEffect as useEffect23, useLayoutEffect as
|
|
26824
|
+
import { useEffect as useEffect23, useLayoutEffect as useLayoutEffect14, useMemo as useMemo13 } from "react";
|
|
26469
26825
|
|
|
26470
26826
|
// src/components/VirtualBrain/ScrollListener.ts
|
|
26471
26827
|
var initialScrollPosition = {
|
|
@@ -26566,6 +26922,12 @@ var HorizontalLayoutMatrixBrain = class extends MatrixBrain {
|
|
|
26566
26922
|
this.onTotalPageCountChangeFns.delete(fn);
|
|
26567
26923
|
};
|
|
26568
26924
|
};
|
|
26925
|
+
this.onScrollOriginChange = (fn) => {
|
|
26926
|
+
if (this.options?.masterBrain) {
|
|
26927
|
+
return this.options.masterBrain.onScrollOriginChange(fn);
|
|
26928
|
+
}
|
|
26929
|
+
return super.onScrollOriginChangeForBrain(fn);
|
|
26930
|
+
};
|
|
26569
26931
|
this.options = opts;
|
|
26570
26932
|
if (this.options.masterBrain) {
|
|
26571
26933
|
this.options.masterBrain.onTotalPageCountChange(() => {
|
|
@@ -26807,6 +27169,46 @@ var HorizontalLayoutMatrixBrain = class extends MatrixBrain {
|
|
|
26807
27169
|
this.options.masterBrain = void 0;
|
|
26808
27170
|
this.onTotalPageCountChangeFns.clear();
|
|
26809
27171
|
}
|
|
27172
|
+
// -------------------------------------------------------------------------
|
|
27173
|
+
// very large content - see largeContent.ts
|
|
27174
|
+
//
|
|
27175
|
+
// Here the rows become width (pageWidth x totalPageCount) while the height
|
|
27176
|
+
// always fits the viewport, so it's the horizontal axis that can get larger
|
|
27177
|
+
// than the browser supports - with way fewer rows than in the normal layout.
|
|
27178
|
+
// -------------------------------------------------------------------------
|
|
27179
|
+
supportsLargeContent(direction) {
|
|
27180
|
+
return direction === "horizontal";
|
|
27181
|
+
}
|
|
27182
|
+
/**
|
|
27183
|
+
* The horizontal origin is a whole number of pages: cells are positioned at
|
|
27184
|
+
* `calc(pageWidth * (pageIndex - originPageIndex))`, with pageWidth being a
|
|
27185
|
+
* CSS var (so column resizes keep working without rewriting every cell).
|
|
27186
|
+
*/
|
|
27187
|
+
alignScrollOrigin(direction, value) {
|
|
27188
|
+
if (direction === "vertical" || !this.pageWidth) {
|
|
27189
|
+
return Math.floor(value);
|
|
27190
|
+
}
|
|
27191
|
+
return Math.floor(value / this.pageWidth) * this.pageWidth;
|
|
27192
|
+
}
|
|
27193
|
+
/**
|
|
27194
|
+
* The page at the horizontal scroll origin - page offsets in the DOM are
|
|
27195
|
+
* relative to it.
|
|
27196
|
+
*/
|
|
27197
|
+
getScrollOriginPageIndex() {
|
|
27198
|
+
const pageWidth = this.getPageWidth();
|
|
27199
|
+
return pageWidth ? Math.round(this.getScrollOrigin().scrollLeft / pageWidth) : 0;
|
|
27200
|
+
}
|
|
27201
|
+
// the header brain follows the body brain (its master) - same origin, so
|
|
27202
|
+
// the header and the body cells stay aligned
|
|
27203
|
+
getScrollOrigin() {
|
|
27204
|
+
return this.options?.masterBrain ? this.options.masterBrain.getScrollOrigin() : super.getScrollOrigin();
|
|
27205
|
+
}
|
|
27206
|
+
updateScrollOrigin() {
|
|
27207
|
+
if (this.options?.masterBrain) {
|
|
27208
|
+
return;
|
|
27209
|
+
}
|
|
27210
|
+
super.updateScrollOrigin();
|
|
27211
|
+
}
|
|
26810
27212
|
getVirtualizedContentSizeFor(direction) {
|
|
26811
27213
|
if (direction === "vertical") {
|
|
26812
27214
|
const rowHeight = this.getInitialRowHeight();
|
|
@@ -27909,7 +28311,7 @@ function useHideColumns(groupByMap, state, actions) {
|
|
|
27909
28311
|
} = state;
|
|
27910
28312
|
const componentActions = actions;
|
|
27911
28313
|
const getComponentState = useLatest(state);
|
|
27912
|
-
|
|
28314
|
+
useLayoutEffect14(() => {
|
|
27913
28315
|
if (groupRenderStrategy !== "multi-column") {
|
|
27914
28316
|
return;
|
|
27915
28317
|
}
|
|
@@ -28257,7 +28659,7 @@ function useComputedRowHeight(param) {
|
|
|
28257
28659
|
}
|
|
28258
28660
|
|
|
28259
28661
|
// src/components/InfiniteTable/hooks/useScrollbars.ts
|
|
28260
|
-
import { useState as useState19, useEffect as useEffect24, useLayoutEffect as
|
|
28662
|
+
import { useState as useState19, useEffect as useEffect24, useLayoutEffect as useLayoutEffect15 } from "react";
|
|
28261
28663
|
var INITIAL_SCROLLBARS = {
|
|
28262
28664
|
vertical: false,
|
|
28263
28665
|
horizontal: false
|
|
@@ -28279,7 +28681,7 @@ function useScrollbars(getState) {
|
|
|
28279
28681
|
});
|
|
28280
28682
|
});
|
|
28281
28683
|
}, [brain]);
|
|
28282
|
-
|
|
28684
|
+
useLayoutEffect15(() => {
|
|
28283
28685
|
const dataSourceState = getDataSourceState();
|
|
28284
28686
|
const { onScrollbarsChange } = getState();
|
|
28285
28687
|
const { notifyScrollbarsChange } = dataSourceState;
|
|
@@ -28716,7 +29118,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
28716
29118
|
}
|
|
28717
29119
|
let valid2 = isValidLicense(licenseKey, {
|
|
28718
29120
|
publishedAt: 1624970570587,
|
|
28719
|
-
version: "10.1.
|
|
29121
|
+
version: "10.1.4"
|
|
28720
29122
|
});
|
|
28721
29123
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
28722
29124
|
return true;
|
|
@@ -29432,7 +29834,7 @@ import * as React57 from "react";
|
|
|
29432
29834
|
import {
|
|
29433
29835
|
useCallback as useCallback28,
|
|
29434
29836
|
useEffect as useEffect30,
|
|
29435
|
-
useLayoutEffect as
|
|
29837
|
+
useLayoutEffect as useLayoutEffect16,
|
|
29436
29838
|
useState as useState21
|
|
29437
29839
|
} from "react";
|
|
29438
29840
|
import { createPortal as createPortal2 } from "react-dom";
|
|
@@ -29677,7 +30079,7 @@ function OverlayContent(props) {
|
|
|
29677
30079
|
}
|
|
29678
30080
|
function useOverlayPortal(content, portalContainer) {
|
|
29679
30081
|
const [container, setContainer] = useState21(null);
|
|
29680
|
-
|
|
30082
|
+
useLayoutEffect16(() => {
|
|
29681
30083
|
async function getContainer() {
|
|
29682
30084
|
const container2 = portalContainer ? await retrieveElement(portalContainer) : null;
|
|
29683
30085
|
if (container2 != null) {
|
|
@@ -30012,7 +30414,7 @@ var deriveStateFromProps2 = (params) => {
|
|
|
30012
30414
|
import * as React61 from "react";
|
|
30013
30415
|
import {
|
|
30014
30416
|
useCallback as useCallback30,
|
|
30015
|
-
useLayoutEffect as
|
|
30417
|
+
useLayoutEffect as useLayoutEffect17,
|
|
30016
30418
|
useRef as useRef30,
|
|
30017
30419
|
useState as useState23
|
|
30018
30420
|
} from "react";
|
|
@@ -30412,7 +30814,7 @@ function MenuComponent(props) {
|
|
|
30412
30814
|
const isMounted = useMounted();
|
|
30413
30815
|
const [submenuApi, setSubmenuApi] = useState23(null);
|
|
30414
30816
|
let renderedChildren = null;
|
|
30415
|
-
|
|
30817
|
+
useLayoutEffect17(() => {
|
|
30416
30818
|
const { runtimeItems: runtimeItems2 } = getState();
|
|
30417
30819
|
const activeItem = runtimeItems2.filter(
|
|
30418
30820
|
(item) => item.type === "item" && activeItemKey === item.key
|