@infinite-table/infinite-react 0.3.3 → 0.3.6
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 +116 -61
- package/index.d.ts +122 -9
- package/index.esm.css +116 -61
- package/index.esm.js +960 -358
- package/index.js +961 -365
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -665,7 +665,8 @@ function debounce(fn, { wait }) {
|
|
|
665
665
|
}
|
|
666
666
|
|
|
667
667
|
// src/components/InfiniteTable/index.tsx
|
|
668
|
-
var
|
|
668
|
+
var React32 = __toModule(require("react"));
|
|
669
|
+
var import_react45 = __toModule(require("react"));
|
|
669
670
|
|
|
670
671
|
// src/utils/join.ts
|
|
671
672
|
var join = (...args) => args.filter((x) => !!`${x}`).join(" ");
|
|
@@ -874,8 +875,8 @@ function useDataSourceContextValue() {
|
|
|
874
875
|
}
|
|
875
876
|
|
|
876
877
|
// src/components/HeadlessTable/index.tsx
|
|
877
|
-
var
|
|
878
|
-
var
|
|
878
|
+
var React12 = __toModule(require("react"));
|
|
879
|
+
var import_react11 = __toModule(require("react"));
|
|
879
880
|
|
|
880
881
|
// src/components/VirtualList/SpacePlaceholder.tsx
|
|
881
882
|
var React5 = __toModule(require("react"));
|
|
@@ -2512,6 +2513,171 @@ var ReactHeadlessTableRenderer = class extends Logger {
|
|
|
2512
2513
|
this.items = [];
|
|
2513
2514
|
this.currentHoveredRow = -1;
|
|
2514
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
|
+
};
|
|
2515
2681
|
this.getExtraSpanCellsForRange = (range) => {
|
|
2516
2682
|
const { start, end } = range;
|
|
2517
2683
|
const [startRow, startCol] = start;
|
|
@@ -3088,8 +3254,11 @@ function createRenderer(brain) {
|
|
|
3088
3254
|
function RawTableFn(props) {
|
|
3089
3255
|
const { brain, renderCell } = props;
|
|
3090
3256
|
const { renderer, onRenderUpdater } = (0, import_react7.useMemo)(() => {
|
|
3091
|
-
return
|
|
3092
|
-
|
|
3257
|
+
return props.onRenderUpdater && props.renderer ? {
|
|
3258
|
+
renderer: props.renderer,
|
|
3259
|
+
onRenderUpdater: props.onRenderUpdater
|
|
3260
|
+
} : createRenderer(brain);
|
|
3261
|
+
}, [brain, props.onRenderUpdater, props.renderer]);
|
|
3093
3262
|
(0, import_react7.useEffect)(() => {
|
|
3094
3263
|
renderer.cellHoverClassNames = props.cellHoverClassNames || [];
|
|
3095
3264
|
}, [renderer, props.cellHoverClassNames]);
|
|
@@ -3123,6 +3292,144 @@ function RawTableFn(props) {
|
|
|
3123
3292
|
}
|
|
3124
3293
|
var RawTable = React9.memo(RawTableFn);
|
|
3125
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
|
+
|
|
3126
3433
|
// src/components/HeadlessTable/index.tsx
|
|
3127
3434
|
function useMatrixBrain(brain, brainOptions, fixedCellsInfo) {
|
|
3128
3435
|
if (fixedCellsInfo && (fixedCellsInfo.fixedColsStart || fixedCellsInfo.fixedColsEnd || fixedCellsInfo.fixedRowsStart || fixedCellsInfo.fixedRowsEnd)) {
|
|
@@ -3150,25 +3457,33 @@ function HeadlessTable(props) {
|
|
|
3150
3457
|
scrollerDOMRef,
|
|
3151
3458
|
scrollStopDelay,
|
|
3152
3459
|
renderCell,
|
|
3153
|
-
cellHoverClassNames
|
|
3460
|
+
cellHoverClassNames,
|
|
3461
|
+
renderer,
|
|
3462
|
+
activeRowIndex,
|
|
3463
|
+
activeCellIndex,
|
|
3464
|
+
onRenderUpdater
|
|
3154
3465
|
} = _a, domProps = __objRest(_a, [
|
|
3155
3466
|
"brain",
|
|
3156
3467
|
"scrollerDOMRef",
|
|
3157
3468
|
"scrollStopDelay",
|
|
3158
3469
|
"renderCell",
|
|
3159
|
-
"cellHoverClassNames"
|
|
3470
|
+
"cellHoverClassNames",
|
|
3471
|
+
"renderer",
|
|
3472
|
+
"activeRowIndex",
|
|
3473
|
+
"activeCellIndex",
|
|
3474
|
+
"onRenderUpdater"
|
|
3160
3475
|
]);
|
|
3161
|
-
const domRef = (0,
|
|
3162
|
-
const [scrollSize, setTotalScrollSize] = (0,
|
|
3476
|
+
const domRef = (0, import_react11.useRef)(null);
|
|
3477
|
+
const [scrollSize, setTotalScrollSize] = (0, import_react11.useState)({
|
|
3163
3478
|
width: 0,
|
|
3164
3479
|
height: 0
|
|
3165
3480
|
});
|
|
3166
|
-
(0,
|
|
3481
|
+
(0, import_react11.useEffect)(() => {
|
|
3167
3482
|
if (scrollStopDelay != null) {
|
|
3168
3483
|
brain.setScrollStopDelay(scrollStopDelay);
|
|
3169
3484
|
}
|
|
3170
3485
|
}, [scrollStopDelay, brain]);
|
|
3171
|
-
(0,
|
|
3486
|
+
(0, import_react11.useEffect)(() => {
|
|
3172
3487
|
var _a2;
|
|
3173
3488
|
const node = (_a2 = domRef.current) == null ? void 0 : _a2.parentNode;
|
|
3174
3489
|
if (!node) {
|
|
@@ -3184,39 +3499,47 @@ function HeadlessTable(props) {
|
|
|
3184
3499
|
const remove = setupResizeObserver(node, onResize);
|
|
3185
3500
|
return remove;
|
|
3186
3501
|
}, []);
|
|
3187
|
-
const onContainerScroll = (0,
|
|
3502
|
+
const onContainerScroll = (0, import_react11.useCallback)((scrollPos) => {
|
|
3188
3503
|
brain.setScrollPosition(scrollPos, (scrollPos2) => {
|
|
3189
3504
|
domRef.current.style.transform = `translate3d(${-scrollPos2.scrollLeft}px, ${-scrollPos2.scrollTop}px, 0px)`;
|
|
3190
3505
|
});
|
|
3191
3506
|
}, [brain]);
|
|
3192
|
-
(0,
|
|
3507
|
+
(0, import_react11.useEffect)(() => {
|
|
3193
3508
|
const removeOnRenderCount = brain.onRenderCountChange(() => {
|
|
3194
3509
|
setTotalScrollSize(brain.getTotalSize());
|
|
3195
3510
|
});
|
|
3196
3511
|
setTotalScrollSize(brain.getTotalSize());
|
|
3197
3512
|
return removeOnRenderCount;
|
|
3198
3513
|
}, [brain]);
|
|
3199
|
-
return /* @__PURE__ */
|
|
3514
|
+
return /* @__PURE__ */ React12.createElement(VirtualScrollContainer, __spreadProps(__spreadValues({
|
|
3200
3515
|
onContainerScroll
|
|
3201
3516
|
}, domProps), {
|
|
3202
3517
|
ref: scrollerDOMRef
|
|
3203
|
-
}), /* @__PURE__ */
|
|
3518
|
+
}), /* @__PURE__ */ React12.createElement("div", {
|
|
3204
3519
|
ref: domRef,
|
|
3205
3520
|
className: scrollTransformTargetCls,
|
|
3206
3521
|
"data-name": "scroll-transform-target"
|
|
3207
|
-
}, /* @__PURE__ */
|
|
3522
|
+
}, /* @__PURE__ */ React12.createElement(RawTable, {
|
|
3523
|
+
renderer,
|
|
3524
|
+
onRenderUpdater,
|
|
3208
3525
|
renderCell,
|
|
3209
3526
|
brain,
|
|
3210
3527
|
cellHoverClassNames
|
|
3211
|
-
})), /* @__PURE__ */
|
|
3528
|
+
})), /* @__PURE__ */ React12.createElement(ActiveRowIndicator, {
|
|
3529
|
+
brain,
|
|
3530
|
+
activeRowIndex
|
|
3531
|
+
}), /* @__PURE__ */ React12.createElement(ActiveCellIndicator, {
|
|
3532
|
+
brain,
|
|
3533
|
+
activeCellIndex
|
|
3534
|
+
}), /* @__PURE__ */ React12.createElement(SpacePlaceholder, {
|
|
3212
3535
|
width: scrollSize.width,
|
|
3213
3536
|
height: scrollSize.height
|
|
3214
3537
|
}));
|
|
3215
3538
|
}
|
|
3216
3539
|
|
|
3217
3540
|
// src/components/hooks/useComponentState/index.tsx
|
|
3218
|
-
var
|
|
3219
|
-
var
|
|
3541
|
+
var React13 = __toModule(require("react"));
|
|
3542
|
+
var import_react14 = __toModule(require("react"));
|
|
3220
3543
|
|
|
3221
3544
|
// src/utils/proxyFnCall.ts
|
|
3222
3545
|
function proxyFn(fn, config) {
|
|
@@ -3259,18 +3582,18 @@ function isControlled(propName, props) {
|
|
|
3259
3582
|
}
|
|
3260
3583
|
|
|
3261
3584
|
// src/components/hooks/useLatest.tsx
|
|
3262
|
-
var
|
|
3585
|
+
var import_react12 = __toModule(require("react"));
|
|
3263
3586
|
function useLatest(value) {
|
|
3264
|
-
const ref = (0,
|
|
3587
|
+
const ref = (0, import_react12.useRef)(value);
|
|
3265
3588
|
ref.current = value;
|
|
3266
|
-
return (0,
|
|
3589
|
+
return (0, import_react12.useCallback)(() => ref.current, []);
|
|
3267
3590
|
}
|
|
3268
3591
|
|
|
3269
3592
|
// src/components/hooks/usePrevious.ts
|
|
3270
|
-
var
|
|
3593
|
+
var import_react13 = __toModule(require("react"));
|
|
3271
3594
|
var usePrevious = (value, initialValue) => {
|
|
3272
|
-
const ref = (0,
|
|
3273
|
-
(0,
|
|
3595
|
+
const ref = (0, import_react13.useRef)(initialValue === void 0 ? value : initialValue);
|
|
3596
|
+
(0, import_react13.useLayoutEffect)(() => {
|
|
3274
3597
|
ref.current = value;
|
|
3275
3598
|
});
|
|
3276
3599
|
return ref.current;
|
|
@@ -3291,7 +3614,7 @@ function getComponentStateContext() {
|
|
|
3291
3614
|
if (ComponentContext) {
|
|
3292
3615
|
return ComponentContext;
|
|
3293
3616
|
}
|
|
3294
|
-
return ComponentContext = (0,
|
|
3617
|
+
return ComponentContext = (0, import_react14.createContext)(null);
|
|
3295
3618
|
}
|
|
3296
3619
|
function getReducerGeneratedActions(dispatch, getState, getProps, propsToForward, allowedControlledPropOverrides, interceptedActions) {
|
|
3297
3620
|
const state = getState();
|
|
@@ -3350,16 +3673,16 @@ function forwardProps(propsToForward, props) {
|
|
|
3350
3673
|
return mappedState;
|
|
3351
3674
|
}
|
|
3352
3675
|
function getComponentStateRoot(config) {
|
|
3353
|
-
return
|
|
3676
|
+
return React13.memo(function ComponentStateRoot(props) {
|
|
3354
3677
|
var _a, _b;
|
|
3355
|
-
const [initialSetupState] = (0,
|
|
3678
|
+
const [initialSetupState] = (0, import_react14.useState)(() => {
|
|
3356
3679
|
return config.initSetupState ? config.initSetupState() : {};
|
|
3357
3680
|
});
|
|
3358
|
-
const propsToStateSetRef = (0,
|
|
3359
|
-
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]);
|
|
3360
3683
|
const parentState = (_b = (_a = config.getParentState) == null ? void 0 : _a.call(config)) != null ? _b : null;
|
|
3361
3684
|
const getParentState = useLatest(parentState);
|
|
3362
|
-
const [wholeState] = (0,
|
|
3685
|
+
const [wholeState] = (0, import_react14.useState)(() => {
|
|
3363
3686
|
let mappedState = {};
|
|
3364
3687
|
if (propsToForward) {
|
|
3365
3688
|
mappedState = forwardProps(propsToForward, props);
|
|
@@ -3426,10 +3749,10 @@ function getComponentStateRoot(config) {
|
|
|
3426
3749
|
}) : newState;
|
|
3427
3750
|
return result;
|
|
3428
3751
|
};
|
|
3429
|
-
const [state, dispatch] = (0,
|
|
3752
|
+
const [state, dispatch] = (0, import_react14.useReducer)(theReducer, wholeState);
|
|
3430
3753
|
const getComponentState = useLatest(state);
|
|
3431
3754
|
const { allowedControlledPropOverrides } = config;
|
|
3432
|
-
const actions = (0,
|
|
3755
|
+
const actions = (0, import_react14.useMemo)(() => {
|
|
3433
3756
|
const generatedActions = getReducerGeneratedActions(dispatch, getComponentState, getProps, propsToForward, allowedControlledPropOverrides, config.interceptActions);
|
|
3434
3757
|
return generatedActions;
|
|
3435
3758
|
}, [
|
|
@@ -3438,13 +3761,13 @@ function getComponentStateRoot(config) {
|
|
|
3438
3761
|
allowedControlledPropOverrides
|
|
3439
3762
|
]);
|
|
3440
3763
|
const Context = getComponentStateContext();
|
|
3441
|
-
const contextValue = (0,
|
|
3764
|
+
const contextValue = (0, import_react14.useMemo)(() => ({
|
|
3442
3765
|
componentState: state,
|
|
3443
3766
|
componentActions: actions,
|
|
3444
3767
|
getComponentState
|
|
3445
3768
|
}), [state, actions, getComponentState]);
|
|
3446
3769
|
const prevProps = usePrevious(props);
|
|
3447
|
-
(0,
|
|
3770
|
+
(0, import_react14.useEffect)(() => {
|
|
3448
3771
|
const currentProps = props;
|
|
3449
3772
|
const newMappedState = {};
|
|
3450
3773
|
let newMappedStateCount = 0;
|
|
@@ -3500,24 +3823,18 @@ function getComponentStateRoot(config) {
|
|
|
3500
3823
|
}
|
|
3501
3824
|
}
|
|
3502
3825
|
});
|
|
3503
|
-
return /* @__PURE__ */
|
|
3826
|
+
return /* @__PURE__ */ React13.createElement(Context.Provider, {
|
|
3504
3827
|
value: contextValue
|
|
3505
3828
|
}, props.children);
|
|
3506
3829
|
});
|
|
3507
3830
|
}
|
|
3508
3831
|
function useComponentState() {
|
|
3509
3832
|
const Context = getComponentStateContext();
|
|
3510
|
-
return
|
|
3833
|
+
return React13.useContext(Context);
|
|
3511
3834
|
}
|
|
3512
3835
|
|
|
3513
3836
|
// src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx
|
|
3514
|
-
var
|
|
3515
|
-
|
|
3516
|
-
// src/components/InfiniteTable/internalProps.ts
|
|
3517
|
-
var rootClassName2 = "Infinite";
|
|
3518
|
-
var internalProps = {
|
|
3519
|
-
rootClassName: rootClassName2
|
|
3520
|
-
};
|
|
3837
|
+
var React14 = __toModule(require("react"));
|
|
3521
3838
|
|
|
3522
3839
|
// src/components/InfiniteTable/hooks/useInternalProps.ts
|
|
3523
3840
|
var useInternalProps = () => {
|
|
@@ -3525,45 +3842,45 @@ var useInternalProps = () => {
|
|
|
3525
3842
|
};
|
|
3526
3843
|
|
|
3527
3844
|
// src/components/InfiniteTable/utilities.css.ts
|
|
3528
|
-
var alignItems = { center: "
|
|
3529
|
-
var cssEllipsisClassName = "
|
|
3845
|
+
var alignItems = { center: "_16lm1iw14", stretch: "_16lm1iw15" };
|
|
3846
|
+
var cssEllipsisClassName = "_16lm1iw1d _16lm1iw1e _16lm1iw19";
|
|
3530
3847
|
var cursor = { pointer: "_16lm1iwd" };
|
|
3531
|
-
var display = { flex: "
|
|
3532
|
-
var flex = { "1": "
|
|
3533
|
-
var flexFlow = { column: "
|
|
3534
|
-
var justifyContent = { center: "
|
|
3535
|
-
var left = { "0": "
|
|
3536
|
-
var overflow = { hidden: "
|
|
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" };
|
|
3537
3854
|
var position = { relative: "_16lm1iw1", absolute: "_16lm1iw2", sticky: "_16lm1iw3", fixed: "_16lm1iw4" };
|
|
3538
|
-
var top = { "0": "
|
|
3855
|
+
var top = { "0": "_16lm1iwu", "100%": "_16lm1iwv" };
|
|
3539
3856
|
var transformTranslateZero = "_16lm1iwa";
|
|
3540
|
-
var userSelect = { none: "
|
|
3541
|
-
var zIndex = { "1": "
|
|
3857
|
+
var userSelect = { none: "_16lm1iwp" };
|
|
3858
|
+
var zIndex = { "1": "_16lm1iwh", "10": "_16lm1iwi", "1000": "_16lm1iwj", "10000": "_16lm1iwk", "100000": "_16lm1iwl" };
|
|
3542
3859
|
|
|
3543
3860
|
// src/components/InfiniteTable/components/InfiniteTableBody/InfiniteTableBody.tsx
|
|
3544
|
-
var InfiniteTableBody =
|
|
3545
|
-
const { rootClassName:
|
|
3546
|
-
return /* @__PURE__ */
|
|
3861
|
+
var InfiniteTableBody = React14.forwardRef(function InfiniteTableBody2(props, ref) {
|
|
3862
|
+
const { rootClassName: rootClassName11 } = useInternalProps();
|
|
3863
|
+
return /* @__PURE__ */ React14.createElement("div", __spreadProps(__spreadValues({
|
|
3547
3864
|
ref
|
|
3548
3865
|
}, props), {
|
|
3549
|
-
className: join(`${
|
|
3866
|
+
className: join(`${rootClassName11}Body`, position.relative, flex["1"], transformTranslateZero, props.className)
|
|
3550
3867
|
}));
|
|
3551
3868
|
});
|
|
3552
3869
|
|
|
3553
3870
|
// src/components/InfiniteTable/components/InfiniteTableFooter/InfiniteTableFooter.tsx
|
|
3554
|
-
var
|
|
3555
|
-
var InfiniteTableFooter =
|
|
3556
|
-
const { rootClassName:
|
|
3557
|
-
return /* @__PURE__ */
|
|
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({
|
|
3558
3875
|
ref
|
|
3559
3876
|
}, props), {
|
|
3560
|
-
className: join(`${
|
|
3877
|
+
className: join(`${rootClassName11}Footer`, position.relative, display.flex, flexFlow.row, props.className)
|
|
3561
3878
|
}));
|
|
3562
3879
|
});
|
|
3563
3880
|
|
|
3564
3881
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
|
|
3565
|
-
var
|
|
3566
|
-
var
|
|
3882
|
+
var React20 = __toModule(require("react"));
|
|
3883
|
+
var import_react22 = __toModule(require("react"));
|
|
3567
3884
|
var import_react_dom = __toModule(require("react-dom"));
|
|
3568
3885
|
|
|
3569
3886
|
// src/components/DataSource/defaultFilterTypes.ts
|
|
@@ -3636,6 +3953,7 @@ function useCellClassName(column, baseClasses, variants, extraFlags) {
|
|
|
3636
3953
|
firstInCategory: column.computedFirstInCategory,
|
|
3637
3954
|
lastInCategory: column.computedLastInCategory,
|
|
3638
3955
|
pinned: column.computedPinned || false,
|
|
3956
|
+
rowActive: extraFlags.rowActive,
|
|
3639
3957
|
dragging: extraFlags.dragging,
|
|
3640
3958
|
zebra: extraFlags.zebra
|
|
3641
3959
|
};
|
|
@@ -3666,25 +3984,25 @@ function useCellClassName(column, baseClasses, variants, extraFlags) {
|
|
|
3666
3984
|
|
|
3667
3985
|
// src/components/InfiniteTable/hooks/useColumnPointerEvents.ts
|
|
3668
3986
|
var import_binary_search2 = __toModule(require_binary_search());
|
|
3669
|
-
var
|
|
3987
|
+
var import_react17 = __toModule(require("react"));
|
|
3670
3988
|
|
|
3671
3989
|
// src/components/InfiniteTable/hooks/useInfiniteTable.ts
|
|
3672
|
-
var
|
|
3990
|
+
var import_react16 = __toModule(require("react"));
|
|
3673
3991
|
|
|
3674
3992
|
// src/components/InfiniteTable/InfiniteTableContext.ts
|
|
3675
|
-
var
|
|
3993
|
+
var import_react15 = __toModule(require("react"));
|
|
3676
3994
|
var TableContext;
|
|
3677
3995
|
function getInfiniteTableContext() {
|
|
3678
3996
|
if (TableContext) {
|
|
3679
3997
|
return TableContext;
|
|
3680
3998
|
}
|
|
3681
|
-
return TableContext = (0,
|
|
3999
|
+
return TableContext = (0, import_react15.createContext)(null);
|
|
3682
4000
|
}
|
|
3683
4001
|
|
|
3684
4002
|
// src/components/InfiniteTable/hooks/useInfiniteTable.ts
|
|
3685
4003
|
var useInfiniteTable = () => {
|
|
3686
4004
|
const TableContext2 = getInfiniteTableContext();
|
|
3687
|
-
return (0,
|
|
4005
|
+
return (0, import_react16.useContext)(TableContext2);
|
|
3688
4006
|
};
|
|
3689
4007
|
|
|
3690
4008
|
// src/components/InfiniteTable/utils/moveXatY.ts
|
|
@@ -3719,18 +4037,18 @@ var useColumnPointerEvents = ({
|
|
|
3719
4037
|
columns,
|
|
3720
4038
|
computedRemainingSpace
|
|
3721
4039
|
}) => {
|
|
3722
|
-
const [draggingDiff, setDraggingDiff] = (0,
|
|
3723
|
-
const [proxyOffset, setProxyOffset] = (0,
|
|
3724
|
-
const breakpointsRef = (0,
|
|
3725
|
-
const pointerMoveRef = (0,
|
|
3726
|
-
const didDragRef = (0,
|
|
3727
|
-
const initialClientPos = (0,
|
|
3728
|
-
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);
|
|
3729
4047
|
const dragging = draggingDiff != null;
|
|
3730
4048
|
const { componentActions, computed } = useInfiniteTable();
|
|
3731
4049
|
const { computedColumnOrder } = computed;
|
|
3732
|
-
const column = (0,
|
|
3733
|
-
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)(() => {
|
|
3734
4052
|
const columnsArray2 = Array.from(columns.values());
|
|
3735
4053
|
return {
|
|
3736
4054
|
columnsArray: columnsArray2,
|
|
@@ -3738,8 +4056,8 @@ var useColumnPointerEvents = ({
|
|
|
3738
4056
|
columnWidth: column.computedWidth
|
|
3739
4057
|
};
|
|
3740
4058
|
}, [columns, columnId, column]);
|
|
3741
|
-
let cursorRef = (0,
|
|
3742
|
-
const onPointerDown = (0,
|
|
4059
|
+
let cursorRef = (0, import_react17.useRef)("auto");
|
|
4060
|
+
const onPointerDown = (0, import_react17.useCallback)((e) => {
|
|
3743
4061
|
const target = domRef.current;
|
|
3744
4062
|
cursorRef.current = target.style.cursor;
|
|
3745
4063
|
didDragRef.current = false;
|
|
@@ -3802,7 +4120,7 @@ var useColumnPointerEvents = ({
|
|
|
3802
4120
|
target.addEventListener("pointermove", onPointerMove);
|
|
3803
4121
|
target.setPointerCapture(e.pointerId);
|
|
3804
4122
|
}, [columns, column, columnIndex, columnsArray, computedRemainingSpace]);
|
|
3805
|
-
const onPointerUp = (0,
|
|
4123
|
+
const onPointerUp = (0, import_react17.useCallback)((e) => {
|
|
3806
4124
|
const target = domRef.current;
|
|
3807
4125
|
target.style.cursor = cursorRef.current;
|
|
3808
4126
|
target.releasePointerCapture(e.pointerId);
|
|
@@ -3842,7 +4160,7 @@ function RenderHookComponent(props) {
|
|
|
3842
4160
|
}
|
|
3843
4161
|
|
|
3844
4162
|
// src/components/InfiniteTable/components/FilterEditors.tsx
|
|
3845
|
-
var
|
|
4163
|
+
var import_react18 = __toModule(require("react"));
|
|
3846
4164
|
function getFilterEditors() {
|
|
3847
4165
|
return {
|
|
3848
4166
|
string: StringFilterEditor,
|
|
@@ -3851,7 +4169,7 @@ function getFilterEditors() {
|
|
|
3851
4169
|
}
|
|
3852
4170
|
var defaultFilterEditors = getFilterEditors();
|
|
3853
4171
|
function StringFilterEditor(props) {
|
|
3854
|
-
return /* @__PURE__ */
|
|
4172
|
+
return /* @__PURE__ */ import_react18.default.createElement("input", {
|
|
3855
4173
|
"aria-label": `Filter for ${props.ariaLabel}`,
|
|
3856
4174
|
type: "text",
|
|
3857
4175
|
value: props.filterValue,
|
|
@@ -3862,7 +4180,7 @@ function StringFilterEditor(props) {
|
|
|
3862
4180
|
});
|
|
3863
4181
|
}
|
|
3864
4182
|
function NumberFilterEditor(props) {
|
|
3865
|
-
return /* @__PURE__ */
|
|
4183
|
+
return /* @__PURE__ */ import_react18.default.createElement("input", {
|
|
3866
4184
|
"aria-label": `Filter for ${props.ariaLabel}`,
|
|
3867
4185
|
type: "number",
|
|
3868
4186
|
value: props.filterValue,
|
|
@@ -3878,24 +4196,24 @@ function NumberFilterEditor(props) {
|
|
|
3878
4196
|
}
|
|
3879
4197
|
|
|
3880
4198
|
// src/components/InfiniteTable/components/icons/SortIcon.tsx
|
|
3881
|
-
var
|
|
3882
|
-
var
|
|
4199
|
+
var React17 = __toModule(require("react"));
|
|
4200
|
+
var import_react19 = __toModule(require("react"));
|
|
3883
4201
|
|
|
3884
4202
|
// src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts
|
|
3885
4203
|
var import_createRuntimeFn = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
3886
|
-
var CellCls = "_1eexc2a5
|
|
3887
|
-
var HeaderCellContentRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "
|
|
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: [] });
|
|
3888
4206
|
var HeaderCellProxy = "_12zfob10";
|
|
3889
|
-
var HeaderCellRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_12zfob1h
|
|
3890
|
-
var HeaderClsRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "_12zfob17
|
|
3891
|
-
var HeaderFilterCls = "
|
|
3892
|
-
var HeaderFilterEditorCls = "
|
|
3893
|
-
var HeaderGroupCls = "
|
|
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";
|
|
3894
4212
|
var HeaderScrollbarPlaceholderCls = "_12zfob16 _16lm1iw2";
|
|
3895
4213
|
var HeaderSortIconCls = "_16lm1iw1";
|
|
3896
4214
|
var HeaderSortIconIndexCls = "_12zfob15";
|
|
3897
4215
|
var HeaderSortIconRecipe = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "", variantClassNames: { align: { start: "_12zfob12", center: "_12zfob13", end: "_12zfob14" } }, defaultVariants: {}, compoundVariants: [] });
|
|
3898
|
-
var HeaderWrapperCls = "
|
|
4216
|
+
var HeaderWrapperCls = "_12zfob11a _16lm1iw19 _16lm1iw1 _16lm1iwm _16lm1iw13";
|
|
3899
4217
|
|
|
3900
4218
|
// src/components/InfiniteTable/components/icons/SortIcon.tsx
|
|
3901
4219
|
var defaultLineStyle = {
|
|
@@ -3906,8 +4224,8 @@ var defaultLineStyle = {
|
|
|
3906
4224
|
var InfiniteTableIconClassName = "InfiniteTableIcon";
|
|
3907
4225
|
function SortIcon(props) {
|
|
3908
4226
|
var _a;
|
|
3909
|
-
const [rendered, setRendered] = (0,
|
|
3910
|
-
const [opacity, setOpacity] = (0,
|
|
4227
|
+
const [rendered, setRendered] = (0, import_react19.useState)(true);
|
|
4228
|
+
const [opacity, setOpacity] = (0, import_react19.useState)(0);
|
|
3911
4229
|
const { direction, lineWidth = 1, style, className, index } = props;
|
|
3912
4230
|
const showIndex = index != null && index > 0;
|
|
3913
4231
|
const size = (_a = props.size) != null ? _a : 16;
|
|
@@ -3921,16 +4239,21 @@ function SortIcon(props) {
|
|
|
3921
4239
|
}), props.lineStyle), {
|
|
3922
4240
|
opacity
|
|
3923
4241
|
});
|
|
3924
|
-
(0,
|
|
4242
|
+
(0, import_react19.useEffect)(() => {
|
|
3925
4243
|
const newOpacity = direction != 0 ? 1 : 0;
|
|
3926
4244
|
if (!rendered && newOpacity) {
|
|
3927
4245
|
setRendered(true);
|
|
3928
4246
|
}
|
|
3929
4247
|
if (newOpacity !== opacity) {
|
|
3930
|
-
requestAnimationFrame(() => {
|
|
4248
|
+
const rafId = requestAnimationFrame(() => {
|
|
3931
4249
|
setOpacity(newOpacity);
|
|
3932
4250
|
});
|
|
4251
|
+
return () => {
|
|
4252
|
+
cancelAnimationFrame(rafId);
|
|
4253
|
+
};
|
|
3933
4254
|
}
|
|
4255
|
+
return () => {
|
|
4256
|
+
};
|
|
3934
4257
|
}, [direction, rendered]);
|
|
3935
4258
|
const onTransitionEnd = () => {
|
|
3936
4259
|
const hidden = opacity === 0 && direction === 0;
|
|
@@ -3946,44 +4269,44 @@ function SortIcon(props) {
|
|
|
3946
4269
|
if (direction === -1) {
|
|
3947
4270
|
indexStyle.top = "100%";
|
|
3948
4271
|
}
|
|
3949
|
-
return /* @__PURE__ */
|
|
4272
|
+
return /* @__PURE__ */ React17.createElement("div", {
|
|
3950
4273
|
style: __spreadProps(__spreadValues({}, style), { width: size }),
|
|
3951
4274
|
className: join(className, InfiniteTableIconClassName, `${InfiniteTableIconClassName}-sort`)
|
|
3952
|
-
}, showIndex ? /* @__PURE__ */
|
|
4275
|
+
}, showIndex ? /* @__PURE__ */ React17.createElement("div", {
|
|
3953
4276
|
"data-name": "index",
|
|
3954
4277
|
style: indexStyle,
|
|
3955
4278
|
className: HeaderSortIconIndexCls
|
|
3956
|
-
}, index) : null, /* @__PURE__ */
|
|
4279
|
+
}, index) : null, /* @__PURE__ */ React17.createElement("div", {
|
|
3957
4280
|
style: __spreadValues({ width: sizes[0] }, lineStyle),
|
|
3958
4281
|
onTransitionEnd
|
|
3959
|
-
}), /* @__PURE__ */
|
|
4282
|
+
}), /* @__PURE__ */ React17.createElement("div", {
|
|
3960
4283
|
style: __spreadValues({ width: sizes[1] }, lineStyle)
|
|
3961
|
-
}), /* @__PURE__ */
|
|
4284
|
+
}), /* @__PURE__ */ React17.createElement("div", {
|
|
3962
4285
|
style: __spreadValues({ width: sizes[2] }, lineStyle)
|
|
3963
4286
|
}));
|
|
3964
4287
|
}
|
|
3965
4288
|
|
|
3966
4289
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
|
|
3967
|
-
var
|
|
4290
|
+
var React18 = __toModule(require("react"));
|
|
3968
4291
|
|
|
3969
4292
|
// src/components/InfiniteTable/hooks/useInfiniteTableState.ts
|
|
3970
|
-
var
|
|
4293
|
+
var import_react20 = __toModule(require("react"));
|
|
3971
4294
|
var useInfiniteTableState = () => {
|
|
3972
4295
|
const TableContext2 = getInfiniteTableContext();
|
|
3973
|
-
const { componentState } = (0,
|
|
4296
|
+
const { componentState } = (0, import_react20.useContext)(TableContext2);
|
|
3974
4297
|
return componentState;
|
|
3975
4298
|
};
|
|
3976
4299
|
|
|
3977
4300
|
// src/components/InfiniteTable/components/cell.css.ts
|
|
3978
4301
|
var import_createRuntimeFn2 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
3979
4302
|
var CellClsVariants = { shifting: "_1eexc2a3", dragging: "_1eexc2a4" };
|
|
3980
|
-
var ColumnCellCls = "_1eexc2a5
|
|
3981
|
-
var ColumnCellRecipe = (0, import_createRuntimeFn2.createRuntimeFn)({ defaultClassName: "_1eexc2a7", variantClassNames: { dragging: { false: "_1eexc2a8", true: "_1eexc2a9" },
|
|
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"]] });
|
|
3982
4305
|
|
|
3983
4306
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableCell.tsx
|
|
3984
|
-
var { rootClassName:
|
|
3985
|
-
var InfiniteTableCellClassName = `${
|
|
3986
|
-
var InfiniteTableCellContentClassName = `${
|
|
4307
|
+
var { rootClassName: rootClassName5 } = internalProps;
|
|
4308
|
+
var InfiniteTableCellClassName = `${rootClassName5}Cell`;
|
|
4309
|
+
var InfiniteTableCellContentClassName = `${rootClassName5}Cell_content`;
|
|
3987
4310
|
function InfiniteTableCellFn(props) {
|
|
3988
4311
|
var _b, _c, _d;
|
|
3989
4312
|
const _a = props, {
|
|
@@ -4037,35 +4360,35 @@ function InfiniteTableCellFn(props) {
|
|
|
4037
4360
|
style,
|
|
4038
4361
|
"data-column-id": column.id,
|
|
4039
4362
|
className: join(domProps.className, justifyContent[(_b = column.align) != null ? _b : "start"], InfiniteTableCellClassName, ColumnCellCls, shifting ? `${InfiniteTableCellClassName}--shifting ${CellClsVariants.shifting}` : ""),
|
|
4040
|
-
children: /* @__PURE__ */
|
|
4363
|
+
children: /* @__PURE__ */ React18.createElement(React18.Fragment, null, beforeChildren, /* @__PURE__ */ React18.createElement("div", {
|
|
4041
4364
|
className: join(InfiniteTableCellContentClassName, cssEllipsis ? cssEllipsisClassName : overflow.hidden, contentClassName),
|
|
4042
4365
|
style: contentStyle
|
|
4043
4366
|
}, children), afterChildren)
|
|
4044
4367
|
});
|
|
4045
4368
|
const RenderComponent = cellType === "body" ? (_c = column.components) == null ? void 0 : _c.ColumnCell : (_d = column.components) == null ? void 0 : _d.HeaderCell;
|
|
4046
4369
|
if (RenderComponent) {
|
|
4047
|
-
return /* @__PURE__ */
|
|
4370
|
+
return /* @__PURE__ */ React18.createElement(RenderComponent, __spreadValues({}, finalDOMProps));
|
|
4048
4371
|
}
|
|
4049
|
-
return /* @__PURE__ */
|
|
4372
|
+
return /* @__PURE__ */ React18.createElement("div", __spreadProps(__spreadValues({}, finalDOMProps), {
|
|
4050
4373
|
ref: domRef
|
|
4051
4374
|
}));
|
|
4052
4375
|
}
|
|
4053
|
-
var InfiniteTableCell =
|
|
4376
|
+
var InfiniteTableCell = React18.memo(InfiniteTableCellFn);
|
|
4054
4377
|
|
|
4055
4378
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableColumnHeaderFilter.tsx
|
|
4056
|
-
var
|
|
4057
|
-
var
|
|
4058
|
-
var { rootClassName:
|
|
4059
|
-
var InfiniteTableColumnHeaderFilterClassName = `${
|
|
4379
|
+
var React19 = __toModule(require("react"));
|
|
4380
|
+
var import_react21 = __toModule(require("react"));
|
|
4381
|
+
var { rootClassName: rootClassName6 } = internalProps;
|
|
4382
|
+
var InfiniteTableColumnHeaderFilterClassName = `${rootClassName6}HeaderCell__filter`;
|
|
4060
4383
|
var stopPropagation = (e) => e.stopPropagation();
|
|
4061
4384
|
function InfiniteTableColumnHeaderFilter(props) {
|
|
4062
4385
|
var _a, _b, _c, _d;
|
|
4063
|
-
const [theValue, setTheValue] = (0,
|
|
4386
|
+
const [theValue, setTheValue] = (0, import_react21.useState)((_b = (_a = props.columnFilterValue) == null ? void 0 : _a.filterValue) != null ? _b : "");
|
|
4064
4387
|
const onInputChange = (filterValue) => {
|
|
4065
4388
|
setTheValue(filterValue);
|
|
4066
4389
|
props.onChange(filterValue);
|
|
4067
4390
|
};
|
|
4068
|
-
(0,
|
|
4391
|
+
(0, import_react21.useEffect)(() => {
|
|
4069
4392
|
var _a2;
|
|
4070
4393
|
if (props.columnFilterValue) {
|
|
4071
4394
|
if (theValue !== props.columnFilterValue.filterValue) {
|
|
@@ -4092,15 +4415,15 @@ function InfiniteTableColumnHeaderFilter(props) {
|
|
|
4092
4415
|
onChange: onInputChange
|
|
4093
4416
|
};
|
|
4094
4417
|
const FilterEditor = props.filterEditor;
|
|
4095
|
-
return /* @__PURE__ */
|
|
4418
|
+
return /* @__PURE__ */ React19.createElement("div", {
|
|
4096
4419
|
onPointerUp: stopPropagation,
|
|
4097
4420
|
onPointerDown: stopPropagation,
|
|
4098
4421
|
className: `${InfiniteTableColumnHeaderFilterClassName} ${HeaderFilterCls}`,
|
|
4099
4422
|
style: { height: props.columnHeaderHeight }
|
|
4100
|
-
}, FilterEditor ? /* @__PURE__ */
|
|
4423
|
+
}, FilterEditor ? /* @__PURE__ */ React19.createElement(FilterEditor, __spreadValues({}, filterEditorProps)) : null);
|
|
4101
4424
|
}
|
|
4102
4425
|
function InfiniteTableColumnHeaderFilterEmpty() {
|
|
4103
|
-
return /* @__PURE__ */
|
|
4426
|
+
return /* @__PURE__ */ React19.createElement("div", {
|
|
4104
4427
|
onPointerUp: stopPropagation,
|
|
4105
4428
|
onPointerDown: stopPropagation,
|
|
4106
4429
|
className: `${InfiniteTableColumnHeaderFilterClassName} ${HeaderFilterCls}`,
|
|
@@ -4109,9 +4432,9 @@ function InfiniteTableColumnHeaderFilterEmpty() {
|
|
|
4109
4432
|
}
|
|
4110
4433
|
|
|
4111
4434
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderCell.tsx
|
|
4112
|
-
var InfiniteTableHeaderCellContext =
|
|
4113
|
-
var { rootClassName:
|
|
4114
|
-
var InfiniteTableHeaderCellClassName = `${
|
|
4435
|
+
var InfiniteTableHeaderCellContext = React20.createContext(null);
|
|
4436
|
+
var { rootClassName: rootClassName7 } = internalProps;
|
|
4437
|
+
var InfiniteTableHeaderCellClassName = `${rootClassName7}HeaderCell`;
|
|
4115
4438
|
function InfiniteTableHeaderCell(props) {
|
|
4116
4439
|
var _a, _b, _c, _d, _e;
|
|
4117
4440
|
const column = props.column;
|
|
@@ -4119,13 +4442,13 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4119
4442
|
const { onResize, height, width, headerOptions } = props;
|
|
4120
4443
|
const sortInfo = column.computedSortInfo;
|
|
4121
4444
|
let header = column.header;
|
|
4122
|
-
const ref = (0,
|
|
4445
|
+
const ref = (0, import_react22.useCallback)((node) => {
|
|
4123
4446
|
var _a2;
|
|
4124
4447
|
domRef.current = node;
|
|
4125
4448
|
(_a2 = props.domRef) == null ? void 0 : _a2.call(props, node);
|
|
4126
4449
|
}, [props.domRef]);
|
|
4127
4450
|
const alwaysShow = headerOptions.alwaysReserveSpaceForSortIcon;
|
|
4128
|
-
const sortTool = column.computedSorted || alwaysShow ? /* @__PURE__ */
|
|
4451
|
+
const sortTool = column.computedSorted || alwaysShow ? /* @__PURE__ */ React20.createElement(SortIcon, {
|
|
4129
4452
|
index: column.computedMultiSort ? column.computedSortIndex + 1 : void 0,
|
|
4130
4453
|
className: `${InfiniteTableHeaderCellClassName}__sort-icon ${HeaderSortIconCls} ${HeaderSortIconRecipe({
|
|
4131
4454
|
align: column.align || "start"
|
|
@@ -4142,15 +4465,15 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4142
4465
|
const align = column.align || "start";
|
|
4143
4466
|
const renderChildren = () => {
|
|
4144
4467
|
if (header instanceof Function) {
|
|
4145
|
-
header = /* @__PURE__ */
|
|
4468
|
+
header = /* @__PURE__ */ React20.createElement(RenderHookComponent, {
|
|
4146
4469
|
render: header,
|
|
4147
4470
|
renderParam
|
|
4148
4471
|
});
|
|
4149
4472
|
}
|
|
4150
4473
|
header = header != null ? header : column.name;
|
|
4151
|
-
return /* @__PURE__ */
|
|
4474
|
+
return /* @__PURE__ */ React20.createElement(React20.Fragment, null, align === "end" ? sortTool : null, header, align !== "end" ? sortTool : null);
|
|
4152
4475
|
};
|
|
4153
|
-
const domRef = (0,
|
|
4476
|
+
const domRef = (0, import_react22.useRef)(null);
|
|
4154
4477
|
const {
|
|
4155
4478
|
computed: { computedRemainingSpace, showColumnFilters },
|
|
4156
4479
|
componentState: { portalDOMRef, columnHeaderHeight, filterEditors }
|
|
@@ -4160,7 +4483,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4160
4483
|
getState: getDataSourceState,
|
|
4161
4484
|
componentState: { filterDelay, filterTypes }
|
|
4162
4485
|
} = useDataSourceContextValue();
|
|
4163
|
-
(0,
|
|
4486
|
+
(0, import_react22.useEffect)(() => {
|
|
4164
4487
|
let clearOnResize = null;
|
|
4165
4488
|
const node = domRef.current;
|
|
4166
4489
|
if (onResize && node) {
|
|
@@ -4181,7 +4504,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4181
4504
|
});
|
|
4182
4505
|
let draggingProxy = null;
|
|
4183
4506
|
if (dragging) {
|
|
4184
|
-
draggingProxy = /* @__PURE__ */
|
|
4507
|
+
draggingProxy = /* @__PURE__ */ React20.createElement("div", {
|
|
4185
4508
|
className: `${InfiniteTableHeaderCellClassName}Proxy ${HeaderCellProxy}`,
|
|
4186
4509
|
style: {
|
|
4187
4510
|
position: "absolute",
|
|
@@ -4198,7 +4521,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4198
4521
|
const contentRecipeVariants = {
|
|
4199
4522
|
filtered: column.computedFiltered
|
|
4200
4523
|
};
|
|
4201
|
-
const setFilterValue = (0,
|
|
4524
|
+
const setFilterValue = (0, import_react22.useCallback)((filterValue) => {
|
|
4202
4525
|
var _a2;
|
|
4203
4526
|
const state = getDataSourceState();
|
|
4204
4527
|
let newFilterValue = (_a2 = state.filterValue) != null ? _a2 : [];
|
|
@@ -4222,7 +4545,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4222
4545
|
});
|
|
4223
4546
|
dataSourceActions.filterValue = newFilterValue;
|
|
4224
4547
|
}, [column, filterTypes]);
|
|
4225
|
-
const debouncedOnFilterValueChange =
|
|
4548
|
+
const debouncedOnFilterValueChange = React20.useMemo(() => {
|
|
4226
4549
|
const fn = (filterValue) => {
|
|
4227
4550
|
let newFilterValueForColumn;
|
|
4228
4551
|
if (column.computedFilterValue) {
|
|
@@ -4259,9 +4582,9 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4259
4582
|
]);
|
|
4260
4583
|
const filterType = column.computedFilterType;
|
|
4261
4584
|
const FilterEditor = filterEditors[filterType] || defaultFilterEditors[filterType] || StringFilterEditor;
|
|
4262
|
-
return /* @__PURE__ */
|
|
4585
|
+
return /* @__PURE__ */ React20.createElement(ContextProvider, {
|
|
4263
4586
|
value: renderParam
|
|
4264
|
-
}, /* @__PURE__ */
|
|
4587
|
+
}, /* @__PURE__ */ React20.createElement(InfiniteTableCell, {
|
|
4265
4588
|
domRef: ref,
|
|
4266
4589
|
cellType: "header",
|
|
4267
4590
|
column,
|
|
@@ -4273,9 +4596,9 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4273
4596
|
onPointerUp,
|
|
4274
4597
|
contentClassName: join(HeaderCellContentRecipe(contentRecipeVariants), justifyContent[(_c = column.align) != null ? _c : "start"]),
|
|
4275
4598
|
contentStyle: showColumnFilters ? { height: height / 2 } : void 0,
|
|
4276
|
-
className: join(InfiniteTableHeaderCellClassName, userSelect.none, column.computedSortable ? cursor.pointer : "", useCellClassName(column, [InfiniteTableHeaderCellClassName, InfiniteTableCellClassName], HeaderCellRecipe, { dragging, zebra: false }), CellCls),
|
|
4599
|
+
className: join(InfiniteTableHeaderCellClassName, userSelect.none, column.computedSortable ? cursor.pointer : "", useCellClassName(column, [InfiniteTableHeaderCellClassName, InfiniteTableCellClassName], HeaderCellRecipe, { dragging, zebra: false, rowActive: false }), CellCls),
|
|
4277
4600
|
cssEllipsis: (_e = (_d = column.headerCssEllipsis) != null ? _d : column.cssEllipsis) != null ? _e : true,
|
|
4278
|
-
afterChildren: showColumnFilters ? column.computedFilterable ? /* @__PURE__ */
|
|
4601
|
+
afterChildren: showColumnFilters ? column.computedFilterable ? /* @__PURE__ */ React20.createElement(InfiniteTableColumnHeaderFilter, {
|
|
4279
4602
|
filterEditor: FilterEditor,
|
|
4280
4603
|
filterTypes,
|
|
4281
4604
|
onChange: debouncedOnFilterValueChange,
|
|
@@ -4283,17 +4606,17 @@ function InfiniteTableHeaderCell(props) {
|
|
|
4283
4606
|
columnLabel: column.field || column.name || column.id,
|
|
4284
4607
|
columnFilterValue: column.computedFilterValue,
|
|
4285
4608
|
columnHeaderHeight
|
|
4286
|
-
}) : /* @__PURE__ */
|
|
4609
|
+
}) : /* @__PURE__ */ React20.createElement(InfiniteTableColumnHeaderFilterEmpty, null) : null,
|
|
4287
4610
|
renderChildren
|
|
4288
4611
|
}), draggingProxy);
|
|
4289
4612
|
}
|
|
4290
4613
|
function useInfiniteHeaderCell() {
|
|
4291
|
-
const result = (0,
|
|
4614
|
+
const result = (0, import_react22.useContext)(InfiniteTableHeaderCellContext);
|
|
4292
4615
|
return result;
|
|
4293
4616
|
}
|
|
4294
4617
|
|
|
4295
4618
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx
|
|
4296
|
-
var
|
|
4619
|
+
var React23 = __toModule(require("react"));
|
|
4297
4620
|
|
|
4298
4621
|
// src/components/utils/getScrollbarWidth.ts
|
|
4299
4622
|
var scrollbarWidth;
|
|
@@ -4415,11 +4738,11 @@ function assignGroupOffsetsAndComputedWidths(items, groupOffset = 0) {
|
|
|
4415
4738
|
}
|
|
4416
4739
|
|
|
4417
4740
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
|
|
4418
|
-
var
|
|
4419
|
-
var
|
|
4741
|
+
var React22 = __toModule(require("react"));
|
|
4742
|
+
var import_react23 = __toModule(require("react"));
|
|
4420
4743
|
|
|
4421
4744
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderGroup.tsx
|
|
4422
|
-
var
|
|
4745
|
+
var React21 = __toModule(require("react"));
|
|
4423
4746
|
var TableHeaderGroupClassName = `${rootClassName2}HeaderGroup`;
|
|
4424
4747
|
function InfiniteTableHeaderGroup(props) {
|
|
4425
4748
|
const { columnGroup, height, width } = props;
|
|
@@ -4429,19 +4752,19 @@ function InfiniteTableHeaderGroup(props) {
|
|
|
4429
4752
|
columnGroup
|
|
4430
4753
|
});
|
|
4431
4754
|
}
|
|
4432
|
-
return /* @__PURE__ */
|
|
4755
|
+
return /* @__PURE__ */ React21.createElement("div", {
|
|
4433
4756
|
ref: props.domRef,
|
|
4434
4757
|
"data-group-id": columnGroup.uniqueGroupId,
|
|
4435
4758
|
className: join(HeaderGroupCls, TableHeaderGroupClassName),
|
|
4436
4759
|
style: { width, height }
|
|
4437
|
-
}, /* @__PURE__ */
|
|
4760
|
+
}, /* @__PURE__ */ React21.createElement("div", {
|
|
4438
4761
|
className: join(`${TableHeaderGroupClassName}__header-content`, cssEllipsisClassName)
|
|
4439
4762
|
}, header));
|
|
4440
4763
|
}
|
|
4441
4764
|
|
|
4442
4765
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeader.tsx
|
|
4443
|
-
var { rootClassName:
|
|
4444
|
-
var TableHeaderClassName = `${
|
|
4766
|
+
var { rootClassName: rootClassName8 } = internalProps;
|
|
4767
|
+
var TableHeaderClassName = `${rootClassName8}Header`;
|
|
4445
4768
|
function InfiniteTableHeaderFn(props) {
|
|
4446
4769
|
const {
|
|
4447
4770
|
brain,
|
|
@@ -4457,7 +4780,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4457
4780
|
componentState: { headerBrain, headerOptions }
|
|
4458
4781
|
} = useInfiniteTable();
|
|
4459
4782
|
const { computedVisibleColumnsMap, showColumnFilters } = computed;
|
|
4460
|
-
(0,
|
|
4783
|
+
(0, import_react23.useEffect)(() => {
|
|
4461
4784
|
const onScroll = (scrollPosition) => {
|
|
4462
4785
|
if (domRef.current) {
|
|
4463
4786
|
domRef.current.style.transform = `translate3d(-${scrollPosition.scrollLeft}px, 0px, 0px)`;
|
|
@@ -4466,7 +4789,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4466
4789
|
const removeOnScroll = brain.onScroll(onScroll);
|
|
4467
4790
|
return removeOnScroll;
|
|
4468
4791
|
}, [brain]);
|
|
4469
|
-
const domRef = (0,
|
|
4792
|
+
const domRef = (0, import_react23.useRef)(null);
|
|
4470
4793
|
const headerCls = HeaderClsRecipe({
|
|
4471
4794
|
overflow: false,
|
|
4472
4795
|
virtualized: true
|
|
@@ -4476,7 +4799,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4476
4799
|
className: join(TableHeaderClassName, `${TableHeaderClassName}--virtualized`, className, headerCls),
|
|
4477
4800
|
style: __spreadProps(__spreadValues({}, style), { height: columnHeaderHeight })
|
|
4478
4801
|
};
|
|
4479
|
-
const renderCell = (0,
|
|
4802
|
+
const renderCell = (0, import_react23.useCallback)((params) => {
|
|
4480
4803
|
const {
|
|
4481
4804
|
rowIndex,
|
|
4482
4805
|
colIndex,
|
|
@@ -4501,7 +4824,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4501
4824
|
computedWidth: colGroupItem.computedWidth,
|
|
4502
4825
|
groupOffset: colGroupItem.groupOffset
|
|
4503
4826
|
});
|
|
4504
|
-
return /* @__PURE__ */
|
|
4827
|
+
return /* @__PURE__ */ React22.createElement(InfiniteTableHeaderGroup, {
|
|
4505
4828
|
domRef: domRef2,
|
|
4506
4829
|
columns: columns2,
|
|
4507
4830
|
width: widthWithColspan,
|
|
@@ -4509,7 +4832,7 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4509
4832
|
columnGroup: computedColumnGroup
|
|
4510
4833
|
});
|
|
4511
4834
|
}
|
|
4512
|
-
return /* @__PURE__ */
|
|
4835
|
+
return /* @__PURE__ */ React22.createElement(InfiniteTableHeaderCell, {
|
|
4513
4836
|
domRef: domRef2,
|
|
4514
4837
|
column,
|
|
4515
4838
|
headerOptions,
|
|
@@ -4525,13 +4848,13 @@ function InfiniteTableHeaderFn(props) {
|
|
|
4525
4848
|
columnGroupsMaxDepth,
|
|
4526
4849
|
showColumnFilters
|
|
4527
4850
|
]);
|
|
4528
|
-
return /* @__PURE__ */
|
|
4851
|
+
return /* @__PURE__ */ React22.createElement("div", __spreadValues({}, domProps), /* @__PURE__ */ React22.createElement(RawTable, {
|
|
4529
4852
|
renderCell,
|
|
4530
4853
|
brain: headerBrain,
|
|
4531
4854
|
cellHoverClassNames: []
|
|
4532
4855
|
}));
|
|
4533
4856
|
}
|
|
4534
|
-
var InfiniteTableHeader =
|
|
4857
|
+
var InfiniteTableHeader = React22.memo(InfiniteTableHeaderFn);
|
|
4535
4858
|
|
|
4536
4859
|
// src/components/InfiniteTable/components/InfiniteTableHeader/InfiniteTableHeaderWrapper.tsx
|
|
4537
4860
|
function TableHeaderWrapper(props) {
|
|
@@ -4554,13 +4877,13 @@ function TableHeaderWrapper(props) {
|
|
|
4554
4877
|
} = tableContextValue;
|
|
4555
4878
|
const rows = !computedColumnGroups || !computedColumnGroups.size ? 1 : columnGroupsMaxDepth + 2;
|
|
4556
4879
|
const height = rows * columnHeaderHeight + (showColumnFilters ? columnHeaderHeight : 0);
|
|
4557
|
-
const columnAndGroupTreeInfo =
|
|
4880
|
+
const columnAndGroupTreeInfo = React23.useMemo(() => {
|
|
4558
4881
|
if (!computedColumnGroups || !computedColumnGroups.size) {
|
|
4559
4882
|
return void 0;
|
|
4560
4883
|
}
|
|
4561
4884
|
return buildColumnAndGroupTree(computedVisibleColumns, computedColumnGroups, columnGroupsDepthsMap, columnGroupsMaxDepth);
|
|
4562
4885
|
}, [computedVisibleColumns, computedColumnGroups, columnGroupsDepthsMap]);
|
|
4563
|
-
const cellspan =
|
|
4886
|
+
const cellspan = React23.useCallback(({ rowIndex, colIndex }) => {
|
|
4564
4887
|
const column = computedVisibleColumns[colIndex];
|
|
4565
4888
|
const rowspan2 = 1;
|
|
4566
4889
|
const colspan2 = 1;
|
|
@@ -4593,9 +4916,9 @@ function TableHeaderWrapper(props) {
|
|
|
4593
4916
|
rows,
|
|
4594
4917
|
columnGroupsDepthsMap
|
|
4595
4918
|
]);
|
|
4596
|
-
const rowspan =
|
|
4597
|
-
const colspan =
|
|
4598
|
-
const rowHeight =
|
|
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) => {
|
|
4599
4922
|
return showColumnFilters ? index < rows - 1 ? columnHeaderHeight : 2 * columnHeaderHeight : columnHeaderHeight;
|
|
4600
4923
|
}, [rows, showColumnFilters, columnHeaderHeight]);
|
|
4601
4924
|
useMatrixBrain(brain, {
|
|
@@ -4610,21 +4933,21 @@ function TableHeaderWrapper(props) {
|
|
|
4610
4933
|
fixedColsEnd: computedPinnedEndColumns.length,
|
|
4611
4934
|
fixedColsStart: computedPinnedStartColumns.length
|
|
4612
4935
|
});
|
|
4613
|
-
const header = /* @__PURE__ */
|
|
4936
|
+
const header = /* @__PURE__ */ React23.createElement(InfiniteTableHeader, {
|
|
4614
4937
|
columns: computedVisibleColumns,
|
|
4615
4938
|
brain,
|
|
4616
4939
|
columnHeaderHeight: height,
|
|
4617
4940
|
columnGroupsMaxDepth,
|
|
4618
4941
|
columnAndGroupTreeInfo
|
|
4619
4942
|
});
|
|
4620
|
-
const verticalScrollbarPlaceholder = scrollbars.vertical && getScrollbarWidth() ? /* @__PURE__ */
|
|
4943
|
+
const verticalScrollbarPlaceholder = scrollbars.vertical && getScrollbarWidth() ? /* @__PURE__ */ React23.createElement("div", {
|
|
4621
4944
|
className: HeaderScrollbarPlaceholderCls,
|
|
4622
4945
|
style: {
|
|
4623
4946
|
zIndex: 1e3,
|
|
4624
4947
|
width: getScrollbarWidth()
|
|
4625
4948
|
}
|
|
4626
4949
|
}) : null;
|
|
4627
|
-
return /* @__PURE__ */
|
|
4950
|
+
return /* @__PURE__ */ React23.createElement("div", {
|
|
4628
4951
|
className: HeaderWrapperCls,
|
|
4629
4952
|
style: {
|
|
4630
4953
|
height
|
|
@@ -4633,8 +4956,8 @@ function TableHeaderWrapper(props) {
|
|
|
4633
4956
|
}
|
|
4634
4957
|
|
|
4635
4958
|
// src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
|
|
4636
|
-
var
|
|
4637
|
-
var
|
|
4959
|
+
var React24 = __toModule(require("react"));
|
|
4960
|
+
var import_react24 = __toModule(require("react"));
|
|
4638
4961
|
|
|
4639
4962
|
// src/components/utils/decamelize.ts
|
|
4640
4963
|
function decamelize(str, options) {
|
|
@@ -4643,15 +4966,15 @@ function decamelize(str, options) {
|
|
|
4643
4966
|
}
|
|
4644
4967
|
|
|
4645
4968
|
// src/components/InfiniteTable/theme.css.ts
|
|
4646
|
-
var ThemeVars = { color: { accent: "var(--infinite-accent-color)", color: "var(--infinite-color)" }, spacing: { "0": "var(--infinite-space-0)", "1": "var(--infinite-space-1)", "2": "var(--infinite-space-2)", "3": "var(--infinite-space-3)", "4": "var(--infinite-space-4)", "5": "var(--infinite-space-5)", "6": "var(--infinite-space-6)", "7": "var(--infinite-space-7)", "8": "var(--infinite-space-8)", "9": "var(--infinite-space-9)", "10": "var(--infinite-space-10)" }, fontSize: { "0": "var(--infinite-font-size-0)", "1": "var(--infinite-font-size-1)", "2": "var(--infinite-font-size-2)", "3": "var(--infinite-font-size-3)", "4": "var(--infinite-font-size-4)", "5": "var(--infinite-font-size-5)", "6": "var(--infinite-font-size-6)", "7": "var(--infinite-font-size-7)" }, fontFamily: "var(--infinite-font-family)", minHeight: "var(--infinite-min-height)", borderRadius: "var(--infinite-border-radius)", background: "var(--infinite-background)", components: { LoadMask: { padding: "var(--infinite-load-mask-padding)", color: "var(--infinite-load-mask-color)", textBackground: "var(--infinite-load-mask-text-background)", overlayBackground: "var(--infinite-load-mask-overlay-background)", overlayOpacity: "var(--infinite-load-mask-overlay-opacity)", borderRadius: "var(--infinite-load-mask-border-radius)" }, Header: { background: "var(--infinite-header-background)", color: "var(--infinite-header-color)", columnHeaderHeight: "var(--infinite-column-header-height)" }, HeaderCell: { draggingBackground: "var(--infinite-header-cell-dragging-background)", background: "var(--infinite-header-cell-background)", padding: "var(--infinite-header-cell-padding)", paddingX: "var(--infinite-header-cell-padding-x)", paddingY: "var(--infinite-header-cell-padding-y)", iconSize: "var(--infinite-header-cell-icon-size)", sortIconMargin: "var(--infinite-header-cell-sort-icon-margin)" }, Cell: { padding: "var(--infinite-cell-padding)", borderWidth: "var(--infinite-cell-border-width)", border: "var(--infinite-cell-border)", borderInvisible: "var(--infinite-cell-border-invisible)", borderRadius: "var(--infinite-cell-border-radius)", color: "var(--infinite-cell-color)" }, Row: { background: "var(--infinite-row-background)", oddBackground: "var(--infinite-row-odd-background)", hoverBackground: "var(--infinite-row-hover-background)", groupRowBackground: "var(--infinite-group-row-background)", groupRowColumnNesting: "var(--infinite-group-row-column-nesting)", groupNesting: "var(--infinite-dont-override-group-row-nesting-length)", pointerEventsWhileScrolling: "var(--infinite-row-pointer-events-while-scrolling)" }, ColumnCell: { background: "var(--infinite-column-cell-bg-dont-override)" } } };
|
|
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)" } } };
|
|
4647
4970
|
|
|
4648
4971
|
// src/components/InfiniteTable/InfiniteCls.css.ts
|
|
4649
4972
|
var import_createRuntimeFn3 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
4650
4973
|
var FooterCls = "_16lm1iw1";
|
|
4651
|
-
var InfiniteCls = "_1yeub2v0 _16lm1iw1
|
|
4652
|
-
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: [] });
|
|
4653
|
-
var InfiniteClsShiftingColumns = "
|
|
4654
|
-
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: [] });
|
|
4655
4978
|
|
|
4656
4979
|
// src/components/InfiniteTable/components/InfiniteTableLicenseFooter/index.tsx
|
|
4657
4980
|
var defaultStyle = {
|
|
@@ -4680,10 +5003,10 @@ var enforceStyle = (node, style) => {
|
|
|
4680
5003
|
node.style.setProperty(decamelize(propertyName), propertyValue, "important");
|
|
4681
5004
|
}
|
|
4682
5005
|
};
|
|
4683
|
-
var InfiniteTableLicenseFooter =
|
|
4684
|
-
const { rootClassName:
|
|
4685
|
-
const domRef =
|
|
4686
|
-
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) => {
|
|
4687
5010
|
domRef.current = node;
|
|
4688
5011
|
if (!ref) {
|
|
4689
5012
|
return;
|
|
@@ -4694,7 +5017,7 @@ var InfiniteTableLicenseFooter = React22.forwardRef(function InfiniteTableLicens
|
|
|
4694
5017
|
ref.current = node;
|
|
4695
5018
|
}
|
|
4696
5019
|
}, []);
|
|
4697
|
-
(0,
|
|
5020
|
+
(0, import_react24.useEffect)(() => {
|
|
4698
5021
|
const forceStyle = () => {
|
|
4699
5022
|
requestAnimationFrame(() => {
|
|
4700
5023
|
var _a;
|
|
@@ -4708,12 +5031,12 @@ var InfiniteTableLicenseFooter = React22.forwardRef(function InfiniteTableLicens
|
|
|
4708
5031
|
clearInterval(intervalId);
|
|
4709
5032
|
};
|
|
4710
5033
|
}, []);
|
|
4711
|
-
return /* @__PURE__ */
|
|
5034
|
+
return /* @__PURE__ */ React24.createElement("div", __spreadProps(__spreadValues({
|
|
4712
5035
|
ref: domCallback
|
|
4713
5036
|
}, props), {
|
|
4714
|
-
className: join(`${
|
|
5037
|
+
className: join(`${rootClassName11}-Footer`, FooterCls, props.className),
|
|
4715
5038
|
style: defaultStyle
|
|
4716
|
-
}), "Powered by", " ", /* @__PURE__ */
|
|
5039
|
+
}), "Powered by", " ", /* @__PURE__ */ React24.createElement("a", {
|
|
4717
5040
|
href: "https://infinite-table.com",
|
|
4718
5041
|
rel: "noopener noreferrer",
|
|
4719
5042
|
role: "link",
|
|
@@ -4722,11 +5045,11 @@ var InfiniteTableLicenseFooter = React22.forwardRef(function InfiniteTableLicens
|
|
|
4722
5045
|
});
|
|
4723
5046
|
|
|
4724
5047
|
// src/components/InfiniteTable/components/InfiniteTableRow/InfiniteTableColumnCell.tsx
|
|
4725
|
-
var
|
|
4726
|
-
var
|
|
4727
|
-
var { rootClassName:
|
|
4728
|
-
var InfiniteTableColumnCellContext =
|
|
4729
|
-
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`;
|
|
4730
5053
|
function isColumnWithField(c) {
|
|
4731
5054
|
return typeof c.field === "string";
|
|
4732
5055
|
}
|
|
@@ -4750,13 +5073,16 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
4750
5073
|
showZebraRows
|
|
4751
5074
|
} = props;
|
|
4752
5075
|
if (!column) {
|
|
4753
|
-
return /* @__PURE__ */
|
|
5076
|
+
return /* @__PURE__ */ React25.createElement("div", {
|
|
4754
5077
|
ref: domRef
|
|
4755
5078
|
}, "no column");
|
|
4756
5079
|
}
|
|
4757
5080
|
const { data, isGroupRow, dataSourceHasGrouping } = rowInfo;
|
|
4758
5081
|
const groupBy = dataSourceHasGrouping ? rowInfo.groupBy : void 0;
|
|
4759
5082
|
const groupRowInfo = null;
|
|
5083
|
+
const { getState, componentActions } = useInfiniteTable();
|
|
5084
|
+
const { activeRowIndex, keyboardNavigation } = getState();
|
|
5085
|
+
const rowActive = rowIndex === activeRowIndex && keyboardNavigation === "row";
|
|
4760
5086
|
let value = isGroupRow && groupBy && column.groupByField ? rowInfo.value : isColumnWithField(column) ? data == null ? void 0 : data[column.field] : null;
|
|
4761
5087
|
if (column.valueGetter) {
|
|
4762
5088
|
if (!rowInfo.isGroupRow && rowInfo.data) {
|
|
@@ -4768,27 +5094,43 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
4768
5094
|
data: rowInfo.data,
|
|
4769
5095
|
isGroupRow,
|
|
4770
5096
|
rowInfo,
|
|
5097
|
+
rowActive,
|
|
4771
5098
|
field: column.field,
|
|
4772
5099
|
value
|
|
4773
5100
|
} : {
|
|
4774
5101
|
data: rowInfo.data,
|
|
4775
5102
|
isGroupRow,
|
|
5103
|
+
rowActive,
|
|
4776
5104
|
rowInfo,
|
|
4777
5105
|
field: column.field,
|
|
4778
5106
|
value
|
|
4779
5107
|
});
|
|
4780
5108
|
}
|
|
5109
|
+
const onClick = (0, import_react25.useCallback)(() => {
|
|
5110
|
+
if (keyboardNavigation === "row") {
|
|
5111
|
+
componentActions.activeRowIndex = rowIndex;
|
|
5112
|
+
return;
|
|
5113
|
+
}
|
|
5114
|
+
if (keyboardNavigation === "cell") {
|
|
5115
|
+
componentActions.activeCellIndex = [
|
|
5116
|
+
rowIndex,
|
|
5117
|
+
column.computedVisibleIndex
|
|
5118
|
+
];
|
|
5119
|
+
}
|
|
5120
|
+
}, [rowIndex, column.computedVisibleIndex, keyboardNavigation]);
|
|
4781
5121
|
const { componentState: computedDataSource } = useDataSourceContextValue();
|
|
4782
5122
|
const rest = rowInfo.isGroupRow ? {
|
|
4783
5123
|
rowInfo,
|
|
4784
5124
|
isGroupRow: rowInfo.isGroupRow,
|
|
4785
5125
|
data: rowInfo.data,
|
|
5126
|
+
rowActive,
|
|
4786
5127
|
value,
|
|
4787
5128
|
field: column.field
|
|
4788
5129
|
} : {
|
|
4789
5130
|
rowInfo,
|
|
4790
5131
|
isGroupRow: rowInfo.isGroupRow,
|
|
4791
5132
|
data: rowInfo.data,
|
|
5133
|
+
rowActive,
|
|
4792
5134
|
value,
|
|
4793
5135
|
field: column.field
|
|
4794
5136
|
};
|
|
@@ -4804,28 +5146,28 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
4804
5146
|
isGroupRow,
|
|
4805
5147
|
rowIndex,
|
|
4806
5148
|
toggleGroupRow,
|
|
4807
|
-
toggleCurrentGroupRow: () => {
|
|
5149
|
+
toggleCurrentGroupRow: (0, import_react25.useCallback)(() => {
|
|
4808
5150
|
if (!rowInfo.isGroupRow) {
|
|
4809
5151
|
return;
|
|
4810
5152
|
}
|
|
4811
5153
|
toggleGroupRow(rowInfo.groupKeys);
|
|
4812
|
-
},
|
|
5154
|
+
}, []),
|
|
4813
5155
|
groupBy: computedDataSource.groupBy,
|
|
4814
5156
|
pivotBy: computedDataSource.pivotBy
|
|
4815
5157
|
});
|
|
4816
|
-
const renderChildren = () => {
|
|
5158
|
+
const renderChildren = (0, import_react25.useCallback)(() => {
|
|
4817
5159
|
if (hidden) {
|
|
4818
5160
|
return null;
|
|
4819
5161
|
}
|
|
4820
5162
|
const renderFn = column.render || column.renderValue;
|
|
4821
5163
|
if (renderFn) {
|
|
4822
|
-
return /* @__PURE__ */
|
|
5164
|
+
return /* @__PURE__ */ React25.createElement(RenderHookComponent, {
|
|
4823
5165
|
render: renderFn,
|
|
4824
5166
|
renderParam
|
|
4825
5167
|
});
|
|
4826
5168
|
}
|
|
4827
5169
|
return renderValue;
|
|
4828
|
-
};
|
|
5170
|
+
}, [column, hidden, ...Object.values(renderParam)]);
|
|
4829
5171
|
const rowPropsAndStyleArgs = __spreadProps(__spreadValues({}, rest), {
|
|
4830
5172
|
rowIndex
|
|
4831
5173
|
});
|
|
@@ -4838,6 +5180,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
4838
5180
|
style = column.style ? typeof column.style === "function" ? __spreadValues(__spreadValues({}, style), column.style(stylingRenderParam) || {}) : __spreadValues(__spreadValues({}, style), column.style) : style || {};
|
|
4839
5181
|
style.width = width;
|
|
4840
5182
|
style.height = rowHeight;
|
|
5183
|
+
const memoizedStyle = (0, import_react25.useMemo)(() => style, [!style ? null : JSON.stringify(style)]);
|
|
4841
5184
|
const odd = (rowInfo.indexInAll != null ? rowInfo.indexInAll : rowIndex) % 2 === 1;
|
|
4842
5185
|
const zebra = showZebraRows ? odd ? "odd" : "even" : false;
|
|
4843
5186
|
const cellProps = {
|
|
@@ -4847,21 +5190,22 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
4847
5190
|
column,
|
|
4848
5191
|
width,
|
|
4849
5192
|
offset: virtualized ? 0 : column.computedPinningOffset,
|
|
4850
|
-
style,
|
|
5193
|
+
style: memoizedStyle,
|
|
4851
5194
|
onMouseLeave,
|
|
4852
5195
|
onMouseEnter,
|
|
5196
|
+
onClick,
|
|
4853
5197
|
cssEllipsis: (_a = column.cssEllipsis) != null ? _a : true,
|
|
4854
|
-
className: join(useCellClassName(column, [InfiniteTableColumnCellClassName, InfiniteTableCellClassName], ColumnCellRecipe, { dragging: false, zebra }), colClassName, rowComputedClassName),
|
|
5198
|
+
className: join(useCellClassName(column, [InfiniteTableColumnCellClassName, InfiniteTableCellClassName], ColumnCellRecipe, { dragging: false, zebra, rowActive }), colClassName, rowComputedClassName),
|
|
4855
5199
|
renderChildren
|
|
4856
5200
|
};
|
|
4857
5201
|
const ContextProvider = InfiniteTableColumnCellContext.Provider;
|
|
4858
|
-
return /* @__PURE__ */
|
|
5202
|
+
return /* @__PURE__ */ React25.createElement(ContextProvider, {
|
|
4859
5203
|
value: renderParam
|
|
4860
|
-
}, /* @__PURE__ */
|
|
5204
|
+
}, /* @__PURE__ */ React25.createElement(InfiniteTableCell, __spreadValues({}, cellProps)));
|
|
4861
5205
|
}
|
|
4862
|
-
var InfiniteTableColumnCell =
|
|
5206
|
+
var InfiniteTableColumnCell = React25.memo(InfiniteTableColumnCellFn);
|
|
4863
5207
|
function useInfiniteColumnCell() {
|
|
4864
|
-
const result = (0,
|
|
5208
|
+
const result = (0, import_react25.useContext)(InfiniteTableColumnCellContext);
|
|
4865
5209
|
return result;
|
|
4866
5210
|
}
|
|
4867
5211
|
|
|
@@ -4872,30 +5216,92 @@ var RowClsRecipe = (0, import_createRuntimeFn4.createRuntimeFn)({ defaultClassNa
|
|
|
4872
5216
|
var RowHoverCls = "_7pupv01";
|
|
4873
5217
|
|
|
4874
5218
|
// src/components/InfiniteTable/components/LoadMask.tsx
|
|
4875
|
-
var
|
|
5219
|
+
var React26 = __toModule(require("react"));
|
|
4876
5220
|
|
|
4877
5221
|
// src/components/InfiniteTable/components/LoadMask.css.ts
|
|
4878
|
-
var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2
|
|
4879
|
-
var LoadMaskOverlayCls = "qy58ya3 _16lm1iw2
|
|
5222
|
+
var LoadMaskCls = { visible: "qy58ya1 qy58ya0 _16lm1iw2 _16lm1iwu _16lm1iww _16lm1iw10 _16lm1iwy", hidden: "qy58ya2 qy58ya0 _16lm1iw2 _16lm1iwu _16lm1iww _16lm1iw10 _16lm1iwy" };
|
|
5223
|
+
var LoadMaskOverlayCls = "qy58ya3 _16lm1iw2 _16lm1iwu _16lm1iww _16lm1iw10 _16lm1iwy";
|
|
4880
5224
|
var LoadMaskTextCls = "qy58ya4";
|
|
4881
5225
|
|
|
4882
5226
|
// src/components/InfiniteTable/components/LoadMask.tsx
|
|
4883
|
-
var { rootClassName:
|
|
4884
|
-
var
|
|
5227
|
+
var { rootClassName: rootClassName10 } = internalProps;
|
|
5228
|
+
var baseCls3 = `${rootClassName10}-LoadMask`;
|
|
4885
5229
|
function LoadMaskFn(props) {
|
|
4886
5230
|
const { visible, children = "Loading" } = props;
|
|
4887
|
-
return /* @__PURE__ */
|
|
4888
|
-
className: `${LoadMaskCls[visible ? "visible" : "hidden"]} ${
|
|
4889
|
-
}, /* @__PURE__ */
|
|
4890
|
-
className: `${LoadMaskOverlayCls} ${
|
|
4891
|
-
}), /* @__PURE__ */
|
|
4892
|
-
className: `${LoadMaskTextCls} ${
|
|
5231
|
+
return /* @__PURE__ */ React26.createElement("div", {
|
|
5232
|
+
className: `${LoadMaskCls[visible ? "visible" : "hidden"]} ${baseCls3}`
|
|
5233
|
+
}, /* @__PURE__ */ React26.createElement("div", {
|
|
5234
|
+
className: `${LoadMaskOverlayCls} ${baseCls3}-Overlay`
|
|
5235
|
+
}), /* @__PURE__ */ React26.createElement("div", {
|
|
5236
|
+
className: `${LoadMaskTextCls} ${baseCls3}-Text`
|
|
4893
5237
|
}, children));
|
|
4894
5238
|
}
|
|
4895
|
-
var LoadMask =
|
|
5239
|
+
var LoadMask = React26.memo(LoadMaskFn);
|
|
5240
|
+
|
|
5241
|
+
// src/components/InfiniteTable/getImperativeApi.ts
|
|
5242
|
+
function getImperativeApi(getState, getComputed, getDataSourceState, componentActions) {
|
|
5243
|
+
const imperativeApi = {
|
|
5244
|
+
setColumnOrder: (columnOrder) => {
|
|
5245
|
+
componentActions.columnOrder = columnOrder;
|
|
5246
|
+
},
|
|
5247
|
+
setColumnVisibility: (columnVisibility) => {
|
|
5248
|
+
componentActions.columnVisibility = columnVisibility;
|
|
5249
|
+
},
|
|
5250
|
+
getState,
|
|
5251
|
+
getDataSourceState,
|
|
5252
|
+
scrollRowIntoView(rowIndex, config = { offset: 0 }) {
|
|
5253
|
+
const state = getState();
|
|
5254
|
+
const scrollPosition = state.renderer.getScrollPositionForScrollRowIntoView(rowIndex, config);
|
|
5255
|
+
const currentScrollPosition = state.brain.getScrollPosition();
|
|
5256
|
+
if (scrollPosition.scrollTop !== currentScrollPosition.scrollTop) {
|
|
5257
|
+
state.scrollerDOMRef.current.scrollTop = scrollPosition.scrollTop;
|
|
5258
|
+
}
|
|
5259
|
+
},
|
|
5260
|
+
scrollColumnIntoView(colId, config = { offset: 0 }) {
|
|
5261
|
+
const state = getState();
|
|
5262
|
+
const computed = getComputed();
|
|
5263
|
+
const computedColumn = computed.computedVisibleColumnsMap.get(colId);
|
|
5264
|
+
if (!computedColumn) {
|
|
5265
|
+
return;
|
|
5266
|
+
}
|
|
5267
|
+
const colIndex = computedColumn.computedVisibleIndex;
|
|
5268
|
+
const scrollPosition = state.renderer.getScrollPositionForScrollColumnIntoView(colIndex, config);
|
|
5269
|
+
const currentScrollPosition = state.brain.getScrollPosition();
|
|
5270
|
+
if (scrollPosition.scrollLeft !== currentScrollPosition.scrollLeft) {
|
|
5271
|
+
state.scrollerDOMRef.current.scrollLeft = scrollPosition.scrollLeft;
|
|
5272
|
+
}
|
|
5273
|
+
},
|
|
5274
|
+
scrollCellIntoView(rowIndex, colIdOrIndex, config = { offset: 0 }) {
|
|
5275
|
+
const state = getState();
|
|
5276
|
+
const computed = getComputed();
|
|
5277
|
+
let colIndex = colIdOrIndex;
|
|
5278
|
+
if (typeof colIdOrIndex === "string") {
|
|
5279
|
+
const computedColumn = computed.computedVisibleColumnsMap.get(colIdOrIndex);
|
|
5280
|
+
if (!computedColumn) {
|
|
5281
|
+
return;
|
|
5282
|
+
}
|
|
5283
|
+
colIndex = computedColumn.computedVisibleIndex;
|
|
5284
|
+
}
|
|
5285
|
+
const scrollPositionForCol = state.renderer.getScrollPositionForScrollColumnIntoView(colIndex, config);
|
|
5286
|
+
const scrollPositionForRow = state.renderer.getScrollPositionForScrollRowIntoView(rowIndex, config);
|
|
5287
|
+
const newScrollPosition = {
|
|
5288
|
+
scrollLeft: scrollPositionForCol.scrollLeft,
|
|
5289
|
+
scrollTop: scrollPositionForRow.scrollTop
|
|
5290
|
+
};
|
|
5291
|
+
const currentScrollPosition = state.brain.getScrollPosition();
|
|
5292
|
+
if (newScrollPosition.scrollLeft !== currentScrollPosition.scrollLeft) {
|
|
5293
|
+
state.scrollerDOMRef.current.scrollLeft = newScrollPosition.scrollLeft;
|
|
5294
|
+
}
|
|
5295
|
+
if (newScrollPosition.scrollTop !== currentScrollPosition.scrollTop) {
|
|
5296
|
+
state.scrollerDOMRef.current.scrollTop = newScrollPosition.scrollTop;
|
|
5297
|
+
}
|
|
5298
|
+
}
|
|
5299
|
+
};
|
|
5300
|
+
return imperativeApi;
|
|
5301
|
+
}
|
|
4896
5302
|
|
|
4897
5303
|
// src/components/InfiniteTable/hooks/useAutoSizeColumns.ts
|
|
4898
|
-
var
|
|
5304
|
+
var import_react26 = __toModule(require("react"));
|
|
4899
5305
|
var OFFSET = 10;
|
|
4900
5306
|
function getColumnContentMaxWidths(domRef, options) {
|
|
4901
5307
|
var _a;
|
|
@@ -4955,11 +5361,11 @@ function useAutoSizeColumns() {
|
|
|
4955
5361
|
componentActions,
|
|
4956
5362
|
componentState: { domRef, ready, autoSizeColumnsKey, brain }
|
|
4957
5363
|
} = useComponentState();
|
|
4958
|
-
const [refreshId, setRefreshId] = (0,
|
|
5364
|
+
const [refreshId, setRefreshId] = (0, import_react26.useState)(0);
|
|
4959
5365
|
const theKey = typeof autoSizeColumnsKey === "object" ? autoSizeColumnsKey.key : autoSizeColumnsKey;
|
|
4960
5366
|
const getTheKey = useLatest(theKey);
|
|
4961
|
-
const lastExecutedIdentifierRef = (0,
|
|
4962
|
-
(0,
|
|
5367
|
+
const lastExecutedIdentifierRef = (0, import_react26.useRef)(null);
|
|
5368
|
+
(0, import_react26.useEffect)(() => {
|
|
4963
5369
|
const key = getTheKey();
|
|
4964
5370
|
if (key == null) {
|
|
4965
5371
|
return;
|
|
@@ -4972,7 +5378,7 @@ function useAutoSizeColumns() {
|
|
|
4972
5378
|
};
|
|
4973
5379
|
return brain.onRenderRangeChange(onChange);
|
|
4974
5380
|
}, [brain]);
|
|
4975
|
-
(0,
|
|
5381
|
+
(0, import_react26.useEffect)(() => {
|
|
4976
5382
|
var _a;
|
|
4977
5383
|
if (theKey == null) {
|
|
4978
5384
|
return;
|
|
@@ -5017,20 +5423,8 @@ function useAutoSizeColumns() {
|
|
|
5017
5423
|
}
|
|
5018
5424
|
|
|
5019
5425
|
// src/components/InfiniteTable/hooks/useCellRendering.tsx
|
|
5020
|
-
var
|
|
5021
|
-
var
|
|
5022
|
-
|
|
5023
|
-
// src/components/hooks/useRerender.ts
|
|
5024
|
-
var import_react24 = __toModule(require("react"));
|
|
5025
|
-
var useRerender = () => {
|
|
5026
|
-
const [state, setState] = (0, import_react24.useState)(0);
|
|
5027
|
-
return [
|
|
5028
|
-
state,
|
|
5029
|
-
(0, import_react24.useCallback)(() => {
|
|
5030
|
-
setState((state2) => state2 + 1);
|
|
5031
|
-
}, [setState])
|
|
5032
|
-
];
|
|
5033
|
-
};
|
|
5426
|
+
var import_react27 = __toModule(require("react"));
|
|
5427
|
+
var import_react28 = __toModule(require("react"));
|
|
5034
5428
|
|
|
5035
5429
|
// src/components/InfiniteTable/hooks/useYourBrain.ts
|
|
5036
5430
|
function useYourBrain(param) {
|
|
@@ -5060,7 +5454,7 @@ function useYourBrain(param) {
|
|
|
5060
5454
|
// src/components/InfiniteTable/hooks/useCellRendering.tsx
|
|
5061
5455
|
var SCROLL_BOTTOM_OFFSET = 1;
|
|
5062
5456
|
function useCellRendering(param) {
|
|
5063
|
-
const { computed, bodySize } = param;
|
|
5457
|
+
const { computed, bodySize, imperativeApi } = param;
|
|
5064
5458
|
const { componentActions, componentState, getState } = useInfiniteTable();
|
|
5065
5459
|
const {
|
|
5066
5460
|
computedPinnedStartColumns,
|
|
@@ -5100,13 +5494,13 @@ function useCellRendering(param) {
|
|
|
5100
5494
|
bodySize,
|
|
5101
5495
|
rowspan
|
|
5102
5496
|
});
|
|
5103
|
-
const scrollTopMaxRef = (0,
|
|
5104
|
-
(0,
|
|
5497
|
+
const scrollTopMaxRef = (0, import_react27.useRef)(0);
|
|
5498
|
+
(0, import_react27.useEffect)(() => {
|
|
5105
5499
|
return brain.onRenderCountChange(() => {
|
|
5106
5500
|
scrollTopMaxRef.current = brain.scrollTopMax;
|
|
5107
5501
|
});
|
|
5108
5502
|
}, [brain]);
|
|
5109
|
-
(0,
|
|
5503
|
+
(0, import_react27.useEffect)(() => {
|
|
5110
5504
|
return brain.onScrollStop((scrollPosition) => {
|
|
5111
5505
|
const { scrollTop } = scrollPosition;
|
|
5112
5506
|
if (scrollTop === 0) {
|
|
@@ -5123,31 +5517,21 @@ function useCellRendering(param) {
|
|
|
5123
5517
|
}
|
|
5124
5518
|
});
|
|
5125
5519
|
}, [brain, onScrollToTop, onScrollToBottom]);
|
|
5126
|
-
(0,
|
|
5520
|
+
(0, import_react27.useEffect)(() => {
|
|
5127
5521
|
if (!bodySize.height) {
|
|
5128
5522
|
return;
|
|
5129
5523
|
}
|
|
5130
5524
|
const { onReady } = getState();
|
|
5131
5525
|
componentActions.ready = true;
|
|
5132
5526
|
if (onReady) {
|
|
5133
|
-
const imperativeApi = {
|
|
5134
|
-
setColumnOrder: (columnOrder) => {
|
|
5135
|
-
componentActions.columnOrder = columnOrder;
|
|
5136
|
-
},
|
|
5137
|
-
setColumnVisibility: (columnVisibility) => {
|
|
5138
|
-
componentActions.columnVisibility = columnVisibility;
|
|
5139
|
-
},
|
|
5140
|
-
getState,
|
|
5141
|
-
getDataSourceState
|
|
5142
|
-
};
|
|
5143
5527
|
onReady(imperativeApi);
|
|
5144
5528
|
}
|
|
5145
5529
|
}, [!!bodySize.height]);
|
|
5146
5530
|
const [, rerender] = useRerender();
|
|
5147
|
-
(0,
|
|
5531
|
+
(0, import_react27.useEffect)(() => {
|
|
5148
5532
|
rerender();
|
|
5149
5533
|
}, [dataSourceState]);
|
|
5150
|
-
const renderCell = (0,
|
|
5534
|
+
const renderCell = (0, import_react27.useCallback)((params) => {
|
|
5151
5535
|
const {
|
|
5152
5536
|
rowIndex,
|
|
5153
5537
|
colIndex,
|
|
@@ -5182,7 +5566,7 @@ function useCellRendering(param) {
|
|
|
5182
5566
|
rowStyle,
|
|
5183
5567
|
rowClassName
|
|
5184
5568
|
};
|
|
5185
|
-
return /* @__PURE__ */
|
|
5569
|
+
return /* @__PURE__ */ import_react28.default.createElement(InfiniteTableColumnCell, __spreadValues({}, cellProps));
|
|
5186
5570
|
}, [
|
|
5187
5571
|
rowHeight,
|
|
5188
5572
|
getData,
|
|
@@ -5200,13 +5584,13 @@ function useCellRendering(param) {
|
|
|
5200
5584
|
}
|
|
5201
5585
|
|
|
5202
5586
|
// src/components/InfiniteTable/hooks/useComputed.ts
|
|
5203
|
-
var
|
|
5587
|
+
var import_react42 = __toModule(require("react"));
|
|
5204
5588
|
|
|
5205
5589
|
// src/components/InfiniteTable/hooks/useColumnGroups.ts
|
|
5206
|
-
var
|
|
5590
|
+
var import_react30 = __toModule(require("react"));
|
|
5207
5591
|
|
|
5208
5592
|
// src/components/hooks/useInterceptedMap.ts
|
|
5209
|
-
var
|
|
5593
|
+
var import_react29 = __toModule(require("react"));
|
|
5210
5594
|
function interceptMap(map2, fns) {
|
|
5211
5595
|
const { set, delete: deleteKey, clear } = map2;
|
|
5212
5596
|
if (fns.set) {
|
|
@@ -5294,7 +5678,7 @@ function useColumnGroups() {
|
|
|
5294
5678
|
componentActions,
|
|
5295
5679
|
getComponentState
|
|
5296
5680
|
} = useComponentState();
|
|
5297
|
-
(0,
|
|
5681
|
+
(0, import_react30.useEffect)(() => {
|
|
5298
5682
|
const recompute = () => {
|
|
5299
5683
|
componentActions.columnGroupsDepthsMap = computeColumnGroupsDepths(computedColumnGroups);
|
|
5300
5684
|
};
|
|
@@ -5305,7 +5689,7 @@ function useColumnGroups() {
|
|
|
5305
5689
|
set: update
|
|
5306
5690
|
});
|
|
5307
5691
|
}, [computedColumnGroups]);
|
|
5308
|
-
(0,
|
|
5692
|
+
(0, import_react30.useEffect)(() => {
|
|
5309
5693
|
return interceptMap(collapsedColumnGroups, {
|
|
5310
5694
|
set: (key, visibleCol) => {
|
|
5311
5695
|
const colIds = key.slice(1);
|
|
@@ -5340,10 +5724,10 @@ function useColumnGroups() {
|
|
|
5340
5724
|
}
|
|
5341
5725
|
|
|
5342
5726
|
// src/components/InfiniteTable/hooks/useColumnRowspan.ts
|
|
5343
|
-
var
|
|
5727
|
+
var import_react31 = __toModule(require("react"));
|
|
5344
5728
|
function useColumnRowspan(computedVisibleColumns) {
|
|
5345
5729
|
const { getState: getDataSourceState } = useDataSourceContextValue();
|
|
5346
|
-
const rowspan = (0,
|
|
5730
|
+
const rowspan = (0, import_react31.useMemo)(() => {
|
|
5347
5731
|
const colsWithRowspan = computedVisibleColumns.filter((col) => typeof col.rowspan === "function");
|
|
5348
5732
|
return colsWithRowspan.length ? ({ rowIndex, colIndex }) => {
|
|
5349
5733
|
const dataArray = getDataSourceState().dataArray;
|
|
@@ -5369,10 +5753,10 @@ function useColumnRowspan(computedVisibleColumns) {
|
|
|
5369
5753
|
}
|
|
5370
5754
|
|
|
5371
5755
|
// src/components/InfiniteTable/hooks/useColumnSizeFn.ts
|
|
5372
|
-
var
|
|
5756
|
+
var import_react32 = __toModule(require("react"));
|
|
5373
5757
|
var debug4 = dbg("useColumnSizeFn");
|
|
5374
5758
|
function useColumnSizeFn(columns) {
|
|
5375
|
-
const columnSize = (0,
|
|
5759
|
+
const columnSize = (0, import_react32.useCallback)((index) => {
|
|
5376
5760
|
const column = columns[index];
|
|
5377
5761
|
if (!column) {
|
|
5378
5762
|
debug4("cannot find column at index", index, columns);
|
|
@@ -5383,10 +5767,10 @@ function useColumnSizeFn(columns) {
|
|
|
5383
5767
|
}
|
|
5384
5768
|
|
|
5385
5769
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
5386
|
-
var
|
|
5770
|
+
var import_react38 = __toModule(require("react"));
|
|
5387
5771
|
|
|
5388
5772
|
// src/components/InfiniteTable/utils/getColumnForGroupBy.tsx
|
|
5389
|
-
var
|
|
5773
|
+
var React30 = __toModule(require("react"));
|
|
5390
5774
|
|
|
5391
5775
|
// src/utils/stripVar.ts
|
|
5392
5776
|
function stripVar(cssVariableWithVarString) {
|
|
@@ -5402,19 +5786,19 @@ var showLoadingIcon = (rowInfo) => {
|
|
|
5402
5786
|
};
|
|
5403
5787
|
|
|
5404
5788
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
5405
|
-
var
|
|
5406
|
-
var
|
|
5789
|
+
var React28 = __toModule(require("react"));
|
|
5790
|
+
var import_react33 = __toModule(require("react"));
|
|
5407
5791
|
|
|
5408
5792
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.css.ts
|
|
5409
5793
|
var import_createRuntimeFn5 = __toModule(require_vanilla_extract_recipes_createRuntimeFn_cjs());
|
|
5410
|
-
var ExpanderIconCls = "_16lm1iw6
|
|
5794
|
+
var ExpanderIconCls = "_16lm1iw6 _16lm1iwg _16lm1iwd";
|
|
5411
5795
|
var ExpanderIconClsVariants = (0, import_createRuntimeFn5.createRuntimeFn)({ defaultClassName: "", variantClassNames: { expanded: { true: "_16lm1iwc", false: "_198z9782" } }, defaultVariants: {}, compoundVariants: [] });
|
|
5412
5796
|
|
|
5413
5797
|
// src/components/InfiniteTable/components/icons/ExpanderIcon.tsx
|
|
5414
5798
|
function ExpanderIcon(props) {
|
|
5415
5799
|
var _a;
|
|
5416
5800
|
const { size = 24 } = props;
|
|
5417
|
-
const [expanded, setExpanded] = (0,
|
|
5801
|
+
const [expanded, setExpanded] = (0, import_react33.useState)((_a = props.expanded) != null ? _a : props.defaultExpanded);
|
|
5418
5802
|
const onClick = () => {
|
|
5419
5803
|
var _a2;
|
|
5420
5804
|
(_a2 = props.onChange) == null ? void 0 : _a2.call(props, !expanded);
|
|
@@ -5422,12 +5806,12 @@ function ExpanderIcon(props) {
|
|
|
5422
5806
|
setExpanded(!expanded);
|
|
5423
5807
|
}
|
|
5424
5808
|
};
|
|
5425
|
-
|
|
5809
|
+
React28.useEffect(() => {
|
|
5426
5810
|
if (isControlled("expanded", props)) {
|
|
5427
5811
|
setExpanded(props.expanded);
|
|
5428
5812
|
}
|
|
5429
5813
|
}, [props.expanded]);
|
|
5430
|
-
return /* @__PURE__ */
|
|
5814
|
+
return /* @__PURE__ */ React28.createElement("svg", {
|
|
5431
5815
|
"data-name": "expander-icon",
|
|
5432
5816
|
xmlns: "http://www.w3.org/2000/svg",
|
|
5433
5817
|
height: `${size}px`,
|
|
@@ -5438,20 +5822,20 @@ function ExpanderIcon(props) {
|
|
|
5438
5822
|
className: join(props.className, ExpanderIconCls, ExpanderIconClsVariants({
|
|
5439
5823
|
expanded
|
|
5440
5824
|
}), "InfiniteIcon", "InfiniteIcon-expander", `InfiniteIcon-expander--${expanded ? "expanded" : "collapsed"}`)
|
|
5441
|
-
}, /* @__PURE__ */
|
|
5825
|
+
}, /* @__PURE__ */ React28.createElement("path", {
|
|
5442
5826
|
d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"
|
|
5443
5827
|
}));
|
|
5444
5828
|
}
|
|
5445
5829
|
|
|
5446
5830
|
// src/components/InfiniteTable/components/icons/LoadingIcon.tsx
|
|
5447
|
-
var
|
|
5831
|
+
var React29 = __toModule(require("react"));
|
|
5448
5832
|
|
|
5449
5833
|
// src/components/InfiniteTable/components/icons/LoadingIcon.css.ts
|
|
5450
|
-
var LoadingIconCls = "_16lm1iw8
|
|
5834
|
+
var LoadingIconCls = "_16lm1iw8 _16lm1iwg _16lm1iwd";
|
|
5451
5835
|
|
|
5452
5836
|
// src/components/InfiniteTable/components/icons/LoadingIcon.tsx
|
|
5453
5837
|
var LoadingIcon = (props) => {
|
|
5454
|
-
return /* @__PURE__ */
|
|
5838
|
+
return /* @__PURE__ */ React29.createElement("svg", {
|
|
5455
5839
|
xmlns: "http://www.w3.org/2000/svg",
|
|
5456
5840
|
style: {
|
|
5457
5841
|
margin: "auto",
|
|
@@ -5463,14 +5847,14 @@ var LoadingIcon = (props) => {
|
|
|
5463
5847
|
viewBox: "0 0 100 100",
|
|
5464
5848
|
preserveAspectRatio: "xMidYMid",
|
|
5465
5849
|
className: join(props.className, LoadingIconCls, "InfiniteIcon", "InfiniteIcon-loading")
|
|
5466
|
-
}, /* @__PURE__ */
|
|
5850
|
+
}, /* @__PURE__ */ React29.createElement("circle", {
|
|
5467
5851
|
cx: "50",
|
|
5468
5852
|
cy: "50",
|
|
5469
5853
|
fill: "none",
|
|
5470
5854
|
strokeWidth: "10",
|
|
5471
5855
|
r: "35",
|
|
5472
5856
|
strokeDasharray: "164.93361431346415 56.97787143782138"
|
|
5473
|
-
}, /* @__PURE__ */
|
|
5857
|
+
}, /* @__PURE__ */ React29.createElement("animateTransform", {
|
|
5474
5858
|
attributeName: "transform",
|
|
5475
5859
|
type: "rotate",
|
|
5476
5860
|
repeatCount: "indefinite",
|
|
@@ -5490,7 +5874,7 @@ function getGroupColumnRender({
|
|
|
5490
5874
|
var _a, _b, _c;
|
|
5491
5875
|
let { value, rowInfo, column, groupBy, pivotBy } = renderOptions;
|
|
5492
5876
|
if (column.renderValue) {
|
|
5493
|
-
value = /* @__PURE__ */
|
|
5877
|
+
value = /* @__PURE__ */ React30.createElement(RenderHookComponent, {
|
|
5494
5878
|
render: column.renderValue,
|
|
5495
5879
|
renderParam: renderOptions
|
|
5496
5880
|
});
|
|
@@ -5520,22 +5904,22 @@ function getGroupColumnRender({
|
|
|
5520
5904
|
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);
|
|
5521
5905
|
const isLoading = showLoadingIcon(groupRowInfo);
|
|
5522
5906
|
if (isLoading) {
|
|
5523
|
-
icon = /* @__PURE__ */
|
|
5907
|
+
icon = /* @__PURE__ */ React30.createElement(LoadingIcon, null);
|
|
5524
5908
|
} else if (showExpanderIcon) {
|
|
5525
|
-
const defaultIcon = /* @__PURE__ */
|
|
5909
|
+
const defaultIcon = /* @__PURE__ */ React30.createElement(ExpanderIcon, {
|
|
5526
5910
|
expanded: !collapsed,
|
|
5527
5911
|
onChange: () => {
|
|
5528
5912
|
toggleGroupRow(groupKeys);
|
|
5529
5913
|
}
|
|
5530
5914
|
});
|
|
5531
|
-
icon = column.renderGroupIcon ? /* @__PURE__ */
|
|
5915
|
+
icon = column.renderGroupIcon ? /* @__PURE__ */ React30.createElement(RenderHookComponent, {
|
|
5532
5916
|
render: column.renderGroupIcon,
|
|
5533
5917
|
renderParam: Object.assign({ collapsed, groupIcon: defaultIcon }, renderOptions)
|
|
5534
5918
|
}) : defaultIcon;
|
|
5535
5919
|
}
|
|
5536
|
-
return /* @__PURE__ */
|
|
5920
|
+
return /* @__PURE__ */ React30.createElement("div", {
|
|
5537
5921
|
className: join(display.flex, alignItems.center)
|
|
5538
|
-
}, icon, /* @__PURE__ */
|
|
5922
|
+
}, icon, /* @__PURE__ */ React30.createElement("div", {
|
|
5539
5923
|
className: cssEllipsisClassName
|
|
5540
5924
|
}, value != null ? value : null));
|
|
5541
5925
|
};
|
|
@@ -5580,9 +5964,9 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
5580
5964
|
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;
|
|
5581
5965
|
const isLoading = showLoadingIcon(rowInfo);
|
|
5582
5966
|
if (isLoading) {
|
|
5583
|
-
icon = /* @__PURE__ */
|
|
5967
|
+
icon = /* @__PURE__ */ React30.createElement(LoadingIcon, null);
|
|
5584
5968
|
} else if (showExpanderIcon) {
|
|
5585
|
-
const defaultIcon = /* @__PURE__ */
|
|
5969
|
+
const defaultIcon = /* @__PURE__ */ React30.createElement(ExpanderIcon, {
|
|
5586
5970
|
expanded: !collapsed,
|
|
5587
5971
|
onChange: () => {
|
|
5588
5972
|
if (!rowInfo.isGroupRow) {
|
|
@@ -5597,9 +5981,9 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
5597
5981
|
icon = column.renderGroupIcon(renderParam);
|
|
5598
5982
|
}
|
|
5599
5983
|
}
|
|
5600
|
-
return /* @__PURE__ */
|
|
5984
|
+
return /* @__PURE__ */ React30.createElement("div", {
|
|
5601
5985
|
className: join(display.flex, alignItems.center, GroupRowExpanderCls)
|
|
5602
|
-
}, icon, /* @__PURE__ */
|
|
5986
|
+
}, icon, /* @__PURE__ */ React30.createElement("div", {
|
|
5603
5987
|
className: cssEllipsisClassName
|
|
5604
5988
|
}, value != null ? value : null));
|
|
5605
5989
|
}
|
|
@@ -5615,11 +5999,11 @@ function getSingleGroupColumn(options, toggleGroupRow, groupColumnFromProps) {
|
|
|
5615
5999
|
}
|
|
5616
6000
|
|
|
5617
6001
|
// src/components/InfiniteTable/hooks/useEffectWithRaf.ts
|
|
5618
|
-
var
|
|
6002
|
+
var import_react34 = __toModule(require("react"));
|
|
5619
6003
|
function useEffectWithRaf(fn, deps) {
|
|
5620
|
-
const rafId = (0,
|
|
5621
|
-
const removeFnRaf = (0,
|
|
5622
|
-
(0,
|
|
6004
|
+
const rafId = (0, import_react34.useRef)(0);
|
|
6005
|
+
const removeFnRaf = (0, import_react34.useRef)();
|
|
6006
|
+
(0, import_react34.useEffect)(() => {
|
|
5623
6007
|
rafId.current = requestAnimationFrame(() => {
|
|
5624
6008
|
removeFnRaf.current = fn();
|
|
5625
6009
|
});
|
|
@@ -5636,7 +6020,7 @@ function useEffectWithRaf(fn, deps) {
|
|
|
5636
6020
|
}
|
|
5637
6021
|
|
|
5638
6022
|
// src/components/InfiniteTable/hooks/useToggleGroupRow.ts
|
|
5639
|
-
var
|
|
6023
|
+
var import_react37 = __toModule(require("react"));
|
|
5640
6024
|
|
|
5641
6025
|
// src/utils/groupAndPivot/index.ts
|
|
5642
6026
|
var LAZY_ROOT_KEY_FOR_GROUPS = "____root____";
|
|
@@ -6089,7 +6473,7 @@ function enhancedFlatten(param) {
|
|
|
6089
6473
|
}
|
|
6090
6474
|
|
|
6091
6475
|
// src/components/DataSource/index.tsx
|
|
6092
|
-
var
|
|
6476
|
+
var React31 = __toModule(require("react"));
|
|
6093
6477
|
|
|
6094
6478
|
// src/utils/multisort/sortTypes.ts
|
|
6095
6479
|
var numberComparator = function(first, second) {
|
|
@@ -6277,15 +6661,15 @@ var GroupRowsState = class {
|
|
|
6277
6661
|
};
|
|
6278
6662
|
|
|
6279
6663
|
// src/components/DataSource/privateHooks/useLoadData.ts
|
|
6280
|
-
var
|
|
6664
|
+
var import_react36 = __toModule(require("react"));
|
|
6281
6665
|
|
|
6282
6666
|
// src/components/hooks/useEffectWithChanges.ts
|
|
6283
|
-
var
|
|
6667
|
+
var import_react35 = __toModule(require("react"));
|
|
6284
6668
|
function useEffectWithChanges(fn, deps) {
|
|
6285
|
-
const prevRef = (0,
|
|
6286
|
-
const oldValuesRef = (0,
|
|
6669
|
+
const prevRef = (0, import_react35.useRef)({});
|
|
6670
|
+
const oldValuesRef = (0, import_react35.useRef)({});
|
|
6287
6671
|
const oldValues = oldValuesRef.current;
|
|
6288
|
-
const changesRef = (0,
|
|
6672
|
+
const changesRef = (0, import_react35.useRef)({});
|
|
6289
6673
|
const changes = changesRef.current;
|
|
6290
6674
|
const useEffectDeps = [];
|
|
6291
6675
|
for (const k in deps) {
|
|
@@ -6298,7 +6682,7 @@ function useEffectWithChanges(fn, deps) {
|
|
|
6298
6682
|
}
|
|
6299
6683
|
}
|
|
6300
6684
|
prevRef.current = deps;
|
|
6301
|
-
(0,
|
|
6685
|
+
(0, import_react35.useEffect)(() => {
|
|
6302
6686
|
const changes2 = changesRef.current;
|
|
6303
6687
|
const result = fn(changes2, oldValues);
|
|
6304
6688
|
changesRef.current = {};
|
|
@@ -6566,12 +6950,12 @@ function useLoadData() {
|
|
|
6566
6950
|
livePaginationCursor,
|
|
6567
6951
|
cursorId: stateCursorId
|
|
6568
6952
|
} = componentState;
|
|
6569
|
-
const [scrollbars, setScrollbars] = (0,
|
|
6953
|
+
const [scrollbars, setScrollbars] = (0, import_react36.useState)({
|
|
6570
6954
|
vertical: false,
|
|
6571
6955
|
horizontal: false
|
|
6572
6956
|
});
|
|
6573
|
-
const scrollbarsRef = (0,
|
|
6574
|
-
(0,
|
|
6957
|
+
const scrollbarsRef = (0, import_react36.useRef)(scrollbars);
|
|
6958
|
+
(0, import_react36.useEffect)(() => {
|
|
6575
6959
|
notifyScrollbarsChange.onChange((scrollbars2) => {
|
|
6576
6960
|
if (!scrollbars2) {
|
|
6577
6961
|
return;
|
|
@@ -6581,7 +6965,7 @@ function useLoadData() {
|
|
|
6581
6965
|
});
|
|
6582
6966
|
return () => notifyScrollbarsChange.destroy();
|
|
6583
6967
|
}, [notifyScrollbarsChange]);
|
|
6584
|
-
(0,
|
|
6968
|
+
(0, import_react36.useEffect)(() => {
|
|
6585
6969
|
if (!livePagination) {
|
|
6586
6970
|
return;
|
|
6587
6971
|
}
|
|
@@ -6595,7 +6979,7 @@ function useLoadData() {
|
|
|
6595
6979
|
});
|
|
6596
6980
|
return () => cancelAnimationFrame(frameId);
|
|
6597
6981
|
}, [livePaginationCursor]);
|
|
6598
|
-
(0,
|
|
6982
|
+
(0, import_react36.useEffect)(() => {
|
|
6599
6983
|
if (!livePagination || livePaginationCursor !== void 0) {
|
|
6600
6984
|
return;
|
|
6601
6985
|
}
|
|
@@ -6609,7 +6993,7 @@ function useLoadData() {
|
|
|
6609
6993
|
});
|
|
6610
6994
|
return () => cancelAnimationFrame(frameId);
|
|
6611
6995
|
}, [dataArray.length, livePaginationCursor]);
|
|
6612
|
-
(0,
|
|
6996
|
+
(0, import_react36.useEffect)(() => {
|
|
6613
6997
|
const state = getComponentState();
|
|
6614
6998
|
const { livePaginationCursor: livePaginationCursor2, livePagination: livePagination2, dataArray: dataArray2 } = state;
|
|
6615
6999
|
if (!scrollbars.vertical && livePagination2) {
|
|
@@ -6627,7 +7011,7 @@ function useLoadData() {
|
|
|
6627
7011
|
filterValue,
|
|
6628
7012
|
cursorId: livePagination ? stateCursorId : null
|
|
6629
7013
|
};
|
|
6630
|
-
const initialRef = (0,
|
|
7014
|
+
const initialRef = (0, import_react36.useRef)(true);
|
|
6631
7015
|
useLazyLoadRange();
|
|
6632
7016
|
useEffectWithChanges(() => {
|
|
6633
7017
|
const componentState2 = getComponentState();
|
|
@@ -6659,7 +7043,7 @@ function useLazyLoadRange() {
|
|
|
6659
7043
|
componentActions: actions,
|
|
6660
7044
|
componentState
|
|
6661
7045
|
} = useComponentState();
|
|
6662
|
-
(0,
|
|
7046
|
+
(0, import_react36.useEffect)(() => {
|
|
6663
7047
|
actions.lazyLoadCacheOfLoadedBatches = new DeepMap();
|
|
6664
7048
|
}, [componentState.data, componentState.dataParams]);
|
|
6665
7049
|
const {
|
|
@@ -6668,7 +7052,7 @@ function useLazyLoadRange() {
|
|
|
6668
7052
|
dataArray,
|
|
6669
7053
|
scrollStopDelayUpdatedByTable
|
|
6670
7054
|
} = componentState;
|
|
6671
|
-
const latestRenderRangeRef = (0,
|
|
7055
|
+
const latestRenderRangeRef = (0, import_react36.useRef)(null);
|
|
6672
7056
|
const loadRange = (renderRange, cache = getComponentState().lazyLoadCacheOfLoadedBatches) => {
|
|
6673
7057
|
const componentState2 = getComponentState();
|
|
6674
7058
|
renderRange = renderRange || latestRenderRangeRef.current;
|
|
@@ -6687,8 +7071,8 @@ function useLazyLoadRange() {
|
|
|
6687
7071
|
componentActions: actions
|
|
6688
7072
|
}, cache);
|
|
6689
7073
|
};
|
|
6690
|
-
const debouncedLoadRange = (0,
|
|
6691
|
-
(0,
|
|
7074
|
+
const debouncedLoadRange = (0, import_react36.useMemo)(() => debounce(loadRange, { wait: scrollStopDelayUpdatedByTable }), [scrollStopDelayUpdatedByTable]);
|
|
7075
|
+
(0, import_react36.useEffect)(() => {
|
|
6692
7076
|
if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
|
|
6693
7077
|
return notifyRenderRangeChange.onChange((renderRange) => {
|
|
6694
7078
|
latestRenderRangeRef.current = renderRange;
|
|
@@ -6697,7 +7081,7 @@ function useLazyLoadRange() {
|
|
|
6697
7081
|
}
|
|
6698
7082
|
return;
|
|
6699
7083
|
}, [lazyLoadBatchSize]);
|
|
6700
|
-
(0,
|
|
7084
|
+
(0, import_react36.useEffect)(() => {
|
|
6701
7085
|
if (lazyLoadBatchSize && lazyLoadBatchSize > 0) {
|
|
6702
7086
|
debouncedLoadRange();
|
|
6703
7087
|
}
|
|
@@ -6933,6 +7317,7 @@ var forwardProps2 = (setupState) => {
|
|
|
6933
7317
|
sortTypes: (sortTypes) => {
|
|
6934
7318
|
return __spreadValues(__spreadValues({}, sortTypes_default), sortTypes);
|
|
6935
7319
|
},
|
|
7320
|
+
sortMode: (sortMode) => sortMode != null ? sortMode : "local",
|
|
6936
7321
|
aggregationReducers: 1,
|
|
6937
7322
|
collapseGroupRowsOnDataFunctionChange: (collapseGroupRowsOnDataFunctionChange) => collapseGroupRowsOnDataFunctionChange != null ? collapseGroupRowsOnDataFunctionChange : true,
|
|
6938
7323
|
loading: (loading) => loading != null ? loading : false,
|
|
@@ -6976,7 +7361,7 @@ function mapPropsToState(params) {
|
|
|
6976
7361
|
operatorsByFilterType,
|
|
6977
7362
|
controlledSort,
|
|
6978
7363
|
controlledFilter,
|
|
6979
|
-
filterMode: ((_a = props.filterMode) != null ? _a : props.filterFunction != null) ? "
|
|
7364
|
+
filterMode: ((_a = props.filterMode) != null ? _a : props.filterFunction != null) ? "local" : typeof props.data === "function" ? "remote" : "local",
|
|
6980
7365
|
multiSort: Array.isArray(controlledSort ? props.sortInfo : props.defaultSortInfo),
|
|
6981
7366
|
lazyLoadBatchSize: typeof props.lazyLoad === "object" ? props.lazyLoad.batchSize : void 0
|
|
6982
7367
|
};
|
|
@@ -7367,7 +7752,7 @@ function concludeReducer(params) {
|
|
|
7367
7752
|
}
|
|
7368
7753
|
const { filterFunction, filterValue, filterTypes, operatorsByFilterType } = state;
|
|
7369
7754
|
const shouldFilter = !!filterFunction || Array.isArray(filterValue) && filterValue.length;
|
|
7370
|
-
const shouldFilterClientSide = shouldFilter && state.filterMode === "
|
|
7755
|
+
const shouldFilterClientSide = shouldFilter && state.filterMode === "local";
|
|
7371
7756
|
const filterDepsChanged = haveDepsChanged(previousState, state, [
|
|
7372
7757
|
"filterFunction",
|
|
7373
7758
|
"filterValue",
|
|
@@ -7376,7 +7761,7 @@ function concludeReducer(params) {
|
|
|
7376
7761
|
const filterChanged = originalDataArrayChanged || filterDepsChanged;
|
|
7377
7762
|
const sortInfoChanged = haveDepsChanged(previousState, state, ["sortInfo"]);
|
|
7378
7763
|
const sortDepsChanged = originalDataArrayChanged || filterDepsChanged || sortInfoChanged;
|
|
7379
|
-
const shouldFilterAgain = state.filterMode === "
|
|
7764
|
+
const shouldFilterAgain = state.filterMode === "local" && (filterChanged || !state.lastFilterDataArray);
|
|
7380
7765
|
const shouldSortAgain = shouldSort && (sortDepsChanged || !state.lastSortDataArray);
|
|
7381
7766
|
const groupBy = state.groupBy;
|
|
7382
7767
|
const pivotBy = state.pivotBy;
|
|
@@ -7418,7 +7803,8 @@ function concludeReducer(params) {
|
|
|
7418
7803
|
}
|
|
7419
7804
|
state.filteredCount = dataArray.length;
|
|
7420
7805
|
state.postFilterDataArray = dataArray;
|
|
7421
|
-
|
|
7806
|
+
const shouldSortClientSide = shouldSort && state.sortMode === "local";
|
|
7807
|
+
if (shouldSortClientSide) {
|
|
7422
7808
|
const prevKnownTypes = multisort.knownTypes;
|
|
7423
7809
|
multisort.knownTypes = state.sortTypes;
|
|
7424
7810
|
dataArray = shouldSortAgain ? multisort(sortInfo, [...dataArray]) : state.lastSortDataArray;
|
|
@@ -7498,7 +7884,7 @@ function DataSourceWithContext(props) {
|
|
|
7498
7884
|
if (typeof children === "function") {
|
|
7499
7885
|
children = children(computedValues);
|
|
7500
7886
|
}
|
|
7501
|
-
return /* @__PURE__ */
|
|
7887
|
+
return /* @__PURE__ */ React31.createElement(React31.Fragment, null, children);
|
|
7502
7888
|
}
|
|
7503
7889
|
var DataSourceRoot = getComponentStateRoot({
|
|
7504
7890
|
initSetupState,
|
|
@@ -7521,14 +7907,14 @@ function DataSourceCmp({ children }) {
|
|
|
7521
7907
|
globalThis.getDataSourceState = getState;
|
|
7522
7908
|
}
|
|
7523
7909
|
useLoadData();
|
|
7524
|
-
return /* @__PURE__ */
|
|
7910
|
+
return /* @__PURE__ */ React31.createElement(DataSourceContext.Provider, {
|
|
7525
7911
|
value: contextValue
|
|
7526
|
-
}, /* @__PURE__ */
|
|
7912
|
+
}, /* @__PURE__ */ React31.createElement(DataSourceWithContext, {
|
|
7527
7913
|
children
|
|
7528
7914
|
}));
|
|
7529
7915
|
}
|
|
7530
7916
|
function DataSource(props) {
|
|
7531
|
-
return /* @__PURE__ */
|
|
7917
|
+
return /* @__PURE__ */ React31.createElement(DataSourceRoot, __spreadValues({}, props), /* @__PURE__ */ React31.createElement(DataSourceCmp, {
|
|
7532
7918
|
children: props.children
|
|
7533
7919
|
}));
|
|
7534
7920
|
}
|
|
@@ -7536,7 +7922,7 @@ function DataSource(props) {
|
|
|
7536
7922
|
// src/components/InfiniteTable/hooks/useToggleGroupRow.ts
|
|
7537
7923
|
function useToggleGroupRow() {
|
|
7538
7924
|
const { getState: getDataSourceState, componentActions: dataSourceActions } = useDataSourceContextValue();
|
|
7539
|
-
const toggleGroupRow = (0,
|
|
7925
|
+
const toggleGroupRow = (0, import_react37.useCallback)((groupKeys) => {
|
|
7540
7926
|
const state = getDataSourceState();
|
|
7541
7927
|
const newState = new GroupRowsState(state.groupRowsState);
|
|
7542
7928
|
newState.toggleGroupRow(groupKeys);
|
|
@@ -7568,7 +7954,7 @@ function useToggleGroupRow() {
|
|
|
7568
7954
|
|
|
7569
7955
|
// src/components/InfiniteTable/hooks/useColumnsWhen.ts
|
|
7570
7956
|
function useGroupByMap(groupBy) {
|
|
7571
|
-
const groupByMap = (0,
|
|
7957
|
+
const groupByMap = (0, import_react38.useMemo)(() => {
|
|
7572
7958
|
return groupBy.reduce((acc, groupBy2, index) => {
|
|
7573
7959
|
acc.set(groupBy2.field, {
|
|
7574
7960
|
groupBy: groupBy2,
|
|
@@ -7592,13 +7978,13 @@ function useColumnsWhen() {
|
|
|
7592
7978
|
}
|
|
7593
7979
|
} = useComponentState();
|
|
7594
7980
|
const groupByMap = useGroupByMap(groupBy);
|
|
7595
|
-
(0,
|
|
7981
|
+
(0, import_react38.useEffect)(() => {
|
|
7596
7982
|
dataSourceActions.generateGroupRows = groupRenderStrategy !== "inline";
|
|
7597
7983
|
}, [groupRenderStrategy]);
|
|
7598
|
-
(0,
|
|
7984
|
+
(0, import_react38.useEffect)(() => {
|
|
7599
7985
|
dataSourceActions.pivotTotalColumnPosition = pivotTotalColumnPosition;
|
|
7600
7986
|
}, [pivotTotalColumnPosition]);
|
|
7601
|
-
(0,
|
|
7987
|
+
(0, import_react38.useEffect)(() => {
|
|
7602
7988
|
if (pivotGrandTotalColumnPosition != void 0) {
|
|
7603
7989
|
dataSourceActions.pivotGrandTotalColumnPosition = pivotGrandTotalColumnPosition;
|
|
7604
7990
|
}
|
|
@@ -7672,7 +8058,7 @@ function useColumnsWhenInlineGroupRenderStrategy(groupByMap) {
|
|
|
7672
8058
|
});
|
|
7673
8059
|
return computedColumns.size === 0 ? void 0 : computedColumns;
|
|
7674
8060
|
}
|
|
7675
|
-
(0,
|
|
8061
|
+
(0, import_react38.useEffect)(() => {
|
|
7676
8062
|
const update = () => {
|
|
7677
8063
|
componentActions.columnsWhenInlineGroupRenderStrategy = computeColumnsWhenInlineGroupRenderStrategy(columns, groupByMap, groupRenderStrategy, toggleGroupRow);
|
|
7678
8064
|
};
|
|
@@ -7701,7 +8087,7 @@ function useColumnsWhenGrouping() {
|
|
|
7701
8087
|
}
|
|
7702
8088
|
} = useComponentState();
|
|
7703
8089
|
const toggleGroupRow = useToggleGroupRow();
|
|
7704
|
-
(0,
|
|
8090
|
+
(0, import_react38.useEffect)(() => {
|
|
7705
8091
|
const update = () => {
|
|
7706
8092
|
const columnsWhenGrouping = getColumnsWhenGrouping({
|
|
7707
8093
|
columns,
|
|
@@ -7837,7 +8223,7 @@ function useHideColumns(groupByMap) {
|
|
|
7837
8223
|
hideEmptyGroupColumns ? groupRowsState : null,
|
|
7838
8224
|
hideEmptyGroupColumns
|
|
7839
8225
|
]);
|
|
7840
|
-
(0,
|
|
8226
|
+
(0, import_react38.useEffect)(() => {
|
|
7841
8227
|
const isGrouped = groupBy.length > 0;
|
|
7842
8228
|
const currentState = getComponentState();
|
|
7843
8229
|
const { controlledColumnVisibility, columnVisibility } = currentState;
|
|
@@ -7952,7 +8338,7 @@ function getColumnsWhenGrouping(params) {
|
|
|
7952
8338
|
}
|
|
7953
8339
|
|
|
7954
8340
|
// src/components/InfiniteTable/hooks/useComputedVisibleColumns.ts
|
|
7955
|
-
var
|
|
8341
|
+
var import_react40 = __toModule(require("react"));
|
|
7956
8342
|
|
|
7957
8343
|
// src/components/flexbox/index.ts
|
|
7958
8344
|
var computeFlex = (params) => {
|
|
@@ -8265,7 +8651,7 @@ var getComputedVisibleColumns = ({
|
|
|
8265
8651
|
});
|
|
8266
8652
|
const firstPinnedEndAbsoluteOffset = bodySize.width - totalPinnedEndWidth;
|
|
8267
8653
|
columnsArray.forEach((c, i) => {
|
|
8268
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
|
|
8654
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
|
|
8269
8655
|
const id = visibleColumnOrder[i];
|
|
8270
8656
|
const nextColumnId = visibleColumnOrder[i + 1];
|
|
8271
8657
|
const colType = getColumnComputedType(c, columnTypes);
|
|
@@ -8290,16 +8676,26 @@ var getComputedVisibleColumns = ({
|
|
|
8290
8676
|
const computedDataType = c.dataType || colType.dataType || (Array.isArray(c.type) ? c.type[0] : c.type) || "string";
|
|
8291
8677
|
const computedSortType = c.sortType || colType.sortType || computedDataType;
|
|
8292
8678
|
const computedFilterType = c.filterType || colType.filterType || computedDataType;
|
|
8679
|
+
const field = (_m = c.field) != null ? _m : colType.field;
|
|
8680
|
+
const valueGetter = (_n = c.valueGetter) != null ? _n : colType.valueGetter;
|
|
8681
|
+
let sortableColumnOrType = (_o = c.sortable) != null ? _o : colType.sortable;
|
|
8682
|
+
if (sortableColumnOrType == null) {
|
|
8683
|
+
if (field == null && valueGetter == null) {
|
|
8684
|
+
sortableColumnOrType = false;
|
|
8685
|
+
}
|
|
8686
|
+
}
|
|
8687
|
+
let computedSortable = (_p = sortableColumnOrType != null ? sortableColumnOrType : sortable) != null ? _p : true;
|
|
8293
8688
|
const result2 = __spreadProps(__spreadValues({
|
|
8294
8689
|
align: colType.align,
|
|
8295
8690
|
verticalAlign: colType.verticalAlign,
|
|
8296
8691
|
defaultHiddenWhenGroupedBy: colType.defaultHiddenWhenGroupedBy,
|
|
8297
|
-
valueGetter
|
|
8692
|
+
valueGetter,
|
|
8298
8693
|
valueFormatter: colType.valueFormatter,
|
|
8299
8694
|
renderValue: colType.renderValue,
|
|
8300
8695
|
render: colType.render,
|
|
8301
8696
|
style: colType.style,
|
|
8302
|
-
components: colType.components
|
|
8697
|
+
components: colType.components,
|
|
8698
|
+
field
|
|
8303
8699
|
}, c), {
|
|
8304
8700
|
computedDataType,
|
|
8305
8701
|
computedSortType,
|
|
@@ -8313,7 +8709,7 @@ var getComputedVisibleColumns = ({
|
|
|
8313
8709
|
computedAbsoluteOffset,
|
|
8314
8710
|
computedPinningOffset,
|
|
8315
8711
|
computedOffset,
|
|
8316
|
-
computedSortable
|
|
8712
|
+
computedSortable,
|
|
8317
8713
|
computedSortInfo,
|
|
8318
8714
|
computedSortIndex,
|
|
8319
8715
|
computedMultiSort: multiSort,
|
|
@@ -8322,7 +8718,7 @@ var getComputedVisibleColumns = ({
|
|
|
8322
8718
|
computedSortedDesc,
|
|
8323
8719
|
computedVisibleIndex: i,
|
|
8324
8720
|
computedPinned,
|
|
8325
|
-
computedDraggable: (
|
|
8721
|
+
computedDraggable: (_r = (_q = c.draggable) != null ? _q : draggableColumns) != null ? _r : true,
|
|
8326
8722
|
computedFirstInCategory,
|
|
8327
8723
|
computedLastInCategory,
|
|
8328
8724
|
computedFirst: i === 0,
|
|
@@ -8372,7 +8768,7 @@ var getComputedVisibleColumns = ({
|
|
|
8372
8768
|
setSortInfo(finalSortInfo);
|
|
8373
8769
|
},
|
|
8374
8770
|
id,
|
|
8375
|
-
header: (
|
|
8771
|
+
header: (_u = (_t = (_s = c.header) != null ? _s : colType.header) != null ? _t : c.name) != null ? _u : c.field
|
|
8376
8772
|
});
|
|
8377
8773
|
computedOffset += computedWidth;
|
|
8378
8774
|
computedVisibleColumnsMap.set(result2.id, result2);
|
|
@@ -8413,10 +8809,10 @@ var getComputedVisibleColumns = ({
|
|
|
8413
8809
|
};
|
|
8414
8810
|
|
|
8415
8811
|
// src/components/InfiniteTable/hooks/useRerenderOnKeyChange.ts
|
|
8416
|
-
var
|
|
8812
|
+
var import_react39 = __toModule(require("react"));
|
|
8417
8813
|
var useRerenderOnKeyChange = (map2) => {
|
|
8418
8814
|
const [renderId, rerender] = useRerender();
|
|
8419
|
-
(0,
|
|
8815
|
+
(0, import_react39.useEffect)(() => {
|
|
8420
8816
|
const update = rafFn(rerender);
|
|
8421
8817
|
return interceptMap(map2, {
|
|
8422
8818
|
set: update,
|
|
@@ -8469,7 +8865,7 @@ var useComputedVisibleColumns = ({
|
|
|
8469
8865
|
computedPinnedEndOffset,
|
|
8470
8866
|
computedPinnedEndWidth,
|
|
8471
8867
|
computedPinnedStartWidth
|
|
8472
|
-
} = (0,
|
|
8868
|
+
} = (0, import_react40.useMemo)(() => {
|
|
8473
8869
|
return getComputedVisibleColumns({
|
|
8474
8870
|
columns,
|
|
8475
8871
|
bodySize,
|
|
@@ -8537,7 +8933,7 @@ var useComputedVisibleColumns = ({
|
|
|
8537
8933
|
};
|
|
8538
8934
|
|
|
8539
8935
|
// src/components/InfiniteTable/hooks/useScrollbars.ts
|
|
8540
|
-
var
|
|
8936
|
+
var import_react41 = __toModule(require("react"));
|
|
8541
8937
|
var INITIAL_SCROLLBARS = {
|
|
8542
8938
|
vertical: false,
|
|
8543
8939
|
horizontal: false
|
|
@@ -8545,8 +8941,8 @@ var INITIAL_SCROLLBARS = {
|
|
|
8545
8941
|
function useScrollbars(brain) {
|
|
8546
8942
|
const { getComponentState: getInfiniteTableState } = useComponentState();
|
|
8547
8943
|
const { getState: getDataSourceState } = useDataSourceContextValue();
|
|
8548
|
-
const [scrollbars, setScrollbars] = (0,
|
|
8549
|
-
(0,
|
|
8944
|
+
const [scrollbars, setScrollbars] = (0, import_react41.useState)(INITIAL_SCROLLBARS);
|
|
8945
|
+
(0, import_react41.useEffect)(() => {
|
|
8550
8946
|
return brain.onRenderCountChange(() => {
|
|
8551
8947
|
const { scrollTopMax, scrollLeftMax } = brain;
|
|
8552
8948
|
setScrollbars({
|
|
@@ -8555,7 +8951,7 @@ function useScrollbars(brain) {
|
|
|
8555
8951
|
});
|
|
8556
8952
|
});
|
|
8557
8953
|
}, [brain]);
|
|
8558
|
-
(0,
|
|
8954
|
+
(0, import_react41.useLayoutEffect)(() => {
|
|
8559
8955
|
const dataSourceState = getDataSourceState();
|
|
8560
8956
|
const { onScrollbarsChange } = getInfiniteTableState();
|
|
8561
8957
|
const { notifyScrollbarsChange } = dataSourceState;
|
|
@@ -8586,7 +8982,7 @@ function useComputed() {
|
|
|
8586
8982
|
bodySize,
|
|
8587
8983
|
showSeparatePivotColumnForSingleAggregation
|
|
8588
8984
|
} = componentState;
|
|
8589
|
-
(0,
|
|
8985
|
+
(0, import_react42.useState)(() => {
|
|
8590
8986
|
componentState.onRowHeightCSSVarChange.onChange((rowHeight) => {
|
|
8591
8987
|
if (rowHeight) {
|
|
8592
8988
|
componentActions.rowHeight = rowHeight;
|
|
@@ -8598,13 +8994,13 @@ function useComputed() {
|
|
|
8598
8994
|
}
|
|
8599
8995
|
});
|
|
8600
8996
|
});
|
|
8601
|
-
(0,
|
|
8997
|
+
(0, import_react42.useEffect)(() => {
|
|
8602
8998
|
dataSourceActions.showSeparatePivotColumnForSingleAggregation = showSeparatePivotColumnForSingleAggregation;
|
|
8603
8999
|
}, [showSeparatePivotColumnForSingleAggregation]);
|
|
8604
9000
|
const { multiSort, filterValue } = dataSourceState;
|
|
8605
9001
|
useColumnGroups();
|
|
8606
9002
|
const { toggleGroupRow } = useColumnsWhen();
|
|
8607
|
-
const setSortInfo = (0,
|
|
9003
|
+
const setSortInfo = (0, import_react42.useCallback)((sortInfo) => {
|
|
8608
9004
|
var _a2;
|
|
8609
9005
|
const newSortInfo = getDataSourceState().multiSort ? sortInfo : (_a2 = sortInfo[0]) != null ? _a2 : null;
|
|
8610
9006
|
dataSourceActions.sortInfo = newSortInfo;
|
|
@@ -8763,7 +9159,7 @@ function useDOMProps(initialDOMProps) {
|
|
|
8763
9159
|
}
|
|
8764
9160
|
|
|
8765
9161
|
// src/components/InfiniteTable/hooks/useLicense/useLicense.ts
|
|
8766
|
-
var
|
|
9162
|
+
var import_react43 = __toModule(require("react"));
|
|
8767
9163
|
|
|
8768
9164
|
// src/components/InfiniteTable/hooks/useLicense/crc32.ts
|
|
8769
9165
|
var DEFAULT_ReversedPolynomial = 3988292384;
|
|
@@ -8921,10 +9317,10 @@ var isInsideSandbox = () => {
|
|
|
8921
9317
|
};
|
|
8922
9318
|
var isInsidePlayground = isInsideSandbox() || isInsideSandpack();
|
|
8923
9319
|
var useLicense = (licenseKey = "") => {
|
|
8924
|
-
const valid = (0,
|
|
9320
|
+
const valid = (0, import_react43.useMemo)(() => {
|
|
8925
9321
|
let valid2 = isValidLicense(licenseKey, {
|
|
8926
9322
|
publishedAt: 1624970570587,
|
|
8927
|
-
version: "0.3.
|
|
9323
|
+
version: "0.3.6"
|
|
8928
9324
|
});
|
|
8929
9325
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
8930
9326
|
return true;
|
|
@@ -8934,8 +9330,142 @@ var useLicense = (licenseKey = "") => {
|
|
|
8934
9330
|
return valid;
|
|
8935
9331
|
};
|
|
8936
9332
|
|
|
9333
|
+
// src/components/utils/clamp.ts
|
|
9334
|
+
function clamp(value, min, max) {
|
|
9335
|
+
return Math.min(Math.max(value, min), max);
|
|
9336
|
+
}
|
|
9337
|
+
|
|
9338
|
+
// src/components/InfiniteTable/keyboardNavigationAndSelection.ts
|
|
9339
|
+
function handleRowNavigation(options) {
|
|
9340
|
+
const { key, getState, getDataSourceState, actions } = options;
|
|
9341
|
+
const arrLength = getDataSourceState().dataArray.length;
|
|
9342
|
+
const state = getState();
|
|
9343
|
+
const { brain } = state;
|
|
9344
|
+
let { activeRowIndex } = state;
|
|
9345
|
+
if (activeRowIndex == null) {
|
|
9346
|
+
return false;
|
|
9347
|
+
}
|
|
9348
|
+
const {
|
|
9349
|
+
start: [startRow],
|
|
9350
|
+
end: [endRow]
|
|
9351
|
+
} = brain.getRenderRange();
|
|
9352
|
+
const renderRowCount = endRow - startRow - 1;
|
|
9353
|
+
const min = 0;
|
|
9354
|
+
const max = arrLength - 1;
|
|
9355
|
+
const KeyToFunction = {
|
|
9356
|
+
ArrowDown: () => {
|
|
9357
|
+
activeRowIndex = clamp(activeRowIndex + 1, min, max);
|
|
9358
|
+
},
|
|
9359
|
+
ArrowUp: () => {
|
|
9360
|
+
activeRowIndex = clamp(activeRowIndex - 1, min, max);
|
|
9361
|
+
},
|
|
9362
|
+
PageDown: () => {
|
|
9363
|
+
activeRowIndex = Math.min(activeRowIndex + renderRowCount, arrLength - 1);
|
|
9364
|
+
},
|
|
9365
|
+
PageUp: () => {
|
|
9366
|
+
activeRowIndex = Math.max(activeRowIndex - renderRowCount, min);
|
|
9367
|
+
},
|
|
9368
|
+
End: () => {
|
|
9369
|
+
activeRowIndex = max;
|
|
9370
|
+
},
|
|
9371
|
+
Home: () => {
|
|
9372
|
+
activeRowIndex = min;
|
|
9373
|
+
}
|
|
9374
|
+
};
|
|
9375
|
+
const Fn = KeyToFunction[key];
|
|
9376
|
+
if (!Fn) {
|
|
9377
|
+
return false;
|
|
9378
|
+
}
|
|
9379
|
+
Fn();
|
|
9380
|
+
actions.activeRowIndex = activeRowIndex;
|
|
9381
|
+
return true;
|
|
9382
|
+
}
|
|
9383
|
+
function handleCellNavigation(options) {
|
|
9384
|
+
const { key, shiftKey, getState, getComputed, getDataSourceState, actions } = options;
|
|
9385
|
+
const state = getState();
|
|
9386
|
+
const { activeCellIndex, brain } = state;
|
|
9387
|
+
if (!activeCellIndex) {
|
|
9388
|
+
return false;
|
|
9389
|
+
}
|
|
9390
|
+
let [rowIndex, colIndex] = activeCellIndex;
|
|
9391
|
+
const {
|
|
9392
|
+
start: [startRow, startCol],
|
|
9393
|
+
end: [endRow, endCol]
|
|
9394
|
+
} = brain.getRenderRange();
|
|
9395
|
+
const renderRowCount = endRow - startRow - 1;
|
|
9396
|
+
const renderColCount = endCol - startCol - 1;
|
|
9397
|
+
const maxRow = getDataSourceState().dataArray.length - 1;
|
|
9398
|
+
const maxCol = getComputed().computedVisibleColumns.length - 1;
|
|
9399
|
+
const minRow = 0;
|
|
9400
|
+
const minCol = 0;
|
|
9401
|
+
rowIndex = clamp(rowIndex, 0, maxRow);
|
|
9402
|
+
colIndex = clamp(colIndex, 0, maxCol);
|
|
9403
|
+
actions.activeCellIndex = [rowIndex, colIndex];
|
|
9404
|
+
const KeyToFunction = {
|
|
9405
|
+
ArrowDown: () => {
|
|
9406
|
+
rowIndex = clamp(rowIndex + 1, minRow, maxRow);
|
|
9407
|
+
},
|
|
9408
|
+
ArrowUp: () => {
|
|
9409
|
+
rowIndex = clamp(rowIndex - 1, minRow, maxRow);
|
|
9410
|
+
},
|
|
9411
|
+
ArrowLeft: () => {
|
|
9412
|
+
colIndex = clamp(colIndex - 1, minCol, maxCol);
|
|
9413
|
+
},
|
|
9414
|
+
ArrowRight: () => {
|
|
9415
|
+
colIndex = clamp(colIndex + 1, minCol, maxCol);
|
|
9416
|
+
},
|
|
9417
|
+
PageDown: () => {
|
|
9418
|
+
if (!shiftKey) {
|
|
9419
|
+
rowIndex = Math.min(rowIndex + renderRowCount, maxRow);
|
|
9420
|
+
} else {
|
|
9421
|
+
colIndex = Math.min(colIndex + renderColCount, maxCol);
|
|
9422
|
+
}
|
|
9423
|
+
},
|
|
9424
|
+
PageUp: () => {
|
|
9425
|
+
if (!shiftKey) {
|
|
9426
|
+
rowIndex = Math.max(rowIndex - renderRowCount, minRow);
|
|
9427
|
+
} else {
|
|
9428
|
+
colIndex = Math.max(colIndex - renderColCount, minCol);
|
|
9429
|
+
}
|
|
9430
|
+
},
|
|
9431
|
+
End: () => {
|
|
9432
|
+
if (!shiftKey) {
|
|
9433
|
+
rowIndex = maxRow;
|
|
9434
|
+
} else {
|
|
9435
|
+
colIndex = maxCol;
|
|
9436
|
+
}
|
|
9437
|
+
},
|
|
9438
|
+
Home: () => {
|
|
9439
|
+
if (!shiftKey) {
|
|
9440
|
+
rowIndex = minRow;
|
|
9441
|
+
} else {
|
|
9442
|
+
colIndex = minCol;
|
|
9443
|
+
}
|
|
9444
|
+
}
|
|
9445
|
+
};
|
|
9446
|
+
const Fn = KeyToFunction[key];
|
|
9447
|
+
if (!Fn) {
|
|
9448
|
+
return false;
|
|
9449
|
+
}
|
|
9450
|
+
Fn();
|
|
9451
|
+
actions.activeCellIndex = [rowIndex, colIndex];
|
|
9452
|
+
return true;
|
|
9453
|
+
}
|
|
9454
|
+
function handleKeyboardNavigation(options) {
|
|
9455
|
+
const { getState } = options;
|
|
9456
|
+
const state = getState();
|
|
9457
|
+
const { activeRowIndex, activeCellIndex, keyboardNavigation } = state;
|
|
9458
|
+
if (activeRowIndex != null && keyboardNavigation === "row") {
|
|
9459
|
+
return handleRowNavigation(options);
|
|
9460
|
+
}
|
|
9461
|
+
if (activeCellIndex != null && keyboardNavigation === "cell") {
|
|
9462
|
+
return handleCellNavigation(options);
|
|
9463
|
+
}
|
|
9464
|
+
return false;
|
|
9465
|
+
}
|
|
9466
|
+
|
|
8937
9467
|
// src/components/InfiniteTable/state/getInitialState.ts
|
|
8938
|
-
var
|
|
9468
|
+
var import_react44 = __toModule(require("react"));
|
|
8939
9469
|
|
|
8940
9470
|
// src/components/VirtualBrain/ScrollListener.ts
|
|
8941
9471
|
var initialScrollPosition = {
|
|
@@ -8991,6 +9521,18 @@ function toMap(mapOrObject, weakMapCache) {
|
|
|
8991
9521
|
}
|
|
8992
9522
|
|
|
8993
9523
|
// src/components/InfiniteTable/state/getInitialState.ts
|
|
9524
|
+
function createRenderer2(brain) {
|
|
9525
|
+
const renderer = new ReactHeadlessTableRenderer(brain);
|
|
9526
|
+
const onRenderUpdater = buildSubscriptionCallback();
|
|
9527
|
+
brain.onDestroy(() => {
|
|
9528
|
+
renderer.destroy();
|
|
9529
|
+
onRenderUpdater.destroy();
|
|
9530
|
+
});
|
|
9531
|
+
return {
|
|
9532
|
+
renderer,
|
|
9533
|
+
onRenderUpdater
|
|
9534
|
+
};
|
|
9535
|
+
}
|
|
8994
9536
|
function initSetupState2() {
|
|
8995
9537
|
const columnsGeneratedForGrouping = new Map();
|
|
8996
9538
|
const brain = new MatrixBrain();
|
|
@@ -9004,17 +9546,23 @@ function initSetupState2() {
|
|
|
9004
9546
|
if (true) {
|
|
9005
9547
|
globalThis.brain = brain;
|
|
9006
9548
|
}
|
|
9549
|
+
const { renderer, onRenderUpdater } = createRenderer2(brain);
|
|
9007
9550
|
brain.onAvailableSizeChange((size) => {
|
|
9008
9551
|
headerBrain.setAvailableSize({ width: size.width });
|
|
9009
9552
|
});
|
|
9553
|
+
if (true) {
|
|
9554
|
+
globalThis.renderer = renderer;
|
|
9555
|
+
}
|
|
9010
9556
|
return {
|
|
9557
|
+
renderer,
|
|
9558
|
+
onRenderUpdater,
|
|
9011
9559
|
propsCache: new Map([]),
|
|
9012
9560
|
brain,
|
|
9013
9561
|
headerBrain,
|
|
9014
9562
|
columnShifts: null,
|
|
9015
|
-
domRef: (0,
|
|
9016
|
-
scrollerDOMRef: (0,
|
|
9017
|
-
portalDOMRef: (0,
|
|
9563
|
+
domRef: (0, import_react44.createRef)(),
|
|
9564
|
+
scrollerDOMRef: (0, import_react44.createRef)(),
|
|
9565
|
+
portalDOMRef: (0, import_react44.createRef)(),
|
|
9018
9566
|
onRowHeightCSSVarChange: buildSubscriptionCallback(),
|
|
9019
9567
|
onColumnHeaderHeightCSSVarChange: buildSubscriptionCallback(),
|
|
9020
9568
|
bodySize: {
|
|
@@ -9068,7 +9616,6 @@ var forwardProps3 = (setupState) => {
|
|
|
9068
9616
|
scrollStopDelay: (scrollStopDelay) => scrollStopDelay != null ? scrollStopDelay : 250,
|
|
9069
9617
|
filterEditors: (filterEditors) => __spreadValues(__spreadValues({}, defaultFilterEditors), filterEditors),
|
|
9070
9618
|
viewportReservedWidth: (viewportReservedWidth) => viewportReservedWidth != null ? viewportReservedWidth : 0,
|
|
9071
|
-
activeIndex: (activeIndex) => activeIndex != null ? activeIndex : 0,
|
|
9072
9619
|
columnMinWidth: (columnMinWidth) => columnMinWidth != null ? columnMinWidth : 30,
|
|
9073
9620
|
columnMaxWidth: (columnMaxWidth) => columnMaxWidth != null ? columnMaxWidth : 2e3,
|
|
9074
9621
|
columnDefaultWidth: (columnDefaultWidth) => columnDefaultWidth != null ? columnDefaultWidth : 200,
|
|
@@ -9083,6 +9630,9 @@ var forwardProps3 = (setupState) => {
|
|
|
9083
9630
|
pivotTotalColumnPosition: (pivotTotalColumnPosition) => pivotTotalColumnPosition != null ? pivotTotalColumnPosition : "end",
|
|
9084
9631
|
pivotGrandTotalColumnPosition: 1,
|
|
9085
9632
|
licenseKey: (licenseKey) => licenseKey || "",
|
|
9633
|
+
keyboardNavigation: (keyboardNavigation) => keyboardNavigation || "cell",
|
|
9634
|
+
activeRowIndex: 1,
|
|
9635
|
+
activeCellIndex: 1,
|
|
9086
9636
|
columnOrder: (columnOrder) => columnOrder != null ? columnOrder : true,
|
|
9087
9637
|
header: (header) => header != null ? header : true,
|
|
9088
9638
|
showZebraRows: (showZebraRows) => showZebraRows != null ? showZebraRows : true,
|
|
@@ -9153,14 +9703,23 @@ var InfiniteTableRoot = getComponentStateRoot({
|
|
|
9153
9703
|
getParentState: () => useDataSource(),
|
|
9154
9704
|
debugName: "InfiniteTable"
|
|
9155
9705
|
});
|
|
9156
|
-
var InfiniteTableComponent =
|
|
9706
|
+
var InfiniteTableComponent = React32.memo(function InfiniteTableComponent2() {
|
|
9157
9707
|
var _a;
|
|
9158
|
-
const {
|
|
9708
|
+
const {
|
|
9709
|
+
componentState,
|
|
9710
|
+
getComputed,
|
|
9711
|
+
computed,
|
|
9712
|
+
componentActions: actions,
|
|
9713
|
+
getState
|
|
9714
|
+
} = useInfiniteTable();
|
|
9159
9715
|
const {
|
|
9160
9716
|
componentState: { loading },
|
|
9161
9717
|
getState: getDataSourceState,
|
|
9162
9718
|
componentActions: dataSourceActions
|
|
9163
9719
|
} = useDataSourceContextValue();
|
|
9720
|
+
const [imperativeApi] = (0, import_react45.useState)(() => {
|
|
9721
|
+
return getImperativeApi(getState, getComputed, getDataSourceState, actions);
|
|
9722
|
+
});
|
|
9164
9723
|
const {
|
|
9165
9724
|
domRef,
|
|
9166
9725
|
scrollerDOMRef,
|
|
@@ -9175,18 +9734,38 @@ var InfiniteTableComponent = React30.memo(function InfiniteTableComponent2() {
|
|
|
9175
9734
|
components,
|
|
9176
9735
|
scrollStopDelay,
|
|
9177
9736
|
brain,
|
|
9178
|
-
headerBrain
|
|
9737
|
+
headerBrain,
|
|
9738
|
+
renderer,
|
|
9739
|
+
keyboardNavigation,
|
|
9740
|
+
activeRowIndex,
|
|
9741
|
+
activeCellIndex,
|
|
9742
|
+
onRenderUpdater
|
|
9179
9743
|
} = componentState;
|
|
9744
|
+
(0, import_react45.useEffect)(() => {
|
|
9745
|
+
if (activeRowIndex != null) {
|
|
9746
|
+
imperativeApi.scrollRowIntoView(activeRowIndex, {
|
|
9747
|
+
offset: 30
|
|
9748
|
+
});
|
|
9749
|
+
}
|
|
9750
|
+
}, [activeRowIndex]);
|
|
9751
|
+
(0, import_react45.useEffect)(() => {
|
|
9752
|
+
if (activeCellIndex != null) {
|
|
9753
|
+
imperativeApi.scrollCellIntoView(activeCellIndex[0], activeCellIndex[1], {
|
|
9754
|
+
offset: 30
|
|
9755
|
+
});
|
|
9756
|
+
}
|
|
9757
|
+
}, [activeCellIndex]);
|
|
9180
9758
|
const { columnShifts, bodySize } = componentState;
|
|
9181
9759
|
const { scrollbars } = computed;
|
|
9182
9760
|
const { renderCell } = useCellRendering({
|
|
9761
|
+
imperativeApi,
|
|
9183
9762
|
getComputed,
|
|
9184
9763
|
domRef: componentState.domRef,
|
|
9185
9764
|
columnShifts,
|
|
9186
9765
|
bodySize,
|
|
9187
9766
|
computed
|
|
9188
9767
|
});
|
|
9189
|
-
|
|
9768
|
+
React32.useEffect(() => {
|
|
9190
9769
|
const dataSourceState = getDataSourceState();
|
|
9191
9770
|
const onChange = debounce((renderRange) => {
|
|
9192
9771
|
dataSourceState.notifyRenderRangeChange({
|
|
@@ -9199,35 +9778,52 @@ var InfiniteTableComponent = React30.memo(function InfiniteTableComponent2() {
|
|
|
9199
9778
|
const licenseValid = useLicense(licenseKey);
|
|
9200
9779
|
const domProps = useDOMProps(componentState.domProps);
|
|
9201
9780
|
const LoadMaskCmp = (_a = components == null ? void 0 : components.LoadMask) != null ? _a : LoadMask;
|
|
9202
|
-
|
|
9781
|
+
React32.useEffect(() => {
|
|
9203
9782
|
brain.setScrollStopDelay(scrollStopDelay);
|
|
9204
9783
|
dataSourceActions.scrollStopDelayUpdatedByTable = scrollStopDelay;
|
|
9205
9784
|
}, [scrollStopDelay]);
|
|
9206
9785
|
useAutoSizeColumns();
|
|
9207
|
-
|
|
9786
|
+
const onKeyDown = (0, import_react45.useCallback)((event) => {
|
|
9787
|
+
if (handleKeyboardNavigation({
|
|
9788
|
+
getState,
|
|
9789
|
+
actions,
|
|
9790
|
+
getDataSourceState,
|
|
9791
|
+
getComputed,
|
|
9792
|
+
key: event.key,
|
|
9793
|
+
shiftKey: !!event.shiftKey
|
|
9794
|
+
})) {
|
|
9795
|
+
event.preventDefault();
|
|
9796
|
+
}
|
|
9797
|
+
}, []);
|
|
9798
|
+
return /* @__PURE__ */ React32.createElement("div", __spreadValues({
|
|
9799
|
+
onKeyDown,
|
|
9208
9800
|
ref: domRef
|
|
9209
|
-
}, domProps), header ? /* @__PURE__ */
|
|
9801
|
+
}, domProps), header ? /* @__PURE__ */ React32.createElement(TableHeaderWrapper, {
|
|
9210
9802
|
brain: headerBrain,
|
|
9211
9803
|
scrollbars
|
|
9212
|
-
}) : null, /* @__PURE__ */
|
|
9804
|
+
}) : null, /* @__PURE__ */ React32.createElement(InfiniteTableBody, null, /* @__PURE__ */ React32.createElement(HeadlessTable, {
|
|
9213
9805
|
tabIndex: 0,
|
|
9806
|
+
activeRowIndex: componentState.ready && keyboardNavigation === "row" ? activeRowIndex : null,
|
|
9807
|
+
activeCellIndex: componentState.ready && keyboardNavigation === "cell" ? activeCellIndex : null,
|
|
9214
9808
|
scrollStopDelay,
|
|
9809
|
+
renderer,
|
|
9810
|
+
onRenderUpdater,
|
|
9215
9811
|
brain,
|
|
9216
9812
|
renderCell,
|
|
9217
9813
|
cellHoverClassNames: HOVERED_CLASS_NAMES,
|
|
9218
9814
|
scrollerDOMRef
|
|
9219
|
-
}), /* @__PURE__ */
|
|
9815
|
+
}), /* @__PURE__ */ React32.createElement(LoadMaskCmp, {
|
|
9220
9816
|
visible: loading
|
|
9221
|
-
}, loadingText)), /* @__PURE__ */
|
|
9817
|
+
}, loadingText)), /* @__PURE__ */ React32.createElement("div", {
|
|
9222
9818
|
ref: portalDOMRef,
|
|
9223
9819
|
className: join(`${rootClassName2}Portal`, zIndex[1e3], position.absolute, top[0], left[0])
|
|
9224
|
-
}), rowHeightCSSVar ? /* @__PURE__ */
|
|
9820
|
+
}), rowHeightCSSVar ? /* @__PURE__ */ React32.createElement(CSSVariableWatch, {
|
|
9225
9821
|
varName: rowHeightCSSVar,
|
|
9226
9822
|
onChange: onRowHeightCSSVarChange
|
|
9227
|
-
}) : null, columnHeaderHeightCSSVar ? /* @__PURE__ */
|
|
9823
|
+
}) : null, columnHeaderHeightCSSVar ? /* @__PURE__ */ React32.createElement(CSSVariableWatch, {
|
|
9228
9824
|
varName: columnHeaderHeightCSSVar,
|
|
9229
9825
|
onChange: onColumnHeaderHeightCSSVarChange
|
|
9230
|
-
}) : null, /* @__PURE__ */
|
|
9826
|
+
}) : null, /* @__PURE__ */ React32.createElement(InfiniteTableFooter, null), licenseValid ? null : /* @__PURE__ */ React32.createElement(InfiniteTableLicenseFooter, null));
|
|
9231
9827
|
});
|
|
9232
9828
|
function InfiniteTableContextProvider() {
|
|
9233
9829
|
const { componentActions, componentState } = useComponentState();
|
|
@@ -9255,25 +9851,25 @@ function InfiniteTableContextProvider() {
|
|
|
9255
9851
|
bodySize.width = (_b = (_a = scrollerDOMRef.current) == null ? void 0 : _a.scrollWidth) != null ? _b : bodySize.width;
|
|
9256
9852
|
componentActions.bodySize = bodySize;
|
|
9257
9853
|
}, { earlyAttach: true });
|
|
9258
|
-
|
|
9854
|
+
React32.useEffect(() => {
|
|
9259
9855
|
return () => {
|
|
9260
9856
|
componentState.onRowHeightCSSVarChange.destroy();
|
|
9261
9857
|
componentState.onColumnHeaderHeightCSSVarChange.destroy();
|
|
9262
9858
|
};
|
|
9263
9859
|
}, []);
|
|
9264
|
-
|
|
9860
|
+
React32.useEffect(() => {
|
|
9265
9861
|
if (scrollerDOMRef.current) {
|
|
9266
9862
|
scrollerDOMRef.current.scrollTop = 0;
|
|
9267
9863
|
}
|
|
9268
9864
|
}, [scrollTopKey, scrollerDOMRef]);
|
|
9269
9865
|
const TableContext2 = getInfiniteTableContext();
|
|
9270
|
-
return /* @__PURE__ */
|
|
9866
|
+
return /* @__PURE__ */ React32.createElement(TableContext2.Provider, {
|
|
9271
9867
|
value: contextValue
|
|
9272
|
-
}, /* @__PURE__ */
|
|
9868
|
+
}, /* @__PURE__ */ React32.createElement(InfiniteTableComponent, null));
|
|
9273
9869
|
}
|
|
9274
9870
|
function InfiniteTable(props) {
|
|
9275
|
-
const table = /* @__PURE__ */
|
|
9276
|
-
return /* @__PURE__ */
|
|
9871
|
+
const table = /* @__PURE__ */ React32.createElement(InfiniteTableRoot, __spreadValues({}, props), /* @__PURE__ */ React32.createElement(InfiniteTableContextProvider, null));
|
|
9872
|
+
return /* @__PURE__ */ React32.createElement(React32.StrictMode, null, table);
|
|
9277
9873
|
}
|
|
9278
9874
|
InfiniteTable.defaultProps = {
|
|
9279
9875
|
rowHeight: 40,
|