@mui/x-date-pickers 6.0.4 → 6.2.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/AdapterDateFns/index.d.ts +1 -1
- package/AdapterDateFnsJalali/index.d.ts +1 -1
- package/AdapterDayjs/AdapterDayjs.d.ts +114 -0
- package/AdapterDayjs/AdapterDayjs.js +387 -0
- package/AdapterDayjs/index.d.ts +1 -29
- package/AdapterDayjs/index.js +1 -102
- package/AdapterLuxon/index.d.ts +2 -2
- package/AdapterLuxon/index.js +1 -1
- package/AdapterMoment/index.d.ts +1 -1
- package/AdapterMomentHijri/index.d.ts +1 -1
- package/AdapterMomentJalaali/index.d.ts +1 -1
- package/CHANGELOG.md +110 -0
- package/DateCalendar/DateCalendar.js +0 -2
- package/DateCalendar/DateCalendar.types.d.ts +1 -1
- package/DateCalendar/DayCalendar.d.ts +1 -1
- package/DateCalendar/PickersCalendarHeader.d.ts +0 -12
- package/DateCalendar/PickersCalendarHeader.js +7 -9
- package/DateCalendar/PickersSlideTransition.js +1 -0
- package/DateCalendar/useCalendarState.d.ts +1 -1
- package/DateField/DateField.js +14 -2
- package/DateField/useDateField.js +3 -1
- package/DatePicker/DatePicker.js +6 -0
- package/DatePicker/shared.d.ts +2 -2
- package/DateTimeField/DateTimeField.js +14 -2
- package/DateTimeField/useDateTimeField.js +3 -1
- package/DateTimePicker/DateTimePicker.js +6 -0
- package/DateTimePicker/shared.js +3 -1
- package/DesktopDatePicker/DesktopDatePicker.js +6 -0
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +6 -0
- package/DesktopTimePicker/DesktopTimePicker.js +6 -0
- package/LocalizationProvider/LocalizationProvider.d.ts +2 -3
- package/MobileDatePicker/MobileDatePicker.js +6 -0
- package/MobileDateTimePicker/MobileDateTimePicker.js +6 -0
- package/MobileTimePicker/MobileTimePicker.js +6 -0
- package/MonthCalendar/PickersMonth.js +1 -0
- package/README.md +3 -2
- package/TimeClock/ClockNumbers.d.ts +1 -1
- package/TimeClock/TimeClock.js +5 -4
- package/TimeClock/TimeClock.types.d.ts +1 -1
- package/TimeField/TimeField.js +14 -2
- package/TimeField/useTimeField.js +3 -1
- package/TimePicker/TimePicker.js +6 -0
- package/YearCalendar/PickersYear.js +1 -0
- package/index.js +1 -1
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +10 -12
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.types.d.ts +0 -12
- package/internals/components/PickersModalDialog.d.ts +1 -13
- package/internals/components/PickersModalDialog.js +7 -9
- package/internals/components/PickersPopper.d.ts +1 -3
- package/internals/components/PickersPopper.js +2 -7
- package/internals/hooks/useDesktopPicker/useDesktopPicker.js +2 -0
- package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +2 -3
- package/internals/hooks/useField/useField.js +2 -2
- package/internals/hooks/useField/useField.types.d.ts +9 -11
- package/internals/hooks/useField/useField.utils.d.ts +2 -3
- package/internals/hooks/useField/useField.utils.js +19 -5
- package/internals/hooks/useField/useFieldCharacterEditing.js +23 -0
- package/internals/hooks/useField/useFieldState.js +3 -2
- package/internals/hooks/useMobilePicker/useMobilePicker.js +2 -0
- package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +2 -3
- package/internals/hooks/usePicker/index.d.ts +1 -1
- package/internals/hooks/usePicker/usePicker.types.d.ts +1 -1
- package/internals/hooks/usePicker/usePickerLayoutProps.d.ts +1 -1
- package/internals/hooks/usePicker/usePickerLayoutProps.js +6 -0
- package/internals/hooks/usePicker/usePickerValue.d.ts +3 -173
- package/internals/hooks/usePicker/usePickerValue.js +199 -144
- package/internals/hooks/usePicker/usePickerValue.types.d.ts +233 -0
- package/internals/hooks/usePicker/usePickerValue.types.js +1 -0
- package/internals/hooks/usePicker/usePickerViews.d.ts +1 -1
- package/internals/hooks/usePicker/usePickerViews.js +13 -0
- package/internals/hooks/useUtils.d.ts +1 -1
- package/internals/index.d.ts +1 -2
- package/internals/models/index.d.ts +0 -1
- package/internals/models/index.js +1 -2
- package/internals/models/props/basePickerProps.d.ts +6 -0
- package/internals/utils/date-utils.d.ts +1 -1
- package/internals/utils/time-utils.d.ts +1 -2
- package/internals/utils/valueManagers.d.ts +1 -1
- package/internals/utils/valueManagers.js +2 -2
- package/legacy/AdapterDayjs/AdapterDayjs.js +403 -0
- package/legacy/AdapterDayjs/index.js +1 -119
- package/legacy/AdapterLuxon/index.js +1 -1
- package/legacy/DateCalendar/DateCalendar.js +0 -2
- package/legacy/DateCalendar/PickersCalendarHeader.js +8 -10
- package/legacy/DateField/DateField.js +13 -1
- package/legacy/DateField/useDateField.js +3 -1
- package/legacy/DatePicker/DatePicker.js +6 -0
- package/legacy/DateTimeField/DateTimeField.js +13 -1
- package/legacy/DateTimeField/useDateTimeField.js +3 -1
- package/legacy/DateTimePicker/DateTimePicker.js +6 -0
- package/legacy/DateTimePicker/shared.js +3 -1
- package/legacy/DesktopDatePicker/DesktopDatePicker.js +6 -0
- package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +6 -0
- package/legacy/DesktopTimePicker/DesktopTimePicker.js +6 -0
- package/legacy/MobileDatePicker/MobileDatePicker.js +6 -0
- package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +6 -0
- package/legacy/MobileTimePicker/MobileTimePicker.js +6 -0
- package/legacy/TimeClock/TimeClock.js +5 -4
- package/legacy/TimeField/TimeField.js +13 -1
- package/legacy/TimeField/useTimeField.js +3 -1
- package/legacy/TimePicker/TimePicker.js +6 -0
- package/legacy/index.js +1 -1
- package/legacy/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +10 -12
- package/legacy/internals/components/PickersModalDialog.js +7 -9
- package/legacy/internals/components/PickersPopper.js +2 -7
- package/legacy/internals/hooks/useDesktopPicker/useDesktopPicker.js +2 -0
- package/legacy/internals/hooks/useField/useField.js +2 -2
- package/legacy/internals/hooks/useField/useField.utils.js +27 -10
- package/legacy/internals/hooks/useField/useFieldCharacterEditing.js +23 -0
- package/legacy/internals/hooks/useField/useFieldState.js +5 -3
- package/legacy/internals/hooks/useMobilePicker/useMobilePicker.js +2 -0
- package/legacy/internals/hooks/usePicker/usePickerLayoutProps.js +6 -0
- package/legacy/internals/hooks/usePicker/usePickerValue.js +196 -146
- package/legacy/internals/hooks/usePicker/usePickerValue.types.js +1 -0
- package/legacy/internals/hooks/usePicker/usePickerViews.js +13 -0
- package/legacy/internals/models/index.js +1 -2
- package/legacy/internals/utils/valueManagers.js +3 -3
- package/legacy/locales/caES.js +88 -0
- package/legacy/locales/esES.js +34 -17
- package/legacy/locales/heIL.js +33 -16
- package/legacy/locales/index.js +1 -0
- package/legacy/locales/jaJP.js +3 -1
- package/legacy/locales/kzKZ.js +88 -0
- package/legacy/locales/nlNL.js +25 -11
- package/legacy/locales/ptBR.js +33 -16
- package/legacy/models/adapters.js +1 -0
- package/legacy/models/index.js +2 -1
- package/legacy/tests/describeGregorianAdapter/describeGregorianAdapter.js +20 -0
- package/legacy/tests/describeGregorianAdapter/describeGregorianAdapter.types.js +1 -0
- package/legacy/tests/describeGregorianAdapter/index.js +1 -0
- package/legacy/tests/describeGregorianAdapter/testCalculations.js +273 -0
- package/legacy/tests/describeGregorianAdapter/testFormat.js +26 -0
- package/legacy/tests/describeGregorianAdapter/testLocalization.js +15 -0
- package/legacy/tests/describeValidation/describeValidation.js +2 -1
- package/legacy/tests/describeValidation/testMinutesViewValidation.js +201 -0
- package/legacy/tests/describeValue/testPickerActionBar.js +52 -3
- package/legacy/tests/describeValue/testPickerOpenCloseLifeCycle.js +6 -6
- package/locales/beBY.d.ts +3 -3
- package/locales/caES.d.ts +51 -0
- package/locales/caES.js +54 -0
- package/locales/csCZ.d.ts +3 -3
- package/locales/daDK.d.ts +3 -3
- package/locales/deDE.d.ts +3 -3
- package/locales/enUS.d.ts +3 -3
- package/locales/esES.d.ts +3 -3
- package/locales/esES.js +14 -17
- package/locales/faIR.d.ts +3 -3
- package/locales/fiFI.d.ts +3 -3
- package/locales/frFR.d.ts +3 -3
- package/locales/heIL.d.ts +3 -3
- package/locales/heIL.js +13 -16
- package/locales/huHU.d.ts +3 -3
- package/locales/index.d.ts +1 -0
- package/locales/index.js +1 -0
- package/locales/isIS.d.ts +3 -3
- package/locales/itIT.d.ts +3 -3
- package/locales/jaJP.d.ts +3 -3
- package/locales/jaJP.js +1 -1
- package/locales/koKR.d.ts +3 -3
- package/locales/kzKZ.d.ts +51 -0
- package/locales/kzKZ.js +56 -0
- package/locales/nbNO.d.ts +3 -3
- package/locales/nlNL.d.ts +3 -3
- package/locales/nlNL.js +9 -11
- package/locales/plPL.d.ts +3 -3
- package/locales/ptBR.d.ts +3 -3
- package/locales/ptBR.js +13 -16
- package/locales/ruRU.d.ts +3 -3
- package/locales/svSE.d.ts +3 -3
- package/locales/trTR.d.ts +3 -3
- package/locales/ukUA.d.ts +3 -3
- package/locales/urPK.d.ts +3 -3
- package/locales/utils/getPickersLocalization.d.ts +3 -3
- package/locales/utils/pickersLocaleTextApi.d.ts +1 -2
- package/locales/zhCN.d.ts +3 -3
- package/models/adapters.d.ts +568 -0
- package/models/adapters.js +1 -0
- package/models/index.d.ts +1 -0
- package/models/index.js +2 -1
- package/modern/AdapterDayjs/AdapterDayjs.js +386 -0
- package/modern/AdapterDayjs/index.js +1 -101
- package/modern/AdapterLuxon/index.js +1 -1
- package/modern/DateCalendar/DateCalendar.js +0 -2
- package/modern/DateCalendar/PickersCalendarHeader.js +6 -8
- package/modern/DateCalendar/PickersSlideTransition.js +1 -0
- package/modern/DateField/DateField.js +14 -2
- package/modern/DateField/useDateField.js +3 -1
- package/modern/DatePicker/DatePicker.js +6 -0
- package/modern/DateTimeField/DateTimeField.js +14 -2
- package/modern/DateTimeField/useDateTimeField.js +3 -1
- package/modern/DateTimePicker/DateTimePicker.js +6 -0
- package/modern/DateTimePicker/shared.js +3 -1
- package/modern/DesktopDatePicker/DesktopDatePicker.js +6 -0
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +6 -0
- package/modern/DesktopTimePicker/DesktopTimePicker.js +6 -0
- package/modern/MobileDatePicker/MobileDatePicker.js +6 -0
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +6 -0
- package/modern/MobileTimePicker/MobileTimePicker.js +6 -0
- package/modern/MonthCalendar/PickersMonth.js +1 -0
- package/modern/TimeClock/TimeClock.js +5 -4
- package/modern/TimeField/TimeField.js +14 -2
- package/modern/TimeField/useTimeField.js +3 -1
- package/modern/TimePicker/TimePicker.js +6 -0
- package/modern/YearCalendar/PickersYear.js +1 -0
- package/modern/index.js +1 -1
- package/modern/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +9 -11
- package/modern/internals/components/PickersModalDialog.js +6 -8
- package/modern/internals/components/PickersPopper.js +2 -7
- package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +2 -0
- package/modern/internals/hooks/useField/useField.js +2 -2
- package/modern/internals/hooks/useField/useField.utils.js +19 -5
- package/modern/internals/hooks/useField/useFieldCharacterEditing.js +23 -0
- package/modern/internals/hooks/useField/useFieldState.js +3 -2
- package/modern/internals/hooks/useMobilePicker/useMobilePicker.js +2 -0
- package/modern/internals/hooks/usePicker/usePickerLayoutProps.js +6 -0
- package/modern/internals/hooks/usePicker/usePickerValue.js +199 -144
- package/modern/internals/hooks/usePicker/usePickerValue.types.js +1 -0
- package/modern/internals/hooks/usePicker/usePickerViews.js +13 -0
- package/modern/internals/models/index.js +1 -2
- package/modern/internals/utils/valueManagers.js +2 -2
- package/modern/locales/caES.js +54 -0
- package/modern/locales/esES.js +14 -17
- package/modern/locales/heIL.js +13 -16
- package/modern/locales/index.js +1 -0
- package/modern/locales/jaJP.js +1 -1
- package/modern/locales/kzKZ.js +56 -0
- package/modern/locales/nlNL.js +9 -11
- package/modern/locales/ptBR.js +13 -16
- package/modern/models/adapters.js +1 -0
- package/modern/models/index.js +2 -1
- package/modern/tests/describeGregorianAdapter/describeGregorianAdapter.js +20 -0
- package/modern/tests/describeGregorianAdapter/describeGregorianAdapter.types.js +1 -0
- package/modern/tests/describeGregorianAdapter/index.js +1 -0
- package/modern/tests/describeGregorianAdapter/testCalculations.js +272 -0
- package/modern/tests/describeGregorianAdapter/testFormat.js +27 -0
- package/modern/tests/describeGregorianAdapter/testLocalization.js +16 -0
- package/modern/tests/describeValidation/describeValidation.js +2 -1
- package/modern/tests/describeValidation/testMinutesViewValidation.js +200 -0
- package/modern/tests/describeValue/testPickerActionBar.js +52 -3
- package/modern/tests/describeValue/testPickerOpenCloseLifeCycle.js +6 -6
- package/node/AdapterDayjs/AdapterDayjs.js +395 -0
- package/node/AdapterDayjs/index.js +6 -104
- package/node/AdapterLuxon/index.js +1 -1
- package/node/AdapterMomentHijri/index.js +2 -0
- package/node/DateCalendar/DateCalendar.js +0 -2
- package/node/DateCalendar/PickersCalendarHeader.js +5 -9
- package/node/DateCalendar/PickersSlideTransition.js +1 -0
- package/node/DateField/DateField.js +14 -2
- package/node/DateField/useDateField.js +3 -1
- package/node/DatePicker/DatePicker.js +6 -0
- package/node/DateTimeField/DateTimeField.js +14 -2
- package/node/DateTimeField/useDateTimeField.js +3 -1
- package/node/DateTimePicker/DateTimePicker.js +6 -0
- package/node/DateTimePicker/shared.js +3 -1
- package/node/DesktopDatePicker/DesktopDatePicker.js +6 -0
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +6 -0
- package/node/DesktopTimePicker/DesktopTimePicker.js +6 -0
- package/node/MobileDatePicker/MobileDatePicker.js +6 -0
- package/node/MobileDateTimePicker/MobileDateTimePicker.js +6 -0
- package/node/MobileTimePicker/MobileTimePicker.js +6 -0
- package/node/MonthCalendar/PickersMonth.js +1 -0
- package/node/TimeClock/TimeClock.js +5 -4
- package/node/TimeField/TimeField.js +14 -2
- package/node/TimeField/useTimeField.js +3 -1
- package/node/TimePicker/TimePicker.js +6 -0
- package/node/YearCalendar/PickersYear.js +1 -0
- package/node/index.js +1 -1
- package/node/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +9 -11
- package/node/internals/components/PickersModalDialog.js +6 -8
- package/node/internals/components/PickersPopper.js +2 -7
- package/node/internals/hooks/useDesktopPicker/useDesktopPicker.js +2 -0
- package/node/internals/hooks/useField/useField.js +2 -2
- package/node/internals/hooks/useField/useField.utils.js +19 -5
- package/node/internals/hooks/useField/useFieldCharacterEditing.js +22 -0
- package/node/internals/hooks/useField/useFieldState.js +3 -2
- package/node/internals/hooks/useMobilePicker/useMobilePicker.js +2 -0
- package/node/internals/hooks/usePicker/usePickerLayoutProps.js +5 -0
- package/node/internals/hooks/usePicker/usePickerValue.js +199 -144
- package/node/internals/hooks/usePicker/usePickerValue.types.js +5 -0
- package/node/internals/hooks/usePicker/usePickerViews.js +12 -0
- package/node/internals/models/index.js +0 -11
- package/node/internals/utils/valueManagers.js +2 -2
- package/node/locales/caES.js +61 -0
- package/node/locales/csCZ.js +0 -1
- package/node/locales/esES.js +14 -17
- package/node/locales/heIL.js +13 -16
- package/node/locales/index.js +11 -0
- package/node/locales/jaJP.js +1 -1
- package/node/locales/kzKZ.js +62 -0
- package/node/locales/nlNL.js +9 -11
- package/node/locales/ptBR.js +13 -16
- package/node/models/adapters.js +5 -0
- package/node/models/index.js +11 -0
- package/node/tests/describeGregorianAdapter/describeGregorianAdapter.js +29 -0
- package/node/tests/describeGregorianAdapter/describeGregorianAdapter.types.js +5 -0
- package/node/tests/describeGregorianAdapter/index.js +18 -0
- package/node/tests/describeGregorianAdapter/testCalculations.js +279 -0
- package/node/tests/describeGregorianAdapter/testFormat.js +34 -0
- package/node/tests/describeGregorianAdapter/testLocalization.js +23 -0
- package/node/tests/describeValidation/describeValidation.js +2 -1
- package/node/tests/describeValidation/testMinutesViewValidation.js +210 -0
- package/node/tests/describeValue/testPickerActionBar.js +52 -3
- package/node/tests/describeValue/testPickerOpenCloseLifeCycle.js +6 -6
- package/package.json +11 -11
- package/tests/describeGregorianAdapter/describeGregorianAdapter.js +20 -0
- package/tests/describeGregorianAdapter/describeGregorianAdapter.types.js +1 -0
- package/tests/describeGregorianAdapter/index.js +1 -0
- package/tests/describeGregorianAdapter/testCalculations.js +272 -0
- package/tests/describeGregorianAdapter/testFormat.js +27 -0
- package/tests/describeGregorianAdapter/testLocalization.js +16 -0
- package/tests/describeValidation/describeValidation.js +2 -1
- package/tests/describeValidation/testMinutesViewValidation.js +200 -0
- package/tests/describeValue/testPickerActionBar.js +52 -3
- package/tests/describeValue/testPickerOpenCloseLifeCycle.js +6 -6
- package/internals/models/muiPickersAdapter.d.ts +0 -26
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.AdapterDayjs = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
10
|
+
var _weekOfYear = _interopRequireDefault(require("dayjs/plugin/weekOfYear"));
|
|
11
|
+
var _customParseFormat = _interopRequireDefault(require("dayjs/plugin/customParseFormat"));
|
|
12
|
+
var _localizedFormat = _interopRequireDefault(require("dayjs/plugin/localizedFormat"));
|
|
13
|
+
var _isBetween = _interopRequireDefault(require("dayjs/plugin/isBetween"));
|
|
14
|
+
var _warning = require("../internals/utils/warning");
|
|
15
|
+
/* eslint-disable class-methods-use-this */
|
|
16
|
+
|
|
17
|
+
_dayjs.default.extend(_customParseFormat.default);
|
|
18
|
+
_dayjs.default.extend(_localizedFormat.default);
|
|
19
|
+
_dayjs.default.extend(_isBetween.default);
|
|
20
|
+
const localeNotFoundWarning = (0, _warning.buildWarning)(['Your locale has not been found.', 'Either the locale key is not a supported one. Locales supported by dayjs are available here: https://github.com/iamkun/dayjs/tree/dev/src/locale', "Or you forget to import the locale with `require('dayjs/locale/{localeUsed}')`", 'fallback on English locale']);
|
|
21
|
+
const formatTokenMap = {
|
|
22
|
+
// Year
|
|
23
|
+
YY: 'year',
|
|
24
|
+
YYYY: 'year',
|
|
25
|
+
// Month
|
|
26
|
+
M: 'month',
|
|
27
|
+
MM: 'month',
|
|
28
|
+
MMM: {
|
|
29
|
+
sectionType: 'month',
|
|
30
|
+
contentType: 'letter'
|
|
31
|
+
},
|
|
32
|
+
MMMM: {
|
|
33
|
+
sectionType: 'month',
|
|
34
|
+
contentType: 'letter'
|
|
35
|
+
},
|
|
36
|
+
// Day of the month
|
|
37
|
+
D: 'day',
|
|
38
|
+
DD: 'day',
|
|
39
|
+
Do: 'day',
|
|
40
|
+
// Day of the week
|
|
41
|
+
d: 'weekDay',
|
|
42
|
+
dd: {
|
|
43
|
+
sectionType: 'weekDay',
|
|
44
|
+
contentType: 'letter'
|
|
45
|
+
},
|
|
46
|
+
ddd: {
|
|
47
|
+
sectionType: 'weekDay',
|
|
48
|
+
contentType: 'letter'
|
|
49
|
+
},
|
|
50
|
+
dddd: {
|
|
51
|
+
sectionType: 'weekDay',
|
|
52
|
+
contentType: 'letter'
|
|
53
|
+
},
|
|
54
|
+
// Meridiem
|
|
55
|
+
A: 'meridiem',
|
|
56
|
+
a: 'meridiem',
|
|
57
|
+
// Hours
|
|
58
|
+
H: 'hours',
|
|
59
|
+
HH: 'hours',
|
|
60
|
+
h: 'hours',
|
|
61
|
+
hh: 'hours',
|
|
62
|
+
// Minutes
|
|
63
|
+
m: 'minutes',
|
|
64
|
+
mm: 'minutes',
|
|
65
|
+
// Seconds
|
|
66
|
+
s: 'seconds',
|
|
67
|
+
ss: 'seconds'
|
|
68
|
+
};
|
|
69
|
+
const defaultFormats = {
|
|
70
|
+
normalDateWithWeekday: 'ddd, MMM D',
|
|
71
|
+
normalDate: 'D MMMM',
|
|
72
|
+
shortDate: 'MMM D',
|
|
73
|
+
monthAndDate: 'MMMM D',
|
|
74
|
+
dayOfMonth: 'D',
|
|
75
|
+
year: 'YYYY',
|
|
76
|
+
month: 'MMMM',
|
|
77
|
+
monthShort: 'MMM',
|
|
78
|
+
monthAndYear: 'MMMM YYYY',
|
|
79
|
+
weekday: 'dddd',
|
|
80
|
+
weekdayShort: 'ddd',
|
|
81
|
+
minutes: 'mm',
|
|
82
|
+
hours12h: 'hh',
|
|
83
|
+
hours24h: 'HH',
|
|
84
|
+
seconds: 'ss',
|
|
85
|
+
fullTime: 'LT',
|
|
86
|
+
fullTime12h: 'hh:mm A',
|
|
87
|
+
fullTime24h: 'HH:mm',
|
|
88
|
+
fullDate: 'll',
|
|
89
|
+
fullDateWithWeekday: 'dddd, LL',
|
|
90
|
+
fullDateTime: 'lll',
|
|
91
|
+
fullDateTime12h: 'll hh:mm A',
|
|
92
|
+
fullDateTime24h: 'll HH:mm',
|
|
93
|
+
keyboardDate: 'L',
|
|
94
|
+
keyboardDateTime: 'L LT',
|
|
95
|
+
keyboardDateTime12h: 'L hh:mm A',
|
|
96
|
+
keyboardDateTime24h: 'L HH:mm'
|
|
97
|
+
};
|
|
98
|
+
const withLocale = (dayjs, locale) => !locale ? dayjs : (...args) => dayjs(...args).locale(locale);
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Based on `@date-io/dayjs`
|
|
102
|
+
*
|
|
103
|
+
* MIT License
|
|
104
|
+
*
|
|
105
|
+
* Copyright (c) 2017 Dmitriy Kovalenko
|
|
106
|
+
*
|
|
107
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
108
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
109
|
+
* in the Software without restriction, including without limitation the rights
|
|
110
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
111
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
112
|
+
* furnished to do so, subject to the following conditions:
|
|
113
|
+
*
|
|
114
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
115
|
+
* copies or substantial portions of the Software.
|
|
116
|
+
*
|
|
117
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
118
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
119
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
120
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
121
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
122
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
123
|
+
* SOFTWARE.
|
|
124
|
+
*/
|
|
125
|
+
class AdapterDayjs {
|
|
126
|
+
constructor({
|
|
127
|
+
locale: _locale,
|
|
128
|
+
formats,
|
|
129
|
+
instance
|
|
130
|
+
} = {}) {
|
|
131
|
+
this.isMUIAdapter = true;
|
|
132
|
+
this.rawDayJsInstance = void 0;
|
|
133
|
+
this.lib = 'dayjs';
|
|
134
|
+
this.dayjs = void 0;
|
|
135
|
+
this.locale = void 0;
|
|
136
|
+
this.formats = void 0;
|
|
137
|
+
this.escapedCharacters = {
|
|
138
|
+
start: '[',
|
|
139
|
+
end: ']'
|
|
140
|
+
};
|
|
141
|
+
this.formatTokenMap = formatTokenMap;
|
|
142
|
+
this.getLocaleFormats = () => {
|
|
143
|
+
const locales = this.rawDayJsInstance.Ls ?? _dayjs.default.Ls;
|
|
144
|
+
const locale = this.locale || 'en';
|
|
145
|
+
let localeObject = locales[locale];
|
|
146
|
+
if (localeObject === undefined) {
|
|
147
|
+
localeNotFoundWarning();
|
|
148
|
+
localeObject = locales.en;
|
|
149
|
+
}
|
|
150
|
+
return localeObject.formats;
|
|
151
|
+
};
|
|
152
|
+
this.date = value => {
|
|
153
|
+
if (value === null) {
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
return this.dayjs(value);
|
|
157
|
+
};
|
|
158
|
+
this.toJsDate = value => {
|
|
159
|
+
return value.toDate();
|
|
160
|
+
};
|
|
161
|
+
this.parseISO = isoString => {
|
|
162
|
+
return this.dayjs(isoString);
|
|
163
|
+
};
|
|
164
|
+
this.toISO = value => {
|
|
165
|
+
return value.toISOString();
|
|
166
|
+
};
|
|
167
|
+
this.parse = (value, format) => {
|
|
168
|
+
if (value === '') {
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
return this.dayjs(value, format, this.locale, true);
|
|
172
|
+
};
|
|
173
|
+
this.getCurrentLocaleCode = () => {
|
|
174
|
+
return this.locale || 'en';
|
|
175
|
+
};
|
|
176
|
+
this.is12HourCycleInCurrentLocale = () => {
|
|
177
|
+
/* istanbul ignore next */
|
|
178
|
+
return /A|a/.test(this.getLocaleFormats().LT || '');
|
|
179
|
+
};
|
|
180
|
+
this.expandFormat = format => {
|
|
181
|
+
const localeFormats = this.getLocaleFormats();
|
|
182
|
+
|
|
183
|
+
// @see https://github.com/iamkun/dayjs/blob/dev/src/plugin/localizedFormat/index.js
|
|
184
|
+
const t = formatBis => formatBis.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (_, a, b) => a || b.slice(1));
|
|
185
|
+
return format.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, (_, a, b) => {
|
|
186
|
+
const B = b && b.toUpperCase();
|
|
187
|
+
return a || localeFormats[b] || t(localeFormats[B]);
|
|
188
|
+
});
|
|
189
|
+
};
|
|
190
|
+
this.getFormatHelperText = format => {
|
|
191
|
+
return this.expandFormat(format).replace(/a/gi, '(a|p)m').toLocaleLowerCase();
|
|
192
|
+
};
|
|
193
|
+
this.isNull = date => {
|
|
194
|
+
return date === null;
|
|
195
|
+
};
|
|
196
|
+
this.isValid = value => {
|
|
197
|
+
return this.dayjs(value).isValid();
|
|
198
|
+
};
|
|
199
|
+
this.format = (date, formatKey) => {
|
|
200
|
+
return this.formatByString(date, this.formats[formatKey]);
|
|
201
|
+
};
|
|
202
|
+
this.formatByString = (date, formatString) => {
|
|
203
|
+
return this.dayjs(date).format(formatString);
|
|
204
|
+
};
|
|
205
|
+
this.formatNumber = numberToFormat => {
|
|
206
|
+
return numberToFormat;
|
|
207
|
+
};
|
|
208
|
+
this.getDiff = (date, comparing, units) => {
|
|
209
|
+
return date.diff(comparing, units);
|
|
210
|
+
};
|
|
211
|
+
this.isEqual = (value, comparing) => {
|
|
212
|
+
if (value === null && comparing === null) {
|
|
213
|
+
return true;
|
|
214
|
+
}
|
|
215
|
+
return this.dayjs(value).isSame(comparing);
|
|
216
|
+
};
|
|
217
|
+
this.isSameYear = (date, comparing) => {
|
|
218
|
+
return date.isSame(comparing, 'year');
|
|
219
|
+
};
|
|
220
|
+
this.isSameMonth = (date, comparing) => {
|
|
221
|
+
return date.isSame(comparing, 'month');
|
|
222
|
+
};
|
|
223
|
+
this.isSameDay = (date, comparing) => {
|
|
224
|
+
return date.isSame(comparing, 'day');
|
|
225
|
+
};
|
|
226
|
+
this.isSameHour = (date, comparing) => {
|
|
227
|
+
return date.isSame(comparing, 'hour');
|
|
228
|
+
};
|
|
229
|
+
this.isAfter = (date, value) => {
|
|
230
|
+
return date.isAfter(value);
|
|
231
|
+
};
|
|
232
|
+
this.isAfterYear = (date, value) => {
|
|
233
|
+
return date.isAfter(value, 'year');
|
|
234
|
+
};
|
|
235
|
+
this.isAfterDay = (date, value) => {
|
|
236
|
+
return date.isAfter(value, 'day');
|
|
237
|
+
};
|
|
238
|
+
this.isBefore = (date, value) => {
|
|
239
|
+
return date.isBefore(value);
|
|
240
|
+
};
|
|
241
|
+
this.isBeforeYear = (date, value) => {
|
|
242
|
+
return date.isBefore(value, 'year');
|
|
243
|
+
};
|
|
244
|
+
this.isBeforeDay = (date, value) => {
|
|
245
|
+
return date.isBefore(value, 'day');
|
|
246
|
+
};
|
|
247
|
+
this.isWithinRange = (date, [start, end]) => {
|
|
248
|
+
return date.isBetween(start, end, null, '[]');
|
|
249
|
+
};
|
|
250
|
+
this.startOfYear = date => {
|
|
251
|
+
return date.startOf('year');
|
|
252
|
+
};
|
|
253
|
+
this.startOfMonth = date => {
|
|
254
|
+
return date.startOf('month');
|
|
255
|
+
};
|
|
256
|
+
this.endOfYear = date => {
|
|
257
|
+
return date.endOf('year');
|
|
258
|
+
};
|
|
259
|
+
this.startOfWeek = date => {
|
|
260
|
+
return date.startOf('week');
|
|
261
|
+
};
|
|
262
|
+
this.startOfDay = date => {
|
|
263
|
+
return date.startOf('day');
|
|
264
|
+
};
|
|
265
|
+
this.endOfMonth = date => {
|
|
266
|
+
return date.endOf('month');
|
|
267
|
+
};
|
|
268
|
+
this.endOfWeek = date => {
|
|
269
|
+
return date.endOf('week');
|
|
270
|
+
};
|
|
271
|
+
this.endOfDay = date => {
|
|
272
|
+
return date.endOf('day');
|
|
273
|
+
};
|
|
274
|
+
this.addYears = (date, count) => {
|
|
275
|
+
return count < 0 ? date.subtract(Math.abs(count), 'year') : date.add(count, 'year');
|
|
276
|
+
};
|
|
277
|
+
this.addMonths = (date, count) => {
|
|
278
|
+
return count < 0 ? date.subtract(Math.abs(count), 'month') : date.add(count, 'month');
|
|
279
|
+
};
|
|
280
|
+
this.addWeeks = (date, count) => {
|
|
281
|
+
return count < 0 ? date.subtract(Math.abs(count), 'week') : date.add(count, 'week');
|
|
282
|
+
};
|
|
283
|
+
this.addDays = (date, count) => {
|
|
284
|
+
return count < 0 ? date.subtract(Math.abs(count), 'day') : date.add(count, 'day');
|
|
285
|
+
};
|
|
286
|
+
this.addHours = (date, count) => {
|
|
287
|
+
return count < 0 ? date.subtract(Math.abs(count), 'hour') : date.add(count, 'hour');
|
|
288
|
+
};
|
|
289
|
+
this.addMinutes = (date, count) => {
|
|
290
|
+
return count < 0 ? date.subtract(Math.abs(count), 'minute') : date.add(count, 'minute');
|
|
291
|
+
};
|
|
292
|
+
this.addSeconds = (date, count) => {
|
|
293
|
+
return count < 0 ? date.subtract(Math.abs(count), 'second') : date.add(count, 'second');
|
|
294
|
+
};
|
|
295
|
+
this.getYear = date => {
|
|
296
|
+
return date.year();
|
|
297
|
+
};
|
|
298
|
+
this.getMonth = date => {
|
|
299
|
+
return date.month();
|
|
300
|
+
};
|
|
301
|
+
this.getDate = date => {
|
|
302
|
+
return date.date();
|
|
303
|
+
};
|
|
304
|
+
this.getHours = date => {
|
|
305
|
+
return date.hour();
|
|
306
|
+
};
|
|
307
|
+
this.getMinutes = date => {
|
|
308
|
+
return date.minute();
|
|
309
|
+
};
|
|
310
|
+
this.getSeconds = date => {
|
|
311
|
+
return date.second();
|
|
312
|
+
};
|
|
313
|
+
this.setYear = (date, year) => {
|
|
314
|
+
return date.set('year', year);
|
|
315
|
+
};
|
|
316
|
+
this.setMonth = (date, count) => {
|
|
317
|
+
return date.set('month', count);
|
|
318
|
+
};
|
|
319
|
+
this.setDate = (date, count) => {
|
|
320
|
+
return date.set('date', count);
|
|
321
|
+
};
|
|
322
|
+
this.setHours = (date, count) => {
|
|
323
|
+
return date.set('hour', count);
|
|
324
|
+
};
|
|
325
|
+
this.setMinutes = (date, count) => {
|
|
326
|
+
return date.set('minute', count);
|
|
327
|
+
};
|
|
328
|
+
this.setSeconds = (date, count) => {
|
|
329
|
+
return date.set('second', count);
|
|
330
|
+
};
|
|
331
|
+
this.getDaysInMonth = date => {
|
|
332
|
+
return date.daysInMonth();
|
|
333
|
+
};
|
|
334
|
+
this.getNextMonth = date => {
|
|
335
|
+
return date.add(1, 'month');
|
|
336
|
+
};
|
|
337
|
+
this.getPreviousMonth = date => {
|
|
338
|
+
return date.subtract(1, 'month');
|
|
339
|
+
};
|
|
340
|
+
this.getMonthArray = date => {
|
|
341
|
+
const firstMonth = date.startOf('year');
|
|
342
|
+
const monthArray = [firstMonth];
|
|
343
|
+
while (monthArray.length < 12) {
|
|
344
|
+
const prevMonth = monthArray[monthArray.length - 1];
|
|
345
|
+
monthArray.push(this.getNextMonth(prevMonth));
|
|
346
|
+
}
|
|
347
|
+
return monthArray;
|
|
348
|
+
};
|
|
349
|
+
this.mergeDateAndTime = (date, time) => {
|
|
350
|
+
return date.hour(time.hour()).minute(time.minute()).second(time.second());
|
|
351
|
+
};
|
|
352
|
+
this.getWeekdays = () => {
|
|
353
|
+
const start = this.dayjs().startOf('week');
|
|
354
|
+
return [0, 1, 2, 3, 4, 5, 6].map(diff => this.formatByString(start.add(diff, 'day'), 'dd'));
|
|
355
|
+
};
|
|
356
|
+
this.getWeekArray = date => {
|
|
357
|
+
const start = this.dayjs(date).startOf('month').startOf('week');
|
|
358
|
+
const end = this.dayjs(date).endOf('month').endOf('week');
|
|
359
|
+
let count = 0;
|
|
360
|
+
let current = start;
|
|
361
|
+
const nestedWeeks = [];
|
|
362
|
+
while (current.isBefore(end)) {
|
|
363
|
+
const weekNumber = Math.floor(count / 7);
|
|
364
|
+
nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];
|
|
365
|
+
nestedWeeks[weekNumber].push(current);
|
|
366
|
+
current = current.add(1, 'day');
|
|
367
|
+
count += 1;
|
|
368
|
+
}
|
|
369
|
+
return nestedWeeks;
|
|
370
|
+
};
|
|
371
|
+
this.getWeekNumber = date => {
|
|
372
|
+
return date.week();
|
|
373
|
+
};
|
|
374
|
+
this.getYearRange = (start, end) => {
|
|
375
|
+
const startDate = this.dayjs(start).startOf('year');
|
|
376
|
+
const endDate = this.dayjs(end).endOf('year');
|
|
377
|
+
const years = [];
|
|
378
|
+
let current = startDate;
|
|
379
|
+
while (current.isBefore(endDate)) {
|
|
380
|
+
years.push(current);
|
|
381
|
+
current = current.add(1, 'year');
|
|
382
|
+
}
|
|
383
|
+
return years;
|
|
384
|
+
};
|
|
385
|
+
this.getMeridiemText = ampm => {
|
|
386
|
+
return ampm === 'am' ? 'AM' : 'PM';
|
|
387
|
+
};
|
|
388
|
+
this.rawDayJsInstance = instance || _dayjs.default;
|
|
389
|
+
this.dayjs = withLocale(this.rawDayJsInstance, _locale);
|
|
390
|
+
this.locale = _locale;
|
|
391
|
+
this.formats = (0, _extends2.default)({}, defaultFormats, formats);
|
|
392
|
+
_dayjs.default.extend(_weekOfYear.default);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
exports.AdapterDayjs = AdapterDayjs;
|
|
@@ -1,110 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
|
-
exports
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var _warning = require("../internals/utils/warning");
|
|
12
|
-
/* eslint-disable class-methods-use-this */
|
|
13
|
-
|
|
14
|
-
const localeNotFoundWarning = (0, _warning.buildWarning)(['Your locale has not been found.', 'Either the locale key is not a supported one. Locales supported by dayjs are available here: https://github.com/iamkun/dayjs/tree/dev/src/locale', "Or you forget to import the locale with `require('dayjs/locale/{localeUsed}')`", 'fallback on English locale']);
|
|
15
|
-
const formatTokenMap = {
|
|
16
|
-
// Year
|
|
17
|
-
YY: 'year',
|
|
18
|
-
YYYY: 'year',
|
|
19
|
-
// Month
|
|
20
|
-
M: 'month',
|
|
21
|
-
MM: 'month',
|
|
22
|
-
MMM: {
|
|
23
|
-
sectionType: 'month',
|
|
24
|
-
contentType: 'letter'
|
|
25
|
-
},
|
|
26
|
-
MMMM: {
|
|
27
|
-
sectionType: 'month',
|
|
28
|
-
contentType: 'letter'
|
|
29
|
-
},
|
|
30
|
-
// Day of the month
|
|
31
|
-
D: 'day',
|
|
32
|
-
DD: 'day',
|
|
33
|
-
Do: 'day',
|
|
34
|
-
// Day of the week
|
|
35
|
-
d: 'weekDay',
|
|
36
|
-
dd: {
|
|
37
|
-
sectionType: 'weekDay',
|
|
38
|
-
contentType: 'letter'
|
|
39
|
-
},
|
|
40
|
-
ddd: {
|
|
41
|
-
sectionType: 'weekDay',
|
|
42
|
-
contentType: 'letter'
|
|
43
|
-
},
|
|
44
|
-
dddd: {
|
|
45
|
-
sectionType: 'weekDay',
|
|
46
|
-
contentType: 'letter'
|
|
47
|
-
},
|
|
48
|
-
// Meridiem
|
|
49
|
-
A: 'meridiem',
|
|
50
|
-
a: 'meridiem',
|
|
51
|
-
// Hours
|
|
52
|
-
H: 'hours',
|
|
53
|
-
HH: 'hours',
|
|
54
|
-
h: 'hours',
|
|
55
|
-
hh: 'hours',
|
|
56
|
-
// Minutes
|
|
57
|
-
m: 'minutes',
|
|
58
|
-
mm: 'minutes',
|
|
59
|
-
// Seconds
|
|
60
|
-
s: 'seconds',
|
|
61
|
-
ss: 'seconds'
|
|
62
|
-
};
|
|
63
|
-
class AdapterDayjs extends _dayjs2.default {
|
|
64
|
-
constructor(options) {
|
|
65
|
-
super(options);
|
|
66
|
-
this.isMUIAdapter = true;
|
|
67
|
-
this.formatTokenMap = formatTokenMap;
|
|
68
|
-
this.escapedCharacters = {
|
|
69
|
-
start: '[',
|
|
70
|
-
end: ']'
|
|
71
|
-
};
|
|
72
|
-
this.getLocaleFormats = () => {
|
|
73
|
-
const locales = this.rawDayJsInstance.Ls ?? _dayjs.default.Ls;
|
|
74
|
-
const locale = this.locale || 'en';
|
|
75
|
-
let localeObject = locales[locale];
|
|
76
|
-
if (localeObject === undefined) {
|
|
77
|
-
localeNotFoundWarning();
|
|
78
|
-
localeObject = locales.en;
|
|
79
|
-
}
|
|
80
|
-
return localeObject.formats;
|
|
81
|
-
};
|
|
82
|
-
this.is12HourCycleInCurrentLocale = () => {
|
|
83
|
-
/* istanbul ignore next */
|
|
84
|
-
return /A|a/.test(this.getLocaleFormats().LT || '');
|
|
85
|
-
};
|
|
86
|
-
/**
|
|
87
|
-
* The current getFormatHelperText method uses an outdated format parsing logic.
|
|
88
|
-
* We should use this one in the future to support all localized formats.
|
|
89
|
-
*/
|
|
90
|
-
this.expandFormat = format => {
|
|
91
|
-
const localeFormats = this.getLocaleFormats();
|
|
92
|
-
|
|
93
|
-
// @see https://github.com/iamkun/dayjs/blob/dev/src/plugin/localizedFormat/index.js
|
|
94
|
-
const t = formatBis => formatBis.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (_, a, b) => a || b.slice(1));
|
|
95
|
-
return format.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, (_, a, b) => {
|
|
96
|
-
const B = b && b.toUpperCase();
|
|
97
|
-
return a || localeFormats[b] || t(localeFormats[B]);
|
|
98
|
-
});
|
|
99
|
-
};
|
|
100
|
-
// Redefined here just to show how it can be written using expandFormat
|
|
101
|
-
this.getFormatHelperText = format => {
|
|
102
|
-
return this.expandFormat(format).replace(/a/gi, '(a|p)m').toLocaleLowerCase();
|
|
103
|
-
};
|
|
104
|
-
this.getWeekNumber = date => {
|
|
105
|
-
return date.week();
|
|
106
|
-
};
|
|
107
|
-
_dayjs.default.extend(_weekOfYear.default);
|
|
6
|
+
Object.defineProperty(exports, "AdapterDayjs", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _AdapterDayjs.AdapterDayjs;
|
|
108
10
|
}
|
|
109
|
-
}
|
|
110
|
-
|
|
11
|
+
});
|
|
12
|
+
var _AdapterDayjs = require("./AdapterDayjs");
|
|
@@ -92,7 +92,7 @@ class AdapterLuxon extends _luxon2.default {
|
|
|
92
92
|
if (!_luxon.DateTime.expandFormat) {
|
|
93
93
|
throw Error('Your luxon version does not support `expandFormat`. Consider upgrading it to v3.0.2');
|
|
94
94
|
}
|
|
95
|
-
// Extract escaped section to avoid
|
|
95
|
+
// Extract escaped section to avoid extending them
|
|
96
96
|
const longFormatRegexp = /''|'(''|[^'])+('|$)|[^']*/g;
|
|
97
97
|
return format.match(longFormatRegexp).map(token => {
|
|
98
98
|
const firstCharacter = token[0];
|
|
@@ -8,6 +8,8 @@ exports.AdapterMomentHijri = void 0;
|
|
|
8
8
|
var _hijri = _interopRequireDefault(require("@date-io/hijri"));
|
|
9
9
|
/* eslint-disable class-methods-use-this */
|
|
10
10
|
|
|
11
|
+
// @ts-ignore
|
|
12
|
+
|
|
11
13
|
// From https://momentjs.com/docs/#/displaying/format/
|
|
12
14
|
const formatTokenMap = {
|
|
13
15
|
// Year
|
|
@@ -280,8 +280,6 @@ const DateCalendar = /*#__PURE__*/React.forwardRef(function DateCalendar(inProps
|
|
|
280
280
|
disableFuture: disableFuture,
|
|
281
281
|
reduceAnimations: reduceAnimations,
|
|
282
282
|
labelId: gridLabelId,
|
|
283
|
-
components: components,
|
|
284
|
-
componentsProps: componentsProps,
|
|
285
283
|
slots: slots,
|
|
286
284
|
slotProps: slotProps
|
|
287
285
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(DateCalendarViewTransitionContainer, {
|
|
@@ -20,7 +20,7 @@ var _PickersArrowSwitcher = require("../internals/components/PickersArrowSwitche
|
|
|
20
20
|
var _dateHelpersHooks = require("../internals/hooks/date-helpers-hooks");
|
|
21
21
|
var _pickersCalendarHeaderClasses = require("./pickersCalendarHeaderClasses");
|
|
22
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
|
-
const _excluded = ["ownerState"];
|
|
23
|
+
const _excluded = ["ownerState"]; // We keep the interface to allow module augmentation
|
|
24
24
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
25
25
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
26
26
|
const useUtilityClasses = ownerState => {
|
|
@@ -109,8 +109,6 @@ function PickersCalendarHeader(inProps) {
|
|
|
109
109
|
name: 'MuiPickersCalendarHeader'
|
|
110
110
|
});
|
|
111
111
|
const {
|
|
112
|
-
components,
|
|
113
|
-
componentsProps,
|
|
114
112
|
slots,
|
|
115
113
|
slotProps,
|
|
116
114
|
currentMonth: month,
|
|
@@ -128,10 +126,10 @@ function PickersCalendarHeader(inProps) {
|
|
|
128
126
|
} = props;
|
|
129
127
|
const ownerState = props;
|
|
130
128
|
const classes = useUtilityClasses(props);
|
|
131
|
-
const SwitchViewButton = slots?.switchViewButton ??
|
|
129
|
+
const SwitchViewButton = slots?.switchViewButton ?? PickersCalendarHeaderSwitchViewButton;
|
|
132
130
|
const switchViewButtonProps = (0, _utils.useSlotProps)({
|
|
133
131
|
elementType: SwitchViewButton,
|
|
134
|
-
externalSlotProps: slotProps?.switchViewButton
|
|
132
|
+
externalSlotProps: slotProps?.switchViewButton,
|
|
135
133
|
additionalProps: {
|
|
136
134
|
size: 'small',
|
|
137
135
|
'aria-label': localeText.calendarViewSwitchingButtonAriaLabel(view)
|
|
@@ -139,11 +137,11 @@ function PickersCalendarHeader(inProps) {
|
|
|
139
137
|
ownerState,
|
|
140
138
|
className: classes.switchViewButton
|
|
141
139
|
});
|
|
142
|
-
const SwitchViewIcon = slots?.switchViewIcon ??
|
|
140
|
+
const SwitchViewIcon = slots?.switchViewIcon ?? PickersCalendarHeaderSwitchViewIcon;
|
|
143
141
|
// The spread is here to avoid this bug mui/material-ui#34056
|
|
144
142
|
const _useSlotProps = (0, _utils.useSlotProps)({
|
|
145
143
|
elementType: SwitchViewIcon,
|
|
146
|
-
externalSlotProps: slotProps?.switchViewIcon
|
|
144
|
+
externalSlotProps: slotProps?.switchViewIcon,
|
|
147
145
|
ownerState: undefined,
|
|
148
146
|
className: classes.switchViewIcon
|
|
149
147
|
}),
|
|
@@ -201,8 +199,6 @@ function PickersCalendarHeader(inProps) {
|
|
|
201
199
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Fade.default, {
|
|
202
200
|
in: view === 'day',
|
|
203
201
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PickersArrowSwitcher.PickersArrowSwitcher, {
|
|
204
|
-
components: components,
|
|
205
|
-
componentsProps: componentsProps,
|
|
206
202
|
slots: slots,
|
|
207
203
|
slotProps: slotProps,
|
|
208
204
|
onGoToPrevious: selectPreviousMonth,
|
|
@@ -112,6 +112,7 @@ function PickersSlideTransition(inProps) {
|
|
|
112
112
|
className,
|
|
113
113
|
reduceAnimations,
|
|
114
114
|
transKey
|
|
115
|
+
// extracting `classes` from `other`
|
|
115
116
|
} = props,
|
|
116
117
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
117
118
|
const classes = useUtilityClasses(props);
|
|
@@ -14,7 +14,7 @@ var _styles = require("@mui/material/styles");
|
|
|
14
14
|
var _utils = require("@mui/base/utils");
|
|
15
15
|
var _useDateField2 = require("./useDateField");
|
|
16
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
-
const _excluded = ["components", "componentsProps", "slots", "slotProps"],
|
|
17
|
+
const _excluded = ["components", "componentsProps", "slots", "slotProps", "InputProps", "inputProps"],
|
|
18
18
|
_excluded2 = ["inputRef"],
|
|
19
19
|
_excluded3 = ["ref", "onPaste", "inputMode", "readOnly"];
|
|
20
20
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -28,7 +28,9 @@ const DateField = /*#__PURE__*/React.forwardRef(function DateField(inProps, ref)
|
|
|
28
28
|
components,
|
|
29
29
|
componentsProps,
|
|
30
30
|
slots,
|
|
31
|
-
slotProps
|
|
31
|
+
slotProps,
|
|
32
|
+
InputProps,
|
|
33
|
+
inputProps
|
|
32
34
|
} = themeProps,
|
|
33
35
|
other = (0, _objectWithoutPropertiesLoose2.default)(themeProps, _excluded);
|
|
34
36
|
const ownerState = themeProps;
|
|
@@ -43,6 +45,10 @@ const DateField = /*#__PURE__*/React.forwardRef(function DateField(inProps, ref)
|
|
|
43
45
|
inputRef: externalInputRef
|
|
44
46
|
} = _useSlotProps,
|
|
45
47
|
textFieldProps = (0, _objectWithoutPropertiesLoose2.default)(_useSlotProps, _excluded2);
|
|
48
|
+
|
|
49
|
+
// TODO: Remove when mui/material-ui#35088 will be merged
|
|
50
|
+
textFieldProps.inputProps = (0, _extends2.default)({}, textFieldProps.inputProps, inputProps);
|
|
51
|
+
textFieldProps.InputProps = (0, _extends2.default)({}, textFieldProps.InputProps, InputProps);
|
|
46
52
|
const _useDateField = (0, _useDateField2.useDateField)({
|
|
47
53
|
props: textFieldProps,
|
|
48
54
|
inputRef: externalInputRef
|
|
@@ -123,6 +129,12 @@ process.env.NODE_ENV !== "production" ? DateField.propTypes = {
|
|
|
123
129
|
* Format of the date when rendered in the input(s).
|
|
124
130
|
*/
|
|
125
131
|
format: _propTypes.default.string,
|
|
132
|
+
/**
|
|
133
|
+
* Density of the format when rendered in the input.
|
|
134
|
+
* Setting `formatDensity` to `"spacious"` will add a space before and after each `/`, `-` and `.` character.
|
|
135
|
+
* @default "dense"
|
|
136
|
+
*/
|
|
137
|
+
formatDensity: _propTypes.default.oneOf(['dense', 'spacious']),
|
|
126
138
|
/**
|
|
127
139
|
* Props applied to the [`FormHelperText`](/material-ui/api/form-helper-text/) element.
|
|
128
140
|
*/
|
|
@@ -12,7 +12,7 @@ var _useField = require("../internals/hooks/useField");
|
|
|
12
12
|
var _useDateValidation = require("../internals/hooks/validation/useDateValidation");
|
|
13
13
|
var _dateUtils = require("../internals/utils/date-utils");
|
|
14
14
|
var _useUtils = require("../internals/hooks/useUtils");
|
|
15
|
-
const _excluded = ["value", "defaultValue", "format", "onChange", "readOnly", "onError", "shouldDisableDate", "shouldDisableMonth", "shouldDisableYear", "minDate", "maxDate", "disableFuture", "disablePast", "selectedSections", "onSelectedSectionsChange", "unstableFieldRef"];
|
|
15
|
+
const _excluded = ["value", "defaultValue", "format", "formatDensity", "onChange", "readOnly", "onError", "shouldDisableDate", "shouldDisableMonth", "shouldDisableYear", "minDate", "maxDate", "disableFuture", "disablePast", "selectedSections", "onSelectedSectionsChange", "unstableFieldRef"];
|
|
16
16
|
const useDefaultizedDateField = props => {
|
|
17
17
|
const utils = (0, _useUtils.useUtils)();
|
|
18
18
|
const defaultDates = (0, _useUtils.useDefaultDates)();
|
|
@@ -33,6 +33,7 @@ const useDateField = ({
|
|
|
33
33
|
value,
|
|
34
34
|
defaultValue,
|
|
35
35
|
format,
|
|
36
|
+
formatDensity,
|
|
36
37
|
onChange,
|
|
37
38
|
readOnly,
|
|
38
39
|
onError,
|
|
@@ -55,6 +56,7 @@ const useDateField = ({
|
|
|
55
56
|
value,
|
|
56
57
|
defaultValue,
|
|
57
58
|
format,
|
|
59
|
+
formatDensity,
|
|
58
60
|
onChange,
|
|
59
61
|
readOnly,
|
|
60
62
|
onError,
|
|
@@ -137,6 +137,12 @@ process.env.NODE_ENV !== "production" ? DatePicker.propTypes = {
|
|
|
137
137
|
* Defaults to localized format based on the used `views`.
|
|
138
138
|
*/
|
|
139
139
|
format: _propTypes.default.string,
|
|
140
|
+
/**
|
|
141
|
+
* Density of the format when rendered in the input.
|
|
142
|
+
* Setting `formatDensity` to `"spacious"` will add a space before and after each `/`, `-` and `.` character.
|
|
143
|
+
* @default "dense"
|
|
144
|
+
*/
|
|
145
|
+
formatDensity: _propTypes.default.oneOf(['dense', 'spacious']),
|
|
140
146
|
/**
|
|
141
147
|
* Pass a ref to the `input` element.
|
|
142
148
|
*/
|