material-react-table 1.7.1 → 1.7.3
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 +5 -4
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/column.utils.d.ts +1 -0
- package/dist/esm/material-react-table.esm.js +5 -4
- package/dist/esm/material-react-table.esm.js.map +1 -1
- package/dist/esm/types/column.utils.d.ts +1 -0
- package/package.json +1 -1
- package/src/column.utils.ts +11 -10
- package/src/table/MRT_Table.tsx +2 -1
@@ -243,7 +243,7 @@ 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-${parseCSSVarId(column.id)}-size) 0 auto`
|
247
247
|
: undefined, left: column.getIsPinned() === 'left'
|
248
248
|
? `${column.getStart('left')}px`
|
249
249
|
: undefined, ml: table.options.enableColumnVirtualization &&
|
@@ -263,11 +263,11 @@ const getCommonCellStyles = ({ column, table, tableCellProps, theme, }) => {
|
|
263
263
|
? 'sticky'
|
264
264
|
: undefined, right: column.getIsPinned() === 'right'
|
265
265
|
? `${getTotalRight(table, column)}px`
|
266
|
-
: undefined, transition: table.options.enableColumnVirtualization
|
266
|
+
: undefined, transition: table.options.enableColumnVirtualization
|
267
267
|
? 'none'
|
268
268
|
: `padding 150ms ease-in-out` }, ((tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx) instanceof Function
|
269
269
|
? tableCellProps.sx(theme)
|
270
|
-
: tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx)), { minWidth: `max(calc(var(--col-${column.id
|
270
|
+
: tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx)), { minWidth: `max(calc(var(--col-${parseCSSVarId(column.id)}-size) * 1px), ${(_g = column.columnDef.minSize) !== null && _g !== void 0 ? _g : 30}px)`, width: `calc(var(--col-${parseCSSVarId(column.id)}-size) * 1px)` }));
|
271
271
|
};
|
272
272
|
const MRT_DefaultColumn = {
|
273
273
|
filterVariant: 'text',
|
@@ -289,6 +289,7 @@ const MRT_DefaultDisplayColumn = {
|
|
289
289
|
enableResizing: false,
|
290
290
|
enableSorting: false,
|
291
291
|
};
|
292
|
+
const parseCSSVarId = (id) => id.replaceAll('.', '_').replaceAll(' ', '_').replaceAll('+', '_');
|
292
293
|
|
293
294
|
const fuzzy$1 = (row, columnId, filterValue, addMeta) => {
|
294
295
|
const itemRank = rankItem(row.getValue(columnId), filterValue, {
|
@@ -2632,7 +2633,7 @@ const MRT_Table = ({ table }) => {
|
|
2632
2633
|
const colSizes = {};
|
2633
2634
|
for (let i = 0; i < headers.length; i++) {
|
2634
2635
|
const h = headers[i];
|
2635
|
-
colSizes[`--col-${h.column.id}-size
|
2636
|
+
colSizes[`--col-${parseCSSVarId(h.column.id)}-size`] = h.getSize();
|
2636
2637
|
}
|
2637
2638
|
return colSizes;
|
2638
2639
|
}, [columns, columnSizing, columnSizingInfo]);
|