material-react-table 1.7.0 → 1.7.2
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.
@@ -243,7 +243,9 @@ const getCommonCellStyles = ({ column, table, tableCellProps, theme, }) => {
|
|
243
243
|
: getIsFirstRightPinnedColumn(column)
|
244
244
|
? `4px 0 8px -6px ${alpha(theme.palette.common.black, 0.2)} inset`
|
245
245
|
: undefined, display: table.options.layoutMode === 'grid' ? 'flex' : 'table-cell', flex: table.options.layoutMode === 'grid'
|
246
|
-
? `var(--col-${column.id
|
246
|
+
? `var(--col-${column.id
|
247
|
+
.replaceAll('.', '_')
|
248
|
+
.replaceAll(' ', '_')}-size) 0 auto`
|
247
249
|
: undefined, left: column.getIsPinned() === 'left'
|
248
250
|
? `${column.getStart('left')}px`
|
249
251
|
: undefined, ml: table.options.enableColumnVirtualization &&
|
@@ -267,7 +269,11 @@ const getCommonCellStyles = ({ column, table, tableCellProps, theme, }) => {
|
|
267
269
|
? 'none'
|
268
270
|
: `padding 150ms ease-in-out` }, ((tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx) instanceof Function
|
269
271
|
? tableCellProps.sx(theme)
|
270
|
-
: tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx)), { minWidth: `max(calc(var(--col-${column.id
|
272
|
+
: tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx)), { minWidth: `max(calc(var(--col-${column.id
|
273
|
+
.replaceAll('.', '_')
|
274
|
+
.replaceAll(' ', '_')}-size) * 1px), ${(_g = column.columnDef.minSize) !== null && _g !== void 0 ? _g : 30}px)`, width: `calc(var(--col-${column.id
|
275
|
+
.replaceAll('.', '_')
|
276
|
+
.replaceAll(' ', '_')}-size) * 1px)` }));
|
271
277
|
};
|
272
278
|
const MRT_DefaultColumn = {
|
273
279
|
filterVariant: 'text',
|
@@ -2627,6 +2633,15 @@ const MRT_Table = ({ table }) => {
|
|
2627
2633
|
const vProps = columnVirtualizerProps instanceof Function
|
2628
2634
|
? columnVirtualizerProps({ table })
|
2629
2635
|
: columnVirtualizerProps;
|
2636
|
+
const columnSizeVars = useMemo(() => {
|
2637
|
+
const headers = getFlatHeaders();
|
2638
|
+
const colSizes = {};
|
2639
|
+
for (let i = 0; i < headers.length; i++) {
|
2640
|
+
const h = headers[i];
|
2641
|
+
colSizes[`--col-${h.column.id}-size`.replaceAll('.', '_').replaceAll(' ', '_')] = h.getSize();
|
2642
|
+
}
|
2643
|
+
return colSizes;
|
2644
|
+
}, [columns, columnSizing, columnSizingInfo]);
|
2630
2645
|
//get first 16 column widths and average them
|
2631
2646
|
const averageColumnWidth = useMemo(() => {
|
2632
2647
|
var _a, _b, _c, _d;
|
@@ -2674,15 +2689,6 @@ const MRT_Table = ({ table }) => {
|
|
2674
2689
|
virtualPaddingLeft,
|
2675
2690
|
virtualPaddingRight,
|
2676
2691
|
};
|
2677
|
-
const columnSizeVars = useMemo(() => {
|
2678
|
-
const headers = getFlatHeaders();
|
2679
|
-
const colSizes = {};
|
2680
|
-
for (let i = 0; i < headers.length; i++) {
|
2681
|
-
const h = headers[i];
|
2682
|
-
colSizes[`--col-${h.column.id}-size`] = h.getSize();
|
2683
|
-
}
|
2684
|
-
return colSizes;
|
2685
|
-
}, [columns, columnSizing, columnSizingInfo]);
|
2686
2692
|
return (React.createElement(Table, Object.assign({ stickyHeader: enableStickyHeader || isFullScreen }, tableProps, { sx: (theme) => (Object.assign({ borderCollapse: 'separate', display: layoutMode === 'grid' ? 'grid' : 'table', tableLayout: layoutMode !== 'grid' && enableColumnResizing ? 'fixed' : undefined }, ((tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx) instanceof Function
|
2687
2693
|
? tableProps.sx(theme)
|
2688
2694
|
: tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx))), style: Object.assign(Object.assign({}, columnSizeVars), tableProps === null || tableProps === void 0 ? void 0 : tableProps.style) }),
|