@redsift/table 12.5.0-muiv6 → 12.5.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.
@@ -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,CAACO,YAAY,CA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C,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,16 +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';
4
- import { useTheme, ThemeProvider, RedsiftColorBlueN, RedsiftColorNeutralXDarkGrey, RedsiftColorNeutralWhite } from '@redsift/design-system';
5
- import { useGridApiRef, gridPaginatedVisibleSortedGridRowEntriesSelector, gridPaginatedVisibleSortedGridRowIdsSelector, gridFilteredSortedRowEntriesSelector, gridFilteredSortedRowIdsSelector, DataGridPro } from '@mui/x-data-grid-pro';
6
- import { L as LicenseInfo, u as useControlledDatagridState, T as ThemeProvider$1, S as StyledDataGrid } from './useControlledDatagridState.js';
7
- import { T as Toolbar } from './Toolbar2.js';
8
- import { o as onServerSideSelectionStatusChange, f as fixServerSideHeaderCheckboxSelection, S as ServerSideControlledPagination, C as ControlledPagination } from './ControlledPagination.js';
9
- import { e as createTheme } from './Portal.js';
10
- import { B as BaseButton, a as BaseCheckbox, c as BasePopper, b as BaseIcon } from './BasePopper.js';
11
- import { T as ToolbarWrapper } from './ToolbarWrapper2.js';
5
+ import { LicenseInfo } from '@mui/x-license';
6
+ import { useTheme, RedsiftColorBlueN, RedsiftColorNeutralXDarkGrey, RedsiftColorNeutralWhite, ThemeProvider } from '@redsift/design-system';
7
+ import { useGridApiRef, gridFilteredSortedRowEntriesSelector, gridFilteredSortedRowIdsSelector, DataGridPremium } from '@mui/x-data-grid-premium';
8
+ import { u as useControlledDatagridState, S as StyledDataGrid } 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';
10
+ import { B as BaseButton, a as BaseCheckbox, c as BaseIconButton, b as BaseIcon } from './BaseIconButton.js';
12
11
 
13
- 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", "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", "paginationProps", "rows", "pageSizeOptions", "sx", "theme", "paginationMode", "rowCount", "density"];
14
13
  const COMPONENT_NAME = 'DataGrid';
15
14
  const CLASSNAME = 'redsift-datagrid';
16
15
 
@@ -87,6 +86,7 @@ const CLASSNAME = 'redsift-datagrid';
87
86
  */
88
87
 
89
88
  const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
89
+ var _ref6;
90
90
  const datagridRef = ref || useRef();
91
91
  const {
92
92
  apiRef: propsApiRef,
@@ -115,17 +115,17 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
115
115
  paginationPlacement = 'both',
116
116
  paginationProps,
117
117
  rows,
118
- pageSizeOptions,
118
+ pageSizeOptions = [5, 10, 25, 50],
119
119
  sx,
120
120
  theme: propsTheme,
121
121
  paginationMode = 'client',
122
- rowCount
122
+ rowCount,
123
+ density
123
124
  } = props,
124
125
  forwardedProps = _objectWithoutProperties(props, _excluded);
125
126
  const theme = useTheme(propsTheme);
126
127
  const _apiRef = useGridApiRef();
127
128
  const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
128
- const RenderedToolbar = slots !== null && slots !== void 0 && slots.toolbar ? slots.toolbar : Toolbar;
129
129
  LicenseInfo.setLicenseKey(license);
130
130
  const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
131
131
  const {
@@ -153,9 +153,9 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
153
153
  propsSortModel,
154
154
  propsOnPaginationModelChange
155
155
  });
