material-react-table 0.26.0 → 0.26.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.
@@ -217,10 +217,12 @@ var MRT_ExpandButton = function MRT_ExpandButton(_ref) {
217
217
  disabled: !row.getCanExpand() && !renderDetailPanel,
218
218
  onClick: handleToggleExpand
219
219
  }, iconButtonProps, {
220
- sx: _extends({
221
- height: density === 'compact' ? '1.75rem' : '2.25rem',
222
- width: density === 'compact' ? '1.75rem' : '2.25rem'
223
- }, iconButtonProps == null ? void 0 : iconButtonProps.sx)
220
+ sx: function sx(theme) {
221
+ return _extends({
222
+ height: density === 'compact' ? '1.75rem' : '2.25rem',
223
+ width: density === 'compact' ? '1.75rem' : '2.25rem'
224
+ }, (iconButtonProps == null ? void 0 : iconButtonProps.sx) instanceof Function ? iconButtonProps.sx(theme) : iconButtonProps == null ? void 0 : iconButtonProps.sx);
225
+ }
224
226
  }), React.createElement(ExpandMoreIcon, {
225
227
  style: {
226
228
  transform: "rotate(" + (!row.getCanExpand() && !renderDetailPanel ? -90 : row.getIsExpanded() ? -180 : 0) + "deg)",
@@ -265,7 +267,7 @@ var MRT_FilterOptionMenu = function MRT_FilterOptionMenu(_ref) {
265
267
  divider: false
266
268
  }, {
267
269
  option: 'contains',
268
- symbol: '[]',
270
+ symbol: '*',
269
271
  label: localization.filterContains,
270
272
  divider: false
271
273
  }, {
@@ -1441,11 +1443,13 @@ var MRT_SelectCheckbox = function MRT_SelectCheckbox(_ref) {
1441
1443
  onChange: !row ? selectAllMode === 'all' ? table.getToggleAllRowsSelectedHandler() : table.getToggleAllPageRowsSelectedHandler() : row.getToggleSelectedHandler(),
1442
1444
  size: density === 'compact' ? 'small' : 'medium'
1443
1445
  }, checkboxProps, {
1444
- sx: _extends({
1445
- height: density === 'compact' ? '1.5rem' : '2rem',
1446
- width: density === 'compact' ? '1.5rem' : '2rem',
1447
- m: '-1re.m'
1448
- }, checkboxProps == null ? void 0 : checkboxProps.sx)
1446
+ sx: function sx(theme) {
1447
+ return _extends({
1448
+ height: density === 'compact' ? '1.5rem' : '2rem',
1449
+ width: density === 'compact' ? '1.5rem' : '2rem',
1450
+ m: '-1re.m'
1451
+ }, (checkboxProps == null ? void 0 : checkboxProps.sx) instanceof Function ? checkboxProps.sx(theme) : checkboxProps == null ? void 0 : checkboxProps.sx);
1452
+ }
1449
1453
  })));
1450
1454
  };
1451
1455
 
@@ -1796,12 +1800,14 @@ var MRT_TablePagination = function MRT_TablePagination(_ref) {
1796
1800
  showFirstButton: showFirstLastPageButtons,
1797
1801
  showLastButton: showFirstLastPageButtons
1798
1802
  }, tablePaginationProps, {
1799
- sx: _extends({
1800
- m: '0 0.5rem',
1801
- mt: position === 'top' && enableToolbarInternalActions && !showGlobalFilter ? '3.5rem' : undefined,
1802
- position: 'relative',
1803
- zIndex: 2
1804
- }, tablePaginationProps == null ? void 0 : tablePaginationProps.sx)
1803
+ sx: function sx(theme) {
1804
+ return _extends({
1805
+ m: '0 0.5rem',
1806
+ mt: position === 'top' && enableToolbarInternalActions && !showGlobalFilter ? '3.5rem' : undefined,
1807
+ position: 'relative',
1808
+ zIndex: 2
1809
+ }, (tablePaginationProps == null ? void 0 : tablePaginationProps.sx) instanceof Function ? tablePaginationProps.sx(theme) : tablePaginationProps == null ? void 0 : tablePaginationProps.sx);
1810
+ }
1805
1811
  }));
1806
1812
  };
1807
1813
 
