@redsift/table 9.2.0-muiv5 → 9.2.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.
package/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as _mui_x_data_grid_pro from '@mui/x-data-grid-pro';
2
2
  import { GridFilterItem, GridCellParams, GridFilterOperator, GridFilterInputMultipleValue, DataGridProProps, GridToolbarExportProps, GridToolbarFilterButtonProps, GridFilterModel, GridToolbarColumnsButton, GridToolbarDensitySelector } from '@mui/x-data-grid-pro';
3
- export { GridAlignment, GridColDef, GridColumns, GridFilterItem, GridFilterModel, GridSelectionModel, getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators } from '@mui/x-data-grid-pro';
3
+ export * from '@mui/x-data-grid-pro';
4
+ export { GridAlignment, GridColDef, GridFilterItem, GridFilterModel, getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators } from '@mui/x-data-grid-pro';
4
5
  import { Comp, IconProps, NotificationsColorPalette, ProductColorPalette, ShieldVariant } from '@redsift/design-system';
5
6
  import React, { ReactNode, RefObject, ComponentProps } from 'react';
6
7
 
@@ -9,7 +10,7 @@ declare const DETAIL_PANEL_TOGGLE_COL_DEF: _mui_x_data_grid_pro.GridColDef<any,
9
10
  declare const IS_BETWEEN: {
10
11
  label: string;
11
12
  value: string;
12
- getApplyFilterFn: (filterItem: GridFilterItem) => ((params: GridCellParams) => boolean) | null;
13
+ getApplyFilterFn: (filterItem: GridFilterItem) => ((params: GridCellParams<any, any>) => boolean) | null;
13
14
  InputComponent: (props: any) => JSX.Element;
14
15
  };
15
16
 
package/index.js CHANGED
@@ -1,4 +1,5 @@
1
- import { GRID_DETAIL_PANEL_TOGGLE_COL_DEF, getGridNumericOperators as getGridNumericOperators$1, GridFilterInputMultipleValue, getGridStringOperators as getGridStringOperators$1, GridToolbarContainer, GridToolbarFilterButton, GridToolbarColumnsButton, GridToolbarDensitySelector, GridToolbarExport, gridVisibleSortedRowIdsSelector, useGridApiRef, DataGridPro, gridPaginatedVisibleSortedGridRowEntriesSelector, gridPaginatedVisibleSortedGridRowIdsSelector, gridFilteredSortedRowEntriesSelector, gridFilteredSortedRowIdsSelector } from '@mui/x-data-grid-pro';
1
+ import { GRID_DETAIL_PANEL_TOGGLE_COL_DEF, getGridNumericOperators as getGridNumericOperators$1, GridFilterInputMultipleValue, getGridStringOperators as getGridStringOperators$1, GridToolbarContainer, GridToolbarFilterButton, GridToolbarColumnsButton, GridToolbarDensitySelector, GridToolbarExport, gridExpandedSortedRowIdsSelector, useGridApiRef, DataGridPro, gridPaginatedVisibleSortedGridRowEntriesSelector, gridPaginatedVisibleSortedGridRowIdsSelector, gridFilteredSortedRowEntriesSelector, gridFilteredSortedRowIdsSelector } from '@mui/x-data-grid-pro';
2
+ export * from '@mui/x-data-grid-pro';
2
3
  export { getGridBooleanOperators, getGridDateOperators, getGridSingleSelectOperators } from '@mui/x-data-grid-pro';
3
4
  import * as React from 'react';
4
5
  import React__default, { Children, isValidElement, cloneElement, useLayoutEffect, useEffect, useRef, forwardRef, useState, useCallback, createElement } from 'react';
