material-react-table 0.9.2 → 0.9.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.
@@ -1912,7 +1912,7 @@ var MRT_ToolbarBottom = function MRT_ToolbarBottom(_ref) {
1912
1912
  }, toolbarProps == null ? void 0 : toolbarProps.sx);
1913
1913
  }
1914
1914
  }), React.createElement(MRT_LinearProgressBar, {
1915
- alignTo: 'top',
1915
+ alignTo: "top",
1916
1916
  tableInstance: tableInstance
1917
1917
  }), positionToolbarAlertBanner === 'bottom' && React.createElement(MRT_ToolbarAlertBanner, {
1918
1918
  tableInstance: tableInstance
@@ -2737,11 +2737,13 @@ var MRT_TableBodyCell = function MRT_TableBodyCell(_ref) {
2737
2737
  editingMode = _tableInstance$option.editingMode,
2738
2738
  enableClickToCopy = _tableInstance$option.enableClickToCopy,
2739
2739
  enableColumnOrdering = _tableInstance$option.enableColumnOrdering,
2740
+ enableColumnResizing = _tableInstance$option.enableColumnResizing,
2740
2741
  enableEditing = _tableInstance$option.enableEditing,
2741
- tableId = _tableInstance$option.tableId,
2742
+ enableRowVirtualization = _tableInstance$option.enableRowVirtualization,
2742
2743
  muiTableBodyCellProps = _tableInstance$option.muiTableBodyCellProps,
2743
2744
  muiTableBodyCellSkeletonProps = _tableInstance$option.muiTableBodyCellSkeletonProps,
2744
2745
  onMrtCellClick = _tableInstance$option.onMrtCellClick,
2746
+ tableId = _tableInstance$option.tableId,
2745
2747
  setColumnOrder = tableInstance.setColumnOrder,
2746
2748
  setCurrentEditingCell = tableInstance.setCurrentEditingCell;
2747
2749
 
@@ -2817,7 +2819,8 @@ var MRT_TableBodyCell = function MRT_TableBodyCell(_ref) {
2817
2819
  tableInstance: tableInstance
2818
2820
  });
2819
2821
  },
2820
- onDoubleClick: handleDoubleClick
2822
+ onDoubleClick: handleDoubleClick,
2823
+ title: (enableRowVirtualization || enableColumnResizing) && !(columnDef != null && columnDef.Cell) && !cell.getIsGrouped() && !columnDef.enableClickToCopy && typeof cell.getValue() === 'string' ? cell.getValue() : ''
2821
2824
  }, tableCellProps, {
2822
2825
  ref: columnDefType === 'data' && enableColumnOrdering ? dropRef : undefined,
2823
2826
  sx: function sx(theme) {
@@ -2826,10 +2829,12 @@ var MRT_TableBodyCell = function MRT_TableBodyCell(_ref) {
2826
2829
  boxShadow: getIsLastLeftPinnedColumn() ? "4px 0 4px -2px " + alpha(theme.palette.common.black, 0.1) : getIsFirstRightPinnedColumn() ? "-4px 0 4px -2px " + alpha(theme.palette.common.black, 0.1) : undefined,
2827
2830
  cursor: isEditable && editingMode === 'cell' ? 'pointer' : 'text',
2828
2831
  left: column.getIsPinned() === 'left' ? column.getStart('left') + "px" : undefined,
2832
+ overflow: 'hidden',
2829
2833
  p: isDensePadding ? columnDefType === 'display' ? '0 0.5rem' : '0.5rem' : columnDefType === 'display' ? '0.5rem 0.75rem' : '1rem',
2830
2834
  pl: column.id === 'mrt-expand' ? row.depth + (isDensePadding ? 0.5 : 0.75) + "rem" : undefined,
2831
2835
  position: column.getIsPinned() ? 'sticky' : 'relative',
2832
2836
  right: column.getIsPinned() === 'right' ? getTotalRight() + "px" : undefined,
2837
+ textOverflow: 'ellipsis',
2833
2838
  transition: 'all 0.2s ease-in-out',
2834
2839
  whiteSpace: isDensePadding ? 'nowrap' : 'normal',
2835
2840
  zIndex: column.getIsPinned() ? 1 : undefined,
@@ -2969,14 +2974,14 @@ var MRT_TableBody = function MRT_TableBody(_ref) {
2969
2974
  tableInstance: tableInstance
2970
2975
  }) : muiTableBodyProps;
2971
2976
  var rows = enablePagination ? getPaginationRowModel().rows : getPrePaginationRowModel().rows;
2972
- var rowVirtualizer = useVirtual({
2977
+ var rowVirtualizer = enableRowVirtualization ? useVirtual({
2973
2978
  overscan: isDensePadding ? 15 : 5,
2974
2979
  size: rows.length,
2975
2980
  parentRef: tableContainerRef
2976
- });
2981
+ }) : {};
2977
2982
  var virtualRows = rowVirtualizer.virtualItems;
2978
- var paddingTop = virtualRows.length > 0 ? virtualRows[0].start : 0;
2979
- var paddingBottom = virtualRows.length > 0 ? rowVirtualizer.totalSize - virtualRows[virtualRows.length - 1].end : 0;
2983
+ var paddingTop = (virtualRows == null ? void 0 : virtualRows.length) > 0 ? virtualRows[0].start : 0;
2984
+ var paddingBottom = (virtualRows == null ? void 0 : virtualRows.length) > 0 ? rowVirtualizer.totalSize - virtualRows[virtualRows.length - 1].end : 0;
2980
2985
  return React.createElement(TableBody, Object.assign({}, tableBodyProps), enableRowVirtualization && paddingTop > 0 && React.createElement("tr", null, React.createElement("td", {
2981
2986
  style: {
2982
2987
  height: paddingTop + "px"
@@ -3089,6 +3094,8 @@ var MRT_Table = function MRT_Table(_ref) {
3089
3094
  var tableContainerRef = _ref.tableContainerRef,
3090
3095
  tableInstance = _ref.tableInstance;
3091
3096
  var _tableInstance$option = tableInstance.options,
3097
+ enableColumnResizing = _tableInstance$option.enableColumnResizing,
3098
+ enableRowVirtualization = _tableInstance$option.enableRowVirtualization,
3092
3099
  enableStickyHeader = _tableInstance$option.enableStickyHeader,
3093
3100
  enableTableFooter = _tableInstance$option.enableTableFooter,
3094
3101
  enableTableHead = _tableInstance$option.enableTableHead,
@@ -3098,7 +3105,11 @@ var MRT_Table = function MRT_Table(_ref) {
3098
3105
  }) : muiTableProps;
3099
3106
  return React.createElement(Table, Object.assign({
3100
3107
  stickyHeader: enableStickyHeader
3101
- }, tableProps), enableTableHead && React.createElement(MRT_TableHead, {
3108
+ }, tableProps, {
3109
+ sx: _extends({
3110
+ tableLayout: enableColumnResizing || enableRowVirtualization ? 'fixed' : undefined
3111
+ }, tableProps == null ? void 0 : tableProps.sx)
3112
+ }), enableTableHead && React.createElement(MRT_TableHead, {
3102
3113
  tableInstance: tableInstance
3103
3114
  }), React.createElement(MRT_TableBody, {
3104
3115
  tableContainerRef: tableContainerRef,
@@ -3468,9 +3479,9 @@ var MaterialReactTable = (function (_ref) {
3468
3479
  columnResizeMode = _ref$columnResizeMode === void 0 ? 'onEnd' : _ref$columnResizeMode,
3469
3480
  _ref$defaultColumn = _ref.defaultColumn,
3470
3481
  defaultColumn = _ref$defaultColumn === void 0 ? {
3471
- minSize: 50,
3482
+ minSize: 30,
3472
3483
  maxSize: 1000,
3473
- size: 150
3484
+ size: 180
3474
3485
  } : _ref$defaultColumn,
3475
3486
  _ref$editingMode = _ref.editingMode,
3476
3487
  editingMode = _ref$editingMode === void 0 ? 'row' : _ref$editingMode,