@infinite-table/infinite-react 0.3.2 → 0.3.5
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/LICENSE.md +1 -1
- package/index.css +172 -91
- package/index.d.ts +659 -414
- package/index.esm.css +172 -91
- package/index.esm.js +1889 -810
- package/index.js +1884 -818
- package/package.json +2 -2
package/index.esm.js
CHANGED
|
@@ -636,10 +636,11 @@ function debounce(fn, { wait }) {
|
|
|
636
636
|
// src/components/InfiniteTable/index.tsx
|
|
637
637
|
import {
|
|
638
638
|
StrictMode,
|
|
639
|
-
createElement as
|
|
640
|
-
memo as
|
|
641
|
-
useEffect as
|
|
639
|
+
createElement as createElement26,
|
|
640
|
+
memo as memo11,
|
|
641
|
+
useEffect as useEffect26
|
|
642
642
|
} from "react";
|
|
643
|
+
import { useCallback as useCallback16, useEffect as useEffect27, useState as useState15 } from "react";
|
|
643
644
|
|
|
644
645
|
// src/utils/join.ts
|
|
645
646
|
var join = (...args) => args.filter((x) => !!`${x}`).join(" ");
|
|
@@ -865,13 +866,13 @@ function useDataSourceContextValue() {
|
|
|
865
866
|
|
|
866
867
|
// src/components/HeadlessTable/index.tsx
|
|
867
868
|
import {
|
|
868
|
-
createElement as
|
|
869
|
+
createElement as createElement8
|
|
869
870
|
} from "react";
|
|
870
871
|
import {
|
|
871
|
-
useCallback as
|
|
872
|
-
useEffect as
|
|
873
|
-
useRef as
|
|
874
|
-
useState as
|
|
872
|
+
useCallback as useCallback4,
|
|
873
|
+
useEffect as useEffect7,
|
|
874
|
+
useRef as useRef7,
|
|
875
|
+
useState as useState5
|
|
875
876
|
} from "react";
|
|
876
877
|
|
|
877
878
|
// src/components/VirtualList/SpacePlaceholder.tsx
|
|
@@ -2520,6 +2521,171 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2520
2521
|
this.items = [];
|
|
2521
2522
|
this.currentHoveredRow = -1;
|
|
2522
2523
|
this.hoverRowUpdatesInProgress = new Map();
|
|
2524
|
+
this.getFullyVisibleRowsRange = () => {
|
|
2525
|
+
let {
|
|
2526
|
+
start: [startRow],
|
|
2527
|
+
end: [endRow]
|
|
2528
|
+
} = this.brain.getRenderRange();
|
|
2529
|
+
while (!this.isRowFullyVisible(startRow)) {
|
|
2530
|
+
startRow++;
|
|
2531
|
+
if (startRow === endRow) {
|
|
2532
|
+
return null;
|
|
2533
|
+
}
|
|
2534
|
+
}
|
|
2535
|
+
while (!this.isRowFullyVisible(endRow)) {
|
|
2536
|
+
endRow--;
|
|
2537
|
+
if (endRow === startRow) {
|
|
2538
|
+
return null;
|
|
2539
|
+
}
|
|
2540
|
+
}
|
|
2541
|
+
return { start: startRow, end: endRow };
|
|
2542
|
+
};
|
|
2543
|
+
this.getScrollPositionForScrollRowIntoView = (rowIndex, config = { offset: 0 }) => {
|
|
2544
|
+
const { brain } = this;
|
|
2545
|
+
const scrollPosition = brain.getScrollPosition();
|
|
2546
|
+
let { scrollAdjustPosition, offset = 0 } = config;
|
|
2547
|
+
if (this.isRowFullyVisible(rowIndex) && !scrollAdjustPosition) {
|
|
2548
|
+
return scrollPosition;
|
|
2549
|
+
}
|
|
2550
|
+
const rowOffset = brain.getItemOffsetFor(rowIndex, "vertical");
|
|
2551
|
+
const rowHeight = brain.getItemSize(rowIndex, "vertical");
|
|
2552
|
+
const top2 = scrollPosition.scrollTop;
|
|
2553
|
+
const availableSize = brain.getAvailableSize();
|
|
2554
|
+
const bottom = top2 + availableSize.height;
|
|
2555
|
+
if (!scrollAdjustPosition) {
|
|
2556
|
+
scrollAdjustPosition = rowOffset > bottom ? "end" : rowOffset < top2 ? "start" : "end";
|
|
2557
|
+
}
|
|
2558
|
+
let scrollTop = scrollPosition.scrollTop;
|
|
2559
|
+
if (scrollAdjustPosition === "center") {
|
|
2560
|
+
scrollTop = rowOffset - Math.floor(brain.getAvailableSize().height / 2);
|
|
2561
|
+
} else if (scrollAdjustPosition === "start") {
|
|
2562
|
+
offset = -offset;
|
|
2563
|
+
scrollTop += rowOffset - top2 + offset;
|
|
2564
|
+
} else {
|
|
2565
|
+
offset += rowHeight;
|
|
2566
|
+
scrollTop += rowOffset - bottom + offset;
|
|
2567
|
+
}
|
|
2568
|
+
return __spreadProps(__spreadValues({}, scrollPosition), {
|
|
2569
|
+
scrollTop
|
|
2570
|
+
});
|
|
2571
|
+
};
|
|
2572
|
+
this.getScrollPositionForScrollColumnIntoView = (colIndex, config = { offset: 0 }) => {
|
|
2573
|
+
const { brain } = this;
|
|
2574
|
+
const scrollPosition = brain.getScrollPosition();
|
|
2575
|
+
let { scrollAdjustPosition, offset = 0 } = config;
|
|
2576
|
+
if (this.isColumnFullyVisible(colIndex) && !scrollAdjustPosition) {
|
|
2577
|
+
return scrollPosition;
|
|
2578
|
+
}
|
|
2579
|
+
const rowOffset = brain.getItemOffsetFor(colIndex, "horizontal");
|
|
2580
|
+
const colWidth = brain.getItemSize(colIndex, "horizontal");
|
|
2581
|
+
const left2 = scrollPosition.scrollLeft;
|
|
2582
|
+
const availableSize = brain.getAvailableSize();
|
|
2583
|
+
const right = left2 + availableSize.width;
|
|
2584
|
+
if (!scrollAdjustPosition) {
|
|
2585
|
+
scrollAdjustPosition = rowOffset > right ? "end" : rowOffset < left2 ? "start" : "end";
|
|
2586
|
+
}
|
|
2587
|
+
let scrollLeft = scrollPosition.scrollLeft;
|
|
2588
|
+
if (scrollAdjustPosition === "center") {
|
|
2589
|
+
scrollLeft = rowOffset - Math.floor(brain.getAvailableSize().width / 2);
|
|
2590
|
+
} else if (scrollAdjustPosition === "start") {
|
|
2591
|
+
offset = -offset;
|
|
2592
|
+
scrollLeft += rowOffset - left2 + offset;
|
|
2593
|
+
} else {
|
|
2594
|
+
offset += colWidth;
|
|
2595
|
+
scrollLeft += rowOffset - right + offset;
|
|
2596
|
+
}
|
|
2597
|
+
return __spreadProps(__spreadValues({}, scrollPosition), {
|
|
2598
|
+
scrollLeft
|
|
2599
|
+
});
|
|
2600
|
+
};
|
|
2601
|
+
this.getScrollPositionForScrollCellIntoView = (rowIndex, colIndex, config = { offsetLeft: 0, offsetTop: 0 }) => {
|
|
2602
|
+
const { scrollLeft } = this.getScrollPositionForScrollColumnIntoView(colIndex, {
|
|
2603
|
+
scrollAdjustPosition: config.colScrollAdjustPosition || config.scrollAdjustPosition,
|
|
2604
|
+
offset: config.offsetLeft
|
|
2605
|
+
});
|
|
2606
|
+
const { scrollTop } = this.getScrollPositionForScrollRowIntoView(rowIndex, {
|
|
2607
|
+
scrollAdjustPosition: config.rowScrollAdjustPosition || config.scrollAdjustPosition,
|
|
2608
|
+
offset: config.offsetTop
|
|
2609
|
+
});
|
|
2610
|
+
return { scrollLeft, scrollTop };
|
|
2611
|
+
};
|
|
2612
|
+
this.isRowFullyVisible = (rowIndex, offsetMargin = 2) => {
|
|
2613
|
+
return this.isRowVisible(rowIndex, this.brain.getRowHeight(rowIndex) - offsetMargin);
|
|
2614
|
+
};
|
|
2615
|
+
this.isRowVisible = (rowIndex, offsetMargin = 10) => {
|
|
2616
|
+
if (!this.isRowRendered(rowIndex)) {
|
|
2617
|
+
return false;
|
|
2618
|
+
}
|
|
2619
|
+
const { brain } = this;
|
|
2620
|
+
const {
|
|
2621
|
+
start: [startRow],
|
|
2622
|
+
end: [endRow]
|
|
2623
|
+
} = this.brain.getRenderRange();
|
|
2624
|
+
const midRow = Math.floor((startRow + endRow) / 2);
|
|
2625
|
+
if (rowIndex < startRow) {
|
|
2626
|
+
return false;
|
|
2627
|
+
}
|
|
2628
|
+
if (rowIndex >= endRow) {
|
|
2629
|
+
return false;
|
|
2630
|
+
}
|
|
2631
|
+
if (rowIndex >= midRow) {
|
|
2632
|
+
const lastVisibleRow = brain.getItemAt(brain.getAvailableSize().height + brain.getScrollPosition().scrollTop - offsetMargin, "vertical");
|
|
2633
|
+
return rowIndex <= lastVisibleRow;
|
|
2634
|
+
}
|
|
2635
|
+
if (rowIndex < midRow) {
|
|
2636
|
+
const firstVisibleRow = brain.getItemAt(brain.getScrollPosition().scrollTop + offsetMargin, "vertical");
|
|
2637
|
+
return rowIndex >= firstVisibleRow;
|
|
2638
|
+
}
|
|
2639
|
+
return true;
|
|
2640
|
+
};
|
|
2641
|
+
this.isRowRendered = (rowIndex) => {
|
|
2642
|
+
const elements = this.mappedCells.getElementsForRowIndex(rowIndex);
|
|
2643
|
+
return elements.length > 0;
|
|
2644
|
+
};
|
|
2645
|
+
this.isCellVisible = (rowIndex, colIndex) => {
|
|
2646
|
+
return this.isRowVisible(rowIndex) && this.isColumnVisible(colIndex);
|
|
2647
|
+
};
|
|
2648
|
+
this.isCellFullyVisible = (rowIndex, colIndex) => {
|
|
2649
|
+
return this.isRowFullyVisible(rowIndex) && this.isColumnVisible(colIndex);
|
|
2650
|
+
};
|
|
2651
|
+
this.isColumnFullyVisible = (colIndex, offsetMargin = 2) => {
|
|
2652
|
+
return this.isColumnVisible(colIndex, this.brain.getColWidth(colIndex) - offsetMargin);
|
|
2653
|
+
};
|
|
2654
|
+
this.isColumnVisible = (colIndex, offsetMargin = 10) => {
|
|
2655
|
+
if (!this.isColumnRendered(colIndex)) {
|
|
2656
|
+
return false;
|
|
2657
|
+
}
|
|
2658
|
+
const { brain } = this;
|
|
2659
|
+
const {
|
|
2660
|
+
start: [_, startCol],
|
|
2661
|
+
end: [__, endCol]
|
|
2662
|
+
} = brain.getRenderRange();
|
|
2663
|
+
const midCol = Math.floor((startCol + endCol) / 2);
|
|
2664
|
+
if (colIndex < startCol) {
|
|
2665
|
+
return false;
|
|
2666
|
+
}
|
|
2667
|
+
if (colIndex >= endCol) {
|
|
2668
|
+
return false;
|
|
2669
|
+
}
|
|
2670
|
+
if (colIndex >= midCol) {
|
|
2671
|
+
const lastVisibleCol = brain.getItemAt(brain.getAvailableSize().width + brain.getScrollPosition().scrollLeft - offsetMargin, "horizontal");
|
|
2672
|
+
return colIndex <= lastVisibleCol;
|
|
2673
|
+
}
|
|
2674
|
+
if (colIndex < midCol) {
|
|
2675
|
+
const firstVisibleCol = brain.getItemAt(brain.getScrollPosition().scrollLeft + offsetMargin, "horizontal");
|
|
2676
|
+
return colIndex >= firstVisibleCol;
|
|
2677
|
+
}
|
|
2678
|
+
return true;
|
|
2679
|
+
};
|
|
2680
|
+
this.isCellRendered = (rowIndex, colIndex) => {
|
|
2681
|
+
return this.isRowRendered(rowIndex) && this.isColumnRendered(colIndex);
|
|
2682
|
+
};
|
|
2683
|
+
this.isColumnRendered = (colIndex) => {
|
|
2684
|
+
const {
|
|
2685
|
+
start: [startRow]
|
|
2686
|
+
} = this.brain.getRenderRange();
|
|
2687
|
+
return this.mappedCells.getRenderedNodeForCell(startRow, colIndex) !== null;
|
|
2688
|
+
};
|
|
2523
2689
|
this.getExtraSpanCellsForRange = (range) => {
|
|
2524
2690
|
const { start, end } = range;
|
|
2525
2691
|
const [startRow, startCol] = start;
|
|
@@ -2782,6 +2948,9 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2782
2948
|
});
|
|
2783
2949
|
};
|
|
2784
2950
|
this.onMouseLeave = (rowIndex) => {
|
|
2951
|
+
if (this.currentHoveredRow != -1 && this.currentHoveredRow === rowIndex) {
|
|
2952
|
+
this.removeHoverClass(rowIndex);
|
|
2953
|
+
}
|
|
2785
2954
|
this.currentHoveredRow = -1;
|
|
2786
2955
|
if (this.scrolling) {
|
|
2787
2956
|
return;
|
|
@@ -2856,9 +3025,6 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2856
3025
|
};
|
|
2857
3026
|
this.onScrollStart = () => {
|
|
2858
3027
|
this.scrolling = true;
|
|
2859
|
-
if (this.currentHoveredRow != -1) {
|
|
2860
|
-
this.removeHoverClass(this.currentHoveredRow);
|
|
2861
|
-
}
|
|
2862
3028
|
};
|
|
2863
3029
|
this.onScrollStop = () => {
|
|
2864
3030
|
this.scrolling = false;
|
|
@@ -3096,8 +3262,11 @@ function createRenderer(brain) {
|
|
|
3096
3262
|
function RawTableFn(props) {
|
|
3097
3263
|
const { brain, renderCell } = props;
|
|
3098
3264
|
const { renderer, onRenderUpdater } = useMemo2(() => {
|
|
3099
|
-
return
|
|
3100
|
-
|
|
3265
|
+
return props.onRenderUpdater && props.renderer ? {
|
|
3266
|
+
renderer: props.renderer,
|
|
3267
|
+
onRenderUpdater: props.onRenderUpdater
|
|
3268
|
+
} : createRenderer(brain);
|
|
3269
|
+
}, [brain, props.onRenderUpdater, props.renderer]);
|
|
3101
3270
|
useEffect4(() => {
|
|
3102
3271
|
renderer.cellHoverClassNames = props.cellHoverClassNames || [];
|
|
3103
3272
|
}, [renderer, props.cellHoverClassNames]);
|
|
@@ -3131,6 +3300,150 @@ function RawTableFn(props) {
|
|
|
3131
3300
|
}
|
|
3132
3301
|
var RawTable = memo3(RawTableFn);
|
|
3133
3302
|
|
|
3303
|
+
// src/components/InfiniteTable/components/ActiveRowIndicator.tsx
|
|
3304
|
+
import {
|
|
3305
|
+
createElement as createElement6,
|
|
3306
|
+
memo as memo4
|
|
3307
|
+
} from "react";
|
|
3308
|
+
import { useEffect as useEffect5, useLayoutEffect as useLayoutEffect3, useRef as useRef5, useState as useState3 } from "react";
|
|
3309
|
+
|
|
3310
|
+
// src/components/hooks/useRerender.ts
|
|
3311
|
+
import { useCallback as useCallback3, useState as useState2 } from "react";
|
|
3312
|
+
var useRerender = () => {
|
|
3313
|
+
const [state, setState] = useState2(0);
|
|
3314
|
+
return [
|
|
3315
|
+
state,
|
|
3316
|
+
useCallback3(() => {
|
|
3317
|
+
setState((state2) => state2 + 1);
|
|
3318
|
+
}, [setState])
|
|
3319
|
+
];
|
|
3320
|
+
};
|
|
3321
|
+
|
|
3322
|
+
// src/components/InfiniteTable/internalProps.ts
|
|
3323
|
+
var rootClassName2 = "Infinite";
|
|
3324
|
+
var internalProps = {
|
|
3325
|
+
rootClassName: rootClassName2
|
|
3326
|
+
};
|
|
3327
|
+
|
|
3328
|
+
// src/components/InfiniteTable/components/ActiveRowIndicator.css.ts
|
|
3329
|
+
var ActiveRowIndicatorCls = { visible: "j26lrx1 j26lrx0 _16lm1iwe _16lm1iw3 _16lm1iwt _16lm1iwu _16lm1iww", hidden: "j26lrx2 j26lrx0 _16lm1iwe _16lm1iw3 _16lm1iwt _16lm1iwu _16lm1iww" };
|
|
3330
|
+
|
|
3331
|
+
// src/components/InfiniteTable/components/ActiveRowIndicator.tsx
|
|
3332
|
+
var { rootClassName: rootClassName3 } = internalProps;
|
|
3333
|
+
var baseCls = `${rootClassName3}-ActiveRowIndicator`;
|
|
3334
|
+
var ActiveRowIndicatorFn = (props) => {
|
|
3335
|
+
const { brain } = props;
|
|
3336
|
+
const [state, setState] = useState3({
|
|
3337
|
+
top: 0,
|
|
3338
|
+
rowHeight: 0
|
|
3339
|
+
});
|
|
3340
|
+
const domRef = useRef5(null);
|
|
3341
|
+
const stateRef = useRef5(state);
|
|
3342
|
+
const active = props.activeRowIndex != null && brain.getRowCount() > props.activeRowIndex;
|
|
3343
|
+
const [rerenderId, rerender] = useRerender();
|
|
3344
|
+
useLayoutEffect3(() => {
|
|
3345
|
+
if (props.activeRowIndex == null) {
|
|
3346
|
+
return;
|
|
3347
|
+
}
|
|
3348
|
+
setState(stateRef.current = {
|
|
3349
|
+
top: brain.getItemOffsetFor(props.activeRowIndex, "vertical"),
|
|
3350
|
+
rowHeight: brain.getRowHeight(props.activeRowIndex)
|
|
3351
|
+
});
|
|
3352
|
+
}, [props.activeRowIndex, rerenderId]);
|
|
3353
|
+
useEffect5(() => {
|
|
3354
|
+
const removeOnScroll = brain.onScroll((scrollPos) => {
|
|
3355
|
+
const node = domRef.current;
|
|
3356
|
+
const topOffset = stateRef.current.top;
|
|
3357
|
+
node.style.transform = `translate3d(0px, ${-scrollPos.scrollTop + topOffset}px, 0px)`;
|
|
3358
|
+
});
|
|
3359
|
+
const removeOnRenderCountChange = brain.onRenderCountChange(rerender);
|
|
3360
|
+
return () => {
|
|
3361
|
+
removeOnRenderCountChange();
|
|
3362
|
+
removeOnScroll();
|
|
3363
|
+
};
|
|
3364
|
+
}, [brain]);
|
|
3365
|
+
return /* @__PURE__ */ createElement6("div", {
|
|
3366
|
+
ref: domRef,
|
|
3367
|
+
"data-name": "active-row-indicator",
|
|
3368
|
+
className: `${baseCls} ${active ? ActiveRowIndicatorCls.visible : ActiveRowIndicatorCls.hidden}`,
|
|
3369
|
+
style: active ? {
|
|
3370
|
+
transform: `translate3d(0px, ${-brain.getScrollPosition().scrollTop + state.top}px,0)`,
|
|
3371
|
+
height: state.rowHeight
|
|
3372
|
+
} : void 0
|
|
3373
|
+
});
|
|
3374
|
+
};
|
|
3375
|
+
var ActiveRowIndicator = memo4(ActiveRowIndicatorFn);
|
|
3376
|
+
|
|
3377
|
+
// src/components/InfiniteTable/components/ActiveCellIndicator.tsx
|
|
3378
|
+
import {
|
|
3379
|
+
createElement as createElement7,
|
|
3380
|
+
memo as memo5
|
|
3381
|
+
} from "react";
|
|
3382
|
+
import { useEffect as useEffect6, useLayoutEffect as useLayoutEffect4, useRef as useRef6, useState as useState4 } from "react";
|
|
3383
|
+
|
|
3384
|
+
// src/components/InfiniteTable/components/ActiveCellIndicator.css.ts
|
|
3385
|
+
var ActiveCellIndicatorCls = { visible: "nxbq1c1 nxbq1c0 _16lm1iwe _16lm1iw3 _16lm1iww _16lm1iwu", hidden: "nxbq1c2 nxbq1c0 _16lm1iwe _16lm1iw3 _16lm1iww _16lm1iwu" };
|
|
3386
|
+
|
|
3387
|
+
// src/components/InfiniteTable/components/ActiveCellIndicator.tsx
|
|
3388
|
+
var { rootClassName: rootClassName4 } = internalProps;
|
|
3389
|
+
var baseCls2 = `${rootClassName4}-ActiveCellIndicator`;
|
|
3390
|
+
var ActiveCellIndicatorFn = (props) => {
|
|
3391
|
+
const { brain } = props;
|
|
3392
|
+
const [rerenderId, rerender] = useRerender();
|
|
3393
|
+
const [state, setState] = useState4({
|
|
3394
|
+
top: 0,
|
|
3395
|
+
rowHeight: 0,
|
|
3396
|
+
colWidth: 0,
|
|
3397
|
+
left: 0
|
|
3398
|
+
});
|
|
3399
|
+
const domRef = useRef6(null);
|
|
3400
|
+
const stateRef = useRef6(state);
|
|
3401
|
+
const active = props.activeCellIndex != null && brain.getRowCount() > props.activeCellIndex[0];
|
|
3402
|
+
useLayoutEffect4(() => {
|
|
3403
|
+
if (props.activeCellIndex == null) {
|
|
3404
|
+
return;
|
|
3405
|
+
}
|
|
3406
|
+
const rowIndex = props.activeCellIndex[0];
|
|
3407
|
+
setState(stateRef.current = {
|
|
3408
|
+
top: brain.getItemOffsetFor(rowIndex, "vertical"),
|
|
3409
|
+
rowHeight: brain.getRowHeight(rowIndex),
|
|
3410
|
+
left: brain.getItemOffsetFor(props.activeCellIndex[1], "horizontal"),
|
|
3411
|
+
colWidth: brain.getColWidth(props.activeCellIndex[1])
|
|
3412
|
+
});
|
|
3413
|
+
}, [props.activeCellIndex, rerenderId]);
|
|
3414
|
+
useEffect6(() => {
|
|
3415
|
+
const removeOnSCroll = brain.onScroll((scrollPos) => {
|
|
3416
|
+
const node = domRef.current;
|
|
3417
|
+
const topOffset = stateRef.current.top;
|
|
3418
|
+
const leftOffset = stateRef.current.left;
|
|
3419
|
+
node.style.transform = `translate3d(${-scrollPos.scrollLeft + leftOffset}px, ${-scrollPos.scrollTop + topOffset}px, 0px)`;
|
|
3420
|
+
});
|
|
3421
|
+
const removeOnRenderCountChange = brain.onRenderCountChange(() => {
|
|
3422
|
+
rerender();
|
|
3423
|
+
});
|
|
3424
|
+
const removeOnAvailableSizeChange = brain.onAvailableSizeChange(() => {
|
|
3425
|
+
rerender();
|
|
3426
|
+
});
|
|
3427
|
+
return () => {
|
|
3428
|
+
removeOnAvailableSizeChange();
|
|
3429
|
+
removeOnRenderCountChange();
|
|
3430
|
+
removeOnSCroll();
|
|
3431
|
+
};
|
|
3432
|
+
}, [brain]);
|
|
3433
|
+
const scrollPosition = brain.getScrollPosition();
|
|
3434
|
+
return /* @__PURE__ */ createElement7("div", {
|
|
3435
|
+
ref: domRef,
|
|
3436
|
+
"data-name": "active-cell-indicator",
|
|
3437
|
+
className: `${baseCls2} ${active ? ActiveCellIndicatorCls.visible : ActiveCellIndicatorCls.hidden}`,
|
|
3438
|
+
style: active ? {
|
|
3439
|
+
transform: `translate3d(${-scrollPosition.scrollLeft + state.left}px, ${-scrollPosition.scrollTop + state.top}px,0)`,
|
|
3440
|
+
width: state.colWidth,
|
|
3441
|
+
height: state.rowHeight
|
|
3442
|
+
} : void 0
|
|
3443
|
+
});
|
|
3444
|
+
};
|
|
3445
|
+
var ActiveCellIndicator = memo5(ActiveCellIndicatorFn);
|
|
3446
|
+
|
|
3134
3447
|
// src/components/HeadlessTable/index.tsx
|
|
3135
3448
|
function useMatrixBrain(brain, brainOptions, fixedCellsInfo) {
|
|
3136
3449
|
if (fixedCellsInfo && (fixedCellsInfo.fixedColsStart || fixedCellsInfo.fixedColsEnd || fixedCellsInfo.fixedRowsStart || fixedCellsInfo.fixedRowsEnd)) {
|
|
@@ -3158,25 +3471,33 @@ function HeadlessTable(props) {
|
|
|
3158
3471
|
scrollerDOMRef,
|
|
3159
3472
|
scrollStopDelay,
|
|
3160
3473
|
renderCell,
|
|
3161
|
-
cellHoverClassNames
|
|
3474
|
+
cellHoverClassNames,
|
|
3475
|
+
renderer,
|
|
3476
|
+
activeRowIndex,
|
|
3477
|
+
activeCellIndex,
|
|
3478
|
+
onRenderUpdater
|
|
3162
3479
|
} = _a, domProps = __objRest(_a, [
|
|
3163
3480
|
"brain",
|
|
3164
3481
|
"scrollerDOMRef",
|
|
3165
3482
|
"scrollStopDelay",
|
|
3166
3483
|
"renderCell",
|
|
3167
|
-
"cellHoverClassNames"
|
|
3484
|
+
"cellHoverClassNames",
|
|
3485
|
+
"renderer",
|
|
3486
|
+
"activeRowIndex",
|
|
3487
|
+
"activeCellIndex",
|
|
3488
|
+
"onRenderUpdater"
|
|
3168
3489
|
]);
|
|
3169
|
-
const domRef =
|
|
3170
|
-
const [scrollSize, setTotalScrollSize] =
|
|
3490
|
+
const domRef = useRef7(null);
|
|
3491
|
+
const [scrollSize, setTotalScrollSize] = useState5({
|
|
3171
3492
|
width: 0,
|
|
3172
3493
|
height: 0
|
|
3173
3494
|
});
|
|
3174
|
-
|
|
3495
|
+
useEffect7(() => {
|
|
3175
3496
|
if (scrollStopDelay != null) {
|
|
3176
3497
|
brain.setScrollStopDelay(scrollStopDelay);
|
|
3177
3498
|
}
|
|
3178
3499
|
}, [scrollStopDelay, brain]);
|
|
3179
|
-
|
|
3500
|
+
useEffect7(() => {
|
|
3180
3501
|
var _a2;
|
|
3181
3502
|
const node = (_a2 = domRef.current) == null ? void 0 : _a2.parentNode;
|
|
3182
3503
|
if (!node) {
|
|
@@ -3192,31 +3513,39 @@ function HeadlessTable(props) {
|
|
|
3192
3513
|
const remove = setupResizeObserver(node, onResize);
|
|
3193
3514
|
return remove;
|
|
3194
3515
|
}, []);
|
|
3195
|
-
const onContainerScroll =
|
|
3516
|
+
const onContainerScroll = useCallback4((scrollPos) => {
|
|
3196
3517
|
brain.setScrollPosition(scrollPos, (scrollPos2) => {
|
|
3197
3518
|
domRef.current.style.transform = `translate3d(${-scrollPos2.scrollLeft}px, ${-scrollPos2.scrollTop}px, 0px)`;
|
|
3198
3519
|
});
|
|
3199
3520
|
}, [brain]);
|
|
3200
|
-
|
|
3521
|
+
useEffect7(() => {
|
|
3201
3522
|
const removeOnRenderCount = brain.onRenderCountChange(() => {
|
|
3202
3523
|
setTotalScrollSize(brain.getTotalSize());
|
|
3203
3524
|
});
|
|
3204
3525
|
setTotalScrollSize(brain.getTotalSize());
|
|
3205
3526
|
return removeOnRenderCount;
|
|
3206
3527
|
}, [brain]);
|
|
3207
|
-
return /* @__PURE__ */
|
|
3528
|
+
return /* @__PURE__ */ createElement8(VirtualScrollContainer, __spreadProps(__spreadValues({
|
|
3208
3529
|
onContainerScroll
|
|
3209
3530
|
}, domProps), {
|
|
3210
3531
|
ref: scrollerDOMRef
|
|
3211
|
-
}), /* @__PURE__ */
|
|
3532
|
+
}), /* @__PURE__ */ createElement8("div", {
|
|
3212
3533
|
ref: domRef,
|
|
3213
3534
|
className: scrollTransformTargetCls,
|
|
3214
3535
|
"data-name": "scroll-transform-target"
|
|
3215
|
-
}, /* @__PURE__ */
|
|
3536
|
+
}, /* @__PURE__ */ createElement8(RawTable, {
|
|
3537
|
+
renderer,
|
|
3538
|
+
onRenderUpdater,
|
|
3216
3539
|
renderCell,
|
|
3217
3540
|
brain,
|
|
3218
3541
|
cellHoverClassNames
|
|
3219
|
-
})), /* @__PURE__ */
|
|
3542
|
+
})), /* @__PURE__ */ createElement8(ActiveRowIndicator, {
|
|
3543
|
+
brain,
|
|
3544
|
+
activeRowIndex
|
|
3545
|
+
}), /* @__PURE__ */ createElement8(ActiveCellIndicator, {
|
|
3546
|
+
brain,
|
|
3547
|
+
activeCellIndex
|
|
3548
|
+
}), /* @__PURE__ */ createElement8(SpacePlaceholder, {
|
|
3220
3549
|
width: scrollSize.width,
|
|
3221
3550
|
height: scrollSize.height
|
|
3222
3551
|
}));
|
|
@@ -3224,17 +3553,17 @@ function HeadlessTable(props) {
|
|
|
3224
3553
|
|
|
3225
3554
|
// src/components/hooks/useComponentState/index.tsx
|
|
3226
3555
|
import {
|
|
3227
|
-
createElement as
|
|
3228
|
-
memo as
|
|
3556
|
+
createElement as createElement9,
|
|
3557
|
+
memo as memo6,
|
|
3229
3558
|
useContext as useContext2
|
|
3230
3559
|
} from "react";
|
|
3231
3560
|
import {
|
|
3232
3561
|
useReducer,
|
|
3233
3562
|
createContext as createContext2,
|
|
3234
3563
|
useMemo as useMemo3,
|
|
3235
|
-
useEffect as
|
|
3236
|
-
useState as
|
|
3237
|
-
useRef as
|
|
3564
|
+
useEffect as useEffect8,
|
|
3565
|
+
useState as useState6,
|
|
3566
|
+
useRef as useRef10
|
|
3238
3567
|
} from "react";
|
|
3239
3568
|
|
|
3240
3569
|
// src/utils/proxyFnCall.ts
|
|
@@ -3278,18 +3607,18 @@ function isControlled(propName, props) {
|
|
|
3278
3607
|
}
|
|
3279
3608
|
|
|
3280
3609
|
// src/components/hooks/useLatest.tsx
|
|
3281
|
-
import { useCallback as
|
|
3610
|
+
import { useCallback as useCallback5, useRef as useRef8 } from "react";
|
|
3282
3611
|
function useLatest(value) {
|
|
3283
|
-
const ref =
|
|
3612
|
+
const ref = useRef8(value);
|
|
3284
3613
|
ref.current = value;
|
|
3285
|
-
return
|
|
3614
|
+
return useCallback5(() => ref.current, []);
|
|
3286
3615
|
}
|
|
3287
3616
|
|
|
3288
3617
|
// src/components/hooks/usePrevious.ts
|
|
3289
|
-
import { useRef as
|
|
3618
|
+
import { useRef as useRef9, useLayoutEffect as useLayoutEffect5 } from "react";
|
|
3290
3619
|
var usePrevious = (value, initialValue) => {
|
|
3291
|
-
const ref =
|
|
3292
|
-
|
|
3620
|
+
const ref = useRef9(initialValue === void 0 ? value : initialValue);
|
|
3621
|
+
useLayoutEffect5(() => {
|
|
3293
3622
|
ref.current = value;
|
|
3294
3623
|
});
|
|
3295
3624
|
return ref.current;
|
|
@@ -3369,16 +3698,16 @@ function forwardProps(propsToForward, props) {
|
|
|
3369
3698
|
return mappedState;
|
|
3370
3699
|
}
|
|
3371
3700
|
function getComponentStateRoot(config) {
|
|
3372
|
-
return
|
|
3701
|
+
return memo6(function ComponentStateRoot(props) {
|
|
3373
3702
|
var _a, _b;
|
|
3374
|
-
const [initialSetupState] =
|
|
3703
|
+
const [initialSetupState] = useState6(() => {
|
|
3375
3704
|
return config.initSetupState ? config.initSetupState() : {};
|
|
3376
3705
|
});
|
|
3377
|
-
const propsToStateSetRef =
|
|
3706
|
+
const propsToStateSetRef = useRef10(new Set());
|
|
3378
3707
|
const propsToForward = useMemo3(() => config.forwardProps ? config.forwardProps(initialSetupState) : {}, [initialSetupState]);
|
|
3379
3708
|
const parentState = (_b = (_a = config.getParentState) == null ? void 0 : _a.call(config)) != null ? _b : null;
|
|
3380
3709
|
const getParentState = useLatest(parentState);
|
|
3381
|
-
const [wholeState] =
|
|
3710
|
+
const [wholeState] = useState6(() => {
|
|
3382
3711
|
let mappedState = {};
|
|
3383
3712
|
if (propsToForward) {
|
|
3384
3713
|
mappedState = forwardProps(propsToForward, props);
|
|
@@ -3463,7 +3792,7 @@ function getComponentStateRoot(config) {
|
|
|
3463
3792
|
getComponentState
|
|
3464
3793
|
}), [state, actions, getComponentState]);
|
|
3465
3794
|
const prevProps = usePrevious(props);
|
|
3466
|
-
|
|
3795
|
+
useEffect8(() => {
|
|
3467
3796
|
const currentProps = props;
|
|
3468
3797
|
const newMappedState = {};
|
|
3469
3798
|
let newMappedStateCount = 0;
|
|
@@ -3519,7 +3848,7 @@ function getComponentStateRoot(config) {
|
|
|
3519
3848
|
}
|
|
3520
3849
|
}
|
|
3521
3850
|
});
|
|
3522
|
-
return /* @__PURE__ */
|
|
3851
|
+
return /* @__PURE__ */ createElement9(Context.Provider, {
|
|
3523
3852
|
value: contextValue
|
|
3524
3853
|
}, props.children);
|
|
3525
3854
|
});
|
|
@@ -3531,62 +3860,174 @@ function useComponentState() {
|
|
|
3531
3860
|
|
|
3532
3861
|
// src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx
|
|
3533
3862
|
import {
|
|
3534
|
-
createElement as
|
|
3863
|
+
createElement as createElement10,
|
|
3535
3864
|
forwardRef as forwardRef2
|
|
3536
3865
|
} from "react";
|
|
3537
3866
|
|
|
3538
|
-
// src/components/InfiniteTable/internalProps.ts
|
|
3539
|
-
var rootClassName2 = "Infinite";
|
|
3540
|
-
var internalProps = {
|
|
3541
|
-
rootClassName: rootClassName2
|
|
3542
|
-
};
|
|
3543
|
-
|
|
3544
3867
|
// src/components/InfiniteTable/hooks/useInternalProps.ts
|
|
3545
3868
|
var useInternalProps = () => {
|
|
3546
3869
|
return internalProps;
|
|
3547
3870
|
};
|
|
3548
3871
|
|
|
3549
3872
|
// src/components/InfiniteTable/utilities.css.ts
|
|
3550
|
-
var alignItems = { center: "
|
|
3551
|
-
var cssEllipsisClassName = "
|
|
3873
|
+
var alignItems = { center: "_16lm1iw14", stretch: "_16lm1iw15" };
|
|
3874
|
+
var cssEllipsisClassName = "_16lm1iw1d _16lm1iw1e _16lm1iw19";
|
|
3552
3875
|
var cursor = { pointer: "_16lm1iwd" };
|
|
3553
|
-
var display = { flex: "
|
|
3554
|
-
var flex = { "1": "
|
|
3555
|
-
var
|
|
3556
|
-
var
|
|
3557
|
-
var
|
|
3876
|
+
var display = { flex: "_16lm1iwm", block: "_16lm1iwn", inlineBlock: "_16lm1iwo" };
|
|
3877
|
+
var flex = { "1": "_16lm1iwf", none: "_16lm1iwg" };
|
|
3878
|
+
var flexFlow = { column: "_16lm1iw12", row: "_16lm1iw13" };
|
|
3879
|
+
var justifyContent = { center: "_16lm1iw16", start: "_16lm1iw17", end: "_16lm1iw18" };
|
|
3880
|
+
var left = { "0": "_16lm1iww", "100%": "_16lm1iwx" };
|
|
3881
|
+
var overflow = { hidden: "_16lm1iw19", auto: "_16lm1iw1a", visible: "_16lm1iw1b" };
|
|
3558
3882
|
var position = { relative: "_16lm1iw1", absolute: "_16lm1iw2", sticky: "_16lm1iw3", fixed: "_16lm1iw4" };
|
|
3559
|
-
var top = { "0": "
|
|
3883
|
+
var top = { "0": "_16lm1iwu", "100%": "_16lm1iwv" };
|
|
3560
3884
|
var transformTranslateZero = "_16lm1iwa";
|
|
3561
|
-
var userSelect = { none: "
|
|
3562
|
-
var zIndex = { "1": "
|
|
3885
|
+
var userSelect = { none: "_16lm1iwp" };
|
|
3886
|
+
var zIndex = { "1": "_16lm1iwh", "10": "_16lm1iwi", "1000": "_16lm1iwj", "10000": "_16lm1iwk", "100000": "_16lm1iwl" };
|
|
3563
3887
|
|
|
3564
3888
|
// src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx
|
|
3565
3889
|
var InfiniteTableBody = forwardRef2(function InfiniteTableBody2(props, ref) {
|
|
3566
|
-
const { rootClassName:
|
|
3567
|
-
return /* @__PURE__ */
|
|
3890
|
+
const { rootClassName: rootClassName11 } = useInternalProps();
|
|
3891
|
+
return /* @__PURE__ */ createElement10("div", __spreadProps(__spreadValues({
|
|
3892
|
+
ref
|
|
3893
|
+
}, props), {
|
|
3894
|
+
className: join(`${rootClassName11}Body`, position.relative, flex["1"], transformTranslateZero, props.className)
|
|
3895
|
+
}));
|
|
3896
|
+
});
|
|
3897
|
+
|
|
3898
|
+
// src/components/InfiniteTable/components/InfiniteTableFooter/InfiniteTableFooter.tsx
|
|
3899
|
+
import {
|
|
3900
|
+
createElement as createElement11,
|
|
3901
|
+
forwardRef as forwardRef3
|
|
3902
|
+
} from "react";
|
|
3903
|
+
var InfiniteTableFooter = forwardRef3(function InfiniteTableFooter2(props, ref) {
|
|
3904
|
+
const { rootClassName: rootClassName11 } = useInternalProps();
|
|
3905
|
+
return /* @__PURE__ */ createElement11("div", __spreadProps(__spreadValues({
|
|
3568
3906
|
ref
|
|
3569
3907
|
}, props), {
|
|
3570
|
-
className: join(`${
|
|
3908
|
+
className: join(`${rootClassName11}Footer`, position.relative, display.flex, flexFlow.row, props.className)
|
|
3571
3909
|
}));
|
|
3572
3910
|
});
|
|
3573
3911
|
|
|
3574
3912
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
|
|
3575
3913
|
import {
|
|
3914
|
+
Fragment as Fragment2,
|
|
3576
3915
|
createContext as createContext4,
|
|
3577
|
-
createElement as
|
|
3916
|
+
createElement as createElement15,
|
|
3917
|
+
useMemo as useMemo5
|
|
3578
3918
|
} from "react";
|
|
3919
|
+
import { useCallback as useCallback7, useContext as useContext5, useEffect as useEffect11, useRef as useRef12 } from "react";
|
|
3579
3920
|
import { createPortal } from "react-dom";
|
|
3580
|
-
import { useCallback as useCallback6, useContext as useContext5, useEffect as useEffect8, useRef as useRef10 } from "react";
|
|
3581
3921
|
|
|
3582
|
-
// src/components/
|
|
3922
|
+
// src/components/DataSource/defaultFilterTypes.ts
|
|
3923
|
+
function getFilterTypes() {
|
|
3924
|
+
const result = {
|
|
3925
|
+
string: {
|
|
3926
|
+
label: "Text",
|
|
3927
|
+
emptyValues: new Set([""]),
|
|
3928
|
+
defaultOperator: "contains",
|
|
3929
|
+
operators: [
|
|
3930
|
+
{
|
|
3931
|
+
name: "contains",
|
|
3932
|
+
fn: ({ currentValue, filterValue, emptyValues }) => {
|
|
3933
|
+
if (emptyValues.has(currentValue) || emptyValues.has(filterValue)) {
|
|
3934
|
+
return true;
|
|
3935
|
+
}
|
|
3936
|
+
return typeof currentValue === "string" && typeof filterValue == "string" && currentValue.toLowerCase().includes(filterValue.toLowerCase());
|
|
3937
|
+
}
|
|
3938
|
+
},
|
|
3939
|
+
{
|
|
3940
|
+
name: "eq",
|
|
3941
|
+
fn: ({ currentValue: value, filterValue, emptyValues }) => {
|
|
3942
|
+
if (emptyValues.has(value) || emptyValues.has(filterValue)) {
|
|
3943
|
+
return true;
|
|
3944
|
+
}
|
|
3945
|
+
return typeof value === "string" && value === filterValue;
|
|
3946
|
+
}
|
|
3947
|
+
}
|
|
3948
|
+
]
|
|
3949
|
+
},
|
|
3950
|
+
number: {
|
|
3951
|
+
label: "Number",
|
|
3952
|
+
emptyValues: new Set(["", null, void 0]),
|
|
3953
|
+
defaultOperator: "eq",
|
|
3954
|
+
operators: [
|
|
3955
|
+
{
|
|
3956
|
+
name: "eq",
|
|
3957
|
+
fn: ({ currentValue, filterValue, emptyValues }) => {
|
|
3958
|
+
if (emptyValues.has(currentValue) || emptyValues.has(filterValue)) {
|
|
3959
|
+
return true;
|
|
3960
|
+
}
|
|
3961
|
+
return currentValue == filterValue;
|
|
3962
|
+
}
|
|
3963
|
+
},
|
|
3964
|
+
{
|
|
3965
|
+
name: "between",
|
|
3966
|
+
fn: ({ currentValue, filterValue, emptyValues }) => {
|
|
3967
|
+
if (emptyValues.has(currentValue) || emptyValues.has(filterValue)) {
|
|
3968
|
+
return true;
|
|
3969
|
+
}
|
|
3970
|
+
const [min, max] = filterValue;
|
|
3971
|
+
return currentValue >= min && currentValue <= max;
|
|
3972
|
+
}
|
|
3973
|
+
}
|
|
3974
|
+
]
|
|
3975
|
+
}
|
|
3976
|
+
};
|
|
3977
|
+
return result;
|
|
3978
|
+
}
|
|
3979
|
+
var defaultFilterTypes = getFilterTypes();
|
|
3980
|
+
|
|
3981
|
+
// src/components/InfiniteTable/hooks/useCellClassName.ts
|
|
3982
|
+
function useCellClassName(column, baseClasses, variants, extraFlags) {
|
|
3983
|
+
const result = [...baseClasses];
|
|
3984
|
+
const variantObject = {
|
|
3985
|
+
filtered: column.computedFiltered,
|
|
3986
|
+
first: column.computedFirst,
|
|
3987
|
+
last: column.computedLast,
|
|
3988
|
+
groupByField: !!column.groupByField,
|
|
3989
|
+
firstInCategory: column.computedFirstInCategory,
|
|
3990
|
+
lastInCategory: column.computedLastInCategory,
|
|
3991
|
+
pinned: column.computedPinned || false,
|
|
3992
|
+
rowActive: extraFlags.rowActive,
|
|
3993
|
+
dragging: extraFlags.dragging,
|
|
3994
|
+
zebra: extraFlags.zebra
|
|
3995
|
+
};
|
|
3996
|
+
const theVariant = variants(variantObject);
|
|
3997
|
+
result.push(theVariant);
|
|
3998
|
+
if (column.computedFirst) {
|
|
3999
|
+
result.push(...baseClasses.map((c) => `${c}--first`));
|
|
4000
|
+
}
|
|
4001
|
+
if (column.groupByField) {
|
|
4002
|
+
result.push(...baseClasses.map((c) => `${c}--group-column`));
|
|
4003
|
+
}
|
|
4004
|
+
if (column.computedLast) {
|
|
4005
|
+
result.push(...baseClasses.map((c) => `${c}--last`));
|
|
4006
|
+
}
|
|
4007
|
+
if (column.computedFirstInCategory) {
|
|
4008
|
+
result.push(...baseClasses.map((c) => `${c}--first-in-category`));
|
|
4009
|
+
}
|
|
4010
|
+
if (column.computedLastInCategory) {
|
|
4011
|
+
result.push(...baseClasses.map((c) => `${c}--last-in-category`));
|
|
4012
|
+
}
|
|
4013
|
+
if (column.computedPinned) {
|
|
4014
|
+
result.push(...baseClasses.map((c) => `${c}--pinned-${column.computedPinned}`));
|
|
4015
|
+
} else {
|
|
4016
|
+
result.push(...baseClasses.map((c) => `${c}--unpinned`));
|
|
4017
|
+
}
|
|
4018
|
+
return result.filter(Boolean).join(" ");
|
|
4019
|
+
}
|
|
4020
|
+
|
|
4021
|
+
// src/components/InfiniteTable/hooks/useColumnPointerEvents.ts
|
|
4022
|
+
var import_binary_search2 = __toModule(require_binary_search());
|
|
3583
4023
|
import {
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
4024
|
+
useCallback as useCallback6,
|
|
4025
|
+
useMemo as useMemo4,
|
|
4026
|
+
useRef as useRef11,
|
|
4027
|
+
useState as useState7
|
|
3587
4028
|
} from "react";
|
|
3588
4029
|
|
|
3589
|
-
// src/components/InfiniteTable/hooks/
|
|
4030
|
+
// src/components/InfiniteTable/hooks/useInfiniteTable.ts
|
|
3590
4031
|
import { useContext as useContext3 } from "react";
|
|
3591
4032
|
|
|
3592
4033
|
// src/components/InfiniteTable/InfiniteTableContext.ts
|
|
@@ -3599,119 +4040,28 @@ function getInfiniteTableContext() {
|
|
|
3599
4040
|
return TableContext = createContext3(null);
|
|
3600
4041
|
}
|
|
3601
4042
|
|
|
3602
|
-
// src/components/InfiniteTable/hooks/
|
|
3603
|
-
var
|
|
4043
|
+
// src/components/InfiniteTable/hooks/useInfiniteTable.ts
|
|
4044
|
+
var useInfiniteTable = () => {
|
|
3604
4045
|
const TableContext2 = getInfiniteTableContext();
|
|
3605
|
-
|
|
3606
|
-
return componentState;
|
|
4046
|
+
return useContext3(TableContext2);
|
|
3607
4047
|
};
|
|
3608
4048
|
|
|
3609
|
-
// src/components/InfiniteTable/
|
|
3610
|
-
var
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
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
|
-
}
|
|
3664
|
-
}
|
|
3665
|
-
const finalDOMProps = __spreadProps(__spreadValues({}, domProps), {
|
|
3666
|
-
style,
|
|
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));
|
|
3676
|
-
}
|
|
3677
|
-
return /* @__PURE__ */ createElement9("div", __spreadProps(__spreadValues({}, finalDOMProps), {
|
|
3678
|
-
ref: domRef
|
|
3679
|
-
}));
|
|
3680
|
-
}
|
|
3681
|
-
var InfiniteTableCell = memo5(InfiniteTableCellFn);
|
|
3682
|
-
|
|
3683
|
-
// src/components/InfiniteTable/hooks/useColumnPointerEvents.ts
|
|
3684
|
-
var import_binary_search2 = __toModule(require_binary_search());
|
|
3685
|
-
import {
|
|
3686
|
-
useCallback as useCallback5,
|
|
3687
|
-
useMemo as useMemo4,
|
|
3688
|
-
useRef as useRef9,
|
|
3689
|
-
useState as useState4
|
|
3690
|
-
} from "react";
|
|
3691
|
-
|
|
3692
|
-
// src/components/InfiniteTable/hooks/useInfiniteTable.ts
|
|
3693
|
-
import { useContext as useContext4 } from "react";
|
|
3694
|
-
var useInfiniteTable = () => {
|
|
3695
|
-
const TableContext2 = getInfiniteTableContext();
|
|
3696
|
-
return useContext4(TableContext2);
|
|
3697
|
-
};
|
|
3698
|
-
|
|
3699
|
-
// src/components/InfiniteTable/utils/moveXatY.ts
|
|
3700
|
-
var moveXatY = (arr, dragIndex, dropIndex) => {
|
|
3701
|
-
arr = [...arr];
|
|
3702
|
-
if (dragIndex === dropIndex || arr[dragIndex] === void 0 || arr[dropIndex] === void 0) {
|
|
3703
|
-
return arr;
|
|
3704
|
-
}
|
|
3705
|
-
const dragItem = arr[dragIndex];
|
|
3706
|
-
if (dropIndex < dragIndex) {
|
|
3707
|
-
arr.splice(dragIndex, 1);
|
|
3708
|
-
arr.splice(dropIndex, 0, dragItem);
|
|
3709
|
-
} else {
|
|
3710
|
-
arr.splice(dragIndex, 1);
|
|
3711
|
-
arr.splice(dropIndex, 0, dragItem);
|
|
3712
|
-
}
|
|
3713
|
-
return arr;
|
|
3714
|
-
};
|
|
4049
|
+
// src/components/InfiniteTable/utils/moveXatY.ts
|
|
4050
|
+
var moveXatY = (arr, dragIndex, dropIndex) => {
|
|
4051
|
+
arr = [...arr];
|
|
4052
|
+
if (dragIndex === dropIndex || arr[dragIndex] === void 0 || arr[dropIndex] === void 0) {
|
|
4053
|
+
return arr;
|
|
4054
|
+
}
|
|
4055
|
+
const dragItem = arr[dragIndex];
|
|
4056
|
+
if (dropIndex < dragIndex) {
|
|
4057
|
+
arr.splice(dragIndex, 1);
|
|
4058
|
+
arr.splice(dropIndex, 0, dragItem);
|
|
4059
|
+
} else {
|
|
4060
|
+
arr.splice(dragIndex, 1);
|
|
4061
|
+
arr.splice(dropIndex, 0, dragItem);
|
|
4062
|
+
}
|
|
4063
|
+
return arr;
|
|
4064
|
+
};
|
|
3715
4065
|
|
|
3716
4066
|
// src/components/InfiniteTable/hooks/useColumnPointerEvents.ts
|
|
3717
4067
|
var getBreakPoints = (columns) => {
|
|
@@ -3728,13 +4078,13 @@ var useColumnPointerEvents = ({
|
|
|
3728
4078
|
columns,
|
|
3729
4079
|
computedRemainingSpace
|
|
3730
4080
|
}) => {
|
|
3731
|
-
const [draggingDiff, setDraggingDiff] =
|
|
3732
|
-
const [proxyOffset, setProxyOffset] =
|
|
3733
|
-
const breakpointsRef =
|
|
3734
|
-
const pointerMoveRef =
|
|
3735
|
-
const didDragRef =
|
|
3736
|
-
const initialClientPos =
|
|
3737
|
-
const currentDropIndexRef =
|
|
4081
|
+
const [draggingDiff, setDraggingDiff] = useState7(null);
|
|
4082
|
+
const [proxyOffset, setProxyOffset] = useState7(null);
|
|
4083
|
+
const breakpointsRef = useRef11([]);
|
|
4084
|
+
const pointerMoveRef = useRef11(null);
|
|
4085
|
+
const didDragRef = useRef11(false);
|
|
4086
|
+
const initialClientPos = useRef11(null);
|
|
4087
|
+
const currentDropIndexRef = useRef11(null);
|
|
3738
4088
|
const dragging = draggingDiff != null;
|
|
3739
4089
|
const { componentActions, computed } = useInfiniteTable();
|
|
3740
4090
|
const { computedColumnOrder } = computed;
|
|
@@ -3747,8 +4097,8 @@ var useColumnPointerEvents = ({
|
|
|
3747
4097
|
columnWidth: column.computedWidth
|
|
3748
4098
|
};
|
|
3749
4099
|
}, [columns, columnId, column]);
|
|
3750
|
-
let cursorRef =
|
|
3751
|
-
const onPointerDown =
|
|
4100
|
+
let cursorRef = useRef11("auto");
|
|
4101
|
+
const onPointerDown = useCallback6((e) => {
|
|
3752
4102
|
const target = domRef.current;
|
|
3753
4103
|
cursorRef.current = target.style.cursor;
|
|
3754
4104
|
didDragRef.current = false;
|
|
@@ -3811,7 +4161,7 @@ var useColumnPointerEvents = ({
|
|
|
3811
4161
|
target.addEventListener("pointermove", onPointerMove);
|
|
3812
4162
|
target.setPointerCapture(e.pointerId);
|
|
3813
4163
|
}, [columns, column, columnIndex, columnsArray, computedRemainingSpace]);
|
|
3814
|
-
const onPointerUp =
|
|
4164
|
+
const onPointerUp = useCallback6((e) => {
|
|
3815
4165
|
const target = domRef.current;
|
|
3816
4166
|
target.style.cursor = cursorRef.current;
|
|
3817
4167
|
target.releasePointerCapture(e.pointerId);
|
|
@@ -3844,49 +4194,71 @@ var useColumnPointerEvents = ({
|
|
|
3844
4194
|
};
|
|
3845
4195
|
};
|
|
3846
4196
|
|
|
3847
|
-
// src/components/InfiniteTable/
|
|
3848
|
-
function
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
4197
|
+
// src/components/InfiniteTable/utils/RenderHookComponent.tsx
|
|
4198
|
+
function RenderHookComponent(props) {
|
|
4199
|
+
var _a;
|
|
4200
|
+
return (_a = props.render(props.renderParam)) != null ? _a : null;
|
|
4201
|
+
}
|
|
4202
|
+
|
|
4203
|
+
// src/components/InfiniteTable/components/FilterEditors.tsx
|
|
4204
|
+
import React16 from "react";
|
|
4205
|
+
function getFilterEditors() {
|
|
4206
|
+
return {
|
|
4207
|
+
string: StringFilterEditor,
|
|
4208
|
+
number: NumberFilterEditor
|
|
3859
4209
|
};
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
4210
|
+
}
|
|
4211
|
+
var defaultFilterEditors = getFilterEditors();
|
|
4212
|
+
function StringFilterEditor(props) {
|
|
4213
|
+
return /* @__PURE__ */ React16.createElement("input", {
|
|
4214
|
+
"aria-label": `Filter for ${props.ariaLabel}`,
|
|
4215
|
+
type: "text",
|
|
4216
|
+
value: props.filterValue,
|
|
4217
|
+
onChange: (event) => {
|
|
4218
|
+
props.onChange(event.target.value);
|
|
4219
|
+
},
|
|
4220
|
+
className: props.className
|
|
4221
|
+
});
|
|
4222
|
+
}
|
|
4223
|
+
function NumberFilterEditor(props) {
|
|
4224
|
+
return /* @__PURE__ */ React16.createElement("input", {
|
|
4225
|
+
"aria-label": `Filter for ${props.ariaLabel}`,
|
|
4226
|
+
type: "number",
|
|
4227
|
+
value: props.filterValue,
|
|
4228
|
+
onChange: (event) => {
|
|
4229
|
+
let value = event.target.value;
|
|
4230
|
+
if (!isNaN(value + "")) {
|
|
4231
|
+
value = value + "";
|
|
4232
|
+
}
|
|
4233
|
+
props.onChange(value);
|
|
4234
|
+
},
|
|
4235
|
+
className: props.className
|
|
4236
|
+
});
|
|
3883
4237
|
}
|
|
3884
4238
|
|
|
3885
4239
|
// src/components/InfiniteTable/components/icons/SortIcon.tsx
|
|
3886
4240
|
import {
|
|
3887
|
-
createElement as
|
|
4241
|
+
createElement as createElement12
|
|
3888
4242
|
} from "react";
|
|
3889
|
-
import { useEffect as
|
|
4243
|
+
import { useEffect as useEffect9, useState as useState8 } from "react";
|
|
4244
|
+
|
|
4245
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts
|
|
4246
|
+
var import_createRuntimeFn = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
4247
|
+
var CellCls = "_1eexc2a5 _16lm1iwm _16lm1iw13 _16lm1iw14 _16lm1iw2 _16lm1iw1c _16lm1iw1d";
|
|
4248
|
+
var HeaderCellContentRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_12zfob117 _16lm1iwr _16lm1iwt _16lm1iwm _16lm1iw13 _16lm1iw14", variantClassNames: { filtered: { false: "_12zfob118", true: "_12zfob119" } }, defaultVariants: {}, compoundVariants: [] });
|
|
4249
|
+
var HeaderCellProxy = "_12zfob10";
|
|
4250
|
+
var HeaderCellRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_12zfob1h _16lm1iwn", variantClassNames: { rowActive: { false: "_12zfob1i", true: "_12zfob1j" }, zebra: { false: "_12zfob1k", even: "_12zfob1l", odd: "_12zfob1m" }, dragging: { true: "_12zfob1n", false: "_12zfob1o" }, first: { true: "_12zfob1p", false: "_12zfob1q" }, last: { true: "_12zfob1r", false: "_12zfob1s" }, groupByField: { true: "_12zfob1t", false: "_12zfob1u" }, firstInCategory: { true: "_12zfob1v", false: "_12zfob1w" }, lastInCategory: { true: "_12zfob1x", false: "_12zfob1y" }, pinned: { start: "_12zfob1z", end: "_12zfob110", false: "_12zfob111" }, filtered: { true: "_12zfob112", false: "_12zfob113" } }, defaultVariants: {}, compoundVariants: [[{ pinned: "start", lastInCategory: true }, "_12zfob114"], [{ pinned: "end", firstInCategory: true }, "_12zfob115"], [{ pinned: false, lastInCategory: true }, "_12zfob116"]] });
|
|
4251
|
+
var HeaderClsRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_12zfob17 _16lm1iwn _16lm1iw2", variantClassNames: { pinned: { start: "_12zfob18", end: "_12zfob19", false: "_12zfob1a" }, virtualized: { true: "_12zfob1b", false: "_12zfob1c" }, overflow: { true: "_12zfob1d", false: "_12zfob1e" } }, defaultVariants: {}, compoundVariants: [[{ overflow: true, pinned: "start" }, "_12zfob1f"], [{ overflow: true, pinned: "end" }, "_12zfob1g"]] });
|
|
4252
|
+
var HeaderFilterCls = "_12zfob11c _16lm1iwm _16lm1iw13 _16lm1iw14 _16lm1iw1";
|
|
4253
|
+
var HeaderFilterEditorCls = "_16lm1iwt _16lm1iwr";
|
|
4254
|
+
var HeaderGroupCls = "_12zfob11b _16lm1iwm _16lm1iw13 _16lm1iw14";
|
|
4255
|
+
var HeaderScrollbarPlaceholderCls = "_12zfob16 _16lm1iw2";
|
|
4256
|
+
var HeaderSortIconCls = "_16lm1iw1";
|
|
4257
|
+
var HeaderSortIconIndexCls = "_12zfob15";
|
|
4258
|
+
var HeaderSortIconRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "", variantClassNames: { align: { start: "_12zfob12", center: "_12zfob13", end: "_12zfob14" } }, defaultVariants: {}, compoundVariants: [] });
|
|
4259
|
+
var HeaderWrapperCls = "_12zfob11a _16lm1iw19 _16lm1iw1 _16lm1iwm _16lm1iw13";
|
|
4260
|
+
|
|
4261
|
+
// src/components/InfiniteTable/components/icons/SortIcon.tsx
|
|
3890
4262
|
var defaultLineStyle = {
|
|
3891
4263
|
marginTop: 2,
|
|
3892
4264
|
marginBottom: 2,
|
|
@@ -3895,8 +4267,8 @@ var defaultLineStyle = {
|
|
|
3895
4267
|
var InfiniteTableIconClassName = "InfiniteTableIcon";
|
|
3896
4268
|
function SortIcon(props) {
|
|
3897
4269
|
var _a;
|
|
3898
|
-
const [rendered, setRendered] =
|
|
3899
|
-
const [opacity, setOpacity] =
|
|
4270
|
+
const [rendered, setRendered] = useState8(true);
|
|
4271
|
+
const [opacity, setOpacity] = useState8(0);
|
|
3900
4272
|
const { direction, lineWidth = 1, style, className, index } = props;
|
|
3901
4273
|
const showIndex = index != null && index > 0;
|
|
3902
4274
|
const size = (_a = props.size) != null ? _a : 16;
|
|
@@ -3910,16 +4282,21 @@ function SortIcon(props) {
|
|
|
3910
4282
|
}), props.lineStyle), {
|
|
3911
4283
|
opacity
|
|
3912
4284
|
});
|
|
3913
|
-
|
|
4285
|
+
useEffect9(() => {
|
|
3914
4286
|
const newOpacity = direction != 0 ? 1 : 0;
|
|
3915
4287
|
if (!rendered && newOpacity) {
|
|
3916
4288
|
setRendered(true);
|
|
3917
4289
|
}
|
|
3918
4290
|
if (newOpacity !== opacity) {
|
|
3919
|
-
requestAnimationFrame(() => {
|
|
4291
|
+
const rafId = requestAnimationFrame(() => {
|
|
3920
4292
|
setOpacity(newOpacity);
|
|
3921
4293
|
});
|
|
4294
|
+
return () => {
|
|
4295
|
+
cancelAnimationFrame(rafId);
|
|
4296
|
+
};
|
|
3922
4297
|
}
|
|
4298
|
+
return () => {
|
|
4299
|
+
};
|
|
3923
4300
|
}, [direction, rendered]);
|
|
3924
4301
|
const onTransitionEnd = () => {
|
|
3925
4302
|
const hidden = opacity === 0 && direction === 0;
|
|
@@ -3931,91 +4308,231 @@ function SortIcon(props) {
|
|
|
3931
4308
|
if (!rendered) {
|
|
3932
4309
|
return null;
|
|
3933
4310
|
}
|
|
3934
|
-
const indexStyle = {
|
|
3935
|
-
position: "absolute",
|
|
3936
|
-
transition: "top 0.2s",
|
|
3937
|
-
top: 0,
|
|
3938
|
-
right: 2
|
|
3939
|
-
};
|
|
4311
|
+
const indexStyle = {};
|
|
3940
4312
|
if (direction === -1) {
|
|
3941
4313
|
indexStyle.top = "100%";
|
|
3942
4314
|
}
|
|
3943
|
-
return /* @__PURE__ */
|
|
4315
|
+
return /* @__PURE__ */ createElement12("div", {
|
|
3944
4316
|
style: __spreadProps(__spreadValues({}, style), { width: size }),
|
|
3945
4317
|
className: join(className, InfiniteTableIconClassName, `${InfiniteTableIconClassName}-sort`)
|
|
3946
|
-
}, showIndex ? /* @__PURE__ */
|
|
4318
|
+
}, showIndex ? /* @__PURE__ */ createElement12("div", {
|
|
3947
4319
|
"data-name": "index",
|
|
3948
|
-
style: indexStyle
|
|
3949
|
-
|
|
4320
|
+
style: indexStyle,
|
|
4321
|
+
className: HeaderSortIconIndexCls
|
|
4322
|
+
}, index) : null, /* @__PURE__ */ createElement12("div", {
|
|
3950
4323
|
style: __spreadValues({ width: sizes[0] }, lineStyle),
|
|
3951
4324
|
onTransitionEnd
|
|
3952
|
-
}), /* @__PURE__ */
|
|
4325
|
+
}), /* @__PURE__ */ createElement12("div", {
|
|
3953
4326
|
style: __spreadValues({ width: sizes[1] }, lineStyle)
|
|
3954
|
-
}), /* @__PURE__ */
|
|
4327
|
+
}), /* @__PURE__ */ createElement12("div", {
|
|
3955
4328
|
style: __spreadValues({ width: sizes[2] }, lineStyle)
|
|
3956
4329
|
}));
|
|
3957
4330
|
}
|
|
3958
4331
|
|
|
3959
|
-
// src/components/InfiniteTable/components/
|
|
4332
|
+
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
|
|
4333
|
+
import {
|
|
4334
|
+
Fragment,
|
|
4335
|
+
createElement as createElement13,
|
|
4336
|
+
memo as memo7
|
|
4337
|
+
} from "react";
|
|
4338
|
+
|
|
4339
|
+
// src/components/InfiniteTable/hooks/useInfiniteTableState.ts
|
|
4340
|
+
import { useContext as useContext4 } from "react";
|
|
4341
|
+
var useInfiniteTableState = () => {
|
|
4342
|
+
const TableContext2 = getInfiniteTableContext();
|
|
4343
|
+
const { componentState } = useContext4(TableContext2);
|
|
4344
|
+
return componentState;
|
|
4345
|
+
};
|
|
4346
|
+
|
|
4347
|
+
// src/components/InfiniteTable/components/cell.css.ts
|
|
3960
4348
|
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";
|
|
4349
|
+
var CellClsVariants = { shifting: "_1eexc2a3", dragging: "_1eexc2a4" };
|
|
4350
|
+
var ColumnCellCls = "_1eexc2a5 _16lm1iwm _16lm1iw13 _16lm1iw14 _16lm1iw2 _16lm1iw1c _16lm1iw1d";
|
|
4351
|
+
var ColumnCellRecipe = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "_1eexc2a7", variantClassNames: { dragging: { false: "_1eexc2a8", true: "_1eexc2a9" }, rowActive: { false: "_1eexc2aa", true: "_1eexc2ab" }, zebra: { false: "_1eexc2ac", even: "_1eexc2ad", odd: "_1eexc2ae" }, first: { true: "_1eexc2af", false: "_1eexc2ag" }, last: { true: "_1eexc2ah", false: "_1eexc2ai" }, groupByField: { true: "_1eexc2aj", false: "_1eexc2ak" }, firstInCategory: { true: "_1eexc2al", false: "_1eexc2am" }, lastInCategory: { true: "_1eexc2an", false: "_1eexc2ao" }, pinned: { start: "_1eexc2ap", end: "_1eexc2aq", false: "_1eexc2ar" }, filtered: { true: "_1eexc2as", false: "_1eexc2at" } }, defaultVariants: {}, compoundVariants: [[{ pinned: "start", lastInCategory: true }, "_1eexc2au"], [{ pinned: "end", firstInCategory: true }, "_1eexc2av"]] });
|
|
3969
4352
|
|
|
3970
|
-
// src/components/InfiniteTable/
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
4353
|
+
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
|
|
4354
|
+
var { rootClassName: rootClassName5 } = internalProps;
|
|
4355
|
+
var InfiniteTableCellClassName = `${rootClassName5}Cell`;
|
|
4356
|
+
var InfiniteTableCellContentClassName = `${rootClassName5}Cell_content`;
|
|
4357
|
+
function InfiniteTableCellFn(props) {
|
|
4358
|
+
var _b, _c, _d;
|
|
4359
|
+
const _a = props, {
|
|
4360
|
+
cssEllipsis = true,
|
|
4361
|
+
virtualized = true,
|
|
4362
|
+
skipColumnShifting = false,
|
|
4363
|
+
offsetProperty = "left",
|
|
4364
|
+
contentStyle,
|
|
4365
|
+
column,
|
|
4366
|
+
domRef,
|
|
4367
|
+
width,
|
|
4368
|
+
contentClassName,
|
|
4369
|
+
afterChildren,
|
|
4370
|
+
beforeChildren,
|
|
4371
|
+
offset,
|
|
4372
|
+
cellType,
|
|
4373
|
+
cssPosition: _cssPosition,
|
|
4374
|
+
renderChildren
|
|
4375
|
+
} = _a, domProps = __objRest(_a, [
|
|
4376
|
+
"cssEllipsis",
|
|
4377
|
+
"virtualized",
|
|
4378
|
+
"skipColumnShifting",
|
|
4379
|
+
"offsetProperty",
|
|
4380
|
+
"contentStyle",
|
|
4381
|
+
"column",
|
|
4382
|
+
"domRef",
|
|
4383
|
+
"width",
|
|
4384
|
+
"contentClassName",
|
|
4385
|
+
"afterChildren",
|
|
4386
|
+
"beforeChildren",
|
|
4387
|
+
"offset",
|
|
4388
|
+
"cellType",
|
|
4389
|
+
"cssPosition",
|
|
4390
|
+
"renderChildren"
|
|
4391
|
+
]);
|
|
4392
|
+
const children = renderChildren();
|
|
4393
|
+
const { columnShifts } = useInfiniteTableState();
|
|
4394
|
+
const shifting = !!columnShifts;
|
|
4395
|
+
const style = __spreadValues({
|
|
4396
|
+
width
|
|
4397
|
+
}, domProps.style);
|
|
4398
|
+
if (!skipColumnShifting && columnShifts && columnShifts[column.computedVisibleIndex]) {
|
|
4399
|
+
const shiftLeft = columnShifts[column.computedVisibleIndex] + (offset != null ? offset : 0);
|
|
4400
|
+
if (virtualized) {
|
|
4401
|
+
style.left = shiftLeft;
|
|
4402
|
+
} else {
|
|
4403
|
+
style.transform = `translate3d(${shiftLeft}px, 0px, 0px)`;
|
|
4404
|
+
}
|
|
4405
|
+
}
|
|
4406
|
+
const finalDOMProps = __spreadProps(__spreadValues({}, domProps), {
|
|
4407
|
+
style,
|
|
4408
|
+
"data-column-id": column.id,
|
|
4409
|
+
className: join(domProps.className, justifyContent[(_b = column.align) != null ? _b : "start"], InfiniteTableCellClassName, ColumnCellCls, shifting ? `${InfiniteTableCellClassName}--shifting ${CellClsVariants.shifting}` : ""),
|
|
4410
|
+
children: /* @__PURE__ */ createElement13(Fragment, null, beforeChildren, /* @__PURE__ */ createElement13("div", {
|
|
4411
|
+
className: join(InfiniteTableCellContentClassName, cssEllipsis ? cssEllipsisClassName : overflow.hidden, contentClassName),
|
|
4412
|
+
style: contentStyle
|
|
4413
|
+
}, children), afterChildren)
|
|
4414
|
+
});
|
|
4415
|
+
const RenderComponent = cellType === "body" ? (_c = column.components) == null ? void 0 : _c.ColumnCell : (_d = column.components) == null ? void 0 : _d.HeaderCell;
|
|
4416
|
+
if (RenderComponent) {
|
|
4417
|
+
return /* @__PURE__ */ createElement13(RenderComponent, __spreadValues({}, finalDOMProps));
|
|
4418
|
+
}
|
|
4419
|
+
return /* @__PURE__ */ createElement13("div", __spreadProps(__spreadValues({}, finalDOMProps), {
|
|
4420
|
+
ref: domRef
|
|
4421
|
+
}));
|
|
4422
|
+
}
|
|
4423
|
+
var InfiniteTableCell = memo7(InfiniteTableCellFn);
|
|
4424
|
+
|
|
4425
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableColumnHeaderFilter.tsx
|
|
4426
|
+
import {
|
|
4427
|
+
createElement as createElement14
|
|
4428
|
+
} from "react";
|
|
4429
|
+
import { useEffect as useEffect10, useState as useState9 } from "react";
|
|
4430
|
+
var { rootClassName: rootClassName6 } = internalProps;
|
|
4431
|
+
var InfiniteTableColumnHeaderFilterClassName = `${rootClassName6}HeaderCell__filter`;
|
|
4432
|
+
var stopPropagation = (e) => e.stopPropagation();
|
|
4433
|
+
function InfiniteTableColumnHeaderFilter(props) {
|
|
4434
|
+
var _a, _b, _c, _d;
|
|
4435
|
+
const [theValue, setTheValue] = useState9((_b = (_a = props.columnFilterValue) == null ? void 0 : _a.filterValue) != null ? _b : "");
|
|
4436
|
+
const onInputChange = (filterValue) => {
|
|
4437
|
+
setTheValue(filterValue);
|
|
4438
|
+
props.onChange(filterValue);
|
|
4439
|
+
};
|
|
4440
|
+
useEffect10(() => {
|
|
4441
|
+
var _a2;
|
|
4442
|
+
if (props.columnFilterValue) {
|
|
4443
|
+
if (theValue !== props.columnFilterValue.filterValue) {
|
|
4444
|
+
setTheValue(props.columnFilterValue.filterValue);
|
|
4445
|
+
}
|
|
4446
|
+
} else {
|
|
4447
|
+
const currentFilterType = props.filterTypes[(_a2 = props.columnFilterType) != null ? _a2 : "string"];
|
|
4448
|
+
if (currentFilterType) {
|
|
4449
|
+
const emptyValue = [...currentFilterType.emptyValues][0];
|
|
4450
|
+
if (emptyValue !== theValue) {
|
|
4451
|
+
setTheValue(emptyValue);
|
|
4452
|
+
}
|
|
4453
|
+
}
|
|
4454
|
+
}
|
|
4455
|
+
}, [(_c = props.columnFilterValue) == null ? void 0 : _c.filterValue]);
|
|
4456
|
+
const filterType = props.columnFilterValue ? props.columnFilterValue.filterType : (_d = props.columnFilterType) != null ? _d : "string";
|
|
4457
|
+
const operator = props.columnFilterValue ? props.columnFilterValue.operator : props.filterTypes[filterType] ? props.filterTypes[filterType].defaultOperator : props.filterTypes.string.defaultOperator;
|
|
4458
|
+
const filterEditorProps = {
|
|
4459
|
+
ariaLabel: `Filter for ${props.columnLabel}`,
|
|
4460
|
+
filterValue: theValue,
|
|
4461
|
+
className: HeaderFilterEditorCls,
|
|
4462
|
+
operator,
|
|
4463
|
+
filterType,
|
|
4464
|
+
onChange: onInputChange
|
|
4465
|
+
};
|
|
4466
|
+
const FilterEditor = props.filterEditor;
|
|
4467
|
+
return /* @__PURE__ */ createElement14("div", {
|
|
4468
|
+
onPointerUp: stopPropagation,
|
|
4469
|
+
onPointerDown: stopPropagation,
|
|
4470
|
+
className: `${InfiniteTableColumnHeaderFilterClassName} ${HeaderFilterCls}`,
|
|
4471
|
+
style: { height: props.columnHeaderHeight }
|
|
4472
|
+
}, FilterEditor ? /* @__PURE__ */ createElement14(FilterEditor, __spreadValues({}, filterEditorProps)) : null);
|
|
4473
|
+
}
|
|
4474
|
+
function InfiniteTableColumnHeaderFilterEmpty() {
|
|
4475
|
+
return /* @__PURE__ */ createElement14("div", {
|
|
4476
|
+
onPointerUp: stopPropagation,
|
|
4477
|
+
onPointerDown: stopPropagation,
|
|
4478
|
+
className: `${InfiniteTableColumnHeaderFilterClassName} ${HeaderFilterCls}`,
|
|
4479
|
+
style: { height: "100%" }
|
|
4480
|
+
});
|
|
3974
4481
|
}
|
|
3975
4482
|
|
|
3976
4483
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
|
|
3977
4484
|
var InfiniteTableHeaderCellContext = createContext4(null);
|
|
3978
|
-
var { rootClassName:
|
|
3979
|
-
var InfiniteTableHeaderCellClassName = `${
|
|
4485
|
+
var { rootClassName: rootClassName7 } = internalProps;
|
|
4486
|
+
var InfiniteTableHeaderCellClassName = `${rootClassName7}HeaderCell`;
|
|
3980
4487
|
function InfiniteTableHeaderCell(props) {
|
|
3981
|
-
var _a, _b, _c, _d;
|
|
4488
|
+
var _a, _b, _c, _d, _e;
|
|
3982
4489
|
const column = props.column;
|
|
3983
4490
|
const columns = props.columns;
|
|
3984
|
-
const { onResize, height, width } = props;
|
|
4491
|
+
const { onResize, height, width, headerOptions } = props;
|
|
3985
4492
|
const sortInfo = column.computedSortInfo;
|
|
3986
4493
|
let header = column.header;
|
|
3987
|
-
const ref =
|
|
4494
|
+
const ref = useCallback7((node) => {
|
|
3988
4495
|
var _a2;
|
|
3989
4496
|
domRef.current = node;
|
|
3990
4497
|
(_a2 = props.domRef) == null ? void 0 : _a2.call(props, node);
|
|
3991
4498
|
}, [props.domRef]);
|
|
3992
|
-
const
|
|
4499
|
+
const alwaysShow = headerOptions.alwaysReserveSpaceForSortIcon;
|
|
4500
|
+
const sortTool = column.computedSorted || alwaysShow ? /* @__PURE__ */ createElement15(SortIcon, {
|
|
3993
4501
|
index: column.computedMultiSort ? column.computedSortIndex + 1 : void 0,
|
|
3994
|
-
className: `${InfiniteTableHeaderCellClassName}__sort-icon ${HeaderSortIconCls}
|
|
4502
|
+
className: `${InfiniteTableHeaderCellClassName}__sort-icon ${HeaderSortIconCls} ${HeaderSortIconRecipe({
|
|
4503
|
+
align: column.align || "start"
|
|
4504
|
+
})}`,
|
|
3995
4505
|
direction: column.computedSorted ? column.computedSortedAsc ? 1 : -1 : 0
|
|
3996
|
-
});
|
|
4506
|
+
}) : null;
|
|
3997
4507
|
const renderParam = {
|
|
3998
4508
|
domRef: ref,
|
|
3999
4509
|
column,
|
|
4000
4510
|
columnSortInfo: sortInfo,
|
|
4511
|
+
columnFilterValue: column.computedFilterValue,
|
|
4001
4512
|
sortTool
|
|
4002
4513
|
};
|
|
4514
|
+
const align = column.align || "start";
|
|
4003
4515
|
const renderChildren = () => {
|
|
4004
4516
|
if (header instanceof Function) {
|
|
4005
|
-
header = /* @__PURE__ */
|
|
4517
|
+
header = /* @__PURE__ */ createElement15(RenderHookComponent, {
|
|
4006
4518
|
render: header,
|
|
4007
4519
|
renderParam
|
|
4008
4520
|
});
|
|
4009
4521
|
}
|
|
4010
4522
|
header = header != null ? header : column.name;
|
|
4011
|
-
return header;
|
|
4523
|
+
return /* @__PURE__ */ createElement15(Fragment2, null, align === "end" ? sortTool : null, header, align !== "end" ? sortTool : null);
|
|
4012
4524
|
};
|
|
4013
|
-
const domRef =
|
|
4525
|
+
const domRef = useRef12(null);
|
|
4014
4526
|
const {
|
|
4015
|
-
computed: { computedRemainingSpace },
|
|
4016
|
-
componentState: { portalDOMRef }
|
|
4527
|
+
computed: { computedRemainingSpace, showColumnFilters },
|
|
4528
|
+
componentState: { portalDOMRef, columnHeaderHeight, filterEditors }
|
|
4017
4529
|
} = useInfiniteTable();
|
|
4018
|
-
|
|
4530
|
+
const {
|
|
4531
|
+
componentActions: dataSourceActions,
|
|
4532
|
+
getState: getDataSourceState,
|
|
4533
|
+
componentState: { filterDelay, filterTypes }
|
|
4534
|
+
} = useDataSourceContextValue();
|
|
4535
|
+
useEffect11(() => {
|
|
4019
4536
|
let clearOnResize = null;
|
|
4020
4537
|
const node = domRef.current;
|
|
4021
4538
|
if (onResize && node) {
|
|
@@ -4036,7 +4553,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4036
4553
|
});
|
|
4037
4554
|
let draggingProxy = null;
|
|
4038
4555
|
if (dragging) {
|
|
4039
|
-
draggingProxy = /* @__PURE__ */
|
|
4556
|
+
draggingProxy = /* @__PURE__ */ createElement15("div", {
|
|
4040
4557
|
className: `${InfiniteTableHeaderCellClassName}Proxy ${HeaderCellProxy}`,
|
|
4041
4558
|
style: {
|
|
4042
4559
|
position: "absolute",
|
|
@@ -4050,9 +4567,73 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4050
4567
|
draggingProxy = createPortal(draggingProxy, portalDOMRef.current);
|
|
4051
4568
|
}
|
|
4052
4569
|
const ContextProvider = InfiniteTableHeaderCellContext.Provider;
|
|
4053
|
-
|
|
4570
|
+
const contentRecipeVariants = {
|
|
4571
|
+
filtered: column.computedFiltered
|
|
4572
|
+
};
|
|
4573
|
+
const setFilterValue = useCallback7((filterValue) => {
|
|
4574
|
+
var _a2;
|
|
4575
|
+
const state = getDataSourceState();
|
|
4576
|
+
let newFilterValue = (_a2 = state.filterValue) != null ? _a2 : [];
|
|
4577
|
+
let found = false;
|
|
4578
|
+
newFilterValue = newFilterValue.map((currentFilterValue) => {
|
|
4579
|
+
if (filterValue.id && currentFilterValue.id === filterValue.id || filterValue.field && currentFilterValue.field === column.field) {
|
|
4580
|
+
found = true;
|
|
4581
|
+
return filterValue;
|
|
4582
|
+
}
|
|
4583
|
+
return currentFilterValue;
|
|
4584
|
+
});
|
|
4585
|
+
if (!found) {
|
|
4586
|
+
newFilterValue.push(filterValue);
|
|
4587
|
+
}
|
|
4588
|
+
newFilterValue = newFilterValue.filter((filterValue2) => {
|
|
4589
|
+
const filterType2 = filterTypes[filterValue2.filterType];
|
|
4590
|
+
if (!filterType2 || filterType2.emptyValues.has(filterValue2.filterValue)) {
|
|
4591
|
+
return false;
|
|
4592
|
+
}
|
|
4593
|
+
return true;
|
|
4594
|
+
});
|
|
4595
|
+
dataSourceActions.filterValue = newFilterValue;
|
|
4596
|
+
}, [column, filterTypes]);
|
|
4597
|
+
const debouncedOnFilterValueChange = useMemo5(() => {
|
|
4598
|
+
const fn = (filterValue) => {
|
|
4599
|
+
let newFilterValueForColumn;
|
|
4600
|
+
if (column.computedFilterValue) {
|
|
4601
|
+
newFilterValueForColumn = __spreadValues({}, column.computedFilterValue);
|
|
4602
|
+
} else {
|
|
4603
|
+
const filterType2 = column.computedFilterType;
|
|
4604
|
+
const filterValueForColumn = {
|
|
4605
|
+
filterType: filterType2,
|
|
4606
|
+
operator: filterTypes[filterType2].defaultOperator,
|
|
4607
|
+
filterValue,
|
|
4608
|
+
valueGetter: column.valueGetter
|
|
4609
|
+
};
|
|
4610
|
+
if (column.field) {
|
|
4611
|
+
filterValueForColumn.field = column.field;
|
|
4612
|
+
} else {
|
|
4613
|
+
filterValueForColumn.id = column.id;
|
|
4614
|
+
}
|
|
4615
|
+
newFilterValueForColumn = filterValueForColumn;
|
|
4616
|
+
}
|
|
4617
|
+
newFilterValueForColumn.filterValue = filterValue;
|
|
4618
|
+
setFilterValue(newFilterValueForColumn);
|
|
4619
|
+
};
|
|
4620
|
+
if (filterDelay > 0) {
|
|
4621
|
+
return debounce(fn, { wait: filterDelay });
|
|
4622
|
+
}
|
|
4623
|
+
return fn;
|
|
4624
|
+
}, [
|
|
4625
|
+
filterDelay,
|
|
4626
|
+
setFilterValue,
|
|
4627
|
+
column.computedFilterValue,
|
|
4628
|
+
column.id,
|
|
4629
|
+
column.field,
|
|
4630
|
+
column.computedFilterType
|
|
4631
|
+
]);
|
|
4632
|
+
const filterType = column.computedFilterType;
|
|
4633
|
+
const FilterEditor = filterEditors[filterType] || defaultFilterEditors[filterType] || StringFilterEditor;
|
|
4634
|
+
return /* @__PURE__ */ createElement15(ContextProvider, {
|
|
4054
4635
|
value: renderParam
|
|
4055
|
-
}, /* @__PURE__ */
|
|
4636
|
+
}, /* @__PURE__ */ createElement15(InfiniteTableCell, {
|
|
4056
4637
|
domRef: ref,
|
|
4057
4638
|
cellType: "header",
|
|
4058
4639
|
column,
|
|
@@ -4062,9 +4643,19 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4062
4643
|
width,
|
|
4063
4644
|
onPointerDown,
|
|
4064
4645
|
onPointerUp,
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4646
|
+
contentClassName: join(HeaderCellContentRecipe(contentRecipeVariants), justifyContent[(_c = column.align) != null ? _c : "start"]),
|
|
4647
|
+
contentStyle: showColumnFilters ? { height: height / 2 } : void 0,
|
|
4648
|
+
className: join(InfiniteTableHeaderCellClassName, userSelect.none, column.computedSortable ? cursor.pointer : "", useCellClassName(column, [InfiniteTableHeaderCellClassName, InfiniteTableCellClassName], HeaderCellRecipe, { dragging, zebra: false, rowActive: false }), CellCls),
|
|
4649
|
+
cssEllipsis: (_e = (_d = column.headerCssEllipsis) != null ? _d : column.cssEllipsis) != null ? _e : true,
|
|
4650
|
+
afterChildren: showColumnFilters ? column.computedFilterable ? /* @__PURE__ */ createElement15(InfiniteTableColumnHeaderFilter, {
|
|
4651
|
+
filterEditor: FilterEditor,
|
|
4652
|
+
filterTypes,
|
|
4653
|
+
onChange: debouncedOnFilterValueChange,
|
|
4654
|
+
columnFilterType: filterType,
|
|
4655
|
+
columnLabel: column.field || column.name || column.id,
|
|
4656
|
+
columnFilterValue: column.computedFilterValue,
|
|
4657
|
+
columnHeaderHeight
|
|
4658
|
+
}) : /* @__PURE__ */ createElement15(InfiniteTableColumnHeaderFilterEmpty, null) : null,
|
|
4068
4659
|
renderChildren
|
|
4069
4660
|
}), draggingProxy);
|
|
4070
4661
|
}
|
|
@@ -4075,9 +4666,9 @@ function useInfiniteHeaderCell() {
|
|
|
4075
4666
|
|
|
4076
4667
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx
|
|
4077
4668
|
import {
|
|
4078
|
-
createElement as
|
|
4079
|
-
useCallback as
|
|
4080
|
-
useMemo as
|
|
4669
|
+
createElement as createElement18,
|
|
4670
|
+
useCallback as useCallback9,
|
|
4671
|
+
useMemo as useMemo6
|
|
4081
4672
|
} from "react";
|
|
4082
4673
|
|
|
4083
4674
|
// src/components/utils/getScrollbarWidth.ts
|
|
@@ -4201,14 +4792,14 @@ function assignGroupOffsetsAndComputedWidths(items, groupOffset = 0) {
|
|
|
4201
4792
|
|
|
4202
4793
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
|
|
4203
4794
|
import {
|
|
4204
|
-
createElement as
|
|
4205
|
-
memo as
|
|
4795
|
+
createElement as createElement17,
|
|
4796
|
+
memo as memo8
|
|
4206
4797
|
} from "react";
|
|
4207
|
-
import { useCallback as
|
|
4798
|
+
import { useCallback as useCallback8, useEffect as useEffect12, useRef as useRef13 } from "react";
|
|
4208
4799
|
|
|
4209
4800
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderGroup.tsx
|
|
4210
4801
|
import {
|
|
4211
|
-
createElement as
|
|
4802
|
+
createElement as createElement16
|
|
4212
4803
|
} from "react";
|
|
4213
4804
|
var TableHeaderGroupClassName = `${rootClassName2}HeaderGroup`;
|
|
4214
4805
|
function InfiniteTableHeaderGroup(props) {
|
|
@@ -4219,35 +4810,35 @@ function InfiniteTableHeaderGroup(props) {
|
|
|
4219
4810
|
columnGroup
|
|
4220
4811
|
});
|
|
4221
4812
|
}
|
|
4222
|
-
return /* @__PURE__ */
|
|
4813
|
+
return /* @__PURE__ */ createElement16("div", {
|
|
4223
4814
|
ref: props.domRef,
|
|
4224
4815
|
"data-group-id": columnGroup.uniqueGroupId,
|
|
4225
4816
|
className: join(HeaderGroupCls, TableHeaderGroupClassName),
|
|
4226
4817
|
style: { width, height }
|
|
4227
|
-
}, /* @__PURE__ */
|
|
4818
|
+
}, /* @__PURE__ */ createElement16("div", {
|
|
4228
4819
|
className: join(`${TableHeaderGroupClassName}__header-content`, cssEllipsisClassName)
|
|
4229
4820
|
}, header));
|
|
4230
4821
|
}
|
|
4231
4822
|
|
|
4232
4823
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
|
|
4233
|
-
var { rootClassName:
|
|
4234
|
-
var TableHeaderClassName = `${
|
|
4824
|
+
var { rootClassName: rootClassName8 } = internalProps;
|
|
4825
|
+
var TableHeaderClassName = `${rootClassName8}Header`;
|
|
4235
4826
|
function InfiniteTableHeaderFn(props) {
|
|
4236
4827
|
const {
|
|
4237
4828
|
brain,
|
|
4238
4829
|
columns,
|
|
4239
4830
|
style,
|
|
4240
4831
|
className,
|
|
4241
|
-
|
|
4832
|
+
columnHeaderHeight,
|
|
4242
4833
|
columnAndGroupTreeInfo,
|
|
4243
4834
|
columnGroupsMaxDepth
|
|
4244
4835
|
} = props;
|
|
4245
4836
|
const {
|
|
4246
4837
|
computed,
|
|
4247
|
-
componentState: { headerBrain }
|
|
4838
|
+
componentState: { headerBrain, headerOptions }
|
|
4248
4839
|
} = useInfiniteTable();
|
|
4249
|
-
const { computedVisibleColumnsMap } = computed;
|
|
4250
|
-
|
|
4840
|
+
const { computedVisibleColumnsMap, showColumnFilters } = computed;
|
|
4841
|
+
useEffect12(() => {
|
|
4251
4842
|
const onScroll = (scrollPosition) => {
|
|
4252
4843
|
if (domRef.current) {
|
|
4253
4844
|
domRef.current.style.transform = `translate3d(-${scrollPosition.scrollLeft}px, 0px, 0px)`;
|
|
@@ -4256,7 +4847,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4256
4847
|
const removeOnScroll = brain.onScroll(onScroll);
|
|
4257
4848
|
return removeOnScroll;
|
|
4258
4849
|
}, [brain]);
|
|
4259
|
-
const domRef =
|
|
4850
|
+
const domRef = useRef13(null);
|
|
4260
4851
|
const headerCls = HeaderClsRecipe({
|
|
4261
4852
|
overflow: false,
|
|
4262
4853
|
virtualized: true
|
|
@@ -4264,9 +4855,9 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4264
4855
|
const domProps = {
|
|
4265
4856
|
ref: domRef,
|
|
4266
4857
|
className: join(TableHeaderClassName, `${TableHeaderClassName}--virtualized`, className, headerCls),
|
|
4267
|
-
style: __spreadProps(__spreadValues({}, style), { height:
|
|
4858
|
+
style: __spreadProps(__spreadValues({}, style), { height: columnHeaderHeight })
|
|
4268
4859
|
};
|
|
4269
|
-
const renderCell =
|
|
4860
|
+
const renderCell = useCallback8((params) => {
|
|
4270
4861
|
const {
|
|
4271
4862
|
rowIndex,
|
|
4272
4863
|
colIndex,
|
|
@@ -4291,7 +4882,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4291
4882
|
computedWidth: colGroupItem.computedWidth,
|
|
4292
4883
|
groupOffset: colGroupItem.groupOffset
|
|
4293
4884
|
});
|
|
4294
|
-
return /* @__PURE__ */
|
|
4885
|
+
return /* @__PURE__ */ createElement17(InfiniteTableHeaderGroup, {
|
|
4295
4886
|
domRef: domRef2,
|
|
4296
4887
|
columns: columns2,
|
|
4297
4888
|
width: widthWithColspan,
|
|
@@ -4299,21 +4890,29 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4299
4890
|
columnGroup: computedColumnGroup
|
|
4300
4891
|
});
|
|
4301
4892
|
}
|
|
4302
|
-
return /* @__PURE__ */
|
|
4893
|
+
return /* @__PURE__ */ createElement17(InfiniteTableHeaderCell, {
|
|
4303
4894
|
domRef: domRef2,
|
|
4304
4895
|
column,
|
|
4896
|
+
headerOptions,
|
|
4305
4897
|
width: widthWithColspan,
|
|
4306
4898
|
height: heightWithRowspan,
|
|
4307
4899
|
columns: computedVisibleColumnsMap
|
|
4308
4900
|
});
|
|
4309
|
-
}, [
|
|
4310
|
-
|
|
4901
|
+
}, [
|
|
4902
|
+
headerOptions,
|
|
4903
|
+
columns,
|
|
4904
|
+
columnHeaderHeight,
|
|
4905
|
+
columnAndGroupTreeInfo,
|
|
4906
|
+
columnGroupsMaxDepth,
|
|
4907
|
+
showColumnFilters
|
|
4908
|
+
]);
|
|
4909
|
+
return /* @__PURE__ */ createElement17("div", __spreadValues({}, domProps), /* @__PURE__ */ createElement17(RawTable, {
|
|
4311
4910
|
renderCell,
|
|
4312
4911
|
brain: headerBrain,
|
|
4313
4912
|
cellHoverClassNames: []
|
|
4314
4913
|
}));
|
|
4315
4914
|
}
|
|
4316
|
-
var InfiniteTableHeader =
|
|
4915
|
+
var InfiniteTableHeader = memo8(InfiniteTableHeaderFn);
|
|
4317
4916
|
|
|
4318
4917
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx
|
|
4319
4918
|
function TableHeaderWrapper(props) {
|
|
@@ -4323,25 +4922,26 @@ function TableHeaderWrapper(props) {
|
|
|
4323
4922
|
computedPinnedStartColumns,
|
|
4324
4923
|
computedPinnedEndColumns,
|
|
4325
4924
|
computedVisibleColumns,
|
|
4326
|
-
columnSize
|
|
4925
|
+
columnSize,
|
|
4926
|
+
showColumnFilters
|
|
4327
4927
|
} = tableContextValue.computed;
|
|
4328
4928
|
const {
|
|
4329
4929
|
componentState: {
|
|
4330
|
-
|
|
4930
|
+
columnHeaderHeight,
|
|
4331
4931
|
columnGroupsDepthsMap,
|
|
4332
4932
|
columnGroupsMaxDepth,
|
|
4333
4933
|
computedColumnGroups
|
|
4334
4934
|
}
|
|
4335
4935
|
} = tableContextValue;
|
|
4336
4936
|
const rows = !computedColumnGroups || !computedColumnGroups.size ? 1 : columnGroupsMaxDepth + 2;
|
|
4337
|
-
const height = rows *
|
|
4338
|
-
const columnAndGroupTreeInfo =
|
|
4937
|
+
const height = rows * columnHeaderHeight + (showColumnFilters ? columnHeaderHeight : 0);
|
|
4938
|
+
const columnAndGroupTreeInfo = useMemo6(() => {
|
|
4339
4939
|
if (!computedColumnGroups || !computedColumnGroups.size) {
|
|
4340
4940
|
return void 0;
|
|
4341
4941
|
}
|
|
4342
4942
|
return buildColumnAndGroupTree(computedVisibleColumns, computedColumnGroups, columnGroupsDepthsMap, columnGroupsMaxDepth);
|
|
4343
4943
|
}, [computedVisibleColumns, computedColumnGroups, columnGroupsDepthsMap]);
|
|
4344
|
-
const cellspan =
|
|
4944
|
+
const cellspan = useCallback9(({ rowIndex, colIndex }) => {
|
|
4345
4945
|
const column = computedVisibleColumns[colIndex];
|
|
4346
4946
|
const rowspan2 = 1;
|
|
4347
4947
|
const colspan2 = 1;
|
|
@@ -4374,11 +4974,14 @@ function TableHeaderWrapper(props) {
|
|
|
4374
4974
|
rows,
|
|
4375
4975
|
columnGroupsDepthsMap
|
|
4376
4976
|
]);
|
|
4377
|
-
const rowspan =
|
|
4378
|
-
const colspan =
|
|
4977
|
+
const rowspan = useCallback9(({ rowIndex, colIndex }) => cellspan({ rowIndex, colIndex }).rowspan, [cellspan]);
|
|
4978
|
+
const colspan = useCallback9(({ rowIndex, colIndex }) => cellspan({ rowIndex, colIndex }).colspan, [cellspan]);
|
|
4979
|
+
const rowHeight = useCallback9((index) => {
|
|
4980
|
+
return showColumnFilters ? index < rows - 1 ? columnHeaderHeight : 2 * columnHeaderHeight : columnHeaderHeight;
|
|
4981
|
+
}, [rows, showColumnFilters, columnHeaderHeight]);
|
|
4379
4982
|
useMatrixBrain(brain, {
|
|
4380
4983
|
colWidth: columnSize,
|
|
4381
|
-
rowHeight
|
|
4984
|
+
rowHeight,
|
|
4382
4985
|
rows,
|
|
4383
4986
|
cols: computedVisibleColumns.length,
|
|
4384
4987
|
height,
|
|
@@ -4388,21 +4991,21 @@ function TableHeaderWrapper(props) {
|
|
|
4388
4991
|
fixedColsEnd: computedPinnedEndColumns.length,
|
|
4389
4992
|
fixedColsStart: computedPinnedStartColumns.length
|
|
4390
4993
|
});
|
|
4391
|
-
const header = /* @__PURE__ */
|
|
4994
|
+
const header = /* @__PURE__ */ createElement18(InfiniteTableHeader, {
|
|
4392
4995
|
columns: computedVisibleColumns,
|
|
4393
4996
|
brain,
|
|
4394
|
-
|
|
4997
|
+
columnHeaderHeight: height,
|
|
4395
4998
|
columnGroupsMaxDepth,
|
|
4396
4999
|
columnAndGroupTreeInfo
|
|
4397
5000
|
});
|
|
4398
|
-
const verticalScrollbarPlaceholder = scrollbars.vertical && getScrollbarWidth() ? /* @__PURE__ */
|
|
5001
|
+
const verticalScrollbarPlaceholder = scrollbars.vertical && getScrollbarWidth() ? /* @__PURE__ */ createElement18("div", {
|
|
4399
5002
|
className: HeaderScrollbarPlaceholderCls,
|
|
4400
5003
|
style: {
|
|
4401
5004
|
zIndex: 1e3,
|
|
4402
5005
|
width: getScrollbarWidth()
|
|
4403
5006
|
}
|
|
4404
5007
|
}) : null;
|
|
4405
|
-
return /* @__PURE__ */
|
|
5008
|
+
return /* @__PURE__ */ createElement18("div", {
|
|
4406
5009
|
className: HeaderWrapperCls,
|
|
4407
5010
|
style: {
|
|
4408
5011
|
height
|
|
@@ -4412,12 +5015,12 @@ function TableHeaderWrapper(props) {
|
|
|
4412
5015
|
|
|
4413
5016
|
// src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
|
|
4414
5017
|
import {
|
|
4415
|
-
createElement as
|
|
4416
|
-
forwardRef as
|
|
4417
|
-
useCallback as
|
|
4418
|
-
useRef as
|
|
5018
|
+
createElement as createElement19,
|
|
5019
|
+
forwardRef as forwardRef4,
|
|
5020
|
+
useCallback as useCallback10,
|
|
5021
|
+
useRef as useRef14
|
|
4419
5022
|
} from "react";
|
|
4420
|
-
import { useEffect as
|
|
5023
|
+
import { useEffect as useEffect13 } from "react";
|
|
4421
5024
|
|
|
4422
5025
|
// src/components/utils/decamelize.ts
|
|
4423
5026
|
function decamelize(str, options) {
|
|
@@ -4426,15 +5029,15 @@ function decamelize(str, options) {
|
|
|
4426
5029
|
}
|
|
4427
5030
|
|
|
4428
5031
|
// 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)",
|
|
5032
|
+
var ThemeVars = { color: { accent: "var(--infinite-accent-color)", color: "var(--infinite-color)" }, spacing: { "0": "var(--infinite-space-0)", "1": "var(--infinite-space-1)", "2": "var(--infinite-space-2)", "3": "var(--infinite-space-3)", "4": "var(--infinite-space-4)", "5": "var(--infinite-space-5)", "6": "var(--infinite-space-6)", "7": "var(--infinite-space-7)", "8": "var(--infinite-space-8)", "9": "var(--infinite-space-9)", "10": "var(--infinite-space-10)" }, fontSize: { "0": "var(--infinite-font-size-0)", "1": "var(--infinite-font-size-1)", "2": "var(--infinite-font-size-2)", "3": "var(--infinite-font-size-3)", "4": "var(--infinite-font-size-4)", "5": "var(--infinite-font-size-5)", "6": "var(--infinite-font-size-6)", "7": "var(--infinite-font-size-7)" }, fontFamily: "var(--infinite-font-family)", minHeight: "var(--infinite-min-height)", borderRadius: "var(--infinite-border-radius)", background: "var(--infinite-background)", components: { LoadMask: { padding: "var(--infinite-load-mask-padding)", color: "var(--infinite-load-mask-color)", textBackground: "var(--infinite-load-mask-text-background)", overlayBackground: "var(--infinite-load-mask-overlay-background)", overlayOpacity: "var(--infinite-load-mask-overlay-opacity)", borderRadius: "var(--infinite-load-mask-border-radius)" }, Header: { background: "var(--infinite-header-background)", color: "var(--infinite-header-color)", columnHeaderHeight: "var(--infinite-column-header-height)" }, HeaderCell: { draggingBackground: "var(--infinite-header-cell-dragging-background)", background: "var(--infinite-header-cell-background)", padding: "var(--infinite-header-cell-padding)", paddingX: "var(--infinite-header-cell-padding-x)", paddingY: "var(--infinite-header-cell-padding-y)", iconSize: "var(--infinite-header-cell-icon-size)", sortIconMargin: "var(--infinite-header-cell-sort-icon-margin)" }, Cell: { padding: "var(--infinite-cell-padding)", borderWidth: "var(--infinite-cell-border-width)", border: "var(--infinite-cell-border)", borderInvisible: "var(--infinite-cell-border-invisible)", borderRadius: "var(--infinite-cell-border-radius)", color: "var(--infinite-cell-color)", activeBorderColor_R: "var(--infinite-active-cell-border-color--r)", activeBorderColor_G: "var(--infinite-active-cell-border-color--g)", activeBorderColor_B: "var(--infinite-active-cell-border-color--b)", activeBackgroundAlpha: "var(--infinite-active-cell-background-alpha)", activeBackgroundAlphaWhenTableUnfocused: "var(--infinite-active-cell-background-alpha--table-unfocused)", activeBackground: "var(--infinite-active-cell-background)", activeBorderColor: "var(--infinite-active-cell-border-color)", activeBorderWidth: "var(--infinite-active-cell-border-width)", activeBorderStyle: "var(--infinite-active-cell-border-style)", activeBorder: "var(--infinite-active-cell-border)" }, Row: { background: "var(--infinite-row-background)", oddBackground: "var(--infinite-row-odd-background)", activeBackground: "var(--infinite-active-row-background)", activeBorderColor: "var(--infinite-active-row-border-color)", activeBorderWidth: "var(--infinite-active-row-border-width)", activeBorderStyle: "var(--infinite-active-row-border-style)", activeBorder: "var(--infinite-active-row-border)", activeBackgroundAlpha: "var(--infinite-active-row-background-alpha)", activeBackgroundAlphaWhenTableUnfocused: "var(--infinite-active-row-background-alpha--table-unfocused)", hoverBackground: "var(--infinite-row-hover-background)", groupRowBackground: "var(--infinite-group-row-background)", groupRowColumnNesting: "var(--infinite-group-row-column-nesting)", groupNesting: "var(--infinite-dont-override-group-row-nesting-length)", pointerEventsWhileScrolling: "var(--infinite-row-pointer-events-while-scrolling)" }, ColumnCell: { background: "var(--infinite-column-cell-bg-dont-override)" } } };
|
|
4430
5033
|
|
|
4431
5034
|
// src/components/InfiniteTable/InfiniteCls.css.ts
|
|
4432
5035
|
var import_createRuntimeFn3 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
4433
5036
|
var FooterCls = "_16lm1iw1";
|
|
4434
|
-
var InfiniteCls = "_1yeub2v0 _16lm1iw1
|
|
4435
|
-
var InfiniteClsRecipe = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "", variantClassNames: { focused: { true: "_1yeub2v2", false: "_1yeub2v3" }, focusedWithin: { true: "_1yeub2v4", false: "_1yeub2v5" }, hasPinnedStart: { true: "_1yeub2v6", false: "_1yeub2v7" }, hasPinnedEnd: { true: "_1yeub2v8", false: "_1yeub2v9" }, hasPinnedStartOverflow: { true: "_1yeub2va", false: "_1yeub2vb" }, hasPinnedEndOverflow: { true: "_1yeub2vc", false: "_1yeub2vd" } }, defaultVariants: {}, compoundVariants: [] });
|
|
4436
|
-
var InfiniteClsShiftingColumns = "
|
|
4437
|
-
var PinnedRowsContainerClsVariants = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "", variantClassNames: { pinned: { start: "
|
|
5037
|
+
var InfiniteCls = "_1yeub2v0 _16lm1iw1 _16lm1iwm _16lm1iw12 _16lm1iw0";
|
|
5038
|
+
var InfiniteClsRecipe = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "", variantClassNames: { focused: { true: "_1yeub2v2", false: "_1yeub2v3" }, focusedWithin: { true: "_1yeub2v4", false: "_1yeub2v5" }, hasPinnedStart: { true: "_1yeub2v6", false: "_1yeub2v7" }, hasPinnedEnd: { true: "_1yeub2v8", false: "_1yeub2v9" }, hasPinnedStartOverflow: { true: "_1yeub2va", false: "_1yeub2vb" }, hasPinnedEndOverflow: { true: "_1yeub2vc", false: "_1yeub2vd" } }, defaultVariants: {}, compoundVariants: [[{ focused: false, focusedWithin: false }, "_1yeub2ve"]] });
|
|
5039
|
+
var InfiniteClsShiftingColumns = "_16lm1iwp";
|
|
5040
|
+
var PinnedRowsContainerClsVariants = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "", variantClassNames: { pinned: { start: "_1yeub2vi", end: "_1yeub2vj", false: "_1yeub2vk" } }, defaultVariants: {}, compoundVariants: [] });
|
|
4438
5041
|
|
|
4439
5042
|
// src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
|
|
4440
5043
|
var defaultStyle = {
|
|
@@ -4463,10 +5066,10 @@ var enforceStyle = (node, style) => {
|
|
|
4463
5066
|
node.style.setProperty(decamelize(propertyName), propertyValue, "important");
|
|
4464
5067
|
}
|
|
4465
5068
|
};
|
|
4466
|
-
var InfiniteTableLicenseFooter =
|
|
4467
|
-
const { rootClassName:
|
|
4468
|
-
const domRef =
|
|
4469
|
-
const domCallback =
|
|
5069
|
+
var InfiniteTableLicenseFooter = forwardRef4(function InfiniteTableLicenseFooter2(props, ref) {
|
|
5070
|
+
const { rootClassName: rootClassName11 } = useInternalProps();
|
|
5071
|
+
const domRef = useRef14(null);
|
|
5072
|
+
const domCallback = useCallback10((node) => {
|
|
4470
5073
|
domRef.current = node;
|
|
4471
5074
|
if (!ref) {
|
|
4472
5075
|
return;
|
|
@@ -4477,7 +5080,7 @@ var InfiniteTableLicenseFooter = forwardRef3(function InfiniteTableLicenseFooter
|
|
|
4477
5080
|
ref.current = node;
|
|
4478
5081
|
}
|
|
4479
5082
|
}, []);
|
|
4480
|
-
|
|
5083
|
+
useEffect13(() => {
|
|
4481
5084
|
const forceStyle = () => {
|
|
4482
5085
|
requestAnimationFrame(() => {
|
|
4483
5086
|
var _a;
|
|
@@ -4491,12 +5094,12 @@ var InfiniteTableLicenseFooter = forwardRef3(function InfiniteTableLicenseFooter
|
|
|
4491
5094
|
clearInterval(intervalId);
|
|
4492
5095
|
};
|
|
4493
5096
|
}, []);
|
|
4494
|
-
return /* @__PURE__ */
|
|
5097
|
+
return /* @__PURE__ */ createElement19("div", __spreadProps(__spreadValues({
|
|
4495
5098
|
ref: domCallback
|
|
4496
5099
|
}, props), {
|
|
4497
|
-
className: join(`${
|
|
5100
|
+
className: join(`${rootClassName11}-Footer`, FooterCls, props.className),
|
|
4498
5101
|
style: defaultStyle
|
|
4499
|
-
}), "Powered by", " ", /* @__PURE__ */
|
|
5102
|
+
}), "Powered by", " ", /* @__PURE__ */ createElement19("a", {
|
|
4500
5103
|
href: "https://infinite-table.com",
|
|
4501
5104
|
rel: "noopener noreferrer",
|
|
4502
5105
|
role: "link",
|
|
@@ -4507,13 +5110,13 @@ var InfiniteTableLicenseFooter = forwardRef3(function InfiniteTableLicenseFooter
|
|
|
4507
5110
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableColumnCell.tsx
|
|
4508
5111
|
import {
|
|
4509
5112
|
createContext as createContext5,
|
|
4510
|
-
createElement as
|
|
4511
|
-
memo as
|
|
5113
|
+
createElement as createElement20,
|
|
5114
|
+
memo as memo9
|
|
4512
5115
|
} from "react";
|
|
4513
|
-
import { useContext as useContext6 } from "react";
|
|
4514
|
-
var { rootClassName:
|
|
5116
|
+
import { useCallback as useCallback11, useContext as useContext6, useMemo as useMemo7 } from "react";
|
|
5117
|
+
var { rootClassName: rootClassName9 } = internalProps;
|
|
4515
5118
|
var InfiniteTableColumnCellContext = createContext5(null);
|
|
4516
|
-
var InfiniteTableColumnCellClassName = `${
|
|
5119
|
+
var InfiniteTableColumnCellClassName = `${rootClassName9}ColumnCell`;
|
|
4517
5120
|
function isColumnWithField(c) {
|
|
4518
5121
|
return typeof c.field === "string";
|
|
4519
5122
|
}
|
|
@@ -4537,42 +5140,73 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
4537
5140
|
showZebraRows
|
|
4538
5141
|
} = props;
|
|
4539
5142
|
if (!column) {
|
|
4540
|
-
return /* @__PURE__ */
|
|
5143
|
+
return /* @__PURE__ */ createElement20("div", {
|
|
4541
5144
|
ref: domRef
|
|
4542
5145
|
}, "no column");
|
|
4543
5146
|
}
|
|
4544
5147
|
const { data, isGroupRow, dataSourceHasGrouping } = rowInfo;
|
|
4545
5148
|
const groupBy = dataSourceHasGrouping ? rowInfo.groupBy : void 0;
|
|
4546
5149
|
const groupRowInfo = null;
|
|
5150
|
+
const { getState, componentActions } = useInfiniteTable();
|
|
5151
|
+
const { activeRowIndex, keyboardNavigation } = getState();
|
|
5152
|
+
const rowActive = rowIndex === activeRowIndex && keyboardNavigation === "row";
|
|
4547
5153
|
let value = isGroupRow && groupBy && column.groupByField ? rowInfo.value : isColumnWithField(column) ? data == null ? void 0 : data[column.field] : null;
|
|
4548
5154
|
if (column.valueGetter) {
|
|
4549
|
-
|
|
5155
|
+
if (!rowInfo.isGroupRow && rowInfo.data) {
|
|
5156
|
+
value = column.valueGetter({ data: rowInfo.data, field: column.field });
|
|
5157
|
+
}
|
|
5158
|
+
}
|
|
5159
|
+
if (column.valueFormatter) {
|
|
5160
|
+
value = column.valueFormatter(isGroupRow ? {
|
|
4550
5161
|
data: rowInfo.data,
|
|
4551
5162
|
isGroupRow,
|
|
4552
|
-
rowInfo
|
|
5163
|
+
rowInfo,
|
|
5164
|
+
rowActive,
|
|
5165
|
+
field: column.field,
|
|
5166
|
+
value
|
|
4553
5167
|
} : {
|
|
4554
5168
|
data: rowInfo.data,
|
|
4555
5169
|
isGroupRow,
|
|
4556
|
-
|
|
5170
|
+
rowActive,
|
|
5171
|
+
rowInfo,
|
|
5172
|
+
field: column.field,
|
|
5173
|
+
value
|
|
4557
5174
|
});
|
|
4558
5175
|
}
|
|
5176
|
+
const onClick = useCallback11(() => {
|
|
5177
|
+
const { activeRowIndex: activeRowIndex2, activeCellIndex } = getState();
|
|
5178
|
+
if (activeRowIndex2 !== void 0 && keyboardNavigation === "row") {
|
|
5179
|
+
componentActions.activeRowIndex = rowIndex;
|
|
5180
|
+
return;
|
|
5181
|
+
}
|
|
5182
|
+
if (activeCellIndex !== void 0 && keyboardNavigation === "cell") {
|
|
5183
|
+
componentActions.activeCellIndex = [
|
|
5184
|
+
rowIndex,
|
|
5185
|
+
column.computedVisibleIndex
|
|
5186
|
+
];
|
|
5187
|
+
}
|
|
5188
|
+
}, [rowIndex, column.computedVisibleIndex, keyboardNavigation]);
|
|
4559
5189
|
const { componentState: computedDataSource } = useDataSourceContextValue();
|
|
4560
5190
|
const rest = rowInfo.isGroupRow ? {
|
|
4561
5191
|
rowInfo,
|
|
4562
5192
|
isGroupRow: rowInfo.isGroupRow,
|
|
4563
|
-
data: rowInfo.data
|
|
5193
|
+
data: rowInfo.data,
|
|
5194
|
+
rowActive,
|
|
5195
|
+
value,
|
|
5196
|
+
field: column.field
|
|
4564
5197
|
} : {
|
|
4565
5198
|
rowInfo,
|
|
4566
5199
|
isGroupRow: rowInfo.isGroupRow,
|
|
4567
|
-
data: rowInfo.data
|
|
5200
|
+
data: rowInfo.data,
|
|
5201
|
+
rowActive,
|
|
5202
|
+
value,
|
|
5203
|
+
field: column.field
|
|
4568
5204
|
};
|
|
4569
5205
|
const stylingRenderParam = __spreadValues({
|
|
4570
|
-
value,
|
|
4571
5206
|
column
|
|
4572
5207
|
}, rest);
|
|
4573
5208
|
const renderValue = value;
|
|
4574
5209
|
const renderParam = __spreadProps(__spreadValues({
|
|
4575
|
-
value,
|
|
4576
5210
|
column,
|
|
4577
5211
|
domRef,
|
|
4578
5212
|
groupRowInfo
|
|
@@ -4580,28 +5214,28 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
4580
5214
|
isGroupRow,
|
|
4581
5215
|
rowIndex,
|
|
4582
5216
|
toggleGroupRow,
|
|
4583
|
-
toggleCurrentGroupRow: () => {
|
|
5217
|
+
toggleCurrentGroupRow: useCallback11(() => {
|
|
4584
5218
|
if (!rowInfo.isGroupRow) {
|
|
4585
5219
|
return;
|
|
4586
5220
|
}
|
|
4587
5221
|
toggleGroupRow(rowInfo.groupKeys);
|
|
4588
|
-
},
|
|
5222
|
+
}, []),
|
|
4589
5223
|
groupBy: computedDataSource.groupBy,
|
|
4590
5224
|
pivotBy: computedDataSource.pivotBy
|
|
4591
5225
|
});
|
|
4592
|
-
const renderChildren = () => {
|
|
5226
|
+
const renderChildren = useCallback11(() => {
|
|
4593
5227
|
if (hidden) {
|
|
4594
5228
|
return null;
|
|
4595
5229
|
}
|
|
4596
5230
|
const renderFn = column.render || column.renderValue;
|
|
4597
5231
|
if (renderFn) {
|
|
4598
|
-
return /* @__PURE__ */
|
|
5232
|
+
return /* @__PURE__ */ createElement20(RenderHookComponent, {
|
|
4599
5233
|
render: renderFn,
|
|
4600
5234
|
renderParam
|
|
4601
5235
|
});
|
|
4602
5236
|
}
|
|
4603
5237
|
return renderValue;
|
|
4604
|
-
};
|
|
5238
|
+
}, [column, hidden, ...Object.values(renderParam)]);
|
|
4605
5239
|
const rowPropsAndStyleArgs = __spreadProps(__spreadValues({}, rest), {
|
|
4606
5240
|
rowIndex
|
|
4607
5241
|
});
|
|
@@ -4614,6 +5248,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
4614
5248
|
style = column.style ? typeof column.style === "function" ? __spreadValues(__spreadValues({}, style), column.style(stylingRenderParam) || {}) : __spreadValues(__spreadValues({}, style), column.style) : style || {};
|
|
4615
5249
|
style.width = width;
|
|
4616
5250
|
style.height = rowHeight;
|
|
5251
|
+
const memoizedStyle = useMemo7(() => style, [!style ? null : JSON.stringify(style)]);
|
|
4617
5252
|
const odd = (rowInfo.indexInAll != null ? rowInfo.indexInAll : rowIndex) % 2 === 1;
|
|
4618
5253
|
const zebra = showZebraRows ? odd ? "odd" : "even" : false;
|
|
4619
5254
|
const cellProps = {
|
|
@@ -4623,19 +5258,20 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
4623
5258
|
column,
|
|
4624
5259
|
width,
|
|
4625
5260
|
offset: virtualized ? 0 : column.computedPinningOffset,
|
|
4626
|
-
style,
|
|
5261
|
+
style: memoizedStyle,
|
|
4627
5262
|
onMouseLeave,
|
|
4628
5263
|
onMouseEnter,
|
|
5264
|
+
onClick,
|
|
4629
5265
|
cssEllipsis: (_a = column.cssEllipsis) != null ? _a : true,
|
|
4630
|
-
className: join(useCellClassName(column, [InfiniteTableColumnCellClassName, InfiniteTableCellClassName], ColumnCellRecipe, { dragging: false, zebra }), colClassName, rowComputedClassName),
|
|
5266
|
+
className: join(useCellClassName(column, [InfiniteTableColumnCellClassName, InfiniteTableCellClassName], ColumnCellRecipe, { dragging: false, zebra, rowActive }), colClassName, rowComputedClassName),
|
|
4631
5267
|
renderChildren
|
|
4632
5268
|
};
|
|
4633
5269
|
const ContextProvider = InfiniteTableColumnCellContext.Provider;
|
|
4634
|
-
return /* @__PURE__ */
|
|
5270
|
+
return /* @__PURE__ */ createElement20(ContextProvider, {
|
|
4635
5271
|
value: renderParam
|
|
4636
|
-
}, /* @__PURE__ */
|
|
5272
|
+
}, /* @__PURE__ */ createElement20(InfiniteTableCell, __spreadValues({}, cellProps)));
|
|
4637
5273
|
}
|
|
4638
|
-
var InfiniteTableColumnCell =
|
|
5274
|
+
var InfiniteTableColumnCell = memo9(InfiniteTableColumnCellFn);
|
|
4639
5275
|
function useInfiniteColumnCell() {
|
|
4640
5276
|
const result = useContext6(InfiniteTableColumnCellContext);
|
|
4641
5277
|
return result;
|
|
@@ -4649,35 +5285,97 @@ var RowHoverCls = "_7pupv01";
|
|
|
4649
5285
|
|
|
4650
5286
|
// src/components/InfiniteTable/components/LoadMask.tsx
|
|
4651
5287
|
import {
|
|
4652
|
-
createElement as
|
|
4653
|
-
memo as
|
|
5288
|
+
createElement as createElement21,
|
|
5289
|
+
memo as memo10
|
|
4654
5290
|
} from "react";
|
|
4655
5291
|
|
|
4656
5292
|
// src/components/InfiniteTable/components/LoadMask.css.ts
|
|
4657
|
-
var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2
|
|
4658
|
-
var LoadMaskOverlayCls = "qy58ya3 _16lm1iw2
|
|
5293
|
+
var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2 _16lm1iwu _16lm1iww _16lm1iw10 _16lm1iwy", hidden: "qy58ya2 qy58ya0 _16lm1iw2 _16lm1iwu _16lm1iww _16lm1iw10 _16lm1iwy" };
|
|
5294
|
+
var LoadMaskOverlayCls = "qy58ya3 _16lm1iw2 _16lm1iwu _16lm1iww _16lm1iw10 _16lm1iwy";
|
|
4659
5295
|
var LoadMaskTextCls = "qy58ya4";
|
|
4660
5296
|
|
|
4661
5297
|
// src/components/InfiniteTable/components/LoadMask.tsx
|
|
4662
|
-
var { rootClassName:
|
|
4663
|
-
var
|
|
5298
|
+
var { rootClassName: rootClassName10 } = internalProps;
|
|
5299
|
+
var baseCls3 = `${rootClassName10}-LoadMask`;
|
|
4664
5300
|
function LoadMaskFn(props) {
|
|
4665
5301
|
const { visible, children = "Loading" } = props;
|
|
4666
|
-
return /* @__PURE__ */
|
|
4667
|
-
className: `${LoadMaskCls[visible ? "visible" : "hidden"]} ${
|
|
4668
|
-
}, /* @__PURE__ */
|
|
4669
|
-
className: `${LoadMaskOverlayCls} ${
|
|
4670
|
-
}), /* @__PURE__ */
|
|
4671
|
-
className: `${LoadMaskTextCls} ${
|
|
5302
|
+
return /* @__PURE__ */ createElement21("div", {
|
|
5303
|
+
className: `${LoadMaskCls[visible ? "visible" : "hidden"]} ${baseCls3}`
|
|
5304
|
+
}, /* @__PURE__ */ createElement21("div", {
|
|
5305
|
+
className: `${LoadMaskOverlayCls} ${baseCls3}-Overlay`
|
|
5306
|
+
}), /* @__PURE__ */ createElement21("div", {
|
|
5307
|
+
className: `${LoadMaskTextCls} ${baseCls3}-Text`
|
|
4672
5308
|
}, children));
|
|
4673
5309
|
}
|
|
4674
|
-
var LoadMask =
|
|
5310
|
+
var LoadMask = memo10(LoadMaskFn);
|
|
5311
|
+
|
|
5312
|
+
// src/components/InfiniteTable/getImperativeApi.ts
|
|
5313
|
+
function getImperativeApi(getState, getComputed, getDataSourceState, componentActions) {
|
|
5314
|
+
const imperativeApi = {
|
|
5315
|
+
setColumnOrder: (columnOrder) => {
|
|
5316
|
+
componentActions.columnOrder = columnOrder;
|
|
5317
|
+
},
|
|
5318
|
+
setColumnVisibility: (columnVisibility) => {
|
|
5319
|
+
componentActions.columnVisibility = columnVisibility;
|
|
5320
|
+
},
|
|
5321
|
+
getState,
|
|
5322
|
+
getDataSourceState,
|
|
5323
|
+
scrollRowIntoView(rowIndex, config = { offset: 0 }) {
|
|
5324
|
+
const state = getState();
|
|
5325
|
+
const scrollPosition = state.renderer.getScrollPositionForScrollRowIntoView(rowIndex, config);
|
|
5326
|
+
const currentScrollPosition = state.brain.getScrollPosition();
|
|
5327
|
+
if (scrollPosition.scrollTop !== currentScrollPosition.scrollTop) {
|
|
5328
|
+
state.scrollerDOMRef.current.scrollTop = scrollPosition.scrollTop;
|
|
5329
|
+
}
|
|
5330
|
+
},
|
|
5331
|
+
scrollColumnIntoView(colId, config = { offset: 0 }) {
|
|
5332
|
+
const state = getState();
|
|
5333
|
+
const computed = getComputed();
|
|
5334
|
+
const computedColumn = computed.computedVisibleColumnsMap.get(colId);
|
|
5335
|
+
if (!computedColumn) {
|
|
5336
|
+
return;
|
|
5337
|
+
}
|
|
5338
|
+
const colIndex = computedColumn.computedVisibleIndex;
|
|
5339
|
+
const scrollPosition = state.renderer.getScrollPositionForScrollColumnIntoView(colIndex, config);
|
|
5340
|
+
const currentScrollPosition = state.brain.getScrollPosition();
|
|
5341
|
+
if (scrollPosition.scrollLeft !== currentScrollPosition.scrollLeft) {
|
|
5342
|
+
state.scrollerDOMRef.current.scrollLeft = scrollPosition.scrollLeft;
|
|
5343
|
+
}
|
|
5344
|
+
},
|
|
5345
|
+
scrollCellIntoView(rowIndex, colIdOrIndex, config = { offset: 0 }) {
|
|
5346
|
+
const state = getState();
|
|
5347
|
+
const computed = getComputed();
|
|
5348
|
+
let colIndex = colIdOrIndex;
|
|
5349
|
+
if (typeof colIdOrIndex === "string") {
|
|
5350
|
+
const computedColumn = computed.computedVisibleColumnsMap.get(colIdOrIndex);
|
|
5351
|
+
if (!computedColumn) {
|
|
5352
|
+
return;
|
|
5353
|
+
}
|
|
5354
|
+
colIndex = computedColumn.computedVisibleIndex;
|
|
5355
|
+
}
|
|
5356
|
+
const scrollPositionForCol = state.renderer.getScrollPositionForScrollColumnIntoView(colIndex, config);
|
|
5357
|
+
const scrollPositionForRow = state.renderer.getScrollPositionForScrollRowIntoView(rowIndex, config);
|
|
5358
|
+
const newScrollPosition = {
|
|
5359
|
+
scrollLeft: scrollPositionForCol.scrollLeft,
|
|
5360
|
+
scrollTop: scrollPositionForRow.scrollTop
|
|
5361
|
+
};
|
|
5362
|
+
const currentScrollPosition = state.brain.getScrollPosition();
|
|
5363
|
+
if (newScrollPosition.scrollLeft !== currentScrollPosition.scrollLeft) {
|
|
5364
|
+
state.scrollerDOMRef.current.scrollLeft = newScrollPosition.scrollLeft;
|
|
5365
|
+
}
|
|
5366
|
+
if (newScrollPosition.scrollTop !== currentScrollPosition.scrollTop) {
|
|
5367
|
+
state.scrollerDOMRef.current.scrollTop = newScrollPosition.scrollTop;
|
|
5368
|
+
}
|
|
5369
|
+
}
|
|
5370
|
+
};
|
|
5371
|
+
return imperativeApi;
|
|
5372
|
+
}
|
|
4675
5373
|
|
|
4676
5374
|
// src/components/InfiniteTable/hooks/useAutoSizeColumns.ts
|
|
4677
5375
|
import {
|
|
4678
|
-
useEffect as
|
|
4679
|
-
useRef as
|
|
4680
|
-
useState as
|
|
5376
|
+
useEffect as useEffect14,
|
|
5377
|
+
useRef as useRef15,
|
|
5378
|
+
useState as useState10
|
|
4681
5379
|
} from "react";
|
|
4682
5380
|
var OFFSET = 10;
|
|
4683
5381
|
function getColumnContentMaxWidths(domRef, options) {
|
|
@@ -4700,6 +5398,7 @@ function getColumnContentMaxWidths(domRef, options) {
|
|
|
4700
5398
|
contentClone.style.pointerEvents = "none";
|
|
4701
5399
|
contentClone.classList.remove(...cssEllipsisClassName.split(" "));
|
|
4702
5400
|
contentClone.style.position = "absolute";
|
|
5401
|
+
contentClone.style.width = "auto";
|
|
4703
5402
|
cell.appendChild(contentClone);
|
|
4704
5403
|
let measuredWidth = contentClone.offsetWidth;
|
|
4705
5404
|
cell.removeChild(contentClone);
|
|
@@ -4737,11 +5436,11 @@ function useAutoSizeColumns() {
|
|
|
4737
5436
|
componentActions,
|
|
4738
5437
|
componentState: { domRef, ready, autoSizeColumnsKey, brain }
|
|
4739
5438
|
} = useComponentState();
|
|
4740
|
-
const [refreshId, setRefreshId] =
|
|
5439
|
+
const [refreshId, setRefreshId] = useState10(0);
|
|
4741
5440
|
const theKey = typeof autoSizeColumnsKey === "object" ? autoSizeColumnsKey.key : autoSizeColumnsKey;
|
|
4742
5441
|
const getTheKey = useLatest(theKey);
|
|
4743
|
-
const lastExecutedIdentifierRef =
|
|
4744
|
-
|
|
5442
|
+
const lastExecutedIdentifierRef = useRef15(null);
|
|
5443
|
+
useEffect14(() => {
|
|
4745
5444
|
const key = getTheKey();
|
|
4746
5445
|
if (key == null) {
|
|
4747
5446
|
return;
|
|
@@ -4754,7 +5453,7 @@ function useAutoSizeColumns() {
|
|
|
4754
5453
|
};
|
|
4755
5454
|
return brain.onRenderRangeChange(onChange);
|
|
4756
5455
|
}, [brain]);
|
|
4757
|
-
|
|
5456
|
+
useEffect14(() => {
|
|
4758
5457
|
var _a;
|
|
4759
5458
|
if (theKey == null) {
|
|
4760
5459
|
return;
|
|
@@ -4799,20 +5498,8 @@ function useAutoSizeColumns() {
|
|
|
4799
5498
|
}
|
|
4800
5499
|
|
|
4801
5500
|
// src/components/InfiniteTable/hooks/useCellRendering.tsx
|
|
4802
|
-
import { useCallback as
|
|
4803
|
-
import
|
|
4804
|
-
|
|
4805
|
-
// src/components/hooks/useRerender.ts
|
|
4806
|
-
import { useCallback as useCallback10, useState as useState7 } from "react";
|
|
4807
|
-
var useRerender = () => {
|
|
4808
|
-
const [state, setState] = useState7(0);
|
|
4809
|
-
return [
|
|
4810
|
-
state,
|
|
4811
|
-
useCallback10(() => {
|
|
4812
|
-
setState((state2) => state2 + 1);
|
|
4813
|
-
}, [setState])
|
|
4814
|
-
];
|
|
4815
|
-
};
|
|
5501
|
+
import { useCallback as useCallback12, useEffect as useEffect15, useRef as useRef16 } from "react";
|
|
5502
|
+
import React27 from "react";
|
|
4816
5503
|
|
|
4817
5504
|
// src/components/InfiniteTable/hooks/useYourBrain.ts
|
|
4818
5505
|
function useYourBrain(param) {
|
|
@@ -4842,7 +5529,7 @@ function useYourBrain(param) {
|
|
|
4842
5529
|
// src/components/InfiniteTable/hooks/useCellRendering.tsx
|
|
4843
5530
|
var SCROLL_BOTTOM_OFFSET = 1;
|
|
4844
5531
|
function useCellRendering(param) {
|
|
4845
|
-
const { computed, bodySize } = param;
|
|
5532
|
+
const { computed, bodySize, imperativeApi } = param;
|
|
4846
5533
|
const { componentActions, componentState, getState } = useInfiniteTable();
|
|
4847
5534
|
const {
|
|
4848
5535
|
computedPinnedStartColumns,
|
|
@@ -4882,13 +5569,13 @@ function useCellRendering(param) {
|
|
|
4882
5569
|
bodySize,
|
|
4883
5570
|
rowspan
|
|
4884
5571
|
});
|
|
4885
|
-
const scrollTopMaxRef =
|
|
4886
|
-
|
|
5572
|
+
const scrollTopMaxRef = useRef16(0);
|
|
5573
|
+
useEffect15(() => {
|
|
4887
5574
|
return brain.onRenderCountChange(() => {
|
|
4888
5575
|
scrollTopMaxRef.current = brain.scrollTopMax;
|
|
4889
5576
|
});
|
|
4890
5577
|
}, [brain]);
|
|
4891
|
-
|
|
5578
|
+
useEffect15(() => {
|
|
4892
5579
|
return brain.onScrollStop((scrollPosition) => {
|
|
4893
5580
|
const { scrollTop } = scrollPosition;
|
|
4894
5581
|
if (scrollTop === 0) {
|
|
@@ -4905,31 +5592,21 @@ function useCellRendering(param) {
|
|
|
4905
5592
|
}
|
|
4906
5593
|
});
|
|
4907
5594
|
}, [brain, onScrollToTop, onScrollToBottom]);
|
|
4908
|
-
|
|
5595
|
+
useEffect15(() => {
|
|
4909
5596
|
if (!bodySize.height) {
|
|
4910
5597
|
return;
|
|
4911
5598
|
}
|
|
4912
5599
|
const { onReady } = getState();
|
|
4913
5600
|
componentActions.ready = true;
|
|
4914
5601
|
if (onReady) {
|
|
4915
|
-
const imperativeApi = {
|
|
4916
|
-
setColumnOrder: (columnOrder) => {
|
|
4917
|
-
componentActions.columnOrder = columnOrder;
|
|
4918
|
-
},
|
|
4919
|
-
setColumnVisibility: (columnVisibility) => {
|
|
4920
|
-
componentActions.columnVisibility = columnVisibility;
|
|
4921
|
-
},
|
|
4922
|
-
getState,
|
|
4923
|
-
getDataSourceState
|
|
4924
|
-
};
|
|
4925
5602
|
onReady(imperativeApi);
|
|
4926
5603
|
}
|
|
4927
5604
|
}, [!!bodySize.height]);
|
|
4928
5605
|
const [, rerender] = useRerender();
|
|
4929
|
-
|
|
5606
|
+
useEffect15(() => {
|
|
4930
5607
|
rerender();
|
|
4931
5608
|
}, [dataSourceState]);
|
|
4932
|
-
const renderCell =
|
|
5609
|
+
const renderCell = useCallback12((params) => {
|
|
4933
5610
|
const {
|
|
4934
5611
|
rowIndex,
|
|
4935
5612
|
colIndex,
|
|
@@ -4964,7 +5641,7 @@ function useCellRendering(param) {
|
|
|
4964
5641
|
rowStyle,
|
|
4965
5642
|
rowClassName
|
|
4966
5643
|
};
|
|
4967
|
-
return /* @__PURE__ */
|
|
5644
|
+
return /* @__PURE__ */ React27.createElement(InfiniteTableColumnCell, __spreadValues({}, cellProps));
|
|
4968
5645
|
}, [
|
|
4969
5646
|
rowHeight,
|
|
4970
5647
|
getData,
|
|
@@ -4982,13 +5659,13 @@ function useCellRendering(param) {
|
|
|
4982
5659
|
}
|
|
4983
5660
|
|
|
4984
5661
|
// src/components/InfiniteTable/hooks/useComputed.ts
|
|
4985
|
-
import { useCallback as
|
|
5662
|
+
import { useCallback as useCallback15, useEffect as useEffect25, useState as useState14 } from "react";
|
|
4986
5663
|
|
|
4987
5664
|
// src/components/InfiniteTable/hooks/useColumnGroups.ts
|
|
4988
|
-
import { useEffect as
|
|
5665
|
+
import { useEffect as useEffect17 } from "react";
|
|
4989
5666
|
|
|
4990
5667
|
// src/components/hooks/useInterceptedMap.ts
|
|
4991
|
-
import { useEffect as
|
|
5668
|
+
import { useEffect as useEffect16 } from "react";
|
|
4992
5669
|
function interceptMap(map2, fns) {
|
|
4993
5670
|
const { set, delete: deleteKey, clear } = map2;
|
|
4994
5671
|
if (fns.set) {
|
|
@@ -5076,7 +5753,7 @@ function useColumnGroups() {
|
|
|
5076
5753
|
componentActions,
|
|
5077
5754
|
getComponentState
|
|
5078
5755
|
} = useComponentState();
|
|
5079
|
-
|
|
5756
|
+
useEffect17(() => {
|
|
5080
5757
|
const recompute = () => {
|
|
5081
5758
|
componentActions.columnGroupsDepthsMap = computeColumnGroupsDepths(computedColumnGroups);
|
|
5082
5759
|
};
|
|
@@ -5087,7 +5764,7 @@ function useColumnGroups() {
|
|
|
5087
5764
|
set: update
|
|
5088
5765
|
});
|
|
5089
5766
|
}, [computedColumnGroups]);
|
|
5090
|
-
|
|
5767
|
+
useEffect17(() => {
|
|
5091
5768
|
return interceptMap(collapsedColumnGroups, {
|
|
5092
5769
|
set: (key, visibleCol) => {
|
|
5093
5770
|
const colIds = key.slice(1);
|
|
@@ -5122,10 +5799,10 @@ function useColumnGroups() {
|
|
|
5122
5799
|
}
|
|
5123
5800
|
|
|
5124
5801
|
// src/components/InfiniteTable/hooks/useColumnRowspan.ts
|
|
5125
|
-
import { useMemo as
|
|
5802
|
+
import { useMemo as useMemo8 } from "react";
|
|
5126
5803
|
function useColumnRowspan(computedVisibleColumns) {
|
|
5127
5804
|
const { getState: getDataSourceState } = useDataSourceContextValue();
|
|
5128
|
-
const rowspan =
|
|
5805
|
+
const rowspan = useMemo8(() => {
|
|
5129
5806
|
const colsWithRowspan = computedVisibleColumns.filter((col) => typeof col.rowspan === "function");
|
|
5130
5807
|
return colsWithRowspan.length ? ({ rowIndex, colIndex }) => {
|
|
5131
5808
|
const dataArray = getDataSourceState().dataArray;
|
|
@@ -5151,10 +5828,10 @@ function useColumnRowspan(computedVisibleColumns) {
|
|
|
5151
5828
|
}
|
|
5152
5829
|
|
|
5153
5830
|
// src/components/InfiniteTable/hooks/useColumnSizeFn.ts
|
|
5154
|
-
import { useCallback as
|
|
5831
|
+
import { useCallback as useCallback13 } from "react";
|
|
5155
5832
|
var debug4 = dbg("useColumnSizeFn");
|
|
5156
5833
|
function useColumnSizeFn(columns) {
|
|
5157
|
-
const columnSize =
|
|
5834
|
+
const columnSize = useCallback13((index) => {
|
|
5158
5835
|
const column = columns[index];
|
|
5159
5836
|
if (!column) {
|
|
5160
5837
|
debug4("cannot find column at index", index, columns);
|
|
@@ -5165,11 +5842,11 @@ function useColumnSizeFn(columns) {
|
|
|
5165
5842
|
}
|
|
5166
5843
|
|
|
5167
5844
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
5168
|
-
import { useEffect as
|
|
5845
|
+
import { useEffect as useEffect22, useMemo as useMemo10 } from "react";
|
|
5169
5846
|
|
|
5170
5847
|
// src/components/InfiniteTable/utils/getColumnForGroupBy.tsx
|
|
5171
5848
|
import {
|
|
5172
|
-
createElement as
|
|
5849
|
+
createElement as createElement24
|
|
5173
5850
|
} from "react";
|
|
5174
5851
|
|
|
5175
5852
|
// src/utils/stripVar.ts
|
|
@@ -5187,21 +5864,21 @@ var showLoadingIcon = (rowInfo) => {
|
|
|
5187
5864
|
|
|
5188
5865
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
5189
5866
|
import {
|
|
5190
|
-
createElement as
|
|
5191
|
-
useEffect as
|
|
5867
|
+
createElement as createElement22,
|
|
5868
|
+
useEffect as useEffect18
|
|
5192
5869
|
} from "react";
|
|
5193
|
-
import { useState as
|
|
5870
|
+
import { useState as useState11 } from "react";
|
|
5194
5871
|
|
|
5195
5872
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.css.ts
|
|
5196
5873
|
var import_createRuntimeFn5 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
5197
|
-
var ExpanderIconCls = "_16lm1iw6
|
|
5874
|
+
var ExpanderIconCls = "_16lm1iw6 _16lm1iwg _16lm1iwd";
|
|
5198
5875
|
var ExpanderIconClsVariants = (0, import_createRuntimeFn5.createRuntimeFn)({ defaultClassName: "", variantClassNames: { expanded: { true: "_16lm1iwc", false: "_198z9782" } }, defaultVariants: {}, compoundVariants: [] });
|
|
5199
5876
|
|
|
5200
5877
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
5201
5878
|
function ExpanderIcon(props) {
|
|
5202
5879
|
var _a;
|
|
5203
5880
|
const { size = 24 } = props;
|
|
5204
|
-
const [expanded, setExpanded] =
|
|
5881
|
+
const [expanded, setExpanded] = useState11((_a = props.expanded) != null ? _a : props.defaultExpanded);
|
|
5205
5882
|
const onClick = () => {
|
|
5206
5883
|
var _a2;
|
|
5207
5884
|
(_a2 = props.onChange) == null ? void 0 : _a2.call(props, !expanded);
|
|
@@ -5209,12 +5886,12 @@ function ExpanderIcon(props) {
|
|
|
5209
5886
|
setExpanded(!expanded);
|
|
5210
5887
|
}
|
|
5211
5888
|
};
|
|
5212
|
-
|
|
5889
|
+
useEffect18(() => {
|
|
5213
5890
|
if (isControlled("expanded", props)) {
|
|
5214
5891
|
setExpanded(props.expanded);
|
|
5215
5892
|
}
|
|
5216
5893
|
}, [props.expanded]);
|
|
5217
|
-
return /* @__PURE__ */
|
|
5894
|
+
return /* @__PURE__ */ createElement22("svg", {
|
|
5218
5895
|
"data-name": "expander-icon",
|
|
5219
5896
|
xmlns: "http://www.w3.org/2000/svg",
|
|
5220
5897
|
height: `${size}px`,
|
|
@@ -5225,22 +5902,22 @@ function ExpanderIcon(props) {
|
|
|
5225
5902
|
className: join(props.className, ExpanderIconCls, ExpanderIconClsVariants({
|
|
5226
5903
|
expanded
|
|
5227
5904
|
}), "InfiniteIcon", "InfiniteIcon-expander", `InfiniteIcon-expander--${expanded ? "expanded" : "collapsed"}`)
|
|
5228
|
-
}, /* @__PURE__ */
|
|
5905
|
+
}, /* @__PURE__ */ createElement22("path", {
|
|
5229
5906
|
d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"
|
|
5230
5907
|
}));
|
|
5231
5908
|
}
|
|
5232
5909
|
|
|
5233
5910
|
// src/components/InfiniteTable/components/icons/LoadingIcon.tsx
|
|
5234
5911
|
import {
|
|
5235
|
-
createElement as
|
|
5912
|
+
createElement as createElement23
|
|
5236
5913
|
} from "react";
|
|
5237
5914
|
|
|
5238
5915
|
// src/components/InfiniteTable/components/icons/LoadingIcon.css.ts
|
|
5239
|
-
var LoadingIconCls = "_16lm1iw8
|
|
5916
|
+
var LoadingIconCls = "_16lm1iw8 _16lm1iwg _16lm1iwd";
|
|
5240
5917
|
|
|
5241
5918
|
// src/components/InfiniteTable/components/icons/LoadingIcon.tsx
|
|
5242
5919
|
var LoadingIcon = (props) => {
|
|
5243
|
-
return /* @__PURE__ */
|
|
5920
|
+
return /* @__PURE__ */ createElement23("svg", {
|
|
5244
5921
|
xmlns: "http://www.w3.org/2000/svg",
|
|
5245
5922
|
style: {
|
|
5246
5923
|
margin: "auto",
|
|
@@ -5252,14 +5929,14 @@ var LoadingIcon = (props) => {
|
|
|
5252
5929
|
viewBox: "0 0 100 100",
|
|
5253
5930
|
preserveAspectRatio: "xMidYMid",
|
|
5254
5931
|
className: join(props.className, LoadingIconCls, "InfiniteIcon", "InfiniteIcon-loading")
|
|
5255
|
-
}, /* @__PURE__ */
|
|
5932
|
+
}, /* @__PURE__ */ createElement23("circle", {
|
|
5256
5933
|
cx: "50",
|
|
5257
5934
|
cy: "50",
|
|
5258
5935
|
fill: "none",
|
|
5259
5936
|
strokeWidth: "10",
|
|
5260
5937
|
r: "35",
|
|
5261
5938
|
strokeDasharray: "164.93361431346415 56.97787143782138"
|
|
5262
|
-
}, /* @__PURE__ */
|
|
5939
|
+
}, /* @__PURE__ */ createElement23("animateTransform", {
|
|
5263
5940
|
attributeName: "transform",
|
|
5264
5941
|
type: "rotate",
|
|
5265
5942
|
repeatCount: "indefinite",
|
|
@@ -5279,7 +5956,7 @@ function getGroupColumnRender({
|
|
|
5279
5956
|
var _a, _b, _c;
|
|
5280
5957
|
let { value, rowInfo, column, groupBy, pivotBy } = renderOptions;
|
|
5281
5958
|
if (column.renderValue) {
|
|
5282
|
-
value = /* @__PURE__ */
|
|
5959
|
+
value = /* @__PURE__ */ createElement24(RenderHookComponent, {
|
|
5283
5960
|
render: column.renderValue,
|
|
5284
5961
|
renderParam: renderOptions
|
|
5285
5962
|
});
|
|
@@ -5309,22 +5986,22 @@ function getGroupColumnRender({
|
|
|
5309
5986
|
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
5987
|
const isLoading = showLoadingIcon(groupRowInfo);
|
|
5311
5988
|
if (isLoading) {
|
|
5312
|
-
icon = /* @__PURE__ */
|
|
5989
|
+
icon = /* @__PURE__ */ createElement24(LoadingIcon, null);
|
|
5313
5990
|
} else if (showExpanderIcon) {
|
|
5314
|
-
const defaultIcon = /* @__PURE__ */
|
|
5991
|
+
const defaultIcon = /* @__PURE__ */ createElement24(ExpanderIcon, {
|
|
5315
5992
|
expanded: !collapsed,
|
|
5316
5993
|
onChange: () => {
|
|
5317
5994
|
toggleGroupRow(groupKeys);
|
|
5318
5995
|
}
|
|
5319
5996
|
});
|
|
5320
|
-
icon = column.renderGroupIcon ? /* @__PURE__ */
|
|
5997
|
+
icon = column.renderGroupIcon ? /* @__PURE__ */ createElement24(RenderHookComponent, {
|
|
5321
5998
|
render: column.renderGroupIcon,
|
|
5322
5999
|
renderParam: Object.assign({ collapsed, groupIcon: defaultIcon }, renderOptions)
|
|
5323
6000
|
}) : defaultIcon;
|
|
5324
6001
|
}
|
|
5325
|
-
return /* @__PURE__ */
|
|
6002
|
+
return /* @__PURE__ */ createElement24("div", {
|
|
5326
6003
|
className: join(display.flex, alignItems.center)
|
|
5327
|
-
}, icon, /* @__PURE__ */
|
|
6004
|
+
}, icon, /* @__PURE__ */ createElement24("div", {
|
|
5328
6005
|
className: cssEllipsisClassName
|
|
5329
6006
|
}, value != null ? value : null));
|
|
5330
6007
|
};
|
|
@@ -5369,9 +6046,9 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
5369
6046
|
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
6047
|
const isLoading = showLoadingIcon(rowInfo);
|
|
5371
6048
|
if (isLoading) {
|
|
5372
|
-
icon = /* @__PURE__ */
|
|
6049
|
+
icon = /* @__PURE__ */ createElement24(LoadingIcon, null);
|
|
5373
6050
|
} else if (showExpanderIcon) {
|
|
5374
|
-
const defaultIcon = /* @__PURE__ */
|
|
6051
|
+
const defaultIcon = /* @__PURE__ */ createElement24(ExpanderIcon, {
|
|
5375
6052
|
expanded: !collapsed,
|
|
5376
6053
|
onChange: () => {
|
|
5377
6054
|
if (!rowInfo.isGroupRow) {
|
|
@@ -5386,9 +6063,9 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
5386
6063
|
icon = column.renderGroupIcon(renderParam);
|
|
5387
6064
|
}
|
|
5388
6065
|
}
|
|
5389
|
-
return /* @__PURE__ */
|
|
6066
|
+
return /* @__PURE__ */ createElement24("div", {
|
|
5390
6067
|
className: join(display.flex, alignItems.center, GroupRowExpanderCls)
|
|
5391
|
-
}, icon, /* @__PURE__ */
|
|
6068
|
+
}, icon, /* @__PURE__ */ createElement24("div", {
|
|
5392
6069
|
className: cssEllipsisClassName
|
|
5393
6070
|
}, value != null ? value : null));
|
|
5394
6071
|
}
|
|
@@ -5404,11 +6081,11 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
5404
6081
|
}
|
|
5405
6082
|
|
|
5406
6083
|
// src/components/InfiniteTable/hooks/useEffectWithRaf.ts
|
|
5407
|
-
import { useEffect as
|
|
6084
|
+
import { useEffect as useEffect19, useRef as useRef17 } from "react";
|
|
5408
6085
|
function useEffectWithRaf(fn, deps) {
|
|
5409
|
-
const rafId =
|
|
5410
|
-
const removeFnRaf =
|
|
5411
|
-
|
|
6086
|
+
const rafId = useRef17(0);
|
|
6087
|
+
const removeFnRaf = useRef17();
|
|
6088
|
+
useEffect19(() => {
|
|
5412
6089
|
rafId.current = requestAnimationFrame(() => {
|
|
5413
6090
|
removeFnRaf.current = fn();
|
|
5414
6091
|
});
|
|
@@ -5425,7 +6102,7 @@ function useEffectWithRaf(fn, deps) {
|
|
|
5425
6102
|
}
|
|
5426
6103
|
|
|
5427
6104
|
// src/components/InfiniteTable/hooks/useToggleGroupRow.ts
|
|
5428
|
-
import { useCallback as
|
|
6105
|
+
import { useCallback as useCallback14 } from "react";
|
|
5429
6106
|
|
|
5430
6107
|
// src/utils/groupAndPivot/index.ts
|
|
5431
6108
|
var LAZY_ROOT_KEY_FOR_GROUPS = "____root____";
|
|
@@ -5493,21 +6170,18 @@ function lazyGroup(groupParams, rootData) {
|
|
|
5493
6170
|
rootData.visitDepthFirst((lazyGroupRowInfo, keys, _index, next) => {
|
|
5494
6171
|
const [_rootKey, ...currentGroupKeys] = keys;
|
|
5495
6172
|
const dataArray = lazyGroupRowInfo.children;
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
|
|
6173
|
+
const current = deepMap.get(currentGroupKeys);
|
|
6174
|
+
if (current) {
|
|
6175
|
+
current.cache = lazyGroupRowInfo.cache;
|
|
6176
|
+
current.childrenLoading = lazyGroupRowInfo.childrenLoading;
|
|
6177
|
+
current.childrenAvailable = lazyGroupRowInfo.childrenAvailable;
|
|
6178
|
+
current.error = lazyGroupRowInfo.error;
|
|
5502
6179
|
}
|
|
5503
|
-
if (
|
|
5504
|
-
const current = deepMap.get(currentGroupKeys);
|
|
6180
|
+
if (currentGroupKeys.length == groupBy.length && groupBy.length) {
|
|
5505
6181
|
if (current) {
|
|
5506
|
-
current.
|
|
5507
|
-
current.childrenLoading = lazyGroupRowInfo.childrenLoading;
|
|
5508
|
-
current.childrenAvailable = lazyGroupRowInfo.childrenAvailable;
|
|
5509
|
-
current.error = lazyGroupRowInfo.error;
|
|
6182
|
+
current.items = dataArray;
|
|
5510
6183
|
}
|
|
6184
|
+
return next == null ? void 0 : next();
|
|
5511
6185
|
}
|
|
5512
6186
|
for (let i = 0, len = dataArray.length; i < len; i++) {
|
|
5513
6187
|
if (!dataArray[i]) {
|
|
@@ -5836,8 +6510,9 @@ function enhancedFlatten(param) {
|
|
|
5836
6510
|
}
|
|
5837
6511
|
for (let index = 0, len = items.length; index < len; index++) {
|
|
5838
6512
|
const item = items[index];
|
|
6513
|
+
const indexInAll = startIndex + index;
|
|
5839
6514
|
const rowInfo = {
|
|
5840
|
-
id: item ? toPrimaryKey(item) : `${groupKeys}-${index}`,
|
|
6515
|
+
id: item ? toPrimaryKey(item, indexInAll) : `${groupKeys}-${index}`,
|
|
5841
6516
|
data: item,
|
|
5842
6517
|
dataSourceHasGrouping: true,
|
|
5843
6518
|
isGroupRow: false,
|
|
@@ -5848,7 +6523,7 @@ function enhancedFlatten(param) {
|
|
|
5848
6523
|
parents: Array.from(parents),
|
|
5849
6524
|
indexInParentGroups: [...indexInParentGroups, index],
|
|
5850
6525
|
indexInGroup: index,
|
|
5851
|
-
indexInAll
|
|
6526
|
+
indexInAll,
|
|
5852
6527
|
groupBy: groupByStrings,
|
|
5853
6528
|
groupNesting,
|
|
5854
6529
|
groupCount: enhancedGroupData.groupCount
|
|
@@ -5881,8 +6556,8 @@ function enhancedFlatten(param) {
|
|
|
5881
6556
|
|
|
5882
6557
|
// src/components/DataSource/index.tsx
|
|
5883
6558
|
import {
|
|
5884
|
-
Fragment as
|
|
5885
|
-
createElement as
|
|
6559
|
+
Fragment as Fragment3,
|
|
6560
|
+
createElement as createElement25
|
|
5886
6561
|
} from "react";
|
|
5887
6562
|
|
|
5888
6563
|
// src/utils/multisort/sortTypes.ts
|
|
@@ -5894,11 +6569,11 @@ var stringComparator = function(first, second) {
|
|
|
5894
6569
|
second = `${second}`;
|
|
5895
6570
|
return first.localeCompare(second);
|
|
5896
6571
|
};
|
|
5897
|
-
var
|
|
6572
|
+
var defaultSortTypes = {
|
|
5898
6573
|
number: numberComparator,
|
|
5899
6574
|
string: stringComparator
|
|
5900
6575
|
};
|
|
5901
|
-
var sortTypes_default =
|
|
6576
|
+
var sortTypes_default = defaultSortTypes;
|
|
5902
6577
|
|
|
5903
6578
|
// src/utils/multisort/index.ts
|
|
5904
6579
|
var multisort = (sortInfo, array, get) => {
|
|
@@ -5911,7 +6586,8 @@ var getSingleSortFunction = (info) => {
|
|
|
5911
6586
|
return;
|
|
5912
6587
|
}
|
|
5913
6588
|
const field = info.field;
|
|
5914
|
-
|
|
6589
|
+
const valueGetter = info.valueGetter;
|
|
6590
|
+
const dir = info.dir < 0 ? -1 : info.dir > 0 ? 1 : 0;
|
|
5915
6591
|
if (!dir) {
|
|
5916
6592
|
return;
|
|
5917
6593
|
}
|
|
@@ -5926,8 +6602,8 @@ var getSingleSortFunction = (info) => {
|
|
|
5926
6602
|
fn = sortTypes_default.string;
|
|
5927
6603
|
}
|
|
5928
6604
|
return (first, second) => {
|
|
5929
|
-
const a = field ? first[field] : first;
|
|
5930
|
-
const b = field ? second[field] : second;
|
|
6605
|
+
const a = valueGetter ? valueGetter(first) : field ? first[field] : first;
|
|
6606
|
+
const b = valueGetter ? valueGetter(second) : field ? second[field] : second;
|
|
5931
6607
|
return dir * fn(a, b);
|
|
5932
6608
|
};
|
|
5933
6609
|
};
|
|
@@ -5941,34 +6617,144 @@ var getMultisortFunction = (sortInfo, get) => {
|
|
|
5941
6617
|
first = get(first);
|
|
5942
6618
|
second = get(second);
|
|
5943
6619
|
}
|
|
5944
|
-
let result = 0;
|
|
5945
|
-
let i = 0;
|
|
5946
|
-
let fn;
|
|
5947
|
-
const len = fns.length;
|
|
5948
|
-
for (; i < len; i++) {
|
|
5949
|
-
fn = fns[i];
|
|
5950
|
-
if (!fn) {
|
|
5951
|
-
continue;
|
|
6620
|
+
let result = 0;
|
|
6621
|
+
let i = 0;
|
|
6622
|
+
let fn;
|
|
6623
|
+
const len = fns.length;
|
|
6624
|
+
for (; i < len; i++) {
|
|
6625
|
+
fn = fns[i];
|
|
6626
|
+
if (!fn) {
|
|
6627
|
+
continue;
|
|
6628
|
+
}
|
|
6629
|
+
result = fn(first, second);
|
|
6630
|
+
if (result !== 0) {
|
|
6631
|
+
return result;
|
|
6632
|
+
}
|
|
6633
|
+
}
|
|
6634
|
+
return result;
|
|
6635
|
+
};
|
|
6636
|
+
};
|
|
6637
|
+
|
|
6638
|
+
// src/components/DataSource/GroupRowsState.ts
|
|
6639
|
+
var GroupRowsState = class {
|
|
6640
|
+
constructor(state) {
|
|
6641
|
+
this.update(state instanceof GroupRowsState ? state.getState() : state);
|
|
6642
|
+
}
|
|
6643
|
+
getState() {
|
|
6644
|
+
var _a, _b, _c, _d;
|
|
6645
|
+
return {
|
|
6646
|
+
expandedRows: this.expandedAll ? true : (_b = (_a = this.expandedMap) == null ? void 0 : _a.topDownKeys()) != null ? _b : [],
|
|
6647
|
+
collapsedRows: this.collapsedAll ? true : (_d = (_c = this.collapsedMap) == null ? void 0 : _c.topDownKeys()) != null ? _d : []
|
|
6648
|
+
};
|
|
6649
|
+
}
|
|
6650
|
+
destroy() {
|
|
6651
|
+
var _a, _b;
|
|
6652
|
+
(_a = this.expandedMap) == null ? void 0 : _a.clear();
|
|
6653
|
+
(_b = this.collapsedMap) == null ? void 0 : _b.clear();
|
|
6654
|
+
delete this.expandedMap;
|
|
6655
|
+
delete this.collapsedMap;
|
|
6656
|
+
}
|
|
6657
|
+
update(state) {
|
|
6658
|
+
var _a, _b, _c, _d;
|
|
6659
|
+
this.initialState = state;
|
|
6660
|
+
const { collapsedRows, expandedRows } = this.initialState;
|
|
6661
|
+
this.collapsedAll = collapsedRows === true;
|
|
6662
|
+
this.expandedAll = expandedRows === true;
|
|
6663
|
+
if (this.collapsedAll && this.expandedAll) {
|
|
6664
|
+
throw `Cannot have both collapsedRows and expandedRows be true!`;
|
|
6665
|
+
}
|
|
6666
|
+
if (collapsedRows !== true) {
|
|
6667
|
+
(_a = this.collapsedMap) == null ? void 0 : _a.clear();
|
|
6668
|
+
this.collapsedMap = (_b = this.collapsedMap) != null ? _b : new DeepMap(collapsedRows.map((keys) => [keys, true]));
|
|
6669
|
+
}
|
|
6670
|
+
if (expandedRows !== true) {
|
|
6671
|
+
(_c = this.expandedMap) == null ? void 0 : _c.clear();
|
|
6672
|
+
this.expandedMap = (_d = this.expandedMap) != null ? _d : new DeepMap(expandedRows.map((keys) => [keys, true]));
|
|
6673
|
+
}
|
|
6674
|
+
}
|
|
6675
|
+
areAllCollapsed() {
|
|
6676
|
+
return this.collapsedAll && (this.expandedMap ? this.expandedMap.size === 0 : true);
|
|
6677
|
+
}
|
|
6678
|
+
areAllExpanded() {
|
|
6679
|
+
return this.expandedAll && (this.collapsedMap ? this.collapsedMap.size === 0 : true);
|
|
6680
|
+
}
|
|
6681
|
+
collapseAll() {
|
|
6682
|
+
this.update({
|
|
6683
|
+
collapsedRows: true,
|
|
6684
|
+
expandedRows: []
|
|
6685
|
+
});
|
|
6686
|
+
}
|
|
6687
|
+
expandAll() {
|
|
6688
|
+
this.update({
|
|
6689
|
+
expandedRows: true,
|
|
6690
|
+
collapsedRows: []
|
|
6691
|
+
});
|
|
6692
|
+
}
|
|
6693
|
+
isGroupRowExpanded(keys) {
|
|
6694
|
+
var _a, _b;
|
|
6695
|
+
if (this.expandedAll === true) {
|
|
6696
|
+
if (this.collapsedAll === true) {
|
|
6697
|
+
throw 'Cannot have both expandedRows and collapsedRows be "true"';
|
|
6698
|
+
}
|
|
6699
|
+
return !((_a = this.collapsedMap) == null ? void 0 : _a.has(keys));
|
|
6700
|
+
}
|
|
6701
|
+
return (_b = this.expandedMap) == null ? void 0 : _b.has(keys);
|
|
6702
|
+
}
|
|
6703
|
+
isGroupRowCollapsed(keys) {
|
|
6704
|
+
return !this.isGroupRowExpanded(keys);
|
|
6705
|
+
}
|
|
6706
|
+
setGroupRowExpanded(keys, shouldExpand) {
|
|
6707
|
+
var _a;
|
|
6708
|
+
if (shouldExpand === this.isGroupRowExpanded(keys)) {
|
|
6709
|
+
return;
|
|
6710
|
+
}
|
|
6711
|
+
if (shouldExpand) {
|
|
6712
|
+
if (this.collapsedAll === true) {
|
|
6713
|
+
if (!this.expandedMap) {
|
|
6714
|
+
throw `No expandedMap found when trying to expand group row ${keys.join(",")}`;
|
|
6715
|
+
}
|
|
6716
|
+
this.expandedMap.set(keys, true);
|
|
6717
|
+
} else if (this.expandedAll === true) {
|
|
6718
|
+
if (!this.collapsedMap) {
|
|
6719
|
+
throw `No collapsedMap found when trying to expand group row ${keys.join(",")}`;
|
|
6720
|
+
}
|
|
6721
|
+
this.collapsedMap.delete(keys);
|
|
5952
6722
|
}
|
|
5953
|
-
|
|
5954
|
-
if (
|
|
5955
|
-
|
|
6723
|
+
} else {
|
|
6724
|
+
if (this.expandedAll === true) {
|
|
6725
|
+
if (!this.collapsedMap) {
|
|
6726
|
+
throw `No collapsedMap found when trying to collapse group row ${keys.join(",")}`;
|
|
6727
|
+
}
|
|
6728
|
+
this.collapsedMap.set(keys, true);
|
|
6729
|
+
} else if (this.collapsedAll === true) {
|
|
6730
|
+
if (!this.expandedMap) {
|
|
6731
|
+
throw `No expandedMap found when trying to collapse group row ${keys.join(",")}`;
|
|
6732
|
+
}
|
|
6733
|
+
(_a = this.expandedMap) == null ? void 0 : _a.delete(keys);
|
|
5956
6734
|
}
|
|
5957
6735
|
}
|
|
5958
|
-
|
|
5959
|
-
|
|
6736
|
+
}
|
|
6737
|
+
collapseGroupRow(keys) {
|
|
6738
|
+
this.setGroupRowExpanded(keys, false);
|
|
6739
|
+
}
|
|
6740
|
+
expandGroupRow(keys) {
|
|
6741
|
+
this.setGroupRowExpanded(keys, true);
|
|
6742
|
+
}
|
|
6743
|
+
toggleGroupRow(keys) {
|
|
6744
|
+
this.setGroupRowExpanded(keys, !this.isGroupRowExpanded(keys));
|
|
6745
|
+
}
|
|
5960
6746
|
};
|
|
5961
6747
|
|
|
5962
6748
|
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
5963
|
-
import { useEffect as
|
|
6749
|
+
import { useEffect as useEffect21, useMemo as useMemo9, useRef as useRef19, useState as useState12 } from "react";
|
|
5964
6750
|
|
|
5965
6751
|
// src/components/hooks/useEffectWithChanges.ts
|
|
5966
|
-
import { useEffect as
|
|
6752
|
+
import { useEffect as useEffect20, useRef as useRef18 } from "react";
|
|
5967
6753
|
function useEffectWithChanges(fn, deps) {
|
|
5968
|
-
const prevRef =
|
|
5969
|
-
const oldValuesRef =
|
|
6754
|
+
const prevRef = useRef18({});
|
|
6755
|
+
const oldValuesRef = useRef18({});
|
|
5970
6756
|
const oldValues = oldValuesRef.current;
|
|
5971
|
-
const changesRef =
|
|
6757
|
+
const changesRef = useRef18({});
|
|
5972
6758
|
const changes = changesRef.current;
|
|
5973
6759
|
const useEffectDeps = [];
|
|
5974
6760
|
for (const k in deps) {
|
|
@@ -5981,7 +6767,7 @@ function useEffectWithChanges(fn, deps) {
|
|
|
5981
6767
|
}
|
|
5982
6768
|
}
|
|
5983
6769
|
prevRef.current = deps;
|
|
5984
|
-
|
|
6770
|
+
useEffect20(() => {
|
|
5985
6771
|
const changes2 = changesRef.current;
|
|
5986
6772
|
const result = fn(changes2, oldValues);
|
|
5987
6773
|
changesRef.current = {};
|
|
@@ -6034,6 +6820,7 @@ function buildDataSourceDataParams(componentState, overrides) {
|
|
|
6034
6820
|
sortInfo,
|
|
6035
6821
|
groupBy: componentState.groupBy,
|
|
6036
6822
|
pivotBy: componentState.pivotBy,
|
|
6823
|
+
filterValue: componentState.filterValue,
|
|
6037
6824
|
aggregationReducers: componentState.aggregationReducers
|
|
6038
6825
|
};
|
|
6039
6826
|
if (dataSourceParams.groupBy) {
|
|
@@ -6053,6 +6840,13 @@ function buildDataSourceDataParams(componentState, overrides) {
|
|
|
6053
6840
|
if (overrides) {
|
|
6054
6841
|
Object.assign(dataSourceParams, overrides);
|
|
6055
6842
|
}
|
|
6843
|
+
if (dataSourceParams.filterValue && dataSourceParams.filterValue.length) {
|
|
6844
|
+
dataSourceParams.filterValue = dataSourceParams.filterValue.map((f) => {
|
|
6845
|
+
const value = __spreadValues({}, f);
|
|
6846
|
+
delete value.valueGetter;
|
|
6847
|
+
return value;
|
|
6848
|
+
});
|
|
6849
|
+
}
|
|
6056
6850
|
const changes = {};
|
|
6057
6851
|
const oldDataSourceParams = componentState.dataParams || {};
|
|
6058
6852
|
for (const k in dataSourceParams) {
|
|
@@ -6073,6 +6867,13 @@ function loadData(data, componentState, actions, overrides) {
|
|
|
6073
6867
|
const lazyGroupData = componentState.originalLazyGroupData;
|
|
6074
6868
|
const key = [LAZY_ROOT_KEY_FOR_GROUPS, ...dataParams.groupKeys || []];
|
|
6075
6869
|
const existingGroupRowInfo = lazyGroupData.get(key);
|
|
6870
|
+
if (!existingGroupRowInfo) {
|
|
6871
|
+
const groupCacheKeys = [
|
|
6872
|
+
...dataParams.groupKeys || [],
|
|
6873
|
+
dataParams.lazyLoadStartIndex
|
|
6874
|
+
];
|
|
6875
|
+
componentState.lazyLoadCacheOfLoadedBatches.set(groupCacheKeys, true);
|
|
6876
|
+
}
|
|
6076
6877
|
if (existingGroupRowInfo && existingGroupRowInfo.cache && key.length > 1) {
|
|
6077
6878
|
const items = existingGroupRowInfo.children;
|
|
6078
6879
|
const len = items.length;
|
|
@@ -6098,7 +6899,8 @@ function loadData(data, componentState, actions, overrides) {
|
|
|
6098
6899
|
childrenLoading: true,
|
|
6099
6900
|
childrenAvailable: false,
|
|
6100
6901
|
cache: CACHE_DEFAULT,
|
|
6101
|
-
totalCount: 0
|
|
6902
|
+
totalCount: 0,
|
|
6903
|
+
totalCountUnfiltered: 0
|
|
6102
6904
|
});
|
|
6103
6905
|
}
|
|
6104
6906
|
actions.originalLazyGroupDataChangeDetect = getChangeDetect();
|
|
@@ -6122,9 +6924,12 @@ function loadData(data, componentState, actions, overrides) {
|
|
|
6122
6924
|
if (remoteData.mappings) {
|
|
6123
6925
|
actions.pivotMappings = remoteData.mappings;
|
|
6124
6926
|
}
|
|
6927
|
+
if (remoteData.totalCountUnfiltered) {
|
|
6928
|
+
actions.unfilteredCount = remoteData.totalCountUnfiltered;
|
|
6929
|
+
}
|
|
6125
6930
|
if (componentState.lazyLoad) {
|
|
6126
6931
|
let resolveRemoteData = function(keys, remoteData2, parentKeys) {
|
|
6127
|
-
var _a, _b, _c;
|
|
6932
|
+
var _a, _b, _c, _d;
|
|
6128
6933
|
const theKey = [LAZY_ROOT_KEY_FOR_GROUPS, ...keys];
|
|
6129
6934
|
const dataArray2 = remoteData2.data;
|
|
6130
6935
|
const newGroupRowInfo = {
|
|
@@ -6132,6 +6937,7 @@ function loadData(data, componentState, actions, overrides) {
|
|
|
6132
6937
|
childrenLoading: false,
|
|
6133
6938
|
childrenAvailable: true,
|
|
6134
6939
|
totalCount: (_a = remoteData2.totalCount) != null ? _a : dataArray2.length,
|
|
6940
|
+
totalCountUnfiltered: (_b = remoteData2.totalCount) != null ? _b : dataArray2.length,
|
|
6135
6941
|
children: dataArray2,
|
|
6136
6942
|
error: remoteData2.error
|
|
6137
6943
|
};
|
|
@@ -6146,8 +6952,8 @@ function loadData(data, componentState, actions, overrides) {
|
|
|
6146
6952
|
currentGroupRowInfo.chidren = [];
|
|
6147
6953
|
}
|
|
6148
6954
|
currentGroupRowInfo.children.length = currentGroupRowInfo.totalCount;
|
|
6149
|
-
const start = (
|
|
6150
|
-
const end = Math.min((
|
|
6955
|
+
const start = (_c = dataParams.lazyLoadStartIndex) != null ? _c : 0;
|
|
6956
|
+
const end = Math.min((_d = remoteData2.totalCount) != null ? _d : dataArray2.length, start + dataParams.lazyLoadBatchSize);
|
|
6151
6957
|
for (let i = start; i < end; i++) {
|
|
6152
6958
|
const it = newGroupRowInfo.children[i - start];
|
|
6153
6959
|
if (!it) {
|
|
@@ -6224,16 +7030,17 @@ function useLoadData() {
|
|
|
6224
7030
|
sortInfo,
|
|
6225
7031
|
groupBy,
|
|
6226
7032
|
pivotBy,
|
|
7033
|
+
filterValue,
|
|
6227
7034
|
livePagination,
|
|
6228
7035
|
livePaginationCursor,
|
|
6229
7036
|
cursorId: stateCursorId
|
|
6230
7037
|
} = componentState;
|
|
6231
|
-
const [scrollbars, setScrollbars] =
|
|
7038
|
+
const [scrollbars, setScrollbars] = useState12({
|
|
6232
7039
|
vertical: false,
|
|
6233
7040
|
horizontal: false
|
|
6234
7041
|
});
|
|
6235
|
-
const scrollbarsRef =
|
|
6236
|
-
|
|
7042
|
+
const scrollbarsRef = useRef19(scrollbars);
|
|
7043
|
+
useEffect21(() => {
|
|
6237
7044
|
notifyScrollbarsChange.onChange((scrollbars2) => {
|
|
6238
7045
|
if (!scrollbars2) {
|
|
6239
7046
|
return;
|
|
@@ -6243,7 +7050,7 @@ function useLoadData() {
|
|
|
6243
7050
|
});
|
|
6244
7051
|
return () => notifyScrollbarsChange.destroy();
|
|
6245
7052
|
}, [notifyScrollbarsChange]);
|
|
6246
|
-
|
|
7053
|
+
useEffect21(() => {
|
|
6247
7054
|
if (!livePagination) {
|
|
6248
7055
|
return;
|
|
6249
7056
|
}
|
|
@@ -6257,7 +7064,7 @@ function useLoadData() {
|
|
|
6257
7064
|
});
|
|
6258
7065
|
return () => cancelAnimationFrame(frameId);
|
|
6259
7066
|
}, [livePaginationCursor]);
|
|
6260
|
-
|
|
7067
|
+
useEffect21(() => {
|
|
6261
7068
|
if (!livePagination || livePaginationCursor !== void 0) {
|
|
6262
7069
|
return;
|
|
6263
7070
|
}
|
|
@@ -6271,7 +7078,7 @@ function useLoadData() {
|
|
|
6271
7078
|
});
|
|
6272
7079
|
return () => cancelAnimationFrame(frameId);
|
|
6273
7080
|
}, [dataArray.length, livePaginationCursor]);
|
|
6274
|
-
|
|
7081
|
+
useEffect21(() => {
|
|
6275
7082
|
const state = getComponentState();
|
|
6276
7083
|
const { livePaginationCursor: livePaginationCursor2, livePagination: livePagination2, dataArray: dataArray2 } = state;
|
|
6277
7084
|
if (!scrollbars.vertical && livePagination2) {
|
|
@@ -6286,9 +7093,10 @@ function useLoadData() {
|
|
|
6286
7093
|
sortInfo,
|
|
6287
7094
|
groupBy,
|
|
6288
7095
|
pivotBy,
|
|
7096
|
+
filterValue,
|
|
6289
7097
|
cursorId: livePagination ? stateCursorId : null
|
|
6290
7098
|
};
|
|
6291
|
-
const initialRef =
|
|
7099
|
+
const initialRef = useRef19(true);
|
|
6292
7100
|
useLazyLoadRange();
|
|
6293
7101
|
useEffectWithChanges(() => {
|
|
6294
7102
|
const componentState2 = getComponentState();
|
|
@@ -6320,7 +7128,7 @@ function useLazyLoadRange() {
|
|
|
6320
7128
|
componentActions: actions,
|
|
6321
7129
|
componentState
|
|
6322
7130
|
} = useComponentState();
|
|
6323
|
-
|
|
7131
|
+
useEffect21(() => {
|
|
6324
7132
|
actions.lazyLoadCacheOfLoadedBatches = new DeepMap();
|
|
6325
7133
|
}, [componentState.data, componentState.dataParams]);
|
|
6326
7134
|
const {
|
|
@@ -6329,7 +7137,7 @@ function useLazyLoadRange() {
|
|
|
6329
7137
|
dataArray,
|
|
6330
7138
|
scrollStopDelayUpdatedByTable
|
|
6331
7139
|
} = componentState;
|
|
6332
|
-
const latestRenderRangeRef =
|
|
7140
|
+
const latestRenderRangeRef = useRef19(null);
|
|
6333
7141
|
const loadRange = (renderRange, cache = getComponentState().lazyLoadCacheOfLoadedBatches) => {
|
|
6334
7142
|
const componentState2 = getComponentState();
|
|
6335
7143
|
renderRange = renderRange || latestRenderRangeRef.current;
|
|
@@ -6348,8 +7156,8 @@ function useLazyLoadRange() {
|
|
|
6348
7156
|
componentActions: actions
|
|
6349
7157
|
}, cache);
|
|
6350
7158
|
};
|
|
6351
|
-
const debouncedLoadRange =
|
|
6352
|
-
|
|
7159
|
+
const debouncedLoadRange = useMemo9(() => debounce(loadRange, { wait: scrollStopDelayUpdatedByTable }), [scrollStopDelayUpdatedByTable]);
|
|
7160
|
+
useEffect21(() => {
|
|
6353
7161
|
if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
|
|
6354
7162
|
return notifyRenderRangeChange.onChange((renderRange) => {
|
|
6355
7163
|
latestRenderRangeRef.current = renderRange;
|
|
@@ -6358,7 +7166,7 @@ function useLazyLoadRange() {
|
|
|
6358
7166
|
}
|
|
6359
7167
|
return;
|
|
6360
7168
|
}, [lazyLoadBatchSize]);
|
|
6361
|
-
|
|
7169
|
+
useEffect21(() => {
|
|
6362
7170
|
if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
|
|
6363
7171
|
debouncedLoadRange();
|
|
6364
7172
|
}
|
|
@@ -6391,7 +7199,7 @@ function lazyLoadRange(options, cache) {
|
|
|
6391
7199
|
theGroupKeys.pop();
|
|
6392
7200
|
}
|
|
6393
7201
|
const cacheKeys = theGroupKeys.length ? theGroupKeys : rootGroupKeys;
|
|
6394
|
-
const indexInGroup = rowInfo.
|
|
7202
|
+
const indexInGroup = rowInfo.dataSourceHasGrouping ? rowInfo.indexInGroup : rowInfo.indexInAll;
|
|
6395
7203
|
if (rowInfo.isGroupRow && !rowInfo.collapsed && !rowInfo.childrenAvailable) {
|
|
6396
7204
|
const currentFnCall = {
|
|
6397
7205
|
lazyLoadStartIndex: 0,
|
|
@@ -6414,7 +7222,7 @@ function lazyLoadRange(options, cache) {
|
|
|
6414
7222
|
if (!rowLoaded) {
|
|
6415
7223
|
let cachedFnCalls = perGroupFnCalls.get(cacheKeys);
|
|
6416
7224
|
const batchStartIndexInGroup = Math.floor(indexInGroup / lazyLoadBatchSize) * lazyLoadBatchSize;
|
|
6417
|
-
const offset =
|
|
7225
|
+
const offset = indexInGroup - batchStartIndexInGroup;
|
|
6418
7226
|
const absoluteIndexOfBatchStart = dataArray[rowInfo.indexInAll - offset].indexInAll;
|
|
6419
7227
|
const batchStartRowLoaded = isRowLoaded(absoluteIndexOfBatchStart);
|
|
6420
7228
|
const batchStartRowId = dataArray[absoluteIndexOfBatchStart].id;
|
|
@@ -6436,191 +7244,81 @@ function lazyLoadRange(options, cache) {
|
|
|
6436
7244
|
}
|
|
6437
7245
|
}
|
|
6438
7246
|
}
|
|
6439
|
-
const initialPromise = Promise.resolve(true);
|
|
6440
|
-
const allFnCalls = [];
|
|
6441
|
-
perGroupFnCalls.topDownValues().forEach((record) => {
|
|
6442
|
-
allFnCalls.push(...Object.values(record));
|
|
6443
|
-
});
|
|
6444
|
-
allFnCalls.reduce((promise, fnCall) => {
|
|
6445
|
-
const cacheKey = [...fnCall.groupKeys, fnCall.lazyLoadStartIndex];
|
|
6446
|
-
if (cache && cache.has(cacheKey)) {
|
|
6447
|
-
return promise;
|
|
6448
|
-
}
|
|
6449
|
-
cache == null ? void 0 : cache.set(cacheKey, true);
|
|
6450
|
-
const args = [componentState.data, componentState, componentActions, fnCall];
|
|
6451
|
-
return promise.then(() => getRafPromise()).then(() => loadData(...args));
|
|
6452
|
-
}, initialPromise);
|
|
6453
|
-
}
|
|
6454
|
-
|
|
6455
|
-
// src/utils/shallowEqualObjects.ts
|
|
6456
|
-
function shallowEqualObjects(objA, objB, ignoreKeys) {
|
|
6457
|
-
if (objA === objB) {
|
|
6458
|
-
return true;
|
|
6459
|
-
}
|
|
6460
|
-
if (!objA || !objB) {
|
|
6461
|
-
return false;
|
|
6462
|
-
}
|
|
6463
|
-
var aKeys = Object.keys(objA);
|
|
6464
|
-
var bKeys = Object.keys(objB);
|
|
6465
|
-
if (ignoreKeys) {
|
|
6466
|
-
aKeys = aKeys.filter((key2) => !ignoreKeys.has(key2));
|
|
6467
|
-
bKeys = bKeys.filter((key2) => !ignoreKeys.has(key2));
|
|
6468
|
-
}
|
|
6469
|
-
var len = aKeys.length;
|
|
6470
|
-
if (bKeys.length !== len) {
|
|
6471
|
-
return false;
|
|
6472
|
-
}
|
|
6473
|
-
for (var i = 0; i < len; i++) {
|
|
6474
|
-
var key = aKeys[i];
|
|
6475
|
-
if (ignoreKeys) {
|
|
6476
|
-
if (ignoreKeys.has(key)) {
|
|
6477
|
-
continue;
|
|
6478
|
-
}
|
|
6479
|
-
}
|
|
6480
|
-
if (objA[key] !== objB[key] || !Object.prototype.hasOwnProperty.call(objB, key)) {
|
|
6481
|
-
return false;
|
|
6482
|
-
}
|
|
6483
|
-
}
|
|
6484
|
-
return true;
|
|
6485
|
-
}
|
|
6486
|
-
|
|
6487
|
-
// src/components/utils/discardCallsWithEqualArg.ts
|
|
6488
|
-
var map = new WeakMap();
|
|
6489
|
-
var getCompareDefault = (a) => a;
|
|
6490
|
-
function discardCallsWithEqualArg(fn, timeframe = 50, getCompareObject) {
|
|
6491
|
-
map.set(fn, {
|
|
6492
|
-
lastCallTime: 0,
|
|
6493
|
-
lastCallArg: null
|
|
6494
|
-
});
|
|
6495
|
-
const getCompare = getCompareObject != null ? getCompareObject : getCompareDefault;
|
|
6496
|
-
return (arg) => {
|
|
6497
|
-
const { lastCallTime, lastCallArg } = map.get(fn) || {
|
|
6498
|
-
lastCallTime: 0,
|
|
6499
|
-
lastCallArg: null
|
|
6500
|
-
};
|
|
6501
|
-
const now = Date.now();
|
|
6502
|
-
const diff = now - lastCallTime;
|
|
6503
|
-
const objectsEqual = shallowEqualObjects(getCompare(lastCallArg), getCompare(arg));
|
|
6504
|
-
if (diff < timeframe && objectsEqual) {
|
|
6505
|
-
return;
|
|
6506
|
-
}
|
|
6507
|
-
map.set(fn, {
|
|
6508
|
-
lastCallTime: now,
|
|
6509
|
-
lastCallArg: arg
|
|
6510
|
-
});
|
|
6511
|
-
fn(arg);
|
|
6512
|
-
};
|
|
6513
|
-
}
|
|
6514
|
-
|
|
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);
|
|
7247
|
+
const initialPromise = Promise.resolve(true);
|
|
7248
|
+
const allFnCalls = [];
|
|
7249
|
+
perGroupFnCalls.topDownValues().forEach((record) => {
|
|
7250
|
+
allFnCalls.push(...Object.values(record));
|
|
7251
|
+
});
|
|
7252
|
+
allFnCalls.reduce((promise, fnCall) => {
|
|
7253
|
+
const cacheKey = [...fnCall.groupKeys, fnCall.lazyLoadStartIndex];
|
|
7254
|
+
if (cache && cache.has(cacheKey)) {
|
|
7255
|
+
return promise;
|
|
7256
|
+
}
|
|
7257
|
+
cache == null ? void 0 : cache.set(cacheKey, true);
|
|
7258
|
+
const args = [componentState.data, componentState, componentActions, fnCall];
|
|
7259
|
+
return promise.then(() => getRafPromise()).then(() => loadData(...args));
|
|
7260
|
+
}, initialPromise);
|
|
7261
|
+
}
|
|
7262
|
+
|
|
7263
|
+
// src/utils/shallowEqualObjects.ts
|
|
7264
|
+
function shallowEqualObjects(objA, objB, ignoreKeys) {
|
|
7265
|
+
if (objA === objB) {
|
|
7266
|
+
return true;
|
|
6616
7267
|
}
|
|
6617
|
-
|
|
6618
|
-
|
|
7268
|
+
if (!objA || !objB) {
|
|
7269
|
+
return false;
|
|
6619
7270
|
}
|
|
6620
|
-
|
|
6621
|
-
|
|
7271
|
+
var aKeys = Object.keys(objA);
|
|
7272
|
+
var bKeys = Object.keys(objB);
|
|
7273
|
+
if (ignoreKeys) {
|
|
7274
|
+
aKeys = aKeys.filter((key2) => !ignoreKeys.has(key2));
|
|
7275
|
+
bKeys = bKeys.filter((key2) => !ignoreKeys.has(key2));
|
|
6622
7276
|
}
|
|
6623
|
-
|
|
7277
|
+
var len = aKeys.length;
|
|
7278
|
+
if (bKeys.length !== len) {
|
|
7279
|
+
return false;
|
|
7280
|
+
}
|
|
7281
|
+
for (var i = 0; i < len; i++) {
|
|
7282
|
+
var key = aKeys[i];
|
|
7283
|
+
if (ignoreKeys) {
|
|
7284
|
+
if (ignoreKeys.has(key)) {
|
|
7285
|
+
continue;
|
|
7286
|
+
}
|
|
7287
|
+
}
|
|
7288
|
+
if (objA[key] !== objB[key] || !Object.prototype.hasOwnProperty.call(objB, key)) {
|
|
7289
|
+
return false;
|
|
7290
|
+
}
|
|
7291
|
+
}
|
|
7292
|
+
return true;
|
|
7293
|
+
}
|
|
7294
|
+
|
|
7295
|
+
// src/components/utils/discardCallsWithEqualArg.ts
|
|
7296
|
+
var map = new WeakMap();
|
|
7297
|
+
var getCompareDefault = (a) => a;
|
|
7298
|
+
function discardCallsWithEqualArg(fn, timeframe = 50, getCompareObject) {
|
|
7299
|
+
map.set(fn, {
|
|
7300
|
+
lastCallTime: 0,
|
|
7301
|
+
lastCallArg: null
|
|
7302
|
+
});
|
|
7303
|
+
const getCompare = getCompareObject != null ? getCompareObject : getCompareDefault;
|
|
7304
|
+
return (arg) => {
|
|
7305
|
+
const { lastCallTime, lastCallArg } = map.get(fn) || {
|
|
7306
|
+
lastCallTime: 0,
|
|
7307
|
+
lastCallArg: null
|
|
7308
|
+
};
|
|
7309
|
+
const now = Date.now();
|
|
7310
|
+
const diff = now - lastCallTime;
|
|
7311
|
+
const objectsEqual = shallowEqualObjects(getCompare(lastCallArg), getCompare(arg));
|
|
7312
|
+
if (diff < timeframe && objectsEqual) {
|
|
7313
|
+
return;
|
|
7314
|
+
}
|
|
7315
|
+
map.set(fn, {
|
|
7316
|
+
lastCallTime: now,
|
|
7317
|
+
lastCallArg: arg
|
|
7318
|
+
});
|
|
7319
|
+
fn(arg);
|
|
7320
|
+
};
|
|
7321
|
+
}
|
|
6624
7322
|
|
|
6625
7323
|
// src/components/DataSource/state/normalizeSortInfo.ts
|
|
6626
7324
|
var EMPTY_ARRAY = Object.freeze([]);
|
|
@@ -6667,9 +7365,12 @@ function initSetupState() {
|
|
|
6667
7365
|
pivotColumns: void 0,
|
|
6668
7366
|
pivotColumnGroups: void 0,
|
|
6669
7367
|
dataArray,
|
|
7368
|
+
unfilteredCount: dataArray.length,
|
|
7369
|
+
filteredCount: dataArray.length,
|
|
6670
7370
|
updatedAt: now,
|
|
6671
7371
|
groupedAt: 0,
|
|
6672
7372
|
sortedAt: 0,
|
|
7373
|
+
filteredAt: 0,
|
|
6673
7374
|
reducedAt: now,
|
|
6674
7375
|
generateGroupRows: true,
|
|
6675
7376
|
groupDeepMap: void 0,
|
|
@@ -6692,6 +7393,16 @@ var forwardProps2 = (setupState) => {
|
|
|
6692
7393
|
pivotBy: 1,
|
|
6693
7394
|
primaryKey: 1,
|
|
6694
7395
|
livePagination: 1,
|
|
7396
|
+
filterFunction: 1,
|
|
7397
|
+
filterValue: 1,
|
|
7398
|
+
filterDelay: (filterDelay) => filterDelay != null ? filterDelay : 200,
|
|
7399
|
+
filterTypes: (filterTypes) => {
|
|
7400
|
+
return __spreadValues(__spreadValues({}, defaultFilterTypes), filterTypes);
|
|
7401
|
+
},
|
|
7402
|
+
sortTypes: (sortTypes) => {
|
|
7403
|
+
return __spreadValues(__spreadValues({}, sortTypes_default), sortTypes);
|
|
7404
|
+
},
|
|
7405
|
+
sortMode: (sortMode) => sortMode != null ? sortMode : "local",
|
|
6695
7406
|
aggregationReducers: 1,
|
|
6696
7407
|
collapseGroupRowsOnDataFunctionChange: (collapseGroupRowsOnDataFunctionChange) => collapseGroupRowsOnDataFunctionChange != null ? collapseGroupRowsOnDataFunctionChange : true,
|
|
6697
7408
|
loading: (loading) => loading != null ? loading : false,
|
|
@@ -6717,10 +7428,25 @@ function getLivePaginationCursorValue(livePaginationCursorProp, state) {
|
|
|
6717
7428
|
return livePaginationCursor;
|
|
6718
7429
|
}
|
|
6719
7430
|
function mapPropsToState(params) {
|
|
7431
|
+
var _a;
|
|
6720
7432
|
const { props, state, oldState } = params;
|
|
6721
7433
|
const controlledSort = isControlledValue(props.sortInfo);
|
|
7434
|
+
const controlledFilter = isControlledValue(props.filterValue);
|
|
7435
|
+
const { filterTypes } = state;
|
|
7436
|
+
const operatorsByFilterType = Object.keys(filterTypes).reduce((acc, key) => {
|
|
7437
|
+
const operators = filterTypes[key].operators;
|
|
7438
|
+
acc[key] = acc[key] || {};
|
|
7439
|
+
const currentFilterTypeOperators = acc[key];
|
|
7440
|
+
operators.forEach((operator) => {
|
|
7441
|
+
currentFilterTypeOperators[operator.name] = operator;
|
|
7442
|
+
});
|
|
7443
|
+
return acc;
|
|
7444
|
+
}, {});
|
|
6722
7445
|
const result = {
|
|
7446
|
+
operatorsByFilterType,
|
|
6723
7447
|
controlledSort,
|
|
7448
|
+
controlledFilter,
|
|
7449
|
+
filterMode: ((_a = props.filterMode) != null ? _a : props.filterFunction != null) ? "local" : typeof props.data === "function" ? "remote" : "local",
|
|
6724
7450
|
multiSort: Array.isArray(controlledSort ? props.sortInfo : props.defaultSortInfo),
|
|
6725
7451
|
lazyLoadBatchSize: typeof props.lazyLoad === "object" ? props.lazyLoad.batchSize : void 0
|
|
6726
7452
|
};
|
|
@@ -6785,6 +7511,18 @@ function getInterceptActions() {
|
|
|
6785
7511
|
});
|
|
6786
7512
|
}
|
|
6787
7513
|
},
|
|
7514
|
+
filterValue: (filterValue, { actions, state }) => {
|
|
7515
|
+
const dataParams = buildDataSourceDataParams(state, {
|
|
7516
|
+
filterValue,
|
|
7517
|
+
livePaginationCursor: null
|
|
7518
|
+
});
|
|
7519
|
+
actions.dataParams = dataParams;
|
|
7520
|
+
if (state.livePagination) {
|
|
7521
|
+
requestAnimationFrame(() => {
|
|
7522
|
+
actions.livePaginationCursor = null;
|
|
7523
|
+
});
|
|
7524
|
+
}
|
|
7525
|
+
},
|
|
6788
7526
|
cursorId: (cursorId, { actions, state }) => {
|
|
6789
7527
|
const dataParams = buildDataSourceDataParams(state, {
|
|
6790
7528
|
__cursorId: cursorId
|
|
@@ -6866,7 +7604,7 @@ function getPivotColumnsAndColumnGroups({
|
|
|
6866
7604
|
pivotGroupKeys: [],
|
|
6867
7605
|
pivotGroupKey: "",
|
|
6868
7606
|
pivotIndex: -1,
|
|
6869
|
-
|
|
7607
|
+
valueFormatter: ({ rowInfo }) => {
|
|
6870
7608
|
var _a;
|
|
6871
7609
|
return rowInfo.isGroupRow ? (_a = rowInfo.reducerResults) == null ? void 0 : _a[reducer.id] : null;
|
|
6872
7610
|
}
|
|
@@ -6915,7 +7653,7 @@ function getPivotColumnsAndColumnGroups({
|
|
|
6915
7653
|
sortable: false,
|
|
6916
7654
|
columnGroup: parentColumnGroupId,
|
|
6917
7655
|
header,
|
|
6918
|
-
|
|
7656
|
+
valueFormatter: ({ rowInfo }) => {
|
|
6919
7657
|
var _a, _b;
|
|
6920
7658
|
if (!rowInfo.isGroupRow) {
|
|
6921
7659
|
return null;
|
|
@@ -6970,7 +7708,7 @@ function getPivotColumnsAndColumnGroups({
|
|
|
6970
7708
|
pivotIndex: keys.length - 1,
|
|
6971
7709
|
pivotBy,
|
|
6972
7710
|
sortable: false,
|
|
6973
|
-
|
|
7711
|
+
valueFormatter: ({ rowInfo }) => {
|
|
6974
7712
|
var _a, _b;
|
|
6975
7713
|
if (!rowInfo.isGroupRow) {
|
|
6976
7714
|
return null;
|
|
@@ -7018,9 +7756,68 @@ function toRowInfo(data, id, index) {
|
|
|
7018
7756
|
selfLoaded: true
|
|
7019
7757
|
};
|
|
7020
7758
|
}
|
|
7759
|
+
function filterDataSource(params) {
|
|
7760
|
+
const {
|
|
7761
|
+
filterTypes,
|
|
7762
|
+
filterValue: filterValueArray,
|
|
7763
|
+
operatorsByFilterType,
|
|
7764
|
+
filterFunction,
|
|
7765
|
+
toPrimaryKey
|
|
7766
|
+
} = params;
|
|
7767
|
+
let { dataArray } = params;
|
|
7768
|
+
if (filterFunction) {
|
|
7769
|
+
dataArray = dataArray.filter((data, index, arr) => filterFunction({
|
|
7770
|
+
data,
|
|
7771
|
+
index,
|
|
7772
|
+
dataArray: arr,
|
|
7773
|
+
primaryKey: toPrimaryKey(data, index)
|
|
7774
|
+
}));
|
|
7775
|
+
}
|
|
7776
|
+
if (filterValueArray && filterValueArray.length) {
|
|
7777
|
+
return dataArray.filter((data, index, arr) => {
|
|
7778
|
+
var _a;
|
|
7779
|
+
const param = {
|
|
7780
|
+
data,
|
|
7781
|
+
index,
|
|
7782
|
+
dataArray: arr,
|
|
7783
|
+
primaryKey: toPrimaryKey(data, index)
|
|
7784
|
+
};
|
|
7785
|
+
for (let i = 0, len = filterValueArray.length; i < len; i++) {
|
|
7786
|
+
const currentFilterValue = filterValueArray[i];
|
|
7787
|
+
const {
|
|
7788
|
+
disabled,
|
|
7789
|
+
filterValue,
|
|
7790
|
+
field,
|
|
7791
|
+
filterType: filterTypeKey,
|
|
7792
|
+
valueGetter,
|
|
7793
|
+
operator
|
|
7794
|
+
} = currentFilterValue;
|
|
7795
|
+
const filterType = filterTypes[filterTypeKey];
|
|
7796
|
+
if (disabled || !filterType) {
|
|
7797
|
+
continue;
|
|
7798
|
+
}
|
|
7799
|
+
const currentOperator = (_a = operatorsByFilterType[filterTypeKey]) == null ? void 0 : _a[operator];
|
|
7800
|
+
if (!currentOperator) {
|
|
7801
|
+
continue;
|
|
7802
|
+
}
|
|
7803
|
+
const getter = valueGetter || (({ data: data2 }) => field ? data2[field] : data2);
|
|
7804
|
+
const operatorFnParam = __spreadValues({}, param);
|
|
7805
|
+
operatorFnParam.filterValue = filterValue;
|
|
7806
|
+
operatorFnParam.currentValue = getter(param);
|
|
7807
|
+
operatorFnParam.emptyValues = filterType.emptyValues;
|
|
7808
|
+
if (!currentOperator.fn(operatorFnParam)) {
|
|
7809
|
+
return false;
|
|
7810
|
+
}
|
|
7811
|
+
}
|
|
7812
|
+
return true;
|
|
7813
|
+
});
|
|
7814
|
+
}
|
|
7815
|
+
return dataArray;
|
|
7816
|
+
}
|
|
7021
7817
|
function concludeReducer(params) {
|
|
7022
7818
|
var _a, _b;
|
|
7023
7819
|
const { state, previousState } = params;
|
|
7820
|
+
const primaryKeyDescriptor = state.primaryKey;
|
|
7024
7821
|
const sortInfo = state.sortInfo;
|
|
7025
7822
|
let shouldSort = !!(sortInfo == null ? void 0 : sortInfo.length) && !state.controlledSort;
|
|
7026
7823
|
if (state.lazyLoad || state.livePagination) {
|
|
@@ -7038,15 +7835,24 @@ function concludeReducer(params) {
|
|
|
7038
7835
|
state.originalLazyGroupData = new DeepMap();
|
|
7039
7836
|
originalDataArrayChanged = true;
|
|
7040
7837
|
}
|
|
7838
|
+
const { filterFunction, filterValue, filterTypes, operatorsByFilterType } = state;
|
|
7839
|
+
const shouldFilter = !!filterFunction || Array.isArray(filterValue) && filterValue.length;
|
|
7840
|
+
const shouldFilterClientSide = shouldFilter && state.filterMode === "local";
|
|
7841
|
+
const filterDepsChanged = haveDepsChanged(previousState, state, [
|
|
7842
|
+
"filterFunction",
|
|
7843
|
+
"filterValue",
|
|
7844
|
+
"filterTypes"
|
|
7845
|
+
]);
|
|
7846
|
+
const filterChanged = originalDataArrayChanged || filterDepsChanged;
|
|
7041
7847
|
const sortInfoChanged = haveDepsChanged(previousState, state, ["sortInfo"]);
|
|
7042
|
-
const sortDepsChanged = originalDataArrayChanged || sortInfoChanged;
|
|
7848
|
+
const sortDepsChanged = originalDataArrayChanged || filterDepsChanged || sortInfoChanged;
|
|
7849
|
+
const shouldFilterAgain = state.filterMode === "local" && (filterChanged || !state.lastFilterDataArray);
|
|
7043
7850
|
const shouldSortAgain = shouldSort && (sortDepsChanged || !state.lastSortDataArray);
|
|
7044
7851
|
const groupBy = state.groupBy;
|
|
7045
7852
|
const pivotBy = state.pivotBy;
|
|
7046
7853
|
const shouldGroup = groupBy.length > 0 || !!pivotBy;
|
|
7047
|
-
const groupsDepsChanged = originalDataArrayChanged || haveDepsChanged(previousState, state, [
|
|
7854
|
+
const groupsDepsChanged = originalDataArrayChanged || sortDepsChanged || haveDepsChanged(previousState, state, [
|
|
7048
7855
|
"generateGroupRows",
|
|
7049
|
-
"originalDataArray",
|
|
7050
7856
|
"originalLazyGroupData",
|
|
7051
7857
|
"originalLazyGroupDataChangeDetect",
|
|
7052
7858
|
"groupBy",
|
|
@@ -7055,23 +7861,44 @@ function concludeReducer(params) {
|
|
|
7055
7861
|
"aggregationReducers",
|
|
7056
7862
|
"pivotTotalColumnPosition",
|
|
7057
7863
|
"pivotGrandTotalColumnPosition",
|
|
7058
|
-
"showSeparatePivotColumnForSingleAggregation"
|
|
7059
|
-
"sortInfo"
|
|
7864
|
+
"showSeparatePivotColumnForSingleAggregation"
|
|
7060
7865
|
]);
|
|
7061
7866
|
const shouldGroupAgain = shouldGroup && (groupsDepsChanged || !state.lastGroupDataArray);
|
|
7062
7867
|
const now = Date.now();
|
|
7063
7868
|
let dataArray = state.originalDataArray;
|
|
7064
|
-
|
|
7065
|
-
|
|
7869
|
+
const toPrimaryKey = typeof primaryKeyDescriptor === "function" ? (data, index) => primaryKeyDescriptor({ data, index }) : (data, _index) => {
|
|
7870
|
+
const pk = data[primaryKeyDescriptor];
|
|
7871
|
+
return pk;
|
|
7872
|
+
};
|
|
7873
|
+
if (!shouldFilter) {
|
|
7874
|
+
state.unfilteredCount = dataArray.length;
|
|
7875
|
+
}
|
|
7876
|
+
if (shouldFilterClientSide) {
|
|
7877
|
+
state.unfilteredCount = dataArray.length;
|
|
7878
|
+
dataArray = shouldFilterAgain ? filterDataSource({
|
|
7879
|
+
dataArray,
|
|
7880
|
+
toPrimaryKey,
|
|
7881
|
+
filterTypes,
|
|
7882
|
+
operatorsByFilterType,
|
|
7883
|
+
filterFunction,
|
|
7884
|
+
filterValue
|
|
7885
|
+
}) : state.lastFilterDataArray;
|
|
7886
|
+
state.lastFilterDataArray = dataArray;
|
|
7887
|
+
state.filteredAt = now;
|
|
7888
|
+
}
|
|
7889
|
+
state.filteredCount = dataArray.length;
|
|
7890
|
+
state.postFilterDataArray = dataArray;
|
|
7891
|
+
const shouldSortClientSide = shouldSort && state.sortMode === "local";
|
|
7892
|
+
if (shouldSortClientSide) {
|
|
7893
|
+
const prevKnownTypes = multisort.knownTypes;
|
|
7894
|
+
multisort.knownTypes = state.sortTypes;
|
|
7066
7895
|
dataArray = shouldSortAgain ? multisort(sortInfo, [...dataArray]) : state.lastSortDataArray;
|
|
7896
|
+
multisort.knownTypes = prevKnownTypes;
|
|
7067
7897
|
state.lastSortDataArray = dataArray;
|
|
7068
7898
|
state.sortedAt = now;
|
|
7069
7899
|
}
|
|
7070
7900
|
state.postSortDataArray = dataArray;
|
|
7071
|
-
|
|
7072
|
-
const pk = data[state.primaryKey];
|
|
7073
|
-
return pk;
|
|
7074
|
-
};
|
|
7901
|
+
let rowInfoDataArray = state.dataArray;
|
|
7075
7902
|
if (shouldGroup) {
|
|
7076
7903
|
if (shouldGroupAgain) {
|
|
7077
7904
|
const groupResult = state.lazyLoad ? lazyGroup({
|
|
@@ -7114,7 +7941,7 @@ function concludeReducer(params) {
|
|
|
7114
7941
|
state.pivotColumns = void 0;
|
|
7115
7942
|
const arrayDifferentAfterSortStep = previousState.postSortDataArray != state.postSortDataArray;
|
|
7116
7943
|
if (arrayDifferentAfterSortStep || groupsDepsChanged) {
|
|
7117
|
-
rowInfoDataArray = dataArray.map((data, index) => toRowInfo(data, data ? toPrimaryKey(data) : index, index));
|
|
7944
|
+
rowInfoDataArray = dataArray.map((data, index) => toRowInfo(data, data ? toPrimaryKey(data, index) : index, index));
|
|
7118
7945
|
}
|
|
7119
7946
|
}
|
|
7120
7947
|
state.postGroupDataArray = rowInfoDataArray;
|
|
@@ -7142,7 +7969,7 @@ function DataSourceWithContext(props) {
|
|
|
7142
7969
|
if (typeof children === "function") {
|
|
7143
7970
|
children = children(computedValues);
|
|
7144
7971
|
}
|
|
7145
|
-
return /* @__PURE__ */
|
|
7972
|
+
return /* @__PURE__ */ createElement25(Fragment3, null, children);
|
|
7146
7973
|
}
|
|
7147
7974
|
var DataSourceRoot = getComponentStateRoot({
|
|
7148
7975
|
initSetupState,
|
|
@@ -7165,14 +7992,14 @@ function DataSourceCmp({ children }) {
|
|
|
7165
7992
|
globalThis.getDataSourceState = getState;
|
|
7166
7993
|
}
|
|
7167
7994
|
useLoadData();
|
|
7168
|
-
return /* @__PURE__ */
|
|
7995
|
+
return /* @__PURE__ */ createElement25(DataSourceContext.Provider, {
|
|
7169
7996
|
value: contextValue
|
|
7170
|
-
}, /* @__PURE__ */
|
|
7997
|
+
}, /* @__PURE__ */ createElement25(DataSourceWithContext, {
|
|
7171
7998
|
children
|
|
7172
7999
|
}));
|
|
7173
8000
|
}
|
|
7174
8001
|
function DataSource(props) {
|
|
7175
|
-
return /* @__PURE__ */
|
|
8002
|
+
return /* @__PURE__ */ createElement25(DataSourceRoot, __spreadValues({}, props), /* @__PURE__ */ createElement25(DataSourceCmp, {
|
|
7176
8003
|
children: props.children
|
|
7177
8004
|
}));
|
|
7178
8005
|
}
|
|
@@ -7180,7 +8007,7 @@ function DataSource(props) {
|
|
|
7180
8007
|
// src/components/InfiniteTable/hooks/useToggleGroupRow.ts
|
|
7181
8008
|
function useToggleGroupRow() {
|
|
7182
8009
|
const { getState: getDataSourceState, componentActions: dataSourceActions } = useDataSourceContextValue();
|
|
7183
|
-
const toggleGroupRow =
|
|
8010
|
+
const toggleGroupRow = useCallback14((groupKeys) => {
|
|
7184
8011
|
const state = getDataSourceState();
|
|
7185
8012
|
const newState = new GroupRowsState(state.groupRowsState);
|
|
7186
8013
|
newState.toggleGroupRow(groupKeys);
|
|
@@ -7212,7 +8039,7 @@ function useToggleGroupRow() {
|
|
|
7212
8039
|
|
|
7213
8040
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
7214
8041
|
function useGroupByMap(groupBy) {
|
|
7215
|
-
const groupByMap =
|
|
8042
|
+
const groupByMap = useMemo10(() => {
|
|
7216
8043
|
return groupBy.reduce((acc, groupBy2, index) => {
|
|
7217
8044
|
acc.set(groupBy2.field, {
|
|
7218
8045
|
groupBy: groupBy2,
|
|
@@ -7236,13 +8063,13 @@ function useColumnsWhen() {
|
|
|
7236
8063
|
}
|
|
7237
8064
|
} = useComponentState();
|
|
7238
8065
|
const groupByMap = useGroupByMap(groupBy);
|
|
7239
|
-
|
|
8066
|
+
useEffect22(() => {
|
|
7240
8067
|
dataSourceActions.generateGroupRows = groupRenderStrategy !== "inline";
|
|
7241
8068
|
}, [groupRenderStrategy]);
|
|
7242
|
-
|
|
8069
|
+
useEffect22(() => {
|
|
7243
8070
|
dataSourceActions.pivotTotalColumnPosition = pivotTotalColumnPosition;
|
|
7244
8071
|
}, [pivotTotalColumnPosition]);
|
|
7245
|
-
|
|
8072
|
+
useEffect22(() => {
|
|
7246
8073
|
if (pivotGrandTotalColumnPosition != void 0) {
|
|
7247
8074
|
dataSourceActions.pivotGrandTotalColumnPosition = pivotGrandTotalColumnPosition;
|
|
7248
8075
|
}
|
|
@@ -7272,7 +8099,7 @@ function useColumnsWhenInlineGroupRenderStrategy(groupByMap) {
|
|
|
7272
8099
|
base = {
|
|
7273
8100
|
groupByField: field,
|
|
7274
8101
|
field,
|
|
7275
|
-
|
|
8102
|
+
valueFormatter: ({ rowInfo }) => {
|
|
7276
8103
|
var _a;
|
|
7277
8104
|
return rowInfo.isGroupRow ? (_a = rowInfo.groupKeys) == null ? void 0 : _a[groupIndex] : rowInfo.value;
|
|
7278
8105
|
},
|
|
@@ -7316,7 +8143,7 @@ function useColumnsWhenInlineGroupRenderStrategy(groupByMap) {
|
|
|
7316
8143
|
});
|
|
7317
8144
|
return computedColumns.size === 0 ? void 0 : computedColumns;
|
|
7318
8145
|
}
|
|
7319
|
-
|
|
8146
|
+
useEffect22(() => {
|
|
7320
8147
|
const update = () => {
|
|
7321
8148
|
componentActions.columnsWhenInlineGroupRenderStrategy = computeColumnsWhenInlineGroupRenderStrategy(columns, groupByMap, groupRenderStrategy, toggleGroupRow);
|
|
7322
8149
|
};
|
|
@@ -7345,7 +8172,7 @@ function useColumnsWhenGrouping() {
|
|
|
7345
8172
|
}
|
|
7346
8173
|
} = useComponentState();
|
|
7347
8174
|
const toggleGroupRow = useToggleGroupRow();
|
|
7348
|
-
|
|
8175
|
+
useEffect22(() => {
|
|
7349
8176
|
const update = () => {
|
|
7350
8177
|
const columnsWhenGrouping = getColumnsWhenGrouping({
|
|
7351
8178
|
columns,
|
|
@@ -7481,7 +8308,7 @@ function useHideColumns(groupByMap) {
|
|
|
7481
8308
|
hideEmptyGroupColumns ? groupRowsState : null,
|
|
7482
8309
|
hideEmptyGroupColumns
|
|
7483
8310
|
]);
|
|
7484
|
-
|
|
8311
|
+
useEffect22(() => {
|
|
7485
8312
|
const isGrouped = groupBy.length > 0;
|
|
7486
8313
|
const currentState = getComponentState();
|
|
7487
8314
|
const { controlledColumnVisibility, columnVisibility } = currentState;
|
|
@@ -7596,7 +8423,7 @@ function getColumnsWhenGrouping(params) {
|
|
|
7596
8423
|
}
|
|
7597
8424
|
|
|
7598
8425
|
// src/components/InfiniteTable/hooks/useComputedVisibleColumns.ts
|
|
7599
|
-
import { useMemo as
|
|
8426
|
+
import { useMemo as useMemo11 } from "react";
|
|
7600
8427
|
|
|
7601
8428
|
// src/components/flexbox/index.ts
|
|
7602
8429
|
var computeFlex = (params) => {
|
|
@@ -7753,7 +8580,9 @@ var adjustColumnOrderForPinning = (columnOrder, columnPinning) => {
|
|
|
7753
8580
|
};
|
|
7754
8581
|
|
|
7755
8582
|
// src/components/InfiniteTable/utils/getColumnComputedType.ts
|
|
7756
|
-
var emptyType = Object.freeze({
|
|
8583
|
+
var emptyType = Object.freeze({
|
|
8584
|
+
filterType: "string"
|
|
8585
|
+
});
|
|
7757
8586
|
function getColumnComputedType(column, columnTypes) {
|
|
7758
8587
|
const defaultType = columnTypes["default"] || emptyType;
|
|
7759
8588
|
if (column.type === void 0) {
|
|
@@ -7789,6 +8618,7 @@ var getComputedVisibleColumns = ({
|
|
|
7789
8618
|
columnHeaderCssEllipsis,
|
|
7790
8619
|
pinnedStartMaxWidth,
|
|
7791
8620
|
pinnedEndMaxWidth,
|
|
8621
|
+
filterValue,
|
|
7792
8622
|
sortable,
|
|
7793
8623
|
sortInfo,
|
|
7794
8624
|
setSortInfo,
|
|
@@ -7803,9 +8633,19 @@ var getComputedVisibleColumns = ({
|
|
|
7803
8633
|
columnVisibilityAssumeVisible
|
|
7804
8634
|
}) => {
|
|
7805
8635
|
let computedOffset = 0;
|
|
8636
|
+
const filterValueRecord = (filterValue || []).reduce((acc, filterValueItem) => {
|
|
8637
|
+
const { id, field } = filterValueItem;
|
|
8638
|
+
if (field) {
|
|
8639
|
+
acc[field] = filterValueItem;
|
|
8640
|
+
}
|
|
8641
|
+
if (id) {
|
|
8642
|
+
acc[id] = filterValueItem;
|
|
8643
|
+
}
|
|
8644
|
+
return acc;
|
|
8645
|
+
}, {});
|
|
7806
8646
|
const normalizedColumnOrder = adjustColumnOrderForPinning(columnOrder === true ? [...columns.keys()] : columnOrder, columnPinning);
|
|
7807
8647
|
const visibleColumnOrder = normalizedColumnOrder.filter((colId) => {
|
|
7808
|
-
|
|
8648
|
+
const col = columns.get(colId);
|
|
7809
8649
|
if (!col) {
|
|
7810
8650
|
logError(`Column with id "${colId}" specified in columnOrder array cannot be found in the columns map.`);
|
|
7811
8651
|
return false;
|
|
@@ -7853,7 +8693,7 @@ var getComputedVisibleColumns = ({
|
|
|
7853
8693
|
delete colTypeSizing.width;
|
|
7854
8694
|
}
|
|
7855
8695
|
colSizing = assignNonNull(colTypeSizing, colSizing);
|
|
7856
|
-
|
|
8696
|
+
const colFlex = (_a = colSizing.flex) != null ? _a : void 0;
|
|
7857
8697
|
const colMinWidth = (_c = (_b = colSizing.minWidth) != null ? _b : column == null ? void 0 : column.minWidth) != null ? _c : columnMinWidth;
|
|
7858
8698
|
const colMaxWidth = (_e = (_d = colSizing.maxWidth) != null ? _d : column == null ? void 0 : column.maxWidth) != null ? _e : columnMaxWidth;
|
|
7859
8699
|
let size = colFlex != void 0 ? void 0 : (_f = colSizing.width) != null ? _f : columnDefaultWidth;
|
|
@@ -7896,7 +8736,7 @@ var getComputedVisibleColumns = ({
|
|
|
7896
8736
|
});
|
|
7897
8737
|
const firstPinnedEndAbsoluteOffset = bodySize.width - totalPinnedEndWidth;
|
|
7898
8738
|
columnsArray.forEach((c, i) => {
|
|
7899
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
|
|
8739
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
|
|
7900
8740
|
const id = visibleColumnOrder[i];
|
|
7901
8741
|
const nextColumnId = visibleColumnOrder[i + 1];
|
|
7902
8742
|
const colType = getColumnComputedType(c, columnTypes);
|
|
@@ -7907,47 +8747,6 @@ var getComputedVisibleColumns = ({
|
|
|
7907
8747
|
const computedSortedDesc = computedSorted && !computedSortedAsc;
|
|
7908
8748
|
const computedSortIndex = (_c = sortingInfo == null ? void 0 : sortingInfo.index) != null ? _c : -1;
|
|
7909
8749
|
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
8750
|
const computedPinned = getComputedPinned(id, columnPinning);
|
|
7952
8751
|
const computedLast = i === visibleColumnOrder.length - 1;
|
|
7953
8752
|
const computedPinningOffset = computedPinned === "start" ? computedPinnedStartColumnsWidth : computedPinned === "end" ? computedPinnedEndColumnsWidth : computedOffset - computedPinnedStartColumnsWidth;
|
|
@@ -7956,23 +8755,46 @@ var getComputedVisibleColumns = ({
|
|
|
7956
8755
|
const computedLastInCategory = computedLast || computedPinned !== getComputedPinned(nextColumnId, columnPinning);
|
|
7957
8756
|
const cssEllipsis = (_e = (_d = c.cssEllipsis) != null ? _d : colType.cssEllipsis) != null ? _e : columnCssEllipsis;
|
|
7958
8757
|
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;
|
|
8758
|
+
const computedFilterValue = filterValueRecord[id] || c.field ? filterValueRecord[c.field] || null : null;
|
|
8759
|
+
const computedFiltered = computedFilterValue != null;
|
|
8760
|
+
const computedFilterable = (_l = (_k = c.defaultFilterable) != null ? _k : colType.defaultFilterable) != null ? _l : true;
|
|
8761
|
+
const computedDataType = c.dataType || colType.dataType || (Array.isArray(c.type) ? c.type[0] : c.type) || "string";
|
|
8762
|
+
const computedSortType = c.sortType || colType.sortType || computedDataType;
|
|
8763
|
+
const computedFilterType = c.filterType || colType.filterType || computedDataType;
|
|
8764
|
+
const field = (_m = c.field) != null ? _m : colType.field;
|
|
8765
|
+
const valueGetter = (_n = c.valueGetter) != null ? _n : colType.valueGetter;
|
|
8766
|
+
let sortableColumnOrType = (_o = c.sortable) != null ? _o : colType.sortable;
|
|
8767
|
+
if (sortableColumnOrType == null) {
|
|
8768
|
+
if (field == null && valueGetter == null) {
|
|
8769
|
+
sortableColumnOrType = false;
|
|
8770
|
+
}
|
|
8771
|
+
}
|
|
8772
|
+
let computedSortable = (_p = sortableColumnOrType != null ? sortableColumnOrType : sortable) != null ? _p : true;
|
|
7959
8773
|
const result2 = __spreadProps(__spreadValues({
|
|
7960
8774
|
align: colType.align,
|
|
7961
8775
|
verticalAlign: colType.verticalAlign,
|
|
7962
8776
|
defaultHiddenWhenGroupedBy: colType.defaultHiddenWhenGroupedBy,
|
|
7963
|
-
valueGetter
|
|
8777
|
+
valueGetter,
|
|
8778
|
+
valueFormatter: colType.valueFormatter,
|
|
7964
8779
|
renderValue: colType.renderValue,
|
|
7965
8780
|
render: colType.render,
|
|
7966
8781
|
style: colType.style,
|
|
7967
|
-
components: colType.components
|
|
8782
|
+
components: colType.components,
|
|
8783
|
+
field
|
|
7968
8784
|
}, c), {
|
|
8785
|
+
computedDataType,
|
|
8786
|
+
computedSortType,
|
|
8787
|
+
computedFilterType,
|
|
7969
8788
|
cssEllipsis,
|
|
7970
8789
|
headerCssEllipsis,
|
|
8790
|
+
computedFilterValue,
|
|
8791
|
+
computedFiltered,
|
|
8792
|
+
computedFilterable,
|
|
7971
8793
|
computedWidth,
|
|
7972
8794
|
computedAbsoluteOffset,
|
|
7973
8795
|
computedPinningOffset,
|
|
7974
8796
|
computedOffset,
|
|
7975
|
-
computedSortable
|
|
8797
|
+
computedSortable,
|
|
7976
8798
|
computedSortInfo,
|
|
7977
8799
|
computedSortIndex,
|
|
7978
8800
|
computedMultiSort: multiSort,
|
|
@@ -7981,14 +8803,57 @@ var getComputedVisibleColumns = ({
|
|
|
7981
8803
|
computedSortedDesc,
|
|
7982
8804
|
computedVisibleIndex: i,
|
|
7983
8805
|
computedPinned,
|
|
7984
|
-
computedDraggable: (
|
|
8806
|
+
computedDraggable: (_r = (_q = c.draggable) != null ? _q : draggableColumns) != null ? _r : true,
|
|
7985
8807
|
computedFirstInCategory,
|
|
7986
8808
|
computedLastInCategory,
|
|
7987
8809
|
computedFirst: i === 0,
|
|
7988
8810
|
computedLast,
|
|
7989
|
-
toggleSort
|
|
8811
|
+
toggleSort: () => {
|
|
8812
|
+
const currentSortInfo = computedSortInfo;
|
|
8813
|
+
let newColumnSortInfo;
|
|
8814
|
+
if (!currentSortInfo) {
|
|
8815
|
+
newColumnSortInfo = {
|
|
8816
|
+
dir: 1,
|
|
8817
|
+
id,
|
|
8818
|
+
field: c.field,
|
|
8819
|
+
type: computedSortType
|
|
8820
|
+
};
|
|
8821
|
+
} else {
|
|
8822
|
+
if (computedSortedDesc) {
|
|
8823
|
+
newColumnSortInfo = null;
|
|
8824
|
+
} else {
|
|
8825
|
+
newColumnSortInfo = __spreadProps(__spreadValues({}, computedSortInfo), {
|
|
8826
|
+
dir: -1
|
|
8827
|
+
});
|
|
8828
|
+
}
|
|
8829
|
+
}
|
|
8830
|
+
if (c.field && newColumnSortInfo && !newColumnSortInfo.field) {
|
|
8831
|
+
newColumnSortInfo.field = c.field;
|
|
8832
|
+
}
|
|
8833
|
+
if (c.valueGetter && newColumnSortInfo && !newColumnSortInfo.valueGetter) {
|
|
8834
|
+
newColumnSortInfo.valueGetter = (data) => c.valueGetter({ data, field: c.field });
|
|
8835
|
+
}
|
|
8836
|
+
let finalSortInfo = sortInfo ? [...sortInfo] : [];
|
|
8837
|
+
if (multiSort) {
|
|
8838
|
+
if (computedSortIndex === -1) {
|
|
8839
|
+
if (newColumnSortInfo) {
|
|
8840
|
+
finalSortInfo.push(newColumnSortInfo);
|
|
8841
|
+
}
|
|
8842
|
+
} else {
|
|
8843
|
+
finalSortInfo = finalSortInfo.map((info, index) => {
|
|
8844
|
+
if (index === computedSortIndex) {
|
|
8845
|
+
return newColumnSortInfo;
|
|
8846
|
+
}
|
|
8847
|
+
return info;
|
|
8848
|
+
}).filter((x) => x != null);
|
|
8849
|
+
}
|
|
8850
|
+
} else {
|
|
8851
|
+
finalSortInfo = newColumnSortInfo ? [newColumnSortInfo] : [];
|
|
8852
|
+
}
|
|
8853
|
+
setSortInfo(finalSortInfo);
|
|
8854
|
+
},
|
|
7990
8855
|
id,
|
|
7991
|
-
header: (
|
|
8856
|
+
header: (_u = (_t = (_s = c.header) != null ? _s : colType.header) != null ? _t : c.name) != null ? _u : c.field
|
|
7992
8857
|
});
|
|
7993
8858
|
computedOffset += computedWidth;
|
|
7994
8859
|
computedVisibleColumnsMap.set(result2.id, result2);
|
|
@@ -8029,10 +8894,10 @@ var getComputedVisibleColumns = ({
|
|
|
8029
8894
|
};
|
|
8030
8895
|
|
|
8031
8896
|
// src/components/InfiniteTable/hooks/useRerenderOnKeyChange.ts
|
|
8032
|
-
import { useEffect as
|
|
8897
|
+
import { useEffect as useEffect23 } from "react";
|
|
8033
8898
|
var useRerenderOnKeyChange = (map2) => {
|
|
8034
8899
|
const [renderId, rerender] = useRerender();
|
|
8035
|
-
|
|
8900
|
+
useEffect23(() => {
|
|
8036
8901
|
const update = rafFn(rerender);
|
|
8037
8902
|
return interceptMap(map2, {
|
|
8038
8903
|
set: update,
|
|
@@ -8057,6 +8922,7 @@ var useComputedVisibleColumns = ({
|
|
|
8057
8922
|
sortInfo,
|
|
8058
8923
|
multiSort,
|
|
8059
8924
|
setSortInfo,
|
|
8925
|
+
filterValue,
|
|
8060
8926
|
columnOrder,
|
|
8061
8927
|
columnPinning,
|
|
8062
8928
|
columnTypes,
|
|
@@ -8084,7 +8950,7 @@ var useComputedVisibleColumns = ({
|
|
|
8084
8950
|
computedPinnedEndOffset,
|
|
8085
8951
|
computedPinnedEndWidth,
|
|
8086
8952
|
computedPinnedStartWidth
|
|
8087
|
-
} =
|
|
8953
|
+
} = useMemo11(() => {
|
|
8088
8954
|
return getComputedVisibleColumns({
|
|
8089
8955
|
columns,
|
|
8090
8956
|
bodySize,
|
|
@@ -8094,6 +8960,7 @@ var useComputedVisibleColumns = ({
|
|
|
8094
8960
|
columnCssEllipsis,
|
|
8095
8961
|
columnHeaderCssEllipsis,
|
|
8096
8962
|
viewportReservedWidth,
|
|
8963
|
+
filterValue,
|
|
8097
8964
|
sortable,
|
|
8098
8965
|
sortInfo,
|
|
8099
8966
|
setSortInfo,
|
|
@@ -8118,6 +8985,7 @@ var useComputedVisibleColumns = ({
|
|
|
8118
8985
|
sortInfo,
|
|
8119
8986
|
setSortInfo,
|
|
8120
8987
|
multiSort,
|
|
8988
|
+
filterValue,
|
|
8121
8989
|
columnOrder,
|
|
8122
8990
|
columnVisibility,
|
|
8123
8991
|
columnVisibilityAssumeVisible,
|
|
@@ -8150,7 +9018,7 @@ var useComputedVisibleColumns = ({
|
|
|
8150
9018
|
};
|
|
8151
9019
|
|
|
8152
9020
|
// src/components/InfiniteTable/hooks/useScrollbars.ts
|
|
8153
|
-
import { useState as
|
|
9021
|
+
import { useState as useState13, useEffect as useEffect24, useLayoutEffect as useLayoutEffect6 } from "react";
|
|
8154
9022
|
var INITIAL_SCROLLBARS = {
|
|
8155
9023
|
vertical: false,
|
|
8156
9024
|
horizontal: false
|
|
@@ -8158,8 +9026,8 @@ var INITIAL_SCROLLBARS = {
|
|
|
8158
9026
|
function useScrollbars(brain) {
|
|
8159
9027
|
const { getComponentState: getInfiniteTableState } = useComponentState();
|
|
8160
9028
|
const { getState: getDataSourceState } = useDataSourceContextValue();
|
|
8161
|
-
const [scrollbars, setScrollbars] =
|
|
8162
|
-
|
|
9029
|
+
const [scrollbars, setScrollbars] = useState13(INITIAL_SCROLLBARS);
|
|
9030
|
+
useEffect24(() => {
|
|
8163
9031
|
return brain.onRenderCountChange(() => {
|
|
8164
9032
|
const { scrollTopMax, scrollLeftMax } = brain;
|
|
8165
9033
|
setScrollbars({
|
|
@@ -8168,7 +9036,7 @@ function useScrollbars(brain) {
|
|
|
8168
9036
|
});
|
|
8169
9037
|
});
|
|
8170
9038
|
}, [brain]);
|
|
8171
|
-
|
|
9039
|
+
useLayoutEffect6(() => {
|
|
8172
9040
|
const dataSourceState = getDataSourceState();
|
|
8173
9041
|
const { onScrollbarsChange } = getInfiniteTableState();
|
|
8174
9042
|
const { notifyScrollbarsChange } = dataSourceState;
|
|
@@ -8199,27 +9067,27 @@ function useComputed() {
|
|
|
8199
9067
|
bodySize,
|
|
8200
9068
|
showSeparatePivotColumnForSingleAggregation
|
|
8201
9069
|
} = componentState;
|
|
8202
|
-
|
|
9070
|
+
useState14(() => {
|
|
8203
9071
|
componentState.onRowHeightCSSVarChange.onChange((rowHeight) => {
|
|
8204
9072
|
if (rowHeight) {
|
|
8205
9073
|
componentActions.rowHeight = rowHeight;
|
|
8206
9074
|
}
|
|
8207
9075
|
});
|
|
8208
|
-
componentState.
|
|
8209
|
-
if (
|
|
8210
|
-
componentActions.
|
|
9076
|
+
componentState.onColumnHeaderHeightCSSVarChange.onChange((columnHeaderHeight) => {
|
|
9077
|
+
if (columnHeaderHeight) {
|
|
9078
|
+
componentActions.columnHeaderHeight = columnHeaderHeight;
|
|
8211
9079
|
}
|
|
8212
9080
|
});
|
|
8213
9081
|
});
|
|
8214
|
-
|
|
9082
|
+
useEffect25(() => {
|
|
8215
9083
|
dataSourceActions.showSeparatePivotColumnForSingleAggregation = showSeparatePivotColumnForSingleAggregation;
|
|
8216
9084
|
}, [showSeparatePivotColumnForSingleAggregation]);
|
|
8217
|
-
const { multiSort } = dataSourceState;
|
|
9085
|
+
const { multiSort, filterValue } = dataSourceState;
|
|
8218
9086
|
useColumnGroups();
|
|
8219
9087
|
const { toggleGroupRow } = useColumnsWhen();
|
|
8220
|
-
const setSortInfo =
|
|
9088
|
+
const setSortInfo = useCallback15((sortInfo) => {
|
|
8221
9089
|
var _a2;
|
|
8222
|
-
const newSortInfo = multiSort ? sortInfo : (_a2 = sortInfo[0]) != null ? _a2 : null;
|
|
9090
|
+
const newSortInfo = getDataSourceState().multiSort ? sortInfo : (_a2 = sortInfo[0]) != null ? _a2 : null;
|
|
8223
9091
|
dataSourceActions.sortInfo = newSortInfo;
|
|
8224
9092
|
}, [getDataSourceState]);
|
|
8225
9093
|
const columns = componentState.computedColumns;
|
|
@@ -8258,6 +9126,7 @@ function useComputed() {
|
|
|
8258
9126
|
columnVisibility,
|
|
8259
9127
|
columnVisibilityAssumeVisible: true,
|
|
8260
9128
|
columnPinning,
|
|
9129
|
+
filterValue,
|
|
8261
9130
|
columnSizing,
|
|
8262
9131
|
columnTypes
|
|
8263
9132
|
});
|
|
@@ -8267,6 +9136,7 @@ function useComputed() {
|
|
|
8267
9136
|
const computedPinnedStartOverflow = computedPinnedStartWidth ? computedPinnedStartColumnsWidth > computedPinnedStartWidth : false;
|
|
8268
9137
|
const computedPinnedEndOverflow = computedPinnedEndWidth ? computedPinnedEndColumnsWidth > computedPinnedEndWidth : false;
|
|
8269
9138
|
return {
|
|
9139
|
+
showColumnFilters: !!dataSourceState.filterValue,
|
|
8270
9140
|
scrollbars,
|
|
8271
9141
|
columnSize,
|
|
8272
9142
|
rowspan,
|
|
@@ -8374,7 +9244,7 @@ function useDOMProps(initialDOMProps) {
|
|
|
8374
9244
|
}
|
|
8375
9245
|
|
|
8376
9246
|
// src/components/InfiniteTable/hooks/useLicense/useLicense.ts
|
|
8377
|
-
import { useMemo as
|
|
9247
|
+
import { useMemo as useMemo12 } from "react";
|
|
8378
9248
|
|
|
8379
9249
|
// src/components/InfiniteTable/hooks/useLicense/crc32.ts
|
|
8380
9250
|
var DEFAULT_ReversedPolynomial = 3988292384;
|
|
@@ -8532,10 +9402,10 @@ var isInsideSandbox = () => {
|
|
|
8532
9402
|
};
|
|
8533
9403
|
var isInsidePlayground = isInsideSandbox() || isInsideSandpack();
|
|
8534
9404
|
var useLicense = (licenseKey = "") => {
|
|
8535
|
-
const valid =
|
|
9405
|
+
const valid = useMemo12(() => {
|
|
8536
9406
|
let valid2 = isValidLicense(licenseKey, {
|
|
8537
9407
|
publishedAt: 1624970570587,
|
|
8538
|
-
version: "0.3.
|
|
9408
|
+
version: "0.3.5"
|
|
8539
9409
|
});
|
|
8540
9410
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
8541
9411
|
return true;
|
|
@@ -8545,6 +9415,140 @@ var useLicense = (licenseKey = "") => {
|
|
|
8545
9415
|
return valid;
|
|
8546
9416
|
};
|
|
8547
9417
|
|
|
9418
|
+
// src/components/utils/clamp.ts
|
|
9419
|
+
function clamp(value, min, max) {
|
|
9420
|
+
return Math.min(Math.max(value, min), max);
|
|
9421
|
+
}
|
|
9422
|
+
|
|
9423
|
+
// src/components/InfiniteTable/keyboardNavigationAndSelection.ts
|
|
9424
|
+
function handleRowNavigation(options) {
|
|
9425
|
+
const { key, getState, getDataSourceState, actions } = options;
|
|
9426
|
+
const arrLength = getDataSourceState().dataArray.length;
|
|
9427
|
+
const state = getState();
|
|
9428
|
+
const { brain } = state;
|
|
9429
|
+
let { activeRowIndex } = state;
|
|
9430
|
+
if (activeRowIndex == null) {
|
|
9431
|
+
return false;
|
|
9432
|
+
}
|
|
9433
|
+
const {
|
|
9434
|
+
start: [startRow],
|
|
9435
|
+
end: [endRow]
|
|
9436
|
+
} = brain.getRenderRange();
|
|
9437
|
+
const renderRowCount = endRow - startRow - 1;
|
|
9438
|
+
const min = 0;
|
|
9439
|
+
const max = arrLength - 1;
|
|
9440
|
+
const KeyToFunction = {
|
|
9441
|
+
ArrowDown: () => {
|
|
9442
|
+
activeRowIndex = clamp(activeRowIndex + 1, min, max);
|
|
9443
|
+
},
|
|
9444
|
+
ArrowUp: () => {
|
|
9445
|
+
activeRowIndex = clamp(activeRowIndex - 1, min, max);
|
|
9446
|
+
},
|
|
9447
|
+
PageDown: () => {
|
|
9448
|
+
activeRowIndex = Math.min(activeRowIndex + renderRowCount, arrLength - 1);
|
|
9449
|
+
},
|
|
9450
|
+
PageUp: () => {
|
|
9451
|
+
activeRowIndex = Math.max(activeRowIndex - renderRowCount, min);
|
|
9452
|
+
},
|
|
9453
|
+
End: () => {
|
|
9454
|
+
activeRowIndex = max;
|
|
9455
|
+
},
|
|
9456
|
+
Home: () => {
|
|
9457
|
+
activeRowIndex = min;
|
|
9458
|
+
}
|
|
9459
|
+
};
|
|
9460
|
+
const Fn = KeyToFunction[key];
|
|
9461
|
+
if (!Fn) {
|
|
9462
|
+
return false;
|
|
9463
|
+
}
|
|
9464
|
+
Fn();
|
|
9465
|
+
actions.activeRowIndex = activeRowIndex;
|
|
9466
|
+
return true;
|
|
9467
|
+
}
|
|
9468
|
+
function handleCellNavigation(options) {
|
|
9469
|
+
const { key, shiftKey, getState, getComputed, getDataSourceState, actions } = options;
|
|
9470
|
+
const state = getState();
|
|
9471
|
+
const { activeCellIndex, brain } = state;
|
|
9472
|
+
if (!activeCellIndex) {
|
|
9473
|
+
return false;
|
|
9474
|
+
}
|
|
9475
|
+
let [rowIndex, colIndex] = activeCellIndex;
|
|
9476
|
+
const {
|
|
9477
|
+
start: [startRow, startCol],
|
|
9478
|
+
end: [endRow, endCol]
|
|
9479
|
+
} = brain.getRenderRange();
|
|
9480
|
+
const renderRowCount = endRow - startRow - 1;
|
|
9481
|
+
const renderColCount = endCol - startCol - 1;
|
|
9482
|
+
const maxRow = getDataSourceState().dataArray.length - 1;
|
|
9483
|
+
const maxCol = getComputed().computedVisibleColumns.length - 1;
|
|
9484
|
+
const minRow = 0;
|
|
9485
|
+
const minCol = 0;
|
|
9486
|
+
rowIndex = clamp(rowIndex, 0, maxRow);
|
|
9487
|
+
colIndex = clamp(colIndex, 0, maxCol);
|
|
9488
|
+
actions.activeCellIndex = [rowIndex, colIndex];
|
|
9489
|
+
const KeyToFunction = {
|
|
9490
|
+
ArrowDown: () => {
|
|
9491
|
+
rowIndex = clamp(rowIndex + 1, minRow, maxRow);
|
|
9492
|
+
},
|
|
9493
|
+
ArrowUp: () => {
|
|
9494
|
+
rowIndex = clamp(rowIndex - 1, minRow, maxRow);
|
|
9495
|
+
},
|
|
9496
|
+
ArrowLeft: () => {
|
|
9497
|
+
colIndex = clamp(colIndex - 1, minCol, maxCol);
|
|
9498
|
+
},
|
|
9499
|
+
ArrowRight: () => {
|
|
9500
|
+
colIndex = clamp(colIndex + 1, minCol, maxCol);
|
|
9501
|
+
},
|
|
9502
|
+
PageDown: () => {
|
|
9503
|
+
if (!shiftKey) {
|
|
9504
|
+
rowIndex = Math.min(rowIndex + renderRowCount, maxRow);
|
|
9505
|
+
} else {
|
|
9506
|
+
colIndex = Math.min(colIndex + renderColCount, maxCol);
|
|
9507
|
+
}
|
|
9508
|
+
},
|
|
9509
|
+
PageUp: () => {
|
|
9510
|
+
if (!shiftKey) {
|
|
9511
|
+
rowIndex = Math.max(rowIndex - renderRowCount, minRow);
|
|
9512
|
+
} else {
|
|
9513
|
+
colIndex = Math.max(colIndex - renderColCount, minCol);
|
|
9514
|
+
}
|
|
9515
|
+
},
|
|
9516
|
+
End: () => {
|
|
9517
|
+
if (!shiftKey) {
|
|
9518
|
+
rowIndex = maxRow;
|
|
9519
|
+
} else {
|
|
9520
|
+
colIndex = maxCol;
|
|
9521
|
+
}
|
|
9522
|
+
},
|
|
9523
|
+
Home: () => {
|
|
9524
|
+
if (!shiftKey) {
|
|
9525
|
+
rowIndex = minRow;
|
|
9526
|
+
} else {
|
|
9527
|
+
colIndex = minCol;
|
|
9528
|
+
}
|
|
9529
|
+
}
|
|
9530
|
+
};
|
|
9531
|
+
const Fn = KeyToFunction[key];
|
|
9532
|
+
if (!Fn) {
|
|
9533
|
+
return false;
|
|
9534
|
+
}
|
|
9535
|
+
Fn();
|
|
9536
|
+
actions.activeCellIndex = [rowIndex, colIndex];
|
|
9537
|
+
return true;
|
|
9538
|
+
}
|
|
9539
|
+
function handleKeyboardNavigation(options) {
|
|
9540
|
+
const { getState } = options;
|
|
9541
|
+
const state = getState();
|
|
9542
|
+
const { activeRowIndex, activeCellIndex, keyboardNavigation } = state;
|
|
9543
|
+
if (activeRowIndex != null && keyboardNavigation === "row") {
|
|
9544
|
+
return handleRowNavigation(options);
|
|
9545
|
+
}
|
|
9546
|
+
if (activeCellIndex != null && keyboardNavigation === "cell") {
|
|
9547
|
+
return handleCellNavigation(options);
|
|
9548
|
+
}
|
|
9549
|
+
return false;
|
|
9550
|
+
}
|
|
9551
|
+
|
|
8548
9552
|
// src/components/InfiniteTable/state/getInitialState.ts
|
|
8549
9553
|
import { createRef } from "react";
|
|
8550
9554
|
|
|
@@ -8602,6 +9606,18 @@ function toMap(mapOrObject, weakMapCache) {
|
|
|
8602
9606
|
}
|
|
8603
9607
|
|
|
8604
9608
|
// src/components/InfiniteTable/state/getInitialState.ts
|
|
9609
|
+
function createRenderer2(brain) {
|
|
9610
|
+
const renderer = new ReactHeadlessTableRenderer(brain);
|
|
9611
|
+
const onRenderUpdater = buildSubscriptionCallback();
|
|
9612
|
+
brain.onDestroy(() => {
|
|
9613
|
+
renderer.destroy();
|
|
9614
|
+
onRenderUpdater.destroy();
|
|
9615
|
+
});
|
|
9616
|
+
return {
|
|
9617
|
+
renderer,
|
|
9618
|
+
onRenderUpdater
|
|
9619
|
+
};
|
|
9620
|
+
}
|
|
8605
9621
|
function initSetupState2() {
|
|
8606
9622
|
const columnsGeneratedForGrouping = new Map();
|
|
8607
9623
|
const brain = new MatrixBrain();
|
|
@@ -8615,10 +9631,16 @@ function initSetupState2() {
|
|
|
8615
9631
|
if (true) {
|
|
8616
9632
|
globalThis.brain = brain;
|
|
8617
9633
|
}
|
|
9634
|
+
const { renderer, onRenderUpdater } = createRenderer2(brain);
|
|
8618
9635
|
brain.onAvailableSizeChange((size) => {
|
|
8619
9636
|
headerBrain.setAvailableSize({ width: size.width });
|
|
8620
9637
|
});
|
|
9638
|
+
if (true) {
|
|
9639
|
+
globalThis.renderer = renderer;
|
|
9640
|
+
}
|
|
8621
9641
|
return {
|
|
9642
|
+
renderer,
|
|
9643
|
+
onRenderUpdater,
|
|
8622
9644
|
propsCache: new Map([]),
|
|
8623
9645
|
brain,
|
|
8624
9646
|
headerBrain,
|
|
@@ -8627,7 +9649,7 @@ function initSetupState2() {
|
|
|
8627
9649
|
scrollerDOMRef: createRef(),
|
|
8628
9650
|
portalDOMRef: createRef(),
|
|
8629
9651
|
onRowHeightCSSVarChange: buildSubscriptionCallback(),
|
|
8630
|
-
|
|
9652
|
+
onColumnHeaderHeightCSSVarChange: buildSubscriptionCallback(),
|
|
8631
9653
|
bodySize: {
|
|
8632
9654
|
width: 0,
|
|
8633
9655
|
height: 0
|
|
@@ -8677,26 +9699,32 @@ var forwardProps3 = (setupState) => {
|
|
|
8677
9699
|
onScrollbarsChange: 1,
|
|
8678
9700
|
autoSizeColumnsKey: 1,
|
|
8679
9701
|
scrollStopDelay: (scrollStopDelay) => scrollStopDelay != null ? scrollStopDelay : 250,
|
|
9702
|
+
filterEditors: (filterEditors) => __spreadValues(__spreadValues({}, defaultFilterEditors), filterEditors),
|
|
8680
9703
|
viewportReservedWidth: (viewportReservedWidth) => viewportReservedWidth != null ? viewportReservedWidth : 0,
|
|
8681
|
-
activeIndex: (activeIndex) => activeIndex != null ? activeIndex : 0,
|
|
8682
9704
|
columnMinWidth: (columnMinWidth) => columnMinWidth != null ? columnMinWidth : 30,
|
|
8683
9705
|
columnMaxWidth: (columnMaxWidth) => columnMaxWidth != null ? columnMaxWidth : 2e3,
|
|
8684
9706
|
columnDefaultWidth: (columnDefaultWidth) => columnDefaultWidth != null ? columnDefaultWidth : 200,
|
|
8685
9707
|
columnCssEllipsis: (columnCssEllipsis) => columnCssEllipsis != null ? columnCssEllipsis : true,
|
|
8686
9708
|
draggableColumns: (draggableColumns) => draggableColumns != null ? draggableColumns : true,
|
|
9709
|
+
headerOptions: (headerOptions) => __spreadValues({
|
|
9710
|
+
alwaysReserveSpaceForSortIcon: true
|
|
9711
|
+
}, headerOptions),
|
|
8687
9712
|
showSeparatePivotColumnForSingleAggregation: (showSeparatePivotColumnForSingleAggregation) => showSeparatePivotColumnForSingleAggregation != null ? showSeparatePivotColumnForSingleAggregation : false,
|
|
8688
9713
|
sortable: (sortable) => sortable != null ? sortable : true,
|
|
8689
9714
|
hideEmptyGroupColumns: (hideEmptyGroupColumns) => hideEmptyGroupColumns != null ? hideEmptyGroupColumns : false,
|
|
8690
9715
|
pivotTotalColumnPosition: (pivotTotalColumnPosition) => pivotTotalColumnPosition != null ? pivotTotalColumnPosition : "end",
|
|
8691
9716
|
pivotGrandTotalColumnPosition: 1,
|
|
8692
9717
|
licenseKey: (licenseKey) => licenseKey || "",
|
|
9718
|
+
keyboardNavigation: (keyboardNavigation) => keyboardNavigation || "cell",
|
|
9719
|
+
activeRowIndex: 1,
|
|
9720
|
+
activeCellIndex: 1,
|
|
8693
9721
|
columnOrder: (columnOrder) => columnOrder != null ? columnOrder : true,
|
|
8694
9722
|
header: (header) => header != null ? header : true,
|
|
8695
9723
|
showZebraRows: (showZebraRows) => showZebraRows != null ? showZebraRows : true,
|
|
8696
9724
|
showHoverRows: (showHoverRows) => showHoverRows != null ? showHoverRows : true,
|
|
8697
9725
|
virtualizeColumns: (virtualizeColumns) => virtualizeColumns != null ? virtualizeColumns : true,
|
|
8698
9726
|
rowHeight: (rowHeight) => typeof rowHeight === "number" ? rowHeight : 0,
|
|
8699
|
-
|
|
9727
|
+
columnHeaderHeight: (columnHeaderHeight) => typeof columnHeaderHeight === "number" ? columnHeaderHeight : 30,
|
|
8700
9728
|
columns: (columns) => toMap(columns, setupState.propsCache.get("columns")),
|
|
8701
9729
|
columnVisibility: (columnVisibility) => columnVisibility != null ? columnVisibility : {},
|
|
8702
9730
|
columnPinning: (columnPinning) => toMap(columnPinning, setupState.propsCache.get("columnPinning")),
|
|
@@ -8742,7 +9770,7 @@ var mapPropsToState2 = (params) => {
|
|
|
8742
9770
|
columnGroupsMaxDepth: columnGroupsDepthsMap != state.columnGroupsDepthsMap ? Math.max(...columnGroupsDepthsMap.values(), 0) : state.columnGroupsMaxDepth,
|
|
8743
9771
|
computedColumnGroups,
|
|
8744
9772
|
rowHeightCSSVar: typeof props.rowHeight === "string" ? props.rowHeight : "",
|
|
8745
|
-
|
|
9773
|
+
columnHeaderHeightCSSVar: typeof props.columnHeaderHeight === "string" ? props.columnHeaderHeight || ThemeVars.components.Header.columnHeaderHeight : ""
|
|
8746
9774
|
};
|
|
8747
9775
|
};
|
|
8748
9776
|
|
|
@@ -8755,19 +9783,28 @@ var InfiniteTableRoot = getComponentStateRoot({
|
|
|
8755
9783
|
mapPropsToState: mapPropsToState2,
|
|
8756
9784
|
allowedControlledPropOverrides: {
|
|
8757
9785
|
rowHeight: true,
|
|
8758
|
-
|
|
9786
|
+
columnHeaderHeight: true
|
|
8759
9787
|
},
|
|
8760
9788
|
getParentState: () => useDataSource(),
|
|
8761
9789
|
debugName: "InfiniteTable"
|
|
8762
9790
|
});
|
|
8763
|
-
var InfiniteTableComponent =
|
|
9791
|
+
var InfiniteTableComponent = memo11(function InfiniteTableComponent2() {
|
|
8764
9792
|
var _a;
|
|
8765
|
-
const {
|
|
9793
|
+
const {
|
|
9794
|
+
componentState,
|
|
9795
|
+
getComputed,
|
|
9796
|
+
computed,
|
|
9797
|
+
componentActions: actions,
|
|
9798
|
+
getState
|
|
9799
|
+
} = useInfiniteTable();
|
|
8766
9800
|
const {
|
|
8767
9801
|
componentState: { loading },
|
|
8768
9802
|
getState: getDataSourceState,
|
|
8769
9803
|
componentActions: dataSourceActions
|
|
8770
9804
|
} = useDataSourceContextValue();
|
|
9805
|
+
const [imperativeApi] = useState15(() => {
|
|
9806
|
+
return getImperativeApi(getState, getComputed, getDataSourceState, actions);
|
|
9807
|
+
});
|
|
8771
9808
|
const {
|
|
8772
9809
|
domRef,
|
|
8773
9810
|
scrollerDOMRef,
|
|
@@ -8776,24 +9813,44 @@ var InfiniteTableComponent = memo9(function InfiniteTableComponent2() {
|
|
|
8776
9813
|
loadingText,
|
|
8777
9814
|
header,
|
|
8778
9815
|
onRowHeightCSSVarChange,
|
|
8779
|
-
|
|
9816
|
+
onColumnHeaderHeightCSSVarChange,
|
|
8780
9817
|
rowHeightCSSVar,
|
|
8781
|
-
|
|
9818
|
+
columnHeaderHeightCSSVar,
|
|
8782
9819
|
components,
|
|
8783
9820
|
scrollStopDelay,
|
|
8784
9821
|
brain,
|
|
8785
|
-
headerBrain
|
|
9822
|
+
headerBrain,
|
|
9823
|
+
renderer,
|
|
9824
|
+
keyboardNavigation,
|
|
9825
|
+
activeRowIndex,
|
|
9826
|
+
activeCellIndex,
|
|
9827
|
+
onRenderUpdater
|
|
8786
9828
|
} = componentState;
|
|
9829
|
+
useEffect27(() => {
|
|
9830
|
+
if (activeRowIndex != null) {
|
|
9831
|
+
imperativeApi.scrollRowIntoView(activeRowIndex, {
|
|
9832
|
+
offset: 30
|
|
9833
|
+
});
|
|
9834
|
+
}
|
|
9835
|
+
}, [activeRowIndex]);
|
|
9836
|
+
useEffect27(() => {
|
|
9837
|
+
if (activeCellIndex != null) {
|
|
9838
|
+
imperativeApi.scrollCellIntoView(activeCellIndex[0], activeCellIndex[1], {
|
|
9839
|
+
offset: 30
|
|
9840
|
+
});
|
|
9841
|
+
}
|
|
9842
|
+
}, [activeCellIndex]);
|
|
8787
9843
|
const { columnShifts, bodySize } = componentState;
|
|
8788
9844
|
const { scrollbars } = computed;
|
|
8789
9845
|
const { renderCell } = useCellRendering({
|
|
9846
|
+
imperativeApi,
|
|
8790
9847
|
getComputed,
|
|
8791
9848
|
domRef: componentState.domRef,
|
|
8792
9849
|
columnShifts,
|
|
8793
9850
|
bodySize,
|
|
8794
9851
|
computed
|
|
8795
9852
|
});
|
|
8796
|
-
|
|
9853
|
+
useEffect26(() => {
|
|
8797
9854
|
const dataSourceState = getDataSourceState();
|
|
8798
9855
|
const onChange = debounce((renderRange) => {
|
|
8799
9856
|
dataSourceState.notifyRenderRangeChange({
|
|
@@ -8806,35 +9863,52 @@ var InfiniteTableComponent = memo9(function InfiniteTableComponent2() {
|
|
|
8806
9863
|
const licenseValid = useLicense(licenseKey);
|
|
8807
9864
|
const domProps = useDOMProps(componentState.domProps);
|
|
8808
9865
|
const LoadMaskCmp = (_a = components == null ? void 0 : components.LoadMask) != null ? _a : LoadMask;
|
|
8809
|
-
|
|
9866
|
+
useEffect26(() => {
|
|
8810
9867
|
brain.setScrollStopDelay(scrollStopDelay);
|
|
8811
9868
|
dataSourceActions.scrollStopDelayUpdatedByTable = scrollStopDelay;
|
|
8812
9869
|
}, [scrollStopDelay]);
|
|
8813
9870
|
useAutoSizeColumns();
|
|
8814
|
-
|
|
9871
|
+
const onKeyDown = useCallback16((event) => {
|
|
9872
|
+
if (handleKeyboardNavigation({
|
|
9873
|
+
getState,
|
|
9874
|
+
actions,
|
|
9875
|
+
getDataSourceState,
|
|
9876
|
+
getComputed,
|
|
9877
|
+
key: event.key,
|
|
9878
|
+
shiftKey: !!event.shiftKey
|
|
9879
|
+
})) {
|
|
9880
|
+
event.preventDefault();
|
|
9881
|
+
}
|
|
9882
|
+
}, []);
|
|
9883
|
+
return /* @__PURE__ */ createElement26("div", __spreadValues({
|
|
9884
|
+
onKeyDown,
|
|
8815
9885
|
ref: domRef
|
|
8816
|
-
}, domProps), header ? /* @__PURE__ */
|
|
9886
|
+
}, domProps), header ? /* @__PURE__ */ createElement26(TableHeaderWrapper, {
|
|
8817
9887
|
brain: headerBrain,
|
|
8818
9888
|
scrollbars
|
|
8819
|
-
}) : null, /* @__PURE__ */
|
|
9889
|
+
}) : null, /* @__PURE__ */ createElement26(InfiniteTableBody, null, /* @__PURE__ */ createElement26(HeadlessTable, {
|
|
8820
9890
|
tabIndex: 0,
|
|
9891
|
+
activeRowIndex: componentState.ready && keyboardNavigation === "row" ? activeRowIndex : null,
|
|
9892
|
+
activeCellIndex: componentState.ready && keyboardNavigation === "cell" ? activeCellIndex : null,
|
|
8821
9893
|
scrollStopDelay,
|
|
9894
|
+
renderer,
|
|
9895
|
+
onRenderUpdater,
|
|
8822
9896
|
brain,
|
|
8823
9897
|
renderCell,
|
|
8824
9898
|
cellHoverClassNames: HOVERED_CLASS_NAMES,
|
|
8825
9899
|
scrollerDOMRef
|
|
8826
|
-
}), /* @__PURE__ */
|
|
9900
|
+
}), /* @__PURE__ */ createElement26(LoadMaskCmp, {
|
|
8827
9901
|
visible: loading
|
|
8828
|
-
}, loadingText)),
|
|
9902
|
+
}, loadingText)), /* @__PURE__ */ createElement26("div", {
|
|
8829
9903
|
ref: portalDOMRef,
|
|
8830
9904
|
className: join(`${rootClassName2}Portal`, zIndex[1e3], position.absolute, top[0], left[0])
|
|
8831
|
-
}), rowHeightCSSVar ? /* @__PURE__ */
|
|
9905
|
+
}), rowHeightCSSVar ? /* @__PURE__ */ createElement26(CSSVariableWatch, {
|
|
8832
9906
|
varName: rowHeightCSSVar,
|
|
8833
9907
|
onChange: onRowHeightCSSVarChange
|
|
8834
|
-
}) : null,
|
|
8835
|
-
varName:
|
|
8836
|
-
onChange:
|
|
8837
|
-
}) : null);
|
|
9908
|
+
}) : null, columnHeaderHeightCSSVar ? /* @__PURE__ */ createElement26(CSSVariableWatch, {
|
|
9909
|
+
varName: columnHeaderHeightCSSVar,
|
|
9910
|
+
onChange: onColumnHeaderHeightCSSVarChange
|
|
9911
|
+
}) : null, /* @__PURE__ */ createElement26(InfiniteTableFooter, null), licenseValid ? null : /* @__PURE__ */ createElement26(InfiniteTableLicenseFooter, null));
|
|
8838
9912
|
});
|
|
8839
9913
|
function InfiniteTableContextProvider() {
|
|
8840
9914
|
const { componentActions, componentState } = useComponentState();
|
|
@@ -8862,29 +9936,29 @@ function InfiniteTableContextProvider() {
|
|
|
8862
9936
|
bodySize.width = (_b = (_a = scrollerDOMRef.current) == null ? void 0 : _a.scrollWidth) != null ? _b : bodySize.width;
|
|
8863
9937
|
componentActions.bodySize = bodySize;
|
|
8864
9938
|
}, { earlyAttach: true });
|
|
8865
|
-
|
|
9939
|
+
useEffect26(() => {
|
|
8866
9940
|
return () => {
|
|
8867
9941
|
componentState.onRowHeightCSSVarChange.destroy();
|
|
8868
|
-
componentState.
|
|
9942
|
+
componentState.onColumnHeaderHeightCSSVarChange.destroy();
|
|
8869
9943
|
};
|
|
8870
9944
|
}, []);
|
|
8871
|
-
|
|
9945
|
+
useEffect26(() => {
|
|
8872
9946
|
if (scrollerDOMRef.current) {
|
|
8873
9947
|
scrollerDOMRef.current.scrollTop = 0;
|
|
8874
9948
|
}
|
|
8875
9949
|
}, [scrollTopKey, scrollerDOMRef]);
|
|
8876
9950
|
const TableContext2 = getInfiniteTableContext();
|
|
8877
|
-
return /* @__PURE__ */
|
|
9951
|
+
return /* @__PURE__ */ createElement26(TableContext2.Provider, {
|
|
8878
9952
|
value: contextValue
|
|
8879
|
-
}, /* @__PURE__ */
|
|
9953
|
+
}, /* @__PURE__ */ createElement26(InfiniteTableComponent, null));
|
|
8880
9954
|
}
|
|
8881
9955
|
function InfiniteTable(props) {
|
|
8882
|
-
const table = /* @__PURE__ */
|
|
8883
|
-
return /* @__PURE__ */
|
|
9956
|
+
const table = /* @__PURE__ */ createElement26(InfiniteTableRoot, __spreadValues({}, props), /* @__PURE__ */ createElement26(InfiniteTableContextProvider, null));
|
|
9957
|
+
return /* @__PURE__ */ createElement26(StrictMode, null, table);
|
|
8884
9958
|
}
|
|
8885
9959
|
InfiniteTable.defaultProps = {
|
|
8886
9960
|
rowHeight: 40,
|
|
8887
|
-
|
|
9961
|
+
columnHeaderHeight: ThemeVars.components.Header.columnHeaderHeight
|
|
8888
9962
|
};
|
|
8889
9963
|
export {
|
|
8890
9964
|
DataSource,
|
|
@@ -8893,7 +9967,12 @@ export {
|
|
|
8893
9967
|
InfiniteTable,
|
|
8894
9968
|
InfiniteTableClassName,
|
|
8895
9969
|
InfiniteTableComponent,
|
|
9970
|
+
NumberFilterEditor,
|
|
9971
|
+
StringFilterEditor,
|
|
8896
9972
|
debounce,
|
|
9973
|
+
defaultFilterEditors,
|
|
9974
|
+
defaultFilterTypes,
|
|
9975
|
+
defaultFilterTypes as filterTypes,
|
|
8897
9976
|
flatten,
|
|
8898
9977
|
getComponentStateRoot,
|
|
8899
9978
|
group,
|