@mui/x-date-pickers 7.9.0 → 7.10.0

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 CHANGED
@@ -3,6 +3,80 @@
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.10.0
7
+
8
+ _Jul 11, 2024_
9
+
10
+ We'd like to offer a big thanks to the 12 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🎁 Add selectors to support showing child row count in footer in the Data Grid
13
+ - ✨ New APIs for retrieving current item tree and item's children IDs in the Tree View
14
+ - 🌍 Improve Spanish (es-ES) locale on the Data Grid
15
+ - 🐞 Bugfixes
16
+ - 📚 Documentation improvements
17
+
18
+ <!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
19
+
20
+ ### Data Grid
21
+
22
+ #### `@mui/x-data-grid@7.10.0`
23
+
24
+ - [DataGrid] Add selectors to support showing child row count in footer (#13725) @KenanYusuf
25
+ - [DataGrid] Fix incorrect panels position when using a toolbar (#13474) @oukunan
26
+ - [DataGrid] Set default variant to `'standard'` in `GridFilterInputMultipleValue` (#13129) @tarunrajput
27
+ - [DataGrid] Use `readonly` on more array props (#13331) @pcorpet
28
+ - [l10n] Improve Spanish (es-ES) locale (#13772) @joserealdev
29
+
30
+ #### `@mui/x-data-grid-pro@7.10.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
31
+
32
+ Same changes as in `@mui/x-data-grid@7.10.0`, plus:
33
+
34
+ - [DataGridPro] Keep bottom pinned row at the bottom (#13313) @romgrk
35
+
36
+ #### `@mui/x-data-grid-premium@7.10.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
37
+
38
+ Same changes as in `@mui/x-data-grid-pro@7.10.0`.
39
+
40
+ ### Date and Time Pickers
41
+
42
+ #### `@mui/x-date-pickers@7.10.0`
43
+
44
+ - [fields] Prevent infinite recursion when ensuring selection (#13779) @LukasTy
45
+ - [fields] Unify fields behavior regardless of the `readOnly` flag (#13688) @LukasTy
46
+
47
+ #### `@mui/x-date-pickers-pro@7.10.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
48
+
49
+ Same changes as in `@mui/x-date-pickers@7.10.0`, plus:
50
+
51
+ - [DateRangePicker] Fix `calendarHeader` slot props propagation (#13780) @LukasTy
52
+ - [DateTimeRangePicker] Resolve `format` from given `views` (#13743) @LukasTy
53
+
54
+ ### Charts
55
+
56
+ #### `@mui/x-charts@7.10.0`
57
+
58
+ - [charts] Fix displaying area of a `LineChart` when using the `log` scale (#13791) @alexfauquette
59
+ - [charts] Use correct click handler prop on pie chart `OnSeriesItemClick` documentation (#13761) @tonyhallett
60
+
61
+ ### Tree View
62
+
63
+ #### `@mui/x-tree-view@7.10.0`
64
+
65
+ - [TreeView] Add `getItemTree` and `getItemOrderedChildrenIds` methods to the public API (#13804) @flaviendelangle
66
+ - [TreeView] Add utility function to check if an optional plugin is present (#13788) @flaviendelangle
67
+
68
+ ### Docs
69
+
70
+ - [docs] Add missing default `loading` prop value (#13604) @oliviertassinari
71
+ - [docs] Add the `DateTimeRangePicker` to the "Commonly used components" demo (#13775) @flaviendelangle
72
+ - [docs] Fix Pickers customization playground overflow (#13742) @LukasTy
73
+ - [docs] Move Pickers dialog guidelines to accessibility page (#13778) @arthurbalduini
74
+
75
+ ### Core
76
+
77
+ - [core] Sort `DATA_GRID_PROPS_DEFAULT_VALUES` alphabetically (#13783) @oliviertassinari
78
+ - [test] Fix split infinitive use in tests @oliviertassinari
79
+
6
80
  ## 7.9.0
7
81
 
8
82
  _Jul 5, 2024_
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers v7.9.0
2
+ * @mui/x-date-pickers v7.10.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -36,6 +36,7 @@ export const addPositionPropertiesToSections = (sections, localizedDigits, isRtl
36
36
  export const useFieldV6TextField = params => {
37
37
  const isRtl = useRtl();
38
38
  const focusTimeoutRef = React.useRef();
39
+ const selectionSyncTimeoutRef = React.useRef();
39
40
  const {
40
41
  forwardedProps: {
41
42
  onFocus,
@@ -103,10 +104,14 @@ export const useFieldV6TextField = params => {
103
104
  inputRef.current.setSelectionRange(selectionStart, selectionEnd);
104
105
  }
105
106
  }
106
- setTimeout(() => {
107
+ clearTimeout(selectionSyncTimeoutRef.current);
108
+ selectionSyncTimeoutRef.current = setTimeout(() => {
107
109
  // handle case when the selection is not updated correctly
108
110
  // could happen on Android
109
- if (inputRef.current && inputRef.current === getActiveElement(document) && (inputRef.current.selectionStart !== selectionStart || inputRef.current.selectionEnd !== selectionEnd)) {
111
+ if (inputRef.current && inputRef.current === getActiveElement(document) &&
112
+ // The section might loose all selection, where `selectionStart === selectionEnd`
113
+ // https://github.com/mui/mui-x/pull/13652
114
+ inputRef.current.selectionStart === inputRef.current.selectionEnd && (inputRef.current.selectionStart !== selectionStart || inputRef.current.selectionEnd !== selectionEnd)) {
110
115
  interactions.syncSelectionToDOM();
111
116
  }
112
117
  });
@@ -118,8 +123,7 @@ export const useFieldV6TextField = params => {
118
123
  getActiveSectionIndexFromDOM: () => {
119
124
  const browserStartIndex = inputRef.current.selectionStart ?? 0;
120
125
  const browserEndIndex = inputRef.current.selectionEnd ?? 0;
121
- const isInputReadOnly = !!inputRef.current?.readOnly;
122
- if (browserStartIndex === 0 && browserEndIndex === 0 || isInputReadOnly) {
126
+ if (browserStartIndex === 0 && browserEndIndex === 0) {
123
127
  return null;
124
128
  }
125
129
  const nextSectionIndex = browserStartIndex <= sections[0].startInInput ? 1 // Special case if browser index is in invisible characters at the beginning.
@@ -134,10 +138,6 @@ export const useFieldV6TextField = params => {
134
138
  isFieldFocused: () => inputRef.current === getActiveElement(document)
135
139
  }), [inputRef, parsedSelectedSections, sections, setSelectedSections]);
136
140
  const syncSelectionFromDOM = () => {
137
- if (readOnly) {
138
- setSelectedSections(null);
139
- return;
140
- }
141
141
  const browserStartIndex = inputRef.current.selectionStart ?? 0;
142
142
  let nextSectionIndex;
143
143
  if (browserStartIndex <= sections[0].startInInput) {
@@ -162,7 +162,7 @@ export const useFieldV6TextField = params => {
162
162
  if (!input || input !== inputRef.current) {
163
163
  return;
164
164
  }
165
- if (activeSectionIndex != null || readOnly) {
165
+ if (activeSectionIndex != null) {
166
166
  return;
167
167
  }
168
168
  if (
@@ -296,6 +296,7 @@ export const useFieldV6TextField = params => {
296
296
  }
297
297
  return () => {
298
298
  clearTimeout(focusTimeoutRef.current);
299
+ clearTimeout(selectionSyncTimeoutRef.current);
299
300
  };
300
301
  }, []); // eslint-disable-line react-hooks/exhaustive-deps
301
302
 
@@ -221,7 +221,7 @@ export const useFieldV7TextField = params => {
221
221
  const getInputContainerClickHandler = useEventCallback(sectionIndex => event => {
222
222
  // The click event on the clear button would propagate to the input, trigger this handler and result in a wrong section selection.
223
223
  // We avoid this by checking if the call to this function is actually intended, or a side effect.
224
- if (event.isDefaultPrevented() || readOnly) {
224
+ if (event.isDefaultPrevented()) {
225
225
  return;
226
226
  }
227
227
  setSelectedSections(sectionIndex);
@@ -231,9 +231,6 @@ export const useFieldV7TextField = params => {
231
231
  event.preventDefault();
232
232
  });
233
233
  const getInputContentFocusHandler = useEventCallback(sectionIndex => () => {
234
- if (readOnly) {
235
- return;
236
- }
237
234
  setSelectedSections(sectionIndex);
238
235
  });
239
236
  const handleInputContentPaste = useEventCallback(event => {
@@ -48,7 +48,7 @@ export type { WrapperVariant, TimeViewWithMeridiem, DateOrTimeViewWithMeridiem,
48
48
  export type { BaseDateValidationProps, BaseTimeValidationProps, TimeValidationProps, MonthValidationProps, YearValidationProps, DayValidationProps, DateTimeValidationProps, } from './models/validation';
49
49
  export { convertFieldResponseIntoMuiTextFieldProps } from './utils/convertFieldResponseIntoMuiTextFieldProps';
50
50
  export { applyDefaultDate, replaceInvalidDateByNull, areDatesEqual, getTodayDate, isDatePickerView, mergeDateAndTime, formatMeridiem, } from './utils/date-utils';
51
- export { resolveTimeViewsResponse } from './utils/date-time-utils';
51
+ export { resolveTimeViewsResponse, resolveDateTimeFormat } from './utils/date-time-utils';
52
52
  export { splitFieldInternalAndForwardedProps } from './utils/fields';
53
53
  export { getDefaultReferenceDate } from './utils/getDefaultReferenceDate';
54
54
  export { executeInTheNextEventLoopTick, getActiveElement, onSpaceOrEnter, DEFAULT_DESKTOP_MODE_MEDIA_QUERY, } from './utils/utils';
@@ -19,7 +19,7 @@ export { useValidation } from './hooks/useValidation';
19
19
  export { usePreviousMonthDisabled, useNextMonthDisabled } from './hooks/date-helpers-hooks';
20
20
  export { convertFieldResponseIntoMuiTextFieldProps } from './utils/convertFieldResponseIntoMuiTextFieldProps';
21
21
  export { applyDefaultDate, replaceInvalidDateByNull, areDatesEqual, getTodayDate, isDatePickerView, mergeDateAndTime, formatMeridiem } from './utils/date-utils';
22
- export { resolveTimeViewsResponse } from './utils/date-time-utils';
22
+ export { resolveTimeViewsResponse, resolveDateTimeFormat } from './utils/date-time-utils';
23
23
  export { splitFieldInternalAndForwardedProps } from './utils/fields';
24
24
  export { getDefaultReferenceDate } from './utils/getDefaultReferenceDate';
25
25
  export { executeInTheNextEventLoopTick, getActiveElement, onSpaceOrEnter, DEFAULT_DESKTOP_MODE_MEDIA_QUERY } from './utils/utils';
@@ -4,7 +4,7 @@ import { DesktopOnlyTimePickerProps } from '../models/props/clock';
4
4
  import { DefaultizedProps } from '../models/helpers';
5
5
  export declare const resolveDateTimeFormat: <TDate extends PickerValidDate>(utils: MuiPickersAdapter<TDate>, { views, format, ...other }: {
6
6
  format?: string;
7
- views: readonly DateOrTimeView[];
7
+ views: readonly DateOrTimeViewWithMeridiem[];
8
8
  ampm: boolean;
9
9
  }) => string;
10
10
  interface DefaultizedTimeViewsProps<TDate extends PickerValidDate, TView = DateOrTimeView> extends DefaultizedProps<DesktopOnlyTimePickerProps<TDate>, 'ampm'> {
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers v7.9.0
2
+ * @mui/x-date-pickers v7.10.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -36,6 +36,7 @@ export const addPositionPropertiesToSections = (sections, localizedDigits, isRtl
36
36
  export const useFieldV6TextField = params => {
37
37
  const isRtl = useRtl();
38
38
  const focusTimeoutRef = React.useRef();
39
+ const selectionSyncTimeoutRef = React.useRef();
39
40
  const {
40
41
  forwardedProps: {
41
42
  onFocus,
@@ -103,10 +104,14 @@ export const useFieldV6TextField = params => {
103
104
  inputRef.current.setSelectionRange(selectionStart, selectionEnd);
104
105
  }
105
106
  }
106
- setTimeout(() => {
107
+ clearTimeout(selectionSyncTimeoutRef.current);
108
+ selectionSyncTimeoutRef.current = setTimeout(() => {
107
109
  // handle case when the selection is not updated correctly
108
110
  // could happen on Android
109
- if (inputRef.current && inputRef.current === getActiveElement(document) && (inputRef.current.selectionStart !== selectionStart || inputRef.current.selectionEnd !== selectionEnd)) {
111
+ if (inputRef.current && inputRef.current === getActiveElement(document) &&
112
+ // The section might loose all selection, where `selectionStart === selectionEnd`
113
+ // https://github.com/mui/mui-x/pull/13652
114
+ inputRef.current.selectionStart === inputRef.current.selectionEnd && (inputRef.current.selectionStart !== selectionStart || inputRef.current.selectionEnd !== selectionEnd)) {
110
115
  interactions.syncSelectionToDOM();
111
116
  }
112
117
  });
@@ -118,8 +123,7 @@ export const useFieldV6TextField = params => {
118
123
  getActiveSectionIndexFromDOM: () => {
119
124
  const browserStartIndex = inputRef.current.selectionStart ?? 0;
120
125
  const browserEndIndex = inputRef.current.selectionEnd ?? 0;
121
- const isInputReadOnly = !!inputRef.current?.readOnly;
122
- if (browserStartIndex === 0 && browserEndIndex === 0 || isInputReadOnly) {
126
+ if (browserStartIndex === 0 && browserEndIndex === 0) {
123
127
  return null;
124
128
  }
125
129
  const nextSectionIndex = browserStartIndex <= sections[0].startInInput ? 1 // Special case if browser index is in invisible characters at the beginning.
@@ -134,10 +138,6 @@ export const useFieldV6TextField = params => {
134
138
  isFieldFocused: () => inputRef.current === getActiveElement(document)
135
139
  }), [inputRef, parsedSelectedSections, sections, setSelectedSections]);
136
140
  const syncSelectionFromDOM = () => {
137
- if (readOnly) {
138
- setSelectedSections(null);
139
- return;
140
- }
141
141
  const browserStartIndex = inputRef.current.selectionStart ?? 0;
142
142
  let nextSectionIndex;
143
143
  if (browserStartIndex <= sections[0].startInInput) {
@@ -162,7 +162,7 @@ export const useFieldV6TextField = params => {
162
162
  if (!input || input !== inputRef.current) {
163
163
  return;
164
164
  }
165
- if (activeSectionIndex != null || readOnly) {
165
+ if (activeSectionIndex != null) {
166
166
  return;
167
167
  }
168
168
  if (
@@ -296,6 +296,7 @@ export const useFieldV6TextField = params => {
296
296
  }
297
297
  return () => {
298
298
  clearTimeout(focusTimeoutRef.current);
299
+ clearTimeout(selectionSyncTimeoutRef.current);
299
300
  };
300
301
  }, []); // eslint-disable-line react-hooks/exhaustive-deps
301
302
 
@@ -221,7 +221,7 @@ export const useFieldV7TextField = params => {
221
221
  const getInputContainerClickHandler = useEventCallback(sectionIndex => event => {
222
222
  // The click event on the clear button would propagate to the input, trigger this handler and result in a wrong section selection.
223
223
  // We avoid this by checking if the call to this function is actually intended, or a side effect.
224
- if (event.isDefaultPrevented() || readOnly) {
224
+ if (event.isDefaultPrevented()) {
225
225
  return;
226
226
  }
227
227
  setSelectedSections(sectionIndex);
@@ -231,9 +231,6 @@ export const useFieldV7TextField = params => {
231
231
  event.preventDefault();
232
232
  });
233
233
  const getInputContentFocusHandler = useEventCallback(sectionIndex => () => {
234
- if (readOnly) {
235
- return;
236
- }
237
234
  setSelectedSections(sectionIndex);
238
235
  });
239
236
  const handleInputContentPaste = useEventCallback(event => {
@@ -19,7 +19,7 @@ export { useValidation } from './hooks/useValidation';
19
19
  export { usePreviousMonthDisabled, useNextMonthDisabled } from './hooks/date-helpers-hooks';
20
20
  export { convertFieldResponseIntoMuiTextFieldProps } from './utils/convertFieldResponseIntoMuiTextFieldProps';
21
21
  export { applyDefaultDate, replaceInvalidDateByNull, areDatesEqual, getTodayDate, isDatePickerView, mergeDateAndTime, formatMeridiem } from './utils/date-utils';
22
- export { resolveTimeViewsResponse } from './utils/date-time-utils';
22
+ export { resolveTimeViewsResponse, resolveDateTimeFormat } from './utils/date-time-utils';
23
23
  export { splitFieldInternalAndForwardedProps } from './utils/fields';
24
24
  export { getDefaultReferenceDate } from './utils/getDefaultReferenceDate';
25
25
  export { executeInTheNextEventLoopTick, getActiveElement, onSpaceOrEnter, DEFAULT_DESKTOP_MODE_MEDIA_QUERY } from './utils/utils';
package/node/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers v7.9.0
2
+ * @mui/x-date-pickers v7.10.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -46,6 +46,7 @@ exports.addPositionPropertiesToSections = addPositionPropertiesToSections;
46
46
  const useFieldV6TextField = params => {
47
47
  const isRtl = (0, _RtlProvider.useRtl)();
48
48
  const focusTimeoutRef = React.useRef();
49
+ const selectionSyncTimeoutRef = React.useRef();
49
50
  const {
50
51
  forwardedProps: {
51
52
  onFocus,
@@ -113,10 +114,14 @@ const useFieldV6TextField = params => {
113
114
  inputRef.current.setSelectionRange(selectionStart, selectionEnd);
114
115
  }
115
116
  }
116
- setTimeout(() => {
117
+ clearTimeout(selectionSyncTimeoutRef.current);
118
+ selectionSyncTimeoutRef.current = setTimeout(() => {
117
119
  // handle case when the selection is not updated correctly
118
120
  // could happen on Android
119
- if (inputRef.current && inputRef.current === (0, _utils.getActiveElement)(document) && (inputRef.current.selectionStart !== selectionStart || inputRef.current.selectionEnd !== selectionEnd)) {
121
+ if (inputRef.current && inputRef.current === (0, _utils.getActiveElement)(document) &&
122
+ // The section might loose all selection, where `selectionStart === selectionEnd`
123
+ // https://github.com/mui/mui-x/pull/13652
124
+ inputRef.current.selectionStart === inputRef.current.selectionEnd && (inputRef.current.selectionStart !== selectionStart || inputRef.current.selectionEnd !== selectionEnd)) {
120
125
  interactions.syncSelectionToDOM();
121
126
  }
122
127
  });
@@ -128,8 +133,7 @@ const useFieldV6TextField = params => {
128
133
  getActiveSectionIndexFromDOM: () => {
129
134
  const browserStartIndex = inputRef.current.selectionStart ?? 0;
130
135
  const browserEndIndex = inputRef.current.selectionEnd ?? 0;
131
- const isInputReadOnly = !!inputRef.current?.readOnly;
132
- if (browserStartIndex === 0 && browserEndIndex === 0 || isInputReadOnly) {
136
+ if (browserStartIndex === 0 && browserEndIndex === 0) {
133
137
  return null;
134
138
  }
135
139
  const nextSectionIndex = browserStartIndex <= sections[0].startInInput ? 1 // Special case if browser index is in invisible characters at the beginning.
@@ -144,10 +148,6 @@ const useFieldV6TextField = params => {
144
148
  isFieldFocused: () => inputRef.current === (0, _utils.getActiveElement)(document)
145
149
  }), [inputRef, parsedSelectedSections, sections, setSelectedSections]);
146
150
  const syncSelectionFromDOM = () => {
147
- if (readOnly) {
148
- setSelectedSections(null);
149
- return;
150
- }
151
151
  const browserStartIndex = inputRef.current.selectionStart ?? 0;
152
152
  let nextSectionIndex;
153
153
  if (browserStartIndex <= sections[0].startInInput) {
@@ -172,7 +172,7 @@ const useFieldV6TextField = params => {
172
172
  if (!input || input !== inputRef.current) {
173
173
  return;
174
174
  }
175
- if (activeSectionIndex != null || readOnly) {
175
+ if (activeSectionIndex != null) {
176
176
  return;
177
177
  }
178
178
  if (
@@ -306,6 +306,7 @@ const useFieldV6TextField = params => {
306
306
  }
307
307
  return () => {
308
308
  clearTimeout(focusTimeoutRef.current);
309
+ clearTimeout(selectionSyncTimeoutRef.current);
309
310
  };
310
311
  }, []); // eslint-disable-line react-hooks/exhaustive-deps
311
312
 
@@ -230,7 +230,7 @@ const useFieldV7TextField = params => {
230
230
  const getInputContainerClickHandler = (0, _useEventCallback.default)(sectionIndex => event => {
231
231
  // The click event on the clear button would propagate to the input, trigger this handler and result in a wrong section selection.
232
232
  // We avoid this by checking if the call to this function is actually intended, or a side effect.
233
- if (event.isDefaultPrevented() || readOnly) {
233
+ if (event.isDefaultPrevented()) {
234
234
  return;
235
235
  }
236
236
  setSelectedSections(sectionIndex);
@@ -240,9 +240,6 @@ const useFieldV7TextField = params => {
240
240
  event.preventDefault();
241
241
  });
242
242
  const getInputContentFocusHandler = (0, _useEventCallback.default)(sectionIndex => () => {
243
- if (readOnly) {
244
- return;
245
- }
246
243
  setSelectedSections(sectionIndex);
247
244
  });
248
245
  const handleInputContentPaste = (0, _useEventCallback.default)(event => {
@@ -213,6 +213,12 @@ Object.defineProperty(exports, "replaceInvalidDateByNull", {
213
213
  return _dateUtils.replaceInvalidDateByNull;
214
214
  }
215
215
  });
216
+ Object.defineProperty(exports, "resolveDateTimeFormat", {
217
+ enumerable: true,
218
+ get: function () {
219
+ return _dateTimeUtils.resolveDateTimeFormat;
220
+ }
221
+ });
216
222
  Object.defineProperty(exports, "resolveTimeViewsResponse", {
217
223
  enumerable: true,
218
224
  get: function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-date-pickers",
3
- "version": "7.9.0",
3
+ "version": "7.10.0",
4
4
  "description": "The community edition of the Date and Time Picker components (MUI X).",
5
5
  "author": "MUI Team",
6
6
  "main": "./node/index.js",