@infinite-table/infinite-react 0.3.0 → 0.3.3

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 +76 -50
  2. package/index.d.ts +543 -410
  3. package/index.esm.css +76 -50
  4. package/index.esm.js +1093 -598
  5. package/index.js +1153 -665
  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,7 @@ function debounce(fn, { wait }) {
660
665
  }
661
666
 
662
667
  // src/components/InfiniteTable/index.tsx
663
- var React27 = __toModule(require("react"));
668
+ var React30 = __toModule(require("react"));
664
669
 
665
670
  // src/utils/join.ts
666
671
  var join = (...args) => args.filter((x) => !!`${x}`).join(" ");
@@ -2769,6 +2774,9 @@ var ReactHeadlessTableRenderer = class extends Logger {
2769
2774
  });
2770
2775
  };
2771
2776
  this.onMouseLeave = (rowIndex) => {
2777
+ if (this.currentHoveredRow != -1 && this.currentHoveredRow === rowIndex) {
2778
+ this.removeHoverClass(rowIndex);
2779
+ }
2772
2780
  this.currentHoveredRow = -1;
2773
2781
  if (this.scrolling) {
2774
2782
  return;
@@ -2807,7 +2815,7 @@ var ReactHeadlessTableRenderer = class extends Logger {
2807
2815
  this.hoverRowUpdatesInProgress.delete(rowIndex);
2808
2816
  });
2809
2817
  };
