@infinite-table/infinite-react 0.3.3 → 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 +141 -59
- package/index.d.ts +116 -7
- package/index.esm.css +141 -59
- package/index.esm.js +956 -356
- package/index.js +957 -363
- 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;
|
|
@@ -3096,8 +3262,11 @@ function createRenderer(brain) {
|
|
|
3096
3262
|
function RawTableFn(props) {
|
|
3097
3263
|
const { brain, renderCell } = props;
|
|
3098
3264
|
const { renderer, onRenderUpdater } = useMemo2(() => {
|
|
3099
|
-
return
|
|
3100
|
-
|
|
3265
|
+
return props.onRenderUpdater && props.renderer ? {
|
|
3266
|
+
renderer: props.renderer,
|
|
3267
|
+
onRenderUpdater: props.onRenderUpdater
|
|
3268
|
+
} : createRenderer(brain);
|
|
3269
|
+
}, [brain, props.onRenderUpdater, props.renderer]);
|
|
3101
3270
|
useEffect4(() => {
|
|
3102
3271
|
renderer.cellHoverClassNames = props.cellHoverClassNames || [];
|
|
3103
3272
|
}, [renderer, props.cellHoverClassNames]);
|
|
@@ -3131,6 +3300,150 @@ function RawTableFn(props) {
|
|
|
3131
3300
|
}
|
|
3132
3301
|
var RawTable = memo3(RawTableFn);
|
|
3133
3302
|
|
|
3303
|
+
// src/components/InfiniteTable/components/ActiveRowIndicator.tsx
|
|
3304
|
+
import {
|
|
3305
|
+
createElement as createElement6,
|
|
3306
|
+
memo as memo4
|
|
3307
|
+
} from "react";
|
|
3308
|
+
import { useEffect as useEffect5, useLayoutEffect as useLayoutEffect3, useRef as useRef5, useState as useState3 } from "react";
|
|
3309
|
+
|
|
3310
|
+
// src/components/hooks/useRerender.ts
|
|
3311
|
+
import { useCallback as useCallback3, useState as useState2 } from "react";
|
|
3312
|
+
var useRerender = () => {
|
|
3313
|
+
const [state, setState] = useState2(0);
|
|
3314
|
+
return [
|
|
3315
|
+
state,
|
|
3316
|
+
useCallback3(() => {
|
|
3317
|
+
setState((state2) => state2 + 1);
|
|
3318
|
+
}, [setState])
|
|
3319
|
+
];
|
|
3320
|
+
};
|
|
3321
|
+
|
|
3322
|
+
// src/components/InfiniteTable/internalProps.ts
|
|
3323
|
+
var rootClassName2 = "Infinite";
|
|
3324
|
+
var internalProps = {
|
|
3325
|
+
rootClassName: rootClassName2
|
|
3326
|
+
};
|
|
3327
|
+
|
|
3328
|
+
// src/components/InfiniteTable/components/ActiveRowIndicator.css.ts
|
|
3329
|
+
var ActiveRowIndicatorCls = { visible: "j26lrx1 j26lrx0 _16lm1iwe _16lm1iw3 _16lm1iwt _16lm1iwu _16lm1iww", hidden: "j26lrx2 j26lrx0 _16lm1iwe _16lm1iw3 _16lm1iwt _16lm1iwu _16lm1iww" };
|
|
3330
|
+
|
|
3331
|
+
// src/components/InfiniteTable/components/ActiveRowIndicator.tsx
|
|
3332
|
+
var { rootClassName: rootClassName3 } = internalProps;
|
|
3333
|
+
var baseCls = `${rootClassName3}-ActiveRowIndicator`;
|
|
3334
|
+
var ActiveRowIndicatorFn = (props) => {
|
|
3335
|
+
const { brain } = props;
|
|
3336
|
+
const [state, setState] = useState3({
|
|
3337
|
+
top: 0,
|
|
3338
|
+
rowHeight: 0
|
|
3339
|
+
});
|
|
3340
|
+
const domRef = useRef5(null);
|
|
3341
|
+
const stateRef = useRef5(state);
|
|
3342
|
+
const active = props.activeRowIndex != null && brain.getRowCount() > props.activeRowIndex;
|
|
3343
|
+
const [rerenderId, rerender] = useRerender();
|
|
3344
|
+
useLayoutEffect3(() => {
|
|
3345
|
+
if (props.activeRowIndex == null) {
|
|
3346
|
+
return;
|
|
3347
|
+
}
|
|
3348
|
+
setState(stateRef.current = {
|
|
3349
|
+
top: brain.getItemOffsetFor(props.activeRowIndex, "vertical"),
|
|
3350
|
+
rowHeight: brain.getRowHeight(props.activeRowIndex)
|
|
3351
|
+
});
|
|
3352
|
+
}, [props.activeRowIndex, rerenderId]);
|
|
3353
|
+
useEffect5(() => {
|
|
3354
|
+
const removeOnScroll = brain.onScroll((scrollPos) => {
|
|
3355
|
+
const node = domRef.current;
|
|
3356
|
+
const topOffset = stateRef.current.top;
|
|
3357
|
+
node.style.transform = `translate3d(0px, ${-scrollPos.scrollTop + topOffset}px, 0px)`;
|
|
3358
|
+
});
|
|
3359
|
+
const removeOnRenderCountChange = brain.onRenderCountChange(rerender);
|
|
3360
|
+
return () => {
|
|
3361
|
+
removeOnRenderCountChange();
|
|
3362
|
+
removeOnScroll();
|
|
3363
|
+
};
|
|
3364
|
+
}, [brain]);
|
|
3365
|
+
return /* @__PURE__ */ createElement6("div", {
|
|
3366
|
+
ref: domRef,
|
|
3367
|
+
"data-name": "active-row-indicator",
|
|
3368
|
+
className: `${baseCls} ${active ? ActiveRowIndicatorCls.visible : ActiveRowIndicatorCls.hidden}`,
|
|
3369
|
+
style: active ? {
|
|
3370
|
+
transform: `translate3d(0px, ${-brain.getScrollPosition().scrollTop + state.top}px,0)`,
|
|
3371
|
+
height: state.rowHeight
|
|
3372
|
+
} : void 0
|
|
3373
|
+
});
|
|
3374
|
+
};
|
|
3375
|
+
var ActiveRowIndicator = memo4(ActiveRowIndicatorFn);
|
|
3376
|
+
|
|
3377
|
+
// src/components/InfiniteTable/components/ActiveCellIndicator.tsx
|
|
3378
|
+
import {
|
|
3379
|
+
createElement as createElement7,
|
|
3380
|
+
memo as memo5
|
|
3381
|
+
} from "react";
|
|
3382
|
+
import { useEffect as useEffect6, useLayoutEffect as useLayoutEffect4, useRef as useRef6, useState as useState4 } from "react";
|
|
3383
|
+
|
|
3384
|
+
// src/components/InfiniteTable/components/ActiveCellIndicator.css.ts
|
|
3385
|
+
var ActiveCellIndicatorCls = { visible: "nxbq1c1 nxbq1c0 _16lm1iwe _16lm1iw3 _16lm1iww _16lm1iwu", hidden: "nxbq1c2 nxbq1c0 _16lm1iwe _16lm1iw3 _16lm1iww _16lm1iwu" };
|
|
3386
|
+
|
|
3387
|
+
// src/components/InfiniteTable/components/ActiveCellIndicator.tsx
|
|
3388
|
+
var { rootClassName: rootClassName4 } = internalProps;
|
|
3389
|
+
var baseCls2 = `${rootClassName4}-ActiveCellIndicator`;
|
|
3390
|
+
var ActiveCellIndicatorFn = (props) => {
|
|
3391
|
+
const { brain } = props;
|
|
3392
|
+
const [rerenderId, rerender] = useRerender();
|
|
3393
|
+
const [state, setState] = useState4({
|
|
3394
|
+
top: 0,
|
|
3395
|
+
rowHeight: 0,
|
|
3396
|
+
colWidth: 0,
|
|
3397
|
+
left: 0
|
|
3398
|
+
});
|
|
3399
|
+
const domRef = useRef6(null);
|
|
3400
|
+
const stateRef = useRef6(state);
|
|
3401
|
+
const active = props.activeCellIndex != null && brain.getRowCount() > props.activeCellIndex[0];
|
|
3402
|
+
useLayoutEffect4(() => {
|
|
3403
|
+
if (props.activeCellIndex == null) {
|
|
3404
|
+
return;
|
|
3405
|
+
}
|
|
3406
|
+
const rowIndex = props.activeCellIndex[0];
|
|
3407
|
+
setState(stateRef.current = {
|
|
3408
|
+
top: brain.getItemOffsetFor(rowIndex, "vertical"),
|
|
3409
|
+
rowHeight: brain.getRowHeight(rowIndex),
|
|
3410
|
+
left: brain.getItemOffsetFor(props.activeCellIndex[1], "horizontal"),
|
|
3411
|
+
colWidth: brain.getColWidth(props.activeCellIndex[1])
|
|
3412
|
+
});
|
|
3413
|
+
}, [props.activeCellIndex, rerenderId]);
|
|
3414
|
+
useEffect6(() => {
|
|
3415
|
+
const removeOnSCroll = brain.onScroll((scrollPos) => {
|
|
3416
|
+
const node = domRef.current;
|
|
3417
|
+
const topOffset = stateRef.current.top;
|
|
3418
|
+
const leftOffset = stateRef.current.left;
|
|
3419
|
+
node.style.transform = `translate3d(${-scrollPos.scrollLeft + leftOffset}px, ${-scrollPos.scrollTop + topOffset}px, 0px)`;
|
|
3420
|
+
});
|
|
3421
|
+
const removeOnRenderCountChange = brain.onRenderCountChange(() => {
|
|
3422
|
+
rerender();
|
|
3423
|
+
});
|
|
3424
|
+
const removeOnAvailableSizeChange = brain.onAvailableSizeChange(() => {
|
|
3425
|
+
rerender();
|
|
3426
|
+
});
|
|
3427
|
+
return () => {
|
|
3428
|
+
removeOnAvailableSizeChange();
|
|
3429
|
+
removeOnRenderCountChange();
|
|
3430
|
+
removeOnSCroll();
|
|
3431
|
+
};
|
|
3432
|
+
}, [brain]);
|
|
3433
|
+
const scrollPosition = brain.getScrollPosition();
|
|
3434
|
+
return /* @__PURE__ */ createElement7("div", {
|
|
3435
|
+
ref: domRef,
|
|
3436
|
+
"data-name": "active-cell-indicator",
|
|
3437
|
+
className: `${baseCls2} ${active ? ActiveCellIndicatorCls.visible : ActiveCellIndicatorCls.hidden}`,
|
|
3438
|
+
style: active ? {
|
|
3439
|
+
transform: `translate3d(${-scrollPosition.scrollLeft + state.left}px, ${-scrollPosition.scrollTop + state.top}px,0)`,
|
|
3440
|
+
width: state.colWidth,
|
|
3441
|
+
height: state.rowHeight
|
|
3442
|
+
} : void 0
|
|
3443
|
+
});
|
|
3444
|
+
};
|
|
3445
|
+
var ActiveCellIndicator = memo5(ActiveCellIndicatorFn);
|
|
3446
|
+
|
|
3134
3447
|
// src/components/HeadlessTable/index.tsx
|
|
3135
3448
|
function useMatrixBrain(brain, brainOptions, fixedCellsInfo) {
|
|
3136
3449
|
if (fixedCellsInfo && (fixedCellsInfo.fixedColsStart || fixedCellsInfo.fixedColsEnd || fixedCellsInfo.fixedRowsStart || fixedCellsInfo.fixedRowsEnd)) {
|
|
@@ -3158,25 +3471,33 @@ function HeadlessTable(props) {
|
|
|
3158
3471
|
scrollerDOMRef,
|
|
3159
3472
|
scrollStopDelay,
|
|
3160
3473
|
renderCell,
|
|
3161
|
-
cellHoverClassNames
|
|
3474
|
+
cellHoverClassNames,
|
|
3475
|
+
renderer,
|
|
3476
|
+
activeRowIndex,
|
|
3477
|
+
activeCellIndex,
|
|
3478
|
+
onRenderUpdater
|
|
3162
3479
|
} = _a, domProps = __objRest(_a, [
|
|
3163
3480
|
"brain",
|
|
3164
3481
|
"scrollerDOMRef",
|
|
3165
3482
|
"scrollStopDelay",
|
|
3166
3483
|
"renderCell",
|
|
3167
|
-
"cellHoverClassNames"
|
|
3484
|
+
"cellHoverClassNames",
|
|
3485
|
+
"renderer",
|
|
3486
|
+
"activeRowIndex",
|
|
3487
|
+
"activeCellIndex",
|
|
3488
|
+
"onRenderUpdater"
|
|
3168
3489
|
]);
|
|
3169
|
-
const domRef =
|
|
3170
|
-
const [scrollSize, setTotalScrollSize] =
|
|
3490
|
+
const domRef = useRef7(null);
|
|
3491
|
+
const [scrollSize, setTotalScrollSize] = useState5({
|
|
3171
3492
|
width: 0,
|
|
3172
3493
|
height: 0
|
|
3173
3494
|
});
|
|
3174
|
-
|
|
3495
|
+
useEffect7(() => {
|
|
3175
3496
|
if (scrollStopDelay != null) {
|
|
3176
3497
|
brain.setScrollStopDelay(scrollStopDelay);
|
|
3177
3498
|
}
|
|
3178
3499
|
}, [scrollStopDelay, brain]);
|
|
3179
|
-
|
|
3500
|
+
useEffect7(() => {
|
|
3180
3501
|
var _a2;
|
|
3181
3502
|
const node = (_a2 = domRef.current) == null ? void 0 : _a2.parentNode;
|
|
3182
3503
|
if (!node) {
|
|
@@ -3192,31 +3513,39 @@ function HeadlessTable(props) {
|
|
|
3192
3513
|
const remove = setupResizeObserver(node, onResize);
|
|
3193
3514
|
return remove;
|
|
3194
3515
|
}, []);
|
|
3195
|
-
const onContainerScroll =
|
|
3516
|
+
const onContainerScroll = useCallback4((scrollPos) => {
|
|
3196
3517
|
brain.setScrollPosition(scrollPos, (scrollPos2) => {
|
|
3197
3518
|
domRef.current.style.transform = `translate3d(${-scrollPos2.scrollLeft}px, ${-scrollPos2.scrollTop}px, 0px)`;
|
|
3198
3519
|
});
|
|
3199
3520
|
}, [brain]);
|
|
3200
|
-
|
|
3521
|
+
useEffect7(() => {
|
|
3201
3522
|
const removeOnRenderCount = brain.onRenderCountChange(() => {
|
|
3202
3523
|
setTotalScrollSize(brain.getTotalSize());
|
|
3203
3524
|
});
|
|
3204
3525
|
setTotalScrollSize(brain.getTotalSize());
|
|
3205
3526
|
return removeOnRenderCount;
|
|
3206
3527
|
}, [brain]);
|
|
3207
|
-
return /* @__PURE__ */
|
|
3528
|
+
return /* @__PURE__ */ createElement8(VirtualScrollContainer, __spreadProps(__spreadValues({
|
|
3208
3529
|
onContainerScroll
|
|
3209
3530
|
}, domProps), {
|
|
3210
3531
|
ref: scrollerDOMRef
|
|
3211
|
-
}), /* @__PURE__ */
|
|
3532
|
+
}), /* @__PURE__ */ createElement8("div", {
|
|
3212
3533
|
ref: domRef,
|
|
3213
3534
|
className: scrollTransformTargetCls,
|
|
3214
3535
|
"data-name": "scroll-transform-target"
|
|
3215
|
-
}, /* @__PURE__ */
|
|
3536
|
+
}, /* @__PURE__ */ createElement8(RawTable, {
|
|
3537
|
+
renderer,
|
|
3538
|
+
onRenderUpdater,
|
|
3216
3539
|
renderCell,
|
|
3217
3540
|
brain,
|
|
3218
3541
|
cellHoverClassNames
|
|
3219
|
-
})), /* @__PURE__ */
|
|
3542
|
+
})), /* @__PURE__ */ createElement8(ActiveRowIndicator, {
|
|
3543
|
+
brain,
|
|
3544
|
+
activeRowIndex
|
|
3545
|
+
}), /* @__PURE__ */ createElement8(ActiveCellIndicator, {
|
|
3546
|
+
brain,
|
|
3547
|
+
activeCellIndex
|
|
3548
|
+
}), /* @__PURE__ */ createElement8(SpacePlaceholder, {
|
|
3220
3549
|
width: scrollSize.width,
|
|
3221
3550
|
height: scrollSize.height
|
|
3222
3551
|
}));
|
|
@@ -3224,17 +3553,17 @@ function HeadlessTable(props) {
|
|
|
3224
3553
|
|
|
3225
3554
|
// src/components/hooks/useComponentState/index.tsx
|
|
3226
3555
|
import {
|
|
3227
|
-
createElement as
|
|
3228
|
-
memo as
|
|
3556
|
+
createElement as createElement9,
|
|
3557
|
+
memo as memo6,
|
|
3229
3558
|
useContext as useContext2
|
|
3230
3559
|
} from "react";
|
|
3231
3560
|
import {
|
|
3232
3561
|
useReducer,
|
|
3233
3562
|
createContext as createContext2,
|
|
3234
3563
|
useMemo as useMemo3,
|
|
3235
|
-
useEffect as
|
|
3236
|
-
useState as
|
|
3237
|
-
useRef as
|
|
3564
|
+
useEffect as useEffect8,
|
|
3565
|
+
useState as useState6,
|
|
3566
|
+
useRef as useRef10
|
|
3238
3567
|
} from "react";
|
|
3239
3568
|
|
|
3240
3569
|
// src/utils/proxyFnCall.ts
|
|
@@ -3278,18 +3607,18 @@ function isControlled(propName, props) {
|
|
|
3278
3607
|
}
|
|
3279
3608
|
|
|
3280
3609
|
// src/components/hooks/useLatest.tsx
|
|
3281
|
-
import { useCallback as
|
|
3610
|
+
import { useCallback as useCallback5, useRef as useRef8 } from "react";
|
|
3282
3611
|
function useLatest(value) {
|
|
3283
|
-
const ref =
|
|
3612
|
+
const ref = useRef8(value);
|
|
3284
3613
|
ref.current = value;
|
|
3285
|
-
return
|
|
3614
|
+
return useCallback5(() => ref.current, []);
|
|
3286
3615
|
}
|
|
3287
3616
|
|
|
3288
3617
|
// src/components/hooks/usePrevious.ts
|
|
3289
|
-
import { useRef as
|
|
3618
|
+
import { useRef as useRef9, useLayoutEffect as useLayoutEffect5 } from "react";
|
|
3290
3619
|
var usePrevious = (value, initialValue) => {
|
|
3291
|
-
const ref =
|
|
3292
|
-
|
|
3620
|
+
const ref = useRef9(initialValue === void 0 ? value : initialValue);
|
|
3621
|
+
useLayoutEffect5(() => {
|
|
3293
3622
|
ref.current = value;
|
|
3294
3623
|
});
|
|
3295
3624
|
return ref.current;
|
|
@@ -3369,16 +3698,16 @@ function forwardProps(propsToForward, props) {
|
|
|
3369
3698
|
return mappedState;
|
|
3370
3699
|
}
|
|
3371
3700
|
function getComponentStateRoot(config) {
|
|
3372
|
-
return
|
|
3701
|
+
return memo6(function ComponentStateRoot(props) {
|
|
3373
3702
|
var _a, _b;
|
|
3374
|
-
const [initialSetupState] =
|
|
3703
|
+
const [initialSetupState] = useState6(() => {
|
|
3375
3704
|
return config.initSetupState ? config.initSetupState() : {};
|
|
3376
3705
|
});
|
|
3377
|
-
const propsToStateSetRef =
|
|
3706
|
+
const propsToStateSetRef = useRef10(new Set());
|
|
3378
3707
|
const propsToForward = useMemo3(() => config.forwardProps ? config.forwardProps(initialSetupState) : {}, [initialSetupState]);
|
|
3379
3708
|
const parentState = (_b = (_a = config.getParentState) == null ? void 0 : _a.call(config)) != null ? _b : null;
|
|
3380
3709
|
const getParentState = useLatest(parentState);
|
|
3381
|
-
const [wholeState] =
|
|
3710
|
+
const [wholeState] = useState6(() => {
|
|
3382
3711
|
let mappedState = {};
|
|
3383
3712
|
if (propsToForward) {
|
|
3384
3713
|
mappedState = forwardProps(propsToForward, props);
|
|
@@ -3463,7 +3792,7 @@ function getComponentStateRoot(config) {
|
|
|
3463
3792
|
getComponentState
|
|
3464
3793
|
}), [state, actions, getComponentState]);
|
|
3465
3794
|
const prevProps = usePrevious(props);
|
|
3466
|
-
|
|
3795
|
+
useEffect8(() => {
|
|
3467
3796
|
const currentProps = props;
|
|
3468
3797
|
const newMappedState = {};
|
|
3469
3798
|
let newMappedStateCount = 0;
|
|
@@ -3519,7 +3848,7 @@ function getComponentStateRoot(config) {
|
|
|
3519
3848
|
}
|
|
3520
3849
|
}
|
|
3521
3850
|
});
|
|
3522
|
-
return /* @__PURE__ */
|
|
3851
|
+
return /* @__PURE__ */ createElement9(Context.Provider, {
|
|
3523
3852
|
value: contextValue
|
|
3524
3853
|
}, props.children);
|
|
3525
3854
|
});
|
|
@@ -3531,58 +3860,52 @@ function useComponentState() {
|
|
|
3531
3860
|
|
|
3532
3861
|
// src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx
|
|
3533
3862
|
import {
|
|
3534
|
-
createElement as
|
|
3863
|
+
createElement as createElement10,
|
|
3535
3864
|
forwardRef as forwardRef2
|
|
3536
3865
|
} from "react";
|
|
3537
3866
|
|
|
3538
|
-
// src/components/InfiniteTable/internalProps.ts
|
|
3539
|
-
var rootClassName2 = "Infinite";
|
|
3540
|
-
var internalProps = {
|
|
3541
|
-
rootClassName: rootClassName2
|
|
3542
|
-
};
|
|
3543
|
-
|
|
3544
3867
|
// src/components/InfiniteTable/hooks/useInternalProps.ts
|
|
3545
3868
|
var useInternalProps = () => {
|
|
3546
3869
|
return internalProps;
|
|
3547
3870
|
};
|
|
3548
3871
|
|
|
3549
3872
|
// src/components/InfiniteTable/utilities.css.ts
|
|
3550
|
-
var alignItems = { center: "
|
|
3551
|
-
var cssEllipsisClassName = "
|
|
3873
|
+
var alignItems = { center: "_16lm1iw14", stretch: "_16lm1iw15" };
|
|
3874
|
+
var cssEllipsisClassName = "_16lm1iw1d _16lm1iw1e _16lm1iw19";
|
|
3552
3875
|
var cursor = { pointer: "_16lm1iwd" };
|
|
3553
|
-
var display = { flex: "
|
|
3554
|
-
var flex = { "1": "
|
|
3555
|
-
var flexFlow = { column: "
|
|
3556
|
-
var justifyContent = { center: "
|
|
3557
|
-
var left = { "0": "
|
|
3558
|
-
var overflow = { hidden: "
|
|
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" };
|
|
3559
3882
|
var position = { relative: "_16lm1iw1", absolute: "_16lm1iw2", sticky: "_16lm1iw3", fixed: "_16lm1iw4" };
|
|
3560
|
-
var top = { "0": "
|
|
3883
|
+
var top = { "0": "_16lm1iwu", "100%": "_16lm1iwv" };
|
|
3561
3884
|
var transformTranslateZero = "_16lm1iwa";
|
|
3562
|
-
var userSelect = { none: "
|
|
3563
|
-
var zIndex = { "1": "
|
|
3885
|
+
var userSelect = { none: "_16lm1iwp" };
|
|
3886
|
+
var zIndex = { "1": "_16lm1iwh", "10": "_16lm1iwi", "1000": "_16lm1iwj", "10000": "_16lm1iwk", "100000": "_16lm1iwl" };
|
|
3564
3887
|
|
|
3565
3888
|
// src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx
|
|
3566
3889
|
var InfiniteTableBody = forwardRef2(function InfiniteTableBody2(props, ref) {
|
|
3567
|
-
const { rootClassName:
|
|
3568
|
-
return /* @__PURE__ */
|
|
3890
|
+
const { rootClassName: rootClassName11 } = useInternalProps();
|
|
3891
|
+
return /* @__PURE__ */ createElement10("div", __spreadProps(__spreadValues({
|
|
3569
3892
|
ref
|
|
3570
3893
|
}, props), {
|
|
3571
|
-
className: join(`${
|
|
3894
|
+
className: join(`${rootClassName11}Body`, position.relative, flex["1"], transformTranslateZero, props.className)
|
|
3572
3895
|
}));
|
|
3573
3896
|
});
|
|
3574
3897
|
|
|
3575
3898
|
// src/components/InfiniteTable/components/InfiniteTableFooter/InfiniteTableFooter.tsx
|
|
3576
3899
|
import {
|
|
3577
|
-
createElement as
|
|
3900
|
+
createElement as createElement11,
|
|
3578
3901
|
forwardRef as forwardRef3
|
|
3579
3902
|
} from "react";
|
|
3580
3903
|
var InfiniteTableFooter = forwardRef3(function InfiniteTableFooter2(props, ref) {
|
|
3581
|
-
const { rootClassName:
|
|
3582
|
-
return /* @__PURE__ */
|
|
3904
|
+
const { rootClassName: rootClassName11 } = useInternalProps();
|
|
3905
|
+
return /* @__PURE__ */ createElement11("div", __spreadProps(__spreadValues({
|
|
3583
3906
|
ref
|
|
3584
3907
|
}, props), {
|
|
3585
|
-
className: join(`${
|
|
3908
|
+
className: join(`${rootClassName11}Footer`, position.relative, display.flex, flexFlow.row, props.className)
|
|
3586
3909
|
}));
|
|
3587
3910
|
});
|
|
3588
3911
|
|
|
@@ -3590,10 +3913,10 @@ var InfiniteTableFooter = forwardRef3(function InfiniteTableFooter2(props, ref)
|
|
|
3590
3913
|
import {
|
|
3591
3914
|
Fragment as Fragment2,
|
|
3592
3915
|
createContext as createContext4,
|
|
3593
|
-
createElement as
|
|
3916
|
+
createElement as createElement15,
|
|
3594
3917
|
useMemo as useMemo5
|
|
3595
3918
|
} from "react";
|
|
3596
|
-
import { useCallback as
|
|
3919
|
+
import { useCallback as useCallback7, useContext as useContext5, useEffect as useEffect11, useRef as useRef12 } from "react";
|
|
3597
3920
|
import { createPortal } from "react-dom";
|
|
3598
3921
|
|
|
3599
3922
|
// src/components/DataSource/defaultFilterTypes.ts
|
|
@@ -3666,6 +3989,7 @@ function useCellClassName(column, baseClasses, variants, extraFlags) {
|
|
|
3666
3989
|
firstInCategory: column.computedFirstInCategory,
|
|
3667
3990
|
lastInCategory: column.computedLastInCategory,
|
|
3668
3991
|
pinned: column.computedPinned || false,
|
|
3992
|
+
rowActive: extraFlags.rowActive,
|
|
3669
3993
|
dragging: extraFlags.dragging,
|
|
3670
3994
|
zebra: extraFlags.zebra
|
|
3671
3995
|
};
|
|
@@ -3697,10 +4021,10 @@ function useCellClassName(column, baseClasses, variants, extraFlags) {
|
|
|
3697
4021
|
// src/components/InfiniteTable/hooks/useColumnPointerEvents.ts
|
|
3698
4022
|
var import_binary_search2 = __toModule(require_binary_search());
|
|
3699
4023
|
import {
|
|
3700
|
-
useCallback as
|
|
4024
|
+
useCallback as useCallback6,
|
|
3701
4025
|
useMemo as useMemo4,
|
|
3702
|
-
useRef as
|
|
3703
|
-
useState as
|
|
4026
|
+
useRef as useRef11,
|
|
4027
|
+
useState as useState7
|
|
3704
4028
|
} from "react";
|
|
3705
4029
|
|
|
3706
4030
|
// src/components/InfiniteTable/hooks/useInfiniteTable.ts
|
|
@@ -3754,13 +4078,13 @@ var useColumnPointerEvents = ({
|
|
|
3754
4078
|
columns,
|
|
3755
4079
|
computedRemainingSpace
|
|
3756
4080
|
}) => {
|
|
3757
|
-
const [draggingDiff, setDraggingDiff] =
|
|
3758
|
-
const [proxyOffset, setProxyOffset] =
|
|
3759
|
-
const breakpointsRef =
|
|
3760
|
-
const pointerMoveRef =
|
|
3761
|
-
const didDragRef =
|
|
3762
|
-
const initialClientPos =
|
|
3763
|
-
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);
|
|
3764
4088
|
const dragging = draggingDiff != null;
|
|
3765
4089
|
const { componentActions, computed } = useInfiniteTable();
|
|
3766
4090
|
const { computedColumnOrder } = computed;
|
|
@@ -3773,8 +4097,8 @@ var useColumnPointerEvents = ({
|
|
|
3773
4097
|
columnWidth: column.computedWidth
|
|
3774
4098
|
};
|
|
3775
4099
|
}, [columns, columnId, column]);
|
|
3776
|
-
let cursorRef =
|
|
3777
|
-
const onPointerDown =
|
|
4100
|
+
let cursorRef = useRef11("auto");
|
|
4101
|
+
const onPointerDown = useCallback6((e) => {
|
|
3778
4102
|
const target = domRef.current;
|
|
3779
4103
|
cursorRef.current = target.style.cursor;
|
|
3780
4104
|
didDragRef.current = false;
|
|
@@ -3837,7 +4161,7 @@ var useColumnPointerEvents = ({
|
|
|
3837
4161
|
target.addEventListener("pointermove", onPointerMove);
|
|
3838
4162
|
target.setPointerCapture(e.pointerId);
|
|
3839
4163
|
}, [columns, column, columnIndex, columnsArray, computedRemainingSpace]);
|
|
3840
|
-
const onPointerUp =
|
|
4164
|
+
const onPointerUp = useCallback6((e) => {
|
|
3841
4165
|
const target = domRef.current;
|
|
3842
4166
|
target.style.cursor = cursorRef.current;
|
|
3843
4167
|
target.releasePointerCapture(e.pointerId);
|
|
@@ -3877,7 +4201,7 @@ function RenderHookComponent(props) {
|
|
|
3877
4201
|
}
|
|
3878
4202
|
|
|
3879
4203
|
// src/components/InfiniteTable/components/FilterEditors.tsx
|
|
3880
|
-
import
|
|
4204
|
+
import React16 from "react";
|
|
3881
4205
|
function getFilterEditors() {
|
|
3882
4206
|
return {
|
|
3883
4207
|
string: StringFilterEditor,
|
|
@@ -3886,7 +4210,7 @@ function getFilterEditors() {
|
|
|
3886
4210
|
}
|
|
3887
4211
|
var defaultFilterEditors = getFilterEditors();
|
|
3888
4212
|
function StringFilterEditor(props) {
|
|
3889
|
-
return /* @__PURE__ */
|
|
4213
|
+
return /* @__PURE__ */ React16.createElement("input", {
|
|
3890
4214
|
"aria-label": `Filter for ${props.ariaLabel}`,
|
|
3891
4215
|
type: "text",
|
|
3892
4216
|
value: props.filterValue,
|
|
@@ -3897,7 +4221,7 @@ function StringFilterEditor(props) {
|
|
|
3897
4221
|
});
|
|
3898
4222
|
}
|
|
3899
4223
|
function NumberFilterEditor(props) {
|
|
3900
|
-
return /* @__PURE__ */
|
|
4224
|
+
return /* @__PURE__ */ React16.createElement("input", {
|
|
3901
4225
|
"aria-label": `Filter for ${props.ariaLabel}`,
|
|
3902
4226
|
type: "number",
|
|
3903
4227
|
value: props.filterValue,
|
|
@@ -3914,25 +4238,25 @@ function NumberFilterEditor(props) {
|
|
|
3914
4238
|
|
|
3915
4239
|
// src/components/InfiniteTable/components/icons/SortIcon.tsx
|
|
3916
4240
|
import {
|
|
3917
|
-
createElement as
|
|
4241
|
+
createElement as createElement12
|
|
3918
4242
|
} from "react";
|
|
3919
|
-
import { useEffect as
|
|
4243
|
+
import { useEffect as useEffect9, useState as useState8 } from "react";
|
|
3920
4244
|
|
|
3921
4245
|
// src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts
|
|
3922
4246
|
var import_createRuntimeFn = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
3923
|
-
var CellCls = "_1eexc2a5
|
|
3924
|
-
var HeaderCellContentRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "
|
|
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: [] });
|
|
3925
4249
|
var HeaderCellProxy = "_12zfob10";
|
|
3926
|
-
var HeaderCellRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_12zfob1h
|
|
3927
|
-
var HeaderClsRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_12zfob17
|
|
3928
|
-
var HeaderFilterCls = "
|
|
3929
|
-
var HeaderFilterEditorCls = "
|
|
3930
|
-
var HeaderGroupCls = "
|
|
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";
|
|
3931
4255
|
var HeaderScrollbarPlaceholderCls = "_12zfob16 _16lm1iw2";
|
|
3932
4256
|
var HeaderSortIconCls = "_16lm1iw1";
|
|
3933
4257
|
var HeaderSortIconIndexCls = "_12zfob15";
|
|
3934
4258
|
var HeaderSortIconRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "", variantClassNames: { align: { start: "_12zfob12", center: "_12zfob13", end: "_12zfob14" } }, defaultVariants: {}, compoundVariants: [] });
|
|
3935
|
-
var HeaderWrapperCls = "
|
|
4259
|
+
var HeaderWrapperCls = "_12zfob11a _16lm1iw19 _16lm1iw1 _16lm1iwm _16lm1iw13";
|
|
3936
4260
|
|
|
3937
4261
|
// src/components/InfiniteTable/components/icons/SortIcon.tsx
|
|
3938
4262
|
var defaultLineStyle = {
|
|
@@ -3943,8 +4267,8 @@ var defaultLineStyle = {
|
|
|
3943
4267
|
var InfiniteTableIconClassName = "InfiniteTableIcon";
|
|
3944
4268
|
function SortIcon(props) {
|
|
3945
4269
|
var _a;
|
|
3946
|
-
const [rendered, setRendered] =
|
|
3947
|
-
const [opacity, setOpacity] =
|
|
4270
|
+
const [rendered, setRendered] = useState8(true);
|
|
4271
|
+
const [opacity, setOpacity] = useState8(0);
|
|
3948
4272
|
const { direction, lineWidth = 1, style, className, index } = props;
|
|
3949
4273
|
const showIndex = index != null && index > 0;
|
|
3950
4274
|
const size = (_a = props.size) != null ? _a : 16;
|
|
@@ -3958,16 +4282,21 @@ function SortIcon(props) {
|
|
|
3958
4282
|
}), props.lineStyle), {
|
|
3959
4283
|
opacity
|
|
3960
4284
|
});
|
|
3961
|
-
|
|
4285
|
+
useEffect9(() => {
|
|
3962
4286
|
const newOpacity = direction != 0 ? 1 : 0;
|
|
3963
4287
|
if (!rendered && newOpacity) {
|
|
3964
4288
|
setRendered(true);
|
|
3965
4289
|
}
|
|
3966
4290
|
if (newOpacity !== opacity) {
|
|
3967
|
-
requestAnimationFrame(() => {
|
|
4291
|
+
const rafId = requestAnimationFrame(() => {
|
|
3968
4292
|
setOpacity(newOpacity);
|
|
3969
4293
|
});
|
|
4294
|
+
return () => {
|
|
4295
|
+
cancelAnimationFrame(rafId);
|
|
4296
|
+
};
|
|
3970
4297
|
}
|
|
4298
|
+
return () => {
|
|
4299
|
+
};
|
|
3971
4300
|
}, [direction, rendered]);
|
|
3972
4301
|
const onTransitionEnd = () => {
|
|
3973
4302
|
const hidden = opacity === 0 && direction === 0;
|
|
@@ -3983,19 +4312,19 @@ function SortIcon(props) {
|
|
|
3983
4312
|
if (direction === -1) {
|
|
3984
4313
|
indexStyle.top = "100%";
|
|
3985
4314
|
}
|
|
3986
|
-
return /* @__PURE__ */
|
|
4315
|
+
return /* @__PURE__ */ createElement12("div", {
|
|
3987
4316
|
style: __spreadProps(__spreadValues({}, style), { width: size }),
|
|
3988
4317
|
className: join(className, InfiniteTableIconClassName, `${InfiniteTableIconClassName}-sort`)
|
|
3989
|
-
}, showIndex ? /* @__PURE__ */
|
|
4318
|
+
}, showIndex ? /* @__PURE__ */ createElement12("div", {
|
|
3990
4319
|
"data-name": "index",
|
|
3991
4320
|
style: indexStyle,
|
|
3992
4321
|
className: HeaderSortIconIndexCls
|
|
3993
|
-
}, index) : null, /* @__PURE__ */
|
|
4322
|
+
}, index) : null, /* @__PURE__ */ createElement12("div", {
|
|
3994
4323
|
style: __spreadValues({ width: sizes[0] }, lineStyle),
|
|
3995
4324
|
onTransitionEnd
|
|
3996
|
-
}), /* @__PURE__ */
|
|
4325
|
+
}), /* @__PURE__ */ createElement12("div", {
|
|
3997
4326
|
style: __spreadValues({ width: sizes[1] }, lineStyle)
|
|
3998
|
-
}), /* @__PURE__ */
|
|
4327
|
+
}), /* @__PURE__ */ createElement12("div", {
|
|
3999
4328
|
style: __spreadValues({ width: sizes[2] }, lineStyle)
|
|
4000
4329
|
}));
|
|
4001
4330
|
}
|
|
@@ -4003,8 +4332,8 @@ function SortIcon(props) {
|
|
|
4003
4332
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
|
|
4004
4333
|
import {
|
|
4005
4334
|
Fragment,
|
|
4006
|
-
createElement as
|
|
4007
|
-
memo as
|
|
4335
|
+
createElement as createElement13,
|
|
4336
|
+
memo as memo7
|
|
4008
4337
|
} from "react";
|
|
4009
4338
|
|
|
4010
4339
|
// src/components/InfiniteTable/hooks/useInfiniteTableState.ts
|
|
@@ -4018,13 +4347,13 @@ var useInfiniteTableState = () => {
|
|
|
4018
4347
|
// src/components/InfiniteTable/components/cell.css.ts
|
|
4019
4348
|
var import_createRuntimeFn2 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
4020
4349
|
var CellClsVariants = { shifting: "_1eexc2a3", dragging: "_1eexc2a4" };
|
|
4021
|
-
var ColumnCellCls = "_1eexc2a5
|
|
4022
|
-
var ColumnCellRecipe = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "_1eexc2a7", variantClassNames: { dragging: { false: "_1eexc2a8", true: "_1eexc2a9" },
|
|
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"]] });
|
|
4023
4352
|
|
|
4024
4353
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
|
|
4025
|
-
var { rootClassName:
|
|
4026
|
-
var InfiniteTableCellClassName = `${
|
|
4027
|
-
var InfiniteTableCellContentClassName = `${
|
|
4354
|
+
var { rootClassName: rootClassName5 } = internalProps;
|
|
4355
|
+
var InfiniteTableCellClassName = `${rootClassName5}Cell`;
|
|
4356
|
+
var InfiniteTableCellContentClassName = `${rootClassName5}Cell_content`;
|
|
4028
4357
|
function InfiniteTableCellFn(props) {
|
|
4029
4358
|
var _b, _c, _d;
|
|
4030
4359
|
const _a = props, {
|
|
@@ -4078,37 +4407,37 @@ function InfiniteTableCellFn(props) {
|
|
|
4078
4407
|
style,
|
|
4079
4408
|
"data-column-id": column.id,
|
|
4080
4409
|
className: join(domProps.className, justifyContent[(_b = column.align) != null ? _b : "start"], InfiniteTableCellClassName, ColumnCellCls, shifting ? `${InfiniteTableCellClassName}--shifting ${CellClsVariants.shifting}` : ""),
|
|
4081
|
-
children: /* @__PURE__ */
|
|
4410
|
+
children: /* @__PURE__ */ createElement13(Fragment, null, beforeChildren, /* @__PURE__ */ createElement13("div", {
|
|
4082
4411
|
className: join(InfiniteTableCellContentClassName, cssEllipsis ? cssEllipsisClassName : overflow.hidden, contentClassName),
|
|
4083
4412
|
style: contentStyle
|
|
4084
4413
|
}, children), afterChildren)
|
|
4085
4414
|
});
|
|
4086
4415
|
const RenderComponent = cellType === "body" ? (_c = column.components) == null ? void 0 : _c.ColumnCell : (_d = column.components) == null ? void 0 : _d.HeaderCell;
|
|
4087
4416
|
if (RenderComponent) {
|
|
4088
|
-
return /* @__PURE__ */
|
|
4417
|
+
return /* @__PURE__ */ createElement13(RenderComponent, __spreadValues({}, finalDOMProps));
|
|
4089
4418
|
}
|
|
4090
|
-
return /* @__PURE__ */
|
|
4419
|
+
return /* @__PURE__ */ createElement13("div", __spreadProps(__spreadValues({}, finalDOMProps), {
|
|
4091
4420
|
ref: domRef
|
|
4092
4421
|
}));
|
|
4093
4422
|
}
|
|
4094
|
-
var InfiniteTableCell =
|
|
4423
|
+
var InfiniteTableCell = memo7(InfiniteTableCellFn);
|
|
4095
4424
|
|
|
4096
4425
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableColumnHeaderFilter.tsx
|
|
4097
4426
|
import {
|
|
4098
|
-
createElement as
|
|
4427
|
+
createElement as createElement14
|
|
4099
4428
|
} from "react";
|
|
4100
|
-
import { useEffect as
|
|
4101
|
-
var { rootClassName:
|
|
4102
|
-
var InfiniteTableColumnHeaderFilterClassName = `${
|
|
4429
|
+
import { useEffect as useEffect10, useState as useState9 } from "react";
|
|
4430
|
+
var { rootClassName: rootClassName6 } = internalProps;
|
|
4431
|
+
var InfiniteTableColumnHeaderFilterClassName = `${rootClassName6}HeaderCell__filter`;
|
|
4103
4432
|
var stopPropagation = (e) => e.stopPropagation();
|
|
4104
4433
|
function InfiniteTableColumnHeaderFilter(props) {
|
|
4105
4434
|
var _a, _b, _c, _d;
|
|
4106
|
-
const [theValue, setTheValue] =
|
|
4435
|
+
const [theValue, setTheValue] = useState9((_b = (_a = props.columnFilterValue) == null ? void 0 : _a.filterValue) != null ? _b : "");
|
|
4107
4436
|
const onInputChange = (filterValue) => {
|
|
4108
4437
|
setTheValue(filterValue);
|
|
4109
4438
|
props.onChange(filterValue);
|
|
4110
4439
|
};
|
|
4111
|
-
|
|
4440
|
+
useEffect10(() => {
|
|
4112
4441
|
var _a2;
|
|
4113
4442
|
if (props.columnFilterValue) {
|
|
4114
4443
|
if (theValue !== props.columnFilterValue.filterValue) {
|
|
@@ -4135,15 +4464,15 @@ function InfiniteTableColumnHeaderFilter(props) {
|
|
|
4135
4464
|
onChange: onInputChange
|
|
4136
4465
|
};
|
|
4137
4466
|
const FilterEditor = props.filterEditor;
|
|
4138
|
-
return /* @__PURE__ */
|
|
4467
|
+
return /* @__PURE__ */ createElement14("div", {
|
|
4139
4468
|
onPointerUp: stopPropagation,
|
|
4140
4469
|
onPointerDown: stopPropagation,
|
|
4141
4470
|
className: `${InfiniteTableColumnHeaderFilterClassName} ${HeaderFilterCls}`,
|
|
4142
4471
|
style: { height: props.columnHeaderHeight }
|
|
4143
|
-
}, FilterEditor ? /* @__PURE__ */
|
|
4472
|
+
}, FilterEditor ? /* @__PURE__ */ createElement14(FilterEditor, __spreadValues({}, filterEditorProps)) : null);
|
|
4144
4473
|
}
|
|
4145
4474
|
function InfiniteTableColumnHeaderFilterEmpty() {
|
|
4146
|
-
return /* @__PURE__ */
|
|
4475
|
+
return /* @__PURE__ */ createElement14("div", {
|
|
4147
4476
|
onPointerUp: stopPropagation,
|
|
4148
4477
|
onPointerDown: stopPropagation,
|
|
4149
4478
|
className: `${InfiniteTableColumnHeaderFilterClassName} ${HeaderFilterCls}`,
|
|
@@ -4153,8 +4482,8 @@ function InfiniteTableColumnHeaderFilterEmpty() {
|
|
|
4153
4482
|
|
|
4154
4483
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
|
|
4155
4484
|
var InfiniteTableHeaderCellContext = createContext4(null);
|
|
4156
|
-
var { rootClassName:
|
|
4157
|
-
var InfiniteTableHeaderCellClassName = `${
|
|
4485
|
+
var { rootClassName: rootClassName7 } = internalProps;
|
|
4486
|
+
var InfiniteTableHeaderCellClassName = `${rootClassName7}HeaderCell`;
|
|
4158
4487
|
function InfiniteTableHeaderCell(props) {
|
|
4159
4488
|
var _a, _b, _c, _d, _e;
|
|
4160
4489
|
const column = props.column;
|
|
@@ -4162,13 +4491,13 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4162
4491
|
const { onResize, height, width, headerOptions } = props;
|
|
4163
4492
|
const sortInfo = column.computedSortInfo;
|
|
4164
4493
|
let header = column.header;
|
|
4165
|
-
const ref =
|
|
4494
|
+
const ref = useCallback7((node) => {
|
|
4166
4495
|
var _a2;
|
|
4167
4496
|
domRef.current = node;
|
|
4168
4497
|
(_a2 = props.domRef) == null ? void 0 : _a2.call(props, node);
|
|
4169
4498
|
}, [props.domRef]);
|
|
4170
4499
|
const alwaysShow = headerOptions.alwaysReserveSpaceForSortIcon;
|
|
4171
|
-
const sortTool = column.computedSorted || alwaysShow ? /* @__PURE__ */
|
|
4500
|
+
const sortTool = column.computedSorted || alwaysShow ? /* @__PURE__ */ createElement15(SortIcon, {
|
|
4172
4501
|
index: column.computedMultiSort ? column.computedSortIndex + 1 : void 0,
|
|
4173
4502
|
className: `${InfiniteTableHeaderCellClassName}__sort-icon ${HeaderSortIconCls} ${HeaderSortIconRecipe({
|
|
4174
4503
|
align: column.align || "start"
|
|
@@ -4185,15 +4514,15 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4185
4514
|
const align = column.align || "start";
|
|
4186
4515
|
const renderChildren = () => {
|
|
4187
4516
|
if (header instanceof Function) {
|
|
4188
|
-
header = /* @__PURE__ */
|
|
4517
|
+
header = /* @__PURE__ */ createElement15(RenderHookComponent, {
|
|
4189
4518
|
render: header,
|
|
4190
4519
|
renderParam
|
|
4191
4520
|
});
|
|
4192
4521
|
}
|
|
4193
4522
|
header = header != null ? header : column.name;
|
|
4194
|
-
return /* @__PURE__ */
|
|
4523
|
+
return /* @__PURE__ */ createElement15(Fragment2, null, align === "end" ? sortTool : null, header, align !== "end" ? sortTool : null);
|
|
4195
4524
|
};
|
|
4196
|
-
const domRef =
|
|
4525
|
+
const domRef = useRef12(null);
|
|
4197
4526
|
const {
|
|
4198
4527
|
computed: { computedRemainingSpace, showColumnFilters },
|
|
4199
4528
|
componentState: { portalDOMRef, columnHeaderHeight, filterEditors }
|
|
@@ -4203,7 +4532,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4203
4532
|
getState: getDataSourceState,
|
|
4204
4533
|
componentState: { filterDelay, filterTypes }
|
|
4205
4534
|
} = useDataSourceContextValue();
|
|
4206
|
-
|
|
4535
|
+
useEffect11(() => {
|
|
4207
4536
|
let clearOnResize = null;
|
|
4208
4537
|
const node = domRef.current;
|
|
4209
4538
|
if (onResize && node) {
|
|
@@ -4224,7 +4553,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4224
4553
|
});
|
|
4225
4554
|
let draggingProxy = null;
|
|
4226
4555
|
if (dragging) {
|
|
4227
|
-
draggingProxy = /* @__PURE__ */
|
|
4556
|
+
draggingProxy = /* @__PURE__ */ createElement15("div", {
|
|
4228
4557
|
className: `${InfiniteTableHeaderCellClassName}Proxy ${HeaderCellProxy}`,
|
|
4229
4558
|
style: {
|
|
4230
4559
|
position: "absolute",
|
|
@@ -4241,7 +4570,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4241
4570
|
const contentRecipeVariants = {
|
|
4242
4571
|
filtered: column.computedFiltered
|
|
4243
4572
|
};
|
|
4244
|
-
const setFilterValue =
|
|
4573
|
+
const setFilterValue = useCallback7((filterValue) => {
|
|
4245
4574
|
var _a2;
|
|
4246
4575
|
const state = getDataSourceState();
|
|
4247
4576
|
let newFilterValue = (_a2 = state.filterValue) != null ? _a2 : [];
|
|
@@ -4302,9 +4631,9 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4302
4631
|
]);
|
|
4303
4632
|
const filterType = column.computedFilterType;
|
|
4304
4633
|
const FilterEditor = filterEditors[filterType] || defaultFilterEditors[filterType] || StringFilterEditor;
|
|
4305
|
-
return /* @__PURE__ */
|
|
4634
|
+
return /* @__PURE__ */ createElement15(ContextProvider, {
|
|
4306
4635
|
value: renderParam
|
|
4307
|
-
}, /* @__PURE__ */
|
|
4636
|
+
}, /* @__PURE__ */ createElement15(InfiniteTableCell, {
|
|
4308
4637
|
domRef: ref,
|
|
4309
4638
|
cellType: "header",
|
|
4310
4639
|
column,
|
|
@@ -4316,9 +4645,9 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4316
4645
|
onPointerUp,
|
|
4317
4646
|
contentClassName: join(HeaderCellContentRecipe(contentRecipeVariants), justifyContent[(_c = column.align) != null ? _c : "start"]),
|
|
4318
4647
|
contentStyle: showColumnFilters ? { height: height / 2 } : void 0,
|
|
4319
|
-
className: join(InfiniteTableHeaderCellClassName, userSelect.none, column.computedSortable ? cursor.pointer : "", useCellClassName(column, [InfiniteTableHeaderCellClassName, InfiniteTableCellClassName], HeaderCellRecipe, { dragging, zebra: false }), CellCls),
|
|
4648
|
+
className: join(InfiniteTableHeaderCellClassName, userSelect.none, column.computedSortable ? cursor.pointer : "", useCellClassName(column, [InfiniteTableHeaderCellClassName, InfiniteTableCellClassName], HeaderCellRecipe, { dragging, zebra: false, rowActive: false }), CellCls),
|
|
4320
4649
|
cssEllipsis: (_e = (_d = column.headerCssEllipsis) != null ? _d : column.cssEllipsis) != null ? _e : true,
|
|
4321
|
-
afterChildren: showColumnFilters ? column.computedFilterable ? /* @__PURE__ */
|
|
4650
|
+
afterChildren: showColumnFilters ? column.computedFilterable ? /* @__PURE__ */ createElement15(InfiniteTableColumnHeaderFilter, {
|
|
4322
4651
|
filterEditor: FilterEditor,
|
|
4323
4652
|
filterTypes,
|
|
4324
4653
|
onChange: debouncedOnFilterValueChange,
|
|
@@ -4326,7 +4655,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4326
4655
|
columnLabel: column.field || column.name || column.id,
|
|
4327
4656
|
columnFilterValue: column.computedFilterValue,
|
|
4328
4657
|
columnHeaderHeight
|
|
4329
|
-
}) : /* @__PURE__ */
|
|
4658
|
+
}) : /* @__PURE__ */ createElement15(InfiniteTableColumnHeaderFilterEmpty, null) : null,
|
|
4330
4659
|
renderChildren
|
|
4331
4660
|
}), draggingProxy);
|
|
4332
4661
|
}
|
|
@@ -4337,8 +4666,8 @@ function useInfiniteHeaderCell() {
|
|
|
4337
4666
|
|
|
4338
4667
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx
|
|
4339
4668
|
import {
|
|
4340
|
-
createElement as
|
|
4341
|
-
useCallback as
|
|
4669
|
+
createElement as createElement18,
|
|
4670
|
+
useCallback as useCallback9,
|
|
4342
4671
|
useMemo as useMemo6
|
|
4343
4672
|
} from "react";
|
|
4344
4673
|
|
|
@@ -4463,14 +4792,14 @@ function assignGroupOffsetsAndComputedWidths(items, groupOffset = 0) {
|
|
|
4463
4792
|
|
|
4464
4793
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
|
|
4465
4794
|
import {
|
|
4466
|
-
createElement as
|
|
4467
|
-
memo as
|
|
4795
|
+
createElement as createElement17,
|
|
4796
|
+
memo as memo8
|
|
4468
4797
|
} from "react";
|
|
4469
|
-
import { useCallback as
|
|
4798
|
+
import { useCallback as useCallback8, useEffect as useEffect12, useRef as useRef13 } from "react";
|
|
4470
4799
|
|
|
4471
4800
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderGroup.tsx
|
|
4472
4801
|
import {
|
|
4473
|
-
createElement as
|
|
4802
|
+
createElement as createElement16
|
|
4474
4803
|
} from "react";
|
|
4475
4804
|
var TableHeaderGroupClassName = `${rootClassName2}HeaderGroup`;
|
|
4476
4805
|
function InfiniteTableHeaderGroup(props) {
|
|
@@ -4481,19 +4810,19 @@ function InfiniteTableHeaderGroup(props) {
|
|
|
4481
4810
|
columnGroup
|
|
4482
4811
|
});
|
|
4483
4812
|
}
|
|
4484
|
-
return /* @__PURE__ */
|
|
4813
|
+
return /* @__PURE__ */ createElement16("div", {
|
|
4485
4814
|
ref: props.domRef,
|
|
4486
4815
|
"data-group-id": columnGroup.uniqueGroupId,
|
|
4487
4816
|
className: join(HeaderGroupCls, TableHeaderGroupClassName),
|
|
4488
4817
|
style: { width, height }
|
|
4489
|
-
}, /* @__PURE__ */
|
|
4818
|
+
}, /* @__PURE__ */ createElement16("div", {
|
|
4490
4819
|
className: join(`${TableHeaderGroupClassName}__header-content`, cssEllipsisClassName)
|
|
4491
4820
|
}, header));
|
|
4492
4821
|
}
|
|
4493
4822
|
|
|
4494
4823
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
|
|
4495
|
-
var { rootClassName:
|
|
4496
|
-
var TableHeaderClassName = `${
|
|
4824
|
+
var { rootClassName: rootClassName8 } = internalProps;
|
|
4825
|
+
var TableHeaderClassName = `${rootClassName8}Header`;
|
|
4497
4826
|
function InfiniteTableHeaderFn(props) {
|
|
4498
4827
|
const {
|
|
4499
4828
|
brain,
|
|
@@ -4509,7 +4838,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4509
4838
|
componentState: { headerBrain, headerOptions }
|
|
4510
4839
|
} = useInfiniteTable();
|
|
4511
4840
|
const { computedVisibleColumnsMap, showColumnFilters } = computed;
|
|
4512
|
-
|
|
4841
|
+
useEffect12(() => {
|
|
4513
4842
|
const onScroll = (scrollPosition) => {
|
|
4514
4843
|
if (domRef.current) {
|
|
4515
4844
|
domRef.current.style.transform = `translate3d(-${scrollPosition.scrollLeft}px, 0px, 0px)`;
|
|
@@ -4518,7 +4847,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4518
4847
|
const removeOnScroll = brain.onScroll(onScroll);
|
|
4519
4848
|
return removeOnScroll;
|
|
4520
4849
|
}, [brain]);
|
|
4521
|
-
const domRef =
|
|
4850
|
+
const domRef = useRef13(null);
|
|
4522
4851
|
const headerCls = HeaderClsRecipe({
|
|
4523
4852
|
overflow: false,
|
|
4524
4853
|
virtualized: true
|
|
@@ -4528,7 +4857,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4528
4857
|
className: join(TableHeaderClassName, `${TableHeaderClassName}--virtualized`, className, headerCls),
|
|
4529
4858
|
style: __spreadProps(__spreadValues({}, style), { height: columnHeaderHeight })
|
|
4530
4859
|
};
|
|
4531
|
-
const renderCell =
|
|
4860
|
+
const renderCell = useCallback8((params) => {
|
|
4532
4861
|
const {
|
|
4533
4862
|
rowIndex,
|
|
4534
4863
|
colIndex,
|
|
@@ -4553,7 +4882,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4553
4882
|
computedWidth: colGroupItem.computedWidth,
|
|
4554
4883
|
groupOffset: colGroupItem.groupOffset
|
|
4555
4884
|
});
|
|
4556
|
-
return /* @__PURE__ */
|
|
4885
|
+
return /* @__PURE__ */ createElement17(InfiniteTableHeaderGroup, {
|
|
4557
4886
|
domRef: domRef2,
|
|
4558
4887
|
columns: columns2,
|
|
4559
4888
|
width: widthWithColspan,
|
|
@@ -4561,7 +4890,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4561
4890
|
columnGroup: computedColumnGroup
|
|
4562
4891
|
});
|
|
4563
4892
|
}
|
|
4564
|
-
return /* @__PURE__ */
|
|
4893
|
+
return /* @__PURE__ */ createElement17(InfiniteTableHeaderCell, {
|
|
4565
4894
|
domRef: domRef2,
|
|
4566
4895
|
column,
|
|
4567
4896
|
headerOptions,
|
|
@@ -4577,13 +4906,13 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4577
4906
|
columnGroupsMaxDepth,
|
|
4578
4907
|
showColumnFilters
|
|
4579
4908
|
]);
|
|
4580
|
-
return /* @__PURE__ */
|
|
4909
|
+
return /* @__PURE__ */ createElement17("div", __spreadValues({}, domProps), /* @__PURE__ */ createElement17(RawTable, {
|
|
4581
4910
|
renderCell,
|
|
4582
4911
|
brain: headerBrain,
|
|
4583
4912
|
cellHoverClassNames: []
|
|
4584
4913
|
}));
|
|
4585
4914
|
}
|
|
4586
|
-
var InfiniteTableHeader =
|
|
4915
|
+
var InfiniteTableHeader = memo8(InfiniteTableHeaderFn);
|
|
4587
4916
|
|
|
4588
4917
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx
|
|
4589
4918
|
function TableHeaderWrapper(props) {
|
|
@@ -4612,7 +4941,7 @@ function TableHeaderWrapper(props) {
|
|
|
4612
4941
|
}
|
|
4613
4942
|
return buildColumnAndGroupTree(computedVisibleColumns, computedColumnGroups, columnGroupsDepthsMap, columnGroupsMaxDepth);
|
|
4614
4943
|
}, [computedVisibleColumns, computedColumnGroups, columnGroupsDepthsMap]);
|
|
4615
|
-
const cellspan =
|
|
4944
|
+
const cellspan = useCallback9(({ rowIndex, colIndex }) => {
|
|
4616
4945
|
const column = computedVisibleColumns[colIndex];
|
|
4617
4946
|
const rowspan2 = 1;
|
|
4618
4947
|
const colspan2 = 1;
|
|
@@ -4645,9 +4974,9 @@ function TableHeaderWrapper(props) {
|
|
|
4645
4974
|
rows,
|
|
4646
4975
|
columnGroupsDepthsMap
|
|
4647
4976
|
]);
|
|
4648
|
-
const rowspan =
|
|
4649
|
-
const colspan =
|
|
4650
|
-
const rowHeight =
|
|
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) => {
|
|
4651
4980
|
return showColumnFilters ? index < rows - 1 ? columnHeaderHeight : 2 * columnHeaderHeight : columnHeaderHeight;
|
|
4652
4981
|
}, [rows, showColumnFilters, columnHeaderHeight]);
|
|
4653
4982
|
useMatrixBrain(brain, {
|
|
@@ -4662,21 +4991,21 @@ function TableHeaderWrapper(props) {
|
|
|
4662
4991
|
fixedColsEnd: computedPinnedEndColumns.length,
|
|
4663
4992
|
fixedColsStart: computedPinnedStartColumns.length
|
|
4664
4993
|
});
|
|
4665
|
-
const header = /* @__PURE__ */
|
|
4994
|
+
const header = /* @__PURE__ */ createElement18(InfiniteTableHeader, {
|
|
4666
4995
|
columns: computedVisibleColumns,
|
|
4667
4996
|
brain,
|
|
4668
4997
|
columnHeaderHeight: height,
|
|
4669
4998
|
columnGroupsMaxDepth,
|
|
4670
4999
|
columnAndGroupTreeInfo
|
|
4671
5000
|
});
|
|
4672
|
-
const verticalScrollbarPlaceholder = scrollbars.vertical && getScrollbarWidth() ? /* @__PURE__ */
|
|
5001
|
+
const verticalScrollbarPlaceholder = scrollbars.vertical && getScrollbarWidth() ? /* @__PURE__ */ createElement18("div", {
|
|
4673
5002
|
className: HeaderScrollbarPlaceholderCls,
|
|
4674
5003
|
style: {
|
|
4675
5004
|
zIndex: 1e3,
|
|
4676
5005
|
width: getScrollbarWidth()
|
|
4677
5006
|
}
|
|
4678
5007
|
}) : null;
|
|
4679
|
-
return /* @__PURE__ */
|
|
5008
|
+
return /* @__PURE__ */ createElement18("div", {
|
|
4680
5009
|
className: HeaderWrapperCls,
|
|
4681
5010
|
style: {
|
|
4682
5011
|
height
|
|
@@ -4686,12 +5015,12 @@ function TableHeaderWrapper(props) {
|
|
|
4686
5015
|
|
|
4687
5016
|
// src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
|
|
4688
5017
|
import {
|
|
4689
|
-
createElement as
|
|
5018
|
+
createElement as createElement19,
|
|
4690
5019
|
forwardRef as forwardRef4,
|
|
4691
|
-
useCallback as
|
|
4692
|
-
useRef as
|
|
5020
|
+
useCallback as useCallback10,
|
|
5021
|
+
useRef as useRef14
|
|
4693
5022
|
} from "react";
|
|
4694
|
-
import { useEffect as
|
|
5023
|
+
import { useEffect as useEffect13 } from "react";
|
|
4695
5024
|
|
|
4696
5025
|
// src/components/utils/decamelize.ts
|
|
4697
5026
|
function decamelize(str, options) {
|
|
@@ -4700,14 +5029,14 @@ function decamelize(str, options) {
|
|
|
4700
5029
|
}
|
|
4701
5030
|
|
|
4702
5031
|
// src/components/InfiniteTable/theme.css.ts
|
|
4703
|
-
var ThemeVars = { color: { accent: "var(--infinite-accent-color)", color: "var(--infinite-color)" }, spacing: { "0": "var(--infinite-space-0)", "1": "var(--infinite-space-1)", "2": "var(--infinite-space-2)", "3": "var(--infinite-space-3)", "4": "var(--infinite-space-4)", "5": "var(--infinite-space-5)", "6": "var(--infinite-space-6)", "7": "var(--infinite-space-7)", "8": "var(--infinite-space-8)", "9": "var(--infinite-space-9)", "10": "var(--infinite-space-10)" }, fontSize: { "0": "var(--infinite-font-size-0)", "1": "var(--infinite-font-size-1)", "2": "var(--infinite-font-size-2)", "3": "var(--infinite-font-size-3)", "4": "var(--infinite-font-size-4)", "5": "var(--infinite-font-size-5)", "6": "var(--infinite-font-size-6)", "7": "var(--infinite-font-size-7)" }, fontFamily: "var(--infinite-font-family)", minHeight: "var(--infinite-min-height)", borderRadius: "var(--infinite-border-radius)", background: "var(--infinite-background)", components: { LoadMask: { padding: "var(--infinite-load-mask-padding)", color: "var(--infinite-load-mask-color)", textBackground: "var(--infinite-load-mask-text-background)", overlayBackground: "var(--infinite-load-mask-overlay-background)", overlayOpacity: "var(--infinite-load-mask-overlay-opacity)", borderRadius: "var(--infinite-load-mask-border-radius)" }, Header: { background: "var(--infinite-header-background)", color: "var(--infinite-header-color)", columnHeaderHeight: "var(--infinite-column-header-height)" }, HeaderCell: { draggingBackground: "var(--infinite-header-cell-dragging-background)", background: "var(--infinite-header-cell-background)", padding: "var(--infinite-header-cell-padding)", paddingX: "var(--infinite-header-cell-padding-x)", paddingY: "var(--infinite-header-cell-padding-y)", iconSize: "var(--infinite-header-cell-icon-size)", sortIconMargin: "var(--infinite-header-cell-sort-icon-margin)" }, Cell: { padding: "var(--infinite-cell-padding)", borderWidth: "var(--infinite-cell-border-width)", border: "var(--infinite-cell-border)", borderInvisible: "var(--infinite-cell-border-invisible)", borderRadius: "var(--infinite-cell-border-radius)", color: "var(--infinite-cell-color)" }, Row: { background: "var(--infinite-row-background)", oddBackground: "var(--infinite-row-odd-background)", hoverBackground: "var(--infinite-row-hover-background)", groupRowBackground: "var(--infinite-group-row-background)", groupRowColumnNesting: "var(--infinite-group-row-column-nesting)", groupNesting: "var(--infinite-dont-override-group-row-nesting-length)", pointerEventsWhileScrolling: "var(--infinite-row-pointer-events-while-scrolling)" }, ColumnCell: { background: "var(--infinite-column-cell-bg-dont-override)" } } };
|
|
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)" } } };
|
|
4704
5033
|
|
|
4705
5034
|
// src/components/InfiniteTable/InfiniteCls.css.ts
|
|
4706
5035
|
var import_createRuntimeFn3 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
4707
5036
|
var FooterCls = "_16lm1iw1";
|
|
4708
|
-
var InfiniteCls = "_1yeub2v0 _16lm1iw1
|
|
5037
|
+
var InfiniteCls = "_1yeub2v0 _16lm1iw1 _16lm1iwm _16lm1iw12 _16lm1iw0";
|
|
4709
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: [] });
|
|
4710
|
-
var InfiniteClsShiftingColumns = "
|
|
5039
|
+
var InfiniteClsShiftingColumns = "_16lm1iwp";
|
|
4711
5040
|
var PinnedRowsContainerClsVariants = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "", variantClassNames: { pinned: { start: "_1yeub2vh", end: "_1yeub2vi", false: "_1yeub2vj" } }, defaultVariants: {}, compoundVariants: [] });
|
|
4712
5041
|
|
|
4713
5042
|
// src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
|
|
@@ -4738,9 +5067,9 @@ var enforceStyle = (node, style) => {
|
|
|
4738
5067
|
}
|
|
4739
5068
|
};
|
|
4740
5069
|
var InfiniteTableLicenseFooter = forwardRef4(function InfiniteTableLicenseFooter2(props, ref) {
|
|
4741
|
-
const { rootClassName:
|
|
4742
|
-
const domRef =
|
|
4743
|
-
const domCallback =
|
|
5070
|
+
const { rootClassName: rootClassName11 } = useInternalProps();
|
|
5071
|
+
const domRef = useRef14(null);
|
|
5072
|
+
const domCallback = useCallback10((node) => {
|
|
4744
5073
|
domRef.current = node;
|
|
4745
5074
|
if (!ref) {
|
|
4746
5075
|
return;
|
|
@@ -4751,7 +5080,7 @@ var InfiniteTableLicenseFooter = forwardRef4(function InfiniteTableLicenseFooter
|
|
|
4751
5080
|
ref.current = node;
|
|
4752
5081
|
}
|
|
4753
5082
|
}, []);
|
|
4754
|
-
|
|
5083
|
+
useEffect13(() => {
|
|
4755
5084
|
const forceStyle = () => {
|
|
4756
5085
|
requestAnimationFrame(() => {
|
|
4757
5086
|
var _a;
|
|
@@ -4765,12 +5094,12 @@ var InfiniteTableLicenseFooter = forwardRef4(function InfiniteTableLicenseFooter
|
|
|
4765
5094
|
clearInterval(intervalId);
|
|
4766
5095
|
};
|
|
4767
5096
|
}, []);
|
|
4768
|
-
return /* @__PURE__ */
|
|
5097
|
+
return /* @__PURE__ */ createElement19("div", __spreadProps(__spreadValues({
|
|
4769
5098
|
ref: domCallback
|
|
4770
5099
|
}, props), {
|
|
4771
|
-
className: join(`${
|
|
5100
|
+
className: join(`${rootClassName11}-Footer`, FooterCls, props.className),
|
|
4772
5101
|
style: defaultStyle
|
|
4773
|
-
}), "Powered by", " ", /* @__PURE__ */
|
|
5102
|
+
}), "Powered by", " ", /* @__PURE__ */ createElement19("a", {
|
|
4774
5103
|
href: "https://infinite-table.com",
|
|
4775
5104
|
rel: "noopener noreferrer",
|
|
4776
5105
|
role: "link",
|
|
@@ -4781,13 +5110,13 @@ var InfiniteTableLicenseFooter = forwardRef4(function InfiniteTableLicenseFooter
|
|
|
4781
5110
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableColumnCell.tsx
|
|
4782
5111
|
import {
|
|
4783
5112
|
createContext as createContext5,
|
|
4784
|
-
createElement as
|
|
4785
|
-
memo as
|
|
5113
|
+
createElement as createElement20,
|
|
5114
|
+
memo as memo9
|
|
4786
5115
|
} from "react";
|
|
4787
|
-
import { useContext as useContext6 } from "react";
|
|
4788
|
-
var { rootClassName:
|
|
5116
|
+
import { useCallback as useCallback11, useContext as useContext6, useMemo as useMemo7 } from "react";
|
|
5117
|
+
var { rootClassName: rootClassName9 } = internalProps;
|
|
4789
5118
|
var InfiniteTableColumnCellContext = createContext5(null);
|
|
4790
|
-
var InfiniteTableColumnCellClassName = `${
|
|
5119
|
+
var InfiniteTableColumnCellClassName = `${rootClassName9}ColumnCell`;
|
|
4791
5120
|
function isColumnWithField(c) {
|
|
4792
5121
|
return typeof c.field === "string";
|
|
4793
5122
|
}
|
|
@@ -4811,7 +5140,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
4811
5140
|
showZebraRows
|
|
4812
5141
|
} = props;
|
|
4813
5142
|
if (!column) {
|
|
4814
|
-
return /* @__PURE__ */
|
|
5143
|
+
return /* @__PURE__ */ createElement20("div", {
|
|
4815
5144
|
ref: domRef
|
|
4816
5145
|
}, "no column");
|
|
4817
5146
|
}
|
|
@@ -4839,17 +5168,35 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
4839
5168
|
value
|
|
4840
5169
|
});
|
|
4841
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]);
|
|
4842
5187
|
const { componentState: computedDataSource } = useDataSourceContextValue();
|
|
4843
5188
|
const rest = rowInfo.isGroupRow ? {
|
|
4844
5189
|
rowInfo,
|
|
4845
5190
|
isGroupRow: rowInfo.isGroupRow,
|
|
4846
5191
|
data: rowInfo.data,
|
|
5192
|
+
rowActive,
|
|
4847
5193
|
value,
|
|
4848
5194
|
field: column.field
|
|
4849
5195
|
} : {
|
|
4850
5196
|
rowInfo,
|
|
4851
5197
|
isGroupRow: rowInfo.isGroupRow,
|
|
4852
5198
|
data: rowInfo.data,
|
|
5199
|
+
rowActive,
|
|
4853
5200
|
value,
|
|
4854
5201
|
field: column.field
|
|
4855
5202
|
};
|
|
@@ -4865,28 +5212,28 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
4865
5212
|
isGroupRow,
|
|
4866
5213
|
rowIndex,
|
|
4867
5214
|
toggleGroupRow,
|
|
4868
|
-
toggleCurrentGroupRow: () => {
|
|
5215
|
+
toggleCurrentGroupRow: useCallback11(() => {
|
|
4869
5216
|
if (!rowInfo.isGroupRow) {
|
|
4870
5217
|
return;
|
|
4871
5218
|
}
|
|
4872
5219
|
toggleGroupRow(rowInfo.groupKeys);
|
|
4873
|
-
},
|
|
5220
|
+
}, []),
|
|
4874
5221
|
groupBy: computedDataSource.groupBy,
|
|
4875
5222
|
pivotBy: computedDataSource.pivotBy
|
|
4876
5223
|
});
|
|
4877
|
-
const renderChildren = () => {
|
|
5224
|
+
const renderChildren = useCallback11(() => {
|
|
4878
5225
|
if (hidden) {
|
|
4879
5226
|
return null;
|
|
4880
5227
|
}
|
|
4881
5228
|
const renderFn = column.render || column.renderValue;
|
|
4882
5229
|
if (renderFn) {
|
|
4883
|
-
return /* @__PURE__ */
|
|
5230
|
+
return /* @__PURE__ */ createElement20(RenderHookComponent, {
|
|
4884
5231
|
render: renderFn,
|
|
4885
5232
|
renderParam
|
|
4886
5233
|
});
|
|
4887
5234
|
}
|
|
4888
5235
|
return renderValue;
|
|
4889
|
-
};
|
|
5236
|
+
}, [column, hidden, ...Object.values(renderParam)]);
|
|
4890
5237
|
const rowPropsAndStyleArgs = __spreadProps(__spreadValues({}, rest), {
|
|
4891
5238
|
rowIndex
|
|
4892
5239
|
});
|
|
@@ -4899,6 +5246,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
4899
5246
|
style = column.style ? typeof column.style === "function" ? __spreadValues(__spreadValues({}, style), column.style(stylingRenderParam) || {}) : __spreadValues(__spreadValues({}, style), column.style) : style || {};
|
|
4900
5247
|
style.width = width;
|
|
4901
5248
|
style.height = rowHeight;
|
|
5249
|
+
const memoizedStyle = useMemo7(() => style, [!style ? null : JSON.stringify(style)]);
|
|
4902
5250
|
const odd = (rowInfo.indexInAll != null ? rowInfo.indexInAll : rowIndex) % 2 === 1;
|
|
4903
5251
|
const zebra = showZebraRows ? odd ? "odd" : "even" : false;
|
|
4904
5252
|
const cellProps = {
|
|
@@ -4908,19 +5256,20 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
4908
5256
|
column,
|
|
4909
5257
|
width,
|
|
4910
5258
|
offset: virtualized ? 0 : column.computedPinningOffset,
|
|
4911
|
-
style,
|
|
5259
|
+
style: memoizedStyle,
|
|
4912
5260
|
onMouseLeave,
|
|
4913
5261
|
onMouseEnter,
|
|
5262
|
+
onClick,
|
|
4914
5263
|
cssEllipsis: (_a = column.cssEllipsis) != null ? _a : true,
|
|
4915
|
-
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),
|
|
4916
5265
|
renderChildren
|
|
4917
5266
|
};
|
|
4918
5267
|
const ContextProvider = InfiniteTableColumnCellContext.Provider;
|
|
4919
|
-
return /* @__PURE__ */
|
|
5268
|
+
return /* @__PURE__ */ createElement20(ContextProvider, {
|
|
4920
5269
|
value: renderParam
|
|
4921
|
-
}, /* @__PURE__ */
|
|
5270
|
+
}, /* @__PURE__ */ createElement20(InfiniteTableCell, __spreadValues({}, cellProps)));
|
|
4922
5271
|
}
|
|
4923
|
-
var InfiniteTableColumnCell =
|
|
5272
|
+
var InfiniteTableColumnCell = memo9(InfiniteTableColumnCellFn);
|
|
4924
5273
|
function useInfiniteColumnCell() {
|
|
4925
5274
|
const result = useContext6(InfiniteTableColumnCellContext);
|
|
4926
5275
|
return result;
|
|
@@ -4934,35 +5283,97 @@ var RowHoverCls = "_7pupv01";
|
|
|
4934
5283
|
|
|
4935
5284
|
// src/components/InfiniteTable/components/LoadMask.tsx
|
|
4936
5285
|
import {
|
|
4937
|
-
createElement as
|
|
4938
|
-
memo as
|
|
5286
|
+
createElement as createElement21,
|
|
5287
|
+
memo as memo10
|
|
4939
5288
|
} from "react";
|
|
4940
5289
|
|
|
4941
5290
|
// src/components/InfiniteTable/components/LoadMask.css.ts
|
|
4942
|
-
var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2
|
|
4943
|
-
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";
|
|
4944
5293
|
var LoadMaskTextCls = "qy58ya4";
|
|
4945
5294
|
|
|
4946
5295
|
// src/components/InfiniteTable/components/LoadMask.tsx
|
|
4947
|
-
var { rootClassName:
|
|
4948
|
-
var
|
|
5296
|
+
var { rootClassName: rootClassName10 } = internalProps;
|
|
5297
|
+
var baseCls3 = `${rootClassName10}-LoadMask`;
|
|
4949
5298
|
function LoadMaskFn(props) {
|
|
4950
5299
|
const { visible, children = "Loading" } = props;
|
|
4951
|
-
return /* @__PURE__ */
|
|
4952
|
-
className: `${LoadMaskCls[visible ? "visible" : "hidden"]} ${
|
|
4953
|
-
}, /* @__PURE__ */
|
|
4954
|
-
className: `${LoadMaskOverlayCls} ${
|
|
4955
|
-
}), /* @__PURE__ */
|
|
4956
|
-
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`
|
|
4957
5306
|
}, children));
|
|
4958
5307
|
}
|
|
4959
|
-
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
|
+
}
|
|
4960
5371
|
|
|
4961
5372
|
// src/components/InfiniteTable/hooks/useAutoSizeColumns.ts
|
|
4962
5373
|
import {
|
|
4963
|
-
useEffect as
|
|
4964
|
-
useRef as
|
|
4965
|
-
useState as
|
|
5374
|
+
useEffect as useEffect14,
|
|
5375
|
+
useRef as useRef15,
|
|
5376
|
+
useState as useState10
|
|
4966
5377
|
} from "react";
|
|
4967
5378
|
var OFFSET = 10;
|
|
4968
5379
|
function getColumnContentMaxWidths(domRef, options) {
|
|
@@ -5023,11 +5434,11 @@ function useAutoSizeColumns() {
|
|
|
5023
5434
|
componentActions,
|
|
5024
5435
|
componentState: { domRef, ready, autoSizeColumnsKey, brain }
|
|
5025
5436
|
} = useComponentState();
|
|
5026
|
-
const [refreshId, setRefreshId] =
|
|
5437
|
+
const [refreshId, setRefreshId] = useState10(0);
|
|
5027
5438
|
const theKey = typeof autoSizeColumnsKey === "object" ? autoSizeColumnsKey.key : autoSizeColumnsKey;
|
|
5028
5439
|
const getTheKey = useLatest(theKey);
|
|
5029
|
-
const lastExecutedIdentifierRef =
|
|
5030
|
-
|
|
5440
|
+
const lastExecutedIdentifierRef = useRef15(null);
|
|
5441
|
+
useEffect14(() => {
|
|
5031
5442
|
const key = getTheKey();
|
|
5032
5443
|
if (key == null) {
|
|
5033
5444
|
return;
|
|
@@ -5040,7 +5451,7 @@ function useAutoSizeColumns() {
|
|
|
5040
5451
|
};
|
|
5041
5452
|
return brain.onRenderRangeChange(onChange);
|
|
5042
5453
|
}, [brain]);
|
|
5043
|
-
|
|
5454
|
+
useEffect14(() => {
|
|
5044
5455
|
var _a;
|
|
5045
5456
|
if (theKey == null) {
|
|
5046
5457
|
return;
|
|
@@ -5085,20 +5496,8 @@ function useAutoSizeColumns() {
|
|
|
5085
5496
|
}
|
|
5086
5497
|
|
|
5087
5498
|
// src/components/InfiniteTable/hooks/useCellRendering.tsx
|
|
5088
|
-
import { useCallback as
|
|
5089
|
-
import
|
|
5090
|
-
|
|
5091
|
-
// src/components/hooks/useRerender.ts
|
|
5092
|
-
import { useCallback as useCallback10, useState as useState8 } from "react";
|
|
5093
|
-
var useRerender = () => {
|
|
5094
|
-
const [state, setState] = useState8(0);
|
|
5095
|
-
return [
|
|
5096
|
-
state,
|
|
5097
|
-
useCallback10(() => {
|
|
5098
|
-
setState((state2) => state2 + 1);
|
|
5099
|
-
}, [setState])
|
|
5100
|
-
];
|
|
5101
|
-
};
|
|
5499
|
+
import { useCallback as useCallback12, useEffect as useEffect15, useRef as useRef16 } from "react";
|
|
5500
|
+
import React27 from "react";
|
|
5102
5501
|
|
|
5103
5502
|
// src/components/InfiniteTable/hooks/useYourBrain.ts
|
|
5104
5503
|
function useYourBrain(param) {
|
|
@@ -5128,7 +5527,7 @@ function useYourBrain(param) {
|
|
|
5128
5527
|
// src/components/InfiniteTable/hooks/useCellRendering.tsx
|
|
5129
5528
|
var SCROLL_BOTTOM_OFFSET = 1;
|
|
5130
5529
|
function useCellRendering(param) {
|
|
5131
|
-
const { computed, bodySize } = param;
|
|
5530
|
+
const { computed, bodySize, imperativeApi } = param;
|
|
5132
5531
|
const { componentActions, componentState, getState } = useInfiniteTable();
|
|
5133
5532
|
const {
|
|
5134
5533
|
computedPinnedStartColumns,
|
|
@@ -5168,13 +5567,13 @@ function useCellRendering(param) {
|
|
|
5168
5567
|
bodySize,
|
|
5169
5568
|
rowspan
|
|
5170
5569
|
});
|
|
5171
|
-
const scrollTopMaxRef =
|
|
5172
|
-
|
|
5570
|
+
const scrollTopMaxRef = useRef16(0);
|
|
5571
|
+
useEffect15(() => {
|
|
5173
5572
|
return brain.onRenderCountChange(() => {
|
|
5174
5573
|
scrollTopMaxRef.current = brain.scrollTopMax;
|
|
5175
5574
|
});
|
|
5176
5575
|
}, [brain]);
|
|
5177
|
-
|
|
5576
|
+
useEffect15(() => {
|
|
5178
5577
|
return brain.onScrollStop((scrollPosition) => {
|
|
5179
5578
|
const { scrollTop } = scrollPosition;
|
|
5180
5579
|
if (scrollTop === 0) {
|
|
@@ -5191,31 +5590,21 @@ function useCellRendering(param) {
|
|
|
5191
5590
|
}
|
|
5192
5591
|
});
|
|
5193
5592
|
}, [brain, onScrollToTop, onScrollToBottom]);
|
|
5194
|
-
|
|
5593
|
+
useEffect15(() => {
|
|
5195
5594
|
if (!bodySize.height) {
|
|
5196
5595
|
return;
|
|
5197
5596
|
}
|
|
5198
5597
|
const { onReady } = getState();
|
|
5199
5598
|
componentActions.ready = true;
|
|
5200
5599
|
if (onReady) {
|
|
5201
|
-
const imperativeApi = {
|
|
5202
|
-
setColumnOrder: (columnOrder) => {
|
|
5203
|
-
componentActions.columnOrder = columnOrder;
|
|
5204
|
-
},
|
|
5205
|
-
setColumnVisibility: (columnVisibility) => {
|
|
5206
|
-
componentActions.columnVisibility = columnVisibility;
|
|
5207
|
-
},
|
|
5208
|
-
getState,
|
|
5209
|
-
getDataSourceState
|
|
5210
|
-
};
|
|
5211
5600
|
onReady(imperativeApi);
|
|
5212
5601
|
}
|
|
5213
5602
|
}, [!!bodySize.height]);
|
|
5214
5603
|
const [, rerender] = useRerender();
|
|
5215
|
-
|
|
5604
|
+
useEffect15(() => {
|
|
5216
5605
|
rerender();
|
|
5217
5606
|
}, [dataSourceState]);
|
|
5218
|
-
const renderCell =
|
|
5607
|
+
const renderCell = useCallback12((params) => {
|
|
5219
5608
|
const {
|
|
5220
5609
|
rowIndex,
|
|
5221
5610
|
colIndex,
|
|
@@ -5250,7 +5639,7 @@ function useCellRendering(param) {
|
|
|
5250
5639
|
rowStyle,
|
|
5251
5640
|
rowClassName
|
|
5252
5641
|
};
|
|
5253
|
-
return /* @__PURE__ */
|
|
5642
|
+
return /* @__PURE__ */ React27.createElement(InfiniteTableColumnCell, __spreadValues({}, cellProps));
|
|
5254
5643
|
}, [
|
|
5255
5644
|
rowHeight,
|
|
5256
5645
|
getData,
|
|
@@ -5268,13 +5657,13 @@ function useCellRendering(param) {
|
|
|
5268
5657
|
}
|
|
5269
5658
|
|
|
5270
5659
|
// src/components/InfiniteTable/hooks/useComputed.ts
|
|
5271
|
-
import { useCallback as
|
|
5660
|
+
import { useCallback as useCallback15, useEffect as useEffect25, useState as useState14 } from "react";
|
|
5272
5661
|
|
|
5273
5662
|
// src/components/InfiniteTable/hooks/useColumnGroups.ts
|
|
5274
|
-
import { useEffect as
|
|
5663
|
+
import { useEffect as useEffect17 } from "react";
|
|
5275
5664
|
|
|
5276
5665
|
// src/components/hooks/useInterceptedMap.ts
|
|
5277
|
-
import { useEffect as
|
|
5666
|
+
import { useEffect as useEffect16 } from "react";
|
|
5278
5667
|
function interceptMap(map2, fns) {
|
|
5279
5668
|
const { set, delete: deleteKey, clear } = map2;
|
|
5280
5669
|
if (fns.set) {
|
|
@@ -5362,7 +5751,7 @@ function useColumnGroups() {
|
|
|
5362
5751
|
componentActions,
|
|
5363
5752
|
getComponentState
|
|
5364
5753
|
} = useComponentState();
|
|
5365
|
-
|
|
5754
|
+
useEffect17(() => {
|
|
5366
5755
|
const recompute = () => {
|
|
5367
5756
|
componentActions.columnGroupsDepthsMap = computeColumnGroupsDepths(computedColumnGroups);
|
|
5368
5757
|
};
|
|
@@ -5373,7 +5762,7 @@ function useColumnGroups() {
|
|
|
5373
5762
|
set: update
|
|
5374
5763
|
});
|
|
5375
5764
|
}, [computedColumnGroups]);
|
|
5376
|
-
|
|
5765
|
+
useEffect17(() => {
|
|
5377
5766
|
return interceptMap(collapsedColumnGroups, {
|
|
5378
5767
|
set: (key, visibleCol) => {
|
|
5379
5768
|
const colIds = key.slice(1);
|
|
@@ -5408,10 +5797,10 @@ function useColumnGroups() {
|
|
|
5408
5797
|
}
|
|
5409
5798
|
|
|
5410
5799
|
// src/components/InfiniteTable/hooks/useColumnRowspan.ts
|
|
5411
|
-
import { useMemo as
|
|
5800
|
+
import { useMemo as useMemo8 } from "react";
|
|
5412
5801
|
function useColumnRowspan(computedVisibleColumns) {
|
|
5413
5802
|
const { getState: getDataSourceState } = useDataSourceContextValue();
|
|
5414
|
-
const rowspan =
|
|
5803
|
+
const rowspan = useMemo8(() => {
|
|
5415
5804
|
const colsWithRowspan = computedVisibleColumns.filter((col) => typeof col.rowspan === "function");
|
|
5416
5805
|
return colsWithRowspan.length ? ({ rowIndex, colIndex }) => {
|
|
5417
5806
|
const dataArray = getDataSourceState().dataArray;
|
|
@@ -5437,10 +5826,10 @@ function useColumnRowspan(computedVisibleColumns) {
|
|
|
5437
5826
|
}
|
|
5438
5827
|
|
|
5439
5828
|
// src/components/InfiniteTable/hooks/useColumnSizeFn.ts
|
|
5440
|
-
import { useCallback as
|
|
5829
|
+
import { useCallback as useCallback13 } from "react";
|
|
5441
5830
|
var debug4 = dbg("useColumnSizeFn");
|
|
5442
5831
|
function useColumnSizeFn(columns) {
|
|
5443
|
-
const columnSize =
|
|
5832
|
+
const columnSize = useCallback13((index) => {
|
|
5444
5833
|
const column = columns[index];
|
|
5445
5834
|
if (!column) {
|
|
5446
5835
|
debug4("cannot find column at index", index, columns);
|
|
@@ -5451,11 +5840,11 @@ function useColumnSizeFn(columns) {
|
|
|
5451
5840
|
}
|
|
5452
5841
|
|
|
5453
5842
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
5454
|
-
import { useEffect as
|
|
5843
|
+
import { useEffect as useEffect22, useMemo as useMemo10 } from "react";
|
|
5455
5844
|
|
|
5456
5845
|
// src/components/InfiniteTable/utils/getColumnForGroupBy.tsx
|
|
5457
5846
|
import {
|
|
5458
|
-
createElement as
|
|
5847
|
+
createElement as createElement24
|
|
5459
5848
|
} from "react";
|
|
5460
5849
|
|
|
5461
5850
|
// src/utils/stripVar.ts
|
|
@@ -5473,21 +5862,21 @@ var showLoadingIcon = (rowInfo) => {
|
|
|
5473
5862
|
|
|
5474
5863
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
5475
5864
|
import {
|
|
5476
|
-
createElement as
|
|
5477
|
-
useEffect as
|
|
5865
|
+
createElement as createElement22,
|
|
5866
|
+
useEffect as useEffect18
|
|
5478
5867
|
} from "react";
|
|
5479
|
-
import { useState as
|
|
5868
|
+
import { useState as useState11 } from "react";
|
|
5480
5869
|
|
|
5481
5870
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.css.ts
|
|
5482
5871
|
var import_createRuntimeFn5 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
5483
|
-
var ExpanderIconCls = "_16lm1iw6
|
|
5872
|
+
var ExpanderIconCls = "_16lm1iw6 _16lm1iwg _16lm1iwd";
|
|
5484
5873
|
var ExpanderIconClsVariants = (0, import_createRuntimeFn5.createRuntimeFn)({ defaultClassName: "", variantClassNames: { expanded: { true: "_16lm1iwc", false: "_198z9782" } }, defaultVariants: {}, compoundVariants: [] });
|
|
5485
5874
|
|
|
5486
5875
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
5487
5876
|
function ExpanderIcon(props) {
|
|
5488
5877
|
var _a;
|
|
5489
5878
|
const { size = 24 } = props;
|
|
5490
|
-
const [expanded, setExpanded] =
|
|
5879
|
+
const [expanded, setExpanded] = useState11((_a = props.expanded) != null ? _a : props.defaultExpanded);
|
|
5491
5880
|
const onClick = () => {
|
|
5492
5881
|
var _a2;
|
|
5493
5882
|
(_a2 = props.onChange) == null ? void 0 : _a2.call(props, !expanded);
|
|
@@ -5495,12 +5884,12 @@ function ExpanderIcon(props) {
|
|
|
5495
5884
|
setExpanded(!expanded);
|
|
5496
5885
|
}
|
|
5497
5886
|
};
|
|
5498
|
-
|
|
5887
|
+
useEffect18(() => {
|
|
5499
5888
|
if (isControlled("expanded", props)) {
|
|
5500
5889
|
setExpanded(props.expanded);
|
|
5501
5890
|
}
|
|
5502
5891
|
}, [props.expanded]);
|
|
5503
|
-
return /* @__PURE__ */
|
|
5892
|
+
return /* @__PURE__ */ createElement22("svg", {
|
|
5504
5893
|
"data-name": "expander-icon",
|
|
5505
5894
|
xmlns: "http://www.w3.org/2000/svg",
|
|
5506
5895
|
height: `${size}px`,
|
|
@@ -5511,22 +5900,22 @@ function ExpanderIcon(props) {
|
|
|
5511
5900
|
className: join(props.className, ExpanderIconCls, ExpanderIconClsVariants({
|
|
5512
5901
|
expanded
|
|
5513
5902
|
}), "InfiniteIcon", "InfiniteIcon-expander", `InfiniteIcon-expander--${expanded ? "expanded" : "collapsed"}`)
|
|
5514
|
-
}, /* @__PURE__ */
|
|
5903
|
+
}, /* @__PURE__ */ createElement22("path", {
|
|
5515
5904
|
d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"
|
|
5516
5905
|
}));
|
|
5517
5906
|
}
|
|
5518
5907
|
|
|
5519
5908
|
// src/components/InfiniteTable/components/icons/LoadingIcon.tsx
|
|
5520
5909
|
import {
|
|
5521
|
-
createElement as
|
|
5910
|
+
createElement as createElement23
|
|
5522
5911
|
} from "react";
|
|
5523
5912
|
|
|
5524
5913
|
// src/components/InfiniteTable/components/icons/LoadingIcon.css.ts
|
|
5525
|
-
var LoadingIconCls = "_16lm1iw8
|
|
5914
|
+
var LoadingIconCls = "_16lm1iw8 _16lm1iwg _16lm1iwd";
|
|
5526
5915
|
|
|
5527
5916
|
// src/components/InfiniteTable/components/icons/LoadingIcon.tsx
|
|
5528
5917
|
var LoadingIcon = (props) => {
|
|
5529
|
-
return /* @__PURE__ */
|
|
5918
|
+
return /* @__PURE__ */ createElement23("svg", {
|
|
5530
5919
|
xmlns: "http://www.w3.org/2000/svg",
|
|
5531
5920
|
style: {
|
|
5532
5921
|
margin: "auto",
|
|
@@ -5538,14 +5927,14 @@ var LoadingIcon = (props) => {
|
|
|
5538
5927
|
viewBox: "0 0 100 100",
|
|
5539
5928
|
preserveAspectRatio: "xMidYMid",
|
|
5540
5929
|
className: join(props.className, LoadingIconCls, "InfiniteIcon", "InfiniteIcon-loading")
|
|
5541
|
-
}, /* @__PURE__ */
|
|
5930
|
+
}, /* @__PURE__ */ createElement23("circle", {
|
|
5542
5931
|
cx: "50",
|
|
5543
5932
|
cy: "50",
|
|
5544
5933
|
fill: "none",
|
|
5545
5934
|
strokeWidth: "10",
|
|
5546
5935
|
r: "35",
|
|
5547
5936
|
strokeDasharray: "164.93361431346415 56.97787143782138"
|
|
5548
|
-
}, /* @__PURE__ */
|
|
5937
|
+
}, /* @__PURE__ */ createElement23("animateTransform", {
|
|
5549
5938
|
attributeName: "transform",
|
|
5550
5939
|
type: "rotate",
|
|
5551
5940
|
repeatCount: "indefinite",
|
|
@@ -5565,7 +5954,7 @@ function getGroupColumnRender({
|
|
|
5565
5954
|
var _a, _b, _c;
|
|
5566
5955
|
let { value, rowInfo, column, groupBy, pivotBy } = renderOptions;
|
|
5567
5956
|
if (column.renderValue) {
|
|
5568
|
-
value = /* @__PURE__ */
|
|
5957
|
+
value = /* @__PURE__ */ createElement24(RenderHookComponent, {
|
|
5569
5958
|
render: column.renderValue,
|
|
5570
5959
|
renderParam: renderOptions
|
|
5571
5960
|
});
|
|
@@ -5595,22 +5984,22 @@ function getGroupColumnRender({
|
|
|
5595
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);
|
|
5596
5985
|
const isLoading = showLoadingIcon(groupRowInfo);
|
|
5597
5986
|
if (isLoading) {
|
|
5598
|
-
icon = /* @__PURE__ */
|
|
5987
|
+
icon = /* @__PURE__ */ createElement24(LoadingIcon, null);
|
|
5599
5988
|
} else if (showExpanderIcon) {
|
|
5600
|
-
const defaultIcon = /* @__PURE__ */
|
|
5989
|
+
const defaultIcon = /* @__PURE__ */ createElement24(ExpanderIcon, {
|
|
5601
5990
|
expanded: !collapsed,
|
|
5602
5991
|
onChange: () => {
|
|
5603
5992
|
toggleGroupRow(groupKeys);
|
|
5604
5993
|
}
|
|
5605
5994
|
});
|
|
5606
|
-
icon = column.renderGroupIcon ? /* @__PURE__ */
|
|
5995
|
+
icon = column.renderGroupIcon ? /* @__PURE__ */ createElement24(RenderHookComponent, {
|
|
5607
5996
|
render: column.renderGroupIcon,
|
|
5608
5997
|
renderParam: Object.assign({ collapsed, groupIcon: defaultIcon }, renderOptions)
|
|
5609
5998
|
}) : defaultIcon;
|
|
5610
5999
|
}
|
|
5611
|
-
return /* @__PURE__ */
|
|
6000
|
+
return /* @__PURE__ */ createElement24("div", {
|
|
5612
6001
|
className: join(display.flex, alignItems.center)
|
|
5613
|
-
}, icon, /* @__PURE__ */
|
|
6002
|
+
}, icon, /* @__PURE__ */ createElement24("div", {
|
|
5614
6003
|
className: cssEllipsisClassName
|
|
5615
6004
|
}, value != null ? value : null));
|
|
5616
6005
|
};
|
|
@@ -5655,9 +6044,9 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
5655
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;
|
|
5656
6045
|
const isLoading = showLoadingIcon(rowInfo);
|
|
5657
6046
|
if (isLoading) {
|
|
5658
|
-
icon = /* @__PURE__ */
|
|
6047
|
+
icon = /* @__PURE__ */ createElement24(LoadingIcon, null);
|
|
5659
6048
|
} else if (showExpanderIcon) {
|
|
5660
|
-
const defaultIcon = /* @__PURE__ */
|
|
6049
|
+
const defaultIcon = /* @__PURE__ */ createElement24(ExpanderIcon, {
|
|
5661
6050
|
expanded: !collapsed,
|
|
5662
6051
|
onChange: () => {
|
|
5663
6052
|
if (!rowInfo.isGroupRow) {
|
|
@@ -5672,9 +6061,9 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
5672
6061
|
icon = column.renderGroupIcon(renderParam);
|
|
5673
6062
|
}
|
|
5674
6063
|
}
|
|
5675
|
-
return /* @__PURE__ */
|
|
6064
|
+
return /* @__PURE__ */ createElement24("div", {
|
|
5676
6065
|
className: join(display.flex, alignItems.center, GroupRowExpanderCls)
|
|
5677
|
-
}, icon, /* @__PURE__ */
|
|
6066
|
+
}, icon, /* @__PURE__ */ createElement24("div", {
|
|
5678
6067
|
className: cssEllipsisClassName
|
|
5679
6068
|
}, value != null ? value : null));
|
|
5680
6069
|
}
|
|
@@ -5690,11 +6079,11 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
5690
6079
|
}
|
|
5691
6080
|
|
|
5692
6081
|
// src/components/InfiniteTable/hooks/useEffectWithRaf.ts
|
|
5693
|
-
import { useEffect as
|
|
6082
|
+
import { useEffect as useEffect19, useRef as useRef17 } from "react";
|
|
5694
6083
|
function useEffectWithRaf(fn, deps) {
|
|
5695
|
-
const rafId =
|
|
5696
|
-
const removeFnRaf =
|
|
5697
|
-
|
|
6084
|
+
const rafId = useRef17(0);
|
|
6085
|
+
const removeFnRaf = useRef17();
|
|
6086
|
+
useEffect19(() => {
|
|
5698
6087
|
rafId.current = requestAnimationFrame(() => {
|
|
5699
6088
|
removeFnRaf.current = fn();
|
|
5700
6089
|
});
|
|
@@ -5711,7 +6100,7 @@ function useEffectWithRaf(fn, deps) {
|
|
|
5711
6100
|
}
|
|
5712
6101
|
|
|
5713
6102
|
// src/components/InfiniteTable/hooks/useToggleGroupRow.ts
|
|
5714
|
-
import { useCallback as
|
|
6103
|
+
import { useCallback as useCallback14 } from "react";
|
|
5715
6104
|
|
|
5716
6105
|
// src/utils/groupAndPivot/index.ts
|
|
5717
6106
|
var LAZY_ROOT_KEY_FOR_GROUPS = "____root____";
|
|
@@ -6166,7 +6555,7 @@ function enhancedFlatten(param) {
|
|
|
6166
6555
|
// src/components/DataSource/index.tsx
|
|
6167
6556
|
import {
|
|
6168
6557
|
Fragment as Fragment3,
|
|
6169
|
-
createElement as
|
|
6558
|
+
createElement as createElement25
|
|
6170
6559
|
} from "react";
|
|
6171
6560
|
|
|
6172
6561
|
// src/utils/multisort/sortTypes.ts
|
|
@@ -6355,15 +6744,15 @@ var GroupRowsState = class {
|
|
|
6355
6744
|
};
|
|
6356
6745
|
|
|
6357
6746
|
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
6358
|
-
import { useEffect as
|
|
6747
|
+
import { useEffect as useEffect21, useMemo as useMemo9, useRef as useRef19, useState as useState12 } from "react";
|
|
6359
6748
|
|
|
6360
6749
|
// src/components/hooks/useEffectWithChanges.ts
|
|
6361
|
-
import { useEffect as
|
|
6750
|
+
import { useEffect as useEffect20, useRef as useRef18 } from "react";
|
|
6362
6751
|
function useEffectWithChanges(fn, deps) {
|
|
6363
|
-
const prevRef =
|
|
6364
|
-
const oldValuesRef =
|
|
6752
|
+
const prevRef = useRef18({});
|
|
6753
|
+
const oldValuesRef = useRef18({});
|
|
6365
6754
|
const oldValues = oldValuesRef.current;
|
|
6366
|
-
const changesRef =
|
|
6755
|
+
const changesRef = useRef18({});
|
|
6367
6756
|
const changes = changesRef.current;
|
|
6368
6757
|
const useEffectDeps = [];
|
|
6369
6758
|
for (const k in deps) {
|
|
@@ -6376,7 +6765,7 @@ function useEffectWithChanges(fn, deps) {
|
|
|
6376
6765
|
}
|
|
6377
6766
|
}
|
|
6378
6767
|
prevRef.current = deps;
|
|
6379
|
-
|
|
6768
|
+
useEffect20(() => {
|
|
6380
6769
|
const changes2 = changesRef.current;
|
|
6381
6770
|
const result = fn(changes2, oldValues);
|
|
6382
6771
|
changesRef.current = {};
|
|
@@ -6644,12 +7033,12 @@ function useLoadData() {
|
|
|
6644
7033
|
livePaginationCursor,
|
|
6645
7034
|
cursorId: stateCursorId
|
|
6646
7035
|
} = componentState;
|
|
6647
|
-
const [scrollbars, setScrollbars] =
|
|
7036
|
+
const [scrollbars, setScrollbars] = useState12({
|
|
6648
7037
|
vertical: false,
|
|
6649
7038
|
horizontal: false
|
|
6650
7039
|
});
|
|
6651
|
-
const scrollbarsRef =
|
|
6652
|
-
|
|
7040
|
+
const scrollbarsRef = useRef19(scrollbars);
|
|
7041
|
+
useEffect21(() => {
|
|
6653
7042
|
notifyScrollbarsChange.onChange((scrollbars2) => {
|
|
6654
7043
|
if (!scrollbars2) {
|
|
6655
7044
|
return;
|
|
@@ -6659,7 +7048,7 @@ function useLoadData() {
|
|
|
6659
7048
|
});
|
|
6660
7049
|
return () => notifyScrollbarsChange.destroy();
|
|
6661
7050
|
}, [notifyScrollbarsChange]);
|
|
6662
|
-
|
|
7051
|
+
useEffect21(() => {
|
|
6663
7052
|
if (!livePagination) {
|
|
6664
7053
|
return;
|
|
6665
7054
|
}
|
|
@@ -6673,7 +7062,7 @@ function useLoadData() {
|
|
|
6673
7062
|
});
|
|
6674
7063
|
return () => cancelAnimationFrame(frameId);
|
|
6675
7064
|
}, [livePaginationCursor]);
|
|
6676
|
-
|
|
7065
|
+
useEffect21(() => {
|
|
6677
7066
|
if (!livePagination || livePaginationCursor !== void 0) {
|
|
6678
7067
|
return;
|
|
6679
7068
|
}
|
|
@@ -6687,7 +7076,7 @@ function useLoadData() {
|
|
|
6687
7076
|
});
|
|
6688
7077
|
return () => cancelAnimationFrame(frameId);
|
|
6689
7078
|
}, [dataArray.length, livePaginationCursor]);
|
|
6690
|
-
|
|
7079
|
+
useEffect21(() => {
|
|
6691
7080
|
const state = getComponentState();
|
|
6692
7081
|
const { livePaginationCursor: livePaginationCursor2, livePagination: livePagination2, dataArray: dataArray2 } = state;
|
|
6693
7082
|
if (!scrollbars.vertical && livePagination2) {
|
|
@@ -6705,7 +7094,7 @@ function useLoadData() {
|
|
|
6705
7094
|
filterValue,
|
|
6706
7095
|
cursorId: livePagination ? stateCursorId : null
|
|
6707
7096
|
};
|
|
6708
|
-
const initialRef =
|
|
7097
|
+
const initialRef = useRef19(true);
|
|
6709
7098
|
useLazyLoadRange();
|
|
6710
7099
|
useEffectWithChanges(() => {
|
|
6711
7100
|
const componentState2 = getComponentState();
|
|
@@ -6737,7 +7126,7 @@ function useLazyLoadRange() {
|
|
|
6737
7126
|
componentActions: actions,
|
|
6738
7127
|
componentState
|
|
6739
7128
|
} = useComponentState();
|
|
6740
|
-
|
|
7129
|
+
useEffect21(() => {
|
|
6741
7130
|
actions.lazyLoadCacheOfLoadedBatches = new DeepMap();
|
|
6742
7131
|
}, [componentState.data, componentState.dataParams]);
|
|
6743
7132
|
const {
|
|
@@ -6746,7 +7135,7 @@ function useLazyLoadRange() {
|
|
|
6746
7135
|
dataArray,
|
|
6747
7136
|
scrollStopDelayUpdatedByTable
|
|
6748
7137
|
} = componentState;
|
|
6749
|
-
const latestRenderRangeRef =
|
|
7138
|
+
const latestRenderRangeRef = useRef19(null);
|
|
6750
7139
|
const loadRange = (renderRange, cache = getComponentState().lazyLoadCacheOfLoadedBatches) => {
|
|
6751
7140
|
const componentState2 = getComponentState();
|
|
6752
7141
|
renderRange = renderRange || latestRenderRangeRef.current;
|
|
@@ -6765,8 +7154,8 @@ function useLazyLoadRange() {
|
|
|
6765
7154
|
componentActions: actions
|
|
6766
7155
|
}, cache);
|
|
6767
7156
|
};
|
|
6768
|
-
const debouncedLoadRange =
|
|
6769
|
-
|
|
7157
|
+
const debouncedLoadRange = useMemo9(() => debounce(loadRange, { wait: scrollStopDelayUpdatedByTable }), [scrollStopDelayUpdatedByTable]);
|
|
7158
|
+
useEffect21(() => {
|
|
6770
7159
|
if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
|
|
6771
7160
|
return notifyRenderRangeChange.onChange((renderRange) => {
|
|
6772
7161
|
latestRenderRangeRef.current = renderRange;
|
|
@@ -6775,7 +7164,7 @@ function useLazyLoadRange() {
|
|
|
6775
7164
|
}
|
|
6776
7165
|
return;
|
|
6777
7166
|
}, [lazyLoadBatchSize]);
|
|
6778
|
-
|
|
7167
|
+
useEffect21(() => {
|
|
6779
7168
|
if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
|
|
6780
7169
|
debouncedLoadRange();
|
|
6781
7170
|
}
|
|
@@ -7011,6 +7400,7 @@ var forwardProps2 = (setupState) => {
|
|
|
7011
7400
|
sortTypes: (sortTypes) => {
|
|
7012
7401
|
return __spreadValues(__spreadValues({}, sortTypes_default), sortTypes);
|
|
7013
7402
|
},
|
|
7403
|
+
sortMode: (sortMode) => sortMode != null ? sortMode : "local",
|
|
7014
7404
|
aggregationReducers: 1,
|
|
7015
7405
|
collapseGroupRowsOnDataFunctionChange: (collapseGroupRowsOnDataFunctionChange) => collapseGroupRowsOnDataFunctionChange != null ? collapseGroupRowsOnDataFunctionChange : true,
|
|
7016
7406
|
loading: (loading) => loading != null ? loading : false,
|
|
@@ -7054,7 +7444,7 @@ function mapPropsToState(params) {
|
|
|
7054
7444
|
operatorsByFilterType,
|
|
7055
7445
|
controlledSort,
|
|
7056
7446
|
controlledFilter,
|
|
7057
|
-
filterMode: ((_a = props.filterMode) != null ? _a : props.filterFunction != null) ? "
|
|
7447
|
+
filterMode: ((_a = props.filterMode) != null ? _a : props.filterFunction != null) ? "local" : typeof props.data === "function" ? "remote" : "local",
|
|
7058
7448
|
multiSort: Array.isArray(controlledSort ? props.sortInfo : props.defaultSortInfo),
|
|
7059
7449
|
lazyLoadBatchSize: typeof props.lazyLoad === "object" ? props.lazyLoad.batchSize : void 0
|
|
7060
7450
|
};
|
|
@@ -7445,7 +7835,7 @@ function concludeReducer(params) {
|
|
|
7445
7835
|
}
|
|
7446
7836
|
const { filterFunction, filterValue, filterTypes, operatorsByFilterType } = state;
|
|
7447
7837
|
const shouldFilter = !!filterFunction || Array.isArray(filterValue) && filterValue.length;
|
|
7448
|
-
const shouldFilterClientSide = shouldFilter && state.filterMode === "
|
|
7838
|
+
const shouldFilterClientSide = shouldFilter && state.filterMode === "local";
|
|
7449
7839
|
const filterDepsChanged = haveDepsChanged(previousState, state, [
|
|
7450
7840
|
"filterFunction",
|
|
7451
7841
|
"filterValue",
|
|
@@ -7454,7 +7844,7 @@ function concludeReducer(params) {
|
|
|
7454
7844
|
const filterChanged = originalDataArrayChanged || filterDepsChanged;
|
|
7455
7845
|
const sortInfoChanged = haveDepsChanged(previousState, state, ["sortInfo"]);
|
|
7456
7846
|
const sortDepsChanged = originalDataArrayChanged || filterDepsChanged || sortInfoChanged;
|
|
7457
|
-
const shouldFilterAgain = state.filterMode === "
|
|
7847
|
+
const shouldFilterAgain = state.filterMode === "local" && (filterChanged || !state.lastFilterDataArray);
|
|
7458
7848
|
const shouldSortAgain = shouldSort && (sortDepsChanged || !state.lastSortDataArray);
|
|
7459
7849
|
const groupBy = state.groupBy;
|
|
7460
7850
|
const pivotBy = state.pivotBy;
|
|
@@ -7496,7 +7886,8 @@ function concludeReducer(params) {
|
|
|
7496
7886
|
}
|
|
7497
7887
|
state.filteredCount = dataArray.length;
|
|
7498
7888
|
state.postFilterDataArray = dataArray;
|
|
7499
|
-
|
|
7889
|
+
const shouldSortClientSide = shouldSort && state.sortMode === "local";
|
|
7890
|
+
if (shouldSortClientSide) {
|
|
7500
7891
|
const prevKnownTypes = multisort.knownTypes;
|
|
7501
7892
|
multisort.knownTypes = state.sortTypes;
|
|
7502
7893
|
dataArray = shouldSortAgain ? multisort(sortInfo, [...dataArray]) : state.lastSortDataArray;
|
|
@@ -7576,7 +7967,7 @@ function DataSourceWithContext(props) {
|
|
|
7576
7967
|
if (typeof children === "function") {
|
|
7577
7968
|
children = children(computedValues);
|
|
7578
7969
|
}
|
|
7579
|
-
return /* @__PURE__ */
|
|
7970
|
+
return /* @__PURE__ */ createElement25(Fragment3, null, children);
|
|
7580
7971
|
}
|
|
7581
7972
|
var DataSourceRoot = getComponentStateRoot({
|
|
7582
7973
|
initSetupState,
|
|
@@ -7599,14 +7990,14 @@ function DataSourceCmp({ children }) {
|
|
|
7599
7990
|
globalThis.getDataSourceState = getState;
|
|
7600
7991
|
}
|
|
7601
7992
|
useLoadData();
|
|
7602
|
-
return /* @__PURE__ */
|
|
7993
|
+
return /* @__PURE__ */ createElement25(DataSourceContext.Provider, {
|
|
7603
7994
|
value: contextValue
|
|
7604
|
-
}, /* @__PURE__ */
|
|
7995
|
+
}, /* @__PURE__ */ createElement25(DataSourceWithContext, {
|
|
7605
7996
|
children
|
|
7606
7997
|
}));
|
|
7607
7998
|
}
|
|
7608
7999
|
function DataSource(props) {
|
|
7609
|
-
return /* @__PURE__ */
|
|
8000
|
+
return /* @__PURE__ */ createElement25(DataSourceRoot, __spreadValues({}, props), /* @__PURE__ */ createElement25(DataSourceCmp, {
|
|
7610
8001
|
children: props.children
|
|
7611
8002
|
}));
|
|
7612
8003
|
}
|
|
@@ -7614,7 +8005,7 @@ function DataSource(props) {
|
|
|
7614
8005
|
// src/components/InfiniteTable/hooks/useToggleGroupRow.ts
|
|
7615
8006
|
function useToggleGroupRow() {
|
|
7616
8007
|
const { getState: getDataSourceState, componentActions: dataSourceActions } = useDataSourceContextValue();
|
|
7617
|
-
const toggleGroupRow =
|
|
8008
|
+
const toggleGroupRow = useCallback14((groupKeys) => {
|
|
7618
8009
|
const state = getDataSourceState();
|
|
7619
8010
|
const newState = new GroupRowsState(state.groupRowsState);
|
|
7620
8011
|
newState.toggleGroupRow(groupKeys);
|
|
@@ -7646,7 +8037,7 @@ function useToggleGroupRow() {
|
|
|
7646
8037
|
|
|
7647
8038
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
7648
8039
|
function useGroupByMap(groupBy) {
|
|
7649
|
-
const groupByMap =
|
|
8040
|
+
const groupByMap = useMemo10(() => {
|
|
7650
8041
|
return groupBy.reduce((acc, groupBy2, index) => {
|
|
7651
8042
|
acc.set(groupBy2.field, {
|
|
7652
8043
|
groupBy: groupBy2,
|
|
@@ -7670,13 +8061,13 @@ function useColumnsWhen() {
|
|
|
7670
8061
|
}
|
|
7671
8062
|
} = useComponentState();
|
|
7672
8063
|
const groupByMap = useGroupByMap(groupBy);
|
|
7673
|
-
|
|
8064
|
+
useEffect22(() => {
|
|
7674
8065
|
dataSourceActions.generateGroupRows = groupRenderStrategy !== "inline";
|
|
7675
8066
|
}, [groupRenderStrategy]);
|
|
7676
|
-
|
|
8067
|
+
useEffect22(() => {
|
|
7677
8068
|
dataSourceActions.pivotTotalColumnPosition = pivotTotalColumnPosition;
|
|
7678
8069
|
}, [pivotTotalColumnPosition]);
|
|
7679
|
-
|
|
8070
|
+
useEffect22(() => {
|
|
7680
8071
|
if (pivotGrandTotalColumnPosition != void 0) {
|
|
7681
8072
|
dataSourceActions.pivotGrandTotalColumnPosition = pivotGrandTotalColumnPosition;
|
|
7682
8073
|
}
|
|
@@ -7750,7 +8141,7 @@ function useColumnsWhenInlineGroupRenderStrategy(groupByMap) {
|
|
|
7750
8141
|
});
|
|
7751
8142
|
return computedColumns.size === 0 ? void 0 : computedColumns;
|
|
7752
8143
|
}
|
|
7753
|
-
|
|
8144
|
+
useEffect22(() => {
|
|
7754
8145
|
const update = () => {
|
|
7755
8146
|
componentActions.columnsWhenInlineGroupRenderStrategy = computeColumnsWhenInlineGroupRenderStrategy(columns, groupByMap, groupRenderStrategy, toggleGroupRow);
|
|
7756
8147
|
};
|
|
@@ -7779,7 +8170,7 @@ function useColumnsWhenGrouping() {
|
|
|
7779
8170
|
}
|
|
7780
8171
|
} = useComponentState();
|
|
7781
8172
|
const toggleGroupRow = useToggleGroupRow();
|
|
7782
|
-
|
|
8173
|
+
useEffect22(() => {
|
|
7783
8174
|
const update = () => {
|
|
7784
8175
|
const columnsWhenGrouping = getColumnsWhenGrouping({
|
|
7785
8176
|
columns,
|
|
@@ -7915,7 +8306,7 @@ function useHideColumns(groupByMap) {
|
|
|
7915
8306
|
hideEmptyGroupColumns ? groupRowsState : null,
|
|
7916
8307
|
hideEmptyGroupColumns
|
|
7917
8308
|
]);
|
|
7918
|
-
|
|
8309
|
+
useEffect22(() => {
|
|
7919
8310
|
const isGrouped = groupBy.length > 0;
|
|
7920
8311
|
const currentState = getComponentState();
|
|
7921
8312
|
const { controlledColumnVisibility, columnVisibility } = currentState;
|
|
@@ -8030,7 +8421,7 @@ function getColumnsWhenGrouping(params) {
|
|
|
8030
8421
|
}
|
|
8031
8422
|
|
|
8032
8423
|
// src/components/InfiniteTable/hooks/useComputedVisibleColumns.ts
|
|
8033
|
-
import { useMemo as
|
|
8424
|
+
import { useMemo as useMemo11 } from "react";
|
|
8034
8425
|
|
|
8035
8426
|
// src/components/flexbox/index.ts
|
|
8036
8427
|
var computeFlex = (params) => {
|
|
@@ -8343,7 +8734,7 @@ var getComputedVisibleColumns = ({
|
|
|
8343
8734
|
});
|
|
8344
8735
|
const firstPinnedEndAbsoluteOffset = bodySize.width - totalPinnedEndWidth;
|
|
8345
8736
|
columnsArray.forEach((c, i) => {
|
|
8346
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
|
|
8737
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
|
|
8347
8738
|
const id = visibleColumnOrder[i];
|
|
8348
8739
|
const nextColumnId = visibleColumnOrder[i + 1];
|
|
8349
8740
|
const colType = getColumnComputedType(c, columnTypes);
|
|
@@ -8368,16 +8759,26 @@ var getComputedVisibleColumns = ({
|
|
|
8368
8759
|
const computedDataType = c.dataType || colType.dataType || (Array.isArray(c.type) ? c.type[0] : c.type) || "string";
|
|
8369
8760
|
const computedSortType = c.sortType || colType.sortType || computedDataType;
|
|
8370
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;
|
|
8371
8771
|
const result2 = __spreadProps(__spreadValues({
|
|
8372
8772
|
align: colType.align,
|
|
8373
8773
|
verticalAlign: colType.verticalAlign,
|
|
8374
8774
|
defaultHiddenWhenGroupedBy: colType.defaultHiddenWhenGroupedBy,
|
|
8375
|
-
valueGetter
|
|
8775
|
+
valueGetter,
|
|
8376
8776
|
valueFormatter: colType.valueFormatter,
|
|
8377
8777
|
renderValue: colType.renderValue,
|
|
8378
8778
|
render: colType.render,
|
|
8379
8779
|
style: colType.style,
|
|
8380
|
-
components: colType.components
|
|
8780
|
+
components: colType.components,
|
|
8781
|
+
field
|
|
8381
8782
|
}, c), {
|
|
8382
8783
|
computedDataType,
|
|
8383
8784
|
computedSortType,
|
|
@@ -8391,7 +8792,7 @@ var getComputedVisibleColumns = ({
|
|
|
8391
8792
|
computedAbsoluteOffset,
|
|
8392
8793
|
computedPinningOffset,
|
|
8393
8794
|
computedOffset,
|
|
8394
|
-
computedSortable
|
|
8795
|
+
computedSortable,
|
|
8395
8796
|
computedSortInfo,
|
|
8396
8797
|
computedSortIndex,
|
|
8397
8798
|
computedMultiSort: multiSort,
|
|
@@ -8400,7 +8801,7 @@ var getComputedVisibleColumns = ({
|
|
|
8400
8801
|
computedSortedDesc,
|
|
8401
8802
|
computedVisibleIndex: i,
|
|
8402
8803
|
computedPinned,
|
|
8403
|
-
computedDraggable: (
|
|
8804
|
+
computedDraggable: (_r = (_q = c.draggable) != null ? _q : draggableColumns) != null ? _r : true,
|
|
8404
8805
|
computedFirstInCategory,
|
|
8405
8806
|
computedLastInCategory,
|
|
8406
8807
|
computedFirst: i === 0,
|
|
@@ -8450,7 +8851,7 @@ var getComputedVisibleColumns = ({
|
|
|
8450
8851
|
setSortInfo(finalSortInfo);
|
|
8451
8852
|
},
|
|
8452
8853
|
id,
|
|
8453
|
-
header: (
|
|
8854
|
+
header: (_u = (_t = (_s = c.header) != null ? _s : colType.header) != null ? _t : c.name) != null ? _u : c.field
|
|
8454
8855
|
});
|
|
8455
8856
|
computedOffset += computedWidth;
|
|
8456
8857
|
computedVisibleColumnsMap.set(result2.id, result2);
|
|
@@ -8491,10 +8892,10 @@ var getComputedVisibleColumns = ({
|
|
|
8491
8892
|
};
|
|
8492
8893
|
|
|
8493
8894
|
// src/components/InfiniteTable/hooks/useRerenderOnKeyChange.ts
|
|
8494
|
-
import { useEffect as
|
|
8895
|
+
import { useEffect as useEffect23 } from "react";
|
|
8495
8896
|
var useRerenderOnKeyChange = (map2) => {
|
|
8496
8897
|
const [renderId, rerender] = useRerender();
|
|
8497
|
-
|
|
8898
|
+
useEffect23(() => {
|
|
8498
8899
|
const update = rafFn(rerender);
|
|
8499
8900
|
return interceptMap(map2, {
|
|
8500
8901
|
set: update,
|
|
@@ -8547,7 +8948,7 @@ var useComputedVisibleColumns = ({
|
|
|
8547
8948
|
computedPinnedEndOffset,
|
|
8548
8949
|
computedPinnedEndWidth,
|
|
8549
8950
|
computedPinnedStartWidth
|
|
8550
|
-
} =
|
|
8951
|
+
} = useMemo11(() => {
|
|
8551
8952
|
return getComputedVisibleColumns({
|
|
8552
8953
|
columns,
|
|
8553
8954
|
bodySize,
|
|
@@ -8615,7 +9016,7 @@ var useComputedVisibleColumns = ({
|
|
|
8615
9016
|
};
|
|
8616
9017
|
|
|
8617
9018
|
// src/components/InfiniteTable/hooks/useScrollbars.ts
|
|
8618
|
-
import { useState as
|
|
9019
|
+
import { useState as useState13, useEffect as useEffect24, useLayoutEffect as useLayoutEffect6 } from "react";
|
|
8619
9020
|
var INITIAL_SCROLLBARS = {
|
|
8620
9021
|
vertical: false,
|
|
8621
9022
|
horizontal: false
|
|
@@ -8623,8 +9024,8 @@ var INITIAL_SCROLLBARS = {
|
|
|
8623
9024
|
function useScrollbars(brain) {
|
|
8624
9025
|
const { getComponentState: getInfiniteTableState } = useComponentState();
|
|
8625
9026
|
const { getState: getDataSourceState } = useDataSourceContextValue();
|
|
8626
|
-
const [scrollbars, setScrollbars] =
|
|
8627
|
-
|
|
9027
|
+
const [scrollbars, setScrollbars] = useState13(INITIAL_SCROLLBARS);
|
|
9028
|
+
useEffect24(() => {
|
|
8628
9029
|
return brain.onRenderCountChange(() => {
|
|
8629
9030
|
const { scrollTopMax, scrollLeftMax } = brain;
|
|
8630
9031
|
setScrollbars({
|
|
@@ -8633,7 +9034,7 @@ function useScrollbars(brain) {
|
|
|
8633
9034
|
});
|
|
8634
9035
|
});
|
|
8635
9036
|
}, [brain]);
|
|
8636
|
-
|
|
9037
|
+
useLayoutEffect6(() => {
|
|
8637
9038
|
const dataSourceState = getDataSourceState();
|
|
8638
9039
|
const { onScrollbarsChange } = getInfiniteTableState();
|
|
8639
9040
|
const { notifyScrollbarsChange } = dataSourceState;
|
|
@@ -8664,7 +9065,7 @@ function useComputed() {
|
|
|
8664
9065
|
bodySize,
|
|
8665
9066
|
showSeparatePivotColumnForSingleAggregation
|
|
8666
9067
|
} = componentState;
|
|
8667
|
-
|
|
9068
|
+
useState14(() => {
|
|
8668
9069
|
componentState.onRowHeightCSSVarChange.onChange((rowHeight) => {
|
|
8669
9070
|
if (rowHeight) {
|
|
8670
9071
|
componentActions.rowHeight = rowHeight;
|
|
@@ -8676,13 +9077,13 @@ function useComputed() {
|
|
|
8676
9077
|
}
|
|
8677
9078
|
});
|
|
8678
9079
|
});
|
|
8679
|
-
|
|
9080
|
+
useEffect25(() => {
|
|
8680
9081
|
dataSourceActions.showSeparatePivotColumnForSingleAggregation = showSeparatePivotColumnForSingleAggregation;
|
|
8681
9082
|
}, [showSeparatePivotColumnForSingleAggregation]);
|
|
8682
9083
|
const { multiSort, filterValue } = dataSourceState;
|
|
8683
9084
|
useColumnGroups();
|
|
8684
9085
|
const { toggleGroupRow } = useColumnsWhen();
|
|
8685
|
-
const setSortInfo =
|
|
9086
|
+
const setSortInfo = useCallback15((sortInfo) => {
|
|
8686
9087
|
var _a2;
|
|
8687
9088
|
const newSortInfo = getDataSourceState().multiSort ? sortInfo : (_a2 = sortInfo[0]) != null ? _a2 : null;
|
|
8688
9089
|
dataSourceActions.sortInfo = newSortInfo;
|
|
@@ -8841,7 +9242,7 @@ function useDOMProps(initialDOMProps) {
|
|
|
8841
9242
|
}
|
|
8842
9243
|
|
|
8843
9244
|
// src/components/InfiniteTable/hooks/useLicense/useLicense.ts
|
|
8844
|
-
import { useMemo as
|
|
9245
|
+
import { useMemo as useMemo12 } from "react";
|
|
8845
9246
|
|
|
8846
9247
|
// src/components/InfiniteTable/hooks/useLicense/crc32.ts
|
|
8847
9248
|
var DEFAULT_ReversedPolynomial = 3988292384;
|
|
@@ -8999,10 +9400,10 @@ var isInsideSandbox = () => {
|
|
|
8999
9400
|
};
|
|
9000
9401
|
var isInsidePlayground = isInsideSandbox() || isInsideSandpack();
|
|
9001
9402
|
var useLicense = (licenseKey = "") => {
|
|
9002
|
-
const valid =
|
|
9403
|
+
const valid = useMemo12(() => {
|
|
9003
9404
|
let valid2 = isValidLicense(licenseKey, {
|
|
9004
9405
|
publishedAt: 1624970570587,
|
|
9005
|
-
version: "0.3.
|
|
9406
|
+
version: "0.3.4"
|
|
9006
9407
|
});
|
|
9007
9408
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
9008
9409
|
return true;
|
|
@@ -9012,6 +9413,140 @@ var useLicense = (licenseKey = "") => {
|
|
|
9012
9413
|
return valid;
|
|
9013
9414
|
};
|
|
9014
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
|
+
|
|
9015
9550
|
// src/components/InfiniteTable/state/getInitialState.ts
|
|
9016
9551
|
import { createRef } from "react";
|
|
9017
9552
|
|
|
@@ -9069,6 +9604,18 @@ function toMap(mapOrObject, weakMapCache) {
|
|
|
9069
9604
|
}
|
|
9070
9605
|
|
|
9071
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
|
+
}
|
|
9072
9619
|
function initSetupState2() {
|
|
9073
9620
|
const columnsGeneratedForGrouping = new Map();
|
|
9074
9621
|
const brain = new MatrixBrain();
|
|
@@ -9082,10 +9629,16 @@ function initSetupState2() {
|
|
|
9082
9629
|
if (true) {
|
|
9083
9630
|
globalThis.brain = brain;
|
|
9084
9631
|
}
|
|
9632
|
+
const { renderer, onRenderUpdater } = createRenderer2(brain);
|
|
9085
9633
|
brain.onAvailableSizeChange((size) => {
|
|
9086
9634
|
headerBrain.setAvailableSize({ width: size.width });
|
|
9087
9635
|
});
|
|
9636
|
+
if (true) {
|
|
9637
|
+
globalThis.renderer = renderer;
|
|
9638
|
+
}
|
|
9088
9639
|
return {
|
|
9640
|
+
renderer,
|
|
9641
|
+
onRenderUpdater,
|
|
9089
9642
|
propsCache: new Map([]),
|
|
9090
9643
|
brain,
|
|
9091
9644
|
headerBrain,
|
|
@@ -9146,7 +9699,6 @@ var forwardProps3 = (setupState) => {
|
|
|
9146
9699
|
scrollStopDelay: (scrollStopDelay) => scrollStopDelay != null ? scrollStopDelay : 250,
|
|
9147
9700
|
filterEditors: (filterEditors) => __spreadValues(__spreadValues({}, defaultFilterEditors), filterEditors),
|
|
9148
9701
|
viewportReservedWidth: (viewportReservedWidth) => viewportReservedWidth != null ? viewportReservedWidth : 0,
|
|
9149
|
-
activeIndex: (activeIndex) => activeIndex != null ? activeIndex : 0,
|
|
9150
9702
|
columnMinWidth: (columnMinWidth) => columnMinWidth != null ? columnMinWidth : 30,
|
|
9151
9703
|
columnMaxWidth: (columnMaxWidth) => columnMaxWidth != null ? columnMaxWidth : 2e3,
|
|
9152
9704
|
columnDefaultWidth: (columnDefaultWidth) => columnDefaultWidth != null ? columnDefaultWidth : 200,
|
|
@@ -9161,6 +9713,8 @@ var forwardProps3 = (setupState) => {
|
|
|
9161
9713
|
pivotTotalColumnPosition: (pivotTotalColumnPosition) => pivotTotalColumnPosition != null ? pivotTotalColumnPosition : "end",
|
|
9162
9714
|
pivotGrandTotalColumnPosition: 1,
|
|
9163
9715
|
licenseKey: (licenseKey) => licenseKey || "",
|
|
9716
|
+
activeRowIndex: (activeRowIndex) => activeRowIndex != null ? activeRowIndex : null,
|
|
9717
|
+
activeCellIndex: (activeCellIndex) => activeCellIndex != null ? activeCellIndex : null,
|
|
9164
9718
|
columnOrder: (columnOrder) => columnOrder != null ? columnOrder : true,
|
|
9165
9719
|
header: (header) => header != null ? header : true,
|
|
9166
9720
|
showZebraRows: (showZebraRows) => showZebraRows != null ? showZebraRows : true,
|
|
@@ -9208,6 +9762,7 @@ var mapPropsToState2 = (params) => {
|
|
|
9208
9762
|
groupRenderStrategy,
|
|
9209
9763
|
groupBy,
|
|
9210
9764
|
computedColumns,
|
|
9765
|
+
enableKeyboardNavigation: state.activeRowIndex != null,
|
|
9211
9766
|
columnHeaderCssEllipsis: (_b = (_a = props.columnHeaderCssEllipsis) != null ? _a : props.columnCssEllipsis) != null ? _b : true,
|
|
9212
9767
|
columnGroupsDepthsMap,
|
|
9213
9768
|
columnGroupsMaxDepth: columnGroupsDepthsMap != state.columnGroupsDepthsMap ? Math.max(...columnGroupsDepthsMap.values(), 0) : state.columnGroupsMaxDepth,
|
|
@@ -9231,14 +9786,23 @@ var InfiniteTableRoot = getComponentStateRoot({
|
|
|
9231
9786
|
getParentState: () => useDataSource(),
|
|
9232
9787
|
debugName: "InfiniteTable"
|
|
9233
9788
|
});
|
|
9234
|
-
var InfiniteTableComponent =
|
|
9789
|
+
var InfiniteTableComponent = memo11(function InfiniteTableComponent2() {
|
|
9235
9790
|
var _a;
|
|
9236
|
-
const {
|
|
9791
|
+
const {
|
|
9792
|
+
componentState,
|
|
9793
|
+
getComputed,
|
|
9794
|
+
computed,
|
|
9795
|
+
componentActions: actions,
|
|
9796
|
+
getState
|
|
9797
|
+
} = useInfiniteTable();
|
|
9237
9798
|
const {
|
|
9238
9799
|
componentState: { loading },
|
|
9239
9800
|
getState: getDataSourceState,
|
|
9240
9801
|
componentActions: dataSourceActions
|
|
9241
9802
|
} = useDataSourceContextValue();
|
|
9803
|
+
const [imperativeApi] = useState15(() => {
|
|
9804
|
+
return getImperativeApi(getState, getComputed, getDataSourceState, actions);
|
|
9805
|
+
});
|
|
9242
9806
|
const {
|
|
9243
9807
|
domRef,
|
|
9244
9808
|
scrollerDOMRef,
|
|
@@ -9253,18 +9817,37 @@ var InfiniteTableComponent = memo9(function InfiniteTableComponent2() {
|
|
|
9253
9817
|
components,
|
|
9254
9818
|
scrollStopDelay,
|
|
9255
9819
|
brain,
|
|
9256
|
-
headerBrain
|
|
9820
|
+
headerBrain,
|
|
9821
|
+
renderer,
|
|
9822
|
+
activeRowIndex,
|
|
9823
|
+
activeCellIndex,
|
|
9824
|
+
onRenderUpdater
|
|
9257
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]);
|
|
9258
9840
|
const { columnShifts, bodySize } = componentState;
|
|
9259
9841
|
const { scrollbars } = computed;
|
|
9260
9842
|
const { renderCell } = useCellRendering({
|
|
9843
|
+
imperativeApi,
|
|
9261
9844
|
getComputed,
|
|
9262
9845
|
domRef: componentState.domRef,
|
|
9263
9846
|
columnShifts,
|
|
9264
9847
|
bodySize,
|
|
9265
9848
|
computed
|
|
9266
9849
|
});
|
|
9267
|
-
|
|
9850
|
+
useEffect26(() => {
|
|
9268
9851
|
const dataSourceState = getDataSourceState();
|
|
9269
9852
|
const onChange = debounce((renderRange) => {
|
|
9270
9853
|
dataSourceState.notifyRenderRangeChange({
|
|
@@ -9277,35 +9860,52 @@ var InfiniteTableComponent = memo9(function InfiniteTableComponent2() {
|
|
|
9277
9860
|
const licenseValid = useLicense(licenseKey);
|
|
9278
9861
|
const domProps = useDOMProps(componentState.domProps);
|
|
9279
9862
|
const LoadMaskCmp = (_a = components == null ? void 0 : components.LoadMask) != null ? _a : LoadMask;
|
|
9280
|
-
|
|
9863
|
+
useEffect26(() => {
|
|
9281
9864
|
brain.setScrollStopDelay(scrollStopDelay);
|
|
9282
9865
|
dataSourceActions.scrollStopDelayUpdatedByTable = scrollStopDelay;
|
|
9283
9866
|
}, [scrollStopDelay]);
|
|
9284
9867
|
useAutoSizeColumns();
|
|
9285
|
-
|
|
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,
|
|
9286
9882
|
ref: domRef
|
|
9287
|
-
}, domProps), header ? /* @__PURE__ */
|
|
9883
|
+
}, domProps), header ? /* @__PURE__ */ createElement26(TableHeaderWrapper, {
|
|
9288
9884
|
brain: headerBrain,
|
|
9289
9885
|
scrollbars
|
|
9290
|
-
}) : null, /* @__PURE__ */
|
|
9886
|
+
}) : null, /* @__PURE__ */ createElement26(InfiniteTableBody, null, /* @__PURE__ */ createElement26(HeadlessTable, {
|
|
9291
9887
|
tabIndex: 0,
|
|
9888
|
+
activeRowIndex: componentState.ready ? activeRowIndex : null,
|
|
9889
|
+
activeCellIndex: componentState.ready ? activeCellIndex : null,
|
|
9292
9890
|
scrollStopDelay,
|
|
9891
|
+
renderer,
|
|
9892
|
+
onRenderUpdater,
|
|
9293
9893
|
brain,
|
|
9294
9894
|
renderCell,
|
|
9295
9895
|
cellHoverClassNames: HOVERED_CLASS_NAMES,
|
|
9296
9896
|
scrollerDOMRef
|
|
9297
|
-
}), /* @__PURE__ */
|
|
9897
|
+
}), /* @__PURE__ */ createElement26(LoadMaskCmp, {
|
|
9298
9898
|
visible: loading
|
|
9299
|
-
}, loadingText)), /* @__PURE__ */
|
|
9899
|
+
}, loadingText)), /* @__PURE__ */ createElement26("div", {
|
|
9300
9900
|
ref: portalDOMRef,
|
|
9301
9901
|
className: join(`${rootClassName2}Portal`, zIndex[1e3], position.absolute, top[0], left[0])
|
|
9302
|
-
}), rowHeightCSSVar ? /* @__PURE__ */
|
|
9902
|
+
}), rowHeightCSSVar ? /* @__PURE__ */ createElement26(CSSVariableWatch, {
|
|
9303
9903
|
varName: rowHeightCSSVar,
|
|
9304
9904
|
onChange: onRowHeightCSSVarChange
|
|
9305
|
-
}) : null, columnHeaderHeightCSSVar ? /* @__PURE__ */
|
|
9905
|
+
}) : null, columnHeaderHeightCSSVar ? /* @__PURE__ */ createElement26(CSSVariableWatch, {
|
|
9306
9906
|
varName: columnHeaderHeightCSSVar,
|
|
9307
9907
|
onChange: onColumnHeaderHeightCSSVarChange
|
|
9308
|
-
}) : null, /* @__PURE__ */
|
|
9908
|
+
}) : null, /* @__PURE__ */ createElement26(InfiniteTableFooter, null), licenseValid ? null : /* @__PURE__ */ createElement26(InfiniteTableLicenseFooter, null));
|
|
9309
9909
|
});
|
|
9310
9910
|
function InfiniteTableContextProvider() {
|
|
9311
9911
|
const { componentActions, componentState } = useComponentState();
|
|
@@ -9333,25 +9933,25 @@ function InfiniteTableContextProvider() {
|
|
|
9333
9933
|
bodySize.width = (_b = (_a = scrollerDOMRef.current) == null ? void 0 : _a.scrollWidth) != null ? _b : bodySize.width;
|
|
9334
9934
|
componentActions.bodySize = bodySize;
|
|
9335
9935
|
}, { earlyAttach: true });
|
|
9336
|
-
|
|
9936
|
+
useEffect26(() => {
|
|
9337
9937
|
return () => {
|
|
9338
9938
|
componentState.onRowHeightCSSVarChange.destroy();
|
|
9339
9939
|
componentState.onColumnHeaderHeightCSSVarChange.destroy();
|
|
9340
9940
|
};
|
|
9341
9941
|
}, []);
|
|
9342
|
-
|
|
9942
|
+
useEffect26(() => {
|
|
9343
9943
|
if (scrollerDOMRef.current) {
|
|
9344
9944
|
scrollerDOMRef.current.scrollTop = 0;
|
|
9345
9945
|
}
|
|
9346
9946
|
}, [scrollTopKey, scrollerDOMRef]);
|
|
9347
9947
|
const TableContext2 = getInfiniteTableContext();
|
|
9348
|
-
return /* @__PURE__ */
|
|
9948
|
+
return /* @__PURE__ */ createElement26(TableContext2.Provider, {
|
|
9349
9949
|
value: contextValue
|
|
9350
|
-
}, /* @__PURE__ */
|
|
9950
|
+
}, /* @__PURE__ */ createElement26(InfiniteTableComponent, null));
|
|
9351
9951
|
}
|
|
9352
9952
|
function InfiniteTable(props) {
|
|
9353
|
-
const table = /* @__PURE__ */
|
|
9354
|
-
return /* @__PURE__ */
|
|
9953
|
+
const table = /* @__PURE__ */ createElement26(InfiniteTableRoot, __spreadValues({}, props), /* @__PURE__ */ createElement26(InfiniteTableContextProvider, null));
|
|
9954
|
+
return /* @__PURE__ */ createElement26(StrictMode, null, table);
|
|
9355
9955
|
}
|
|
9356
9956
|
InfiniteTable.defaultProps = {
|
|
9357
9957
|
rowHeight: 40,
|