material-react-table 0.41.0 → 1.0.0-beta.0

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.
@@ -1022,7 +1022,7 @@ const MRT_GlobalFilterTextField = ({ table, }) => {
1022
1022
  const textFieldProps = muiSearchTextFieldProps instanceof Function
1023
1023
  ? muiSearchTextFieldProps({ table })
1024
1024
  : muiSearchTextFieldProps;
1025
- return (React.createElement(Collapse, { in: showGlobalFilter, orientation: "horizontal" },
1025
+ return (React.createElement(Collapse, { in: showGlobalFilter, orientation: "horizontal", unmountOnExit: true, mountOnEnter: true },
1026
1026
  React.createElement(TextField, Object.assign({ placeholder: localization.search, onChange: handleChange, value: searchValue !== null && searchValue !== void 0 ? searchValue : '', variant: "standard", InputProps: {
1027
1027
  startAdornment: enableGlobalFilterModes ? (React.createElement(InputAdornment, { position: "start" },
1028
1028
  React.createElement(Tooltip, { arrow: true, title: localization.changeSearchMode },
@@ -1071,11 +1071,11 @@ const MRT_TablePagination = ({ table, position }) => {
1071
1071
  return (React.createElement(TablePagination, Object.assign({ SelectProps: {
1072
1072
  sx: { m: '0 1rem 0 1ch' },
1073
1073
  MenuProps: { MenuListProps: { disablePadding: true } },
1074
- }, component: "div", count: totalRowCount, onPageChange: (_, newPage) => setPageIndex(newPage), onRowsPerPageChange: handleChangeRowsPerPage, page: pageIndex, rowsPerPage: pageSize, rowsPerPageOptions: [5, 10, 15, 20, 25, 30, 50, 100], showFirstButton: showFirstLastPageButtons, showLastButton: showFirstLastPageButtons }, tablePaginationProps, { sx: (theme) => (Object.assign({ m: '0 0.5rem', mt: position === 'top' &&
1074
+ }, component: "div", count: totalRowCount, onPageChange: (_, newPage) => setPageIndex(newPage), onRowsPerPageChange: handleChangeRowsPerPage, page: pageIndex, rowsPerPage: pageSize, rowsPerPageOptions: [5, 10, 15, 20, 25, 30, 50, 100], showFirstButton: showFirstLastPageButtons, showLastButton: showFirstLastPageButtons }, tablePaginationProps, { sx: (theme) => (Object.assign({ mt: position === 'top' &&
1075
1075
  enableToolbarInternalActions &&
1076
1076
  !showGlobalFilter
1077
1077
  ? '3.5rem'
1078
- : undefined, position: 'relative', zIndex: 2 }, ((tablePaginationProps === null || tablePaginationProps === void 0 ? void 0 : tablePaginationProps.sx) instanceof Function
1078
+ : '-0.25rem', position: 'relative', zIndex: 2 }, ((tablePaginationProps === null || tablePaginationProps === void 0 ? void 0 : tablePaginationProps.sx) instanceof Function
1079
1079
  ? tablePaginationProps.sx(theme)
1080
1080
  : tablePaginationProps === null || tablePaginationProps === void 0 ? void 0 : tablePaginationProps.sx))) })));
1081
1081
  };
@@ -1183,7 +1183,7 @@ const MRT_ToggleGlobalFilterButton = (_a) => {
1183
1183
 
1184
1184
  const MRT_ToolbarInternalButtons = ({ table }) => {
1185
1185
  var _a;
1186
- const { options: { enableColumnFilters, enableColumnOrdering, enableDensityToggle, enableFilters, enableFullScreenToggle, enableGlobalFilter, enableHiding, enablePinning, positionGlobalFilter, renderToolbarInternalActions, }, } = table;
1186
+ const { options: { enableColumnFilters, enableColumnOrdering, enableDensityToggle, enableFilters, enableFullScreenToggle, enableGlobalFilter, enableHiding, enablePinning, initialState, renderToolbarInternalActions, }, } = table;
1187
1187
  return (React.createElement(Box, { sx: {
1188
1188
  alignItems: 'center',
1189
1189
  display: 'flex',
@@ -1191,8 +1191,9 @@ const MRT_ToolbarInternalButtons = ({ table }) => {
1191
1191
  } }, (_a = renderToolbarInternalActions === null || renderToolbarInternalActions === void 0 ? void 0 : renderToolbarInternalActions({
1192
1192
  table,
1193
1193
  })) !== null && _a !== void 0 ? _a : (React.createElement(React.Fragment, null,
1194
- enableGlobalFilter && positionGlobalFilter === 'right' && (React.createElement(MRT_GlobalFilterTextField, { table: table })),
1195
- enableFilters && enableGlobalFilter && (React.createElement(MRT_ToggleGlobalFilterButton, { table: table })),
1194
+ enableFilters &&
1195
+ enableGlobalFilter &&
1196
+ !(initialState === null || initialState === void 0 ? void 0 : initialState.showGlobalFilter) && (React.createElement(MRT_ToggleGlobalFilterButton, { table: table })),
1196
1197
  enableFilters && enableColumnFilters && (React.createElement(MRT_ToggleFiltersButton, { table: table })),
1197
1198
  (enableHiding || enableColumnOrdering || enablePinning) && (React.createElement(MRT_ShowHideColumnsButton, { table: table })),
1198
1199
  enableDensityToggle && (React.createElement(MRT_ToggleDensePaddingButton, { table: table })),
@@ -1266,7 +1267,9 @@ const MRT_TopToolbar = ({ table }) => {
1266
1267
  width: '100%',
1267
1268
  } },
1268
1269
  enableGlobalFilter && positionGlobalFilter === 'left' && (React.createElement(MRT_GlobalFilterTextField, { table: table })), (_a = renderTopToolbarCustomActions === null || renderTopToolbarCustomActions === void 0 ? void 0 : renderTopToolbarCustomActions({ table })) !== null && _a !== void 0 ? _a : React.createElement("span", null),
1269
- enableToolbarInternalActions ? (React.createElement(MRT_ToolbarInternalButtons, { table: table })) : (enableGlobalFilter &&
1270
+ enableToolbarInternalActions ? (React.createElement(Box, { sx: { display: 'flex', flexWrap: 'wrap' } },
1271
+ enableGlobalFilter && positionGlobalFilter === 'right' && (React.createElement(MRT_GlobalFilterTextField, { table: table })),
1272
+ React.createElement(MRT_ToolbarInternalButtons, { table: table }))) : (enableGlobalFilter &&
1270
1273
  positionGlobalFilter === 'right' && (React.createElement(MRT_GlobalFilterTextField, { table: table })))),
1271
1274
  enablePagination &&
1272
1275
  ['top', 'both'].includes(positionPagination !== null && positionPagination !== void 0 ? positionPagination : '') && (React.createElement(MRT_TablePagination, { table: table, position: "top" })),
@@ -1294,8 +1297,11 @@ const MRT_BottomToolbar = ({ table }) => {
1294
1297
  positionToolbarAlertBanner === 'bottom' && (React.createElement(MRT_ToolbarAlertBanner, { table: table })),
1295
1298
  ['both', 'bottom'].includes(positionToolbarDropZone !== null && positionToolbarDropZone !== void 0 ? positionToolbarDropZone : '') && (React.createElement(MRT_ToolbarDropZone, { table: table })),
1296
1299
  React.createElement(Box, { sx: {
1300
+ alignItems: 'flex-start',
1301
+ boxSizing: 'border-box',
1297
1302
  display: 'flex',
1298
1303
  justifyContent: 'space-between',
1304
+ p: '0.5rem',
1299
1305
  width: '100%',
1300
1306
  } },
1301
1307
  renderBottomToolbarCustomActions ? (renderBottomToolbarCustomActions({ table })) : (React.createElement("span", null)),