156
- const [rowSelectionModel, setRowSelectionModel] = useState(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
156
+ const [rowSelectionModel, setRowSelectionModel] = useState(() => normalizeRowSelectionModel(propsRowSelectionModel));
157
157
  useEffect(() => {
158
- setRowSelectionModel(propsRowSelectionModel !== null && propsRowSelectionModel !== void 0 ? propsRowSelectionModel : []);
158
+ setRowSelectionModel(normalizeRowSelectionModel(propsRowSelectionModel));
159
159
  }, [propsRowSelectionModel]);
160
160
  const onRowSelectionModelChange = (selectionModel, details) => {
161
161
  setRowSelectionModel(selectionModel);
@@ -171,15 +171,28 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
171
171
  pageSize: paginationModel.pageSize
172
172
  });
173
173
 
174
+ // Version counter to force re-renders when selectionStatus ref changes
175
+ const [, forceSelectionUpdate] = useState(0);
176
+
177
+ // Track when the grid API is ready to ensure top pagination renders correctly
178
+ const [gridReady, setGridReady] = useState(false);
179
+
174
180
  // The checkboxSelectionVisibleOnly should only be applied to client-side pagination,
175
181
  // for server-side pagination it produces inconsistent behavior when selecting all rows in pages 2 and beyond
176
182
  const checkboxSelectionVisibleOnly = Boolean(pagination) && Boolean(paginationMode != 'server');
177
183
 
184
+ // Force re-render when the grid API becomes ready (for top pagination)
185
+ useEffect(() => {
186
+ if (apiRef.current && !gridReady) {
187
+ setGridReady(true);
188
+ }
189
+ });
190
+
178
191
  // in server-side pagination we want to update the selection status
179
192
  // every time we navigate between pages, resize our page or select something
180
193
  useEffect(() => {
181
194
  if (paginationMode == 'server') {
182
- onServerSideSelectionStatusChange(Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel], apiRef, selectionStatusRef, isRowSelectable, paginationModel.page, paginationModel.pageSize);
195
+ onServerSideSelectionStatusChange(rowSelectionModel, apiRef, selectionStatusRef, forceSelectionUpdate, isRowSelectable, paginationModel.page, paginationModel.pageSize);
183
196
  }
184
197
  }, [rowSelectionModel, paginationModel.page, paginationModel.pageSize, rows]);
