@redsift/table 12.5.7-muiv7 → 12.5.7-muiv8-alpha.1

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.
@@ -1,3 +1,3 @@
1
- export { B as BaseButton, a as BaseCheckbox, b as BaseIcon, c as BasePopper, m as muiIconToDSIcon } from './BasePopper.js';
1
+ export { B as BaseButton, a as BaseCheckbox, b as BaseIcon, c as BaseIconButton, m as muiIconToDSIcon } from './BaseIconButton.js';
2
2
  export { B as BaseTextField } from './BaseTextField.js';
3
3
  //# sourceMappingURL=BaseComponents.js.map
@@ -0,0 +1,126 @@
1
+ import { a as _objectWithoutProperties, b as _extends } from './_rollupPluginBabelHelpers.js';
2
+ import React__default, { forwardRef } from 'react';
3
+ import { ButtonsColorPalette, IconButton, Button, Checkbox, Icon } from '@redsift/design-system';
4
+ import { mdiFilterVariant, mdiViewColumn, mdiArrowUp, mdiArrowDown, mdiViewHeadline, mdiViewSequential, mdiViewStream, mdiChevronDown, mdiChevronRight, mdiTrayArrowDown } from '@redsift/icons';
5
+
6
+ const _excluded$3 = ["children", "color", "onClick", "startIcon"];
7
+ const BaseButton = /*#__PURE__*/forwardRef((props, ref) => {
8
+ var _props$className;
9
+ const {
10
+ children,
11
+ color: propsColor,
12
+ onClick,
13
+ startIcon
14
+ } = props,
15
+ forwardedProps = _objectWithoutProperties(props, _excluded$3);
16
+ const color = Object.keys(ButtonsColorPalette).includes(propsColor) ? propsColor : 'primary';
17
+ if ((_props$className = props.className) !== null && _props$className !== void 0 && _props$className.includes('redsift-condensed')) {
18
+ return /*#__PURE__*/React__default.createElement(IconButton, _extends({}, forwardedProps, {
19
+ color: color,
20
+ onClick: onClick,
21
+ ref: ref,
22
+ variant: "unstyled",
23
+ isActive: props['aria-expanded'] === 'true',
24
+ icon: typeof startIcon !== 'string' ? /*#__PURE__*/React__default.cloneElement(startIcon, {
25
+ fontSize: 'medium'
26
+ }) : startIcon,
27
+ "aria-label": children,
28
+ size: "medium"
29
+ }));
30
+ }
31
+ return /*#__PURE__*/React__default.createElement(Button, _extends({}, forwardedProps, {
32
+ color: color,
33
+ onClick: onClick,
34
+ ref: ref,
35
+ variant: "unstyled",
36
+ isActive: props['aria-expanded'] === 'true',
37
+ leftIcon: startIcon
38
+ }), children);
39
+ });
40
+
41
+ const _excluded$2 = ["checked", "indeterminate", "disabled", "onChange", "label", "slotProps", "material", "field", "isSelected", "inputProps", "touchRippleRef"];
42
+ const BaseCheckbox = /*#__PURE__*/forwardRef((props, ref) => {
43
+ const {
44
+ checked,
45
+ indeterminate,
46
+ disabled,
47
+ onChange,
48
+ label,
49
+ // MUI DataGrid v8 injects these props — strip them to avoid DOM warnings
50
+ slotProps,
51
+ material,
52
+ field,
53
+ isSelected,
54
+ inputProps,
55
+ touchRippleRef
56
+ } = props,
57
+ forwardedProps = _objectWithoutProperties(props, _excluded$2);
58
+ return /*#__PURE__*/React__default.createElement(Checkbox, _extends({}, forwardedProps, inputProps, {
59
+ isSelected: checked && !indeterminate,
60
+ isDisabled: disabled,
61
+ isIndeterminate: indeterminate,
62
+ ref: ref,
63
+ onChange: (isChecked, value, name, event) => onChange(event),
64
+ "aria-label": label || 'Select row'
65
+ }), label);
66
+ });
67
+
68
+ const _excluded$1 = ["displayName"];
69
+ const muiIconToDSIcon = {
70
+ columnFilteredIcon: mdiFilterVariant,
71
+ columnSelectorIcon: mdiViewColumn,
72
+ columnSortedAscendingIcon: mdiArrowUp,
73
+ columnSortedDescendingIcon: mdiArrowDown,
74
+ densityCompactIcon: mdiViewHeadline,
75
+ densityStandardIcon: mdiViewSequential,
76
+ densityComfortableIcon: mdiViewStream,
77
+ detailPanelCollapseIcon: mdiChevronDown,
78
+ detailPanelExpandIcon: mdiChevronRight,
79
+ exportIcon: mdiTrayArrowDown,
80
+ openFilterButtonIcon: mdiFilterVariant
81
+ };
82
+ const BaseIcon = /*#__PURE__*/forwardRef((props, ref) => {
83
+ const {
84
+ displayName
85
+ } = props,
86
+ forwardedProps = _objectWithoutProperties(props, _excluded$1);
87
+ return /*#__PURE__*/React__default.createElement(Icon, _extends({}, forwardedProps, forwardedProps.inputProps, {
88
+ ref: ref,
89
+ size: forwardedProps.fontSize,
90
+ icon: muiIconToDSIcon[displayName]
91
+ }));
92
+ });
93
+
94
+ const _excluded = ["children", "color", "onClick", "field"];
95
+ const BaseIconButton = /*#__PURE__*/forwardRef((props, ref) => {
96
+ const {
97
+ children,
98
+ color: propsColor,
99
+ onClick,
100
+ field
101
+ } = props,
102
+ forwardedProps = _objectWithoutProperties(props, _excluded);
103
+ const color = Object.keys(ButtonsColorPalette).includes(propsColor) ? propsColor : 'primary';
104
+
105
+ // MUI passes the icon as children (already rendered), but DS IconButton expects an icon prop
106
+ // We pass children directly as the icon - the Icon component can handle ReactElements
107
+ return /*#__PURE__*/React__default.createElement(IconButton, _extends({}, forwardedProps, {
108
+ color: color,
109
+ onClick: onClick,
110
+ ref: ref,
111
+ variant: "unstyled",
112
+ isActive: props['aria-expanded'] === 'true',
113
+ icon: children,
114
+ size: "medium",
115
+ iconProps: {
116
+ style: {
117
+ display: 'flex',
118
+ alignItems: 'center',
119
+ justifyContent: 'center'
120
+ }
121
+ }
122
+ }));
123
+ });
124
+
125
+ export { BaseButton as B, BaseCheckbox as a, BaseIcon as b, BaseIconButton as c, muiIconToDSIcon as m };
126
+ //# sourceMappingURL=BaseIconButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseIconButton.js","sources":["../../src/components/BaseComponents/BaseButton.tsx","../../src/components/BaseComponents/BaseCheckbox.tsx","../../src/components/BaseComponents/BaseIcon.tsx","../../src/components/BaseComponents/BaseIconButton.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { Button, ButtonsColorPalette, IconButton } from '@redsift/design-system';\n\nexport const BaseButton: React.JSXElementConstructor<any> = forwardRef((props, ref) => {\n const { children, color: propsColor, onClick, startIcon, ...forwardedProps } = props;\n\n const color = Object.keys(ButtonsColorPalette).includes(propsColor) ? propsColor : 'primary';\n\n if (props.className?.includes('redsift-condensed')) {\n return (\n <IconButton\n {...forwardedProps}\n color={color}\n onClick={onClick}\n ref={ref}\n variant=\"unstyled\"\n isActive={props['aria-expanded'] === 'true'}\n icon={typeof startIcon !== 'string' ? React.cloneElement(startIcon, { fontSize: 'medium' }) : startIcon}\n aria-label={children}\n size=\"medium\"\n />\n );\n }\n\n return (\n <Button\n {...forwardedProps}\n color={color}\n onClick={onClick}\n ref={ref}\n variant=\"unstyled\"\n isActive={props['aria-expanded'] === 'true'}\n leftIcon={startIcon}\n >\n {children}\n </Button>\n );\n});\n","/* eslint-disable @typescript-eslint/no-unused-vars */\nimport React, { forwardRef, MutableRefObject } from 'react';\nimport { Checkbox } from '@redsift/design-system';\n\nexport const BaseCheckbox: React.JSXElementConstructor<any> = forwardRef((props, ref) => {\n const {\n checked,\n indeterminate,\n disabled,\n onChange,\n label,\n // MUI DataGrid v8 injects these props — strip them to avoid DOM warnings\n slotProps,\n material,\n field,\n isSelected,\n inputProps,\n touchRippleRef,\n ...forwardedProps\n } = props;\n\n return (\n <Checkbox\n {...forwardedProps}\n {...inputProps}\n isSelected={checked && !indeterminate}\n isDisabled={disabled}\n isIndeterminate={indeterminate}\n ref={ref as MutableRefObject<HTMLLabelElement>}\n onChange={(isChecked, value, name, event) => onChange(event)}\n aria-label={label || 'Select row'}\n >\n {label}\n </Checkbox>\n );\n});\n","import React, { forwardRef } from 'react';\nimport { Icon } from '@redsift/design-system';\nimport {\n mdiArrowDown,\n mdiArrowUp,\n mdiChevronDown,\n mdiChevronRight,\n mdiFilterVariant,\n mdiTrayArrowDown,\n mdiViewColumn,\n mdiViewHeadline,\n mdiViewSequential,\n mdiViewStream,\n} from '@redsift/icons';\nimport { GridSlotsComponent } from '@mui/x-data-grid-premium';\n\nexport const muiIconToDSIcon: Partial<Record<keyof GridSlotsComponent, string>> = {\n columnFilteredIcon: mdiFilterVariant,\n columnSelectorIcon: mdiViewColumn,\n columnSortedAscendingIcon: mdiArrowUp,\n columnSortedDescendingIcon: mdiArrowDown,\n densityCompactIcon: mdiViewHeadline,\n densityStandardIcon: mdiViewSequential,\n densityComfortableIcon: mdiViewStream,\n detailPanelCollapseIcon: mdiChevronDown,\n detailPanelExpandIcon: mdiChevronRight,\n exportIcon: mdiTrayArrowDown,\n openFilterButtonIcon: mdiFilterVariant,\n};\n\nexport const BaseIcon: React.JSXElementConstructor<any> = forwardRef((props, ref) => {\n const { displayName, ...forwardedProps } = props;\n\n return (\n <Icon\n {...forwardedProps}\n {...forwardedProps.inputProps}\n ref={ref}\n size={forwardedProps.fontSize}\n icon={muiIconToDSIcon[displayName as keyof GridSlotsComponent]}\n />\n );\n});\n","/* eslint-disable @typescript-eslint/no-unused-vars */\nimport React, { forwardRef } from 'react';\nimport { IconButton, ButtonsColorPalette } from '@redsift/design-system';\n\nexport const BaseIconButton: React.JSXElementConstructor<any> = forwardRef((props, ref) => {\n const { children, color: propsColor, onClick, field, ...forwardedProps } = props;\n\n const color = Object.keys(ButtonsColorPalette).includes(propsColor) ? propsColor : 'primary';\n\n // MUI passes the icon as children (already rendered), but DS IconButton expects an icon prop\n // We pass children directly as the icon - the Icon component can handle ReactElements\n return (\n <IconButton\n {...forwardedProps}\n color={color}\n onClick={onClick}\n ref={ref}\n variant=\"unstyled\"\n isActive={props['aria-expanded'] === 'true'}\n icon={children}\n size=\"medium\"\n iconProps={{ style: { display: 'flex', alignItems: 'center', justifyContent: 'center' } }}\n />\n );\n});\n"],"names":["BaseButton","forwardRef","props","ref","_props$className","children","color","propsColor","onClick","startIcon","forwardedProps","_objectWithoutProperties","_excluded","Object","keys","ButtonsColorPalette","includes","className","React","createElement","IconButton","_extends","variant","isActive","icon","cloneElement","fontSize","size","Button","leftIcon","BaseCheckbox","checked","indeterminate","disabled","onChange","label","slotProps","material","field","isSelected","inputProps","touchRippleRef","Checkbox","isDisabled","isIndeterminate","isChecked","value","name","event","muiIconToDSIcon","columnFilteredIcon","mdiFilterVariant","columnSelectorIcon","mdiViewColumn","columnSortedAscendingIcon","mdiArrowUp","columnSortedDescendingIcon","mdiArrowDown","densityCompactIcon","mdiViewHeadline","densityStandardIcon","mdiViewSequential","densityComfortableIcon","mdiViewStream","detailPanelCollapseIcon","mdiChevronDown","detailPanelExpandIcon","mdiChevronRight","exportIcon","mdiTrayArrowDown","openFilterButtonIcon","BaseIcon","displayName","Icon","BaseIconButton","iconProps","style","display","alignItems","justifyContent"],"mappings":";;;;;;AAGO,MAAMA,UAA4C,gBAAGC,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAK;AAAA,EAAA,IAAAC,gBAAA,CAAA;EACrF,MAAM;MAAEC,QAAQ;AAAEC,MAAAA,KAAK,EAAEC,UAAU;MAAEC,OAAO;AAAEC,MAAAA,SAAAA;AAA6B,KAAC,GAAGP,KAAK;AAAxBQ,IAAAA,cAAc,GAAAC,wBAAA,CAAKT,KAAK,EAAAU,WAAA,CAAA,CAAA;AAEpF,EAAA,MAAMN,KAAK,GAAGO,MAAM,CAACC,IAAI,CAACC,mBAAmB,CAAC,CAACC,QAAQ,CAACT,UAAU,CAAC,GAAGA,UAAU,GAAG,SAAS,CAAA;AAE5F,EAAA,IAAA,CAAAH,gBAAA,GAAIF,KAAK,CAACe,SAAS,MAAAb,IAAAA,IAAAA,gBAAA,KAAfA,KAAAA,CAAAA,IAAAA,gBAAA,CAAiBY,QAAQ,CAAC,mBAAmB,CAAC,EAAE;IAClD,oBACEE,cAAA,CAAAC,aAAA,CAACC,UAAU,EAAAC,QAAA,KACLX,cAAc,EAAA;AAClBJ,MAAAA,KAAK,EAAEA,KAAM;AACbE,MAAAA,OAAO,EAAEA,OAAQ;AACjBL,MAAAA,GAAG,EAAEA,GAAI;AACTmB,MAAAA,OAAO,EAAC,UAAU;AAClBC,MAAAA,QAAQ,EAAErB,KAAK,CAAC,eAAe,CAAC,KAAK,MAAO;MAC5CsB,IAAI,EAAE,OAAOf,SAAS,KAAK,QAAQ,gBAAGS,cAAK,C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C,UAAU;MAAEC,OAAO;AAAE8B,MAAAA,KAAAA;AAAyB,KAAC,GAAGpC,KAAK;AAAxBQ,IAAAA,cAAc,GAAAC,wBAAA,CAAKT,KAAK,EAAAU,SAAA,CAAA,CAAA;AAEhF,EAAA,MAAMN,KAAK,GAAGO,MAAM,CAACC,IAAI,CAACC,mBAAmB,CAAC,CAACC,QAAQ,CAACT,UAAU,CAAC,GAAGA,UAAU,GAAG,SAAS,CAAA;;AAE5F;AACA;EACA,oBACEW,cAAA,CAAAC,aAAA,CAACC,UAAU,EAAAC,QAAA,KACLX,cAAc,EAAA;AAClBJ,IAAAA,KAAK,EAAEA,KAAM;AACbE,IAAAA,OAAO,EAAEA,OAAQ;AACjBL,IAAAA,GAAG,EAAEA,GAAI;AACTmB,IAAAA,OAAO,EAAC,UAAU;AAClBC,IAAAA,QAAQ,EAAErB,KAAK,CAAC,eAAe,CAAC,KAAK,MAAO;AAC5CsB,IAAAA,IAAI,EAAEnB,QAAS;AACfsB,IAAAA,IAAI,EAAC,QAAQ;AACbgD,IAAAA,SAAS,EAAE;AAAEC,MAAAA,KAAK,EAAE;AAAEC,QAAAA,OAAO,EAAE,MAAM;AAAEC,QAAAA,UAAU,EAAE,QAAQ;AAAEC,QAAAA,cAAc,EAAE,QAAA;AAAS,OAAA;AAAE,KAAA;AAAE,GAAA,CAC3F,CAAC,CAAA;AAEN,CAAC;;;;"}
@@ -1,14 +1,15 @@
1
1
  import { a as _objectWithoutProperties, b as _extends, _ as _objectSpread2 } from './_rollupPluginBabelHelpers.js';
