@mui/x-date-pickers 5.0.2 → 6.0.0-alpha.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 +212 -3
- package/CalendarPicker/CalendarPicker.d.ts +8 -2
- package/CalendarPicker/CalendarPicker.js +54 -71
- package/CalendarPicker/DayPicker.d.ts +2 -2
- package/CalendarPicker/DayPicker.js +6 -2
- package/CalendarPicker/PickersCalendarHeader.d.ts +3 -10
- package/CalendarPicker/PickersCalendarHeader.js +7 -20
- package/CalendarPicker/useCalendarState.d.ts +2 -2
- package/CalendarPicker/useCalendarState.js +7 -7
- package/ClockPicker/Clock.d.ts +9 -4
- package/ClockPicker/Clock.js +13 -13
- package/ClockPicker/ClockNumbers.d.ts +3 -3
- package/ClockPicker/ClockNumbers.js +2 -2
- package/ClockPicker/ClockPicker.d.ts +8 -58
- package/ClockPicker/ClockPicker.js +52 -128
- package/ClockPicker/ClockPointer.d.ts +1 -1
- package/ClockPicker/ClockPointer.js +4 -4
- package/DateField/useDateField.d.ts +1 -1
- package/DateField/useDateField.js +5 -1
- package/DatePicker/DatePicker.js +10 -20
- package/DateTimePicker/DateTimePicker.js +10 -39
- package/DesktopDatePicker/DesktopDatePicker.d.ts +1 -1
- package/DesktopDatePicker/DesktopDatePicker.js +14 -22
- package/DesktopDateTimePicker/DesktopDateTimePicker.d.ts +1 -1
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +13 -40
- package/DesktopTimePicker/DesktopTimePicker.d.ts +1 -1
- package/DesktopTimePicker/DesktopTimePicker.js +9 -21
- package/LocalizationProvider/LocalizationProvider.d.ts +10 -11
- package/LocalizationProvider/LocalizationProvider.js +31 -24
- package/MobileDatePicker/MobileDatePicker.d.ts +1 -1
- package/MobileDatePicker/MobileDatePicker.js +14 -22
- package/MobileDateTimePicker/MobileDateTimePicker.d.ts +1 -1
- package/MobileDateTimePicker/MobileDateTimePicker.js +13 -40
- package/MobileTimePicker/MobileTimePicker.d.ts +1 -1
- package/MobileTimePicker/MobileTimePicker.js +9 -21
- package/MonthPicker/MonthPicker.d.ts +12 -9
- package/MonthPicker/MonthPicker.js +60 -57
- package/MonthPicker/PickersMonth.d.ts +10 -7
- package/MonthPicker/PickersMonth.js +76 -44
- package/MonthPicker/pickersMonthClasses.d.ts +9 -1
- package/MonthPicker/pickersMonthClasses.js +1 -1
- package/PickersDay/PickersDay.d.ts +0 -6
- package/PickersDay/PickersDay.js +0 -5
- package/StaticDatePicker/StaticDatePicker.d.ts +1 -1
- package/StaticDatePicker/StaticDatePicker.js +17 -23
- package/StaticDateTimePicker/StaticDateTimePicker.d.ts +1 -1
- package/StaticDateTimePicker/StaticDateTimePicker.js +17 -42
- package/StaticTimePicker/StaticTimePicker.d.ts +1 -1
- package/StaticTimePicker/StaticTimePicker.js +17 -22
- package/TimePicker/TimePicker.js +5 -19
- package/YearPicker/PickersYear.d.ts +7 -6
- package/YearPicker/PickersYear.js +34 -23
- package/YearPicker/YearPicker.d.ts +21 -4
- package/YearPicker/YearPicker.js +109 -49
- package/YearPicker/pickersYearClasses.d.ts +1 -1
- package/index.js +1 -1
- package/internals/components/CalendarOrClockPicker/CalendarOrClockPicker.js +2 -2
- package/internals/components/PickerStaticWrapper/PickerStaticWrapper.d.ts +20 -6
- package/internals/components/PickerStaticWrapper/PickerStaticWrapper.js +38 -22
- package/internals/components/PickerStaticWrapper/index.d.ts +1 -1
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.d.ts +3 -0
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +166 -0
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.types.d.ts +63 -0
- package/internals/{models/muiPickersAdapter.js → components/PickersArrowSwitcher/PickersArrowSwitcher.types.js} +0 -0
- package/internals/components/PickersArrowSwitcher/index.d.ts +2 -0
- package/internals/components/PickersArrowSwitcher/index.js +1 -0
- package/internals/components/{pickersArrowSwitcherClasses.d.ts → PickersArrowSwitcher/pickersArrowSwitcherClasses.d.ts} +0 -0
- package/internals/components/{pickersArrowSwitcherClasses.js → PickersArrowSwitcher/pickersArrowSwitcherClasses.js} +0 -0
- package/internals/components/PickersPopper.d.ts +2 -6
- package/internals/components/PickersPopper.js +5 -5
- package/internals/components/PickersToolbar.d.ts +1 -1
- package/internals/components/PickersToolbar.js +1 -2
- package/internals/components/PickersToolbarText.d.ts +1 -1
- package/internals/components/wrappers/DesktopTooltipWrapper.d.ts +1 -1
- package/internals/components/wrappers/DesktopTooltipWrapper.js +29 -24
- package/internals/components/wrappers/DesktopWrapper.d.ts +8 -3
- package/internals/components/wrappers/DesktopWrapper.js +26 -21
- package/internals/components/wrappers/MobileWrapper.d.ts +8 -3
- package/internals/components/wrappers/MobileWrapper.js +23 -18
- package/internals/hooks/useField/useField.interfaces.d.ts +0 -1
- package/internals/hooks/useField/useField.js +19 -23
- package/internals/hooks/useField/useField.utils.js +10 -2
- package/internals/hooks/useUtils.d.ts +5 -2
- package/internals/hooks/useUtils.js +11 -2
- package/internals/hooks/validation/useDateValidation.d.ts +4 -4
- package/internals/hooks/validation/useDateValidation.js +12 -2
- package/internals/index.d.ts +5 -5
- package/internals/index.js +3 -3
- package/internals/models/muiPickersAdapter.d.ts +12 -7
- package/internals/models/props/baseToolbarProps.d.ts +0 -8
- package/internals/models/props/staticPickerProps.d.ts +2 -8
- package/legacy/CalendarPicker/CalendarPicker.js +52 -69
- package/legacy/CalendarPicker/DayPicker.js +6 -2
- package/legacy/CalendarPicker/PickersCalendarHeader.js +7 -20
- package/legacy/CalendarPicker/useCalendarState.js +7 -7
- package/legacy/ClockPicker/Clock.js +13 -13
- package/legacy/ClockPicker/ClockNumbers.js +2 -2
- package/legacy/ClockPicker/ClockPicker.js +57 -133
- package/legacy/ClockPicker/ClockPointer.js +4 -4
- package/legacy/DateField/useDateField.js +5 -1
- package/legacy/DatePicker/DatePicker.js +10 -20
- package/legacy/DateTimePicker/DateTimePicker.js +10 -39
- package/legacy/DesktopDatePicker/DesktopDatePicker.js +13 -21
- package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +13 -40
- package/legacy/DesktopTimePicker/DesktopTimePicker.js +8 -20
- package/legacy/LocalizationProvider/LocalizationProvider.js +28 -23
- package/legacy/MobileDatePicker/MobileDatePicker.js +13 -21
- package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +13 -40
- package/legacy/MobileTimePicker/MobileTimePicker.js +8 -20
- package/legacy/MonthPicker/MonthPicker.js +67 -62
- package/legacy/MonthPicker/PickersMonth.js +89 -57
- package/legacy/MonthPicker/pickersMonthClasses.js +1 -1
- package/legacy/PickersDay/PickersDay.js +0 -5
- package/legacy/StaticDatePicker/StaticDatePicker.js +17 -24
- package/legacy/StaticDateTimePicker/StaticDateTimePicker.js +17 -43
- package/legacy/StaticTimePicker/StaticTimePicker.js +17 -23
- package/legacy/TimePicker/TimePicker.js +5 -19
- package/legacy/YearPicker/PickersYear.js +35 -25
- package/legacy/YearPicker/YearPicker.js +111 -51
- package/legacy/index.js +1 -1
- package/legacy/internals/components/CalendarOrClockPicker/CalendarOrClockPicker.js +2 -2
- package/legacy/internals/components/PickerStaticWrapper/PickerStaticWrapper.js +41 -24
- package/legacy/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +180 -0
- package/legacy/internals/{models/muiPickersAdapter.js → components/PickersArrowSwitcher/PickersArrowSwitcher.types.js} +0 -0
- package/legacy/internals/components/PickersArrowSwitcher/index.js +1 -0
- package/legacy/internals/components/{pickersArrowSwitcherClasses.js → PickersArrowSwitcher/pickersArrowSwitcherClasses.js} +0 -0
- package/legacy/internals/components/PickersPopper.js +5 -5
- package/legacy/internals/components/PickersToolbar.js +1 -2
- package/legacy/internals/components/wrappers/DesktopTooltipWrapper.js +29 -24
- package/legacy/internals/components/wrappers/DesktopWrapper.js +26 -21
- package/legacy/internals/components/wrappers/MobileWrapper.js +22 -17
- package/legacy/internals/hooks/useField/useField.js +21 -23
- package/legacy/internals/hooks/useField/useField.utils.js +10 -2
- package/legacy/internals/hooks/useUtils.js +13 -2
- package/legacy/internals/hooks/validation/useDateValidation.js +12 -2
- package/legacy/internals/index.js +3 -3
- package/legacy/locales/faIR.js +52 -0
- package/legacy/locales/fiFI.js +61 -0
- package/legacy/locales/index.js +2 -0
- package/legacy/locales/isIS.js +0 -1
- package/locales/faIR.d.ts +35 -0
- package/locales/faIR.js +36 -0
- package/locales/fiFI.d.ts +35 -0
- package/locales/fiFI.js +45 -0
- package/locales/index.d.ts +2 -0
- package/locales/index.js +2 -0
- package/locales/isIS.js +0 -1
- package/locales/utils/pickersLocaleTextApi.d.ts +1 -0
- package/modern/CalendarPicker/CalendarPicker.js +54 -71
- package/modern/CalendarPicker/DayPicker.js +6 -2
- package/modern/CalendarPicker/PickersCalendarHeader.js +7 -20
- package/modern/CalendarPicker/useCalendarState.js +7 -7
- package/modern/ClockPicker/Clock.js +13 -13
- package/modern/ClockPicker/ClockNumbers.js +2 -2
- package/modern/ClockPicker/ClockPicker.js +52 -128
- package/modern/ClockPicker/ClockPointer.js +4 -4
- package/modern/DateField/useDateField.js +5 -1
- package/modern/DatePicker/DatePicker.js +10 -20
- package/modern/DateTimePicker/DateTimePicker.js +10 -39
- package/modern/DesktopDatePicker/DesktopDatePicker.js +14 -22
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +13 -40
- package/modern/DesktopTimePicker/DesktopTimePicker.js +9 -21
- package/modern/LocalizationProvider/LocalizationProvider.js +29 -24
- package/modern/MobileDatePicker/MobileDatePicker.js +14 -22
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +13 -40
- package/modern/MobileTimePicker/MobileTimePicker.js +9 -21
- package/modern/MonthPicker/MonthPicker.js +60 -57
- package/modern/MonthPicker/PickersMonth.js +76 -44
- package/modern/MonthPicker/pickersMonthClasses.js +1 -1
- package/modern/PickersDay/PickersDay.js +0 -5
- package/modern/StaticDatePicker/StaticDatePicker.js +17 -23
- package/modern/StaticDateTimePicker/StaticDateTimePicker.js +17 -42
- package/modern/StaticTimePicker/StaticTimePicker.js +17 -22
- package/modern/TimePicker/TimePicker.js +5 -19
- package/modern/YearPicker/PickersYear.js +34 -23
- package/modern/YearPicker/YearPicker.js +109 -49
- package/modern/index.js +1 -1
- package/modern/internals/components/CalendarOrClockPicker/CalendarOrClockPicker.js +2 -2
- package/modern/internals/components/PickerStaticWrapper/PickerStaticWrapper.js +38 -22
- package/modern/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +164 -0
- package/modern/internals/{models/muiPickersAdapter.js → components/PickersArrowSwitcher/PickersArrowSwitcher.types.js} +0 -0
- package/modern/internals/components/PickersArrowSwitcher/index.js +1 -0
- package/modern/internals/components/{pickersArrowSwitcherClasses.js → PickersArrowSwitcher/pickersArrowSwitcherClasses.js} +0 -0
- package/modern/internals/components/PickersPopper.js +5 -5
- package/modern/internals/components/PickersToolbar.js +1 -2
- package/modern/internals/components/wrappers/DesktopTooltipWrapper.js +29 -24
- package/modern/internals/components/wrappers/DesktopWrapper.js +26 -21
- package/modern/internals/components/wrappers/MobileWrapper.js +23 -18
- package/modern/internals/hooks/useField/useField.js +19 -21
- package/modern/internals/hooks/useField/useField.utils.js +10 -2
- package/modern/internals/hooks/useUtils.js +11 -2
- package/modern/internals/hooks/validation/useDateValidation.js +12 -2
- package/modern/internals/index.js +3 -3
- package/modern/locales/faIR.js +36 -0
- package/modern/locales/fiFI.js +45 -0
- package/modern/locales/index.js +2 -0
- package/modern/locales/isIS.js +0 -1
- package/node/CalendarPicker/CalendarPicker.js +54 -71
- package/node/CalendarPicker/DayPicker.js +5 -1
- package/node/CalendarPicker/PickersCalendarHeader.js +7 -21
- package/node/CalendarPicker/useCalendarState.js +6 -6
- package/node/ClockPicker/Clock.js +12 -12
- package/node/ClockPicker/ClockNumbers.js +2 -2
- package/node/ClockPicker/ClockPicker.js +52 -129
- package/node/ClockPicker/ClockPointer.js +4 -4
- package/node/DateField/useDateField.js +5 -1
- package/node/DatePicker/DatePicker.js +10 -20
- package/node/DateTimePicker/DateTimePicker.js +10 -39
- package/node/DesktopDatePicker/DesktopDatePicker.js +14 -22
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +13 -40
- package/node/DesktopTimePicker/DesktopTimePicker.js +9 -21
- package/node/LocalizationProvider/LocalizationProvider.js +31 -25
- package/node/MobileDatePicker/MobileDatePicker.js +14 -22
- package/node/MobileDateTimePicker/MobileDateTimePicker.js +13 -40
- package/node/MobileTimePicker/MobileTimePicker.js +9 -21
- package/node/MonthPicker/MonthPicker.js +61 -58
- package/node/MonthPicker/PickersMonth.js +71 -43
- package/node/MonthPicker/pickersMonthClasses.js +1 -1
- package/node/PickersDay/PickersDay.js +0 -5
- package/node/StaticDatePicker/StaticDatePicker.js +17 -23
- package/node/StaticDateTimePicker/StaticDateTimePicker.js +17 -42
- package/node/StaticTimePicker/StaticTimePicker.js +17 -22
- package/node/TimePicker/TimePicker.js +5 -19
- package/node/YearPicker/PickersYear.js +33 -22
- package/node/YearPicker/YearPicker.js +111 -49
- package/node/index.js +1 -1
- package/node/internals/components/CalendarOrClockPicker/CalendarOrClockPicker.js +2 -2
- package/node/internals/components/PickerStaticWrapper/PickerStaticWrapper.js +39 -22
- package/node/internals/components/{PickersArrowSwitcher.js → PickersArrowSwitcher/PickersArrowSwitcher.js} +102 -58
- package/node/internals/{models/muiPickersAdapter.js → components/PickersArrowSwitcher/PickersArrowSwitcher.types.js} +0 -0
- package/node/internals/components/PickersArrowSwitcher/index.js +13 -0
- package/node/internals/components/{pickersArrowSwitcherClasses.js → PickersArrowSwitcher/pickersArrowSwitcherClasses.js} +0 -0
- package/node/internals/components/PickersPopper.js +5 -5
- package/node/internals/components/PickersToolbar.js +1 -2
- package/node/internals/components/wrappers/DesktopTooltipWrapper.js +30 -24
- package/node/internals/components/wrappers/DesktopWrapper.js +27 -21
- package/node/internals/components/wrappers/MobileWrapper.js +24 -18
- package/node/internals/hooks/useField/useField.js +19 -23
- package/node/internals/hooks/useField/useField.utils.js +10 -2
- package/node/internals/hooks/useUtils.js +15 -2
- package/node/internals/hooks/validation/useDateValidation.js +14 -4
- package/node/internals/index.js +8 -2
- package/node/locales/faIR.js +45 -0
- package/node/locales/fiFI.js +54 -0
- package/node/locales/index.js +26 -0
- package/node/locales/isIS.js +0 -1
- package/package.json +4 -4
- package/themeAugmentation/props.d.ts +3 -3
- package/internals/components/PickersArrowSwitcher.d.ts +0 -62
- package/internals/components/PickersArrowSwitcher.js +0 -124
- package/legacy/internals/components/PickersArrowSwitcher.js +0 -128
- package/modern/internals/components/PickersArrowSwitcher.js +0 -124
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,215 @@
|
|
|
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
|
+
## 6.0.0-alpha.0
|
|
7
|
+
|
|
8
|
+
_Sep 22, 2022_
|
|
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 a `localeText` prop to all pickers to customize the translations (#6212) @flaviendelangle
|
|
13
|
+
- 🌍 Add Finnish (fi-FI) locale to the pickers (#6219) @PetroSilenius
|
|
14
|
+
- 🌍 Add Persian (fa-IR) locale to the pickers (#6181) @fakhamatia
|
|
15
|
+
- 📚 Documentation improvements
|
|
16
|
+
- 🐞 Bugfixes
|
|
17
|
+
|
|
18
|
+
### `@mui/x-data-grid@v6.0.0-alpha.0` / `@mui/x-data-grid-pro@v6.0.0-alpha.0` / `@mui/x-data-grid-premium@v6.0.0-alpha.0`
|
|
19
|
+
|
|
20
|
+
#### Breaking changes
|
|
21
|
+
|
|
22
|
+
- The deprecated `hide` column property has been removed in favor of the `columnVisibilityModel` prop and initial state.
|
|
23
|
+
|
|
24
|
+
```diff
|
|
25
|
+
<DataGrid
|
|
26
|
+
columns={[
|
|
27
|
+
field: 'id,
|
|
28
|
+
- hide: true,
|
|
29
|
+
]}
|
|
30
|
+
+ initialState={{
|
|
31
|
+
+ columns: {
|
|
32
|
+
+ columnVisibilityModel: { id: false },
|
|
33
|
+
+ }
|
|
34
|
+
+ }}
|
|
35
|
+
/>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
You can find more information about this new API on our [documentation](https://next.mui.com/x/react-data-grid/column-visibility/).
|
|
39
|
+
|
|
40
|
+
- The `GridEvents` enum is now a TypeScript type.
|
|
41
|
+
|
|
42
|
+
```diff
|
|
43
|
+
- apiRef.current.subscribeEvent(GridEvents.rowClick', handleRowClick)
|
|
44
|
+
+ apiRef.current.subscribeEvent('rowClick', handleRowClick)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
#### Changes
|
|
48
|
+
|
|
49
|
+
- [DataGrid] Do not publish `cellFocusOut` event if the row was removed (#6251) @cherniavskii
|
|
50
|
+
- [DataGrid] Fix scroll anchoring with master details (#6054) @oliviertassinari
|
|
51
|
+
- [DataGrid] Improve Polish (pl-PL) locale on the data grid (#6245) @grzegorz-bach
|
|
52
|
+
- [DataGrid] Remove the `GridEvents` enum (#6003) @flaviendelangle
|
|
53
|
+
- [DataGrid] Remove the deprecated `hide` column property (#5999) @flaviendelangle
|
|
54
|
+
|
|
55
|
+
### `@mui/x-date-pickers@v6.0.0-alpha.0` / `@mui/x-date-pickers-pro@v6.0.0-alpha.0`
|
|
56
|
+
|
|
57
|
+
#### Breaking changes
|
|
58
|
+
|
|
59
|
+
- All the deprecated props that allowed you to set the text displayed in the pickers have been removed.
|
|
60
|
+
|
|
61
|
+
You can now use the `localText` prop available on all picker components:
|
|
62
|
+
|
|
63
|
+
| Removed prop | Property in the new `localText` prop |
|
|
64
|
+
|------------------------------|-----------------------------------------------------------------------------------|
|
|
65
|
+
| `endText` | `end` |
|
|
66
|
+
| `getClockLabelText` | `clockLabelText` |
|
|
67
|
+
| `getHoursClockNumberText` | `hoursClockNumberText` |
|
|
68
|
+
| `getMinutesClockNumberText` | `minutesClockNumberText` |
|
|
69
|
+
| `getSecondsClockNumberText` | `secondsClockNumberText` |
|
|
70
|
+
| `getViewSwitchingButtonText` | `calendarViewSwitchingButtonAriaLabel` |
|
|
71
|
+
| `leftArrowButtonText` | `openPreviousView` (or `previousMonth` when the button changes the visible month) |
|
|
72
|
+
| `rightArrowButtonText` | `openNextView` (or `nextMonth` when the button changes the visible month) |
|
|
73
|
+
| `startText` | `start` |
|
|
74
|
+
|
|
75
|
+
For instance if you want to replace the `startText` / `endText`
|
|
76
|
+
|
|
77
|
+
```diff
|
|
78
|
+
<DateRangePicker
|
|
79
|
+
- startText="From"
|
|
80
|
+
- endText="To"
|
|
81
|
+
+ localeText={{
|
|
82
|
+
+ start: 'From',
|
|
83
|
+
+ end: 'To',
|
|
84
|
+
+ }}
|
|
85
|
+
/>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
You can find more information about the new api, including how to set those translations on all your components at once in the [documentation](https://next.mui.com/x/react-date-pickers/localization/)
|
|
89
|
+
|
|
90
|
+
- The component slots `LeftArrowButton` and `RightArrowButton` have been renamed `PreviousIconButton` and `NextIconButton` to better describe there usage:
|
|
91
|
+
|
|
92
|
+
```diff
|
|
93
|
+
<DatePicker
|
|
94
|
+
components={{
|
|
95
|
+
- LeftArrowButton: CustomButton,
|
|
96
|
+
+ PreviousIconButton: CustomButton,
|
|
97
|
+
|
|
98
|
+
- RightArrowButton: CustomButton,
|
|
99
|
+
+ NextIconButton: CustomButton,
|
|
100
|
+
}}
|
|
101
|
+
|
|
102
|
+
componentsProps={{
|
|
103
|
+
- leftArrowButton: {},
|
|
104
|
+
+ previousIconButton: {},
|
|
105
|
+
|
|
106
|
+
- rightArrowButton: {},
|
|
107
|
+
+ nextIconButton: {},
|
|
108
|
+
}}
|
|
109
|
+
/>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
- The `date` prop has been renamed `value` on `MonthPicker` / `YearPicker`, `ClockPicker` and `CalendarPicker`.
|
|
113
|
+
|
|
114
|
+
```diff
|
|
115
|
+
- <MonthPicker date={dayjs()} onChange={handleMonthChange} />
|
|
116
|
+
+ <MonthPicker value={dayjs()} onChange={handleMonthChange} />
|
|
117
|
+
|
|
118
|
+
- <YearPicker date={dayjs()} onChange={handleYearChange} />
|
|
119
|
+
+ <YearPicker value={dayjs()} onChange={handleYearChange} />
|
|
120
|
+
|
|
121
|
+
- <ClockPicker date={dayjs()} onChange={handleTimeChange} />
|
|
122
|
+
+ <ClockPicker value={dayjs()} onChange={handleTimeChange} />
|
|
123
|
+
|
|
124
|
+
- <CalendarPicker date={dayjs()} onChange={handleDateChange} />
|
|
125
|
+
+ <CalendarPicker value={dayjs()} onChange={handleDateChange} />
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
#### Changes
|
|
129
|
+
|
|
130
|
+
- [CalendarPicker] Don't move to closest enabled date when `props.date` contains a disabled date (#6146) @flaviendelangle
|
|
131
|
+
- [DateRangePicker] Switch to new month when changing the value from the outside (#6166) @flaviendelangle
|
|
132
|
+
- [pickers] Add a `localeText` prop to all pickers to customize the translations (#6212) @flaviendelangle
|
|
133
|
+
- [pickers] Add Finnish (fi-FI) locale to the pickers (#6219) (#6230) @PetroSilenius
|
|
134
|
+
- [pickers] Add Persian (fa-IR) locale to the pickers (#6181) @fakhamatia
|
|
135
|
+
- [pickers] Allow nested `LocalizationProvider` (#6011) @flaviendelangle
|
|
136
|
+
- [pickers] Clean slots on `PickersArrowSwitcher` component (#5890) @flaviendelangle
|
|
137
|
+
- [pickers] Fix invalid date error when decreasing `DateField` day (#6071) @alexfauquette
|
|
138
|
+
- [pickers] Fix mobile section selection (#6207) @oliviertassinari
|
|
139
|
+
- [pickers] Fix usage with Typescript 4.8 (#6229) @flaviendelangle
|
|
140
|
+
- [pickers] Improve error message when no adapter context is found (#6211) @flaviendelangle
|
|
141
|
+
- [pickers] Remove `valueStr` from the field state (#6142) @flaviendelangle
|
|
142
|
+
- [pickers] Remove remaining deprecated locale props (#6233) @flaviendelangle
|
|
143
|
+
- [pickers] Rename the `date` prop `value` on `MonthPicker` / `YearPicker`, `ClockPicker` and `CalendarPicker` (#6128) @flaviendelangle
|
|
144
|
+
- [pickers] Rename the `onClose` prop of `PickersPopper` `onDismiss` to simplify typing (#6155) @flaviendelangle
|
|
145
|
+
- [pickers] Support the `sx` prop on all public component with a root HTML elements (#5944) @flaviendelangle
|
|
146
|
+
- [pickers] Unify `PickersMonth` and `PickersYear` behaviors (#6034) @flaviendelangle
|
|
147
|
+
- [pickers] Use `shouldDisableMonth` and `shouldDisableYear` for date validation (#6066) @flaviendelangle
|
|
148
|
+
- [YearPicker] Scroll to the current year even with `autoFocus=false` (#6224) @alexfauquette
|
|
149
|
+
|
|
150
|
+
### Docs
|
|
151
|
+
|
|
152
|
+
- [docs] Add automatic vale check (#5429) @alexfauquette
|
|
153
|
+
- [docs] Add Pro logo in "column ordering" link (#6127) @alexfauquette
|
|
154
|
+
- [docs] Fix 301 link (#6239) @oliviertassinari
|
|
155
|
+
- [docs] Fix broken link (#6163) @alexfauquette
|
|
156
|
+
- [docs] Fix broken links (#6101) @alexfauquette
|
|
157
|
+
- [docs] Fix demonstration date to avoid hydration errors (#6032) @alexfauquette
|
|
158
|
+
- [docs] Fix hidden popper in restore state example (#6191) @heyfirst
|
|
159
|
+
- [docs] Fix invalid links causing 404 & 301 errors (#6105) @oliviertassinari
|
|
160
|
+
- [docs] Fix npm repository url in the pickers `package.json` (#6172) @oliviertassinari
|
|
161
|
+
- [docs] Fix typo in linked issue (#6162) @flaviendelangle
|
|
162
|
+
- [docs] Import `generateUtilityClass` from `@mui/utils` (#6216) @michaldudak
|
|
163
|
+
- [docs] Improve Upgrade plan docs (#6018) @oliviertassinari
|
|
164
|
+
- [docs] Link the OpenSSF Best Practices card (#6171) @oliviertassinari
|
|
165
|
+
|
|
166
|
+
### Core
|
|
167
|
+
|
|
168
|
+
- [core] Add `v5.17.3` changelog to next branch (#6250) @flaviendelangle
|
|
169
|
+
- [core] Add link to the security page on the `README` (#6073) @oliviertassinari
|
|
170
|
+
- [core] Fix scroll restoration in the docs (#5938) @oliviertassinari
|
|
171
|
+
- [core] Remove the Storybook (#6099) @flaviendelangle
|
|
172
|
+
- [core] Tag release as `next` in NPM (#6256) @m4theushw
|
|
173
|
+
- [core] Update monorepo (#6180) @flaviendelangle
|
|
174
|
+
- [core] Use the `next` branch for Prettier (#6097) @flaviendelangle
|
|
175
|
+
- [core] Use the official repository for `@mui/monorepo` instead of a fork (#6189) @oliviertassinari
|
|
176
|
+
- [test] Fix logic to skip column pinning tests (#6133) @m4theushw
|
|
177
|
+
- [test] Hide the date on the print regression test (#6120) @flaviendelangle
|
|
178
|
+
- [test] Skip tests for column pinning and dynamic row height (#5997) @m4theushw
|
|
179
|
+
- [website] Improve security header @oliviertassinari
|
|
180
|
+
|
|
181
|
+
## v5.17.4
|
|
182
|
+
|
|
183
|
+
_Sep 22, 2022_
|
|
184
|
+
|
|
185
|
+
We'd like to offer a big thanks to the 5 contributors who made this release possible. Here are some highlights ✨:
|
|
186
|
+
|
|
187
|
+
- 🌍 Add Finnish (fi-FI) locale to the pickers (#6230) @PetroSilenius
|
|
188
|
+
- 🌍 Add Persian (fa-IR) locale to the pickers (#6181) @fakhamatia
|
|
189
|
+
- 🐞 Bugfixes
|
|
190
|
+
|
|
191
|
+
### `@mui/x-data-grid@v5.17.4` / `@mui/x-data-grid-pro@v5.17.4` / `@mui/x-data-grid-premium@v5.17.4`
|
|
192
|
+
|
|
193
|
+
#### Changes
|
|
194
|
+
|
|
195
|
+
- [DataGrid] Do not publish `cellFocusOut` event if the row was removed (#6251) @cherniavskii
|
|
196
|
+
- [DataGrid] Improve Polish (pl-PL) locale on the data grid (#6245) @grzegorz-bach
|
|
197
|
+
|
|
198
|
+
### `@mui/x-date-pickers@v5.0.3` / `@mui/x-date-pickers-pro@v5.0.3`
|
|
199
|
+
|
|
200
|
+
#### Changes
|
|
201
|
+
|
|
202
|
+
- [pickers] Add Finnish (fi-FI) locale to pickers (#6219) (#6230) @PetroSilenius
|
|
203
|
+
- [pickers] Add Persian (fa-IR) locale to the pickers (#6181) @fakhamatia
|
|
204
|
+
- [pickers] Fix usage with Typescript 4.8 (#6229) @flaviendelangle
|
|
205
|
+
- [YearPicker] Scroll to the current year even with `autoFocus=false` (#6224) @alexfauquette
|
|
206
|
+
|
|
207
|
+
### Docs
|
|
208
|
+
|
|
209
|
+
- [docs] Fix 301 link (#6239) @oliviertassinari
|
|
210
|
+
|
|
211
|
+
### Core
|
|
212
|
+
|
|
213
|
+
- [core] Use the official repository for `@mui/monorepo` instead of a fork (#6189) @oliviertassinari
|
|
214
|
+
|
|
6
215
|
## 5.17.3
|
|
7
216
|
|
|
8
217
|
_Sep 16, 2022_
|
|
@@ -1406,7 +1615,7 @@ We'd like to offer a big thanks to the 15 contributors who made this release pos
|
|
|
1406
1615
|
- [DataGrid] Stop checkbox ripple on blur (#3835) @m4theushw
|
|
1407
1616
|
- [DataGrid] Stop calling `onRowClick` when clicking in cells with interactive elements (#3929) @m4theushw
|
|
1408
1617
|
- [DataGrid] Use only `headerName` when available to search column (#3959) @pkratz
|
|
1409
|
-
- [DataGrid] Use the bundling scripts as the packages published by the [https://github.com/mui/material-ui
|
|
1618
|
+
- [DataGrid] Use the bundling scripts as the packages published by the [material-ui](https://github.com/mui/material-ui) repository (#3965) @flaviendelangle
|
|
1410
1619
|
- [DataGridPro] Add `unstable_setRowHeight` method to `apiRef` (#3751) @cherniavskii
|
|
1411
1620
|
- [DataGridPro] Always export the `pageSize` and `page` when it has been initialized or is being controlled (#3908) @flaviendelangle
|
|
1412
1621
|
- [DataGridPro] Disable export for detail panel column (#4057) @gustavhagland
|
|
@@ -4051,7 +4260,7 @@ Big thanks to the 7 contributors who made this release possible. Here are some h
|
|
|
4051
4260
|
|
|
4052
4261
|
- 💄 Release the cell editing feature (#1287) @dtassone
|
|
4053
4262
|
|
|
4054
|
-
This is the first release of the Cell editing feature. You can find the documentation [following this link](https://mui.com/x/react-data-grid/editing
|
|
4263
|
+
This is the first release of the Cell editing feature. You can find the documentation [following this link](https://mui.com/x/react-data-grid/editing/). We have spent the last three months working on it.
|
|
4055
4264
|
|
|
4056
4265
|

|
|
4057
4266
|
|
|
@@ -4661,7 +4870,7 @@ _Dec 9, 2020_
|
|
|
4661
4870
|
|
|
4662
4871
|
Big thanks to the 6 contributors who made this release possible. Here are some highlights ✨:
|
|
4663
4872
|
|
|
4664
|
-
- 🔍 Add a new data grid [density selector](https://mui.com/x/react-data-grid/
|
|
4873
|
+
- 🔍 Add a new data grid [density selector](https://mui.com/x/react-data-grid/accessibility/#density) feature (#606) @DanailH.
|
|
4665
4874
|
- 💄 A first iteration on the data grid's toolbar.
|
|
4666
4875
|
- 🧪 Continue the iteration on the data grid filtering feature, soon to be released @dtassone.
|
|
4667
4876
|
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { Theme } from '@mui/material/styles';
|
|
3
|
+
import { SxProps } from '@mui/system';
|
|
2
4
|
import { ExportedDayPickerProps } from './DayPicker';
|
|
3
5
|
import { PickerOnChangeFn } from '../internals/hooks/useViews';
|
|
4
6
|
import { ExportedCalendarHeaderProps, PickersCalendarHeaderSlotsComponent, PickersCalendarHeaderSlotsComponentsProps } from './PickersCalendarHeader';
|
|
@@ -14,6 +16,10 @@ export interface CalendarPickerProps<TDate> extends ExportedDayPickerProps<TDate
|
|
|
14
16
|
autoFocus?: boolean;
|
|
15
17
|
className?: string;
|
|
16
18
|
classes?: Partial<CalendarPickerClasses>;
|
|
19
|
+
/**
|
|
20
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
21
|
+
*/
|
|
22
|
+
sx?: SxProps<Theme>;
|
|
17
23
|
/**
|
|
18
24
|
* Overrideable components.
|
|
19
25
|
* @default {}
|
|
@@ -24,7 +30,7 @@ export interface CalendarPickerProps<TDate> extends ExportedDayPickerProps<TDate
|
|
|
24
30
|
* @default {}
|
|
25
31
|
*/
|
|
26
32
|
componentsProps?: Partial<CalendarPickerSlotsComponentsProps>;
|
|
27
|
-
|
|
33
|
+
value: TDate | null;
|
|
28
34
|
/**
|
|
29
35
|
* Default calendar month displayed when `value={null}`.
|
|
30
36
|
*/
|
|
@@ -89,7 +95,7 @@ export interface CalendarPickerProps<TDate> extends ExportedDayPickerProps<TDate
|
|
|
89
95
|
focusedView?: CalendarPickerView | null;
|
|
90
96
|
onFocusedViewChange?: (view: CalendarPickerView) => (newHasFocus: boolean) => void;
|
|
91
97
|
}
|
|
92
|
-
export declare type ExportedCalendarPickerProps<TDate> = Omit<CalendarPickerProps<TDate>, '
|
|
98
|
+
export declare type ExportedCalendarPickerProps<TDate> = Omit<CalendarPickerProps<TDate>, 'value' | 'view' | 'views' | 'openTo' | 'onChange' | 'changeView' | 'slideDirection' | 'currentMonth' | 'className' | 'classes' | 'components' | 'componentsProps' | 'onFocusedViewChange' | 'focusedView'>;
|
|
93
99
|
export declare type CalendarPickerDefaultizedProps<TDate> = DefaultizedProps<CalendarPickerProps<TDate>, 'views' | 'openTo' | 'loading' | 'reduceAnimations' | 'renderLoading' | keyof BaseDateValidationProps<TDate>>;
|
|
94
100
|
declare type CalendarPickerComponent = (<TDate>(props: CalendarPickerProps<TDate> & React.RefAttributes<HTMLDivElement>) => JSX.Element) & {
|
|
95
101
|
propTypes?: any;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["autoFocus", "onViewChange", "date", "disableFuture", "disablePast", "defaultCalendarMonth", "onChange", "onYearChange", "onMonthChange", "reduceAnimations", "shouldDisableDate", "shouldDisableMonth", "shouldDisableYear", "view", "views", "openTo", "className", "disabled", "readOnly", "minDate", "maxDate", "disableHighlightToday", "focusedView", "onFocusedViewChange", "classes"];
|
|
4
2
|
import * as React from 'react';
|
|
5
3
|
import PropTypes from 'prop-types';
|
|
6
4
|
import clsx from 'clsx';
|
|
@@ -68,9 +66,7 @@ const CalendarPickerViewTransitionContainer = styled(PickersFadeTransitionGroup,
|
|
|
68
66
|
name: 'MuiCalendarPicker',
|
|
69
67
|
slot: 'ViewTransitionContainer',
|
|
70
68
|
overridesResolver: (props, styles) => styles.viewTransitionContainer
|
|
71
|
-
})({
|
|
72
|
-
overflowY: 'auto'
|
|
73
|
-
});
|
|
69
|
+
})({});
|
|
74
70
|
|
|
75
71
|
/**
|
|
76
72
|
*
|
|
@@ -86,11 +82,10 @@ export const CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPic
|
|
|
86
82
|
const utils = useUtils();
|
|
87
83
|
const id = useId();
|
|
88
84
|
const props = useCalendarPickerDefaultizedProps(inProps, 'MuiCalendarPicker');
|
|
89
|
-
|
|
90
85
|
const {
|
|
91
86
|
autoFocus,
|
|
92
87
|
onViewChange,
|
|
93
|
-
|
|
88
|
+
value,
|
|
94
89
|
disableFuture,
|
|
95
90
|
disablePast,
|
|
96
91
|
defaultCalendarMonth,
|
|
@@ -111,10 +106,16 @@ export const CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPic
|
|
|
111
106
|
maxDate,
|
|
112
107
|
disableHighlightToday,
|
|
113
108
|
focusedView,
|
|
114
|
-
onFocusedViewChange
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
109
|
+
onFocusedViewChange,
|
|
110
|
+
showDaysOutsideCurrentMonth,
|
|
111
|
+
dayOfWeekFormatter,
|
|
112
|
+
renderDay,
|
|
113
|
+
components,
|
|
114
|
+
componentsProps,
|
|
115
|
+
loading,
|
|
116
|
+
renderLoading,
|
|
117
|
+
sx
|
|
118
|
+
} = props;
|
|
118
119
|
const {
|
|
119
120
|
openView,
|
|
120
121
|
setOpenView,
|
|
@@ -134,7 +135,7 @@ export const CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPic
|
|
|
134
135
|
isDateDisabled,
|
|
135
136
|
onMonthSwitchingAnimationEnd
|
|
136
137
|
} = useCalendarState({
|
|
137
|
-
|
|
138
|
+
value,
|
|
138
139
|
defaultCalendarMonth,
|
|
139
140
|
reduceAnimations,
|
|
140
141
|
onMonthChange,
|
|
@@ -144,7 +145,7 @@ export const CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPic
|
|
|
144
145
|
disablePast,
|
|
145
146
|
disableFuture
|
|
146
147
|
});
|
|
147
|
-
const handleDateMonthChange = React.useCallback(
|
|
148
|
+
const handleDateMonthChange = React.useCallback(newDate => {
|
|
148
149
|
const startOfMonth = utils.startOfMonth(newDate);
|
|
149
150
|
const endOfMonth = utils.endOfMonth(newDate);
|
|
150
151
|
const closestEnabledDate = isDateDisabled(newDate) ? findClosestEnabledDate({
|
|
@@ -158,7 +159,7 @@ export const CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPic
|
|
|
158
159
|
}) : newDate;
|
|
159
160
|
|
|
160
161
|
if (closestEnabledDate) {
|
|
161
|
-
onChange(closestEnabledDate,
|
|
162
|
+
onChange(closestEnabledDate, 'finish');
|
|
162
163
|
onMonthChange == null ? void 0 : onMonthChange(startOfMonth);
|
|
163
164
|
} else {
|
|
164
165
|
openNext();
|
|
@@ -167,7 +168,7 @@ export const CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPic
|
|
|
167
168
|
|
|
168
169
|
changeFocusedDay(closestEnabledDate, true);
|
|
169
170
|
}, [changeFocusedDay, disableFuture, disablePast, isDateDisabled, maxDate, minDate, onChange, onMonthChange, changeMonth, openNext, utils]);
|
|
170
|
-
const handleDateYearChange = React.useCallback(
|
|
171
|
+
const handleDateYearChange = React.useCallback(newDate => {
|
|
171
172
|
const startOfYear = utils.startOfYear(newDate);
|
|
172
173
|
const endOfYear = utils.endOfYear(newDate);
|
|
173
174
|
const closestEnabledDate = isDateDisabled(newDate) ? findClosestEnabledDate({
|
|
@@ -181,7 +182,7 @@ export const CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPic
|
|
|
181
182
|
}) : newDate;
|
|
182
183
|
|
|
183
184
|
if (closestEnabledDate) {
|
|
184
|
-
onChange(closestEnabledDate,
|
|
185
|
+
onChange(closestEnabledDate, 'finish');
|
|
185
186
|
onYearChange == null ? void 0 : onYearChange(closestEnabledDate);
|
|
186
187
|
} else {
|
|
187
188
|
openNext();
|
|
@@ -191,35 +192,18 @@ export const CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPic
|
|
|
191
192
|
changeFocusedDay(closestEnabledDate, true);
|
|
192
193
|
}, [changeFocusedDay, disableFuture, disablePast, isDateDisabled, maxDate, minDate, onChange, onYearChange, openNext, utils, changeMonth]);
|
|
193
194
|
const onSelectedDayChange = React.useCallback((day, isFinish) => {
|
|
194
|
-
if (
|
|
195
|
+
if (value && day) {
|
|
195
196
|
// If there is a date already selected, then we want to keep its time
|
|
196
|
-
return onChange(utils.mergeDateAndTime(day,
|
|
197
|
+
return onChange(utils.mergeDateAndTime(day, value), isFinish);
|
|
197
198
|
}
|
|
198
199
|
|
|
199
200
|
return onChange(day, isFinish);
|
|
200
|
-
}, [utils,
|
|
201
|
-
React.useEffect(() => {
|
|
202
|
-
if (date && isDateDisabled(date)) {
|
|
203
|
-
const closestEnabledDate = findClosestEnabledDate({
|
|
204
|
-
utils,
|
|
205
|
-
date,
|
|
206
|
-
minDate,
|
|
207
|
-
maxDate,
|
|
208
|
-
disablePast,
|
|
209
|
-
disableFuture,
|
|
210
|
-
isDateDisabled
|
|
211
|
-
});
|
|
212
|
-
onChange(closestEnabledDate, 'partial');
|
|
213
|
-
} // This call is too expensive to run it on each prop change.
|
|
214
|
-
// So just ensure that we are not rendering disabled as selected on mount.
|
|
215
|
-
|
|
216
|
-
}, []); // eslint-disable-line
|
|
217
|
-
|
|
201
|
+
}, [utils, value, onChange]);
|
|
218
202
|
React.useEffect(() => {
|
|
219
|
-
if (
|
|
220
|
-
changeMonth(
|
|
203
|
+
if (value != null && utils.isValid(value)) {
|
|
204
|
+
changeMonth(value);
|
|
221
205
|
}
|
|
222
|
-
}, [
|
|
206
|
+
}, [value]); // eslint-disable-line
|
|
223
207
|
|
|
224
208
|
const ownerState = props;
|
|
225
209
|
const classes = useUtilityClasses(ownerState);
|
|
@@ -230,8 +214,8 @@ export const CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPic
|
|
|
230
214
|
minDate
|
|
231
215
|
}; // When disabled, limit the view to the selected date
|
|
232
216
|
|
|
233
|
-
const minDateWithDisabled = disabled &&
|
|
234
|
-
const maxDateWithDisabled = disabled &&
|
|
217
|
+
const minDateWithDisabled = disabled && value || minDate;
|
|
218
|
+
const maxDateWithDisabled = disabled && value || maxDate;
|
|
235
219
|
const commonViewProps = {
|
|
236
220
|
disableHighlightToday,
|
|
237
221
|
readOnly,
|
|
@@ -259,11 +243,16 @@ export const CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPic
|
|
|
259
243
|
setInternalFocusedView(prevView => prevView === eventView ? null : prevView);
|
|
260
244
|
}
|
|
261
245
|
});
|
|
246
|
+
React.useEffect(() => {
|
|
247
|
+
// Set focus to the button when switching from a view to another
|
|
248
|
+
handleFocusedViewChange(openView)(true);
|
|
249
|
+
}, [openView, handleFocusedViewChange]);
|
|
262
250
|
return /*#__PURE__*/_jsxs(CalendarPickerRoot, {
|
|
263
251
|
ref: ref,
|
|
264
252
|
className: clsx(classes.root, className),
|
|
265
253
|
ownerState: ownerState,
|
|
266
|
-
|
|
254
|
+
sx: sx,
|
|
255
|
+
children: [/*#__PURE__*/_jsx(PickersCalendarHeader, {
|
|
267
256
|
views: views,
|
|
268
257
|
openView: openView,
|
|
269
258
|
currentMonth: calendarState.currentMonth,
|
|
@@ -278,16 +267,18 @@ export const CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPic
|
|
|
278
267
|
disablePast: disablePast,
|
|
279
268
|
disableFuture: disableFuture,
|
|
280
269
|
reduceAnimations: reduceAnimations,
|
|
281
|
-
labelId: gridLabelId
|
|
282
|
-
|
|
270
|
+
labelId: gridLabelId,
|
|
271
|
+
components: components,
|
|
272
|
+
componentsProps: componentsProps
|
|
273
|
+
}), /*#__PURE__*/_jsx(CalendarPickerViewTransitionContainer, {
|
|
283
274
|
reduceAnimations: reduceAnimations,
|
|
284
275
|
className: classes.viewTransitionContainer,
|
|
285
276
|
transKey: openView,
|
|
286
277
|
ownerState: ownerState,
|
|
287
278
|
children: /*#__PURE__*/_jsxs("div", {
|
|
288
|
-
children: [openView === 'year' && /*#__PURE__*/_jsx(YearPicker, _extends({},
|
|
279
|
+
children: [openView === 'year' && /*#__PURE__*/_jsx(YearPicker, _extends({}, baseDateValidationProps, commonViewProps, {
|
|
289
280
|
autoFocus: autoFocus,
|
|
290
|
-
|
|
281
|
+
value: value,
|
|
291
282
|
onChange: handleDateYearChange,
|
|
292
283
|
shouldDisableYear: shouldDisableYear,
|
|
293
284
|
hasFocus: hasFocus,
|
|
@@ -296,21 +287,28 @@ export const CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPic
|
|
|
296
287
|
autoFocus: autoFocus,
|
|
297
288
|
hasFocus: hasFocus,
|
|
298
289
|
className: className,
|
|
299
|
-
|
|
290
|
+
value: value,
|
|
300
291
|
onChange: handleDateMonthChange,
|
|
301
292
|
shouldDisableMonth: shouldDisableMonth,
|
|
302
293
|
onFocusedViewChange: handleFocusedViewChange('month')
|
|
303
|
-
})), openView === 'day' && /*#__PURE__*/_jsx(DayPicker, _extends({},
|
|
294
|
+
})), openView === 'day' && /*#__PURE__*/_jsx(DayPicker, _extends({}, calendarState, baseDateValidationProps, commonViewProps, {
|
|
304
295
|
autoFocus: autoFocus,
|
|
305
296
|
onMonthSwitchingAnimationEnd: onMonthSwitchingAnimationEnd,
|
|
306
297
|
onFocusedDayChange: changeFocusedDay,
|
|
307
298
|
reduceAnimations: reduceAnimations,
|
|
308
|
-
selectedDays: [
|
|
299
|
+
selectedDays: [value],
|
|
309
300
|
onSelectedDaysChange: onSelectedDayChange,
|
|
310
301
|
shouldDisableDate: shouldDisableDate,
|
|
302
|
+
shouldDisableMonth: shouldDisableMonth,
|
|
303
|
+
shouldDisableYear: shouldDisableYear,
|
|
311
304
|
hasFocus: hasFocus,
|
|
312
305
|
onFocusedViewChange: handleFocusedViewChange('day'),
|
|
313
|
-
gridLabelId: gridLabelId
|
|
306
|
+
gridLabelId: gridLabelId,
|
|
307
|
+
showDaysOutsideCurrentMonth: showDaysOutsideCurrentMonth,
|
|
308
|
+
dayOfWeekFormatter: dayOfWeekFormatter,
|
|
309
|
+
renderDay: renderDay,
|
|
310
|
+
loading: loading,
|
|
311
|
+
renderLoading: renderLoading
|
|
314
312
|
}))]
|
|
315
313
|
})
|
|
316
314
|
})]
|
|
@@ -336,7 +334,6 @@ process.env.NODE_ENV !== "production" ? CalendarPicker.propTypes = {
|
|
|
336
334
|
* @default {}
|
|
337
335
|
*/
|
|
338
336
|
componentsProps: PropTypes.object,
|
|
339
|
-
date: PropTypes.any,
|
|
340
337
|
|
|
341
338
|
/**
|
|
342
339
|
* Formats the day of week displayed in the calendar header.
|
|
@@ -376,20 +373,6 @@ process.env.NODE_ENV !== "production" ? CalendarPicker.propTypes = {
|
|
|
376
373
|
disablePast: PropTypes.bool,
|
|
377
374
|
focusedView: PropTypes.oneOf(['day', 'month', 'year']),
|
|
378
375
|
|
|
379
|
-
/**
|
|
380
|
-
* Get aria-label text for switching between views button.
|
|
381
|
-
* @param {CalendarPickerView} currentView The view from which we want to get the button text.
|
|
382
|
-
* @returns {string} The label of the view.
|
|
383
|
-
* @deprecated Use the `localeText` prop of `LocalizationProvider` instead, see https://mui.com/x/react-date-pickers/localization
|
|
384
|
-
*/
|
|
385
|
-
getViewSwitchingButtonText: PropTypes.func,
|
|
386
|
-
|
|
387
|
-
/**
|
|
388
|
-
* Left arrow icon aria-label text.
|
|
389
|
-
* @deprecated
|
|
390
|
-
*/
|
|
391
|
-
leftArrowButtonText: PropTypes.string,
|
|
392
|
-
|
|
393
376
|
/**
|
|
394
377
|
* If `true` renders `LoadingComponent` in calendar instead of calendar view.
|
|
395
378
|
* Can be used to preload information and show it in calendar.
|
|
@@ -469,12 +452,6 @@ process.env.NODE_ENV !== "production" ? CalendarPicker.propTypes = {
|
|
|
469
452
|
*/
|
|
470
453
|
renderLoading: PropTypes.func,
|
|
471
454
|
|
|
472
|
-
/**
|
|
473
|
-
* Right arrow icon aria-label text.
|
|
474
|
-
* @deprecated
|
|
475
|
-
*/
|
|
476
|
-
rightArrowButtonText: PropTypes.string,
|
|
477
|
-
|
|
478
455
|
/**
|
|
479
456
|
* Disable specific date. @DateIOType
|
|
480
457
|
* @template TDate
|
|
@@ -507,6 +484,12 @@ process.env.NODE_ENV !== "production" ? CalendarPicker.propTypes = {
|
|
|
507
484
|
*/
|
|
508
485
|
showDaysOutsideCurrentMonth: PropTypes.bool,
|
|
509
486
|
|
|
487
|
+
/**
|
|
488
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
489
|
+
*/
|
|
490
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
491
|
+
value: PropTypes.any,
|
|
492
|
+
|
|
510
493
|
/**
|
|
511
494
|
* Controlled open view.
|
|
512
495
|
*/
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { PickersDayProps } from '../PickersDay/PickersDay';
|
|
3
3
|
import { PickerOnChangeFn } from '../internals/hooks/useViews';
|
|
4
4
|
import { SlideDirection, SlideTransitionProps } from './PickersSlideTransition';
|
|
5
|
-
import { BaseDateValidationProps, DayValidationProps } from '../internals/hooks/validation/models';
|
|
5
|
+
import { BaseDateValidationProps, DayValidationProps, MonthValidationProps, YearValidationProps } from '../internals/hooks/validation/models';
|
|
6
6
|
import { DayPickerClasses } from './dayPickerClasses';
|
|
7
7
|
export interface ExportedDayPickerProps<TDate> extends Pick<PickersDayProps<TDate>, 'disableHighlightToday' | 'showDaysOutsideCurrentMonth'> {
|
|
8
8
|
/**
|
|
@@ -34,7 +34,7 @@ export interface ExportedDayPickerProps<TDate> extends Pick<PickersDayProps<TDat
|
|
|
34
34
|
*/
|
|
35
35
|
dayOfWeekFormatter?: (day: string) => string;
|
|
36
36
|
}
|
|
37
|
-
export interface DayPickerProps<TDate> extends ExportedDayPickerProps<TDate>, DayValidationProps<TDate>, Required<BaseDateValidationProps<TDate>> {
|
|
37
|
+
export interface DayPickerProps<TDate> extends ExportedDayPickerProps<TDate>, DayValidationProps<TDate>, MonthValidationProps<TDate>, YearValidationProps<TDate>, Required<BaseDateValidationProps<TDate>> {
|
|
38
38
|
autoFocus?: boolean;
|
|
39
39
|
className?: string;
|
|
40
40
|
currentMonth: TDate;
|
|
@@ -8,7 +8,7 @@ import { PickersDay } from '../PickersDay/PickersDay';
|
|
|
8
8
|
import { useUtils, useNow } from '../internals/hooks/useUtils';
|
|
9
9
|
import { DAY_SIZE, DAY_MARGIN } from '../internals/constants/dimensions';
|
|
10
10
|
import { PickersSlideTransition } from './PickersSlideTransition';
|
|
11
|
-
import {
|
|
11
|
+
import { useIsDateDisabled } from '../internals/hooks/validation/useDateValidation';
|
|
12
12
|
import { findClosestEnabledDate } from '../internals/utils/date-utils';
|
|
13
13
|
import { getDayPickerUtilityClass } from './dayPickerClasses';
|
|
14
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -128,13 +128,17 @@ export function DayPicker(inProps) {
|
|
|
128
128
|
minDate,
|
|
129
129
|
maxDate,
|
|
130
130
|
shouldDisableDate,
|
|
131
|
+
shouldDisableMonth,
|
|
132
|
+
shouldDisableYear,
|
|
131
133
|
dayOfWeekFormatter = defaultDayOfWeekFormatter,
|
|
132
134
|
hasFocus,
|
|
133
135
|
onFocusedViewChange,
|
|
134
136
|
gridLabelId
|
|
135
137
|
} = props;
|
|
136
|
-
const isDateDisabled =
|
|
138
|
+
const isDateDisabled = useIsDateDisabled({
|
|
137
139
|
shouldDisableDate,
|
|
140
|
+
shouldDisableMonth,
|
|
141
|
+
shouldDisableYear,
|
|
138
142
|
minDate,
|
|
139
143
|
maxDate,
|
|
140
144
|
disablePast,
|
|
@@ -2,10 +2,10 @@ import * as React from 'react';
|
|
|
2
2
|
import IconButton from '@mui/material/IconButton';
|
|
3
3
|
import { SlideDirection } from './PickersSlideTransition';
|
|
4
4
|
import { ExportedDateValidationProps } from '../internals/hooks/validation/useDateValidation';
|
|
5
|
-
import {
|
|
5
|
+
import { ExportedPickersArrowSwitcherProps, PickersArrowSwitcherSlotsComponent, PickersArrowSwitcherSlotsComponentsProps } from '../internals/components/PickersArrowSwitcher';
|
|
6
6
|
import { CalendarPickerView } from '../internals/models';
|
|
7
7
|
import { PickersCalendarHeaderClasses } from './pickersCalendarHeaderClasses';
|
|
8
|
-
export declare type ExportedCalendarHeaderProps<TDate> = Pick<PickersCalendarHeaderProps<TDate>, '
|
|
8
|
+
export declare type ExportedCalendarHeaderProps<TDate> = Pick<PickersCalendarHeaderProps<TDate>, 'classes'>;
|
|
9
9
|
export interface PickersCalendarHeaderSlotsComponent extends PickersArrowSwitcherSlotsComponent {
|
|
10
10
|
/**
|
|
11
11
|
* Button displayed to switch between different calendar views.
|
|
@@ -23,7 +23,7 @@ export interface PickersCalendarHeaderComponentsPropsOverrides {
|
|
|
23
23
|
export interface PickersCalendarHeaderSlotsComponentsProps extends PickersArrowSwitcherSlotsComponentsProps {
|
|
24
24
|
switchViewButton: React.ComponentPropsWithRef<typeof IconButton> & PickersCalendarHeaderComponentsPropsOverrides;
|
|
25
25
|
}
|
|
26
|
-
export interface PickersCalendarHeaderProps<TDate> extends
|
|
26
|
+
export interface PickersCalendarHeaderProps<TDate> extends ExportedPickersArrowSwitcherProps, Omit<ExportedDateValidationProps<TDate>, 'shouldDisableDate'> {
|
|
27
27
|
/**
|
|
28
28
|
* Overrideable components.
|
|
29
29
|
* @default {}
|
|
@@ -37,13 +37,6 @@ export interface PickersCalendarHeaderProps<TDate> extends ExportedArrowSwitcher
|
|
|
37
37
|
currentMonth: TDate;
|
|
38
38
|
disabled?: boolean;
|
|
39
39
|
views: readonly CalendarPickerView[];
|
|
40
|
-
/**
|
|
41
|
-
* Get aria-label text for switching between views button.
|
|
42
|
-
* @param {CalendarPickerView} currentView The view from which we want to get the button text.
|
|
43
|
-
* @returns {string} The label of the view.
|
|
44
|
-
* @deprecated Use the `localeText` prop of `LocalizationProvider` instead, see https://mui.com/x/react-date-pickers/localization
|
|
45
|
-
*/
|
|
46
|
-
getViewSwitchingButtonText?: (currentView: CalendarPickerView) => string;
|
|
47
40
|
onMonthChange: (date: TDate, slideDirection: SlideDirection) => void;
|
|
48
41
|
openView: CalendarPickerView;
|
|
49
42
|
reduceAnimations: boolean;
|