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.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.7.0",
2
+ "version": "1.7.2",
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,9 @@ 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}-size) 0 auto`
266
+ ? `var(--col-${column.id
267
+ .replaceAll('.', '_')
268
+ .replaceAll(' ', '_')}-size) 0 auto`
267
269
  : undefined,
268
270
  left:
269
271
  column.getIsPinned() === 'left'
@@ -307,10 +309,12 @@ export const getCommonCellStyles = ({
307
309
  ...(tableCellProps?.sx instanceof Function
308
310
  ? tableCellProps.sx(theme)
309
311
  : (tableCellProps?.sx as any)),
310
- minWidth: `max(calc(var(--col-${column.id}-size) * 1px), ${
311
- column.columnDef.minSize ?? 30
312
- }px)`,
313
- width: `calc(var(--col-${column.id}-size) * 1px)`,
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)`,
314
318
  });
315
319
 
316
320
  export const MRT_DefaultColumn = {
@@ -53,6 +53,18 @@ export const MRT_Table = ({ table }: Props) => {
53
53
  ? columnVirtualizerProps({ table })
54
54
  : columnVirtualizerProps;
55
55
 
56
+ const columnSizeVars = useMemo(() => {
57
+ const headers = getFlatHeaders();
58
+ const colSizes: { [key: string]: number } = {};
59
+ for (let i = 0; i < headers.length; i++) {
60
+ const h = headers[i];
61
+ colSizes[
62
+ `--col-${h.column.id}-size`.replaceAll('.', '_').replaceAll(' ', '_')
63
+ ] = h.getSize();
64
+ }
65
+ return colSizes;
66
+ }, [columns, columnSizing, columnSizingInfo]);
67
+
56
68
  //get first 16 column widths and average them
57
69
  const averageColumnWidth = useMemo(() => {
58
70
  if (!enableColumnVirtualization) return 0;
@@ -130,16 +142,6 @@ export const MRT_Table = ({ table }: Props) => {
130
142
  virtualPaddingRight,
131
143
  };
132
144
 
133
- const columnSizeVars = useMemo(() => {
134
- const headers = getFlatHeaders();
135
- const colSizes: { [key: string]: number } = {};
136
- for (let i = 0; i < headers.length; i++) {
137
- const h = headers[i];
138
- colSizes[`--col-${h.column.id}-size`] = h.getSize();
139
- }
140
- return colSizes;
141
- }, [columns, columnSizing, columnSizingInfo]);
142
-
143
145
  return (
144
146
  <Table
145
147
  stickyHeader={enableStickyHeader || isFullScreen}