@infinite-table/infinite-react 0.3.21 → 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 +3 -3
- package/index.d.ts +2 -3
- package/index.esm.css +3 -3
- package/index.esm.js +345 -209
- package/index.js +345 -209
- package/package.json +2 -2
package/index.esm.js
CHANGED
|
@@ -1100,7 +1100,7 @@ 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)", columnReorderEffectDurationAtIndex: "var(--_1slvgu9a)", columnWidthAtIndex: "var(--_1slvgu9b)", columnOffsetAtIndex: "var(--_1slvgu9c)", columnOffsetAtIndexWhileReordering: "var(--_1slvgu9d)", columnZIndexAtIndex: "var(--_1slvgu9e)", pinnedStartWidth: "var(--_1slvgu9f)", pinnedEndWidth: "var(--_1slvgu9g)",
|
|
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
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
|
|
|
@@ -4269,7 +4269,6 @@ function useCellClassName(column, baseClasses, variants, extraFlags) {
|
|
|
4269
4269
|
}
|
|
4270
4270
|
|
|
4271
4271
|
// src/components/InfiniteTable/hooks/useColumnPointerEvents.ts
|
|
4272
|
-
var import_binary_search2 = __toModule(require_binary_search());
|
|
4273
4272
|
import { useCallback as useCallback6, useState as useState5 } from "react";
|
|
4274
4273
|
|
|
4275
4274
|
// src/components/InfiniteTable/hooks/useInfiniteTable.ts
|
|
@@ -4291,23 +4290,6 @@ var useInfiniteTable = () => {
|
|
|
4291
4290
|
return useContext3(TableContext2);
|
|
4292
4291
|
};
|
|
4293
4292
|
|
|
4294
|
-
// src/components/InfiniteTable/utils/moveXatY.ts
|
|
4295
|
-
var moveXatY = (arr, dragIndex, dropIndex) => {
|
|
4296
|
-
arr = [...arr];
|
|
4297
|
-
if (dragIndex === dropIndex || arr[dragIndex] === void 0 || arr[dropIndex] === void 0) {
|
|
4298
|
-
return arr;
|
|
4299
|
-
}
|
|
4300
|
-
const dragItem = arr[dragIndex];
|
|
4301
|
-
if (dropIndex < dragIndex) {
|
|
4302
|
-
arr.splice(dragIndex, 1);
|
|
4303
|
-
arr.splice(dropIndex, 0, dragItem);
|
|
4304
|
-
} else {
|
|
4305
|
-
arr.splice(dragIndex, 1);
|
|
4306
|
-
arr.splice(dropIndex, 0, dragItem);
|
|
4307
|
-
}
|
|
4308
|
-
return arr;
|
|
4309
|
-
};
|
|
4310
|
-
|
|
4311
4293
|
// src/components/InfiniteTable/InfiniteCls.css.ts
|
|
4312
4294
|
var import_createRuntimeFn = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
4313
4295
|
var FooterCls = "_16lm1iw1";
|
|
@@ -4316,9 +4298,9 @@ var InfiniteClsHasPinnedEnd = "_1yeub2vo";
|
|
|
4316
4298
|
var InfiniteClsHasPinnedStart = "_1yeub2vn";
|
|
4317
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"]] });
|
|
4318
4300
|
var InfiniteClsShiftingColumns = "_1yeub2vl";
|
|
4319
|
-
var PinnedEndIndicatorBorder = "_1yeub2vr _1yeub2vp _16lm1iw2 _16lm1iw12 _16lm1iwe _16lm1iwx _16lm1iw10 _16lm1iw1n _16lm1iwf
|
|
4301
|
+
var PinnedEndIndicatorBorder = "_1yeub2vr _1yeub2vp _16lm1iw2 _16lm1iw12 _16lm1iwe _16lm1iwx _16lm1iw10 _16lm1iw1n _16lm1iwf _16lm1iwp";
|
|
4320
4302
|
var PinnedRowsContainerClsVariants = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "", variantClassNames: { pinned: { start: "_1yeub2vi", end: "_1yeub2vj", false: "_1yeub2vk" } }, defaultVariants: {}, compoundVariants: [] });
|
|
4321
|
-
var PinnedStartIndicatorBorder = "_1yeub2vq _1yeub2vp _16lm1iw2 _16lm1iw12 _16lm1iwe _16lm1iwx _16lm1iw10 _16lm1iw1n _16lm1iwf
|
|
4303
|
+
var PinnedStartIndicatorBorder = "_1yeub2vq _1yeub2vp _16lm1iw2 _16lm1iw12 _16lm1iwe _16lm1iwx _16lm1iw10 _16lm1iw1n _16lm1iwf _16lm1iwp";
|
|
4322
4304
|
|
|
4323
4305
|
// src/components/utils/getScrollbarWidth.ts
|
|
4324
4306
|
var scrollbarWidth;
|
|
@@ -4367,12 +4349,10 @@ var activeCellColWidth = stripVar(InternalVars.activeCellColWidth);
|
|
|
4367
4349
|
var activeCellColOffset = stripVar(InternalVars.activeCellColOffset);
|
|
4368
4350
|
var baseZIndexForCells = stripVar(InternalVars.baseZIndexForCells);
|
|
4369
4351
|
var pinnedStartWidthCSSVar = stripVar(InternalVars.pinnedStartWidth);
|
|
4370
|
-
var pinnedStartDraggingWidthCSSVar = stripVar(InternalVars.pinnedStartDraggingWidth);
|
|
4371
4352
|
var bodyWidthCSSVar = stripVar(InternalVars.bodyWidth);
|
|
4372
4353
|
var bodyHeightCSSVar = stripVar(InternalVars.bodyHeight);
|
|
4373
4354
|
var pinnedEndOffsetCSSVar = stripVar(InternalVars.pinnedEndOffset);
|
|
4374
4355
|
var pinnedEndWidthCSSVar = stripVar(InternalVars.pinnedEndWidth);
|
|
4375
|
-
var pinnedEndDraggingWidthCSSVar = stripVar(InternalVars.pinnedEndDraggingWidth);
|
|
4376
4356
|
var computedVisibleColumnsCountCSSVar = stripVar(InternalVars.computedVisibleColumnsCount);
|
|
4377
4357
|
function getColumnZIndex(col, params) {
|
|
4378
4358
|
let computedZIndex = "auto";
|
|
@@ -4433,8 +4413,8 @@ function useDOMProps(initialDOMProps) {
|
|
|
4433
4413
|
cssVars[computedVisibleColumnsCountCSSVar] = computedVisibleColumns.length;
|
|
4434
4414
|
cssVars[scrollbarWidthHorizontal] = scrollbars.horizontal ? `${scrollbarWidth2}px` : "0px";
|
|
4435
4415
|
cssVars[scrollbarWidthVertical] = scrollbars.vertical ? `${scrollbarWidth2}px` : "0px";
|
|
4436
|
-
cssVars[pinnedStartWidthCSSVar] = `calc( ` + computedPinnedStartColumns.map((c) => `var(${getCSSVarNameForColWidth(c.computedVisibleIndex)})`).join(" + ") +
|
|
4437
|
-
cssVars[pinnedEndWidthCSSVar] = `calc( ` + computedPinnedEndColumns.map((c) => `var(${getCSSVarNameForColWidth(c.computedVisibleIndex)})`).join(" + ") +
|
|
4416
|
+
cssVars[pinnedStartWidthCSSVar] = `calc( ` + computedPinnedStartColumns.map((c) => `var(${getCSSVarNameForColWidth(c.computedVisibleIndex)})`).join(" + ") + ")";
|
|
4417
|
+
cssVars[pinnedEndWidthCSSVar] = `calc( ` + computedPinnedEndColumns.map((c) => `var(${getCSSVarNameForColWidth(c.computedVisibleIndex)})`).join(" + ") + ")";
|
|
4438
4418
|
cssVars[baseZIndexForCells] = computedVisibleColumns.length * 10;
|
|
4439
4419
|
cssVars[pinnedEndOffsetCSSVar] = `calc( var(${bodyWidthCSSVar}) - var(${pinnedEndWidthCSSVar}) - var(${scrollbarWidthVertical}) )`;
|
|
4440
4420
|
cssVars[bodyWidthCSSVar] = `${bodySize.width}px`;
|
|
@@ -4507,6 +4487,26 @@ function useDOMProps(initialDOMProps) {
|
|
|
4507
4487
|
return domProps;
|
|
4508
4488
|
}
|
|
4509
4489
|
|
|
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
4510
|
// src/components/InfiniteTable/utils/progressiveSpeedScroller.ts
|
|
4511
4511
|
var progressiveSpeedScroller = (staticOptions) => {
|
|
4512
4512
|
let scrollLeftRafId = null;
|
|
@@ -4583,19 +4583,284 @@ var progressiveSpeedScroller = (staticOptions) => {
|
|
|
4583
4583
|
};
|
|
4584
4584
|
};
|
|
4585
4585
|
|
|
4586
|
+
// src/components/InfiniteTable/hooks/reorderColumnsOnDrag.ts
|
|
4587
|
+
var PROXY_OFFSET = 10;
|
|
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);
|
|
4740
|
+
return {
|
|
4741
|
+
newColumnIndexes,
|
|
4742
|
+
indexesWithTransition,
|
|
4743
|
+
pinnedStartCount: currentPinnedStartCount
|
|
4744
|
+
};
|
|
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
|
+
|
|
4586
4855
|
// src/components/InfiniteTable/hooks/useColumnPointerEvents.ts
|
|
4587
4856
|
var columnOffsetAtIndex4 = stripVar(InternalVars.columnOffsetAtIndex);
|
|
4588
4857
|
var columnWidthAtIndex3 = stripVar(InternalVars.columnWidthAtIndex);
|
|
4589
4858
|
var baseZIndexForCells2 = stripVar(InternalVars.baseZIndexForCells);
|
|
4590
|
-
var
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
index: c.computedVisibleIndex,
|
|
4596
|
-
breakpoint: c.computedOffset + Math.round(c.computedWidth / 2)
|
|
4597
|
-
};
|
|
4598
|
-
}).filter(Boolean);
|
|
4859
|
+
var equalPinning = (pinning1, pinning2) => {
|
|
4860
|
+
if (!!pinning1 != !!pinning2) {
|
|
4861
|
+
return false;
|
|
4862
|
+
}
|
|
4863
|
+
return shallowEqualObjects(pinning1, pinning2);
|
|
4599
4864
|
};
|
|
4600
4865
|
var useColumnPointerEvents = ({
|
|
4601
4866
|
columnId,
|
|
@@ -4607,6 +4872,7 @@ var useColumnPointerEvents = ({
|
|
|
4607
4872
|
componentActions,
|
|
4608
4873
|
computed,
|
|
4609
4874
|
getComputed,
|
|
4875
|
+
getState,
|
|
4610
4876
|
imperativeApi,
|
|
4611
4877
|
componentState: { domRef: rootRef, brain, headerBrain }
|
|
4612
4878
|
} = useInfiniteTable();
|
|
@@ -4615,78 +4881,52 @@ var useColumnPointerEvents = ({
|
|
|
4615
4881
|
const {
|
|
4616
4882
|
computedVisibleColumns,
|
|
4617
4883
|
computedVisibleColumnsMap,
|
|
4618
|
-
computedPinnedStartColumns
|
|
4884
|
+
computedPinnedStartColumns,
|
|
4885
|
+
computedUnpinnedColumns,
|
|
4886
|
+
computedPinnedEndColumns
|
|
4619
4887
|
} = getComputed();
|
|
4620
4888
|
const dragColumn = computedVisibleColumnsMap.get(columnId);
|
|
4621
|
-
const initialBreakpoints = getBreakPoints(computedVisibleColumns);
|
|
4622
4889
|
const target = domRef.current;
|
|
4623
4890
|
const targetRect = target.getBoundingClientRect();
|
|
4624
4891
|
const tableRect = rootRef.current.getBoundingClientRect();
|
|
4625
4892
|
const initialAvailableSize = brain.getAvailableSize();
|
|
4626
4893
|
const dragColumnIndex = dragColumn.computedVisibleIndex;
|
|
4627
|
-
let
|
|
4628
|
-
|
|
4629
|
-
const
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
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
|
|
4644
4914
|
}
|
|
4645
|
-
return col.computedOffset >= scrollLeft2 + pinnedStartCurrentWidth && col.computedOffset + col.computedWidth < scrollLeft2 + tableRect.width - pinnedEndCurrentWidth;
|
|
4646
|
-
};
|
|
4647
|
-
const initialClientPos = {
|
|
4648
|
-
clientX: Math.round(e.clientX),
|
|
4649
|
-
clientY: Math.round(e.clientY)
|
|
4650
|
-
};
|
|
4651
|
-
let currentScrollPosition = {
|
|
4652
|
-
scrollLeft: 0,
|
|
4653
|
-
scrollTop: 0
|
|
4654
|
-
};
|
|
4655
|
-
const initialScrollPosition2 = brain.getScrollPosition();
|
|
4656
|
-
const updateScrollPosition = (scrollPosition) => {
|
|
4657
|
-
currentScrollPosition = scrollPosition;
|
|
4658
|
-
};
|
|
4659
|
-
updateScrollPosition(initialScrollPosition2);
|
|
4660
|
-
const removeOnScroll = brain.onScroll((scrollPosition) => {
|
|
4661
|
-
currentScrollPosition = scrollPosition;
|
|
4662
4915
|
});
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
if (clientX === currentClientPos.clientX && clientY === currentClientPos.clientY) {
|
|
4676
|
-
return;
|
|
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;
|
|
4677
4928
|
}
|
|
4678
|
-
currentClientPos = { clientX, clientY };
|
|
4679
|
-
currentDiff.x = currentClientPos.clientX - initialClientPos.clientX;
|
|
4680
|
-
currentDiff.y = currentClientPos.clientY - initialClientPos.clientY;
|
|
4681
|
-
setProxyPosition({
|
|
4682
|
-
left: initialProxyPosition.left + currentDiff.x,
|
|
4683
|
-
top: initialProxyPosition.top + currentDiff.y
|
|
4684
|
-
});
|
|
4685
4929
|
}
|
|
4686
|
-
updateProxyPosition(initialClientPos);
|
|
4687
|
-
let initialCursor = (_a2 = target.style.cursor) != null ? _a2 : "auto";
|
|
4688
|
-
let didDragAtLeastOnce = false;
|
|
4689
|
-
let currentDropIndex = dragColumnIndex;
|
|
4690
4930
|
const onPointerMove = (e2) => {
|
|
4691
4931
|
var _a3;
|
|
4692
4932
|
if (!didDragAtLeastOnce) {
|
|
@@ -4704,86 +4944,13 @@ var useColumnPointerEvents = ({
|
|
|
4704
4944
|
(_a3 = rootRef.current) == null ? void 0 : _a3.classList.add(InfiniteClsShiftingColumns);
|
|
4705
4945
|
target.style.cursor = "grabbing";
|
|
4706
4946
|
}
|
|
4707
|
-
|
|
4708
|
-
const scrollLeft2 = currentScrollPosition.scrollLeft;
|
|
4709
|
-
const scrollLeftDiff = scrollLeft2 - initialScrollPosition2.scrollLeft;
|
|
4710
|
-
let diffX = currentDiff.x + scrollLeftDiff;
|
|
4711
|
-
const dir = diffX < 0 ? -1 : 1;
|
|
4712
|
-
let currentPos = dir === -1 ? dragColumn.computedOffset + diffX : dragColumn.computedOffset + dragColumn.computedWidth + diffX;
|
|
4713
|
-
speedScroller.scroll({
|
|
4714
|
-
mousePosition: currentClientPos,
|
|
4715
|
-
get scrollLeft() {
|
|
4716
|
-
return brain.getScrollPosition().scrollLeft;
|
|
4717
|
-
},
|
|
4718
|
-
set scrollLeft(value) {
|
|
4719
|
-
imperativeApi.scrollLeft = value;
|
|
4720
|
-
}
|
|
4721
|
-
});
|
|
4722
|
-
const breakpoints = initialBreakpoints.filter((b) => isColumnVisible2(b.index, {
|
|
4723
|
-
scrollLeft: currentScrollPosition.scrollLeft
|
|
4724
|
-
})).map((b) => {
|
|
4725
|
-
return __spreadProps(__spreadValues({}, b), { breakpoint: b.breakpoint - scrollLeft2 });
|
|
4726
|
-
});
|
|
4727
|
-
let idx = (0, import_binary_search2.default)(breakpoints, currentPos, ({ breakpoint }, value) => {
|
|
4728
|
-
return breakpoint < value ? -1 : breakpoint > value ? 1 : 0;
|
|
4729
|
-
});
|
|
4730
|
-
if (idx < 0) {
|
|
4731
|
-
idx = ~idx;
|
|
4732
|
-
console.log("found breakpoint", breakpoints[idx], "at index", idx, "for currentPos", currentPos, JSON.parse(JSON.stringify(breakpoints)));
|
|
4733
|
-
}
|
|
4734
|
-
idx = breakpoints[idx] ? breakpoints[idx].index : breakpoints[breakpoints.length - 1].index + 1;
|
|
4735
|
-
if (idx != null && idx !== currentDropIndex) {
|
|
4736
|
-
currentDropIndex = idx;
|
|
4737
|
-
if (dir === 1 && currentDropIndex === dragColumnIndex + 1) {
|
|
4738
|
-
currentDropIndex = dragColumnIndex;
|
|
4739
|
-
}
|
|
4740
|
-
const newColumnIndexes = moveXatY(initialColumnIndexes, dragColumnIndex, currentDropIndex > dragColumnIndex ? currentDropIndex - 1 : currentDropIndex);
|
|
4741
|
-
const indexesWithTransition = new Set();
|
|
4742
|
-
newColumnIndexes.forEach((newIndex, i) => {
|
|
4743
|
-
const currentIndex = currentColumnIndexes[i];
|
|
4744
|
-
if (newIndex !== currentIndex) {
|
|
4745
|
-
indexesWithTransition.add(newIndex);
|
|
4746
|
-
}
|
|
4747
|
-
});
|
|
4748
|
-
console.log(JSON.stringify(currentColumnIndexes));
|
|
4749
|
-
console.log(JSON.stringify(newColumnIndexes));
|
|
4750
|
-
console.log("switched", indexesWithTransition);
|
|
4751
|
-
console.log("----");
|
|
4752
|
-
currentColumnIndexes = newColumnIndexes;
|
|
4753
|
-
computedVisibleColumns.forEach((col) => {
|
|
4754
|
-
const colIndex = col.computedVisibleIndex;
|
|
4755
|
-
if (indexesWithTransition.has(colIndex)) {
|
|
4756
|
-
restoreInfiniteColumnReorderDuration(colIndex, rootRef.current);
|
|
4757
|
-
} else {
|
|
4758
|
-
clearInfiniteColumnReorderDuration(colIndex, rootRef.current);
|
|
4759
|
-
}
|
|
4760
|
-
const isDragColumn = colIndex === dragColumnIndex;
|
|
4761
|
-
let isOutsideCol = dir === -1 ? colIndex < currentDropIndex || colIndex > dragColumnIndex : colIndex < dragColumnIndex || colIndex >= currentDropIndex;
|
|
4762
|
-
let newPosition = "";
|
|
4763
|
-
if (dir === -1) {
|
|
4764
|
-
newPosition = isDragColumn ? `var(${columnOffsetAtIndex4}-${currentDropIndex})` : isOutsideCol ? `var(${columnOffsetAtIndex4}-${colIndex})` : `calc( var(${columnOffsetAtIndex4}-${colIndex}) + var(${columnWidthAtIndex3}-${dragColumnIndex}) )`;
|
|
4765
|
-
} else {
|
|
4766
|
-
newPosition = isOutsideCol ? `var(${columnOffsetAtIndex4}-${colIndex})` : isDragColumn ? `calc( var(${columnOffsetAtIndex4}-${currentDropIndex - 1}) + var(${columnWidthAtIndex3}-${currentDropIndex - 1}) - var(${columnWidthAtIndex3}-${dragColumnIndex}) )` : `calc( var(${columnOffsetAtIndex4}-${colIndex}) - var(${columnWidthAtIndex3}-${dragColumnIndex}) )`;
|
|
4767
|
-
}
|
|
4768
|
-
setInfiniteColumnOffsetWhileReordering(colIndex, newPosition, rootRef.current);
|
|
4769
|
-
});
|
|
4770
|
-
}
|
|
4947
|
+
reorderDragResult = dragger.onMove(e2);
|
|
4771
4948
|
};
|
|
4772
|
-
function persistColumnOrder() {
|
|
4773
|
-
if (currentDropIndex != null && currentDropIndex !== dragColumnIndex) {
|
|
4774
|
-
const newOrder = moveXatY(getComputed().computedColumnOrder, dragColumnIndex, currentDropIndex > dragColumnIndex ? currentDropIndex - 1 : currentDropIndex);
|
|
4775
|
-
computedVisibleColumns.forEach((col) => {
|
|
4776
|
-
setInfiniteColumnOffsetWhileReordering(col.computedVisibleIndex, "", rootRef.current);
|
|
4777
|
-
});
|
|
4778
|
-
componentActions.columnOrder = newOrder;
|
|
4779
|
-
}
|
|
4780
|
-
}
|
|
4781
4949
|
const onPointerUp = (e2) => {
|
|
4782
4950
|
var _a3;
|
|
4783
4951
|
const target2 = domRef.current;
|
|
4784
4952
|
(_a3 = rootRef.current) == null ? void 0 : _a3.classList.remove(InfiniteClsShiftingColumns);
|
|
4785
|
-
|
|
4786
|
-
speedScroller.stop();
|
|
4953
|
+
dragger.stop();
|
|
4787
4954
|
brain.setAvailableSize(__spreadValues({}, initialAvailableSize));
|
|
4788
4955
|
computedVisibleColumns.forEach((col) => {
|
|
4789
4956
|
clearInfiniteColumnReorderDuration(col.computedVisibleIndex, rootRef.current);
|
|
@@ -4801,7 +4968,9 @@ var useColumnPointerEvents = ({
|
|
|
4801
4968
|
if (!didDragAtLeastOnce && dragColumn.computedSortable) {
|
|
4802
4969
|
dragColumn.toggleSort();
|
|
4803
4970
|
}
|
|
4804
|
-
|
|
4971
|
+
if (reorderDragResult) {
|
|
4972
|
+
persistColumnOrder(reorderDragResult);
|
|
4973
|
+
}
|
|
4805
4974
|
componentActions.columnReorderDragColumnId = false;
|
|
4806
4975
|
};
|
|
4807
4976
|
target.addEventListener("pointermove", onPointerMove);
|
|
@@ -8633,38 +8802,6 @@ function lazyLoadRange(options, cache) {
|
|
|
8633
8802
|
}, initialPromise);
|
|
8634
8803
|
}
|
|
8635
8804
|
|
|
8636
|
-
// src/utils/shallowEqualObjects.ts
|
|
8637
|
-
function shallowEqualObjects(objA, objB, ignoreKeys) {
|
|
8638
|
-
if (objA === objB) {
|
|
8639
|
-
return true;
|
|
8640
|
-
}
|
|
8641
|
-
if (!objA || !objB) {
|
|
8642
|
-
return false;
|
|
8643
|
-
}
|
|
8644
|
-
var aKeys = Object.keys(objA);
|
|
8645
|
-
var bKeys = Object.keys(objB);
|
|
8646
|
-
if (ignoreKeys) {
|
|
8647
|
-
aKeys = aKeys.filter((key2) => !ignoreKeys.has(key2));
|
|
8648
|
-
bKeys = bKeys.filter((key2) => !ignoreKeys.has(key2));
|
|
8649
|
-
}
|
|
8650
|
-
var len = aKeys.length;
|
|
8651
|
-
if (bKeys.length !== len) {
|
|
8652
|
-
return false;
|
|
8653
|
-
}
|
|
8654
|
-
for (var i = 0; i < len; i++) {
|
|
8655
|
-
var key = aKeys[i];
|
|
8656
|
-
if (ignoreKeys) {
|
|
8657
|
-
if (ignoreKeys.has(key)) {
|
|
8658
|
-
continue;
|
|
8659
|
-
}
|
|
8660
|
-
}
|
|
8661
|
-
if (objA[key] !== objB[key] || !Object.prototype.hasOwnProperty.call(objB, key)) {
|
|
8662
|
-
return false;
|
|
8663
|
-
}
|
|
8664
|
-
}
|
|
8665
|
-
return true;
|
|
8666
|
-
}
|
|
8667
|
-
|
|
8668
8805
|
// src/components/utils/discardCallsWithEqualArg.ts
|
|
8669
8806
|
var map = new WeakMap();
|
|
8670
8807
|
var getCompareDefault = (a) => a;
|
|
@@ -10591,7 +10728,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
10591
10728
|
const valid = useMemo11(() => {
|
|
10592
10729
|
let valid2 = isValidLicense(licenseKey, {
|
|
10593
10730
|
publishedAt: 1624970570587,
|
|
10594
|
-
version: "0.3.
|
|
10731
|
+
version: "0.3.22"
|
|
10595
10732
|
});
|
|
10596
10733
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
10597
10734
|
return true;
|
|
@@ -10610,14 +10747,14 @@ function useScrollToActiveCell(activeCellIndex, dataCount, imperativeApi) {
|
|
|
10610
10747
|
useEffect26(() => {
|
|
10611
10748
|
if (activeCellIndex != null) {
|
|
10612
10749
|
didScrollRef.current = false;
|
|
10613
|
-
|
|
10750
|
+
cancelRaf(rafId.current);
|
|
10614
10751
|
}
|
|
10615
10752
|
}, [activeCellIndex]);
|
|
10616
10753
|
useEffect26(() => {
|
|
10617
10754
|
if (activeCellIndex != null && !didScrollRef.current) {
|
|
10618
10755
|
let tryScroll = function(times = 0) {
|
|
10619
10756
|
times++;
|
|
10620
|
-
|
|
10757
|
+
cancelRaf(rafId.current);
|
|
10621
10758
|
rafId.current = raf(() => {
|
|
10622
10759
|
didScrollRef.current = imperativeApi.scrollCellIntoView(activeCellIndex[0], activeCellIndex[1], {
|
|
10623
10760
|
offset: 30
|
|
@@ -10630,7 +10767,7 @@ function useScrollToActiveCell(activeCellIndex, dataCount, imperativeApi) {
|
|
|
10630
10767
|
tryScroll();
|
|
10631
10768
|
}
|
|
10632
10769
|
return () => {
|
|
10633
|
-
|
|
10770
|
+
cancelRaf(rafId.current);
|
|
10634
10771
|
};
|
|
10635
10772
|
}, [activeCellIndex, dataCount]);
|
|
10636
10773
|
}
|
|
@@ -10956,6 +11093,7 @@ var forwardProps3 = (setupState) => {
|
|
|
10956
11093
|
onScrollToBottom: 1,
|
|
10957
11094
|
onScrollStop: 1,
|
|
10958
11095
|
scrollToBottomOffset: 1,
|
|
11096
|
+
columnPinning: 1,
|
|
10959
11097
|
rowStyle: 1,
|
|
10960
11098
|
rowProps: 1,
|
|
10961
11099
|
rowClassName: 1,
|
|
@@ -11040,8 +11178,6 @@ var mapPropsToState2 = (params) => {
|
|
|
11040
11178
|
});
|
|
11041
11179
|
const computedColumns = state.columnsWhenGrouping || state.columnsWhenInlineGroupRenderStrategy || state.columns;
|
|
11042
11180
|
return {
|
|
11043
|
-
columnPinning: state.columnPinningWhileDragging || state.columnPinning || props.columnPinning,
|
|
11044
|
-
columnPinningWhileDragging: state.columnPinningWhileDragging,
|
|
11045
11181
|
controlledColumnVisibility: !!props.columnVisibility,
|
|
11046
11182
|
groupRenderStrategy,
|
|
11047
11183
|
groupBy,
|