@mui/x-data-grid 8.0.0-alpha.0 → 8.0.0-alpha.2
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/CHANGELOG.md +651 -6
- package/DataGrid/DataGrid.js +9 -9
- package/README.md +2 -2
- package/components/GridLoadingOverlay.d.ts +2 -2
- package/components/GridLoadingOverlay.js +4 -4
- package/components/GridPagination.js +2 -1
- package/components/base/GridOverlays.d.ts +4 -3
- package/components/base/GridOverlays.js +2 -24
- package/components/base/index.d.ts +0 -1
- package/components/base/index.js +1 -2
- package/components/cell/GridCell.js +10 -10
- package/components/columnSelection/GridCellCheckboxRenderer.js +2 -3
- package/components/columnSelection/GridHeaderCheckbox.js +2 -3
- package/components/columnsManagement/GridColumnsManagement.d.ts +2 -0
- package/components/columnsManagement/GridColumnsManagement.js +53 -6
- package/components/toolbar/GridToolbarColumnsButton.js +3 -4
- package/components/toolbar/GridToolbarDensitySelector.js +3 -4
- package/components/toolbar/GridToolbarExportContainer.js +3 -4
- package/components/toolbar/GridToolbarFilterButton.d.ts +2 -0
- package/components/toolbar/GridToolbarFilterButton.js +7 -6
- package/components/toolbar/GridToolbarQuickFilter.js +1 -0
- package/components/virtualization/GridVirtualScroller.js +5 -3
- package/constants/dataGridPropsDefaultValues.js +2 -3
- package/constants/gridClasses.d.ts +24 -0
- package/constants/gridClasses.js +1 -1
- package/constants/localeTextConstants.js +11 -0
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +2 -2
- package/hooks/features/dimensions/gridDimensionsApi.d.ts +0 -4
- package/hooks/features/dimensions/useGridDimensions.js +3 -19
- package/hooks/features/index.d.ts +1 -0
- package/hooks/features/index.js +1 -0
- package/hooks/features/listView/gridListViewSelectors.d.ts +3 -1
- package/hooks/features/listView/gridListViewSelectors.js +3 -1
- package/hooks/features/listView/index.d.ts +1 -0
- package/hooks/features/listView/index.js +1 -0
- package/hooks/features/overlays/useGridOverlays.d.ts +7 -4
- package/hooks/features/overlays/useGridOverlays.js +19 -1
- package/hooks/features/rowSelection/useGridRowSelection.js +0 -9
- package/hooks/features/rowSelection/utils.js +2 -2
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +1 -1
- package/hooks/features/virtualization/useGridVirtualScroller.js +55 -15
- package/index.js +1 -1
- package/internals/index.d.ts +1 -0
- package/internals/index.js +1 -0
- package/joy/joySlots.js +7 -2
- package/locales/arSD.js +12 -0
- package/locales/beBY.js +12 -0
- package/locales/bgBG.js +13 -0
- package/locales/csCZ.js +13 -0
- package/locales/daDK.js +13 -0
- package/locales/deDE.js +11 -0
- package/locales/elGR.js +12 -0
- package/locales/esES.js +15 -4
- package/locales/faIR.js +13 -0
- package/locales/fiFI.js +13 -0
- package/locales/frFR.js +13 -0
- package/locales/heIL.js +13 -0
- package/locales/hrHR.js +13 -0
- package/locales/huHU.js +13 -0
- package/locales/isIS.js +12 -0
- package/locales/itIT.js +13 -0
- package/locales/jaJP.js +13 -0
- package/locales/koKR.js +12 -0
- package/locales/nbNO.js +13 -0
- package/locales/nlNL.js +13 -0
- package/locales/nnNO.js +13 -0
- package/locales/plPL.js +13 -0
- package/locales/ptBR.js +11 -0
- package/locales/ptPT.js +11 -0
- package/locales/roRO.js +12 -0
- package/locales/ruRU.js +13 -0
- package/locales/skSK.js +12 -0
- package/locales/svSE.js +17 -5
- package/locales/trTR.js +13 -0
- package/locales/ukUA.js +12 -0
- package/locales/urPK.js +12 -0
- package/locales/viVN.js +13 -0
- package/locales/zhCN.js +15 -4
- package/locales/zhHK.js +12 -0
- package/locales/zhTW.js +12 -0
- package/models/api/gridCoreApi.d.ts +1 -1
- package/models/api/gridLocaleTextApi.d.ts +10 -0
- package/models/colDef/gridColDef.d.ts +28 -24
- package/models/gridDataSource.d.ts +12 -12
- package/models/props/DataGridProps.d.ts +9 -9
- package/modern/DataGrid/DataGrid.js +9 -9
- package/modern/components/GridLoadingOverlay.js +4 -4
- package/modern/components/GridPagination.js +2 -1
- package/modern/components/base/GridOverlays.js +2 -24
- package/modern/components/base/index.js +1 -2
- package/modern/components/cell/GridCell.js +10 -10
- package/modern/components/columnSelection/GridCellCheckboxRenderer.js +2 -3
- package/modern/components/columnSelection/GridHeaderCheckbox.js +2 -3
- package/modern/components/columnsManagement/GridColumnsManagement.js +53 -6
- package/modern/components/toolbar/GridToolbarColumnsButton.js +3 -4
- package/modern/components/toolbar/GridToolbarDensitySelector.js +3 -4
- package/modern/components/toolbar/GridToolbarExportContainer.js +3 -4
- package/modern/components/toolbar/GridToolbarFilterButton.js +7 -6
- package/modern/components/toolbar/GridToolbarQuickFilter.js +1 -0
- package/modern/components/virtualization/GridVirtualScroller.js +5 -3
- package/modern/constants/dataGridPropsDefaultValues.js +2 -3
- package/modern/constants/gridClasses.js +1 -1
- package/modern/constants/localeTextConstants.js +11 -0
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +2 -2
- package/modern/hooks/features/dimensions/useGridDimensions.js +3 -19
- package/modern/hooks/features/index.js +1 -0
- package/modern/hooks/features/listView/gridListViewSelectors.js +3 -1
- package/modern/hooks/features/listView/index.js +1 -0
- package/modern/hooks/features/overlays/useGridOverlays.js +19 -1
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +0 -9
- package/modern/hooks/features/rowSelection/utils.js +2 -2
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +55 -15
- package/modern/index.js +1 -1
- package/modern/internals/index.js +1 -0
- package/modern/joy/joySlots.js +7 -2
- package/modern/locales/arSD.js +12 -0
- package/modern/locales/beBY.js +12 -0
- package/modern/locales/bgBG.js +13 -0
- package/modern/locales/csCZ.js +13 -0
- package/modern/locales/daDK.js +13 -0
- package/modern/locales/deDE.js +11 -0
- package/modern/locales/elGR.js +12 -0
- package/modern/locales/esES.js +15 -4
- package/modern/locales/faIR.js +13 -0
- package/modern/locales/fiFI.js +13 -0
- package/modern/locales/frFR.js +13 -0
- package/modern/locales/heIL.js +13 -0
- package/modern/locales/hrHR.js +13 -0
- package/modern/locales/huHU.js +13 -0
- package/modern/locales/isIS.js +12 -0
- package/modern/locales/itIT.js +13 -0
- package/modern/locales/jaJP.js +13 -0
- package/modern/locales/koKR.js +12 -0
- package/modern/locales/nbNO.js +13 -0
- package/modern/locales/nlNL.js +13 -0
- package/modern/locales/nnNO.js +13 -0
- package/modern/locales/plPL.js +13 -0
- package/modern/locales/ptBR.js +11 -0
- package/modern/locales/ptPT.js +11 -0
- package/modern/locales/roRO.js +12 -0
- package/modern/locales/ruRU.js +13 -0
- package/modern/locales/skSK.js +12 -0
- package/modern/locales/svSE.js +17 -5
- package/modern/locales/trTR.js +13 -0
- package/modern/locales/ukUA.js +12 -0
- package/modern/locales/urPK.js +12 -0
- package/modern/locales/viVN.js +13 -0
- package/modern/locales/zhCN.js +15 -4
- package/modern/locales/zhHK.js +12 -0
- package/modern/locales/zhTW.js +12 -0
- package/node/DataGrid/DataGrid.js +9 -9
- package/node/components/GridLoadingOverlay.js +4 -4
- package/node/components/GridPagination.js +2 -1
- package/node/components/base/GridOverlays.js +2 -24
- package/node/components/base/index.js +0 -11
- package/node/components/cell/GridCell.js +10 -10
- package/node/components/columnSelection/GridCellCheckboxRenderer.js +2 -3
- package/node/components/columnSelection/GridHeaderCheckbox.js +2 -3
- package/node/components/columnsManagement/GridColumnsManagement.js +53 -6
- package/node/components/toolbar/GridToolbarColumnsButton.js +3 -4
- package/node/components/toolbar/GridToolbarDensitySelector.js +3 -4
- package/node/components/toolbar/GridToolbarExportContainer.js +3 -4
- package/node/components/toolbar/GridToolbarFilterButton.js +7 -6
- package/node/components/toolbar/GridToolbarQuickFilter.js +1 -0
- package/node/components/virtualization/GridVirtualScroller.js +5 -3
- package/node/constants/dataGridPropsDefaultValues.js +2 -3
- package/node/constants/gridClasses.js +1 -1
- package/node/constants/localeTextConstants.js +11 -0
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +2 -2
- package/node/hooks/features/dimensions/useGridDimensions.js +2 -18
- package/node/hooks/features/index.js +11 -0
- package/node/hooks/features/listView/gridListViewSelectors.js +3 -1
- package/node/hooks/features/listView/index.js +16 -0
- package/node/hooks/features/overlays/useGridOverlays.js +21 -1
- package/node/hooks/features/rowSelection/useGridRowSelection.js +0 -9
- package/node/hooks/features/rowSelection/utils.js +2 -2
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +55 -15
- package/node/index.js +1 -1
- package/node/internals/index.js +9 -2
- package/node/joy/joySlots.js +7 -2
- package/node/locales/arSD.js +12 -0
- package/node/locales/beBY.js +12 -0
- package/node/locales/bgBG.js +13 -0
- package/node/locales/csCZ.js +13 -0
- package/node/locales/daDK.js +13 -0
- package/node/locales/deDE.js +11 -0
- package/node/locales/elGR.js +12 -0
- package/node/locales/esES.js +15 -4
- package/node/locales/faIR.js +13 -0
- package/node/locales/fiFI.js +13 -0
- package/node/locales/frFR.js +13 -0
- package/node/locales/heIL.js +13 -0
- package/node/locales/hrHR.js +13 -0
- package/node/locales/huHU.js +13 -0
- package/node/locales/isIS.js +12 -0
- package/node/locales/itIT.js +13 -0
- package/node/locales/jaJP.js +13 -0
- package/node/locales/koKR.js +12 -0
- package/node/locales/nbNO.js +13 -0
- package/node/locales/nlNL.js +13 -0
- package/node/locales/nnNO.js +13 -0
- package/node/locales/plPL.js +13 -0
- package/node/locales/ptBR.js +11 -0
- package/node/locales/ptPT.js +11 -0
- package/node/locales/roRO.js +12 -0
- package/node/locales/ruRU.js +13 -0
- package/node/locales/skSK.js +12 -0
- package/node/locales/svSE.js +17 -5
- package/node/locales/trTR.js +13 -0
- package/node/locales/ukUA.js +12 -0
- package/node/locales/urPK.js +12 -0
- package/node/locales/viVN.js +13 -0
- package/node/locales/zhCN.js +15 -4
- package/node/locales/zhHK.js +12 -0
- package/node/locales/zhTW.js +12 -0
- package/package.json +4 -4
|
@@ -92,12 +92,11 @@ const GridHeaderCheckbox = /*#__PURE__*/React.forwardRef(function GridHeaderChec
|
|
|
92
92
|
React.useEffect(() => {
|
|
93
93
|
return apiRef.current.subscribeEvent('rowSelectionChange', handleSelectionChange);
|
|
94
94
|
}, [apiRef, handleSelectionChange]);
|
|
95
|
-
const label = apiRef.current.getLocaleText(isChecked ? 'checkboxSelectionUnselectAllRows' : 'checkboxSelectionSelectAllRows');
|
|
96
|
-
const checked = rootProps.indeterminateCheckboxAction === 'select' ? isChecked && !isIndeterminate : isChecked;
|
|
95
|
+
const label = apiRef.current.getLocaleText(isChecked && !isIndeterminate ? 'checkboxSelectionUnselectAllRows' : 'checkboxSelectionSelectAllRows');
|
|
97
96
|
return /*#__PURE__*/_jsx(rootProps.slots.baseCheckbox, _extends({
|
|
98
97
|
ref: ref,
|
|
99
98
|
indeterminate: isIndeterminate,
|
|
100
|
-
checked:
|
|
99
|
+
checked: isChecked && !isIndeterminate,
|
|
101
100
|
onChange: handleChange,
|
|
102
101
|
className: classes.root,
|
|
103
102
|
inputProps: {
|
|
@@ -5,6 +5,8 @@ import PropTypes from 'prop-types';
|
|
|
5
5
|
import composeClasses from '@mui/utils/composeClasses';
|
|
6
6
|
import FormControlLabel from '@mui/material/FormControlLabel';
|
|
7
7
|
import { styled } from '@mui/material/styles';
|
|
8
|
+
import TextField from '@mui/material/TextField';
|
|
9
|
+
import { inputBaseClasses } from '@mui/material/InputBase';
|
|
8
10
|
import { gridColumnDefinitionsSelector, gridColumnVisibilityModelSelector } from "../../hooks/features/columns/gridColumnsSelector.js";
|
|
9
11
|
import { useGridSelector } from "../../hooks/utils/useGridSelector.js";
|
|
10
12
|
import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
|
|
@@ -20,6 +22,7 @@ const useUtilityClasses = ownerState => {
|
|
|
20
22
|
const slots = {
|
|
21
23
|
root: ['columnsManagement'],
|
|
22
24
|
header: ['columnsManagementHeader'],
|
|
25
|
+
searchInput: ['columnsManagementSearchInput'],
|
|
23
26
|
footer: ['columnsManagementFooter'],
|
|
24
27
|
row: ['columnsManagementRow']
|
|
25
28
|
};
|
|
@@ -42,7 +45,8 @@ function GridColumnsManagement(props) {
|
|
|
42
45
|
disableShowHideToggle = false,
|
|
43
46
|
disableResetButton = false,
|
|
44
47
|
toggleAllMode = 'all',
|
|
45
|
-
getTogglableColumns
|
|
48
|
+
getTogglableColumns,
|
|
49
|
+
searchInputProps
|
|
46
50
|
} = props;
|
|
47
51
|
const isResetDisabled = React.useMemo(() => checkColumnVisibilityModelsSame(columnVisibilityModel, initialColumnVisibilityModel), [columnVisibilityModel, initialColumnVisibilityModel]);
|
|
48
52
|
const sortedColumns = React.useMemo(() => {
|
|
@@ -109,28 +113,52 @@ function GridColumnsManagement(props) {
|
|
|
109
113
|
}
|
|
110
114
|
return false;
|
|
111
115
|
};
|
|
116
|
+
const handleSearchReset = React.useCallback(() => {
|
|
117
|
+
setSearchValue('');
|
|
118
|
+
searchInputRef.current.focus();
|
|
119
|
+
}, []);
|
|
112
120
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
113
121
|
children: [/*#__PURE__*/_jsx(GridColumnsManagementHeader, {
|
|
114
122
|
className: classes.header,
|
|
115
123
|
ownerState: rootProps,
|
|
116
|
-
children: /*#__PURE__*/_jsx(
|
|
124
|
+
children: /*#__PURE__*/_jsx(SearchInput, _extends({
|
|
125
|
+
as: rootProps.slots.baseTextField,
|
|
126
|
+
ownerState: rootProps,
|
|
117
127
|
placeholder: apiRef.current.getLocaleText('columnsManagementSearchTitle'),
|
|
118
128
|
inputRef: searchInputRef,
|
|
129
|
+
className: classes.searchInput,
|
|
119
130
|
value: searchValue,
|
|
120
131
|
onChange: handleSearchValueChange,
|
|
121
132
|
variant: "outlined",
|
|
122
133
|
size: "small",
|
|
134
|
+
type: "search",
|
|
123
135
|
InputProps: {
|
|
124
136
|
startAdornment: /*#__PURE__*/_jsx(rootProps.slots.baseInputAdornment, {
|
|
125
137
|
position: "start",
|
|
126
138
|
children: /*#__PURE__*/_jsx(rootProps.slots.quickFilterIcon, {})
|
|
127
139
|
}),
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
140
|
+
endAdornment: /*#__PURE__*/_jsx(rootProps.slots.baseIconButton, _extends({
|
|
141
|
+
"aria-label": apiRef.current.getLocaleText('columnsManagementDeleteIconLabel'),
|
|
142
|
+
size: "small",
|
|
143
|
+
sx: [searchValue ? {
|
|
144
|
+
visibility: 'visible'
|
|
145
|
+
} : {
|
|
146
|
+
visibility: 'hidden'
|
|
147
|
+
}],
|
|
148
|
+
tabIndex: -1,
|
|
149
|
+
onClick: handleSearchReset
|
|
150
|
+
}, rootProps.slotProps?.baseIconButton, {
|
|
151
|
+
children: /*#__PURE__*/_jsx(rootProps.slots.quickFilterClearIcon, {
|
|
152
|
+
fontSize: "small"
|
|
153
|
+
})
|
|
154
|
+
}))
|
|
155
|
+
},
|
|
156
|
+
inputProps: {
|
|
157
|
+
'aria-label': apiRef.current.getLocaleText('columnsManagementSearchTitle')
|
|
131
158
|
},
|
|
159
|
+
autoComplete: "off",
|
|
132
160
|
fullWidth: true
|
|
133
|
-
}, rootProps.slotProps?.baseTextField))
|
|
161
|
+
}, rootProps.slotProps?.baseTextField, searchInputProps))
|
|
134
162
|
}), /*#__PURE__*/_jsxs(GridColumnsManagementBody, {
|
|
135
163
|
className: classes.root,
|
|
136
164
|
ownerState: rootProps,
|
|
@@ -205,6 +233,7 @@ process.env.NODE_ENV !== "production" ? GridColumnsManagement.propTypes = {
|
|
|
205
233
|
* @returns {GridColDef['field'][]} The list of togglable columns' field names.
|
|
206
234
|
*/
|
|
207
235
|
getTogglableColumns: PropTypes.func,
|
|
236
|
+
searchInputProps: PropTypes.object,
|
|
208
237
|
searchPredicate: PropTypes.func,
|
|
209
238
|
sort: PropTypes.oneOf(['asc', 'desc']),
|
|
210
239
|
/**
|
|
@@ -239,6 +268,24 @@ const GridColumnsManagementHeader = styled('div', {
|
|
|
239
268
|
}) => ({
|
|
240
269
|
padding: theme.spacing(1.5, 3)
|
|
241
270
|
}));
|
|
271
|
+
const SearchInput = styled(TextField, {
|
|
272
|
+
name: 'MuiDataGrid',
|
|
273
|
+
slot: 'ColumnsManagementSearchInput',
|
|
274
|
+
overridesResolver: (props, styles) => styles.columnsManagementSearchInput
|
|
275
|
+
})(({
|
|
276
|
+
theme
|
|
277
|
+
}) => ({
|
|
278
|
+
[`& .${inputBaseClasses.root}`]: {
|
|
279
|
+
padding: theme.spacing(0, 1.5, 0, 1.5)
|
|
280
|
+
},
|
|
281
|
+
[`& .${inputBaseClasses.input}::-webkit-search-decoration,
|
|
282
|
+
& .${inputBaseClasses.input}::-webkit-search-cancel-button,
|
|
283
|
+
& .${inputBaseClasses.input}::-webkit-search-results-button,
|
|
284
|
+
& .${inputBaseClasses.input}::-webkit-search-results-decoration`]: {
|
|
285
|
+
/* clears the 'X' icon from Chrome */
|
|
286
|
+
display: 'none'
|
|
287
|
+
}
|
|
288
|
+
}));
|
|
242
289
|
const GridColumnsManagementFooter = styled('div', {
|
|
243
290
|
name: 'MuiDataGrid',
|
|
244
291
|
slot: 'ColumnsManagementFooter',
|
|
@@ -36,7 +36,7 @@ const GridToolbarColumnsButton = /*#__PURE__*/React.forwardRef(function GridTool
|
|
|
36
36
|
return /*#__PURE__*/_jsx(rootProps.slots.baseTooltip, _extends({
|
|
37
37
|
title: apiRef.current.getLocaleText('toolbarColumnsLabel'),
|
|
38
38
|
enterDelay: 1000
|
|
39
|
-
},
|
|
39
|
+
}, rootProps.slotProps?.baseTooltip, tooltipProps, {
|
|
40
40
|
children: /*#__PURE__*/_jsx(rootProps.slots.baseButton, _extends({
|
|
41
41
|
ref: ref,
|
|
42
42
|
id: columnButtonId,
|
|
@@ -45,10 +45,9 @@ const GridToolbarColumnsButton = /*#__PURE__*/React.forwardRef(function GridTool
|
|
|
45
45
|
"aria-haspopup": "menu",
|
|
46
46
|
"aria-expanded": isOpen,
|
|
47
47
|
"aria-controls": isOpen ? columnPanelId : undefined,
|
|
48
|
-
startIcon: /*#__PURE__*/_jsx(rootProps.slots.columnSelectorIcon, {})
|
|
49
|
-
}, buttonProps, {
|
|
48
|
+
startIcon: /*#__PURE__*/_jsx(rootProps.slots.columnSelectorIcon, {}),
|
|
50
49
|
onClick: showColumns
|
|
51
|
-
}, rootProps.slotProps?.baseButton, {
|
|
50
|
+
}, rootProps.slotProps?.baseButton, buttonProps, {
|
|
52
51
|
children: apiRef.current.getLocaleText('toolbarColumns')
|
|
53
52
|
}))
|
|
54
53
|
}));
|
|
@@ -83,7 +83,7 @@ const GridToolbarDensitySelector = /*#__PURE__*/React.forwardRef(function GridTo
|
|
|
83
83
|
children: [/*#__PURE__*/_jsx(rootProps.slots.baseTooltip, _extends({
|
|
84
84
|
title: apiRef.current.getLocaleText('toolbarDensityLabel'),
|
|
85
85
|
enterDelay: 1000
|
|
86
|
-
},
|
|
86
|
+
}, rootProps.slotProps?.baseTooltip, tooltipProps, {
|
|
87
87
|
children: /*#__PURE__*/_jsx(rootProps.slots.baseButton, _extends({
|
|
88
88
|
ref: handleRef,
|
|
89
89
|
size: "small",
|
|
@@ -92,10 +92,9 @@ const GridToolbarDensitySelector = /*#__PURE__*/React.forwardRef(function GridTo
|
|
|
92
92
|
"aria-haspopup": "menu",
|
|
93
93
|
"aria-expanded": open,
|
|
94
94
|
"aria-controls": open ? densityMenuId : undefined,
|
|
95
|
-
id: densityButtonId
|
|
96
|
-
}, buttonProps, {
|
|
95
|
+
id: densityButtonId,
|
|
97
96
|
onClick: handleDensitySelectorOpen
|
|
98
|
-
}, rootProps.slotProps?.baseButton, {
|
|
97
|
+
}, rootProps.slotProps?.baseButton, buttonProps, {
|
|
99
98
|
children: apiRef.current.getLocaleText('toolbarDensity')
|
|
100
99
|
}))
|
|
101
100
|
})), /*#__PURE__*/_jsx(GridMenu, {
|
|
@@ -42,7 +42,7 @@ const GridToolbarExportContainer = /*#__PURE__*/React.forwardRef(function GridTo
|
|
|
42
42
|
children: [/*#__PURE__*/_jsx(rootProps.slots.baseTooltip, _extends({
|
|
43
43
|
title: apiRef.current.getLocaleText('toolbarExportLabel'),
|
|
44
44
|
enterDelay: 1000
|
|
45
|
-
},
|
|
45
|
+
}, rootProps.slotProps?.baseTooltip, tooltipProps, {
|
|
46
46
|
children: /*#__PURE__*/_jsx(rootProps.slots.baseButton, _extends({
|
|
47
47
|
ref: handleRef,
|
|
48
48
|
size: "small",
|
|
@@ -51,10 +51,9 @@ const GridToolbarExportContainer = /*#__PURE__*/React.forwardRef(function GridTo
|
|
|
51
51
|
"aria-label": apiRef.current.getLocaleText('toolbarExportLabel'),
|
|
52
52
|
"aria-haspopup": "menu",
|
|
53
53
|
"aria-controls": open ? exportMenuId : undefined,
|
|
54
|
-
id: exportButtonId
|
|
55
|
-
}, buttonProps, {
|
|
54
|
+
id: exportButtonId,
|
|
56
55
|
onClick: handleMenuOpen
|
|
57
|
-
}, rootProps.slotProps?.baseButton, {
|
|
56
|
+
}, rootProps.slotProps?.baseButton, buttonProps, {
|
|
58
57
|
children: apiRef.current.getLocaleText('toolbarExport')
|
|
59
58
|
}))
|
|
60
59
|
})), /*#__PURE__*/_jsx(GridMenu, {
|
|
@@ -37,6 +37,7 @@ const GridToolbarFilterButton = /*#__PURE__*/React.forwardRef(function GridToolb
|
|
|
37
37
|
} = props;
|
|
38
38
|
const buttonProps = slotProps.button || {};
|
|
39
39
|
const tooltipProps = slotProps.tooltip || {};
|
|
40
|
+
const badgeProps = slotProps.badge || {};
|
|
40
41
|
const apiRef = useGridApiContext();
|
|
41
42
|
const rootProps = useGridRootProps();
|
|
42
43
|
const activeFilters = useGridSelector(apiRef, gridFilterActiveItemsSelector);
|
|
@@ -94,7 +95,7 @@ const GridToolbarFilterButton = /*#__PURE__*/React.forwardRef(function GridToolb
|
|
|
94
95
|
return /*#__PURE__*/_jsx(rootProps.slots.baseTooltip, _extends({
|
|
95
96
|
title: tooltipContentNode,
|
|
96
97
|
enterDelay: 1000
|
|
97
|
-
},
|
|
98
|
+
}, rootProps.slotProps?.baseTooltip, tooltipProps, {
|
|
98
99
|
children: /*#__PURE__*/_jsx(rootProps.slots.baseButton, _extends({
|
|
99
100
|
ref: ref,
|
|
100
101
|
id: filterButtonId,
|
|
@@ -103,14 +104,14 @@ const GridToolbarFilterButton = /*#__PURE__*/React.forwardRef(function GridToolb
|
|
|
103
104
|
"aria-controls": isOpen ? filterPanelId : undefined,
|
|
104
105
|
"aria-expanded": isOpen,
|
|
105
106
|
"aria-haspopup": true,
|
|
106
|
-
startIcon: /*#__PURE__*/_jsx(rootProps.slots.baseBadge, {
|
|
107
|
+
startIcon: /*#__PURE__*/_jsx(rootProps.slots.baseBadge, _extends({
|
|
107
108
|
badgeContent: activeFilters.length,
|
|
108
|
-
color: "primary"
|
|
109
|
+
color: "primary"
|
|
110
|
+
}, rootProps.slotProps?.baseBadge, badgeProps, {
|
|
109
111
|
children: /*#__PURE__*/_jsx(rootProps.slots.openFilterButtonIcon, {})
|
|
110
|
-
})
|
|
111
|
-
}, buttonProps, {
|
|
112
|
+
})),
|
|
112
113
|
onClick: toggleFilter
|
|
113
|
-
}, rootProps.slotProps?.baseButton, {
|
|
114
|
+
}, rootProps.slotProps?.baseButton, buttonProps, {
|
|
114
115
|
children: apiRef.current.getLocaleText('toolbarFilters')
|
|
115
116
|
}))
|
|
116
117
|
}));
|
|
@@ -78,6 +78,7 @@ function GridToolbarQuickFilter(props) {
|
|
|
78
78
|
apiRef.current.setQuickFilterValues(newQuickFilterValues);
|
|
79
79
|
}, [apiRef, quickFilterParser]);
|
|
80
80
|
const debouncedUpdateSearchValue = React.useMemo(() => debounce(updateSearchValue, debounceMs), [updateSearchValue, debounceMs]);
|
|
81
|
+
React.useEffect(() => debouncedUpdateSearchValue.clear, [debouncedUpdateSearchValue]);
|
|
81
82
|
const handleSearchValueChange = React.useCallback(event => {
|
|
82
83
|
const newSearchValue = event.target.value;
|
|
83
84
|
setSearchValue(newSearchValue);
|
|
@@ -10,7 +10,6 @@ import { getDataGridUtilityClass } from "../../constants/gridClasses.js";
|
|
|
10
10
|
import { gridDimensionsSelector } from "../../hooks/features/dimensions/index.js";
|
|
11
11
|
import { useGridVirtualScroller } from "../../hooks/features/virtualization/useGridVirtualScroller.js";
|
|
12
12
|
import { useGridOverlays } from "../../hooks/features/overlays/useGridOverlays.js";
|
|
13
|
-
import { GridOverlays as Overlays } from "../base/GridOverlays.js";
|
|
14
13
|
import { GridHeaders } from "../GridHeaders.js";
|
|
15
14
|
import { GridMainContainer as Container } from "./GridMainContainer.js";
|
|
16
15
|
import { GridTopContainer as TopContainer } from "./GridTopContainer.js";
|
|
@@ -55,7 +54,10 @@ function GridVirtualScroller(props) {
|
|
|
55
54
|
const apiRef = useGridApiContext();
|
|
56
55
|
const rootProps = useGridRootProps();
|
|
57
56
|
const dimensions = useGridSelector(apiRef, gridDimensionsSelector);
|
|
58
|
-
const
|
|
57
|
+
const {
|
|
58
|
+
getOverlay,
|
|
59
|
+
overlaysProps
|
|
60
|
+
} = useGridOverlays();
|
|
59
61
|
const classes = useUtilityClasses(rootProps, dimensions, overlaysProps.loadingOverlayVariant);
|
|
60
62
|
const virtualScroller = useGridVirtualScroller();
|
|
61
63
|
const {
|
|
@@ -84,7 +86,7 @@ function GridVirtualScroller(props) {
|
|
|
84
86
|
position: "top",
|
|
85
87
|
virtualScroller: virtualScroller
|
|
86
88
|
})]
|
|
87
|
-
}),
|
|
89
|
+
}), getOverlay(), /*#__PURE__*/_jsx(Content, _extends({}, getContentProps(), {
|
|
88
90
|
children: /*#__PURE__*/_jsxs(RenderZone, _extends({}, getRenderZoneProps(), {
|
|
89
91
|
children: [rows, /*#__PURE__*/_jsx(rootProps.slots.detailPanels, {
|
|
90
92
|
virtualScroller: virtualScroller
|
|
@@ -34,8 +34,6 @@ export const DATA_GRID_PROPS_DEFAULT_VALUES = {
|
|
|
34
34
|
hideFooterSelectedRowCount: false,
|
|
35
35
|
ignoreDiacritics: false,
|
|
36
36
|
ignoreValueFormatterDuringExport: false,
|
|
37
|
-
// TODO v8: Update to 'select'
|
|
38
|
-
indeterminateCheckboxAction: 'deselect',
|
|
39
37
|
keepColumnPositionIfDraggedOutside: false,
|
|
40
38
|
keepNonExistentRowsSelected: false,
|
|
41
39
|
loading: false,
|
|
@@ -56,5 +54,6 @@ export const DATA_GRID_PROPS_DEFAULT_VALUES = {
|
|
|
56
54
|
sortingMode: 'client',
|
|
57
55
|
sortingOrder: ['asc', 'desc', null],
|
|
58
56
|
throttleRowsMs: 0,
|
|
59
|
-
unstable_rowSpanning: false
|
|
57
|
+
unstable_rowSpanning: false,
|
|
58
|
+
virtualizeColumnsWithAutoRowHeight: false
|
|
60
59
|
};
|
|
@@ -2,4 +2,4 @@ import { unstable_generateUtilityClasses as generateUtilityClasses, unstable_gen
|
|
|
2
2
|
export function getDataGridUtilityClass(slot) {
|
|
3
3
|
return generateUtilityClass('MuiDataGrid', slot);
|
|
4
4
|
}
|
|
5
|
-
export const gridClasses = generateUtilityClasses('MuiDataGrid', ['actionsCell', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'aggregationColumnHeaderLabel', 'autoHeight', 'autosizing', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--flex', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--rangeTop', 'cell--rangeBottom', 'cell--rangeLeft', 'cell--rangeRight', 'cell--pinnedLeft', 'cell--pinnedRight', 'cell--selectionMode', 'cell', 'cellCheckbox', 'cellEmpty', 'cellSkeleton', 'cellOffsetLeft', 'checkboxInput', 'columnHeader', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader--pinnedLeft', 'columnHeader--pinnedRight', 'columnHeader--last', 'columnHeader--lastUnpinned', 'columnHeader--siblingFocused', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnHeader--filledGroup', 'columnHeader--emptyGroup', 'columnHeaders', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsManagement', 'columnsManagementRow', 'columnsManagementHeader', 'columnsManagementFooter', 'container--top', 'container--bottom', 'detailPanel', 'detailPanels', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'footerCell', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filler', 'filler--borderBottom', 'filler--pinnedLeft', 'filler--pinnedRight', 'filterForm', 'filterFormDeleteIcon', 'filterFormLogicOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'headerFilterRow', 'iconButtonContainer', 'iconSeparator', 'main', 'main--hasPinnedRight', 'main--hasSkeletonLoadingOverlay', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'overlayWrapper', 'overlayWrapperInner', 'root', 'root--densityStandard', 'root--densityComfortable', 'root--densityCompact', 'root--disableUserSelection', 'root--noToolbar', 'row', 'row--editable', 'row--editing', 'row--firstVisible', 'row--lastVisible', 'row--dragging', 'row--dynamicHeight', 'row--detailPanelExpanded', 'row--borderBottom', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'rowSkeleton', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'scrollbar', 'scrollbar--vertical', 'scrollbar--horizontal', 'scrollbarFiller', 'scrollbarFiller--header', 'scrollbarFiller--borderTop', 'scrollbarFiller--borderBottom', 'scrollbarFiller--pinnedRight', 'selectedRowCount', 'sortIcon', 'toolbarContainer', 'toolbarFilterList', 'virtualScroller', 'virtualScroller--hasScrollX', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pinnedColumns', 'withVerticalBorder', 'withBorderColor', 'cell--withRightBorder', 'cell--withLeftBorder', 'columnHeader--withRightBorder', 'columnHeader--withLeftBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'treeDataGroupingCellLoadingContainer', 'groupingCriteriaCell', 'groupingCriteriaCellToggle', 'groupingCriteriaCellLoadingContainer', 'pinnedRows', 'pinnedRows--top', 'pinnedRows--bottom', 'pinnedRowsRenderZone']);
|
|
5
|
+
export const gridClasses = generateUtilityClasses('MuiDataGrid', ['actionsCell', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'aggregationColumnHeaderLabel', 'autoHeight', 'autosizing', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--flex', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--rangeTop', 'cell--rangeBottom', 'cell--rangeLeft', 'cell--rangeRight', 'cell--pinnedLeft', 'cell--pinnedRight', 'cell--selectionMode', 'cell', 'cellCheckbox', 'cellEmpty', 'cellSkeleton', 'cellOffsetLeft', 'checkboxInput', 'columnHeader', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader--pinnedLeft', 'columnHeader--pinnedRight', 'columnHeader--last', 'columnHeader--lastUnpinned', 'columnHeader--siblingFocused', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnHeader--filledGroup', 'columnHeader--emptyGroup', 'columnHeaders', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsManagement', 'columnsManagementRow', 'columnsManagementHeader', 'columnsManagementSearchInput', 'columnsManagementFooter', 'container--top', 'container--bottom', 'detailPanel', 'detailPanels', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'footerCell', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filler', 'filler--borderBottom', 'filler--pinnedLeft', 'filler--pinnedRight', 'filterForm', 'filterFormDeleteIcon', 'filterFormLogicOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'headerFilterRow', 'iconButtonContainer', 'iconSeparator', 'main', 'main--hasPinnedRight', 'main--hasSkeletonLoadingOverlay', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'overlayWrapper', 'overlayWrapperInner', 'root', 'root--densityStandard', 'root--densityComfortable', 'root--densityCompact', 'root--disableUserSelection', 'root--noToolbar', 'row', 'row--editable', 'row--editing', 'row--firstVisible', 'row--lastVisible', 'row--dragging', 'row--dynamicHeight', 'row--detailPanelExpanded', 'row--borderBottom', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'rowSkeleton', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'scrollbar', 'scrollbar--vertical', 'scrollbar--horizontal', 'scrollbarFiller', 'scrollbarFiller--header', 'scrollbarFiller--borderTop', 'scrollbarFiller--borderBottom', 'scrollbarFiller--pinnedRight', 'selectedRowCount', 'sortIcon', 'toolbarContainer', 'toolbarFilterList', 'toolbarPromptControl', 'toolbarPromptControl--recording', 'toolbarPromptControlRecordingIndicator', 'toolbarPromptControlRecordButton', 'toolbarPromptControlSendButton', 'virtualScroller', 'virtualScroller--hasScrollX', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pinnedColumns', 'withVerticalBorder', 'withBorderColor', 'cell--withRightBorder', 'cell--withLeftBorder', 'columnHeader--withRightBorder', 'columnHeader--withLeftBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'treeDataGroupingCellLoadingContainer', 'groupingCriteriaCell', 'groupingCriteriaCellToggle', 'groupingCriteriaCellLoadingContainer', 'pinnedRows', 'pinnedRows--top', 'pinnedRows--bottom', 'pinnedRowsRenderZone']);
|
|
@@ -21,6 +21,16 @@ export const GRID_DEFAULT_LOCALE_TEXT = {
|
|
|
21
21
|
toolbarQuickFilterPlaceholder: 'Search…',
|
|
22
22
|
toolbarQuickFilterLabel: 'Search',
|
|
23
23
|
toolbarQuickFilterDeleteIconLabel: 'Clear',
|
|
24
|
+
// Prompt toolbar field
|
|
25
|
+
toolbarPromptControlPlaceholder: 'Type a prompt…',
|
|
26
|
+
toolbarPromptControlWithRecordingPlaceholder: 'Type or record a prompt…',
|
|
27
|
+
toolbarPromptControlRecordingPlaceholder: 'Listening for prompt…',
|
|
28
|
+
toolbarPromptControlLabel: 'Prompt input',
|
|
29
|
+
toolbarPromptControlRecordButtonDefaultLabel: 'Record',
|
|
30
|
+
toolbarPromptControlRecordButtonActiveLabel: 'Stop recording',
|
|
31
|
+
toolbarPromptControlSendActionLabel: 'Send',
|
|
32
|
+
toolbarPromptControlSendActionAriaLabel: 'Send prompt',
|
|
33
|
+
toolbarPromptControlErrorMessage: 'An error occurred while processing the request. Please try again with a different prompt.',
|
|
24
34
|
// Export selector toolbar button text
|
|
25
35
|
toolbarExport: 'Export',
|
|
26
36
|
toolbarExportLabel: 'Export',
|
|
@@ -32,6 +42,7 @@ export const GRID_DEFAULT_LOCALE_TEXT = {
|
|
|
32
42
|
columnsManagementNoColumns: 'No columns',
|
|
33
43
|
columnsManagementShowHideAllText: 'Show/Hide All',
|
|
34
44
|
columnsManagementReset: 'Reset',
|
|
45
|
+
columnsManagementDeleteIconLabel: 'Clear',
|
|
35
46
|
// Filter panel text
|
|
36
47
|
filterPanelAddFilter: 'Add filter',
|
|
37
48
|
filterPanelRemoveAll: 'Remove all',
|
|
@@ -283,7 +283,7 @@ export const useGridColumnHeaders = props => {
|
|
|
283
283
|
fields: headerInfo.fields,
|
|
284
284
|
colIndex: headerInfo.colIndex,
|
|
285
285
|
depth: depth,
|
|
286
|
-
isLastColumn:
|
|
286
|
+
isLastColumn: index === visibleColumnGroupHeader.length - 1,
|
|
287
287
|
maxDepth: headerGroupingMaxDepth,
|
|
288
288
|
height: dimensions.groupHeaderHeight,
|
|
289
289
|
hasFocus: hasFocus,
|
|
@@ -291,7 +291,7 @@ export const useGridColumnHeaders = props => {
|
|
|
291
291
|
pinnedPosition: pinnedPosition,
|
|
292
292
|
style: style,
|
|
293
293
|
indexInSection: indexInSection,
|
|
294
|
-
sectionLength:
|
|
294
|
+
sectionLength: visibleColumnGroupHeader.length,
|
|
295
295
|
gridHasFiller: gridHasFiller
|
|
296
296
|
}, index);
|
|
297
297
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { unstable_ownerDocument as ownerDocument, unstable_useEnhancedEffect as useEnhancedEffect, unstable_useEventCallback as useEventCallback
|
|
3
|
+
import { unstable_ownerDocument as ownerDocument, unstable_useEnhancedEffect as useEnhancedEffect, unstable_useEventCallback as useEventCallback } from '@mui/utils';
|
|
4
4
|
import { throttle } from '@mui/x-internals/throttle';
|
|
5
5
|
import { useGridApiEventHandler, useGridApiOptionHandler } from "../../utils/useGridApiEventHandler.js";
|
|
6
6
|
import { useGridApiMethod } from "../../utils/useGridApiMethod.js";
|
|
@@ -66,28 +66,13 @@ export function useGridDimensions(apiRef, props) {
|
|
|
66
66
|
const rightPinnedWidth = pinnedColumns.right.reduce((w, col) => w + col.computedWidth, 0);
|
|
67
67
|
const [savedSize, setSavedSize] = React.useState();
|
|
68
68
|
const debouncedSetSavedSize = React.useMemo(() => throttle(setSavedSize, props.resizeThrottleMs), [props.resizeThrottleMs]);
|
|
69
|
-
|
|
69
|
+
React.useEffect(() => debouncedSetSavedSize.clear, [debouncedSetSavedSize]);
|
|
70
70
|
const getRootDimensions = () => apiRef.current.state.dimensions;
|
|
71
71
|
const setDimensions = useEventCallback(dimensions => {
|
|
72
72
|
apiRef.current.setState(state => _extends({}, state, {
|
|
73
73
|
dimensions
|
|
74
74
|
}));
|
|
75
75
|
});
|
|
76
|
-
const resize = React.useCallback(() => {
|
|
77
|
-
const element = apiRef.current.mainElementRef.current;
|
|
78
|
-
if (!element) {
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
const computedStyle = ownerWindow(element).getComputedStyle(element);
|
|
82
|
-
const newSize = {
|
|
83
|
-
width: parseFloat(computedStyle.width) || 0,
|
|
84
|
-
height: parseFloat(computedStyle.height) || 0
|
|
85
|
-
};
|
|
86
|
-
if (!previousSize.current || !areElementSizesEqual(previousSize.current, newSize)) {
|
|
87
|
-
apiRef.current.publishEvent('resize', newSize);
|
|
88
|
-
previousSize.current = newSize;
|
|
89
|
-
}
|
|
90
|
-
}, [apiRef]);
|
|
91
76
|
const getViewportPageSize = React.useCallback(() => {
|
|
92
77
|
const dimensions = gridDimensionsSelector(apiRef.current.state);
|
|
93
78
|
if (!dimensions.isReady) {
|
|
@@ -198,7 +183,6 @@ export function useGridDimensions(apiRef, props) {
|
|
|
198
183
|
apiRef.current.updateRenderContext?.();
|
|
199
184
|
}, [apiRef, setDimensions, props.scrollbarSize, props.autoHeight, rowsMeta.currentPageTotalHeight, rowHeight, headerHeight, groupHeaderHeight, headerFilterHeight, columnsTotalWidth, headersTotalHeight, leftPinnedWidth, rightPinnedWidth]);
|
|
200
185
|
const apiPublic = {
|
|
201
|
-
resize,
|
|
202
186
|
getRootDimensions
|
|
203
187
|
};
|
|
204
188
|
const apiPrivate = {
|
|
@@ -238,7 +222,7 @@ export function useGridDimensions(apiRef, props) {
|
|
|
238
222
|
rootDimensionsRef.current = size;
|
|
239
223
|
|
|
240
224
|
// jsdom has no layout capabilities
|
|
241
|
-
const isJSDOM = /jsdom/.test(window.navigator.userAgent);
|
|
225
|
+
const isJSDOM = /jsdom|HappyDOM/.test(window.navigator.userAgent);
|
|
242
226
|
if (size.height === 0 && !errorShown.current && !props.autoHeight && !isJSDOM) {
|
|
243
227
|
logger.error(['The parent DOM element of the Data Grid has an empty height.', 'Please make sure that this element has an intrinsic height.', 'The grid displays with a height of 0px.', '', 'More details: https://mui.com/r/x-data-grid-no-dimensions.'].join('\n'));
|
|
244
228
|
errorShown.current = true;
|
|
@@ -7,6 +7,7 @@ export * from "./density/index.js";
|
|
|
7
7
|
export * from "./editing/index.js";
|
|
8
8
|
export * from "./filter/index.js";
|
|
9
9
|
export * from "./focus/index.js";
|
|
10
|
+
export * from "./listView/index.js";
|
|
10
11
|
export * from "./pagination/index.js";
|
|
11
12
|
export * from "./preferencesPanel/index.js";
|
|
12
13
|
export * from "./rows/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./gridListViewSelectors.js";
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import * as React from 'react';
|
|
1
3
|
import { useGridSelector } from "../../utils/index.js";
|
|
2
4
|
import { useGridApiContext } from "../../utils/useGridApiContext.js";
|
|
3
5
|
import { useGridRootProps } from "../../utils/useGridRootProps.js";
|
|
4
6
|
import { gridExpandedRowCountSelector } from "../filter/index.js";
|
|
5
7
|
import { gridRowCountSelector, gridRowsLoadingSelector } from "../rows/index.js";
|
|
8
|
+
import { GridOverlayWrapper } from "../../../components/base/GridOverlays.js";
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
10
|
/**
|
|
7
11
|
* Uses the grid state to determine which overlay to display.
|
|
8
12
|
* Returns the active overlay type and the active loading overlay variant.
|
|
@@ -28,8 +32,22 @@ export const useGridOverlays = () => {
|
|
|
28
32
|
overlayType = 'loadingOverlay';
|
|
29
33
|
loadingOverlayVariant = rootProps.slotProps?.loadingOverlay?.[noRows ? 'noRowsVariant' : 'variant'] || null;
|
|
30
34
|
}
|
|
31
|
-
|
|
35
|
+
const overlaysProps = {
|
|
32
36
|
overlayType,
|
|
33
37
|
loadingOverlayVariant
|
|
34
38
|
};
|
|
39
|
+
const getOverlay = () => {
|
|
40
|
+
if (!overlayType) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
const Overlay = rootProps.slots?.[overlayType];
|
|
44
|
+
const overlayProps = rootProps.slotProps?.[overlayType];
|
|
45
|
+
return /*#__PURE__*/_jsx(GridOverlayWrapper, _extends({}, overlaysProps, {
|
|
46
|
+
children: /*#__PURE__*/_jsx(Overlay, _extends({}, overlayProps))
|
|
47
|
+
}));
|
|
48
|
+
};
|
|
49
|
+
return {
|
|
50
|
+
getOverlay,
|
|
51
|
+
overlaysProps
|
|
52
|
+
};
|
|
35
53
|
};
|
|
@@ -248,11 +248,7 @@ export const useGridRowSelection = (apiRef, props) => {
|
|
|
248
248
|
/*
|
|
249
249
|
* EVENTS
|
|
250
250
|
*/
|
|
251
|
-
const isFirstRender = React.useRef(true);
|
|
252
251
|
const removeOutdatedSelection = React.useCallback((sortModelUpdated = false) => {
|
|
253
|
-
if (isFirstRender.current) {
|
|
254
|
-
return;
|
|
255
|
-
}
|
|
256
252
|
const currentSelection = gridRowSelectionStateSelector(apiRef.current.state);
|
|
257
253
|
const rowsLookup = gridRowsLookupSelector(apiRef);
|
|
258
254
|
const filteredRowsLookup = gridFilteredRowsLookupSelector(apiRef);
|
|
@@ -480,9 +476,4 @@ export const useGridRowSelection = (apiRef, props) => {
|
|
|
480
476
|
React.useEffect(() => {
|
|
481
477
|
runIfRowSelectionIsEnabled(removeOutdatedSelection);
|
|
482
478
|
}, [removeOutdatedSelection, runIfRowSelectionIsEnabled]);
|
|
483
|
-
React.useEffect(() => {
|
|
484
|
-
if (isFirstRender.current) {
|
|
485
|
-
isFirstRender.current = false;
|
|
486
|
-
}
|
|
487
|
-
}, []);
|
|
488
479
|
};
|
|
@@ -6,8 +6,8 @@ import { selectedIdsLookupSelector } from "./gridRowSelectionSelector.js";
|
|
|
6
6
|
import { gridRowTreeSelector } from "../rows/gridRowsSelector.js";
|
|
7
7
|
import { createSelector } from "../../../utils/createSelector.js";
|
|
8
8
|
export const ROW_SELECTION_PROPAGATION_DEFAULT = {
|
|
9
|
-
parents:
|
|
10
|
-
descendants:
|
|
9
|
+
parents: true,
|
|
10
|
+
descendants: true
|
|
11
11
|
};
|
|
12
12
|
function getGridRowGroupSelectableDescendants(apiRef, groupId) {
|
|
13
13
|
const rowTree = gridRowTreeSelector(apiRef);
|
|
@@ -4,8 +4,8 @@ import * as ReactDOM from 'react-dom';
|
|
|
4
4
|
import { unstable_useEnhancedEffect as useEnhancedEffect, unstable_useEventCallback as useEventCallback } from '@mui/utils';
|
|
5
5
|
import useLazyRef from '@mui/utils/useLazyRef';
|
|
6
6
|
import useTimeout from '@mui/utils/useTimeout';
|
|
7
|
-
import { useResizeObserver } from '@mui/x-internals/useResizeObserver';
|
|
8
7
|
import { useRtl } from '@mui/system/RtlProvider';
|
|
8
|
+
import reactMajor from '@mui/x-internals/reactMajor';
|
|
9
9
|
import { useGridPrivateApiContext } from "../../utils/useGridPrivateApiContext.js";
|
|
10
10
|
import { useGridRootProps } from "../../utils/useGridRootProps.js";
|
|
11
11
|
import { useGridSelector } from "../../utils/useGridSelector.js";
|
|
@@ -48,7 +48,7 @@ const createScrollCache = (isRtl, rowBufferPx, columnBufferPx, verticalBuffer, h
|
|
|
48
48
|
let isJSDOM = false;
|
|
49
49
|
try {
|
|
50
50
|
if (typeof window !== 'undefined') {
|
|
51
|
-
isJSDOM = /jsdom/.test(window.navigator.userAgent);
|
|
51
|
+
isJSDOM = /jsdom|HappyDOM/.test(window.navigator.userAgent);
|
|
52
52
|
}
|
|
53
53
|
} catch (_) {
|
|
54
54
|
/* ignore */
|
|
@@ -86,7 +86,44 @@ export const useGridVirtualScroller = () => {
|
|
|
86
86
|
const contentHeight = dimensions.contentSize.height;
|
|
87
87
|
const columnsTotalWidth = dimensions.columnsTotalWidth;
|
|
88
88
|
const hasColSpan = useGridSelector(apiRef, gridHasColSpanSelector);
|
|
89
|
-
|
|
89
|
+
const mainRefCallback = React.useCallback(node => {
|
|
90
|
+
mainRef.current = node;
|
|
91
|
+
if (!node) {
|
|
92
|
+
return undefined;
|
|
93
|
+
}
|
|
94
|
+
const initialRect = node.getBoundingClientRect();
|
|
95
|
+
let lastSize = {
|
|
96
|
+
width: initialRect.width,
|
|
97
|
+
height: initialRect.height
|
|
98
|
+
};
|
|
99
|
+
apiRef.current.publishEvent('resize', lastSize);
|
|
100
|
+
if (typeof ResizeObserver === 'undefined') {
|
|
101
|
+
return undefined;
|
|
102
|
+
}
|
|
103
|
+
const observer = new ResizeObserver(entries => {
|
|
104
|
+
const entry = entries[0];
|
|
105
|
+
if (!entry) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const newSize = {
|
|
109
|
+
width: entry.contentRect.width,
|
|
110
|
+
height: entry.contentRect.height
|
|
111
|
+
};
|
|
112
|
+
if (newSize.width === lastSize.width && newSize.height === lastSize.height) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
apiRef.current.publishEvent('resize', newSize);
|
|
116
|
+
lastSize = newSize;
|
|
117
|
+
});
|
|
118
|
+
observer.observe(node);
|
|
119
|
+
if (reactMajor >= 19) {
|
|
120
|
+
return () => {
|
|
121
|
+
mainRef.current = null;
|
|
122
|
+
observer.disconnect();
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
return undefined;
|
|
126
|
+
}, [apiRef, mainRef]);
|
|
90
127
|
|
|
91
128
|
/*
|
|
92
129
|
* Scroll context logic
|
|
@@ -137,9 +174,13 @@ export const useGridVirtualScroller = () => {
|
|
|
137
174
|
previousContextScrollPosition.current = scrollPosition.current;
|
|
138
175
|
}, [apiRef, dimensions.isReady]);
|
|
139
176
|
const triggerUpdateRenderContext = useEventCallback(() => {
|
|
177
|
+
const scroller = scrollerRef.current;
|
|
178
|
+
if (!scroller) {
|
|
179
|
+
return undefined;
|
|
180
|
+
}
|
|
140
181
|
const newScroll = {
|
|
141
|
-
top:
|
|
142
|
-
left:
|
|
182
|
+
top: scroller.scrollTop,
|
|
183
|
+
left: scroller.scrollLeft
|
|
143
184
|
};
|
|
144
185
|
const dx = newScroll.left - scrollPosition.current.left;
|
|
145
186
|
const dy = newScroll.top - scrollPosition.current.top;
|
|
@@ -389,10 +430,6 @@ export const useGridVirtualScroller = () => {
|
|
|
389
430
|
React.useEffect(() => {
|
|
390
431
|
apiRef.current.publishEvent('virtualScrollerContentSizeChange');
|
|
391
432
|
}, [apiRef, contentSize]);
|
|
392
|
-
useEnhancedEffect(() => {
|
|
393
|
-
// FIXME: Is this really necessary?
|
|
394
|
-
apiRef.current.resize();
|
|
395
|
-
}, [apiRef, rowsMeta.currentPageTotalHeight]);
|
|
396
433
|
useEnhancedEffect(() => {
|
|
397
434
|
// TODO a scroll reset should not be necessary
|
|
398
435
|
if (enabledForColumns) {
|
|
@@ -428,7 +465,7 @@ export const useGridVirtualScroller = () => {
|
|
|
428
465
|
setPanels,
|
|
429
466
|
getRows,
|
|
430
467
|
getContainerProps: () => ({
|
|
431
|
-
ref:
|
|
468
|
+
ref: mainRefCallback
|
|
432
469
|
}),
|
|
433
470
|
getScrollerProps: () => ({
|
|
434
471
|
ref: scrollerRef,
|
|
@@ -485,7 +522,8 @@ function inputsSelector(apiRef, rootProps, enabledForRows, enabledForColumns) {
|
|
|
485
522
|
pinnedColumns: gridVisiblePinnedColumnDefinitionsSelector(apiRef),
|
|
486
523
|
visibleColumns,
|
|
487
524
|
hiddenCellsOriginMap,
|
|
488
|
-
listView: rootProps.unstable_listView ?? false
|
|
525
|
+
listView: rootProps.unstable_listView ?? false,
|
|
526
|
+
virtualizeColumnsWithAutoRowHeight: rootProps.virtualizeColumnsWithAutoRowHeight
|
|
489
527
|
};
|
|
490
528
|
}
|
|
491
529
|
function computeRenderContext(inputs, scrollPosition, scrollCache) {
|
|
@@ -533,11 +571,13 @@ function computeRenderContext(inputs, scrollPosition, scrollCache) {
|
|
|
533
571
|
positions: inputs.rowsMeta.positions,
|
|
534
572
|
lastSize: inputs.lastRowHeight
|
|
535
573
|
});
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
574
|
+
if (!inputs.virtualizeColumnsWithAutoRowHeight) {
|
|
575
|
+
for (let i = firstRowToRender; i < lastRowToRender && !hasRowWithAutoHeight; i += 1) {
|
|
576
|
+
const row = inputs.rows[i];
|
|
577
|
+
hasRowWithAutoHeight = inputs.apiRef.current.rowHasAutoHeight(row.id);
|
|
578
|
+
}
|
|
539
579
|
}
|
|
540
|
-
if (!hasRowWithAutoHeight) {
|
|
580
|
+
if (!hasRowWithAutoHeight || inputs.virtualizeColumnsWithAutoRowHeight) {
|
|
541
581
|
firstColumnIndex = binarySearch(realLeft, inputs.columnPositions, {
|
|
542
582
|
atStart: true,
|
|
543
583
|
lastPosition: inputs.columnsTotalWidth
|
package/modern/index.js
CHANGED