2
2
  import React__default, { forwardRef, useRef, useState, useEffect, useMemo } from 'react';
3
+ import { createTheme, ThemeProvider as ThemeProvider$1 } from '@mui/material/styles';
3
4
  import classNames from 'classnames';
5
+ import { LicenseInfo } from '@mui/x-license';
4
6
  import { useTheme, RedsiftColorBlueN, RedsiftColorNeutralXDarkGrey, RedsiftColorNeutralWhite, ThemeProvider } from '@redsift/design-system';
5
- import { useGridApiRef, gridFilteredSortedRowEntriesSelector, gridFilteredSortedRowIdsSelector, DataGridPro } from '@mui/x-data-grid-pro';
6
- import { L as LicenseInfo, u as useControlledDatagridState, T as ThemeProvider$1, S as StyledDataGrid, B as BelowToolbar, a as BottomPagination, b as baseGridSlots } from './useControlledDatagridState.js';
7
+ import { useGridApiRef, gridFilteredSortedRowEntriesSelector, gridFilteredSortedRowIdsSelector, DataGridPremium } from '@mui/x-data-grid-premium';
8
+ import { u as useControlledDatagridState, S as StyledDataGrid, B as BottomPagination, b as baseGridSlots, a as BelowToolbar } from './useControlledDatagridState.js';
9
+ import { n as normalizeRowSelectionModel, o as onServerSideSelectionStatusChange, g as getSelectionCount, i as isRowSelected, S as ServerSideControlledPagination, C as ControlledPagination, f as fixServerSideHeaderCheckboxSelection } from './ServerSideControlledPagination.js';
7
10
  import { T as Toolbar } from './Toolbar2.js';
