@infinite-table/infinite-react 0.3.1 → 0.3.4

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.
Files changed (6) hide show
  1. package/index.css +199 -91
  2. package/index.d.ts +654 -411
  3. package/index.esm.css +199 -91
  4. package/index.esm.js +1911 -832
  5. package/index.js +1906 -840
  6. package/package.json +2 -2
package/index.js CHANGED
@@ -632,7 +632,12 @@ __export(exports, {
632
632
  InfiniteTable: () => InfiniteTable,
633
633
  InfiniteTableClassName: () => InfiniteTableClassName,
634
634
  InfiniteTableComponent: () => InfiniteTableComponent,
635
+ NumberFilterEditor: () => NumberFilterEditor,
636
+ StringFilterEditor: () => StringFilterEditor,
635
637
  debounce: () => debounce,
638
+ defaultFilterEditors: () => defaultFilterEditors,
639
+ defaultFilterTypes: () => defaultFilterTypes,
640
+ filterTypes: () => defaultFilterTypes,
636
641
  flatten: () => flatten,
637
642
  getComponentStateRoot: () => getComponentStateRoot,
638
643
  group: () => group,
@@ -660,7 +665,8 @@ function debounce(fn, { wait }) {
660
665
  }
661
666
 
662
667
  // src/components/InfiniteTable/index.tsx
663
- var React27 = __toModule(require("react"));
668
+ var React32 = __toModule(require("react"));
669
+ var import_react45 = __toModule(require("react"));
664
670
 
665
671
  // src/utils/join.ts
666
672
  var join = (...args) => args.filter((x) => !!`${x}`).join(" ");
@@ -869,8 +875,8 @@ function useDataSourceContextValue() {
869
875
  }
870
876
 
871
877
  // src/components/HeadlessTable/index.tsx
872
- var React10 = __toModule(require("react"));
873
- var import_react8 = __toModule(require("react"));
878
+ var React12 = __toModule(require("react"));
879
+ var import_react11 = __toModule(require("react"));
874
880
 
875
881
  // src/components/VirtualList/SpacePlaceholder.tsx
876
882
  var React5 = __toModule(require("react"));
@@ -2507,6 +2513,171 @@ var ReactHeadlessTableRenderer = class extends Logger {
2507
2513
  this.items = [];
2508
2514
  this.currentHoveredRow = -1;
2509
2515
  this.hoverRowUpdatesInProgress = new Map();
2516
+ this.getFullyVisibleRowsRange = () => {
2517
+ let {
2518
+ start: [startRow],
2519
+ end: [endRow]
2520
+ } = this.brain.getRenderRange();
2521
+ while (!this.isRowFullyVisible(startRow)) {
2522
+ startRow++;
2523
+ if (startRow === endRow) {
2524
+ return null;
2525
+ }
2526
+ }
2527
+ while (!this.isRowFullyVisible(endRow)) {
2528
+ endRow--;
2529
+ if (endRow === startRow) {
2530
+ return null;
2531
+ }
2532
+ }
2533
+ return { start: startRow, end: endRow };
2534
+ };
2535
+ this.getScrollPositionForScrollRowIntoView = (rowIndex, config = { offset: 0 }) => {
2536
+ const { brain } = this;
2537
+ const scrollPosition = brain.getScrollPosition();
2538
+ let { scrollAdjustPosition, offset = 0 } = config;
2539
+ if (this.isRowFullyVisible(rowIndex) && !scrollAdjustPosition) {
2540
+ return scrollPosition;
2541
+ }
2542
+ const rowOffset = brain.getItemOffsetFor(rowIndex, "vertical");
2543
+ const rowHeight = brain.getItemSize(rowIndex, "vertical");
2544
+ const top2 = scrollPosition.scrollTop;
2545
+ const availableSize = brain.getAvailableSize();
2546
+ const bottom = top2 + availableSize.height;
2547
+ if (!scrollAdjustPosition) {
2548
+ scrollAdjustPosition = rowOffset > bottom ? "end" : rowOffset < top2 ? "start" : "end";
2549
+ }
2550
+ let scrollTop = scrollPosition.scrollTop;
2551
+ if (scrollAdjustPosition === "center") {
2552
+ scrollTop = rowOffset - Math.floor(brain.getAvailableSize().height / 2);
2553
+ } else if (scrollAdjustPosition === "start") {
2554
+ offset = -offset;
2555
+ scrollTop += rowOffset - top2 + offset;
2556
+ } else {
2557
+ offset += rowHeight;
2558
+ scrollTop += rowOffset - bottom + offset;
2559
+ }
2560
+ return __spreadProps(__spreadValues({}, scrollPosition), {
2561
+ scrollTop
2562
+ });
2563
+ };
2564
+ this.getScrollPositionForScrollColumnIntoView = (colIndex, config = { offset: 0 }) => {
2565
+ const { brain } = this;
2566
+ const scrollPosition = brain.getScrollPosition();
2567
+ let { scrollAdjustPosition, offset = 0 } = config;
2568
+ if (this.isColumnFullyVisible(colIndex) && !scrollAdjustPosition) {
2569
+ return scrollPosition;
2570
+ }
2571
+ const rowOffset = brain.getItemOffsetFor(colIndex, "horizontal");
2572
+ const colWidth = brain.getItemSize(colIndex, "horizontal");
2573
+ const left2 = scrollPosition.scrollLeft;
2574
+ const availableSize = brain.getAvailableSize();
2575
+ const right = left2 + availableSize.width;
2576
+ if (!scrollAdjustPosition) {
2577
+ scrollAdjustPosition = rowOffset > right ? "end" : rowOffset < left2 ? "start" : "end";
2578
+ }
2579
+ let scrollLeft = scrollPosition.scrollLeft;
2580
+ if (scrollAdjustPosition === "center") {
2581
+ scrollLeft = rowOffset - Math.floor(brain.getAvailableSize().width / 2);
2582
+ } else if (scrollAdjustPosition === "start") {
2583
+ offset = -offset;
2584
+ scrollLeft += rowOffset - left2 + offset;
2585
+ } else {
2586
+ offset += colWidth;
2587
+ scrollLeft += rowOffset - right + offset;
2588
+ }
2589
+ return __spreadProps(__spreadValues({}, scrollPosition), {
2590
+ scrollLeft
2591
+ });
2592
+ };
2593
+ this.getScrollPositionForScrollCellIntoView = (rowIndex, colIndex, config = { offsetLeft: 0, offsetTop: 0 }) => {
2594
+ const { scrollLeft } = this.getScrollPositionForScrollColumnIntoView(colIndex, {
2595
+ scrollAdjustPosition: config.colScrollAdjustPosition || config.scrollAdjustPosition,
2596
+ offset: config.offsetLeft
2597
+ });
2598
+ const { scrollTop } = this.getScrollPositionForScrollRowIntoView(rowIndex, {
2599
+ scrollAdjustPosition: config.rowScrollAdjustPosition || config.scrollAdjustPosition,
2600
+ offset: config.offsetTop
2601
+ });
2602
+ return { scrollLeft, scrollTop };
2603
+ };
2604
+ this.isRowFullyVisible = (rowIndex, offsetMargin = 2) => {
2605
+ return this.isRowVisible(rowIndex, this.brain.getRowHeight(rowIndex) - offsetMargin);
2606
+ };
2607
+ this.isRowVisible = (rowIndex, offsetMargin = 10) => {
2608
+ if (!this.isRowRendered(rowIndex)) {
2609
+ return false;
2610
+ }
2611
+ const { brain } = this;
2612
+ const {
2613
+ start: [startRow],
2614
+ end: [endRow]
2615
+ } = this.brain.getRenderRange();
2616
+ const midRow = Math.floor((startRow + endRow) / 2);
2617
+ if (rowIndex < startRow) {
2618
+ return false;
2619
+ }
2620
+ if (rowIndex >= endRow) {
2621
+ return false;
2622
+ }
2623
+ if (rowIndex >= midRow) {
2624
+ const lastVisibleRow = brain.getItemAt(brain.getAvailableSize().height + brain.getScrollPosition().scrollTop - offsetMargin, "vertical");
2625
+ return rowIndex <= lastVisibleRow;
2626
+ }
2627
+ if (rowIndex < midRow) {
2628
+ const firstVisibleRow = brain.getItemAt(brain.getScrollPosition().scrollTop + offsetMargin, "vertical");
2629
+ return rowIndex >= firstVisibleRow;
2630
+ }
2631
+ return true;
2632
+ };
2633
+ this.isRowRendered = (rowIndex) => {
2634
+ const elements = this.mappedCells.getElementsForRowIndex(rowIndex);
2635
+ return elements.length > 0;
2636
+ };
2637
+ this.isCellVisible = (rowIndex, colIndex) => {
2638
+ return this.isRowVisible(rowIndex) && this.isColumnVisible(colIndex);
2639
+ };
2640
+ this.isCellFullyVisible = (rowIndex, colIndex) => {
2641
+ return this.isRowFullyVisible(rowIndex) && this.isColumnVisible(colIndex);
2642
+ };
2643
+ this.isColumnFullyVisible = (colIndex, offsetMargin = 2) => {
2644
+ return this.isColumnVisible(colIndex, this.brain.getColWidth(colIndex) - offsetMargin);
2645
+ };
2646
+ this.isColumnVisible = (colIndex, offsetMargin = 10) => {
2647
+ if (!this.isColumnRendered(colIndex)) {
2648
+ return false;
2649
+ }
2650
+ const { brain } = this;
2651
+ const {
2652
+ start: [_, startCol],
2653
+ end: [__, endCol]
2654
+ } = brain.getRenderRange();
2655
+ const midCol = Math.floor((startCol + endCol) / 2);
2656
+ if (colIndex < startCol) {
2657
+ return false;
2658
+ }
2659
+ if (colIndex >= endCol) {
2660
+ return false;
2661
+ }
2662
+ if (colIndex >= midCol) {
2663
+ const lastVisibleCol = brain.getItemAt(brain.getAvailableSize().width + brain.getScrollPosition().scrollLeft - offsetMargin, "horizontal");
2664
+ return colIndex <= lastVisibleCol;
2665
+ }
2666
+ if (colIndex < midCol) {
2667
+ const firstVisibleCol = brain.getItemAt(brain.getScrollPosition().scrollLeft + offsetMargin, "horizontal");
2668
+ return colIndex >= firstVisibleCol;
2669
+ }
2670
+ return true;
2671
+ };
2672
+ this.isCellRendered = (rowIndex, colIndex) => {
2673
+ return this.isRowRendered(rowIndex) && this.isColumnRendered(colIndex);
2674
+ };
2675
+ this.isColumnRendered = (colIndex) => {
2676
+ const {
2677
+ start: [startRow]
2678
+ } = this.brain.getRenderRange();
2679
+ return this.mappedCells.getRenderedNodeForCell(startRow, colIndex) !== null;
2680
+ };
2510
2681
  this.getExtraSpanCellsForRange = (range) => {
2511
2682
  const { start, end } = range;
2512
2683
  const [startRow, startCol] = start;
@@ -2769,6 +2940,9 @@ var ReactHeadlessTableRenderer = class extends Logger {
2769
2940
  });
2770
2941
  };
2771
2942
  this.onMouseLeave = (rowIndex) => {
2943
+ if (this.currentHoveredRow != -1 && this.currentHoveredRow === rowIndex) {
2944
+ this.removeHoverClass(rowIndex);
2945
+ }
2772
2946
  this.currentHoveredRow = -1;
2773
2947
  if (this.scrolling) {
2774
2948
  return;
@@ -2807,7 +2981,7 @@ var ReactHeadlessTableRenderer = class extends Logger {
2807
2981
  this.hoverRowUpdatesInProgress.delete(rowIndex);
2808
2982
  });
2809
2983
  };
2810
- this.updateElementPosition = (elementIndex) => {
2984
+ this.updateElementPosition = (elementIndex, options) => {
2811
2985
  const itemElement = this.itemDOMElements[elementIndex];
2812
2986
  const cell = this.mappedCells.getRenderedCellAtElement(elementIndex);
2813
2987
  if (cell == null) {
@@ -2832,7 +3006,8 @@ var ReactHeadlessTableRenderer = class extends Logger {
2832
3006
  itemElement.style.transform = `translate3d(${x}px, ${y}px, 0)`;
2833
3007
  itemElement.style.willChange = "transform";
2834
3008
  itemElement.style.backfaceVisibility = "hidden";
2835
- itemElement.style.zIndex = "auto";
3009
+ const hidden = options ? options.hidden : !!this.isCellCovered(rowIndex, colIndex);
3010
+ itemElement.style.zIndex = hidden ? "-1" : "auto";
2836
3011
  } else {
2837
3012
  itemElement.style.display = "";
2838
3013
  itemElement.style.left = `${x}px`;
@@ -2842,9 +3017,6 @@ var ReactHeadlessTableRenderer = class extends Logger {
2842
3017
  };
2843
3018
  this.onScrollStart = () => {
2844
3019
  this.scrolling = true;
2845
- if (this.currentHoveredRow != -1) {
2846
- this.removeHoverClass(this.currentHoveredRow);
2847
- }
2848
3020
  };
2849
3021
  this.onScrollStop = () => {
2850
3022
  this.scrolling = false;
@@ -3027,6 +3199,7 @@ var ReactHeadlessTableRenderer = class extends Logger {
3027
3199
  const heightWithRowspan = rowspan === 1 ? height : this.brain.getRowHeightWithSpan(rowIndex, colIndex, rowspan);
3028
3200
  const widthWithColspan = colspan === 1 ? width : this.brain.getColWidthWithSpan(rowIndex, colIndex, colspan);
3029
3201
  const { row: rowFixed, col: colFixed } = this.isCellFixed(rowIndex, colIndex);
3202
+ const hidden = !!covered;
3030
3203
  const renderedNode = renderCell({
3031
3204
  rowIndex,
3032
3205
  colIndex,
@@ -3036,7 +3209,7 @@ var ReactHeadlessTableRenderer = class extends Logger {
3036
3209
  colspan,
3037
3210
  rowFixed,
3038
3211
  colFixed,
3039
- hidden: !!covered,
3212
+ hidden,
3040
3213
  heightWithRowspan,
3041
3214
  widthWithColspan,
3042
3215
  onMouseEnter: this.onMouseEnter.bind(null, rowIndex),
@@ -3053,7 +3226,7 @@ var ReactHeadlessTableRenderer = class extends Logger {
3053
3226
  this.debug(`Render cell ${rowIndex},${colIndex} at element ${elementIndex}`);
3054
3227
  }
3055
3228
  itemUpdater(renderedNode);
3056
- this.updateElementPosition(elementIndex);
3229
+ this.updateElementPosition(elementIndex, { hidden, rowspan, colspan });
3057
3230
  return;
3058
3231
  }
3059
3232
  reset() {
@@ -3081,8 +3254,11 @@ function createRenderer(brain) {
3081
3254
  function RawTableFn(props) {
3082
3255
  const { brain, renderCell } = props;
3083
3256
  const { renderer, onRenderUpdater } = (0, import_react7.useMemo)(() => {
3084
- return createRenderer(brain);
3085
- }, [brain]);
3257
+ return props.onRenderUpdater && props.renderer ? {
3258
+ renderer: props.renderer,
3259
+ onRenderUpdater: props.onRenderUpdater
3260
+ } : createRenderer(brain);
3261
+ }, [brain, props.onRenderUpdater, props.renderer]);
3086
3262
  (0, import_react7.useEffect)(() => {
3087
3263
  renderer.cellHoverClassNames = props.cellHoverClassNames || [];
3088
3264
  }, [renderer, props.cellHoverClassNames]);
@@ -3116,6 +3292,144 @@ function RawTableFn(props) {
3116
3292
  }
3117
3293
  var RawTable = React9.memo(RawTableFn);
3118
3294
 
3295
+ // src/components/InfiniteTable/components/ActiveRowIndicator.tsx
3296
+ var React10 = __toModule(require("react"));
3297
+ var import_react9 = __toModule(require("react"));
3298
+
3299
+ // src/components/hooks/useRerender.ts
3300
+ var import_react8 = __toModule(require("react"));
3301
+ var useRerender = () => {
3302
+ const [state, setState] = (0, import_react8.useState)(0);
3303
+ return [
3304
+ state,
3305
+ (0, import_react8.useCallback)(() => {
3306
+ setState((state2) => state2 + 1);
3307
+ }, [setState])
3308
+ ];
3309
+ };
3310
+
3311
+ // src/components/InfiniteTable/internalProps.ts
3312
+ var rootClassName2 = "Infinite";
3313
+ var internalProps = {
3314
+ rootClassName: rootClassName2
3315
+ };
3316
+
3317
+ // src/components/InfiniteTable/components/ActiveRowIndicator.css.ts
3318
+ var ActiveRowIndicatorCls = { visible: "j26lrx1 j26lrx0 _16lm1iwe _16lm1iw3 _16lm1iwt _16lm1iwu _16lm1iww", hidden: "j26lrx2 j26lrx0 _16lm1iwe _16lm1iw3 _16lm1iwt _16lm1iwu _16lm1iww" };
3319
+
3320
+ // src/components/InfiniteTable/components/ActiveRowIndicator.tsx
3321
+ var { rootClassName: rootClassName3 } = internalProps;
3322
+ var baseCls = `${rootClassName3}-ActiveRowIndicator`;
3323
+ var ActiveRowIndicatorFn = (props) => {
3324
+ const { brain } = props;
3325
+ const [state, setState] = (0, import_react9.useState)({
3326
+ top: 0,
3327
+ rowHeight: 0
3328
+ });
3329
+ const domRef = (0, import_react9.useRef)(null);
3330
+ const stateRef = (0, import_react9.useRef)(state);
3331
+ const active = props.activeRowIndex != null && brain.getRowCount() > props.activeRowIndex;
3332
+ const [rerenderId, rerender] = useRerender();
3333
+ (0, import_react9.useLayoutEffect)(() => {
3334
+ if (props.activeRowIndex == null) {
3335
+ return;
3336
+ }
3337
+ setState(stateRef.current = {
3338
+ top: brain.getItemOffsetFor(props.activeRowIndex, "vertical"),
3339
+ rowHeight: brain.getRowHeight(props.activeRowIndex)
3340
+ });
3341
+ }, [props.activeRowIndex, rerenderId]);
3342
+ (0, import_react9.useEffect)(() => {
3343
+ const removeOnScroll = brain.onScroll((scrollPos) => {
3344
+ const node = domRef.current;
3345
+ const topOffset = stateRef.current.top;
3346
+ node.style.transform = `translate3d(0px, ${-scrollPos.scrollTop + topOffset}px, 0px)`;
3347
+ });
3348
+ const removeOnRenderCountChange = brain.onRenderCountChange(rerender);
3349
+ return () => {
3350
+ removeOnRenderCountChange();
3351
+ removeOnScroll();
3352
+ };
3353
+ }, [brain]);
3354
+ return /* @__PURE__ */ React10.createElement("div", {
3355
+ ref: domRef,
3356
+ "data-name": "active-row-indicator",
3357
+ className: `${baseCls} ${active ? ActiveRowIndicatorCls.visible : ActiveRowIndicatorCls.hidden}`,
3358
+ style: active ? {
3359
+ transform: `translate3d(0px, ${-brain.getScrollPosition().scrollTop + state.top}px,0)`,
3360
+ height: state.rowHeight
3361
+ } : void 0
3362
+ });
3363
+ };
3364
+ var ActiveRowIndicator = React10.memo(ActiveRowIndicatorFn);
3365
+
3366
+ // src/components/InfiniteTable/components/ActiveCellIndicator.tsx
3367
+ var React11 = __toModule(require("react"));
3368
+ var import_react10 = __toModule(require("react"));
3369
+
3370
+ // src/components/InfiniteTable/components/ActiveCellIndicator.css.ts
3371
+ var ActiveCellIndicatorCls = { visible: "nxbq1c1 nxbq1c0 _16lm1iwe _16lm1iw3 _16lm1iww _16lm1iwu", hidden: "nxbq1c2 nxbq1c0 _16lm1iwe _16lm1iw3 _16lm1iww _16lm1iwu" };
3372
+
3373
+ // src/components/InfiniteTable/components/ActiveCellIndicator.tsx
3374
+ var { rootClassName: rootClassName4 } = internalProps;
3375
+ var baseCls2 = `${rootClassName4}-ActiveCellIndicator`;
3376
+ var ActiveCellIndicatorFn = (props) => {
3377
+ const { brain } = props;
3378
+ const [rerenderId, rerender] = useRerender();
3379
+ const [state, setState] = (0, import_react10.useState)({
3380
+ top: 0,
3381
+ rowHeight: 0,
3382
+ colWidth: 0,
3383
+ left: 0
3384
+ });
3385
+ const domRef = (0, import_react10.useRef)(null);
3386
+ const stateRef = (0, import_react10.useRef)(state);
3387
+ const active = props.activeCellIndex != null && brain.getRowCount() > props.activeCellIndex[0];
3388
+ (0, import_react10.useLayoutEffect)(() => {
3389
+ if (props.activeCellIndex == null) {
3390
+ return;
3391
+ }
3392
+ const rowIndex = props.activeCellIndex[0];
3393
+ setState(stateRef.current = {
3394
+ top: brain.getItemOffsetFor(rowIndex, "vertical"),
3395
+ rowHeight: brain.getRowHeight(rowIndex),
3396
+ left: brain.getItemOffsetFor(props.activeCellIndex[1], "horizontal"),
3397
+ colWidth: brain.getColWidth(props.activeCellIndex[1])
3398
+ });
3399
+ }, [props.activeCellIndex, rerenderId]);
3400
+ (0, import_react10.useEffect)(() => {
3401
+ const removeOnSCroll = brain.onScroll((scrollPos) => {
3402
+ const node = domRef.current;
3403
+ const topOffset = stateRef.current.top;
3404
+ const leftOffset = stateRef.current.left;
3405
+ node.style.transform = `translate3d(${-scrollPos.scrollLeft + leftOffset}px, ${-scrollPos.scrollTop + topOffset}px, 0px)`;
3406
+ });
3407
+ const removeOnRenderCountChange = brain.onRenderCountChange(() => {
3408
+ rerender();
3409
+ });
3410
+ const removeOnAvailableSizeChange = brain.onAvailableSizeChange(() => {
3411
+ rerender();
3412
+ });
3413
+ return () => {
3414
+ removeOnAvailableSizeChange();
3415
+ removeOnRenderCountChange();
3416
+ removeOnSCroll();
3417
+ };
3418
+ }, [brain]);
3419
+ const scrollPosition = brain.getScrollPosition();
3420
+ return /* @__PURE__ */ React11.createElement("div", {
3421
+ ref: domRef,
3422
+ "data-name": "active-cell-indicator",
3423
+ className: `${baseCls2} ${active ? ActiveCellIndicatorCls.visible : ActiveCellIndicatorCls.hidden}`,
3424
+ style: active ? {
3425
+ transform: `translate3d(${-scrollPosition.scrollLeft + state.left}px, ${-scrollPosition.scrollTop + state.top}px,0)`,
3426
+ width: state.colWidth,
3427
+ height: state.rowHeight
3428
+ } : void 0
3429
+ });
3430
+ };
3431
+ var ActiveCellIndicator = React11.memo(ActiveCellIndicatorFn);
3432
+
3119
3433
  // src/components/HeadlessTable/index.tsx
3120
3434
  function useMatrixBrain(brain, brainOptions, fixedCellsInfo) {
3121
3435
  if (fixedCellsInfo && (fixedCellsInfo.fixedColsStart || fixedCellsInfo.fixedColsEnd || fixedCellsInfo.fixedRowsStart || fixedCellsInfo.fixedRowsEnd)) {
@@ -3143,25 +3457,33 @@ function HeadlessTable(props) {
3143
3457
  scrollerDOMRef,
3144
3458
  scrollStopDelay,
3145
3459
  renderCell,
3146
- cellHoverClassNames
3460
+ cellHoverClassNames,
3461
+ renderer,
3462
+ activeRowIndex,
3463
+ activeCellIndex,
3464
+ onRenderUpdater
3147
3465
  } = _a, domProps = __objRest(_a, [
3148
3466
  "brain",
3149
3467
  "scrollerDOMRef",
3150
3468
  "scrollStopDelay",
3151
3469
  "renderCell",
3152
- "cellHoverClassNames"
3470
+ "cellHoverClassNames",
3471
+ "renderer",
3472
+ "activeRowIndex",
3473
+ "activeCellIndex",
3474
+ "onRenderUpdater"
3153
3475
  ]);
3154
- const domRef = (0, import_react8.useRef)(null);
3155
- const [scrollSize, setTotalScrollSize] = (0, import_react8.useState)({
3476
+ const domRef = (0, import_react11.useRef)(null);
3477
+ const [scrollSize, setTotalScrollSize] = (0, import_react11.useState)({
3156
3478
  width: 0,
3157
3479
  height: 0
3158
3480
  });
3159
- (0, import_react8.useEffect)(() => {
3481
+ (0, import_react11.useEffect)(() => {
3160
3482
  if (scrollStopDelay != null) {
3161
3483
  brain.setScrollStopDelay(scrollStopDelay);
3162
3484
  }
3163
3485
  }, [scrollStopDelay, brain]);
3164
- (0, import_react8.useEffect)(() => {
3486
+ (0, import_react11.useEffect)(() => {
3165
3487
  var _a2;
3166
3488
  const node = (_a2 = domRef.current) == null ? void 0 : _a2.parentNode;
3167
3489
  if (!node) {
@@ -3177,39 +3499,47 @@ function HeadlessTable(props) {
3177
3499
  const remove = setupResizeObserver(node, onResize);
3178
3500
  return remove;
3179
3501
  }, []);
3180
- const onContainerScroll = (0, import_react8.useCallback)((scrollPos) => {
3502
+ const onContainerScroll = (0, import_react11.useCallback)((scrollPos) => {
3181
3503
  brain.setScrollPosition(scrollPos, (scrollPos2) => {
3182
3504
  domRef.current.style.transform = `translate3d(${-scrollPos2.scrollLeft}px, ${-scrollPos2.scrollTop}px, 0px)`;
3183
3505
  });
3184
3506
  }, [brain]);
3185
- (0, import_react8.useEffect)(() => {
3507
+ (0, import_react11.useEffect)(() => {
3186
3508
  const removeOnRenderCount = brain.onRenderCountChange(() => {
3187
3509
  setTotalScrollSize(brain.getTotalSize());
3188
3510
  });
3189
3511
  setTotalScrollSize(brain.getTotalSize());
3190
3512
  return removeOnRenderCount;
3191
3513
  }, [brain]);
3192
- return /* @__PURE__ */ React10.createElement(VirtualScrollContainer, __spreadProps(__spreadValues({
3514
+ return /* @__PURE__ */ React12.createElement(VirtualScrollContainer, __spreadProps(__spreadValues({
3193
3515
  onContainerScroll
3194
3516
  }, domProps), {
3195
3517
  ref: scrollerDOMRef
3196
- }), /* @__PURE__ */ React10.createElement("div", {
3518
+ }), /* @__PURE__ */ React12.createElement("div", {
3197
3519
  ref: domRef,
3198
3520
  className: scrollTransformTargetCls,
3199
3521
  "data-name": "scroll-transform-target"
3200
- }, /* @__PURE__ */ React10.createElement(RawTable, {
3522
+ }, /* @__PURE__ */ React12.createElement(RawTable, {
3523
+ renderer,
3524
+ onRenderUpdater,
3201
3525
  renderCell,
3202
3526
  brain,
3203
3527
  cellHoverClassNames
3204
- })), /* @__PURE__ */ React10.createElement(SpacePlaceholder, {
3528
+ })), /* @__PURE__ */ React12.createElement(ActiveRowIndicator, {
3529
+ brain,
3530
+ activeRowIndex
3531
+ }), /* @__PURE__ */ React12.createElement(ActiveCellIndicator, {
3532
+ brain,
3533
+ activeCellIndex
3534
+ }), /* @__PURE__ */ React12.createElement(SpacePlaceholder, {
3205
3535
  width: scrollSize.width,
3206
3536
  height: scrollSize.height
3207
3537
  }));
3208
3538
  }
3209
3539
 
3210
3540
  // src/components/hooks/useComponentState/index.tsx
3211
- var React11 = __toModule(require("react"));
3212
- var import_react11 = __toModule(require("react"));
3541
+ var React13 = __toModule(require("react"));
3542
+ var import_react14 = __toModule(require("react"));
3213
3543
 
3214
3544
  // src/utils/proxyFnCall.ts
3215
3545
  function proxyFn(fn, config) {
@@ -3252,18 +3582,18 @@ function isControlled(propName, props) {
3252
3582
  }
3253
3583
 
3254
3584
  // src/components/hooks/useLatest.tsx
3255
- var import_react9 = __toModule(require("react"));
3585
+ var import_react12 = __toModule(require("react"));
3256
3586
  function useLatest(value) {
3257
- const ref = (0, import_react9.useRef)(value);
3587
+ const ref = (0, import_react12.useRef)(value);
3258
3588
  ref.current = value;
3259
- return (0, import_react9.useCallback)(() => ref.current, []);
3589
+ return (0, import_react12.useCallback)(() => ref.current, []);
3260
3590
  }
3261
3591
 
3262
3592
  // src/components/hooks/usePrevious.ts
3263
- var import_react10 = __toModule(require("react"));
3593
+ var import_react13 = __toModule(require("react"));
3264
3594
  var usePrevious = (value, initialValue) => {
3265
- const ref = (0, import_react10.useRef)(initialValue === void 0 ? value : initialValue);
3266
- (0, import_react10.useLayoutEffect)(() => {
3595
+ const ref = (0, import_react13.useRef)(initialValue === void 0 ? value : initialValue);
3596
+ (0, import_react13.useLayoutEffect)(() => {
3267
3597
  ref.current = value;
3268
3598
  });
3269
3599
  return ref.current;
@@ -3284,7 +3614,7 @@ function getComponentStateContext() {
3284
3614
  if (ComponentContext) {
3285
3615
  return ComponentContext;
3286
3616
  }
3287
- return ComponentContext = (0, import_react11.createContext)(null);
3617
+ return ComponentContext = (0, import_react14.createContext)(null);
3288
3618
  }
3289
3619
  function getReducerGeneratedActions(dispatch, getState, getProps, propsToForward, allowedControlledPropOverrides, interceptedActions) {
3290
3620
  const state = getState();
@@ -3343,16 +3673,16 @@ function forwardProps(propsToForward, props) {
3343
3673
  return mappedState;
3344
3674
  }
3345
3675
  function getComponentStateRoot(config) {
3346
- return React11.memo(function ComponentStateRoot(props) {
3676
+ return React13.memo(function ComponentStateRoot(props) {
3347
3677
  var _a, _b;
3348
- const [initialSetupState] = (0, import_react11.useState)(() => {
3678
+ const [initialSetupState] = (0, import_react14.useState)(() => {
3349
3679
  return config.initSetupState ? config.initSetupState() : {};
3350
3680
  });
3351
- const propsToStateSetRef = (0, import_react11.useRef)(new Set());
3352
- const propsToForward = (0, import_react11.useMemo)(() => config.forwardProps ? config.forwardProps(initialSetupState) : {}, [initialSetupState]);
3681
+ const propsToStateSetRef = (0, import_react14.useRef)(new Set());
3682
+ const propsToForward = (0, import_react14.useMemo)(() => config.forwardProps ? config.forwardProps(initialSetupState) : {}, [initialSetupState]);
3353
3683
  const parentState = (_b = (_a = config.getParentState) == null ? void 0 : _a.call(config)) != null ? _b : null;
3354
3684
  const getParentState = useLatest(parentState);
3355
- const [wholeState] = (0, import_react11.useState)(() => {
3685
+ const [wholeState] = (0, import_react14.useState)(() => {
3356
3686
  let mappedState = {};
3357
3687
  if (propsToForward) {
3358
3688
  mappedState = forwardProps(propsToForward, props);
@@ -3419,10 +3749,10 @@ function getComponentStateRoot(config) {
3419
3749
  }) : newState;
3420
3750
  return result;
3421
3751
  };
3422
- const [state, dispatch] = (0, import_react11.useReducer)(theReducer, wholeState);
3752
+ const [state, dispatch] = (0, import_react14.useReducer)(theReducer, wholeState);
3423
3753
  const getComponentState = useLatest(state);
3424
3754
  const { allowedControlledPropOverrides } = config;
3425
- const actions = (0, import_react11.useMemo)(() => {
3755
+ const actions = (0, import_react14.useMemo)(() => {
3426
3756
  const generatedActions = getReducerGeneratedActions(dispatch, getComponentState, getProps, propsToForward, allowedControlledPropOverrides, config.interceptActions);
3427
3757
  return generatedActions;
3428
3758
  }, [
@@ -3431,13 +3761,13 @@ function getComponentStateRoot(config) {
3431
3761
  allowedControlledPropOverrides
3432
3762
  ]);
3433
3763
  const Context = getComponentStateContext();
3434
- const contextValue = (0, import_react11.useMemo)(() => ({
3764
+ const contextValue = (0, import_react14.useMemo)(() => ({
3435
3765
  componentState: state,
3436
3766
  componentActions: actions,
3437
3767
  getComponentState
3438
3768
  }), [state, actions, getComponentState]);
3439
3769
  const prevProps = usePrevious(props);
3440
- (0, import_react11.useEffect)(() => {
3770
+ (0, import_react14.useEffect)(() => {
3441
3771
  const currentProps = props;
3442
3772
  const newMappedState = {};
3443
3773
  let newMappedStateCount = 0;
@@ -3493,24 +3823,18 @@ function getComponentStateRoot(config) {
3493
3823
  }
3494
3824
  }
3495
3825
  });
3496
- return /* @__PURE__ */ React11.createElement(Context.Provider, {
3826
+ return /* @__PURE__ */ React13.createElement(Context.Provider, {
3497
3827
  value: contextValue
3498
3828
  }, props.children);
3499
3829
  });
3500
3830
  }
3501
3831
  function useComponentState() {
3502
3832
  const Context = getComponentStateContext();
3503
- return React11.useContext(Context);
3833
+ return React13.useContext(Context);
3504
3834
  }
3505
3835
 
3506
3836
  // src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx
3507
- var React12 = __toModule(require("react"));
3508
-
3509
- // src/components/InfiniteTable/internalProps.ts
3510
- var rootClassName2 = "Infinite";
3511
- var internalProps = {
3512
- rootClassName: rootClassName2
3513
- };
3837
+ var React14 = __toModule(require("react"));
3514
3838
 
3515
3839
  // src/components/InfiniteTable/hooks/useInternalProps.ts
3516
3840
  var useInternalProps = () => {
@@ -3518,159 +3842,185 @@ var useInternalProps = () => {
3518
3842
  };
3519
3843
 
3520
3844
  // src/components/InfiniteTable/utilities.css.ts
3521
- var alignItems = { center: "_16lm1iw13", stretch: "_16lm1iw14" };
3522
- var cssEllipsisClassName = "_16lm1iw1c _16lm1iw1d _16lm1iw18";
3845
+ var alignItems = { center: "_16lm1iw14", stretch: "_16lm1iw15" };
3846
+ var cssEllipsisClassName = "_16lm1iw1d _16lm1iw1e _16lm1iw19";
3523
3847
  var cursor = { pointer: "_16lm1iwd" };
3524
- var display = { flex: "_16lm1iwl", block: "_16lm1iwm", inlineBlock: "_16lm1iwn" };
3525
- var flex = { "1": "_16lm1iwe", none: "_16lm1iwf" };
3526
- var justifyContent = { center: "_16lm1iw15", start: "_16lm1iw16", end: "_16lm1iw17" };
3527
- var left = { "0": "_16lm1iwv", "100%": "_16lm1iww" };
3528
- var overflow = { hidden: "_16lm1iw18", auto: "_16lm1iw19", visible: "_16lm1iw1a" };
3848
+ var display = { flex: "_16lm1iwm", block: "_16lm1iwn", inlineBlock: "_16lm1iwo" };
3849
+ var flex = { "1": "_16lm1iwf", none: "_16lm1iwg" };
3850
+ var flexFlow = { column: "_16lm1iw12", row: "_16lm1iw13" };
3851
+ var justifyContent = { center: "_16lm1iw16", start: "_16lm1iw17", end: "_16lm1iw18" };
3852
+ var left = { "0": "_16lm1iww", "100%": "_16lm1iwx" };
3853
+ var overflow = { hidden: "_16lm1iw19", auto: "_16lm1iw1a", visible: "_16lm1iw1b" };
3529
3854
  var position = { relative: "_16lm1iw1", absolute: "_16lm1iw2", sticky: "_16lm1iw3", fixed: "_16lm1iw4" };
3530
- var top = { "0": "_16lm1iwt", "100%": "_16lm1iwu" };
3855
+ var top = { "0": "_16lm1iwu", "100%": "_16lm1iwv" };
3531
3856
  var transformTranslateZero = "_16lm1iwa";
3532
- var userSelect = { none: "_16lm1iwo" };
3533
- var zIndex = { "1": "_16lm1iwg", "10": "_16lm1iwh", "1000": "_16lm1iwi", "10000": "_16lm1iwj", "100000": "_16lm1iwk" };
3857
+ var userSelect = { none: "_16lm1iwp" };
3858
+ var zIndex = { "1": "_16lm1iwh", "10": "_16lm1iwi", "1000": "_16lm1iwj", "10000": "_16lm1iwk", "100000": "_16lm1iwl" };
3534
3859
 
3535
3860
  // src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx
3536
- var InfiniteTableBody = React12.forwardRef(function InfiniteTableBody2(props, ref) {
3537
- const { rootClassName: rootClassName8 } = useInternalProps();
3538
- return /* @__PURE__ */ React12.createElement("div", __spreadProps(__spreadValues({
3861
+ var InfiniteTableBody = React14.forwardRef(function InfiniteTableBody2(props, ref) {
3862
+ const { rootClassName: rootClassName11 } = useInternalProps();
3863
+ return /* @__PURE__ */ React14.createElement("div", __spreadProps(__spreadValues({
3539
3864
  ref
3540
3865
  }, props), {
3541
- className: join(`${rootClassName8}Body`, position.relative, flex["1"], transformTranslateZero, props.className)
3866
+ className: join(`${rootClassName11}Body`, position.relative, flex["1"], transformTranslateZero, props.className)
3542
3867
  }));
3543
3868
  });
3544
3869
 
3545
- // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
3870
+ // src/components/InfiniteTable/components/InfiniteTableFooter/InfiniteTableFooter.tsx
3546
3871
  var React15 = __toModule(require("react"));
3872
+ var InfiniteTableFooter = React15.forwardRef(function InfiniteTableFooter2(props, ref) {
3873
+ const { rootClassName: rootClassName11 } = useInternalProps();
3874
+ return /* @__PURE__ */ React15.createElement("div", __spreadProps(__spreadValues({
3875
+ ref
3876
+ }, props), {
3877
+ className: join(`${rootClassName11}Footer`, position.relative, display.flex, flexFlow.row, props.className)
3878
+ }));
3879
+ });
3880
+
3881
+ // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
3882
+ var React20 = __toModule(require("react"));
3883
+ var import_react22 = __toModule(require("react"));
3547
3884
  var import_react_dom = __toModule(require("react-dom"));
3548
- var import_react17 = __toModule(require("react"));
3549
3885
 
3550
- // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
3551
- var React13 = __toModule(require("react"));
3886
+ // src/components/DataSource/defaultFilterTypes.ts
3887
+ function getFilterTypes() {
3888
+ const result = {
3889
+ string: {
3890
+ label: "Text",
3891
+ emptyValues: new Set([""]),
3892
+ defaultOperator: "contains",
3893
+ operators: [
3894
+ {
3895
+ name: "contains",
3896
+ fn: ({ currentValue, filterValue, emptyValues }) => {
3897
+ if (emptyValues.has(currentValue) || emptyValues.has(filterValue)) {
3898
+ return true;
3899
+ }
3900
+ return typeof currentValue === "string" && typeof filterValue == "string" && currentValue.toLowerCase().includes(filterValue.toLowerCase());
3901
+ }
3902
+ },
3903
+ {
3904
+ name: "eq",
3905
+ fn: ({ currentValue: value, filterValue, emptyValues }) => {
3906
+ if (emptyValues.has(value) || emptyValues.has(filterValue)) {
3907
+ return true;
3908
+ }
3909
+ return typeof value === "string" && value === filterValue;
3910
+ }
3911
+ }
3912
+ ]
3913
+ },
3914
+ number: {
3915
+ label: "Number",
3916
+ emptyValues: new Set(["", null, void 0]),
3917
+ defaultOperator: "eq",
3918
+ operators: [
3919
+ {
3920
+ name: "eq",
3921
+ fn: ({ currentValue, filterValue, emptyValues }) => {
3922
+ if (emptyValues.has(currentValue) || emptyValues.has(filterValue)) {
3923
+ return true;
3924
+ }
3925
+ return currentValue == filterValue;
3926
+ }
3927
+ },
3928
+ {
3929
+ name: "between",
3930
+ fn: ({ currentValue, filterValue, emptyValues }) => {
3931
+ if (emptyValues.has(currentValue) || emptyValues.has(filterValue)) {
3932
+ return true;
3933
+ }
3934
+ const [min, max] = filterValue;
3935
+ return currentValue >= min && currentValue <= max;
3936
+ }
3937
+ }
3938
+ ]
3939
+ }
3940
+ };
3941
+ return result;
3942
+ }
3943
+ var defaultFilterTypes = getFilterTypes();
3552
3944
 
3553
- // src/components/InfiniteTable/hooks/useInfiniteTableState.ts
3554
- var import_react13 = __toModule(require("react"));
3945
+ // src/components/InfiniteTable/hooks/useCellClassName.ts
3946
+ function useCellClassName(column, baseClasses, variants, extraFlags) {
3947
+ const result = [...baseClasses];
3948
+ const variantObject = {
3949
+ filtered: column.computedFiltered,
3950
+ first: column.computedFirst,
3951
+ last: column.computedLast,
3952
+ groupByField: !!column.groupByField,
3953
+ firstInCategory: column.computedFirstInCategory,
3954
+ lastInCategory: column.computedLastInCategory,
3955
+ pinned: column.computedPinned || false,
3956
+ rowActive: extraFlags.rowActive,
3957
+ dragging: extraFlags.dragging,
3958
+ zebra: extraFlags.zebra
3959
+ };
3960
+ const theVariant = variants(variantObject);
3961
+ result.push(theVariant);
3962
+ if (column.computedFirst) {
3963
+ result.push(...baseClasses.map((c) => `${c}--first`));
3964
+ }
3965
+ if (column.groupByField) {
3966
+ result.push(...baseClasses.map((c) => `${c}--group-column`));
3967
+ }
3968
+ if (column.computedLast) {
3969
+ result.push(...baseClasses.map((c) => `${c}--last`));
3970
+ }
3971
+ if (column.computedFirstInCategory) {
3972
+ result.push(...baseClasses.map((c) => `${c}--first-in-category`));
3973
+ }
3974
+ if (column.computedLastInCategory) {
3975
+ result.push(...baseClasses.map((c) => `${c}--last-in-category`));
3976
+ }
3977
+ if (column.computedPinned) {
3978
+ result.push(...baseClasses.map((c) => `${c}--pinned-${column.computedPinned}`));
3979
+ } else {
3980
+ result.push(...baseClasses.map((c) => `${c}--unpinned`));
3981
+ }
3982
+ return result.filter(Boolean).join(" ");
3983
+ }
3984
+
3985
+ // src/components/InfiniteTable/hooks/useColumnPointerEvents.ts
3986
+ var import_binary_search2 = __toModule(require_binary_search());
3987
+ var import_react17 = __toModule(require("react"));
3988
+
3989
+ // src/components/InfiniteTable/hooks/useInfiniteTable.ts
3990
+ var import_react16 = __toModule(require("react"));
3555
3991
 
3556
3992
  // src/components/InfiniteTable/InfiniteTableContext.ts
3557
- var import_react12 = __toModule(require("react"));
3993
+ var import_react15 = __toModule(require("react"));
3558
3994
  var TableContext;
3559
3995
  function getInfiniteTableContext() {
3560
3996
  if (TableContext) {
3561
3997
  return TableContext;
3562
3998
  }
3563
- return TableContext = (0, import_react12.createContext)(null);
3999
+ return TableContext = (0, import_react15.createContext)(null);
3564
4000
  }
3565
4001
 
3566
- // src/components/InfiniteTable/hooks/useInfiniteTableState.ts
3567
- var useInfiniteTableState = () => {
4002
+ // src/components/InfiniteTable/hooks/useInfiniteTable.ts
4003
+ var useInfiniteTable = () => {
3568
4004
  const TableContext2 = getInfiniteTableContext();
3569
- const { componentState } = (0, import_react13.useContext)(TableContext2);
3570
- return componentState;
4005
+ return (0, import_react16.useContext)(TableContext2);
3571
4006
  };
3572
4007
 
3573
- // src/components/InfiniteTable/components/cell.css.ts
3574
- var import_createRuntimeFn = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
3575
- var CellClsVariants = { shifting: "_1eexc2a3", dragging: "_1eexc2a4" };
3576
- var ColumnCellCls = "_1eexc2a5 _16lm1iwl _16lm1iw12 _16lm1iw13 _16lm1iw2 _16lm1iw1b _16lm1iw1c";
3577
- var ColumnCellRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_1eexc2a7", variantClassNames: { dragging: { false: "_1eexc2a8", true: "_1eexc2a9" }, zebra: { false: "_1eexc2aa", even: "_1eexc2ab", odd: "_1eexc2ac" }, first: { true: "_1eexc2ad", false: "_1eexc2ae" }, last: { true: "_1eexc2af", false: "_1eexc2ag" }, groupByField: { true: "_1eexc2ah", false: "_1eexc2ai" }, firstInCategory: { true: "_1eexc2aj", false: "_1eexc2ak" }, lastInCategory: { true: "_1eexc2al", false: "_1eexc2am" }, pinned: { start: "_1eexc2an", end: "_1eexc2ao", false: "_1eexc2ap" } }, defaultVariants: {}, compoundVariants: [[{ pinned: "start", lastInCategory: true }, "_1eexc2aq"], [{ pinned: "end", firstInCategory: true }, "_1eexc2ar"]] });
3578
- var columnAlignCellStyle = { center: "_1eexc2a0", start: "_1eexc2a1", end: "_1eexc2a2" };
3579
-
3580
- // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
3581
- var { rootClassName: rootClassName3 } = internalProps;
3582
- var InfiniteTableCellClassName = `${rootClassName3}Cell`;
3583
- var InfiniteTableCellContentClassName = `${rootClassName3}Cell_content`;
3584
- function InfiniteTableCellFn(props) {
3585
- var _b, _c, _d, _e;
3586
- const _a = props, {
3587
- cssEllipsis = true,
3588
- virtualized = true,
3589
- skipColumnShifting = false,
3590
- offsetProperty = "left",
3591
- column,
3592
- domRef,
3593
- width,
3594
- afterChildren,
3595
- beforeChildren,
3596
- offset,
3597
- cellType,
3598
- cssPosition: _cssPosition,
3599
- renderChildren
3600
- } = _a, domProps = __objRest(_a, [
3601
- "cssEllipsis",
3602
- "virtualized",
3603
- "skipColumnShifting",
3604
- "offsetProperty",
3605
- "column",
3606
- "domRef",
3607
- "width",
3608
- "afterChildren",
3609
- "beforeChildren",
3610
- "offset",
3611
- "cellType",
3612
- "cssPosition",
3613
- "renderChildren"
3614
- ]);
3615
- const children = renderChildren();
3616
- const { columnShifts } = useInfiniteTableState();
3617
- const shifting = !!columnShifts;
3618
- const style = __spreadValues({
3619
- width
3620
- }, domProps.style);
3621
- if (!skipColumnShifting && columnShifts && columnShifts[column.computedVisibleIndex]) {
3622
- const shiftLeft = columnShifts[column.computedVisibleIndex] + (offset != null ? offset : 0);
3623
- if (virtualized) {
3624
- style.left = shiftLeft;
3625
- } else {
3626
- style.transform = `translate3d(${shiftLeft}px, 0px, 0px)`;
3627
- }
3628
- }
3629
- const finalDOMProps = __spreadProps(__spreadValues({}, domProps), {
3630
- style,
3631
- "data-column-id": column.id,
3632
- className: join(domProps.className, columnAlignCellStyle[(_b = column.align) != null ? _b : "start"], justifyContent[(_c = column.align) != null ? _c : "start"], InfiniteTableCellClassName, ColumnCellCls, shifting ? `${InfiniteTableCellClassName}--shifting ${CellClsVariants.shifting}` : ""),
3633
- children: /* @__PURE__ */ React13.createElement(React13.Fragment, null, beforeChildren, /* @__PURE__ */ React13.createElement("div", {
3634
- className: `${InfiniteTableCellContentClassName} ${cssEllipsis ? cssEllipsisClassName : overflow.hidden}`
3635
- }, children), afterChildren)
3636
- });
3637
- const RenderComponent = cellType === "body" ? (_d = column.components) == null ? void 0 : _d.ColumnCell : (_e = column.components) == null ? void 0 : _e.HeaderCell;
3638
- if (RenderComponent) {
3639
- return /* @__PURE__ */ React13.createElement(RenderComponent, __spreadValues({}, finalDOMProps));
3640
- }
3641
- return /* @__PURE__ */ React13.createElement("div", __spreadProps(__spreadValues({}, finalDOMProps), {
3642
- ref: domRef
3643
- }));
3644
- }
3645
- var InfiniteTableCell = React13.memo(InfiniteTableCellFn);
3646
-
3647
- // src/components/InfiniteTable/hooks/useColumnPointerEvents.ts
3648
- var import_binary_search2 = __toModule(require_binary_search());
3649
- var import_react15 = __toModule(require("react"));
3650
-
3651
- // src/components/InfiniteTable/hooks/useInfiniteTable.ts
3652
- var import_react14 = __toModule(require("react"));
3653
- var useInfiniteTable = () => {
3654
- const TableContext2 = getInfiniteTableContext();
3655
- return (0, import_react14.useContext)(TableContext2);
3656
- };
3657
-
3658
- // src/components/InfiniteTable/utils/moveXatY.ts
3659
- var moveXatY = (arr, dragIndex, dropIndex) => {
3660
- arr = [...arr];
3661
- if (dragIndex === dropIndex || arr[dragIndex] === void 0 || arr[dropIndex] === void 0) {
3662
- return arr;
3663
- }
3664
- const dragItem = arr[dragIndex];
3665
- if (dropIndex < dragIndex) {
3666
- arr.splice(dragIndex, 1);
3667
- arr.splice(dropIndex, 0, dragItem);
3668
- } else {
3669
- arr.splice(dragIndex, 1);
3670
- arr.splice(dropIndex, 0, dragItem);
3671
- }
3672
- return arr;
3673
- };
4008
+ // src/components/InfiniteTable/utils/moveXatY.ts
4009
+ var moveXatY = (arr, dragIndex, dropIndex) => {
4010
+ arr = [...arr];
4011
+ if (dragIndex === dropIndex || arr[dragIndex] === void 0 || arr[dropIndex] === void 0) {
4012
+ return arr;
4013
+ }
4014
+ const dragItem = arr[dragIndex];
4015
+ if (dropIndex < dragIndex) {
4016
+ arr.splice(dragIndex, 1);
4017
+ arr.splice(dropIndex, 0, dragItem);
4018
+ } else {
4019
+ arr.splice(dragIndex, 1);
4020
+ arr.splice(dropIndex, 0, dragItem);
4021
+ }
4022
+ return arr;
4023
+ };
3674
4024
 
3675
4025
  // src/components/InfiniteTable/hooks/useColumnPointerEvents.ts
3676
4026
  var getBreakPoints = (columns) => {
@@ -3687,18 +4037,18 @@ var useColumnPointerEvents = ({
3687
4037
  columns,
3688
4038
  computedRemainingSpace
3689
4039
  }) => {
3690
- const [draggingDiff, setDraggingDiff] = (0, import_react15.useState)(null);
3691
- const [proxyOffset, setProxyOffset] = (0, import_react15.useState)(null);
3692
- const breakpointsRef = (0, import_react15.useRef)([]);
3693
- const pointerMoveRef = (0, import_react15.useRef)(null);
3694
- const didDragRef = (0, import_react15.useRef)(false);
3695
- const initialClientPos = (0, import_react15.useRef)(null);
3696
- const currentDropIndexRef = (0, import_react15.useRef)(null);
4040
+ const [draggingDiff, setDraggingDiff] = (0, import_react17.useState)(null);
4041
+ const [proxyOffset, setProxyOffset] = (0, import_react17.useState)(null);
4042
+ const breakpointsRef = (0, import_react17.useRef)([]);
4043
+ const pointerMoveRef = (0, import_react17.useRef)(null);
4044
+ const didDragRef = (0, import_react17.useRef)(false);
4045
+ const initialClientPos = (0, import_react17.useRef)(null);
4046
+ const currentDropIndexRef = (0, import_react17.useRef)(null);
3697
4047
  const dragging = draggingDiff != null;
3698
4048
  const { componentActions, computed } = useInfiniteTable();
3699
4049
  const { computedColumnOrder } = computed;
3700
- const column = (0, import_react15.useMemo)(() => columns.get(columnId), [columnId, columns]);
3701
- const { columnIndex, columnWidth, columnsArray } = (0, import_react15.useMemo)(() => {
4050
+ const column = (0, import_react17.useMemo)(() => columns.get(columnId), [columnId, columns]);
4051
+ const { columnIndex, columnWidth, columnsArray } = (0, import_react17.useMemo)(() => {
3702
4052
  const columnsArray2 = Array.from(columns.values());
3703
4053
  return {
3704
4054
  columnsArray: columnsArray2,
@@ -3706,8 +4056,8 @@ var useColumnPointerEvents = ({
3706
4056
  columnWidth: column.computedWidth
3707
4057
  };
3708
4058
  }, [columns, columnId, column]);
3709
- let cursorRef = (0, import_react15.useRef)("auto");
3710
- const onPointerDown = (0, import_react15.useCallback)((e) => {
4059
+ let cursorRef = (0, import_react17.useRef)("auto");
4060
+ const onPointerDown = (0, import_react17.useCallback)((e) => {
3711
4061
  const target = domRef.current;
3712
4062
  cursorRef.current = target.style.cursor;
3713
4063
  didDragRef.current = false;
@@ -3770,7 +4120,7 @@ var useColumnPointerEvents = ({
3770
4120
  target.addEventListener("pointermove", onPointerMove);
3771
4121
  target.setPointerCapture(e.pointerId);
3772
4122
  }, [columns, column, columnIndex, columnsArray, computedRemainingSpace]);
3773
- const onPointerUp = (0, import_react15.useCallback)((e) => {
4123
+ const onPointerUp = (0, import_react17.useCallback)((e) => {
3774
4124
  const target = domRef.current;
3775
4125
  target.style.cursor = cursorRef.current;
3776
4126
  target.releasePointerCapture(e.pointerId);
@@ -3803,47 +4153,69 @@ var useColumnPointerEvents = ({
3803
4153
  };
3804
4154
  };
3805
4155
 
3806
- // src/components/InfiniteTable/hooks/useCellClassName.ts
3807
- function useCellClassName(column, baseClasses, variants, extraFlags) {
3808
- const result = [...baseClasses];
3809
- const variantObject = {
3810
- first: column.computedFirst,
3811
- last: column.computedLast,
3812
- groupByField: !!column.groupByField,
3813
- firstInCategory: column.computedFirstInCategory,
3814
- lastInCategory: column.computedLastInCategory,
3815
- pinned: column.computedPinned || false,
3816
- dragging: extraFlags.dragging,
3817
- zebra: extraFlags.zebra
4156
+ // src/components/InfiniteTable/utils/RenderHookComponent.tsx
4157
+ function RenderHookComponent(props) {
4158
+ var _a;
4159
+ return (_a = props.render(props.renderParam)) != null ? _a : null;
4160
+ }
4161
+
4162
+ // src/components/InfiniteTable/components/FilterEditors.tsx
4163
+ var import_react18 = __toModule(require("react"));
4164
+ function getFilterEditors() {
4165
+ return {
4166
+ string: StringFilterEditor,
4167
+ number: NumberFilterEditor
3818
4168
  };
3819
- const theVariant = variants(variantObject);
3820
- result.push(theVariant);
3821
- if (column.computedFirst) {
3822
- result.push(...baseClasses.map((c) => `${c}--first`));
3823
- }
3824
- if (column.groupByField) {
3825
- result.push(...baseClasses.map((c) => `${c}--group-column`));
3826
- }
3827
- if (column.computedLast) {
3828
- result.push(...baseClasses.map((c) => `${c}--last`));
3829
- }
3830
- if (column.computedFirstInCategory) {
3831
- result.push(...baseClasses.map((c) => `${c}--first-in-category`));
3832
- }
3833
- if (column.computedLastInCategory) {
3834
- result.push(...baseClasses.map((c) => `${c}--last-in-category`));
3835
- }
3836
- if (column.computedPinned) {
3837
- result.push(...baseClasses.map((c) => `${c}--pinned-${column.computedPinned}`));
3838
- } else {
3839
- result.push(...baseClasses.map((c) => `${c}--unpinned`));
3840
- }
3841
- return result.filter(Boolean).join(" ");
4169
+ }
4170
+ var defaultFilterEditors = getFilterEditors();
4171
+ function StringFilterEditor(props) {
4172
+ return /* @__PURE__ */ import_react18.default.createElement("input", {
4173
+ "aria-label": `Filter for ${props.ariaLabel}`,
4174
+ type: "text",
4175
+ value: props.filterValue,
4176
+ onChange: (event) => {
4177
+ props.onChange(event.target.value);
4178
+ },
4179
+ className: props.className
4180
+ });
4181
+ }
4182
+ function NumberFilterEditor(props) {
4183
+ return /* @__PURE__ */ import_react18.default.createElement("input", {
4184
+ "aria-label": `Filter for ${props.ariaLabel}`,
4185
+ type: "number",
4186
+ value: props.filterValue,
4187
+ onChange: (event) => {
4188
+ let value = event.target.value;
4189
+ if (!isNaN(value + "")) {
4190
+ value = value + "";
4191
+ }
4192
+ props.onChange(value);
4193
+ },
4194
+ className: props.className
4195
+ });
3842
4196
  }
3843
4197
 
3844
4198
  // src/components/InfiniteTable/components/icons/SortIcon.tsx
3845
- var React14 = __toModule(require("react"));
3846
- var import_react16 = __toModule(require("react"));
4199
+ var React17 = __toModule(require("react"));
4200
+ var import_react19 = __toModule(require("react"));
4201
+
4202
+ // src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts
4203
+ var import_createRuntimeFn = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
4204
+ var CellCls = "_1eexc2a5 _16lm1iwm _16lm1iw13 _16lm1iw14 _16lm1iw2 _16lm1iw1c _16lm1iw1d";
4205
+ var HeaderCellContentRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_12zfob117 _16lm1iwr _16lm1iwt _16lm1iwm _16lm1iw13 _16lm1iw14", variantClassNames: { filtered: { false: "_12zfob118", true: "_12zfob119" } }, defaultVariants: {}, compoundVariants: [] });
4206
+ var HeaderCellProxy = "_12zfob10";
4207
+ var HeaderCellRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_12zfob1h _16lm1iwn", variantClassNames: { rowActive: { false: "_12zfob1i", true: "_12zfob1j" }, zebra: { false: "_12zfob1k", even: "_12zfob1l", odd: "_12zfob1m" }, dragging: { true: "_12zfob1n", false: "_12zfob1o" }, first: { true: "_12zfob1p", false: "_12zfob1q" }, last: { true: "_12zfob1r", false: "_12zfob1s" }, groupByField: { true: "_12zfob1t", false: "_12zfob1u" }, firstInCategory: { true: "_12zfob1v", false: "_12zfob1w" }, lastInCategory: { true: "_12zfob1x", false: "_12zfob1y" }, pinned: { start: "_12zfob1z", end: "_12zfob110", false: "_12zfob111" }, filtered: { true: "_12zfob112", false: "_12zfob113" } }, defaultVariants: {}, compoundVariants: [[{ pinned: "start", lastInCategory: true }, "_12zfob114"], [{ pinned: "end", firstInCategory: true }, "_12zfob115"], [{ pinned: false, lastInCategory: true }, "_12zfob116"]] });
4208
+ var HeaderClsRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_12zfob17 _16lm1iwn _16lm1iw2", variantClassNames: { pinned: { start: "_12zfob18", end: "_12zfob19", false: "_12zfob1a" }, virtualized: { true: "_12zfob1b", false: "_12zfob1c" }, overflow: { true: "_12zfob1d", false: "_12zfob1e" } }, defaultVariants: {}, compoundVariants: [[{ overflow: true, pinned: "start" }, "_12zfob1f"], [{ overflow: true, pinned: "end" }, "_12zfob1g"]] });
4209
+ var HeaderFilterCls = "_12zfob11c _16lm1iwm _16lm1iw13 _16lm1iw14 _16lm1iw1";
4210
+ var HeaderFilterEditorCls = "_16lm1iwt _16lm1iwr";
4211
+ var HeaderGroupCls = "_12zfob11b _16lm1iwm _16lm1iw13 _16lm1iw14";
4212
+ var HeaderScrollbarPlaceholderCls = "_12zfob16 _16lm1iw2";
4213
+ var HeaderSortIconCls = "_16lm1iw1";
4214
+ var HeaderSortIconIndexCls = "_12zfob15";
4215
+ var HeaderSortIconRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "", variantClassNames: { align: { start: "_12zfob12", center: "_12zfob13", end: "_12zfob14" } }, defaultVariants: {}, compoundVariants: [] });
4216
+ var HeaderWrapperCls = "_12zfob11a _16lm1iw19 _16lm1iw1 _16lm1iwm _16lm1iw13";
4217
+
4218
+ // src/components/InfiniteTable/components/icons/SortIcon.tsx
3847
4219
  var defaultLineStyle = {
3848
4220
  marginTop: 2,
3849
4221
  marginBottom: 2,
@@ -3852,8 +4224,8 @@ var defaultLineStyle = {
3852
4224
  var InfiniteTableIconClassName = "InfiniteTableIcon";
3853
4225
  function SortIcon(props) {
3854
4226
  var _a;
3855
- const [rendered, setRendered] = (0, import_react16.useState)(true);
3856
- const [opacity, setOpacity] = (0, import_react16.useState)(0);
4227
+ const [rendered, setRendered] = (0, import_react19.useState)(true);
4228
+ const [opacity, setOpacity] = (0, import_react19.useState)(0);
3857
4229
  const { direction, lineWidth = 1, style, className, index } = props;
3858
4230
  const showIndex = index != null && index > 0;
3859
4231
  const size = (_a = props.size) != null ? _a : 16;
@@ -3867,16 +4239,21 @@ function SortIcon(props) {
3867
4239
  }), props.lineStyle), {
3868
4240
  opacity
3869
4241
  });
3870
- (0, import_react16.useEffect)(() => {
4242
+ (0, import_react19.useEffect)(() => {
3871
4243
  const newOpacity = direction != 0 ? 1 : 0;
3872
4244
  if (!rendered && newOpacity) {
3873
4245
  setRendered(true);
3874
4246
  }
3875
4247
  if (newOpacity !== opacity) {
3876
- requestAnimationFrame(() => {
4248
+ const rafId = requestAnimationFrame(() => {
3877
4249
  setOpacity(newOpacity);
3878
4250
  });
4251
+ return () => {
4252
+ cancelAnimationFrame(rafId);
4253
+ };
3879
4254
  }
4255
+ return () => {
4256
+ };
3880
4257
  }, [direction, rendered]);
3881
4258
  const onTransitionEnd = () => {
3882
4259
  const hidden = opacity === 0 && direction === 0;
@@ -3888,91 +4265,225 @@ function SortIcon(props) {
3888
4265
  if (!rendered) {
3889
4266
  return null;
3890
4267
  }
3891
- const indexStyle = {
3892
- position: "absolute",
3893
- transition: "top 0.2s",
3894
- top: 0,
3895
- right: 2
3896
- };
4268
+ const indexStyle = {};
3897
4269
  if (direction === -1) {
3898
4270
  indexStyle.top = "100%";
3899
4271
  }
3900
- return /* @__PURE__ */ React14.createElement("div", {
4272
+ return /* @__PURE__ */ React17.createElement("div", {
3901
4273
  style: __spreadProps(__spreadValues({}, style), { width: size }),
3902
4274
  className: join(className, InfiniteTableIconClassName, `${InfiniteTableIconClassName}-sort`)
3903
- }, showIndex ? /* @__PURE__ */ React14.createElement("div", {
4275
+ }, showIndex ? /* @__PURE__ */ React17.createElement("div", {
3904
4276
  "data-name": "index",
3905
- style: indexStyle
3906
- }, index) : null, /* @__PURE__ */ React14.createElement("div", {
4277
+ style: indexStyle,
4278
+ className: HeaderSortIconIndexCls
4279
+ }, index) : null, /* @__PURE__ */ React17.createElement("div", {
3907
4280
  style: __spreadValues({ width: sizes[0] }, lineStyle),
3908
4281
  onTransitionEnd
3909
- }), /* @__PURE__ */ React14.createElement("div", {
4282
+ }), /* @__PURE__ */ React17.createElement("div", {
3910
4283
  style: __spreadValues({ width: sizes[1] }, lineStyle)
3911
- }), /* @__PURE__ */ React14.createElement("div", {
4284
+ }), /* @__PURE__ */ React17.createElement("div", {
3912
4285
  style: __spreadValues({ width: sizes[2] }, lineStyle)
3913
4286
  }));
3914
4287
  }
3915
4288
 
3916
- // src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts
4289
+ // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
4290
+ var React18 = __toModule(require("react"));
4291
+
4292
+ // src/components/InfiniteTable/hooks/useInfiniteTableState.ts
4293
+ var import_react20 = __toModule(require("react"));
4294
+ var useInfiniteTableState = () => {
4295
+ const TableContext2 = getInfiniteTableContext();
4296
+ const { componentState } = (0, import_react20.useContext)(TableContext2);
4297
+ return componentState;
4298
+ };
4299
+
4300
+ // src/components/InfiniteTable/components/cell.css.ts
3917
4301
  var import_createRuntimeFn2 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
3918
- var CellCls = "_1eexc2a5 _16lm1iwl _16lm1iw12 _16lm1iw13 _16lm1iw2 _16lm1iw1b _16lm1iw1c";
3919
- var HeaderCellProxy = "_12zfob10";
3920
- var HeaderCellRecipe = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "_12zfob1d", variantClassNames: { zebra: { false: "_12zfob1e", even: "_12zfob1f", odd: "_12zfob1g" }, dragging: { true: "_12zfob1h", false: "_12zfob1i" }, first: { true: "_12zfob1j", false: "_12zfob1k" }, last: { true: "_12zfob1l", false: "_12zfob1m" }, groupByField: { true: "_12zfob1n", false: "_12zfob1o" }, firstInCategory: { true: "_12zfob1p", false: "_12zfob1q" }, lastInCategory: { true: "_12zfob1r", false: "_12zfob1s" }, pinned: { start: "_12zfob1t", end: "_12zfob1u", false: "_12zfob1v" } }, defaultVariants: {}, compoundVariants: [[{ pinned: "start", lastInCategory: true }, "_12zfob1w"], [{ pinned: "end", firstInCategory: true }, "_12zfob1x"], [{ pinned: false, lastInCategory: true }, "_12zfob1y"]] });
3921
- var HeaderClsRecipe = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "_12zfob13 _16lm1iw12 _16lm1iw2", variantClassNames: { pinned: { start: "_12zfob14", end: "_12zfob15", false: "_12zfob16" }, virtualized: { true: "_12zfob17", false: "_12zfob18" }, overflow: { true: "_12zfob19", false: "_12zfob1a" } }, defaultVariants: {}, compoundVariants: [[{ overflow: true, pinned: "start" }, "_12zfob1b"], [{ overflow: true, pinned: "end" }, "_12zfob1c"]] });
3922
- var HeaderGroupCls = "_12zfob110 _16lm1iwl _16lm1iw12 _16lm1iw13";
3923
- var HeaderScrollbarPlaceholderCls = "_12zfob12 _16lm1iw2";
3924
- var HeaderSortIconCls = "_12zfob11 _16lm1iw1";
3925
- var HeaderWrapperCls = "_12zfob1z _16lm1iw18 _16lm1iw1 _16lm1iwl _16lm1iw12";
4302
+ var CellClsVariants = { shifting: "_1eexc2a3", dragging: "_1eexc2a4" };
4303
+ var ColumnCellCls = "_1eexc2a5 _16lm1iwm _16lm1iw13 _16lm1iw14 _16lm1iw2 _16lm1iw1c _16lm1iw1d";
4304
+ var ColumnCellRecipe = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "_1eexc2a7", variantClassNames: { dragging: { false: "_1eexc2a8", true: "_1eexc2a9" }, rowActive: { false: "_1eexc2aa", true: "_1eexc2ab" }, zebra: { false: "_1eexc2ac", even: "_1eexc2ad", odd: "_1eexc2ae" }, first: { true: "_1eexc2af", false: "_1eexc2ag" }, last: { true: "_1eexc2ah", false: "_1eexc2ai" }, groupByField: { true: "_1eexc2aj", false: "_1eexc2ak" }, firstInCategory: { true: "_1eexc2al", false: "_1eexc2am" }, lastInCategory: { true: "_1eexc2an", false: "_1eexc2ao" }, pinned: { start: "_1eexc2ap", end: "_1eexc2aq", false: "_1eexc2ar" }, filtered: { true: "_1eexc2as", false: "_1eexc2at" } }, defaultVariants: {}, compoundVariants: [[{ pinned: "start", lastInCategory: true }, "_1eexc2au"], [{ pinned: "end", firstInCategory: true }, "_1eexc2av"]] });
3926
4305
 
3927
- // src/components/InfiniteTable/utils/RenderHookComponent.tsx
3928
- function RenderHookComponent(props) {
3929
- var _a;
3930
- return (_a = props.render(props.renderParam)) != null ? _a : null;
4306
+ // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
4307
+ var { rootClassName: rootClassName5 } = internalProps;
4308
+ var InfiniteTableCellClassName = `${rootClassName5}Cell`;
4309
+ var InfiniteTableCellContentClassName = `${rootClassName5}Cell_content`;
4310
+ function InfiniteTableCellFn(props) {
4311
+ var _b, _c, _d;
4312
+ const _a = props, {
4313
+ cssEllipsis = true,
4314
+ virtualized = true,
4315
+ skipColumnShifting = false,
4316
+ offsetProperty = "left",
4317
+ contentStyle,
4318
+ column,
4319
+ domRef,
4320
+ width,
4321
+ contentClassName,
4322
+ afterChildren,
4323
+ beforeChildren,
4324
+ offset,
4325
+ cellType,
4326
+ cssPosition: _cssPosition,
4327
+ renderChildren
4328
+ } = _a, domProps = __objRest(_a, [
4329
+ "cssEllipsis",
4330
+ "virtualized",
4331
+ "skipColumnShifting",
4332
+ "offsetProperty",
4333
+ "contentStyle",
4334
+ "column",
4335
+ "domRef",
4336
+ "width",
4337
+ "contentClassName",
4338
+ "afterChildren",
4339
+ "beforeChildren",
4340
+ "offset",
4341
+ "cellType",
4342
+ "cssPosition",
4343
+ "renderChildren"
4344
+ ]);
4345
+ const children = renderChildren();
4346
+ const { columnShifts } = useInfiniteTableState();
4347
+ const shifting = !!columnShifts;
4348
+ const style = __spreadValues({
4349
+ width
4350
+ }, domProps.style);
4351
+ if (!skipColumnShifting && columnShifts && columnShifts[column.computedVisibleIndex]) {
4352
+ const shiftLeft = columnShifts[column.computedVisibleIndex] + (offset != null ? offset : 0);
4353
+ if (virtualized) {
4354
+ style.left = shiftLeft;
4355
+ } else {
4356
+ style.transform = `translate3d(${shiftLeft}px, 0px, 0px)`;
4357
+ }
4358
+ }
4359
+ const finalDOMProps = __spreadProps(__spreadValues({}, domProps), {
4360
+ style,
4361
+ "data-column-id": column.id,
4362
+ className: join(domProps.className, justifyContent[(_b = column.align) != null ? _b : "start"], InfiniteTableCellClassName, ColumnCellCls, shifting ? `${InfiniteTableCellClassName}--shifting ${CellClsVariants.shifting}` : ""),
4363
+ children: /* @__PURE__ */ React18.createElement(React18.Fragment, null, beforeChildren, /* @__PURE__ */ React18.createElement("div", {
4364
+ className: join(InfiniteTableCellContentClassName, cssEllipsis ? cssEllipsisClassName : overflow.hidden, contentClassName),
4365
+ style: contentStyle
4366
+ }, children), afterChildren)
4367
+ });
4368
+ const RenderComponent = cellType === "body" ? (_c = column.components) == null ? void 0 : _c.ColumnCell : (_d = column.components) == null ? void 0 : _d.HeaderCell;
4369
+ if (RenderComponent) {
4370
+ return /* @__PURE__ */ React18.createElement(RenderComponent, __spreadValues({}, finalDOMProps));
4371
+ }
4372
+ return /* @__PURE__ */ React18.createElement("div", __spreadProps(__spreadValues({}, finalDOMProps), {
4373
+ ref: domRef
4374
+ }));
4375
+ }
4376
+ var InfiniteTableCell = React18.memo(InfiniteTableCellFn);
4377
+
4378
+ // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableColumnHeaderFilter.tsx
4379
+ var React19 = __toModule(require("react"));
4380
+ var import_react21 = __toModule(require("react"));
4381
+ var { rootClassName: rootClassName6 } = internalProps;
4382
+ var InfiniteTableColumnHeaderFilterClassName = `${rootClassName6}HeaderCell__filter`;
4383
+ var stopPropagation = (e) => e.stopPropagation();
4384
+ function InfiniteTableColumnHeaderFilter(props) {
4385
+ var _a, _b, _c, _d;
4386
+ const [theValue, setTheValue] = (0, import_react21.useState)((_b = (_a = props.columnFilterValue) == null ? void 0 : _a.filterValue) != null ? _b : "");
4387
+ const onInputChange = (filterValue) => {
4388
+ setTheValue(filterValue);
4389
+ props.onChange(filterValue);
4390
+ };
4391
+ (0, import_react21.useEffect)(() => {
4392
+ var _a2;
4393
+ if (props.columnFilterValue) {
4394
+ if (theValue !== props.columnFilterValue.filterValue) {
4395
+ setTheValue(props.columnFilterValue.filterValue);
4396
+ }
4397
+ } else {
4398
+ const currentFilterType = props.filterTypes[(_a2 = props.columnFilterType) != null ? _a2 : "string"];
4399
+ if (currentFilterType) {
4400
+ const emptyValue = [...currentFilterType.emptyValues][0];
4401
+ if (emptyValue !== theValue) {
4402
+ setTheValue(emptyValue);
4403
+ }
4404
+ }
4405
+ }
4406
+ }, [(_c = props.columnFilterValue) == null ? void 0 : _c.filterValue]);
4407
+ const filterType = props.columnFilterValue ? props.columnFilterValue.filterType : (_d = props.columnFilterType) != null ? _d : "string";
4408
+ const operator = props.columnFilterValue ? props.columnFilterValue.operator : props.filterTypes[filterType] ? props.filterTypes[filterType].defaultOperator : props.filterTypes.string.defaultOperator;
4409
+ const filterEditorProps = {
4410
+ ariaLabel: `Filter for ${props.columnLabel}`,
4411
+ filterValue: theValue,
4412
+ className: HeaderFilterEditorCls,
4413
+ operator,
4414
+ filterType,
4415
+ onChange: onInputChange
4416
+ };
4417
+ const FilterEditor = props.filterEditor;
4418
+ return /* @__PURE__ */ React19.createElement("div", {
4419
+ onPointerUp: stopPropagation,
4420
+ onPointerDown: stopPropagation,
4421
+ className: `${InfiniteTableColumnHeaderFilterClassName} ${HeaderFilterCls}`,
4422
+ style: { height: props.columnHeaderHeight }
4423
+ }, FilterEditor ? /* @__PURE__ */ React19.createElement(FilterEditor, __spreadValues({}, filterEditorProps)) : null);
4424
+ }
4425
+ function InfiniteTableColumnHeaderFilterEmpty() {
4426
+ return /* @__PURE__ */ React19.createElement("div", {
4427
+ onPointerUp: stopPropagation,
4428
+ onPointerDown: stopPropagation,
4429
+ className: `${InfiniteTableColumnHeaderFilterClassName} ${HeaderFilterCls}`,
4430
+ style: { height: "100%" }
4431
+ });
3931
4432
  }
3932
4433
 
3933
4434
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
3934
- var InfiniteTableHeaderCellContext = React15.createContext(null);
3935
- var { rootClassName: rootClassName4 } = internalProps;
3936
- var InfiniteTableHeaderCellClassName = `${rootClassName4}HeaderCell`;
4435
+ var InfiniteTableHeaderCellContext = React20.createContext(null);
4436
+ var { rootClassName: rootClassName7 } = internalProps;
4437
+ var InfiniteTableHeaderCellClassName = `${rootClassName7}HeaderCell`;
3937
4438
  function InfiniteTableHeaderCell(props) {
3938
- var _a, _b, _c, _d;
4439
+ var _a, _b, _c, _d, _e;
3939
4440
  const column = props.column;
3940
4441
  const columns = props.columns;
3941
- const { onResize, height, width } = props;
4442
+ const { onResize, height, width, headerOptions } = props;
3942
4443
  const sortInfo = column.computedSortInfo;
3943
4444
  let header = column.header;
3944
- const ref = (0, import_react17.useCallback)((node) => {
4445
+ const ref = (0, import_react22.useCallback)((node) => {
3945
4446
  var _a2;
3946
4447
  domRef.current = node;
3947
4448
  (_a2 = props.domRef) == null ? void 0 : _a2.call(props, node);
3948
4449
  }, [props.domRef]);
3949
- const sortTool = /* @__PURE__ */ React15.createElement(SortIcon, {
4450
+ const alwaysShow = headerOptions.alwaysReserveSpaceForSortIcon;
4451
+ const sortTool = column.computedSorted || alwaysShow ? /* @__PURE__ */ React20.createElement(SortIcon, {
3950
4452
  index: column.computedMultiSort ? column.computedSortIndex + 1 : void 0,
3951
- className: `${InfiniteTableHeaderCellClassName}__sort-icon ${HeaderSortIconCls}`,
4453
+ className: `${InfiniteTableHeaderCellClassName}__sort-icon ${HeaderSortIconCls} ${HeaderSortIconRecipe({
4454
+ align: column.align || "start"
4455
+ })}`,
3952
4456
  direction: column.computedSorted ? column.computedSortedAsc ? 1 : -1 : 0
3953
- });
4457
+ }) : null;
3954
4458
  const renderParam = {
3955
4459
  domRef: ref,
3956
4460
  column,
3957
4461
  columnSortInfo: sortInfo,
4462
+ columnFilterValue: column.computedFilterValue,
3958
4463
  sortTool
3959
4464
  };
4465
+ const align = column.align || "start";
3960
4466
  const renderChildren = () => {
3961
4467
  if (header instanceof Function) {
3962
- header = /* @__PURE__ */ React15.createElement(RenderHookComponent, {
4468
+ header = /* @__PURE__ */ React20.createElement(RenderHookComponent, {
3963
4469
  render: header,
3964
4470
  renderParam
3965
4471
  });
3966
4472
  }
3967
4473
  header = header != null ? header : column.name;
3968
- return header;
4474
+ return /* @__PURE__ */ React20.createElement(React20.Fragment, null, align === "end" ? sortTool : null, header, align !== "end" ? sortTool : null);
3969
4475
  };
3970
- const domRef = (0, import_react17.useRef)(null);
4476
+ const domRef = (0, import_react22.useRef)(null);
3971
4477
  const {
3972
- computed: { computedRemainingSpace },
3973
- componentState: { portalDOMRef }
4478
+ computed: { computedRemainingSpace, showColumnFilters },
4479
+ componentState: { portalDOMRef, columnHeaderHeight, filterEditors }
3974
4480
  } = useInfiniteTable();
3975
- (0, import_react17.useEffect)(() => {
4481
+ const {
4482
+ componentActions: dataSourceActions,
4483
+ getState: getDataSourceState,
4484
+ componentState: { filterDelay, filterTypes }
4485
+ } = useDataSourceContextValue();
4486
+ (0, import_react22.useEffect)(() => {
3976
4487
  let clearOnResize = null;
3977
4488
  const node = domRef.current;
3978
4489
  if (onResize && node) {
@@ -3993,7 +4504,7 @@ function InfiniteTableHeaderCell(props) {
3993
4504
  });
3994
4505
  let draggingProxy = null;
3995
4506
  if (dragging) {
3996
- draggingProxy = /* @__PURE__ */ React15.createElement("div", {
4507
+ draggingProxy = /* @__PURE__ */ React20.createElement("div", {
3997
4508
  className: `${InfiniteTableHeaderCellClassName}Proxy ${HeaderCellProxy}`,
3998
4509
  style: {
3999
4510
  position: "absolute",
@@ -4007,9 +4518,73 @@ function InfiniteTableHeaderCell(props) {
4007
4518
  draggingProxy = (0, import_react_dom.createPortal)(draggingProxy, portalDOMRef.current);
4008
4519
  }
4009
4520
  const ContextProvider = InfiniteTableHeaderCellContext.Provider;
4010
- return /* @__PURE__ */ React15.createElement(ContextProvider, {
4521
+ const contentRecipeVariants = {
4522
+ filtered: column.computedFiltered
4523
+ };
4524
+ const setFilterValue = (0, import_react22.useCallback)((filterValue) => {
4525
+ var _a2;
4526
+ const state = getDataSourceState();
4527
+ let newFilterValue = (_a2 = state.filterValue) != null ? _a2 : [];
4528
+ let found = false;
4529
+ newFilterValue = newFilterValue.map((currentFilterValue) => {
4530
+ if (filterValue.id && currentFilterValue.id === filterValue.id || filterValue.field && currentFilterValue.field === column.field) {
4531
+ found = true;
4532
+ return filterValue;
4533
+ }
4534
+ return currentFilterValue;
4535
+ });
4536
+ if (!found) {
4537
+ newFilterValue.push(filterValue);
4538
+ }
4539
+ newFilterValue = newFilterValue.filter((filterValue2) => {
4540
+ const filterType2 = filterTypes[filterValue2.filterType];
4541
+ if (!filterType2 || filterType2.emptyValues.has(filterValue2.filterValue)) {
4542
+ return false;
4543
+ }
4544
+ return true;
4545
+ });
4546
+ dataSourceActions.filterValue = newFilterValue;
4547
+ }, [column, filterTypes]);
4548
+ const debouncedOnFilterValueChange = React20.useMemo(() => {
4549
+ const fn = (filterValue) => {
4550
+ let newFilterValueForColumn;
4551
+ if (column.computedFilterValue) {
4552
+ newFilterValueForColumn = __spreadValues({}, column.computedFilterValue);
4553
+ } else {
4554
+ const filterType2 = column.computedFilterType;
4555
+ const filterValueForColumn = {
4556
+ filterType: filterType2,
4557
+ operator: filterTypes[filterType2].defaultOperator,
4558
+ filterValue,
4559
+ valueGetter: column.valueGetter
4560
+ };
4561
+ if (column.field) {
4562
+ filterValueForColumn.field = column.field;
4563
+ } else {
4564
+ filterValueForColumn.id = column.id;
4565
+ }
4566
+ newFilterValueForColumn = filterValueForColumn;
4567
+ }
4568
+ newFilterValueForColumn.filterValue = filterValue;
4569
+ setFilterValue(newFilterValueForColumn);
4570
+ };
4571
+ if (filterDelay > 0) {
4572
+ return debounce(fn, { wait: filterDelay });
4573
+ }
4574
+ return fn;
4575
+ }, [
4576
+ filterDelay,
4577
+ setFilterValue,
4578
+ column.computedFilterValue,
4579
+ column.id,
4580
+ column.field,
4581
+ column.computedFilterType
4582
+ ]);
4583
+ const filterType = column.computedFilterType;
4584
+ const FilterEditor = filterEditors[filterType] || defaultFilterEditors[filterType] || StringFilterEditor;
4585
+ return /* @__PURE__ */ React20.createElement(ContextProvider, {
4011
4586
  value: renderParam
4012
- }, /* @__PURE__ */ React15.createElement(InfiniteTableCell, {
4587
+ }, /* @__PURE__ */ React20.createElement(InfiniteTableCell, {
4013
4588
  domRef: ref,
4014
4589
  cellType: "header",
4015
4590
  column,
@@ -4019,19 +4594,29 @@ function InfiniteTableHeaderCell(props) {
4019
4594
  width,
4020
4595
  onPointerDown,
4021
4596
  onPointerUp,
4022
- className: join(InfiniteTableHeaderCellClassName, userSelect.none, column.computedSortable ? cursor.pointer : "", useCellClassName(column, [InfiniteTableHeaderCellClassName, InfiniteTableCellClassName], HeaderCellRecipe, { dragging, zebra: false }), CellCls),
4023
- cssEllipsis: (_d = (_c = column.headerCssEllipsis) != null ? _c : column.cssEllipsis) != null ? _d : true,
4024
- afterChildren: sortTool,
4597
+ contentClassName: join(HeaderCellContentRecipe(contentRecipeVariants), justifyContent[(_c = column.align) != null ? _c : "start"]),
4598
+ contentStyle: showColumnFilters ? { height: height / 2 } : void 0,
4599
+ className: join(InfiniteTableHeaderCellClassName, userSelect.none, column.computedSortable ? cursor.pointer : "", useCellClassName(column, [InfiniteTableHeaderCellClassName, InfiniteTableCellClassName], HeaderCellRecipe, { dragging, zebra: false, rowActive: false }), CellCls),
4600
+ cssEllipsis: (_e = (_d = column.headerCssEllipsis) != null ? _d : column.cssEllipsis) != null ? _e : true,
4601
+ afterChildren: showColumnFilters ? column.computedFilterable ? /* @__PURE__ */ React20.createElement(InfiniteTableColumnHeaderFilter, {
4602
+ filterEditor: FilterEditor,
4603
+ filterTypes,
4604
+ onChange: debouncedOnFilterValueChange,
4605
+ columnFilterType: filterType,
4606
+ columnLabel: column.field || column.name || column.id,
4607
+ columnFilterValue: column.computedFilterValue,
4608
+ columnHeaderHeight
4609
+ }) : /* @__PURE__ */ React20.createElement(InfiniteTableColumnHeaderFilterEmpty, null) : null,
4025
4610
  renderChildren
4026
4611
  }), draggingProxy);
4027
4612
  }
4028
4613
  function useInfiniteHeaderCell() {
4029
- const result = (0, import_react17.useContext)(InfiniteTableHeaderCellContext);
4614
+ const result = (0, import_react22.useContext)(InfiniteTableHeaderCellContext);
4030
4615
  return result;
4031
4616
  }
4032
4617
 
4033
4618
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx
4034
- var React18 = __toModule(require("react"));
4619
+ var React23 = __toModule(require("react"));
4035
4620
 
4036
4621
  // src/components/utils/getScrollbarWidth.ts
4037
4622
  var scrollbarWidth;
@@ -4153,11 +4738,11 @@ function assignGroupOffsetsAndComputedWidths(items, groupOffset = 0) {
4153
4738
  }
4154
4739
 
4155
4740
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
4156
- var React17 = __toModule(require("react"));
4157
- var import_react18 = __toModule(require("react"));
4741
+ var React22 = __toModule(require("react"));
4742
+ var import_react23 = __toModule(require("react"));
4158
4743
 
4159
4744
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderGroup.tsx
4160
- var React16 = __toModule(require("react"));
4745
+ var React21 = __toModule(require("react"));
4161
4746
  var TableHeaderGroupClassName = `${rootClassName2}HeaderGroup`;
4162
4747
  function InfiniteTableHeaderGroup(props) {
4163
4748
  const { columnGroup, height, width } = props;
@@ -4167,35 +4752,35 @@ function InfiniteTableHeaderGroup(props) {
4167
4752
  columnGroup
4168
4753
  });
4169
4754
  }
4170
- return /* @__PURE__ */ React16.createElement("div", {
4755
+ return /* @__PURE__ */ React21.createElement("div", {
4171
4756
  ref: props.domRef,
4172
4757
  "data-group-id": columnGroup.uniqueGroupId,
4173
4758
  className: join(HeaderGroupCls, TableHeaderGroupClassName),
4174
4759
  style: { width, height }
4175
- }, /* @__PURE__ */ React16.createElement("div", {
4760
+ }, /* @__PURE__ */ React21.createElement("div", {
4176
4761
  className: join(`${TableHeaderGroupClassName}__header-content`, cssEllipsisClassName)
4177
4762
  }, header));
4178
4763
  }
4179
4764
 
4180
4765
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
4181
- var { rootClassName: rootClassName5 } = internalProps;
4182
- var TableHeaderClassName = `${rootClassName5}Header`;
4766
+ var { rootClassName: rootClassName8 } = internalProps;
4767
+ var TableHeaderClassName = `${rootClassName8}Header`;
4183
4768
  function InfiniteTableHeaderFn(props) {
4184
4769
  const {
4185
4770
  brain,
4186
4771
  columns,
4187
4772
  style,
4188
4773
  className,
4189
- headerHeight,
4774
+ columnHeaderHeight,
4190
4775
  columnAndGroupTreeInfo,
4191
4776
  columnGroupsMaxDepth
4192
4777
  } = props;
4193
4778
  const {
4194
4779
  computed,
4195
- componentState: { headerBrain }
4780
+ componentState: { headerBrain, headerOptions }
4196
4781
  } = useInfiniteTable();
4197
- const { computedVisibleColumnsMap } = computed;
4198
- (0, import_react18.useEffect)(() => {
4782
+ const { computedVisibleColumnsMap, showColumnFilters } = computed;
4783
+ (0, import_react23.useEffect)(() => {
4199
4784
  const onScroll = (scrollPosition) => {
4200
4785
  if (domRef.current) {
4201
4786
  domRef.current.style.transform = `translate3d(-${scrollPosition.scrollLeft}px, 0px, 0px)`;
@@ -4204,7 +4789,7 @@ function InfiniteTableHeaderFn(props) {
4204
4789
  const removeOnScroll = brain.onScroll(onScroll);
4205
4790
  return removeOnScroll;
4206
4791
  }, [brain]);
4207
- const domRef = (0, import_react18.useRef)(null);
4792
+ const domRef = (0, import_react23.useRef)(null);
4208
4793
  const headerCls = HeaderClsRecipe({
4209
4794
  overflow: false,
4210
4795
  virtualized: true
@@ -4212,9 +4797,9 @@ function InfiniteTableHeaderFn(props) {
4212
4797
  const domProps = {
4213
4798
  ref: domRef,
4214
4799
  className: join(TableHeaderClassName, `${TableHeaderClassName}--virtualized`, className, headerCls),
4215
- style: __spreadProps(__spreadValues({}, style), { height: headerHeight })
4800
+ style: __spreadProps(__spreadValues({}, style), { height: columnHeaderHeight })
4216
4801
  };
4217
- const renderCell = (0, import_react18.useCallback)((params) => {
4802
+ const renderCell = (0, import_react23.useCallback)((params) => {
4218
4803
  const {
4219
4804
  rowIndex,
4220
4805
  colIndex,
@@ -4239,7 +4824,7 @@ function InfiniteTableHeaderFn(props) {
4239
4824
  computedWidth: colGroupItem.computedWidth,
4240
4825
  groupOffset: colGroupItem.groupOffset
4241
4826
  });
4242
- return /* @__PURE__ */ React17.createElement(InfiniteTableHeaderGroup, {
4827
+ return /* @__PURE__ */ React22.createElement(InfiniteTableHeaderGroup, {
4243
4828
  domRef: domRef2,
4244
4829
  columns: columns2,
4245
4830
  width: widthWithColspan,
@@ -4247,21 +4832,29 @@ function InfiniteTableHeaderFn(props) {
4247
4832
  columnGroup: computedColumnGroup
4248
4833
  });
4249
4834
  }
4250
- return /* @__PURE__ */ React17.createElement(InfiniteTableHeaderCell, {
4835
+ return /* @__PURE__ */ React22.createElement(InfiniteTableHeaderCell, {
4251
4836
  domRef: domRef2,
4252
4837
  column,
4838
+ headerOptions,
4253
4839
  width: widthWithColspan,
4254
4840
  height: heightWithRowspan,
4255
4841
  columns: computedVisibleColumnsMap
4256
4842
  });
4257
- }, [columns, headerHeight, columnAndGroupTreeInfo, columnGroupsMaxDepth]);
4258
- return /* @__PURE__ */ React17.createElement("div", __spreadValues({}, domProps), /* @__PURE__ */ React17.createElement(RawTable, {
4843
+ }, [
4844
+ headerOptions,
4845
+ columns,
4846
+ columnHeaderHeight,
4847
+ columnAndGroupTreeInfo,
4848
+ columnGroupsMaxDepth,
4849
+ showColumnFilters
4850
+ ]);
4851
+ return /* @__PURE__ */ React22.createElement("div", __spreadValues({}, domProps), /* @__PURE__ */ React22.createElement(RawTable, {
4259
4852
  renderCell,
4260
4853
  brain: headerBrain,
4261
4854
  cellHoverClassNames: []
4262
4855
  }));
4263
4856
  }
4264
- var InfiniteTableHeader = React17.memo(InfiniteTableHeaderFn);
4857
+ var InfiniteTableHeader = React22.memo(InfiniteTableHeaderFn);
4265
4858
 
4266
4859
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx
4267
4860
  function TableHeaderWrapper(props) {
@@ -4271,25 +4864,26 @@ function TableHeaderWrapper(props) {
4271
4864
  computedPinnedStartColumns,
4272
4865
  computedPinnedEndColumns,
4273
4866
  computedVisibleColumns,
4274
- columnSize
4867
+ columnSize,
4868
+ showColumnFilters
4275
4869
  } = tableContextValue.computed;
4276
4870
  const {
4277
4871
  componentState: {
4278
- headerHeight,
4872
+ columnHeaderHeight,
4279
4873
  columnGroupsDepthsMap,
4280
4874
  columnGroupsMaxDepth,
4281
4875
  computedColumnGroups
4282
4876
  }
4283
4877
  } = tableContextValue;
4284
4878
  const rows = !computedColumnGroups || !computedColumnGroups.size ? 1 : columnGroupsMaxDepth + 2;
4285
- const height = rows * headerHeight;
4286
- const columnAndGroupTreeInfo = React18.useMemo(() => {
4879
+ const height = rows * columnHeaderHeight + (showColumnFilters ? columnHeaderHeight : 0);
4880
+ const columnAndGroupTreeInfo = React23.useMemo(() => {
4287
4881
  if (!computedColumnGroups || !computedColumnGroups.size) {
4288
4882
  return void 0;
4289
4883
  }
4290
4884
  return buildColumnAndGroupTree(computedVisibleColumns, computedColumnGroups, columnGroupsDepthsMap, columnGroupsMaxDepth);
4291
4885
  }, [computedVisibleColumns, computedColumnGroups, columnGroupsDepthsMap]);
4292
- const cellspan = React18.useCallback(({ rowIndex, colIndex }) => {
4886
+ const cellspan = React23.useCallback(({ rowIndex, colIndex }) => {
4293
4887
  const column = computedVisibleColumns[colIndex];
4294
4888
  const rowspan2 = 1;
4295
4889
  const colspan2 = 1;
@@ -4322,11 +4916,14 @@ function TableHeaderWrapper(props) {
4322
4916
  rows,
4323
4917
  columnGroupsDepthsMap
4324
4918
  ]);
4325
- const rowspan = React18.useCallback(({ rowIndex, colIndex }) => cellspan({ rowIndex, colIndex }).rowspan, [cellspan]);
4326
- const colspan = React18.useCallback(({ rowIndex, colIndex }) => cellspan({ rowIndex, colIndex }).colspan, [cellspan]);
4919
+ const rowspan = React23.useCallback(({ rowIndex, colIndex }) => cellspan({ rowIndex, colIndex }).rowspan, [cellspan]);
4920
+ const colspan = React23.useCallback(({ rowIndex, colIndex }) => cellspan({ rowIndex, colIndex }).colspan, [cellspan]);
4921
+ const rowHeight = React23.useCallback((index) => {
4922
+ return showColumnFilters ? index < rows - 1 ? columnHeaderHeight : 2 * columnHeaderHeight : columnHeaderHeight;
4923
+ }, [rows, showColumnFilters, columnHeaderHeight]);
4327
4924
  useMatrixBrain(brain, {
4328
4925
  colWidth: columnSize,
4329
- rowHeight: headerHeight,
4926
+ rowHeight,
4330
4927
  rows,
4331
4928
  cols: computedVisibleColumns.length,
4332
4929
  height,
@@ -4336,21 +4933,21 @@ function TableHeaderWrapper(props) {
4336
4933
  fixedColsEnd: computedPinnedEndColumns.length,
4337
4934
  fixedColsStart: computedPinnedStartColumns.length
4338
4935
  });
4339
- const header = /* @__PURE__ */ React18.createElement(InfiniteTableHeader, {
4936
+ const header = /* @__PURE__ */ React23.createElement(InfiniteTableHeader, {
4340
4937
  columns: computedVisibleColumns,
4341
4938
  brain,
4342
- headerHeight: height,
4939
+ columnHeaderHeight: height,
4343
4940
  columnGroupsMaxDepth,
4344
4941
  columnAndGroupTreeInfo
4345
4942
  });
4346
- const verticalScrollbarPlaceholder = scrollbars.vertical && getScrollbarWidth() ? /* @__PURE__ */ React18.createElement("div", {
4943
+ const verticalScrollbarPlaceholder = scrollbars.vertical && getScrollbarWidth() ? /* @__PURE__ */ React23.createElement("div", {
4347
4944
  className: HeaderScrollbarPlaceholderCls,
4348
4945
  style: {
4349
4946
  zIndex: 1e3,
4350
4947
  width: getScrollbarWidth()
4351
4948
  }
4352
4949
  }) : null;
4353
- return /* @__PURE__ */ React18.createElement("div", {
4950
+ return /* @__PURE__ */ React23.createElement("div", {
4354
4951
  className: HeaderWrapperCls,
4355
4952
  style: {
4356
4953
  height
@@ -4359,8 +4956,8 @@ function TableHeaderWrapper(props) {
4359
4956
  }
4360
4957
 
4361
4958
  // src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
4362
- var React19 = __toModule(require("react"));
4363
- var import_react19 = __toModule(require("react"));
4959
+ var React24 = __toModule(require("react"));
4960
+ var import_react24 = __toModule(require("react"));
4364
4961
 
4365
4962
  // src/components/utils/decamelize.ts
4366
4963
  function decamelize(str, options) {
@@ -4369,14 +4966,14 @@ function decamelize(str, options) {
4369
4966
  }
4370
4967
 
4371
4968
  // src/components/InfiniteTable/theme.css.ts
4372
- var ThemeVars = { color: { accent: "var(--infinite-accent-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)", height: "var(--infinite-header-height)" }, HeaderCell: { draggingBackground: "var(--infinite-header-cell-dragging-background)", background: "var(--infinite-header-cell-background)", padding: "var(--infinite-header-cell-padding)", iconSize: "var(--infinite-header-cell-icon-size)" }, 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)", color: "var(--infinite-cell-color)" }, Row: { background: "var(--infinite-row-background)", oddBackground: "var(--infinite-row-odd-background)", 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)" } } };
4969
+ var ThemeVars = { color: { accent: "var(--infinite-accent-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: { draggingBackground: "var(--infinite-header-cell-dragging-background)", background: "var(--infinite-header-cell-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)" }, 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)", 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)", activeBorderColor: "var(--infinite-active-cell-border-color)", activeBackgroundFromBorder: "var(--infinite-active-cell-background-from-border)", activeBackground: "var(--infinite-active-cell-background)", 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)", activeBorderColor: "var(--infinite-active-row-border-color)", activeBackground: "var(--infinite-active-row-background)", activeBackgroundFromBorder: "var(--infinite-active-row-background-from-border)", activeBorderWidth: "var(--infinite-active-row-border-width)", activeBorderStyle: "var(--infinite-active-row-border-style)", activeBorder: "var(--infinite-active-row-border)", 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)" } } };
4373
4970
 
4374
4971
  // src/components/InfiniteTable/InfiniteCls.css.ts
4375
4972
  var import_createRuntimeFn3 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
4376
4973
  var FooterCls = "_16lm1iw1";
4377
- var InfiniteCls = "_1yeub2v0 _16lm1iw1 _16lm1iwl _16lm1iw11 _16lm1iw0";
4974
+ var InfiniteCls = "_1yeub2v0 _16lm1iw1 _16lm1iwm _16lm1iw12 _16lm1iw0";
4378
4975
  var InfiniteClsRecipe = (0, import_createRuntimeFn3.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: [] });
4379
- var InfiniteClsShiftingColumns = "_16lm1iwo";
4976
+ var InfiniteClsShiftingColumns = "_16lm1iwp";
4380
4977
  var PinnedRowsContainerClsVariants = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "", variantClassNames: { pinned: { start: "_1yeub2vh", end: "_1yeub2vi", false: "_1yeub2vj" } }, defaultVariants: {}, compoundVariants: [] });
4381
4978
 
4382
4979
  // src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
@@ -4406,10 +5003,10 @@ var enforceStyle = (node, style) => {
4406
5003
  node.style.setProperty(decamelize(propertyName), propertyValue, "important");
4407
5004
  }
4408
5005
  };
4409
- var InfiniteTableLicenseFooter = React19.forwardRef(function InfiniteTableLicenseFooter2(props, ref) {
4410
- const { rootClassName: rootClassName8 } = useInternalProps();
4411
- const domRef = React19.useRef(null);
4412
- const domCallback = React19.useCallback((node) => {
5006
+ var InfiniteTableLicenseFooter = React24.forwardRef(function InfiniteTableLicenseFooter2(props, ref) {
5007
+ const { rootClassName: rootClassName11 } = useInternalProps();
5008
+ const domRef = React24.useRef(null);
5009
+ const domCallback = React24.useCallback((node) => {
4413
5010
  domRef.current = node;
4414
5011
  if (!ref) {
4415
5012
  return;
@@ -4420,7 +5017,7 @@ var InfiniteTableLicenseFooter = React19.forwardRef(function InfiniteTableLicens
4420
5017
  ref.current = node;
4421
5018
  }
4422
5019
  }, []);
4423
- (0, import_react19.useEffect)(() => {
5020
+ (0, import_react24.useEffect)(() => {
4424
5021
  const forceStyle = () => {
4425
5022
  requestAnimationFrame(() => {
4426
5023
  var _a;
@@ -4434,12 +5031,12 @@ var InfiniteTableLicenseFooter = React19.forwardRef(function InfiniteTableLicens
4434
5031
  clearInterval(intervalId);
4435
5032
  };
4436
5033
  }, []);
4437
- return /* @__PURE__ */ React19.createElement("div", __spreadProps(__spreadValues({
5034
+ return /* @__PURE__ */ React24.createElement("div", __spreadProps(__spreadValues({
4438
5035
  ref: domCallback
4439
5036
  }, props), {
4440
- className: join(`${rootClassName8}-Footer`, FooterCls, props.className),
5037
+ className: join(`${rootClassName11}-Footer`, FooterCls, props.className),
4441
5038
  style: defaultStyle
4442
- }), "Powered by", " ", /* @__PURE__ */ React19.createElement("a", {
5039
+ }), "Powered by", " ", /* @__PURE__ */ React24.createElement("a", {
4443
5040
  href: "https://infinite-table.com",
4444
5041
  rel: "noopener noreferrer",
4445
5042
  role: "link",
@@ -4448,11 +5045,11 @@ var InfiniteTableLicenseFooter = React19.forwardRef(function InfiniteTableLicens
4448
5045
  });
4449
5046
 
4450
5047
  // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableColumnCell.tsx
4451
- var React20 = __toModule(require("react"));
4452
- var import_react20 = __toModule(require("react"));
4453
- var { rootClassName: rootClassName6 } = internalProps;
4454
- var InfiniteTableColumnCellContext = React20.createContext(null);
4455
- var InfiniteTableColumnCellClassName = `${rootClassName6}ColumnCell`;
5048
+ var React25 = __toModule(require("react"));
5049
+ var import_react25 = __toModule(require("react"));
5050
+ var { rootClassName: rootClassName9 } = internalProps;
5051
+ var InfiniteTableColumnCellContext = React25.createContext(null);
5052
+ var InfiniteTableColumnCellClassName = `${rootClassName9}ColumnCell`;
4456
5053
  function isColumnWithField(c) {
4457
5054
  return typeof c.field === "string";
4458
5055
  }
@@ -4476,7 +5073,7 @@ function InfiniteTableColumnCellFn(props) {
4476
5073
  showZebraRows
4477
5074
  } = props;
4478
5075
  if (!column) {
4479
- return /* @__PURE__ */ React20.createElement("div", {
5076
+ return /* @__PURE__ */ React25.createElement("div", {
4480
5077
  ref: domRef
4481
5078
  }, "no column");
4482
5079
  }
@@ -4485,33 +5082,62 @@ function InfiniteTableColumnCellFn(props) {
4485
5082
  const groupRowInfo = null;
4486
5083
  let value = isGroupRow && groupBy && column.groupByField ? rowInfo.value : isColumnWithField(column) ? data == null ? void 0 : data[column.field] : null;
4487
5084
  if (column.valueGetter) {
4488
- value = column.valueGetter(isGroupRow ? {
5085
+ if (!rowInfo.isGroupRow && rowInfo.data) {
5086
+ value = column.valueGetter({ data: rowInfo.data, field: column.field });
5087
+ }
5088
+ }
5089
+ if (column.valueFormatter) {
5090
+ value = column.valueFormatter(isGroupRow ? {
4489
5091
  data: rowInfo.data,
4490
5092
  isGroupRow,
4491
- rowInfo
5093
+ rowInfo,
5094
+ field: column.field,
5095
+ value
4492
5096
  } : {
4493
5097
  data: rowInfo.data,
4494
5098
  isGroupRow,
4495
- rowInfo
5099
+ rowInfo,
5100
+ field: column.field,
5101
+ value
4496
5102
  });
4497
5103
  }
5104
+ const { getState, componentActions } = useInfiniteTable();
5105
+ const { activeRowIndex } = getState();
5106
+ const rowActive = rowIndex === activeRowIndex;
5107
+ const onClick = (0, import_react25.useCallback)(() => {
5108
+ const { activeRowIndex: activeRowIndex2, activeCellIndex } = getState();
5109
+ if (activeRowIndex2 != null) {
5110
+ componentActions.activeRowIndex = rowIndex;
5111
+ return;
5112
+ }
5113
+ if (activeCellIndex != null) {
5114
+ componentActions.activeCellIndex = [
5115
+ rowIndex,
5116
+ column.computedVisibleIndex
5117
+ ];
5118
+ }
5119
+ }, [rowIndex, column.computedVisibleIndex]);
4498
5120
  const { componentState: computedDataSource } = useDataSourceContextValue();
4499
5121
  const rest = rowInfo.isGroupRow ? {
4500
5122
  rowInfo,
4501
5123
  isGroupRow: rowInfo.isGroupRow,
4502
- data: rowInfo.data
5124
+ data: rowInfo.data,
5125
+ rowActive,
5126
+ value,
5127
+ field: column.field
4503
5128
  } : {
4504
5129
  rowInfo,
4505
5130
  isGroupRow: rowInfo.isGroupRow,
4506
- data: rowInfo.data
5131
+ data: rowInfo.data,
5132
+ rowActive,
5133
+ value,
5134
+ field: column.field
4507
5135
  };
4508
5136
  const stylingRenderParam = __spreadValues({
4509
- value,
4510
5137
  column
4511
5138
  }, rest);
4512
5139
  const renderValue = value;
4513
5140
  const renderParam = __spreadProps(__spreadValues({
4514
- value,
4515
5141
  column,
4516
5142
  domRef,
4517
5143
  groupRowInfo
@@ -4519,28 +5145,28 @@ function InfiniteTableColumnCellFn(props) {
4519
5145
  isGroupRow,
4520
5146
  rowIndex,
4521
5147
  toggleGroupRow,
4522
- toggleCurrentGroupRow: () => {
5148
+ toggleCurrentGroupRow: (0, import_react25.useCallback)(() => {
4523
5149
  if (!rowInfo.isGroupRow) {
4524
5150
  return;
4525
5151
  }
4526
5152
  toggleGroupRow(rowInfo.groupKeys);
4527
- },
5153
+ }, []),
4528
5154
  groupBy: computedDataSource.groupBy,
4529
5155
  pivotBy: computedDataSource.pivotBy
4530
5156
  });
4531
- const renderChildren = () => {
5157
+ const renderChildren = (0, import_react25.useCallback)(() => {
4532
5158
  if (hidden) {
4533
5159
  return null;
4534
5160
  }
4535
5161
  const renderFn = column.render || column.renderValue;
4536
5162
  if (renderFn) {
4537
- return /* @__PURE__ */ React20.createElement(RenderHookComponent, {
5163
+ return /* @__PURE__ */ React25.createElement(RenderHookComponent, {
4538
5164
  render: renderFn,
4539
5165
  renderParam
4540
5166
  });
4541
5167
  }
4542
5168
  return renderValue;
4543
- };
5169
+ }, [column, hidden, ...Object.values(renderParam)]);
4544
5170
  const rowPropsAndStyleArgs = __spreadProps(__spreadValues({}, rest), {
4545
5171
  rowIndex
4546
5172
  });
@@ -4553,6 +5179,7 @@ function InfiniteTableColumnCellFn(props) {
4553
5179
  style = column.style ? typeof column.style === "function" ? __spreadValues(__spreadValues({}, style), column.style(stylingRenderParam) || {}) : __spreadValues(__spreadValues({}, style), column.style) : style || {};
4554
5180
  style.width = width;
4555
5181
  style.height = rowHeight;
5182
+ const memoizedStyle = (0, import_react25.useMemo)(() => style, [!style ? null : JSON.stringify(style)]);
4556
5183
  const odd = (rowInfo.indexInAll != null ? rowInfo.indexInAll : rowIndex) % 2 === 1;
4557
5184
  const zebra = showZebraRows ? odd ? "odd" : "even" : false;
4558
5185
  const cellProps = {
@@ -4562,21 +5189,22 @@ function InfiniteTableColumnCellFn(props) {
4562
5189
  column,
4563
5190
  width,
4564
5191
  offset: virtualized ? 0 : column.computedPinningOffset,
4565
- style,
5192
+ style: memoizedStyle,
4566
5193
  onMouseLeave,
4567
5194
  onMouseEnter,
5195
+ onClick,
4568
5196
  cssEllipsis: (_a = column.cssEllipsis) != null ? _a : true,
4569
- className: join(useCellClassName(column, [InfiniteTableColumnCellClassName, InfiniteTableCellClassName], ColumnCellRecipe, { dragging: false, zebra }), colClassName, rowComputedClassName),
5197
+ className: join(useCellClassName(column, [InfiniteTableColumnCellClassName, InfiniteTableCellClassName], ColumnCellRecipe, { dragging: false, zebra, rowActive }), colClassName, rowComputedClassName),
4570
5198
  renderChildren
4571
5199
  };
4572
5200
  const ContextProvider = InfiniteTableColumnCellContext.Provider;
4573
- return /* @__PURE__ */ React20.createElement(ContextProvider, {
5201
+ return /* @__PURE__ */ React25.createElement(ContextProvider, {
4574
5202
  value: renderParam
4575
- }, /* @__PURE__ */ React20.createElement(InfiniteTableCell, __spreadValues({}, cellProps)));
5203
+ }, /* @__PURE__ */ React25.createElement(InfiniteTableCell, __spreadValues({}, cellProps)));
4576
5204
  }
4577
- var InfiniteTableColumnCell = React20.memo(InfiniteTableColumnCellFn);
5205
+ var InfiniteTableColumnCell = React25.memo(InfiniteTableColumnCellFn);
4578
5206
  function useInfiniteColumnCell() {
4579
- const result = (0, import_react20.useContext)(InfiniteTableColumnCellContext);
5207
+ const result = (0, import_react25.useContext)(InfiniteTableColumnCellContext);
4580
5208
  return result;
4581
5209
  }
4582
5210
 
@@ -4587,30 +5215,92 @@ var RowClsRecipe = (0, import_createRuntimeFn4.createRuntimeFn)({ defaultClassNa
4587
5215
  var RowHoverCls = "_7pupv01";
4588
5216
 
4589
5217
  // src/components/InfiniteTable/components/LoadMask.tsx
4590
- var React21 = __toModule(require("react"));
5218
+ var React26 = __toModule(require("react"));
4591
5219
 
4592
5220
  // src/components/InfiniteTable/components/LoadMask.css.ts
4593
- var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2 _16lm1iwt _16lm1iwv _16lm1iwz _16lm1iwx", hidden: "qy58ya2 qy58ya0 _16lm1iw2 _16lm1iwt _16lm1iwv _16lm1iwz _16lm1iwx" };
4594
- var LoadMaskOverlayCls = "qy58ya3 _16lm1iw2 _16lm1iwt _16lm1iwv _16lm1iwz _16lm1iwx";
5221
+ var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2 _16lm1iwu _16lm1iww _16lm1iw10 _16lm1iwy", hidden: "qy58ya2 qy58ya0 _16lm1iw2 _16lm1iwu _16lm1iww _16lm1iw10 _16lm1iwy" };
5222
+ var LoadMaskOverlayCls = "qy58ya3 _16lm1iw2 _16lm1iwu _16lm1iww _16lm1iw10 _16lm1iwy";
4595
5223
  var LoadMaskTextCls = "qy58ya4";
4596
5224
 
4597
5225
  // src/components/InfiniteTable/components/LoadMask.tsx
4598
- var { rootClassName: rootClassName7 } = internalProps;
4599
- var baseCls = `${rootClassName7}-LoadMask`;
5226
+ var { rootClassName: rootClassName10 } = internalProps;
5227
+ var baseCls3 = `${rootClassName10}-LoadMask`;
4600
5228
  function LoadMaskFn(props) {
4601
5229
  const { visible, children = "Loading" } = props;
4602
- return /* @__PURE__ */ React21.createElement("div", {
4603
- className: `${LoadMaskCls[visible ? "visible" : "hidden"]} ${baseCls}`
4604
- }, /* @__PURE__ */ React21.createElement("div", {
4605
- className: `${LoadMaskOverlayCls} ${baseCls}-Overlay`
4606
- }), /* @__PURE__ */ React21.createElement("div", {
4607
- className: `${LoadMaskTextCls} ${baseCls}-Text`
5230
+ return /* @__PURE__ */ React26.createElement("div", {
5231
+ className: `${LoadMaskCls[visible ? "visible" : "hidden"]} ${baseCls3}`
5232
+ }, /* @__PURE__ */ React26.createElement("div", {
5233
+ className: `${LoadMaskOverlayCls} ${baseCls3}-Overlay`
5234
+ }), /* @__PURE__ */ React26.createElement("div", {
5235
+ className: `${LoadMaskTextCls} ${baseCls3}-Text`
4608
5236
  }, children));
4609
5237
  }
4610
- var LoadMask = React21.memo(LoadMaskFn);
5238
+ var LoadMask = React26.memo(LoadMaskFn);
5239
+
5240
+ // src/components/InfiniteTable/getImperativeApi.ts
5241
+ function getImperativeApi(getState, getComputed, getDataSourceState, componentActions) {
5242
+ const imperativeApi = {
5243
+ setColumnOrder: (columnOrder) => {
5244
+ componentActions.columnOrder = columnOrder;
5245
+ },
5246
+ setColumnVisibility: (columnVisibility) => {
5247
+ componentActions.columnVisibility = columnVisibility;
5248
+ },
5249
+ getState,
5250
+ getDataSourceState,
5251
+ scrollRowIntoView(rowIndex, config = { offset: 0 }) {
5252
+ const state = getState();
5253
+ const scrollPosition = state.renderer.getScrollPositionForScrollRowIntoView(rowIndex, config);
5254
+ const currentScrollPosition = state.brain.getScrollPosition();
5255
+ if (scrollPosition.scrollTop !== currentScrollPosition.scrollTop) {
5256
+ state.scrollerDOMRef.current.scrollTop = scrollPosition.scrollTop;
5257
+ }
5258
+ },
5259
+ scrollColumnIntoView(colId, config = { offset: 0 }) {
5260
+ const state = getState();
5261
+ const computed = getComputed();
5262
+ const computedColumn = computed.computedVisibleColumnsMap.get(colId);
5263
+ if (!computedColumn) {
5264
+ return;
5265
+ }
5266
+ const colIndex = computedColumn.computedVisibleIndex;
5267
+ const scrollPosition = state.renderer.getScrollPositionForScrollColumnIntoView(colIndex, config);
5268
+ const currentScrollPosition = state.brain.getScrollPosition();
5269
+ if (scrollPosition.scrollLeft !== currentScrollPosition.scrollLeft) {
5270
+ state.scrollerDOMRef.current.scrollLeft = scrollPosition.scrollLeft;
5271
+ }
5272
+ },
5273
+ scrollCellIntoView(rowIndex, colIdOrIndex, config = { offset: 0 }) {
5274
+ const state = getState();
5275
+ const computed = getComputed();
5276
+ let colIndex = colIdOrIndex;
5277
+ if (typeof colIdOrIndex === "string") {
5278
+ const computedColumn = computed.computedVisibleColumnsMap.get(colIdOrIndex);
5279
+ if (!computedColumn) {
5280
+ return;
5281
+ }
5282
+ colIndex = computedColumn.computedVisibleIndex;
5283
+ }
5284
+ const scrollPositionForCol = state.renderer.getScrollPositionForScrollColumnIntoView(colIndex, config);
5285
+ const scrollPositionForRow = state.renderer.getScrollPositionForScrollRowIntoView(rowIndex, config);
5286
+ const newScrollPosition = {
5287
+ scrollLeft: scrollPositionForCol.scrollLeft,
5288
+ scrollTop: scrollPositionForRow.scrollTop
5289
+ };
5290
+ const currentScrollPosition = state.brain.getScrollPosition();
5291
+ if (newScrollPosition.scrollLeft !== currentScrollPosition.scrollLeft) {
5292
+ state.scrollerDOMRef.current.scrollLeft = newScrollPosition.scrollLeft;
5293
+ }
5294
+ if (newScrollPosition.scrollTop !== currentScrollPosition.scrollTop) {
5295
+ state.scrollerDOMRef.current.scrollTop = newScrollPosition.scrollTop;
5296
+ }
5297
+ }
5298
+ };
5299
+ return imperativeApi;
5300
+ }
4611
5301
 
4612
5302
  // src/components/InfiniteTable/hooks/useAutoSizeColumns.ts
4613
- var import_react21 = __toModule(require("react"));
5303
+ var import_react26 = __toModule(require("react"));
4614
5304
  var OFFSET = 10;
4615
5305
  function getColumnContentMaxWidths(domRef, options) {
4616
5306
  var _a;
@@ -4632,6 +5322,7 @@ function getColumnContentMaxWidths(domRef, options) {
4632
5322
  contentClone.style.pointerEvents = "none";
4633
5323
  contentClone.classList.remove(...cssEllipsisClassName.split(" "));
4634
5324
  contentClone.style.position = "absolute";
5325
+ contentClone.style.width = "auto";
4635
5326
  cell.appendChild(contentClone);
4636
5327
  let measuredWidth = contentClone.offsetWidth;
4637
5328
  cell.removeChild(contentClone);
@@ -4669,11 +5360,11 @@ function useAutoSizeColumns() {
4669
5360
  componentActions,
4670
5361
  componentState: { domRef, ready, autoSizeColumnsKey, brain }
4671
5362
  } = useComponentState();
4672
- const [refreshId, setRefreshId] = (0, import_react21.useState)(0);
5363
+ const [refreshId, setRefreshId] = (0, import_react26.useState)(0);
4673
5364
  const theKey = typeof autoSizeColumnsKey === "object" ? autoSizeColumnsKey.key : autoSizeColumnsKey;
4674
5365
  const getTheKey = useLatest(theKey);
4675
- const lastExecutedIdentifierRef = (0, import_react21.useRef)(null);
4676
- (0, import_react21.useEffect)(() => {
5366
+ const lastExecutedIdentifierRef = (0, import_react26.useRef)(null);
5367
+ (0, import_react26.useEffect)(() => {
4677
5368
  const key = getTheKey();
4678
5369
  if (key == null) {
4679
5370
  return;
@@ -4686,7 +5377,7 @@ function useAutoSizeColumns() {
4686
5377
  };
4687
5378
  return brain.onRenderRangeChange(onChange);
4688
5379
  }, [brain]);
4689
- (0, import_react21.useEffect)(() => {
5380
+ (0, import_react26.useEffect)(() => {
4690
5381
  var _a;
4691
5382
  if (theKey == null) {
4692
5383
  return;
@@ -4731,20 +5422,8 @@ function useAutoSizeColumns() {
4731
5422
  }
4732
5423
 
4733
5424
  // src/components/InfiniteTable/hooks/useCellRendering.tsx
4734
- var import_react23 = __toModule(require("react"));
4735
- var import_react24 = __toModule(require("react"));
4736
-
4737
- // src/components/hooks/useRerender.ts
4738
- var import_react22 = __toModule(require("react"));
4739
- var useRerender = () => {
4740
- const [state, setState] = (0, import_react22.useState)(0);
4741
- return [
4742
- state,
4743
- (0, import_react22.useCallback)(() => {
4744
- setState((state2) => state2 + 1);
4745
- }, [setState])
4746
- ];
4747
- };
5425
+ var import_react27 = __toModule(require("react"));
5426
+ var import_react28 = __toModule(require("react"));
4748
5427
 
4749
5428
  // src/components/InfiniteTable/hooks/useYourBrain.ts
4750
5429
  function useYourBrain(param) {
@@ -4774,7 +5453,7 @@ function useYourBrain(param) {
4774
5453
  // src/components/InfiniteTable/hooks/useCellRendering.tsx
4775
5454
  var SCROLL_BOTTOM_OFFSET = 1;
4776
5455
  function useCellRendering(param) {
4777
- const { computed, bodySize } = param;
5456
+ const { computed, bodySize, imperativeApi } = param;
4778
5457
  const { componentActions, componentState, getState } = useInfiniteTable();
4779
5458
  const {
4780
5459
  computedPinnedStartColumns,
@@ -4814,13 +5493,13 @@ function useCellRendering(param) {
4814
5493
  bodySize,
4815
5494
  rowspan
4816
5495
  });
4817
- const scrollTopMaxRef = (0, import_react23.useRef)(0);
4818
- (0, import_react23.useEffect)(() => {
5496
+ const scrollTopMaxRef = (0, import_react27.useRef)(0);
5497
+ (0, import_react27.useEffect)(() => {
4819
5498
  return brain.onRenderCountChange(() => {
4820
5499
  scrollTopMaxRef.current = brain.scrollTopMax;
4821
5500
  });
4822
5501
  }, [brain]);
4823
- (0, import_react23.useEffect)(() => {
5502
+ (0, import_react27.useEffect)(() => {
4824
5503
  return brain.onScrollStop((scrollPosition) => {
4825
5504
  const { scrollTop } = scrollPosition;
4826
5505
  if (scrollTop === 0) {
@@ -4837,31 +5516,21 @@ function useCellRendering(param) {
4837
5516
  }
4838
5517
  });
4839
5518
  }, [brain, onScrollToTop, onScrollToBottom]);
4840
- (0, import_react23.useEffect)(() => {
5519
+ (0, import_react27.useEffect)(() => {
4841
5520
  if (!bodySize.height) {
4842
5521
  return;
4843
5522
  }
4844
5523
  const { onReady } = getState();
4845
5524
  componentActions.ready = true;
4846
5525
  if (onReady) {
4847
- const imperativeApi = {
4848
- setColumnOrder: (columnOrder) => {
4849
- componentActions.columnOrder = columnOrder;
4850
- },
4851
- setColumnVisibility: (columnVisibility) => {
4852
- componentActions.columnVisibility = columnVisibility;
4853
- },
4854
- getState,
4855
- getDataSourceState
4856
- };
4857
5526
  onReady(imperativeApi);
4858
5527
  }
4859
5528
  }, [!!bodySize.height]);
4860
5529
  const [, rerender] = useRerender();
4861
- (0, import_react23.useEffect)(() => {
5530
+ (0, import_react27.useEffect)(() => {
4862
5531
  rerender();
4863
5532
  }, [dataSourceState]);
4864
- const renderCell = (0, import_react23.useCallback)((params) => {
5533
+ const renderCell = (0, import_react27.useCallback)((params) => {
4865
5534
  const {
4866
5535
  rowIndex,
4867
5536
  colIndex,
@@ -4896,7 +5565,7 @@ function useCellRendering(param) {
4896
5565
  rowStyle,
4897
5566
  rowClassName
4898
5567
  };
4899
- return /* @__PURE__ */ import_react24.default.createElement(InfiniteTableColumnCell, __spreadValues({}, cellProps));
5568
+ return /* @__PURE__ */ import_react28.default.createElement(InfiniteTableColumnCell, __spreadValues({}, cellProps));
4900
5569
  }, [
4901
5570
  rowHeight,
4902
5571
  getData,
@@ -4914,13 +5583,13 @@ function useCellRendering(param) {
4914
5583
  }
4915
5584
 
4916
5585
  // src/components/InfiniteTable/hooks/useComputed.ts
4917
- var import_react38 = __toModule(require("react"));
5586
+ var import_react42 = __toModule(require("react"));
4918
5587
 
4919
5588
  // src/components/InfiniteTable/hooks/useColumnGroups.ts
4920
- var import_react26 = __toModule(require("react"));
5589
+ var import_react30 = __toModule(require("react"));
4921
5590
 
4922
5591
  // src/components/hooks/useInterceptedMap.ts
4923
- var import_react25 = __toModule(require("react"));
5592
+ var import_react29 = __toModule(require("react"));
4924
5593
  function interceptMap(map2, fns) {
4925
5594
  const { set, delete: deleteKey, clear } = map2;
4926
5595
  if (fns.set) {
@@ -5008,7 +5677,7 @@ function useColumnGroups() {
5008
5677
  componentActions,
5009
5678
  getComponentState
5010
5679
  } = useComponentState();
5011
- (0, import_react26.useEffect)(() => {
5680
+ (0, import_react30.useEffect)(() => {
5012
5681
  const recompute = () => {
5013
5682
  componentActions.columnGroupsDepthsMap = computeColumnGroupsDepths(computedColumnGroups);
5014
5683
  };
@@ -5019,7 +5688,7 @@ function useColumnGroups() {
5019
5688
  set: update
5020
5689
  });
5021
5690
  }, [computedColumnGroups]);
5022
- (0, import_react26.useEffect)(() => {
5691
+ (0, import_react30.useEffect)(() => {
5023
5692
  return interceptMap(collapsedColumnGroups, {
5024
5693
  set: (key, visibleCol) => {
5025
5694
  const colIds = key.slice(1);
@@ -5054,14 +5723,17 @@ function useColumnGroups() {
5054
5723
  }
5055
5724
 
5056
5725
  // src/components/InfiniteTable/hooks/useColumnRowspan.ts
5057
- var import_react27 = __toModule(require("react"));
5726
+ var import_react31 = __toModule(require("react"));
5058
5727
  function useColumnRowspan(computedVisibleColumns) {
5059
5728
  const { getState: getDataSourceState } = useDataSourceContextValue();
5060
- const rowspan = (0, import_react27.useMemo)(() => {
5729
+ const rowspan = (0, import_react31.useMemo)(() => {
5061
5730
  const colsWithRowspan = computedVisibleColumns.filter((col) => typeof col.rowspan === "function");
5062
5731
  return colsWithRowspan.length ? ({ rowIndex, colIndex }) => {
5063
5732
  const dataArray = getDataSourceState().dataArray;
5064
5733
  const rowInfo = dataArray[rowIndex];
5734
+ if (!rowInfo) {
5735
+ return 1;
5736
+ }
5065
5737
  const data = rowInfo.data;
5066
5738
  const column = computedVisibleColumns[colIndex];
5067
5739
  if (!column || !column.rowspan) {
@@ -5080,10 +5752,10 @@ function useColumnRowspan(computedVisibleColumns) {
5080
5752
  }
5081
5753
 
5082
5754
  // src/components/InfiniteTable/hooks/useColumnSizeFn.ts
5083
- var import_react28 = __toModule(require("react"));
5755
+ var import_react32 = __toModule(require("react"));
5084
5756
  var debug4 = dbg("useColumnSizeFn");
5085
5757
  function useColumnSizeFn(columns) {
5086
- const columnSize = (0, import_react28.useCallback)((index) => {
5758
+ const columnSize = (0, import_react32.useCallback)((index) => {
5087
5759
  const column = columns[index];
5088
5760
  if (!column) {
5089
5761
  debug4("cannot find column at index", index, columns);
@@ -5094,10 +5766,10 @@ function useColumnSizeFn(columns) {
5094
5766
  }
5095
5767
 
5096
5768
  // src/components/InfiniteTable/hooks/useColumnsWhen.ts
5097
- var import_react34 = __toModule(require("react"));
5769
+ var import_react38 = __toModule(require("react"));
5098
5770
 
5099
5771
  // src/components/InfiniteTable/utils/getColumnForGroupBy.tsx
5100
- var React25 = __toModule(require("react"));
5772
+ var React30 = __toModule(require("react"));
5101
5773
 
5102
5774
  // src/utils/stripVar.ts
5103
5775
  function stripVar(cssVariableWithVarString) {
@@ -5113,19 +5785,19 @@ var showLoadingIcon = (rowInfo) => {
5113
5785
  };
5114
5786
 
5115
5787
  // src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
5116
- var React23 = __toModule(require("react"));
5117
- var import_react29 = __toModule(require("react"));
5788
+ var React28 = __toModule(require("react"));
5789
+ var import_react33 = __toModule(require("react"));
5118
5790
 
5119
5791
  // src/components/InfiniteTable/components/icons/ExpanderIcon.css.ts
5120
5792
  var import_createRuntimeFn5 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
5121
- var ExpanderIconCls = "_16lm1iw6 _16lm1iwf _16lm1iwd";
5793
+ var ExpanderIconCls = "_16lm1iw6 _16lm1iwg _16lm1iwd";
5122
5794
  var ExpanderIconClsVariants = (0, import_createRuntimeFn5.createRuntimeFn)({ defaultClassName: "", variantClassNames: { expanded: { true: "_16lm1iwc", false: "_198z9782" } }, defaultVariants: {}, compoundVariants: [] });
5123
5795
 
5124
5796
  // src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
5125
5797
  function ExpanderIcon(props) {
5126
5798
  var _a;
5127
5799
  const { size = 24 } = props;
5128
- const [expanded, setExpanded] = (0, import_react29.useState)((_a = props.expanded) != null ? _a : props.defaultExpanded);
5800
+ const [expanded, setExpanded] = (0, import_react33.useState)((_a = props.expanded) != null ? _a : props.defaultExpanded);
5129
5801
  const onClick = () => {
5130
5802
  var _a2;
5131
5803
  (_a2 = props.onChange) == null ? void 0 : _a2.call(props, !expanded);
@@ -5133,12 +5805,12 @@ function ExpanderIcon(props) {
5133
5805
  setExpanded(!expanded);
5134
5806
  }
5135
5807
  };
5136
- React23.useEffect(() => {
5808
+ React28.useEffect(() => {
5137
5809
  if (isControlled("expanded", props)) {
5138
5810
  setExpanded(props.expanded);
5139
5811
  }
5140
5812
  }, [props.expanded]);
5141
- return /* @__PURE__ */ React23.createElement("svg", {
5813
+ return /* @__PURE__ */ React28.createElement("svg", {
5142
5814
  "data-name": "expander-icon",
5143
5815
  xmlns: "http://www.w3.org/2000/svg",
5144
5816
  height: `${size}px`,
@@ -5149,20 +5821,20 @@ function ExpanderIcon(props) {
5149
5821
  className: join(props.className, ExpanderIconCls, ExpanderIconClsVariants({
5150
5822
  expanded
5151
5823
  }), "InfiniteIcon", "InfiniteIcon-expander", `InfiniteIcon-expander--${expanded ? "expanded" : "collapsed"}`)
5152
- }, /* @__PURE__ */ React23.createElement("path", {
5824
+ }, /* @__PURE__ */ React28.createElement("path", {
5153
5825
  d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"
5154
5826
  }));
5155
5827
  }
5156
5828
 
5157
5829
  // src/components/InfiniteTable/components/icons/LoadingIcon.tsx
5158
- var React24 = __toModule(require("react"));
5830
+ var React29 = __toModule(require("react"));
5159
5831
 
5160
5832
  // src/components/InfiniteTable/components/icons/LoadingIcon.css.ts
5161
- var LoadingIconCls = "_16lm1iw8 _16lm1iwf _16lm1iwd";
5833
+ var LoadingIconCls = "_16lm1iw8 _16lm1iwg _16lm1iwd";
5162
5834
 
5163
5835
  // src/components/InfiniteTable/components/icons/LoadingIcon.tsx
5164
5836
  var LoadingIcon = (props) => {
5165
- return /* @__PURE__ */ React24.createElement("svg", {
5837
+ return /* @__PURE__ */ React29.createElement("svg", {
5166
5838
  xmlns: "http://www.w3.org/2000/svg",
5167
5839
  style: {
5168
5840
  margin: "auto",
@@ -5174,14 +5846,14 @@ var LoadingIcon = (props) => {
5174
5846
  viewBox: "0 0 100 100",
5175
5847
  preserveAspectRatio: "xMidYMid",
5176
5848
  className: join(props.className, LoadingIconCls, "InfiniteIcon", "InfiniteIcon-loading")
5177
- }, /* @__PURE__ */ React24.createElement("circle", {
5849
+ }, /* @__PURE__ */ React29.createElement("circle", {
5178
5850
  cx: "50",
5179
5851
  cy: "50",
5180
5852
  fill: "none",
5181
5853
  strokeWidth: "10",
5182
5854
  r: "35",
5183
5855
  strokeDasharray: "164.93361431346415 56.97787143782138"
5184
- }, /* @__PURE__ */ React24.createElement("animateTransform", {
5856
+ }, /* @__PURE__ */ React29.createElement("animateTransform", {
5185
5857
  attributeName: "transform",
5186
5858
  type: "rotate",
5187
5859
  repeatCount: "indefinite",
@@ -5201,7 +5873,7 @@ function getGroupColumnRender({
5201
5873
  var _a, _b, _c;
5202
5874
  let { value, rowInfo, column, groupBy, pivotBy } = renderOptions;
5203
5875
  if (column.renderValue) {
5204
- value = /* @__PURE__ */ React25.createElement(RenderHookComponent, {
5876
+ value = /* @__PURE__ */ React30.createElement(RenderHookComponent, {
5205
5877
  render: column.renderValue,
5206
5878
  renderParam: renderOptions
5207
5879
  });
@@ -5231,22 +5903,22 @@ function getGroupColumnRender({
5231
5903
  const showExpanderIcon = pivotBy ? (((_b = groupRowInfo.groupKeys) == null ? void 0 : _b.length) || 0) < (groupBy == null ? void 0 : groupBy.length) : (((_c = groupRowInfo.groupKeys) == null ? void 0 : _c.length) || 0) <= (groupBy == null ? void 0 : groupBy.length);
5232
5904
  const isLoading = showLoadingIcon(groupRowInfo);
5233
5905
  if (isLoading) {
5234
- icon = /* @__PURE__ */ React25.createElement(LoadingIcon, null);
5906
+ icon = /* @__PURE__ */ React30.createElement(LoadingIcon, null);
5235
5907
  } else if (showExpanderIcon) {
5236
- const defaultIcon = /* @__PURE__ */ React25.createElement(ExpanderIcon, {
5908
+ const defaultIcon = /* @__PURE__ */ React30.createElement(ExpanderIcon, {
5237
5909
  expanded: !collapsed,
5238
5910
  onChange: () => {
5239
5911
  toggleGroupRow(groupKeys);
5240
5912
  }
5241
5913
  });
5242
- icon = column.renderGroupIcon ? /* @__PURE__ */ React25.createElement(RenderHookComponent, {
5914
+ icon = column.renderGroupIcon ? /* @__PURE__ */ React30.createElement(RenderHookComponent, {
5243
5915
  render: column.renderGroupIcon,
5244
5916
  renderParam: Object.assign({ collapsed, groupIcon: defaultIcon }, renderOptions)
5245
5917
  }) : defaultIcon;
5246
5918
  }
5247
- return /* @__PURE__ */ React25.createElement("div", {
5919
+ return /* @__PURE__ */ React30.createElement("div", {
5248
5920
  className: join(display.flex, alignItems.center)
5249
- }, icon, /* @__PURE__ */ React25.createElement("div", {
5921
+ }, icon, /* @__PURE__ */ React30.createElement("div", {
5250
5922
  className: cssEllipsisClassName
5251
5923
  }, value != null ? value : null));
5252
5924
  };
@@ -5291,9 +5963,9 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
5291
5963
  const showExpanderIcon = rowInfo.isGroupRow ? pivotBy ? (((_a = rowInfo.groupKeys) == null ? void 0 : _a.length) || 0) < (groupBy == null ? void 0 : groupBy.length) : (((_b = rowInfo.groupKeys) == null ? void 0 : _b.length) || 0) <= (groupBy == null ? void 0 : groupBy.length) : false;
5292
5964
  const isLoading = showLoadingIcon(rowInfo);
5293
5965
  if (isLoading) {
5294
- icon = /* @__PURE__ */ React25.createElement(LoadingIcon, null);
5966
+ icon = /* @__PURE__ */ React30.createElement(LoadingIcon, null);
5295
5967
  } else if (showExpanderIcon) {
5296
- const defaultIcon = /* @__PURE__ */ React25.createElement(ExpanderIcon, {
5968
+ const defaultIcon = /* @__PURE__ */ React30.createElement(ExpanderIcon, {
5297
5969
  expanded: !collapsed,
5298
5970
  onChange: () => {
5299
5971
  if (!rowInfo.isGroupRow) {
@@ -5308,9 +5980,9 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
5308
5980
  icon = column.renderGroupIcon(renderParam);
5309
5981
  }
5310
5982
  }
5311
- return /* @__PURE__ */ React25.createElement("div", {
5983
+ return /* @__PURE__ */ React30.createElement("div", {
5312
5984
  className: join(display.flex, alignItems.center, GroupRowExpanderCls)
5313
- }, icon, /* @__PURE__ */ React25.createElement("div", {
5985
+ }, icon, /* @__PURE__ */ React30.createElement("div", {
5314
5986
  className: cssEllipsisClassName
5315
5987
  }, value != null ? value : null));
5316
5988
  }
@@ -5326,11 +5998,11 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
5326
5998
  }
5327
5999
 
5328
6000
  // src/components/InfiniteTable/hooks/useEffectWithRaf.ts
5329
- var import_react30 = __toModule(require("react"));
6001
+ var import_react34 = __toModule(require("react"));
5330
6002
  function useEffectWithRaf(fn, deps) {
5331
- const rafId = (0, import_react30.useRef)(0);
5332
- const removeFnRaf = (0, import_react30.useRef)();
5333
- (0, import_react30.useEffect)(() => {
6003
+ const rafId = (0, import_react34.useRef)(0);
6004
+ const removeFnRaf = (0, import_react34.useRef)();
6005
+ (0, import_react34.useEffect)(() => {
5334
6006
  rafId.current = requestAnimationFrame(() => {
5335
6007
  removeFnRaf.current = fn();
5336
6008
  });
@@ -5347,7 +6019,7 @@ function useEffectWithRaf(fn, deps) {
5347
6019
  }
5348
6020
 
5349
6021
  // src/components/InfiniteTable/hooks/useToggleGroupRow.ts
5350
- var import_react33 = __toModule(require("react"));
6022
+ var import_react37 = __toModule(require("react"));
5351
6023
 
5352
6024
  // src/utils/groupAndPivot/index.ts
5353
6025
  var LAZY_ROOT_KEY_FOR_GROUPS = "____root____";
@@ -5415,21 +6087,18 @@ function lazyGroup(groupParams, rootData) {
5415
6087
  rootData.visitDepthFirst((lazyGroupRowInfo, keys, _index, next) => {
5416
6088
  const [_rootKey, ...currentGroupKeys] = keys;
5417
6089
  const dataArray = lazyGroupRowInfo.children;
5418
- if (currentGroupKeys.length == groupBy.length && groupBy.length) {
5419
- const deepMapGroupValue = deepMap.get(currentGroupKeys);
5420
- if (deepMapGroupValue) {
5421
- deepMapGroupValue.items = dataArray;
5422
- }
5423
- return next == null ? void 0 : next();
6090
+ const current = deepMap.get(currentGroupKeys);
6091
+ if (current) {
6092
+ current.cache = lazyGroupRowInfo.cache;
6093
+ current.childrenLoading = lazyGroupRowInfo.childrenLoading;
6094
+ current.childrenAvailable = lazyGroupRowInfo.childrenAvailable;
6095
+ current.error = lazyGroupRowInfo.error;
5424
6096
  }
5425
- if (lazyGroupRowInfo) {
5426
- const current = deepMap.get(currentGroupKeys);
6097
+ if (currentGroupKeys.length == groupBy.length && groupBy.length) {
5427
6098
  if (current) {
5428
- current.cache = lazyGroupRowInfo.cache;
5429
- current.childrenLoading = lazyGroupRowInfo.childrenLoading;
5430
- current.childrenAvailable = lazyGroupRowInfo.childrenAvailable;
5431
- current.error = lazyGroupRowInfo.error;
6099
+ current.items = dataArray;
5432
6100
  }
6101
+ return next == null ? void 0 : next();
5433
6102
  }
5434
6103
  for (let i = 0, len = dataArray.length; i < len; i++) {
5435
6104
  if (!dataArray[i]) {
@@ -5448,10 +6117,8 @@ function lazyGroup(groupParams, rootData) {
5448
6117
  }
5449
6118
  const dataObject = dataArray[i].data;
5450
6119
  const dataKeys = dataArray[i].keys;
5451
- const item = dataObject;
5452
6120
  if (dataKeys.length) {
5453
- const { field: groupByProperty } = groupBy[dataKeys.length - 1];
5454
- const key = item[groupByProperty];
6121
+ const key = dataKeys[dataKeys.length - 1];
5455
6122
  currentGroupKeys.push(key);
5456
6123
  }
5457
6124
  const deepMapGroupValue = {
@@ -5614,6 +6281,7 @@ function flatten(groupResult) {
5614
6281
  return result;
5615
6282
  }
5616
6283
  function getEnhancedGroupData(options, deepMapValue) {
6284
+ var _a;
5617
6285
  const { groupBy, groupKeys, collapsed, parents, reducers, lazyLoad } = options;
5618
6286
  const groupNesting = groupKeys.length;
5619
6287
  const {
@@ -5622,9 +6290,9 @@ function getEnhancedGroupData(options, deepMapValue) {
5622
6290
  pivotDeepMap,
5623
6291
  commonData
5624
6292
  } = deepMapValue;
5625
- let data = null;
6293
+ let data = commonData != null ? commonData : null;
5626
6294
  if (Object.keys(reducerResults).length > 0) {
5627
- data = commonData || {};
6295
+ data = __spreadValues({}, commonData);
5628
6296
  for (const key in reducers)
5629
6297
  if (reducers.hasOwnProperty(key)) {
5630
6298
  const reducer = reducers[key];
@@ -5635,7 +6303,7 @@ function getEnhancedGroupData(options, deepMapValue) {
5635
6303
  }
5636
6304
  }
5637
6305
  let selfLoaded = true;
5638
- let theValue = groupKeys[groupKeys.length - 1];
6306
+ let theValue = (_a = data != null ? data[groupBy[groupKeys.length - 1]] : null) != null ? _a : groupKeys[groupKeys.length - 1];
5639
6307
  if (typeof theValue === "string" && theValue.startsWith(NOT_LOADED_YET_KEY_PREFIX)) {
5640
6308
  selfLoaded = false;
5641
6309
  theValue = null;
@@ -5649,6 +6317,7 @@ function getEnhancedGroupData(options, deepMapValue) {
5649
6317
  collapsed,
5650
6318
  dataSourceHasGrouping: true,
5651
6319
  selfLoaded,
6320
+ error: options.error,
5652
6321
  parents,
5653
6322
  deepRowInfoArray: [],
5654
6323
  collapsedChildrenCount: 0,
@@ -5712,6 +6381,7 @@ function enhancedFlatten(param) {
5712
6381
  indexInParentGroups: Array.from(indexInParentGroups),
5713
6382
  indexInAll: result.length,
5714
6383
  groupKeys,
6384
+ error: deepMapValue.error,
5715
6385
  childrenLoading: deepMapValue.childrenLoading,
5716
6386
  childrenAvailable: deepMapValue.childrenAvailable,
5717
6387
  directChildrenCount: groupKeys.length === groupByStrings.length ? deepMapValue.items.length : deepMap.getDirectChildrenSizeFor(groupKeys),
@@ -5757,8 +6427,9 @@ function enhancedFlatten(param) {
5757
6427
  }
5758
6428
  for (let index = 0, len = items.length; index < len; index++) {
5759
6429
  const item = items[index];
6430
+ const indexInAll = startIndex + index;
5760
6431
  const rowInfo = {
5761
- id: item ? toPrimaryKey(item) : `${groupKeys}-${index}`,
6432
+ id: item ? toPrimaryKey(item, indexInAll) : `${groupKeys}-${index}`,
5762
6433
  data: item,
5763
6434
  dataSourceHasGrouping: true,
5764
6435
  isGroupRow: false,
@@ -5769,7 +6440,7 @@ function enhancedFlatten(param) {
5769
6440
  parents: Array.from(parents),
5770
6441
  indexInParentGroups: [...indexInParentGroups, index],
5771
6442
  indexInGroup: index,
5772
- indexInAll: startIndex + index,
6443
+ indexInAll,
5773
6444
  groupBy: groupByStrings,
5774
6445
  groupNesting,
5775
6446
  groupCount: enhancedGroupData.groupCount
@@ -5801,7 +6472,7 @@ function enhancedFlatten(param) {
5801
6472
  }
5802
6473
 
5803
6474
  // src/components/DataSource/index.tsx
5804
- var React26 = __toModule(require("react"));
6475
+ var React31 = __toModule(require("react"));
5805
6476
 
5806
6477
  // src/utils/multisort/sortTypes.ts
5807
6478
  var numberComparator = function(first, second) {
@@ -5812,11 +6483,11 @@ var stringComparator = function(first, second) {
5812
6483
  second = `${second}`;
5813
6484
  return first.localeCompare(second);
5814
6485
  };
5815
- var sortTypes = {
6486
+ var defaultSortTypes = {
5816
6487
  number: numberComparator,
5817
6488
  string: stringComparator
5818
6489
  };
5819
- var sortTypes_default = sortTypes;
6490
+ var sortTypes_default = defaultSortTypes;
5820
6491
 
5821
6492
  // src/utils/multisort/index.ts
5822
6493
  var multisort = (sortInfo, array, get) => {
@@ -5829,7 +6500,8 @@ var getSingleSortFunction = (info) => {
5829
6500
  return;
5830
6501
  }
5831
6502
  const field = info.field;
5832
- var dir = info.dir < 0 ? -1 : info.dir > 0 ? 1 : 0;
6503
+ const valueGetter = info.valueGetter;
6504
+ const dir = info.dir < 0 ? -1 : info.dir > 0 ? 1 : 0;
5833
6505
  if (!dir) {
5834
6506
  return;
5835
6507
  }
@@ -5840,53 +6512,163 @@ var getSingleSortFunction = (info) => {
5840
6512
  console.warn(`Unknown sort type "${info.type}" - please pass one of ${Object.keys(multisort.knownTypes).join(", ")}`);
5841
6513
  }
5842
6514
  }
5843
- if (!fn) {
5844
- fn = sortTypes_default.string;
6515
+ if (!fn) {
6516
+ fn = sortTypes_default.string;
6517
+ }
6518
+ return (first, second) => {
6519
+ const a = valueGetter ? valueGetter(first) : field ? first[field] : first;
6520
+ const b = valueGetter ? valueGetter(second) : field ? second[field] : second;
6521
+ return dir * fn(a, b);
6522
+ };
6523
+ };
6524
+ var getSortFunctions = (sortInfo) => {
6525
+ return sortInfo.map(getSingleSortFunction).filter((fn) => fn instanceof Function);
6526
+ };
6527
+ var getMultisortFunction = (sortInfo, get) => {
6528
+ const fns = getSortFunctions(sortInfo);
6529
+ return (first, second) => {
6530
+ if (get) {
6531
+ first = get(first);
6532
+ second = get(second);
6533
+ }
6534
+ let result = 0;
6535
+ let i = 0;
6536
+ let fn;
6537
+ const len = fns.length;
6538
+ for (; i < len; i++) {
6539
+ fn = fns[i];
6540
+ if (!fn) {
6541
+ continue;
6542
+ }
6543
+ result = fn(first, second);
6544
+ if (result !== 0) {
6545
+ return result;
6546
+ }
6547
+ }
6548
+ return result;
6549
+ };
6550
+ };
6551
+
6552
+ // src/components/DataSource/GroupRowsState.ts
6553
+ var GroupRowsState = class {
6554
+ constructor(state) {
6555
+ this.update(state instanceof GroupRowsState ? state.getState() : state);
6556
+ }
6557
+ getState() {
6558
+ var _a, _b, _c, _d;
6559
+ return {
6560
+ expandedRows: this.expandedAll ? true : (_b = (_a = this.expandedMap) == null ? void 0 : _a.topDownKeys()) != null ? _b : [],
6561
+ collapsedRows: this.collapsedAll ? true : (_d = (_c = this.collapsedMap) == null ? void 0 : _c.topDownKeys()) != null ? _d : []
6562
+ };
6563
+ }
6564
+ destroy() {
6565
+ var _a, _b;
6566
+ (_a = this.expandedMap) == null ? void 0 : _a.clear();
6567
+ (_b = this.collapsedMap) == null ? void 0 : _b.clear();
6568
+ delete this.expandedMap;
6569
+ delete this.collapsedMap;
6570
+ }
6571
+ update(state) {
6572
+ var _a, _b, _c, _d;
6573
+ this.initialState = state;
6574
+ const { collapsedRows, expandedRows } = this.initialState;
6575
+ this.collapsedAll = collapsedRows === true;
6576
+ this.expandedAll = expandedRows === true;
6577
+ if (this.collapsedAll && this.expandedAll) {
6578
+ throw `Cannot have both collapsedRows and expandedRows be true!`;
6579
+ }
6580
+ if (collapsedRows !== true) {
6581
+ (_a = this.collapsedMap) == null ? void 0 : _a.clear();
6582
+ this.collapsedMap = (_b = this.collapsedMap) != null ? _b : new DeepMap(collapsedRows.map((keys) => [keys, true]));
6583
+ }
6584
+ if (expandedRows !== true) {
6585
+ (_c = this.expandedMap) == null ? void 0 : _c.clear();
6586
+ this.expandedMap = (_d = this.expandedMap) != null ? _d : new DeepMap(expandedRows.map((keys) => [keys, true]));
6587
+ }
6588
+ }
6589
+ areAllCollapsed() {
6590
+ return this.collapsedAll && (this.expandedMap ? this.expandedMap.size === 0 : true);
6591
+ }
6592
+ areAllExpanded() {
6593
+ return this.expandedAll && (this.collapsedMap ? this.collapsedMap.size === 0 : true);
6594
+ }
6595
+ collapseAll() {
6596
+ this.update({
6597
+ collapsedRows: true,
6598
+ expandedRows: []
6599
+ });
6600
+ }
6601
+ expandAll() {
6602
+ this.update({
6603
+ expandedRows: true,
6604
+ collapsedRows: []
6605
+ });
6606
+ }
6607
+ isGroupRowExpanded(keys) {
6608
+ var _a, _b;
6609
+ if (this.expandedAll === true) {
6610
+ if (this.collapsedAll === true) {
6611
+ throw 'Cannot have both expandedRows and collapsedRows be "true"';
6612
+ }
6613
+ return !((_a = this.collapsedMap) == null ? void 0 : _a.has(keys));
6614
+ }
6615
+ return (_b = this.expandedMap) == null ? void 0 : _b.has(keys);
6616
+ }
6617
+ isGroupRowCollapsed(keys) {
6618
+ return !this.isGroupRowExpanded(keys);
5845
6619
  }
5846
- return (first, second) => {
5847
- const a = field ? first[field] : first;
5848
- const b = field ? second[field] : second;
5849
- return dir * fn(a, b);
5850
- };
5851
- };
5852
- var getSortFunctions = (sortInfo) => {
5853
- return sortInfo.map(getSingleSortFunction).filter((fn) => fn instanceof Function);
5854
- };
5855
- var getMultisortFunction = (sortInfo, get) => {
5856
- const fns = getSortFunctions(sortInfo);
5857
- return (first, second) => {
5858
- if (get) {
5859
- first = get(first);
5860
- second = get(second);
6620
+ setGroupRowExpanded(keys, shouldExpand) {
6621
+ var _a;
6622
+ if (shouldExpand === this.isGroupRowExpanded(keys)) {
6623
+ return;
5861
6624
  }
5862
- let result = 0;
5863
- let i = 0;
5864
- let fn;
5865
- const len = fns.length;
5866
- for (; i < len; i++) {
5867
- fn = fns[i];
5868
- if (!fn) {
5869
- continue;
6625
+ if (shouldExpand) {
6626
+ if (this.collapsedAll === true) {
6627
+ if (!this.expandedMap) {
6628
+ throw `No expandedMap found when trying to expand group row ${keys.join(",")}`;
6629
+ }
6630
+ this.expandedMap.set(keys, true);
6631
+ } else if (this.expandedAll === true) {
6632
+ if (!this.collapsedMap) {
6633
+ throw `No collapsedMap found when trying to expand group row ${keys.join(",")}`;
6634
+ }
6635
+ this.collapsedMap.delete(keys);
5870
6636
  }
5871
- result = fn(first, second);
5872
- if (result !== 0) {
5873
- return result;
6637
+ } else {
6638
+ if (this.expandedAll === true) {
6639
+ if (!this.collapsedMap) {
6640
+ throw `No collapsedMap found when trying to collapse group row ${keys.join(",")}`;
6641
+ }
6642
+ this.collapsedMap.set(keys, true);
6643
+ } else if (this.collapsedAll === true) {
6644
+ if (!this.expandedMap) {
6645
+ throw `No expandedMap found when trying to collapse group row ${keys.join(",")}`;
6646
+ }
6647
+ (_a = this.expandedMap) == null ? void 0 : _a.delete(keys);
5874
6648
  }
5875
6649
  }
5876
- return result;
5877
- };
6650
+ }
6651
+ collapseGroupRow(keys) {
6652
+ this.setGroupRowExpanded(keys, false);
6653
+ }
6654
+ expandGroupRow(keys) {
6655
+ this.setGroupRowExpanded(keys, true);
6656
+ }
6657
+ toggleGroupRow(keys) {
6658
+ this.setGroupRowExpanded(keys, !this.isGroupRowExpanded(keys));
6659
+ }
5878
6660
  };
5879
6661
 
5880
6662
  // src/components/DataSource/privateHooks/useLoadData.ts
5881
- var import_react32 = __toModule(require("react"));
6663
+ var import_react36 = __toModule(require("react"));
5882
6664
 
5883
6665
  // src/components/hooks/useEffectWithChanges.ts
5884
- var import_react31 = __toModule(require("react"));
6666
+ var import_react35 = __toModule(require("react"));
5885
6667
  function useEffectWithChanges(fn, deps) {
5886
- const prevRef = (0, import_react31.useRef)({});
5887
- const oldValuesRef = (0, import_react31.useRef)({});
6668
+ const prevRef = (0, import_react35.useRef)({});
6669
+ const oldValuesRef = (0, import_react35.useRef)({});
5888
6670
  const oldValues = oldValuesRef.current;
5889
- const changesRef = (0, import_react31.useRef)({});
6671
+ const changesRef = (0, import_react35.useRef)({});
5890
6672
  const changes = changesRef.current;
5891
6673
  const useEffectDeps = [];
5892
6674
  for (const k in deps) {
@@ -5899,7 +6681,7 @@ function useEffectWithChanges(fn, deps) {
5899
6681
  }
5900
6682
  }
5901
6683
  prevRef.current = deps;
5902
- (0, import_react31.useEffect)(() => {
6684
+ (0, import_react35.useEffect)(() => {
5903
6685
  const changes2 = changesRef.current;
5904
6686
  const result = fn(changes2, oldValues);
5905
6687
  changesRef.current = {};
@@ -5908,6 +6690,25 @@ function useEffectWithChanges(fn, deps) {
5908
6690
  }, useEffectDeps);
5909
6691
  }
5910
6692
 
6693
+ // src/components/InfiniteTable/utils/assignFiltered.ts
6694
+ function assignFiltered(filterFn, target, ...rest) {
6695
+ const result = target;
6696
+ rest.forEach((obj) => {
6697
+ for (const key in obj) {
6698
+ if (obj.hasOwnProperty(key) && filterFn(obj[key], key)) {
6699
+ result[key] = obj[key];
6700
+ }
6701
+ }
6702
+ });
6703
+ return result;
6704
+ }
6705
+ function assignNonNull(target, ...rest) {
6706
+ return assignFiltered((value) => value != null, target, ...rest);
6707
+ }
6708
+ function assignExcept(exceptKeys, target, ...rest) {
6709
+ return assignFiltered((_value, key) => !(key in exceptKeys), target, ...rest);
6710
+ }
6711
+
5911
6712
  // src/components/DataSource/privateHooks/getChangeDetect.ts
5912
6713
  function getChangeDetect() {
5913
6714
  var _a;
@@ -5933,6 +6734,7 @@ function buildDataSourceDataParams(componentState, overrides) {
5933
6734
  sortInfo,
5934
6735
  groupBy: componentState.groupBy,
5935
6736
  pivotBy: componentState.pivotBy,
6737
+ filterValue: componentState.filterValue,
5936
6738
  aggregationReducers: componentState.aggregationReducers
5937
6739
  };
5938
6740
  if (dataSourceParams.groupBy) {
@@ -5952,6 +6754,13 @@ function buildDataSourceDataParams(componentState, overrides) {
5952
6754
  if (overrides) {
5953
6755
  Object.assign(dataSourceParams, overrides);
5954
6756
  }
6757
+ if (dataSourceParams.filterValue && dataSourceParams.filterValue.length) {
6758
+ dataSourceParams.filterValue = dataSourceParams.filterValue.map((f) => {
6759
+ const value = __spreadValues({}, f);
6760
+ delete value.valueGetter;
6761
+ return value;
6762
+ });
6763
+ }
5955
6764
  const changes = {};
5956
6765
  const oldDataSourceParams = componentState.dataParams || {};
5957
6766
  for (const k in dataSourceParams) {
@@ -5972,6 +6781,13 @@ function loadData(data, componentState, actions, overrides) {
5972
6781
  const lazyGroupData = componentState.originalLazyGroupData;
5973
6782
  const key = [LAZY_ROOT_KEY_FOR_GROUPS, ...dataParams.groupKeys || []];
5974
6783
  const existingGroupRowInfo = lazyGroupData.get(key);
6784
+ if (!existingGroupRowInfo) {
6785
+ const groupCacheKeys = [
6786
+ ...dataParams.groupKeys || [],
6787
+ dataParams.lazyLoadStartIndex
6788
+ ];
6789
+ componentState.lazyLoadCacheOfLoadedBatches.set(groupCacheKeys, true);
6790
+ }
5975
6791
  if (existingGroupRowInfo && existingGroupRowInfo.cache && key.length > 1) {
5976
6792
  const items = existingGroupRowInfo.children;
5977
6793
  const len = items.length;
@@ -5997,7 +6813,8 @@ function loadData(data, componentState, actions, overrides) {
5997
6813
  childrenLoading: true,
5998
6814
  childrenAvailable: false,
5999
6815
  cache: CACHE_DEFAULT,
6000
- totalCount: 0
6816
+ totalCount: 0,
6817
+ totalCountUnfiltered: 0
6001
6818
  });
6002
6819
  }
6003
6820
  actions.originalLazyGroupDataChangeDetect = getChangeDetect();
@@ -6021,6 +6838,9 @@ function loadData(data, componentState, actions, overrides) {
6021
6838
  if (remoteData.mappings) {
6022
6839
  actions.pivotMappings = remoteData.mappings;
6023
6840
  }
6841
+ if (remoteData.totalCountUnfiltered) {
6842
+ actions.unfilteredCount = remoteData.totalCountUnfiltered;
6843
+ }
6024
6844
  if (componentState.lazyLoad) {
6025
6845
  let resolveRemoteData = function(keys, remoteData2, parentKeys) {
6026
6846
  var _a, _b, _c, _d;
@@ -6031,24 +6851,19 @@ function loadData(data, componentState, actions, overrides) {
6031
6851
  childrenLoading: false,
6032
6852
  childrenAvailable: true,
6033
6853
  totalCount: (_a = remoteData2.totalCount) != null ? _a : dataArray2.length,
6034
- children: dataArray2
6854
+ totalCountUnfiltered: (_b = remoteData2.totalCount) != null ? _b : dataArray2.length,
6855
+ children: dataArray2,
6856
+ error: remoteData2.error
6035
6857
  };
6036
6858
  const childDatasets = [];
6037
6859
  if (dataParams.lazyLoadBatchSize && !parentKeys) {
6038
6860
  const existingGroupRowInfo = lazyGroupData.get(theKey);
6039
- const currentGroupRowInfo = existingGroupRowInfo != null ? existingGroupRowInfo : {
6040
- children: [],
6041
- childrenAvailable: true,
6042
- childrenLoading: false,
6043
- totalCount: newGroupRowInfo.totalCount,
6044
- cache: (_b = newGroupRowInfo.cache) != null ? _b : CACHE_DEFAULT
6045
- };
6046
- if (existingGroupRowInfo) {
6047
- existingGroupRowInfo.cache = newGroupRowInfo.cache;
6048
- existingGroupRowInfo.totalCount = newGroupRowInfo.totalCount;
6049
- existingGroupRowInfo.childrenLoading = false;
6050
- existingGroupRowInfo.childrenAvailable = true;
6051
- existingGroupRowInfo.error = newGroupRowInfo.error;
6861
+ const isGroupNew = !existingGroupRowInfo;
6862
+ const currentGroupRowInfo = assignExcept({
6863
+ children: true
6864
+ }, existingGroupRowInfo || {}, newGroupRowInfo);
6865
+ if (isGroupNew) {
6866
+ currentGroupRowInfo.chidren = [];
6052
6867
  }
6053
6868
  currentGroupRowInfo.children.length = currentGroupRowInfo.totalCount;
6054
6869
  const start = (_c = dataParams.lazyLoadStartIndex) != null ? _c : 0;
@@ -6066,13 +6881,13 @@ function loadData(data, componentState, actions, overrides) {
6066
6881
  });
6067
6882
  }
6068
6883
  }
6069
- if (!existingGroupRowInfo) {
6884
+ if (isGroupNew) {
6070
6885
  lazyGroupData.set(theKey, currentGroupRowInfo);
6071
6886
  }
6072
6887
  } else {
6073
6888
  if (parentKeys) {
6074
6889
  newGroupRowInfo.children.forEach((child) => {
6075
- if (child.dataset) {
6890
+ if (child && child.dataset) {
6076
6891
  childDatasets.push({
6077
6892
  keys: child.keys,
6078
6893
  dataset: child.dataset
@@ -6129,16 +6944,17 @@ function useLoadData() {
6129
6944
  sortInfo,
6130
6945
  groupBy,
6131
6946
  pivotBy,
6947
+ filterValue,
6132
6948
  livePagination,
6133
6949
  livePaginationCursor,
6134
6950
  cursorId: stateCursorId
6135
6951
  } = componentState;
6136
- const [scrollbars, setScrollbars] = (0, import_react32.useState)({
6952
+ const [scrollbars, setScrollbars] = (0, import_react36.useState)({
6137
6953
  vertical: false,
6138
6954
  horizontal: false
6139
6955
  });
6140
- const scrollbarsRef = (0, import_react32.useRef)(scrollbars);
6141
- (0, import_react32.useEffect)(() => {
6956
+ const scrollbarsRef = (0, import_react36.useRef)(scrollbars);
6957
+ (0, import_react36.useEffect)(() => {
6142
6958
  notifyScrollbarsChange.onChange((scrollbars2) => {
6143
6959
  if (!scrollbars2) {
6144
6960
  return;
@@ -6148,7 +6964,7 @@ function useLoadData() {
6148
6964
  });
6149
6965
  return () => notifyScrollbarsChange.destroy();
6150
6966
  }, [notifyScrollbarsChange]);
6151
- (0, import_react32.useEffect)(() => {
6967
+ (0, import_react36.useEffect)(() => {
6152
6968
  if (!livePagination) {
6153
6969
  return;
6154
6970
  }
@@ -6162,7 +6978,7 @@ function useLoadData() {
6162
6978
  });
6163
6979
  return () => cancelAnimationFrame(frameId);
6164
6980
  }, [livePaginationCursor]);
6165
- (0, import_react32.useEffect)(() => {
6981
+ (0, import_react36.useEffect)(() => {
6166
6982
  if (!livePagination || livePaginationCursor !== void 0) {
6167
6983
  return;
6168
6984
  }
@@ -6176,7 +6992,7 @@ function useLoadData() {
6176
6992
  });
6177
6993
  return () => cancelAnimationFrame(frameId);
6178
6994
  }, [dataArray.length, livePaginationCursor]);
6179
- (0, import_react32.useEffect)(() => {
6995
+ (0, import_react36.useEffect)(() => {
6180
6996
  const state = getComponentState();
6181
6997
  const { livePaginationCursor: livePaginationCursor2, livePagination: livePagination2, dataArray: dataArray2 } = state;
6182
6998
  if (!scrollbars.vertical && livePagination2) {
@@ -6191,9 +7007,10 @@ function useLoadData() {
6191
7007
  sortInfo,
6192
7008
  groupBy,
6193
7009
  pivotBy,
7010
+ filterValue,
6194
7011
  cursorId: livePagination ? stateCursorId : null
6195
7012
  };
6196
- const initialRef = (0, import_react32.useRef)(true);
7013
+ const initialRef = (0, import_react36.useRef)(true);
6197
7014
  useLazyLoadRange();
6198
7015
  useEffectWithChanges(() => {
6199
7016
  const componentState2 = getComponentState();
@@ -6225,7 +7042,7 @@ function useLazyLoadRange() {
6225
7042
  componentActions: actions,
6226
7043
  componentState
6227
7044
  } = useComponentState();
6228
- (0, import_react32.useEffect)(() => {
7045
+ (0, import_react36.useEffect)(() => {
6229
7046
  actions.lazyLoadCacheOfLoadedBatches = new DeepMap();
6230
7047
  }, [componentState.data, componentState.dataParams]);
6231
7048
  const {
@@ -6234,7 +7051,7 @@ function useLazyLoadRange() {
6234
7051
  dataArray,
6235
7052
  scrollStopDelayUpdatedByTable
6236
7053
  } = componentState;
6237
- const latestRenderRangeRef = (0, import_react32.useRef)(null);
7054
+ const latestRenderRangeRef = (0, import_react36.useRef)(null);
6238
7055
  const loadRange = (renderRange, cache = getComponentState().lazyLoadCacheOfLoadedBatches) => {
6239
7056
  const componentState2 = getComponentState();
6240
7057
  renderRange = renderRange || latestRenderRangeRef.current;
@@ -6253,8 +7070,8 @@ function useLazyLoadRange() {
6253
7070
  componentActions: actions
6254
7071
  }, cache);
6255
7072
  };
6256
- const debouncedLoadRange = (0, import_react32.useMemo)(() => debounce(loadRange, { wait: scrollStopDelayUpdatedByTable }), [scrollStopDelayUpdatedByTable]);
6257
- (0, import_react32.useEffect)(() => {
7073
+ const debouncedLoadRange = (0, import_react36.useMemo)(() => debounce(loadRange, { wait: scrollStopDelayUpdatedByTable }), [scrollStopDelayUpdatedByTable]);
7074
+ (0, import_react36.useEffect)(() => {
6258
7075
  if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
6259
7076
  return notifyRenderRangeChange.onChange((renderRange) => {
6260
7077
  latestRenderRangeRef.current = renderRange;
@@ -6263,7 +7080,7 @@ function useLazyLoadRange() {
6263
7080
  }
6264
7081
  return;
6265
7082
  }, [lazyLoadBatchSize]);
6266
- (0, import_react32.useEffect)(() => {
7083
+ (0, import_react36.useEffect)(() => {
6267
7084
  if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
6268
7085
  debouncedLoadRange();
6269
7086
  }
@@ -6296,7 +7113,7 @@ function lazyLoadRange(options, cache) {
6296
7113
  theGroupKeys.pop();
6297
7114
  }
6298
7115
  const cacheKeys = theGroupKeys.length ? theGroupKeys : rootGroupKeys;
6299
- const indexInGroup = rowInfo.isGroupRow ? rowInfo.indexInGroup : rowInfo.indexInAll;
7116
+ const indexInGroup = rowInfo.dataSourceHasGrouping ? rowInfo.indexInGroup : rowInfo.indexInAll;
6300
7117
  if (rowInfo.isGroupRow && !rowInfo.collapsed && !rowInfo.childrenAvailable) {
6301
7118
  const currentFnCall = {
6302
7119
  lazyLoadStartIndex: 0,
@@ -6319,7 +7136,7 @@ function lazyLoadRange(options, cache) {
6319
7136
  if (!rowLoaded) {
6320
7137
  let cachedFnCalls = perGroupFnCalls.get(cacheKeys);
6321
7138
  const batchStartIndexInGroup = Math.floor(indexInGroup / lazyLoadBatchSize) * lazyLoadBatchSize;
6322
- const offset = (rowInfo.isGroupRow ? rowInfo.indexInGroup : rowInfo.indexInAll) - batchStartIndexInGroup;
7139
+ const offset = indexInGroup - batchStartIndexInGroup;
6323
7140
  const absoluteIndexOfBatchStart = dataArray[rowInfo.indexInAll - offset].indexInAll;
6324
7141
  const batchStartRowLoaded = isRowLoaded(absoluteIndexOfBatchStart);
6325
7142
  const batchStartRowId = dataArray[absoluteIndexOfBatchStart].id;
@@ -6355,177 +7172,67 @@ function lazyLoadRange(options, cache) {
6355
7172
  const args = [componentState.data, componentState, componentActions, fnCall];
6356
7173
  return promise.then(() => getRafPromise()).then(() => loadData(...args));
6357
7174
  }, initialPromise);
6358
- }
6359
-
6360
- // src/utils/shallowEqualObjects.ts
6361
- function shallowEqualObjects(objA, objB, ignoreKeys) {
6362
- if (objA === objB) {
6363
- return true;
6364
- }
6365
- if (!objA || !objB) {
6366
- return false;
6367
- }
6368
- var aKeys = Object.keys(objA);
6369
- var bKeys = Object.keys(objB);
6370
- if (ignoreKeys) {
6371
- aKeys = aKeys.filter((key2) => !ignoreKeys.has(key2));
6372
- bKeys = bKeys.filter((key2) => !ignoreKeys.has(key2));
6373
- }
6374
- var len = aKeys.length;
6375
- if (bKeys.length !== len) {
6376
- return false;
6377
- }
6378
- for (var i = 0; i < len; i++) {
6379
- var key = aKeys[i];
6380
- if (ignoreKeys) {
6381
- if (ignoreKeys.has(key)) {
6382
- continue;
6383
- }
6384
- }
6385
- if (objA[key] !== objB[key] || !Object.prototype.hasOwnProperty.call(objB, key)) {
6386
- return false;
6387
- }
6388
- }
6389
- return true;
6390
- }
6391
-
6392
- // src/components/utils/discardCallsWithEqualArg.ts
6393
- var map = new WeakMap();
6394
- var getCompareDefault = (a) => a;
6395
- function discardCallsWithEqualArg(fn, timeframe = 50, getCompareObject) {
6396
- map.set(fn, {
6397
- lastCallTime: 0,
6398
- lastCallArg: null
6399
- });
6400
- const getCompare = getCompareObject != null ? getCompareObject : getCompareDefault;
6401
- return (arg) => {
6402
- const { lastCallTime, lastCallArg } = map.get(fn) || {
6403
- lastCallTime: 0,
6404
- lastCallArg: null
6405
- };
6406
- const now = Date.now();
6407
- const diff = now - lastCallTime;
6408
- const objectsEqual = shallowEqualObjects(getCompare(lastCallArg), getCompare(arg));
6409
- if (diff < timeframe && objectsEqual) {
6410
- return;
6411
- }
6412
- map.set(fn, {
6413
- lastCallTime: now,
6414
- lastCallArg: arg
6415
- });
6416
- fn(arg);
6417
- };
6418
- }
6419
-
6420
- // src/components/DataSource/GroupRowsState.ts
6421
- var GroupRowsState = class {
6422
- constructor(state) {
6423
- this.update(state instanceof GroupRowsState ? state.getState() : state);
6424
- }
6425
- getState() {
6426
- var _a, _b, _c, _d;
6427
- return {
6428
- expandedRows: this.expandedAll ? true : (_b = (_a = this.expandedMap) == null ? void 0 : _a.topDownKeys()) != null ? _b : [],
6429
- collapsedRows: this.collapsedAll ? true : (_d = (_c = this.collapsedMap) == null ? void 0 : _c.topDownKeys()) != null ? _d : []
6430
- };
6431
- }
6432
- destroy() {
6433
- var _a, _b;
6434
- (_a = this.expandedMap) == null ? void 0 : _a.clear();
6435
- (_b = this.collapsedMap) == null ? void 0 : _b.clear();
6436
- delete this.expandedMap;
6437
- delete this.collapsedMap;
6438
- }
6439
- update(state) {
6440
- var _a, _b, _c, _d;
6441
- this.initialState = state;
6442
- const { collapsedRows, expandedRows } = this.initialState;
6443
- this.collapsedAll = collapsedRows === true;
6444
- this.expandedAll = expandedRows === true;
6445
- if (this.collapsedAll && this.expandedAll) {
6446
- throw `Cannot have both collapsedRows and expandedRows be true!`;
6447
- }
6448
- if (collapsedRows !== true) {
6449
- (_a = this.collapsedMap) == null ? void 0 : _a.clear();
6450
- this.collapsedMap = (_b = this.collapsedMap) != null ? _b : new DeepMap(collapsedRows.map((keys) => [keys, true]));
6451
- }
6452
- if (expandedRows !== true) {
6453
- (_c = this.expandedMap) == null ? void 0 : _c.clear();
6454
- this.expandedMap = (_d = this.expandedMap) != null ? _d : new DeepMap(expandedRows.map((keys) => [keys, true]));
6455
- }
6456
- }
6457
- areAllCollapsed() {
6458
- return this.collapsedAll && (this.expandedMap ? this.expandedMap.size === 0 : true);
6459
- }
6460
- areAllExpanded() {
6461
- return this.expandedAll && (this.collapsedMap ? this.collapsedMap.size === 0 : true);
6462
- }
6463
- collapseAll() {
6464
- this.update({
6465
- collapsedRows: true,
6466
- expandedRows: []
6467
- });
6468
- }
6469
- expandAll() {
6470
- this.update({
6471
- expandedRows: true,
6472
- collapsedRows: []
6473
- });
6474
- }
6475
- isGroupRowExpanded(keys) {
6476
- var _a, _b;
6477
- if (this.expandedAll === true) {
6478
- if (this.collapsedAll === true) {
6479
- throw 'Cannot have both expandedRows and collapsedRows be "true"';
6480
- }
6481
- return !((_a = this.collapsedMap) == null ? void 0 : _a.has(keys));
6482
- }
6483
- return (_b = this.expandedMap) == null ? void 0 : _b.has(keys);
6484
- }
6485
- isGroupRowCollapsed(keys) {
6486
- return !this.isGroupRowExpanded(keys);
6487
- }
6488
- setGroupRowExpanded(keys, shouldExpand) {
6489
- var _a;
6490
- if (shouldExpand === this.isGroupRowExpanded(keys)) {
6491
- return;
6492
- }
6493
- if (shouldExpand) {
6494
- if (this.collapsedAll === true) {
6495
- if (!this.expandedMap) {
6496
- throw `No expandedMap found when trying to expand group row ${keys.join(",")}`;
6497
- }
6498
- this.expandedMap.set(keys, true);
6499
- } else if (this.expandedAll === true) {
6500
- if (!this.collapsedMap) {
6501
- throw `No collapsedMap found when trying to expand group row ${keys.join(",")}`;
6502
- }
6503
- this.collapsedMap.delete(keys);
6504
- }
6505
- } else {
6506
- if (this.expandedAll === true) {
6507
- if (!this.collapsedMap) {
6508
- throw `No collapsedMap found when trying to collapse group row ${keys.join(",")}`;
6509
- }
6510
- this.collapsedMap.set(keys, true);
6511
- } else if (this.collapsedAll === true) {
6512
- if (!this.expandedMap) {
6513
- throw `No expandedMap found when trying to collapse group row ${keys.join(",")}`;
6514
- }
6515
- (_a = this.expandedMap) == null ? void 0 : _a.delete(keys);
6516
- }
6517
- }
7175
+ }
7176
+
7177
+ // src/utils/shallowEqualObjects.ts
7178
+ function shallowEqualObjects(objA, objB, ignoreKeys) {
7179
+ if (objA === objB) {
7180
+ return true;
6518
7181
  }
6519
- collapseGroupRow(keys) {
6520
- this.setGroupRowExpanded(keys, false);
7182
+ if (!objA || !objB) {
7183
+ return false;
6521
7184
  }
6522
- expandGroupRow(keys) {
6523
- this.setGroupRowExpanded(keys, true);
7185
+ var aKeys = Object.keys(objA);
7186
+ var bKeys = Object.keys(objB);
7187
+ if (ignoreKeys) {
7188
+ aKeys = aKeys.filter((key2) => !ignoreKeys.has(key2));
7189
+ bKeys = bKeys.filter((key2) => !ignoreKeys.has(key2));
6524
7190
  }
6525
- toggleGroupRow(keys) {
6526
- this.setGroupRowExpanded(keys, !this.isGroupRowExpanded(keys));
7191
+ var len = aKeys.length;
7192
+ if (bKeys.length !== len) {
7193
+ return false;
6527
7194
  }
6528
- };
7195
+ for (var i = 0; i < len; i++) {
7196
+ var key = aKeys[i];
7197
+ if (ignoreKeys) {
7198
+ if (ignoreKeys.has(key)) {
7199
+ continue;
7200
+ }
7201
+ }
7202
+ if (objA[key] !== objB[key] || !Object.prototype.hasOwnProperty.call(objB, key)) {
7203
+ return false;
7204
+ }
7205
+ }
7206
+ return true;
7207
+ }
7208
+
7209
+ // src/components/utils/discardCallsWithEqualArg.ts
7210
+ var map = new WeakMap();
7211
+ var getCompareDefault = (a) => a;
7212
+ function discardCallsWithEqualArg(fn, timeframe = 50, getCompareObject) {
7213
+ map.set(fn, {
7214
+ lastCallTime: 0,
7215
+ lastCallArg: null
7216
+ });
7217
+ const getCompare = getCompareObject != null ? getCompareObject : getCompareDefault;
7218
+ return (arg) => {
7219
+ const { lastCallTime, lastCallArg } = map.get(fn) || {
7220
+ lastCallTime: 0,
7221
+ lastCallArg: null
7222
+ };
7223
+ const now = Date.now();
7224
+ const diff = now - lastCallTime;
7225
+ const objectsEqual = shallowEqualObjects(getCompare(lastCallArg), getCompare(arg));
7226
+ if (diff < timeframe && objectsEqual) {
7227
+ return;
7228
+ }
7229
+ map.set(fn, {
7230
+ lastCallTime: now,
7231
+ lastCallArg: arg
7232
+ });
7233
+ fn(arg);
7234
+ };
7235
+ }
6529
7236
 
6530
7237
  // src/components/DataSource/state/normalizeSortInfo.ts
6531
7238
  var EMPTY_ARRAY = Object.freeze([]);
@@ -6572,9 +7279,12 @@ function initSetupState() {
6572
7279
  pivotColumns: void 0,
6573
7280
  pivotColumnGroups: void 0,
6574
7281
  dataArray,
7282
+ unfilteredCount: dataArray.length,
7283
+ filteredCount: dataArray.length,
6575
7284
  updatedAt: now,
6576
7285
  groupedAt: 0,
6577
7286
  sortedAt: 0,
7287
+ filteredAt: 0,
6578
7288
  reducedAt: now,
6579
7289
  generateGroupRows: true,
6580
7290
  groupDeepMap: void 0,
@@ -6597,6 +7307,16 @@ var forwardProps2 = (setupState) => {
6597
7307
  pivotBy: 1,
6598
7308
  primaryKey: 1,
6599
7309
  livePagination: 1,
7310
+ filterFunction: 1,
7311
+ filterValue: 1,
7312
+ filterDelay: (filterDelay) => filterDelay != null ? filterDelay : 200,
7313
+ filterTypes: (filterTypes) => {
7314
+ return __spreadValues(__spreadValues({}, defaultFilterTypes), filterTypes);
7315
+ },
7316
+ sortTypes: (sortTypes) => {
7317
+ return __spreadValues(__spreadValues({}, sortTypes_default), sortTypes);
7318
+ },
7319
+ sortMode: (sortMode) => sortMode != null ? sortMode : "local",
6600
7320
  aggregationReducers: 1,
6601
7321
  collapseGroupRowsOnDataFunctionChange: (collapseGroupRowsOnDataFunctionChange) => collapseGroupRowsOnDataFunctionChange != null ? collapseGroupRowsOnDataFunctionChange : true,
6602
7322
  loading: (loading) => loading != null ? loading : false,
@@ -6622,10 +7342,25 @@ function getLivePaginationCursorValue(livePaginationCursorProp, state) {
6622
7342
  return livePaginationCursor;
6623
7343
  }
6624
7344
  function mapPropsToState(params) {
7345
+ var _a;
6625
7346
  const { props, state, oldState } = params;
6626
7347
  const controlledSort = isControlledValue(props.sortInfo);
7348
+ const controlledFilter = isControlledValue(props.filterValue);
7349
+ const { filterTypes } = state;
7350
+ const operatorsByFilterType = Object.keys(filterTypes).reduce((acc, key) => {
7351
+ const operators = filterTypes[key].operators;
7352
+ acc[key] = acc[key] || {};
7353
+ const currentFilterTypeOperators = acc[key];
7354
+ operators.forEach((operator) => {
7355
+ currentFilterTypeOperators[operator.name] = operator;
7356
+ });
7357
+ return acc;
7358
+ }, {});
6627
7359
  const result = {
7360
+ operatorsByFilterType,
6628
7361
  controlledSort,
7362
+ controlledFilter,
7363
+ filterMode: ((_a = props.filterMode) != null ? _a : props.filterFunction != null) ? "local" : typeof props.data === "function" ? "remote" : "local",
6629
7364
  multiSort: Array.isArray(controlledSort ? props.sortInfo : props.defaultSortInfo),
6630
7365
  lazyLoadBatchSize: typeof props.lazyLoad === "object" ? props.lazyLoad.batchSize : void 0
6631
7366
  };
@@ -6690,6 +7425,18 @@ function getInterceptActions() {
6690
7425
  });
6691
7426
  }
6692
7427
  },
7428
+ filterValue: (filterValue, { actions, state }) => {
7429
+ const dataParams = buildDataSourceDataParams(state, {
7430
+ filterValue,
7431
+ livePaginationCursor: null
7432
+ });
7433
+ actions.dataParams = dataParams;
7434
+ if (state.livePagination) {
7435
+ requestAnimationFrame(() => {
7436
+ actions.livePaginationCursor = null;
7437
+ });
7438
+ }
7439
+ },
6693
7440
  cursorId: (cursorId, { actions, state }) => {
6694
7441
  const dataParams = buildDataSourceDataParams(state, {
6695
7442
  __cursorId: cursorId
@@ -6771,7 +7518,7 @@ function getPivotColumnsAndColumnGroups({
6771
7518
  pivotGroupKeys: [],
6772
7519
  pivotGroupKey: "",
6773
7520
  pivotIndex: -1,
6774
- valueGetter: ({ rowInfo }) => {
7521
+ valueFormatter: ({ rowInfo }) => {
6775
7522
  var _a;
6776
7523
  return rowInfo.isGroupRow ? (_a = rowInfo.reducerResults) == null ? void 0 : _a[reducer.id] : null;
6777
7524
  }
@@ -6820,7 +7567,7 @@ function getPivotColumnsAndColumnGroups({
6820
7567
  sortable: false,
6821
7568
  columnGroup: parentColumnGroupId,
6822
7569
  header,
6823
- valueGetter: ({ rowInfo }) => {
7570
+ valueFormatter: ({ rowInfo }) => {
6824
7571
  var _a, _b;
6825
7572
  if (!rowInfo.isGroupRow) {
6826
7573
  return null;
@@ -6875,7 +7622,7 @@ function getPivotColumnsAndColumnGroups({
6875
7622
  pivotIndex: keys.length - 1,
6876
7623
  pivotBy,
6877
7624
  sortable: false,
6878
- valueGetter: ({ rowInfo }) => {
7625
+ valueFormatter: ({ rowInfo }) => {
6879
7626
  var _a, _b;
6880
7627
  if (!rowInfo.isGroupRow) {
6881
7628
  return null;
@@ -6923,9 +7670,68 @@ function toRowInfo(data, id, index) {
6923
7670
  selfLoaded: true
6924
7671
  };
6925
7672
  }
7673
+ function filterDataSource(params) {
7674
+ const {
7675
+ filterTypes,
7676
+ filterValue: filterValueArray,
7677
+ operatorsByFilterType,
7678
+ filterFunction,
7679
+ toPrimaryKey
7680
+ } = params;
7681
+ let { dataArray } = params;
7682
+ if (filterFunction) {
7683
+ dataArray = dataArray.filter((data, index, arr) => filterFunction({
7684
+ data,
7685
+ index,
7686
+ dataArray: arr,
7687
+ primaryKey: toPrimaryKey(data, index)
7688
+ }));
7689
+ }
7690
+ if (filterValueArray && filterValueArray.length) {
7691
+ return dataArray.filter((data, index, arr) => {
7692
+ var _a;
7693
+ const param = {
7694
+ data,
7695
+ index,
7696
+ dataArray: arr,
7697
+ primaryKey: toPrimaryKey(data, index)
7698
+ };
7699
+ for (let i = 0, len = filterValueArray.length; i < len; i++) {
7700
+ const currentFilterValue = filterValueArray[i];
7701
+ const {
7702
+ disabled,
7703
+ filterValue,
7704
+ field,
7705
+ filterType: filterTypeKey,
7706
+ valueGetter,
7707
+ operator
7708
+ } = currentFilterValue;
7709
+ const filterType = filterTypes[filterTypeKey];
7710
+ if (disabled || !filterType) {
7711
+ continue;
7712
+ }
7713
+ const currentOperator = (_a = operatorsByFilterType[filterTypeKey]) == null ? void 0 : _a[operator];
7714
+ if (!currentOperator) {
7715
+ continue;
7716
+ }
7717
+ const getter = valueGetter || (({ data: data2 }) => field ? data2[field] : data2);
7718
+ const operatorFnParam = __spreadValues({}, param);
7719
+ operatorFnParam.filterValue = filterValue;
7720
+ operatorFnParam.currentValue = getter(param);
7721
+ operatorFnParam.emptyValues = filterType.emptyValues;
7722
+ if (!currentOperator.fn(operatorFnParam)) {
7723
+ return false;
7724
+ }
7725
+ }
7726
+ return true;
7727
+ });
7728
+ }
7729
+ return dataArray;
7730
+ }
6926
7731
  function concludeReducer(params) {
6927
7732
  var _a, _b;
6928
7733
  const { state, previousState } = params;
7734
+ const primaryKeyDescriptor = state.primaryKey;
6929
7735
  const sortInfo = state.sortInfo;
6930
7736
  let shouldSort = !!(sortInfo == null ? void 0 : sortInfo.length) && !state.controlledSort;
6931
7737
  if (state.lazyLoad || state.livePagination) {
@@ -6943,15 +7749,24 @@ function concludeReducer(params) {
6943
7749
  state.originalLazyGroupData = new DeepMap();
6944
7750
  originalDataArrayChanged = true;
6945
7751
  }
7752
+ const { filterFunction, filterValue, filterTypes, operatorsByFilterType } = state;
7753
+ const shouldFilter = !!filterFunction || Array.isArray(filterValue) && filterValue.length;
7754
+ const shouldFilterClientSide = shouldFilter && state.filterMode === "local";
7755
+ const filterDepsChanged = haveDepsChanged(previousState, state, [
7756
+ "filterFunction",
7757
+ "filterValue",
7758
+ "filterTypes"
7759
+ ]);
7760
+ const filterChanged = originalDataArrayChanged || filterDepsChanged;
6946
7761
  const sortInfoChanged = haveDepsChanged(previousState, state, ["sortInfo"]);
6947
- const sortDepsChanged = originalDataArrayChanged || sortInfoChanged;
7762
+ const sortDepsChanged = originalDataArrayChanged || filterDepsChanged || sortInfoChanged;
7763
+ const shouldFilterAgain = state.filterMode === "local" && (filterChanged || !state.lastFilterDataArray);
6948
7764
  const shouldSortAgain = shouldSort && (sortDepsChanged || !state.lastSortDataArray);
6949
7765
  const groupBy = state.groupBy;
6950
7766
  const pivotBy = state.pivotBy;
6951
7767
  const shouldGroup = groupBy.length > 0 || !!pivotBy;
6952
- const groupsDepsChanged = originalDataArrayChanged || haveDepsChanged(previousState, state, [
7768
+ const groupsDepsChanged = originalDataArrayChanged || sortDepsChanged || haveDepsChanged(previousState, state, [
6953
7769
  "generateGroupRows",
6954
- "originalDataArray",
6955
7770
  "originalLazyGroupData",
6956
7771
  "originalLazyGroupDataChangeDetect",
6957
7772
  "groupBy",
@@ -6960,23 +7775,44 @@ function concludeReducer(params) {
6960
7775
  "aggregationReducers",
6961
7776
  "pivotTotalColumnPosition",
6962
7777
  "pivotGrandTotalColumnPosition",
6963
- "showSeparatePivotColumnForSingleAggregation",
6964
- "sortInfo"
7778
+ "showSeparatePivotColumnForSingleAggregation"
6965
7779
  ]);
6966
7780
  const shouldGroupAgain = shouldGroup && (groupsDepsChanged || !state.lastGroupDataArray);
6967
7781
  const now = Date.now();
6968
7782
  let dataArray = state.originalDataArray;
6969
- let rowInfoDataArray = state.dataArray;
6970
- if (shouldSort) {
7783
+ const toPrimaryKey = typeof primaryKeyDescriptor === "function" ? (data, index) => primaryKeyDescriptor({ data, index }) : (data, _index) => {
7784
+ const pk = data[primaryKeyDescriptor];
7785
+ return pk;
7786
+ };
7787
+ if (!shouldFilter) {
7788
+ state.unfilteredCount = dataArray.length;
7789
+ }
7790
+ if (shouldFilterClientSide) {
7791
+ state.unfilteredCount = dataArray.length;
7792
+ dataArray = shouldFilterAgain ? filterDataSource({
7793
+ dataArray,
7794
+ toPrimaryKey,
7795
+ filterTypes,
7796
+ operatorsByFilterType,
7797
+ filterFunction,
7798
+ filterValue
7799
+ }) : state.lastFilterDataArray;
7800
+ state.lastFilterDataArray = dataArray;
7801
+ state.filteredAt = now;
7802
+ }
7803
+ state.filteredCount = dataArray.length;
7804
+ state.postFilterDataArray = dataArray;
7805
+ const shouldSortClientSide = shouldSort && state.sortMode === "local";
7806
+ if (shouldSortClientSide) {
7807
+ const prevKnownTypes = multisort.knownTypes;
7808
+ multisort.knownTypes = state.sortTypes;
6971
7809
  dataArray = shouldSortAgain ? multisort(sortInfo, [...dataArray]) : state.lastSortDataArray;
7810
+ multisort.knownTypes = prevKnownTypes;
6972
7811
  state.lastSortDataArray = dataArray;
6973
7812
  state.sortedAt = now;
6974
7813
  }
6975
7814
  state.postSortDataArray = dataArray;
6976
- const toPrimaryKey = (data) => {
6977
- const pk = data[state.primaryKey];
6978
- return pk;
6979
- };
7815
+ let rowInfoDataArray = state.dataArray;
6980
7816
  if (shouldGroup) {
6981
7817
  if (shouldGroupAgain) {
6982
7818
  const groupResult = state.lazyLoad ? lazyGroup({
@@ -7019,7 +7855,7 @@ function concludeReducer(params) {
7019
7855
  state.pivotColumns = void 0;
7020
7856
  const arrayDifferentAfterSortStep = previousState.postSortDataArray != state.postSortDataArray;
7021
7857
  if (arrayDifferentAfterSortStep || groupsDepsChanged) {
7022
- rowInfoDataArray = dataArray.map((data, index) => toRowInfo(data, data ? toPrimaryKey(data) : index, index));
7858
+ rowInfoDataArray = dataArray.map((data, index) => toRowInfo(data, data ? toPrimaryKey(data, index) : index, index));
7023
7859
  }
7024
7860
  }
7025
7861
  state.postGroupDataArray = rowInfoDataArray;
@@ -7047,7 +7883,7 @@ function DataSourceWithContext(props) {
7047
7883
  if (typeof children === "function") {
7048
7884
  children = children(computedValues);
7049
7885
  }
7050
- return /* @__PURE__ */ React26.createElement(React26.Fragment, null, children);
7886
+ return /* @__PURE__ */ React31.createElement(React31.Fragment, null, children);
7051
7887
  }
7052
7888
  var DataSourceRoot = getComponentStateRoot({
7053
7889
  initSetupState,
@@ -7070,14 +7906,14 @@ function DataSourceCmp({ children }) {
7070
7906
  globalThis.getDataSourceState = getState;
7071
7907
  }
7072
7908
  useLoadData();
7073
- return /* @__PURE__ */ React26.createElement(DataSourceContext.Provider, {
7909
+ return /* @__PURE__ */ React31.createElement(DataSourceContext.Provider, {
7074
7910
  value: contextValue
7075
- }, /* @__PURE__ */ React26.createElement(DataSourceWithContext, {
7911
+ }, /* @__PURE__ */ React31.createElement(DataSourceWithContext, {
7076
7912
  children
7077
7913
  }));
7078
7914
  }
7079
7915
  function DataSource(props) {
7080
- return /* @__PURE__ */ React26.createElement(DataSourceRoot, __spreadValues({}, props), /* @__PURE__ */ React26.createElement(DataSourceCmp, {
7916
+ return /* @__PURE__ */ React31.createElement(DataSourceRoot, __spreadValues({}, props), /* @__PURE__ */ React31.createElement(DataSourceCmp, {
7081
7917
  children: props.children
7082
7918
  }));
7083
7919
  }
@@ -7085,7 +7921,7 @@ function DataSource(props) {
7085
7921
  // src/components/InfiniteTable/hooks/useToggleGroupRow.ts
7086
7922
  function useToggleGroupRow() {
7087
7923
  const { getState: getDataSourceState, componentActions: dataSourceActions } = useDataSourceContextValue();
7088
- const toggleGroupRow = (0, import_react33.useCallback)((groupKeys) => {
7924
+ const toggleGroupRow = (0, import_react37.useCallback)((groupKeys) => {
7089
7925
  const state = getDataSourceState();
7090
7926
  const newState = new GroupRowsState(state.groupRowsState);
7091
7927
  newState.toggleGroupRow(groupKeys);
@@ -7117,7 +7953,7 @@ function useToggleGroupRow() {
7117
7953
 
7118
7954
  // src/components/InfiniteTable/hooks/useColumnsWhen.ts
7119
7955
  function useGroupByMap(groupBy) {
7120
- const groupByMap = (0, import_react34.useMemo)(() => {
7956
+ const groupByMap = (0, import_react38.useMemo)(() => {
7121
7957
  return groupBy.reduce((acc, groupBy2, index) => {
7122
7958
  acc.set(groupBy2.field, {
7123
7959
  groupBy: groupBy2,
@@ -7141,13 +7977,13 @@ function useColumnsWhen() {
7141
7977
  }
7142
7978
  } = useComponentState();
7143
7979
  const groupByMap = useGroupByMap(groupBy);
7144
- (0, import_react34.useEffect)(() => {
7980
+ (0, import_react38.useEffect)(() => {
7145
7981
  dataSourceActions.generateGroupRows = groupRenderStrategy !== "inline";
7146
7982
  }, [groupRenderStrategy]);
7147
- (0, import_react34.useEffect)(() => {
7983
+ (0, import_react38.useEffect)(() => {
7148
7984
  dataSourceActions.pivotTotalColumnPosition = pivotTotalColumnPosition;
7149
7985
  }, [pivotTotalColumnPosition]);
7150
- (0, import_react34.useEffect)(() => {
7986
+ (0, import_react38.useEffect)(() => {
7151
7987
  if (pivotGrandTotalColumnPosition != void 0) {
7152
7988
  dataSourceActions.pivotGrandTotalColumnPosition = pivotGrandTotalColumnPosition;
7153
7989
  }
@@ -7177,7 +8013,7 @@ function useColumnsWhenInlineGroupRenderStrategy(groupByMap) {
7177
8013
  base = {
7178
8014
  groupByField: field,
7179
8015
  field,
7180
- valueGetter: ({ rowInfo }) => {
8016
+ valueFormatter: ({ rowInfo }) => {
7181
8017
  var _a;
7182
8018
  return rowInfo.isGroupRow ? (_a = rowInfo.groupKeys) == null ? void 0 : _a[groupIndex] : rowInfo.value;
7183
8019
  },
@@ -7221,7 +8057,7 @@ function useColumnsWhenInlineGroupRenderStrategy(groupByMap) {
7221
8057
  });
7222
8058
  return computedColumns.size === 0 ? void 0 : computedColumns;
7223
8059
  }
7224
- (0, import_react34.useEffect)(() => {
8060
+ (0, import_react38.useEffect)(() => {
7225
8061
  const update = () => {
7226
8062
  componentActions.columnsWhenInlineGroupRenderStrategy = computeColumnsWhenInlineGroupRenderStrategy(columns, groupByMap, groupRenderStrategy, toggleGroupRow);
7227
8063
  };
@@ -7250,7 +8086,7 @@ function useColumnsWhenGrouping() {
7250
8086
  }
7251
8087
  } = useComponentState();
7252
8088
  const toggleGroupRow = useToggleGroupRow();
7253
- (0, import_react34.useEffect)(() => {
8089
+ (0, import_react38.useEffect)(() => {
7254
8090
  const update = () => {
7255
8091
  const columnsWhenGrouping = getColumnsWhenGrouping({
7256
8092
  columns,
@@ -7386,7 +8222,7 @@ function useHideColumns(groupByMap) {
7386
8222
  hideEmptyGroupColumns ? groupRowsState : null,
7387
8223
  hideEmptyGroupColumns
7388
8224
  ]);
7389
- (0, import_react34.useEffect)(() => {
8225
+ (0, import_react38.useEffect)(() => {
7390
8226
  const isGrouped = groupBy.length > 0;
7391
8227
  const currentState = getComponentState();
7392
8228
  const { controlledColumnVisibility, columnVisibility } = currentState;
@@ -7501,7 +8337,7 @@ function getColumnsWhenGrouping(params) {
7501
8337
  }
7502
8338
 
7503
8339
  // src/components/InfiniteTable/hooks/useComputedVisibleColumns.ts
7504
- var import_react36 = __toModule(require("react"));
8340
+ var import_react40 = __toModule(require("react"));
7505
8341
 
7506
8342
  // src/components/flexbox/index.ts
7507
8343
  var computeFlex = (params) => {
@@ -7658,7 +8494,9 @@ var adjustColumnOrderForPinning = (columnOrder, columnPinning) => {
7658
8494
  };
7659
8495
 
7660
8496
  // src/components/InfiniteTable/utils/getColumnComputedType.ts
7661
- var emptyType = Object.freeze({});
8497
+ var emptyType = Object.freeze({
8498
+ filterType: "string"
8499
+ });
7662
8500
  function getColumnComputedType(column, columnTypes) {
7663
8501
  const defaultType = columnTypes["default"] || emptyType;
7664
8502
  if (column.type === void 0) {
@@ -7674,22 +8512,6 @@ function getColumnComputedType(column, columnTypes) {
7674
8512
  return column.type.reduce((acc, columnType) => Object.assign(acc, columnTypes[columnType]), {});
7675
8513
  }
7676
8514
 
7677
- // src/components/InfiniteTable/utils/assignFiltered.ts
7678
- function assignFiltered(filterFn, target, ...rest) {
7679
- let result = target;
7680
- rest.forEach((obj) => {
7681
- for (const key in obj) {
7682
- if (obj.hasOwnProperty(key) && filterFn(obj[key], key)) {
7683
- result[key] = obj[key];
7684
- }
7685
- }
7686
- });
7687
- return result;
7688
- }
7689
- function assignNonNull(target, ...rest) {
7690
- return assignFiltered((value) => value != null, target, ...rest);
7691
- }
7692
-
7693
8515
  // src/components/InfiniteTable/utils/getComputedVisibleColumns.ts
7694
8516
  var logError = err("getComputedVisibleColumns");
7695
8517
  var isColumnVisible = (columnVisibility, _columnVisibilityAssumeVisible, colId) => {
@@ -7710,6 +8532,7 @@ var getComputedVisibleColumns = ({
7710
8532
  columnHeaderCssEllipsis,
7711
8533
  pinnedStartMaxWidth,
7712
8534
  pinnedEndMaxWidth,
8535
+ filterValue,
7713
8536
  sortable,
7714
8537
  sortInfo,
7715
8538
  setSortInfo,
@@ -7724,9 +8547,19 @@ var getComputedVisibleColumns = ({
7724
8547
  columnVisibilityAssumeVisible
7725
8548
  }) => {
7726
8549
  let computedOffset = 0;
8550
+ const filterValueRecord = (filterValue || []).reduce((acc, filterValueItem) => {
8551
+ const { id, field } = filterValueItem;
8552
+ if (field) {
8553
+ acc[field] = filterValueItem;
8554
+ }
8555
+ if (id) {
8556
+ acc[id] = filterValueItem;
8557
+ }
8558
+ return acc;
8559
+ }, {});
7727
8560
  const normalizedColumnOrder = adjustColumnOrderForPinning(columnOrder === true ? [...columns.keys()] : columnOrder, columnPinning);
7728
8561
  const visibleColumnOrder = normalizedColumnOrder.filter((colId) => {
7729
- let col = columns.get(colId);
8562
+ const col = columns.get(colId);
7730
8563
  if (!col) {
7731
8564
  logError(`Column with id "${colId}" specified in columnOrder array cannot be found in the columns map.`);
7732
8565
  return false;
@@ -7774,7 +8607,7 @@ var getComputedVisibleColumns = ({
7774
8607
  delete colTypeSizing.width;
7775
8608
  }
7776
8609
  colSizing = assignNonNull(colTypeSizing, colSizing);
7777
- let colFlex = (_a = colSizing.flex) != null ? _a : void 0;
8610
+ const colFlex = (_a = colSizing.flex) != null ? _a : void 0;
7778
8611
  const colMinWidth = (_c = (_b = colSizing.minWidth) != null ? _b : column == null ? void 0 : column.minWidth) != null ? _c : columnMinWidth;
7779
8612
  const colMaxWidth = (_e = (_d = colSizing.maxWidth) != null ? _d : column == null ? void 0 : column.maxWidth) != null ? _e : columnMaxWidth;
7780
8613
  let size = colFlex != void 0 ? void 0 : (_f = colSizing.width) != null ? _f : columnDefaultWidth;
@@ -7817,7 +8650,7 @@ var getComputedVisibleColumns = ({
7817
8650
  });
7818
8651
  const firstPinnedEndAbsoluteOffset = bodySize.width - totalPinnedEndWidth;
7819
8652
  columnsArray.forEach((c, i) => {
7820
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
8653
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
7821
8654
  const id = visibleColumnOrder[i];
7822
8655
  const nextColumnId = visibleColumnOrder[i + 1];
7823
8656
  const colType = getColumnComputedType(c, columnTypes);
@@ -7828,47 +8661,6 @@ var getComputedVisibleColumns = ({
7828
8661
  const computedSortedDesc = computedSorted && !computedSortedAsc;
7829
8662
  const computedSortIndex = (_c = sortingInfo == null ? void 0 : sortingInfo.index) != null ? _c : -1;
7830
8663
  const computedWidth = computedSizes[i];
7831
- const toggleSort = () => {
7832
- let currentSortInfo = computedSortInfo;
7833
- let newColumnSortInfo;
7834
- if (!currentSortInfo) {
7835
- newColumnSortInfo = {
7836
- dir: 1,
7837
- id,
7838
- field: c.field,
7839
- type: c.type
7840
- };
7841
- } else {
7842
- if (computedSortedDesc) {
7843
- newColumnSortInfo = null;
7844
- } else {
7845
- newColumnSortInfo = __spreadProps(__spreadValues({}, computedSortInfo), {
7846
- dir: -1
7847
- });
7848
- }
7849
- }
7850
- if (c.field && newColumnSortInfo && !newColumnSortInfo.field) {
7851
- newColumnSortInfo.field = c.field;
7852
- }
7853
- let finalSortInfo = sortInfo ? [...sortInfo] : [];
7854
- if (multiSort) {
7855
- if (computedSortIndex === -1) {
7856
- if (newColumnSortInfo) {
7857
- finalSortInfo.push(newColumnSortInfo);
7858
- }
7859
- } else {
7860
- finalSortInfo = finalSortInfo.map((info, index) => {
7861
- if (index === computedSortIndex) {
7862
- return newColumnSortInfo;
7863
- }
7864
- return info;
7865
- }).filter((x) => x != null);
7866
- }
7867
- } else {
7868
- finalSortInfo = newColumnSortInfo ? [newColumnSortInfo] : [];
7869
- }
7870
- setSortInfo(finalSortInfo);
7871
- };
7872
8664
  const computedPinned = getComputedPinned(id, columnPinning);
7873
8665
  const computedLast = i === visibleColumnOrder.length - 1;
7874
8666
  const computedPinningOffset = computedPinned === "start" ? computedPinnedStartColumnsWidth : computedPinned === "end" ? computedPinnedEndColumnsWidth : computedOffset - computedPinnedStartColumnsWidth;
@@ -7877,23 +8669,46 @@ var getComputedVisibleColumns = ({
7877
8669
  const computedLastInCategory = computedLast || computedPinned !== getComputedPinned(nextColumnId, columnPinning);
7878
8670
  const cssEllipsis = (_e = (_d = c.cssEllipsis) != null ? _d : colType.cssEllipsis) != null ? _e : columnCssEllipsis;
7879
8671
  const headerCssEllipsis = (_j = (_i = (_h = (_g = (_f = c.headerCssEllipsis) != null ? _f : colType.cssEllipsis) != null ? _g : c.cssEllipsis) != null ? _h : colType.headerCssEllipsis) != null ? _i : columnHeaderCssEllipsis) != null ? _j : cssEllipsis;
8672
+ const computedFilterValue = filterValueRecord[id] || c.field ? filterValueRecord[c.field] || null : null;
8673
+ const computedFiltered = computedFilterValue != null;
8674
+ const computedFilterable = (_l = (_k = c.defaultFilterable) != null ? _k : colType.defaultFilterable) != null ? _l : true;
8675
+ const computedDataType = c.dataType || colType.dataType || (Array.isArray(c.type) ? c.type[0] : c.type) || "string";
8676
+ const computedSortType = c.sortType || colType.sortType || computedDataType;
8677
+ const computedFilterType = c.filterType || colType.filterType || computedDataType;
8678
+ const field = (_m = c.field) != null ? _m : colType.field;
8679
+ const valueGetter = (_n = c.valueGetter) != null ? _n : colType.valueGetter;
8680
+ let sortableColumnOrType = (_o = c.sortable) != null ? _o : colType.sortable;
8681
+ if (sortableColumnOrType == null) {
8682
+ if (field == null && valueGetter == null) {
8683
+ sortableColumnOrType = false;
8684
+ }
8685
+ }
8686
+ let computedSortable = (_p = sortableColumnOrType != null ? sortableColumnOrType : sortable) != null ? _p : true;
7880
8687
  const result2 = __spreadProps(__spreadValues({
7881
8688
  align: colType.align,
7882
8689
  verticalAlign: colType.verticalAlign,
7883
8690
  defaultHiddenWhenGroupedBy: colType.defaultHiddenWhenGroupedBy,
7884
- valueGetter: colType.valueGetter,
8691
+ valueGetter,
8692
+ valueFormatter: colType.valueFormatter,
7885
8693
  renderValue: colType.renderValue,
7886
8694
  render: colType.render,
7887
8695
  style: colType.style,
7888
- components: colType.components
8696
+ components: colType.components,
8697
+ field
7889
8698
  }, c), {
8699
+ computedDataType,
8700
+ computedSortType,
8701
+ computedFilterType,
7890
8702
  cssEllipsis,
7891
8703
  headerCssEllipsis,
8704
+ computedFilterValue,
8705
+ computedFiltered,
8706
+ computedFilterable,
7892
8707
  computedWidth,
7893
8708
  computedAbsoluteOffset,
7894
8709
  computedPinningOffset,
7895
8710
  computedOffset,
7896
- computedSortable: (_m = (_l = (_k = c.sortable) != null ? _k : colType.sortable) != null ? _l : sortable) != null ? _m : true,
8711
+ computedSortable,
7897
8712
  computedSortInfo,
7898
8713
  computedSortIndex,
7899
8714
  computedMultiSort: multiSort,
@@ -7902,14 +8717,57 @@ var getComputedVisibleColumns = ({
7902
8717
  computedSortedDesc,
7903
8718
  computedVisibleIndex: i,
7904
8719
  computedPinned,
7905
- computedDraggable: (_o = (_n = c.draggable) != null ? _n : draggableColumns) != null ? _o : true,
8720
+ computedDraggable: (_r = (_q = c.draggable) != null ? _q : draggableColumns) != null ? _r : true,
7906
8721
  computedFirstInCategory,
7907
8722
  computedLastInCategory,
7908
8723
  computedFirst: i === 0,
7909
8724
  computedLast,
7910
- toggleSort,
8725
+ toggleSort: () => {
8726
+ const currentSortInfo = computedSortInfo;
8727
+ let newColumnSortInfo;
8728
+ if (!currentSortInfo) {
8729
+ newColumnSortInfo = {
8730
+ dir: 1,
8731
+ id,
8732
+ field: c.field,
8733
+ type: computedSortType
8734
+ };
8735
+ } else {
8736
+ if (computedSortedDesc) {
8737
+ newColumnSortInfo = null;
8738
+ } else {
8739
+ newColumnSortInfo = __spreadProps(__spreadValues({}, computedSortInfo), {
8740
+ dir: -1
8741
+ });
8742
+ }
8743
+ }
8744
+ if (c.field && newColumnSortInfo && !newColumnSortInfo.field) {
8745
+ newColumnSortInfo.field = c.field;
8746
+ }
8747
+ if (c.valueGetter && newColumnSortInfo && !newColumnSortInfo.valueGetter) {
8748
+ newColumnSortInfo.valueGetter = (data) => c.valueGetter({ data, field: c.field });
8749
+ }
8750
+ let finalSortInfo = sortInfo ? [...sortInfo] : [];
8751
+ if (multiSort) {
8752
+ if (computedSortIndex === -1) {
8753
+ if (newColumnSortInfo) {
8754
+ finalSortInfo.push(newColumnSortInfo);
8755
+ }
8756
+ } else {
8757
+ finalSortInfo = finalSortInfo.map((info, index) => {
8758
+ if (index === computedSortIndex) {
8759
+ return newColumnSortInfo;
8760
+ }
8761
+ return info;
8762
+ }).filter((x) => x != null);
8763
+ }
8764
+ } else {
8765
+ finalSortInfo = newColumnSortInfo ? [newColumnSortInfo] : [];
8766
+ }
8767
+ setSortInfo(finalSortInfo);
8768
+ },
7911
8769
  id,
7912
- header: (_r = (_q = (_p = c.header) != null ? _p : colType.header) != null ? _q : c.name) != null ? _r : c.field
8770
+ header: (_u = (_t = (_s = c.header) != null ? _s : colType.header) != null ? _t : c.name) != null ? _u : c.field
7913
8771
  });
7914
8772
  computedOffset += computedWidth;
7915
8773
  computedVisibleColumnsMap.set(result2.id, result2);
@@ -7950,10 +8808,10 @@ var getComputedVisibleColumns = ({
7950
8808
  };
7951
8809
 
7952
8810
  // src/components/InfiniteTable/hooks/useRerenderOnKeyChange.ts
7953
- var import_react35 = __toModule(require("react"));
8811
+ var import_react39 = __toModule(require("react"));
7954
8812
  var useRerenderOnKeyChange = (map2) => {
7955
8813
  const [renderId, rerender] = useRerender();
7956
- (0, import_react35.useEffect)(() => {
8814
+ (0, import_react39.useEffect)(() => {
7957
8815
  const update = rafFn(rerender);
7958
8816
  return interceptMap(map2, {
7959
8817
  set: update,
@@ -7978,6 +8836,7 @@ var useComputedVisibleColumns = ({
7978
8836
  sortInfo,
7979
8837
  multiSort,
7980
8838
  setSortInfo,
8839
+ filterValue,
7981
8840
  columnOrder,
7982
8841
  columnPinning,
7983
8842
  columnTypes,
@@ -8005,7 +8864,7 @@ var useComputedVisibleColumns = ({
8005
8864
  computedPinnedEndOffset,
8006
8865
  computedPinnedEndWidth,
8007
8866
  computedPinnedStartWidth
8008
- } = (0, import_react36.useMemo)(() => {
8867
+ } = (0, import_react40.useMemo)(() => {
8009
8868
  return getComputedVisibleColumns({
8010
8869
  columns,
8011
8870
  bodySize,
@@ -8015,6 +8874,7 @@ var useComputedVisibleColumns = ({
8015
8874
  columnCssEllipsis,
8016
8875
  columnHeaderCssEllipsis,
8017
8876
  viewportReservedWidth,
8877
+ filterValue,
8018
8878
  sortable,
8019
8879
  sortInfo,
8020
8880
  setSortInfo,
@@ -8039,6 +8899,7 @@ var useComputedVisibleColumns = ({
8039
8899
  sortInfo,
8040
8900
  setSortInfo,
8041
8901
  multiSort,
8902
+ filterValue,
8042
8903
  columnOrder,
8043
8904
  columnVisibility,
8044
8905
  columnVisibilityAssumeVisible,
@@ -8071,7 +8932,7 @@ var useComputedVisibleColumns = ({
8071
8932
  };
8072
8933
 
8073
8934
  // src/components/InfiniteTable/hooks/useScrollbars.ts
8074
- var import_react37 = __toModule(require("react"));
8935
+ var import_react41 = __toModule(require("react"));
8075
8936
  var INITIAL_SCROLLBARS = {
8076
8937
  vertical: false,
8077
8938
  horizontal: false
@@ -8079,8 +8940,8 @@ var INITIAL_SCROLLBARS = {
8079
8940
  function useScrollbars(brain) {
8080
8941
  const { getComponentState: getInfiniteTableState } = useComponentState();
8081
8942
  const { getState: getDataSourceState } = useDataSourceContextValue();
8082
- const [scrollbars, setScrollbars] = (0, import_react37.useState)(INITIAL_SCROLLBARS);
8083
- (0, import_react37.useEffect)(() => {
8943
+ const [scrollbars, setScrollbars] = (0, import_react41.useState)(INITIAL_SCROLLBARS);
8944
+ (0, import_react41.useEffect)(() => {
8084
8945
  return brain.onRenderCountChange(() => {
8085
8946
  const { scrollTopMax, scrollLeftMax } = brain;
8086
8947
  setScrollbars({
@@ -8089,7 +8950,7 @@ function useScrollbars(brain) {
8089
8950
  });
8090
8951
  });
8091
8952
  }, [brain]);
8092
- (0, import_react37.useLayoutEffect)(() => {
8953
+ (0, import_react41.useLayoutEffect)(() => {
8093
8954
  const dataSourceState = getDataSourceState();
8094
8955
  const { onScrollbarsChange } = getInfiniteTableState();
8095
8956
  const { notifyScrollbarsChange } = dataSourceState;
@@ -8120,27 +8981,27 @@ function useComputed() {
8120
8981
  bodySize,
8121
8982
  showSeparatePivotColumnForSingleAggregation
8122
8983
  } = componentState;
8123
- (0, import_react38.useState)(() => {
8984
+ (0, import_react42.useState)(() => {
8124
8985
  componentState.onRowHeightCSSVarChange.onChange((rowHeight) => {
8125
8986
  if (rowHeight) {
8126
8987
  componentActions.rowHeight = rowHeight;
8127
8988
  }
8128
8989
  });
8129
- componentState.onHeaderHeightCSSVarChange.onChange((headerHeight) => {
8130
- if (headerHeight) {
8131
- componentActions.headerHeight = headerHeight;
8990
+ componentState.onColumnHeaderHeightCSSVarChange.onChange((columnHeaderHeight) => {
8991
+ if (columnHeaderHeight) {
8992
+ componentActions.columnHeaderHeight = columnHeaderHeight;
8132
8993
  }
8133
8994
  });
8134
8995
  });
8135
- (0, import_react38.useEffect)(() => {
8996
+ (0, import_react42.useEffect)(() => {
8136
8997
  dataSourceActions.showSeparatePivotColumnForSingleAggregation = showSeparatePivotColumnForSingleAggregation;
8137
8998
  }, [showSeparatePivotColumnForSingleAggregation]);
8138
- const { multiSort } = dataSourceState;
8999
+ const { multiSort, filterValue } = dataSourceState;
8139
9000
  useColumnGroups();
8140
9001
  const { toggleGroupRow } = useColumnsWhen();
8141
- const setSortInfo = (0, import_react38.useCallback)((sortInfo) => {
9002
+ const setSortInfo = (0, import_react42.useCallback)((sortInfo) => {
8142
9003
  var _a2;
8143
- const newSortInfo = multiSort ? sortInfo : (_a2 = sortInfo[0]) != null ? _a2 : null;
9004
+ const newSortInfo = getDataSourceState().multiSort ? sortInfo : (_a2 = sortInfo[0]) != null ? _a2 : null;
8144
9005
  dataSourceActions.sortInfo = newSortInfo;
8145
9006
  }, [getDataSourceState]);
8146
9007
  const columns = componentState.computedColumns;
@@ -8179,6 +9040,7 @@ function useComputed() {
8179
9040
  columnVisibility,
8180
9041
  columnVisibilityAssumeVisible: true,
8181
9042
  columnPinning,
9043
+ filterValue,
8182
9044
  columnSizing,
8183
9045
  columnTypes
8184
9046
  });
@@ -8188,6 +9050,7 @@ function useComputed() {
8188
9050
  const computedPinnedStartOverflow = computedPinnedStartWidth ? computedPinnedStartColumnsWidth > computedPinnedStartWidth : false;
8189
9051
  const computedPinnedEndOverflow = computedPinnedEndWidth ? computedPinnedEndColumnsWidth > computedPinnedEndWidth : false;
8190
9052
  return {
9053
+ showColumnFilters: !!dataSourceState.filterValue,
8191
9054
  scrollbars,
8192
9055
  columnSize,
8193
9056
  rowspan,
@@ -8295,7 +9158,7 @@ function useDOMProps(initialDOMProps) {
8295
9158
  }
8296
9159
 
8297
9160
  // src/components/InfiniteTable/hooks/useLicense/useLicense.ts
8298
- var import_react39 = __toModule(require("react"));
9161
+ var import_react43 = __toModule(require("react"));
8299
9162
 
8300
9163
  // src/components/InfiniteTable/hooks/useLicense/crc32.ts
8301
9164
  var DEFAULT_ReversedPolynomial = 3988292384;
@@ -8453,10 +9316,10 @@ var isInsideSandbox = () => {
8453
9316
  };
8454
9317
  var isInsidePlayground = isInsideSandbox() || isInsideSandpack();
8455
9318
  var useLicense = (licenseKey = "") => {
8456
- const valid = (0, import_react39.useMemo)(() => {
9319
+ const valid = (0, import_react43.useMemo)(() => {
8457
9320
  let valid2 = isValidLicense(licenseKey, {
8458
9321
  publishedAt: 1624970570587,
8459
- version: "0.3.1"
9322
+ version: "0.3.4"
8460
9323
  });
8461
9324
  if (!licenseKey && !valid2 && isInsidePlayground) {
8462
9325
  return true;
@@ -8466,8 +9329,142 @@ var useLicense = (licenseKey = "") => {
8466
9329
  return valid;
8467
9330
  };
8468
9331
 
9332
+ // src/components/utils/clamp.ts
9333
+ function clamp(value, min, max) {
9334
+ return Math.min(Math.max(value, min), max);
9335
+ }
9336
+
9337
+ // src/components/InfiniteTable/keyboardNavigationAndSelection.ts
9338
+ function handleRowNavigation(options) {
9339
+ const { key, getState, getDataSourceState, actions } = options;
9340
+ const arrLength = getDataSourceState().dataArray.length;
9341
+ const state = getState();
9342
+ const { brain } = state;
9343
+ let { activeRowIndex } = state;
9344
+ if (activeRowIndex == null) {
9345
+ return false;
9346
+ }
9347
+ const {
9348
+ start: [startRow],
9349
+ end: [endRow]
9350
+ } = brain.getRenderRange();
9351
+ const renderRowCount = endRow - startRow - 1;
9352
+ const min = 0;
9353
+ const max = arrLength - 1;
9354
+ const KeyToFunction = {
9355
+ ArrowDown: () => {
9356
+ activeRowIndex = clamp(activeRowIndex + 1, min, max);
9357
+ },
9358
+ ArrowUp: () => {
9359
+ activeRowIndex = clamp(activeRowIndex - 1, min, max);
9360
+ },
9361
+ PageDown: () => {
9362
+ activeRowIndex = Math.min(activeRowIndex + renderRowCount, arrLength - 1);
9363
+ },
9364
+ PageUp: () => {
9365
+ activeRowIndex = Math.max(activeRowIndex - renderRowCount, min);
9366
+ },
9367
+ End: () => {
9368
+ activeRowIndex = max;
9369
+ },
9370
+ Home: () => {
9371
+ activeRowIndex = min;
9372
+ }
9373
+ };
9374
+ const Fn = KeyToFunction[key];
9375
+ if (!Fn) {
9376
+ return false;
9377
+ }
9378
+ Fn();
9379
+ actions.activeRowIndex = activeRowIndex;
9380
+ return true;
9381
+ }
9382
+ function handleCellNavigation(options) {
9383
+ const { key, shiftKey, getState, getComputed, getDataSourceState, actions } = options;
9384
+ const state = getState();
9385
+ const { activeCellIndex, brain } = state;
9386
+ if (!activeCellIndex) {
9387
+ return false;
9388
+ }
9389
+ let [rowIndex, colIndex] = activeCellIndex;
9390
+ const {
9391
+ start: [startRow, startCol],
9392
+ end: [endRow, endCol]
9393
+ } = brain.getRenderRange();
9394
+ const renderRowCount = endRow - startRow - 1;
9395
+ const renderColCount = endCol - startCol - 1;
9396
+ const maxRow = getDataSourceState().dataArray.length - 1;
9397
+ const maxCol = getComputed().computedVisibleColumns.length - 1;
9398
+ const minRow = 0;
9399
+ const minCol = 0;
9400
+ rowIndex = clamp(rowIndex, 0, maxRow);
9401
+ colIndex = clamp(colIndex, 0, maxCol);
9402
+ actions.activeCellIndex = [rowIndex, colIndex];
9403
+ const KeyToFunction = {
9404
+ ArrowDown: () => {
9405
+ rowIndex = clamp(rowIndex + 1, minRow, maxRow);
9406
+ },
9407
+ ArrowUp: () => {
9408
+ rowIndex = clamp(rowIndex - 1, minRow, maxRow);
9409
+ },
9410
+ ArrowLeft: () => {
9411
+ colIndex = clamp(colIndex - 1, minCol, maxCol);
9412
+ },
9413
+ ArrowRight: () => {
9414
+ colIndex = clamp(colIndex + 1, minCol, maxCol);
9415
+ },
9416
+ PageDown: () => {
9417
+ if (!shiftKey) {
9418
+ rowIndex = Math.min(rowIndex + renderRowCount, maxRow);
9419
+ } else {
9420
+ colIndex = Math.min(colIndex + renderColCount, maxCol);
9421
+ }
9422
+ },
9423
+ PageUp: () => {
9424
+ if (!shiftKey) {
9425
+ rowIndex = Math.max(rowIndex - renderRowCount, minRow);
9426
+ } else {
9427
+ colIndex = Math.max(colIndex - renderColCount, minCol);
9428
+ }
9429
+ },
9430
+ End: () => {
9431
+ if (!shiftKey) {
9432
+ rowIndex = maxRow;
9433
+ } else {
9434
+ colIndex = maxCol;
9435
+ }
9436
+ },
9437
+ Home: () => {
9438
+ if (!shiftKey) {
9439
+ rowIndex = minRow;
9440
+ } else {
9441
+ colIndex = minCol;
9442
+ }
9443
+ }
9444
+ };
9445
+ const Fn = KeyToFunction[key];
9446
+ if (!Fn) {
9447
+ return false;
9448
+ }
9449
+ Fn();
9450
+ actions.activeCellIndex = [rowIndex, colIndex];
9451
+ return true;
9452
+ }
9453
+ function handleKeyboardNavigation(options) {
9454
+ const { getState } = options;
9455
+ const state = getState();
9456
+ const { activeRowIndex, activeCellIndex } = state;
9457
+ if (activeRowIndex != null) {
9458
+ return handleRowNavigation(options);
9459
+ }
9460
+ if (activeCellIndex != null) {
9461
+ return handleCellNavigation(options);
9462
+ }
9463
+ return false;
9464
+ }
9465
+
8469
9466
  // src/components/InfiniteTable/state/getInitialState.ts
8470
- var import_react40 = __toModule(require("react"));
9467
+ var import_react44 = __toModule(require("react"));
8471
9468
 
8472
9469
  // src/components/VirtualBrain/ScrollListener.ts
8473
9470
  var initialScrollPosition = {
@@ -8523,6 +9520,18 @@ function toMap(mapOrObject, weakMapCache) {
8523
9520
  }
8524
9521
 
8525
9522
  // src/components/InfiniteTable/state/getInitialState.ts
9523
+ function createRenderer2(brain) {
9524
+ const renderer = new ReactHeadlessTableRenderer(brain);
9525
+ const onRenderUpdater = buildSubscriptionCallback();
9526
+ brain.onDestroy(() => {
9527
+ renderer.destroy();
9528
+ onRenderUpdater.destroy();
9529
+ });
9530
+ return {
9531
+ renderer,
9532
+ onRenderUpdater
9533
+ };
9534
+ }
8526
9535
  function initSetupState2() {
8527
9536
  const columnsGeneratedForGrouping = new Map();
8528
9537
  const brain = new MatrixBrain();
@@ -8536,19 +9545,25 @@ function initSetupState2() {
8536
9545
  if (true) {
8537
9546
  globalThis.brain = brain;
8538
9547
  }
9548
+ const { renderer, onRenderUpdater } = createRenderer2(brain);
8539
9549
  brain.onAvailableSizeChange((size) => {
8540
9550
  headerBrain.setAvailableSize({ width: size.width });
8541
9551
  });
9552
+ if (true) {
9553
+ globalThis.renderer = renderer;
9554
+ }
8542
9555
  return {
9556
+ renderer,
9557
+ onRenderUpdater,
8543
9558
  propsCache: new Map([]),
8544
9559
  brain,
8545
9560
  headerBrain,
8546
9561
  columnShifts: null,
8547
- domRef: (0, import_react40.createRef)(),
8548
- scrollerDOMRef: (0, import_react40.createRef)(),
8549
- portalDOMRef: (0, import_react40.createRef)(),
9562
+ domRef: (0, import_react44.createRef)(),
9563
+ scrollerDOMRef: (0, import_react44.createRef)(),
9564
+ portalDOMRef: (0, import_react44.createRef)(),
8550
9565
  onRowHeightCSSVarChange: buildSubscriptionCallback(),
8551
- onHeaderHeightCSSVarChange: buildSubscriptionCallback(),
9566
+ onColumnHeaderHeightCSSVarChange: buildSubscriptionCallback(),
8552
9567
  bodySize: {
8553
9568
  width: 0,
8554
9569
  height: 0
@@ -8598,26 +9613,31 @@ var forwardProps3 = (setupState) => {
8598
9613
  onScrollbarsChange: 1,
8599
9614
  autoSizeColumnsKey: 1,
8600
9615
  scrollStopDelay: (scrollStopDelay) => scrollStopDelay != null ? scrollStopDelay : 250,
9616
+ filterEditors: (filterEditors) => __spreadValues(__spreadValues({}, defaultFilterEditors), filterEditors),
8601
9617
  viewportReservedWidth: (viewportReservedWidth) => viewportReservedWidth != null ? viewportReservedWidth : 0,
8602
- activeIndex: (activeIndex) => activeIndex != null ? activeIndex : 0,
8603
9618
  columnMinWidth: (columnMinWidth) => columnMinWidth != null ? columnMinWidth : 30,
8604
9619
  columnMaxWidth: (columnMaxWidth) => columnMaxWidth != null ? columnMaxWidth : 2e3,
8605
9620
  columnDefaultWidth: (columnDefaultWidth) => columnDefaultWidth != null ? columnDefaultWidth : 200,
8606
9621
  columnCssEllipsis: (columnCssEllipsis) => columnCssEllipsis != null ? columnCssEllipsis : true,
8607
9622
  draggableColumns: (draggableColumns) => draggableColumns != null ? draggableColumns : true,
9623
+ headerOptions: (headerOptions) => __spreadValues({
9624
+ alwaysReserveSpaceForSortIcon: true
9625
+ }, headerOptions),
8608
9626
  showSeparatePivotColumnForSingleAggregation: (showSeparatePivotColumnForSingleAggregation) => showSeparatePivotColumnForSingleAggregation != null ? showSeparatePivotColumnForSingleAggregation : false,
8609
9627
  sortable: (sortable) => sortable != null ? sortable : true,
8610
9628
  hideEmptyGroupColumns: (hideEmptyGroupColumns) => hideEmptyGroupColumns != null ? hideEmptyGroupColumns : false,
8611
9629
  pivotTotalColumnPosition: (pivotTotalColumnPosition) => pivotTotalColumnPosition != null ? pivotTotalColumnPosition : "end",
8612
9630
  pivotGrandTotalColumnPosition: 1,
8613
9631
  licenseKey: (licenseKey) => licenseKey || "",
9632
+ activeRowIndex: (activeRowIndex) => activeRowIndex != null ? activeRowIndex : null,
9633
+ activeCellIndex: (activeCellIndex) => activeCellIndex != null ? activeCellIndex : null,
8614
9634
  columnOrder: (columnOrder) => columnOrder != null ? columnOrder : true,
8615
9635
  header: (header) => header != null ? header : true,
8616
9636
  showZebraRows: (showZebraRows) => showZebraRows != null ? showZebraRows : true,
8617
9637
  showHoverRows: (showHoverRows) => showHoverRows != null ? showHoverRows : true,
8618
9638
  virtualizeColumns: (virtualizeColumns) => virtualizeColumns != null ? virtualizeColumns : true,
8619
9639
  rowHeight: (rowHeight) => typeof rowHeight === "number" ? rowHeight : 0,
8620
- headerHeight: (headerHeight) => typeof headerHeight === "number" ? headerHeight : 30,
9640
+ columnHeaderHeight: (columnHeaderHeight) => typeof columnHeaderHeight === "number" ? columnHeaderHeight : 30,
8621
9641
  columns: (columns) => toMap(columns, setupState.propsCache.get("columns")),
8622
9642
  columnVisibility: (columnVisibility) => columnVisibility != null ? columnVisibility : {},
8623
9643
  columnPinning: (columnPinning) => toMap(columnPinning, setupState.propsCache.get("columnPinning")),
@@ -8658,12 +9678,13 @@ var mapPropsToState2 = (params) => {
8658
9678
  groupRenderStrategy,
8659
9679
  groupBy,
8660
9680
  computedColumns,
9681
+ enableKeyboardNavigation: state.activeRowIndex != null,
8661
9682
  columnHeaderCssEllipsis: (_b = (_a = props.columnHeaderCssEllipsis) != null ? _a : props.columnCssEllipsis) != null ? _b : true,
8662
9683
  columnGroupsDepthsMap,
8663
9684
  columnGroupsMaxDepth: columnGroupsDepthsMap != state.columnGroupsDepthsMap ? Math.max(...columnGroupsDepthsMap.values(), 0) : state.columnGroupsMaxDepth,
8664
9685
  computedColumnGroups,
8665
9686
  rowHeightCSSVar: typeof props.rowHeight === "string" ? props.rowHeight : "",
8666
- headerHeightCSSVar: typeof props.headerHeight === "string" ? props.headerHeight || ThemeVars.components.Header.height : ""
9687
+ columnHeaderHeightCSSVar: typeof props.columnHeaderHeight === "string" ? props.columnHeaderHeight || ThemeVars.components.Header.columnHeaderHeight : ""
8667
9688
  };
8668
9689
  };
8669
9690
 
@@ -8676,19 +9697,28 @@ var InfiniteTableRoot = getComponentStateRoot({
8676
9697
  mapPropsToState: mapPropsToState2,
8677
9698
  allowedControlledPropOverrides: {
8678
9699
  rowHeight: true,
8679
- headerHeight: true
9700
+ columnHeaderHeight: true
8680
9701
  },
8681
9702
  getParentState: () => useDataSource(),
8682
9703
  debugName: "InfiniteTable"
8683
9704
  });
8684
- var InfiniteTableComponent = React27.memo(function InfiniteTableComponent2() {
9705
+ var InfiniteTableComponent = React32.memo(function InfiniteTableComponent2() {
8685
9706
  var _a;
8686
- const { componentState, getComputed, computed } = useInfiniteTable();
9707
+ const {
9708
+ componentState,
9709
+ getComputed,
9710
+ computed,
9711
+ componentActions: actions,
9712
+ getState
9713
+ } = useInfiniteTable();
8687
9714
  const {
8688
9715
  componentState: { loading },
8689
9716
  getState: getDataSourceState,
8690
9717
  componentActions: dataSourceActions
8691
9718
  } = useDataSourceContextValue();
9719
+ const [imperativeApi] = (0, import_react45.useState)(() => {
9720
+ return getImperativeApi(getState, getComputed, getDataSourceState, actions);
9721
+ });
8692
9722
  const {
8693
9723
  domRef,
8694
9724
  scrollerDOMRef,
@@ -8697,24 +9727,43 @@ var InfiniteTableComponent = React27.memo(function InfiniteTableComponent2() {
8697
9727
  loadingText,
8698
9728
  header,
8699
9729
  onRowHeightCSSVarChange,
8700
- onHeaderHeightCSSVarChange,
9730
+ onColumnHeaderHeightCSSVarChange,
8701
9731
  rowHeightCSSVar,
8702
- headerHeightCSSVar,
9732
+ columnHeaderHeightCSSVar,
8703
9733
  components,
8704
9734
  scrollStopDelay,
8705
9735
  brain,
8706
- headerBrain
9736
+ headerBrain,
9737
+ renderer,
9738
+ activeRowIndex,
9739
+ activeCellIndex,
9740
+ onRenderUpdater
8707
9741
  } = componentState;
9742
+ (0, import_react45.useEffect)(() => {
9743
+ if (activeRowIndex != null) {
9744
+ imperativeApi.scrollRowIntoView(activeRowIndex, {
9745
+ offset: 30
9746
+ });
9747
+ }
9748
+ }, [activeRowIndex]);
9749
+ (0, import_react45.useEffect)(() => {
9750
+ if (activeCellIndex != null) {
9751
+ imperativeApi.scrollCellIntoView(activeCellIndex[0], activeCellIndex[1], {
9752
+ offset: 30
9753
+ });
9754
+ }
9755
+ }, [activeCellIndex]);
8708
9756
  const { columnShifts, bodySize } = componentState;
8709
9757
  const { scrollbars } = computed;
8710
9758
  const { renderCell } = useCellRendering({
9759
+ imperativeApi,
8711
9760
  getComputed,
8712
9761
  domRef: componentState.domRef,
8713
9762
  columnShifts,
8714
9763
  bodySize,
8715
9764
  computed
8716
9765
  });
8717
- React27.useEffect(() => {
9766
+ React32.useEffect(() => {
8718
9767
  const dataSourceState = getDataSourceState();
8719
9768
  const onChange = debounce((renderRange) => {
8720
9769
  dataSourceState.notifyRenderRangeChange({
@@ -8727,35 +9776,52 @@ var InfiniteTableComponent = React27.memo(function InfiniteTableComponent2() {
8727
9776
  const licenseValid = useLicense(licenseKey);
8728
9777
  const domProps = useDOMProps(componentState.domProps);
8729
9778
  const LoadMaskCmp = (_a = components == null ? void 0 : components.LoadMask) != null ? _a : LoadMask;
8730
- React27.useEffect(() => {
9779
+ React32.useEffect(() => {
8731
9780
  brain.setScrollStopDelay(scrollStopDelay);
8732
9781
  dataSourceActions.scrollStopDelayUpdatedByTable = scrollStopDelay;
8733
9782
  }, [scrollStopDelay]);
8734
9783
  useAutoSizeColumns();
8735
- return /* @__PURE__ */ React27.createElement("div", __spreadValues({
9784
+ const onKeyDown = (0, import_react45.useCallback)((event) => {
9785
+ if (handleKeyboardNavigation({
9786
+ getState,
9787
+ actions,
9788
+ getDataSourceState,
9789
+ getComputed,
9790
+ key: event.key,
9791
+ shiftKey: !!event.shiftKey
9792
+ })) {
9793
+ event.preventDefault();
9794
+ }
9795
+ }, []);
9796
+ return /* @__PURE__ */ React32.createElement("div", __spreadValues({
9797
+ onKeyDown,
8736
9798
  ref: domRef
8737
- }, domProps), header ? /* @__PURE__ */ React27.createElement(TableHeaderWrapper, {
9799
+ }, domProps), header ? /* @__PURE__ */ React32.createElement(TableHeaderWrapper, {
8738
9800
  brain: headerBrain,
8739
9801
  scrollbars
8740
- }) : null, /* @__PURE__ */ React27.createElement(InfiniteTableBody, null, /* @__PURE__ */ React27.createElement(HeadlessTable, {
9802
+ }) : null, /* @__PURE__ */ React32.createElement(InfiniteTableBody, null, /* @__PURE__ */ React32.createElement(HeadlessTable, {
8741
9803
  tabIndex: 0,
9804
+ activeRowIndex: componentState.ready ? activeRowIndex : null,
9805
+ activeCellIndex: componentState.ready ? activeCellIndex : null,
8742
9806
  scrollStopDelay,
9807
+ renderer,
9808
+ onRenderUpdater,
8743
9809
  brain,
8744
9810
  renderCell,
8745
9811
  cellHoverClassNames: HOVERED_CLASS_NAMES,
8746
9812
  scrollerDOMRef
8747
- }), /* @__PURE__ */ React27.createElement(LoadMaskCmp, {
9813
+ }), /* @__PURE__ */ React32.createElement(LoadMaskCmp, {
8748
9814
  visible: loading
8749
- }, loadingText)), licenseValid ? null : /* @__PURE__ */ React27.createElement(InfiniteTableLicenseFooter, null), /* @__PURE__ */ React27.createElement("div", {
9815
+ }, loadingText)), /* @__PURE__ */ React32.createElement("div", {
8750
9816
  ref: portalDOMRef,
8751
9817
  className: join(`${rootClassName2}Portal`, zIndex[1e3], position.absolute, top[0], left[0])
8752
- }), rowHeightCSSVar ? /* @__PURE__ */ React27.createElement(CSSVariableWatch, {
9818
+ }), rowHeightCSSVar ? /* @__PURE__ */ React32.createElement(CSSVariableWatch, {
8753
9819
  varName: rowHeightCSSVar,
8754
9820
  onChange: onRowHeightCSSVarChange
8755
- }) : null, headerHeightCSSVar ? /* @__PURE__ */ React27.createElement(CSSVariableWatch, {
8756
- varName: headerHeightCSSVar,
8757
- onChange: onHeaderHeightCSSVarChange
8758
- }) : null);
9821
+ }) : null, columnHeaderHeightCSSVar ? /* @__PURE__ */ React32.createElement(CSSVariableWatch, {
9822
+ varName: columnHeaderHeightCSSVar,
9823
+ onChange: onColumnHeaderHeightCSSVarChange
9824
+ }) : null, /* @__PURE__ */ React32.createElement(InfiniteTableFooter, null), licenseValid ? null : /* @__PURE__ */ React32.createElement(InfiniteTableLicenseFooter, null));
8759
9825
  });
8760
9826
  function InfiniteTableContextProvider() {
8761
9827
  const { componentActions, componentState } = useComponentState();
@@ -8783,27 +9849,27 @@ function InfiniteTableContextProvider() {
8783
9849
  bodySize.width = (_b = (_a = scrollerDOMRef.current) == null ? void 0 : _a.scrollWidth) != null ? _b : bodySize.width;
8784
9850
  componentActions.bodySize = bodySize;
8785
9851
  }, { earlyAttach: true });
8786
- React27.useEffect(() => {
9852
+ React32.useEffect(() => {
8787
9853
  return () => {
8788
9854
  componentState.onRowHeightCSSVarChange.destroy();
8789
- componentState.onHeaderHeightCSSVarChange.destroy();
9855
+ componentState.onColumnHeaderHeightCSSVarChange.destroy();
8790
9856
  };
8791
9857
  }, []);
8792
- React27.useEffect(() => {
9858
+ React32.useEffect(() => {
8793
9859
  if (scrollerDOMRef.current) {
8794
9860
  scrollerDOMRef.current.scrollTop = 0;
8795
9861
  }
8796
9862
  }, [scrollTopKey, scrollerDOMRef]);
8797
9863
  const TableContext2 = getInfiniteTableContext();
8798
- return /* @__PURE__ */ React27.createElement(TableContext2.Provider, {
9864
+ return /* @__PURE__ */ React32.createElement(TableContext2.Provider, {
8799
9865
  value: contextValue
8800
- }, /* @__PURE__ */ React27.createElement(InfiniteTableComponent, null));
9866
+ }, /* @__PURE__ */ React32.createElement(InfiniteTableComponent, null));
8801
9867
  }
8802
9868
  function InfiniteTable(props) {
8803
- const table = /* @__PURE__ */ React27.createElement(InfiniteTableRoot, __spreadValues({}, props), /* @__PURE__ */ React27.createElement(InfiniteTableContextProvider, null));
8804
- return /* @__PURE__ */ React27.createElement(React27.StrictMode, null, table);
9869
+ const table = /* @__PURE__ */ React32.createElement(InfiniteTableRoot, __spreadValues({}, props), /* @__PURE__ */ React32.createElement(InfiniteTableContextProvider, null));
9870
+ return /* @__PURE__ */ React32.createElement(React32.StrictMode, null, table);
8805
9871
  }
8806
9872
  InfiniteTable.defaultProps = {
8807
9873
  rowHeight: 40,
8808
- headerHeight: ThemeVars.components.Header.height
9874
+ columnHeaderHeight: ThemeVars.components.Header.columnHeaderHeight
8809
9875
  };