@mui/x-date-pickers 5.0.0 → 5.0.1
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 +60 -0
- package/CalendarPicker/DayPicker.js +28 -6
- package/DatePicker/DatePicker.js +3 -0
- package/DatePicker/shared.d.ts +3 -0
- package/DateTimePicker/DateTimePicker.js +3 -0
- package/DateTimePicker/shared.d.ts +3 -0
- package/DesktopDatePicker/DesktopDatePicker.js +3 -0
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +4 -1
- package/DesktopTimePicker/DesktopTimePicker.js +3 -0
- package/MobileDatePicker/MobileDatePicker.js +3 -0
- package/MobileDateTimePicker/MobileDateTimePicker.js +4 -1
- package/MobileTimePicker/MobileTimePicker.js +3 -0
- package/PickersDay/PickersDay.js +1 -1
- package/StaticDatePicker/StaticDatePicker.js +3 -0
- package/StaticDateTimePicker/StaticDateTimePicker.js +4 -1
- package/StaticTimePicker/StaticTimePicker.js +3 -0
- package/TimePicker/TimePicker.js +3 -0
- package/TimePicker/shared.d.ts +3 -0
- package/index.js +1 -1
- package/internals/components/CalendarOrClockPicker/CalendarOrClockPicker.js +9 -0
- package/internals/components/PureDateInput.js +10 -2
- package/legacy/CalendarPicker/DayPicker.js +31 -6
- package/legacy/DatePicker/DatePicker.js +3 -0
- package/legacy/DateTimePicker/DateTimePicker.js +3 -0
- package/legacy/DesktopDatePicker/DesktopDatePicker.js +3 -0
- package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +4 -1
- package/legacy/DesktopTimePicker/DesktopTimePicker.js +3 -0
- package/legacy/MobileDatePicker/MobileDatePicker.js +3 -0
- package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +4 -1
- package/legacy/MobileTimePicker/MobileTimePicker.js +3 -0
- package/legacy/PickersDay/PickersDay.js +1 -1
- package/legacy/StaticDatePicker/StaticDatePicker.js +3 -0
- package/legacy/StaticDateTimePicker/StaticDateTimePicker.js +4 -1
- package/legacy/StaticTimePicker/StaticTimePicker.js +3 -0
- package/legacy/TimePicker/TimePicker.js +3 -0
- package/legacy/index.js +1 -1
- package/legacy/internals/components/CalendarOrClockPicker/CalendarOrClockPicker.js +8 -0
- package/legacy/internals/components/PureDateInput.js +10 -2
- package/modern/CalendarPicker/DayPicker.js +28 -6
- package/modern/DatePicker/DatePicker.js +3 -0
- package/modern/DateTimePicker/DateTimePicker.js +3 -0
- package/modern/DesktopDatePicker/DesktopDatePicker.js +3 -0
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +4 -1
- package/modern/DesktopTimePicker/DesktopTimePicker.js +3 -0
- package/modern/MobileDatePicker/MobileDatePicker.js +3 -0
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +4 -1
- package/modern/MobileTimePicker/MobileTimePicker.js +3 -0
- package/modern/PickersDay/PickersDay.js +1 -1
- package/modern/StaticDatePicker/StaticDatePicker.js +3 -0
- package/modern/StaticDateTimePicker/StaticDateTimePicker.js +4 -1
- package/modern/StaticTimePicker/StaticTimePicker.js +3 -0
- package/modern/TimePicker/TimePicker.js +3 -0
- package/modern/index.js +1 -1
- package/modern/internals/components/CalendarOrClockPicker/CalendarOrClockPicker.js +9 -0
- package/modern/internals/components/PureDateInput.js +10 -2
- package/node/CalendarPicker/DayPicker.js +28 -6
- package/node/DatePicker/DatePicker.js +3 -0
- package/node/DateTimePicker/DateTimePicker.js +3 -0
- package/node/DesktopDatePicker/DesktopDatePicker.js +3 -0
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +5 -2
- package/node/DesktopTimePicker/DesktopTimePicker.js +3 -0
- package/node/MobileDatePicker/MobileDatePicker.js +3 -0
- package/node/MobileDateTimePicker/MobileDateTimePicker.js +5 -2
- package/node/MobileTimePicker/MobileTimePicker.js +3 -0
- package/node/PickersDay/PickersDay.js +1 -1
- package/node/StaticDatePicker/StaticDatePicker.js +3 -0
- package/node/StaticDateTimePicker/StaticDateTimePicker.js +5 -2
- package/node/StaticTimePicker/StaticTimePicker.js +3 -0
- package/node/TimePicker/TimePicker.js +3 -0
- package/node/index.js +1 -1
- package/node/internals/components/CalendarOrClockPicker/CalendarOrClockPicker.js +10 -0
- package/node/internals/components/PureDateInput.js +13 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,66 @@
|
|
|
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
|
+
## 5.17.2
|
|
7
|
+
|
|
8
|
+
_Sep 9, 2022_
|
|
9
|
+
|
|
10
|
+
This release will the last regular release for our `v5` packages.
|
|
11
|
+
From now on, we'll be focusing on developing MUI X v6.
|
|
12
|
+
You can check the [roadmap](https://github.com/mui/mui-x/projects/1) for more details on what's coming next.
|
|
13
|
+
|
|
14
|
+
And if you'd like to help, please consider volunteering to give us a [user interview](https://docs.google.com/forms/d/11L_zxL7oD_B-ZrZDuSyIkUzJLzOTUU2M4vHXxMVtWhU/edit).
|
|
15
|
+
We'd love to know more about your use cases, pain points and expectations for the future.
|
|
16
|
+
|
|
17
|
+
The `v5` packages will only get new versions to patch critical bug fixes.
|
|
18
|
+
|
|
19
|
+
We'd like to offer a big thanks to the 6 contributors who made this release possible. Here are some highlights ✨:
|
|
20
|
+
|
|
21
|
+
- 📃 Add support for column grouping when exporting to Excel (#5895) @alexfauquette
|
|
22
|
+
- 🐞 Bugfixes
|
|
23
|
+
|
|
24
|
+
### `@mui/x-data-grid@v5.17.2` / `@mui/x-data-grid-pro@v5.17.2` / `@mui/x-data-grid-premium@v5.17.2`
|
|
25
|
+
|
|
26
|
+
#### Changes
|
|
27
|
+
|
|
28
|
+
- [DataGrid] Revert mode if cell/row couldn't be saved due to validation error (#5897) @m4theushw
|
|
29
|
+
- [DataGridPremium] Export column grouping in Excel (#5895) @alexfauquette
|
|
30
|
+
|
|
31
|
+
### `@mui/x-date-pickers@v5.0.1` / `@mui/x-date-pickers-pro@v5.0.1`
|
|
32
|
+
|
|
33
|
+
#### Changes
|
|
34
|
+
|
|
35
|
+
- [DateTimePicker] Remove circular import (#6087) @flaviendelangle
|
|
36
|
+
- [pickers] Add `sx` prop to the equality check of `PickersDay` (#6030) @TheUnlocked
|
|
37
|
+
- [pickers] Add warning when `openTo` is invalid based on available `views` (#6042) @LukasTy
|
|
38
|
+
- [pickers] Allow keyboard navigation to ignore disabled date for left / right arrow (#6082) @alexfauquette
|
|
39
|
+
- [pickers] Fix mobile picker not opening on label click (#6074) @LukasTy
|
|
40
|
+
|
|
41
|
+
### Docs
|
|
42
|
+
|
|
43
|
+
- [docs] Add Recipes section
|
|
44
|
+
|
|
45
|
+
### Core
|
|
46
|
+
|
|
47
|
+
- [core] Add `yarn release:tag` script (#5169) @DanailH
|
|
48
|
+
- [core] Upgrade monorepo (#6072) @m4theushw
|
|
49
|
+
|
|
50
|
+
## 5.17.1
|
|
51
|
+
|
|
52
|
+
_Sep 5, 2022_
|
|
53
|
+
|
|
54
|
+
We'd like to offer a big thanks to the 3 contributors who made this release possible. Here are some highlights ✨:
|
|
55
|
+
|
|
56
|
+
- 🐞 Bugfixes
|
|
57
|
+
|
|
58
|
+
### `@mui/x-data-grid@v5.17.1` / `@mui/x-data-grid-pro@v5.17.1` / `@mui/x-data-grid-premium@v5.17.1`
|
|
59
|
+
|
|
60
|
+
#### Changes
|
|
61
|
+
|
|
62
|
+
- [DataGrid] Fix cells being focused on mouseUp (#5980) @cherniavskii
|
|
63
|
+
- [DataGrid] Fix focused cell if column is spanned and new editing API is used (#5962) @m4theushw
|
|
64
|
+
- [DataGridPro] Fix import in lazy-loading causing a bundling error (#6031) @flaviendelangle
|
|
65
|
+
|
|
6
66
|
## 5.17.0
|
|
7
67
|
|
|
8
68
|
_Sep 2, 2022_
|
|
@@ -128,14 +128,36 @@ export function DayPicker(props) {
|
|
|
128
128
|
break;
|
|
129
129
|
|
|
130
130
|
case 'ArrowLeft':
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
131
|
+
{
|
|
132
|
+
const newFocusedDayDefault = utils.addDays(day, theme.direction === 'ltr' ? -1 : 1);
|
|
133
|
+
const nextAvailableMonth = theme.direction === 'ltr' ? utils.getPreviousMonth(day) : utils.getNextMonth(day);
|
|
134
|
+
const closestDayToFocus = findClosestEnabledDate({
|
|
135
|
+
utils,
|
|
136
|
+
date: newFocusedDayDefault,
|
|
137
|
+
minDate: theme.direction === 'ltr' ? utils.startOfMonth(nextAvailableMonth) : newFocusedDayDefault,
|
|
138
|
+
maxDate: theme.direction === 'ltr' ? newFocusedDayDefault : utils.endOfMonth(nextAvailableMonth),
|
|
139
|
+
isDateDisabled
|
|
140
|
+
});
|
|
141
|
+
focusDay(closestDayToFocus || newFocusedDayDefault);
|
|
142
|
+
event.preventDefault();
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
134
145
|
|
|
135
146
|
case 'ArrowRight':
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
147
|
+
{
|
|
148
|
+
const newFocusedDayDefault = utils.addDays(day, theme.direction === 'ltr' ? 1 : -1);
|
|
149
|
+
const nextAvailableMonth = theme.direction === 'ltr' ? utils.getNextMonth(day) : utils.getPreviousMonth(day);
|
|
150
|
+
const closestDayToFocus = findClosestEnabledDate({
|
|
151
|
+
utils,
|
|
152
|
+
date: newFocusedDayDefault,
|
|
153
|
+
minDate: theme.direction === 'ltr' ? newFocusedDayDefault : utils.startOfMonth(nextAvailableMonth),
|
|
154
|
+
maxDate: theme.direction === 'ltr' ? utils.endOfMonth(nextAvailableMonth) : newFocusedDayDefault,
|
|
155
|
+
isDateDisabled
|
|
156
|
+
});
|
|
157
|
+
focusDay(closestDayToFocus || newFocusedDayDefault);
|
|
158
|
+
event.preventDefault();
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
139
161
|
|
|
140
162
|
case 'Home':
|
|
141
163
|
focusDay(utils.startOfWeek(day));
|
package/DatePicker/DatePicker.js
CHANGED
|
@@ -290,6 +290,8 @@ process.env.NODE_ENV !== "production" ? DatePicker.propTypes = {
|
|
|
290
290
|
|
|
291
291
|
/**
|
|
292
292
|
* First view to show.
|
|
293
|
+
* Must be a valid option from `views` list
|
|
294
|
+
* @default 'day'
|
|
293
295
|
*/
|
|
294
296
|
openTo: PropTypes.oneOf(['day', 'month', 'year']),
|
|
295
297
|
|
|
@@ -434,6 +436,7 @@ process.env.NODE_ENV !== "production" ? DatePicker.propTypes = {
|
|
|
434
436
|
|
|
435
437
|
/**
|
|
436
438
|
* Array of views to show.
|
|
439
|
+
* @default ['year', 'day']
|
|
437
440
|
*/
|
|
438
441
|
views: PropTypes.arrayOf(PropTypes.oneOf(['day', 'month', 'year']).isRequired)
|
|
439
442
|
} : void 0;
|
package/DatePicker/shared.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ export interface BaseDatePickerProps<TInputDate, TDate> extends ExportedCalendar
|
|
|
17
17
|
onViewChange?: (view: CalendarPickerView) => void;
|
|
18
18
|
/**
|
|
19
19
|
* First view to show.
|
|
20
|
+
* Must be a valid option from `views` list
|
|
21
|
+
* @default 'day'
|
|
20
22
|
*/
|
|
21
23
|
openTo?: CalendarPickerView;
|
|
22
24
|
/**
|
|
@@ -40,6 +42,7 @@ export interface BaseDatePickerProps<TInputDate, TDate> extends ExportedCalendar
|
|
|
40
42
|
toolbarTitle?: React.ReactNode;
|
|
41
43
|
/**
|
|
42
44
|
* Array of views to show.
|
|
45
|
+
* @default ['year', 'day']
|
|
43
46
|
*/
|
|
44
47
|
views?: readonly CalendarPickerView[];
|
|
45
48
|
}
|
|
@@ -366,6 +366,8 @@ process.env.NODE_ENV !== "production" ? DateTimePicker.propTypes = {
|
|
|
366
366
|
|
|
367
367
|
/**
|
|
368
368
|
* First view to show.
|
|
369
|
+
* Must be a valid option from `views` list
|
|
370
|
+
* @default 'day'
|
|
369
371
|
*/
|
|
370
372
|
openTo: PropTypes.oneOf(['day', 'hours', 'minutes', 'month', 'seconds', 'year']),
|
|
371
373
|
|
|
@@ -524,6 +526,7 @@ process.env.NODE_ENV !== "production" ? DateTimePicker.propTypes = {
|
|
|
524
526
|
|
|
525
527
|
/**
|
|
526
528
|
* Array of views to show.
|
|
529
|
+
* @default ['year', 'day', 'hours', 'minutes']
|
|
527
530
|
*/
|
|
528
531
|
views: PropTypes.arrayOf(PropTypes.oneOf(['day', 'hours', 'minutes', 'month', 'seconds', 'year']).isRequired)
|
|
529
532
|
} : void 0;
|
|
@@ -44,6 +44,8 @@ export interface BaseDateTimePickerProps<TInputDate, TDate> extends ExportedCloc
|
|
|
44
44
|
onViewChange?: (view: CalendarOrClockPickerView) => void;
|
|
45
45
|
/**
|
|
46
46
|
* First view to show.
|
|
47
|
+
* Must be a valid option from `views` list
|
|
48
|
+
* @default 'day'
|
|
47
49
|
*/
|
|
48
50
|
openTo?: CalendarOrClockPickerView;
|
|
49
51
|
/**
|
|
@@ -67,6 +69,7 @@ export interface BaseDateTimePickerProps<TInputDate, TDate> extends ExportedCloc
|
|
|
67
69
|
toolbarPlaceholder?: React.ReactNode;
|
|
68
70
|
/**
|
|
69
71
|
* Array of views to show.
|
|
72
|
+
* @default ['year', 'day', 'hours', 'minutes']
|
|
70
73
|
*/
|
|
71
74
|
views?: readonly CalendarOrClockPickerView[];
|
|
72
75
|
}
|
|
@@ -292,6 +292,8 @@ process.env.NODE_ENV !== "production" ? DesktopDatePicker.propTypes = {
|
|
|
292
292
|
|
|
293
293
|
/**
|
|
294
294
|
* First view to show.
|
|
295
|
+
* Must be a valid option from `views` list
|
|
296
|
+
* @default 'day'
|
|
295
297
|
*/
|
|
296
298
|
openTo: PropTypes.oneOf(['day', 'month', 'year']),
|
|
297
299
|
|
|
@@ -436,6 +438,7 @@ process.env.NODE_ENV !== "production" ? DesktopDatePicker.propTypes = {
|
|
|
436
438
|
|
|
437
439
|
/**
|
|
438
440
|
* Array of views to show.
|
|
441
|
+
* @default ['year', 'day']
|
|
439
442
|
*/
|
|
440
443
|
views: PropTypes.arrayOf(PropTypes.oneOf(['day', 'month', 'year']).isRequired)
|
|
441
444
|
} : void 0;
|
|
@@ -10,7 +10,7 @@ import { CalendarOrClockPicker } from '../internals/components/CalendarOrClockPi
|
|
|
10
10
|
import { useDateTimeValidation } from '../internals/hooks/validation/useDateTimeValidation';
|
|
11
11
|
import { KeyboardDateInput } from '../internals/components/KeyboardDateInput';
|
|
12
12
|
import { usePickerState } from '../internals/hooks/usePickerState';
|
|
13
|
-
import { DateTimePickerTabs } from '../DateTimePicker';
|
|
13
|
+
import { DateTimePickerTabs } from '../DateTimePicker/DateTimePickerTabs';
|
|
14
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -375,6 +375,8 @@ process.env.NODE_ENV !== "production" ? DesktopDateTimePicker.propTypes = {
|
|
|
375
375
|
|
|
376
376
|
/**
|
|
377
377
|
* First view to show.
|
|
378
|
+
* Must be a valid option from `views` list
|
|
379
|
+
* @default 'day'
|
|
378
380
|
*/
|
|
379
381
|
openTo: PropTypes.oneOf(['day', 'hours', 'minutes', 'month', 'seconds', 'year']),
|
|
380
382
|
|
|
@@ -533,6 +535,7 @@ process.env.NODE_ENV !== "production" ? DesktopDateTimePicker.propTypes = {
|
|
|
533
535
|
|
|
534
536
|
/**
|
|
535
537
|
* Array of views to show.
|
|
538
|
+
* @default ['year', 'day', 'hours', 'minutes']
|
|
536
539
|
*/
|
|
537
540
|
views: PropTypes.arrayOf(PropTypes.oneOf(['day', 'hours', 'minutes', 'month', 'seconds', 'year']).isRequired)
|
|
538
541
|
} : void 0;
|
|
@@ -269,6 +269,8 @@ process.env.NODE_ENV !== "production" ? DesktopTimePicker.propTypes = {
|
|
|
269
269
|
|
|
270
270
|
/**
|
|
271
271
|
* First view to show.
|
|
272
|
+
* Must be a valid option from `views` list
|
|
273
|
+
* @default 'hours'
|
|
272
274
|
*/
|
|
273
275
|
openTo: PropTypes.oneOf(['hours', 'minutes', 'seconds']),
|
|
274
276
|
|
|
@@ -350,6 +352,7 @@ process.env.NODE_ENV !== "production" ? DesktopTimePicker.propTypes = {
|
|
|
350
352
|
|
|
351
353
|
/**
|
|
352
354
|
* Array of views to show.
|
|
355
|
+
* @default ['hours', 'minutes']
|
|
353
356
|
*/
|
|
354
357
|
views: PropTypes.arrayOf(PropTypes.oneOf(['hours', 'minutes', 'seconds']).isRequired)
|
|
355
358
|
} : void 0;
|
|
@@ -292,6 +292,8 @@ process.env.NODE_ENV !== "production" ? MobileDatePicker.propTypes = {
|
|
|
292
292
|
|
|
293
293
|
/**
|
|
294
294
|
* First view to show.
|
|
295
|
+
* Must be a valid option from `views` list
|
|
296
|
+
* @default 'day'
|
|
295
297
|
*/
|
|
296
298
|
openTo: PropTypes.oneOf(['day', 'month', 'year']),
|
|
297
299
|
|
|
@@ -421,6 +423,7 @@ process.env.NODE_ENV !== "production" ? MobileDatePicker.propTypes = {
|
|
|
421
423
|
|
|
422
424
|
/**
|
|
423
425
|
* Array of views to show.
|
|
426
|
+
* @default ['year', 'day']
|
|
424
427
|
*/
|
|
425
428
|
views: PropTypes.arrayOf(PropTypes.oneOf(['day', 'month', 'year']).isRequired)
|
|
426
429
|
} : void 0;
|
|
@@ -10,7 +10,7 @@ import { CalendarOrClockPicker } from '../internals/components/CalendarOrClockPi
|
|
|
10
10
|
import { useDateTimeValidation } from '../internals/hooks/validation/useDateTimeValidation';
|
|
11
11
|
import { PureDateInput } from '../internals/components/PureDateInput';
|
|
12
12
|
import { usePickerState } from '../internals/hooks/usePickerState';
|
|
13
|
-
import { DateTimePickerTabs } from '../DateTimePicker';
|
|
13
|
+
import { DateTimePickerTabs } from '../DateTimePicker/DateTimePickerTabs';
|
|
14
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -375,6 +375,8 @@ process.env.NODE_ENV !== "production" ? MobileDateTimePicker.propTypes = {
|
|
|
375
375
|
|
|
376
376
|
/**
|
|
377
377
|
* First view to show.
|
|
378
|
+
* Must be a valid option from `views` list
|
|
379
|
+
* @default 'day'
|
|
378
380
|
*/
|
|
379
381
|
openTo: PropTypes.oneOf(['day', 'hours', 'minutes', 'month', 'seconds', 'year']),
|
|
380
382
|
|
|
@@ -518,6 +520,7 @@ process.env.NODE_ENV !== "production" ? MobileDateTimePicker.propTypes = {
|
|
|
518
520
|
|
|
519
521
|
/**
|
|
520
522
|
* Array of views to show.
|
|
523
|
+
* @default ['year', 'day', 'hours', 'minutes']
|
|
521
524
|
*/
|
|
522
525
|
views: PropTypes.arrayOf(PropTypes.oneOf(['day', 'hours', 'minutes', 'month', 'seconds', 'year']).isRequired)
|
|
523
526
|
} : void 0;
|
|
@@ -269,6 +269,8 @@ process.env.NODE_ENV !== "production" ? MobileTimePicker.propTypes = {
|
|
|
269
269
|
|
|
270
270
|
/**
|
|
271
271
|
* First view to show.
|
|
272
|
+
* Must be a valid option from `views` list
|
|
273
|
+
* @default 'hours'
|
|
272
274
|
*/
|
|
273
275
|
openTo: PropTypes.oneOf(['hours', 'minutes', 'seconds']),
|
|
274
276
|
|
|
@@ -335,6 +337,7 @@ process.env.NODE_ENV !== "production" ? MobileTimePicker.propTypes = {
|
|
|
335
337
|
|
|
336
338
|
/**
|
|
337
339
|
* Array of views to show.
|
|
340
|
+
* @default ['hours', 'minutes']
|
|
338
341
|
*/
|
|
339
342
|
views: PropTypes.arrayOf(PropTypes.oneOf(['hours', 'minutes', 'seconds']).isRequired)
|
|
340
343
|
} : void 0;
|
package/PickersDay/PickersDay.js
CHANGED
|
@@ -207,7 +207,7 @@ const PickersDayRaw = /*#__PURE__*/React.forwardRef(function PickersDay(inProps,
|
|
|
207
207
|
}));
|
|
208
208
|
});
|
|
209
209
|
export const areDayPropsEqual = (prevProps, nextProps) => {
|
|
210
|
-
return prevProps.autoFocus === nextProps.autoFocus && prevProps.isAnimating === nextProps.isAnimating && prevProps.today === nextProps.today && prevProps.disabled === nextProps.disabled && prevProps.selected === nextProps.selected && prevProps.disableMargin === nextProps.disableMargin && prevProps.showDaysOutsideCurrentMonth === nextProps.showDaysOutsideCurrentMonth && prevProps.disableHighlightToday === nextProps.disableHighlightToday && prevProps.className === nextProps.className && prevProps.outsideCurrentMonth === nextProps.outsideCurrentMonth && prevProps.onFocus === nextProps.onFocus && prevProps.onBlur === nextProps.onBlur && prevProps.onDaySelect === nextProps.onDaySelect;
|
|
210
|
+
return prevProps.autoFocus === nextProps.autoFocus && prevProps.isAnimating === nextProps.isAnimating && prevProps.today === nextProps.today && prevProps.disabled === nextProps.disabled && prevProps.selected === nextProps.selected && prevProps.disableMargin === nextProps.disableMargin && prevProps.showDaysOutsideCurrentMonth === nextProps.showDaysOutsideCurrentMonth && prevProps.disableHighlightToday === nextProps.disableHighlightToday && prevProps.className === nextProps.className && prevProps.sx === nextProps.sx && prevProps.outsideCurrentMonth === nextProps.outsideCurrentMonth && prevProps.onFocus === nextProps.onFocus && prevProps.onBlur === nextProps.onBlur && prevProps.onDaySelect === nextProps.onDaySelect;
|
|
211
211
|
};
|
|
212
212
|
process.env.NODE_ENV !== "production" ? PickersDayRaw.propTypes = {
|
|
213
213
|
// ----------------------------- Warning --------------------------------
|
|
@@ -274,6 +274,8 @@ process.env.NODE_ENV !== "production" ? StaticDatePicker.propTypes = {
|
|
|
274
274
|
|
|
275
275
|
/**
|
|
276
276
|
* First view to show.
|
|
277
|
+
* Must be a valid option from `views` list
|
|
278
|
+
* @default 'day'
|
|
277
279
|
*/
|
|
278
280
|
openTo: PropTypes.oneOf(['day', 'month', 'year']),
|
|
279
281
|
|
|
@@ -403,6 +405,7 @@ process.env.NODE_ENV !== "production" ? StaticDatePicker.propTypes = {
|
|
|
403
405
|
|
|
404
406
|
/**
|
|
405
407
|
* Array of views to show.
|
|
408
|
+
* @default ['year', 'day']
|
|
406
409
|
*/
|
|
407
410
|
views: PropTypes.arrayOf(PropTypes.oneOf(['day', 'month', 'year']).isRequired)
|
|
408
411
|
} : void 0;
|
|
@@ -9,7 +9,7 @@ import { PickerStaticWrapper } from '../internals/components/PickerStaticWrapper
|
|
|
9
9
|
import { CalendarOrClockPicker } from '../internals/components/CalendarOrClockPicker';
|
|
10
10
|
import { useDateTimeValidation } from '../internals/hooks/validation/useDateTimeValidation';
|
|
11
11
|
import { usePickerState } from '../internals/hooks/usePickerState';
|
|
12
|
-
import { DateTimePickerTabs } from '../DateTimePicker';
|
|
12
|
+
import { DateTimePickerTabs } from '../DateTimePicker/DateTimePickerTabs';
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
|
|
15
15
|
/**
|
|
@@ -357,6 +357,8 @@ process.env.NODE_ENV !== "production" ? StaticDateTimePicker.propTypes = {
|
|
|
357
357
|
|
|
358
358
|
/**
|
|
359
359
|
* First view to show.
|
|
360
|
+
* Must be a valid option from `views` list
|
|
361
|
+
* @default 'day'
|
|
360
362
|
*/
|
|
361
363
|
openTo: PropTypes.oneOf(['day', 'hours', 'minutes', 'month', 'seconds', 'year']),
|
|
362
364
|
|
|
@@ -500,6 +502,7 @@ process.env.NODE_ENV !== "production" ? StaticDateTimePicker.propTypes = {
|
|
|
500
502
|
|
|
501
503
|
/**
|
|
502
504
|
* Array of views to show.
|
|
505
|
+
* @default ['year', 'day', 'hours', 'minutes']
|
|
503
506
|
*/
|
|
504
507
|
views: PropTypes.arrayOf(PropTypes.oneOf(['day', 'hours', 'minutes', 'month', 'seconds', 'year']).isRequired)
|
|
505
508
|
} : void 0;
|
|
@@ -251,6 +251,8 @@ process.env.NODE_ENV !== "production" ? StaticTimePicker.propTypes = {
|
|
|
251
251
|
|
|
252
252
|
/**
|
|
253
253
|
* First view to show.
|
|
254
|
+
* Must be a valid option from `views` list
|
|
255
|
+
* @default 'hours'
|
|
254
256
|
*/
|
|
255
257
|
openTo: PropTypes.oneOf(['hours', 'minutes', 'seconds']),
|
|
256
258
|
|
|
@@ -317,6 +319,7 @@ process.env.NODE_ENV !== "production" ? StaticTimePicker.propTypes = {
|
|
|
317
319
|
|
|
318
320
|
/**
|
|
319
321
|
* Array of views to show.
|
|
322
|
+
* @default ['hours', 'minutes']
|
|
320
323
|
*/
|
|
321
324
|
views: PropTypes.arrayOf(PropTypes.oneOf(['hours', 'minutes', 'seconds']).isRequired)
|
|
322
325
|
} : void 0;
|
package/TimePicker/TimePicker.js
CHANGED
|
@@ -267,6 +267,8 @@ process.env.NODE_ENV !== "production" ? TimePicker.propTypes = {
|
|
|
267
267
|
|
|
268
268
|
/**
|
|
269
269
|
* First view to show.
|
|
270
|
+
* Must be a valid option from `views` list
|
|
271
|
+
* @default 'hours'
|
|
270
272
|
*/
|
|
271
273
|
openTo: PropTypes.oneOf(['hours', 'minutes', 'seconds']),
|
|
272
274
|
|
|
@@ -348,6 +350,7 @@ process.env.NODE_ENV !== "production" ? TimePicker.propTypes = {
|
|
|
348
350
|
|
|
349
351
|
/**
|
|
350
352
|
* Array of views to show.
|
|
353
|
+
* @default ['hours', 'minutes']
|
|
351
354
|
*/
|
|
352
355
|
views: PropTypes.arrayOf(PropTypes.oneOf(['hours', 'minutes', 'seconds']).isRequired)
|
|
353
356
|
} : void 0;
|
package/TimePicker/shared.d.ts
CHANGED
|
@@ -21,6 +21,8 @@ export interface BaseTimePickerProps<TInputDate, TDate> extends ExportedClockPic
|
|
|
21
21
|
onViewChange?: (view: ClockPickerView) => void;
|
|
22
22
|
/**
|
|
23
23
|
* First view to show.
|
|
24
|
+
* Must be a valid option from `views` list
|
|
25
|
+
* @default 'hours'
|
|
24
26
|
*/
|
|
25
27
|
openTo?: ClockPickerView;
|
|
26
28
|
/**
|
|
@@ -35,6 +37,7 @@ export interface BaseTimePickerProps<TInputDate, TDate> extends ExportedClockPic
|
|
|
35
37
|
toolbarTitle?: React.ReactNode;
|
|
36
38
|
/**
|
|
37
39
|
* Array of views to show.
|
|
40
|
+
* @default ['hours', 'minutes']
|
|
38
41
|
*/
|
|
39
42
|
views?: readonly ClockPickerView[];
|
|
40
43
|
components?: any;
|
package/index.js
CHANGED
|
@@ -32,6 +32,7 @@ const isDatePickerView = view => view === 'year' || view === 'month' || view ===
|
|
|
32
32
|
|
|
33
33
|
const isTimePickerView = view => view === 'hours' || view === 'minutes' || view === 'seconds';
|
|
34
34
|
|
|
35
|
+
let warnedOnceNotValidOpenTo = false;
|
|
35
36
|
export function CalendarOrClockPicker(props) {
|
|
36
37
|
var _other$components, _other$componentsProp;
|
|
37
38
|
|
|
@@ -74,6 +75,14 @@ export function CalendarOrClockPicker(props) {
|
|
|
74
75
|
onViewChange(newView);
|
|
75
76
|
}
|
|
76
77
|
}, [isMobileKeyboardViewOpen, onViewChange, toggleMobileKeyboardView]);
|
|
78
|
+
|
|
79
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
80
|
+
if (!warnedOnceNotValidOpenTo && !views.includes(openTo)) {
|
|
81
|
+
console.warn(`MUI: \`openTo="${openTo}"\` is not a valid prop.`, `It must be an element of \`views=["${views.join('", "')}"]\`.`);
|
|
82
|
+
warnedOnceNotValidOpenTo = true;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
77
86
|
const {
|
|
78
87
|
openView,
|
|
79
88
|
setOpenView,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import { useEventCallback } from '@mui/material/utils';
|
|
3
4
|
import { onSpaceOrEnter } from '../utils/utils';
|
|
4
5
|
import { useLocaleText, useUtils } from '../hooks/useUtils';
|
|
5
6
|
import { getDisplayDate } from '../utils/text-field-helper';
|
|
@@ -28,6 +29,10 @@ export const PureDateInput = /*#__PURE__*/React.forwardRef(function PureDateInpu
|
|
|
28
29
|
readOnly: true
|
|
29
30
|
}), [InputProps]);
|
|
30
31
|
const inputValue = getDisplayDate(utils, rawValue, inputFormat);
|
|
32
|
+
const handleOnClick = useEventCallback(event => {
|
|
33
|
+
event.stopPropagation();
|
|
34
|
+
onOpen();
|
|
35
|
+
});
|
|
31
36
|
return renderInput(_extends({
|
|
32
37
|
label,
|
|
33
38
|
disabled,
|
|
@@ -35,7 +40,10 @@ export const PureDateInput = /*#__PURE__*/React.forwardRef(function PureDateInpu
|
|
|
35
40
|
inputRef,
|
|
36
41
|
error: validationError,
|
|
37
42
|
InputProps: PureDateInputProps,
|
|
38
|
-
className
|
|
43
|
+
className
|
|
44
|
+
}, !props.readOnly && !props.disabled && {
|
|
45
|
+
onClick: handleOnClick
|
|
46
|
+
}, {
|
|
39
47
|
inputProps: _extends({
|
|
40
48
|
disabled,
|
|
41
49
|
readOnly: true,
|
|
@@ -43,7 +51,7 @@ export const PureDateInput = /*#__PURE__*/React.forwardRef(function PureDateInpu
|
|
|
43
51
|
'aria-label': getOpenDialogAriaText(rawValue, utils),
|
|
44
52
|
value: inputValue
|
|
45
53
|
}, !props.readOnly && {
|
|
46
|
-
|
|
54
|
+
onClick: handleOnClick
|
|
47
55
|
}, {
|
|
48
56
|
onKeyDown: onSpaceOrEnter(onOpen)
|
|
49
57
|
})
|
|
@@ -143,14 +143,39 @@ export function DayPicker(props) {
|
|
|
143
143
|
break;
|
|
144
144
|
|
|
145
145
|
case 'ArrowLeft':
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
146
|
+
{
|
|
147
|
+
var newFocusedDayDefault = utils.addDays(day, theme.direction === 'ltr' ? -1 : 1);
|
|
148
|
+
var nextAvailableMonth = theme.direction === 'ltr' ? utils.getPreviousMonth(day) : utils.getNextMonth(day);
|
|
149
|
+
var closestDayToFocus = findClosestEnabledDate({
|
|
150
|
+
utils: utils,
|
|
151
|
+
date: newFocusedDayDefault,
|
|
152
|
+
minDate: theme.direction === 'ltr' ? utils.startOfMonth(nextAvailableMonth) : newFocusedDayDefault,
|
|
153
|
+
maxDate: theme.direction === 'ltr' ? newFocusedDayDefault : utils.endOfMonth(nextAvailableMonth),
|
|
154
|
+
isDateDisabled: isDateDisabled
|
|
155
|
+
});
|
|
156
|
+
focusDay(closestDayToFocus || newFocusedDayDefault);
|
|
157
|
+
event.preventDefault();
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
149
160
|
|
|
150
161
|
case 'ArrowRight':
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
162
|
+
{
|
|
163
|
+
var _newFocusedDayDefault = utils.addDays(day, theme.direction === 'ltr' ? 1 : -1);
|
|
164
|
+
|
|
165
|
+
var _nextAvailableMonth = theme.direction === 'ltr' ? utils.getNextMonth(day) : utils.getPreviousMonth(day);
|
|
166
|
+
|
|
167
|
+
var _closestDayToFocus = findClosestEnabledDate({
|
|
168
|
+
utils: utils,
|
|
169
|
+
date: _newFocusedDayDefault,
|
|
170
|
+
minDate: theme.direction === 'ltr' ? _newFocusedDayDefault : utils.startOfMonth(_nextAvailableMonth),
|
|
171
|
+
maxDate: theme.direction === 'ltr' ? utils.endOfMonth(_nextAvailableMonth) : _newFocusedDayDefault,
|
|
172
|
+
isDateDisabled: isDateDisabled
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
focusDay(_closestDayToFocus || _newFocusedDayDefault);
|
|
176
|
+
event.preventDefault();
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
154
179
|
|
|
155
180
|
case 'Home':
|
|
156
181
|
focusDay(utils.startOfWeek(day));
|
|
@@ -289,6 +289,8 @@ process.env.NODE_ENV !== "production" ? DatePicker.propTypes = {
|
|
|
289
289
|
|
|
290
290
|
/**
|
|
291
291
|
* First view to show.
|
|
292
|
+
* Must be a valid option from `views` list
|
|
293
|
+
* @default 'day'
|
|
292
294
|
*/
|
|
293
295
|
openTo: PropTypes.oneOf(['day', 'month', 'year']),
|
|
294
296
|
|
|
@@ -433,6 +435,7 @@ process.env.NODE_ENV !== "production" ? DatePicker.propTypes = {
|
|
|
433
435
|
|
|
434
436
|
/**
|
|
435
437
|
* Array of views to show.
|
|
438
|
+
* @default ['year', 'day']
|
|
436
439
|
*/
|
|
437
440
|
views: PropTypes.arrayOf(PropTypes.oneOf(['day', 'month', 'year']).isRequired)
|
|
438
441
|
} : void 0;
|
|
@@ -365,6 +365,8 @@ process.env.NODE_ENV !== "production" ? DateTimePicker.propTypes = {
|
|
|
365
365
|
|
|
366
366
|
/**
|
|
367
367
|
* First view to show.
|
|
368
|
+
* Must be a valid option from `views` list
|
|
369
|
+
* @default 'day'
|
|
368
370
|
*/
|
|
369
371
|
openTo: PropTypes.oneOf(['day', 'hours', 'minutes', 'month', 'seconds', 'year']),
|
|
370
372
|
|
|
@@ -523,6 +525,7 @@ process.env.NODE_ENV !== "production" ? DateTimePicker.propTypes = {
|
|
|
523
525
|
|
|
524
526
|
/**
|
|
525
527
|
* Array of views to show.
|
|
528
|
+
* @default ['year', 'day', 'hours', 'minutes']
|
|
526
529
|
*/
|
|
527
530
|
views: PropTypes.arrayOf(PropTypes.oneOf(['day', 'hours', 'minutes', 'month', 'seconds', 'year']).isRequired)
|
|
528
531
|
} : void 0;
|
|
@@ -293,6 +293,8 @@ process.env.NODE_ENV !== "production" ? DesktopDatePicker.propTypes = {
|
|
|
293
293
|
|
|
294
294
|
/**
|
|
295
295
|
* First view to show.
|
|
296
|
+
* Must be a valid option from `views` list
|
|
297
|
+
* @default 'day'
|
|
296
298
|
*/
|
|
297
299
|
openTo: PropTypes.oneOf(['day', 'month', 'year']),
|
|
298
300
|
|
|
@@ -437,6 +439,7 @@ process.env.NODE_ENV !== "production" ? DesktopDatePicker.propTypes = {
|
|
|
437
439
|
|
|
438
440
|
/**
|
|
439
441
|
* Array of views to show.
|
|
442
|
+
* @default ['year', 'day']
|
|
440
443
|
*/
|
|
441
444
|
views: PropTypes.arrayOf(PropTypes.oneOf(['day', 'month', 'year']).isRequired)
|
|
442
445
|
} : void 0;
|
|
@@ -10,7 +10,7 @@ import { CalendarOrClockPicker } from '../internals/components/CalendarOrClockPi
|
|
|
10
10
|
import { useDateTimeValidation } from '../internals/hooks/validation/useDateTimeValidation';
|
|
11
11
|
import { KeyboardDateInput } from '../internals/components/KeyboardDateInput';
|
|
12
12
|
import { usePickerState } from '../internals/hooks/usePickerState';
|
|
13
|
-
import { DateTimePickerTabs } from '../DateTimePicker';
|
|
13
|
+
import { DateTimePickerTabs } from '../DateTimePicker/DateTimePickerTabs';
|
|
14
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -379,6 +379,8 @@ process.env.NODE_ENV !== "production" ? DesktopDateTimePicker.propTypes = {
|
|
|
379
379
|
|
|
380
380
|
/**
|
|
381
381
|
* First view to show.
|
|
382
|
+
* Must be a valid option from `views` list
|
|
383
|
+
* @default 'day'
|
|
382
384
|
*/
|
|
383
385
|
openTo: PropTypes.oneOf(['day', 'hours', 'minutes', 'month', 'seconds', 'year']),
|
|
384
386
|
|
|
@@ -537,6 +539,7 @@ process.env.NODE_ENV !== "production" ? DesktopDateTimePicker.propTypes = {
|
|
|
537
539
|
|
|
538
540
|
/**
|
|
539
541
|
* Array of views to show.
|
|
542
|
+
* @default ['year', 'day', 'hours', 'minutes']
|
|
540
543
|
*/
|
|
541
544
|
views: PropTypes.arrayOf(PropTypes.oneOf(['day', 'hours', 'minutes', 'month', 'seconds', 'year']).isRequired)
|
|
542
545
|
} : void 0;
|
|
@@ -270,6 +270,8 @@ process.env.NODE_ENV !== "production" ? DesktopTimePicker.propTypes = {
|
|
|
270
270
|
|
|
271
271
|
/**
|
|
272
272
|
* First view to show.
|
|
273
|
+
* Must be a valid option from `views` list
|
|
274
|
+
* @default 'hours'
|
|
273
275
|
*/
|
|
274
276
|
openTo: PropTypes.oneOf(['hours', 'minutes', 'seconds']),
|
|
275
277
|
|
|
@@ -351,6 +353,7 @@ process.env.NODE_ENV !== "production" ? DesktopTimePicker.propTypes = {
|
|
|
351
353
|
|
|
352
354
|
/**
|
|
353
355
|
* Array of views to show.
|
|
356
|
+
* @default ['hours', 'minutes']
|
|
354
357
|
*/
|
|
355
358
|
views: PropTypes.arrayOf(PropTypes.oneOf(['hours', 'minutes', 'seconds']).isRequired)
|
|
356
359
|
} : void 0;
|
|
@@ -294,6 +294,8 @@ process.env.NODE_ENV !== "production" ? MobileDatePicker.propTypes = {
|
|
|
294
294
|
|
|
295
295
|
/**
|
|
296
296
|
* First view to show.
|
|
297
|
+
* Must be a valid option from `views` list
|
|
298
|
+
* @default 'day'
|
|
297
299
|
*/
|
|
298
300
|
openTo: PropTypes.oneOf(['day', 'month', 'year']),
|
|
299
301
|
|
|
@@ -423,6 +425,7 @@ process.env.NODE_ENV !== "production" ? MobileDatePicker.propTypes = {
|
|
|
423
425
|
|
|
424
426
|
/**
|
|
425
427
|
* Array of views to show.
|
|
428
|
+
* @default ['year', 'day']
|
|
426
429
|
*/
|
|
427
430
|
views: PropTypes.arrayOf(PropTypes.oneOf(['day', 'month', 'year']).isRequired)
|
|
428
431
|
} : void 0;
|