@infinite-table/infinite-react 10.2.0 → 10.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.dev.mjs CHANGED
@@ -15490,6 +15490,7 @@ var ListRowManager = class extends Logger {
15490
15490
  var ITEM_POSITION_WITH_TRANSFORM = true;
15491
15491
  var currentTransformY = stripVar(InternalVars.y);
15492
15492
  var scrollTopCSSVar = stripVar(InternalVars.scrollTop);
15493
+ var scrollLeftCSSVar2 = stripVar(InternalVars.scrollLeft);
15493
15494
  var columnOffsetAtIndex2 = stripVar(InternalVars.columnOffsetAtIndex);
15494
15495
  var columnOffsetAtIndexWhileReordering2 = stripVar(
15495
15496
  InternalVars.columnOffsetAtIndexWhileReordering
@@ -15503,6 +15504,16 @@ var GridRenderer = class extends Logger {
15503
15504
  this.scrolling = false;
15504
15505
  this.cellHoverClassNames = [];
15505
15506
  this.cellDetachedClassNames = [];
15507
+ /**
15508
+ * Inside InfiniteTable, the table owns the CSS vars that position the
15509
+ * cells horizontally (one offset var per column, plus the scroll position
15510
+ * vars used by pinned cells) and sets them on its root node.
15511
+ *
15512
+ * A HeadlessTable used on its own has nobody to set them. With this on,
15513
+ * the renderer writes each cell's x from the brain, and sets the scroll
15514
+ * position vars itself, on the parent node of the cells.
15515
+ */
15516
+ this.ownsPositionVars = false;
15506
15517
  this.lastEnteredRow = -1;
15507
15518
  this.lastExitedRow = -1;
15508
15519
  this.hoverRowUpdatesInProgress = /* @__PURE__ */ new Map();
@@ -15522,26 +15533,30 @@ var GridRenderer = class extends Logger {
15522
15533
  element.style.transform = `translate3d(${scrollLeft2 || 0}px, var(${currentTransformY}), 0)`;
15523
15534
  };
15524
15535
  this.setTransform = (element, _rowIndex, colIndex, {
15525
- //@ts-ignore
15526
15536
  x,
15527
15537
  y,
15528
- //@ts-ignore
15529
15538
  scrollLeft: scrollLeft2,
15530
15539
  scrollTop: scrollTop2
15531
15540
  }, zIndex2) => {
15532
15541
  const columnOffsetX = InternalVarUtils.columnOffsets.get(colIndex);
15533
15542
  const columnOffsetXWhileReordering = `${columnOffsetAtIndexWhileReordering2}-${colIndex}`;
15534
- const currentTransformYValue = scrollTop2 ? `calc( ${y}px + var(${scrollTopCSSVar}) )` : `${y - this.brain.getScrollOrigin().scrollTop}px`;
15543
+ const currentTransformYValue = scrollTop2 ? `calc( ${y}px + var(${scrollTopCSSVar}, 0px) )` : `${y - this.brain.getScrollOrigin().scrollTop}px`;
15535
15544
  if (element.__currentTransformY !== currentTransformYValue) {
15536
15545
  element.__currentTransformY = currentTransformYValue;
15537
15546
  element.style.setProperty(currentTransformY, currentTransformYValue);
15538
15547
  }
15539
- const transformValue = `translate3d(var(${columnOffsetXWhileReordering}, ${columnOffsetX}), var(${currentTransformY}), 0)`;
15548
+ const transformX2 = this.ownsPositionVars ? scrollLeft2 ? `calc( ${x}px + var(${scrollLeftCSSVar2}, 0px) )` : `${x - this.brain.getScrollOrigin().scrollLeft}px` : `var(${columnOffsetXWhileReordering}, ${columnOffsetX})`;
15549
+ const transformValue = `translate3d(${transformX2}, var(${currentTransformY}), 0)`;
15540
15550
  if (element.__transformValue !== transformValue) {
15541
15551
  element.__transformValue = transformValue;
15542
15552
  element.style.transform = transformValue;
15543
15553
  }
15544
- if (zIndex2 != null) {
15554
+ if (zIndex2 != null && this.ownsPositionVars) {
15555
+ const zIndexValue = `${zIndex2}`;
15556
+ if (element.__zIndex !== zIndexValue) {
15557
+ element.__zIndex = zIndexValue;
15558
+ element.style.zIndex = zIndexValue;
15559
+ }
15545
15560
  }
15546
15561
  };
15547
15562
  /**
@@ -15562,6 +15577,17 @@ var GridRenderer = class extends Logger {
15562
15577
  });
15563
15578
  this.adjustFixedElementsOnScroll();
15564
15579
  };
15580
+ /**
15581
+ * While a render pass is in progress, the cells it detaches are collected
15582
+ * here and only get the detached class names when the pass ends - if they
15583
+ * are still detached by then.
15584
+ *
15585
+ * Most of the cells detached by a render pass (while scrolling, all of
15586
+ * them) are re-attached at another position by the same pass, so they
15587
+ * would get the class names added and then removed, with no visible effect
15588
+ * - only the cost of the DOM writes and of the style invalidations.
15589
+ */
15590
+ this.cellsDetachedInRenderPass = null;
15565
15591
  this.getFullyVisibleRowsRange = () => {
15566
15592
  let {
15567
15593
  start: [startRow],
@@ -16051,11 +16077,18 @@ var GridRenderer = class extends Logger {
16051
16077
  itemElement.dataset.rowIndex = realCoords.rowIndex;
16052
16078
  itemElement.dataset.colIndex = realCoords.colIndex;
16053
16079
  if (ITEM_POSITION_WITH_TRANSFORM) {
16054
- this.setTransform(itemElement, rowIndex, colIndex, { x, y }, null);
16080
+ const fixedPlacement = this.ownsPositionVars ? this.getFixedCellPlacement(rowIndex, colIndex, { x, y }) : null;
16081
+ this.setTransform(
16082
+ itemElement,
16083
+ rowIndex,
16084
+ colIndex,
16085
+ fixedPlacement ?? { x, y },
16086
+ null
16087
+ );
16055
16088
  itemElement.style.willChange = "transform";
16056
16089
  itemElement.style.backfaceVisibility = "hidden";
16057
16090
  const hidden = options ? options.hidden : !!this.isCellCovered(rowIndex, colIndex);
16058
- const zIndex2 = hidden ? "-1" : (
16091
+ const zIndex2 = hidden ? "-1" : fixedPlacement ? `${fixedPlacement.zIndex}` : (
16059
16092
  // #updatezindex - we need to allow elements use their own zIndex, so we
16060
16093
  // resort to allowing them to have it as a data-z-index attribute
16061
16094
  itemElement.dataset.zIndex || "auto"
@@ -16158,126 +16191,51 @@ var GridRenderer = class extends Logger {
16158
16191
  // fixed cells are positioned with these, inside the scroll layer
16159
16192
  // which is translated relative to the scroll origin
16160
16193
  brain.getDOMScrollPosition(scrollPosition),
16161
- this.getInfiniteNode(attachedCell.getElement())
16194
+ this.ownsPositionVars ? (
16195
+ // null on the first render pass, before the cells are in the DOM:
16196
+ // the cells fall back to a scroll position of 0 - see setTransform
16197
+ attachedCell.getElement()?.parentElement ?? null
16198
+ ) : this.getInfiniteNode(attachedCell.getElement())
16162
16199
  );
16163
16200
  }
16164
- const fixedEndColsOffsets = this.brain.getFixedEndColsOffsets({
16165
- skipScroll: true
16166
- });
16167
- const fixedEndRowsOffsets = this.brain.getFixedEndRowsOffsets({
16168
- skipScroll: true
16169
- });
16201
+ const fixedEndOffsets = {
16202
+ cols: this.brain.getFixedEndColsOffsets({ skipScroll: true }),
16203
+ rows: this.brain.getFixedEndRowsOffsets({ skipScroll: true })
16204
+ };
16170
16205
  const { start, end } = this.brain.getRenderRange();
16171
16206
  const [startRow, startCol] = start;
16172
16207
  const [endRow, endCol] = end;
16173
- function adjustElementPosition(rowIndex, colIndex, fn) {
16174
- const cell = cellManager.getCellAt([rowIndex, colIndex]);
16175
- if (cell == null) {
16208
+ const adjust = (rowIndex, colIndex) => {
16209
+ const node = cellManager.getCellAt([rowIndex, colIndex])?.getElement();
16210
+ const itemPosition = node ? brain.getCellOffset(rowIndex, colIndex) : null;
16211
+ if (!node || !itemPosition) {
16176
16212
  return;
16177
16213
  }
16178
- const itemPosition = brain.getCellOffset(rowIndex, colIndex);
16179
- const node = cell.getElement();
16180
- if (node && itemPosition) {
16181
- fn(rowIndex, colIndex, node, itemPosition);
16182
- }
16183
- }
16184
- const adjustColStart = (_rowIndex, colIndex, node, { x, y }) => {
16185
- this.setTransform(
16186
- node,
16187
- _rowIndex,
16188
- colIndex,
16189
- { x, y, scrollLeft: true },
16190
- fixedColsStart - colIndex
16191
- );
16192
- };
16193
- const adjustRowStart = (rowIndex, _colIndex, node, coords) => {
16194
- this.setTransform(
16195
- node,
16214
+ const placement = this.getFixedCellPlacement(
16196
16215
  rowIndex,
16197
- _colIndex,
16198
- { x: coords.x, y: coords.y, scrollTop: true },
16199
- fixedRowsStart - rowIndex
16200
- );
16201
- };
16202
- const adjustColEnd = (_rowIndex, colIndex, node, { y }) => {
16203
- const val = fixedEndColsOffsets[colIndex];
16204
- this.setTransform(
16205
- node,
16206
- _rowIndex,
16207
16216
  colIndex,
16208
- { x: val, y, scrollLeft: true },
16209
- cols - colIndex
16210
- );
16211
- };
16212
- const adjustRowEnd = (rowIndex, _colIndex, node, coords) => {
16213
- this.setTransform(
16214
- node,
16215
- rowIndex,
16216
- _colIndex,
16217
- { x: coords.x, y: fixedEndRowsOffsets[rowIndex], scrollTop: true },
16218
- rows - rowIndex
16219
- );
16220
- };
16221
- const adjustColStartRowStart = (_rowIndex, _colIndex, node, { x, y }) => {
16222
- this.setTransform(
16223
- node,
16224
- _rowIndex,
16225
- _colIndex,
16226
- { x, scrollLeft: true, y, scrollTop: true },
16227
- 1e5
16228
- );
16229
- };
16230
- const adjustColStartRowEnd = (_rowIndex, _colIndex, node, { x }) => {
16231
- this.setTransform(
16232
- node,
16233
- _rowIndex,
16234
- _colIndex,
16235
- {
16236
- x,
16237
- scrollLeft: true,
16238
- y: fixedEndRowsOffsets[_rowIndex],
16239
- scrollTop: true
16240
- },
16241
- 2e5
16242
- );
16243
- };
16244
- const adjustColEndRowStart = (_rowIndex, colIndex, node, coords) => {
16245
- this.setTransform(
16246
- node,
16247
- _rowIndex,
16248
- colIndex,
16249
- {
16250
- x: fixedEndColsOffsets[colIndex],
16251
- y: coords.y,
16252
- scrollLeft: true,
16253
- scrollTop: true
16254
- },
16255
- 3e5
16256
- );
16257
- };
16258
- const adjustColEndRowEnd = (rowIndex, colIndex, node) => {
16259
- this.setTransform(
16260
- node,
16261
- rowIndex,
16262
- colIndex,
16263
- {
16264
- x: fixedEndColsOffsets[colIndex],
16265
- y: fixedEndRowsOffsets[rowIndex],
16266
- scrollLeft: true,
16267
- scrollTop: true
16268
- },
16269
- 4e5
16217
+ itemPosition,
16218
+ fixedEndOffsets
16270
16219
  );
16220
+ if (placement) {
16221
+ this.setTransform(
16222
+ node,
16223
+ rowIndex,
16224
+ colIndex,
16225
+ placement,
16226
+ placement.zIndex
16227
+ );
16228
+ }
16271
16229
  };
16272
16230
  if (fixedColsStart || fixedColsEnd) {
16273
16231
  for (let rowIndex = startRow; rowIndex < endRow; rowIndex++) {
16274
16232
  for (let colIndex = 0; colIndex < fixedColsStart; colIndex++) {
16275
- adjustElementPosition(rowIndex, colIndex, adjustColStart);
16233
+ adjust(rowIndex, colIndex);
16276
16234
  }
16277
16235
  if (fixedColsEnd) {
16278
16236
  const firstColFixedEnd = cols - fixedColsEnd;
16279
16237
  for (let colIndex = firstColFixedEnd; colIndex < cols; colIndex++) {
16280
- adjustElementPosition(rowIndex, colIndex, adjustColEnd);
16238
+ adjust(rowIndex, colIndex);
16281
16239
  }
16282
16240
  }
16283
16241
  }
@@ -16285,12 +16243,12 @@ var GridRenderer = class extends Logger {
16285
16243
  if (fixedRowsStart || fixedRowsEnd) {
16286
16244
  for (let colIndex = startCol; colIndex < endCol; colIndex++) {
16287
16245
  for (let rowIndex = 0; rowIndex < fixedRowsStart; rowIndex++) {
16288
- adjustElementPosition(rowIndex, colIndex, adjustRowStart);
16246
+ adjust(rowIndex, colIndex);
16289
16247
  }
16290
16248
  if (fixedRowsEnd) {
16291
16249
  const firstRowFixedEnd = rows - fixedRowsEnd;
16292
16250
  for (let rowIndex = firstRowFixedEnd; rowIndex < rows; rowIndex++) {
16293
- adjustElementPosition(rowIndex, colIndex, adjustRowEnd);
16251
+ adjust(rowIndex, colIndex);
16294
16252
  }
16295
16253
  }
16296
16254
  }
@@ -16298,7 +16256,7 @@ var GridRenderer = class extends Logger {
16298
16256
  if (fixedColsStart && fixedRowsStart) {
16299
16257
  for (let rowIndex = 0; rowIndex < fixedRowsStart; rowIndex++) {
16300
16258
  for (let colIndex = 0; colIndex < fixedColsStart; colIndex++) {
16301
- adjustElementPosition(rowIndex, colIndex, adjustColStartRowStart);
16259
+ adjust(rowIndex, colIndex);
16302
16260
  }
16303
16261
  }
16304
16262
  }
@@ -16306,7 +16264,7 @@ var GridRenderer = class extends Logger {
16306
16264
  const firstRowFixedEnd = rows - fixedRowsEnd;
16307
16265
  for (let rowIndex = firstRowFixedEnd; rowIndex < rows; rowIndex++) {
16308
16266
  for (let colIndex = 0; colIndex < fixedColsStart; colIndex++) {
16309
- adjustElementPosition(rowIndex, colIndex, adjustColStartRowEnd);
16267
+ adjust(rowIndex, colIndex);
16310
16268
  }
16311
16269
  }
16312
16270
  }
@@ -16314,7 +16272,7 @@ var GridRenderer = class extends Logger {
16314
16272
  const firstColFixedEnd = cols - fixedColsEnd;
16315
16273
  for (let rowIndex = 0; rowIndex < fixedRowsStart; rowIndex++) {
16316
16274
  for (let colIndex = firstColFixedEnd; colIndex < cols; colIndex++) {
16317
- adjustElementPosition(rowIndex, colIndex, adjustColEndRowStart);
16275
+ adjust(rowIndex, colIndex);
16318
16276
  }
16319
16277
  }
16320
16278
  }
@@ -16323,7 +16281,7 @@ var GridRenderer = class extends Logger {
16323
16281
  const firstColFixedEnd = cols - fixedColsEnd;
16324
16282
  for (let rowIndex = firstRowFixedEnd; rowIndex < rows; rowIndex++) {
16325
16283
  for (let colIndex = firstColFixedEnd; colIndex < cols; colIndex++) {
16326
- adjustElementPosition(rowIndex, colIndex, adjustColEndRowEnd);
16284
+ adjust(rowIndex, colIndex);
16327
16285
  }
16328
16286
  }
16329
16287
  }
@@ -16397,6 +16355,9 @@ var GridRenderer = class extends Logger {
16397
16355
  return this.infiniteNode;
16398
16356
  }
16399
16357
  onCellAttached(cell) {
16358
+ if (this.cellsDetachedInRenderPass?.delete(cell)) {
16359
+ return;
16360
+ }
16400
16361
  if (this.cellDetachedClassNames.length) {
16401
16362
  const el = cell.getElement();
16402
16363
  if (el) {
@@ -16407,6 +16368,13 @@ var GridRenderer = class extends Logger {
16407
16368
  }
16408
16369
  }
16409
16370
  onCellDetached(cell) {
16371
+ if (this.cellsDetachedInRenderPass) {
16372
+ this.cellsDetachedInRenderPass.add(cell);
16373
+ return;
16374
+ }
16375
+ this.addDetachedClassNames(cell);
16376
+ }
16377
+ addDetachedClassNames(cell) {
16410
16378
  if (this.cellDetachedClassNames.length) {
16411
16379
  const el = cell.getElement();
16412
16380
  if (el) {
@@ -16443,10 +16411,22 @@ var GridRenderer = class extends Logger {
16443
16411
  mapped: rendered
16444
16412
  };
16445
16413
  }
16446
- renderRange(range, { renderCell, renderDetailRow, force, onRender }) {
16414
+ renderRange(range, options) {
16447
16415
  if (this.destroyed) {
16448
16416
  return [];
16449
16417
  }
16418
+ if (this.cellsDetachedInRenderPass) {
16419
+ return this.renderRangeInternal(range, options);
16420
+ }
16421
+ const detachedCells = this.cellsDetachedInRenderPass = /* @__PURE__ */ new Set();
16422
+ try {
16423
+ return this.renderRangeInternal(range, options);
16424
+ } finally {
16425
+ this.cellsDetachedInRenderPass = null;
16426
+ detachedCells.forEach((cell) => this.addDetachedClassNames(cell));
16427
+ }
16428
+ }
16429
+ renderRangeInternal(range, { renderCell, renderDetailRow, force, onRender }) {
16450
16430
  const { start, end } = range;
16451
16431
  const horizontalLayout = this.brain.isHorizontalLayoutBrain;
16452
16432
  if (false) {
@@ -16721,6 +16701,34 @@ var GridRenderer = class extends Logger {
16721
16701
  this.updateElementPosition(cell, { hidden, rowspan, colspan });
16722
16702
  return;
16723
16703
  }
16704
+ /**
16705
+ * Where a fixed (pinned) cell goes: its x and/or y relative to the viewport
16706
+ * (`scrollLeft` / `scrollTop: true` - see setTransform), and its z-index:
16707
+ * the corners above the pinned rows and columns, those above the cells
16708
+ * scrolling under them. null for a cell that is not fixed.
16709
+ */
16710
+ getFixedCellPlacement(rowIndex, colIndex, { x, y }, fixedEndOffsets) {
16711
+ const { fixedRowsStart, fixedRowsEnd, fixedColsStart, fixedColsEnd } = this.brain.getFixedCellInfo();
16712
+ const cols = this.brain.getColCount();
16713
+ const rows = this.brain.getRowCount();
16714
+ const colStart = colIndex < fixedColsStart;
16715
+ const colEnd = !colStart && !!fixedColsEnd && colIndex >= cols - fixedColsEnd;
16716
+ const rowStart = rowIndex < fixedRowsStart;
16717
+ const rowEnd = !rowStart && !!fixedRowsEnd && rowIndex >= rows - fixedRowsEnd;
16718
+ const colFixed = colStart || colEnd;
16719
+ const rowFixed = rowStart || rowEnd;
16720
+ if (!colFixed && !rowFixed) {
16721
+ return null;
16722
+ }
16723
+ if (colEnd) {
16724
+ x = (fixedEndOffsets?.cols ?? this.brain.getFixedEndColsOffsets({ skipScroll: true }))[colIndex];
16725
+ }
16726
+ if (rowEnd) {
16727
+ y = (fixedEndOffsets?.rows ?? this.brain.getFixedEndRowsOffsets({ skipScroll: true }))[rowIndex];
16728
+ }
16729
+ const zIndex2 = colFixed && rowFixed ? colStart ? rowStart ? 1e5 : 2e5 : rowStart ? 3e5 : 4e5 : colStart ? fixedColsStart - colIndex : colEnd ? cols - colIndex : rowStart ? fixedRowsStart - rowIndex : rows - rowIndex;
16730
+ return { x, y, scrollLeft: colFixed, scrollTop: rowFixed, zIndex: zIndex2 };
16731
+ }
16724
16732
  reset() {
16725
16733
  this.cellManager.reset();
16726
16734
  this.rowManager.reset();
@@ -17312,13 +17320,18 @@ function createRenderer(brain) {
17312
17320
  }
17313
17321
 
17314
17322
  // src/components/HeadlessTable/RawTable.tsx
17323
+ function createOwnRenderer(brain) {
17324
+ const result = createRenderer(brain);
17325
+ result.renderer.ownsPositionVars = true;
17326
+ return result;
17327
+ }
17315
17328
  function RawTableFn(props) {
17316
17329
  const { brain, renderCell, renderDetailRow, forceRerenderTimestamp } = props;
17317
17330
  const { renderer, onRenderUpdater } = useMemo7(() => {
17318
17331
  return props.onRenderUpdater && props.renderer ? {
17319
17332
  renderer: props.renderer,
17320
17333
  onRenderUpdater: props.onRenderUpdater
17321
- } : createRenderer(brain);
17334
+ } : createOwnRenderer(brain);
17322
17335
  }, [brain, props.onRenderUpdater, props.renderer]);
17323
17336
  useLayoutEffect8(() => {
17324
17337
  renderer.cellHoverClassNames = props.cellHoverClassNames || [];
@@ -22444,6 +22457,80 @@ function treeTraverse(treeParams, traverseOptions, data) {
22444
22457
  }
22445
22458
  }
22446
22459
 
22460
+ // src/utils/multisort/sortByNumber.ts
22461
+ var SORT_BY_NUMBER_MIN_LENGTH = 1e3;
22462
+ var IS_LITTLE_ENDIAN = new Uint8Array(new Uint32Array([1]).buffer)[0] === 1;
22463
+ function sortByNumber(array, getValue, dir) {
22464
+ const len = array.length;
22465
+ const keys = new Float64Array(len);
22466
+ for (let i = 0; i < len; i++) {
22467
+ const value = getValue(array[i]);
22468
+ if (typeof value !== "number" || value !== value) {
22469
+ return false;
22470
+ }
22471
+ keys[i] = (dir < 0 ? -value : value) + 0;
22472
+ }
22473
+ if (len < 2) {
22474
+ return true;
22475
+ }
22476
+ const words = new Uint32Array(keys.buffer);
22477
+ const LOW = IS_LITTLE_ENDIAN ? 0 : 1;
22478
+ const HIGH = IS_LITTLE_ENDIAN ? 1 : 0;
22479
+ const counts = new Uint32Array(8 * 256);
22480
+ for (let i = 0; i < len; i++) {
22481
+ let low = words[2 * i + LOW];
22482
+ let high = words[2 * i + HIGH];
22483
+ if (high & 2147483648) {
22484
+ high = ~high >>> 0;
22485
+ low = ~low >>> 0;
22486
+ words[2 * i + LOW] = low;
22487
+ } else {
22488
+ high = (high | 2147483648) >>> 0;
22489
+ }
22490
+ words[2 * i + HIGH] = high;
22491
+ counts[low & 255]++;
22492
+ counts[256 + (low >>> 8 & 255)]++;
22493
+ counts[512 + (low >>> 16 & 255)]++;
22494
+ counts[768 + (low >>> 24)]++;
22495
+ counts[1024 + (high & 255)]++;
22496
+ counts[1280 + (high >>> 8 & 255)]++;
22497
+ counts[1536 + (high >>> 16 & 255)]++;
22498
+ counts[1792 + (high >>> 24)]++;
22499
+ }
22500
+ let indexes = new Uint32Array(len);
22501
+ let nextIndexes = new Uint32Array(len);
22502
+ for (let i = 0; i < len; i++) {
22503
+ indexes[i] = i;
22504
+ }
22505
+ for (let digitIndex = 0; digitIndex < 8; digitIndex++) {
22506
+ const word = digitIndex < 4 ? LOW : HIGH;
22507
+ const shift = digitIndex % 4 * 8;
22508
+ const countsOffset = digitIndex * 256;
22509
+ if (counts[countsOffset + (words[word] >>> shift & 255)] === len) {
22510
+ continue;
22511
+ }
22512
+ let position2 = 0;
22513
+ for (let digit = 0; digit < 256; digit++) {
22514
+ const count = counts[countsOffset + digit];
22515
+ counts[countsOffset + digit] = position2;
22516
+ position2 += count;
22517
+ }
22518
+ for (let i = 0; i < len; i++) {
22519
+ const index = indexes[i];
22520
+ const digit = words[2 * index + word] >>> shift & 255;
22521
+ nextIndexes[counts[countsOffset + digit]++] = index;
22522
+ }
22523
+ const previousIndexes = indexes;
22524
+ indexes = nextIndexes;
22525
+ nextIndexes = previousIndexes;
22526
+ }
22527
+ const items = array.slice();
22528
+ for (let i = 0; i < len; i++) {
22529
+ array[i] = items[indexes[i]];
22530
+ }
22531
+ return true;
22532
+ }
22533
+
22447
22534
  // src/utils/multisort/sortTypes.ts
22448
22535
  var numberComparator = function(first, second) {
22449
22536
  return first - second;
@@ -22529,7 +22616,10 @@ var multisort = (sortInfo, array, options) => {
22529
22616
  if (marker) {
22530
22617
  marker.start();
22531
22618
  }
22532
- array.sort(getMultisortFunction(toPlainSortInfo(sortInfo), get));
22619
+ const plainSortInfo = toPlainSortInfo(sortInfo);
22620
+ if (!sortByNumberIfPossible(plainSortInfo, array, get)) {
22621
+ array.sort(getMultisortFunction(plainSortInfo, get));
22622
+ }
22533
22623
  if (marker) {
22534
22624
  marker.end();
22535
22625
  }
@@ -22595,6 +22685,30 @@ var multisortNested = (sortInfo, array, options) => {
22595
22685
  return array;
22596
22686
  };
22597
22687
  multisort.knownTypes = sortTypes_default;
22688
+ function sortByNumberIfPossible(sortInfo, array, get) {
22689
+ if (sortInfo.length !== 1 || array.length < SORT_BY_NUMBER_MIN_LENGTH) {
22690
+ return false;
22691
+ }
22692
+ const info = sortInfo[0];
22693
+ if (!info || info.fn || !info.type || info.dir !== 1 && info.dir !== -1) {
22694
+ return false;
22695
+ }
22696
+ const type = Array.isArray(info.type) ? info.type[0] : info.type;
22697
+ if (multisort.knownTypes[type] !== numberComparator) {
22698
+ return false;
22699
+ }
22700
+ const { field, valueGetter } = info;
22701
+ return sortByNumber(
22702
+ array,
22703
+ (item) => {
22704
+ if (get) {
22705
+ item = get(item);
22706
+ }
22707
+ return valueGetter ? valueGetter(item) : field ? item[field] : item;
22708
+ },
22709
+ info.dir
22710
+ );
22711
+ }
22598
22712
  var getSingleSortFunction = (info) => {
22599
22713
  if (!info) {
22600
22714
  return;
@@ -29434,8 +29548,8 @@ function getLicenseStatus(licenseKey = "", options) {
29434
29548
  return "valid";
29435
29549
  }
29436
29550
  const result = checkLicense(licenseKey, {
29437
- publishedAt: 1794927344373,
29438
- version: "10.2.0"
29551
+ publishedAt: 1795523603652,
29552
+ version: "10.2.1"
29439
29553
  });
29440
29554
  if (result === "invalid" && !licenseKey) {
29441
29555
  return "missing";