@mui/x-data-grid 7.0.0-alpha.5 → 7.0.0-alpha.6
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 +226 -6
- package/DataGrid/DataGrid.js +25 -19
- package/DataGrid/useDataGridProps.js +0 -1
- package/colDef/gridDateOperators.js +13 -6
- package/colDef/gridSingleSelectColDef.js +6 -15
- package/components/cell/GridEditSingleSelectCell.d.ts +1 -2
- package/components/cell/GridEditSingleSelectCell.js +9 -29
- package/components/columnSelection/GridHeaderCheckbox.js +3 -1
- package/components/panel/filterPanel/GridFilterForm.js +44 -9
- package/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/components/panel/filterPanel/GridFilterInputDate.js +25 -8
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.d.ts +2 -2
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +7 -48
- package/components/panel/filterPanel/GridFilterInputSingleSelect.d.ts +1 -2
- package/components/panel/filterPanel/GridFilterInputSingleSelect.js +15 -57
- package/components/panel/filterPanel/filterPanelUtils.d.ts +3 -2
- package/components/panel/filterPanel/filterPanelUtils.js +10 -5
- package/hooks/features/rowSelection/useGridRowSelection.js +9 -9
- package/hooks/features/rowSelection/utils.d.ts +2 -0
- package/hooks/features/rowSelection/utils.js +8 -0
- package/hooks/utils/useGridAriaAttributes.js +2 -1
- package/index.js +1 -1
- package/legacy/DataGrid/DataGrid.js +25 -19
- package/legacy/DataGrid/useDataGridProps.js +0 -1
- package/legacy/colDef/gridDateOperators.js +13 -13
- package/legacy/colDef/gridSingleSelectColDef.js +6 -15
- package/legacy/components/cell/GridEditSingleSelectCell.js +8 -28
- package/legacy/components/columnSelection/GridHeaderCheckbox.js +3 -1
- package/legacy/components/panel/filterPanel/GridFilterForm.js +51 -19
- package/legacy/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/legacy/components/panel/filterPanel/GridFilterInputDate.js +27 -8
- package/legacy/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +6 -53
- package/legacy/components/panel/filterPanel/GridFilterInputSingleSelect.js +14 -59
- package/legacy/components/panel/filterPanel/filterPanelUtils.js +10 -6
- package/legacy/hooks/features/rowSelection/useGridRowSelection.js +9 -9
- package/legacy/hooks/features/rowSelection/utils.js +8 -0
- package/legacy/hooks/utils/useGridAriaAttributes.js +2 -1
- package/legacy/index.js +1 -1
- package/models/props/DataGridProps.d.ts +26 -25
- package/modern/DataGrid/DataGrid.js +25 -19
- package/modern/DataGrid/useDataGridProps.js +0 -1
- package/modern/colDef/gridDateOperators.js +13 -6
- package/modern/colDef/gridSingleSelectColDef.js +6 -15
- package/modern/components/cell/GridEditSingleSelectCell.js +9 -29
- package/modern/components/columnSelection/GridHeaderCheckbox.js +3 -1
- package/modern/components/panel/filterPanel/GridFilterForm.js +44 -9
- package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/modern/components/panel/filterPanel/GridFilterInputDate.js +24 -6
- package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +7 -47
- package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +15 -56
- package/modern/components/panel/filterPanel/filterPanelUtils.js +10 -5
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +9 -9
- package/modern/hooks/features/rowSelection/utils.js +8 -0
- package/modern/hooks/utils/useGridAriaAttributes.js +2 -1
- package/modern/index.js +1 -1
- package/node/DataGrid/DataGrid.js +25 -19
- package/node/DataGrid/useDataGridProps.js +0 -1
- package/node/colDef/gridDateOperators.js +13 -6
- package/node/colDef/gridSingleSelectColDef.js +5 -14
- package/node/components/cell/GridEditSingleSelectCell.js +8 -28
- package/node/components/columnSelection/GridHeaderCheckbox.js +3 -1
- package/node/components/panel/filterPanel/GridFilterForm.js +44 -9
- package/node/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/node/components/panel/filterPanel/GridFilterInputDate.js +24 -6
- package/node/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +6 -46
- package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +14 -55
- package/node/components/panel/filterPanel/filterPanelUtils.js +12 -7
- package/node/hooks/features/rowSelection/useGridRowSelection.js +9 -9
- package/node/hooks/features/rowSelection/utils.js +14 -0
- package/node/hooks/utils/useGridAriaAttributes.js +2 -1
- package/node/index.js +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,96 @@
|
|
|
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
|
+
## 7.0.0-alpha.6
|
|
7
|
+
|
|
8
|
+
_Dec 22, 2023_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 6 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🎁 Data Grid now supports `Date` objects in the `filterModel`
|
|
13
|
+
- 🌍 Improve Russian (ru-RU) locale on the Data Grid
|
|
14
|
+
- 🐞 Bugfixes
|
|
15
|
+
|
|
16
|
+
### Data Grid
|
|
17
|
+
|
|
18
|
+
#### Breaking changes
|
|
19
|
+
|
|
20
|
+
- The filter panel no longer uses the native version of the [`Select`](https://mui.com/material-ui/react-select/) component for all components.
|
|
21
|
+
- The `getOptionValue` and `getOptionLabel` props were removed from the following components:
|
|
22
|
+
|
|
23
|
+
- `GridEditSingleSelectCell`
|
|
24
|
+
- `GridFilterInputSingleSelect`
|
|
25
|
+
- `GridFilterInputMultipleSingleSelect`
|
|
26
|
+
|
|
27
|
+
Use the `getOptionValue` and `getOptionLabel` properties on the `singleSelect` column definition instead:
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
const column: GridColDef = {
|
|
31
|
+
type: 'singleSelect',
|
|
32
|
+
field: 'country',
|
|
33
|
+
valueOptions: [
|
|
34
|
+
{ code: 'BR', name: 'Brazil' },
|
|
35
|
+
{ code: 'FR', name: 'France' },
|
|
36
|
+
],
|
|
37
|
+
getOptionValue: (value: any) => value.code,
|
|
38
|
+
getOptionLabel: (value: any) => value.name,
|
|
39
|
+
};
|
|
40
|
+
```
|
|
41
|
+
- The `filterModel` now supports `Date` objects as values for `date` and `dateTime` column types.
|
|
42
|
+
The `filterModel` still accepts strings as values for `date` and `dateTime` column types,
|
|
43
|
+
but all updates to the `filterModel` coming from the UI (e.g. filter panel) will set the value as a `Date` object.
|
|
44
|
+
|
|
45
|
+
#### `@mui/x-data-grid@7.0.0-alpha.6`
|
|
46
|
+
|
|
47
|
+
- [DataGrid] Fix typos in the JSDoc (#11451) @flaviendelangle
|
|
48
|
+
- [DataGrid] Make `checkboxSelection` respect the `disableMultipleRowSelection` prop (#11448) @cherniavskii
|
|
49
|
+
- [DataGrid] Support `Date` objects in filter model (#7069) @cherniavskii
|
|
50
|
+
- [DataGrid] Use non-native `Select`s by default (#11330) @cherniavskii
|
|
51
|
+
- [l10n] Improve Russian (ru-RU) locale (#11441) @wensiet
|
|
52
|
+
|
|
53
|
+
#### `@mui/x-data-grid-pro@7.0.0-alpha.6` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
54
|
+
|
|
55
|
+
Same changes as in `@mui/x-data-grid@7.0.0-alpha.6`.
|
|
56
|
+
|
|
57
|
+
#### `@mui/x-data-grid-premium@7.0.0-alpha.6` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
58
|
+
|
|
59
|
+
Same changes as in `@mui/x-data-grid-pro@7.0.0-alpha.6`.
|
|
60
|
+
|
|
61
|
+
### Date Pickers
|
|
62
|
+
|
|
63
|
+
#### `@mui/x-date-pickers@7.0.0-alpha.6`
|
|
64
|
+
|
|
65
|
+
- [fields] Adjust `PickersInput` sizing styles (#11392) @noraleonte
|
|
66
|
+
- [fields] Fix section pasting (#11447) @LukasTy
|
|
67
|
+
- [pickers] Add `PickersTextField` `standard` and `filled` variants (#11250) @noraleonte
|
|
68
|
+
- [pickers] Add missing breaking changes to changelog (#11420) @MBilalShafi
|
|
69
|
+
- [pickers] Cleanup error messages in `PickersSectionList` (#11449) @flaviendelangle
|
|
70
|
+
- [pickers] Create new component `PickersSectionList` (#11352) @flaviendelangle
|
|
71
|
+
|
|
72
|
+
#### `@mui/x-date-pickers-pro@7.0.0-alpha.6` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
73
|
+
|
|
74
|
+
Same changes as in `@mui/x-date-pickers@7.0.0-alpha.6`.
|
|
75
|
+
|
|
76
|
+
### Charts / `@mui/x-charts@7.0.0-alpha.6`
|
|
77
|
+
|
|
78
|
+
- [charts] Allow percentage values for pie chart center and radius (#11464) @alexfauquette
|
|
79
|
+
- [charts] Improve dataset typing (#11372) @alexfauquette
|
|
80
|
+
- [charts] Make error message more explicit (#11457) @alexfauquette
|
|
81
|
+
- [charts] Make the helper `ChartsText` component public (#11370) @alexfauquette
|
|
82
|
+
|
|
83
|
+
### Docs
|
|
84
|
+
|
|
85
|
+
- [docs] Document `false` default values for boolean props (#11477) @cherniavskii
|
|
86
|
+
- [docs] Improve Pickers `name` prop examples (#11422) @LukasTy
|
|
87
|
+
- [docs] Limit `date-fns` package to v2 in codesandbox (#11463) @LukasTy
|
|
88
|
+
|
|
89
|
+
### Core
|
|
90
|
+
|
|
91
|
+
- [core] Cherry pick follow up (#11469) @LukasTy
|
|
92
|
+
- [core] Fix `cherry-pick` action (#11446) @LukasTy
|
|
93
|
+
- [core] Fix security regressions in cherry-pick-next-to-master.yml (#11482) @MBilalShafi
|
|
94
|
+
- [test] Reload the page if its blank and there are no links to the remaining tests (#11466) @cherniavskii
|
|
95
|
+
|
|
6
96
|
## 7.0.0-alpha.5
|
|
7
97
|
|
|
8
98
|
_Dec 14, 2023_
|
|
@@ -43,12 +133,93 @@ Same changes as in `@mui/x-data-grid-pro@7.0.0-alpha.5`.
|
|
|
43
133
|
- The slot interfaces got renamed to match with `@mui/base` naming.
|
|
44
134
|
The `SlotsComponent` suffix has been replaced with `Slots` and `SlotsComponentsProps` with `SlotProps`.
|
|
45
135
|
|
|
46
|
-
```diff
|
|
47
|
-
- DateCalendarSlotsComponent
|
|
48
|
-
+ DateCalendarSlots
|
|
49
|
-
- DateCalendarSlotsComponentsProps
|
|
50
|
-
+ DateCalendarSlotProps
|
|
51
|
-
```
|
|
136
|
+
```diff
|
|
137
|
+
- DateCalendarSlotsComponent
|
|
138
|
+
+ DateCalendarSlots
|
|
139
|
+
- DateCalendarSlotsComponentsProps
|
|
140
|
+
+ DateCalendarSlotProps
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
- Move `inputRef` inside the props passed to the field hooks
|
|
144
|
+
|
|
145
|
+
The field hooks now only receive the props instead of an object containing both the props and the `inputRef`.
|
|
146
|
+
|
|
147
|
+
```diff
|
|
148
|
+
- const { inputRef, ...otherProps } = props
|
|
149
|
+
- const fieldResponse = useDateField({ props: otherProps, inputRef });
|
|
150
|
+
+ const fieldResponse = useDateField(props);
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
If you are using a multi input range field hook, the same applies to `startInputRef` and `endInputRef` params
|
|
154
|
+
|
|
155
|
+
```diff
|
|
156
|
+
- const { inputRef: startInputRef, ...otherStartTextFieldProps } = startTextFieldProps
|
|
157
|
+
- const { inputRef: endInputRef, ...otherEndTextFieldProps } = endTextFieldProps
|
|
158
|
+
|
|
159
|
+
const fieldResponse = useMultiInputDateRangeField({
|
|
160
|
+
sharedProps,
|
|
161
|
+
- startTextFieldProps: otherStartTextFieldProps,
|
|
162
|
+
- endTextFieldProps: otherEndTextFieldProps,
|
|
163
|
+
- startInputRef
|
|
164
|
+
- endInputRef,
|
|
165
|
+
+ startTextFieldProps,
|
|
166
|
+
+ endTextFieldProps
|
|
167
|
+
});
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
- Rename the ref returned by the field hooks to `inputRef`
|
|
171
|
+
|
|
172
|
+
When used with the v6 TextField approach (where the input is an `<input />` HTML element), the field hooks return a ref that needs to be passed to the `<input />` element.
|
|
173
|
+
This ref was previously named `ref` and has been renamed `inputRef` for extra clarity.
|
|
174
|
+
|
|
175
|
+
```diff
|
|
176
|
+
const fieldResponse = useDateField(props);
|
|
177
|
+
|
|
178
|
+
- return <input ref={fieldResponse.ref} />
|
|
179
|
+
+ return <input ref={fieldResponse.inputRef} />
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
If you are using a multi input range field hook, the same applies to the ref in the `startDate` and `endDate` objects
|
|
183
|
+
|
|
184
|
+
```diff
|
|
185
|
+
const fieldResponse = useDateField(props);
|
|
186
|
+
|
|
187
|
+
return (
|
|
188
|
+
<div>
|
|
189
|
+
- <input ref={fieldResponse.startDate.ref} />
|
|
190
|
+
+ <input ref={fieldResponse.startDate.inputRef} />
|
|
191
|
+
<span>–</span>
|
|
192
|
+
- <input ref={fieldResponse.endDate.ref} />
|
|
193
|
+
+ <input ref={fieldResponse.endDate.inputRef} />
|
|
194
|
+
</div>
|
|
195
|
+
)
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
- Restructure the API of `useClearableField`
|
|
199
|
+
|
|
200
|
+
The `useClearableField` hook API has been simplified to now take a `props` parameter instead of a `fieldProps`, `InputProps`, `clearable`, `onClear`, `slots` and `slotProps` parameters.
|
|
201
|
+
|
|
202
|
+
You should now be able to directly pass the returned value from your field hook (e.g: `useDateField`) to `useClearableField`
|
|
203
|
+
|
|
204
|
+
```diff
|
|
205
|
+
const fieldResponse = useDateField(props);
|
|
206
|
+
|
|
207
|
+
- const { InputProps, onClear, clearable, slots, slotProps, ...otherFieldProps } = fieldResponse
|
|
208
|
+
- const { InputProps: ProcessedInputProps, fieldProps: processedFieldProps } = useClearableField({
|
|
209
|
+
- fieldProps: otherFieldProps,
|
|
210
|
+
- InputProps,
|
|
211
|
+
- clearable,
|
|
212
|
+
- onClear,
|
|
213
|
+
- slots,
|
|
214
|
+
- slotProps,
|
|
215
|
+
- });
|
|
216
|
+
-
|
|
217
|
+
- return <MyCustomTextField {...processedFieldProps} InputProps={ProcessedInputProps} />
|
|
218
|
+
|
|
219
|
+
+ const processedFieldProps = useClearableField(fieldResponse);
|
|
220
|
+
+
|
|
221
|
+
+ return <MyCustomTextField {...processedFieldProps} />
|
|
222
|
+
```
|
|
52
223
|
|
|
53
224
|
#### `@mui/x-date-pickers@7.0.0-alpha.5`
|
|
54
225
|
|
|
@@ -1029,6 +1200,55 @@ Here is an example of the renaming for the `<ChartsTooltip />` component.
|
|
|
1029
1200
|
- [core] Update release instructions as per v7 configuration (#10962) @MBilalShafi
|
|
1030
1201
|
- [license] Correctly throw errors (#10924) @oliviertassinari
|
|
1031
1202
|
|
|
1203
|
+
## 6.18.6
|
|
1204
|
+
|
|
1205
|
+
_Dec 22, 2023_
|
|
1206
|
+
|
|
1207
|
+
We'd like to offer a big thanks to the 5 contributors who made this release possible. Here are some highlights ✨:
|
|
1208
|
+
|
|
1209
|
+
- 🌍 Improve Russian (ru-RU) locale (#11429) @wensiet
|
|
1210
|
+
- 🐞 Bugfixes
|
|
1211
|
+
|
|
1212
|
+
### Data Grid
|
|
1213
|
+
|
|
1214
|
+
#### `@mui/x-data-grid@6.18.6`
|
|
1215
|
+
|
|
1216
|
+
- [DataGrid] Fix typos in the JSDoc (#11475) @flaviendelangle
|
|
1217
|
+
- [l10n] Improve Russian (ru-RU) locale (#11429) @wensiet
|
|
1218
|
+
|
|
1219
|
+
#### `@mui/x-data-grid-pro@6.18.6` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
1220
|
+
|
|
1221
|
+
Same changes as in `@mui/x-data-grid@6.18.6`.
|
|
1222
|
+
|
|
1223
|
+
#### `@mui/x-data-grid-premium@6.18.6` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
1224
|
+
|
|
1225
|
+
Same changes as in `@mui/x-data-grid-pro@6.18.6`.
|
|
1226
|
+
|
|
1227
|
+
### Date Pickers
|
|
1228
|
+
|
|
1229
|
+
#### `@mui/x-date-pickers@6.18.6`
|
|
1230
|
+
|
|
1231
|
+
- [fields] Fix section pasting (#11467) @LukasTy
|
|
1232
|
+
|
|
1233
|
+
#### `@mui/x-date-pickers-pro@6.18.6` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
1234
|
+
|
|
1235
|
+
Same changes as in `@mui/x-date-pickers@6.18.6`.
|
|
1236
|
+
|
|
1237
|
+
### Charts / `@mui/x-charts@6.18.6`
|
|
1238
|
+
|
|
1239
|
+
- [charts] Allow percentage values for pie chart center and radius (#11464) @alexfauquette
|
|
1240
|
+
- [charts] Make error message more explicit (#11457) @alexfauquette
|
|
1241
|
+
- [charts] Make the helper `ChartsText` component public (#11370) @alexfauquette
|
|
1242
|
+
- [charts] Improve dataset typing (#11372) @alexfauquette
|
|
1243
|
+
- [charts] Fix size overflow (#11385) @alexfauquette
|
|
1244
|
+
|
|
1245
|
+
### Docs
|
|
1246
|
+
|
|
1247
|
+
- [docs] Document false default values for boolean props (#11489) @cherniavskii
|
|
1248
|
+
- [docs] Improve Pickers `name` prop examples (#11442) @LukasTy
|
|
1249
|
+
- [docs] Limit `date-fns` package to v2 in codesandbox (#11478) @LukasTy
|
|
1250
|
+
- [test] Reload the page if its blank and there are no links to the remaining tests (#11471) @cherniavskii
|
|
1251
|
+
|
|
1032
1252
|
## 6.18.5
|
|
1033
1253
|
|
|
1034
1254
|
_Dec 14, 2023_
|
package/DataGrid/DataGrid.js
CHANGED
|
@@ -41,21 +41,21 @@ DataGridRaw.propTypes = {
|
|
|
41
41
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
42
42
|
// ----------------------------------------------------------------------
|
|
43
43
|
/**
|
|
44
|
-
* The ref object that allows
|
|
44
|
+
* The ref object that allows Data Grid manipulation. Can be instantiated with `useGridApiRef()`.
|
|
45
45
|
*/
|
|
46
46
|
apiRef: PropTypes.shape({
|
|
47
47
|
current: PropTypes.object.isRequired
|
|
48
48
|
}),
|
|
49
49
|
/**
|
|
50
|
-
* The label of the
|
|
50
|
+
* The label of the Data Grid.
|
|
51
51
|
*/
|
|
52
52
|
'aria-label': PropTypes.string,
|
|
53
53
|
/**
|
|
54
|
-
* The id of the element containing a label for the
|
|
54
|
+
* The id of the element containing a label for the Data Grid.
|
|
55
55
|
*/
|
|
56
56
|
'aria-labelledby': PropTypes.string,
|
|
57
57
|
/**
|
|
58
|
-
* If `true`, the
|
|
58
|
+
* If `true`, the Data Grid height is dynamic and follow the number of rows in the Data Grid.
|
|
59
59
|
* @default false
|
|
60
60
|
*/
|
|
61
61
|
autoHeight: PropTypes.bool,
|
|
@@ -69,7 +69,7 @@ DataGridRaw.propTypes = {
|
|
|
69
69
|
*/
|
|
70
70
|
cellModesModel: PropTypes.object,
|
|
71
71
|
/**
|
|
72
|
-
* If `true`, the
|
|
72
|
+
* If `true`, the Data Grid will display an extra column with checkboxes for selecting rows.
|
|
73
73
|
* @default false
|
|
74
74
|
*/
|
|
75
75
|
checkboxSelection: PropTypes.bool,
|
|
@@ -89,7 +89,7 @@ DataGridRaw.propTypes = {
|
|
|
89
89
|
columnBuffer: PropTypes.number,
|
|
90
90
|
columnGroupingModel: PropTypes.arrayOf(PropTypes.object),
|
|
91
91
|
/**
|
|
92
|
-
* Sets the height in pixel of the column headers in the
|
|
92
|
+
* Sets the height in pixel of the column headers in the Data Grid.
|
|
93
93
|
* @default 56
|
|
94
94
|
*/
|
|
95
95
|
columnHeaderHeight: PropTypes.number,
|
|
@@ -109,12 +109,12 @@ DataGridRaw.propTypes = {
|
|
|
109
109
|
*/
|
|
110
110
|
columnThreshold: PropTypes.number,
|
|
111
111
|
/**
|
|
112
|
-
* Set the column visibility model of the
|
|
113
|
-
* If defined, the
|
|
112
|
+
* Set the column visibility model of the Data Grid.
|
|
113
|
+
* If defined, the Data Grid will ignore the `hide` property in [[GridColDef]].
|
|
114
114
|
*/
|
|
115
115
|
columnVisibilityModel: PropTypes.object,
|
|
116
116
|
/**
|
|
117
|
-
* Set the density of the
|
|
117
|
+
* Set the density of the Data Grid.
|
|
118
118
|
* @default "standard"
|
|
119
119
|
*/
|
|
120
120
|
density: PropTypes.oneOf(['comfortable', 'compact', 'standard']),
|
|
@@ -144,6 +144,12 @@ DataGridRaw.propTypes = {
|
|
|
144
144
|
* @ignore - do not document
|
|
145
145
|
*/
|
|
146
146
|
disableEval: PropTypes.bool,
|
|
147
|
+
/**
|
|
148
|
+
* If `true`, multiple selection using the Ctrl/CMD or Shift key is disabled.
|
|
149
|
+
* The MIT DataGrid will ignore this prop, unless `checkboxSelection` is enabled.
|
|
150
|
+
* @default false (`!props.checkboxSelection` for MIT Data Grid)
|
|
151
|
+
*/
|
|
152
|
+
disableMultipleRowSelection: PropTypes.bool,
|
|
147
153
|
/**
|
|
148
154
|
* If `true`, the selection on click on a row or cell is disabled.
|
|
149
155
|
* @default false
|
|
@@ -180,7 +186,7 @@ DataGridRaw.propTypes = {
|
|
|
180
186
|
*/
|
|
181
187
|
filterMode: PropTypes.oneOf(['client', 'server']),
|
|
182
188
|
/**
|
|
183
|
-
* Set the filter model of the
|
|
189
|
+
* Set the filter model of the Data Grid.
|
|
184
190
|
*/
|
|
185
191
|
filterModel: PropTypes.shape({
|
|
186
192
|
items: PropTypes.arrayOf(PropTypes.shape({
|
|
@@ -195,7 +201,7 @@ DataGridRaw.propTypes = {
|
|
|
195
201
|
quickFilterValues: PropTypes.array
|
|
196
202
|
}),
|
|
197
203
|
/**
|
|
198
|
-
* Forwarded props for the
|
|
204
|
+
* Forwarded props for the Data Grid root element.
|
|
199
205
|
* @ignore - do not document.
|
|
200
206
|
*/
|
|
201
207
|
forwardedProps: PropTypes.object,
|
|
@@ -263,7 +269,7 @@ DataGridRaw.propTypes = {
|
|
|
263
269
|
*/
|
|
264
270
|
ignoreDiacritics: PropTypes.bool,
|
|
265
271
|
/**
|
|
266
|
-
* If `true`, the
|
|
272
|
+
* If `true`, the Data Grid will not use `valueFormatter` when exporting to CSV or copying to clipboard.
|
|
267
273
|
* If an object is provided, you can choose to ignore the `valueFormatter` for CSV export or clipboard export.
|
|
268
274
|
* @default false
|
|
269
275
|
*/
|
|
@@ -301,7 +307,7 @@ DataGridRaw.propTypes = {
|
|
|
301
307
|
*/
|
|
302
308
|
loading: PropTypes.bool,
|
|
303
309
|
/**
|
|
304
|
-
* Set the locale text of the
|
|
310
|
+
* Set the locale text of the Data Grid.
|
|
305
311
|
* You can find all the translation keys supported in [the source](https://github.com/mui/mui-x/blob/HEAD/packages/grid/x-data-grid/src/constants/localeTextConstants.ts) in the GitHub repository.
|
|
306
312
|
*/
|
|
307
313
|
localeText: PropTypes.object,
|
|
@@ -469,7 +475,7 @@ DataGridRaw.propTypes = {
|
|
|
469
475
|
*/
|
|
470
476
|
onProcessRowUpdateError: PropTypes.func,
|
|
471
477
|
/**
|
|
472
|
-
* Callback fired when the
|
|
478
|
+
* Callback fired when the Data Grid is resized.
|
|
473
479
|
* @param {ElementSize} containerSize With all properties from [[ElementSize]].
|
|
474
480
|
* @param {MuiEvent<{}>} event The event object.
|
|
475
481
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
@@ -527,7 +533,7 @@ DataGridRaw.propTypes = {
|
|
|
527
533
|
*/
|
|
528
534
|
onSortModelChange: PropTypes.func,
|
|
529
535
|
/**
|
|
530
|
-
* Callback fired when the state of the
|
|
536
|
+
* Callback fired when the state of the Data Grid is updated.
|
|
531
537
|
* @param {GridState} state The new state.
|
|
532
538
|
* @param {MuiEvent<{}>} event The event object.
|
|
533
539
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
@@ -581,7 +587,7 @@ DataGridRaw.propTypes = {
|
|
|
581
587
|
*/
|
|
582
588
|
rowCount: PropTypes.number,
|
|
583
589
|
/**
|
|
584
|
-
* Sets the height in pixel of a row in the
|
|
590
|
+
* Sets the height in pixel of a row in the Data Grid.
|
|
585
591
|
* @default 52
|
|
586
592
|
*/
|
|
587
593
|
rowHeight: PropTypes.number,
|
|
@@ -606,7 +612,7 @@ DataGridRaw.propTypes = {
|
|
|
606
612
|
*/
|
|
607
613
|
rowSelection: PropTypes.bool,
|
|
608
614
|
/**
|
|
609
|
-
* Sets the row selection model of the
|
|
615
|
+
* Sets the row selection model of the Data Grid.
|
|
610
616
|
*/
|
|
611
617
|
rowSelectionModel: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired), PropTypes.number, PropTypes.string]),
|
|
612
618
|
/**
|
|
@@ -620,7 +626,7 @@ DataGridRaw.propTypes = {
|
|
|
620
626
|
*/
|
|
621
627
|
rowThreshold: PropTypes.number,
|
|
622
628
|
/**
|
|
623
|
-
* Override the height/width of the
|
|
629
|
+
* Override the height/width of the Data Grid inner scrollbar.
|
|
624
630
|
*/
|
|
625
631
|
scrollbarSize: PropTypes.number,
|
|
626
632
|
/**
|
|
@@ -654,7 +660,7 @@ DataGridRaw.propTypes = {
|
|
|
654
660
|
*/
|
|
655
661
|
sortingOrder: PropTypes.arrayOf(PropTypes.oneOf(['asc', 'desc'])),
|
|
656
662
|
/**
|
|
657
|
-
* Set the sort model of the
|
|
663
|
+
* Set the sort model of the Data Grid.
|
|
658
664
|
*/
|
|
659
665
|
sortModel: PropTypes.arrayOf(PropTypes.shape({
|
|
660
666
|
field: PropTypes.string.isRequired,
|
|
@@ -8,7 +8,6 @@ import { computeSlots, useProps } from '../internals/utils';
|
|
|
8
8
|
const DATA_GRID_FORCED_PROPS = {
|
|
9
9
|
disableMultipleColumnsFiltering: true,
|
|
10
10
|
disableMultipleColumnsSorting: true,
|
|
11
|
-
disableMultipleRowSelection: true,
|
|
12
11
|
throttleRowsMs: undefined,
|
|
13
12
|
hideFooterRowCount: false,
|
|
14
13
|
pagination: true,
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { GridFilterInputDate } from '../components/panel/filterPanel/GridFilterInputDate';
|
|
2
|
-
const dateRegex = /(\d+)-(\d+)-(\d+)/;
|
|
3
|
-
const dateTimeRegex = /(\d+)-(\d+)-(\d+)T(\d+):(\d+)/;
|
|
4
2
|
function buildApplyFilterFn(filterItem, compareFn, showTime, keepHours) {
|
|
5
3
|
if (!filterItem.value) {
|
|
6
4
|
return null;
|
|
7
5
|
}
|
|
8
|
-
const
|
|
9
|
-
|
|
6
|
+
const date = new Date(filterItem.value);
|
|
7
|
+
if (showTime) {
|
|
8
|
+
date.setSeconds(0, 0);
|
|
9
|
+
} else {
|
|
10
|
+
date.setHours(0, 0, 0, 0);
|
|
11
|
+
}
|
|
12
|
+
const time = date.getTime();
|
|
10
13
|
return value => {
|
|
11
14
|
if (!value) {
|
|
12
15
|
return false;
|
|
@@ -17,8 +20,12 @@ function buildApplyFilterFn(filterItem, compareFn, showTime, keepHours) {
|
|
|
17
20
|
|
|
18
21
|
// Make a copy of the date to not reset the hours in the original object
|
|
19
22
|
const dateCopy = new Date(value);
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
if (showTime) {
|
|
24
|
+
dateCopy.setSeconds(0, 0);
|
|
25
|
+
} else {
|
|
26
|
+
dateCopy.setHours(0, 0, 0, 0);
|
|
27
|
+
}
|
|
28
|
+
return compareFn(dateCopy.getTime(), time);
|
|
22
29
|
};
|
|
23
30
|
}
|
|
24
31
|
export const getGridDateOperators = showTime => [{
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import { GRID_STRING_COL_DEF } from './gridStringColDef';
|
|
3
3
|
import { renderEditSingleSelectCell } from '../components/cell/GridEditSingleSelectCell';
|
|
4
4
|
import { getGridSingleSelectOperators } from './gridSingleSelectOperators';
|
|
5
|
-
import { isSingleSelectColDef } from '../components/panel/filterPanel/filterPanelUtils';
|
|
5
|
+
import { getValueOptions, isSingleSelectColDef } from '../components/panel/filterPanel/filterPanelUtils';
|
|
6
6
|
import { isObject } from '../utils/utils';
|
|
7
7
|
const isArrayOfObjects = options => {
|
|
8
8
|
return typeof options[0] === 'object';
|
|
@@ -28,16 +28,10 @@ export const GRID_SINGLE_SELECT_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
|
28
28
|
if (!isSingleSelectColDef(colDef)) {
|
|
29
29
|
return '';
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
row: id ? api.getRow(id) : null,
|
|
36
|
-
field
|
|
37
|
-
});
|
|
38
|
-
} else {
|
|
39
|
-
valueOptions = colDef.valueOptions;
|
|
40
|
-
}
|
|
31
|
+
const valueOptions = getValueOptions(colDef, {
|
|
32
|
+
id,
|
|
33
|
+
row: id ? api.getRow(id) : null
|
|
34
|
+
});
|
|
41
35
|
if (value == null) {
|
|
42
36
|
return '';
|
|
43
37
|
}
|
|
@@ -55,10 +49,7 @@ export const GRID_SINGLE_SELECT_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
|
55
49
|
// @ts-ignore
|
|
56
50
|
pastedValueParser: (value, params) => {
|
|
57
51
|
const colDef = params.colDef;
|
|
58
|
-
const
|
|
59
|
-
const valueOptions = typeof colDefValueOptions === 'function' ? colDefValueOptions({
|
|
60
|
-
field: colDef.field
|
|
61
|
-
}) : colDefValueOptions || [];
|
|
52
|
+
const valueOptions = getValueOptions(colDef) || [];
|
|
62
53
|
const getOptionValue = colDef.getOptionValue;
|
|
63
54
|
const valueOption = valueOptions.find(option => {
|
|
64
55
|
if (getOptionValue(option) === value) {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { SelectProps, SelectChangeEvent } from '@mui/material/Select';
|
|
3
3
|
import { GridRenderEditCellParams } from '../../models/params/gridCellParams';
|
|
4
|
-
|
|
5
|
-
export interface GridEditSingleSelectCellProps extends GridRenderEditCellParams, Omit<SelectProps, 'id' | 'tabIndex' | 'value'>, Pick<GridSingleSelectColDef, 'getOptionLabel' | 'getOptionValue'> {
|
|
4
|
+
export interface GridEditSingleSelectCellProps extends GridRenderEditCellParams, Omit<SelectProps, 'id' | 'tabIndex' | 'value'> {
|
|
6
5
|
/**
|
|
7
6
|
* Callback called when the value is changed by the user.
|
|
8
7
|
* @param {SelectChangeEvent<any>} event The event source of the callback.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "tabIndex", "className", "hasFocus", "isValidating", "isProcessingProps", "error", "onValueChange", "initialOpen"
|
|
3
|
+
const _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "tabIndex", "className", "hasFocus", "isValidating", "isProcessingProps", "error", "onValueChange", "initialOpen"],
|
|
4
4
|
_excluded2 = ["MenuProps"];
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
@@ -9,7 +9,7 @@ import { GridCellEditStopReasons } from '../../models/params/gridEditCellParams'
|
|
|
9
9
|
import { isEscapeKey } from '../../utils/keyboardUtils';
|
|
10
10
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
11
11
|
import { GridEditModes } from '../../models/gridEditRowModel';
|
|
12
|
-
import { getValueFromValueOptions, isSingleSelectColDef } from '../panel/filterPanel/filterPanelUtils';
|
|
12
|
+
import { getValueFromValueOptions, getValueOptions, isSingleSelectColDef } from '../panel/filterPanel/filterPanelUtils';
|
|
13
13
|
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
14
14
|
import { createElement as _createElement } from "react";
|
|
15
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -28,9 +28,7 @@ function GridEditSingleSelectCell(props) {
|
|
|
28
28
|
hasFocus,
|
|
29
29
|
error,
|
|
30
30
|
onValueChange,
|
|
31
|
-
initialOpen = rootProps.editMode === GridEditModes.Cell
|
|
32
|
-
getOptionLabel: getOptionLabelProp,
|
|
33
|
-
getOptionValue: getOptionValueProp
|
|
31
|
+
initialOpen = rootProps.editMode === GridEditModes.Cell
|
|
34
32
|
} = props,
|
|
35
33
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
36
34
|
const apiRef = useGridApiContext();
|
|
@@ -53,21 +51,15 @@ function GridEditSingleSelectCell(props) {
|
|
|
53
51
|
if (!isSingleSelectColDef(colDef)) {
|
|
54
52
|
return null;
|
|
55
53
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
row,
|
|
61
|
-
field
|
|
62
|
-
});
|
|
63
|
-
} else {
|
|
64
|
-
valueOptions = colDef == null ? void 0 : colDef.valueOptions;
|
|
65
|
-
}
|
|
54
|
+
const valueOptions = getValueOptions(colDef, {
|
|
55
|
+
id,
|
|
56
|
+
row
|
|
57
|
+
});
|
|
66
58
|
if (!valueOptions) {
|
|
67
59
|
return null;
|
|
68
60
|
}
|
|
69
|
-
const getOptionValue =
|
|
70
|
-
const getOptionLabel =
|
|
61
|
+
const getOptionValue = colDef.getOptionValue;
|
|
62
|
+
const getOptionLabel = colDef.getOptionLabel;
|
|
71
63
|
const handleChange = async event => {
|
|
72
64
|
if (!isSingleSelectColDef(colDef) || !valueOptions) {
|
|
73
65
|
return;
|
|
@@ -157,18 +149,6 @@ process.env.NODE_ENV !== "production" ? GridEditSingleSelectCell.propTypes = {
|
|
|
157
149
|
* The cell value formatted with the column valueFormatter.
|
|
158
150
|
*/
|
|
159
151
|
formattedValue: PropTypes.any,
|
|
160
|
-
/**
|
|
161
|
-
* Used to determine the label displayed for a given value option.
|
|
162
|
-
* @param {ValueOptions} value The current value option.
|
|
163
|
-
* @returns {string} The text to be displayed.
|
|
164
|
-
*/
|
|
165
|
-
getOptionLabel: PropTypes.func,
|
|
166
|
-
/**
|
|
167
|
-
* Used to determine the value used for a value option.
|
|
168
|
-
* @param {ValueOptions} value The current value option.
|
|
169
|
-
* @returns {string} The value to be used.
|
|
170
|
-
*/
|
|
171
|
-
getOptionValue: PropTypes.func,
|
|
172
152
|
/**
|
|
173
153
|
* If true, the cell is the active element.
|
|
174
154
|
*/
|
|
@@ -4,6 +4,7 @@ const _excluded = ["field", "colDef"];
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
7
|
+
import { isMultipleRowSelectionEnabled } from '../../hooks/features/rowSelection/utils';
|
|
7
8
|
import { useGridSelector } from '../../hooks/utils/useGridSelector';
|
|
8
9
|
import { gridTabIndexColumnHeaderSelector } from '../../hooks/features/focus/gridFocusStateSelector';
|
|
9
10
|
import { gridRowSelectionStateSelector } from '../../hooks/features/rowSelection/gridRowSelectionSelector';
|
|
@@ -103,7 +104,8 @@ const GridHeaderCheckbox = /*#__PURE__*/React.forwardRef(function GridHeaderChec
|
|
|
103
104
|
'aria-label': label
|
|
104
105
|
},
|
|
105
106
|
tabIndex: tabIndex,
|
|
106
|
-
onKeyDown: handleKeyDown
|
|
107
|
+
onKeyDown: handleKeyDown,
|
|
108
|
+
disabled: !isMultipleRowSelectionEnabled(rootProps)
|
|
107
109
|
}, (_rootProps$slotProps = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps.baseCheckbox, other));
|
|
108
110
|
});
|
|
109
111
|
process.env.NODE_ENV !== "production" ? GridHeaderCheckbox.propTypes = {
|