@infinite-table/infinite-react 0.3.19 → 0.3.22
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 -12
- package/index.esm.css +116 -81
- package/index.esm.js +853 -372
- package/index.js +836 -355
- 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)", pinnedEndOffset: "var(--_1slvgu9h)", computedVisibleColumnsCount: "var(--_1slvgu9i)", baseZIndexForCells: "var(--_1slvgu9j)", bodyWidth: "var(--_1slvgu9k)", bodyHeight: "var(--_1slvgu9l)", scrollbarWidthHorizontal: "var(--_1slvgu9m)", scrollbarWidthVertical: "var(--_1slvgu9n)", scrollLeft: "var(--_1slvgu9o)", scrollTop: "var(--_1slvgu9p)" };
|
|
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";
|
|
@@ -4211,8 +4269,7 @@ function useCellClassName(column, baseClasses, variants, extraFlags) {
|
|
|
4211
4269
|
}
|
|
4212
4270
|
|
|
4213
4271
|
// src/components/InfiniteTable/hooks/useColumnPointerEvents.ts
|
|
4214
|
-
|
|
4215
|
-
import { useCallback as useCallback6, useMemo as useMemo4, useState as useState5 } from "react";
|
|
4272
|
+
import { useCallback as useCallback6, useState as useState5 } from "react";
|
|
4216
4273
|
|
|
4217
4274
|
// src/components/InfiniteTable/hooks/useInfiniteTable.ts
|
|
4218
4275
|
import { useContext as useContext3 } from "react";
|
|
@@ -4233,30 +4290,39 @@ var useInfiniteTable = () => {
|
|
|
4233
4290
|
return useContext3(TableContext2);
|
|
4234
4291
|
};
|
|
4235
4292
|
|
|
4236
|
-
// src/components/InfiniteTable/utils/moveXatY.ts
|
|
4237
|
-
var moveXatY = (arr, dragIndex, dropIndex) => {
|
|
4238
|
-
arr = [...arr];
|
|
4239
|
-
if (dragIndex === dropIndex || arr[dragIndex] === void 0 || arr[dropIndex] === void 0) {
|
|
4240
|
-
return arr;
|
|
4241
|
-
}
|
|
4242
|
-
const dragItem = arr[dragIndex];
|
|
4243
|
-
if (dropIndex < dragIndex) {
|
|
4244
|
-
arr.splice(dragIndex, 1);
|
|
4245
|
-
arr.splice(dropIndex, 0, dragItem);
|
|
4246
|
-
} else {
|
|
4247
|
-
arr.splice(dragIndex, 1);
|
|
4248
|
-
arr.splice(dropIndex, 0, dragItem);
|
|
4249
|
-
}
|
|
4250
|
-
return arr;
|
|
4251
|
-
};
|
|
4252
|
-
|
|
4253
4293
|
// src/components/InfiniteTable/InfiniteCls.css.ts
|
|
4254
4294
|
var import_createRuntimeFn = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
4255
4295
|
var FooterCls = "_16lm1iw1";
|
|
4256
|
-
var InfiniteCls = "_1yeub2v0 _16lm1iw1
|
|
4296
|
+
var InfiniteCls = "_1yeub2v0 _16lm1iw1 _16lm1iwt _16lm1iw1c _16lm1iw0";
|
|
4297
|
+
var InfiniteClsHasPinnedEnd = "_1yeub2vo";
|
|
4298
|
+
var InfiniteClsHasPinnedStart = "_1yeub2vn";
|
|
4257
4299
|
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
4300
|
var InfiniteClsShiftingColumns = "_1yeub2vl";
|
|
4301
|
+
var PinnedEndIndicatorBorder = "_1yeub2vr _1yeub2vp _16lm1iw2 _16lm1iw12 _16lm1iwe _16lm1iwx _16lm1iw10 _16lm1iw1n _16lm1iwf _16lm1iwp";
|
|
4259
4302
|
var PinnedRowsContainerClsVariants = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "", variantClassNames: { pinned: { start: "_1yeub2vi", end: "_1yeub2vj", false: "_1yeub2vk" } }, defaultVariants: {}, compoundVariants: [] });
|
|
4303
|
+
var PinnedStartIndicatorBorder = "_1yeub2vq _1yeub2vp _16lm1iw2 _16lm1iw12 _16lm1iwe _16lm1iwx _16lm1iw10 _16lm1iw1n _16lm1iwf _16lm1iwp";
|
|
4304
|
+
|
|
4305
|
+
// src/components/utils/getScrollbarWidth.ts
|
|
4306
|
+
var scrollbarWidth;
|
|
4307
|
+
function getScrollbarWidth() {
|
|
4308
|
+
var _a, _b;
|
|
4309
|
+
if (scrollbarWidth != null) {
|
|
4310
|
+
return scrollbarWidth;
|
|
4311
|
+
}
|
|
4312
|
+
const doc = (_a = getGlobal().document) != null ? _a : null;
|
|
4313
|
+
if (!doc) {
|
|
4314
|
+
return 0;
|
|
4315
|
+
}
|
|
4316
|
+
const outer = doc.createElement("div");
|
|
4317
|
+
outer.style.visibility = "hidden";
|
|
4318
|
+
outer.style.overflow = "scroll";
|
|
4319
|
+
doc.body.appendChild(outer);
|
|
4320
|
+
const inner = doc.createElement("div");
|
|
4321
|
+
outer.appendChild(inner);
|
|
4322
|
+
scrollbarWidth = outer.offsetWidth - inner.offsetWidth;
|
|
4323
|
+
(_b = outer.parentNode) == null ? void 0 : _b.removeChild(outer);
|
|
4324
|
+
return scrollbarWidth;
|
|
4325
|
+
}
|
|
4260
4326
|
|
|
4261
4327
|
// src/components/InfiniteTable/utils/rafFn.ts
|
|
4262
4328
|
var rafFn = (fn) => {
|
|
@@ -4273,12 +4339,20 @@ var rafFn = (fn) => {
|
|
|
4273
4339
|
};
|
|
4274
4340
|
|
|
4275
4341
|
// src/components/InfiniteTable/hooks/useDOMProps.ts
|
|
4342
|
+
var scrollbarWidthHorizontal = stripVar(InternalVars.scrollbarWidthHorizontal);
|
|
4343
|
+
var scrollbarWidthVertical = stripVar(InternalVars.scrollbarWidthVertical);
|
|
4276
4344
|
var columnWidthAtIndex2 = stripVar(InternalVars.columnWidthAtIndex);
|
|
4277
4345
|
var columnOffsetAtIndex3 = stripVar(InternalVars.columnOffsetAtIndex);
|
|
4278
4346
|
var columnZIndexAtIndex3 = stripVar(InternalVars.columnZIndexAtIndex);
|
|
4347
|
+
var scrollLeftCSSVar = stripVar(InternalVars.scrollLeft);
|
|
4279
4348
|
var activeCellColWidth = stripVar(InternalVars.activeCellColWidth);
|
|
4280
4349
|
var activeCellColOffset = stripVar(InternalVars.activeCellColOffset);
|
|
4281
4350
|
var baseZIndexForCells = stripVar(InternalVars.baseZIndexForCells);
|
|
4351
|
+
var pinnedStartWidthCSSVar = stripVar(InternalVars.pinnedStartWidth);
|
|
4352
|
+
var bodyWidthCSSVar = stripVar(InternalVars.bodyWidth);
|
|
4353
|
+
var bodyHeightCSSVar = stripVar(InternalVars.bodyHeight);
|
|
4354
|
+
var pinnedEndOffsetCSSVar = stripVar(InternalVars.pinnedEndOffset);
|
|
4355
|
+
var pinnedEndWidthCSSVar = stripVar(InternalVars.pinnedEndWidth);
|
|
4282
4356
|
var computedVisibleColumnsCountCSSVar = stripVar(InternalVars.computedVisibleColumnsCount);
|
|
4283
4357
|
function getColumnZIndex(col, params) {
|
|
4284
4358
|
let computedZIndex = "auto";
|
|
@@ -4287,7 +4361,7 @@ function getColumnZIndex(col, params) {
|
|
|
4287
4361
|
if (col.computedPinned === "start") {
|
|
4288
4362
|
computedZIndex = params.pinnedStartColsCount - col.computedVisibleIndexInCategory;
|
|
4289
4363
|
} else if (col.computedPinned === "end") {
|
|
4290
|
-
computedZIndex = params.visibleColsCount
|
|
4364
|
+
computedZIndex = params.visibleColsCount + col.computedVisibleIndexInCategory;
|
|
4291
4365
|
}
|
|
4292
4366
|
} else {
|
|
4293
4367
|
computedZIndex = -index * 10;
|
|
@@ -4296,6 +4370,7 @@ function getColumnZIndex(col, params) {
|
|
|
4296
4370
|
return zIndexValue;
|
|
4297
4371
|
}
|
|
4298
4372
|
function useDOMProps(initialDOMProps) {
|
|
4373
|
+
const scrollbarWidth2 = getScrollbarWidth();
|
|
4299
4374
|
const { computed, componentState, componentActions } = useInfiniteTable();
|
|
4300
4375
|
const {
|
|
4301
4376
|
focused,
|
|
@@ -4305,23 +4380,30 @@ function useDOMProps(initialDOMProps) {
|
|
|
4305
4380
|
onFocusWithin,
|
|
4306
4381
|
onSelfFocus,
|
|
4307
4382
|
onSelfBlur,
|
|
4383
|
+
bodySize,
|
|
4308
4384
|
activeCellIndex
|
|
4309
4385
|
} = componentState;
|
|
4310
4386
|
const {
|
|
4311
4387
|
computedPinnedStartColumnsWidth,
|
|
4312
4388
|
computedPinnedEndColumnsWidth,
|
|
4313
4389
|
computedPinnedStartColumns,
|
|
4314
|
-
|
|
4390
|
+
computedPinnedEndColumns,
|
|
4391
|
+
computedVisibleColumns,
|
|
4392
|
+
scrollbars
|
|
4315
4393
|
} = computed;
|
|
4394
|
+
const prevPinnedEndCols = [];
|
|
4316
4395
|
const cssVars = computedVisibleColumns.reduce((vars, col) => {
|
|
4317
4396
|
const index = col.computedVisibleIndex;
|
|
4318
4397
|
vars[`${columnWidthAtIndex2}-${index}`] = col.computedWidth + "px";
|
|
4319
|
-
vars[`${columnOffsetAtIndex3}-${index}`] = col.computedOffset + "px
|
|
4398
|
+
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
4399
|
const zIndexValue = getColumnZIndex(col, {
|
|
4321
4400
|
pinnedStartColsCount: computedPinnedStartColumns.length,
|
|
4322
4401
|
visibleColsCount: computedVisibleColumns.length
|
|
4323
4402
|
});
|
|
4324
4403
|
vars[`${columnZIndexAtIndex3}-${index}`] = `${zIndexValue}`;
|
|
4404
|
+
if (col.computedPinned === "end") {
|
|
4405
|
+
prevPinnedEndCols.push(col);
|
|
4406
|
+
}
|
|
4325
4407
|
return vars;
|
|
4326
4408
|
}, {});
|
|
4327
4409
|
if (activeCellIndex != null) {
|
|
@@ -4329,7 +4411,14 @@ function useDOMProps(initialDOMProps) {
|
|
|
4329
4411
|
cssVars[activeCellColOffset] = `var(${getCSSVarNameForColOffset(activeCellIndex[1])})`;
|
|
4330
4412
|
}
|
|
4331
4413
|
cssVars[computedVisibleColumnsCountCSSVar] = computedVisibleColumns.length;
|
|
4414
|
+
cssVars[scrollbarWidthHorizontal] = scrollbars.horizontal ? `${scrollbarWidth2}px` : "0px";
|
|
4415
|
+
cssVars[scrollbarWidthVertical] = scrollbars.vertical ? `${scrollbarWidth2}px` : "0px";
|
|
4416
|
+
cssVars[pinnedStartWidthCSSVar] = `calc( ` + computedPinnedStartColumns.map((c) => `var(${getCSSVarNameForColWidth(c.computedVisibleIndex)})`).join(" + ") + ")";
|
|
4417
|
+
cssVars[pinnedEndWidthCSSVar] = `calc( ` + computedPinnedEndColumns.map((c) => `var(${getCSSVarNameForColWidth(c.computedVisibleIndex)})`).join(" + ") + ")";
|
|
4332
4418
|
cssVars[baseZIndexForCells] = computedVisibleColumns.length * 10;
|
|
4419
|
+
cssVars[pinnedEndOffsetCSSVar] = `calc( var(${bodyWidthCSSVar}) - var(${pinnedEndWidthCSSVar}) - var(${scrollbarWidthVertical}) )`;
|
|
4420
|
+
cssVars[bodyWidthCSSVar] = `${bodySize.width}px`;
|
|
4421
|
+
cssVars[bodyHeightCSSVar] = `${bodySize.height}px`;
|
|
4333
4422
|
const setFocused = rafFn((focused2) => {
|
|
4334
4423
|
componentActions.focused = focused2;
|
|
4335
4424
|
});
|
|
@@ -4377,7 +4466,7 @@ function useDOMProps(initialDOMProps) {
|
|
|
4377
4466
|
onFocus,
|
|
4378
4467
|
onBlur
|
|
4379
4468
|
});
|
|
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({
|
|
4469
|
+
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
4470
|
hasPinnedStart: !!computedPinnedStartColumnsWidth,
|
|
4382
4471
|
hasPinnedEnd: !!computedPinnedEndColumnsWidth,
|
|
4383
4472
|
focused,
|
|
@@ -4398,167 +4487,499 @@ function useDOMProps(initialDOMProps) {
|
|
|
4398
4487
|
return domProps;
|
|
4399
4488
|
}
|
|
4400
4489
|
|
|
4401
|
-
// src/components/InfiniteTable/hooks/
|
|
4402
|
-
var
|
|
4403
|
-
|
|
4490
|
+
// src/components/InfiniteTable/hooks/reorderColumnsOnDrag.ts
|
|
4491
|
+
var import_binary_search2 = __toModule(require_binary_search());
|
|
4492
|
+
|
|
4493
|
+
// src/components/InfiniteTable/utils/moveXatY.ts
|
|
4494
|
+
var moveXatY = (arr, dragIndex, dropIndex) => {
|
|
4495
|
+
arr = [...arr];
|
|
4496
|
+
if (dragIndex === dropIndex || arr[dragIndex] === void 0 || arr[dropIndex] === void 0) {
|
|
4497
|
+
return arr;
|
|
4498
|
+
}
|
|
4499
|
+
const dragItem = arr[dragIndex];
|
|
4500
|
+
if (dropIndex < dragIndex) {
|
|
4501
|
+
arr.splice(dragIndex, 1);
|
|
4502
|
+
arr.splice(dropIndex, 0, dragItem);
|
|
4503
|
+
} else {
|
|
4504
|
+
arr.splice(dragIndex, 1);
|
|
4505
|
+
arr.splice(dropIndex, 0, dragItem);
|
|
4506
|
+
}
|
|
4507
|
+
return arr;
|
|
4508
|
+
};
|
|
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
|
+
|
|
4586
|
+
// src/components/InfiniteTable/hooks/reorderColumnsOnDrag.ts
|
|
4404
4587
|
var PROXY_OFFSET = 10;
|
|
4405
|
-
var
|
|
4406
|
-
|
|
4588
|
+
var pinnedStartWidthCSSVar2 = stripVar(InternalVars.pinnedStartWidth);
|
|
4589
|
+
function reorderColumnsOnDrag(params) {
|
|
4590
|
+
const {
|
|
4591
|
+
columnOffsetAtIndexCSSVar,
|
|
4592
|
+
columnWidthAtIndexCSSVar,
|
|
4593
|
+
computedVisibleColumns,
|
|
4594
|
+
computedVisibleColumnsMap,
|
|
4595
|
+
computedPinnedEndColumns,
|
|
4596
|
+
computedPinnedStartColumns,
|
|
4597
|
+
dragColumnId,
|
|
4598
|
+
infiniteDOMNode,
|
|
4599
|
+
brain,
|
|
4600
|
+
dragColumnHeaderTargetRect,
|
|
4601
|
+
tableRect,
|
|
4602
|
+
setProxyPosition,
|
|
4603
|
+
imperativeApi
|
|
4604
|
+
} = params;
|
|
4605
|
+
function getCurrentPinnedWidth(pinned) {
|
|
4606
|
+
let currentWidth = pinned === "start" ? pinnedStartInitialWidth : pinnedEndInitialWidth;
|
|
4607
|
+
if (initialDragColumnPinned === currentDragColumnPinned) {
|
|
4608
|
+
return currentWidth;
|
|
4609
|
+
}
|
|
4610
|
+
if (currentDragColumnPinned === pinned) {
|
|
4611
|
+
return currentWidth + dragColumn.computedWidth;
|
|
4612
|
+
}
|
|
4613
|
+
if (initialDragColumnPinned === pinned) {
|
|
4614
|
+
return currentWidth - dragColumn.computedWidth;
|
|
4615
|
+
}
|
|
4616
|
+
return currentWidth;
|
|
4617
|
+
}
|
|
4618
|
+
function isColumnVisible2(b) {
|
|
4619
|
+
if (b.index === dragColumnIndex) {
|
|
4620
|
+
return true;
|
|
4621
|
+
}
|
|
4622
|
+
const col = computedVisibleColumns[b.index];
|
|
4623
|
+
if (col.computedPinned) {
|
|
4624
|
+
return true;
|
|
4625
|
+
}
|
|
4626
|
+
const scrollLeft2 = brain.getScrollPosition().scrollLeft;
|
|
4627
|
+
return col.computedOffset >= scrollLeft2 + getCurrentPinnedWidth("start") && col.computedOffset + col.computedWidth < scrollLeft2 + tableRect.width - getCurrentPinnedWidth("end");
|
|
4628
|
+
}
|
|
4629
|
+
const getBreakPoints = (columns) => {
|
|
4630
|
+
const breakpoints = [];
|
|
4631
|
+
columns.forEach((c) => {
|
|
4632
|
+
const b = {
|
|
4633
|
+
columnId: c.id,
|
|
4634
|
+
index: c.computedVisibleIndex,
|
|
4635
|
+
breakpoint: c.computedOffset + Math.round(c.computedWidth / 2)
|
|
4636
|
+
};
|
|
4637
|
+
if (isColumnVisible2(b)) {
|
|
4638
|
+
breakpoints.push(b);
|
|
4639
|
+
}
|
|
4640
|
+
});
|
|
4641
|
+
return breakpoints;
|
|
4642
|
+
};
|
|
4643
|
+
const initialPinnedStartCount = computedPinnedStartColumns.length;
|
|
4644
|
+
let currentPinnedStartCount = initialPinnedStartCount;
|
|
4645
|
+
const initialMousePosition = {
|
|
4646
|
+
clientX: Math.round(params.initialMousePosition.clientX),
|
|
4647
|
+
clientY: Math.round(params.initialMousePosition.clientY)
|
|
4648
|
+
};
|
|
4649
|
+
const initialProxyPosition = {
|
|
4650
|
+
left: initialMousePosition.clientX - tableRect.left - (initialMousePosition.clientX - dragColumnHeaderTargetRect.left) + PROXY_OFFSET,
|
|
4651
|
+
top: initialMousePosition.clientY - tableRect.top - (initialMousePosition.clientY - dragColumnHeaderTargetRect.top) + PROXY_OFFSET
|
|
4652
|
+
};
|
|
4653
|
+
const initialScrollPosition2 = brain.getScrollPosition();
|
|
4654
|
+
const initialIndexes = computedVisibleColumns.map((c) => c.computedVisibleIndex);
|
|
4655
|
+
let currentIndexes = initialIndexes;
|
|
4656
|
+
const dragColumn = computedVisibleColumnsMap.get(dragColumnId);
|
|
4657
|
+
const dragColumnIndex = dragColumn.computedVisibleIndex;
|
|
4658
|
+
const initialDragColumnPinned = dragColumn == null ? void 0 : dragColumn.computedPinned;
|
|
4659
|
+
let currentDropIndex = dragColumnIndex;
|
|
4660
|
+
let currentDragColumnPinned = initialDragColumnPinned;
|
|
4661
|
+
const pinnedStartInitialWidth = brain.getFixedStartColsWidth();
|
|
4662
|
+
const pinnedEndInitialWidth = brain.getFixedEndColsWidth();
|
|
4663
|
+
let currentMousePosition = initialMousePosition;
|
|
4664
|
+
let currentDiff = {
|
|
4665
|
+
x: 0,
|
|
4666
|
+
y: 0
|
|
4667
|
+
};
|
|
4668
|
+
let dir = 1;
|
|
4669
|
+
let diffX = 0;
|
|
4670
|
+
function updatePositionAndDiff(mousePosition) {
|
|
4671
|
+
const clientX = Math.round(mousePosition.clientX);
|
|
4672
|
+
const clientY = Math.round(mousePosition.clientY);
|
|
4673
|
+
if (clientX === currentMousePosition.clientX && clientY === currentMousePosition.clientY) {
|
|
4674
|
+
return;
|
|
4675
|
+
}
|
|
4676
|
+
currentMousePosition = { clientX, clientY };
|
|
4677
|
+
const currentScrollLeft = brain.getScrollPosition().scrollLeft;
|
|
4678
|
+
const scrollLeftDiff = currentScrollLeft - initialScrollPosition2.scrollLeft;
|
|
4679
|
+
currentDiff.x = currentMousePosition.clientX - initialMousePosition.clientX;
|
|
4680
|
+
currentDiff.y = currentMousePosition.clientY - initialMousePosition.clientY;
|
|
4681
|
+
diffX = currentDiff.x + scrollLeftDiff;
|
|
4682
|
+
dir = diffX < 0 ? -1 : 1;
|
|
4683
|
+
setProxyPosition({
|
|
4684
|
+
left: initialProxyPosition.left + currentDiff.x,
|
|
4685
|
+
top: initialProxyPosition.top + currentDiff.y
|
|
4686
|
+
});
|
|
4687
|
+
}
|
|
4688
|
+
function updatePinnedStartCount(columnIndexes) {
|
|
4689
|
+
let pinnedStartCount = 0;
|
|
4690
|
+
if (!initialDragColumnPinned) {
|
|
4691
|
+
columnIndexes.forEach((colIndex, i) => {
|
|
4692
|
+
var _a;
|
|
4693
|
+
if (((_a = computedVisibleColumns[colIndex]) == null ? void 0 : _a.computedPinned) === "start") {
|
|
4694
|
+
pinnedStartCount = i + 1;
|
|
4695
|
+
}
|
|
4696
|
+
});
|
|
4697
|
+
} else if (initialDragColumnPinned === "start") {
|
|
4698
|
+
columnIndexes.forEach((colIndex, i) => {
|
|
4699
|
+
var _a;
|
|
4700
|
+
if (pinnedStartCount) {
|
|
4701
|
+
return;
|
|
4702
|
+
}
|
|
4703
|
+
if (((_a = computedVisibleColumns[colIndex]) == null ? void 0 : _a.computedPinned) !== "start") {
|
|
4704
|
+
pinnedStartCount = i;
|
|
4705
|
+
}
|
|
4706
|
+
});
|
|
4707
|
+
}
|
|
4708
|
+
currentPinnedStartCount = pinnedStartCount;
|
|
4709
|
+
updatePinningMarker("start", columnIndexes, pinnedStartCount);
|
|
4710
|
+
}
|
|
4711
|
+
function updatePinningMarker(where, columnIndexes, pinnedCount) {
|
|
4712
|
+
if (where === "start") {
|
|
4713
|
+
let width = 0;
|
|
4714
|
+
for (let i = 0; i < pinnedCount; i++) {
|
|
4715
|
+
const colIndex = columnIndexes[i];
|
|
4716
|
+
const col = computedVisibleColumns[colIndex];
|
|
4717
|
+
width += col.computedWidth;
|
|
4718
|
+
}
|
|
4719
|
+
setInfiniteVarOnRoot(pinnedStartWidthCSSVar2, `${width}px`, infiniteDOMNode);
|
|
4720
|
+
}
|
|
4721
|
+
}
|
|
4722
|
+
function updateDropIndex(newDropIndex) {
|
|
4723
|
+
if (newDropIndex === currentDropIndex) {
|
|
4724
|
+
return;
|
|
4725
|
+
}
|
|
4726
|
+
currentDropIndex = newDropIndex;
|
|
4727
|
+
const newColumnIndexes = moveXatY(initialIndexes, dragColumnIndex, currentDropIndex > dragColumnIndex ? currentDropIndex - 1 : currentDropIndex);
|
|
4728
|
+
let pinnedStartCount = 0;
|
|
4729
|
+
currentPinnedStartCount = pinnedStartCount;
|
|
4730
|
+
const indexesWithTransition = new Set();
|
|
4731
|
+
newColumnIndexes.forEach((newIndex, i) => {
|
|
4732
|
+
const currentIndex = currentIndexes[i];
|
|
4733
|
+
if (newIndex !== currentIndex) {
|
|
4734
|
+
indexesWithTransition.add(newIndex);
|
|
4735
|
+
}
|
|
4736
|
+
updatePinnedStartCount(newColumnIndexes);
|
|
4737
|
+
});
|
|
4738
|
+
currentIndexes = newColumnIndexes;
|
|
4739
|
+
adjustAllOffsets(indexesWithTransition);
|
|
4407
4740
|
return {
|
|
4408
|
-
|
|
4409
|
-
|
|
4741
|
+
newColumnIndexes,
|
|
4742
|
+
indexesWithTransition,
|
|
4743
|
+
pinnedStartCount: currentPinnedStartCount
|
|
4410
4744
|
};
|
|
4411
|
-
}
|
|
4745
|
+
}
|
|
4746
|
+
function adjustAllOffsets(indexesWithTransition) {
|
|
4747
|
+
computedVisibleColumns.forEach((col) => {
|
|
4748
|
+
const colIndex = col.computedVisibleIndex;
|
|
4749
|
+
if (indexesWithTransition.has(colIndex)) {
|
|
4750
|
+
restoreInfiniteColumnReorderDuration(colIndex, infiniteDOMNode);
|
|
4751
|
+
} else {
|
|
4752
|
+
clearInfiniteColumnReorderDuration(colIndex, infiniteDOMNode);
|
|
4753
|
+
}
|
|
4754
|
+
const isDragColumn = colIndex === dragColumnIndex;
|
|
4755
|
+
let isOutsideCol = dir === -1 ? colIndex < currentDropIndex || colIndex > dragColumnIndex : colIndex < dragColumnIndex || colIndex >= currentDropIndex;
|
|
4756
|
+
let newPosition = "";
|
|
4757
|
+
if (dir === -1) {
|
|
4758
|
+
newPosition = isDragColumn ? `var(${columnOffsetAtIndexCSSVar}-${currentDropIndex})` : isOutsideCol ? `var(${columnOffsetAtIndexCSSVar}-${colIndex})` : `calc( var(${columnOffsetAtIndexCSSVar}-${colIndex}) + var(${columnWidthAtIndexCSSVar}-${dragColumnIndex}) )`;
|
|
4759
|
+
} else {
|
|
4760
|
+
newPosition = isOutsideCol ? `var(${columnOffsetAtIndexCSSVar}-${colIndex})` : isDragColumn ? `calc( var(${columnOffsetAtIndexCSSVar}-${currentDropIndex - 1}) + var(${columnWidthAtIndexCSSVar}-${currentDropIndex - 1}) - var(${columnWidthAtIndexCSSVar}-${dragColumnIndex}) )` : `calc( var(${columnOffsetAtIndexCSSVar}-${colIndex}) - var(${columnWidthAtIndexCSSVar}-${dragColumnIndex}) )`;
|
|
4761
|
+
}
|
|
4762
|
+
setInfiniteColumnOffsetWhileReordering(colIndex, newPosition, infiniteDOMNode);
|
|
4763
|
+
});
|
|
4764
|
+
}
|
|
4765
|
+
const pinnedStartColsRight = tableRect.left + getCurrentPinnedWidth("start");
|
|
4766
|
+
const pinnedEndColsLeft = tableRect.right - getCurrentPinnedWidth("end");
|
|
4767
|
+
const speedScroller = progressiveSpeedScroller({
|
|
4768
|
+
scrollOffsetStart: pinnedStartColsRight,
|
|
4769
|
+
scrollOffsetEnd: pinnedEndColsLeft
|
|
4770
|
+
});
|
|
4771
|
+
updatePositionAndDiff(initialMousePosition);
|
|
4772
|
+
return {
|
|
4773
|
+
speedScroller,
|
|
4774
|
+
stop() {
|
|
4775
|
+
speedScroller.stop();
|
|
4776
|
+
},
|
|
4777
|
+
onMove(mousePosition) {
|
|
4778
|
+
updatePositionAndDiff(mousePosition);
|
|
4779
|
+
speedScroller.scroll({
|
|
4780
|
+
mousePosition: currentMousePosition,
|
|
4781
|
+
get scrollLeft() {
|
|
4782
|
+
return brain.getScrollPosition().scrollLeft;
|
|
4783
|
+
},
|
|
4784
|
+
set scrollLeft(value) {
|
|
4785
|
+
imperativeApi.scrollLeft = value;
|
|
4786
|
+
}
|
|
4787
|
+
});
|
|
4788
|
+
const breakpoints = getBreakPoints(computedVisibleColumns);
|
|
4789
|
+
let currentPos = dir === -1 ? dragColumn.computedOffset + diffX : dragColumn.computedOffset + dragColumn.computedWidth + diffX;
|
|
4790
|
+
let idx = (0, import_binary_search2.default)(breakpoints, currentPos, ({ breakpoint }, value) => {
|
|
4791
|
+
return breakpoint < value ? -1 : breakpoint > value ? 1 : 0;
|
|
4792
|
+
});
|
|
4793
|
+
if (idx < 0) {
|
|
4794
|
+
idx = ~idx;
|
|
4795
|
+
}
|
|
4796
|
+
idx = breakpoints[idx] ? breakpoints[idx].index : breakpoints[breakpoints.length - 1].index + 1;
|
|
4797
|
+
if (idx != null && idx !== currentDropIndex) {
|
|
4798
|
+
if (dir === 1 && currentDropIndex === dragColumnIndex + 1) {
|
|
4799
|
+
idx = dragColumnIndex;
|
|
4800
|
+
}
|
|
4801
|
+
updateDropIndex(idx);
|
|
4802
|
+
}
|
|
4803
|
+
const columnPinning = {};
|
|
4804
|
+
computedPinnedEndColumns.forEach((col) => {
|
|
4805
|
+
columnPinning[col.id] = "end";
|
|
4806
|
+
});
|
|
4807
|
+
for (let i = 0; i < currentPinnedStartCount; i++) {
|
|
4808
|
+
const colIndex = currentIndexes[i];
|
|
4809
|
+
const col = computedVisibleColumns[colIndex];
|
|
4810
|
+
columnPinning[col.id] = "start";
|
|
4811
|
+
}
|
|
4812
|
+
const columnOrder = currentIndexes.map((colIndex) => {
|
|
4813
|
+
return computedVisibleColumns[colIndex].id;
|
|
4814
|
+
});
|
|
4815
|
+
return {
|
|
4816
|
+
columnPinning,
|
|
4817
|
+
columnOrder
|
|
4818
|
+
};
|
|
4819
|
+
}
|
|
4820
|
+
};
|
|
4821
|
+
}
|
|
4822
|
+
|
|
4823
|
+
// src/utils/shallowEqualObjects.ts
|
|
4824
|
+
function shallowEqualObjects(objA, objB, ignoreKeys) {
|
|
4825
|
+
if (objA === objB) {
|
|
4826
|
+
return true;
|
|
4827
|
+
}
|
|
4828
|
+
if (!objA || !objB) {
|
|
4829
|
+
return false;
|
|
4830
|
+
}
|
|
4831
|
+
var aKeys = Object.keys(objA);
|
|
4832
|
+
var bKeys = Object.keys(objB);
|
|
4833
|
+
if (ignoreKeys) {
|
|
4834
|
+
aKeys = aKeys.filter((key2) => !ignoreKeys.has(key2));
|
|
4835
|
+
bKeys = bKeys.filter((key2) => !ignoreKeys.has(key2));
|
|
4836
|
+
}
|
|
4837
|
+
var len = aKeys.length;
|
|
4838
|
+
if (bKeys.length !== len) {
|
|
4839
|
+
return false;
|
|
4840
|
+
}
|
|
4841
|
+
for (var i = 0; i < len; i++) {
|
|
4842
|
+
var key = aKeys[i];
|
|
4843
|
+
if (ignoreKeys) {
|
|
4844
|
+
if (ignoreKeys.has(key)) {
|
|
4845
|
+
continue;
|
|
4846
|
+
}
|
|
4847
|
+
}
|
|
4848
|
+
if (objA[key] !== objB[key] || !Object.prototype.hasOwnProperty.call(objB, key)) {
|
|
4849
|
+
return false;
|
|
4850
|
+
}
|
|
4851
|
+
}
|
|
4852
|
+
return true;
|
|
4853
|
+
}
|
|
4854
|
+
|
|
4855
|
+
// src/components/InfiniteTable/hooks/useColumnPointerEvents.ts
|
|
4856
|
+
var columnOffsetAtIndex4 = stripVar(InternalVars.columnOffsetAtIndex);
|
|
4857
|
+
var columnWidthAtIndex3 = stripVar(InternalVars.columnWidthAtIndex);
|
|
4858
|
+
var baseZIndexForCells2 = stripVar(InternalVars.baseZIndexForCells);
|
|
4859
|
+
var equalPinning = (pinning1, pinning2) => {
|
|
4860
|
+
if (!!pinning1 != !!pinning2) {
|
|
4861
|
+
return false;
|
|
4862
|
+
}
|
|
4863
|
+
return shallowEqualObjects(pinning1, pinning2);
|
|
4412
4864
|
};
|
|
4413
4865
|
var useColumnPointerEvents = ({
|
|
4414
4866
|
columnId,
|
|
4415
|
-
domRef
|
|
4416
|
-
columns,
|
|
4417
|
-
computedRemainingSpace,
|
|
4418
|
-
pinnedStartColsCount,
|
|
4419
|
-
visibleColsCount
|
|
4867
|
+
domRef
|
|
4420
4868
|
}) => {
|
|
4869
|
+
var _a;
|
|
4421
4870
|
const [proxyPosition, setProxyPosition] = useState5(null);
|
|
4422
|
-
const dragging = proxyPosition != null;
|
|
4423
4871
|
const {
|
|
4424
4872
|
componentActions,
|
|
4425
4873
|
computed,
|
|
4426
|
-
|
|
4874
|
+
getComputed,
|
|
4875
|
+
getState,
|
|
4876
|
+
imperativeApi,
|
|
4877
|
+
componentState: { domRef: rootRef, brain, headerBrain }
|
|
4427
4878
|
} = 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
4879
|
const onPointerDown = useCallback6((e) => {
|
|
4441
|
-
var
|
|
4442
|
-
|
|
4880
|
+
var _a2;
|
|
4881
|
+
const {
|
|
4882
|
+
computedVisibleColumns,
|
|
4883
|
+
computedVisibleColumnsMap,
|
|
4884
|
+
computedPinnedStartColumns,
|
|
4885
|
+
computedUnpinnedColumns,
|
|
4886
|
+
computedPinnedEndColumns
|
|
4887
|
+
} = getComputed();
|
|
4888
|
+
const dragColumn = computedVisibleColumnsMap.get(columnId);
|
|
4443
4889
|
const target = domRef.current;
|
|
4444
|
-
const
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4890
|
+
const targetRect = target.getBoundingClientRect();
|
|
4891
|
+
const tableRect = rootRef.current.getBoundingClientRect();
|
|
4892
|
+
const initialAvailableSize = brain.getAvailableSize();
|
|
4893
|
+
const dragColumnIndex = dragColumn.computedVisibleIndex;
|
|
4894
|
+
let initialCursor = (_a2 = target.style.cursor) != null ? _a2 : "auto";
|
|
4895
|
+
let didDragAtLeastOnce = false;
|
|
4896
|
+
const dragger = reorderColumnsOnDrag({
|
|
4897
|
+
brain,
|
|
4898
|
+
columnOffsetAtIndexCSSVar: columnOffsetAtIndex4,
|
|
4899
|
+
columnWidthAtIndexCSSVar: columnWidthAtIndex3,
|
|
4900
|
+
computedPinnedEndColumns,
|
|
4901
|
+
computedPinnedStartColumns,
|
|
4902
|
+
computedUnpinnedColumns,
|
|
4903
|
+
computedVisibleColumns,
|
|
4904
|
+
computedVisibleColumnsMap,
|
|
4905
|
+
dragColumnHeaderTargetRect: targetRect,
|
|
4906
|
+
dragColumnId: columnId,
|
|
4907
|
+
imperativeApi,
|
|
4908
|
+
infiniteDOMNode: rootRef.current,
|
|
4909
|
+
setProxyPosition,
|
|
4910
|
+
tableRect,
|
|
4911
|
+
initialMousePosition: {
|
|
4912
|
+
clientX: e.clientX,
|
|
4913
|
+
clientY: e.clientY
|
|
4914
|
+
}
|
|
4915
|
+
});
|
|
4916
|
+
let reorderDragResult = null;
|
|
4917
|
+
function persistColumnOrder(reorderDragResult2) {
|
|
4918
|
+
const { columnPinning, columnOrder } = reorderDragResult2;
|
|
4919
|
+
if (!equalPinning(getState().columnPinning, columnPinning)) {
|
|
4920
|
+
console.log("update pinning");
|
|
4921
|
+
componentActions.columnPinning = columnPinning;
|
|
4922
|
+
}
|
|
4923
|
+
if (JSON.stringify(columnOrder, getComputed().computedColumnOrder)) {
|
|
4924
|
+
computedVisibleColumns.forEach((col) => {
|
|
4925
|
+
setInfiniteColumnOffsetWhileReordering(col.computedVisibleIndex, "", rootRef.current);
|
|
4926
|
+
});
|
|
4927
|
+
componentActions.columnOrder = columnOrder;
|
|
4463
4928
|
}
|
|
4464
|
-
currentClientPos = { clientX, clientY };
|
|
4465
|
-
currentDiff.x = currentClientPos.clientX - initialClientPos.clientX;
|
|
4466
|
-
currentDiff.y = currentClientPos.clientY - initialClientPos.clientY;
|
|
4467
|
-
setProxyPosition({
|
|
4468
|
-
left: initialProxyPosition.left + currentDiff.x,
|
|
4469
|
-
top: initialProxyPosition.top + currentDiff.y
|
|
4470
|
-
});
|
|
4471
4929
|
}
|
|
4472
|
-
updateColumnOffsets(initialClientPos);
|
|
4473
|
-
let initialCursor = (_a = target.style.cursor) != null ? _a : "auto";
|
|
4474
|
-
let didDragAtLeastOnce = false;
|
|
4475
|
-
let currentDropIndex = dragColumnIndex;
|
|
4476
4930
|
const onPointerMove = (e2) => {
|
|
4477
|
-
var
|
|
4931
|
+
var _a3;
|
|
4478
4932
|
if (!didDragAtLeastOnce) {
|
|
4479
4933
|
didDragAtLeastOnce = true;
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
const diffX = currentDiff.x;
|
|
4488
|
-
const dir = diffX < 0 ? -1 : 1;
|
|
4489
|
-
let currentPos = dir === -1 ? column.computedAbsoluteOffset + diffX : column.computedAbsoluteOffset + column.computedWidth + diffX;
|
|
4490
|
-
let idx = (0, import_binary_search2.default)(breakpoints, currentPos, ({ breakpoint }, value) => {
|
|
4491
|
-
return breakpoint < value ? -1 : breakpoint > value ? 1 : 0;
|
|
4492
|
-
});
|
|
4493
|
-
if (idx < 0) {
|
|
4494
|
-
idx = ~idx;
|
|
4495
|
-
}
|
|
4496
|
-
if (idx !== currentDropIndex) {
|
|
4497
|
-
currentDropIndex = idx;
|
|
4498
|
-
if (dir === 1 && currentDropIndex === dragColumnIndex + 1) {
|
|
4499
|
-
currentDropIndex = dragColumnIndex;
|
|
4500
|
-
}
|
|
4501
|
-
columnsArray.forEach((col) => {
|
|
4502
|
-
const colIndex = col.computedVisibleIndex;
|
|
4503
|
-
if (dir === -1) {
|
|
4504
|
-
let newPosition = colIndex === dragColumnIndex ? `var(${columnOffsetAtIndex4}-${currentDropIndex})` : colIndex < currentDropIndex || colIndex > dragColumnIndex ? `var(${columnOffsetAtIndex4}-${colIndex})` : `calc( var(${columnOffsetAtIndex4}-${colIndex}) + var(${columnWidthAtIndex3}-${dragColumnIndex}) )`;
|
|
4505
|
-
setInfiniteColumnOffsetWhileReordering(colIndex, newPosition, rootRef.current);
|
|
4506
|
-
return;
|
|
4507
|
-
}
|
|
4508
|
-
if (dir === 1) {
|
|
4509
|
-
let newPosition = colIndex < dragColumnIndex || colIndex >= currentDropIndex ? `var(${columnOffsetAtIndex4}-${colIndex})` : colIndex === dragColumnIndex ? `calc( var(${columnOffsetAtIndex4}-${currentDropIndex - 1}) + var(${columnWidthAtIndex3}-${currentDropIndex - 1}) - var(${columnWidthAtIndex3}-${dragColumnIndex}) )` : `calc( var(${columnOffsetAtIndex4}-${colIndex}) - var(${columnWidthAtIndex3}-${dragColumnIndex}) )`;
|
|
4510
|
-
setInfiniteColumnOffsetWhileReordering(colIndex, newPosition, rootRef.current);
|
|
4511
|
-
return;
|
|
4512
|
-
}
|
|
4934
|
+
brain.setRenderCount({
|
|
4935
|
+
horizontal: computedVisibleColumns.length,
|
|
4936
|
+
vertical: void 0
|
|
4937
|
+
});
|
|
4938
|
+
headerBrain.setRenderCount({
|
|
4939
|
+
horizontal: computedVisibleColumns.length,
|
|
4940
|
+
vertical: void 0
|
|
4513
4941
|
});
|
|
4942
|
+
componentActions.columnReorderDragColumnId = dragColumn.id;
|
|
4943
|
+
setInfiniteColumnZIndex(dragColumnIndex, `calc( var(${baseZIndexForCells2}) + 10000 )`, rootRef.current);
|
|
4944
|
+
(_a3 = rootRef.current) == null ? void 0 : _a3.classList.add(InfiniteClsShiftingColumns);
|
|
4945
|
+
target.style.cursor = "grabbing";
|
|
4514
4946
|
}
|
|
4947
|
+
reorderDragResult = dragger.onMove(e2);
|
|
4515
4948
|
};
|
|
4516
4949
|
const onPointerUp = (e2) => {
|
|
4517
|
-
var
|
|
4950
|
+
var _a3;
|
|
4518
4951
|
const target2 = domRef.current;
|
|
4519
|
-
(
|
|
4520
|
-
|
|
4952
|
+
(_a3 = rootRef.current) == null ? void 0 : _a3.classList.remove(InfiniteClsShiftingColumns);
|
|
4953
|
+
dragger.stop();
|
|
4954
|
+
brain.setAvailableSize(__spreadValues({}, initialAvailableSize));
|
|
4955
|
+
computedVisibleColumns.forEach((col) => {
|
|
4956
|
+
clearInfiniteColumnReorderDuration(col.computedVisibleIndex, rootRef.current);
|
|
4521
4957
|
setInfiniteColumnOffsetWhileReordering(col.computedVisibleIndex, "", rootRef.current);
|
|
4522
4958
|
});
|
|
4523
|
-
setInfiniteColumnZIndex(dragColumnIndex, getColumnZIndex(
|
|
4524
|
-
pinnedStartColsCount,
|
|
4525
|
-
visibleColsCount
|
|
4959
|
+
setInfiniteColumnZIndex(dragColumnIndex, getColumnZIndex(dragColumn, {
|
|
4960
|
+
pinnedStartColsCount: computedPinnedStartColumns.length,
|
|
4961
|
+
visibleColsCount: computedVisibleColumns.length
|
|
4526
4962
|
}), rootRef.current);
|
|
4527
4963
|
target2.style.cursor = initialCursor;
|
|
4528
4964
|
target2.releasePointerCapture(e2.pointerId);
|
|
4529
4965
|
target2.removeEventListener("pointermove", onPointerMove);
|
|
4530
4966
|
target2.removeEventListener("pointerup", onPointerUp);
|
|
4531
4967
|
setProxyPosition(null);
|
|
4532
|
-
if (!didDragAtLeastOnce &&
|
|
4533
|
-
|
|
4968
|
+
if (!didDragAtLeastOnce && dragColumn.computedSortable) {
|
|
4969
|
+
dragColumn.toggleSort();
|
|
4534
4970
|
}
|
|
4535
|
-
if (
|
|
4536
|
-
|
|
4537
|
-
columnsArray.forEach((col) => {
|
|
4538
|
-
setInfiniteColumnOffsetWhileReordering(col.computedVisibleIndex, "", rootRef.current);
|
|
4539
|
-
});
|
|
4540
|
-
componentActions.columnOrder = newOrder;
|
|
4971
|
+
if (reorderDragResult) {
|
|
4972
|
+
persistColumnOrder(reorderDragResult);
|
|
4541
4973
|
}
|
|
4542
|
-
componentActions.
|
|
4543
|
-
breakpoints = [];
|
|
4974
|
+
componentActions.columnReorderDragColumnId = false;
|
|
4544
4975
|
};
|
|
4545
4976
|
target.addEventListener("pointermove", onPointerMove);
|
|
4546
4977
|
target.addEventListener("pointerup", onPointerUp);
|
|
4547
4978
|
target.setPointerCapture(e.pointerId);
|
|
4548
|
-
}, [
|
|
4549
|
-
columns,
|
|
4550
|
-
column,
|
|
4551
|
-
dragColumnIndex,
|
|
4552
|
-
visibleColsCount,
|
|
4553
|
-
pinnedStartColsCount,
|
|
4554
|
-
columnsArray,
|
|
4555
|
-
computedRemainingSpace,
|
|
4556
|
-
computedColumnOrder
|
|
4557
|
-
]);
|
|
4979
|
+
}, [columnId]);
|
|
4558
4980
|
return {
|
|
4559
|
-
onPointerDown:
|
|
4981
|
+
onPointerDown: ((_a = computed.computedVisibleColumnsMap.get(columnId)) == null ? void 0 : _a.computedDraggable) ? onPointerDown : () => {
|
|
4560
4982
|
},
|
|
4561
|
-
dragging,
|
|
4562
4983
|
proxyPosition
|
|
4563
4984
|
};
|
|
4564
4985
|
};
|
|
@@ -4613,19 +5034,19 @@ import { useEffect as useEffect9, useState as useState6 } from "react";
|
|
|
4613
5034
|
|
|
4614
5035
|
// src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts
|
|
4615
5036
|
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 = "
|
|
5037
|
+
var CellCls = "_1eexc2a5 _16lm1iwt _16lm1iw1d _16lm1iw1e _16lm1iw2 _16lm1iw1o _16lm1iw1p";
|
|
5038
|
+
var HeaderCellContentRecipe = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "_12zfob11b _16lm1iwz _16lm1iw11 _16lm1iwt _16lm1iw1d _16lm1iw1e", variantClassNames: { filtered: { false: "_12zfob11c", true: "_12zfob11d" } }, defaultVariants: {}, compoundVariants: [] });
|
|
5039
|
+
var HeaderCellProxy = "_12zfob1k _16lm1iw1p _16lm1iw1q _16lm1iw1j";
|
|
5040
|
+
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"]] });
|
|
5041
|
+
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"]] });
|
|
5042
|
+
var HeaderFilterCls = "_12zfob11g _16lm1iwt _16lm1iw1d _16lm1iw1e _16lm1iw1";
|
|
5043
|
+
var HeaderFilterEditorCls = "_16lm1iw11 _16lm1iwz";
|
|
5044
|
+
var HeaderGroupCls = "_12zfob11f _16lm1iwt _16lm1iw1d _16lm1iw1e";
|
|
4624
5045
|
var HeaderScrollbarPlaceholderCls = "_12zfob15 _16lm1iw2";
|
|
4625
5046
|
var HeaderSortIconCls = "_16lm1iw1";
|
|
4626
5047
|
var HeaderSortIconIndexCls = "_12zfob14";
|
|
4627
5048
|
var HeaderSortIconRecipe = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "", variantClassNames: { align: { start: "_12zfob11", center: "_12zfob12", end: "_12zfob13" } }, defaultVariants: {}, compoundVariants: [] });
|
|
4628
|
-
var HeaderWrapperCls = "
|
|
5049
|
+
var HeaderWrapperCls = "_12zfob11e _16lm1iw1j _16lm1iw1 _16lm1iwt _16lm1iw1d";
|
|
4629
5050
|
|
|
4630
5051
|
// src/components/InfiniteTable/components/icons/SortIcon.tsx
|
|
4631
5052
|
var defaultLineStyle = {
|
|
@@ -4707,14 +5128,15 @@ import {
|
|
|
4707
5128
|
|
|
4708
5129
|
// src/components/InfiniteTable/components/cell.css.ts
|
|
4709
5130
|
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: "
|
|
5131
|
+
var ColumnCellCls = "_1eexc2a6 _1eexc2a5 _16lm1iwt _16lm1iw1d _16lm1iw1e _16lm1iw2 _16lm1iw1o _16lm1iw1p";
|
|
5132
|
+
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
5133
|
|
|
4713
5134
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
|
|
4714
5135
|
var { rootClassName: rootClassName5 } = internalProps;
|
|
4715
5136
|
var InfiniteTableCellClassName = `${rootClassName5}Cell`;
|
|
4716
5137
|
var InfiniteTableCellContentClassName = `${rootClassName5}Cell_content`;
|
|
4717
5138
|
var columnWidthAtIndex4 = stripVar(InternalVars.columnWidthAtIndex);
|
|
5139
|
+
var columnReorderEffectDurationAtIndex2 = stripVar(InternalVars.columnReorderEffectDurationAtIndex);
|
|
4718
5140
|
function InfiniteTableCellFn(props) {
|
|
4719
5141
|
var _b, _c, _d;
|
|
4720
5142
|
const _a = props, {
|
|
@@ -4748,7 +5170,8 @@ function InfiniteTableCellFn(props) {
|
|
|
4748
5170
|
]);
|
|
4749
5171
|
const children = renderChildren();
|
|
4750
5172
|
const style = __spreadValues({
|
|
4751
|
-
width: `var(${columnWidthAtIndex4}-${column.computedVisibleIndex})
|
|
5173
|
+
width: `var(${columnWidthAtIndex4}-${column.computedVisibleIndex})`,
|
|
5174
|
+
transition: `transform var(${columnReorderEffectDurationAtIndex2}-${column.computedVisibleIndex}, 0s)`
|
|
4752
5175
|
}, domProps.style);
|
|
4753
5176
|
const finalDOMProps = __spreadProps(__spreadValues({}, domProps), {
|
|
4754
5177
|
style,
|
|
@@ -5190,11 +5613,36 @@ function getColumnResizer(colIndex, {
|
|
|
5190
5613
|
return;
|
|
5191
5614
|
}
|
|
5192
5615
|
setInfiniteColumnWidth(nextColIndex, nextColumn.computedWidth - diff, domRef.current);
|
|
5193
|
-
|
|
5616
|
+
if (nextColumn.computedPinned === "start") {
|
|
5617
|
+
addToInfiniteColumnOffset(nextColumn, diff, domRef.current);
|
|
5618
|
+
} else {
|
|
5619
|
+
setInfiniteColumnOffset(nextColIndex, nextColumn.computedOffset + diff, domRef.current);
|
|
5620
|
+
}
|
|
5621
|
+
return;
|
|
5622
|
+
}
|
|
5623
|
+
if (column.computedPinned === "end") {
|
|
5624
|
+
return;
|
|
5625
|
+
}
|
|
5626
|
+
if (column.computedPinned === "start") {
|
|
5627
|
+
for (let i = nextColIndex, len = columns.length; i < len; i++) {
|
|
5628
|
+
const col = columns[i];
|
|
5629
|
+
if (col.computedPinned === "start") {
|
|
5630
|
+
addToInfiniteColumnOffset(col, diff, domRef.current);
|
|
5631
|
+
continue;
|
|
5632
|
+
}
|
|
5633
|
+
if (col.computedPinned === "end") {
|
|
5634
|
+
continue;
|
|
5635
|
+
}
|
|
5636
|
+
setInfiniteColumnOffset(i, col.computedOffset + diff, domRef.current);
|
|
5637
|
+
}
|
|
5194
5638
|
return;
|
|
5195
5639
|
}
|
|
5196
5640
|
for (let i = nextColIndex, len = columns.length; i < len; i++) {
|
|
5197
|
-
|
|
5641
|
+
const col = columns[i];
|
|
5642
|
+
if (col.computedPinned) {
|
|
5643
|
+
continue;
|
|
5644
|
+
}
|
|
5645
|
+
setInfiniteColumnOffset(i, col.computedOffset + diff, domRef.current);
|
|
5198
5646
|
}
|
|
5199
5647
|
}
|
|
5200
5648
|
};
|
|
@@ -5204,7 +5652,8 @@ function getColumnGroupResizer(colIndexes, config) {
|
|
|
5204
5652
|
return {
|
|
5205
5653
|
resize(diffs) {
|
|
5206
5654
|
const { columns, domRef } = config;
|
|
5207
|
-
|
|
5655
|
+
const firstCol = columns[colIndexes[0]];
|
|
5656
|
+
let offset = firstCol.computedOffset;
|
|
5208
5657
|
let diffSum = 0;
|
|
5209
5658
|
const node = domRef.current;
|
|
5210
5659
|
diffs.forEach((diff, i) => {
|
|
@@ -5213,13 +5662,23 @@ function getColumnGroupResizer(colIndexes, config) {
|
|
|
5213
5662
|
const column = columns[colIndex];
|
|
5214
5663
|
const newWidth = column.computedWidth + diff;
|
|
5215
5664
|
setInfiniteColumnWidth(colIndex, newWidth, node);
|
|
5665
|
+
if (column.computedPinned === "end") {
|
|
5666
|
+
return;
|
|
5667
|
+
}
|
|
5216
5668
|
if (offset) {
|
|
5217
5669
|
setInfiniteColumnOffset(colIndex, offset, node);
|
|
5218
5670
|
}
|
|
5219
5671
|
offset += newWidth;
|
|
5220
5672
|
});
|
|
5673
|
+
if (firstCol.computedPinned === "end") {
|
|
5674
|
+
return;
|
|
5675
|
+
}
|
|
5221
5676
|
for (let i = lastColIndex + 1; i < columns.length; i++) {
|
|
5222
|
-
|
|
5677
|
+
const col = columns[i];
|
|
5678
|
+
if (col.computedPinned === "end") {
|
|
5679
|
+
continue;
|
|
5680
|
+
}
|
|
5681
|
+
setInfiniteColumnOffset(i, col.computedOffset + diffSum, node);
|
|
5223
5682
|
}
|
|
5224
5683
|
}
|
|
5225
5684
|
};
|
|
@@ -5227,8 +5686,9 @@ function getColumnGroupResizer(colIndexes, config) {
|
|
|
5227
5686
|
|
|
5228
5687
|
// src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/ResizeHandle.css.ts
|
|
5229
5688
|
var import_createRuntimeFn4 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
5230
|
-
var ResizeHandleCls = "zneyzh0 _16lm1iw2
|
|
5231
|
-
var ResizeHandleDraggerClsRecipe = (0, import_createRuntimeFn4.createRuntimeFn)({ defaultClassName: "
|
|
5689
|
+
var ResizeHandleCls = "zneyzh0 _16lm1iw2 _16lm1iw12 _16lm1iw19 _16lm1iw17 _16lm1iwe _16lm1iw1j";
|
|
5690
|
+
var ResizeHandleDraggerClsRecipe = (0, import_createRuntimeFn4.createRuntimeFn)({ defaultClassName: "zneyzhb _16lm1iw2 _16lm1iw12 _16lm1iw17", variantClassNames: { constrained: { false: "zneyzhc", true: "zneyzhd" } }, defaultVariants: {}, compoundVariants: [] });
|
|
5691
|
+
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
5692
|
|
|
5233
5693
|
// src/components/InfiniteTable/components/InfiniteTableHeader/ResizeHandle/index.tsx
|
|
5234
5694
|
var { rootClassName: rootClassName7 } = internalProps;
|
|
@@ -5238,6 +5698,13 @@ function ResizeHandleFn(props) {
|
|
|
5238
5698
|
const [constrained, setConstrained] = useState8(false);
|
|
5239
5699
|
const constrainedRef = useRef11(constrained);
|
|
5240
5700
|
constrainedRef.current = constrained;
|
|
5701
|
+
const col = props.columns[props.columnIndex];
|
|
5702
|
+
if (!col) {
|
|
5703
|
+
return null;
|
|
5704
|
+
}
|
|
5705
|
+
const computedPinned = col.computedPinned;
|
|
5706
|
+
const computedFirstInCategory = col.computedFirstInCategory;
|
|
5707
|
+
const computedLastInCategory = col.computedLastInCategory;
|
|
5241
5708
|
const onPointerDown = (e) => {
|
|
5242
5709
|
e.stopPropagation();
|
|
5243
5710
|
const shareSpaceOnResize = !!e.shiftKey;
|
|
@@ -5251,6 +5718,9 @@ function ResizeHandleFn(props) {
|
|
|
5251
5718
|
domRef
|
|
5252
5719
|
});
|
|
5253
5720
|
const resizeDiff = (diff) => {
|
|
5721
|
+
if (computedPinned === "end") {
|
|
5722
|
+
diff *= -1;
|
|
5723
|
+
}
|
|
5254
5724
|
const { adjustedDiff, constrained: constrained2 } = props.computeResize({
|
|
5255
5725
|
diff,
|
|
5256
5726
|
shareSpaceOnResize
|
|
@@ -5275,11 +5745,19 @@ function ResizeHandleFn(props) {
|
|
|
5275
5745
|
target.addEventListener("pointermove", onPointerMove);
|
|
5276
5746
|
target.addEventListener("pointerup", onPointerUp);
|
|
5277
5747
|
};
|
|
5748
|
+
const style = (computedPinned === false || computedPinned === "start") && computedLastInCategory ? {
|
|
5749
|
+
right: computedPinned === "start" ? 0 : 0
|
|
5750
|
+
} : computedPinned === "end" && computedFirstInCategory ? { right: "none", left: 0 } : void 0;
|
|
5278
5751
|
return /* @__PURE__ */ React20.createElement("div", {
|
|
5279
5752
|
ref: domRef,
|
|
5280
|
-
className: `${InfiniteTableHeaderCellResizeHandleCls} ${ResizeHandleCls}
|
|
5753
|
+
className: `${InfiniteTableHeaderCellResizeHandleCls} ${ResizeHandleCls} ${ResizeHandleRecipeCls({
|
|
5754
|
+
computedPinned,
|
|
5755
|
+
computedFirstInCategory,
|
|
5756
|
+
computedLastInCategory
|
|
5757
|
+
})}`,
|
|
5281
5758
|
onPointerDown
|
|
5282
5759
|
}, /* @__PURE__ */ React20.createElement("div", {
|
|
5760
|
+
style,
|
|
5283
5761
|
className: ResizeHandleDraggerClsRecipe({
|
|
5284
5762
|
constrained
|
|
5285
5763
|
})
|
|
@@ -5357,11 +5835,19 @@ var InfiniteTableHeaderCellContext = createContext4(null);
|
|
|
5357
5835
|
var { rootClassName: rootClassName8 } = internalProps;
|
|
5358
5836
|
var InfiniteTableHeaderCellClassName = `${rootClassName8}HeaderCell`;
|
|
5359
5837
|
var columnZIndexAtIndex4 = stripVar(InternalVars.columnZIndexAtIndex);
|
|
5360
|
-
var columnOffsetAtIndex5 = stripVar(InternalVars.columnOffsetAtIndex);
|
|
5361
5838
|
function InfiniteTableHeaderCell(props) {
|
|
5362
5839
|
var _a, _b, _c, _d, _e;
|
|
5363
5840
|
const column = props.column;
|
|
5364
|
-
const
|
|
5841
|
+
const {
|
|
5842
|
+
computed: { showColumnFilters },
|
|
5843
|
+
componentState: {
|
|
5844
|
+
portalDOMRef,
|
|
5845
|
+
columnHeaderHeight,
|
|
5846
|
+
filterEditors,
|
|
5847
|
+
columnReorderDragColumnId
|
|
5848
|
+
}
|
|
5849
|
+
} = useInfiniteTable();
|
|
5850
|
+
const dragging = columnReorderDragColumnId === column.id;
|
|
5365
5851
|
const { onResize, height, width, headerOptions } = props;
|
|
5366
5852
|
const sortInfo = column.computedSortInfo;
|
|
5367
5853
|
let header = column.header;
|
|
@@ -5379,6 +5865,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
5379
5865
|
direction: column.computedSorted ? column.computedSortedAsc ? 1 : -1 : 0
|
|
5380
5866
|
}) : null;
|
|
5381
5867
|
const renderParam = {
|
|
5868
|
+
dragging,
|
|
5382
5869
|
domRef: ref,
|
|
5383
5870
|
column,
|
|
5384
5871
|
columnSortInfo: sortInfo,
|
|
@@ -5397,15 +5884,6 @@ function InfiniteTableHeaderCell(props) {
|
|
|
5397
5884
|
return /* @__PURE__ */ createElement16(Fragment2, null, align === "end" ? sortTool : null, header, align !== "end" ? sortTool : null);
|
|
5398
5885
|
};
|
|
5399
5886
|
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
5887
|
const {
|
|
5410
5888
|
componentActions: dataSourceActions,
|
|
5411
5889
|
getState: getDataSourceState,
|
|
@@ -5421,26 +5899,27 @@ function InfiniteTableHeaderCell(props) {
|
|
|
5421
5899
|
clearOnResize == null ? void 0 : clearOnResize();
|
|
5422
5900
|
};
|
|
5423
5901
|
}, [domRef.current, props.onResize]);
|
|
5424
|
-
|
|
5902
|
+
let style = {
|
|
5425
5903
|
height
|
|
5426
5904
|
};
|
|
5427
|
-
|
|
5428
|
-
|
|
5429
|
-
|
|
5430
|
-
|
|
5905
|
+
if (column.headerStyle) {
|
|
5906
|
+
style = typeof column.headerStyle === "function" ? __spreadValues(__spreadValues({}, style), column.headerStyle(renderParam) || {}) : __spreadValues(__spreadValues({}, style), column.headerStyle);
|
|
5907
|
+
}
|
|
5908
|
+
const headerClassName = typeof column.headerClassName === "function" ? column.headerClassName(renderParam) : column.headerClassName;
|
|
5909
|
+
const { onPointerDown, proxyPosition } = useColumnPointerEvents({
|
|
5431
5910
|
columnId: column.id,
|
|
5432
|
-
domRef
|
|
5433
|
-
columns
|
|
5911
|
+
domRef
|
|
5434
5912
|
});
|
|
5435
5913
|
let draggingProxy = null;
|
|
5436
|
-
if (dragging) {
|
|
5914
|
+
if (dragging && proxyPosition) {
|
|
5437
5915
|
draggingProxy = /* @__PURE__ */ createElement16("div", {
|
|
5916
|
+
key: column.id,
|
|
5438
5917
|
className: `${InfiniteTableHeaderCellClassName}Proxy ${HeaderCellProxy}`,
|
|
5439
5918
|
style: {
|
|
5440
5919
|
position: "absolute",
|
|
5441
5920
|
height,
|
|
5442
5921
|
width,
|
|
5443
|
-
left:
|
|
5922
|
+
left: (_a = proxyPosition.left) != null ? _a : 0,
|
|
5444
5923
|
top: (_b = proxyPosition.top) != null ? _b : 0,
|
|
5445
5924
|
zIndex: 1e9
|
|
5446
5925
|
}
|
|
@@ -5475,7 +5954,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
5475
5954
|
});
|
|
5476
5955
|
dataSourceActions.filterValue = newFilterValue;
|
|
5477
5956
|
}, [column, filterTypes]);
|
|
5478
|
-
const debouncedOnFilterValueChange =
|
|
5957
|
+
const debouncedOnFilterValueChange = useMemo4(() => {
|
|
5479
5958
|
const fn = (filterValue) => {
|
|
5480
5959
|
let newFilterValueForColumn;
|
|
5481
5960
|
if (column.computedFilterValue) {
|
|
@@ -5529,7 +6008,11 @@ function InfiniteTableHeaderCell(props) {
|
|
|
5529
6008
|
onPointerDown,
|
|
5530
6009
|
contentClassName: join(HeaderCellContentRecipe(contentRecipeVariants), justifyContent[(_c = column.align) != null ? _c : "start"]),
|
|
5531
6010
|
contentStyle: showColumnFilters ? { height: height / 2 } : void 0,
|
|
5532
|
-
className: join(InfiniteTableHeaderCellClassName, userSelect.none, column.computedSortable ? cursor.pointer : "", useCellClassName(column, [InfiniteTableHeaderCellClassName, InfiniteTableCellClassName], HeaderCellRecipe, {
|
|
6011
|
+
className: join(InfiniteTableHeaderCellClassName, userSelect.none, column.computedSortable ? cursor.pointer : "", headerClassName, useCellClassName(column, [InfiniteTableHeaderCellClassName, InfiniteTableCellClassName], HeaderCellRecipe, {
|
|
6012
|
+
dragging,
|
|
6013
|
+
zebra: false,
|
|
6014
|
+
rowActive: false
|
|
6015
|
+
}), CellCls),
|
|
5533
6016
|
cssEllipsis: (_e = (_d = column.headerCssEllipsis) != null ? _d : column.cssEllipsis) != null ? _e : true,
|
|
5534
6017
|
afterChildren: /* @__PURE__ */ createElement16(Fragment2, null, showColumnFilters ? column.computedFilterable ? /* @__PURE__ */ createElement16(InfiniteTableColumnHeaderFilter, {
|
|
5535
6018
|
filterEditor: FilterEditor,
|
|
@@ -5552,50 +6035,30 @@ function useInfiniteHeaderCell() {
|
|
|
5552
6035
|
import {
|
|
5553
6036
|
createElement as createElement20,
|
|
5554
6037
|
useCallback as useCallback11,
|
|
5555
|
-
useMemo as
|
|
6038
|
+
useMemo as useMemo5
|
|
5556
6039
|
} from "react";
|
|
5557
6040
|
|
|
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
6041
|
// src/components/InfiniteTable/components/InfiniteTableHeader/buildColumnAndGroupTree.ts
|
|
5581
6042
|
function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap, columnGroupsMaxDepth) {
|
|
5582
6043
|
const map2 = new Map();
|
|
5583
6044
|
const temporaryMap = new Map();
|
|
5584
6045
|
const mapOfAllParentGroupsForColumns = new Map();
|
|
5585
6046
|
columns.forEach((col, index) => {
|
|
5586
|
-
var _a, _b, _c, _d
|
|
6047
|
+
var _a, _b, _c, _d;
|
|
5587
6048
|
const colId = col.id;
|
|
5588
|
-
const
|
|
6049
|
+
const previousColumn = columns[index - 1];
|
|
6050
|
+
const previousColumnId = (_a = previousColumn == null ? void 0 : previousColumn.id) != null ? _a : "";
|
|
5589
6051
|
const parentGroups = new Set();
|
|
5590
|
-
const parentGroupsOfPreviousColumn = (
|
|
6052
|
+
const parentGroupsOfPreviousColumn = (previousColumn == null ? void 0 : previousColumn.computedPinned) !== col.computedPinned ? new Set() : (_b = mapOfAllParentGroupsForColumns.get(previousColumnId)) != null ? _b : new Set();
|
|
5591
6053
|
mapOfAllParentGroupsForColumns.set(colId, parentGroups);
|
|
5592
6054
|
const colItem = {
|
|
5593
6055
|
type: "column",
|
|
5594
6056
|
id: colId,
|
|
5595
6057
|
ref: col,
|
|
5596
6058
|
groupOffset: 0,
|
|
6059
|
+
computedPinned: col.computedPinned,
|
|
5597
6060
|
computedWidth: col.computedWidth,
|
|
5598
|
-
depth: col.columnGroup ? ((
|
|
6061
|
+
depth: col.columnGroup ? ((_c = columnGroupsDepthsMap.get(col.columnGroup)) != null ? _c : 0) + 1 : 0
|
|
5599
6062
|
};
|
|
5600
6063
|
map2.set([colId], colItem);
|
|
5601
6064
|
let groupId = col.columnGroup;
|
|
@@ -5617,7 +6080,8 @@ function buildColumnAndGroupTree(columns, columnGroups, columnGroupsDepthsMap, c
|
|
|
5617
6080
|
groupOffset: 0,
|
|
5618
6081
|
uniqueGroupId: [groupId],
|
|
5619
6082
|
computedWidth: 0,
|
|
5620
|
-
|
|
6083
|
+
computedPinned: colItem.computedPinned,
|
|
6084
|
+
depth: (_d = columnGroupsDepthsMap.get(groupId)) != null ? _d : 0
|
|
5621
6085
|
};
|
|
5622
6086
|
map2.set(groupAbsoluteId, colGroupItem);
|
|
5623
6087
|
temporaryMap.set(groupId, colGroupItem);
|
|
@@ -5701,6 +6165,13 @@ function GroupResizeHandleFn(props) {
|
|
|
5701
6165
|
const [constrained, setConstrained] = useState9(false);
|
|
5702
6166
|
const constrainedRef = useRef13(constrained);
|
|
5703
6167
|
constrainedRef.current = constrained;
|
|
6168
|
+
const col = props.groupColumns[0];
|
|
6169
|
+
if (!col) {
|
|
6170
|
+
return null;
|
|
6171
|
+
}
|
|
6172
|
+
const computedPinned = col.computedPinned;
|
|
6173
|
+
const computedFirstInCategory = col.computedFirstInCategory;
|
|
6174
|
+
const computedLastInCategory = col.computedLastInCategory;
|
|
5704
6175
|
const onPointerDown = (e) => {
|
|
5705
6176
|
e.stopPropagation();
|
|
5706
6177
|
const pointerId = e.pointerId;
|
|
@@ -5713,6 +6184,9 @@ function GroupResizeHandleFn(props) {
|
|
|
5713
6184
|
domRef
|
|
5714
6185
|
});
|
|
5715
6186
|
const resizeDiff = (diff) => {
|
|
6187
|
+
if (computedPinned === "end") {
|
|
6188
|
+
diff *= -1;
|
|
6189
|
+
}
|
|
5716
6190
|
const { constrained: constrained2, adjustedDiffs, adjustedDiff } = props.computeResize(diff);
|
|
5717
6191
|
if (constrainedRef.current !== constrained2) {
|
|
5718
6192
|
setConstrained(constrained2);
|
|
@@ -5722,8 +6196,8 @@ function GroupResizeHandleFn(props) {
|
|
|
5722
6196
|
};
|
|
5723
6197
|
const onPointerMove = (e2) => {
|
|
5724
6198
|
if (initialMove) {
|
|
5725
|
-
const maxDiff = props.groupColumns.reduce((diff,
|
|
5726
|
-
return diff +
|
|
6199
|
+
const maxDiff = props.groupColumns.reduce((diff, col2) => {
|
|
6200
|
+
return diff + col2.computedWidth - col2.computedMinWidth;
|
|
5727
6201
|
}, 0);
|
|
5728
6202
|
const currentSize = props.brain.getAvailableSize();
|
|
5729
6203
|
const newSize = {
|
|
@@ -5746,12 +6220,19 @@ function GroupResizeHandleFn(props) {
|
|
|
5746
6220
|
target.addEventListener("pointermove", onPointerMove);
|
|
5747
6221
|
target.addEventListener("pointerup", onPointerUp);
|
|
5748
6222
|
};
|
|
6223
|
+
const style = (computedPinned === false || computedPinned === "start") && computedLastInCategory ? {
|
|
6224
|
+
right: computedPinned === "start" ? 0 : ThemeVars.components.HeaderCell.resizeHandleWidth
|
|
6225
|
+
} : computedPinned === "end" && computedFirstInCategory ? { right: "none", left: 0 } : void 0;
|
|
5749
6226
|
return /* @__PURE__ */ React23.createElement("div", {
|
|
5750
6227
|
ref: domRef,
|
|
5751
|
-
className: `${InfiniteTableHeaderCellResizeHandleCls2} ${ResizeHandleCls}
|
|
6228
|
+
className: `${InfiniteTableHeaderCellResizeHandleCls2} ${ResizeHandleCls} ${ResizeHandleRecipeCls({
|
|
6229
|
+
computedPinned,
|
|
6230
|
+
computedFirstInCategory,
|
|
6231
|
+
computedLastInCategory
|
|
6232
|
+
})}`,
|
|
5752
6233
|
onPointerDown
|
|
5753
6234
|
}, /* @__PURE__ */ React23.createElement("div", {
|
|
5754
|
-
style: props.style,
|
|
6235
|
+
style: __spreadValues(__spreadValues({}, style), props.style),
|
|
5755
6236
|
className: ResizeHandleDraggerClsRecipe({
|
|
5756
6237
|
constrained
|
|
5757
6238
|
})
|
|
@@ -5883,8 +6364,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
5883
6364
|
}, [brain]);
|
|
5884
6365
|
const domRef = useRef14(null);
|
|
5885
6366
|
const headerCls = HeaderClsRecipe({
|
|
5886
|
-
overflow: false
|
|
5887
|
-
virtualized: true
|
|
6367
|
+
overflow: false
|
|
5888
6368
|
});
|
|
5889
6369
|
const domProps = {
|
|
5890
6370
|
ref: domRef,
|
|
@@ -5972,7 +6452,7 @@ function TableHeaderWrapper(props) {
|
|
|
5972
6452
|
} = tableContextValue;
|
|
5973
6453
|
const rows = !computedColumnGroups || !computedColumnGroups.size ? 1 : columnGroupsMaxDepth + 2;
|
|
5974
6454
|
const height = rows * columnHeaderHeight + (showColumnFilters ? columnHeaderHeight : 0);
|
|
5975
|
-
const columnAndGroupTreeInfo =
|
|
6455
|
+
const columnAndGroupTreeInfo = useMemo5(() => {
|
|
5976
6456
|
if (!computedColumnGroups || !computedColumnGroups.size) {
|
|
5977
6457
|
return void 0;
|
|
5978
6458
|
}
|
|
@@ -6109,7 +6589,7 @@ var InfiniteTableLicenseFooter = forwardRef4(function InfiniteTableLicenseFooter
|
|
|
6109
6589
|
}, []);
|
|
6110
6590
|
useEffect13(() => {
|
|
6111
6591
|
const forceStyle = () => {
|
|
6112
|
-
|
|
6592
|
+
raf(() => {
|
|
6113
6593
|
var _a;
|
|
6114
6594
|
enforceStyle(domRef.current, defaultStyle);
|
|
6115
6595
|
enforceStyle((_a = domRef.current) == null ? void 0 : _a.firstElementChild, anchorStyle);
|
|
@@ -6140,7 +6620,7 @@ import {
|
|
|
6140
6620
|
createElement as createElement22,
|
|
6141
6621
|
memo as memo9
|
|
6142
6622
|
} from "react";
|
|
6143
|
-
import { useCallback as useCallback13, useContext as useContext5, useMemo as
|
|
6623
|
+
import { useCallback as useCallback13, useContext as useContext5, useMemo as useMemo6 } from "react";
|
|
6144
6624
|
var { rootClassName: rootClassName11 } = internalProps;
|
|
6145
6625
|
var columnZIndexAtIndex6 = stripVar(InternalVars.columnZIndexAtIndex);
|
|
6146
6626
|
var InfiniteTableColumnCellContext = createContext5(null);
|
|
@@ -6273,7 +6753,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
6273
6753
|
style = column.style ? typeof column.style === "function" ? __spreadValues(__spreadValues({}, style), column.style(stylingRenderParam) || {}) : __spreadValues(__spreadValues({}, style), column.style) : style || {};
|
|
6274
6754
|
style.height = rowHeight;
|
|
6275
6755
|
style.zIndex = `var(${columnZIndexAtIndex6}-${column.computedVisibleIndex})`;
|
|
6276
|
-
const memoizedStyle =
|
|
6756
|
+
const memoizedStyle = useMemo6(() => style, [!style ? null : JSON.stringify(style)]);
|
|
6277
6757
|
const odd = (rowInfo.indexInAll != null ? rowInfo.indexInAll : rowIndex) % 2 === 1;
|
|
6278
6758
|
const zebra = showZebraRows ? odd ? "odd" : "even" : false;
|
|
6279
6759
|
const cellProps = {
|
|
@@ -6313,8 +6793,8 @@ import {
|
|
|
6313
6793
|
} from "react";
|
|
6314
6794
|
|
|
6315
6795
|
// src/components/InfiniteTable/components/LoadMask.css.ts
|
|
6316
|
-
var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2
|
|
6317
|
-
var LoadMaskOverlayCls = "qy58ya3 _16lm1iw2
|
|
6796
|
+
var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2 _16lm1iw12 _16lm1iw14 _16lm1iw19 _16lm1iw17", hidden: "qy58ya2 qy58ya0 _16lm1iw2 _16lm1iw12 _16lm1iw14 _16lm1iw19 _16lm1iw17" };
|
|
6797
|
+
var LoadMaskOverlayCls = "qy58ya3 _16lm1iw2 _16lm1iw12 _16lm1iw14 _16lm1iw19 _16lm1iw17";
|
|
6318
6798
|
var LoadMaskTextCls = "qy58ya4";
|
|
6319
6799
|
|
|
6320
6800
|
// src/components/InfiniteTable/components/LoadMask.tsx
|
|
@@ -6343,6 +6823,22 @@ function getImperativeApi(getState, getComputed, getDataSourceState, componentAc
|
|
|
6343
6823
|
},
|
|
6344
6824
|
getState,
|
|
6345
6825
|
getDataSourceState,
|
|
6826
|
+
get scrollLeft() {
|
|
6827
|
+
const state = getState();
|
|
6828
|
+
return state.brain.getScrollPosition().scrollLeft;
|
|
6829
|
+
},
|
|
6830
|
+
set scrollLeft(scrollLeft2) {
|
|
6831
|
+
const state = getState();
|
|
6832
|
+
state.scrollerDOMRef.current.scrollLeft = Math.max(scrollLeft2, 0);
|
|
6833
|
+
},
|
|
6834
|
+
get scrollTop() {
|
|
6835
|
+
const state = getState();
|
|
6836
|
+
return state.brain.getScrollPosition().scrollTop;
|
|
6837
|
+
},
|
|
6838
|
+
set scrollTop(scrollTop2) {
|
|
6839
|
+
const state = getState();
|
|
6840
|
+
state.scrollerDOMRef.current.scrollTop = Math.max(scrollTop2, 0);
|
|
6841
|
+
},
|
|
6346
6842
|
scrollRowIntoView(rowIndex, config = { offset: 0 }) {
|
|
6347
6843
|
const state = getState();
|
|
6348
6844
|
const scrollPosition = state.renderer.getScrollPositionForScrollRowIntoView(rowIndex, config);
|
|
@@ -6637,12 +7133,12 @@ function useCellRendering(param) {
|
|
|
6637
7133
|
}, [brain]);
|
|
6638
7134
|
useEffect15(() => {
|
|
6639
7135
|
return brain.onScrollStop((scrollPosition) => {
|
|
6640
|
-
const { scrollTop } = scrollPosition;
|
|
6641
|
-
if (
|
|
7136
|
+
const { scrollTop: scrollTop2 } = scrollPosition;
|
|
7137
|
+
if (scrollTop2 === 0) {
|
|
6642
7138
|
onScrollToTop == null ? void 0 : onScrollToTop();
|
|
6643
7139
|
}
|
|
6644
7140
|
const offset = scrollToBottomOffset != null ? scrollToBottomOffset : SCROLL_BOTTOM_OFFSET;
|
|
6645
|
-
const isScrollBottom =
|
|
7141
|
+
const isScrollBottom = scrollTop2 + offset >= scrollTopMaxRef.current;
|
|
6646
7142
|
if (isScrollBottom) {
|
|
6647
7143
|
onScrollToBottom == null ? void 0 : onScrollToBottom();
|
|
6648
7144
|
const { livePagination, livePaginationCursor, dataArray: dataArray2 } = getDataSourceState();
|
|
@@ -6845,10 +7341,10 @@ function useColumnGroups() {
|
|
|
6845
7341
|
}
|
|
6846
7342
|
|
|
6847
7343
|
// src/components/InfiniteTable/hooks/useColumnRowspan.ts
|
|
6848
|
-
import { useMemo as
|
|
7344
|
+
import { useMemo as useMemo7 } from "react";
|
|
6849
7345
|
function useColumnRowspan(computedVisibleColumns) {
|
|
6850
7346
|
const { getState: getDataSourceState } = useDataSourceContextValue();
|
|
6851
|
-
const rowspan =
|
|
7347
|
+
const rowspan = useMemo7(() => {
|
|
6852
7348
|
const colsWithRowspan = computedVisibleColumns.filter((col) => typeof col.rowspan === "function");
|
|
6853
7349
|
return colsWithRowspan.length ? ({ rowIndex, colIndex }) => {
|
|
6854
7350
|
const dataArray = getDataSourceState().dataArray;
|
|
@@ -6888,7 +7384,7 @@ function useColumnSizeFn(columns) {
|
|
|
6888
7384
|
}
|
|
6889
7385
|
|
|
6890
7386
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
6891
|
-
import { useEffect as useEffect22, useMemo as
|
|
7387
|
+
import { useEffect as useEffect22, useMemo as useMemo9 } from "react";
|
|
6892
7388
|
|
|
6893
7389
|
// src/components/InfiniteTable/utils/getColumnForGroupBy.tsx
|
|
6894
7390
|
import {
|
|
@@ -7787,7 +8283,7 @@ var GroupRowsState = class {
|
|
|
7787
8283
|
};
|
|
7788
8284
|
|
|
7789
8285
|
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
7790
|
-
import { useEffect as useEffect21, useMemo as
|
|
8286
|
+
import { useEffect as useEffect21, useMemo as useMemo8, useRef as useRef20, useState as useState12 } from "react";
|
|
7791
8287
|
|
|
7792
8288
|
// src/components/hooks/useEffectWithChanges.ts
|
|
7793
8289
|
import { useEffect as useEffect20, useRef as useRef19 } from "react";
|
|
@@ -7846,7 +8342,7 @@ function getChangeDetect() {
|
|
|
7846
8342
|
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
7847
8343
|
var CACHE_DEFAULT = true;
|
|
7848
8344
|
var getRafPromise = () => new Promise((resolve) => {
|
|
7849
|
-
|
|
8345
|
+
raf(resolve);
|
|
7850
8346
|
});
|
|
7851
8347
|
var SKIP_DATA_CHANGES_KEYS = {
|
|
7852
8348
|
originalDataArray: true,
|
|
@@ -8012,17 +8508,15 @@ function loadData(data, componentState, actions, overrides) {
|
|
|
8012
8508
|
lazyGroupData.set(theKey, currentGroupRowInfo);
|
|
8013
8509
|
}
|
|
8014
8510
|
} else {
|
|
8015
|
-
|
|
8016
|
-
|
|
8017
|
-
|
|
8018
|
-
|
|
8019
|
-
|
|
8020
|
-
|
|
8021
|
-
|
|
8022
|
-
|
|
8023
|
-
|
|
8024
|
-
newGroupRowInfo.children.length = newGroupRowInfo.totalCount;
|
|
8025
|
-
}
|
|
8511
|
+
newGroupRowInfo.children.forEach((child) => {
|
|
8512
|
+
if (child && child.dataset) {
|
|
8513
|
+
childDatasets.push({
|
|
8514
|
+
keys: child.keys,
|
|
8515
|
+
dataset: child.dataset
|
|
8516
|
+
});
|
|
8517
|
+
}
|
|
8518
|
+
});
|
|
8519
|
+
newGroupRowInfo.children.length = newGroupRowInfo.totalCount;
|
|
8026
8520
|
lazyGroupData.set(theKey, newGroupRowInfo);
|
|
8027
8521
|
}
|
|
8028
8522
|
let skipTriggerChangeAsAlreadyOriginalArrayWasUpdated = false;
|
|
@@ -8174,6 +8668,7 @@ function useLazyLoadRange() {
|
|
|
8174
8668
|
}, [componentState.data, componentState.dataParams]);
|
|
8175
8669
|
const {
|
|
8176
8670
|
lazyLoadBatchSize,
|
|
8671
|
+
lazyLoad,
|
|
8177
8672
|
notifyRenderRangeChange,
|
|
8178
8673
|
dataArray,
|
|
8179
8674
|
scrollStopDelayUpdatedByTable
|
|
@@ -8186,27 +8681,33 @@ function useLazyLoadRange() {
|
|
|
8186
8681
|
return;
|
|
8187
8682
|
}
|
|
8188
8683
|
const { renderStartIndex: startIndex, renderEndIndex: endIndex } = renderRange;
|
|
8189
|
-
|
|
8684
|
+
const { lazyLoadBatchSize: lazyLoadBatchSize2, lazyLoad: lazyLoad2 } = componentState2;
|
|
8685
|
+
if (!lazyLoad2) {
|
|
8190
8686
|
return;
|
|
8191
8687
|
}
|
|
8688
|
+
if (!lazyLoadBatchSize2 || lazyLoadBatchSize2 <= 0) {
|
|
8689
|
+
if (!componentState2.groupBy || componentState2.groupBy.length === 0) {
|
|
8690
|
+
return;
|
|
8691
|
+
}
|
|
8692
|
+
}
|
|
8192
8693
|
lazyLoadRange({
|
|
8193
8694
|
startIndex,
|
|
8194
8695
|
endIndex,
|
|
8195
|
-
lazyLoadBatchSize,
|
|
8696
|
+
lazyLoadBatchSize: lazyLoadBatchSize2,
|
|
8196
8697
|
componentState: componentState2,
|
|
8197
8698
|
componentActions: actions
|
|
8198
8699
|
}, cache);
|
|
8199
8700
|
};
|
|
8200
|
-
const debouncedLoadRange =
|
|
8701
|
+
const debouncedLoadRange = useMemo8(() => debounce(loadRange, { wait: scrollStopDelayUpdatedByTable }), [scrollStopDelayUpdatedByTable]);
|
|
8201
8702
|
useEffect21(() => {
|
|
8202
|
-
if (
|
|
8703
|
+
if (lazyLoad) {
|
|
8203
8704
|
return notifyRenderRangeChange.onChange((renderRange) => {
|
|
8204
8705
|
latestRenderRangeRef.current = renderRange;
|
|
8205
8706
|
loadRange(renderRange);
|
|
8206
8707
|
});
|
|
8207
8708
|
}
|
|
8208
8709
|
return;
|
|
8209
|
-
}, [lazyLoadBatchSize]);
|
|
8710
|
+
}, [lazyLoadBatchSize, lazyLoad]);
|
|
8210
8711
|
useEffect21(() => {
|
|
8211
8712
|
if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
|
|
8212
8713
|
debouncedLoadRange();
|
|
@@ -8260,7 +8761,7 @@ function lazyLoadRange(options, cache) {
|
|
|
8260
8761
|
}
|
|
8261
8762
|
}
|
|
8262
8763
|
}
|
|
8263
|
-
if (!rowLoaded) {
|
|
8764
|
+
if (!rowLoaded && lazyLoadBatchSize != void 0) {
|
|
8264
8765
|
let cachedFnCalls = perGroupFnCalls.get(cacheKeys);
|
|
8265
8766
|
const batchStartIndexInGroup = Math.floor(indexInGroup / lazyLoadBatchSize) * lazyLoadBatchSize;
|
|
8266
8767
|
const offset = indexInGroup - batchStartIndexInGroup;
|
|
@@ -8301,38 +8802,6 @@ function lazyLoadRange(options, cache) {
|
|
|
8301
8802
|
}, initialPromise);
|
|
8302
8803
|
}
|
|
8303
8804
|
|
|
8304
|
-
// src/utils/shallowEqualObjects.ts
|
|
8305
|
-
function shallowEqualObjects(objA, objB, ignoreKeys) {
|
|
8306
|
-
if (objA === objB) {
|
|
8307
|
-
return true;
|
|
8308
|
-
}
|
|
8309
|
-
if (!objA || !objB) {
|
|
8310
|
-
return false;
|
|
8311
|
-
}
|
|
8312
|
-
var aKeys = Object.keys(objA);
|
|
8313
|
-
var bKeys = Object.keys(objB);
|
|
8314
|
-
if (ignoreKeys) {
|
|
8315
|
-
aKeys = aKeys.filter((key2) => !ignoreKeys.has(key2));
|
|
8316
|
-
bKeys = bKeys.filter((key2) => !ignoreKeys.has(key2));
|
|
8317
|
-
}
|
|
8318
|
-
var len = aKeys.length;
|
|
8319
|
-
if (bKeys.length !== len) {
|
|
8320
|
-
return false;
|
|
8321
|
-
}
|
|
8322
|
-
for (var i = 0; i < len; i++) {
|
|
8323
|
-
var key = aKeys[i];
|
|
8324
|
-
if (ignoreKeys) {
|
|
8325
|
-
if (ignoreKeys.has(key)) {
|
|
8326
|
-
continue;
|
|
8327
|
-
}
|
|
8328
|
-
}
|
|
8329
|
-
if (objA[key] !== objB[key] || !Object.prototype.hasOwnProperty.call(objB, key)) {
|
|
8330
|
-
return false;
|
|
8331
|
-
}
|
|
8332
|
-
}
|
|
8333
|
-
return true;
|
|
8334
|
-
}
|
|
8335
|
-
|
|
8336
8805
|
// src/components/utils/discardCallsWithEqualArg.ts
|
|
8337
8806
|
var map = new WeakMap();
|
|
8338
8807
|
var getCompareDefault = (a) => a;
|
|
@@ -8523,7 +8992,7 @@ function getInterceptActions() {
|
|
|
8523
8992
|
});
|
|
8524
8993
|
actions.dataParams = dataParams;
|
|
8525
8994
|
if (state.livePagination) {
|
|
8526
|
-
|
|
8995
|
+
raf(() => {
|
|
8527
8996
|
actions.livePaginationCursor = null;
|
|
8528
8997
|
});
|
|
8529
8998
|
}
|
|
@@ -8535,7 +9004,7 @@ function getInterceptActions() {
|
|
|
8535
9004
|
});
|
|
8536
9005
|
actions.dataParams = dataParams;
|
|
8537
9006
|
if (state.livePagination) {
|
|
8538
|
-
|
|
9007
|
+
raf(() => {
|
|
8539
9008
|
actions.livePaginationCursor = null;
|
|
8540
9009
|
});
|
|
8541
9010
|
}
|
|
@@ -8547,7 +9016,7 @@ function getInterceptActions() {
|
|
|
8547
9016
|
});
|
|
8548
9017
|
actions.dataParams = dataParams;
|
|
8549
9018
|
if (state.livePagination) {
|
|
8550
|
-
|
|
9019
|
+
raf(() => {
|
|
8551
9020
|
actions.livePaginationCursor = null;
|
|
8552
9021
|
});
|
|
8553
9022
|
}
|
|
@@ -8559,7 +9028,7 @@ function getInterceptActions() {
|
|
|
8559
9028
|
});
|
|
8560
9029
|
actions.dataParams = dataParams;
|
|
8561
9030
|
if (state.livePagination) {
|
|
8562
|
-
|
|
9031
|
+
raf(() => {
|
|
8563
9032
|
actions.livePaginationCursor = null;
|
|
8564
9033
|
});
|
|
8565
9034
|
}
|
|
@@ -9080,7 +9549,7 @@ function useToggleGroupRow() {
|
|
|
9080
9549
|
|
|
9081
9550
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
9082
9551
|
function useGroupByMap(groupBy) {
|
|
9083
|
-
const groupByMap =
|
|
9552
|
+
const groupByMap = useMemo9(() => {
|
|
9084
9553
|
return groupBy.reduce((acc, groupBy2, index) => {
|
|
9085
9554
|
acc.set(groupBy2.field, {
|
|
9086
9555
|
groupBy: groupBy2,
|
|
@@ -9464,15 +9933,15 @@ function getColumnsWhenGrouping(params) {
|
|
|
9464
9933
|
}
|
|
9465
9934
|
|
|
9466
9935
|
// src/components/InfiniteTable/hooks/useComputedVisibleColumns.ts
|
|
9467
|
-
import { useMemo as
|
|
9936
|
+
import { useMemo as useMemo10 } from "react";
|
|
9468
9937
|
|
|
9469
9938
|
// src/components/InfiniteTable/utils/adjustColumnOrderForPinning.ts
|
|
9470
9939
|
var order = ["start", void 0, "end"];
|
|
9471
9940
|
var adjustColumnOrderForPinning = (columnOrder, columnPinning) => {
|
|
9472
|
-
if (columnPinning.
|
|
9941
|
+
if (columnPinning && Object.keys(columnPinning).length > 0) {
|
|
9473
9942
|
columnOrder.sort((colId1, colId2) => {
|
|
9474
|
-
let p1 = columnPinning
|
|
9475
|
-
let p2 = columnPinning
|
|
9943
|
+
let p1 = columnPinning[colId1];
|
|
9944
|
+
let p2 = columnPinning[colId2];
|
|
9476
9945
|
if (p1 === true) {
|
|
9477
9946
|
p1 = "start";
|
|
9478
9947
|
}
|
|
@@ -9513,7 +9982,10 @@ var isColumnVisible = (columnVisibility, _columnVisibilityAssumeVisible, colId)
|
|
|
9513
9982
|
return columnVisibility[colId] !== false;
|
|
9514
9983
|
};
|
|
9515
9984
|
var getComputedPinned = (colId, columnPinning) => {
|
|
9516
|
-
|
|
9985
|
+
if (!columnPinning) {
|
|
9986
|
+
return false;
|
|
9987
|
+
}
|
|
9988
|
+
const pinned = columnPinning[colId];
|
|
9517
9989
|
const computedPinned = pinned === "start" || pinned === true ? "start" : pinned === "end" ? "end" : false;
|
|
9518
9990
|
return computedPinned;
|
|
9519
9991
|
};
|
|
@@ -9701,6 +10173,8 @@ var getComputedVisibleColumns = ({
|
|
|
9701
10173
|
renderValue: colType.renderValue,
|
|
9702
10174
|
render: colType.render,
|
|
9703
10175
|
style: colType.style,
|
|
10176
|
+
headerStyle: colType.headerStyle,
|
|
10177
|
+
headerClassName: colType.headerClassName,
|
|
9704
10178
|
components: colType.components,
|
|
9705
10179
|
columnGroup: colType.columnGroup,
|
|
9706
10180
|
field
|
|
@@ -9863,7 +10337,6 @@ var useComputedVisibleColumns = ({
|
|
|
9863
10337
|
columnSizing
|
|
9864
10338
|
}) => {
|
|
9865
10339
|
const columnsRenderId = useRerenderOnKeyChange(columns);
|
|
9866
|
-
const pinningRenderId = useRerenderOnKeyChange(columnPinning);
|
|
9867
10340
|
const {
|
|
9868
10341
|
computedRemainingSpace,
|
|
9869
10342
|
computedColumnOrder,
|
|
@@ -9879,7 +10352,7 @@ var useComputedVisibleColumns = ({
|
|
|
9879
10352
|
computedPinnedEndOffset,
|
|
9880
10353
|
computedPinnedEndWidth,
|
|
9881
10354
|
computedPinnedStartWidth
|
|
9882
|
-
} =
|
|
10355
|
+
} = useMemo10(() => {
|
|
9883
10356
|
return getComputedVisibleColumns({
|
|
9884
10357
|
columns,
|
|
9885
10358
|
bodySize,
|
|
@@ -9926,8 +10399,7 @@ var useComputedVisibleColumns = ({
|
|
|
9926
10399
|
columnSizing,
|
|
9927
10400
|
columnTypes,
|
|
9928
10401
|
columnPinning,
|
|
9929
|
-
columnsRenderId
|
|
9930
|
-
pinningRenderId
|
|
10402
|
+
columnsRenderId
|
|
9931
10403
|
]);
|
|
9932
10404
|
const result = {
|
|
9933
10405
|
columns,
|
|
@@ -10095,7 +10567,7 @@ function useComputed() {
|
|
|
10095
10567
|
}
|
|
10096
10568
|
|
|
10097
10569
|
// src/components/InfiniteTable/hooks/useLicense/useLicense.ts
|
|
10098
|
-
import { useMemo as
|
|
10570
|
+
import { useMemo as useMemo11 } from "react";
|
|
10099
10571
|
|
|
10100
10572
|
// src/components/InfiniteTable/hooks/useLicense/crc32.ts
|
|
10101
10573
|
var DEFAULT_ReversedPolynomial = 3988292384;
|
|
@@ -10253,10 +10725,10 @@ var isInsideSandbox = () => {
|
|
|
10253
10725
|
};
|
|
10254
10726
|
var isInsidePlayground = isInsideSandbox() || isInsideSandpack();
|
|
10255
10727
|
var useLicense = (licenseKey = "") => {
|
|
10256
|
-
const valid =
|
|
10728
|
+
const valid = useMemo11(() => {
|
|
10257
10729
|
let valid2 = isValidLicense(licenseKey, {
|
|
10258
10730
|
publishedAt: 1624970570587,
|
|
10259
|
-
version: "0.3.
|
|
10731
|
+
version: "0.3.22"
|
|
10260
10732
|
});
|
|
10261
10733
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
10262
10734
|
return true;
|
|
@@ -10275,15 +10747,15 @@ function useScrollToActiveCell(activeCellIndex, dataCount, imperativeApi) {
|
|
|
10275
10747
|
useEffect26(() => {
|
|
10276
10748
|
if (activeCellIndex != null) {
|
|
10277
10749
|
didScrollRef.current = false;
|
|
10278
|
-
|
|
10750
|
+
cancelRaf(rafId.current);
|
|
10279
10751
|
}
|
|
10280
10752
|
}, [activeCellIndex]);
|
|
10281
10753
|
useEffect26(() => {
|
|
10282
10754
|
if (activeCellIndex != null && !didScrollRef.current) {
|
|
10283
10755
|
let tryScroll = function(times = 0) {
|
|
10284
10756
|
times++;
|
|
10285
|
-
|
|
10286
|
-
rafId.current =
|
|
10757
|
+
cancelRaf(rafId.current);
|
|
10758
|
+
rafId.current = raf(() => {
|
|
10287
10759
|
didScrollRef.current = imperativeApi.scrollCellIntoView(activeCellIndex[0], activeCellIndex[1], {
|
|
10288
10760
|
offset: 30
|
|
10289
10761
|
});
|
|
@@ -10295,7 +10767,7 @@ function useScrollToActiveCell(activeCellIndex, dataCount, imperativeApi) {
|
|
|
10295
10767
|
tryScroll();
|
|
10296
10768
|
}
|
|
10297
10769
|
return () => {
|
|
10298
|
-
|
|
10770
|
+
cancelRaf(rafId.current);
|
|
10299
10771
|
};
|
|
10300
10772
|
}, [activeCellIndex, dataCount]);
|
|
10301
10773
|
}
|
|
@@ -10590,7 +11062,7 @@ function initSetupState2() {
|
|
|
10590
11062
|
scrollTop: 0,
|
|
10591
11063
|
scrollLeft: 0
|
|
10592
11064
|
},
|
|
10593
|
-
|
|
11065
|
+
columnReorderDragColumnId: false,
|
|
10594
11066
|
ready: false,
|
|
10595
11067
|
focused: false,
|
|
10596
11068
|
focusedWithin: false,
|
|
@@ -10621,6 +11093,7 @@ var forwardProps3 = (setupState) => {
|
|
|
10621
11093
|
onScrollToBottom: 1,
|
|
10622
11094
|
onScrollStop: 1,
|
|
10623
11095
|
scrollToBottomOffset: 1,
|
|
11096
|
+
columnPinning: 1,
|
|
10624
11097
|
rowStyle: 1,
|
|
10625
11098
|
rowProps: 1,
|
|
10626
11099
|
rowClassName: 1,
|
|
@@ -10659,7 +11132,6 @@ var forwardProps3 = (setupState) => {
|
|
|
10659
11132
|
columnHeaderHeight: (columnHeaderHeight) => typeof columnHeaderHeight === "number" ? columnHeaderHeight : 30,
|
|
10660
11133
|
columns: (columns) => toMap(columns, setupState.propsCache.get("columns")),
|
|
10661
11134
|
columnVisibility: (columnVisibility) => columnVisibility != null ? columnVisibility : {},
|
|
10662
|
-
columnPinning: (columnPinning) => toMap(columnPinning, setupState.propsCache.get("columnPinning")),
|
|
10663
11135
|
columnSizing: (columnSizing) => columnSizing || {},
|
|
10664
11136
|
columnTypes: (columnTypes) => columnTypes || {},
|
|
10665
11137
|
collapsedColumnGroups: (collapsedColumnGroups) => collapsedColumnGroups != null ? collapsedColumnGroups : new Map(),
|
|
@@ -10710,7 +11182,7 @@ var mapPropsToState2 = (params) => {
|
|
|
10710
11182
|
groupRenderStrategy,
|
|
10711
11183
|
groupBy,
|
|
10712
11184
|
computedColumns,
|
|
10713
|
-
keyboardNavigation: (_a =
|
|
11185
|
+
keyboardNavigation: (_a = props.keyboardNavigation) != null ? _a : state.activeCellIndex != null ? "cell" : state.activeRowIndex != null ? "row" : "cell",
|
|
10714
11186
|
columnHeaderCssEllipsis: (_c = (_b = props.columnHeaderCssEllipsis) != null ? _b : props.columnCssEllipsis) != null ? _c : true,
|
|
10715
11187
|
columnGroupsDepthsMap,
|
|
10716
11188
|
columnGroupsMaxDepth: columnGroupsDepthsMap != state.columnGroupsDepthsMap ? Math.max(...columnGroupsDepthsMap.values(), 0) : state.columnGroupsMaxDepth,
|
|
@@ -10745,16 +11217,14 @@ var InfiniteTableComponent = memo11(function InfiniteTableComponent2() {
|
|
|
10745
11217
|
getComputed,
|
|
10746
11218
|
computed,
|
|
10747
11219
|
componentActions: actions,
|
|
10748
|
-
getState
|
|
11220
|
+
getState,
|
|
11221
|
+
imperativeApi
|
|
10749
11222
|
} = useInfiniteTable();
|
|
10750
11223
|
const {
|
|
10751
11224
|
componentState: { loading, dataArray },
|
|
10752
11225
|
getState: getDataSourceState,
|
|
10753
11226
|
componentActions: dataSourceActions
|
|
10754
11227
|
} = useDataSourceContextValue();
|
|
10755
|
-
const [imperativeApi] = useState15(() => {
|
|
10756
|
-
return getImperativeApi(getState, getComputed, getDataSourceState, actions);
|
|
10757
|
-
});
|
|
10758
11228
|
const {
|
|
10759
11229
|
domRef,
|
|
10760
11230
|
scrollerDOMRef,
|
|
@@ -10827,7 +11297,7 @@ var InfiniteTableComponent = memo11(function InfiniteTableComponent2() {
|
|
|
10827
11297
|
}) : null, /* @__PURE__ */ createElement28(InfiniteTableBody, null, /* @__PURE__ */ createElement28(HeadlessTable, {
|
|
10828
11298
|
tabIndex: 0,
|
|
10829
11299
|
activeRowIndex: componentState.ready && keyboardNavigation === "row" ? activeRowIndex : null,
|
|
10830
|
-
activeCellIndex: componentState.ready && keyboardNavigation === "cell" && !componentState.
|
|
11300
|
+
activeCellIndex: componentState.ready && keyboardNavigation === "cell" && !componentState.columnReorderDragColumnId ? activeCellIndex : null,
|
|
10831
11301
|
scrollStopDelay,
|
|
10832
11302
|
renderer,
|
|
10833
11303
|
onRenderUpdater,
|
|
@@ -10840,6 +11310,12 @@ var InfiniteTableComponent = memo11(function InfiniteTableComponent2() {
|
|
|
10840
11310
|
}, loadingText)), /* @__PURE__ */ createElement28("div", {
|
|
10841
11311
|
ref: portalDOMRef,
|
|
10842
11312
|
className: join(`${rootClassName2}Portal`, zIndex[1e7], position.absolute, top[0], left[0])
|
|
11313
|
+
}), /* @__PURE__ */ createElement28("div", {
|
|
11314
|
+
"data-name": "pinned-start-border",
|
|
11315
|
+
className: PinnedStartIndicatorBorder
|
|
11316
|
+
}), /* @__PURE__ */ createElement28("div", {
|
|
11317
|
+
"data-name": "pinned-end-border",
|
|
11318
|
+
className: PinnedEndIndicatorBorder
|
|
10843
11319
|
}), rowHeightCSSVar ? /* @__PURE__ */ createElement28(CSSVariableWatch, {
|
|
10844
11320
|
varName: rowHeightCSSVar,
|
|
10845
11321
|
onChange: onRowHeightCSSVarChange
|
|
@@ -10858,12 +11334,17 @@ function InfiniteTableContextProvider() {
|
|
|
10858
11334
|
globalThis.getState = getState;
|
|
10859
11335
|
globalThis.getComputed = getComputed;
|
|
10860
11336
|
}
|
|
11337
|
+
const { getState: getDataSourceState } = useDataSourceContextValue();
|
|
11338
|
+
const [imperativeApi] = useState15(() => {
|
|
11339
|
+
return getImperativeApi(getState, getComputed, getDataSourceState, componentActions);
|
|
11340
|
+
});
|
|
10861
11341
|
const contextValue = {
|
|
10862
11342
|
componentActions,
|
|
10863
11343
|
componentState,
|
|
10864
11344
|
computed,
|
|
10865
11345
|
getComputed,
|
|
10866
|
-
getState
|
|
11346
|
+
getState,
|
|
11347
|
+
imperativeApi
|
|
10867
11348
|
};
|
|
10868
11349
|
useResizeObserver(scrollerDOMRef, (size) => {
|
|
10869
11350
|
const bodySize = {
|