@mui/x-date-pickers 7.0.0-alpha.0 → 7.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AdapterDateFns/AdapterDateFns.d.ts +4 -15
- package/AdapterDateFns/AdapterDateFns.js +8 -90
- package/AdapterDateFnsJalali/AdapterDateFnsJalali.d.ts +4 -15
- package/AdapterDateFnsJalali/AdapterDateFnsJalali.js +8 -90
- package/AdapterDayjs/AdapterDayjs.d.ts +5 -17
- package/AdapterDayjs/AdapterDayjs.js +11 -60
- package/AdapterLuxon/AdapterLuxon.d.ts +4 -15
- package/AdapterLuxon/AdapterLuxon.js +3 -73
- package/AdapterMoment/AdapterMoment.d.ts +4 -20
- package/AdapterMoment/AdapterMoment.js +9 -66
- package/AdapterMomentHijri/AdapterMomentHijri.d.ts +1 -7
- package/AdapterMomentHijri/AdapterMomentHijri.js +1 -30
- package/AdapterMomentJalaali/AdapterMomentJalaali.d.ts +1 -9
- package/AdapterMomentJalaali/AdapterMomentJalaali.js +1 -40
- package/CHANGELOG.md +409 -1
- package/DateCalendar/DateCalendar.js +0 -1
- package/DateCalendar/DayCalendar.d.ts +1 -2
- package/DateCalendar/DayCalendar.js +9 -16
- package/DateCalendar/index.d.ts +0 -1
- package/DateCalendar/index.js +1 -3
- package/DatePicker/DatePicker.js +0 -1
- package/DatePicker/shared.d.ts +1 -1
- package/DateTimePicker/DateTimePicker.js +0 -1
- package/DateTimePicker/shared.d.ts +1 -1
- package/DesktopDatePicker/DesktopDatePicker.js +0 -1
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -1
- package/DigitalClock/DigitalClock.js +3 -2
- package/LocalizationProvider/LocalizationProvider.js +0 -6
- package/MobileDatePicker/MobileDatePicker.js +0 -1
- package/MobileDateTimePicker/MobileDateTimePicker.js +0 -1
- package/PickersCalendarHeader/PickersCalendarHeader.js +11 -4
- package/StaticDatePicker/StaticDatePicker.js +0 -1
- package/StaticDateTimePicker/StaticDateTimePicker.js +0 -1
- package/TimePicker/shared.d.ts +1 -1
- package/YearCalendar/YearCalendar.js +1 -1
- package/dateTimeViewRenderers/dateTimeViewRenderers.d.ts +1 -1
- package/index.d.ts +1 -0
- package/index.js +4 -1
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.types.d.ts +5 -0
- package/internals/hooks/useField/useField.utils.js +0 -1
- package/internals/hooks/useField/useFieldState.js +1 -1
- package/internals/utils/getDefaultReferenceDate.d.ts +1 -2
- package/internals/utils/getDefaultReferenceDate.js +0 -4
- package/legacy/AdapterDateFns/AdapterDateFns.js +11 -92
- package/legacy/AdapterDateFnsJalali/AdapterDateFnsJalali.js +11 -92
- package/legacy/AdapterDayjs/AdapterDayjs.js +15 -63
- package/legacy/AdapterLuxon/AdapterLuxon.js +6 -75
- package/legacy/AdapterMoment/AdapterMoment.js +12 -70
- package/legacy/AdapterMomentHijri/AdapterMomentHijri.js +5 -30
- package/legacy/AdapterMomentJalaali/AdapterMomentJalaali.js +5 -40
- package/legacy/DateCalendar/DateCalendar.js +0 -1
- package/legacy/DateCalendar/DayCalendar.js +7 -11
- package/legacy/DateCalendar/index.js +1 -3
- package/legacy/DatePicker/DatePicker.js +0 -1
- package/legacy/DateTimePicker/DateTimePicker.js +0 -1
- package/legacy/DesktopDatePicker/DesktopDatePicker.js +0 -1
- package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -1
- package/legacy/DigitalClock/DigitalClock.js +3 -2
- package/legacy/LocalizationProvider/LocalizationProvider.js +0 -6
- package/legacy/MobileDatePicker/MobileDatePicker.js +0 -1
- package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +0 -1
- package/legacy/PickersCalendarHeader/PickersCalendarHeader.js +11 -3
- package/legacy/StaticDatePicker/StaticDatePicker.js +0 -1
- package/legacy/StaticDateTimePicker/StaticDateTimePicker.js +0 -1
- package/legacy/YearCalendar/YearCalendar.js +1 -1
- package/legacy/index.js +4 -1
- package/legacy/internals/hooks/useField/useField.utils.js +0 -1
- package/legacy/internals/hooks/useField/useFieldState.js +1 -1
- package/legacy/internals/utils/getDefaultReferenceDate.js +0 -6
- package/models/adapters.d.ts +10 -135
- package/models/fields.d.ts +0 -6
- package/modern/AdapterDateFns/AdapterDateFns.js +8 -90
- package/modern/AdapterDateFnsJalali/AdapterDateFnsJalali.js +8 -90
- package/modern/AdapterDayjs/AdapterDayjs.js +11 -59
- package/modern/AdapterLuxon/AdapterLuxon.js +3 -73
- package/modern/AdapterMoment/AdapterMoment.js +9 -65
- package/modern/AdapterMomentHijri/AdapterMomentHijri.js +1 -30
- package/modern/AdapterMomentJalaali/AdapterMomentJalaali.js +1 -40
- package/modern/DateCalendar/DateCalendar.js +0 -1
- package/modern/DateCalendar/DayCalendar.js +9 -15
- package/modern/DateCalendar/index.js +1 -3
- package/modern/DatePicker/DatePicker.js +0 -1
- package/modern/DateTimePicker/DateTimePicker.js +0 -1
- package/modern/DesktopDatePicker/DesktopDatePicker.js +0 -1
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -1
- package/modern/DigitalClock/DigitalClock.js +3 -2
- package/modern/LocalizationProvider/LocalizationProvider.js +0 -6
- package/modern/MobileDatePicker/MobileDatePicker.js +0 -1
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +0 -1
- package/modern/PickersCalendarHeader/PickersCalendarHeader.js +11 -4
- package/modern/StaticDatePicker/StaticDatePicker.js +0 -1
- package/modern/StaticDateTimePicker/StaticDateTimePicker.js +0 -1
- package/modern/YearCalendar/YearCalendar.js +1 -1
- package/modern/index.js +4 -1
- package/modern/internals/hooks/useField/useField.utils.js +0 -1
- package/modern/internals/hooks/useField/useFieldState.js +1 -1
- package/modern/internals/utils/getDefaultReferenceDate.js +0 -1
- package/node/AdapterDateFns/AdapterDateFns.js +8 -90
- package/node/AdapterDateFnsJalali/AdapterDateFnsJalali.js +8 -90
- package/node/AdapterDayjs/AdapterDayjs.js +11 -59
- package/node/AdapterLuxon/AdapterLuxon.js +3 -73
- package/node/AdapterMoment/AdapterMoment.js +9 -65
- package/node/AdapterMomentHijri/AdapterMomentHijri.js +1 -30
- package/node/AdapterMomentJalaali/AdapterMomentJalaali.js +1 -40
- package/node/DateCalendar/DateCalendar.js +0 -1
- package/node/DateCalendar/DayCalendar.js +9 -15
- package/node/DateCalendar/index.js +1 -21
- package/node/DatePicker/DatePicker.js +0 -1
- package/node/DateTimePicker/DateTimePicker.js +0 -1
- package/node/DesktopDatePicker/DesktopDatePicker.js +0 -1
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -1
- package/node/DigitalClock/DigitalClock.js +3 -2
- package/node/LocalizationProvider/LocalizationProvider.js +0 -6
- package/node/MobileDatePicker/MobileDatePicker.js +0 -1
- package/node/MobileDateTimePicker/MobileDateTimePicker.js +0 -1
- package/node/PickersCalendarHeader/PickersCalendarHeader.js +11 -4
- package/node/StaticDatePicker/StaticDatePicker.js +0 -1
- package/node/StaticDateTimePicker/StaticDateTimePicker.js +0 -1
- package/node/YearCalendar/YearCalendar.js +1 -1
- package/node/index.js +13 -1
- package/node/internals/hooks/useField/useField.utils.js +0 -1
- package/node/internals/hooks/useField/useFieldState.js +1 -1
- package/node/internals/utils/getDefaultReferenceDate.js +1 -3
- package/package.json +1 -1
- package/themeAugmentation/overrides.d.ts +1 -1
|
@@ -239,6 +239,7 @@ export function DayCalendar(inProps) {
|
|
|
239
239
|
props: inProps,
|
|
240
240
|
name: 'MuiDayCalendar'
|
|
241
241
|
});
|
|
242
|
+
var utils = useUtils();
|
|
242
243
|
var onFocusedDayChange = props.onFocusedDayChange,
|
|
243
244
|
className = props.className,
|
|
244
245
|
currentMonth = props.currentMonth,
|
|
@@ -264,7 +265,10 @@ export function DayCalendar(inProps) {
|
|
|
264
265
|
shouldDisableDate = props.shouldDisableDate,
|
|
265
266
|
shouldDisableMonth = props.shouldDisableMonth,
|
|
266
267
|
shouldDisableYear = props.shouldDisableYear,
|
|
267
|
-
|
|
268
|
+
_props$dayOfWeekForma = props.dayOfWeekFormatter,
|
|
269
|
+
dayOfWeekFormatter = _props$dayOfWeekForma === void 0 ? function (date) {
|
|
270
|
+
return utils.format(date, 'weekdayShort').charAt(0).toUpperCase();
|
|
271
|
+
} : _props$dayOfWeekForma,
|
|
268
272
|
hasFocus = props.hasFocus,
|
|
269
273
|
onFocusedViewChange = props.onFocusedViewChange,
|
|
270
274
|
gridLabelId = props.gridLabelId,
|
|
@@ -273,15 +277,9 @@ export function DayCalendar(inProps) {
|
|
|
273
277
|
autoFocus = props.autoFocus,
|
|
274
278
|
timezone = props.timezone;
|
|
275
279
|
var now = useNow(timezone);
|
|
276
|
-
var utils = useUtils();
|
|
277
280
|
var classes = useUtilityClasses(props);
|
|
278
281
|
var theme = useTheme();
|
|
279
282
|
var isRTL = theme.direction === 'rtl';
|
|
280
|
-
|
|
281
|
-
// before we could define this outside of the component scope, but now we need utils, which is only defined here
|
|
282
|
-
var dayOfWeekFormatter = dayOfWeekFormatterFromProps || function (_day, date) {
|
|
283
|
-
return utils.format(date, 'weekdayShort').charAt(0).toUpperCase();
|
|
284
|
-
};
|
|
285
283
|
var isDateDisabled = useIsDateDisabled({
|
|
286
284
|
shouldDisableDate: shouldDisableDate,
|
|
287
285
|
shouldDisableMonth: shouldDisableMonth,
|
|
@@ -455,15 +453,13 @@ export function DayCalendar(inProps) {
|
|
|
455
453
|
className: classes.weekNumberLabel,
|
|
456
454
|
children: localeText.calendarWeekNumberHeaderText
|
|
457
455
|
}), getWeekdays(utils, now).map(function (weekday, i) {
|
|
458
|
-
var _dayOfWeekFormatter;
|
|
459
|
-
var day = utils.format(weekday, 'weekdayShort');
|
|
460
456
|
return /*#__PURE__*/_jsx(PickersCalendarWeekDayLabel, {
|
|
461
457
|
variant: "caption",
|
|
462
458
|
role: "columnheader",
|
|
463
459
|
"aria-label": utils.format(utils.addDays(startOfCurrentWeek, i), 'weekday'),
|
|
464
460
|
className: classes.weekDayLabel,
|
|
465
|
-
children:
|
|
466
|
-
},
|
|
461
|
+
children: dayOfWeekFormatter(weekday)
|
|
462
|
+
}, i.toString());
|
|
467
463
|
})]
|
|
468
464
|
}), loading ? /*#__PURE__*/_jsx(PickersCalendarLoadingContainer, {
|
|
469
465
|
className: classes.loadingContainer,
|
|
@@ -2,6 +2,4 @@ export { DateCalendar } from './DateCalendar';
|
|
|
2
2
|
export { getDateCalendarUtilityClass, dateCalendarClasses } from './dateCalendarClasses';
|
|
3
3
|
export { dayPickerClasses } from './dayCalendarClasses';
|
|
4
4
|
export { pickersFadeTransitionGroupClasses } from './pickersFadeTransitionGroupClasses';
|
|
5
|
-
export { pickersSlideTransitionClasses } from './pickersSlideTransitionClasses';
|
|
6
|
-
// TODO v7: Remove and export the `PickersCalendarHeader` folder from the root instead.
|
|
7
|
-
export * from '../PickersCalendarHeader';
|
|
5
|
+
export { pickersSlideTransitionClasses } from './pickersSlideTransitionClasses';
|
|
@@ -65,7 +65,6 @@ process.env.NODE_ENV !== "production" ? DatePicker.propTypes = {
|
|
|
65
65
|
closeOnSelect: PropTypes.bool,
|
|
66
66
|
/**
|
|
67
67
|
* Formats the day of week displayed in the calendar header.
|
|
68
|
-
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
69
68
|
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
70
69
|
* @returns {string} The name to display.
|
|
71
70
|
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
@@ -75,7 +75,6 @@ process.env.NODE_ENV !== "production" ? DateTimePicker.propTypes = {
|
|
|
75
75
|
closeOnSelect: PropTypes.bool,
|
|
76
76
|
/**
|
|
77
77
|
* Formats the day of week displayed in the calendar header.
|
|
78
|
-
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
79
78
|
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
80
79
|
* @returns {string} The name to display.
|
|
81
80
|
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
@@ -89,7 +89,6 @@ DesktopDatePicker.propTypes = {
|
|
|
89
89
|
closeOnSelect: PropTypes.bool,
|
|
90
90
|
/**
|
|
91
91
|
* Formats the day of week displayed in the calendar header.
|
|
92
|
-
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
93
92
|
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
94
93
|
* @returns {string} The name to display.
|
|
95
94
|
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
@@ -137,7 +137,6 @@ DesktopDateTimePicker.propTypes = {
|
|
|
137
137
|
closeOnSelect: PropTypes.bool,
|
|
138
138
|
/**
|
|
139
139
|
* Formats the day of week displayed in the calendar header.
|
|
140
|
-
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
141
140
|
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
142
141
|
* @returns {string} The name to display.
|
|
143
142
|
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
@@ -261,6 +261,7 @@ export var DigitalClock = /*#__PURE__*/React.forwardRef(function DigitalClock(in
|
|
|
261
261
|
return null;
|
|
262
262
|
}
|
|
263
263
|
var isSelected = utils.isEqual(option, value);
|
|
264
|
+
var formattedValue = utils.format(option, ampm ? 'fullTime12h' : 'fullTime24h');
|
|
264
265
|
var tabIndex = focusedOptionIndex === index || focusedOptionIndex === -1 && index === 0 ? 0 : -1;
|
|
265
266
|
return /*#__PURE__*/_jsx(ClockItem, _extends({
|
|
266
267
|
onClick: function onClick() {
|
|
@@ -276,8 +277,8 @@ export var DigitalClock = /*#__PURE__*/React.forwardRef(function DigitalClock(in
|
|
|
276
277
|
"aria-selected": isSelected,
|
|
277
278
|
tabIndex: tabIndex
|
|
278
279
|
}, clockItemProps, {
|
|
279
|
-
children:
|
|
280
|
-
}),
|
|
280
|
+
children: formattedValue
|
|
281
|
+
}), formattedValue);
|
|
281
282
|
})
|
|
282
283
|
})
|
|
283
284
|
}));
|
|
@@ -105,10 +105,6 @@ process.env.NODE_ENV !== "production" ? LocalizationProvider.propTypes = {
|
|
|
105
105
|
dateFormats: PropTypes.shape({
|
|
106
106
|
dayOfMonth: PropTypes.string,
|
|
107
107
|
fullDate: PropTypes.string,
|
|
108
|
-
fullDateTime: PropTypes.string,
|
|
109
|
-
fullDateTime12h: PropTypes.string,
|
|
110
|
-
fullDateTime24h: PropTypes.string,
|
|
111
|
-
fullDateWithWeekday: PropTypes.string,
|
|
112
108
|
fullTime: PropTypes.string,
|
|
113
109
|
fullTime12h: PropTypes.string,
|
|
114
110
|
fullTime24h: PropTypes.string,
|
|
@@ -121,8 +117,6 @@ process.env.NODE_ENV !== "production" ? LocalizationProvider.propTypes = {
|
|
|
121
117
|
meridiem: PropTypes.string,
|
|
122
118
|
minutes: PropTypes.string,
|
|
123
119
|
month: PropTypes.string,
|
|
124
|
-
monthAndDate: PropTypes.string,
|
|
125
|
-
monthAndYear: PropTypes.string,
|
|
126
120
|
monthShort: PropTypes.string,
|
|
127
121
|
normalDate: PropTypes.string,
|
|
128
122
|
normalDateWithWeekday: PropTypes.string,
|
|
@@ -86,7 +86,6 @@ MobileDatePicker.propTypes = {
|
|
|
86
86
|
closeOnSelect: PropTypes.bool,
|
|
87
87
|
/**
|
|
88
88
|
* Formats the day of week displayed in the calendar header.
|
|
89
|
-
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
90
89
|
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
91
90
|
* @returns {string} The name to display.
|
|
92
91
|
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
@@ -107,7 +107,6 @@ MobileDateTimePicker.propTypes = {
|
|
|
107
107
|
closeOnSelect: PropTypes.bool,
|
|
108
108
|
/**
|
|
109
109
|
* Formats the day of week displayed in the calendar header.
|
|
110
|
-
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
111
110
|
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
112
111
|
* @returns {string} The name to display.
|
|
113
112
|
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
-
var _excluded = ["slots", "slotProps", "currentMonth", "disabled", "disableFuture", "disablePast", "maxDate", "minDate", "onMonthChange", "onViewChange", "view", "reduceAnimations", "views", "labelId", "className", "timezone"],
|
|
4
|
+
var _excluded = ["slots", "slotProps", "currentMonth", "disabled", "disableFuture", "disablePast", "maxDate", "minDate", "onMonthChange", "onViewChange", "view", "reduceAnimations", "views", "labelId", "className", "timezone", "format"],
|
|
5
5
|
_excluded2 = ["ownerState"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
@@ -137,6 +137,8 @@ var PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCalend
|
|
|
137
137
|
labelId = props.labelId,
|
|
138
138
|
className = props.className,
|
|
139
139
|
timezone = props.timezone,
|
|
140
|
+
_props$format = props.format,
|
|
141
|
+
format = _props$format === void 0 ? "".concat(utils.formats.month, " ").concat(utils.formats.year) : _props$format,
|
|
140
142
|
other = _objectWithoutProperties(props, _excluded);
|
|
141
143
|
var ownerState = props;
|
|
142
144
|
var classes = useUtilityClasses(props);
|
|
@@ -196,6 +198,7 @@ var PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCalend
|
|
|
196
198
|
if (views.length === 1 && views[0] === 'year') {
|
|
197
199
|
return null;
|
|
198
200
|
}
|
|
201
|
+
var label = utils.formatByString(month, format);
|
|
199
202
|
return /*#__PURE__*/_jsxs(PickersCalendarHeaderRoot, _extends({}, other, {
|
|
200
203
|
ownerState: ownerState,
|
|
201
204
|
className: clsx(className, classes.root),
|
|
@@ -210,12 +213,12 @@ var PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCalend
|
|
|
210
213
|
className: classes.labelContainer,
|
|
211
214
|
children: [/*#__PURE__*/_jsx(PickersFadeTransitionGroup, {
|
|
212
215
|
reduceAnimations: reduceAnimations,
|
|
213
|
-
transKey:
|
|
216
|
+
transKey: label,
|
|
214
217
|
children: /*#__PURE__*/_jsx(PickersCalendarHeaderLabel, {
|
|
215
218
|
id: labelId,
|
|
216
219
|
ownerState: ownerState,
|
|
217
220
|
className: classes.label,
|
|
218
|
-
children:
|
|
221
|
+
children: label
|
|
219
222
|
})
|
|
220
223
|
}), views.length > 1 && !disabled && /*#__PURE__*/_jsx(SwitchViewButton, _extends({}, switchViewButtonProps, {
|
|
221
224
|
children: /*#__PURE__*/_jsx(SwitchViewIcon, _extends({}, switchViewIconProps))
|
|
@@ -252,6 +255,11 @@ process.env.NODE_ENV !== "production" ? PickersCalendarHeader.propTypes = {
|
|
|
252
255
|
disabled: PropTypes.bool,
|
|
253
256
|
disableFuture: PropTypes.bool,
|
|
254
257
|
disablePast: PropTypes.bool,
|
|
258
|
+
/**
|
|
259
|
+
* Format used to display the date.
|
|
260
|
+
* @default `${adapter.formats.month} ${adapter.formats.year}`
|
|
261
|
+
*/
|
|
262
|
+
format: PropTypes.string,
|
|
255
263
|
labelId: PropTypes.string,
|
|
256
264
|
maxDate: PropTypes.any.isRequired,
|
|
257
265
|
minDate: PropTypes.any.isRequired,
|
|
@@ -65,7 +65,6 @@ StaticDatePicker.propTypes = {
|
|
|
65
65
|
className: PropTypes.string,
|
|
66
66
|
/**
|
|
67
67
|
* Formats the day of week displayed in the calendar header.
|
|
68
|
-
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
69
68
|
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
70
69
|
* @returns {string} The name to display.
|
|
71
70
|
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
@@ -85,7 +85,6 @@ StaticDateTimePicker.propTypes = {
|
|
|
85
85
|
className: PropTypes.string,
|
|
86
86
|
/**
|
|
87
87
|
* Formats the day of week displayed in the calendar header.
|
|
88
|
-
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
89
88
|
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
90
89
|
* @returns {string} The name to display.
|
|
91
90
|
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
@@ -248,7 +248,7 @@ export var YearCalendar = /*#__PURE__*/React.forwardRef(function YearCalendar(in
|
|
|
248
248
|
role: "radiogroup",
|
|
249
249
|
"aria-labelledby": gridLabelId
|
|
250
250
|
}, other, {
|
|
251
|
-
children: utils.getYearRange(minDate, maxDate).map(function (year) {
|
|
251
|
+
children: utils.getYearRange([minDate, maxDate]).map(function (year) {
|
|
252
252
|
var yearNumber = utils.getYear(year);
|
|
253
253
|
var isSelected = yearNumber === selectedYear;
|
|
254
254
|
var isDisabled = disabled || isYearDisabled(year);
|
package/legacy/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-date-pickers v7.0.0-alpha.
|
|
2
|
+
* @mui/x-date-pickers v7.0.0-alpha.1
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -46,6 +46,9 @@ export * from './timeViewRenderers';
|
|
|
46
46
|
export * from './PickersLayout';
|
|
47
47
|
export * from './PickersActionBar';
|
|
48
48
|
export * from './PickersShortcuts';
|
|
49
|
+
|
|
50
|
+
// Other slots
|
|
51
|
+
export * from './PickersCalendarHeader';
|
|
49
52
|
export { DEFAULT_DESKTOP_MODE_MEDIA_QUERY } from './internals/utils/utils';
|
|
50
53
|
export * from './models';
|
|
51
54
|
export * from './icons';
|
|
@@ -368,7 +368,6 @@ export var splitFormatIntoSections = function splitFormatIntoSections(utils, tim
|
|
|
368
368
|
maxLength: maxLength,
|
|
369
369
|
value: sectionValue,
|
|
370
370
|
placeholder: getSectionPlaceholder(utils, timezone, localeText, sectionConfig, token),
|
|
371
|
-
hasLeadingZeros: hasLeadingZerosInFormat,
|
|
372
371
|
hasLeadingZerosInFormat: hasLeadingZerosInFormat,
|
|
373
372
|
hasLeadingZerosInInput: hasLeadingZerosInInput,
|
|
374
373
|
startSeparator: sections.length === 0 ? startSeparator : '',
|
|
@@ -280,7 +280,7 @@ export var useFieldState = function useFieldState(params) {
|
|
|
280
280
|
}, [format, utils.locale]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
281
281
|
|
|
282
282
|
React.useEffect(function () {
|
|
283
|
-
var shouldUpdate
|
|
283
|
+
var shouldUpdate;
|
|
284
284
|
if (!valueManager.areValuesEqual(utils, state.value, valueFromTheOutside)) {
|
|
285
285
|
shouldUpdate = true;
|
|
286
286
|
} else {
|
|
@@ -16,12 +16,6 @@ export var getSectionTypeGranularity = function getSectionTypeGranularity(sectio
|
|
|
16
16
|
return (_SECTION_TYPE_GRANULA = SECTION_TYPE_GRANULARITY[section.type]) != null ? _SECTION_TYPE_GRANULA : 1;
|
|
17
17
|
})));
|
|
18
18
|
};
|
|
19
|
-
export var getViewsGranularity = function getViewsGranularity(views) {
|
|
20
|
-
return Math.max.apply(Math, _toConsumableArray(views.map(function (view) {
|
|
21
|
-
var _SECTION_TYPE_GRANULA2;
|
|
22
|
-
return (_SECTION_TYPE_GRANULA2 = SECTION_TYPE_GRANULARITY[view]) != null ? _SECTION_TYPE_GRANULA2 : 1;
|
|
23
|
-
})));
|
|
24
|
-
};
|
|
25
19
|
var roundDate = function roundDate(utils, granularity, date) {
|
|
26
20
|
if (granularity === SECTION_TYPE_GRANULARITY.year) {
|
|
27
21
|
return utils.startOfYear(date);
|
package/models/adapters.d.ts
CHANGED
|
@@ -61,12 +61,6 @@ export interface AdapterFormats {
|
|
|
61
61
|
* @example "Jan 1, 2019"
|
|
62
62
|
*/
|
|
63
63
|
fullDate: string;
|
|
64
|
-
/**
|
|
65
|
-
* The partially localized full date with weekday, useful for text-to-speech accessibility.
|
|
66
|
-
* @example "Tuesday, January 1, 2019"
|
|
67
|
-
* @deprecated Never used internally.
|
|
68
|
-
*/
|
|
69
|
-
fullDateWithWeekday: string;
|
|
70
64
|
/**
|
|
71
65
|
* A keyboard input friendly date format.
|
|
72
66
|
* Used in the date fields.
|
|
@@ -91,18 +85,6 @@ export interface AdapterFormats {
|
|
|
91
85
|
* @example "Sun, Jan 1"
|
|
92
86
|
*/
|
|
93
87
|
normalDateWithWeekday: string;
|
|
94
|
-
/**
|
|
95
|
-
* The month name and the 4-digit year.
|
|
96
|
-
* @example "January 2018"
|
|
97
|
-
* @deprecated Use `${adapter.formats.month} ${adapter.formats.year}`
|
|
98
|
-
*/
|
|
99
|
-
monthAndYear: string;
|
|
100
|
-
/**
|
|
101
|
-
* The month name and the day of the month.
|
|
102
|
-
* @example "January 1"
|
|
103
|
-
* @deprecated Use `${adapter.formats.month} ${adapter.formats.dayOfMonth}`
|
|
104
|
-
*/
|
|
105
|
-
monthAndDate: string;
|
|
106
88
|
/**
|
|
107
89
|
* The hours and the minutes.
|
|
108
90
|
* Used for the aria-label of the opening button of the `TimePicker`.
|
|
@@ -119,24 +101,6 @@ export interface AdapterFormats {
|
|
|
119
101
|
* @example "23:44"
|
|
120
102
|
*/
|
|
121
103
|
fullTime24h: string;
|
|
122
|
-
/**
|
|
123
|
-
* The combination of `fullDate` and `fullTime` formats.
|
|
124
|
-
* @example "Jan 1, 2018 11:44 PM"
|
|
125
|
-
* @deprecated Use `${adapter.formats.fullDate} ${adapter.formats.fullTime}`
|
|
126
|
-
*/
|
|
127
|
-
fullDateTime: string;
|
|
128
|
-
/**
|
|
129
|
-
* The combination of `fullDate` and `fullTime12h` formats.
|
|
130
|
-
* @example "Jan 1, 2018 11:44 PM"
|
|
131
|
-
* @deprecated Use `${adapter.formats.fullDate} ${adapter.formats.fullTime12h}`
|
|
132
|
-
*/
|
|
133
|
-
fullDateTime12h: string;
|
|
134
|
-
/**
|
|
135
|
-
* The combination of `fullDate` and `fullTime24h` formats.
|
|
136
|
-
* @example "Jan 1, 2018 23:44"
|
|
137
|
-
* @deprecated Use `${adapter.formats.fullDate} ${adapter.formats.fullTime24h}`
|
|
138
|
-
*/
|
|
139
|
-
fullDateTime24h: string;
|
|
140
104
|
/**
|
|
141
105
|
* A keyboard input friendly time format.
|
|
142
106
|
* Used in the date-time fields.
|
|
@@ -156,7 +120,6 @@ export interface AdapterFormats {
|
|
|
156
120
|
*/
|
|
157
121
|
keyboardDateTime24h: string;
|
|
158
122
|
}
|
|
159
|
-
export type AdapterUnits = 'years' | 'quarters' | 'months' | 'weeks' | 'days' | 'hours' | 'minutes' | 'seconds' | 'milliseconds';
|
|
160
123
|
export type FieldFormatTokenMap = {
|
|
161
124
|
[formatToken: string]: FieldSectionType | {
|
|
162
125
|
sectionType: FieldSectionType;
|
|
@@ -235,22 +198,6 @@ export interface MuiPickersAdapter<TDate, TLocale = any> {
|
|
|
235
198
|
* @returns {Date} the JavaScript date.
|
|
236
199
|
*/
|
|
237
200
|
toJsDate(value: TDate): Date;
|
|
238
|
-
/**
|
|
239
|
-
* Parse an iso string into a date in the date library format.
|
|
240
|
-
* @deprecate Will be removed in v7.
|
|
241
|
-
* @template TDate
|
|
242
|
-
* @param {string} isoString The iso string to parse.
|
|
243
|
-
* @returns {TDate} the parsed date.
|
|
244
|
-
*/
|
|
245
|
-
parseISO(isoString: string): TDate;
|
|
246
|
-
/**
|
|
247
|
-
* Stringify a date in the date library format into an ISO string.
|
|
248
|
-
* @deprecate Will be removed in v7.
|
|
249
|
-
* @template TDate
|
|
250
|
-
* @param {TDate} value The date to stringify.
|
|
251
|
-
* @returns {string} the iso string representing the date.
|
|
252
|
-
*/
|
|
253
|
-
toISO(value: TDate): string;
|
|
254
201
|
/**
|
|
255
202
|
* Parse a string date in a specific format.
|
|
256
203
|
* @template TDate
|
|
@@ -275,27 +222,12 @@ export interface MuiPickersAdapter<TDate, TLocale = any> {
|
|
|
275
222
|
* @returns {string} The expanded format.
|
|
276
223
|
*/
|
|
277
224
|
expandFormat(format: string): string;
|
|
278
|
-
/**
|
|
279
|
-
* Create a user readable format (taking into account localized format tokens), useful to render helper text for input (e.g. placeholder).
|
|
280
|
-
* @deprecated Will be removed in v7.
|
|
281
|
-
* @param {string} format The format to analyze.
|
|
282
|
-
* @returns {string} The helper text of the given format.
|
|
283
|
-
*/
|
|
284
|
-
getFormatHelperText(format: string): string;
|
|
285
|
-
/**
|
|
286
|
-
* Check if the date is null.
|
|
287
|
-
* @deprecated Will be removed in v7.
|
|
288
|
-
* @template TDate
|
|
289
|
-
* @param {TDate | null} value The date to test.
|
|
290
|
-
* @returns {boolean} `true` if the date is null.
|
|
291
|
-
*/
|
|
292
|
-
isNull(value: TDate | null): boolean;
|
|
293
225
|
/**
|
|
294
226
|
* Check if the date is valid.
|
|
295
|
-
* @param {
|
|
296
|
-
* @returns {boolean} `true` if the value is valid.
|
|
227
|
+
* @param {TDate | null} value The value to test.
|
|
228
|
+
* @returns {boolean} `true` if the value is a valid date according to the date library.
|
|
297
229
|
*/
|
|
298
|
-
isValid(value:
|
|
230
|
+
isValid(value: TDate | null): boolean;
|
|
299
231
|
/**
|
|
300
232
|
* Format a date using an adapter format string (see the `AdapterFormats` interface)
|
|
301
233
|
* @template TDate
|
|
@@ -319,23 +251,13 @@ export interface MuiPickersAdapter<TDate, TLocale = any> {
|
|
|
319
251
|
* @returns {string} The formatted number.
|
|
320
252
|
*/
|
|
321
253
|
formatNumber(numberToFormat: string): string;
|
|
322
|
-
/**
|
|
323
|
-
* Compute the difference between the two dates in the unit provided.
|
|
324
|
-
* @deprecated Will be removed in v7.
|
|
325
|
-
* @template TDate
|
|
326
|
-
* @param {TDate} value The reference date.
|
|
327
|
-
* @param {TDate | string} comparing The date to compare with the reference date.
|
|
328
|
-
* @param {AdapterUnits} unit The unit in which we want to the result to be.
|
|
329
|
-
* @returns {number} The diff between the two dates.
|
|
330
|
-
*/
|
|
331
|
-
getDiff(value: TDate, comparing: TDate | string, unit?: AdapterUnits): number;
|
|
332
254
|
/**
|
|
333
255
|
* Check if the two dates are equal (e.g: they represent the same timestamp).
|
|
334
|
-
* @param {
|
|
335
|
-
* @param {
|
|
256
|
+
* @param {TDate | null} value The reference date.
|
|
257
|
+
* @param {TDate | null} comparing The date to compare with the reference date.
|
|
336
258
|
* @returns {boolean} `true` if the two dates are equal.
|
|
337
259
|
*/
|
|
338
|
-
isEqual(value:
|
|
260
|
+
isEqual(value: TDate | null, comparing: TDate | null): boolean;
|
|
339
261
|
/**
|
|
340
262
|
* Check if the two dates are in the same year (using the timezone of the reference date).
|
|
341
263
|
* @template TDate
|
|
@@ -417,7 +339,7 @@ export interface MuiPickersAdapter<TDate, TLocale = any> {
|
|
|
417
339
|
*/
|
|
418
340
|
isBeforeDay(value: TDate, comparing: TDate): boolean;
|
|
419
341
|
/**
|
|
420
|
-
* Check if the value is
|
|
342
|
+
* Check if the value is within the provided range.
|
|
421
343
|
* @template TDate
|
|
422
344
|
* @param {TDate} value The value to test.
|
|
423
345
|
* @param {[TDate, TDate]} range The range in which the value should be.
|
|
@@ -649,45 +571,6 @@ export interface MuiPickersAdapter<TDate, TLocale = any> {
|
|
|
649
571
|
* @returns {number} The number of days in the month
|
|
650
572
|
*/
|
|
651
573
|
getDaysInMonth(value: TDate): number;
|
|
652
|
-
/**
|
|
653
|
-
* Add one month to the given date.
|
|
654
|
-
* @deprecated Use `addMonths(value, 1)`
|
|
655
|
-
* @template TDate
|
|
656
|
-
* @param {TDate} value The given date.
|
|
657
|
-
* @returns {TDate} The new date with one month added.
|
|
658
|
-
*/
|
|
659
|
-
getNextMonth(value: TDate): TDate;
|
|
660
|
-
/**
|
|
661
|
-
* Subtract one month from the given date.
|
|
662
|
-
* @deprecated Use `addMonths(value, -1)`
|
|
663
|
-
* @template TDate
|
|
664
|
-
* @param {TDate} value The given date.
|
|
665
|
-
* @returns {TDate} The new date with one month subtracted.
|
|
666
|
-
*/
|
|
667
|
-
getPreviousMonth(value: TDate): TDate;
|
|
668
|
-
/**
|
|
669
|
-
* Get an array with all the months in the year of the given date.
|
|
670
|
-
* @deprecated Will be removed in v7.
|
|
671
|
-
* @template TDate
|
|
672
|
-
* @param {TDate} value The given date.
|
|
673
|
-
* @returns {TDate[]} All the months in the year of the given date.
|
|
674
|
-
*/
|
|
675
|
-
getMonthArray(value: TDate): TDate[];
|
|
676
|
-
/**
|
|
677
|
-
* Create a date with the date of the first param and the time of the second param.
|
|
678
|
-
* @deprecated Use `adapter.setHours`, `adapter.setMinutes` and `adapter.setSeconds`.
|
|
679
|
-
* @template TDate
|
|
680
|
-
* @param {TDate} dateParam Param from which we want to get the date.
|
|
681
|
-
* @param {TDate} timeParam Param from which we want to get the time.
|
|
682
|
-
* @returns Date with the date of the first param and the time of the second param.
|
|
683
|
-
*/
|
|
684
|
-
mergeDateAndTime(dateParam: TDate, timeParam: TDate): TDate;
|
|
685
|
-
/**
|
|
686
|
-
* Get the label of each day of a week.
|
|
687
|
-
* @deprecated Will be removed in v7. Use `getWeekdays` from date-utils and format the dates.
|
|
688
|
-
* @returns {string[]} The label of each day of a week.
|
|
689
|
-
*/
|
|
690
|
-
getWeekdays(): string[];
|
|
691
574
|
/**
|
|
692
575
|
* Create a nested list with all the days of the month of the given date grouped by week.
|
|
693
576
|
* @template TDate
|
|
@@ -703,19 +586,11 @@ export interface MuiPickersAdapter<TDate, TLocale = any> {
|
|
|
703
586
|
*/
|
|
704
587
|
getWeekNumber(value: TDate): number;
|
|
705
588
|
/**
|
|
706
|
-
* Create a list with all the years between the start
|
|
589
|
+
* Create a list with all the years between the start and the end date.
|
|
707
590
|
* @template TDate
|
|
708
|
-
* @param {TDate}
|
|
709
|
-
* @param {TDate} end The end of the range.
|
|
591
|
+
* @param {[TDate, TDate]} range The range of year to create.
|
|
710
592
|
* @returns {TDate[]} List of all the years between the start end the end date.
|
|
711
593
|
*/
|
|
712
|
-
getYearRange(
|
|
713
|
-
/**
|
|
714
|
-
* Allow to customize how the "am"` and "pm" strings are rendered.
|
|
715
|
-
* @deprecated Use `utils.format(utils.setHours(utils.date()!, meridiem === 'am' ? 2 : 14), 'meridiem')` instead.
|
|
716
|
-
* @param {"am" | "pm"} meridiem The string to render.
|
|
717
|
-
* @return {string} The formatted string.
|
|
718
|
-
*/
|
|
719
|
-
getMeridiemText(meridiem: 'am' | 'pm'): string;
|
|
594
|
+
getYearRange(range: [TDate, TDate]): TDate[];
|
|
720
595
|
}
|
|
721
596
|
export {};
|
package/models/fields.d.ts
CHANGED
|
@@ -32,12 +32,6 @@ export interface FieldSection {
|
|
|
32
32
|
* Will determine if we should apply a digit-based editing or a letter-based editing.
|
|
33
33
|
*/
|
|
34
34
|
contentType: FieldSectionContentType;
|
|
35
|
-
/**
|
|
36
|
-
* If `true`, the value of this section is supposed to have leading zeroes when parsed by the date library.
|
|
37
|
-
* For example, the value `1` should be rendered as "01" instead of "1".
|
|
38
|
-
* @deprecated Will be removed in v7, use `hasLeadingZerosInFormat` instead.
|
|
39
|
-
*/
|
|
40
|
-
hasLeadingZeros: boolean;
|
|
41
35
|
/**
|
|
42
36
|
* If `true`, the value of this section is supposed to have leading zeroes when parsed by the date library.
|
|
43
37
|
* For example, the value `1` should be rendered as "01" instead of "1".
|