@@ -1843,17 +1849,19 @@ var MRT_ToolbarAlertBanner = function MRT_ToolbarAlertBanner(_ref) {
1843
1849
  color: "info",
1844
1850
  icon: false
1845
1851
  }, alertProps, {
1846
- sx: _extends({
1847
- borderRadius: 0,
1848
- fontSize: '1rem',
1849
- left: 0,
1850
- p: 0,
1851
- position: 'relative',
1852
- right: 0,
1853
- top: 0,
1854
- width: '100%',
1855
- zIndex: 2
1856
- }, alertProps == null ? void 0 : alertProps.sx)
1852
+ sx: function sx(theme) {
1853
+ return _extends({
1854
+ borderRadius: 0,
1855
+ fontSize: '1rem',
1856
+ left: 0,
1857
+ p: 0,
1858
+ position: 'relative',
1859
+ right: 0,
1860
+ top: 0,
1861
+ width: '100%',
1862
+ zIndex: 2
1863
+ }, (alertProps == null ? void 0 : alertProps.sx) instanceof Function ? alertProps.sx(theme) : alertProps == null ? void 0 : alertProps.sx);
1864
+ }
1857
1865
  }), (alertProps == null ? void 0 : alertProps.title) && React.createElement(AlertTitle, null, alertProps.title), React.createElement(Box, {
1858
1866
  sx: {
1859
1867
  p: '0.5rem 1rem'
@@ -1942,7 +1950,7 @@ var MRT_ToolbarTop = function MRT_ToolbarTop(_ref2) {
1942
1950
  top: isFullScreen ? '0' : undefined
1943
1951
  }, commonToolbarStyles({
1944
1952
  theme: theme
1945
- }), toolbarProps == null ? void 0 : toolbarProps.sx);
1953
+ }), (toolbarProps == null ? void 0 : toolbarProps.sx) instanceof Function ? toolbarProps.sx(theme) : toolbarProps == null ? void 0 : toolbarProps.sx);
1946
1954
  }
1947
1955
  }), positionToolbarAlertBanner === 'top' && React.createElement(MRT_ToolbarAlertBanner, {
1948
1956
  stackAlertBanner: stackAlertBanner,
@@ -2008,7 +2016,7 @@ var MRT_ToolbarBottom = function MRT_ToolbarBottom(_ref) {
2008
2016
  left: 0,
2009
2017
  position: isFullScreen ? 'fixed' : 'relative',
2010
2018
  right: 0
2011
- }, toolbarProps == null ? void 0 : toolbarProps.sx);
2019
+ }, (toolbarProps == null ? void 0 : toolbarProps.sx) instanceof Function ? toolbarProps.sx(theme) : toolbarProps == null ? void 0 : toolbarProps.sx);
2012
2020
  }
2013
2021
  }), React.createElement(MRT_LinearProgressBar, {
2014
2022
  isTopToolbar: false,
@@ -2083,16 +2091,18 @@ var MRT_TableHeadCellColumnActionsButton = function MRT_TableHeadCellColumnActio
2083
2091
  onClick: handleClick,
2084
2092
  size: "small"
2085
2093
  }, iconButtonProps, {
2086
- sx: _extends({
2087
- height: '2rem',
2088
- mt: '-0.2rem',
2089
- opacity: 0.5,
2090
- transition: 'opacity 0.2s',
2091
- width: '2rem',
2092
- '&:hover': {
2093
- opacity: 1
2094
- }
2095
- }, iconButtonProps.sx)
2094
+ sx: function sx(theme) {
2095
+ return _extends({
2096
+ height: '2rem',
2097
+ mt: '-0.2rem',
2098
+ opacity: 0.5,
2099
+ transition: 'opacity 0.2s',
2100
+ width: '2rem',
2101
+ '&:hover': {
2102
+ opacity: 1
2103
+ }
2104
+ }, (iconButtonProps == null ? void 0 : iconButtonProps.sx) instanceof Function ? iconButtonProps.sx(theme) : iconButtonProps == null ? void 0 : iconButtonProps.sx);
2105
+ }
2096
2106
  }), React.createElement(MoreVertIcon, null))), React.createElement(MRT_ColumnActionMenu, {
2097
2107
  anchorEl: anchorEl,
2098
2108
  header: header,
@@ -2277,15 +2287,17 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
2277
2287
  }, React.createElement(CloseIcon, null)))))
2278
2288
  }
