@infinite-table/infinite-react 0.3.1 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.css +199 -91
- package/index.d.ts +654 -411
- package/index.esm.css +199 -91
- package/index.esm.js +1911 -832
- package/index.js +1906 -840
- 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;
|
|
@@ -2820,7 +2989,7 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2820
2989
|
this.hoverRowUpdatesInProgress.delete(rowIndex);
|
|
2821
2990
|
});
|
|
2822
2991
|
};
|
|
2823
|
-
this.updateElementPosition = (elementIndex) => {
|
|
2992
|
+
this.updateElementPosition = (elementIndex, options) => {
|
|
2824
2993
|
const itemElement = this.itemDOMElements[elementIndex];
|
|
2825
2994
|
const cell = this.mappedCells.getRenderedCellAtElement(elementIndex);
|
|
2826
2995
|
if (cell == null) {
|
|
@@ -2845,7 +3014,8 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2845
3014
|
itemElement.style.transform = `translate3d(${x}px, ${y}px, 0)`;
|
|
2846
3015
|
itemElement.style.willChange = "transform";
|
|
2847
3016
|
itemElement.style.backfaceVisibility = "hidden";
|
|
2848
|
-
|
|
3017
|
+
const hidden = options ? options.hidden : !!this.isCellCovered(rowIndex, colIndex);
|
|
3018
|
+
itemElement.style.zIndex = hidden ? "-1" : "auto";
|
|
2849
3019
|
} else {
|
|
2850
3020
|
itemElement.style.display = "";
|
|
2851
3021
|
itemElement.style.left = `${x}px`;
|
|
@@ -2855,9 +3025,6 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2855
3025
|
};
|
|
2856
3026
|
this.onScrollStart = () => {
|
|
2857
3027
|
this.scrolling = true;
|
|
2858
|
-
if (this.currentHoveredRow != -1) {
|
|
2859
|
-
this.removeHoverClass(this.currentHoveredRow);
|
|
2860
|
-
}
|
|
2861
3028
|
};
|
|
2862
3029
|
this.onScrollStop = () => {
|
|
2863
3030
|
this.scrolling = false;
|
|
@@ -3040,6 +3207,7 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
3040
3207
|
const heightWithRowspan = rowspan === 1 ? height : this.brain.getRowHeightWithSpan(rowIndex, colIndex, rowspan);
|
|
3041
3208
|
const widthWithColspan = colspan === 1 ? width : this.brain.getColWidthWithSpan(rowIndex, colIndex, colspan);
|
|
3042
3209
|
const { row: rowFixed, col: colFixed } = this.isCellFixed(rowIndex, colIndex);
|
|
3210
|
+
const hidden = !!covered;
|
|
3043
3211
|
const renderedNode = renderCell({
|
|
3044
3212
|
rowIndex,
|
|
3045
3213
|
colIndex,
|
|
@@ -3049,7 +3217,7 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
3049
3217
|
colspan,
|
|
3050
3218
|
rowFixed,
|
|
3051
3219
|
colFixed,
|
|
3052
|
-
hidden
|
|
3220
|
+
hidden,
|
|
3053
3221
|
heightWithRowspan,
|
|
3054
3222
|
widthWithColspan,
|
|
3055
3223
|
onMouseEnter: this.onMouseEnter.bind(null, rowIndex),
|
|
@@ -3066,7 +3234,7 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
3066
3234
|
this.debug(`Render cell ${rowIndex},${colIndex} at element ${elementIndex}`);
|
|
3067
3235
|
}
|
|
3068
3236
|
itemUpdater(renderedNode);
|
|
3069
|
-
this.updateElementPosition(elementIndex);
|
|
3237
|
+
this.updateElementPosition(elementIndex, { hidden, rowspan, colspan });
|
|
3070
3238
|
return;
|
|
3071
3239
|
}
|
|
3072
3240
|
reset() {
|
|
@@ -3094,8 +3262,11 @@ function createRenderer(brain) {
|
|
|
3094
3262
|
function RawTableFn(props) {
|
|
3095
3263
|
const { brain, renderCell } = props;
|
|
3096
3264
|
const { renderer, onRenderUpdater } = useMemo2(() => {
|
|
3097
|
-
return
|
|
3098
|
-
|
|
3265
|
+
return props.onRenderUpdater && props.renderer ? {
|
|
3266
|
+
renderer: props.renderer,
|
|
3267
|
+
onRenderUpdater: props.onRenderUpdater
|
|
3268
|
+
} : createRenderer(brain);
|
|
3269
|
+
}, [brain, props.onRenderUpdater, props.renderer]);
|
|
3099
3270
|
useEffect4(() => {
|
|
3100
3271
|
renderer.cellHoverClassNames = props.cellHoverClassNames || [];
|
|
3101
3272
|
}, [renderer, props.cellHoverClassNames]);
|
|
@@ -3129,6 +3300,150 @@ function RawTableFn(props) {
|
|
|
3129
3300
|
}
|
|
3130
3301
|
var RawTable = memo3(RawTableFn);
|
|
3131
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
|
+
|
|
3132
3447
|
// src/components/HeadlessTable/index.tsx
|
|
3133
3448
|
function useMatrixBrain(brain, brainOptions, fixedCellsInfo) {
|
|
3134
3449
|
if (fixedCellsInfo && (fixedCellsInfo.fixedColsStart || fixedCellsInfo.fixedColsEnd || fixedCellsInfo.fixedRowsStart || fixedCellsInfo.fixedRowsEnd)) {
|
|
@@ -3156,25 +3471,33 @@ function HeadlessTable(props) {
|
|
|
3156
3471
|
scrollerDOMRef,
|
|
3157
3472
|
scrollStopDelay,
|
|
3158
3473
|
renderCell,
|
|
3159
|
-
cellHoverClassNames
|
|
3474
|
+
cellHoverClassNames,
|
|
3475
|
+
renderer,
|
|
3476
|
+
activeRowIndex,
|
|
3477
|
+
activeCellIndex,
|
|
3478
|
+
onRenderUpdater
|
|
3160
3479
|
} = _a, domProps = __objRest(_a, [
|
|
3161
3480
|
"brain",
|
|
3162
3481
|
"scrollerDOMRef",
|
|
3163
3482
|
"scrollStopDelay",
|
|
3164
3483
|
"renderCell",
|
|
3165
|
-
"cellHoverClassNames"
|
|
3484
|
+
"cellHoverClassNames",
|
|
3485
|
+
"renderer",
|
|
3486
|
+
"activeRowIndex",
|
|
3487
|
+
"activeCellIndex",
|
|
3488
|
+
"onRenderUpdater"
|
|
3166
3489
|
]);
|
|
3167
|
-
const domRef =
|
|
3168
|
-
const [scrollSize, setTotalScrollSize] =
|
|
3490
|
+
const domRef = useRef7(null);
|
|
3491
|
+
const [scrollSize, setTotalScrollSize] = useState5({
|
|
3169
3492
|
width: 0,
|
|
3170
3493
|
height: 0
|
|
3171
3494
|
});
|
|
3172
|
-
|
|
3495
|
+
useEffect7(() => {
|
|
3173
3496
|
if (scrollStopDelay != null) {
|
|
3174
3497
|
brain.setScrollStopDelay(scrollStopDelay);
|
|
3175
3498
|
}
|
|
3176
3499
|
}, [scrollStopDelay, brain]);
|
|
3177
|
-
|
|
3500
|
+
useEffect7(() => {
|
|
3178
3501
|
var _a2;
|
|
3179
3502
|
const node = (_a2 = domRef.current) == null ? void 0 : _a2.parentNode;
|
|
3180
3503
|
if (!node) {
|
|
@@ -3190,31 +3513,39 @@ function HeadlessTable(props) {
|
|
|
3190
3513
|
const remove = setupResizeObserver(node, onResize);
|
|
3191
3514
|
return remove;
|
|
3192
3515
|
}, []);
|
|
3193
|
-
const onContainerScroll =
|
|
3516
|
+
const onContainerScroll = useCallback4((scrollPos) => {
|
|
3194
3517
|
brain.setScrollPosition(scrollPos, (scrollPos2) => {
|
|
3195
3518
|
domRef.current.style.transform = `translate3d(${-scrollPos2.scrollLeft}px, ${-scrollPos2.scrollTop}px, 0px)`;
|
|
3196
3519
|
});
|
|
3197
3520
|
}, [brain]);
|
|
3198
|
-
|
|
3521
|
+
useEffect7(() => {
|
|
3199
3522
|
const removeOnRenderCount = brain.onRenderCountChange(() => {
|
|
3200
3523
|
setTotalScrollSize(brain.getTotalSize());
|
|
3201
3524
|
});
|
|
3202
3525
|
setTotalScrollSize(brain.getTotalSize());
|
|
3203
3526
|
return removeOnRenderCount;
|
|
3204
3527
|
}, [brain]);
|
|
3205
|
-
return /* @__PURE__ */
|
|
3528
|
+
return /* @__PURE__ */ createElement8(VirtualScrollContainer, __spreadProps(__spreadValues({
|
|
3206
3529
|
onContainerScroll
|
|
3207
3530
|
}, domProps), {
|
|
3208
3531
|
ref: scrollerDOMRef
|
|
3209
|
-
}), /* @__PURE__ */
|
|
3532
|
+
}), /* @__PURE__ */ createElement8("div", {
|
|
3210
3533
|
ref: domRef,
|
|
3211
3534
|
className: scrollTransformTargetCls,
|
|
3212
3535
|
"data-name": "scroll-transform-target"
|
|
3213
|
-
}, /* @__PURE__ */
|
|
3536
|
+
}, /* @__PURE__ */ createElement8(RawTable, {
|
|
3537
|
+
renderer,
|
|
3538
|
+
onRenderUpdater,
|
|
3214
3539
|
renderCell,
|
|
3215
3540
|
brain,
|
|
3216
3541
|
cellHoverClassNames
|
|
3217
|
-
})), /* @__PURE__ */
|
|
3542
|
+
})), /* @__PURE__ */ createElement8(ActiveRowIndicator, {
|
|
3543
|
+
brain,
|
|
3544
|
+
activeRowIndex
|
|
3545
|
+
}), /* @__PURE__ */ createElement8(ActiveCellIndicator, {
|
|
3546
|
+
brain,
|
|
3547
|
+
activeCellIndex
|
|
3548
|
+
}), /* @__PURE__ */ createElement8(SpacePlaceholder, {
|
|
3218
3549
|
width: scrollSize.width,
|
|
3219
3550
|
height: scrollSize.height
|
|
3220
3551
|
}));
|
|
@@ -3222,17 +3553,17 @@ function HeadlessTable(props) {
|
|
|
3222
3553
|
|
|
3223
3554
|
// src/components/hooks/useComponentState/index.tsx
|
|
3224
3555
|
import {
|
|
3225
|
-
createElement as
|
|
3226
|
-
memo as
|
|
3556
|
+
createElement as createElement9,
|
|
3557
|
+
memo as memo6,
|
|
3227
3558
|
useContext as useContext2
|
|
3228
3559
|
} from "react";
|
|
3229
3560
|
import {
|
|
3230
3561
|
useReducer,
|
|
3231
3562
|
createContext as createContext2,
|
|
3232
3563
|
useMemo as useMemo3,
|
|
3233
|
-
useEffect as
|
|
3234
|
-
useState as
|
|
3235
|
-
useRef as
|
|
3564
|
+
useEffect as useEffect8,
|
|
3565
|
+
useState as useState6,
|
|
3566
|
+
useRef as useRef10
|
|
3236
3567
|
} from "react";
|
|
3237
3568
|
|
|
3238
3569
|
// src/utils/proxyFnCall.ts
|
|
@@ -3276,18 +3607,18 @@ function isControlled(propName, props) {
|
|
|
3276
3607
|
}
|
|
3277
3608
|
|
|
3278
3609
|
// src/components/hooks/useLatest.tsx
|
|
3279
|
-
import { useCallback as
|
|
3610
|
+
import { useCallback as useCallback5, useRef as useRef8 } from "react";
|
|
3280
3611
|
function useLatest(value) {
|
|
3281
|
-
const ref =
|
|
3612
|
+
const ref = useRef8(value);
|
|
3282
3613
|
ref.current = value;
|
|
3283
|
-
return
|
|
3614
|
+
return useCallback5(() => ref.current, []);
|
|
3284
3615
|
}
|
|
3285
3616
|
|
|
3286
3617
|
// src/components/hooks/usePrevious.ts
|
|
3287
|
-
import { useRef as
|
|
3618
|
+
import { useRef as useRef9, useLayoutEffect as useLayoutEffect5 } from "react";
|
|
3288
3619
|
var usePrevious = (value, initialValue) => {
|
|
3289
|
-
const ref =
|
|
3290
|
-
|
|
3620
|
+
const ref = useRef9(initialValue === void 0 ? value : initialValue);
|
|
3621
|
+
useLayoutEffect5(() => {
|
|
3291
3622
|
ref.current = value;
|
|
3292
3623
|
});
|
|
3293
3624
|
return ref.current;
|
|
@@ -3367,16 +3698,16 @@ function forwardProps(propsToForward, props) {
|
|
|
3367
3698
|
return mappedState;
|
|
3368
3699
|
}
|
|
3369
3700
|
function getComponentStateRoot(config) {
|
|
3370
|
-
return
|
|
3701
|
+
return memo6(function ComponentStateRoot(props) {
|
|
3371
3702
|
var _a, _b;
|
|
3372
|
-
const [initialSetupState] =
|
|
3703
|
+
const [initialSetupState] = useState6(() => {
|
|
3373
3704
|
return config.initSetupState ? config.initSetupState() : {};
|
|
3374
3705
|
});
|
|
3375
|
-
const propsToStateSetRef =
|
|
3706
|
+
const propsToStateSetRef = useRef10(new Set());
|
|
3376
3707
|
const propsToForward = useMemo3(() => config.forwardProps ? config.forwardProps(initialSetupState) : {}, [initialSetupState]);
|
|
3377
3708
|
const parentState = (_b = (_a = config.getParentState) == null ? void 0 : _a.call(config)) != null ? _b : null;
|
|
3378
3709
|
const getParentState = useLatest(parentState);
|
|
3379
|
-
const [wholeState] =
|
|
3710
|
+
const [wholeState] = useState6(() => {
|
|
3380
3711
|
let mappedState = {};
|
|
3381
3712
|
if (propsToForward) {
|
|
3382
3713
|
mappedState = forwardProps(propsToForward, props);
|
|
@@ -3461,7 +3792,7 @@ function getComponentStateRoot(config) {
|
|
|
3461
3792
|
getComponentState
|
|
3462
3793
|
}), [state, actions, getComponentState]);
|
|
3463
3794
|
const prevProps = usePrevious(props);
|
|
3464
|
-
|
|
3795
|
+
useEffect8(() => {
|
|
3465
3796
|
const currentProps = props;
|
|
3466
3797
|
const newMappedState = {};
|
|
3467
3798
|
let newMappedStateCount = 0;
|
|
@@ -3517,7 +3848,7 @@ function getComponentStateRoot(config) {
|
|
|
3517
3848
|
}
|
|
3518
3849
|
}
|
|
3519
3850
|
});
|
|
3520
|
-
return /* @__PURE__ */
|
|
3851
|
+
return /* @__PURE__ */ createElement9(Context.Provider, {
|
|
3521
3852
|
value: contextValue
|
|
3522
3853
|
}, props.children);
|
|
3523
3854
|
});
|
|
@@ -3529,62 +3860,174 @@ function useComponentState() {
|
|
|
3529
3860
|
|
|
3530
3861
|
// src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx
|
|
3531
3862
|
import {
|
|
3532
|
-
createElement as
|
|
3863
|
+
createElement as createElement10,
|
|
3533
3864
|
forwardRef as forwardRef2
|
|
3534
3865
|
} from "react";
|
|
3535
3866
|
|
|
3536
|
-
// src/components/InfiniteTable/internalProps.ts
|
|
3537
|
-
var rootClassName2 = "Infinite";
|
|
3538
|
-
var internalProps = {
|
|
3539
|
-
rootClassName: rootClassName2
|
|
3540
|
-
};
|
|
3541
|
-
|
|
3542
3867
|
// src/components/InfiniteTable/hooks/useInternalProps.ts
|
|
3543
3868
|
var useInternalProps = () => {
|
|
3544
3869
|
return internalProps;
|
|
3545
3870
|
};
|
|
3546
3871
|
|
|
3547
3872
|
// src/components/InfiniteTable/utilities.css.ts
|
|
3548
|
-
var alignItems = { center: "
|
|
3549
|
-
var cssEllipsisClassName = "
|
|
3873
|
+
var alignItems = { center: "_16lm1iw14", stretch: "_16lm1iw15" };
|
|
3874
|
+
var cssEllipsisClassName = "_16lm1iw1d _16lm1iw1e _16lm1iw19";
|
|
3550
3875
|
var cursor = { pointer: "_16lm1iwd" };
|
|
3551
|
-
var display = { flex: "
|
|
3552
|
-
var flex = { "1": "
|
|
3553
|
-
var
|
|
3554
|
-
var
|
|
3555
|
-
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" };
|
|
3556
3882
|
var position = { relative: "_16lm1iw1", absolute: "_16lm1iw2", sticky: "_16lm1iw3", fixed: "_16lm1iw4" };
|
|
3557
|
-
var top = { "0": "
|
|
3883
|
+
var top = { "0": "_16lm1iwu", "100%": "_16lm1iwv" };
|
|
3558
3884
|
var transformTranslateZero = "_16lm1iwa";
|
|
3559
|
-
var userSelect = { none: "
|
|
3560
|
-
var zIndex = { "1": "
|
|
3885
|
+
var userSelect = { none: "_16lm1iwp" };
|
|
3886
|
+
var zIndex = { "1": "_16lm1iwh", "10": "_16lm1iwi", "1000": "_16lm1iwj", "10000": "_16lm1iwk", "100000": "_16lm1iwl" };
|
|
3561
3887
|
|
|
3562
3888
|
// src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx
|
|
3563
3889
|
var InfiniteTableBody = forwardRef2(function InfiniteTableBody2(props, ref) {
|
|
3564
|
-
const { rootClassName:
|
|
3565
|
-
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({
|
|
3566
3906
|
ref
|
|
3567
3907
|
}, props), {
|
|
3568
|
-
className: join(`${
|
|
3908
|
+
className: join(`${rootClassName11}Footer`, position.relative, display.flex, flexFlow.row, props.className)
|
|
3569
3909
|
}));
|
|
3570
3910
|
});
|
|
3571
3911
|
|
|
3572
3912
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
|
|
3573
3913
|
import {
|
|
3914
|
+
Fragment as Fragment2,
|
|
3574
3915
|
createContext as createContext4,
|
|
3575
|
-
createElement as
|
|
3916
|
+
createElement as createElement15,
|
|
3917
|
+
useMemo as useMemo5
|
|
3576
3918
|
} from "react";
|
|
3919
|
+
import { useCallback as useCallback7, useContext as useContext5, useEffect as useEffect11, useRef as useRef12 } from "react";
|
|
3577
3920
|
import { createPortal } from "react-dom";
|
|
3578
|
-
import { useCallback as useCallback6, useContext as useContext5, useEffect as useEffect8, useRef as useRef10 } from "react";
|
|
3579
3921
|
|
|
3580
|
-
// 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());
|
|
3581
4023
|
import {
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
4024
|
+
useCallback as useCallback6,
|
|
4025
|
+
useMemo as useMemo4,
|
|
4026
|
+
useRef as useRef11,
|
|
4027
|
+
useState as useState7
|
|
3585
4028
|
} from "react";
|
|
3586
4029
|
|
|
3587
|
-
// src/components/InfiniteTable/hooks/
|
|
4030
|
+
// src/components/InfiniteTable/hooks/useInfiniteTable.ts
|
|
3588
4031
|
import { useContext as useContext3 } from "react";
|
|
3589
4032
|
|
|
3590
4033
|
// src/components/InfiniteTable/InfiniteTableContext.ts
|
|
@@ -3597,119 +4040,28 @@ function getInfiniteTableContext() {
|
|
|
3597
4040
|
return TableContext = createContext3(null);
|
|
3598
4041
|
}
|
|
3599
4042
|
|
|
3600
|
-
// src/components/InfiniteTable/hooks/
|
|
3601
|
-
var
|
|
4043
|
+
// src/components/InfiniteTable/hooks/useInfiniteTable.ts
|
|
4044
|
+
var useInfiniteTable = () => {
|
|
3602
4045
|
const TableContext2 = getInfiniteTableContext();
|
|
3603
|
-
|
|
3604
|
-
return componentState;
|
|
4046
|
+
return useContext3(TableContext2);
|
|
3605
4047
|
};
|
|
3606
4048
|
|
|
3607
|
-
// src/components/InfiniteTable/
|
|
3608
|
-
var
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
skipColumnShifting = false,
|
|
3624
|
-
offsetProperty = "left",
|
|
3625
|
-
column,
|
|
3626
|
-
domRef,
|
|
3627
|
-
width,
|
|
3628
|
-
afterChildren,
|
|
3629
|
-
beforeChildren,
|
|
3630
|
-
offset,
|
|
3631
|
-
cellType,
|
|
3632
|
-
cssPosition: _cssPosition,
|
|
3633
|
-
renderChildren
|
|
3634
|
-
} = _a, domProps = __objRest(_a, [
|
|
3635
|
-
"cssEllipsis",
|
|
3636
|
-
"virtualized",
|
|
3637
|
-
"skipColumnShifting",
|
|
3638
|
-
"offsetProperty",
|
|
3639
|
-
"column",
|
|
3640
|
-
"domRef",
|
|
3641
|
-
"width",
|
|
3642
|
-
"afterChildren",
|
|
3643
|
-
"beforeChildren",
|
|
3644
|
-
"offset",
|
|
3645
|
-
"cellType",
|
|
3646
|
-
"cssPosition",
|
|
3647
|
-
"renderChildren"
|
|
3648
|
-
]);
|
|
3649
|
-
const children = renderChildren();
|
|
3650
|
-
const { columnShifts } = useInfiniteTableState();
|
|
3651
|
-
const shifting = !!columnShifts;
|
|
3652
|
-
const style = __spreadValues({
|
|
3653
|
-
width
|
|
3654
|
-
}, domProps.style);
|
|
3655
|
-
if (!skipColumnShifting && columnShifts && columnShifts[column.computedVisibleIndex]) {
|
|
3656
|
-
const shiftLeft = columnShifts[column.computedVisibleIndex] + (offset != null ? offset : 0);
|
|
3657
|
-
if (virtualized) {
|
|
3658
|
-
style.left = shiftLeft;
|
|
3659
|
-
} else {
|
|
3660
|
-
style.transform = `translate3d(${shiftLeft}px, 0px, 0px)`;
|
|
3661
|
-
}
|
|
3662
|
-
}
|
|
3663
|
-
const finalDOMProps = __spreadProps(__spreadValues({}, domProps), {
|
|
3664
|
-
style,
|
|
3665
|
-
"data-column-id": column.id,
|
|
3666
|
-
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}` : ""),
|
|
3667
|
-
children: /* @__PURE__ */ createElement9(Fragment, null, beforeChildren, /* @__PURE__ */ createElement9("div", {
|
|
3668
|
-
className: `${InfiniteTableCellContentClassName} ${cssEllipsis ? cssEllipsisClassName : overflow.hidden}`
|
|
3669
|
-
}, children), afterChildren)
|
|
3670
|
-
});
|
|
3671
|
-
const RenderComponent = cellType === "body" ? (_d = column.components) == null ? void 0 : _d.ColumnCell : (_e = column.components) == null ? void 0 : _e.HeaderCell;
|
|
3672
|
-
if (RenderComponent) {
|
|
3673
|
-
return /* @__PURE__ */ createElement9(RenderComponent, __spreadValues({}, finalDOMProps));
|
|
3674
|
-
}
|
|
3675
|
-
return /* @__PURE__ */ createElement9("div", __spreadProps(__spreadValues({}, finalDOMProps), {
|
|
3676
|
-
ref: domRef
|
|
3677
|
-
}));
|
|
3678
|
-
}
|
|
3679
|
-
var InfiniteTableCell = memo5(InfiniteTableCellFn);
|
|
3680
|
-
|
|
3681
|
-
// src/components/InfiniteTable/hooks/useColumnPointerEvents.ts
|
|
3682
|
-
var import_binary_search2 = __toModule(require_binary_search());
|
|
3683
|
-
import {
|
|
3684
|
-
useCallback as useCallback5,
|
|
3685
|
-
useMemo as useMemo4,
|
|
3686
|
-
useRef as useRef9,
|
|
3687
|
-
useState as useState4
|
|
3688
|
-
} from "react";
|
|
3689
|
-
|
|
3690
|
-
// src/components/InfiniteTable/hooks/useInfiniteTable.ts
|
|
3691
|
-
import { useContext as useContext4 } from "react";
|
|
3692
|
-
var useInfiniteTable = () => {
|
|
3693
|
-
const TableContext2 = getInfiniteTableContext();
|
|
3694
|
-
return useContext4(TableContext2);
|
|
3695
|
-
};
|
|
3696
|
-
|
|
3697
|
-
// src/components/InfiniteTable/utils/moveXatY.ts
|
|
3698
|
-
var moveXatY = (arr, dragIndex, dropIndex) => {
|
|
3699
|
-
arr = [...arr];
|
|
3700
|
-
if (dragIndex === dropIndex || arr[dragIndex] === void 0 || arr[dropIndex] === void 0) {
|
|
3701
|
-
return arr;
|
|
3702
|
-
}
|
|
3703
|
-
const dragItem = arr[dragIndex];
|
|
3704
|
-
if (dropIndex < dragIndex) {
|
|
3705
|
-
arr.splice(dragIndex, 1);
|
|
3706
|
-
arr.splice(dropIndex, 0, dragItem);
|
|
3707
|
-
} else {
|
|
3708
|
-
arr.splice(dragIndex, 1);
|
|
3709
|
-
arr.splice(dropIndex, 0, dragItem);
|
|
3710
|
-
}
|
|
3711
|
-
return arr;
|
|
3712
|
-
};
|
|
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
|
+
};
|
|
3713
4065
|
|
|
3714
4066
|
// src/components/InfiniteTable/hooks/useColumnPointerEvents.ts
|
|
3715
4067
|
var getBreakPoints = (columns) => {
|
|
@@ -3726,13 +4078,13 @@ var useColumnPointerEvents = ({
|
|
|
3726
4078
|
columns,
|
|
3727
4079
|
computedRemainingSpace
|
|
3728
4080
|
}) => {
|
|
3729
|
-
const [draggingDiff, setDraggingDiff] =
|
|
3730
|
-
const [proxyOffset, setProxyOffset] =
|
|
3731
|
-
const breakpointsRef =
|
|
3732
|
-
const pointerMoveRef =
|
|
3733
|
-
const didDragRef =
|
|
3734
|
-
const initialClientPos =
|
|
3735
|
-
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);
|
|
3736
4088
|
const dragging = draggingDiff != null;
|
|
3737
4089
|
const { componentActions, computed } = useInfiniteTable();
|
|
3738
4090
|
const { computedColumnOrder } = computed;
|
|
@@ -3745,8 +4097,8 @@ var useColumnPointerEvents = ({
|
|
|
3745
4097
|
columnWidth: column.computedWidth
|
|
3746
4098
|
};
|
|
3747
4099
|
}, [columns, columnId, column]);
|
|
3748
|
-
let cursorRef =
|
|
3749
|
-
const onPointerDown =
|
|
4100
|
+
let cursorRef = useRef11("auto");
|
|
4101
|
+
const onPointerDown = useCallback6((e) => {
|
|
3750
4102
|
const target = domRef.current;
|
|
3751
4103
|
cursorRef.current = target.style.cursor;
|
|
3752
4104
|
didDragRef.current = false;
|
|
@@ -3809,7 +4161,7 @@ var useColumnPointerEvents = ({
|
|
|
3809
4161
|
target.addEventListener("pointermove", onPointerMove);
|
|
3810
4162
|
target.setPointerCapture(e.pointerId);
|
|
3811
4163
|
}, [columns, column, columnIndex, columnsArray, computedRemainingSpace]);
|
|
3812
|
-
const onPointerUp =
|
|
4164
|
+
const onPointerUp = useCallback6((e) => {
|
|
3813
4165
|
const target = domRef.current;
|
|
3814
4166
|
target.style.cursor = cursorRef.current;
|
|
3815
4167
|
target.releasePointerCapture(e.pointerId);
|
|
@@ -3842,49 +4194,71 @@ var useColumnPointerEvents = ({
|
|
|
3842
4194
|
};
|
|
3843
4195
|
};
|
|
3844
4196
|
|
|
3845
|
-
// src/components/InfiniteTable/
|
|
3846
|
-
function
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
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
|
|
3857
4209
|
};
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
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
|
+
});
|
|
3881
4237
|
}
|
|
3882
4238
|
|
|
3883
4239
|
// src/components/InfiniteTable/components/icons/SortIcon.tsx
|
|
3884
4240
|
import {
|
|
3885
|
-
createElement as
|
|
4241
|
+
createElement as createElement12
|
|
3886
4242
|
} from "react";
|
|
3887
|
-
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
|
|
3888
4262
|
var defaultLineStyle = {
|
|
3889
4263
|
marginTop: 2,
|
|
3890
4264
|
marginBottom: 2,
|
|
@@ -3893,8 +4267,8 @@ var defaultLineStyle = {
|
|
|
3893
4267
|
var InfiniteTableIconClassName = "InfiniteTableIcon";
|
|
3894
4268
|
function SortIcon(props) {
|
|
3895
4269
|
var _a;
|
|
3896
|
-
const [rendered, setRendered] =
|
|
3897
|
-
const [opacity, setOpacity] =
|
|
4270
|
+
const [rendered, setRendered] = useState8(true);
|
|
4271
|
+
const [opacity, setOpacity] = useState8(0);
|
|
3898
4272
|
const { direction, lineWidth = 1, style, className, index } = props;
|
|
3899
4273
|
const showIndex = index != null && index > 0;
|
|
3900
4274
|
const size = (_a = props.size) != null ? _a : 16;
|
|
@@ -3908,16 +4282,21 @@ function SortIcon(props) {
|
|
|
3908
4282
|
}), props.lineStyle), {
|
|
3909
4283
|
opacity
|
|
3910
4284
|
});
|
|
3911
|
-
|
|
4285
|
+
useEffect9(() => {
|
|
3912
4286
|
const newOpacity = direction != 0 ? 1 : 0;
|
|
3913
4287
|
if (!rendered && newOpacity) {
|
|
3914
4288
|
setRendered(true);
|
|
3915
4289
|
}
|
|
3916
4290
|
if (newOpacity !== opacity) {
|
|
3917
|
-
requestAnimationFrame(() => {
|
|
4291
|
+
const rafId = requestAnimationFrame(() => {
|
|
3918
4292
|
setOpacity(newOpacity);
|
|
3919
4293
|
});
|
|
4294
|
+
return () => {
|
|
4295
|
+
cancelAnimationFrame(rafId);
|
|
4296
|
+
};
|
|
3920
4297
|
}
|
|
4298
|
+
return () => {
|
|
4299
|
+
};
|
|
3921
4300
|
}, [direction, rendered]);
|
|
3922
4301
|
const onTransitionEnd = () => {
|
|
3923
4302
|
const hidden = opacity === 0 && direction === 0;
|
|
@@ -3929,91 +4308,231 @@ function SortIcon(props) {
|
|
|
3929
4308
|
if (!rendered) {
|
|
3930
4309
|
return null;
|
|
3931
4310
|
}
|
|
3932
|
-
const indexStyle = {
|
|
3933
|
-
position: "absolute",
|
|
3934
|
-
transition: "top 0.2s",
|
|
3935
|
-
top: 0,
|
|
3936
|
-
right: 2
|
|
3937
|
-
};
|
|
4311
|
+
const indexStyle = {};
|
|
3938
4312
|
if (direction === -1) {
|
|
3939
4313
|
indexStyle.top = "100%";
|
|
3940
4314
|
}
|
|
3941
|
-
return /* @__PURE__ */
|
|
4315
|
+
return /* @__PURE__ */ createElement12("div", {
|
|
3942
4316
|
style: __spreadProps(__spreadValues({}, style), { width: size }),
|
|
3943
4317
|
className: join(className, InfiniteTableIconClassName, `${InfiniteTableIconClassName}-sort`)
|
|
3944
|
-
}, showIndex ? /* @__PURE__ */
|
|
4318
|
+
}, showIndex ? /* @__PURE__ */ createElement12("div", {
|
|
3945
4319
|
"data-name": "index",
|
|
3946
|
-
style: indexStyle
|
|
3947
|
-
|
|
4320
|
+
style: indexStyle,
|
|
4321
|
+
className: HeaderSortIconIndexCls
|
|
4322
|
+
}, index) : null, /* @__PURE__ */ createElement12("div", {
|
|
3948
4323
|
style: __spreadValues({ width: sizes[0] }, lineStyle),
|
|
3949
4324
|
onTransitionEnd
|
|
3950
|
-
}), /* @__PURE__ */
|
|
4325
|
+
}), /* @__PURE__ */ createElement12("div", {
|
|
3951
4326
|
style: __spreadValues({ width: sizes[1] }, lineStyle)
|
|
3952
|
-
}), /* @__PURE__ */
|
|
4327
|
+
}), /* @__PURE__ */ createElement12("div", {
|
|
3953
4328
|
style: __spreadValues({ width: sizes[2] }, lineStyle)
|
|
3954
4329
|
}));
|
|
3955
4330
|
}
|
|
3956
4331
|
|
|
3957
|
-
// 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
|
|
3958
4348
|
var import_createRuntimeFn2 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
3959
|
-
var
|
|
3960
|
-
var
|
|
3961
|
-
var
|
|
3962
|
-
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"]] });
|
|
3963
|
-
var HeaderGroupCls = "_12zfob110 _16lm1iwl _16lm1iw12 _16lm1iw13";
|
|
3964
|
-
var HeaderScrollbarPlaceholderCls = "_12zfob12 _16lm1iw2";
|
|
3965
|
-
var HeaderSortIconCls = "_12zfob11 _16lm1iw1";
|
|
3966
|
-
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"]] });
|
|
3967
4352
|
|
|
3968
|
-
// src/components/InfiniteTable/
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
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
|
+
});
|
|
3972
4481
|
}
|
|
3973
4482
|
|
|
3974
4483
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
|
|
3975
4484
|
var InfiniteTableHeaderCellContext = createContext4(null);
|
|
3976
|
-
var { rootClassName:
|
|
3977
|
-
var InfiniteTableHeaderCellClassName = `${
|
|
4485
|
+
var { rootClassName: rootClassName7 } = internalProps;
|
|
4486
|
+
var InfiniteTableHeaderCellClassName = `${rootClassName7}HeaderCell`;
|
|
3978
4487
|
function InfiniteTableHeaderCell(props) {
|
|
3979
|
-
var _a, _b, _c, _d;
|
|
4488
|
+
var _a, _b, _c, _d, _e;
|
|
3980
4489
|
const column = props.column;
|
|
3981
4490
|
const columns = props.columns;
|
|
3982
|
-
const { onResize, height, width } = props;
|
|
4491
|
+
const { onResize, height, width, headerOptions } = props;
|
|
3983
4492
|
const sortInfo = column.computedSortInfo;
|
|
3984
4493
|
let header = column.header;
|
|
3985
|
-
const ref =
|
|
4494
|
+
const ref = useCallback7((node) => {
|
|
3986
4495
|
var _a2;
|
|
3987
4496
|
domRef.current = node;
|
|
3988
4497
|
(_a2 = props.domRef) == null ? void 0 : _a2.call(props, node);
|
|
3989
4498
|
}, [props.domRef]);
|
|
3990
|
-
const
|
|
4499
|
+
const alwaysShow = headerOptions.alwaysReserveSpaceForSortIcon;
|
|
4500
|
+
const sortTool = column.computedSorted || alwaysShow ? /* @__PURE__ */ createElement15(SortIcon, {
|
|
3991
4501
|
index: column.computedMultiSort ? column.computedSortIndex + 1 : void 0,
|
|
3992
|
-
className: `${InfiniteTableHeaderCellClassName}__sort-icon ${HeaderSortIconCls}
|
|
4502
|
+
className: `${InfiniteTableHeaderCellClassName}__sort-icon ${HeaderSortIconCls} ${HeaderSortIconRecipe({
|
|
4503
|
+
align: column.align || "start"
|
|
4504
|
+
})}`,
|
|
3993
4505
|
direction: column.computedSorted ? column.computedSortedAsc ? 1 : -1 : 0
|
|
3994
|
-
});
|
|
4506
|
+
}) : null;
|
|
3995
4507
|
const renderParam = {
|
|
3996
4508
|
domRef: ref,
|
|
3997
4509
|
column,
|
|
3998
4510
|
columnSortInfo: sortInfo,
|
|
4511
|
+
columnFilterValue: column.computedFilterValue,
|
|
3999
4512
|
sortTool
|
|
4000
4513
|
};
|
|
4514
|
+
const align = column.align || "start";
|
|
4001
4515
|
const renderChildren = () => {
|
|
4002
4516
|
if (header instanceof Function) {
|
|
4003
|
-
header = /* @__PURE__ */
|
|
4517
|
+
header = /* @__PURE__ */ createElement15(RenderHookComponent, {
|
|
4004
4518
|
render: header,
|
|
4005
4519
|
renderParam
|
|
4006
4520
|
});
|
|
4007
4521
|
}
|
|
4008
4522
|
header = header != null ? header : column.name;
|
|
4009
|
-
return header;
|
|
4523
|
+
return /* @__PURE__ */ createElement15(Fragment2, null, align === "end" ? sortTool : null, header, align !== "end" ? sortTool : null);
|
|
4010
4524
|
};
|
|
4011
|
-
const domRef =
|
|
4525
|
+
const domRef = useRef12(null);
|
|
4012
4526
|
const {
|
|
4013
|
-
computed: { computedRemainingSpace },
|
|
4014
|
-
componentState: { portalDOMRef }
|
|
4527
|
+
computed: { computedRemainingSpace, showColumnFilters },
|
|
4528
|
+
componentState: { portalDOMRef, columnHeaderHeight, filterEditors }
|
|
4015
4529
|
} = useInfiniteTable();
|
|
4016
|
-
|
|
4530
|
+
const {
|
|
4531
|
+
componentActions: dataSourceActions,
|
|
4532
|
+
getState: getDataSourceState,
|
|
4533
|
+
componentState: { filterDelay, filterTypes }
|
|
4534
|
+
} = useDataSourceContextValue();
|
|
4535
|
+
useEffect11(() => {
|
|
4017
4536
|
let clearOnResize = null;
|
|
4018
4537
|
const node = domRef.current;
|
|
4019
4538
|
if (onResize && node) {
|
|
@@ -4034,7 +4553,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4034
4553
|
});
|
|
4035
4554
|
let draggingProxy = null;
|
|
4036
4555
|
if (dragging) {
|
|
4037
|
-
draggingProxy = /* @__PURE__ */
|
|
4556
|
+
draggingProxy = /* @__PURE__ */ createElement15("div", {
|
|
4038
4557
|
className: `${InfiniteTableHeaderCellClassName}Proxy ${HeaderCellProxy}`,
|
|
4039
4558
|
style: {
|
|
4040
4559
|
position: "absolute",
|
|
@@ -4048,9 +4567,73 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4048
4567
|
draggingProxy = createPortal(draggingProxy, portalDOMRef.current);
|
|
4049
4568
|
}
|
|
4050
4569
|
const ContextProvider = InfiniteTableHeaderCellContext.Provider;
|
|
4051
|
-
|
|
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, {
|
|
4052
4635
|
value: renderParam
|
|
4053
|
-
}, /* @__PURE__ */
|
|
4636
|
+
}, /* @__PURE__ */ createElement15(InfiniteTableCell, {
|
|
4054
4637
|
domRef: ref,
|
|
4055
4638
|
cellType: "header",
|
|
4056
4639
|
column,
|
|
@@ -4060,9 +4643,19 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4060
4643
|
width,
|
|
4061
4644
|
onPointerDown,
|
|
4062
4645
|
onPointerUp,
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
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,
|
|
4066
4659
|
renderChildren
|
|
4067
4660
|
}), draggingProxy);
|
|
4068
4661
|
}
|
|
@@ -4073,9 +4666,9 @@ function useInfiniteHeaderCell() {
|
|
|
4073
4666
|
|
|
4074
4667
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx
|
|
4075
4668
|
import {
|
|
4076
|
-
createElement as
|
|
4077
|
-
useCallback as
|
|
4078
|
-
useMemo as
|
|
4669
|
+
createElement as createElement18,
|
|
4670
|
+
useCallback as useCallback9,
|
|
4671
|
+
useMemo as useMemo6
|
|
4079
4672
|
} from "react";
|
|
4080
4673
|
|
|
4081
4674
|
// src/components/utils/getScrollbarWidth.ts
|
|
@@ -4199,14 +4792,14 @@ function assignGroupOffsetsAndComputedWidths(items, groupOffset = 0) {
|
|
|
4199
4792
|
|
|
4200
4793
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
|
|
4201
4794
|
import {
|
|
4202
|
-
createElement as
|
|
4203
|
-
memo as
|
|
4795
|
+
createElement as createElement17,
|
|
4796
|
+
memo as memo8
|
|
4204
4797
|
} from "react";
|
|
4205
|
-
import { useCallback as
|
|
4798
|
+
import { useCallback as useCallback8, useEffect as useEffect12, useRef as useRef13 } from "react";
|
|
4206
4799
|
|
|
4207
4800
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderGroup.tsx
|
|
4208
4801
|
import {
|
|
4209
|
-
createElement as
|
|
4802
|
+
createElement as createElement16
|
|
4210
4803
|
} from "react";
|
|
4211
4804
|
var TableHeaderGroupClassName = `${rootClassName2}HeaderGroup`;
|
|
4212
4805
|
function InfiniteTableHeaderGroup(props) {
|
|
@@ -4217,35 +4810,35 @@ function InfiniteTableHeaderGroup(props) {
|
|
|
4217
4810
|
columnGroup
|
|
4218
4811
|
});
|
|
4219
4812
|
}
|
|
4220
|
-
return /* @__PURE__ */
|
|
4813
|
+
return /* @__PURE__ */ createElement16("div", {
|
|
4221
4814
|
ref: props.domRef,
|
|
4222
4815
|
"data-group-id": columnGroup.uniqueGroupId,
|
|
4223
4816
|
className: join(HeaderGroupCls, TableHeaderGroupClassName),
|
|
4224
4817
|
style: { width, height }
|
|
4225
|
-
}, /* @__PURE__ */
|
|
4818
|
+
}, /* @__PURE__ */ createElement16("div", {
|
|
4226
4819
|
className: join(`${TableHeaderGroupClassName}__header-content`, cssEllipsisClassName)
|
|
4227
4820
|
}, header));
|
|
4228
4821
|
}
|
|
4229
4822
|
|
|
4230
4823
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
|
|
4231
|
-
var { rootClassName:
|
|
4232
|
-
var TableHeaderClassName = `${
|
|
4824
|
+
var { rootClassName: rootClassName8 } = internalProps;
|
|
4825
|
+
var TableHeaderClassName = `${rootClassName8}Header`;
|
|
4233
4826
|
function InfiniteTableHeaderFn(props) {
|
|
4234
4827
|
const {
|
|
4235
4828
|
brain,
|
|
4236
4829
|
columns,
|
|
4237
4830
|
style,
|
|
4238
4831
|
className,
|
|
4239
|
-
|
|
4832
|
+
columnHeaderHeight,
|
|
4240
4833
|
columnAndGroupTreeInfo,
|
|
4241
4834
|
columnGroupsMaxDepth
|
|
4242
4835
|
} = props;
|
|
4243
4836
|
const {
|
|
4244
4837
|
computed,
|
|
4245
|
-
componentState: { headerBrain }
|
|
4838
|
+
componentState: { headerBrain, headerOptions }
|
|
4246
4839
|
} = useInfiniteTable();
|
|
4247
|
-
const { computedVisibleColumnsMap } = computed;
|
|
4248
|
-
|
|
4840
|
+
const { computedVisibleColumnsMap, showColumnFilters } = computed;
|
|
4841
|
+
useEffect12(() => {
|
|
4249
4842
|
const onScroll = (scrollPosition) => {
|
|
4250
4843
|
if (domRef.current) {
|
|
4251
4844
|
domRef.current.style.transform = `translate3d(-${scrollPosition.scrollLeft}px, 0px, 0px)`;
|
|
@@ -4254,7 +4847,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4254
4847
|
const removeOnScroll = brain.onScroll(onScroll);
|
|
4255
4848
|
return removeOnScroll;
|
|
4256
4849
|
}, [brain]);
|
|
4257
|
-
const domRef =
|
|
4850
|
+
const domRef = useRef13(null);
|
|
4258
4851
|
const headerCls = HeaderClsRecipe({
|
|
4259
4852
|
overflow: false,
|
|
4260
4853
|
virtualized: true
|
|
@@ -4262,9 +4855,9 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4262
4855
|
const domProps = {
|
|
4263
4856
|
ref: domRef,
|
|
4264
4857
|
className: join(TableHeaderClassName, `${TableHeaderClassName}--virtualized`, className, headerCls),
|
|
4265
|
-
style: __spreadProps(__spreadValues({}, style), { height:
|
|
4858
|
+
style: __spreadProps(__spreadValues({}, style), { height: columnHeaderHeight })
|
|
4266
4859
|
};
|
|
4267
|
-
const renderCell =
|
|
4860
|
+
const renderCell = useCallback8((params) => {
|
|
4268
4861
|
const {
|
|
4269
4862
|
rowIndex,
|
|
4270
4863
|
colIndex,
|
|
@@ -4289,7 +4882,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4289
4882
|
computedWidth: colGroupItem.computedWidth,
|
|
4290
4883
|
groupOffset: colGroupItem.groupOffset
|
|
4291
4884
|
});
|
|
4292
|
-
return /* @__PURE__ */
|
|
4885
|
+
return /* @__PURE__ */ createElement17(InfiniteTableHeaderGroup, {
|
|
4293
4886
|
domRef: domRef2,
|
|
4294
4887
|
columns: columns2,
|
|
4295
4888
|
width: widthWithColspan,
|
|
@@ -4297,21 +4890,29 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4297
4890
|
columnGroup: computedColumnGroup
|
|
4298
4891
|
});
|
|
4299
4892
|
}
|
|
4300
|
-
return /* @__PURE__ */
|
|
4893
|
+
return /* @__PURE__ */ createElement17(InfiniteTableHeaderCell, {
|
|
4301
4894
|
domRef: domRef2,
|
|
4302
4895
|
column,
|
|
4896
|
+
headerOptions,
|
|
4303
4897
|
width: widthWithColspan,
|
|
4304
4898
|
height: heightWithRowspan,
|
|
4305
4899
|
columns: computedVisibleColumnsMap
|
|
4306
4900
|
});
|
|
4307
|
-
}, [
|
|
4308
|
-
|
|
4901
|
+
}, [
|
|
4902
|
+
headerOptions,
|
|
4903
|
+
columns,
|
|
4904
|
+
columnHeaderHeight,
|
|
4905
|
+
columnAndGroupTreeInfo,
|
|
4906
|
+
columnGroupsMaxDepth,
|
|
4907
|
+
showColumnFilters
|
|
4908
|
+
]);
|
|
4909
|
+
return /* @__PURE__ */ createElement17("div", __spreadValues({}, domProps), /* @__PURE__ */ createElement17(RawTable, {
|
|
4309
4910
|
renderCell,
|
|
4310
4911
|
brain: headerBrain,
|
|
4311
4912
|
cellHoverClassNames: []
|
|
4312
4913
|
}));
|
|
4313
4914
|
}
|
|
4314
|
-
var InfiniteTableHeader =
|
|
4915
|
+
var InfiniteTableHeader = memo8(InfiniteTableHeaderFn);
|
|
4315
4916
|
|
|
4316
4917
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx
|
|
4317
4918
|
function TableHeaderWrapper(props) {
|
|
@@ -4321,25 +4922,26 @@ function TableHeaderWrapper(props) {
|
|
|
4321
4922
|
computedPinnedStartColumns,
|
|
4322
4923
|
computedPinnedEndColumns,
|
|
4323
4924
|
computedVisibleColumns,
|
|
4324
|
-
columnSize
|
|
4925
|
+
columnSize,
|
|
4926
|
+
showColumnFilters
|
|
4325
4927
|
} = tableContextValue.computed;
|
|
4326
4928
|
const {
|
|
4327
4929
|
componentState: {
|
|
4328
|
-
|
|
4930
|
+
columnHeaderHeight,
|
|
4329
4931
|
columnGroupsDepthsMap,
|
|
4330
4932
|
columnGroupsMaxDepth,
|
|
4331
4933
|
computedColumnGroups
|
|
4332
4934
|
}
|
|
4333
4935
|
} = tableContextValue;
|
|
4334
4936
|
const rows = !computedColumnGroups || !computedColumnGroups.size ? 1 : columnGroupsMaxDepth + 2;
|
|
4335
|
-
const height = rows *
|
|
4336
|
-
const columnAndGroupTreeInfo =
|
|
4937
|
+
const height = rows * columnHeaderHeight + (showColumnFilters ? columnHeaderHeight : 0);
|
|
4938
|
+
const columnAndGroupTreeInfo = useMemo6(() => {
|
|
4337
4939
|
if (!computedColumnGroups || !computedColumnGroups.size) {
|
|
4338
4940
|
return void 0;
|
|
4339
4941
|
}
|
|
4340
4942
|
return buildColumnAndGroupTree(computedVisibleColumns, computedColumnGroups, columnGroupsDepthsMap, columnGroupsMaxDepth);
|
|
4341
4943
|
}, [computedVisibleColumns, computedColumnGroups, columnGroupsDepthsMap]);
|
|
4342
|
-
const cellspan =
|
|
4944
|
+
const cellspan = useCallback9(({ rowIndex, colIndex }) => {
|
|
4343
4945
|
const column = computedVisibleColumns[colIndex];
|
|
4344
4946
|
const rowspan2 = 1;
|
|
4345
4947
|
const colspan2 = 1;
|
|
@@ -4372,11 +4974,14 @@ function TableHeaderWrapper(props) {
|
|
|
4372
4974
|
rows,
|
|
4373
4975
|
columnGroupsDepthsMap
|
|
4374
4976
|
]);
|
|
4375
|
-
const rowspan =
|
|
4376
|
-
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]);
|
|
4377
4982
|
useMatrixBrain(brain, {
|
|
4378
4983
|
colWidth: columnSize,
|
|
4379
|
-
rowHeight
|
|
4984
|
+
rowHeight,
|
|
4380
4985
|
rows,
|
|
4381
4986
|
cols: computedVisibleColumns.length,
|
|
4382
4987
|
height,
|
|
@@ -4386,21 +4991,21 @@ function TableHeaderWrapper(props) {
|
|
|
4386
4991
|
fixedColsEnd: computedPinnedEndColumns.length,
|
|
4387
4992
|
fixedColsStart: computedPinnedStartColumns.length
|
|
4388
4993
|
});
|
|
4389
|
-
const header = /* @__PURE__ */
|
|
4994
|
+
const header = /* @__PURE__ */ createElement18(InfiniteTableHeader, {
|
|
4390
4995
|
columns: computedVisibleColumns,
|
|
4391
4996
|
brain,
|
|
4392
|
-
|
|
4997
|
+
columnHeaderHeight: height,
|
|
4393
4998
|
columnGroupsMaxDepth,
|
|
4394
4999
|
columnAndGroupTreeInfo
|
|
4395
5000
|
});
|
|
4396
|
-
const verticalScrollbarPlaceholder = scrollbars.vertical && getScrollbarWidth() ? /* @__PURE__ */
|
|
5001
|
+
const verticalScrollbarPlaceholder = scrollbars.vertical && getScrollbarWidth() ? /* @__PURE__ */ createElement18("div", {
|
|
4397
5002
|
className: HeaderScrollbarPlaceholderCls,
|
|
4398
5003
|
style: {
|
|
4399
5004
|
zIndex: 1e3,
|
|
4400
5005
|
width: getScrollbarWidth()
|
|
4401
5006
|
}
|
|
4402
5007
|
}) : null;
|
|
4403
|
-
return /* @__PURE__ */
|
|
5008
|
+
return /* @__PURE__ */ createElement18("div", {
|
|
4404
5009
|
className: HeaderWrapperCls,
|
|
4405
5010
|
style: {
|
|
4406
5011
|
height
|
|
@@ -4410,12 +5015,12 @@ function TableHeaderWrapper(props) {
|
|
|
4410
5015
|
|
|
4411
5016
|
// src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
|
|
4412
5017
|
import {
|
|
4413
|
-
createElement as
|
|
4414
|
-
forwardRef as
|
|
4415
|
-
useCallback as
|
|
4416
|
-
useRef as
|
|
5018
|
+
createElement as createElement19,
|
|
5019
|
+
forwardRef as forwardRef4,
|
|
5020
|
+
useCallback as useCallback10,
|
|
5021
|
+
useRef as useRef14
|
|
4417
5022
|
} from "react";
|
|
4418
|
-
import { useEffect as
|
|
5023
|
+
import { useEffect as useEffect13 } from "react";
|
|
4419
5024
|
|
|
4420
5025
|
// src/components/utils/decamelize.ts
|
|
4421
5026
|
function decamelize(str, options) {
|
|
@@ -4424,14 +5029,14 @@ function decamelize(str, options) {
|
|
|
4424
5029
|
}
|
|
4425
5030
|
|
|
4426
5031
|
// src/components/InfiniteTable/theme.css.ts
|
|
4427
|
-
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)", activeBorderColor: "var(--infinite-active-cell-border-color)", activeBackgroundFromBorder: "var(--infinite-active-cell-background-from-border)", activeBackground: "var(--infinite-active-cell-background)", activeBorderWidth: "var(--infinite-active-cell-border-width)", activeBorderStyle: "var(--infinite-active-cell-border-style)", activeBorder: "var(--infinite-active-cell-border)" }, Row: { background: "var(--infinite-row-background)", oddBackground: "var(--infinite-row-odd-background)", activeBorderColor: "var(--infinite-active-row-border-color)", activeBackground: "var(--infinite-active-row-background)", activeBackgroundFromBorder: "var(--infinite-active-row-background-from-border)", activeBorderWidth: "var(--infinite-active-row-border-width)", activeBorderStyle: "var(--infinite-active-row-border-style)", activeBorder: "var(--infinite-active-row-border)", hoverBackground: "var(--infinite-row-hover-background)", groupRowBackground: "var(--infinite-group-row-background)", groupRowColumnNesting: "var(--infinite-group-row-column-nesting)", groupNesting: "var(--infinite-dont-override-group-row-nesting-length)", pointerEventsWhileScrolling: "var(--infinite-row-pointer-events-while-scrolling)" }, ColumnCell: { background: "var(--infinite-column-cell-bg-dont-override)" } } };
|
|
4428
5033
|
|
|
4429
5034
|
// src/components/InfiniteTable/InfiniteCls.css.ts
|
|
4430
5035
|
var import_createRuntimeFn3 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
4431
5036
|
var FooterCls = "_16lm1iw1";
|
|
4432
|
-
var InfiniteCls = "_1yeub2v0 _16lm1iw1
|
|
5037
|
+
var InfiniteCls = "_1yeub2v0 _16lm1iw1 _16lm1iwm _16lm1iw12 _16lm1iw0";
|
|
4433
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: [] });
|
|
4434
|
-
var InfiniteClsShiftingColumns = "
|
|
5039
|
+
var InfiniteClsShiftingColumns = "_16lm1iwp";
|
|
4435
5040
|
var PinnedRowsContainerClsVariants = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "", variantClassNames: { pinned: { start: "_1yeub2vh", end: "_1yeub2vi", false: "_1yeub2vj" } }, defaultVariants: {}, compoundVariants: [] });
|
|
4436
5041
|
|
|
4437
5042
|
// src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
|
|
@@ -4461,10 +5066,10 @@ var enforceStyle = (node, style) => {
|
|
|
4461
5066
|
node.style.setProperty(decamelize(propertyName), propertyValue, "important");
|
|
4462
5067
|
}
|
|
4463
5068
|
};
|
|
4464
|
-
var InfiniteTableLicenseFooter =
|
|
4465
|
-
const { rootClassName:
|
|
4466
|
-
const domRef =
|
|
4467
|
-
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) => {
|
|
4468
5073
|
domRef.current = node;
|
|
4469
5074
|
if (!ref) {
|
|
4470
5075
|
return;
|
|
@@ -4475,7 +5080,7 @@ var InfiniteTableLicenseFooter = forwardRef3(function InfiniteTableLicenseFooter
|
|
|
4475
5080
|
ref.current = node;
|
|
4476
5081
|
}
|
|
4477
5082
|
}, []);
|
|
4478
|
-
|
|
5083
|
+
useEffect13(() => {
|
|
4479
5084
|
const forceStyle = () => {
|
|
4480
5085
|
requestAnimationFrame(() => {
|
|
4481
5086
|
var _a;
|
|
@@ -4489,12 +5094,12 @@ var InfiniteTableLicenseFooter = forwardRef3(function InfiniteTableLicenseFooter
|
|
|
4489
5094
|
clearInterval(intervalId);
|
|
4490
5095
|
};
|
|
4491
5096
|
}, []);
|
|
4492
|
-
return /* @__PURE__ */
|
|
5097
|
+
return /* @__PURE__ */ createElement19("div", __spreadProps(__spreadValues({
|
|
4493
5098
|
ref: domCallback
|
|
4494
5099
|
}, props), {
|
|
4495
|
-
className: join(`${
|
|
5100
|
+
className: join(`${rootClassName11}-Footer`, FooterCls, props.className),
|
|
4496
5101
|
style: defaultStyle
|
|
4497
|
-
}), "Powered by", " ", /* @__PURE__ */
|
|
5102
|
+
}), "Powered by", " ", /* @__PURE__ */ createElement19("a", {
|
|
4498
5103
|
href: "https://infinite-table.com",
|
|
4499
5104
|
rel: "noopener noreferrer",
|
|
4500
5105
|
role: "link",
|
|
@@ -4505,13 +5110,13 @@ var InfiniteTableLicenseFooter = forwardRef3(function InfiniteTableLicenseFooter
|
|
|
4505
5110
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableColumnCell.tsx
|
|
4506
5111
|
import {
|
|
4507
5112
|
createContext as createContext5,
|
|
4508
|
-
createElement as
|
|
4509
|
-
memo as
|
|
5113
|
+
createElement as createElement20,
|
|
5114
|
+
memo as memo9
|
|
4510
5115
|
} from "react";
|
|
4511
|
-
import { useContext as useContext6 } from "react";
|
|
4512
|
-
var { rootClassName:
|
|
5116
|
+
import { useCallback as useCallback11, useContext as useContext6, useMemo as useMemo7 } from "react";
|
|
5117
|
+
var { rootClassName: rootClassName9 } = internalProps;
|
|
4513
5118
|
var InfiniteTableColumnCellContext = createContext5(null);
|
|
4514
|
-
var InfiniteTableColumnCellClassName = `${
|
|
5119
|
+
var InfiniteTableColumnCellClassName = `${rootClassName9}ColumnCell`;
|
|
4515
5120
|
function isColumnWithField(c) {
|
|
4516
5121
|
return typeof c.field === "string";
|
|
4517
5122
|
}
|
|
@@ -4535,7 +5140,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
4535
5140
|
showZebraRows
|
|
4536
5141
|
} = props;
|
|
4537
5142
|
if (!column) {
|
|
4538
|
-
return /* @__PURE__ */
|
|
5143
|
+
return /* @__PURE__ */ createElement20("div", {
|
|
4539
5144
|
ref: domRef
|
|
4540
5145
|
}, "no column");
|
|
4541
5146
|
}
|
|
@@ -4544,33 +5149,62 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
4544
5149
|
const groupRowInfo = null;
|
|
4545
5150
|
let value = isGroupRow && groupBy && column.groupByField ? rowInfo.value : isColumnWithField(column) ? data == null ? void 0 : data[column.field] : null;
|
|
4546
5151
|
if (column.valueGetter) {
|
|
4547
|
-
|
|
5152
|
+
if (!rowInfo.isGroupRow && rowInfo.data) {
|
|
5153
|
+
value = column.valueGetter({ data: rowInfo.data, field: column.field });
|
|
5154
|
+
}
|
|
5155
|
+
}
|
|
5156
|
+
if (column.valueFormatter) {
|
|
5157
|
+
value = column.valueFormatter(isGroupRow ? {
|
|
4548
5158
|
data: rowInfo.data,
|
|
4549
5159
|
isGroupRow,
|
|
4550
|
-
rowInfo
|
|
5160
|
+
rowInfo,
|
|
5161
|
+
field: column.field,
|
|
5162
|
+
value
|
|
4551
5163
|
} : {
|
|
4552
5164
|
data: rowInfo.data,
|
|
4553
5165
|
isGroupRow,
|
|
4554
|
-
rowInfo
|
|
5166
|
+
rowInfo,
|
|
5167
|
+
field: column.field,
|
|
5168
|
+
value
|
|
4555
5169
|
});
|
|
4556
5170
|
}
|
|
5171
|
+
const { getState, componentActions } = useInfiniteTable();
|
|
5172
|
+
const { activeRowIndex } = getState();
|
|
5173
|
+
const rowActive = rowIndex === activeRowIndex;
|
|
5174
|
+
const onClick = useCallback11(() => {
|
|
5175
|
+
const { activeRowIndex: activeRowIndex2, activeCellIndex } = getState();
|
|
5176
|
+
if (activeRowIndex2 != null) {
|
|
5177
|
+
componentActions.activeRowIndex = rowIndex;
|
|
5178
|
+
return;
|
|
5179
|
+
}
|
|
5180
|
+
if (activeCellIndex != null) {
|
|
5181
|
+
componentActions.activeCellIndex = [
|
|
5182
|
+
rowIndex,
|
|
5183
|
+
column.computedVisibleIndex
|
|
5184
|
+
];
|
|
5185
|
+
}
|
|
5186
|
+
}, [rowIndex, column.computedVisibleIndex]);
|
|
4557
5187
|
const { componentState: computedDataSource } = useDataSourceContextValue();
|
|
4558
5188
|
const rest = rowInfo.isGroupRow ? {
|
|
4559
5189
|
rowInfo,
|
|
4560
5190
|
isGroupRow: rowInfo.isGroupRow,
|
|
4561
|
-
data: rowInfo.data
|
|
5191
|
+
data: rowInfo.data,
|
|
5192
|
+
rowActive,
|
|
5193
|
+
value,
|
|
5194
|
+
field: column.field
|
|
4562
5195
|
} : {
|
|
4563
5196
|
rowInfo,
|
|
4564
5197
|
isGroupRow: rowInfo.isGroupRow,
|
|
4565
|
-
data: rowInfo.data
|
|
5198
|
+
data: rowInfo.data,
|
|
5199
|
+
rowActive,
|
|
5200
|
+
value,
|
|
5201
|
+
field: column.field
|
|
4566
5202
|
};
|
|
4567
5203
|
const stylingRenderParam = __spreadValues({
|
|
4568
|
-
value,
|
|
4569
5204
|
column
|
|
4570
5205
|
}, rest);
|
|
4571
5206
|
const renderValue = value;
|
|
4572
5207
|
const renderParam = __spreadProps(__spreadValues({
|
|
4573
|
-
value,
|
|
4574
5208
|
column,
|
|
4575
5209
|
domRef,
|
|
4576
5210
|
groupRowInfo
|
|
@@ -4578,28 +5212,28 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
4578
5212
|
isGroupRow,
|
|
4579
5213
|
rowIndex,
|
|
4580
5214
|
toggleGroupRow,
|
|
4581
|
-
toggleCurrentGroupRow: () => {
|
|
5215
|
+
toggleCurrentGroupRow: useCallback11(() => {
|
|
4582
5216
|
if (!rowInfo.isGroupRow) {
|
|
4583
5217
|
return;
|
|
4584
5218
|
}
|
|
4585
5219
|
toggleGroupRow(rowInfo.groupKeys);
|
|
4586
|
-
},
|
|
5220
|
+
}, []),
|
|
4587
5221
|
groupBy: computedDataSource.groupBy,
|
|
4588
5222
|
pivotBy: computedDataSource.pivotBy
|
|
4589
5223
|
});
|
|
4590
|
-
const renderChildren = () => {
|
|
5224
|
+
const renderChildren = useCallback11(() => {
|
|
4591
5225
|
if (hidden) {
|
|
4592
5226
|
return null;
|
|
4593
5227
|
}
|
|
4594
5228
|
const renderFn = column.render || column.renderValue;
|
|
4595
5229
|
if (renderFn) {
|
|
4596
|
-
return /* @__PURE__ */
|
|
5230
|
+
return /* @__PURE__ */ createElement20(RenderHookComponent, {
|
|
4597
5231
|
render: renderFn,
|
|
4598
5232
|
renderParam
|
|
4599
5233
|
});
|
|
4600
5234
|
}
|
|
4601
5235
|
return renderValue;
|
|
4602
|
-
};
|
|
5236
|
+
}, [column, hidden, ...Object.values(renderParam)]);
|
|
4603
5237
|
const rowPropsAndStyleArgs = __spreadProps(__spreadValues({}, rest), {
|
|
4604
5238
|
rowIndex
|
|
4605
5239
|
});
|
|
@@ -4612,6 +5246,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
4612
5246
|
style = column.style ? typeof column.style === "function" ? __spreadValues(__spreadValues({}, style), column.style(stylingRenderParam) || {}) : __spreadValues(__spreadValues({}, style), column.style) : style || {};
|
|
4613
5247
|
style.width = width;
|
|
4614
5248
|
style.height = rowHeight;
|
|
5249
|
+
const memoizedStyle = useMemo7(() => style, [!style ? null : JSON.stringify(style)]);
|
|
4615
5250
|
const odd = (rowInfo.indexInAll != null ? rowInfo.indexInAll : rowIndex) % 2 === 1;
|
|
4616
5251
|
const zebra = showZebraRows ? odd ? "odd" : "even" : false;
|
|
4617
5252
|
const cellProps = {
|
|
@@ -4621,19 +5256,20 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
4621
5256
|
column,
|
|
4622
5257
|
width,
|
|
4623
5258
|
offset: virtualized ? 0 : column.computedPinningOffset,
|
|
4624
|
-
style,
|
|
5259
|
+
style: memoizedStyle,
|
|
4625
5260
|
onMouseLeave,
|
|
4626
5261
|
onMouseEnter,
|
|
5262
|
+
onClick,
|
|
4627
5263
|
cssEllipsis: (_a = column.cssEllipsis) != null ? _a : true,
|
|
4628
|
-
className: join(useCellClassName(column, [InfiniteTableColumnCellClassName, InfiniteTableCellClassName], ColumnCellRecipe, { dragging: false, zebra }), colClassName, rowComputedClassName),
|
|
5264
|
+
className: join(useCellClassName(column, [InfiniteTableColumnCellClassName, InfiniteTableCellClassName], ColumnCellRecipe, { dragging: false, zebra, rowActive }), colClassName, rowComputedClassName),
|
|
4629
5265
|
renderChildren
|
|
4630
5266
|
};
|
|
4631
5267
|
const ContextProvider = InfiniteTableColumnCellContext.Provider;
|
|
4632
|
-
return /* @__PURE__ */
|
|
5268
|
+
return /* @__PURE__ */ createElement20(ContextProvider, {
|
|
4633
5269
|
value: renderParam
|
|
4634
|
-
}, /* @__PURE__ */
|
|
5270
|
+
}, /* @__PURE__ */ createElement20(InfiniteTableCell, __spreadValues({}, cellProps)));
|
|
4635
5271
|
}
|
|
4636
|
-
var InfiniteTableColumnCell =
|
|
5272
|
+
var InfiniteTableColumnCell = memo9(InfiniteTableColumnCellFn);
|
|
4637
5273
|
function useInfiniteColumnCell() {
|
|
4638
5274
|
const result = useContext6(InfiniteTableColumnCellContext);
|
|
4639
5275
|
return result;
|
|
@@ -4647,35 +5283,97 @@ var RowHoverCls = "_7pupv01";
|
|
|
4647
5283
|
|
|
4648
5284
|
// src/components/InfiniteTable/components/LoadMask.tsx
|
|
4649
5285
|
import {
|
|
4650
|
-
createElement as
|
|
4651
|
-
memo as
|
|
5286
|
+
createElement as createElement21,
|
|
5287
|
+
memo as memo10
|
|
4652
5288
|
} from "react";
|
|
4653
5289
|
|
|
4654
5290
|
// src/components/InfiniteTable/components/LoadMask.css.ts
|
|
4655
|
-
var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2
|
|
4656
|
-
var LoadMaskOverlayCls = "qy58ya3 _16lm1iw2
|
|
5291
|
+
var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2 _16lm1iwu _16lm1iww _16lm1iw10 _16lm1iwy", hidden: "qy58ya2 qy58ya0 _16lm1iw2 _16lm1iwu _16lm1iww _16lm1iw10 _16lm1iwy" };
|
|
5292
|
+
var LoadMaskOverlayCls = "qy58ya3 _16lm1iw2 _16lm1iwu _16lm1iww _16lm1iw10 _16lm1iwy";
|
|
4657
5293
|
var LoadMaskTextCls = "qy58ya4";
|
|
4658
5294
|
|
|
4659
5295
|
// src/components/InfiniteTable/components/LoadMask.tsx
|
|
4660
|
-
var { rootClassName:
|
|
4661
|
-
var
|
|
5296
|
+
var { rootClassName: rootClassName10 } = internalProps;
|
|
5297
|
+
var baseCls3 = `${rootClassName10}-LoadMask`;
|
|
4662
5298
|
function LoadMaskFn(props) {
|
|
4663
5299
|
const { visible, children = "Loading" } = props;
|
|
4664
|
-
return /* @__PURE__ */
|
|
4665
|
-
className: `${LoadMaskCls[visible ? "visible" : "hidden"]} ${
|
|
4666
|
-
}, /* @__PURE__ */
|
|
4667
|
-
className: `${LoadMaskOverlayCls} ${
|
|
4668
|
-
}), /* @__PURE__ */
|
|
4669
|
-
className: `${LoadMaskTextCls} ${
|
|
5300
|
+
return /* @__PURE__ */ createElement21("div", {
|
|
5301
|
+
className: `${LoadMaskCls[visible ? "visible" : "hidden"]} ${baseCls3}`
|
|
5302
|
+
}, /* @__PURE__ */ createElement21("div", {
|
|
5303
|
+
className: `${LoadMaskOverlayCls} ${baseCls3}-Overlay`
|
|
5304
|
+
}), /* @__PURE__ */ createElement21("div", {
|
|
5305
|
+
className: `${LoadMaskTextCls} ${baseCls3}-Text`
|
|
4670
5306
|
}, children));
|
|
4671
5307
|
}
|
|
4672
|
-
var LoadMask =
|
|
5308
|
+
var LoadMask = memo10(LoadMaskFn);
|
|
5309
|
+
|
|
5310
|
+
// src/components/InfiniteTable/getImperativeApi.ts
|
|
5311
|
+
function getImperativeApi(getState, getComputed, getDataSourceState, componentActions) {
|
|
5312
|
+
const imperativeApi = {
|
|
5313
|
+
setColumnOrder: (columnOrder) => {
|
|
5314
|
+
componentActions.columnOrder = columnOrder;
|
|
5315
|
+
},
|
|
5316
|
+
setColumnVisibility: (columnVisibility) => {
|
|
5317
|
+
componentActions.columnVisibility = columnVisibility;
|
|
5318
|
+
},
|
|
5319
|
+
getState,
|
|
5320
|
+
getDataSourceState,
|
|
5321
|
+
scrollRowIntoView(rowIndex, config = { offset: 0 }) {
|
|
5322
|
+
const state = getState();
|
|
5323
|
+
const scrollPosition = state.renderer.getScrollPositionForScrollRowIntoView(rowIndex, config);
|
|
5324
|
+
const currentScrollPosition = state.brain.getScrollPosition();
|
|
5325
|
+
if (scrollPosition.scrollTop !== currentScrollPosition.scrollTop) {
|
|
5326
|
+
state.scrollerDOMRef.current.scrollTop = scrollPosition.scrollTop;
|
|
5327
|
+
}
|
|
5328
|
+
},
|
|
5329
|
+
scrollColumnIntoView(colId, config = { offset: 0 }) {
|
|
5330
|
+
const state = getState();
|
|
5331
|
+
const computed = getComputed();
|
|
5332
|
+
const computedColumn = computed.computedVisibleColumnsMap.get(colId);
|
|
5333
|
+
if (!computedColumn) {
|
|
5334
|
+
return;
|
|
5335
|
+
}
|
|
5336
|
+
const colIndex = computedColumn.computedVisibleIndex;
|
|
5337
|
+
const scrollPosition = state.renderer.getScrollPositionForScrollColumnIntoView(colIndex, config);
|
|
5338
|
+
const currentScrollPosition = state.brain.getScrollPosition();
|
|
5339
|
+
if (scrollPosition.scrollLeft !== currentScrollPosition.scrollLeft) {
|
|
5340
|
+
state.scrollerDOMRef.current.scrollLeft = scrollPosition.scrollLeft;
|
|
5341
|
+
}
|
|
5342
|
+
},
|
|
5343
|
+
scrollCellIntoView(rowIndex, colIdOrIndex, config = { offset: 0 }) {
|
|
5344
|
+
const state = getState();
|
|
5345
|
+
const computed = getComputed();
|
|
5346
|
+
let colIndex = colIdOrIndex;
|
|
5347
|
+
if (typeof colIdOrIndex === "string") {
|
|
5348
|
+
const computedColumn = computed.computedVisibleColumnsMap.get(colIdOrIndex);
|
|
5349
|
+
if (!computedColumn) {
|
|
5350
|
+
return;
|
|
5351
|
+
}
|
|
5352
|
+
colIndex = computedColumn.computedVisibleIndex;
|
|
5353
|
+
}
|
|
5354
|
+
const scrollPositionForCol = state.renderer.getScrollPositionForScrollColumnIntoView(colIndex, config);
|
|
5355
|
+
const scrollPositionForRow = state.renderer.getScrollPositionForScrollRowIntoView(rowIndex, config);
|
|
5356
|
+
const newScrollPosition = {
|
|
5357
|
+
scrollLeft: scrollPositionForCol.scrollLeft,
|
|
5358
|
+
scrollTop: scrollPositionForRow.scrollTop
|
|
5359
|
+
};
|
|
5360
|
+
const currentScrollPosition = state.brain.getScrollPosition();
|
|
5361
|
+
if (newScrollPosition.scrollLeft !== currentScrollPosition.scrollLeft) {
|
|
5362
|
+
state.scrollerDOMRef.current.scrollLeft = newScrollPosition.scrollLeft;
|
|
5363
|
+
}
|
|
5364
|
+
if (newScrollPosition.scrollTop !== currentScrollPosition.scrollTop) {
|
|
5365
|
+
state.scrollerDOMRef.current.scrollTop = newScrollPosition.scrollTop;
|
|
5366
|
+
}
|
|
5367
|
+
}
|
|
5368
|
+
};
|
|
5369
|
+
return imperativeApi;
|
|
5370
|
+
}
|
|
4673
5371
|
|
|
4674
5372
|
// src/components/InfiniteTable/hooks/useAutoSizeColumns.ts
|
|
4675
5373
|
import {
|
|
4676
|
-
useEffect as
|
|
4677
|
-
useRef as
|
|
4678
|
-
useState as
|
|
5374
|
+
useEffect as useEffect14,
|
|
5375
|
+
useRef as useRef15,
|
|
5376
|
+
useState as useState10
|
|
4679
5377
|
} from "react";
|
|
4680
5378
|
var OFFSET = 10;
|
|
4681
5379
|
function getColumnContentMaxWidths(domRef, options) {
|
|
@@ -4698,6 +5396,7 @@ function getColumnContentMaxWidths(domRef, options) {
|
|
|
4698
5396
|
contentClone.style.pointerEvents = "none";
|
|
4699
5397
|
contentClone.classList.remove(...cssEllipsisClassName.split(" "));
|
|
4700
5398
|
contentClone.style.position = "absolute";
|
|
5399
|
+
contentClone.style.width = "auto";
|
|
4701
5400
|
cell.appendChild(contentClone);
|
|
4702
5401
|
let measuredWidth = contentClone.offsetWidth;
|
|
4703
5402
|
cell.removeChild(contentClone);
|
|
@@ -4735,11 +5434,11 @@ function useAutoSizeColumns() {
|
|
|
4735
5434
|
componentActions,
|
|
4736
5435
|
componentState: { domRef, ready, autoSizeColumnsKey, brain }
|
|
4737
5436
|
} = useComponentState();
|
|
4738
|
-
const [refreshId, setRefreshId] =
|
|
5437
|
+
const [refreshId, setRefreshId] = useState10(0);
|
|
4739
5438
|
const theKey = typeof autoSizeColumnsKey === "object" ? autoSizeColumnsKey.key : autoSizeColumnsKey;
|
|
4740
5439
|
const getTheKey = useLatest(theKey);
|
|
4741
|
-
const lastExecutedIdentifierRef =
|
|
4742
|
-
|
|
5440
|
+
const lastExecutedIdentifierRef = useRef15(null);
|
|
5441
|
+
useEffect14(() => {
|
|
4743
5442
|
const key = getTheKey();
|
|
4744
5443
|
if (key == null) {
|
|
4745
5444
|
return;
|
|
@@ -4752,7 +5451,7 @@ function useAutoSizeColumns() {
|
|
|
4752
5451
|
};
|
|
4753
5452
|
return brain.onRenderRangeChange(onChange);
|
|
4754
5453
|
}, [brain]);
|
|
4755
|
-
|
|
5454
|
+
useEffect14(() => {
|
|
4756
5455
|
var _a;
|
|
4757
5456
|
if (theKey == null) {
|
|
4758
5457
|
return;
|
|
@@ -4797,20 +5496,8 @@ function useAutoSizeColumns() {
|
|
|
4797
5496
|
}
|
|
4798
5497
|
|
|
4799
5498
|
// src/components/InfiniteTable/hooks/useCellRendering.tsx
|
|
4800
|
-
import { useCallback as
|
|
4801
|
-
import
|
|
4802
|
-
|
|
4803
|
-
// src/components/hooks/useRerender.ts
|
|
4804
|
-
import { useCallback as useCallback10, useState as useState7 } from "react";
|
|
4805
|
-
var useRerender = () => {
|
|
4806
|
-
const [state, setState] = useState7(0);
|
|
4807
|
-
return [
|
|
4808
|
-
state,
|
|
4809
|
-
useCallback10(() => {
|
|
4810
|
-
setState((state2) => state2 + 1);
|
|
4811
|
-
}, [setState])
|
|
4812
|
-
];
|
|
4813
|
-
};
|
|
5499
|
+
import { useCallback as useCallback12, useEffect as useEffect15, useRef as useRef16 } from "react";
|
|
5500
|
+
import React27 from "react";
|
|
4814
5501
|
|
|
4815
5502
|
// src/components/InfiniteTable/hooks/useYourBrain.ts
|
|
4816
5503
|
function useYourBrain(param) {
|
|
@@ -4840,7 +5527,7 @@ function useYourBrain(param) {
|
|
|
4840
5527
|
// src/components/InfiniteTable/hooks/useCellRendering.tsx
|
|
4841
5528
|
var SCROLL_BOTTOM_OFFSET = 1;
|
|
4842
5529
|
function useCellRendering(param) {
|
|
4843
|
-
const { computed, bodySize } = param;
|
|
5530
|
+
const { computed, bodySize, imperativeApi } = param;
|
|
4844
5531
|
const { componentActions, componentState, getState } = useInfiniteTable();
|
|
4845
5532
|
const {
|
|
4846
5533
|
computedPinnedStartColumns,
|
|
@@ -4880,13 +5567,13 @@ function useCellRendering(param) {
|
|
|
4880
5567
|
bodySize,
|
|
4881
5568
|
rowspan
|
|
4882
5569
|
});
|
|
4883
|
-
const scrollTopMaxRef =
|
|
4884
|
-
|
|
5570
|
+
const scrollTopMaxRef = useRef16(0);
|
|
5571
|
+
useEffect15(() => {
|
|
4885
5572
|
return brain.onRenderCountChange(() => {
|
|
4886
5573
|
scrollTopMaxRef.current = brain.scrollTopMax;
|
|
4887
5574
|
});
|
|
4888
5575
|
}, [brain]);
|
|
4889
|
-
|
|
5576
|
+
useEffect15(() => {
|
|
4890
5577
|
return brain.onScrollStop((scrollPosition) => {
|
|
4891
5578
|
const { scrollTop } = scrollPosition;
|
|
4892
5579
|
if (scrollTop === 0) {
|
|
@@ -4903,31 +5590,21 @@ function useCellRendering(param) {
|
|
|
4903
5590
|
}
|
|
4904
5591
|
});
|
|
4905
5592
|
}, [brain, onScrollToTop, onScrollToBottom]);
|
|
4906
|
-
|
|
5593
|
+
useEffect15(() => {
|
|
4907
5594
|
if (!bodySize.height) {
|
|
4908
5595
|
return;
|
|
4909
5596
|
}
|
|
4910
5597
|
const { onReady } = getState();
|
|
4911
5598
|
componentActions.ready = true;
|
|
4912
5599
|
if (onReady) {
|
|
4913
|
-
const imperativeApi = {
|
|
4914
|
-
setColumnOrder: (columnOrder) => {
|
|
4915
|
-
componentActions.columnOrder = columnOrder;
|
|
4916
|
-
},
|
|
4917
|
-
setColumnVisibility: (columnVisibility) => {
|
|
4918
|
-
componentActions.columnVisibility = columnVisibility;
|
|
4919
|
-
},
|
|
4920
|
-
getState,
|
|
4921
|
-
getDataSourceState
|
|
4922
|
-
};
|
|
4923
5600
|
onReady(imperativeApi);
|
|
4924
5601
|
}
|
|
4925
5602
|
}, [!!bodySize.height]);
|
|
4926
5603
|
const [, rerender] = useRerender();
|
|
4927
|
-
|
|
5604
|
+
useEffect15(() => {
|
|
4928
5605
|
rerender();
|
|
4929
5606
|
}, [dataSourceState]);
|
|
4930
|
-
const renderCell =
|
|
5607
|
+
const renderCell = useCallback12((params) => {
|
|
4931
5608
|
const {
|
|
4932
5609
|
rowIndex,
|
|
4933
5610
|
colIndex,
|
|
@@ -4962,7 +5639,7 @@ function useCellRendering(param) {
|
|
|
4962
5639
|
rowStyle,
|
|
4963
5640
|
rowClassName
|
|
4964
5641
|
};
|
|
4965
|
-
return /* @__PURE__ */
|
|
5642
|
+
return /* @__PURE__ */ React27.createElement(InfiniteTableColumnCell, __spreadValues({}, cellProps));
|
|
4966
5643
|
}, [
|
|
4967
5644
|
rowHeight,
|
|
4968
5645
|
getData,
|
|
@@ -4980,13 +5657,13 @@ function useCellRendering(param) {
|
|
|
4980
5657
|
}
|
|
4981
5658
|
|
|
4982
5659
|
// src/components/InfiniteTable/hooks/useComputed.ts
|
|
4983
|
-
import { useCallback as
|
|
5660
|
+
import { useCallback as useCallback15, useEffect as useEffect25, useState as useState14 } from "react";
|
|
4984
5661
|
|
|
4985
5662
|
// src/components/InfiniteTable/hooks/useColumnGroups.ts
|
|
4986
|
-
import { useEffect as
|
|
5663
|
+
import { useEffect as useEffect17 } from "react";
|
|
4987
5664
|
|
|
4988
5665
|
// src/components/hooks/useInterceptedMap.ts
|
|
4989
|
-
import { useEffect as
|
|
5666
|
+
import { useEffect as useEffect16 } from "react";
|
|
4990
5667
|
function interceptMap(map2, fns) {
|
|
4991
5668
|
const { set, delete: deleteKey, clear } = map2;
|
|
4992
5669
|
if (fns.set) {
|
|
@@ -5074,7 +5751,7 @@ function useColumnGroups() {
|
|
|
5074
5751
|
componentActions,
|
|
5075
5752
|
getComponentState
|
|
5076
5753
|
} = useComponentState();
|
|
5077
|
-
|
|
5754
|
+
useEffect17(() => {
|
|
5078
5755
|
const recompute = () => {
|
|
5079
5756
|
componentActions.columnGroupsDepthsMap = computeColumnGroupsDepths(computedColumnGroups);
|
|
5080
5757
|
};
|
|
@@ -5085,7 +5762,7 @@ function useColumnGroups() {
|
|
|
5085
5762
|
set: update
|
|
5086
5763
|
});
|
|
5087
5764
|
}, [computedColumnGroups]);
|
|
5088
|
-
|
|
5765
|
+
useEffect17(() => {
|
|
5089
5766
|
return interceptMap(collapsedColumnGroups, {
|
|
5090
5767
|
set: (key, visibleCol) => {
|
|
5091
5768
|
const colIds = key.slice(1);
|
|
@@ -5120,14 +5797,17 @@ function useColumnGroups() {
|
|
|
5120
5797
|
}
|
|
5121
5798
|
|
|
5122
5799
|
// src/components/InfiniteTable/hooks/useColumnRowspan.ts
|
|
5123
|
-
import { useMemo as
|
|
5800
|
+
import { useMemo as useMemo8 } from "react";
|
|
5124
5801
|
function useColumnRowspan(computedVisibleColumns) {
|
|
5125
5802
|
const { getState: getDataSourceState } = useDataSourceContextValue();
|
|
5126
|
-
const rowspan =
|
|
5803
|
+
const rowspan = useMemo8(() => {
|
|
5127
5804
|
const colsWithRowspan = computedVisibleColumns.filter((col) => typeof col.rowspan === "function");
|
|
5128
5805
|
return colsWithRowspan.length ? ({ rowIndex, colIndex }) => {
|
|
5129
5806
|
const dataArray = getDataSourceState().dataArray;
|
|
5130
5807
|
const rowInfo = dataArray[rowIndex];
|
|
5808
|
+
if (!rowInfo) {
|
|
5809
|
+
return 1;
|
|
5810
|
+
}
|
|
5131
5811
|
const data = rowInfo.data;
|
|
5132
5812
|
const column = computedVisibleColumns[colIndex];
|
|
5133
5813
|
if (!column || !column.rowspan) {
|
|
@@ -5146,10 +5826,10 @@ function useColumnRowspan(computedVisibleColumns) {
|
|
|
5146
5826
|
}
|
|
5147
5827
|
|
|
5148
5828
|
// src/components/InfiniteTable/hooks/useColumnSizeFn.ts
|
|
5149
|
-
import { useCallback as
|
|
5829
|
+
import { useCallback as useCallback13 } from "react";
|
|
5150
5830
|
var debug4 = dbg("useColumnSizeFn");
|
|
5151
5831
|
function useColumnSizeFn(columns) {
|
|
5152
|
-
const columnSize =
|
|
5832
|
+
const columnSize = useCallback13((index) => {
|
|
5153
5833
|
const column = columns[index];
|
|
5154
5834
|
if (!column) {
|
|
5155
5835
|
debug4("cannot find column at index", index, columns);
|
|
@@ -5160,11 +5840,11 @@ function useColumnSizeFn(columns) {
|
|
|
5160
5840
|
}
|
|
5161
5841
|
|
|
5162
5842
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
5163
|
-
import { useEffect as
|
|
5843
|
+
import { useEffect as useEffect22, useMemo as useMemo10 } from "react";
|
|
5164
5844
|
|
|
5165
5845
|
// src/components/InfiniteTable/utils/getColumnForGroupBy.tsx
|
|
5166
5846
|
import {
|
|
5167
|
-
createElement as
|
|
5847
|
+
createElement as createElement24
|
|
5168
5848
|
} from "react";
|
|
5169
5849
|
|
|
5170
5850
|
// src/utils/stripVar.ts
|
|
@@ -5182,21 +5862,21 @@ var showLoadingIcon = (rowInfo) => {
|
|
|
5182
5862
|
|
|
5183
5863
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
5184
5864
|
import {
|
|
5185
|
-
createElement as
|
|
5186
|
-
useEffect as
|
|
5865
|
+
createElement as createElement22,
|
|
5866
|
+
useEffect as useEffect18
|
|
5187
5867
|
} from "react";
|
|
5188
|
-
import { useState as
|
|
5868
|
+
import { useState as useState11 } from "react";
|
|
5189
5869
|
|
|
5190
5870
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.css.ts
|
|
5191
5871
|
var import_createRuntimeFn5 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
5192
|
-
var ExpanderIconCls = "_16lm1iw6
|
|
5872
|
+
var ExpanderIconCls = "_16lm1iw6 _16lm1iwg _16lm1iwd";
|
|
5193
5873
|
var ExpanderIconClsVariants = (0, import_createRuntimeFn5.createRuntimeFn)({ defaultClassName: "", variantClassNames: { expanded: { true: "_16lm1iwc", false: "_198z9782" } }, defaultVariants: {}, compoundVariants: [] });
|
|
5194
5874
|
|
|
5195
5875
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
5196
5876
|
function ExpanderIcon(props) {
|
|
5197
5877
|
var _a;
|
|
5198
5878
|
const { size = 24 } = props;
|
|
5199
|
-
const [expanded, setExpanded] =
|
|
5879
|
+
const [expanded, setExpanded] = useState11((_a = props.expanded) != null ? _a : props.defaultExpanded);
|
|
5200
5880
|
const onClick = () => {
|
|
5201
5881
|
var _a2;
|
|
5202
5882
|
(_a2 = props.onChange) == null ? void 0 : _a2.call(props, !expanded);
|
|
@@ -5204,12 +5884,12 @@ function ExpanderIcon(props) {
|
|
|
5204
5884
|
setExpanded(!expanded);
|
|
5205
5885
|
}
|
|
5206
5886
|
};
|
|
5207
|
-
|
|
5887
|
+
useEffect18(() => {
|
|
5208
5888
|
if (isControlled("expanded", props)) {
|
|
5209
5889
|
setExpanded(props.expanded);
|
|
5210
5890
|
}
|
|
5211
5891
|
}, [props.expanded]);
|
|
5212
|
-
return /* @__PURE__ */
|
|
5892
|
+
return /* @__PURE__ */ createElement22("svg", {
|
|
5213
5893
|
"data-name": "expander-icon",
|
|
5214
5894
|
xmlns: "http://www.w3.org/2000/svg",
|
|
5215
5895
|
height: `${size}px`,
|
|
@@ -5220,22 +5900,22 @@ function ExpanderIcon(props) {
|
|
|
5220
5900
|
className: join(props.className, ExpanderIconCls, ExpanderIconClsVariants({
|
|
5221
5901
|
expanded
|
|
5222
5902
|
}), "InfiniteIcon", "InfiniteIcon-expander", `InfiniteIcon-expander--${expanded ? "expanded" : "collapsed"}`)
|
|
5223
|
-
}, /* @__PURE__ */
|
|
5903
|
+
}, /* @__PURE__ */ createElement22("path", {
|
|
5224
5904
|
d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"
|
|
5225
5905
|
}));
|
|
5226
5906
|
}
|
|
5227
5907
|
|
|
5228
5908
|
// src/components/InfiniteTable/components/icons/LoadingIcon.tsx
|
|
5229
5909
|
import {
|
|
5230
|
-
createElement as
|
|
5910
|
+
createElement as createElement23
|
|
5231
5911
|
} from "react";
|
|
5232
5912
|
|
|
5233
5913
|
// src/components/InfiniteTable/components/icons/LoadingIcon.css.ts
|
|
5234
|
-
var LoadingIconCls = "_16lm1iw8
|
|
5914
|
+
var LoadingIconCls = "_16lm1iw8 _16lm1iwg _16lm1iwd";
|
|
5235
5915
|
|
|
5236
5916
|
// src/components/InfiniteTable/components/icons/LoadingIcon.tsx
|
|
5237
5917
|
var LoadingIcon = (props) => {
|
|
5238
|
-
return /* @__PURE__ */
|
|
5918
|
+
return /* @__PURE__ */ createElement23("svg", {
|
|
5239
5919
|
xmlns: "http://www.w3.org/2000/svg",
|
|
5240
5920
|
style: {
|
|
5241
5921
|
margin: "auto",
|
|
@@ -5247,14 +5927,14 @@ var LoadingIcon = (props) => {
|
|
|
5247
5927
|
viewBox: "0 0 100 100",
|
|
5248
5928
|
preserveAspectRatio: "xMidYMid",
|
|
5249
5929
|
className: join(props.className, LoadingIconCls, "InfiniteIcon", "InfiniteIcon-loading")
|
|
5250
|
-
}, /* @__PURE__ */
|
|
5930
|
+
}, /* @__PURE__ */ createElement23("circle", {
|
|
5251
5931
|
cx: "50",
|
|
5252
5932
|
cy: "50",
|
|
5253
5933
|
fill: "none",
|
|
5254
5934
|
strokeWidth: "10",
|
|
5255
5935
|
r: "35",
|
|
5256
5936
|
strokeDasharray: "164.93361431346415 56.97787143782138"
|
|
5257
|
-
}, /* @__PURE__ */
|
|
5937
|
+
}, /* @__PURE__ */ createElement23("animateTransform", {
|
|
5258
5938
|
attributeName: "transform",
|
|
5259
5939
|
type: "rotate",
|
|
5260
5940
|
repeatCount: "indefinite",
|
|
@@ -5274,7 +5954,7 @@ function getGroupColumnRender({
|
|
|
5274
5954
|
var _a, _b, _c;
|
|
5275
5955
|
let { value, rowInfo, column, groupBy, pivotBy } = renderOptions;
|
|
5276
5956
|
if (column.renderValue) {
|
|
5277
|
-
value = /* @__PURE__ */
|
|
5957
|
+
value = /* @__PURE__ */ createElement24(RenderHookComponent, {
|
|
5278
5958
|
render: column.renderValue,
|
|
5279
5959
|
renderParam: renderOptions
|
|
5280
5960
|
});
|
|
@@ -5304,22 +5984,22 @@ function getGroupColumnRender({
|
|
|
5304
5984
|
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);
|
|
5305
5985
|
const isLoading = showLoadingIcon(groupRowInfo);
|
|
5306
5986
|
if (isLoading) {
|
|
5307
|
-
icon = /* @__PURE__ */
|
|
5987
|
+
icon = /* @__PURE__ */ createElement24(LoadingIcon, null);
|
|
5308
5988
|
} else if (showExpanderIcon) {
|
|
5309
|
-
const defaultIcon = /* @__PURE__ */
|
|
5989
|
+
const defaultIcon = /* @__PURE__ */ createElement24(ExpanderIcon, {
|
|
5310
5990
|
expanded: !collapsed,
|
|
5311
5991
|
onChange: () => {
|
|
5312
5992
|
toggleGroupRow(groupKeys);
|
|
5313
5993
|
}
|
|
5314
5994
|
});
|
|
5315
|
-
icon = column.renderGroupIcon ? /* @__PURE__ */
|
|
5995
|
+
icon = column.renderGroupIcon ? /* @__PURE__ */ createElement24(RenderHookComponent, {
|
|
5316
5996
|
render: column.renderGroupIcon,
|
|
5317
5997
|
renderParam: Object.assign({ collapsed, groupIcon: defaultIcon }, renderOptions)
|
|
5318
5998
|
}) : defaultIcon;
|
|
5319
5999
|
}
|
|
5320
|
-
return /* @__PURE__ */
|
|
6000
|
+
return /* @__PURE__ */ createElement24("div", {
|
|
5321
6001
|
className: join(display.flex, alignItems.center)
|
|
5322
|
-
}, icon, /* @__PURE__ */
|
|
6002
|
+
}, icon, /* @__PURE__ */ createElement24("div", {
|
|
5323
6003
|
className: cssEllipsisClassName
|
|
5324
6004
|
}, value != null ? value : null));
|
|
5325
6005
|
};
|
|
@@ -5364,9 +6044,9 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
5364
6044
|
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;
|
|
5365
6045
|
const isLoading = showLoadingIcon(rowInfo);
|
|
5366
6046
|
if (isLoading) {
|
|
5367
|
-
icon = /* @__PURE__ */
|
|
6047
|
+
icon = /* @__PURE__ */ createElement24(LoadingIcon, null);
|
|
5368
6048
|
} else if (showExpanderIcon) {
|
|
5369
|
-
const defaultIcon = /* @__PURE__ */
|
|
6049
|
+
const defaultIcon = /* @__PURE__ */ createElement24(ExpanderIcon, {
|
|
5370
6050
|
expanded: !collapsed,
|
|
5371
6051
|
onChange: () => {
|
|
5372
6052
|
if (!rowInfo.isGroupRow) {
|
|
@@ -5381,9 +6061,9 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
5381
6061
|
icon = column.renderGroupIcon(renderParam);
|
|
5382
6062
|
}
|
|
5383
6063
|
}
|
|
5384
|
-
return /* @__PURE__ */
|
|
6064
|
+
return /* @__PURE__ */ createElement24("div", {
|
|
5385
6065
|
className: join(display.flex, alignItems.center, GroupRowExpanderCls)
|
|
5386
|
-
}, icon, /* @__PURE__ */
|
|
6066
|
+
}, icon, /* @__PURE__ */ createElement24("div", {
|
|
5387
6067
|
className: cssEllipsisClassName
|
|
5388
6068
|
}, value != null ? value : null));
|
|
5389
6069
|
}
|
|
@@ -5399,11 +6079,11 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
5399
6079
|
}
|
|
5400
6080
|
|
|
5401
6081
|
// src/components/InfiniteTable/hooks/useEffectWithRaf.ts
|
|
5402
|
-
import { useEffect as
|
|
6082
|
+
import { useEffect as useEffect19, useRef as useRef17 } from "react";
|
|
5403
6083
|
function useEffectWithRaf(fn, deps) {
|
|
5404
|
-
const rafId =
|
|
5405
|
-
const removeFnRaf =
|
|
5406
|
-
|
|
6084
|
+
const rafId = useRef17(0);
|
|
6085
|
+
const removeFnRaf = useRef17();
|
|
6086
|
+
useEffect19(() => {
|
|
5407
6087
|
rafId.current = requestAnimationFrame(() => {
|
|
5408
6088
|
removeFnRaf.current = fn();
|
|
5409
6089
|
});
|
|
@@ -5420,7 +6100,7 @@ function useEffectWithRaf(fn, deps) {
|
|
|
5420
6100
|
}
|
|
5421
6101
|
|
|
5422
6102
|
// src/components/InfiniteTable/hooks/useToggleGroupRow.ts
|
|
5423
|
-
import { useCallback as
|
|
6103
|
+
import { useCallback as useCallback14 } from "react";
|
|
5424
6104
|
|
|
5425
6105
|
// src/utils/groupAndPivot/index.ts
|
|
5426
6106
|
var LAZY_ROOT_KEY_FOR_GROUPS = "____root____";
|
|
@@ -5488,21 +6168,18 @@ function lazyGroup(groupParams, rootData) {
|
|
|
5488
6168
|
rootData.visitDepthFirst((lazyGroupRowInfo, keys, _index, next) => {
|
|
5489
6169
|
const [_rootKey, ...currentGroupKeys] = keys;
|
|
5490
6170
|
const dataArray = lazyGroupRowInfo.children;
|
|
5491
|
-
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
|
|
6171
|
+
const current = deepMap.get(currentGroupKeys);
|
|
6172
|
+
if (current) {
|
|
6173
|
+
current.cache = lazyGroupRowInfo.cache;
|
|
6174
|
+
current.childrenLoading = lazyGroupRowInfo.childrenLoading;
|
|
6175
|
+
current.childrenAvailable = lazyGroupRowInfo.childrenAvailable;
|
|
6176
|
+
current.error = lazyGroupRowInfo.error;
|
|
5497
6177
|
}
|
|
5498
|
-
if (
|
|
5499
|
-
const current = deepMap.get(currentGroupKeys);
|
|
6178
|
+
if (currentGroupKeys.length == groupBy.length && groupBy.length) {
|
|
5500
6179
|
if (current) {
|
|
5501
|
-
current.
|
|
5502
|
-
current.childrenLoading = lazyGroupRowInfo.childrenLoading;
|
|
5503
|
-
current.childrenAvailable = lazyGroupRowInfo.childrenAvailable;
|
|
5504
|
-
current.error = lazyGroupRowInfo.error;
|
|
6180
|
+
current.items = dataArray;
|
|
5505
6181
|
}
|
|
6182
|
+
return next == null ? void 0 : next();
|
|
5506
6183
|
}
|
|
5507
6184
|
for (let i = 0, len = dataArray.length; i < len; i++) {
|
|
5508
6185
|
if (!dataArray[i]) {
|
|
@@ -5521,10 +6198,8 @@ function lazyGroup(groupParams, rootData) {
|
|
|
5521
6198
|
}
|
|
5522
6199
|
const dataObject = dataArray[i].data;
|
|
5523
6200
|
const dataKeys = dataArray[i].keys;
|
|
5524
|
-
const item = dataObject;
|
|
5525
6201
|
if (dataKeys.length) {
|
|
5526
|
-
const
|
|
5527
|
-
const key = item[groupByProperty];
|
|
6202
|
+
const key = dataKeys[dataKeys.length - 1];
|
|
5528
6203
|
currentGroupKeys.push(key);
|
|
5529
6204
|
}
|
|
5530
6205
|
const deepMapGroupValue = {
|
|
@@ -5687,6 +6362,7 @@ function flatten(groupResult) {
|
|
|
5687
6362
|
return result;
|
|
5688
6363
|
}
|
|
5689
6364
|
function getEnhancedGroupData(options, deepMapValue) {
|
|
6365
|
+
var _a;
|
|
5690
6366
|
const { groupBy, groupKeys, collapsed, parents, reducers, lazyLoad } = options;
|
|
5691
6367
|
const groupNesting = groupKeys.length;
|
|
5692
6368
|
const {
|
|
@@ -5695,9 +6371,9 @@ function getEnhancedGroupData(options, deepMapValue) {
|
|
|
5695
6371
|
pivotDeepMap,
|
|
5696
6372
|
commonData
|
|
5697
6373
|
} = deepMapValue;
|
|
5698
|
-
let data = null;
|
|
6374
|
+
let data = commonData != null ? commonData : null;
|
|
5699
6375
|
if (Object.keys(reducerResults).length > 0) {
|
|
5700
|
-
data =
|
|
6376
|
+
data = __spreadValues({}, commonData);
|
|
5701
6377
|
for (const key in reducers)
|
|
5702
6378
|
if (reducers.hasOwnProperty(key)) {
|
|
5703
6379
|
const reducer = reducers[key];
|
|
@@ -5708,7 +6384,7 @@ function getEnhancedGroupData(options, deepMapValue) {
|
|
|
5708
6384
|
}
|
|
5709
6385
|
}
|
|
5710
6386
|
let selfLoaded = true;
|
|
5711
|
-
let theValue = groupKeys[groupKeys.length - 1];
|
|
6387
|
+
let theValue = (_a = data != null ? data[groupBy[groupKeys.length - 1]] : null) != null ? _a : groupKeys[groupKeys.length - 1];
|
|
5712
6388
|
if (typeof theValue === "string" && theValue.startsWith(NOT_LOADED_YET_KEY_PREFIX)) {
|
|
5713
6389
|
selfLoaded = false;
|
|
5714
6390
|
theValue = null;
|
|
@@ -5722,6 +6398,7 @@ function getEnhancedGroupData(options, deepMapValue) {
|
|
|
5722
6398
|
collapsed,
|
|
5723
6399
|
dataSourceHasGrouping: true,
|
|
5724
6400
|
selfLoaded,
|
|
6401
|
+
error: options.error,
|
|
5725
6402
|
parents,
|
|
5726
6403
|
deepRowInfoArray: [],
|
|
5727
6404
|
collapsedChildrenCount: 0,
|
|
@@ -5785,6 +6462,7 @@ function enhancedFlatten(param) {
|
|
|
5785
6462
|
indexInParentGroups: Array.from(indexInParentGroups),
|
|
5786
6463
|
indexInAll: result.length,
|
|
5787
6464
|
groupKeys,
|
|
6465
|
+
error: deepMapValue.error,
|
|
5788
6466
|
childrenLoading: deepMapValue.childrenLoading,
|
|
5789
6467
|
childrenAvailable: deepMapValue.childrenAvailable,
|
|
5790
6468
|
directChildrenCount: groupKeys.length === groupByStrings.length ? deepMapValue.items.length : deepMap.getDirectChildrenSizeFor(groupKeys),
|
|
@@ -5830,8 +6508,9 @@ function enhancedFlatten(param) {
|
|
|
5830
6508
|
}
|
|
5831
6509
|
for (let index = 0, len = items.length; index < len; index++) {
|
|
5832
6510
|
const item = items[index];
|
|
6511
|
+
const indexInAll = startIndex + index;
|
|
5833
6512
|
const rowInfo = {
|
|
5834
|
-
id: item ? toPrimaryKey(item) : `${groupKeys}-${index}`,
|
|
6513
|
+
id: item ? toPrimaryKey(item, indexInAll) : `${groupKeys}-${index}`,
|
|
5835
6514
|
data: item,
|
|
5836
6515
|
dataSourceHasGrouping: true,
|
|
5837
6516
|
isGroupRow: false,
|
|
@@ -5842,7 +6521,7 @@ function enhancedFlatten(param) {
|
|
|
5842
6521
|
parents: Array.from(parents),
|
|
5843
6522
|
indexInParentGroups: [...indexInParentGroups, index],
|
|
5844
6523
|
indexInGroup: index,
|
|
5845
|
-
indexInAll
|
|
6524
|
+
indexInAll,
|
|
5846
6525
|
groupBy: groupByStrings,
|
|
5847
6526
|
groupNesting,
|
|
5848
6527
|
groupCount: enhancedGroupData.groupCount
|
|
@@ -5875,8 +6554,8 @@ function enhancedFlatten(param) {
|
|
|
5875
6554
|
|
|
5876
6555
|
// src/components/DataSource/index.tsx
|
|
5877
6556
|
import {
|
|
5878
|
-
Fragment as
|
|
5879
|
-
createElement as
|
|
6557
|
+
Fragment as Fragment3,
|
|
6558
|
+
createElement as createElement25
|
|
5880
6559
|
} from "react";
|
|
5881
6560
|
|
|
5882
6561
|
// src/utils/multisort/sortTypes.ts
|
|
@@ -5888,11 +6567,11 @@ var stringComparator = function(first, second) {
|
|
|
5888
6567
|
second = `${second}`;
|
|
5889
6568
|
return first.localeCompare(second);
|
|
5890
6569
|
};
|
|
5891
|
-
var
|
|
6570
|
+
var defaultSortTypes = {
|
|
5892
6571
|
number: numberComparator,
|
|
5893
6572
|
string: stringComparator
|
|
5894
6573
|
};
|
|
5895
|
-
var sortTypes_default =
|
|
6574
|
+
var sortTypes_default = defaultSortTypes;
|
|
5896
6575
|
|
|
5897
6576
|
// src/utils/multisort/index.ts
|
|
5898
6577
|
var multisort = (sortInfo, array, get) => {
|
|
@@ -5905,7 +6584,8 @@ var getSingleSortFunction = (info) => {
|
|
|
5905
6584
|
return;
|
|
5906
6585
|
}
|
|
5907
6586
|
const field = info.field;
|
|
5908
|
-
|
|
6587
|
+
const valueGetter = info.valueGetter;
|
|
6588
|
+
const dir = info.dir < 0 ? -1 : info.dir > 0 ? 1 : 0;
|
|
5909
6589
|
if (!dir) {
|
|
5910
6590
|
return;
|
|
5911
6591
|
}
|
|
@@ -5920,8 +6600,8 @@ var getSingleSortFunction = (info) => {
|
|
|
5920
6600
|
fn = sortTypes_default.string;
|
|
5921
6601
|
}
|
|
5922
6602
|
return (first, second) => {
|
|
5923
|
-
const a = field ? first[field] : first;
|
|
5924
|
-
const b = field ? second[field] : second;
|
|
6603
|
+
const a = valueGetter ? valueGetter(first) : field ? first[field] : first;
|
|
6604
|
+
const b = valueGetter ? valueGetter(second) : field ? second[field] : second;
|
|
5925
6605
|
return dir * fn(a, b);
|
|
5926
6606
|
};
|
|
5927
6607
|
};
|
|
@@ -5935,34 +6615,144 @@ var getMultisortFunction = (sortInfo, get) => {
|
|
|
5935
6615
|
first = get(first);
|
|
5936
6616
|
second = get(second);
|
|
5937
6617
|
}
|
|
5938
|
-
let result = 0;
|
|
5939
|
-
let i = 0;
|
|
5940
|
-
let fn;
|
|
5941
|
-
const len = fns.length;
|
|
5942
|
-
for (; i < len; i++) {
|
|
5943
|
-
fn = fns[i];
|
|
5944
|
-
if (!fn) {
|
|
5945
|
-
continue;
|
|
6618
|
+
let result = 0;
|
|
6619
|
+
let i = 0;
|
|
6620
|
+
let fn;
|
|
6621
|
+
const len = fns.length;
|
|
6622
|
+
for (; i < len; i++) {
|
|
6623
|
+
fn = fns[i];
|
|
6624
|
+
if (!fn) {
|
|
6625
|
+
continue;
|
|
6626
|
+
}
|
|
6627
|
+
result = fn(first, second);
|
|
6628
|
+
if (result !== 0) {
|
|
6629
|
+
return result;
|
|
6630
|
+
}
|
|
6631
|
+
}
|
|
6632
|
+
return result;
|
|
6633
|
+
};
|
|
6634
|
+
};
|
|
6635
|
+
|
|
6636
|
+
// src/components/DataSource/GroupRowsState.ts
|
|
6637
|
+
var GroupRowsState = class {
|
|
6638
|
+
constructor(state) {
|
|
6639
|
+
this.update(state instanceof GroupRowsState ? state.getState() : state);
|
|
6640
|
+
}
|
|
6641
|
+
getState() {
|
|
6642
|
+
var _a, _b, _c, _d;
|
|
6643
|
+
return {
|
|
6644
|
+
expandedRows: this.expandedAll ? true : (_b = (_a = this.expandedMap) == null ? void 0 : _a.topDownKeys()) != null ? _b : [],
|
|
6645
|
+
collapsedRows: this.collapsedAll ? true : (_d = (_c = this.collapsedMap) == null ? void 0 : _c.topDownKeys()) != null ? _d : []
|
|
6646
|
+
};
|
|
6647
|
+
}
|
|
6648
|
+
destroy() {
|
|
6649
|
+
var _a, _b;
|
|
6650
|
+
(_a = this.expandedMap) == null ? void 0 : _a.clear();
|
|
6651
|
+
(_b = this.collapsedMap) == null ? void 0 : _b.clear();
|
|
6652
|
+
delete this.expandedMap;
|
|
6653
|
+
delete this.collapsedMap;
|
|
6654
|
+
}
|
|
6655
|
+
update(state) {
|
|
6656
|
+
var _a, _b, _c, _d;
|
|
6657
|
+
this.initialState = state;
|
|
6658
|
+
const { collapsedRows, expandedRows } = this.initialState;
|
|
6659
|
+
this.collapsedAll = collapsedRows === true;
|
|
6660
|
+
this.expandedAll = expandedRows === true;
|
|
6661
|
+
if (this.collapsedAll && this.expandedAll) {
|
|
6662
|
+
throw `Cannot have both collapsedRows and expandedRows be true!`;
|
|
6663
|
+
}
|
|
6664
|
+
if (collapsedRows !== true) {
|
|
6665
|
+
(_a = this.collapsedMap) == null ? void 0 : _a.clear();
|
|
6666
|
+
this.collapsedMap = (_b = this.collapsedMap) != null ? _b : new DeepMap(collapsedRows.map((keys) => [keys, true]));
|
|
6667
|
+
}
|
|
6668
|
+
if (expandedRows !== true) {
|
|
6669
|
+
(_c = this.expandedMap) == null ? void 0 : _c.clear();
|
|
6670
|
+
this.expandedMap = (_d = this.expandedMap) != null ? _d : new DeepMap(expandedRows.map((keys) => [keys, true]));
|
|
6671
|
+
}
|
|
6672
|
+
}
|
|
6673
|
+
areAllCollapsed() {
|
|
6674
|
+
return this.collapsedAll && (this.expandedMap ? this.expandedMap.size === 0 : true);
|
|
6675
|
+
}
|
|
6676
|
+
areAllExpanded() {
|
|
6677
|
+
return this.expandedAll && (this.collapsedMap ? this.collapsedMap.size === 0 : true);
|
|
6678
|
+
}
|
|
6679
|
+
collapseAll() {
|
|
6680
|
+
this.update({
|
|
6681
|
+
collapsedRows: true,
|
|
6682
|
+
expandedRows: []
|
|
6683
|
+
});
|
|
6684
|
+
}
|
|
6685
|
+
expandAll() {
|
|
6686
|
+
this.update({
|
|
6687
|
+
expandedRows: true,
|
|
6688
|
+
collapsedRows: []
|
|
6689
|
+
});
|
|
6690
|
+
}
|
|
6691
|
+
isGroupRowExpanded(keys) {
|
|
6692
|
+
var _a, _b;
|
|
6693
|
+
if (this.expandedAll === true) {
|
|
6694
|
+
if (this.collapsedAll === true) {
|
|
6695
|
+
throw 'Cannot have both expandedRows and collapsedRows be "true"';
|
|
6696
|
+
}
|
|
6697
|
+
return !((_a = this.collapsedMap) == null ? void 0 : _a.has(keys));
|
|
6698
|
+
}
|
|
6699
|
+
return (_b = this.expandedMap) == null ? void 0 : _b.has(keys);
|
|
6700
|
+
}
|
|
6701
|
+
isGroupRowCollapsed(keys) {
|
|
6702
|
+
return !this.isGroupRowExpanded(keys);
|
|
6703
|
+
}
|
|
6704
|
+
setGroupRowExpanded(keys, shouldExpand) {
|
|
6705
|
+
var _a;
|
|
6706
|
+
if (shouldExpand === this.isGroupRowExpanded(keys)) {
|
|
6707
|
+
return;
|
|
6708
|
+
}
|
|
6709
|
+
if (shouldExpand) {
|
|
6710
|
+
if (this.collapsedAll === true) {
|
|
6711
|
+
if (!this.expandedMap) {
|
|
6712
|
+
throw `No expandedMap found when trying to expand group row ${keys.join(",")}`;
|
|
6713
|
+
}
|
|
6714
|
+
this.expandedMap.set(keys, true);
|
|
6715
|
+
} else if (this.expandedAll === true) {
|
|
6716
|
+
if (!this.collapsedMap) {
|
|
6717
|
+
throw `No collapsedMap found when trying to expand group row ${keys.join(",")}`;
|
|
6718
|
+
}
|
|
6719
|
+
this.collapsedMap.delete(keys);
|
|
5946
6720
|
}
|
|
5947
|
-
|
|
5948
|
-
if (
|
|
5949
|
-
|
|
6721
|
+
} else {
|
|
6722
|
+
if (this.expandedAll === true) {
|
|
6723
|
+
if (!this.collapsedMap) {
|
|
6724
|
+
throw `No collapsedMap found when trying to collapse group row ${keys.join(",")}`;
|
|
6725
|
+
}
|
|
6726
|
+
this.collapsedMap.set(keys, true);
|
|
6727
|
+
} else if (this.collapsedAll === true) {
|
|
6728
|
+
if (!this.expandedMap) {
|
|
6729
|
+
throw `No expandedMap found when trying to collapse group row ${keys.join(",")}`;
|
|
6730
|
+
}
|
|
6731
|
+
(_a = this.expandedMap) == null ? void 0 : _a.delete(keys);
|
|
5950
6732
|
}
|
|
5951
6733
|
}
|
|
5952
|
-
|
|
5953
|
-
|
|
6734
|
+
}
|
|
6735
|
+
collapseGroupRow(keys) {
|
|
6736
|
+
this.setGroupRowExpanded(keys, false);
|
|
6737
|
+
}
|
|
6738
|
+
expandGroupRow(keys) {
|
|
6739
|
+
this.setGroupRowExpanded(keys, true);
|
|
6740
|
+
}
|
|
6741
|
+
toggleGroupRow(keys) {
|
|
6742
|
+
this.setGroupRowExpanded(keys, !this.isGroupRowExpanded(keys));
|
|
6743
|
+
}
|
|
5954
6744
|
};
|
|
5955
6745
|
|
|
5956
6746
|
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
5957
|
-
import { useEffect as
|
|
6747
|
+
import { useEffect as useEffect21, useMemo as useMemo9, useRef as useRef19, useState as useState12 } from "react";
|
|
5958
6748
|
|
|
5959
6749
|
// src/components/hooks/useEffectWithChanges.ts
|
|
5960
|
-
import { useEffect as
|
|
6750
|
+
import { useEffect as useEffect20, useRef as useRef18 } from "react";
|
|
5961
6751
|
function useEffectWithChanges(fn, deps) {
|
|
5962
|
-
const prevRef =
|
|
5963
|
-
const oldValuesRef =
|
|
6752
|
+
const prevRef = useRef18({});
|
|
6753
|
+
const oldValuesRef = useRef18({});
|
|
5964
6754
|
const oldValues = oldValuesRef.current;
|
|
5965
|
-
const changesRef =
|
|
6755
|
+
const changesRef = useRef18({});
|
|
5966
6756
|
const changes = changesRef.current;
|
|
5967
6757
|
const useEffectDeps = [];
|
|
5968
6758
|
for (const k in deps) {
|
|
@@ -5975,7 +6765,7 @@ function useEffectWithChanges(fn, deps) {
|
|
|
5975
6765
|
}
|
|
5976
6766
|
}
|
|
5977
6767
|
prevRef.current = deps;
|
|
5978
|
-
|
|
6768
|
+
useEffect20(() => {
|
|
5979
6769
|
const changes2 = changesRef.current;
|
|
5980
6770
|
const result = fn(changes2, oldValues);
|
|
5981
6771
|
changesRef.current = {};
|
|
@@ -5984,6 +6774,25 @@ function useEffectWithChanges(fn, deps) {
|
|
|
5984
6774
|
}, useEffectDeps);
|
|
5985
6775
|
}
|
|
5986
6776
|
|
|
6777
|
+
// src/components/InfiniteTable/utils/assignFiltered.ts
|
|
6778
|
+
function assignFiltered(filterFn, target, ...rest) {
|
|
6779
|
+
const result = target;
|
|
6780
|
+
rest.forEach((obj) => {
|
|
6781
|
+
for (const key in obj) {
|
|
6782
|
+
if (obj.hasOwnProperty(key) && filterFn(obj[key], key)) {
|
|
6783
|
+
result[key] = obj[key];
|
|
6784
|
+
}
|
|
6785
|
+
}
|
|
6786
|
+
});
|
|
6787
|
+
return result;
|
|
6788
|
+
}
|
|
6789
|
+
function assignNonNull(target, ...rest) {
|
|
6790
|
+
return assignFiltered((value) => value != null, target, ...rest);
|
|
6791
|
+
}
|
|
6792
|
+
function assignExcept(exceptKeys, target, ...rest) {
|
|
6793
|
+
return assignFiltered((_value, key) => !(key in exceptKeys), target, ...rest);
|
|
6794
|
+
}
|
|
6795
|
+
|
|
5987
6796
|
// src/components/DataSource/privateHooks/getChangeDetect.ts
|
|
5988
6797
|
function getChangeDetect() {
|
|
5989
6798
|
var _a;
|
|
@@ -6009,6 +6818,7 @@ function buildDataSourceDataParams(componentState, overrides) {
|
|
|
6009
6818
|
sortInfo,
|
|
6010
6819
|
groupBy: componentState.groupBy,
|
|
6011
6820
|
pivotBy: componentState.pivotBy,
|
|
6821
|
+
filterValue: componentState.filterValue,
|
|
6012
6822
|
aggregationReducers: componentState.aggregationReducers
|
|
6013
6823
|
};
|
|
6014
6824
|
if (dataSourceParams.groupBy) {
|
|
@@ -6028,6 +6838,13 @@ function buildDataSourceDataParams(componentState, overrides) {
|
|
|
6028
6838
|
if (overrides) {
|
|
6029
6839
|
Object.assign(dataSourceParams, overrides);
|
|
6030
6840
|
}
|
|
6841
|
+
if (dataSourceParams.filterValue && dataSourceParams.filterValue.length) {
|
|
6842
|
+
dataSourceParams.filterValue = dataSourceParams.filterValue.map((f) => {
|
|
6843
|
+
const value = __spreadValues({}, f);
|
|
6844
|
+
delete value.valueGetter;
|
|
6845
|
+
return value;
|
|
6846
|
+
});
|
|
6847
|
+
}
|
|
6031
6848
|
const changes = {};
|
|
6032
6849
|
const oldDataSourceParams = componentState.dataParams || {};
|
|
6033
6850
|
for (const k in dataSourceParams) {
|
|
@@ -6048,6 +6865,13 @@ function loadData(data, componentState, actions, overrides) {
|
|
|
6048
6865
|
const lazyGroupData = componentState.originalLazyGroupData;
|
|
6049
6866
|
const key = [LAZY_ROOT_KEY_FOR_GROUPS, ...dataParams.groupKeys || []];
|
|
6050
6867
|
const existingGroupRowInfo = lazyGroupData.get(key);
|
|
6868
|
+
if (!existingGroupRowInfo) {
|
|
6869
|
+
const groupCacheKeys = [
|
|
6870
|
+
...dataParams.groupKeys || [],
|
|
6871
|
+
dataParams.lazyLoadStartIndex
|
|
6872
|
+
];
|
|
6873
|
+
componentState.lazyLoadCacheOfLoadedBatches.set(groupCacheKeys, true);
|
|
6874
|
+
}
|
|
6051
6875
|
if (existingGroupRowInfo && existingGroupRowInfo.cache && key.length > 1) {
|
|
6052
6876
|
const items = existingGroupRowInfo.children;
|
|
6053
6877
|
const len = items.length;
|
|
@@ -6073,7 +6897,8 @@ function loadData(data, componentState, actions, overrides) {
|
|
|
6073
6897
|
childrenLoading: true,
|
|
6074
6898
|
childrenAvailable: false,
|
|
6075
6899
|
cache: CACHE_DEFAULT,
|
|
6076
|
-
totalCount: 0
|
|
6900
|
+
totalCount: 0,
|
|
6901
|
+
totalCountUnfiltered: 0
|
|
6077
6902
|
});
|
|
6078
6903
|
}
|
|
6079
6904
|
actions.originalLazyGroupDataChangeDetect = getChangeDetect();
|
|
@@ -6097,6 +6922,9 @@ function loadData(data, componentState, actions, overrides) {
|
|
|
6097
6922
|
if (remoteData.mappings) {
|
|
6098
6923
|
actions.pivotMappings = remoteData.mappings;
|
|
6099
6924
|
}
|
|
6925
|
+
if (remoteData.totalCountUnfiltered) {
|
|
6926
|
+
actions.unfilteredCount = remoteData.totalCountUnfiltered;
|
|
6927
|
+
}
|
|
6100
6928
|
if (componentState.lazyLoad) {
|
|
6101
6929
|
let resolveRemoteData = function(keys, remoteData2, parentKeys) {
|
|
6102
6930
|
var _a, _b, _c, _d;
|
|
@@ -6107,24 +6935,19 @@ function loadData(data, componentState, actions, overrides) {
|
|
|
6107
6935
|
childrenLoading: false,
|
|
6108
6936
|
childrenAvailable: true,
|
|
6109
6937
|
totalCount: (_a = remoteData2.totalCount) != null ? _a : dataArray2.length,
|
|
6110
|
-
|
|
6938
|
+
totalCountUnfiltered: (_b = remoteData2.totalCount) != null ? _b : dataArray2.length,
|
|
6939
|
+
children: dataArray2,
|
|
6940
|
+
error: remoteData2.error
|
|
6111
6941
|
};
|
|
6112
6942
|
const childDatasets = [];
|
|
6113
6943
|
if (dataParams.lazyLoadBatchSize && !parentKeys) {
|
|
6114
6944
|
const existingGroupRowInfo = lazyGroupData.get(theKey);
|
|
6115
|
-
const
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
|
|
6120
|
-
|
|
6121
|
-
};
|
|
6122
|
-
if (existingGroupRowInfo) {
|
|
6123
|
-
existingGroupRowInfo.cache = newGroupRowInfo.cache;
|
|
6124
|
-
existingGroupRowInfo.totalCount = newGroupRowInfo.totalCount;
|
|
6125
|
-
existingGroupRowInfo.childrenLoading = false;
|
|
6126
|
-
existingGroupRowInfo.childrenAvailable = true;
|
|
6127
|
-
existingGroupRowInfo.error = newGroupRowInfo.error;
|
|
6945
|
+
const isGroupNew = !existingGroupRowInfo;
|
|
6946
|
+
const currentGroupRowInfo = assignExcept({
|
|
6947
|
+
children: true
|
|
6948
|
+
}, existingGroupRowInfo || {}, newGroupRowInfo);
|
|
6949
|
+
if (isGroupNew) {
|
|
6950
|
+
currentGroupRowInfo.chidren = [];
|
|
6128
6951
|
}
|
|
6129
6952
|
currentGroupRowInfo.children.length = currentGroupRowInfo.totalCount;
|
|
6130
6953
|
const start = (_c = dataParams.lazyLoadStartIndex) != null ? _c : 0;
|
|
@@ -6142,13 +6965,13 @@ function loadData(data, componentState, actions, overrides) {
|
|
|
6142
6965
|
});
|
|
6143
6966
|
}
|
|
6144
6967
|
}
|
|
6145
|
-
if (
|
|
6968
|
+
if (isGroupNew) {
|
|
6146
6969
|
lazyGroupData.set(theKey, currentGroupRowInfo);
|
|
6147
6970
|
}
|
|
6148
6971
|
} else {
|
|
6149
6972
|
if (parentKeys) {
|
|
6150
6973
|
newGroupRowInfo.children.forEach((child) => {
|
|
6151
|
-
if (child.dataset) {
|
|
6974
|
+
if (child && child.dataset) {
|
|
6152
6975
|
childDatasets.push({
|
|
6153
6976
|
keys: child.keys,
|
|
6154
6977
|
dataset: child.dataset
|
|
@@ -6205,16 +7028,17 @@ function useLoadData() {
|
|
|
6205
7028
|
sortInfo,
|
|
6206
7029
|
groupBy,
|
|
6207
7030
|
pivotBy,
|
|
7031
|
+
filterValue,
|
|
6208
7032
|
livePagination,
|
|
6209
7033
|
livePaginationCursor,
|
|
6210
7034
|
cursorId: stateCursorId
|
|
6211
7035
|
} = componentState;
|
|
6212
|
-
const [scrollbars, setScrollbars] =
|
|
7036
|
+
const [scrollbars, setScrollbars] = useState12({
|
|
6213
7037
|
vertical: false,
|
|
6214
7038
|
horizontal: false
|
|
6215
7039
|
});
|
|
6216
|
-
const scrollbarsRef =
|
|
6217
|
-
|
|
7040
|
+
const scrollbarsRef = useRef19(scrollbars);
|
|
7041
|
+
useEffect21(() => {
|
|
6218
7042
|
notifyScrollbarsChange.onChange((scrollbars2) => {
|
|
6219
7043
|
if (!scrollbars2) {
|
|
6220
7044
|
return;
|
|
@@ -6224,7 +7048,7 @@ function useLoadData() {
|
|
|
6224
7048
|
});
|
|
6225
7049
|
return () => notifyScrollbarsChange.destroy();
|
|
6226
7050
|
}, [notifyScrollbarsChange]);
|
|
6227
|
-
|
|
7051
|
+
useEffect21(() => {
|
|
6228
7052
|
if (!livePagination) {
|
|
6229
7053
|
return;
|
|
6230
7054
|
}
|
|
@@ -6238,7 +7062,7 @@ function useLoadData() {
|
|
|
6238
7062
|
});
|
|
6239
7063
|
return () => cancelAnimationFrame(frameId);
|
|
6240
7064
|
}, [livePaginationCursor]);
|
|
6241
|
-
|
|
7065
|
+
useEffect21(() => {
|
|
6242
7066
|
if (!livePagination || livePaginationCursor !== void 0) {
|
|
6243
7067
|
return;
|
|
6244
7068
|
}
|
|
@@ -6252,7 +7076,7 @@ function useLoadData() {
|
|
|
6252
7076
|
});
|
|
6253
7077
|
return () => cancelAnimationFrame(frameId);
|
|
6254
7078
|
}, [dataArray.length, livePaginationCursor]);
|
|
6255
|
-
|
|
7079
|
+
useEffect21(() => {
|
|
6256
7080
|
const state = getComponentState();
|
|
6257
7081
|
const { livePaginationCursor: livePaginationCursor2, livePagination: livePagination2, dataArray: dataArray2 } = state;
|
|
6258
7082
|
if (!scrollbars.vertical && livePagination2) {
|
|
@@ -6267,9 +7091,10 @@ function useLoadData() {
|
|
|
6267
7091
|
sortInfo,
|
|
6268
7092
|
groupBy,
|
|
6269
7093
|
pivotBy,
|
|
7094
|
+
filterValue,
|
|
6270
7095
|
cursorId: livePagination ? stateCursorId : null
|
|
6271
7096
|
};
|
|
6272
|
-
const initialRef =
|
|
7097
|
+
const initialRef = useRef19(true);
|
|
6273
7098
|
useLazyLoadRange();
|
|
6274
7099
|
useEffectWithChanges(() => {
|
|
6275
7100
|
const componentState2 = getComponentState();
|
|
@@ -6301,7 +7126,7 @@ function useLazyLoadRange() {
|
|
|
6301
7126
|
componentActions: actions,
|
|
6302
7127
|
componentState
|
|
6303
7128
|
} = useComponentState();
|
|
6304
|
-
|
|
7129
|
+
useEffect21(() => {
|
|
6305
7130
|
actions.lazyLoadCacheOfLoadedBatches = new DeepMap();
|
|
6306
7131
|
}, [componentState.data, componentState.dataParams]);
|
|
6307
7132
|
const {
|
|
@@ -6310,7 +7135,7 @@ function useLazyLoadRange() {
|
|
|
6310
7135
|
dataArray,
|
|
6311
7136
|
scrollStopDelayUpdatedByTable
|
|
6312
7137
|
} = componentState;
|
|
6313
|
-
const latestRenderRangeRef =
|
|
7138
|
+
const latestRenderRangeRef = useRef19(null);
|
|
6314
7139
|
const loadRange = (renderRange, cache = getComponentState().lazyLoadCacheOfLoadedBatches) => {
|
|
6315
7140
|
const componentState2 = getComponentState();
|
|
6316
7141
|
renderRange = renderRange || latestRenderRangeRef.current;
|
|
@@ -6329,8 +7154,8 @@ function useLazyLoadRange() {
|
|
|
6329
7154
|
componentActions: actions
|
|
6330
7155
|
}, cache);
|
|
6331
7156
|
};
|
|
6332
|
-
const debouncedLoadRange =
|
|
6333
|
-
|
|
7157
|
+
const debouncedLoadRange = useMemo9(() => debounce(loadRange, { wait: scrollStopDelayUpdatedByTable }), [scrollStopDelayUpdatedByTable]);
|
|
7158
|
+
useEffect21(() => {
|
|
6334
7159
|
if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
|
|
6335
7160
|
return notifyRenderRangeChange.onChange((renderRange) => {
|
|
6336
7161
|
latestRenderRangeRef.current = renderRange;
|
|
@@ -6339,7 +7164,7 @@ function useLazyLoadRange() {
|
|
|
6339
7164
|
}
|
|
6340
7165
|
return;
|
|
6341
7166
|
}, [lazyLoadBatchSize]);
|
|
6342
|
-
|
|
7167
|
+
useEffect21(() => {
|
|
6343
7168
|
if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
|
|
6344
7169
|
debouncedLoadRange();
|
|
6345
7170
|
}
|
|
@@ -6372,7 +7197,7 @@ function lazyLoadRange(options, cache) {
|
|
|
6372
7197
|
theGroupKeys.pop();
|
|
6373
7198
|
}
|
|
6374
7199
|
const cacheKeys = theGroupKeys.length ? theGroupKeys : rootGroupKeys;
|
|
6375
|
-
const indexInGroup = rowInfo.
|
|
7200
|
+
const indexInGroup = rowInfo.dataSourceHasGrouping ? rowInfo.indexInGroup : rowInfo.indexInAll;
|
|
6376
7201
|
if (rowInfo.isGroupRow && !rowInfo.collapsed && !rowInfo.childrenAvailable) {
|
|
6377
7202
|
const currentFnCall = {
|
|
6378
7203
|
lazyLoadStartIndex: 0,
|
|
@@ -6395,7 +7220,7 @@ function lazyLoadRange(options, cache) {
|
|
|
6395
7220
|
if (!rowLoaded) {
|
|
6396
7221
|
let cachedFnCalls = perGroupFnCalls.get(cacheKeys);
|
|
6397
7222
|
const batchStartIndexInGroup = Math.floor(indexInGroup / lazyLoadBatchSize) * lazyLoadBatchSize;
|
|
6398
|
-
const offset =
|
|
7223
|
+
const offset = indexInGroup - batchStartIndexInGroup;
|
|
6399
7224
|
const absoluteIndexOfBatchStart = dataArray[rowInfo.indexInAll - offset].indexInAll;
|
|
6400
7225
|
const batchStartRowLoaded = isRowLoaded(absoluteIndexOfBatchStart);
|
|
6401
7226
|
const batchStartRowId = dataArray[absoluteIndexOfBatchStart].id;
|
|
@@ -6431,177 +7256,67 @@ function lazyLoadRange(options, cache) {
|
|
|
6431
7256
|
const args = [componentState.data, componentState, componentActions, fnCall];
|
|
6432
7257
|
return promise.then(() => getRafPromise()).then(() => loadData(...args));
|
|
6433
7258
|
}, initialPromise);
|
|
6434
|
-
}
|
|
6435
|
-
|
|
6436
|
-
// src/utils/shallowEqualObjects.ts
|
|
6437
|
-
function shallowEqualObjects(objA, objB, ignoreKeys) {
|
|
6438
|
-
if (objA === objB) {
|
|
6439
|
-
return true;
|
|
6440
|
-
}
|
|
6441
|
-
if (!objA || !objB) {
|
|
6442
|
-
return false;
|
|
6443
|
-
}
|
|
6444
|
-
var aKeys = Object.keys(objA);
|
|
6445
|
-
var bKeys = Object.keys(objB);
|
|
6446
|
-
if (ignoreKeys) {
|
|
6447
|
-
aKeys = aKeys.filter((key2) => !ignoreKeys.has(key2));
|
|
6448
|
-
bKeys = bKeys.filter((key2) => !ignoreKeys.has(key2));
|
|
6449
|
-
}
|
|
6450
|
-
var len = aKeys.length;
|
|
6451
|
-
if (bKeys.length !== len) {
|
|
6452
|
-
return false;
|
|
6453
|
-
}
|
|
6454
|
-
for (var i = 0; i < len; i++) {
|
|
6455
|
-
var key = aKeys[i];
|
|
6456
|
-
if (ignoreKeys) {
|
|
6457
|
-
if (ignoreKeys.has(key)) {
|
|
6458
|
-
continue;
|
|
6459
|
-
}
|
|
6460
|
-
}
|
|
6461
|
-
if (objA[key] !== objB[key] || !Object.prototype.hasOwnProperty.call(objB, key)) {
|
|
6462
|
-
return false;
|
|
6463
|
-
}
|
|
6464
|
-
}
|
|
6465
|
-
return true;
|
|
6466
|
-
}
|
|
6467
|
-
|
|
6468
|
-
// src/components/utils/discardCallsWithEqualArg.ts
|
|
6469
|
-
var map = new WeakMap();
|
|
6470
|
-
var getCompareDefault = (a) => a;
|
|
6471
|
-
function discardCallsWithEqualArg(fn, timeframe = 50, getCompareObject) {
|
|
6472
|
-
map.set(fn, {
|
|
6473
|
-
lastCallTime: 0,
|
|
6474
|
-
lastCallArg: null
|
|
6475
|
-
});
|
|
6476
|
-
const getCompare = getCompareObject != null ? getCompareObject : getCompareDefault;
|
|
6477
|
-
return (arg) => {
|
|
6478
|
-
const { lastCallTime, lastCallArg } = map.get(fn) || {
|
|
6479
|
-
lastCallTime: 0,
|
|
6480
|
-
lastCallArg: null
|
|
6481
|
-
};
|
|
6482
|
-
const now = Date.now();
|
|
6483
|
-
const diff = now - lastCallTime;
|
|
6484
|
-
const objectsEqual = shallowEqualObjects(getCompare(lastCallArg), getCompare(arg));
|
|
6485
|
-
if (diff < timeframe && objectsEqual) {
|
|
6486
|
-
return;
|
|
6487
|
-
}
|
|
6488
|
-
map.set(fn, {
|
|
6489
|
-
lastCallTime: now,
|
|
6490
|
-
lastCallArg: arg
|
|
6491
|
-
});
|
|
6492
|
-
fn(arg);
|
|
6493
|
-
};
|
|
6494
|
-
}
|
|
6495
|
-
|
|
6496
|
-
// src/components/DataSource/GroupRowsState.ts
|
|
6497
|
-
var GroupRowsState = class {
|
|
6498
|
-
constructor(state) {
|
|
6499
|
-
this.update(state instanceof GroupRowsState ? state.getState() : state);
|
|
6500
|
-
}
|
|
6501
|
-
getState() {
|
|
6502
|
-
var _a, _b, _c, _d;
|
|
6503
|
-
return {
|
|
6504
|
-
expandedRows: this.expandedAll ? true : (_b = (_a = this.expandedMap) == null ? void 0 : _a.topDownKeys()) != null ? _b : [],
|
|
6505
|
-
collapsedRows: this.collapsedAll ? true : (_d = (_c = this.collapsedMap) == null ? void 0 : _c.topDownKeys()) != null ? _d : []
|
|
6506
|
-
};
|
|
6507
|
-
}
|
|
6508
|
-
destroy() {
|
|
6509
|
-
var _a, _b;
|
|
6510
|
-
(_a = this.expandedMap) == null ? void 0 : _a.clear();
|
|
6511
|
-
(_b = this.collapsedMap) == null ? void 0 : _b.clear();
|
|
6512
|
-
delete this.expandedMap;
|
|
6513
|
-
delete this.collapsedMap;
|
|
6514
|
-
}
|
|
6515
|
-
update(state) {
|
|
6516
|
-
var _a, _b, _c, _d;
|
|
6517
|
-
this.initialState = state;
|
|
6518
|
-
const { collapsedRows, expandedRows } = this.initialState;
|
|
6519
|
-
this.collapsedAll = collapsedRows === true;
|
|
6520
|
-
this.expandedAll = expandedRows === true;
|
|
6521
|
-
if (this.collapsedAll && this.expandedAll) {
|
|
6522
|
-
throw `Cannot have both collapsedRows and expandedRows be true!`;
|
|
6523
|
-
}
|
|
6524
|
-
if (collapsedRows !== true) {
|
|
6525
|
-
(_a = this.collapsedMap) == null ? void 0 : _a.clear();
|
|
6526
|
-
this.collapsedMap = (_b = this.collapsedMap) != null ? _b : new DeepMap(collapsedRows.map((keys) => [keys, true]));
|
|
6527
|
-
}
|
|
6528
|
-
if (expandedRows !== true) {
|
|
6529
|
-
(_c = this.expandedMap) == null ? void 0 : _c.clear();
|
|
6530
|
-
this.expandedMap = (_d = this.expandedMap) != null ? _d : new DeepMap(expandedRows.map((keys) => [keys, true]));
|
|
6531
|
-
}
|
|
6532
|
-
}
|
|
6533
|
-
areAllCollapsed() {
|
|
6534
|
-
return this.collapsedAll && (this.expandedMap ? this.expandedMap.size === 0 : true);
|
|
6535
|
-
}
|
|
6536
|
-
areAllExpanded() {
|
|
6537
|
-
return this.expandedAll && (this.collapsedMap ? this.collapsedMap.size === 0 : true);
|
|
6538
|
-
}
|
|
6539
|
-
collapseAll() {
|
|
6540
|
-
this.update({
|
|
6541
|
-
collapsedRows: true,
|
|
6542
|
-
expandedRows: []
|
|
6543
|
-
});
|
|
6544
|
-
}
|
|
6545
|
-
expandAll() {
|
|
6546
|
-
this.update({
|
|
6547
|
-
expandedRows: true,
|
|
6548
|
-
collapsedRows: []
|
|
6549
|
-
});
|
|
6550
|
-
}
|
|
6551
|
-
isGroupRowExpanded(keys) {
|
|
6552
|
-
var _a, _b;
|
|
6553
|
-
if (this.expandedAll === true) {
|
|
6554
|
-
if (this.collapsedAll === true) {
|
|
6555
|
-
throw 'Cannot have both expandedRows and collapsedRows be "true"';
|
|
6556
|
-
}
|
|
6557
|
-
return !((_a = this.collapsedMap) == null ? void 0 : _a.has(keys));
|
|
6558
|
-
}
|
|
6559
|
-
return (_b = this.expandedMap) == null ? void 0 : _b.has(keys);
|
|
6560
|
-
}
|
|
6561
|
-
isGroupRowCollapsed(keys) {
|
|
6562
|
-
return !this.isGroupRowExpanded(keys);
|
|
6563
|
-
}
|
|
6564
|
-
setGroupRowExpanded(keys, shouldExpand) {
|
|
6565
|
-
var _a;
|
|
6566
|
-
if (shouldExpand === this.isGroupRowExpanded(keys)) {
|
|
6567
|
-
return;
|
|
6568
|
-
}
|
|
6569
|
-
if (shouldExpand) {
|
|
6570
|
-
if (this.collapsedAll === true) {
|
|
6571
|
-
if (!this.expandedMap) {
|
|
6572
|
-
throw `No expandedMap found when trying to expand group row ${keys.join(",")}`;
|
|
6573
|
-
}
|
|
6574
|
-
this.expandedMap.set(keys, true);
|
|
6575
|
-
} else if (this.expandedAll === true) {
|
|
6576
|
-
if (!this.collapsedMap) {
|
|
6577
|
-
throw `No collapsedMap found when trying to expand group row ${keys.join(",")}`;
|
|
6578
|
-
}
|
|
6579
|
-
this.collapsedMap.delete(keys);
|
|
6580
|
-
}
|
|
6581
|
-
} else {
|
|
6582
|
-
if (this.expandedAll === true) {
|
|
6583
|
-
if (!this.collapsedMap) {
|
|
6584
|
-
throw `No collapsedMap found when trying to collapse group row ${keys.join(",")}`;
|
|
6585
|
-
}
|
|
6586
|
-
this.collapsedMap.set(keys, true);
|
|
6587
|
-
} else if (this.collapsedAll === true) {
|
|
6588
|
-
if (!this.expandedMap) {
|
|
6589
|
-
throw `No expandedMap found when trying to collapse group row ${keys.join(",")}`;
|
|
6590
|
-
}
|
|
6591
|
-
(_a = this.expandedMap) == null ? void 0 : _a.delete(keys);
|
|
6592
|
-
}
|
|
6593
|
-
}
|
|
7259
|
+
}
|
|
7260
|
+
|
|
7261
|
+
// src/utils/shallowEqualObjects.ts
|
|
7262
|
+
function shallowEqualObjects(objA, objB, ignoreKeys) {
|
|
7263
|
+
if (objA === objB) {
|
|
7264
|
+
return true;
|
|
6594
7265
|
}
|
|
6595
|
-
|
|
6596
|
-
|
|
7266
|
+
if (!objA || !objB) {
|
|
7267
|
+
return false;
|
|
6597
7268
|
}
|
|
6598
|
-
|
|
6599
|
-
|
|
7269
|
+
var aKeys = Object.keys(objA);
|
|
7270
|
+
var bKeys = Object.keys(objB);
|
|
7271
|
+
if (ignoreKeys) {
|
|
7272
|
+
aKeys = aKeys.filter((key2) => !ignoreKeys.has(key2));
|
|
7273
|
+
bKeys = bKeys.filter((key2) => !ignoreKeys.has(key2));
|
|
6600
7274
|
}
|
|
6601
|
-
|
|
6602
|
-
|
|
7275
|
+
var len = aKeys.length;
|
|
7276
|
+
if (bKeys.length !== len) {
|
|
7277
|
+
return false;
|
|
6603
7278
|
}
|
|
6604
|
-
|
|
7279
|
+
for (var i = 0; i < len; i++) {
|
|
7280
|
+
var key = aKeys[i];
|
|
7281
|
+
if (ignoreKeys) {
|
|
7282
|
+
if (ignoreKeys.has(key)) {
|
|
7283
|
+
continue;
|
|
7284
|
+
}
|
|
7285
|
+
}
|
|
7286
|
+
if (objA[key] !== objB[key] || !Object.prototype.hasOwnProperty.call(objB, key)) {
|
|
7287
|
+
return false;
|
|
7288
|
+
}
|
|
7289
|
+
}
|
|
7290
|
+
return true;
|
|
7291
|
+
}
|
|
7292
|
+
|
|
7293
|
+
// src/components/utils/discardCallsWithEqualArg.ts
|
|
7294
|
+
var map = new WeakMap();
|
|
7295
|
+
var getCompareDefault = (a) => a;
|
|
7296
|
+
function discardCallsWithEqualArg(fn, timeframe = 50, getCompareObject) {
|
|
7297
|
+
map.set(fn, {
|
|
7298
|
+
lastCallTime: 0,
|
|
7299
|
+
lastCallArg: null
|
|
7300
|
+
});
|
|
7301
|
+
const getCompare = getCompareObject != null ? getCompareObject : getCompareDefault;
|
|
7302
|
+
return (arg) => {
|
|
7303
|
+
const { lastCallTime, lastCallArg } = map.get(fn) || {
|
|
7304
|
+
lastCallTime: 0,
|
|
7305
|
+
lastCallArg: null
|
|
7306
|
+
};
|
|
7307
|
+
const now = Date.now();
|
|
7308
|
+
const diff = now - lastCallTime;
|
|
7309
|
+
const objectsEqual = shallowEqualObjects(getCompare(lastCallArg), getCompare(arg));
|
|
7310
|
+
if (diff < timeframe && objectsEqual) {
|
|
7311
|
+
return;
|
|
7312
|
+
}
|
|
7313
|
+
map.set(fn, {
|
|
7314
|
+
lastCallTime: now,
|
|
7315
|
+
lastCallArg: arg
|
|
7316
|
+
});
|
|
7317
|
+
fn(arg);
|
|
7318
|
+
};
|
|
7319
|
+
}
|
|
6605
7320
|
|
|
6606
7321
|
// src/components/DataSource/state/normalizeSortInfo.ts
|
|
6607
7322
|
var EMPTY_ARRAY = Object.freeze([]);
|
|
@@ -6648,9 +7363,12 @@ function initSetupState() {
|
|
|
6648
7363
|
pivotColumns: void 0,
|
|
6649
7364
|
pivotColumnGroups: void 0,
|
|
6650
7365
|
dataArray,
|
|
7366
|
+
unfilteredCount: dataArray.length,
|
|
7367
|
+
filteredCount: dataArray.length,
|
|
6651
7368
|
updatedAt: now,
|
|
6652
7369
|
groupedAt: 0,
|
|
6653
7370
|
sortedAt: 0,
|
|
7371
|
+
filteredAt: 0,
|
|
6654
7372
|
reducedAt: now,
|
|
6655
7373
|
generateGroupRows: true,
|
|
6656
7374
|
groupDeepMap: void 0,
|
|
@@ -6673,6 +7391,16 @@ var forwardProps2 = (setupState) => {
|
|
|
6673
7391
|
pivotBy: 1,
|
|
6674
7392
|
primaryKey: 1,
|
|
6675
7393
|
livePagination: 1,
|
|
7394
|
+
filterFunction: 1,
|
|
7395
|
+
filterValue: 1,
|
|
7396
|
+
filterDelay: (filterDelay) => filterDelay != null ? filterDelay : 200,
|
|
7397
|
+
filterTypes: (filterTypes) => {
|
|
7398
|
+
return __spreadValues(__spreadValues({}, defaultFilterTypes), filterTypes);
|
|
7399
|
+
},
|
|
7400
|
+
sortTypes: (sortTypes) => {
|
|
7401
|
+
return __spreadValues(__spreadValues({}, sortTypes_default), sortTypes);
|
|
7402
|
+
},
|
|
7403
|
+
sortMode: (sortMode) => sortMode != null ? sortMode : "local",
|
|
6676
7404
|
aggregationReducers: 1,
|
|
6677
7405
|
collapseGroupRowsOnDataFunctionChange: (collapseGroupRowsOnDataFunctionChange) => collapseGroupRowsOnDataFunctionChange != null ? collapseGroupRowsOnDataFunctionChange : true,
|
|
6678
7406
|
loading: (loading) => loading != null ? loading : false,
|
|
@@ -6698,10 +7426,25 @@ function getLivePaginationCursorValue(livePaginationCursorProp, state) {
|
|
|
6698
7426
|
return livePaginationCursor;
|
|
6699
7427
|
}
|
|
6700
7428
|
function mapPropsToState(params) {
|
|
7429
|
+
var _a;
|
|
6701
7430
|
const { props, state, oldState } = params;
|
|
6702
7431
|
const controlledSort = isControlledValue(props.sortInfo);
|
|
7432
|
+
const controlledFilter = isControlledValue(props.filterValue);
|
|
7433
|
+
const { filterTypes } = state;
|
|
7434
|
+
const operatorsByFilterType = Object.keys(filterTypes).reduce((acc, key) => {
|
|
7435
|
+
const operators = filterTypes[key].operators;
|
|
7436
|
+
acc[key] = acc[key] || {};
|
|
7437
|
+
const currentFilterTypeOperators = acc[key];
|
|
7438
|
+
operators.forEach((operator) => {
|
|
7439
|
+
currentFilterTypeOperators[operator.name] = operator;
|
|
7440
|
+
});
|
|
7441
|
+
return acc;
|
|
7442
|
+
}, {});
|
|
6703
7443
|
const result = {
|
|
7444
|
+
operatorsByFilterType,
|
|
6704
7445
|
controlledSort,
|
|
7446
|
+
controlledFilter,
|
|
7447
|
+
filterMode: ((_a = props.filterMode) != null ? _a : props.filterFunction != null) ? "local" : typeof props.data === "function" ? "remote" : "local",
|
|
6705
7448
|
multiSort: Array.isArray(controlledSort ? props.sortInfo : props.defaultSortInfo),
|
|
6706
7449
|
lazyLoadBatchSize: typeof props.lazyLoad === "object" ? props.lazyLoad.batchSize : void 0
|
|
6707
7450
|
};
|
|
@@ -6766,6 +7509,18 @@ function getInterceptActions() {
|
|
|
6766
7509
|
});
|
|
6767
7510
|
}
|
|
6768
7511
|
},
|
|
7512
|
+
filterValue: (filterValue, { actions, state }) => {
|
|
7513
|
+
const dataParams = buildDataSourceDataParams(state, {
|
|
7514
|
+
filterValue,
|
|
7515
|
+
livePaginationCursor: null
|
|
7516
|
+
});
|
|
7517
|
+
actions.dataParams = dataParams;
|
|
7518
|
+
if (state.livePagination) {
|
|
7519
|
+
requestAnimationFrame(() => {
|
|
7520
|
+
actions.livePaginationCursor = null;
|
|
7521
|
+
});
|
|
7522
|
+
}
|
|
7523
|
+
},
|
|
6769
7524
|
cursorId: (cursorId, { actions, state }) => {
|
|
6770
7525
|
const dataParams = buildDataSourceDataParams(state, {
|
|
6771
7526
|
__cursorId: cursorId
|
|
@@ -6847,7 +7602,7 @@ function getPivotColumnsAndColumnGroups({
|
|
|
6847
7602
|
pivotGroupKeys: [],
|
|
6848
7603
|
pivotGroupKey: "",
|
|
6849
7604
|
pivotIndex: -1,
|
|
6850
|
-
|
|
7605
|
+
valueFormatter: ({ rowInfo }) => {
|
|
6851
7606
|
var _a;
|
|
6852
7607
|
return rowInfo.isGroupRow ? (_a = rowInfo.reducerResults) == null ? void 0 : _a[reducer.id] : null;
|
|
6853
7608
|
}
|
|
@@ -6896,7 +7651,7 @@ function getPivotColumnsAndColumnGroups({
|
|
|
6896
7651
|
sortable: false,
|
|
6897
7652
|
columnGroup: parentColumnGroupId,
|
|
6898
7653
|
header,
|
|
6899
|
-
|
|
7654
|
+
valueFormatter: ({ rowInfo }) => {
|
|
6900
7655
|
var _a, _b;
|
|
6901
7656
|
if (!rowInfo.isGroupRow) {
|
|
6902
7657
|
return null;
|
|
@@ -6951,7 +7706,7 @@ function getPivotColumnsAndColumnGroups({
|
|
|
6951
7706
|
pivotIndex: keys.length - 1,
|
|
6952
7707
|
pivotBy,
|
|
6953
7708
|
sortable: false,
|
|
6954
|
-
|
|
7709
|
+
valueFormatter: ({ rowInfo }) => {
|
|
6955
7710
|
var _a, _b;
|
|
6956
7711
|
if (!rowInfo.isGroupRow) {
|
|
6957
7712
|
return null;
|
|
@@ -6999,9 +7754,68 @@ function toRowInfo(data, id, index) {
|
|
|
6999
7754
|
selfLoaded: true
|
|
7000
7755
|
};
|
|
7001
7756
|
}
|
|
7757
|
+
function filterDataSource(params) {
|
|
7758
|
+
const {
|
|
7759
|
+
filterTypes,
|
|
7760
|
+
filterValue: filterValueArray,
|
|
7761
|
+
operatorsByFilterType,
|
|
7762
|
+
filterFunction,
|
|
7763
|
+
toPrimaryKey
|
|
7764
|
+
} = params;
|
|
7765
|
+
let { dataArray } = params;
|
|
7766
|
+
if (filterFunction) {
|
|
7767
|
+
dataArray = dataArray.filter((data, index, arr) => filterFunction({
|
|
7768
|
+
data,
|
|
7769
|
+
index,
|
|
7770
|
+
dataArray: arr,
|
|
7771
|
+
primaryKey: toPrimaryKey(data, index)
|
|
7772
|
+
}));
|
|
7773
|
+
}
|
|
7774
|
+
if (filterValueArray && filterValueArray.length) {
|
|
7775
|
+
return dataArray.filter((data, index, arr) => {
|
|
7776
|
+
var _a;
|
|
7777
|
+
const param = {
|
|
7778
|
+
data,
|
|
7779
|
+
index,
|
|
7780
|
+
dataArray: arr,
|
|
7781
|
+
primaryKey: toPrimaryKey(data, index)
|
|
7782
|
+
};
|
|
7783
|
+
for (let i = 0, len = filterValueArray.length; i < len; i++) {
|
|
7784
|
+
const currentFilterValue = filterValueArray[i];
|
|
7785
|
+
const {
|
|
7786
|
+
disabled,
|
|
7787
|
+
filterValue,
|
|
7788
|
+
field,
|
|
7789
|
+
filterType: filterTypeKey,
|
|
7790
|
+
valueGetter,
|
|
7791
|
+
operator
|
|
7792
|
+
} = currentFilterValue;
|
|
7793
|
+
const filterType = filterTypes[filterTypeKey];
|
|
7794
|
+
if (disabled || !filterType) {
|
|
7795
|
+
continue;
|
|
7796
|
+
}
|
|
7797
|
+
const currentOperator = (_a = operatorsByFilterType[filterTypeKey]) == null ? void 0 : _a[operator];
|
|
7798
|
+
if (!currentOperator) {
|
|
7799
|
+
continue;
|
|
7800
|
+
}
|
|
7801
|
+
const getter = valueGetter || (({ data: data2 }) => field ? data2[field] : data2);
|
|
7802
|
+
const operatorFnParam = __spreadValues({}, param);
|
|
7803
|
+
operatorFnParam.filterValue = filterValue;
|
|
7804
|
+
operatorFnParam.currentValue = getter(param);
|
|
7805
|
+
operatorFnParam.emptyValues = filterType.emptyValues;
|
|
7806
|
+
if (!currentOperator.fn(operatorFnParam)) {
|
|
7807
|
+
return false;
|
|
7808
|
+
}
|
|
7809
|
+
}
|
|
7810
|
+
return true;
|
|
7811
|
+
});
|
|
7812
|
+
}
|
|
7813
|
+
return dataArray;
|
|
7814
|
+
}
|
|
7002
7815
|
function concludeReducer(params) {
|
|
7003
7816
|
var _a, _b;
|
|
7004
7817
|
const { state, previousState } = params;
|
|
7818
|
+
const primaryKeyDescriptor = state.primaryKey;
|
|
7005
7819
|
const sortInfo = state.sortInfo;
|
|
7006
7820
|
let shouldSort = !!(sortInfo == null ? void 0 : sortInfo.length) && !state.controlledSort;
|
|
7007
7821
|
if (state.lazyLoad || state.livePagination) {
|
|
@@ -7019,15 +7833,24 @@ function concludeReducer(params) {
|
|
|
7019
7833
|
state.originalLazyGroupData = new DeepMap();
|
|
7020
7834
|
originalDataArrayChanged = true;
|
|
7021
7835
|
}
|
|
7836
|
+
const { filterFunction, filterValue, filterTypes, operatorsByFilterType } = state;
|
|
7837
|
+
const shouldFilter = !!filterFunction || Array.isArray(filterValue) && filterValue.length;
|
|
7838
|
+
const shouldFilterClientSide = shouldFilter && state.filterMode === "local";
|
|
7839
|
+
const filterDepsChanged = haveDepsChanged(previousState, state, [
|
|
7840
|
+
"filterFunction",
|
|
7841
|
+
"filterValue",
|
|
7842
|
+
"filterTypes"
|
|
7843
|
+
]);
|
|
7844
|
+
const filterChanged = originalDataArrayChanged || filterDepsChanged;
|
|
7022
7845
|
const sortInfoChanged = haveDepsChanged(previousState, state, ["sortInfo"]);
|
|
7023
|
-
const sortDepsChanged = originalDataArrayChanged || sortInfoChanged;
|
|
7846
|
+
const sortDepsChanged = originalDataArrayChanged || filterDepsChanged || sortInfoChanged;
|
|
7847
|
+
const shouldFilterAgain = state.filterMode === "local" && (filterChanged || !state.lastFilterDataArray);
|
|
7024
7848
|
const shouldSortAgain = shouldSort && (sortDepsChanged || !state.lastSortDataArray);
|
|
7025
7849
|
const groupBy = state.groupBy;
|
|
7026
7850
|
const pivotBy = state.pivotBy;
|
|
7027
7851
|
const shouldGroup = groupBy.length > 0 || !!pivotBy;
|
|
7028
|
-
const groupsDepsChanged = originalDataArrayChanged || haveDepsChanged(previousState, state, [
|
|
7852
|
+
const groupsDepsChanged = originalDataArrayChanged || sortDepsChanged || haveDepsChanged(previousState, state, [
|
|
7029
7853
|
"generateGroupRows",
|
|
7030
|
-
"originalDataArray",
|
|
7031
7854
|
"originalLazyGroupData",
|
|
7032
7855
|
"originalLazyGroupDataChangeDetect",
|
|
7033
7856
|
"groupBy",
|
|
@@ -7036,23 +7859,44 @@ function concludeReducer(params) {
|
|
|
7036
7859
|
"aggregationReducers",
|
|
7037
7860
|
"pivotTotalColumnPosition",
|
|
7038
7861
|
"pivotGrandTotalColumnPosition",
|
|
7039
|
-
"showSeparatePivotColumnForSingleAggregation"
|
|
7040
|
-
"sortInfo"
|
|
7862
|
+
"showSeparatePivotColumnForSingleAggregation"
|
|
7041
7863
|
]);
|
|
7042
7864
|
const shouldGroupAgain = shouldGroup && (groupsDepsChanged || !state.lastGroupDataArray);
|
|
7043
7865
|
const now = Date.now();
|
|
7044
7866
|
let dataArray = state.originalDataArray;
|
|
7045
|
-
|
|
7046
|
-
|
|
7867
|
+
const toPrimaryKey = typeof primaryKeyDescriptor === "function" ? (data, index) => primaryKeyDescriptor({ data, index }) : (data, _index) => {
|
|
7868
|
+
const pk = data[primaryKeyDescriptor];
|
|
7869
|
+
return pk;
|
|
7870
|
+
};
|
|
7871
|
+
if (!shouldFilter) {
|
|
7872
|
+
state.unfilteredCount = dataArray.length;
|
|
7873
|
+
}
|
|
7874
|
+
if (shouldFilterClientSide) {
|
|
7875
|
+
state.unfilteredCount = dataArray.length;
|
|
7876
|
+
dataArray = shouldFilterAgain ? filterDataSource({
|
|
7877
|
+
dataArray,
|
|
7878
|
+
toPrimaryKey,
|
|
7879
|
+
filterTypes,
|
|
7880
|
+
operatorsByFilterType,
|
|
7881
|
+
filterFunction,
|
|
7882
|
+
filterValue
|
|
7883
|
+
}) : state.lastFilterDataArray;
|
|
7884
|
+
state.lastFilterDataArray = dataArray;
|
|
7885
|
+
state.filteredAt = now;
|
|
7886
|
+
}
|
|
7887
|
+
state.filteredCount = dataArray.length;
|
|
7888
|
+
state.postFilterDataArray = dataArray;
|
|
7889
|
+
const shouldSortClientSide = shouldSort && state.sortMode === "local";
|
|
7890
|
+
if (shouldSortClientSide) {
|
|
7891
|
+
const prevKnownTypes = multisort.knownTypes;
|
|
7892
|
+
multisort.knownTypes = state.sortTypes;
|
|
7047
7893
|
dataArray = shouldSortAgain ? multisort(sortInfo, [...dataArray]) : state.lastSortDataArray;
|
|
7894
|
+
multisort.knownTypes = prevKnownTypes;
|
|
7048
7895
|
state.lastSortDataArray = dataArray;
|
|
7049
7896
|
state.sortedAt = now;
|
|
7050
7897
|
}
|
|
7051
7898
|
state.postSortDataArray = dataArray;
|
|
7052
|
-
|
|
7053
|
-
const pk = data[state.primaryKey];
|
|
7054
|
-
return pk;
|
|
7055
|
-
};
|
|
7899
|
+
let rowInfoDataArray = state.dataArray;
|
|
7056
7900
|
if (shouldGroup) {
|
|
7057
7901
|
if (shouldGroupAgain) {
|
|
7058
7902
|
const groupResult = state.lazyLoad ? lazyGroup({
|
|
@@ -7095,7 +7939,7 @@ function concludeReducer(params) {
|
|
|
7095
7939
|
state.pivotColumns = void 0;
|
|
7096
7940
|
const arrayDifferentAfterSortStep = previousState.postSortDataArray != state.postSortDataArray;
|
|
7097
7941
|
if (arrayDifferentAfterSortStep || groupsDepsChanged) {
|
|
7098
|
-
rowInfoDataArray = dataArray.map((data, index) => toRowInfo(data, data ? toPrimaryKey(data) : index, index));
|
|
7942
|
+
rowInfoDataArray = dataArray.map((data, index) => toRowInfo(data, data ? toPrimaryKey(data, index) : index, index));
|
|
7099
7943
|
}
|
|
7100
7944
|
}
|
|
7101
7945
|
state.postGroupDataArray = rowInfoDataArray;
|
|
@@ -7123,7 +7967,7 @@ function DataSourceWithContext(props) {
|
|
|
7123
7967
|
if (typeof children === "function") {
|
|
7124
7968
|
children = children(computedValues);
|
|
7125
7969
|
}
|
|
7126
|
-
return /* @__PURE__ */
|
|
7970
|
+
return /* @__PURE__ */ createElement25(Fragment3, null, children);
|
|
7127
7971
|
}
|
|
7128
7972
|
var DataSourceRoot = getComponentStateRoot({
|
|
7129
7973
|
initSetupState,
|
|
@@ -7146,14 +7990,14 @@ function DataSourceCmp({ children }) {
|
|
|
7146
7990
|
globalThis.getDataSourceState = getState;
|
|
7147
7991
|
}
|
|
7148
7992
|
useLoadData();
|
|
7149
|
-
return /* @__PURE__ */
|
|
7993
|
+
return /* @__PURE__ */ createElement25(DataSourceContext.Provider, {
|
|
7150
7994
|
value: contextValue
|
|
7151
|
-
}, /* @__PURE__ */
|
|
7995
|
+
}, /* @__PURE__ */ createElement25(DataSourceWithContext, {
|
|
7152
7996
|
children
|
|
7153
7997
|
}));
|
|
7154
7998
|
}
|
|
7155
7999
|
function DataSource(props) {
|
|
7156
|
-
return /* @__PURE__ */
|
|
8000
|
+
return /* @__PURE__ */ createElement25(DataSourceRoot, __spreadValues({}, props), /* @__PURE__ */ createElement25(DataSourceCmp, {
|
|
7157
8001
|
children: props.children
|
|
7158
8002
|
}));
|
|
7159
8003
|
}
|
|
@@ -7161,7 +8005,7 @@ function DataSource(props) {
|
|
|
7161
8005
|
// src/components/InfiniteTable/hooks/useToggleGroupRow.ts
|
|
7162
8006
|
function useToggleGroupRow() {
|
|
7163
8007
|
const { getState: getDataSourceState, componentActions: dataSourceActions } = useDataSourceContextValue();
|
|
7164
|
-
const toggleGroupRow =
|
|
8008
|
+
const toggleGroupRow = useCallback14((groupKeys) => {
|
|
7165
8009
|
const state = getDataSourceState();
|
|
7166
8010
|
const newState = new GroupRowsState(state.groupRowsState);
|
|
7167
8011
|
newState.toggleGroupRow(groupKeys);
|
|
@@ -7193,7 +8037,7 @@ function useToggleGroupRow() {
|
|
|
7193
8037
|
|
|
7194
8038
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
7195
8039
|
function useGroupByMap(groupBy) {
|
|
7196
|
-
const groupByMap =
|
|
8040
|
+
const groupByMap = useMemo10(() => {
|
|
7197
8041
|
return groupBy.reduce((acc, groupBy2, index) => {
|
|
7198
8042
|
acc.set(groupBy2.field, {
|
|
7199
8043
|
groupBy: groupBy2,
|
|
@@ -7217,13 +8061,13 @@ function useColumnsWhen() {
|
|
|
7217
8061
|
}
|
|
7218
8062
|
} = useComponentState();
|
|
7219
8063
|
const groupByMap = useGroupByMap(groupBy);
|
|
7220
|
-
|
|
8064
|
+
useEffect22(() => {
|
|
7221
8065
|
dataSourceActions.generateGroupRows = groupRenderStrategy !== "inline";
|
|
7222
8066
|
}, [groupRenderStrategy]);
|
|
7223
|
-
|
|
8067
|
+
useEffect22(() => {
|
|
7224
8068
|
dataSourceActions.pivotTotalColumnPosition = pivotTotalColumnPosition;
|
|
7225
8069
|
}, [pivotTotalColumnPosition]);
|
|
7226
|
-
|
|
8070
|
+
useEffect22(() => {
|
|
7227
8071
|
if (pivotGrandTotalColumnPosition != void 0) {
|
|
7228
8072
|
dataSourceActions.pivotGrandTotalColumnPosition = pivotGrandTotalColumnPosition;
|
|
7229
8073
|
}
|
|
@@ -7253,7 +8097,7 @@ function useColumnsWhenInlineGroupRenderStrategy(groupByMap) {
|
|
|
7253
8097
|
base = {
|
|
7254
8098
|
groupByField: field,
|
|
7255
8099
|
field,
|
|
7256
|
-
|
|
8100
|
+
valueFormatter: ({ rowInfo }) => {
|
|
7257
8101
|
var _a;
|
|
7258
8102
|
return rowInfo.isGroupRow ? (_a = rowInfo.groupKeys) == null ? void 0 : _a[groupIndex] : rowInfo.value;
|
|
7259
8103
|
},
|
|
@@ -7297,7 +8141,7 @@ function useColumnsWhenInlineGroupRenderStrategy(groupByMap) {
|
|
|
7297
8141
|
});
|
|
7298
8142
|
return computedColumns.size === 0 ? void 0 : computedColumns;
|
|
7299
8143
|
}
|
|
7300
|
-
|
|
8144
|
+
useEffect22(() => {
|
|
7301
8145
|
const update = () => {
|
|
7302
8146
|
componentActions.columnsWhenInlineGroupRenderStrategy = computeColumnsWhenInlineGroupRenderStrategy(columns, groupByMap, groupRenderStrategy, toggleGroupRow);
|
|
7303
8147
|
};
|
|
@@ -7326,7 +8170,7 @@ function useColumnsWhenGrouping() {
|
|
|
7326
8170
|
}
|
|
7327
8171
|
} = useComponentState();
|
|
7328
8172
|
const toggleGroupRow = useToggleGroupRow();
|
|
7329
|
-
|
|
8173
|
+
useEffect22(() => {
|
|
7330
8174
|
const update = () => {
|
|
7331
8175
|
const columnsWhenGrouping = getColumnsWhenGrouping({
|
|
7332
8176
|
columns,
|
|
@@ -7462,7 +8306,7 @@ function useHideColumns(groupByMap) {
|
|
|
7462
8306
|
hideEmptyGroupColumns ? groupRowsState : null,
|
|
7463
8307
|
hideEmptyGroupColumns
|
|
7464
8308
|
]);
|
|
7465
|
-
|
|
8309
|
+
useEffect22(() => {
|
|
7466
8310
|
const isGrouped = groupBy.length > 0;
|
|
7467
8311
|
const currentState = getComponentState();
|
|
7468
8312
|
const { controlledColumnVisibility, columnVisibility } = currentState;
|
|
@@ -7577,7 +8421,7 @@ function getColumnsWhenGrouping(params) {
|
|
|
7577
8421
|
}
|
|
7578
8422
|
|
|
7579
8423
|
// src/components/InfiniteTable/hooks/useComputedVisibleColumns.ts
|
|
7580
|
-
import { useMemo as
|
|
8424
|
+
import { useMemo as useMemo11 } from "react";
|
|
7581
8425
|
|
|
7582
8426
|
// src/components/flexbox/index.ts
|
|
7583
8427
|
var computeFlex = (params) => {
|
|
@@ -7734,7 +8578,9 @@ var adjustColumnOrderForPinning = (columnOrder, columnPinning) => {
|
|
|
7734
8578
|
};
|
|
7735
8579
|
|
|
7736
8580
|
// src/components/InfiniteTable/utils/getColumnComputedType.ts
|
|
7737
|
-
var emptyType = Object.freeze({
|
|
8581
|
+
var emptyType = Object.freeze({
|
|
8582
|
+
filterType: "string"
|
|
8583
|
+
});
|
|
7738
8584
|
function getColumnComputedType(column, columnTypes) {
|
|
7739
8585
|
const defaultType = columnTypes["default"] || emptyType;
|
|
7740
8586
|
if (column.type === void 0) {
|
|
@@ -7750,22 +8596,6 @@ function getColumnComputedType(column, columnTypes) {
|
|
|
7750
8596
|
return column.type.reduce((acc, columnType) => Object.assign(acc, columnTypes[columnType]), {});
|
|
7751
8597
|
}
|
|
7752
8598
|
|
|
7753
|
-
// src/components/InfiniteTable/utils/assignFiltered.ts
|
|
7754
|
-
function assignFiltered(filterFn, target, ...rest) {
|
|
7755
|
-
let result = target;
|
|
7756
|
-
rest.forEach((obj) => {
|
|
7757
|
-
for (const key in obj) {
|
|
7758
|
-
if (obj.hasOwnProperty(key) && filterFn(obj[key], key)) {
|
|
7759
|
-
result[key] = obj[key];
|
|
7760
|
-
}
|
|
7761
|
-
}
|
|
7762
|
-
});
|
|
7763
|
-
return result;
|
|
7764
|
-
}
|
|
7765
|
-
function assignNonNull(target, ...rest) {
|
|
7766
|
-
return assignFiltered((value) => value != null, target, ...rest);
|
|
7767
|
-
}
|
|
7768
|
-
|
|
7769
8599
|
// src/components/InfiniteTable/utils/getComputedVisibleColumns.ts
|
|
7770
8600
|
var logError = err("getComputedVisibleColumns");
|
|
7771
8601
|
var isColumnVisible = (columnVisibility, _columnVisibilityAssumeVisible, colId) => {
|
|
@@ -7786,6 +8616,7 @@ var getComputedVisibleColumns = ({
|
|
|
7786
8616
|
columnHeaderCssEllipsis,
|
|
7787
8617
|
pinnedStartMaxWidth,
|
|
7788
8618
|
pinnedEndMaxWidth,
|
|
8619
|
+
filterValue,
|
|
7789
8620
|
sortable,
|
|
7790
8621
|
sortInfo,
|
|
7791
8622
|
setSortInfo,
|
|
@@ -7800,9 +8631,19 @@ var getComputedVisibleColumns = ({
|
|
|
7800
8631
|
columnVisibilityAssumeVisible
|
|
7801
8632
|
}) => {
|
|
7802
8633
|
let computedOffset = 0;
|
|
8634
|
+
const filterValueRecord = (filterValue || []).reduce((acc, filterValueItem) => {
|
|
8635
|
+
const { id, field } = filterValueItem;
|
|
8636
|
+
if (field) {
|
|
8637
|
+
acc[field] = filterValueItem;
|
|
8638
|
+
}
|
|
8639
|
+
if (id) {
|
|
8640
|
+
acc[id] = filterValueItem;
|
|
8641
|
+
}
|
|
8642
|
+
return acc;
|
|
8643
|
+
}, {});
|
|
7803
8644
|
const normalizedColumnOrder = adjustColumnOrderForPinning(columnOrder === true ? [...columns.keys()] : columnOrder, columnPinning);
|
|
7804
8645
|
const visibleColumnOrder = normalizedColumnOrder.filter((colId) => {
|
|
7805
|
-
|
|
8646
|
+
const col = columns.get(colId);
|
|
7806
8647
|
if (!col) {
|
|
7807
8648
|
logError(`Column with id "${colId}" specified in columnOrder array cannot be found in the columns map.`);
|
|
7808
8649
|
return false;
|
|
@@ -7850,7 +8691,7 @@ var getComputedVisibleColumns = ({
|
|
|
7850
8691
|
delete colTypeSizing.width;
|
|
7851
8692
|
}
|
|
7852
8693
|
colSizing = assignNonNull(colTypeSizing, colSizing);
|
|
7853
|
-
|
|
8694
|
+
const colFlex = (_a = colSizing.flex) != null ? _a : void 0;
|
|
7854
8695
|
const colMinWidth = (_c = (_b = colSizing.minWidth) != null ? _b : column == null ? void 0 : column.minWidth) != null ? _c : columnMinWidth;
|
|
7855
8696
|
const colMaxWidth = (_e = (_d = colSizing.maxWidth) != null ? _d : column == null ? void 0 : column.maxWidth) != null ? _e : columnMaxWidth;
|
|
7856
8697
|
let size = colFlex != void 0 ? void 0 : (_f = colSizing.width) != null ? _f : columnDefaultWidth;
|
|
@@ -7893,7 +8734,7 @@ var getComputedVisibleColumns = ({
|
|
|
7893
8734
|
});
|
|
7894
8735
|
const firstPinnedEndAbsoluteOffset = bodySize.width - totalPinnedEndWidth;
|
|
7895
8736
|
columnsArray.forEach((c, i) => {
|
|
7896
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
|
|
8737
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
|
|
7897
8738
|
const id = visibleColumnOrder[i];
|
|
7898
8739
|
const nextColumnId = visibleColumnOrder[i + 1];
|
|
7899
8740
|
const colType = getColumnComputedType(c, columnTypes);
|
|
@@ -7904,47 +8745,6 @@ var getComputedVisibleColumns = ({
|
|
|
7904
8745
|
const computedSortedDesc = computedSorted && !computedSortedAsc;
|
|
7905
8746
|
const computedSortIndex = (_c = sortingInfo == null ? void 0 : sortingInfo.index) != null ? _c : -1;
|
|
7906
8747
|
const computedWidth = computedSizes[i];
|
|
7907
|
-
const toggleSort = () => {
|
|
7908
|
-
let currentSortInfo = computedSortInfo;
|
|
7909
|
-
let newColumnSortInfo;
|
|
7910
|
-
if (!currentSortInfo) {
|
|
7911
|
-
newColumnSortInfo = {
|
|
7912
|
-
dir: 1,
|
|
7913
|
-
id,
|
|
7914
|
-
field: c.field,
|
|
7915
|
-
type: c.type
|
|
7916
|
-
};
|
|
7917
|
-
} else {
|
|
7918
|
-
if (computedSortedDesc) {
|
|
7919
|
-
newColumnSortInfo = null;
|
|
7920
|
-
} else {
|
|
7921
|
-
newColumnSortInfo = __spreadProps(__spreadValues({}, computedSortInfo), {
|
|
7922
|
-
dir: -1
|
|
7923
|
-
});
|
|
7924
|
-
}
|
|
7925
|
-
}
|
|
7926
|
-
if (c.field && newColumnSortInfo && !newColumnSortInfo.field) {
|
|
7927
|
-
newColumnSortInfo.field = c.field;
|
|
7928
|
-
}
|
|
7929
|
-
let finalSortInfo = sortInfo ? [...sortInfo] : [];
|
|
7930
|
-
if (multiSort) {
|
|
7931
|
-
if (computedSortIndex === -1) {
|
|
7932
|
-
if (newColumnSortInfo) {
|
|
7933
|
-
finalSortInfo.push(newColumnSortInfo);
|
|
7934
|
-
}
|
|
7935
|
-
} else {
|
|
7936
|
-
finalSortInfo = finalSortInfo.map((info, index) => {
|
|
7937
|
-
if (index === computedSortIndex) {
|
|
7938
|
-
return newColumnSortInfo;
|
|
7939
|
-
}
|
|
7940
|
-
return info;
|
|
7941
|
-
}).filter((x) => x != null);
|
|
7942
|
-
}
|
|
7943
|
-
} else {
|
|
7944
|
-
finalSortInfo = newColumnSortInfo ? [newColumnSortInfo] : [];
|
|
7945
|
-
}
|
|
7946
|
-
setSortInfo(finalSortInfo);
|
|
7947
|
-
};
|
|
7948
8748
|
const computedPinned = getComputedPinned(id, columnPinning);
|
|
7949
8749
|
const computedLast = i === visibleColumnOrder.length - 1;
|
|
7950
8750
|
const computedPinningOffset = computedPinned === "start" ? computedPinnedStartColumnsWidth : computedPinned === "end" ? computedPinnedEndColumnsWidth : computedOffset - computedPinnedStartColumnsWidth;
|
|
@@ -7953,23 +8753,46 @@ var getComputedVisibleColumns = ({
|
|
|
7953
8753
|
const computedLastInCategory = computedLast || computedPinned !== getComputedPinned(nextColumnId, columnPinning);
|
|
7954
8754
|
const cssEllipsis = (_e = (_d = c.cssEllipsis) != null ? _d : colType.cssEllipsis) != null ? _e : columnCssEllipsis;
|
|
7955
8755
|
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;
|
|
8756
|
+
const computedFilterValue = filterValueRecord[id] || c.field ? filterValueRecord[c.field] || null : null;
|
|
8757
|
+
const computedFiltered = computedFilterValue != null;
|
|
8758
|
+
const computedFilterable = (_l = (_k = c.defaultFilterable) != null ? _k : colType.defaultFilterable) != null ? _l : true;
|
|
8759
|
+
const computedDataType = c.dataType || colType.dataType || (Array.isArray(c.type) ? c.type[0] : c.type) || "string";
|
|
8760
|
+
const computedSortType = c.sortType || colType.sortType || computedDataType;
|
|
8761
|
+
const computedFilterType = c.filterType || colType.filterType || computedDataType;
|
|
8762
|
+
const field = (_m = c.field) != null ? _m : colType.field;
|
|
8763
|
+
const valueGetter = (_n = c.valueGetter) != null ? _n : colType.valueGetter;
|
|
8764
|
+
let sortableColumnOrType = (_o = c.sortable) != null ? _o : colType.sortable;
|
|
8765
|
+
if (sortableColumnOrType == null) {
|
|
8766
|
+
if (field == null && valueGetter == null) {
|
|
8767
|
+
sortableColumnOrType = false;
|
|
8768
|
+
}
|
|
8769
|
+
}
|
|
8770
|
+
let computedSortable = (_p = sortableColumnOrType != null ? sortableColumnOrType : sortable) != null ? _p : true;
|
|
7956
8771
|
const result2 = __spreadProps(__spreadValues({
|
|
7957
8772
|
align: colType.align,
|
|
7958
8773
|
verticalAlign: colType.verticalAlign,
|
|
7959
8774
|
defaultHiddenWhenGroupedBy: colType.defaultHiddenWhenGroupedBy,
|
|
7960
|
-
valueGetter
|
|
8775
|
+
valueGetter,
|
|
8776
|
+
valueFormatter: colType.valueFormatter,
|
|
7961
8777
|
renderValue: colType.renderValue,
|
|
7962
8778
|
render: colType.render,
|
|
7963
8779
|
style: colType.style,
|
|
7964
|
-
components: colType.components
|
|
8780
|
+
components: colType.components,
|
|
8781
|
+
field
|
|
7965
8782
|
}, c), {
|
|
8783
|
+
computedDataType,
|
|
8784
|
+
computedSortType,
|
|
8785
|
+
computedFilterType,
|
|
7966
8786
|
cssEllipsis,
|
|
7967
8787
|
headerCssEllipsis,
|
|
8788
|
+
computedFilterValue,
|
|
8789
|
+
computedFiltered,
|
|
8790
|
+
computedFilterable,
|
|
7968
8791
|
computedWidth,
|
|
7969
8792
|
computedAbsoluteOffset,
|
|
7970
8793
|
computedPinningOffset,
|
|
7971
8794
|
computedOffset,
|
|
7972
|
-
computedSortable
|
|
8795
|
+
computedSortable,
|
|
7973
8796
|
computedSortInfo,
|
|
7974
8797
|
computedSortIndex,
|
|
7975
8798
|
computedMultiSort: multiSort,
|
|
@@ -7978,14 +8801,57 @@ var getComputedVisibleColumns = ({
|
|
|
7978
8801
|
computedSortedDesc,
|
|
7979
8802
|
computedVisibleIndex: i,
|
|
7980
8803
|
computedPinned,
|
|
7981
|
-
computedDraggable: (
|
|
8804
|
+
computedDraggable: (_r = (_q = c.draggable) != null ? _q : draggableColumns) != null ? _r : true,
|
|
7982
8805
|
computedFirstInCategory,
|
|
7983
8806
|
computedLastInCategory,
|
|
7984
8807
|
computedFirst: i === 0,
|
|
7985
8808
|
computedLast,
|
|
7986
|
-
toggleSort
|
|
8809
|
+
toggleSort: () => {
|
|
8810
|
+
const currentSortInfo = computedSortInfo;
|
|
8811
|
+
let newColumnSortInfo;
|
|
8812
|
+
if (!currentSortInfo) {
|
|
8813
|
+
newColumnSortInfo = {
|
|
8814
|
+
dir: 1,
|
|
8815
|
+
id,
|
|
8816
|
+
field: c.field,
|
|
8817
|
+
type: computedSortType
|
|
8818
|
+
};
|
|
8819
|
+
} else {
|
|
8820
|
+
if (computedSortedDesc) {
|
|
8821
|
+
newColumnSortInfo = null;
|
|
8822
|
+
} else {
|
|
8823
|
+
newColumnSortInfo = __spreadProps(__spreadValues({}, computedSortInfo), {
|
|
8824
|
+
dir: -1
|
|
8825
|
+
});
|
|
8826
|
+
}
|
|
8827
|
+
}
|
|
8828
|
+
if (c.field && newColumnSortInfo && !newColumnSortInfo.field) {
|
|
8829
|
+
newColumnSortInfo.field = c.field;
|
|
8830
|
+
}
|
|
8831
|
+
if (c.valueGetter && newColumnSortInfo && !newColumnSortInfo.valueGetter) {
|
|
8832
|
+
newColumnSortInfo.valueGetter = (data) => c.valueGetter({ data, field: c.field });
|
|
8833
|
+
}
|
|
8834
|
+
let finalSortInfo = sortInfo ? [...sortInfo] : [];
|
|
8835
|
+
if (multiSort) {
|
|
8836
|
+
if (computedSortIndex === -1) {
|
|
8837
|
+
if (newColumnSortInfo) {
|
|
8838
|
+
finalSortInfo.push(newColumnSortInfo);
|
|
8839
|
+
}
|
|
8840
|
+
} else {
|
|
8841
|
+
finalSortInfo = finalSortInfo.map((info, index) => {
|
|
8842
|
+
if (index === computedSortIndex) {
|
|
8843
|
+
return newColumnSortInfo;
|
|
8844
|
+
}
|
|
8845
|
+
return info;
|
|
8846
|
+
}).filter((x) => x != null);
|
|
8847
|
+
}
|
|
8848
|
+
} else {
|
|
8849
|
+
finalSortInfo = newColumnSortInfo ? [newColumnSortInfo] : [];
|
|
8850
|
+
}
|
|
8851
|
+
setSortInfo(finalSortInfo);
|
|
8852
|
+
},
|
|
7987
8853
|
id,
|
|
7988
|
-
header: (
|
|
8854
|
+
header: (_u = (_t = (_s = c.header) != null ? _s : colType.header) != null ? _t : c.name) != null ? _u : c.field
|
|
7989
8855
|
});
|
|
7990
8856
|
computedOffset += computedWidth;
|
|
7991
8857
|
computedVisibleColumnsMap.set(result2.id, result2);
|
|
@@ -8026,10 +8892,10 @@ var getComputedVisibleColumns = ({
|
|
|
8026
8892
|
};
|
|
8027
8893
|
|
|
8028
8894
|
// src/components/InfiniteTable/hooks/useRerenderOnKeyChange.ts
|
|
8029
|
-
import { useEffect as
|
|
8895
|
+
import { useEffect as useEffect23 } from "react";
|
|
8030
8896
|
var useRerenderOnKeyChange = (map2) => {
|
|
8031
8897
|
const [renderId, rerender] = useRerender();
|
|
8032
|
-
|
|
8898
|
+
useEffect23(() => {
|
|
8033
8899
|
const update = rafFn(rerender);
|
|
8034
8900
|
return interceptMap(map2, {
|
|
8035
8901
|
set: update,
|
|
@@ -8054,6 +8920,7 @@ var useComputedVisibleColumns = ({
|
|
|
8054
8920
|
sortInfo,
|
|
8055
8921
|
multiSort,
|
|
8056
8922
|
setSortInfo,
|
|
8923
|
+
filterValue,
|
|
8057
8924
|
columnOrder,
|
|
8058
8925
|
columnPinning,
|
|
8059
8926
|
columnTypes,
|
|
@@ -8081,7 +8948,7 @@ var useComputedVisibleColumns = ({
|
|
|
8081
8948
|
computedPinnedEndOffset,
|
|
8082
8949
|
computedPinnedEndWidth,
|
|
8083
8950
|
computedPinnedStartWidth
|
|
8084
|
-
} =
|
|
8951
|
+
} = useMemo11(() => {
|
|
8085
8952
|
return getComputedVisibleColumns({
|
|
8086
8953
|
columns,
|
|
8087
8954
|
bodySize,
|
|
@@ -8091,6 +8958,7 @@ var useComputedVisibleColumns = ({
|
|
|
8091
8958
|
columnCssEllipsis,
|
|
8092
8959
|
columnHeaderCssEllipsis,
|
|
8093
8960
|
viewportReservedWidth,
|
|
8961
|
+
filterValue,
|
|
8094
8962
|
sortable,
|
|
8095
8963
|
sortInfo,
|
|
8096
8964
|
setSortInfo,
|
|
@@ -8115,6 +8983,7 @@ var useComputedVisibleColumns = ({
|
|
|
8115
8983
|
sortInfo,
|
|
8116
8984
|
setSortInfo,
|
|
8117
8985
|
multiSort,
|
|
8986
|
+
filterValue,
|
|
8118
8987
|
columnOrder,
|
|
8119
8988
|
columnVisibility,
|
|
8120
8989
|
columnVisibilityAssumeVisible,
|
|
@@ -8147,7 +9016,7 @@ var useComputedVisibleColumns = ({
|
|
|
8147
9016
|
};
|
|
8148
9017
|
|
|
8149
9018
|
// src/components/InfiniteTable/hooks/useScrollbars.ts
|
|
8150
|
-
import { useState as
|
|
9019
|
+
import { useState as useState13, useEffect as useEffect24, useLayoutEffect as useLayoutEffect6 } from "react";
|
|
8151
9020
|
var INITIAL_SCROLLBARS = {
|
|
8152
9021
|
vertical: false,
|
|
8153
9022
|
horizontal: false
|
|
@@ -8155,8 +9024,8 @@ var INITIAL_SCROLLBARS = {
|
|
|
8155
9024
|
function useScrollbars(brain) {
|
|
8156
9025
|
const { getComponentState: getInfiniteTableState } = useComponentState();
|
|
8157
9026
|
const { getState: getDataSourceState } = useDataSourceContextValue();
|
|
8158
|
-
const [scrollbars, setScrollbars] =
|
|
8159
|
-
|
|
9027
|
+
const [scrollbars, setScrollbars] = useState13(INITIAL_SCROLLBARS);
|
|
9028
|
+
useEffect24(() => {
|
|
8160
9029
|
return brain.onRenderCountChange(() => {
|
|
8161
9030
|
const { scrollTopMax, scrollLeftMax } = brain;
|
|
8162
9031
|
setScrollbars({
|
|
@@ -8165,7 +9034,7 @@ function useScrollbars(brain) {
|
|
|
8165
9034
|
});
|
|
8166
9035
|
});
|
|
8167
9036
|
}, [brain]);
|
|
8168
|
-
|
|
9037
|
+
useLayoutEffect6(() => {
|
|
8169
9038
|
const dataSourceState = getDataSourceState();
|
|
8170
9039
|
const { onScrollbarsChange } = getInfiniteTableState();
|
|
8171
9040
|
const { notifyScrollbarsChange } = dataSourceState;
|
|
@@ -8196,27 +9065,27 @@ function useComputed() {
|
|
|
8196
9065
|
bodySize,
|
|
8197
9066
|
showSeparatePivotColumnForSingleAggregation
|
|
8198
9067
|
} = componentState;
|
|
8199
|
-
|
|
9068
|
+
useState14(() => {
|
|
8200
9069
|
componentState.onRowHeightCSSVarChange.onChange((rowHeight) => {
|
|
8201
9070
|
if (rowHeight) {
|
|
8202
9071
|
componentActions.rowHeight = rowHeight;
|
|
8203
9072
|
}
|
|
8204
9073
|
});
|
|
8205
|
-
componentState.
|
|
8206
|
-
if (
|
|
8207
|
-
componentActions.
|
|
9074
|
+
componentState.onColumnHeaderHeightCSSVarChange.onChange((columnHeaderHeight) => {
|
|
9075
|
+
if (columnHeaderHeight) {
|
|
9076
|
+
componentActions.columnHeaderHeight = columnHeaderHeight;
|
|
8208
9077
|
}
|
|
8209
9078
|
});
|
|
8210
9079
|
});
|
|
8211
|
-
|
|
9080
|
+
useEffect25(() => {
|
|
8212
9081
|
dataSourceActions.showSeparatePivotColumnForSingleAggregation = showSeparatePivotColumnForSingleAggregation;
|
|
8213
9082
|
}, [showSeparatePivotColumnForSingleAggregation]);
|
|
8214
|
-
const { multiSort } = dataSourceState;
|
|
9083
|
+
const { multiSort, filterValue } = dataSourceState;
|
|
8215
9084
|
useColumnGroups();
|
|
8216
9085
|
const { toggleGroupRow } = useColumnsWhen();
|
|
8217
|
-
const setSortInfo =
|
|
9086
|
+
const setSortInfo = useCallback15((sortInfo) => {
|
|
8218
9087
|
var _a2;
|
|
8219
|
-
const newSortInfo = multiSort ? sortInfo : (_a2 = sortInfo[0]) != null ? _a2 : null;
|
|
9088
|
+
const newSortInfo = getDataSourceState().multiSort ? sortInfo : (_a2 = sortInfo[0]) != null ? _a2 : null;
|
|
8220
9089
|
dataSourceActions.sortInfo = newSortInfo;
|
|
8221
9090
|
}, [getDataSourceState]);
|
|
8222
9091
|
const columns = componentState.computedColumns;
|
|
@@ -8255,6 +9124,7 @@ function useComputed() {
|
|
|
8255
9124
|
columnVisibility,
|
|
8256
9125
|
columnVisibilityAssumeVisible: true,
|
|
8257
9126
|
columnPinning,
|
|
9127
|
+
filterValue,
|
|
8258
9128
|
columnSizing,
|
|
8259
9129
|
columnTypes
|
|
8260
9130
|
});
|
|
@@ -8264,6 +9134,7 @@ function useComputed() {
|
|
|
8264
9134
|
const computedPinnedStartOverflow = computedPinnedStartWidth ? computedPinnedStartColumnsWidth > computedPinnedStartWidth : false;
|
|
8265
9135
|
const computedPinnedEndOverflow = computedPinnedEndWidth ? computedPinnedEndColumnsWidth > computedPinnedEndWidth : false;
|
|
8266
9136
|
return {
|
|
9137
|
+
showColumnFilters: !!dataSourceState.filterValue,
|
|
8267
9138
|
scrollbars,
|
|
8268
9139
|
columnSize,
|
|
8269
9140
|
rowspan,
|
|
@@ -8371,7 +9242,7 @@ function useDOMProps(initialDOMProps) {
|
|
|
8371
9242
|
}
|
|
8372
9243
|
|
|
8373
9244
|
// src/components/InfiniteTable/hooks/useLicense/useLicense.ts
|
|
8374
|
-
import { useMemo as
|
|
9245
|
+
import { useMemo as useMemo12 } from "react";
|
|
8375
9246
|
|
|
8376
9247
|
// src/components/InfiniteTable/hooks/useLicense/crc32.ts
|
|
8377
9248
|
var DEFAULT_ReversedPolynomial = 3988292384;
|
|
@@ -8529,10 +9400,10 @@ var isInsideSandbox = () => {
|
|
|
8529
9400
|
};
|
|
8530
9401
|
var isInsidePlayground = isInsideSandbox() || isInsideSandpack();
|
|
8531
9402
|
var useLicense = (licenseKey = "") => {
|
|
8532
|
-
const valid =
|
|
9403
|
+
const valid = useMemo12(() => {
|
|
8533
9404
|
let valid2 = isValidLicense(licenseKey, {
|
|
8534
9405
|
publishedAt: 1624970570587,
|
|
8535
|
-
version: "0.3.
|
|
9406
|
+
version: "0.3.4"
|
|
8536
9407
|
});
|
|
8537
9408
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
8538
9409
|
return true;
|
|
@@ -8542,6 +9413,140 @@ var useLicense = (licenseKey = "") => {
|
|
|
8542
9413
|
return valid;
|
|
8543
9414
|
};
|
|
8544
9415
|
|
|
9416
|
+
// src/components/utils/clamp.ts
|
|
9417
|
+
function clamp(value, min, max) {
|
|
9418
|
+
return Math.min(Math.max(value, min), max);
|
|
9419
|
+
}
|
|
9420
|
+
|
|
9421
|
+
// src/components/InfiniteTable/keyboardNavigationAndSelection.ts
|
|
9422
|
+
function handleRowNavigation(options) {
|
|
9423
|
+
const { key, getState, getDataSourceState, actions } = options;
|
|
9424
|
+
const arrLength = getDataSourceState().dataArray.length;
|
|
9425
|
+
const state = getState();
|
|
9426
|
+
const { brain } = state;
|
|
9427
|
+
let { activeRowIndex } = state;
|
|
9428
|
+
if (activeRowIndex == null) {
|
|
9429
|
+
return false;
|
|
9430
|
+
}
|
|
9431
|
+
const {
|
|
9432
|
+
start: [startRow],
|
|
9433
|
+
end: [endRow]
|
|
9434
|
+
} = brain.getRenderRange();
|
|
9435
|
+
const renderRowCount = endRow - startRow - 1;
|
|
9436
|
+
const min = 0;
|
|
9437
|
+
const max = arrLength - 1;
|
|
9438
|
+
const KeyToFunction = {
|
|
9439
|
+
ArrowDown: () => {
|
|
9440
|
+
activeRowIndex = clamp(activeRowIndex + 1, min, max);
|
|
9441
|
+
},
|
|
9442
|
+
ArrowUp: () => {
|
|
9443
|
+
activeRowIndex = clamp(activeRowIndex - 1, min, max);
|
|
9444
|
+
},
|
|
9445
|
+
PageDown: () => {
|
|
9446
|
+
activeRowIndex = Math.min(activeRowIndex + renderRowCount, arrLength - 1);
|
|
9447
|
+
},
|
|
9448
|
+
PageUp: () => {
|
|
9449
|
+
activeRowIndex = Math.max(activeRowIndex - renderRowCount, min);
|
|
9450
|
+
},
|
|
9451
|
+
End: () => {
|
|
9452
|
+
activeRowIndex = max;
|
|
9453
|
+
},
|
|
9454
|
+
Home: () => {
|
|
9455
|
+
activeRowIndex = min;
|
|
9456
|
+
}
|
|
9457
|
+
};
|
|
9458
|
+
const Fn = KeyToFunction[key];
|
|
9459
|
+
if (!Fn) {
|
|
9460
|
+
return false;
|
|
9461
|
+
}
|
|
9462
|
+
Fn();
|
|
9463
|
+
actions.activeRowIndex = activeRowIndex;
|
|
9464
|
+
return true;
|
|
9465
|
+
}
|
|
9466
|
+
function handleCellNavigation(options) {
|
|
9467
|
+
const { key, shiftKey, getState, getComputed, getDataSourceState, actions } = options;
|
|
9468
|
+
const state = getState();
|
|
9469
|
+
const { activeCellIndex, brain } = state;
|
|
9470
|
+
if (!activeCellIndex) {
|
|
9471
|
+
return false;
|
|
9472
|
+
}
|
|
9473
|
+
let [rowIndex, colIndex] = activeCellIndex;
|
|
9474
|
+
const {
|
|
9475
|
+
start: [startRow, startCol],
|
|
9476
|
+
end: [endRow, endCol]
|
|
9477
|
+
} = brain.getRenderRange();
|
|
9478
|
+
const renderRowCount = endRow - startRow - 1;
|
|
9479
|
+
const renderColCount = endCol - startCol - 1;
|
|
9480
|
+
const maxRow = getDataSourceState().dataArray.length - 1;
|
|
9481
|
+
const maxCol = getComputed().computedVisibleColumns.length - 1;
|
|
9482
|
+
const minRow = 0;
|
|
9483
|
+
const minCol = 0;
|
|
9484
|
+
rowIndex = clamp(rowIndex, 0, maxRow);
|
|
9485
|
+
colIndex = clamp(colIndex, 0, maxCol);
|
|
9486
|
+
actions.activeCellIndex = [rowIndex, colIndex];
|
|
9487
|
+
const KeyToFunction = {
|
|
9488
|
+
ArrowDown: () => {
|
|
9489
|
+
rowIndex = clamp(rowIndex + 1, minRow, maxRow);
|
|
9490
|
+
},
|
|
9491
|
+
ArrowUp: () => {
|
|
9492
|
+
rowIndex = clamp(rowIndex - 1, minRow, maxRow);
|
|
9493
|
+
},
|
|
9494
|
+
ArrowLeft: () => {
|
|
9495
|
+
colIndex = clamp(colIndex - 1, minCol, maxCol);
|
|
9496
|
+
},
|
|
9497
|
+
ArrowRight: () => {
|
|
9498
|
+
colIndex = clamp(colIndex + 1, minCol, maxCol);
|
|
9499
|
+
},
|
|
9500
|
+
PageDown: () => {
|
|
9501
|
+
if (!shiftKey) {
|
|
9502
|
+
rowIndex = Math.min(rowIndex + renderRowCount, maxRow);
|
|
9503
|
+
} else {
|
|
9504
|
+
colIndex = Math.min(colIndex + renderColCount, maxCol);
|
|
9505
|
+
}
|
|
9506
|
+
},
|
|
9507
|
+
PageUp: () => {
|
|
9508
|
+
if (!shiftKey) {
|
|
9509
|
+
rowIndex = Math.max(rowIndex - renderRowCount, minRow);
|
|
9510
|
+
} else {
|
|
9511
|
+
colIndex = Math.max(colIndex - renderColCount, minCol);
|
|
9512
|
+
}
|
|
9513
|
+
},
|
|
9514
|
+
End: () => {
|
|
9515
|
+
if (!shiftKey) {
|
|
9516
|
+
rowIndex = maxRow;
|
|
9517
|
+
} else {
|
|
9518
|
+
colIndex = maxCol;
|
|
9519
|
+
}
|
|
9520
|
+
},
|
|
9521
|
+
Home: () => {
|
|
9522
|
+
if (!shiftKey) {
|
|
9523
|
+
rowIndex = minRow;
|
|
9524
|
+
} else {
|
|
9525
|
+
colIndex = minCol;
|
|
9526
|
+
}
|
|
9527
|
+
}
|
|
9528
|
+
};
|
|
9529
|
+
const Fn = KeyToFunction[key];
|
|
9530
|
+
if (!Fn) {
|
|
9531
|
+
return false;
|
|
9532
|
+
}
|
|
9533
|
+
Fn();
|
|
9534
|
+
actions.activeCellIndex = [rowIndex, colIndex];
|
|
9535
|
+
return true;
|
|
9536
|
+
}
|
|
9537
|
+
function handleKeyboardNavigation(options) {
|
|
9538
|
+
const { getState } = options;
|
|
9539
|
+
const state = getState();
|
|
9540
|
+
const { activeRowIndex, activeCellIndex } = state;
|
|
9541
|
+
if (activeRowIndex != null) {
|
|
9542
|
+
return handleRowNavigation(options);
|
|
9543
|
+
}
|
|
9544
|
+
if (activeCellIndex != null) {
|
|
9545
|
+
return handleCellNavigation(options);
|
|
9546
|
+
}
|
|
9547
|
+
return false;
|
|
9548
|
+
}
|
|
9549
|
+
|
|
8545
9550
|
// src/components/InfiniteTable/state/getInitialState.ts
|
|
8546
9551
|
import { createRef } from "react";
|
|
8547
9552
|
|
|
@@ -8599,6 +9604,18 @@ function toMap(mapOrObject, weakMapCache) {
|
|
|
8599
9604
|
}
|
|
8600
9605
|
|
|
8601
9606
|
// src/components/InfiniteTable/state/getInitialState.ts
|
|
9607
|
+
function createRenderer2(brain) {
|
|
9608
|
+
const renderer = new ReactHeadlessTableRenderer(brain);
|
|
9609
|
+
const onRenderUpdater = buildSubscriptionCallback();
|
|
9610
|
+
brain.onDestroy(() => {
|
|
9611
|
+
renderer.destroy();
|
|
9612
|
+
onRenderUpdater.destroy();
|
|
9613
|
+
});
|
|
9614
|
+
return {
|
|
9615
|
+
renderer,
|
|
9616
|
+
onRenderUpdater
|
|
9617
|
+
};
|
|
9618
|
+
}
|
|
8602
9619
|
function initSetupState2() {
|
|
8603
9620
|
const columnsGeneratedForGrouping = new Map();
|
|
8604
9621
|
const brain = new MatrixBrain();
|
|
@@ -8612,10 +9629,16 @@ function initSetupState2() {
|
|
|
8612
9629
|
if (true) {
|
|
8613
9630
|
globalThis.brain = brain;
|
|
8614
9631
|
}
|
|
9632
|
+
const { renderer, onRenderUpdater } = createRenderer2(brain);
|
|
8615
9633
|
brain.onAvailableSizeChange((size) => {
|
|
8616
9634
|
headerBrain.setAvailableSize({ width: size.width });
|
|
8617
9635
|
});
|
|
9636
|
+
if (true) {
|
|
9637
|
+
globalThis.renderer = renderer;
|
|
9638
|
+
}
|
|
8618
9639
|
return {
|
|
9640
|
+
renderer,
|
|
9641
|
+
onRenderUpdater,
|
|
8619
9642
|
propsCache: new Map([]),
|
|
8620
9643
|
brain,
|
|
8621
9644
|
headerBrain,
|
|
@@ -8624,7 +9647,7 @@ function initSetupState2() {
|
|
|
8624
9647
|
scrollerDOMRef: createRef(),
|
|
8625
9648
|
portalDOMRef: createRef(),
|
|
8626
9649
|
onRowHeightCSSVarChange: buildSubscriptionCallback(),
|
|
8627
|
-
|
|
9650
|
+
onColumnHeaderHeightCSSVarChange: buildSubscriptionCallback(),
|
|
8628
9651
|
bodySize: {
|
|
8629
9652
|
width: 0,
|
|
8630
9653
|
height: 0
|
|
@@ -8674,26 +9697,31 @@ var forwardProps3 = (setupState) => {
|
|
|
8674
9697
|
onScrollbarsChange: 1,
|
|
8675
9698
|
autoSizeColumnsKey: 1,
|
|
8676
9699
|
scrollStopDelay: (scrollStopDelay) => scrollStopDelay != null ? scrollStopDelay : 250,
|
|
9700
|
+
filterEditors: (filterEditors) => __spreadValues(__spreadValues({}, defaultFilterEditors), filterEditors),
|
|
8677
9701
|
viewportReservedWidth: (viewportReservedWidth) => viewportReservedWidth != null ? viewportReservedWidth : 0,
|
|
8678
|
-
activeIndex: (activeIndex) => activeIndex != null ? activeIndex : 0,
|
|
8679
9702
|
columnMinWidth: (columnMinWidth) => columnMinWidth != null ? columnMinWidth : 30,
|
|
8680
9703
|
columnMaxWidth: (columnMaxWidth) => columnMaxWidth != null ? columnMaxWidth : 2e3,
|
|
8681
9704
|
columnDefaultWidth: (columnDefaultWidth) => columnDefaultWidth != null ? columnDefaultWidth : 200,
|
|
8682
9705
|
columnCssEllipsis: (columnCssEllipsis) => columnCssEllipsis != null ? columnCssEllipsis : true,
|
|
8683
9706
|
draggableColumns: (draggableColumns) => draggableColumns != null ? draggableColumns : true,
|
|
9707
|
+
headerOptions: (headerOptions) => __spreadValues({
|
|
9708
|
+
alwaysReserveSpaceForSortIcon: true
|
|
9709
|
+
}, headerOptions),
|
|
8684
9710
|
showSeparatePivotColumnForSingleAggregation: (showSeparatePivotColumnForSingleAggregation) => showSeparatePivotColumnForSingleAggregation != null ? showSeparatePivotColumnForSingleAggregation : false,
|
|
8685
9711
|
sortable: (sortable) => sortable != null ? sortable : true,
|
|
8686
9712
|
hideEmptyGroupColumns: (hideEmptyGroupColumns) => hideEmptyGroupColumns != null ? hideEmptyGroupColumns : false,
|
|
8687
9713
|
pivotTotalColumnPosition: (pivotTotalColumnPosition) => pivotTotalColumnPosition != null ? pivotTotalColumnPosition : "end",
|
|
8688
9714
|
pivotGrandTotalColumnPosition: 1,
|
|
8689
9715
|
licenseKey: (licenseKey) => licenseKey || "",
|
|
9716
|
+
activeRowIndex: (activeRowIndex) => activeRowIndex != null ? activeRowIndex : null,
|
|
9717
|
+
activeCellIndex: (activeCellIndex) => activeCellIndex != null ? activeCellIndex : null,
|
|
8690
9718
|
columnOrder: (columnOrder) => columnOrder != null ? columnOrder : true,
|
|
8691
9719
|
header: (header) => header != null ? header : true,
|
|
8692
9720
|
showZebraRows: (showZebraRows) => showZebraRows != null ? showZebraRows : true,
|
|
8693
9721
|
showHoverRows: (showHoverRows) => showHoverRows != null ? showHoverRows : true,
|
|
8694
9722
|
virtualizeColumns: (virtualizeColumns) => virtualizeColumns != null ? virtualizeColumns : true,
|
|
8695
9723
|
rowHeight: (rowHeight) => typeof rowHeight === "number" ? rowHeight : 0,
|
|
8696
|
-
|
|
9724
|
+
columnHeaderHeight: (columnHeaderHeight) => typeof columnHeaderHeight === "number" ? columnHeaderHeight : 30,
|
|
8697
9725
|
columns: (columns) => toMap(columns, setupState.propsCache.get("columns")),
|
|
8698
9726
|
columnVisibility: (columnVisibility) => columnVisibility != null ? columnVisibility : {},
|
|
8699
9727
|
columnPinning: (columnPinning) => toMap(columnPinning, setupState.propsCache.get("columnPinning")),
|
|
@@ -8734,12 +9762,13 @@ var mapPropsToState2 = (params) => {
|
|
|
8734
9762
|
groupRenderStrategy,
|
|
8735
9763
|
groupBy,
|
|
8736
9764
|
computedColumns,
|
|
9765
|
+
enableKeyboardNavigation: state.activeRowIndex != null,
|
|
8737
9766
|
columnHeaderCssEllipsis: (_b = (_a = props.columnHeaderCssEllipsis) != null ? _a : props.columnCssEllipsis) != null ? _b : true,
|
|
8738
9767
|
columnGroupsDepthsMap,
|
|
8739
9768
|
columnGroupsMaxDepth: columnGroupsDepthsMap != state.columnGroupsDepthsMap ? Math.max(...columnGroupsDepthsMap.values(), 0) : state.columnGroupsMaxDepth,
|
|
8740
9769
|
computedColumnGroups,
|
|
8741
9770
|
rowHeightCSSVar: typeof props.rowHeight === "string" ? props.rowHeight : "",
|
|
8742
|
-
|
|
9771
|
+
columnHeaderHeightCSSVar: typeof props.columnHeaderHeight === "string" ? props.columnHeaderHeight || ThemeVars.components.Header.columnHeaderHeight : ""
|
|
8743
9772
|
};
|
|
8744
9773
|
};
|
|
8745
9774
|
|
|
@@ -8752,19 +9781,28 @@ var InfiniteTableRoot = getComponentStateRoot({
|
|
|
8752
9781
|
mapPropsToState: mapPropsToState2,
|
|
8753
9782
|
allowedControlledPropOverrides: {
|
|
8754
9783
|
rowHeight: true,
|
|
8755
|
-
|
|
9784
|
+
columnHeaderHeight: true
|
|
8756
9785
|
},
|
|
8757
9786
|
getParentState: () => useDataSource(),
|
|
8758
9787
|
debugName: "InfiniteTable"
|
|
8759
9788
|
});
|
|
8760
|
-
var InfiniteTableComponent =
|
|
9789
|
+
var InfiniteTableComponent = memo11(function InfiniteTableComponent2() {
|
|
8761
9790
|
var _a;
|
|
8762
|
-
const {
|
|
9791
|
+
const {
|
|
9792
|
+
componentState,
|
|
9793
|
+
getComputed,
|
|
9794
|
+
computed,
|
|
9795
|
+
componentActions: actions,
|
|
9796
|
+
getState
|
|
9797
|
+
} = useInfiniteTable();
|
|
8763
9798
|
const {
|
|
8764
9799
|
componentState: { loading },
|
|
8765
9800
|
getState: getDataSourceState,
|
|
8766
9801
|
componentActions: dataSourceActions
|
|
8767
9802
|
} = useDataSourceContextValue();
|
|
9803
|
+
const [imperativeApi] = useState15(() => {
|
|
9804
|
+
return getImperativeApi(getState, getComputed, getDataSourceState, actions);
|
|
9805
|
+
});
|
|
8768
9806
|
const {
|
|
8769
9807
|
domRef,
|
|
8770
9808
|
scrollerDOMRef,
|
|
@@ -8773,24 +9811,43 @@ var InfiniteTableComponent = memo9(function InfiniteTableComponent2() {
|
|
|
8773
9811
|
loadingText,
|
|
8774
9812
|
header,
|
|
8775
9813
|
onRowHeightCSSVarChange,
|
|
8776
|
-
|
|
9814
|
+
onColumnHeaderHeightCSSVarChange,
|
|
8777
9815
|
rowHeightCSSVar,
|
|
8778
|
-
|
|
9816
|
+
columnHeaderHeightCSSVar,
|
|
8779
9817
|
components,
|
|
8780
9818
|
scrollStopDelay,
|
|
8781
9819
|
brain,
|
|
8782
|
-
headerBrain
|
|
9820
|
+
headerBrain,
|
|
9821
|
+
renderer,
|
|
9822
|
+
activeRowIndex,
|
|
9823
|
+
activeCellIndex,
|
|
9824
|
+
onRenderUpdater
|
|
8783
9825
|
} = componentState;
|
|
9826
|
+
useEffect27(() => {
|
|
9827
|
+
if (activeRowIndex != null) {
|
|
9828
|
+
imperativeApi.scrollRowIntoView(activeRowIndex, {
|
|
9829
|
+
offset: 30
|
|
9830
|
+
});
|
|
9831
|
+
}
|
|
9832
|
+
}, [activeRowIndex]);
|
|
9833
|
+
useEffect27(() => {
|
|
9834
|
+
if (activeCellIndex != null) {
|
|
9835
|
+
imperativeApi.scrollCellIntoView(activeCellIndex[0], activeCellIndex[1], {
|
|
9836
|
+
offset: 30
|
|
9837
|
+
});
|
|
9838
|
+
}
|
|
9839
|
+
}, [activeCellIndex]);
|
|
8784
9840
|
const { columnShifts, bodySize } = componentState;
|
|
8785
9841
|
const { scrollbars } = computed;
|
|
8786
9842
|
const { renderCell } = useCellRendering({
|
|
9843
|
+
imperativeApi,
|
|
8787
9844
|
getComputed,
|
|
8788
9845
|
domRef: componentState.domRef,
|
|
8789
9846
|
columnShifts,
|
|
8790
9847
|
bodySize,
|
|
8791
9848
|
computed
|
|
8792
9849
|
});
|
|
8793
|
-
|
|
9850
|
+
useEffect26(() => {
|
|
8794
9851
|
const dataSourceState = getDataSourceState();
|
|
8795
9852
|
const onChange = debounce((renderRange) => {
|
|
8796
9853
|
dataSourceState.notifyRenderRangeChange({
|
|
@@ -8803,35 +9860,52 @@ var InfiniteTableComponent = memo9(function InfiniteTableComponent2() {
|
|
|
8803
9860
|
const licenseValid = useLicense(licenseKey);
|
|
8804
9861
|
const domProps = useDOMProps(componentState.domProps);
|
|
8805
9862
|
const LoadMaskCmp = (_a = components == null ? void 0 : components.LoadMask) != null ? _a : LoadMask;
|
|
8806
|
-
|
|
9863
|
+
useEffect26(() => {
|
|
8807
9864
|
brain.setScrollStopDelay(scrollStopDelay);
|
|
8808
9865
|
dataSourceActions.scrollStopDelayUpdatedByTable = scrollStopDelay;
|
|
8809
9866
|
}, [scrollStopDelay]);
|
|
8810
9867
|
useAutoSizeColumns();
|
|
8811
|
-
|
|
9868
|
+
const onKeyDown = useCallback16((event) => {
|
|
9869
|
+
if (handleKeyboardNavigation({
|
|
9870
|
+
getState,
|
|
9871
|
+
actions,
|
|
9872
|
+
getDataSourceState,
|
|
9873
|
+
getComputed,
|
|
9874
|
+
key: event.key,
|
|
9875
|
+
shiftKey: !!event.shiftKey
|
|
9876
|
+
})) {
|
|
9877
|
+
event.preventDefault();
|
|
9878
|
+
}
|
|
9879
|
+
}, []);
|
|
9880
|
+
return /* @__PURE__ */ createElement26("div", __spreadValues({
|
|
9881
|
+
onKeyDown,
|
|
8812
9882
|
ref: domRef
|
|
8813
|
-
}, domProps), header ? /* @__PURE__ */
|
|
9883
|
+
}, domProps), header ? /* @__PURE__ */ createElement26(TableHeaderWrapper, {
|
|
8814
9884
|
brain: headerBrain,
|
|
8815
9885
|
scrollbars
|
|
8816
|
-
}) : null, /* @__PURE__ */
|
|
9886
|
+
}) : null, /* @__PURE__ */ createElement26(InfiniteTableBody, null, /* @__PURE__ */ createElement26(HeadlessTable, {
|
|
8817
9887
|
tabIndex: 0,
|
|
9888
|
+
activeRowIndex: componentState.ready ? activeRowIndex : null,
|
|
9889
|
+
activeCellIndex: componentState.ready ? activeCellIndex : null,
|
|
8818
9890
|
scrollStopDelay,
|
|
9891
|
+
renderer,
|
|
9892
|
+
onRenderUpdater,
|
|
8819
9893
|
brain,
|
|
8820
9894
|
renderCell,
|
|
8821
9895
|
cellHoverClassNames: HOVERED_CLASS_NAMES,
|
|
8822
9896
|
scrollerDOMRef
|
|
8823
|
-
}), /* @__PURE__ */
|
|
9897
|
+
}), /* @__PURE__ */ createElement26(LoadMaskCmp, {
|
|
8824
9898
|
visible: loading
|
|
8825
|
-
}, loadingText)),
|
|
9899
|
+
}, loadingText)), /* @__PURE__ */ createElement26("div", {
|
|
8826
9900
|
ref: portalDOMRef,
|
|
8827
9901
|
className: join(`${rootClassName2}Portal`, zIndex[1e3], position.absolute, top[0], left[0])
|
|
8828
|
-
}), rowHeightCSSVar ? /* @__PURE__ */
|
|
9902
|
+
}), rowHeightCSSVar ? /* @__PURE__ */ createElement26(CSSVariableWatch, {
|
|
8829
9903
|
varName: rowHeightCSSVar,
|
|
8830
9904
|
onChange: onRowHeightCSSVarChange
|
|
8831
|
-
}) : null,
|
|
8832
|
-
varName:
|
|
8833
|
-
onChange:
|
|
8834
|
-
}) : null);
|
|
9905
|
+
}) : null, columnHeaderHeightCSSVar ? /* @__PURE__ */ createElement26(CSSVariableWatch, {
|
|
9906
|
+
varName: columnHeaderHeightCSSVar,
|
|
9907
|
+
onChange: onColumnHeaderHeightCSSVarChange
|
|
9908
|
+
}) : null, /* @__PURE__ */ createElement26(InfiniteTableFooter, null), licenseValid ? null : /* @__PURE__ */ createElement26(InfiniteTableLicenseFooter, null));
|
|
8835
9909
|
});
|
|
8836
9910
|
function InfiniteTableContextProvider() {
|
|
8837
9911
|
const { componentActions, componentState } = useComponentState();
|
|
@@ -8859,29 +9933,29 @@ function InfiniteTableContextProvider() {
|
|
|
8859
9933
|
bodySize.width = (_b = (_a = scrollerDOMRef.current) == null ? void 0 : _a.scrollWidth) != null ? _b : bodySize.width;
|
|
8860
9934
|
componentActions.bodySize = bodySize;
|
|
8861
9935
|
}, { earlyAttach: true });
|
|
8862
|
-
|
|
9936
|
+
useEffect26(() => {
|
|
8863
9937
|
return () => {
|
|
8864
9938
|
componentState.onRowHeightCSSVarChange.destroy();
|
|
8865
|
-
componentState.
|
|
9939
|
+
componentState.onColumnHeaderHeightCSSVarChange.destroy();
|
|
8866
9940
|
};
|
|
8867
9941
|
}, []);
|
|
8868
|
-
|
|
9942
|
+
useEffect26(() => {
|
|
8869
9943
|
if (scrollerDOMRef.current) {
|
|
8870
9944
|
scrollerDOMRef.current.scrollTop = 0;
|
|
8871
9945
|
}
|
|
8872
9946
|
}, [scrollTopKey, scrollerDOMRef]);
|
|
8873
9947
|
const TableContext2 = getInfiniteTableContext();
|
|
8874
|
-
return /* @__PURE__ */
|
|
9948
|
+
return /* @__PURE__ */ createElement26(TableContext2.Provider, {
|
|
8875
9949
|
value: contextValue
|
|
8876
|
-
}, /* @__PURE__ */
|
|
9950
|
+
}, /* @__PURE__ */ createElement26(InfiniteTableComponent, null));
|
|
8877
9951
|
}
|
|
8878
9952
|
function InfiniteTable(props) {
|
|
8879
|
-
const table = /* @__PURE__ */
|
|
8880
|
-
return /* @__PURE__ */
|
|
9953
|
+
const table = /* @__PURE__ */ createElement26(InfiniteTableRoot, __spreadValues({}, props), /* @__PURE__ */ createElement26(InfiniteTableContextProvider, null));
|
|
9954
|
+
return /* @__PURE__ */ createElement26(StrictMode, null, table);
|
|
8881
9955
|
}
|
|
8882
9956
|
InfiniteTable.defaultProps = {
|
|
8883
9957
|
rowHeight: 40,
|
|
8884
|
-
|
|
9958
|
+
columnHeaderHeight: ThemeVars.components.Header.columnHeaderHeight
|
|
8885
9959
|
};
|
|
8886
9960
|
export {
|
|
8887
9961
|
DataSource,
|
|
@@ -8890,7 +9964,12 @@ export {
|
|
|
8890
9964
|
InfiniteTable,
|
|
8891
9965
|
InfiniteTableClassName,
|
|
8892
9966
|
InfiniteTableComponent,
|
|
9967
|
+
NumberFilterEditor,
|
|
9968
|
+
StringFilterEditor,
|
|
8893
9969
|
debounce,
|
|
9970
|
+
defaultFilterEditors,
|
|
9971
|
+
defaultFilterTypes,
|
|
9972
|
+
defaultFilterTypes as filterTypes,
|
|
8894
9973
|
flatten,
|
|
8895
9974
|
getComponentStateRoot,
|
|
8896
9975
|
group,
|