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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.7.0",
2
+ "version": "1.7.1",
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}-size) 0 auto`
266
+ ? `var(--col-${column.id.replaceAll('.', '_')}-size) 0 auto`
267
267
  : undefined,
268
268
  left:
269
269
  column.getIsPinned() === 'left'
@@ -307,10 +307,11 @@ export const getCommonCellStyles = ({
307
307
  ...(tableCellProps?.sx instanceof Function
308
308
  ? tableCellProps.sx(theme)
309
309
  : (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)`,
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)`,
314
315
  });
315
316
 
316
317
  export const MRT_DefaultColumn = {
@@ -53,6 +53,16 @@ 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[`--col-${h.column.id}-size`.replaceAll('.', '_')] = h.getSize();
62
+ }
63
+ return colSizes;
64
+ }, [columns, columnSizing, columnSizingInfo]);
65
+
56
66
  //get first 16 column widths and average them
57
67
  const averageColumnWidth = useMemo(() => {
58
68
  if (!enableColumnVirtualization) return 0;
@@ -130,16 +140,6 @@ export const MRT_Table = ({ table }: Props) => {
130
140
  virtualPaddingRight,
131
141
  };
132
142
 
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
143
  return (
144
144
  <Table
145
145
  stickyHeader={enableStickyHeader || isFullScreen}