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.
- package/dist/cjs/index.js +5 -10
- 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 -10
- 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 -13
- package/src/table/MRT_Table.tsx +2 -3
package/package.json
CHANGED
package/src/column.utils.ts
CHANGED
@@ -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
|
-
|
307
|
-
|
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
|
-
.
|
314
|
-
|
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('+', '_');
|
package/src/table/MRT_Table.tsx
CHANGED
@@ -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]);
|