185
198
  if (!Array.isArray(rows)) {
@@ -191,9 +204,15 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
191
204
  // receive the fresh value in the same render cycle — no extra re-render needed.
192
205
  // The ref is kept in sync for the onRowSelectionModelChange callback's deselect logic.
193
206
  let selectionStatus = selectionStatusRef.current;
194
- if (pagination && paginationMode !== 'server' && Array.isArray(rowSelectionModel) && rowSelectionModel.length > 0) {
207
+ if (pagination && paginationMode !== 'server' && getSelectionCount(rowSelectionModel) > 0) {
195
208
  try {
196
- const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref => {
209
+ // Use manual page slicing instead of gridPaginatedVisibleSorted* selectors.
210
+ // MUI's paginated selectors use apiRef internal state which may be stale when
211
+ // paginationModel prop changes — our React state is always up to date.
212
+ const allFilteredEntries = gridFilteredSortedRowEntriesSelector(apiRef);
213
+ const pageStart = paginationModel.page * paginationModel.pageSize;
214
+ const pageEntries = allFilteredEntries.slice(pageStart, pageStart + paginationModel.pageSize);
215
+ const selectableRowsInPage = isRowSelectable ? pageEntries.filter(_ref => {
197
216
  let {
198
217
  model
199
218
  } = _ref;
@@ -205,24 +224,29 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
205
224
  id
206
225
  } = _ref2;
207
226
  return id;
208
- }) : gridPaginatedVisibleSortedGridRowIdsSelector(apiRef);
227
+ }) : pageEntries.map(_ref3 => {
228
+ let {
229
+ id
230
+ } = _ref3;
231
+ return id;
232
+ });
209
233
  const numberOfSelectableRowsInPage = selectableRowsInPage.length;
210
- const selectableRowsInTable = isRowSelectable ? gridFilteredSortedRowEntriesSelector(apiRef).filter(_ref3 => {
234
+ const selectableRowsInTable = isRowSelectable ? allFilteredEntries.filter(_ref4 => {
211
235
  let {
212
236
  model
213
- } = _ref3;
237
+ } = _ref4;
214
238
  return isRowSelectable({
215
239
  row: model
216
240
  });
217
- }).map(_ref4 => {
241
+ }).map(_ref5 => {
218
242
  let {
219
243
  id
220
- } = _ref4;
244
+ } = _ref5;
221
245
  return id;
222
246
  }) : gridFilteredSortedRowIdsSelector(apiRef);
223
247
  const numberOfSelectableRowsInTable = selectableRowsInTable.length;
224
- const numberOfSelectedRows = rowSelectionModel.length;
225
- const selectedOnCurrentPage = selectableRowsInPage.filter(id => rowSelectionModel.includes(id));
248
+ const numberOfSelectedRows = getSelectionCount(rowSelectionModel);
249
+ const selectedOnCurrentPage = selectableRowsInPage.filter(id => isRowSelected(rowSelectionModel, id));
226
250
  if (numberOfSelectedRows === numberOfSelectableRowsInTable && numberOfSelectableRowsInPage < numberOfSelectableRowsInTable) {
227
251
  selectionStatus = {
228
252
  type: 'table',
@@ -276,51 +300,72 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
276
300
  ref: datagridRef,
277
301
  className: classNames(DataGrid.className, className),
278
302
  $height: height
279
- }, /*#__PURE__*/React__default.createElement(DataGridPro, _extends({}, forwardedProps, {
303
+ }, pagination && ['top', 'both'].includes(paginationPlacement) && gridReady ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, {
304
+ displaySelection: true,
305
+ displayRowsPerPage: ['top', 'both'].includes(paginationPlacement),
306
+ displayPagination: ['top', 'both'].includes(paginationPlacement),
307
+ selectionStatus: selectionStatus,
308
+ paginationModel: paginationModel,
309
+ onPaginationModelChange: onPaginationModelChange,
310
+ pageSizeOptions: pageSizeOptions,
311
+ paginationProps: paginationProps,
312
+ rowCount: rowCount
313
+ }) : /*#__PURE__*/React__default.createElement(ControlledPagination, {
314
+ displaySelection: true,
315
+ displayRowsPerPage: ['top', 'both'].includes(paginationPlacement),
316
+ displayPagination: ['top', 'both'].includes(paginationPlacement),
317
+ selectionStatus: selectionStatus,
318
+ apiRef: apiRef,
319
+ isRowSelectable: isRowSelectable,
320
+ paginationModel: paginationModel,
321
+ onPaginationModelChange: onPaginationModelChange,
322
+ pageSizeOptions: pageSizeOptions,
323
+ paginationProps: paginationProps
324
+ }) : null, /*#__PURE__*/React__default.createElement(DataGridPremium, _extends({}, forwardedProps, {
280
325
  rowCount: rowCount,
281
326
  apiRef: apiRef,
282
327
  autoHeight: autoHeight,
283
328
  checkboxSelectionVisibleOnly: checkboxSelectionVisibleOnly,
329
+ disableRowSelectionExcludeModel: true,
330
+ showToolbar: !hideToolbar,
284
331
  slots: _objectSpread2(_objectSpread2({
285
332
  baseButton: BaseButton,
286
333
  baseCheckbox: BaseCheckbox,
287
- // baseTextField,
288
- basePopper: BasePopper,
334
+ baseIconButton: BaseIconButton,
289
335
  columnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
290
- displayName: "ColumnFilteredIcon"
336
+ displayName: "columnFilteredIcon"
291
337
  })),
292
338
  columnSelectorIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
293
- displayName: "ColumnSelectorIcon"
339
+ displayName: "columnSelectorIcon"
294
340
  })),
295
341
  columnSortedAscendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
296
- displayName: "ColumnSortedAscendingIcon"
342
+ displayName: "columnSortedAscendingIcon"
297
343
  })),
298
344
  columnSortedDescendingIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
299
- displayName: "ColumnSortedDescendingIcon"
345
+ displayName: "columnSortedDescendingIcon"
300
346
  })),