@@ -17466,7 +17467,7 @@ const isBetweenOperator = {
17466
17467
  label: 'is between',
17467
17468
  value: 'isBetween',
17468
17469
  getApplyFilterFn: filterItem => {
17469
- if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
17470
+ if (!filterItem.field || !filterItem.value || !filterItem.operator) {
17470
17471
  return null;
17471
17472
  }
17472
17473
  if (!Array.isArray(filterItem.value) || filterItem.value.length !== 2) {
@@ -17479,7 +17480,7 @@ const isBetweenOperator = {
17479
17480
  return null;
17480
17481
  }
17481
17482
  return params => {
17482
- return params.value !== null && filterItem.value[0] <= params.value && params.value <= filterItem.value[1];
17483
+ return params.value !== null && params.value !== undefined && filterItem.value[0] <= params.value && params.value <= filterItem.value[1];
17483
17484
  };
17484
17485
  },
17485
17486
  InputComponent: InputNumberInterval
@@ -17492,7 +17493,7 @@ const containsAnyOfOperator = {
17492
17493
  label: 'contains any of',
17493
17494
  value: 'containsAnyOf',
17494
17495
  getApplyFilterFn: filterItem => {
17495
- if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
17496
+ if (!filterItem.field || !filterItem.value || !filterItem.operator) {
17496
17497
  return null;
17497
17498
  }
17498
17499
  return params => {
@@ -17517,7 +17518,7 @@ const endsWithAnyOfOperator = {
17517
17518
  label: 'ends with any of',
17518
17519
  value: 'endsWithAnyOf',
17519
17520
  getApplyFilterFn: filterItem => {
17520
- if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
17521
+ if (!filterItem.field || !filterItem.value || !filterItem.operator) {
17521
17522
  return null;
17522
17523
  }
17523
17524
  return params => {
@@ -17544,7 +17545,7 @@ const isAnyOfOperator = {
17544
17545
  label: 'is any of',
17545
17546
  value: 'isAnyOf',
17546
17547
  getApplyFilterFn: filterItem => {
17547
- if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
17548
+ if (!filterItem.field || !filterItem.value || !filterItem.operator) {
17548
17549
  return null;
17549
17550
  }
17550
17551
  return params => {
@@ -17568,7 +17569,7 @@ const isNotAnyOfOperator = {
17568
17569
  label: 'is not any of',
17569
17570
  value: 'isNotAnyOf',
17570
17571
  getApplyFilterFn: filterItem => {
17571
- if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
17572
+ if (!filterItem.field || !filterItem.value || !filterItem.operator) {
17572
17573
  return null;
17573
17574
  }
17574
17575
  return params => {
@@ -17592,7 +17593,7 @@ const startsWithAnyOfOperator = {
17592
17593
  label: 'starts with any of',
17593
17594
  value: 'startsWithAnyOf',
17594
17595
  getApplyFilterFn: filterItem => {
17595
- if (!filterItem.columnField || !filterItem.value || !filterItem.operatorValue) {
17596
+ if (!filterItem.field || !filterItem.value || !filterItem.operator) {
17596
17597
  return null;
17597
17598
  }
17598
17599
  return params => {
@@ -21709,7 +21710,7 @@ const Toolbar$2 = props => {
21709
21710
  let {
21710
21711
  apiRef
21711
21712
  } = _ref;
21712
- return gridVisibleSortedRowIdsSelector(apiRef);
21713
+ return gridExpandedSortedRowIdsSelector(apiRef);
21713
21714
  }
21714
21715
  },
21715
21716
  printOptions: {
@@ -24165,7 +24166,7 @@ process.env.NODE_ENV !== "production" ? TablePagination.propTypes /* remove-prop
24165
24166
  } : void 0;
24166
24167
  var TablePagination$1 = TablePagination;
24167
24168
 
24168
- const _excluded$1 = ["apiRef", "autoHeight", "className", "components", "componentsProps", "filterModel", "height", "hideToolbar", "initialState", "license", "onFilterModelChange", "onPageChange", "onPageSizeChange", "onSelectionModelChange", "page", "pageSize", "pagination", "paginationPlacement", "rows", "rowsPerPageOptions", "sx"];
24169
+ const _excluded$1 = ["apiRef", "autoHeight", "className", "slots", "slotProps", "filterModel", "height", "hideToolbar", "initialState", "license", "onFilterModelChange", "paginationModel", "onPaginationModelChange", "onRowSelectionModelChange", "pagination", "paginationPlacement", "rows", "pageSizeOptions", "sx"];
24169
24170
  const COMPONENT_NAME$1 = 'DataGrid';
24170
24171
  const CLASSNAME$1 = 'redsift-datagrid';
24171
24172
  const DEFAULT_PROPS = {
@@ -24179,13 +24180,11 @@ const Pagination = _ref => {
24179
24180
  displayPagination = false,
24180
24181
  selectionStatus,
24181
24182
  apiRef,
24182
- page,
24183
- onPageChange,
24184
- pageSize,
24185
- onPageSizeChange,
24186
- rowsPerPageOptions
24183
+ paginationModel,
24184
+ onPaginationModelChange,
24185
+ pageSizeOptions
24187
24186
  } = _ref;
24188
- const rowsCount = apiRef.current.state.pagination.rowCount;
24187
+ const rowsCount = apiRef.current.state.rows.totalRowCount;
24189
24188
  return /*#__PURE__*/React__default.createElement(Flexbox, {
24190
24189
  flexDirection: "row",
24191
24190
  alignItems: "center",
@@ -24195,7 +24194,7 @@ const Pagination = _ref => {
24195
24194
  fontSize: "14px"
24196
24195
  }, `All ${selectionStatus.numberOfSelectedRows}${rowsCount !== selectionStatus.numberOfSelectableRowsInTable ? ' selectable' : ''} rows on this page are selected. `, /*#__PURE__*/React__default.createElement(LinkButton, {
24197
24196
  onClick: () => {
24198
- apiRef.current.selectRows(apiRef.current.getAllRowIds());
24197
+ apiRef.current.selectRows(selectionStatus.selectableRowsInTable ? selectionStatus.selectableRowsInTable : apiRef.current.getAllRowIds());
24199
24198
  }
24200
24199
  }, "Select all ", selectionStatus.numberOfSelectableRowsInTable, rowsCount !== selectionStatus.numberOfSelectableRowsInTable ? ' selectable' : '', " rows in the table.")) : selectionStatus.type === 'table' ? /*#__PURE__*/React__default.createElement(Text, {
24201
24200
  fontSize: "14px"
@@ -24207,51 +24206,56 @@ const Pagination = _ref => {
24207
24206
  fontSize: "14px"
24208
24207
  }, `${selectionStatus.numberOfSelectedRows} row${selectionStatus.numberOfSelectedRows > 1 ? 's' : ''} selected`) : /*#__PURE__*/React__default.createElement(Text, null)) : null, displayPagination ? /*#__PURE__*/React__default.createElement(TablePagination$1, {
24209
24208
  component: "div",
24210
- count: rowsCount,
24211
- page: page,
24212
- onPageChange: (event, newPage) => onPageChange(newPage),
24213
- rowsPerPage: pageSize,
24214
- onRowsPerPageChange: event => onPageSizeChange(parseInt(event.target.value, 10)),
24215
- rowsPerPageOptions: displayRowsPerPage ? rowsPerPageOptions : []
24209
+ count: selectionStatus.selectableRowsInTable.length ? selectionStatus.selectableRowsInTable.length : apiRef.current.getAllRowIds().length,
24210
+ page: paginationModel.page,
24211
+ onPageChange: (event, page) => onPaginationModelChange({
24212
+ page,
24213
+ pageSize: paginationModel.pageSize
24214
+ }),
24215
+ rowsPerPage: paginationModel.pageSize,
24216
+ onRowsPerPageChange: event => onPaginationModelChange({
24217
+ page: paginationModel.page,
24218
+ pageSize: parseInt(event.target.value, 10)
24219
+ }),
24220
+ rowsPerPageOptions: displayRowsPerPage ? pageSizeOptions || [] : []
24216
24221
  }) : null);
24217
24222
  };
24218
24223
  const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
24219
- var _initialState$paginat, _initialState$paginat2;
24224
+ var _initialState$paginat, _initialState$paginat2, _ref4, _ref5, _initialState$paginat3, _initialState$paginat4, _initialState$paginat5, _pageSizeOptions$;
24220
24225
  const datagridRef = ref || useRef();
24221
24226
  const {
24222
24227
  apiRef: propsApiRef,
24223
24228
  autoHeight,
24224
24229
  className,
24225
- components,
24226
- componentsProps,
24230
+ slots,
24231
+ slotProps,
24227
24232
  filterModel: propsFilterModel,
24228
24233
  height: propsHeight,
24229
24234
  hideToolbar,
24230
24235
  initialState,
24231
24236
  license,
24232
24237
  onFilterModelChange: propsOnFilterModelChange,
24233
- onPageChange: propsOnPageChange,
24234
- onPageSizeChange: propsOnPageSizeChange,
24235
- onSelectionModelChange,
24236
- page: propsPage,
24237
- pageSize: propsPageSize,
24238
+ paginationModel: propsPaginationModel,
24239
+ onPaginationModelChange: propsOnPaginationModelChange,
24240
+ onRowSelectionModelChange,
24238
24241
  pagination,
24239
24242
  paginationPlacement,
24240
24243
  rows,
24241
- rowsPerPageOptions,
24244
+ pageSizeOptions,
24242
24245
  sx
24243
24246
  } = props,
24244
24247
  forwardedProps = _objectWithoutProperties(props, _excluded$1);
24245
24248
  const _apiRef = useGridApiRef();
24246
24249
  const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
24247
- const RenderedToolbar = components !== null && components !== void 0 && components.Toolbar ? components.Toolbar : Toolbar$2;
24250
+ const RenderedToolbar = slots !== null && slots !== void 0 && slots.toolbar ? slots.toolbar : Toolbar$2;
24248
24251
  LicenseInfo.setLicenseKey(license);
24249
24252
  const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
24250
24253
  const selectionStatus = useRef({
24251
24254
  type: 'none',
24252
24255
  numberOfSelectedRows: 0,
24253
24256
  numberOfSelectableRowsInPage: 0,
24254
- numberOfSelectableRowsInTable: 0
24257
+ numberOfSelectableRowsInTable: 0,
24258
+ selectableRowsInTable: []
24255
24259
  });
24256
24260
  const [filterModel, setFilterModel] = useState(propsFilterModel);
24257
24261
  useEffect(() => {
@@ -24263,24 +24267,40 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
24263
24267
  } else {
24264
24268
  setFilterModel(model);
24265
24269
  }
24270
+ const selectableRowsInTable = props.isRowSelectable && typeof props.isRowSelectable === 'function' ? gridFilteredSortedRowEntriesSelector(apiRef).filter(_ref2 => {
24271
+ var _props$isRowSelectabl;
24272
+ let {
24273
+ model
24274
+ } = _ref2;
24275
+ return (_props$isRowSelectabl = props.isRowSelectable) === null || _props$isRowSelectabl === void 0 ? void 0 : _props$isRowSelectabl.call(props, {
24276
+ row: model
24277
+ });
24278
+ }).map(_ref3 => {
24279
+ let {
24280
+ id
24281
+ } = _ref3;
24282
+ return id;
24283
+ }) : gridFilteredSortedRowIdsSelector(apiRef);
24284
+ const numberOfSelectableRowsInTable = selectableRowsInTable.length;
24285
+ selectionStatus.current.selectableRowsInTable = selectableRowsInTable;
24286
+ selectionStatus.current.numberOfSelectableRowsInTable = numberOfSelectableRowsInTable;
24266
24287
  };
24267
- const [page, setPage] = React__default.useState((initialState === null || initialState === void 0 ? void 0 : (_initialState$paginat = initialState.pagination) === null || _initialState$paginat === void 0 ? void 0 : _initialState$paginat.page) || propsPage || 0);
24268
- const [pageSize, setPageSize] = React__default.useState((initialState === null || initialState === void 0 ? void 0 : (_initialState$paginat2 = initialState.pagination) === null || _initialState$paginat2 === void 0 ? void 0 : _initialState$paginat2.pageSize) || propsPageSize || (rowsPerPageOptions === null || rowsPerPageOptions === void 0 ? void 0 : rowsPerPageOptions[0]) || 100);
24269
- const onPageChange = page => {
24270
- if (propsOnPageChange) {
24271
- propsOnPageChange(page, undefined);
24288
+ const [paginationModel, setPaginationModel] = useState({
24289
+ pageSize: (initialState === null || initialState === void 0 ? void 0 : (_initialState$paginat = initialState.pagination) === null || _initialState$paginat === void 0 ? void 0 : (_initialState$paginat2 = _initialState$paginat.paginationModel) === null || _initialState$paginat2 === void 0 ? void 0 : _initialState$paginat2.pageSize) || (propsPaginationModel === null || propsPaginationModel === void 0 ? void 0 : propsPaginationModel.pageSize) || 100,
24290
+ page: (_ref4 = (_ref5 = (_initialState$paginat3 = initialState === null || initialState === void 0 ? void 0 : (_initialState$paginat4 = initialState.pagination) === null || _initialState$paginat4 === void 0 ? void 0 : (_initialState$paginat5 = _initialState$paginat4.paginationModel) === null || _initialState$paginat5 === void 0 ? void 0 : _initialState$paginat5.page) !== null && _initialState$paginat3 !== void 0 ? _initialState$paginat3 : propsPaginationModel === null || propsPaginationModel === void 0 ? void 0 : propsPaginationModel.page) !== null && _ref5 !== void 0 ? _ref5 : typeof (pageSizeOptions === null || pageSizeOptions === void 0 ? void 0 : pageSizeOptions[0]) === 'number' ? pageSizeOptions === null || pageSizeOptions === void 0 ? void 0 : pageSizeOptions[0] : pageSizeOptions === null || pageSizeOptions === void 0 ? void 0 : (_pageSizeOptions$ = pageSizeOptions[0]) === null || _pageSizeOptions$ === void 0 ? void 0 : _pageSizeOptions$.value) !== null && _ref4 !== void 0 ? _ref4 : 0
24291
+ });
24292
+ const onPaginationModelChange = model => {
24293
+ if (propsOnPaginationModelChange) {
24294
+ propsOnPaginationModelChange(model, undefined);
24272
24295
  } else {
24273
- setPage(page);
24296
+ setPaginationModel(model);
24274
24297
  }
24275
24298
  };
24276
- const onPageSizeChange = pageSize => {
24277
- if (propsOnPageSizeChange) {
24278
- propsOnPageSizeChange(pageSize, undefined);
24279
- } else {
24280
- setPageSize(pageSize);
24281
- setPage(0);
24299
+ useEffect(() => {
24300
+ if (propsPaginationModel) {
24301
+ setPaginationModel(propsPaginationModel);
24282
24302
  }
24283
- };
24303
+ }, [propsPaginationModel]);
24284
24304
  if (!Array.isArray(rows)) {
24285
24305
  return null;
24286
24306
  }
@@ -24292,47 +24312,47 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
24292
24312
  apiRef: apiRef,
24293
24313
  autoHeight: autoHeight,
24294
24314
  checkboxSelectionVisibleOnly: Boolean(pagination),
24295
- components: _objectSpread2(_objectSpread2({
24296
- BaseButton,
24297
- BaseCheckbox,
24298
- // BaseTextField,
24299
- BasePopper,
24300
- ColumnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24315
+ slots: _objectSpread2(_objectSpread2({
24316
+ baseButton: BaseButton,
24317
+ baseCheckbox: BaseCheckbox,
24318
+ // baseTextField,
24319
+ basePopper: BasePopper,
24320
+ columnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24301
24321
  displayName: "ColumnFilteredIcon"
24302
24322
  })),
24303
- ColumnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24323
+ columnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24304
24324
  displayName: "ColumnSelectorIcon"
24305
24325
  })),
24306
- ColumnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24326
+ columnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24307
24327
  displayName: "ColumnSortedAscendingIcon"
24308
24328
  })),
24309
- ColumnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24329
+ columnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24310
24330
  displayName: "ColumnSortedDescendingIcon"
24311
24331
  })),
24312
- DensityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24332
+ densityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24313
24333
  displayName: "DensityCompactIcon"
24314
24334
  })),
24315
- DensityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24335
+ densityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24316
24336
  displayName: "DensityStandardIcon"
24317
24337
  })),
24318
- DensityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24338
+ densityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24319
24339
  displayName: "DensityComfortableIcon"
24320
24340
  })),
24321
- DetailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24341
+ detailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24322
24342
  displayName: "DetailPanelCollapseIcon"
24323
24343
  })),
24324
- DetailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24344
+ detailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24325
24345
  displayName: "DetailPanelExpandIcon"
24326
24346
  })),
