@redsift/table 12.5.0-muiv7 → 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';
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 } 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 { b 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';
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);
@@ -174,15 +174,25 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
174
174
  // Version counter to force re-renders when selectionStatus ref changes
175
175
  const [, forceSelectionUpdate] = useState(0);
176
176
 
177
+ // Track when the grid API is ready to ensure top pagination renders correctly
178
+ const [gridReady, setGridReady] = useState(false);
179
+
177
180
  // The checkboxSelectionVisibleOnly should only be applied to client-side pagination,
178
181
  // for server-side pagination it produces inconsistent behavior when selecting all rows in pages 2 and beyond
179
182
  const checkboxSelectionVisibleOnly = Boolean(pagination) && Boolean(paginationMode != 'server');
180
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
+
181
191
  // in server-side pagination we want to update the selection status
182
192
  // every time we navigate between pages, resize our page or select something
183
193
  useEffect(() => {
184
194
  if (paginationMode == 'server') {
185
- onServerSideSelectionStatusChange(Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel], apiRef, selectionStatusRef, forceSelectionUpdate, isRowSelectable, paginationModel.page, paginationModel.pageSize);
195
+ onServerSideSelectionStatusChange(rowSelectionModel, apiRef, selectionStatusRef, forceSelectionUpdate, isRowSelectable, paginationModel.page, paginationModel.pageSize);
186
196
  }
187
197
  }, [rowSelectionModel, paginationModel.page, paginationModel.pageSize, rows]);
188
198
  if (!Array.isArray(rows)) {
@@ -194,15 +204,15 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
194
204
  // receive the fresh value in the same render cycle — no extra re-render needed.
195
205
  // The ref is kept in sync for the onRowSelectionModelChange callback's deselect logic.
196
206
  let selectionStatus = selectionStatusRef.current;
197
- if (pagination && paginationMode !== 'server' && Array.isArray(rowSelectionModel) && rowSelectionModel.length > 0) {
207
+ if (pagination && paginationMode !== 'server' && getSelectionCount(rowSelectionModel) > 0) {
198
208
  try {
199
- // Use manual page slicing with our React state's paginationModel instead of
200
- // gridPaginatedVisibleSortedGridRow*Selector(apiRef). In MUI v7, the apiRef's
201
- // internal pagination state can lag behind the React state after a page change,
202
- // causing the selection status to be one page behind.
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);
203
213
  const pageStart = paginationModel.page * paginationModel.pageSize;
204
- const pageEnd = pageStart + paginationModel.pageSize;
205
- const selectableRowsInPage = isRowSelectable ? gridFilteredSortedRowEntriesSelector(apiRef).slice(pageStart, pageEnd).filter(_ref => {
214
+ const pageEntries = allFilteredEntries.slice(pageStart, pageStart + paginationModel.pageSize);
215
+ const selectableRowsInPage = isRowSelectable ? pageEntries.filter(_ref => {
206
216
  let {
207
217
  model
208
218
  } = _ref;
@@ -214,24 +224,29 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
214
224
  id
215
225
  } = _ref2;
216
226
  return id;
217
- }) : gridFilteredSortedRowIdsSelector(apiRef).slice(pageStart, pageEnd);
227
+ }) : pageEntries.map(_ref3 => {
228
+ let {
229
+ id
230
+ } = _ref3;
231
+ return id;
232
+ });
218
233
  const numberOfSelectableRowsInPage = selectableRowsInPage.length;
219
- const selectableRowsInTable = isRowSelectable ? gridFilteredSortedRowEntriesSelector(apiRef).filter(_ref3 => {
234
+ const selectableRowsInTable = isRowSelectable ? allFilteredEntries.filter(_ref4 => {
220
235
  let {
221
236
  model
222
- } = _ref3;
237
+ } = _ref4;
223
238
  return isRowSelectable({
224
239
  row: model
225
240
  });
226
- }).map(_ref4 => {
241
+ }).map(_ref5 => {
227
242
  let {
228
243
  id
229
- } = _ref4;
244
+ } = _ref5;
230
245
  return id;
231
246
  }) : gridFilteredSortedRowIdsSelector(apiRef);
232
247
  const numberOfSelectableRowsInTable = selectableRowsInTable.length;
233
- const numberOfSelectedRows = rowSelectionModel.length;
234
- const selectedOnCurrentPage = selectableRowsInPage.filter(id => rowSelectionModel.includes(id));
248
+ const numberOfSelectedRows = getSelectionCount(rowSelectionModel);
249
+ const selectedOnCurrentPage = selectableRowsInPage.filter(id => isRowSelected(rowSelectionModel, id));
235
250
  if (numberOfSelectedRows === numberOfSelectableRowsInTable && numberOfSelectableRowsInPage < numberOfSelectableRowsInTable) {
236
251
  selectionStatus = {
237
252
  type: 'table',
@@ -285,16 +300,38 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
285
300
  ref: datagridRef,
286
301
  className: classNames(DataGrid.className, className),
287
302
  $height: height
288
- }, /*#__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, {
289
325
  rowCount: rowCount,
290
326
  apiRef: apiRef,
291
327
  autoHeight: autoHeight,
292
328
  checkboxSelectionVisibleOnly: checkboxSelectionVisibleOnly,
329
+ disableRowSelectionExcludeModel: true,
330
+ showToolbar: !hideToolbar,
293
331
  slots: _objectSpread2(_objectSpread2({
294
332
  baseButton: BaseButton,
295
333
  baseCheckbox: BaseCheckbox,
296
- // baseTextField,
297
- basePopper: BasePopper,
334
+ baseIconButton: BaseIconButton,
298
335
  columnFilteredIcon: props => /*#__PURE__*/React__default.createElement(BaseIcon, _extends({}, props, {
299
336
  displayName: "columnFilteredIcon"
300
337
  })),
@@ -329,23 +366,6 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
329
366
  displayName: "openFilterButtonIcon"
330
367
  }))