301
347
  densityCompactIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
302
- displayName: "DensityCompactIcon"
348
+ displayName: "densityCompactIcon"
303
349
  })),
304
350
  densityStandardIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
305
- displayName: "DensityStandardIcon"
351
+ displayName: "densityStandardIcon"
306
352
  })),
307
353
  densityComfortableIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
308
- displayName: "DensityComfortableIcon"
354
+ displayName: "densityComfortableIcon"
309
355
  })),
310
356
  detailPanelCollapseIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
311
- displayName: "DetailPanelCollapseIcon"
357
+ displayName: "detailPanelCollapseIcon"
312
358
  })),
313
359
  detailPanelExpandIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
314
- displayName: "DetailPanelExpandIcon"
360
+ displayName: "detailPanelExpandIcon"
315
361
  })),
316
362
  exportIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
317
- displayName: "ExportIcon"
363
+ displayName: "exportIcon"
318
364
  })),
319
- openFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({
320
- displayName: "OpenFilterButtonIcon"
321
- }, props))
365
+ openFilterButtonIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
366
+ displayName: "openFilterButtonIcon"
367
+ }))
322
368
  }, slots), {}, {
323
- toolbar: ToolbarWrapper,
324
369
  pagination: props => pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends({}, props, {
325
370
  displaySelection: false,
326
371
  displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
@@ -330,7 +375,6 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
330
375
  onPaginationModelChange: onPaginationModelChange,
331
376
  pageSizeOptions: pageSizeOptions,
332
377
  paginationProps: paginationProps,
333
- paginationMode: paginationMode,
334
378
  rowCount: rowCount
335
379
  })) : /*#__PURE__*/React__default.createElement(ControlledPagination, _extends({}, props, {
336
380
  displaySelection: false,
@@ -342,34 +386,17 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
342
386
  paginationModel: paginationModel,
343
387
  onPaginationModelChange: onPaginationModelChange,
344
388
  pageSizeOptions: pageSizeOptions,
345
- paginationProps: paginationProps,
346
- paginationMode: paginationMode
389
+ paginationProps: paginationProps
347
390
  })) : null
348
391
  }),
349
- slotProps: _objectSpread2(_objectSpread2({}, slotProps), {}, {
350
- toolbar: _objectSpread2({
351
- hideToolbar,
352
- RenderedToolbar,
353
- filterModel,
354
- onFilterModelChange,
355
- pagination,
356
- paginationPlacement,
357
- selectionStatus,
358
- apiRef,
359
- isRowSelectable,
360
- paginationModel,
361
- onPaginationModelChange,
362
- pageSizeOptions,
363
- paginationProps,
364
- paginationMode,
365
- rowCount
366
- }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.toolbar)
367
- }),
392
+ slotProps: _objectSpread2({}, slotProps),
368
393
  filterModel: filterModel,
369
394
  columnVisibilityModel: columnVisibilityModel,
370
395
  pinnedColumns: pinnedColumns,
371
396
  sortModel: sortModel,
372
- initialState: initialState,
397
+ initialState: _objectSpread2(_objectSpread2({}, initialState), {}, {
398
+ density: (_ref6 = density !== null && density !== void 0 ? density : initialState === null || initialState === void 0 ? void 0 : initialState.density) !== null && _ref6 !== void 0 ? _ref6 : 'standard'
399
+ }),
373
400
  isRowSelectable: isRowSelectable,
374
401
  onFilterModelChange: onFilterModelChange,
375
402
  onColumnVisibilityModelChange: onColumnVisibilityModelChange,
@@ -389,41 +416,52 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
389
416
  // Fix server-side header checkbox: when MUI deselects all due to indeterminate
390
417
  // state (cross-page selections exist, 0 on current page), convert to "select page".
