material-react-table 1.7.0 → 1.7.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/cjs/index.js
CHANGED
@@ -321,7 +321,7 @@ const getCommonCellStyles = ({ column, table, tableCellProps, theme, }) => {
|
|
321
321
|
: getIsFirstRightPinnedColumn(column)
|
322
322
|
? `4px 0 8px -6px ${styles.alpha(theme.palette.common.black, 0.2)} inset`
|
323
323
|
: undefined, display: table.options.layoutMode === 'grid' ? 'flex' : 'table-cell', flex: table.options.layoutMode === 'grid'
|
324
|
-
? `var(--col-${column.id}-size) 0 auto`
|
324
|
+
? `var(--col-${column.id.replaceAll('.', '_')}-size) 0 auto`
|
325
325
|
: undefined, left: column.getIsPinned() === 'left'
|
326
326
|
? `${column.getStart('left')}px`
|
327
327
|
: undefined, ml: table.options.enableColumnVirtualization &&
|
@@ -345,7 +345,7 @@ const getCommonCellStyles = ({ column, table, tableCellProps, theme, }) => {
|
|
345
345
|
? 'none'
|
346
346
|
: `padding 150ms ease-in-out` }, ((tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx) instanceof Function
|
347
347
|
? tableCellProps.sx(theme)
|
348
|
-
: tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx)), { minWidth: `max(calc(var(--col-${column.id}-size) * 1px), ${(_g = column.columnDef.minSize) !== null && _g !== void 0 ? _g : 30}px)`, width: `calc(var(--col-${column.id}-size) * 1px)` }));
|
348
|
+
: tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx)), { minWidth: `max(calc(var(--col-${column.id.replaceAll('.', '_')}-size) * 1px), ${(_g = column.columnDef.minSize) !== null && _g !== void 0 ? _g : 30}px)`, width: `calc(var(--col-${column.id.replaceAll('.', '_')}-size) * 1px)` }));
|
349
349
|
};
|
350
350
|
const MRT_DefaultColumn = {
|
351
351
|
filterVariant: 'text',
|
@@ -2705,6 +2705,15 @@ const MRT_Table = ({ table }) => {
|
|
2705
2705
|
const vProps = columnVirtualizerProps instanceof Function
|
2706
2706
|
? columnVirtualizerProps({ table })
|
2707
2707
|
: columnVirtualizerProps;
|
2708
|
+
const columnSizeVars = React.useMemo(() => {
|
2709
|
+
const headers = getFlatHeaders();
|
2710
|
+
const colSizes = {};
|
2711
|
+
for (let i = 0; i < headers.length; i++) {
|
2712
|
+
const h = headers[i];
|
2713
|
+
colSizes[`--col-${h.column.id}-size`.replaceAll('.', '_')] = h.getSize();
|
2714
|
+
}
|
2715
|
+
return colSizes;
|
2716
|
+
}, [columns, columnSizing, columnSizingInfo]);
|
2708
2717
|
//get first 16 column widths and average them
|
2709
2718
|
const averageColumnWidth = React.useMemo(() => {
|
2710
2719
|
var _a, _b, _c, _d;
|
@@ -2752,15 +2761,6 @@ const MRT_Table = ({ table }) => {
|
|
2752
2761
|
virtualPaddingLeft,
|
2753
2762
|
virtualPaddingRight,
|
2754
2763
|
};
|
2755
|
-
const columnSizeVars = React.useMemo(() => {
|
2756
|
-
const headers = getFlatHeaders();
|
2757
|
-
const colSizes = {};
|
2758
|
-
for (let i = 0; i < headers.length; i++) {
|
2759
|
-
const h = headers[i];
|
2760
|
-
colSizes[`--col-${h.column.id}-size`] = h.getSize();
|
2761
|
-
}
|
2762
|
-
return colSizes;
|
2763
|
-
}, [columns, columnSizing, columnSizingInfo]);
|
2764
2764
|
return (React__default["default"].createElement(Table__default["default"], 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
|
2765
2765
|
? tableProps.sx(theme)
|
2766
2766
|
: tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx))), style: Object.assign(Object.assign({}, columnSizeVars), tableProps === null || tableProps === void 0 ? void 0 : tableProps.style) }),
|