@mui/x-date-pickers 5.0.0-alpha.3 → 5.0.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +237 -16
- package/CalendarPicker/CalendarPicker.d.ts +18 -30
- package/CalendarPicker/CalendarPicker.js +90 -44
- package/CalendarPicker/DayPicker.d.ts +2 -2
- package/CalendarPicker/DayPicker.js +16 -4
- package/CalendarPicker/PickersCalendarHeader.d.ts +3 -3
- package/CalendarPicker/PickersCalendarHeader.js +15 -9
- package/CalendarPicker/index.d.ts +1 -1
- package/CalendarPicker/useCalendarState.d.ts +2 -2
- package/CalendarPicker/useCalendarState.js +9 -9
- package/ClockPicker/ClockPicker.d.ts +10 -3
- package/ClockPicker/ClockPicker.js +40 -38
- package/DatePicker/DatePicker.d.ts +17 -3
- package/DatePicker/DatePicker.js +16 -56
- package/DatePicker/DatePickerToolbar.d.ts +1 -0
- package/DatePicker/DatePickerToolbar.js +16 -7
- package/DatePicker/shared.d.ts +2 -10
- package/DatePicker/shared.js +0 -2
- package/DateTimePicker/DateTimePicker.d.ts +17 -3
- package/DateTimePicker/DateTimePicker.js +17 -56
- package/DateTimePicker/DateTimePickerTabs.js +4 -2
- package/DateTimePicker/DateTimePickerToolbar.d.ts +1 -0
- package/DateTimePicker/DateTimePickerToolbar.js +37 -11
- package/DateTimePicker/shared.d.ts +2 -10
- package/DateTimePicker/shared.js +0 -1
- package/DesktopDatePicker/DesktopDatePicker.d.ts +17 -2
- package/DesktopDatePicker/DesktopDatePicker.js +24 -28
- package/DesktopDatePicker/index.d.ts +1 -1
- package/DesktopDateTimePicker/DesktopDateTimePicker.d.ts +17 -1
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +25 -28
- package/DesktopDateTimePicker/index.d.ts +1 -1
- package/DesktopTimePicker/DesktopTimePicker.d.ts +17 -1
- package/DesktopTimePicker/DesktopTimePicker.js +19 -20
- package/DesktopTimePicker/index.d.ts +1 -1
- package/LocalizationProvider/LocalizationProvider.d.ts +13 -2
- package/LocalizationProvider/LocalizationProvider.js +38 -7
- package/MobileDatePicker/MobileDatePicker.d.ts +16 -1
- package/MobileDatePicker/MobileDatePicker.js +25 -49
- package/MobileDatePicker/index.d.ts +1 -1
- package/MobileDateTimePicker/MobileDateTimePicker.d.ts +17 -1
- package/MobileDateTimePicker/MobileDateTimePicker.js +26 -49
- package/MobileDateTimePicker/index.d.ts +1 -1
- package/MobileTimePicker/MobileTimePicker.d.ts +17 -1
- package/MobileTimePicker/MobileTimePicker.js +20 -41
- package/MobileTimePicker/index.d.ts +1 -1
- package/MonthPicker/MonthPicker.d.ts +4 -28
- package/MonthPicker/MonthPicker.js +18 -27
- package/PickersActionBar/PickersActionBar.d.ts +16 -0
- package/PickersActionBar/PickersActionBar.js +56 -0
- package/PickersActionBar/index.d.ts +2 -0
- package/PickersActionBar/index.js +1 -0
- package/PickersActionBar/package.json +6 -0
- package/PickersDay/PickersDay.d.ts +1 -1
- package/PickersDay/PickersDay.js +1 -1
- package/README.md +44 -4
- package/StaticDatePicker/StaticDatePicker.d.ts +19 -1
- package/StaticDatePicker/StaticDatePicker.js +30 -17
- package/StaticDateTimePicker/StaticDateTimePicker.d.ts +19 -1
- package/StaticDateTimePicker/StaticDateTimePicker.js +32 -17
- package/StaticTimePicker/StaticTimePicker.d.ts +19 -1
- package/StaticTimePicker/StaticTimePicker.js +26 -10
- package/TimePicker/TimePicker.d.ts +17 -3
- package/TimePicker/TimePicker.js +11 -48
- package/TimePicker/TimePickerToolbar.js +24 -9
- package/TimePicker/shared.d.ts +1 -0
- package/TimePicker/shared.js +4 -8
- package/TimePicker/timePickerToolbarClasses.d.ts +0 -1
- package/TimePicker/timePickerToolbarClasses.js +2 -2
- package/YearPicker/YearPicker.d.ts +4 -24
- package/YearPicker/YearPicker.js +53 -49
- package/index.d.ts +2 -0
- package/index.js +4 -2
- package/internals/components/CalendarOrClockPicker/CalendarOrClockPicker.d.ts +2 -3
- package/internals/components/CalendarOrClockPicker/index.d.ts +1 -0
- package/internals/components/KeyboardDateInput.js +4 -3
- package/internals/components/PickerStaticWrapper/PickerStaticWrapper.d.ts +24 -2
- package/internals/components/PickerStaticWrapper/PickerStaticWrapper.js +78 -7
- package/internals/components/PickerStaticWrapper/pickerStaticWrapperClasses.d.ts +2 -0
- package/internals/components/PickerStaticWrapper/pickerStaticWrapperClasses.js +1 -1
- package/internals/components/PickersArrowSwitcher.d.ts +4 -3
- package/internals/components/PickersArrowSwitcher.js +8 -8
- package/internals/components/PickersModalDialog.d.ts +18 -36
- package/internals/components/PickersModalDialog.js +13 -35
- package/internals/components/PickersPopper.d.ts +13 -12
- package/internals/components/PickersPopper.js +27 -23
- package/internals/components/PickersToolbar.d.ts +1 -1
- package/internals/components/PickersToolbar.js +23 -9
- package/internals/components/PureDateInput.d.ts +3 -3
- package/internals/components/PureDateInput.js +7 -3
- package/internals/components/wrappers/DesktopTooltipWrapper.js +11 -5
- package/internals/components/wrappers/DesktopWrapper.d.ts +16 -1
- package/internals/components/wrappers/DesktopWrapper.js +9 -5
- package/internals/components/wrappers/MobileWrapper.d.ts +8 -1
- package/internals/components/wrappers/MobileWrapper.js +8 -14
- package/internals/hooks/useMaskedInput.js +32 -31
- package/internals/hooks/useUtils.d.ts +3 -0
- package/internals/hooks/useUtils.js +2 -3
- package/internals/hooks/useViews.d.ts +1 -0
- package/internals/hooks/validation/models.d.ts +61 -0
- package/internals/hooks/validation/models.js +1 -0
- package/internals/hooks/validation/useDateTimeValidation.js +23 -11
- package/internals/hooks/validation/useDateValidation.d.ts +3 -26
- package/internals/hooks/validation/useDateValidation.js +40 -13
- package/internals/hooks/validation/useTimeValidation.js +18 -13
- package/internals/hooks/validation/useValidation.d.ts +6 -2
- package/internals/hooks/validation/useValidation.js +7 -3
- package/internals/index.d.ts +6 -4
- package/internals/index.js +3 -2
- package/internals/utils/date-utils.d.ts +4 -4
- package/internals/utils/date-utils.js +4 -4
- package/internals/utils/text-field-helper.d.ts +1 -1
- package/internals/utils/text-field-helper.js +29 -14
- package/internals/utils/utils.d.ts +0 -1
- package/internals/utils/utils.js +0 -9
- package/internals/utils/warning.d.ts +3 -0
- package/internals/utils/warning.js +17 -0
- package/legacy/CalendarPicker/CalendarPicker.js +91 -46
- package/legacy/CalendarPicker/DayPicker.js +16 -4
- package/legacy/CalendarPicker/PickersCalendarHeader.js +15 -12
- package/legacy/CalendarPicker/useCalendarState.js +11 -13
- package/legacy/ClockPicker/ClockPicker.js +42 -52
- package/legacy/DatePicker/DatePicker.js +17 -57
- package/legacy/DatePicker/DatePickerToolbar.js +19 -6
- package/legacy/DatePicker/shared.js +0 -2
- package/legacy/DateTimePicker/DateTimePicker.js +18 -57
- package/legacy/DateTimePicker/DateTimePickerTabs.js +4 -2
- package/legacy/DateTimePicker/DateTimePickerToolbar.js +45 -11
- package/legacy/DateTimePicker/shared.js +0 -1
- package/legacy/DesktopDatePicker/DesktopDatePicker.js +24 -28
- package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +25 -28
- package/legacy/DesktopTimePicker/DesktopTimePicker.js +19 -20
- package/legacy/LocalizationProvider/LocalizationProvider.js +38 -7
- package/legacy/MobileDatePicker/MobileDatePicker.js +24 -48
- package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +25 -48
- package/legacy/MobileTimePicker/MobileTimePicker.js +19 -40
- package/legacy/MonthPicker/MonthPicker.js +20 -27
- package/legacy/PickersActionBar/PickersActionBar.js +54 -0
- package/legacy/PickersActionBar/index.js +1 -0
- package/legacy/PickersDay/PickersDay.js +1 -1
- package/legacy/StaticDatePicker/StaticDatePicker.js +29 -16
- package/legacy/StaticDateTimePicker/StaticDateTimePicker.js +31 -16
- package/legacy/StaticTimePicker/StaticTimePicker.js +25 -9
- package/legacy/TimePicker/TimePicker.js +12 -49
- package/legacy/TimePicker/TimePickerToolbar.js +31 -8
- package/legacy/TimePicker/shared.js +4 -8
- package/legacy/TimePicker/timePickerToolbarClasses.js +2 -2
- package/legacy/YearPicker/YearPicker.js +57 -50
- package/legacy/index.js +4 -2
- package/legacy/internals/components/KeyboardDateInput.js +4 -4
- package/legacy/internals/components/PickerStaticWrapper/PickerStaticWrapper.js +81 -6
- package/legacy/internals/components/PickerStaticWrapper/pickerStaticWrapperClasses.js +1 -1
- package/legacy/internals/components/PickersArrowSwitcher.js +8 -10
- package/legacy/internals/components/PickersModalDialog.js +14 -43
- package/legacy/internals/components/PickersPopper.js +30 -29
- package/legacy/internals/components/PickersToolbar.js +29 -9
- package/legacy/internals/components/PureDateInput.js +7 -4
- package/legacy/internals/components/wrappers/DesktopTooltipWrapper.js +11 -5
- package/legacy/internals/components/wrappers/DesktopWrapper.js +9 -5
- package/legacy/internals/components/wrappers/MobileWrapper.js +9 -15
- package/legacy/internals/hooks/useMaskedInput.js +40 -40
- package/legacy/internals/hooks/useUtils.js +4 -3
- package/legacy/internals/hooks/validation/models.js +1 -0
- package/legacy/internals/hooks/validation/useDateTimeValidation.js +26 -14
- package/legacy/internals/hooks/validation/useDateValidation.js +41 -13
- package/legacy/internals/hooks/validation/useTimeValidation.js +16 -13
- package/legacy/internals/hooks/validation/useValidation.js +7 -3
- package/legacy/internals/index.js +3 -2
- package/legacy/internals/utils/date-utils.js +4 -4
- package/legacy/internals/utils/text-field-helper.js +29 -14
- package/legacy/internals/utils/utils.js +0 -9
- package/legacy/internals/utils/warning.js +29 -0
- package/legacy/locales/deDE.js +31 -0
- package/legacy/locales/enUS.js +46 -0
- package/legacy/locales/frFR.js +31 -0
- package/legacy/locales/index.js +6 -0
- package/legacy/locales/ptBR.js +44 -0
- package/legacy/locales/trTR.js +32 -0
- package/legacy/locales/utils/getPickersLocalization.js +12 -0
- package/legacy/locales/utils/pickersLocaleTextApi.js +1 -0
- package/locales/deDE.d.ts +29 -0
- package/locales/deDE.js +31 -0
- package/locales/enUS.d.ts +32 -0
- package/locales/enUS.js +32 -0
- package/locales/frFR.d.ts +29 -0
- package/locales/frFR.js +31 -0
- package/locales/index.d.ts +6 -0
- package/locales/index.js +6 -0
- package/locales/package.json +6 -0
- package/locales/ptBR.d.ts +30 -0
- package/locales/ptBR.js +30 -0
- package/locales/trTR.d.ts +29 -0
- package/locales/trTR.js +32 -0
- package/locales/utils/getPickersLocalization.d.ts +30 -0
- package/locales/utils/getPickersLocalization.js +12 -0
- package/locales/utils/pickersLocaleTextApi.d.ts +26 -0
- package/locales/utils/pickersLocaleTextApi.js +1 -0
- package/modern/CalendarPicker/CalendarPicker.js +90 -44
- package/modern/CalendarPicker/DayPicker.js +16 -4
- package/modern/CalendarPicker/PickersCalendarHeader.js +15 -9
- package/modern/CalendarPicker/useCalendarState.js +9 -9
- package/modern/ClockPicker/ClockPicker.js +40 -38
- package/modern/DatePicker/DatePicker.js +16 -56
- package/modern/DatePicker/DatePickerToolbar.js +16 -7
- package/modern/DatePicker/shared.js +0 -2
- package/modern/DateTimePicker/DateTimePicker.js +17 -56
- package/modern/DateTimePicker/DateTimePickerTabs.js +4 -2
- package/modern/DateTimePicker/DateTimePickerToolbar.js +37 -11
- package/modern/DateTimePicker/shared.js +0 -1
- package/modern/DesktopDatePicker/DesktopDatePicker.js +24 -28
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +25 -28
- package/modern/DesktopTimePicker/DesktopTimePicker.js +19 -20
- package/modern/LocalizationProvider/LocalizationProvider.js +38 -7
- package/modern/MobileDatePicker/MobileDatePicker.js +25 -49
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +26 -49
- package/modern/MobileTimePicker/MobileTimePicker.js +20 -41
- package/modern/MonthPicker/MonthPicker.js +18 -27
- package/modern/PickersActionBar/PickersActionBar.js +56 -0
- package/modern/PickersActionBar/index.js +1 -0
- package/modern/PickersDay/PickersDay.js +1 -1
- package/modern/StaticDatePicker/StaticDatePicker.js +30 -17
- package/modern/StaticDateTimePicker/StaticDateTimePicker.js +32 -17
- package/modern/StaticTimePicker/StaticTimePicker.js +26 -10
- package/modern/TimePicker/TimePicker.js +11 -48
- package/modern/TimePicker/TimePickerToolbar.js +24 -9
- package/modern/TimePicker/shared.js +4 -8
- package/modern/TimePicker/timePickerToolbarClasses.js +2 -2
- package/modern/YearPicker/YearPicker.js +53 -49
- package/modern/index.js +4 -2
- package/modern/internals/components/KeyboardDateInput.js +4 -3
- package/modern/internals/components/PickerStaticWrapper/PickerStaticWrapper.js +76 -7
- package/modern/internals/components/PickerStaticWrapper/pickerStaticWrapperClasses.js +1 -1
- package/modern/internals/components/PickersArrowSwitcher.js +8 -8
- package/modern/internals/components/PickersModalDialog.js +11 -35
- package/modern/internals/components/PickersPopper.js +25 -23
- package/modern/internals/components/PickersToolbar.js +23 -9
- package/modern/internals/components/PureDateInput.js +7 -3
- package/modern/internals/components/wrappers/DesktopTooltipWrapper.js +11 -5
- package/modern/internals/components/wrappers/DesktopWrapper.js +9 -5
- package/modern/internals/components/wrappers/MobileWrapper.js +8 -14
- package/modern/internals/hooks/useMaskedInput.js +32 -31
- package/modern/internals/hooks/useUtils.js +2 -3
- package/modern/internals/hooks/validation/models.js +1 -0
- package/modern/internals/hooks/validation/useDateTimeValidation.js +23 -11
- package/modern/internals/hooks/validation/useDateValidation.js +40 -13
- package/modern/internals/hooks/validation/useTimeValidation.js +18 -13
- package/modern/internals/hooks/validation/useValidation.js +7 -3
- package/modern/internals/index.js +3 -2
- package/modern/internals/utils/date-utils.js +4 -4
- package/modern/internals/utils/text-field-helper.js +29 -14
- package/modern/internals/utils/utils.js +0 -9
- package/modern/internals/utils/warning.js +17 -0
- package/modern/locales/deDE.js +31 -0
- package/modern/locales/enUS.js +32 -0
- package/modern/locales/frFR.js +31 -0
- package/modern/locales/index.js +6 -0
- package/modern/locales/ptBR.js +30 -0
- package/modern/locales/trTR.js +32 -0
- package/modern/locales/utils/getPickersLocalization.js +12 -0
- package/modern/locales/utils/pickersLocaleTextApi.js +1 -0
- package/node/CalendarPicker/CalendarPicker.js +90 -44
- package/node/CalendarPicker/DayPicker.js +17 -4
- package/node/CalendarPicker/PickersCalendarHeader.js +15 -8
- package/node/CalendarPicker/useCalendarState.js +8 -8
- package/node/ClockPicker/ClockPicker.js +40 -37
- package/node/DatePicker/DatePicker.js +16 -56
- package/node/DatePicker/DatePickerToolbar.js +17 -7
- package/node/DatePicker/shared.js +0 -2
- package/node/DateTimePicker/DateTimePicker.js +17 -56
- package/node/DateTimePicker/DateTimePickerTabs.js +5 -2
- package/node/DateTimePicker/DateTimePickerToolbar.js +38 -11
- package/node/DateTimePicker/shared.js +0 -1
- package/node/DesktopDatePicker/DesktopDatePicker.js +24 -28
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +25 -28
- package/node/DesktopTimePicker/DesktopTimePicker.js +19 -20
- package/node/LocalizationProvider/LocalizationProvider.js +41 -7
- package/node/MobileDatePicker/MobileDatePicker.js +25 -49
- package/node/MobileDateTimePicker/MobileDateTimePicker.js +26 -49
- package/node/MobileTimePicker/MobileTimePicker.js +20 -41
- package/node/MonthPicker/MonthPicker.js +17 -26
- package/node/PickersActionBar/PickersActionBar.js +77 -0
- package/node/PickersActionBar/index.js +13 -0
- package/node/PickersDay/PickersDay.js +1 -1
- package/node/StaticDatePicker/StaticDatePicker.js +30 -17
- package/node/StaticDateTimePicker/StaticDateTimePicker.js +32 -17
- package/node/StaticTimePicker/StaticTimePicker.js +26 -10
- package/node/TimePicker/TimePicker.js +11 -48
- package/node/TimePicker/TimePickerToolbar.js +23 -9
- package/node/TimePicker/shared.js +3 -6
- package/node/TimePicker/timePickerToolbarClasses.js +2 -2
- package/node/YearPicker/YearPicker.js +52 -49
- package/node/index.js +46 -2
- package/node/internals/components/KeyboardDateInput.js +3 -3
- package/node/internals/components/PickerStaticWrapper/PickerStaticWrapper.js +76 -6
- package/node/internals/components/PickerStaticWrapper/pickerStaticWrapperClasses.js +1 -1
- package/node/internals/components/PickersArrowSwitcher.js +8 -8
- package/node/internals/components/PickersModalDialog.js +14 -37
- package/node/internals/components/PickersPopper.js +28 -24
- package/node/internals/components/PickersToolbar.js +25 -10
- package/node/internals/components/PureDateInput.js +5 -1
- package/node/internals/components/wrappers/DesktopTooltipWrapper.js +11 -5
- package/node/internals/components/wrappers/DesktopWrapper.js +9 -5
- package/node/internals/components/wrappers/MobileWrapper.js +8 -14
- package/node/internals/hooks/useMaskedInput.js +33 -33
- package/node/internals/hooks/useUtils.js +7 -1
- package/node/internals/hooks/validation/models.js +5 -0
- package/node/internals/hooks/validation/useDateTimeValidation.js +23 -11
- package/node/internals/hooks/validation/useDateValidation.js +50 -14
- package/node/internals/hooks/validation/useTimeValidation.js +18 -13
- package/node/internals/hooks/validation/useValidation.js +6 -2
- package/node/internals/index.js +20 -0
- package/node/internals/utils/date-utils.js +4 -4
- package/node/internals/utils/text-field-helper.js +31 -16
- package/node/internals/utils/utils.js +0 -11
- package/node/internals/utils/warning.js +26 -0
- package/node/locales/deDE.js +40 -0
- package/node/locales/enUS.js +42 -0
- package/node/locales/frFR.js +40 -0
- package/node/locales/index.js +83 -0
- package/node/locales/ptBR.js +39 -0
- package/node/locales/trTR.js +41 -0
- package/node/locales/utils/getPickersLocalization.js +24 -0
- package/node/locales/utils/pickersLocaleTextApi.js +5 -0
- package/package.json +9 -10
package/CHANGELOG.md
CHANGED
|
@@ -3,21 +3,247 @@
|
|
|
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
|
+
## v5.12.1
|
|
7
|
+
|
|
8
|
+
_Jun 9, 2022_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 10 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🎁 Add `reason` to `onFilterModelChange` (#4938) @m4theushw
|
|
13
|
+
- 🔎 Control quick filter input value via model prop (#5013) @alexfauquette
|
|
14
|
+
- 📚 Documentation improvements
|
|
15
|
+
- 🐞 Bugfixes
|
|
16
|
+
|
|
17
|
+
### `@mui/x-data-grid@v5.12.1` / `@mui/x-data-grid-pro@v5.12.1` / `@mui/x-data-grid-premium@v5.12.1`
|
|
18
|
+
|
|
19
|
+
#### Changes
|
|
20
|
+
|
|
21
|
+
- [DataGrid] Add `reason` to `onFilterModelChange` (#4938) @m4theushw
|
|
22
|
+
- [DataGrid] Restore focus after dismissing the column menu (#5027) @m4theushw
|
|
23
|
+
- [DataGrid] Update quick filter input when model is modified (#5013) @alexfauquette
|
|
24
|
+
- [DataGrid] Fix implicit dependency on react-dom (#5121) @oliviertassinari
|
|
25
|
+
- [DataGrid] Support `getRowId` in row reordering (#5093) @flaviendelangle
|
|
26
|
+
- [DataGridPro] Fix column resizing in RTL mode (#4989) @cherniavskii
|
|
27
|
+
- [DataGridPro] Fix column resizing on touchscreen (#5056) @cherniavskii
|
|
28
|
+
- [l10n] Update Japanese (ja-JP) locale (#5122) @hikotq
|
|
29
|
+
- [l10n] Update Russian (ru-RU) locale (#5069) @Artboomy
|
|
30
|
+
|
|
31
|
+
### `@mui/x-date-pickers@5.0.0-alpha.6` / `@mui/x-date-pickers-pro@5.0.0-alpha.6`
|
|
32
|
+
|
|
33
|
+
#### Changes
|
|
34
|
+
|
|
35
|
+
- [pickers] Fix usage of `maxDate` / `minDate` / `disableFuture` and `disablePast` (#5081) @flaviendelangle
|
|
36
|
+
- [pickers] Infer mask from `inputFormat` (#5060) @alexfauquette
|
|
37
|
+
- [pickers] Manage input value without using the focus (#4486) @alexfauquette
|
|
38
|
+
- [pickers] Use new localization for doc examples (#5097) @flaviendelangle
|
|
39
|
+
- [pickers] Fix `shouldDisableDate` in range pickers (#5123) @flaviendelangle
|
|
40
|
+
- [l10n] Add Brazilian Portuguese (pt-BR) locale (#5100) @jardelnovaes
|
|
41
|
+
- [l10n] Use `localText` for remaining texts (#4986) @alexfauquette
|
|
42
|
+
|
|
43
|
+
### Docs
|
|
44
|
+
|
|
45
|
+
- [docs] Implement the focus management on data grid demo links (#5070) @alexfauquette
|
|
46
|
+
- [docs] Fix `301` link to render cell (#5106) @oliviertassinari
|
|
47
|
+
- [docs] Fix broken anchor link @oliviertassinari
|
|
48
|
+
- [docs] Improve movie dataset (#5142) @flaviendelangle
|
|
49
|
+
- [docs] Move all localization documentation in a unique page (#5072) @alexfauquette
|
|
50
|
+
- [docs] Section for overwriting core components i18n keys (#4998) @DanailH
|
|
51
|
+
- [docs] Small grammar and format fixes for Dynamic Row Height section (#5098) @samuelsycamore
|
|
52
|
+
|
|
53
|
+
### Core
|
|
54
|
+
|
|
55
|
+
- [core] Allows to run tests with different date adapters (#5055) @alexfauquette
|
|
56
|
+
- [core] Prettify the l10n issue (#4928) @alexfauquette
|
|
57
|
+
- [core] Set correct `apiRef` type in row reorder pre processors #5125 @DanailH
|
|
58
|
+
- [core] Stop using `GridEvents` in technical doc (#5157) @flaviendelangle
|
|
59
|
+
- [core] Upgrade monorepo (#5101) @oliviertassinari
|
|
60
|
+
- [test] Fix dynamic row height test failing on Chrome (#5147) @m4theushw
|
|
61
|
+
- [test] Remove delay on server demo for regression tests (#5131) @alexfauquette
|
|
62
|
+
|
|
63
|
+
## v5.12.0
|
|
64
|
+
|
|
65
|
+
_May 31, 2022_
|
|
66
|
+
|
|
67
|
+
We'd like to offer a big thanks to the 15 contributors who made this release possible. Here are some highlights ✨:
|
|
68
|
+
|
|
69
|
+
- 🎁 Introduce support for [dynamic row height](https://mui.com/x/react-data-grid/rows/#dynamic-row-height) (#4859) @m4theushw
|
|
70
|
+
|
|
71
|
+
<img src="https://user-images.githubusercontent.com/42154031/171183167-718d7bcd-ec0f-459e-97fe-0f650abb4a99.gif" width="800">
|
|
72
|
+
|
|
73
|
+
- ⚠️ Remove deprecated row grouping feature from `@mui/x-data-grid-pro`
|
|
74
|
+
|
|
75
|
+
Row grouping is available through the `@mui/x-data-grid-premium` package - see [Premium plan release blogpost](https://mui.com/blog/premium-plan-release/).
|
|
76
|
+
|
|
77
|
+
- 🐞 Bug fixes and improvements
|
|
78
|
+
|
|
79
|
+
### `@mui/x-data-grid@v5.12.0` / `@mui/x-data-grid-pro@v5.12.0` / `@mui/x-data-grid-premium@v5.12.0`
|
|
80
|
+
|
|
81
|
+
#### Changes
|
|
82
|
+
|
|
83
|
+
- [DataGrid] Support dynamic row height (#4859) @m4theushw
|
|
84
|
+
- [DataGrid] Add `onMenuOpen` and `onMenuClose` props (#4825) @DanailH
|
|
85
|
+
- [DataGrid] Add generics to `GridActionsColDef` to match `GridColDef` (#4982) @subvertallchris
|
|
86
|
+
- [DataGrid] Disable drag event handlers when row or column reorder are disabled (#4857) @DanailH
|
|
87
|
+
- [DataGrid] Allow other attempts to stop edit mode if the first failed (#5016) @m4theushw
|
|
88
|
+
- [DataGrid] Better reflect the dependency on Material UI (#4795) @oliviertassinari
|
|
89
|
+
- [DataGrid] Add an id to the filter item created when opening the filter panel (#5014) @flaviendelangle
|
|
90
|
+
- [DataGrid] Use column visibility model on Hide All / Show All when enabled (#5050) @flaviendelangle
|
|
91
|
+
- [DataGridPro] Unpin columns back to original position (#4512) @m4theushw
|
|
92
|
+
- [DataGridPro] Remove experimental row grouping from Pro plan (#4949) @flaviendelangle
|
|
93
|
+
- [DataGridPro] Allow to scroll detail panel content if it overflows the panel (#4979) @cherniavskii
|
|
94
|
+
- [DataGridPro] Do not call `setRowIndex` when dragging a column over a row (#4987) @flaviendelangle
|
|
95
|
+
- [l10n] Add Norwegian (Bokmål) (nb-NO) locale (#5001) @spiftire
|
|
96
|
+
- [l10n] Add Turkish (tr-TR) locale (#5026) @Rassilion
|
|
97
|
+
|
|
98
|
+
### `@mui/x-date-pickers@5.0.0-alpha.5` / `@mui/x-date-pickers-pro@5.0.0-alpha.5`
|
|
99
|
+
|
|
100
|
+
#### Breaking changes
|
|
101
|
+
|
|
102
|
+
- [pickers] Restructure props in `MonthPicker` / `YearPicker` and `DayPicker` (#4814) @flaviendelangle
|
|
103
|
+
|
|
104
|
+
The props of `MonthPicker` / `YearPicker` and `DayPicker` have been reworked to make them more consistent for a standalone usage (#4814) @flaviendelangle
|
|
105
|
+
|
|
106
|
+
**MonthPicker**: The prop `onMonthChange` has been removed, you can use `onChange` instead since every change is a month change
|
|
107
|
+
|
|
108
|
+
**YearPicker**: The prop `onYearPicker` has been removed, you can use `onChange` instead since every change is a year change
|
|
109
|
+
|
|
110
|
+
**DayPicker**: The prop `isDateDisabled` has been removed, you can now use the same validation props as for the other components (`maxDate`, `minDate`, `shouldDisableDate`, `disableFuture` and `disablePast`)
|
|
111
|
+
|
|
112
|
+
#### Changes
|
|
113
|
+
|
|
114
|
+
- [pickers] Add German (de-DE) translations (#4974) @felixh10r
|
|
115
|
+
- [pickers] Support action bar on static pickers and improve typing (#5015) @flaviendelangle
|
|
116
|
+
|
|
117
|
+
### Docs
|
|
118
|
+
|
|
119
|
+
- [docs] Add docs sections / pages for upcoming features on pickers (#4603) @flaviendelangle
|
|
120
|
+
- [docs] Add docs for filter panel components (#4919) @m4theushw
|
|
121
|
+
- [docs] Explain how to manage focus with `renderCell` (#4254) @alexfauquette
|
|
122
|
+
- [docs] Fix broken links to GitHub source (#5003) @Edwardveb
|
|
123
|
+
- [docs] Fix navigation links (#4956) @oliviertassinari
|
|
124
|
+
- [docs] Fix typo on rows docs (#4952) @jamesRadicl
|
|
125
|
+
- [docs] New WAI-ARIA guidelines location (#4957) @oliviertassinari
|
|
126
|
+
- [docs] Add "Slots" section to the right nav in the API pages (#4993) @DanailH
|
|
127
|
+
- [docs] Fix docs feedback widget not working (#4905) @cherniavskii
|
|
128
|
+
- [docs] Replace custom notes and warning with callouts (#5008) @flaviendelangle
|
|
129
|
+
|
|
130
|
+
### Core
|
|
131
|
+
|
|
132
|
+
- [core] Avoid Order ID to refer to GitHub issues/PRs (#5005) @oliviertassinari
|
|
133
|
+
- [core] Improve the workflow for incomplete issues (#5012) @mnajdova
|
|
134
|
+
- [core] Remove dead code on row grouping tree creation (#4945) @flaviendelangle
|
|
135
|
+
- [core] Use new cache api for the row grouping last model tracking (#4980) @flaviendelangle
|
|
136
|
+
- [core] Ensure that PRs have atleast 1 label (#5011) @DanailH
|
|
137
|
+
- [core] Fix trailing-space @oliviertassinari
|
|
138
|
+
- [core] Stop Renovate PR updates when PR is on hold (#5020) @cherniavskii
|
|
139
|
+
- [license] Remove support for UTF-8 (#4893) @oliviertassinari
|
|
140
|
+
- [license] Tweak error messages (#4907) @mbrookes
|
|
141
|
+
- [test] Skip Safari and Firefox on broken tests (#4994) @alexfauquette
|
|
142
|
+
- [test] Make argos screenshots stable (#5061) @m4theushw
|
|
143
|
+
|
|
144
|
+
## v5.11.1
|
|
145
|
+
|
|
146
|
+
_May 20, 2022_
|
|
147
|
+
|
|
148
|
+
We'd like to offer a big thanks to the 6 contributors who made this release possible. Here are some highlights ✨:
|
|
149
|
+
|
|
150
|
+
- 🌍 Support localization on the date and time picker components (#4517) @alexfauquette
|
|
151
|
+
|
|
152
|
+
Texts can be translated in the pickers components, similar to what can be done in the data grid component. Check the [documentation](https://mui.com/x/react-date-pickers/localization/) for more information.
|
|
153
|
+
|
|
154
|
+
- 📃 Add support for column spanning when exporting to Excel (#4830) @cherniavskii
|
|
155
|
+
|
|
156
|
+
<img src="https://user-images.githubusercontent.com/13808724/167691417-bf6baeb9-d409-4134-acb6-aadaf6434de9.png" width="800">
|
|
157
|
+
|
|
158
|
+
- 🐞 Bugs fixes
|
|
159
|
+
|
|
160
|
+
### `@mui/x-data-grid@v5.11.1` / `@mui/x-data-grid-pro@v5.11.1` / `@mui/x-data-grid-premium@v5.11.1`
|
|
161
|
+
|
|
162
|
+
#### Changes
|
|
163
|
+
|
|
164
|
+
- [DataGrid] Add a CSS class corresponding to current density (#4858) @m4theushw
|
|
165
|
+
- [DataGrid] Execute the pipe-processors in their initialization order (#4913) @flaviendelangle
|
|
166
|
+
- [DataGrid] Fix rendering of the no rows overlay when the `loading` prop is changed (#4910) @m4theushw
|
|
167
|
+
- [DataGridPremium] Add `exceljs` to the dependencies (#4939) @alexfauquette
|
|
168
|
+
- [DataGridPremium] Support column spanning in the Excel export (#4830) @cherniavskii
|
|
169
|
+
- [l10n] Improve Russian (ru-RU) locale (#4864) @arvkonstantin
|
|
170
|
+
|
|
171
|
+
### `@mui/x-date-pickers@5.0.0-alpha.4` / `@mui/x-date-pickers-pro@5.0.0-alpha.4`
|
|
172
|
+
|
|
173
|
+
#### Breaking changes
|
|
174
|
+
|
|
175
|
+
- The props related to the action bar buttons have been removed (`clearable`, `showTodayButton`, `cancelText`, `okText`)
|
|
176
|
+
|
|
177
|
+
To decide which button must be displayed and in which order, you can now use the `actions` prop of the `actionBar` component slot props.
|
|
178
|
+
|
|
179
|
+
```jsx
|
|
180
|
+
<DatePicker
|
|
181
|
+
componentsProps={{
|
|
182
|
+
actionBar: {
|
|
183
|
+
// The actions will be the same between desktop and mobile
|
|
184
|
+
actions: ['clear'],
|
|
185
|
+
|
|
186
|
+
// The actions will be different between desktop and mobile
|
|
187
|
+
actions: (variant) => (variant === 'desktop' ? [] : ['clear']),
|
|
188
|
+
},
|
|
189
|
+
}}
|
|
190
|
+
/>
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
The build-in `ActionBar` component supports 4 different actions: `'clear'`, `'cancel'`, `'accept'`, and `'today'`.
|
|
194
|
+
By default, the pickers will render the cancel and accept button on mobile and no action on desktop.
|
|
195
|
+
|
|
196
|
+
If you need other actions, you can provide your own component to the `ActionBar` component slot
|
|
197
|
+
|
|
198
|
+
```jsx
|
|
199
|
+
<DatePicker components={{ ActionBar: CustomActionBar }} />
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
#### Changes
|
|
203
|
+
|
|
204
|
+
- [DatePicker] Fix keyboard accessibility for first and last year (#4807) @alexfauquette
|
|
205
|
+
- [pickers] Add component slot for action bar (#4778) @alexfauquette
|
|
206
|
+
- [pickers] Add l10n support (#4517) @alexfauquette
|
|
207
|
+
- [pickers] Close Popper when pressing <kbd>Esc</kbd> inside a modal (#4499) @alexfauquette
|
|
208
|
+
- [pickers] Support class slots on toolbar components (#4855) @flaviendelangle
|
|
209
|
+
- [TimePicker] Fix time validation when current date is `null` (#4867) @flaviendelangle
|
|
210
|
+
|
|
211
|
+
### Docs
|
|
212
|
+
|
|
213
|
+
- [docs] Add 301 redirect for columns page (#4940) @alexfauquette
|
|
214
|
+
- [docs] Avoid confusion with license key installation (#4891) @oliviertassinari
|
|
215
|
+
- [docs] Complete the instructions for pickers installation in readme (#4852) @alexfauquette
|
|
216
|
+
- [docs] Disable ads on paid-only pages (#4842) @flaviendelangle
|
|
217
|
+
- [docs] Don't redirect to localized doc on deploy preview (#4818) @m4theushw
|
|
218
|
+
- [docs] Limit `LICENSE` file to 80 char per line (#4873) @oliviertassinari
|
|
219
|
+
- [docs] Typo on OrderId @oliviertassinari
|
|
220
|
+
- [docs] Update feature comparison table (#4918) @cherniavskii
|
|
221
|
+
|
|
222
|
+
### Core
|
|
223
|
+
|
|
224
|
+
- [core] Add new script to generate tree data rows from file tree (#4902) @flaviendelangle
|
|
225
|
+
- [core] Fix code style (#4874) @oliviertassinari
|
|
226
|
+
- [core] Fix React 18 peer dependency (#4908) @oliviertassinari
|
|
227
|
+
- [core] Fix link to the LICENSE file (#4875) @oliviertassinari
|
|
228
|
+
- [core] Fix transitive babel dependency (#4793) @oliviertassinari
|
|
229
|
+
- [core] New pipe processing `rowHydration` (#4896) @flaviendelangle
|
|
230
|
+
- [core] Remove dead code for the docs (#4791) @oliviertassinari
|
|
231
|
+
- [core] Run `yarn prettier` @oliviertassinari
|
|
232
|
+
- [core] Polishes on `CHANGELOG.md` (#4876) @oliviertassinari
|
|
233
|
+
- [core] Simplify rows cache management (#4933) @flaviendelangle
|
|
234
|
+
- [core] Use internal icons for quick filter (#4912) @alexfauquette
|
|
235
|
+
|
|
6
236
|
## v5.11.0
|
|
7
237
|
|
|
8
238
|
_May 13, 2022_
|
|
9
239
|
|
|
10
240
|
We'd like to offer a big thanks to the 15 contributors who made this release possible. Here are some highlights ✨:
|
|
11
241
|
|
|
12
|
-
- 🚀 Premium plan release
|
|
13
|
-
|
|
14
|
-
We’re happy to announce that the Premium plan is [finally out](https://mui.com/blog/premium-plan-release/)!
|
|
15
|
-
With it, MUI X officially steps up to the next level, supporting the most advanced use cases for UI components.
|
|
242
|
+
- 🚀 **Premium plan release**. We're happy to announce that the Premium plan is [finally out](https://mui.com/blog/premium-plan-release/)! With it, MUI X officially steps up to the next level, supporting the most advanced use cases for UI components.
|
|
16
243
|
|
|
17
244
|
This plan is available through the new `@mui/x-data-grid-premium` package, which contains the row grouping and the Excel export features.
|
|
18
245
|
|
|
19
|
-
If you were already using the row grouping feature, you can upgrade by [installing](https://mui.com/x/react-data-grid/getting-started/#installation) `@mui/x-data-grid-premium` and replace `DataGridPro` with `DataGridPremium`, as follows.
|
|
20
|
-
Note that the experimental flag is not required anymore to use the row grouping.
|
|
246
|
+
If you were already using the row grouping feature, you can upgrade by [installing](https://mui.com/x/react-data-grid/getting-started/#installation) `@mui/x-data-grid-premium` and replace `DataGridPro` with `DataGridPremium`, as follows. Note that the experimental flag is not required anymore to use the row grouping.
|
|
21
247
|
|
|
22
248
|
```diff
|
|
23
249
|
-import { DataGridPro } from '@mui/x-data-grid-pro';
|
|
@@ -29,16 +255,11 @@ We'd like to offer a big thanks to the 15 contributors who made this release pos
|
|
|
29
255
|
|
|
30
256
|
For more information about the revised pricing model please have a look at the [blog post](https://mui.com/blog/premium-plan-release/#the-new-licensing-model).
|
|
31
257
|
|
|
32
|
-
- 👔
|
|
33
|
-
|
|
34
|
-
- 🔎 Quick filtering
|
|
35
|
-
|
|
36
|
-
You can now add a quick filtering search bar to your grid.
|
|
37
|
-
To do so, either pass `showQuickFilter` prop to the `<GridToolbar />` or use the `<GridToolbarQuickFilter />` component in your custom toolbar.
|
|
258
|
+
- 👔 **Excel export**. You can find this new Premium feature at: https://mui.com/x/react-data-grid/export/#excel-export.
|
|
38
259
|
|
|
39
|
-
|
|
260
|
+
- 🔎 **Quick filtering**. You can now add a quick filtering search bar to your grid. To do so, either pass `showQuickFilter` prop to the `<GridToolbar />` or use the `<GridToolbarQuickFilter />` component in your custom toolbar. More information about how to customize the filtering logic is in the [documentation](https://mui.com/x/react-data-grid/filtering/#quick-filter).
|
|
40
261
|
|
|
41
|
-
|
|
262
|
+
<img src="https://user-images.githubusercontent.com/13808724/167700105-5a5acc7c-5463-4871-8514-3d09e2f365ae.png" width="724">
|
|
42
263
|
|
|
43
264
|
- 🐞 Bugs fixes
|
|
44
265
|
|
|
@@ -46,7 +267,7 @@ We'd like to offer a big thanks to the 15 contributors who made this release pos
|
|
|
46
267
|
|
|
47
268
|
#### Breaking changes
|
|
48
269
|
|
|
49
|
-
-
|
|
270
|
+
- Move row grouping to the premium package (#4223) @flaviendelangle
|
|
50
271
|
|
|
51
272
|
The use of `rowGrouping` in the `@mui/x-data-grid-pro` package is deprecated. The experimental flag will be removed in an upcoming release.
|
|
52
273
|
|
|
@@ -76,7 +297,7 @@ We'd like to offer a big thanks to the 15 contributors who made this release pos
|
|
|
76
297
|
|
|
77
298
|
#### Breaking changes
|
|
78
299
|
|
|
79
|
-
- Rework the auto-closing behavior of the pickers
|
|
300
|
+
- Rework the auto-closing behavior of the pickers (#4408) @flaviendelangle
|
|
80
301
|
|
|
81
302
|
The `disableCloseOnSelect` prop has been replaced by a new `closeOnSelect` prop which has the opposite behavior.
|
|
82
303
|
The default behavior remains the same (close after the last step on desktop but not on mobile).
|
|
@@ -1,26 +1,24 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { ExportedMonthPickerProps } from '../MonthPicker/MonthPicker';
|
|
3
2
|
import { ExportedDayPickerProps } from './DayPicker';
|
|
4
3
|
import { PickerOnChangeFn } from '../internals/hooks/useViews';
|
|
5
4
|
import { ExportedCalendarHeaderProps, PickersCalendarHeaderSlotsComponent, PickersCalendarHeaderSlotsComponentsProps } from './PickersCalendarHeader';
|
|
6
|
-
import { ExportedYearPickerProps } from '../YearPicker/YearPicker';
|
|
7
5
|
import { CalendarPickerView } from '../internals/models';
|
|
8
6
|
import { CalendarPickerClasses } from './calendarPickerClasses';
|
|
7
|
+
import { MonthValidationProps, YearValidationProps } from '../internals/hooks/validation/models';
|
|
9
8
|
export interface CalendarPickerSlotsComponent extends PickersCalendarHeaderSlotsComponent {
|
|
10
9
|
}
|
|
11
10
|
export interface CalendarPickerSlotsComponentsProps extends PickersCalendarHeaderSlotsComponentsProps {
|
|
12
11
|
}
|
|
13
|
-
export interface CalendarPickerProps<TDate> extends ExportedDayPickerProps<TDate>,
|
|
12
|
+
export interface CalendarPickerProps<TDate> extends ExportedDayPickerProps<TDate>, YearValidationProps<TDate>, MonthValidationProps<TDate>, ExportedCalendarHeaderProps<TDate> {
|
|
14
13
|
className?: string;
|
|
15
14
|
classes?: Partial<CalendarPickerClasses>;
|
|
16
15
|
/**
|
|
17
|
-
*
|
|
18
|
-
* Either a string to use an HTML element or a component.
|
|
16
|
+
* Overrideable components.
|
|
19
17
|
* @default {}
|
|
20
18
|
*/
|
|
21
19
|
components?: Partial<CalendarPickerSlotsComponent>;
|
|
22
20
|
/**
|
|
23
|
-
* The props used for each slot
|
|
21
|
+
* The props used for each component slot.
|
|
24
22
|
* @default {}
|
|
25
23
|
*/
|
|
26
24
|
componentsProps?: Partial<CalendarPickerSlotsComponentsProps>;
|
|
@@ -34,22 +32,6 @@ export interface CalendarPickerProps<TDate> extends ExportedDayPickerProps<TDate
|
|
|
34
32
|
* @default false
|
|
35
33
|
*/
|
|
36
34
|
disabled?: boolean;
|
|
37
|
-
/**
|
|
38
|
-
* @default false
|
|
39
|
-
*/
|
|
40
|
-
disableFuture?: boolean;
|
|
41
|
-
/**
|
|
42
|
-
* @default false
|
|
43
|
-
*/
|
|
44
|
-
disablePast?: boolean;
|
|
45
|
-
/**
|
|
46
|
-
* Max selectable date. @DateIOType
|
|
47
|
-
*/
|
|
48
|
-
maxDate?: TDate;
|
|
49
|
-
/**
|
|
50
|
-
* Min selectable date. @DateIOType
|
|
51
|
-
*/
|
|
52
|
-
minDate?: TDate;
|
|
53
35
|
/**
|
|
54
36
|
* Callback fired on view change.
|
|
55
37
|
* @param {CalendarPickerView} view The new view.
|
|
@@ -80,13 +62,6 @@ export interface CalendarPickerProps<TDate> extends ExportedDayPickerProps<TDate
|
|
|
80
62
|
* @default () => <span data-mui-test="loading-progress">...</span>
|
|
81
63
|
*/
|
|
82
64
|
renderLoading?: () => React.ReactNode;
|
|
83
|
-
/**
|
|
84
|
-
* Disable specific date. @DateIOType
|
|
85
|
-
* @template TDate
|
|
86
|
-
* @param {TDate} day The date to check.
|
|
87
|
-
* @returns {boolean} If `true` the day will be disabled.
|
|
88
|
-
*/
|
|
89
|
-
shouldDisableDate?: (day: TDate) => boolean;
|
|
90
65
|
/**
|
|
91
66
|
* Controlled open view.
|
|
92
67
|
*/
|
|
@@ -96,8 +71,21 @@ export interface CalendarPickerProps<TDate> extends ExportedDayPickerProps<TDate
|
|
|
96
71
|
* @default ['year', 'day']
|
|
97
72
|
*/
|
|
98
73
|
views?: readonly CalendarPickerView[];
|
|
74
|
+
/**
|
|
75
|
+
* Callback firing on year change @DateIOType.
|
|
76
|
+
* @template TDate
|
|
77
|
+
* @param {TDate} year The new year.
|
|
78
|
+
*/
|
|
79
|
+
onYearChange?: (year: TDate) => void;
|
|
80
|
+
/**
|
|
81
|
+
* Callback firing on month change @DateIOType.
|
|
82
|
+
* @template TDate
|
|
83
|
+
* @param {TDate} month The new month.
|
|
84
|
+
* @returns {void|Promise} -
|
|
85
|
+
*/
|
|
86
|
+
onMonthChange?: (month: TDate) => void | Promise<void>;
|
|
99
87
|
}
|
|
100
|
-
export declare type ExportedCalendarPickerProps<TDate> = Omit<CalendarPickerProps<TDate>, 'date' | 'view' | 'views' | 'openTo' | 'onChange' | 'changeView' | 'slideDirection' | 'currentMonth' | 'className' | 'classes'>;
|
|
88
|
+
export declare type ExportedCalendarPickerProps<TDate> = Omit<CalendarPickerProps<TDate>, 'date' | 'view' | 'views' | 'openTo' | 'onChange' | 'changeView' | 'slideDirection' | 'currentMonth' | 'className' | 'classes' | 'components' | 'componentsProps'>;
|
|
101
89
|
declare type CalendarPickerComponent = (<TDate>(props: CalendarPickerProps<TDate> & React.RefAttributes<HTMLDivElement>) => JSX.Element) & {
|
|
102
90
|
propTypes?: any;
|
|
103
91
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["autoFocus", "onViewChange", "date", "disableFuture", "disablePast", "defaultCalendarMonth", "loading", "
|
|
3
|
+
const _excluded = ["autoFocus", "onViewChange", "date", "disableFuture", "disablePast", "defaultCalendarMonth", "loading", "onChange", "onYearChange", "onMonthChange", "reduceAnimations", "renderLoading", "shouldDisableDate", "shouldDisableMonth", "shouldDisableYear", "view", "views", "openTo", "className", "disabled", "readOnly", "minDate", "maxDate"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import clsx from 'clsx';
|
|
@@ -59,6 +59,8 @@ const CalendarPickerViewTransitionContainer = styled(PickersFadeTransitionGroup,
|
|
|
59
59
|
* - [CalendarPicker API](https://mui.com/x/api/date-pickers/calendar-picker/)
|
|
60
60
|
*/
|
|
61
61
|
const CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPicker(inProps, ref) {
|
|
62
|
+
const utils = useUtils();
|
|
63
|
+
const defaultDates = useDefaultDates();
|
|
62
64
|
const props = useThemeProps({
|
|
63
65
|
props: inProps,
|
|
64
66
|
name: 'MuiCalendarPicker'
|
|
@@ -68,13 +70,12 @@ const CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPicker(inP
|
|
|
68
70
|
autoFocus,
|
|
69
71
|
onViewChange,
|
|
70
72
|
date,
|
|
71
|
-
disableFuture
|
|
72
|
-
disablePast
|
|
73
|
+
disableFuture,
|
|
74
|
+
disablePast,
|
|
73
75
|
defaultCalendarMonth,
|
|
74
76
|
loading = false,
|
|
75
|
-
maxDate: maxDateProp,
|
|
76
|
-
minDate: minDateProp,
|
|
77
77
|
onChange,
|
|
78
|
+
onYearChange,
|
|
78
79
|
onMonthChange,
|
|
79
80
|
reduceAnimations = defaultReduceAnimations,
|
|
80
81
|
renderLoading = () => /*#__PURE__*/_jsx("span", {
|
|
@@ -88,17 +89,16 @@ const CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPicker(inP
|
|
|
88
89
|
openTo = 'day',
|
|
89
90
|
className,
|
|
90
91
|
disabled,
|
|
91
|
-
readOnly
|
|
92
|
+
readOnly,
|
|
93
|
+
minDate = defaultDates.minDate,
|
|
94
|
+
maxDate = defaultDates.maxDate
|
|
92
95
|
} = props,
|
|
93
96
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
94
97
|
|
|
95
|
-
const utils = useUtils();
|
|
96
|
-
const defaultDates = useDefaultDates();
|
|
97
|
-
const minDate = minDateProp != null ? minDateProp : defaultDates.minDate;
|
|
98
|
-
const maxDate = maxDateProp != null ? maxDateProp : defaultDates.maxDate;
|
|
99
98
|
const {
|
|
100
99
|
openView,
|
|
101
|
-
setOpenView
|
|
100
|
+
setOpenView,
|
|
101
|
+
openNext
|
|
102
102
|
} = useViews({
|
|
103
103
|
view,
|
|
104
104
|
views,
|
|
@@ -110,8 +110,8 @@ const CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPicker(inP
|
|
|
110
110
|
calendarState,
|
|
111
111
|
changeFocusedDay,
|
|
112
112
|
changeMonth,
|
|
113
|
-
isDateDisabled,
|
|
114
113
|
handleChangeMonth,
|
|
114
|
+
isDateDisabled,
|
|
115
115
|
onMonthSwitchingAnimationEnd
|
|
116
116
|
} = useCalendarState({
|
|
117
117
|
date,
|
|
@@ -124,6 +124,54 @@ const CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPicker(inP
|
|
|
124
124
|
disablePast,
|
|
125
125
|
disableFuture
|
|
126
126
|
});
|
|
127
|
+
const handleDateMonthChange = React.useCallback((newDate, selectionState) => {
|
|
128
|
+
const startOfMonth = utils.startOfMonth(newDate);
|
|
129
|
+
const endOfMonth = utils.endOfMonth(newDate);
|
|
130
|
+
const closestEnabledDate = isDateDisabled(newDate) ? findClosestEnabledDate({
|
|
131
|
+
utils,
|
|
132
|
+
date: newDate,
|
|
133
|
+
minDate: utils.isBefore(minDate, startOfMonth) ? startOfMonth : minDate,
|
|
134
|
+
maxDate: utils.isAfter(maxDate, endOfMonth) ? endOfMonth : maxDate,
|
|
135
|
+
disablePast,
|
|
136
|
+
disableFuture,
|
|
137
|
+
isDateDisabled
|
|
138
|
+
}) : newDate;
|
|
139
|
+
|
|
140
|
+
if (closestEnabledDate) {
|
|
141
|
+
onChange(closestEnabledDate, selectionState);
|
|
142
|
+
onMonthChange == null ? void 0 : onMonthChange(startOfMonth);
|
|
143
|
+
} else {
|
|
144
|
+
openNext();
|
|
145
|
+
changeMonth(startOfMonth);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
changeFocusedDay(closestEnabledDate);
|
|
149
|
+
}, [changeFocusedDay, disableFuture, disablePast, isDateDisabled, maxDate, minDate, onChange, onMonthChange, changeMonth, openNext, utils]); // TODO: Use same behavior as `handleDateMonthChange` to avoid selecting a date in another year.
|
|
150
|
+
// Needs startOfYear / endOfYear methods in adapter.
|
|
151
|
+
|
|
152
|
+
const handleDateYearChange = React.useCallback((newDate, selectionState) => {
|
|
153
|
+
const startOfYear = utils.startOfYear(newDate);
|
|
154
|
+
const endOfYear = utils.endOfYear(newDate);
|
|
155
|
+
const closestEnabledDate = isDateDisabled(newDate) ? findClosestEnabledDate({
|
|
156
|
+
utils,
|
|
157
|
+
date: newDate,
|
|
158
|
+
minDate: utils.isBefore(minDate, startOfYear) ? startOfYear : minDate,
|
|
159
|
+
maxDate: utils.isAfter(maxDate, endOfYear) ? endOfYear : maxDate,
|
|
160
|
+
disablePast,
|
|
161
|
+
disableFuture,
|
|
162
|
+
isDateDisabled
|
|
163
|
+
}) : newDate;
|
|
164
|
+
|
|
165
|
+
if (closestEnabledDate) {
|
|
166
|
+
onChange(closestEnabledDate, selectionState);
|
|
167
|
+
onYearChange == null ? void 0 : onYearChange(closestEnabledDate);
|
|
168
|
+
} else {
|
|
169
|
+
openNext();
|
|
170
|
+
changeMonth(startOfYear);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
changeFocusedDay(closestEnabledDate);
|
|
174
|
+
}, [changeFocusedDay, disableFuture, disablePast, isDateDisabled, maxDate, minDate, onChange, onYearChange, openNext, utils, changeMonth]);
|
|
127
175
|
const onSelectedDayChange = React.useCallback((day, isFinish) => {
|
|
128
176
|
if (date && day) {
|
|
129
177
|
// If there is a date already selected, then we want to keep its time
|
|
@@ -141,7 +189,7 @@ const CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPicker(inP
|
|
|
141
189
|
maxDate,
|
|
142
190
|
disablePast,
|
|
143
191
|
disableFuture,
|
|
144
|
-
|
|
192
|
+
isDateDisabled
|
|
145
193
|
});
|
|
146
194
|
onChange(closestEnabledDate, 'partial');
|
|
147
195
|
} // This call is too expensive to run it on each prop change.
|
|
@@ -157,19 +205,12 @@ const CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPicker(inP
|
|
|
157
205
|
|
|
158
206
|
const ownerState = props;
|
|
159
207
|
const classes = useUtilityClasses(ownerState);
|
|
160
|
-
const
|
|
161
|
-
className,
|
|
162
|
-
date,
|
|
163
|
-
disabled,
|
|
208
|
+
const baseDateValidationProps = {
|
|
164
209
|
disablePast,
|
|
165
210
|
disableFuture,
|
|
166
|
-
onChange,
|
|
167
|
-
minDate,
|
|
168
211
|
maxDate,
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
readOnly
|
|
172
|
-
}; // When disable, limit the view to the selected date
|
|
212
|
+
minDate
|
|
213
|
+
}; // When disabled, limit the view to the selected date
|
|
173
214
|
|
|
174
215
|
const minDateWithDisabled = disabled && date || minDate;
|
|
175
216
|
const maxDateWithDisabled = disabled && date || maxDate;
|
|
@@ -198,31 +239,32 @@ const CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPicker(inP
|
|
|
198
239
|
transKey: openView,
|
|
199
240
|
ownerState: ownerState,
|
|
200
241
|
children: /*#__PURE__*/_jsxs("div", {
|
|
201
|
-
children: [openView === 'year' && /*#__PURE__*/_jsx(YearPicker, _extends({}, other, {
|
|
242
|
+
children: [openView === 'year' && /*#__PURE__*/_jsx(YearPicker, _extends({}, other, baseDateValidationProps, {
|
|
202
243
|
autoFocus: autoFocus,
|
|
203
244
|
date: date,
|
|
204
|
-
onChange:
|
|
205
|
-
minDate: minDate,
|
|
206
|
-
maxDate: maxDate,
|
|
207
|
-
disableFuture: disableFuture,
|
|
208
|
-
disablePast: disablePast,
|
|
209
|
-
isDateDisabled: isDateDisabled,
|
|
245
|
+
onChange: handleDateYearChange,
|
|
210
246
|
shouldDisableYear: shouldDisableYear,
|
|
211
|
-
onFocusedDayChange: changeFocusedDay,
|
|
212
247
|
disabled: disabled,
|
|
213
248
|
readOnly: readOnly
|
|
214
|
-
})), openView === 'month' && /*#__PURE__*/_jsx(MonthPicker, _extends({},
|
|
249
|
+
})), openView === 'month' && /*#__PURE__*/_jsx(MonthPicker, _extends({}, baseDateValidationProps, {
|
|
250
|
+
className: className,
|
|
251
|
+
date: date,
|
|
252
|
+
onChange: handleDateMonthChange,
|
|
253
|
+
disabled: disabled,
|
|
254
|
+
readOnly: readOnly,
|
|
255
|
+
shouldDisableMonth: shouldDisableMonth
|
|
256
|
+
})), openView === 'day' && /*#__PURE__*/_jsx(DayPicker, _extends({}, other, calendarState, baseDateValidationProps, {
|
|
215
257
|
autoFocus: autoFocus,
|
|
216
258
|
onMonthSwitchingAnimationEnd: onMonthSwitchingAnimationEnd,
|
|
217
259
|
onFocusedDayChange: changeFocusedDay,
|
|
218
260
|
reduceAnimations: reduceAnimations,
|
|
219
261
|
selectedDays: [date],
|
|
220
262
|
onSelectedDaysChange: onSelectedDayChange,
|
|
221
|
-
isDateDisabled: isDateDisabled,
|
|
222
263
|
loading: loading,
|
|
223
264
|
renderLoading: renderLoading,
|
|
224
265
|
disabled: disabled,
|
|
225
|
-
readOnly: readOnly
|
|
266
|
+
readOnly: readOnly,
|
|
267
|
+
shouldDisableDate: shouldDisableDate
|
|
226
268
|
}))]
|
|
227
269
|
})
|
|
228
270
|
})]
|
|
@@ -238,14 +280,13 @@ process.env.NODE_ENV !== "production" ? CalendarPicker.propTypes = {
|
|
|
238
280
|
className: PropTypes.string,
|
|
239
281
|
|
|
240
282
|
/**
|
|
241
|
-
*
|
|
242
|
-
* Either a string to use an HTML element or a component.
|
|
283
|
+
* Overrideable components.
|
|
243
284
|
* @default {}
|
|
244
285
|
*/
|
|
245
286
|
components: PropTypes.object,
|
|
246
287
|
|
|
247
288
|
/**
|
|
248
|
-
* The props used for each slot
|
|
289
|
+
* The props used for each component slot.
|
|
249
290
|
* @default {}
|
|
250
291
|
*/
|
|
251
292
|
componentsProps: PropTypes.object,
|
|
@@ -263,17 +304,19 @@ process.env.NODE_ENV !== "production" ? CalendarPicker.propTypes = {
|
|
|
263
304
|
disabled: PropTypes.bool,
|
|
264
305
|
|
|
265
306
|
/**
|
|
307
|
+
* If `true` future days are disabled.
|
|
266
308
|
* @default false
|
|
267
309
|
*/
|
|
268
310
|
disableFuture: PropTypes.bool,
|
|
269
311
|
|
|
270
312
|
/**
|
|
271
|
-
* If `true`,
|
|
313
|
+
* If `true`, today's date is rendering without highlighting with circle.
|
|
272
314
|
* @default false
|
|
273
315
|
*/
|
|
274
316
|
disableHighlightToday: PropTypes.bool,
|
|
275
317
|
|
|
276
318
|
/**
|
|
319
|
+
* If `true` past days are disabled.
|
|
277
320
|
* @default false
|
|
278
321
|
*/
|
|
279
322
|
disablePast: PropTypes.bool,
|
|
@@ -282,11 +325,13 @@ process.env.NODE_ENV !== "production" ? CalendarPicker.propTypes = {
|
|
|
282
325
|
* Get aria-label text for switching between views button.
|
|
283
326
|
* @param {CalendarPickerView} currentView The view from which we want to get the button text.
|
|
284
327
|
* @returns {string} The label of the view.
|
|
328
|
+
* @deprecated Use the `localeText` prop of `LocalizationProvider` instead, see https://mui.com/x/react-date-pickers/localization
|
|
285
329
|
*/
|
|
286
330
|
getViewSwitchingButtonText: PropTypes.func,
|
|
287
331
|
|
|
288
332
|
/**
|
|
289
333
|
* Left arrow icon aria-label text.
|
|
334
|
+
* @deprecated
|
|
290
335
|
*/
|
|
291
336
|
leftArrowButtonText: PropTypes.string,
|
|
292
337
|
|
|
@@ -298,12 +343,12 @@ process.env.NODE_ENV !== "production" ? CalendarPicker.propTypes = {
|
|
|
298
343
|
loading: PropTypes.bool,
|
|
299
344
|
|
|
300
345
|
/**
|
|
301
|
-
*
|
|
346
|
+
* Maximal selectable date. @DateIOType
|
|
302
347
|
*/
|
|
303
348
|
maxDate: PropTypes.any,
|
|
304
349
|
|
|
305
350
|
/**
|
|
306
|
-
*
|
|
351
|
+
* Minimal selectable date. @DateIOType
|
|
307
352
|
*/
|
|
308
353
|
minDate: PropTypes.any,
|
|
309
354
|
|
|
@@ -315,7 +360,7 @@ process.env.NODE_ENV !== "production" ? CalendarPicker.propTypes = {
|
|
|
315
360
|
/**
|
|
316
361
|
* Callback firing on month change @DateIOType.
|
|
317
362
|
* @template TDate
|
|
318
|
-
* @param {TDate} month The new
|
|
363
|
+
* @param {TDate} month The new month.
|
|
319
364
|
* @returns {void|Promise} -
|
|
320
365
|
*/
|
|
321
366
|
onMonthChange: PropTypes.func,
|
|
@@ -370,14 +415,15 @@ process.env.NODE_ENV !== "production" ? CalendarPicker.propTypes = {
|
|
|
370
415
|
|
|
371
416
|
/**
|
|
372
417
|
* Right arrow icon aria-label text.
|
|
418
|
+
* @deprecated
|
|
373
419
|
*/
|
|
374
420
|
rightArrowButtonText: PropTypes.string,
|
|
375
421
|
|
|
376
422
|
/**
|
|
377
423
|
* Disable specific date. @DateIOType
|
|
378
424
|
* @template TDate
|
|
379
|
-
* @param {TDate} day The date to
|
|
380
|
-
* @returns {boolean}
|
|
425
|
+
* @param {TDate} day The date to test.
|
|
426
|
+
* @returns {boolean} Returns `true` if the date should be disabled.
|
|
381
427
|
*/
|
|
382
428
|
shouldDisableDate: PropTypes.func,
|
|
383
429
|
|
|
@@ -395,7 +441,7 @@ process.env.NODE_ENV !== "production" ? CalendarPicker.propTypes = {
|
|
|
395
441
|
* Works like `shouldDisableDate` but for year selection view @DateIOType.
|
|
396
442
|
* @template TDate
|
|
397
443
|
* @param {TDate} year The year to test.
|
|
398
|
-
* @returns {boolean}
|
|
444
|
+
* @returns {boolean} Returns `true` if the year should be disabled.
|
|
399
445
|
*/
|
|
400
446
|
shouldDisableYear: PropTypes.func,
|
|
401
447
|
|