@infinite-table/infinite-react 0.3.19 → 0.3.20
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.css +116 -81
- package/index.d.ts +34 -11
- package/index.esm.css +116 -81
- package/index.esm.js +617 -272
- package/index.js +600 -255
- package/package.json +2 -2
package/index.esm.js
CHANGED
|
@@ -1100,8 +1100,8 @@ function stripVar(cssVariableWithVarString) {
|
|
|
1100
1100
|
}
|
|
1101
1101
|
|
|
1102
1102
|
// src/components/InfiniteTable/theme.css.ts
|
|
1103
|
-
var InternalVars = { currentColumnWidth: "var(--_1slvgu90)", currentColumnTransformX: "var(--_1slvgu91)", currentColumnTransformY: "var(--_1slvgu92)", activeCellRowOffset: "var(--_1slvgu93)", activeCellRowHeight: "var(--_1slvgu94)", activeCellOffsetX: "var(--_1slvgu95)", activeCellOffsetY: "var(--_1slvgu96)", scrollTopForActiveRow: "var(--_1slvgu97)", activeCellColWidth: "var(--_1slvgu98)", activeCellColOffset: "var(--_1slvgu99)",
|
|
1104
|
-
var ThemeVars = { color: { accent: "var(--infinite-accent-color)", error: "var(--infinite-error-color)", color: "var(--infinite-color)" }, spacing: { "0": "var(--infinite-space-0)", "1": "var(--infinite-space-1)", "2": "var(--infinite-space-2)", "3": "var(--infinite-space-3)", "4": "var(--infinite-space-4)", "5": "var(--infinite-space-5)", "6": "var(--infinite-space-6)", "7": "var(--infinite-space-7)", "8": "var(--infinite-space-8)", "9": "var(--infinite-space-9)", "10": "var(--infinite-space-10)" }, fontSize: { "0": "var(--infinite-font-size-0)", "1": "var(--infinite-font-size-1)", "2": "var(--infinite-font-size-2)", "3": "var(--infinite-font-size-3)", "4": "var(--infinite-font-size-4)", "5": "var(--infinite-font-size-5)", "6": "var(--infinite-font-size-6)", "7": "var(--infinite-font-size-7)" }, fontFamily: "var(--infinite-font-family)", minHeight: "var(--infinite-min-height)", borderRadius: "var(--infinite-border-radius)", background: "var(--infinite-background)", components: { LoadMask: { padding: "var(--infinite-load-mask-padding)", color: "var(--infinite-load-mask-color)", textBackground: "var(--infinite-load-mask-text-background)", overlayBackground: "var(--infinite-load-mask-overlay-background)", overlayOpacity: "var(--infinite-load-mask-overlay-opacity)", borderRadius: "var(--infinite-load-mask-border-radius)" }, Header: { background: "var(--infinite-header-background)", color: "var(--infinite-header-color)", columnHeaderHeight: "var(--infinite-column-header-height)" }, HeaderCell: { background: "var(--infinite-header-cell-background)", hoverBackground: "var(--infinite-header-cell-hover-background)", padding: "var(--infinite-header-cell-padding)", paddingX: "var(--infinite-header-cell-padding-x)", paddingY: "var(--infinite-header-cell-padding-y)", iconSize: "var(--infinite-header-cell-icon-size)", sortIconMargin: "var(--infinite-header-cell-sort-icon-margin)", resizeHandleActiveAreaWidth: "var(--infinite-resize-handle-active-area-width)", resizeHandleWidth: "var(--infinite-resize-handle-width)", resizeHandleHoverBackground: "var(--infinite-resize-handle-hover-background)", resizeHandleConstrainedHoverBackground: "var(--infinite-resize-handle-constrained-hover-background)" }, Cell: { padding: "var(--infinite-cell-padding)", borderWidth: "var(--infinite-cell-border-width)", border: "var(--infinite-cell-border)", borderInvisible: "var(--infinite-cell-border-invisible)", borderRadius: "var(--infinite-cell-border-radius)", reorderEffectDuration: "var(--infinite-column-reorder-effect-duration)", color: "var(--infinite-cell-color)", activeBorderColor_R: "var(--infinite-active-cell-border-color--r)", activeBorderColor_G: "var(--infinite-active-cell-border-color--g)", activeBorderColor_B: "var(--infinite-active-cell-border-color--b)", activeBackgroundAlpha: "var(--infinite-active-cell-background-alpha)", activeBackgroundAlphaWhenTableUnfocused: "var(--infinite-active-cell-background-alpha--table-unfocused)", activeBackground: "var(--infinite-active-cell-background)", activeBorderColor: "var(--infinite-active-cell-border-color)", activeBorderWidth: "var(--infinite-active-cell-border-width)", activeBorderStyle: "var(--infinite-active-cell-border-style)", activeBorder: "var(--infinite-active-cell-border)" }, Row: { background: "var(--infinite-row-background)", oddBackground: "var(--infinite-row-odd-background)", activeBackground: "var(--infinite-active-row-background)", activeBorderColor: "var(--infinite-active-row-border-color)", activeBorderWidth: "var(--infinite-active-row-border-width)", activeBorderStyle: "var(--infinite-active-row-border-style)", activeBorder: "var(--infinite-active-row-border)", activeBackgroundAlpha: "var(--infinite-active-row-background-alpha)", activeBackgroundAlphaWhenTableUnfocused: "var(--infinite-active-row-background-alpha--table-unfocused)", hoverBackground: "var(--infinite-row-hover-background)", groupRowBackground: "var(--infinite-group-row-background)", groupRowColumnNesting: "var(--infinite-group-row-column-nesting)", groupNesting: "var(--infinite-dont-override-group-row-nesting-length)", pointerEventsWhileScrolling: "var(--infinite-row-pointer-events-while-scrolling)" }, ColumnCell: { background: "var(--infinite-column-cell-bg-dont-override)" } } };
|
|
1103
|
+
var InternalVars = { currentColumnWidth: "var(--_1slvgu90)", currentColumnTransformX: "var(--_1slvgu91)", currentColumnTransformY: "var(--_1slvgu92)", activeCellRowOffset: "var(--_1slvgu93)", activeCellRowHeight: "var(--_1slvgu94)", activeCellOffsetX: "var(--_1slvgu95)", activeCellOffsetY: "var(--_1slvgu96)", scrollTopForActiveRow: "var(--_1slvgu97)", activeCellColWidth: "var(--_1slvgu98)", activeCellColOffset: "var(--_1slvgu99)", columnReorderEffectDurationAtIndex: "var(--_1slvgu9a)", columnWidthAtIndex: "var(--_1slvgu9b)", columnOffsetAtIndex: "var(--_1slvgu9c)", columnOffsetAtIndexWhileReordering: "var(--_1slvgu9d)", columnZIndexAtIndex: "var(--_1slvgu9e)", pinnedStartWidth: "var(--_1slvgu9f)", pinnedEndWidth: "var(--_1slvgu9g)", pinnedStartDraggingWidth: "var(--_1slvgu9h)", pinnedEndDraggingWidth: "var(--_1slvgu9i)", pinnedEndOffset: "var(--_1slvgu9j)", computedVisibleColumnsCount: "var(--_1slvgu9k)", baseZIndexForCells: "var(--_1slvgu9l)", bodyWidth: "var(--_1slvgu9m)", bodyHeight: "var(--_1slvgu9n)", scrollbarWidthHorizontal: "var(--_1slvgu9o)", scrollbarWidthVertical: "var(--_1slvgu9p)", scrollLeft: "var(--_1slvgu9q)", scrollTop: "var(--_1slvgu9r)" };
|
|
1104
|
+
var ThemeVars = { color: { accent: "var(--infinite-accent-color)", error: "var(--infinite-error-color)", color: "var(--infinite-color)" }, spacing: { "0": "var(--infinite-space-0)", "1": "var(--infinite-space-1)", "2": "var(--infinite-space-2)", "3": "var(--infinite-space-3)", "4": "var(--infinite-space-4)", "5": "var(--infinite-space-5)", "6": "var(--infinite-space-6)", "7": "var(--infinite-space-7)", "8": "var(--infinite-space-8)", "9": "var(--infinite-space-9)", "10": "var(--infinite-space-10)" }, fontSize: { "0": "var(--infinite-font-size-0)", "1": "var(--infinite-font-size-1)", "2": "var(--infinite-font-size-2)", "3": "var(--infinite-font-size-3)", "4": "var(--infinite-font-size-4)", "5": "var(--infinite-font-size-5)", "6": "var(--infinite-font-size-6)", "7": "var(--infinite-font-size-7)" }, fontFamily: "var(--infinite-font-family)", minHeight: "var(--infinite-min-height)", borderRadius: "var(--infinite-border-radius)", background: "var(--infinite-background)", components: { LoadMask: { padding: "var(--infinite-load-mask-padding)", color: "var(--infinite-load-mask-color)", textBackground: "var(--infinite-load-mask-text-background)", overlayBackground: "var(--infinite-load-mask-overlay-background)", overlayOpacity: "var(--infinite-load-mask-overlay-opacity)", borderRadius: "var(--infinite-load-mask-border-radius)" }, Header: { background: "var(--infinite-header-background)", color: "var(--infinite-header-color)", columnHeaderHeight: "var(--infinite-column-header-height)" }, HeaderCell: { background: "var(--infinite-header-cell-background)", hoverBackground: "var(--infinite-header-cell-hover-background)", padding: "var(--infinite-header-cell-padding)", paddingX: "var(--infinite-header-cell-padding-x)", paddingY: "var(--infinite-header-cell-padding-y)", iconSize: "var(--infinite-header-cell-icon-size)", sortIconMargin: "var(--infinite-header-cell-sort-icon-margin)", resizeHandleActiveAreaWidth: "var(--infinite-resize-handle-active-area-width)", resizeHandleWidth: "var(--infinite-resize-handle-width)", resizeHandleHoverBackground: "var(--infinite-resize-handle-hover-background)", resizeHandleConstrainedHoverBackground: "var(--infinite-resize-handle-constrained-hover-background)" }, Cell: { padding: "var(--infinite-cell-padding)", borderWidth: "var(--infinite-cell-border-width)", border: "var(--infinite-cell-border)", borderInvisible: "var(--infinite-cell-border-invisible)", borderRadius: "var(--infinite-cell-border-radius)", reorderEffectDuration: "var(--infinite-column-reorder-effect-duration)", pinnedBorder: "var(--infinite-pinned-cell-border)", color: "var(--infinite-cell-color)", activeBorderColor_R: "var(--infinite-active-cell-border-color--r)", activeBorderColor_G: "var(--infinite-active-cell-border-color--g)", activeBorderColor_B: "var(--infinite-active-cell-border-color--b)", activeBackgroundAlpha: "var(--infinite-active-cell-background-alpha)", activeBackgroundAlphaWhenTableUnfocused: "var(--infinite-active-cell-background-alpha--table-unfocused)", activeBackground: "var(--infinite-active-cell-background)", activeBorderColor: "var(--infinite-active-cell-border-color)", activeBorderWidth: "var(--infinite-active-cell-border-width)", activeBorderStyle: "var(--infinite-active-cell-border-style)", activeBorder: "var(--infinite-active-cell-border)" }, Row: { background: "var(--infinite-row-background)", oddBackground: "var(--infinite-row-odd-background)", activeBackground: "var(--infinite-active-row-background)", activeBorderColor: "var(--infinite-active-row-border-color)", activeBorderWidth: "var(--infinite-active-row-border-width)", activeBorderStyle: "var(--infinite-active-row-border-style)", activeBorder: "var(--infinite-active-row-border)", activeBackgroundAlpha: "var(--infinite-active-row-background-alpha)", activeBackgroundAlphaWhenTableUnfocused: "var(--infinite-active-row-background-alpha--table-unfocused)", hoverBackground: "var(--infinite-row-hover-background)", groupRowBackground: "var(--infinite-group-row-background)", groupRowColumnNesting: "var(--infinite-group-row-column-nesting)", groupNesting: "var(--infinite-dont-override-group-row-nesting-length)", pointerEventsWhileScrolling: "var(--infinite-row-pointer-events-while-scrolling)" }, ColumnCell: { background: "var(--infinite-column-cell-bg-dont-override)" } } };
|
|
1105
1105
|
var columnHeaderHeightName = "column-header-height";
|
|
1106
1106
|
|
|
1107
1107
|
// src/utils/selectParent.ts
|
|
@@ -1129,8 +1129,11 @@ var InfiniteSelector = `.${internalProps.rootClassName}`;
|
|
|
1129
1129
|
function getParentInfiniteNode(node) {
|
|
1130
1130
|
return selectParent(node, InfiniteSelector);
|
|
1131
1131
|
}
|
|
1132
|
+
var scrollLeft = stripVar(InternalVars.scrollLeft);
|
|
1133
|
+
var scrollTop = stripVar(InternalVars.scrollTop);
|
|
1132
1134
|
var columnWidthAtIndex = stripVar(InternalVars.columnWidthAtIndex);
|
|
1133
1135
|
var columnOffsetAtIndex = stripVar(InternalVars.columnOffsetAtIndex);
|
|
1136
|
+
var columnReorderEffectDurationAtIndex = stripVar(InternalVars.columnReorderEffectDurationAtIndex);
|
|
1134
1137
|
var columnOffsetAtIndexWhileReordering = stripVar(InternalVars.columnOffsetAtIndexWhileReordering);
|
|
1135
1138
|
var columnZIndexAtIndex = stripVar(InternalVars.columnZIndexAtIndex);
|
|
1136
1139
|
function setInfiniteVarOnRoot(varName, varValue, node) {
|
|
@@ -1156,18 +1159,34 @@ function setInfiniteColumnWidth(colIndex, colWidth, node) {
|
|
|
1156
1159
|
function setInfiniteColumnOffset(colIndex, colOffset, node) {
|
|
1157
1160
|
setInfiniteVarOnRoot(`${columnOffsetAtIndex}-${colIndex}`, typeof colOffset === "number" ? colOffset + "px" : colOffset, node);
|
|
1158
1161
|
}
|
|
1162
|
+
function addToInfiniteColumnOffset(column, amountToAdd, node) {
|
|
1163
|
+
setInfiniteVarOnRoot(`${columnOffsetAtIndex}-${column.computedVisibleIndex}`, !column.computedPinned ? `${column.computedAbsoluteOffset + amountToAdd}px` : `calc( ${column.computedAbsoluteOffset + amountToAdd}px + var(${scrollLeft}))`, node);
|
|
1164
|
+
}
|
|
1159
1165
|
function setInfiniteColumnZIndex(colIndex, colZIndex, node) {
|
|
1160
1166
|
setInfiniteVarOnRoot(`${columnZIndexAtIndex}-${colIndex}`, `${colZIndex}`, node);
|
|
1161
1167
|
}
|
|
1162
1168
|
function setInfiniteColumnOffsetWhileReordering(colIndex, offset, node) {
|
|
1163
1169
|
setInfiniteVarOnRoot(`${columnOffsetAtIndexWhileReordering}-${colIndex}`, typeof offset === "number" ? `calc( var(${columnOffsetAtIndex}-${colIndex}) + ${offset}px )` : offset, node);
|
|
1164
1170
|
}
|
|
1171
|
+
function clearInfiniteColumnReorderDuration(colIndex, node, defaultValue) {
|
|
1172
|
+
setInfiniteVarOnRoot(`${columnReorderEffectDurationAtIndex}-${colIndex}`, defaultValue != null ? defaultValue : "", node);
|
|
1173
|
+
}
|
|
1174
|
+
function restoreInfiniteColumnReorderDuration(colIndex, node) {
|
|
1175
|
+
const varName = `${columnReorderEffectDurationAtIndex}-${colIndex}`;
|
|
1176
|
+
setInfiniteVarOnRoot(varName, ThemeVars.components.Cell.reorderEffectDuration, node);
|
|
1177
|
+
}
|
|
1165
1178
|
function getCSSVarNameForColWidth(colIndex) {
|
|
1166
1179
|
return `${columnWidthAtIndex}-${colIndex}`;
|
|
1167
1180
|
}
|
|
1168
1181
|
function getCSSVarNameForColOffset(colIndex) {
|
|
1169
1182
|
return `${columnOffsetAtIndex}-${colIndex}`;
|
|
1170
1183
|
}
|
|
1184
|
+
function setInfiniteScrollPosition(scrollPosition, node) {
|
|
1185
|
+
setInfiniteVarsOnNode({
|
|
1186
|
+
[scrollLeft]: `${scrollPosition.scrollLeft}px`,
|
|
1187
|
+
[scrollTop]: `${scrollPosition.scrollTop}px`
|
|
1188
|
+
}, node);
|
|
1189
|
+
}
|
|
1171
1190
|
|
|
1172
1191
|
// src/components/VirtualBrain/MatrixBrain.ts
|
|
1173
1192
|
var import_binary_search = __toModule(require_binary_search());
|
|
@@ -1501,11 +1520,11 @@ var MatrixBrain = class extends Logger {
|
|
|
1501
1520
|
}
|
|
1502
1521
|
return sum2;
|
|
1503
1522
|
};
|
|
1504
|
-
this.getFixedEndColsOffsets = () => {
|
|
1523
|
+
this.getFixedEndColsOffsets = ({ skipScroll } = { skipScroll: false }) => {
|
|
1505
1524
|
if (!this.fixedColsEnd) {
|
|
1506
1525
|
return [];
|
|
1507
1526
|
}
|
|
1508
|
-
const { scrollLeft } = this.scrollPosition;
|
|
1527
|
+
const { scrollLeft: scrollLeft2 } = this.scrollPosition;
|
|
1509
1528
|
const { width } = this.getAvailableSize();
|
|
1510
1529
|
const offsets = [];
|
|
1511
1530
|
const widths = [];
|
|
@@ -1515,7 +1534,7 @@ var MatrixBrain = class extends Logger {
|
|
|
1515
1534
|
widths.push(colWidth);
|
|
1516
1535
|
sum2 += colWidth;
|
|
1517
1536
|
}
|
|
1518
|
-
const baseOffset = width - sum2 +
|
|
1537
|
+
const baseOffset = width - sum2 + (skipScroll ? 0 : scrollLeft2);
|
|
1519
1538
|
sum2 = 0;
|
|
1520
1539
|
let index = 0;
|
|
1521
1540
|
for (let colIndex = this.cols - this.fixedColsEnd; colIndex < this.cols; colIndex++) {
|
|
@@ -1526,11 +1545,11 @@ var MatrixBrain = class extends Logger {
|
|
|
1526
1545
|
}
|
|
1527
1546
|
return offsets;
|
|
1528
1547
|
};
|
|
1529
|
-
this.getFixedEndRowsOffsets = () => {
|
|
1548
|
+
this.getFixedEndRowsOffsets = ({ skipScroll } = { skipScroll: false }) => {
|
|
1530
1549
|
if (!this.fixedRowsEnd) {
|
|
1531
1550
|
return [];
|
|
1532
1551
|
}
|
|
1533
|
-
const { scrollTop } = this.scrollPosition;
|
|
1552
|
+
const { scrollTop: scrollTop2 } = this.scrollPosition;
|
|
1534
1553
|
const { height } = this.getAvailableSize();
|
|
1535
1554
|
const offsets = [];
|
|
1536
1555
|
const heights = [];
|
|
@@ -1540,7 +1559,7 @@ var MatrixBrain = class extends Logger {
|
|
|
1540
1559
|
heights.push(rowHeight);
|
|
1541
1560
|
sum2 += rowHeight;
|
|
1542
1561
|
}
|
|
1543
|
-
const baseOffset = height - sum2 +
|
|
1562
|
+
const baseOffset = height - sum2 + (skipScroll ? 0 : scrollTop2);
|
|
1544
1563
|
sum2 = 0;
|
|
1545
1564
|
let index = 0;
|
|
1546
1565
|
for (let rowIndex = this.rows - this.fixedRowsEnd; rowIndex < this.rows; rowIndex++) {
|
|
@@ -1602,6 +1621,12 @@ var MatrixBrain = class extends Logger {
|
|
|
1602
1621
|
horizontal,
|
|
1603
1622
|
vertical
|
|
1604
1623
|
}) => {
|
|
1624
|
+
if (horizontal === void 0) {
|
|
1625
|
+
horizontal = this.horizontalRenderCount;
|
|
1626
|
+
}
|
|
1627
|
+
if (vertical === void 0) {
|
|
1628
|
+
vertical = this.verticalRenderCount;
|
|
1629
|
+
}
|
|
1605
1630
|
const horizontalSame = horizontal === this.horizontalRenderCount;
|
|
1606
1631
|
const verticalSame = vertical === this.verticalRenderCount;
|
|
1607
1632
|
if (horizontalSame && verticalSame) {
|
|
@@ -2670,6 +2695,7 @@ var MappedCells = class extends Logger {
|
|
|
2670
2695
|
// src/components/HeadlessTable/ReactHeadlessTableRenderer.tsx
|
|
2671
2696
|
var ITEM_POSITION_WITH_TRANSFORM = true;
|
|
2672
2697
|
var currentColumnTransformY = stripVar(InternalVars.currentColumnTransformY);
|
|
2698
|
+
var scrollTopCSSVar = stripVar(InternalVars.scrollTop);
|
|
2673
2699
|
var columnOffsetAtIndex2 = stripVar(InternalVars.columnOffsetAtIndex);
|
|
2674
2700
|
var columnOffsetAtIndexWhileReordering2 = stripVar(InternalVars.columnOffsetAtIndexWhileReordering);
|
|
2675
2701
|
var ReactHeadlessTableRenderer = class extends Logger {
|
|
@@ -2686,14 +2712,15 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2686
2712
|
this.currentHoveredRow = -1;
|
|
2687
2713
|
this.hoverRowUpdatesInProgress = new Map();
|
|
2688
2714
|
this.infiniteNode = null;
|
|
2689
|
-
this.setTransform = (element, _rowIndex, colIndex,
|
|
2715
|
+
this.setTransform = (element, _rowIndex, colIndex, {
|
|
2716
|
+
x,
|
|
2717
|
+
y,
|
|
2718
|
+
scrollLeft: scrollLeft2,
|
|
2719
|
+
scrollTop: scrollTop2
|
|
2720
|
+
}, zIndex2) => {
|
|
2690
2721
|
const columnOffsetX = `${columnOffsetAtIndex2}-${colIndex}`;
|
|
2691
2722
|
const columnOffsetXWhileReordering = `${columnOffsetAtIndexWhileReordering2}-${colIndex}`;
|
|
2692
|
-
|
|
2693
|
-
this.infiniteNode = getParentInfiniteNode(element);
|
|
2694
|
-
}
|
|
2695
|
-
this.infiniteNode.style.setProperty(columnOffsetX, `${x}px`);
|
|
2696
|
-
element.style.setProperty(currentColumnTransformY, `${y}px`);
|
|
2723
|
+
element.style.setProperty(currentColumnTransformY, scrollTop2 ? `calc( ${y}px + var(${scrollTopCSSVar}) )` : `${y}px`);
|
|
2697
2724
|
element.style.transform = `translate3d(var(${columnOffsetXWhileReordering}, var(${columnOffsetX})), ${InternalVars.currentColumnTransformY}, 0)`;
|
|
2698
2725
|
if (zIndex2 != null) {
|
|
2699
2726
|
}
|
|
@@ -2737,18 +2764,18 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2737
2764
|
if (!scrollAdjustPosition) {
|
|
2738
2765
|
scrollAdjustPosition = rowOffset > bottom - fixedEndRowsHeight ? "end" : rowOffset < top2 + fixedStartRowsHeight ? "start" : "end";
|
|
2739
2766
|
}
|
|
2740
|
-
let
|
|
2767
|
+
let scrollTop2 = scrollPosition.scrollTop;
|
|
2741
2768
|
if (scrollAdjustPosition === "center") {
|
|
2742
|
-
|
|
2769
|
+
scrollTop2 = rowOffset - Math.floor((brain.getAvailableSize().height - fixedStartRowsHeight - fixedEndRowsHeight) / 2);
|
|
2743
2770
|
} else if (scrollAdjustPosition === "start") {
|
|
2744
2771
|
offset = -offset;
|
|
2745
|
-
|
|
2772
|
+
scrollTop2 += rowOffset - top2 + offset - fixedStartRowsHeight;
|
|
2746
2773
|
} else {
|
|
2747
2774
|
offset += rowHeight;
|
|
2748
|
-
|
|
2775
|
+
scrollTop2 += rowOffset - bottom + offset + fixedEndRowsHeight;
|
|
2749
2776
|
}
|
|
2750
2777
|
return __spreadProps(__spreadValues({}, scrollPosition), {
|
|
2751
|
-
scrollTop
|
|
2778
|
+
scrollTop: scrollTop2
|
|
2752
2779
|
});
|
|
2753
2780
|
};
|
|
2754
2781
|
this.getScrollPositionForScrollColumnIntoView = (colIndex, config = { offset: 0 }) => {
|
|
@@ -2771,18 +2798,18 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2771
2798
|
if (!scrollAdjustPosition) {
|
|
2772
2799
|
scrollAdjustPosition = colOffset > right - fixedEndColsWidth ? "end" : colOffset < left2 + fixedStartColsWidth ? "start" : "end";
|
|
2773
2800
|
}
|
|
2774
|
-
let
|
|
2801
|
+
let scrollLeft2 = scrollPosition.scrollLeft;
|
|
2775
2802
|
if (scrollAdjustPosition === "center") {
|
|
2776
|
-
|
|
2803
|
+
scrollLeft2 = colOffset - Math.floor((brain.getAvailableSize().width - fixedStartColsWidth - fixedEndColsWidth) / 2);
|
|
2777
2804
|
} else if (scrollAdjustPosition === "start") {
|
|
2778
2805
|
offset = -offset;
|
|
2779
|
-
|
|
2806
|
+
scrollLeft2 += colOffset - left2 + offset - fixedStartColsWidth;
|
|
2780
2807
|
} else {
|
|
2781
2808
|
offset += colWidth;
|
|
2782
|
-
|
|
2809
|
+
scrollLeft2 += colOffset - right + offset + fixedEndColsWidth;
|
|
2783
2810
|
}
|
|
2784
2811
|
return __spreadProps(__spreadValues({}, scrollPosition), {
|
|
2785
|
-
scrollLeft
|
|
2812
|
+
scrollLeft: scrollLeft2
|
|
2786
2813
|
});
|
|
2787
2814
|
};
|
|
2788
2815
|
this.getScrollPositionForScrollCellIntoView = (rowIndex, colIndex, config = { offsetLeft: 0, offsetTop: 0 }) => {
|
|
@@ -2797,9 +2824,9 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2797
2824
|
if (!scrollPosForCol || !scrollPosForRow) {
|
|
2798
2825
|
return null;
|
|
2799
2826
|
}
|
|
2800
|
-
const { scrollLeft } = scrollPosForCol;
|
|
2801
|
-
const { scrollTop } = scrollPosForRow;
|
|
2802
|
-
return { scrollLeft, scrollTop };
|
|
2827
|
+
const { scrollLeft: scrollLeft2 } = scrollPosForCol;
|
|
2828
|
+
const { scrollTop: scrollTop2 } = scrollPosForRow;
|
|
2829
|
+
return { scrollLeft: scrollLeft2, scrollTop: scrollTop2 };
|
|
2803
2830
|
};
|
|
2804
2831
|
this.isRowFullyVisible = (rowIndex, offsetMargin = 2) => {
|
|
2805
2832
|
return this.isRowVisible(rowIndex, this.brain.getRowHeight(rowIndex) - offsetMargin);
|
|
@@ -3186,10 +3213,10 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
3186
3213
|
}
|
|
3187
3214
|
};
|
|
3188
3215
|
raf(() => {
|
|
3189
|
-
|
|
3190
|
-
if (false) {
|
|
3216
|
+
if (this.destroyed) {
|
|
3191
3217
|
return;
|
|
3192
3218
|
}
|
|
3219
|
+
checkHoverClass();
|
|
3193
3220
|
this.hoverRowUpdatesInProgress.delete(rowIndex);
|
|
3194
3221
|
});
|
|
3195
3222
|
};
|
|
@@ -3213,7 +3240,7 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
3213
3240
|
itemElement.dataset.rowIndex = rowIndex;
|
|
3214
3241
|
itemElement.dataset.colIndex = colIndex;
|
|
3215
3242
|
if (ITEM_POSITION_WITH_TRANSFORM) {
|
|
3216
|
-
this.setTransform(itemElement, rowIndex, colIndex, x, y, null);
|
|
3243
|
+
this.setTransform(itemElement, rowIndex, colIndex, { x, y }, null);
|
|
3217
3244
|
itemElement.style.willChange = "transform";
|
|
3218
3245
|
itemElement.style.backfaceVisibility = "hidden";
|
|
3219
3246
|
const hidden = options ? options.hidden : !!this.isCellCovered(rowIndex, colIndex);
|
|
@@ -3242,8 +3269,15 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
3242
3269
|
if (!fixedColsStart && !fixedColsEnd && !fixedRowsStart && !fixedRowsEnd) {
|
|
3243
3270
|
return;
|
|
3244
3271
|
}
|
|
3245
|
-
|
|
3246
|
-
|
|
3272
|
+
if (itemDOMElements[0]) {
|
|
3273
|
+
setInfiniteScrollPosition(scrollPosition, this.getInfiniteNode(itemDOMElements[0]));
|
|
3274
|
+
}
|
|
3275
|
+
const fixedEndColsOffsets = this.brain.getFixedEndColsOffsets({
|
|
3276
|
+
skipScroll: true
|
|
3277
|
+
});
|
|
3278
|
+
const fixedEndRowsOffsets = this.brain.getFixedEndRowsOffsets({
|
|
3279
|
+
skipScroll: true
|
|
3280
|
+
});
|
|
3247
3281
|
const { start, end } = this.brain.getRenderRange();
|
|
3248
3282
|
const [startRow, startCol] = start;
|
|
3249
3283
|
const [endRow, endCol] = end;
|
|
@@ -3255,33 +3289,48 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
3255
3289
|
const itemPosition = brain.getCellOffset(rowIndex, colIndex);
|
|
3256
3290
|
const node = itemDOMElements[elementIndex];
|
|
3257
3291
|
if (elementIndex != null && node && itemPosition) {
|
|
3258
|
-
fn(rowIndex, colIndex, node, itemPosition
|
|
3292
|
+
fn(rowIndex, colIndex, node, itemPosition);
|
|
3259
3293
|
}
|
|
3260
3294
|
}
|
|
3261
|
-
const adjustColStart = (_rowIndex, colIndex, node, { x, y }
|
|
3262
|
-
this.setTransform(node, _rowIndex, colIndex, x
|
|
3295
|
+
const adjustColStart = (_rowIndex, colIndex, node, { x, y }) => {
|
|
3296
|
+
this.setTransform(node, _rowIndex, colIndex, { x, y, scrollLeft: true }, fixedColsStart - colIndex);
|
|
3263
3297
|
};
|
|
3264
|
-
const adjustRowStart = (rowIndex, _colIndex, node, coords
|
|
3265
|
-
this.setTransform(node, rowIndex, _colIndex, coords.x, coords.y
|
|
3298
|
+
const adjustRowStart = (rowIndex, _colIndex, node, coords) => {
|
|
3299
|
+
this.setTransform(node, rowIndex, _colIndex, { x: coords.x, y: coords.y, scrollTop: true }, fixedRowsStart - rowIndex);
|
|
3266
3300
|
};
|
|
3267
3301
|
const adjustColEnd = (_rowIndex, colIndex, node, { y }) => {
|
|
3268
3302
|
const val = fixedEndColsOffsets[colIndex];
|
|
3269
|
-
this.setTransform(node, _rowIndex, colIndex, val, y, cols - colIndex);
|
|
3303
|
+
this.setTransform(node, _rowIndex, colIndex, { x: val, y, scrollLeft: true }, cols - colIndex);
|
|
3270
3304
|
};
|
|
3271
3305
|
const adjustRowEnd = (rowIndex, _colIndex, node, coords) => {
|
|
3272
|
-
this.setTransform(node, rowIndex, _colIndex, coords.x, fixedEndRowsOffsets[rowIndex], rows - rowIndex);
|
|
3306
|
+
this.setTransform(node, rowIndex, _colIndex, { x: coords.x, y: fixedEndRowsOffsets[rowIndex], scrollTop: true }, rows - rowIndex);
|
|
3273
3307
|
};
|
|
3274
|
-
const adjustColStartRowStart = (_rowIndex, _colIndex, node, { x, y }
|
|
3275
|
-
this.setTransform(node, _rowIndex, _colIndex, x
|
|
3308
|
+
const adjustColStartRowStart = (_rowIndex, _colIndex, node, { x, y }) => {
|
|
3309
|
+
this.setTransform(node, _rowIndex, _colIndex, { x, scrollLeft: true, y, scrollTop: true }, 1e5);
|
|
3276
3310
|
};
|
|
3277
|
-
const adjustColStartRowEnd = (_rowIndex, _colIndex, node, { x }
|
|
3278
|
-
this.setTransform(node, _rowIndex, _colIndex,
|
|
3311
|
+
const adjustColStartRowEnd = (_rowIndex, _colIndex, node, { x }) => {
|
|
3312
|
+
this.setTransform(node, _rowIndex, _colIndex, {
|
|
3313
|
+
x,
|
|
3314
|
+
scrollLeft: true,
|
|
3315
|
+
y: fixedEndRowsOffsets[_rowIndex],
|
|
3316
|
+
scrollTop: true
|
|
3317
|
+
}, 2e5);
|
|
3279
3318
|
};
|
|
3280
3319
|
const adjustColEndRowStart = (_rowIndex, colIndex, node, coords) => {
|
|
3281
|
-
this.setTransform(node, _rowIndex, colIndex,
|
|
3320
|
+
this.setTransform(node, _rowIndex, colIndex, {
|
|
3321
|
+
x: fixedEndColsOffsets[colIndex],
|
|
3322
|
+
y: coords.y,
|
|
3323
|
+
scrollLeft: true,
|
|
3324
|
+
scrollTop: true
|
|
3325
|
+
}, 3e5);
|
|
3282
3326
|
};
|
|
3283
3327
|
const adjustColEndRowEnd = (rowIndex, colIndex, node) => {
|
|
3284
|
-
this.setTransform(node, rowIndex, colIndex,
|
|
3328
|
+
this.setTransform(node, rowIndex, colIndex, {
|
|
3329
|
+
x: fixedEndColsOffsets[colIndex],
|
|
3330
|
+
y: fixedEndRowsOffsets[rowIndex],
|
|
3331
|
+
scrollLeft: true,
|
|
3332
|
+
scrollTop: true
|
|
3333
|
+
}, 4e5);
|
|
3285
3334
|
};
|
|
3286
3335
|
if (fixedColsStart || fixedColsEnd) {
|
|
3287
3336
|
for (let rowIndex = startRow; rowIndex < endRow; rowIndex++) {
|
|
@@ -3360,6 +3409,9 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
3360
3409
|
const removeOnSizeChange = brain.onAvailableSizeChange(() => {
|
|
3361
3410
|
this.adjustFixedElementsOnScroll();
|
|
3362
3411
|
raf(() => {
|
|
3412
|
+
if (this.destroyed) {
|
|
3413
|
+
return;
|
|
3414
|
+
}
|
|
3363
3415
|
this.adjustFixedElementsOnScroll();
|
|
3364
3416
|
});
|
|
3365
3417
|
});
|
|
@@ -3372,6 +3424,12 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
3372
3424
|
removeOnScrollStop();
|
|
3373
3425
|
};
|
|
3374
3426
|
}
|
|
3427
|
+
getInfiniteNode(node) {
|
|
3428
|
+
if (!this.infiniteNode) {
|
|
3429
|
+
this.infiniteNode = getParentInfiniteNode(node);
|
|
3430
|
+
}
|
|
3431
|
+
return this.infiniteNode;
|
|
3432
|
+
}
|
|
3375
3433
|
renderElement(elementIndex) {
|
|
3376
3434
|
const domRef = (node) => {
|
|
3377
3435
|
if (node) {
|
|
@@ -3517,11 +3575,11 @@ var useRerender = () => {
|
|
|
3517
3575
|
};
|
|
3518
3576
|
|
|
3519
3577
|
// src/components/InfiniteTable/components/ActiveCellIndicator.css.ts
|
|
3520
|
-
var ActiveCellIndicatorCls = { visible: "nxbq1c2 nxbq1c1 _16lm1iwf _16lm1iw3
|
|
3521
|
-
var ActiveIndicatorWrapperCls = "_16lm1iwf _16lm1iw3
|
|
3578
|
+
var ActiveCellIndicatorCls = { visible: "nxbq1c2 nxbq1c1 _16lm1iwf _16lm1iw3 _16lm1iw14 _16lm1iw12", hidden: "nxbq1c3 nxbq1c1 _16lm1iwf _16lm1iw3 _16lm1iw14 _16lm1iw12" };
|
|
3579
|
+
var ActiveIndicatorWrapperCls = "_16lm1iwf _16lm1iw3 _16lm1iw14 _16lm1iw12 _16lm1iwy _16lm1iwo";
|
|
3522
3580
|
|
|
3523
3581
|
// src/components/InfiniteTable/components/ActiveRowIndicator.css.ts
|
|
3524
|
-
var ActiveRowIndicatorCls = { visible: "j26lrx1 j26lrx0 _16lm1iwf _16lm1iw3
|
|
3582
|
+
var ActiveRowIndicatorCls = { visible: "j26lrx1 j26lrx0 _16lm1iwf _16lm1iw3 _16lm1iw11 _16lm1iw12 _16lm1iw14", hidden: "j26lrx2 j26lrx0 _16lm1iwf _16lm1iw3 _16lm1iw11 _16lm1iw12 _16lm1iw14" };
|
|
3525
3583
|
|
|
3526
3584
|
// src/components/InfiniteTable/components/ActiveRowIndicator.tsx
|
|
3527
3585
|
var { rootClassName: rootClassName3 } = internalProps;
|
|
@@ -4062,20 +4120,20 @@ var useInternalProps = () => {
|
|
|
4062
4120
|
};
|
|
4063
4121
|
|
|
4064
4122
|
// src/components/InfiniteTable/utilities.css.ts
|
|
4065
|
-
var alignItems = { center: "
|
|
4066
|
-
var cssEllipsisClassName = "
|
|
4123
|
+
var alignItems = { center: "_16lm1iw1e", stretch: "_16lm1iw1f" };
|
|
4124
|
+
var cssEllipsisClassName = "_16lm1iw1p _16lm1iw1q _16lm1iw1j";
|
|
4067
4125
|
var cursor = { pointer: "_16lm1iwd", colResize: "_16lm1iwe" };
|
|
4068
|
-
var display = { flex: "
|
|
4126
|
+
var display = { flex: "_16lm1iwt", none: "_16lm1iwu", block: "_16lm1iwv", inlineBlock: "_16lm1iww" };
|
|
4069
4127
|
var flex = { "1": "_16lm1iwg", none: "_16lm1iwh" };
|
|
4070
|
-
var flexFlow = { column: "
|
|
4071
|
-
var justifyContent = { center: "
|
|
4072
|
-
var left = { "0": "
|
|
4073
|
-
var overflow = { hidden: "
|
|
4128
|
+
var flexFlow = { column: "_16lm1iw1c", row: "_16lm1iw1d" };
|
|
4129
|
+
var justifyContent = { center: "_16lm1iw1g", start: "_16lm1iw1h", end: "_16lm1iw1i" };
|
|
4130
|
+
var left = { "0": "_16lm1iw14", "100%": "_16lm1iw15", auto: "_16lm1iw16" };
|
|
4131
|
+
var overflow = { hidden: "_16lm1iw1j", auto: "_16lm1iw1k", visible: "_16lm1iw1l" };
|
|
4074
4132
|
var position = { relative: "_16lm1iw1", absolute: "_16lm1iw2", sticky: "_16lm1iw3", fixed: "_16lm1iw4" };
|
|
4075
|
-
var top = { "0": "
|
|
4133
|
+
var top = { "0": "_16lm1iw12", "100%": "_16lm1iw13" };
|
|
4076
4134
|
var transformTranslateZero = "_16lm1iwa";
|
|
4077
|
-
var userSelect = { none: "
|
|
4078
|
-
var zIndex = { "1": "_16lm1iwi", "10": "_16lm1iwj", "
|
|
4135
|
+
var userSelect = { none: "_16lm1iwx" };
|
|
4136
|
+
var zIndex = { "1": "_16lm1iwi", "10": "_16lm1iwj", "100": "_16lm1iwk", "1000": "_16lm1iwl", "10000": "_16lm1iwm", "100000": "_16lm1iwn", "1000000": "_16lm1iwo", "10000000": "_16lm1iwp", "1k": "_16lm1iwq", "10k": "_16lm1iwr", "100k": "_16lm1iws" };
|
|
4079
4137
|
|
|
4080
4138
|
// src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx
|
|
4081
4139
|
var InfiniteTableBody = forwardRef2(function InfiniteTableBody2(props, ref) {
|
|
@@ -4106,7 +4164,7 @@ import {
|
|
|
4106
4164
|
Fragment as Fragment2,
|
|
4107
4165
|
createContext as createContext4,
|
|
4108
4166
|
createElement as createElement16,
|
|
4109
|
-
useMemo as
|
|
4167
|
+
useMemo as useMemo4
|
|
4110
4168
|
} from "react";
|
|
4111
4169
|
import { useCallback as useCallback8, useContext as useContext4, useEffect as useEffect11, useRef as useRef12 } from "react";
|
|
4112
4170
|
import { createPortal } from "react-dom";
|
|
@@ -4212,7 +4270,7 @@ function useCellClassName(column, baseClasses, variants, extraFlags) {
|
|
|
4212
4270
|
|
|
4213
4271
|
// src/components/InfiniteTable/hooks/useColumnPointerEvents.ts
|
|
4214
4272
|
var import_binary_search2 = __toModule(require_binary_search());
|
|
4215
|
-
import { useCallback as useCallback6,
|
|
4273
|
+
import { useCallback as useCallback6, useState as useState5 } from "react";
|
|
4216
4274
|
|
|
4217
4275
|
// src/components/InfiniteTable/hooks/useInfiniteTable.ts
|
|
4218
4276
|
import { useContext as useContext3 } from "react";
|
|
@@ -4253,10 +4311,36 @@ var moveXatY = (arr, dragIndex, dropIndex) => {
|
|
|
4253
4311
|
// src/components/InfiniteTable/InfiniteCls.css.ts
|
|
4254
4312
|
var import_createRuntimeFn = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
4255
4313
|
var FooterCls = "_16lm1iw1";
|
|
4256
|
-
var InfiniteCls = "_1yeub2v0 _16lm1iw1
|
|
4314
|
+
var InfiniteCls = "_1yeub2v0 _16lm1iw1 _16lm1iwt _16lm1iw1c _16lm1iw0";
|
|
4315
|
+
var InfiniteClsHasPinnedEnd = "_1yeub2vo";
|
|
4316
|
+
var InfiniteClsHasPinnedStart = "_1yeub2vn";
|
|
4257
4317
|
var InfiniteClsRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "", variantClassNames: { focused: { true: "_1yeub2v2", false: "_1yeub2v3" }, focusedWithin: { true: "_1yeub2v4", false: "_1yeub2v5" }, hasPinnedStart: { true: "_1yeub2v6", false: "_1yeub2v7" }, hasPinnedEnd: { true: "_1yeub2v8", false: "_1yeub2v9" }, hasPinnedStartOverflow: { true: "_1yeub2va", false: "_1yeub2vb" }, hasPinnedEndOverflow: { true: "_1yeub2vc", false: "_1yeub2vd" } }, defaultVariants: {}, compoundVariants: [[{ focused: false, focusedWithin: false }, "_1yeub2ve"]] });
|
|
4258
4318
|
var InfiniteClsShiftingColumns = "_1yeub2vl";
|
|
4319
|
+
var PinnedEndIndicatorBorder = "_1yeub2vr _1yeub2vp _16lm1iw2 _16lm1iw12 _16lm1iwe _16lm1iwx _16lm1iw10 _16lm1iw1n _16lm1iwf _16lm1iwl";
|
|
4259
4320
|
var PinnedRowsContainerClsVariants = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "", variantClassNames: { pinned: { start: "_1yeub2vi", end: "_1yeub2vj", false: "_1yeub2vk" } }, defaultVariants: {}, compoundVariants: [] });
|
|
4321
|
+
var PinnedStartIndicatorBorder = "_1yeub2vq _1yeub2vp _16lm1iw2 _16lm1iw12 _16lm1iwe _16lm1iwx _16lm1iw10 _16lm1iw1n _16lm1iwf _16lm1iwl";
|
|
4322
|
+
|
|
4323
|
+
// src/components/utils/getScrollbarWidth.ts
|
|
4324
|
+
var scrollbarWidth;
|
|
4325
|
+
function getScrollbarWidth() {
|
|
4326
|
+
var _a, _b;
|
|
4327
|
+
if (scrollbarWidth != null) {
|
|
4328
|
+
return scrollbarWidth;
|
|
4329
|
+
}
|
|
4330
|
+
const doc = (_a = getGlobal().document) != null ? _a : null;
|
|
4331
|
+
if (!doc) {
|
|
4332
|
+
return 0;
|
|
4333
|
+
}
|
|
4334
|
+
const outer = doc.createElement("div");
|
|
4335
|
+
outer.style.visibility = "hidden";
|
|
4336
|
+
outer.style.overflow = "scroll";
|
|
4337
|
+
doc.body.appendChild(outer);
|
|
4338
|
+
const inner = doc.createElement("div");
|
|
4339
|
+
outer.appendChild(inner);
|
|
4340
|
+
scrollbarWidth = outer.offsetWidth - inner.offsetWidth;
|
|
4341
|
+
(_b = outer.parentNode) == null ? void 0 : _b.removeChild(outer);
|
|
4342
|
+
return scrollbarWidth;
|
|
4343
|
+
}
|
|
4260
4344
|
|
|
4261
4345
|
// src/components/InfiniteTable/utils/rafFn.ts
|
|
4262
4346
|
var rafFn = (fn) => {
|
|
@@ -4273,12 +4357,22 @@ var rafFn = (fn) => {
|
|
|
4273
4357
|
};
|
|
4274
4358
|
|
|
4275
4359
|
// src/components/InfiniteTable/hooks/useDOMProps.ts
|
|
4360
|
+
var scrollbarWidthHorizontal = stripVar(InternalVars.scrollbarWidthHorizontal);
|
|
4361
|
+
var scrollbarWidthVertical = stripVar(InternalVars.scrollbarWidthVertical);
|
|
4276
4362
|
var columnWidthAtIndex2 = stripVar(InternalVars.columnWidthAtIndex);
|
|
4277
4363
|
var columnOffsetAtIndex3 = stripVar(InternalVars.columnOffsetAtIndex);
|
|
4278
4364
|
var columnZIndexAtIndex3 = stripVar(InternalVars.columnZIndexAtIndex);
|
|
4365
|
+
var scrollLeftCSSVar = stripVar(InternalVars.scrollLeft);
|
|
4279
4366
|
var activeCellColWidth = stripVar(InternalVars.activeCellColWidth);
|
|
4280
4367
|
var activeCellColOffset = stripVar(InternalVars.activeCellColOffset);
|
|
4281
4368
|
var baseZIndexForCells = stripVar(InternalVars.baseZIndexForCells);
|
|
4369
|
+
var pinnedStartWidthCSSVar = stripVar(InternalVars.pinnedStartWidth);
|
|
4370
|
+
var pinnedStartDraggingWidthCSSVar = stripVar(InternalVars.pinnedStartDraggingWidth);
|
|
4371
|
+
var bodyWidthCSSVar = stripVar(InternalVars.bodyWidth);
|
|
4372
|
+
var bodyHeightCSSVar = stripVar(InternalVars.bodyHeight);
|
|
4373
|
+
var pinnedEndOffsetCSSVar = stripVar(InternalVars.pinnedEndOffset);
|
|
4374
|
+
var pinnedEndWidthCSSVar = stripVar(InternalVars.pinnedEndWidth);
|
|
4375
|
+
var pinnedEndDraggingWidthCSSVar = stripVar(InternalVars.pinnedEndDraggingWidth);
|
|
4282
4376
|
var computedVisibleColumnsCountCSSVar = stripVar(InternalVars.computedVisibleColumnsCount);
|
|
4283
4377
|
function getColumnZIndex(col, params) {
|
|
4284
4378
|
let computedZIndex = "auto";
|
|
@@ -4287,7 +4381,7 @@ function getColumnZIndex(col, params) {
|
|
|
4287
4381
|
if (col.computedPinned === "start") {
|
|
4288
4382
|
computedZIndex = params.pinnedStartColsCount - col.computedVisibleIndexInCategory;
|
|
4289
4383
|
} else if (col.computedPinned === "end") {
|
|
4290
|
-
computedZIndex = params.visibleColsCount
|
|
4384
|
+
computedZIndex = params.visibleColsCount + col.computedVisibleIndexInCategory;
|
|
4291
4385
|
}
|
|
4292
4386
|
} else {
|
|
4293
4387
|
computedZIndex = -index * 10;
|
|
@@ -4296,6 +4390,7 @@ function getColumnZIndex(col, params) {
|
|
|
4296
4390
|
return zIndexValue;
|
|
4297
4391
|
}
|
|
4298
4392
|
function useDOMProps(initialDOMProps) {
|
|
4393
|
+
const scrollbarWidth2 = getScrollbarWidth();
|
|
4299
4394
|
const { computed, componentState, componentActions } = useInfiniteTable();
|
|
4300
4395
|
const {
|
|
4301
4396
|
focused,
|
|
@@ -4305,23 +4400,30 @@ function useDOMProps(initialDOMProps) {
|
|
|
4305
4400
|
onFocusWithin,
|
|
4306
4401
|
onSelfFocus,
|
|
4307
4402
|
onSelfBlur,
|
|
4403
|
+
bodySize,
|
|
4308
4404
|
activeCellIndex
|
|
4309
4405
|
} = componentState;
|
|
4310
4406
|
const {
|
|
4311
4407
|
computedPinnedStartColumnsWidth,
|
|
4312
4408
|
computedPinnedEndColumnsWidth,
|
|
4313
4409
|
computedPinnedStartColumns,
|
|
4314
|
-
|
|
4410
|
+
computedPinnedEndColumns,
|
|
4411
|
+
computedVisibleColumns,
|
|
4412
|
+
scrollbars
|
|
4315
4413
|
} = computed;
|
|
4414
|
+
const prevPinnedEndCols = [];
|
|
4316
4415
|
const cssVars = computedVisibleColumns.reduce((vars, col) => {
|
|
4317
4416
|
const index = col.computedVisibleIndex;
|
|
4318
4417
|
vars[`${columnWidthAtIndex2}-${index}`] = col.computedWidth + "px";
|
|
4319
|
-
vars[`${columnOffsetAtIndex3}-${index}`] = col.computedOffset + "px
|
|
4418
|
+
vars[`${columnOffsetAtIndex3}-${index}`] = col.computedPinned === "start" ? `calc( ${col.computedOffset}px + var(${scrollLeftCSSVar}) )` : col.computedPinned === "end" ? `calc( var(${pinnedEndOffsetCSSVar}) ${prevPinnedEndCols.length ? "+" : ""} ${prevPinnedEndCols.map((c) => `var(${columnWidthAtIndex2}-${c.computedVisibleIndex})`).join(" + ")} + var(${scrollLeftCSSVar}) )` : `${col.computedOffset}px`;
|
|
4320
4419
|
const zIndexValue = getColumnZIndex(col, {
|
|
4321
4420
|
pinnedStartColsCount: computedPinnedStartColumns.length,
|
|
4322
4421
|
visibleColsCount: computedVisibleColumns.length
|
|
4323
4422
|
});
|
|
4324
4423
|
vars[`${columnZIndexAtIndex3}-${index}`] = `${zIndexValue}`;
|
|
4424
|
+
if (col.computedPinned === "end") {
|
|
4425
|
+
prevPinnedEndCols.push(col);
|
|
4426
|
+
}
|
|
4325
4427
|
return vars;
|
|
4326
4428
|
}, {});
|
|
4327
4429
|
if (activeCellIndex != null) {
|
|
@@ -4329,7 +4431,14 @@ function useDOMProps(initialDOMProps) {
|
|
|
4329
4431
|
cssVars[activeCellColOffset] = `var(${getCSSVarNameForColOffset(activeCellIndex[1])})`;
|
|
4330
4432
|
}
|
|
4331
4433
|
cssVars[computedVisibleColumnsCountCSSVar] = computedVisibleColumns.length;
|
|
4434
|
+
cssVars[scrollbarWidthHorizontal] = scrollbars.horizontal ? `${scrollbarWidth2}px` : "0px";
|
|
4435
|
+
cssVars[scrollbarWidthVertical] = scrollbars.vertical ? `${scrollbarWidth2}px` : "0px";
|
|
4436
|
+
cssVars[pinnedStartWidthCSSVar] = `calc( ` + computedPinnedStartColumns.map((c) => `var(${getCSSVarNameForColWidth(c.computedVisibleIndex)})`).join(" + ") + ` - var(${pinnedStartDraggingWidthCSSVar}, 0px) )`;
|
|
4437
|
+
cssVars[pinnedEndWidthCSSVar] = `calc( ` + computedPinnedEndColumns.map((c) => `var(${getCSSVarNameForColWidth(c.computedVisibleIndex)})`).join(" + ") + ` - var(${pinnedEndDraggingWidthCSSVar}, 0px) )`;
|
|
4332
4438
|
cssVars[baseZIndexForCells] = computedVisibleColumns.length * 10;
|
|
4439
|
+
cssVars[pinnedEndOffsetCSSVar] = `calc( var(${bodyWidthCSSVar}) - var(${pinnedEndWidthCSSVar}) - var(${scrollbarWidthVertical}) )`;
|
|
4440
|
+
cssVars[bodyWidthCSSVar] = `${bodySize.width}px`;
|
|
4441
|
+
cssVars[bodyHeightCSSVar] = `${bodySize.height}px`;
|
|
4333
4442
|
const setFocused = rafFn((focused2) => {
|
|
4334
4443
|
componentActions.focused = focused2;
|
|
4335
4444
|
});
|
|
@@ -4377,7 +4486,7 @@ function useDOMProps(initialDOMProps) {
|
|
|
4377
4486
|
onFocus,
|
|
4378
4487
|
onBlur
|
|
4379
4488
|
});
|
|
4380
|
-
const className = join(InfiniteTableClassName, InfiniteCls, domProps == null ? void 0 : domProps.className, computedPinnedStartColumnsWidth ? `${InfiniteTableClassName}--has-pinned-start` : null, computedPinnedEndColumnsWidth ? `${InfiniteTableClassName}--has-pinned-end` : null, focused ? `${InfiniteTableClassName}--focused` : null, focusedWithin ? `${InfiniteTableClassName}--focused-within` : null, focused && componentState.focusedClassName ? componentState.focusedClassName : null, focusedWithin && componentState.focusedWithinClassName ? componentState.focusedWithinClassName : null, computed.computedPinnedStartOverflow ? `${InfiniteTableClassName}--has-pinned-start-overflow` : null, computed.computedPinnedEndOverflow ? `${InfiniteTableClassName}--has-pinned-end-overflow` : null, InfiniteClsRecipe({
|
|
4489
|
+
const className = join(InfiniteTableClassName, InfiniteCls, domProps == null ? void 0 : domProps.className, computedPinnedStartColumnsWidth ? `${InfiniteTableClassName}--has-pinned-start ${InfiniteClsHasPinnedStart}` : null, computedPinnedEndColumnsWidth ? `${InfiniteTableClassName}--has-pinned-end ${InfiniteClsHasPinnedEnd}` : null, focused ? `${InfiniteTableClassName}--focused` : null, focusedWithin ? `${InfiniteTableClassName}--focused-within` : null, focused && componentState.focusedClassName ? componentState.focusedClassName : null, focusedWithin && componentState.focusedWithinClassName ? componentState.focusedWithinClassName : null, computed.computedPinnedStartOverflow ? `${InfiniteTableClassName}--has-pinned-start-overflow` : null, computed.computedPinnedEndOverflow ? `${InfiniteTableClassName}--has-pinned-end-overflow` : null, InfiniteClsRecipe({
|
|
4381
4490
|
hasPinnedStart: !!computedPinnedStartColumnsWidth,
|
|
4382
4491
|
hasPinnedEnd: !!computedPinnedEndColumnsWidth,
|
|
4383
4492
|
focused,
|
|
@@ -4398,64 +4507,169 @@ function useDOMProps(initialDOMProps) {
|
|
|
4398
4507
|
return domProps;
|
|
4399
4508
|
}
|
|
4400
4509
|
|
|
4510
|
+
// src/components/InfiniteTable/utils/progressiveSpeedScroller.ts
|
|
4511
|
+
var progressiveSpeedScroller = (staticOptions) => {
|
|
4512
|
+
let scrollLeftRafId = null;
|
|
4513
|
+
let scrollRightRafId = null;
|
|
4514
|
+
return {
|
|
4515
|
+
stop() {
|
|
4516
|
+
if (scrollLeftRafId !== null) {
|
|
4517
|
+
cancelRaf(scrollLeftRafId);
|
|
4518
|
+
}
|
|
4519
|
+
if (scrollRightRafId != null) {
|
|
4520
|
+
cancelRaf(scrollRightRafId);
|
|
4521
|
+
}
|
|
4522
|
+
},
|
|
4523
|
+
scroll(dynamicOptions) {
|
|
4524
|
+
if (scrollLeftRafId !== null) {
|
|
4525
|
+
cancelRaf(scrollLeftRafId);
|
|
4526
|
+
}
|
|
4527
|
+
if (scrollRightRafId != null) {
|
|
4528
|
+
cancelRaf(scrollRightRafId);
|
|
4529
|
+
}
|
|
4530
|
+
const opts = __spreadValues(__spreadValues({
|
|
4531
|
+
offset: 100,
|
|
4532
|
+
scrollAmountsPerRaf: [1, 1, 2, 4, 6, 8, 11, 15]
|
|
4533
|
+
}, staticOptions), dynamicOptions);
|
|
4534
|
+
const self = this;
|
|
4535
|
+
function scrollLeft2() {
|
|
4536
|
+
const marginDistance = opts.scrollOffsetStart + opts.offset - opts.mousePosition.clientX;
|
|
4537
|
+
const shouldScrollLeft = marginDistance > 0 && marginDistance <= opts.offset;
|
|
4538
|
+
if (!shouldScrollLeft) {
|
|
4539
|
+
return false;
|
|
4540
|
+
}
|
|
4541
|
+
const segmentCount = opts.scrollAmountsPerRaf.length;
|
|
4542
|
+
const segmentDistance = Math.round(opts.offset / segmentCount);
|
|
4543
|
+
let speed = 0;
|
|
4544
|
+
for (let i = 0; i < segmentCount; i++) {
|
|
4545
|
+
if (marginDistance > (i + 1) * segmentDistance) {
|
|
4546
|
+
speed = opts.scrollAmountsPerRaf[i];
|
|
4547
|
+
}
|
|
4548
|
+
}
|
|
4549
|
+
dynamicOptions.scrollLeft = dynamicOptions.scrollLeft - speed;
|
|
4550
|
+
scrollLeftRafId = raf(() => {
|
|
4551
|
+
self.scroll(dynamicOptions);
|
|
4552
|
+
});
|
|
4553
|
+
return true;
|
|
4554
|
+
}
|
|
4555
|
+
function scrollRight() {
|
|
4556
|
+
const marginDistance = opts.mousePosition.clientX - (opts.scrollOffsetEnd - opts.offset);
|
|
4557
|
+
const shouldScrollRight = marginDistance > 0 && marginDistance <= opts.offset;
|
|
4558
|
+
if (!shouldScrollRight) {
|
|
4559
|
+
return false;
|
|
4560
|
+
}
|
|
4561
|
+
const segmentCount = opts.scrollAmountsPerRaf.length;
|
|
4562
|
+
const segmentDistance = Math.round(opts.offset / segmentCount);
|
|
4563
|
+
let speed = 0;
|
|
4564
|
+
for (let i = 0; i < segmentCount; i++) {
|
|
4565
|
+
if (marginDistance > (i + 1) * segmentDistance) {
|
|
4566
|
+
speed = opts.scrollAmountsPerRaf[i];
|
|
4567
|
+
}
|
|
4568
|
+
}
|
|
4569
|
+
dynamicOptions.scrollLeft = dynamicOptions.scrollLeft + speed;
|
|
4570
|
+
scrollRightRafId = raf(() => {
|
|
4571
|
+
self.scroll(dynamicOptions);
|
|
4572
|
+
});
|
|
4573
|
+
return true;
|
|
4574
|
+
}
|
|
4575
|
+
if (scrollLeft2()) {
|
|
4576
|
+
return true;
|
|
4577
|
+
}
|
|
4578
|
+
if (scrollRight()) {
|
|
4579
|
+
return true;
|
|
4580
|
+
}
|
|
4581
|
+
return false;
|
|
4582
|
+
}
|
|
4583
|
+
};
|
|
4584
|
+
};
|
|
4585
|
+
|
|
4401
4586
|
// src/components/InfiniteTable/hooks/useColumnPointerEvents.ts
|
|
4402
4587
|
var columnOffsetAtIndex4 = stripVar(InternalVars.columnOffsetAtIndex);
|
|
4403
4588
|
var columnWidthAtIndex3 = stripVar(InternalVars.columnWidthAtIndex);
|
|
4589
|
+
var baseZIndexForCells2 = stripVar(InternalVars.baseZIndexForCells);
|
|
4404
4590
|
var PROXY_OFFSET = 10;
|
|
4405
4591
|
var getBreakPoints = (columns) => {
|
|
4406
|
-
return
|
|
4592
|
+
return columns.map((c) => {
|
|
4407
4593
|
return {
|
|
4408
4594
|
columnId: c.id,
|
|
4409
|
-
|
|
4595
|
+
index: c.computedVisibleIndex,
|
|
4596
|
+
breakpoint: c.computedOffset + Math.round(c.computedWidth / 2)
|
|
4410
4597
|
};
|
|
4411
4598
|
}).filter(Boolean);
|
|
4412
4599
|
};
|
|
4413
4600
|
var useColumnPointerEvents = ({
|
|
4414
4601
|
columnId,
|
|
4415
|
-
domRef
|
|
4416
|
-
columns,
|
|
4417
|
-
computedRemainingSpace,
|
|
4418
|
-
pinnedStartColsCount,
|
|
4419
|
-
visibleColsCount
|
|
4602
|
+
domRef
|
|
4420
4603
|
}) => {
|
|
4604
|
+
var _a;
|
|
4421
4605
|
const [proxyPosition, setProxyPosition] = useState5(null);
|
|
4422
|
-
const dragging = proxyPosition != null;
|
|
4423
4606
|
const {
|
|
4424
4607
|
componentActions,
|
|
4425
4608
|
computed,
|
|
4426
|
-
|
|
4609
|
+
getComputed,
|
|
4610
|
+
imperativeApi,
|
|
4611
|
+
componentState: { domRef: rootRef, brain, headerBrain }
|
|
4427
4612
|
} = useInfiniteTable();
|
|
4428
|
-
const { computedColumnOrder } = computed;
|
|
4429
|
-
const column = useMemo4(() => columns.get(columnId), [columnId, columns]);
|
|
4430
|
-
const { dragColumnIndex, columnsArray } = useMemo4(() => {
|
|
4431
|
-
const columnsArray2 = Array.from(columns.values());
|
|
4432
|
-
const columnIndex = columnsArray2.findIndex((c) => c.id === columnId);
|
|
4433
|
-
return {
|
|
4434
|
-
columnsArray: columnsArray2,
|
|
4435
|
-
dragColumnIndex: columnIndex,
|
|
4436
|
-
columnWidth: column.computedWidth,
|
|
4437
|
-
columnOffsetVar: `var(${columnOffsetAtIndex4}-${column.computedVisibleIndex})`
|
|
4438
|
-
};
|
|
4439
|
-
}, [columns, columnId, column]);
|
|
4440
4613
|
const onPointerDown = useCallback6((e) => {
|
|
4441
|
-
var
|
|
4442
|
-
|
|
4614
|
+
var _a2;
|
|
4615
|
+
const {
|
|
4616
|
+
computedVisibleColumns,
|
|
4617
|
+
computedVisibleColumnsMap,
|
|
4618
|
+
computedPinnedStartColumns
|
|
4619
|
+
} = getComputed();
|
|
4620
|
+
const dragColumn = computedVisibleColumnsMap.get(columnId);
|
|
4621
|
+
const initialBreakpoints = getBreakPoints(computedVisibleColumns);
|
|
4443
4622
|
const target = domRef.current;
|
|
4623
|
+
const targetRect = target.getBoundingClientRect();
|
|
4624
|
+
const tableRect = rootRef.current.getBoundingClientRect();
|
|
4625
|
+
const initialAvailableSize = brain.getAvailableSize();
|
|
4626
|
+
const dragColumnIndex = dragColumn.computedVisibleIndex;
|
|
4627
|
+
let currentColumnIndexes = computedVisibleColumns.map((c) => c.computedVisibleIndex);
|
|
4628
|
+
const initialColumnIndexes = currentColumnIndexes;
|
|
4629
|
+
const pinnedStartCurrentWidth = brain.getFixedStartColsWidth() - (dragColumn.computedPinned === "start" ? dragColumn.computedWidth : 0);
|
|
4630
|
+
const pinnedStartColsRight = tableRect.left + pinnedStartCurrentWidth;
|
|
4631
|
+
const pinnedEndCurrentWidth = brain.getFixedEndColsWidth() - (dragColumn.computedPinned === "end" ? dragColumn.computedWidth : 0);
|
|
4632
|
+
const pinnedEndColsLeft = tableRect.right - pinnedEndCurrentWidth;
|
|
4633
|
+
const speedScroller = progressiveSpeedScroller({
|
|
4634
|
+
scrollOffsetStart: pinnedStartColsRight,
|
|
4635
|
+
scrollOffsetEnd: pinnedEndColsLeft
|
|
4636
|
+
});
|
|
4637
|
+
const isColumnVisible2 = (columnIndex, { scrollLeft: scrollLeft2 }) => {
|
|
4638
|
+
if (columnIndex === dragColumnIndex) {
|
|
4639
|
+
return true;
|
|
4640
|
+
}
|
|
4641
|
+
const col = computedVisibleColumns[columnIndex];
|
|
4642
|
+
if (col.computedPinned) {
|
|
4643
|
+
return true;
|
|
4644
|
+
}
|
|
4645
|
+
return col.computedOffset >= scrollLeft2 + pinnedStartCurrentWidth && col.computedOffset + col.computedWidth < scrollLeft2 + tableRect.width - pinnedEndCurrentWidth;
|
|
4646
|
+
};
|
|
4444
4647
|
const initialClientPos = {
|
|
4445
4648
|
clientX: Math.round(e.clientX),
|
|
4446
4649
|
clientY: Math.round(e.clientY)
|
|
4447
4650
|
};
|
|
4651
|
+
let currentScrollPosition = {
|
|
4652
|
+
scrollLeft: 0,
|
|
4653
|
+
scrollTop: 0
|
|
4654
|
+
};
|
|
4448
4655
|
const initialScrollPosition2 = brain.getScrollPosition();
|
|
4656
|
+
const updateScrollPosition = (scrollPosition) => {
|
|
4657
|
+
currentScrollPosition = scrollPosition;
|
|
4658
|
+
};
|
|
4659
|
+
updateScrollPosition(initialScrollPosition2);
|
|
4660
|
+
const removeOnScroll = brain.onScroll((scrollPosition) => {
|
|
4661
|
+
currentScrollPosition = scrollPosition;
|
|
4662
|
+
});
|
|
4449
4663
|
const initialProxyPosition = {
|
|
4450
|
-
left:
|
|
4451
|
-
top: PROXY_OFFSET
|
|
4664
|
+
left: initialClientPos.clientX - tableRect.left - (initialClientPos.clientX - targetRect.left) + PROXY_OFFSET,
|
|
4665
|
+
top: initialClientPos.clientY - tableRect.top - (initialClientPos.clientY - targetRect.top) + PROXY_OFFSET
|
|
4452
4666
|
};
|
|
4453
4667
|
let currentClientPos = initialClientPos;
|
|
4454
4668
|
let currentDiff = {
|
|
4455
4669
|
x: 0,
|
|
4456
4670
|
y: 0
|
|
4457
4671
|
};
|
|
4458
|
-
function
|
|
4672
|
+
function updateProxyPosition(pos) {
|
|
4459
4673
|
const clientX = Math.round(pos.clientX);
|
|
4460
4674
|
const clientY = Math.round(pos.clientY);
|
|
4461
4675
|
if (clientX === currentClientPos.clientX && clientY === currentClientPos.clientY) {
|
|
@@ -4469,96 +4683,134 @@ var useColumnPointerEvents = ({
|
|
|
4469
4683
|
top: initialProxyPosition.top + currentDiff.y
|
|
4470
4684
|
});
|
|
4471
4685
|
}
|
|
4472
|
-
|
|
4473
|
-
let initialCursor = (
|
|
4686
|
+
updateProxyPosition(initialClientPos);
|
|
4687
|
+
let initialCursor = (_a2 = target.style.cursor) != null ? _a2 : "auto";
|
|
4474
4688
|
let didDragAtLeastOnce = false;
|
|
4475
4689
|
let currentDropIndex = dragColumnIndex;
|
|
4476
4690
|
const onPointerMove = (e2) => {
|
|
4477
|
-
var
|
|
4691
|
+
var _a3;
|
|
4478
4692
|
if (!didDragAtLeastOnce) {
|
|
4479
4693
|
didDragAtLeastOnce = true;
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4694
|
+
brain.setRenderCount({
|
|
4695
|
+
horizontal: computedVisibleColumns.length,
|
|
4696
|
+
vertical: void 0
|
|
4697
|
+
});
|
|
4698
|
+
headerBrain.setRenderCount({
|
|
4699
|
+
horizontal: computedVisibleColumns.length,
|
|
4700
|
+
vertical: void 0
|
|
4701
|
+
});
|
|
4702
|
+
componentActions.columnReorderDragColumnId = dragColumn.id;
|
|
4703
|
+
setInfiniteColumnZIndex(dragColumnIndex, `calc( var(${baseZIndexForCells2}) + 10000 )`, rootRef.current);
|
|
4704
|
+
(_a3 = rootRef.current) == null ? void 0 : _a3.classList.add(InfiniteClsShiftingColumns);
|
|
4484
4705
|
target.style.cursor = "grabbing";
|
|
4485
4706
|
}
|
|
4486
|
-
|
|
4487
|
-
const
|
|
4707
|
+
updateProxyPosition(e2);
|
|
4708
|
+
const scrollLeft2 = currentScrollPosition.scrollLeft;
|
|
4709
|
+
const scrollLeftDiff = scrollLeft2 - initialScrollPosition2.scrollLeft;
|
|
4710
|
+
let diffX = currentDiff.x + scrollLeftDiff;
|
|
4488
4711
|
const dir = diffX < 0 ? -1 : 1;
|
|
4489
|
-
let currentPos = dir === -1 ?
|
|
4712
|
+
let currentPos = dir === -1 ? dragColumn.computedOffset + diffX : dragColumn.computedOffset + dragColumn.computedWidth + diffX;
|
|
4713
|
+
speedScroller.scroll({
|
|
4714
|
+
mousePosition: currentClientPos,
|
|
4715
|
+
get scrollLeft() {
|
|
4716
|
+
return brain.getScrollPosition().scrollLeft;
|
|
4717
|
+
},
|
|
4718
|
+
set scrollLeft(value) {
|
|
4719
|
+
imperativeApi.scrollLeft = value;
|
|
4720
|
+
}
|
|
4721
|
+
});
|
|
4722
|
+
const breakpoints = initialBreakpoints.filter((b) => isColumnVisible2(b.index, {
|
|
4723
|
+
scrollLeft: currentScrollPosition.scrollLeft
|
|
4724
|
+
})).map((b) => {
|
|
4725
|
+
return __spreadProps(__spreadValues({}, b), { breakpoint: b.breakpoint - scrollLeft2 });
|
|
4726
|
+
});
|
|
4490
4727
|
let idx = (0, import_binary_search2.default)(breakpoints, currentPos, ({ breakpoint }, value) => {
|
|
4491
4728
|
return breakpoint < value ? -1 : breakpoint > value ? 1 : 0;
|
|
4492
4729
|
});
|
|
4493
4730
|
if (idx < 0) {
|
|
4494
4731
|
idx = ~idx;
|
|
4732
|
+
console.log("found breakpoint", breakpoints[idx], "at index", idx, "for currentPos", currentPos, JSON.parse(JSON.stringify(breakpoints)));
|
|
4495
4733
|
}
|
|
4496
|
-
|
|
4734
|
+
idx = breakpoints[idx] ? breakpoints[idx].index : breakpoints[breakpoints.length - 1].index + 1;
|
|
4735
|
+
if (idx != null && idx !== currentDropIndex) {
|
|
4497
4736
|
currentDropIndex = idx;
|
|
4498
4737
|
if (dir === 1 && currentDropIndex === dragColumnIndex + 1) {
|
|
4499
4738
|
currentDropIndex = dragColumnIndex;
|
|
4500
4739
|
}
|
|
4501
|
-
|
|
4740
|
+
const newColumnIndexes = moveXatY(initialColumnIndexes, dragColumnIndex, currentDropIndex > dragColumnIndex ? currentDropIndex - 1 : currentDropIndex);
|
|
4741
|
+
const indexesWithTransition = new Set();
|
|
4742
|
+
newColumnIndexes.forEach((newIndex, i) => {
|
|
4743
|
+
const currentIndex = currentColumnIndexes[i];
|
|
4744
|
+
if (newIndex !== currentIndex) {
|
|
4745
|
+
indexesWithTransition.add(newIndex);
|
|
4746
|
+
}
|
|
4747
|
+
});
|
|
4748
|
+
console.log(JSON.stringify(currentColumnIndexes));
|
|
4749
|
+
console.log(JSON.stringify(newColumnIndexes));
|
|
4750
|
+
console.log("switched", indexesWithTransition);
|
|
4751
|
+
console.log("----");
|
|
4752
|
+
currentColumnIndexes = newColumnIndexes;
|
|
4753
|
+
computedVisibleColumns.forEach((col) => {
|
|
4502
4754
|
const colIndex = col.computedVisibleIndex;
|
|
4503
|
-
if (
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4755
|
+
if (indexesWithTransition.has(colIndex)) {
|
|
4756
|
+
restoreInfiniteColumnReorderDuration(colIndex, rootRef.current);
|
|
4757
|
+
} else {
|
|
4758
|
+
clearInfiniteColumnReorderDuration(colIndex, rootRef.current);
|
|
4507
4759
|
}
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4760
|
+
const isDragColumn = colIndex === dragColumnIndex;
|
|
4761
|
+
let isOutsideCol = dir === -1 ? colIndex < currentDropIndex || colIndex > dragColumnIndex : colIndex < dragColumnIndex || colIndex >= currentDropIndex;
|
|
4762
|
+
let newPosition = "";
|
|
4763
|
+
if (dir === -1) {
|
|
4764
|
+
newPosition = isDragColumn ? `var(${columnOffsetAtIndex4}-${currentDropIndex})` : isOutsideCol ? `var(${columnOffsetAtIndex4}-${colIndex})` : `calc( var(${columnOffsetAtIndex4}-${colIndex}) + var(${columnWidthAtIndex3}-${dragColumnIndex}) )`;
|
|
4765
|
+
} else {
|
|
4766
|
+
newPosition = isOutsideCol ? `var(${columnOffsetAtIndex4}-${colIndex})` : isDragColumn ? `calc( var(${columnOffsetAtIndex4}-${currentDropIndex - 1}) + var(${columnWidthAtIndex3}-${currentDropIndex - 1}) - var(${columnWidthAtIndex3}-${dragColumnIndex}) )` : `calc( var(${columnOffsetAtIndex4}-${colIndex}) - var(${columnWidthAtIndex3}-${dragColumnIndex}) )`;
|
|
4512
4767
|
}
|
|
4768
|
+
setInfiniteColumnOffsetWhileReordering(colIndex, newPosition, rootRef.current);
|
|
4513
4769
|
});
|
|
4514
4770
|
}
|
|
4515
4771
|
};
|
|
4772
|
+
function persistColumnOrder() {
|
|
4773
|
+
if (currentDropIndex != null && currentDropIndex !== dragColumnIndex) {
|
|
4774
|
+
const newOrder = moveXatY(getComputed().computedColumnOrder, dragColumnIndex, currentDropIndex > dragColumnIndex ? currentDropIndex - 1 : currentDropIndex);
|
|
4775
|
+
computedVisibleColumns.forEach((col) => {
|
|
4776
|
+
setInfiniteColumnOffsetWhileReordering(col.computedVisibleIndex, "", rootRef.current);
|
|
4777
|
+
});
|
|
4778
|
+
componentActions.columnOrder = newOrder;
|
|
4779
|
+
}
|
|
4780
|
+
}
|
|
4516
4781
|
const onPointerUp = (e2) => {
|
|
4517
|
-
var
|
|
4782
|
+
var _a3;
|
|
4518
4783
|
const target2 = domRef.current;
|
|
4519
|
-
(
|
|
4520
|
-
|
|
4784
|
+
(_a3 = rootRef.current) == null ? void 0 : _a3.classList.remove(InfiniteClsShiftingColumns);
|
|
4785
|
+
removeOnScroll();
|
|
4786
|
+
speedScroller.stop();
|
|
4787
|
+
brain.setAvailableSize(__spreadValues({}, initialAvailableSize));
|
|
4788
|
+
computedVisibleColumns.forEach((col) => {
|
|
4789
|
+
clearInfiniteColumnReorderDuration(col.computedVisibleIndex, rootRef.current);
|
|
4521
4790
|
setInfiniteColumnOffsetWhileReordering(col.computedVisibleIndex, "", rootRef.current);
|
|
4522
4791
|
});
|
|
4523
|
-
setInfiniteColumnZIndex(dragColumnIndex, getColumnZIndex(
|
|
4524
|
-
pinnedStartColsCount,
|
|
4525
|
-
visibleColsCount
|
|
4792
|
+
setInfiniteColumnZIndex(dragColumnIndex, getColumnZIndex(dragColumn, {
|
|
4793
|
+
pinnedStartColsCount: computedPinnedStartColumns.length,
|
|
4794
|
+
visibleColsCount: computedVisibleColumns.length
|
|
4526
4795
|
}), rootRef.current);
|
|
4527
4796
|
target2.style.cursor = initialCursor;
|
|
4528
4797
|
target2.releasePointerCapture(e2.pointerId);
|
|
4529
4798
|
target2.removeEventListener("pointermove", onPointerMove);
|
|
4530
4799
|
target2.removeEventListener("pointerup", onPointerUp);
|
|
4531
4800
|
setProxyPosition(null);
|
|
4532
|
-
if (!didDragAtLeastOnce &&
|
|
4533
|
-
|
|
4801
|
+
if (!didDragAtLeastOnce && dragColumn.computedSortable) {
|
|
4802
|
+
dragColumn.toggleSort();
|
|
4534
4803
|
}
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
columnsArray.forEach((col) => {
|
|
4538
|
-
setInfiniteColumnOffsetWhileReordering(col.computedVisibleIndex, "", rootRef.current);
|
|
4539
|
-
});
|
|
4540
|
-
componentActions.columnOrder = newOrder;
|
|
4541
|
-
}
|
|
4542
|
-
componentActions.columnReorderInProgress = false;
|
|
4543
|
-
breakpoints = [];
|
|
4804
|
+
persistColumnOrder();
|
|
4805
|
+
componentActions.columnReorderDragColumnId = false;
|
|
4544
4806
|
};
|
|
4545
4807
|
target.addEventListener("pointermove", onPointerMove);
|
|
4546
4808
|
target.addEventListener("pointerup", onPointerUp);
|
|
4547
4809
|
target.setPointerCapture(e.pointerId);
|
|
4548
|
-
}, [
|
|
4549
|
-
columns,
|
|
4550
|
-
column,
|
|
4551
|
-
dragColumnIndex,
|
|
4552
|
-
visibleColsCount,
|
|
4553
|
-
pinnedStartColsCount,
|
|
4554
|
-
columnsArray,
|
|
4555
|
-
computedRemainingSpace,
|
|
4556
|
-
computedColumnOrder
|
|
4557
|
-
]);
|
|
4810
|
+
}, [columnId]);
|
|
4558
4811
|
return {
|
|
4559
|
-
onPointerDown:
|
|
4812
|
+
onPointerDown: ((_a = computed.computedVisibleColumnsMap.get(columnId)) == null ? void 0 : _a.computedDraggable) ? onPointerDown : () => {
|
|
4560
4813
|
},
|
|
4561
|
-
dragging,
|
|
4562
4814
|
proxyPosition
|
|
4563
4815
|
};
|
|
4564
4816
|
};
|
|
@@ -4613,19 +4865,19 @@ import { useEffect as useEffect9, useState as useState6 } from "react";
|
|
|
4613
4865
|
|
|
4614
4866
|
// src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts
|
|
4615
4867
|
var import_createRuntimeFn2 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
4616
|
-
var CellCls = "_1eexc2a5
|
|
4617
|
-
var HeaderCellContentRecipe = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "
|
|
4618
|
-
var HeaderCellProxy = "
|
|
4619
|
-
var HeaderCellRecipe = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "
|
|
4620
|
-
var HeaderClsRecipe = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "_12zfob16
|
|
4621
|
-
var HeaderFilterCls = "
|
|
4622
|
-
var HeaderFilterEditorCls = "
|
|
4623
|
-
var HeaderGroupCls = "
|
|
4868
|
+
var CellCls = "_1eexc2a5 _16lm1iwt _16lm1iw1d _16lm1iw1e _16lm1iw2 _16lm1iw1o _16lm1iw1p";
|
|
4869
|
+
var HeaderCellContentRecipe = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "_12zfob11b _16lm1iwz _16lm1iw11 _16lm1iwt _16lm1iw1d _16lm1iw1e", variantClassNames: { filtered: { false: "_12zfob11c", true: "_12zfob11d" } }, defaultVariants: {}, compoundVariants: [] });
|
|
4870
|
+
var HeaderCellProxy = "_12zfob1k _16lm1iw1p _16lm1iw1q _16lm1iw1j";
|
|
4871
|
+
var HeaderCellRecipe = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "_12zfob1l _16lm1iwv", variantClassNames: { rowActive: { false: "_12zfob1m", true: "_12zfob1n" }, zebra: { false: "_12zfob1o", even: "_12zfob1p", odd: "_12zfob1q" }, dragging: { true: "_12zfob1r", false: "_12zfob1s" }, first: { true: "_12zfob1t", false: "_12zfob1u" }, last: { true: "_12zfob1v", false: "_12zfob1w" }, groupByField: { true: "_12zfob1x", false: "_12zfob1y" }, firstInCategory: { true: "_12zfob1z", false: "_12zfob110" }, lastInCategory: { true: "_12zfob111", false: "_12zfob112" }, pinned: { start: "_12zfob113", end: "_12zfob114", false: "_12zfob115" }, filtered: { true: "_12zfob116", false: "_12zfob117" } }, defaultVariants: {}, compoundVariants: [[{ pinned: "start", lastInCategory: true }, "_12zfob118"], [{ pinned: "end", firstInCategory: true }, "_12zfob119"], [{ pinned: false, lastInCategory: true }, "_12zfob11a"]] });
|
|
4872
|
+
var HeaderClsRecipe = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "_12zfob16 _16lm1iwv _16lm1iw2", variantClassNames: { pinned: { start: "_12zfob17", end: "_12zfob18", false: "_12zfob19" }, firstInCategory: { true: "_12zfob1a", false: "_12zfob1b" }, lastInCategory: { true: "_12zfob1c", false: "_12zfob1d" }, overflow: { true: "_12zfob1e", false: "_12zfob1f" } }, defaultVariants: {}, compoundVariants: [[{ overflow: true, pinned: "start" }, "_12zfob1g"], [{ pinned: "start", firstInCategory: true }, "_12zfob1h"], [{ overflow: true, pinned: "end" }, "_12zfob1i"], [{ pinned: "end", lastInCategory: true }, "_12zfob1j"]] });
|
|
4873
|
+
var HeaderFilterCls = "_12zfob11g _16lm1iwt _16lm1iw1d _16lm1iw1e _16lm1iw1";
|
|
4874
|
+
var HeaderFilterEditorCls = "_16lm1iw11 _16lm1iwz";
|
|
4875
|
+
var HeaderGroupCls = "_12zfob11f _16lm1iwt _16lm1iw1d _16lm1iw1e";
|
|
4624
4876
|
var HeaderScrollbarPlaceholderCls = "_12zfob15 _16lm1iw2";
|
|
4625
4877
|
var HeaderSortIconCls = "_16lm1iw1";
|
|
4626
4878
|
var HeaderSortIconIndexCls = "_12zfob14";
|
|
4627
4879
|
var HeaderSortIconRecipe = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "", variantClassNames: { align: { start: "_12zfob11", center: "_12zfob12", end: "_12zfob13" } }, defaultVariants: {}, compoundVariants: [] });
|
|
4628
|
-
var HeaderWrapperCls = "
|
|
4880
|
+
var HeaderWrapperCls = "_12zfob11e _16lm1iw1j _16lm1iw1 _16lm1iwt _16lm1iw1d";
|
|
4629
4881
|
|
|
4630
4882
|
// src/components/InfiniteTable/components/icons/SortIcon.tsx
|
|
4631
4883
|
var defaultLineStyle = {
|
|
@@ -4707,14 +4959,15 @@ import {
|
|
|
4707
4959
|
|
|
4708
4960
|
// src/components/InfiniteTable/components/cell.css.ts
|
|
4709
4961
|
var import_createRuntimeFn3 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
4710
|
-
var ColumnCellCls = "_1eexc2a6 _1eexc2a5
|
|
4711
|
-
var ColumnCellRecipe = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "_1eexc2a7", variantClassNames: { dragging: { false: "_1eexc2a8", true: "_1eexc2a9" }, rowActive: { false: "_1eexc2aa", true: "_1eexc2ab" }, zebra: { false: "_1eexc2ac", even: "_1eexc2ad", odd: "_1eexc2ae" }, first: { true: "_1eexc2af", false: "_1eexc2ag" }, last: { true: "_1eexc2ah", false: "_1eexc2ai" }, groupByField: { true: "_1eexc2aj", false: "_1eexc2ak" }, firstInCategory: { true: "_1eexc2al", false: "_1eexc2am" }, lastInCategory: { true: "_1eexc2an", false: "_1eexc2ao" }, pinned: { start: "_1eexc2ap", end: "_1eexc2aq", false: "_1eexc2ar" }, filtered: { true: "_1eexc2as", false: "_1eexc2at" } }, defaultVariants: {}, compoundVariants: [[{ pinned: "start", lastInCategory: true }, "_1eexc2au"], [{ pinned: "
|
|
4962
|
+
var ColumnCellCls = "_1eexc2a6 _1eexc2a5 _16lm1iwt _16lm1iw1d _16lm1iw1e _16lm1iw2 _16lm1iw1o _16lm1iw1p";
|
|
4963
|
+
var ColumnCellRecipe = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "_1eexc2a7", variantClassNames: { dragging: { false: "_1eexc2a8", true: "_1eexc2a9" }, rowActive: { false: "_1eexc2aa", true: "_1eexc2ab" }, zebra: { false: "_1eexc2ac", even: "_1eexc2ad", odd: "_1eexc2ae" }, first: { true: "_1eexc2af", false: "_1eexc2ag" }, last: { true: "_1eexc2ah", false: "_1eexc2ai" }, groupByField: { true: "_1eexc2aj", false: "_1eexc2ak" }, firstInCategory: { true: "_1eexc2al", false: "_1eexc2am" }, lastInCategory: { true: "_1eexc2an", false: "_1eexc2ao" }, pinned: { start: "_1eexc2ap", end: "_1eexc2aq", false: "_1eexc2ar" }, filtered: { true: "_1eexc2as", false: "_1eexc2at" } }, defaultVariants: {}, compoundVariants: [[{ pinned: "start", lastInCategory: true }, "_1eexc2au"], [{ pinned: "start", firstInCategory: true }, "_1eexc2av"], [{ pinned: "end", firstInCategory: true }, "_1eexc2aw"], [{ pinned: "end", lastInCategory: true }, "_1eexc2ax"]] });
|
|
4712
4964
|
|
|
4713
4965
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
|
|
4714
4966
|
var { rootClassName: rootClassName5 } = internalProps;
|
|
4715
4967
|
var InfiniteTableCellClassName = `${rootClassName5}Cell`;
|
|
4716
4968
|
var InfiniteTableCellContentClassName = `${rootClassName5}Cell_content`;
|
|
4717
4969
|
var columnWidthAtIndex4 = stripVar(InternalVars.columnWidthAtIndex);
|
|
4970
|
+
var columnReorderEffectDurationAtIndex2 = stripVar(InternalVars.columnReorderEffectDurationAtIndex);
|
|
4718
4971
|
function InfiniteTableCellFn(props) {
|
|
4719
4972
|
var _b, _c, _d;
|
|
4720
4973
|
const _a = props, {
|
|
@@ -4748,7 +5001,8 @@ function InfiniteTableCellFn(props) {
|
|
|
4748
5001
|
]);
|
|
4749
5002
|
const children = renderChildren();
|
|
4750
5003
|
const style = __spreadValues({
|
|
4751
|
-
width: `var(${columnWidthAtIndex4}-${column.computedVisibleIndex})
|
|
5004
|
+
width: `var(${columnWidthAtIndex4}-${column.computedVisibleIndex})`,
|
|
5005
|
+
transition: `transform var(${columnReorderEffectDurationAtIndex2}-${column.computedVisibleIndex}, 0s)`
|
|
4752
5006
|
}, domProps.style);
|
|
4753
5007
|
const finalDOMProps = __spreadProps(__spreadValues({}, domProps), {
|
|
4754
5008
|
style,
|
|
@@ -5190,11 +5444,36 @@ function getColumnResizer(colIndex, {
|
|
|
5190
5444
|
return;
|
|
5191
5445
|
}
|
|
5192
5446
|
setInfiniteColumnWidth(nextColIndex, nextColumn.computedWidth - diff, domRef.current);
|
|
5193
|
-
|
|
5447
|
+
if (nextColumn.computedPinned === "start") {
|
|
5448
|
+
addToInfiniteColumnOffset(nextColumn, diff, domRef.current);
|
|
5449
|
+
} else {
|
|
5450
|
+
setInfiniteColumnOffset(nextColIndex, nextColumn.computedOffset + diff, domRef.current);
|
|
5451
|
+
}
|
|
5452
|
+
return;
|
|
5453
|
+
}
|
|
5454
|
+
if (column.computedPinned === "end") {
|
|
5455
|
+
return;
|
|
5456
|
+
}
|
|
5457
|
+
if (column.computedPinned === "start") {
|
|
5458
|
+
for (let i = nextColIndex, len = columns.length; i < len; i++) {
|
|
5459
|
+
const col = columns[i];
|
|
5460
|
+
if (col.computedPinned === "start") {
|
|
5461
|
+
addToInfiniteColumnOffset(col, diff, domRef.current);
|
|
5462
|
+
continue;
|
|
5463
|
+
}
|
|
5464
|
+
if (col.computedPinned === "end") {
|
|
5465
|
+
continue;
|
|
5466
|
+
}
|
|
5467
|
+
setInfiniteColumnOffset(i, col.computedOffset + diff, domRef.current);
|
|
5468
|
+
}
|
|
5194
5469
|
return;
|
|
5195
5470
|
}
|
|
5196
5471
|
for (let i = nextColIndex, len = columns.length; i < len; i++) {
|
|
5197
|
-
|
|
5472
|
+
const col = columns[i];
|
|
5473
|
+
if (col.computedPinned) {
|
|
5474
|
+
continue;
|
|
5475
|
+
}
|
|
5476
|
+
setInfiniteColumnOffset(i, col.computedOffset + diff, domRef.current);
|
|
5198
5477
|
}
|
|
5199
5478
|
}
|
|
5200
5479
|
};
|
|
@@ -5204,7 +5483,8 @@ function getColumnGroupResizer(colIndexes, config) {
|
|
|
5204
5483
|
return {
|
|
5205
5484
|
resize(diffs) {
|
|
5206
5485
|
const { columns, domRef } = config;
|
|
5207
|
-
|
|
5486
|
+
const firstCol = columns[colIndexes[0]];
|
|
5487
|
+
let offset = firstCol.computedOffset;
|
|
5208
5488
|
let diffSum = 0;
|
|
5209
5489
|
const node = domRef.current;
|
|
5210
5490
|
diffs.forEach((diff, i) => {
|
|
@@ -5213,13 +5493,23 @@ function getColumnGroupResizer(colIndexes, config) {
|
|
|
5213
5493
|
const column = columns[colIndex];
|
|
5214
5494
|
const newWidth = column.computedWidth + diff;
|
|
5215
5495
|
setInfiniteColumnWidth(colIndex, newWidth, node);
|
|
5496
|
+
if (column.computedPinned === "end") {
|
|
5497
|
+
return;
|
|
5498
|
+
}
|
|
5216
5499
|
if (offset) {
|
|
5217
5500
|
setInfiniteColumnOffset(colIndex, offset, node);
|
|
5218
5501
|
}
|
|
5219
5502
|
offset += newWidth;
|
|
5220
5503
|
});
|
|
5504
|
+
if (firstCol.computedPinned === "end") {
|
|
5505
|
+
return;
|
|
5506
|
+
}
|
|
5221
5507
|
for (let i = lastColIndex + 1; i < columns.length; i++) {
|
|
5222
|
-
|
|
5508
|
+
const col = columns[i];
|
|
5509
|
+
if (col.computedPinned === "end") {
|
|
5510
|
+
continue;
|
|
5511
|
+
}
|
|
5512
|
+
setInfiniteColumnOffset(i, col.computedOffset + diffSum, node);
|
|
5223
5513
|
}
|
|
5224
5514
|
}
|
|
5225
5515
|
};
|
|
@@ -5227,8 +5517,9 @@ function getColumnGroupResizer(colIndexes, config) {
|
|
|
5227
5517
|
|
|
5228
5518
|
// src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/ResizeHandle.css.ts
|
|
5229
5519
|
var import_createRuntimeFn4 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
5230
|
-
var ResizeHandleCls = "zneyzh0 _16lm1iw2
|
|
5231
|
-
var ResizeHandleDraggerClsRecipe = (0, import_createRuntimeFn4.createRuntimeFn)({ defaultClassName: "
|
|
5520
|
+
var ResizeHandleCls = "zneyzh0 _16lm1iw2 _16lm1iw12 _16lm1iw19 _16lm1iw17 _16lm1iwe _16lm1iw1j";
|
|
5521
|
+
var ResizeHandleDraggerClsRecipe = (0, import_createRuntimeFn4.createRuntimeFn)({ defaultClassName: "zneyzhb _16lm1iw2 _16lm1iw12 _16lm1iw17", variantClassNames: { constrained: { false: "zneyzhc", true: "zneyzhd" } }, defaultVariants: {}, compoundVariants: [] });
|
|
5522
|
+
var ResizeHandleRecipeCls = (0, import_createRuntimeFn4.createRuntimeFn)({ defaultClassName: "", variantClassNames: { computedPinned: { start: "zneyzh1", end: "zneyzh2 _16lm1iw14 _16lm1iw1b", false: "zneyzh3" }, computedFirstInCategory: { true: "zneyzh4", false: "zneyzh5" }, computedLastInCategory: { true: "zneyzh6", false: "zneyzh7" } }, defaultVariants: {}, compoundVariants: [[{ computedPinned: "end", computedLastInCategory: false, computedFirstInCategory: true }, "zneyzh8"], [{ computedPinned: false, computedFirstInCategory: false, computedLastInCategory: true }, "zneyzh9"], [{ computedPinned: "start", computedFirstInCategory: false, computedLastInCategory: true }, "zneyzha"]] });
|
|
5232
5523
|
|
|
5233
5524
|
// src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/index.tsx
|
|
5234
5525
|
var { rootClassName: rootClassName7 } = internalProps;
|
|
@@ -5238,6 +5529,13 @@ function ResizeHandleFn(props) {
|
|
|
5238
5529
|
const [constrained, setConstrained] = useState8(false);
|
|
5239
5530
|
const constrainedRef = useRef11(constrained);
|
|
5240
5531
|
constrainedRef.current = constrained;
|
|
5532
|
+
const col = props.columns[props.columnIndex];
|
|
5533
|
+
if (!col) {
|
|
5534
|
+
return null;
|
|
5535
|
+
}
|
|
5536
|
+
const computedPinned = col.computedPinned;
|
|
5537
|
+
const computedFirstInCategory = col.computedFirstInCategory;
|
|
5538
|
+
const computedLastInCategory = col.computedLastInCategory;
|
|
5241
5539
|
const onPointerDown = (e) => {
|
|
5242
5540
|
e.stopPropagation();
|
|
5243
5541
|
const shareSpaceOnResize = !!e.shiftKey;
|
|
@@ -5251,6 +5549,9 @@ function ResizeHandleFn(props) {
|
|
|
5251
5549
|
domRef
|
|
5252
5550
|
});
|
|
5253
5551
|
const resizeDiff = (diff) => {
|
|
5552
|
+
if (computedPinned === "end") {
|
|
5553
|
+
diff *= -1;
|
|
5554
|
+
}
|
|
5254
5555
|
const { adjustedDiff, constrained: constrained2 } = props.computeResize({
|
|
5255
5556
|
diff,
|
|
5256
5557
|
shareSpaceOnResize
|
|
@@ -5275,11 +5576,19 @@ function ResizeHandleFn(props) {
|
|
|
5275
5576
|
target.addEventListener("pointermove", onPointerMove);
|
|
5276
5577
|
target.addEventListener("pointerup", onPointerUp);
|
|
5277
5578
|
};
|
|
5579
|
+
const style = (computedPinned === false || computedPinned === "start") && computedLastInCategory ? {
|
|
5580
|
+
right: computedPinned === "start" ? 0 : 0
|
|
5581
|
+
} : computedPinned === "end" && computedFirstInCategory ? { right: "none", left: 0 } : void 0;
|
|
5278
5582
|
return /* @__PURE__ */ React20.createElement("div", {
|
|
5279
5583
|
ref: domRef,
|
|
5280
|
-
className: `${InfiniteTableHeaderCellResizeHandleCls} ${ResizeHandleCls}
|
|
5584
|
+
className: `${InfiniteTableHeaderCellResizeHandleCls} ${ResizeHandleCls} ${ResizeHandleRecipeCls({
|
|
5585
|
+
computedPinned,
|
|
5586
|
+
computedFirstInCategory,
|
|
5587
|
+
computedLastInCategory
|
|
5588
|
+
})}`,
|
|
5281
5589
|
onPointerDown
|
|
5282
5590
|
}, /* @__PURE__ */ React20.createElement("div", {
|
|
5591
|
+
style,
|
|
5283
5592
|
className: ResizeHandleDraggerClsRecipe({
|
|
5284
5593
|
constrained
|
|
5285
5594
|
})
|
|
@@ -5357,11 +5666,19 @@ var InfiniteTableHeaderCellContext = createContext4(null);
|
|
|
5357
5666
|
var { rootClassName: rootClassName8 } = internalProps;
|
|
5358
5667
|
var InfiniteTableHeaderCellClassName = `${rootClassName8}HeaderCell`;
|
|
5359
5668
|
var columnZIndexAtIndex4 = stripVar(InternalVars.columnZIndexAtIndex);
|
|
5360
|
-
var columnOffsetAtIndex5 = stripVar(InternalVars.columnOffsetAtIndex);
|
|
5361
5669
|
function InfiniteTableHeaderCell(props) {
|
|
5362
5670
|
var _a, _b, _c, _d, _e;
|
|
5363
5671
|
const column = props.column;
|
|
5364
|
-
const
|
|
5672
|
+
const {
|
|
5673
|
+
computed: { showColumnFilters },
|
|
5674
|
+
componentState: {
|
|
5675
|
+
portalDOMRef,
|
|
5676
|
+
columnHeaderHeight,
|
|
5677
|
+
filterEditors,
|
|
5678
|
+
columnReorderDragColumnId
|
|
5679
|
+
}
|
|
5680
|
+
} = useInfiniteTable();
|
|
5681
|
+
const dragging = columnReorderDragColumnId === column.id;
|
|
5365
5682
|
const { onResize, height, width, headerOptions } = props;
|
|
5366
5683
|
const sortInfo = column.computedSortInfo;
|
|
5367
5684
|
let header = column.header;
|
|
@@ -5379,6 +5696,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
5379
5696
|
direction: column.computedSorted ? column.computedSortedAsc ? 1 : -1 : 0
|
|
5380
5697
|
}) : null;
|
|
5381
5698
|
const renderParam = {
|
|
5699
|
+
dragging,
|
|
5382
5700
|
domRef: ref,
|
|
5383
5701
|
column,
|
|
5384
5702
|
columnSortInfo: sortInfo,
|
|
@@ -5397,15 +5715,6 @@ function InfiniteTableHeaderCell(props) {
|
|
|
5397
5715
|
return /* @__PURE__ */ createElement16(Fragment2, null, align === "end" ? sortTool : null, header, align !== "end" ? sortTool : null);
|
|
5398
5716
|
};
|
|
5399
5717
|
const domRef = useRef12(null);
|
|
5400
|
-
const {
|
|
5401
|
-
computed: {
|
|
5402
|
-
computedRemainingSpace,
|
|
5403
|
-
showColumnFilters,
|
|
5404
|
-
computedVisibleColumns,
|
|
5405
|
-
computedPinnedStartColumns
|
|
5406
|
-
},
|
|
5407
|
-
componentState: { portalDOMRef, columnHeaderHeight, filterEditors }
|
|
5408
|
-
} = useInfiniteTable();
|
|
5409
5718
|
const {
|
|
5410
5719
|
componentActions: dataSourceActions,
|
|
5411
5720
|
getState: getDataSourceState,
|
|
@@ -5421,26 +5730,27 @@ function InfiniteTableHeaderCell(props) {
|
|
|
5421
5730
|
clearOnResize == null ? void 0 : clearOnResize();
|
|
5422
5731
|
};
|
|
5423
5732
|
}, [domRef.current, props.onResize]);
|
|
5424
|
-
|
|
5733
|
+
let style = {
|
|
5425
5734
|
height
|
|
5426
5735
|
};
|
|
5427
|
-
|
|
5428
|
-
|
|
5429
|
-
|
|
5430
|
-
|
|
5736
|
+
if (column.headerStyle) {
|
|
5737
|
+
style = typeof column.headerStyle === "function" ? __spreadValues(__spreadValues({}, style), column.headerStyle(renderParam) || {}) : __spreadValues(__spreadValues({}, style), column.headerStyle);
|
|
5738
|
+
}
|
|
5739
|
+
const headerClassName = typeof column.headerClassName === "function" ? column.headerClassName(renderParam) : column.headerClassName;
|
|
5740
|
+
const { onPointerDown, proxyPosition } = useColumnPointerEvents({
|
|
5431
5741
|
columnId: column.id,
|
|
5432
|
-
domRef
|
|
5433
|
-
columns
|
|
5742
|
+
domRef
|
|
5434
5743
|
});
|
|
5435
5744
|
let draggingProxy = null;
|
|
5436
|
-
if (dragging) {
|
|
5745
|
+
if (dragging && proxyPosition) {
|
|
5437
5746
|
draggingProxy = /* @__PURE__ */ createElement16("div", {
|
|
5747
|
+
key: column.id,
|
|
5438
5748
|
className: `${InfiniteTableHeaderCellClassName}Proxy ${HeaderCellProxy}`,
|
|
5439
5749
|
style: {
|
|
5440
5750
|
position: "absolute",
|
|
5441
5751
|
height,
|
|
5442
5752
|
width,
|
|
5443
|
-
left:
|
|
5753
|
+
left: (_a = proxyPosition.left) != null ? _a : 0,
|
|
5444
5754
|
top: (_b = proxyPosition.top) != null ? _b : 0,
|
|
5445
5755
|
zIndex: 1e9
|
|
5446
5756
|
}
|
|
@@ -5475,7 +5785,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
5475
5785
|
});
|
|
5476
5786
|
dataSourceActions.filterValue = newFilterValue;
|
|
5477
5787
|
}, [column, filterTypes]);
|
|
5478
|
-
const debouncedOnFilterValueChange =
|
|
5788
|
+
const debouncedOnFilterValueChange = useMemo4(() => {
|
|
5479
5789
|
const fn = (filterValue) => {
|
|
5480
5790
|
let newFilterValueForColumn;
|
|
5481
5791
|
if (column.computedFilterValue) {
|
|
@@ -5529,7 +5839,11 @@ function InfiniteTableHeaderCell(props) {
|
|
|
5529
5839
|
onPointerDown,
|
|
5530
5840
|
contentClassName: join(HeaderCellContentRecipe(contentRecipeVariants), justifyContent[(_c = column.align) != null ? _c : "start"]),
|
|
5531
5841
|
contentStyle: showColumnFilters ? { height: height / 2 } : void 0,
|
|
5532
|
-
className: join(InfiniteTableHeaderCellClassName, userSelect.none, column.computedSortable ? cursor.pointer : "", useCellClassName(column, [InfiniteTableHeaderCellClassName, InfiniteTableCellClassName], HeaderCellRecipe, {
|
|
5842
|
+
className: join(InfiniteTableHeaderCellClassName, userSelect.none, column.computedSortable ? cursor.pointer : "", headerClassName, useCellClassName(column, [InfiniteTableHeaderCellClassName, InfiniteTableCellClassName], HeaderCellRecipe, {
|
|
5843
|
+
dragging,
|
|
5844
|
+
zebra: false,
|
|
5845
|
+
rowActive: false
|
|
5846
|
+
}), CellCls),
|
|
5533
5847
|
cssEllipsis: (_e = (_d = column.headerCssEllipsis) != null ? _d : column.cssEllipsis) != null ? _e : true,
|
|
5534
5848
|
afterChildren: /* @__PURE__ */ createElement16(Fragment2, null, showColumnFilters ? column.computedFilterable ? /* @__PURE__ */ createElement16(InfiniteTableColumnHeaderFilter, {
|
|
5535
5849
|
filterEditor: FilterEditor,
|
|
@@ -5552,50 +5866,30 @@ function useInfiniteHeaderCell() {
|
|
|
5552
5866
|
import {
|
|
5553
5867
|
createElement as createElement20,
|
|
5554
5868
|
useCallback as useCallback11,
|
|
5555
|
-
useMemo as
|
|
5869
|
+
useMemo as useMemo5
|
|
5556
5870
|
} from "react";
|
|
5557
5871
|
|
|
5558
|
-
// src/components/utils/getScrollbarWidth.ts
|
|
5559
|
-
var scrollbarWidth;
|
|
5560
|
-
function getScrollbarWidth() {
|
|
5561
|
-
var _a, _b;
|
|
5562
|
-
if (scrollbarWidth != null) {
|
|
5563
|
-
return scrollbarWidth;
|
|
5564
|
-
}
|
|
5565
|
-
const doc = (_a = getGlobal().document) != null ? _a : null;
|
|
5566
|
-
if (!doc) {
|
|
5567
|
-
return 0;
|
|
5568
|
-
}
|
|
5569
|
-
const outer = doc.createElement("div");
|
|
5570
|
-
outer.style.visibility = "hidden";
|
|
5571
|
-
outer.style.overflow = "scroll";
|
|
5572
|
-
doc.body.appendChild(outer);
|
|
5573
|
-
const inner = doc.createElement("div");
|
|
5574
|
-
outer.appendChild(inner);
|
|
5575
|
-
scrollbarWidth = outer.offsetWidth - inner.offsetWidth;
|
|
5576
|
-
(_b = outer.parentNode) == null ? void 0 : _b.removeChild(outer);
|
|
5577
|
-
return scrollbarWidth;
|
|
5578
|
-
}
|
|
5579
|
-
|
|
5580
5872
|
// src/components/InfiniteTable/components/InfiniteTableHeader/buildColumnAndGroupTree.ts
|
|
5581
5873
|
function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap, columnGroupsMaxDepth) {
|
|
5582
5874
|
const map2 = new Map();
|
|
5583
5875
|
const temporaryMap = new Map();
|
|
5584
5876
|
const mapOfAllParentGroupsForColumns = new Map();
|
|
5585
5877
|
columns.forEach((col, index) => {
|
|
5586
|
-
var _a, _b, _c, _d
|
|
5878
|
+
var _a, _b, _c, _d;
|
|
5587
5879
|
const colId = col.id;
|
|
5588
|
-
const
|
|
5880
|
+
const previousColumn = columns[index - 1];
|
|
5881
|
+
const previousColumnId = (_a = previousColumn == null ? void 0 : previousColumn.id) != null ? _a : "";
|
|
5589
5882
|
const parentGroups = new Set();
|
|
5590
|
-
const parentGroupsOfPreviousColumn = (
|
|
5883
|
+
const parentGroupsOfPreviousColumn = (previousColumn == null ? void 0 : previousColumn.computedPinned) !== col.computedPinned ? new Set() : (_b = mapOfAllParentGroupsForColumns.get(previousColumnId)) != null ? _b : new Set();
|
|
5591
5884
|
mapOfAllParentGroupsForColumns.set(colId, parentGroups);
|
|
5592
5885
|
const colItem = {
|
|
5593
5886
|
type: "column",
|
|
5594
5887
|
id: colId,
|
|
5595
5888
|
ref: col,
|
|
5596
5889
|
groupOffset: 0,
|
|
5890
|
+
computedPinned: col.computedPinned,
|
|
5597
5891
|
computedWidth: col.computedWidth,
|
|
5598
|
-
depth: col.columnGroup ? ((
|
|
5892
|
+
depth: col.columnGroup ? ((_c = columnGroupsDepthsMap.get(col.columnGroup)) != null ? _c : 0) + 1 : 0
|
|
5599
5893
|
};
|
|
5600
5894
|
map2.set([colId], colItem);
|
|
5601
5895
|
let groupId = col.columnGroup;
|
|
@@ -5617,7 +5911,8 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap, c
|
|
|
5617
5911
|
groupOffset: 0,
|
|
5618
5912
|
uniqueGroupId: [groupId],
|
|
5619
5913
|
computedWidth: 0,
|
|
5620
|
-
|
|
5914
|
+
computedPinned: colItem.computedPinned,
|
|
5915
|
+
depth: (_d = columnGroupsDepthsMap.get(groupId)) != null ? _d : 0
|
|
5621
5916
|
};
|
|
5622
5917
|
map2.set(groupAbsoluteId, colGroupItem);
|
|
5623
5918
|
temporaryMap.set(groupId, colGroupItem);
|
|
@@ -5701,6 +5996,13 @@ function GroupResizeHandleFn(props) {
|
|
|
5701
5996
|
const [constrained, setConstrained] = useState9(false);
|
|
5702
5997
|
const constrainedRef = useRef13(constrained);
|
|
5703
5998
|
constrainedRef.current = constrained;
|
|
5999
|
+
const col = props.groupColumns[0];
|
|
6000
|
+
if (!col) {
|
|
6001
|
+
return null;
|
|
6002
|
+
}
|
|
6003
|
+
const computedPinned = col.computedPinned;
|
|
6004
|
+
const computedFirstInCategory = col.computedFirstInCategory;
|
|
6005
|
+
const computedLastInCategory = col.computedLastInCategory;
|
|
5704
6006
|
const onPointerDown = (e) => {
|
|
5705
6007
|
e.stopPropagation();
|
|
5706
6008
|
const pointerId = e.pointerId;
|
|
@@ -5713,6 +6015,9 @@ function GroupResizeHandleFn(props) {
|
|
|
5713
6015
|
domRef
|
|
5714
6016
|
});
|
|
5715
6017
|
const resizeDiff = (diff) => {
|
|
6018
|
+
if (computedPinned === "end") {
|
|
6019
|
+
diff *= -1;
|
|
6020
|
+
}
|
|
5716
6021
|
const { constrained: constrained2, adjustedDiffs, adjustedDiff } = props.computeResize(diff);
|
|
5717
6022
|
if (constrainedRef.current !== constrained2) {
|
|
5718
6023
|
setConstrained(constrained2);
|
|
@@ -5722,8 +6027,8 @@ function GroupResizeHandleFn(props) {
|
|
|
5722
6027
|
};
|
|
5723
6028
|
const onPointerMove = (e2) => {
|
|
5724
6029
|
if (initialMove) {
|
|
5725
|
-
const maxDiff = props.groupColumns.reduce((diff,
|
|
5726
|
-
return diff +
|
|
6030
|
+
const maxDiff = props.groupColumns.reduce((diff, col2) => {
|
|
6031
|
+
return diff + col2.computedWidth - col2.computedMinWidth;
|
|
5727
6032
|
}, 0);
|
|
5728
6033
|
const currentSize = props.brain.getAvailableSize();
|
|
5729
6034
|
const newSize = {
|
|
@@ -5746,12 +6051,19 @@ function GroupResizeHandleFn(props) {
|
|
|
5746
6051
|
target.addEventListener("pointermove", onPointerMove);
|
|
5747
6052
|
target.addEventListener("pointerup", onPointerUp);
|
|
5748
6053
|
};
|
|
6054
|
+
const style = (computedPinned === false || computedPinned === "start") && computedLastInCategory ? {
|
|
6055
|
+
right: computedPinned === "start" ? 0 : ThemeVars.components.HeaderCell.resizeHandleWidth
|
|
6056
|
+
} : computedPinned === "end" && computedFirstInCategory ? { right: "none", left: 0 } : void 0;
|
|
5749
6057
|
return /* @__PURE__ */ React23.createElement("div", {
|
|
5750
6058
|
ref: domRef,
|
|
5751
|
-
className: `${InfiniteTableHeaderCellResizeHandleCls2} ${ResizeHandleCls}
|
|
6059
|
+
className: `${InfiniteTableHeaderCellResizeHandleCls2} ${ResizeHandleCls} ${ResizeHandleRecipeCls({
|
|
6060
|
+
computedPinned,
|
|
6061
|
+
computedFirstInCategory,
|
|
6062
|
+
computedLastInCategory
|
|
6063
|
+
})}`,
|
|
5752
6064
|
onPointerDown
|
|
5753
6065
|
}, /* @__PURE__ */ React23.createElement("div", {
|
|
5754
|
-
style: props.style,
|
|
6066
|
+
style: __spreadValues(__spreadValues({}, style), props.style),
|
|
5755
6067
|
className: ResizeHandleDraggerClsRecipe({
|
|
5756
6068
|
constrained
|
|
5757
6069
|
})
|
|
@@ -5883,8 +6195,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
5883
6195
|
}, [brain]);
|
|
5884
6196
|
const domRef = useRef14(null);
|
|
5885
6197
|
const headerCls = HeaderClsRecipe({
|
|
5886
|
-
overflow: false
|
|
5887
|
-
virtualized: true
|
|
6198
|
+
overflow: false
|
|
5888
6199
|
});
|
|
5889
6200
|
const domProps = {
|
|
5890
6201
|
ref: domRef,
|
|
@@ -5972,7 +6283,7 @@ function TableHeaderWrapper(props) {
|
|
|
5972
6283
|
} = tableContextValue;
|
|
5973
6284
|
const rows = !computedColumnGroups || !computedColumnGroups.size ? 1 : columnGroupsMaxDepth + 2;
|
|
5974
6285
|
const height = rows * columnHeaderHeight + (showColumnFilters ? columnHeaderHeight : 0);
|
|
5975
|
-
const columnAndGroupTreeInfo =
|
|
6286
|
+
const columnAndGroupTreeInfo = useMemo5(() => {
|
|
5976
6287
|
if (!computedColumnGroups || !computedColumnGroups.size) {
|
|
5977
6288
|
return void 0;
|
|
5978
6289
|
}
|
|
@@ -6109,7 +6420,7 @@ var InfiniteTableLicenseFooter = forwardRef4(function InfiniteTableLicenseFooter
|
|
|
6109
6420
|
}, []);
|
|
6110
6421
|
useEffect13(() => {
|
|
6111
6422
|
const forceStyle = () => {
|
|
6112
|
-
|
|
6423
|
+
raf(() => {
|
|
6113
6424
|
var _a;
|
|
6114
6425
|
enforceStyle(domRef.current, defaultStyle);
|
|
6115
6426
|
enforceStyle((_a = domRef.current) == null ? void 0 : _a.firstElementChild, anchorStyle);
|
|
@@ -6140,7 +6451,7 @@ import {
|
|
|
6140
6451
|
createElement as createElement22,
|
|
6141
6452
|
memo as memo9
|
|
6142
6453
|
} from "react";
|
|
6143
|
-
import { useCallback as useCallback13, useContext as useContext5, useMemo as
|
|
6454
|
+
import { useCallback as useCallback13, useContext as useContext5, useMemo as useMemo6 } from "react";
|
|
6144
6455
|
var { rootClassName: rootClassName11 } = internalProps;
|
|
6145
6456
|
var columnZIndexAtIndex6 = stripVar(InternalVars.columnZIndexAtIndex);
|
|
6146
6457
|
var InfiniteTableColumnCellContext = createContext5(null);
|
|
@@ -6273,7 +6584,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
6273
6584
|
style = column.style ? typeof column.style === "function" ? __spreadValues(__spreadValues({}, style), column.style(stylingRenderParam) || {}) : __spreadValues(__spreadValues({}, style), column.style) : style || {};
|
|
6274
6585
|
style.height = rowHeight;
|
|
6275
6586
|
style.zIndex = `var(${columnZIndexAtIndex6}-${column.computedVisibleIndex})`;
|
|
6276
|
-
const memoizedStyle =
|
|
6587
|
+
const memoizedStyle = useMemo6(() => style, [!style ? null : JSON.stringify(style)]);
|
|
6277
6588
|
const odd = (rowInfo.indexInAll != null ? rowInfo.indexInAll : rowIndex) % 2 === 1;
|
|
6278
6589
|
const zebra = showZebraRows ? odd ? "odd" : "even" : false;
|
|
6279
6590
|
const cellProps = {
|
|
@@ -6313,8 +6624,8 @@ import {
|
|
|
6313
6624
|
} from "react";
|
|
6314
6625
|
|
|
6315
6626
|
// src/components/InfiniteTable/components/LoadMask.css.ts
|
|
6316
|
-
var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2
|
|
6317
|
-
var LoadMaskOverlayCls = "qy58ya3 _16lm1iw2
|
|
6627
|
+
var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2 _16lm1iw12 _16lm1iw14 _16lm1iw19 _16lm1iw17", hidden: "qy58ya2 qy58ya0 _16lm1iw2 _16lm1iw12 _16lm1iw14 _16lm1iw19 _16lm1iw17" };
|
|
6628
|
+
var LoadMaskOverlayCls = "qy58ya3 _16lm1iw2 _16lm1iw12 _16lm1iw14 _16lm1iw19 _16lm1iw17";
|
|
6318
6629
|
var LoadMaskTextCls = "qy58ya4";
|
|
6319
6630
|
|
|
6320
6631
|
// src/components/InfiniteTable/components/LoadMask.tsx
|
|
@@ -6343,6 +6654,22 @@ function getImperativeApi(getState, getComputed, getDataSourceState, componentAc
|
|
|
6343
6654
|
},
|
|
6344
6655
|
getState,
|
|
6345
6656
|
getDataSourceState,
|
|
6657
|
+
get scrollLeft() {
|
|
6658
|
+
const state = getState();
|
|
6659
|
+
return state.brain.getScrollPosition().scrollLeft;
|
|
6660
|
+
},
|
|
6661
|
+
set scrollLeft(scrollLeft2) {
|
|
6662
|
+
const state = getState();
|
|
6663
|
+
state.scrollerDOMRef.current.scrollLeft = Math.max(scrollLeft2, 0);
|
|
6664
|
+
},
|
|
6665
|
+
get scrollTop() {
|
|
6666
|
+
const state = getState();
|
|
6667
|
+
return state.brain.getScrollPosition().scrollTop;
|
|
6668
|
+
},
|
|
6669
|
+
set scrollTop(scrollTop2) {
|
|
6670
|
+
const state = getState();
|
|
6671
|
+
state.scrollerDOMRef.current.scrollTop = Math.max(scrollTop2, 0);
|
|
6672
|
+
},
|
|
6346
6673
|
scrollRowIntoView(rowIndex, config = { offset: 0 }) {
|
|
6347
6674
|
const state = getState();
|
|
6348
6675
|
const scrollPosition = state.renderer.getScrollPositionForScrollRowIntoView(rowIndex, config);
|
|
@@ -6637,12 +6964,12 @@ function useCellRendering(param) {
|
|
|
6637
6964
|
}, [brain]);
|
|
6638
6965
|
useEffect15(() => {
|
|
6639
6966
|
return brain.onScrollStop((scrollPosition) => {
|
|
6640
|
-
const { scrollTop } = scrollPosition;
|
|
6641
|
-
if (
|
|
6967
|
+
const { scrollTop: scrollTop2 } = scrollPosition;
|
|
6968
|
+
if (scrollTop2 === 0) {
|
|
6642
6969
|
onScrollToTop == null ? void 0 : onScrollToTop();
|
|
6643
6970
|
}
|
|
6644
6971
|
const offset = scrollToBottomOffset != null ? scrollToBottomOffset : SCROLL_BOTTOM_OFFSET;
|
|
6645
|
-
const isScrollBottom =
|
|
6972
|
+
const isScrollBottom = scrollTop2 + offset >= scrollTopMaxRef.current;
|
|
6646
6973
|
if (isScrollBottom) {
|
|
6647
6974
|
onScrollToBottom == null ? void 0 : onScrollToBottom();
|
|
6648
6975
|
const { livePagination, livePaginationCursor, dataArray: dataArray2 } = getDataSourceState();
|
|
@@ -6845,10 +7172,10 @@ function useColumnGroups() {
|
|
|
6845
7172
|
}
|
|
6846
7173
|
|
|
6847
7174
|
// src/components/InfiniteTable/hooks/useColumnRowspan.ts
|
|
6848
|
-
import { useMemo as
|
|
7175
|
+
import { useMemo as useMemo7 } from "react";
|
|
6849
7176
|
function useColumnRowspan(computedVisibleColumns) {
|
|
6850
7177
|
const { getState: getDataSourceState } = useDataSourceContextValue();
|
|
6851
|
-
const rowspan =
|
|
7178
|
+
const rowspan = useMemo7(() => {
|
|
6852
7179
|
const colsWithRowspan = computedVisibleColumns.filter((col) => typeof col.rowspan === "function");
|
|
6853
7180
|
return colsWithRowspan.length ? ({ rowIndex, colIndex }) => {
|
|
6854
7181
|
const dataArray = getDataSourceState().dataArray;
|
|
@@ -6888,7 +7215,7 @@ function useColumnSizeFn(columns) {
|
|
|
6888
7215
|
}
|
|
6889
7216
|
|
|
6890
7217
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
6891
|
-
import { useEffect as useEffect22, useMemo as
|
|
7218
|
+
import { useEffect as useEffect22, useMemo as useMemo9 } from "react";
|
|
6892
7219
|
|
|
6893
7220
|
// src/components/InfiniteTable/utils/getColumnForGroupBy.tsx
|
|
6894
7221
|
import {
|
|
@@ -7787,7 +8114,7 @@ var GroupRowsState = class {
|
|
|
7787
8114
|
};
|
|
7788
8115
|
|
|
7789
8116
|
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
7790
|
-
import { useEffect as useEffect21, useMemo as
|
|
8117
|
+
import { useEffect as useEffect21, useMemo as useMemo8, useRef as useRef20, useState as useState12 } from "react";
|
|
7791
8118
|
|
|
7792
8119
|
// src/components/hooks/useEffectWithChanges.ts
|
|
7793
8120
|
import { useEffect as useEffect20, useRef as useRef19 } from "react";
|
|
@@ -7846,7 +8173,7 @@ function getChangeDetect() {
|
|
|
7846
8173
|
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
7847
8174
|
var CACHE_DEFAULT = true;
|
|
7848
8175
|
var getRafPromise = () => new Promise((resolve) => {
|
|
7849
|
-
|
|
8176
|
+
raf(resolve);
|
|
7850
8177
|
});
|
|
7851
8178
|
var SKIP_DATA_CHANGES_KEYS = {
|
|
7852
8179
|
originalDataArray: true,
|
|
@@ -8012,17 +8339,15 @@ function loadData(data, componentState, actions, overrides) {
|
|
|
8012
8339
|
lazyGroupData.set(theKey, currentGroupRowInfo);
|
|
8013
8340
|
}
|
|
8014
8341
|
} else {
|
|
8015
|
-
|
|
8016
|
-
|
|
8017
|
-
|
|
8018
|
-
|
|
8019
|
-
|
|
8020
|
-
|
|
8021
|
-
|
|
8022
|
-
|
|
8023
|
-
|
|
8024
|
-
newGroupRowInfo.children.length = newGroupRowInfo.totalCount;
|
|
8025
|
-
}
|
|
8342
|
+
newGroupRowInfo.children.forEach((child) => {
|
|
8343
|
+
if (child && child.dataset) {
|
|
8344
|
+
childDatasets.push({
|
|
8345
|
+
keys: child.keys,
|
|
8346
|
+
dataset: child.dataset
|
|
8347
|
+
});
|
|
8348
|
+
}
|
|
8349
|
+
});
|
|
8350
|
+
newGroupRowInfo.children.length = newGroupRowInfo.totalCount;
|
|
8026
8351
|
lazyGroupData.set(theKey, newGroupRowInfo);
|
|
8027
8352
|
}
|
|
8028
8353
|
let skipTriggerChangeAsAlreadyOriginalArrayWasUpdated = false;
|
|
@@ -8174,6 +8499,7 @@ function useLazyLoadRange() {
|
|
|
8174
8499
|
}, [componentState.data, componentState.dataParams]);
|
|
8175
8500
|
const {
|
|
8176
8501
|
lazyLoadBatchSize,
|
|
8502
|
+
lazyLoad,
|
|
8177
8503
|
notifyRenderRangeChange,
|
|
8178
8504
|
dataArray,
|
|
8179
8505
|
scrollStopDelayUpdatedByTable
|
|
@@ -8186,27 +8512,33 @@ function useLazyLoadRange() {
|
|
|
8186
8512
|
return;
|
|
8187
8513
|
}
|
|
8188
8514
|
const { renderStartIndex: startIndex, renderEndIndex: endIndex } = renderRange;
|
|
8189
|
-
|
|
8515
|
+
const { lazyLoadBatchSize: lazyLoadBatchSize2, lazyLoad: lazyLoad2 } = componentState2;
|
|
8516
|
+
if (!lazyLoad2) {
|
|
8190
8517
|
return;
|
|
8191
8518
|
}
|
|
8519
|
+
if (!lazyLoadBatchSize2 || lazyLoadBatchSize2 <= 0) {
|
|
8520
|
+
if (!componentState2.groupBy || componentState2.groupBy.length === 0) {
|
|
8521
|
+
return;
|
|
8522
|
+
}
|
|
8523
|
+
}
|
|
8192
8524
|
lazyLoadRange({
|
|
8193
8525
|
startIndex,
|
|
8194
8526
|
endIndex,
|
|
8195
|
-
lazyLoadBatchSize,
|
|
8527
|
+
lazyLoadBatchSize: lazyLoadBatchSize2,
|
|
8196
8528
|
componentState: componentState2,
|
|
8197
8529
|
componentActions: actions
|
|
8198
8530
|
}, cache);
|
|
8199
8531
|
};
|
|
8200
|
-
const debouncedLoadRange =
|
|
8532
|
+
const debouncedLoadRange = useMemo8(() => debounce(loadRange, { wait: scrollStopDelayUpdatedByTable }), [scrollStopDelayUpdatedByTable]);
|
|
8201
8533
|
useEffect21(() => {
|
|
8202
|
-
if (
|
|
8534
|
+
if (lazyLoad) {
|
|
8203
8535
|
return notifyRenderRangeChange.onChange((renderRange) => {
|
|
8204
8536
|
latestRenderRangeRef.current = renderRange;
|
|
8205
8537
|
loadRange(renderRange);
|
|
8206
8538
|
});
|
|
8207
8539
|
}
|
|
8208
8540
|
return;
|
|
8209
|
-
}, [lazyLoadBatchSize]);
|
|
8541
|
+
}, [lazyLoadBatchSize, lazyLoad]);
|
|
8210
8542
|
useEffect21(() => {
|
|
8211
8543
|
if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
|
|
8212
8544
|
debouncedLoadRange();
|
|
@@ -8260,7 +8592,7 @@ function lazyLoadRange(options, cache) {
|
|
|
8260
8592
|
}
|
|
8261
8593
|
}
|
|
8262
8594
|
}
|
|
8263
|
-
if (!rowLoaded) {
|
|
8595
|
+
if (!rowLoaded && lazyLoadBatchSize != void 0) {
|
|
8264
8596
|
let cachedFnCalls = perGroupFnCalls.get(cacheKeys);
|
|
8265
8597
|
const batchStartIndexInGroup = Math.floor(indexInGroup / lazyLoadBatchSize) * lazyLoadBatchSize;
|
|
8266
8598
|
const offset = indexInGroup - batchStartIndexInGroup;
|
|
@@ -8523,7 +8855,7 @@ function getInterceptActions() {
|
|
|
8523
8855
|
});
|
|
8524
8856
|
actions.dataParams = dataParams;
|
|
8525
8857
|
if (state.livePagination) {
|
|
8526
|
-
|
|
8858
|
+
raf(() => {
|
|
8527
8859
|
actions.livePaginationCursor = null;
|
|
8528
8860
|
});
|
|
8529
8861
|
}
|
|
@@ -8535,7 +8867,7 @@ function getInterceptActions() {
|
|
|
8535
8867
|
});
|
|
8536
8868
|
actions.dataParams = dataParams;
|
|
8537
8869
|
if (state.livePagination) {
|
|
8538
|
-
|
|
8870
|
+
raf(() => {
|
|
8539
8871
|
actions.livePaginationCursor = null;
|
|
8540
8872
|
});
|
|
8541
8873
|
}
|
|
@@ -8547,7 +8879,7 @@ function getInterceptActions() {
|
|
|
8547
8879
|
});
|
|
8548
8880
|
actions.dataParams = dataParams;
|
|
8549
8881
|
if (state.livePagination) {
|
|
8550
|
-
|
|
8882
|
+
raf(() => {
|
|
8551
8883
|
actions.livePaginationCursor = null;
|
|
8552
8884
|
});
|
|
8553
8885
|
}
|
|
@@ -8559,7 +8891,7 @@ function getInterceptActions() {
|
|
|
8559
8891
|
});
|
|
8560
8892
|
actions.dataParams = dataParams;
|
|
8561
8893
|
if (state.livePagination) {
|
|
8562
|
-
|
|
8894
|
+
raf(() => {
|
|
8563
8895
|
actions.livePaginationCursor = null;
|
|
8564
8896
|
});
|
|
8565
8897
|
}
|
|
@@ -9080,7 +9412,7 @@ function useToggleGroupRow() {
|
|
|
9080
9412
|
|
|
9081
9413
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
9082
9414
|
function useGroupByMap(groupBy) {
|
|
9083
|
-
const groupByMap =
|
|
9415
|
+
const groupByMap = useMemo9(() => {
|
|
9084
9416
|
return groupBy.reduce((acc, groupBy2, index) => {
|
|
9085
9417
|
acc.set(groupBy2.field, {
|
|
9086
9418
|
groupBy: groupBy2,
|
|
@@ -9464,15 +9796,15 @@ function getColumnsWhenGrouping(params) {
|
|
|
9464
9796
|
}
|
|
9465
9797
|
|
|
9466
9798
|
// src/components/InfiniteTable/hooks/useComputedVisibleColumns.ts
|
|
9467
|
-
import { useMemo as
|
|
9799
|
+
import { useMemo as useMemo10 } from "react";
|
|
9468
9800
|
|
|
9469
9801
|
// src/components/InfiniteTable/utils/adjustColumnOrderForPinning.ts
|
|
9470
9802
|
var order = ["start", void 0, "end"];
|
|
9471
9803
|
var adjustColumnOrderForPinning = (columnOrder, columnPinning) => {
|
|
9472
|
-
if (columnPinning.
|
|
9804
|
+
if (columnPinning && Object.keys(columnPinning).length > 0) {
|
|
9473
9805
|
columnOrder.sort((colId1, colId2) => {
|
|
9474
|
-
let p1 = columnPinning
|
|
9475
|
-
let p2 = columnPinning
|
|
9806
|
+
let p1 = columnPinning[colId1];
|
|
9807
|
+
let p2 = columnPinning[colId2];
|
|
9476
9808
|
if (p1 === true) {
|
|
9477
9809
|
p1 = "start";
|
|
9478
9810
|
}
|
|
@@ -9513,7 +9845,10 @@ var isColumnVisible = (columnVisibility, _columnVisibilityAssumeVisible, colId)
|
|
|
9513
9845
|
return columnVisibility[colId] !== false;
|
|
9514
9846
|
};
|
|
9515
9847
|
var getComputedPinned = (colId, columnPinning) => {
|
|
9516
|
-
|
|
9848
|
+
if (!columnPinning) {
|
|
9849
|
+
return false;
|
|
9850
|
+
}
|
|
9851
|
+
const pinned = columnPinning[colId];
|
|
9517
9852
|
const computedPinned = pinned === "start" || pinned === true ? "start" : pinned === "end" ? "end" : false;
|
|
9518
9853
|
return computedPinned;
|
|
9519
9854
|
};
|
|
@@ -9701,6 +10036,8 @@ var getComputedVisibleColumns = ({
|
|
|
9701
10036
|
renderValue: colType.renderValue,
|
|
9702
10037
|
render: colType.render,
|
|
9703
10038
|
style: colType.style,
|
|
10039
|
+
headerStyle: colType.headerStyle,
|
|
10040
|
+
headerClassName: colType.headerClassName,
|
|
9704
10041
|
components: colType.components,
|
|
9705
10042
|
columnGroup: colType.columnGroup,
|
|
9706
10043
|
field
|
|
@@ -9863,7 +10200,6 @@ var useComputedVisibleColumns = ({
|
|
|
9863
10200
|
columnSizing
|
|
9864
10201
|
}) => {
|
|
9865
10202
|
const columnsRenderId = useRerenderOnKeyChange(columns);
|
|
9866
|
-
const pinningRenderId = useRerenderOnKeyChange(columnPinning);
|
|
9867
10203
|
const {
|
|
9868
10204
|
computedRemainingSpace,
|
|
9869
10205
|
computedColumnOrder,
|
|
@@ -9879,7 +10215,7 @@ var useComputedVisibleColumns = ({
|
|
|
9879
10215
|
computedPinnedEndOffset,
|
|
9880
10216
|
computedPinnedEndWidth,
|
|
9881
10217
|
computedPinnedStartWidth
|
|
9882
|
-
} =
|
|
10218
|
+
} = useMemo10(() => {
|
|
9883
10219
|
return getComputedVisibleColumns({
|
|
9884
10220
|
columns,
|
|
9885
10221
|
bodySize,
|
|
@@ -9926,8 +10262,7 @@ var useComputedVisibleColumns = ({
|
|
|
9926
10262
|
columnSizing,
|
|
9927
10263
|
columnTypes,
|
|
9928
10264
|
columnPinning,
|
|
9929
|
-
columnsRenderId
|
|
9930
|
-
pinningRenderId
|
|
10265
|
+
columnsRenderId
|
|
9931
10266
|
]);
|
|
9932
10267
|
const result = {
|
|
9933
10268
|
columns,
|
|
@@ -10095,7 +10430,7 @@ function useComputed() {
|
|
|
10095
10430
|
}
|
|
10096
10431
|
|
|
10097
10432
|
// src/components/InfiniteTable/hooks/useLicense/useLicense.ts
|
|
10098
|
-
import { useMemo as
|
|
10433
|
+
import { useMemo as useMemo11 } from "react";
|
|
10099
10434
|
|
|
10100
10435
|
// src/components/InfiniteTable/hooks/useLicense/crc32.ts
|
|
10101
10436
|
var DEFAULT_ReversedPolynomial = 3988292384;
|
|
@@ -10253,10 +10588,10 @@ var isInsideSandbox = () => {
|
|
|
10253
10588
|
};
|
|
10254
10589
|
var isInsidePlayground = isInsideSandbox() || isInsideSandpack();
|
|
10255
10590
|
var useLicense = (licenseKey = "") => {
|
|
10256
|
-
const valid =
|
|
10591
|
+
const valid = useMemo11(() => {
|
|
10257
10592
|
let valid2 = isValidLicense(licenseKey, {
|
|
10258
10593
|
publishedAt: 1624970570587,
|
|
10259
|
-
version: "0.3.
|
|
10594
|
+
version: "0.3.20"
|
|
10260
10595
|
});
|
|
10261
10596
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
10262
10597
|
return true;
|
|
@@ -10283,7 +10618,7 @@ function useScrollToActiveCell(activeCellIndex, dataCount, imperativeApi) {
|
|
|
10283
10618
|
let tryScroll = function(times = 0) {
|
|
10284
10619
|
times++;
|
|
10285
10620
|
cancelAnimationFrame(rafId.current);
|
|
10286
|
-
rafId.current =
|
|
10621
|
+
rafId.current = raf(() => {
|
|
10287
10622
|
didScrollRef.current = imperativeApi.scrollCellIntoView(activeCellIndex[0], activeCellIndex[1], {
|
|
10288
10623
|
offset: 30
|
|
10289
10624
|
});
|
|
@@ -10590,7 +10925,7 @@ function initSetupState2() {
|
|
|
10590
10925
|
scrollTop: 0,
|
|
10591
10926
|
scrollLeft: 0
|
|
10592
10927
|
},
|
|
10593
|
-
|
|
10928
|
+
columnReorderDragColumnId: false,
|
|
10594
10929
|
ready: false,
|
|
10595
10930
|
focused: false,
|
|
10596
10931
|
focusedWithin: false,
|
|
@@ -10659,7 +10994,6 @@ var forwardProps3 = (setupState) => {
|
|
|
10659
10994
|
columnHeaderHeight: (columnHeaderHeight) => typeof columnHeaderHeight === "number" ? columnHeaderHeight : 30,
|
|
10660
10995
|
columns: (columns) => toMap(columns, setupState.propsCache.get("columns")),
|
|
10661
10996
|
columnVisibility: (columnVisibility) => columnVisibility != null ? columnVisibility : {},
|
|
10662
|
-
columnPinning: (columnPinning) => toMap(columnPinning, setupState.propsCache.get("columnPinning")),
|
|
10663
10997
|
columnSizing: (columnSizing) => columnSizing || {},
|
|
10664
10998
|
columnTypes: (columnTypes) => columnTypes || {},
|
|
10665
10999
|
collapsedColumnGroups: (collapsedColumnGroups) => collapsedColumnGroups != null ? collapsedColumnGroups : new Map(),
|
|
@@ -10706,6 +11040,8 @@ var mapPropsToState2 = (params) => {
|
|
|
10706
11040
|
});
|
|
10707
11041
|
const computedColumns = state.columnsWhenGrouping || state.columnsWhenInlineGroupRenderStrategy || state.columns;
|
|
10708
11042
|
return {
|
|
11043
|
+
columnPinning: state.columnPinningWhileDragging || state.columnPinning || props.columnPinning,
|
|
11044
|
+
columnPinningWhileDragging: state.columnPinningWhileDragging,
|
|
10709
11045
|
controlledColumnVisibility: !!props.columnVisibility,
|
|
10710
11046
|
groupRenderStrategy,
|
|
10711
11047
|
groupBy,
|
|
@@ -10745,16 +11081,14 @@ var InfiniteTableComponent = memo11(function InfiniteTableComponent2() {
|
|
|
10745
11081
|
getComputed,
|
|
10746
11082
|
computed,
|
|
10747
11083
|
componentActions: actions,
|
|
10748
|
-
getState
|
|
11084
|
+
getState,
|
|
11085
|
+
imperativeApi
|
|
10749
11086
|
} = useInfiniteTable();
|
|
10750
11087
|
const {
|
|
10751
11088
|
componentState: { loading, dataArray },
|
|
10752
11089
|
getState: getDataSourceState,
|
|
10753
11090
|
componentActions: dataSourceActions
|
|
10754
11091
|
} = useDataSourceContextValue();
|
|
10755
|
-
const [imperativeApi] = useState15(() => {
|
|
10756
|
-
return getImperativeApi(getState, getComputed, getDataSourceState, actions);
|
|
10757
|
-
});
|
|
10758
11092
|
const {
|
|
10759
11093
|
domRef,
|
|
10760
11094
|
scrollerDOMRef,
|
|
@@ -10827,7 +11161,7 @@ var InfiniteTableComponent = memo11(function InfiniteTableComponent2() {
|
|
|
10827
11161
|
}) : null, /* @__PURE__ */ createElement28(InfiniteTableBody, null, /* @__PURE__ */ createElement28(HeadlessTable, {
|
|
10828
11162
|
tabIndex: 0,
|
|
10829
11163
|
activeRowIndex: componentState.ready && keyboardNavigation === "row" ? activeRowIndex : null,
|
|
10830
|
-
activeCellIndex: componentState.ready && keyboardNavigation === "cell" && !componentState.
|
|
11164
|
+
activeCellIndex: componentState.ready && keyboardNavigation === "cell" && !componentState.columnReorderDragColumnId ? activeCellIndex : null,
|
|
10831
11165
|
scrollStopDelay,
|
|
10832
11166
|
renderer,
|
|
10833
11167
|
onRenderUpdater,
|
|
@@ -10840,6 +11174,12 @@ var InfiniteTableComponent = memo11(function InfiniteTableComponent2() {
|
|
|
10840
11174
|
}, loadingText)), /* @__PURE__ */ createElement28("div", {
|
|
10841
11175
|
ref: portalDOMRef,
|
|
10842
11176
|
className: join(`${rootClassName2}Portal`, zIndex[1e7], position.absolute, top[0], left[0])
|
|
11177
|
+
}), /* @__PURE__ */ createElement28("div", {
|
|
11178
|
+
"data-name": "pinned-start-border",
|
|
11179
|
+
className: PinnedStartIndicatorBorder
|
|
11180
|
+
}), /* @__PURE__ */ createElement28("div", {
|
|
11181
|
+
"data-name": "pinned-end-border",
|
|
11182
|
+
className: PinnedEndIndicatorBorder
|
|
10843
11183
|
}), rowHeightCSSVar ? /* @__PURE__ */ createElement28(CSSVariableWatch, {
|
|
10844
11184
|
varName: rowHeightCSSVar,
|
|
10845
11185
|
onChange: onRowHeightCSSVarChange
|
|
@@ -10858,12 +11198,17 @@ function InfiniteTableContextProvider() {
|
|
|
10858
11198
|
globalThis.getState = getState;
|
|
10859
11199
|
globalThis.getComputed = getComputed;
|
|
10860
11200
|
}
|
|
11201
|
+
const { getState: getDataSourceState } = useDataSourceContextValue();
|
|
11202
|
+
const [imperativeApi] = useState15(() => {
|
|
11203
|
+
return getImperativeApi(getState, getComputed, getDataSourceState, componentActions);
|
|
11204
|
+
});
|
|
10861
11205
|
const contextValue = {
|
|
10862
11206
|
componentActions,
|
|
10863
11207
|
componentState,
|
|
10864
11208
|
computed,
|
|
10865
11209
|
getComputed,
|
|
10866
|
-
getState
|
|
11210
|
+
getState,
|
|
11211
|
+
imperativeApi
|
|
10867
11212
|
};
|
|
10868
11213
|
useResizeObserver(scrollerDOMRef, (size) => {
|
|
10869
11214
|
const bodySize = {
|