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.
@@ -137,3 +137,4 @@ export declare const MRT_DefaultDisplayColumn: {
137
137
  readonly enableResizing: false;
138
138
  readonly enableSorting: false;
139
139
  };
140
+ export declare const parseCSSVarId: (id: string) => string;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.7.1",
2
+ "version": "1.7.3",
3
3
  "license": "MIT",
4
4
  "name": "material-react-table",
5
5
  "description": "A fully featured Material UI V5 implementation of TanStack React Table V8, written from the ground up in TypeScript.",
@@ -263,7 +263,7 @@ export const getCommonCellStyles = ({
263
263
  display: table.options.layoutMode === 'grid' ? 'flex' : 'table-cell',
264
264
  flex:
265
265
  table.options.layoutMode === 'grid'
266
- ? `var(--col-${column.id.replaceAll('.', '_')}-size) 0 auto`
266
+ ? `var(--col-${parseCSSVarId(column.id)}-size) 0 auto`
267
267
  : undefined,
268
268
  left:
269
269
  column.getIsPinned() === 'left'
@@ -300,18 +300,16 @@ export const getCommonCellStyles = ({
300
300
  column.getIsPinned() === 'right'
301
301
  ? `${getTotalRight(table, column)}px`
302
302
  : undefined,
303
- transition:
304
- table.options.enableColumnVirtualization || column.getIsResizing()
305
- ? 'none'
306
- : `padding 150ms ease-in-out`,
303
+ transition: table.options.enableColumnVirtualization
304
+ ? 'none'
305
+ : `padding 150ms ease-in-out`,
307
306
  ...(tableCellProps?.sx instanceof Function
308
307
  ? tableCellProps.sx(theme)
309
308
  : (tableCellProps?.sx as any)),
310
- minWidth: `max(calc(var(--col-${column.id.replaceAll(
311
- '.',
312
- '_',
313
- )}-size) * 1px), ${column.columnDef.minSize ?? 30}px)`,
314
- width: `calc(var(--col-${column.id.replaceAll('.', '_')}-size) * 1px)`,
309
+ minWidth: `max(calc(var(--col-${parseCSSVarId(column.id)}-size) * 1px), ${
310
+ column.columnDef.minSize ?? 30
311
+ }px)`,
312
+ width: `calc(var(--col-${parseCSSVarId(column.id)}-size) * 1px)`,
315
313
  });
316
314
 
317
315
  export const MRT_DefaultColumn = {
@@ -335,3 +333,6 @@ export const MRT_DefaultDisplayColumn = {
335
333
  enableResizing: false,
336
334
  enableSorting: false,
337
335
  } as const;
336
+
337
+ export const parseCSSVarId = (id: string) =>
338
+ id.replaceAll('.', '_').replaceAll(' ', '_').replaceAll('+', '_');
@@ -9,6 +9,7 @@ import Table from '@mui/material/Table';
9
9
  import { MRT_TableHead } from '../head/MRT_TableHead';
10
10
  import { Memo_MRT_TableBody, MRT_TableBody } from '../body/MRT_TableBody';
11
11
  import { MRT_TableFooter } from '../footer/MRT_TableFooter';
12
+ import { parseCSSVarId } from '../column.utils';
12
13
  import type { MRT_TableInstance } from '..';
13
14
 
14
15
  interface Props {
@@ -58,7 +59,7 @@ export const MRT_Table = ({ table }: Props) => {
58
59
  const colSizes: { [key: string]: number } = {};
59
60
  for (let i = 0; i < headers.length; i++) {
60
61
  const h = headers[i];
61
- colSizes[`--col-${h.column.id}-size`.replaceAll('.', '_')] = h.getSize();
62
+ colSizes[`--col-${parseCSSVarId(h.column.id)}-size`] = h.getSize();
62
63
  }
63
64
  return colSizes;
64
65
  }, [columns, columnSizing, columnSizingInfo]);