@mui/x-data-grid 7.0.0-alpha.4 → 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.
Files changed (82) hide show
  1. package/CHANGELOG.md +342 -0
  2. package/DataGrid/DataGrid.js +25 -19
  3. package/DataGrid/useDataGridProps.js +0 -1
  4. package/colDef/gridDateOperators.js +13 -6
  5. package/colDef/gridSingleSelectColDef.js +6 -15
  6. package/components/cell/GridEditSingleSelectCell.d.ts +1 -2
  7. package/components/cell/GridEditSingleSelectCell.js +9 -29
  8. package/components/columnSelection/GridHeaderCheckbox.js +3 -1
  9. package/components/panel/filterPanel/GridFilterForm.js +44 -9
  10. package/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
  11. package/components/panel/filterPanel/GridFilterInputDate.js +25 -8
  12. package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.d.ts +2 -2
  13. package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +7 -48
  14. package/components/panel/filterPanel/GridFilterInputSingleSelect.d.ts +1 -2
  15. package/components/panel/filterPanel/GridFilterInputSingleSelect.js +15 -57
  16. package/components/panel/filterPanel/filterPanelUtils.d.ts +3 -2
  17. package/components/panel/filterPanel/filterPanelUtils.js +10 -5
  18. package/hooks/features/rowSelection/useGridRowSelection.js +9 -9
  19. package/hooks/features/rowSelection/utils.d.ts +2 -0
  20. package/hooks/features/rowSelection/utils.js +8 -0
  21. package/hooks/utils/useGridAriaAttributes.js +2 -1
  22. package/index.js +1 -1
  23. package/legacy/DataGrid/DataGrid.js +25 -19
  24. package/legacy/DataGrid/useDataGridProps.js +0 -1
  25. package/legacy/colDef/gridDateOperators.js +13 -13
  26. package/legacy/colDef/gridSingleSelectColDef.js +6 -15
  27. package/legacy/components/cell/GridEditSingleSelectCell.js +8 -28
  28. package/legacy/components/columnSelection/GridHeaderCheckbox.js +3 -1
  29. package/legacy/components/panel/filterPanel/GridFilterForm.js +51 -19
  30. package/legacy/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
  31. package/legacy/components/panel/filterPanel/GridFilterInputDate.js +27 -8
  32. package/legacy/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +6 -53
  33. package/legacy/components/panel/filterPanel/GridFilterInputSingleSelect.js +14 -59
  34. package/legacy/components/panel/filterPanel/filterPanelUtils.js +10 -6
  35. package/legacy/hooks/features/rowSelection/useGridRowSelection.js +9 -9
  36. package/legacy/hooks/features/rowSelection/utils.js +8 -0
  37. package/legacy/hooks/utils/useGridAriaAttributes.js +2 -1
  38. package/legacy/index.js +1 -1
  39. package/legacy/locales/svSE.js +31 -33
  40. package/legacy/locales/urPK.js +26 -28
  41. package/locales/svSE.js +31 -33
  42. package/locales/urPK.js +26 -28
  43. package/models/controlStateItem.d.ts +1 -4
  44. package/models/props/DataGridProps.d.ts +26 -25
  45. package/modern/DataGrid/DataGrid.js +25 -19
  46. package/modern/DataGrid/useDataGridProps.js +0 -1
  47. package/modern/colDef/gridDateOperators.js +13 -6
  48. package/modern/colDef/gridSingleSelectColDef.js +6 -15
  49. package/modern/components/cell/GridEditSingleSelectCell.js +9 -29
  50. package/modern/components/columnSelection/GridHeaderCheckbox.js +3 -1
  51. package/modern/components/panel/filterPanel/GridFilterForm.js +44 -9
  52. package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
  53. package/modern/components/panel/filterPanel/GridFilterInputDate.js +24 -6
  54. package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +7 -47
  55. package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +15 -56
  56. package/modern/components/panel/filterPanel/filterPanelUtils.js +10 -5
  57. package/modern/hooks/features/rowSelection/useGridRowSelection.js +9 -9
  58. package/modern/hooks/features/rowSelection/utils.js +8 -0
  59. package/modern/hooks/utils/useGridAriaAttributes.js +2 -1
  60. package/modern/index.js +1 -1
  61. package/modern/locales/svSE.js +31 -33
  62. package/modern/locales/urPK.js +26 -28
  63. package/node/DataGrid/DataGrid.js +25 -19
  64. package/node/DataGrid/useDataGridProps.js +0 -1
  65. package/node/colDef/gridDateOperators.js +13 -6
  66. package/node/colDef/gridSingleSelectColDef.js +5 -14
  67. package/node/components/cell/GridEditSingleSelectCell.js +8 -28
  68. package/node/components/columnSelection/GridHeaderCheckbox.js +3 -1
  69. package/node/components/panel/filterPanel/GridFilterForm.js +44 -9
  70. package/node/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
  71. package/node/components/panel/filterPanel/GridFilterInputDate.js +24 -6
  72. package/node/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +6 -46
  73. package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +14 -55
  74. package/node/components/panel/filterPanel/filterPanelUtils.js +12 -7
  75. package/node/hooks/features/rowSelection/useGridRowSelection.js +9 -9
  76. package/node/hooks/features/rowSelection/utils.js +14 -0
  77. package/node/hooks/utils/useGridAriaAttributes.js +2 -1
  78. package/node/index.js +1 -1
  79. package/node/locales/svSE.js +31 -33
  80. package/node/locales/urPK.js +26 -28
  81. package/package.json +3 -3
  82. package/utils/createSelector.d.ts +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,257 @@
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` [![pro](https://mui.com/r/x-pro-svg)](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` [![premium](https://mui.com/r/x-premium-svg)](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` [![pro](https://mui.com/r/x-pro-svg)](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
+
96
+ ## 7.0.0-alpha.5
97
+
98
+ _Dec 14, 2023_
99
+
100
+ We'd like to offer a big thanks to the 9 contributors who made this release possible. Here are some highlights ✨:
101
+
102
+ - 💫 New recipe added for the Data Grid
103
+ - 🌍 Improve Swedish (sv-SE) and Urdu (ur-PK) locales on the Data Grid
104
+ - 🐞 Bugfixes
105
+
106
+ ### Data Grid
107
+
108
+ #### Breaking changes
109
+
110
+ - The `instanceId` prop is now required for state selectors.
111
+ This prop is used to distinguish between multiple Data Grid instances on the same page.
112
+ See [migration docs](https://next.mui.com/x/migration/migration-data-grid-v6/#instanceid-prop-is-required-for-state-selectors) for more details.
113
+
114
+ #### `@mui/x-data-grid@7.0.0-alpha.5`
115
+
116
+ - [DataGrid] Make `instanceId` required for state selectors (#11395) @cherniavskii
117
+ - [DataGrid] Recipe for grouped rows autosizing (#11401) @michelengelen
118
+ - [l10n] Improve Swedish (sv-SE) locale (#11373) @fredrikcarlbom
119
+ - [l10n] Improve Urdu (ur-PK) locale (#11400) @MBilalShafi
120
+
121
+ #### `@mui/x-data-grid-pro@7.0.0-alpha.5` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
122
+
123
+ Same changes as in `@mui/x-data-grid@7.0.0-alpha.5`.
124
+
125
+ #### `@mui/x-data-grid-premium@7.0.0-alpha.5` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
126
+
127
+ Same changes as in `@mui/x-data-grid-pro@7.0.0-alpha.5`.
128
+
129
+ ### Date Pickers
130
+
131
+ #### Breaking changes
132
+
133
+ - The slot interfaces got renamed to match with `@mui/base` naming.
134
+ The `SlotsComponent` suffix has been replaced with `Slots` and `SlotsComponentsProps` with `SlotProps`.
135
+
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
+ ```
223
+
224
+ #### `@mui/x-date-pickers@7.0.0-alpha.5`
225
+
226
+ - [fields] Support empty sections (#10307) @flaviendelangle
227
+ - [pickers] Fix field types to avoid error on latest `@types/react` version (#11397) @LukasTy
228
+ - [pickers] Remove all relative imports to the internals index file (#11375) @flaviendelangle
229
+ - [pickers] Rename slots interfaces (#11339) @alexfauquette
230
+ - [pickers] Simplify the API of the field hooks (#11371) @flaviendelangle
231
+ - [pickers] Support name prop (#11025) @gitstart
232
+
233
+ #### `@mui/x-date-pickers-pro@7.0.0-alpha.5` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
234
+
235
+ Same changes as in `@mui/x-date-pickers@7.0.0-alpha.5`, plus:
236
+
237
+ - [DateRangePicker] Fix `autoFocus` behavior (#11273) @kealjones-wk
238
+
239
+ ### Charts / `@mui/x-charts@7.0.0-alpha.5`
240
+
241
+ - [charts] Fix size overflow (#11385) @alexfauquette
242
+
243
+ ### `@mui/x-codemod@7.0.0-alpha.5`
244
+
245
+ - [codemod] Add `cellSelection` codemod and update migration guide (#11353) @MBilalShafi
246
+
247
+ ### Docs
248
+
249
+ - [docs] Respect GoT books (@janoma) (#11387) @alexfauquette
250
+
251
+ ### Core
252
+
253
+ - [core] Automate cherry-pick of PRs from `next` -> `master` (#11382) @MBilalShafi
254
+ - [github] Update `no-response` workflow (#11369) @MBilalShafi
255
+ - [test] Fix flaky screenshots (#11388) @cherniavskii
256
+
6
257
  ## 7.0.0-alpha.4
7
258
 
8
259
  _Dec 8, 2023_
@@ -949,6 +1200,97 @@ Here is an example of the renaming for the `<ChartsTooltip />` component.
949
1200
  - [core] Update release instructions as per v7 configuration (#10962) @MBilalShafi
950
1201
  - [license] Correctly throw errors (#10924) @oliviertassinari
951
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` [![pro](https://mui.com/r/x-pro-svg)](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` [![premium](https://mui.com/r/x-premium-svg)](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` [![pro](https://mui.com/r/x-pro-svg)](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
+
1252
+ ## 6.18.5
1253
+
1254
+ _Dec 14, 2023_
1255
+
1256
+ We'd like to offer a big thanks to the 7 contributors who made this release possible. Here are some highlights ✨:
1257
+
1258
+ - 🌍 Improve Swedish (sv-SE) and Urdu (ur-PK) locales on the Data Grid
1259
+ - 🐞 Bugfixes
1260
+
1261
+ ### Data Grid
1262
+
1263
+ #### `@mui/x-data-grid@6.18.5`
1264
+
1265
+ - [l10n] Improve Swedish (sv-SE) locale (#11379) @fredrikcarlbom
1266
+ - [l10n] Improve Urdu (ur-PK) locale for data grid (#11409) @MBilalShafi
1267
+
1268
+ #### `@mui/x-data-grid-pro@6.18.5` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
1269
+
1270
+ Same changes as in `@mui/x-data-grid@6.18.5`.
1271
+
1272
+ #### `@mui/x-data-grid-premium@6.18.5` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
1273
+
1274
+ Same changes as in `@mui/x-data-grid-pro@6.18.5`.
1275
+
1276
+ ### Date Pickers
1277
+
1278
+ #### `@mui/x-date-pickers@6.18.5`
1279
+
1280
+ - [pickers] Fix field types to avoid error on latest `@types/react` version (#11398) @LukasTy
1281
+ - [pickers] Support name prop (#11380) @gitstart
1282
+
1283
+ #### `@mui/x-date-pickers-pro@6.18.5` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
1284
+
1285
+ Same changes as in `@mui/x-date-pickers@6.18.5`, plus:
1286
+
1287
+ - [DateRangePicker] Fix `autoFocus` behavior (#11376) @kealjones-wk
1288
+
1289
+ ### Docs
1290
+
1291
+ - [docs] Respect GoT books (#11294) @janoma
1292
+ - [test] Fix flaky screenshots (#11391) @cherniavskii
1293
+
952
1294
  ## 6.18.4
953
1295
 
954
1296
  _Dec 8, 2023_
@@ -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 grid manipulation. Can be instantiated with `useGridApiRef()`.
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 grid.
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 grid.
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 grid height is dynamic and follow the number of rows in the grid.
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 grid get a first column with a checkbox that allows to select rows.
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 grid.
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 grid.
113
- * If defined, the grid will ignore the `hide` property in [[GridColDef]].
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 grid.
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 grid.
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 grid root element.
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 grid will not use `valueFormatter` when exporting to CSV or copying to clipboard.
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 grid.
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 grid is resized.
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 grid is updated.
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 grid.
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 grid.
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 grid inner scrollbar.
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 grid.
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 [year, month, day, hour, minute] = filterItem.value.match(showTime ? dateTimeRegex : dateRegex).slice(1).map(Number);
9
- const time = new Date(year, month - 1, day, hour || 0, minute || 0).getTime();
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
- const timeToCompare = dateCopy.setHours(showTime ? value.getHours() : 0, showTime ? value.getMinutes() : 0, 0, 0);
21
- return compareFn(timeToCompare, time);
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
- let valueOptions;
32
- if (typeof colDef.valueOptions === 'function') {
33
- valueOptions = colDef.valueOptions({
34
- id,
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 colDefValueOptions = colDef.valueOptions;
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
- import { GridSingleSelectColDef } from '../../models/colDef/gridColDef';
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", "getOptionLabel", "getOptionValue"],
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
- let valueOptions;
57
- if (typeof (colDef == null ? void 0 : colDef.valueOptions) === 'function') {
58
- valueOptions = colDef == null ? void 0 : colDef.valueOptions({
59
- id,
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 = getOptionValueProp || colDef.getOptionValue;
70
- const getOptionLabel = getOptionLabelProp || colDef.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
  */