@redsift/table 12.5.7-muiv6 → 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.
- package/_internal/BaseComponents.js +1 -1
- package/_internal/BaseIconButton.js +126 -0
- package/_internal/BaseIconButton.js.map +1 -0
- package/_internal/DataGrid2.js +149 -81
- package/_internal/DataGrid2.js.map +1 -1
- package/_internal/GridToolbarFilterSemanticField2.js +1340 -3
- package/_internal/GridToolbarFilterSemanticField2.js.map +1 -1
- package/_internal/Pagination.js +1 -1
- package/_internal/ServerSideControlledPagination.js +337 -0
- package/_internal/ServerSideControlledPagination.js.map +1 -0
- package/_internal/StatefulDataGrid.js +1 -1
- package/_internal/StatefulDataGrid2.js +1071 -1512
- package/_internal/StatefulDataGrid2.js.map +1 -1
- package/_internal/Toolbar2.js +23 -6
- package/_internal/Toolbar2.js.map +1 -1
- package/_internal/ToolbarWrapper2.js +1 -1
- package/_internal/useControlledDatagridState.js +43 -308
- package/_internal/useControlledDatagridState.js.map +1 -1
- package/index.d.ts +519 -354
- package/index.js +46 -15
- package/index.js.map +1 -1
- package/package.json +7 -8
- package/_internal/BasePopper.js +0 -2469
- package/_internal/BasePopper.js.map +0 -1
- package/_internal/ControlledPagination.js +0 -11004
- package/_internal/ControlledPagination.js.map +0 -1
- package/_internal/Portal.js +0 -6538
- package/_internal/Portal.js.map +0 -1
- package/_internal/jsx-runtime.js +0 -1342
- package/_internal/jsx-runtime.js.map +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { B as BaseButton, a as BaseCheckbox, b as BaseIcon, c as
|
|
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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;AAAEC,QAAAA,UAAU,EAAE,QAAQ;AAAEC,QAAAA,cAAc,EAAE,QAAA;AAAS,OAAA;AAAE,KAAA;AAAE,GAAA,CAC3F,CAAC,CAAA;AAEN,CAAC;;;;"}
|
package/_internal/DataGrid2.js
CHANGED
|
@@ -1,15 +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 {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
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, 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 './ControlledPagination.js';
|
|
9
|
-
import { c as createTheme } from './Portal.js';
|
|
10
|
-
import { T as ToolbarWrapper } from './ToolbarWrapper2.js';
|
|
11
11
|
|
|
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"];
|
|
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"];
|
|
13
13
|
const COMPONENT_NAME = 'DataGrid';
|
|
14
14
|
const CLASSNAME = 'redsift-datagrid';
|
|
15
15
|
|
|
@@ -86,6 +86,7 @@ const CLASSNAME = 'redsift-datagrid';
|
|
|
86
86
|
*/
|
|
87
87
|
|
|
88
88
|
const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
89
|
+
var _ref6, _ref7;
|
|
89
90
|
const datagridRef = ref || useRef();
|
|
90
91
|
const {
|
|
91
92
|
apiRef: propsApiRef,
|
|
@@ -115,17 +116,17 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
115
116
|
selectionBannerPlacement = 'top',
|
|
116
117
|
paginationProps,
|
|
117
118
|
rows,
|
|
118
|
-
pageSizeOptions,
|
|
119
|
+
pageSizeOptions = [5, 10, 25, 50],
|
|
119
120
|
sx,
|
|
120
121
|
theme: propsTheme,
|
|
121
122
|
paginationMode = 'client',
|
|
122
|
-
rowCount
|
|
123
|
+
rowCount,
|
|
124
|
+
density
|
|
123
125
|
} = props,
|
|
124
126
|
forwardedProps = _objectWithoutProperties(props, _excluded);
|
|
125
127
|
const theme = useTheme(propsTheme);
|
|
126
128
|
const _apiRef = useGridApiRef();
|
|
127
129
|
const apiRef = propsApiRef !== null && propsApiRef !== void 0 ? propsApiRef : _apiRef;
|
|
128
|
-
const RenderedToolbar = slots !== null && slots !== void 0 && slots.toolbar ? slots.toolbar : Toolbar;
|
|
129
130
|
LicenseInfo.setLicenseKey(license);
|
|
130
131
|
const height = propsHeight !== null && propsHeight !== void 0 ? propsHeight : autoHeight ? undefined : '500px';
|
|
131
132
|
const {
|
|
@@ -153,9 +154,9 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
153
154
|
propsSortModel,
|
|
154
155
|
propsOnPaginationModelChange
|
|
155
156
|
});
|
|
156
|
-
const [rowSelectionModel, setRowSelectionModel] = useState(
|
|
157
|
+
const [rowSelectionModel, setRowSelectionModel] = useState(() => normalizeRowSelectionModel(propsRowSelectionModel));
|
|
157
158
|
useEffect(() => {
|
|
158
|
-
setRowSelectionModel(propsRowSelectionModel
|
|
159
|
+
setRowSelectionModel(normalizeRowSelectionModel(propsRowSelectionModel));
|
|
159
160
|
}, [propsRowSelectionModel]);
|
|
160
161
|
const onRowSelectionModelChange = (selectionModel, details) => {
|
|
161
162
|
setRowSelectionModel(selectionModel);
|
|
@@ -171,22 +172,36 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
171
172
|
pageSize: paginationModel.pageSize
|
|
172
173
|
});
|
|
173
174
|
|
|
175
|
+
// Version counter to force re-renders when selectionStatus ref changes
|
|
176
|
+
const [, forceSelectionUpdate] = useState(0);
|
|
177
|
+
|
|
178
|
+
// Track when the grid API is ready to ensure top pagination renders correctly
|
|
179
|
+
const [gridReady, setGridReady] = useState(false);
|
|
180
|
+
|
|
174
181
|
// The checkboxSelectionVisibleOnly should only be applied to client-side pagination,
|
|
175
182
|
// for server-side pagination it produces inconsistent behavior when selecting all rows in pages 2 and beyond
|
|
176
183
|
const checkboxSelectionVisibleOnly = Boolean(pagination) && Boolean(paginationMode != 'server');
|
|
177
184
|
|
|
178
185
|
// Banner and pager placements are independent. `belowToolbar` (for either) renders
|
|
179
|
-
// in the toolbar
|
|
186
|
+
// in a row inside the toolbar slot, and only applies when pagination is on.
|
|
180
187
|
const bannerAtTop = selectionBannerPlacement === 'top';
|
|
181
188
|
const bannerAtBottom = selectionBannerPlacement === 'bottom';
|
|
182
189
|
const bannerBelowToolbar = selectionBannerPlacement === 'belowToolbar' && Boolean(pagination);
|
|
183
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
|
+
});
|
|
184
199
|
|
|
185
200
|
// in server-side pagination we want to update the selection status
|
|
186
201
|
// every time we navigate between pages, resize our page or select something
|
|
187
202
|
useEffect(() => {
|
|
188
203
|
if (paginationMode == 'server') {
|
|
189
|
-
onServerSideSelectionStatusChange(
|
|
204
|
+
onServerSideSelectionStatusChange(rowSelectionModel, apiRef, selectionStatusRef, forceSelectionUpdate, isRowSelectable, paginationModel.page, paginationModel.pageSize);
|
|
190
205
|
}
|
|
191
206
|
}, [rowSelectionModel, paginationModel.page, paginationModel.pageSize, rows]);
|
|
192
207
|
if (!Array.isArray(rows)) {
|
|
@@ -198,9 +213,15 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
198
213
|
// receive the fresh value in the same render cycle — no extra re-render needed.
|
|
199
214
|
// The ref is kept in sync for the onRowSelectionModelChange callback's deselect logic.
|
|
200
215
|
let selectionStatus = selectionStatusRef.current;
|
|
201
|
-
if (pagination && paginationMode !== 'server' &&
|
|
216
|
+
if (pagination && paginationMode !== 'server' && getSelectionCount(rowSelectionModel) > 0) {
|
|
202
217
|
try {
|
|
203
|
-
|
|
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);
|
|
222
|
+
const pageStart = paginationModel.page * paginationModel.pageSize;
|
|
223
|
+
const pageEntries = allFilteredEntries.slice(pageStart, pageStart + paginationModel.pageSize);
|
|
224
|
+
const selectableRowsInPage = isRowSelectable ? pageEntries.filter(_ref => {
|
|
204
225
|
let {
|
|
205
226
|
model
|
|
206
227
|
} = _ref;
|
|
@@ -212,24 +233,29 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
212
233
|
id
|
|
213
234
|
} = _ref2;
|
|
214
235
|
return id;
|
|
215
|
-
}) :
|
|
236
|
+
}) : pageEntries.map(_ref3 => {
|
|
237
|
+
let {
|
|
238
|
+
id
|
|
239
|
+
} = _ref3;
|
|
240
|
+
return id;
|
|
241
|
+
});
|
|
216
242
|
const numberOfSelectableRowsInPage = selectableRowsInPage.length;
|
|
217
|
-
const selectableRowsInTable = isRowSelectable ?
|
|
243
|
+
const selectableRowsInTable = isRowSelectable ? allFilteredEntries.filter(_ref4 => {
|
|
218
244
|
let {
|
|
219
245
|
model
|
|
220
|
-
} =
|
|
246
|
+
} = _ref4;
|
|
221
247
|
return isRowSelectable({
|
|
222
248
|
row: model
|
|
223
249
|
});
|
|
224
|
-
}).map(
|
|
250
|
+
}).map(_ref5 => {
|
|
225
251
|
let {
|
|
226
252
|
id
|
|
227
|
-
} =
|
|
253
|
+
} = _ref5;
|
|
228
254
|
return id;
|
|
229
255
|
}) : gridFilteredSortedRowIdsSelector(apiRef);
|
|
230
256
|
const numberOfSelectableRowsInTable = selectableRowsInTable.length;
|
|
231
|
-
const numberOfSelectedRows = rowSelectionModel
|
|
232
|
-
const selectedOnCurrentPage = selectableRowsInPage.filter(id => rowSelectionModel
|
|
257
|
+
const numberOfSelectedRows = getSelectionCount(rowSelectionModel);
|
|
258
|
+
const selectedOnCurrentPage = selectableRowsInPage.filter(id => isRowSelected(rowSelectionModel, id));
|
|
233
259
|
if (numberOfSelectedRows === numberOfSelectableRowsInTable && numberOfSelectableRowsInPage < numberOfSelectableRowsInTable) {
|
|
234
260
|
selectionStatus = {
|
|
235
261
|
type: 'table',
|
|
@@ -273,6 +299,48 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
273
299
|
}
|
|
274
300
|
}
|
|
275
301
|
}), [theme]);
|
|
302
|
+
|
|
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,
|
|
309
|
+
hideToolbar,
|
|
310
|
+
filterModel,
|
|
311
|
+
onFilterModelChange,
|
|
312
|
+
pagination,
|
|
313
|
+
paginationMode,
|
|
314
|
+
displaySelection: bannerBelowToolbar,
|
|
315
|
+
displayPagination: pagerBelowToolbar,
|
|
316
|
+
displayRowsPerPage: pagerBelowToolbar,
|
|
317
|
+
selectionStatus,
|
|
318
|
+
apiRef,
|
|
319
|
+
isRowSelectable,
|
|
320
|
+
paginationModel,
|
|
321
|
+
onPaginationModelChange,
|
|
322
|
+
pageSizeOptions: pageSizeOptions,
|
|
323
|
+
paginationProps,
|
|
324
|
+
rowCount
|
|
325
|
+
};
|
|
326
|
+
|
|
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.
|
|
329
|
+
const bottomPaginationSlotProps = {
|
|
330
|
+
pagination,
|
|
331
|
+
paginationMode,
|
|
332
|
+
displaySelection: bannerAtBottom,
|
|
333
|
+
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
334
|
+
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
335
|
+
selectionStatus,
|
|
336
|
+
paginationModel,
|
|
337
|
+
onPaginationModelChange,
|
|
338
|
+
apiRef,
|
|
339
|
+
isRowSelectable,
|
|
340
|
+
pageSizeOptions: pageSizeOptions,
|
|
341
|
+
paginationProps,
|
|
342
|
+
rowCount
|
|
343
|
+
};
|
|
276
344
|
return /*#__PURE__*/React__default.createElement(ThemeProvider, {
|
|
277
345
|
value: {
|
|
278
346
|
theme
|
|
@@ -283,63 +351,51 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
283
351
|
ref: datagridRef,
|
|
284
352
|
className: classNames(DataGrid.className, className),
|
|
285
353
|
$height: height
|
|
286
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
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, {
|
|
287
376
|
rowCount: rowCount,
|
|
288
377
|
apiRef: apiRef,
|
|
289
378
|
autoHeight: autoHeight,
|
|
290
379
|
checkboxSelectionVisibleOnly: checkboxSelectionVisibleOnly,
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
toolbar: ToolbarWrapper,
|
|
380
|
+
disableRowSelectionExcludeModel: true,
|
|
381
|
+
showToolbar: !hideToolbar || belowToolbarActive,
|
|
382
|
+
slots: _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, baseGridSlots), slots), belowToolbarActive ? {
|
|
383
|
+
toolbar: BelowToolbar
|
|
384
|
+
} : {}), {}, {
|
|
297
385
|
pagination: BottomPagination
|
|
298
386
|
}),
|
|
299
|
-
slotProps: _objectSpread2(_objectSpread2({}, slotProps),
|
|
300
|
-
toolbar: _objectSpread2({
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
filterModel,
|
|
304
|
-
onFilterModelChange,
|
|
305
|
-
pagination,
|
|
306
|
-
displaySelection: bannerAtTop || bannerBelowToolbar,
|
|
307
|
-
displayPagination: ['top', 'both'].includes(paginationPlacement) || pagerBelowToolbar,
|
|
308
|
-
displayRowsPerPage: pagerBelowToolbar,
|
|
309
|
-
selectionStatus,
|
|
310
|
-
apiRef,
|
|
311
|
-
isRowSelectable,
|
|
312
|
-
paginationModel,
|
|
313
|
-
onPaginationModelChange,
|
|
314
|
-
pageSizeOptions,
|
|
315
|
-
paginationProps,
|
|
316
|
-
paginationMode,
|
|
317
|
-
rowCount
|
|
318
|
-
}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.toolbar),
|
|
319
|
-
// Per-render data for the stable `BottomPagination` slot. Consumer slot props are
|
|
320
|
-
// spread first; the DS layout data wins. Cast at the MUI boundary because these are
|
|
321
|
-
// ToolbarWrapper props, not the MUI slot prop types.
|
|
322
|
-
pagination: _objectSpread2(_objectSpread2({}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.pagination), {}, {
|
|
323
|
-
pagination,
|
|
324
|
-
paginationMode,
|
|
325
|
-
displaySelection: bannerAtBottom,
|
|
326
|
-
displayRowsPerPage: ['bottom', 'both'].includes(paginationPlacement),
|
|
327
|
-
displayPagination: ['bottom', 'both'].includes(paginationPlacement),
|
|
328
|
-
selectionStatus,
|
|
329
|
-
paginationModel,
|
|
330
|
-
onPaginationModelChange,
|
|
331
|
-
apiRef,
|
|
332
|
-
isRowSelectable,
|
|
333
|
-
pageSizeOptions,
|
|
334
|
-
paginationProps,
|
|
335
|
-
rowCount
|
|
336
|
-
})
|
|
387
|
+
slotProps: _objectSpread2(_objectSpread2(_objectSpread2({}, slotProps), belowToolbarActive ? {
|
|
388
|
+
toolbar: _objectSpread2(_objectSpread2({}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.toolbar), belowToolbarSlotProps)
|
|
389
|
+
} : {}), {}, {
|
|
390
|
+
pagination: _objectSpread2(_objectSpread2({}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.pagination), bottomPaginationSlotProps)
|
|
337
391
|
}),
|
|
338
392
|
filterModel: filterModel,
|
|
339
393
|
columnVisibilityModel: columnVisibilityModel,
|
|
340
394
|
pinnedColumns: pinnedColumns,
|
|
341
395
|
sortModel: sortModel,
|
|
342
|
-
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
|
+
}),
|
|
343
399
|
isRowSelectable: isRowSelectable,
|
|
344
400
|
onFilterModelChange: onFilterModelChange,
|
|
345
401
|
onColumnVisibilityModelChange: onColumnVisibilityModelChange,
|
|
@@ -359,41 +415,52 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
359
415
|
// Fix server-side header checkbox: when MUI deselects all due to indeterminate
|
|
360
416
|
// state (cross-page selections exist, 0 on current page), convert to "select page".
|
|
361
417
|
if (pagination && paginationMode === 'server') {
|
|
362
|
-
effectiveSelectionModel = fixServerSideHeaderCheckboxSelection(newSelectionModel,
|
|
418
|
+
effectiveSelectionModel = fixServerSideHeaderCheckboxSelection(newSelectionModel, rowSelectionModel, selectionStatusRef, apiRef, isRowSelectable);
|
|
363
419
|
}
|
|
364
420
|
if (pagination && paginationMode != 'server') {
|
|
365
|
-
|
|
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 => {
|
|
366
427
|
let {
|
|
367
428
|
model
|
|
368
|
-
} =
|
|
429
|
+
} = _ref8;
|
|
369
430
|
return isRowSelectable({
|
|
370
431
|
row: model
|
|
371
432
|
});
|
|
372
|
-
}).map(
|
|
433
|
+
}).map(_ref9 => {
|
|
373
434
|
let {
|
|
374
435
|
id
|
|
375
|
-
} =
|
|
436
|
+
} = _ref9;
|
|
376
437
|
return id;
|
|
377
|
-
}) :
|
|
438
|
+
}) : pageEntries.map(_ref10 => {
|
|
439
|
+
let {
|
|
440
|
+
id
|
|
441
|
+
} = _ref10;
|
|
442
|
+
return id;
|
|
443
|
+
});
|
|
378
444
|
const numberOfSelectableRowsInPage = selectableRowsInPage.length;
|
|
379
|
-
const selectableRowsInTable = isRowSelectable ?
|
|
445
|
+
const selectableRowsInTable = isRowSelectable ? allFilteredEntries.filter(_ref11 => {
|
|
380
446
|
let {
|
|
381
447
|
model
|
|
382
|
-
} =
|
|
448
|
+
} = _ref11;
|
|
383
449
|
return isRowSelectable({
|
|
384
450
|
row: model
|
|
385
451
|
});
|
|
386
|
-
}).map(
|
|
452
|
+
}).map(_ref12 => {
|
|
387
453
|
let {
|
|
388
454
|
id
|
|
389
|
-
} =
|
|
455
|
+
} = _ref12;
|
|
390
456
|
return id;
|
|
391
457
|
}) : gridFilteredSortedRowIdsSelector(apiRef);
|
|
392
458
|
const numberOfSelectableRowsInTable = selectableRowsInTable.length;
|
|
393
|
-
const numberOfSelectedRows = newSelectionModel
|
|
459
|
+
const numberOfSelectedRows = getSelectionCount(newSelectionModel);
|
|
394
460
|
if (selectionStatusRef.current.type === 'table' && numberOfSelectedRows === numberOfSelectableRowsInTable - numberOfSelectableRowsInPage || selectionStatusRef.current.type === 'table' && numberOfSelectedRows === numberOfSelectableRowsInTable || selectionStatusRef.current.type === 'page' && numberOfSelectedRows === numberOfSelectableRowsInPage) {
|
|
395
461
|
setTimeout(() => {
|
|
396
|
-
|
|
462
|
+
var _apiRef$current;
|
|
463
|
+
(_apiRef$current = apiRef.current) === null || _apiRef$current === void 0 ? void 0 : _apiRef$current.selectRows([], true, true);
|
|
397
464
|
}, 0);
|
|
398
465
|
}
|
|
399
466
|
if (numberOfSelectedRows === numberOfSelectableRowsInPage && numberOfSelectableRowsInPage < numberOfSelectableRowsInTable) {
|
|
@@ -417,6 +484,7 @@ const DataGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
417
484
|
numberOfSelectedRows
|
|
418
485
|
};
|
|
419
486
|
}
|
|
487
|
+
forceSelectionUpdate(v => v + 1);
|
|
420
488
|
}
|
|
421
489
|
onRowSelectionModelChange === null || onRowSelectionModelChange === void 0 ? void 0 : onRowSelectionModelChange(effectiveSelectionModel, details);
|
|
422
490
|
},
|