8
- import { o as onServerSideSelectionStatusChange, f as fixServerSideHeaderCheckboxSelection } from './ServerSideControlledPagination.js';
9
- import { b as createTheme } from './Portal.js';
10
11
 
11
- const _excluded = ["apiRef", "autoHeight", "className", "slots", "slotProps", "filterModel", "columnVisibilityModel", "pinnedColumns", "sortModel", "paginationModel", "height", "hideToolbar", "initialState", "isRowSelectable", "license", "onFilterModelChange", "rowSelectionModel", "onPaginationModelChange", "onRowSelectionModelChange", "onColumnVisibilityModelChange", "onPinnedColumnsChange", "onSortModelChange", "pagination", "paginationPlacement", "selectionBannerPlacement", "paginationProps", "rows", "pageSizeOptions", "sx", "theme", "paginationMode", "rowCount"];
12
+ const _excluded = ["apiRef", "autoHeight", "className", "slots", "slotProps", "filterModel", "columnVisibilityModel", "pinnedColumns", "sortModel", "paginationModel", "height", "hideToolbar", "initialState", "isRowSelectable", "license", "onFilterModelChange", "rowSelectionModel", "onPaginationModelChange", "onRowSelectionModelChange", "onColumnVisibilityModelChange", "onPinnedColumnsChange", "onSortModelChange", "pagination", "paginationPlacement", "selectionBannerPlacement", "paginationProps", "rows", "pageSizeOptions", "sx", "theme", "paginationMode", "rowCount", "density"];
12
13
  const COMPONENT_NAME = 'DataGrid';