2279
2289
  }, textFieldProps, {
2280
- sx: _extends({
2281
- m: '-0.25rem',
2282
- p: 0,
2283
- minWidth: !filterChipLabel ? '8rem' : 'auto',
2284
- width: 'calc(100% + 0.5rem)',
2285
- '& .MuiSelect-icon': {
2286
- mr: '1.5rem'
2287
- }
2288
- }, textFieldProps == null ? void 0 : textFieldProps.sx)
2290
+ sx: function sx(theme) {
2291
+ return _extends({
2292
+ m: '-0.25rem',
2293
+ p: 0,
2294
+ minWidth: !filterChipLabel ? '8rem' : 'auto',
2295
+ width: 'calc(100% + 0.5rem)',
2296
+ '& .MuiSelect-icon': {
2297
+ mr: '1.5rem'
2298
+ }
2299
+ }, (textFieldProps == null ? void 0 : textFieldProps.sx) instanceof Function ? textFieldProps.sx(theme) : textFieldProps == null ? void 0 : textFieldProps.sx);
2300
+ }
2289
2301
  }), isSelectFilter && React.createElement(MenuItem, {
2290
2302
  divider: true,
2291
2303
  disabled: !filterValue,
@@ -2619,7 +2631,7 @@ var MRT_TableHeadCell = function MRT_TableHeadCell(_ref) {
2619
2631
  userSelect: enableMultiSort && column.getCanSort() ? 'none' : undefined,
2620
2632
  verticalAlign: 'top',
2621
2633
  zIndex: column.getIsResizing() || (currentDraggingColumn == null ? void 0 : currentDraggingColumn.id) === column.id ? 3 : column.getIsPinned() && columnDefType !== 'group' ? 2 : 1
2622
- }, tableCellProps == null ? void 0 : tableCellProps.sx, draggingBorders, {
2634
+ }, (tableCellProps == null ? void 0 : tableCellProps.sx) instanceof Function ? tableCellProps.sx(theme) : tableCellProps == null ? void 0 : tableCellProps.sx, draggingBorders, {
2623
2635
  maxWidth: "min(" + column.getSize() + "px, fit-content)",
2624
2636
  minWidth: "max(" + column.getSize() + "px, " + ((_columnDef$minSize = columnDef.minSize) != null ? _columnDef$minSize : 30) + "px)",
2625
2637
  width: header.getSize()
@@ -2640,6 +2652,8 @@ var MRT_TableHeadCell = function MRT_TableHeadCell(_ref) {
2640
2652
  cursor: column.getCanSort() && columnDefType !== 'group' ? 'pointer' : undefined,
2641
2653
  display: 'flex',
2642
2654
  flexWrap: 'nowrap',
2655
+ m: (tableCellProps == null ? void 0 : tableCellProps.align) === 'center' ? 'auto' : undefined,
2656
+ pl: (tableCellProps == null ? void 0 : tableCellProps.align) === 'center' ? '1rem' : undefined,
2643
2657
  whiteSpace: ((_columnDef$header$len = (_columnDef$header = columnDef.header) == null ? void 0 : _columnDef$header.length) != null ? _columnDef$header$len : 0) < 24 ? 'nowrap' : 'normal'
2644
2658
  }
2645
2659
  }, headerElement, column.getCanSort() && React.createElement(MRT_TableHeadCellSortLabel, {
@@ -2841,19 +2855,21 @@ var MRT_CopyButton = function MRT_CopyButton(_ref) {
2841
2855
  type: "button",
2842
2856
  variant: "text"
2843
2857
  }, buttonProps, {
2844
- sx: _extends({
2845
- backgroundColor: 'transparent',
2846
- border: 'none',
2847
- color: 'inherit',
2848
- cursor: 'copy',
2849
- fontFamily: 'inherit',
2850
- fontSize: 'inherit',
2851
- letterSpacing: 'inherit',
2852
- m: '-0.25rem',
2853
- minWidth: 'unset',
2854
- textAlign: 'inherit',
2855
- textTransform: 'inherit'
2856
- }, buttonProps == null ? void 0 : buttonProps.sx)
2858
+ sx: function sx(theme) {
2859
+ return _extends({
2860
+ backgroundColor: 'transparent',
2861
+ border: 'none',
2862
+ color: 'inherit',
2863
+ cursor: 'copy',
2864
+ fontFamily: 'inherit',
2865
+ fontSize: 'inherit',
2866
+ letterSpacing: 'inherit',
2867
+ m: '-0.25rem',
2868
+ minWidth: 'unset',
2869
+ textAlign: 'inherit',
2870
+ textTransform: 'inherit'
2871
+ }, (buttonProps == null ? void 0 : buttonProps.sx) instanceof Function ? buttonProps.sx(theme) : buttonProps == null ? void 0 : buttonProps.sx);
2872
+ }
2857
2873
  }), children));
2858
2874
  };
