@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.js
CHANGED
|
@@ -1092,7 +1092,7 @@ function stripVar(cssVariableWithVarString) {
|
|
|
1092
1092
|
}
|
|
1093
1093
|
|
|
1094
1094
|
// src/components/InfiniteTable/theme.css.ts
|
|
1095
|
-
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)",
|
|
1095
|
+
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)" };
|
|
1096
1096
|
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)" } } };
|
|
1097
1097
|
var columnHeaderHeightName = "column-header-height";
|
|
1098
1098
|
|
|
@@ -4233,7 +4233,6 @@ function useCellClassName(column, baseClasses, variants, extraFlags) {
|
|
|
4233
4233
|
}
|
|
4234
4234
|
|
|
4235
4235
|
// src/components/InfiniteTable/hooks/useColumnPointerEvents.ts
|
|
4236
|
-
var import_binary_search2 = __toModule(require_binary_search());
|
|
4237
4236
|
var import_react17 = __toModule(require("react"));
|
|
4238
4237
|
|
|
4239
4238
|
// src/components/InfiniteTable/hooks/useInfiniteTable.ts
|
|
@@ -4255,23 +4254,6 @@ var useInfiniteTable = () => {
|
|
|
4255
4254
|
return (0, import_react16.useContext)(TableContext2);
|
|
4256
4255
|
};
|
|
4257
4256
|
|
|
4258
|
-
// src/components/InfiniteTable/utils/moveXatY.ts
|
|
4259
|
-
var moveXatY = (arr, dragIndex, dropIndex) => {
|
|
4260
|
-
arr = [...arr];
|
|
4261
|
-
if (dragIndex === dropIndex || arr[dragIndex] === void 0 || arr[dropIndex] === void 0) {
|
|
4262
|
-
return arr;
|
|
4263
|
-
}
|
|
4264
|
-
const dragItem = arr[dragIndex];
|
|
4265
|
-
if (dropIndex < dragIndex) {
|
|
4266
|
-
arr.splice(dragIndex, 1);
|
|
4267
|
-
arr.splice(dropIndex, 0, dragItem);
|
|
4268
|
-
} else {
|
|
4269
|
-
arr.splice(dragIndex, 1);
|
|
4270
|
-
arr.splice(dropIndex, 0, dragItem);
|
|
4271
|
-
}
|
|
4272
|
-
return arr;
|
|
4273
|
-
};
|
|
4274
|
-
|
|
4275
4257
|
// src/components/InfiniteTable/InfiniteCls.css.ts
|
|
4276
4258
|
var import_createRuntimeFn = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
4277
4259
|
var FooterCls = "_16lm1iw1";
|
|
@@ -4280,9 +4262,9 @@ var InfiniteClsHasPinnedEnd = "_1yeub2vo";
|
|
|
4280
4262
|
var InfiniteClsHasPinnedStart = "_1yeub2vn";
|
|
4281
4263
|
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"]] });
|
|
4282
4264
|
var InfiniteClsShiftingColumns = "_1yeub2vl";
|
|
4283
|
-
var PinnedEndIndicatorBorder = "_1yeub2vr _1yeub2vp _16lm1iw2 _16lm1iw12 _16lm1iwe _16lm1iwx _16lm1iw10 _16lm1iw1n _16lm1iwf
|
|
4265
|
+
var PinnedEndIndicatorBorder = "_1yeub2vr _1yeub2vp _16lm1iw2 _16lm1iw12 _16lm1iwe _16lm1iwx _16lm1iw10 _16lm1iw1n _16lm1iwf _16lm1iwp";
|
|
4284
4266
|
var PinnedRowsContainerClsVariants = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "", variantClassNames: { pinned: { start: "_1yeub2vi", end: "_1yeub2vj", false: "_1yeub2vk" } }, defaultVariants: {}, compoundVariants: [] });
|
|
4285
|
-
var PinnedStartIndicatorBorder = "_1yeub2vq _1yeub2vp _16lm1iw2 _16lm1iw12 _16lm1iwe _16lm1iwx _16lm1iw10 _16lm1iw1n _16lm1iwf
|
|
4267
|
+
var PinnedStartIndicatorBorder = "_1yeub2vq _1yeub2vp _16lm1iw2 _16lm1iw12 _16lm1iwe _16lm1iwx _16lm1iw10 _16lm1iw1n _16lm1iwf _16lm1iwp";
|
|
4286
4268
|
|
|
4287
4269
|
// src/components/utils/getScrollbarWidth.ts
|
|
4288
4270
|
var scrollbarWidth;
|
|
@@ -4331,12 +4313,10 @@ var activeCellColWidth = stripVar(InternalVars.activeCellColWidth);
|
|
|
4331
4313
|
var activeCellColOffset = stripVar(InternalVars.activeCellColOffset);
|
|
4332
4314
|
var baseZIndexForCells = stripVar(InternalVars.baseZIndexForCells);
|
|
4333
4315
|
var pinnedStartWidthCSSVar = stripVar(InternalVars.pinnedStartWidth);
|
|
4334
|
-
var pinnedStartDraggingWidthCSSVar = stripVar(InternalVars.pinnedStartDraggingWidth);
|
|
4335
4316
|
var bodyWidthCSSVar = stripVar(InternalVars.bodyWidth);
|
|
4336
4317
|
var bodyHeightCSSVar = stripVar(InternalVars.bodyHeight);
|
|
4337
4318
|
var pinnedEndOffsetCSSVar = stripVar(InternalVars.pinnedEndOffset);
|
|
4338
4319
|
var pinnedEndWidthCSSVar = stripVar(InternalVars.pinnedEndWidth);
|
|
4339
|
-
var pinnedEndDraggingWidthCSSVar = stripVar(InternalVars.pinnedEndDraggingWidth);
|
|
4340
4320
|
var computedVisibleColumnsCountCSSVar = stripVar(InternalVars.computedVisibleColumnsCount);
|
|
4341
4321
|
function getColumnZIndex(col, params) {
|
|
4342
4322
|
let computedZIndex = "auto";
|
|
@@ -4397,8 +4377,8 @@ function useDOMProps(initialDOMProps) {
|
|
|
4397
4377
|
cssVars[computedVisibleColumnsCountCSSVar] = computedVisibleColumns.length;
|
|
4398
4378
|
cssVars[scrollbarWidthHorizontal] = scrollbars.horizontal ? `${scrollbarWidth2}px` : "0px";
|
|
4399
4379
|
cssVars[scrollbarWidthVertical] = scrollbars.vertical ? `${scrollbarWidth2}px` : "0px";
|
|
4400
|
-
cssVars[pinnedStartWidthCSSVar] = `calc( ` + computedPinnedStartColumns.map((c) => `var(${getCSSVarNameForColWidth(c.computedVisibleIndex)})`).join(" + ") +
|
|
4401
|
-
cssVars[pinnedEndWidthCSSVar] = `calc( ` + computedPinnedEndColumns.map((c) => `var(${getCSSVarNameForColWidth(c.computedVisibleIndex)})`).join(" + ") +
|
|
4380
|
+
cssVars[pinnedStartWidthCSSVar] = `calc( ` + computedPinnedStartColumns.map((c) => `var(${getCSSVarNameForColWidth(c.computedVisibleIndex)})`).join(" + ") + ")";
|
|
4381
|
+
cssVars[pinnedEndWidthCSSVar] = `calc( ` + computedPinnedEndColumns.map((c) => `var(${getCSSVarNameForColWidth(c.computedVisibleIndex)})`).join(" + ") + ")";
|
|
4402
4382
|
cssVars[baseZIndexForCells] = computedVisibleColumns.length * 10;
|
|
4403
4383
|
cssVars[pinnedEndOffsetCSSVar] = `calc( var(${bodyWidthCSSVar}) - var(${pinnedEndWidthCSSVar}) - var(${scrollbarWidthVertical}) )`;
|
|
4404
4384
|
cssVars[bodyWidthCSSVar] = `${bodySize.width}px`;
|
|
@@ -4471,6 +4451,26 @@ function useDOMProps(initialDOMProps) {
|
|
|
4471
4451
|
return domProps;
|
|
4472
4452
|
}
|
|
4473
4453
|
|
|
4454
|
+
// src/components/InfiniteTable/hooks/reorderColumnsOnDrag.ts
|
|
4455
|
+
var import_binary_search2 = __toModule(require_binary_search());
|
|
4456
|
+
|
|
4457
|
+
// src/components/InfiniteTable/utils/moveXatY.ts
|
|
4458
|
+
var moveXatY = (arr, dragIndex, dropIndex) => {
|
|
4459
|
+
arr = [...arr];
|
|
4460
|
+
if (dragIndex === dropIndex || arr[dragIndex] === void 0 || arr[dropIndex] === void 0) {
|
|
4461
|
+
return arr;
|
|
4462
|
+
}
|
|
4463
|
+
const dragItem = arr[dragIndex];
|
|
4464
|
+
if (dropIndex < dragIndex) {
|
|
4465
|
+
arr.splice(dragIndex, 1);
|
|
4466
|
+
arr.splice(dropIndex, 0, dragItem);
|
|
4467
|
+
} else {
|
|
4468
|
+
arr.splice(dragIndex, 1);
|
|
4469
|
+
arr.splice(dropIndex, 0, dragItem);
|
|
4470
|
+
}
|
|
4471
|
+
return arr;
|
|
4472
|
+
};
|
|
4473
|
+
|
|
4474
4474
|
// src/components/InfiniteTable/utils/progressiveSpeedScroller.ts
|
|
4475
4475
|
var progressiveSpeedScroller = (staticOptions) => {
|
|
4476
4476
|
let scrollLeftRafId = null;
|
|
@@ -4547,19 +4547,284 @@ var progressiveSpeedScroller = (staticOptions) => {
|
|
|
4547
4547
|
};
|
|
4548
4548
|
};
|
|
4549
4549
|
|
|
4550
|
+
// src/components/InfiniteTable/hooks/reorderColumnsOnDrag.ts
|
|
4551
|
+
var PROXY_OFFSET = 10;
|
|
4552
|
+
var pinnedStartWidthCSSVar2 = stripVar(InternalVars.pinnedStartWidth);
|
|
4553
|
+
function reorderColumnsOnDrag(params) {
|
|
4554
|
+
const {
|
|
4555
|
+
columnOffsetAtIndexCSSVar,
|
|
4556
|
+
columnWidthAtIndexCSSVar,
|
|
4557
|
+
computedVisibleColumns,
|
|
4558
|
+
computedVisibleColumnsMap,
|
|
4559
|
+
computedPinnedEndColumns,
|
|
4560
|
+
computedPinnedStartColumns,
|
|
4561
|
+
dragColumnId,
|
|
4562
|
+
infiniteDOMNode,
|
|
4563
|
+
brain,
|
|
4564
|
+
dragColumnHeaderTargetRect,
|
|
4565
|
+
tableRect,
|
|
4566
|
+
setProxyPosition,
|
|
4567
|
+
imperativeApi
|
|
4568
|
+
} = params;
|
|
4569
|
+
function getCurrentPinnedWidth(pinned) {
|
|
4570
|
+
let currentWidth = pinned === "start" ? pinnedStartInitialWidth : pinnedEndInitialWidth;
|
|
4571
|
+
if (initialDragColumnPinned === currentDragColumnPinned) {
|
|
4572
|
+
return currentWidth;
|
|
4573
|
+
}
|
|
4574
|
+
if (currentDragColumnPinned === pinned) {
|
|
4575
|
+
return currentWidth + dragColumn.computedWidth;
|
|
4576
|
+
}
|
|
4577
|
+
if (initialDragColumnPinned === pinned) {
|
|
4578
|
+
return currentWidth - dragColumn.computedWidth;
|
|
4579
|
+
}
|
|
4580
|
+
return currentWidth;
|
|
4581
|
+
}
|
|
4582
|
+
function isColumnVisible2(b) {
|
|
4583
|
+
if (b.index === dragColumnIndex) {
|
|
4584
|
+
return true;
|
|
4585
|
+
}
|
|
4586
|
+
const col = computedVisibleColumns[b.index];
|
|
4587
|
+
if (col.computedPinned) {
|
|
4588
|
+
return true;
|
|
4589
|
+
}
|
|
4590
|
+
const scrollLeft2 = brain.getScrollPosition().scrollLeft;
|
|
4591
|
+
return col.computedOffset >= scrollLeft2 + getCurrentPinnedWidth("start") && col.computedOffset + col.computedWidth < scrollLeft2 + tableRect.width - getCurrentPinnedWidth("end");
|
|
4592
|
+
}
|
|
4593
|
+
const getBreakPoints = (columns) => {
|
|
4594
|
+
const breakpoints = [];
|
|
4595
|
+
columns.forEach((c) => {
|
|
4596
|
+
const b = {
|
|
4597
|
+
columnId: c.id,
|
|
4598
|
+
index: c.computedVisibleIndex,
|
|
4599
|
+
breakpoint: c.computedOffset + Math.round(c.computedWidth / 2)
|
|
4600
|
+
};
|
|
4601
|
+
if (isColumnVisible2(b)) {
|
|
4602
|
+
breakpoints.push(b);
|
|
4603
|
+
}
|
|
4604
|
+
});
|
|
4605
|
+
return breakpoints;
|
|
4606
|
+
};
|
|
4607
|
+
const initialPinnedStartCount = computedPinnedStartColumns.length;
|
|
4608
|
+
let currentPinnedStartCount = initialPinnedStartCount;
|
|
4609
|
+
const initialMousePosition = {
|
|
4610
|
+
clientX: Math.round(params.initialMousePosition.clientX),
|
|
4611
|
+
clientY: Math.round(params.initialMousePosition.clientY)
|
|
4612
|
+
};
|
|
4613
|
+
const initialProxyPosition = {
|
|
4614
|
+
left: initialMousePosition.clientX - tableRect.left - (initialMousePosition.clientX - dragColumnHeaderTargetRect.left) + PROXY_OFFSET,
|
|
4615
|
+
top: initialMousePosition.clientY - tableRect.top - (initialMousePosition.clientY - dragColumnHeaderTargetRect.top) + PROXY_OFFSET
|
|
4616
|
+
};
|
|
4617
|
+
const initialScrollPosition2 = brain.getScrollPosition();
|
|
4618
|
+
const initialIndexes = computedVisibleColumns.map((c) => c.computedVisibleIndex);
|
|
4619
|
+
let currentIndexes = initialIndexes;
|
|
4620
|
+
const dragColumn = computedVisibleColumnsMap.get(dragColumnId);
|
|
4621
|
+
const dragColumnIndex = dragColumn.computedVisibleIndex;
|
|
4622
|
+
const initialDragColumnPinned = dragColumn == null ? void 0 : dragColumn.computedPinned;
|
|
4623
|
+
let currentDropIndex = dragColumnIndex;
|
|
4624
|
+
let currentDragColumnPinned = initialDragColumnPinned;
|
|
4625
|
+
const pinnedStartInitialWidth = brain.getFixedStartColsWidth();
|
|
4626
|
+
const pinnedEndInitialWidth = brain.getFixedEndColsWidth();
|
|
4627
|
+
let currentMousePosition = initialMousePosition;
|
|
4628
|
+
let currentDiff = {
|
|
4629
|
+
x: 0,
|
|
4630
|
+
y: 0
|
|
4631
|
+
};
|
|
4632
|
+
let dir = 1;
|
|
4633
|
+
let diffX = 0;
|
|
4634
|
+
function updatePositionAndDiff(mousePosition) {
|
|
4635
|
+
const clientX = Math.round(mousePosition.clientX);
|
|
4636
|
+
const clientY = Math.round(mousePosition.clientY);
|
|
4637
|
+
if (clientX === currentMousePosition.clientX && clientY === currentMousePosition.clientY) {
|
|
4638
|
+
return;
|
|
4639
|
+
}
|
|
4640
|
+
currentMousePosition = { clientX, clientY };
|
|
4641
|
+
const currentScrollLeft = brain.getScrollPosition().scrollLeft;
|
|
4642
|
+
const scrollLeftDiff = currentScrollLeft - initialScrollPosition2.scrollLeft;
|
|
4643
|
+
currentDiff.x = currentMousePosition.clientX - initialMousePosition.clientX;
|
|
4644
|
+
currentDiff.y = currentMousePosition.clientY - initialMousePosition.clientY;
|
|
4645
|
+
diffX = currentDiff.x + scrollLeftDiff;
|
|
4646
|
+
dir = diffX < 0 ? -1 : 1;
|
|
4647
|
+
setProxyPosition({
|
|
4648
|
+
left: initialProxyPosition.left + currentDiff.x,
|
|
4649
|
+
top: initialProxyPosition.top + currentDiff.y
|
|
4650
|
+
});
|
|
4651
|
+
}
|
|
4652
|
+
function updatePinnedStartCount(columnIndexes) {
|
|
4653
|
+
let pinnedStartCount = 0;
|
|
4654
|
+
if (!initialDragColumnPinned) {
|
|
4655
|
+
columnIndexes.forEach((colIndex, i) => {
|
|
4656
|
+
var _a;
|
|
4657
|
+
if (((_a = computedVisibleColumns[colIndex]) == null ? void 0 : _a.computedPinned) === "start") {
|
|
4658
|
+
pinnedStartCount = i + 1;
|
|
4659
|
+
}
|
|
4660
|
+
});
|
|
4661
|
+
} else if (initialDragColumnPinned === "start") {
|
|
4662
|
+
columnIndexes.forEach((colIndex, i) => {
|
|
4663
|
+
var _a;
|
|
4664
|
+
if (pinnedStartCount) {
|
|
4665
|
+
return;
|
|
4666
|
+
}
|
|
4667
|
+
if (((_a = computedVisibleColumns[colIndex]) == null ? void 0 : _a.computedPinned) !== "start") {
|
|
4668
|
+
pinnedStartCount = i;
|
|
4669
|
+
}
|
|
4670
|
+
});
|
|
4671
|
+
}
|
|
4672
|
+
currentPinnedStartCount = pinnedStartCount;
|
|
4673
|
+
updatePinningMarker("start", columnIndexes, pinnedStartCount);
|
|
4674
|
+
}
|
|
4675
|
+
function updatePinningMarker(where, columnIndexes, pinnedCount) {
|
|
4676
|
+
if (where === "start") {
|
|
4677
|
+
let width = 0;
|
|
4678
|
+
for (let i = 0; i < pinnedCount; i++) {
|
|
4679
|
+
const colIndex = columnIndexes[i];
|
|
4680
|
+
const col = computedVisibleColumns[colIndex];
|
|
4681
|
+
width += col.computedWidth;
|
|
4682
|
+
}
|
|
4683
|
+
setInfiniteVarOnRoot(pinnedStartWidthCSSVar2, `${width}px`, infiniteDOMNode);
|
|
4684
|
+
}
|
|
4685
|
+
}
|
|
4686
|
+
function updateDropIndex(newDropIndex) {
|
|
4687
|
+
if (newDropIndex === currentDropIndex) {
|
|
4688
|
+
return;
|
|
4689
|
+
}
|
|
4690
|
+
currentDropIndex = newDropIndex;
|
|
4691
|
+
const newColumnIndexes = moveXatY(initialIndexes, dragColumnIndex, currentDropIndex > dragColumnIndex ? currentDropIndex - 1 : currentDropIndex);
|
|
4692
|
+
let pinnedStartCount = 0;
|
|
4693
|
+
currentPinnedStartCount = pinnedStartCount;
|
|
4694
|
+
const indexesWithTransition = new Set();
|
|
4695
|
+
newColumnIndexes.forEach((newIndex, i) => {
|
|
4696
|
+
const currentIndex = currentIndexes[i];
|
|
4697
|
+
if (newIndex !== currentIndex) {
|
|
4698
|
+
indexesWithTransition.add(newIndex);
|
|
4699
|
+
}
|
|
4700
|
+
updatePinnedStartCount(newColumnIndexes);
|
|
4701
|
+
});
|
|
4702
|
+
currentIndexes = newColumnIndexes;
|
|
4703
|
+
adjustAllOffsets(indexesWithTransition);
|
|
4704
|
+
return {
|
|
4705
|
+
newColumnIndexes,
|
|
4706
|
+
indexesWithTransition,
|
|
4707
|
+
pinnedStartCount: currentPinnedStartCount
|
|
4708
|
+
};
|
|
4709
|
+
}
|
|
4710
|
+
function adjustAllOffsets(indexesWithTransition) {
|
|
4711
|
+
computedVisibleColumns.forEach((col) => {
|
|
4712
|
+
const colIndex = col.computedVisibleIndex;
|
|
4713
|
+
if (indexesWithTransition.has(colIndex)) {
|
|
4714
|
+
restoreInfiniteColumnReorderDuration(colIndex, infiniteDOMNode);
|
|
4715
|
+
} else {
|
|
4716
|
+
clearInfiniteColumnReorderDuration(colIndex, infiniteDOMNode);
|
|
4717
|
+
}
|
|
4718
|
+
const isDragColumn = colIndex === dragColumnIndex;
|
|
4719
|
+
let isOutsideCol = dir === -1 ? colIndex < currentDropIndex || colIndex > dragColumnIndex : colIndex < dragColumnIndex || colIndex >= currentDropIndex;
|
|
4720
|
+
let newPosition = "";
|
|
4721
|
+
if (dir === -1) {
|
|
4722
|
+
newPosition = isDragColumn ? `var(${columnOffsetAtIndexCSSVar}-${currentDropIndex})` : isOutsideCol ? `var(${columnOffsetAtIndexCSSVar}-${colIndex})` : `calc( var(${columnOffsetAtIndexCSSVar}-${colIndex}) + var(${columnWidthAtIndexCSSVar}-${dragColumnIndex}) )`;
|
|
4723
|
+
} else {
|
|
4724
|
+
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}) )`;
|
|
4725
|
+
}
|
|
4726
|
+
setInfiniteColumnOffsetWhileReordering(colIndex, newPosition, infiniteDOMNode);
|
|
4727
|
+
});
|
|
4728
|
+
}
|
|
4729
|
+
const pinnedStartColsRight = tableRect.left + getCurrentPinnedWidth("start");
|
|
4730
|
+
const pinnedEndColsLeft = tableRect.right - getCurrentPinnedWidth("end");
|
|
4731
|
+
const speedScroller = progressiveSpeedScroller({
|
|
4732
|
+
scrollOffsetStart: pinnedStartColsRight,
|
|
4733
|
+
scrollOffsetEnd: pinnedEndColsLeft
|
|
4734
|
+
});
|
|
4735
|
+
updatePositionAndDiff(initialMousePosition);
|
|
4736
|
+
return {
|
|
4737
|
+
speedScroller,
|
|
4738
|
+
stop() {
|
|
4739
|
+
speedScroller.stop();
|
|
4740
|
+
},
|
|
4741
|
+
onMove(mousePosition) {
|
|
4742
|
+
updatePositionAndDiff(mousePosition);
|
|
4743
|
+
speedScroller.scroll({
|
|
4744
|
+
mousePosition: currentMousePosition,
|
|
4745
|
+
get scrollLeft() {
|
|
4746
|
+
return brain.getScrollPosition().scrollLeft;
|
|
4747
|
+
},
|
|
4748
|
+
set scrollLeft(value) {
|
|
4749
|
+
imperativeApi.scrollLeft = value;
|
|
4750
|
+
}
|
|
4751
|
+
});
|
|
4752
|
+
const breakpoints = getBreakPoints(computedVisibleColumns);
|
|
4753
|
+
let currentPos = dir === -1 ? dragColumn.computedOffset + diffX : dragColumn.computedOffset + dragColumn.computedWidth + diffX;
|
|
4754
|
+
let idx = (0, import_binary_search2.default)(breakpoints, currentPos, ({ breakpoint }, value) => {
|
|
4755
|
+
return breakpoint < value ? -1 : breakpoint > value ? 1 : 0;
|
|
4756
|
+
});
|
|
4757
|
+
if (idx < 0) {
|
|
4758
|
+
idx = ~idx;
|
|
4759
|
+
}
|
|
4760
|
+
idx = breakpoints[idx] ? breakpoints[idx].index : breakpoints[breakpoints.length - 1].index + 1;
|
|
4761
|
+
if (idx != null && idx !== currentDropIndex) {
|
|
4762
|
+
if (dir === 1 && currentDropIndex === dragColumnIndex + 1) {
|
|
4763
|
+
idx = dragColumnIndex;
|
|
4764
|
+
}
|
|
4765
|
+
updateDropIndex(idx);
|
|
4766
|
+
}
|
|
4767
|
+
const columnPinning = {};
|
|
4768
|
+
computedPinnedEndColumns.forEach((col) => {
|
|
4769
|
+
columnPinning[col.id] = "end";
|
|
4770
|
+
});
|
|
4771
|
+
for (let i = 0; i < currentPinnedStartCount; i++) {
|
|
4772
|
+
const colIndex = currentIndexes[i];
|
|
4773
|
+
const col = computedVisibleColumns[colIndex];
|
|
4774
|
+
columnPinning[col.id] = "start";
|
|
4775
|
+
}
|
|
4776
|
+
const columnOrder = currentIndexes.map((colIndex) => {
|
|
4777
|
+
return computedVisibleColumns[colIndex].id;
|
|
4778
|
+
});
|
|
4779
|
+
return {
|
|
4780
|
+
columnPinning,
|
|
4781
|
+
columnOrder
|
|
4782
|
+
};
|
|
4783
|
+
}
|
|
4784
|
+
};
|
|
4785
|
+
}
|
|
4786
|
+
|
|
4787
|
+
// src/utils/shallowEqualObjects.ts
|
|
4788
|
+
function shallowEqualObjects(objA, objB, ignoreKeys) {
|
|
4789
|
+
if (objA === objB) {
|
|
4790
|
+
return true;
|
|
4791
|
+
}
|
|
4792
|
+
if (!objA || !objB) {
|
|
4793
|
+
return false;
|
|
4794
|
+
}
|
|
4795
|
+
var aKeys = Object.keys(objA);
|
|
4796
|
+
var bKeys = Object.keys(objB);
|
|
4797
|
+
if (ignoreKeys) {
|
|
4798
|
+
aKeys = aKeys.filter((key2) => !ignoreKeys.has(key2));
|
|
4799
|
+
bKeys = bKeys.filter((key2) => !ignoreKeys.has(key2));
|
|
4800
|
+
}
|
|
4801
|
+
var len = aKeys.length;
|
|
4802
|
+
if (bKeys.length !== len) {
|
|
4803
|
+
return false;
|
|
4804
|
+
}
|
|
4805
|
+
for (var i = 0; i < len; i++) {
|
|
4806
|
+
var key = aKeys[i];
|
|
4807
|
+
if (ignoreKeys) {
|
|
4808
|
+
if (ignoreKeys.has(key)) {
|
|
4809
|
+
continue;
|
|
4810
|
+
}
|
|
4811
|
+
}
|
|
4812
|
+
if (objA[key] !== objB[key] || !Object.prototype.hasOwnProperty.call(objB, key)) {
|
|
4813
|
+
return false;
|
|
4814
|
+
}
|
|
4815
|
+
}
|
|
4816
|
+
return true;
|
|
4817
|
+
}
|
|
4818
|
+
|
|
4550
4819
|
// src/components/InfiniteTable/hooks/useColumnPointerEvents.ts
|
|
4551
4820
|
var columnOffsetAtIndex4 = stripVar(InternalVars.columnOffsetAtIndex);
|
|
4552
4821
|
var columnWidthAtIndex3 = stripVar(InternalVars.columnWidthAtIndex);
|
|
4553
4822
|
var baseZIndexForCells2 = stripVar(InternalVars.baseZIndexForCells);
|
|
4554
|
-
var
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
index: c.computedVisibleIndex,
|
|
4560
|
-
breakpoint: c.computedOffset + Math.round(c.computedWidth / 2)
|
|
4561
|
-
};
|
|
4562
|
-
}).filter(Boolean);
|
|
4823
|
+
var equalPinning = (pinning1, pinning2) => {
|
|
4824
|
+
if (!!pinning1 != !!pinning2) {
|
|
4825
|
+
return false;
|
|
4826
|
+
}
|
|
4827
|
+
return shallowEqualObjects(pinning1, pinning2);
|
|
4563
4828
|
};
|
|
4564
4829
|
var useColumnPointerEvents = ({
|
|
4565
4830
|
columnId,
|
|
@@ -4571,6 +4836,7 @@ var useColumnPointerEvents = ({
|
|
|
4571
4836
|
componentActions,
|
|
4572
4837
|
computed,
|
|
4573
4838
|
getComputed,
|
|
4839
|
+
getState,
|
|
4574
4840
|
imperativeApi,
|
|
4575
4841
|
componentState: { domRef: rootRef, brain, headerBrain }
|
|
4576
4842
|
} = useInfiniteTable();
|
|
@@ -4579,78 +4845,52 @@ var useColumnPointerEvents = ({
|
|
|
4579
4845
|
const {
|
|
4580
4846
|
computedVisibleColumns,
|
|
4581
4847
|
computedVisibleColumnsMap,
|
|
4582
|
-
computedPinnedStartColumns
|
|
4848
|
+
computedPinnedStartColumns,
|
|
4849
|
+
computedUnpinnedColumns,
|
|
4850
|
+
computedPinnedEndColumns
|
|
4583
4851
|
} = getComputed();
|
|
4584
4852
|
const dragColumn = computedVisibleColumnsMap.get(columnId);
|
|
4585
|
-
const initialBreakpoints = getBreakPoints(computedVisibleColumns);
|
|
4586
4853
|
const target = domRef.current;
|
|
4587
4854
|
const targetRect = target.getBoundingClientRect();
|
|
4588
4855
|
const tableRect = rootRef.current.getBoundingClientRect();
|
|
4589
4856
|
const initialAvailableSize = brain.getAvailableSize();
|
|
4590
4857
|
const dragColumnIndex = dragColumn.computedVisibleIndex;
|
|
4591
|
-
let
|
|
4592
|
-
|
|
4593
|
-
const
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
|
|
4605
|
-
|
|
4606
|
-
|
|
4607
|
-
|
|
4858
|
+
let initialCursor = (_a2 = target.style.cursor) != null ? _a2 : "auto";
|
|
4859
|
+
let didDragAtLeastOnce = false;
|
|
4860
|
+
const dragger = reorderColumnsOnDrag({
|
|
4861
|
+
brain,
|
|
4862
|
+
columnOffsetAtIndexCSSVar: columnOffsetAtIndex4,
|
|
4863
|
+
columnWidthAtIndexCSSVar: columnWidthAtIndex3,
|
|
4864
|
+
computedPinnedEndColumns,
|
|
4865
|
+
computedPinnedStartColumns,
|
|
4866
|
+
computedUnpinnedColumns,
|
|
4867
|
+
computedVisibleColumns,
|
|
4868
|
+
computedVisibleColumnsMap,
|
|
4869
|
+
dragColumnHeaderTargetRect: targetRect,
|
|
4870
|
+
dragColumnId: columnId,
|
|
4871
|
+
imperativeApi,
|
|
4872
|
+
infiniteDOMNode: rootRef.current,
|
|
4873
|
+
setProxyPosition,
|
|
4874
|
+
tableRect,
|
|
4875
|
+
initialMousePosition: {
|
|
4876
|
+
clientX: e.clientX,
|
|
4877
|
+
clientY: e.clientY
|
|
4608
4878
|
}
|
|
4609
|
-
return col.computedOffset >= scrollLeft2 + pinnedStartCurrentWidth && col.computedOffset + col.computedWidth < scrollLeft2 + tableRect.width - pinnedEndCurrentWidth;
|
|
4610
|
-
};
|
|
4611
|
-
const initialClientPos = {
|
|
4612
|
-
clientX: Math.round(e.clientX),
|
|
4613
|
-
clientY: Math.round(e.clientY)
|
|
4614
|
-
};
|
|
4615
|
-
let currentScrollPosition = {
|
|
4616
|
-
scrollLeft: 0,
|
|
4617
|
-
scrollTop: 0
|
|
4618
|
-
};
|
|
4619
|
-
const initialScrollPosition2 = brain.getScrollPosition();
|
|
4620
|
-
const updateScrollPosition = (scrollPosition) => {
|
|
4621
|
-
currentScrollPosition = scrollPosition;
|
|
4622
|
-
};
|
|
4623
|
-
updateScrollPosition(initialScrollPosition2);
|
|
4624
|
-
const removeOnScroll = brain.onScroll((scrollPosition) => {
|
|
4625
|
-
currentScrollPosition = scrollPosition;
|
|
4626
4879
|
});
|
|
4627
|
-
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
if (clientX === currentClientPos.clientX && clientY === currentClientPos.clientY) {
|
|
4640
|
-
return;
|
|
4880
|
+
let reorderDragResult = null;
|
|
4881
|
+
function persistColumnOrder(reorderDragResult2) {
|
|
4882
|
+
const { columnPinning, columnOrder } = reorderDragResult2;
|
|
4883
|
+
if (!equalPinning(getState().columnPinning, columnPinning)) {
|
|
4884
|
+
console.log("update pinning");
|
|
4885
|
+
componentActions.columnPinning = columnPinning;
|
|
4886
|
+
}
|
|
4887
|
+
if (JSON.stringify(columnOrder, getComputed().computedColumnOrder)) {
|
|
4888
|
+
computedVisibleColumns.forEach((col) => {
|
|
4889
|
+
setInfiniteColumnOffsetWhileReordering(col.computedVisibleIndex, "", rootRef.current);
|
|
4890
|
+
});
|
|
4891
|
+
componentActions.columnOrder = columnOrder;
|
|
4641
4892
|
}
|
|
4642
|
-
currentClientPos = { clientX, clientY };
|
|
4643
|
-
currentDiff.x = currentClientPos.clientX - initialClientPos.clientX;
|
|
4644
|
-
currentDiff.y = currentClientPos.clientY - initialClientPos.clientY;
|
|
4645
|
-
setProxyPosition({
|
|
4646
|
-
left: initialProxyPosition.left + currentDiff.x,
|
|
4647
|
-
top: initialProxyPosition.top + currentDiff.y
|
|
4648
|
-
});
|
|
4649
4893
|
}
|
|
4650
|
-
updateProxyPosition(initialClientPos);
|
|
4651
|
-
let initialCursor = (_a2 = target.style.cursor) != null ? _a2 : "auto";
|
|
4652
|
-
let didDragAtLeastOnce = false;
|
|
4653
|
-
let currentDropIndex = dragColumnIndex;
|
|
4654
4894
|
const onPointerMove = (e2) => {
|
|
4655
4895
|
var _a3;
|
|
4656
4896
|
if (!didDragAtLeastOnce) {
|
|
@@ -4668,86 +4908,13 @@ var useColumnPointerEvents = ({
|
|
|
4668
4908
|
(_a3 = rootRef.current) == null ? void 0 : _a3.classList.add(InfiniteClsShiftingColumns);
|
|
4669
4909
|
target.style.cursor = "grabbing";
|
|
4670
4910
|
}
|
|
4671
|
-
|
|
4672
|
-
const scrollLeft2 = currentScrollPosition.scrollLeft;
|
|
4673
|
-
const scrollLeftDiff = scrollLeft2 - initialScrollPosition2.scrollLeft;
|
|
4674
|
-
let diffX = currentDiff.x + scrollLeftDiff;
|
|
4675
|
-
const dir = diffX < 0 ? -1 : 1;
|
|
4676
|
-
let currentPos = dir === -1 ? dragColumn.computedOffset + diffX : dragColumn.computedOffset + dragColumn.computedWidth + diffX;
|
|
4677
|
-
speedScroller.scroll({
|
|
4678
|
-
mousePosition: currentClientPos,
|
|
4679
|
-
get scrollLeft() {
|
|
4680
|
-
return brain.getScrollPosition().scrollLeft;
|
|
4681
|
-
},
|
|
4682
|
-
set scrollLeft(value) {
|
|
4683
|
-
imperativeApi.scrollLeft = value;
|
|
4684
|
-
}
|
|
4685
|
-
});
|
|
4686
|
-
const breakpoints = initialBreakpoints.filter((b) => isColumnVisible2(b.index, {
|
|
4687
|
-
scrollLeft: currentScrollPosition.scrollLeft
|
|
4688
|
-
})).map((b) => {
|
|
4689
|
-
return __spreadProps(__spreadValues({}, b), { breakpoint: b.breakpoint - scrollLeft2 });
|
|
4690
|
-
});
|
|
4691
|
-
let idx = (0, import_binary_search2.default)(breakpoints, currentPos, ({ breakpoint }, value) => {
|
|
4692
|
-
return breakpoint < value ? -1 : breakpoint > value ? 1 : 0;
|
|
4693
|
-
});
|
|
4694
|
-
if (idx < 0) {
|
|
4695
|
-
idx = ~idx;
|
|
4696
|
-
console.log("found breakpoint", breakpoints[idx], "at index", idx, "for currentPos", currentPos, JSON.parse(JSON.stringify(breakpoints)));
|
|
4697
|
-
}
|
|
4698
|
-
idx = breakpoints[idx] ? breakpoints[idx].index : breakpoints[breakpoints.length - 1].index + 1;
|
|
4699
|
-
if (idx != null && idx !== currentDropIndex) {
|
|
4700
|
-
currentDropIndex = idx;
|
|
4701
|
-
if (dir === 1 && currentDropIndex === dragColumnIndex + 1) {
|
|
4702
|
-
currentDropIndex = dragColumnIndex;
|
|
4703
|
-
}
|
|
4704
|
-
const newColumnIndexes = moveXatY(initialColumnIndexes, dragColumnIndex, currentDropIndex > dragColumnIndex ? currentDropIndex - 1 : currentDropIndex);
|
|
4705
|
-
const indexesWithTransition = new Set();
|
|
4706
|
-
newColumnIndexes.forEach((newIndex, i) => {
|
|
4707
|
-
const currentIndex = currentColumnIndexes[i];
|
|
4708
|
-
if (newIndex !== currentIndex) {
|
|
4709
|
-
indexesWithTransition.add(newIndex);
|
|
4710
|
-
}
|
|
4711
|
-
});
|
|
4712
|
-
console.log(JSON.stringify(currentColumnIndexes));
|
|
4713
|
-
console.log(JSON.stringify(newColumnIndexes));
|
|
4714
|
-
console.log("switched", indexesWithTransition);
|
|
4715
|
-
console.log("----");
|
|
4716
|
-
currentColumnIndexes = newColumnIndexes;
|
|
4717
|
-
computedVisibleColumns.forEach((col) => {
|
|
4718
|
-
const colIndex = col.computedVisibleIndex;
|
|
4719
|
-
if (indexesWithTransition.has(colIndex)) {
|
|
4720
|
-
restoreInfiniteColumnReorderDuration(colIndex, rootRef.current);
|
|
4721
|
-
} else {
|
|
4722
|
-
clearInfiniteColumnReorderDuration(colIndex, rootRef.current);
|
|
4723
|
-
}
|
|
4724
|
-
const isDragColumn = colIndex === dragColumnIndex;
|
|
4725
|
-
let isOutsideCol = dir === -1 ? colIndex < currentDropIndex || colIndex > dragColumnIndex : colIndex < dragColumnIndex || colIndex >= currentDropIndex;
|
|
4726
|
-
let newPosition = "";
|
|
4727
|
-
if (dir === -1) {
|
|
4728
|
-
newPosition = isDragColumn ? `var(${columnOffsetAtIndex4}-${currentDropIndex})` : isOutsideCol ? `var(${columnOffsetAtIndex4}-${colIndex})` : `calc( var(${columnOffsetAtIndex4}-${colIndex}) + var(${columnWidthAtIndex3}-${dragColumnIndex}) )`;
|
|
4729
|
-
} else {
|
|
4730
|
-
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}) )`;
|
|
4731
|
-
}
|
|
4732
|
-
setInfiniteColumnOffsetWhileReordering(colIndex, newPosition, rootRef.current);
|
|
4733
|
-
});
|
|
4734
|
-
}
|
|
4911
|
+
reorderDragResult = dragger.onMove(e2);
|
|
4735
4912
|
};
|
|
4736
|
-
function persistColumnOrder() {
|
|
4737
|
-
if (currentDropIndex != null && currentDropIndex !== dragColumnIndex) {
|
|
4738
|
-
const newOrder = moveXatY(getComputed().computedColumnOrder, dragColumnIndex, currentDropIndex > dragColumnIndex ? currentDropIndex - 1 : currentDropIndex);
|
|
4739
|
-
computedVisibleColumns.forEach((col) => {
|
|
4740
|
-
setInfiniteColumnOffsetWhileReordering(col.computedVisibleIndex, "", rootRef.current);
|
|
4741
|
-
});
|
|
4742
|
-
componentActions.columnOrder = newOrder;
|
|
4743
|
-
}
|
|
4744
|
-
}
|
|
4745
4913
|
const onPointerUp = (e2) => {
|
|
4746
4914
|
var _a3;
|
|
4747
4915
|
const target2 = domRef.current;
|
|
4748
4916
|
(_a3 = rootRef.current) == null ? void 0 : _a3.classList.remove(InfiniteClsShiftingColumns);
|
|
4749
|
-
|
|
4750
|
-
speedScroller.stop();
|
|
4917
|
+
dragger.stop();
|
|
4751
4918
|
brain.setAvailableSize(__spreadValues({}, initialAvailableSize));
|
|
4752
4919
|
computedVisibleColumns.forEach((col) => {
|
|
4753
4920
|
clearInfiniteColumnReorderDuration(col.computedVisibleIndex, rootRef.current);
|
|
@@ -4765,7 +4932,9 @@ var useColumnPointerEvents = ({
|
|
|
4765
4932
|
if (!didDragAtLeastOnce && dragColumn.computedSortable) {
|
|
4766
4933
|
dragColumn.toggleSort();
|
|
4767
4934
|
}
|
|
4768
|
-
|
|
4935
|
+
if (reorderDragResult) {
|
|
4936
|
+
persistColumnOrder(reorderDragResult);
|
|
4937
|
+
}
|
|
4769
4938
|
componentActions.columnReorderDragColumnId = false;
|
|
4770
4939
|
};
|
|
4771
4940
|
target.addEventListener("pointermove", onPointerMove);
|
|
@@ -8550,38 +8719,6 @@ function lazyLoadRange(options, cache) {
|
|
|
8550
8719
|
}, initialPromise);
|
|
8551
8720
|
}
|
|
8552
8721
|
|
|
8553
|
-
// src/utils/shallowEqualObjects.ts
|
|
8554
|
-
function shallowEqualObjects(objA, objB, ignoreKeys) {
|
|
8555
|
-
if (objA === objB) {
|
|
8556
|
-
return true;
|
|
8557
|
-
}
|
|
8558
|
-
if (!objA || !objB) {
|
|
8559
|
-
return false;
|
|
8560
|
-
}
|
|
8561
|
-
var aKeys = Object.keys(objA);
|
|
8562
|
-
var bKeys = Object.keys(objB);
|
|
8563
|
-
if (ignoreKeys) {
|
|
8564
|
-
aKeys = aKeys.filter((key2) => !ignoreKeys.has(key2));
|
|
8565
|
-
bKeys = bKeys.filter((key2) => !ignoreKeys.has(key2));
|
|
8566
|
-
}
|
|
8567
|
-
var len = aKeys.length;
|
|
8568
|
-
if (bKeys.length !== len) {
|
|
8569
|
-
return false;
|
|
8570
|
-
}
|
|
8571
|
-
for (var i = 0; i < len; i++) {
|
|
8572
|
-
var key = aKeys[i];
|
|
8573
|
-
if (ignoreKeys) {
|
|
8574
|
-
if (ignoreKeys.has(key)) {
|
|
8575
|
-
continue;
|
|
8576
|
-
}
|
|
8577
|
-
}
|
|
8578
|
-
if (objA[key] !== objB[key] || !Object.prototype.hasOwnProperty.call(objB, key)) {
|
|
8579
|
-
return false;
|
|
8580
|
-
}
|
|
8581
|
-
}
|
|
8582
|
-
return true;
|
|
8583
|
-
}
|
|
8584
|
-
|
|
8585
8722
|
// src/components/utils/discardCallsWithEqualArg.ts
|
|
8586
8723
|
var map = new WeakMap();
|
|
8587
8724
|
var getCompareDefault = (a) => a;
|
|
@@ -10508,7 +10645,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
10508
10645
|
const valid = (0, import_react46.useMemo)(() => {
|
|
10509
10646
|
let valid2 = isValidLicense(licenseKey, {
|
|
10510
10647
|
publishedAt: 1624970570587,
|
|
10511
|
-
version: "0.3.
|
|
10648
|
+
version: "0.3.22"
|
|
10512
10649
|
});
|
|
10513
10650
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
10514
10651
|
return true;
|
|
@@ -10527,14 +10664,14 @@ function useScrollToActiveCell(activeCellIndex, dataCount, imperativeApi) {
|
|
|
10527
10664
|
(0, import_react47.useEffect)(() => {
|
|
10528
10665
|
if (activeCellIndex != null) {
|
|
10529
10666
|
didScrollRef.current = false;
|
|
10530
|
-
|
|
10667
|
+
cancelRaf(rafId.current);
|
|
10531
10668
|
}
|
|
10532
10669
|
}, [activeCellIndex]);
|
|
10533
10670
|
(0, import_react47.useEffect)(() => {
|
|
10534
10671
|
if (activeCellIndex != null && !didScrollRef.current) {
|
|
10535
10672
|
let tryScroll = function(times = 0) {
|
|
10536
10673
|
times++;
|
|
10537
|
-
|
|
10674
|
+
cancelRaf(rafId.current);
|
|
10538
10675
|
rafId.current = raf(() => {
|
|
10539
10676
|
didScrollRef.current = imperativeApi.scrollCellIntoView(activeCellIndex[0], activeCellIndex[1], {
|
|
10540
10677
|
offset: 30
|
|
@@ -10547,7 +10684,7 @@ function useScrollToActiveCell(activeCellIndex, dataCount, imperativeApi) {
|
|
|
10547
10684
|
tryScroll();
|
|
10548
10685
|
}
|
|
10549
10686
|
return () => {
|
|
10550
|
-
|
|
10687
|
+
cancelRaf(rafId.current);
|
|
10551
10688
|
};
|
|
10552
10689
|
}, [activeCellIndex, dataCount]);
|
|
10553
10690
|
}
|
|
@@ -10873,6 +11010,7 @@ var forwardProps3 = (setupState) => {
|
|
|
10873
11010
|
onScrollToBottom: 1,
|
|
10874
11011
|
onScrollStop: 1,
|
|
10875
11012
|
scrollToBottomOffset: 1,
|
|
11013
|
+
columnPinning: 1,
|
|
10876
11014
|
rowStyle: 1,
|
|
10877
11015
|
rowProps: 1,
|
|
10878
11016
|
rowClassName: 1,
|
|
@@ -10957,8 +11095,6 @@ var mapPropsToState2 = (params) => {
|
|
|
10957
11095
|
});
|
|
10958
11096
|
const computedColumns = state.columnsWhenGrouping || state.columnsWhenInlineGroupRenderStrategy || state.columns;
|
|
10959
11097
|
return {
|
|
10960
|
-
columnPinning: state.columnPinningWhileDragging || state.columnPinning || props.columnPinning,
|
|
10961
|
-
columnPinningWhileDragging: state.columnPinningWhileDragging,
|
|
10962
11098
|
controlledColumnVisibility: !!props.columnVisibility,
|
|
10963
11099
|
groupRenderStrategy,
|
|
10964
11100
|
groupBy,
|