2810
- this.updateElementPosition = (elementIndex) => {
2818
+ this.updateElementPosition = (elementIndex, options) => {
2811
2819
  const itemElement = this.itemDOMElements[elementIndex];
2812
2820
  const cell = this.mappedCells.getRenderedCellAtElement(elementIndex);
2813
2821
  if (cell == null) {
@@ -2832,7 +2840,8 @@ var ReactHeadlessTableRenderer = class extends Logger {
2832
2840
  itemElement.style.transform = `translate3d(${x}px, ${y}px, 0)`;
2833
2841
  itemElement.style.willChange = "transform";
2834
2842
  itemElement.style.backfaceVisibility = "hidden";
2835
- itemElement.style.zIndex = "auto";
2843
+ const hidden = options ? options.hidden : !!this.isCellCovered(rowIndex, colIndex);
2844
+ itemElement.style.zIndex = hidden ? "-1" : "auto";
2836
2845
  } else {
2837
2846
  itemElement.style.display = "";
2838
2847
  itemElement.style.left = `${x}px`;
@@ -2842,9 +2851,6 @@ var ReactHeadlessTableRenderer = class extends Logger {
2842
2851
  };
2843
2852
  this.onScrollStart = () => {
2844
2853
  this.scrolling = true;
2845
- if (this.currentHoveredRow != -1) {
2846
- this.removeHoverClass(this.currentHoveredRow);
2847
- }
2848
2854
  };
2849
2855
  this.onScrollStop = () => {
2850
2856
  this.scrolling = false;
@@ -3027,6 +3033,7 @@ var ReactHeadlessTableRenderer = class extends Logger {
3027
3033
  const heightWithRowspan = rowspan === 1 ? height : this.brain.getRowHeightWithSpan(rowIndex, colIndex, rowspan);
3028
3034
  const widthWithColspan = colspan === 1 ? width : this.brain.getColWidthWithSpan(rowIndex, colIndex, colspan);
3029
3035
  const { row: rowFixed, col: colFixed } = this.isCellFixed(rowIndex, colIndex);
3036
+ const hidden = !!covered;
3030
3037
  const renderedNode = renderCell({
3031
3038
  rowIndex,
3032
3039
  colIndex,
@@ -3036,7 +3043,7 @@ var ReactHeadlessTableRenderer = class extends Logger {
3036
3043
  colspan,
3037
3044
  rowFixed,
3038
3045
  colFixed,
3039
- hidden: !!covered,
3046
+ hidden,
3040
3047
  heightWithRowspan,
3041
3048
  widthWithColspan,
3042
3049
  onMouseEnter: this.onMouseEnter.bind(null, rowIndex),
@@ -3053,7 +3060,7 @@ var ReactHeadlessTableRenderer = class extends Logger {
3053
3060
  this.debug(`Render cell ${rowIndex},${colIndex} at element ${elementIndex}`);
3054
3061
  }
3055
3062
  itemUpdater(renderedNode);
3056
- this.updateElementPosition(elementIndex);
3063
+ this.updateElementPosition(elementIndex, { hidden, rowspan, colspan });
3057
3064
  return;
3058
3065
  }
3059
3066
  reset() {
@@ -3523,6 +3530,7 @@ var cssEllipsisClassName = "_16lm1iw1c _16lm1iw1d _16lm1iw18";
3523
3530
  var cursor = { pointer: "_16lm1iwd" };
3524
3531
  var display = { flex: "_16lm1iwl", block: "_16lm1iwm", inlineBlock: "_16lm1iwn" };
3525
3532
  var flex = { "1": "_16lm1iwe", none: "_16lm1iwf" };
3533
+ var flexFlow = { column: "_16lm1iw11", row: "_16lm1iw12" };
3526
3534
  var justifyContent = { center: "_16lm1iw15", start: "_16lm1iw16", end: "_16lm1iw17" };
3527
3535
  var left = { "0": "_16lm1iwv", "100%": "_16lm1iww" };
3528
3536
  var overflow = { hidden: "_16lm1iw18", auto: "_16lm1iw19", visible: "_16lm1iw1a" };
@@ -3534,23 +3542,133 @@ var zIndex = { "1": "_16lm1iwg", "10": "_16lm1iwh", "1000": "_16lm1iwi", "10000"
3534
3542
 
3535
3543
  // src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx
3536
3544
  var InfiniteTableBody = React12.forwardRef(function InfiniteTableBody2(props, ref) {
3537
- const { rootClassName: rootClassName8 } = useInternalProps();
3545
+ const { rootClassName: rootClassName9 } = useInternalProps();
3538
3546
  return /* @__PURE__ */ React12.createElement("div", __spreadProps(__spreadValues({
3539
3547
  ref
3540
3548
  }, props), {
3541
- className: join(`${rootClassName8}Body`, position.relative, flex["1"], transformTranslateZero, props.className)
3549
+ className: join(`${rootClassName9}Body`, position.relative, flex["1"], transformTranslateZero, props.className)
3550
+ }));
3551
+ });
3552
+
3553
+ // src/components/InfiniteTable/components/InfiniteTableFooter/InfiniteTableFooter.tsx
3554
+ var React13 = __toModule(require("react"));
3555
+ var InfiniteTableFooter = React13.forwardRef(function InfiniteTableFooter2(props, ref) {
3556
+ const { rootClassName: rootClassName9 } = useInternalProps();
3557
+ return /* @__PURE__ */ React13.createElement("div", __spreadProps(__spreadValues({
3558
+ ref
3559
+ }, props), {
3560
+ className: join(`${rootClassName9}Footer`, position.relative, display.flex, flexFlow.row, props.className)
3542
3561
  }));
3543
3562
  });
3544
3563
 
3545
3564
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
3546
- var React15 = __toModule(require("react"));
3565
+ var React18 = __toModule(require("react"));
3566
+ var import_react19 = __toModule(require("react"));
3547
3567
  var import_react_dom = __toModule(require("react-dom"));
3548
- var import_react17 = __toModule(require("react"));
3549
3568
 
3550
- // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
3551
- var React13 = __toModule(require("react"));
3569
+ // src/components/DataSource/defaultFilterTypes.ts
3570
+ function getFilterTypes() {
3571
+ const result = {
3572
+ string: {
3573
+ label: "Text",
3574
+ emptyValues: new Set([""]),
3575
+ defaultOperator: "contains",
3576
+ operators: [
3577
+ {
3578
+ name: "contains",
3579
+ fn: ({ currentValue, filterValue, emptyValues }) => {
3580
+ if (emptyValues.has(currentValue) || emptyValues.has(filterValue)) {
3581
+ return true;
3582
+ }
3583
+ return typeof currentValue === "string" && typeof filterValue == "string" && currentValue.toLowerCase().includes(filterValue.toLowerCase());
3584
+ }
3585
+ },
3586
+ {
3587
+ name: "eq",
3588
+ fn: ({ currentValue: value, filterValue, emptyValues }) => {
3589
+ if (emptyValues.has(value) || emptyValues.has(filterValue)) {
3590
+ return true;
3591
+ }
3592
+ return typeof value === "string" && value === filterValue;
3593
+ }
3594
+ }
3595
+ ]
3596
+ },
3597
+ number: {
3598
+ label: "Number",
3599
+ emptyValues: new Set(["", null, void 0]),
3600
+ defaultOperator: "eq",
3601
+ operators: [
3602
+ {
3603
+ name: "eq",
3604
+ fn: ({ currentValue, filterValue, emptyValues }) => {
3605
+ if (emptyValues.has(currentValue) || emptyValues.has(filterValue)) {
3606
+ return true;
3607
+ }
3608
+ return currentValue == filterValue;
3609
+ }
3610
+ },
3611
+ {
3612
+ name: "between",
3613
+ fn: ({ currentValue, filterValue, emptyValues }) => {
3614
+ if (emptyValues.has(currentValue) || emptyValues.has(filterValue)) {
3615
+ return true;
3616
+ }
3617
+ const [min, max] = filterValue;
3618
+ return currentValue >= min && currentValue <= max;
3619
+ }
3620
+ }
3621
+ ]
3622
+ }
3623
+ };
3624
+ return result;
3625
+ }
3626
+ var defaultFilterTypes = getFilterTypes();
3552
3627
 
3553
- // src/components/InfiniteTable/hooks/useInfiniteTableState.ts
3628
+ // src/components/InfiniteTable/hooks/useCellClassName.ts
3629
+ function useCellClassName(column, baseClasses, variants, extraFlags) {
3630
+ const result = [...baseClasses];
3631
+ const variantObject = {
3632
+ filtered: column.computedFiltered,
3633
+ first: column.computedFirst,
3634
+ last: column.computedLast,
3635
+ groupByField: !!column.groupByField,
3636
+ firstInCategory: column.computedFirstInCategory,
3637
+ lastInCategory: column.computedLastInCategory,
3638
+ pinned: column.computedPinned || false,
3639
+ dragging: extraFlags.dragging,
3640
+ zebra: extraFlags.zebra
3641
+ };
3642
+ const theVariant = variants(variantObject);
3643
+ result.push(theVariant);
3644
+ if (column.computedFirst) {
3645
+ result.push(...baseClasses.map((c) => `${c}--first`));
3646
+ }
3647
+ if (column.groupByField) {
3648
+ result.push(...baseClasses.map((c) => `${c}--group-column`));
3649
+ }
3650
+ if (column.computedLast) {
3651
+ result.push(...baseClasses.map((c) => `${c}--last`));
3652
+ }
3653
+ if (column.computedFirstInCategory) {
3654
+ result.push(...baseClasses.map((c) => `${c}--first-in-category`));
3655
+ }
3656
+ if (column.computedLastInCategory) {
3657
+ result.push(...baseClasses.map((c) => `${c}--last-in-category`));
3658
+ }
3659
+ if (column.computedPinned) {
3660
+ result.push(...baseClasses.map((c) => `${c}--pinned-${column.computedPinned}`));
3661
+ } else {
3662
+ result.push(...baseClasses.map((c) => `${c}--unpinned`));
3663
+ }
3664
+ return result.filter(Boolean).join(" ");
3665
+ }
3666
+
3667
+ // src/components/InfiniteTable/hooks/useColumnPointerEvents.ts
3668
+ var import_binary_search2 = __toModule(require_binary_search());
3669
+ var import_react14 = __toModule(require("react"));
3670
+
3671
+ // src/components/InfiniteTable/hooks/useInfiniteTable.ts
3554
3672
  var import_react13 = __toModule(require("react"));
3555
3673
 
3556
3674
  // src/components/InfiniteTable/InfiniteTableContext.ts
@@ -3563,96 +3681,10 @@ function getInfiniteTableContext() {
3563
3681
  return TableContext = (0, import_react12.createContext)(null);
3564
3682
  }
3565
3683
 
3566
- // src/components/InfiniteTable/hooks/useInfiniteTableState.ts
3567
- var useInfiniteTableState = () => {
3568
- const TableContext2 = getInfiniteTableContext();
3569
- const { componentState } = (0, import_react13.useContext)(TableContext2);
3570
- return componentState;
3571
- };
3572
-
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
3684
  // src/components/InfiniteTable/hooks/useInfiniteTable.ts
3652
- var import_react14 = __toModule(require("react"));
3653
3685
  var useInfiniteTable = () => {
3654
3686
  const TableContext2 = getInfiniteTableContext();
3655
- return (0, import_react14.useContext)(TableContext2);
3687
+ return (0, import_react13.useContext)(TableContext2);
3656
3688
  };
3657
3689
 
3658
3690
  // src/components/InfiniteTable/utils/moveXatY.ts
@@ -3687,18 +3719,18 @@ var useColumnPointerEvents = ({
3687
3719
  columns,
3688
3720
  computedRemainingSpace
3689
3721
  }) => {
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);
3722
+ const [draggingDiff, setDraggingDiff] = (0, import_react14.useState)(null);
3723
+ const [proxyOffset, setProxyOffset] = (0, import_react14.useState)(null);
3724
+ const breakpointsRef = (0, import_react14.useRef)([]);
3725
+ const pointerMoveRef = (0, import_react14.useRef)(null);
3726
+ const didDragRef = (0, import_react14.useRef)(false);
3727
+ const initialClientPos = (0, import_react14.useRef)(null);
3728
+ const currentDropIndexRef = (0, import_react14.useRef)(null);
3697
3729
  const dragging = draggingDiff != null;
3698
3730
  const { componentActions, computed } = useInfiniteTable();
3699
3731
  const { computedColumnOrder } = computed;
3700
- const column = (0, import_react15.useMemo)(() => columns.get(columnId), [columnId, columns]);
3701
- const { columnIndex, columnWidth, columnsArray } = (0, import_react15.useMemo)(() => {
3732
+ const column = (0, import_react14.useMemo)(() => columns.get(columnId), [columnId, columns]);
3733
+ const { columnIndex, columnWidth, columnsArray } = (0, import_react14.useMemo)(() => {
3702
3734
  const columnsArray2 = Array.from(columns.values());
3703
3735
  return {
3704
3736
  columnsArray: columnsArray2,
@@ -3706,8 +3738,8 @@ var useColumnPointerEvents = ({
3706
3738
  columnWidth: column.computedWidth
3707
3739
  };
3708
3740
  }, [columns, columnId, column]);
3709
- let cursorRef = (0, import_react15.useRef)("auto");
3710
- const onPointerDown = (0, import_react15.useCallback)((e) => {
3741
+ let cursorRef = (0, import_react14.useRef)("auto");
3742
+ const onPointerDown = (0, import_react14.useCallback)((e) => {
3711
3743
  const target = domRef.current;
3712
3744
  cursorRef.current = target.style.cursor;
3713
3745
  didDragRef.current = false;
@@ -3770,7 +3802,7 @@ var useColumnPointerEvents = ({
3770
3802
  target.addEventListener("pointermove", onPointerMove);
3771
3803
  target.setPointerCapture(e.pointerId);
3772
3804
  }, [columns, column, columnIndex, columnsArray, computedRemainingSpace]);
3773
- const onPointerUp = (0, import_react15.useCallback)((e) => {
3805
+ const onPointerUp = (0, import_react14.useCallback)((e) => {
3774
3806
  const target = domRef.current;
3775
3807
  target.style.cursor = cursorRef.current;
3776
3808
  target.releasePointerCapture(e.pointerId);
@@ -3803,47 +3835,69 @@ var useColumnPointerEvents = ({
3803
3835
  };
3804
3836
  };
3805
3837
 
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
3838
+ // src/components/InfiniteTable/utils/RenderHookComponent.tsx
3839
+ function RenderHookComponent(props) {
3840
+ var _a;
3841
+ return (_a = props.render(props.renderParam)) != null ? _a : null;
3842
+ }
3843
+
3844
+ // src/components/InfiniteTable/components/FilterEditors.tsx
3845
+ var import_react15 = __toModule(require("react"));
3846
+ function getFilterEditors() {
3847
+ return {
3848
+ string: StringFilterEditor,
3849
+ number: NumberFilterEditor
3818
3850
  };
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(" ");
3851
+ }
3852
+ var defaultFilterEditors = getFilterEditors();
3853
+ function StringFilterEditor(props) {
3854
+ return /* @__PURE__ */ import_react15.default.createElement("input", {
3855
+ "aria-label": `Filter for ${props.ariaLabel}`,
3856
+ type: "text",
3857
+ value: props.filterValue,
3858
+ onChange: (event) => {
3859
+ props.onChange(event.target.value);
3860
+ },
3861
+ className: props.className
3862
+ });
3863
+ }
3864
+ function NumberFilterEditor(props) {
3865
+ return /* @__PURE__ */ import_react15.default.createElement("input", {
3866
+ "aria-label": `Filter for ${props.ariaLabel}`,
3867
+ type: "number",
3868
+ value: props.filterValue,
3869
+ onChange: (event) => {
3870
+ let value = event.target.value;
3871
+ if (!isNaN(value + "")) {
3872
+ value = value + "";
3873
+ }
3874
+ props.onChange(value);
3875
+ },
3876
+ className: props.className
3877
+ });
3842
3878
  }
3843
3879
 
3844
3880
  // src/components/InfiniteTable/components/icons/SortIcon.tsx
3845
- var React14 = __toModule(require("react"));
3881
+ var React15 = __toModule(require("react"));
3846
3882
  var import_react16 = __toModule(require("react"));
3883
+
3884
+ // src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts
3885
+ var import_createRuntimeFn = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
3886
+ var CellCls = "_1eexc2a5 _16lm1iwl _16lm1iw12 _16lm1iw13 _16lm1iw2 _16lm1iw1b _16lm1iw1c";
3887
+ var HeaderCellContentRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_12zfob115 _16lm1iwq _16lm1iws _16lm1iwl _16lm1iw12 _16lm1iw13", variantClassNames: { filtered: { false: "_12zfob116", true: "_12zfob117" } }, defaultVariants: {}, compoundVariants: [] });
3888
+ var HeaderCellProxy = "_12zfob10";
3889
+ var HeaderCellRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_12zfob1h _16lm1iwm", variantClassNames: { zebra: { false: "_12zfob1i", even: "_12zfob1j", odd: "_12zfob1k" }, dragging: { true: "_12zfob1l", false: "_12zfob1m" }, first: { true: "_12zfob1n", false: "_12zfob1o" }, last: { true: "_12zfob1p", false: "_12zfob1q" }, groupByField: { true: "_12zfob1r", false: "_12zfob1s" }, firstInCategory: { true: "_12zfob1t", false: "_12zfob1u" }, lastInCategory: { true: "_12zfob1v", false: "_12zfob1w" }, pinned: { start: "_12zfob1x", end: "_12zfob1y", false: "_12zfob1z" }, filtered: { true: "_12zfob110", false: "_12zfob111" } }, defaultVariants: {}, compoundVariants: [[{ pinned: "start", lastInCategory: true }, "_12zfob112"], [{ pinned: "end", firstInCategory: true }, "_12zfob113"], [{ pinned: false, lastInCategory: true }, "_12zfob114"]] });
3890
+ var HeaderClsRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_12zfob17 _16lm1iwm _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"]] });
3891
+ var HeaderFilterCls = "_12zfob11a _16lm1iwl _16lm1iw12 _16lm1iw13 _16lm1iw1";
3892
+ var HeaderFilterEditorCls = "_16lm1iws _16lm1iwq";
3893
+ var HeaderGroupCls = "_12zfob119 _16lm1iwl _16lm1iw12 _16lm1iw13";
3894
+ var HeaderScrollbarPlaceholderCls = "_12zfob16 _16lm1iw2";
3895
+ var HeaderSortIconCls = "_16lm1iw1";
3896
+ var HeaderSortIconIndexCls = "_12zfob15";
3897
+ var HeaderSortIconRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "", variantClassNames: { align: { start: "_12zfob12", center: "_12zfob13", end: "_12zfob14" } }, defaultVariants: {}, compoundVariants: [] });
3898
+ var HeaderWrapperCls = "_12zfob118 _16lm1iw18 _16lm1iw1 _16lm1iwl _16lm1iw12";
3899
+
3900
+ // src/components/InfiniteTable/components/icons/SortIcon.tsx
3847
3901
  var defaultLineStyle = {
3848
3902
  marginTop: 2,
3849
3903
  marginBottom: 2,
@@ -3888,91 +3942,225 @@ function SortIcon(props) {
3888
3942
  if (!rendered) {
3889
3943
  return null;
3890
3944
  }
3891
- const indexStyle = {
3892
- position: "absolute",
3893
- transition: "top 0.2s",
3894
- top: 0,
3895
- right: 2
3896
- };
3945
+ const indexStyle = {};
3897
3946
  if (direction === -1) {
3898
3947
  indexStyle.top = "100%";
3899
3948
  }
3900
- return /* @__PURE__ */ React14.createElement("div", {
3949
+ return /* @__PURE__ */ React15.createElement("div", {
3901
3950
  style: __spreadProps(__spreadValues({}, style), { width: size }),
3902
3951
  className: join(className, InfiniteTableIconClassName, `${InfiniteTableIconClassName}-sort`)
3903
- }, showIndex ? /* @__PURE__ */ React14.createElement("div", {
3952
+ }, showIndex ? /* @__PURE__ */ React15.createElement("div", {
3904
3953
  "data-name": "index",
3905
- style: indexStyle
3906
- }, index) : null, /* @__PURE__ */ React14.createElement("div", {
3954
+ style: indexStyle,
3955
+ className: HeaderSortIconIndexCls
3956
+ }, index) : null, /* @__PURE__ */ React15.createElement("div", {
3907
3957
  style: __spreadValues({ width: sizes[0] }, lineStyle),
3908
3958
  onTransitionEnd
3909
- }), /* @__PURE__ */ React14.createElement("div", {
3959
+ }), /* @__PURE__ */ React15.createElement("div", {
3910
3960
  style: __spreadValues({ width: sizes[1] }, lineStyle)
3911
- }), /* @__PURE__ */ React14.createElement("div", {
3961
+ }), /* @__PURE__ */ React15.createElement("div", {
3912
3962
  style: __spreadValues({ width: sizes[2] }, lineStyle)
3913
3963
  }));
3914
3964
  }
3915
3965
 
3916
- // src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts
3917
- 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";
3966
+ // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
3967
+ var React16 = __toModule(require("react"));
3926
3968
 
3927
- // src/components/InfiniteTable/utils/RenderHookComponent.tsx
3928
- function RenderHookComponent(props) {
3929
- var _a;
3930
- return (_a = props.render(props.renderParam)) != null ? _a : null;
3931
- }
3969
+ // src/components/InfiniteTable/hooks/useInfiniteTableState.ts
3970
+ var import_react17 = __toModule(require("react"));
3971
+ var useInfiniteTableState = () => {
3972
+ const TableContext2 = getInfiniteTableContext();
3973
+ const { componentState } = (0, import_react17.useContext)(TableContext2);
3974
+ return componentState;
3975
+ };
3932
3976
 
3933
- // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
3934
- var InfiniteTableHeaderCellContext = React15.createContext(null);
3935
- var { rootClassName: rootClassName4 } = internalProps;
3936
- var InfiniteTableHeaderCellClassName = `${rootClassName4}HeaderCell`;
3937
- function InfiniteTableHeaderCell(props) {
3938
- var _a, _b, _c, _d;
3939
- const column = props.column;
3940
- const columns = props.columns;
3941
- const { onResize, height, width } = props;
3942
- const sortInfo = column.computedSortInfo;
3943
- let header = column.header;
3944
- const ref = (0, import_react17.useCallback)((node) => {
3945
- var _a2;
3946
- domRef.current = node;
3947
- (_a2 = props.domRef) == null ? void 0 : _a2.call(props, node);
3948
- }, [props.domRef]);
3949
- const sortTool = /* @__PURE__ */ React15.createElement(SortIcon, {
3950
- index: column.computedMultiSort ? column.computedSortIndex + 1 : void 0,
3951
- className: `${InfiniteTableHeaderCellClassName}__sort-icon ${HeaderSortIconCls}`,
3952
- direction: column.computedSorted ? column.computedSortedAsc ? 1 : -1 : 0
3953
- });
3954
- const renderParam = {
3955
- domRef: ref,
3956
- column,
3957
- columnSortInfo: sortInfo,
3958
- sortTool
3959
- };
3960
- const renderChildren = () => {
3961
- if (header instanceof Function) {
3962
- header = /* @__PURE__ */ React15.createElement(RenderHookComponent, {
3963
- render: header,
3964
- renderParam
3977
+ // src/components/InfiniteTable/components/cell.css.ts
3978
+ var import_createRuntimeFn2 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
3979
+ var CellClsVariants = { shifting: "_1eexc2a3", dragging: "_1eexc2a4" };
3980
+ var ColumnCellCls = "_1eexc2a5 _16lm1iwl _16lm1iw12 _16lm1iw13 _16lm1iw2 _16lm1iw1b _16lm1iw1c";
3981
+ var ColumnCellRecipe = (0, import_createRuntimeFn2.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" }, filtered: { true: "_1eexc2aq", false: "_1eexc2ar" } }, defaultVariants: {}, compoundVariants: [[{ pinned: "start", lastInCategory: true }, "_1eexc2as"], [{ pinned: "end", firstInCategory: true }, "_1eexc2at"]] });
3982
+
3983
+ // src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
3984
+ var { rootClassName: rootClassName3 } = internalProps;
3985
+ var InfiniteTableCellClassName = `${rootClassName3}Cell`;
3986
+ var InfiniteTableCellContentClassName = `${rootClassName3}Cell_content`;
3987
+ function InfiniteTableCellFn(props) {
3988
+ var _b, _c, _d;
3989
+ const _a = props, {
3990
+ cssEllipsis = true,
3991
+ virtualized = true,
3992
+ skipColumnShifting = false,
3993
+ offsetProperty = "left",
3994
+ contentStyle,
3995
+ column,
3996
+ domRef,
3997
+ width,
3998
+ contentClassName,
3999
+ afterChildren,
4000
+ beforeChildren,
4001
+ offset,
4002
+ cellType,
4003
+ cssPosition: _cssPosition,
4004
+ renderChildren
4005
+ } = _a, domProps = __objRest(_a, [
4006
+ "cssEllipsis",
4007
+ "virtualized",
4008
+ "skipColumnShifting",
4009
+ "offsetProperty",
4010
+ "contentStyle",
4011
+ "column",
4012
+ "domRef",
4013
+ "width",
4014
+ "contentClassName",
4015
+ "afterChildren",
4016
+ "beforeChildren",
4017
+ "offset",
4018
+ "cellType",
4019
+ "cssPosition",
4020
+ "renderChildren"
4021
+ ]);
4022
+ const children = renderChildren();
4023
+ const { columnShifts } = useInfiniteTableState();
4024
+ const shifting = !!columnShifts;
4025
+ const style = __spreadValues({
4026
+ width
4027
+ }, domProps.style);
4028
+ if (!skipColumnShifting && columnShifts && columnShifts[column.computedVisibleIndex]) {
4029
+ const shiftLeft = columnShifts[column.computedVisibleIndex] + (offset != null ? offset : 0);
4030
+ if (virtualized) {
4031
+ style.left = shiftLeft;
4032
+ } else {
4033
+ style.transform = `translate3d(${shiftLeft}px, 0px, 0px)`;
4034
+ }
4035
+ }
4036
+ const finalDOMProps = __spreadProps(__spreadValues({}, domProps), {
4037
+ style,
4038
+ "data-column-id": column.id,
4039
+ className: join(domProps.className, justifyContent[(_b = column.align) != null ? _b : "start"], InfiniteTableCellClassName, ColumnCellCls, shifting ? `${InfiniteTableCellClassName}--shifting ${CellClsVariants.shifting}` : ""),
4040
+ children: /* @__PURE__ */ React16.createElement(React16.Fragment, null, beforeChildren, /* @__PURE__ */ React16.createElement("div", {
4041
+ className: join(InfiniteTableCellContentClassName, cssEllipsis ? cssEllipsisClassName : overflow.hidden, contentClassName),
4042
+ style: contentStyle
4043
+ }, children), afterChildren)
4044
+ });
4045
+ const RenderComponent = cellType === "body" ? (_c = column.components) == null ? void 0 : _c.ColumnCell : (_d = column.components) == null ? void 0 : _d.HeaderCell;
4046
+ if (RenderComponent) {
4047
+ return /* @__PURE__ */ React16.createElement(RenderComponent, __spreadValues({}, finalDOMProps));
4048
+ }
4049
+ return /* @__PURE__ */ React16.createElement("div", __spreadProps(__spreadValues({}, finalDOMProps), {
4050
+ ref: domRef
4051
+ }));
4052
+ }
4053
+ var InfiniteTableCell = React16.memo(InfiniteTableCellFn);
4054
+
4055
+ // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableColumnHeaderFilter.tsx
4056
+ var React17 = __toModule(require("react"));
4057
+ var import_react18 = __toModule(require("react"));
4058
+ var { rootClassName: rootClassName4 } = internalProps;
4059
+ var InfiniteTableColumnHeaderFilterClassName = `${rootClassName4}HeaderCell__filter`;
4060
+ var stopPropagation = (e) => e.stopPropagation();
4061
+ function InfiniteTableColumnHeaderFilter(props) {
4062
+ var _a, _b, _c, _d;
4063
+ const [theValue, setTheValue] = (0, import_react18.useState)((_b = (_a = props.columnFilterValue) == null ? void 0 : _a.filterValue) != null ? _b : "");
4064
+ const onInputChange = (filterValue) => {
4065
+ setTheValue(filterValue);
4066
+ props.onChange(filterValue);
4067
+ };
4068
+ (0, import_react18.useEffect)(() => {
4069
+ var _a2;
4070
+ if (props.columnFilterValue) {
4071
+ if (theValue !== props.columnFilterValue.filterValue) {
4072
+ setTheValue(props.columnFilterValue.filterValue);
4073
+ }
4074
+ } else {
4075
+ const currentFilterType = props.filterTypes[(_a2 = props.columnFilterType) != null ? _a2 : "string"];
4076
+ if (currentFilterType) {
4077
+ const emptyValue = [...currentFilterType.emptyValues][0];
4078
+ if (emptyValue !== theValue) {
4079
+ setTheValue(emptyValue);
4080
+ }
4081
+ }
4082
+ }
4083
+ }, [(_c = props.columnFilterValue) == null ? void 0 : _c.filterValue]);
4084
+ const filterType = props.columnFilterValue ? props.columnFilterValue.filterType : (_d = props.columnFilterType) != null ? _d : "string";
4085
+ const operator = props.columnFilterValue ? props.columnFilterValue.operator : props.filterTypes[filterType] ? props.filterTypes[filterType].defaultOperator : props.filterTypes.string.defaultOperator;
4086
+ const filterEditorProps = {
4087
+ ariaLabel: `Filter for ${props.columnLabel}`,
4088
+ filterValue: theValue,
4089
+ className: HeaderFilterEditorCls,
4090
+ operator,
4091
+ filterType,
4092
+ onChange: onInputChange
4093
+ };
4094
+ const FilterEditor = props.filterEditor;
4095
+ return /* @__PURE__ */ React17.createElement("div", {
4096
+ onPointerUp: stopPropagation,
4097
+ onPointerDown: stopPropagation,
4098
+ className: `${InfiniteTableColumnHeaderFilterClassName} ${HeaderFilterCls}`,
4099
+ style: { height: props.columnHeaderHeight }
4100
+ }, FilterEditor ? /* @__PURE__ */ React17.createElement(FilterEditor, __spreadValues({}, filterEditorProps)) : null);
4101
+ }
4102
+ function InfiniteTableColumnHeaderFilterEmpty() {
4103
+ return /* @__PURE__ */ React17.createElement("div", {
4104
+ onPointerUp: stopPropagation,
4105
+ onPointerDown: stopPropagation,
4106
+ className: `${InfiniteTableColumnHeaderFilterClassName} ${HeaderFilterCls}`,
4107
+ style: { height: "100%" }
4108
+ });
4109
+ }
4110
+
4111
+ // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
4112
+ var InfiniteTableHeaderCellContext = React18.createContext(null);
4113
+ var { rootClassName: rootClassName5 } = internalProps;
4114
+ var InfiniteTableHeaderCellClassName = `${rootClassName5}HeaderCell`;
4115
+ function InfiniteTableHeaderCell(props) {
4116
+ var _a, _b, _c, _d, _e;
4117
+ const column = props.column;
4118
+ const columns = props.columns;
4119
+ const { onResize, height, width, headerOptions } = props;
4120
+ const sortInfo = column.computedSortInfo;
4121
+ let header = column.header;
4122
+ const ref = (0, import_react19.useCallback)((node) => {
4123
+ var _a2;
4124
+ domRef.current = node;
4125
+ (_a2 = props.domRef) == null ? void 0 : _a2.call(props, node);
4126
+ }, [props.domRef]);
4127
+ const alwaysShow = headerOptions.alwaysReserveSpaceForSortIcon;
4128
+ const sortTool = column.computedSorted || alwaysShow ? /* @__PURE__ */ React18.createElement(SortIcon, {
4129
+ index: column.computedMultiSort ? column.computedSortIndex + 1 : void 0,
4130
+ className: `${InfiniteTableHeaderCellClassName}__sort-icon ${HeaderSortIconCls} ${HeaderSortIconRecipe({
4131
+ align: column.align || "start"
4132
+ })}`,
4133
+ direction: column.computedSorted ? column.computedSortedAsc ? 1 : -1 : 0
4134
+ }) : null;
4135
+ const renderParam = {
4136
+ domRef: ref,
4137
+ column,
4138
+ columnSortInfo: sortInfo,
4139
+ columnFilterValue: column.computedFilterValue,
4140
+ sortTool
4141
+ };
4142
+ const align = column.align || "start";
4143
+ const renderChildren = () => {
4144
+ if (header instanceof Function) {
4145
+ header = /* @__PURE__ */ React18.createElement(RenderHookComponent, {
4146
+ render: header,
4147
+ renderParam
3965
4148
  });
3966
4149
  }
3967
4150
  header = header != null ? header : column.name;
3968
- return header;
4151
+ return /* @__PURE__ */ React18.createElement(React18.Fragment, null, align === "end" ? sortTool : null, header, align !== "end" ? sortTool : null);
3969
4152
  };
3970
- const domRef = (0, import_react17.useRef)(null);
4153
+ const domRef = (0, import_react19.useRef)(null);
3971
4154
  const {
3972
- computed: { computedRemainingSpace },
3973
- componentState: { portalDOMRef }
4155
+ computed: { computedRemainingSpace, showColumnFilters },
4156
+ componentState: { portalDOMRef, columnHeaderHeight, filterEditors }
3974
4157
  } = useInfiniteTable();
3975
- (0, import_react17.useEffect)(() => {
4158
+ const {
4159
+ componentActions: dataSourceActions,
4160
+ getState: getDataSourceState,
4161
+ componentState: { filterDelay, filterTypes }
4162
+ } = useDataSourceContextValue();
4163
+ (0, import_react19.useEffect)(() => {
3976
4164
  let clearOnResize = null;
3977
4165
  const node = domRef.current;
3978
4166
  if (onResize && node) {
@@ -3993,7 +4181,7 @@ function InfiniteTableHeaderCell(props) {
3993
4181
  });
3994
4182
  let draggingProxy = null;
3995
4183
  if (dragging) {
3996
- draggingProxy = /* @__PURE__ */ React15.createElement("div", {
4184
+ draggingProxy = /* @__PURE__ */ React18.createElement("div", {
3997
4185
  className: `${InfiniteTableHeaderCellClassName}Proxy ${HeaderCellProxy}`,
3998
4186
  style: {
3999
4187
  position: "absolute",
@@ -4007,9 +4195,73 @@ function InfiniteTableHeaderCell(props) {
4007
4195
  draggingProxy = (0, import_react_dom.createPortal)(draggingProxy, portalDOMRef.current);
4008
4196
  }
4009
4197
  const ContextProvider = InfiniteTableHeaderCellContext.Provider;
4010
- return /* @__PURE__ */ React15.createElement(ContextProvider, {
4198
+ const contentRecipeVariants = {
4199
+ filtered: column.computedFiltered
4200
+ };
4201
+ const setFilterValue = (0, import_react19.useCallback)((filterValue) => {
4202
+ var _a2;
4203
+ const state = getDataSourceState();
4204
+ let newFilterValue = (_a2 = state.filterValue) != null ? _a2 : [];
4205
+ let found = false;
4206
+ newFilterValue = newFilterValue.map((currentFilterValue) => {
4207
+ if (filterValue.id && currentFilterValue.id === filterValue.id || filterValue.field && currentFilterValue.field === column.field) {
4208
+ found = true;
4209
+ return filterValue;
4210
+ }
4211
+ return currentFilterValue;
4212
+ });
4213
+ if (!found) {
4214
+ newFilterValue.push(filterValue);
4215
+ }
4216
+ newFilterValue = newFilterValue.filter((filterValue2) => {
4217
+ const filterType2 = filterTypes[filterValue2.filterType];
4218
+ if (!filterType2 || filterType2.emptyValues.has(filterValue2.filterValue)) {
4219
+ return false;
4220
+ }
4221
+ return true;
4222
+ });
4223
+ dataSourceActions.filterValue = newFilterValue;
4224
+ }, [column, filterTypes]);
4225
+ const debouncedOnFilterValueChange = React18.useMemo(() => {
4226
+ const fn = (filterValue) => {
4227
+ let newFilterValueForColumn;
4228
+ if (column.computedFilterValue) {
4229
+ newFilterValueForColumn = __spreadValues({}, column.computedFilterValue);
4230
+ } else {
4231
+ const filterType2 = column.computedFilterType;
4232
+ const filterValueForColumn = {
4233
+ filterType: filterType2,
4234
+ operator: filterTypes[filterType2].defaultOperator,
4235
+ filterValue,
4236
+ valueGetter: column.valueGetter
4237
+ };
4238
+ if (column.field) {
4239
+ filterValueForColumn.field = column.field;
4240
+ } else {
4241
+ filterValueForColumn.id = column.id;
4242
+ }
4243
+ newFilterValueForColumn = filterValueForColumn;
4244
+ }
4245
+ newFilterValueForColumn.filterValue = filterValue;
4246
+ setFilterValue(newFilterValueForColumn);
4247
+ };
4248
+ if (filterDelay > 0) {
4249
+ return debounce(fn, { wait: filterDelay });
4250
+ }
4251
+ return fn;
4252
+ }, [
4253
+ filterDelay,
4254
+ setFilterValue,
4255
+ column.computedFilterValue,
4256
+ column.id,
4257
+ column.field,
4258
+ column.computedFilterType
4259
+ ]);
4260
+ const filterType = column.computedFilterType;
4261
+ const FilterEditor = filterEditors[filterType] || defaultFilterEditors[filterType] || StringFilterEditor;
4262
+ return /* @__PURE__ */ React18.createElement(ContextProvider, {
4011
4263
  value: renderParam
4012
- }, /* @__PURE__ */ React15.createElement(InfiniteTableCell, {
4264
+ }, /* @__PURE__ */ React18.createElement(InfiniteTableCell, {
4013
4265
  domRef: ref,
4014
4266
  cellType: "header",
4015
4267
  column,
@@ -4019,19 +4271,29 @@ function InfiniteTableHeaderCell(props) {
4019
4271
  width,
4020
4272
  onPointerDown,
4021
4273
  onPointerUp,
4274
+ contentClassName: join(HeaderCellContentRecipe(contentRecipeVariants), justifyContent[(_c = column.align) != null ? _c : "start"]),
4275
+ contentStyle: showColumnFilters ? { height: height / 2 } : void 0,
4022
4276
  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,
4277
+ cssEllipsis: (_e = (_d = column.headerCssEllipsis) != null ? _d : column.cssEllipsis) != null ? _e : true,
4278
+ afterChildren: showColumnFilters ? column.computedFilterable ? /* @__PURE__ */ React18.createElement(InfiniteTableColumnHeaderFilter, {
4279
+ filterEditor: FilterEditor,
4280
+ filterTypes,
4281
+ onChange: debouncedOnFilterValueChange,
4282
+ columnFilterType: filterType,
4283
+ columnLabel: column.field || column.name || column.id,
4284
+ columnFilterValue: column.computedFilterValue,
4285
+ columnHeaderHeight
4286
+ }) : /* @__PURE__ */ React18.createElement(InfiniteTableColumnHeaderFilterEmpty, null) : null,
4025
4287
  renderChildren
4026
4288
  }), draggingProxy);
4027
4289
  }
4028
4290
  function useInfiniteHeaderCell() {
4029
- const result = (0, import_react17.useContext)(InfiniteTableHeaderCellContext);
4291
+ const result = (0, import_react19.useContext)(InfiniteTableHeaderCellContext);
4030
4292
  return result;
4031
4293
  }
4032
4294
 
4033
4295
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx
4034
- var React18 = __toModule(require("react"));
4296
+ var React21 = __toModule(require("react"));
4035
4297
 
4036
4298
  // src/components/utils/getScrollbarWidth.ts
4037
4299
  var scrollbarWidth;
@@ -4153,11 +4415,11 @@ function assignGroupOffsetsAndComputedWidths(items, groupOffset = 0) {
4153
4415
  }
4154
4416
 
4155
4417
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
4156
- var React17 = __toModule(require("react"));
4157
- var import_react18 = __toModule(require("react"));
4418
+ var React20 = __toModule(require("react"));
4419
+ var import_react20 = __toModule(require("react"));
4158
4420
 
4159
4421
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderGroup.tsx
4160
- var React16 = __toModule(require("react"));
4422
+ var React19 = __toModule(require("react"));
4161
4423
  var TableHeaderGroupClassName = `${rootClassName2}HeaderGroup`;
4162
4424
  function InfiniteTableHeaderGroup(props) {
4163
4425
  const { columnGroup, height, width } = props;
@@ -4167,35 +4429,35 @@ function InfiniteTableHeaderGroup(props) {
4167
4429
  columnGroup
4168
4430
  });
4169
4431
  }
4170
- return /* @__PURE__ */ React16.createElement("div", {
4432
+ return /* @__PURE__ */ React19.createElement("div", {
4171
4433
  ref: props.domRef,
4172
4434
  "data-group-id": columnGroup.uniqueGroupId,
4173
4435
  className: join(HeaderGroupCls, TableHeaderGroupClassName),
4174
4436
  style: { width, height }
4175
- }, /* @__PURE__ */ React16.createElement("div", {
4437
+ }, /* @__PURE__ */ React19.createElement("div", {
4176
4438
  className: join(`${TableHeaderGroupClassName}__header-content`, cssEllipsisClassName)
4177
4439
  }, header));
4178
4440
  }
4179
4441
 
4180
4442
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
4181
- var { rootClassName: rootClassName5 } = internalProps;
4182
- var TableHeaderClassName = `${rootClassName5}Header`;
4443
+ var { rootClassName: rootClassName6 } = internalProps;
4444
+ var TableHeaderClassName = `${rootClassName6}Header`;
4183
4445
  function InfiniteTableHeaderFn(props) {
4184
4446
  const {
4185
4447
  brain,
4186
4448
  columns,
4187
4449
  style,
4188
4450
  className,
4189
- headerHeight,
4451
+ columnHeaderHeight,
4190
4452
  columnAndGroupTreeInfo,
4191
4453
  columnGroupsMaxDepth
4192
4454
  } = props;
4193
4455
  const {
4194
4456
  computed,
4195
- componentState: { headerBrain }
4457
+ componentState: { headerBrain, headerOptions }
4196
4458
  } = useInfiniteTable();
4197
- const { computedVisibleColumnsMap } = computed;
4198
- (0, import_react18.useEffect)(() => {
4459
+ const { computedVisibleColumnsMap, showColumnFilters } = computed;
4460
+ (0, import_react20.useEffect)(() => {
4199
4461
  const onScroll = (scrollPosition) => {
4200
4462
  if (domRef.current) {
4201
4463
  domRef.current.style.transform = `translate3d(-${scrollPosition.scrollLeft}px, 0px, 0px)`;
@@ -4204,7 +4466,7 @@ function InfiniteTableHeaderFn(props) {
4204
4466
  const removeOnScroll = brain.onScroll(onScroll);
4205
4467
  return removeOnScroll;
4206
4468
  }, [brain]);
4207
- const domRef = (0, import_react18.useRef)(null);
4469
+ const domRef = (0, import_react20.useRef)(null);
4208
4470
  const headerCls = HeaderClsRecipe({
4209
4471
  overflow: false,
4210
4472
  virtualized: true
@@ -4212,9 +4474,9 @@ function InfiniteTableHeaderFn(props) {
4212
4474
  const domProps = {
4213
4475
  ref: domRef,
4214
4476
  className: join(TableHeaderClassName, `${TableHeaderClassName}--virtualized`, className, headerCls),
4215
- style: __spreadProps(__spreadValues({}, style), { height: headerHeight })
4477
+ style: __spreadProps(__spreadValues({}, style), { height: columnHeaderHeight })
4216
4478
  };
4217
- const renderCell = (0, import_react18.useCallback)((params) => {
4479
+ const renderCell = (0, import_react20.useCallback)((params) => {
4218
4480
  const {
4219
4481
  rowIndex,
4220
4482
  colIndex,
@@ -4239,7 +4501,7 @@ function InfiniteTableHeaderFn(props) {
4239
4501
  computedWidth: colGroupItem.computedWidth,
4240
4502
  groupOffset: colGroupItem.groupOffset
4241
4503
  });
4242
- return /* @__PURE__ */ React17.createElement(InfiniteTableHeaderGroup, {
4504
+ return /* @__PURE__ */ React20.createElement(InfiniteTableHeaderGroup, {
4243
4505
  domRef: domRef2,
4244
4506
  columns: columns2,
4245
4507
  width: widthWithColspan,
@@ -4247,21 +4509,29 @@ function InfiniteTableHeaderFn(props) {
4247
4509
  columnGroup: computedColumnGroup
4248
4510
  });
4249
4511
  }
4250
- return /* @__PURE__ */ React17.createElement(InfiniteTableHeaderCell, {
4512
+ return /* @__PURE__ */ React20.createElement(InfiniteTableHeaderCell, {
4251
4513
  domRef: domRef2,
4252
4514
  column,
4515
+ headerOptions,
4253
4516
  width: widthWithColspan,
4254
4517
  height: heightWithRowspan,
4255
4518
  columns: computedVisibleColumnsMap
4256
4519
  });
4257
- }, [columns, headerHeight, columnAndGroupTreeInfo, columnGroupsMaxDepth]);
4258
- return /* @__PURE__ */ React17.createElement("div", __spreadValues({}, domProps), /* @__PURE__ */ React17.createElement(RawTable, {
4520
+ }, [
4521
+ headerOptions,
4522
+ columns,
4523
+ columnHeaderHeight,
4524
+ columnAndGroupTreeInfo,
4525
+ columnGroupsMaxDepth,
4526
+ showColumnFilters
4527
+ ]);
4528
+ return /* @__PURE__ */ React20.createElement("div", __spreadValues({}, domProps), /* @__PURE__ */ React20.createElement(RawTable, {
4259
4529
  renderCell,
4260
4530
  brain: headerBrain,
4261
4531
  cellHoverClassNames: []
4262
4532
  }));
4263
4533
  }
4264
- var InfiniteTableHeader = React17.memo(InfiniteTableHeaderFn);
4534
+ var InfiniteTableHeader = React20.memo(InfiniteTableHeaderFn);
4265
4535
 
4266
4536
  // src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx
4267
4537
  function TableHeaderWrapper(props) {
@@ -4271,25 +4541,26 @@ function TableHeaderWrapper(props) {
4271
4541
  computedPinnedStartColumns,
4272
4542
  computedPinnedEndColumns,
4273
4543
  computedVisibleColumns,
4274
- columnSize
4544
+ columnSize,
4545
+ showColumnFilters
4275
4546
  } = tableContextValue.computed;
4276
4547
  const {
4277
4548
  componentState: {
4278
- headerHeight,
4549
+ columnHeaderHeight,
4279
4550
  columnGroupsDepthsMap,
4280
4551
  columnGroupsMaxDepth,
4281
4552
  computedColumnGroups
4282
4553
  }
4283
4554
  } = tableContextValue;
4284
4555
  const rows = !computedColumnGroups || !computedColumnGroups.size ? 1 : columnGroupsMaxDepth + 2;
4285
- const height = rows * headerHeight;
4286
- const columnAndGroupTreeInfo = React18.useMemo(() => {
4556
+ const height = rows * columnHeaderHeight + (showColumnFilters ? columnHeaderHeight : 0);
4557
+ const columnAndGroupTreeInfo = React21.useMemo(() => {
4287
4558
  if (!computedColumnGroups || !computedColumnGroups.size) {
4288
4559
  return void 0;
4289
4560
  }
4290
4561
  return buildColumnAndGroupTree(computedVisibleColumns, computedColumnGroups, columnGroupsDepthsMap, columnGroupsMaxDepth);
4291
4562
  }, [computedVisibleColumns, computedColumnGroups, columnGroupsDepthsMap]);
4292
- const cellspan = React18.useCallback(({ rowIndex, colIndex }) => {
4563
+ const cellspan = React21.useCallback(({ rowIndex, colIndex }) => {
4293
4564
  const column = computedVisibleColumns[colIndex];
4294
4565
  const rowspan2 = 1;
4295
4566
  const colspan2 = 1;
@@ -4322,11 +4593,14 @@ function TableHeaderWrapper(props) {
4322
4593
  rows,
4323
4594
  columnGroupsDepthsMap
4324
4595
  ]);
4325
- const rowspan = React18.useCallback(({ rowIndex, colIndex }) => cellspan({ rowIndex, colIndex }).rowspan, [cellspan]);
4326
- const colspan = React18.useCallback(({ rowIndex, colIndex }) => cellspan({ rowIndex, colIndex }).colspan, [cellspan]);
4596
+ const rowspan = React21.useCallback(({ rowIndex, colIndex }) => cellspan({ rowIndex, colIndex }).rowspan, [cellspan]);
4597
+ const colspan = React21.useCallback(({ rowIndex, colIndex }) => cellspan({ rowIndex, colIndex }).colspan, [cellspan]);
4598
+ const rowHeight = React21.useCallback((index) => {
4599
+ return showColumnFilters ? index < rows - 1 ? columnHeaderHeight : 2 * columnHeaderHeight : columnHeaderHeight;
4600
+ }, [rows, showColumnFilters, columnHeaderHeight]);
4327
4601
  useMatrixBrain(brain, {
4328
4602
  colWidth: columnSize,
4329
- rowHeight: headerHeight,
4603
+ rowHeight,
4330
4604
  rows,
4331
4605
  cols: computedVisibleColumns.length,
4332
4606
  height,
@@ -4336,21 +4610,21 @@ function TableHeaderWrapper(props) {
4336
4610
  fixedColsEnd: computedPinnedEndColumns.length,
4337
4611
  fixedColsStart: computedPinnedStartColumns.length
4338
4612
  });
4339
- const header = /* @__PURE__ */ React18.createElement(InfiniteTableHeader, {
4613
+ const header = /* @__PURE__ */ React21.createElement(InfiniteTableHeader, {
4340
4614
  columns: computedVisibleColumns,
4341
4615
  brain,
4342
- headerHeight: height,
4616
+ columnHeaderHeight: height,
4343
4617
  columnGroupsMaxDepth,
4344
4618
  columnAndGroupTreeInfo
4345
4619
  });
4346
- const verticalScrollbarPlaceholder = scrollbars.vertical && getScrollbarWidth() ? /* @__PURE__ */ React18.createElement("div", {
4620
+ const verticalScrollbarPlaceholder = scrollbars.vertical && getScrollbarWidth() ? /* @__PURE__ */ React21.createElement("div", {
4347
4621
  className: HeaderScrollbarPlaceholderCls,
4348
4622
  style: {
4349
4623
  zIndex: 1e3,
4350
4624
  width: getScrollbarWidth()
4351
4625
  }
4352
4626
  }) : null;
4353
- return /* @__PURE__ */ React18.createElement("div", {
4627
+ return /* @__PURE__ */ React21.createElement("div", {
4354
4628
  className: HeaderWrapperCls,
4355
4629
  style: {
4356
4630
  height
@@ -4359,8 +4633,8 @@ function TableHeaderWrapper(props) {
4359
4633
  }
4360
4634
 
4361
4635
  // src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
4362
- var React19 = __toModule(require("react"));
4363
- var import_react19 = __toModule(require("react"));
4636
+ var React22 = __toModule(require("react"));
4637
+ var import_react21 = __toModule(require("react"));
4364
4638
 
4365
4639
  // src/components/utils/decamelize.ts
4366
4640
  function decamelize(str, options) {
@@ -4369,7 +4643,7 @@ function decamelize(str, options) {
4369
4643
  }
4370
4644
 
4371
4645
  // 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)" } } };
4646
+ 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)" }, 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)" } } };
4373
4647
 
4374
4648
  // src/components/InfiniteTable/InfiniteCls.css.ts
4375
4649
  var import_createRuntimeFn3 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
@@ -4406,10 +4680,10 @@ var enforceStyle = (node, style) => {
4406
4680
  node.style.setProperty(decamelize(propertyName), propertyValue, "important");
4407
4681
  }
4408
4682
  };
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) => {
4683
+ var InfiniteTableLicenseFooter = React22.forwardRef(function InfiniteTableLicenseFooter2(props, ref) {
4684
+ const { rootClassName: rootClassName9 } = useInternalProps();
4685
+ const domRef = React22.useRef(null);
4686
+ const domCallback = React22.useCallback((node) => {
4413
4687
  domRef.current = node;
4414
4688
  if (!ref) {
4415
4689
  return;
@@ -4420,7 +4694,7 @@ var InfiniteTableLicenseFooter = React19.forwardRef(function InfiniteTableLicens
4420
4694
  ref.current = node;
4421
4695
  }
4422
4696
  }, []);
4423
- (0, import_react19.useEffect)(() => {
4697
+ (0, import_react21.useEffect)(() => {
4424
4698
  const forceStyle = () => {
4425
4699
  requestAnimationFrame(() => {
4426
4700
  var _a;
@@ -4434,12 +4708,12 @@ var InfiniteTableLicenseFooter = React19.forwardRef(function InfiniteTableLicens
4434
4708
  clearInterval(intervalId);
4435
4709
  };
4436
4710
  }, []);
4437
- return /* @__PURE__ */ React19.createElement("div", __spreadProps(__spreadValues({
4711
+ return /* @__PURE__ */ React22.createElement("div", __spreadProps(__spreadValues({
4438
4712
  ref: domCallback
4439
4713
  }, props), {
4440
- className: join(`${rootClassName8}-Footer`, FooterCls, props.className),
4714
+ className: join(`${rootClassName9}-Footer`, FooterCls, props.className),
4441
4715
  style: defaultStyle
4442
- }), "Powered by", " ", /* @__PURE__ */ React19.createElement("a", {
4716
+ }), "Powered by", " ", /* @__PURE__ */ React22.createElement("a", {
4443
4717
  href: "https://infinite-table.com",
4444
4718
  rel: "noopener noreferrer",
4445
4719
  role: "link",
@@ -4448,11 +4722,11 @@ var InfiniteTableLicenseFooter = React19.forwardRef(function InfiniteTableLicens
4448
4722
  });
4449
4723
 
4450
4724
  // 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`;
4725
+ var React23 = __toModule(require("react"));
4726
+ var import_react22 = __toModule(require("react"));
4727
+ var { rootClassName: rootClassName7 } = internalProps;
4728
+ var InfiniteTableColumnCellContext = React23.createContext(null);
4729
+ var InfiniteTableColumnCellClassName = `${rootClassName7}ColumnCell`;
4456
4730
  function isColumnWithField(c) {
4457
4731
  return typeof c.field === "string";
4458
4732
  }
@@ -4460,6 +4734,8 @@ function InfiniteTableColumnCellFn(props) {
4460
4734
  var _a;
4461
4735
  const {
4462
4736
  rowInfo,
4737
+ rowStyle,
4738
+ rowClassName,
4463
4739
  width,
4464
4740
  column,
4465
4741
  onMouseLeave,
@@ -4474,7 +4750,7 @@ function InfiniteTableColumnCellFn(props) {
4474
4750
  showZebraRows
4475
4751
  } = props;
4476
4752
  if (!column) {
4477
- return /* @__PURE__ */ React20.createElement("div", {
4753
+ return /* @__PURE__ */ React23.createElement("div", {
4478
4754
  ref: domRef
4479
4755
  }, "no column");
4480
4756
  }
@@ -4483,37 +4759,49 @@ function InfiniteTableColumnCellFn(props) {
4483
4759
  const groupRowInfo = null;
4484
4760
  let value = isGroupRow && groupBy && column.groupByField ? rowInfo.value : isColumnWithField(column) ? data == null ? void 0 : data[column.field] : null;
4485
4761
  if (column.valueGetter) {
4486
- value = column.valueGetter(isGroupRow ? {
4762
+ if (!rowInfo.isGroupRow && rowInfo.data) {
4763
+ value = column.valueGetter({ data: rowInfo.data, field: column.field });
4764
+ }
4765
+ }
4766
+ if (column.valueFormatter) {
4767
+ value = column.valueFormatter(isGroupRow ? {
4487
4768
  data: rowInfo.data,
4488
4769
  isGroupRow,
4489
- rowInfo
4770
+ rowInfo,
4771
+ field: column.field,
4772
+ value
4490
4773
  } : {
4491
4774
  data: rowInfo.data,
4492
4775
  isGroupRow,
4493
- rowInfo
4776
+ rowInfo,
4777
+ field: column.field,
4778
+ value
4494
4779
  });
4495
4780
  }
4496
4781
  const { componentState: computedDataSource } = useDataSourceContextValue();
4497
4782
  const rest = rowInfo.isGroupRow ? {
4498
4783
  rowInfo,
4499
- data: rowInfo.data
4784
+ isGroupRow: rowInfo.isGroupRow,
4785
+ data: rowInfo.data,
4786
+ value,
4787
+ field: column.field
4500
4788
  } : {
4501
4789
  rowInfo,
4502
- data: rowInfo.data
4790
+ isGroupRow: rowInfo.isGroupRow,
4791
+ data: rowInfo.data,
4792
+ value,
4793
+ field: column.field
4503
4794
  };
4504
4795
  const stylingRenderParam = __spreadValues({
4505
- value,
4506
- column,
4507
- isGroupRow
4796
+ column
4508
4797
  }, rest);
4509
4798
  const renderValue = value;
4510
4799
  const renderParam = __spreadProps(__spreadValues({
4511
- value,
4512
4800
  column,
4513
4801
  domRef,
4514
- groupRowInfo,
4515
- isGroupRow
4802
+ groupRowInfo
4516
4803
  }, rest), {
4804
+ isGroupRow,
4517
4805
  rowIndex,
4518
4806
  toggleGroupRow,
4519
4807
  toggleCurrentGroupRow: () => {
@@ -4531,15 +4819,23 @@ function InfiniteTableColumnCellFn(props) {
4531
4819
  }
4532
4820
  const renderFn = column.render || column.renderValue;
4533
4821
  if (renderFn) {
4534
- return /* @__PURE__ */ React20.createElement(RenderHookComponent, {
4822
+ return /* @__PURE__ */ React23.createElement(RenderHookComponent, {
4535
4823
  render: renderFn,
4536
4824
  renderParam
4537
4825
  });
4538
4826
  }
4539
4827
  return renderValue;
4540
4828
  };
4829
+ const rowPropsAndStyleArgs = __spreadProps(__spreadValues({}, rest), {
4830
+ rowIndex
4831
+ });
4832
+ const rowComputedClassName = typeof rowClassName === "function" ? rowClassName(rowPropsAndStyleArgs) : rowClassName;
4541
4833
  const colClassName = column.className ? typeof column.className === "function" ? column.className(stylingRenderParam) : column.className : void 0;
4542
- const style = column.style ? typeof column.style === "function" ? column.style(stylingRenderParam) || {} : __spreadValues({}, column.style) : {};
4834
+ let style;
4835
+ if (rowStyle) {
4836
+ style = typeof rowStyle === "function" ? __spreadValues(__spreadValues({}, style), rowStyle(rowPropsAndStyleArgs)) : __spreadValues(__spreadValues({}, style), rowStyle);
4837
+ }
4838
+ style = column.style ? typeof column.style === "function" ? __spreadValues(__spreadValues({}, style), column.style(stylingRenderParam) || {}) : __spreadValues(__spreadValues({}, style), column.style) : style || {};
4543
4839
  style.width = width;
4544
4840
  style.height = rowHeight;
4545
4841
  const odd = (rowInfo.indexInAll != null ? rowInfo.indexInAll : rowIndex) % 2 === 1;
@@ -4555,17 +4851,17 @@ function InfiniteTableColumnCellFn(props) {
4555
4851
  onMouseLeave,
4556
4852
  onMouseEnter,
4557
4853
  cssEllipsis: (_a = column.cssEllipsis) != null ? _a : true,
4558
- className: join(useCellClassName(column, [InfiniteTableColumnCellClassName, InfiniteTableCellClassName], ColumnCellRecipe, { dragging: false, zebra }), colClassName),
4854
+ className: join(useCellClassName(column, [InfiniteTableColumnCellClassName, InfiniteTableCellClassName], ColumnCellRecipe, { dragging: false, zebra }), colClassName, rowComputedClassName),
4559
4855
  renderChildren
4560
4856
  };
4561
4857
  const ContextProvider = InfiniteTableColumnCellContext.Provider;
4562
- return /* @__PURE__ */ React20.createElement(ContextProvider, {
4858
+ return /* @__PURE__ */ React23.createElement(ContextProvider, {
4563
4859
  value: renderParam
4564
- }, /* @__PURE__ */ React20.createElement(InfiniteTableCell, __spreadValues({}, cellProps)));
4860
+ }, /* @__PURE__ */ React23.createElement(InfiniteTableCell, __spreadValues({}, cellProps)));
4565
4861
  }
4566
- var InfiniteTableColumnCell = React20.memo(InfiniteTableColumnCellFn);
4862
+ var InfiniteTableColumnCell = React23.memo(InfiniteTableColumnCellFn);
4567
4863
  function useInfiniteColumnCell() {
4568
- const result = (0, import_react20.useContext)(InfiniteTableColumnCellContext);
4864
+ const result = (0, import_react22.useContext)(InfiniteTableColumnCellContext);
4569
4865
  return result;
4570
4866
  }
4571
4867
 
@@ -4576,7 +4872,7 @@ var RowClsRecipe = (0, import_createRuntimeFn4.createRuntimeFn)({ defaultClassNa
4576
4872
  var RowHoverCls = "_7pupv01";
4577
4873
 
4578
4874
  // src/components/InfiniteTable/components/LoadMask.tsx
4579
- var React21 = __toModule(require("react"));
4875
+ var React24 = __toModule(require("react"));
4580
4876
 
4581
4877
  // src/components/InfiniteTable/components/LoadMask.css.ts
4582
4878
  var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2 _16lm1iwt _16lm1iwv _16lm1iwz _16lm1iwx", hidden: "qy58ya2 qy58ya0 _16lm1iw2 _16lm1iwt _16lm1iwv _16lm1iwz _16lm1iwx" };
@@ -4584,22 +4880,22 @@ var LoadMaskOverlayCls = "qy58ya3 _16lm1iw2 _16lm1iwt _16lm1iwv _16lm1iwz _16lm1
4584
4880
  var LoadMaskTextCls = "qy58ya4";
4585
4881
 
4586
4882
  // src/components/InfiniteTable/components/LoadMask.tsx
4587
- var { rootClassName: rootClassName7 } = internalProps;
4588
- var baseCls = `${rootClassName7}-LoadMask`;
4883
+ var { rootClassName: rootClassName8 } = internalProps;
4884
+ var baseCls = `${rootClassName8}-LoadMask`;
4589
4885
  function LoadMaskFn(props) {
4590
4886
  const { visible, children = "Loading" } = props;
4591
- return /* @__PURE__ */ React21.createElement("div", {
4887
+ return /* @__PURE__ */ React24.createElement("div", {
4592
4888
  className: `${LoadMaskCls[visible ? "visible" : "hidden"]} ${baseCls}`
4593
- }, /* @__PURE__ */ React21.createElement("div", {
4889
+ }, /* @__PURE__ */ React24.createElement("div", {
4594
4890
  className: `${LoadMaskOverlayCls} ${baseCls}-Overlay`
4595
- }), /* @__PURE__ */ React21.createElement("div", {
4891
+ }), /* @__PURE__ */ React24.createElement("div", {
4596
4892
  className: `${LoadMaskTextCls} ${baseCls}-Text`
4597
4893
  }, children));
4598
4894
  }
4599
- var LoadMask = React21.memo(LoadMaskFn);
4895
+ var LoadMask = React24.memo(LoadMaskFn);
4600
4896
 
4601
4897
  // src/components/InfiniteTable/hooks/useAutoSizeColumns.ts
4602
- var import_react21 = __toModule(require("react"));
4898
+ var import_react23 = __toModule(require("react"));
4603
4899
  var OFFSET = 10;
4604
4900
  function getColumnContentMaxWidths(domRef, options) {
4605
4901
  var _a;
@@ -4621,6 +4917,7 @@ function getColumnContentMaxWidths(domRef, options) {
4621
4917
  contentClone.style.pointerEvents = "none";
4622
4918
  contentClone.classList.remove(...cssEllipsisClassName.split(" "));
4623
4919
  contentClone.style.position = "absolute";
4920
+ contentClone.style.width = "auto";
4624
4921
  cell.appendChild(contentClone);
4625
4922
  let measuredWidth = contentClone.offsetWidth;
4626
4923
  cell.removeChild(contentClone);
@@ -4658,11 +4955,11 @@ function useAutoSizeColumns() {
4658
4955
  componentActions,
4659
4956
  componentState: { domRef, ready, autoSizeColumnsKey, brain }
4660
4957
  } = useComponentState();
4661
- const [refreshId, setRefreshId] = (0, import_react21.useState)(0);
4958
+ const [refreshId, setRefreshId] = (0, import_react23.useState)(0);
4662
4959
  const theKey = typeof autoSizeColumnsKey === "object" ? autoSizeColumnsKey.key : autoSizeColumnsKey;
4663
4960
  const getTheKey = useLatest(theKey);
4664
- const lastExecutedIdentifierRef = (0, import_react21.useRef)(null);
4665
- (0, import_react21.useEffect)(() => {
4961
+ const lastExecutedIdentifierRef = (0, import_react23.useRef)(null);
4962
+ (0, import_react23.useEffect)(() => {
4666
4963
  const key = getTheKey();
4667
4964
  if (key == null) {
4668
4965
  return;
@@ -4675,7 +4972,7 @@ function useAutoSizeColumns() {
4675
4972
  };
4676
4973
  return brain.onRenderRangeChange(onChange);
4677
4974
  }, [brain]);
4678
- (0, import_react21.useEffect)(() => {
4975
+ (0, import_react23.useEffect)(() => {
4679
4976
  var _a;
4680
4977
  if (theKey == null) {
4681
4978
  return;
@@ -4720,16 +5017,16 @@ function useAutoSizeColumns() {
4720
5017
  }
4721
5018
 
4722
5019
  // src/components/InfiniteTable/hooks/useCellRendering.tsx
4723
- var import_react23 = __toModule(require("react"));
4724
- var import_react24 = __toModule(require("react"));
5020
+ var import_react25 = __toModule(require("react"));
5021
+ var import_react26 = __toModule(require("react"));
4725
5022
 
4726
5023
  // src/components/hooks/useRerender.ts
4727
- var import_react22 = __toModule(require("react"));
5024
+ var import_react24 = __toModule(require("react"));
4728
5025
  var useRerender = () => {
4729
- const [state, setState] = (0, import_react22.useState)(0);
5026
+ const [state, setState] = (0, import_react24.useState)(0);
4730
5027
  return [
4731
5028
  state,
4732
- (0, import_react22.useCallback)(() => {
5029
+ (0, import_react24.useCallback)(() => {
4733
5030
  setState((state2) => state2 + 1);
4734
5031
  }, [setState])
4735
5032
  ];
@@ -4785,6 +5082,8 @@ function useCellRendering(param) {
4785
5082
  groupRenderStrategy,
4786
5083
  brain,
4787
5084
  showZebraRows,
5085
+ rowStyle,
5086
+ rowClassName,
4788
5087
  onScrollToTop,
4789
5088
  onScrollToBottom,
4790
5089
  scrollToBottomOffset
@@ -4801,13 +5100,13 @@ function useCellRendering(param) {
4801
5100
  bodySize,
4802
5101
  rowspan
4803
5102
  });
4804
- const scrollTopMaxRef = (0, import_react23.useRef)(0);
4805
- (0, import_react23.useEffect)(() => {
5103
+ const scrollTopMaxRef = (0, import_react25.useRef)(0);
5104
+ (0, import_react25.useEffect)(() => {
4806
5105
  return brain.onRenderCountChange(() => {
4807
5106
  scrollTopMaxRef.current = brain.scrollTopMax;
4808
5107
  });
4809
5108
  }, [brain]);
4810
- (0, import_react23.useEffect)(() => {
5109
+ (0, import_react25.useEffect)(() => {
4811
5110
  return brain.onScrollStop((scrollPosition) => {
4812
5111
  const { scrollTop } = scrollPosition;
4813
5112
  if (scrollTop === 0) {
@@ -4824,7 +5123,7 @@ function useCellRendering(param) {
4824
5123
  }
4825
5124
  });
4826
5125
  }, [brain, onScrollToTop, onScrollToBottom]);
4827
- (0, import_react23.useEffect)(() => {
5126
+ (0, import_react25.useEffect)(() => {
4828
5127
  if (!bodySize.height) {
4829
5128
  return;
4830
5129
  }
@@ -4845,10 +5144,10 @@ function useCellRendering(param) {
4845
5144
  }
4846
5145
  }, [!!bodySize.height]);
4847
5146
  const [, rerender] = useRerender();
4848
- (0, import_react23.useEffect)(() => {
5147
+ (0, import_react25.useEffect)(() => {
4849
5148
  rerender();
4850
5149
  }, [dataSourceState]);
4851
- const renderCell = (0, import_react23.useCallback)((params) => {
5150
+ const renderCell = (0, import_react25.useCallback)((params) => {
4852
5151
  const {
4853
5152
  rowIndex,
4854
5153
  colIndex,
@@ -4879,9 +5178,11 @@ function useCellRendering(param) {
4879
5178
  onMouseLeave,
4880
5179
  domRef,
4881
5180
  width,
4882
- column
5181
+ column,
5182
+ rowStyle,
5183
+ rowClassName
4883
5184
  };
4884
- return /* @__PURE__ */ import_react24.default.createElement(InfiniteTableColumnCell, __spreadValues({}, cellProps));
5185
+ return /* @__PURE__ */ import_react26.default.createElement(InfiniteTableColumnCell, __spreadValues({}, cellProps));
4885
5186
  }, [
4886
5187
  rowHeight,
4887
5188
  getData,
@@ -4889,7 +5190,9 @@ function useCellRendering(param) {
4889
5190
  groupRenderStrategy,
4890
5191
  toggleGroupRow,
4891
5192
  showZebraRows,
4892
- repaintId
5193
+ repaintId,
5194
+ rowStyle,
5195
+ rowClassName
4893
5196
  ]);
4894
5197
  return {
4895
5198
  renderCell
@@ -4897,13 +5200,13 @@ function useCellRendering(param) {
4897
5200
  }
4898
5201
 
4899
5202
  // src/components/InfiniteTable/hooks/useComputed.ts
4900
- var import_react38 = __toModule(require("react"));
5203
+ var import_react40 = __toModule(require("react"));
4901
5204
 
4902
5205
  // src/components/InfiniteTable/hooks/useColumnGroups.ts
4903
- var import_react26 = __toModule(require("react"));
5206
+ var import_react28 = __toModule(require("react"));
4904
5207
 
4905
5208
  // src/components/hooks/useInterceptedMap.ts
4906
- var import_react25 = __toModule(require("react"));
5209
+ var import_react27 = __toModule(require("react"));
4907
5210
  function interceptMap(map2, fns) {
4908
5211
  const { set, delete: deleteKey, clear } = map2;
4909
5212
  if (fns.set) {
@@ -4991,7 +5294,7 @@ function useColumnGroups() {
4991
5294
  componentActions,
4992
5295
  getComponentState
4993
5296
  } = useComponentState();
4994
- (0, import_react26.useEffect)(() => {
5297
+ (0, import_react28.useEffect)(() => {
4995
5298
  const recompute = () => {
4996
5299
  componentActions.columnGroupsDepthsMap = computeColumnGroupsDepths(computedColumnGroups);
4997
5300
  };
@@ -5002,7 +5305,7 @@ function useColumnGroups() {
5002
5305
  set: update
5003
5306
  });
5004
5307
  }, [computedColumnGroups]);
5005
- (0, import_react26.useEffect)(() => {
5308
+ (0, import_react28.useEffect)(() => {
5006
5309
  return interceptMap(collapsedColumnGroups, {
5007
5310
  set: (key, visibleCol) => {
5008
5311
  const colIds = key.slice(1);
@@ -5037,14 +5340,17 @@ function useColumnGroups() {
5037
5340
  }
5038
5341
 
5039
5342
  // src/components/InfiniteTable/hooks/useColumnRowspan.ts
5040
- var import_react27 = __toModule(require("react"));
5343
+ var import_react29 = __toModule(require("react"));
5041
5344
  function useColumnRowspan(computedVisibleColumns) {
5042
5345
  const { getState: getDataSourceState } = useDataSourceContextValue();
5043
- const rowspan = (0, import_react27.useMemo)(() => {
5346
+ const rowspan = (0, import_react29.useMemo)(() => {
5044
5347
  const colsWithRowspan = computedVisibleColumns.filter((col) => typeof col.rowspan === "function");
5045
5348
  return colsWithRowspan.length ? ({ rowIndex, colIndex }) => {
5046
5349
  const dataArray = getDataSourceState().dataArray;
5047
5350
  const rowInfo = dataArray[rowIndex];
5351
+ if (!rowInfo) {
5352
+ return 1;
5353
+ }
5048
5354
  const data = rowInfo.data;
5049
5355
  const column = computedVisibleColumns[colIndex];
5050
5356
  if (!column || !column.rowspan) {
@@ -5063,10 +5369,10 @@ function useColumnRowspan(computedVisibleColumns) {
5063
5369
  }
5064
5370
 
5065
5371
  // src/components/InfiniteTable/hooks/useColumnSizeFn.ts
5066
- var import_react28 = __toModule(require("react"));
5372
+ var import_react30 = __toModule(require("react"));
5067
5373
  var debug4 = dbg("useColumnSizeFn");
5068
5374
  function useColumnSizeFn(columns) {
5069
- const columnSize = (0, import_react28.useCallback)((index) => {
5375
+ const columnSize = (0, import_react30.useCallback)((index) => {
5070
5376
  const column = columns[index];
5071
5377
  if (!column) {
5072
5378
  debug4("cannot find column at index", index, columns);
@@ -5077,10 +5383,10 @@ function useColumnSizeFn(columns) {
5077
5383
  }
5078
5384
 
5079
5385
  // src/components/InfiniteTable/hooks/useColumnsWhen.ts
5080
- var import_react34 = __toModule(require("react"));
5386
+ var import_react36 = __toModule(require("react"));
5081
5387
 
5082
5388
  // src/components/InfiniteTable/utils/getColumnForGroupBy.tsx
5083
- var React25 = __toModule(require("react"));
5389
+ var React28 = __toModule(require("react"));
5084
5390
 
5085
5391
  // src/utils/stripVar.ts
5086
5392
  function stripVar(cssVariableWithVarString) {
@@ -5096,8 +5402,8 @@ var showLoadingIcon = (rowInfo) => {
5096
5402
  };
5097
5403
 
5098
5404
  // src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
5099
- var React23 = __toModule(require("react"));
5100
- var import_react29 = __toModule(require("react"));
5405
+ var React26 = __toModule(require("react"));
5406
+ var import_react31 = __toModule(require("react"));
5101
5407
 
5102
5408
  // src/components/InfiniteTable/components/icons/ExpanderIcon.css.ts
5103
5409
  var import_createRuntimeFn5 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
@@ -5108,7 +5414,7 @@ var ExpanderIconClsVariants = (0, import_createRuntimeFn5.createRuntimeFn)({ def
5108
5414
  function ExpanderIcon(props) {
5109
5415
  var _a;
5110
5416
  const { size = 24 } = props;
5111
- const [expanded, setExpanded] = (0, import_react29.useState)((_a = props.expanded) != null ? _a : props.defaultExpanded);
5417
+ const [expanded, setExpanded] = (0, import_react31.useState)((_a = props.expanded) != null ? _a : props.defaultExpanded);
5112
5418
  const onClick = () => {
5113
5419
  var _a2;
5114
5420
  (_a2 = props.onChange) == null ? void 0 : _a2.call(props, !expanded);
@@ -5116,12 +5422,12 @@ function ExpanderIcon(props) {
5116
5422
  setExpanded(!expanded);
5117
5423
  }
5118
5424
  };
5119
- React23.useEffect(() => {
5425
+ React26.useEffect(() => {
5120
5426
  if (isControlled("expanded", props)) {
5121
5427
  setExpanded(props.expanded);
5122
5428
  }
5123
5429
  }, [props.expanded]);
5124
- return /* @__PURE__ */ React23.createElement("svg", {
5430
+ return /* @__PURE__ */ React26.createElement("svg", {
5125
5431
  "data-name": "expander-icon",
5126
5432
  xmlns: "http://www.w3.org/2000/svg",
5127
5433
  height: `${size}px`,
@@ -5132,20 +5438,20 @@ function ExpanderIcon(props) {
5132
5438
  className: join(props.className, ExpanderIconCls, ExpanderIconClsVariants({
5133
5439
  expanded
5134
5440
  }), "InfiniteIcon", "InfiniteIcon-expander", `InfiniteIcon-expander--${expanded ? "expanded" : "collapsed"}`)
5135
- }, /* @__PURE__ */ React23.createElement("path", {
5441
+ }, /* @__PURE__ */ React26.createElement("path", {
5136
5442
  d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"
5137
5443
  }));
5138
5444
  }
5139
5445
 
5140
5446
  // src/components/InfiniteTable/components/icons/LoadingIcon.tsx
5141
- var React24 = __toModule(require("react"));
5447
+ var React27 = __toModule(require("react"));
5142
5448
 
5143
5449
  // src/components/InfiniteTable/components/icons/LoadingIcon.css.ts
5144
5450
  var LoadingIconCls = "_16lm1iw8 _16lm1iwf _16lm1iwd";
5145
5451
 
5146
5452
  // src/components/InfiniteTable/components/icons/LoadingIcon.tsx
5147
5453
  var LoadingIcon = (props) => {
5148
- return /* @__PURE__ */ React24.createElement("svg", {
5454
+ return /* @__PURE__ */ React27.createElement("svg", {
5149
5455
  xmlns: "http://www.w3.org/2000/svg",
5150
5456
  style: {
5151
5457
  margin: "auto",
@@ -5157,14 +5463,14 @@ var LoadingIcon = (props) => {
5157
5463
  viewBox: "0 0 100 100",
5158
5464
  preserveAspectRatio: "xMidYMid",
5159
5465
  className: join(props.className, LoadingIconCls, "InfiniteIcon", "InfiniteIcon-loading")
5160
- }, /* @__PURE__ */ React24.createElement("circle", {
5466
+ }, /* @__PURE__ */ React27.createElement("circle", {
5161
5467
  cx: "50",
5162
5468
  cy: "50",
5163
5469
  fill: "none",
5164
5470
  strokeWidth: "10",
5165
5471
  r: "35",
5166
5472
  strokeDasharray: "164.93361431346415 56.97787143782138"
5167
- }, /* @__PURE__ */ React24.createElement("animateTransform", {
5473
+ }, /* @__PURE__ */ React27.createElement("animateTransform", {
5168
5474
  attributeName: "transform",
5169
5475
  type: "rotate",
5170
5476
  repeatCount: "indefinite",
@@ -5184,7 +5490,7 @@ function getGroupColumnRender({
5184
5490
  var _a, _b, _c;
5185
5491
  let { value, rowInfo, column, groupBy, pivotBy } = renderOptions;
5186
5492
  if (column.renderValue) {
5187
- value = /* @__PURE__ */ React25.createElement(RenderHookComponent, {
5493
+ value = /* @__PURE__ */ React28.createElement(RenderHookComponent, {
5188
5494
  render: column.renderValue,
5189
5495
  renderParam: renderOptions
5190
5496
  });
@@ -5214,22 +5520,22 @@ function getGroupColumnRender({
5214
5520
  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);
5215
5521
  const isLoading = showLoadingIcon(groupRowInfo);
5216
5522
  if (isLoading) {
5217
- icon = /* @__PURE__ */ React25.createElement(LoadingIcon, null);
5523
+ icon = /* @__PURE__ */ React28.createElement(LoadingIcon, null);
5218
5524
  } else if (showExpanderIcon) {
5219
- const defaultIcon = /* @__PURE__ */ React25.createElement(ExpanderIcon, {
5525
+ const defaultIcon = /* @__PURE__ */ React28.createElement(ExpanderIcon, {
5220
5526
  expanded: !collapsed,
5221
5527
  onChange: () => {
5222
5528
  toggleGroupRow(groupKeys);
5223
5529
  }
5224
5530
  });
5225
- icon = column.renderGroupIcon ? /* @__PURE__ */ React25.createElement(RenderHookComponent, {
5531
+ icon = column.renderGroupIcon ? /* @__PURE__ */ React28.createElement(RenderHookComponent, {
5226
5532
  render: column.renderGroupIcon,
5227
5533
  renderParam: Object.assign({ collapsed, groupIcon: defaultIcon }, renderOptions)
5228
5534
  }) : defaultIcon;
5229
5535
  }
5230
- return /* @__PURE__ */ React25.createElement("div", {
5536
+ return /* @__PURE__ */ React28.createElement("div", {
5231
5537
  className: join(display.flex, alignItems.center)
5232
- }, icon, /* @__PURE__ */ React25.createElement("div", {
5538
+ }, icon, /* @__PURE__ */ React28.createElement("div", {
5233
5539
  className: cssEllipsisClassName
5234
5540
  }, value != null ? value : null));
5235
5541
  };
@@ -5274,9 +5580,9 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
5274
5580
  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;
5275
5581
  const isLoading = showLoadingIcon(rowInfo);
5276
5582
  if (isLoading) {
5277
- icon = /* @__PURE__ */ React25.createElement(LoadingIcon, null);
5583
+ icon = /* @__PURE__ */ React28.createElement(LoadingIcon, null);
5278
5584
  } else if (showExpanderIcon) {
5279
- const defaultIcon = /* @__PURE__ */ React25.createElement(ExpanderIcon, {
5585
+ const defaultIcon = /* @__PURE__ */ React28.createElement(ExpanderIcon, {
5280
5586
  expanded: !collapsed,
5281
5587
  onChange: () => {
5282
5588
  if (!rowInfo.isGroupRow) {
@@ -5291,9 +5597,9 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
5291
5597
  icon = column.renderGroupIcon(renderParam);
5292
5598
  }
5293
5599
  }
5294
- return /* @__PURE__ */ React25.createElement("div", {
5600
+ return /* @__PURE__ */ React28.createElement("div", {
5295
5601
  className: join(display.flex, alignItems.center, GroupRowExpanderCls)
5296
- }, icon, /* @__PURE__ */ React25.createElement("div", {
5602
+ }, icon, /* @__PURE__ */ React28.createElement("div", {
5297
5603
  className: cssEllipsisClassName
5298
5604
  }, value != null ? value : null));
5299
5605
  }
@@ -5309,11 +5615,11 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
5309
5615
  }
5310
5616
 
5311
5617
  // src/components/InfiniteTable/hooks/useEffectWithRaf.ts
5312
- var import_react30 = __toModule(require("react"));
5618
+ var import_react32 = __toModule(require("react"));
5313
5619
  function useEffectWithRaf(fn, deps) {
5314
- const rafId = (0, import_react30.useRef)(0);
5315
- const removeFnRaf = (0, import_react30.useRef)();
5316
- (0, import_react30.useEffect)(() => {
5620
+ const rafId = (0, import_react32.useRef)(0);
5621
+ const removeFnRaf = (0, import_react32.useRef)();
5622
+ (0, import_react32.useEffect)(() => {
5317
5623
  rafId.current = requestAnimationFrame(() => {
5318
5624
  removeFnRaf.current = fn();
5319
5625
  });
@@ -5330,7 +5636,7 @@ function useEffectWithRaf(fn, deps) {
5330
5636
  }
5331
5637
 
5332
5638
  // src/components/InfiniteTable/hooks/useToggleGroupRow.ts
5333
- var import_react33 = __toModule(require("react"));
5639
+ var import_react35 = __toModule(require("react"));
5334
5640
 
5335
5641
  // src/utils/groupAndPivot/index.ts
5336
5642
  var LAZY_ROOT_KEY_FOR_GROUPS = "____root____";
@@ -5398,21 +5704,18 @@ function lazyGroup(groupParams, rootData) {
5398
5704
  rootData.visitDepthFirst((lazyGroupRowInfo, keys, _index, next) => {
5399
5705
  const [_rootKey, ...currentGroupKeys] = keys;
5400
5706
  const dataArray = lazyGroupRowInfo.children;
5401
- if (currentGroupKeys.length == groupBy.length && groupBy.length) {
5402
- const deepMapGroupValue = deepMap.get(currentGroupKeys);
5403
- if (deepMapGroupValue) {
5404
- deepMapGroupValue.items = dataArray;
5405
- }
5406
- return next == null ? void 0 : next();
5707
+ const current = deepMap.get(currentGroupKeys);
5708
+ if (current) {
5709
+ current.cache = lazyGroupRowInfo.cache;
5710
+ current.childrenLoading = lazyGroupRowInfo.childrenLoading;
5711
+ current.childrenAvailable = lazyGroupRowInfo.childrenAvailable;
5712
+ current.error = lazyGroupRowInfo.error;
5407
5713
  }
5408
- if (lazyGroupRowInfo) {
5409
- const current = deepMap.get(currentGroupKeys);
5714
+ if (currentGroupKeys.length == groupBy.length && groupBy.length) {
5410
5715
  if (current) {
5411
- current.cache = lazyGroupRowInfo.cache;
5412
- current.childrenLoading = lazyGroupRowInfo.childrenLoading;
5413
- current.childrenAvailable = lazyGroupRowInfo.childrenAvailable;
5414
- current.error = lazyGroupRowInfo.error;
5716
+ current.items = dataArray;
5415
5717
  }
5718
+ return next == null ? void 0 : next();
5416
5719
  }
5417
5720
  for (let i = 0, len = dataArray.length; i < len; i++) {
5418
5721
  if (!dataArray[i]) {
@@ -5431,10 +5734,8 @@ function lazyGroup(groupParams, rootData) {
5431
5734
  }
5432
5735
  const dataObject = dataArray[i].data;
5433
5736
  const dataKeys = dataArray[i].keys;
5434
- const item = dataObject;
5435
5737
  if (dataKeys.length) {
5436
- const { field: groupByProperty } = groupBy[dataKeys.length - 1];
5437
- const key = item[groupByProperty];
5738
+ const key = dataKeys[dataKeys.length - 1];
5438
5739
  currentGroupKeys.push(key);
5439
5740
  }
5440
5741
  const deepMapGroupValue = {
@@ -5597,6 +5898,7 @@ function flatten(groupResult) {
5597
5898
  return result;
5598
5899
  }
5599
5900
  function getEnhancedGroupData(options, deepMapValue) {
5901
+ var _a;
5600
5902
  const { groupBy, groupKeys, collapsed, parents, reducers, lazyLoad } = options;
5601
5903
  const groupNesting = groupKeys.length;
5602
5904
  const {
@@ -5605,9 +5907,9 @@ function getEnhancedGroupData(options, deepMapValue) {
5605
5907
  pivotDeepMap,
5606
5908
  commonData
5607
5909
  } = deepMapValue;
5608
- let data = null;
5910
+ let data = commonData != null ? commonData : null;
5609
5911
  if (Object.keys(reducerResults).length > 0) {
5610
- data = commonData || {};
5912
+ data = __spreadValues({}, commonData);
5611
5913
  for (const key in reducers)
5612
5914
  if (reducers.hasOwnProperty(key)) {
5613
5915
  const reducer = reducers[key];
@@ -5618,7 +5920,7 @@ function getEnhancedGroupData(options, deepMapValue) {
5618
5920
  }
5619
5921
  }
5620
5922
  let selfLoaded = true;
5621
- let theValue = groupKeys[groupKeys.length - 1];
5923
+ let theValue = (_a = data != null ? data[groupBy[groupKeys.length - 1]] : null) != null ? _a : groupKeys[groupKeys.length - 1];
5622
5924
  if (typeof theValue === "string" && theValue.startsWith(NOT_LOADED_YET_KEY_PREFIX)) {
5623
5925
  selfLoaded = false;
5624
5926
  theValue = null;
@@ -5632,6 +5934,7 @@ function getEnhancedGroupData(options, deepMapValue) {
5632
5934
  collapsed,
5633
5935
  dataSourceHasGrouping: true,
5634
5936
  selfLoaded,
5937
+ error: options.error,
5635
5938
  parents,
5636
5939
  deepRowInfoArray: [],
5637
5940
  collapsedChildrenCount: 0,
@@ -5695,6 +5998,7 @@ function enhancedFlatten(param) {
5695
5998
  indexInParentGroups: Array.from(indexInParentGroups),
5696
5999
  indexInAll: result.length,
5697
6000
  groupKeys,
6001
+ error: deepMapValue.error,
5698
6002
  childrenLoading: deepMapValue.childrenLoading,
5699
6003
  childrenAvailable: deepMapValue.childrenAvailable,
5700
6004
  directChildrenCount: groupKeys.length === groupByStrings.length ? deepMapValue.items.length : deepMap.getDirectChildrenSizeFor(groupKeys),
@@ -5740,8 +6044,9 @@ function enhancedFlatten(param) {
5740
6044
  }
5741
6045
  for (let index = 0, len = items.length; index < len; index++) {
5742
6046
  const item = items[index];
6047
+ const indexInAll = startIndex + index;
5743
6048
  const rowInfo = {
5744
- id: item ? toPrimaryKey(item) : `${groupKeys}-${index}`,
6049
+ id: item ? toPrimaryKey(item, indexInAll) : `${groupKeys}-${index}`,
5745
6050
  data: item,
5746
6051
  dataSourceHasGrouping: true,
5747
6052
  isGroupRow: false,
@@ -5752,7 +6057,7 @@ function enhancedFlatten(param) {
5752
6057
  parents: Array.from(parents),
5753
6058
  indexInParentGroups: [...indexInParentGroups, index],
5754
6059
  indexInGroup: index,
5755
- indexInAll: startIndex + index,
6060
+ indexInAll,
5756
6061
  groupBy: groupByStrings,
5757
6062
  groupNesting,
5758
6063
  groupCount: enhancedGroupData.groupCount
@@ -5784,7 +6089,7 @@ function enhancedFlatten(param) {
5784
6089
  }
5785
6090
 
5786
6091
  // src/components/DataSource/index.tsx
5787
- var React26 = __toModule(require("react"));
6092
+ var React29 = __toModule(require("react"));
5788
6093
 
5789
6094
  // src/utils/multisort/sortTypes.ts
5790
6095
  var numberComparator = function(first, second) {
@@ -5795,11 +6100,11 @@ var stringComparator = function(first, second) {
5795
6100
  second = `${second}`;
5796
6101
  return first.localeCompare(second);
5797
6102
  };
5798
- var sortTypes = {
6103
+ var defaultSortTypes = {
5799
6104
  number: numberComparator,
5800
6105
  string: stringComparator
5801
6106
  };
5802
- var sortTypes_default = sortTypes;
6107
+ var sortTypes_default = defaultSortTypes;
5803
6108
 
5804
6109
  // src/utils/multisort/index.ts
5805
6110
  var multisort = (sortInfo, array, get) => {
@@ -5812,7 +6117,8 @@ var getSingleSortFunction = (info) => {
5812
6117
  return;
5813
6118
  }
5814
6119
  const field = info.field;
5815
- var dir = info.dir < 0 ? -1 : info.dir > 0 ? 1 : 0;
6120
+ const valueGetter = info.valueGetter;
6121
+ const dir = info.dir < 0 ? -1 : info.dir > 0 ? 1 : 0;
5816
6122
  if (!dir) {
5817
6123
  return;
5818
6124
  }
@@ -5827,8 +6133,8 @@ var getSingleSortFunction = (info) => {
5827
6133
  fn = sortTypes_default.string;
5828
6134
  }
5829
6135
  return (first, second) => {
5830
- const a = field ? first[field] : first;
5831
- const b = field ? second[field] : second;
6136
+ const a = valueGetter ? valueGetter(first) : field ? first[field] : first;
6137
+ const b = valueGetter ? valueGetter(second) : field ? second[field] : second;
5832
6138
  return dir * fn(a, b);
5833
6139
  };
5834
6140
  };
@@ -5860,16 +6166,126 @@ var getMultisortFunction = (sortInfo, get) => {
5860
6166
  };
5861
6167
  };
5862
6168
 
6169
+ // src/components/DataSource/GroupRowsState.ts
6170
+ var GroupRowsState = class {
6171
+ constructor(state) {
6172
+ this.update(state instanceof GroupRowsState ? state.getState() : state);
6173
+ }
6174
+ getState() {
6175
+ var _a, _b, _c, _d;
6176
+ return {
6177
+ expandedRows: this.expandedAll ? true : (_b = (_a = this.expandedMap) == null ? void 0 : _a.topDownKeys()) != null ? _b : [],
6178
+ collapsedRows: this.collapsedAll ? true : (_d = (_c = this.collapsedMap) == null ? void 0 : _c.topDownKeys()) != null ? _d : []
6179
+ };
6180
+ }
6181
+ destroy() {
6182
+ var _a, _b;
6183
+ (_a = this.expandedMap) == null ? void 0 : _a.clear();
6184
+ (_b = this.collapsedMap) == null ? void 0 : _b.clear();
6185
+ delete this.expandedMap;
6186
+ delete this.collapsedMap;
6187
+ }
6188
+ update(state) {
6189
+ var _a, _b, _c, _d;
6190
+ this.initialState = state;
6191
+ const { collapsedRows, expandedRows } = this.initialState;
6192
+ this.collapsedAll = collapsedRows === true;
6193
+ this.expandedAll = expandedRows === true;
6194
+ if (this.collapsedAll && this.expandedAll) {
6195
+ throw `Cannot have both collapsedRows and expandedRows be true!`;
6196
+ }
6197
+ if (collapsedRows !== true) {
6198
+ (_a = this.collapsedMap) == null ? void 0 : _a.clear();
6199
+ this.collapsedMap = (_b = this.collapsedMap) != null ? _b : new DeepMap(collapsedRows.map((keys) => [keys, true]));
6200
+ }
6201
+ if (expandedRows !== true) {
6202
+ (_c = this.expandedMap) == null ? void 0 : _c.clear();
6203
+ this.expandedMap = (_d = this.expandedMap) != null ? _d : new DeepMap(expandedRows.map((keys) => [keys, true]));
6204
+ }
6205
+ }
6206
+ areAllCollapsed() {
6207
+ return this.collapsedAll && (this.expandedMap ? this.expandedMap.size === 0 : true);
6208
+ }
6209
+ areAllExpanded() {
6210
+ return this.expandedAll && (this.collapsedMap ? this.collapsedMap.size === 0 : true);
6211
+ }
6212
+ collapseAll() {
6213
+ this.update({
6214
+ collapsedRows: true,
6215
+ expandedRows: []
6216
+ });
6217
+ }
6218
+ expandAll() {
6219
+ this.update({
6220
+ expandedRows: true,
6221
+ collapsedRows: []
6222
+ });
6223
+ }
6224
+ isGroupRowExpanded(keys) {
6225
+ var _a, _b;
6226
+ if (this.expandedAll === true) {
6227
+ if (this.collapsedAll === true) {
6228
+ throw 'Cannot have both expandedRows and collapsedRows be "true"';
6229
+ }
6230
+ return !((_a = this.collapsedMap) == null ? void 0 : _a.has(keys));
6231
+ }
6232
+ return (_b = this.expandedMap) == null ? void 0 : _b.has(keys);
6233
+ }
6234
+ isGroupRowCollapsed(keys) {
6235
+ return !this.isGroupRowExpanded(keys);
6236
+ }
6237
+ setGroupRowExpanded(keys, shouldExpand) {
6238
+ var _a;
6239
+ if (shouldExpand === this.isGroupRowExpanded(keys)) {
6240
+ return;
6241
+ }
6242
+ if (shouldExpand) {
6243
+ if (this.collapsedAll === true) {
6244
+ if (!this.expandedMap) {
6245
+ throw `No expandedMap found when trying to expand group row ${keys.join(",")}`;
6246
+ }
6247
+ this.expandedMap.set(keys, true);
6248
+ } else if (this.expandedAll === true) {
6249
+ if (!this.collapsedMap) {
6250
+ throw `No collapsedMap found when trying to expand group row ${keys.join(",")}`;
6251
+ }
6252
+ this.collapsedMap.delete(keys);
6253
+ }
6254
+ } else {
6255
+ if (this.expandedAll === true) {
6256
+ if (!this.collapsedMap) {
6257
+ throw `No collapsedMap found when trying to collapse group row ${keys.join(",")}`;
6258
+ }
6259
+ this.collapsedMap.set(keys, true);
6260
+ } else if (this.collapsedAll === true) {
6261
+ if (!this.expandedMap) {
6262
+ throw `No expandedMap found when trying to collapse group row ${keys.join(",")}`;
6263
+ }
6264
+ (_a = this.expandedMap) == null ? void 0 : _a.delete(keys);
6265
+ }
6266
+ }
6267
+ }
6268
+ collapseGroupRow(keys) {
6269
+ this.setGroupRowExpanded(keys, false);
6270
+ }
6271
+ expandGroupRow(keys) {
6272
+ this.setGroupRowExpanded(keys, true);
6273
+ }
6274
+ toggleGroupRow(keys) {
6275
+ this.setGroupRowExpanded(keys, !this.isGroupRowExpanded(keys));
6276
+ }
6277
+ };
6278
+
5863
6279
  // src/components/DataSource/privateHooks/useLoadData.ts
5864
- var import_react32 = __toModule(require("react"));
6280
+ var import_react34 = __toModule(require("react"));
5865
6281
 
5866
6282
  // src/components/hooks/useEffectWithChanges.ts
5867
- var import_react31 = __toModule(require("react"));
6283
+ var import_react33 = __toModule(require("react"));
5868
6284
  function useEffectWithChanges(fn, deps) {
5869
- const prevRef = (0, import_react31.useRef)({});
5870
- const oldValuesRef = (0, import_react31.useRef)({});
6285
+ const prevRef = (0, import_react33.useRef)({});
6286
+ const oldValuesRef = (0, import_react33.useRef)({});
5871
6287
  const oldValues = oldValuesRef.current;
5872
- const changesRef = (0, import_react31.useRef)({});
6288
+ const changesRef = (0, import_react33.useRef)({});
5873
6289
  const changes = changesRef.current;
5874
6290
  const useEffectDeps = [];
5875
6291
  for (const k in deps) {
@@ -5882,7 +6298,7 @@ function useEffectWithChanges(fn, deps) {
5882
6298
  }
5883
6299
  }
5884
6300
  prevRef.current = deps;
5885
- (0, import_react31.useEffect)(() => {
6301
+ (0, import_react33.useEffect)(() => {
5886
6302
  const changes2 = changesRef.current;
5887
6303
  const result = fn(changes2, oldValues);
5888
6304
  changesRef.current = {};
@@ -5891,6 +6307,25 @@ function useEffectWithChanges(fn, deps) {
5891
6307
  }, useEffectDeps);
5892
6308
  }
5893
6309
 
6310
+ // src/components/InfiniteTable/utils/assignFiltered.ts
6311
+ function assignFiltered(filterFn, target, ...rest) {
6312
+ const result = target;
6313
+ rest.forEach((obj) => {
6314
+ for (const key in obj) {
6315
+ if (obj.hasOwnProperty(key) && filterFn(obj[key], key)) {
6316
+ result[key] = obj[key];
6317
+ }
6318
+ }
6319
+ });
6320
+ return result;
6321
+ }
6322
+ function assignNonNull(target, ...rest) {
6323
+ return assignFiltered((value) => value != null, target, ...rest);
6324
+ }
6325
+ function assignExcept(exceptKeys, target, ...rest) {
6326
+ return assignFiltered((_value, key) => !(key in exceptKeys), target, ...rest);
6327
+ }
6328
+
5894
6329
  // src/components/DataSource/privateHooks/getChangeDetect.ts
5895
6330
  function getChangeDetect() {
5896
6331
  var _a;
@@ -5916,6 +6351,7 @@ function buildDataSourceDataParams(componentState, overrides) {
5916
6351
  sortInfo,
5917
6352
  groupBy: componentState.groupBy,
5918
6353
  pivotBy: componentState.pivotBy,
6354
+ filterValue: componentState.filterValue,
5919
6355
  aggregationReducers: componentState.aggregationReducers
5920
6356
  };
5921
6357
  if (dataSourceParams.groupBy) {
@@ -5935,6 +6371,13 @@ function buildDataSourceDataParams(componentState, overrides) {
5935
6371
  if (overrides) {
5936
6372
  Object.assign(dataSourceParams, overrides);
5937
6373
  }
6374
+ if (dataSourceParams.filterValue && dataSourceParams.filterValue.length) {
6375
+ dataSourceParams.filterValue = dataSourceParams.filterValue.map((f) => {
6376
+ const value = __spreadValues({}, f);
6377
+ delete value.valueGetter;
6378
+ return value;
6379
+ });
6380
+ }
5938
6381
  const changes = {};
5939
6382
  const oldDataSourceParams = componentState.dataParams || {};
5940
6383
  for (const k in dataSourceParams) {
@@ -5955,6 +6398,13 @@ function loadData(data, componentState, actions, overrides) {
5955
6398
  const lazyGroupData = componentState.originalLazyGroupData;
5956
6399
  const key = [LAZY_ROOT_KEY_FOR_GROUPS, ...dataParams.groupKeys || []];
5957
6400
  const existingGroupRowInfo = lazyGroupData.get(key);
6401
+ if (!existingGroupRowInfo) {
6402
+ const groupCacheKeys = [
6403
+ ...dataParams.groupKeys || [],
6404
+ dataParams.lazyLoadStartIndex
6405
+ ];
6406
+ componentState.lazyLoadCacheOfLoadedBatches.set(groupCacheKeys, true);
6407
+ }
5958
6408
  if (existingGroupRowInfo && existingGroupRowInfo.cache && key.length > 1) {
5959
6409
  const items = existingGroupRowInfo.children;
5960
6410
  const len = items.length;
@@ -5980,7 +6430,8 @@ function loadData(data, componentState, actions, overrides) {
5980
6430
  childrenLoading: true,
5981
6431
  childrenAvailable: false,
5982
6432
  cache: CACHE_DEFAULT,
5983
- totalCount: 0
6433
+ totalCount: 0,
6434
+ totalCountUnfiltered: 0
5984
6435
  });
5985
6436
  }
5986
6437
  actions.originalLazyGroupDataChangeDetect = getChangeDetect();
@@ -6004,6 +6455,9 @@ function loadData(data, componentState, actions, overrides) {
6004
6455
  if (remoteData.mappings) {
6005
6456
  actions.pivotMappings = remoteData.mappings;
6006
6457
  }
6458
+ if (remoteData.totalCountUnfiltered) {
6459
+ actions.unfilteredCount = remoteData.totalCountUnfiltered;
6460
+ }
6007
6461
  if (componentState.lazyLoad) {
6008
6462
  let resolveRemoteData = function(keys, remoteData2, parentKeys) {
6009
6463
  var _a, _b, _c, _d;
@@ -6014,24 +6468,19 @@ function loadData(data, componentState, actions, overrides) {
6014
6468
  childrenLoading: false,
6015
6469
  childrenAvailable: true,
6016
6470
  totalCount: (_a = remoteData2.totalCount) != null ? _a : dataArray2.length,
6017
- children: dataArray2
6471
+ totalCountUnfiltered: (_b = remoteData2.totalCount) != null ? _b : dataArray2.length,
6472
+ children: dataArray2,
6473
+ error: remoteData2.error
6018
6474
  };
6019
6475
  const childDatasets = [];
6020
6476
  if (dataParams.lazyLoadBatchSize && !parentKeys) {
6021
6477
  const existingGroupRowInfo = lazyGroupData.get(theKey);
6022
- const currentGroupRowInfo = existingGroupRowInfo != null ? existingGroupRowInfo : {
6023
- children: [],
6024
- childrenAvailable: true,
6025
- childrenLoading: false,
6026
- totalCount: newGroupRowInfo.totalCount,
6027
- cache: (_b = newGroupRowInfo.cache) != null ? _b : CACHE_DEFAULT
6028
- };
6029
- if (existingGroupRowInfo) {
6030
- existingGroupRowInfo.cache = newGroupRowInfo.cache;
6031
- existingGroupRowInfo.totalCount = newGroupRowInfo.totalCount;
6032
- existingGroupRowInfo.childrenLoading = false;
6033
- existingGroupRowInfo.childrenAvailable = true;
6034
- existingGroupRowInfo.error = newGroupRowInfo.error;
6478
+ const isGroupNew = !existingGroupRowInfo;
6479
+ const currentGroupRowInfo = assignExcept({
6480
+ children: true
6481
+ }, existingGroupRowInfo || {}, newGroupRowInfo);
6482
+ if (isGroupNew) {
6483
+ currentGroupRowInfo.chidren = [];
6035
6484
  }
6036
6485
  currentGroupRowInfo.children.length = currentGroupRowInfo.totalCount;
6037
6486
  const start = (_c = dataParams.lazyLoadStartIndex) != null ? _c : 0;
@@ -6049,13 +6498,13 @@ function loadData(data, componentState, actions, overrides) {
6049
6498
  });
6050
6499
  }
6051
6500
  }
6052
- if (!existingGroupRowInfo) {
6501
+ if (isGroupNew) {
6053
6502
  lazyGroupData.set(theKey, currentGroupRowInfo);
6054
6503
  }
6055
6504
  } else {
6056
6505
  if (parentKeys) {
6057
6506
  newGroupRowInfo.children.forEach((child) => {
6058
- if (child.dataset) {
6507
+ if (child && child.dataset) {
6059
6508
  childDatasets.push({
6060
6509
  keys: child.keys,
6061
6510
  dataset: child.dataset
@@ -6112,16 +6561,17 @@ function useLoadData() {
6112
6561
  sortInfo,
6113
6562
  groupBy,
6114
6563
  pivotBy,
6564
+ filterValue,
6115
6565
  livePagination,
6116
6566
  livePaginationCursor,
6117
6567
  cursorId: stateCursorId
6118
6568
  } = componentState;
6119
- const [scrollbars, setScrollbars] = (0, import_react32.useState)({
6569
+ const [scrollbars, setScrollbars] = (0, import_react34.useState)({
6120
6570
  vertical: false,
6121
6571
  horizontal: false
6122
6572
  });
6123
- const scrollbarsRef = (0, import_react32.useRef)(scrollbars);
6124
- (0, import_react32.useEffect)(() => {
6573
+ const scrollbarsRef = (0, import_react34.useRef)(scrollbars);
6574
+ (0, import_react34.useEffect)(() => {
6125
6575
  notifyScrollbarsChange.onChange((scrollbars2) => {
6126
6576
  if (!scrollbars2) {
6127
6577
  return;
@@ -6131,7 +6581,7 @@ function useLoadData() {
6131
6581
  });
6132
6582
  return () => notifyScrollbarsChange.destroy();
6133
6583
  }, [notifyScrollbarsChange]);
6134
- (0, import_react32.useEffect)(() => {
6584
+ (0, import_react34.useEffect)(() => {
6135
6585
  if (!livePagination) {
6136
6586
  return;
6137
6587
  }
@@ -6145,7 +6595,7 @@ function useLoadData() {
6145
6595
  });
6146
6596
  return () => cancelAnimationFrame(frameId);
6147
6597
  }, [livePaginationCursor]);
6148
- (0, import_react32.useEffect)(() => {
6598
+ (0, import_react34.useEffect)(() => {
6149
6599
  if (!livePagination || livePaginationCursor !== void 0) {
6150
6600
  return;
6151
6601
  }
@@ -6159,7 +6609,7 @@ function useLoadData() {
6159
6609
  });
6160
6610
  return () => cancelAnimationFrame(frameId);
6161
6611
  }, [dataArray.length, livePaginationCursor]);
6162
- (0, import_react32.useEffect)(() => {
6612
+ (0, import_react34.useEffect)(() => {
6163
6613
  const state = getComponentState();
6164
6614
  const { livePaginationCursor: livePaginationCursor2, livePagination: livePagination2, dataArray: dataArray2 } = state;
6165
6615
  if (!scrollbars.vertical && livePagination2) {
@@ -6174,9 +6624,10 @@ function useLoadData() {
6174
6624
  sortInfo,
6175
6625
  groupBy,
6176
6626
  pivotBy,
6627
+ filterValue,
6177
6628
  cursorId: livePagination ? stateCursorId : null
6178
6629
  };
6179
- const initialRef = (0, import_react32.useRef)(true);
6630
+ const initialRef = (0, import_react34.useRef)(true);
6180
6631
  useLazyLoadRange();
6181
6632
  useEffectWithChanges(() => {
6182
6633
  const componentState2 = getComponentState();
@@ -6208,7 +6659,7 @@ function useLazyLoadRange() {
6208
6659
  componentActions: actions,
6209
6660
  componentState
6210
6661
  } = useComponentState();
6211
- (0, import_react32.useEffect)(() => {
6662
+ (0, import_react34.useEffect)(() => {
6212
6663
  actions.lazyLoadCacheOfLoadedBatches = new DeepMap();
6213
6664
  }, [componentState.data, componentState.dataParams]);
6214
6665
  const {
@@ -6217,7 +6668,7 @@ function useLazyLoadRange() {
6217
6668
  dataArray,
6218
6669
  scrollStopDelayUpdatedByTable
6219
6670
  } = componentState;
6220
- const latestRenderRangeRef = (0, import_react32.useRef)(null);
6671
+ const latestRenderRangeRef = (0, import_react34.useRef)(null);
6221
6672
  const loadRange = (renderRange, cache = getComponentState().lazyLoadCacheOfLoadedBatches) => {
6222
6673
  const componentState2 = getComponentState();
6223
6674
  renderRange = renderRange || latestRenderRangeRef.current;
@@ -6236,8 +6687,8 @@ function useLazyLoadRange() {
6236
6687
  componentActions: actions
6237
6688
  }, cache);
6238
6689
  };
6239
- const debouncedLoadRange = (0, import_react32.useMemo)(() => debounce(loadRange, { wait: scrollStopDelayUpdatedByTable }), [scrollStopDelayUpdatedByTable]);
6240
- (0, import_react32.useEffect)(() => {
6690
+ const debouncedLoadRange = (0, import_react34.useMemo)(() => debounce(loadRange, { wait: scrollStopDelayUpdatedByTable }), [scrollStopDelayUpdatedByTable]);
6691
+ (0, import_react34.useEffect)(() => {
6241
6692
  if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
6242
6693
  return notifyRenderRangeChange.onChange((renderRange) => {
6243
6694
  latestRenderRangeRef.current = renderRange;
@@ -6246,7 +6697,7 @@ function useLazyLoadRange() {
6246
6697
  }
6247
6698
  return;
6248
6699
  }, [lazyLoadBatchSize]);
6249
- (0, import_react32.useEffect)(() => {
6700
+ (0, import_react34.useEffect)(() => {
6250
6701
  if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
6251
6702
  debouncedLoadRange();
6252
6703
  }
@@ -6279,7 +6730,7 @@ function lazyLoadRange(options, cache) {
6279
6730
  theGroupKeys.pop();
6280
6731
  }
6281
6732
  const cacheKeys = theGroupKeys.length ? theGroupKeys : rootGroupKeys;
6282
- const indexInGroup = rowInfo.indexInGroup;
6733
+ const indexInGroup = rowInfo.dataSourceHasGrouping ? rowInfo.indexInGroup : rowInfo.indexInAll;
6283
6734
  if (rowInfo.isGroupRow && !rowInfo.collapsed && !rowInfo.childrenAvailable) {
6284
6735
  const currentFnCall = {
6285
6736
  lazyLoadStartIndex: 0,
@@ -6302,7 +6753,7 @@ function lazyLoadRange(options, cache) {
6302
6753
  if (!rowLoaded) {
6303
6754
  let cachedFnCalls = perGroupFnCalls.get(cacheKeys);
6304
6755
  const batchStartIndexInGroup = Math.floor(indexInGroup / lazyLoadBatchSize) * lazyLoadBatchSize;
6305
- const offset = rowInfo.indexInGroup - batchStartIndexInGroup;
6756
+ const offset = indexInGroup - batchStartIndexInGroup;
6306
6757
  const absoluteIndexOfBatchStart = dataArray[rowInfo.indexInAll - offset].indexInAll;
6307
6758
  const batchStartRowLoaded = isRowLoaded(absoluteIndexOfBatchStart);
6308
6759
  const batchStartRowId = dataArray[absoluteIndexOfBatchStart].id;
@@ -6400,116 +6851,6 @@ function discardCallsWithEqualArg(fn, timeframe = 50, getCompareObject) {
6400
6851
  };
6401
6852
  }
6402
6853
 
6403
- // src/components/DataSource/GroupRowsState.ts
6404
- var GroupRowsState = class {
6405
- constructor(state) {
6406
- this.update(state instanceof GroupRowsState ? state.getState() : state);
6407
- }
6408
- getState() {
6409
- var _a, _b, _c, _d;
6410
- return {
6411
- expandedRows: this.expandedAll ? true : (_b = (_a = this.expandedMap) == null ? void 0 : _a.topDownKeys()) != null ? _b : [],
6412
- collapsedRows: this.collapsedAll ? true : (_d = (_c = this.collapsedMap) == null ? void 0 : _c.topDownKeys()) != null ? _d : []
6413
- };
6414
- }
6415
- destroy() {
6416
- var _a, _b;
6417
- (_a = this.expandedMap) == null ? void 0 : _a.clear();
6418
- (_b = this.collapsedMap) == null ? void 0 : _b.clear();
6419
- delete this.expandedMap;
6420
- delete this.collapsedMap;
6421
- }
6422
- update(state) {
6423
- var _a, _b, _c, _d;
6424
- this.initialState = state;
6425
- const { collapsedRows, expandedRows } = this.initialState;
6426
- this.collapsedAll = collapsedRows === true;
6427
- this.expandedAll = expandedRows === true;
6428
- if (this.collapsedAll && this.expandedAll) {
6429
- throw `Cannot have both collapsedRows and expandedRows be true!`;
6430
- }
6431
- if (collapsedRows !== true) {
6432
- (_a = this.collapsedMap) == null ? void 0 : _a.clear();
6433
- this.collapsedMap = (_b = this.collapsedMap) != null ? _b : new DeepMap(collapsedRows.map((keys) => [keys, true]));
6434
- }
6435
- if (expandedRows !== true) {
6436
- (_c = this.expandedMap) == null ? void 0 : _c.clear();
6437
- this.expandedMap = (_d = this.expandedMap) != null ? _d : new DeepMap(expandedRows.map((keys) => [keys, true]));
6438
- }
6439
- }
6440
- areAllCollapsed() {
6441
- return this.collapsedAll && (this.expandedMap ? this.expandedMap.size === 0 : true);
6442
- }
6443
- areAllExpanded() {
6444
- return this.expandedAll && (this.collapsedMap ? this.collapsedMap.size === 0 : true);
6445
- }
6446
- collapseAll() {
6447
- this.update({
6448
- collapsedRows: true,
6449
- expandedRows: []
6450
- });
6451
- }
6452
- expandAll() {
6453
- this.update({
6454
- expandedRows: true,
6455
- collapsedRows: []
6456
- });
6457
- }
6458
- isGroupRowExpanded(keys) {
6459
- var _a, _b;
6460
- if (this.expandedAll === true) {
6461
- if (this.collapsedAll === true) {
6462
- throw 'Cannot have both expandedRows and collapsedRows be "true"';
6463
- }
6464
- return !((_a = this.collapsedMap) == null ? void 0 : _a.has(keys));
6465
- }
6466
- return (_b = this.expandedMap) == null ? void 0 : _b.has(keys);
6467
- }
6468
- isGroupRowCollapsed(keys) {
6469
- return !this.isGroupRowExpanded(keys);
6470
- }
6471
- setGroupRowExpanded(keys, shouldExpand) {
6472
- var _a;
6473
- if (shouldExpand === this.isGroupRowExpanded(keys)) {
6474
- return;
6475
- }
6476
- if (shouldExpand) {
6477
- if (this.collapsedAll === true) {
6478
- if (!this.expandedMap) {
6479
- throw `No expandedMap found when trying to expand group row ${keys.join(",")}`;
6480
- }
6481
- this.expandedMap.set(keys, true);
6482
- } else if (this.expandedAll === true) {
6483
- if (!this.collapsedMap) {
6484
- throw `No collapsedMap found when trying to expand group row ${keys.join(",")}`;
6485
- }
6486
- this.collapsedMap.delete(keys);
6487
- }
6488
- } else {
6489
- if (this.expandedAll === true) {
6490
- if (!this.collapsedMap) {
6491
- throw `No collapsedMap found when trying to collapse group row ${keys.join(",")}`;
6492
- }
6493
- this.collapsedMap.set(keys, true);
6494
- } else if (this.collapsedAll === true) {
6495
- if (!this.expandedMap) {
6496
- throw `No expandedMap found when trying to collapse group row ${keys.join(",")}`;
6497
- }
6498
- (_a = this.expandedMap) == null ? void 0 : _a.delete(keys);
6499
- }
6500
- }
6501
- }
6502
- collapseGroupRow(keys) {
6503
- this.setGroupRowExpanded(keys, false);
6504
- }
6505
- expandGroupRow(keys) {
6506
- this.setGroupRowExpanded(keys, true);
6507
- }
6508
- toggleGroupRow(keys) {
6509
- this.setGroupRowExpanded(keys, !this.isGroupRowExpanded(keys));
6510
- }
6511
- };
6512
-
6513
6854
  // src/components/DataSource/state/normalizeSortInfo.ts
6514
6855
  var EMPTY_ARRAY = Object.freeze([]);
6515
6856
  var normalizeSortInfo = (initialSortInfo, weakMap) => {
@@ -6555,9 +6896,12 @@ function initSetupState() {
6555
6896
  pivotColumns: void 0,
6556
6897
  pivotColumnGroups: void 0,
6557
6898
  dataArray,
6899
+ unfilteredCount: dataArray.length,
6900
+ filteredCount: dataArray.length,
6558
6901
  updatedAt: now,
6559
6902
  groupedAt: 0,
6560
6903
  sortedAt: 0,
6904
+ filteredAt: 0,
6561
6905
  reducedAt: now,
6562
6906
  generateGroupRows: true,
6563
6907
  groupDeepMap: void 0,
@@ -6580,6 +6924,15 @@ var forwardProps2 = (setupState) => {
6580
6924
  pivotBy: 1,
6581
6925
  primaryKey: 1,
6582
6926
  livePagination: 1,
6927
+ filterFunction: 1,
6928
+ filterValue: 1,
6929
+ filterDelay: (filterDelay) => filterDelay != null ? filterDelay : 200,
6930
+ filterTypes: (filterTypes) => {
6931
+ return __spreadValues(__spreadValues({}, defaultFilterTypes), filterTypes);
6932
+ },
6933
+ sortTypes: (sortTypes) => {
6934
+ return __spreadValues(__spreadValues({}, sortTypes_default), sortTypes);
6935
+ },
6583
6936
  aggregationReducers: 1,
6584
6937
  collapseGroupRowsOnDataFunctionChange: (collapseGroupRowsOnDataFunctionChange) => collapseGroupRowsOnDataFunctionChange != null ? collapseGroupRowsOnDataFunctionChange : true,
6585
6938
  loading: (loading) => loading != null ? loading : false,
@@ -6605,10 +6958,25 @@ function getLivePaginationCursorValue(livePaginationCursorProp, state) {
6605
6958
  return livePaginationCursor;
6606
6959
  }
6607
6960
  function mapPropsToState(params) {
6961
+ var _a;
6608
6962
  const { props, state, oldState } = params;
6609
6963
  const controlledSort = isControlledValue(props.sortInfo);
6964
+ const controlledFilter = isControlledValue(props.filterValue);
6965
+ const { filterTypes } = state;
6966
+ const operatorsByFilterType = Object.keys(filterTypes).reduce((acc, key) => {
6967
+ const operators = filterTypes[key].operators;
6968
+ acc[key] = acc[key] || {};
6969
+ const currentFilterTypeOperators = acc[key];
6970
+ operators.forEach((operator) => {
6971
+ currentFilterTypeOperators[operator.name] = operator;
6972
+ });
6973
+ return acc;
6974
+ }, {});
6610
6975
  const result = {
6976
+ operatorsByFilterType,
6611
6977
  controlledSort,
6978
+ controlledFilter,
6979
+ filterMode: ((_a = props.filterMode) != null ? _a : props.filterFunction != null) ? "client" : typeof props.data === "function" ? "server" : "client",
6612
6980
  multiSort: Array.isArray(controlledSort ? props.sortInfo : props.defaultSortInfo),
6613
6981
  lazyLoadBatchSize: typeof props.lazyLoad === "object" ? props.lazyLoad.batchSize : void 0
6614
6982
  };
@@ -6673,6 +7041,18 @@ function getInterceptActions() {
6673
7041
  });
6674
7042
  }
6675
7043
  },
7044
+ filterValue: (filterValue, { actions, state }) => {
7045
+ const dataParams = buildDataSourceDataParams(state, {
7046
+ filterValue,
7047
+ livePaginationCursor: null
7048
+ });
7049
+ actions.dataParams = dataParams;
7050
+ if (state.livePagination) {
7051
+ requestAnimationFrame(() => {
7052
+ actions.livePaginationCursor = null;
7053
+ });
7054
+ }
7055
+ },
6676
7056
  cursorId: (cursorId, { actions, state }) => {
6677
7057
  const dataParams = buildDataSourceDataParams(state, {
6678
7058
  __cursorId: cursorId
@@ -6754,7 +7134,7 @@ function getPivotColumnsAndColumnGroups({
6754
7134
  pivotGroupKeys: [],
6755
7135
  pivotGroupKey: "",
6756
7136
  pivotIndex: -1,
6757
- valueGetter: ({ rowInfo }) => {
7137
+ valueFormatter: ({ rowInfo }) => {
6758
7138
  var _a;
6759
7139
  return rowInfo.isGroupRow ? (_a = rowInfo.reducerResults) == null ? void 0 : _a[reducer.id] : null;
6760
7140
  }
@@ -6803,7 +7183,7 @@ function getPivotColumnsAndColumnGroups({
6803
7183
  sortable: false,
6804
7184
  columnGroup: parentColumnGroupId,
6805
7185
  header,
6806
- valueGetter: ({ rowInfo }) => {
7186
+ valueFormatter: ({ rowInfo }) => {
6807
7187
  var _a, _b;
6808
7188
  if (!rowInfo.isGroupRow) {
6809
7189
  return null;
@@ -6858,7 +7238,7 @@ function getPivotColumnsAndColumnGroups({
6858
7238
  pivotIndex: keys.length - 1,
6859
7239
  pivotBy,
6860
7240
  sortable: false,
6861
- valueGetter: ({ rowInfo }) => {
7241
+ valueFormatter: ({ rowInfo }) => {
6862
7242
  var _a, _b;
6863
7243
  if (!rowInfo.isGroupRow) {
6864
7244
  return null;
@@ -6902,14 +7282,72 @@ function toRowInfo(data, id, index) {
6902
7282
  data,
6903
7283
  id,
6904
7284
  indexInAll: index,
6905
- indexInGroup: index,
6906
7285
  isGroupRow: false,
6907
7286
  selfLoaded: true
6908
7287
  };
6909
7288
  }
7289
+ function filterDataSource(params) {
7290
+ const {
7291
+ filterTypes,
7292
+ filterValue: filterValueArray,
7293
+ operatorsByFilterType,
7294
+ filterFunction,
7295
+ toPrimaryKey
7296
+ } = params;
7297
+ let { dataArray } = params;
7298
+ if (filterFunction) {
7299
+ dataArray = dataArray.filter((data, index, arr) => filterFunction({
7300
+ data,
7301
+ index,
7302
+ dataArray: arr,
7303
+ primaryKey: toPrimaryKey(data, index)
7304
+ }));
7305
+ }
7306
+ if (filterValueArray && filterValueArray.length) {
7307
+ return dataArray.filter((data, index, arr) => {
7308
+ var _a;
7309
+ const param = {
7310
+ data,
7311
+ index,
7312
+ dataArray: arr,
7313
+ primaryKey: toPrimaryKey(data, index)
7314
+ };
7315
+ for (let i = 0, len = filterValueArray.length; i < len; i++) {
7316
+ const currentFilterValue = filterValueArray[i];
7317
+ const {
7318
+ disabled,
7319
+ filterValue,
7320
+ field,
7321
+ filterType: filterTypeKey,
7322
+ valueGetter,
7323
+ operator
7324
+ } = currentFilterValue;
7325
+ const filterType = filterTypes[filterTypeKey];
7326
+ if (disabled || !filterType) {
7327
+ continue;
7328
+ }
7329
+ const currentOperator = (_a = operatorsByFilterType[filterTypeKey]) == null ? void 0 : _a[operator];
7330
+ if (!currentOperator) {
7331
+ continue;
7332
+ }
7333
+ const getter = valueGetter || (({ data: data2 }) => field ? data2[field] : data2);
7334
+ const operatorFnParam = __spreadValues({}, param);
7335
+ operatorFnParam.filterValue = filterValue;
7336
+ operatorFnParam.currentValue = getter(param);
7337
+ operatorFnParam.emptyValues = filterType.emptyValues;
7338
+ if (!currentOperator.fn(operatorFnParam)) {
7339
+ return false;
7340
+ }
7341
+ }
7342
+ return true;
7343
+ });
7344
+ }
7345
+ return dataArray;
7346
+ }
6910
7347
  function concludeReducer(params) {
6911
7348
  var _a, _b;
6912
7349
  const { state, previousState } = params;
7350
+ const primaryKeyDescriptor = state.primaryKey;
6913
7351
  const sortInfo = state.sortInfo;
6914
7352
  let shouldSort = !!(sortInfo == null ? void 0 : sortInfo.length) && !state.controlledSort;
6915
7353
  if (state.lazyLoad || state.livePagination) {
@@ -6927,15 +7365,24 @@ function concludeReducer(params) {
6927
7365
  state.originalLazyGroupData = new DeepMap();
6928
7366
  originalDataArrayChanged = true;
6929
7367
  }
7368
+ const { filterFunction, filterValue, filterTypes, operatorsByFilterType } = state;
7369
+ const shouldFilter = !!filterFunction || Array.isArray(filterValue) && filterValue.length;
7370
+ const shouldFilterClientSide = shouldFilter && state.filterMode === "client";
7371
+ const filterDepsChanged = haveDepsChanged(previousState, state, [
7372
+ "filterFunction",
7373
+ "filterValue",
7374
+ "filterTypes"
7375
+ ]);
7376
+ const filterChanged = originalDataArrayChanged || filterDepsChanged;
6930
7377
  const sortInfoChanged = haveDepsChanged(previousState, state, ["sortInfo"]);
6931
- const sortDepsChanged = originalDataArrayChanged || sortInfoChanged;
7378
+ const sortDepsChanged = originalDataArrayChanged || filterDepsChanged || sortInfoChanged;
7379
+ const shouldFilterAgain = state.filterMode === "client" && (filterChanged || !state.lastFilterDataArray);
6932
7380
  const shouldSortAgain = shouldSort && (sortDepsChanged || !state.lastSortDataArray);
6933
7381
  const groupBy = state.groupBy;
6934
7382
  const pivotBy = state.pivotBy;
6935
7383
  const shouldGroup = groupBy.length > 0 || !!pivotBy;
6936
- const groupsDepsChanged = originalDataArrayChanged || haveDepsChanged(previousState, state, [
7384
+ const groupsDepsChanged = originalDataArrayChanged || sortDepsChanged || haveDepsChanged(previousState, state, [
6937
7385
  "generateGroupRows",
6938
- "originalDataArray",
6939
7386
  "originalLazyGroupData",
6940
7387
  "originalLazyGroupDataChangeDetect",
6941
7388
  "groupBy",
@@ -6944,23 +7391,43 @@ function concludeReducer(params) {
6944
7391
  "aggregationReducers",
6945
7392
  "pivotTotalColumnPosition",
6946
7393
  "pivotGrandTotalColumnPosition",
6947
- "showSeparatePivotColumnForSingleAggregation",
6948
- "sortInfo"
7394
+ "showSeparatePivotColumnForSingleAggregation"
6949
7395
  ]);
6950
7396
  const shouldGroupAgain = shouldGroup && (groupsDepsChanged || !state.lastGroupDataArray);
6951
7397
  const now = Date.now();
6952
7398
  let dataArray = state.originalDataArray;
6953
- let rowInfoDataArray = state.dataArray;
7399
+ const toPrimaryKey = typeof primaryKeyDescriptor === "function" ? (data, index) => primaryKeyDescriptor({ data, index }) : (data, _index) => {
7400
+ const pk = data[primaryKeyDescriptor];
7401
+ return pk;
7402
+ };
7403
+ if (!shouldFilter) {
7404
+ state.unfilteredCount = dataArray.length;
7405
+ }
7406
+ if (shouldFilterClientSide) {
7407
+ state.unfilteredCount = dataArray.length;
7408
+ dataArray = shouldFilterAgain ? filterDataSource({
7409
+ dataArray,
7410
+ toPrimaryKey,
7411
+ filterTypes,
7412
+ operatorsByFilterType,
7413
+ filterFunction,
7414
+ filterValue
7415
+ }) : state.lastFilterDataArray;
7416
+ state.lastFilterDataArray = dataArray;
7417
+ state.filteredAt = now;
7418
+ }
7419
+ state.filteredCount = dataArray.length;
7420
+ state.postFilterDataArray = dataArray;
6954
7421
  if (shouldSort) {
7422
+ const prevKnownTypes = multisort.knownTypes;
7423
+ multisort.knownTypes = state.sortTypes;
6955
7424
  dataArray = shouldSortAgain ? multisort(sortInfo, [...dataArray]) : state.lastSortDataArray;
7425
+ multisort.knownTypes = prevKnownTypes;
6956
7426
  state.lastSortDataArray = dataArray;
6957
7427
  state.sortedAt = now;
6958
7428
  }
6959
7429
  state.postSortDataArray = dataArray;
6960
- const toPrimaryKey = (data) => {
6961
- const pk = data[state.primaryKey];
6962
- return pk;
6963
- };
7430
+ let rowInfoDataArray = state.dataArray;
6964
7431
  if (shouldGroup) {
6965
7432
  if (shouldGroupAgain) {
6966
7433
  const groupResult = state.lazyLoad ? lazyGroup({
@@ -7003,7 +7470,7 @@ function concludeReducer(params) {
7003
7470
  state.pivotColumns = void 0;
7004
7471
  const arrayDifferentAfterSortStep = previousState.postSortDataArray != state.postSortDataArray;
7005
7472
  if (arrayDifferentAfterSortStep || groupsDepsChanged) {
7006
- rowInfoDataArray = dataArray.map((data, index) => toRowInfo(data, data ? toPrimaryKey(data) : index, index));
7473
+ rowInfoDataArray = dataArray.map((data, index) => toRowInfo(data, data ? toPrimaryKey(data, index) : index, index));
7007
7474
  }
7008
7475
  }
7009
7476
  state.postGroupDataArray = rowInfoDataArray;
@@ -7031,7 +7498,7 @@ function DataSourceWithContext(props) {
7031
7498
  if (typeof children === "function") {
7032
7499
  children = children(computedValues);
7033
7500
  }
7034
- return /* @__PURE__ */ React26.createElement(React26.Fragment, null, children);
7501
+ return /* @__PURE__ */ React29.createElement(React29.Fragment, null, children);
7035
7502
  }
7036
7503
  var DataSourceRoot = getComponentStateRoot({
7037
7504
  initSetupState,
@@ -7054,14 +7521,14 @@ function DataSourceCmp({ children }) {
7054
7521
  globalThis.getDataSourceState = getState;
7055
7522
  }
7056
7523
  useLoadData();
7057
- return /* @__PURE__ */ React26.createElement(DataSourceContext.Provider, {
7524
+ return /* @__PURE__ */ React29.createElement(DataSourceContext.Provider, {
7058
7525
  value: contextValue
7059
- }, /* @__PURE__ */ React26.createElement(DataSourceWithContext, {
7526
+ }, /* @__PURE__ */ React29.createElement(DataSourceWithContext, {
7060
7527
  children
7061
7528
  }));
7062
7529
  }
7063
7530
  function DataSource(props) {
7064
- return /* @__PURE__ */ React26.createElement(DataSourceRoot, __spreadValues({}, props), /* @__PURE__ */ React26.createElement(DataSourceCmp, {
7531
+ return /* @__PURE__ */ React29.createElement(DataSourceRoot, __spreadValues({}, props), /* @__PURE__ */ React29.createElement(DataSourceCmp, {
7065
7532
  children: props.children
7066
7533
  }));
7067
7534
  }
@@ -7069,7 +7536,7 @@ function DataSource(props) {
7069
7536
  // src/components/InfiniteTable/hooks/useToggleGroupRow.ts
7070
7537
  function useToggleGroupRow() {
7071
7538
  const { getState: getDataSourceState, componentActions: dataSourceActions } = useDataSourceContextValue();
7072
- const toggleGroupRow = (0, import_react33.useCallback)((groupKeys) => {
7539
+ const toggleGroupRow = (0, import_react35.useCallback)((groupKeys) => {
7073
7540
  const state = getDataSourceState();
7074
7541
  const newState = new GroupRowsState(state.groupRowsState);
7075
7542
  newState.toggleGroupRow(groupKeys);
@@ -7101,7 +7568,7 @@ function useToggleGroupRow() {
7101
7568
 
7102
7569
  // src/components/InfiniteTable/hooks/useColumnsWhen.ts
7103
7570
  function useGroupByMap(groupBy) {
7104
- const groupByMap = (0, import_react34.useMemo)(() => {
7571
+ const groupByMap = (0, import_react36.useMemo)(() => {
7105
7572
  return groupBy.reduce((acc, groupBy2, index) => {
7106
7573
  acc.set(groupBy2.field, {
7107
7574
  groupBy: groupBy2,
@@ -7125,13 +7592,13 @@ function useColumnsWhen() {
7125
7592
  }
7126
7593
  } = useComponentState();
7127
7594
  const groupByMap = useGroupByMap(groupBy);
7128
- (0, import_react34.useEffect)(() => {
7595
+ (0, import_react36.useEffect)(() => {
7129
7596
  dataSourceActions.generateGroupRows = groupRenderStrategy !== "inline";
7130
7597
  }, [groupRenderStrategy]);
7131
- (0, import_react34.useEffect)(() => {
7598
+ (0, import_react36.useEffect)(() => {
7132
7599
  dataSourceActions.pivotTotalColumnPosition = pivotTotalColumnPosition;
7133
7600
  }, [pivotTotalColumnPosition]);
7134
- (0, import_react34.useEffect)(() => {
7601
+ (0, import_react36.useEffect)(() => {
7135
7602
  if (pivotGrandTotalColumnPosition != void 0) {
7136
7603
  dataSourceActions.pivotGrandTotalColumnPosition = pivotGrandTotalColumnPosition;
7137
7604
  }
@@ -7161,7 +7628,7 @@ function useColumnsWhenInlineGroupRenderStrategy(groupByMap) {
7161
7628
  base = {
7162
7629
  groupByField: field,
7163
7630
  field,
7164
- valueGetter: ({ rowInfo }) => {
7631
+ valueFormatter: ({ rowInfo }) => {
7165
7632
  var _a;
7166
7633
  return rowInfo.isGroupRow ? (_a = rowInfo.groupKeys) == null ? void 0 : _a[groupIndex] : rowInfo.value;
7167
7634
  },
@@ -7205,7 +7672,7 @@ function useColumnsWhenInlineGroupRenderStrategy(groupByMap) {
7205
7672
  });
7206
7673
  return computedColumns.size === 0 ? void 0 : computedColumns;
7207
7674
  }
7208
- (0, import_react34.useEffect)(() => {
7675
+ (0, import_react36.useEffect)(() => {
7209
7676
  const update = () => {
7210
7677
  componentActions.columnsWhenInlineGroupRenderStrategy = computeColumnsWhenInlineGroupRenderStrategy(columns, groupByMap, groupRenderStrategy, toggleGroupRow);
7211
7678
  };
@@ -7234,7 +7701,7 @@ function useColumnsWhenGrouping() {
7234
7701
  }
7235
7702
  } = useComponentState();
7236
7703
  const toggleGroupRow = useToggleGroupRow();
7237
- (0, import_react34.useEffect)(() => {
7704
+ (0, import_react36.useEffect)(() => {
7238
7705
  const update = () => {
7239
7706
  const columnsWhenGrouping = getColumnsWhenGrouping({
7240
7707
  columns,
@@ -7370,7 +7837,7 @@ function useHideColumns(groupByMap) {
7370
7837
  hideEmptyGroupColumns ? groupRowsState : null,
7371
7838
  hideEmptyGroupColumns
7372
7839
  ]);
7373
- (0, import_react34.useEffect)(() => {
7840
+ (0, import_react36.useEffect)(() => {
7374
7841
  const isGrouped = groupBy.length > 0;
7375
7842
  const currentState = getComponentState();
7376
7843
  const { controlledColumnVisibility, columnVisibility } = currentState;
@@ -7485,7 +7952,7 @@ function getColumnsWhenGrouping(params) {
7485
7952
  }
7486
7953
 
7487
7954
  // src/components/InfiniteTable/hooks/useComputedVisibleColumns.ts
7488
- var import_react36 = __toModule(require("react"));
7955
+ var import_react38 = __toModule(require("react"));
7489
7956
 
7490
7957
  // src/components/flexbox/index.ts
7491
7958
  var computeFlex = (params) => {
@@ -7642,7 +8109,9 @@ var adjustColumnOrderForPinning = (columnOrder, columnPinning) => {
7642
8109
  };
7643
8110
 
7644
8111
  // src/components/InfiniteTable/utils/getColumnComputedType.ts
7645
- var emptyType = Object.freeze({});
8112
+ var emptyType = Object.freeze({
8113
+ filterType: "string"
8114
+ });
7646
8115
  function getColumnComputedType(column, columnTypes) {
7647
8116
  const defaultType = columnTypes["default"] || emptyType;
7648
8117
  if (column.type === void 0) {
@@ -7658,22 +8127,6 @@ function getColumnComputedType(column, columnTypes) {
7658
8127
  return column.type.reduce((acc, columnType) => Object.assign(acc, columnTypes[columnType]), {});
7659
8128
  }
7660
8129
 
7661
- // src/components/InfiniteTable/utils/assignFiltered.ts
7662
- function assignFiltered(filterFn, target, ...rest) {
7663
- let result = target;
7664
- rest.forEach((obj) => {
7665
- for (const key in obj) {
7666
- if (obj.hasOwnProperty(key) && filterFn(obj[key], key)) {
7667
- result[key] = obj[key];
7668
- }
7669
- }
7670
- });
7671
- return result;
7672
- }
7673
- function assignNonNull(target, ...rest) {
7674
- return assignFiltered((value) => value != null, target, ...rest);
7675
- }
7676
-
7677
8130
  // src/components/InfiniteTable/utils/getComputedVisibleColumns.ts
7678
8131
  var logError = err("getComputedVisibleColumns");
7679
8132
  var isColumnVisible = (columnVisibility, _columnVisibilityAssumeVisible, colId) => {
@@ -7694,6 +8147,7 @@ var getComputedVisibleColumns = ({
7694
8147
  columnHeaderCssEllipsis,
7695
8148
  pinnedStartMaxWidth,
7696
8149
  pinnedEndMaxWidth,
8150
+ filterValue,
7697
8151
  sortable,
7698
8152
  sortInfo,
7699
8153
  setSortInfo,
@@ -7708,9 +8162,19 @@ var getComputedVisibleColumns = ({
7708
8162
  columnVisibilityAssumeVisible
7709
8163
  }) => {
7710
8164
  let computedOffset = 0;
8165
+ const filterValueRecord = (filterValue || []).reduce((acc, filterValueItem) => {
8166
+ const { id, field } = filterValueItem;
8167
+ if (field) {
8168
+ acc[field] = filterValueItem;
8169
+ }
8170
+ if (id) {
8171
+ acc[id] = filterValueItem;
8172
+ }
8173
+ return acc;
8174
+ }, {});
7711
8175
  const normalizedColumnOrder = adjustColumnOrderForPinning(columnOrder === true ? [...columns.keys()] : columnOrder, columnPinning);
7712
8176
  const visibleColumnOrder = normalizedColumnOrder.filter((colId) => {
7713
- let col = columns.get(colId);
8177
+ const col = columns.get(colId);
7714
8178
  if (!col) {
7715
8179
  logError(`Column with id "${colId}" specified in columnOrder array cannot be found in the columns map.`);
7716
8180
  return false;
@@ -7758,7 +8222,7 @@ var getComputedVisibleColumns = ({
7758
8222
  delete colTypeSizing.width;
7759
8223
  }
7760
8224
  colSizing = assignNonNull(colTypeSizing, colSizing);
7761
- let colFlex = (_a = colSizing.flex) != null ? _a : void 0;
8225
+ const colFlex = (_a = colSizing.flex) != null ? _a : void 0;
7762
8226
  const colMinWidth = (_c = (_b = colSizing.minWidth) != null ? _b : column == null ? void 0 : column.minWidth) != null ? _c : columnMinWidth;
7763
8227
  const colMaxWidth = (_e = (_d = colSizing.maxWidth) != null ? _d : column == null ? void 0 : column.maxWidth) != null ? _e : columnMaxWidth;
7764
8228
  let size = colFlex != void 0 ? void 0 : (_f = colSizing.width) != null ? _f : columnDefaultWidth;
@@ -7801,7 +8265,7 @@ var getComputedVisibleColumns = ({
7801
8265
  });
7802
8266
  const firstPinnedEndAbsoluteOffset = bodySize.width - totalPinnedEndWidth;
7803
8267
  columnsArray.forEach((c, i) => {
7804
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
8268
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
7805
8269
  const id = visibleColumnOrder[i];
7806
8270
  const nextColumnId = visibleColumnOrder[i + 1];
7807
8271
  const colType = getColumnComputedType(c, columnTypes);
@@ -7812,47 +8276,6 @@ var getComputedVisibleColumns = ({
7812
8276
  const computedSortedDesc = computedSorted && !computedSortedAsc;
7813
8277
  const computedSortIndex = (_c = sortingInfo == null ? void 0 : sortingInfo.index) != null ? _c : -1;
7814
8278
  const computedWidth = computedSizes[i];
7815
- const toggleSort = () => {
7816
- let currentSortInfo = computedSortInfo;
7817
- let newColumnSortInfo;
7818
- if (!currentSortInfo) {
7819
- newColumnSortInfo = {
7820
- dir: 1,
7821
- id,
7822
- field: c.field,
7823
- type: c.type
7824
- };
7825
- } else {
7826
- if (computedSortedDesc) {
7827
- newColumnSortInfo = null;
7828
- } else {
7829
- newColumnSortInfo = __spreadProps(__spreadValues({}, computedSortInfo), {
7830
- dir: -1
7831
- });
7832
- }
7833
- }
7834
- if (c.field && newColumnSortInfo && !newColumnSortInfo.field) {
7835
- newColumnSortInfo.field = c.field;
7836
- }
7837
- let finalSortInfo = sortInfo ? [...sortInfo] : [];
7838
- if (multiSort) {
7839
- if (computedSortIndex === -1) {
7840
- if (newColumnSortInfo) {
7841
- finalSortInfo.push(newColumnSortInfo);
7842
- }
7843
- } else {
7844
- finalSortInfo = finalSortInfo.map((info, index) => {
7845
- if (index === computedSortIndex) {
7846
- return newColumnSortInfo;
7847
- }
7848
- return info;
7849
- }).filter((x) => x != null);
7850
- }
7851
- } else {
7852
- finalSortInfo = newColumnSortInfo ? [newColumnSortInfo] : [];
7853
- }
7854
- setSortInfo(finalSortInfo);
7855
- };
7856
8279
  const computedPinned = getComputedPinned(id, columnPinning);
7857
8280
  const computedLast = i === visibleColumnOrder.length - 1;
7858
8281
  const computedPinningOffset = computedPinned === "start" ? computedPinnedStartColumnsWidth : computedPinned === "end" ? computedPinnedEndColumnsWidth : computedOffset - computedPinnedStartColumnsWidth;
@@ -7861,23 +8284,36 @@ var getComputedVisibleColumns = ({
7861
8284
  const computedLastInCategory = computedLast || computedPinned !== getComputedPinned(nextColumnId, columnPinning);
7862
8285
  const cssEllipsis = (_e = (_d = c.cssEllipsis) != null ? _d : colType.cssEllipsis) != null ? _e : columnCssEllipsis;
7863
8286
  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;
8287
+ const computedFilterValue = filterValueRecord[id] || c.field ? filterValueRecord[c.field] || null : null;
8288
+ const computedFiltered = computedFilterValue != null;
8289
+ const computedFilterable = (_l = (_k = c.defaultFilterable) != null ? _k : colType.defaultFilterable) != null ? _l : true;
8290
+ const computedDataType = c.dataType || colType.dataType || (Array.isArray(c.type) ? c.type[0] : c.type) || "string";
8291
+ const computedSortType = c.sortType || colType.sortType || computedDataType;
8292
+ const computedFilterType = c.filterType || colType.filterType || computedDataType;
7864
8293
  const result2 = __spreadProps(__spreadValues({
7865
8294
  align: colType.align,
7866
8295
  verticalAlign: colType.verticalAlign,
7867
8296
  defaultHiddenWhenGroupedBy: colType.defaultHiddenWhenGroupedBy,
7868
8297
  valueGetter: colType.valueGetter,
8298
+ valueFormatter: colType.valueFormatter,
7869
8299
  renderValue: colType.renderValue,
7870
8300
  render: colType.render,
7871
8301
  style: colType.style,
7872
8302
  components: colType.components
7873
8303
  }, c), {
8304
+ computedDataType,
8305
+ computedSortType,
8306
+ computedFilterType,
7874
8307
  cssEllipsis,
7875
8308
  headerCssEllipsis,
8309
+ computedFilterValue,
8310
+ computedFiltered,
8311
+ computedFilterable,
7876
8312
  computedWidth,
7877
8313
  computedAbsoluteOffset,
7878
8314
  computedPinningOffset,
7879
8315
  computedOffset,
7880
- computedSortable: (_m = (_l = (_k = c.sortable) != null ? _k : colType.sortable) != null ? _l : sortable) != null ? _m : true,
8316
+ computedSortable: (_o = (_n = (_m = c.sortable) != null ? _m : colType.sortable) != null ? _n : sortable) != null ? _o : true,
7881
8317
  computedSortInfo,
7882
8318
  computedSortIndex,
7883
8319
  computedMultiSort: multiSort,
@@ -7886,14 +8322,57 @@ var getComputedVisibleColumns = ({
7886
8322
  computedSortedDesc,
7887
8323
  computedVisibleIndex: i,
7888
8324
  computedPinned,
7889
- computedDraggable: (_o = (_n = c.draggable) != null ? _n : draggableColumns) != null ? _o : true,
8325
+ computedDraggable: (_q = (_p = c.draggable) != null ? _p : draggableColumns) != null ? _q : true,
7890
8326
  computedFirstInCategory,
7891
8327
  computedLastInCategory,
7892
8328
  computedFirst: i === 0,
7893
8329
  computedLast,
7894
- toggleSort,
8330
+ toggleSort: () => {
8331
+ const currentSortInfo = computedSortInfo;
8332
+ let newColumnSortInfo;
8333
+ if (!currentSortInfo) {
8334
+ newColumnSortInfo = {
8335
+ dir: 1,
8336
+ id,
8337
+ field: c.field,
8338
+ type: computedSortType
8339
+ };
8340
+ } else {
8341
+ if (computedSortedDesc) {
8342
+ newColumnSortInfo = null;
8343
+ } else {
8344
+ newColumnSortInfo = __spreadProps(__spreadValues({}, computedSortInfo), {
8345
+ dir: -1
8346
+ });
8347
+ }
8348
+ }
8349
+ if (c.field && newColumnSortInfo && !newColumnSortInfo.field) {
8350
+ newColumnSortInfo.field = c.field;
8351
+ }
8352
+ if (c.valueGetter && newColumnSortInfo && !newColumnSortInfo.valueGetter) {
8353
+ newColumnSortInfo.valueGetter = (data) => c.valueGetter({ data, field: c.field });
8354
+ }
8355
+ let finalSortInfo = sortInfo ? [...sortInfo] : [];
8356
+ if (multiSort) {
8357
+ if (computedSortIndex === -1) {
8358
+ if (newColumnSortInfo) {
8359
+ finalSortInfo.push(newColumnSortInfo);
8360
+ }
8361
+ } else {
8362
+ finalSortInfo = finalSortInfo.map((info, index) => {
8363
+ if (index === computedSortIndex) {
8364
+ return newColumnSortInfo;
8365
+ }
8366
+ return info;
8367
+ }).filter((x) => x != null);
8368
+ }
8369
+ } else {
8370
+ finalSortInfo = newColumnSortInfo ? [newColumnSortInfo] : [];
8371
+ }
8372
+ setSortInfo(finalSortInfo);
8373
+ },
7895
8374
  id,
7896
- header: (_r = (_q = (_p = c.header) != null ? _p : colType.header) != null ? _q : c.name) != null ? _r : c.field
8375
+ header: (_t = (_s = (_r = c.header) != null ? _r : colType.header) != null ? _s : c.name) != null ? _t : c.field
7897
8376
  });
7898
8377
  computedOffset += computedWidth;
7899
8378
  computedVisibleColumnsMap.set(result2.id, result2);
@@ -7934,10 +8413,10 @@ var getComputedVisibleColumns = ({
7934
8413
  };
7935
8414
 
7936
8415
  // src/components/InfiniteTable/hooks/useRerenderOnKeyChange.ts
7937
- var import_react35 = __toModule(require("react"));
8416
+ var import_react37 = __toModule(require("react"));
7938
8417
  var useRerenderOnKeyChange = (map2) => {
7939
8418
  const [renderId, rerender] = useRerender();
7940
- (0, import_react35.useEffect)(() => {
8419
+ (0, import_react37.useEffect)(() => {
7941
8420
  const update = rafFn(rerender);
7942
8421
  return interceptMap(map2, {
7943
8422
  set: update,
@@ -7962,6 +8441,7 @@ var useComputedVisibleColumns = ({
7962
8441
  sortInfo,
7963
8442
  multiSort,
7964
8443
  setSortInfo,
8444
+ filterValue,
7965
8445
  columnOrder,
7966
8446
  columnPinning,
7967
8447
  columnTypes,
@@ -7989,7 +8469,7 @@ var useComputedVisibleColumns = ({
7989
8469
  computedPinnedEndOffset,
7990
8470
  computedPinnedEndWidth,
7991
8471
  computedPinnedStartWidth
7992
- } = (0, import_react36.useMemo)(() => {
8472
+ } = (0, import_react38.useMemo)(() => {
7993
8473
  return getComputedVisibleColumns({
7994
8474
  columns,
7995
8475
  bodySize,
@@ -7999,6 +8479,7 @@ var useComputedVisibleColumns = ({
7999
8479
  columnCssEllipsis,
8000
8480
  columnHeaderCssEllipsis,
8001
8481
  viewportReservedWidth,
8482
+ filterValue,
8002
8483
  sortable,
8003
8484
  sortInfo,
8004
8485
  setSortInfo,
@@ -8023,6 +8504,7 @@ var useComputedVisibleColumns = ({
8023
8504
  sortInfo,
8024
8505
  setSortInfo,
8025
8506
  multiSort,
8507
+ filterValue,
8026
8508
  columnOrder,
8027
8509
  columnVisibility,
8028
8510
  columnVisibilityAssumeVisible,
@@ -8055,7 +8537,7 @@ var useComputedVisibleColumns = ({
8055
8537
  };
8056
8538
 
8057
8539
  // src/components/InfiniteTable/hooks/useScrollbars.ts
8058
- var import_react37 = __toModule(require("react"));
8540
+ var import_react39 = __toModule(require("react"));
8059
8541
  var INITIAL_SCROLLBARS = {
8060
8542
  vertical: false,
8061
8543
  horizontal: false
@@ -8063,8 +8545,8 @@ var INITIAL_SCROLLBARS = {
8063
8545
  function useScrollbars(brain) {
8064
8546
  const { getComponentState: getInfiniteTableState } = useComponentState();
8065
8547
  const { getState: getDataSourceState } = useDataSourceContextValue();
8066
- const [scrollbars, setScrollbars] = (0, import_react37.useState)(INITIAL_SCROLLBARS);
8067
- (0, import_react37.useEffect)(() => {
8548
+ const [scrollbars, setScrollbars] = (0, import_react39.useState)(INITIAL_SCROLLBARS);
8549
+ (0, import_react39.useEffect)(() => {
8068
8550
  return brain.onRenderCountChange(() => {
8069
8551
  const { scrollTopMax, scrollLeftMax } = brain;
8070
8552
  setScrollbars({
@@ -8073,7 +8555,7 @@ function useScrollbars(brain) {
8073
8555
  });
8074
8556
  });
8075
8557
  }, [brain]);
8076
- (0, import_react37.useLayoutEffect)(() => {
8558
+ (0, import_react39.useLayoutEffect)(() => {
8077
8559
  const dataSourceState = getDataSourceState();
8078
8560
  const { onScrollbarsChange } = getInfiniteTableState();
8079
8561
  const { notifyScrollbarsChange } = dataSourceState;
@@ -8104,27 +8586,27 @@ function useComputed() {
8104
8586
  bodySize,
8105
8587
  showSeparatePivotColumnForSingleAggregation
8106
8588
  } = componentState;
8107
- (0, import_react38.useState)(() => {
8589
+ (0, import_react40.useState)(() => {
8108
8590
  componentState.onRowHeightCSSVarChange.onChange((rowHeight) => {
8109
8591
  if (rowHeight) {
8110
8592
  componentActions.rowHeight = rowHeight;
8111
8593
  }
8112
8594
  });
8113
- componentState.onHeaderHeightCSSVarChange.onChange((headerHeight) => {
8114
- if (headerHeight) {
8115
- componentActions.headerHeight = headerHeight;
8595
+ componentState.onColumnHeaderHeightCSSVarChange.onChange((columnHeaderHeight) => {
8596
+ if (columnHeaderHeight) {
8597
+ componentActions.columnHeaderHeight = columnHeaderHeight;
8116
8598
  }
8117
8599
  });
8118
8600
  });
8119
- (0, import_react38.useEffect)(() => {
8601
+ (0, import_react40.useEffect)(() => {
8120
8602
  dataSourceActions.showSeparatePivotColumnForSingleAggregation = showSeparatePivotColumnForSingleAggregation;
8121
8603
  }, [showSeparatePivotColumnForSingleAggregation]);
8122
- const { multiSort } = dataSourceState;
8604
+ const { multiSort, filterValue } = dataSourceState;
8123
8605
  useColumnGroups();
8124
8606
  const { toggleGroupRow } = useColumnsWhen();
8125
- const setSortInfo = (0, import_react38.useCallback)((sortInfo) => {
8607
+ const setSortInfo = (0, import_react40.useCallback)((sortInfo) => {
8126
8608
  var _a2;
8127
- const newSortInfo = multiSort ? sortInfo : (_a2 = sortInfo[0]) != null ? _a2 : null;
8609
+ const newSortInfo = getDataSourceState().multiSort ? sortInfo : (_a2 = sortInfo[0]) != null ? _a2 : null;
8128
8610
  dataSourceActions.sortInfo = newSortInfo;
8129
8611
  }, [getDataSourceState]);
8130
8612
  const columns = componentState.computedColumns;
@@ -8163,6 +8645,7 @@ function useComputed() {
8163
8645
  columnVisibility,
8164
8646
  columnVisibilityAssumeVisible: true,
8165
8647
  columnPinning,
8648
+ filterValue,
8166
8649
  columnSizing,
8167
8650
  columnTypes
8168
8651
  });
@@ -8172,6 +8655,7 @@ function useComputed() {
8172
8655
  const computedPinnedStartOverflow = computedPinnedStartWidth ? computedPinnedStartColumnsWidth > computedPinnedStartWidth : false;
8173
8656
  const computedPinnedEndOverflow = computedPinnedEndWidth ? computedPinnedEndColumnsWidth > computedPinnedEndWidth : false;
8174
8657
  return {
8658
+ showColumnFilters: !!dataSourceState.filterValue,
8175
8659
  scrollbars,
8176
8660
  columnSize,
8177
8661
  rowspan,
@@ -8279,7 +8763,7 @@ function useDOMProps(initialDOMProps) {
8279
8763
  }
8280
8764
 
8281
8765
  // src/components/InfiniteTable/hooks/useLicense/useLicense.ts
8282
- var import_react39 = __toModule(require("react"));
8766
+ var import_react41 = __toModule(require("react"));
8283
8767
 
8284
8768
  // src/components/InfiniteTable/hooks/useLicense/crc32.ts
8285
8769
  var DEFAULT_ReversedPolynomial = 3988292384;
@@ -8437,10 +8921,10 @@ var isInsideSandbox = () => {
8437
8921
  };
8438
8922
  var isInsidePlayground = isInsideSandbox() || isInsideSandpack();
8439
8923
  var useLicense = (licenseKey = "") => {
8440
- const valid = (0, import_react39.useMemo)(() => {
8924
+ const valid = (0, import_react41.useMemo)(() => {
8441
8925
  let valid2 = isValidLicense(licenseKey, {
8442
8926
  publishedAt: 1624970570587,
8443
- version: "0.3.0"
8927
+ version: "0.3.3"
8444
8928
  });
8445
8929
  if (!licenseKey && !valid2 && isInsidePlayground) {
8446
8930
  return true;
@@ -8451,7 +8935,7 @@ var useLicense = (licenseKey = "") => {
8451
8935
  };
8452
8936
 
8453
8937
  // src/components/InfiniteTable/state/getInitialState.ts
8454
- var import_react40 = __toModule(require("react"));
8938
+ var import_react42 = __toModule(require("react"));
8455
8939
 
8456
8940
  // src/components/VirtualBrain/ScrollListener.ts
8457
8941
  var initialScrollPosition = {
@@ -8528,11 +9012,11 @@ function initSetupState2() {
8528
9012
  brain,
8529
9013
  headerBrain,
8530
9014
  columnShifts: null,
8531
- domRef: (0, import_react40.createRef)(),
8532
- scrollerDOMRef: (0, import_react40.createRef)(),
8533
- portalDOMRef: (0, import_react40.createRef)(),
9015
+ domRef: (0, import_react42.createRef)(),
9016
+ scrollerDOMRef: (0, import_react42.createRef)(),
9017
+ portalDOMRef: (0, import_react42.createRef)(),
8534
9018
  onRowHeightCSSVarChange: buildSubscriptionCallback(),
8535
- onHeaderHeightCSSVarChange: buildSubscriptionCallback(),
9019
+ onColumnHeaderHeightCSSVarChange: buildSubscriptionCallback(),
8536
9020
  bodySize: {
8537
9021
  width: 0,
8538
9022
  height: 0
@@ -8582,6 +9066,7 @@ var forwardProps3 = (setupState) => {
8582
9066
  onScrollbarsChange: 1,
8583
9067
  autoSizeColumnsKey: 1,
8584
9068
  scrollStopDelay: (scrollStopDelay) => scrollStopDelay != null ? scrollStopDelay : 250,
9069
+ filterEditors: (filterEditors) => __spreadValues(__spreadValues({}, defaultFilterEditors), filterEditors),
8585
9070
  viewportReservedWidth: (viewportReservedWidth) => viewportReservedWidth != null ? viewportReservedWidth : 0,
8586
9071
  activeIndex: (activeIndex) => activeIndex != null ? activeIndex : 0,
8587
9072
  columnMinWidth: (columnMinWidth) => columnMinWidth != null ? columnMinWidth : 30,
@@ -8589,6 +9074,9 @@ var forwardProps3 = (setupState) => {
8589
9074
  columnDefaultWidth: (columnDefaultWidth) => columnDefaultWidth != null ? columnDefaultWidth : 200,
8590
9075
  columnCssEllipsis: (columnCssEllipsis) => columnCssEllipsis != null ? columnCssEllipsis : true,
8591
9076
  draggableColumns: (draggableColumns) => draggableColumns != null ? draggableColumns : true,
9077
+ headerOptions: (headerOptions) => __spreadValues({
9078
+ alwaysReserveSpaceForSortIcon: true
9079
+ }, headerOptions),
8592
9080
  showSeparatePivotColumnForSingleAggregation: (showSeparatePivotColumnForSingleAggregation) => showSeparatePivotColumnForSingleAggregation != null ? showSeparatePivotColumnForSingleAggregation : false,
8593
9081
  sortable: (sortable) => sortable != null ? sortable : true,
8594
9082
  hideEmptyGroupColumns: (hideEmptyGroupColumns) => hideEmptyGroupColumns != null ? hideEmptyGroupColumns : false,
@@ -8601,7 +9089,7 @@ var forwardProps3 = (setupState) => {
8601
9089
  showHoverRows: (showHoverRows) => showHoverRows != null ? showHoverRows : true,
8602
9090
  virtualizeColumns: (virtualizeColumns) => virtualizeColumns != null ? virtualizeColumns : true,
8603
9091
  rowHeight: (rowHeight) => typeof rowHeight === "number" ? rowHeight : 0,
8604
- headerHeight: (headerHeight) => typeof headerHeight === "number" ? headerHeight : 30,
9092
+ columnHeaderHeight: (columnHeaderHeight) => typeof columnHeaderHeight === "number" ? columnHeaderHeight : 30,
8605
9093
  columns: (columns) => toMap(columns, setupState.propsCache.get("columns")),
8606
9094
  columnVisibility: (columnVisibility) => columnVisibility != null ? columnVisibility : {},
8607
9095
  columnPinning: (columnPinning) => toMap(columnPinning, setupState.propsCache.get("columnPinning")),
@@ -8647,7 +9135,7 @@ var mapPropsToState2 = (params) => {
8647
9135
  columnGroupsMaxDepth: columnGroupsDepthsMap != state.columnGroupsDepthsMap ? Math.max(...columnGroupsDepthsMap.values(), 0) : state.columnGroupsMaxDepth,
8648
9136
  computedColumnGroups,
8649
9137
  rowHeightCSSVar: typeof props.rowHeight === "string" ? props.rowHeight : "",
8650
- headerHeightCSSVar: typeof props.headerHeight === "string" ? props.headerHeight || ThemeVars.components.Header.height : ""
9138
+ columnHeaderHeightCSSVar: typeof props.columnHeaderHeight === "string" ? props.columnHeaderHeight || ThemeVars.components.Header.columnHeaderHeight : ""
8651
9139
  };
8652
9140
  };
8653
9141
 
@@ -8660,12 +9148,12 @@ var InfiniteTableRoot = getComponentStateRoot({
8660
9148
  mapPropsToState: mapPropsToState2,
8661
9149
  allowedControlledPropOverrides: {
8662
9150
  rowHeight: true,
8663
- headerHeight: true
9151
+ columnHeaderHeight: true
8664
9152
  },
8665
9153
  getParentState: () => useDataSource(),
8666
9154
  debugName: "InfiniteTable"
8667
9155
  });
8668
- var InfiniteTableComponent = React27.memo(function InfiniteTableComponent2() {
9156
+ var InfiniteTableComponent = React30.memo(function InfiniteTableComponent2() {
8669
9157
  var _a;
8670
9158
  const { componentState, getComputed, computed } = useInfiniteTable();
8671
9159
  const {
@@ -8681,9 +9169,9 @@ var InfiniteTableComponent = React27.memo(function InfiniteTableComponent2() {
8681
9169
  loadingText,
8682
9170
  header,
8683
9171
  onRowHeightCSSVarChange,
8684
- onHeaderHeightCSSVarChange,
9172
+ onColumnHeaderHeightCSSVarChange,
8685
9173
  rowHeightCSSVar,
8686
- headerHeightCSSVar,
9174
+ columnHeaderHeightCSSVar,
8687
9175
  components,
8688
9176
  scrollStopDelay,
8689
9177
  brain,
@@ -8698,7 +9186,7 @@ var InfiniteTableComponent = React27.memo(function InfiniteTableComponent2() {
8698
9186
  bodySize,
8699
9187
  computed
8700
9188
  });
8701
- React27.useEffect(() => {
9189
+ React30.useEffect(() => {
8702
9190
  const dataSourceState = getDataSourceState();
8703
9191
  const onChange = debounce((renderRange) => {
8704
9192
  dataSourceState.notifyRenderRangeChange({
@@ -8711,35 +9199,35 @@ var InfiniteTableComponent = React27.memo(function InfiniteTableComponent2() {
8711
9199
  const licenseValid = useLicense(licenseKey);
8712
9200
  const domProps = useDOMProps(componentState.domProps);
8713
9201
  const LoadMaskCmp = (_a = components == null ? void 0 : components.LoadMask) != null ? _a : LoadMask;
8714
- React27.useEffect(() => {
9202
+ React30.useEffect(() => {
8715
9203
  brain.setScrollStopDelay(scrollStopDelay);
8716
9204
  dataSourceActions.scrollStopDelayUpdatedByTable = scrollStopDelay;
8717
9205
  }, [scrollStopDelay]);
8718
9206
  useAutoSizeColumns();
8719
- return /* @__PURE__ */ React27.createElement("div", __spreadValues({
9207
+ return /* @__PURE__ */ React30.createElement("div", __spreadValues({
8720
9208
  ref: domRef
8721
- }, domProps), header ? /* @__PURE__ */ React27.createElement(TableHeaderWrapper, {
9209
+ }, domProps), header ? /* @__PURE__ */ React30.createElement(TableHeaderWrapper, {
8722
9210
  brain: headerBrain,
8723
9211
  scrollbars
8724
- }) : null, /* @__PURE__ */ React27.createElement(InfiniteTableBody, null, /* @__PURE__ */ React27.createElement(HeadlessTable, {
9212
+ }) : null, /* @__PURE__ */ React30.createElement(InfiniteTableBody, null, /* @__PURE__ */ React30.createElement(HeadlessTable, {
8725
9213
  tabIndex: 0,
8726
9214
  scrollStopDelay,
8727
9215
  brain,
8728
9216
  renderCell,
8729
9217
  cellHoverClassNames: HOVERED_CLASS_NAMES,
8730
9218
  scrollerDOMRef
8731
- }), /* @__PURE__ */ React27.createElement(LoadMaskCmp, {
9219
+ }), /* @__PURE__ */ React30.createElement(LoadMaskCmp, {
8732
9220
  visible: loading
8733
- }, loadingText)), licenseValid ? null : /* @__PURE__ */ React27.createElement(InfiniteTableLicenseFooter, null), /* @__PURE__ */ React27.createElement("div", {
9221
+ }, loadingText)), /* @__PURE__ */ React30.createElement("div", {
8734
9222
  ref: portalDOMRef,
8735
9223
  className: join(`${rootClassName2}Portal`, zIndex[1e3], position.absolute, top[0], left[0])
8736
- }), rowHeightCSSVar ? /* @__PURE__ */ React27.createElement(CSSVariableWatch, {
9224
+ }), rowHeightCSSVar ? /* @__PURE__ */ React30.createElement(CSSVariableWatch, {
8737
9225
  varName: rowHeightCSSVar,
8738
9226
  onChange: onRowHeightCSSVarChange
8739
- }) : null, headerHeightCSSVar ? /* @__PURE__ */ React27.createElement(CSSVariableWatch, {
8740
- varName: headerHeightCSSVar,
8741
- onChange: onHeaderHeightCSSVarChange
8742
- }) : null);
9227
+ }) : null, columnHeaderHeightCSSVar ? /* @__PURE__ */ React30.createElement(CSSVariableWatch, {
9228
+ varName: columnHeaderHeightCSSVar,
9229
+ onChange: onColumnHeaderHeightCSSVarChange
9230
+ }) : null, /* @__PURE__ */ React30.createElement(InfiniteTableFooter, null), licenseValid ? null : /* @__PURE__ */ React30.createElement(InfiniteTableLicenseFooter, null));
8743
9231
  });
8744
9232
  function InfiniteTableContextProvider() {
8745
9233
  const { componentActions, componentState } = useComponentState();
@@ -8767,27 +9255,27 @@ function InfiniteTableContextProvider() {
8767
9255
  bodySize.width = (_b = (_a = scrollerDOMRef.current) == null ? void 0 : _a.scrollWidth) != null ? _b : bodySize.width;
8768
9256
  componentActions.bodySize = bodySize;
8769
9257
  }, { earlyAttach: true });
8770
- React27.useEffect(() => {
9258
+ React30.useEffect(() => {
8771
9259
  return () => {
8772
9260
  componentState.onRowHeightCSSVarChange.destroy();
8773
- componentState.onHeaderHeightCSSVarChange.destroy();
9261
+ componentState.onColumnHeaderHeightCSSVarChange.destroy();
8774
9262
  };
8775
9263
  }, []);
8776
- React27.useEffect(() => {
9264
+ React30.useEffect(() => {
8777
9265
  if (scrollerDOMRef.current) {
8778
9266
  scrollerDOMRef.current.scrollTop = 0;
8779
9267
  }
8780
9268
  }, [scrollTopKey, scrollerDOMRef]);
8781
9269
  const TableContext2 = getInfiniteTableContext();
8782
- return /* @__PURE__ */ React27.createElement(TableContext2.Provider, {
9270
+ return /* @__PURE__ */ React30.createElement(TableContext2.Provider, {
8783
9271
  value: contextValue
8784
- }, /* @__PURE__ */ React27.createElement(InfiniteTableComponent, null));
9272
+ }, /* @__PURE__ */ React30.createElement(InfiniteTableComponent, null));
8785
9273
  }
8786
9274
  function InfiniteTable(props) {
8787
- const table = /* @__PURE__ */ React27.createElement(InfiniteTableRoot, __spreadValues({}, props), /* @__PURE__ */ React27.createElement(InfiniteTableContextProvider, null));
8788
- return /* @__PURE__ */ React27.createElement(React27.StrictMode, null, table);
9275
+ const table = /* @__PURE__ */ React30.createElement(InfiniteTableRoot, __spreadValues({}, props), /* @__PURE__ */ React30.createElement(InfiniteTableContextProvider, null));
9276
+ return /* @__PURE__ */ React30.createElement(React30.StrictMode, null, table);
8789
9277
  }
8790
9278
  InfiniteTable.defaultProps = {
8791
9279
  rowHeight: 40,
8792
- headerHeight: ThemeVars.components.Header.height
9280
+ columnHeaderHeight: ThemeVars.components.Header.columnHeaderHeight
8793
9281
  };