391
418
  if (pagination && paginationMode === 'server') {
392
- effectiveSelectionModel = fixServerSideHeaderCheckboxSelection(newSelectionModel, Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel], selectionStatusRef, apiRef, isRowSelectable);
419
+ effectiveSelectionModel = fixServerSideHeaderCheckboxSelection(newSelectionModel, rowSelectionModel, selectionStatusRef, apiRef, isRowSelectable);
393
420
  }
394
421
  if (pagination && paginationMode != 'server') {
395
- const selectableRowsInPage = isRowSelectable ? gridPaginatedVisibleSortedGridRowEntriesSelector(apiRef).filter(_ref5 => {
422
+ // Use manual page slicing instead of gridPaginatedVisibleSorted* selectors
423
+ // to avoid stale apiRef pagination state.
424
+ const allFilteredEntries = gridFilteredSortedRowEntriesSelector(apiRef);
425
+ const pageStart = paginationModel.page * paginationModel.pageSize;
426
+ const pageEntries = allFilteredEntries.slice(pageStart, pageStart + paginationModel.pageSize);
427
+ const selectableRowsInPage = isRowSelectable ? pageEntries.filter(_ref7 => {
396
428
  let {
397
429
  model
398
- } = _ref5;
430
+ } = _ref7;
399
431
  return isRowSelectable({
400
432
  row: model
401
433
  });
402
- }).map(_ref6 => {
434
+ }).map(_ref8 => {
403
435
  let {
404
436
  id
405
- } = _ref6;
437
+ } = _ref8;
438
+ return id;
439
+ }) : pageEntries.map(_ref9 => {
440
+ let {
441
+ id
442
+ } = _ref9;
406
443
  return id;
407
- }) : gridPaginatedVisibleSortedGridRowIdsSelector(apiRef);
444
+ });
408
445
  const numberOfSelectableRowsInPage = selectableRowsInPage.length;
409
- const selectableRowsInTable = isRowSelectable ? gridFilteredSortedRowEntriesSelector(apiRef).filter(_ref7 => {
446
+ const selectableRowsInTable = isRowSelectable ? allFilteredEntries.filter(_ref10 => {
410
447
  let {
411
448
  model
412
- } = _ref7;
449
+ } = _ref10;
413
450
  return isRowSelectable({
414
451
  row: model
415
452
  });
416
- }).map(_ref8 => {
453
+ }).map(_ref11 => {
417
454
  let {
418
455
  id
419
- } = _ref8;
456
+ } = _ref11;
420
457
  return id;
421
458
  }) : gridFilteredSortedRowIdsSelector(apiRef);
422
459
  const numberOfSelectableRowsInTable = selectableRowsInTable.length;
423
- const numberOfSelectedRows = newSelectionModel.length;
460
+ const numberOfSelectedRows = getSelectionCount(newSelectionModel);
424
461
  if (selectionStatusRef.current.type === 'table' && numberOfSelectedRows === numberOfSelectableRowsInTable - numberOfSelectableRowsInPage || selectionStatusRef.current.type === 'table' && numberOfSelectedRows === numberOfSelectableRowsInTable || selectionStatusRef.current.type === 'page' && numberOfSelectedRows === numberOfSelectableRowsInPage) {
425
462
  setTimeout(() => {
426
- apiRef.current.selectRows([], true, true);
463
+ var _apiRef$current;
464
+ (_apiRef$current = apiRef.current) === null || _apiRef$current === void 0 ? void 0 : _apiRef$current.selectRows([], true, true);
427
465
  }, 0);
428
466
  }
429
467
  if (numberOfSelectedRows === numberOfSelectableRowsInPage && numberOfSelectableRowsInPage < numberOfSelectableRowsInTable) {
@@ -447,6 +485,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
447
485
  numberOfSelectedRows
448
486
  };
449
487
  }
488
+ forceSelectionUpdate(v => v + 1);
450
489
  }
451
490
  onRowSelectionModelChange === null || onRowSelectionModelChange === void 0 ? void 0 : onRowSelectionModelChange(effectiveSelectionModel, details);
452
491
  },