@infinite-table/infinite-react 5.1.0-canary.0 → 5.1.0-canary.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +7 -4
- package/index.dev.js +126 -66
- package/index.dev.mjs +126 -66
- package/index.js +126 -66
- package/index.mjs +126 -66
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -266,6 +266,8 @@ declare class MatrixBrain extends Logger implements IBrain {
|
|
|
266
266
|
private horizontalTotalSize;
|
|
267
267
|
private horizontalRenderCount?;
|
|
268
268
|
private verticalRenderCount?;
|
|
269
|
+
private horizontalExtendRangeBy;
|
|
270
|
+
private verticalExtendRangeBy;
|
|
269
271
|
protected horizontalRenderRange: RenderRangeType;
|
|
270
272
|
protected verticalRenderRange: RenderRangeType;
|
|
271
273
|
protected extraSpanCells: [number, number][];
|
|
@@ -315,8 +317,9 @@ declare class MatrixBrain extends Logger implements IBrain {
|
|
|
315
317
|
* @param options.right - if true, extends the right side with the amount of current visible columns, otherwise with the specified number
|
|
316
318
|
*/
|
|
317
319
|
extendRenderRange(options: {
|
|
318
|
-
|
|
319
|
-
|
|
320
|
+
start?: number | boolean;
|
|
321
|
+
end?: number | boolean;
|
|
322
|
+
direction: 'horizontal' | 'vertical';
|
|
320
323
|
}): () => void;
|
|
321
324
|
updateRenderCount(which?: WhichDirection): void;
|
|
322
325
|
protected doUpdateRenderCount(which?: WhichDirection): void;
|
|
@@ -331,7 +334,7 @@ declare class MatrixBrain extends Logger implements IBrain {
|
|
|
331
334
|
protected notifyVerticalRenderRangeChange: () => void;
|
|
332
335
|
protected notifyHorizontalRenderRangeChange: () => void;
|
|
333
336
|
private notifyScrollChange;
|
|
334
|
-
|
|
337
|
+
protected computeDirectionalRenderCount(direction: 'horizontal' | 'vertical', itemSize: number | ItemSizeFunction, count: number, theRenderSize: Size): number;
|
|
335
338
|
getFixedSize(direction: 'horizontal' | 'vertical'): number;
|
|
336
339
|
getFixedStartSize(direction: 'horizontal' | 'vertical'): number;
|
|
337
340
|
getFixedEndSize(direction: 'horizontal' | 'vertical'): number;
|
|
@@ -378,7 +381,7 @@ declare class MatrixBrain extends Logger implements IBrain {
|
|
|
378
381
|
setRenderCount: ({ horizontal, vertical, }: {
|
|
379
382
|
horizontal: number | undefined;
|
|
380
383
|
vertical: number | undefined;
|
|
381
|
-
}
|
|
384
|
+
}) => void;
|
|
382
385
|
private notifyRenderCountChange;
|
|
383
386
|
updateFixedCells: (config: {
|
|
384
387
|
fixedColsStart?: number;
|
package/index.dev.js
CHANGED
|
@@ -1557,6 +1557,14 @@ var MatrixBrain = class extends Logger {
|
|
|
1557
1557
|
this.horizontalTotalSize = 0;
|
|
1558
1558
|
this.horizontalRenderCount = void 0;
|
|
1559
1559
|
this.verticalRenderCount = void 0;
|
|
1560
|
+
this.horizontalExtendRangeBy = {
|
|
1561
|
+
start: 0,
|
|
1562
|
+
end: 0
|
|
1563
|
+
};
|
|
1564
|
+
this.verticalExtendRangeBy = {
|
|
1565
|
+
start: 0,
|
|
1566
|
+
end: 0
|
|
1567
|
+
};
|
|
1560
1568
|
this.horizontalRenderRange = {
|
|
1561
1569
|
startIndex: 0,
|
|
1562
1570
|
endIndex: 0
|
|
@@ -1696,34 +1704,6 @@ var MatrixBrain = class extends Logger {
|
|
|
1696
1704
|
});
|
|
1697
1705
|
});
|
|
1698
1706
|
};
|
|
1699
|
-
this.computeDirectionalRenderCount = (direction, itemSize, count, theRenderSize) => {
|
|
1700
|
-
let renderCount = 0;
|
|
1701
|
-
let size = direction === "horizontal" ? theRenderSize.width : theRenderSize.height;
|
|
1702
|
-
size -= this.getFixedSize(direction);
|
|
1703
|
-
if (size <= 0) {
|
|
1704
|
-
return 0;
|
|
1705
|
-
}
|
|
1706
|
-
if (typeof itemSize === "function") {
|
|
1707
|
-
const sizes = [];
|
|
1708
|
-
for (let i = 0; i < count; i++) {
|
|
1709
|
-
sizes.push(this.getItemSize(i, direction));
|
|
1710
|
-
}
|
|
1711
|
-
sizes.sort(SORT_ASC);
|
|
1712
|
-
let sum2 = 0;
|
|
1713
|
-
for (let i = 0; i < count; i++) {
|
|
1714
|
-
sum2 += sizes[i];
|
|
1715
|
-
renderCount++;
|
|
1716
|
-
if (sum2 > size) {
|
|
1717
|
-
break;
|
|
1718
|
-
}
|
|
1719
|
-
}
|
|
1720
|
-
renderCount += 1;
|
|
1721
|
-
} else {
|
|
1722
|
-
renderCount = (itemSize ? Math.ceil(size / itemSize) : 0) + 1;
|
|
1723
|
-
}
|
|
1724
|
-
renderCount = Math.min(count, renderCount);
|
|
1725
|
-
return renderCount;
|
|
1726
|
-
};
|
|
1727
1707
|
this.isColFixedEnd = (colIndex) => {
|
|
1728
1708
|
if (!this.fixedColsEnd) {
|
|
1729
1709
|
return false;
|
|
@@ -1894,7 +1874,7 @@ var MatrixBrain = class extends Logger {
|
|
|
1894
1874
|
this.setRenderCount = ({
|
|
1895
1875
|
horizontal,
|
|
1896
1876
|
vertical
|
|
1897
|
-
}
|
|
1877
|
+
}) => {
|
|
1898
1878
|
if (horizontal === void 0) {
|
|
1899
1879
|
horizontal = this.horizontalRenderCount;
|
|
1900
1880
|
}
|
|
@@ -1903,14 +1883,14 @@ var MatrixBrain = class extends Logger {
|
|
|
1903
1883
|
}
|
|
1904
1884
|
const horizontalSame = horizontal === this.horizontalRenderCount;
|
|
1905
1885
|
const verticalSame = vertical === this.verticalRenderCount;
|
|
1906
|
-
if (horizontalSame && verticalSame
|
|
1886
|
+
if (horizontalSame && verticalSame) {
|
|
1907
1887
|
return;
|
|
1908
1888
|
}
|
|
1909
1889
|
this.horizontalRenderCount = horizontal;
|
|
1910
1890
|
this.verticalRenderCount = vertical;
|
|
1911
1891
|
this.updateRenderRange({
|
|
1912
|
-
horizontal:
|
|
1913
|
-
vertical:
|
|
1892
|
+
horizontal: !horizontalSame,
|
|
1893
|
+
vertical: !verticalSame
|
|
1914
1894
|
});
|
|
1915
1895
|
this.notifyRenderCountChange();
|
|
1916
1896
|
};
|
|
@@ -1990,7 +1970,7 @@ var MatrixBrain = class extends Logger {
|
|
|
1990
1970
|
};
|
|
1991
1971
|
};
|
|
1992
1972
|
this.computeDirectionalRenderRange = (direction) => {
|
|
1993
|
-
|
|
1973
|
+
let renderCount = direction === "horizontal" ? this.horizontalRenderCount : this.verticalRenderCount;
|
|
1994
1974
|
const count = direction === "horizontal" ? this.cols : this.rows;
|
|
1995
1975
|
if (!renderCount) {
|
|
1996
1976
|
return {
|
|
@@ -2001,7 +1981,15 @@ var MatrixBrain = class extends Logger {
|
|
|
2001
1981
|
const fixedStartIndex = (direction === "horizontal" ? this.fixedColsStart : this.fixedRowsStart) || 0;
|
|
2002
1982
|
let scrollPositionForDirection = direction === "horizontal" ? this.scrollPosition.scrollLeft : this.scrollPosition.scrollTop;
|
|
2003
1983
|
scrollPositionForDirection += this.getFixedStartSize(direction);
|
|
1984
|
+
const extendBy = direction === "horizontal" ? this.horizontalExtendRangeBy : this.verticalExtendRangeBy;
|
|
2004
1985
|
let startIndex = this.getItemAt(scrollPositionForDirection, direction);
|
|
1986
|
+
if (extendBy.start) {
|
|
1987
|
+
startIndex = Math.max(0, startIndex - extendBy.start);
|
|
1988
|
+
renderCount += extendBy.start;
|
|
1989
|
+
}
|
|
1990
|
+
if (extendBy.end) {
|
|
1991
|
+
renderCount += extendBy.end;
|
|
1992
|
+
}
|
|
2005
1993
|
let endIndex = startIndex + renderCount;
|
|
2006
1994
|
const theEnd = Math.max(
|
|
2007
1995
|
fixedStartIndex,
|
|
@@ -2045,7 +2033,6 @@ var MatrixBrain = class extends Logger {
|
|
|
2045
2033
|
return searchResult;
|
|
2046
2034
|
}
|
|
2047
2035
|
return ~searchResult - 1;
|
|
2048
|
-
return 0;
|
|
2049
2036
|
};
|
|
2050
2037
|
this.computeCacheFor = (itemIndex, direction) => {
|
|
2051
2038
|
const itemSizeValueOrFn = direction === "horizontal" ? this.colWidth : this.rowHeight;
|
|
@@ -2488,31 +2475,30 @@ var MatrixBrain = class extends Logger {
|
|
|
2488
2475
|
* @param options.right - if true, extends the right side with the amount of current visible columns, otherwise with the specified number
|
|
2489
2476
|
*/
|
|
2490
2477
|
extendRenderRange(options) {
|
|
2491
|
-
const
|
|
2492
|
-
const
|
|
2493
|
-
const
|
|
2478
|
+
const { direction } = options;
|
|
2479
|
+
const horizontal = direction === "horizontal";
|
|
2480
|
+
const extendValueWhenTrue = horizontal ? this.horizontalRenderCount || this.getInitialCols() : this.verticalRenderCount || this.getInitialRows();
|
|
2481
|
+
const startAmount = typeof options.start === "number" ? options.start : options.start === true ? extendValueWhenTrue : 0;
|
|
2482
|
+
const endAmount = typeof options.end === "number" ? options.end : options.end === true ? extendValueWhenTrue : 0;
|
|
2483
|
+
if (horizontal) {
|
|
2484
|
+
this.horizontalExtendRangeBy = {
|
|
2485
|
+
start: startAmount,
|
|
2486
|
+
end: endAmount
|
|
2487
|
+
};
|
|
2488
|
+
} else {
|
|
2489
|
+
this.verticalExtendRangeBy = {
|
|
2490
|
+
start: startAmount,
|
|
2491
|
+
end: endAmount
|
|
2492
|
+
};
|
|
2493
|
+
}
|
|
2494
|
+
this.updateRenderRange({ horizontal, vertical: !horizontal });
|
|
2494
2495
|
const restore = () => {
|
|
2495
|
-
this.
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
true
|
|
2501
|
-
);
|
|
2496
|
+
this.extendRenderRange({
|
|
2497
|
+
start: 0,
|
|
2498
|
+
end: 0,
|
|
2499
|
+
direction
|
|
2500
|
+
});
|
|
2502
2501
|
};
|
|
2503
|
-
const { start, end } = this.getRenderRange();
|
|
2504
|
-
const [startRow, startCol] = start;
|
|
2505
|
-
const [endRow, endCol] = end;
|
|
2506
|
-
this.setRenderRange({
|
|
2507
|
-
horizontal: {
|
|
2508
|
-
startIndex: Math.max(0, startCol - leftAmount),
|
|
2509
|
-
endIndex: Math.min(this.cols, endCol + rightAmount)
|
|
2510
|
-
},
|
|
2511
|
-
vertical: {
|
|
2512
|
-
startIndex: startRow,
|
|
2513
|
-
endIndex: endRow
|
|
2514
|
-
}
|
|
2515
|
-
});
|
|
2516
2502
|
return restore;
|
|
2517
2503
|
}
|
|
2518
2504
|
updateRenderCount(which = ALL_DIRECTIONS) {
|
|
@@ -2584,6 +2570,34 @@ var MatrixBrain = class extends Logger {
|
|
|
2584
2570
|
fns[i](scrollPosition);
|
|
2585
2571
|
}
|
|
2586
2572
|
}
|
|
2573
|
+
computeDirectionalRenderCount(direction, itemSize, count, theRenderSize) {
|
|
2574
|
+
let renderCount = 0;
|
|
2575
|
+
let size = direction === "horizontal" ? theRenderSize.width : theRenderSize.height;
|
|
2576
|
+
size -= this.getFixedSize(direction);
|
|
2577
|
+
if (size <= 0) {
|
|
2578
|
+
return 0;
|
|
2579
|
+
}
|
|
2580
|
+
if (typeof itemSize === "function") {
|
|
2581
|
+
const sizes = [];
|
|
2582
|
+
for (let i = 0; i < count; i++) {
|
|
2583
|
+
sizes.push(this.getItemSize(i, direction));
|
|
2584
|
+
}
|
|
2585
|
+
sizes.sort(SORT_ASC);
|
|
2586
|
+
let sum2 = 0;
|
|
2587
|
+
for (let i = 0; i < count; i++) {
|
|
2588
|
+
sum2 += sizes[i];
|
|
2589
|
+
renderCount++;
|
|
2590
|
+
if (sum2 > size) {
|
|
2591
|
+
break;
|
|
2592
|
+
}
|
|
2593
|
+
}
|
|
2594
|
+
renderCount += 1;
|
|
2595
|
+
} else {
|
|
2596
|
+
renderCount = (itemSize ? Math.ceil(size / itemSize) : 0) + 1;
|
|
2597
|
+
}
|
|
2598
|
+
renderCount = Math.min(count, renderCount);
|
|
2599
|
+
return renderCount;
|
|
2600
|
+
}
|
|
2587
2601
|
getFixedSize(direction) {
|
|
2588
2602
|
return direction === "horizontal" ? this.getFixedStartColsWidth() + this.getFixedEndColsWidth() : this.getFixedStartRowsHeight() + this.getFixedEndRowsHeight();
|
|
2589
2603
|
}
|
|
@@ -2698,6 +2712,8 @@ var MatrixBrain = class extends Logger {
|
|
|
2698
2712
|
this.rowspanParent.clear();
|
|
2699
2713
|
this.colspanParent.clear();
|
|
2700
2714
|
this.alwaysRenderedColumns.clear();
|
|
2715
|
+
this.horizontalExtendRangeBy = { start: 0, end: 0 };
|
|
2716
|
+
this.verticalExtendRangeBy = { start: 0, end: 0 };
|
|
2701
2717
|
this.destroyed = true;
|
|
2702
2718
|
this.onDestroyFns = [];
|
|
2703
2719
|
this.onScrollFns = [];
|
|
@@ -7837,12 +7853,14 @@ var useColumnPointerEvents = ({
|
|
|
7837
7853
|
if (brain2.isHorizontalLayoutBrain) {
|
|
7838
7854
|
const extendBy = true;
|
|
7839
7855
|
const restoreBodyRange = brain2.extendRenderRange({
|
|
7840
|
-
|
|
7841
|
-
|
|
7856
|
+
start: extendBy,
|
|
7857
|
+
end: extendBy,
|
|
7858
|
+
direction: "horizontal"
|
|
7842
7859
|
});
|
|
7843
7860
|
const restoreHeaderRange = headerBrain.extendRenderRange({
|
|
7844
|
-
|
|
7845
|
-
|
|
7861
|
+
start: extendBy,
|
|
7862
|
+
end: extendBy,
|
|
7863
|
+
direction: "horizontal"
|
|
7846
7864
|
});
|
|
7847
7865
|
restoreRenderRange = () => {
|
|
7848
7866
|
restoreBodyRange();
|
|
@@ -9596,12 +9614,14 @@ function ResizeHandleFn(props) {
|
|
|
9596
9614
|
const target = e.target;
|
|
9597
9615
|
if (brain.isHorizontalLayoutBrain) {
|
|
9598
9616
|
const restoreBodyRange = brain.extendRenderRange({
|
|
9599
|
-
|
|
9600
|
-
|
|
9617
|
+
start: true,
|
|
9618
|
+
end: true,
|
|
9619
|
+
direction: "horizontal"
|
|
9601
9620
|
});
|
|
9602
9621
|
const restoreHeaderRange = headerBrain.extendRenderRange({
|
|
9603
|
-
|
|
9604
|
-
|
|
9622
|
+
start: true,
|
|
9623
|
+
end: true,
|
|
9624
|
+
direction: "horizontal"
|
|
9605
9625
|
});
|
|
9606
9626
|
restoreRenderRange = () => {
|
|
9607
9627
|
restoreBodyRange();
|
|
@@ -18266,6 +18286,46 @@ var HorizontalLayoutMatrixBrain = class extends MatrixBrain {
|
|
|
18266
18286
|
});
|
|
18267
18287
|
}
|
|
18268
18288
|
}
|
|
18289
|
+
computeDirectionalRenderCount(direction, itemSize, count, theRenderSize) {
|
|
18290
|
+
if (direction === "vertical") {
|
|
18291
|
+
return super.computeDirectionalRenderCount(
|
|
18292
|
+
direction,
|
|
18293
|
+
itemSize,
|
|
18294
|
+
count,
|
|
18295
|
+
theRenderSize
|
|
18296
|
+
);
|
|
18297
|
+
}
|
|
18298
|
+
let renderCount = 0;
|
|
18299
|
+
let size = theRenderSize.width;
|
|
18300
|
+
size -= this.getFixedSize("horizontal");
|
|
18301
|
+
if (size <= 0) {
|
|
18302
|
+
return 0;
|
|
18303
|
+
}
|
|
18304
|
+
if (typeof itemSize === "number") {
|
|
18305
|
+
renderCount = (itemSize ? Math.ceil(size / itemSize) : 0) + 1;
|
|
18306
|
+
renderCount = Math.min(count, renderCount);
|
|
18307
|
+
return renderCount;
|
|
18308
|
+
}
|
|
18309
|
+
const pagesInView = Math.floor(size / this.pageWidth);
|
|
18310
|
+
renderCount += pagesInView * this.initialCols;
|
|
18311
|
+
const remainingSize = size - pagesInView * this.pageWidth;
|
|
18312
|
+
const sizes = [];
|
|
18313
|
+
for (let i = 0; i < this.initialCols; i++) {
|
|
18314
|
+
sizes.push(this.getItemSize(i, direction));
|
|
18315
|
+
}
|
|
18316
|
+
sizes.sort(SORT_ASC);
|
|
18317
|
+
let sum2 = 0;
|
|
18318
|
+
for (let i = 0; i < this.initialCols; i++) {
|
|
18319
|
+
sum2 += sizes[i];
|
|
18320
|
+
renderCount++;
|
|
18321
|
+
if (sum2 > remainingSize) {
|
|
18322
|
+
break;
|
|
18323
|
+
}
|
|
18324
|
+
}
|
|
18325
|
+
renderCount += 1;
|
|
18326
|
+
renderCount = Math.min(count, renderCount);
|
|
18327
|
+
return renderCount;
|
|
18328
|
+
}
|
|
18269
18329
|
getRowIndexInPage(rowIndex) {
|
|
18270
18330
|
return this.rowsPerPage ? rowIndex % this.rowsPerPage : rowIndex;
|
|
18271
18331
|
}
|
|
@@ -19992,7 +20052,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
19992
20052
|
}
|
|
19993
20053
|
let valid2 = isValidLicense(licenseKey, {
|
|
19994
20054
|
publishedAt: 1624970570587,
|
|
19995
|
-
version: "5.1.0-canary.
|
|
20055
|
+
version: "5.1.0-canary.1"
|
|
19996
20056
|
});
|
|
19997
20057
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
19998
20058
|
return true;
|
package/index.dev.mjs
CHANGED
|
@@ -1506,6 +1506,14 @@ var MatrixBrain = class extends Logger {
|
|
|
1506
1506
|
this.horizontalTotalSize = 0;
|
|
1507
1507
|
this.horizontalRenderCount = void 0;
|
|
1508
1508
|
this.verticalRenderCount = void 0;
|
|
1509
|
+
this.horizontalExtendRangeBy = {
|
|
1510
|
+
start: 0,
|
|
1511
|
+
end: 0
|
|
1512
|
+
};
|
|
1513
|
+
this.verticalExtendRangeBy = {
|
|
1514
|
+
start: 0,
|
|
1515
|
+
end: 0
|
|
1516
|
+
};
|
|
1509
1517
|
this.horizontalRenderRange = {
|
|
1510
1518
|
startIndex: 0,
|
|
1511
1519
|
endIndex: 0
|
|
@@ -1645,34 +1653,6 @@ var MatrixBrain = class extends Logger {
|
|
|
1645
1653
|
});
|
|
1646
1654
|
});
|
|
1647
1655
|
};
|
|
1648
|
-
this.computeDirectionalRenderCount = (direction, itemSize, count, theRenderSize) => {
|
|
1649
|
-
let renderCount = 0;
|
|
1650
|
-
let size = direction === "horizontal" ? theRenderSize.width : theRenderSize.height;
|
|
1651
|
-
size -= this.getFixedSize(direction);
|
|
1652
|
-
if (size <= 0) {
|
|
1653
|
-
return 0;
|
|
1654
|
-
}
|
|
1655
|
-
if (typeof itemSize === "function") {
|
|
1656
|
-
const sizes = [];
|
|
1657
|
-
for (let i = 0; i < count; i++) {
|
|
1658
|
-
sizes.push(this.getItemSize(i, direction));
|
|
1659
|
-
}
|
|
1660
|
-
sizes.sort(SORT_ASC);
|
|
1661
|
-
let sum2 = 0;
|
|
1662
|
-
for (let i = 0; i < count; i++) {
|
|
1663
|
-
sum2 += sizes[i];
|
|
1664
|
-
renderCount++;
|
|
1665
|
-
if (sum2 > size) {
|
|
1666
|
-
break;
|
|
1667
|
-
}
|
|
1668
|
-
}
|
|
1669
|
-
renderCount += 1;
|
|
1670
|
-
} else {
|
|
1671
|
-
renderCount = (itemSize ? Math.ceil(size / itemSize) : 0) + 1;
|
|
1672
|
-
}
|
|
1673
|
-
renderCount = Math.min(count, renderCount);
|
|
1674
|
-
return renderCount;
|
|
1675
|
-
};
|
|
1676
1656
|
this.isColFixedEnd = (colIndex) => {
|
|
1677
1657
|
if (!this.fixedColsEnd) {
|
|
1678
1658
|
return false;
|
|
@@ -1843,7 +1823,7 @@ var MatrixBrain = class extends Logger {
|
|
|
1843
1823
|
this.setRenderCount = ({
|
|
1844
1824
|
horizontal,
|
|
1845
1825
|
vertical
|
|
1846
|
-
}
|
|
1826
|
+
}) => {
|
|
1847
1827
|
if (horizontal === void 0) {
|
|
1848
1828
|
horizontal = this.horizontalRenderCount;
|
|
1849
1829
|
}
|
|
@@ -1852,14 +1832,14 @@ var MatrixBrain = class extends Logger {
|
|
|
1852
1832
|
}
|
|
1853
1833
|
const horizontalSame = horizontal === this.horizontalRenderCount;
|
|
1854
1834
|
const verticalSame = vertical === this.verticalRenderCount;
|
|
1855
|
-
if (horizontalSame && verticalSame
|
|
1835
|
+
if (horizontalSame && verticalSame) {
|
|
1856
1836
|
return;
|
|
1857
1837
|
}
|
|
1858
1838
|
this.horizontalRenderCount = horizontal;
|
|
1859
1839
|
this.verticalRenderCount = vertical;
|
|
1860
1840
|
this.updateRenderRange({
|
|
1861
|
-
horizontal:
|
|
1862
|
-
vertical:
|
|
1841
|
+
horizontal: !horizontalSame,
|
|
1842
|
+
vertical: !verticalSame
|
|
1863
1843
|
});
|
|
1864
1844
|
this.notifyRenderCountChange();
|
|
1865
1845
|
};
|
|
@@ -1939,7 +1919,7 @@ var MatrixBrain = class extends Logger {
|
|
|
1939
1919
|
};
|
|
1940
1920
|
};
|
|
1941
1921
|
this.computeDirectionalRenderRange = (direction) => {
|
|
1942
|
-
|
|
1922
|
+
let renderCount = direction === "horizontal" ? this.horizontalRenderCount : this.verticalRenderCount;
|
|
1943
1923
|
const count = direction === "horizontal" ? this.cols : this.rows;
|
|
1944
1924
|
if (!renderCount) {
|
|
1945
1925
|
return {
|
|
@@ -1950,7 +1930,15 @@ var MatrixBrain = class extends Logger {
|
|
|
1950
1930
|
const fixedStartIndex = (direction === "horizontal" ? this.fixedColsStart : this.fixedRowsStart) || 0;
|
|
1951
1931
|
let scrollPositionForDirection = direction === "horizontal" ? this.scrollPosition.scrollLeft : this.scrollPosition.scrollTop;
|
|
1952
1932
|
scrollPositionForDirection += this.getFixedStartSize(direction);
|
|
1933
|
+
const extendBy = direction === "horizontal" ? this.horizontalExtendRangeBy : this.verticalExtendRangeBy;
|
|
1953
1934
|
let startIndex = this.getItemAt(scrollPositionForDirection, direction);
|
|
1935
|
+
if (extendBy.start) {
|
|
1936
|
+
startIndex = Math.max(0, startIndex - extendBy.start);
|
|
1937
|
+
renderCount += extendBy.start;
|
|
1938
|
+
}
|
|
1939
|
+
if (extendBy.end) {
|
|
1940
|
+
renderCount += extendBy.end;
|
|
1941
|
+
}
|
|
1954
1942
|
let endIndex = startIndex + renderCount;
|
|
1955
1943
|
const theEnd = Math.max(
|
|
1956
1944
|
fixedStartIndex,
|
|
@@ -1994,7 +1982,6 @@ var MatrixBrain = class extends Logger {
|
|
|
1994
1982
|
return searchResult;
|
|
1995
1983
|
}
|
|
1996
1984
|
return ~searchResult - 1;
|
|
1997
|
-
return 0;
|
|
1998
1985
|
};
|
|
1999
1986
|
this.computeCacheFor = (itemIndex, direction) => {
|
|
2000
1987
|
const itemSizeValueOrFn = direction === "horizontal" ? this.colWidth : this.rowHeight;
|
|
@@ -2437,31 +2424,30 @@ var MatrixBrain = class extends Logger {
|
|
|
2437
2424
|
* @param options.right - if true, extends the right side with the amount of current visible columns, otherwise with the specified number
|
|
2438
2425
|
*/
|
|
2439
2426
|
extendRenderRange(options) {
|
|
2440
|
-
const
|
|
2441
|
-
const
|
|
2442
|
-
const
|
|
2427
|
+
const { direction } = options;
|
|
2428
|
+
const horizontal = direction === "horizontal";
|
|
2429
|
+
const extendValueWhenTrue = horizontal ? this.horizontalRenderCount || this.getInitialCols() : this.verticalRenderCount || this.getInitialRows();
|
|
2430
|
+
const startAmount = typeof options.start === "number" ? options.start : options.start === true ? extendValueWhenTrue : 0;
|
|
2431
|
+
const endAmount = typeof options.end === "number" ? options.end : options.end === true ? extendValueWhenTrue : 0;
|
|
2432
|
+
if (horizontal) {
|
|
2433
|
+
this.horizontalExtendRangeBy = {
|
|
2434
|
+
start: startAmount,
|
|
2435
|
+
end: endAmount
|
|
2436
|
+
};
|
|
2437
|
+
} else {
|
|
2438
|
+
this.verticalExtendRangeBy = {
|
|
2439
|
+
start: startAmount,
|
|
2440
|
+
end: endAmount
|
|
2441
|
+
};
|
|
2442
|
+
}
|
|
2443
|
+
this.updateRenderRange({ horizontal, vertical: !horizontal });
|
|
2443
2444
|
const restore = () => {
|
|
2444
|
-
this.
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
true
|
|
2450
|
-
);
|
|
2445
|
+
this.extendRenderRange({
|
|
2446
|
+
start: 0,
|
|
2447
|
+
end: 0,
|
|
2448
|
+
direction
|
|
2449
|
+
});
|
|
2451
2450
|
};
|
|
2452
|
-
const { start, end } = this.getRenderRange();
|
|
2453
|
-
const [startRow, startCol] = start;
|
|
2454
|
-
const [endRow, endCol] = end;
|
|
2455
|
-
this.setRenderRange({
|
|
2456
|
-
horizontal: {
|
|
2457
|
-
startIndex: Math.max(0, startCol - leftAmount),
|
|
2458
|
-
endIndex: Math.min(this.cols, endCol + rightAmount)
|
|
2459
|
-
},
|
|
2460
|
-
vertical: {
|
|
2461
|
-
startIndex: startRow,
|
|
2462
|
-
endIndex: endRow
|
|
2463
|
-
}
|
|
2464
|
-
});
|
|
2465
2451
|
return restore;
|
|
2466
2452
|
}
|
|
2467
2453
|
updateRenderCount(which = ALL_DIRECTIONS) {
|
|
@@ -2533,6 +2519,34 @@ var MatrixBrain = class extends Logger {
|
|
|
2533
2519
|
fns[i](scrollPosition);
|
|
2534
2520
|
}
|
|
2535
2521
|
}
|
|
2522
|
+
computeDirectionalRenderCount(direction, itemSize, count, theRenderSize) {
|
|
2523
|
+
let renderCount = 0;
|
|
2524
|
+
let size = direction === "horizontal" ? theRenderSize.width : theRenderSize.height;
|
|
2525
|
+
size -= this.getFixedSize(direction);
|
|
2526
|
+
if (size <= 0) {
|
|
2527
|
+
return 0;
|
|
2528
|
+
}
|
|
2529
|
+
if (typeof itemSize === "function") {
|
|
2530
|
+
const sizes = [];
|
|
2531
|
+
for (let i = 0; i < count; i++) {
|
|
2532
|
+
sizes.push(this.getItemSize(i, direction));
|
|
2533
|
+
}
|
|
2534
|
+
sizes.sort(SORT_ASC);
|
|
2535
|
+
let sum2 = 0;
|
|
2536
|
+
for (let i = 0; i < count; i++) {
|
|
2537
|
+
sum2 += sizes[i];
|
|
2538
|
+
renderCount++;
|
|
2539
|
+
if (sum2 > size) {
|
|
2540
|
+
break;
|
|
2541
|
+
}
|
|
2542
|
+
}
|
|
2543
|
+
renderCount += 1;
|
|
2544
|
+
} else {
|
|
2545
|
+
renderCount = (itemSize ? Math.ceil(size / itemSize) : 0) + 1;
|
|
2546
|
+
}
|
|
2547
|
+
renderCount = Math.min(count, renderCount);
|
|
2548
|
+
return renderCount;
|
|
2549
|
+
}
|
|
2536
2550
|
getFixedSize(direction) {
|
|
2537
2551
|
return direction === "horizontal" ? this.getFixedStartColsWidth() + this.getFixedEndColsWidth() : this.getFixedStartRowsHeight() + this.getFixedEndRowsHeight();
|
|
2538
2552
|
}
|
|
@@ -2647,6 +2661,8 @@ var MatrixBrain = class extends Logger {
|
|
|
2647
2661
|
this.rowspanParent.clear();
|
|
2648
2662
|
this.colspanParent.clear();
|
|
2649
2663
|
this.alwaysRenderedColumns.clear();
|
|
2664
|
+
this.horizontalExtendRangeBy = { start: 0, end: 0 };
|
|
2665
|
+
this.verticalExtendRangeBy = { start: 0, end: 0 };
|
|
2650
2666
|
this.destroyed = true;
|
|
2651
2667
|
this.onDestroyFns = [];
|
|
2652
2668
|
this.onScrollFns = [];
|
|
@@ -7794,12 +7810,14 @@ var useColumnPointerEvents = ({
|
|
|
7794
7810
|
if (brain2.isHorizontalLayoutBrain) {
|
|
7795
7811
|
const extendBy = true;
|
|
7796
7812
|
const restoreBodyRange = brain2.extendRenderRange({
|
|
7797
|
-
|
|
7798
|
-
|
|
7813
|
+
start: extendBy,
|
|
7814
|
+
end: extendBy,
|
|
7815
|
+
direction: "horizontal"
|
|
7799
7816
|
});
|
|
7800
7817
|
const restoreHeaderRange = headerBrain.extendRenderRange({
|
|
7801
|
-
|
|
7802
|
-
|
|
7818
|
+
start: extendBy,
|
|
7819
|
+
end: extendBy,
|
|
7820
|
+
direction: "horizontal"
|
|
7803
7821
|
});
|
|
7804
7822
|
restoreRenderRange = () => {
|
|
7805
7823
|
restoreBodyRange();
|
|
@@ -9553,12 +9571,14 @@ function ResizeHandleFn(props) {
|
|
|
9553
9571
|
const target = e.target;
|
|
9554
9572
|
if (brain.isHorizontalLayoutBrain) {
|
|
9555
9573
|
const restoreBodyRange = brain.extendRenderRange({
|
|
9556
|
-
|
|
9557
|
-
|
|
9574
|
+
start: true,
|
|
9575
|
+
end: true,
|
|
9576
|
+
direction: "horizontal"
|
|
9558
9577
|
});
|
|
9559
9578
|
const restoreHeaderRange = headerBrain.extendRenderRange({
|
|
9560
|
-
|
|
9561
|
-
|
|
9579
|
+
start: true,
|
|
9580
|
+
end: true,
|
|
9581
|
+
direction: "horizontal"
|
|
9562
9582
|
});
|
|
9563
9583
|
restoreRenderRange = () => {
|
|
9564
9584
|
restoreBodyRange();
|
|
@@ -18232,6 +18252,46 @@ var HorizontalLayoutMatrixBrain = class extends MatrixBrain {
|
|
|
18232
18252
|
});
|
|
18233
18253
|
}
|
|
18234
18254
|
}
|
|
18255
|
+
computeDirectionalRenderCount(direction, itemSize, count, theRenderSize) {
|
|
18256
|
+
if (direction === "vertical") {
|
|
18257
|
+
return super.computeDirectionalRenderCount(
|
|
18258
|
+
direction,
|
|
18259
|
+
itemSize,
|
|
18260
|
+
count,
|
|
18261
|
+
theRenderSize
|
|
18262
|
+
);
|
|
18263
|
+
}
|
|
18264
|
+
let renderCount = 0;
|
|
18265
|
+
let size = theRenderSize.width;
|
|
18266
|
+
size -= this.getFixedSize("horizontal");
|
|
18267
|
+
if (size <= 0) {
|
|
18268
|
+
return 0;
|
|
18269
|
+
}
|
|
18270
|
+
if (typeof itemSize === "number") {
|
|
18271
|
+
renderCount = (itemSize ? Math.ceil(size / itemSize) : 0) + 1;
|
|
18272
|
+
renderCount = Math.min(count, renderCount);
|
|
18273
|
+
return renderCount;
|
|
18274
|
+
}
|
|
18275
|
+
const pagesInView = Math.floor(size / this.pageWidth);
|
|
18276
|
+
renderCount += pagesInView * this.initialCols;
|
|
18277
|
+
const remainingSize = size - pagesInView * this.pageWidth;
|
|
18278
|
+
const sizes = [];
|
|
18279
|
+
for (let i = 0; i < this.initialCols; i++) {
|
|
18280
|
+
sizes.push(this.getItemSize(i, direction));
|
|
18281
|
+
}
|
|
18282
|
+
sizes.sort(SORT_ASC);
|
|
18283
|
+
let sum2 = 0;
|
|
18284
|
+
for (let i = 0; i < this.initialCols; i++) {
|
|
18285
|
+
sum2 += sizes[i];
|
|
18286
|
+
renderCount++;
|
|
18287
|
+
if (sum2 > remainingSize) {
|
|
18288
|
+
break;
|
|
18289
|
+
}
|
|
18290
|
+
}
|
|
18291
|
+
renderCount += 1;
|
|
18292
|
+
renderCount = Math.min(count, renderCount);
|
|
18293
|
+
return renderCount;
|
|
18294
|
+
}
|
|
18235
18295
|
getRowIndexInPage(rowIndex) {
|
|
18236
18296
|
return this.rowsPerPage ? rowIndex % this.rowsPerPage : rowIndex;
|
|
18237
18297
|
}
|
|
@@ -19958,7 +20018,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
19958
20018
|
}
|
|
19959
20019
|
let valid2 = isValidLicense(licenseKey, {
|
|
19960
20020
|
publishedAt: 1624970570587,
|
|
19961
|
-
version: "5.1.0-canary.
|
|
20021
|
+
version: "5.1.0-canary.1"
|
|
19962
20022
|
});
|
|
19963
20023
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
19964
20024
|
return true;
|
package/index.js
CHANGED
|
@@ -1557,6 +1557,14 @@ var MatrixBrain = class extends Logger {
|
|
|
1557
1557
|
this.horizontalTotalSize = 0;
|
|
1558
1558
|
this.horizontalRenderCount = void 0;
|
|
1559
1559
|
this.verticalRenderCount = void 0;
|
|
1560
|
+
this.horizontalExtendRangeBy = {
|
|
1561
|
+
start: 0,
|
|
1562
|
+
end: 0
|
|
1563
|
+
};
|
|
1564
|
+
this.verticalExtendRangeBy = {
|
|
1565
|
+
start: 0,
|
|
1566
|
+
end: 0
|
|
1567
|
+
};
|
|
1560
1568
|
this.horizontalRenderRange = {
|
|
1561
1569
|
startIndex: 0,
|
|
1562
1570
|
endIndex: 0
|
|
@@ -1696,34 +1704,6 @@ var MatrixBrain = class extends Logger {
|
|
|
1696
1704
|
});
|
|
1697
1705
|
});
|
|
1698
1706
|
};
|
|
1699
|
-
this.computeDirectionalRenderCount = (direction, itemSize, count, theRenderSize) => {
|
|
1700
|
-
let renderCount = 0;
|
|
1701
|
-
let size = direction === "horizontal" ? theRenderSize.width : theRenderSize.height;
|
|
1702
|
-
size -= this.getFixedSize(direction);
|
|
1703
|
-
if (size <= 0) {
|
|
1704
|
-
return 0;
|
|
1705
|
-
}
|
|
1706
|
-
if (typeof itemSize === "function") {
|
|
1707
|
-
const sizes = [];
|
|
1708
|
-
for (let i = 0; i < count; i++) {
|
|
1709
|
-
sizes.push(this.getItemSize(i, direction));
|
|
1710
|
-
}
|
|
1711
|
-
sizes.sort(SORT_ASC);
|
|
1712
|
-
let sum2 = 0;
|
|
1713
|
-
for (let i = 0; i < count; i++) {
|
|
1714
|
-
sum2 += sizes[i];
|
|
1715
|
-
renderCount++;
|
|
1716
|
-
if (sum2 > size) {
|
|
1717
|
-
break;
|
|
1718
|
-
}
|
|
1719
|
-
}
|
|
1720
|
-
renderCount += 1;
|
|
1721
|
-
} else {
|
|
1722
|
-
renderCount = (itemSize ? Math.ceil(size / itemSize) : 0) + 1;
|
|
1723
|
-
}
|
|
1724
|
-
renderCount = Math.min(count, renderCount);
|
|
1725
|
-
return renderCount;
|
|
1726
|
-
};
|
|
1727
1707
|
this.isColFixedEnd = (colIndex) => {
|
|
1728
1708
|
if (!this.fixedColsEnd) {
|
|
1729
1709
|
return false;
|
|
@@ -1894,7 +1874,7 @@ var MatrixBrain = class extends Logger {
|
|
|
1894
1874
|
this.setRenderCount = ({
|
|
1895
1875
|
horizontal,
|
|
1896
1876
|
vertical
|
|
1897
|
-
}
|
|
1877
|
+
}) => {
|
|
1898
1878
|
if (horizontal === void 0) {
|
|
1899
1879
|
horizontal = this.horizontalRenderCount;
|
|
1900
1880
|
}
|
|
@@ -1903,14 +1883,14 @@ var MatrixBrain = class extends Logger {
|
|
|
1903
1883
|
}
|
|
1904
1884
|
const horizontalSame = horizontal === this.horizontalRenderCount;
|
|
1905
1885
|
const verticalSame = vertical === this.verticalRenderCount;
|
|
1906
|
-
if (horizontalSame && verticalSame
|
|
1886
|
+
if (horizontalSame && verticalSame) {
|
|
1907
1887
|
return;
|
|
1908
1888
|
}
|
|
1909
1889
|
this.horizontalRenderCount = horizontal;
|
|
1910
1890
|
this.verticalRenderCount = vertical;
|
|
1911
1891
|
this.updateRenderRange({
|
|
1912
|
-
horizontal:
|
|
1913
|
-
vertical:
|
|
1892
|
+
horizontal: !horizontalSame,
|
|
1893
|
+
vertical: !verticalSame
|
|
1914
1894
|
});
|
|
1915
1895
|
this.notifyRenderCountChange();
|
|
1916
1896
|
};
|
|
@@ -1990,7 +1970,7 @@ var MatrixBrain = class extends Logger {
|
|
|
1990
1970
|
};
|
|
1991
1971
|
};
|
|
1992
1972
|
this.computeDirectionalRenderRange = (direction) => {
|
|
1993
|
-
|
|
1973
|
+
let renderCount = direction === "horizontal" ? this.horizontalRenderCount : this.verticalRenderCount;
|
|
1994
1974
|
const count = direction === "horizontal" ? this.cols : this.rows;
|
|
1995
1975
|
if (!renderCount) {
|
|
1996
1976
|
return {
|
|
@@ -2001,7 +1981,15 @@ var MatrixBrain = class extends Logger {
|
|
|
2001
1981
|
const fixedStartIndex = (direction === "horizontal" ? this.fixedColsStart : this.fixedRowsStart) || 0;
|
|
2002
1982
|
let scrollPositionForDirection = direction === "horizontal" ? this.scrollPosition.scrollLeft : this.scrollPosition.scrollTop;
|
|
2003
1983
|
scrollPositionForDirection += this.getFixedStartSize(direction);
|
|
1984
|
+
const extendBy = direction === "horizontal" ? this.horizontalExtendRangeBy : this.verticalExtendRangeBy;
|
|
2004
1985
|
let startIndex = this.getItemAt(scrollPositionForDirection, direction);
|
|
1986
|
+
if (extendBy.start) {
|
|
1987
|
+
startIndex = Math.max(0, startIndex - extendBy.start);
|
|
1988
|
+
renderCount += extendBy.start;
|
|
1989
|
+
}
|
|
1990
|
+
if (extendBy.end) {
|
|
1991
|
+
renderCount += extendBy.end;
|
|
1992
|
+
}
|
|
2005
1993
|
let endIndex = startIndex + renderCount;
|
|
2006
1994
|
const theEnd = Math.max(
|
|
2007
1995
|
fixedStartIndex,
|
|
@@ -2045,7 +2033,6 @@ var MatrixBrain = class extends Logger {
|
|
|
2045
2033
|
return searchResult;
|
|
2046
2034
|
}
|
|
2047
2035
|
return ~searchResult - 1;
|
|
2048
|
-
return 0;
|
|
2049
2036
|
};
|
|
2050
2037
|
this.computeCacheFor = (itemIndex, direction) => {
|
|
2051
2038
|
const itemSizeValueOrFn = direction === "horizontal" ? this.colWidth : this.rowHeight;
|
|
@@ -2488,31 +2475,30 @@ var MatrixBrain = class extends Logger {
|
|
|
2488
2475
|
* @param options.right - if true, extends the right side with the amount of current visible columns, otherwise with the specified number
|
|
2489
2476
|
*/
|
|
2490
2477
|
extendRenderRange(options) {
|
|
2491
|
-
const
|
|
2492
|
-
const
|
|
2493
|
-
const
|
|
2478
|
+
const { direction } = options;
|
|
2479
|
+
const horizontal = direction === "horizontal";
|
|
2480
|
+
const extendValueWhenTrue = horizontal ? this.horizontalRenderCount || this.getInitialCols() : this.verticalRenderCount || this.getInitialRows();
|
|
2481
|
+
const startAmount = typeof options.start === "number" ? options.start : options.start === true ? extendValueWhenTrue : 0;
|
|
2482
|
+
const endAmount = typeof options.end === "number" ? options.end : options.end === true ? extendValueWhenTrue : 0;
|
|
2483
|
+
if (horizontal) {
|
|
2484
|
+
this.horizontalExtendRangeBy = {
|
|
2485
|
+
start: startAmount,
|
|
2486
|
+
end: endAmount
|
|
2487
|
+
};
|
|
2488
|
+
} else {
|
|
2489
|
+
this.verticalExtendRangeBy = {
|
|
2490
|
+
start: startAmount,
|
|
2491
|
+
end: endAmount
|
|
2492
|
+
};
|
|
2493
|
+
}
|
|
2494
|
+
this.updateRenderRange({ horizontal, vertical: !horizontal });
|
|
2494
2495
|
const restore = () => {
|
|
2495
|
-
this.
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
true
|
|
2501
|
-
);
|
|
2496
|
+
this.extendRenderRange({
|
|
2497
|
+
start: 0,
|
|
2498
|
+
end: 0,
|
|
2499
|
+
direction
|
|
2500
|
+
});
|
|
2502
2501
|
};
|
|
2503
|
-
const { start, end } = this.getRenderRange();
|
|
2504
|
-
const [startRow, startCol] = start;
|
|
2505
|
-
const [endRow, endCol] = end;
|
|
2506
|
-
this.setRenderRange({
|
|
2507
|
-
horizontal: {
|
|
2508
|
-
startIndex: Math.max(0, startCol - leftAmount),
|
|
2509
|
-
endIndex: Math.min(this.cols, endCol + rightAmount)
|
|
2510
|
-
},
|
|
2511
|
-
vertical: {
|
|
2512
|
-
startIndex: startRow,
|
|
2513
|
-
endIndex: endRow
|
|
2514
|
-
}
|
|
2515
|
-
});
|
|
2516
2502
|
return restore;
|
|
2517
2503
|
}
|
|
2518
2504
|
updateRenderCount(which = ALL_DIRECTIONS) {
|
|
@@ -2584,6 +2570,34 @@ var MatrixBrain = class extends Logger {
|
|
|
2584
2570
|
fns[i](scrollPosition);
|
|
2585
2571
|
}
|
|
2586
2572
|
}
|
|
2573
|
+
computeDirectionalRenderCount(direction, itemSize, count, theRenderSize) {
|
|
2574
|
+
let renderCount = 0;
|
|
2575
|
+
let size = direction === "horizontal" ? theRenderSize.width : theRenderSize.height;
|
|
2576
|
+
size -= this.getFixedSize(direction);
|
|
2577
|
+
if (size <= 0) {
|
|
2578
|
+
return 0;
|
|
2579
|
+
}
|
|
2580
|
+
if (typeof itemSize === "function") {
|
|
2581
|
+
const sizes = [];
|
|
2582
|
+
for (let i = 0; i < count; i++) {
|
|
2583
|
+
sizes.push(this.getItemSize(i, direction));
|
|
2584
|
+
}
|
|
2585
|
+
sizes.sort(SORT_ASC);
|
|
2586
|
+
let sum2 = 0;
|
|
2587
|
+
for (let i = 0; i < count; i++) {
|
|
2588
|
+
sum2 += sizes[i];
|
|
2589
|
+
renderCount++;
|
|
2590
|
+
if (sum2 > size) {
|
|
2591
|
+
break;
|
|
2592
|
+
}
|
|
2593
|
+
}
|
|
2594
|
+
renderCount += 1;
|
|
2595
|
+
} else {
|
|
2596
|
+
renderCount = (itemSize ? Math.ceil(size / itemSize) : 0) + 1;
|
|
2597
|
+
}
|
|
2598
|
+
renderCount = Math.min(count, renderCount);
|
|
2599
|
+
return renderCount;
|
|
2600
|
+
}
|
|
2587
2601
|
getFixedSize(direction) {
|
|
2588
2602
|
return direction === "horizontal" ? this.getFixedStartColsWidth() + this.getFixedEndColsWidth() : this.getFixedStartRowsHeight() + this.getFixedEndRowsHeight();
|
|
2589
2603
|
}
|
|
@@ -2698,6 +2712,8 @@ var MatrixBrain = class extends Logger {
|
|
|
2698
2712
|
this.rowspanParent.clear();
|
|
2699
2713
|
this.colspanParent.clear();
|
|
2700
2714
|
this.alwaysRenderedColumns.clear();
|
|
2715
|
+
this.horizontalExtendRangeBy = { start: 0, end: 0 };
|
|
2716
|
+
this.verticalExtendRangeBy = { start: 0, end: 0 };
|
|
2701
2717
|
this.destroyed = true;
|
|
2702
2718
|
this.onDestroyFns = [];
|
|
2703
2719
|
this.onScrollFns = [];
|
|
@@ -7837,12 +7853,14 @@ var useColumnPointerEvents = ({
|
|
|
7837
7853
|
if (brain2.isHorizontalLayoutBrain) {
|
|
7838
7854
|
const extendBy = true;
|
|
7839
7855
|
const restoreBodyRange = brain2.extendRenderRange({
|
|
7840
|
-
|
|
7841
|
-
|
|
7856
|
+
start: extendBy,
|
|
7857
|
+
end: extendBy,
|
|
7858
|
+
direction: "horizontal"
|
|
7842
7859
|
});
|
|
7843
7860
|
const restoreHeaderRange = headerBrain.extendRenderRange({
|
|
7844
|
-
|
|
7845
|
-
|
|
7861
|
+
start: extendBy,
|
|
7862
|
+
end: extendBy,
|
|
7863
|
+
direction: "horizontal"
|
|
7846
7864
|
});
|
|
7847
7865
|
restoreRenderRange = () => {
|
|
7848
7866
|
restoreBodyRange();
|
|
@@ -9596,12 +9614,14 @@ function ResizeHandleFn(props) {
|
|
|
9596
9614
|
const target = e.target;
|
|
9597
9615
|
if (brain.isHorizontalLayoutBrain) {
|
|
9598
9616
|
const restoreBodyRange = brain.extendRenderRange({
|
|
9599
|
-
|
|
9600
|
-
|
|
9617
|
+
start: true,
|
|
9618
|
+
end: true,
|
|
9619
|
+
direction: "horizontal"
|
|
9601
9620
|
});
|
|
9602
9621
|
const restoreHeaderRange = headerBrain.extendRenderRange({
|
|
9603
|
-
|
|
9604
|
-
|
|
9622
|
+
start: true,
|
|
9623
|
+
end: true,
|
|
9624
|
+
direction: "horizontal"
|
|
9605
9625
|
});
|
|
9606
9626
|
restoreRenderRange = () => {
|
|
9607
9627
|
restoreBodyRange();
|
|
@@ -18266,6 +18286,46 @@ var HorizontalLayoutMatrixBrain = class extends MatrixBrain {
|
|
|
18266
18286
|
});
|
|
18267
18287
|
}
|
|
18268
18288
|
}
|
|
18289
|
+
computeDirectionalRenderCount(direction, itemSize, count, theRenderSize) {
|
|
18290
|
+
if (direction === "vertical") {
|
|
18291
|
+
return super.computeDirectionalRenderCount(
|
|
18292
|
+
direction,
|
|
18293
|
+
itemSize,
|
|
18294
|
+
count,
|
|
18295
|
+
theRenderSize
|
|
18296
|
+
);
|
|
18297
|
+
}
|
|
18298
|
+
let renderCount = 0;
|
|
18299
|
+
let size = theRenderSize.width;
|
|
18300
|
+
size -= this.getFixedSize("horizontal");
|
|
18301
|
+
if (size <= 0) {
|
|
18302
|
+
return 0;
|
|
18303
|
+
}
|
|
18304
|
+
if (typeof itemSize === "number") {
|
|
18305
|
+
renderCount = (itemSize ? Math.ceil(size / itemSize) : 0) + 1;
|
|
18306
|
+
renderCount = Math.min(count, renderCount);
|
|
18307
|
+
return renderCount;
|
|
18308
|
+
}
|
|
18309
|
+
const pagesInView = Math.floor(size / this.pageWidth);
|
|
18310
|
+
renderCount += pagesInView * this.initialCols;
|
|
18311
|
+
const remainingSize = size - pagesInView * this.pageWidth;
|
|
18312
|
+
const sizes = [];
|
|
18313
|
+
for (let i = 0; i < this.initialCols; i++) {
|
|
18314
|
+
sizes.push(this.getItemSize(i, direction));
|
|
18315
|
+
}
|
|
18316
|
+
sizes.sort(SORT_ASC);
|
|
18317
|
+
let sum2 = 0;
|
|
18318
|
+
for (let i = 0; i < this.initialCols; i++) {
|
|
18319
|
+
sum2 += sizes[i];
|
|
18320
|
+
renderCount++;
|
|
18321
|
+
if (sum2 > remainingSize) {
|
|
18322
|
+
break;
|
|
18323
|
+
}
|
|
18324
|
+
}
|
|
18325
|
+
renderCount += 1;
|
|
18326
|
+
renderCount = Math.min(count, renderCount);
|
|
18327
|
+
return renderCount;
|
|
18328
|
+
}
|
|
18269
18329
|
getRowIndexInPage(rowIndex) {
|
|
18270
18330
|
return this.rowsPerPage ? rowIndex % this.rowsPerPage : rowIndex;
|
|
18271
18331
|
}
|
|
@@ -19992,7 +20052,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
19992
20052
|
}
|
|
19993
20053
|
let valid2 = isValidLicense(licenseKey, {
|
|
19994
20054
|
publishedAt: 1624970570587,
|
|
19995
|
-
version: "5.1.0-canary.
|
|
20055
|
+
version: "5.1.0-canary.1"
|
|
19996
20056
|
});
|
|
19997
20057
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
19998
20058
|
return true;
|
package/index.mjs
CHANGED
|
@@ -1506,6 +1506,14 @@ var MatrixBrain = class extends Logger {
|
|
|
1506
1506
|
this.horizontalTotalSize = 0;
|
|
1507
1507
|
this.horizontalRenderCount = void 0;
|
|
1508
1508
|
this.verticalRenderCount = void 0;
|
|
1509
|
+
this.horizontalExtendRangeBy = {
|
|
1510
|
+
start: 0,
|
|
1511
|
+
end: 0
|
|
1512
|
+
};
|
|
1513
|
+
this.verticalExtendRangeBy = {
|
|
1514
|
+
start: 0,
|
|
1515
|
+
end: 0
|
|
1516
|
+
};
|
|
1509
1517
|
this.horizontalRenderRange = {
|
|
1510
1518
|
startIndex: 0,
|
|
1511
1519
|
endIndex: 0
|
|
@@ -1645,34 +1653,6 @@ var MatrixBrain = class extends Logger {
|
|
|
1645
1653
|
});
|
|
1646
1654
|
});
|
|
1647
1655
|
};
|
|
1648
|
-
this.computeDirectionalRenderCount = (direction, itemSize, count, theRenderSize) => {
|
|
1649
|
-
let renderCount = 0;
|
|
1650
|
-
let size = direction === "horizontal" ? theRenderSize.width : theRenderSize.height;
|
|
1651
|
-
size -= this.getFixedSize(direction);
|
|
1652
|
-
if (size <= 0) {
|
|
1653
|
-
return 0;
|
|
1654
|
-
}
|
|
1655
|
-
if (typeof itemSize === "function") {
|
|
1656
|
-
const sizes = [];
|
|
1657
|
-
for (let i = 0; i < count; i++) {
|
|
1658
|
-
sizes.push(this.getItemSize(i, direction));
|
|
1659
|
-
}
|
|
1660
|
-
sizes.sort(SORT_ASC);
|
|
1661
|
-
let sum2 = 0;
|
|
1662
|
-
for (let i = 0; i < count; i++) {
|
|
1663
|
-
sum2 += sizes[i];
|
|
1664
|
-
renderCount++;
|
|
1665
|
-
if (sum2 > size) {
|
|
1666
|
-
break;
|
|
1667
|
-
}
|
|
1668
|
-
}
|
|
1669
|
-
renderCount += 1;
|
|
1670
|
-
} else {
|
|
1671
|
-
renderCount = (itemSize ? Math.ceil(size / itemSize) : 0) + 1;
|
|
1672
|
-
}
|
|
1673
|
-
renderCount = Math.min(count, renderCount);
|
|
1674
|
-
return renderCount;
|
|
1675
|
-
};
|
|
1676
1656
|
this.isColFixedEnd = (colIndex) => {
|
|
1677
1657
|
if (!this.fixedColsEnd) {
|
|
1678
1658
|
return false;
|
|
@@ -1843,7 +1823,7 @@ var MatrixBrain = class extends Logger {
|
|
|
1843
1823
|
this.setRenderCount = ({
|
|
1844
1824
|
horizontal,
|
|
1845
1825
|
vertical
|
|
1846
|
-
}
|
|
1826
|
+
}) => {
|
|
1847
1827
|
if (horizontal === void 0) {
|
|
1848
1828
|
horizontal = this.horizontalRenderCount;
|
|
1849
1829
|
}
|
|
@@ -1852,14 +1832,14 @@ var MatrixBrain = class extends Logger {
|
|
|
1852
1832
|
}
|
|
1853
1833
|
const horizontalSame = horizontal === this.horizontalRenderCount;
|
|
1854
1834
|
const verticalSame = vertical === this.verticalRenderCount;
|
|
1855
|
-
if (horizontalSame && verticalSame
|
|
1835
|
+
if (horizontalSame && verticalSame) {
|
|
1856
1836
|
return;
|
|
1857
1837
|
}
|
|
1858
1838
|
this.horizontalRenderCount = horizontal;
|
|
1859
1839
|
this.verticalRenderCount = vertical;
|
|
1860
1840
|
this.updateRenderRange({
|
|
1861
|
-
horizontal:
|
|
1862
|
-
vertical:
|
|
1841
|
+
horizontal: !horizontalSame,
|
|
1842
|
+
vertical: !verticalSame
|
|
1863
1843
|
});
|
|
1864
1844
|
this.notifyRenderCountChange();
|
|
1865
1845
|
};
|
|
@@ -1939,7 +1919,7 @@ var MatrixBrain = class extends Logger {
|
|
|
1939
1919
|
};
|
|
1940
1920
|
};
|
|
1941
1921
|
this.computeDirectionalRenderRange = (direction) => {
|
|
1942
|
-
|
|
1922
|
+
let renderCount = direction === "horizontal" ? this.horizontalRenderCount : this.verticalRenderCount;
|
|
1943
1923
|
const count = direction === "horizontal" ? this.cols : this.rows;
|
|
1944
1924
|
if (!renderCount) {
|
|
1945
1925
|
return {
|
|
@@ -1950,7 +1930,15 @@ var MatrixBrain = class extends Logger {
|
|
|
1950
1930
|
const fixedStartIndex = (direction === "horizontal" ? this.fixedColsStart : this.fixedRowsStart) || 0;
|
|
1951
1931
|
let scrollPositionForDirection = direction === "horizontal" ? this.scrollPosition.scrollLeft : this.scrollPosition.scrollTop;
|
|
1952
1932
|
scrollPositionForDirection += this.getFixedStartSize(direction);
|
|
1933
|
+
const extendBy = direction === "horizontal" ? this.horizontalExtendRangeBy : this.verticalExtendRangeBy;
|
|
1953
1934
|
let startIndex = this.getItemAt(scrollPositionForDirection, direction);
|
|
1935
|
+
if (extendBy.start) {
|
|
1936
|
+
startIndex = Math.max(0, startIndex - extendBy.start);
|
|
1937
|
+
renderCount += extendBy.start;
|
|
1938
|
+
}
|
|
1939
|
+
if (extendBy.end) {
|
|
1940
|
+
renderCount += extendBy.end;
|
|
1941
|
+
}
|
|
1954
1942
|
let endIndex = startIndex + renderCount;
|
|
1955
1943
|
const theEnd = Math.max(
|
|
1956
1944
|
fixedStartIndex,
|
|
@@ -1994,7 +1982,6 @@ var MatrixBrain = class extends Logger {
|
|
|
1994
1982
|
return searchResult;
|
|
1995
1983
|
}
|
|
1996
1984
|
return ~searchResult - 1;
|
|
1997
|
-
return 0;
|
|
1998
1985
|
};
|
|
1999
1986
|
this.computeCacheFor = (itemIndex, direction) => {
|
|
2000
1987
|
const itemSizeValueOrFn = direction === "horizontal" ? this.colWidth : this.rowHeight;
|
|
@@ -2437,31 +2424,30 @@ var MatrixBrain = class extends Logger {
|
|
|
2437
2424
|
* @param options.right - if true, extends the right side with the amount of current visible columns, otherwise with the specified number
|
|
2438
2425
|
*/
|
|
2439
2426
|
extendRenderRange(options) {
|
|
2440
|
-
const
|
|
2441
|
-
const
|
|
2442
|
-
const
|
|
2427
|
+
const { direction } = options;
|
|
2428
|
+
const horizontal = direction === "horizontal";
|
|
2429
|
+
const extendValueWhenTrue = horizontal ? this.horizontalRenderCount || this.getInitialCols() : this.verticalRenderCount || this.getInitialRows();
|
|
2430
|
+
const startAmount = typeof options.start === "number" ? options.start : options.start === true ? extendValueWhenTrue : 0;
|
|
2431
|
+
const endAmount = typeof options.end === "number" ? options.end : options.end === true ? extendValueWhenTrue : 0;
|
|
2432
|
+
if (horizontal) {
|
|
2433
|
+
this.horizontalExtendRangeBy = {
|
|
2434
|
+
start: startAmount,
|
|
2435
|
+
end: endAmount
|
|
2436
|
+
};
|
|
2437
|
+
} else {
|
|
2438
|
+
this.verticalExtendRangeBy = {
|
|
2439
|
+
start: startAmount,
|
|
2440
|
+
end: endAmount
|
|
2441
|
+
};
|
|
2442
|
+
}
|
|
2443
|
+
this.updateRenderRange({ horizontal, vertical: !horizontal });
|
|
2443
2444
|
const restore = () => {
|
|
2444
|
-
this.
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
true
|
|
2450
|
-
);
|
|
2445
|
+
this.extendRenderRange({
|
|
2446
|
+
start: 0,
|
|
2447
|
+
end: 0,
|
|
2448
|
+
direction
|
|
2449
|
+
});
|
|
2451
2450
|
};
|
|
2452
|
-
const { start, end } = this.getRenderRange();
|
|
2453
|
-
const [startRow, startCol] = start;
|
|
2454
|
-
const [endRow, endCol] = end;
|
|
2455
|
-
this.setRenderRange({
|
|
2456
|
-
horizontal: {
|
|
2457
|
-
startIndex: Math.max(0, startCol - leftAmount),
|
|
2458
|
-
endIndex: Math.min(this.cols, endCol + rightAmount)
|
|
2459
|
-
},
|
|
2460
|
-
vertical: {
|
|
2461
|
-
startIndex: startRow,
|
|
2462
|
-
endIndex: endRow
|
|
2463
|
-
}
|
|
2464
|
-
});
|
|
2465
2451
|
return restore;
|
|
2466
2452
|
}
|
|
2467
2453
|
updateRenderCount(which = ALL_DIRECTIONS) {
|
|
@@ -2533,6 +2519,34 @@ var MatrixBrain = class extends Logger {
|
|
|
2533
2519
|
fns[i](scrollPosition);
|
|
2534
2520
|
}
|
|
2535
2521
|
}
|
|
2522
|
+
computeDirectionalRenderCount(direction, itemSize, count, theRenderSize) {
|
|
2523
|
+
let renderCount = 0;
|
|
2524
|
+
let size = direction === "horizontal" ? theRenderSize.width : theRenderSize.height;
|
|
2525
|
+
size -= this.getFixedSize(direction);
|
|
2526
|
+
if (size <= 0) {
|
|
2527
|
+
return 0;
|
|
2528
|
+
}
|
|
2529
|
+
if (typeof itemSize === "function") {
|
|
2530
|
+
const sizes = [];
|
|
2531
|
+
for (let i = 0; i < count; i++) {
|
|
2532
|
+
sizes.push(this.getItemSize(i, direction));
|
|
2533
|
+
}
|
|
2534
|
+
sizes.sort(SORT_ASC);
|
|
2535
|
+
let sum2 = 0;
|
|
2536
|
+
for (let i = 0; i < count; i++) {
|
|
2537
|
+
sum2 += sizes[i];
|
|
2538
|
+
renderCount++;
|
|
2539
|
+
if (sum2 > size) {
|
|
2540
|
+
break;
|
|
2541
|
+
}
|
|
2542
|
+
}
|
|
2543
|
+
renderCount += 1;
|
|
2544
|
+
} else {
|
|
2545
|
+
renderCount = (itemSize ? Math.ceil(size / itemSize) : 0) + 1;
|
|
2546
|
+
}
|
|
2547
|
+
renderCount = Math.min(count, renderCount);
|
|
2548
|
+
return renderCount;
|
|
2549
|
+
}
|
|
2536
2550
|
getFixedSize(direction) {
|
|
2537
2551
|
return direction === "horizontal" ? this.getFixedStartColsWidth() + this.getFixedEndColsWidth() : this.getFixedStartRowsHeight() + this.getFixedEndRowsHeight();
|
|
2538
2552
|
}
|
|
@@ -2647,6 +2661,8 @@ var MatrixBrain = class extends Logger {
|
|
|
2647
2661
|
this.rowspanParent.clear();
|
|
2648
2662
|
this.colspanParent.clear();
|
|
2649
2663
|
this.alwaysRenderedColumns.clear();
|
|
2664
|
+
this.horizontalExtendRangeBy = { start: 0, end: 0 };
|
|
2665
|
+
this.verticalExtendRangeBy = { start: 0, end: 0 };
|
|
2650
2666
|
this.destroyed = true;
|
|
2651
2667
|
this.onDestroyFns = [];
|
|
2652
2668
|
this.onScrollFns = [];
|
|
@@ -7794,12 +7810,14 @@ var useColumnPointerEvents = ({
|
|
|
7794
7810
|
if (brain2.isHorizontalLayoutBrain) {
|
|
7795
7811
|
const extendBy = true;
|
|
7796
7812
|
const restoreBodyRange = brain2.extendRenderRange({
|
|
7797
|
-
|
|
7798
|
-
|
|
7813
|
+
start: extendBy,
|
|
7814
|
+
end: extendBy,
|
|
7815
|
+
direction: "horizontal"
|
|
7799
7816
|
});
|
|
7800
7817
|
const restoreHeaderRange = headerBrain.extendRenderRange({
|
|
7801
|
-
|
|
7802
|
-
|
|
7818
|
+
start: extendBy,
|
|
7819
|
+
end: extendBy,
|
|
7820
|
+
direction: "horizontal"
|
|
7803
7821
|
});
|
|
7804
7822
|
restoreRenderRange = () => {
|
|
7805
7823
|
restoreBodyRange();
|
|
@@ -9553,12 +9571,14 @@ function ResizeHandleFn(props) {
|
|
|
9553
9571
|
const target = e.target;
|
|
9554
9572
|
if (brain.isHorizontalLayoutBrain) {
|
|
9555
9573
|
const restoreBodyRange = brain.extendRenderRange({
|
|
9556
|
-
|
|
9557
|
-
|
|
9574
|
+
start: true,
|
|
9575
|
+
end: true,
|
|
9576
|
+
direction: "horizontal"
|
|
9558
9577
|
});
|
|
9559
9578
|
const restoreHeaderRange = headerBrain.extendRenderRange({
|
|
9560
|
-
|
|
9561
|
-
|
|
9579
|
+
start: true,
|
|
9580
|
+
end: true,
|
|
9581
|
+
direction: "horizontal"
|
|
9562
9582
|
});
|
|
9563
9583
|
restoreRenderRange = () => {
|
|
9564
9584
|
restoreBodyRange();
|
|
@@ -18232,6 +18252,46 @@ var HorizontalLayoutMatrixBrain = class extends MatrixBrain {
|
|
|
18232
18252
|
});
|
|
18233
18253
|
}
|
|
18234
18254
|
}
|
|
18255
|
+
computeDirectionalRenderCount(direction, itemSize, count, theRenderSize) {
|
|
18256
|
+
if (direction === "vertical") {
|
|
18257
|
+
return super.computeDirectionalRenderCount(
|
|
18258
|
+
direction,
|
|
18259
|
+
itemSize,
|
|
18260
|
+
count,
|
|
18261
|
+
theRenderSize
|
|
18262
|
+
);
|
|
18263
|
+
}
|
|
18264
|
+
let renderCount = 0;
|
|
18265
|
+
let size = theRenderSize.width;
|
|
18266
|
+
size -= this.getFixedSize("horizontal");
|
|
18267
|
+
if (size <= 0) {
|
|
18268
|
+
return 0;
|
|
18269
|
+
}
|
|
18270
|
+
if (typeof itemSize === "number") {
|
|
18271
|
+
renderCount = (itemSize ? Math.ceil(size / itemSize) : 0) + 1;
|
|
18272
|
+
renderCount = Math.min(count, renderCount);
|
|
18273
|
+
return renderCount;
|
|
18274
|
+
}
|
|
18275
|
+
const pagesInView = Math.floor(size / this.pageWidth);
|
|
18276
|
+
renderCount += pagesInView * this.initialCols;
|
|
18277
|
+
const remainingSize = size - pagesInView * this.pageWidth;
|
|
18278
|
+
const sizes = [];
|
|
18279
|
+
for (let i = 0; i < this.initialCols; i++) {
|
|
18280
|
+
sizes.push(this.getItemSize(i, direction));
|
|
18281
|
+
}
|
|
18282
|
+
sizes.sort(SORT_ASC);
|
|
18283
|
+
let sum2 = 0;
|
|
18284
|
+
for (let i = 0; i < this.initialCols; i++) {
|
|
18285
|
+
sum2 += sizes[i];
|
|
18286
|
+
renderCount++;
|
|
18287
|
+
if (sum2 > remainingSize) {
|
|
18288
|
+
break;
|
|
18289
|
+
}
|
|
18290
|
+
}
|
|
18291
|
+
renderCount += 1;
|
|
18292
|
+
renderCount = Math.min(count, renderCount);
|
|
18293
|
+
return renderCount;
|
|
18294
|
+
}
|
|
18235
18295
|
getRowIndexInPage(rowIndex) {
|
|
18236
18296
|
return this.rowsPerPage ? rowIndex % this.rowsPerPage : rowIndex;
|
|
18237
18297
|
}
|
|
@@ -19958,7 +20018,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
19958
20018
|
}
|
|
19959
20019
|
let valid2 = isValidLicense(licenseKey, {
|
|
19960
20020
|
publishedAt: 1624970570587,
|
|
19961
|
-
version: "5.1.0-canary.
|
|
20021
|
+
version: "5.1.0-canary.1"
|
|
19962
20022
|
});
|
|
19963
20023
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
19964
20024
|
return true;
|
package/package.json
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"bugs": {
|
|
26
26
|
"url": "https://github.com/infinite-table/infinite-react/issues"
|
|
27
27
|
},
|
|
28
|
-
"version": "5.1.0-canary.
|
|
28
|
+
"version": "5.1.0-canary.1",
|
|
29
29
|
"main": "index.js",
|
|
30
30
|
"module": "index.mjs",
|
|
31
31
|
"typings": "index.d.ts",
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
},
|
|
35
35
|
"license": "Commercial & Open Source",
|
|
36
36
|
"//": "will be updated at build time",
|
|
37
|
-
"publishedAt":
|
|
37
|
+
"publishedAt": 1728143085224
|
|
38
38
|
}
|