@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.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import React__default, { forwardRef, memo, isValidElement, useMemo, useRef, useEffect, useCallback, useLayoutEffect, useState
|
|
2
|
+
import React__default, { forwardRef, memo, createElement, isValidElement, useMemo, useRef, useEffect, useCallback, useLayoutEffect, useState } from 'react';
|
|
3
3
|
import { useRouter } from '@tanstack/react-router';
|
|
4
4
|
import { create } from 'zustand';
|
|
5
5
|
import clsx2, { clsx } from 'clsx';
|
|
@@ -23,7 +23,7 @@ import { useVirtualizer } from '@tanstack/react-virtual';
|
|
|
23
23
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
24
24
|
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
25
25
|
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
|
|
26
|
-
import { reSplitAlphaNumeric, useReactTable, getCoreRowModel, getGroupedRowModel, getExpandedRowModel, getSortedRowModel, getFilteredRowModel
|
|
26
|
+
import { flexRender, reSplitAlphaNumeric, useReactTable, getCoreRowModel, getGroupedRowModel, getExpandedRowModel, getSortedRowModel, getFilteredRowModel } from '@tanstack/react-table';
|
|
27
27
|
import { initReactI18next, useTranslation, I18nextProvider } from 'react-i18next';
|
|
28
28
|
import i18n from 'i18next';
|
|
29
29
|
import StarterKit from '@tiptap/starter-kit';
|
|
@@ -8977,7 +8977,7 @@ var HeaderCell = ({
|
|
|
8977
8977
|
{
|
|
8978
8978
|
ref,
|
|
8979
8979
|
className: cn(
|
|
8980
|
-
"flex items-center justify-between gap-2",
|
|
8980
|
+
"flex items-center justify-between gap-2 h-full",
|
|
8981
8981
|
{
|
|
8982
8982
|
"cursor-pointer": context?.column?.getCanSort()
|
|
8983
8983
|
},
|
|
@@ -9005,13 +9005,17 @@ var HeaderCell = ({
|
|
|
9005
9005
|
showSorter && /* @__PURE__ */ jsxs(
|
|
9006
9006
|
"div",
|
|
9007
9007
|
{
|
|
9008
|
-
className:
|
|
9008
|
+
className: cn(
|
|
9009
|
+
"flex flex-col -space-y-2 transition-opacity duration-150",
|
|
9010
|
+
sorterProps?.rootClassName
|
|
9011
|
+
),
|
|
9012
|
+
style: { opacity: hovering || !!context.column.getIsSorted() ? 1 : 0.35 },
|
|
9009
9013
|
title: context.column.getCanSort() ? context.column.getNextSortingOrder() === "asc" ? "Sort ascending" : context.column.getNextSortingOrder() === "desc" ? "Sort descending" : "Clear sort" : void 0,
|
|
9010
9014
|
children: [
|
|
9011
9015
|
/* @__PURE__ */ jsx(
|
|
9012
9016
|
ChevronUp,
|
|
9013
9017
|
{
|
|
9014
|
-
className: cn("stroke-[#BBBBBB]", {
|
|
9018
|
+
className: cn("stroke-[#BBBBBB] transition-colors duration-200", {
|
|
9015
9019
|
"stroke-sus-gray-5": context?.column?.getIsSorted() === "asc",
|
|
9016
9020
|
"stroke-sus-gray-5/45": context?.column?.getNextSortingOrder() === "asc" && hovering
|
|
9017
9021
|
}),
|
|
@@ -9022,7 +9026,7 @@ var HeaderCell = ({
|
|
|
9022
9026
|
/* @__PURE__ */ jsx(
|
|
9023
9027
|
ChevronDown,
|
|
9024
9028
|
{
|
|
9025
|
-
className: cn("stroke-[#BBBBBB]", {
|
|
9029
|
+
className: cn("stroke-[#BBBBBB] transition-colors duration-200", {
|
|
9026
9030
|
"stroke-sus-gray-5": context?.column?.getIsSorted() === "desc",
|
|
9027
9031
|
"stroke-sus-gray-5/45": context?.column?.getNextSortingOrder() === "desc" && hovering
|
|
9028
9032
|
}),
|
|
@@ -9098,7 +9102,7 @@ function TableHead({ className, ...props }) {
|
|
|
9098
9102
|
{
|
|
9099
9103
|
"data-slot": "table-head",
|
|
9100
9104
|
className: cn(
|
|
9101
|
-
"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",
|
|
9105
|
+
"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",
|
|
9102
9106
|
className
|
|
9103
9107
|
),
|
|
9104
9108
|
...props
|
|
@@ -9457,8 +9461,13 @@ var useScrollFetch = ({ scrollFetch, containerRef }) => {
|
|
|
9457
9461
|
}, [fetchMoreOnScrollReached, containerRef]);
|
|
9458
9462
|
return fetchMoreOnScrollReached;
|
|
9459
9463
|
};
|
|
9464
|
+
|
|
9465
|
+
// src/components/data-table/constants.ts
|
|
9460
9466
|
var DEFAULT_ROW_HEIGHT = 40;
|
|
9461
9467
|
var DEFAULT_OVER_SCAN = 10;
|
|
9468
|
+
var DEFAULT_COLUMN_OVERSCAN = 1;
|
|
9469
|
+
|
|
9470
|
+
// src/components/data-table/hooks/useTableVirtualizer.ts
|
|
9462
9471
|
var useTableVirtualizer = ({
|
|
9463
9472
|
enabled,
|
|
9464
9473
|
table,
|
|
@@ -9466,23 +9475,50 @@ var useTableVirtualizer = ({
|
|
|
9466
9475
|
virtual
|
|
9467
9476
|
}) => {
|
|
9468
9477
|
const rowModel = table.getRowModel().rows;
|
|
9478
|
+
const columnsEnabled = virtual?.columns?.enabled ?? false;
|
|
9479
|
+
const centerColumns = table.getCenterVisibleLeafColumns();
|
|
9480
|
+
const getRowVirtualItemKey = useCallback((index) => rowModel[index]?.id ?? index, [rowModel]);
|
|
9481
|
+
const getColumnVirtualItemKey = useCallback(
|
|
9482
|
+
(index) => centerColumns[index]?.id ?? index,
|
|
9483
|
+
[centerColumns]
|
|
9484
|
+
);
|
|
9469
9485
|
const virtualizer = useVirtualizer({
|
|
9470
9486
|
count: enabled ? rowModel.length : 0,
|
|
9471
9487
|
useFlushSync: false,
|
|
9472
9488
|
getScrollElement: () => containerRef.current,
|
|
9473
9489
|
estimateSize: () => DEFAULT_ROW_HEIGHT,
|
|
9490
|
+
getItemKey: getRowVirtualItemKey,
|
|
9474
9491
|
measureElement: typeof window !== "undefined" && navigator.userAgent.indexOf("Firefox") === -1 ? (element) => element?.getBoundingClientRect().height : void 0,
|
|
9475
9492
|
overscan: virtual?.overscan ?? DEFAULT_OVER_SCAN
|
|
9476
9493
|
});
|
|
9494
|
+
const columnVirtualizer = useVirtualizer({
|
|
9495
|
+
count: columnsEnabled ? centerColumns.length : 0,
|
|
9496
|
+
estimateSize: (index) => centerColumns[index]?.getSize() ?? 0,
|
|
9497
|
+
getScrollElement: () => containerRef.current,
|
|
9498
|
+
horizontal: true,
|
|
9499
|
+
getItemKey: getColumnVirtualItemKey,
|
|
9500
|
+
overscan: virtual?.columns?.overscan ?? DEFAULT_COLUMN_OVERSCAN
|
|
9501
|
+
});
|
|
9477
9502
|
const virtualItems = enabled ? virtualizer.getVirtualItems() : [];
|
|
9478
9503
|
const paddingTop = enabled && virtualItems.length > 0 ? virtualItems[0].start : 0;
|
|
9479
9504
|
const paddingBottom = enabled && virtualItems.length > 0 ? virtualizer.getTotalSize() - virtualItems[virtualItems.length - 1].end : 0;
|
|
9505
|
+
let columnVirtual;
|
|
9506
|
+
if (!columnsEnabled) {
|
|
9507
|
+
columnVirtual = { enabled: false };
|
|
9508
|
+
} else {
|
|
9509
|
+
const virtualColumns = columnVirtualizer.getVirtualItems();
|
|
9510
|
+
const virtualPaddingLeft = virtualColumns[0]?.start ?? 0;
|
|
9511
|
+
const virtualPaddingRight = columnVirtualizer.getTotalSize() - (virtualColumns[virtualColumns.length - 1]?.end ?? 0);
|
|
9512
|
+
columnVirtual = { enabled: true, virtualColumns, virtualPaddingLeft, virtualPaddingRight };
|
|
9513
|
+
}
|
|
9480
9514
|
return {
|
|
9481
9515
|
virtualizer,
|
|
9516
|
+
columnVirtualizer,
|
|
9482
9517
|
virtualItems,
|
|
9483
9518
|
paddingTop,
|
|
9484
9519
|
paddingBottom,
|
|
9485
|
-
rowModel
|
|
9520
|
+
rowModel,
|
|
9521
|
+
columnVirtual
|
|
9486
9522
|
};
|
|
9487
9523
|
};
|
|
9488
9524
|
function useComputedTableState({
|
|
@@ -9585,6 +9621,7 @@ var ColumnSeparator = ({ show, className, ...props }) => {
|
|
|
9585
9621
|
var ColumnSeparator_default = React__default.memo(ColumnSeparator);
|
|
9586
9622
|
|
|
9587
9623
|
// src/components/data-table/helpers.ts
|
|
9624
|
+
var toCSSId = (id) => id.replace(/[^a-zA-Z0-9_-]/g, "-");
|
|
9588
9625
|
function getColumnPinningInfo(column) {
|
|
9589
9626
|
const isPinned = column.getIsPinned();
|
|
9590
9627
|
const isLastLeftPinnedColumn = isPinned === "left" && column.getIsLastColumn("left");
|
|
@@ -9595,8 +9632,8 @@ function getColumnPinningStyles(column) {
|
|
|
9595
9632
|
const { isPinned, isFirstRightPinnedColumn, isLastLeftPinnedColumn } = getColumnPinningInfo(column);
|
|
9596
9633
|
const classes = cn(isPinned ? "sticky" : "relative");
|
|
9597
9634
|
const style = {
|
|
9598
|
-
left: isPinned === "left" ? column.getStart("left") : void 0,
|
|
9599
|
-
right: isPinned === "right" ? column.getAfter("right") : void 0,
|
|
9635
|
+
left: isPinned === "left" ? `calc(var(--col-${toCSSId(column.id)}-pin-start, ${column.getStart("left")}) * 1px)` : void 0,
|
|
9636
|
+
right: isPinned === "right" ? `calc(var(--col-${toCSSId(column.id)}-pin-after, ${column.getAfter("right")}) * 1px)` : void 0,
|
|
9600
9637
|
zIndex: isPinned ? 1 : 0,
|
|
9601
9638
|
boxShadow: isLastLeftPinnedColumn ? "inset -1px 0 0 0 black" : isFirstRightPinnedColumn ? "inset 1px 0 0 0 black" : void 0
|
|
9602
9639
|
};
|
|
@@ -9615,102 +9652,243 @@ function getRowClickHandlers(handler, { rowData, row, table }) {
|
|
|
9615
9652
|
onClick: handleClick
|
|
9616
9653
|
};
|
|
9617
9654
|
}
|
|
9655
|
+
function renderHeaderCell(header, headerGroup, {
|
|
9656
|
+
columnResizing,
|
|
9657
|
+
virtual,
|
|
9658
|
+
components,
|
|
9659
|
+
table
|
|
9660
|
+
}, rowSpan) {
|
|
9661
|
+
const { classes, style } = getColumnPinningStyles(header.column);
|
|
9662
|
+
const useColumnSizing = header.column.columnDef?.meta?.useColumnSizing ?? columnResizing?.enabled ?? virtual?.enabled ?? false;
|
|
9663
|
+
const tableHeadCellProps = typeof components?.tableHeadCellProps === "function" ? components?.tableHeadCellProps({ header, table }) : components?.tableHeadCellProps;
|
|
9664
|
+
const nextHeader = headerGroup.headers?.[header.index + 1] || header;
|
|
9665
|
+
const { isLastLeftPinnedColumn } = getColumnPinningInfo(header.column);
|
|
9666
|
+
const { isFirstRightPinnedColumn } = getColumnPinningInfo(nextHeader.column);
|
|
9667
|
+
const headerGroupLength = headerGroup.headers.length;
|
|
9668
|
+
const showSeparator = header.index !== headerGroupLength - 1 && !isLastLeftPinnedColumn && !isFirstRightPinnedColumn && (!header.isPlaceholder || !nextHeader.isPlaceholder);
|
|
9669
|
+
return /* @__PURE__ */ jsxs(
|
|
9670
|
+
TableHead,
|
|
9671
|
+
{
|
|
9672
|
+
"data-testid": `table-head-${header.id}`,
|
|
9673
|
+
colSpan: header.colSpan,
|
|
9674
|
+
rowSpan,
|
|
9675
|
+
...tableHeadCellProps,
|
|
9676
|
+
...header.column.columnDef?.meta?.headerProps,
|
|
9677
|
+
className: cn(
|
|
9678
|
+
classes,
|
|
9679
|
+
tableHeadCellProps?.className,
|
|
9680
|
+
header.column.columnDef?.meta?.headerProps?.className
|
|
9681
|
+
),
|
|
9682
|
+
style: {
|
|
9683
|
+
...style,
|
|
9684
|
+
width: useColumnSizing ? `calc(var(--header-${toCSSId(header.id)}-size, ${header.getSize()}) * 1px)` : void 0,
|
|
9685
|
+
minWidth: useColumnSizing ? header.column.columnDef.minSize : void 0,
|
|
9686
|
+
maxWidth: useColumnSizing ? header.column.columnDef.maxSize : void 0,
|
|
9687
|
+
...tableHeadCellProps?.style,
|
|
9688
|
+
...header.column.columnDef?.meta?.headerProps?.style
|
|
9689
|
+
},
|
|
9690
|
+
children: [
|
|
9691
|
+
!header.isPlaceholder || rowSpan ? flexRender(header.column.columnDef.header, header.getContext()) : null,
|
|
9692
|
+
/* @__PURE__ */ jsx(
|
|
9693
|
+
ColumnSeparator_default,
|
|
9694
|
+
{
|
|
9695
|
+
...components?.columnSeparatorProps?.headerCell,
|
|
9696
|
+
...header.column.columnDef?.meta?.columnSeparatorProps,
|
|
9697
|
+
show: header.column.columnDef?.meta?.columnSeparatorProps?.show ?? components?.columnSeparatorProps?.headerCell?.show ?? showSeparator
|
|
9698
|
+
}
|
|
9699
|
+
),
|
|
9700
|
+
/* @__PURE__ */ jsx(ColumnResizer_default, { header, ...components?.columnResizerProps })
|
|
9701
|
+
]
|
|
9702
|
+
},
|
|
9703
|
+
header.id
|
|
9704
|
+
);
|
|
9705
|
+
}
|
|
9618
9706
|
var TableHeaderRows = ({
|
|
9619
9707
|
table,
|
|
9620
9708
|
columnResizing,
|
|
9621
9709
|
virtual,
|
|
9710
|
+
columnVirtual,
|
|
9622
9711
|
components
|
|
9623
9712
|
}) => {
|
|
9624
|
-
|
|
9625
|
-
|
|
9626
|
-
|
|
9627
|
-
|
|
9628
|
-
|
|
9629
|
-
|
|
9630
|
-
|
|
9631
|
-
|
|
9632
|
-
|
|
9633
|
-
|
|
9634
|
-
|
|
9635
|
-
|
|
9636
|
-
|
|
9637
|
-
|
|
9638
|
-
|
|
9639
|
-
|
|
9640
|
-
|
|
9641
|
-
|
|
9642
|
-
|
|
9643
|
-
|
|
9644
|
-
|
|
9645
|
-
|
|
9646
|
-
|
|
9647
|
-
|
|
9648
|
-
|
|
9649
|
-
|
|
9650
|
-
|
|
9651
|
-
|
|
9652
|
-
|
|
9653
|
-
|
|
9654
|
-
|
|
9655
|
-
|
|
9656
|
-
|
|
9657
|
-
|
|
9658
|
-
|
|
9659
|
-
|
|
9660
|
-
|
|
9661
|
-
|
|
9662
|
-
|
|
9713
|
+
const cellProps = { columnResizing, virtual, components, table };
|
|
9714
|
+
const centerLeafCols = columnVirtual.enabled ? table.getCenterVisibleLeafColumns() : [];
|
|
9715
|
+
const totalGroups = table.getHeaderGroups().length;
|
|
9716
|
+
const spannedIds = /* @__PURE__ */ new Set();
|
|
9717
|
+
const resolveHeaderCell = (header, headerGroup, groupIndex) => {
|
|
9718
|
+
if (spannedIds.has(header.column.id)) return null;
|
|
9719
|
+
const remainingRows = totalGroups - groupIndex;
|
|
9720
|
+
if (header.isPlaceholder && header.column.columnDef.meta?.spanRows && remainingRows > 1) {
|
|
9721
|
+
spannedIds.add(header.column.id);
|
|
9722
|
+
return renderHeaderCell(header, headerGroup, cellProps, remainingRows);
|
|
9723
|
+
}
|
|
9724
|
+
return renderHeaderCell(header, headerGroup, cellProps);
|
|
9725
|
+
};
|
|
9726
|
+
return /* @__PURE__ */ jsx(Fragment, { children: table.getHeaderGroups().map((headerGroup, groupIndex) => {
|
|
9727
|
+
if (!columnVirtual.enabled) {
|
|
9728
|
+
return /* @__PURE__ */ jsx(TableRow, { children: headerGroup.headers.map((header) => resolveHeaderCell(header, headerGroup, groupIndex)) }, headerGroup.id);
|
|
9729
|
+
}
|
|
9730
|
+
const leftHeaders = table.getLeftHeaderGroups()[groupIndex]?.headers ?? [];
|
|
9731
|
+
const centerHeaders = table.getCenterHeaderGroups()[groupIndex]?.headers ?? [];
|
|
9732
|
+
const rightHeaders = table.getRightHeaderGroups()[groupIndex]?.headers ?? [];
|
|
9733
|
+
const isLeafLevel = !centerHeaders[0] || centerHeaders[0].subHeaders.length === 0;
|
|
9734
|
+
if (isLeafLevel) {
|
|
9735
|
+
return /* @__PURE__ */ jsxs(TableRow, { children: [
|
|
9736
|
+
leftHeaders.map((header) => resolveHeaderCell(header, headerGroup, groupIndex)),
|
|
9737
|
+
columnVirtual.virtualPaddingLeft > 0 && /* @__PURE__ */ jsx("th", { "aria-hidden": "true", style: { width: columnVirtual.virtualPaddingLeft } }),
|
|
9738
|
+
columnVirtual.virtualColumns.map((vc) => {
|
|
9739
|
+
const header = centerHeaders[vc.index];
|
|
9740
|
+
if (!header) return null;
|
|
9741
|
+
return renderHeaderCell(header, headerGroup, cellProps);
|
|
9742
|
+
}),
|
|
9743
|
+
columnVirtual.virtualPaddingRight > 0 && /* @__PURE__ */ jsx("th", { "aria-hidden": "true", style: { width: columnVirtual.virtualPaddingRight } }),
|
|
9744
|
+
rightHeaders.map((header) => resolveHeaderCell(header, headerGroup, groupIndex))
|
|
9745
|
+
] }, headerGroup.id);
|
|
9746
|
+
}
|
|
9747
|
+
const leafToGroupIdx = [];
|
|
9748
|
+
let leafRunning = 0;
|
|
9749
|
+
for (let gi = 0; gi < centerHeaders.length; gi++) {
|
|
9750
|
+
for (let i = 0; i < centerHeaders[gi].colSpan; i++) {
|
|
9751
|
+
leafToGroupIdx[leafRunning + i] = gi;
|
|
9752
|
+
}
|
|
9753
|
+
leafRunning += centerHeaders[gi].colSpan;
|
|
9754
|
+
}
|
|
9755
|
+
const virtualCols = columnVirtual.virtualColumns;
|
|
9756
|
+
const groupedVirtualCols = [];
|
|
9757
|
+
for (const vc of virtualCols) {
|
|
9758
|
+
const gi = leafToGroupIdx[vc.index];
|
|
9759
|
+
if (gi === void 0) continue;
|
|
9760
|
+
const last = groupedVirtualCols[groupedVirtualCols.length - 1];
|
|
9761
|
+
if (last && last.gi === gi) {
|
|
9762
|
+
last.vcs.push(vc);
|
|
9763
|
+
} else {
|
|
9764
|
+
groupedVirtualCols.push({ gi, vcs: [vc] });
|
|
9765
|
+
}
|
|
9766
|
+
}
|
|
9767
|
+
return /* @__PURE__ */ jsxs(TableRow, { children: [
|
|
9768
|
+
leftHeaders.map((header) => resolveHeaderCell(header, headerGroup, groupIndex)),
|
|
9769
|
+
columnVirtual.virtualPaddingLeft > 0 && /* @__PURE__ */ jsx("th", { "aria-hidden": "true", style: { width: columnVirtual.virtualPaddingLeft } }),
|
|
9770
|
+
groupedVirtualCols.map(({ gi, vcs }) => {
|
|
9771
|
+
const groupHeader = centerHeaders[gi];
|
|
9772
|
+
const { classes, style } = getColumnPinningStyles(groupHeader.column);
|
|
9773
|
+
const tableHeadCellProps = typeof components?.tableHeadCellProps === "function" ? components.tableHeadCellProps({ header: groupHeader, table }) : components?.tableHeadCellProps;
|
|
9774
|
+
const useColumnSizing = groupHeader.column.columnDef?.meta?.useColumnSizing ?? columnResizing?.enabled ?? virtual?.enabled ?? false;
|
|
9775
|
+
const widthCalc = useColumnSizing ? `calc((${vcs.map((vc) => `var(--col-${toCSSId(centerLeafCols[vc.index].id)}-size, ${centerLeafCols[vc.index].getSize()})`).join(" + ")}) * 1px)` : void 0;
|
|
9776
|
+
const nextCenterHeader = centerHeaders[gi + 1];
|
|
9777
|
+
const showSeparator = groupHeader.column.columnDef?.meta?.columnSeparatorProps?.show ?? components?.columnSeparatorProps?.headerCell?.show ?? (gi !== centerHeaders.length - 1 && (!groupHeader.isPlaceholder || !nextCenterHeader?.isPlaceholder));
|
|
9778
|
+
return /* @__PURE__ */ jsxs(
|
|
9779
|
+
TableHead,
|
|
9780
|
+
{
|
|
9781
|
+
"data-testid": `table-head-${groupHeader.id}`,
|
|
9782
|
+
colSpan: vcs.length,
|
|
9783
|
+
...tableHeadCellProps,
|
|
9784
|
+
...groupHeader.column.columnDef?.meta?.headerProps,
|
|
9785
|
+
className: cn(
|
|
9786
|
+
classes,
|
|
9787
|
+
tableHeadCellProps?.className,
|
|
9788
|
+
groupHeader.column.columnDef?.meta?.headerProps?.className
|
|
9663
9789
|
),
|
|
9664
|
-
|
|
9665
|
-
|
|
9666
|
-
|
|
9667
|
-
|
|
9668
|
-
|
|
9669
|
-
|
|
9790
|
+
style: {
|
|
9791
|
+
...style,
|
|
9792
|
+
width: widthCalc,
|
|
9793
|
+
minWidth: useColumnSizing ? groupHeader.column.columnDef.minSize : void 0,
|
|
9794
|
+
maxWidth: useColumnSizing ? groupHeader.column.columnDef.maxSize : void 0,
|
|
9795
|
+
...tableHeadCellProps?.style,
|
|
9796
|
+
...groupHeader.column.columnDef?.meta?.headerProps?.style
|
|
9797
|
+
},
|
|
9798
|
+
children: [
|
|
9799
|
+
!groupHeader.isPlaceholder ? flexRender(groupHeader.column.columnDef.header, groupHeader.getContext()) : null,
|
|
9800
|
+
/* @__PURE__ */ jsx(
|
|
9801
|
+
ColumnSeparator_default,
|
|
9802
|
+
{
|
|
9803
|
+
...components?.columnSeparatorProps?.headerCell,
|
|
9804
|
+
...groupHeader.column.columnDef?.meta?.columnSeparatorProps,
|
|
9805
|
+
show: showSeparator
|
|
9806
|
+
}
|
|
9807
|
+
),
|
|
9808
|
+
/* @__PURE__ */ jsx(ColumnResizer_default, { header: groupHeader, ...components?.columnResizerProps })
|
|
9809
|
+
]
|
|
9810
|
+
},
|
|
9811
|
+
`${groupHeader.id}-${vcs[0].index}`
|
|
9812
|
+
);
|
|
9813
|
+
}),
|
|
9814
|
+
columnVirtual.virtualPaddingRight > 0 && /* @__PURE__ */ jsx("th", { "aria-hidden": "true", style: { width: columnVirtual.virtualPaddingRight } }),
|
|
9815
|
+
rightHeaders.map((header) => resolveHeaderCell(header, headerGroup, groupIndex))
|
|
9816
|
+
] }, headerGroup.id);
|
|
9670
9817
|
}) });
|
|
9671
9818
|
};
|
|
9819
|
+
var MemoizedTableHeaderRows = React__default.memo(
|
|
9820
|
+
TableHeaderRows,
|
|
9821
|
+
(_, next) => next.isResizing === true
|
|
9822
|
+
);
|
|
9823
|
+
function renderFilterCell(column, {
|
|
9824
|
+
columnResizing,
|
|
9825
|
+
virtual,
|
|
9826
|
+
components,
|
|
9827
|
+
table
|
|
9828
|
+
}) {
|
|
9829
|
+
const { classes, style } = getColumnPinningStyles(column);
|
|
9830
|
+
const useColumnSizing = column.columnDef.meta?.useColumnSizing ?? columnResizing?.enabled ?? virtual?.enabled ?? false;
|
|
9831
|
+
const tableFilterCellProps = typeof components?.tableFilterCellProps === "function" ? components?.tableFilterCellProps({ column, table }) : components?.tableFilterCellProps;
|
|
9832
|
+
return /* @__PURE__ */ jsx(
|
|
9833
|
+
TableCell,
|
|
9834
|
+
{
|
|
9835
|
+
"data-testid": `table-filter-cell-${column.id}`,
|
|
9836
|
+
...tableFilterCellProps,
|
|
9837
|
+
...column.columnDef?.meta?.filterCellProps,
|
|
9838
|
+
className: cn(
|
|
9839
|
+
"bg-white border-b",
|
|
9840
|
+
classes,
|
|
9841
|
+
tableFilterCellProps?.className,
|
|
9842
|
+
column.columnDef?.meta?.filterCellProps?.className
|
|
9843
|
+
),
|
|
9844
|
+
style: {
|
|
9845
|
+
...style,
|
|
9846
|
+
width: useColumnSizing ? `calc(var(--col-${toCSSId(column.id)}-size, ${column.getSize()}) * 1px)` : void 0,
|
|
9847
|
+
minWidth: useColumnSizing ? column.columnDef.minSize : void 0,
|
|
9848
|
+
maxWidth: useColumnSizing ? column.columnDef.maxSize : void 0,
|
|
9849
|
+
...tableFilterCellProps?.style,
|
|
9850
|
+
...column.columnDef?.meta?.filterCellProps?.style
|
|
9851
|
+
},
|
|
9852
|
+
children: column.getCanFilter() && column.columnDef.meta?.renderColumnFilter?.({
|
|
9853
|
+
column,
|
|
9854
|
+
table
|
|
9855
|
+
})
|
|
9856
|
+
},
|
|
9857
|
+
column.id
|
|
9858
|
+
);
|
|
9859
|
+
}
|
|
9672
9860
|
var TableFilterRow = ({
|
|
9673
9861
|
table,
|
|
9674
9862
|
filterableColumns,
|
|
9675
9863
|
isSomeColumnsFilterable,
|
|
9676
9864
|
columnResizing,
|
|
9677
9865
|
virtual,
|
|
9866
|
+
columnVirtual,
|
|
9678
9867
|
components
|
|
9679
9868
|
}) => {
|
|
9680
9869
|
if (!isSomeColumnsFilterable) return null;
|
|
9681
|
-
|
|
9682
|
-
|
|
9683
|
-
|
|
9684
|
-
|
|
9685
|
-
|
|
9686
|
-
|
|
9687
|
-
|
|
9688
|
-
|
|
9689
|
-
|
|
9690
|
-
|
|
9691
|
-
|
|
9692
|
-
|
|
9693
|
-
|
|
9694
|
-
|
|
9695
|
-
|
|
9696
|
-
|
|
9697
|
-
|
|
9698
|
-
...style,
|
|
9699
|
-
width: useColumnSizing ? column.getSize() : void 0,
|
|
9700
|
-
minWidth: useColumnSizing ? column.columnDef.minSize : void 0,
|
|
9701
|
-
maxWidth: useColumnSizing ? column.columnDef.maxSize : void 0,
|
|
9702
|
-
...tableFilterCellProps?.style,
|
|
9703
|
-
...column.columnDef?.meta?.filterCellProps?.style
|
|
9704
|
-
},
|
|
9705
|
-
children: column.getCanFilter() && column.columnDef.meta?.renderColumnFilter?.({
|
|
9706
|
-
column,
|
|
9707
|
-
table
|
|
9708
|
-
})
|
|
9709
|
-
},
|
|
9710
|
-
column.id
|
|
9711
|
-
);
|
|
9712
|
-
}) });
|
|
9870
|
+
const cellProps = { columnResizing, virtual, components, table };
|
|
9871
|
+
if (!columnVirtual.enabled) {
|
|
9872
|
+
return /* @__PURE__ */ jsx(TableRow, { "data-testid": "table-filter-row", children: filterableColumns.map((column) => renderFilterCell(column, cellProps)) });
|
|
9873
|
+
}
|
|
9874
|
+
const centerColumns = table.getCenterVisibleLeafColumns();
|
|
9875
|
+
const leftColumns = filterableColumns.filter((col) => col.getIsPinned() === "left");
|
|
9876
|
+
const centerFilterColumns = filterableColumns.filter((col) => !col.getIsPinned());
|
|
9877
|
+
const rightColumns = filterableColumns.filter((col) => col.getIsPinned() === "right");
|
|
9878
|
+
const centerColumnIndexMap = new Map(centerColumns.map((col, i) => [col.id, i]));
|
|
9879
|
+
const virtualIndexSet = new Set(columnVirtual.virtualColumns.map((vc) => vc.index));
|
|
9880
|
+
return /* @__PURE__ */ jsxs(TableRow, { "data-testid": "table-filter-row", children: [
|
|
9881
|
+
leftColumns.map((column) => renderFilterCell(column, cellProps)),
|
|
9882
|
+
columnVirtual.virtualPaddingLeft > 0 && /* @__PURE__ */ jsx("td", { "aria-hidden": "true", style: { width: columnVirtual.virtualPaddingLeft } }),
|
|
9883
|
+
centerFilterColumns.filter((col) => virtualIndexSet.has(centerColumnIndexMap.get(col.id) ?? -1)).map((column) => renderFilterCell(column, cellProps)),
|
|
9884
|
+
columnVirtual.virtualPaddingRight > 0 && /* @__PURE__ */ jsx("td", { "aria-hidden": "true", style: { width: columnVirtual.virtualPaddingRight } }),
|
|
9885
|
+
rightColumns.map((column) => renderFilterCell(column, cellProps))
|
|
9886
|
+
] });
|
|
9713
9887
|
};
|
|
9888
|
+
var MemoizedTableFilterRow = React__default.memo(
|
|
9889
|
+
TableFilterRow,
|
|
9890
|
+
(_, next) => next.isResizing === true
|
|
9891
|
+
);
|
|
9714
9892
|
var TableDataRows = ({
|
|
9715
9893
|
table,
|
|
9716
9894
|
rowModel,
|
|
@@ -9722,6 +9900,7 @@ var TableDataRows = ({
|
|
|
9722
9900
|
visibleColumnCount,
|
|
9723
9901
|
columnResizing,
|
|
9724
9902
|
virtual,
|
|
9903
|
+
columnVirtual,
|
|
9725
9904
|
onRowClick,
|
|
9726
9905
|
components
|
|
9727
9906
|
}) => {
|
|
@@ -9740,6 +9919,56 @@ var TableDataRows = ({
|
|
|
9740
9919
|
if (!row) return null;
|
|
9741
9920
|
const virtualIndex = config.isVirtualize ? item.index : void 0;
|
|
9742
9921
|
const tableDataRowProps = typeof components?.tableDataRowProps === "function" ? components.tableDataRowProps({ row, table }) || {} : components?.tableDataRowProps || {};
|
|
9922
|
+
const renderCell = (cell) => {
|
|
9923
|
+
const { classes, style } = getColumnPinningStyles(cell.column);
|
|
9924
|
+
const useColumnSizing = cell.column.columnDef.meta?.useColumnSizing ?? columnResizing?.enabled ?? virtual?.enabled ?? false;
|
|
9925
|
+
const tableDataCellProps = typeof components?.tableDataCellProps === "function" ? components?.tableDataCellProps({ row, cell, table }) : components?.tableDataCellProps;
|
|
9926
|
+
return /* @__PURE__ */ jsx(
|
|
9927
|
+
TableCell,
|
|
9928
|
+
{
|
|
9929
|
+
"data-testid": `table-data-cell-${cell.id}`,
|
|
9930
|
+
"data-row-id": row.id,
|
|
9931
|
+
"data-column-id": cell.column.id,
|
|
9932
|
+
...tableDataCellProps,
|
|
9933
|
+
...cell.column.columnDef?.meta?.cellProps,
|
|
9934
|
+
className: cn(
|
|
9935
|
+
{
|
|
9936
|
+
"bg-[#dfeae3]": row.getIsSelected(),
|
|
9937
|
+
"bg-white group-hover:bg-sus-primary-3-hover transition-colors duration-150": !row.getIsSelected()
|
|
9938
|
+
},
|
|
9939
|
+
classes,
|
|
9940
|
+
tableDataCellProps?.className,
|
|
9941
|
+
cell.column.columnDef?.meta?.cellProps?.className
|
|
9942
|
+
),
|
|
9943
|
+
style: {
|
|
9944
|
+
...style,
|
|
9945
|
+
width: useColumnSizing ? `calc(var(--col-${toCSSId(cell.column.id)}-size, ${cell.column.getSize()}) * 1px)` : void 0,
|
|
9946
|
+
minWidth: useColumnSizing ? cell.column.columnDef.minSize : void 0,
|
|
9947
|
+
maxWidth: useColumnSizing ? cell.column.columnDef.maxSize : void 0,
|
|
9948
|
+
...tableDataCellProps?.style,
|
|
9949
|
+
...cell.column.columnDef?.meta?.cellProps?.style
|
|
9950
|
+
},
|
|
9951
|
+
children: flexRender(cell.column.columnDef.cell, cell.getContext())
|
|
9952
|
+
},
|
|
9953
|
+
cell.id
|
|
9954
|
+
);
|
|
9955
|
+
};
|
|
9956
|
+
const rowContent = columnVirtual.enabled ? (() => {
|
|
9957
|
+
const leftCells = row.getLeftVisibleCells();
|
|
9958
|
+
const centerCells = row.getCenterVisibleCells();
|
|
9959
|
+
const rightCells = row.getRightVisibleCells();
|
|
9960
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9961
|
+
leftCells.map(renderCell),
|
|
9962
|
+
columnVirtual.virtualPaddingLeft > 0 && /* @__PURE__ */ jsx("td", { "aria-hidden": "true", style: { width: columnVirtual.virtualPaddingLeft } }),
|
|
9963
|
+
columnVirtual.virtualColumns.map((vc) => {
|
|
9964
|
+
const cell = centerCells[vc.index];
|
|
9965
|
+
if (!cell) return null;
|
|
9966
|
+
return renderCell(cell);
|
|
9967
|
+
}),
|
|
9968
|
+
columnVirtual.virtualPaddingRight > 0 && /* @__PURE__ */ jsx("td", { "aria-hidden": "true", style: { width: columnVirtual.virtualPaddingRight } }),
|
|
9969
|
+
rightCells.map(renderCell)
|
|
9970
|
+
] });
|
|
9971
|
+
})() : row.getVisibleCells().map(renderCell);
|
|
9743
9972
|
return /* @__PURE__ */ createElement(
|
|
9744
9973
|
TableRow,
|
|
9745
9974
|
{
|
|
@@ -9757,40 +9986,7 @@ var TableDataRows = ({
|
|
|
9757
9986
|
table
|
|
9758
9987
|
})
|
|
9759
9988
|
},
|
|
9760
|
-
|
|
9761
|
-
const { classes, style } = getColumnPinningStyles(cell.column);
|
|
9762
|
-
const useColumnSizing = cell.column.columnDef.meta?.useColumnSizing ?? columnResizing?.enabled ?? virtual?.enabled ?? false;
|
|
9763
|
-
const tableDataCellProps = typeof components?.tableDataCellProps === "function" ? components?.tableDataCellProps({ row, cell, table }) : components?.tableDataCellProps;
|
|
9764
|
-
return /* @__PURE__ */ jsx(
|
|
9765
|
-
TableCell,
|
|
9766
|
-
{
|
|
9767
|
-
"data-testid": `table-data-cell-${cell.id}`,
|
|
9768
|
-
"data-row-id": row.id,
|
|
9769
|
-
"data-column-id": cell.column.id,
|
|
9770
|
-
...tableDataCellProps,
|
|
9771
|
-
...cell.column.columnDef?.meta?.cellProps,
|
|
9772
|
-
className: cn(
|
|
9773
|
-
{
|
|
9774
|
-
"bg-[#dfeae3]": row.getIsSelected(),
|
|
9775
|
-
"bg-white group-hover:bg-sus-primary-3-hover": !row.getIsSelected()
|
|
9776
|
-
},
|
|
9777
|
-
classes,
|
|
9778
|
-
tableDataCellProps?.className,
|
|
9779
|
-
cell.column.columnDef?.meta?.cellProps?.className
|
|
9780
|
-
),
|
|
9781
|
-
style: {
|
|
9782
|
-
...style,
|
|
9783
|
-
width: useColumnSizing ? cell.column.getSize() : void 0,
|
|
9784
|
-
minWidth: useColumnSizing ? cell.column.columnDef.minSize : void 0,
|
|
9785
|
-
maxWidth: useColumnSizing ? cell.column.columnDef.maxSize : void 0,
|
|
9786
|
-
...tableDataCellProps?.style,
|
|
9787
|
-
...cell.column.columnDef?.meta?.cellProps?.style
|
|
9788
|
-
},
|
|
9789
|
-
children: flexRender(cell.column.columnDef.cell, cell.getContext())
|
|
9790
|
-
},
|
|
9791
|
-
cell.id
|
|
9792
|
-
);
|
|
9793
|
-
})
|
|
9989
|
+
rowContent
|
|
9794
9990
|
);
|
|
9795
9991
|
}),
|
|
9796
9992
|
virtualEnabled && paddingBottom > 0 && /* @__PURE__ */ jsx(TableRow, { "aria-hidden": "true", "data-testid": "table-virtual-padding-bottom", children: /* @__PURE__ */ jsx(
|
|
@@ -9803,66 +9999,163 @@ var TableDataRows = ({
|
|
|
9803
9999
|
) })
|
|
9804
10000
|
] });
|
|
9805
10001
|
};
|
|
10002
|
+
var MemoizedTableDataRows = React__default.memo(
|
|
10003
|
+
TableDataRows,
|
|
10004
|
+
(_, next) => next.isResizing === true
|
|
10005
|
+
);
|
|
10006
|
+
function renderFooterCell(footer, footerGroup, {
|
|
10007
|
+
columnResizing,
|
|
10008
|
+
virtual,
|
|
10009
|
+
components,
|
|
10010
|
+
table
|
|
10011
|
+
}, rowSpan) {
|
|
10012
|
+
const { classes, style } = getColumnPinningStyles(footer.column);
|
|
10013
|
+
const useColumnSizing = footer.column.columnDef?.meta?.useColumnSizing ?? columnResizing?.enabled ?? virtual?.enabled ?? false;
|
|
10014
|
+
const tableFooterCellProps = typeof components?.tableFooterCellProps === "function" ? components.tableFooterCellProps({ footer, table }) : components?.tableFooterCellProps;
|
|
10015
|
+
const nextFooter = footerGroup.headers[footer.index + 1] ?? footer;
|
|
10016
|
+
const { isLastLeftPinnedColumn } = getColumnPinningInfo(footer.column);
|
|
10017
|
+
const { isFirstRightPinnedColumn } = getColumnPinningInfo(nextFooter.column);
|
|
10018
|
+
const footerGroupLength = footerGroup.headers.length;
|
|
10019
|
+
const showSeparator = footer.index !== footerGroupLength - 1 && !isLastLeftPinnedColumn && !isFirstRightPinnedColumn && (!footer.isPlaceholder || !nextFooter.isPlaceholder);
|
|
10020
|
+
return /* @__PURE__ */ jsxs(
|
|
10021
|
+
TableHead,
|
|
10022
|
+
{
|
|
10023
|
+
"data-testid": `footer-cell-${footer.id}`,
|
|
10024
|
+
colSpan: footer.colSpan,
|
|
10025
|
+
rowSpan,
|
|
10026
|
+
...tableFooterCellProps,
|
|
10027
|
+
...footer.column.columnDef?.meta?.footerProps,
|
|
10028
|
+
className: cn(
|
|
10029
|
+
classes,
|
|
10030
|
+
tableFooterCellProps?.className,
|
|
10031
|
+
footer.column.columnDef?.meta?.footerProps?.className
|
|
10032
|
+
),
|
|
10033
|
+
style: {
|
|
10034
|
+
...style,
|
|
10035
|
+
width: useColumnSizing ? `calc(var(--col-${toCSSId(footer.column.id)}-size, ${footer.column.getSize()}) * 1px)` : void 0,
|
|
10036
|
+
minWidth: useColumnSizing ? footer.column.columnDef.minSize : void 0,
|
|
10037
|
+
maxWidth: useColumnSizing ? footer.column.columnDef.maxSize : void 0,
|
|
10038
|
+
...tableFooterCellProps?.style,
|
|
10039
|
+
...footer.column.columnDef?.meta?.footerProps?.style
|
|
10040
|
+
},
|
|
10041
|
+
children: [
|
|
10042
|
+
footer.isPlaceholder ? null : flexRender(footer.column.columnDef.footer, footer.getContext()),
|
|
10043
|
+
/* @__PURE__ */ jsx(
|
|
10044
|
+
ColumnSeparator_default,
|
|
10045
|
+
{
|
|
10046
|
+
...components?.columnSeparatorProps?.headerCell,
|
|
10047
|
+
...footer.column.columnDef?.meta?.columnSeparatorProps,
|
|
10048
|
+
show: footer.column.columnDef?.meta?.columnSeparatorProps?.show ?? components?.columnSeparatorProps?.headerCell?.show ?? showSeparator
|
|
10049
|
+
}
|
|
10050
|
+
),
|
|
10051
|
+
!footer.isPlaceholder && /* @__PURE__ */ jsx(ColumnResizer_default, { header: footer, ...components?.columnResizerProps })
|
|
10052
|
+
]
|
|
10053
|
+
},
|
|
10054
|
+
footer.id
|
|
10055
|
+
);
|
|
10056
|
+
}
|
|
9806
10057
|
var TableFooterRows = ({
|
|
9807
10058
|
table,
|
|
9808
10059
|
columnResizing,
|
|
9809
|
-
|
|
9810
|
-
|
|
10060
|
+
virtual,
|
|
10061
|
+
columnVirtual,
|
|
10062
|
+
components
|
|
9811
10063
|
}) => {
|
|
9812
|
-
const
|
|
9813
|
-
|
|
9814
|
-
|
|
10064
|
+
const cellProps = { columnResizing, virtual, components, table };
|
|
10065
|
+
const centerLeafCols = columnVirtual.enabled ? table.getCenterVisibleLeafColumns() : [];
|
|
10066
|
+
const totalFooterGroups = table.getFooterGroups().length;
|
|
10067
|
+
const spannedIds = /* @__PURE__ */ new Set();
|
|
10068
|
+
const resolveFooterCell = (footer, footerGroup, groupIndex) => {
|
|
10069
|
+
if (spannedIds.has(footer.column.id)) return null;
|
|
10070
|
+
const remainingRows = totalFooterGroups - groupIndex;
|
|
10071
|
+
if (!footer.isPlaceholder && footer.column.columnDef.meta?.spanRows && remainingRows > 1) {
|
|
10072
|
+
spannedIds.add(footer.column.id);
|
|
10073
|
+
return renderFooterCell(footer, footerGroup, cellProps, remainingRows);
|
|
10074
|
+
}
|
|
10075
|
+
return renderFooterCell(footer, footerGroup, cellProps);
|
|
10076
|
+
};
|
|
10077
|
+
return /* @__PURE__ */ jsx(Fragment, { children: table.getFooterGroups().map((footerGroup, groupIndex) => {
|
|
9815
10078
|
const tableFooterRowProps = typeof components?.tableFooterRowProps === "function" ? components.tableFooterRowProps({ footerGroup, table }) : components?.tableFooterRowProps;
|
|
9816
|
-
|
|
9817
|
-
|
|
9818
|
-
|
|
9819
|
-
|
|
9820
|
-
|
|
9821
|
-
|
|
9822
|
-
|
|
9823
|
-
|
|
9824
|
-
|
|
9825
|
-
|
|
9826
|
-
|
|
9827
|
-
{
|
|
9828
|
-
|
|
9829
|
-
|
|
9830
|
-
|
|
9831
|
-
|
|
9832
|
-
|
|
9833
|
-
|
|
9834
|
-
|
|
9835
|
-
|
|
9836
|
-
|
|
9837
|
-
|
|
9838
|
-
|
|
9839
|
-
|
|
9840
|
-
|
|
9841
|
-
|
|
9842
|
-
|
|
9843
|
-
|
|
9844
|
-
|
|
9845
|
-
|
|
9846
|
-
|
|
9847
|
-
|
|
9848
|
-
|
|
9849
|
-
|
|
9850
|
-
|
|
9851
|
-
|
|
9852
|
-
|
|
9853
|
-
|
|
10079
|
+
if (!columnVirtual.enabled) {
|
|
10080
|
+
return /* @__PURE__ */ jsx(TableRow, { ...tableFooterRowProps, children: footerGroup.headers.map((footer) => resolveFooterCell(footer, footerGroup, groupIndex)) }, footerGroup.id);
|
|
10081
|
+
}
|
|
10082
|
+
const leftFooters = table.getLeftFooterGroups()[groupIndex]?.headers ?? [];
|
|
10083
|
+
const centerFooters = table.getCenterFooterGroups()[groupIndex]?.headers ?? [];
|
|
10084
|
+
const rightFooters = table.getRightFooterGroups()[groupIndex]?.headers ?? [];
|
|
10085
|
+
const isLeafLevel = !centerFooters[0] || centerFooters[0].subHeaders.length === 0;
|
|
10086
|
+
if (isLeafLevel) {
|
|
10087
|
+
return /* @__PURE__ */ jsxs(TableRow, { ...tableFooterRowProps, children: [
|
|
10088
|
+
leftFooters.map((footer) => resolveFooterCell(footer, footerGroup, groupIndex)),
|
|
10089
|
+
columnVirtual.virtualPaddingLeft > 0 && /* @__PURE__ */ jsx("th", { "aria-hidden": "true", style: { width: columnVirtual.virtualPaddingLeft } }),
|
|
10090
|
+
columnVirtual.virtualColumns.map((vc) => {
|
|
10091
|
+
const footer = centerFooters[vc.index];
|
|
10092
|
+
if (!footer) return null;
|
|
10093
|
+
return renderFooterCell(footer, footerGroup, cellProps);
|
|
10094
|
+
}),
|
|
10095
|
+
columnVirtual.virtualPaddingRight > 0 && /* @__PURE__ */ jsx("th", { "aria-hidden": "true", style: { width: columnVirtual.virtualPaddingRight } }),
|
|
10096
|
+
rightFooters.map((footer) => resolveFooterCell(footer, footerGroup, groupIndex))
|
|
10097
|
+
] }, footerGroup.id);
|
|
10098
|
+
}
|
|
10099
|
+
const leafToGroupIdx = [];
|
|
10100
|
+
let leafRunning = 0;
|
|
10101
|
+
for (let gi = 0; gi < centerFooters.length; gi++) {
|
|
10102
|
+
for (let i = 0; i < centerFooters[gi].colSpan; i++) {
|
|
10103
|
+
leafToGroupIdx[leafRunning + i] = gi;
|
|
10104
|
+
}
|
|
10105
|
+
leafRunning += centerFooters[gi].colSpan;
|
|
10106
|
+
}
|
|
10107
|
+
const virtualCols = columnVirtual.virtualColumns;
|
|
10108
|
+
const useColumnSizing = columnResizing?.enabled ?? virtual?.enabled ?? false;
|
|
10109
|
+
return /* @__PURE__ */ jsxs(TableRow, { ...tableFooterRowProps, children: [
|
|
10110
|
+
leftFooters.map((footer) => resolveFooterCell(footer, footerGroup, groupIndex)),
|
|
10111
|
+
columnVirtual.virtualPaddingLeft > 0 && /* @__PURE__ */ jsx("th", { "aria-hidden": "true", style: { width: columnVirtual.virtualPaddingLeft } }),
|
|
10112
|
+
virtualCols.map((vc, vcIdx) => {
|
|
10113
|
+
const gi = leafToGroupIdx[vc.index];
|
|
10114
|
+
if (gi === void 0) return null;
|
|
10115
|
+
const groupFooter = centerFooters[gi];
|
|
10116
|
+
const leafCol = centerLeafCols[vc.index];
|
|
10117
|
+
const isFirst = vcIdx === 0 || leafToGroupIdx[virtualCols[vcIdx - 1].index] !== gi;
|
|
10118
|
+
const isLast = vcIdx === virtualCols.length - 1 || leafToGroupIdx[virtualCols[vcIdx + 1].index] !== gi;
|
|
10119
|
+
const { classes, style } = getColumnPinningStyles(groupFooter.column);
|
|
10120
|
+
const tableFooterCellProps = typeof components?.tableFooterCellProps === "function" ? components.tableFooterCellProps({ footer: groupFooter, table }) : components?.tableFooterCellProps;
|
|
10121
|
+
return /* @__PURE__ */ jsxs(
|
|
10122
|
+
TableHead,
|
|
10123
|
+
{
|
|
10124
|
+
colSpan: 1,
|
|
10125
|
+
...tableFooterCellProps,
|
|
10126
|
+
...groupFooter.column.columnDef?.meta?.footerProps,
|
|
10127
|
+
className: cn(
|
|
10128
|
+
classes,
|
|
10129
|
+
tableFooterCellProps?.className,
|
|
10130
|
+
groupFooter.column.columnDef?.meta?.footerProps?.className
|
|
9854
10131
|
),
|
|
9855
|
-
|
|
9856
|
-
|
|
9857
|
-
|
|
9858
|
-
|
|
9859
|
-
|
|
9860
|
-
|
|
10132
|
+
style: {
|
|
10133
|
+
...style,
|
|
10134
|
+
width: useColumnSizing ? `calc(var(--col-${toCSSId(leafCol.id)}-size, ${leafCol.getSize()}) * 1px)` : void 0,
|
|
10135
|
+
...tableFooterCellProps?.style,
|
|
10136
|
+
...groupFooter.column.columnDef?.meta?.footerProps?.style
|
|
10137
|
+
},
|
|
10138
|
+
children: [
|
|
10139
|
+
isFirst && !groupFooter.isPlaceholder ? flexRender(groupFooter.column.columnDef.footer, groupFooter.getContext()) : null,
|
|
10140
|
+
/* @__PURE__ */ jsx(ColumnSeparator_default, { ...components?.columnSeparatorProps?.headerCell, show: isLast })
|
|
10141
|
+
]
|
|
10142
|
+
},
|
|
10143
|
+
`${groupFooter.id}-${leafCol.id}`
|
|
10144
|
+
);
|
|
10145
|
+
}),
|
|
10146
|
+
columnVirtual.virtualPaddingRight > 0 && /* @__PURE__ */ jsx("th", { "aria-hidden": "true", style: { width: columnVirtual.virtualPaddingRight } }),
|
|
10147
|
+
rightFooters.map((footer) => resolveFooterCell(footer, footerGroup, groupIndex))
|
|
10148
|
+
] }, footerGroup.id);
|
|
9861
10149
|
}) });
|
|
9862
10150
|
};
|
|
10151
|
+
var MemoizedTableFooterRows = React__default.memo(
|
|
10152
|
+
TableFooterRows,
|
|
10153
|
+
(_, next) => next.isResizing === true
|
|
10154
|
+
);
|
|
9863
10155
|
var DataTable = ({
|
|
9864
10156
|
tableRef,
|
|
9865
10157
|
virtualizerRef,
|
|
10158
|
+
columnVirtualizerRef,
|
|
9866
10159
|
isInitialLoading,
|
|
9867
10160
|
columns,
|
|
9868
10161
|
data,
|
|
@@ -9902,7 +10195,15 @@ var DataTable = ({
|
|
|
9902
10195
|
rowIdKey,
|
|
9903
10196
|
childrenKey
|
|
9904
10197
|
});
|
|
9905
|
-
const {
|
|
10198
|
+
const {
|
|
10199
|
+
virtualizer,
|
|
10200
|
+
columnVirtualizer,
|
|
10201
|
+
virtualItems,
|
|
10202
|
+
paddingTop,
|
|
10203
|
+
paddingBottom,
|
|
10204
|
+
rowModel,
|
|
10205
|
+
columnVirtual
|
|
10206
|
+
} = useTableVirtualizer({
|
|
9906
10207
|
enabled: virtualEnabled,
|
|
9907
10208
|
table,
|
|
9908
10209
|
containerRef: tableContainerRef,
|
|
@@ -9916,8 +10217,28 @@ var DataTable = ({
|
|
|
9916
10217
|
activeStatusContent
|
|
9917
10218
|
});
|
|
9918
10219
|
const fetchMoreOnScrollReached = useScrollFetch({ scrollFetch, containerRef: tableContainerRef });
|
|
10220
|
+
const columnResizingEnabled = columnResizing?.enabled;
|
|
10221
|
+
const { columnSizing, columnSizingInfo } = table.getState();
|
|
10222
|
+
const columnSizeVars = useMemo(() => {
|
|
10223
|
+
if (!columnResizingEnabled && !virtualEnabled) return {};
|
|
10224
|
+
const headers = table.getFlatHeaders();
|
|
10225
|
+
const colSizes = {};
|
|
10226
|
+
for (const header of headers) {
|
|
10227
|
+
colSizes[`--header-${toCSSId(header.id)}-size`] = header.getSize();
|
|
10228
|
+
colSizes[`--col-${toCSSId(header.column.id)}-size`] = header.column.getSize();
|
|
10229
|
+
if (header.column.getIsPinned() === "left") {
|
|
10230
|
+
colSizes[`--col-${toCSSId(header.column.id)}-pin-start`] = header.column.getStart("left");
|
|
10231
|
+
} else if (header.column.getIsPinned() === "right") {
|
|
10232
|
+
colSizes[`--col-${toCSSId(header.column.id)}-pin-after`] = header.column.getAfter("right");
|
|
10233
|
+
}
|
|
10234
|
+
}
|
|
10235
|
+
return colSizes;
|
|
10236
|
+
}, [columnSizing, columnSizingInfo, columnResizingEnabled, virtualEnabled]);
|
|
10237
|
+
const isResizing = !columnVirtual.enabled && (columnResizingEnabled ?? false) && !!columnSizingInfo.isResizingColumn;
|
|
10238
|
+
const hasAnyFooter = table.getAllColumns().some((col) => col.columnDef.footer != null);
|
|
9919
10239
|
useBindRef_default({ ref: tableRef, value: table });
|
|
9920
10240
|
useBindRef_default({ ref: virtualizerRef, value: virtualizer });
|
|
10241
|
+
useBindRef_default({ ref: columnVirtualizerRef, value: columnVirtualizer });
|
|
9921
10242
|
return /* @__PURE__ */ jsxs(
|
|
9922
10243
|
TableContainer,
|
|
9923
10244
|
{
|
|
@@ -9953,44 +10274,53 @@ var DataTable = ({
|
|
|
9953
10274
|
},
|
|
9954
10275
|
defaultIcon: /* @__PURE__ */ jsx(SuiEmptyDataIcon, { size: 128 })
|
|
9955
10276
|
}
|
|
9956
|
-
) : /* @__PURE__ */
|
|
9957
|
-
|
|
9958
|
-
|
|
9959
|
-
|
|
9960
|
-
|
|
9961
|
-
|
|
9962
|
-
|
|
9963
|
-
|
|
9964
|
-
|
|
9965
|
-
|
|
9966
|
-
|
|
9967
|
-
|
|
9968
|
-
|
|
9969
|
-
|
|
9970
|
-
|
|
9971
|
-
|
|
9972
|
-
|
|
9973
|
-
|
|
9974
|
-
|
|
9975
|
-
|
|
9976
|
-
|
|
9977
|
-
|
|
9978
|
-
|
|
9979
|
-
|
|
9980
|
-
|
|
9981
|
-
|
|
9982
|
-
|
|
9983
|
-
|
|
9984
|
-
|
|
9985
|
-
|
|
9986
|
-
|
|
9987
|
-
|
|
9988
|
-
|
|
9989
|
-
|
|
9990
|
-
|
|
9991
|
-
|
|
9992
|
-
|
|
9993
|
-
|
|
10277
|
+
) : /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
|
|
10278
|
+
Table,
|
|
10279
|
+
{
|
|
10280
|
+
...components?.tableProps,
|
|
10281
|
+
style: {
|
|
10282
|
+
tableLayout: virtualEnabled ? "fixed" : "auto",
|
|
10283
|
+
minWidth: columnVirtual.enabled ? `${table.getTotalSize()}px` : void 0,
|
|
10284
|
+
...components?.tableProps?.style,
|
|
10285
|
+
...columnSizeVars
|
|
10286
|
+
},
|
|
10287
|
+
children: [
|
|
10288
|
+
/* @__PURE__ */ jsxs(
|
|
10289
|
+
TableHeader,
|
|
10290
|
+
{
|
|
10291
|
+
className: cn("sticky top-0 z-10 bg-white", components?.tableHeaderProps?.className),
|
|
10292
|
+
...components?.tableHeaderProps,
|
|
10293
|
+
children: [
|
|
10294
|
+
/* @__PURE__ */ jsx(
|
|
10295
|
+
MemoizedTableHeaderRows,
|
|
10296
|
+
{
|
|
10297
|
+
table,
|
|
10298
|
+
columnResizing,
|
|
10299
|
+
virtual,
|
|
10300
|
+
columnVirtual,
|
|
10301
|
+
components,
|
|
10302
|
+
isResizing
|
|
10303
|
+
}
|
|
10304
|
+
),
|
|
10305
|
+
/* @__PURE__ */ jsx(
|
|
10306
|
+
MemoizedTableFilterRow,
|
|
10307
|
+
{
|
|
10308
|
+
table,
|
|
10309
|
+
filterableColumns,
|
|
10310
|
+
isSomeColumnsFilterable,
|
|
10311
|
+
columnResizing,
|
|
10312
|
+
virtual,
|
|
10313
|
+
columnVirtual,
|
|
10314
|
+
components,
|
|
10315
|
+
isResizing
|
|
10316
|
+
}
|
|
10317
|
+
)
|
|
10318
|
+
]
|
|
10319
|
+
}
|
|
10320
|
+
),
|
|
10321
|
+
/* @__PURE__ */ jsxs(TableBody, { ...components?.tableBodyProps, children: [
|
|
10322
|
+
/* @__PURE__ */ jsx(
|
|
10323
|
+
MemoizedTableDataRows,
|
|
9994
10324
|
{
|
|
9995
10325
|
table,
|
|
9996
10326
|
rowModel,
|
|
@@ -10002,66 +10332,70 @@ var DataTable = ({
|
|
|
10002
10332
|
visibleColumnCount,
|
|
10003
10333
|
columnResizing,
|
|
10004
10334
|
virtual,
|
|
10335
|
+
columnVirtual,
|
|
10005
10336
|
onRowClick,
|
|
10006
|
-
components
|
|
10337
|
+
components,
|
|
10338
|
+
isResizing
|
|
10007
10339
|
}
|
|
10008
|
-
)
|
|
10009
|
-
/* @__PURE__ */ jsx(
|
|
10010
|
-
|
|
10340
|
+
),
|
|
10341
|
+
activeStatusContentComputed === "emptyFilteredData" && /* @__PURE__ */ jsx(TableRow, { "data-testid": "status-row-empty-filtered-data", children: /* @__PURE__ */ jsx(TableCell, { colSpan: visibleColumnCount, className: "border-b-0 p-0", children: /* @__PURE__ */ jsx(
|
|
10342
|
+
StatusContentSlot_default,
|
|
10011
10343
|
{
|
|
10012
|
-
|
|
10013
|
-
|
|
10014
|
-
|
|
10015
|
-
|
|
10016
|
-
|
|
10017
|
-
|
|
10018
|
-
|
|
10019
|
-
|
|
10020
|
-
components
|
|
10021
|
-
}
|
|
10022
|
-
)
|
|
10344
|
+
content: statusContent?.emptyFilteredData?.content ?? "No records found. Please try a different search.",
|
|
10345
|
+
icon: statusContent?.emptyFilteredData?.icon,
|
|
10346
|
+
wrapperProps: statusContent?.emptyFilteredData?.wrapperProps,
|
|
10347
|
+
defaultWrapperProps: {
|
|
10348
|
+
className: "flex flex-col items-center justify-center text-sm py-4 gap-2",
|
|
10349
|
+
["data-testid"]: "status-content-empty-filtered-data"
|
|
10350
|
+
},
|
|
10351
|
+
defaultIcon: /* @__PURE__ */ jsx(SuiEmptyDataIcon, { size: 128 })
|
|
10023
10352
|
}
|
|
10024
|
-
)
|
|
10025
|
-
|
|
10026
|
-
|
|
10027
|
-
|
|
10028
|
-
|
|
10029
|
-
|
|
10030
|
-
|
|
10031
|
-
|
|
10032
|
-
|
|
10033
|
-
|
|
10034
|
-
|
|
10035
|
-
|
|
10036
|
-
|
|
10037
|
-
|
|
10038
|
-
|
|
10039
|
-
|
|
10040
|
-
|
|
10041
|
-
|
|
10042
|
-
|
|
10043
|
-
|
|
10044
|
-
|
|
10045
|
-
|
|
10046
|
-
|
|
10047
|
-
|
|
10048
|
-
|
|
10049
|
-
|
|
10050
|
-
|
|
10051
|
-
|
|
10052
|
-
|
|
10053
|
-
|
|
10054
|
-
|
|
10055
|
-
|
|
10056
|
-
|
|
10057
|
-
|
|
10058
|
-
|
|
10059
|
-
|
|
10060
|
-
|
|
10061
|
-
|
|
10062
|
-
|
|
10063
|
-
|
|
10064
|
-
|
|
10353
|
+
) }) }),
|
|
10354
|
+
activeStatusContentComputed === "fetchingMore" && /* @__PURE__ */ jsx(TableRow, { "data-testid": "status-row-fetching-more", children: /* @__PURE__ */ jsx(TableCell, { colSpan: visibleColumnCount, className: "border-b-0 p-0", children: /* @__PURE__ */ jsx(
|
|
10355
|
+
StatusContentSlot_default,
|
|
10356
|
+
{
|
|
10357
|
+
content: statusContent?.fetchingMore?.content ?? "Loading more...",
|
|
10358
|
+
wrapperProps: statusContent?.fetchingMore?.wrapperProps,
|
|
10359
|
+
defaultWrapperProps: {
|
|
10360
|
+
className: "flex flex-col items-center justify-center text-sm py-4 gap-2",
|
|
10361
|
+
["data-testid"]: "status-content-fetching-more"
|
|
10362
|
+
}
|
|
10363
|
+
}
|
|
10364
|
+
) }) }),
|
|
10365
|
+
activeStatusContentComputed === "noMoreData" && /* @__PURE__ */ jsx(TableRow, { "data-testid": "status-row-no-more-data", children: /* @__PURE__ */ jsx(TableCell, { colSpan: visibleColumnCount, className: "border-b-0 p-0", children: /* @__PURE__ */ jsx(
|
|
10366
|
+
StatusContentSlot_default,
|
|
10367
|
+
{
|
|
10368
|
+
content: statusContent?.noMoreData?.content,
|
|
10369
|
+
icon: statusContent?.noMoreData?.icon,
|
|
10370
|
+
wrapperProps: statusContent?.noMoreData?.wrapperProps,
|
|
10371
|
+
defaultWrapperProps: {
|
|
10372
|
+
className: "flex flex-col items-center justify-center text-sm py-4 gap-2",
|
|
10373
|
+
["data-testid"]: "status-content-no-more-data"
|
|
10374
|
+
}
|
|
10375
|
+
}
|
|
10376
|
+
) }) })
|
|
10377
|
+
] }),
|
|
10378
|
+
hasAnyFooter && /* @__PURE__ */ jsx(
|
|
10379
|
+
TableFooter,
|
|
10380
|
+
{
|
|
10381
|
+
...components?.tableFooterProps,
|
|
10382
|
+
className: cn("sticky bottom-0 z-10 bg-white", components?.tableFooterProps?.className),
|
|
10383
|
+
children: /* @__PURE__ */ jsx(
|
|
10384
|
+
MemoizedTableFooterRows,
|
|
10385
|
+
{
|
|
10386
|
+
table,
|
|
10387
|
+
columnResizing,
|
|
10388
|
+
virtual,
|
|
10389
|
+
columnVirtual,
|
|
10390
|
+
components,
|
|
10391
|
+
isResizing
|
|
10392
|
+
}
|
|
10393
|
+
)
|
|
10394
|
+
}
|
|
10395
|
+
)
|
|
10396
|
+
]
|
|
10397
|
+
}
|
|
10398
|
+
) }),
|
|
10065
10399
|
debug && /* @__PURE__ */ jsx(DataTableDevTool_default, { table })
|
|
10066
10400
|
]
|
|
10067
10401
|
}
|