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.
@@ -243,7 +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}-size) 0 auto`
246
+ ? `var(--col-${column.id.replaceAll('.', '_')}-size) 0 auto`
247
247
  : undefined, left: column.getIsPinned() === 'left'
248
248
  ? `${column.getStart('left')}px`
249
249
  : undefined, ml: table.options.enableColumnVirtualization &&
@@ -267,7 +267,7 @@ const getCommonCellStyles = ({ column, table, tableCellProps, theme, }) => {
267
267
  ? 'none'
268
268
  : `padding 150ms ease-in-out` }, ((tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx) instanceof Function
269
269
  ? tableCellProps.sx(theme)
270
- : tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx)), { minWidth: `max(calc(var(--col-${column.id}-size) * 1px), ${(_g = column.columnDef.minSize) !== null && _g !== void 0 ? _g : 30}px)`, width: `calc(var(--col-${column.id}-size) * 1px)` }));
270
+ : tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx)), { minWidth: `max(calc(var(--col-${column.id.replaceAll('.', '_')}-size) * 1px), ${(_g = column.columnDef.minSize) !== null && _g !== void 0 ? _g : 30}px)`, width: `calc(var(--col-${column.id.replaceAll('.', '_')}-size) * 1px)` }));
271
271
  };
272
272
  const MRT_DefaultColumn = {
273
273
  filterVariant: 'text',
@@ -2627,6 +2627,15 @@ const MRT_Table = ({ table }) => {
2627
2627
  const vProps = columnVirtualizerProps instanceof Function
2628
2628
  ? columnVirtualizerProps({ table })
2629
2629
  : columnVirtualizerProps;
2630
+ const columnSizeVars = useMemo(() => {
2631
+ const headers = getFlatHeaders();
2632
+ const colSizes = {};
2633
+ for (let i = 0; i < headers.length; i++) {
2634
+ const h = headers[i];
2635
+ colSizes[`--col-${h.column.id}-size`.replaceAll('.', '_')] = h.getSize();
2636
+ }
2637
+ return colSizes;
2638
+ }, [columns, columnSizing, columnSizingInfo]);
2630
2639
  //get first 16 column widths and average them
2631
2640
  const averageColumnWidth = useMemo(() => {
2632
2641
  var _a, _b, _c, _d;
@@ -2674,15 +2683,6 @@ const MRT_Table = ({ table }) => {
2674
2683
  virtualPaddingLeft,
2675
2684
  virtualPaddingRight,
2676
2685
  };
2677
- const columnSizeVars = useMemo(() => {
2678
- const headers = getFlatHeaders();
2679
- const colSizes = {};
2680
- for (let i = 0; i < headers.length; i++) {
2681
- const h = headers[i];
2682
- colSizes[`--col-${h.column.id}-size`] = h.getSize();
2683
- }
2684
- return colSizes;
2685
- }, [columns, columnSizing, columnSizingInfo]);
2686
2686
  return (React.createElement(Table, Object.assign({ stickyHeader: enableStickyHeader || isFullScreen }, tableProps, { sx: (theme) => (Object.assign({ borderCollapse: 'separate', display: layoutMode === 'grid' ? 'grid' : 'table', tableLayout: layoutMode !== 'grid' && enableColumnResizing ? 'fixed' : undefined }, ((tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx) instanceof Function
2687
2687
  ? tableProps.sx(theme)
2688
2688
  : tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx))), style: Object.assign(Object.assign({}, columnSizeVars), tableProps === null || tableProps === void 0 ? void 0 : tableProps.style) }),