@mui/x-data-grid 5.12.1 → 5.12.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 +45 -2
- package/colDef/gridCheckboxSelectionColDef.d.ts +1 -0
- package/colDef/gridCheckboxSelectionColDef.js +2 -1
- package/colDef/gridDateOperators.d.ts +1 -1
- package/colDef/gridNumericColDef.js +1 -1
- package/components/columnHeaders/GridColumnHeaderItem.js +5 -3
- package/components/columnSelection/GridCellCheckboxRenderer.js +0 -1
- package/components/columnSelection/GridHeaderCheckbox.js +0 -1
- package/components/containers/GridRootStyles.js +1 -1
- package/components/panel/GridColumnsPanel.js +2 -5
- package/components/panel/filterPanel/GridFilterPanel.js +1 -2
- package/components/toolbar/GridToolbarColumnsButton.js +0 -1
- package/components/toolbar/GridToolbarDensitySelector.js +0 -1
- package/components/toolbar/GridToolbarExportContainer.js +0 -1
- package/components/toolbar/GridToolbarFilterButton.js +0 -1
- package/constants/localeTextConstants.js +1 -0
- package/hooks/features/columns/useGridColumnSpanning.d.ts +1 -1
- package/hooks/features/columns/useGridColumnSpanning.js +1 -1
- package/hooks/features/columns/useGridColumns.d.ts +1 -1
- package/hooks/features/dimensions/gridDimensionsApi.d.ts +5 -0
- package/hooks/features/dimensions/useGridDimensions.js +9 -8
- package/hooks/features/filter/gridFilterState.d.ts +1 -1
- package/hooks/features/filter/useGridFilter.d.ts +1 -1
- package/hooks/features/rows/useGridRowsMeta.js +79 -77
- package/hooks/features/selection/useGridSelectionPreProcessors.js +8 -6
- package/hooks/features/sorting/useGridSorting.d.ts +1 -1
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +1 -1
- package/hooks/features/virtualization/useGridVirtualScroller.js +42 -8
- package/index.js +1 -1
- package/legacy/colDef/gridCheckboxSelectionColDef.js +2 -1
- package/legacy/colDef/gridNumericColDef.js +1 -1
- package/legacy/components/columnHeaders/GridColumnHeaderItem.js +5 -3
- package/legacy/components/columnSelection/GridCellCheckboxRenderer.js +0 -1
- package/legacy/components/columnSelection/GridHeaderCheckbox.js +0 -1
- package/legacy/components/containers/GridRootStyles.js +1 -1
- package/legacy/components/panel/GridColumnsPanel.js +2 -5
- package/legacy/components/panel/filterPanel/GridFilterPanel.js +1 -2
- package/legacy/components/toolbar/GridToolbarColumnsButton.js +0 -1
- package/legacy/components/toolbar/GridToolbarDensitySelector.js +0 -1
- package/legacy/components/toolbar/GridToolbarExportContainer.js +0 -1
- package/legacy/components/toolbar/GridToolbarFilterButton.js +0 -1
- package/legacy/constants/localeTextConstants.js +1 -0
- package/legacy/hooks/features/columns/useGridColumnSpanning.js +1 -1
- package/legacy/hooks/features/dimensions/useGridDimensions.js +9 -8
- package/legacy/hooks/features/rows/useGridRowsMeta.js +81 -77
- package/legacy/hooks/features/selection/useGridSelectionPreProcessors.js +8 -6
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +42 -8
- package/legacy/index.js +1 -1
- package/legacy/locales/arSD.js +1 -0
- package/legacy/locales/bgBG.js +1 -0
- package/legacy/locales/csCZ.js +1 -0
- package/legacy/locales/daDK.js +1 -0
- package/legacy/locales/deDE.js +1 -0
- package/legacy/locales/elGR.js +1 -0
- package/legacy/locales/esES.js +1 -0
- package/legacy/locales/faIR.js +1 -0
- package/legacy/locales/fiFI.js +1 -0
- package/legacy/locales/frFR.js +1 -0
- package/legacy/locales/heIL.js +1 -0
- package/legacy/locales/huHU.js +1 -0
- package/legacy/locales/itIT.js +1 -0
- package/legacy/locales/jaJP.js +1 -0
- package/legacy/locales/koKR.js +1 -0
- package/legacy/locales/nbNO.js +1 -0
- package/legacy/locales/nlNL.js +1 -0
- package/legacy/locales/plPL.js +1 -0
- package/legacy/locales/ptBR.js +1 -0
- package/legacy/locales/ruRU.js +1 -0
- package/legacy/locales/skSK.js +1 -0
- package/legacy/locales/trTR.js +1 -0
- package/legacy/locales/ukUA.js +1 -0
- package/legacy/locales/viVN.js +1 -0
- package/legacy/locales/zhCN.js +1 -0
- package/locales/arSD.js +1 -0
- package/locales/bgBG.js +1 -0
- package/locales/csCZ.js +1 -0
- package/locales/daDK.js +1 -0
- package/locales/deDE.js +1 -0
- package/locales/elGR.js +1 -0
- package/locales/esES.js +1 -0
- package/locales/faIR.js +1 -0
- package/locales/fiFI.js +1 -0
- package/locales/frFR.js +1 -0
- package/locales/heIL.js +1 -0
- package/locales/huHU.js +1 -0
- package/locales/itIT.js +1 -0
- package/locales/jaJP.js +1 -0
- package/locales/koKR.js +1 -0
- package/locales/nbNO.js +1 -0
- package/locales/nlNL.js +1 -0
- package/locales/plPL.js +1 -0
- package/locales/ptBR.js +1 -0
- package/locales/ruRU.js +1 -0
- package/locales/skSK.js +1 -0
- package/locales/trTR.js +1 -0
- package/locales/ukUA.js +1 -0
- package/locales/viVN.js +1 -0
- package/locales/zhCN.js +1 -0
- package/models/api/gridLocaleTextApi.d.ts +1 -0
- package/models/colDef/gridColDef.d.ts +1 -1
- package/modern/colDef/gridCheckboxSelectionColDef.js +2 -1
- package/modern/colDef/gridNumericColDef.js +1 -1
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +5 -3
- package/modern/components/columnSelection/GridCellCheckboxRenderer.js +0 -1
- package/modern/components/columnSelection/GridHeaderCheckbox.js +0 -1
- package/modern/components/containers/GridRootStyles.js +1 -1
- package/modern/components/panel/GridColumnsPanel.js +2 -5
- package/modern/components/panel/filterPanel/GridFilterPanel.js +1 -2
- package/modern/components/toolbar/GridToolbarColumnsButton.js +0 -1
- package/modern/components/toolbar/GridToolbarDensitySelector.js +0 -1
- package/modern/components/toolbar/GridToolbarExportContainer.js +0 -1
- package/modern/components/toolbar/GridToolbarFilterButton.js +0 -1
- package/modern/constants/localeTextConstants.js +1 -0
- package/modern/hooks/features/columns/useGridColumnSpanning.js +1 -1
- package/modern/hooks/features/dimensions/useGridDimensions.js +9 -8
- package/modern/hooks/features/rows/useGridRowsMeta.js +77 -75
- package/modern/hooks/features/selection/useGridSelectionPreProcessors.js +8 -6
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +42 -8
- package/modern/index.js +1 -1
- package/modern/locales/arSD.js +1 -0
- package/modern/locales/bgBG.js +1 -0
- package/modern/locales/csCZ.js +1 -0
- package/modern/locales/daDK.js +1 -0
- package/modern/locales/deDE.js +1 -0
- package/modern/locales/elGR.js +1 -0
- package/modern/locales/esES.js +1 -0
- package/modern/locales/faIR.js +1 -0
- package/modern/locales/fiFI.js +1 -0
- package/modern/locales/frFR.js +1 -0
- package/modern/locales/heIL.js +1 -0
- package/modern/locales/huHU.js +1 -0
- package/modern/locales/itIT.js +1 -0
- package/modern/locales/jaJP.js +1 -0
- package/modern/locales/koKR.js +1 -0
- package/modern/locales/nbNO.js +1 -0
- package/modern/locales/nlNL.js +1 -0
- package/modern/locales/plPL.js +1 -0
- package/modern/locales/ptBR.js +1 -0
- package/modern/locales/ruRU.js +1 -0
- package/modern/locales/skSK.js +1 -0
- package/modern/locales/trTR.js +1 -0
- package/modern/locales/ukUA.js +1 -0
- package/modern/locales/viVN.js +1 -0
- package/modern/locales/zhCN.js +1 -0
- package/node/colDef/gridCheckboxSelectionColDef.js +4 -2
- package/node/colDef/gridNumericColDef.js +1 -1
- package/node/components/columnHeaders/GridColumnHeaderItem.js +5 -3
- package/node/components/columnSelection/GridCellCheckboxRenderer.js +0 -1
- package/node/components/columnSelection/GridHeaderCheckbox.js +0 -1
- package/node/components/containers/GridRootStyles.js +1 -1
- package/node/components/panel/GridColumnsPanel.js +2 -5
- package/node/components/panel/filterPanel/GridFilterPanel.js +1 -2
- package/node/components/toolbar/GridToolbarColumnsButton.js +0 -1
- package/node/components/toolbar/GridToolbarDensitySelector.js +0 -1
- package/node/components/toolbar/GridToolbarExportContainer.js +0 -1
- package/node/components/toolbar/GridToolbarFilterButton.js +0 -1
- package/node/constants/localeTextConstants.js +1 -0
- package/node/hooks/features/columns/useGridColumnSpanning.js +11 -16
- package/node/hooks/features/dimensions/useGridDimensions.js +9 -8
- package/node/hooks/features/rows/useGridRowsMeta.js +80 -77
- package/node/hooks/features/selection/useGridSelectionPreProcessors.js +7 -5
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +42 -9
- package/node/index.js +1 -1
- package/node/locales/arSD.js +1 -0
- package/node/locales/bgBG.js +1 -0
- package/node/locales/csCZ.js +1 -0
- package/node/locales/daDK.js +1 -0
- package/node/locales/deDE.js +1 -0
- package/node/locales/elGR.js +1 -0
- package/node/locales/esES.js +1 -0
- package/node/locales/faIR.js +1 -0
- package/node/locales/fiFI.js +1 -0
- package/node/locales/frFR.js +1 -0
- package/node/locales/heIL.js +1 -0
- package/node/locales/huHU.js +1 -0
- package/node/locales/itIT.js +1 -0
- package/node/locales/jaJP.js +1 -0
- package/node/locales/koKR.js +1 -0
- package/node/locales/nbNO.js +1 -0
- package/node/locales/nlNL.js +1 -0
- package/node/locales/plPL.js +1 -0
- package/node/locales/ptBR.js +1 -0
- package/node/locales/ruRU.js +1 -0
- package/node/locales/skSK.js +1 -0
- package/node/locales/trTR.js +1 -0
- package/node/locales/ukUA.js +1 -0
- package/node/locales/viVN.js +1 -0
- package/node/locales/zhCN.js +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,49 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## v5.12.2
|
|
7
|
+
|
|
8
|
+
_Jun 16, 2022_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 7 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🚀 Performance improvement for dynamic row height (#5135) @m4theushw
|
|
13
|
+
- 🕒 Add demo of how to use the data grid with date pickers (#5053) @cherniavskii
|
|
14
|
+
- 📚 Documentation improvements
|
|
15
|
+
- 🐞 Bugfixes
|
|
16
|
+
|
|
17
|
+
### `@mui/x-data-grid@v5.12.2` / `@mui/x-data-grid-pro@v5.12.2` / `@mui/x-data-grid-premium@v5.12.2`
|
|
18
|
+
|
|
19
|
+
#### Changes
|
|
20
|
+
|
|
21
|
+
- [DataGrid] Fix for cosmetic bug on column filter badge (#5170) @simbahandiane
|
|
22
|
+
- [DataGrid] Hide vertical scrollbar if `autoHeight` is enabled (#5164) @m4theushw
|
|
23
|
+
- [DataGrid] Use exponential search to render non-measured rows (#5135) @m4theushw
|
|
24
|
+
- [DataGridPro] Fix label of the detail panel toggle column (#5191) @m4theushw
|
|
25
|
+
- [DataGridPro] Refresh detail panel caches when props change (#5110) @m4theushw
|
|
26
|
+
|
|
27
|
+
### Docs
|
|
28
|
+
|
|
29
|
+
- [docs] Add example with custom checkbox column (#5161) @flaviendelangle
|
|
30
|
+
- [docs] Batch small changes (#5177) @oliviertassinari
|
|
31
|
+
- [docs] Fix demo currency format (#5034) @oliviertassinari
|
|
32
|
+
- [docs] Fix outdated license description to match the EULA (#5219) @joserodolfofreitas
|
|
33
|
+
- [docs] Fix redundant headers (#5104) @oliviertassinari
|
|
34
|
+
- [docs] Fix some capitalization to match the guidelines (#5105) @oliviertassinari
|
|
35
|
+
- [docs] Improve the `getRowId` doc section (#5156) @flaviendelangle
|
|
36
|
+
- [docs] Instruction to deal with invalid license message (#5074) @joserodolfofreitas
|
|
37
|
+
- [docs] Use redirection in the code (#5114) @oliviertassinari
|
|
38
|
+
- [docs] Add demo of how to use the data grid with date pickers (#5053) @cherniavskii
|
|
39
|
+
|
|
40
|
+
### Core
|
|
41
|
+
|
|
42
|
+
- [core] Improve inline code rendering within the details tag (#5166) @Harmouch101
|
|
43
|
+
- [core] Remove unused props from plugin typing (#5185) @flaviendelangle
|
|
44
|
+
- [core] Use the scrollbar size from `useGridDimensions` on `DataGridProColumnHeaders` (#5201) @flaviendelangle
|
|
45
|
+
- [core] Fix `GridColTypeDef` type (#5167) @cherniavskii
|
|
46
|
+
- [core] Fix `GridColTypeDef` usage in demo (#5197) @cherniavskii
|
|
47
|
+
- [test] Add `waitFor` before asserting height (#5203) @m4theushw
|
|
48
|
+
|
|
6
49
|
## v5.12.1
|
|
7
50
|
|
|
8
51
|
_Jun 9, 2022_
|
|
@@ -4084,9 +4127,9 @@ Big thanks to the 8 contributors who made this release possible. Here are some h
|
|
|
4084
4127
|
|
|
4085
4128
|
### Docs
|
|
4086
4129
|
|
|
4087
|
-
- [docs] Data
|
|
4130
|
+
- [docs] Data grid depends on side effects (#666) @oliviertassinari
|
|
4088
4131
|
- [docs] Clarify the purpose of x-grid-data-generator (#634) @Elius94
|
|
4089
|
-
- [docs] Data
|
|
4132
|
+
- [docs] Data grid is in the lab (#612) @oliviertassinari
|
|
4090
4133
|
- [docs] Fix Demo app, downgrade webpack-cli, known issue in latest version (#647) @dtassone
|
|
4091
4134
|
- [docs] Fix typo in columns.md @stojy
|
|
4092
4135
|
- [docs] Reduce confusion on /export page (#646) @SerdarMustafa1
|
|
@@ -5,8 +5,9 @@ import { GridHeaderCheckbox } from '../components/columnSelection/GridHeaderChec
|
|
|
5
5
|
import { selectedIdsLookupSelector } from '../hooks/features/selection/gridSelectionSelector';
|
|
6
6
|
import { GRID_BOOLEAN_COL_DEF } from './gridBooleanColDef';
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
export const GRID_CHECKBOX_SELECTION_FIELD = '__check__';
|
|
8
9
|
export const GRID_CHECKBOX_SELECTION_COL_DEF = _extends({}, GRID_BOOLEAN_COL_DEF, {
|
|
9
|
-
field:
|
|
10
|
+
field: GRID_CHECKBOX_SELECTION_FIELD,
|
|
10
11
|
type: 'checkboxSelection',
|
|
11
12
|
width: 50,
|
|
12
13
|
resizable: false,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { GridFilterOperator } from '../models/gridFilterOperator';
|
|
2
|
-
export declare const getGridDateOperators: (showTime?: boolean | undefined) => GridFilterOperator<any, string |
|
|
2
|
+
export declare const getGridDateOperators: (showTime?: boolean | undefined) => GridFilterOperator<any, string | Date, any>[];
|
|
@@ -11,7 +11,7 @@ export const GRID_NUMERIC_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
|
11
11
|
valueParser: value => value === '' ? null : Number(value),
|
|
12
12
|
valueFormatter: ({
|
|
13
13
|
value
|
|
14
|
-
}) =>
|
|
14
|
+
}) => isNumber(value) ? value.toLocaleString() : value || '',
|
|
15
15
|
filterOperators: getGridNumericOperators(),
|
|
16
16
|
getApplyQuickFilterFn: getGridNumericQuickFilterFn
|
|
17
17
|
});
|
|
@@ -167,6 +167,7 @@ function GridColumnHeaderItem(props) {
|
|
|
167
167
|
field: column.field,
|
|
168
168
|
colDef: column
|
|
169
169
|
}) : column.headerClassName;
|
|
170
|
+
const label = (_column$headerName = column.headerName) != null ? _column$headerName : column.field;
|
|
170
171
|
return /*#__PURE__*/_jsxs("div", _extends({
|
|
171
172
|
ref: headerCellRef,
|
|
172
173
|
className: clsx(classes.root, headerClassName),
|
|
@@ -179,7 +180,8 @@ function GridColumnHeaderItem(props) {
|
|
|
179
180
|
role: "columnheader",
|
|
180
181
|
tabIndex: tabIndex,
|
|
181
182
|
"aria-colindex": colIndex + 1,
|
|
182
|
-
"aria-sort": ariaSort
|
|
183
|
+
"aria-sort": ariaSort,
|
|
184
|
+
"aria-label": column.renderHeader && headerComponent == null ? label : undefined
|
|
183
185
|
}, mouseEventsHandlers, {
|
|
184
186
|
children: [/*#__PURE__*/_jsxs("div", _extends({
|
|
185
187
|
className: classes.draggableContainer,
|
|
@@ -189,8 +191,8 @@ function GridColumnHeaderItem(props) {
|
|
|
189
191
|
className: classes.titleContainer,
|
|
190
192
|
children: [/*#__PURE__*/_jsx("div", {
|
|
191
193
|
className: classes.titleContainerContent,
|
|
192
|
-
children: headerComponent
|
|
193
|
-
label:
|
|
194
|
+
children: column.renderHeader ? headerComponent : /*#__PURE__*/_jsx(GridColumnHeaderTitle, {
|
|
195
|
+
label: label,
|
|
194
196
|
description: column.description,
|
|
195
197
|
columnWidth: width
|
|
196
198
|
})
|
|
@@ -135,7 +135,6 @@ export function GridColumnsPanel(props) {
|
|
|
135
135
|
checked: columnVisibilityModel[column.field] !== false,
|
|
136
136
|
onClick: toggleColumn,
|
|
137
137
|
name: column.field,
|
|
138
|
-
color: "primary",
|
|
139
138
|
size: "small"
|
|
140
139
|
}, (_rootProps$components2 = rootProps.componentsProps) == null ? void 0 : _rootProps$components2.baseSwitch)),
|
|
141
140
|
label: column.headerName || column.field
|
|
@@ -152,13 +151,11 @@ export function GridColumnsPanel(props) {
|
|
|
152
151
|
})
|
|
153
152
|
}), /*#__PURE__*/_jsxs(GridPanelFooter, {
|
|
154
153
|
children: [/*#__PURE__*/_jsx(rootProps.components.BaseButton, _extends({
|
|
155
|
-
onClick: () => toggleAllColumns(false)
|
|
156
|
-
color: "primary"
|
|
154
|
+
onClick: () => toggleAllColumns(false)
|
|
157
155
|
}, (_rootProps$components3 = rootProps.componentsProps) == null ? void 0 : _rootProps$components3.baseButton, {
|
|
158
156
|
children: apiRef.current.getLocaleText('columnsPanelHideAllButton')
|
|
159
157
|
})), /*#__PURE__*/_jsx(rootProps.components.BaseButton, _extends({
|
|
160
|
-
onClick: () => toggleAllColumns(true)
|
|
161
|
-
color: "primary"
|
|
158
|
+
onClick: () => toggleAllColumns(true)
|
|
162
159
|
}, (_rootProps$components4 = rootProps.componentsProps) == null ? void 0 : _rootProps$components4.baseButton, {
|
|
163
160
|
children: apiRef.current.getLocaleText('columnsPanelShowAllButton')
|
|
164
161
|
}))]
|
|
@@ -113,8 +113,7 @@ const GridFilterPanel = /*#__PURE__*/React.forwardRef(function GridFilterPanel(p
|
|
|
113
113
|
}), !rootProps.disableMultipleColumnsFiltering && /*#__PURE__*/_jsx(GridPanelFooter, {
|
|
114
114
|
children: /*#__PURE__*/_jsx(rootProps.components.BaseButton, _extends({
|
|
115
115
|
onClick: addNewFilter,
|
|
116
|
-
startIcon: /*#__PURE__*/_jsx(GridAddIcon, {})
|
|
117
|
-
color: "primary"
|
|
116
|
+
startIcon: /*#__PURE__*/_jsx(GridAddIcon, {})
|
|
118
117
|
}, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.baseButton, {
|
|
119
118
|
children: apiRef.current.getLocaleText('filterPanelAddFilter')
|
|
120
119
|
}))
|
|
@@ -41,7 +41,6 @@ export const GridToolbarColumnsButton = /*#__PURE__*/React.forwardRef(function G
|
|
|
41
41
|
return /*#__PURE__*/_jsx(rootProps.components.BaseButton, _extends({
|
|
42
42
|
ref: ref,
|
|
43
43
|
size: "small",
|
|
44
|
-
color: "primary",
|
|
45
44
|
"aria-label": apiRef.current.getLocaleText('toolbarColumnsLabel'),
|
|
46
45
|
startIcon: /*#__PURE__*/_jsx(rootProps.components.ColumnSelectorIcon, {})
|
|
47
46
|
}, other, {
|
|
@@ -95,7 +95,6 @@ export const GridToolbarDensitySelector = /*#__PURE__*/React.forwardRef(function
|
|
|
95
95
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
96
96
|
children: [/*#__PURE__*/_jsx(rootProps.components.BaseButton, _extends({
|
|
97
97
|
ref: handleRef,
|
|
98
|
-
color: "primary",
|
|
99
98
|
size: "small",
|
|
100
99
|
startIcon: startIcon,
|
|
101
100
|
"aria-label": apiRef.current.getLocaleText('toolbarDensityLabel'),
|
|
@@ -52,7 +52,6 @@ export const GridToolbarExportContainer = /*#__PURE__*/React.forwardRef(function
|
|
|
52
52
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
53
53
|
children: [/*#__PURE__*/_jsx(rootProps.components.BaseButton, _extends({
|
|
54
54
|
ref: handleRef,
|
|
55
|
-
color: "primary",
|
|
56
55
|
size: "small",
|
|
57
56
|
startIcon: /*#__PURE__*/_jsx(rootProps.components.ExportIcon, {}),
|
|
58
57
|
"aria-expanded": open ? 'true' : undefined,
|
|
@@ -108,7 +108,6 @@ const GridToolbarFilterButton = /*#__PURE__*/React.forwardRef(function GridToolb
|
|
|
108
108
|
children: /*#__PURE__*/_jsx(rootProps.components.BaseButton, _extends({
|
|
109
109
|
ref: ref,
|
|
110
110
|
size: "small",
|
|
111
|
-
color: "primary",
|
|
112
111
|
"aria-label": apiRef.current.getLocaleText('toolbarFiltersLabel'),
|
|
113
112
|
startIcon: /*#__PURE__*/_jsx(Badge, {
|
|
114
113
|
badgeContent: activeFilters.length,
|
|
@@ -105,6 +105,7 @@ export const GRID_DEFAULT_LOCALE_TEXT = {
|
|
|
105
105
|
groupColumn: name => `Group by ${name}`,
|
|
106
106
|
unGroupColumn: name => `Stop grouping by ${name}`,
|
|
107
107
|
// Master/detail
|
|
108
|
+
detailPanelToggle: 'Detail panel toggle',
|
|
108
109
|
expandDetailPanel: 'Expand',
|
|
109
110
|
collapseDetailPanel: 'Collapse',
|
|
110
111
|
// Used core components translation keys
|
|
@@ -8,4 +8,4 @@ export declare const columnsStateInitializer: GridStateInitializer<Pick<DataGrid
|
|
|
8
8
|
* @requires useGridDimensions (method, event) - can be after
|
|
9
9
|
* TODO: Impossible priority - useGridParamsApi also needs to be after useGridColumns
|
|
10
10
|
*/
|
|
11
|
-
export declare function useGridColumns(apiRef: React.MutableRefObject<GridApiCommunity>, props: Pick<DataGridProcessedProps, '
|
|
11
|
+
export declare function useGridColumns(apiRef: React.MutableRefObject<GridApiCommunity>, props: Pick<DataGridProcessedProps, 'columns' | 'onColumnVisibilityChange' | 'columnVisibilityModel' | 'onColumnVisibilityModelChange' | 'columnTypes' | 'components' | 'componentsProps'>): void;
|
|
@@ -16,6 +16,11 @@ export interface GridDimensions {
|
|
|
16
16
|
* Indicates if a scroll is currently needed to go from the beginning of the first row to the end of the last row.
|
|
17
17
|
*/
|
|
18
18
|
hasScrollY: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Size of the scrollbar used to scroll the rows in pixel.
|
|
21
|
+
* It is defined even when the scrollbar is currently not needed.
|
|
22
|
+
*/
|
|
23
|
+
scrollBarSize: number;
|
|
19
24
|
}
|
|
20
25
|
export interface GridDimensionsApi {
|
|
21
26
|
/**
|
|
@@ -37,7 +37,7 @@ const hasScroll = ({
|
|
|
37
37
|
|
|
38
38
|
export function useGridDimensions(apiRef, props) {
|
|
39
39
|
const logger = useGridLogger(apiRef, 'useResizeContainer');
|
|
40
|
-
const
|
|
40
|
+
const errorShown = React.useRef(false);
|
|
41
41
|
const rootDimensionsRef = React.useRef(null);
|
|
42
42
|
const fullDimensionsRef = React.useRef(null);
|
|
43
43
|
const rowsMeta = useGridSelector(apiRef, gridRowsMetaSelector);
|
|
@@ -94,7 +94,8 @@ export function useGridDimensions(apiRef, props) {
|
|
|
94
94
|
viewportOuterSize,
|
|
95
95
|
viewportInnerSize,
|
|
96
96
|
hasScrollX,
|
|
97
|
-
hasScrollY
|
|
97
|
+
hasScrollY,
|
|
98
|
+
scrollBarSize
|
|
98
99
|
};
|
|
99
100
|
const prevDimensions = fullDimensionsRef.current;
|
|
100
101
|
fullDimensionsRef.current = newFullDimensions;
|
|
@@ -144,14 +145,14 @@ export function useGridDimensions(apiRef, props) {
|
|
|
144
145
|
|
|
145
146
|
const isJSDOM = /jsdom/.test(window.navigator.userAgent);
|
|
146
147
|
|
|
147
|
-
if (size.height === 0 && !
|
|
148
|
-
logger.
|
|
149
|
-
|
|
148
|
+
if (size.height === 0 && !errorShown.current && !props.autoHeight && !isJSDOM) {
|
|
149
|
+
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'));
|
|
150
|
+
errorShown.current = true;
|
|
150
151
|
}
|
|
151
152
|
|
|
152
|
-
if (size.width === 0 && !
|
|
153
|
-
logger.
|
|
154
|
-
|
|
153
|
+
if (size.width === 0 && !errorShown.current && !isJSDOM) {
|
|
154
|
+
logger.error(['The parent DOM element of the data grid has an empty width.', 'Please make sure that this element has an intrinsic width.', 'The grid displays with a width of 0px.', '', 'More details: https://mui.com/r/x-data-grid-no-dimensions.'].join('\n'));
|
|
155
|
+
errorShown.current = true;
|
|
155
156
|
}
|
|
156
157
|
|
|
157
158
|
if (isTestEnvironment) {
|
|
@@ -19,7 +19,7 @@ export interface GridFilterState {
|
|
|
19
19
|
/**
|
|
20
20
|
* Amount of descendants that are passing the filters.
|
|
21
21
|
* For the Tree Data, it includes all the intermediate depth levels (= amount of children + amount of grand children + ...).
|
|
22
|
-
* For the Row
|
|
22
|
+
* For the Row grouping by column, it does not include the intermediate depth levels (= amount of descendant of maximum depth).
|
|
23
23
|
* If a row is not registered in this lookup, it is supposed to have no descendant passing the filters.
|
|
24
24
|
*/
|
|
25
25
|
filteredDescendantCountLookup: Record<GridRowId, number>;
|
|
@@ -8,4 +8,4 @@ export declare const filterStateInitializer: GridStateInitializer<Pick<DataGridP
|
|
|
8
8
|
* @requires useGridParamsApi (method)
|
|
9
9
|
* @requires useGridRows (event)
|
|
10
10
|
*/
|
|
11
|
-
export declare const useGridFilter: (apiRef: React.MutableRefObject<GridApiCommunity>, props: Pick<DataGridProcessedProps, '
|
|
11
|
+
export declare const useGridFilter: (apiRef: React.MutableRefObject<GridApiCommunity>, props: Pick<DataGridProcessedProps, 'filterModel' | 'onFilterModelChange' | 'filterMode' | 'disableMultipleColumnsFiltering' | 'components' | 'componentsProps'>) => void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import { debounce } from '@mui/material/utils';
|
|
3
4
|
import { useGridVisibleRows } from '../../utils/useGridVisibleRows';
|
|
4
5
|
import { useGridApiMethod } from '../../utils/useGridApiMethod';
|
|
5
6
|
import { useGridSelector } from '../../utils/useGridSelector';
|
|
@@ -36,86 +37,86 @@ export const useGridRowsMeta = (apiRef, props) => {
|
|
|
36
37
|
const currentPage = useGridVisibleRows(apiRef, props);
|
|
37
38
|
const hydrateRowsMeta = React.useCallback(() => {
|
|
38
39
|
hasRowWithAutoHeight.current = false;
|
|
39
|
-
apiRef.current.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
needsFirstMeasurement: true // Assume all rows will need to be measured by default
|
|
53
|
-
|
|
54
|
-
};
|
|
55
|
-
}
|
|
40
|
+
const densityFactor = gridDensityFactorSelector(apiRef.current.state, apiRef.current.instanceId);
|
|
41
|
+
const positions = [];
|
|
42
|
+
const currentPageTotalHeight = currentPage.rows.reduce((acc, row) => {
|
|
43
|
+
positions.push(acc);
|
|
44
|
+
|
|
45
|
+
if (!rowsHeightLookup.current[row.id]) {
|
|
46
|
+
rowsHeightLookup.current[row.id] = {
|
|
47
|
+
sizes: {
|
|
48
|
+
base: rowHeightFromDensity
|
|
49
|
+
},
|
|
50
|
+
isResized: false,
|
|
51
|
+
autoHeight: false,
|
|
52
|
+
needsFirstMeasurement: true // Assume all rows will need to be measured by default
|
|
56
53
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
hasRowWithAutoHeight.current = true;
|
|
85
|
-
rowsHeightLookup.current[row.id].autoHeight = true;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const {
|
|
58
|
+
isResized,
|
|
59
|
+
needsFirstMeasurement,
|
|
60
|
+
sizes
|
|
61
|
+
} = rowsHeightLookup.current[row.id];
|
|
62
|
+
let baseRowHeight = rowHeightFromDensity;
|
|
63
|
+
const existingBaseRowHeight = sizes.base;
|
|
64
|
+
|
|
65
|
+
if (isResized) {
|
|
66
|
+
// Do not recalculate resized row height and use the value from the lookup
|
|
67
|
+
baseRowHeight = existingBaseRowHeight;
|
|
68
|
+
} else if (getRowHeightProp) {
|
|
69
|
+
const rowHeightFromUser = getRowHeightProp(_extends({}, row, {
|
|
70
|
+
densityFactor
|
|
71
|
+
}));
|
|
72
|
+
|
|
73
|
+
if (rowHeightFromUser === 'auto') {
|
|
74
|
+
if (needsFirstMeasurement) {
|
|
75
|
+
const estimatedRowHeight = getEstimatedRowHeight ? getEstimatedRowHeight(_extends({}, row, {
|
|
76
|
+
densityFactor
|
|
77
|
+
})) : rowHeightFromDensity; // If the row was not measured yet use the estimated row height
|
|
78
|
+
|
|
79
|
+
baseRowHeight = estimatedRowHeight != null ? estimatedRowHeight : rowHeightFromDensity;
|
|
86
80
|
} else {
|
|
87
|
-
|
|
88
|
-
baseRowHeight = rowHeightFromUser != null ? rowHeightFromUser : rowHeightFromDensity;
|
|
89
|
-
rowsHeightLookup.current[row.id].needsFirstMeasurement = false;
|
|
90
|
-
rowsHeightLookup.current[row.id].autoHeight = false;
|
|
81
|
+
baseRowHeight = existingBaseRowHeight;
|
|
91
82
|
}
|
|
83
|
+
|
|
84
|
+
hasRowWithAutoHeight.current = true;
|
|
85
|
+
rowsHeightLookup.current[row.id].autoHeight = true;
|
|
92
86
|
} else {
|
|
87
|
+
// Default back to base rowHeight if getRowHeight returns null or undefined.
|
|
88
|
+
baseRowHeight = rowHeightFromUser != null ? rowHeightFromUser : rowHeightFromDensity;
|
|
93
89
|
rowsHeightLookup.current[row.id].needsFirstMeasurement = false;
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
const initialHeights = {
|
|
98
|
-
base: baseRowHeight
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
if (getRowSpacing) {
|
|
102
|
-
var _spacing$top, _spacing$bottom;
|
|
103
|
-
|
|
104
|
-
const indexRelativeToCurrentPage = apiRef.current.getRowIndexRelativeToVisibleRows(row.id);
|
|
105
|
-
const spacing = getRowSpacing(_extends({}, row, {
|
|
106
|
-
isFirstVisible: indexRelativeToCurrentPage === 0,
|
|
107
|
-
isLastVisible: indexRelativeToCurrentPage === currentPage.rows.length - 1,
|
|
108
|
-
indexRelativeToCurrentPage
|
|
109
|
-
}));
|
|
110
|
-
initialHeights.spacingTop = (_spacing$top = spacing.top) != null ? _spacing$top : 0;
|
|
111
|
-
initialHeights.spacingBottom = (_spacing$bottom = spacing.bottom) != null ? _spacing$bottom : 0;
|
|
90
|
+
rowsHeightLookup.current[row.id].autoHeight = false;
|
|
112
91
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
92
|
+
} else {
|
|
93
|
+
rowsHeightLookup.current[row.id].needsFirstMeasurement = false;
|
|
94
|
+
} // We use an object to make simple to check if a height is already added or not
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
const initialHeights = {
|
|
98
|
+
base: baseRowHeight
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
if (getRowSpacing) {
|
|
102
|
+
var _spacing$top, _spacing$bottom;
|
|
103
|
+
|
|
104
|
+
const indexRelativeToCurrentPage = apiRef.current.getRowIndexRelativeToVisibleRows(row.id);
|
|
105
|
+
const spacing = getRowSpacing(_extends({}, row, {
|
|
106
|
+
isFirstVisible: indexRelativeToCurrentPage === 0,
|
|
107
|
+
isLastVisible: indexRelativeToCurrentPage === currentPage.rows.length - 1,
|
|
108
|
+
indexRelativeToCurrentPage
|
|
109
|
+
}));
|
|
110
|
+
initialHeights.spacingTop = (_spacing$top = spacing.top) != null ? _spacing$top : 0;
|
|
111
|
+
initialHeights.spacingBottom = (_spacing$bottom = spacing.bottom) != null ? _spacing$bottom : 0;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const processedSizes = apiRef.current.unstable_applyPipeProcessors('rowHeight', initialHeights, row);
|
|
115
|
+
rowsHeightLookup.current[row.id].sizes = processedSizes;
|
|
116
|
+
const finalRowHeight = Object.values(processedSizes).reduce((acc2, value) => acc2 + value, 0);
|
|
117
|
+
return acc + finalRowHeight;
|
|
118
|
+
}, 0);
|
|
119
|
+
apiRef.current.setState(state => {
|
|
119
120
|
return _extends({}, state, {
|
|
120
121
|
rowsMeta: {
|
|
121
122
|
currentPageTotalHeight,
|
|
@@ -148,6 +149,7 @@ export const useGridRowsMeta = (apiRef, props) => {
|
|
|
148
149
|
rowsHeightLookup.current[id].needsFirstMeasurement = false;
|
|
149
150
|
hydrateRowsMeta();
|
|
150
151
|
}, [hydrateRowsMeta]);
|
|
152
|
+
const debouncedHydrateRowsMeta = React.useMemo(() => debounce(hydrateRowsMeta), [hydrateRowsMeta]);
|
|
151
153
|
const storeMeasuredRowHeight = React.useCallback((id, height) => {
|
|
152
154
|
if (!rowsHeightLookup.current[id] || !rowsHeightLookup.current[id].autoHeight) {
|
|
153
155
|
return;
|
|
@@ -159,9 +161,9 @@ export const useGridRowsMeta = (apiRef, props) => {
|
|
|
159
161
|
rowsHeightLookup.current[id].sizes.base = height;
|
|
160
162
|
|
|
161
163
|
if (needsHydration) {
|
|
162
|
-
|
|
164
|
+
debouncedHydrateRowsMeta();
|
|
163
165
|
}
|
|
164
|
-
}, [
|
|
166
|
+
}, [debouncedHydrateRowsMeta]);
|
|
165
167
|
const rowHasAutoHeight = React.useCallback(id => {
|
|
166
168
|
var _rowsHeightLookup$cur2;
|
|
167
169
|
|
|
@@ -171,7 +173,7 @@ export const useGridRowsMeta = (apiRef, props) => {
|
|
|
171
173
|
return lastMeasuredRowIndex.current;
|
|
172
174
|
}, []);
|
|
173
175
|
const setLastMeasuredRowIndex = React.useCallback(index => {
|
|
174
|
-
if (hasRowWithAutoHeight.current) {
|
|
176
|
+
if (hasRowWithAutoHeight.current && index > lastMeasuredRowIndex.current) {
|
|
175
177
|
lastMeasuredRowIndex.current = index;
|
|
176
178
|
}
|
|
177
179
|
}, []); // The effect is used to build the rows meta data - currentPageTotalHeight and positions.
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
4
4
|
import { useGridRegisterPipeProcessor } from '../../core/pipeProcessing';
|
|
5
5
|
import { getDataGridUtilityClass } from '../../../constants';
|
|
6
|
-
import { GRID_CHECKBOX_SELECTION_COL_DEF } from '../../../colDef';
|
|
6
|
+
import { GRID_CHECKBOX_SELECTION_COL_DEF, GRID_CHECKBOX_SELECTION_FIELD } from '../../../colDef';
|
|
7
7
|
|
|
8
8
|
const useUtilityClasses = ownerState => {
|
|
9
9
|
const {
|
|
@@ -31,14 +31,16 @@ export const useGridSelectionPreProcessors = (apiRef, props) => {
|
|
|
31
31
|
});
|
|
32
32
|
|
|
33
33
|
const shouldHaveSelectionColumn = props.checkboxSelection;
|
|
34
|
-
const haveSelectionColumn = columnsState.lookup[
|
|
34
|
+
const haveSelectionColumn = columnsState.lookup[GRID_CHECKBOX_SELECTION_FIELD] != null;
|
|
35
35
|
|
|
36
36
|
if (shouldHaveSelectionColumn && !haveSelectionColumn) {
|
|
37
|
-
columnsState.lookup[
|
|
38
|
-
columnsState.all = [
|
|
37
|
+
columnsState.lookup[GRID_CHECKBOX_SELECTION_FIELD] = selectionColumn;
|
|
38
|
+
columnsState.all = [GRID_CHECKBOX_SELECTION_FIELD, ...columnsState.all];
|
|
39
39
|
} else if (!shouldHaveSelectionColumn && haveSelectionColumn) {
|
|
40
|
-
delete columnsState.lookup[
|
|
41
|
-
columnsState.all = columnsState.all.filter(field => field !==
|
|
40
|
+
delete columnsState.lookup[GRID_CHECKBOX_SELECTION_FIELD];
|
|
41
|
+
columnsState.all = columnsState.all.filter(field => field !== GRID_CHECKBOX_SELECTION_FIELD);
|
|
42
|
+
} else if (shouldHaveSelectionColumn && haveSelectionColumn) {
|
|
43
|
+
columnsState.lookup[GRID_CHECKBOX_SELECTION_FIELD] = _extends({}, selectionColumn, columnsState.lookup[GRID_CHECKBOX_SELECTION_FIELD]);
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
return columnsState;
|
|
@@ -7,4 +7,4 @@ export declare const sortingStateInitializer: GridStateInitializer<Pick<DataGrid
|
|
|
7
7
|
* @requires useGridRows (event)
|
|
8
8
|
* @requires useGridColumns (event)
|
|
9
9
|
*/
|
|
10
|
-
export declare const useGridSorting: (apiRef: React.MutableRefObject<GridApiCommunity>, props: Pick<DataGridProcessedProps, '
|
|
10
|
+
export declare const useGridSorting: (apiRef: React.MutableRefObject<GridApiCommunity>, props: Pick<DataGridProcessedProps, 'sortModel' | 'onSortModelChange' | 'sortingOrder' | 'sortingMode' | 'disableMultipleColumnsSorting'>) => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GridRenderContext } from '../../../models';
|
|
3
3
|
import { GridRowId, GridRowModel } from '../../../models/gridRows';
|
|
4
|
-
export declare function
|
|
4
|
+
export declare function binarySearch(offset: number, positions: number[], sliceStart?: number, sliceEnd?: number): number;
|
|
5
5
|
export declare const getRenderableIndexes: ({ firstIndex, lastIndex, buffer, minFirstIndex, maxLastIndex, }: {
|
|
6
6
|
firstIndex: number;
|
|
7
7
|
lastIndex: number;
|