13
14
  const CLASSNAME = 'redsift-datagrid';
14
15
 
@@ -85,6 +86,7 @@ const CLASSNAME = 'redsift-datagrid';
85
86
  */
86
87
 
87
88
  const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
89
+ var _ref6, _ref7;
88
90
  const datagridRef = ref || useRef();
89
91
  const {
90
92
  apiRef: propsApiRef,
@@ -114,17 +116,17 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
114
116
  selectionBannerPlacement = 'top',
115
117
  paginationProps,
116
118
  rows,
117
- pageSizeOptions,
119
+ pageSizeOptions = [5, 10, 25, 50],
118
120
  sx,
119
121
  theme: propsTheme,
120
122
  paginationMode = 'client',
121
- rowCount
123
+ rowCount,
124
+ density
122
125
  } = props,
123
126
  forwardedProps = _objectWithoutProperties(props, _excluded);
124
127
  const theme = useTheme(propsTheme);
125
128
  const _apiRef = useGridApiRef();
126
129
  const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
127
- const RenderedToolbar = slots !== null && slots !== void 0 && slots.toolbar ? slots.toolbar : Toolbar;
128
130
  LicenseInfo.setLicenseKey(license);
129
131
  const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
130
132
  const {
@@ -152,9 +154,9 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
152
154
  propsSortModel,
153
155
  propsOnPaginationModelChange
154
156
  });
