@mui/x-date-pickers-pro 7.22.3 → 8.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/CHANGELOG.md +348 -12
- package/DateRangeCalendar/DateRangeCalendar.d.ts +1 -2
- package/DateRangeCalendar/DateRangeCalendar.js +24 -22
- package/DateRangeCalendar/DateRangeCalendar.types.d.ts +24 -36
- package/DateRangeCalendar/useDragRange.d.ts +10 -9
- package/DateRangeCalendar/useDragRange.js +3 -3
- package/DateRangePicker/DateRangePicker.d.ts +1 -2
- package/DateRangePicker/DateRangePicker.js +12 -8
- package/DateRangePicker/DateRangePicker.types.d.ts +12 -6
- package/DateRangePicker/DateRangePickerToolbar.d.ts +3 -5
- package/DateRangePicker/DateRangePickerToolbar.js +2 -4
- package/DateRangePicker/index.d.ts +1 -1
- package/DateRangePicker/shared.d.ts +12 -12
- package/DateRangePickerDay/DateRangePickerDay.d.ts +2 -3
- package/DateTimeRangePicker/DateTimeRangePicker.d.ts +1 -2
- package/DateTimeRangePicker/DateTimeRangePicker.js +13 -10
- package/DateTimeRangePicker/DateTimeRangePicker.types.d.ts +12 -6
- package/DateTimeRangePicker/DateTimeRangePickerTabs.d.ts +1 -2
- package/DateTimeRangePicker/DateTimeRangePickerTabs.js +2 -2
- package/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.d.ts +8 -9
- package/DateTimeRangePicker/DateTimeRangePickerToolbar.d.ts +4 -6
- package/DateTimeRangePicker/DateTimeRangePickerToolbar.js +7 -7
- package/DateTimeRangePicker/index.d.ts +1 -1
- package/DateTimeRangePicker/shared.d.ts +13 -13
- package/DesktopDateRangePicker/DesktopDateRangePicker.d.ts +1 -2
- package/DesktopDateRangePicker/DesktopDateRangePicker.js +16 -8
- package/DesktopDateRangePicker/DesktopDateRangePicker.types.d.ts +6 -7
- package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.d.ts +1 -2
- package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +13 -10
- package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.types.d.ts +6 -7
- package/MobileDateRangePicker/MobileDateRangePicker.d.ts +1 -2
- package/MobileDateRangePicker/MobileDateRangePicker.js +16 -8
- package/MobileDateRangePicker/MobileDateRangePicker.types.d.ts +6 -7
- package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.d.ts +1 -2
- package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +13 -10
- package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.types.d.ts +6 -7
- package/MultiInputDateRangeField/MultiInputDateRangeField.d.ts +1 -2
- package/MultiInputDateRangeField/MultiInputDateRangeField.js +6 -6
- package/MultiInputDateRangeField/MultiInputDateRangeField.types.d.ts +9 -10
- package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.d.ts +1 -2
- package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +7 -8
- package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.d.ts +9 -10
- package/MultiInputTimeRangeField/MultiInputTimeRangeField.d.ts +1 -2
- package/MultiInputTimeRangeField/MultiInputTimeRangeField.js +6 -6
- package/MultiInputTimeRangeField/MultiInputTimeRangeField.types.d.ts +9 -10
- package/PickersRangeCalendarHeader/PickersRangeCalendarHeader.d.ts +1 -2
- package/PickersRangeCalendarHeader/PickersRangeCalendarHeader.js +2 -2
- package/PickersRangeCalendarHeader/PickersRangeCalendarHeader.types.d.ts +3 -3
- package/README.md +4 -4
- package/SingleInputDateRangeField/SingleInputDateRangeField.d.ts +1 -2
- package/SingleInputDateRangeField/SingleInputDateRangeField.js +6 -6
- package/SingleInputDateRangeField/SingleInputDateRangeField.types.d.ts +8 -8
- package/SingleInputDateRangeField/useSingleInputDateRangeField.d.ts +1 -2
- package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.d.ts +1 -2
- package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +7 -8
- package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.types.d.ts +8 -8
- package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.d.ts +1 -2
- package/SingleInputTimeRangeField/SingleInputTimeRangeField.d.ts +1 -2
- package/SingleInputTimeRangeField/SingleInputTimeRangeField.js +6 -6
- package/SingleInputTimeRangeField/SingleInputTimeRangeField.types.d.ts +8 -8
- package/SingleInputTimeRangeField/useSingleInputTimeRangeField.d.ts +1 -2
- package/StaticDateRangePicker/StaticDateRangePicker.d.ts +1 -2
- package/StaticDateRangePicker/StaticDateRangePicker.js +11 -7
- package/StaticDateRangePicker/StaticDateRangePicker.types.d.ts +6 -7
- package/dateRangeViewRenderers/dateRangeViewRenderers.d.ts +2 -3
- package/index.d.ts +0 -7
- package/index.js +1 -7
- package/internals/hooks/models/useRangePicker.d.ts +6 -7
- package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.d.ts +1 -2
- package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +22 -16
- package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.d.ts +6 -7
- package/internals/hooks/useEnrichedRangePickerFieldProps.d.ts +16 -14
- package/internals/hooks/useEnrichedRangePickerFieldProps.js +13 -13
- package/internals/hooks/useMobileRangePicker/useMobileRangePicker.d.ts +1 -2
- package/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +23 -17
- package/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.d.ts +6 -7
- package/internals/hooks/useMultiInputFieldSelectedSections.d.ts +1 -1
- package/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.d.ts +1 -2
- package/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +2 -0
- package/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.d.ts +1 -2
- package/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +2 -0
- package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.d.ts +1 -2
- package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +3 -1
- package/internals/hooks/useStaticRangePicker/useStaticRangePicker.d.ts +1 -2
- package/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +6 -6
- package/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.d.ts +8 -9
- package/internals/models/dateRange.d.ts +3 -4
- package/internals/models/dateTimeRange.d.ts +5 -10
- package/internals/models/fields.d.ts +26 -0
- package/internals/models/fields.js +1 -0
- package/internals/models/timeRange.d.ts +5 -9
- package/internals/utils/date-range-manager.d.ts +11 -10
- package/internals/utils/date-utils.d.ts +5 -5
- package/internals/utils/releaseInfo.js +1 -1
- package/internals/utils/valueManagers.d.ts +5 -6
- package/models/dateRange.d.ts +4 -5
- package/models/fields.d.ts +5 -32
- package/models/range.d.ts +1 -1
- package/modern/DateRangeCalendar/DateRangeCalendar.js +24 -22
- package/modern/DateRangeCalendar/useDragRange.js +3 -3
- package/modern/DateRangePicker/DateRangePicker.js +12 -8
- package/modern/DateRangePicker/DateRangePickerToolbar.js +2 -4
- package/modern/DateTimeRangePicker/DateTimeRangePicker.js +13 -10
- package/modern/DateTimeRangePicker/DateTimeRangePickerTabs.js +2 -2
- package/modern/DateTimeRangePicker/DateTimeRangePickerToolbar.js +7 -7
- package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +16 -8
- package/modern/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +13 -10
- package/modern/MobileDateRangePicker/MobileDateRangePicker.js +16 -8
- package/modern/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +13 -10
- package/modern/MultiInputDateRangeField/MultiInputDateRangeField.js +6 -6
- package/modern/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +7 -8
- package/modern/MultiInputTimeRangeField/MultiInputTimeRangeField.js +6 -6
- package/modern/PickersRangeCalendarHeader/PickersRangeCalendarHeader.js +2 -2
- package/modern/SingleInputDateRangeField/SingleInputDateRangeField.js +6 -6
- package/modern/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +7 -8
- package/modern/SingleInputTimeRangeField/SingleInputTimeRangeField.js +6 -6
- package/modern/StaticDateRangePicker/StaticDateRangePicker.js +11 -7
- package/modern/index.js +1 -7
- package/modern/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +22 -16
- package/modern/internals/hooks/useEnrichedRangePickerFieldProps.js +13 -13
- package/modern/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +23 -17
- package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +2 -0
- package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +2 -0
- package/modern/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +3 -1
- package/modern/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +6 -6
- package/modern/internals/models/fields.js +1 -0
- package/modern/internals/utils/releaseInfo.js +1 -1
- package/modern/validation/validateDateRange.js +5 -0
- package/modern/validation/validateDateTimeRange.js +5 -0
- package/modern/validation/validateTimeRange.js +5 -0
- package/node/DateRangeCalendar/DateRangeCalendar.js +23 -21
- package/node/DateRangeCalendar/useDragRange.js +3 -3
- package/node/DateRangePicker/DateRangePicker.js +12 -8
- package/node/DateRangePicker/DateRangePickerToolbar.js +1 -3
- package/node/DateTimeRangePicker/DateTimeRangePicker.js +13 -10
- package/node/DateTimeRangePicker/DateTimeRangePickerTabs.js +1 -1
- package/node/DateTimeRangePicker/DateTimeRangePickerToolbar.js +6 -6
- package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +16 -8
- package/node/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +13 -10
- package/node/MobileDateRangePicker/MobileDateRangePicker.js +16 -8
- package/node/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +13 -10
- package/node/MultiInputDateRangeField/MultiInputDateRangeField.js +6 -6
- package/node/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +7 -8
- package/node/MultiInputTimeRangeField/MultiInputTimeRangeField.js +6 -6
- package/node/PickersRangeCalendarHeader/PickersRangeCalendarHeader.js +1 -1
- package/node/SingleInputDateRangeField/SingleInputDateRangeField.js +6 -6
- package/node/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +7 -8
- package/node/SingleInputTimeRangeField/SingleInputTimeRangeField.js +6 -6
- package/node/StaticDateRangePicker/StaticDateRangePicker.js +11 -7
- package/node/index.js +2 -41
- package/node/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +21 -15
- package/node/internals/hooks/useEnrichedRangePickerFieldProps.js +12 -12
- package/node/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +21 -15
- package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +2 -0
- package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +2 -0
- package/node/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +3 -1
- package/node/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +5 -5
- package/node/internals/models/fields.js +5 -0
- package/node/internals/utils/releaseInfo.js +1 -1
- package/node/validation/validateDateRange.js +4 -0
- package/node/validation/validateDateTimeRange.js +4 -0
- package/node/validation/validateTimeRange.js +4 -0
- package/package.json +7 -7
- package/themeAugmentation/props.d.ts +16 -17
- package/validation/validateDateRange.d.ts +9 -5
- package/validation/validateDateRange.js +5 -0
- package/validation/validateDateTimeRange.d.ts +11 -6
- package/validation/validateDateTimeRange.js +5 -0
- package/validation/validateTimeRange.d.ts +9 -4
- package/validation/validateTimeRange.js +5 -0
package/models/fields.d.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { BaseSingleInputPickersTextFieldProps, FieldRef, FieldSection, PickerValidDate } from '@mui/x-date-pickers/models';
|
|
2
|
+
import { UseFieldResponse, FormProps } from '@mui/x-date-pickers/internals';
|
|
3
|
+
import { FieldRef, FieldSection, PickerFieldSlotProps } from '@mui/x-date-pickers/models';
|
|
5
4
|
import { UseClearableFieldResponse } from '@mui/x-date-pickers/hooks';
|
|
6
|
-
import { SxProps } from '@mui/material/styles';
|
|
7
|
-
import TextField from '@mui/material/TextField';
|
|
8
5
|
import { RangePosition } from './range';
|
|
9
6
|
export interface RangeFieldSection extends FieldSection {
|
|
10
7
|
dateName: RangePosition;
|
|
@@ -13,11 +10,9 @@ export type FieldType = 'single-input' | 'multi-input';
|
|
|
13
10
|
/**
|
|
14
11
|
* Props the `textField` slot of the multi input field can receive when used inside a picker.
|
|
15
12
|
*/
|
|
16
|
-
export interface MultiInputFieldSlotTextFieldProps {
|
|
13
|
+
export interface MultiInputFieldSlotTextFieldProps extends FormProps {
|
|
17
14
|
label?: React.ReactNode;
|
|
18
15
|
id?: string;
|
|
19
|
-
disabled?: boolean;
|
|
20
|
-
readOnly?: boolean;
|
|
21
16
|
onKeyDown?: React.KeyboardEventHandler;
|
|
22
17
|
onClick?: React.MouseEventHandler;
|
|
23
18
|
onFocus?: React.FocusEventHandler;
|
|
@@ -46,33 +41,11 @@ export interface RangeFieldSeparatorProps {
|
|
|
46
41
|
dateSeparator?: string;
|
|
47
42
|
}
|
|
48
43
|
/**
|
|
49
|
-
* Props the
|
|
50
|
-
* Only contains what the MUI components are passing to the field,
|
|
51
|
-
* not what users can pass using the `props.slotProps.field`.
|
|
44
|
+
* Props the `slotProps.field` of a range picker component can receive.
|
|
52
45
|
*/
|
|
53
|
-
export
|
|
54
|
-
sx?: SxProps<any>;
|
|
55
|
-
unstableStartFieldRef?: React.Ref<FieldRef<RangeFieldSection>>;
|
|
56
|
-
unstableEndFieldRef?: React.Ref<FieldRef<RangeFieldSection>>;
|
|
57
|
-
slots?: {
|
|
58
|
-
root?: React.ElementType;
|
|
59
|
-
separator?: React.ElementType;
|
|
60
|
-
textField?: React.ElementType;
|
|
61
|
-
};
|
|
62
|
-
slotProps?: {
|
|
63
|
-
root?: SlotComponentProps<React.ElementType<MultiInputFieldSlotRootProps>, {}, Record<string, any>>;
|
|
64
|
-
textField?: SlotComponentProps<typeof TextField, {}, {
|
|
65
|
-
position?: RangePosition;
|
|
66
|
-
} & Record<string, any>>;
|
|
67
|
-
};
|
|
68
|
-
}
|
|
46
|
+
export type PickerRangeFieldSlotProps<TValue, TSection extends FieldSection, TEnableAccessibleFieldDOMStructure extends boolean> = PickerFieldSlotProps<TValue, TSection, TEnableAccessibleFieldDOMStructure> & RangeFieldSeparatorProps;
|
|
69
47
|
/**
|
|
70
48
|
* Props the text field receives when used with a multi input picker.
|
|
71
49
|
* Only contains what the MUI components are passing to the text field, not what users can pass using the `props.slotProps.textField`.
|
|
72
50
|
*/
|
|
73
51
|
export type BaseMultiInputPickersTextFieldProps<TEnableAccessibleFieldDOMStructure extends boolean> = UseClearableFieldResponse<UseFieldResponse<TEnableAccessibleFieldDOMStructure, MultiInputFieldSlotTextFieldProps>>;
|
|
74
|
-
/**
|
|
75
|
-
* Props the text field receives when used with a single or multi input picker.
|
|
76
|
-
* Only contains what the MUI components are passing to the text field, not what users can pass using the `props.slotProps.field` or `props.slotProps.textField`.
|
|
77
|
-
*/
|
|
78
|
-
export type BasePickersTextFieldProps<TEnableAccessibleFieldDOMStructure extends boolean> = BaseSingleInputPickersTextFieldProps<TEnableAccessibleFieldDOMStructure> & BaseMultiInputPickersTextFieldProps<TEnableAccessibleFieldDOMStructure>;
|
package/models/range.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
2
2
|
export type DateRange<TDate extends PickerValidDate> = [TDate | null, TDate | null];
|
|
3
|
-
export type NonEmptyDateRange
|
|
3
|
+
export type NonEmptyDateRange = [PickerValidDate, PickerValidDate];
|
|
4
4
|
export type RangePosition = 'start' | 'end';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
4
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
5
|
-
const _excluded = ["value", "defaultValue", "referenceDate", "onChange", "className", "disableFuture", "disablePast", "minDate", "maxDate", "shouldDisableDate", "reduceAnimations", "onMonthChange", "rangePosition", "defaultRangePosition", "onRangePositionChange", "calendars", "currentMonthCalendarPosition", "slots", "slotProps", "loading", "renderLoading", "disableHighlightToday", "readOnly", "disabled", "showDaysOutsideCurrentMonth", "dayOfWeekFormatter", "disableAutoMonthSwitching", "autoFocus", "fixedWeekNumber", "disableDragEditing", "displayWeekNumber", "timezone", "availableRangePositions", "views", "view", "openTo", "onViewChange"],
|
|
5
|
+
const _excluded = ["value", "defaultValue", "referenceDate", "onChange", "className", "classes", "disableFuture", "disablePast", "minDate", "maxDate", "shouldDisableDate", "reduceAnimations", "onMonthChange", "rangePosition", "defaultRangePosition", "onRangePositionChange", "calendars", "currentMonthCalendarPosition", "slots", "slotProps", "loading", "renderLoading", "disableHighlightToday", "readOnly", "disabled", "showDaysOutsideCurrentMonth", "dayOfWeekFormatter", "disableAutoMonthSwitching", "autoFocus", "fixedWeekNumber", "disableDragEditing", "displayWeekNumber", "timezone", "availableRangePositions", "views", "view", "openTo", "onViewChange"],
|
|
6
6
|
_excluded2 = ["isDragging", "rangeDragDay", "draggingDatePosition"];
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
@@ -15,7 +15,7 @@ import { styled, useThemeProps } from '@mui/material/styles';
|
|
|
15
15
|
import composeClasses from '@mui/utils/composeClasses';
|
|
16
16
|
import useId from '@mui/utils/useId';
|
|
17
17
|
import { Watermark } from '@mui/x-license';
|
|
18
|
-
import { applyDefaultDate, DayCalendar, useDefaultReduceAnimations, useCalendarState, useDefaultDates, useUtils, useNow, DEFAULT_DESKTOP_MODE_MEDIA_QUERY, useControlledValueWithTimezone, useViews } from '@mui/x-date-pickers/internals';
|
|
18
|
+
import { applyDefaultDate, DayCalendar, useDefaultReduceAnimations, useCalendarState, useDefaultDates, useUtils, useNow, DEFAULT_DESKTOP_MODE_MEDIA_QUERY, useControlledValueWithTimezone, useViews, usePickerPrivateContext } from '@mui/x-date-pickers/internals';
|
|
19
19
|
import { warnOnce } from '@mui/x-internals/warning';
|
|
20
20
|
import { getReleaseInfo } from "../internals/utils/releaseInfo.js";
|
|
21
21
|
import { dateRangeCalendarClasses, getDateRangeCalendarUtilityClass } from "./dateRangeCalendarClasses.js";
|
|
@@ -97,15 +97,11 @@ function useDateRangeCalendarDefaultizedProps(props, name) {
|
|
|
97
97
|
availableRangePositions: themeProps.availableRangePositions ?? ['start', 'end']
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
|
-
const useUtilityClasses = ownerState => {
|
|
101
|
-
const {
|
|
102
|
-
classes,
|
|
103
|
-
isDragging
|
|
104
|
-
} = ownerState;
|
|
100
|
+
const useUtilityClasses = (classes, ownerState) => {
|
|
105
101
|
const slots = {
|
|
106
102
|
root: ['root'],
|
|
107
103
|
monthContainer: ['monthContainer'],
|
|
108
|
-
dayCalendar: [
|
|
104
|
+
dayCalendar: [ownerState.isDraggingDay && 'dayDragging']
|
|
109
105
|
};
|
|
110
106
|
return composeClasses(slots, getDateRangeCalendarUtilityClass, classes);
|
|
111
107
|
};
|
|
@@ -130,6 +126,7 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
|
|
|
130
126
|
referenceDate,
|
|
131
127
|
onChange,
|
|
132
128
|
className,
|
|
129
|
+
classes: classesProp,
|
|
133
130
|
disableFuture,
|
|
134
131
|
disablePast,
|
|
135
132
|
minDate,
|
|
@@ -172,6 +169,7 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
|
|
|
172
169
|
name: 'DateRangeCalendar',
|
|
173
170
|
timezone: timezoneProp,
|
|
174
171
|
value: valueProp,
|
|
172
|
+
referenceDate,
|
|
175
173
|
defaultValue,
|
|
176
174
|
onChange,
|
|
177
175
|
valueManager: rangeValueManager
|
|
@@ -245,10 +243,13 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
|
|
|
245
243
|
draggingDatePosition
|
|
246
244
|
} = _useDragRange,
|
|
247
245
|
dragEventHandlers = _objectWithoutPropertiesLoose(_useDragRange, _excluded2);
|
|
248
|
-
const
|
|
249
|
-
|
|
246
|
+
const {
|
|
247
|
+
ownerState: pickersOwnerState
|
|
248
|
+
} = usePickerPrivateContext();
|
|
249
|
+
const ownerState = _extends({}, pickersOwnerState, {
|
|
250
|
+
isDraggingDay: isDragging
|
|
250
251
|
});
|
|
251
|
-
const classes = useUtilityClasses(ownerState);
|
|
252
|
+
const classes = useUtilityClasses(classesProp, ownerState);
|
|
252
253
|
const draggingRange = React.useMemo(() => {
|
|
253
254
|
if (!valueDayRange[0] || !valueDayRange[1] || !rangeDragDay) {
|
|
254
255
|
return [null, null];
|
|
@@ -310,7 +311,7 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
|
|
|
310
311
|
slots,
|
|
311
312
|
slotProps
|
|
312
313
|
},
|
|
313
|
-
ownerState
|
|
314
|
+
ownerState
|
|
314
315
|
});
|
|
315
316
|
const prevValue = React.useRef(null);
|
|
316
317
|
React.useEffect(() => {
|
|
@@ -371,7 +372,8 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
|
|
|
371
372
|
const slotPropsForDayCalendar = _extends({}, slotProps, {
|
|
372
373
|
day: dayOwnerState => {
|
|
373
374
|
const {
|
|
374
|
-
day
|
|
375
|
+
day,
|
|
376
|
+
isDaySelected
|
|
375
377
|
} = dayOwnerState;
|
|
376
378
|
const isSelectedStartDate = isStartOfRange(utils, day, valueDayRange);
|
|
377
379
|
const isSelectedEndDate = isEndOfRange(utils, day, valueDayRange);
|
|
@@ -394,7 +396,7 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
|
|
|
394
396
|
isEndOfHighlighting: isDragging ? isEndOfRange(utils, day, draggingRange) : isSelectedEndDate,
|
|
395
397
|
onMouseEnter: shouldHavePreview ? handleDayMouseEnter : undefined,
|
|
396
398
|
// apply selected styling to the dragging start or end day
|
|
397
|
-
isVisuallySelected:
|
|
399
|
+
isVisuallySelected: isDaySelected || isDragging && (isStartOfHighlighting || isEndOfHighlighting),
|
|
398
400
|
'data-position': datePosition
|
|
399
401
|
}, dragEventHandlers, {
|
|
400
402
|
draggable: isElementDraggable ? true : undefined
|
|
@@ -515,9 +517,9 @@ process.env.NODE_ENV !== "production" ? DateRangeCalendar.propTypes = {
|
|
|
515
517
|
currentMonthCalendarPosition: PropTypes.oneOf([1, 2, 3]),
|
|
516
518
|
/**
|
|
517
519
|
* Formats the day of week displayed in the calendar header.
|
|
518
|
-
* @param {
|
|
520
|
+
* @param {PickerValidDate} date The date of the day of week provided by the adapter.
|
|
519
521
|
* @returns {string} The name to display.
|
|
520
|
-
* @default (date:
|
|
522
|
+
* @default (date: PickerValidDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
521
523
|
*/
|
|
522
524
|
dayOfWeekFormatter: PropTypes.func,
|
|
523
525
|
/**
|
|
@@ -537,7 +539,8 @@ process.env.NODE_ENV !== "production" ? DateRangeCalendar.propTypes = {
|
|
|
537
539
|
*/
|
|
538
540
|
disableAutoMonthSwitching: PropTypes.bool,
|
|
539
541
|
/**
|
|
540
|
-
* If `true`, the
|
|
542
|
+
* If `true`, the component is disabled.
|
|
543
|
+
* When disabled, the value cannot be changed and no interaction is possible.
|
|
541
544
|
* @default false
|
|
542
545
|
*/
|
|
543
546
|
disabled: PropTypes.bool,
|
|
@@ -608,8 +611,7 @@ process.env.NODE_ENV !== "production" ? DateRangeCalendar.propTypes = {
|
|
|
608
611
|
onFocusedViewChange: PropTypes.func,
|
|
609
612
|
/**
|
|
610
613
|
* Callback fired on month change.
|
|
611
|
-
* @
|
|
612
|
-
* @param {TDate} month The new month.
|
|
614
|
+
* @param {PickerValidDate} month The new month.
|
|
613
615
|
*/
|
|
614
616
|
onMonthChange: PropTypes.func,
|
|
615
617
|
/**
|
|
@@ -635,7 +637,8 @@ process.env.NODE_ENV !== "production" ? DateRangeCalendar.propTypes = {
|
|
|
635
637
|
*/
|
|
636
638
|
rangePosition: PropTypes.oneOf(['end', 'start']),
|
|
637
639
|
/**
|
|
638
|
-
*
|
|
640
|
+
* If `true`, the component is read-only.
|
|
641
|
+
* When read-only, the value cannot be changed but the user can interact with the interface.
|
|
639
642
|
* @default false
|
|
640
643
|
*/
|
|
641
644
|
readOnly: PropTypes.bool,
|
|
@@ -660,8 +663,7 @@ process.env.NODE_ENV !== "production" ? DateRangeCalendar.propTypes = {
|
|
|
660
663
|
*
|
|
661
664
|
* Warning: This function can be called multiple times (for example when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
662
665
|
*
|
|
663
|
-
* @
|
|
664
|
-
* @param {TDate} day The date to test.
|
|
666
|
+
* @param {PickerValidDate} day The date to test.
|
|
665
667
|
* @param {string} position The date to test, 'start' or 'end'.
|
|
666
668
|
* @returns {boolean} Returns `true` if the date should be disabled.
|
|
667
669
|
*/
|
|
@@ -214,9 +214,9 @@ export const useDragRange = ({
|
|
|
214
214
|
}) => {
|
|
215
215
|
const [isDragging, setIsDragging] = React.useState(false);
|
|
216
216
|
const [rangeDragDay, setRangeDragDay] = React.useState(null);
|
|
217
|
-
const handleRangeDragDayChange = useEventCallback(
|
|
218
|
-
if (!utils.isEqual(
|
|
219
|
-
setRangeDragDay(
|
|
217
|
+
const handleRangeDragDayChange = useEventCallback(newValue => {
|
|
218
|
+
if (!utils.isEqual(newValue, rangeDragDay)) {
|
|
219
|
+
setRangeDragDay(newValue);
|
|
220
220
|
}
|
|
221
221
|
});
|
|
222
222
|
const draggingDatePosition = React.useMemo(() => {
|
|
@@ -74,9 +74,9 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
|
|
|
74
74
|
currentMonthCalendarPosition: PropTypes.oneOf([1, 2, 3]),
|
|
75
75
|
/**
|
|
76
76
|
* Formats the day of week displayed in the calendar header.
|
|
77
|
-
* @param {
|
|
77
|
+
* @param {PickerValidDate} date The date of the day of week provided by the adapter.
|
|
78
78
|
* @returns {string} The name to display.
|
|
79
|
-
* @default (date:
|
|
79
|
+
* @default (date: PickerValidDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
80
80
|
*/
|
|
81
81
|
dayOfWeekFormatter: PropTypes.func,
|
|
82
82
|
/**
|
|
@@ -102,7 +102,8 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
|
|
|
102
102
|
*/
|
|
103
103
|
disableAutoMonthSwitching: PropTypes.bool,
|
|
104
104
|
/**
|
|
105
|
-
* If `true`, the
|
|
105
|
+
* If `true`, the component is disabled.
|
|
106
|
+
* When disabled, the value cannot be changed and no interaction is possible.
|
|
106
107
|
* @default false
|
|
107
108
|
*/
|
|
108
109
|
disabled: PropTypes.bool,
|
|
@@ -136,7 +137,7 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
|
|
|
136
137
|
*/
|
|
137
138
|
displayWeekNumber: PropTypes.bool,
|
|
138
139
|
/**
|
|
139
|
-
* @default
|
|
140
|
+
* @default true
|
|
140
141
|
*/
|
|
141
142
|
enableAccessibleFieldDOMStructure: PropTypes.any,
|
|
142
143
|
/**
|
|
@@ -224,8 +225,7 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
|
|
|
224
225
|
onError: PropTypes.func,
|
|
225
226
|
/**
|
|
226
227
|
* Callback fired on month change.
|
|
227
|
-
* @
|
|
228
|
-
* @param {TDate} month The new month.
|
|
228
|
+
* @param {PickerValidDate} month The new month.
|
|
229
229
|
*/
|
|
230
230
|
onMonthChange: PropTypes.func,
|
|
231
231
|
/**
|
|
@@ -253,6 +253,11 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
|
|
|
253
253
|
* Used when the component position is controlled.
|
|
254
254
|
*/
|
|
255
255
|
rangePosition: PropTypes.oneOf(['end', 'start']),
|
|
256
|
+
/**
|
|
257
|
+
* If `true`, the component is read-only.
|
|
258
|
+
* When read-only, the value cannot be changed but the user can interact with the interface.
|
|
259
|
+
* @default false
|
|
260
|
+
*/
|
|
256
261
|
readOnly: PropTypes.bool,
|
|
257
262
|
/**
|
|
258
263
|
* If `true`, disable heavy animations.
|
|
@@ -285,8 +290,7 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
|
|
|
285
290
|
*
|
|
286
291
|
* Warning: This function can be called multiple times (for example when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
287
292
|
*
|
|
288
|
-
* @
|
|
289
|
-
* @param {TDate} day The date to test.
|
|
293
|
+
* @param {PickerValidDate} day The date to test.
|
|
290
294
|
* @param {string} position The date to test, 'start' or 'end'.
|
|
291
295
|
* @returns {boolean} Returns `true` if the date should be disabled.
|
|
292
296
|
*/
|
|
@@ -10,7 +10,7 @@ import Typography from '@mui/material/Typography';
|
|
|
10
10
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
11
11
|
import composeClasses from '@mui/utils/composeClasses';
|
|
12
12
|
import { PickersToolbar, PickersToolbarButton, useUtils } from '@mui/x-date-pickers/internals';
|
|
13
|
-
import {
|
|
13
|
+
import { usePickerTranslations } from '@mui/x-date-pickers/hooks';
|
|
14
14
|
import { getDateRangePickerToolbarUtilityClass } from "./dateRangePickerToolbarClasses.js";
|
|
15
15
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
16
|
const useUtilityClasses = ownerState => {
|
|
@@ -59,7 +59,7 @@ const DateRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateRangeP
|
|
|
59
59
|
className
|
|
60
60
|
} = props,
|
|
61
61
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
62
|
-
const translations =
|
|
62
|
+
const translations = usePickerTranslations();
|
|
63
63
|
const startDateValue = start ? utils.formatByString(start, toolbarFormat || utils.formats.shortDate) : translations.start;
|
|
64
64
|
const endDateValue = end ? utils.formatByString(end, toolbarFormat || utils.formats.shortDate) : translations.end;
|
|
65
65
|
const ownerState = props;
|
|
@@ -99,7 +99,6 @@ process.env.NODE_ENV !== "production" ? DateRangePickerToolbar.propTypes = {
|
|
|
99
99
|
*/
|
|
100
100
|
classes: PropTypes.object,
|
|
101
101
|
className: PropTypes.string,
|
|
102
|
-
disabled: PropTypes.bool,
|
|
103
102
|
/**
|
|
104
103
|
* If `true`, show the toolbar even in desktop mode.
|
|
105
104
|
* @default `true` for Desktop, `false` for Mobile.
|
|
@@ -113,7 +112,6 @@ process.env.NODE_ENV !== "production" ? DateRangePickerToolbar.propTypes = {
|
|
|
113
112
|
*/
|
|
114
113
|
onViewChange: PropTypes.func.isRequired,
|
|
115
114
|
rangePosition: PropTypes.oneOf(['end', 'start']).isRequired,
|
|
116
|
-
readOnly: PropTypes.bool,
|
|
117
115
|
/**
|
|
118
116
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
119
117
|
*/
|
|
@@ -79,9 +79,9 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePicker.propTypes = {
|
|
|
79
79
|
currentMonthCalendarPosition: PropTypes.oneOf([1, 2, 3]),
|
|
80
80
|
/**
|
|
81
81
|
* Formats the day of week displayed in the calendar header.
|
|
82
|
-
* @param {
|
|
82
|
+
* @param {PickerValidDate} date The date of the day of week provided by the adapter.
|
|
83
83
|
* @returns {string} The name to display.
|
|
84
|
-
* @default (date:
|
|
84
|
+
* @default (date: PickerValidDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
85
85
|
*/
|
|
86
86
|
dayOfWeekFormatter: PropTypes.func,
|
|
87
87
|
/**
|
|
@@ -107,7 +107,8 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePicker.propTypes = {
|
|
|
107
107
|
*/
|
|
108
108
|
disableAutoMonthSwitching: PropTypes.bool,
|
|
109
109
|
/**
|
|
110
|
-
* If `true`, the
|
|
110
|
+
* If `true`, the component is disabled.
|
|
111
|
+
* When disabled, the value cannot be changed and no interaction is possible.
|
|
111
112
|
* @default false
|
|
112
113
|
*/
|
|
113
114
|
disabled: PropTypes.bool,
|
|
@@ -146,7 +147,7 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePicker.propTypes = {
|
|
|
146
147
|
*/
|
|
147
148
|
displayWeekNumber: PropTypes.bool,
|
|
148
149
|
/**
|
|
149
|
-
* @default
|
|
150
|
+
* @default true
|
|
150
151
|
*/
|
|
151
152
|
enableAccessibleFieldDOMStructure: PropTypes.any,
|
|
152
153
|
/**
|
|
@@ -257,8 +258,7 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePicker.propTypes = {
|
|
|
257
258
|
onError: PropTypes.func,
|
|
258
259
|
/**
|
|
259
260
|
* Callback fired on month change.
|
|
260
|
-
* @
|
|
261
|
-
* @param {TDate} month The new month.
|
|
261
|
+
* @param {PickerValidDate} month The new month.
|
|
262
262
|
*/
|
|
263
263
|
onMonthChange: PropTypes.func,
|
|
264
264
|
/**
|
|
@@ -298,6 +298,11 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePicker.propTypes = {
|
|
|
298
298
|
* Used when the component position is controlled.
|
|
299
299
|
*/
|
|
300
300
|
rangePosition: PropTypes.oneOf(['end', 'start']),
|
|
301
|
+
/**
|
|
302
|
+
* If `true`, the component is read-only.
|
|
303
|
+
* When read-only, the value cannot be changed but the user can interact with the interface.
|
|
304
|
+
* @default false
|
|
305
|
+
*/
|
|
301
306
|
readOnly: PropTypes.bool,
|
|
302
307
|
/**
|
|
303
308
|
* If `true`, disable heavy animations.
|
|
@@ -330,16 +335,14 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePicker.propTypes = {
|
|
|
330
335
|
*
|
|
331
336
|
* Warning: This function can be called multiple times (for example when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
332
337
|
*
|
|
333
|
-
* @
|
|
334
|
-
* @param {TDate} day The date to test.
|
|
338
|
+
* @param {PickerValidDate} day The date to test.
|
|
335
339
|
* @param {string} position The date to test, 'start' or 'end'.
|
|
336
340
|
* @returns {boolean} Returns `true` if the date should be disabled.
|
|
337
341
|
*/
|
|
338
342
|
shouldDisableDate: PropTypes.func,
|
|
339
343
|
/**
|
|
340
344
|
* Disable specific time.
|
|
341
|
-
* @
|
|
342
|
-
* @param {TDate} value The value to check.
|
|
345
|
+
* @param {PickerValidDate} value The value to check.
|
|
343
346
|
* @param {TimeView} view The clock type of the timeValue.
|
|
344
347
|
* @returns {boolean} If `true` the time will be disabled.
|
|
345
348
|
*/
|
|
@@ -8,7 +8,7 @@ import composeClasses from '@mui/utils/composeClasses';
|
|
|
8
8
|
import useEventCallback from '@mui/utils/useEventCallback';
|
|
9
9
|
import { TimeIcon, DateRangeIcon, ArrowLeftIcon, ArrowRightIcon } from '@mui/x-date-pickers/icons';
|
|
10
10
|
import { isDatePickerView } from '@mui/x-date-pickers/internals';
|
|
11
|
-
import {
|
|
11
|
+
import { usePickerTranslations } from '@mui/x-date-pickers/hooks';
|
|
12
12
|
import IconButton from '@mui/material/IconButton';
|
|
13
13
|
import Button from '@mui/material/Button';
|
|
14
14
|
import { getDateTimeRangePickerTabsUtilityClass } from "./dateTimeRangePickerTabsClasses.js";
|
|
@@ -81,7 +81,7 @@ const DateTimeRangePickerTabs = function DateTimeRangePickerTabs(inProps) {
|
|
|
81
81
|
className,
|
|
82
82
|
sx
|
|
83
83
|
} = props;
|
|
84
|
-
const translations =
|
|
84
|
+
const translations = usePickerTranslations();
|
|
85
85
|
const classes = useUtilityClasses(props);
|
|
86
86
|
const value = React.useMemo(() => viewToTab(view, rangePosition), [view, rangePosition]);
|
|
87
87
|
const isPreviousHidden = value === 'start-date';
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["value", "rangePosition", "onRangePositionChange", "className", "onViewChange", "toolbarVariant", "onChange", "classes", "view", "isLandscape", "views", "ampm", "
|
|
5
|
+
const _excluded = ["value", "rangePosition", "onRangePositionChange", "className", "onViewChange", "toolbarVariant", "onChange", "classes", "view", "isLandscape", "views", "ampm", "hidden", "toolbarFormat", "toolbarPlaceholder", "titleId", "sx"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
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
11
|
import { useUtils } from '@mui/x-date-pickers/internals';
|
|
12
|
-
import {
|
|
12
|
+
import { 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";
|
|
@@ -86,8 +86,6 @@ const DateTimeRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateTi
|
|
|
86
86
|
isLandscape,
|
|
87
87
|
views,
|
|
88
88
|
ampm,
|
|
89
|
-
disabled,
|
|
90
|
-
readOnly,
|
|
91
89
|
hidden,
|
|
92
90
|
toolbarFormat,
|
|
93
91
|
toolbarPlaceholder,
|
|
@@ -95,6 +93,10 @@ const DateTimeRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateTi
|
|
|
95
93
|
sx
|
|
96
94
|
} = props,
|
|
97
95
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
96
|
+
const {
|
|
97
|
+
disabled,
|
|
98
|
+
readOnly
|
|
99
|
+
} = usePickerContext();
|
|
98
100
|
const commonToolbarProps = {
|
|
99
101
|
isLandscape,
|
|
100
102
|
views,
|
|
@@ -105,7 +107,7 @@ const DateTimeRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateTi
|
|
|
105
107
|
toolbarFormat,
|
|
106
108
|
toolbarPlaceholder
|
|
107
109
|
};
|
|
108
|
-
const translations =
|
|
110
|
+
const translations = usePickerTranslations();
|
|
109
111
|
const ownerState = props;
|
|
110
112
|
const classes = useUtilityClasses(ownerState);
|
|
111
113
|
const handleStartRangeViewChange = React.useCallback(newView => {
|
|
@@ -183,7 +185,6 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePickerToolbar.propTypes = {
|
|
|
183
185
|
*/
|
|
184
186
|
classes: PropTypes.object,
|
|
185
187
|
className: PropTypes.string,
|
|
186
|
-
disabled: PropTypes.bool,
|
|
187
188
|
/**
|
|
188
189
|
* If `true`, show the toolbar even in desktop mode.
|
|
189
190
|
* @default `true` for Desktop, `false` for Mobile.
|
|
@@ -199,7 +200,6 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePickerToolbar.propTypes = {
|
|
|
199
200
|
*/
|
|
200
201
|
onViewChange: PropTypes.func.isRequired,
|
|
201
202
|
rangePosition: PropTypes.oneOf(['end', 'start']).isRequired,
|
|
202
|
-
readOnly: PropTypes.bool,
|
|
203
203
|
/**
|
|
204
204
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
205
205
|
*/
|
|
@@ -3,6 +3,7 @@
|
|
|
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';
|
|
6
7
|
import { extractValidationProps } from '@mui/x-date-pickers/validation';
|
|
7
8
|
import resolveComponentProps from '@mui/utils/resolveComponentProps';
|
|
8
9
|
import { refType } from '@mui/utils';
|
|
@@ -23,6 +24,8 @@ import { validateDateRange } from "../validation/index.js";
|
|
|
23
24
|
* - [DesktopDateRangePicker API](https://mui.com/x/api/date-pickers/desktop-date-range-picker/)
|
|
24
25
|
*/
|
|
25
26
|
const DesktopDateRangePicker = /*#__PURE__*/React.forwardRef(function DesktopDateRangePicker(inProps, ref) {
|
|
27
|
+
const utils = useUtils();
|
|
28
|
+
|
|
26
29
|
// Props with the default values common to all date time pickers
|
|
27
30
|
const defaultizedProps = useDateRangePickerDefaultizedProps(inProps, 'MuiDesktopDateRangePicker');
|
|
28
31
|
const viewRenderers = _extends({
|
|
@@ -30,6 +33,7 @@ const DesktopDateRangePicker = /*#__PURE__*/React.forwardRef(function DesktopDat
|
|
|
30
33
|
}, defaultizedProps.viewRenderers);
|
|
31
34
|
const props = _extends({}, defaultizedProps, {
|
|
32
35
|
viewRenderers,
|
|
36
|
+
format: utils.formats.keyboardDate,
|
|
33
37
|
calendars: defaultizedProps.calendars ?? 2,
|
|
34
38
|
views: ['day'],
|
|
35
39
|
openTo: 'day',
|
|
@@ -85,9 +89,9 @@ DesktopDateRangePicker.propTypes = {
|
|
|
85
89
|
currentMonthCalendarPosition: PropTypes.oneOf([1, 2, 3]),
|
|
86
90
|
/**
|
|
87
91
|
* Formats the day of week displayed in the calendar header.
|
|
88
|
-
* @param {
|
|
92
|
+
* @param {PickerValidDate} date The date of the day of week provided by the adapter.
|
|
89
93
|
* @returns {string} The name to display.
|
|
90
|
-
* @default (date:
|
|
94
|
+
* @default (date: PickerValidDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
91
95
|
*/
|
|
92
96
|
dayOfWeekFormatter: PropTypes.func,
|
|
93
97
|
/**
|
|
@@ -107,7 +111,8 @@ DesktopDateRangePicker.propTypes = {
|
|
|
107
111
|
*/
|
|
108
112
|
disableAutoMonthSwitching: PropTypes.bool,
|
|
109
113
|
/**
|
|
110
|
-
* If `true`, the
|
|
114
|
+
* If `true`, the component is disabled.
|
|
115
|
+
* When disabled, the value cannot be changed and no interaction is possible.
|
|
111
116
|
* @default false
|
|
112
117
|
*/
|
|
113
118
|
disabled: PropTypes.bool,
|
|
@@ -141,7 +146,7 @@ DesktopDateRangePicker.propTypes = {
|
|
|
141
146
|
*/
|
|
142
147
|
displayWeekNumber: PropTypes.bool,
|
|
143
148
|
/**
|
|
144
|
-
* @default
|
|
149
|
+
* @default true
|
|
145
150
|
*/
|
|
146
151
|
enableAccessibleFieldDOMStructure: PropTypes.any,
|
|
147
152
|
/**
|
|
@@ -229,8 +234,7 @@ DesktopDateRangePicker.propTypes = {
|
|
|
229
234
|
onError: PropTypes.func,
|
|
230
235
|
/**
|
|
231
236
|
* Callback fired on month change.
|
|
232
|
-
* @
|
|
233
|
-
* @param {TDate} month The new month.
|
|
237
|
+
* @param {PickerValidDate} month The new month.
|
|
234
238
|
*/
|
|
235
239
|
onMonthChange: PropTypes.func,
|
|
236
240
|
/**
|
|
@@ -258,6 +262,11 @@ DesktopDateRangePicker.propTypes = {
|
|
|
258
262
|
* Used when the component position is controlled.
|
|
259
263
|
*/
|
|
260
264
|
rangePosition: PropTypes.oneOf(['end', 'start']),
|
|
265
|
+
/**
|
|
266
|
+
* If `true`, the component is read-only.
|
|
267
|
+
* When read-only, the value cannot be changed but the user can interact with the interface.
|
|
268
|
+
* @default false
|
|
269
|
+
*/
|
|
261
270
|
readOnly: PropTypes.bool,
|
|
262
271
|
/**
|
|
263
272
|
* If `true`, disable heavy animations.
|
|
@@ -290,8 +299,7 @@ DesktopDateRangePicker.propTypes = {
|
|
|
290
299
|
*
|
|
291
300
|
* Warning: This function can be called multiple times (for example when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
292
301
|
*
|
|
293
|
-
* @
|
|
294
|
-
* @param {TDate} day The date to test.
|
|
302
|
+
* @param {PickerValidDate} day The date to test.
|
|
295
303
|
* @param {string} position The date to test, 'start' or 'end'.
|
|
296
304
|
* @returns {boolean} Returns `true` if the date should be disabled.
|
|
297
305
|
*/
|
|
@@ -166,9 +166,9 @@ DesktopDateTimeRangePicker.propTypes = {
|
|
|
166
166
|
currentMonthCalendarPosition: PropTypes.oneOf([1, 2, 3]),
|
|
167
167
|
/**
|
|
168
168
|
* Formats the day of week displayed in the calendar header.
|
|
169
|
-
* @param {
|
|
169
|
+
* @param {PickerValidDate} date The date of the day of week provided by the adapter.
|
|
170
170
|
* @returns {string} The name to display.
|
|
171
|
-
* @default (date:
|
|
171
|
+
* @default (date: PickerValidDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
172
172
|
*/
|
|
173
173
|
dayOfWeekFormatter: PropTypes.func,
|
|
174
174
|
/**
|
|
@@ -188,7 +188,8 @@ DesktopDateTimeRangePicker.propTypes = {
|
|
|
188
188
|
*/
|
|
189
189
|
disableAutoMonthSwitching: PropTypes.bool,
|
|
190
190
|
/**
|
|
191
|
-
* If `true`, the
|
|
191
|
+
* If `true`, the component is disabled.
|
|
192
|
+
* When disabled, the value cannot be changed and no interaction is possible.
|
|
192
193
|
* @default false
|
|
193
194
|
*/
|
|
194
195
|
disabled: PropTypes.bool,
|
|
@@ -227,7 +228,7 @@ DesktopDateTimeRangePicker.propTypes = {
|
|
|
227
228
|
*/
|
|
228
229
|
displayWeekNumber: PropTypes.bool,
|
|
229
230
|
/**
|
|
230
|
-
* @default
|
|
231
|
+
* @default true
|
|
231
232
|
*/
|
|
232
233
|
enableAccessibleFieldDOMStructure: PropTypes.any,
|
|
233
234
|
/**
|
|
@@ -338,8 +339,7 @@ DesktopDateTimeRangePicker.propTypes = {
|
|
|
338
339
|
onError: PropTypes.func,
|
|
339
340
|
/**
|
|
340
341
|
* Callback fired on month change.
|
|
341
|
-
* @
|
|
342
|
-
* @param {TDate} month The new month.
|
|
342
|
+
* @param {PickerValidDate} month The new month.
|
|
343
343
|
*/
|
|
344
344
|
onMonthChange: PropTypes.func,
|
|
345
345
|
/**
|
|
@@ -379,6 +379,11 @@ DesktopDateTimeRangePicker.propTypes = {
|
|
|
379
379
|
* Used when the component position is controlled.
|
|
380
380
|
*/
|
|
381
381
|
rangePosition: PropTypes.oneOf(['end', 'start']),
|
|
382
|
+
/**
|
|
383
|
+
* If `true`, the component is read-only.
|
|
384
|
+
* When read-only, the value cannot be changed but the user can interact with the interface.
|
|
385
|
+
* @default false
|
|
386
|
+
*/
|
|
382
387
|
readOnly: PropTypes.bool,
|
|
383
388
|
/**
|
|
384
389
|
* If `true`, disable heavy animations.
|
|
@@ -411,16 +416,14 @@ DesktopDateTimeRangePicker.propTypes = {
|
|
|
411
416
|
*
|
|
412
417
|
* Warning: This function can be called multiple times (for example when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
413
418
|
*
|
|
414
|
-
* @
|
|
415
|
-
* @param {TDate} day The date to test.
|
|
419
|
+
* @param {PickerValidDate} day The date to test.
|
|
416
420
|
* @param {string} position The date to test, 'start' or 'end'.
|
|
417
421
|
* @returns {boolean} Returns `true` if the date should be disabled.
|
|
418
422
|
*/
|
|
419
423
|
shouldDisableDate: PropTypes.func,
|
|
420
424
|
/**
|
|
421
425
|
* Disable specific time.
|
|
422
|
-
* @
|
|
423
|
-
* @param {TDate} value The value to check.
|
|
426
|
+
* @param {PickerValidDate} value The value to check.
|
|
424
427
|
* @param {TimeView} view The clock type of the timeValue.
|
|
425
428
|
* @returns {boolean} If `true` the time will be disabled.
|
|
426
429
|
*/
|