@infinite-table/infinite-react 0.3.2 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +1 -1
- package/index.css +172 -91
- package/index.d.ts +659 -414
- package/index.esm.css +172 -91
- package/index.esm.js +1889 -810
- package/index.js +1884 -818
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -632,7 +632,12 @@ __export(exports, {
|
|
|
632
632
|
InfiniteTable: () => InfiniteTable,
|
|
633
633
|
InfiniteTableClassName: () => InfiniteTableClassName,
|
|
634
634
|
InfiniteTableComponent: () => InfiniteTableComponent,
|
|
635
|
+
NumberFilterEditor: () => NumberFilterEditor,
|
|
636
|
+
StringFilterEditor: () => StringFilterEditor,
|
|
635
637
|
debounce: () => debounce,
|
|
638
|
+
defaultFilterEditors: () => defaultFilterEditors,
|
|
639
|
+
defaultFilterTypes: () => defaultFilterTypes,
|
|
640
|
+
filterTypes: () => defaultFilterTypes,
|
|
636
641
|
flatten: () => flatten,
|
|
637
642
|
getComponentStateRoot: () => getComponentStateRoot,
|
|
638
643
|
group: () => group,
|
|
@@ -660,7 +665,8 @@ function debounce(fn, { wait }) {
|
|
|
660
665
|
}
|
|
661
666
|
|
|
662
667
|
// src/components/InfiniteTable/index.tsx
|
|
663
|
-
var
|
|
668
|
+
var React32 = __toModule(require("react"));
|
|
669
|
+
var import_react45 = __toModule(require("react"));
|
|
664
670
|
|
|
665
671
|
// src/utils/join.ts
|
|
666
672
|
var join = (...args) => args.filter((x) => !!`${x}`).join(" ");
|
|
@@ -869,8 +875,8 @@ function useDataSourceContextValue() {
|
|
|
869
875
|
}
|
|
870
876
|
|
|
871
877
|
// src/components/HeadlessTable/index.tsx
|
|
872
|
-
var
|
|
873
|
-
var
|
|
878
|
+
var React12 = __toModule(require("react"));
|
|
879
|
+
var import_react11 = __toModule(require("react"));
|
|
874
880
|
|
|
875
881
|
// src/components/VirtualList/SpacePlaceholder.tsx
|
|
876
882
|
var React5 = __toModule(require("react"));
|
|
@@ -2507,6 +2513,171 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2507
2513
|
this.items = [];
|
|
2508
2514
|
this.currentHoveredRow = -1;
|
|
2509
2515
|
this.hoverRowUpdatesInProgress = new Map();
|
|
2516
|
+
this.getFullyVisibleRowsRange = () => {
|
|
2517
|
+
let {
|
|
2518
|
+
start: [startRow],
|
|
2519
|
+
end: [endRow]
|
|
2520
|
+
} = this.brain.getRenderRange();
|
|
2521
|
+
while (!this.isRowFullyVisible(startRow)) {
|
|
2522
|
+
startRow++;
|
|
2523
|
+
if (startRow === endRow) {
|
|
2524
|
+
return null;
|
|
2525
|
+
}
|
|
2526
|
+
}
|
|
2527
|
+
while (!this.isRowFullyVisible(endRow)) {
|
|
2528
|
+
endRow--;
|
|
2529
|
+
if (endRow === startRow) {
|
|
2530
|
+
return null;
|
|
2531
|
+
}
|
|
2532
|
+
}
|
|
2533
|
+
return { start: startRow, end: endRow };
|
|
2534
|
+
};
|
|
2535
|
+
this.getScrollPositionForScrollRowIntoView = (rowIndex, config = { offset: 0 }) => {
|
|
2536
|
+
const { brain } = this;
|
|
2537
|
+
const scrollPosition = brain.getScrollPosition();
|
|
2538
|
+
let { scrollAdjustPosition, offset = 0 } = config;
|
|
2539
|
+
if (this.isRowFullyVisible(rowIndex) && !scrollAdjustPosition) {
|
|
2540
|
+
return scrollPosition;
|
|
2541
|
+
}
|
|
2542
|
+
const rowOffset = brain.getItemOffsetFor(rowIndex, "vertical");
|
|
2543
|
+
const rowHeight = brain.getItemSize(rowIndex, "vertical");
|
|
2544
|
+
const top2 = scrollPosition.scrollTop;
|
|
2545
|
+
const availableSize = brain.getAvailableSize();
|
|
2546
|
+
const bottom = top2 + availableSize.height;
|
|
2547
|
+
if (!scrollAdjustPosition) {
|
|
2548
|
+
scrollAdjustPosition = rowOffset > bottom ? "end" : rowOffset < top2 ? "start" : "end";
|
|
2549
|
+
}
|
|
2550
|
+
let scrollTop = scrollPosition.scrollTop;
|
|
2551
|
+
if (scrollAdjustPosition === "center") {
|
|
2552
|
+
scrollTop = rowOffset - Math.floor(brain.getAvailableSize().height / 2);
|
|
2553
|
+
} else if (scrollAdjustPosition === "start") {
|
|
2554
|
+
offset = -offset;
|
|
2555
|
+
scrollTop += rowOffset - top2 + offset;
|
|
2556
|
+
} else {
|
|
2557
|
+
offset += rowHeight;
|
|
2558
|
+
scrollTop += rowOffset - bottom + offset;
|
|
2559
|
+
}
|
|
2560
|
+
return __spreadProps(__spreadValues({}, scrollPosition), {
|
|
2561
|
+
scrollTop
|
|
2562
|
+
});
|
|
2563
|
+
};
|
|
2564
|
+
this.getScrollPositionForScrollColumnIntoView = (colIndex, config = { offset: 0 }) => {
|
|
2565
|
+
const { brain } = this;
|
|
2566
|
+
const scrollPosition = brain.getScrollPosition();
|
|
2567
|
+
let { scrollAdjustPosition, offset = 0 } = config;
|
|
2568
|
+
if (this.isColumnFullyVisible(colIndex) && !scrollAdjustPosition) {
|
|
2569
|
+
return scrollPosition;
|
|
2570
|
+
}
|
|
2571
|
+
const rowOffset = brain.getItemOffsetFor(colIndex, "horizontal");
|
|
2572
|
+
const colWidth = brain.getItemSize(colIndex, "horizontal");
|
|
2573
|
+
const left2 = scrollPosition.scrollLeft;
|
|
2574
|
+
const availableSize = brain.getAvailableSize();
|
|
2575
|
+
const right = left2 + availableSize.width;
|
|
2576
|
+
if (!scrollAdjustPosition) {
|
|
2577
|
+
scrollAdjustPosition = rowOffset > right ? "end" : rowOffset < left2 ? "start" : "end";
|
|
2578
|
+
}
|
|
2579
|
+
let scrollLeft = scrollPosition.scrollLeft;
|
|
2580
|
+
if (scrollAdjustPosition === "center") {
|
|
2581
|
+
scrollLeft = rowOffset - Math.floor(brain.getAvailableSize().width / 2);
|
|
2582
|
+
} else if (scrollAdjustPosition === "start") {
|
|
2583
|
+
offset = -offset;
|
|
2584
|
+
scrollLeft += rowOffset - left2 + offset;
|
|
2585
|
+
} else {
|
|
2586
|
+
offset += colWidth;
|
|
2587
|
+
scrollLeft += rowOffset - right + offset;
|
|
2588
|
+
}
|
|
2589
|
+
return __spreadProps(__spreadValues({}, scrollPosition), {
|
|
2590
|
+
scrollLeft
|
|
2591
|
+
});
|
|
2592
|
+
};
|
|
2593
|
+
this.getScrollPositionForScrollCellIntoView = (rowIndex, colIndex, config = { offsetLeft: 0, offsetTop: 0 }) => {
|
|
2594
|
+
const { scrollLeft } = this.getScrollPositionForScrollColumnIntoView(colIndex, {
|
|
2595
|
+
scrollAdjustPosition: config.colScrollAdjustPosition || config.scrollAdjustPosition,
|
|
2596
|
+
offset: config.offsetLeft
|
|
2597
|
+
});
|
|
2598
|
+
const { scrollTop } = this.getScrollPositionForScrollRowIntoView(rowIndex, {
|
|
2599
|
+
scrollAdjustPosition: config.rowScrollAdjustPosition || config.scrollAdjustPosition,
|
|
2600
|
+
offset: config.offsetTop
|
|
2601
|
+
});
|
|
2602
|
+
return { scrollLeft, scrollTop };
|
|
2603
|
+
};
|
|
2604
|
+
this.isRowFullyVisible = (rowIndex, offsetMargin = 2) => {
|
|
2605
|
+
return this.isRowVisible(rowIndex, this.brain.getRowHeight(rowIndex) - offsetMargin);
|
|
2606
|
+
};
|
|
2607
|
+
this.isRowVisible = (rowIndex, offsetMargin = 10) => {
|
|
2608
|
+
if (!this.isRowRendered(rowIndex)) {
|
|
2609
|
+
return false;
|
|
2610
|
+
}
|
|
2611
|
+
const { brain } = this;
|
|
2612
|
+
const {
|
|
2613
|
+
start: [startRow],
|
|
2614
|
+
end: [endRow]
|
|
2615
|
+
} = this.brain.getRenderRange();
|
|
2616
|
+
const midRow = Math.floor((startRow + endRow) / 2);
|
|
2617
|
+
if (rowIndex < startRow) {
|
|
2618
|
+
return false;
|
|
2619
|
+
}
|
|
2620
|
+
if (rowIndex >= endRow) {
|
|
2621
|
+
return false;
|
|
2622
|
+
}
|
|
2623
|
+
if (rowIndex >= midRow) {
|
|
2624
|
+
const lastVisibleRow = brain.getItemAt(brain.getAvailableSize().height + brain.getScrollPosition().scrollTop - offsetMargin, "vertical");
|
|
2625
|
+
return rowIndex <= lastVisibleRow;
|
|
2626
|
+
}
|
|
2627
|
+
if (rowIndex < midRow) {
|
|
2628
|
+
const firstVisibleRow = brain.getItemAt(brain.getScrollPosition().scrollTop + offsetMargin, "vertical");
|
|
2629
|
+
return rowIndex >= firstVisibleRow;
|
|
2630
|
+
}
|
|
2631
|
+
return true;
|
|
2632
|
+
};
|
|
2633
|
+
this.isRowRendered = (rowIndex) => {
|
|
2634
|
+
const elements = this.mappedCells.getElementsForRowIndex(rowIndex);
|
|
2635
|
+
return elements.length > 0;
|
|
2636
|
+
};
|
|
2637
|
+
this.isCellVisible = (rowIndex, colIndex) => {
|
|
2638
|
+
return this.isRowVisible(rowIndex) && this.isColumnVisible(colIndex);
|
|
2639
|
+
};
|
|
2640
|
+
this.isCellFullyVisible = (rowIndex, colIndex) => {
|
|
2641
|
+
return this.isRowFullyVisible(rowIndex) && this.isColumnVisible(colIndex);
|
|
2642
|
+
};
|
|
2643
|
+
this.isColumnFullyVisible = (colIndex, offsetMargin = 2) => {
|
|
2644
|
+
return this.isColumnVisible(colIndex, this.brain.getColWidth(colIndex) - offsetMargin);
|
|
2645
|
+
};
|
|
2646
|
+
this.isColumnVisible = (colIndex, offsetMargin = 10) => {
|
|
2647
|
+
if (!this.isColumnRendered(colIndex)) {
|
|
2648
|
+
return false;
|
|
2649
|
+
}
|
|
2650
|
+
const { brain } = this;
|
|
2651
|
+
const {
|
|
2652
|
+
start: [_, startCol],
|
|
2653
|
+
end: [__, endCol]
|
|
2654
|
+
} = brain.getRenderRange();
|
|
2655
|
+
const midCol = Math.floor((startCol + endCol) / 2);
|
|
2656
|
+
if (colIndex < startCol) {
|
|
2657
|
+
return false;
|
|
2658
|
+
}
|
|
2659
|
+
if (colIndex >= endCol) {
|
|
2660
|
+
return false;
|
|
2661
|
+
}
|
|
2662
|
+
if (colIndex >= midCol) {
|
|
2663
|
+
const lastVisibleCol = brain.getItemAt(brain.getAvailableSize().width + brain.getScrollPosition().scrollLeft - offsetMargin, "horizontal");
|
|
2664
|
+
return colIndex <= lastVisibleCol;
|
|
2665
|
+
}
|
|
2666
|
+
if (colIndex < midCol) {
|
|
2667
|
+
const firstVisibleCol = brain.getItemAt(brain.getScrollPosition().scrollLeft + offsetMargin, "horizontal");
|
|
2668
|
+
return colIndex >= firstVisibleCol;
|
|
2669
|
+
}
|
|
2670
|
+
return true;
|
|
2671
|
+
};
|
|
2672
|
+
this.isCellRendered = (rowIndex, colIndex) => {
|
|
2673
|
+
return this.isRowRendered(rowIndex) && this.isColumnRendered(colIndex);
|
|
2674
|
+
};
|
|
2675
|
+
this.isColumnRendered = (colIndex) => {
|
|
2676
|
+
const {
|
|
2677
|
+
start: [startRow]
|
|
2678
|
+
} = this.brain.getRenderRange();
|
|
2679
|
+
return this.mappedCells.getRenderedNodeForCell(startRow, colIndex) !== null;
|
|
2680
|
+
};
|
|
2510
2681
|
this.getExtraSpanCellsForRange = (range) => {
|
|
2511
2682
|
const { start, end } = range;
|
|
2512
2683
|
const [startRow, startCol] = start;
|
|
@@ -2769,6 +2940,9 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2769
2940
|
});
|
|
2770
2941
|
};
|
|
2771
2942
|
this.onMouseLeave = (rowIndex) => {
|
|
2943
|
+
if (this.currentHoveredRow != -1 && this.currentHoveredRow === rowIndex) {
|
|
2944
|
+
this.removeHoverClass(rowIndex);
|
|
2945
|
+
}
|
|
2772
2946
|
this.currentHoveredRow = -1;
|
|
2773
2947
|
if (this.scrolling) {
|
|
2774
2948
|
return;
|
|
@@ -2843,9 +3017,6 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2843
3017
|
};
|
|
2844
3018
|
this.onScrollStart = () => {
|
|
2845
3019
|
this.scrolling = true;
|
|
2846
|
-
if (this.currentHoveredRow != -1) {
|
|
2847
|
-
this.removeHoverClass(this.currentHoveredRow);
|
|
2848
|
-
}
|
|
2849
3020
|
};
|
|
2850
3021
|
this.onScrollStop = () => {
|
|
2851
3022
|
this.scrolling = false;
|
|
@@ -3083,8 +3254,11 @@ function createRenderer(brain) {
|
|
|
3083
3254
|
function RawTableFn(props) {
|
|
3084
3255
|
const { brain, renderCell } = props;
|
|
3085
3256
|
const { renderer, onRenderUpdater } = (0, import_react7.useMemo)(() => {
|
|
3086
|
-
return
|
|
3087
|
-
|
|
3257
|
+
return props.onRenderUpdater && props.renderer ? {
|
|
3258
|
+
renderer: props.renderer,
|
|
3259
|
+
onRenderUpdater: props.onRenderUpdater
|
|
3260
|
+
} : createRenderer(brain);
|
|
3261
|
+
}, [brain, props.onRenderUpdater, props.renderer]);
|
|
3088
3262
|
(0, import_react7.useEffect)(() => {
|
|
3089
3263
|
renderer.cellHoverClassNames = props.cellHoverClassNames || [];
|
|
3090
3264
|
}, [renderer, props.cellHoverClassNames]);
|
|
@@ -3118,6 +3292,144 @@ function RawTableFn(props) {
|
|
|
3118
3292
|
}
|
|
3119
3293
|
var RawTable = React9.memo(RawTableFn);
|
|
3120
3294
|
|
|
3295
|
+
// src/components/InfiniteTable/components/ActiveRowIndicator.tsx
|
|
3296
|
+
var React10 = __toModule(require("react"));
|
|
3297
|
+
var import_react9 = __toModule(require("react"));
|
|
3298
|
+
|
|
3299
|
+
// src/components/hooks/useRerender.ts
|
|
3300
|
+
var import_react8 = __toModule(require("react"));
|
|
3301
|
+
var useRerender = () => {
|
|
3302
|
+
const [state, setState] = (0, import_react8.useState)(0);
|
|
3303
|
+
return [
|
|
3304
|
+
state,
|
|
3305
|
+
(0, import_react8.useCallback)(() => {
|
|
3306
|
+
setState((state2) => state2 + 1);
|
|
3307
|
+
}, [setState])
|
|
3308
|
+
];
|
|
3309
|
+
};
|
|
3310
|
+
|
|
3311
|
+
// src/components/InfiniteTable/internalProps.ts
|
|
3312
|
+
var rootClassName2 = "Infinite";
|
|
3313
|
+
var internalProps = {
|
|
3314
|
+
rootClassName: rootClassName2
|
|
3315
|
+
};
|
|
3316
|
+
|
|
3317
|
+
// src/components/InfiniteTable/components/ActiveRowIndicator.css.ts
|
|
3318
|
+
var ActiveRowIndicatorCls = { visible: "j26lrx1 j26lrx0 _16lm1iwe _16lm1iw3 _16lm1iwt _16lm1iwu _16lm1iww", hidden: "j26lrx2 j26lrx0 _16lm1iwe _16lm1iw3 _16lm1iwt _16lm1iwu _16lm1iww" };
|
|
3319
|
+
|
|
3320
|
+
// src/components/InfiniteTable/components/ActiveRowIndicator.tsx
|
|
3321
|
+
var { rootClassName: rootClassName3 } = internalProps;
|
|
3322
|
+
var baseCls = `${rootClassName3}-ActiveRowIndicator`;
|
|
3323
|
+
var ActiveRowIndicatorFn = (props) => {
|
|
3324
|
+
const { brain } = props;
|
|
3325
|
+
const [state, setState] = (0, import_react9.useState)({
|
|
3326
|
+
top: 0,
|
|
3327
|
+
rowHeight: 0
|
|
3328
|
+
});
|
|
3329
|
+
const domRef = (0, import_react9.useRef)(null);
|
|
3330
|
+
const stateRef = (0, import_react9.useRef)(state);
|
|
3331
|
+
const active = props.activeRowIndex != null && brain.getRowCount() > props.activeRowIndex;
|
|
3332
|
+
const [rerenderId, rerender] = useRerender();
|
|
3333
|
+
(0, import_react9.useLayoutEffect)(() => {
|
|
3334
|
+
if (props.activeRowIndex == null) {
|
|
3335
|
+
return;
|
|
3336
|
+
}
|
|
3337
|
+
setState(stateRef.current = {
|
|
3338
|
+
top: brain.getItemOffsetFor(props.activeRowIndex, "vertical"),
|
|
3339
|
+
rowHeight: brain.getRowHeight(props.activeRowIndex)
|
|
3340
|
+
});
|
|
3341
|
+
}, [props.activeRowIndex, rerenderId]);
|
|
3342
|
+
(0, import_react9.useEffect)(() => {
|
|
3343
|
+
const removeOnScroll = brain.onScroll((scrollPos) => {
|
|
3344
|
+
const node = domRef.current;
|
|
3345
|
+
const topOffset = stateRef.current.top;
|
|
3346
|
+
node.style.transform = `translate3d(0px, ${-scrollPos.scrollTop + topOffset}px, 0px)`;
|
|
3347
|
+
});
|
|
3348
|
+
const removeOnRenderCountChange = brain.onRenderCountChange(rerender);
|
|
3349
|
+
return () => {
|
|
3350
|
+
removeOnRenderCountChange();
|
|
3351
|
+
removeOnScroll();
|
|
3352
|
+
};
|
|
3353
|
+
}, [brain]);
|
|
3354
|
+
return /* @__PURE__ */ React10.createElement("div", {
|
|
3355
|
+
ref: domRef,
|
|
3356
|
+
"data-name": "active-row-indicator",
|
|
3357
|
+
className: `${baseCls} ${active ? ActiveRowIndicatorCls.visible : ActiveRowIndicatorCls.hidden}`,
|
|
3358
|
+
style: active ? {
|
|
3359
|
+
transform: `translate3d(0px, ${-brain.getScrollPosition().scrollTop + state.top}px,0)`,
|
|
3360
|
+
height: state.rowHeight
|
|
3361
|
+
} : void 0
|
|
3362
|
+
});
|
|
3363
|
+
};
|
|
3364
|
+
var ActiveRowIndicator = React10.memo(ActiveRowIndicatorFn);
|
|
3365
|
+
|
|
3366
|
+
// src/components/InfiniteTable/components/ActiveCellIndicator.tsx
|
|
3367
|
+
var React11 = __toModule(require("react"));
|
|
3368
|
+
var import_react10 = __toModule(require("react"));
|
|
3369
|
+
|
|
3370
|
+
// src/components/InfiniteTable/components/ActiveCellIndicator.css.ts
|
|
3371
|
+
var ActiveCellIndicatorCls = { visible: "nxbq1c1 nxbq1c0 _16lm1iwe _16lm1iw3 _16lm1iww _16lm1iwu", hidden: "nxbq1c2 nxbq1c0 _16lm1iwe _16lm1iw3 _16lm1iww _16lm1iwu" };
|
|
3372
|
+
|
|
3373
|
+
// src/components/InfiniteTable/components/ActiveCellIndicator.tsx
|
|
3374
|
+
var { rootClassName: rootClassName4 } = internalProps;
|
|
3375
|
+
var baseCls2 = `${rootClassName4}-ActiveCellIndicator`;
|
|
3376
|
+
var ActiveCellIndicatorFn = (props) => {
|
|
3377
|
+
const { brain } = props;
|
|
3378
|
+
const [rerenderId, rerender] = useRerender();
|
|
3379
|
+
const [state, setState] = (0, import_react10.useState)({
|
|
3380
|
+
top: 0,
|
|
3381
|
+
rowHeight: 0,
|
|
3382
|
+
colWidth: 0,
|
|
3383
|
+
left: 0
|
|
3384
|
+
});
|
|
3385
|
+
const domRef = (0, import_react10.useRef)(null);
|
|
3386
|
+
const stateRef = (0, import_react10.useRef)(state);
|
|
3387
|
+
const active = props.activeCellIndex != null && brain.getRowCount() > props.activeCellIndex[0];
|
|
3388
|
+
(0, import_react10.useLayoutEffect)(() => {
|
|
3389
|
+
if (props.activeCellIndex == null) {
|
|
3390
|
+
return;
|
|
3391
|
+
}
|
|
3392
|
+
const rowIndex = props.activeCellIndex[0];
|
|
3393
|
+
setState(stateRef.current = {
|
|
3394
|
+
top: brain.getItemOffsetFor(rowIndex, "vertical"),
|
|
3395
|
+
rowHeight: brain.getRowHeight(rowIndex),
|
|
3396
|
+
left: brain.getItemOffsetFor(props.activeCellIndex[1], "horizontal"),
|
|
3397
|
+
colWidth: brain.getColWidth(props.activeCellIndex[1])
|
|
3398
|
+
});
|
|
3399
|
+
}, [props.activeCellIndex, rerenderId]);
|
|
3400
|
+
(0, import_react10.useEffect)(() => {
|
|
3401
|
+
const removeOnSCroll = brain.onScroll((scrollPos) => {
|
|
3402
|
+
const node = domRef.current;
|
|
3403
|
+
const topOffset = stateRef.current.top;
|
|
3404
|
+
const leftOffset = stateRef.current.left;
|
|
3405
|
+
node.style.transform = `translate3d(${-scrollPos.scrollLeft + leftOffset}px, ${-scrollPos.scrollTop + topOffset}px, 0px)`;
|
|
3406
|
+
});
|
|
3407
|
+
const removeOnRenderCountChange = brain.onRenderCountChange(() => {
|
|
3408
|
+
rerender();
|
|
3409
|
+
});
|
|
3410
|
+
const removeOnAvailableSizeChange = brain.onAvailableSizeChange(() => {
|
|
3411
|
+
rerender();
|
|
3412
|
+
});
|
|
3413
|
+
return () => {
|
|
3414
|
+
removeOnAvailableSizeChange();
|
|
3415
|
+
removeOnRenderCountChange();
|
|
3416
|
+
removeOnSCroll();
|
|
3417
|
+
};
|
|
3418
|
+
}, [brain]);
|
|
3419
|
+
const scrollPosition = brain.getScrollPosition();
|
|
3420
|
+
return /* @__PURE__ */ React11.createElement("div", {
|
|
3421
|
+
ref: domRef,
|
|
3422
|
+
"data-name": "active-cell-indicator",
|
|
3423
|
+
className: `${baseCls2} ${active ? ActiveCellIndicatorCls.visible : ActiveCellIndicatorCls.hidden}`,
|
|
3424
|
+
style: active ? {
|
|
3425
|
+
transform: `translate3d(${-scrollPosition.scrollLeft + state.left}px, ${-scrollPosition.scrollTop + state.top}px,0)`,
|
|
3426
|
+
width: state.colWidth,
|
|
3427
|
+
height: state.rowHeight
|
|
3428
|
+
} : void 0
|
|
3429
|
+
});
|
|
3430
|
+
};
|
|
3431
|
+
var ActiveCellIndicator = React11.memo(ActiveCellIndicatorFn);
|
|
3432
|
+
|
|
3121
3433
|
// src/components/HeadlessTable/index.tsx
|
|
3122
3434
|
function useMatrixBrain(brain, brainOptions, fixedCellsInfo) {
|
|
3123
3435
|
if (fixedCellsInfo && (fixedCellsInfo.fixedColsStart || fixedCellsInfo.fixedColsEnd || fixedCellsInfo.fixedRowsStart || fixedCellsInfo.fixedRowsEnd)) {
|
|
@@ -3145,25 +3457,33 @@ function HeadlessTable(props) {
|
|
|
3145
3457
|
scrollerDOMRef,
|
|
3146
3458
|
scrollStopDelay,
|
|
3147
3459
|
renderCell,
|
|
3148
|
-
cellHoverClassNames
|
|
3460
|
+
cellHoverClassNames,
|
|
3461
|
+
renderer,
|
|
3462
|
+
activeRowIndex,
|
|
3463
|
+
activeCellIndex,
|
|
3464
|
+
onRenderUpdater
|
|
3149
3465
|
} = _a, domProps = __objRest(_a, [
|
|
3150
3466
|
"brain",
|
|
3151
3467
|
"scrollerDOMRef",
|
|
3152
3468
|
"scrollStopDelay",
|
|
3153
3469
|
"renderCell",
|
|
3154
|
-
"cellHoverClassNames"
|
|
3470
|
+
"cellHoverClassNames",
|
|
3471
|
+
"renderer",
|
|
3472
|
+
"activeRowIndex",
|
|
3473
|
+
"activeCellIndex",
|
|
3474
|
+
"onRenderUpdater"
|
|
3155
3475
|
]);
|
|
3156
|
-
const domRef = (0,
|
|
3157
|
-
const [scrollSize, setTotalScrollSize] = (0,
|
|
3476
|
+
const domRef = (0, import_react11.useRef)(null);
|
|
3477
|
+
const [scrollSize, setTotalScrollSize] = (0, import_react11.useState)({
|
|
3158
3478
|
width: 0,
|
|
3159
3479
|
height: 0
|
|
3160
3480
|
});
|
|
3161
|
-
(0,
|
|
3481
|
+
(0, import_react11.useEffect)(() => {
|
|
3162
3482
|
if (scrollStopDelay != null) {
|
|
3163
3483
|
brain.setScrollStopDelay(scrollStopDelay);
|
|
3164
3484
|
}
|
|
3165
3485
|
}, [scrollStopDelay, brain]);
|
|
3166
|
-
(0,
|
|
3486
|
+
(0, import_react11.useEffect)(() => {
|
|
3167
3487
|
var _a2;
|
|
3168
3488
|
const node = (_a2 = domRef.current) == null ? void 0 : _a2.parentNode;
|
|
3169
3489
|
if (!node) {
|
|
@@ -3179,39 +3499,47 @@ function HeadlessTable(props) {
|
|
|
3179
3499
|
const remove = setupResizeObserver(node, onResize);
|
|
3180
3500
|
return remove;
|
|
3181
3501
|
}, []);
|
|
3182
|
-
const onContainerScroll = (0,
|
|
3502
|
+
const onContainerScroll = (0, import_react11.useCallback)((scrollPos) => {
|
|
3183
3503
|
brain.setScrollPosition(scrollPos, (scrollPos2) => {
|
|
3184
3504
|
domRef.current.style.transform = `translate3d(${-scrollPos2.scrollLeft}px, ${-scrollPos2.scrollTop}px, 0px)`;
|
|
3185
3505
|
});
|
|
3186
3506
|
}, [brain]);
|
|
3187
|
-
(0,
|
|
3507
|
+
(0, import_react11.useEffect)(() => {
|
|
3188
3508
|
const removeOnRenderCount = brain.onRenderCountChange(() => {
|
|
3189
3509
|
setTotalScrollSize(brain.getTotalSize());
|
|
3190
3510
|
});
|
|
3191
3511
|
setTotalScrollSize(brain.getTotalSize());
|
|
3192
3512
|
return removeOnRenderCount;
|
|
3193
3513
|
}, [brain]);
|
|
3194
|
-
return /* @__PURE__ */
|
|
3514
|
+
return /* @__PURE__ */ React12.createElement(VirtualScrollContainer, __spreadProps(__spreadValues({
|
|
3195
3515
|
onContainerScroll
|
|
3196
3516
|
}, domProps), {
|
|
3197
3517
|
ref: scrollerDOMRef
|
|
3198
|
-
}), /* @__PURE__ */
|
|
3518
|
+
}), /* @__PURE__ */ React12.createElement("div", {
|
|
3199
3519
|
ref: domRef,
|
|
3200
3520
|
className: scrollTransformTargetCls,
|
|
3201
3521
|
"data-name": "scroll-transform-target"
|
|
3202
|
-
}, /* @__PURE__ */
|
|
3522
|
+
}, /* @__PURE__ */ React12.createElement(RawTable, {
|
|
3523
|
+
renderer,
|
|
3524
|
+
onRenderUpdater,
|
|
3203
3525
|
renderCell,
|
|
3204
3526
|
brain,
|
|
3205
3527
|
cellHoverClassNames
|
|
3206
|
-
})), /* @__PURE__ */
|
|
3528
|
+
})), /* @__PURE__ */ React12.createElement(ActiveRowIndicator, {
|
|
3529
|
+
brain,
|
|
3530
|
+
activeRowIndex
|
|
3531
|
+
}), /* @__PURE__ */ React12.createElement(ActiveCellIndicator, {
|
|
3532
|
+
brain,
|
|
3533
|
+
activeCellIndex
|
|
3534
|
+
}), /* @__PURE__ */ React12.createElement(SpacePlaceholder, {
|
|
3207
3535
|
width: scrollSize.width,
|
|
3208
3536
|
height: scrollSize.height
|
|
3209
3537
|
}));
|
|
3210
3538
|
}
|
|
3211
3539
|
|
|
3212
3540
|
// src/components/hooks/useComponentState/index.tsx
|
|
3213
|
-
var
|
|
3214
|
-
var
|
|
3541
|
+
var React13 = __toModule(require("react"));
|
|
3542
|
+
var import_react14 = __toModule(require("react"));
|
|
3215
3543
|
|
|
3216
3544
|
// src/utils/proxyFnCall.ts
|
|
3217
3545
|
function proxyFn(fn, config) {
|
|
@@ -3254,18 +3582,18 @@ function isControlled(propName, props) {
|
|
|
3254
3582
|
}
|
|
3255
3583
|
|
|
3256
3584
|
// src/components/hooks/useLatest.tsx
|
|
3257
|
-
var
|
|
3585
|
+
var import_react12 = __toModule(require("react"));
|
|
3258
3586
|
function useLatest(value) {
|
|
3259
|
-
const ref = (0,
|
|
3587
|
+
const ref = (0, import_react12.useRef)(value);
|
|
3260
3588
|
ref.current = value;
|
|
3261
|
-
return (0,
|
|
3589
|
+
return (0, import_react12.useCallback)(() => ref.current, []);
|
|
3262
3590
|
}
|
|
3263
3591
|
|
|
3264
3592
|
// src/components/hooks/usePrevious.ts
|
|
3265
|
-
var
|
|
3593
|
+
var import_react13 = __toModule(require("react"));
|
|
3266
3594
|
var usePrevious = (value, initialValue) => {
|
|
3267
|
-
const ref = (0,
|
|
3268
|
-
(0,
|
|
3595
|
+
const ref = (0, import_react13.useRef)(initialValue === void 0 ? value : initialValue);
|
|
3596
|
+
(0, import_react13.useLayoutEffect)(() => {
|
|
3269
3597
|
ref.current = value;
|
|
3270
3598
|
});
|
|
3271
3599
|
return ref.current;
|
|
@@ -3286,7 +3614,7 @@ function getComponentStateContext() {
|
|
|
3286
3614
|
if (ComponentContext) {
|
|
3287
3615
|
return ComponentContext;
|
|
3288
3616
|
}
|
|
3289
|
-
return ComponentContext = (0,
|
|
3617
|
+
return ComponentContext = (0, import_react14.createContext)(null);
|
|
3290
3618
|
}
|
|
3291
3619
|
function getReducerGeneratedActions(dispatch, getState, getProps, propsToForward, allowedControlledPropOverrides, interceptedActions) {
|
|
3292
3620
|
const state = getState();
|
|
@@ -3345,16 +3673,16 @@ function forwardProps(propsToForward, props) {
|
|
|
3345
3673
|
return mappedState;
|
|
3346
3674
|
}
|
|
3347
3675
|
function getComponentStateRoot(config) {
|
|
3348
|
-
return
|
|
3676
|
+
return React13.memo(function ComponentStateRoot(props) {
|
|
3349
3677
|
var _a, _b;
|
|
3350
|
-
const [initialSetupState] = (0,
|
|
3678
|
+
const [initialSetupState] = (0, import_react14.useState)(() => {
|
|
3351
3679
|
return config.initSetupState ? config.initSetupState() : {};
|
|
3352
3680
|
});
|
|
3353
|
-
const propsToStateSetRef = (0,
|
|
3354
|
-
const propsToForward = (0,
|
|
3681
|
+
const propsToStateSetRef = (0, import_react14.useRef)(new Set());
|
|
3682
|
+
const propsToForward = (0, import_react14.useMemo)(() => config.forwardProps ? config.forwardProps(initialSetupState) : {}, [initialSetupState]);
|
|
3355
3683
|
const parentState = (_b = (_a = config.getParentState) == null ? void 0 : _a.call(config)) != null ? _b : null;
|
|
3356
3684
|
const getParentState = useLatest(parentState);
|
|
3357
|
-
const [wholeState] = (0,
|
|
3685
|
+
const [wholeState] = (0, import_react14.useState)(() => {
|
|
3358
3686
|
let mappedState = {};
|
|
3359
3687
|
if (propsToForward) {
|
|
3360
3688
|
mappedState = forwardProps(propsToForward, props);
|
|
@@ -3421,10 +3749,10 @@ function getComponentStateRoot(config) {
|
|
|
3421
3749
|
}) : newState;
|
|
3422
3750
|
return result;
|
|
3423
3751
|
};
|
|
3424
|
-
const [state, dispatch] = (0,
|
|
3752
|
+
const [state, dispatch] = (0, import_react14.useReducer)(theReducer, wholeState);
|
|
3425
3753
|
const getComponentState = useLatest(state);
|
|
3426
3754
|
const { allowedControlledPropOverrides } = config;
|
|
3427
|
-
const actions = (0,
|
|
3755
|
+
const actions = (0, import_react14.useMemo)(() => {
|
|
3428
3756
|
const generatedActions = getReducerGeneratedActions(dispatch, getComponentState, getProps, propsToForward, allowedControlledPropOverrides, config.interceptActions);
|
|
3429
3757
|
return generatedActions;
|
|
3430
3758
|
}, [
|
|
@@ -3433,13 +3761,13 @@ function getComponentStateRoot(config) {
|
|
|
3433
3761
|
allowedControlledPropOverrides
|
|
3434
3762
|
]);
|
|
3435
3763
|
const Context = getComponentStateContext();
|
|
3436
|
-
const contextValue = (0,
|
|
3764
|
+
const contextValue = (0, import_react14.useMemo)(() => ({
|
|
3437
3765
|
componentState: state,
|
|
3438
3766
|
componentActions: actions,
|
|
3439
3767
|
getComponentState
|
|
3440
3768
|
}), [state, actions, getComponentState]);
|
|
3441
3769
|
const prevProps = usePrevious(props);
|
|
3442
|
-
(0,
|
|
3770
|
+
(0, import_react14.useEffect)(() => {
|
|
3443
3771
|
const currentProps = props;
|
|
3444
3772
|
const newMappedState = {};
|
|
3445
3773
|
let newMappedStateCount = 0;
|
|
@@ -3495,24 +3823,18 @@ function getComponentStateRoot(config) {
|
|
|
3495
3823
|
}
|
|
3496
3824
|
}
|
|
3497
3825
|
});
|
|
3498
|
-
return /* @__PURE__ */
|
|
3826
|
+
return /* @__PURE__ */ React13.createElement(Context.Provider, {
|
|
3499
3827
|
value: contextValue
|
|
3500
3828
|
}, props.children);
|
|
3501
3829
|
});
|
|
3502
3830
|
}
|
|
3503
3831
|
function useComponentState() {
|
|
3504
3832
|
const Context = getComponentStateContext();
|
|
3505
|
-
return
|
|
3833
|
+
return React13.useContext(Context);
|
|
3506
3834
|
}
|
|
3507
3835
|
|
|
3508
3836
|
// src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx
|
|
3509
|
-
var
|
|
3510
|
-
|
|
3511
|
-
// src/components/InfiniteTable/internalProps.ts
|
|
3512
|
-
var rootClassName2 = "Infinite";
|
|
3513
|
-
var internalProps = {
|
|
3514
|
-
rootClassName: rootClassName2
|
|
3515
|
-
};
|
|
3837
|
+
var React14 = __toModule(require("react"));
|
|
3516
3838
|
|
|
3517
3839
|
// src/components/InfiniteTable/hooks/useInternalProps.ts
|
|
3518
3840
|
var useInternalProps = () => {
|
|
@@ -3520,159 +3842,185 @@ var useInternalProps = () => {
|
|
|
3520
3842
|
};
|
|
3521
3843
|
|
|
3522
3844
|
// src/components/InfiniteTable/utilities.css.ts
|
|
3523
|
-
var alignItems = { center: "
|
|
3524
|
-
var cssEllipsisClassName = "
|
|
3845
|
+
var alignItems = { center: "_16lm1iw14", stretch: "_16lm1iw15" };
|
|
3846
|
+
var cssEllipsisClassName = "_16lm1iw1d _16lm1iw1e _16lm1iw19";
|
|
3525
3847
|
var cursor = { pointer: "_16lm1iwd" };
|
|
3526
|
-
var display = { flex: "
|
|
3527
|
-
var flex = { "1": "
|
|
3528
|
-
var
|
|
3529
|
-
var
|
|
3530
|
-
var
|
|
3848
|
+
var display = { flex: "_16lm1iwm", block: "_16lm1iwn", inlineBlock: "_16lm1iwo" };
|
|
3849
|
+
var flex = { "1": "_16lm1iwf", none: "_16lm1iwg" };
|
|
3850
|
+
var flexFlow = { column: "_16lm1iw12", row: "_16lm1iw13" };
|
|
3851
|
+
var justifyContent = { center: "_16lm1iw16", start: "_16lm1iw17", end: "_16lm1iw18" };
|
|
3852
|
+
var left = { "0": "_16lm1iww", "100%": "_16lm1iwx" };
|
|
3853
|
+
var overflow = { hidden: "_16lm1iw19", auto: "_16lm1iw1a", visible: "_16lm1iw1b" };
|
|
3531
3854
|
var position = { relative: "_16lm1iw1", absolute: "_16lm1iw2", sticky: "_16lm1iw3", fixed: "_16lm1iw4" };
|
|
3532
|
-
var top = { "0": "
|
|
3855
|
+
var top = { "0": "_16lm1iwu", "100%": "_16lm1iwv" };
|
|
3533
3856
|
var transformTranslateZero = "_16lm1iwa";
|
|
3534
|
-
var userSelect = { none: "
|
|
3535
|
-
var zIndex = { "1": "
|
|
3857
|
+
var userSelect = { none: "_16lm1iwp" };
|
|
3858
|
+
var zIndex = { "1": "_16lm1iwh", "10": "_16lm1iwi", "1000": "_16lm1iwj", "10000": "_16lm1iwk", "100000": "_16lm1iwl" };
|
|
3536
3859
|
|
|
3537
3860
|
// src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx
|
|
3538
|
-
var InfiniteTableBody =
|
|
3539
|
-
const { rootClassName:
|
|
3540
|
-
return /* @__PURE__ */
|
|
3861
|
+
var InfiniteTableBody = React14.forwardRef(function InfiniteTableBody2(props, ref) {
|
|
3862
|
+
const { rootClassName: rootClassName11 } = useInternalProps();
|
|
3863
|
+
return /* @__PURE__ */ React14.createElement("div", __spreadProps(__spreadValues({
|
|
3541
3864
|
ref
|
|
3542
3865
|
}, props), {
|
|
3543
|
-
className: join(`${
|
|
3866
|
+
className: join(`${rootClassName11}Body`, position.relative, flex["1"], transformTranslateZero, props.className)
|
|
3544
3867
|
}));
|
|
3545
3868
|
});
|
|
3546
3869
|
|
|
3547
|
-
// src/components/InfiniteTable/components/
|
|
3870
|
+
// src/components/InfiniteTable/components/InfiniteTableFooter/InfiniteTableFooter.tsx
|
|
3548
3871
|
var React15 = __toModule(require("react"));
|
|
3872
|
+
var InfiniteTableFooter = React15.forwardRef(function InfiniteTableFooter2(props, ref) {
|
|
3873
|
+
const { rootClassName: rootClassName11 } = useInternalProps();
|
|
3874
|
+
return /* @__PURE__ */ React15.createElement("div", __spreadProps(__spreadValues({
|
|
3875
|
+
ref
|
|
3876
|
+
}, props), {
|
|
3877
|
+
className: join(`${rootClassName11}Footer`, position.relative, display.flex, flexFlow.row, props.className)
|
|
3878
|
+
}));
|
|
3879
|
+
});
|
|
3880
|
+
|
|
3881
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
|
|
3882
|
+
var React20 = __toModule(require("react"));
|
|
3883
|
+
var import_react22 = __toModule(require("react"));
|
|
3549
3884
|
var import_react_dom = __toModule(require("react-dom"));
|
|
3550
|
-
var import_react17 = __toModule(require("react"));
|
|
3551
3885
|
|
|
3552
|
-
// src/components/
|
|
3553
|
-
|
|
3886
|
+
// src/components/DataSource/defaultFilterTypes.ts
|
|
3887
|
+
function getFilterTypes() {
|
|
3888
|
+
const result = {
|
|
3889
|
+
string: {
|
|
3890
|
+
label: "Text",
|
|
3891
|
+
emptyValues: new Set([""]),
|
|
3892
|
+
defaultOperator: "contains",
|
|
3893
|
+
operators: [
|
|
3894
|
+
{
|
|
3895
|
+
name: "contains",
|
|
3896
|
+
fn: ({ currentValue, filterValue, emptyValues }) => {
|
|
3897
|
+
if (emptyValues.has(currentValue) || emptyValues.has(filterValue)) {
|
|
3898
|
+
return true;
|
|
3899
|
+
}
|
|
3900
|
+
return typeof currentValue === "string" && typeof filterValue == "string" && currentValue.toLowerCase().includes(filterValue.toLowerCase());
|
|
3901
|
+
}
|
|
3902
|
+
},
|
|
3903
|
+
{
|
|
3904
|
+
name: "eq",
|
|
3905
|
+
fn: ({ currentValue: value, filterValue, emptyValues }) => {
|
|
3906
|
+
if (emptyValues.has(value) || emptyValues.has(filterValue)) {
|
|
3907
|
+
return true;
|
|
3908
|
+
}
|
|
3909
|
+
return typeof value === "string" && value === filterValue;
|
|
3910
|
+
}
|
|
3911
|
+
}
|
|
3912
|
+
]
|
|
3913
|
+
},
|
|
3914
|
+
number: {
|
|
3915
|
+
label: "Number",
|
|
3916
|
+
emptyValues: new Set(["", null, void 0]),
|
|
3917
|
+
defaultOperator: "eq",
|
|
3918
|
+
operators: [
|
|
3919
|
+
{
|
|
3920
|
+
name: "eq",
|
|
3921
|
+
fn: ({ currentValue, filterValue, emptyValues }) => {
|
|
3922
|
+
if (emptyValues.has(currentValue) || emptyValues.has(filterValue)) {
|
|
3923
|
+
return true;
|
|
3924
|
+
}
|
|
3925
|
+
return currentValue == filterValue;
|
|
3926
|
+
}
|
|
3927
|
+
},
|
|
3928
|
+
{
|
|
3929
|
+
name: "between",
|
|
3930
|
+
fn: ({ currentValue, filterValue, emptyValues }) => {
|
|
3931
|
+
if (emptyValues.has(currentValue) || emptyValues.has(filterValue)) {
|
|
3932
|
+
return true;
|
|
3933
|
+
}
|
|
3934
|
+
const [min, max] = filterValue;
|
|
3935
|
+
return currentValue >= min && currentValue <= max;
|
|
3936
|
+
}
|
|
3937
|
+
}
|
|
3938
|
+
]
|
|
3939
|
+
}
|
|
3940
|
+
};
|
|
3941
|
+
return result;
|
|
3942
|
+
}
|
|
3943
|
+
var defaultFilterTypes = getFilterTypes();
|
|
3554
3944
|
|
|
3555
|
-
// src/components/InfiniteTable/hooks/
|
|
3556
|
-
|
|
3945
|
+
// src/components/InfiniteTable/hooks/useCellClassName.ts
|
|
3946
|
+
function useCellClassName(column, baseClasses, variants, extraFlags) {
|
|
3947
|
+
const result = [...baseClasses];
|
|
3948
|
+
const variantObject = {
|
|
3949
|
+
filtered: column.computedFiltered,
|
|
3950
|
+
first: column.computedFirst,
|
|
3951
|
+
last: column.computedLast,
|
|
3952
|
+
groupByField: !!column.groupByField,
|
|
3953
|
+
firstInCategory: column.computedFirstInCategory,
|
|
3954
|
+
lastInCategory: column.computedLastInCategory,
|
|
3955
|
+
pinned: column.computedPinned || false,
|
|
3956
|
+
rowActive: extraFlags.rowActive,
|
|
3957
|
+
dragging: extraFlags.dragging,
|
|
3958
|
+
zebra: extraFlags.zebra
|
|
3959
|
+
};
|
|
3960
|
+
const theVariant = variants(variantObject);
|
|
3961
|
+
result.push(theVariant);
|
|
3962
|
+
if (column.computedFirst) {
|
|
3963
|
+
result.push(...baseClasses.map((c) => `${c}--first`));
|
|
3964
|
+
}
|
|
3965
|
+
if (column.groupByField) {
|
|
3966
|
+
result.push(...baseClasses.map((c) => `${c}--group-column`));
|
|
3967
|
+
}
|
|
3968
|
+
if (column.computedLast) {
|
|
3969
|
+
result.push(...baseClasses.map((c) => `${c}--last`));
|
|
3970
|
+
}
|
|
3971
|
+
if (column.computedFirstInCategory) {
|
|
3972
|
+
result.push(...baseClasses.map((c) => `${c}--first-in-category`));
|
|
3973
|
+
}
|
|
3974
|
+
if (column.computedLastInCategory) {
|
|
3975
|
+
result.push(...baseClasses.map((c) => `${c}--last-in-category`));
|
|
3976
|
+
}
|
|
3977
|
+
if (column.computedPinned) {
|
|
3978
|
+
result.push(...baseClasses.map((c) => `${c}--pinned-${column.computedPinned}`));
|
|
3979
|
+
} else {
|
|
3980
|
+
result.push(...baseClasses.map((c) => `${c}--unpinned`));
|
|
3981
|
+
}
|
|
3982
|
+
return result.filter(Boolean).join(" ");
|
|
3983
|
+
}
|
|
3984
|
+
|
|
3985
|
+
// src/components/InfiniteTable/hooks/useColumnPointerEvents.ts
|
|
3986
|
+
var import_binary_search2 = __toModule(require_binary_search());
|
|
3987
|
+
var import_react17 = __toModule(require("react"));
|
|
3988
|
+
|
|
3989
|
+
// src/components/InfiniteTable/hooks/useInfiniteTable.ts
|
|
3990
|
+
var import_react16 = __toModule(require("react"));
|
|
3557
3991
|
|
|
3558
3992
|
// src/components/InfiniteTable/InfiniteTableContext.ts
|
|
3559
|
-
var
|
|
3993
|
+
var import_react15 = __toModule(require("react"));
|
|
3560
3994
|
var TableContext;
|
|
3561
3995
|
function getInfiniteTableContext() {
|
|
3562
3996
|
if (TableContext) {
|
|
3563
3997
|
return TableContext;
|
|
3564
3998
|
}
|
|
3565
|
-
return TableContext = (0,
|
|
3999
|
+
return TableContext = (0, import_react15.createContext)(null);
|
|
3566
4000
|
}
|
|
3567
4001
|
|
|
3568
|
-
// src/components/InfiniteTable/hooks/
|
|
3569
|
-
var
|
|
4002
|
+
// src/components/InfiniteTable/hooks/useInfiniteTable.ts
|
|
4003
|
+
var useInfiniteTable = () => {
|
|
3570
4004
|
const TableContext2 = getInfiniteTableContext();
|
|
3571
|
-
|
|
3572
|
-
return componentState;
|
|
4005
|
+
return (0, import_react16.useContext)(TableContext2);
|
|
3573
4006
|
};
|
|
3574
4007
|
|
|
3575
|
-
// src/components/InfiniteTable/
|
|
3576
|
-
var
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
skipColumnShifting = false,
|
|
3592
|
-
offsetProperty = "left",
|
|
3593
|
-
column,
|
|
3594
|
-
domRef,
|
|
3595
|
-
width,
|
|
3596
|
-
afterChildren,
|
|
3597
|
-
beforeChildren,
|
|
3598
|
-
offset,
|
|
3599
|
-
cellType,
|
|
3600
|
-
cssPosition: _cssPosition,
|
|
3601
|
-
renderChildren
|
|
3602
|
-
} = _a, domProps = __objRest(_a, [
|
|
3603
|
-
"cssEllipsis",
|
|
3604
|
-
"virtualized",
|
|
3605
|
-
"skipColumnShifting",
|
|
3606
|
-
"offsetProperty",
|
|
3607
|
-
"column",
|
|
3608
|
-
"domRef",
|
|
3609
|
-
"width",
|
|
3610
|
-
"afterChildren",
|
|
3611
|
-
"beforeChildren",
|
|
3612
|
-
"offset",
|
|
3613
|
-
"cellType",
|
|
3614
|
-
"cssPosition",
|
|
3615
|
-
"renderChildren"
|
|
3616
|
-
]);
|
|
3617
|
-
const children = renderChildren();
|
|
3618
|
-
const { columnShifts } = useInfiniteTableState();
|
|
3619
|
-
const shifting = !!columnShifts;
|
|
3620
|
-
const style = __spreadValues({
|
|
3621
|
-
width
|
|
3622
|
-
}, domProps.style);
|
|
3623
|
-
if (!skipColumnShifting && columnShifts && columnShifts[column.computedVisibleIndex]) {
|
|
3624
|
-
const shiftLeft = columnShifts[column.computedVisibleIndex] + (offset != null ? offset : 0);
|
|
3625
|
-
if (virtualized) {
|
|
3626
|
-
style.left = shiftLeft;
|
|
3627
|
-
} else {
|
|
3628
|
-
style.transform = `translate3d(${shiftLeft}px, 0px, 0px)`;
|
|
3629
|
-
}
|
|
3630
|
-
}
|
|
3631
|
-
const finalDOMProps = __spreadProps(__spreadValues({}, domProps), {
|
|
3632
|
-
style,
|
|
3633
|
-
"data-column-id": column.id,
|
|
3634
|
-
className: join(domProps.className, columnAlignCellStyle[(_b = column.align) != null ? _b : "start"], justifyContent[(_c = column.align) != null ? _c : "start"], InfiniteTableCellClassName, ColumnCellCls, shifting ? `${InfiniteTableCellClassName}--shifting ${CellClsVariants.shifting}` : ""),
|
|
3635
|
-
children: /* @__PURE__ */ React13.createElement(React13.Fragment, null, beforeChildren, /* @__PURE__ */ React13.createElement("div", {
|
|
3636
|
-
className: `${InfiniteTableCellContentClassName} ${cssEllipsis ? cssEllipsisClassName : overflow.hidden}`
|
|
3637
|
-
}, children), afterChildren)
|
|
3638
|
-
});
|
|
3639
|
-
const RenderComponent = cellType === "body" ? (_d = column.components) == null ? void 0 : _d.ColumnCell : (_e = column.components) == null ? void 0 : _e.HeaderCell;
|
|
3640
|
-
if (RenderComponent) {
|
|
3641
|
-
return /* @__PURE__ */ React13.createElement(RenderComponent, __spreadValues({}, finalDOMProps));
|
|
3642
|
-
}
|
|
3643
|
-
return /* @__PURE__ */ React13.createElement("div", __spreadProps(__spreadValues({}, finalDOMProps), {
|
|
3644
|
-
ref: domRef
|
|
3645
|
-
}));
|
|
3646
|
-
}
|
|
3647
|
-
var InfiniteTableCell = React13.memo(InfiniteTableCellFn);
|
|
3648
|
-
|
|
3649
|
-
// src/components/InfiniteTable/hooks/useColumnPointerEvents.ts
|
|
3650
|
-
var import_binary_search2 = __toModule(require_binary_search());
|
|
3651
|
-
var import_react15 = __toModule(require("react"));
|
|
3652
|
-
|
|
3653
|
-
// src/components/InfiniteTable/hooks/useInfiniteTable.ts
|
|
3654
|
-
var import_react14 = __toModule(require("react"));
|
|
3655
|
-
var useInfiniteTable = () => {
|
|
3656
|
-
const TableContext2 = getInfiniteTableContext();
|
|
3657
|
-
return (0, import_react14.useContext)(TableContext2);
|
|
3658
|
-
};
|
|
3659
|
-
|
|
3660
|
-
// src/components/InfiniteTable/utils/moveXatY.ts
|
|
3661
|
-
var moveXatY = (arr, dragIndex, dropIndex) => {
|
|
3662
|
-
arr = [...arr];
|
|
3663
|
-
if (dragIndex === dropIndex || arr[dragIndex] === void 0 || arr[dropIndex] === void 0) {
|
|
3664
|
-
return arr;
|
|
3665
|
-
}
|
|
3666
|
-
const dragItem = arr[dragIndex];
|
|
3667
|
-
if (dropIndex < dragIndex) {
|
|
3668
|
-
arr.splice(dragIndex, 1);
|
|
3669
|
-
arr.splice(dropIndex, 0, dragItem);
|
|
3670
|
-
} else {
|
|
3671
|
-
arr.splice(dragIndex, 1);
|
|
3672
|
-
arr.splice(dropIndex, 0, dragItem);
|
|
3673
|
-
}
|
|
3674
|
-
return arr;
|
|
3675
|
-
};
|
|
4008
|
+
// src/components/InfiniteTable/utils/moveXatY.ts
|
|
4009
|
+
var moveXatY = (arr, dragIndex, dropIndex) => {
|
|
4010
|
+
arr = [...arr];
|
|
4011
|
+
if (dragIndex === dropIndex || arr[dragIndex] === void 0 || arr[dropIndex] === void 0) {
|
|
4012
|
+
return arr;
|
|
4013
|
+
}
|
|
4014
|
+
const dragItem = arr[dragIndex];
|
|
4015
|
+
if (dropIndex < dragIndex) {
|
|
4016
|
+
arr.splice(dragIndex, 1);
|
|
4017
|
+
arr.splice(dropIndex, 0, dragItem);
|
|
4018
|
+
} else {
|
|
4019
|
+
arr.splice(dragIndex, 1);
|
|
4020
|
+
arr.splice(dropIndex, 0, dragItem);
|
|
4021
|
+
}
|
|
4022
|
+
return arr;
|
|
4023
|
+
};
|
|
3676
4024
|
|
|
3677
4025
|
// src/components/InfiniteTable/hooks/useColumnPointerEvents.ts
|
|
3678
4026
|
var getBreakPoints = (columns) => {
|
|
@@ -3689,18 +4037,18 @@ var useColumnPointerEvents = ({
|
|
|
3689
4037
|
columns,
|
|
3690
4038
|
computedRemainingSpace
|
|
3691
4039
|
}) => {
|
|
3692
|
-
const [draggingDiff, setDraggingDiff] = (0,
|
|
3693
|
-
const [proxyOffset, setProxyOffset] = (0,
|
|
3694
|
-
const breakpointsRef = (0,
|
|
3695
|
-
const pointerMoveRef = (0,
|
|
3696
|
-
const didDragRef = (0,
|
|
3697
|
-
const initialClientPos = (0,
|
|
3698
|
-
const currentDropIndexRef = (0,
|
|
4040
|
+
const [draggingDiff, setDraggingDiff] = (0, import_react17.useState)(null);
|
|
4041
|
+
const [proxyOffset, setProxyOffset] = (0, import_react17.useState)(null);
|
|
4042
|
+
const breakpointsRef = (0, import_react17.useRef)([]);
|
|
4043
|
+
const pointerMoveRef = (0, import_react17.useRef)(null);
|
|
4044
|
+
const didDragRef = (0, import_react17.useRef)(false);
|
|
4045
|
+
const initialClientPos = (0, import_react17.useRef)(null);
|
|
4046
|
+
const currentDropIndexRef = (0, import_react17.useRef)(null);
|
|
3699
4047
|
const dragging = draggingDiff != null;
|
|
3700
4048
|
const { componentActions, computed } = useInfiniteTable();
|
|
3701
4049
|
const { computedColumnOrder } = computed;
|
|
3702
|
-
const column = (0,
|
|
3703
|
-
const { columnIndex, columnWidth, columnsArray } = (0,
|
|
4050
|
+
const column = (0, import_react17.useMemo)(() => columns.get(columnId), [columnId, columns]);
|
|
4051
|
+
const { columnIndex, columnWidth, columnsArray } = (0, import_react17.useMemo)(() => {
|
|
3704
4052
|
const columnsArray2 = Array.from(columns.values());
|
|
3705
4053
|
return {
|
|
3706
4054
|
columnsArray: columnsArray2,
|
|
@@ -3708,8 +4056,8 @@ var useColumnPointerEvents = ({
|
|
|
3708
4056
|
columnWidth: column.computedWidth
|
|
3709
4057
|
};
|
|
3710
4058
|
}, [columns, columnId, column]);
|
|
3711
|
-
let cursorRef = (0,
|
|
3712
|
-
const onPointerDown = (0,
|
|
4059
|
+
let cursorRef = (0, import_react17.useRef)("auto");
|
|
4060
|
+
const onPointerDown = (0, import_react17.useCallback)((e) => {
|
|
3713
4061
|
const target = domRef.current;
|
|
3714
4062
|
cursorRef.current = target.style.cursor;
|
|
3715
4063
|
didDragRef.current = false;
|
|
@@ -3772,7 +4120,7 @@ var useColumnPointerEvents = ({
|
|
|
3772
4120
|
target.addEventListener("pointermove", onPointerMove);
|
|
3773
4121
|
target.setPointerCapture(e.pointerId);
|
|
3774
4122
|
}, [columns, column, columnIndex, columnsArray, computedRemainingSpace]);
|
|
3775
|
-
const onPointerUp = (0,
|
|
4123
|
+
const onPointerUp = (0, import_react17.useCallback)((e) => {
|
|
3776
4124
|
const target = domRef.current;
|
|
3777
4125
|
target.style.cursor = cursorRef.current;
|
|
3778
4126
|
target.releasePointerCapture(e.pointerId);
|
|
@@ -3805,47 +4153,69 @@ var useColumnPointerEvents = ({
|
|
|
3805
4153
|
};
|
|
3806
4154
|
};
|
|
3807
4155
|
|
|
3808
|
-
// src/components/InfiniteTable/
|
|
3809
|
-
function
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
4156
|
+
// src/components/InfiniteTable/utils/RenderHookComponent.tsx
|
|
4157
|
+
function RenderHookComponent(props) {
|
|
4158
|
+
var _a;
|
|
4159
|
+
return (_a = props.render(props.renderParam)) != null ? _a : null;
|
|
4160
|
+
}
|
|
4161
|
+
|
|
4162
|
+
// src/components/InfiniteTable/components/FilterEditors.tsx
|
|
4163
|
+
var import_react18 = __toModule(require("react"));
|
|
4164
|
+
function getFilterEditors() {
|
|
4165
|
+
return {
|
|
4166
|
+
string: StringFilterEditor,
|
|
4167
|
+
number: NumberFilterEditor
|
|
3820
4168
|
};
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
4169
|
+
}
|
|
4170
|
+
var defaultFilterEditors = getFilterEditors();
|
|
4171
|
+
function StringFilterEditor(props) {
|
|
4172
|
+
return /* @__PURE__ */ import_react18.default.createElement("input", {
|
|
4173
|
+
"aria-label": `Filter for ${props.ariaLabel}`,
|
|
4174
|
+
type: "text",
|
|
4175
|
+
value: props.filterValue,
|
|
4176
|
+
onChange: (event) => {
|
|
4177
|
+
props.onChange(event.target.value);
|
|
4178
|
+
},
|
|
4179
|
+
className: props.className
|
|
4180
|
+
});
|
|
4181
|
+
}
|
|
4182
|
+
function NumberFilterEditor(props) {
|
|
4183
|
+
return /* @__PURE__ */ import_react18.default.createElement("input", {
|
|
4184
|
+
"aria-label": `Filter for ${props.ariaLabel}`,
|
|
4185
|
+
type: "number",
|
|
4186
|
+
value: props.filterValue,
|
|
4187
|
+
onChange: (event) => {
|
|
4188
|
+
let value = event.target.value;
|
|
4189
|
+
if (!isNaN(value + "")) {
|
|
4190
|
+
value = value + "";
|
|
4191
|
+
}
|
|
4192
|
+
props.onChange(value);
|
|
4193
|
+
},
|
|
4194
|
+
className: props.className
|
|
4195
|
+
});
|
|
3844
4196
|
}
|
|
3845
4197
|
|
|
3846
4198
|
// src/components/InfiniteTable/components/icons/SortIcon.tsx
|
|
3847
|
-
var
|
|
3848
|
-
var
|
|
4199
|
+
var React17 = __toModule(require("react"));
|
|
4200
|
+
var import_react19 = __toModule(require("react"));
|
|
4201
|
+
|
|
4202
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts
|
|
4203
|
+
var import_createRuntimeFn = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
4204
|
+
var CellCls = "_1eexc2a5 _16lm1iwm _16lm1iw13 _16lm1iw14 _16lm1iw2 _16lm1iw1c _16lm1iw1d";
|
|
4205
|
+
var HeaderCellContentRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_12zfob117 _16lm1iwr _16lm1iwt _16lm1iwm _16lm1iw13 _16lm1iw14", variantClassNames: { filtered: { false: "_12zfob118", true: "_12zfob119" } }, defaultVariants: {}, compoundVariants: [] });
|
|
4206
|
+
var HeaderCellProxy = "_12zfob10";
|
|
4207
|
+
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"]] });
|
|
4208
|
+
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"]] });
|
|
4209
|
+
var HeaderFilterCls = "_12zfob11c _16lm1iwm _16lm1iw13 _16lm1iw14 _16lm1iw1";
|
|
4210
|
+
var HeaderFilterEditorCls = "_16lm1iwt _16lm1iwr";
|
|
4211
|
+
var HeaderGroupCls = "_12zfob11b _16lm1iwm _16lm1iw13 _16lm1iw14";
|
|
4212
|
+
var HeaderScrollbarPlaceholderCls = "_12zfob16 _16lm1iw2";
|
|
4213
|
+
var HeaderSortIconCls = "_16lm1iw1";
|
|
4214
|
+
var HeaderSortIconIndexCls = "_12zfob15";
|
|
4215
|
+
var HeaderSortIconRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "", variantClassNames: { align: { start: "_12zfob12", center: "_12zfob13", end: "_12zfob14" } }, defaultVariants: {}, compoundVariants: [] });
|
|
4216
|
+
var HeaderWrapperCls = "_12zfob11a _16lm1iw19 _16lm1iw1 _16lm1iwm _16lm1iw13";
|
|
4217
|
+
|
|
4218
|
+
// src/components/InfiniteTable/components/icons/SortIcon.tsx
|
|
3849
4219
|
var defaultLineStyle = {
|
|
3850
4220
|
marginTop: 2,
|
|
3851
4221
|
marginBottom: 2,
|
|
@@ -3854,8 +4224,8 @@ var defaultLineStyle = {
|
|
|
3854
4224
|
var InfiniteTableIconClassName = "InfiniteTableIcon";
|
|
3855
4225
|
function SortIcon(props) {
|
|
3856
4226
|
var _a;
|
|
3857
|
-
const [rendered, setRendered] = (0,
|
|
3858
|
-
const [opacity, setOpacity] = (0,
|
|
4227
|
+
const [rendered, setRendered] = (0, import_react19.useState)(true);
|
|
4228
|
+
const [opacity, setOpacity] = (0, import_react19.useState)(0);
|
|
3859
4229
|
const { direction, lineWidth = 1, style, className, index } = props;
|
|
3860
4230
|
const showIndex = index != null && index > 0;
|
|
3861
4231
|
const size = (_a = props.size) != null ? _a : 16;
|
|
@@ -3869,16 +4239,21 @@ function SortIcon(props) {
|
|
|
3869
4239
|
}), props.lineStyle), {
|
|
3870
4240
|
opacity
|
|
3871
4241
|
});
|
|
3872
|
-
(0,
|
|
4242
|
+
(0, import_react19.useEffect)(() => {
|
|
3873
4243
|
const newOpacity = direction != 0 ? 1 : 0;
|
|
3874
4244
|
if (!rendered && newOpacity) {
|
|
3875
4245
|
setRendered(true);
|
|
3876
4246
|
}
|
|
3877
4247
|
if (newOpacity !== opacity) {
|
|
3878
|
-
requestAnimationFrame(() => {
|
|
4248
|
+
const rafId = requestAnimationFrame(() => {
|
|
3879
4249
|
setOpacity(newOpacity);
|
|
3880
4250
|
});
|
|
4251
|
+
return () => {
|
|
4252
|
+
cancelAnimationFrame(rafId);
|
|
4253
|
+
};
|
|
3881
4254
|
}
|
|
4255
|
+
return () => {
|
|
4256
|
+
};
|
|
3882
4257
|
}, [direction, rendered]);
|
|
3883
4258
|
const onTransitionEnd = () => {
|
|
3884
4259
|
const hidden = opacity === 0 && direction === 0;
|
|
@@ -3890,91 +4265,225 @@ function SortIcon(props) {
|
|
|
3890
4265
|
if (!rendered) {
|
|
3891
4266
|
return null;
|
|
3892
4267
|
}
|
|
3893
|
-
const indexStyle = {
|
|
3894
|
-
position: "absolute",
|
|
3895
|
-
transition: "top 0.2s",
|
|
3896
|
-
top: 0,
|
|
3897
|
-
right: 2
|
|
3898
|
-
};
|
|
4268
|
+
const indexStyle = {};
|
|
3899
4269
|
if (direction === -1) {
|
|
3900
4270
|
indexStyle.top = "100%";
|
|
3901
4271
|
}
|
|
3902
|
-
return /* @__PURE__ */
|
|
4272
|
+
return /* @__PURE__ */ React17.createElement("div", {
|
|
3903
4273
|
style: __spreadProps(__spreadValues({}, style), { width: size }),
|
|
3904
4274
|
className: join(className, InfiniteTableIconClassName, `${InfiniteTableIconClassName}-sort`)
|
|
3905
|
-
}, showIndex ? /* @__PURE__ */
|
|
4275
|
+
}, showIndex ? /* @__PURE__ */ React17.createElement("div", {
|
|
3906
4276
|
"data-name": "index",
|
|
3907
|
-
style: indexStyle
|
|
3908
|
-
|
|
4277
|
+
style: indexStyle,
|
|
4278
|
+
className: HeaderSortIconIndexCls
|
|
4279
|
+
}, index) : null, /* @__PURE__ */ React17.createElement("div", {
|
|
3909
4280
|
style: __spreadValues({ width: sizes[0] }, lineStyle),
|
|
3910
4281
|
onTransitionEnd
|
|
3911
|
-
}), /* @__PURE__ */
|
|
4282
|
+
}), /* @__PURE__ */ React17.createElement("div", {
|
|
3912
4283
|
style: __spreadValues({ width: sizes[1] }, lineStyle)
|
|
3913
|
-
}), /* @__PURE__ */
|
|
4284
|
+
}), /* @__PURE__ */ React17.createElement("div", {
|
|
3914
4285
|
style: __spreadValues({ width: sizes[2] }, lineStyle)
|
|
3915
4286
|
}));
|
|
3916
4287
|
}
|
|
3917
4288
|
|
|
3918
|
-
// src/components/InfiniteTable/components/
|
|
4289
|
+
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
|
|
4290
|
+
var React18 = __toModule(require("react"));
|
|
4291
|
+
|
|
4292
|
+
// src/components/InfiniteTable/hooks/useInfiniteTableState.ts
|
|
4293
|
+
var import_react20 = __toModule(require("react"));
|
|
4294
|
+
var useInfiniteTableState = () => {
|
|
4295
|
+
const TableContext2 = getInfiniteTableContext();
|
|
4296
|
+
const { componentState } = (0, import_react20.useContext)(TableContext2);
|
|
4297
|
+
return componentState;
|
|
4298
|
+
};
|
|
4299
|
+
|
|
4300
|
+
// src/components/InfiniteTable/components/cell.css.ts
|
|
3919
4301
|
var import_createRuntimeFn2 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
3920
|
-
var
|
|
3921
|
-
var
|
|
3922
|
-
var
|
|
3923
|
-
var HeaderClsRecipe = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "_12zfob13 _16lm1iw12 _16lm1iw2", variantClassNames: { pinned: { start: "_12zfob14", end: "_12zfob15", false: "_12zfob16" }, virtualized: { true: "_12zfob17", false: "_12zfob18" }, overflow: { true: "_12zfob19", false: "_12zfob1a" } }, defaultVariants: {}, compoundVariants: [[{ overflow: true, pinned: "start" }, "_12zfob1b"], [{ overflow: true, pinned: "end" }, "_12zfob1c"]] });
|
|
3924
|
-
var HeaderGroupCls = "_12zfob110 _16lm1iwl _16lm1iw12 _16lm1iw13";
|
|
3925
|
-
var HeaderScrollbarPlaceholderCls = "_12zfob12 _16lm1iw2";
|
|
3926
|
-
var HeaderSortIconCls = "_12zfob11 _16lm1iw1";
|
|
3927
|
-
var HeaderWrapperCls = "_12zfob1z _16lm1iw18 _16lm1iw1 _16lm1iwl _16lm1iw12";
|
|
4302
|
+
var CellClsVariants = { shifting: "_1eexc2a3", dragging: "_1eexc2a4" };
|
|
4303
|
+
var ColumnCellCls = "_1eexc2a5 _16lm1iwm _16lm1iw13 _16lm1iw14 _16lm1iw2 _16lm1iw1c _16lm1iw1d";
|
|
4304
|
+
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"]] });
|
|
3928
4305
|
|
|
3929
|
-
// src/components/InfiniteTable/
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
4306
|
+
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
|
|
4307
|
+
var { rootClassName: rootClassName5 } = internalProps;
|
|
4308
|
+
var InfiniteTableCellClassName = `${rootClassName5}Cell`;
|
|
4309
|
+
var InfiniteTableCellContentClassName = `${rootClassName5}Cell_content`;
|
|
4310
|
+
function InfiniteTableCellFn(props) {
|
|
4311
|
+
var _b, _c, _d;
|
|
4312
|
+
const _a = props, {
|
|
4313
|
+
cssEllipsis = true,
|
|
4314
|
+
virtualized = true,
|
|
4315
|
+
skipColumnShifting = false,
|
|
4316
|
+
offsetProperty = "left",
|
|
4317
|
+
contentStyle,
|
|
4318
|
+
column,
|
|
4319
|
+
domRef,
|
|
4320
|
+
width,
|
|
4321
|
+
contentClassName,
|
|
4322
|
+
afterChildren,
|
|
4323
|
+
beforeChildren,
|
|
4324
|
+
offset,
|
|
4325
|
+
cellType,
|
|
4326
|
+
cssPosition: _cssPosition,
|
|
4327
|
+
renderChildren
|
|
4328
|
+
} = _a, domProps = __objRest(_a, [
|
|
4329
|
+
"cssEllipsis",
|
|
4330
|
+
"virtualized",
|
|
4331
|
+
"skipColumnShifting",
|
|
4332
|
+
"offsetProperty",
|
|
4333
|
+
"contentStyle",
|
|
4334
|
+
"column",
|
|
4335
|
+
"domRef",
|
|
4336
|
+
"width",
|
|
4337
|
+
"contentClassName",
|
|
4338
|
+
"afterChildren",
|
|
4339
|
+
"beforeChildren",
|
|
4340
|
+
"offset",
|
|
4341
|
+
"cellType",
|
|
4342
|
+
"cssPosition",
|
|
4343
|
+
"renderChildren"
|
|
4344
|
+
]);
|
|
4345
|
+
const children = renderChildren();
|
|
4346
|
+
const { columnShifts } = useInfiniteTableState();
|
|
4347
|
+
const shifting = !!columnShifts;
|
|
4348
|
+
const style = __spreadValues({
|
|
4349
|
+
width
|
|
4350
|
+
}, domProps.style);
|
|
4351
|
+
if (!skipColumnShifting && columnShifts && columnShifts[column.computedVisibleIndex]) {
|
|
4352
|
+
const shiftLeft = columnShifts[column.computedVisibleIndex] + (offset != null ? offset : 0);
|
|
4353
|
+
if (virtualized) {
|
|
4354
|
+
style.left = shiftLeft;
|
|
4355
|
+
} else {
|
|
4356
|
+
style.transform = `translate3d(${shiftLeft}px, 0px, 0px)`;
|
|
4357
|
+
}
|
|
4358
|
+
}
|
|
4359
|
+
const finalDOMProps = __spreadProps(__spreadValues({}, domProps), {
|
|
4360
|
+
style,
|
|
4361
|
+
"data-column-id": column.id,
|
|
4362
|
+
className: join(domProps.className, justifyContent[(_b = column.align) != null ? _b : "start"], InfiniteTableCellClassName, ColumnCellCls, shifting ? `${InfiniteTableCellClassName}--shifting ${CellClsVariants.shifting}` : ""),
|
|
4363
|
+
children: /* @__PURE__ */ React18.createElement(React18.Fragment, null, beforeChildren, /* @__PURE__ */ React18.createElement("div", {
|
|
4364
|
+
className: join(InfiniteTableCellContentClassName, cssEllipsis ? cssEllipsisClassName : overflow.hidden, contentClassName),
|
|
4365
|
+
style: contentStyle
|
|
4366
|
+
}, children), afterChildren)
|
|
4367
|
+
});
|
|
4368
|
+
const RenderComponent = cellType === "body" ? (_c = column.components) == null ? void 0 : _c.ColumnCell : (_d = column.components) == null ? void 0 : _d.HeaderCell;
|
|
4369
|
+
if (RenderComponent) {
|
|
4370
|
+
return /* @__PURE__ */ React18.createElement(RenderComponent, __spreadValues({}, finalDOMProps));
|
|
4371
|
+
}
|
|
4372
|
+
return /* @__PURE__ */ React18.createElement("div", __spreadProps(__spreadValues({}, finalDOMProps), {
|
|
4373
|
+
ref: domRef
|
|
4374
|
+
}));
|
|
4375
|
+
}
|
|
4376
|
+
var InfiniteTableCell = React18.memo(InfiniteTableCellFn);
|
|
4377
|
+
|
|
4378
|
+
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableColumnHeaderFilter.tsx
|
|
4379
|
+
var React19 = __toModule(require("react"));
|
|
4380
|
+
var import_react21 = __toModule(require("react"));
|
|
4381
|
+
var { rootClassName: rootClassName6 } = internalProps;
|
|
4382
|
+
var InfiniteTableColumnHeaderFilterClassName = `${rootClassName6}HeaderCell__filter`;
|
|
4383
|
+
var stopPropagation = (e) => e.stopPropagation();
|
|
4384
|
+
function InfiniteTableColumnHeaderFilter(props) {
|
|
4385
|
+
var _a, _b, _c, _d;
|
|
4386
|
+
const [theValue, setTheValue] = (0, import_react21.useState)((_b = (_a = props.columnFilterValue) == null ? void 0 : _a.filterValue) != null ? _b : "");
|
|
4387
|
+
const onInputChange = (filterValue) => {
|
|
4388
|
+
setTheValue(filterValue);
|
|
4389
|
+
props.onChange(filterValue);
|
|
4390
|
+
};
|
|
4391
|
+
(0, import_react21.useEffect)(() => {
|
|
4392
|
+
var _a2;
|
|
4393
|
+
if (props.columnFilterValue) {
|
|
4394
|
+
if (theValue !== props.columnFilterValue.filterValue) {
|
|
4395
|
+
setTheValue(props.columnFilterValue.filterValue);
|
|
4396
|
+
}
|
|
4397
|
+
} else {
|
|
4398
|
+
const currentFilterType = props.filterTypes[(_a2 = props.columnFilterType) != null ? _a2 : "string"];
|
|
4399
|
+
if (currentFilterType) {
|
|
4400
|
+
const emptyValue = [...currentFilterType.emptyValues][0];
|
|
4401
|
+
if (emptyValue !== theValue) {
|
|
4402
|
+
setTheValue(emptyValue);
|
|
4403
|
+
}
|
|
4404
|
+
}
|
|
4405
|
+
}
|
|
4406
|
+
}, [(_c = props.columnFilterValue) == null ? void 0 : _c.filterValue]);
|
|
4407
|
+
const filterType = props.columnFilterValue ? props.columnFilterValue.filterType : (_d = props.columnFilterType) != null ? _d : "string";
|
|
4408
|
+
const operator = props.columnFilterValue ? props.columnFilterValue.operator : props.filterTypes[filterType] ? props.filterTypes[filterType].defaultOperator : props.filterTypes.string.defaultOperator;
|
|
4409
|
+
const filterEditorProps = {
|
|
4410
|
+
ariaLabel: `Filter for ${props.columnLabel}`,
|
|
4411
|
+
filterValue: theValue,
|
|
4412
|
+
className: HeaderFilterEditorCls,
|
|
4413
|
+
operator,
|
|
4414
|
+
filterType,
|
|
4415
|
+
onChange: onInputChange
|
|
4416
|
+
};
|
|
4417
|
+
const FilterEditor = props.filterEditor;
|
|
4418
|
+
return /* @__PURE__ */ React19.createElement("div", {
|
|
4419
|
+
onPointerUp: stopPropagation,
|
|
4420
|
+
onPointerDown: stopPropagation,
|
|
4421
|
+
className: `${InfiniteTableColumnHeaderFilterClassName} ${HeaderFilterCls}`,
|
|
4422
|
+
style: { height: props.columnHeaderHeight }
|
|
4423
|
+
}, FilterEditor ? /* @__PURE__ */ React19.createElement(FilterEditor, __spreadValues({}, filterEditorProps)) : null);
|
|
4424
|
+
}
|
|
4425
|
+
function InfiniteTableColumnHeaderFilterEmpty() {
|
|
4426
|
+
return /* @__PURE__ */ React19.createElement("div", {
|
|
4427
|
+
onPointerUp: stopPropagation,
|
|
4428
|
+
onPointerDown: stopPropagation,
|
|
4429
|
+
className: `${InfiniteTableColumnHeaderFilterClassName} ${HeaderFilterCls}`,
|
|
4430
|
+
style: { height: "100%" }
|
|
4431
|
+
});
|
|
3933
4432
|
}
|
|
3934
4433
|
|
|
3935
4434
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
|
|
3936
|
-
var InfiniteTableHeaderCellContext =
|
|
3937
|
-
var { rootClassName:
|
|
3938
|
-
var InfiniteTableHeaderCellClassName = `${
|
|
4435
|
+
var InfiniteTableHeaderCellContext = React20.createContext(null);
|
|
4436
|
+
var { rootClassName: rootClassName7 } = internalProps;
|
|
4437
|
+
var InfiniteTableHeaderCellClassName = `${rootClassName7}HeaderCell`;
|
|
3939
4438
|
function InfiniteTableHeaderCell(props) {
|
|
3940
|
-
var _a, _b, _c, _d;
|
|
4439
|
+
var _a, _b, _c, _d, _e;
|
|
3941
4440
|
const column = props.column;
|
|
3942
4441
|
const columns = props.columns;
|
|
3943
|
-
const { onResize, height, width } = props;
|
|
4442
|
+
const { onResize, height, width, headerOptions } = props;
|
|
3944
4443
|
const sortInfo = column.computedSortInfo;
|
|
3945
4444
|
let header = column.header;
|
|
3946
|
-
const ref = (0,
|
|
4445
|
+
const ref = (0, import_react22.useCallback)((node) => {
|
|
3947
4446
|
var _a2;
|
|
3948
4447
|
domRef.current = node;
|
|
3949
4448
|
(_a2 = props.domRef) == null ? void 0 : _a2.call(props, node);
|
|
3950
4449
|
}, [props.domRef]);
|
|
3951
|
-
const
|
|
4450
|
+
const alwaysShow = headerOptions.alwaysReserveSpaceForSortIcon;
|
|
4451
|
+
const sortTool = column.computedSorted || alwaysShow ? /* @__PURE__ */ React20.createElement(SortIcon, {
|
|
3952
4452
|
index: column.computedMultiSort ? column.computedSortIndex + 1 : void 0,
|
|
3953
|
-
className: `${InfiniteTableHeaderCellClassName}__sort-icon ${HeaderSortIconCls}
|
|
4453
|
+
className: `${InfiniteTableHeaderCellClassName}__sort-icon ${HeaderSortIconCls} ${HeaderSortIconRecipe({
|
|
4454
|
+
align: column.align || "start"
|
|
4455
|
+
})}`,
|
|
3954
4456
|
direction: column.computedSorted ? column.computedSortedAsc ? 1 : -1 : 0
|
|
3955
|
-
});
|
|
4457
|
+
}) : null;
|
|
3956
4458
|
const renderParam = {
|
|
3957
4459
|
domRef: ref,
|
|
3958
4460
|
column,
|
|
3959
4461
|
columnSortInfo: sortInfo,
|
|
4462
|
+
columnFilterValue: column.computedFilterValue,
|
|
3960
4463
|
sortTool
|
|
3961
4464
|
};
|
|
4465
|
+
const align = column.align || "start";
|
|
3962
4466
|
const renderChildren = () => {
|
|
3963
4467
|
if (header instanceof Function) {
|
|
3964
|
-
header = /* @__PURE__ */
|
|
4468
|
+
header = /* @__PURE__ */ React20.createElement(RenderHookComponent, {
|
|
3965
4469
|
render: header,
|
|
3966
4470
|
renderParam
|
|
3967
4471
|
});
|
|
3968
4472
|
}
|
|
3969
4473
|
header = header != null ? header : column.name;
|
|
3970
|
-
return header;
|
|
4474
|
+
return /* @__PURE__ */ React20.createElement(React20.Fragment, null, align === "end" ? sortTool : null, header, align !== "end" ? sortTool : null);
|
|
3971
4475
|
};
|
|
3972
|
-
const domRef = (0,
|
|
4476
|
+
const domRef = (0, import_react22.useRef)(null);
|
|
3973
4477
|
const {
|
|
3974
|
-
computed: { computedRemainingSpace },
|
|
3975
|
-
componentState: { portalDOMRef }
|
|
4478
|
+
computed: { computedRemainingSpace, showColumnFilters },
|
|
4479
|
+
componentState: { portalDOMRef, columnHeaderHeight, filterEditors }
|
|
3976
4480
|
} = useInfiniteTable();
|
|
3977
|
-
|
|
4481
|
+
const {
|
|
4482
|
+
componentActions: dataSourceActions,
|
|
4483
|
+
getState: getDataSourceState,
|
|
4484
|
+
componentState: { filterDelay, filterTypes }
|
|
4485
|
+
} = useDataSourceContextValue();
|
|
4486
|
+
(0, import_react22.useEffect)(() => {
|
|
3978
4487
|
let clearOnResize = null;
|
|
3979
4488
|
const node = domRef.current;
|
|
3980
4489
|
if (onResize && node) {
|
|
@@ -3995,7 +4504,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
3995
4504
|
});
|
|
3996
4505
|
let draggingProxy = null;
|
|
3997
4506
|
if (dragging) {
|
|
3998
|
-
draggingProxy = /* @__PURE__ */
|
|
4507
|
+
draggingProxy = /* @__PURE__ */ React20.createElement("div", {
|
|
3999
4508
|
className: `${InfiniteTableHeaderCellClassName}Proxy ${HeaderCellProxy}`,
|
|
4000
4509
|
style: {
|
|
4001
4510
|
position: "absolute",
|
|
@@ -4009,9 +4518,73 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4009
4518
|
draggingProxy = (0, import_react_dom.createPortal)(draggingProxy, portalDOMRef.current);
|
|
4010
4519
|
}
|
|
4011
4520
|
const ContextProvider = InfiniteTableHeaderCellContext.Provider;
|
|
4012
|
-
|
|
4521
|
+
const contentRecipeVariants = {
|
|
4522
|
+
filtered: column.computedFiltered
|
|
4523
|
+
};
|
|
4524
|
+
const setFilterValue = (0, import_react22.useCallback)((filterValue) => {
|
|
4525
|
+
var _a2;
|
|
4526
|
+
const state = getDataSourceState();
|
|
4527
|
+
let newFilterValue = (_a2 = state.filterValue) != null ? _a2 : [];
|
|
4528
|
+
let found = false;
|
|
4529
|
+
newFilterValue = newFilterValue.map((currentFilterValue) => {
|
|
4530
|
+
if (filterValue.id && currentFilterValue.id === filterValue.id || filterValue.field && currentFilterValue.field === column.field) {
|
|
4531
|
+
found = true;
|
|
4532
|
+
return filterValue;
|
|
4533
|
+
}
|
|
4534
|
+
return currentFilterValue;
|
|
4535
|
+
});
|
|
4536
|
+
if (!found) {
|
|
4537
|
+
newFilterValue.push(filterValue);
|
|
4538
|
+
}
|
|
4539
|
+
newFilterValue = newFilterValue.filter((filterValue2) => {
|
|
4540
|
+
const filterType2 = filterTypes[filterValue2.filterType];
|
|
4541
|
+
if (!filterType2 || filterType2.emptyValues.has(filterValue2.filterValue)) {
|
|
4542
|
+
return false;
|
|
4543
|
+
}
|
|
4544
|
+
return true;
|
|
4545
|
+
});
|
|
4546
|
+
dataSourceActions.filterValue = newFilterValue;
|
|
4547
|
+
}, [column, filterTypes]);
|
|
4548
|
+
const debouncedOnFilterValueChange = React20.useMemo(() => {
|
|
4549
|
+
const fn = (filterValue) => {
|
|
4550
|
+
let newFilterValueForColumn;
|
|
4551
|
+
if (column.computedFilterValue) {
|
|
4552
|
+
newFilterValueForColumn = __spreadValues({}, column.computedFilterValue);
|
|
4553
|
+
} else {
|
|
4554
|
+
const filterType2 = column.computedFilterType;
|
|
4555
|
+
const filterValueForColumn = {
|
|
4556
|
+
filterType: filterType2,
|
|
4557
|
+
operator: filterTypes[filterType2].defaultOperator,
|
|
4558
|
+
filterValue,
|
|
4559
|
+
valueGetter: column.valueGetter
|
|
4560
|
+
};
|
|
4561
|
+
if (column.field) {
|
|
4562
|
+
filterValueForColumn.field = column.field;
|
|
4563
|
+
} else {
|
|
4564
|
+
filterValueForColumn.id = column.id;
|
|
4565
|
+
}
|
|
4566
|
+
newFilterValueForColumn = filterValueForColumn;
|
|
4567
|
+
}
|
|
4568
|
+
newFilterValueForColumn.filterValue = filterValue;
|
|
4569
|
+
setFilterValue(newFilterValueForColumn);
|
|
4570
|
+
};
|
|
4571
|
+
if (filterDelay > 0) {
|
|
4572
|
+
return debounce(fn, { wait: filterDelay });
|
|
4573
|
+
}
|
|
4574
|
+
return fn;
|
|
4575
|
+
}, [
|
|
4576
|
+
filterDelay,
|
|
4577
|
+
setFilterValue,
|
|
4578
|
+
column.computedFilterValue,
|
|
4579
|
+
column.id,
|
|
4580
|
+
column.field,
|
|
4581
|
+
column.computedFilterType
|
|
4582
|
+
]);
|
|
4583
|
+
const filterType = column.computedFilterType;
|
|
4584
|
+
const FilterEditor = filterEditors[filterType] || defaultFilterEditors[filterType] || StringFilterEditor;
|
|
4585
|
+
return /* @__PURE__ */ React20.createElement(ContextProvider, {
|
|
4013
4586
|
value: renderParam
|
|
4014
|
-
}, /* @__PURE__ */
|
|
4587
|
+
}, /* @__PURE__ */ React20.createElement(InfiniteTableCell, {
|
|
4015
4588
|
domRef: ref,
|
|
4016
4589
|
cellType: "header",
|
|
4017
4590
|
column,
|
|
@@ -4021,19 +4594,29 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4021
4594
|
width,
|
|
4022
4595
|
onPointerDown,
|
|
4023
4596
|
onPointerUp,
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4597
|
+
contentClassName: join(HeaderCellContentRecipe(contentRecipeVariants), justifyContent[(_c = column.align) != null ? _c : "start"]),
|
|
4598
|
+
contentStyle: showColumnFilters ? { height: height / 2 } : void 0,
|
|
4599
|
+
className: join(InfiniteTableHeaderCellClassName, userSelect.none, column.computedSortable ? cursor.pointer : "", useCellClassName(column, [InfiniteTableHeaderCellClassName, InfiniteTableCellClassName], HeaderCellRecipe, { dragging, zebra: false, rowActive: false }), CellCls),
|
|
4600
|
+
cssEllipsis: (_e = (_d = column.headerCssEllipsis) != null ? _d : column.cssEllipsis) != null ? _e : true,
|
|
4601
|
+
afterChildren: showColumnFilters ? column.computedFilterable ? /* @__PURE__ */ React20.createElement(InfiniteTableColumnHeaderFilter, {
|
|
4602
|
+
filterEditor: FilterEditor,
|
|
4603
|
+
filterTypes,
|
|
4604
|
+
onChange: debouncedOnFilterValueChange,
|
|
4605
|
+
columnFilterType: filterType,
|
|
4606
|
+
columnLabel: column.field || column.name || column.id,
|
|
4607
|
+
columnFilterValue: column.computedFilterValue,
|
|
4608
|
+
columnHeaderHeight
|
|
4609
|
+
}) : /* @__PURE__ */ React20.createElement(InfiniteTableColumnHeaderFilterEmpty, null) : null,
|
|
4027
4610
|
renderChildren
|
|
4028
4611
|
}), draggingProxy);
|
|
4029
4612
|
}
|
|
4030
4613
|
function useInfiniteHeaderCell() {
|
|
4031
|
-
const result = (0,
|
|
4614
|
+
const result = (0, import_react22.useContext)(InfiniteTableHeaderCellContext);
|
|
4032
4615
|
return result;
|
|
4033
4616
|
}
|
|
4034
4617
|
|
|
4035
4618
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx
|
|
4036
|
-
var
|
|
4619
|
+
var React23 = __toModule(require("react"));
|
|
4037
4620
|
|
|
4038
4621
|
// src/components/utils/getScrollbarWidth.ts
|
|
4039
4622
|
var scrollbarWidth;
|
|
@@ -4155,11 +4738,11 @@ function assignGroupOffsetsAndComputedWidths(items, groupOffset = 0) {
|
|
|
4155
4738
|
}
|
|
4156
4739
|
|
|
4157
4740
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
|
|
4158
|
-
var
|
|
4159
|
-
var
|
|
4741
|
+
var React22 = __toModule(require("react"));
|
|
4742
|
+
var import_react23 = __toModule(require("react"));
|
|
4160
4743
|
|
|
4161
4744
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderGroup.tsx
|
|
4162
|
-
var
|
|
4745
|
+
var React21 = __toModule(require("react"));
|
|
4163
4746
|
var TableHeaderGroupClassName = `${rootClassName2}HeaderGroup`;
|
|
4164
4747
|
function InfiniteTableHeaderGroup(props) {
|
|
4165
4748
|
const { columnGroup, height, width } = props;
|
|
@@ -4169,35 +4752,35 @@ function InfiniteTableHeaderGroup(props) {
|
|
|
4169
4752
|
columnGroup
|
|
4170
4753
|
});
|
|
4171
4754
|
}
|
|
4172
|
-
return /* @__PURE__ */
|
|
4755
|
+
return /* @__PURE__ */ React21.createElement("div", {
|
|
4173
4756
|
ref: props.domRef,
|
|
4174
4757
|
"data-group-id": columnGroup.uniqueGroupId,
|
|
4175
4758
|
className: join(HeaderGroupCls, TableHeaderGroupClassName),
|
|
4176
4759
|
style: { width, height }
|
|
4177
|
-
}, /* @__PURE__ */
|
|
4760
|
+
}, /* @__PURE__ */ React21.createElement("div", {
|
|
4178
4761
|
className: join(`${TableHeaderGroupClassName}__header-content`, cssEllipsisClassName)
|
|
4179
4762
|
}, header));
|
|
4180
4763
|
}
|
|
4181
4764
|
|
|
4182
4765
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
|
|
4183
|
-
var { rootClassName:
|
|
4184
|
-
var TableHeaderClassName = `${
|
|
4766
|
+
var { rootClassName: rootClassName8 } = internalProps;
|
|
4767
|
+
var TableHeaderClassName = `${rootClassName8}Header`;
|
|
4185
4768
|
function InfiniteTableHeaderFn(props) {
|
|
4186
4769
|
const {
|
|
4187
4770
|
brain,
|
|
4188
4771
|
columns,
|
|
4189
4772
|
style,
|
|
4190
4773
|
className,
|
|
4191
|
-
|
|
4774
|
+
columnHeaderHeight,
|
|
4192
4775
|
columnAndGroupTreeInfo,
|
|
4193
4776
|
columnGroupsMaxDepth
|
|
4194
4777
|
} = props;
|
|
4195
4778
|
const {
|
|
4196
4779
|
computed,
|
|
4197
|
-
componentState: { headerBrain }
|
|
4780
|
+
componentState: { headerBrain, headerOptions }
|
|
4198
4781
|
} = useInfiniteTable();
|
|
4199
|
-
const { computedVisibleColumnsMap } = computed;
|
|
4200
|
-
(0,
|
|
4782
|
+
const { computedVisibleColumnsMap, showColumnFilters } = computed;
|
|
4783
|
+
(0, import_react23.useEffect)(() => {
|
|
4201
4784
|
const onScroll = (scrollPosition) => {
|
|
4202
4785
|
if (domRef.current) {
|
|
4203
4786
|
domRef.current.style.transform = `translate3d(-${scrollPosition.scrollLeft}px, 0px, 0px)`;
|
|
@@ -4206,7 +4789,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4206
4789
|
const removeOnScroll = brain.onScroll(onScroll);
|
|
4207
4790
|
return removeOnScroll;
|
|
4208
4791
|
}, [brain]);
|
|
4209
|
-
const domRef = (0,
|
|
4792
|
+
const domRef = (0, import_react23.useRef)(null);
|
|
4210
4793
|
const headerCls = HeaderClsRecipe({
|
|
4211
4794
|
overflow: false,
|
|
4212
4795
|
virtualized: true
|
|
@@ -4214,9 +4797,9 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4214
4797
|
const domProps = {
|
|
4215
4798
|
ref: domRef,
|
|
4216
4799
|
className: join(TableHeaderClassName, `${TableHeaderClassName}--virtualized`, className, headerCls),
|
|
4217
|
-
style: __spreadProps(__spreadValues({}, style), { height:
|
|
4800
|
+
style: __spreadProps(__spreadValues({}, style), { height: columnHeaderHeight })
|
|
4218
4801
|
};
|
|
4219
|
-
const renderCell = (0,
|
|
4802
|
+
const renderCell = (0, import_react23.useCallback)((params) => {
|
|
4220
4803
|
const {
|
|
4221
4804
|
rowIndex,
|
|
4222
4805
|
colIndex,
|
|
@@ -4241,7 +4824,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4241
4824
|
computedWidth: colGroupItem.computedWidth,
|
|
4242
4825
|
groupOffset: colGroupItem.groupOffset
|
|
4243
4826
|
});
|
|
4244
|
-
return /* @__PURE__ */
|
|
4827
|
+
return /* @__PURE__ */ React22.createElement(InfiniteTableHeaderGroup, {
|
|
4245
4828
|
domRef: domRef2,
|
|
4246
4829
|
columns: columns2,
|
|
4247
4830
|
width: widthWithColspan,
|
|
@@ -4249,21 +4832,29 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4249
4832
|
columnGroup: computedColumnGroup
|
|
4250
4833
|
});
|
|
4251
4834
|
}
|
|
4252
|
-
return /* @__PURE__ */
|
|
4835
|
+
return /* @__PURE__ */ React22.createElement(InfiniteTableHeaderCell, {
|
|
4253
4836
|
domRef: domRef2,
|
|
4254
4837
|
column,
|
|
4838
|
+
headerOptions,
|
|
4255
4839
|
width: widthWithColspan,
|
|
4256
4840
|
height: heightWithRowspan,
|
|
4257
4841
|
columns: computedVisibleColumnsMap
|
|
4258
4842
|
});
|
|
4259
|
-
}, [
|
|
4260
|
-
|
|
4843
|
+
}, [
|
|
4844
|
+
headerOptions,
|
|
4845
|
+
columns,
|
|
4846
|
+
columnHeaderHeight,
|
|
4847
|
+
columnAndGroupTreeInfo,
|
|
4848
|
+
columnGroupsMaxDepth,
|
|
4849
|
+
showColumnFilters
|
|
4850
|
+
]);
|
|
4851
|
+
return /* @__PURE__ */ React22.createElement("div", __spreadValues({}, domProps), /* @__PURE__ */ React22.createElement(RawTable, {
|
|
4261
4852
|
renderCell,
|
|
4262
4853
|
brain: headerBrain,
|
|
4263
4854
|
cellHoverClassNames: []
|
|
4264
4855
|
}));
|
|
4265
4856
|
}
|
|
4266
|
-
var InfiniteTableHeader =
|
|
4857
|
+
var InfiniteTableHeader = React22.memo(InfiniteTableHeaderFn);
|
|
4267
4858
|
|
|
4268
4859
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx
|
|
4269
4860
|
function TableHeaderWrapper(props) {
|
|
@@ -4273,25 +4864,26 @@ function TableHeaderWrapper(props) {
|
|
|
4273
4864
|
computedPinnedStartColumns,
|
|
4274
4865
|
computedPinnedEndColumns,
|
|
4275
4866
|
computedVisibleColumns,
|
|
4276
|
-
columnSize
|
|
4867
|
+
columnSize,
|
|
4868
|
+
showColumnFilters
|
|
4277
4869
|
} = tableContextValue.computed;
|
|
4278
4870
|
const {
|
|
4279
4871
|
componentState: {
|
|
4280
|
-
|
|
4872
|
+
columnHeaderHeight,
|
|
4281
4873
|
columnGroupsDepthsMap,
|
|
4282
4874
|
columnGroupsMaxDepth,
|
|
4283
4875
|
computedColumnGroups
|
|
4284
4876
|
}
|
|
4285
4877
|
} = tableContextValue;
|
|
4286
4878
|
const rows = !computedColumnGroups || !computedColumnGroups.size ? 1 : columnGroupsMaxDepth + 2;
|
|
4287
|
-
const height = rows *
|
|
4288
|
-
const columnAndGroupTreeInfo =
|
|
4879
|
+
const height = rows * columnHeaderHeight + (showColumnFilters ? columnHeaderHeight : 0);
|
|
4880
|
+
const columnAndGroupTreeInfo = React23.useMemo(() => {
|
|
4289
4881
|
if (!computedColumnGroups || !computedColumnGroups.size) {
|
|
4290
4882
|
return void 0;
|
|
4291
4883
|
}
|
|
4292
4884
|
return buildColumnAndGroupTree(computedVisibleColumns, computedColumnGroups, columnGroupsDepthsMap, columnGroupsMaxDepth);
|
|
4293
4885
|
}, [computedVisibleColumns, computedColumnGroups, columnGroupsDepthsMap]);
|
|
4294
|
-
const cellspan =
|
|
4886
|
+
const cellspan = React23.useCallback(({ rowIndex, colIndex }) => {
|
|
4295
4887
|
const column = computedVisibleColumns[colIndex];
|
|
4296
4888
|
const rowspan2 = 1;
|
|
4297
4889
|
const colspan2 = 1;
|
|
@@ -4324,11 +4916,14 @@ function TableHeaderWrapper(props) {
|
|
|
4324
4916
|
rows,
|
|
4325
4917
|
columnGroupsDepthsMap
|
|
4326
4918
|
]);
|
|
4327
|
-
const rowspan =
|
|
4328
|
-
const colspan =
|
|
4919
|
+
const rowspan = React23.useCallback(({ rowIndex, colIndex }) => cellspan({ rowIndex, colIndex }).rowspan, [cellspan]);
|
|
4920
|
+
const colspan = React23.useCallback(({ rowIndex, colIndex }) => cellspan({ rowIndex, colIndex }).colspan, [cellspan]);
|
|
4921
|
+
const rowHeight = React23.useCallback((index) => {
|
|
4922
|
+
return showColumnFilters ? index < rows - 1 ? columnHeaderHeight : 2 * columnHeaderHeight : columnHeaderHeight;
|
|
4923
|
+
}, [rows, showColumnFilters, columnHeaderHeight]);
|
|
4329
4924
|
useMatrixBrain(brain, {
|
|
4330
4925
|
colWidth: columnSize,
|
|
4331
|
-
rowHeight
|
|
4926
|
+
rowHeight,
|
|
4332
4927
|
rows,
|
|
4333
4928
|
cols: computedVisibleColumns.length,
|
|
4334
4929
|
height,
|
|
@@ -4338,21 +4933,21 @@ function TableHeaderWrapper(props) {
|
|
|
4338
4933
|
fixedColsEnd: computedPinnedEndColumns.length,
|
|
4339
4934
|
fixedColsStart: computedPinnedStartColumns.length
|
|
4340
4935
|
});
|
|
4341
|
-
const header = /* @__PURE__ */
|
|
4936
|
+
const header = /* @__PURE__ */ React23.createElement(InfiniteTableHeader, {
|
|
4342
4937
|
columns: computedVisibleColumns,
|
|
4343
4938
|
brain,
|
|
4344
|
-
|
|
4939
|
+
columnHeaderHeight: height,
|
|
4345
4940
|
columnGroupsMaxDepth,
|
|
4346
4941
|
columnAndGroupTreeInfo
|
|
4347
4942
|
});
|
|
4348
|
-
const verticalScrollbarPlaceholder = scrollbars.vertical && getScrollbarWidth() ? /* @__PURE__ */
|
|
4943
|
+
const verticalScrollbarPlaceholder = scrollbars.vertical && getScrollbarWidth() ? /* @__PURE__ */ React23.createElement("div", {
|
|
4349
4944
|
className: HeaderScrollbarPlaceholderCls,
|
|
4350
4945
|
style: {
|
|
4351
4946
|
zIndex: 1e3,
|
|
4352
4947
|
width: getScrollbarWidth()
|
|
4353
4948
|
}
|
|
4354
4949
|
}) : null;
|
|
4355
|
-
return /* @__PURE__ */
|
|
4950
|
+
return /* @__PURE__ */ React23.createElement("div", {
|
|
4356
4951
|
className: HeaderWrapperCls,
|
|
4357
4952
|
style: {
|
|
4358
4953
|
height
|
|
@@ -4361,8 +4956,8 @@ function TableHeaderWrapper(props) {
|
|
|
4361
4956
|
}
|
|
4362
4957
|
|
|
4363
4958
|
// src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
|
|
4364
|
-
var
|
|
4365
|
-
var
|
|
4959
|
+
var React24 = __toModule(require("react"));
|
|
4960
|
+
var import_react24 = __toModule(require("react"));
|
|
4366
4961
|
|
|
4367
4962
|
// src/components/utils/decamelize.ts
|
|
4368
4963
|
function decamelize(str, options) {
|
|
@@ -4371,15 +4966,15 @@ function decamelize(str, options) {
|
|
|
4371
4966
|
}
|
|
4372
4967
|
|
|
4373
4968
|
// src/components/InfiniteTable/theme.css.ts
|
|
4374
|
-
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)",
|
|
4969
|
+
var ThemeVars = { color: { accent: "var(--infinite-accent-color)", color: "var(--infinite-color)" }, spacing: { "0": "var(--infinite-space-0)", "1": "var(--infinite-space-1)", "2": "var(--infinite-space-2)", "3": "var(--infinite-space-3)", "4": "var(--infinite-space-4)", "5": "var(--infinite-space-5)", "6": "var(--infinite-space-6)", "7": "var(--infinite-space-7)", "8": "var(--infinite-space-8)", "9": "var(--infinite-space-9)", "10": "var(--infinite-space-10)" }, fontSize: { "0": "var(--infinite-font-size-0)", "1": "var(--infinite-font-size-1)", "2": "var(--infinite-font-size-2)", "3": "var(--infinite-font-size-3)", "4": "var(--infinite-font-size-4)", "5": "var(--infinite-font-size-5)", "6": "var(--infinite-font-size-6)", "7": "var(--infinite-font-size-7)" }, fontFamily: "var(--infinite-font-family)", minHeight: "var(--infinite-min-height)", borderRadius: "var(--infinite-border-radius)", background: "var(--infinite-background)", components: { LoadMask: { padding: "var(--infinite-load-mask-padding)", color: "var(--infinite-load-mask-color)", textBackground: "var(--infinite-load-mask-text-background)", overlayBackground: "var(--infinite-load-mask-overlay-background)", overlayOpacity: "var(--infinite-load-mask-overlay-opacity)", borderRadius: "var(--infinite-load-mask-border-radius)" }, Header: { background: "var(--infinite-header-background)", color: "var(--infinite-header-color)", columnHeaderHeight: "var(--infinite-column-header-height)" }, HeaderCell: { draggingBackground: "var(--infinite-header-cell-dragging-background)", background: "var(--infinite-header-cell-background)", padding: "var(--infinite-header-cell-padding)", paddingX: "var(--infinite-header-cell-padding-x)", paddingY: "var(--infinite-header-cell-padding-y)", iconSize: "var(--infinite-header-cell-icon-size)", sortIconMargin: "var(--infinite-header-cell-sort-icon-margin)" }, Cell: { padding: "var(--infinite-cell-padding)", borderWidth: "var(--infinite-cell-border-width)", border: "var(--infinite-cell-border)", borderInvisible: "var(--infinite-cell-border-invisible)", borderRadius: "var(--infinite-cell-border-radius)", color: "var(--infinite-cell-color)", activeBorderColor_R: "var(--infinite-active-cell-border-color--r)", activeBorderColor_G: "var(--infinite-active-cell-border-color--g)", activeBorderColor_B: "var(--infinite-active-cell-border-color--b)", activeBackgroundAlpha: "var(--infinite-active-cell-background-alpha)", activeBackgroundAlphaWhenTableUnfocused: "var(--infinite-active-cell-background-alpha--table-unfocused)", activeBackground: "var(--infinite-active-cell-background)", activeBorderColor: "var(--infinite-active-cell-border-color)", activeBorderWidth: "var(--infinite-active-cell-border-width)", activeBorderStyle: "var(--infinite-active-cell-border-style)", activeBorder: "var(--infinite-active-cell-border)" }, Row: { background: "var(--infinite-row-background)", oddBackground: "var(--infinite-row-odd-background)", activeBackground: "var(--infinite-active-row-background)", activeBorderColor: "var(--infinite-active-row-border-color)", activeBorderWidth: "var(--infinite-active-row-border-width)", activeBorderStyle: "var(--infinite-active-row-border-style)", activeBorder: "var(--infinite-active-row-border)", activeBackgroundAlpha: "var(--infinite-active-row-background-alpha)", activeBackgroundAlphaWhenTableUnfocused: "var(--infinite-active-row-background-alpha--table-unfocused)", hoverBackground: "var(--infinite-row-hover-background)", groupRowBackground: "var(--infinite-group-row-background)", groupRowColumnNesting: "var(--infinite-group-row-column-nesting)", groupNesting: "var(--infinite-dont-override-group-row-nesting-length)", pointerEventsWhileScrolling: "var(--infinite-row-pointer-events-while-scrolling)" }, ColumnCell: { background: "var(--infinite-column-cell-bg-dont-override)" } } };
|
|
4375
4970
|
|
|
4376
4971
|
// src/components/InfiniteTable/InfiniteCls.css.ts
|
|
4377
4972
|
var import_createRuntimeFn3 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
4378
4973
|
var FooterCls = "_16lm1iw1";
|
|
4379
|
-
var InfiniteCls = "_1yeub2v0 _16lm1iw1
|
|
4380
|
-
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: [] });
|
|
4381
|
-
var InfiniteClsShiftingColumns = "
|
|
4382
|
-
var PinnedRowsContainerClsVariants = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "", variantClassNames: { pinned: { start: "
|
|
4974
|
+
var InfiniteCls = "_1yeub2v0 _16lm1iw1 _16lm1iwm _16lm1iw12 _16lm1iw0";
|
|
4975
|
+
var InfiniteClsRecipe = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "", variantClassNames: { focused: { true: "_1yeub2v2", false: "_1yeub2v3" }, focusedWithin: { true: "_1yeub2v4", false: "_1yeub2v5" }, hasPinnedStart: { true: "_1yeub2v6", false: "_1yeub2v7" }, hasPinnedEnd: { true: "_1yeub2v8", false: "_1yeub2v9" }, hasPinnedStartOverflow: { true: "_1yeub2va", false: "_1yeub2vb" }, hasPinnedEndOverflow: { true: "_1yeub2vc", false: "_1yeub2vd" } }, defaultVariants: {}, compoundVariants: [[{ focused: false, focusedWithin: false }, "_1yeub2ve"]] });
|
|
4976
|
+
var InfiniteClsShiftingColumns = "_16lm1iwp";
|
|
4977
|
+
var PinnedRowsContainerClsVariants = (0, import_createRuntimeFn3.createRuntimeFn)({ defaultClassName: "", variantClassNames: { pinned: { start: "_1yeub2vi", end: "_1yeub2vj", false: "_1yeub2vk" } }, defaultVariants: {}, compoundVariants: [] });
|
|
4383
4978
|
|
|
4384
4979
|
// src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
|
|
4385
4980
|
var defaultStyle = {
|
|
@@ -4408,10 +5003,10 @@ var enforceStyle = (node, style) => {
|
|
|
4408
5003
|
node.style.setProperty(decamelize(propertyName), propertyValue, "important");
|
|
4409
5004
|
}
|
|
4410
5005
|
};
|
|
4411
|
-
var InfiniteTableLicenseFooter =
|
|
4412
|
-
const { rootClassName:
|
|
4413
|
-
const domRef =
|
|
4414
|
-
const domCallback =
|
|
5006
|
+
var InfiniteTableLicenseFooter = React24.forwardRef(function InfiniteTableLicenseFooter2(props, ref) {
|
|
5007
|
+
const { rootClassName: rootClassName11 } = useInternalProps();
|
|
5008
|
+
const domRef = React24.useRef(null);
|
|
5009
|
+
const domCallback = React24.useCallback((node) => {
|
|
4415
5010
|
domRef.current = node;
|
|
4416
5011
|
if (!ref) {
|
|
4417
5012
|
return;
|
|
@@ -4422,7 +5017,7 @@ var InfiniteTableLicenseFooter = React19.forwardRef(function InfiniteTableLicens
|
|
|
4422
5017
|
ref.current = node;
|
|
4423
5018
|
}
|
|
4424
5019
|
}, []);
|
|
4425
|
-
(0,
|
|
5020
|
+
(0, import_react24.useEffect)(() => {
|
|
4426
5021
|
const forceStyle = () => {
|
|
4427
5022
|
requestAnimationFrame(() => {
|
|
4428
5023
|
var _a;
|
|
@@ -4436,12 +5031,12 @@ var InfiniteTableLicenseFooter = React19.forwardRef(function InfiniteTableLicens
|
|
|
4436
5031
|
clearInterval(intervalId);
|
|
4437
5032
|
};
|
|
4438
5033
|
}, []);
|
|
4439
|
-
return /* @__PURE__ */
|
|
5034
|
+
return /* @__PURE__ */ React24.createElement("div", __spreadProps(__spreadValues({
|
|
4440
5035
|
ref: domCallback
|
|
4441
5036
|
}, props), {
|
|
4442
|
-
className: join(`${
|
|
5037
|
+
className: join(`${rootClassName11}-Footer`, FooterCls, props.className),
|
|
4443
5038
|
style: defaultStyle
|
|
4444
|
-
}), "Powered by", " ", /* @__PURE__ */
|
|
5039
|
+
}), "Powered by", " ", /* @__PURE__ */ React24.createElement("a", {
|
|
4445
5040
|
href: "https://infinite-table.com",
|
|
4446
5041
|
rel: "noopener noreferrer",
|
|
4447
5042
|
role: "link",
|
|
@@ -4450,11 +5045,11 @@ var InfiniteTableLicenseFooter = React19.forwardRef(function InfiniteTableLicens
|
|
|
4450
5045
|
});
|
|
4451
5046
|
|
|
4452
5047
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableColumnCell.tsx
|
|
4453
|
-
var
|
|
4454
|
-
var
|
|
4455
|
-
var { rootClassName:
|
|
4456
|
-
var InfiniteTableColumnCellContext =
|
|
4457
|
-
var InfiniteTableColumnCellClassName = `${
|
|
5048
|
+
var React25 = __toModule(require("react"));
|
|
5049
|
+
var import_react25 = __toModule(require("react"));
|
|
5050
|
+
var { rootClassName: rootClassName9 } = internalProps;
|
|
5051
|
+
var InfiniteTableColumnCellContext = React25.createContext(null);
|
|
5052
|
+
var InfiniteTableColumnCellClassName = `${rootClassName9}ColumnCell`;
|
|
4458
5053
|
function isColumnWithField(c) {
|
|
4459
5054
|
return typeof c.field === "string";
|
|
4460
5055
|
}
|
|
@@ -4478,42 +5073,73 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
4478
5073
|
showZebraRows
|
|
4479
5074
|
} = props;
|
|
4480
5075
|
if (!column) {
|
|
4481
|
-
return /* @__PURE__ */
|
|
5076
|
+
return /* @__PURE__ */ React25.createElement("div", {
|
|
4482
5077
|
ref: domRef
|
|
4483
5078
|
}, "no column");
|
|
4484
5079
|
}
|
|
4485
5080
|
const { data, isGroupRow, dataSourceHasGrouping } = rowInfo;
|
|
4486
5081
|
const groupBy = dataSourceHasGrouping ? rowInfo.groupBy : void 0;
|
|
4487
5082
|
const groupRowInfo = null;
|
|
5083
|
+
const { getState, componentActions } = useInfiniteTable();
|
|
5084
|
+
const { activeRowIndex, keyboardNavigation } = getState();
|
|
5085
|
+
const rowActive = rowIndex === activeRowIndex && keyboardNavigation === "row";
|
|
4488
5086
|
let value = isGroupRow && groupBy && column.groupByField ? rowInfo.value : isColumnWithField(column) ? data == null ? void 0 : data[column.field] : null;
|
|
4489
5087
|
if (column.valueGetter) {
|
|
4490
|
-
|
|
5088
|
+
if (!rowInfo.isGroupRow && rowInfo.data) {
|
|
5089
|
+
value = column.valueGetter({ data: rowInfo.data, field: column.field });
|
|
5090
|
+
}
|
|
5091
|
+
}
|
|
5092
|
+
if (column.valueFormatter) {
|
|
5093
|
+
value = column.valueFormatter(isGroupRow ? {
|
|
4491
5094
|
data: rowInfo.data,
|
|
4492
5095
|
isGroupRow,
|
|
4493
|
-
rowInfo
|
|
5096
|
+
rowInfo,
|
|
5097
|
+
rowActive,
|
|
5098
|
+
field: column.field,
|
|
5099
|
+
value
|
|
4494
5100
|
} : {
|
|
4495
5101
|
data: rowInfo.data,
|
|
4496
5102
|
isGroupRow,
|
|
4497
|
-
|
|
5103
|
+
rowActive,
|
|
5104
|
+
rowInfo,
|
|
5105
|
+
field: column.field,
|
|
5106
|
+
value
|
|
4498
5107
|
});
|
|
4499
5108
|
}
|
|
5109
|
+
const onClick = (0, import_react25.useCallback)(() => {
|
|
5110
|
+
const { activeRowIndex: activeRowIndex2, activeCellIndex } = getState();
|
|
5111
|
+
if (activeRowIndex2 !== void 0 && keyboardNavigation === "row") {
|
|
5112
|
+
componentActions.activeRowIndex = rowIndex;
|
|
5113
|
+
return;
|
|
5114
|
+
}
|
|
5115
|
+
if (activeCellIndex !== void 0 && keyboardNavigation === "cell") {
|
|
5116
|
+
componentActions.activeCellIndex = [
|
|
5117
|
+
rowIndex,
|
|
5118
|
+
column.computedVisibleIndex
|
|
5119
|
+
];
|
|
5120
|
+
}
|
|
5121
|
+
}, [rowIndex, column.computedVisibleIndex, keyboardNavigation]);
|
|
4500
5122
|
const { componentState: computedDataSource } = useDataSourceContextValue();
|
|
4501
5123
|
const rest = rowInfo.isGroupRow ? {
|
|
4502
5124
|
rowInfo,
|
|
4503
5125
|
isGroupRow: rowInfo.isGroupRow,
|
|
4504
|
-
data: rowInfo.data
|
|
5126
|
+
data: rowInfo.data,
|
|
5127
|
+
rowActive,
|
|
5128
|
+
value,
|
|
5129
|
+
field: column.field
|
|
4505
5130
|
} : {
|
|
4506
5131
|
rowInfo,
|
|
4507
5132
|
isGroupRow: rowInfo.isGroupRow,
|
|
4508
|
-
data: rowInfo.data
|
|
5133
|
+
data: rowInfo.data,
|
|
5134
|
+
rowActive,
|
|
5135
|
+
value,
|
|
5136
|
+
field: column.field
|
|
4509
5137
|
};
|
|
4510
5138
|
const stylingRenderParam = __spreadValues({
|
|
4511
|
-
value,
|
|
4512
5139
|
column
|
|
4513
5140
|
}, rest);
|
|
4514
5141
|
const renderValue = value;
|
|
4515
5142
|
const renderParam = __spreadProps(__spreadValues({
|
|
4516
|
-
value,
|
|
4517
5143
|
column,
|
|
4518
5144
|
domRef,
|
|
4519
5145
|
groupRowInfo
|
|
@@ -4521,28 +5147,28 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
4521
5147
|
isGroupRow,
|
|
4522
5148
|
rowIndex,
|
|
4523
5149
|
toggleGroupRow,
|
|
4524
|
-
toggleCurrentGroupRow: () => {
|
|
5150
|
+
toggleCurrentGroupRow: (0, import_react25.useCallback)(() => {
|
|
4525
5151
|
if (!rowInfo.isGroupRow) {
|
|
4526
5152
|
return;
|
|
4527
5153
|
}
|
|
4528
5154
|
toggleGroupRow(rowInfo.groupKeys);
|
|
4529
|
-
},
|
|
5155
|
+
}, []),
|
|
4530
5156
|
groupBy: computedDataSource.groupBy,
|
|
4531
5157
|
pivotBy: computedDataSource.pivotBy
|
|
4532
5158
|
});
|
|
4533
|
-
const renderChildren = () => {
|
|
5159
|
+
const renderChildren = (0, import_react25.useCallback)(() => {
|
|
4534
5160
|
if (hidden) {
|
|
4535
5161
|
return null;
|
|
4536
5162
|
}
|
|
4537
5163
|
const renderFn = column.render || column.renderValue;
|
|
4538
5164
|
if (renderFn) {
|
|
4539
|
-
return /* @__PURE__ */
|
|
5165
|
+
return /* @__PURE__ */ React25.createElement(RenderHookComponent, {
|
|
4540
5166
|
render: renderFn,
|
|
4541
5167
|
renderParam
|
|
4542
5168
|
});
|
|
4543
5169
|
}
|
|
4544
5170
|
return renderValue;
|
|
4545
|
-
};
|
|
5171
|
+
}, [column, hidden, ...Object.values(renderParam)]);
|
|
4546
5172
|
const rowPropsAndStyleArgs = __spreadProps(__spreadValues({}, rest), {
|
|
4547
5173
|
rowIndex
|
|
4548
5174
|
});
|
|
@@ -4555,6 +5181,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
4555
5181
|
style = column.style ? typeof column.style === "function" ? __spreadValues(__spreadValues({}, style), column.style(stylingRenderParam) || {}) : __spreadValues(__spreadValues({}, style), column.style) : style || {};
|
|
4556
5182
|
style.width = width;
|
|
4557
5183
|
style.height = rowHeight;
|
|
5184
|
+
const memoizedStyle = (0, import_react25.useMemo)(() => style, [!style ? null : JSON.stringify(style)]);
|
|
4558
5185
|
const odd = (rowInfo.indexInAll != null ? rowInfo.indexInAll : rowIndex) % 2 === 1;
|
|
4559
5186
|
const zebra = showZebraRows ? odd ? "odd" : "even" : false;
|
|
4560
5187
|
const cellProps = {
|
|
@@ -4564,21 +5191,22 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
4564
5191
|
column,
|
|
4565
5192
|
width,
|
|
4566
5193
|
offset: virtualized ? 0 : column.computedPinningOffset,
|
|
4567
|
-
style,
|
|
5194
|
+
style: memoizedStyle,
|
|
4568
5195
|
onMouseLeave,
|
|
4569
5196
|
onMouseEnter,
|
|
5197
|
+
onClick,
|
|
4570
5198
|
cssEllipsis: (_a = column.cssEllipsis) != null ? _a : true,
|
|
4571
|
-
className: join(useCellClassName(column, [InfiniteTableColumnCellClassName, InfiniteTableCellClassName], ColumnCellRecipe, { dragging: false, zebra }), colClassName, rowComputedClassName),
|
|
5199
|
+
className: join(useCellClassName(column, [InfiniteTableColumnCellClassName, InfiniteTableCellClassName], ColumnCellRecipe, { dragging: false, zebra, rowActive }), colClassName, rowComputedClassName),
|
|
4572
5200
|
renderChildren
|
|
4573
5201
|
};
|
|
4574
5202
|
const ContextProvider = InfiniteTableColumnCellContext.Provider;
|
|
4575
|
-
return /* @__PURE__ */
|
|
5203
|
+
return /* @__PURE__ */ React25.createElement(ContextProvider, {
|
|
4576
5204
|
value: renderParam
|
|
4577
|
-
}, /* @__PURE__ */
|
|
5205
|
+
}, /* @__PURE__ */ React25.createElement(InfiniteTableCell, __spreadValues({}, cellProps)));
|
|
4578
5206
|
}
|
|
4579
|
-
var InfiniteTableColumnCell =
|
|
5207
|
+
var InfiniteTableColumnCell = React25.memo(InfiniteTableColumnCellFn);
|
|
4580
5208
|
function useInfiniteColumnCell() {
|
|
4581
|
-
const result = (0,
|
|
5209
|
+
const result = (0, import_react25.useContext)(InfiniteTableColumnCellContext);
|
|
4582
5210
|
return result;
|
|
4583
5211
|
}
|
|
4584
5212
|
|
|
@@ -4589,30 +5217,92 @@ var RowClsRecipe = (0, import_createRuntimeFn4.createRuntimeFn)({ defaultClassNa
|
|
|
4589
5217
|
var RowHoverCls = "_7pupv01";
|
|
4590
5218
|
|
|
4591
5219
|
// src/components/InfiniteTable/components/LoadMask.tsx
|
|
4592
|
-
var
|
|
5220
|
+
var React26 = __toModule(require("react"));
|
|
4593
5221
|
|
|
4594
5222
|
// src/components/InfiniteTable/components/LoadMask.css.ts
|
|
4595
|
-
var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2
|
|
4596
|
-
var LoadMaskOverlayCls = "qy58ya3 _16lm1iw2
|
|
5223
|
+
var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2 _16lm1iwu _16lm1iww _16lm1iw10 _16lm1iwy", hidden: "qy58ya2 qy58ya0 _16lm1iw2 _16lm1iwu _16lm1iww _16lm1iw10 _16lm1iwy" };
|
|
5224
|
+
var LoadMaskOverlayCls = "qy58ya3 _16lm1iw2 _16lm1iwu _16lm1iww _16lm1iw10 _16lm1iwy";
|
|
4597
5225
|
var LoadMaskTextCls = "qy58ya4";
|
|
4598
5226
|
|
|
4599
5227
|
// src/components/InfiniteTable/components/LoadMask.tsx
|
|
4600
|
-
var { rootClassName:
|
|
4601
|
-
var
|
|
5228
|
+
var { rootClassName: rootClassName10 } = internalProps;
|
|
5229
|
+
var baseCls3 = `${rootClassName10}-LoadMask`;
|
|
4602
5230
|
function LoadMaskFn(props) {
|
|
4603
5231
|
const { visible, children = "Loading" } = props;
|
|
4604
|
-
return /* @__PURE__ */
|
|
4605
|
-
className: `${LoadMaskCls[visible ? "visible" : "hidden"]} ${
|
|
4606
|
-
}, /* @__PURE__ */
|
|
4607
|
-
className: `${LoadMaskOverlayCls} ${
|
|
4608
|
-
}), /* @__PURE__ */
|
|
4609
|
-
className: `${LoadMaskTextCls} ${
|
|
5232
|
+
return /* @__PURE__ */ React26.createElement("div", {
|
|
5233
|
+
className: `${LoadMaskCls[visible ? "visible" : "hidden"]} ${baseCls3}`
|
|
5234
|
+
}, /* @__PURE__ */ React26.createElement("div", {
|
|
5235
|
+
className: `${LoadMaskOverlayCls} ${baseCls3}-Overlay`
|
|
5236
|
+
}), /* @__PURE__ */ React26.createElement("div", {
|
|
5237
|
+
className: `${LoadMaskTextCls} ${baseCls3}-Text`
|
|
4610
5238
|
}, children));
|
|
4611
5239
|
}
|
|
4612
|
-
var LoadMask =
|
|
5240
|
+
var LoadMask = React26.memo(LoadMaskFn);
|
|
5241
|
+
|
|
5242
|
+
// src/components/InfiniteTable/getImperativeApi.ts
|
|
5243
|
+
function getImperativeApi(getState, getComputed, getDataSourceState, componentActions) {
|
|
5244
|
+
const imperativeApi = {
|
|
5245
|
+
setColumnOrder: (columnOrder) => {
|
|
5246
|
+
componentActions.columnOrder = columnOrder;
|
|
5247
|
+
},
|
|
5248
|
+
setColumnVisibility: (columnVisibility) => {
|
|
5249
|
+
componentActions.columnVisibility = columnVisibility;
|
|
5250
|
+
},
|
|
5251
|
+
getState,
|
|
5252
|
+
getDataSourceState,
|
|
5253
|
+
scrollRowIntoView(rowIndex, config = { offset: 0 }) {
|
|
5254
|
+
const state = getState();
|
|
5255
|
+
const scrollPosition = state.renderer.getScrollPositionForScrollRowIntoView(rowIndex, config);
|
|
5256
|
+
const currentScrollPosition = state.brain.getScrollPosition();
|
|
5257
|
+
if (scrollPosition.scrollTop !== currentScrollPosition.scrollTop) {
|
|
5258
|
+
state.scrollerDOMRef.current.scrollTop = scrollPosition.scrollTop;
|
|
5259
|
+
}
|
|
5260
|
+
},
|
|
5261
|
+
scrollColumnIntoView(colId, config = { offset: 0 }) {
|
|
5262
|
+
const state = getState();
|
|
5263
|
+
const computed = getComputed();
|
|
5264
|
+
const computedColumn = computed.computedVisibleColumnsMap.get(colId);
|
|
5265
|
+
if (!computedColumn) {
|
|
5266
|
+
return;
|
|
5267
|
+
}
|
|
5268
|
+
const colIndex = computedColumn.computedVisibleIndex;
|
|
5269
|
+
const scrollPosition = state.renderer.getScrollPositionForScrollColumnIntoView(colIndex, config);
|
|
5270
|
+
const currentScrollPosition = state.brain.getScrollPosition();
|
|
5271
|
+
if (scrollPosition.scrollLeft !== currentScrollPosition.scrollLeft) {
|
|
5272
|
+
state.scrollerDOMRef.current.scrollLeft = scrollPosition.scrollLeft;
|
|
5273
|
+
}
|
|
5274
|
+
},
|
|
5275
|
+
scrollCellIntoView(rowIndex, colIdOrIndex, config = { offset: 0 }) {
|
|
5276
|
+
const state = getState();
|
|
5277
|
+
const computed = getComputed();
|
|
5278
|
+
let colIndex = colIdOrIndex;
|
|
5279
|
+
if (typeof colIdOrIndex === "string") {
|
|
5280
|
+
const computedColumn = computed.computedVisibleColumnsMap.get(colIdOrIndex);
|
|
5281
|
+
if (!computedColumn) {
|
|
5282
|
+
return;
|
|
5283
|
+
}
|
|
5284
|
+
colIndex = computedColumn.computedVisibleIndex;
|
|
5285
|
+
}
|
|
5286
|
+
const scrollPositionForCol = state.renderer.getScrollPositionForScrollColumnIntoView(colIndex, config);
|
|
5287
|
+
const scrollPositionForRow = state.renderer.getScrollPositionForScrollRowIntoView(rowIndex, config);
|
|
5288
|
+
const newScrollPosition = {
|
|
5289
|
+
scrollLeft: scrollPositionForCol.scrollLeft,
|
|
5290
|
+
scrollTop: scrollPositionForRow.scrollTop
|
|
5291
|
+
};
|
|
5292
|
+
const currentScrollPosition = state.brain.getScrollPosition();
|
|
5293
|
+
if (newScrollPosition.scrollLeft !== currentScrollPosition.scrollLeft) {
|
|
5294
|
+
state.scrollerDOMRef.current.scrollLeft = newScrollPosition.scrollLeft;
|
|
5295
|
+
}
|
|
5296
|
+
if (newScrollPosition.scrollTop !== currentScrollPosition.scrollTop) {
|
|
5297
|
+
state.scrollerDOMRef.current.scrollTop = newScrollPosition.scrollTop;
|
|
5298
|
+
}
|
|
5299
|
+
}
|
|
5300
|
+
};
|
|
5301
|
+
return imperativeApi;
|
|
5302
|
+
}
|
|
4613
5303
|
|
|
4614
5304
|
// src/components/InfiniteTable/hooks/useAutoSizeColumns.ts
|
|
4615
|
-
var
|
|
5305
|
+
var import_react26 = __toModule(require("react"));
|
|
4616
5306
|
var OFFSET = 10;
|
|
4617
5307
|
function getColumnContentMaxWidths(domRef, options) {
|
|
4618
5308
|
var _a;
|
|
@@ -4634,6 +5324,7 @@ function getColumnContentMaxWidths(domRef, options) {
|
|
|
4634
5324
|
contentClone.style.pointerEvents = "none";
|
|
4635
5325
|
contentClone.classList.remove(...cssEllipsisClassName.split(" "));
|
|
4636
5326
|
contentClone.style.position = "absolute";
|
|
5327
|
+
contentClone.style.width = "auto";
|
|
4637
5328
|
cell.appendChild(contentClone);
|
|
4638
5329
|
let measuredWidth = contentClone.offsetWidth;
|
|
4639
5330
|
cell.removeChild(contentClone);
|
|
@@ -4671,11 +5362,11 @@ function useAutoSizeColumns() {
|
|
|
4671
5362
|
componentActions,
|
|
4672
5363
|
componentState: { domRef, ready, autoSizeColumnsKey, brain }
|
|
4673
5364
|
} = useComponentState();
|
|
4674
|
-
const [refreshId, setRefreshId] = (0,
|
|
5365
|
+
const [refreshId, setRefreshId] = (0, import_react26.useState)(0);
|
|
4675
5366
|
const theKey = typeof autoSizeColumnsKey === "object" ? autoSizeColumnsKey.key : autoSizeColumnsKey;
|
|
4676
5367
|
const getTheKey = useLatest(theKey);
|
|
4677
|
-
const lastExecutedIdentifierRef = (0,
|
|
4678
|
-
(0,
|
|
5368
|
+
const lastExecutedIdentifierRef = (0, import_react26.useRef)(null);
|
|
5369
|
+
(0, import_react26.useEffect)(() => {
|
|
4679
5370
|
const key = getTheKey();
|
|
4680
5371
|
if (key == null) {
|
|
4681
5372
|
return;
|
|
@@ -4688,7 +5379,7 @@ function useAutoSizeColumns() {
|
|
|
4688
5379
|
};
|
|
4689
5380
|
return brain.onRenderRangeChange(onChange);
|
|
4690
5381
|
}, [brain]);
|
|
4691
|
-
(0,
|
|
5382
|
+
(0, import_react26.useEffect)(() => {
|
|
4692
5383
|
var _a;
|
|
4693
5384
|
if (theKey == null) {
|
|
4694
5385
|
return;
|
|
@@ -4733,20 +5424,8 @@ function useAutoSizeColumns() {
|
|
|
4733
5424
|
}
|
|
4734
5425
|
|
|
4735
5426
|
// src/components/InfiniteTable/hooks/useCellRendering.tsx
|
|
4736
|
-
var
|
|
4737
|
-
var
|
|
4738
|
-
|
|
4739
|
-
// src/components/hooks/useRerender.ts
|
|
4740
|
-
var import_react22 = __toModule(require("react"));
|
|
4741
|
-
var useRerender = () => {
|
|
4742
|
-
const [state, setState] = (0, import_react22.useState)(0);
|
|
4743
|
-
return [
|
|
4744
|
-
state,
|
|
4745
|
-
(0, import_react22.useCallback)(() => {
|
|
4746
|
-
setState((state2) => state2 + 1);
|
|
4747
|
-
}, [setState])
|
|
4748
|
-
];
|
|
4749
|
-
};
|
|
5427
|
+
var import_react27 = __toModule(require("react"));
|
|
5428
|
+
var import_react28 = __toModule(require("react"));
|
|
4750
5429
|
|
|
4751
5430
|
// src/components/InfiniteTable/hooks/useYourBrain.ts
|
|
4752
5431
|
function useYourBrain(param) {
|
|
@@ -4776,7 +5455,7 @@ function useYourBrain(param) {
|
|
|
4776
5455
|
// src/components/InfiniteTable/hooks/useCellRendering.tsx
|
|
4777
5456
|
var SCROLL_BOTTOM_OFFSET = 1;
|
|
4778
5457
|
function useCellRendering(param) {
|
|
4779
|
-
const { computed, bodySize } = param;
|
|
5458
|
+
const { computed, bodySize, imperativeApi } = param;
|
|
4780
5459
|
const { componentActions, componentState, getState } = useInfiniteTable();
|
|
4781
5460
|
const {
|
|
4782
5461
|
computedPinnedStartColumns,
|
|
@@ -4816,13 +5495,13 @@ function useCellRendering(param) {
|
|
|
4816
5495
|
bodySize,
|
|
4817
5496
|
rowspan
|
|
4818
5497
|
});
|
|
4819
|
-
const scrollTopMaxRef = (0,
|
|
4820
|
-
(0,
|
|
5498
|
+
const scrollTopMaxRef = (0, import_react27.useRef)(0);
|
|
5499
|
+
(0, import_react27.useEffect)(() => {
|
|
4821
5500
|
return brain.onRenderCountChange(() => {
|
|
4822
5501
|
scrollTopMaxRef.current = brain.scrollTopMax;
|
|
4823
5502
|
});
|
|
4824
5503
|
}, [brain]);
|
|
4825
|
-
(0,
|
|
5504
|
+
(0, import_react27.useEffect)(() => {
|
|
4826
5505
|
return brain.onScrollStop((scrollPosition) => {
|
|
4827
5506
|
const { scrollTop } = scrollPosition;
|
|
4828
5507
|
if (scrollTop === 0) {
|
|
@@ -4839,31 +5518,21 @@ function useCellRendering(param) {
|
|
|
4839
5518
|
}
|
|
4840
5519
|
});
|
|
4841
5520
|
}, [brain, onScrollToTop, onScrollToBottom]);
|
|
4842
|
-
(0,
|
|
5521
|
+
(0, import_react27.useEffect)(() => {
|
|
4843
5522
|
if (!bodySize.height) {
|
|
4844
5523
|
return;
|
|
4845
5524
|
}
|
|
4846
5525
|
const { onReady } = getState();
|
|
4847
5526
|
componentActions.ready = true;
|
|
4848
5527
|
if (onReady) {
|
|
4849
|
-
const imperativeApi = {
|
|
4850
|
-
setColumnOrder: (columnOrder) => {
|
|
4851
|
-
componentActions.columnOrder = columnOrder;
|
|
4852
|
-
},
|
|
4853
|
-
setColumnVisibility: (columnVisibility) => {
|
|
4854
|
-
componentActions.columnVisibility = columnVisibility;
|
|
4855
|
-
},
|
|
4856
|
-
getState,
|
|
4857
|
-
getDataSourceState
|
|
4858
|
-
};
|
|
4859
5528
|
onReady(imperativeApi);
|
|
4860
5529
|
}
|
|
4861
5530
|
}, [!!bodySize.height]);
|
|
4862
5531
|
const [, rerender] = useRerender();
|
|
4863
|
-
(0,
|
|
5532
|
+
(0, import_react27.useEffect)(() => {
|
|
4864
5533
|
rerender();
|
|
4865
5534
|
}, [dataSourceState]);
|
|
4866
|
-
const renderCell = (0,
|
|
5535
|
+
const renderCell = (0, import_react27.useCallback)((params) => {
|
|
4867
5536
|
const {
|
|
4868
5537
|
rowIndex,
|
|
4869
5538
|
colIndex,
|
|
@@ -4898,7 +5567,7 @@ function useCellRendering(param) {
|
|
|
4898
5567
|
rowStyle,
|
|
4899
5568
|
rowClassName
|
|
4900
5569
|
};
|
|
4901
|
-
return /* @__PURE__ */
|
|
5570
|
+
return /* @__PURE__ */ import_react28.default.createElement(InfiniteTableColumnCell, __spreadValues({}, cellProps));
|
|
4902
5571
|
}, [
|
|
4903
5572
|
rowHeight,
|
|
4904
5573
|
getData,
|
|
@@ -4916,13 +5585,13 @@ function useCellRendering(param) {
|
|
|
4916
5585
|
}
|
|
4917
5586
|
|
|
4918
5587
|
// src/components/InfiniteTable/hooks/useComputed.ts
|
|
4919
|
-
var
|
|
5588
|
+
var import_react42 = __toModule(require("react"));
|
|
4920
5589
|
|
|
4921
5590
|
// src/components/InfiniteTable/hooks/useColumnGroups.ts
|
|
4922
|
-
var
|
|
5591
|
+
var import_react30 = __toModule(require("react"));
|
|
4923
5592
|
|
|
4924
5593
|
// src/components/hooks/useInterceptedMap.ts
|
|
4925
|
-
var
|
|
5594
|
+
var import_react29 = __toModule(require("react"));
|
|
4926
5595
|
function interceptMap(map2, fns) {
|
|
4927
5596
|
const { set, delete: deleteKey, clear } = map2;
|
|
4928
5597
|
if (fns.set) {
|
|
@@ -5010,7 +5679,7 @@ function useColumnGroups() {
|
|
|
5010
5679
|
componentActions,
|
|
5011
5680
|
getComponentState
|
|
5012
5681
|
} = useComponentState();
|
|
5013
|
-
(0,
|
|
5682
|
+
(0, import_react30.useEffect)(() => {
|
|
5014
5683
|
const recompute = () => {
|
|
5015
5684
|
componentActions.columnGroupsDepthsMap = computeColumnGroupsDepths(computedColumnGroups);
|
|
5016
5685
|
};
|
|
@@ -5021,7 +5690,7 @@ function useColumnGroups() {
|
|
|
5021
5690
|
set: update
|
|
5022
5691
|
});
|
|
5023
5692
|
}, [computedColumnGroups]);
|
|
5024
|
-
(0,
|
|
5693
|
+
(0, import_react30.useEffect)(() => {
|
|
5025
5694
|
return interceptMap(collapsedColumnGroups, {
|
|
5026
5695
|
set: (key, visibleCol) => {
|
|
5027
5696
|
const colIds = key.slice(1);
|
|
@@ -5056,10 +5725,10 @@ function useColumnGroups() {
|
|
|
5056
5725
|
}
|
|
5057
5726
|
|
|
5058
5727
|
// src/components/InfiniteTable/hooks/useColumnRowspan.ts
|
|
5059
|
-
var
|
|
5728
|
+
var import_react31 = __toModule(require("react"));
|
|
5060
5729
|
function useColumnRowspan(computedVisibleColumns) {
|
|
5061
5730
|
const { getState: getDataSourceState } = useDataSourceContextValue();
|
|
5062
|
-
const rowspan = (0,
|
|
5731
|
+
const rowspan = (0, import_react31.useMemo)(() => {
|
|
5063
5732
|
const colsWithRowspan = computedVisibleColumns.filter((col) => typeof col.rowspan === "function");
|
|
5064
5733
|
return colsWithRowspan.length ? ({ rowIndex, colIndex }) => {
|
|
5065
5734
|
const dataArray = getDataSourceState().dataArray;
|
|
@@ -5085,10 +5754,10 @@ function useColumnRowspan(computedVisibleColumns) {
|
|
|
5085
5754
|
}
|
|
5086
5755
|
|
|
5087
5756
|
// src/components/InfiniteTable/hooks/useColumnSizeFn.ts
|
|
5088
|
-
var
|
|
5757
|
+
var import_react32 = __toModule(require("react"));
|
|
5089
5758
|
var debug4 = dbg("useColumnSizeFn");
|
|
5090
5759
|
function useColumnSizeFn(columns) {
|
|
5091
|
-
const columnSize = (0,
|
|
5760
|
+
const columnSize = (0, import_react32.useCallback)((index) => {
|
|
5092
5761
|
const column = columns[index];
|
|
5093
5762
|
if (!column) {
|
|
5094
5763
|
debug4("cannot find column at index", index, columns);
|
|
@@ -5099,10 +5768,10 @@ function useColumnSizeFn(columns) {
|
|
|
5099
5768
|
}
|
|
5100
5769
|
|
|
5101
5770
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
5102
|
-
var
|
|
5771
|
+
var import_react38 = __toModule(require("react"));
|
|
5103
5772
|
|
|
5104
5773
|
// src/components/InfiniteTable/utils/getColumnForGroupBy.tsx
|
|
5105
|
-
var
|
|
5774
|
+
var React30 = __toModule(require("react"));
|
|
5106
5775
|
|
|
5107
5776
|
// src/utils/stripVar.ts
|
|
5108
5777
|
function stripVar(cssVariableWithVarString) {
|
|
@@ -5118,19 +5787,19 @@ var showLoadingIcon = (rowInfo) => {
|
|
|
5118
5787
|
};
|
|
5119
5788
|
|
|
5120
5789
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
5121
|
-
var
|
|
5122
|
-
var
|
|
5790
|
+
var React28 = __toModule(require("react"));
|
|
5791
|
+
var import_react33 = __toModule(require("react"));
|
|
5123
5792
|
|
|
5124
5793
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.css.ts
|
|
5125
5794
|
var import_createRuntimeFn5 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
5126
|
-
var ExpanderIconCls = "_16lm1iw6
|
|
5795
|
+
var ExpanderIconCls = "_16lm1iw6 _16lm1iwg _16lm1iwd";
|
|
5127
5796
|
var ExpanderIconClsVariants = (0, import_createRuntimeFn5.createRuntimeFn)({ defaultClassName: "", variantClassNames: { expanded: { true: "_16lm1iwc", false: "_198z9782" } }, defaultVariants: {}, compoundVariants: [] });
|
|
5128
5797
|
|
|
5129
5798
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
5130
5799
|
function ExpanderIcon(props) {
|
|
5131
5800
|
var _a;
|
|
5132
5801
|
const { size = 24 } = props;
|
|
5133
|
-
const [expanded, setExpanded] = (0,
|
|
5802
|
+
const [expanded, setExpanded] = (0, import_react33.useState)((_a = props.expanded) != null ? _a : props.defaultExpanded);
|
|
5134
5803
|
const onClick = () => {
|
|
5135
5804
|
var _a2;
|
|
5136
5805
|
(_a2 = props.onChange) == null ? void 0 : _a2.call(props, !expanded);
|
|
@@ -5138,12 +5807,12 @@ function ExpanderIcon(props) {
|
|
|
5138
5807
|
setExpanded(!expanded);
|
|
5139
5808
|
}
|
|
5140
5809
|
};
|
|
5141
|
-
|
|
5810
|
+
React28.useEffect(() => {
|
|
5142
5811
|
if (isControlled("expanded", props)) {
|
|
5143
5812
|
setExpanded(props.expanded);
|
|
5144
5813
|
}
|
|
5145
5814
|
}, [props.expanded]);
|
|
5146
|
-
return /* @__PURE__ */
|
|
5815
|
+
return /* @__PURE__ */ React28.createElement("svg", {
|
|
5147
5816
|
"data-name": "expander-icon",
|
|
5148
5817
|
xmlns: "http://www.w3.org/2000/svg",
|
|
5149
5818
|
height: `${size}px`,
|
|
@@ -5154,20 +5823,20 @@ function ExpanderIcon(props) {
|
|
|
5154
5823
|
className: join(props.className, ExpanderIconCls, ExpanderIconClsVariants({
|
|
5155
5824
|
expanded
|
|
5156
5825
|
}), "InfiniteIcon", "InfiniteIcon-expander", `InfiniteIcon-expander--${expanded ? "expanded" : "collapsed"}`)
|
|
5157
|
-
}, /* @__PURE__ */
|
|
5826
|
+
}, /* @__PURE__ */ React28.createElement("path", {
|
|
5158
5827
|
d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"
|
|
5159
5828
|
}));
|
|
5160
5829
|
}
|
|
5161
5830
|
|
|
5162
5831
|
// src/components/InfiniteTable/components/icons/LoadingIcon.tsx
|
|
5163
|
-
var
|
|
5832
|
+
var React29 = __toModule(require("react"));
|
|
5164
5833
|
|
|
5165
5834
|
// src/components/InfiniteTable/components/icons/LoadingIcon.css.ts
|
|
5166
|
-
var LoadingIconCls = "_16lm1iw8
|
|
5835
|
+
var LoadingIconCls = "_16lm1iw8 _16lm1iwg _16lm1iwd";
|
|
5167
5836
|
|
|
5168
5837
|
// src/components/InfiniteTable/components/icons/LoadingIcon.tsx
|
|
5169
5838
|
var LoadingIcon = (props) => {
|
|
5170
|
-
return /* @__PURE__ */
|
|
5839
|
+
return /* @__PURE__ */ React29.createElement("svg", {
|
|
5171
5840
|
xmlns: "http://www.w3.org/2000/svg",
|
|
5172
5841
|
style: {
|
|
5173
5842
|
margin: "auto",
|
|
@@ -5179,14 +5848,14 @@ var LoadingIcon = (props) => {
|
|
|
5179
5848
|
viewBox: "0 0 100 100",
|
|
5180
5849
|
preserveAspectRatio: "xMidYMid",
|
|
5181
5850
|
className: join(props.className, LoadingIconCls, "InfiniteIcon", "InfiniteIcon-loading")
|
|
5182
|
-
}, /* @__PURE__ */
|
|
5851
|
+
}, /* @__PURE__ */ React29.createElement("circle", {
|
|
5183
5852
|
cx: "50",
|
|
5184
5853
|
cy: "50",
|
|
5185
5854
|
fill: "none",
|
|
5186
5855
|
strokeWidth: "10",
|
|
5187
5856
|
r: "35",
|
|
5188
5857
|
strokeDasharray: "164.93361431346415 56.97787143782138"
|
|
5189
|
-
}, /* @__PURE__ */
|
|
5858
|
+
}, /* @__PURE__ */ React29.createElement("animateTransform", {
|
|
5190
5859
|
attributeName: "transform",
|
|
5191
5860
|
type: "rotate",
|
|
5192
5861
|
repeatCount: "indefinite",
|
|
@@ -5206,7 +5875,7 @@ function getGroupColumnRender({
|
|
|
5206
5875
|
var _a, _b, _c;
|
|
5207
5876
|
let { value, rowInfo, column, groupBy, pivotBy } = renderOptions;
|
|
5208
5877
|
if (column.renderValue) {
|
|
5209
|
-
value = /* @__PURE__ */
|
|
5878
|
+
value = /* @__PURE__ */ React30.createElement(RenderHookComponent, {
|
|
5210
5879
|
render: column.renderValue,
|
|
5211
5880
|
renderParam: renderOptions
|
|
5212
5881
|
});
|
|
@@ -5236,22 +5905,22 @@ function getGroupColumnRender({
|
|
|
5236
5905
|
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);
|
|
5237
5906
|
const isLoading = showLoadingIcon(groupRowInfo);
|
|
5238
5907
|
if (isLoading) {
|
|
5239
|
-
icon = /* @__PURE__ */
|
|
5908
|
+
icon = /* @__PURE__ */ React30.createElement(LoadingIcon, null);
|
|
5240
5909
|
} else if (showExpanderIcon) {
|
|
5241
|
-
const defaultIcon = /* @__PURE__ */
|
|
5910
|
+
const defaultIcon = /* @__PURE__ */ React30.createElement(ExpanderIcon, {
|
|
5242
5911
|
expanded: !collapsed,
|
|
5243
5912
|
onChange: () => {
|
|
5244
5913
|
toggleGroupRow(groupKeys);
|
|
5245
5914
|
}
|
|
5246
5915
|
});
|
|
5247
|
-
icon = column.renderGroupIcon ? /* @__PURE__ */
|
|
5916
|
+
icon = column.renderGroupIcon ? /* @__PURE__ */ React30.createElement(RenderHookComponent, {
|
|
5248
5917
|
render: column.renderGroupIcon,
|
|
5249
5918
|
renderParam: Object.assign({ collapsed, groupIcon: defaultIcon }, renderOptions)
|
|
5250
5919
|
}) : defaultIcon;
|
|
5251
5920
|
}
|
|
5252
|
-
return /* @__PURE__ */
|
|
5921
|
+
return /* @__PURE__ */ React30.createElement("div", {
|
|
5253
5922
|
className: join(display.flex, alignItems.center)
|
|
5254
|
-
}, icon, /* @__PURE__ */
|
|
5923
|
+
}, icon, /* @__PURE__ */ React30.createElement("div", {
|
|
5255
5924
|
className: cssEllipsisClassName
|
|
5256
5925
|
}, value != null ? value : null));
|
|
5257
5926
|
};
|
|
@@ -5296,9 +5965,9 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
5296
5965
|
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;
|
|
5297
5966
|
const isLoading = showLoadingIcon(rowInfo);
|
|
5298
5967
|
if (isLoading) {
|
|
5299
|
-
icon = /* @__PURE__ */
|
|
5968
|
+
icon = /* @__PURE__ */ React30.createElement(LoadingIcon, null);
|
|
5300
5969
|
} else if (showExpanderIcon) {
|
|
5301
|
-
const defaultIcon = /* @__PURE__ */
|
|
5970
|
+
const defaultIcon = /* @__PURE__ */ React30.createElement(ExpanderIcon, {
|
|
5302
5971
|
expanded: !collapsed,
|
|
5303
5972
|
onChange: () => {
|
|
5304
5973
|
if (!rowInfo.isGroupRow) {
|
|
@@ -5313,9 +5982,9 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
5313
5982
|
icon = column.renderGroupIcon(renderParam);
|
|
5314
5983
|
}
|
|
5315
5984
|
}
|
|
5316
|
-
return /* @__PURE__ */
|
|
5985
|
+
return /* @__PURE__ */ React30.createElement("div", {
|
|
5317
5986
|
className: join(display.flex, alignItems.center, GroupRowExpanderCls)
|
|
5318
|
-
}, icon, /* @__PURE__ */
|
|
5987
|
+
}, icon, /* @__PURE__ */ React30.createElement("div", {
|
|
5319
5988
|
className: cssEllipsisClassName
|
|
5320
5989
|
}, value != null ? value : null));
|
|
5321
5990
|
}
|
|
@@ -5331,11 +6000,11 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
5331
6000
|
}
|
|
5332
6001
|
|
|
5333
6002
|
// src/components/InfiniteTable/hooks/useEffectWithRaf.ts
|
|
5334
|
-
var
|
|
6003
|
+
var import_react34 = __toModule(require("react"));
|
|
5335
6004
|
function useEffectWithRaf(fn, deps) {
|
|
5336
|
-
const rafId = (0,
|
|
5337
|
-
const removeFnRaf = (0,
|
|
5338
|
-
(0,
|
|
6005
|
+
const rafId = (0, import_react34.useRef)(0);
|
|
6006
|
+
const removeFnRaf = (0, import_react34.useRef)();
|
|
6007
|
+
(0, import_react34.useEffect)(() => {
|
|
5339
6008
|
rafId.current = requestAnimationFrame(() => {
|
|
5340
6009
|
removeFnRaf.current = fn();
|
|
5341
6010
|
});
|
|
@@ -5352,7 +6021,7 @@ function useEffectWithRaf(fn, deps) {
|
|
|
5352
6021
|
}
|
|
5353
6022
|
|
|
5354
6023
|
// src/components/InfiniteTable/hooks/useToggleGroupRow.ts
|
|
5355
|
-
var
|
|
6024
|
+
var import_react37 = __toModule(require("react"));
|
|
5356
6025
|
|
|
5357
6026
|
// src/utils/groupAndPivot/index.ts
|
|
5358
6027
|
var LAZY_ROOT_KEY_FOR_GROUPS = "____root____";
|
|
@@ -5420,21 +6089,18 @@ function lazyGroup(groupParams, rootData) {
|
|
|
5420
6089
|
rootData.visitDepthFirst((lazyGroupRowInfo, keys, _index, next) => {
|
|
5421
6090
|
const [_rootKey, ...currentGroupKeys] = keys;
|
|
5422
6091
|
const dataArray = lazyGroupRowInfo.children;
|
|
5423
|
-
|
|
5424
|
-
|
|
5425
|
-
|
|
5426
|
-
|
|
5427
|
-
|
|
5428
|
-
|
|
6092
|
+
const current = deepMap.get(currentGroupKeys);
|
|
6093
|
+
if (current) {
|
|
6094
|
+
current.cache = lazyGroupRowInfo.cache;
|
|
6095
|
+
current.childrenLoading = lazyGroupRowInfo.childrenLoading;
|
|
6096
|
+
current.childrenAvailable = lazyGroupRowInfo.childrenAvailable;
|
|
6097
|
+
current.error = lazyGroupRowInfo.error;
|
|
5429
6098
|
}
|
|
5430
|
-
if (
|
|
5431
|
-
const current = deepMap.get(currentGroupKeys);
|
|
6099
|
+
if (currentGroupKeys.length == groupBy.length && groupBy.length) {
|
|
5432
6100
|
if (current) {
|
|
5433
|
-
current.
|
|
5434
|
-
current.childrenLoading = lazyGroupRowInfo.childrenLoading;
|
|
5435
|
-
current.childrenAvailable = lazyGroupRowInfo.childrenAvailable;
|
|
5436
|
-
current.error = lazyGroupRowInfo.error;
|
|
6101
|
+
current.items = dataArray;
|
|
5437
6102
|
}
|
|
6103
|
+
return next == null ? void 0 : next();
|
|
5438
6104
|
}
|
|
5439
6105
|
for (let i = 0, len = dataArray.length; i < len; i++) {
|
|
5440
6106
|
if (!dataArray[i]) {
|
|
@@ -5763,8 +6429,9 @@ function enhancedFlatten(param) {
|
|
|
5763
6429
|
}
|
|
5764
6430
|
for (let index = 0, len = items.length; index < len; index++) {
|
|
5765
6431
|
const item = items[index];
|
|
6432
|
+
const indexInAll = startIndex + index;
|
|
5766
6433
|
const rowInfo = {
|
|
5767
|
-
id: item ? toPrimaryKey(item) : `${groupKeys}-${index}`,
|
|
6434
|
+
id: item ? toPrimaryKey(item, indexInAll) : `${groupKeys}-${index}`,
|
|
5768
6435
|
data: item,
|
|
5769
6436
|
dataSourceHasGrouping: true,
|
|
5770
6437
|
isGroupRow: false,
|
|
@@ -5775,7 +6442,7 @@ function enhancedFlatten(param) {
|
|
|
5775
6442
|
parents: Array.from(parents),
|
|
5776
6443
|
indexInParentGroups: [...indexInParentGroups, index],
|
|
5777
6444
|
indexInGroup: index,
|
|
5778
|
-
indexInAll
|
|
6445
|
+
indexInAll,
|
|
5779
6446
|
groupBy: groupByStrings,
|
|
5780
6447
|
groupNesting,
|
|
5781
6448
|
groupCount: enhancedGroupData.groupCount
|
|
@@ -5807,7 +6474,7 @@ function enhancedFlatten(param) {
|
|
|
5807
6474
|
}
|
|
5808
6475
|
|
|
5809
6476
|
// src/components/DataSource/index.tsx
|
|
5810
|
-
var
|
|
6477
|
+
var React31 = __toModule(require("react"));
|
|
5811
6478
|
|
|
5812
6479
|
// src/utils/multisort/sortTypes.ts
|
|
5813
6480
|
var numberComparator = function(first, second) {
|
|
@@ -5818,11 +6485,11 @@ var stringComparator = function(first, second) {
|
|
|
5818
6485
|
second = `${second}`;
|
|
5819
6486
|
return first.localeCompare(second);
|
|
5820
6487
|
};
|
|
5821
|
-
var
|
|
6488
|
+
var defaultSortTypes = {
|
|
5822
6489
|
number: numberComparator,
|
|
5823
6490
|
string: stringComparator
|
|
5824
6491
|
};
|
|
5825
|
-
var sortTypes_default =
|
|
6492
|
+
var sortTypes_default = defaultSortTypes;
|
|
5826
6493
|
|
|
5827
6494
|
// src/utils/multisort/index.ts
|
|
5828
6495
|
var multisort = (sortInfo, array, get) => {
|
|
@@ -5835,7 +6502,8 @@ var getSingleSortFunction = (info) => {
|
|
|
5835
6502
|
return;
|
|
5836
6503
|
}
|
|
5837
6504
|
const field = info.field;
|
|
5838
|
-
|
|
6505
|
+
const valueGetter = info.valueGetter;
|
|
6506
|
+
const dir = info.dir < 0 ? -1 : info.dir > 0 ? 1 : 0;
|
|
5839
6507
|
if (!dir) {
|
|
5840
6508
|
return;
|
|
5841
6509
|
}
|
|
@@ -5846,53 +6514,163 @@ var getSingleSortFunction = (info) => {
|
|
|
5846
6514
|
console.warn(`Unknown sort type "${info.type}" - please pass one of ${Object.keys(multisort.knownTypes).join(", ")}`);
|
|
5847
6515
|
}
|
|
5848
6516
|
}
|
|
5849
|
-
if (!fn) {
|
|
5850
|
-
fn = sortTypes_default.string;
|
|
6517
|
+
if (!fn) {
|
|
6518
|
+
fn = sortTypes_default.string;
|
|
6519
|
+
}
|
|
6520
|
+
return (first, second) => {
|
|
6521
|
+
const a = valueGetter ? valueGetter(first) : field ? first[field] : first;
|
|
6522
|
+
const b = valueGetter ? valueGetter(second) : field ? second[field] : second;
|
|
6523
|
+
return dir * fn(a, b);
|
|
6524
|
+
};
|
|
6525
|
+
};
|
|
6526
|
+
var getSortFunctions = (sortInfo) => {
|
|
6527
|
+
return sortInfo.map(getSingleSortFunction).filter((fn) => fn instanceof Function);
|
|
6528
|
+
};
|
|
6529
|
+
var getMultisortFunction = (sortInfo, get) => {
|
|
6530
|
+
const fns = getSortFunctions(sortInfo);
|
|
6531
|
+
return (first, second) => {
|
|
6532
|
+
if (get) {
|
|
6533
|
+
first = get(first);
|
|
6534
|
+
second = get(second);
|
|
6535
|
+
}
|
|
6536
|
+
let result = 0;
|
|
6537
|
+
let i = 0;
|
|
6538
|
+
let fn;
|
|
6539
|
+
const len = fns.length;
|
|
6540
|
+
for (; i < len; i++) {
|
|
6541
|
+
fn = fns[i];
|
|
6542
|
+
if (!fn) {
|
|
6543
|
+
continue;
|
|
6544
|
+
}
|
|
6545
|
+
result = fn(first, second);
|
|
6546
|
+
if (result !== 0) {
|
|
6547
|
+
return result;
|
|
6548
|
+
}
|
|
6549
|
+
}
|
|
6550
|
+
return result;
|
|
6551
|
+
};
|
|
6552
|
+
};
|
|
6553
|
+
|
|
6554
|
+
// src/components/DataSource/GroupRowsState.ts
|
|
6555
|
+
var GroupRowsState = class {
|
|
6556
|
+
constructor(state) {
|
|
6557
|
+
this.update(state instanceof GroupRowsState ? state.getState() : state);
|
|
6558
|
+
}
|
|
6559
|
+
getState() {
|
|
6560
|
+
var _a, _b, _c, _d;
|
|
6561
|
+
return {
|
|
6562
|
+
expandedRows: this.expandedAll ? true : (_b = (_a = this.expandedMap) == null ? void 0 : _a.topDownKeys()) != null ? _b : [],
|
|
6563
|
+
collapsedRows: this.collapsedAll ? true : (_d = (_c = this.collapsedMap) == null ? void 0 : _c.topDownKeys()) != null ? _d : []
|
|
6564
|
+
};
|
|
6565
|
+
}
|
|
6566
|
+
destroy() {
|
|
6567
|
+
var _a, _b;
|
|
6568
|
+
(_a = this.expandedMap) == null ? void 0 : _a.clear();
|
|
6569
|
+
(_b = this.collapsedMap) == null ? void 0 : _b.clear();
|
|
6570
|
+
delete this.expandedMap;
|
|
6571
|
+
delete this.collapsedMap;
|
|
6572
|
+
}
|
|
6573
|
+
update(state) {
|
|
6574
|
+
var _a, _b, _c, _d;
|
|
6575
|
+
this.initialState = state;
|
|
6576
|
+
const { collapsedRows, expandedRows } = this.initialState;
|
|
6577
|
+
this.collapsedAll = collapsedRows === true;
|
|
6578
|
+
this.expandedAll = expandedRows === true;
|
|
6579
|
+
if (this.collapsedAll && this.expandedAll) {
|
|
6580
|
+
throw `Cannot have both collapsedRows and expandedRows be true!`;
|
|
6581
|
+
}
|
|
6582
|
+
if (collapsedRows !== true) {
|
|
6583
|
+
(_a = this.collapsedMap) == null ? void 0 : _a.clear();
|
|
6584
|
+
this.collapsedMap = (_b = this.collapsedMap) != null ? _b : new DeepMap(collapsedRows.map((keys) => [keys, true]));
|
|
6585
|
+
}
|
|
6586
|
+
if (expandedRows !== true) {
|
|
6587
|
+
(_c = this.expandedMap) == null ? void 0 : _c.clear();
|
|
6588
|
+
this.expandedMap = (_d = this.expandedMap) != null ? _d : new DeepMap(expandedRows.map((keys) => [keys, true]));
|
|
6589
|
+
}
|
|
6590
|
+
}
|
|
6591
|
+
areAllCollapsed() {
|
|
6592
|
+
return this.collapsedAll && (this.expandedMap ? this.expandedMap.size === 0 : true);
|
|
6593
|
+
}
|
|
6594
|
+
areAllExpanded() {
|
|
6595
|
+
return this.expandedAll && (this.collapsedMap ? this.collapsedMap.size === 0 : true);
|
|
6596
|
+
}
|
|
6597
|
+
collapseAll() {
|
|
6598
|
+
this.update({
|
|
6599
|
+
collapsedRows: true,
|
|
6600
|
+
expandedRows: []
|
|
6601
|
+
});
|
|
6602
|
+
}
|
|
6603
|
+
expandAll() {
|
|
6604
|
+
this.update({
|
|
6605
|
+
expandedRows: true,
|
|
6606
|
+
collapsedRows: []
|
|
6607
|
+
});
|
|
6608
|
+
}
|
|
6609
|
+
isGroupRowExpanded(keys) {
|
|
6610
|
+
var _a, _b;
|
|
6611
|
+
if (this.expandedAll === true) {
|
|
6612
|
+
if (this.collapsedAll === true) {
|
|
6613
|
+
throw 'Cannot have both expandedRows and collapsedRows be "true"';
|
|
6614
|
+
}
|
|
6615
|
+
return !((_a = this.collapsedMap) == null ? void 0 : _a.has(keys));
|
|
6616
|
+
}
|
|
6617
|
+
return (_b = this.expandedMap) == null ? void 0 : _b.has(keys);
|
|
6618
|
+
}
|
|
6619
|
+
isGroupRowCollapsed(keys) {
|
|
6620
|
+
return !this.isGroupRowExpanded(keys);
|
|
5851
6621
|
}
|
|
5852
|
-
|
|
5853
|
-
|
|
5854
|
-
|
|
5855
|
-
|
|
5856
|
-
};
|
|
5857
|
-
};
|
|
5858
|
-
var getSortFunctions = (sortInfo) => {
|
|
5859
|
-
return sortInfo.map(getSingleSortFunction).filter((fn) => fn instanceof Function);
|
|
5860
|
-
};
|
|
5861
|
-
var getMultisortFunction = (sortInfo, get) => {
|
|
5862
|
-
const fns = getSortFunctions(sortInfo);
|
|
5863
|
-
return (first, second) => {
|
|
5864
|
-
if (get) {
|
|
5865
|
-
first = get(first);
|
|
5866
|
-
second = get(second);
|
|
6622
|
+
setGroupRowExpanded(keys, shouldExpand) {
|
|
6623
|
+
var _a;
|
|
6624
|
+
if (shouldExpand === this.isGroupRowExpanded(keys)) {
|
|
6625
|
+
return;
|
|
5867
6626
|
}
|
|
5868
|
-
|
|
5869
|
-
|
|
5870
|
-
|
|
5871
|
-
|
|
5872
|
-
|
|
5873
|
-
|
|
5874
|
-
if (
|
|
5875
|
-
|
|
6627
|
+
if (shouldExpand) {
|
|
6628
|
+
if (this.collapsedAll === true) {
|
|
6629
|
+
if (!this.expandedMap) {
|
|
6630
|
+
throw `No expandedMap found when trying to expand group row ${keys.join(",")}`;
|
|
6631
|
+
}
|
|
6632
|
+
this.expandedMap.set(keys, true);
|
|
6633
|
+
} else if (this.expandedAll === true) {
|
|
6634
|
+
if (!this.collapsedMap) {
|
|
6635
|
+
throw `No collapsedMap found when trying to expand group row ${keys.join(",")}`;
|
|
6636
|
+
}
|
|
6637
|
+
this.collapsedMap.delete(keys);
|
|
5876
6638
|
}
|
|
5877
|
-
|
|
5878
|
-
if (
|
|
5879
|
-
|
|
6639
|
+
} else {
|
|
6640
|
+
if (this.expandedAll === true) {
|
|
6641
|
+
if (!this.collapsedMap) {
|
|
6642
|
+
throw `No collapsedMap found when trying to collapse group row ${keys.join(",")}`;
|
|
6643
|
+
}
|
|
6644
|
+
this.collapsedMap.set(keys, true);
|
|
6645
|
+
} else if (this.collapsedAll === true) {
|
|
6646
|
+
if (!this.expandedMap) {
|
|
6647
|
+
throw `No expandedMap found when trying to collapse group row ${keys.join(",")}`;
|
|
6648
|
+
}
|
|
6649
|
+
(_a = this.expandedMap) == null ? void 0 : _a.delete(keys);
|
|
5880
6650
|
}
|
|
5881
6651
|
}
|
|
5882
|
-
|
|
5883
|
-
|
|
6652
|
+
}
|
|
6653
|
+
collapseGroupRow(keys) {
|
|
6654
|
+
this.setGroupRowExpanded(keys, false);
|
|
6655
|
+
}
|
|
6656
|
+
expandGroupRow(keys) {
|
|
6657
|
+
this.setGroupRowExpanded(keys, true);
|
|
6658
|
+
}
|
|
6659
|
+
toggleGroupRow(keys) {
|
|
6660
|
+
this.setGroupRowExpanded(keys, !this.isGroupRowExpanded(keys));
|
|
6661
|
+
}
|
|
5884
6662
|
};
|
|
5885
6663
|
|
|
5886
6664
|
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
5887
|
-
var
|
|
6665
|
+
var import_react36 = __toModule(require("react"));
|
|
5888
6666
|
|
|
5889
6667
|
// src/components/hooks/useEffectWithChanges.ts
|
|
5890
|
-
var
|
|
6668
|
+
var import_react35 = __toModule(require("react"));
|
|
5891
6669
|
function useEffectWithChanges(fn, deps) {
|
|
5892
|
-
const prevRef = (0,
|
|
5893
|
-
const oldValuesRef = (0,
|
|
6670
|
+
const prevRef = (0, import_react35.useRef)({});
|
|
6671
|
+
const oldValuesRef = (0, import_react35.useRef)({});
|
|
5894
6672
|
const oldValues = oldValuesRef.current;
|
|
5895
|
-
const changesRef = (0,
|
|
6673
|
+
const changesRef = (0, import_react35.useRef)({});
|
|
5896
6674
|
const changes = changesRef.current;
|
|
5897
6675
|
const useEffectDeps = [];
|
|
5898
6676
|
for (const k in deps) {
|
|
@@ -5905,7 +6683,7 @@ function useEffectWithChanges(fn, deps) {
|
|
|
5905
6683
|
}
|
|
5906
6684
|
}
|
|
5907
6685
|
prevRef.current = deps;
|
|
5908
|
-
(0,
|
|
6686
|
+
(0, import_react35.useEffect)(() => {
|
|
5909
6687
|
const changes2 = changesRef.current;
|
|
5910
6688
|
const result = fn(changes2, oldValues);
|
|
5911
6689
|
changesRef.current = {};
|
|
@@ -5958,6 +6736,7 @@ function buildDataSourceDataParams(componentState, overrides) {
|
|
|
5958
6736
|
sortInfo,
|
|
5959
6737
|
groupBy: componentState.groupBy,
|
|
5960
6738
|
pivotBy: componentState.pivotBy,
|
|
6739
|
+
filterValue: componentState.filterValue,
|
|
5961
6740
|
aggregationReducers: componentState.aggregationReducers
|
|
5962
6741
|
};
|
|
5963
6742
|
if (dataSourceParams.groupBy) {
|
|
@@ -5977,6 +6756,13 @@ function buildDataSourceDataParams(componentState, overrides) {
|
|
|
5977
6756
|
if (overrides) {
|
|
5978
6757
|
Object.assign(dataSourceParams, overrides);
|
|
5979
6758
|
}
|
|
6759
|
+
if (dataSourceParams.filterValue && dataSourceParams.filterValue.length) {
|
|
6760
|
+
dataSourceParams.filterValue = dataSourceParams.filterValue.map((f) => {
|
|
6761
|
+
const value = __spreadValues({}, f);
|
|
6762
|
+
delete value.valueGetter;
|
|
6763
|
+
return value;
|
|
6764
|
+
});
|
|
6765
|
+
}
|
|
5980
6766
|
const changes = {};
|
|
5981
6767
|
const oldDataSourceParams = componentState.dataParams || {};
|
|
5982
6768
|
for (const k in dataSourceParams) {
|
|
@@ -5997,6 +6783,13 @@ function loadData(data, componentState, actions, overrides) {
|
|
|
5997
6783
|
const lazyGroupData = componentState.originalLazyGroupData;
|
|
5998
6784
|
const key = [LAZY_ROOT_KEY_FOR_GROUPS, ...dataParams.groupKeys || []];
|
|
5999
6785
|
const existingGroupRowInfo = lazyGroupData.get(key);
|
|
6786
|
+
if (!existingGroupRowInfo) {
|
|
6787
|
+
const groupCacheKeys = [
|
|
6788
|
+
...dataParams.groupKeys || [],
|
|
6789
|
+
dataParams.lazyLoadStartIndex
|
|
6790
|
+
];
|
|
6791
|
+
componentState.lazyLoadCacheOfLoadedBatches.set(groupCacheKeys, true);
|
|
6792
|
+
}
|
|
6000
6793
|
if (existingGroupRowInfo && existingGroupRowInfo.cache && key.length > 1) {
|
|
6001
6794
|
const items = existingGroupRowInfo.children;
|
|
6002
6795
|
const len = items.length;
|
|
@@ -6022,7 +6815,8 @@ function loadData(data, componentState, actions, overrides) {
|
|
|
6022
6815
|
childrenLoading: true,
|
|
6023
6816
|
childrenAvailable: false,
|
|
6024
6817
|
cache: CACHE_DEFAULT,
|
|
6025
|
-
totalCount: 0
|
|
6818
|
+
totalCount: 0,
|
|
6819
|
+
totalCountUnfiltered: 0
|
|
6026
6820
|
});
|
|
6027
6821
|
}
|
|
6028
6822
|
actions.originalLazyGroupDataChangeDetect = getChangeDetect();
|
|
@@ -6046,9 +6840,12 @@ function loadData(data, componentState, actions, overrides) {
|
|
|
6046
6840
|
if (remoteData.mappings) {
|
|
6047
6841
|
actions.pivotMappings = remoteData.mappings;
|
|
6048
6842
|
}
|
|
6843
|
+
if (remoteData.totalCountUnfiltered) {
|
|
6844
|
+
actions.unfilteredCount = remoteData.totalCountUnfiltered;
|
|
6845
|
+
}
|
|
6049
6846
|
if (componentState.lazyLoad) {
|
|
6050
6847
|
let resolveRemoteData = function(keys, remoteData2, parentKeys) {
|
|
6051
|
-
var _a, _b, _c;
|
|
6848
|
+
var _a, _b, _c, _d;
|
|
6052
6849
|
const theKey = [LAZY_ROOT_KEY_FOR_GROUPS, ...keys];
|
|
6053
6850
|
const dataArray2 = remoteData2.data;
|
|
6054
6851
|
const newGroupRowInfo = {
|
|
@@ -6056,6 +6853,7 @@ function loadData(data, componentState, actions, overrides) {
|
|
|
6056
6853
|
childrenLoading: false,
|
|
6057
6854
|
childrenAvailable: true,
|
|
6058
6855
|
totalCount: (_a = remoteData2.totalCount) != null ? _a : dataArray2.length,
|
|
6856
|
+
totalCountUnfiltered: (_b = remoteData2.totalCount) != null ? _b : dataArray2.length,
|
|
6059
6857
|
children: dataArray2,
|
|
6060
6858
|
error: remoteData2.error
|
|
6061
6859
|
};
|
|
@@ -6070,8 +6868,8 @@ function loadData(data, componentState, actions, overrides) {
|
|
|
6070
6868
|
currentGroupRowInfo.chidren = [];
|
|
6071
6869
|
}
|
|
6072
6870
|
currentGroupRowInfo.children.length = currentGroupRowInfo.totalCount;
|
|
6073
|
-
const start = (
|
|
6074
|
-
const end = Math.min((
|
|
6871
|
+
const start = (_c = dataParams.lazyLoadStartIndex) != null ? _c : 0;
|
|
6872
|
+
const end = Math.min((_d = remoteData2.totalCount) != null ? _d : dataArray2.length, start + dataParams.lazyLoadBatchSize);
|
|
6075
6873
|
for (let i = start; i < end; i++) {
|
|
6076
6874
|
const it = newGroupRowInfo.children[i - start];
|
|
6077
6875
|
if (!it) {
|
|
@@ -6148,16 +6946,17 @@ function useLoadData() {
|
|
|
6148
6946
|
sortInfo,
|
|
6149
6947
|
groupBy,
|
|
6150
6948
|
pivotBy,
|
|
6949
|
+
filterValue,
|
|
6151
6950
|
livePagination,
|
|
6152
6951
|
livePaginationCursor,
|
|
6153
6952
|
cursorId: stateCursorId
|
|
6154
6953
|
} = componentState;
|
|
6155
|
-
const [scrollbars, setScrollbars] = (0,
|
|
6954
|
+
const [scrollbars, setScrollbars] = (0, import_react36.useState)({
|
|
6156
6955
|
vertical: false,
|
|
6157
6956
|
horizontal: false
|
|
6158
6957
|
});
|
|
6159
|
-
const scrollbarsRef = (0,
|
|
6160
|
-
(0,
|
|
6958
|
+
const scrollbarsRef = (0, import_react36.useRef)(scrollbars);
|
|
6959
|
+
(0, import_react36.useEffect)(() => {
|
|
6161
6960
|
notifyScrollbarsChange.onChange((scrollbars2) => {
|
|
6162
6961
|
if (!scrollbars2) {
|
|
6163
6962
|
return;
|
|
@@ -6167,7 +6966,7 @@ function useLoadData() {
|
|
|
6167
6966
|
});
|
|
6168
6967
|
return () => notifyScrollbarsChange.destroy();
|
|
6169
6968
|
}, [notifyScrollbarsChange]);
|
|
6170
|
-
(0,
|
|
6969
|
+
(0, import_react36.useEffect)(() => {
|
|
6171
6970
|
if (!livePagination) {
|
|
6172
6971
|
return;
|
|
6173
6972
|
}
|
|
@@ -6181,7 +6980,7 @@ function useLoadData() {
|
|
|
6181
6980
|
});
|
|
6182
6981
|
return () => cancelAnimationFrame(frameId);
|
|
6183
6982
|
}, [livePaginationCursor]);
|
|
6184
|
-
(0,
|
|
6983
|
+
(0, import_react36.useEffect)(() => {
|
|
6185
6984
|
if (!livePagination || livePaginationCursor !== void 0) {
|
|
6186
6985
|
return;
|
|
6187
6986
|
}
|
|
@@ -6195,7 +6994,7 @@ function useLoadData() {
|
|
|
6195
6994
|
});
|
|
6196
6995
|
return () => cancelAnimationFrame(frameId);
|
|
6197
6996
|
}, [dataArray.length, livePaginationCursor]);
|
|
6198
|
-
(0,
|
|
6997
|
+
(0, import_react36.useEffect)(() => {
|
|
6199
6998
|
const state = getComponentState();
|
|
6200
6999
|
const { livePaginationCursor: livePaginationCursor2, livePagination: livePagination2, dataArray: dataArray2 } = state;
|
|
6201
7000
|
if (!scrollbars.vertical && livePagination2) {
|
|
@@ -6210,9 +7009,10 @@ function useLoadData() {
|
|
|
6210
7009
|
sortInfo,
|
|
6211
7010
|
groupBy,
|
|
6212
7011
|
pivotBy,
|
|
7012
|
+
filterValue,
|
|
6213
7013
|
cursorId: livePagination ? stateCursorId : null
|
|
6214
7014
|
};
|
|
6215
|
-
const initialRef = (0,
|
|
7015
|
+
const initialRef = (0, import_react36.useRef)(true);
|
|
6216
7016
|
useLazyLoadRange();
|
|
6217
7017
|
useEffectWithChanges(() => {
|
|
6218
7018
|
const componentState2 = getComponentState();
|
|
@@ -6244,7 +7044,7 @@ function useLazyLoadRange() {
|
|
|
6244
7044
|
componentActions: actions,
|
|
6245
7045
|
componentState
|
|
6246
7046
|
} = useComponentState();
|
|
6247
|
-
(0,
|
|
7047
|
+
(0, import_react36.useEffect)(() => {
|
|
6248
7048
|
actions.lazyLoadCacheOfLoadedBatches = new DeepMap();
|
|
6249
7049
|
}, [componentState.data, componentState.dataParams]);
|
|
6250
7050
|
const {
|
|
@@ -6253,7 +7053,7 @@ function useLazyLoadRange() {
|
|
|
6253
7053
|
dataArray,
|
|
6254
7054
|
scrollStopDelayUpdatedByTable
|
|
6255
7055
|
} = componentState;
|
|
6256
|
-
const latestRenderRangeRef = (0,
|
|
7056
|
+
const latestRenderRangeRef = (0, import_react36.useRef)(null);
|
|
6257
7057
|
const loadRange = (renderRange, cache = getComponentState().lazyLoadCacheOfLoadedBatches) => {
|
|
6258
7058
|
const componentState2 = getComponentState();
|
|
6259
7059
|
renderRange = renderRange || latestRenderRangeRef.current;
|
|
@@ -6272,8 +7072,8 @@ function useLazyLoadRange() {
|
|
|
6272
7072
|
componentActions: actions
|
|
6273
7073
|
}, cache);
|
|
6274
7074
|
};
|
|
6275
|
-
const debouncedLoadRange = (0,
|
|
6276
|
-
(0,
|
|
7075
|
+
const debouncedLoadRange = (0, import_react36.useMemo)(() => debounce(loadRange, { wait: scrollStopDelayUpdatedByTable }), [scrollStopDelayUpdatedByTable]);
|
|
7076
|
+
(0, import_react36.useEffect)(() => {
|
|
6277
7077
|
if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
|
|
6278
7078
|
return notifyRenderRangeChange.onChange((renderRange) => {
|
|
6279
7079
|
latestRenderRangeRef.current = renderRange;
|
|
@@ -6282,7 +7082,7 @@ function useLazyLoadRange() {
|
|
|
6282
7082
|
}
|
|
6283
7083
|
return;
|
|
6284
7084
|
}, [lazyLoadBatchSize]);
|
|
6285
|
-
(0,
|
|
7085
|
+
(0, import_react36.useEffect)(() => {
|
|
6286
7086
|
if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
|
|
6287
7087
|
debouncedLoadRange();
|
|
6288
7088
|
}
|
|
@@ -6315,7 +7115,7 @@ function lazyLoadRange(options, cache) {
|
|
|
6315
7115
|
theGroupKeys.pop();
|
|
6316
7116
|
}
|
|
6317
7117
|
const cacheKeys = theGroupKeys.length ? theGroupKeys : rootGroupKeys;
|
|
6318
|
-
const indexInGroup = rowInfo.
|
|
7118
|
+
const indexInGroup = rowInfo.dataSourceHasGrouping ? rowInfo.indexInGroup : rowInfo.indexInAll;
|
|
6319
7119
|
if (rowInfo.isGroupRow && !rowInfo.collapsed && !rowInfo.childrenAvailable) {
|
|
6320
7120
|
const currentFnCall = {
|
|
6321
7121
|
lazyLoadStartIndex: 0,
|
|
@@ -6338,7 +7138,7 @@ function lazyLoadRange(options, cache) {
|
|
|
6338
7138
|
if (!rowLoaded) {
|
|
6339
7139
|
let cachedFnCalls = perGroupFnCalls.get(cacheKeys);
|
|
6340
7140
|
const batchStartIndexInGroup = Math.floor(indexInGroup / lazyLoadBatchSize) * lazyLoadBatchSize;
|
|
6341
|
-
const offset =
|
|
7141
|
+
const offset = indexInGroup - batchStartIndexInGroup;
|
|
6342
7142
|
const absoluteIndexOfBatchStart = dataArray[rowInfo.indexInAll - offset].indexInAll;
|
|
6343
7143
|
const batchStartRowLoaded = isRowLoaded(absoluteIndexOfBatchStart);
|
|
6344
7144
|
const batchStartRowId = dataArray[absoluteIndexOfBatchStart].id;
|
|
@@ -6360,191 +7160,81 @@ function lazyLoadRange(options, cache) {
|
|
|
6360
7160
|
}
|
|
6361
7161
|
}
|
|
6362
7162
|
}
|
|
6363
|
-
const initialPromise = Promise.resolve(true);
|
|
6364
|
-
const allFnCalls = [];
|
|
6365
|
-
perGroupFnCalls.topDownValues().forEach((record) => {
|
|
6366
|
-
allFnCalls.push(...Object.values(record));
|
|
6367
|
-
});
|
|
6368
|
-
allFnCalls.reduce((promise, fnCall) => {
|
|
6369
|
-
const cacheKey = [...fnCall.groupKeys, fnCall.lazyLoadStartIndex];
|
|
6370
|
-
if (cache && cache.has(cacheKey)) {
|
|
6371
|
-
return promise;
|
|
6372
|
-
}
|
|
6373
|
-
cache == null ? void 0 : cache.set(cacheKey, true);
|
|
6374
|
-
const args = [componentState.data, componentState, componentActions, fnCall];
|
|
6375
|
-
return promise.then(() => getRafPromise()).then(() => loadData(...args));
|
|
6376
|
-
}, initialPromise);
|
|
6377
|
-
}
|
|
6378
|
-
|
|
6379
|
-
// src/utils/shallowEqualObjects.ts
|
|
6380
|
-
function shallowEqualObjects(objA, objB, ignoreKeys) {
|
|
6381
|
-
if (objA === objB) {
|
|
6382
|
-
return true;
|
|
6383
|
-
}
|
|
6384
|
-
if (!objA || !objB) {
|
|
6385
|
-
return false;
|
|
6386
|
-
}
|
|
6387
|
-
var aKeys = Object.keys(objA);
|
|
6388
|
-
var bKeys = Object.keys(objB);
|
|
6389
|
-
if (ignoreKeys) {
|
|
6390
|
-
aKeys = aKeys.filter((key2) => !ignoreKeys.has(key2));
|
|
6391
|
-
bKeys = bKeys.filter((key2) => !ignoreKeys.has(key2));
|
|
6392
|
-
}
|
|
6393
|
-
var len = aKeys.length;
|
|
6394
|
-
if (bKeys.length !== len) {
|
|
6395
|
-
return false;
|
|
6396
|
-
}
|
|
6397
|
-
for (var i = 0; i < len; i++) {
|
|
6398
|
-
var key = aKeys[i];
|
|
6399
|
-
if (ignoreKeys) {
|
|
6400
|
-
if (ignoreKeys.has(key)) {
|
|
6401
|
-
continue;
|
|
6402
|
-
}
|
|
6403
|
-
}
|
|
6404
|
-
if (objA[key] !== objB[key] || !Object.prototype.hasOwnProperty.call(objB, key)) {
|
|
6405
|
-
return false;
|
|
6406
|
-
}
|
|
6407
|
-
}
|
|
6408
|
-
return true;
|
|
6409
|
-
}
|
|
6410
|
-
|
|
6411
|
-
// src/components/utils/discardCallsWithEqualArg.ts
|
|
6412
|
-
var map = new WeakMap();
|
|
6413
|
-
var getCompareDefault = (a) => a;
|
|
6414
|
-
function discardCallsWithEqualArg(fn, timeframe = 50, getCompareObject) {
|
|
6415
|
-
map.set(fn, {
|
|
6416
|
-
lastCallTime: 0,
|
|
6417
|
-
lastCallArg: null
|
|
6418
|
-
});
|
|
6419
|
-
const getCompare = getCompareObject != null ? getCompareObject : getCompareDefault;
|
|
6420
|
-
return (arg) => {
|
|
6421
|
-
const { lastCallTime, lastCallArg } = map.get(fn) || {
|
|
6422
|
-
lastCallTime: 0,
|
|
6423
|
-
lastCallArg: null
|
|
6424
|
-
};
|
|
6425
|
-
const now = Date.now();
|
|
6426
|
-
const diff = now - lastCallTime;
|
|
6427
|
-
const objectsEqual = shallowEqualObjects(getCompare(lastCallArg), getCompare(arg));
|
|
6428
|
-
if (diff < timeframe && objectsEqual) {
|
|
6429
|
-
return;
|
|
6430
|
-
}
|
|
6431
|
-
map.set(fn, {
|
|
6432
|
-
lastCallTime: now,
|
|
6433
|
-
lastCallArg: arg
|
|
6434
|
-
});
|
|
6435
|
-
fn(arg);
|
|
6436
|
-
};
|
|
6437
|
-
}
|
|
6438
|
-
|
|
6439
|
-
// src/components/DataSource/GroupRowsState.ts
|
|
6440
|
-
var GroupRowsState = class {
|
|
6441
|
-
constructor(state) {
|
|
6442
|
-
this.update(state instanceof GroupRowsState ? state.getState() : state);
|
|
6443
|
-
}
|
|
6444
|
-
getState() {
|
|
6445
|
-
var _a, _b, _c, _d;
|
|
6446
|
-
return {
|
|
6447
|
-
expandedRows: this.expandedAll ? true : (_b = (_a = this.expandedMap) == null ? void 0 : _a.topDownKeys()) != null ? _b : [],
|
|
6448
|
-
collapsedRows: this.collapsedAll ? true : (_d = (_c = this.collapsedMap) == null ? void 0 : _c.topDownKeys()) != null ? _d : []
|
|
6449
|
-
};
|
|
6450
|
-
}
|
|
6451
|
-
destroy() {
|
|
6452
|
-
var _a, _b;
|
|
6453
|
-
(_a = this.expandedMap) == null ? void 0 : _a.clear();
|
|
6454
|
-
(_b = this.collapsedMap) == null ? void 0 : _b.clear();
|
|
6455
|
-
delete this.expandedMap;
|
|
6456
|
-
delete this.collapsedMap;
|
|
6457
|
-
}
|
|
6458
|
-
update(state) {
|
|
6459
|
-
var _a, _b, _c, _d;
|
|
6460
|
-
this.initialState = state;
|
|
6461
|
-
const { collapsedRows, expandedRows } = this.initialState;
|
|
6462
|
-
this.collapsedAll = collapsedRows === true;
|
|
6463
|
-
this.expandedAll = expandedRows === true;
|
|
6464
|
-
if (this.collapsedAll && this.expandedAll) {
|
|
6465
|
-
throw `Cannot have both collapsedRows and expandedRows be true!`;
|
|
6466
|
-
}
|
|
6467
|
-
if (collapsedRows !== true) {
|
|
6468
|
-
(_a = this.collapsedMap) == null ? void 0 : _a.clear();
|
|
6469
|
-
this.collapsedMap = (_b = this.collapsedMap) != null ? _b : new DeepMap(collapsedRows.map((keys) => [keys, true]));
|
|
6470
|
-
}
|
|
6471
|
-
if (expandedRows !== true) {
|
|
6472
|
-
(_c = this.expandedMap) == null ? void 0 : _c.clear();
|
|
6473
|
-
this.expandedMap = (_d = this.expandedMap) != null ? _d : new DeepMap(expandedRows.map((keys) => [keys, true]));
|
|
6474
|
-
}
|
|
6475
|
-
}
|
|
6476
|
-
areAllCollapsed() {
|
|
6477
|
-
return this.collapsedAll && (this.expandedMap ? this.expandedMap.size === 0 : true);
|
|
6478
|
-
}
|
|
6479
|
-
areAllExpanded() {
|
|
6480
|
-
return this.expandedAll && (this.collapsedMap ? this.collapsedMap.size === 0 : true);
|
|
6481
|
-
}
|
|
6482
|
-
collapseAll() {
|
|
6483
|
-
this.update({
|
|
6484
|
-
collapsedRows: true,
|
|
6485
|
-
expandedRows: []
|
|
6486
|
-
});
|
|
6487
|
-
}
|
|
6488
|
-
expandAll() {
|
|
6489
|
-
this.update({
|
|
6490
|
-
expandedRows: true,
|
|
6491
|
-
collapsedRows: []
|
|
6492
|
-
});
|
|
6493
|
-
}
|
|
6494
|
-
isGroupRowExpanded(keys) {
|
|
6495
|
-
var _a, _b;
|
|
6496
|
-
if (this.expandedAll === true) {
|
|
6497
|
-
if (this.collapsedAll === true) {
|
|
6498
|
-
throw 'Cannot have both expandedRows and collapsedRows be "true"';
|
|
6499
|
-
}
|
|
6500
|
-
return !((_a = this.collapsedMap) == null ? void 0 : _a.has(keys));
|
|
6501
|
-
}
|
|
6502
|
-
return (_b = this.expandedMap) == null ? void 0 : _b.has(keys);
|
|
6503
|
-
}
|
|
6504
|
-
isGroupRowCollapsed(keys) {
|
|
6505
|
-
return !this.isGroupRowExpanded(keys);
|
|
6506
|
-
}
|
|
6507
|
-
setGroupRowExpanded(keys, shouldExpand) {
|
|
6508
|
-
var _a;
|
|
6509
|
-
if (shouldExpand === this.isGroupRowExpanded(keys)) {
|
|
6510
|
-
return;
|
|
6511
|
-
}
|
|
6512
|
-
if (shouldExpand) {
|
|
6513
|
-
if (this.collapsedAll === true) {
|
|
6514
|
-
if (!this.expandedMap) {
|
|
6515
|
-
throw `No expandedMap found when trying to expand group row ${keys.join(",")}`;
|
|
6516
|
-
}
|
|
6517
|
-
this.expandedMap.set(keys, true);
|
|
6518
|
-
} else if (this.expandedAll === true) {
|
|
6519
|
-
if (!this.collapsedMap) {
|
|
6520
|
-
throw `No collapsedMap found when trying to expand group row ${keys.join(",")}`;
|
|
6521
|
-
}
|
|
6522
|
-
this.collapsedMap.delete(keys);
|
|
6523
|
-
}
|
|
6524
|
-
} else {
|
|
6525
|
-
if (this.expandedAll === true) {
|
|
6526
|
-
if (!this.collapsedMap) {
|
|
6527
|
-
throw `No collapsedMap found when trying to collapse group row ${keys.join(",")}`;
|
|
6528
|
-
}
|
|
6529
|
-
this.collapsedMap.set(keys, true);
|
|
6530
|
-
} else if (this.collapsedAll === true) {
|
|
6531
|
-
if (!this.expandedMap) {
|
|
6532
|
-
throw `No expandedMap found when trying to collapse group row ${keys.join(",")}`;
|
|
6533
|
-
}
|
|
6534
|
-
(_a = this.expandedMap) == null ? void 0 : _a.delete(keys);
|
|
6535
|
-
}
|
|
6536
|
-
}
|
|
6537
|
-
}
|
|
6538
|
-
collapseGroupRow(keys) {
|
|
6539
|
-
this.setGroupRowExpanded(keys, false);
|
|
7163
|
+
const initialPromise = Promise.resolve(true);
|
|
7164
|
+
const allFnCalls = [];
|
|
7165
|
+
perGroupFnCalls.topDownValues().forEach((record) => {
|
|
7166
|
+
allFnCalls.push(...Object.values(record));
|
|
7167
|
+
});
|
|
7168
|
+
allFnCalls.reduce((promise, fnCall) => {
|
|
7169
|
+
const cacheKey = [...fnCall.groupKeys, fnCall.lazyLoadStartIndex];
|
|
7170
|
+
if (cache && cache.has(cacheKey)) {
|
|
7171
|
+
return promise;
|
|
7172
|
+
}
|
|
7173
|
+
cache == null ? void 0 : cache.set(cacheKey, true);
|
|
7174
|
+
const args = [componentState.data, componentState, componentActions, fnCall];
|
|
7175
|
+
return promise.then(() => getRafPromise()).then(() => loadData(...args));
|
|
7176
|
+
}, initialPromise);
|
|
7177
|
+
}
|
|
7178
|
+
|
|
7179
|
+
// src/utils/shallowEqualObjects.ts
|
|
7180
|
+
function shallowEqualObjects(objA, objB, ignoreKeys) {
|
|
7181
|
+
if (objA === objB) {
|
|
7182
|
+
return true;
|
|
6540
7183
|
}
|
|
6541
|
-
|
|
6542
|
-
|
|
7184
|
+
if (!objA || !objB) {
|
|
7185
|
+
return false;
|
|
6543
7186
|
}
|
|
6544
|
-
|
|
6545
|
-
|
|
7187
|
+
var aKeys = Object.keys(objA);
|
|
7188
|
+
var bKeys = Object.keys(objB);
|
|
7189
|
+
if (ignoreKeys) {
|
|
7190
|
+
aKeys = aKeys.filter((key2) => !ignoreKeys.has(key2));
|
|
7191
|
+
bKeys = bKeys.filter((key2) => !ignoreKeys.has(key2));
|
|
6546
7192
|
}
|
|
6547
|
-
|
|
7193
|
+
var len = aKeys.length;
|
|
7194
|
+
if (bKeys.length !== len) {
|
|
7195
|
+
return false;
|
|
7196
|
+
}
|
|
7197
|
+
for (var i = 0; i < len; i++) {
|
|
7198
|
+
var key = aKeys[i];
|
|
7199
|
+
if (ignoreKeys) {
|
|
7200
|
+
if (ignoreKeys.has(key)) {
|
|
7201
|
+
continue;
|
|
7202
|
+
}
|
|
7203
|
+
}
|
|
7204
|
+
if (objA[key] !== objB[key] || !Object.prototype.hasOwnProperty.call(objB, key)) {
|
|
7205
|
+
return false;
|
|
7206
|
+
}
|
|
7207
|
+
}
|
|
7208
|
+
return true;
|
|
7209
|
+
}
|
|
7210
|
+
|
|
7211
|
+
// src/components/utils/discardCallsWithEqualArg.ts
|
|
7212
|
+
var map = new WeakMap();
|
|
7213
|
+
var getCompareDefault = (a) => a;
|
|
7214
|
+
function discardCallsWithEqualArg(fn, timeframe = 50, getCompareObject) {
|
|
7215
|
+
map.set(fn, {
|
|
7216
|
+
lastCallTime: 0,
|
|
7217
|
+
lastCallArg: null
|
|
7218
|
+
});
|
|
7219
|
+
const getCompare = getCompareObject != null ? getCompareObject : getCompareDefault;
|
|
7220
|
+
return (arg) => {
|
|
7221
|
+
const { lastCallTime, lastCallArg } = map.get(fn) || {
|
|
7222
|
+
lastCallTime: 0,
|
|
7223
|
+
lastCallArg: null
|
|
7224
|
+
};
|
|
7225
|
+
const now = Date.now();
|
|
7226
|
+
const diff = now - lastCallTime;
|
|
7227
|
+
const objectsEqual = shallowEqualObjects(getCompare(lastCallArg), getCompare(arg));
|
|
7228
|
+
if (diff < timeframe && objectsEqual) {
|
|
7229
|
+
return;
|
|
7230
|
+
}
|
|
7231
|
+
map.set(fn, {
|
|
7232
|
+
lastCallTime: now,
|
|
7233
|
+
lastCallArg: arg
|
|
7234
|
+
});
|
|
7235
|
+
fn(arg);
|
|
7236
|
+
};
|
|
7237
|
+
}
|
|
6548
7238
|
|
|
6549
7239
|
// src/components/DataSource/state/normalizeSortInfo.ts
|
|
6550
7240
|
var EMPTY_ARRAY = Object.freeze([]);
|
|
@@ -6591,9 +7281,12 @@ function initSetupState() {
|
|
|
6591
7281
|
pivotColumns: void 0,
|
|
6592
7282
|
pivotColumnGroups: void 0,
|
|
6593
7283
|
dataArray,
|
|
7284
|
+
unfilteredCount: dataArray.length,
|
|
7285
|
+
filteredCount: dataArray.length,
|
|
6594
7286
|
updatedAt: now,
|
|
6595
7287
|
groupedAt: 0,
|
|
6596
7288
|
sortedAt: 0,
|
|
7289
|
+
filteredAt: 0,
|
|
6597
7290
|
reducedAt: now,
|
|
6598
7291
|
generateGroupRows: true,
|
|
6599
7292
|
groupDeepMap: void 0,
|
|
@@ -6616,6 +7309,16 @@ var forwardProps2 = (setupState) => {
|
|
|
6616
7309
|
pivotBy: 1,
|
|
6617
7310
|
primaryKey: 1,
|
|
6618
7311
|
livePagination: 1,
|
|
7312
|
+
filterFunction: 1,
|
|
7313
|
+
filterValue: 1,
|
|
7314
|
+
filterDelay: (filterDelay) => filterDelay != null ? filterDelay : 200,
|
|
7315
|
+
filterTypes: (filterTypes) => {
|
|
7316
|
+
return __spreadValues(__spreadValues({}, defaultFilterTypes), filterTypes);
|
|
7317
|
+
},
|
|
7318
|
+
sortTypes: (sortTypes) => {
|
|
7319
|
+
return __spreadValues(__spreadValues({}, sortTypes_default), sortTypes);
|
|
7320
|
+
},
|
|
7321
|
+
sortMode: (sortMode) => sortMode != null ? sortMode : "local",
|
|
6619
7322
|
aggregationReducers: 1,
|
|
6620
7323
|
collapseGroupRowsOnDataFunctionChange: (collapseGroupRowsOnDataFunctionChange) => collapseGroupRowsOnDataFunctionChange != null ? collapseGroupRowsOnDataFunctionChange : true,
|
|
6621
7324
|
loading: (loading) => loading != null ? loading : false,
|
|
@@ -6641,10 +7344,25 @@ function getLivePaginationCursorValue(livePaginationCursorProp, state) {
|
|
|
6641
7344
|
return livePaginationCursor;
|
|
6642
7345
|
}
|
|
6643
7346
|
function mapPropsToState(params) {
|
|
7347
|
+
var _a;
|
|
6644
7348
|
const { props, state, oldState } = params;
|
|
6645
7349
|
const controlledSort = isControlledValue(props.sortInfo);
|
|
7350
|
+
const controlledFilter = isControlledValue(props.filterValue);
|
|
7351
|
+
const { filterTypes } = state;
|
|
7352
|
+
const operatorsByFilterType = Object.keys(filterTypes).reduce((acc, key) => {
|
|
7353
|
+
const operators = filterTypes[key].operators;
|
|
7354
|
+
acc[key] = acc[key] || {};
|
|
7355
|
+
const currentFilterTypeOperators = acc[key];
|
|
7356
|
+
operators.forEach((operator) => {
|
|
7357
|
+
currentFilterTypeOperators[operator.name] = operator;
|
|
7358
|
+
});
|
|
7359
|
+
return acc;
|
|
7360
|
+
}, {});
|
|
6646
7361
|
const result = {
|
|
7362
|
+
operatorsByFilterType,
|
|
6647
7363
|
controlledSort,
|
|
7364
|
+
controlledFilter,
|
|
7365
|
+
filterMode: ((_a = props.filterMode) != null ? _a : props.filterFunction != null) ? "local" : typeof props.data === "function" ? "remote" : "local",
|
|
6648
7366
|
multiSort: Array.isArray(controlledSort ? props.sortInfo : props.defaultSortInfo),
|
|
6649
7367
|
lazyLoadBatchSize: typeof props.lazyLoad === "object" ? props.lazyLoad.batchSize : void 0
|
|
6650
7368
|
};
|
|
@@ -6709,6 +7427,18 @@ function getInterceptActions() {
|
|
|
6709
7427
|
});
|
|
6710
7428
|
}
|
|
6711
7429
|
},
|
|
7430
|
+
filterValue: (filterValue, { actions, state }) => {
|
|
7431
|
+
const dataParams = buildDataSourceDataParams(state, {
|
|
7432
|
+
filterValue,
|
|
7433
|
+
livePaginationCursor: null
|
|
7434
|
+
});
|
|
7435
|
+
actions.dataParams = dataParams;
|
|
7436
|
+
if (state.livePagination) {
|
|
7437
|
+
requestAnimationFrame(() => {
|
|
7438
|
+
actions.livePaginationCursor = null;
|
|
7439
|
+
});
|
|
7440
|
+
}
|
|
7441
|
+
},
|
|
6712
7442
|
cursorId: (cursorId, { actions, state }) => {
|
|
6713
7443
|
const dataParams = buildDataSourceDataParams(state, {
|
|
6714
7444
|
__cursorId: cursorId
|
|
@@ -6790,7 +7520,7 @@ function getPivotColumnsAndColumnGroups({
|
|
|
6790
7520
|
pivotGroupKeys: [],
|
|
6791
7521
|
pivotGroupKey: "",
|
|
6792
7522
|
pivotIndex: -1,
|
|
6793
|
-
|
|
7523
|
+
valueFormatter: ({ rowInfo }) => {
|
|
6794
7524
|
var _a;
|
|
6795
7525
|
return rowInfo.isGroupRow ? (_a = rowInfo.reducerResults) == null ? void 0 : _a[reducer.id] : null;
|
|
6796
7526
|
}
|
|
@@ -6839,7 +7569,7 @@ function getPivotColumnsAndColumnGroups({
|
|
|
6839
7569
|
sortable: false,
|
|
6840
7570
|
columnGroup: parentColumnGroupId,
|
|
6841
7571
|
header,
|
|
6842
|
-
|
|
7572
|
+
valueFormatter: ({ rowInfo }) => {
|
|
6843
7573
|
var _a, _b;
|
|
6844
7574
|
if (!rowInfo.isGroupRow) {
|
|
6845
7575
|
return null;
|
|
@@ -6894,7 +7624,7 @@ function getPivotColumnsAndColumnGroups({
|
|
|
6894
7624
|
pivotIndex: keys.length - 1,
|
|
6895
7625
|
pivotBy,
|
|
6896
7626
|
sortable: false,
|
|
6897
|
-
|
|
7627
|
+
valueFormatter: ({ rowInfo }) => {
|
|
6898
7628
|
var _a, _b;
|
|
6899
7629
|
if (!rowInfo.isGroupRow) {
|
|
6900
7630
|
return null;
|
|
@@ -6942,9 +7672,68 @@ function toRowInfo(data, id, index) {
|
|
|
6942
7672
|
selfLoaded: true
|
|
6943
7673
|
};
|
|
6944
7674
|
}
|
|
7675
|
+
function filterDataSource(params) {
|
|
7676
|
+
const {
|
|
7677
|
+
filterTypes,
|
|
7678
|
+
filterValue: filterValueArray,
|
|
7679
|
+
operatorsByFilterType,
|
|
7680
|
+
filterFunction,
|
|
7681
|
+
toPrimaryKey
|
|
7682
|
+
} = params;
|
|
7683
|
+
let { dataArray } = params;
|
|
7684
|
+
if (filterFunction) {
|
|
7685
|
+
dataArray = dataArray.filter((data, index, arr) => filterFunction({
|
|
7686
|
+
data,
|
|
7687
|
+
index,
|
|
7688
|
+
dataArray: arr,
|
|
7689
|
+
primaryKey: toPrimaryKey(data, index)
|
|
7690
|
+
}));
|
|
7691
|
+
}
|
|
7692
|
+
if (filterValueArray && filterValueArray.length) {
|
|
7693
|
+
return dataArray.filter((data, index, arr) => {
|
|
7694
|
+
var _a;
|
|
7695
|
+
const param = {
|
|
7696
|
+
data,
|
|
7697
|
+
index,
|
|
7698
|
+
dataArray: arr,
|
|
7699
|
+
primaryKey: toPrimaryKey(data, index)
|
|
7700
|
+
};
|
|
7701
|
+
for (let i = 0, len = filterValueArray.length; i < len; i++) {
|
|
7702
|
+
const currentFilterValue = filterValueArray[i];
|
|
7703
|
+
const {
|
|
7704
|
+
disabled,
|
|
7705
|
+
filterValue,
|
|
7706
|
+
field,
|
|
7707
|
+
filterType: filterTypeKey,
|
|
7708
|
+
valueGetter,
|
|
7709
|
+
operator
|
|
7710
|
+
} = currentFilterValue;
|
|
7711
|
+
const filterType = filterTypes[filterTypeKey];
|
|
7712
|
+
if (disabled || !filterType) {
|
|
7713
|
+
continue;
|
|
7714
|
+
}
|
|
7715
|
+
const currentOperator = (_a = operatorsByFilterType[filterTypeKey]) == null ? void 0 : _a[operator];
|
|
7716
|
+
if (!currentOperator) {
|
|
7717
|
+
continue;
|
|
7718
|
+
}
|
|
7719
|
+
const getter = valueGetter || (({ data: data2 }) => field ? data2[field] : data2);
|
|
7720
|
+
const operatorFnParam = __spreadValues({}, param);
|
|
7721
|
+
operatorFnParam.filterValue = filterValue;
|
|
7722
|
+
operatorFnParam.currentValue = getter(param);
|
|
7723
|
+
operatorFnParam.emptyValues = filterType.emptyValues;
|
|
7724
|
+
if (!currentOperator.fn(operatorFnParam)) {
|
|
7725
|
+
return false;
|
|
7726
|
+
}
|
|
7727
|
+
}
|
|
7728
|
+
return true;
|
|
7729
|
+
});
|
|
7730
|
+
}
|
|
7731
|
+
return dataArray;
|
|
7732
|
+
}
|
|
6945
7733
|
function concludeReducer(params) {
|
|
6946
7734
|
var _a, _b;
|
|
6947
7735
|
const { state, previousState } = params;
|
|
7736
|
+
const primaryKeyDescriptor = state.primaryKey;
|
|
6948
7737
|
const sortInfo = state.sortInfo;
|
|
6949
7738
|
let shouldSort = !!(sortInfo == null ? void 0 : sortInfo.length) && !state.controlledSort;
|
|
6950
7739
|
if (state.lazyLoad || state.livePagination) {
|
|
@@ -6962,15 +7751,24 @@ function concludeReducer(params) {
|
|
|
6962
7751
|
state.originalLazyGroupData = new DeepMap();
|
|
6963
7752
|
originalDataArrayChanged = true;
|
|
6964
7753
|
}
|
|
7754
|
+
const { filterFunction, filterValue, filterTypes, operatorsByFilterType } = state;
|
|
7755
|
+
const shouldFilter = !!filterFunction || Array.isArray(filterValue) && filterValue.length;
|
|
7756
|
+
const shouldFilterClientSide = shouldFilter && state.filterMode === "local";
|
|
7757
|
+
const filterDepsChanged = haveDepsChanged(previousState, state, [
|
|
7758
|
+
"filterFunction",
|
|
7759
|
+
"filterValue",
|
|
7760
|
+
"filterTypes"
|
|
7761
|
+
]);
|
|
7762
|
+
const filterChanged = originalDataArrayChanged || filterDepsChanged;
|
|
6965
7763
|
const sortInfoChanged = haveDepsChanged(previousState, state, ["sortInfo"]);
|
|
6966
|
-
const sortDepsChanged = originalDataArrayChanged || sortInfoChanged;
|
|
7764
|
+
const sortDepsChanged = originalDataArrayChanged || filterDepsChanged || sortInfoChanged;
|
|
7765
|
+
const shouldFilterAgain = state.filterMode === "local" && (filterChanged || !state.lastFilterDataArray);
|
|
6967
7766
|
const shouldSortAgain = shouldSort && (sortDepsChanged || !state.lastSortDataArray);
|
|
6968
7767
|
const groupBy = state.groupBy;
|
|
6969
7768
|
const pivotBy = state.pivotBy;
|
|
6970
7769
|
const shouldGroup = groupBy.length > 0 || !!pivotBy;
|
|
6971
|
-
const groupsDepsChanged = originalDataArrayChanged || haveDepsChanged(previousState, state, [
|
|
7770
|
+
const groupsDepsChanged = originalDataArrayChanged || sortDepsChanged || haveDepsChanged(previousState, state, [
|
|
6972
7771
|
"generateGroupRows",
|
|
6973
|
-
"originalDataArray",
|
|
6974
7772
|
"originalLazyGroupData",
|
|
6975
7773
|
"originalLazyGroupDataChangeDetect",
|
|
6976
7774
|
"groupBy",
|
|
@@ -6979,23 +7777,44 @@ function concludeReducer(params) {
|
|
|
6979
7777
|
"aggregationReducers",
|
|
6980
7778
|
"pivotTotalColumnPosition",
|
|
6981
7779
|
"pivotGrandTotalColumnPosition",
|
|
6982
|
-
"showSeparatePivotColumnForSingleAggregation"
|
|
6983
|
-
"sortInfo"
|
|
7780
|
+
"showSeparatePivotColumnForSingleAggregation"
|
|
6984
7781
|
]);
|
|
6985
7782
|
const shouldGroupAgain = shouldGroup && (groupsDepsChanged || !state.lastGroupDataArray);
|
|
6986
7783
|
const now = Date.now();
|
|
6987
7784
|
let dataArray = state.originalDataArray;
|
|
6988
|
-
|
|
6989
|
-
|
|
7785
|
+
const toPrimaryKey = typeof primaryKeyDescriptor === "function" ? (data, index) => primaryKeyDescriptor({ data, index }) : (data, _index) => {
|
|
7786
|
+
const pk = data[primaryKeyDescriptor];
|
|
7787
|
+
return pk;
|
|
7788
|
+
};
|
|
7789
|
+
if (!shouldFilter) {
|
|
7790
|
+
state.unfilteredCount = dataArray.length;
|
|
7791
|
+
}
|
|
7792
|
+
if (shouldFilterClientSide) {
|
|
7793
|
+
state.unfilteredCount = dataArray.length;
|
|
7794
|
+
dataArray = shouldFilterAgain ? filterDataSource({
|
|
7795
|
+
dataArray,
|
|
7796
|
+
toPrimaryKey,
|
|
7797
|
+
filterTypes,
|
|
7798
|
+
operatorsByFilterType,
|
|
7799
|
+
filterFunction,
|
|
7800
|
+
filterValue
|
|
7801
|
+
}) : state.lastFilterDataArray;
|
|
7802
|
+
state.lastFilterDataArray = dataArray;
|
|
7803
|
+
state.filteredAt = now;
|
|
7804
|
+
}
|
|
7805
|
+
state.filteredCount = dataArray.length;
|
|
7806
|
+
state.postFilterDataArray = dataArray;
|
|
7807
|
+
const shouldSortClientSide = shouldSort && state.sortMode === "local";
|
|
7808
|
+
if (shouldSortClientSide) {
|
|
7809
|
+
const prevKnownTypes = multisort.knownTypes;
|
|
7810
|
+
multisort.knownTypes = state.sortTypes;
|
|
6990
7811
|
dataArray = shouldSortAgain ? multisort(sortInfo, [...dataArray]) : state.lastSortDataArray;
|
|
7812
|
+
multisort.knownTypes = prevKnownTypes;
|
|
6991
7813
|
state.lastSortDataArray = dataArray;
|
|
6992
7814
|
state.sortedAt = now;
|
|
6993
7815
|
}
|
|
6994
7816
|
state.postSortDataArray = dataArray;
|
|
6995
|
-
|
|
6996
|
-
const pk = data[state.primaryKey];
|
|
6997
|
-
return pk;
|
|
6998
|
-
};
|
|
7817
|
+
let rowInfoDataArray = state.dataArray;
|
|
6999
7818
|
if (shouldGroup) {
|
|
7000
7819
|
if (shouldGroupAgain) {
|
|
7001
7820
|
const groupResult = state.lazyLoad ? lazyGroup({
|
|
@@ -7038,7 +7857,7 @@ function concludeReducer(params) {
|
|
|
7038
7857
|
state.pivotColumns = void 0;
|
|
7039
7858
|
const arrayDifferentAfterSortStep = previousState.postSortDataArray != state.postSortDataArray;
|
|
7040
7859
|
if (arrayDifferentAfterSortStep || groupsDepsChanged) {
|
|
7041
|
-
rowInfoDataArray = dataArray.map((data, index) => toRowInfo(data, data ? toPrimaryKey(data) : index, index));
|
|
7860
|
+
rowInfoDataArray = dataArray.map((data, index) => toRowInfo(data, data ? toPrimaryKey(data, index) : index, index));
|
|
7042
7861
|
}
|
|
7043
7862
|
}
|
|
7044
7863
|
state.postGroupDataArray = rowInfoDataArray;
|
|
@@ -7066,7 +7885,7 @@ function DataSourceWithContext(props) {
|
|
|
7066
7885
|
if (typeof children === "function") {
|
|
7067
7886
|
children = children(computedValues);
|
|
7068
7887
|
}
|
|
7069
|
-
return /* @__PURE__ */
|
|
7888
|
+
return /* @__PURE__ */ React31.createElement(React31.Fragment, null, children);
|
|
7070
7889
|
}
|
|
7071
7890
|
var DataSourceRoot = getComponentStateRoot({
|
|
7072
7891
|
initSetupState,
|
|
@@ -7089,14 +7908,14 @@ function DataSourceCmp({ children }) {
|
|
|
7089
7908
|
globalThis.getDataSourceState = getState;
|
|
7090
7909
|
}
|
|
7091
7910
|
useLoadData();
|
|
7092
|
-
return /* @__PURE__ */
|
|
7911
|
+
return /* @__PURE__ */ React31.createElement(DataSourceContext.Provider, {
|
|
7093
7912
|
value: contextValue
|
|
7094
|
-
}, /* @__PURE__ */
|
|
7913
|
+
}, /* @__PURE__ */ React31.createElement(DataSourceWithContext, {
|
|
7095
7914
|
children
|
|
7096
7915
|
}));
|
|
7097
7916
|
}
|
|
7098
7917
|
function DataSource(props) {
|
|
7099
|
-
return /* @__PURE__ */
|
|
7918
|
+
return /* @__PURE__ */ React31.createElement(DataSourceRoot, __spreadValues({}, props), /* @__PURE__ */ React31.createElement(DataSourceCmp, {
|
|
7100
7919
|
children: props.children
|
|
7101
7920
|
}));
|
|
7102
7921
|
}
|
|
@@ -7104,7 +7923,7 @@ function DataSource(props) {
|
|
|
7104
7923
|
// src/components/InfiniteTable/hooks/useToggleGroupRow.ts
|
|
7105
7924
|
function useToggleGroupRow() {
|
|
7106
7925
|
const { getState: getDataSourceState, componentActions: dataSourceActions } = useDataSourceContextValue();
|
|
7107
|
-
const toggleGroupRow = (0,
|
|
7926
|
+
const toggleGroupRow = (0, import_react37.useCallback)((groupKeys) => {
|
|
7108
7927
|
const state = getDataSourceState();
|
|
7109
7928
|
const newState = new GroupRowsState(state.groupRowsState);
|
|
7110
7929
|
newState.toggleGroupRow(groupKeys);
|
|
@@ -7136,7 +7955,7 @@ function useToggleGroupRow() {
|
|
|
7136
7955
|
|
|
7137
7956
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
7138
7957
|
function useGroupByMap(groupBy) {
|
|
7139
|
-
const groupByMap = (0,
|
|
7958
|
+
const groupByMap = (0, import_react38.useMemo)(() => {
|
|
7140
7959
|
return groupBy.reduce((acc, groupBy2, index) => {
|
|
7141
7960
|
acc.set(groupBy2.field, {
|
|
7142
7961
|
groupBy: groupBy2,
|
|
@@ -7160,13 +7979,13 @@ function useColumnsWhen() {
|
|
|
7160
7979
|
}
|
|
7161
7980
|
} = useComponentState();
|
|
7162
7981
|
const groupByMap = useGroupByMap(groupBy);
|
|
7163
|
-
(0,
|
|
7982
|
+
(0, import_react38.useEffect)(() => {
|
|
7164
7983
|
dataSourceActions.generateGroupRows = groupRenderStrategy !== "inline";
|
|
7165
7984
|
}, [groupRenderStrategy]);
|
|
7166
|
-
(0,
|
|
7985
|
+
(0, import_react38.useEffect)(() => {
|
|
7167
7986
|
dataSourceActions.pivotTotalColumnPosition = pivotTotalColumnPosition;
|
|
7168
7987
|
}, [pivotTotalColumnPosition]);
|
|
7169
|
-
(0,
|
|
7988
|
+
(0, import_react38.useEffect)(() => {
|
|
7170
7989
|
if (pivotGrandTotalColumnPosition != void 0) {
|
|
7171
7990
|
dataSourceActions.pivotGrandTotalColumnPosition = pivotGrandTotalColumnPosition;
|
|
7172
7991
|
}
|
|
@@ -7196,7 +8015,7 @@ function useColumnsWhenInlineGroupRenderStrategy(groupByMap) {
|
|
|
7196
8015
|
base = {
|
|
7197
8016
|
groupByField: field,
|
|
7198
8017
|
field,
|
|
7199
|
-
|
|
8018
|
+
valueFormatter: ({ rowInfo }) => {
|
|
7200
8019
|
var _a;
|
|
7201
8020
|
return rowInfo.isGroupRow ? (_a = rowInfo.groupKeys) == null ? void 0 : _a[groupIndex] : rowInfo.value;
|
|
7202
8021
|
},
|
|
@@ -7240,7 +8059,7 @@ function useColumnsWhenInlineGroupRenderStrategy(groupByMap) {
|
|
|
7240
8059
|
});
|
|
7241
8060
|
return computedColumns.size === 0 ? void 0 : computedColumns;
|
|
7242
8061
|
}
|
|
7243
|
-
(0,
|
|
8062
|
+
(0, import_react38.useEffect)(() => {
|
|
7244
8063
|
const update = () => {
|
|
7245
8064
|
componentActions.columnsWhenInlineGroupRenderStrategy = computeColumnsWhenInlineGroupRenderStrategy(columns, groupByMap, groupRenderStrategy, toggleGroupRow);
|
|
7246
8065
|
};
|
|
@@ -7269,7 +8088,7 @@ function useColumnsWhenGrouping() {
|
|
|
7269
8088
|
}
|
|
7270
8089
|
} = useComponentState();
|
|
7271
8090
|
const toggleGroupRow = useToggleGroupRow();
|
|
7272
|
-
(0,
|
|
8091
|
+
(0, import_react38.useEffect)(() => {
|
|
7273
8092
|
const update = () => {
|
|
7274
8093
|
const columnsWhenGrouping = getColumnsWhenGrouping({
|
|
7275
8094
|
columns,
|
|
@@ -7405,7 +8224,7 @@ function useHideColumns(groupByMap) {
|
|
|
7405
8224
|
hideEmptyGroupColumns ? groupRowsState : null,
|
|
7406
8225
|
hideEmptyGroupColumns
|
|
7407
8226
|
]);
|
|
7408
|
-
(0,
|
|
8227
|
+
(0, import_react38.useEffect)(() => {
|
|
7409
8228
|
const isGrouped = groupBy.length > 0;
|
|
7410
8229
|
const currentState = getComponentState();
|
|
7411
8230
|
const { controlledColumnVisibility, columnVisibility } = currentState;
|
|
@@ -7520,7 +8339,7 @@ function getColumnsWhenGrouping(params) {
|
|
|
7520
8339
|
}
|
|
7521
8340
|
|
|
7522
8341
|
// src/components/InfiniteTable/hooks/useComputedVisibleColumns.ts
|
|
7523
|
-
var
|
|
8342
|
+
var import_react40 = __toModule(require("react"));
|
|
7524
8343
|
|
|
7525
8344
|
// src/components/flexbox/index.ts
|
|
7526
8345
|
var computeFlex = (params) => {
|
|
@@ -7677,7 +8496,9 @@ var adjustColumnOrderForPinning = (columnOrder, columnPinning) => {
|
|
|
7677
8496
|
};
|
|
7678
8497
|
|
|
7679
8498
|
// src/components/InfiniteTable/utils/getColumnComputedType.ts
|
|
7680
|
-
var emptyType = Object.freeze({
|
|
8499
|
+
var emptyType = Object.freeze({
|
|
8500
|
+
filterType: "string"
|
|
8501
|
+
});
|
|
7681
8502
|
function getColumnComputedType(column, columnTypes) {
|
|
7682
8503
|
const defaultType = columnTypes["default"] || emptyType;
|
|
7683
8504
|
if (column.type === void 0) {
|
|
@@ -7713,6 +8534,7 @@ var getComputedVisibleColumns = ({
|
|
|
7713
8534
|
columnHeaderCssEllipsis,
|
|
7714
8535
|
pinnedStartMaxWidth,
|
|
7715
8536
|
pinnedEndMaxWidth,
|
|
8537
|
+
filterValue,
|
|
7716
8538
|
sortable,
|
|
7717
8539
|
sortInfo,
|
|
7718
8540
|
setSortInfo,
|
|
@@ -7727,9 +8549,19 @@ var getComputedVisibleColumns = ({
|
|
|
7727
8549
|
columnVisibilityAssumeVisible
|
|
7728
8550
|
}) => {
|
|
7729
8551
|
let computedOffset = 0;
|
|
8552
|
+
const filterValueRecord = (filterValue || []).reduce((acc, filterValueItem) => {
|
|
8553
|
+
const { id, field } = filterValueItem;
|
|
8554
|
+
if (field) {
|
|
8555
|
+
acc[field] = filterValueItem;
|
|
8556
|
+
}
|
|
8557
|
+
if (id) {
|
|
8558
|
+
acc[id] = filterValueItem;
|
|
8559
|
+
}
|
|
8560
|
+
return acc;
|
|
8561
|
+
}, {});
|
|
7730
8562
|
const normalizedColumnOrder = adjustColumnOrderForPinning(columnOrder === true ? [...columns.keys()] : columnOrder, columnPinning);
|
|
7731
8563
|
const visibleColumnOrder = normalizedColumnOrder.filter((colId) => {
|
|
7732
|
-
|
|
8564
|
+
const col = columns.get(colId);
|
|
7733
8565
|
if (!col) {
|
|
7734
8566
|
logError(`Column with id "${colId}" specified in columnOrder array cannot be found in the columns map.`);
|
|
7735
8567
|
return false;
|
|
@@ -7777,7 +8609,7 @@ var getComputedVisibleColumns = ({
|
|
|
7777
8609
|
delete colTypeSizing.width;
|
|
7778
8610
|
}
|
|
7779
8611
|
colSizing = assignNonNull(colTypeSizing, colSizing);
|
|
7780
|
-
|
|
8612
|
+
const colFlex = (_a = colSizing.flex) != null ? _a : void 0;
|
|
7781
8613
|
const colMinWidth = (_c = (_b = colSizing.minWidth) != null ? _b : column == null ? void 0 : column.minWidth) != null ? _c : columnMinWidth;
|
|
7782
8614
|
const colMaxWidth = (_e = (_d = colSizing.maxWidth) != null ? _d : column == null ? void 0 : column.maxWidth) != null ? _e : columnMaxWidth;
|
|
7783
8615
|
let size = colFlex != void 0 ? void 0 : (_f = colSizing.width) != null ? _f : columnDefaultWidth;
|
|
@@ -7820,7 +8652,7 @@ var getComputedVisibleColumns = ({
|
|
|
7820
8652
|
});
|
|
7821
8653
|
const firstPinnedEndAbsoluteOffset = bodySize.width - totalPinnedEndWidth;
|
|
7822
8654
|
columnsArray.forEach((c, i) => {
|
|
7823
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
|
|
8655
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
|
|
7824
8656
|
const id = visibleColumnOrder[i];
|
|
7825
8657
|
const nextColumnId = visibleColumnOrder[i + 1];
|
|
7826
8658
|
const colType = getColumnComputedType(c, columnTypes);
|
|
@@ -7831,47 +8663,6 @@ var getComputedVisibleColumns = ({
|
|
|
7831
8663
|
const computedSortedDesc = computedSorted && !computedSortedAsc;
|
|
7832
8664
|
const computedSortIndex = (_c = sortingInfo == null ? void 0 : sortingInfo.index) != null ? _c : -1;
|
|
7833
8665
|
const computedWidth = computedSizes[i];
|
|
7834
|
-
const toggleSort = () => {
|
|
7835
|
-
let currentSortInfo = computedSortInfo;
|
|
7836
|
-
let newColumnSortInfo;
|
|
7837
|
-
if (!currentSortInfo) {
|
|
7838
|
-
newColumnSortInfo = {
|
|
7839
|
-
dir: 1,
|
|
7840
|
-
id,
|
|
7841
|
-
field: c.field,
|
|
7842
|
-
type: c.type
|
|
7843
|
-
};
|
|
7844
|
-
} else {
|
|
7845
|
-
if (computedSortedDesc) {
|
|
7846
|
-
newColumnSortInfo = null;
|
|
7847
|
-
} else {
|
|
7848
|
-
newColumnSortInfo = __spreadProps(__spreadValues({}, computedSortInfo), {
|
|
7849
|
-
dir: -1
|
|
7850
|
-
});
|
|
7851
|
-
}
|
|
7852
|
-
}
|
|
7853
|
-
if (c.field && newColumnSortInfo && !newColumnSortInfo.field) {
|
|
7854
|
-
newColumnSortInfo.field = c.field;
|
|
7855
|
-
}
|
|
7856
|
-
let finalSortInfo = sortInfo ? [...sortInfo] : [];
|
|
7857
|
-
if (multiSort) {
|
|
7858
|
-
if (computedSortIndex === -1) {
|
|
7859
|
-
if (newColumnSortInfo) {
|
|
7860
|
-
finalSortInfo.push(newColumnSortInfo);
|
|
7861
|
-
}
|
|
7862
|
-
} else {
|
|
7863
|
-
finalSortInfo = finalSortInfo.map((info, index) => {
|
|
7864
|
-
if (index === computedSortIndex) {
|
|
7865
|
-
return newColumnSortInfo;
|
|
7866
|
-
}
|
|
7867
|
-
return info;
|
|
7868
|
-
}).filter((x) => x != null);
|
|
7869
|
-
}
|
|
7870
|
-
} else {
|
|
7871
|
-
finalSortInfo = newColumnSortInfo ? [newColumnSortInfo] : [];
|
|
7872
|
-
}
|
|
7873
|
-
setSortInfo(finalSortInfo);
|
|
7874
|
-
};
|
|
7875
8666
|
const computedPinned = getComputedPinned(id, columnPinning);
|
|
7876
8667
|
const computedLast = i === visibleColumnOrder.length - 1;
|
|
7877
8668
|
const computedPinningOffset = computedPinned === "start" ? computedPinnedStartColumnsWidth : computedPinned === "end" ? computedPinnedEndColumnsWidth : computedOffset - computedPinnedStartColumnsWidth;
|
|
@@ -7880,23 +8671,46 @@ var getComputedVisibleColumns = ({
|
|
|
7880
8671
|
const computedLastInCategory = computedLast || computedPinned !== getComputedPinned(nextColumnId, columnPinning);
|
|
7881
8672
|
const cssEllipsis = (_e = (_d = c.cssEllipsis) != null ? _d : colType.cssEllipsis) != null ? _e : columnCssEllipsis;
|
|
7882
8673
|
const headerCssEllipsis = (_j = (_i = (_h = (_g = (_f = c.headerCssEllipsis) != null ? _f : colType.cssEllipsis) != null ? _g : c.cssEllipsis) != null ? _h : colType.headerCssEllipsis) != null ? _i : columnHeaderCssEllipsis) != null ? _j : cssEllipsis;
|
|
8674
|
+
const computedFilterValue = filterValueRecord[id] || c.field ? filterValueRecord[c.field] || null : null;
|
|
8675
|
+
const computedFiltered = computedFilterValue != null;
|
|
8676
|
+
const computedFilterable = (_l = (_k = c.defaultFilterable) != null ? _k : colType.defaultFilterable) != null ? _l : true;
|
|
8677
|
+
const computedDataType = c.dataType || colType.dataType || (Array.isArray(c.type) ? c.type[0] : c.type) || "string";
|
|
8678
|
+
const computedSortType = c.sortType || colType.sortType || computedDataType;
|
|
8679
|
+
const computedFilterType = c.filterType || colType.filterType || computedDataType;
|
|
8680
|
+
const field = (_m = c.field) != null ? _m : colType.field;
|
|
8681
|
+
const valueGetter = (_n = c.valueGetter) != null ? _n : colType.valueGetter;
|
|
8682
|
+
let sortableColumnOrType = (_o = c.sortable) != null ? _o : colType.sortable;
|
|
8683
|
+
if (sortableColumnOrType == null) {
|
|
8684
|
+
if (field == null && valueGetter == null) {
|
|
8685
|
+
sortableColumnOrType = false;
|
|
8686
|
+
}
|
|
8687
|
+
}
|
|
8688
|
+
let computedSortable = (_p = sortableColumnOrType != null ? sortableColumnOrType : sortable) != null ? _p : true;
|
|
7883
8689
|
const result2 = __spreadProps(__spreadValues({
|
|
7884
8690
|
align: colType.align,
|
|
7885
8691
|
verticalAlign: colType.verticalAlign,
|
|
7886
8692
|
defaultHiddenWhenGroupedBy: colType.defaultHiddenWhenGroupedBy,
|
|
7887
|
-
valueGetter
|
|
8693
|
+
valueGetter,
|
|
8694
|
+
valueFormatter: colType.valueFormatter,
|
|
7888
8695
|
renderValue: colType.renderValue,
|
|
7889
8696
|
render: colType.render,
|
|
7890
8697
|
style: colType.style,
|
|
7891
|
-
components: colType.components
|
|
8698
|
+
components: colType.components,
|
|
8699
|
+
field
|
|
7892
8700
|
}, c), {
|
|
8701
|
+
computedDataType,
|
|
8702
|
+
computedSortType,
|
|
8703
|
+
computedFilterType,
|
|
7893
8704
|
cssEllipsis,
|
|
7894
8705
|
headerCssEllipsis,
|
|
8706
|
+
computedFilterValue,
|
|
8707
|
+
computedFiltered,
|
|
8708
|
+
computedFilterable,
|
|
7895
8709
|
computedWidth,
|
|
7896
8710
|
computedAbsoluteOffset,
|
|
7897
8711
|
computedPinningOffset,
|
|
7898
8712
|
computedOffset,
|
|
7899
|
-
computedSortable
|
|
8713
|
+
computedSortable,
|
|
7900
8714
|
computedSortInfo,
|
|
7901
8715
|
computedSortIndex,
|
|
7902
8716
|
computedMultiSort: multiSort,
|
|
@@ -7905,14 +8719,57 @@ var getComputedVisibleColumns = ({
|
|
|
7905
8719
|
computedSortedDesc,
|
|
7906
8720
|
computedVisibleIndex: i,
|
|
7907
8721
|
computedPinned,
|
|
7908
|
-
computedDraggable: (
|
|
8722
|
+
computedDraggable: (_r = (_q = c.draggable) != null ? _q : draggableColumns) != null ? _r : true,
|
|
7909
8723
|
computedFirstInCategory,
|
|
7910
8724
|
computedLastInCategory,
|
|
7911
8725
|
computedFirst: i === 0,
|
|
7912
8726
|
computedLast,
|
|
7913
|
-
toggleSort
|
|
8727
|
+
toggleSort: () => {
|
|
8728
|
+
const currentSortInfo = computedSortInfo;
|
|
8729
|
+
let newColumnSortInfo;
|
|
8730
|
+
if (!currentSortInfo) {
|
|
8731
|
+
newColumnSortInfo = {
|
|
8732
|
+
dir: 1,
|
|
8733
|
+
id,
|
|
8734
|
+
field: c.field,
|
|
8735
|
+
type: computedSortType
|
|
8736
|
+
};
|
|
8737
|
+
} else {
|
|
8738
|
+
if (computedSortedDesc) {
|
|
8739
|
+
newColumnSortInfo = null;
|
|
8740
|
+
} else {
|
|
8741
|
+
newColumnSortInfo = __spreadProps(__spreadValues({}, computedSortInfo), {
|
|
8742
|
+
dir: -1
|
|
8743
|
+
});
|
|
8744
|
+
}
|
|
8745
|
+
}
|
|
8746
|
+
if (c.field && newColumnSortInfo && !newColumnSortInfo.field) {
|
|
8747
|
+
newColumnSortInfo.field = c.field;
|
|
8748
|
+
}
|
|
8749
|
+
if (c.valueGetter && newColumnSortInfo && !newColumnSortInfo.valueGetter) {
|
|
8750
|
+
newColumnSortInfo.valueGetter = (data) => c.valueGetter({ data, field: c.field });
|
|
8751
|
+
}
|
|
8752
|
+
let finalSortInfo = sortInfo ? [...sortInfo] : [];
|
|
8753
|
+
if (multiSort) {
|
|
8754
|
+
if (computedSortIndex === -1) {
|
|
8755
|
+
if (newColumnSortInfo) {
|
|
8756
|
+
finalSortInfo.push(newColumnSortInfo);
|
|
8757
|
+
}
|
|
8758
|
+
} else {
|
|
8759
|
+
finalSortInfo = finalSortInfo.map((info, index) => {
|
|
8760
|
+
if (index === computedSortIndex) {
|
|
8761
|
+
return newColumnSortInfo;
|
|
8762
|
+
}
|
|
8763
|
+
return info;
|
|
8764
|
+
}).filter((x) => x != null);
|
|
8765
|
+
}
|
|
8766
|
+
} else {
|
|
8767
|
+
finalSortInfo = newColumnSortInfo ? [newColumnSortInfo] : [];
|
|
8768
|
+
}
|
|
8769
|
+
setSortInfo(finalSortInfo);
|
|
8770
|
+
},
|
|
7914
8771
|
id,
|
|
7915
|
-
header: (
|
|
8772
|
+
header: (_u = (_t = (_s = c.header) != null ? _s : colType.header) != null ? _t : c.name) != null ? _u : c.field
|
|
7916
8773
|
});
|
|
7917
8774
|
computedOffset += computedWidth;
|
|
7918
8775
|
computedVisibleColumnsMap.set(result2.id, result2);
|
|
@@ -7953,10 +8810,10 @@ var getComputedVisibleColumns = ({
|
|
|
7953
8810
|
};
|
|
7954
8811
|
|
|
7955
8812
|
// src/components/InfiniteTable/hooks/useRerenderOnKeyChange.ts
|
|
7956
|
-
var
|
|
8813
|
+
var import_react39 = __toModule(require("react"));
|
|
7957
8814
|
var useRerenderOnKeyChange = (map2) => {
|
|
7958
8815
|
const [renderId, rerender] = useRerender();
|
|
7959
|
-
(0,
|
|
8816
|
+
(0, import_react39.useEffect)(() => {
|
|
7960
8817
|
const update = rafFn(rerender);
|
|
7961
8818
|
return interceptMap(map2, {
|
|
7962
8819
|
set: update,
|
|
@@ -7981,6 +8838,7 @@ var useComputedVisibleColumns = ({
|
|
|
7981
8838
|
sortInfo,
|
|
7982
8839
|
multiSort,
|
|
7983
8840
|
setSortInfo,
|
|
8841
|
+
filterValue,
|
|
7984
8842
|
columnOrder,
|
|
7985
8843
|
columnPinning,
|
|
7986
8844
|
columnTypes,
|
|
@@ -8008,7 +8866,7 @@ var useComputedVisibleColumns = ({
|
|
|
8008
8866
|
computedPinnedEndOffset,
|
|
8009
8867
|
computedPinnedEndWidth,
|
|
8010
8868
|
computedPinnedStartWidth
|
|
8011
|
-
} = (0,
|
|
8869
|
+
} = (0, import_react40.useMemo)(() => {
|
|
8012
8870
|
return getComputedVisibleColumns({
|
|
8013
8871
|
columns,
|
|
8014
8872
|
bodySize,
|
|
@@ -8018,6 +8876,7 @@ var useComputedVisibleColumns = ({
|
|
|
8018
8876
|
columnCssEllipsis,
|
|
8019
8877
|
columnHeaderCssEllipsis,
|
|
8020
8878
|
viewportReservedWidth,
|
|
8879
|
+
filterValue,
|
|
8021
8880
|
sortable,
|
|
8022
8881
|
sortInfo,
|
|
8023
8882
|
setSortInfo,
|
|
@@ -8042,6 +8901,7 @@ var useComputedVisibleColumns = ({
|
|
|
8042
8901
|
sortInfo,
|
|
8043
8902
|
setSortInfo,
|
|
8044
8903
|
multiSort,
|
|
8904
|
+
filterValue,
|
|
8045
8905
|
columnOrder,
|
|
8046
8906
|
columnVisibility,
|
|
8047
8907
|
columnVisibilityAssumeVisible,
|
|
@@ -8074,7 +8934,7 @@ var useComputedVisibleColumns = ({
|
|
|
8074
8934
|
};
|
|
8075
8935
|
|
|
8076
8936
|
// src/components/InfiniteTable/hooks/useScrollbars.ts
|
|
8077
|
-
var
|
|
8937
|
+
var import_react41 = __toModule(require("react"));
|
|
8078
8938
|
var INITIAL_SCROLLBARS = {
|
|
8079
8939
|
vertical: false,
|
|
8080
8940
|
horizontal: false
|
|
@@ -8082,8 +8942,8 @@ var INITIAL_SCROLLBARS = {
|
|
|
8082
8942
|
function useScrollbars(brain) {
|
|
8083
8943
|
const { getComponentState: getInfiniteTableState } = useComponentState();
|
|
8084
8944
|
const { getState: getDataSourceState } = useDataSourceContextValue();
|
|
8085
|
-
const [scrollbars, setScrollbars] = (0,
|
|
8086
|
-
(0,
|
|
8945
|
+
const [scrollbars, setScrollbars] = (0, import_react41.useState)(INITIAL_SCROLLBARS);
|
|
8946
|
+
(0, import_react41.useEffect)(() => {
|
|
8087
8947
|
return brain.onRenderCountChange(() => {
|
|
8088
8948
|
const { scrollTopMax, scrollLeftMax } = brain;
|
|
8089
8949
|
setScrollbars({
|
|
@@ -8092,7 +8952,7 @@ function useScrollbars(brain) {
|
|
|
8092
8952
|
});
|
|
8093
8953
|
});
|
|
8094
8954
|
}, [brain]);
|
|
8095
|
-
(0,
|
|
8955
|
+
(0, import_react41.useLayoutEffect)(() => {
|
|
8096
8956
|
const dataSourceState = getDataSourceState();
|
|
8097
8957
|
const { onScrollbarsChange } = getInfiniteTableState();
|
|
8098
8958
|
const { notifyScrollbarsChange } = dataSourceState;
|
|
@@ -8123,27 +8983,27 @@ function useComputed() {
|
|
|
8123
8983
|
bodySize,
|
|
8124
8984
|
showSeparatePivotColumnForSingleAggregation
|
|
8125
8985
|
} = componentState;
|
|
8126
|
-
(0,
|
|
8986
|
+
(0, import_react42.useState)(() => {
|
|
8127
8987
|
componentState.onRowHeightCSSVarChange.onChange((rowHeight) => {
|
|
8128
8988
|
if (rowHeight) {
|
|
8129
8989
|
componentActions.rowHeight = rowHeight;
|
|
8130
8990
|
}
|
|
8131
8991
|
});
|
|
8132
|
-
componentState.
|
|
8133
|
-
if (
|
|
8134
|
-
componentActions.
|
|
8992
|
+
componentState.onColumnHeaderHeightCSSVarChange.onChange((columnHeaderHeight) => {
|
|
8993
|
+
if (columnHeaderHeight) {
|
|
8994
|
+
componentActions.columnHeaderHeight = columnHeaderHeight;
|
|
8135
8995
|
}
|
|
8136
8996
|
});
|
|
8137
8997
|
});
|
|
8138
|
-
(0,
|
|
8998
|
+
(0, import_react42.useEffect)(() => {
|
|
8139
8999
|
dataSourceActions.showSeparatePivotColumnForSingleAggregation = showSeparatePivotColumnForSingleAggregation;
|
|
8140
9000
|
}, [showSeparatePivotColumnForSingleAggregation]);
|
|
8141
|
-
const { multiSort } = dataSourceState;
|
|
9001
|
+
const { multiSort, filterValue } = dataSourceState;
|
|
8142
9002
|
useColumnGroups();
|
|
8143
9003
|
const { toggleGroupRow } = useColumnsWhen();
|
|
8144
|
-
const setSortInfo = (0,
|
|
9004
|
+
const setSortInfo = (0, import_react42.useCallback)((sortInfo) => {
|
|
8145
9005
|
var _a2;
|
|
8146
|
-
const newSortInfo = multiSort ? sortInfo : (_a2 = sortInfo[0]) != null ? _a2 : null;
|
|
9006
|
+
const newSortInfo = getDataSourceState().multiSort ? sortInfo : (_a2 = sortInfo[0]) != null ? _a2 : null;
|
|
8147
9007
|
dataSourceActions.sortInfo = newSortInfo;
|
|
8148
9008
|
}, [getDataSourceState]);
|
|
8149
9009
|
const columns = componentState.computedColumns;
|
|
@@ -8182,6 +9042,7 @@ function useComputed() {
|
|
|
8182
9042
|
columnVisibility,
|
|
8183
9043
|
columnVisibilityAssumeVisible: true,
|
|
8184
9044
|
columnPinning,
|
|
9045
|
+
filterValue,
|
|
8185
9046
|
columnSizing,
|
|
8186
9047
|
columnTypes
|
|
8187
9048
|
});
|
|
@@ -8191,6 +9052,7 @@ function useComputed() {
|
|
|
8191
9052
|
const computedPinnedStartOverflow = computedPinnedStartWidth ? computedPinnedStartColumnsWidth > computedPinnedStartWidth : false;
|
|
8192
9053
|
const computedPinnedEndOverflow = computedPinnedEndWidth ? computedPinnedEndColumnsWidth > computedPinnedEndWidth : false;
|
|
8193
9054
|
return {
|
|
9055
|
+
showColumnFilters: !!dataSourceState.filterValue,
|
|
8194
9056
|
scrollbars,
|
|
8195
9057
|
columnSize,
|
|
8196
9058
|
rowspan,
|
|
@@ -8298,7 +9160,7 @@ function useDOMProps(initialDOMProps) {
|
|
|
8298
9160
|
}
|
|
8299
9161
|
|
|
8300
9162
|
// src/components/InfiniteTable/hooks/useLicense/useLicense.ts
|
|
8301
|
-
var
|
|
9163
|
+
var import_react43 = __toModule(require("react"));
|
|
8302
9164
|
|
|
8303
9165
|
// src/components/InfiniteTable/hooks/useLicense/crc32.ts
|
|
8304
9166
|
var DEFAULT_ReversedPolynomial = 3988292384;
|
|
@@ -8456,10 +9318,10 @@ var isInsideSandbox = () => {
|
|
|
8456
9318
|
};
|
|
8457
9319
|
var isInsidePlayground = isInsideSandbox() || isInsideSandpack();
|
|
8458
9320
|
var useLicense = (licenseKey = "") => {
|
|
8459
|
-
const valid = (0,
|
|
9321
|
+
const valid = (0, import_react43.useMemo)(() => {
|
|
8460
9322
|
let valid2 = isValidLicense(licenseKey, {
|
|
8461
9323
|
publishedAt: 1624970570587,
|
|
8462
|
-
version: "0.3.
|
|
9324
|
+
version: "0.3.5"
|
|
8463
9325
|
});
|
|
8464
9326
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
8465
9327
|
return true;
|
|
@@ -8469,8 +9331,142 @@ var useLicense = (licenseKey = "") => {
|
|
|
8469
9331
|
return valid;
|
|
8470
9332
|
};
|
|
8471
9333
|
|
|
9334
|
+
// src/components/utils/clamp.ts
|
|
9335
|
+
function clamp(value, min, max) {
|
|
9336
|
+
return Math.min(Math.max(value, min), max);
|
|
9337
|
+
}
|
|
9338
|
+
|
|
9339
|
+
// src/components/InfiniteTable/keyboardNavigationAndSelection.ts
|
|
9340
|
+
function handleRowNavigation(options) {
|
|
9341
|
+
const { key, getState, getDataSourceState, actions } = options;
|
|
9342
|
+
const arrLength = getDataSourceState().dataArray.length;
|
|
9343
|
+
const state = getState();
|
|
9344
|
+
const { brain } = state;
|
|
9345
|
+
let { activeRowIndex } = state;
|
|
9346
|
+
if (activeRowIndex == null) {
|
|
9347
|
+
return false;
|
|
9348
|
+
}
|
|
9349
|
+
const {
|
|
9350
|
+
start: [startRow],
|
|
9351
|
+
end: [endRow]
|
|
9352
|
+
} = brain.getRenderRange();
|
|
9353
|
+
const renderRowCount = endRow - startRow - 1;
|
|
9354
|
+
const min = 0;
|
|
9355
|
+
const max = arrLength - 1;
|
|
9356
|
+
const KeyToFunction = {
|
|
9357
|
+
ArrowDown: () => {
|
|
9358
|
+
activeRowIndex = clamp(activeRowIndex + 1, min, max);
|
|
9359
|
+
},
|
|
9360
|
+
ArrowUp: () => {
|
|
9361
|
+
activeRowIndex = clamp(activeRowIndex - 1, min, max);
|
|
9362
|
+
},
|
|
9363
|
+
PageDown: () => {
|
|
9364
|
+
activeRowIndex = Math.min(activeRowIndex + renderRowCount, arrLength - 1);
|
|
9365
|
+
},
|
|
9366
|
+
PageUp: () => {
|
|
9367
|
+
activeRowIndex = Math.max(activeRowIndex - renderRowCount, min);
|
|
9368
|
+
},
|
|
9369
|
+
End: () => {
|
|
9370
|
+
activeRowIndex = max;
|
|
9371
|
+
},
|
|
9372
|
+
Home: () => {
|
|
9373
|
+
activeRowIndex = min;
|
|
9374
|
+
}
|
|
9375
|
+
};
|
|
9376
|
+
const Fn = KeyToFunction[key];
|
|
9377
|
+
if (!Fn) {
|
|
9378
|
+
return false;
|
|
9379
|
+
}
|
|
9380
|
+
Fn();
|
|
9381
|
+
actions.activeRowIndex = activeRowIndex;
|
|
9382
|
+
return true;
|
|
9383
|
+
}
|
|
9384
|
+
function handleCellNavigation(options) {
|
|
9385
|
+
const { key, shiftKey, getState, getComputed, getDataSourceState, actions } = options;
|
|
9386
|
+
const state = getState();
|
|
9387
|
+
const { activeCellIndex, brain } = state;
|
|
9388
|
+
if (!activeCellIndex) {
|
|
9389
|
+
return false;
|
|
9390
|
+
}
|
|
9391
|
+
let [rowIndex, colIndex] = activeCellIndex;
|
|
9392
|
+
const {
|
|
9393
|
+
start: [startRow, startCol],
|
|
9394
|
+
end: [endRow, endCol]
|
|
9395
|
+
} = brain.getRenderRange();
|
|
9396
|
+
const renderRowCount = endRow - startRow - 1;
|
|
9397
|
+
const renderColCount = endCol - startCol - 1;
|
|
9398
|
+
const maxRow = getDataSourceState().dataArray.length - 1;
|
|
9399
|
+
const maxCol = getComputed().computedVisibleColumns.length - 1;
|
|
9400
|
+
const minRow = 0;
|
|
9401
|
+
const minCol = 0;
|
|
9402
|
+
rowIndex = clamp(rowIndex, 0, maxRow);
|
|
9403
|
+
colIndex = clamp(colIndex, 0, maxCol);
|
|
9404
|
+
actions.activeCellIndex = [rowIndex, colIndex];
|
|
9405
|
+
const KeyToFunction = {
|
|
9406
|
+
ArrowDown: () => {
|
|
9407
|
+
rowIndex = clamp(rowIndex + 1, minRow, maxRow);
|
|
9408
|
+
},
|
|
9409
|
+
ArrowUp: () => {
|
|
9410
|
+
rowIndex = clamp(rowIndex - 1, minRow, maxRow);
|
|
9411
|
+
},
|
|
9412
|
+
ArrowLeft: () => {
|
|
9413
|
+
colIndex = clamp(colIndex - 1, minCol, maxCol);
|
|
9414
|
+
},
|
|
9415
|
+
ArrowRight: () => {
|
|
9416
|
+
colIndex = clamp(colIndex + 1, minCol, maxCol);
|
|
9417
|
+
},
|
|
9418
|
+
PageDown: () => {
|
|
9419
|
+
if (!shiftKey) {
|
|
9420
|
+
rowIndex = Math.min(rowIndex + renderRowCount, maxRow);
|
|
9421
|
+
} else {
|
|
9422
|
+
colIndex = Math.min(colIndex + renderColCount, maxCol);
|
|
9423
|
+
}
|
|
9424
|
+
},
|
|
9425
|
+
PageUp: () => {
|
|
9426
|
+
if (!shiftKey) {
|
|
9427
|
+
rowIndex = Math.max(rowIndex - renderRowCount, minRow);
|
|
9428
|
+
} else {
|
|
9429
|
+
colIndex = Math.max(colIndex - renderColCount, minCol);
|
|
9430
|
+
}
|
|
9431
|
+
},
|
|
9432
|
+
End: () => {
|
|
9433
|
+
if (!shiftKey) {
|
|
9434
|
+
rowIndex = maxRow;
|
|
9435
|
+
} else {
|
|
9436
|
+
colIndex = maxCol;
|
|
9437
|
+
}
|
|
9438
|
+
},
|
|
9439
|
+
Home: () => {
|
|
9440
|
+
if (!shiftKey) {
|
|
9441
|
+
rowIndex = minRow;
|
|
9442
|
+
} else {
|
|
9443
|
+
colIndex = minCol;
|
|
9444
|
+
}
|
|
9445
|
+
}
|
|
9446
|
+
};
|
|
9447
|
+
const Fn = KeyToFunction[key];
|
|
9448
|
+
if (!Fn) {
|
|
9449
|
+
return false;
|
|
9450
|
+
}
|
|
9451
|
+
Fn();
|
|
9452
|
+
actions.activeCellIndex = [rowIndex, colIndex];
|
|
9453
|
+
return true;
|
|
9454
|
+
}
|
|
9455
|
+
function handleKeyboardNavigation(options) {
|
|
9456
|
+
const { getState } = options;
|
|
9457
|
+
const state = getState();
|
|
9458
|
+
const { activeRowIndex, activeCellIndex, keyboardNavigation } = state;
|
|
9459
|
+
if (activeRowIndex != null && keyboardNavigation === "row") {
|
|
9460
|
+
return handleRowNavigation(options);
|
|
9461
|
+
}
|
|
9462
|
+
if (activeCellIndex != null && keyboardNavigation === "cell") {
|
|
9463
|
+
return handleCellNavigation(options);
|
|
9464
|
+
}
|
|
9465
|
+
return false;
|
|
9466
|
+
}
|
|
9467
|
+
|
|
8472
9468
|
// src/components/InfiniteTable/state/getInitialState.ts
|
|
8473
|
-
var
|
|
9469
|
+
var import_react44 = __toModule(require("react"));
|
|
8474
9470
|
|
|
8475
9471
|
// src/components/VirtualBrain/ScrollListener.ts
|
|
8476
9472
|
var initialScrollPosition = {
|
|
@@ -8526,6 +9522,18 @@ function toMap(mapOrObject, weakMapCache) {
|
|
|
8526
9522
|
}
|
|
8527
9523
|
|
|
8528
9524
|
// src/components/InfiniteTable/state/getInitialState.ts
|
|
9525
|
+
function createRenderer2(brain) {
|
|
9526
|
+
const renderer = new ReactHeadlessTableRenderer(brain);
|
|
9527
|
+
const onRenderUpdater = buildSubscriptionCallback();
|
|
9528
|
+
brain.onDestroy(() => {
|
|
9529
|
+
renderer.destroy();
|
|
9530
|
+
onRenderUpdater.destroy();
|
|
9531
|
+
});
|
|
9532
|
+
return {
|
|
9533
|
+
renderer,
|
|
9534
|
+
onRenderUpdater
|
|
9535
|
+
};
|
|
9536
|
+
}
|
|
8529
9537
|
function initSetupState2() {
|
|
8530
9538
|
const columnsGeneratedForGrouping = new Map();
|
|
8531
9539
|
const brain = new MatrixBrain();
|
|
@@ -8539,19 +9547,25 @@ function initSetupState2() {
|
|
|
8539
9547
|
if (true) {
|
|
8540
9548
|
globalThis.brain = brain;
|
|
8541
9549
|
}
|
|
9550
|
+
const { renderer, onRenderUpdater } = createRenderer2(brain);
|
|
8542
9551
|
brain.onAvailableSizeChange((size) => {
|
|
8543
9552
|
headerBrain.setAvailableSize({ width: size.width });
|
|
8544
9553
|
});
|
|
9554
|
+
if (true) {
|
|
9555
|
+
globalThis.renderer = renderer;
|
|
9556
|
+
}
|
|
8545
9557
|
return {
|
|
9558
|
+
renderer,
|
|
9559
|
+
onRenderUpdater,
|
|
8546
9560
|
propsCache: new Map([]),
|
|
8547
9561
|
brain,
|
|
8548
9562
|
headerBrain,
|
|
8549
9563
|
columnShifts: null,
|
|
8550
|
-
domRef: (0,
|
|
8551
|
-
scrollerDOMRef: (0,
|
|
8552
|
-
portalDOMRef: (0,
|
|
9564
|
+
domRef: (0, import_react44.createRef)(),
|
|
9565
|
+
scrollerDOMRef: (0, import_react44.createRef)(),
|
|
9566
|
+
portalDOMRef: (0, import_react44.createRef)(),
|
|
8553
9567
|
onRowHeightCSSVarChange: buildSubscriptionCallback(),
|
|
8554
|
-
|
|
9568
|
+
onColumnHeaderHeightCSSVarChange: buildSubscriptionCallback(),
|
|
8555
9569
|
bodySize: {
|
|
8556
9570
|
width: 0,
|
|
8557
9571
|
height: 0
|
|
@@ -8601,26 +9615,32 @@ var forwardProps3 = (setupState) => {
|
|
|
8601
9615
|
onScrollbarsChange: 1,
|
|
8602
9616
|
autoSizeColumnsKey: 1,
|
|
8603
9617
|
scrollStopDelay: (scrollStopDelay) => scrollStopDelay != null ? scrollStopDelay : 250,
|
|
9618
|
+
filterEditors: (filterEditors) => __spreadValues(__spreadValues({}, defaultFilterEditors), filterEditors),
|
|
8604
9619
|
viewportReservedWidth: (viewportReservedWidth) => viewportReservedWidth != null ? viewportReservedWidth : 0,
|
|
8605
|
-
activeIndex: (activeIndex) => activeIndex != null ? activeIndex : 0,
|
|
8606
9620
|
columnMinWidth: (columnMinWidth) => columnMinWidth != null ? columnMinWidth : 30,
|
|
8607
9621
|
columnMaxWidth: (columnMaxWidth) => columnMaxWidth != null ? columnMaxWidth : 2e3,
|
|
8608
9622
|
columnDefaultWidth: (columnDefaultWidth) => columnDefaultWidth != null ? columnDefaultWidth : 200,
|
|
8609
9623
|
columnCssEllipsis: (columnCssEllipsis) => columnCssEllipsis != null ? columnCssEllipsis : true,
|
|
8610
9624
|
draggableColumns: (draggableColumns) => draggableColumns != null ? draggableColumns : true,
|
|
9625
|
+
headerOptions: (headerOptions) => __spreadValues({
|
|
9626
|
+
alwaysReserveSpaceForSortIcon: true
|
|
9627
|
+
}, headerOptions),
|
|
8611
9628
|
showSeparatePivotColumnForSingleAggregation: (showSeparatePivotColumnForSingleAggregation) => showSeparatePivotColumnForSingleAggregation != null ? showSeparatePivotColumnForSingleAggregation : false,
|
|
8612
9629
|
sortable: (sortable) => sortable != null ? sortable : true,
|
|
8613
9630
|
hideEmptyGroupColumns: (hideEmptyGroupColumns) => hideEmptyGroupColumns != null ? hideEmptyGroupColumns : false,
|
|
8614
9631
|
pivotTotalColumnPosition: (pivotTotalColumnPosition) => pivotTotalColumnPosition != null ? pivotTotalColumnPosition : "end",
|
|
8615
9632
|
pivotGrandTotalColumnPosition: 1,
|
|
8616
9633
|
licenseKey: (licenseKey) => licenseKey || "",
|
|
9634
|
+
keyboardNavigation: (keyboardNavigation) => keyboardNavigation || "cell",
|
|
9635
|
+
activeRowIndex: 1,
|
|
9636
|
+
activeCellIndex: 1,
|
|
8617
9637
|
columnOrder: (columnOrder) => columnOrder != null ? columnOrder : true,
|
|
8618
9638
|
header: (header) => header != null ? header : true,
|
|
8619
9639
|
showZebraRows: (showZebraRows) => showZebraRows != null ? showZebraRows : true,
|
|
8620
9640
|
showHoverRows: (showHoverRows) => showHoverRows != null ? showHoverRows : true,
|
|
8621
9641
|
virtualizeColumns: (virtualizeColumns) => virtualizeColumns != null ? virtualizeColumns : true,
|
|
8622
9642
|
rowHeight: (rowHeight) => typeof rowHeight === "number" ? rowHeight : 0,
|
|
8623
|
-
|
|
9643
|
+
columnHeaderHeight: (columnHeaderHeight) => typeof columnHeaderHeight === "number" ? columnHeaderHeight : 30,
|
|
8624
9644
|
columns: (columns) => toMap(columns, setupState.propsCache.get("columns")),
|
|
8625
9645
|
columnVisibility: (columnVisibility) => columnVisibility != null ? columnVisibility : {},
|
|
8626
9646
|
columnPinning: (columnPinning) => toMap(columnPinning, setupState.propsCache.get("columnPinning")),
|
|
@@ -8666,7 +9686,7 @@ var mapPropsToState2 = (params) => {
|
|
|
8666
9686
|
columnGroupsMaxDepth: columnGroupsDepthsMap != state.columnGroupsDepthsMap ? Math.max(...columnGroupsDepthsMap.values(), 0) : state.columnGroupsMaxDepth,
|
|
8667
9687
|
computedColumnGroups,
|
|
8668
9688
|
rowHeightCSSVar: typeof props.rowHeight === "string" ? props.rowHeight : "",
|
|
8669
|
-
|
|
9689
|
+
columnHeaderHeightCSSVar: typeof props.columnHeaderHeight === "string" ? props.columnHeaderHeight || ThemeVars.components.Header.columnHeaderHeight : ""
|
|
8670
9690
|
};
|
|
8671
9691
|
};
|
|
8672
9692
|
|
|
@@ -8679,19 +9699,28 @@ var InfiniteTableRoot = getComponentStateRoot({
|
|
|
8679
9699
|
mapPropsToState: mapPropsToState2,
|
|
8680
9700
|
allowedControlledPropOverrides: {
|
|
8681
9701
|
rowHeight: true,
|
|
8682
|
-
|
|
9702
|
+
columnHeaderHeight: true
|
|
8683
9703
|
},
|
|
8684
9704
|
getParentState: () => useDataSource(),
|
|
8685
9705
|
debugName: "InfiniteTable"
|
|
8686
9706
|
});
|
|
8687
|
-
var InfiniteTableComponent =
|
|
9707
|
+
var InfiniteTableComponent = React32.memo(function InfiniteTableComponent2() {
|
|
8688
9708
|
var _a;
|
|
8689
|
-
const {
|
|
9709
|
+
const {
|
|
9710
|
+
componentState,
|
|
9711
|
+
getComputed,
|
|
9712
|
+
computed,
|
|
9713
|
+
componentActions: actions,
|
|
9714
|
+
getState
|
|
9715
|
+
} = useInfiniteTable();
|
|
8690
9716
|
const {
|
|
8691
9717
|
componentState: { loading },
|
|
8692
9718
|
getState: getDataSourceState,
|
|
8693
9719
|
componentActions: dataSourceActions
|
|
8694
9720
|
} = useDataSourceContextValue();
|
|
9721
|
+
const [imperativeApi] = (0, import_react45.useState)(() => {
|
|
9722
|
+
return getImperativeApi(getState, getComputed, getDataSourceState, actions);
|
|
9723
|
+
});
|
|
8695
9724
|
const {
|
|
8696
9725
|
domRef,
|
|
8697
9726
|
scrollerDOMRef,
|
|
@@ -8700,24 +9729,44 @@ var InfiniteTableComponent = React27.memo(function InfiniteTableComponent2() {
|
|
|
8700
9729
|
loadingText,
|
|
8701
9730
|
header,
|
|
8702
9731
|
onRowHeightCSSVarChange,
|
|
8703
|
-
|
|
9732
|
+
onColumnHeaderHeightCSSVarChange,
|
|
8704
9733
|
rowHeightCSSVar,
|
|
8705
|
-
|
|
9734
|
+
columnHeaderHeightCSSVar,
|
|
8706
9735
|
components,
|
|
8707
9736
|
scrollStopDelay,
|
|
8708
9737
|
brain,
|
|
8709
|
-
headerBrain
|
|
9738
|
+
headerBrain,
|
|
9739
|
+
renderer,
|
|
9740
|
+
keyboardNavigation,
|
|
9741
|
+
activeRowIndex,
|
|
9742
|
+
activeCellIndex,
|
|
9743
|
+
onRenderUpdater
|
|
8710
9744
|
} = componentState;
|
|
9745
|
+
(0, import_react45.useEffect)(() => {
|
|
9746
|
+
if (activeRowIndex != null) {
|
|
9747
|
+
imperativeApi.scrollRowIntoView(activeRowIndex, {
|
|
9748
|
+
offset: 30
|
|
9749
|
+
});
|
|
9750
|
+
}
|
|
9751
|
+
}, [activeRowIndex]);
|
|
9752
|
+
(0, import_react45.useEffect)(() => {
|
|
9753
|
+
if (activeCellIndex != null) {
|
|
9754
|
+
imperativeApi.scrollCellIntoView(activeCellIndex[0], activeCellIndex[1], {
|
|
9755
|
+
offset: 30
|
|
9756
|
+
});
|
|
9757
|
+
}
|
|
9758
|
+
}, [activeCellIndex]);
|
|
8711
9759
|
const { columnShifts, bodySize } = componentState;
|
|
8712
9760
|
const { scrollbars } = computed;
|
|
8713
9761
|
const { renderCell } = useCellRendering({
|
|
9762
|
+
imperativeApi,
|
|
8714
9763
|
getComputed,
|
|
8715
9764
|
domRef: componentState.domRef,
|
|
8716
9765
|
columnShifts,
|
|
8717
9766
|
bodySize,
|
|
8718
9767
|
computed
|
|
8719
9768
|
});
|
|
8720
|
-
|
|
9769
|
+
React32.useEffect(() => {
|
|
8721
9770
|
const dataSourceState = getDataSourceState();
|
|
8722
9771
|
const onChange = debounce((renderRange) => {
|
|
8723
9772
|
dataSourceState.notifyRenderRangeChange({
|
|
@@ -8730,35 +9779,52 @@ var InfiniteTableComponent = React27.memo(function InfiniteTableComponent2() {
|
|
|
8730
9779
|
const licenseValid = useLicense(licenseKey);
|
|
8731
9780
|
const domProps = useDOMProps(componentState.domProps);
|
|
8732
9781
|
const LoadMaskCmp = (_a = components == null ? void 0 : components.LoadMask) != null ? _a : LoadMask;
|
|
8733
|
-
|
|
9782
|
+
React32.useEffect(() => {
|
|
8734
9783
|
brain.setScrollStopDelay(scrollStopDelay);
|
|
8735
9784
|
dataSourceActions.scrollStopDelayUpdatedByTable = scrollStopDelay;
|
|
8736
9785
|
}, [scrollStopDelay]);
|
|
8737
9786
|
useAutoSizeColumns();
|
|
8738
|
-
|
|
9787
|
+
const onKeyDown = (0, import_react45.useCallback)((event) => {
|
|
9788
|
+
if (handleKeyboardNavigation({
|
|
9789
|
+
getState,
|
|
9790
|
+
actions,
|
|
9791
|
+
getDataSourceState,
|
|
9792
|
+
getComputed,
|
|
9793
|
+
key: event.key,
|
|
9794
|
+
shiftKey: !!event.shiftKey
|
|
9795
|
+
})) {
|
|
9796
|
+
event.preventDefault();
|
|
9797
|
+
}
|
|
9798
|
+
}, []);
|
|
9799
|
+
return /* @__PURE__ */ React32.createElement("div", __spreadValues({
|
|
9800
|
+
onKeyDown,
|
|
8739
9801
|
ref: domRef
|
|
8740
|
-
}, domProps), header ? /* @__PURE__ */
|
|
9802
|
+
}, domProps), header ? /* @__PURE__ */ React32.createElement(TableHeaderWrapper, {
|
|
8741
9803
|
brain: headerBrain,
|
|
8742
9804
|
scrollbars
|
|
8743
|
-
}) : null, /* @__PURE__ */
|
|
9805
|
+
}) : null, /* @__PURE__ */ React32.createElement(InfiniteTableBody, null, /* @__PURE__ */ React32.createElement(HeadlessTable, {
|
|
8744
9806
|
tabIndex: 0,
|
|
9807
|
+
activeRowIndex: componentState.ready && keyboardNavigation === "row" ? activeRowIndex : null,
|
|
9808
|
+
activeCellIndex: componentState.ready && keyboardNavigation === "cell" ? activeCellIndex : null,
|
|
8745
9809
|
scrollStopDelay,
|
|
9810
|
+
renderer,
|
|
9811
|
+
onRenderUpdater,
|
|
8746
9812
|
brain,
|
|
8747
9813
|
renderCell,
|
|
8748
9814
|
cellHoverClassNames: HOVERED_CLASS_NAMES,
|
|
8749
9815
|
scrollerDOMRef
|
|
8750
|
-
}), /* @__PURE__ */
|
|
9816
|
+
}), /* @__PURE__ */ React32.createElement(LoadMaskCmp, {
|
|
8751
9817
|
visible: loading
|
|
8752
|
-
}, loadingText)),
|
|
9818
|
+
}, loadingText)), /* @__PURE__ */ React32.createElement("div", {
|
|
8753
9819
|
ref: portalDOMRef,
|
|
8754
9820
|
className: join(`${rootClassName2}Portal`, zIndex[1e3], position.absolute, top[0], left[0])
|
|
8755
|
-
}), rowHeightCSSVar ? /* @__PURE__ */
|
|
9821
|
+
}), rowHeightCSSVar ? /* @__PURE__ */ React32.createElement(CSSVariableWatch, {
|
|
8756
9822
|
varName: rowHeightCSSVar,
|
|
8757
9823
|
onChange: onRowHeightCSSVarChange
|
|
8758
|
-
}) : null,
|
|
8759
|
-
varName:
|
|
8760
|
-
onChange:
|
|
8761
|
-
}) : null);
|
|
9824
|
+
}) : null, columnHeaderHeightCSSVar ? /* @__PURE__ */ React32.createElement(CSSVariableWatch, {
|
|
9825
|
+
varName: columnHeaderHeightCSSVar,
|
|
9826
|
+
onChange: onColumnHeaderHeightCSSVarChange
|
|
9827
|
+
}) : null, /* @__PURE__ */ React32.createElement(InfiniteTableFooter, null), licenseValid ? null : /* @__PURE__ */ React32.createElement(InfiniteTableLicenseFooter, null));
|
|
8762
9828
|
});
|
|
8763
9829
|
function InfiniteTableContextProvider() {
|
|
8764
9830
|
const { componentActions, componentState } = useComponentState();
|
|
@@ -8786,27 +9852,27 @@ function InfiniteTableContextProvider() {
|
|
|
8786
9852
|
bodySize.width = (_b = (_a = scrollerDOMRef.current) == null ? void 0 : _a.scrollWidth) != null ? _b : bodySize.width;
|
|
8787
9853
|
componentActions.bodySize = bodySize;
|
|
8788
9854
|
}, { earlyAttach: true });
|
|
8789
|
-
|
|
9855
|
+
React32.useEffect(() => {
|
|
8790
9856
|
return () => {
|
|
8791
9857
|
componentState.onRowHeightCSSVarChange.destroy();
|
|
8792
|
-
componentState.
|
|
9858
|
+
componentState.onColumnHeaderHeightCSSVarChange.destroy();
|
|
8793
9859
|
};
|
|
8794
9860
|
}, []);
|
|
8795
|
-
|
|
9861
|
+
React32.useEffect(() => {
|
|
8796
9862
|
if (scrollerDOMRef.current) {
|
|
8797
9863
|
scrollerDOMRef.current.scrollTop = 0;
|
|
8798
9864
|
}
|
|
8799
9865
|
}, [scrollTopKey, scrollerDOMRef]);
|
|
8800
9866
|
const TableContext2 = getInfiniteTableContext();
|
|
8801
|
-
return /* @__PURE__ */
|
|
9867
|
+
return /* @__PURE__ */ React32.createElement(TableContext2.Provider, {
|
|
8802
9868
|
value: contextValue
|
|
8803
|
-
}, /* @__PURE__ */
|
|
9869
|
+
}, /* @__PURE__ */ React32.createElement(InfiniteTableComponent, null));
|
|
8804
9870
|
}
|
|
8805
9871
|
function InfiniteTable(props) {
|
|
8806
|
-
const table = /* @__PURE__ */
|
|
8807
|
-
return /* @__PURE__ */
|
|
9872
|
+
const table = /* @__PURE__ */ React32.createElement(InfiniteTableRoot, __spreadValues({}, props), /* @__PURE__ */ React32.createElement(InfiniteTableContextProvider, null));
|
|
9873
|
+
return /* @__PURE__ */ React32.createElement(React32.StrictMode, null, table);
|
|
8808
9874
|
}
|
|
8809
9875
|
InfiniteTable.defaultProps = {
|
|
8810
9876
|
rowHeight: 40,
|
|
8811
|
-
|
|
9877
|
+
columnHeaderHeight: ThemeVars.components.Header.columnHeaderHeight
|
|
8812
9878
|
};
|