@mui/x-date-pickers-pro 8.5.3 → 8.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +210 -0
- package/DateRangeCalendar/DateRangeCalendar.js +39 -38
- package/DateRangeCalendar/DateRangeCalendar.types.d.ts +1 -1
- package/DateRangeCalendar/useDragRange.d.ts +2 -2
- package/DateRangeCalendar/useDragRange.js +17 -17
- package/DateRangePicker/DateRangePicker.js +1 -1
- package/DateRangePicker/DateRangePickerToolbar.js +4 -4
- package/DateRangePickerDay/DateRangePickerDay.js +5 -4
- package/DateRangePickerDay2/DateRangePickerDay2.js +5 -4
- package/DateTimeRangePicker/DateTimeRangePicker.js +2 -2
- package/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +11 -8
- package/DateTimeRangePicker/DateTimeRangePickerToolbar.js +3 -3
- package/DateTimeRangePicker/shared.js +3 -2
- package/DesktopDateRangePicker/DesktopDateRangePicker.js +5 -5
- package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +15 -9
- package/DesktopTimeRangePicker/DesktopTimeRangePicker.js +5 -4
- package/MobileDateRangePicker/MobileDateRangePicker.js +6 -6
- package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +7 -6
- package/MobileTimeRangePicker/MobileTimeRangePicker.js +7 -6
- package/MultiInputDateRangeField/MultiInputDateRangeField.js +1 -1
- package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +2 -2
- package/MultiInputTimeRangeField/MultiInputTimeRangeField.js +2 -2
- package/PickersRangeCalendarHeader/PickersRangeCalendarHeader.js +4 -4
- package/SingleInputDateRangeField/SingleInputDateRangeField.js +1 -1
- package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +2 -2
- package/SingleInputTimeRangeField/SingleInputTimeRangeField.js +2 -2
- package/StaticDateRangePicker/StaticDateRangePicker.js +1 -1
- package/TimeRangePicker/TimeRangePicker.js +2 -2
- package/TimeRangePicker/TimeRangePickerTimeWrapper.js +11 -8
- package/TimeRangePicker/TimeRangePickerToolbar.js +7 -7
- package/TimeRangePicker/shared.js +3 -2
- package/esm/DateRangeCalendar/DateRangeCalendar.js +41 -40
- package/esm/DateRangeCalendar/DateRangeCalendar.types.d.ts +1 -1
- package/esm/DateRangeCalendar/useDragRange.d.ts +2 -2
- package/esm/DateRangeCalendar/useDragRange.js +17 -17
- package/esm/DateRangePicker/DateRangePicker.js +1 -1
- package/esm/DateRangePicker/DateRangePickerToolbar.js +6 -6
- package/esm/DateRangePickerDay/DateRangePickerDay.js +6 -5
- package/esm/DateRangePickerDay2/DateRangePickerDay2.js +6 -5
- package/esm/DateTimeRangePicker/DateTimeRangePicker.js +2 -2
- package/esm/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +10 -7
- package/esm/DateTimeRangePicker/DateTimeRangePickerToolbar.js +5 -5
- package/esm/DateTimeRangePicker/shared.js +4 -3
- package/esm/DesktopDateRangePicker/DesktopDateRangePicker.js +5 -5
- package/esm/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +13 -7
- package/esm/DesktopTimeRangePicker/DesktopTimeRangePicker.js +6 -5
- package/esm/MobileDateRangePicker/MobileDateRangePicker.js +6 -6
- package/esm/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +6 -5
- package/esm/MobileTimeRangePicker/MobileTimeRangePicker.js +7 -6
- package/esm/MultiInputDateRangeField/MultiInputDateRangeField.js +1 -1
- package/esm/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +2 -2
- package/esm/MultiInputTimeRangeField/MultiInputTimeRangeField.js +2 -2
- package/esm/PickersRangeCalendarHeader/PickersRangeCalendarHeader.js +6 -6
- package/esm/SingleInputDateRangeField/SingleInputDateRangeField.js +1 -1
- package/esm/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +2 -2
- package/esm/SingleInputTimeRangeField/SingleInputTimeRangeField.js +2 -2
- package/esm/StaticDateRangePicker/StaticDateRangePicker.js +1 -1
- package/esm/TimeRangePicker/TimeRangePicker.js +2 -2
- package/esm/TimeRangePicker/TimeRangePickerTimeWrapper.js +10 -7
- package/esm/TimeRangePicker/TimeRangePickerToolbar.js +9 -9
- package/esm/TimeRangePicker/shared.js +4 -3
- package/esm/hooks/useMultiInputRangeField/useMultiInputRangeFieldSelectedSections.js +2 -0
- package/esm/hooks/useMultiInputRangeField/useTextFieldProps.js +2 -0
- package/esm/index.js +2 -1
- package/esm/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +1 -1
- package/esm/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +1 -1
- package/esm/internals/utils/date-range-manager.d.ts +4 -3
- package/esm/internals/utils/date-range-manager.js +14 -8
- package/esm/internals/utils/date-utils.d.ts +5 -5
- package/esm/internals/utils/date-utils.js +11 -11
- package/esm/internals/utils/valueManagers.js +12 -10
- package/esm/managers/useDateRangeManager.js +8 -8
- package/esm/managers/useDateTimeRangeManager.js +9 -9
- package/esm/managers/useTimeRangeManager.js +10 -10
- package/esm/validation/validateDateRange.js +1 -1
- package/esm/validation/validateDateTimeRange.js +1 -1
- package/esm/validation/validateTimeRange.js +1 -1
- package/hooks/useMultiInputRangeField/useMultiInputRangeFieldSelectedSections.js +1 -0
- package/hooks/useMultiInputRangeField/useTextFieldProps.js +1 -0
- package/index.js +1 -1
- package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +1 -1
- package/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +1 -1
- package/internals/utils/date-range-manager.d.ts +4 -3
- package/internals/utils/date-range-manager.js +15 -8
- package/internals/utils/date-utils.d.ts +5 -5
- package/internals/utils/date-utils.js +11 -11
- package/internals/utils/valueManagers.js +12 -10
- package/managers/useDateRangeManager.js +6 -6
- package/managers/useDateTimeRangeManager.js +7 -7
- package/managers/useTimeRangeManager.js +8 -8
- package/package.json +4 -4
- package/validation/validateDateRange.js +1 -1
- package/validation/validateDateTimeRange.js +1 -1
- package/validation/validateTimeRange.js +1 -1
|
@@ -9,7 +9,8 @@ import ButtonBase from '@mui/material/ButtonBase';
|
|
|
9
9
|
import useForkRef from '@mui/utils/useForkRef';
|
|
10
10
|
import composeClasses from '@mui/utils/composeClasses';
|
|
11
11
|
import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
|
|
12
|
-
import { usePickerDayOwnerState
|
|
12
|
+
import { usePickerDayOwnerState } from '@mui/x-date-pickers/internals';
|
|
13
|
+
import { usePickerAdapter } from '@mui/x-date-pickers/hooks';
|
|
13
14
|
import { dateRangePickerDay2Classes, getDateRangePickerDay2UtilityClass } from "./dateRangePickerDay2Classes.js";
|
|
14
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
16
|
const useUtilityClasses = (ownerState, classes) => {
|
|
@@ -302,7 +303,7 @@ const DateRangePickerDay2Raw = /*#__PURE__*/React.forwardRef(function DateRangeP
|
|
|
302
303
|
props: inProps,
|
|
303
304
|
name: 'MuiDateRangePickerDay2'
|
|
304
305
|
});
|
|
305
|
-
const
|
|
306
|
+
const adapter = usePickerAdapter();
|
|
306
307
|
const {
|
|
307
308
|
autoFocus = false,
|
|
308
309
|
className,
|
|
@@ -355,8 +356,8 @@ const DateRangePickerDay2Raw = /*#__PURE__*/React.forwardRef(function DateRangeP
|
|
|
355
356
|
isDayPreviewEnd: isEndOfPreviewing,
|
|
356
357
|
isDayInsidePreview: isPreviewing && !isStartOfPreviewing && !isEndOfPreviewing,
|
|
357
358
|
// Properties specific to the MUI implementation (some might be removed in the next major)
|
|
358
|
-
isDayStartOfMonth:
|
|
359
|
-
isDayEndOfMonth:
|
|
359
|
+
isDayStartOfMonth: adapter.isSameDay(day, adapter.startOfMonth(day)),
|
|
360
|
+
isDayEndOfMonth: adapter.isSameDay(day, adapter.endOfMonth(day)),
|
|
360
361
|
isDayFirstVisibleCell: isFirstVisibleCell,
|
|
361
362
|
isDayLastVisibleCell: isLastVisibleCell,
|
|
362
363
|
isDayFillerCell: outsideCurrentMonth && !showDaysOutsideCurrentMonth,
|
|
@@ -412,7 +413,7 @@ const DateRangePickerDay2Raw = /*#__PURE__*/React.forwardRef(function DateRangeP
|
|
|
412
413
|
}, other, {
|
|
413
414
|
ownerState: ownerState,
|
|
414
415
|
className: clsx(classes.root, className),
|
|
415
|
-
children: children ?? (ownerState.isDayFillerCell ? null :
|
|
416
|
+
children: children ?? (ownerState.isDayFillerCell ? null : adapter.format(day, 'dayOfMonth'))
|
|
416
417
|
}));
|
|
417
418
|
});
|
|
418
419
|
if (process.env.NODE_ENV !== "production") DateRangePickerDay2Raw.displayName = "DateRangePickerDay2Raw";
|
|
@@ -53,7 +53,7 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePicker.propTypes = {
|
|
|
53
53
|
// ----------------------------------------------------------------------
|
|
54
54
|
/**
|
|
55
55
|
* 12h/24h view for hour selection clock.
|
|
56
|
-
* @default
|
|
56
|
+
* @default adapter.is12HourCycleInCurrentLocale()
|
|
57
57
|
*/
|
|
58
58
|
ampm: PropTypes.bool,
|
|
59
59
|
/**
|
|
@@ -313,7 +313,7 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePicker.propTypes = {
|
|
|
313
313
|
* The date used to generate the new value when both `value` and `defaultValue` are empty.
|
|
314
314
|
* @default The closest valid date-time using the validation props, except callbacks like `shouldDisable<...>`.
|
|
315
315
|
*/
|
|
316
|
-
referenceDate: PropTypes.object,
|
|
316
|
+
referenceDate: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]),
|
|
317
317
|
/**
|
|
318
318
|
* Component rendered on the "day" view when `props.loading` is true.
|
|
319
319
|
* @returns {React.ReactNode} The node to render when loading.
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["viewRenderer", "value", "onChange", "defaultValue", "onViewChange", "views", "className"];
|
|
4
|
-
import {
|
|
3
|
+
const _excluded = ["viewRenderer", "value", "onChange", "defaultValue", "onViewChange", "views", "className", "referenceDate"];
|
|
4
|
+
import { usePickerAdapter } from '@mui/x-date-pickers/hooks';
|
|
5
5
|
import { isRangeValid } from "../internals/utils/date-utils.js";
|
|
6
|
-
import { calculateRangeChange } from "../internals/utils/date-range-manager.js";
|
|
6
|
+
import { calculateRangeChange, resolveReferenceDate } from "../internals/utils/date-range-manager.js";
|
|
7
7
|
import { usePickerRangePositionContext } from "../hooks/index.js";
|
|
8
8
|
/**
|
|
9
9
|
* @ignore - internal component.
|
|
10
10
|
*/
|
|
11
11
|
function DateTimeRangePickerTimeWrapper(props) {
|
|
12
|
-
const
|
|
12
|
+
const adapter = usePickerAdapter();
|
|
13
13
|
const {
|
|
14
14
|
viewRenderer,
|
|
15
15
|
value,
|
|
16
16
|
onChange,
|
|
17
17
|
defaultValue,
|
|
18
18
|
onViewChange,
|
|
19
|
-
views
|
|
19
|
+
views,
|
|
20
|
+
referenceDate: referenceDateProp
|
|
20
21
|
} = props,
|
|
21
22
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
22
23
|
const {
|
|
@@ -27,6 +28,7 @@ function DateTimeRangePickerTimeWrapper(props) {
|
|
|
27
28
|
}
|
|
28
29
|
const currentValue = (rangePosition === 'start' ? value?.[0] : value?.[1]) ?? null;
|
|
29
30
|
const currentDefaultValue = (rangePosition === 'start' ? defaultValue?.[0] : defaultValue?.[1]) ?? null;
|
|
31
|
+
const referenceDate = resolveReferenceDate(referenceDateProp, rangePosition);
|
|
30
32
|
const handleOnChange = (newDate, selectionState, selectedView) => {
|
|
31
33
|
if (!onChange || !value) {
|
|
32
34
|
return;
|
|
@@ -35,14 +37,15 @@ function DateTimeRangePickerTimeWrapper(props) {
|
|
|
35
37
|
newRange
|
|
36
38
|
} = calculateRangeChange({
|
|
37
39
|
newDate,
|
|
38
|
-
|
|
40
|
+
adapter,
|
|
39
41
|
range: value,
|
|
40
42
|
rangePosition
|
|
41
43
|
});
|
|
42
|
-
const isFullRangeSelected = rangePosition === 'end' && isRangeValid(
|
|
44
|
+
const isFullRangeSelected = rangePosition === 'end' && isRangeValid(adapter, newRange);
|
|
43
45
|
onChange(newRange, isFullRangeSelected ? 'finish' : 'partial', selectedView);
|
|
44
46
|
};
|
|
45
47
|
return viewRenderer(_extends({}, other, {
|
|
48
|
+
referenceDate,
|
|
46
49
|
views,
|
|
47
50
|
onViewChange,
|
|
48
51
|
value: currentValue,
|
|
@@ -8,8 +8,8 @@ import PropTypes from 'prop-types';
|
|
|
8
8
|
import clsx from 'clsx';
|
|
9
9
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
10
10
|
import composeClasses from '@mui/utils/composeClasses';
|
|
11
|
-
import {
|
|
12
|
-
import { usePickerContext, usePickerTranslations } from '@mui/x-date-pickers/hooks';
|
|
11
|
+
import { useToolbarOwnerState, DateTimePickerToolbarOverrideContext } from '@mui/x-date-pickers/internals';
|
|
12
|
+
import { usePickerAdapter, usePickerContext, usePickerTranslations } from '@mui/x-date-pickers/hooks';
|
|
13
13
|
import { DateTimePickerToolbar } from '@mui/x-date-pickers/DateTimePicker';
|
|
14
14
|
import { getDateTimeRangePickerToolbarUtilityClass } from "./dateTimeRangePickerToolbarClasses.js";
|
|
15
15
|
import { calculateRangeChange } from "../internals/utils/date-range-manager.js";
|
|
@@ -46,7 +46,7 @@ const DateTimeRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateTi
|
|
|
46
46
|
props: inProps,
|
|
47
47
|
name: 'MuiDateTimeRangePickerToolbar'
|
|
48
48
|
});
|
|
49
|
-
const
|
|
49
|
+
const adapter = usePickerAdapter();
|
|
50
50
|
const {
|
|
51
51
|
className,
|
|
52
52
|
classes: classesProp,
|
|
@@ -89,7 +89,7 @@ const DateTimeRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateTi
|
|
|
89
89
|
newRange
|
|
90
90
|
} = calculateRangeChange({
|
|
91
91
|
newDate,
|
|
92
|
-
|
|
92
|
+
adapter,
|
|
93
93
|
range: value,
|
|
94
94
|
rangePosition,
|
|
95
95
|
allowRangeFlip: true
|
|
@@ -98,7 +98,7 @@ const DateTimeRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateTi
|
|
|
98
98
|
setValue(newRange, {
|
|
99
99
|
changeImportance: 'set'
|
|
100
100
|
});
|
|
101
|
-
}, [setValue, setRangePosition, value, rangePosition,
|
|
101
|
+
}, [setValue, setRangePosition, value, rangePosition, adapter]);
|
|
102
102
|
const startOverrides = React.useMemo(() => {
|
|
103
103
|
const handleStartRangeViewChange = newView => {
|
|
104
104
|
if (newView === 'year' || newView === 'month') {
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import { useThemeProps } from '@mui/material/styles';
|
|
3
|
-
import {
|
|
3
|
+
import { applyDefaultViewProps, resolveTimeViewsResponse, useApplyDefaultValuesToDateTimeValidationProps } from '@mui/x-date-pickers/internals';
|
|
4
|
+
import { usePickerAdapter } from '@mui/x-date-pickers/hooks';
|
|
4
5
|
import { DateTimeRangePickerToolbar } from "./DateTimeRangePickerToolbar.js";
|
|
5
6
|
import { DateTimeRangePickerTabs } from "./DateTimeRangePickerTabs.js";
|
|
6
7
|
export function useDateTimeRangePickerDefaultizedProps(props, name) {
|
|
7
|
-
const
|
|
8
|
+
const adapter = usePickerAdapter();
|
|
8
9
|
const themeProps = useThemeProps({
|
|
9
10
|
props,
|
|
10
11
|
name
|
|
11
12
|
});
|
|
12
13
|
const validationProps = useApplyDefaultValuesToDateTimeValidationProps(themeProps);
|
|
13
|
-
const ampm = themeProps.ampm ??
|
|
14
|
+
const ampm = themeProps.ampm ?? adapter.is12HourCycleInCurrentLocale();
|
|
14
15
|
const {
|
|
15
16
|
openTo,
|
|
16
17
|
views: defaultViews
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import { useUtils } from '@mui/x-date-pickers/internals';
|
|
7
|
-
import { extractValidationProps } from '@mui/x-date-pickers/validation';
|
|
8
6
|
import resolveComponentProps from '@mui/utils/resolveComponentProps';
|
|
9
7
|
import refType from '@mui/utils/refType';
|
|
8
|
+
import { extractValidationProps } from '@mui/x-date-pickers/validation';
|
|
9
|
+
import { usePickerAdapter } from '@mui/x-date-pickers/hooks';
|
|
10
10
|
import { rangeValueManager } from "../internals/utils/valueManagers.js";
|
|
11
11
|
import { useDateRangePickerDefaultizedProps } from "../DateRangePicker/shared.js";
|
|
12
12
|
import { renderDateRangeViewCalendar } from "../dateRangeViewRenderers/index.js";
|
|
@@ -24,7 +24,7 @@ import { validateDateRange } from "../validation/index.js";
|
|
|
24
24
|
* - [DesktopDateRangePicker API](https://mui.com/x/api/date-pickers/desktop-date-range-picker/)
|
|
25
25
|
*/
|
|
26
26
|
const DesktopDateRangePicker = /*#__PURE__*/React.forwardRef(function DesktopDateRangePicker(inProps, ref) {
|
|
27
|
-
const
|
|
27
|
+
const adapter = usePickerAdapter();
|
|
28
28
|
|
|
29
29
|
// Props with the default values common to all date time pickers
|
|
30
30
|
const defaultizedProps = useDateRangePickerDefaultizedProps(inProps, 'MuiDesktopDateRangePicker');
|
|
@@ -35,7 +35,7 @@ const DesktopDateRangePicker = /*#__PURE__*/React.forwardRef(function DesktopDat
|
|
|
35
35
|
closeOnSelect: defaultizedProps.closeOnSelect ?? true,
|
|
36
36
|
viewRenderers,
|
|
37
37
|
// TODO: Replace with resolveDateFormat() once we support month and year views
|
|
38
|
-
format: defaultizedProps.format ??
|
|
38
|
+
format: defaultizedProps.format ?? adapter.formats.keyboardDate,
|
|
39
39
|
calendars: defaultizedProps.calendars ?? 2,
|
|
40
40
|
views: ['day'],
|
|
41
41
|
openTo: 'day',
|
|
@@ -278,7 +278,7 @@ DesktopDateRangePicker.propTypes = {
|
|
|
278
278
|
* The date used to generate the new value when both `value` and `defaultValue` are empty.
|
|
279
279
|
* @default The closest valid date-time using the validation props, except callbacks like `shouldDisable<...>`.
|
|
280
280
|
*/
|
|
281
|
-
referenceDate: PropTypes.object,
|
|
281
|
+
referenceDate: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]),
|
|
282
282
|
/**
|
|
283
283
|
* Component rendered on the "day" view when `props.loading` is true.
|
|
284
284
|
* @returns {React.ReactNode} The node to render when loading.
|
|
@@ -5,15 +5,16 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
5
5
|
const _excluded = ["openTo"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
import { isDatePickerView, isInternalTimeView, resolveDateTimeFormat, useUtils } from '@mui/x-date-pickers/internals';
|
|
9
|
-
import { extractValidationProps } from '@mui/x-date-pickers/validation';
|
|
10
8
|
import resolveComponentProps from '@mui/utils/resolveComponentProps';
|
|
11
9
|
import refType from '@mui/utils/refType';
|
|
10
|
+
import Divider from '@mui/material/Divider';
|
|
11
|
+
import { isDatePickerView, isInternalTimeView, resolveDateTimeFormat } from '@mui/x-date-pickers/internals';
|
|
12
|
+
import { extractValidationProps } from '@mui/x-date-pickers/validation';
|
|
12
13
|
import { renderDigitalClockTimeView, renderMultiSectionDigitalClockTimeView } from '@mui/x-date-pickers/timeViewRenderers';
|
|
13
14
|
import { multiSectionDigitalClockClasses, multiSectionDigitalClockSectionClasses } from '@mui/x-date-pickers/MultiSectionDigitalClock';
|
|
14
|
-
import Divider from '@mui/material/Divider';
|
|
15
15
|
import { digitalClockClasses } from '@mui/x-date-pickers/DigitalClock';
|
|
16
16
|
import { DesktopDateTimePickerLayout } from '@mui/x-date-pickers/DesktopDateTimePicker';
|
|
17
|
+
import { usePickerAdapter } from '@mui/x-date-pickers/hooks';
|
|
17
18
|
import { rangeValueManager } from "../internals/utils/valueManagers.js";
|
|
18
19
|
import { renderDateRangeViewCalendar } from "../dateRangeViewRenderers/index.js";
|
|
19
20
|
import { useDesktopRangePicker } from "../internals/hooks/useDesktopRangePicker/index.js";
|
|
@@ -23,6 +24,7 @@ import { SingleInputDateTimeRangeField } from "../SingleInputDateTimeRangeField/
|
|
|
23
24
|
import { DateTimeRangePickerTimeWrapper } from "../DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js";
|
|
24
25
|
import { RANGE_VIEW_HEIGHT } from "../internals/constants/dimensions.js";
|
|
25
26
|
import { usePickerRangePositionContext } from "../hooks/index.js";
|
|
27
|
+
import { resolveReferenceDate } from "../internals/utils/date-range-manager.js";
|
|
26
28
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
27
29
|
const STEPS = [{
|
|
28
30
|
views: null,
|
|
@@ -55,8 +57,11 @@ const rendererInterceptor = function RendererInterceptor(props) {
|
|
|
55
57
|
}]
|
|
56
58
|
});
|
|
57
59
|
const isTimeViewActive = isInternalTimeView(popperView);
|
|
60
|
+
const referenceDate = resolveReferenceDate(rendererProps.referenceDate, rangePosition);
|
|
58
61
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
59
62
|
children: [viewRenderers.day?.(_extends({}, rendererProps, {
|
|
63
|
+
referenceDate,
|
|
64
|
+
rangePosition,
|
|
60
65
|
availableRangePositions: [rangePosition],
|
|
61
66
|
view: !isTimeViewActive ? popperView : 'day',
|
|
62
67
|
views: rendererProps.views.filter(isDatePickerView),
|
|
@@ -69,6 +74,7 @@ const rendererInterceptor = function RendererInterceptor(props) {
|
|
|
69
74
|
gridColumn: 2
|
|
70
75
|
}
|
|
71
76
|
}), /*#__PURE__*/_jsx(DateTimeRangePickerTimeWrapper, _extends({}, finalProps, {
|
|
77
|
+
referenceDate: referenceDate,
|
|
72
78
|
view: isTimeViewActive ? popperView : 'hours',
|
|
73
79
|
views: finalProps.views.filter(isInternalTimeView),
|
|
74
80
|
openTo: isInternalTimeView(openTo) ? openTo : 'hours',
|
|
@@ -91,7 +97,7 @@ if (process.env.NODE_ENV !== "production") rendererInterceptor.displayName = "re
|
|
|
91
97
|
* - [DesktopDateTimeRangePicker API](https://mui.com/x/api/date-pickers/desktop-date-time-range-picker/)
|
|
92
98
|
*/
|
|
93
99
|
const DesktopDateTimeRangePicker = /*#__PURE__*/React.forwardRef(function DesktopDateTimeRangePicker(inProps, ref) {
|
|
94
|
-
const
|
|
100
|
+
const adapter = usePickerAdapter();
|
|
95
101
|
// Props with the default values common to all date time range pickers
|
|
96
102
|
const defaultizedProps = useDateTimeRangePickerDefaultizedProps(inProps, 'MuiDesktopDateTimeRangePicker');
|
|
97
103
|
const renderTimeView = defaultizedProps.shouldRenderTimeInASingleColumn ? renderDigitalClockTimeView : renderMultiSectionDigitalClockTimeView;
|
|
@@ -109,7 +115,7 @@ const DesktopDateTimeRangePicker = /*#__PURE__*/React.forwardRef(function Deskto
|
|
|
109
115
|
const props = _extends({}, defaultizedProps, {
|
|
110
116
|
views,
|
|
111
117
|
viewRenderers,
|
|
112
|
-
format: resolveDateTimeFormat(
|
|
118
|
+
format: resolveDateTimeFormat(adapter, defaultizedProps, true),
|
|
113
119
|
// force true to correctly handle `renderTimeViewClock` as a renderer
|
|
114
120
|
ampmInClock: true,
|
|
115
121
|
calendars: defaultizedProps.calendars ?? 1,
|
|
@@ -148,7 +154,7 @@ DesktopDateTimeRangePicker.propTypes = {
|
|
|
148
154
|
// ----------------------------------------------------------------------
|
|
149
155
|
/**
|
|
150
156
|
* 12h/24h view for hour selection clock.
|
|
151
|
-
* @default
|
|
157
|
+
* @default adapter.is12HourCycleInCurrentLocale()
|
|
152
158
|
*/
|
|
153
159
|
ampm: PropTypes.bool,
|
|
154
160
|
/**
|
|
@@ -402,7 +408,7 @@ DesktopDateTimeRangePicker.propTypes = {
|
|
|
402
408
|
* The date used to generate the new value when both `value` and `defaultValue` are empty.
|
|
403
409
|
* @default The closest valid date-time using the validation props, except callbacks like `shouldDisable<...>`.
|
|
404
410
|
*/
|
|
405
|
-
referenceDate: PropTypes.object,
|
|
411
|
+
referenceDate: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]),
|
|
406
412
|
/**
|
|
407
413
|
* Component rendered on the "day" view when `props.loading` is true.
|
|
408
414
|
* @returns {React.ReactNode} The node to render when loading.
|
|
@@ -6,12 +6,13 @@ const _excluded = ["openTo"];
|
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import resolveComponentProps from '@mui/utils/resolveComponentProps';
|
|
9
|
-
import {
|
|
9
|
+
import { resolveTimeFormat, mergeSx, MULTI_SECTION_CLOCK_SECTION_WIDTH } from '@mui/x-date-pickers/internals';
|
|
10
10
|
import { extractValidationProps } from '@mui/x-date-pickers/validation';
|
|
11
11
|
import { multiSectionDigitalClockClasses, multiSectionDigitalClockSectionClasses } from '@mui/x-date-pickers/MultiSectionDigitalClock';
|
|
12
12
|
import { digitalClockClasses } from '@mui/x-date-pickers/DigitalClock';
|
|
13
13
|
import { renderDigitalClockTimeView, renderMultiSectionDigitalClockTimeView } from '@mui/x-date-pickers/timeViewRenderers';
|
|
14
14
|
import { pickersLayoutClasses } from '@mui/x-date-pickers/PickersLayout';
|
|
15
|
+
import { usePickerAdapter } from '@mui/x-date-pickers/hooks';
|
|
15
16
|
import { rangeValueManager } from "../internals/utils/valueManagers.js";
|
|
16
17
|
import { useTimeRangePickerDefaultizedProps } from "../TimeRangePicker/shared.js";
|
|
17
18
|
import { SingleInputTimeRangeField } from "../SingleInputTimeRangeField/index.js";
|
|
@@ -62,7 +63,7 @@ const rendererInterceptor = function RendererInterceptor(props) {
|
|
|
62
63
|
};
|
|
63
64
|
if (process.env.NODE_ENV !== "production") rendererInterceptor.displayName = "rendererInterceptor";
|
|
64
65
|
const DesktopTimeRangePicker = /*#__PURE__*/React.forwardRef(function DesktopTimeRangePicker(inProps, ref) {
|
|
65
|
-
const
|
|
66
|
+
const adapter = usePickerAdapter();
|
|
66
67
|
|
|
67
68
|
// Props with the default values common to all time range pickers
|
|
68
69
|
const defaultizedProps = useTimeRangePickerDefaultizedProps(inProps, 'MuiDesktopTimeRangePicker');
|
|
@@ -79,7 +80,7 @@ const DesktopTimeRangePicker = /*#__PURE__*/React.forwardRef(function DesktopTim
|
|
|
79
80
|
views,
|
|
80
81
|
viewRenderers,
|
|
81
82
|
ampmInClock: true,
|
|
82
|
-
format: resolveTimeFormat(
|
|
83
|
+
format: resolveTimeFormat(adapter, defaultizedProps),
|
|
83
84
|
slots: _extends({
|
|
84
85
|
field: SingleInputTimeRangeField
|
|
85
86
|
}, defaultizedProps.slots),
|
|
@@ -122,7 +123,7 @@ DesktopTimeRangePicker.propTypes = {
|
|
|
122
123
|
// ----------------------------------------------------------------------
|
|
123
124
|
/**
|
|
124
125
|
* 12h/24h view for hour selection clock.
|
|
125
|
-
* @default
|
|
126
|
+
* @default adapter.is12HourCycleInCurrentLocale()
|
|
126
127
|
*/
|
|
127
128
|
ampm: PropTypes.bool,
|
|
128
129
|
/**
|
|
@@ -308,7 +309,7 @@ DesktopTimeRangePicker.propTypes = {
|
|
|
308
309
|
* The date used to generate the new value when both `value` and `defaultValue` are empty.
|
|
309
310
|
* @default The closest valid date-time using the validation props, except callbacks like `shouldDisable<...>`.
|
|
310
311
|
*/
|
|
311
|
-
referenceDate: PropTypes.object,
|
|
312
|
+
referenceDate: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]),
|
|
312
313
|
/**
|
|
313
314
|
* The currently selected sections.
|
|
314
315
|
* This prop accepts four formats:
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import { useUtils } from '@mui/x-date-pickers/internals';
|
|
7
|
-
import { extractValidationProps } from '@mui/x-date-pickers/validation';
|
|
8
|
-
import resolveComponentProps from '@mui/utils/resolveComponentProps';
|
|
9
6
|
import refType from '@mui/utils/refType';
|
|
7
|
+
import resolveComponentProps from '@mui/utils/resolveComponentProps';
|
|
8
|
+
import { extractValidationProps } from '@mui/x-date-pickers/validation';
|
|
9
|
+
import { usePickerAdapter } from '@mui/x-date-pickers/hooks';
|
|
10
10
|
import { rangeValueManager } from "../internals/utils/valueManagers.js";
|
|
11
11
|
import { useDateRangePickerDefaultizedProps } from "../DateRangePicker/shared.js";
|
|
12
12
|
import { renderDateRangeViewCalendar } from "../dateRangeViewRenderers/index.js";
|
|
@@ -24,7 +24,7 @@ import { validateDateRange } from "../validation/index.js";
|
|
|
24
24
|
* - [MobileDateRangePicker API](https://mui.com/x/api/date-pickers/mobile-date-range-picker/)
|
|
25
25
|
*/
|
|
26
26
|
const MobileDateRangePicker = /*#__PURE__*/React.forwardRef(function MobileDateRangePicker(inProps, ref) {
|
|
27
|
-
const
|
|
27
|
+
const adapter = usePickerAdapter();
|
|
28
28
|
|
|
29
29
|
// Props with the default values common to all date time pickers
|
|
30
30
|
const defaultizedProps = useDateRangePickerDefaultizedProps(inProps, 'MuiMobileDateRangePicker');
|
|
@@ -34,7 +34,7 @@ const MobileDateRangePicker = /*#__PURE__*/React.forwardRef(function MobileDateR
|
|
|
34
34
|
const props = _extends({}, defaultizedProps, {
|
|
35
35
|
viewRenderers,
|
|
36
36
|
// TODO: Replace with resolveDateFormat() once we support month and year views
|
|
37
|
-
format: defaultizedProps.format ??
|
|
37
|
+
format: defaultizedProps.format ?? adapter.formats.keyboardDate,
|
|
38
38
|
// Force one calendar on mobile to avoid layout issues
|
|
39
39
|
calendars: 1,
|
|
40
40
|
// force current calendar position, since we only have one calendar
|
|
@@ -275,7 +275,7 @@ MobileDateRangePicker.propTypes = {
|
|
|
275
275
|
* The date used to generate the new value when both `value` and `defaultValue` are empty.
|
|
276
276
|
* @default The closest valid date-time using the validation props, except callbacks like `shouldDisable<...>`.
|
|
277
277
|
*/
|
|
278
|
-
referenceDate: PropTypes.object,
|
|
278
|
+
referenceDate: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]),
|
|
279
279
|
/**
|
|
280
280
|
* Component rendered on the "day" view when `props.loading` is true.
|
|
281
281
|
* @returns {React.ReactNode} The node to render when loading.
|
|
@@ -6,12 +6,13 @@ const _excluded = ["view", "openTo"];
|
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import refType from '@mui/utils/refType';
|
|
9
|
-
import { DIALOG_WIDTH, VIEW_HEIGHT, isInternalTimeView, isDatePickerView, resolveDateTimeFormat,
|
|
9
|
+
import { DIALOG_WIDTH, VIEW_HEIGHT, isInternalTimeView, isDatePickerView, resolveDateTimeFormat, TIME_VIEWS } from '@mui/x-date-pickers/internals';
|
|
10
10
|
import { extractValidationProps } from '@mui/x-date-pickers/validation';
|
|
11
11
|
import resolveComponentProps from '@mui/utils/resolveComponentProps';
|
|
12
12
|
import { renderDigitalClockTimeView, renderMultiSectionDigitalClockTimeView } from '@mui/x-date-pickers/timeViewRenderers';
|
|
13
13
|
import { multiSectionDigitalClockClasses, multiSectionDigitalClockSectionClasses } from '@mui/x-date-pickers/MultiSectionDigitalClock';
|
|
14
14
|
import { digitalClockClasses } from '@mui/x-date-pickers/DigitalClock';
|
|
15
|
+
import { usePickerAdapter } from '@mui/x-date-pickers/hooks';
|
|
15
16
|
import { rangeValueManager } from "../internals/utils/valueManagers.js";
|
|
16
17
|
import { renderDateRangeViewCalendar } from "../dateRangeViewRenderers/index.js";
|
|
17
18
|
import { useMobileRangePicker } from "../internals/hooks/useMobileRangePicker/index.js";
|
|
@@ -104,7 +105,7 @@ const rendererInterceptor = function RendererInterceptor(props) {
|
|
|
104
105
|
* - [MobileDateTimeRangePicker API](https://mui.com/x/api/date-pickers/mobile-date-time-range-picker/)
|
|
105
106
|
*/
|
|
106
107
|
const MobileDateTimeRangePicker = /*#__PURE__*/React.forwardRef(function MobileDateTimeRangePicker(inProps, ref) {
|
|
107
|
-
const
|
|
108
|
+
const adapter = usePickerAdapter();
|
|
108
109
|
// Props with the default values common to all date time range pickers
|
|
109
110
|
const defaultizedProps = useDateTimeRangePickerDefaultizedProps(inProps, 'MuiMobileDateTimeRangePicker');
|
|
110
111
|
const renderTimeView = defaultizedProps.shouldRenderTimeInASingleColumn ? renderDigitalClockTimeView : renderMultiSectionDigitalClockTimeView;
|
|
@@ -117,7 +118,7 @@ const MobileDateTimeRangePicker = /*#__PURE__*/React.forwardRef(function MobileD
|
|
|
117
118
|
}, defaultizedProps.viewRenderers);
|
|
118
119
|
const props = _extends({}, defaultizedProps, {
|
|
119
120
|
viewRenderers,
|
|
120
|
-
format: resolveDateTimeFormat(
|
|
121
|
+
format: resolveDateTimeFormat(adapter, defaultizedProps, true),
|
|
121
122
|
// Force one calendar on mobile to avoid layout issues
|
|
122
123
|
calendars: 1,
|
|
123
124
|
// force true to correctly handle `renderTimeViewClock` as a renderer
|
|
@@ -158,7 +159,7 @@ MobileDateTimeRangePicker.propTypes = {
|
|
|
158
159
|
// ----------------------------------------------------------------------
|
|
159
160
|
/**
|
|
160
161
|
* 12h/24h view for hour selection clock.
|
|
161
|
-
* @default
|
|
162
|
+
* @default adapter.is12HourCycleInCurrentLocale()
|
|
162
163
|
*/
|
|
163
164
|
ampm: PropTypes.bool,
|
|
164
165
|
/**
|
|
@@ -407,7 +408,7 @@ MobileDateTimeRangePicker.propTypes = {
|
|
|
407
408
|
* The date used to generate the new value when both `value` and `defaultValue` are empty.
|
|
408
409
|
* @default The closest valid date-time using the validation props, except callbacks like `shouldDisable<...>`.
|
|
409
410
|
*/
|
|
410
|
-
referenceDate: PropTypes.object,
|
|
411
|
+
referenceDate: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]),
|
|
411
412
|
/**
|
|
412
413
|
* Component rendered on the "day" view when `props.loading` is true.
|
|
413
414
|
* @returns {React.ReactNode} The node to render when loading.
|
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import { DIALOG_WIDTH, resolveTimeFormat, useUtils, VIEW_HEIGHT } from '@mui/x-date-pickers/internals';
|
|
7
|
-
import resolveComponentProps from '@mui/utils/resolveComponentProps';
|
|
8
6
|
import refType from '@mui/utils/refType';
|
|
7
|
+
import resolveComponentProps from '@mui/utils/resolveComponentProps';
|
|
8
|
+
import { DIALOG_WIDTH, resolveTimeFormat, VIEW_HEIGHT } from '@mui/x-date-pickers/internals';
|
|
9
9
|
import { multiSectionDigitalClockClasses, multiSectionDigitalClockSectionClasses } from '@mui/x-date-pickers/MultiSectionDigitalClock';
|
|
10
10
|
import { digitalClockClasses } from '@mui/x-date-pickers/DigitalClock';
|
|
11
11
|
import { renderDigitalClockTimeView, renderMultiSectionDigitalClockTimeView } from '@mui/x-date-pickers/timeViewRenderers';
|
|
12
12
|
import { extractValidationProps } from '@mui/x-date-pickers/validation';
|
|
13
|
+
import { usePickerAdapter } from '@mui/x-date-pickers/hooks';
|
|
13
14
|
import { rangeValueManager } from "../internals/utils/valueManagers.js";
|
|
14
15
|
import { useTimeRangePickerDefaultizedProps } from "../TimeRangePicker/shared.js";
|
|
15
16
|
import { SingleInputTimeRangeField } from "../SingleInputTimeRangeField/index.js";
|
|
@@ -63,7 +64,7 @@ const rendererInterceptor = function rendererInterceptor(props) {
|
|
|
63
64
|
};
|
|
64
65
|
if (process.env.NODE_ENV !== "production") rendererInterceptor.displayName = "rendererInterceptor";
|
|
65
66
|
const MobileTimeRangePicker = /*#__PURE__*/React.forwardRef(function MobileTimeRangePicker(inProps, ref) {
|
|
66
|
-
const
|
|
67
|
+
const adapter = usePickerAdapter();
|
|
67
68
|
|
|
68
69
|
// Props with the default values common to all time range pickers
|
|
69
70
|
const defaultizedProps = useTimeRangePickerDefaultizedProps(inProps, 'MuiMobileTimeRangePicker');
|
|
@@ -77,7 +78,7 @@ const MobileTimeRangePicker = /*#__PURE__*/React.forwardRef(function MobileTimeR
|
|
|
77
78
|
const props = _extends({}, defaultizedProps, {
|
|
78
79
|
ampmInClock: true,
|
|
79
80
|
viewRenderers,
|
|
80
|
-
format: resolveTimeFormat(
|
|
81
|
+
format: resolveTimeFormat(adapter, defaultizedProps),
|
|
81
82
|
slots: _extends({
|
|
82
83
|
field: SingleInputTimeRangeField
|
|
83
84
|
}, defaultizedProps.slots),
|
|
@@ -112,7 +113,7 @@ MobileTimeRangePicker.propTypes = {
|
|
|
112
113
|
// ----------------------------------------------------------------------
|
|
113
114
|
/**
|
|
114
115
|
* 12h/24h view for hour selection clock.
|
|
115
|
-
* @default
|
|
116
|
+
* @default adapter.is12HourCycleInCurrentLocale()
|
|
116
117
|
*/
|
|
117
118
|
ampm: PropTypes.bool,
|
|
118
119
|
/**
|
|
@@ -296,7 +297,7 @@ MobileTimeRangePicker.propTypes = {
|
|
|
296
297
|
* The date used to generate the new value when both `value` and `defaultValue` are empty.
|
|
297
298
|
* @default The closest valid date-time using the validation props, except callbacks like `shouldDisable<...>`.
|
|
298
299
|
*/
|
|
299
|
-
referenceDate: PropTypes.object,
|
|
300
|
+
referenceDate: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]),
|
|
300
301
|
/**
|
|
301
302
|
* The currently selected sections.
|
|
302
303
|
* This prop accepts four formats:
|
|
@@ -130,7 +130,7 @@ MultiInputDateRangeField.propTypes = {
|
|
|
130
130
|
* For example, on time fields it will be used to determine the date to set.
|
|
131
131
|
* @default The closest valid date using the validation props, except callbacks such as `shouldDisableDate`. Value is rounded to the most granular section used.
|
|
132
132
|
*/
|
|
133
|
-
referenceDate: PropTypes.object,
|
|
133
|
+
referenceDate: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]),
|
|
134
134
|
/**
|
|
135
135
|
* The currently selected sections.
|
|
136
136
|
* This prop accepts four formats:
|
|
@@ -28,7 +28,7 @@ MultiInputDateTimeRangeField.propTypes = {
|
|
|
28
28
|
// ----------------------------------------------------------------------
|
|
29
29
|
/**
|
|
30
30
|
* 12h/24h view for hour selection clock.
|
|
31
|
-
* @default
|
|
31
|
+
* @default adapter.is12HourCycleInCurrentLocale()
|
|
32
32
|
*/
|
|
33
33
|
ampm: PropTypes.bool,
|
|
34
34
|
/**
|
|
@@ -163,7 +163,7 @@ MultiInputDateTimeRangeField.propTypes = {
|
|
|
163
163
|
* For example, on time fields it will be used to determine the date to set.
|
|
164
164
|
* @default The closest valid date using the validation props, except callbacks such as `shouldDisableDate`. Value is rounded to the most granular section used.
|
|
165
165
|
*/
|
|
166
|
-
referenceDate: PropTypes.object,
|
|
166
|
+
referenceDate: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]),
|
|
167
167
|
/**
|
|
168
168
|
* The currently selected sections.
|
|
169
169
|
* This prop accepts four formats:
|
|
@@ -29,7 +29,7 @@ MultiInputTimeRangeField.propTypes = {
|
|
|
29
29
|
// ----------------------------------------------------------------------
|
|
30
30
|
/**
|
|
31
31
|
* 12h/24h view for hour selection clock.
|
|
32
|
-
* @default
|
|
32
|
+
* @default adapter.is12HourCycleInCurrentLocale()
|
|
33
33
|
*/
|
|
34
34
|
ampm: PropTypes.bool,
|
|
35
35
|
/**
|
|
@@ -146,7 +146,7 @@ MultiInputTimeRangeField.propTypes = {
|
|
|
146
146
|
* For example, on time fields it will be used to determine the date to set.
|
|
147
147
|
* @default The closest valid date using the validation props, except callbacks such as `shouldDisableDate`. Value is rounded to the most granular section used.
|
|
148
148
|
*/
|
|
149
|
-
referenceDate: PropTypes.object,
|
|
149
|
+
referenceDate: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]),
|
|
150
150
|
/**
|
|
151
151
|
* The currently selected sections.
|
|
152
152
|
* This prop accepts four formats:
|
|
@@ -8,8 +8,8 @@ import * as React from 'react';
|
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
import { styled } from '@mui/material/styles';
|
|
10
10
|
import { PickersCalendarHeader } from '@mui/x-date-pickers/PickersCalendarHeader';
|
|
11
|
-
import { PickersArrowSwitcher, useNextMonthDisabled, usePreviousMonthDisabled
|
|
12
|
-
import { usePickerTranslations } from '@mui/x-date-pickers/hooks';
|
|
11
|
+
import { PickersArrowSwitcher, useNextMonthDisabled, usePreviousMonthDisabled } from '@mui/x-date-pickers/internals';
|
|
12
|
+
import { usePickerAdapter, usePickerTranslations } from '@mui/x-date-pickers/hooks';
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
const PickersRangeCalendarHeaderContentMultipleCalendars = styled(PickersArrowSwitcher)({
|
|
15
15
|
padding: '12px 16px 4px 16px',
|
|
@@ -18,7 +18,7 @@ const PickersRangeCalendarHeaderContentMultipleCalendars = styled(PickersArrowSw
|
|
|
18
18
|
justifyContent: 'space-between'
|
|
19
19
|
});
|
|
20
20
|
const PickersRangeCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersRangeCalendarHeader(props, ref) {
|
|
21
|
-
const
|
|
21
|
+
const adapter = usePickerAdapter();
|
|
22
22
|
const translations = usePickerTranslations();
|
|
23
23
|
const {
|
|
24
24
|
calendars,
|
|
@@ -57,8 +57,8 @@ const PickersRangeCalendarHeader = /*#__PURE__*/React.forwardRef(function Picker
|
|
|
57
57
|
ref: ref
|
|
58
58
|
}));
|
|
59
59
|
}
|
|
60
|
-
const selectNextMonth = () => onMonthChange(
|
|
61
|
-
const selectPreviousMonth = () => onMonthChange(
|
|
60
|
+
const selectNextMonth = () => onMonthChange(adapter.addMonths(currentMonth, 1));
|
|
61
|
+
const selectPreviousMonth = () => onMonthChange(adapter.addMonths(currentMonth, -1));
|
|
62
62
|
return /*#__PURE__*/_jsx(PickersRangeCalendarHeaderContentMultipleCalendars, _extends({}, otherRangeProps, {
|
|
63
63
|
ref: ref,
|
|
64
64
|
onGoToPrevious: selectPreviousMonth,
|
|
@@ -72,7 +72,7 @@ const PickersRangeCalendarHeader = /*#__PURE__*/React.forwardRef(function Picker
|
|
|
72
72
|
slots: slots,
|
|
73
73
|
slotProps: slotProps,
|
|
74
74
|
labelId: labelId,
|
|
75
|
-
children:
|
|
75
|
+
children: adapter.formatByString(month, format ?? `${adapter.formats.month} ${adapter.formats.year}`)
|
|
76
76
|
}));
|
|
77
77
|
});
|
|
78
78
|
if (process.env.NODE_ENV !== "production") PickersRangeCalendarHeader.displayName = "PickersRangeCalendarHeader";
|
|
@@ -230,7 +230,7 @@ process.env.NODE_ENV !== "production" ? SingleInputDateRangeField.propTypes = {
|
|
|
230
230
|
* For example, on time fields it will be used to determine the date to set.
|
|
231
231
|
* @default The closest valid date using the validation props, except callbacks such as `shouldDisableDate`. Value is rounded to the most granular section used.
|
|
232
232
|
*/
|
|
233
|
-
referenceDate: PropTypes.object,
|
|
233
|
+
referenceDate: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]),
|
|
234
234
|
/**
|
|
235
235
|
* If `true`, the label is displayed as required and the `input` element is required.
|
|
236
236
|
* @default false
|
|
@@ -52,7 +52,7 @@ process.env.NODE_ENV !== "production" ? SingleInputDateTimeRangeField.propTypes
|
|
|
52
52
|
// ----------------------------------------------------------------------
|
|
53
53
|
/**
|
|
54
54
|
* 12h/24h view for hour selection clock.
|
|
55
|
-
* @default
|
|
55
|
+
* @default adapter.is12HourCycleInCurrentLocale()
|
|
56
56
|
*/
|
|
57
57
|
ampm: PropTypes.bool,
|
|
58
58
|
/**
|
|
@@ -263,7 +263,7 @@ process.env.NODE_ENV !== "production" ? SingleInputDateTimeRangeField.propTypes
|
|
|
263
263
|
* For example, on time fields it will be used to determine the date to set.
|
|
264
264
|
* @default The closest valid date using the validation props, except callbacks such as `shouldDisableDate`. Value is rounded to the most granular section used.
|
|
265
265
|
*/
|
|
266
|
-
referenceDate: PropTypes.object,
|
|
266
|
+
referenceDate: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]),
|
|
267
267
|
/**
|
|
268
268
|
* If `true`, the label is displayed as required and the `input` element is required.
|
|
269
269
|
* @default false
|
|
@@ -52,7 +52,7 @@ process.env.NODE_ENV !== "production" ? SingleInputTimeRangeField.propTypes = {
|
|
|
52
52
|
// ----------------------------------------------------------------------
|
|
53
53
|
/**
|
|
54
54
|
* 12h/24h view for hour selection clock.
|
|
55
|
-
* @default
|
|
55
|
+
* @default adapter.is12HourCycleInCurrentLocale()
|
|
56
56
|
*/
|
|
57
57
|
ampm: PropTypes.bool,
|
|
58
58
|
/**
|
|
@@ -245,7 +245,7 @@ process.env.NODE_ENV !== "production" ? SingleInputTimeRangeField.propTypes = {
|
|
|
245
245
|
* For example, on time fields it will be used to determine the date to set.
|
|
246
246
|
* @default The closest valid date using the validation props, except callbacks such as `shouldDisableDate`. Value is rounded to the most granular section used.
|
|
247
247
|
*/
|
|
248
|
-
referenceDate: PropTypes.object,
|
|
248
|
+
referenceDate: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]),
|
|
249
249
|
/**
|
|
250
250
|
* If `true`, the label is displayed as required and the `input` element is required.
|
|
251
251
|
* @default false
|
|
@@ -220,7 +220,7 @@ StaticDateRangePicker.propTypes = {
|
|
|
220
220
|
* The date used to generate the new value when both `value` and `defaultValue` are empty.
|
|
221
221
|
* @default The closest valid date-time using the validation props, except callbacks like `shouldDisable<...>`.
|
|
222
222
|
*/
|
|
223
|
-
referenceDate: PropTypes.object,
|
|
223
|
+
referenceDate: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]),
|
|
224
224
|
/**
|
|
225
225
|
* Component rendered on the "day" view when `props.loading` is true.
|
|
226
226
|
* @returns {React.ReactNode} The node to render when loading.
|