24327
- ExportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24347
+ exportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({}, props, {
24328
24348
  displayName: "ExportIcon"
24329
24349
  })),
24330
- OpenFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({
24350
+ openFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends$2({
24331
24351
  displayName: "OpenFilterButtonIcon",
24332
24352
  fontSize: "medium"
24333
24353
  }, props))
24334
- }, components), {}, {
24335
- Toolbar: props => {
24354
+ }, slots), {}, {
24355
+ toolbar: props => {
24336
24356
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, !hideToolbar ? /*#__PURE__*/React__default.createElement(RenderedToolbar, _extends$2({}, props, {
24337
24357
  filterModel: filterModel,
24338
24358
  onFilterModelChange: onFilterModelChange
@@ -24342,59 +24362,65 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
24342
24362
  displayPagination: ['top', 'both'].includes(paginationPlacement),
24343
24363
  selectionStatus: selectionStatus.current,
24344
24364
  apiRef: apiRef,
24345
- page: page,
24346
- onPageChange: onPageChange,
24347
- pageSize: pageSize,
24348
- onPageSizeChange: onPageSizeChange,
24349
- rowsPerPageOptions: rowsPerPageOptions
24365
+ paginationModel: paginationModel,
24366
+ onPaginationModelChange: onPaginationModelChange,
24367
+ pageSizeOptions: pageSizeOptions
24350
24368
  }) : null);
24351
24369
  },
24352
- Pagination: props => pagination ? /*#__PURE__*/React__default.createElement(Pagination, _extends$2({}, props, {
24370
+ pagination: props => pagination ? /*#__PURE__*/React__default.createElement(Pagination, _extends$2({}, props, {
24353
24371
  displaySelection: false,
24354
24372
  displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
24355
24373
  displayPagination: ['bottom', 'both'].includes(paginationPlacement),
24356
24374
  selectionStatus: selectionStatus.current,
24357
24375
  apiRef: apiRef,
24358
- page: page,
24359
- onPageChange: onPageChange,
24360
- pageSize: pageSize,
24361
- onPageSizeChange: onPageSizeChange,
24362
- rowsPerPageOptions: rowsPerPageOptions
24376
+ paginationModel: paginationModel,
24377
+ onPaginationModelChange: onPaginationModelChange,
24378
+ pageSizeOptions: pageSizeOptions
24363
24379
  })) : null
24364
24380
  }),
24365
- componentsProps: _objectSpread2(_objectSpread2({}, componentsProps), {}, {
24366
- toolbar: _objectSpread2({}, componentsProps === null || componentsProps === void 0 ? void 0 : componentsProps.toolbar)
24381
+ slotProps: _objectSpread2(_objectSpread2({}, slotProps), {}, {
24382
+ toolbar: _objectSpread2({}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.toolbar)
24367
24383
  }),
24368
24384
  filterModel: filterModel,
24369
24385
  initialState: initialState,
24370
24386
  onFilterModelChange: onFilterModelChange,
24371
24387
  pagination: pagination,
24372
24388
  rows: rows,
24373
- rowsPerPageOptions: rowsPerPageOptions,
24374
- page: page,
24375
- onPageChange: onPageChange,
24376
- pageSize: pageSize,
24377
- onPageSizeChange: onPageSizeChange,
24378
- onSelectionModelChange: (newSelectionModel, details) => {
24389
+ pageSizeOptions: pageSizeOptions,
24390
+ paginationModel: paginationModel,
24391
+ onPaginationModelChange: onPaginationModelChange,
24392
+ onRowSelectionModelChange: (newSelectionModel, details) => {
24379
24393
  if (pagination) {
24380
- const numberOfSelectableRowsInPage = props.isRowSelectable && typeof props.isRowSelectable === 'function' ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref2 => {
24381
- var _props$isRowSelectabl;
24394
+ const selectableRowsInPage = props.isRowSelectable && typeof props.isRowSelectable === 'function' ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref6 => {
24395
+ var _props$isRowSelectabl2;
24382
24396
  let {
24383
24397
  model
24384
- } = _ref2;
24385
- return (_props$isRowSelectabl = props.isRowSelectable) === null || _props$isRowSelectabl === void 0 ? void 0 : _props$isRowSelectabl.call(props, {
24398
+ } = _ref6;
24399
+ return (_props$isRowSelectabl2 = props.isRowSelectable) === null || _props$isRowSelectabl2 === void 0 ? void 0 : _props$isRowSelectabl2.call(props, {
24386
24400
  row: model
24387
24401
  });
24388
- }).length : gridPaginatedVisibleSortedGridRowIdsSelector(apiRef).length;
24389
- const numberOfSelectableRowsInTable = props.isRowSelectable && typeof props.isRowSelectable === 'function' ? gridFilteredSortedRowEntriesSelector(apiRef).filter(_ref3 => {
24390
- var _props$isRowSelectabl2;
24402
+ }).map(_ref7 => {
24403
+ let {
24404
+ id
24405
+ } = _ref7;
24406
+ return id;
24407
+ }) : gridPaginatedVisibleSortedGridRowIdsSelector(apiRef);
24408
+ const numberOfSelectableRowsInPage = selectableRowsInPage.length;
24409
+ const selectableRowsInTable = props.isRowSelectable && typeof props.isRowSelectable === 'function' ? gridFilteredSortedRowEntriesSelector(apiRef).filter(_ref8 => {
24410
+ var _props$isRowSelectabl3;
24391
24411
  let {
24392
24412
  model
24393
- } = _ref3;
24394
- return (_props$isRowSelectabl2 = props.isRowSelectable) === null || _props$isRowSelectabl2 === void 0 ? void 0 : _props$isRowSelectabl2.call(props, {
24413
+ } = _ref8;
24414
+ return (_props$isRowSelectabl3 = props.isRowSelectable) === null || _props$isRowSelectabl3 === void 0 ? void 0 : _props$isRowSelectabl3.call(props, {
24395
24415
  row: model
24396
24416
  });
24397
- }).length : gridFilteredSortedRowIdsSelector(apiRef).length;
24417
+ }).map(_ref9 => {
24418
+ let {
24419
+ id
24420
+ } = _ref9;
24421
+ return id;
24422
+ }) : gridFilteredSortedRowIdsSelector(apiRef);
24423
+ const numberOfSelectableRowsInTable = selectableRowsInTable.length;
24398
24424
  const numberOfSelectedRows = newSelectionModel.length;
24399
24425
  if (selectionStatus.current.type === 'table' && numberOfSelectedRows === numberOfSelectableRowsInTable - numberOfSelectableRowsInPage) {
24400
24426
  setTimeout(() => {
@@ -24406,32 +24432,36 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
24406
24432
  type: 'page',
24407
24433
  numberOfSelectedRows,
24408
24434
  numberOfSelectableRowsInPage,
24409
- numberOfSelectableRowsInTable
24435
+ numberOfSelectableRowsInTable,
24436
+ selectableRowsInTable
24410
24437
  };
24411
24438
  } else if (numberOfSelectedRows === numberOfSelectableRowsInTable && numberOfSelectableRowsInPage < numberOfSelectableRowsInTable) {
24412
24439
  selectionStatus.current = {
24413
24440
  type: 'table',
24414
24441
  numberOfSelectedRows,
24415
24442
  numberOfSelectableRowsInPage,
24416
- numberOfSelectableRowsInTable
24443
+ numberOfSelectableRowsInTable,
24444
+ selectableRowsInTable
24417
24445
  };
24418
24446
  } else if (numberOfSelectedRows > 0) {
24419
24447
  selectionStatus.current = {
24420
24448
  type: 'other',
24421
24449
  numberOfSelectedRows,
24422
24450
  numberOfSelectableRowsInPage,
24423
- numberOfSelectableRowsInTable
24451
+ numberOfSelectableRowsInTable,
24452
+ selectableRowsInTable
24424
24453
  };
24425
24454
  } else {
24426
24455
  selectionStatus.current = {
24427
24456
  type: 'none',
24428
24457
  numberOfSelectedRows,
24429
24458
  numberOfSelectableRowsInPage,
24430
- numberOfSelectableRowsInTable
24459
+ numberOfSelectableRowsInTable,
24460
+ selectableRowsInTable
24431
24461
  };
24432
24462
  }
24433
24463
  }
24434
- onSelectionModelChange === null || onSelectionModelChange === void 0 ? void 0 : onSelectionModelChange(newSelectionModel, details);
24464
+ onRowSelectionModelChange === null || onRowSelectionModelChange === void 0 ? void 0 : onRowSelectionModelChange(newSelectionModel, details);
24435
24465
  },
24436
24466
  sx: _objectSpread2(_objectSpread2({}, sx), {}, {
24437
24467
  '.MuiDataGrid-columnHeaders': {