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
@@ -243,9 +243,7 @@ const getCommonCellStyles = ({ column, table, tableCellProps, theme, }) => {
|
|
243
243
|
: getIsFirstRightPinnedColumn(column)
|
244
244
|
? `4px 0 8px -6px ${alpha(theme.palette.common.black, 0.2)} inset`
|
245
245
|
: undefined, display: table.options.layoutMode === 'grid' ? 'flex' : 'table-cell', flex: table.options.layoutMode === 'grid'
|
246
|
-
? `var(--col-${column.id
|
247
|
-
.replaceAll('.', '_')
|
248
|
-
.replaceAll(' ', '_')}-size) 0 auto`
|
246
|
+
? `var(--col-${parseCSSVarId(column.id)}-size) 0 auto`
|
249
247
|
: undefined, left: column.getIsPinned() === 'left'
|
250
248
|
? `${column.getStart('left')}px`
|
251
249
|
: undefined, ml: table.options.enableColumnVirtualization &&
|
@@ -265,15 +263,11 @@ const getCommonCellStyles = ({ column, table, tableCellProps, theme, }) => {
|
|
265
263
|
? 'sticky'
|
266
264
|
: undefined, right: column.getIsPinned() === 'right'
|
267
265
|
? `${getTotalRight(table, column)}px`
|
268
|
-
: undefined, transition: table.options.enableColumnVirtualization
|
266
|
+
: undefined, transition: table.options.enableColumnVirtualization
|
269
267
|
? 'none'
|
270
268
|
: `padding 150ms ease-in-out` }, ((tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx) instanceof Function
|
271
269
|
? tableCellProps.sx(theme)
|
272
|
-
: tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx)), { minWidth: `max(calc(var(--col-${column.id
|
273
|
-
.replaceAll('.', '_')
|
274
|
-
.replaceAll(' ', '_')}-size) * 1px), ${(_g = column.columnDef.minSize) !== null && _g !== void 0 ? _g : 30}px)`, width: `calc(var(--col-${column.id
|
275
|
-
.replaceAll('.', '_')
|
276
|
-
.replaceAll(' ', '_')}-size) * 1px)` }));
|
270
|
+
: tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx)), { minWidth: `max(calc(var(--col-${parseCSSVarId(column.id)}-size) * 1px), ${(_g = column.columnDef.minSize) !== null && _g !== void 0 ? _g : 30}px)`, width: `calc(var(--col-${parseCSSVarId(column.id)}-size) * 1px)` }));
|
277
271
|
};
|
278
272
|
const MRT_DefaultColumn = {
|
279
273
|
filterVariant: 'text',
|
@@ -295,6 +289,7 @@ const MRT_DefaultDisplayColumn = {
|
|
295
289
|
enableResizing: false,
|
296
290
|
enableSorting: false,
|
297
291
|
};
|
292
|
+
const parseCSSVarId = (id) => id.replaceAll('.', '_').replaceAll(' ', '_').replaceAll('+', '_');
|
298
293
|
|
299
294
|
const fuzzy$1 = (row, columnId, filterValue, addMeta) => {
|
300
295
|
const itemRank = rankItem(row.getValue(columnId), filterValue, {
|
@@ -2638,7 +2633,7 @@ const MRT_Table = ({ table }) => {
|
|
2638
2633
|
const colSizes = {};
|
2639
2634
|
for (let i = 0; i < headers.length; i++) {
|
2640
2635
|
const h = headers[i];
|
2641
|
-
colSizes[`--col-${h.column.id}-size
|
2636
|
+
colSizes[`--col-${parseCSSVarId(h.column.id)}-size`] = h.getSize();
|
2642
2637
|
}
|
2643
2638
|
return colSizes;
|
2644
2639
|
}, [columns, columnSizing, columnSizingInfo]);
|