@sustaina/shared-ui 1.69.0 → 1.70.1
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/dist/index.d.mts +19 -3
- package/dist/index.d.ts +19 -3
- package/dist/index.js +597 -263
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +599 -265
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9020,7 +9020,7 @@ var HeaderCell = ({
|
|
|
9020
9020
|
{
|
|
9021
9021
|
ref,
|
|
9022
9022
|
className: cn(
|
|
9023
|
-
"flex items-center justify-between gap-2",
|
|
9023
|
+
"flex items-center justify-between gap-2 h-full",
|
|
9024
9024
|
{
|
|
9025
9025
|
"cursor-pointer": context?.column?.getCanSort()
|
|
9026
9026
|
},
|
|
@@ -9048,13 +9048,17 @@ var HeaderCell = ({
|
|
|
9048
9048
|
showSorter && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9049
9049
|
"div",
|
|
9050
9050
|
{
|
|
9051
|
-
className:
|
|
9051
|
+
className: cn(
|
|
9052
|
+
"flex flex-col -space-y-2 transition-opacity duration-150",
|
|
9053
|
+
sorterProps?.rootClassName
|
|
9054
|
+
),
|
|
9055
|
+
style: { opacity: hovering || !!context.column.getIsSorted() ? 1 : 0.35 },
|
|
9052
9056
|
title: context.column.getCanSort() ? context.column.getNextSortingOrder() === "asc" ? "Sort ascending" : context.column.getNextSortingOrder() === "desc" ? "Sort descending" : "Clear sort" : void 0,
|
|
9053
9057
|
children: [
|
|
9054
9058
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9055
9059
|
lucideReact.ChevronUp,
|
|
9056
9060
|
{
|
|
9057
|
-
className: cn("stroke-[#BBBBBB]", {
|
|
9061
|
+
className: cn("stroke-[#BBBBBB] transition-colors duration-200", {
|
|
9058
9062
|
"stroke-sus-gray-5": context?.column?.getIsSorted() === "asc",
|
|
9059
9063
|
"stroke-sus-gray-5/45": context?.column?.getNextSortingOrder() === "asc" && hovering
|
|
9060
9064
|
}),
|
|
@@ -9065,7 +9069,7 @@ var HeaderCell = ({
|
|
|
9065
9069
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9066
9070
|
lucideReact.ChevronDown,
|
|
9067
9071
|
{
|
|
9068
|
-
className: cn("stroke-[#BBBBBB]", {
|
|
9072
|
+
className: cn("stroke-[#BBBBBB] transition-colors duration-200", {
|
|
9069
9073
|
"stroke-sus-gray-5": context?.column?.getIsSorted() === "desc",
|
|
9070
9074
|
"stroke-sus-gray-5/45": context?.column?.getNextSortingOrder() === "desc" && hovering
|
|
9071
9075
|
}),
|
|
@@ -9141,7 +9145,7 @@ function TableHead({ className, ...props }) {
|
|
|
9141
9145
|
{
|
|
9142
9146
|
"data-slot": "table-head",
|
|
9143
9147
|
className: cn(
|
|
9144
|
-
"text-foreground h-9 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 *:[[role=checkbox]]:translate-y-0.5 hover:bg-gray-200 bg-[#F0F0F0] truncate",
|
|
9148
|
+
"text-foreground h-9 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 *:[[role=checkbox]]:translate-y-0.5 hover:bg-gray-200 bg-[#F0F0F0] truncate transition-colors duration-150",
|
|
9145
9149
|
className
|
|
9146
9150
|
),
|
|
9147
9151
|
...props
|
|
@@ -9500,8 +9504,13 @@ var useScrollFetch = ({ scrollFetch, containerRef }) => {
|
|
|
9500
9504
|
}, [fetchMoreOnScrollReached, containerRef]);
|
|
9501
9505
|
return fetchMoreOnScrollReached;
|
|
9502
9506
|
};
|
|
9507
|
+
|
|
9508
|
+
// src/components/data-table/constants.ts
|
|
9503
9509
|
var DEFAULT_ROW_HEIGHT = 40;
|
|
9504
9510
|
var DEFAULT_OVER_SCAN = 10;
|
|
9511
|
+
var DEFAULT_COLUMN_OVERSCAN = 1;
|
|
9512
|
+
|
|
9513
|
+
// src/components/data-table/hooks/useTableVirtualizer.ts
|
|
9505
9514
|
var useTableVirtualizer = ({
|
|
9506
9515
|
enabled,
|
|
9507
9516
|
table,
|
|
@@ -9509,23 +9518,50 @@ var useTableVirtualizer = ({
|
|
|
9509
9518
|
virtual
|
|
9510
9519
|
}) => {
|
|
9511
9520
|
const rowModel = table.getRowModel().rows;
|
|
9521
|
+
const columnsEnabled = virtual?.columns?.enabled ?? false;
|
|
9522
|
+
const centerColumns = table.getCenterVisibleLeafColumns();
|
|
9523
|
+
const getRowVirtualItemKey = React.useCallback((index) => rowModel[index]?.id ?? index, [rowModel]);
|
|
9524
|
+
const getColumnVirtualItemKey = React.useCallback(
|
|
9525
|
+
(index) => centerColumns[index]?.id ?? index,
|
|
9526
|
+
[centerColumns]
|
|
9527
|
+
);
|
|
9512
9528
|
const virtualizer = reactVirtual.useVirtualizer({
|
|
9513
9529
|
count: enabled ? rowModel.length : 0,
|
|
9514
9530
|
useFlushSync: false,
|
|
9515
9531
|
getScrollElement: () => containerRef.current,
|
|
9516
9532
|
estimateSize: () => DEFAULT_ROW_HEIGHT,
|
|
9533
|
+
getItemKey: getRowVirtualItemKey,
|
|
9517
9534
|
measureElement: typeof window !== "undefined" && navigator.userAgent.indexOf("Firefox") === -1 ? (element) => element?.getBoundingClientRect().height : void 0,
|
|
9518
9535
|
overscan: virtual?.overscan ?? DEFAULT_OVER_SCAN
|
|
9519
9536
|
});
|
|
9537
|
+
const columnVirtualizer = reactVirtual.useVirtualizer({
|
|
9538
|
+
count: columnsEnabled ? centerColumns.length : 0,
|
|
9539
|
+
estimateSize: (index) => centerColumns[index]?.getSize() ?? 0,
|
|
9540
|
+
getScrollElement: () => containerRef.current,
|
|
9541
|
+
horizontal: true,
|
|
9542
|
+
getItemKey: getColumnVirtualItemKey,
|
|
9543
|
+
overscan: virtual?.columns?.overscan ?? DEFAULT_COLUMN_OVERSCAN
|
|
9544
|
+
});
|
|
9520
9545
|
const virtualItems = enabled ? virtualizer.getVirtualItems() : [];
|
|
9521
9546
|
const paddingTop = enabled && virtualItems.length > 0 ? virtualItems[0].start : 0;
|
|
9522
9547
|
const paddingBottom = enabled && virtualItems.length > 0 ? virtualizer.getTotalSize() - virtualItems[virtualItems.length - 1].end : 0;
|
|
9548
|
+
let columnVirtual;
|
|
9549
|
+
if (!columnsEnabled) {
|
|
9550
|
+
columnVirtual = { enabled: false };
|
|
9551
|
+
} else {
|
|
9552
|
+
const virtualColumns = columnVirtualizer.getVirtualItems();
|
|
9553
|
+
const virtualPaddingLeft = virtualColumns[0]?.start ?? 0;
|
|
9554
|
+
const virtualPaddingRight = columnVirtualizer.getTotalSize() - (virtualColumns[virtualColumns.length - 1]?.end ?? 0);
|
|
9555
|
+
columnVirtual = { enabled: true, virtualColumns, virtualPaddingLeft, virtualPaddingRight };
|
|
9556
|
+
}
|
|
9523
9557
|
return {
|
|
9524
9558
|
virtualizer,
|
|
9559
|
+
columnVirtualizer,
|
|
9525
9560
|
virtualItems,
|
|
9526
9561
|
paddingTop,
|
|
9527
9562
|
paddingBottom,
|
|
9528
|
-
rowModel
|
|
9563
|
+
rowModel,
|
|
9564
|
+
columnVirtual
|
|
9529
9565
|
};
|
|
9530
9566
|
};
|
|
9531
9567
|
function useComputedTableState({
|
|
@@ -9628,6 +9664,7 @@ var ColumnSeparator = ({ show, className, ...props }) => {
|
|
|
9628
9664
|
var ColumnSeparator_default = React__namespace.default.memo(ColumnSeparator);
|
|
9629
9665
|
|
|
9630
9666
|
// src/components/data-table/helpers.ts
|
|
9667
|
+
var toCSSId = (id) => id.replace(/[^a-zA-Z0-9_-]/g, "-");
|
|
9631
9668
|
function getColumnPinningInfo(column) {
|
|
9632
9669
|
const isPinned = column.getIsPinned();
|
|
9633
9670
|
const isLastLeftPinnedColumn = isPinned === "left" && column.getIsLastColumn("left");
|
|
@@ -9638,8 +9675,8 @@ function getColumnPinningStyles(column) {
|
|
|
9638
9675
|
const { isPinned, isFirstRightPinnedColumn, isLastLeftPinnedColumn } = getColumnPinningInfo(column);
|
|
9639
9676
|
const classes = cn(isPinned ? "sticky" : "relative");
|
|
9640
9677
|
const style = {
|
|
9641
|
-
left: isPinned === "left" ? column.getStart("left") : void 0,
|
|
9642
|
-
right: isPinned === "right" ? column.getAfter("right") : void 0,
|
|
9678
|
+
left: isPinned === "left" ? `calc(var(--col-${toCSSId(column.id)}-pin-start, ${column.getStart("left")}) * 1px)` : void 0,
|
|
9679
|
+
right: isPinned === "right" ? `calc(var(--col-${toCSSId(column.id)}-pin-after, ${column.getAfter("right")}) * 1px)` : void 0,
|
|
9643
9680
|
zIndex: isPinned ? 1 : 0,
|
|
9644
9681
|
boxShadow: isLastLeftPinnedColumn ? "inset -1px 0 0 0 black" : isFirstRightPinnedColumn ? "inset 1px 0 0 0 black" : void 0
|
|
9645
9682
|
};
|
|
@@ -9658,102 +9695,243 @@ function getRowClickHandlers(handler, { rowData, row, table }) {
|
|
|
9658
9695
|
onClick: handleClick
|
|
9659
9696
|
};
|
|
9660
9697
|
}
|
|
9698
|
+
function renderHeaderCell(header, headerGroup, {
|
|
9699
|
+
columnResizing,
|
|
9700
|
+
virtual,
|
|
9701
|
+
components,
|
|
9702
|
+
table
|
|
9703
|
+
}, rowSpan) {
|
|
9704
|
+
const { classes, style } = getColumnPinningStyles(header.column);
|
|
9705
|
+
const useColumnSizing = header.column.columnDef?.meta?.useColumnSizing ?? columnResizing?.enabled ?? virtual?.enabled ?? false;
|
|
9706
|
+
const tableHeadCellProps = typeof components?.tableHeadCellProps === "function" ? components?.tableHeadCellProps({ header, table }) : components?.tableHeadCellProps;
|
|
9707
|
+
const nextHeader = headerGroup.headers?.[header.index + 1] || header;
|
|
9708
|
+
const { isLastLeftPinnedColumn } = getColumnPinningInfo(header.column);
|
|
9709
|
+
const { isFirstRightPinnedColumn } = getColumnPinningInfo(nextHeader.column);
|
|
9710
|
+
const headerGroupLength = headerGroup.headers.length;
|
|
9711
|
+
const showSeparator = header.index !== headerGroupLength - 1 && !isLastLeftPinnedColumn && !isFirstRightPinnedColumn && (!header.isPlaceholder || !nextHeader.isPlaceholder);
|
|
9712
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9713
|
+
TableHead,
|
|
9714
|
+
{
|
|
9715
|
+
"data-testid": `table-head-${header.id}`,
|
|
9716
|
+
colSpan: header.colSpan,
|
|
9717
|
+
rowSpan,
|
|
9718
|
+
...tableHeadCellProps,
|
|
9719
|
+
...header.column.columnDef?.meta?.headerProps,
|
|
9720
|
+
className: cn(
|
|
9721
|
+
classes,
|
|
9722
|
+
tableHeadCellProps?.className,
|
|
9723
|
+
header.column.columnDef?.meta?.headerProps?.className
|
|
9724
|
+
),
|
|
9725
|
+
style: {
|
|
9726
|
+
...style,
|
|
9727
|
+
width: useColumnSizing ? `calc(var(--header-${toCSSId(header.id)}-size, ${header.getSize()}) * 1px)` : void 0,
|
|
9728
|
+
minWidth: useColumnSizing ? header.column.columnDef.minSize : void 0,
|
|
9729
|
+
maxWidth: useColumnSizing ? header.column.columnDef.maxSize : void 0,
|
|
9730
|
+
...tableHeadCellProps?.style,
|
|
9731
|
+
...header.column.columnDef?.meta?.headerProps?.style
|
|
9732
|
+
},
|
|
9733
|
+
children: [
|
|
9734
|
+
!header.isPlaceholder || rowSpan ? reactTable.flexRender(header.column.columnDef.header, header.getContext()) : null,
|
|
9735
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9736
|
+
ColumnSeparator_default,
|
|
9737
|
+
{
|
|
9738
|
+
...components?.columnSeparatorProps?.headerCell,
|
|
9739
|
+
...header.column.columnDef?.meta?.columnSeparatorProps,
|
|
9740
|
+
show: header.column.columnDef?.meta?.columnSeparatorProps?.show ?? components?.columnSeparatorProps?.headerCell?.show ?? showSeparator
|
|
9741
|
+
}
|
|
9742
|
+
),
|
|
9743
|
+
/* @__PURE__ */ jsxRuntime.jsx(ColumnResizer_default, { header, ...components?.columnResizerProps })
|
|
9744
|
+
]
|
|
9745
|
+
},
|
|
9746
|
+
header.id
|
|
9747
|
+
);
|
|
9748
|
+
}
|
|
9661
9749
|
var TableHeaderRows = ({
|
|
9662
9750
|
table,
|
|
9663
9751
|
columnResizing,
|
|
9664
9752
|
virtual,
|
|
9753
|
+
columnVirtual,
|
|
9665
9754
|
components
|
|
9666
9755
|
}) => {
|
|
9667
|
-
|
|
9668
|
-
|
|
9669
|
-
|
|
9670
|
-
|
|
9671
|
-
|
|
9672
|
-
|
|
9673
|
-
|
|
9674
|
-
|
|
9675
|
-
|
|
9676
|
-
|
|
9677
|
-
|
|
9678
|
-
|
|
9679
|
-
|
|
9680
|
-
|
|
9681
|
-
|
|
9682
|
-
|
|
9683
|
-
|
|
9684
|
-
|
|
9685
|
-
|
|
9686
|
-
|
|
9687
|
-
|
|
9688
|
-
|
|
9689
|
-
|
|
9690
|
-
|
|
9691
|
-
|
|
9692
|
-
|
|
9693
|
-
|
|
9694
|
-
|
|
9695
|
-
|
|
9696
|
-
|
|
9697
|
-
|
|
9698
|
-
|
|
9699
|
-
|
|
9700
|
-
|
|
9701
|
-
|
|
9702
|
-
|
|
9703
|
-
|
|
9704
|
-
|
|
9705
|
-
|
|
9756
|
+
const cellProps = { columnResizing, virtual, components, table };
|
|
9757
|
+
const centerLeafCols = columnVirtual.enabled ? table.getCenterVisibleLeafColumns() : [];
|
|
9758
|
+
const totalGroups = table.getHeaderGroups().length;
|
|
9759
|
+
const spannedIds = /* @__PURE__ */ new Set();
|
|
9760
|
+
const resolveHeaderCell = (header, headerGroup, groupIndex) => {
|
|
9761
|
+
if (spannedIds.has(header.column.id)) return null;
|
|
9762
|
+
const remainingRows = totalGroups - groupIndex;
|
|
9763
|
+
if (header.isPlaceholder && header.column.columnDef.meta?.spanRows && remainingRows > 1) {
|
|
9764
|
+
spannedIds.add(header.column.id);
|
|
9765
|
+
return renderHeaderCell(header, headerGroup, cellProps, remainingRows);
|
|
9766
|
+
}
|
|
9767
|
+
return renderHeaderCell(header, headerGroup, cellProps);
|
|
9768
|
+
};
|
|
9769
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: table.getHeaderGroups().map((headerGroup, groupIndex) => {
|
|
9770
|
+
if (!columnVirtual.enabled) {
|
|
9771
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TableRow, { children: headerGroup.headers.map((header) => resolveHeaderCell(header, headerGroup, groupIndex)) }, headerGroup.id);
|
|
9772
|
+
}
|
|
9773
|
+
const leftHeaders = table.getLeftHeaderGroups()[groupIndex]?.headers ?? [];
|
|
9774
|
+
const centerHeaders = table.getCenterHeaderGroups()[groupIndex]?.headers ?? [];
|
|
9775
|
+
const rightHeaders = table.getRightHeaderGroups()[groupIndex]?.headers ?? [];
|
|
9776
|
+
const isLeafLevel = !centerHeaders[0] || centerHeaders[0].subHeaders.length === 0;
|
|
9777
|
+
if (isLeafLevel) {
|
|
9778
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(TableRow, { children: [
|
|
9779
|
+
leftHeaders.map((header) => resolveHeaderCell(header, headerGroup, groupIndex)),
|
|
9780
|
+
columnVirtual.virtualPaddingLeft > 0 && /* @__PURE__ */ jsxRuntime.jsx("th", { "aria-hidden": "true", style: { width: columnVirtual.virtualPaddingLeft } }),
|
|
9781
|
+
columnVirtual.virtualColumns.map((vc) => {
|
|
9782
|
+
const header = centerHeaders[vc.index];
|
|
9783
|
+
if (!header) return null;
|
|
9784
|
+
return renderHeaderCell(header, headerGroup, cellProps);
|
|
9785
|
+
}),
|
|
9786
|
+
columnVirtual.virtualPaddingRight > 0 && /* @__PURE__ */ jsxRuntime.jsx("th", { "aria-hidden": "true", style: { width: columnVirtual.virtualPaddingRight } }),
|
|
9787
|
+
rightHeaders.map((header) => resolveHeaderCell(header, headerGroup, groupIndex))
|
|
9788
|
+
] }, headerGroup.id);
|
|
9789
|
+
}
|
|
9790
|
+
const leafToGroupIdx = [];
|
|
9791
|
+
let leafRunning = 0;
|
|
9792
|
+
for (let gi = 0; gi < centerHeaders.length; gi++) {
|
|
9793
|
+
for (let i = 0; i < centerHeaders[gi].colSpan; i++) {
|
|
9794
|
+
leafToGroupIdx[leafRunning + i] = gi;
|
|
9795
|
+
}
|
|
9796
|
+
leafRunning += centerHeaders[gi].colSpan;
|
|
9797
|
+
}
|
|
9798
|
+
const virtualCols = columnVirtual.virtualColumns;
|
|
9799
|
+
const groupedVirtualCols = [];
|
|
9800
|
+
for (const vc of virtualCols) {
|
|
9801
|
+
const gi = leafToGroupIdx[vc.index];
|
|
9802
|
+
if (gi === void 0) continue;
|
|
9803
|
+
const last = groupedVirtualCols[groupedVirtualCols.length - 1];
|
|
9804
|
+
if (last && last.gi === gi) {
|
|
9805
|
+
last.vcs.push(vc);
|
|
9806
|
+
} else {
|
|
9807
|
+
groupedVirtualCols.push({ gi, vcs: [vc] });
|
|
9808
|
+
}
|
|
9809
|
+
}
|
|
9810
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(TableRow, { children: [
|
|
9811
|
+
leftHeaders.map((header) => resolveHeaderCell(header, headerGroup, groupIndex)),
|
|
9812
|
+
columnVirtual.virtualPaddingLeft > 0 && /* @__PURE__ */ jsxRuntime.jsx("th", { "aria-hidden": "true", style: { width: columnVirtual.virtualPaddingLeft } }),
|
|
9813
|
+
groupedVirtualCols.map(({ gi, vcs }) => {
|
|
9814
|
+
const groupHeader = centerHeaders[gi];
|
|
9815
|
+
const { classes, style } = getColumnPinningStyles(groupHeader.column);
|
|
9816
|
+
const tableHeadCellProps = typeof components?.tableHeadCellProps === "function" ? components.tableHeadCellProps({ header: groupHeader, table }) : components?.tableHeadCellProps;
|
|
9817
|
+
const useColumnSizing = groupHeader.column.columnDef?.meta?.useColumnSizing ?? columnResizing?.enabled ?? virtual?.enabled ?? false;
|
|
9818
|
+
const widthCalc = useColumnSizing ? `calc((${vcs.map((vc) => `var(--col-${toCSSId(centerLeafCols[vc.index].id)}-size, ${centerLeafCols[vc.index].getSize()})`).join(" + ")}) * 1px)` : void 0;
|
|
9819
|
+
const nextCenterHeader = centerHeaders[gi + 1];
|
|
9820
|
+
const showSeparator = groupHeader.column.columnDef?.meta?.columnSeparatorProps?.show ?? components?.columnSeparatorProps?.headerCell?.show ?? (gi !== centerHeaders.length - 1 && (!groupHeader.isPlaceholder || !nextCenterHeader?.isPlaceholder));
|
|
9821
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9822
|
+
TableHead,
|
|
9823
|
+
{
|
|
9824
|
+
"data-testid": `table-head-${groupHeader.id}`,
|
|
9825
|
+
colSpan: vcs.length,
|
|
9826
|
+
...tableHeadCellProps,
|
|
9827
|
+
...groupHeader.column.columnDef?.meta?.headerProps,
|
|
9828
|
+
className: cn(
|
|
9829
|
+
classes,
|
|
9830
|
+
tableHeadCellProps?.className,
|
|
9831
|
+
groupHeader.column.columnDef?.meta?.headerProps?.className
|
|
9706
9832
|
),
|
|
9707
|
-
|
|
9708
|
-
|
|
9709
|
-
|
|
9710
|
-
|
|
9711
|
-
|
|
9712
|
-
|
|
9833
|
+
style: {
|
|
9834
|
+
...style,
|
|
9835
|
+
width: widthCalc,
|
|
9836
|
+
minWidth: useColumnSizing ? groupHeader.column.columnDef.minSize : void 0,
|
|
9837
|
+
maxWidth: useColumnSizing ? groupHeader.column.columnDef.maxSize : void 0,
|
|
9838
|
+
...tableHeadCellProps?.style,
|
|
9839
|
+
...groupHeader.column.columnDef?.meta?.headerProps?.style
|
|
9840
|
+
},
|
|
9841
|
+
children: [
|
|
9842
|
+
!groupHeader.isPlaceholder ? reactTable.flexRender(groupHeader.column.columnDef.header, groupHeader.getContext()) : null,
|
|
9843
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9844
|
+
ColumnSeparator_default,
|
|
9845
|
+
{
|
|
9846
|
+
...components?.columnSeparatorProps?.headerCell,
|
|
9847
|
+
...groupHeader.column.columnDef?.meta?.columnSeparatorProps,
|
|
9848
|
+
show: showSeparator
|
|
9849
|
+
}
|
|
9850
|
+
),
|
|
9851
|
+
/* @__PURE__ */ jsxRuntime.jsx(ColumnResizer_default, { header: groupHeader, ...components?.columnResizerProps })
|
|
9852
|
+
]
|
|
9853
|
+
},
|
|
9854
|
+
`${groupHeader.id}-${vcs[0].index}`
|
|
9855
|
+
);
|
|
9856
|
+
}),
|
|
9857
|
+
columnVirtual.virtualPaddingRight > 0 && /* @__PURE__ */ jsxRuntime.jsx("th", { "aria-hidden": "true", style: { width: columnVirtual.virtualPaddingRight } }),
|
|
9858
|
+
rightHeaders.map((header) => resolveHeaderCell(header, headerGroup, groupIndex))
|
|
9859
|
+
] }, headerGroup.id);
|
|
9713
9860
|
}) });
|
|
9714
9861
|
};
|
|
9862
|
+
var MemoizedTableHeaderRows = React__namespace.default.memo(
|
|
9863
|
+
TableHeaderRows,
|
|
9864
|
+
(_, next) => next.isResizing === true
|
|
9865
|
+
);
|
|
9866
|
+
function renderFilterCell(column, {
|
|
9867
|
+
columnResizing,
|
|
9868
|
+
virtual,
|
|
9869
|
+
components,
|
|
9870
|
+
table
|
|
9871
|
+
}) {
|
|
9872
|
+
const { classes, style } = getColumnPinningStyles(column);
|
|
9873
|
+
const useColumnSizing = column.columnDef.meta?.useColumnSizing ?? columnResizing?.enabled ?? virtual?.enabled ?? false;
|
|
9874
|
+
const tableFilterCellProps = typeof components?.tableFilterCellProps === "function" ? components?.tableFilterCellProps({ column, table }) : components?.tableFilterCellProps;
|
|
9875
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9876
|
+
TableCell,
|
|
9877
|
+
{
|
|
9878
|
+
"data-testid": `table-filter-cell-${column.id}`,
|
|
9879
|
+
...tableFilterCellProps,
|
|
9880
|
+
...column.columnDef?.meta?.filterCellProps,
|
|
9881
|
+
className: cn(
|
|
9882
|
+
"bg-white border-b",
|
|
9883
|
+
classes,
|
|
9884
|
+
tableFilterCellProps?.className,
|
|
9885
|
+
column.columnDef?.meta?.filterCellProps?.className
|
|
9886
|
+
),
|
|
9887
|
+
style: {
|
|
9888
|
+
...style,
|
|
9889
|
+
width: useColumnSizing ? `calc(var(--col-${toCSSId(column.id)}-size, ${column.getSize()}) * 1px)` : void 0,
|
|
9890
|
+
minWidth: useColumnSizing ? column.columnDef.minSize : void 0,
|
|
9891
|
+
maxWidth: useColumnSizing ? column.columnDef.maxSize : void 0,
|
|
9892
|
+
...tableFilterCellProps?.style,
|
|
9893
|
+
...column.columnDef?.meta?.filterCellProps?.style
|
|
9894
|
+
},
|
|
9895
|
+
children: column.getCanFilter() && column.columnDef.meta?.renderColumnFilter?.({
|
|
9896
|
+
column,
|
|
9897
|
+
table
|
|
9898
|
+
})
|
|
9899
|
+
},
|
|
9900
|
+
column.id
|
|
9901
|
+
);
|
|
9902
|
+
}
|
|
9715
9903
|
var TableFilterRow = ({
|
|
9716
9904
|
table,
|
|
9717
9905
|
filterableColumns,
|
|
9718
9906
|
isSomeColumnsFilterable,
|
|
9719
9907
|
columnResizing,
|
|
9720
9908
|
virtual,
|
|
9909
|
+
columnVirtual,
|
|
9721
9910
|
components
|
|
9722
9911
|
}) => {
|
|
9723
9912
|
if (!isSomeColumnsFilterable) return null;
|
|
9724
|
-
|
|
9725
|
-
|
|
9726
|
-
|
|
9727
|
-
|
|
9728
|
-
|
|
9729
|
-
|
|
9730
|
-
|
|
9731
|
-
|
|
9732
|
-
|
|
9733
|
-
|
|
9734
|
-
|
|
9735
|
-
|
|
9736
|
-
|
|
9737
|
-
|
|
9738
|
-
|
|
9739
|
-
|
|
9740
|
-
|
|
9741
|
-
...style,
|
|
9742
|
-
width: useColumnSizing ? column.getSize() : void 0,
|
|
9743
|
-
minWidth: useColumnSizing ? column.columnDef.minSize : void 0,
|
|
9744
|
-
maxWidth: useColumnSizing ? column.columnDef.maxSize : void 0,
|
|
9745
|
-
...tableFilterCellProps?.style,
|
|
9746
|
-
...column.columnDef?.meta?.filterCellProps?.style
|
|
9747
|
-
},
|
|
9748
|
-
children: column.getCanFilter() && column.columnDef.meta?.renderColumnFilter?.({
|
|
9749
|
-
column,
|
|
9750
|
-
table
|
|
9751
|
-
})
|
|
9752
|
-
},
|
|
9753
|
-
column.id
|
|
9754
|
-
);
|
|
9755
|
-
}) });
|
|
9913
|
+
const cellProps = { columnResizing, virtual, components, table };
|
|
9914
|
+
if (!columnVirtual.enabled) {
|
|
9915
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TableRow, { "data-testid": "table-filter-row", children: filterableColumns.map((column) => renderFilterCell(column, cellProps)) });
|
|
9916
|
+
}
|
|
9917
|
+
const centerColumns = table.getCenterVisibleLeafColumns();
|
|
9918
|
+
const leftColumns = filterableColumns.filter((col) => col.getIsPinned() === "left");
|
|
9919
|
+
const centerFilterColumns = filterableColumns.filter((col) => !col.getIsPinned());
|
|
9920
|
+
const rightColumns = filterableColumns.filter((col) => col.getIsPinned() === "right");
|
|
9921
|
+
const centerColumnIndexMap = new Map(centerColumns.map((col, i) => [col.id, i]));
|
|
9922
|
+
const virtualIndexSet = new Set(columnVirtual.virtualColumns.map((vc) => vc.index));
|
|
9923
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(TableRow, { "data-testid": "table-filter-row", children: [
|
|
9924
|
+
leftColumns.map((column) => renderFilterCell(column, cellProps)),
|
|
9925
|
+
columnVirtual.virtualPaddingLeft > 0 && /* @__PURE__ */ jsxRuntime.jsx("td", { "aria-hidden": "true", style: { width: columnVirtual.virtualPaddingLeft } }),
|
|
9926
|
+
centerFilterColumns.filter((col) => virtualIndexSet.has(centerColumnIndexMap.get(col.id) ?? -1)).map((column) => renderFilterCell(column, cellProps)),
|
|
9927
|
+
columnVirtual.virtualPaddingRight > 0 && /* @__PURE__ */ jsxRuntime.jsx("td", { "aria-hidden": "true", style: { width: columnVirtual.virtualPaddingRight } }),
|
|
9928
|
+
rightColumns.map((column) => renderFilterCell(column, cellProps))
|
|
9929
|
+
] });
|
|
9756
9930
|
};
|
|
9931
|
+
var MemoizedTableFilterRow = React__namespace.default.memo(
|
|
9932
|
+
TableFilterRow,
|
|
9933
|
+
(_, next) => next.isResizing === true
|
|
9934
|
+
);
|
|
9757
9935
|
var TableDataRows = ({
|
|
9758
9936
|
table,
|
|
9759
9937
|
rowModel,
|
|
@@ -9765,6 +9943,7 @@ var TableDataRows = ({
|
|
|
9765
9943
|
visibleColumnCount,
|
|
9766
9944
|
columnResizing,
|
|
9767
9945
|
virtual,
|
|
9946
|
+
columnVirtual,
|
|
9768
9947
|
onRowClick,
|
|
9769
9948
|
components
|
|
9770
9949
|
}) => {
|
|
@@ -9783,6 +9962,56 @@ var TableDataRows = ({
|
|
|
9783
9962
|
if (!row) return null;
|
|
9784
9963
|
const virtualIndex = config.isVirtualize ? item.index : void 0;
|
|
9785
9964
|
const tableDataRowProps = typeof components?.tableDataRowProps === "function" ? components.tableDataRowProps({ row, table }) || {} : components?.tableDataRowProps || {};
|
|
9965
|
+
const renderCell = (cell) => {
|
|
9966
|
+
const { classes, style } = getColumnPinningStyles(cell.column);
|
|
9967
|
+
const useColumnSizing = cell.column.columnDef.meta?.useColumnSizing ?? columnResizing?.enabled ?? virtual?.enabled ?? false;
|
|
9968
|
+
const tableDataCellProps = typeof components?.tableDataCellProps === "function" ? components?.tableDataCellProps({ row, cell, table }) : components?.tableDataCellProps;
|
|
9969
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9970
|
+
TableCell,
|
|
9971
|
+
{
|
|
9972
|
+
"data-testid": `table-data-cell-${cell.id}`,
|
|
9973
|
+
"data-row-id": row.id,
|
|
9974
|
+
"data-column-id": cell.column.id,
|
|
9975
|
+
...tableDataCellProps,
|
|
9976
|
+
...cell.column.columnDef?.meta?.cellProps,
|
|
9977
|
+
className: cn(
|
|
9978
|
+
{
|
|
9979
|
+
"bg-[#dfeae3]": row.getIsSelected(),
|
|
9980
|
+
"bg-white group-hover:bg-sus-primary-3-hover transition-colors duration-150": !row.getIsSelected()
|
|
9981
|
+
},
|
|
9982
|
+
classes,
|
|
9983
|
+
tableDataCellProps?.className,
|
|
9984
|
+
cell.column.columnDef?.meta?.cellProps?.className
|
|
9985
|
+
),
|
|
9986
|
+
style: {
|
|
9987
|
+
...style,
|
|
9988
|
+
width: useColumnSizing ? `calc(var(--col-${toCSSId(cell.column.id)}-size, ${cell.column.getSize()}) * 1px)` : void 0,
|
|
9989
|
+
minWidth: useColumnSizing ? cell.column.columnDef.minSize : void 0,
|
|
9990
|
+
maxWidth: useColumnSizing ? cell.column.columnDef.maxSize : void 0,
|
|
9991
|
+
...tableDataCellProps?.style,
|
|
9992
|
+
...cell.column.columnDef?.meta?.cellProps?.style
|
|
9993
|
+
},
|
|
9994
|
+
children: reactTable.flexRender(cell.column.columnDef.cell, cell.getContext())
|
|
9995
|
+
},
|
|
9996
|
+
cell.id
|
|
9997
|
+
);
|
|
9998
|
+
};
|
|
9999
|
+
const rowContent = columnVirtual.enabled ? (() => {
|
|
10000
|
+
const leftCells = row.getLeftVisibleCells();
|
|
10001
|
+
const centerCells = row.getCenterVisibleCells();
|
|
10002
|
+
const rightCells = row.getRightVisibleCells();
|
|
10003
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
10004
|
+
leftCells.map(renderCell),
|
|
10005
|
+
columnVirtual.virtualPaddingLeft > 0 && /* @__PURE__ */ jsxRuntime.jsx("td", { "aria-hidden": "true", style: { width: columnVirtual.virtualPaddingLeft } }),
|
|
10006
|
+
columnVirtual.virtualColumns.map((vc) => {
|
|
10007
|
+
const cell = centerCells[vc.index];
|
|
10008
|
+
if (!cell) return null;
|
|
10009
|
+
return renderCell(cell);
|
|
10010
|
+
}),
|
|
10011
|
+
columnVirtual.virtualPaddingRight > 0 && /* @__PURE__ */ jsxRuntime.jsx("td", { "aria-hidden": "true", style: { width: columnVirtual.virtualPaddingRight } }),
|
|
10012
|
+
rightCells.map(renderCell)
|
|
10013
|
+
] });
|
|
10014
|
+
})() : row.getVisibleCells().map(renderCell);
|
|
9786
10015
|
return /* @__PURE__ */ React.createElement(
|
|
9787
10016
|
TableRow,
|
|
9788
10017
|
{
|
|
@@ -9800,40 +10029,7 @@ var TableDataRows = ({
|
|
|
9800
10029
|
table
|
|
9801
10030
|
})
|
|
9802
10031
|
},
|
|
9803
|
-
|
|
9804
|
-
const { classes, style } = getColumnPinningStyles(cell.column);
|
|
9805
|
-
const useColumnSizing = cell.column.columnDef.meta?.useColumnSizing ?? columnResizing?.enabled ?? virtual?.enabled ?? false;
|
|
9806
|
-
const tableDataCellProps = typeof components?.tableDataCellProps === "function" ? components?.tableDataCellProps({ row, cell, table }) : components?.tableDataCellProps;
|
|
9807
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9808
|
-
TableCell,
|
|
9809
|
-
{
|
|
9810
|
-
"data-testid": `table-data-cell-${cell.id}`,
|
|
9811
|
-
"data-row-id": row.id,
|
|
9812
|
-
"data-column-id": cell.column.id,
|
|
9813
|
-
...tableDataCellProps,
|
|
9814
|
-
...cell.column.columnDef?.meta?.cellProps,
|
|
9815
|
-
className: cn(
|
|
9816
|
-
{
|
|
9817
|
-
"bg-[#dfeae3]": row.getIsSelected(),
|
|
9818
|
-
"bg-white group-hover:bg-sus-primary-3-hover": !row.getIsSelected()
|
|
9819
|
-
},
|
|
9820
|
-
classes,
|
|
9821
|
-
tableDataCellProps?.className,
|
|
9822
|
-
cell.column.columnDef?.meta?.cellProps?.className
|
|
9823
|
-
),
|
|
9824
|
-
style: {
|
|
9825
|
-
...style,
|
|
9826
|
-
width: useColumnSizing ? cell.column.getSize() : void 0,
|
|
9827
|
-
minWidth: useColumnSizing ? cell.column.columnDef.minSize : void 0,
|
|
9828
|
-
maxWidth: useColumnSizing ? cell.column.columnDef.maxSize : void 0,
|
|
9829
|
-
...tableDataCellProps?.style,
|
|
9830
|
-
...cell.column.columnDef?.meta?.cellProps?.style
|
|
9831
|
-
},
|
|
9832
|
-
children: reactTable.flexRender(cell.column.columnDef.cell, cell.getContext())
|
|
9833
|
-
},
|
|
9834
|
-
cell.id
|
|
9835
|
-
);
|
|
9836
|
-
})
|
|
10032
|
+
rowContent
|
|
9837
10033
|
);
|
|
9838
10034
|
}),
|
|
9839
10035
|
virtualEnabled && paddingBottom > 0 && /* @__PURE__ */ jsxRuntime.jsx(TableRow, { "aria-hidden": "true", "data-testid": "table-virtual-padding-bottom", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -9846,66 +10042,163 @@ var TableDataRows = ({
|
|
|
9846
10042
|
) })
|
|
9847
10043
|
] });
|
|
9848
10044
|
};
|
|
10045
|
+
var MemoizedTableDataRows = React__namespace.default.memo(
|
|
10046
|
+
TableDataRows,
|
|
10047
|
+
(_, next) => next.isResizing === true
|
|
10048
|
+
);
|
|
10049
|
+
function renderFooterCell(footer, footerGroup, {
|
|
10050
|
+
columnResizing,
|
|
10051
|
+
virtual,
|
|
10052
|
+
components,
|
|
10053
|
+
table
|
|
10054
|
+
}, rowSpan) {
|
|
10055
|
+
const { classes, style } = getColumnPinningStyles(footer.column);
|
|
10056
|
+
const useColumnSizing = footer.column.columnDef?.meta?.useColumnSizing ?? columnResizing?.enabled ?? virtual?.enabled ?? false;
|
|
10057
|
+
const tableFooterCellProps = typeof components?.tableFooterCellProps === "function" ? components.tableFooterCellProps({ footer, table }) : components?.tableFooterCellProps;
|
|
10058
|
+
const nextFooter = footerGroup.headers[footer.index + 1] ?? footer;
|
|
10059
|
+
const { isLastLeftPinnedColumn } = getColumnPinningInfo(footer.column);
|
|
10060
|
+
const { isFirstRightPinnedColumn } = getColumnPinningInfo(nextFooter.column);
|
|
10061
|
+
const footerGroupLength = footerGroup.headers.length;
|
|
10062
|
+
const showSeparator = footer.index !== footerGroupLength - 1 && !isLastLeftPinnedColumn && !isFirstRightPinnedColumn && (!footer.isPlaceholder || !nextFooter.isPlaceholder);
|
|
10063
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10064
|
+
TableHead,
|
|
10065
|
+
{
|
|
10066
|
+
"data-testid": `footer-cell-${footer.id}`,
|
|
10067
|
+
colSpan: footer.colSpan,
|
|
10068
|
+
rowSpan,
|
|
10069
|
+
...tableFooterCellProps,
|
|
10070
|
+
...footer.column.columnDef?.meta?.footerProps,
|
|
10071
|
+
className: cn(
|
|
10072
|
+
classes,
|
|
10073
|
+
tableFooterCellProps?.className,
|
|
10074
|
+
footer.column.columnDef?.meta?.footerProps?.className
|
|
10075
|
+
),
|
|
10076
|
+
style: {
|
|
10077
|
+
...style,
|
|
10078
|
+
width: useColumnSizing ? `calc(var(--col-${toCSSId(footer.column.id)}-size, ${footer.column.getSize()}) * 1px)` : void 0,
|
|
10079
|
+
minWidth: useColumnSizing ? footer.column.columnDef.minSize : void 0,
|
|
10080
|
+
maxWidth: useColumnSizing ? footer.column.columnDef.maxSize : void 0,
|
|
10081
|
+
...tableFooterCellProps?.style,
|
|
10082
|
+
...footer.column.columnDef?.meta?.footerProps?.style
|
|
10083
|
+
},
|
|
10084
|
+
children: [
|
|
10085
|
+
footer.isPlaceholder ? null : reactTable.flexRender(footer.column.columnDef.footer, footer.getContext()),
|
|
10086
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10087
|
+
ColumnSeparator_default,
|
|
10088
|
+
{
|
|
10089
|
+
...components?.columnSeparatorProps?.headerCell,
|
|
10090
|
+
...footer.column.columnDef?.meta?.columnSeparatorProps,
|
|
10091
|
+
show: footer.column.columnDef?.meta?.columnSeparatorProps?.show ?? components?.columnSeparatorProps?.headerCell?.show ?? showSeparator
|
|
10092
|
+
}
|
|
10093
|
+
),
|
|
10094
|
+
!footer.isPlaceholder && /* @__PURE__ */ jsxRuntime.jsx(ColumnResizer_default, { header: footer, ...components?.columnResizerProps })
|
|
10095
|
+
]
|
|
10096
|
+
},
|
|
10097
|
+
footer.id
|
|
10098
|
+
);
|
|
10099
|
+
}
|
|
9849
10100
|
var TableFooterRows = ({
|
|
9850
10101
|
table,
|
|
9851
10102
|
columnResizing,
|
|
9852
|
-
|
|
9853
|
-
|
|
10103
|
+
virtual,
|
|
10104
|
+
columnVirtual,
|
|
10105
|
+
components
|
|
9854
10106
|
}) => {
|
|
9855
|
-
const
|
|
9856
|
-
|
|
9857
|
-
|
|
10107
|
+
const cellProps = { columnResizing, virtual, components, table };
|
|
10108
|
+
const centerLeafCols = columnVirtual.enabled ? table.getCenterVisibleLeafColumns() : [];
|
|
10109
|
+
const totalFooterGroups = table.getFooterGroups().length;
|
|
10110
|
+
const spannedIds = /* @__PURE__ */ new Set();
|
|
10111
|
+
const resolveFooterCell = (footer, footerGroup, groupIndex) => {
|
|
10112
|
+
if (spannedIds.has(footer.column.id)) return null;
|
|
10113
|
+
const remainingRows = totalFooterGroups - groupIndex;
|
|
10114
|
+
if (!footer.isPlaceholder && footer.column.columnDef.meta?.spanRows && remainingRows > 1) {
|
|
10115
|
+
spannedIds.add(footer.column.id);
|
|
10116
|
+
return renderFooterCell(footer, footerGroup, cellProps, remainingRows);
|
|
10117
|
+
}
|
|
10118
|
+
return renderFooterCell(footer, footerGroup, cellProps);
|
|
10119
|
+
};
|
|
10120
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: table.getFooterGroups().map((footerGroup, groupIndex) => {
|
|
9858
10121
|
const tableFooterRowProps = typeof components?.tableFooterRowProps === "function" ? components.tableFooterRowProps({ footerGroup, table }) : components?.tableFooterRowProps;
|
|
9859
|
-
|
|
9860
|
-
|
|
9861
|
-
|
|
9862
|
-
|
|
9863
|
-
|
|
9864
|
-
|
|
9865
|
-
|
|
9866
|
-
|
|
9867
|
-
|
|
9868
|
-
|
|
9869
|
-
|
|
9870
|
-
{
|
|
9871
|
-
|
|
9872
|
-
|
|
9873
|
-
|
|
9874
|
-
|
|
9875
|
-
|
|
9876
|
-
|
|
9877
|
-
|
|
9878
|
-
|
|
9879
|
-
|
|
9880
|
-
|
|
9881
|
-
|
|
9882
|
-
|
|
9883
|
-
|
|
9884
|
-
|
|
9885
|
-
|
|
9886
|
-
|
|
9887
|
-
|
|
9888
|
-
|
|
9889
|
-
|
|
9890
|
-
|
|
9891
|
-
|
|
9892
|
-
|
|
9893
|
-
|
|
9894
|
-
|
|
9895
|
-
|
|
9896
|
-
|
|
10122
|
+
if (!columnVirtual.enabled) {
|
|
10123
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TableRow, { ...tableFooterRowProps, children: footerGroup.headers.map((footer) => resolveFooterCell(footer, footerGroup, groupIndex)) }, footerGroup.id);
|
|
10124
|
+
}
|
|
10125
|
+
const leftFooters = table.getLeftFooterGroups()[groupIndex]?.headers ?? [];
|
|
10126
|
+
const centerFooters = table.getCenterFooterGroups()[groupIndex]?.headers ?? [];
|
|
10127
|
+
const rightFooters = table.getRightFooterGroups()[groupIndex]?.headers ?? [];
|
|
10128
|
+
const isLeafLevel = !centerFooters[0] || centerFooters[0].subHeaders.length === 0;
|
|
10129
|
+
if (isLeafLevel) {
|
|
10130
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(TableRow, { ...tableFooterRowProps, children: [
|
|
10131
|
+
leftFooters.map((footer) => resolveFooterCell(footer, footerGroup, groupIndex)),
|
|
10132
|
+
columnVirtual.virtualPaddingLeft > 0 && /* @__PURE__ */ jsxRuntime.jsx("th", { "aria-hidden": "true", style: { width: columnVirtual.virtualPaddingLeft } }),
|
|
10133
|
+
columnVirtual.virtualColumns.map((vc) => {
|
|
10134
|
+
const footer = centerFooters[vc.index];
|
|
10135
|
+
if (!footer) return null;
|
|
10136
|
+
return renderFooterCell(footer, footerGroup, cellProps);
|
|
10137
|
+
}),
|
|
10138
|
+
columnVirtual.virtualPaddingRight > 0 && /* @__PURE__ */ jsxRuntime.jsx("th", { "aria-hidden": "true", style: { width: columnVirtual.virtualPaddingRight } }),
|
|
10139
|
+
rightFooters.map((footer) => resolveFooterCell(footer, footerGroup, groupIndex))
|
|
10140
|
+
] }, footerGroup.id);
|
|
10141
|
+
}
|
|
10142
|
+
const leafToGroupIdx = [];
|
|
10143
|
+
let leafRunning = 0;
|
|
10144
|
+
for (let gi = 0; gi < centerFooters.length; gi++) {
|
|
10145
|
+
for (let i = 0; i < centerFooters[gi].colSpan; i++) {
|
|
10146
|
+
leafToGroupIdx[leafRunning + i] = gi;
|
|
10147
|
+
}
|
|
10148
|
+
leafRunning += centerFooters[gi].colSpan;
|
|
10149
|
+
}
|
|
10150
|
+
const virtualCols = columnVirtual.virtualColumns;
|
|
10151
|
+
const useColumnSizing = columnResizing?.enabled ?? virtual?.enabled ?? false;
|
|
10152
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(TableRow, { ...tableFooterRowProps, children: [
|
|
10153
|
+
leftFooters.map((footer) => resolveFooterCell(footer, footerGroup, groupIndex)),
|
|
10154
|
+
columnVirtual.virtualPaddingLeft > 0 && /* @__PURE__ */ jsxRuntime.jsx("th", { "aria-hidden": "true", style: { width: columnVirtual.virtualPaddingLeft } }),
|
|
10155
|
+
virtualCols.map((vc, vcIdx) => {
|
|
10156
|
+
const gi = leafToGroupIdx[vc.index];
|
|
10157
|
+
if (gi === void 0) return null;
|
|
10158
|
+
const groupFooter = centerFooters[gi];
|
|
10159
|
+
const leafCol = centerLeafCols[vc.index];
|
|
10160
|
+
const isFirst = vcIdx === 0 || leafToGroupIdx[virtualCols[vcIdx - 1].index] !== gi;
|
|
10161
|
+
const isLast = vcIdx === virtualCols.length - 1 || leafToGroupIdx[virtualCols[vcIdx + 1].index] !== gi;
|
|
10162
|
+
const { classes, style } = getColumnPinningStyles(groupFooter.column);
|
|
10163
|
+
const tableFooterCellProps = typeof components?.tableFooterCellProps === "function" ? components.tableFooterCellProps({ footer: groupFooter, table }) : components?.tableFooterCellProps;
|
|
10164
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10165
|
+
TableHead,
|
|
10166
|
+
{
|
|
10167
|
+
colSpan: 1,
|
|
10168
|
+
...tableFooterCellProps,
|
|
10169
|
+
...groupFooter.column.columnDef?.meta?.footerProps,
|
|
10170
|
+
className: cn(
|
|
10171
|
+
classes,
|
|
10172
|
+
tableFooterCellProps?.className,
|
|
10173
|
+
groupFooter.column.columnDef?.meta?.footerProps?.className
|
|
9897
10174
|
),
|
|
9898
|
-
|
|
9899
|
-
|
|
9900
|
-
|
|
9901
|
-
|
|
9902
|
-
|
|
9903
|
-
|
|
10175
|
+
style: {
|
|
10176
|
+
...style,
|
|
10177
|
+
width: useColumnSizing ? `calc(var(--col-${toCSSId(leafCol.id)}-size, ${leafCol.getSize()}) * 1px)` : void 0,
|
|
10178
|
+
...tableFooterCellProps?.style,
|
|
10179
|
+
...groupFooter.column.columnDef?.meta?.footerProps?.style
|
|
10180
|
+
},
|
|
10181
|
+
children: [
|
|
10182
|
+
isFirst && !groupFooter.isPlaceholder ? reactTable.flexRender(groupFooter.column.columnDef.footer, groupFooter.getContext()) : null,
|
|
10183
|
+
/* @__PURE__ */ jsxRuntime.jsx(ColumnSeparator_default, { ...components?.columnSeparatorProps?.headerCell, show: isLast })
|
|
10184
|
+
]
|
|
10185
|
+
},
|
|
10186
|
+
`${groupFooter.id}-${leafCol.id}`
|
|
10187
|
+
);
|
|
10188
|
+
}),
|
|
10189
|
+
columnVirtual.virtualPaddingRight > 0 && /* @__PURE__ */ jsxRuntime.jsx("th", { "aria-hidden": "true", style: { width: columnVirtual.virtualPaddingRight } }),
|
|
10190
|
+
rightFooters.map((footer) => resolveFooterCell(footer, footerGroup, groupIndex))
|
|
10191
|
+
] }, footerGroup.id);
|
|
9904
10192
|
}) });
|
|
9905
10193
|
};
|
|
10194
|
+
var MemoizedTableFooterRows = React__namespace.default.memo(
|
|
10195
|
+
TableFooterRows,
|
|
10196
|
+
(_, next) => next.isResizing === true
|
|
10197
|
+
);
|
|
9906
10198
|
var DataTable = ({
|
|
9907
10199
|
tableRef,
|
|
9908
10200
|
virtualizerRef,
|
|
10201
|
+
columnVirtualizerRef,
|
|
9909
10202
|
isInitialLoading,
|
|
9910
10203
|
columns,
|
|
9911
10204
|
data,
|
|
@@ -9945,7 +10238,15 @@ var DataTable = ({
|
|
|
9945
10238
|
rowIdKey,
|
|
9946
10239
|
childrenKey
|
|
9947
10240
|
});
|
|
9948
|
-
const {
|
|
10241
|
+
const {
|
|
10242
|
+
virtualizer,
|
|
10243
|
+
columnVirtualizer,
|
|
10244
|
+
virtualItems,
|
|
10245
|
+
paddingTop,
|
|
10246
|
+
paddingBottom,
|
|
10247
|
+
rowModel,
|
|
10248
|
+
columnVirtual
|
|
10249
|
+
} = useTableVirtualizer({
|
|
9949
10250
|
enabled: virtualEnabled,
|
|
9950
10251
|
table,
|
|
9951
10252
|
containerRef: tableContainerRef,
|
|
@@ -9959,8 +10260,28 @@ var DataTable = ({
|
|
|
9959
10260
|
activeStatusContent
|
|
9960
10261
|
});
|
|
9961
10262
|
const fetchMoreOnScrollReached = useScrollFetch({ scrollFetch, containerRef: tableContainerRef });
|
|
10263
|
+
const columnResizingEnabled = columnResizing?.enabled;
|
|
10264
|
+
const { columnSizing, columnSizingInfo } = table.getState();
|
|
10265
|
+
const columnSizeVars = React.useMemo(() => {
|
|
10266
|
+
if (!columnResizingEnabled && !virtualEnabled) return {};
|
|
10267
|
+
const headers = table.getFlatHeaders();
|
|
10268
|
+
const colSizes = {};
|
|
10269
|
+
for (const header of headers) {
|
|
10270
|
+
colSizes[`--header-${toCSSId(header.id)}-size`] = header.getSize();
|
|
10271
|
+
colSizes[`--col-${toCSSId(header.column.id)}-size`] = header.column.getSize();
|
|
10272
|
+
if (header.column.getIsPinned() === "left") {
|
|
10273
|
+
colSizes[`--col-${toCSSId(header.column.id)}-pin-start`] = header.column.getStart("left");
|
|
10274
|
+
} else if (header.column.getIsPinned() === "right") {
|
|
10275
|
+
colSizes[`--col-${toCSSId(header.column.id)}-pin-after`] = header.column.getAfter("right");
|
|
10276
|
+
}
|
|
10277
|
+
}
|
|
10278
|
+
return colSizes;
|
|
10279
|
+
}, [columnSizing, columnSizingInfo, columnResizingEnabled, virtualEnabled]);
|
|
10280
|
+
const isResizing = !columnVirtual.enabled && (columnResizingEnabled ?? false) && !!columnSizingInfo.isResizingColumn;
|
|
10281
|
+
const hasAnyFooter = table.getAllColumns().some((col) => col.columnDef.footer != null);
|
|
9962
10282
|
useBindRef_default({ ref: tableRef, value: table });
|
|
9963
10283
|
useBindRef_default({ ref: virtualizerRef, value: virtualizer });
|
|
10284
|
+
useBindRef_default({ ref: columnVirtualizerRef, value: columnVirtualizer });
|
|
9964
10285
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9965
10286
|
TableContainer,
|
|
9966
10287
|
{
|
|
@@ -9996,44 +10317,53 @@ var DataTable = ({
|
|
|
9996
10317
|
},
|
|
9997
10318
|
defaultIcon: /* @__PURE__ */ jsxRuntime.jsx(SuiEmptyDataIcon, { size: 128 })
|
|
9998
10319
|
}
|
|
9999
|
-
) : /* @__PURE__ */ jsxRuntime.
|
|
10000
|
-
|
|
10001
|
-
|
|
10002
|
-
|
|
10003
|
-
|
|
10004
|
-
|
|
10005
|
-
|
|
10006
|
-
|
|
10007
|
-
|
|
10008
|
-
|
|
10009
|
-
|
|
10010
|
-
|
|
10011
|
-
|
|
10012
|
-
|
|
10013
|
-
|
|
10014
|
-
|
|
10015
|
-
|
|
10016
|
-
|
|
10017
|
-
|
|
10018
|
-
|
|
10019
|
-
|
|
10020
|
-
|
|
10021
|
-
|
|
10022
|
-
|
|
10023
|
-
|
|
10024
|
-
|
|
10025
|
-
|
|
10026
|
-
|
|
10027
|
-
|
|
10028
|
-
|
|
10029
|
-
|
|
10030
|
-
|
|
10031
|
-
|
|
10032
|
-
|
|
10033
|
-
|
|
10034
|
-
|
|
10035
|
-
|
|
10036
|
-
|
|
10320
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10321
|
+
Table,
|
|
10322
|
+
{
|
|
10323
|
+
...components?.tableProps,
|
|
10324
|
+
style: {
|
|
10325
|
+
tableLayout: virtualEnabled ? "fixed" : "auto",
|
|
10326
|
+
minWidth: columnVirtual.enabled ? `${table.getTotalSize()}px` : void 0,
|
|
10327
|
+
...components?.tableProps?.style,
|
|
10328
|
+
...columnSizeVars
|
|
10329
|
+
},
|
|
10330
|
+
children: [
|
|
10331
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
10332
|
+
TableHeader,
|
|
10333
|
+
{
|
|
10334
|
+
className: cn("sticky top-0 z-10 bg-white", components?.tableHeaderProps?.className),
|
|
10335
|
+
...components?.tableHeaderProps,
|
|
10336
|
+
children: [
|
|
10337
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10338
|
+
MemoizedTableHeaderRows,
|
|
10339
|
+
{
|
|
10340
|
+
table,
|
|
10341
|
+
columnResizing,
|
|
10342
|
+
virtual,
|
|
10343
|
+
columnVirtual,
|
|
10344
|
+
components,
|
|
10345
|
+
isResizing
|
|
10346
|
+
}
|
|
10347
|
+
),
|
|
10348
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10349
|
+
MemoizedTableFilterRow,
|
|
10350
|
+
{
|
|
10351
|
+
table,
|
|
10352
|
+
filterableColumns,
|
|
10353
|
+
isSomeColumnsFilterable,
|
|
10354
|
+
columnResizing,
|
|
10355
|
+
virtual,
|
|
10356
|
+
columnVirtual,
|
|
10357
|
+
components,
|
|
10358
|
+
isResizing
|
|
10359
|
+
}
|
|
10360
|
+
)
|
|
10361
|
+
]
|
|
10362
|
+
}
|
|
10363
|
+
),
|
|
10364
|
+
/* @__PURE__ */ jsxRuntime.jsxs(TableBody, { ...components?.tableBodyProps, children: [
|
|
10365
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10366
|
+
MemoizedTableDataRows,
|
|
10037
10367
|
{
|
|
10038
10368
|
table,
|
|
10039
10369
|
rowModel,
|
|
@@ -10045,66 +10375,70 @@ var DataTable = ({
|
|
|
10045
10375
|
visibleColumnCount,
|
|
10046
10376
|
columnResizing,
|
|
10047
10377
|
virtual,
|
|
10378
|
+
columnVirtual,
|
|
10048
10379
|
onRowClick,
|
|
10049
|
-
components
|
|
10380
|
+
components,
|
|
10381
|
+
isResizing
|
|
10050
10382
|
}
|
|
10051
|
-
)
|
|
10052
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10053
|
-
|
|
10383
|
+
),
|
|
10384
|
+
activeStatusContentComputed === "emptyFilteredData" && /* @__PURE__ */ jsxRuntime.jsx(TableRow, { "data-testid": "status-row-empty-filtered-data", children: /* @__PURE__ */ jsxRuntime.jsx(TableCell, { colSpan: visibleColumnCount, className: "border-b-0 p-0", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10385
|
+
StatusContentSlot_default,
|
|
10054
10386
|
{
|
|
10055
|
-
|
|
10056
|
-
|
|
10057
|
-
|
|
10058
|
-
|
|
10059
|
-
|
|
10060
|
-
|
|
10061
|
-
|
|
10062
|
-
|
|
10063
|
-
components
|
|
10064
|
-
}
|
|
10065
|
-
)
|
|
10387
|
+
content: statusContent?.emptyFilteredData?.content ?? "No records found. Please try a different search.",
|
|
10388
|
+
icon: statusContent?.emptyFilteredData?.icon,
|
|
10389
|
+
wrapperProps: statusContent?.emptyFilteredData?.wrapperProps,
|
|
10390
|
+
defaultWrapperProps: {
|
|
10391
|
+
className: "flex flex-col items-center justify-center text-sm py-4 gap-2",
|
|
10392
|
+
["data-testid"]: "status-content-empty-filtered-data"
|
|
10393
|
+
},
|
|
10394
|
+
defaultIcon: /* @__PURE__ */ jsxRuntime.jsx(SuiEmptyDataIcon, { size: 128 })
|
|
10066
10395
|
}
|
|
10067
|
-
)
|
|
10068
|
-
|
|
10069
|
-
|
|
10070
|
-
|
|
10071
|
-
|
|
10072
|
-
|
|
10073
|
-
|
|
10074
|
-
|
|
10075
|
-
|
|
10076
|
-
|
|
10077
|
-
|
|
10078
|
-
|
|
10079
|
-
|
|
10080
|
-
|
|
10081
|
-
|
|
10082
|
-
|
|
10083
|
-
|
|
10084
|
-
|
|
10085
|
-
|
|
10086
|
-
|
|
10087
|
-
|
|
10088
|
-
|
|
10089
|
-
|
|
10090
|
-
|
|
10091
|
-
|
|
10092
|
-
|
|
10093
|
-
|
|
10094
|
-
|
|
10095
|
-
|
|
10096
|
-
|
|
10097
|
-
|
|
10098
|
-
|
|
10099
|
-
|
|
10100
|
-
|
|
10101
|
-
|
|
10102
|
-
|
|
10103
|
-
|
|
10104
|
-
|
|
10105
|
-
|
|
10106
|
-
|
|
10107
|
-
|
|
10396
|
+
) }) }),
|
|
10397
|
+
activeStatusContentComputed === "fetchingMore" && /* @__PURE__ */ jsxRuntime.jsx(TableRow, { "data-testid": "status-row-fetching-more", children: /* @__PURE__ */ jsxRuntime.jsx(TableCell, { colSpan: visibleColumnCount, className: "border-b-0 p-0", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10398
|
+
StatusContentSlot_default,
|
|
10399
|
+
{
|
|
10400
|
+
content: statusContent?.fetchingMore?.content ?? "Loading more...",
|
|
10401
|
+
wrapperProps: statusContent?.fetchingMore?.wrapperProps,
|
|
10402
|
+
defaultWrapperProps: {
|
|
10403
|
+
className: "flex flex-col items-center justify-center text-sm py-4 gap-2",
|
|
10404
|
+
["data-testid"]: "status-content-fetching-more"
|
|
10405
|
+
}
|
|
10406
|
+
}
|
|
10407
|
+
) }) }),
|
|
10408
|
+
activeStatusContentComputed === "noMoreData" && /* @__PURE__ */ jsxRuntime.jsx(TableRow, { "data-testid": "status-row-no-more-data", children: /* @__PURE__ */ jsxRuntime.jsx(TableCell, { colSpan: visibleColumnCount, className: "border-b-0 p-0", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10409
|
+
StatusContentSlot_default,
|
|
10410
|
+
{
|
|
10411
|
+
content: statusContent?.noMoreData?.content,
|
|
10412
|
+
icon: statusContent?.noMoreData?.icon,
|
|
10413
|
+
wrapperProps: statusContent?.noMoreData?.wrapperProps,
|
|
10414
|
+
defaultWrapperProps: {
|
|
10415
|
+
className: "flex flex-col items-center justify-center text-sm py-4 gap-2",
|
|
10416
|
+
["data-testid"]: "status-content-no-more-data"
|
|
10417
|
+
}
|
|
10418
|
+
}
|
|
10419
|
+
) }) })
|
|
10420
|
+
] }),
|
|
10421
|
+
hasAnyFooter && /* @__PURE__ */ jsxRuntime.jsx(
|
|
10422
|
+
TableFooter,
|
|
10423
|
+
{
|
|
10424
|
+
...components?.tableFooterProps,
|
|
10425
|
+
className: cn("sticky bottom-0 z-10 bg-white", components?.tableFooterProps?.className),
|
|
10426
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10427
|
+
MemoizedTableFooterRows,
|
|
10428
|
+
{
|
|
10429
|
+
table,
|
|
10430
|
+
columnResizing,
|
|
10431
|
+
virtual,
|
|
10432
|
+
columnVirtual,
|
|
10433
|
+
components,
|
|
10434
|
+
isResizing
|
|
10435
|
+
}
|
|
10436
|
+
)
|
|
10437
|
+
}
|
|
10438
|
+
)
|
|
10439
|
+
]
|
|
10440
|
+
}
|
|
10441
|
+
) }),
|
|
10108
10442
|
debug && /* @__PURE__ */ jsxRuntime.jsx(DataTableDevTool_default, { table })
|
|
10109
10443
|
]
|
|
10110
10444
|
}
|