@infinite-table/infinite-react 0.3.2 → 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.
- package/index.css +76 -50
- package/index.d.ts +537 -405
- package/index.esm.css +76 -50
- package/index.esm.js +1029 -553
- package/index.js +1092 -623
- package/package.json +2 -2
package/index.esm.js
CHANGED
|
@@ -636,9 +636,9 @@ function debounce(fn, { wait }) {
|
|
|
636
636
|
// src/components/InfiniteTable/index.tsx
|
|
637
637
|
import {
|
|
638
638
|
StrictMode,
|
|
639
|
-
createElement as
|
|
639
|
+
createElement as createElement24,
|
|
640
640
|
memo as memo9,
|
|
641
|
-
useEffect as
|
|
641
|
+
useEffect as useEffect24
|
|
642
642
|
} from "react";
|
|
643
643
|
|
|
644
644
|
// src/utils/join.ts
|
|
@@ -2782,6 +2782,9 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2782
2782
|
});
|
|
2783
2783
|
};
|
|
2784
2784
|
this.onMouseLeave = (rowIndex) => {
|
|
2785
|
+
if (this.currentHoveredRow != -1 && this.currentHoveredRow === rowIndex) {
|
|
2786
|
+
this.removeHoverClass(rowIndex);
|
|
2787
|
+
}
|
|
2785
2788
|
this.currentHoveredRow = -1;
|
|
2786
2789
|
if (this.scrolling) {
|
|
2787
2790
|
return;
|
|
@@ -2856,9 +2859,6 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2856
2859
|
};
|
|
2857
2860
|
this.onScrollStart = () => {
|
|
2858
2861
|
this.scrolling = true;
|
|
2859
|
-
if (this.currentHoveredRow != -1) {
|
|
2860
|
-
this.removeHoverClass(this.currentHoveredRow);
|
|
2861
|
-
}
|
|
2862
2862
|
};
|
|
2863
2863
|
this.onScrollStop = () => {
|
|
2864
2864
|
this.scrolling = false;
|
|
@@ -3552,6 +3552,7 @@ var cssEllipsisClassName = "_16lm1iw1c _16lm1iw1d _16lm1iw18";
|
|
|
3552
3552
|
var cursor = { pointer: "_16lm1iwd" };
|
|
3553
3553
|
var display = { flex: "_16lm1iwl", block: "_16lm1iwm", inlineBlock: "_16lm1iwn" };
|
|
3554
3554
|
var flex = { "1": "_16lm1iwe", none: "_16lm1iwf" };
|
|
3555
|
+
var flexFlow = { column: "_16lm1iw11", row: "_16lm1iw12" };
|
|
3555
3556
|
var justifyContent = { center: "_16lm1iw15", start: "_16lm1iw16", end: "_16lm1iw17" };
|
|
3556
3557
|
var left = { "0": "_16lm1iwv", "100%": "_16lm1iww" };
|
|
3557
3558
|
var overflow = { hidden: "_16lm1iw18", auto: "_16lm1iw19", visible: "_16lm1iw1a" };
|
|
@@ -3563,122 +3564,135 @@ var zIndex = { "1": "_16lm1iwg", "10": "_16lm1iwh", "1000": "_16lm1iwi", "10000"
|
|
|
3563
3564
|
|
|
3564
3565
|
// src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx
|
|
3565
3566
|
var InfiniteTableBody = forwardRef2(function InfiniteTableBody2(props, ref) {
|
|
3566
|
-
const { rootClassName:
|
|
3567
|
+
const { rootClassName: rootClassName9 } = useInternalProps();
|
|
3567
3568
|
return /* @__PURE__ */ createElement8("div", __spreadProps(__spreadValues({
|
|
3568
3569
|
ref
|
|
3569
3570
|
}, props), {
|
|
3570
|
-
className: join(`${
|
|
3571
|
+
className: join(`${rootClassName9}Body`, position.relative, flex["1"], transformTranslateZero, props.className)
|
|
3571
3572
|
}));
|
|
3572
3573
|
});
|
|
3573
3574
|
|
|
3574
|
-
// src/components/InfiniteTable/components/
|
|
3575
|
+
// src/components/InfiniteTable/components/InfiniteTableFooter/InfiniteTableFooter.tsx
|
|
3575
3576
|
import {
|
|
3576
|
-
|
|
3577
|
-
|
|
3577
|
+
createElement as createElement9,
|
|
3578
|
+
forwardRef as forwardRef3
|
|
3578
3579
|
} from "react";
|
|
3579
|
-
|
|
3580
|
-
|
|
3580
|
+
var InfiniteTableFooter = forwardRef3(function InfiniteTableFooter2(props, ref) {
|
|
3581
|
+
const { rootClassName: rootClassName9 } = useInternalProps();
|
|
3582
|
+
return /* @__PURE__ */ createElement9("div", __spreadProps(__spreadValues({
|
|
3583
|
+
ref
|
|
3584
|
+
}, props), {
|
|
3585
|
+
className: join(`${rootClassName9}Footer`, position.relative, display.flex, flexFlow.row, props.className)
|
|
3586
|
+
}));
|
|
3587
|
+
});
|
|
3581
3588
|
|
|
3582
|
-
// src/components/InfiniteTable/components/
|
|
3589
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
|
|
3583
3590
|
import {
|
|
3584
|
-
Fragment,
|
|
3585
|
-
|
|
3586
|
-
|
|
3591
|
+
Fragment as Fragment2,
|
|
3592
|
+
createContext as createContext4,
|
|
3593
|
+
createElement as createElement13,
|
|
3594
|
+
useMemo as useMemo5
|
|
3587
3595
|
} from "react";
|
|
3596
|
+
import { useCallback as useCallback6, useContext as useContext5, useEffect as useEffect9, useRef as useRef10 } from "react";
|
|
3597
|
+
import { createPortal } from "react-dom";
|
|
3588
3598
|
|
|
3589
|
-
// src/components/
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3599
|
+
// src/components/DataSource/defaultFilterTypes.ts
|
|
3600
|
+
function getFilterTypes() {
|
|
3601
|
+
const result = {
|
|
3602
|
+
string: {
|
|
3603
|
+
label: "Text",
|
|
3604
|
+
emptyValues: new Set([""]),
|
|
3605
|
+
defaultOperator: "contains",
|
|
3606
|
+
operators: [
|
|
3607
|
+
{
|
|
3608
|
+
name: "contains",
|
|
3609
|
+
fn: ({ currentValue, filterValue, emptyValues }) => {
|
|
3610
|
+
if (emptyValues.has(currentValue) || emptyValues.has(filterValue)) {
|
|
3611
|
+
return true;
|
|
3612
|
+
}
|
|
3613
|
+
return typeof currentValue === "string" && typeof filterValue == "string" && currentValue.toLowerCase().includes(filterValue.toLowerCase());
|
|
3614
|
+
}
|
|
3615
|
+
},
|
|
3616
|
+
{
|
|
3617
|
+
name: "eq",
|
|
3618
|
+
fn: ({ currentValue: value, filterValue, emptyValues }) => {
|
|
3619
|
+
if (emptyValues.has(value) || emptyValues.has(filterValue)) {
|
|
3620
|
+
return true;
|
|
3621
|
+
}
|
|
3622
|
+
return typeof value === "string" && value === filterValue;
|
|
3623
|
+
}
|
|
3624
|
+
}
|
|
3625
|
+
]
|
|
3626
|
+
},
|
|
3627
|
+
number: {
|
|
3628
|
+
label: "Number",
|
|
3629
|
+
emptyValues: new Set(["", null, void 0]),
|
|
3630
|
+
defaultOperator: "eq",
|
|
3631
|
+
operators: [
|
|
3632
|
+
{
|
|
3633
|
+
name: "eq",
|
|
3634
|
+
fn: ({ currentValue, filterValue, emptyValues }) => {
|
|
3635
|
+
if (emptyValues.has(currentValue) || emptyValues.has(filterValue)) {
|
|
3636
|
+
return true;
|
|
3637
|
+
}
|
|
3638
|
+
return currentValue == filterValue;
|
|
3639
|
+
}
|
|
3640
|
+
},
|
|
3641
|
+
{
|
|
3642
|
+
name: "between",
|
|
3643
|
+
fn: ({ currentValue, filterValue, emptyValues }) => {
|
|
3644
|
+
if (emptyValues.has(currentValue) || emptyValues.has(filterValue)) {
|
|
3645
|
+
return true;
|
|
3646
|
+
}
|
|
3647
|
+
const [min, max] = filterValue;
|
|
3648
|
+
return currentValue >= min && currentValue <= max;
|
|
3649
|
+
}
|
|
3650
|
+
}
|
|
3651
|
+
]
|
|
3652
|
+
}
|
|
3653
|
+
};
|
|
3654
|
+
return result;
|
|
3600
3655
|
}
|
|
3656
|
+
var defaultFilterTypes = getFilterTypes();
|
|
3601
3657
|
|
|
3602
|
-
// src/components/InfiniteTable/hooks/
|
|
3603
|
-
|
|
3604
|
-
const
|
|
3605
|
-
const
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
function InfiniteTableCellFn(props) {
|
|
3621
|
-
var _b, _c, _d, _e;
|
|
3622
|
-
const _a = props, {
|
|
3623
|
-
cssEllipsis = true,
|
|
3624
|
-
virtualized = true,
|
|
3625
|
-
skipColumnShifting = false,
|
|
3626
|
-
offsetProperty = "left",
|
|
3627
|
-
column,
|
|
3628
|
-
domRef,
|
|
3629
|
-
width,
|
|
3630
|
-
afterChildren,
|
|
3631
|
-
beforeChildren,
|
|
3632
|
-
offset,
|
|
3633
|
-
cellType,
|
|
3634
|
-
cssPosition: _cssPosition,
|
|
3635
|
-
renderChildren
|
|
3636
|
-
} = _a, domProps = __objRest(_a, [
|
|
3637
|
-
"cssEllipsis",
|
|
3638
|
-
"virtualized",
|
|
3639
|
-
"skipColumnShifting",
|
|
3640
|
-
"offsetProperty",
|
|
3641
|
-
"column",
|
|
3642
|
-
"domRef",
|
|
3643
|
-
"width",
|
|
3644
|
-
"afterChildren",
|
|
3645
|
-
"beforeChildren",
|
|
3646
|
-
"offset",
|
|
3647
|
-
"cellType",
|
|
3648
|
-
"cssPosition",
|
|
3649
|
-
"renderChildren"
|
|
3650
|
-
]);
|
|
3651
|
-
const children = renderChildren();
|
|
3652
|
-
const { columnShifts } = useInfiniteTableState();
|
|
3653
|
-
const shifting = !!columnShifts;
|
|
3654
|
-
const style = __spreadValues({
|
|
3655
|
-
width
|
|
3656
|
-
}, domProps.style);
|
|
3657
|
-
if (!skipColumnShifting && columnShifts && columnShifts[column.computedVisibleIndex]) {
|
|
3658
|
-
const shiftLeft = columnShifts[column.computedVisibleIndex] + (offset != null ? offset : 0);
|
|
3659
|
-
if (virtualized) {
|
|
3660
|
-
style.left = shiftLeft;
|
|
3661
|
-
} else {
|
|
3662
|
-
style.transform = `translate3d(${shiftLeft}px, 0px, 0px)`;
|
|
3663
|
-
}
|
|
3658
|
+
// src/components/InfiniteTable/hooks/useCellClassName.ts
|
|
3659
|
+
function useCellClassName(column, baseClasses, variants, extraFlags) {
|
|
3660
|
+
const result = [...baseClasses];
|
|
3661
|
+
const variantObject = {
|
|
3662
|
+
filtered: column.computedFiltered,
|
|
3663
|
+
first: column.computedFirst,
|
|
3664
|
+
last: column.computedLast,
|
|
3665
|
+
groupByField: !!column.groupByField,
|
|
3666
|
+
firstInCategory: column.computedFirstInCategory,
|
|
3667
|
+
lastInCategory: column.computedLastInCategory,
|
|
3668
|
+
pinned: column.computedPinned || false,
|
|
3669
|
+
dragging: extraFlags.dragging,
|
|
3670
|
+
zebra: extraFlags.zebra
|
|
3671
|
+
};
|
|
3672
|
+
const theVariant = variants(variantObject);
|
|
3673
|
+
result.push(theVariant);
|
|
3674
|
+
if (column.computedFirst) {
|
|
3675
|
+
result.push(...baseClasses.map((c) => `${c}--first`));
|
|
3664
3676
|
}
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
"data-column-id": column.id,
|
|
3668
|
-
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}` : ""),
|
|
3669
|
-
children: /* @__PURE__ */ createElement9(Fragment, null, beforeChildren, /* @__PURE__ */ createElement9("div", {
|
|
3670
|
-
className: `${InfiniteTableCellContentClassName} ${cssEllipsis ? cssEllipsisClassName : overflow.hidden}`
|
|
3671
|
-
}, children), afterChildren)
|
|
3672
|
-
});
|
|
3673
|
-
const RenderComponent = cellType === "body" ? (_d = column.components) == null ? void 0 : _d.ColumnCell : (_e = column.components) == null ? void 0 : _e.HeaderCell;
|
|
3674
|
-
if (RenderComponent) {
|
|
3675
|
-
return /* @__PURE__ */ createElement9(RenderComponent, __spreadValues({}, finalDOMProps));
|
|
3677
|
+
if (column.groupByField) {
|
|
3678
|
+
result.push(...baseClasses.map((c) => `${c}--group-column`));
|
|
3676
3679
|
}
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
}
|
|
3680
|
+
if (column.computedLast) {
|
|
3681
|
+
result.push(...baseClasses.map((c) => `${c}--last`));
|
|
3682
|
+
}
|
|
3683
|
+
if (column.computedFirstInCategory) {
|
|
3684
|
+
result.push(...baseClasses.map((c) => `${c}--first-in-category`));
|
|
3685
|
+
}
|
|
3686
|
+
if (column.computedLastInCategory) {
|
|
3687
|
+
result.push(...baseClasses.map((c) => `${c}--last-in-category`));
|
|
3688
|
+
}
|
|
3689
|
+
if (column.computedPinned) {
|
|
3690
|
+
result.push(...baseClasses.map((c) => `${c}--pinned-${column.computedPinned}`));
|
|
3691
|
+
} else {
|
|
3692
|
+
result.push(...baseClasses.map((c) => `${c}--unpinned`));
|
|
3693
|
+
}
|
|
3694
|
+
return result.filter(Boolean).join(" ");
|
|
3680
3695
|
}
|
|
3681
|
-
var InfiniteTableCell = memo5(InfiniteTableCellFn);
|
|
3682
3696
|
|
|
3683
3697
|
// src/components/InfiniteTable/hooks/useColumnPointerEvents.ts
|
|
3684
3698
|
var import_binary_search2 = __toModule(require_binary_search());
|
|
@@ -3690,10 +3704,22 @@ import {
|
|
|
3690
3704
|
} from "react";
|
|
3691
3705
|
|
|
3692
3706
|
// src/components/InfiniteTable/hooks/useInfiniteTable.ts
|
|
3693
|
-
import { useContext as
|
|
3707
|
+
import { useContext as useContext3 } from "react";
|
|
3708
|
+
|
|
3709
|
+
// src/components/InfiniteTable/InfiniteTableContext.ts
|
|
3710
|
+
import { createContext as createContext3 } from "react";
|
|
3711
|
+
var TableContext;
|
|
3712
|
+
function getInfiniteTableContext() {
|
|
3713
|
+
if (TableContext) {
|
|
3714
|
+
return TableContext;
|
|
3715
|
+
}
|
|
3716
|
+
return TableContext = createContext3(null);
|
|
3717
|
+
}
|
|
3718
|
+
|
|
3719
|
+
// src/components/InfiniteTable/hooks/useInfiniteTable.ts
|
|
3694
3720
|
var useInfiniteTable = () => {
|
|
3695
3721
|
const TableContext2 = getInfiniteTableContext();
|
|
3696
|
-
return
|
|
3722
|
+
return useContext3(TableContext2);
|
|
3697
3723
|
};
|
|
3698
3724
|
|
|
3699
3725
|
// src/components/InfiniteTable/utils/moveXatY.ts
|
|
@@ -3844,42 +3870,46 @@ var useColumnPointerEvents = ({
|
|
|
3844
3870
|
};
|
|
3845
3871
|
};
|
|
3846
3872
|
|
|
3847
|
-
// src/components/InfiniteTable/
|
|
3848
|
-
function
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3873
|
+
// src/components/InfiniteTable/utils/RenderHookComponent.tsx
|
|
3874
|
+
function RenderHookComponent(props) {
|
|
3875
|
+
var _a;
|
|
3876
|
+
return (_a = props.render(props.renderParam)) != null ? _a : null;
|
|
3877
|
+
}
|
|
3878
|
+
|
|
3879
|
+
// src/components/InfiniteTable/components/FilterEditors.tsx
|
|
3880
|
+
import React14 from "react";
|
|
3881
|
+
function getFilterEditors() {
|
|
3882
|
+
return {
|
|
3883
|
+
string: StringFilterEditor,
|
|
3884
|
+
number: NumberFilterEditor
|
|
3859
3885
|
};
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3886
|
+
}
|
|
3887
|
+
var defaultFilterEditors = getFilterEditors();
|
|
3888
|
+
function StringFilterEditor(props) {
|
|
3889
|
+
return /* @__PURE__ */ React14.createElement("input", {
|
|
3890
|
+
"aria-label": `Filter for ${props.ariaLabel}`,
|
|
3891
|
+
type: "text",
|
|
3892
|
+
value: props.filterValue,
|
|
3893
|
+
onChange: (event) => {
|
|
3894
|
+
props.onChange(event.target.value);
|
|
3895
|
+
},
|
|
3896
|
+
className: props.className
|
|
3897
|
+
});
|
|
3898
|
+
}
|
|
3899
|
+
function NumberFilterEditor(props) {
|
|
3900
|
+
return /* @__PURE__ */ React14.createElement("input", {
|
|
3901
|
+
"aria-label": `Filter for ${props.ariaLabel}`,
|
|
3902
|
+
type: "number",
|
|
3903
|
+
value: props.filterValue,
|
|
3904
|
+
onChange: (event) => {
|
|
3905
|
+
let value = event.target.value;
|
|
3906
|
+
if (!isNaN(value + "")) {
|
|
3907
|
+
value = value + "";
|
|
3908
|
+
}
|
|
3909
|
+
props.onChange(value);
|
|
3910
|
+
},
|
|
3911
|
+
className: props.className
|
|
3912
|
+
});
|
|
3883
3913
|
}
|
|
3884
3914
|
|
|
3885
3915
|
// src/components/InfiniteTable/components/icons/SortIcon.tsx
|
|
@@ -3887,6 +3917,24 @@ import {
|
|
|
3887
3917
|
createElement as createElement10
|
|
3888
3918
|
} from "react";
|
|
3889
3919
|
import { useEffect as useEffect7, useState as useState5 } from "react";
|
|
3920
|
+
|
|
3921
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts
|
|
3922
|
+
var import_createRuntimeFn = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
3923
|
+
var CellCls = "_1eexc2a5 _16lm1iwl _16lm1iw12 _16lm1iw13 _16lm1iw2 _16lm1iw1b _16lm1iw1c";
|
|
3924
|
+
var HeaderCellContentRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_12zfob115 _16lm1iwq _16lm1iws _16lm1iwl _16lm1iw12 _16lm1iw13", variantClassNames: { filtered: { false: "_12zfob116", true: "_12zfob117" } }, defaultVariants: {}, compoundVariants: [] });
|
|
3925
|
+
var HeaderCellProxy = "_12zfob10";
|
|
3926
|
+
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"]] });
|
|
3927
|
+
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"]] });
|
|
3928
|
+
var HeaderFilterCls = "_12zfob11a _16lm1iwl _16lm1iw12 _16lm1iw13 _16lm1iw1";
|
|
3929
|
+
var HeaderFilterEditorCls = "_16lm1iws _16lm1iwq";
|
|
3930
|
+
var HeaderGroupCls = "_12zfob119 _16lm1iwl _16lm1iw12 _16lm1iw13";
|
|
3931
|
+
var HeaderScrollbarPlaceholderCls = "_12zfob16 _16lm1iw2";
|
|
3932
|
+
var HeaderSortIconCls = "_16lm1iw1";
|
|
3933
|
+
var HeaderSortIconIndexCls = "_12zfob15";
|
|
3934
|
+
var HeaderSortIconRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "", variantClassNames: { align: { start: "_12zfob12", center: "_12zfob13", end: "_12zfob14" } }, defaultVariants: {}, compoundVariants: [] });
|
|
3935
|
+
var HeaderWrapperCls = "_12zfob118 _16lm1iw18 _16lm1iw1 _16lm1iwl _16lm1iw12";
|
|
3936
|
+
|
|
3937
|
+
// src/components/InfiniteTable/components/icons/SortIcon.tsx
|
|
3890
3938
|
var defaultLineStyle = {
|
|
3891
3939
|
marginTop: 2,
|
|
3892
3940
|
marginBottom: 2,
|
|
@@ -3931,12 +3979,7 @@ function SortIcon(props) {
|
|
|
3931
3979
|
if (!rendered) {
|
|
3932
3980
|
return null;
|
|
3933
3981
|
}
|
|
3934
|
-
const indexStyle = {
|
|
3935
|
-
position: "absolute",
|
|
3936
|
-
transition: "top 0.2s",
|
|
3937
|
-
top: 0,
|
|
3938
|
-
right: 2
|
|
3939
|
-
};
|
|
3982
|
+
const indexStyle = {};
|
|
3940
3983
|
if (direction === -1) {
|
|
3941
3984
|
indexStyle.top = "100%";
|
|
3942
3985
|
}
|
|
@@ -3945,7 +3988,8 @@ function SortIcon(props) {
|
|
|
3945
3988
|
className: join(className, InfiniteTableIconClassName, `${InfiniteTableIconClassName}-sort`)
|
|
3946
3989
|
}, showIndex ? /* @__PURE__ */ createElement10("div", {
|
|
3947
3990
|
"data-name": "index",
|
|
3948
|
-
style: indexStyle
|
|
3991
|
+
style: indexStyle,
|
|
3992
|
+
className: HeaderSortIconIndexCls
|
|
3949
3993
|
}, index) : null, /* @__PURE__ */ createElement10("div", {
|
|
3950
3994
|
style: __spreadValues({ width: sizes[0] }, lineStyle),
|
|
3951
3995
|
onTransitionEnd
|
|
@@ -3956,32 +4000,166 @@ function SortIcon(props) {
|
|
|
3956
4000
|
}));
|
|
3957
4001
|
}
|
|
3958
4002
|
|
|
3959
|
-
// src/components/InfiniteTable/components/
|
|
4003
|
+
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
|
|
4004
|
+
import {
|
|
4005
|
+
Fragment,
|
|
4006
|
+
createElement as createElement11,
|
|
4007
|
+
memo as memo5
|
|
4008
|
+
} from "react";
|
|
4009
|
+
|
|
4010
|
+
// src/components/InfiniteTable/hooks/useInfiniteTableState.ts
|
|
4011
|
+
import { useContext as useContext4 } from "react";
|
|
4012
|
+
var useInfiniteTableState = () => {
|
|
4013
|
+
const TableContext2 = getInfiniteTableContext();
|
|
4014
|
+
const { componentState } = useContext4(TableContext2);
|
|
4015
|
+
return componentState;
|
|
4016
|
+
};
|
|
4017
|
+
|
|
4018
|
+
// src/components/InfiniteTable/components/cell.css.ts
|
|
3960
4019
|
var import_createRuntimeFn2 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
3961
|
-
var
|
|
3962
|
-
var
|
|
3963
|
-
var
|
|
3964
|
-
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"]] });
|
|
3965
|
-
var HeaderGroupCls = "_12zfob110 _16lm1iwl _16lm1iw12 _16lm1iw13";
|
|
3966
|
-
var HeaderScrollbarPlaceholderCls = "_12zfob12 _16lm1iw2";
|
|
3967
|
-
var HeaderSortIconCls = "_12zfob11 _16lm1iw1";
|
|
3968
|
-
var HeaderWrapperCls = "_12zfob1z _16lm1iw18 _16lm1iw1 _16lm1iwl _16lm1iw12";
|
|
4020
|
+
var CellClsVariants = { shifting: "_1eexc2a3", dragging: "_1eexc2a4" };
|
|
4021
|
+
var ColumnCellCls = "_1eexc2a5 _16lm1iwl _16lm1iw12 _16lm1iw13 _16lm1iw2 _16lm1iw1b _16lm1iw1c";
|
|
4022
|
+
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"]] });
|
|
3969
4023
|
|
|
3970
|
-
// src/components/InfiniteTable/
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
4024
|
+
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
|
|
4025
|
+
var { rootClassName: rootClassName3 } = internalProps;
|
|
4026
|
+
var InfiniteTableCellClassName = `${rootClassName3}Cell`;
|
|
4027
|
+
var InfiniteTableCellContentClassName = `${rootClassName3}Cell_content`;
|
|
4028
|
+
function InfiniteTableCellFn(props) {
|
|
4029
|
+
var _b, _c, _d;
|
|
4030
|
+
const _a = props, {
|
|
4031
|
+
cssEllipsis = true,
|
|
4032
|
+
virtualized = true,
|
|
4033
|
+
skipColumnShifting = false,
|
|
4034
|
+
offsetProperty = "left",
|
|
4035
|
+
contentStyle,
|
|
4036
|
+
column,
|
|
4037
|
+
domRef,
|
|
4038
|
+
width,
|
|
4039
|
+
contentClassName,
|
|
4040
|
+
afterChildren,
|
|
4041
|
+
beforeChildren,
|
|
4042
|
+
offset,
|
|
4043
|
+
cellType,
|
|
4044
|
+
cssPosition: _cssPosition,
|
|
4045
|
+
renderChildren
|
|
4046
|
+
} = _a, domProps = __objRest(_a, [
|
|
4047
|
+
"cssEllipsis",
|
|
4048
|
+
"virtualized",
|
|
4049
|
+
"skipColumnShifting",
|
|
4050
|
+
"offsetProperty",
|
|
4051
|
+
"contentStyle",
|
|
4052
|
+
"column",
|
|
4053
|
+
"domRef",
|
|
4054
|
+
"width",
|
|
4055
|
+
"contentClassName",
|
|
4056
|
+
"afterChildren",
|
|
4057
|
+
"beforeChildren",
|
|
4058
|
+
"offset",
|
|
4059
|
+
"cellType",
|
|
4060
|
+
"cssPosition",
|
|
4061
|
+
"renderChildren"
|
|
4062
|
+
]);
|
|
4063
|
+
const children = renderChildren();
|
|
4064
|
+
const { columnShifts } = useInfiniteTableState();
|
|
4065
|
+
const shifting = !!columnShifts;
|
|
4066
|
+
const style = __spreadValues({
|
|
4067
|
+
width
|
|
4068
|
+
}, domProps.style);
|
|
4069
|
+
if (!skipColumnShifting && columnShifts && columnShifts[column.computedVisibleIndex]) {
|
|
4070
|
+
const shiftLeft = columnShifts[column.computedVisibleIndex] + (offset != null ? offset : 0);
|
|
4071
|
+
if (virtualized) {
|
|
4072
|
+
style.left = shiftLeft;
|
|
4073
|
+
} else {
|
|
4074
|
+
style.transform = `translate3d(${shiftLeft}px, 0px, 0px)`;
|
|
4075
|
+
}
|
|
4076
|
+
}
|
|
4077
|
+
const finalDOMProps = __spreadProps(__spreadValues({}, domProps), {
|
|
4078
|
+
style,
|
|
4079
|
+
"data-column-id": column.id,
|
|
4080
|
+
className: join(domProps.className, justifyContent[(_b = column.align) != null ? _b : "start"], InfiniteTableCellClassName, ColumnCellCls, shifting ? `${InfiniteTableCellClassName}--shifting ${CellClsVariants.shifting}` : ""),
|
|
4081
|
+
children: /* @__PURE__ */ createElement11(Fragment, null, beforeChildren, /* @__PURE__ */ createElement11("div", {
|
|
4082
|
+
className: join(InfiniteTableCellContentClassName, cssEllipsis ? cssEllipsisClassName : overflow.hidden, contentClassName),
|
|
4083
|
+
style: contentStyle
|
|
4084
|
+
}, children), afterChildren)
|
|
4085
|
+
});
|
|
4086
|
+
const RenderComponent = cellType === "body" ? (_c = column.components) == null ? void 0 : _c.ColumnCell : (_d = column.components) == null ? void 0 : _d.HeaderCell;
|
|
4087
|
+
if (RenderComponent) {
|
|
4088
|
+
return /* @__PURE__ */ createElement11(RenderComponent, __spreadValues({}, finalDOMProps));
|
|
4089
|
+
}
|
|
4090
|
+
return /* @__PURE__ */ createElement11("div", __spreadProps(__spreadValues({}, finalDOMProps), {
|
|
4091
|
+
ref: domRef
|
|
4092
|
+
}));
|
|
4093
|
+
}
|
|
4094
|
+
var InfiniteTableCell = memo5(InfiniteTableCellFn);
|
|
4095
|
+
|
|
4096
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableColumnHeaderFilter.tsx
|
|
4097
|
+
import {
|
|
4098
|
+
createElement as createElement12
|
|
4099
|
+
} from "react";
|
|
4100
|
+
import { useEffect as useEffect8, useState as useState6 } from "react";
|
|
4101
|
+
var { rootClassName: rootClassName4 } = internalProps;
|
|
4102
|
+
var InfiniteTableColumnHeaderFilterClassName = `${rootClassName4}HeaderCell__filter`;
|
|
4103
|
+
var stopPropagation = (e) => e.stopPropagation();
|
|
4104
|
+
function InfiniteTableColumnHeaderFilter(props) {
|
|
4105
|
+
var _a, _b, _c, _d;
|
|
4106
|
+
const [theValue, setTheValue] = useState6((_b = (_a = props.columnFilterValue) == null ? void 0 : _a.filterValue) != null ? _b : "");
|
|
4107
|
+
const onInputChange = (filterValue) => {
|
|
4108
|
+
setTheValue(filterValue);
|
|
4109
|
+
props.onChange(filterValue);
|
|
4110
|
+
};
|
|
4111
|
+
useEffect8(() => {
|
|
4112
|
+
var _a2;
|
|
4113
|
+
if (props.columnFilterValue) {
|
|
4114
|
+
if (theValue !== props.columnFilterValue.filterValue) {
|
|
4115
|
+
setTheValue(props.columnFilterValue.filterValue);
|
|
4116
|
+
}
|
|
4117
|
+
} else {
|
|
4118
|
+
const currentFilterType = props.filterTypes[(_a2 = props.columnFilterType) != null ? _a2 : "string"];
|
|
4119
|
+
if (currentFilterType) {
|
|
4120
|
+
const emptyValue = [...currentFilterType.emptyValues][0];
|
|
4121
|
+
if (emptyValue !== theValue) {
|
|
4122
|
+
setTheValue(emptyValue);
|
|
4123
|
+
}
|
|
4124
|
+
}
|
|
4125
|
+
}
|
|
4126
|
+
}, [(_c = props.columnFilterValue) == null ? void 0 : _c.filterValue]);
|
|
4127
|
+
const filterType = props.columnFilterValue ? props.columnFilterValue.filterType : (_d = props.columnFilterType) != null ? _d : "string";
|
|
4128
|
+
const operator = props.columnFilterValue ? props.columnFilterValue.operator : props.filterTypes[filterType] ? props.filterTypes[filterType].defaultOperator : props.filterTypes.string.defaultOperator;
|
|
4129
|
+
const filterEditorProps = {
|
|
4130
|
+
ariaLabel: `Filter for ${props.columnLabel}`,
|
|
4131
|
+
filterValue: theValue,
|
|
4132
|
+
className: HeaderFilterEditorCls,
|
|
4133
|
+
operator,
|
|
4134
|
+
filterType,
|
|
4135
|
+
onChange: onInputChange
|
|
4136
|
+
};
|
|
4137
|
+
const FilterEditor = props.filterEditor;
|
|
4138
|
+
return /* @__PURE__ */ createElement12("div", {
|
|
4139
|
+
onPointerUp: stopPropagation,
|
|
4140
|
+
onPointerDown: stopPropagation,
|
|
4141
|
+
className: `${InfiniteTableColumnHeaderFilterClassName} ${HeaderFilterCls}`,
|
|
4142
|
+
style: { height: props.columnHeaderHeight }
|
|
4143
|
+
}, FilterEditor ? /* @__PURE__ */ createElement12(FilterEditor, __spreadValues({}, filterEditorProps)) : null);
|
|
4144
|
+
}
|
|
4145
|
+
function InfiniteTableColumnHeaderFilterEmpty() {
|
|
4146
|
+
return /* @__PURE__ */ createElement12("div", {
|
|
4147
|
+
onPointerUp: stopPropagation,
|
|
4148
|
+
onPointerDown: stopPropagation,
|
|
4149
|
+
className: `${InfiniteTableColumnHeaderFilterClassName} ${HeaderFilterCls}`,
|
|
4150
|
+
style: { height: "100%" }
|
|
4151
|
+
});
|
|
3974
4152
|
}
|
|
3975
4153
|
|
|
3976
4154
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
|
|
3977
4155
|
var InfiniteTableHeaderCellContext = createContext4(null);
|
|
3978
|
-
var { rootClassName:
|
|
3979
|
-
var InfiniteTableHeaderCellClassName = `${
|
|
4156
|
+
var { rootClassName: rootClassName5 } = internalProps;
|
|
4157
|
+
var InfiniteTableHeaderCellClassName = `${rootClassName5}HeaderCell`;
|
|
3980
4158
|
function InfiniteTableHeaderCell(props) {
|
|
3981
|
-
var _a, _b, _c, _d;
|
|
4159
|
+
var _a, _b, _c, _d, _e;
|
|
3982
4160
|
const column = props.column;
|
|
3983
4161
|
const columns = props.columns;
|
|
3984
|
-
const { onResize, height, width } = props;
|
|
4162
|
+
const { onResize, height, width, headerOptions } = props;
|
|
3985
4163
|
const sortInfo = column.computedSortInfo;
|
|
3986
4164
|
let header = column.header;
|
|
3987
4165
|
const ref = useCallback6((node) => {
|
|
@@ -3989,33 +4167,43 @@ function InfiniteTableHeaderCell(props) {
|
|
|
3989
4167
|
domRef.current = node;
|
|
3990
4168
|
(_a2 = props.domRef) == null ? void 0 : _a2.call(props, node);
|
|
3991
4169
|
}, [props.domRef]);
|
|
3992
|
-
const
|
|
4170
|
+
const alwaysShow = headerOptions.alwaysReserveSpaceForSortIcon;
|
|
4171
|
+
const sortTool = column.computedSorted || alwaysShow ? /* @__PURE__ */ createElement13(SortIcon, {
|
|
3993
4172
|
index: column.computedMultiSort ? column.computedSortIndex + 1 : void 0,
|
|
3994
|
-
className: `${InfiniteTableHeaderCellClassName}__sort-icon ${HeaderSortIconCls}
|
|
4173
|
+
className: `${InfiniteTableHeaderCellClassName}__sort-icon ${HeaderSortIconCls} ${HeaderSortIconRecipe({
|
|
4174
|
+
align: column.align || "start"
|
|
4175
|
+
})}`,
|
|
3995
4176
|
direction: column.computedSorted ? column.computedSortedAsc ? 1 : -1 : 0
|
|
3996
|
-
});
|
|
4177
|
+
}) : null;
|
|
3997
4178
|
const renderParam = {
|
|
3998
4179
|
domRef: ref,
|
|
3999
4180
|
column,
|
|
4000
4181
|
columnSortInfo: sortInfo,
|
|
4182
|
+
columnFilterValue: column.computedFilterValue,
|
|
4001
4183
|
sortTool
|
|
4002
4184
|
};
|
|
4185
|
+
const align = column.align || "start";
|
|
4003
4186
|
const renderChildren = () => {
|
|
4004
4187
|
if (header instanceof Function) {
|
|
4005
|
-
header = /* @__PURE__ */
|
|
4188
|
+
header = /* @__PURE__ */ createElement13(RenderHookComponent, {
|
|
4006
4189
|
render: header,
|
|
4007
4190
|
renderParam
|
|
4008
4191
|
});
|
|
4009
4192
|
}
|
|
4010
4193
|
header = header != null ? header : column.name;
|
|
4011
|
-
return header;
|
|
4194
|
+
return /* @__PURE__ */ createElement13(Fragment2, null, align === "end" ? sortTool : null, header, align !== "end" ? sortTool : null);
|
|
4012
4195
|
};
|
|
4013
4196
|
const domRef = useRef10(null);
|
|
4014
4197
|
const {
|
|
4015
|
-
computed: { computedRemainingSpace },
|
|
4016
|
-
componentState: { portalDOMRef }
|
|
4198
|
+
computed: { computedRemainingSpace, showColumnFilters },
|
|
4199
|
+
componentState: { portalDOMRef, columnHeaderHeight, filterEditors }
|
|
4017
4200
|
} = useInfiniteTable();
|
|
4018
|
-
|
|
4201
|
+
const {
|
|
4202
|
+
componentActions: dataSourceActions,
|
|
4203
|
+
getState: getDataSourceState,
|
|
4204
|
+
componentState: { filterDelay, filterTypes }
|
|
4205
|
+
} = useDataSourceContextValue();
|
|
4206
|
+
useEffect9(() => {
|
|
4019
4207
|
let clearOnResize = null;
|
|
4020
4208
|
const node = domRef.current;
|
|
4021
4209
|
if (onResize && node) {
|
|
@@ -4036,7 +4224,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4036
4224
|
});
|
|
4037
4225
|
let draggingProxy = null;
|
|
4038
4226
|
if (dragging) {
|
|
4039
|
-
draggingProxy = /* @__PURE__ */
|
|
4227
|
+
draggingProxy = /* @__PURE__ */ createElement13("div", {
|
|
4040
4228
|
className: `${InfiniteTableHeaderCellClassName}Proxy ${HeaderCellProxy}`,
|
|
4041
4229
|
style: {
|
|
4042
4230
|
position: "absolute",
|
|
@@ -4050,9 +4238,73 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4050
4238
|
draggingProxy = createPortal(draggingProxy, portalDOMRef.current);
|
|
4051
4239
|
}
|
|
4052
4240
|
const ContextProvider = InfiniteTableHeaderCellContext.Provider;
|
|
4053
|
-
|
|
4241
|
+
const contentRecipeVariants = {
|
|
4242
|
+
filtered: column.computedFiltered
|
|
4243
|
+
};
|
|
4244
|
+
const setFilterValue = useCallback6((filterValue) => {
|
|
4245
|
+
var _a2;
|
|
4246
|
+
const state = getDataSourceState();
|
|
4247
|
+
let newFilterValue = (_a2 = state.filterValue) != null ? _a2 : [];
|
|
4248
|
+
let found = false;
|
|
4249
|
+
newFilterValue = newFilterValue.map((currentFilterValue) => {
|
|
4250
|
+
if (filterValue.id && currentFilterValue.id === filterValue.id || filterValue.field && currentFilterValue.field === column.field) {
|
|
4251
|
+
found = true;
|
|
4252
|
+
return filterValue;
|
|
4253
|
+
}
|
|
4254
|
+
return currentFilterValue;
|
|
4255
|
+
});
|
|
4256
|
+
if (!found) {
|
|
4257
|
+
newFilterValue.push(filterValue);
|
|
4258
|
+
}
|
|
4259
|
+
newFilterValue = newFilterValue.filter((filterValue2) => {
|
|
4260
|
+
const filterType2 = filterTypes[filterValue2.filterType];
|
|
4261
|
+
if (!filterType2 || filterType2.emptyValues.has(filterValue2.filterValue)) {
|
|
4262
|
+
return false;
|
|
4263
|
+
}
|
|
4264
|
+
return true;
|
|
4265
|
+
});
|
|
4266
|
+
dataSourceActions.filterValue = newFilterValue;
|
|
4267
|
+
}, [column, filterTypes]);
|
|
4268
|
+
const debouncedOnFilterValueChange = useMemo5(() => {
|
|
4269
|
+
const fn = (filterValue) => {
|
|
4270
|
+
let newFilterValueForColumn;
|
|
4271
|
+
if (column.computedFilterValue) {
|
|
4272
|
+
newFilterValueForColumn = __spreadValues({}, column.computedFilterValue);
|
|
4273
|
+
} else {
|
|
4274
|
+
const filterType2 = column.computedFilterType;
|
|
4275
|
+
const filterValueForColumn = {
|
|
4276
|
+
filterType: filterType2,
|
|
4277
|
+
operator: filterTypes[filterType2].defaultOperator,
|
|
4278
|
+
filterValue,
|
|
4279
|
+
valueGetter: column.valueGetter
|
|
4280
|
+
};
|
|
4281
|
+
if (column.field) {
|
|
4282
|
+
filterValueForColumn.field = column.field;
|
|
4283
|
+
} else {
|
|
4284
|
+
filterValueForColumn.id = column.id;
|
|
4285
|
+
}
|
|
4286
|
+
newFilterValueForColumn = filterValueForColumn;
|
|
4287
|
+
}
|
|
4288
|
+
newFilterValueForColumn.filterValue = filterValue;
|
|
4289
|
+
setFilterValue(newFilterValueForColumn);
|
|
4290
|
+
};
|
|
4291
|
+
if (filterDelay > 0) {
|
|
4292
|
+
return debounce(fn, { wait: filterDelay });
|
|
4293
|
+
}
|
|
4294
|
+
return fn;
|
|
4295
|
+
}, [
|
|
4296
|
+
filterDelay,
|
|
4297
|
+
setFilterValue,
|
|
4298
|
+
column.computedFilterValue,
|
|
4299
|
+
column.id,
|
|
4300
|
+
column.field,
|
|
4301
|
+
column.computedFilterType
|
|
4302
|
+
]);
|
|
4303
|
+
const filterType = column.computedFilterType;
|
|
4304
|
+
const FilterEditor = filterEditors[filterType] || defaultFilterEditors[filterType] || StringFilterEditor;
|
|
4305
|
+
return /* @__PURE__ */ createElement13(ContextProvider, {
|
|
4054
4306
|
value: renderParam
|
|
4055
|
-
}, /* @__PURE__ */
|
|
4307
|
+
}, /* @__PURE__ */ createElement13(InfiniteTableCell, {
|
|
4056
4308
|
domRef: ref,
|
|
4057
4309
|
cellType: "header",
|
|
4058
4310
|
column,
|
|
@@ -4062,9 +4314,19 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4062
4314
|
width,
|
|
4063
4315
|
onPointerDown,
|
|
4064
4316
|
onPointerUp,
|
|
4317
|
+
contentClassName: join(HeaderCellContentRecipe(contentRecipeVariants), justifyContent[(_c = column.align) != null ? _c : "start"]),
|
|
4318
|
+
contentStyle: showColumnFilters ? { height: height / 2 } : void 0,
|
|
4065
4319
|
className: join(InfiniteTableHeaderCellClassName, userSelect.none, column.computedSortable ? cursor.pointer : "", useCellClassName(column, [InfiniteTableHeaderCellClassName, InfiniteTableCellClassName], HeaderCellRecipe, { dragging, zebra: false }), CellCls),
|
|
4066
|
-
cssEllipsis: (
|
|
4067
|
-
afterChildren:
|
|
4320
|
+
cssEllipsis: (_e = (_d = column.headerCssEllipsis) != null ? _d : column.cssEllipsis) != null ? _e : true,
|
|
4321
|
+
afterChildren: showColumnFilters ? column.computedFilterable ? /* @__PURE__ */ createElement13(InfiniteTableColumnHeaderFilter, {
|
|
4322
|
+
filterEditor: FilterEditor,
|
|
4323
|
+
filterTypes,
|
|
4324
|
+
onChange: debouncedOnFilterValueChange,
|
|
4325
|
+
columnFilterType: filterType,
|
|
4326
|
+
columnLabel: column.field || column.name || column.id,
|
|
4327
|
+
columnFilterValue: column.computedFilterValue,
|
|
4328
|
+
columnHeaderHeight
|
|
4329
|
+
}) : /* @__PURE__ */ createElement13(InfiniteTableColumnHeaderFilterEmpty, null) : null,
|
|
4068
4330
|
renderChildren
|
|
4069
4331
|
}), draggingProxy);
|
|
4070
4332
|
}
|
|
@@ -4075,9 +4337,9 @@ function useInfiniteHeaderCell() {
|
|
|
4075
4337
|
|
|
4076
4338
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx
|
|
4077
4339
|
import {
|
|
4078
|
-
createElement as
|
|
4340
|
+
createElement as createElement16,
|
|
4079
4341
|
useCallback as useCallback8,
|
|
4080
|
-
useMemo as
|
|
4342
|
+
useMemo as useMemo6
|
|
4081
4343
|
} from "react";
|
|
4082
4344
|
|
|
4083
4345
|
// src/components/utils/getScrollbarWidth.ts
|
|
@@ -4201,14 +4463,14 @@ function assignGroupOffsetsAndComputedWidths(items, groupOffset = 0) {
|
|
|
4201
4463
|
|
|
4202
4464
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
|
|
4203
4465
|
import {
|
|
4204
|
-
createElement as
|
|
4466
|
+
createElement as createElement15,
|
|
4205
4467
|
memo as memo6
|
|
4206
4468
|
} from "react";
|
|
4207
|
-
import { useCallback as useCallback7, useEffect as
|
|
4469
|
+
import { useCallback as useCallback7, useEffect as useEffect10, useRef as useRef11 } from "react";
|
|
4208
4470
|
|
|
4209
4471
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderGroup.tsx
|
|
4210
4472
|
import {
|
|
4211
|
-
createElement as
|
|
4473
|
+
createElement as createElement14
|
|
4212
4474
|
} from "react";
|
|
4213
4475
|
var TableHeaderGroupClassName = `${rootClassName2}HeaderGroup`;
|
|
4214
4476
|
function InfiniteTableHeaderGroup(props) {
|
|
@@ -4219,35 +4481,35 @@ function InfiniteTableHeaderGroup(props) {
|
|
|
4219
4481
|
columnGroup
|
|
4220
4482
|
});
|
|
4221
4483
|
}
|
|
4222
|
-
return /* @__PURE__ */
|
|
4484
|
+
return /* @__PURE__ */ createElement14("div", {
|
|
4223
4485
|
ref: props.domRef,
|
|
4224
4486
|
"data-group-id": columnGroup.uniqueGroupId,
|
|
4225
4487
|
className: join(HeaderGroupCls, TableHeaderGroupClassName),
|
|
4226
4488
|
style: { width, height }
|
|
4227
|
-
}, /* @__PURE__ */
|
|
4489
|
+
}, /* @__PURE__ */ createElement14("div", {
|
|
4228
4490
|
className: join(`${TableHeaderGroupClassName}__header-content`, cssEllipsisClassName)
|
|
4229
4491
|
}, header));
|
|
4230
4492
|
}
|
|
4231
4493
|
|
|
4232
4494
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
|
|
4233
|
-
var { rootClassName:
|
|
4234
|
-
var TableHeaderClassName = `${
|
|
4495
|
+
var { rootClassName: rootClassName6 } = internalProps;
|
|
4496
|
+
var TableHeaderClassName = `${rootClassName6}Header`;
|
|
4235
4497
|
function InfiniteTableHeaderFn(props) {
|
|
4236
4498
|
const {
|
|
4237
4499
|
brain,
|
|
4238
4500
|
columns,
|
|
4239
4501
|
style,
|
|
4240
4502
|
className,
|
|
4241
|
-
|
|
4503
|
+
columnHeaderHeight,
|
|
4242
4504
|
columnAndGroupTreeInfo,
|
|
4243
4505
|
columnGroupsMaxDepth
|
|
4244
4506
|
} = props;
|
|
4245
4507
|
const {
|
|
4246
4508
|
computed,
|
|
4247
|
-
componentState: { headerBrain }
|
|
4509
|
+
componentState: { headerBrain, headerOptions }
|
|
4248
4510
|
} = useInfiniteTable();
|
|
4249
|
-
const { computedVisibleColumnsMap } = computed;
|
|
4250
|
-
|
|
4511
|
+
const { computedVisibleColumnsMap, showColumnFilters } = computed;
|
|
4512
|
+
useEffect10(() => {
|
|
4251
4513
|
const onScroll = (scrollPosition) => {
|
|
4252
4514
|
if (domRef.current) {
|
|
4253
4515
|
domRef.current.style.transform = `translate3d(-${scrollPosition.scrollLeft}px, 0px, 0px)`;
|
|
@@ -4264,7 +4526,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4264
4526
|
const domProps = {
|
|
4265
4527
|
ref: domRef,
|
|
4266
4528
|
className: join(TableHeaderClassName, `${TableHeaderClassName}--virtualized`, className, headerCls),
|
|
4267
|
-
style: __spreadProps(__spreadValues({}, style), { height:
|
|
4529
|
+
style: __spreadProps(__spreadValues({}, style), { height: columnHeaderHeight })
|
|
4268
4530
|
};
|
|
4269
4531
|
const renderCell = useCallback7((params) => {
|
|
4270
4532
|
const {
|
|
@@ -4291,7 +4553,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4291
4553
|
computedWidth: colGroupItem.computedWidth,
|
|
4292
4554
|
groupOffset: colGroupItem.groupOffset
|
|
4293
4555
|
});
|
|
4294
|
-
return /* @__PURE__ */
|
|
4556
|
+
return /* @__PURE__ */ createElement15(InfiniteTableHeaderGroup, {
|
|
4295
4557
|
domRef: domRef2,
|
|
4296
4558
|
columns: columns2,
|
|
4297
4559
|
width: widthWithColspan,
|
|
@@ -4299,15 +4561,23 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4299
4561
|
columnGroup: computedColumnGroup
|
|
4300
4562
|
});
|
|
4301
4563
|
}
|
|
4302
|
-
return /* @__PURE__ */
|
|
4564
|
+
return /* @__PURE__ */ createElement15(InfiniteTableHeaderCell, {
|
|
4303
4565
|
domRef: domRef2,
|
|
4304
4566
|
column,
|
|
4567
|
+
headerOptions,
|
|
4305
4568
|
width: widthWithColspan,
|
|
4306
4569
|
height: heightWithRowspan,
|
|
4307
4570
|
columns: computedVisibleColumnsMap
|
|
4308
4571
|
});
|
|
4309
|
-
}, [
|
|
4310
|
-
|
|
4572
|
+
}, [
|
|
4573
|
+
headerOptions,
|
|
4574
|
+
columns,
|
|
4575
|
+
columnHeaderHeight,
|
|
4576
|
+
columnAndGroupTreeInfo,
|
|
4577
|
+
columnGroupsMaxDepth,
|
|
4578
|
+
showColumnFilters
|
|
4579
|
+
]);
|
|
4580
|
+
return /* @__PURE__ */ createElement15("div", __spreadValues({}, domProps), /* @__PURE__ */ createElement15(RawTable, {
|
|
4311
4581
|
renderCell,
|
|
4312
4582
|
brain: headerBrain,
|
|
4313
4583
|
cellHoverClassNames: []
|
|
@@ -4323,19 +4593,20 @@ function TableHeaderWrapper(props) {
|
|
|
4323
4593
|
computedPinnedStartColumns,
|
|
4324
4594
|
computedPinnedEndColumns,
|
|
4325
4595
|
computedVisibleColumns,
|
|
4326
|
-
columnSize
|
|
4596
|
+
columnSize,
|
|
4597
|
+
showColumnFilters
|
|
4327
4598
|
} = tableContextValue.computed;
|
|
4328
4599
|
const {
|
|
4329
4600
|
componentState: {
|
|
4330
|
-
|
|
4601
|
+
columnHeaderHeight,
|
|
4331
4602
|
columnGroupsDepthsMap,
|
|
4332
4603
|
columnGroupsMaxDepth,
|
|
4333
4604
|
computedColumnGroups
|
|
4334
4605
|
}
|
|
4335
4606
|
} = tableContextValue;
|
|
4336
4607
|
const rows = !computedColumnGroups || !computedColumnGroups.size ? 1 : columnGroupsMaxDepth + 2;
|
|
4337
|
-
const height = rows *
|
|
4338
|
-
const columnAndGroupTreeInfo =
|
|
4608
|
+
const height = rows * columnHeaderHeight + (showColumnFilters ? columnHeaderHeight : 0);
|
|
4609
|
+
const columnAndGroupTreeInfo = useMemo6(() => {
|
|
4339
4610
|
if (!computedColumnGroups || !computedColumnGroups.size) {
|
|
4340
4611
|
return void 0;
|
|
4341
4612
|
}
|
|
@@ -4376,9 +4647,12 @@ function TableHeaderWrapper(props) {
|
|
|
4376
4647
|
]);
|
|
4377
4648
|
const rowspan = useCallback8(({ rowIndex, colIndex }) => cellspan({ rowIndex, colIndex }).rowspan, [cellspan]);
|
|
4378
4649
|
const colspan = useCallback8(({ rowIndex, colIndex }) => cellspan({ rowIndex, colIndex }).colspan, [cellspan]);
|
|
4650
|
+
const rowHeight = useCallback8((index) => {
|
|
4651
|
+
return showColumnFilters ? index < rows - 1 ? columnHeaderHeight : 2 * columnHeaderHeight : columnHeaderHeight;
|
|
4652
|
+
}, [rows, showColumnFilters, columnHeaderHeight]);
|
|
4379
4653
|
useMatrixBrain(brain, {
|
|
4380
4654
|
colWidth: columnSize,
|
|
4381
|
-
rowHeight
|
|
4655
|
+
rowHeight,
|
|
4382
4656
|
rows,
|
|
4383
4657
|
cols: computedVisibleColumns.length,
|
|
4384
4658
|
height,
|
|
@@ -4388,21 +4662,21 @@ function TableHeaderWrapper(props) {
|
|
|
4388
4662
|
fixedColsEnd: computedPinnedEndColumns.length,
|
|
4389
4663
|
fixedColsStart: computedPinnedStartColumns.length
|
|
4390
4664
|
});
|
|
4391
|
-
const header = /* @__PURE__ */
|
|
4665
|
+
const header = /* @__PURE__ */ createElement16(InfiniteTableHeader, {
|
|
4392
4666
|
columns: computedVisibleColumns,
|
|
4393
4667
|
brain,
|
|
4394
|
-
|
|
4668
|
+
columnHeaderHeight: height,
|
|
4395
4669
|
columnGroupsMaxDepth,
|
|
4396
4670
|
columnAndGroupTreeInfo
|
|
4397
4671
|
});
|
|
4398
|
-
const verticalScrollbarPlaceholder = scrollbars.vertical && getScrollbarWidth() ? /* @__PURE__ */
|
|
4672
|
+
const verticalScrollbarPlaceholder = scrollbars.vertical && getScrollbarWidth() ? /* @__PURE__ */ createElement16("div", {
|
|
4399
4673
|
className: HeaderScrollbarPlaceholderCls,
|
|
4400
4674
|
style: {
|
|
4401
4675
|
zIndex: 1e3,
|
|
4402
4676
|
width: getScrollbarWidth()
|
|
4403
4677
|
}
|
|
4404
4678
|
}) : null;
|
|
4405
|
-
return /* @__PURE__ */
|
|
4679
|
+
return /* @__PURE__ */ createElement16("div", {
|
|
4406
4680
|
className: HeaderWrapperCls,
|
|
4407
4681
|
style: {
|
|
4408
4682
|
height
|
|
@@ -4412,12 +4686,12 @@ function TableHeaderWrapper(props) {
|
|
|
4412
4686
|
|
|
4413
4687
|
// src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
|
|
4414
4688
|
import {
|
|
4415
|
-
createElement as
|
|
4416
|
-
forwardRef as
|
|
4689
|
+
createElement as createElement17,
|
|
4690
|
+
forwardRef as forwardRef4,
|
|
4417
4691
|
useCallback as useCallback9,
|
|
4418
4692
|
useRef as useRef12
|
|
4419
4693
|
} from "react";
|
|
4420
|
-
import { useEffect as
|
|
4694
|
+
import { useEffect as useEffect11 } from "react";
|
|
4421
4695
|
|
|
4422
4696
|
// src/components/utils/decamelize.ts
|
|
4423
4697
|
function decamelize(str, options) {
|
|
@@ -4426,7 +4700,7 @@ function decamelize(str, options) {
|
|
|
4426
4700
|
}
|
|
4427
4701
|
|
|
4428
4702
|
// src/components/InfiniteTable/theme.css.ts
|
|
4429
|
-
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)",
|
|
4703
|
+
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)" } } };
|
|
4430
4704
|
|
|
4431
4705
|
// src/components/InfiniteTable/InfiniteCls.css.ts
|
|
4432
4706
|
var import_createRuntimeFn3 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
@@ -4463,8 +4737,8 @@ var enforceStyle = (node, style) => {
|
|
|
4463
4737
|
node.style.setProperty(decamelize(propertyName), propertyValue, "important");
|
|
4464
4738
|
}
|
|
4465
4739
|
};
|
|
4466
|
-
var InfiniteTableLicenseFooter =
|
|
4467
|
-
const { rootClassName:
|
|
4740
|
+
var InfiniteTableLicenseFooter = forwardRef4(function InfiniteTableLicenseFooter2(props, ref) {
|
|
4741
|
+
const { rootClassName: rootClassName9 } = useInternalProps();
|
|
4468
4742
|
const domRef = useRef12(null);
|
|
4469
4743
|
const domCallback = useCallback9((node) => {
|
|
4470
4744
|
domRef.current = node;
|
|
@@ -4477,7 +4751,7 @@ var InfiniteTableLicenseFooter = forwardRef3(function InfiniteTableLicenseFooter
|
|
|
4477
4751
|
ref.current = node;
|
|
4478
4752
|
}
|
|
4479
4753
|
}, []);
|
|
4480
|
-
|
|
4754
|
+
useEffect11(() => {
|
|
4481
4755
|
const forceStyle = () => {
|
|
4482
4756
|
requestAnimationFrame(() => {
|
|
4483
4757
|
var _a;
|
|
@@ -4491,12 +4765,12 @@ var InfiniteTableLicenseFooter = forwardRef3(function InfiniteTableLicenseFooter
|
|
|
4491
4765
|
clearInterval(intervalId);
|
|
4492
4766
|
};
|
|
4493
4767
|
}, []);
|
|
4494
|
-
return /* @__PURE__ */
|
|
4768
|
+
return /* @__PURE__ */ createElement17("div", __spreadProps(__spreadValues({
|
|
4495
4769
|
ref: domCallback
|
|
4496
4770
|
}, props), {
|
|
4497
|
-
className: join(`${
|
|
4771
|
+
className: join(`${rootClassName9}-Footer`, FooterCls, props.className),
|
|
4498
4772
|
style: defaultStyle
|
|
4499
|
-
}), "Powered by", " ", /* @__PURE__ */
|
|
4773
|
+
}), "Powered by", " ", /* @__PURE__ */ createElement17("a", {
|
|
4500
4774
|
href: "https://infinite-table.com",
|
|
4501
4775
|
rel: "noopener noreferrer",
|
|
4502
4776
|
role: "link",
|
|
@@ -4507,13 +4781,13 @@ var InfiniteTableLicenseFooter = forwardRef3(function InfiniteTableLicenseFooter
|
|
|
4507
4781
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableColumnCell.tsx
|
|
4508
4782
|
import {
|
|
4509
4783
|
createContext as createContext5,
|
|
4510
|
-
createElement as
|
|
4784
|
+
createElement as createElement18,
|
|
4511
4785
|
memo as memo7
|
|
4512
4786
|
} from "react";
|
|
4513
4787
|
import { useContext as useContext6 } from "react";
|
|
4514
|
-
var { rootClassName:
|
|
4788
|
+
var { rootClassName: rootClassName7 } = internalProps;
|
|
4515
4789
|
var InfiniteTableColumnCellContext = createContext5(null);
|
|
4516
|
-
var InfiniteTableColumnCellClassName = `${
|
|
4790
|
+
var InfiniteTableColumnCellClassName = `${rootClassName7}ColumnCell`;
|
|
4517
4791
|
function isColumnWithField(c) {
|
|
4518
4792
|
return typeof c.field === "string";
|
|
4519
4793
|
}
|
|
@@ -4537,7 +4811,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
4537
4811
|
showZebraRows
|
|
4538
4812
|
} = props;
|
|
4539
4813
|
if (!column) {
|
|
4540
|
-
return /* @__PURE__ */
|
|
4814
|
+
return /* @__PURE__ */ createElement18("div", {
|
|
4541
4815
|
ref: domRef
|
|
4542
4816
|
}, "no column");
|
|
4543
4817
|
}
|
|
@@ -4546,33 +4820,44 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
4546
4820
|
const groupRowInfo = null;
|
|
4547
4821
|
let value = isGroupRow && groupBy && column.groupByField ? rowInfo.value : isColumnWithField(column) ? data == null ? void 0 : data[column.field] : null;
|
|
4548
4822
|
if (column.valueGetter) {
|
|
4549
|
-
|
|
4823
|
+
if (!rowInfo.isGroupRow && rowInfo.data) {
|
|
4824
|
+
value = column.valueGetter({ data: rowInfo.data, field: column.field });
|
|
4825
|
+
}
|
|
4826
|
+
}
|
|
4827
|
+
if (column.valueFormatter) {
|
|
4828
|
+
value = column.valueFormatter(isGroupRow ? {
|
|
4550
4829
|
data: rowInfo.data,
|
|
4551
4830
|
isGroupRow,
|
|
4552
|
-
rowInfo
|
|
4831
|
+
rowInfo,
|
|
4832
|
+
field: column.field,
|
|
4833
|
+
value
|
|
4553
4834
|
} : {
|
|
4554
4835
|
data: rowInfo.data,
|
|
4555
4836
|
isGroupRow,
|
|
4556
|
-
rowInfo
|
|
4837
|
+
rowInfo,
|
|
4838
|
+
field: column.field,
|
|
4839
|
+
value
|
|
4557
4840
|
});
|
|
4558
4841
|
}
|
|
4559
4842
|
const { componentState: computedDataSource } = useDataSourceContextValue();
|
|
4560
4843
|
const rest = rowInfo.isGroupRow ? {
|
|
4561
4844
|
rowInfo,
|
|
4562
4845
|
isGroupRow: rowInfo.isGroupRow,
|
|
4563
|
-
data: rowInfo.data
|
|
4846
|
+
data: rowInfo.data,
|
|
4847
|
+
value,
|
|
4848
|
+
field: column.field
|
|
4564
4849
|
} : {
|
|
4565
4850
|
rowInfo,
|
|
4566
4851
|
isGroupRow: rowInfo.isGroupRow,
|
|
4567
|
-
data: rowInfo.data
|
|
4852
|
+
data: rowInfo.data,
|
|
4853
|
+
value,
|
|
4854
|
+
field: column.field
|
|
4568
4855
|
};
|
|
4569
4856
|
const stylingRenderParam = __spreadValues({
|
|
4570
|
-
value,
|
|
4571
4857
|
column
|
|
4572
4858
|
}, rest);
|
|
4573
4859
|
const renderValue = value;
|
|
4574
4860
|
const renderParam = __spreadProps(__spreadValues({
|
|
4575
|
-
value,
|
|
4576
4861
|
column,
|
|
4577
4862
|
domRef,
|
|
4578
4863
|
groupRowInfo
|
|
@@ -4595,7 +4880,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
4595
4880
|
}
|
|
4596
4881
|
const renderFn = column.render || column.renderValue;
|
|
4597
4882
|
if (renderFn) {
|
|
4598
|
-
return /* @__PURE__ */
|
|
4883
|
+
return /* @__PURE__ */ createElement18(RenderHookComponent, {
|
|
4599
4884
|
render: renderFn,
|
|
4600
4885
|
renderParam
|
|
4601
4886
|
});
|
|
@@ -4631,9 +4916,9 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
4631
4916
|
renderChildren
|
|
4632
4917
|
};
|
|
4633
4918
|
const ContextProvider = InfiniteTableColumnCellContext.Provider;
|
|
4634
|
-
return /* @__PURE__ */
|
|
4919
|
+
return /* @__PURE__ */ createElement18(ContextProvider, {
|
|
4635
4920
|
value: renderParam
|
|
4636
|
-
}, /* @__PURE__ */
|
|
4921
|
+
}, /* @__PURE__ */ createElement18(InfiniteTableCell, __spreadValues({}, cellProps)));
|
|
4637
4922
|
}
|
|
4638
4923
|
var InfiniteTableColumnCell = memo7(InfiniteTableColumnCellFn);
|
|
4639
4924
|
function useInfiniteColumnCell() {
|
|
@@ -4649,7 +4934,7 @@ var RowHoverCls = "_7pupv01";
|
|
|
4649
4934
|
|
|
4650
4935
|
// src/components/InfiniteTable/components/LoadMask.tsx
|
|
4651
4936
|
import {
|
|
4652
|
-
createElement as
|
|
4937
|
+
createElement as createElement19,
|
|
4653
4938
|
memo as memo8
|
|
4654
4939
|
} from "react";
|
|
4655
4940
|
|
|
@@ -4659,15 +4944,15 @@ var LoadMaskOverlayCls = "qy58ya3 _16lm1iw2 _16lm1iwt _16lm1iwv _16lm1iwz _16lm1
|
|
|
4659
4944
|
var LoadMaskTextCls = "qy58ya4";
|
|
4660
4945
|
|
|
4661
4946
|
// src/components/InfiniteTable/components/LoadMask.tsx
|
|
4662
|
-
var { rootClassName:
|
|
4663
|
-
var baseCls = `${
|
|
4947
|
+
var { rootClassName: rootClassName8 } = internalProps;
|
|
4948
|
+
var baseCls = `${rootClassName8}-LoadMask`;
|
|
4664
4949
|
function LoadMaskFn(props) {
|
|
4665
4950
|
const { visible, children = "Loading" } = props;
|
|
4666
|
-
return /* @__PURE__ */
|
|
4951
|
+
return /* @__PURE__ */ createElement19("div", {
|
|
4667
4952
|
className: `${LoadMaskCls[visible ? "visible" : "hidden"]} ${baseCls}`
|
|
4668
|
-
}, /* @__PURE__ */
|
|
4953
|
+
}, /* @__PURE__ */ createElement19("div", {
|
|
4669
4954
|
className: `${LoadMaskOverlayCls} ${baseCls}-Overlay`
|
|
4670
|
-
}), /* @__PURE__ */
|
|
4955
|
+
}), /* @__PURE__ */ createElement19("div", {
|
|
4671
4956
|
className: `${LoadMaskTextCls} ${baseCls}-Text`
|
|
4672
4957
|
}, children));
|
|
4673
4958
|
}
|
|
@@ -4675,9 +4960,9 @@ var LoadMask = memo8(LoadMaskFn);
|
|
|
4675
4960
|
|
|
4676
4961
|
// src/components/InfiniteTable/hooks/useAutoSizeColumns.ts
|
|
4677
4962
|
import {
|
|
4678
|
-
useEffect as
|
|
4963
|
+
useEffect as useEffect12,
|
|
4679
4964
|
useRef as useRef13,
|
|
4680
|
-
useState as
|
|
4965
|
+
useState as useState7
|
|
4681
4966
|
} from "react";
|
|
4682
4967
|
var OFFSET = 10;
|
|
4683
4968
|
function getColumnContentMaxWidths(domRef, options) {
|
|
@@ -4700,6 +4985,7 @@ function getColumnContentMaxWidths(domRef, options) {
|
|
|
4700
4985
|
contentClone.style.pointerEvents = "none";
|
|
4701
4986
|
contentClone.classList.remove(...cssEllipsisClassName.split(" "));
|
|
4702
4987
|
contentClone.style.position = "absolute";
|
|
4988
|
+
contentClone.style.width = "auto";
|
|
4703
4989
|
cell.appendChild(contentClone);
|
|
4704
4990
|
let measuredWidth = contentClone.offsetWidth;
|
|
4705
4991
|
cell.removeChild(contentClone);
|
|
@@ -4737,11 +5023,11 @@ function useAutoSizeColumns() {
|
|
|
4737
5023
|
componentActions,
|
|
4738
5024
|
componentState: { domRef, ready, autoSizeColumnsKey, brain }
|
|
4739
5025
|
} = useComponentState();
|
|
4740
|
-
const [refreshId, setRefreshId] =
|
|
5026
|
+
const [refreshId, setRefreshId] = useState7(0);
|
|
4741
5027
|
const theKey = typeof autoSizeColumnsKey === "object" ? autoSizeColumnsKey.key : autoSizeColumnsKey;
|
|
4742
5028
|
const getTheKey = useLatest(theKey);
|
|
4743
5029
|
const lastExecutedIdentifierRef = useRef13(null);
|
|
4744
|
-
|
|
5030
|
+
useEffect12(() => {
|
|
4745
5031
|
const key = getTheKey();
|
|
4746
5032
|
if (key == null) {
|
|
4747
5033
|
return;
|
|
@@ -4754,7 +5040,7 @@ function useAutoSizeColumns() {
|
|
|
4754
5040
|
};
|
|
4755
5041
|
return brain.onRenderRangeChange(onChange);
|
|
4756
5042
|
}, [brain]);
|
|
4757
|
-
|
|
5043
|
+
useEffect12(() => {
|
|
4758
5044
|
var _a;
|
|
4759
5045
|
if (theKey == null) {
|
|
4760
5046
|
return;
|
|
@@ -4799,13 +5085,13 @@ function useAutoSizeColumns() {
|
|
|
4799
5085
|
}
|
|
4800
5086
|
|
|
4801
5087
|
// src/components/InfiniteTable/hooks/useCellRendering.tsx
|
|
4802
|
-
import { useCallback as useCallback11, useEffect as
|
|
4803
|
-
import
|
|
5088
|
+
import { useCallback as useCallback11, useEffect as useEffect13, useRef as useRef14 } from "react";
|
|
5089
|
+
import React25 from "react";
|
|
4804
5090
|
|
|
4805
5091
|
// src/components/hooks/useRerender.ts
|
|
4806
|
-
import { useCallback as useCallback10, useState as
|
|
5092
|
+
import { useCallback as useCallback10, useState as useState8 } from "react";
|
|
4807
5093
|
var useRerender = () => {
|
|
4808
|
-
const [state, setState] =
|
|
5094
|
+
const [state, setState] = useState8(0);
|
|
4809
5095
|
return [
|
|
4810
5096
|
state,
|
|
4811
5097
|
useCallback10(() => {
|
|
@@ -4883,12 +5169,12 @@ function useCellRendering(param) {
|
|
|
4883
5169
|
rowspan
|
|
4884
5170
|
});
|
|
4885
5171
|
const scrollTopMaxRef = useRef14(0);
|
|
4886
|
-
|
|
5172
|
+
useEffect13(() => {
|
|
4887
5173
|
return brain.onRenderCountChange(() => {
|
|
4888
5174
|
scrollTopMaxRef.current = brain.scrollTopMax;
|
|
4889
5175
|
});
|
|
4890
5176
|
}, [brain]);
|
|
4891
|
-
|
|
5177
|
+
useEffect13(() => {
|
|
4892
5178
|
return brain.onScrollStop((scrollPosition) => {
|
|
4893
5179
|
const { scrollTop } = scrollPosition;
|
|
4894
5180
|
if (scrollTop === 0) {
|
|
@@ -4905,7 +5191,7 @@ function useCellRendering(param) {
|
|
|
4905
5191
|
}
|
|
4906
5192
|
});
|
|
4907
5193
|
}, [brain, onScrollToTop, onScrollToBottom]);
|
|
4908
|
-
|
|
5194
|
+
useEffect13(() => {
|
|
4909
5195
|
if (!bodySize.height) {
|
|
4910
5196
|
return;
|
|
4911
5197
|
}
|
|
@@ -4926,7 +5212,7 @@ function useCellRendering(param) {
|
|
|
4926
5212
|
}
|
|
4927
5213
|
}, [!!bodySize.height]);
|
|
4928
5214
|
const [, rerender] = useRerender();
|
|
4929
|
-
|
|
5215
|
+
useEffect13(() => {
|
|
4930
5216
|
rerender();
|
|
4931
5217
|
}, [dataSourceState]);
|
|
4932
5218
|
const renderCell = useCallback11((params) => {
|
|
@@ -4964,7 +5250,7 @@ function useCellRendering(param) {
|
|
|
4964
5250
|
rowStyle,
|
|
4965
5251
|
rowClassName
|
|
4966
5252
|
};
|
|
4967
|
-
return /* @__PURE__ */
|
|
5253
|
+
return /* @__PURE__ */ React25.createElement(InfiniteTableColumnCell, __spreadValues({}, cellProps));
|
|
4968
5254
|
}, [
|
|
4969
5255
|
rowHeight,
|
|
4970
5256
|
getData,
|
|
@@ -4982,13 +5268,13 @@ function useCellRendering(param) {
|
|
|
4982
5268
|
}
|
|
4983
5269
|
|
|
4984
5270
|
// src/components/InfiniteTable/hooks/useComputed.ts
|
|
4985
|
-
import { useCallback as useCallback14, useEffect as
|
|
5271
|
+
import { useCallback as useCallback14, useEffect as useEffect23, useState as useState12 } from "react";
|
|
4986
5272
|
|
|
4987
5273
|
// src/components/InfiniteTable/hooks/useColumnGroups.ts
|
|
4988
|
-
import { useEffect as
|
|
5274
|
+
import { useEffect as useEffect15 } from "react";
|
|
4989
5275
|
|
|
4990
5276
|
// src/components/hooks/useInterceptedMap.ts
|
|
4991
|
-
import { useEffect as
|
|
5277
|
+
import { useEffect as useEffect14 } from "react";
|
|
4992
5278
|
function interceptMap(map2, fns) {
|
|
4993
5279
|
const { set, delete: deleteKey, clear } = map2;
|
|
4994
5280
|
if (fns.set) {
|
|
@@ -5076,7 +5362,7 @@ function useColumnGroups() {
|
|
|
5076
5362
|
componentActions,
|
|
5077
5363
|
getComponentState
|
|
5078
5364
|
} = useComponentState();
|
|
5079
|
-
|
|
5365
|
+
useEffect15(() => {
|
|
5080
5366
|
const recompute = () => {
|
|
5081
5367
|
componentActions.columnGroupsDepthsMap = computeColumnGroupsDepths(computedColumnGroups);
|
|
5082
5368
|
};
|
|
@@ -5087,7 +5373,7 @@ function useColumnGroups() {
|
|
|
5087
5373
|
set: update
|
|
5088
5374
|
});
|
|
5089
5375
|
}, [computedColumnGroups]);
|
|
5090
|
-
|
|
5376
|
+
useEffect15(() => {
|
|
5091
5377
|
return interceptMap(collapsedColumnGroups, {
|
|
5092
5378
|
set: (key, visibleCol) => {
|
|
5093
5379
|
const colIds = key.slice(1);
|
|
@@ -5122,10 +5408,10 @@ function useColumnGroups() {
|
|
|
5122
5408
|
}
|
|
5123
5409
|
|
|
5124
5410
|
// src/components/InfiniteTable/hooks/useColumnRowspan.ts
|
|
5125
|
-
import { useMemo as
|
|
5411
|
+
import { useMemo as useMemo7 } from "react";
|
|
5126
5412
|
function useColumnRowspan(computedVisibleColumns) {
|
|
5127
5413
|
const { getState: getDataSourceState } = useDataSourceContextValue();
|
|
5128
|
-
const rowspan =
|
|
5414
|
+
const rowspan = useMemo7(() => {
|
|
5129
5415
|
const colsWithRowspan = computedVisibleColumns.filter((col) => typeof col.rowspan === "function");
|
|
5130
5416
|
return colsWithRowspan.length ? ({ rowIndex, colIndex }) => {
|
|
5131
5417
|
const dataArray = getDataSourceState().dataArray;
|
|
@@ -5165,11 +5451,11 @@ function useColumnSizeFn(columns) {
|
|
|
5165
5451
|
}
|
|
5166
5452
|
|
|
5167
5453
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
5168
|
-
import { useEffect as
|
|
5454
|
+
import { useEffect as useEffect20, useMemo as useMemo9 } from "react";
|
|
5169
5455
|
|
|
5170
5456
|
// src/components/InfiniteTable/utils/getColumnForGroupBy.tsx
|
|
5171
5457
|
import {
|
|
5172
|
-
createElement as
|
|
5458
|
+
createElement as createElement22
|
|
5173
5459
|
} from "react";
|
|
5174
5460
|
|
|
5175
5461
|
// src/utils/stripVar.ts
|
|
@@ -5187,10 +5473,10 @@ var showLoadingIcon = (rowInfo) => {
|
|
|
5187
5473
|
|
|
5188
5474
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
5189
5475
|
import {
|
|
5190
|
-
createElement as
|
|
5191
|
-
useEffect as
|
|
5476
|
+
createElement as createElement20,
|
|
5477
|
+
useEffect as useEffect16
|
|
5192
5478
|
} from "react";
|
|
5193
|
-
import { useState as
|
|
5479
|
+
import { useState as useState9 } from "react";
|
|
5194
5480
|
|
|
5195
5481
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.css.ts
|
|
5196
5482
|
var import_createRuntimeFn5 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
@@ -5201,7 +5487,7 @@ var ExpanderIconClsVariants = (0, import_createRuntimeFn5.createRuntimeFn)({ def
|
|
|
5201
5487
|
function ExpanderIcon(props) {
|
|
5202
5488
|
var _a;
|
|
5203
5489
|
const { size = 24 } = props;
|
|
5204
|
-
const [expanded, setExpanded] =
|
|
5490
|
+
const [expanded, setExpanded] = useState9((_a = props.expanded) != null ? _a : props.defaultExpanded);
|
|
5205
5491
|
const onClick = () => {
|
|
5206
5492
|
var _a2;
|
|
5207
5493
|
(_a2 = props.onChange) == null ? void 0 : _a2.call(props, !expanded);
|
|
@@ -5209,12 +5495,12 @@ function ExpanderIcon(props) {
|
|
|
5209
5495
|
setExpanded(!expanded);
|
|
5210
5496
|
}
|
|
5211
5497
|
};
|
|
5212
|
-
|
|
5498
|
+
useEffect16(() => {
|
|
5213
5499
|
if (isControlled("expanded", props)) {
|
|
5214
5500
|
setExpanded(props.expanded);
|
|
5215
5501
|
}
|
|
5216
5502
|
}, [props.expanded]);
|
|
5217
|
-
return /* @__PURE__ */
|
|
5503
|
+
return /* @__PURE__ */ createElement20("svg", {
|
|
5218
5504
|
"data-name": "expander-icon",
|
|
5219
5505
|
xmlns: "http://www.w3.org/2000/svg",
|
|
5220
5506
|
height: `${size}px`,
|
|
@@ -5225,14 +5511,14 @@ function ExpanderIcon(props) {
|
|
|
5225
5511
|
className: join(props.className, ExpanderIconCls, ExpanderIconClsVariants({
|
|
5226
5512
|
expanded
|
|
5227
5513
|
}), "InfiniteIcon", "InfiniteIcon-expander", `InfiniteIcon-expander--${expanded ? "expanded" : "collapsed"}`)
|
|
5228
|
-
}, /* @__PURE__ */
|
|
5514
|
+
}, /* @__PURE__ */ createElement20("path", {
|
|
5229
5515
|
d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"
|
|
5230
5516
|
}));
|
|
5231
5517
|
}
|
|
5232
5518
|
|
|
5233
5519
|
// src/components/InfiniteTable/components/icons/LoadingIcon.tsx
|
|
5234
5520
|
import {
|
|
5235
|
-
createElement as
|
|
5521
|
+
createElement as createElement21
|
|
5236
5522
|
} from "react";
|
|
5237
5523
|
|
|
5238
5524
|
// src/components/InfiniteTable/components/icons/LoadingIcon.css.ts
|
|
@@ -5240,7 +5526,7 @@ var LoadingIconCls = "_16lm1iw8 _16lm1iwf _16lm1iwd";
|
|
|
5240
5526
|
|
|
5241
5527
|
// src/components/InfiniteTable/components/icons/LoadingIcon.tsx
|
|
5242
5528
|
var LoadingIcon = (props) => {
|
|
5243
|
-
return /* @__PURE__ */
|
|
5529
|
+
return /* @__PURE__ */ createElement21("svg", {
|
|
5244
5530
|
xmlns: "http://www.w3.org/2000/svg",
|
|
5245
5531
|
style: {
|
|
5246
5532
|
margin: "auto",
|
|
@@ -5252,14 +5538,14 @@ var LoadingIcon = (props) => {
|
|
|
5252
5538
|
viewBox: "0 0 100 100",
|
|
5253
5539
|
preserveAspectRatio: "xMidYMid",
|
|
5254
5540
|
className: join(props.className, LoadingIconCls, "InfiniteIcon", "InfiniteIcon-loading")
|
|
5255
|
-
}, /* @__PURE__ */
|
|
5541
|
+
}, /* @__PURE__ */ createElement21("circle", {
|
|
5256
5542
|
cx: "50",
|
|
5257
5543
|
cy: "50",
|
|
5258
5544
|
fill: "none",
|
|
5259
5545
|
strokeWidth: "10",
|
|
5260
5546
|
r: "35",
|
|
5261
5547
|
strokeDasharray: "164.93361431346415 56.97787143782138"
|
|
5262
|
-
}, /* @__PURE__ */
|
|
5548
|
+
}, /* @__PURE__ */ createElement21("animateTransform", {
|
|
5263
5549
|
attributeName: "transform",
|
|
5264
5550
|
type: "rotate",
|
|
5265
5551
|
repeatCount: "indefinite",
|
|
@@ -5279,7 +5565,7 @@ function getGroupColumnRender({
|
|
|
5279
5565
|
var _a, _b, _c;
|
|
5280
5566
|
let { value, rowInfo, column, groupBy, pivotBy } = renderOptions;
|
|
5281
5567
|
if (column.renderValue) {
|
|
5282
|
-
value = /* @__PURE__ */
|
|
5568
|
+
value = /* @__PURE__ */ createElement22(RenderHookComponent, {
|
|
5283
5569
|
render: column.renderValue,
|
|
5284
5570
|
renderParam: renderOptions
|
|
5285
5571
|
});
|
|
@@ -5309,22 +5595,22 @@ function getGroupColumnRender({
|
|
|
5309
5595
|
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);
|
|
5310
5596
|
const isLoading = showLoadingIcon(groupRowInfo);
|
|
5311
5597
|
if (isLoading) {
|
|
5312
|
-
icon = /* @__PURE__ */
|
|
5598
|
+
icon = /* @__PURE__ */ createElement22(LoadingIcon, null);
|
|
5313
5599
|
} else if (showExpanderIcon) {
|
|
5314
|
-
const defaultIcon = /* @__PURE__ */
|
|
5600
|
+
const defaultIcon = /* @__PURE__ */ createElement22(ExpanderIcon, {
|
|
5315
5601
|
expanded: !collapsed,
|
|
5316
5602
|
onChange: () => {
|
|
5317
5603
|
toggleGroupRow(groupKeys);
|
|
5318
5604
|
}
|
|
5319
5605
|
});
|
|
5320
|
-
icon = column.renderGroupIcon ? /* @__PURE__ */
|
|
5606
|
+
icon = column.renderGroupIcon ? /* @__PURE__ */ createElement22(RenderHookComponent, {
|
|
5321
5607
|
render: column.renderGroupIcon,
|
|
5322
5608
|
renderParam: Object.assign({ collapsed, groupIcon: defaultIcon }, renderOptions)
|
|
5323
5609
|
}) : defaultIcon;
|
|
5324
5610
|
}
|
|
5325
|
-
return /* @__PURE__ */
|
|
5611
|
+
return /* @__PURE__ */ createElement22("div", {
|
|
5326
5612
|
className: join(display.flex, alignItems.center)
|
|
5327
|
-
}, icon, /* @__PURE__ */
|
|
5613
|
+
}, icon, /* @__PURE__ */ createElement22("div", {
|
|
5328
5614
|
className: cssEllipsisClassName
|
|
5329
5615
|
}, value != null ? value : null));
|
|
5330
5616
|
};
|
|
@@ -5369,9 +5655,9 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
5369
5655
|
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;
|
|
5370
5656
|
const isLoading = showLoadingIcon(rowInfo);
|
|
5371
5657
|
if (isLoading) {
|
|
5372
|
-
icon = /* @__PURE__ */
|
|
5658
|
+
icon = /* @__PURE__ */ createElement22(LoadingIcon, null);
|
|
5373
5659
|
} else if (showExpanderIcon) {
|
|
5374
|
-
const defaultIcon = /* @__PURE__ */
|
|
5660
|
+
const defaultIcon = /* @__PURE__ */ createElement22(ExpanderIcon, {
|
|
5375
5661
|
expanded: !collapsed,
|
|
5376
5662
|
onChange: () => {
|
|
5377
5663
|
if (!rowInfo.isGroupRow) {
|
|
@@ -5386,9 +5672,9 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
5386
5672
|
icon = column.renderGroupIcon(renderParam);
|
|
5387
5673
|
}
|
|
5388
5674
|
}
|
|
5389
|
-
return /* @__PURE__ */
|
|
5675
|
+
return /* @__PURE__ */ createElement22("div", {
|
|
5390
5676
|
className: join(display.flex, alignItems.center, GroupRowExpanderCls)
|
|
5391
|
-
}, icon, /* @__PURE__ */
|
|
5677
|
+
}, icon, /* @__PURE__ */ createElement22("div", {
|
|
5392
5678
|
className: cssEllipsisClassName
|
|
5393
5679
|
}, value != null ? value : null));
|
|
5394
5680
|
}
|
|
@@ -5404,11 +5690,11 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
5404
5690
|
}
|
|
5405
5691
|
|
|
5406
5692
|
// src/components/InfiniteTable/hooks/useEffectWithRaf.ts
|
|
5407
|
-
import { useEffect as
|
|
5693
|
+
import { useEffect as useEffect17, useRef as useRef15 } from "react";
|
|
5408
5694
|
function useEffectWithRaf(fn, deps) {
|
|
5409
5695
|
const rafId = useRef15(0);
|
|
5410
5696
|
const removeFnRaf = useRef15();
|
|
5411
|
-
|
|
5697
|
+
useEffect17(() => {
|
|
5412
5698
|
rafId.current = requestAnimationFrame(() => {
|
|
5413
5699
|
removeFnRaf.current = fn();
|
|
5414
5700
|
});
|
|
@@ -5493,21 +5779,18 @@ function lazyGroup(groupParams, rootData) {
|
|
|
5493
5779
|
rootData.visitDepthFirst((lazyGroupRowInfo, keys, _index, next) => {
|
|
5494
5780
|
const [_rootKey, ...currentGroupKeys] = keys;
|
|
5495
5781
|
const dataArray = lazyGroupRowInfo.children;
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
|
|
5782
|
+
const current = deepMap.get(currentGroupKeys);
|
|
5783
|
+
if (current) {
|
|
5784
|
+
current.cache = lazyGroupRowInfo.cache;
|
|
5785
|
+
current.childrenLoading = lazyGroupRowInfo.childrenLoading;
|
|
5786
|
+
current.childrenAvailable = lazyGroupRowInfo.childrenAvailable;
|
|
5787
|
+
current.error = lazyGroupRowInfo.error;
|
|
5502
5788
|
}
|
|
5503
|
-
if (
|
|
5504
|
-
const current = deepMap.get(currentGroupKeys);
|
|
5789
|
+
if (currentGroupKeys.length == groupBy.length && groupBy.length) {
|
|
5505
5790
|
if (current) {
|
|
5506
|
-
current.
|
|
5507
|
-
current.childrenLoading = lazyGroupRowInfo.childrenLoading;
|
|
5508
|
-
current.childrenAvailable = lazyGroupRowInfo.childrenAvailable;
|
|
5509
|
-
current.error = lazyGroupRowInfo.error;
|
|
5791
|
+
current.items = dataArray;
|
|
5510
5792
|
}
|
|
5793
|
+
return next == null ? void 0 : next();
|
|
5511
5794
|
}
|
|
5512
5795
|
for (let i = 0, len = dataArray.length; i < len; i++) {
|
|
5513
5796
|
if (!dataArray[i]) {
|
|
@@ -5836,8 +6119,9 @@ function enhancedFlatten(param) {
|
|
|
5836
6119
|
}
|
|
5837
6120
|
for (let index = 0, len = items.length; index < len; index++) {
|
|
5838
6121
|
const item = items[index];
|
|
6122
|
+
const indexInAll = startIndex + index;
|
|
5839
6123
|
const rowInfo = {
|
|
5840
|
-
id: item ? toPrimaryKey(item) : `${groupKeys}-${index}`,
|
|
6124
|
+
id: item ? toPrimaryKey(item, indexInAll) : `${groupKeys}-${index}`,
|
|
5841
6125
|
data: item,
|
|
5842
6126
|
dataSourceHasGrouping: true,
|
|
5843
6127
|
isGroupRow: false,
|
|
@@ -5848,7 +6132,7 @@ function enhancedFlatten(param) {
|
|
|
5848
6132
|
parents: Array.from(parents),
|
|
5849
6133
|
indexInParentGroups: [...indexInParentGroups, index],
|
|
5850
6134
|
indexInGroup: index,
|
|
5851
|
-
indexInAll
|
|
6135
|
+
indexInAll,
|
|
5852
6136
|
groupBy: groupByStrings,
|
|
5853
6137
|
groupNesting,
|
|
5854
6138
|
groupCount: enhancedGroupData.groupCount
|
|
@@ -5881,8 +6165,8 @@ function enhancedFlatten(param) {
|
|
|
5881
6165
|
|
|
5882
6166
|
// src/components/DataSource/index.tsx
|
|
5883
6167
|
import {
|
|
5884
|
-
Fragment as
|
|
5885
|
-
createElement as
|
|
6168
|
+
Fragment as Fragment3,
|
|
6169
|
+
createElement as createElement23
|
|
5886
6170
|
} from "react";
|
|
5887
6171
|
|
|
5888
6172
|
// src/utils/multisort/sortTypes.ts
|
|
@@ -5894,11 +6178,11 @@ var stringComparator = function(first, second) {
|
|
|
5894
6178
|
second = `${second}`;
|
|
5895
6179
|
return first.localeCompare(second);
|
|
5896
6180
|
};
|
|
5897
|
-
var
|
|
6181
|
+
var defaultSortTypes = {
|
|
5898
6182
|
number: numberComparator,
|
|
5899
6183
|
string: stringComparator
|
|
5900
6184
|
};
|
|
5901
|
-
var sortTypes_default =
|
|
6185
|
+
var sortTypes_default = defaultSortTypes;
|
|
5902
6186
|
|
|
5903
6187
|
// src/utils/multisort/index.ts
|
|
5904
6188
|
var multisort = (sortInfo, array, get) => {
|
|
@@ -5911,7 +6195,8 @@ var getSingleSortFunction = (info) => {
|
|
|
5911
6195
|
return;
|
|
5912
6196
|
}
|
|
5913
6197
|
const field = info.field;
|
|
5914
|
-
|
|
6198
|
+
const valueGetter = info.valueGetter;
|
|
6199
|
+
const dir = info.dir < 0 ? -1 : info.dir > 0 ? 1 : 0;
|
|
5915
6200
|
if (!dir) {
|
|
5916
6201
|
return;
|
|
5917
6202
|
}
|
|
@@ -5926,8 +6211,8 @@ var getSingleSortFunction = (info) => {
|
|
|
5926
6211
|
fn = sortTypes_default.string;
|
|
5927
6212
|
}
|
|
5928
6213
|
return (first, second) => {
|
|
5929
|
-
const a = field ? first[field] : first;
|
|
5930
|
-
const b = field ? second[field] : second;
|
|
6214
|
+
const a = valueGetter ? valueGetter(first) : field ? first[field] : first;
|
|
6215
|
+
const b = valueGetter ? valueGetter(second) : field ? second[field] : second;
|
|
5931
6216
|
return dir * fn(a, b);
|
|
5932
6217
|
};
|
|
5933
6218
|
};
|
|
@@ -5950,20 +6235,130 @@ var getMultisortFunction = (sortInfo, get) => {
|
|
|
5950
6235
|
if (!fn) {
|
|
5951
6236
|
continue;
|
|
5952
6237
|
}
|
|
5953
|
-
result = fn(first, second);
|
|
5954
|
-
if (result !== 0) {
|
|
5955
|
-
return result;
|
|
6238
|
+
result = fn(first, second);
|
|
6239
|
+
if (result !== 0) {
|
|
6240
|
+
return result;
|
|
6241
|
+
}
|
|
6242
|
+
}
|
|
6243
|
+
return result;
|
|
6244
|
+
};
|
|
6245
|
+
};
|
|
6246
|
+
|
|
6247
|
+
// src/components/DataSource/GroupRowsState.ts
|
|
6248
|
+
var GroupRowsState = class {
|
|
6249
|
+
constructor(state) {
|
|
6250
|
+
this.update(state instanceof GroupRowsState ? state.getState() : state);
|
|
6251
|
+
}
|
|
6252
|
+
getState() {
|
|
6253
|
+
var _a, _b, _c, _d;
|
|
6254
|
+
return {
|
|
6255
|
+
expandedRows: this.expandedAll ? true : (_b = (_a = this.expandedMap) == null ? void 0 : _a.topDownKeys()) != null ? _b : [],
|
|
6256
|
+
collapsedRows: this.collapsedAll ? true : (_d = (_c = this.collapsedMap) == null ? void 0 : _c.topDownKeys()) != null ? _d : []
|
|
6257
|
+
};
|
|
6258
|
+
}
|
|
6259
|
+
destroy() {
|
|
6260
|
+
var _a, _b;
|
|
6261
|
+
(_a = this.expandedMap) == null ? void 0 : _a.clear();
|
|
6262
|
+
(_b = this.collapsedMap) == null ? void 0 : _b.clear();
|
|
6263
|
+
delete this.expandedMap;
|
|
6264
|
+
delete this.collapsedMap;
|
|
6265
|
+
}
|
|
6266
|
+
update(state) {
|
|
6267
|
+
var _a, _b, _c, _d;
|
|
6268
|
+
this.initialState = state;
|
|
6269
|
+
const { collapsedRows, expandedRows } = this.initialState;
|
|
6270
|
+
this.collapsedAll = collapsedRows === true;
|
|
6271
|
+
this.expandedAll = expandedRows === true;
|
|
6272
|
+
if (this.collapsedAll && this.expandedAll) {
|
|
6273
|
+
throw `Cannot have both collapsedRows and expandedRows be true!`;
|
|
6274
|
+
}
|
|
6275
|
+
if (collapsedRows !== true) {
|
|
6276
|
+
(_a = this.collapsedMap) == null ? void 0 : _a.clear();
|
|
6277
|
+
this.collapsedMap = (_b = this.collapsedMap) != null ? _b : new DeepMap(collapsedRows.map((keys) => [keys, true]));
|
|
6278
|
+
}
|
|
6279
|
+
if (expandedRows !== true) {
|
|
6280
|
+
(_c = this.expandedMap) == null ? void 0 : _c.clear();
|
|
6281
|
+
this.expandedMap = (_d = this.expandedMap) != null ? _d : new DeepMap(expandedRows.map((keys) => [keys, true]));
|
|
6282
|
+
}
|
|
6283
|
+
}
|
|
6284
|
+
areAllCollapsed() {
|
|
6285
|
+
return this.collapsedAll && (this.expandedMap ? this.expandedMap.size === 0 : true);
|
|
6286
|
+
}
|
|
6287
|
+
areAllExpanded() {
|
|
6288
|
+
return this.expandedAll && (this.collapsedMap ? this.collapsedMap.size === 0 : true);
|
|
6289
|
+
}
|
|
6290
|
+
collapseAll() {
|
|
6291
|
+
this.update({
|
|
6292
|
+
collapsedRows: true,
|
|
6293
|
+
expandedRows: []
|
|
6294
|
+
});
|
|
6295
|
+
}
|
|
6296
|
+
expandAll() {
|
|
6297
|
+
this.update({
|
|
6298
|
+
expandedRows: true,
|
|
6299
|
+
collapsedRows: []
|
|
6300
|
+
});
|
|
6301
|
+
}
|
|
6302
|
+
isGroupRowExpanded(keys) {
|
|
6303
|
+
var _a, _b;
|
|
6304
|
+
if (this.expandedAll === true) {
|
|
6305
|
+
if (this.collapsedAll === true) {
|
|
6306
|
+
throw 'Cannot have both expandedRows and collapsedRows be "true"';
|
|
6307
|
+
}
|
|
6308
|
+
return !((_a = this.collapsedMap) == null ? void 0 : _a.has(keys));
|
|
6309
|
+
}
|
|
6310
|
+
return (_b = this.expandedMap) == null ? void 0 : _b.has(keys);
|
|
6311
|
+
}
|
|
6312
|
+
isGroupRowCollapsed(keys) {
|
|
6313
|
+
return !this.isGroupRowExpanded(keys);
|
|
6314
|
+
}
|
|
6315
|
+
setGroupRowExpanded(keys, shouldExpand) {
|
|
6316
|
+
var _a;
|
|
6317
|
+
if (shouldExpand === this.isGroupRowExpanded(keys)) {
|
|
6318
|
+
return;
|
|
6319
|
+
}
|
|
6320
|
+
if (shouldExpand) {
|
|
6321
|
+
if (this.collapsedAll === true) {
|
|
6322
|
+
if (!this.expandedMap) {
|
|
6323
|
+
throw `No expandedMap found when trying to expand group row ${keys.join(",")}`;
|
|
6324
|
+
}
|
|
6325
|
+
this.expandedMap.set(keys, true);
|
|
6326
|
+
} else if (this.expandedAll === true) {
|
|
6327
|
+
if (!this.collapsedMap) {
|
|
6328
|
+
throw `No collapsedMap found when trying to expand group row ${keys.join(",")}`;
|
|
6329
|
+
}
|
|
6330
|
+
this.collapsedMap.delete(keys);
|
|
6331
|
+
}
|
|
6332
|
+
} else {
|
|
6333
|
+
if (this.expandedAll === true) {
|
|
6334
|
+
if (!this.collapsedMap) {
|
|
6335
|
+
throw `No collapsedMap found when trying to collapse group row ${keys.join(",")}`;
|
|
6336
|
+
}
|
|
6337
|
+
this.collapsedMap.set(keys, true);
|
|
6338
|
+
} else if (this.collapsedAll === true) {
|
|
6339
|
+
if (!this.expandedMap) {
|
|
6340
|
+
throw `No expandedMap found when trying to collapse group row ${keys.join(",")}`;
|
|
6341
|
+
}
|
|
6342
|
+
(_a = this.expandedMap) == null ? void 0 : _a.delete(keys);
|
|
5956
6343
|
}
|
|
5957
6344
|
}
|
|
5958
|
-
|
|
5959
|
-
|
|
6345
|
+
}
|
|
6346
|
+
collapseGroupRow(keys) {
|
|
6347
|
+
this.setGroupRowExpanded(keys, false);
|
|
6348
|
+
}
|
|
6349
|
+
expandGroupRow(keys) {
|
|
6350
|
+
this.setGroupRowExpanded(keys, true);
|
|
6351
|
+
}
|
|
6352
|
+
toggleGroupRow(keys) {
|
|
6353
|
+
this.setGroupRowExpanded(keys, !this.isGroupRowExpanded(keys));
|
|
6354
|
+
}
|
|
5960
6355
|
};
|
|
5961
6356
|
|
|
5962
6357
|
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
5963
|
-
import { useEffect as
|
|
6358
|
+
import { useEffect as useEffect19, useMemo as useMemo8, useRef as useRef17, useState as useState10 } from "react";
|
|
5964
6359
|
|
|
5965
6360
|
// src/components/hooks/useEffectWithChanges.ts
|
|
5966
|
-
import { useEffect as
|
|
6361
|
+
import { useEffect as useEffect18, useRef as useRef16 } from "react";
|
|
5967
6362
|
function useEffectWithChanges(fn, deps) {
|
|
5968
6363
|
const prevRef = useRef16({});
|
|
5969
6364
|
const oldValuesRef = useRef16({});
|
|
@@ -5981,7 +6376,7 @@ function useEffectWithChanges(fn, deps) {
|
|
|
5981
6376
|
}
|
|
5982
6377
|
}
|
|
5983
6378
|
prevRef.current = deps;
|
|
5984
|
-
|
|
6379
|
+
useEffect18(() => {
|
|
5985
6380
|
const changes2 = changesRef.current;
|
|
5986
6381
|
const result = fn(changes2, oldValues);
|
|
5987
6382
|
changesRef.current = {};
|
|
@@ -6034,6 +6429,7 @@ function buildDataSourceDataParams(componentState, overrides) {
|
|
|
6034
6429
|
sortInfo,
|
|
6035
6430
|
groupBy: componentState.groupBy,
|
|
6036
6431
|
pivotBy: componentState.pivotBy,
|
|
6432
|
+
filterValue: componentState.filterValue,
|
|
6037
6433
|
aggregationReducers: componentState.aggregationReducers
|
|
6038
6434
|
};
|
|
6039
6435
|
if (dataSourceParams.groupBy) {
|
|
@@ -6053,6 +6449,13 @@ function buildDataSourceDataParams(componentState, overrides) {
|
|
|
6053
6449
|
if (overrides) {
|
|
6054
6450
|
Object.assign(dataSourceParams, overrides);
|
|
6055
6451
|
}
|
|
6452
|
+
if (dataSourceParams.filterValue && dataSourceParams.filterValue.length) {
|
|
6453
|
+
dataSourceParams.filterValue = dataSourceParams.filterValue.map((f) => {
|
|
6454
|
+
const value = __spreadValues({}, f);
|
|
6455
|
+
delete value.valueGetter;
|
|
6456
|
+
return value;
|
|
6457
|
+
});
|
|
6458
|
+
}
|
|
6056
6459
|
const changes = {};
|
|
6057
6460
|
const oldDataSourceParams = componentState.dataParams || {};
|
|
6058
6461
|
for (const k in dataSourceParams) {
|
|
@@ -6073,6 +6476,13 @@ function loadData(data, componentState, actions, overrides) {
|
|
|
6073
6476
|
const lazyGroupData = componentState.originalLazyGroupData;
|
|
6074
6477
|
const key = [LAZY_ROOT_KEY_FOR_GROUPS, ...dataParams.groupKeys || []];
|
|
6075
6478
|
const existingGroupRowInfo = lazyGroupData.get(key);
|
|
6479
|
+
if (!existingGroupRowInfo) {
|
|
6480
|
+
const groupCacheKeys = [
|
|
6481
|
+
...dataParams.groupKeys || [],
|
|
6482
|
+
dataParams.lazyLoadStartIndex
|
|
6483
|
+
];
|
|
6484
|
+
componentState.lazyLoadCacheOfLoadedBatches.set(groupCacheKeys, true);
|
|
6485
|
+
}
|
|
6076
6486
|
if (existingGroupRowInfo && existingGroupRowInfo.cache && key.length > 1) {
|
|
6077
6487
|
const items = existingGroupRowInfo.children;
|
|
6078
6488
|
const len = items.length;
|
|
@@ -6098,7 +6508,8 @@ function loadData(data, componentState, actions, overrides) {
|
|
|
6098
6508
|
childrenLoading: true,
|
|
6099
6509
|
childrenAvailable: false,
|
|
6100
6510
|
cache: CACHE_DEFAULT,
|
|
6101
|
-
totalCount: 0
|
|
6511
|
+
totalCount: 0,
|
|
6512
|
+
totalCountUnfiltered: 0
|
|
6102
6513
|
});
|
|
6103
6514
|
}
|
|
6104
6515
|
actions.originalLazyGroupDataChangeDetect = getChangeDetect();
|
|
@@ -6122,9 +6533,12 @@ function loadData(data, componentState, actions, overrides) {
|
|
|
6122
6533
|
if (remoteData.mappings) {
|
|
6123
6534
|
actions.pivotMappings = remoteData.mappings;
|
|
6124
6535
|
}
|
|
6536
|
+
if (remoteData.totalCountUnfiltered) {
|
|
6537
|
+
actions.unfilteredCount = remoteData.totalCountUnfiltered;
|
|
6538
|
+
}
|
|
6125
6539
|
if (componentState.lazyLoad) {
|
|
6126
6540
|
let resolveRemoteData = function(keys, remoteData2, parentKeys) {
|
|
6127
|
-
var _a, _b, _c;
|
|
6541
|
+
var _a, _b, _c, _d;
|
|
6128
6542
|
const theKey = [LAZY_ROOT_KEY_FOR_GROUPS, ...keys];
|
|
6129
6543
|
const dataArray2 = remoteData2.data;
|
|
6130
6544
|
const newGroupRowInfo = {
|
|
@@ -6132,6 +6546,7 @@ function loadData(data, componentState, actions, overrides) {
|
|
|
6132
6546
|
childrenLoading: false,
|
|
6133
6547
|
childrenAvailable: true,
|
|
6134
6548
|
totalCount: (_a = remoteData2.totalCount) != null ? _a : dataArray2.length,
|
|
6549
|
+
totalCountUnfiltered: (_b = remoteData2.totalCount) != null ? _b : dataArray2.length,
|
|
6135
6550
|
children: dataArray2,
|
|
6136
6551
|
error: remoteData2.error
|
|
6137
6552
|
};
|
|
@@ -6146,8 +6561,8 @@ function loadData(data, componentState, actions, overrides) {
|
|
|
6146
6561
|
currentGroupRowInfo.chidren = [];
|
|
6147
6562
|
}
|
|
6148
6563
|
currentGroupRowInfo.children.length = currentGroupRowInfo.totalCount;
|
|
6149
|
-
const start = (
|
|
6150
|
-
const end = Math.min((
|
|
6564
|
+
const start = (_c = dataParams.lazyLoadStartIndex) != null ? _c : 0;
|
|
6565
|
+
const end = Math.min((_d = remoteData2.totalCount) != null ? _d : dataArray2.length, start + dataParams.lazyLoadBatchSize);
|
|
6151
6566
|
for (let i = start; i < end; i++) {
|
|
6152
6567
|
const it = newGroupRowInfo.children[i - start];
|
|
6153
6568
|
if (!it) {
|
|
@@ -6224,16 +6639,17 @@ function useLoadData() {
|
|
|
6224
6639
|
sortInfo,
|
|
6225
6640
|
groupBy,
|
|
6226
6641
|
pivotBy,
|
|
6642
|
+
filterValue,
|
|
6227
6643
|
livePagination,
|
|
6228
6644
|
livePaginationCursor,
|
|
6229
6645
|
cursorId: stateCursorId
|
|
6230
6646
|
} = componentState;
|
|
6231
|
-
const [scrollbars, setScrollbars] =
|
|
6647
|
+
const [scrollbars, setScrollbars] = useState10({
|
|
6232
6648
|
vertical: false,
|
|
6233
6649
|
horizontal: false
|
|
6234
6650
|
});
|
|
6235
6651
|
const scrollbarsRef = useRef17(scrollbars);
|
|
6236
|
-
|
|
6652
|
+
useEffect19(() => {
|
|
6237
6653
|
notifyScrollbarsChange.onChange((scrollbars2) => {
|
|
6238
6654
|
if (!scrollbars2) {
|
|
6239
6655
|
return;
|
|
@@ -6243,7 +6659,7 @@ function useLoadData() {
|
|
|
6243
6659
|
});
|
|
6244
6660
|
return () => notifyScrollbarsChange.destroy();
|
|
6245
6661
|
}, [notifyScrollbarsChange]);
|
|
6246
|
-
|
|
6662
|
+
useEffect19(() => {
|
|
6247
6663
|
if (!livePagination) {
|
|
6248
6664
|
return;
|
|
6249
6665
|
}
|
|
@@ -6257,7 +6673,7 @@ function useLoadData() {
|
|
|
6257
6673
|
});
|
|
6258
6674
|
return () => cancelAnimationFrame(frameId);
|
|
6259
6675
|
}, [livePaginationCursor]);
|
|
6260
|
-
|
|
6676
|
+
useEffect19(() => {
|
|
6261
6677
|
if (!livePagination || livePaginationCursor !== void 0) {
|
|
6262
6678
|
return;
|
|
6263
6679
|
}
|
|
@@ -6271,7 +6687,7 @@ function useLoadData() {
|
|
|
6271
6687
|
});
|
|
6272
6688
|
return () => cancelAnimationFrame(frameId);
|
|
6273
6689
|
}, [dataArray.length, livePaginationCursor]);
|
|
6274
|
-
|
|
6690
|
+
useEffect19(() => {
|
|
6275
6691
|
const state = getComponentState();
|
|
6276
6692
|
const { livePaginationCursor: livePaginationCursor2, livePagination: livePagination2, dataArray: dataArray2 } = state;
|
|
6277
6693
|
if (!scrollbars.vertical && livePagination2) {
|
|
@@ -6286,6 +6702,7 @@ function useLoadData() {
|
|
|
6286
6702
|
sortInfo,
|
|
6287
6703
|
groupBy,
|
|
6288
6704
|
pivotBy,
|
|
6705
|
+
filterValue,
|
|
6289
6706
|
cursorId: livePagination ? stateCursorId : null
|
|
6290
6707
|
};
|
|
6291
6708
|
const initialRef = useRef17(true);
|
|
@@ -6320,7 +6737,7 @@ function useLazyLoadRange() {
|
|
|
6320
6737
|
componentActions: actions,
|
|
6321
6738
|
componentState
|
|
6322
6739
|
} = useComponentState();
|
|
6323
|
-
|
|
6740
|
+
useEffect19(() => {
|
|
6324
6741
|
actions.lazyLoadCacheOfLoadedBatches = new DeepMap();
|
|
6325
6742
|
}, [componentState.data, componentState.dataParams]);
|
|
6326
6743
|
const {
|
|
@@ -6348,8 +6765,8 @@ function useLazyLoadRange() {
|
|
|
6348
6765
|
componentActions: actions
|
|
6349
6766
|
}, cache);
|
|
6350
6767
|
};
|
|
6351
|
-
const debouncedLoadRange =
|
|
6352
|
-
|
|
6768
|
+
const debouncedLoadRange = useMemo8(() => debounce(loadRange, { wait: scrollStopDelayUpdatedByTable }), [scrollStopDelayUpdatedByTable]);
|
|
6769
|
+
useEffect19(() => {
|
|
6353
6770
|
if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
|
|
6354
6771
|
return notifyRenderRangeChange.onChange((renderRange) => {
|
|
6355
6772
|
latestRenderRangeRef.current = renderRange;
|
|
@@ -6358,7 +6775,7 @@ function useLazyLoadRange() {
|
|
|
6358
6775
|
}
|
|
6359
6776
|
return;
|
|
6360
6777
|
}, [lazyLoadBatchSize]);
|
|
6361
|
-
|
|
6778
|
+
useEffect19(() => {
|
|
6362
6779
|
if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
|
|
6363
6780
|
debouncedLoadRange();
|
|
6364
6781
|
}
|
|
@@ -6391,7 +6808,7 @@ function lazyLoadRange(options, cache) {
|
|
|
6391
6808
|
theGroupKeys.pop();
|
|
6392
6809
|
}
|
|
6393
6810
|
const cacheKeys = theGroupKeys.length ? theGroupKeys : rootGroupKeys;
|
|
6394
|
-
const indexInGroup = rowInfo.
|
|
6811
|
+
const indexInGroup = rowInfo.dataSourceHasGrouping ? rowInfo.indexInGroup : rowInfo.indexInAll;
|
|
6395
6812
|
if (rowInfo.isGroupRow && !rowInfo.collapsed && !rowInfo.childrenAvailable) {
|
|
6396
6813
|
const currentFnCall = {
|
|
6397
6814
|
lazyLoadStartIndex: 0,
|
|
@@ -6414,7 +6831,7 @@ function lazyLoadRange(options, cache) {
|
|
|
6414
6831
|
if (!rowLoaded) {
|
|
6415
6832
|
let cachedFnCalls = perGroupFnCalls.get(cacheKeys);
|
|
6416
6833
|
const batchStartIndexInGroup = Math.floor(indexInGroup / lazyLoadBatchSize) * lazyLoadBatchSize;
|
|
6417
|
-
const offset =
|
|
6834
|
+
const offset = indexInGroup - batchStartIndexInGroup;
|
|
6418
6835
|
const absoluteIndexOfBatchStart = dataArray[rowInfo.indexInAll - offset].indexInAll;
|
|
6419
6836
|
const batchStartRowLoaded = isRowLoaded(absoluteIndexOfBatchStart);
|
|
6420
6837
|
const batchStartRowId = dataArray[absoluteIndexOfBatchStart].id;
|
|
@@ -6512,116 +6929,6 @@ function discardCallsWithEqualArg(fn, timeframe = 50, getCompareObject) {
|
|
|
6512
6929
|
};
|
|
6513
6930
|
}
|
|
6514
6931
|
|
|
6515
|
-
// src/components/DataSource/GroupRowsState.ts
|
|
6516
|
-
var GroupRowsState = class {
|
|
6517
|
-
constructor(state) {
|
|
6518
|
-
this.update(state instanceof GroupRowsState ? state.getState() : state);
|
|
6519
|
-
}
|
|
6520
|
-
getState() {
|
|
6521
|
-
var _a, _b, _c, _d;
|
|
6522
|
-
return {
|
|
6523
|
-
expandedRows: this.expandedAll ? true : (_b = (_a = this.expandedMap) == null ? void 0 : _a.topDownKeys()) != null ? _b : [],
|
|
6524
|
-
collapsedRows: this.collapsedAll ? true : (_d = (_c = this.collapsedMap) == null ? void 0 : _c.topDownKeys()) != null ? _d : []
|
|
6525
|
-
};
|
|
6526
|
-
}
|
|
6527
|
-
destroy() {
|
|
6528
|
-
var _a, _b;
|
|
6529
|
-
(_a = this.expandedMap) == null ? void 0 : _a.clear();
|
|
6530
|
-
(_b = this.collapsedMap) == null ? void 0 : _b.clear();
|
|
6531
|
-
delete this.expandedMap;
|
|
6532
|
-
delete this.collapsedMap;
|
|
6533
|
-
}
|
|
6534
|
-
update(state) {
|
|
6535
|
-
var _a, _b, _c, _d;
|
|
6536
|
-
this.initialState = state;
|
|
6537
|
-
const { collapsedRows, expandedRows } = this.initialState;
|
|
6538
|
-
this.collapsedAll = collapsedRows === true;
|
|
6539
|
-
this.expandedAll = expandedRows === true;
|
|
6540
|
-
if (this.collapsedAll && this.expandedAll) {
|
|
6541
|
-
throw `Cannot have both collapsedRows and expandedRows be true!`;
|
|
6542
|
-
}
|
|
6543
|
-
if (collapsedRows !== true) {
|
|
6544
|
-
(_a = this.collapsedMap) == null ? void 0 : _a.clear();
|
|
6545
|
-
this.collapsedMap = (_b = this.collapsedMap) != null ? _b : new DeepMap(collapsedRows.map((keys) => [keys, true]));
|
|
6546
|
-
}
|
|
6547
|
-
if (expandedRows !== true) {
|
|
6548
|
-
(_c = this.expandedMap) == null ? void 0 : _c.clear();
|
|
6549
|
-
this.expandedMap = (_d = this.expandedMap) != null ? _d : new DeepMap(expandedRows.map((keys) => [keys, true]));
|
|
6550
|
-
}
|
|
6551
|
-
}
|
|
6552
|
-
areAllCollapsed() {
|
|
6553
|
-
return this.collapsedAll && (this.expandedMap ? this.expandedMap.size === 0 : true);
|
|
6554
|
-
}
|
|
6555
|
-
areAllExpanded() {
|
|
6556
|
-
return this.expandedAll && (this.collapsedMap ? this.collapsedMap.size === 0 : true);
|
|
6557
|
-
}
|
|
6558
|
-
collapseAll() {
|
|
6559
|
-
this.update({
|
|
6560
|
-
collapsedRows: true,
|
|
6561
|
-
expandedRows: []
|
|
6562
|
-
});
|
|
6563
|
-
}
|
|
6564
|
-
expandAll() {
|
|
6565
|
-
this.update({
|
|
6566
|
-
expandedRows: true,
|
|
6567
|
-
collapsedRows: []
|
|
6568
|
-
});
|
|
6569
|
-
}
|
|
6570
|
-
isGroupRowExpanded(keys) {
|
|
6571
|
-
var _a, _b;
|
|
6572
|
-
if (this.expandedAll === true) {
|
|
6573
|
-
if (this.collapsedAll === true) {
|
|
6574
|
-
throw 'Cannot have both expandedRows and collapsedRows be "true"';
|
|
6575
|
-
}
|
|
6576
|
-
return !((_a = this.collapsedMap) == null ? void 0 : _a.has(keys));
|
|
6577
|
-
}
|
|
6578
|
-
return (_b = this.expandedMap) == null ? void 0 : _b.has(keys);
|
|
6579
|
-
}
|
|
6580
|
-
isGroupRowCollapsed(keys) {
|
|
6581
|
-
return !this.isGroupRowExpanded(keys);
|
|
6582
|
-
}
|
|
6583
|
-
setGroupRowExpanded(keys, shouldExpand) {
|
|
6584
|
-
var _a;
|
|
6585
|
-
if (shouldExpand === this.isGroupRowExpanded(keys)) {
|
|
6586
|
-
return;
|
|
6587
|
-
}
|
|
6588
|
-
if (shouldExpand) {
|
|
6589
|
-
if (this.collapsedAll === true) {
|
|
6590
|
-
if (!this.expandedMap) {
|
|
6591
|
-
throw `No expandedMap found when trying to expand group row ${keys.join(",")}`;
|
|
6592
|
-
}
|
|
6593
|
-
this.expandedMap.set(keys, true);
|
|
6594
|
-
} else if (this.expandedAll === true) {
|
|
6595
|
-
if (!this.collapsedMap) {
|
|
6596
|
-
throw `No collapsedMap found when trying to expand group row ${keys.join(",")}`;
|
|
6597
|
-
}
|
|
6598
|
-
this.collapsedMap.delete(keys);
|
|
6599
|
-
}
|
|
6600
|
-
} else {
|
|
6601
|
-
if (this.expandedAll === true) {
|
|
6602
|
-
if (!this.collapsedMap) {
|
|
6603
|
-
throw `No collapsedMap found when trying to collapse group row ${keys.join(",")}`;
|
|
6604
|
-
}
|
|
6605
|
-
this.collapsedMap.set(keys, true);
|
|
6606
|
-
} else if (this.collapsedAll === true) {
|
|
6607
|
-
if (!this.expandedMap) {
|
|
6608
|
-
throw `No expandedMap found when trying to collapse group row ${keys.join(",")}`;
|
|
6609
|
-
}
|
|
6610
|
-
(_a = this.expandedMap) == null ? void 0 : _a.delete(keys);
|
|
6611
|
-
}
|
|
6612
|
-
}
|
|
6613
|
-
}
|
|
6614
|
-
collapseGroupRow(keys) {
|
|
6615
|
-
this.setGroupRowExpanded(keys, false);
|
|
6616
|
-
}
|
|
6617
|
-
expandGroupRow(keys) {
|
|
6618
|
-
this.setGroupRowExpanded(keys, true);
|
|
6619
|
-
}
|
|
6620
|
-
toggleGroupRow(keys) {
|
|
6621
|
-
this.setGroupRowExpanded(keys, !this.isGroupRowExpanded(keys));
|
|
6622
|
-
}
|
|
6623
|
-
};
|
|
6624
|
-
|
|
6625
6932
|
// src/components/DataSource/state/normalizeSortInfo.ts
|
|
6626
6933
|
var EMPTY_ARRAY = Object.freeze([]);
|
|
6627
6934
|
var normalizeSortInfo = (initialSortInfo, weakMap) => {
|
|
@@ -6667,9 +6974,12 @@ function initSetupState() {
|
|
|
6667
6974
|
pivotColumns: void 0,
|
|
6668
6975
|
pivotColumnGroups: void 0,
|
|
6669
6976
|
dataArray,
|
|
6977
|
+
unfilteredCount: dataArray.length,
|
|
6978
|
+
filteredCount: dataArray.length,
|
|
6670
6979
|
updatedAt: now,
|
|
6671
6980
|
groupedAt: 0,
|
|
6672
6981
|
sortedAt: 0,
|
|
6982
|
+
filteredAt: 0,
|
|
6673
6983
|
reducedAt: now,
|
|
6674
6984
|
generateGroupRows: true,
|
|
6675
6985
|
groupDeepMap: void 0,
|
|
@@ -6692,6 +7002,15 @@ var forwardProps2 = (setupState) => {
|
|
|
6692
7002
|
pivotBy: 1,
|
|
6693
7003
|
primaryKey: 1,
|
|
6694
7004
|
livePagination: 1,
|
|
7005
|
+
filterFunction: 1,
|
|
7006
|
+
filterValue: 1,
|
|
7007
|
+
filterDelay: (filterDelay) => filterDelay != null ? filterDelay : 200,
|
|
7008
|
+
filterTypes: (filterTypes) => {
|
|
7009
|
+
return __spreadValues(__spreadValues({}, defaultFilterTypes), filterTypes);
|
|
7010
|
+
},
|
|
7011
|
+
sortTypes: (sortTypes) => {
|
|
7012
|
+
return __spreadValues(__spreadValues({}, sortTypes_default), sortTypes);
|
|
7013
|
+
},
|
|
6695
7014
|
aggregationReducers: 1,
|
|
6696
7015
|
collapseGroupRowsOnDataFunctionChange: (collapseGroupRowsOnDataFunctionChange) => collapseGroupRowsOnDataFunctionChange != null ? collapseGroupRowsOnDataFunctionChange : true,
|
|
6697
7016
|
loading: (loading) => loading != null ? loading : false,
|
|
@@ -6717,10 +7036,25 @@ function getLivePaginationCursorValue(livePaginationCursorProp, state) {
|
|
|
6717
7036
|
return livePaginationCursor;
|
|
6718
7037
|
}
|
|
6719
7038
|
function mapPropsToState(params) {
|
|
7039
|
+
var _a;
|
|
6720
7040
|
const { props, state, oldState } = params;
|
|
6721
7041
|
const controlledSort = isControlledValue(props.sortInfo);
|
|
7042
|
+
const controlledFilter = isControlledValue(props.filterValue);
|
|
7043
|
+
const { filterTypes } = state;
|
|
7044
|
+
const operatorsByFilterType = Object.keys(filterTypes).reduce((acc, key) => {
|
|
7045
|
+
const operators = filterTypes[key].operators;
|
|
7046
|
+
acc[key] = acc[key] || {};
|
|
7047
|
+
const currentFilterTypeOperators = acc[key];
|
|
7048
|
+
operators.forEach((operator) => {
|
|
7049
|
+
currentFilterTypeOperators[operator.name] = operator;
|
|
7050
|
+
});
|
|
7051
|
+
return acc;
|
|
7052
|
+
}, {});
|
|
6722
7053
|
const result = {
|
|
7054
|
+
operatorsByFilterType,
|
|
6723
7055
|
controlledSort,
|
|
7056
|
+
controlledFilter,
|
|
7057
|
+
filterMode: ((_a = props.filterMode) != null ? _a : props.filterFunction != null) ? "client" : typeof props.data === "function" ? "server" : "client",
|
|
6724
7058
|
multiSort: Array.isArray(controlledSort ? props.sortInfo : props.defaultSortInfo),
|
|
6725
7059
|
lazyLoadBatchSize: typeof props.lazyLoad === "object" ? props.lazyLoad.batchSize : void 0
|
|
6726
7060
|
};
|
|
@@ -6785,6 +7119,18 @@ function getInterceptActions() {
|
|
|
6785
7119
|
});
|
|
6786
7120
|
}
|
|
6787
7121
|
},
|
|
7122
|
+
filterValue: (filterValue, { actions, state }) => {
|
|
7123
|
+
const dataParams = buildDataSourceDataParams(state, {
|
|
7124
|
+
filterValue,
|
|
7125
|
+
livePaginationCursor: null
|
|
7126
|
+
});
|
|
7127
|
+
actions.dataParams = dataParams;
|
|
7128
|
+
if (state.livePagination) {
|
|
7129
|
+
requestAnimationFrame(() => {
|
|
7130
|
+
actions.livePaginationCursor = null;
|
|
7131
|
+
});
|
|
7132
|
+
}
|
|
7133
|
+
},
|
|
6788
7134
|
cursorId: (cursorId, { actions, state }) => {
|
|
6789
7135
|
const dataParams = buildDataSourceDataParams(state, {
|
|
6790
7136
|
__cursorId: cursorId
|
|
@@ -6866,7 +7212,7 @@ function getPivotColumnsAndColumnGroups({
|
|
|
6866
7212
|
pivotGroupKeys: [],
|
|
6867
7213
|
pivotGroupKey: "",
|
|
6868
7214
|
pivotIndex: -1,
|
|
6869
|
-
|
|
7215
|
+
valueFormatter: ({ rowInfo }) => {
|
|
6870
7216
|
var _a;
|
|
6871
7217
|
return rowInfo.isGroupRow ? (_a = rowInfo.reducerResults) == null ? void 0 : _a[reducer.id] : null;
|
|
6872
7218
|
}
|
|
@@ -6915,7 +7261,7 @@ function getPivotColumnsAndColumnGroups({
|
|
|
6915
7261
|
sortable: false,
|
|
6916
7262
|
columnGroup: parentColumnGroupId,
|
|
6917
7263
|
header,
|
|
6918
|
-
|
|
7264
|
+
valueFormatter: ({ rowInfo }) => {
|
|
6919
7265
|
var _a, _b;
|
|
6920
7266
|
if (!rowInfo.isGroupRow) {
|
|
6921
7267
|
return null;
|
|
@@ -6970,7 +7316,7 @@ function getPivotColumnsAndColumnGroups({
|
|
|
6970
7316
|
pivotIndex: keys.length - 1,
|
|
6971
7317
|
pivotBy,
|
|
6972
7318
|
sortable: false,
|
|
6973
|
-
|
|
7319
|
+
valueFormatter: ({ rowInfo }) => {
|
|
6974
7320
|
var _a, _b;
|
|
6975
7321
|
if (!rowInfo.isGroupRow) {
|
|
6976
7322
|
return null;
|
|
@@ -7018,9 +7364,68 @@ function toRowInfo(data, id, index) {
|
|
|
7018
7364
|
selfLoaded: true
|
|
7019
7365
|
};
|
|
7020
7366
|
}
|
|
7367
|
+
function filterDataSource(params) {
|
|
7368
|
+
const {
|
|
7369
|
+
filterTypes,
|
|
7370
|
+
filterValue: filterValueArray,
|
|
7371
|
+
operatorsByFilterType,
|
|
7372
|
+
filterFunction,
|
|
7373
|
+
toPrimaryKey
|
|
7374
|
+
} = params;
|
|
7375
|
+
let { dataArray } = params;
|
|
7376
|
+
if (filterFunction) {
|
|
7377
|
+
dataArray = dataArray.filter((data, index, arr) => filterFunction({
|
|
7378
|
+
data,
|
|
7379
|
+
index,
|
|
7380
|
+
dataArray: arr,
|
|
7381
|
+
primaryKey: toPrimaryKey(data, index)
|
|
7382
|
+
}));
|
|
7383
|
+
}
|
|
7384
|
+
if (filterValueArray && filterValueArray.length) {
|
|
7385
|
+
return dataArray.filter((data, index, arr) => {
|
|
7386
|
+
var _a;
|
|
7387
|
+
const param = {
|
|
7388
|
+
data,
|
|
7389
|
+
index,
|
|
7390
|
+
dataArray: arr,
|
|
7391
|
+
primaryKey: toPrimaryKey(data, index)
|
|
7392
|
+
};
|
|
7393
|
+
for (let i = 0, len = filterValueArray.length; i < len; i++) {
|
|
7394
|
+
const currentFilterValue = filterValueArray[i];
|
|
7395
|
+
const {
|
|
7396
|
+
disabled,
|
|
7397
|
+
filterValue,
|
|
7398
|
+
field,
|
|
7399
|
+
filterType: filterTypeKey,
|
|
7400
|
+
valueGetter,
|
|
7401
|
+
operator
|
|
7402
|
+
} = currentFilterValue;
|
|
7403
|
+
const filterType = filterTypes[filterTypeKey];
|
|
7404
|
+
if (disabled || !filterType) {
|
|
7405
|
+
continue;
|
|
7406
|
+
}
|
|
7407
|
+
const currentOperator = (_a = operatorsByFilterType[filterTypeKey]) == null ? void 0 : _a[operator];
|
|
7408
|
+
if (!currentOperator) {
|
|
7409
|
+
continue;
|
|
7410
|
+
}
|
|
7411
|
+
const getter = valueGetter || (({ data: data2 }) => field ? data2[field] : data2);
|
|
7412
|
+
const operatorFnParam = __spreadValues({}, param);
|
|
7413
|
+
operatorFnParam.filterValue = filterValue;
|
|
7414
|
+
operatorFnParam.currentValue = getter(param);
|
|
7415
|
+
operatorFnParam.emptyValues = filterType.emptyValues;
|
|
7416
|
+
if (!currentOperator.fn(operatorFnParam)) {
|
|
7417
|
+
return false;
|
|
7418
|
+
}
|
|
7419
|
+
}
|
|
7420
|
+
return true;
|
|
7421
|
+
});
|
|
7422
|
+
}
|
|
7423
|
+
return dataArray;
|
|
7424
|
+
}
|
|
7021
7425
|
function concludeReducer(params) {
|
|
7022
7426
|
var _a, _b;
|
|
7023
7427
|
const { state, previousState } = params;
|
|
7428
|
+
const primaryKeyDescriptor = state.primaryKey;
|
|
7024
7429
|
const sortInfo = state.sortInfo;
|
|
7025
7430
|
let shouldSort = !!(sortInfo == null ? void 0 : sortInfo.length) && !state.controlledSort;
|
|
7026
7431
|
if (state.lazyLoad || state.livePagination) {
|
|
@@ -7038,15 +7443,24 @@ function concludeReducer(params) {
|
|
|
7038
7443
|
state.originalLazyGroupData = new DeepMap();
|
|
7039
7444
|
originalDataArrayChanged = true;
|
|
7040
7445
|
}
|
|
7446
|
+
const { filterFunction, filterValue, filterTypes, operatorsByFilterType } = state;
|
|
7447
|
+
const shouldFilter = !!filterFunction || Array.isArray(filterValue) && filterValue.length;
|
|
7448
|
+
const shouldFilterClientSide = shouldFilter && state.filterMode === "client";
|
|
7449
|
+
const filterDepsChanged = haveDepsChanged(previousState, state, [
|
|
7450
|
+
"filterFunction",
|
|
7451
|
+
"filterValue",
|
|
7452
|
+
"filterTypes"
|
|
7453
|
+
]);
|
|
7454
|
+
const filterChanged = originalDataArrayChanged || filterDepsChanged;
|
|
7041
7455
|
const sortInfoChanged = haveDepsChanged(previousState, state, ["sortInfo"]);
|
|
7042
|
-
const sortDepsChanged = originalDataArrayChanged || sortInfoChanged;
|
|
7456
|
+
const sortDepsChanged = originalDataArrayChanged || filterDepsChanged || sortInfoChanged;
|
|
7457
|
+
const shouldFilterAgain = state.filterMode === "client" && (filterChanged || !state.lastFilterDataArray);
|
|
7043
7458
|
const shouldSortAgain = shouldSort && (sortDepsChanged || !state.lastSortDataArray);
|
|
7044
7459
|
const groupBy = state.groupBy;
|
|
7045
7460
|
const pivotBy = state.pivotBy;
|
|
7046
7461
|
const shouldGroup = groupBy.length > 0 || !!pivotBy;
|
|
7047
|
-
const groupsDepsChanged = originalDataArrayChanged || haveDepsChanged(previousState, state, [
|
|
7462
|
+
const groupsDepsChanged = originalDataArrayChanged || sortDepsChanged || haveDepsChanged(previousState, state, [
|
|
7048
7463
|
"generateGroupRows",
|
|
7049
|
-
"originalDataArray",
|
|
7050
7464
|
"originalLazyGroupData",
|
|
7051
7465
|
"originalLazyGroupDataChangeDetect",
|
|
7052
7466
|
"groupBy",
|
|
@@ -7055,23 +7469,43 @@ function concludeReducer(params) {
|
|
|
7055
7469
|
"aggregationReducers",
|
|
7056
7470
|
"pivotTotalColumnPosition",
|
|
7057
7471
|
"pivotGrandTotalColumnPosition",
|
|
7058
|
-
"showSeparatePivotColumnForSingleAggregation"
|
|
7059
|
-
"sortInfo"
|
|
7472
|
+
"showSeparatePivotColumnForSingleAggregation"
|
|
7060
7473
|
]);
|
|
7061
7474
|
const shouldGroupAgain = shouldGroup && (groupsDepsChanged || !state.lastGroupDataArray);
|
|
7062
7475
|
const now = Date.now();
|
|
7063
7476
|
let dataArray = state.originalDataArray;
|
|
7064
|
-
|
|
7477
|
+
const toPrimaryKey = typeof primaryKeyDescriptor === "function" ? (data, index) => primaryKeyDescriptor({ data, index }) : (data, _index) => {
|
|
7478
|
+
const pk = data[primaryKeyDescriptor];
|
|
7479
|
+
return pk;
|
|
7480
|
+
};
|
|
7481
|
+
if (!shouldFilter) {
|
|
7482
|
+
state.unfilteredCount = dataArray.length;
|
|
7483
|
+
}
|
|
7484
|
+
if (shouldFilterClientSide) {
|
|
7485
|
+
state.unfilteredCount = dataArray.length;
|
|
7486
|
+
dataArray = shouldFilterAgain ? filterDataSource({
|
|
7487
|
+
dataArray,
|
|
7488
|
+
toPrimaryKey,
|
|
7489
|
+
filterTypes,
|
|
7490
|
+
operatorsByFilterType,
|
|
7491
|
+
filterFunction,
|
|
7492
|
+
filterValue
|
|
7493
|
+
}) : state.lastFilterDataArray;
|
|
7494
|
+
state.lastFilterDataArray = dataArray;
|
|
7495
|
+
state.filteredAt = now;
|
|
7496
|
+
}
|
|
7497
|
+
state.filteredCount = dataArray.length;
|
|
7498
|
+
state.postFilterDataArray = dataArray;
|
|
7065
7499
|
if (shouldSort) {
|
|
7500
|
+
const prevKnownTypes = multisort.knownTypes;
|
|
7501
|
+
multisort.knownTypes = state.sortTypes;
|
|
7066
7502
|
dataArray = shouldSortAgain ? multisort(sortInfo, [...dataArray]) : state.lastSortDataArray;
|
|
7503
|
+
multisort.knownTypes = prevKnownTypes;
|
|
7067
7504
|
state.lastSortDataArray = dataArray;
|
|
7068
7505
|
state.sortedAt = now;
|
|
7069
7506
|
}
|
|
7070
7507
|
state.postSortDataArray = dataArray;
|
|
7071
|
-
|
|
7072
|
-
const pk = data[state.primaryKey];
|
|
7073
|
-
return pk;
|
|
7074
|
-
};
|
|
7508
|
+
let rowInfoDataArray = state.dataArray;
|
|
7075
7509
|
if (shouldGroup) {
|
|
7076
7510
|
if (shouldGroupAgain) {
|
|
7077
7511
|
const groupResult = state.lazyLoad ? lazyGroup({
|
|
@@ -7114,7 +7548,7 @@ function concludeReducer(params) {
|
|
|
7114
7548
|
state.pivotColumns = void 0;
|
|
7115
7549
|
const arrayDifferentAfterSortStep = previousState.postSortDataArray != state.postSortDataArray;
|
|
7116
7550
|
if (arrayDifferentAfterSortStep || groupsDepsChanged) {
|
|
7117
|
-
rowInfoDataArray = dataArray.map((data, index) => toRowInfo(data, data ? toPrimaryKey(data) : index, index));
|
|
7551
|
+
rowInfoDataArray = dataArray.map((data, index) => toRowInfo(data, data ? toPrimaryKey(data, index) : index, index));
|
|
7118
7552
|
}
|
|
7119
7553
|
}
|
|
7120
7554
|
state.postGroupDataArray = rowInfoDataArray;
|
|
@@ -7142,7 +7576,7 @@ function DataSourceWithContext(props) {
|
|
|
7142
7576
|
if (typeof children === "function") {
|
|
7143
7577
|
children = children(computedValues);
|
|
7144
7578
|
}
|
|
7145
|
-
return /* @__PURE__ */
|
|
7579
|
+
return /* @__PURE__ */ createElement23(Fragment3, null, children);
|
|
7146
7580
|
}
|
|
7147
7581
|
var DataSourceRoot = getComponentStateRoot({
|
|
7148
7582
|
initSetupState,
|
|
@@ -7165,14 +7599,14 @@ function DataSourceCmp({ children }) {
|
|
|
7165
7599
|
globalThis.getDataSourceState = getState;
|
|
7166
7600
|
}
|
|
7167
7601
|
useLoadData();
|
|
7168
|
-
return /* @__PURE__ */
|
|
7602
|
+
return /* @__PURE__ */ createElement23(DataSourceContext.Provider, {
|
|
7169
7603
|
value: contextValue
|
|
7170
|
-
}, /* @__PURE__ */
|
|
7604
|
+
}, /* @__PURE__ */ createElement23(DataSourceWithContext, {
|
|
7171
7605
|
children
|
|
7172
7606
|
}));
|
|
7173
7607
|
}
|
|
7174
7608
|
function DataSource(props) {
|
|
7175
|
-
return /* @__PURE__ */
|
|
7609
|
+
return /* @__PURE__ */ createElement23(DataSourceRoot, __spreadValues({}, props), /* @__PURE__ */ createElement23(DataSourceCmp, {
|
|
7176
7610
|
children: props.children
|
|
7177
7611
|
}));
|
|
7178
7612
|
}
|
|
@@ -7212,7 +7646,7 @@ function useToggleGroupRow() {
|
|
|
7212
7646
|
|
|
7213
7647
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
7214
7648
|
function useGroupByMap(groupBy) {
|
|
7215
|
-
const groupByMap =
|
|
7649
|
+
const groupByMap = useMemo9(() => {
|
|
7216
7650
|
return groupBy.reduce((acc, groupBy2, index) => {
|
|
7217
7651
|
acc.set(groupBy2.field, {
|
|
7218
7652
|
groupBy: groupBy2,
|
|
@@ -7236,13 +7670,13 @@ function useColumnsWhen() {
|
|
|
7236
7670
|
}
|
|
7237
7671
|
} = useComponentState();
|
|
7238
7672
|
const groupByMap = useGroupByMap(groupBy);
|
|
7239
|
-
|
|
7673
|
+
useEffect20(() => {
|
|
7240
7674
|
dataSourceActions.generateGroupRows = groupRenderStrategy !== "inline";
|
|
7241
7675
|
}, [groupRenderStrategy]);
|
|
7242
|
-
|
|
7676
|
+
useEffect20(() => {
|
|
7243
7677
|
dataSourceActions.pivotTotalColumnPosition = pivotTotalColumnPosition;
|
|
7244
7678
|
}, [pivotTotalColumnPosition]);
|
|
7245
|
-
|
|
7679
|
+
useEffect20(() => {
|
|
7246
7680
|
if (pivotGrandTotalColumnPosition != void 0) {
|
|
7247
7681
|
dataSourceActions.pivotGrandTotalColumnPosition = pivotGrandTotalColumnPosition;
|
|
7248
7682
|
}
|
|
@@ -7272,7 +7706,7 @@ function useColumnsWhenInlineGroupRenderStrategy(groupByMap) {
|
|
|
7272
7706
|
base = {
|
|
7273
7707
|
groupByField: field,
|
|
7274
7708
|
field,
|
|
7275
|
-
|
|
7709
|
+
valueFormatter: ({ rowInfo }) => {
|
|
7276
7710
|
var _a;
|
|
7277
7711
|
return rowInfo.isGroupRow ? (_a = rowInfo.groupKeys) == null ? void 0 : _a[groupIndex] : rowInfo.value;
|
|
7278
7712
|
},
|
|
@@ -7316,7 +7750,7 @@ function useColumnsWhenInlineGroupRenderStrategy(groupByMap) {
|
|
|
7316
7750
|
});
|
|
7317
7751
|
return computedColumns.size === 0 ? void 0 : computedColumns;
|
|
7318
7752
|
}
|
|
7319
|
-
|
|
7753
|
+
useEffect20(() => {
|
|
7320
7754
|
const update = () => {
|
|
7321
7755
|
componentActions.columnsWhenInlineGroupRenderStrategy = computeColumnsWhenInlineGroupRenderStrategy(columns, groupByMap, groupRenderStrategy, toggleGroupRow);
|
|
7322
7756
|
};
|
|
@@ -7345,7 +7779,7 @@ function useColumnsWhenGrouping() {
|
|
|
7345
7779
|
}
|
|
7346
7780
|
} = useComponentState();
|
|
7347
7781
|
const toggleGroupRow = useToggleGroupRow();
|
|
7348
|
-
|
|
7782
|
+
useEffect20(() => {
|
|
7349
7783
|
const update = () => {
|
|
7350
7784
|
const columnsWhenGrouping = getColumnsWhenGrouping({
|
|
7351
7785
|
columns,
|
|
@@ -7481,7 +7915,7 @@ function useHideColumns(groupByMap) {
|
|
|
7481
7915
|
hideEmptyGroupColumns ? groupRowsState : null,
|
|
7482
7916
|
hideEmptyGroupColumns
|
|
7483
7917
|
]);
|
|
7484
|
-
|
|
7918
|
+
useEffect20(() => {
|
|
7485
7919
|
const isGrouped = groupBy.length > 0;
|
|
7486
7920
|
const currentState = getComponentState();
|
|
7487
7921
|
const { controlledColumnVisibility, columnVisibility } = currentState;
|
|
@@ -7596,7 +8030,7 @@ function getColumnsWhenGrouping(params) {
|
|
|
7596
8030
|
}
|
|
7597
8031
|
|
|
7598
8032
|
// src/components/InfiniteTable/hooks/useComputedVisibleColumns.ts
|
|
7599
|
-
import { useMemo as
|
|
8033
|
+
import { useMemo as useMemo10 } from "react";
|
|
7600
8034
|
|
|
7601
8035
|
// src/components/flexbox/index.ts
|
|
7602
8036
|
var computeFlex = (params) => {
|
|
@@ -7753,7 +8187,9 @@ var adjustColumnOrderForPinning = (columnOrder, columnPinning) => {
|
|
|
7753
8187
|
};
|
|
7754
8188
|
|
|
7755
8189
|
// src/components/InfiniteTable/utils/getColumnComputedType.ts
|
|
7756
|
-
var emptyType = Object.freeze({
|
|
8190
|
+
var emptyType = Object.freeze({
|
|
8191
|
+
filterType: "string"
|
|
8192
|
+
});
|
|
7757
8193
|
function getColumnComputedType(column, columnTypes) {
|
|
7758
8194
|
const defaultType = columnTypes["default"] || emptyType;
|
|
7759
8195
|
if (column.type === void 0) {
|
|
@@ -7789,6 +8225,7 @@ var getComputedVisibleColumns = ({
|
|
|
7789
8225
|
columnHeaderCssEllipsis,
|
|
7790
8226
|
pinnedStartMaxWidth,
|
|
7791
8227
|
pinnedEndMaxWidth,
|
|
8228
|
+
filterValue,
|
|
7792
8229
|
sortable,
|
|
7793
8230
|
sortInfo,
|
|
7794
8231
|
setSortInfo,
|
|
@@ -7803,9 +8240,19 @@ var getComputedVisibleColumns = ({
|
|
|
7803
8240
|
columnVisibilityAssumeVisible
|
|
7804
8241
|
}) => {
|
|
7805
8242
|
let computedOffset = 0;
|
|
8243
|
+
const filterValueRecord = (filterValue || []).reduce((acc, filterValueItem) => {
|
|
8244
|
+
const { id, field } = filterValueItem;
|
|
8245
|
+
if (field) {
|
|
8246
|
+
acc[field] = filterValueItem;
|
|
8247
|
+
}
|
|
8248
|
+
if (id) {
|
|
8249
|
+
acc[id] = filterValueItem;
|
|
8250
|
+
}
|
|
8251
|
+
return acc;
|
|
8252
|
+
}, {});
|
|
7806
8253
|
const normalizedColumnOrder = adjustColumnOrderForPinning(columnOrder === true ? [...columns.keys()] : columnOrder, columnPinning);
|
|
7807
8254
|
const visibleColumnOrder = normalizedColumnOrder.filter((colId) => {
|
|
7808
|
-
|
|
8255
|
+
const col = columns.get(colId);
|
|
7809
8256
|
if (!col) {
|
|
7810
8257
|
logError(`Column with id "${colId}" specified in columnOrder array cannot be found in the columns map.`);
|
|
7811
8258
|
return false;
|
|
@@ -7853,7 +8300,7 @@ var getComputedVisibleColumns = ({
|
|
|
7853
8300
|
delete colTypeSizing.width;
|
|
7854
8301
|
}
|
|
7855
8302
|
colSizing = assignNonNull(colTypeSizing, colSizing);
|
|
7856
|
-
|
|
8303
|
+
const colFlex = (_a = colSizing.flex) != null ? _a : void 0;
|
|
7857
8304
|
const colMinWidth = (_c = (_b = colSizing.minWidth) != null ? _b : column == null ? void 0 : column.minWidth) != null ? _c : columnMinWidth;
|
|
7858
8305
|
const colMaxWidth = (_e = (_d = colSizing.maxWidth) != null ? _d : column == null ? void 0 : column.maxWidth) != null ? _e : columnMaxWidth;
|
|
7859
8306
|
let size = colFlex != void 0 ? void 0 : (_f = colSizing.width) != null ? _f : columnDefaultWidth;
|
|
@@ -7896,7 +8343,7 @@ var getComputedVisibleColumns = ({
|
|
|
7896
8343
|
});
|
|
7897
8344
|
const firstPinnedEndAbsoluteOffset = bodySize.width - totalPinnedEndWidth;
|
|
7898
8345
|
columnsArray.forEach((c, i) => {
|
|
7899
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
|
|
8346
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
|
|
7900
8347
|
const id = visibleColumnOrder[i];
|
|
7901
8348
|
const nextColumnId = visibleColumnOrder[i + 1];
|
|
7902
8349
|
const colType = getColumnComputedType(c, columnTypes);
|
|
@@ -7907,47 +8354,6 @@ var getComputedVisibleColumns = ({
|
|
|
7907
8354
|
const computedSortedDesc = computedSorted && !computedSortedAsc;
|
|
7908
8355
|
const computedSortIndex = (_c = sortingInfo == null ? void 0 : sortingInfo.index) != null ? _c : -1;
|
|
7909
8356
|
const computedWidth = computedSizes[i];
|
|
7910
|
-
const toggleSort = () => {
|
|
7911
|
-
let currentSortInfo = computedSortInfo;
|
|
7912
|
-
let newColumnSortInfo;
|
|
7913
|
-
if (!currentSortInfo) {
|
|
7914
|
-
newColumnSortInfo = {
|
|
7915
|
-
dir: 1,
|
|
7916
|
-
id,
|
|
7917
|
-
field: c.field,
|
|
7918
|
-
type: c.type
|
|
7919
|
-
};
|
|
7920
|
-
} else {
|
|
7921
|
-
if (computedSortedDesc) {
|
|
7922
|
-
newColumnSortInfo = null;
|
|
7923
|
-
} else {
|
|
7924
|
-
newColumnSortInfo = __spreadProps(__spreadValues({}, computedSortInfo), {
|
|
7925
|
-
dir: -1
|
|
7926
|
-
});
|
|
7927
|
-
}
|
|
7928
|
-
}
|
|
7929
|
-
if (c.field && newColumnSortInfo && !newColumnSortInfo.field) {
|
|
7930
|
-
newColumnSortInfo.field = c.field;
|
|
7931
|
-
}
|
|
7932
|
-
let finalSortInfo = sortInfo ? [...sortInfo] : [];
|
|
7933
|
-
if (multiSort) {
|
|
7934
|
-
if (computedSortIndex === -1) {
|
|
7935
|
-
if (newColumnSortInfo) {
|
|
7936
|
-
finalSortInfo.push(newColumnSortInfo);
|
|
7937
|
-
}
|
|
7938
|
-
} else {
|
|
7939
|
-
finalSortInfo = finalSortInfo.map((info, index) => {
|
|
7940
|
-
if (index === computedSortIndex) {
|
|
7941
|
-
return newColumnSortInfo;
|
|
7942
|
-
}
|
|
7943
|
-
return info;
|
|
7944
|
-
}).filter((x) => x != null);
|
|
7945
|
-
}
|
|
7946
|
-
} else {
|
|
7947
|
-
finalSortInfo = newColumnSortInfo ? [newColumnSortInfo] : [];
|
|
7948
|
-
}
|
|
7949
|
-
setSortInfo(finalSortInfo);
|
|
7950
|
-
};
|
|
7951
8357
|
const computedPinned = getComputedPinned(id, columnPinning);
|
|
7952
8358
|
const computedLast = i === visibleColumnOrder.length - 1;
|
|
7953
8359
|
const computedPinningOffset = computedPinned === "start" ? computedPinnedStartColumnsWidth : computedPinned === "end" ? computedPinnedEndColumnsWidth : computedOffset - computedPinnedStartColumnsWidth;
|
|
@@ -7956,23 +8362,36 @@ var getComputedVisibleColumns = ({
|
|
|
7956
8362
|
const computedLastInCategory = computedLast || computedPinned !== getComputedPinned(nextColumnId, columnPinning);
|
|
7957
8363
|
const cssEllipsis = (_e = (_d = c.cssEllipsis) != null ? _d : colType.cssEllipsis) != null ? _e : columnCssEllipsis;
|
|
7958
8364
|
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;
|
|
8365
|
+
const computedFilterValue = filterValueRecord[id] || c.field ? filterValueRecord[c.field] || null : null;
|
|
8366
|
+
const computedFiltered = computedFilterValue != null;
|
|
8367
|
+
const computedFilterable = (_l = (_k = c.defaultFilterable) != null ? _k : colType.defaultFilterable) != null ? _l : true;
|
|
8368
|
+
const computedDataType = c.dataType || colType.dataType || (Array.isArray(c.type) ? c.type[0] : c.type) || "string";
|
|
8369
|
+
const computedSortType = c.sortType || colType.sortType || computedDataType;
|
|
8370
|
+
const computedFilterType = c.filterType || colType.filterType || computedDataType;
|
|
7959
8371
|
const result2 = __spreadProps(__spreadValues({
|
|
7960
8372
|
align: colType.align,
|
|
7961
8373
|
verticalAlign: colType.verticalAlign,
|
|
7962
8374
|
defaultHiddenWhenGroupedBy: colType.defaultHiddenWhenGroupedBy,
|
|
7963
8375
|
valueGetter: colType.valueGetter,
|
|
8376
|
+
valueFormatter: colType.valueFormatter,
|
|
7964
8377
|
renderValue: colType.renderValue,
|
|
7965
8378
|
render: colType.render,
|
|
7966
8379
|
style: colType.style,
|
|
7967
8380
|
components: colType.components
|
|
7968
8381
|
}, c), {
|
|
8382
|
+
computedDataType,
|
|
8383
|
+
computedSortType,
|
|
8384
|
+
computedFilterType,
|
|
7969
8385
|
cssEllipsis,
|
|
7970
8386
|
headerCssEllipsis,
|
|
8387
|
+
computedFilterValue,
|
|
8388
|
+
computedFiltered,
|
|
8389
|
+
computedFilterable,
|
|
7971
8390
|
computedWidth,
|
|
7972
8391
|
computedAbsoluteOffset,
|
|
7973
8392
|
computedPinningOffset,
|
|
7974
8393
|
computedOffset,
|
|
7975
|
-
computedSortable: (
|
|
8394
|
+
computedSortable: (_o = (_n = (_m = c.sortable) != null ? _m : colType.sortable) != null ? _n : sortable) != null ? _o : true,
|
|
7976
8395
|
computedSortInfo,
|
|
7977
8396
|
computedSortIndex,
|
|
7978
8397
|
computedMultiSort: multiSort,
|
|
@@ -7981,14 +8400,57 @@ var getComputedVisibleColumns = ({
|
|
|
7981
8400
|
computedSortedDesc,
|
|
7982
8401
|
computedVisibleIndex: i,
|
|
7983
8402
|
computedPinned,
|
|
7984
|
-
computedDraggable: (
|
|
8403
|
+
computedDraggable: (_q = (_p = c.draggable) != null ? _p : draggableColumns) != null ? _q : true,
|
|
7985
8404
|
computedFirstInCategory,
|
|
7986
8405
|
computedLastInCategory,
|
|
7987
8406
|
computedFirst: i === 0,
|
|
7988
8407
|
computedLast,
|
|
7989
|
-
toggleSort
|
|
8408
|
+
toggleSort: () => {
|
|
8409
|
+
const currentSortInfo = computedSortInfo;
|
|
8410
|
+
let newColumnSortInfo;
|
|
8411
|
+
if (!currentSortInfo) {
|
|
8412
|
+
newColumnSortInfo = {
|
|
8413
|
+
dir: 1,
|
|
8414
|
+
id,
|
|
8415
|
+
field: c.field,
|
|
8416
|
+
type: computedSortType
|
|
8417
|
+
};
|
|
8418
|
+
} else {
|
|
8419
|
+
if (computedSortedDesc) {
|
|
8420
|
+
newColumnSortInfo = null;
|
|
8421
|
+
} else {
|
|
8422
|
+
newColumnSortInfo = __spreadProps(__spreadValues({}, computedSortInfo), {
|
|
8423
|
+
dir: -1
|
|
8424
|
+
});
|
|
8425
|
+
}
|
|
8426
|
+
}
|
|
8427
|
+
if (c.field && newColumnSortInfo && !newColumnSortInfo.field) {
|
|
8428
|
+
newColumnSortInfo.field = c.field;
|
|
8429
|
+
}
|
|
8430
|
+
if (c.valueGetter && newColumnSortInfo && !newColumnSortInfo.valueGetter) {
|
|
8431
|
+
newColumnSortInfo.valueGetter = (data) => c.valueGetter({ data, field: c.field });
|
|
8432
|
+
}
|
|
8433
|
+
let finalSortInfo = sortInfo ? [...sortInfo] : [];
|
|
8434
|
+
if (multiSort) {
|
|
8435
|
+
if (computedSortIndex === -1) {
|
|
8436
|
+
if (newColumnSortInfo) {
|
|
8437
|
+
finalSortInfo.push(newColumnSortInfo);
|
|
8438
|
+
}
|
|
8439
|
+
} else {
|
|
8440
|
+
finalSortInfo = finalSortInfo.map((info, index) => {
|
|
8441
|
+
if (index === computedSortIndex) {
|
|
8442
|
+
return newColumnSortInfo;
|
|
8443
|
+
}
|
|
8444
|
+
return info;
|
|
8445
|
+
}).filter((x) => x != null);
|
|
8446
|
+
}
|
|
8447
|
+
} else {
|
|
8448
|
+
finalSortInfo = newColumnSortInfo ? [newColumnSortInfo] : [];
|
|
8449
|
+
}
|
|
8450
|
+
setSortInfo(finalSortInfo);
|
|
8451
|
+
},
|
|
7990
8452
|
id,
|
|
7991
|
-
header: (
|
|
8453
|
+
header: (_t = (_s = (_r = c.header) != null ? _r : colType.header) != null ? _s : c.name) != null ? _t : c.field
|
|
7992
8454
|
});
|
|
7993
8455
|
computedOffset += computedWidth;
|
|
7994
8456
|
computedVisibleColumnsMap.set(result2.id, result2);
|
|
@@ -8029,10 +8491,10 @@ var getComputedVisibleColumns = ({
|
|
|
8029
8491
|
};
|
|
8030
8492
|
|
|
8031
8493
|
// src/components/InfiniteTable/hooks/useRerenderOnKeyChange.ts
|
|
8032
|
-
import { useEffect as
|
|
8494
|
+
import { useEffect as useEffect21 } from "react";
|
|
8033
8495
|
var useRerenderOnKeyChange = (map2) => {
|
|
8034
8496
|
const [renderId, rerender] = useRerender();
|
|
8035
|
-
|
|
8497
|
+
useEffect21(() => {
|
|
8036
8498
|
const update = rafFn(rerender);
|
|
8037
8499
|
return interceptMap(map2, {
|
|
8038
8500
|
set: update,
|
|
@@ -8057,6 +8519,7 @@ var useComputedVisibleColumns = ({
|
|
|
8057
8519
|
sortInfo,
|
|
8058
8520
|
multiSort,
|
|
8059
8521
|
setSortInfo,
|
|
8522
|
+
filterValue,
|
|
8060
8523
|
columnOrder,
|
|
8061
8524
|
columnPinning,
|
|
8062
8525
|
columnTypes,
|
|
@@ -8084,7 +8547,7 @@ var useComputedVisibleColumns = ({
|
|
|
8084
8547
|
computedPinnedEndOffset,
|
|
8085
8548
|
computedPinnedEndWidth,
|
|
8086
8549
|
computedPinnedStartWidth
|
|
8087
|
-
} =
|
|
8550
|
+
} = useMemo10(() => {
|
|
8088
8551
|
return getComputedVisibleColumns({
|
|
8089
8552
|
columns,
|
|
8090
8553
|
bodySize,
|
|
@@ -8094,6 +8557,7 @@ var useComputedVisibleColumns = ({
|
|
|
8094
8557
|
columnCssEllipsis,
|
|
8095
8558
|
columnHeaderCssEllipsis,
|
|
8096
8559
|
viewportReservedWidth,
|
|
8560
|
+
filterValue,
|
|
8097
8561
|
sortable,
|
|
8098
8562
|
sortInfo,
|
|
8099
8563
|
setSortInfo,
|
|
@@ -8118,6 +8582,7 @@ var useComputedVisibleColumns = ({
|
|
|
8118
8582
|
sortInfo,
|
|
8119
8583
|
setSortInfo,
|
|
8120
8584
|
multiSort,
|
|
8585
|
+
filterValue,
|
|
8121
8586
|
columnOrder,
|
|
8122
8587
|
columnVisibility,
|
|
8123
8588
|
columnVisibilityAssumeVisible,
|
|
@@ -8150,7 +8615,7 @@ var useComputedVisibleColumns = ({
|
|
|
8150
8615
|
};
|
|
8151
8616
|
|
|
8152
8617
|
// src/components/InfiniteTable/hooks/useScrollbars.ts
|
|
8153
|
-
import { useState as
|
|
8618
|
+
import { useState as useState11, useEffect as useEffect22, useLayoutEffect as useLayoutEffect4 } from "react";
|
|
8154
8619
|
var INITIAL_SCROLLBARS = {
|
|
8155
8620
|
vertical: false,
|
|
8156
8621
|
horizontal: false
|
|
@@ -8158,8 +8623,8 @@ var INITIAL_SCROLLBARS = {
|
|
|
8158
8623
|
function useScrollbars(brain) {
|
|
8159
8624
|
const { getComponentState: getInfiniteTableState } = useComponentState();
|
|
8160
8625
|
const { getState: getDataSourceState } = useDataSourceContextValue();
|
|
8161
|
-
const [scrollbars, setScrollbars] =
|
|
8162
|
-
|
|
8626
|
+
const [scrollbars, setScrollbars] = useState11(INITIAL_SCROLLBARS);
|
|
8627
|
+
useEffect22(() => {
|
|
8163
8628
|
return brain.onRenderCountChange(() => {
|
|
8164
8629
|
const { scrollTopMax, scrollLeftMax } = brain;
|
|
8165
8630
|
setScrollbars({
|
|
@@ -8199,27 +8664,27 @@ function useComputed() {
|
|
|
8199
8664
|
bodySize,
|
|
8200
8665
|
showSeparatePivotColumnForSingleAggregation
|
|
8201
8666
|
} = componentState;
|
|
8202
|
-
|
|
8667
|
+
useState12(() => {
|
|
8203
8668
|
componentState.onRowHeightCSSVarChange.onChange((rowHeight) => {
|
|
8204
8669
|
if (rowHeight) {
|
|
8205
8670
|
componentActions.rowHeight = rowHeight;
|
|
8206
8671
|
}
|
|
8207
8672
|
});
|
|
8208
|
-
componentState.
|
|
8209
|
-
if (
|
|
8210
|
-
componentActions.
|
|
8673
|
+
componentState.onColumnHeaderHeightCSSVarChange.onChange((columnHeaderHeight) => {
|
|
8674
|
+
if (columnHeaderHeight) {
|
|
8675
|
+
componentActions.columnHeaderHeight = columnHeaderHeight;
|
|
8211
8676
|
}
|
|
8212
8677
|
});
|
|
8213
8678
|
});
|
|
8214
|
-
|
|
8679
|
+
useEffect23(() => {
|
|
8215
8680
|
dataSourceActions.showSeparatePivotColumnForSingleAggregation = showSeparatePivotColumnForSingleAggregation;
|
|
8216
8681
|
}, [showSeparatePivotColumnForSingleAggregation]);
|
|
8217
|
-
const { multiSort } = dataSourceState;
|
|
8682
|
+
const { multiSort, filterValue } = dataSourceState;
|
|
8218
8683
|
useColumnGroups();
|
|
8219
8684
|
const { toggleGroupRow } = useColumnsWhen();
|
|
8220
8685
|
const setSortInfo = useCallback14((sortInfo) => {
|
|
8221
8686
|
var _a2;
|
|
8222
|
-
const newSortInfo = multiSort ? sortInfo : (_a2 = sortInfo[0]) != null ? _a2 : null;
|
|
8687
|
+
const newSortInfo = getDataSourceState().multiSort ? sortInfo : (_a2 = sortInfo[0]) != null ? _a2 : null;
|
|
8223
8688
|
dataSourceActions.sortInfo = newSortInfo;
|
|
8224
8689
|
}, [getDataSourceState]);
|
|
8225
8690
|
const columns = componentState.computedColumns;
|
|
@@ -8258,6 +8723,7 @@ function useComputed() {
|
|
|
8258
8723
|
columnVisibility,
|
|
8259
8724
|
columnVisibilityAssumeVisible: true,
|
|
8260
8725
|
columnPinning,
|
|
8726
|
+
filterValue,
|
|
8261
8727
|
columnSizing,
|
|
8262
8728
|
columnTypes
|
|
8263
8729
|
});
|
|
@@ -8267,6 +8733,7 @@ function useComputed() {
|
|
|
8267
8733
|
const computedPinnedStartOverflow = computedPinnedStartWidth ? computedPinnedStartColumnsWidth > computedPinnedStartWidth : false;
|
|
8268
8734
|
const computedPinnedEndOverflow = computedPinnedEndWidth ? computedPinnedEndColumnsWidth > computedPinnedEndWidth : false;
|
|
8269
8735
|
return {
|
|
8736
|
+
showColumnFilters: !!dataSourceState.filterValue,
|
|
8270
8737
|
scrollbars,
|
|
8271
8738
|
columnSize,
|
|
8272
8739
|
rowspan,
|
|
@@ -8374,7 +8841,7 @@ function useDOMProps(initialDOMProps) {
|
|
|
8374
8841
|
}
|
|
8375
8842
|
|
|
8376
8843
|
// src/components/InfiniteTable/hooks/useLicense/useLicense.ts
|
|
8377
|
-
import { useMemo as
|
|
8844
|
+
import { useMemo as useMemo11 } from "react";
|
|
8378
8845
|
|
|
8379
8846
|
// src/components/InfiniteTable/hooks/useLicense/crc32.ts
|
|
8380
8847
|
var DEFAULT_ReversedPolynomial = 3988292384;
|
|
@@ -8532,10 +8999,10 @@ var isInsideSandbox = () => {
|
|
|
8532
8999
|
};
|
|
8533
9000
|
var isInsidePlayground = isInsideSandbox() || isInsideSandpack();
|
|
8534
9001
|
var useLicense = (licenseKey = "") => {
|
|
8535
|
-
const valid =
|
|
9002
|
+
const valid = useMemo11(() => {
|
|
8536
9003
|
let valid2 = isValidLicense(licenseKey, {
|
|
8537
9004
|
publishedAt: 1624970570587,
|
|
8538
|
-
version: "0.3.
|
|
9005
|
+
version: "0.3.3"
|
|
8539
9006
|
});
|
|
8540
9007
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
8541
9008
|
return true;
|
|
@@ -8627,7 +9094,7 @@ function initSetupState2() {
|
|
|
8627
9094
|
scrollerDOMRef: createRef(),
|
|
8628
9095
|
portalDOMRef: createRef(),
|
|
8629
9096
|
onRowHeightCSSVarChange: buildSubscriptionCallback(),
|
|
8630
|
-
|
|
9097
|
+
onColumnHeaderHeightCSSVarChange: buildSubscriptionCallback(),
|
|
8631
9098
|
bodySize: {
|
|
8632
9099
|
width: 0,
|
|
8633
9100
|
height: 0
|
|
@@ -8677,6 +9144,7 @@ var forwardProps3 = (setupState) => {
|
|
|
8677
9144
|
onScrollbarsChange: 1,
|
|
8678
9145
|
autoSizeColumnsKey: 1,
|
|
8679
9146
|
scrollStopDelay: (scrollStopDelay) => scrollStopDelay != null ? scrollStopDelay : 250,
|
|
9147
|
+
filterEditors: (filterEditors) => __spreadValues(__spreadValues({}, defaultFilterEditors), filterEditors),
|
|
8680
9148
|
viewportReservedWidth: (viewportReservedWidth) => viewportReservedWidth != null ? viewportReservedWidth : 0,
|
|
8681
9149
|
activeIndex: (activeIndex) => activeIndex != null ? activeIndex : 0,
|
|
8682
9150
|
columnMinWidth: (columnMinWidth) => columnMinWidth != null ? columnMinWidth : 30,
|
|
@@ -8684,6 +9152,9 @@ var forwardProps3 = (setupState) => {
|
|
|
8684
9152
|
columnDefaultWidth: (columnDefaultWidth) => columnDefaultWidth != null ? columnDefaultWidth : 200,
|
|
8685
9153
|
columnCssEllipsis: (columnCssEllipsis) => columnCssEllipsis != null ? columnCssEllipsis : true,
|
|
8686
9154
|
draggableColumns: (draggableColumns) => draggableColumns != null ? draggableColumns : true,
|
|
9155
|
+
headerOptions: (headerOptions) => __spreadValues({
|
|
9156
|
+
alwaysReserveSpaceForSortIcon: true
|
|
9157
|
+
}, headerOptions),
|
|
8687
9158
|
showSeparatePivotColumnForSingleAggregation: (showSeparatePivotColumnForSingleAggregation) => showSeparatePivotColumnForSingleAggregation != null ? showSeparatePivotColumnForSingleAggregation : false,
|
|
8688
9159
|
sortable: (sortable) => sortable != null ? sortable : true,
|
|
8689
9160
|
hideEmptyGroupColumns: (hideEmptyGroupColumns) => hideEmptyGroupColumns != null ? hideEmptyGroupColumns : false,
|
|
@@ -8696,7 +9167,7 @@ var forwardProps3 = (setupState) => {
|
|
|
8696
9167
|
showHoverRows: (showHoverRows) => showHoverRows != null ? showHoverRows : true,
|
|
8697
9168
|
virtualizeColumns: (virtualizeColumns) => virtualizeColumns != null ? virtualizeColumns : true,
|
|
8698
9169
|
rowHeight: (rowHeight) => typeof rowHeight === "number" ? rowHeight : 0,
|
|
8699
|
-
|
|
9170
|
+
columnHeaderHeight: (columnHeaderHeight) => typeof columnHeaderHeight === "number" ? columnHeaderHeight : 30,
|
|
8700
9171
|
columns: (columns) => toMap(columns, setupState.propsCache.get("columns")),
|
|
8701
9172
|
columnVisibility: (columnVisibility) => columnVisibility != null ? columnVisibility : {},
|
|
8702
9173
|
columnPinning: (columnPinning) => toMap(columnPinning, setupState.propsCache.get("columnPinning")),
|
|
@@ -8742,7 +9213,7 @@ var mapPropsToState2 = (params) => {
|
|
|
8742
9213
|
columnGroupsMaxDepth: columnGroupsDepthsMap != state.columnGroupsDepthsMap ? Math.max(...columnGroupsDepthsMap.values(), 0) : state.columnGroupsMaxDepth,
|
|
8743
9214
|
computedColumnGroups,
|
|
8744
9215
|
rowHeightCSSVar: typeof props.rowHeight === "string" ? props.rowHeight : "",
|
|
8745
|
-
|
|
9216
|
+
columnHeaderHeightCSSVar: typeof props.columnHeaderHeight === "string" ? props.columnHeaderHeight || ThemeVars.components.Header.columnHeaderHeight : ""
|
|
8746
9217
|
};
|
|
8747
9218
|
};
|
|
8748
9219
|
|
|
@@ -8755,7 +9226,7 @@ var InfiniteTableRoot = getComponentStateRoot({
|
|
|
8755
9226
|
mapPropsToState: mapPropsToState2,
|
|
8756
9227
|
allowedControlledPropOverrides: {
|
|
8757
9228
|
rowHeight: true,
|
|
8758
|
-
|
|
9229
|
+
columnHeaderHeight: true
|
|
8759
9230
|
},
|
|
8760
9231
|
getParentState: () => useDataSource(),
|
|
8761
9232
|
debugName: "InfiniteTable"
|
|
@@ -8776,9 +9247,9 @@ var InfiniteTableComponent = memo9(function InfiniteTableComponent2() {
|
|
|
8776
9247
|
loadingText,
|
|
8777
9248
|
header,
|
|
8778
9249
|
onRowHeightCSSVarChange,
|
|
8779
|
-
|
|
9250
|
+
onColumnHeaderHeightCSSVarChange,
|
|
8780
9251
|
rowHeightCSSVar,
|
|
8781
|
-
|
|
9252
|
+
columnHeaderHeightCSSVar,
|
|
8782
9253
|
components,
|
|
8783
9254
|
scrollStopDelay,
|
|
8784
9255
|
brain,
|
|
@@ -8793,7 +9264,7 @@ var InfiniteTableComponent = memo9(function InfiniteTableComponent2() {
|
|
|
8793
9264
|
bodySize,
|
|
8794
9265
|
computed
|
|
8795
9266
|
});
|
|
8796
|
-
|
|
9267
|
+
useEffect24(() => {
|
|
8797
9268
|
const dataSourceState = getDataSourceState();
|
|
8798
9269
|
const onChange = debounce((renderRange) => {
|
|
8799
9270
|
dataSourceState.notifyRenderRangeChange({
|
|
@@ -8806,35 +9277,35 @@ var InfiniteTableComponent = memo9(function InfiniteTableComponent2() {
|
|
|
8806
9277
|
const licenseValid = useLicense(licenseKey);
|
|
8807
9278
|
const domProps = useDOMProps(componentState.domProps);
|
|
8808
9279
|
const LoadMaskCmp = (_a = components == null ? void 0 : components.LoadMask) != null ? _a : LoadMask;
|
|
8809
|
-
|
|
9280
|
+
useEffect24(() => {
|
|
8810
9281
|
brain.setScrollStopDelay(scrollStopDelay);
|
|
8811
9282
|
dataSourceActions.scrollStopDelayUpdatedByTable = scrollStopDelay;
|
|
8812
9283
|
}, [scrollStopDelay]);
|
|
8813
9284
|
useAutoSizeColumns();
|
|
8814
|
-
return /* @__PURE__ */
|
|
9285
|
+
return /* @__PURE__ */ createElement24("div", __spreadValues({
|
|
8815
9286
|
ref: domRef
|
|
8816
|
-
}, domProps), header ? /* @__PURE__ */
|
|
9287
|
+
}, domProps), header ? /* @__PURE__ */ createElement24(TableHeaderWrapper, {
|
|
8817
9288
|
brain: headerBrain,
|
|
8818
9289
|
scrollbars
|
|
8819
|
-
}) : null, /* @__PURE__ */
|
|
9290
|
+
}) : null, /* @__PURE__ */ createElement24(InfiniteTableBody, null, /* @__PURE__ */ createElement24(HeadlessTable, {
|
|
8820
9291
|
tabIndex: 0,
|
|
8821
9292
|
scrollStopDelay,
|
|
8822
9293
|
brain,
|
|
8823
9294
|
renderCell,
|
|
8824
9295
|
cellHoverClassNames: HOVERED_CLASS_NAMES,
|
|
8825
9296
|
scrollerDOMRef
|
|
8826
|
-
}), /* @__PURE__ */
|
|
9297
|
+
}), /* @__PURE__ */ createElement24(LoadMaskCmp, {
|
|
8827
9298
|
visible: loading
|
|
8828
|
-
}, loadingText)),
|
|
9299
|
+
}, loadingText)), /* @__PURE__ */ createElement24("div", {
|
|
8829
9300
|
ref: portalDOMRef,
|
|
8830
9301
|
className: join(`${rootClassName2}Portal`, zIndex[1e3], position.absolute, top[0], left[0])
|
|
8831
|
-
}), rowHeightCSSVar ? /* @__PURE__ */
|
|
9302
|
+
}), rowHeightCSSVar ? /* @__PURE__ */ createElement24(CSSVariableWatch, {
|
|
8832
9303
|
varName: rowHeightCSSVar,
|
|
8833
9304
|
onChange: onRowHeightCSSVarChange
|
|
8834
|
-
}) : null,
|
|
8835
|
-
varName:
|
|
8836
|
-
onChange:
|
|
8837
|
-
}) : null);
|
|
9305
|
+
}) : null, columnHeaderHeightCSSVar ? /* @__PURE__ */ createElement24(CSSVariableWatch, {
|
|
9306
|
+
varName: columnHeaderHeightCSSVar,
|
|
9307
|
+
onChange: onColumnHeaderHeightCSSVarChange
|
|
9308
|
+
}) : null, /* @__PURE__ */ createElement24(InfiniteTableFooter, null), licenseValid ? null : /* @__PURE__ */ createElement24(InfiniteTableLicenseFooter, null));
|
|
8838
9309
|
});
|
|
8839
9310
|
function InfiniteTableContextProvider() {
|
|
8840
9311
|
const { componentActions, componentState } = useComponentState();
|
|
@@ -8862,29 +9333,29 @@ function InfiniteTableContextProvider() {
|
|
|
8862
9333
|
bodySize.width = (_b = (_a = scrollerDOMRef.current) == null ? void 0 : _a.scrollWidth) != null ? _b : bodySize.width;
|
|
8863
9334
|
componentActions.bodySize = bodySize;
|
|
8864
9335
|
}, { earlyAttach: true });
|
|
8865
|
-
|
|
9336
|
+
useEffect24(() => {
|
|
8866
9337
|
return () => {
|
|
8867
9338
|
componentState.onRowHeightCSSVarChange.destroy();
|
|
8868
|
-
componentState.
|
|
9339
|
+
componentState.onColumnHeaderHeightCSSVarChange.destroy();
|
|
8869
9340
|
};
|
|
8870
9341
|
}, []);
|
|
8871
|
-
|
|
9342
|
+
useEffect24(() => {
|
|
8872
9343
|
if (scrollerDOMRef.current) {
|
|
8873
9344
|
scrollerDOMRef.current.scrollTop = 0;
|
|
8874
9345
|
}
|
|
8875
9346
|
}, [scrollTopKey, scrollerDOMRef]);
|
|
8876
9347
|
const TableContext2 = getInfiniteTableContext();
|
|
8877
|
-
return /* @__PURE__ */
|
|
9348
|
+
return /* @__PURE__ */ createElement24(TableContext2.Provider, {
|
|
8878
9349
|
value: contextValue
|
|
8879
|
-
}, /* @__PURE__ */
|
|
9350
|
+
}, /* @__PURE__ */ createElement24(InfiniteTableComponent, null));
|
|
8880
9351
|
}
|
|
8881
9352
|
function InfiniteTable(props) {
|
|
8882
|
-
const table = /* @__PURE__ */
|
|
8883
|
-
return /* @__PURE__ */
|
|
9353
|
+
const table = /* @__PURE__ */ createElement24(InfiniteTableRoot, __spreadValues({}, props), /* @__PURE__ */ createElement24(InfiniteTableContextProvider, null));
|
|
9354
|
+
return /* @__PURE__ */ createElement24(StrictMode, null, table);
|
|
8884
9355
|
}
|
|
8885
9356
|
InfiniteTable.defaultProps = {
|
|
8886
9357
|
rowHeight: 40,
|
|
8887
|
-
|
|
9358
|
+
columnHeaderHeight: ThemeVars.components.Header.columnHeaderHeight
|
|
8888
9359
|
};
|
|
8889
9360
|
export {
|
|
8890
9361
|
DataSource,
|
|
@@ -8893,7 +9364,12 @@ export {
|
|
|
8893
9364
|
InfiniteTable,
|
|
8894
9365
|
InfiniteTableClassName,
|
|
8895
9366
|
InfiniteTableComponent,
|
|
9367
|
+
NumberFilterEditor,
|
|
9368
|
+
StringFilterEditor,
|
|
8896
9369
|
debounce,
|
|
9370
|
+
defaultFilterEditors,
|
|
9371
|
+
defaultFilterTypes,
|
|
9372
|
+
defaultFilterTypes as filterTypes,
|
|
8897
9373
|
flatten,
|
|
8898
9374
|
getComponentStateRoot,
|
|
8899
9375
|
group,
|