2859
2875
 
@@ -3008,7 +3024,7 @@ var MRT_TableBodyCell = function MRT_TableBodyCell(_ref) {
3008
3024
  '&:hover': {
3009
3025
  backgroundColor: enableHover && enableEditing && editingMode !== 'row' ? theme.palette.mode === 'dark' ? lighten(theme.palette.background["default"], 0.13) + " !important" : darken(theme.palette.background["default"], 0.07) + " !important" : undefined
3010
3026
  }
3011
- }, tableCellProps == null ? void 0 : tableCellProps.sx, draggingBorders, {
3027
+ }, (tableCellProps == null ? void 0 : tableCellProps.sx) instanceof Function ? tableCellProps.sx(theme) : tableCellProps == null ? void 0 : tableCellProps.sx, draggingBorders, {
3012
3028
  maxWidth: "min(" + column.getSize() + "px, fit-content)",
3013
3029
  minWidth: "max(" + column.getSize() + "px, " + ((_columnDef$minSize = columnDef.minSize) != null ? _columnDef$minSize : 30) + "px)",
3014
3030
  width: column.getSize()
@@ -3059,13 +3075,15 @@ var MRT_TableDetailPanel = function MRT_TableDetailPanel(_ref) {
3059
3075
  return React.createElement(TableRow, Object.assign({}, tableRowProps), React.createElement(TableCell, Object.assign({
3060
3076
  colSpan: getVisibleLeafColumns().length
3061
3077
  }, tableCellProps, {
3062
- sx: _extends({
3063
- borderBottom: !row.getIsExpanded() ? 'none' : undefined,
3064
- pb: row.getIsExpanded() ? '1rem' : 0,
3065
- pt: row.getIsExpanded() ? '1rem' : 0,
3066
- transition: 'all 0.2s ease-in-out',
3067
- width: table.getTotalSize() + "px"
3068
- }, tableCellProps == null ? void 0 : tableCellProps.sx)
3078
+ sx: function sx(theme) {
3079
+ return _extends({
3080
+ borderBottom: !row.getIsExpanded() ? 'none' : undefined,
3081
+ pb: row.getIsExpanded() ? '1rem' : 0,
3082
+ pt: row.getIsExpanded() ? '1rem' : 0,
3083
+ transition: 'all 0.2s ease-in-out',
3084
+ width: table.getTotalSize() + "px"
3085
+ }, (tableCellProps == null ? void 0 : tableCellProps.sx) instanceof Function ? tableCellProps.sx(theme) : tableCellProps == null ? void 0 : tableCellProps.sx);
3086
+ }
3069
3087
  }), renderDetailPanel && React.createElement(Collapse, {
3070
3088
  "in": row.getIsExpanded()
3071
3089
  }, renderDetailPanel({
@@ -3123,7 +3141,7 @@ var MRT_TableBodyRow = function MRT_TableBodyRow(_ref) {
3123
3141
  '&:hover td': {
3124
3142
  backgroundColor: (tableRowProps == null ? void 0 : tableRowProps.hover) !== false && getIsSomeColumnsPinned() ? theme.palette.mode === 'dark' ? "" + lighten(theme.palette.background["default"], 0.12) : "" + darken(theme.palette.background["default"], 0.05) : undefined
3125
3143
  }
3126
- }, tableRowProps == null ? void 0 : tableRowProps.sx, draggingBorders);
3144
+ }, (tableRowProps == null ? void 0 : tableRowProps.sx) instanceof Function ? tableRowProps.sx(theme) : tableRowProps == null ? void 0 : tableRowProps.sx, draggingBorders);
3127
3145
  }
3128
3146
  }), row == null ? void 0 : (_row$getVisibleCells = row.getVisibleCells()) == null ? void 0 : _row$getVisibleCells.map == null ? void 0 : _row$getVisibleCells.map(function (cell) {
3129
3147
  return React.createElement(MRT_TableBodyCell, {
@@ -3259,7 +3277,7 @@ var MRT_TableFooterCell = function MRT_TableFooterCell(_ref) {
3259
3277
  transition: "all " + (enableColumnResizing ? '10ms' : '0.2s') + " ease-in-out",
3260
3278
  width: column.getSize(),
3261
3279
  verticalAlign: 'text-top'
3262
- }, tableCellProps == null ? void 0 : tableCellProps.sx);
3280
+ }, (tableCellProps == null ? void 0 : tableCellProps.sx) instanceof Function ? tableCellProps.sx(theme) : tableCellProps == null ? void 0 : tableCellProps.sx);
3263
3281
  }
3264
3282
  }), React.createElement(React.Fragment, null, footer.isPlaceholder ? null : (_ref2 = (_ref3 = columnDef.Footer instanceof Function ? columnDef.Footer == null ? void 0 : columnDef.Footer({
3265
3283
  footer: footer,
@@ -3327,9 +3345,11 @@ var MRT_Table = function MRT_Table(_ref) {
3327
3345
  return React.createElement(Table, Object.assign({
3328
3346
  stickyHeader: enableStickyHeader || enableRowVirtualization || isFullScreen
3329
3347
  }, tableProps, {
3330
- sx: _extends({
3331
- tableLayout: enableColumnResizing || enableRowVirtualization ? 'fixed' : 'auto'
3332
- }, tableProps == null ? void 0 : tableProps.sx)
3348
+ sx: function sx(theme) {
3349
+ return _extends({
3350
+ tableLayout: enableColumnResizing || enableRowVirtualization ? 'fixed' : 'auto'
3351
+ }, (tableProps == null ? void 0 : tableProps.sx) instanceof Function ? tableProps.sx(theme) : tableProps == null ? void 0 : tableProps.sx);
3352
+ }
3333
3353
  }), enableTableHead && React.createElement(MRT_TableHead, {
3334
3354
  table: table
3335
3355
  }), React.createElement(MRT_TableBody, {
@@ -3371,11 +3391,13 @@ var MRT_TableContainer = function MRT_TableContainer(_ref) {
3371
3391
  return React.createElement(TableContainer, Object.assign({
3372
3392
  ref: tableContainerRef
3373
3393
  }, tableContainerProps, {
3374
- sx: _extends({
3375
- maxWidth: '100%',
3376
- maxHeight: enableStickyHeader || enableRowVirtualization ? "clamp(350px, calc(100vh - " + totalToolbarHeight + "px), 9999px)" : undefined,
3377
- overflow: 'auto'
3378
- }, tableContainerProps == null ? void 0 : tableContainerProps.sx),
3394
+ sx: function sx(theme) {
3395
+ return _extends({
3396
+ maxWidth: '100%',
3397
+ maxHeight: enableStickyHeader || enableRowVirtualization ? "clamp(350px, calc(100vh - " + totalToolbarHeight + "px), 9999px)" : undefined,
3398
+ overflow: 'auto'
3399
+ }, (tableContainerProps == null ? void 0 : tableContainerProps.sx) instanceof Function ? tableContainerProps.sx(theme) : tableContainerProps == null ? void 0 : tableContainerProps.sx);
3400
+ },
3379
3401
  style: _extends({
3380
3402
  maxHeight: isFullScreen ? "calc(100vh - " + totalToolbarHeight + "px)" : undefined
3381
3403
  }, tableContainerProps == null ? void 0 : tableContainerProps.style)
@@ -3630,7 +3652,6 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
3630
3652
  getSubRows: function getSubRows(row) {
3631
3653
  return row == null ? void 0 : row.subRows;
3632
3654
  },
3633
- //@ts-ignore
3634
3655
  globalFilterFn: (_MRT_FilterFns$curren = MRT_FilterFns[currentGlobalFilterFn]) != null ? _MRT_FilterFns$curren : MRT_FilterFns.fuzzy,
3635
3656
  initialState: initialState,
3636
3657
  state: _extends({
@@ -3666,6 +3687,9 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
3666
3687
  setShowGlobalFilter: (_props$onShowGlobalFi = props.onShowGlobalFilterChange) != null ? _props$onShowGlobalFi : setShowGlobalFilter
3667
3688
  });
3668
3689
 
3690
+ useEffect(function () {
3691
+ return props == null ? void 0 : props.onTableInstanceChange == null ? void 0 : props.onTableInstanceChange(table);
3692
+ }, [table]);
3669
3693
  return React.createElement(React.Fragment, null, React.createElement(Dialog, {
3670
3694
  PaperComponent: Box,
3671
3695
  TransitionComponent: Grow,