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/dist/cjs/index.js CHANGED
@@ -321,7 +321,9 @@ const getCommonCellStyles = ({ column, table, tableCellProps, theme, }) => {
321
321
  : getIsFirstRightPinnedColumn(column)
322
322
  ? `4px 0 8px -6px ${styles.alpha(theme.palette.common.black, 0.2)} inset`
323
323
  : undefined, display: table.options.layoutMode === 'grid' ? 'flex' : 'table-cell', flex: table.options.layoutMode === 'grid'
324
- ? `var(--col-${column.id}-size) 0 auto`
324
+ ? `var(--col-${column.id
325
+ .replaceAll('.', '_')
326
+ .replaceAll(' ', '_')}-size) 0 auto`
325
327
  : undefined, left: column.getIsPinned() === 'left'
326
328
  ? `${column.getStart('left')}px`
327
329
  : undefined, ml: table.options.enableColumnVirtualization &&
@@ -345,7 +347,11 @@ const getCommonCellStyles = ({ column, table, tableCellProps, theme, }) => {
345
347
  ? 'none'
346
348
  : `padding 150ms ease-in-out` }, ((tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx) instanceof Function
347
349
  ? tableCellProps.sx(theme)
348
- : 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)` }));
350
+ : tableCellProps === null || tableCellProps === void 0 ? void 0 : tableCellProps.sx)), { minWidth: `max(calc(var(--col-${column.id
351
+ .replaceAll('.', '_')
352
+ .replaceAll(' ', '_')}-size) * 1px), ${(_g = column.columnDef.minSize) !== null && _g !== void 0 ? _g : 30}px)`, width: `calc(var(--col-${column.id
353
+ .replaceAll('.', '_')
354
+ .replaceAll(' ', '_')}-size) * 1px)` }));
349
355
  };
350
356
  const MRT_DefaultColumn = {
351
357
  filterVariant: 'text',
@@ -2705,6 +2711,15 @@ const MRT_Table = ({ table }) => {
2705
2711
  const vProps = columnVirtualizerProps instanceof Function
2706
2712
  ? columnVirtualizerProps({ table })
2707
2713
  : columnVirtualizerProps;
2714
+ const columnSizeVars = React.useMemo(() => {
2715
+ const headers = getFlatHeaders();
2716
+ const colSizes = {};
2717
+ for (let i = 0; i < headers.length; i++) {
2718
+ const h = headers[i];
2719
+ colSizes[`--col-${h.column.id}-size`.replaceAll('.', '_').replaceAll(' ', '_')] = h.getSize();
2720
+ }
2721
+ return colSizes;
2722
+ }, [columns, columnSizing, columnSizingInfo]);
2708
2723
  //get first 16 column widths and average them
2709
2724
  const averageColumnWidth = React.useMemo(() => {
2710
2725
  var _a, _b, _c, _d;
@@ -2752,15 +2767,6 @@ const MRT_Table = ({ table }) => {
2752
2767
  virtualPaddingLeft,
2753
2768
  virtualPaddingRight,
2754
2769
  };
2755
- const columnSizeVars = React.useMemo(() => {
2756
- const headers = getFlatHeaders();
2757
- const colSizes = {};
2758
- for (let i = 0; i < headers.length; i++) {
2759
- const h = headers[i];
2760
- colSizes[`--col-${h.column.id}-size`] = h.getSize();
2761
- }
2762
- return colSizes;
2763
- }, [columns, columnSizing, columnSizingInfo]);
2764
2770
  return (React__default["default"].createElement(Table__default["default"], 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
2765
2771
  ? tableProps.sx(theme)
2766
2772
  : tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx))), style: Object.assign(Object.assign({}, columnSizeVars), tableProps === null || tableProps === void 0 ? void 0 : tableProps.style) }),