155
- const [rowSelectionModel, setRowSelectionModel] = useState(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
157
+ const [rowSelectionModel, setRowSelectionModel] = useState(() => normalizeRowSelectionModel(propsRowSelectionModel));
156
158
  useEffect(() => {
157
- setRowSelectionModel(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
159
+ setRowSelectionModel(normalizeRowSelectionModel(propsRowSelectionModel));
158
160
  }, [propsRowSelectionModel]);
159
161
  const onRowSelectionModelChange = (selectionModel, details) => {
160
162
  setRowSelectionModel(selectionModel);
@@ -173,22 +175,33 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
173
175
  // Version counter to force re-renders when selectionStatus ref changes
174
176
  const [, forceSelectionUpdate] = useState(0);
175
177
 
178
+ // Track when the grid API is ready to ensure top pagination renders correctly
179
+ const [gridReady, setGridReady] = useState(false);
180
+
176
181
  // The checkboxSelectionVisibleOnly should only be applied to client-side pagination,
177
182
  // for server-side pagination it produces inconsistent behavior when selecting all rows in pages 2 and beyond
178
183
  const checkboxSelectionVisibleOnly = Boolean(pagination) && Boolean(paginationMode != 'server');
179
184
 
180
185
  // Banner and pager placements are independent. `belowToolbar` (for either) renders
181
- // in the toolbar-slot row, and only applies when pagination is on.
186
+ // in a row inside the toolbar slot, and only applies when pagination is on.
182
187
  const bannerAtTop = selectionBannerPlacement === 'top';
183
188
  const bannerAtBottom = selectionBannerPlacement === 'bottom';
184
189
  const bannerBelowToolbar = selectionBannerPlacement === 'belowToolbar' && Boolean(pagination);
185
190
  const pagerBelowToolbar = paginationPlacement === 'belowToolbar' && Boolean(pagination);
191
+ const belowToolbarActive = bannerBelowToolbar || pagerBelowToolbar;
192
+
193
+ // Force re-render when the grid API becomes ready (for top pagination)
194
+ useEffect(() => {
195
+ if (apiRef.current && !gridReady) {
196
+ setGridReady(true);
197
+ }
198
+ });
186
199
 
187
200
  // in server-side pagination we want to update the selection status
188
201
  // every time we navigate between pages, resize our page or select something
189
202
  useEffect(() => {
190
203
  if (paginationMode == 'server') {
191
- onServerSideSelectionStatusChange(Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel], apiRef, selectionStatusRef, forceSelectionUpdate, isRowSelectable, paginationModel.page, paginationModel.pageSize);
204
+ onServerSideSelectionStatusChange(rowSelectionModel, apiRef, selectionStatusRef, forceSelectionUpdate, isRowSelectable, paginationModel.page, paginationModel.pageSize);
192
205
  }
193
206
  }, [rowSelectionModel, paginationModel.page, paginationModel.pageSize, rows]);
194
207
  if (!Array.isArray(rows)) {
@@ -200,15 +213,15 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
200
213
  // receive the fresh value in the same render cycle — no extra re-render needed.
201
214
  // The ref is kept in sync for the onRowSelectionModelChange callback's deselect logic.
202
215
  let selectionStatus = selectionStatusRef.current;
203
- if (pagination && paginationMode !== 'server' && Array.isArray(rowSelectionModel) && rowSelectionModel.length > 0) {
216
+ if (pagination && paginationMode !== 'server' && getSelectionCount(rowSelectionModel) > 0) {
204
217
  try {
205
- // Use manual page slicing with our React state's paginationModel instead of
206
- // gridPaginatedVisibleSortedGridRow*Selector(apiRef). In MUI v7, the apiRef's
207
- // internal pagination state can lag behind the React state after a page change,
208
- // causing the selection status to be one page behind.
218
+ // Use manual page slicing instead of gridPaginatedVisibleSorted* selectors.
219
+ // MUI's paginated selectors use apiRef internal state which may be stale when
220
+ // paginationModel prop changes our React state is always up to date.
221
+ const allFilteredEntries = gridFilteredSortedRowEntriesSelector(apiRef);
209
222
  const pageStart = paginationModel.page * paginationModel.pageSize;
210
- const pageEnd = pageStart + paginationModel.pageSize;
211
- const selectableRowsInPage = isRowSelectable ? gridFilteredSortedRowEntriesSelector(apiRef).slice(pageStart, pageEnd).filter(_ref => {
223
+ const pageEntries = allFilteredEntries.slice(pageStart, pageStart + paginationModel.pageSize);
224
+ const selectableRowsInPage = isRowSelectable ? pageEntries.filter(_ref => {
212
225
  let {
213
226
  model
214
227
  } = _ref;
@@ -220,24 +233,29 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
220
233
  id
221
234
  } = _ref2;
222
235
  return id;
223
- }) : gridFilteredSortedRowIdsSelector(apiRef).slice(pageStart, pageEnd);
236
+ }) : pageEntries.map(_ref3 => {
237
+ let {
238
+ id
239
+ } = _ref3;
240
+ return id;
241
+ });
224
242
  const numberOfSelectableRowsInPage = selectableRowsInPage.length;
225
- const selectableRowsInTable = isRowSelectable ? gridFilteredSortedRowEntriesSelector(apiRef).filter(_ref3 => {
243
+ const selectableRowsInTable = isRowSelectable ? allFilteredEntries.filter(_ref4 => {
226
244
  let {
227
245
  model
228
- } = _ref3;
246
+ } = _ref4;
229
247
  return isRowSelectable({
230
248
  row: model
231
249
  });
232
- }).map(_ref4 => {
250
+ }).map(_ref5 => {
233
251
  let {
234
252
  id
235
- } = _ref4;
253
+ } = _ref5;
236
254
  return id;
237
255
  }) : gridFilteredSortedRowIdsSelector(apiRef);
238
256
  const numberOfSelectableRowsInTable = selectableRowsInTable.length;
239
- const numberOfSelectedRows = rowSelectionModel.length;
240
- const selectedOnCurrentPage = selectableRowsInPage.filter(id => rowSelectionModel.includes(id));
257
+ const numberOfSelectedRows = getSelectionCount(rowSelectionModel);
258
+ const selectedOnCurrentPage = selectableRowsInPage.filter(id => isRowSelected(rowSelectionModel, id));
241
259
  if (numberOfSelectedRows === numberOfSelectableRowsInTable && numberOfSelectableRowsInPage < numberOfSelectableRowsInTable) {
242
260
  selectionStatus = {
243
261
  type: 'table',
@@ -282,33 +300,32 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
282
300
  }
283
301
  }), [theme]);
284
302
 
285
- // Per-render data for the stable `BelowToolbar` slot (which wraps the resolved toolbar and,
286
- // depending on placement, the banner/pager), injected via `slotProps.toolbar` so the slot
287
- // identity stays constant and the toolbar is re-rendered, not remounted. Typed as
288
- // ToolbarWrapper props so mistakes are caught here; cast to MUI's slot type only at the
289
- // injection site below.
290
- const toolbarSlotProps = {
303
+ // Per-render data for the belowToolbar layout, handed to the stable `BelowToolbar` slot
304
+ // via `slotProps.toolbar` (see BelowToolbar) so the slot identity stays constant and the
305
+ // toolbar is re-rendered, not remounted. Typed as ToolbarWrapper props so mistakes are
306
+ // caught here; cast to MUI's slot type only at the injection site below.
307
+ const belowToolbarSlotProps = {
308
+ RenderedToolbar: (_ref6 = slots === null || slots === void 0 ? void 0 : slots.toolbar) !== null && _ref6 !== void 0 ? _ref6 : Toolbar,
291
309
  hideToolbar,
292
- RenderedToolbar,
293
310
  filterModel,
294
311
  onFilterModelChange,
295
312
  pagination,
296
- displaySelection: bannerAtTop || bannerBelowToolbar,
297
- displayPagination: ['top', 'both'].includes(paginationPlacement) || pagerBelowToolbar,
313
+ paginationMode,
314
+ displaySelection: bannerBelowToolbar,
315
+ displayPagination: pagerBelowToolbar,
298
316
  displayRowsPerPage: pagerBelowToolbar,
299
317
  selectionStatus,
300
318
  apiRef,
301
319
  isRowSelectable,
302
320
  paginationModel,
303
321
  onPaginationModelChange,
304
- pageSizeOptions,
322
+ pageSizeOptions: pageSizeOptions,
305
323
  paginationProps,
306
- paginationMode,
307
324
  rowCount
308
325
  };
309
326
 
310
- // Per-render data for the stable bottom `BottomPagination` slot, handed over via
311
- // `slotProps.pagination` for the same reason as the toolbar above.
327
+ // Per-render data for the bottom pagination slot, handed to the stable `BottomPagination`
328
+ // slot via `slotProps.pagination` for the same reason as the toolbar above.
312
329
  const bottomPaginationSlotProps = {
313
330
  pagination,
314
331
  paginationMode,
@@ -320,7 +337,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
320
337
  onPaginationModelChange,
321
338
  apiRef,
322
339
  isRowSelectable,
323
- pageSizeOptions,
340
+ pageSizeOptions: pageSizeOptions,
324
341
  paginationProps,
325
342
  rowCount
326
343
  };
@@ -334,34 +351,51 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
334
351
  ref: datagridRef,
335
352
  className: classNames(DataGrid.className, className),
336
353
  $height: height
337
- }, /*#__PURE__*/React__default.createElement(DataGridPro, _extends({}, forwardedProps, {
354
+ }, pagination && gridReady && (bannerAtTop || ['top', 'both'].includes(paginationPlacement)) ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, {
355
+ displaySelection: bannerAtTop,
356
+ displayRowsPerPage: ['top', 'both'].includes(paginationPlacement),
357
+ displayPagination: ['top', 'both'].includes(paginationPlacement),
358
+ selectionStatus: selectionStatus,
359
+ paginationModel: paginationModel,
360
+ onPaginationModelChange: onPaginationModelChange,
361
+ pageSizeOptions: pageSizeOptions,
362
+ paginationProps: paginationProps,
363
+ rowCount: rowCount
364
+ }) : /*#__PURE__*/React__default.createElement(ControlledPagination, {
365
+ displaySelection: bannerAtTop,
366
+ displayRowsPerPage: ['top', 'both'].includes(paginationPlacement),
367
+ displayPagination: ['top', 'both'].includes(paginationPlacement),
368
+ selectionStatus: selectionStatus,
369
+ apiRef: apiRef,
370
+ isRowSelectable: isRowSelectable,
371
+ paginationModel: paginationModel,
372
+ onPaginationModelChange: onPaginationModelChange,
373
+ pageSizeOptions: pageSizeOptions,
374
+ paginationProps: paginationProps
375
+ }) : null, /*#__PURE__*/React__default.createElement(DataGridPremium, _extends({}, forwardedProps, {
338
376
  rowCount: rowCount,
339
377
  apiRef: apiRef,
340
378
  autoHeight: autoHeight,
341
379
  checkboxSelectionVisibleOnly: checkboxSelectionVisibleOnly,
342
- slots: _objectSpread2(_objectSpread2(_objectSpread2({}, baseGridSlots), slots), {}, {
343
- // `BelowToolbar` and `BottomPagination` are stable module-level components; their
344
- // per-render data is injected via `slotProps` below. A fresh inline function here
345
- // would remount the slot's subtree every render — for the toolbar that dropped
346
- // quick-search focus on every keystroke. The consumer's `slots.toolbar` (or the
347
- // default DS Toolbar) is preserved via `RenderedToolbar` inside ToolbarWrapper.
348
- toolbar: BelowToolbar,
380
+ disableRowSelectionExcludeModel: true,
381
+ showToolbar: !hideToolbar || belowToolbarActive,
382
+ slots: _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, baseGridSlots), slots), belowToolbarActive ? {
383
+ toolbar: BelowToolbar
384
+ } : {}), {}, {
349
385
  pagination: BottomPagination
350
386
  }),
351
- slotProps: _objectSpread2(_objectSpread2({}, slotProps), {}, {
352
- // Inject the per-render slot data (built above) here rather than closing over it
353
- // in inline slots, so the `toolbar`/`pagination` slot identities stay stable.
354
- // Consumer slot props are spread first; the DS layout data wins (and, for the
355
- // toolbar, is forwarded on to `RenderedToolbar` by ToolbarWrapper). Cast at the
356
- // MUI boundary because these are ToolbarWrapper props, not the MUI slot prop types.
357
- toolbar: _objectSpread2(_objectSpread2({}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.toolbar), toolbarSlotProps),
387
+ slotProps: _objectSpread2(_objectSpread2(_objectSpread2({}, slotProps), belowToolbarActive ? {
388
+ toolbar: _objectSpread2(_objectSpread2({}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.toolbar), belowToolbarSlotProps)
389
+ } : {}), {}, {
358
390
  pagination: _objectSpread2(_objectSpread2({}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.pagination), bottomPaginationSlotProps)
359
391
  }),
360
392
  filterModel: filterModel,
361
393
  columnVisibilityModel: columnVisibilityModel,
362
394
  pinnedColumns: pinnedColumns,
363
395
  sortModel: sortModel,
364
- initialState: initialState,
396
+ initialState: _objectSpread2(_objectSpread2({}, initialState), {}, {
397
+ density: (_ref7 = density !== null && density !== void 0 ? density : initialState === null || initialState === void 0 ? void 0 : initialState.density) !== null && _ref7 !== void 0 ? _ref7 : 'standard'
398
+ }),
365
399
  isRowSelectable: isRowSelectable,
366
400
  onFilterModelChange: onFilterModelChange,
367
401
  onColumnVisibilityModelChange: onColumnVisibilityModelChange,
@@ -381,43 +415,52 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
381
415
  // Fix server-side header checkbox: when MUI deselects all due to indeterminate
382
416
  // state (cross-page selections exist, 0 on current page), convert to "select page".
383
417
  if (pagination && paginationMode === 'server') {
384
- effectiveSelectionModel = fixServerSideHeaderCheckboxSelection(newSelectionModel, Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel], selectionStatusRef, apiRef, isRowSelectable);
418
+ effectiveSelectionModel = fixServerSideHeaderCheckboxSelection(newSelectionModel, rowSelectionModel, selectionStatusRef, apiRef, isRowSelectable);
385
419
  }
386
420
  if (pagination && paginationMode != 'server') {
387
- const cbPageStart = paginationModel.page * paginationModel.pageSize;
388
- const cbPageEnd = cbPageStart + paginationModel.pageSize;
389
- const selectableRowsInPage = isRowSelectable ? gridFilteredSortedRowEntriesSelector(apiRef).slice(cbPageStart, cbPageEnd).filter(_ref5 => {
421
+ // Use manual page slicing instead of gridPaginatedVisibleSorted* selectors
422
+ // to avoid stale apiRef pagination state.
423
+ const allFilteredEntries = gridFilteredSortedRowEntriesSelector(apiRef);
424
+ const pageStart = paginationModel.page * paginationModel.pageSize;
425
+ const pageEntries = allFilteredEntries.slice(pageStart, pageStart + paginationModel.pageSize);
426
+ const selectableRowsInPage = isRowSelectable ? pageEntries.filter(_ref8 => {
390
427
  let {
391
428
  model
392
- } = _ref5;
429
+ } = _ref8;
393
430
  return isRowSelectable({
394
431
  row: model
395
432
  });
396
- }).map(_ref6 => {
433
+ }).map(_ref9 => {
434
+ let {
435
+ id
436
+ } = _ref9;
437
+ return id;
438
+ }) : pageEntries.map(_ref10 => {
397
439
  let {
398
440
  id
399
- } = _ref6;
441
+ } = _ref10;
400
442
  return id;
401
- }) : gridFilteredSortedRowIdsSelector(apiRef).slice(cbPageStart, cbPageEnd);
443
+ });
402
444
  const numberOfSelectableRowsInPage = selectableRowsInPage.length;
403
- const selectableRowsInTable = isRowSelectable ? gridFilteredSortedRowEntriesSelector(apiRef).filter(_ref7 => {
445
+ const selectableRowsInTable = isRowSelectable ? allFilteredEntries.filter(_ref11 => {
404
446
  let {
405
447
  model
406
- } = _ref7;
448
+ } = _ref11;
407
449
  return isRowSelectable({
408
450
  row: model
409
451
  });
410
- }).map(_ref8 => {
452
+ }).map(_ref12 => {
411
453
  let {
412
454
  id
413
- } = _ref8;
455
+ } = _ref12;
414
456
  return id;
415
457
  }) : gridFilteredSortedRowIdsSelector(apiRef);
416
458
  const numberOfSelectableRowsInTable = selectableRowsInTable.length;
417
- const numberOfSelectedRows = newSelectionModel.length;
459
+ const numberOfSelectedRows = getSelectionCount(newSelectionModel);
418
460
  if (selectionStatusRef.current.type === 'table' && numberOfSelectedRows === numberOfSelectableRowsInTable - numberOfSelectableRowsInPage || selectionStatusRef.current.type === 'table' && numberOfSelectedRows === numberOfSelectableRowsInTable || selectionStatusRef.current.type === 'page' && numberOfSelectedRows === numberOfSelectableRowsInPage) {
419
461
  setTimeout(() => {
420
- apiRef.current.selectRows([], true, true);
462
+ var _apiRef$current;
463
+ (_apiRef$current = apiRef.current) === null || _apiRef$current === void 0 ? void 0 : _apiRef$current.selectRows([], true, true);
421
464
  }, 0);
422
465
  }
423
466
  if (numberOfSelectedRows === numberOfSelectableRowsInPage && numberOfSelectableRowsInPage < numberOfSelectableRowsInTable) {