@sustaina/shared-ui 1.67.1 → 1.68.0
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 +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +122 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +124 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -405,6 +405,15 @@ type DataTableComponentProps<TData> = {
|
|
|
405
405
|
column: Column$1<TData>;
|
|
406
406
|
table: Table$1<TData>;
|
|
407
407
|
}) => React__default.ComponentProps<typeof TableCell>);
|
|
408
|
+
tableFooterProps?: React__default.ComponentProps<typeof TableFooter>;
|
|
409
|
+
tableFooterRowProps?: React__default.ComponentProps<typeof TableRow> | ((info: {
|
|
410
|
+
footerGroup: HeaderGroup<TData>;
|
|
411
|
+
table: Table$1<TData>;
|
|
412
|
+
}) => React__default.ComponentProps<typeof TableRow>);
|
|
413
|
+
tableFooterCellProps?: React__default.ComponentProps<typeof TableHead> | ((info: {
|
|
414
|
+
footer: Header<TData, unknown>;
|
|
415
|
+
table: Table$1<TData>;
|
|
416
|
+
}) => React__default.ComponentProps<typeof TableHead>);
|
|
408
417
|
columnResizerProps?: Omit<ColumnResizerProps, "header">;
|
|
409
418
|
columnSeparatorProps?: DataTableColumnSeparatorProps;
|
|
410
419
|
};
|
|
@@ -467,6 +476,7 @@ declare module "@tanstack/react-table" {
|
|
|
467
476
|
headerProps?: React.ComponentProps<"th">;
|
|
468
477
|
cellProps?: React.ComponentProps<"td">;
|
|
469
478
|
filterCellProps?: React.ComponentProps<"td">;
|
|
479
|
+
footerProps?: React.ComponentProps<"th">;
|
|
470
480
|
useColumnSizing?: boolean;
|
|
471
481
|
columnSeparatorProps?: ColumnSeparatorProps;
|
|
472
482
|
renderColumnFilter?: (props: DataTableColumnFilterProps<TData>) => ReactNode;
|
package/dist/index.d.ts
CHANGED
|
@@ -405,6 +405,15 @@ type DataTableComponentProps<TData> = {
|
|
|
405
405
|
column: Column$1<TData>;
|
|
406
406
|
table: Table$1<TData>;
|
|
407
407
|
}) => React__default.ComponentProps<typeof TableCell>);
|
|
408
|
+
tableFooterProps?: React__default.ComponentProps<typeof TableFooter>;
|
|
409
|
+
tableFooterRowProps?: React__default.ComponentProps<typeof TableRow> | ((info: {
|
|
410
|
+
footerGroup: HeaderGroup<TData>;
|
|
411
|
+
table: Table$1<TData>;
|
|
412
|
+
}) => React__default.ComponentProps<typeof TableRow>);
|
|
413
|
+
tableFooterCellProps?: React__default.ComponentProps<typeof TableHead> | ((info: {
|
|
414
|
+
footer: Header<TData, unknown>;
|
|
415
|
+
table: Table$1<TData>;
|
|
416
|
+
}) => React__default.ComponentProps<typeof TableHead>);
|
|
408
417
|
columnResizerProps?: Omit<ColumnResizerProps, "header">;
|
|
409
418
|
columnSeparatorProps?: DataTableColumnSeparatorProps;
|
|
410
419
|
};
|
|
@@ -467,6 +476,7 @@ declare module "@tanstack/react-table" {
|
|
|
467
476
|
headerProps?: React.ComponentProps<"th">;
|
|
468
477
|
cellProps?: React.ComponentProps<"td">;
|
|
469
478
|
filterCellProps?: React.ComponentProps<"td">;
|
|
479
|
+
footerProps?: React.ComponentProps<"th">;
|
|
470
480
|
useColumnSizing?: boolean;
|
|
471
481
|
columnSeparatorProps?: ColumnSeparatorProps;
|
|
472
482
|
renderColumnFilter?: (props: DataTableColumnFilterProps<TData>) => ReactNode;
|
package/dist/index.js
CHANGED
|
@@ -9239,7 +9239,11 @@ var modelOptions = [
|
|
|
9239
9239
|
"getVisibleLeafColumns",
|
|
9240
9240
|
"getLeftVisibleLeafColumns",
|
|
9241
9241
|
"getRightVisibleLeafColumns",
|
|
9242
|
-
"getCenterVisibleLeafColumns"
|
|
9242
|
+
"getCenterVisibleLeafColumns",
|
|
9243
|
+
"getFooterGroups",
|
|
9244
|
+
"getLeftFooterGroups",
|
|
9245
|
+
"getRightFooterGroups",
|
|
9246
|
+
"getCenterFooterGroups"
|
|
9243
9247
|
];
|
|
9244
9248
|
var DataTableDevTool = ({ table }) => {
|
|
9245
9249
|
const [open, setOpen] = React.useState(false);
|
|
@@ -9669,7 +9673,7 @@ var TableHeaderRows = ({
|
|
|
9669
9673
|
const { isLastLeftPinnedColumn } = getColumnPinningInfo(header.column);
|
|
9670
9674
|
const { isFirstRightPinnedColumn } = getColumnPinningInfo(nextHeader.column);
|
|
9671
9675
|
const headerGroupLength = header.headerGroup.headers.length;
|
|
9672
|
-
const showSeparator = header.index !== headerGroupLength - 1 && !isLastLeftPinnedColumn && !isFirstRightPinnedColumn;
|
|
9676
|
+
const showSeparator = header.index !== headerGroupLength - 1 && !isLastLeftPinnedColumn && !isFirstRightPinnedColumn && (!header.isPlaceholder || !nextHeader.isPlaceholder);
|
|
9673
9677
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9674
9678
|
TableHead,
|
|
9675
9679
|
{
|
|
@@ -9684,7 +9688,7 @@ var TableHeaderRows = ({
|
|
|
9684
9688
|
),
|
|
9685
9689
|
style: {
|
|
9686
9690
|
...style,
|
|
9687
|
-
width: useColumnSizing ? header.
|
|
9691
|
+
width: useColumnSizing ? `calc(var(--header-${header.id}-size, ${header.getSize()}) * 1px)` : void 0,
|
|
9688
9692
|
minWidth: useColumnSizing ? header.column.columnDef.minSize : void 0,
|
|
9689
9693
|
maxWidth: useColumnSizing ? header.column.columnDef.maxSize : void 0,
|
|
9690
9694
|
...tableHeadCellProps?.style,
|
|
@@ -9735,7 +9739,7 @@ var TableFilterRow = ({
|
|
|
9735
9739
|
),
|
|
9736
9740
|
style: {
|
|
9737
9741
|
...style,
|
|
9738
|
-
width: useColumnSizing ? column.getSize() : void 0,
|
|
9742
|
+
width: useColumnSizing ? `calc(var(--col-${column.id}-size, ${column.getSize()}) * 1px)` : void 0,
|
|
9739
9743
|
minWidth: useColumnSizing ? column.columnDef.minSize : void 0,
|
|
9740
9744
|
maxWidth: useColumnSizing ? column.columnDef.maxSize : void 0,
|
|
9741
9745
|
...tableFilterCellProps?.style,
|
|
@@ -9819,7 +9823,7 @@ var TableDataRows = ({
|
|
|
9819
9823
|
),
|
|
9820
9824
|
style: {
|
|
9821
9825
|
...style,
|
|
9822
|
-
width: useColumnSizing ? cell.column.getSize() : void 0,
|
|
9826
|
+
width: useColumnSizing ? `calc(var(--col-${cell.column.id}-size, ${cell.column.getSize()}) * 1px)` : void 0,
|
|
9823
9827
|
minWidth: useColumnSizing ? cell.column.columnDef.minSize : void 0,
|
|
9824
9828
|
maxWidth: useColumnSizing ? cell.column.columnDef.maxSize : void 0,
|
|
9825
9829
|
...tableDataCellProps?.style,
|
|
@@ -9842,6 +9846,67 @@ var TableDataRows = ({
|
|
|
9842
9846
|
) })
|
|
9843
9847
|
] });
|
|
9844
9848
|
};
|
|
9849
|
+
var MemoizedTableDataRows = React__namespace.default.memo(
|
|
9850
|
+
TableDataRows,
|
|
9851
|
+
(prev, next) => prev.table.options.data === next.table.options.data
|
|
9852
|
+
);
|
|
9853
|
+
var TableFooterRows = ({
|
|
9854
|
+
table,
|
|
9855
|
+
columnResizing,
|
|
9856
|
+
components,
|
|
9857
|
+
virtual
|
|
9858
|
+
}) => {
|
|
9859
|
+
const hasAnyFooter = table.getAllColumns().some((col) => col.columnDef.footer != null);
|
|
9860
|
+
if (!hasAnyFooter) return null;
|
|
9861
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: table.getFooterGroups().map((footerGroup) => {
|
|
9862
|
+
const tableFooterRowProps = typeof components?.tableFooterRowProps === "function" ? components.tableFooterRowProps({ footerGroup, table }) : components?.tableFooterRowProps;
|
|
9863
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TableRow, { ...tableFooterRowProps, children: footerGroup.headers.map((footer) => {
|
|
9864
|
+
const { classes, style } = getColumnPinningStyles(footer.column);
|
|
9865
|
+
const useColumnSizing = footer.column.columnDef?.meta?.useColumnSizing ?? columnResizing?.enabled ?? virtual?.enabled ?? false;
|
|
9866
|
+
const tableFooterCellProps = typeof components?.tableFooterCellProps === "function" ? components.tableFooterCellProps({ footer, table }) : components?.tableFooterCellProps;
|
|
9867
|
+
const nextFooter = footerGroup.headers[footer.index + 1] ?? footer;
|
|
9868
|
+
const { isLastLeftPinnedColumn } = getColumnPinningInfo(footer.column);
|
|
9869
|
+
const { isFirstRightPinnedColumn } = getColumnPinningInfo(nextFooter.column);
|
|
9870
|
+
const footerGroupLength = footer.headerGroup.headers.length;
|
|
9871
|
+
const showSeparator = footer.index !== footerGroupLength - 1 && !isLastLeftPinnedColumn && !isFirstRightPinnedColumn && (!footer.isPlaceholder || !nextFooter.isPlaceholder);
|
|
9872
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9873
|
+
TableHead,
|
|
9874
|
+
{
|
|
9875
|
+
"data-testid": `footer-cell-${footer.id}`,
|
|
9876
|
+
colSpan: footer.colSpan,
|
|
9877
|
+
...tableFooterCellProps,
|
|
9878
|
+
...footer.column.columnDef?.meta?.footerProps,
|
|
9879
|
+
className: cn(
|
|
9880
|
+
classes,
|
|
9881
|
+
tableFooterCellProps?.className,
|
|
9882
|
+
footer.column.columnDef?.meta?.footerProps?.className
|
|
9883
|
+
),
|
|
9884
|
+
style: {
|
|
9885
|
+
...style,
|
|
9886
|
+
width: useColumnSizing ? `calc(var(--col-${footer.column.id}-size, ${footer.column.getSize()}) * 1px)` : void 0,
|
|
9887
|
+
minWidth: useColumnSizing ? footer.column.columnDef.minSize : void 0,
|
|
9888
|
+
maxWidth: useColumnSizing ? footer.column.columnDef.maxSize : void 0,
|
|
9889
|
+
...tableFooterCellProps?.style,
|
|
9890
|
+
...footer.column.columnDef?.meta?.footerProps?.style
|
|
9891
|
+
},
|
|
9892
|
+
children: [
|
|
9893
|
+
footer.isPlaceholder ? null : reactTable.flexRender(footer.column.columnDef.footer, footer.getContext()),
|
|
9894
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9895
|
+
ColumnSeparator_default,
|
|
9896
|
+
{
|
|
9897
|
+
...components?.columnSeparatorProps?.headerCell,
|
|
9898
|
+
...footer.column.columnDef?.meta?.columnSeparatorProps,
|
|
9899
|
+
show: footer.column.columnDef?.meta?.columnSeparatorProps?.show ?? components?.columnSeparatorProps?.headerCell?.show ?? showSeparator
|
|
9900
|
+
}
|
|
9901
|
+
),
|
|
9902
|
+
!footer.isPlaceholder && /* @__PURE__ */ jsxRuntime.jsx(ColumnResizer_default, { header: footer, ...components?.columnResizerProps })
|
|
9903
|
+
]
|
|
9904
|
+
},
|
|
9905
|
+
footer.id
|
|
9906
|
+
);
|
|
9907
|
+
}) }, footerGroup.id);
|
|
9908
|
+
}) });
|
|
9909
|
+
};
|
|
9845
9910
|
var DataTable = ({
|
|
9846
9911
|
tableRef,
|
|
9847
9912
|
virtualizerRef,
|
|
@@ -9898,6 +9963,19 @@ var DataTable = ({
|
|
|
9898
9963
|
activeStatusContent
|
|
9899
9964
|
});
|
|
9900
9965
|
const fetchMoreOnScrollReached = useScrollFetch({ scrollFetch, containerRef: tableContainerRef });
|
|
9966
|
+
const columnResizingEnabled = columnResizing?.enabled;
|
|
9967
|
+
const { columnSizing, columnSizingInfo } = table.getState();
|
|
9968
|
+
const columnSizeVars = React.useMemo(() => {
|
|
9969
|
+
if (!columnResizingEnabled && !virtualEnabled) return {};
|
|
9970
|
+
const headers = table.getFlatHeaders();
|
|
9971
|
+
const colSizes = {};
|
|
9972
|
+
for (const header of headers) {
|
|
9973
|
+
colSizes[`--header-${header.id}-size`] = header.getSize();
|
|
9974
|
+
colSizes[`--col-${header.column.id}-size`] = header.column.getSize();
|
|
9975
|
+
}
|
|
9976
|
+
return colSizes;
|
|
9977
|
+
}, [columnSizing, columnSizingInfo, columnResizingEnabled, virtualEnabled]);
|
|
9978
|
+
const isResizing = columnResizingEnabled && !!columnSizingInfo.isResizingColumn;
|
|
9901
9979
|
useBindRef_default({ ref: tableRef, value: table });
|
|
9902
9980
|
useBindRef_default({ ref: virtualizerRef, value: virtualizer });
|
|
9903
9981
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -9940,7 +10018,11 @@ var DataTable = ({
|
|
|
9940
10018
|
Table,
|
|
9941
10019
|
{
|
|
9942
10020
|
...components?.tableProps,
|
|
9943
|
-
style: {
|
|
10021
|
+
style: {
|
|
10022
|
+
tableLayout: virtualEnabled ? "fixed" : "auto",
|
|
10023
|
+
...components?.tableProps?.style,
|
|
10024
|
+
...columnSizeVars
|
|
10025
|
+
},
|
|
9944
10026
|
children: [
|
|
9945
10027
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
9946
10028
|
TableHeader,
|
|
@@ -9971,7 +10053,23 @@ var DataTable = ({
|
|
|
9971
10053
|
]
|
|
9972
10054
|
}
|
|
9973
10055
|
),
|
|
9974
|
-
/* @__PURE__ */ jsxRuntime.jsx(TableBody, { ...components?.tableBodyProps, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10056
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableBody, { ...components?.tableBodyProps, children: isResizing ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
10057
|
+
MemoizedTableDataRows,
|
|
10058
|
+
{
|
|
10059
|
+
table,
|
|
10060
|
+
rowModel,
|
|
10061
|
+
virtualEnabled,
|
|
10062
|
+
virtualItems,
|
|
10063
|
+
virtualizer,
|
|
10064
|
+
paddingTop,
|
|
10065
|
+
paddingBottom,
|
|
10066
|
+
visibleColumnCount,
|
|
10067
|
+
columnResizing,
|
|
10068
|
+
virtual,
|
|
10069
|
+
onRowClick,
|
|
10070
|
+
components
|
|
10071
|
+
}
|
|
10072
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
9975
10073
|
TableDataRows,
|
|
9976
10074
|
{
|
|
9977
10075
|
table,
|
|
@@ -9987,7 +10085,23 @@ var DataTable = ({
|
|
|
9987
10085
|
onRowClick,
|
|
9988
10086
|
components
|
|
9989
10087
|
}
|
|
9990
|
-
) })
|
|
10088
|
+
) }),
|
|
10089
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10090
|
+
TableFooter,
|
|
10091
|
+
{
|
|
10092
|
+
...components?.tableFooterProps,
|
|
10093
|
+
className: cn("sticky bottom-0 z-10 bg-white", components?.tableFooterProps?.className),
|
|
10094
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10095
|
+
TableFooterRows,
|
|
10096
|
+
{
|
|
10097
|
+
table,
|
|
10098
|
+
columnResizing,
|
|
10099
|
+
virtual,
|
|
10100
|
+
components
|
|
10101
|
+
}
|
|
10102
|
+
)
|
|
10103
|
+
}
|
|
10104
|
+
)
|
|
9991
10105
|
]
|
|
9992
10106
|
}
|
|
9993
10107
|
),
|