material-react-table 1.7.2 → 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.2",
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,9 +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
267
- .replaceAll('.', '_')
268
- .replaceAll(' ', '_')}-size) 0 auto`
266
+ ? `var(--col-${parseCSSVarId(column.id)}-size) 0 auto`
269
267
  : undefined,
270
268
  left:
271
269
  column.getIsPinned() === 'left'
@@ -302,19 +300,16 @@ export const getCommonCellStyles = ({
302
300
  column.getIsPinned() === 'right'
303
301
  ? `${getTotalRight(table, column)}px`
304
302
  : undefined,
305
- transition:
306
- table.options.enableColumnVirtualization || column.getIsResizing()
307
- ? 'none'
308
- : `padding 150ms ease-in-out`,
303
+ transition: table.options.enableColumnVirtualization
304
+ ? 'none'
305
+ : `padding 150ms ease-in-out`,
309
306
  ...(tableCellProps?.sx instanceof Function
310
307
  ? tableCellProps.sx(theme)
311
308
  : (tableCellProps?.sx as any)),
312
- minWidth: `max(calc(var(--col-${column.id
313
- .replaceAll('.', '_')
314
- .replaceAll(' ', '_')}-size) * 1px), ${column.columnDef.minSize ?? 30}px)`,
315
- width: `calc(var(--col-${column.id
316
- .replaceAll('.', '_')
317
- .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)`,
318
313
  });
319
314
 
320
315
  export const MRT_DefaultColumn = {
@@ -338,3 +333,6 @@ export const MRT_DefaultDisplayColumn = {
338
333
  enableResizing: false,
339
334
  enableSorting: false,
340
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,9 +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[
62
- `--col-${h.column.id}-size`.replaceAll('.', '_').replaceAll(' ', '_')
63
- ] = h.getSize();
62
+ colSizes[`--col-${parseCSSVarId(h.column.id)}-size`] = h.getSize();
64
63
  }
65
64
  return colSizes;
66
65
  }, [columns, columnSizing, columnSizingInfo]);