331
368
  }, slots), {}, {
332
- toolbar: props => /*#__PURE__*/React__default.createElement(ToolbarWrapper, _extends({}, props, {
333
- hideToolbar: hideToolbar,
334
- RenderedToolbar: RenderedToolbar,
335
- filterModel: filterModel,
336
- onFilterModelChange: onFilterModelChange,
337
- pagination: pagination,
338
- paginationPlacement: paginationPlacement,
339
- selectionStatus: selectionStatus,
340
- apiRef: apiRef,
341
- isRowSelectable: isRowSelectable,
342
- paginationModel: paginationModel,
343
- onPaginationModelChange: onPaginationModelChange,
344
- pageSizeOptions: pageSizeOptions,
345
- paginationProps: paginationProps,
346
- paginationMode: paginationMode,
347
- rowCount: rowCount
348
- })),
349
369
  pagination: props => pagination ? paginationMode == 'server' ? /*#__PURE__*/React__default.createElement(ServerSideControlledPagination, _extends({}, props, {
350
370
  displaySelection: false,
351
371
  displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
@@ -374,7 +394,9 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
374
394
  columnVisibilityModel: columnVisibilityModel,
375
395
  pinnedColumns: pinnedColumns,
376
396
  sortModel: sortModel,
377
- 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
+ }),
378
400
  isRowSelectable: isRowSelectable,
379
401
  onFilterModelChange: onFilterModelChange,
380
402
  onColumnVisibilityModelChange: onColumnVisibilityModelChange,
@@ -394,43 +416,52 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
394
416
  // Fix server-side header checkbox: when MUI deselects all due to indeterminate
395
417
  // state (cross-page selections exist, 0 on current page), convert to "select page".
396
418
  if (pagination && paginationMode === 'server') {
397
- effectiveSelectionModel = fixServerSideHeaderCheckboxSelection(newSelectionModel, Array.isArray(rowSelectionModel) ? rowSelectionModel : [rowSelectionModel], selectionStatusRef, apiRef, isRowSelectable);
419
+ effectiveSelectionModel = fixServerSideHeaderCheckboxSelection(newSelectionModel, rowSelectionModel, selectionStatusRef, apiRef, isRowSelectable);
398
420
  }
399
421
  if (pagination && paginationMode != 'server') {
400
- const cbPageStart = paginationModel.page * paginationModel.pageSize;
401
- const cbPageEnd = cbPageStart + paginationModel.pageSize;
402
- const selectableRowsInPage = isRowSelectable ? gridFilteredSortedRowEntriesSelector(apiRef).slice(cbPageStart, cbPageEnd).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 => {
403
428
  let {
404
429
  model
405
- } = _ref5;
430
+ } = _ref7;
406
431
  return isRowSelectable({
407
432
  row: model
408
433
  });
409
- }).map(_ref6 => {
434
+ }).map(_ref8 => {
435
+ let {
436
+ id
437
+ } = _ref8;
438
+ return id;
439
+ }) : pageEntries.map(_ref9 => {
410
440
  let {
411
441
  id
412
- } = _ref6;
442
+ } = _ref9;
413
443
  return id;
414
- }) : gridFilteredSortedRowIdsSelector(apiRef).slice(cbPageStart, cbPageEnd);
444
+ });
415
445
  const numberOfSelectableRowsInPage = selectableRowsInPage.length;
416
- const selectableRowsInTable = isRowSelectable ? gridFilteredSortedRowEntriesSelector(apiRef).filter(_ref7 => {
446
+ const selectableRowsInTable = isRowSelectable ? allFilteredEntries.filter(_ref10 => {
417
447
  let {
418
448
  model
419
- } = _ref7;
449
+ } = _ref10;
420
450
  return isRowSelectable({
421
451
  row: model
422
452
  });
423
- }).map(_ref8 => {
453
+ }).map(_ref11 => {
424
454
  let {
425
455
  id
426
- } = _ref8;
456
+ } = _ref11;
427
457
  return id;
428
458
  }) : gridFilteredSortedRowIdsSelector(apiRef);
429
459
  const numberOfSelectableRowsInTable = selectableRowsInTable.length;
430
- const numberOfSelectedRows = newSelectionModel.length;
460
+ const numberOfSelectedRows = getSelectionCount(newSelectionModel);
431
461
  if (selectionStatusRef.current.type === 'table' && numberOfSelectedRows === numberOfSelectableRowsInTable - numberOfSelectableRowsInPage || selectionStatusRef.current.type === 'table' && numberOfSelectedRows === numberOfSelectableRowsInTable || selectionStatusRef.current.type === 'page' && numberOfSelectedRows === numberOfSelectableRowsInPage) {
432
462
  setTimeout(() => {
433
- 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);
434
465
  }, 0);
435
466
  }
436
467
  if (numberOfSelectedRows === numberOfSelectableRowsInPage && numberOfSelectableRowsInPage < numberOfSelectableRowsInTable) {