@mui/x-date-pickers-pro 7.0.0-beta.6 → 7.0.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 +311 -12
- package/DateRangeCalendar/DateRangeCalendar.js +34 -74
- package/DateRangeCalendar/DateRangeCalendar.types.d.ts +3 -2
- package/DateRangeCalendar/useDragRange.js +1 -2
- package/DateRangePicker/DateRangePicker.js +1 -1
- package/DateRangePicker/shared.js +3 -5
- package/DateTimeRangePicker/DateTimeRangePicker.d.ts +10 -0
- package/DateTimeRangePicker/DateTimeRangePicker.js +11 -1
- package/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.d.ts +4 -5
- package/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +2 -3
- package/DateTimeRangePicker/DateTimeRangePickerToolbar.js +2 -2
- package/DateTimeRangePicker/shared.d.ts +5 -4
- package/DateTimeRangePicker/shared.js +9 -10
- package/DesktopDateRangePicker/DesktopDateRangePicker.js +6 -10
- package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.d.ts +10 -0
- package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +31 -28
- package/MobileDateRangePicker/MobileDateRangePicker.js +5 -9
- package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.d.ts +10 -0
- package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +20 -14
- package/MultiInputDateRangeField/MultiInputDateRangeField.js +21 -17
- package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +21 -17
- package/MultiInputTimeRangeField/MultiInputTimeRangeField.js +20 -16
- package/PickersRangeCalendarHeader/PickersRangeCalendarHeader.d.ts +8 -0
- package/PickersRangeCalendarHeader/PickersRangeCalendarHeader.js +124 -0
- package/PickersRangeCalendarHeader/PickersRangeCalendarHeader.types.d.ts +18 -0
- package/PickersRangeCalendarHeader/PickersRangeCalendarHeader.types.js +1 -0
- package/PickersRangeCalendarHeader/index.d.ts +2 -0
- package/PickersRangeCalendarHeader/index.js +1 -0
- package/PickersRangeCalendarHeader/package.json +6 -0
- package/README.md +1 -1
- package/SingleInputDateRangeField/SingleInputDateRangeField.js +8 -4
- package/SingleInputDateRangeField/useSingleInputDateRangeField.js +6 -2
- package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +8 -4
- package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +6 -2
- package/SingleInputTimeRangeField/SingleInputTimeRangeField.js +7 -3
- package/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +6 -2
- package/StaticDateRangePicker/StaticDateRangePicker.js +4 -5
- package/index.d.ts +1 -0
- package/index.js +2 -1
- package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +9 -11
- package/internals/hooks/useEnrichedRangePickerFieldProps.js +25 -31
- package/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +9 -10
- package/internals/hooks/useMultiInputFieldSelectedSections.js +3 -6
- package/internals/hooks/useRangePosition.js +3 -5
- package/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +14 -18
- package/internals/models/dateRange.d.ts +3 -3
- package/internals/models/dateTimeRange.d.ts +2 -2
- package/internals/models/timeRange.d.ts +2 -2
- package/internals/utils/releaseInfo.js +1 -1
- package/internals/utils/validation/validateDateRange.js +2 -2
- package/internals/utils/validation/validateDateTimeRange.js +2 -2
- package/internals/utils/valueManagers.d.ts +3 -1
- package/internals/utils/valueManagers.js +9 -7
- package/models/fields.d.ts +8 -1
- package/modern/DateRangeCalendar/DateRangeCalendar.js +40 -72
- package/modern/DateRangePicker/DateRangePicker.js +1 -1
- package/modern/DateTimeRangePicker/DateTimeRangePicker.js +11 -1
- package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +1 -1
- package/modern/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +20 -9
- package/modern/MobileDateRangePicker/MobileDateRangePicker.js +1 -1
- package/modern/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +15 -5
- package/modern/MultiInputDateRangeField/MultiInputDateRangeField.js +14 -6
- package/modern/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +14 -6
- package/modern/MultiInputTimeRangeField/MultiInputTimeRangeField.js +13 -5
- package/modern/PickersRangeCalendarHeader/PickersRangeCalendarHeader.js +124 -0
- package/modern/PickersRangeCalendarHeader/PickersRangeCalendarHeader.types.js +1 -0
- package/modern/PickersRangeCalendarHeader/index.js +1 -0
- package/modern/SingleInputDateRangeField/SingleInputDateRangeField.js +6 -1
- package/modern/SingleInputDateRangeField/useSingleInputDateRangeField.js +6 -2
- package/modern/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +6 -1
- package/modern/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +6 -2
- package/modern/SingleInputTimeRangeField/SingleInputTimeRangeField.js +5 -0
- package/modern/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +6 -2
- package/modern/StaticDateRangePicker/StaticDateRangePicker.js +1 -1
- package/modern/index.js +2 -1
- package/modern/internals/utils/releaseInfo.js +1 -1
- package/modern/internals/utils/valueManagers.js +7 -5
- package/node/DateRangeCalendar/DateRangeCalendar.js +39 -71
- package/node/DateRangePicker/DateRangePicker.js +1 -1
- package/node/DateTimeRangePicker/DateTimeRangePicker.js +11 -1
- package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +1 -1
- package/node/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +20 -9
- package/node/MobileDateRangePicker/MobileDateRangePicker.js +1 -1
- package/node/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +15 -5
- package/node/MultiInputDateRangeField/MultiInputDateRangeField.js +14 -6
- package/node/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +14 -6
- package/node/MultiInputTimeRangeField/MultiInputTimeRangeField.js +13 -5
- package/node/PickersRangeCalendarHeader/PickersRangeCalendarHeader.js +132 -0
- package/node/PickersRangeCalendarHeader/PickersRangeCalendarHeader.types.js +5 -0
- package/node/PickersRangeCalendarHeader/index.js +12 -0
- package/node/SingleInputDateRangeField/SingleInputDateRangeField.js +6 -1
- package/node/SingleInputDateRangeField/useSingleInputDateRangeField.js +7 -1
- package/node/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +6 -1
- package/node/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +7 -1
- package/node/SingleInputTimeRangeField/SingleInputTimeRangeField.js +5 -0
- package/node/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +7 -1
- package/node/StaticDateRangePicker/StaticDateRangePicker.js +1 -1
- package/node/index.js +13 -1
- package/node/internals/utils/releaseInfo.js +1 -1
- package/node/internals/utils/valueManagers.js +9 -6
- package/package.json +7 -7
- package/themeAugmentation/components.d.ts +3 -0
- package/themeAugmentation/props.d.ts +2 -0
- package/DesktopDateTimeRangePicker/DesktopDateTimeRangePickerLayout.d.ts +0 -9
- package/DesktopDateTimeRangePicker/DesktopDateTimeRangePickerLayout.js +0 -52
- package/modern/DesktopDateTimeRangePicker/DesktopDateTimeRangePickerLayout.js +0 -51
- package/node/DesktopDateTimeRangePicker/DesktopDateTimeRangePickerLayout.js +0 -59
|
@@ -3,13 +3,14 @@ import { SxProps } from '@mui/system';
|
|
|
3
3
|
import { SlotComponentProps } from '@mui/base/utils';
|
|
4
4
|
import { Theme } from '@mui/material/styles';
|
|
5
5
|
import { PickerValidDate, TimezoneProps } from '@mui/x-date-pickers/models';
|
|
6
|
-
import { PickersCalendarHeader,
|
|
6
|
+
import { PickersCalendarHeader, PickersCalendarHeaderSlots, PickersCalendarHeaderSlotProps } from '@mui/x-date-pickers/PickersCalendarHeader';
|
|
7
7
|
import { BaseDateValidationProps, DefaultizedProps, ExportedDayCalendarProps, DayCalendarSlots, DayCalendarSlotProps, PickersArrowSwitcherSlots, PickersArrowSwitcherSlotProps, DayCalendarProps, ExportedUseViewsOptions } from '@mui/x-date-pickers/internals';
|
|
8
8
|
import { DayRangeValidationProps } from '../internals/models';
|
|
9
9
|
import { DateRange } from '../models';
|
|
10
10
|
import { DateRangeCalendarClasses } from './dateRangeCalendarClasses';
|
|
11
11
|
import { DateRangePickerDay, DateRangePickerDayProps } from '../DateRangePickerDay';
|
|
12
12
|
import { UseRangePositionProps } from '../internals/hooks/useRangePosition';
|
|
13
|
+
import { PickersRangeCalendarHeaderProps } from '../PickersRangeCalendarHeader';
|
|
13
14
|
export type DateRangePosition = 'start' | 'end';
|
|
14
15
|
export interface DateRangeCalendarSlots<TDate extends PickerValidDate> extends PickersArrowSwitcherSlots, Omit<DayCalendarSlots<TDate>, 'day'>, PickersCalendarHeaderSlots {
|
|
15
16
|
/**
|
|
@@ -17,7 +18,7 @@ export interface DateRangeCalendarSlots<TDate extends PickerValidDate> extends P
|
|
|
17
18
|
* Check the [PickersCalendarHeader](https://mui.com/x/api/date-pickers/pickers-calendar-header/) component.
|
|
18
19
|
* @default PickersCalendarHeader
|
|
19
20
|
*/
|
|
20
|
-
calendarHeader?: React.ElementType<
|
|
21
|
+
calendarHeader?: React.ElementType<PickersRangeCalendarHeaderProps<TDate>>;
|
|
21
22
|
/**
|
|
22
23
|
* Custom component for day in range pickers.
|
|
23
24
|
* Check the [DateRangePickersDay](https://mui.com/x/api/date-pickers/date-range-picker-day/) component.
|
|
@@ -27,9 +27,8 @@ const resolveButtonElement = element => {
|
|
|
27
27
|
return element;
|
|
28
28
|
};
|
|
29
29
|
const resolveElementFromTouch = (event, ignoreTouchTarget) => {
|
|
30
|
-
var _event$changedTouches;
|
|
31
30
|
// don't parse multi-touch result
|
|
32
|
-
if (
|
|
31
|
+
if (event.changedTouches?.length === 1 && event.touches.length <= 1) {
|
|
33
32
|
const element = document.elementFromPoint(event.changedTouches[0].clientX, event.changedTouches[0].clientY);
|
|
34
33
|
// `elementFromPoint` could have resolved preview div or wrapping div
|
|
35
34
|
// might need to recursively find the nested button
|
|
@@ -277,7 +277,7 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
|
|
|
277
277
|
/**
|
|
278
278
|
* Disable specific date.
|
|
279
279
|
*
|
|
280
|
-
* Warning: This function can be called multiple times (
|
|
280
|
+
* 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.
|
|
281
281
|
*
|
|
282
282
|
* @template TDate
|
|
283
283
|
* @param {TDate} day The date to test.
|
|
@@ -4,7 +4,6 @@ import { useThemeProps } from '@mui/material/styles';
|
|
|
4
4
|
import { useDefaultDates, useUtils, applyDefaultDate } from '@mui/x-date-pickers/internals';
|
|
5
5
|
import { DateRangePickerToolbar } from './DateRangePickerToolbar';
|
|
6
6
|
export function useDateRangePickerDefaultizedProps(props, name) {
|
|
7
|
-
var _themeProps$disableFu, _themeProps$disablePa;
|
|
8
7
|
const utils = useUtils();
|
|
9
8
|
const defaultDates = useDefaultDates();
|
|
10
9
|
const themeProps = useThemeProps({
|
|
@@ -12,8 +11,7 @@ export function useDateRangePickerDefaultizedProps(props, name) {
|
|
|
12
11
|
name
|
|
13
12
|
});
|
|
14
13
|
const localeText = React.useMemo(() => {
|
|
15
|
-
|
|
16
|
-
if (((_themeProps$localeTex = themeProps.localeText) == null ? void 0 : _themeProps$localeTex.toolbarTitle) == null) {
|
|
14
|
+
if (themeProps.localeText?.toolbarTitle == null) {
|
|
17
15
|
return themeProps.localeText;
|
|
18
16
|
}
|
|
19
17
|
return _extends({}, themeProps.localeText, {
|
|
@@ -22,8 +20,8 @@ export function useDateRangePickerDefaultizedProps(props, name) {
|
|
|
22
20
|
}, [themeProps.localeText]);
|
|
23
21
|
return _extends({}, themeProps, {
|
|
24
22
|
localeText,
|
|
25
|
-
disableFuture:
|
|
26
|
-
disablePast:
|
|
23
|
+
disableFuture: themeProps.disableFuture ?? false,
|
|
24
|
+
disablePast: themeProps.disablePast ?? false,
|
|
27
25
|
minDate: applyDefaultDate(utils, themeProps.minDate, defaultDates.minDate),
|
|
28
26
|
maxDate: applyDefaultDate(utils, themeProps.maxDate, defaultDates.maxDate),
|
|
29
27
|
slots: _extends({
|
|
@@ -4,5 +4,15 @@ import { DateTimeRangePickerProps } from './DateTimeRangePicker.types';
|
|
|
4
4
|
type DateTimeRangePickerComponent = (<TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean = false>(props: DateTimeRangePickerProps<TDate, TEnableAccessibleFieldDOMStructure> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
|
5
5
|
propTypes?: any;
|
|
6
6
|
};
|
|
7
|
+
/**
|
|
8
|
+
* Demos:
|
|
9
|
+
*
|
|
10
|
+
* - [DateTimeRangePicker](https://mui.com/x/react-date-pickers/date-time-range-picker/)
|
|
11
|
+
* - [Validation](https://mui.com/x/react-date-pickers/validation/)
|
|
12
|
+
*
|
|
13
|
+
* API:
|
|
14
|
+
*
|
|
15
|
+
* - [DateTimeRangePicker API](https://mui.com/x/api/date-pickers/date-time-range-picker/)
|
|
16
|
+
*/
|
|
7
17
|
declare const DateTimeRangePicker: DateTimeRangePickerComponent;
|
|
8
18
|
export { DateTimeRangePicker };
|
|
@@ -9,6 +9,16 @@ import { useThemeProps } from '@mui/material/styles';
|
|
|
9
9
|
import { DesktopDateTimeRangePicker } from '../DesktopDateTimeRangePicker';
|
|
10
10
|
import { MobileDateTimeRangePicker } from '../MobileDateTimeRangePicker';
|
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
/**
|
|
13
|
+
* Demos:
|
|
14
|
+
*
|
|
15
|
+
* - [DateTimeRangePicker](https://mui.com/x/react-date-pickers/date-time-range-picker/)
|
|
16
|
+
* - [Validation](https://mui.com/x/react-date-pickers/validation/)
|
|
17
|
+
*
|
|
18
|
+
* API:
|
|
19
|
+
*
|
|
20
|
+
* - [DateTimeRangePicker API](https://mui.com/x/api/date-pickers/date-time-range-picker/)
|
|
21
|
+
*/
|
|
12
22
|
const DateTimeRangePicker = /*#__PURE__*/React.forwardRef(function DateTimeRangePicker(inProps, ref) {
|
|
13
23
|
const props = useThemeProps({
|
|
14
24
|
props: inProps,
|
|
@@ -312,7 +322,7 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePicker.propTypes = {
|
|
|
312
322
|
/**
|
|
313
323
|
* Disable specific date.
|
|
314
324
|
*
|
|
315
|
-
* Warning: This function can be called multiple times (
|
|
325
|
+
* 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.
|
|
316
326
|
*
|
|
317
327
|
* @template TDate
|
|
318
328
|
* @param {TDate} day The date to test.
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { PickerSelectionState, PickerViewRenderer, TimeViewWithMeridiem, BaseClockProps } from '@mui/x-date-pickers/internals';
|
|
2
|
+
import { PickerSelectionState, PickerViewRenderer, TimeViewWithMeridiem, BaseClockProps, DefaultizedProps } from '@mui/x-date-pickers/internals';
|
|
3
3
|
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
4
|
-
import { DateTimeRangePickerView } from '../internals/models';
|
|
5
4
|
import { DateRange } from '../models';
|
|
6
5
|
import { UseRangePositionResponse } from '../internals/hooks/useRangePosition';
|
|
7
|
-
export type DateTimeRangePickerTimeWrapperProps<TDate extends PickerValidDate, TView extends
|
|
6
|
+
export type DateTimeRangePickerTimeWrapperProps<TDate extends PickerValidDate, TView extends TimeViewWithMeridiem, TComponentProps extends DefaultizedProps<Omit<BaseClockProps<TDate, TView>, 'value' | 'defaultValue' | 'onChange'>, 'views'>> = Pick<UseRangePositionResponse, 'rangePosition' | 'onRangePositionChange'> & Omit<TComponentProps, 'views' | 'view' | 'onViewChange' | 'value' | 'defaultValue' | 'onChange'> & {
|
|
8
7
|
view: TView;
|
|
9
8
|
onViewChange?: (view: TView) => void;
|
|
10
9
|
views: readonly TView[];
|
|
11
10
|
value?: DateRange<TDate>;
|
|
12
11
|
defaultValue?: DateRange<TDate>;
|
|
13
12
|
onChange?: (value: DateRange<TDate>, selectionState: PickerSelectionState, selectedView: TView) => void;
|
|
14
|
-
viewRenderer?: PickerViewRenderer<DateRange<TDate>, TView,
|
|
13
|
+
viewRenderer?: PickerViewRenderer<DateRange<TDate>, TView, TComponentProps, any> | null;
|
|
15
14
|
openTo?: TView;
|
|
16
15
|
};
|
|
17
16
|
/**
|
|
18
17
|
* @ignore - internal component.
|
|
19
18
|
*/
|
|
20
|
-
declare function DateTimeRangePickerTimeWrapper<TDate extends PickerValidDate, TView extends
|
|
19
|
+
declare function DateTimeRangePickerTimeWrapper<TDate extends PickerValidDate, TView extends TimeViewWithMeridiem, TComponentProps extends DefaultizedProps<Omit<BaseClockProps<TDate, TView>, 'value' | 'defaultValue' | 'onChange'>, 'views'>>(props: DateTimeRangePickerTimeWrapperProps<TDate, TView, TComponentProps>, ref: React.Ref<HTMLDivElement>): React.ReactNode;
|
|
21
20
|
export { DateTimeRangePickerTimeWrapper };
|
|
@@ -8,7 +8,6 @@ import { calculateRangeChange } from '../internals/utils/date-range-manager';
|
|
|
8
8
|
* @ignore - internal component.
|
|
9
9
|
*/
|
|
10
10
|
function DateTimeRangePickerTimeWrapper(props, ref) {
|
|
11
|
-
var _ref, _ref2;
|
|
12
11
|
const utils = useUtils();
|
|
13
12
|
const {
|
|
14
13
|
rangePosition,
|
|
@@ -24,8 +23,8 @@ function DateTimeRangePickerTimeWrapper(props, ref) {
|
|
|
24
23
|
if (!viewRenderer) {
|
|
25
24
|
return null;
|
|
26
25
|
}
|
|
27
|
-
const currentValue = (
|
|
28
|
-
const currentDefaultValue = (
|
|
26
|
+
const currentValue = (rangePosition === 'start' ? value?.[0] : value?.[1]) ?? null;
|
|
27
|
+
const currentDefaultValue = (rangePosition === 'start' ? defaultValue?.[0] : defaultValue?.[1]) ?? null;
|
|
29
28
|
const handleOnChange = (newDate, selectionState, selectedView) => {
|
|
30
29
|
if (!onChange || !value) {
|
|
31
30
|
return;
|
|
@@ -39,7 +39,7 @@ const DateTimeRangePickerToolbarStart = styled(DateTimePickerToolbar, {
|
|
|
39
39
|
ownerState
|
|
40
40
|
}) => _extends({
|
|
41
41
|
borderBottom: 'none'
|
|
42
|
-
},
|
|
42
|
+
}, ownerState?.toolbarVariant !== 'desktop' ? {
|
|
43
43
|
padding: '12px 8px 0 12px'
|
|
44
44
|
} : {
|
|
45
45
|
paddingBottom: 0
|
|
@@ -51,7 +51,7 @@ const DateTimeRangePickerToolbarEnd = styled(DateTimePickerToolbar, {
|
|
|
51
51
|
})(({
|
|
52
52
|
ownerState
|
|
53
53
|
}) => ({
|
|
54
|
-
padding:
|
|
54
|
+
padding: ownerState?.toolbarVariant !== 'desktop' ? '12px 8px 12px 12px' : undefined
|
|
55
55
|
}));
|
|
56
56
|
const DateTimeRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateTimeRangePickerToolbar(inProps, ref) {
|
|
57
57
|
const props = useThemeProps({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { LocalizedComponent } from '@mui/x-date-pickers/locales';
|
|
3
|
-
import { DefaultizedProps, BaseDateValidationProps, BasePickerInputProps, PickerViewRendererLookup, BaseClockProps, DesktopOnlyTimePickerProps, TimeViewWithMeridiem, UseViewsOptions, DateTimeValidationProps } from '@mui/x-date-pickers/internals';
|
|
3
|
+
import { DefaultizedProps, BaseDateValidationProps, BasePickerInputProps, PickerViewRendererLookup, BaseClockProps, DesktopOnlyTimePickerProps, TimeViewWithMeridiem, UseViewsOptions, DateTimeValidationProps, DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals';
|
|
4
4
|
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
5
5
|
import { TimeViewRendererProps } from '@mui/x-date-pickers/timeViewRenderers';
|
|
6
6
|
import { DigitalClockSlots, DigitalClockSlotProps } from '@mui/x-date-pickers/DigitalClock';
|
|
@@ -33,6 +33,9 @@ export interface BaseDateTimeRangePickerSlotProps<TDate extends PickerValidDate>
|
|
|
33
33
|
*/
|
|
34
34
|
toolbar?: ExportedDateTimeRangePickerToolbarProps;
|
|
35
35
|
}
|
|
36
|
+
export type DateTimeRangePickerRenderers<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TAdditionalProps extends {} = {}> = PickerViewRendererLookup<DateRange<TDate>, TView, Omit<DateRangeViewRendererProps<TDate, 'day'>, 'view' | 'slots' | 'slotProps'> & Omit<TimeViewRendererProps<TimeViewWithMeridiem, BaseClockProps<TDate, TimeViewWithMeridiem>>, 'view' | 'slots' | 'slotProps'> & {
|
|
37
|
+
view: TView;
|
|
38
|
+
}, TAdditionalProps>;
|
|
36
39
|
export interface BaseDateTimeRangePickerProps<TDate extends PickerValidDate> extends Omit<BasePickerInputProps<DateRange<TDate>, TDate, DateTimeRangePickerView, DateTimeRangeValidationError>, 'orientation' | 'views' | 'openTo'>, ExportedDateRangeCalendarProps<TDate>, BaseDateValidationProps<TDate>, DesktopOnlyTimePickerProps<TDate>, Partial<Pick<UseViewsOptions<DateRange<TDate>, DateTimeRangePickerViewExternal>, 'openTo' | 'views'>>, DateTimeValidationProps<TDate> {
|
|
37
40
|
/**
|
|
38
41
|
* Overridable component slots.
|
|
@@ -49,9 +52,7 @@ export interface BaseDateTimeRangePickerProps<TDate extends PickerValidDate> ext
|
|
|
49
52
|
* If `null`, the section will only have field editing.
|
|
50
53
|
* If `undefined`, internally defined view will be the used.
|
|
51
54
|
*/
|
|
52
|
-
viewRenderers?: Partial<
|
|
53
|
-
view: DateTimeRangePickerView;
|
|
54
|
-
}, {}>>;
|
|
55
|
+
viewRenderers?: Partial<DateTimeRangePickerRenderers<TDate, DateTimeRangePickerView>>;
|
|
55
56
|
}
|
|
56
57
|
type UseDateTimeRangePickerDefaultizedProps<TDate extends PickerValidDate, Props extends BaseDateTimeRangePickerProps<TDate>> = LocalizedComponent<TDate, Omit<DefaultizedProps<Props, 'openTo' | 'ampm' | keyof BaseDateValidationProps<TDate>>, 'views'>> & {
|
|
57
58
|
shouldRenderTimeInASingleColumn: boolean;
|
|
@@ -4,14 +4,13 @@ import { useDefaultDates, useUtils, applyDefaultDate, applyDefaultViewProps, res
|
|
|
4
4
|
import { DateTimeRangePickerToolbar } from './DateTimeRangePickerToolbar';
|
|
5
5
|
import { DateTimeRangePickerTabs } from './DateTimeRangePickerTabs';
|
|
6
6
|
export function useDateTimeRangePickerDefaultizedProps(props, name) {
|
|
7
|
-
var _themeProps$ampm, _themeProps$disableFu, _themeProps$disablePa, _themeProps$minDateTi, _themeProps$maxDateTi, _themeProps$minDateTi2, _themeProps$maxDateTi2, _themeProps$disableIg, _themeProps$slotProps;
|
|
8
7
|
const utils = useUtils();
|
|
9
8
|
const defaultDates = useDefaultDates();
|
|
10
9
|
const themeProps = useThemeProps({
|
|
11
10
|
props,
|
|
12
11
|
name
|
|
13
12
|
});
|
|
14
|
-
const ampm =
|
|
13
|
+
const ampm = themeProps.ampm ?? utils.is12HourCycleInCurrentLocale();
|
|
15
14
|
const {
|
|
16
15
|
openTo,
|
|
17
16
|
views: defaultViews
|
|
@@ -39,13 +38,13 @@ export function useDateTimeRangePickerDefaultizedProps(props, name) {
|
|
|
39
38
|
thresholdToRenderTimeInASingleColumn,
|
|
40
39
|
views,
|
|
41
40
|
ampm,
|
|
42
|
-
disableFuture:
|
|
43
|
-
disablePast:
|
|
44
|
-
minDate: applyDefaultDate(utils,
|
|
45
|
-
maxDate: applyDefaultDate(utils,
|
|
46
|
-
minTime:
|
|
47
|
-
maxTime:
|
|
48
|
-
disableIgnoringDatePartForTimeValidation:
|
|
41
|
+
disableFuture: themeProps.disableFuture ?? false,
|
|
42
|
+
disablePast: themeProps.disablePast ?? false,
|
|
43
|
+
minDate: applyDefaultDate(utils, themeProps.minDateTime ?? themeProps.minDate, defaultDates.minDate),
|
|
44
|
+
maxDate: applyDefaultDate(utils, themeProps.maxDateTime ?? themeProps.maxDate, defaultDates.maxDate),
|
|
45
|
+
minTime: themeProps.minDateTime ?? themeProps.minTime,
|
|
46
|
+
maxTime: themeProps.maxDateTime ?? themeProps.maxTime,
|
|
47
|
+
disableIgnoringDatePartForTimeValidation: themeProps.disableIgnoringDatePartForTimeValidation ?? Boolean(themeProps.minDateTime || themeProps.maxDateTime ||
|
|
49
48
|
// allow digital clocks to correctly check time validity: https://github.com/mui/mui-x/issues/12048
|
|
50
49
|
themeProps.disablePast || themeProps.disableFuture),
|
|
51
50
|
slots: _extends({
|
|
@@ -53,7 +52,7 @@ export function useDateTimeRangePickerDefaultizedProps(props, name) {
|
|
|
53
52
|
toolbar: DateTimeRangePickerToolbar
|
|
54
53
|
}, themeProps.slots),
|
|
55
54
|
slotProps: _extends({}, themeProps.slotProps, {
|
|
56
|
-
toolbar: _extends({},
|
|
55
|
+
toolbar: _extends({}, themeProps.slotProps?.toolbar, {
|
|
57
56
|
ampm
|
|
58
57
|
})
|
|
59
58
|
})
|
|
@@ -21,7 +21,6 @@ import { validateDateRange } from '../internals/utils/validation/validateDateRan
|
|
|
21
21
|
* - [DesktopDateRangePicker API](https://mui.com/x/api/date-pickers/desktop-date-range-picker/)
|
|
22
22
|
*/
|
|
23
23
|
const DesktopDateRangePicker = /*#__PURE__*/React.forwardRef(function DesktopDateRangePicker(inProps, ref) {
|
|
24
|
-
var _defaultizedProps$cal, _defaultizedProps$slo2;
|
|
25
24
|
// Props with the default values common to all date time pickers
|
|
26
25
|
const defaultizedProps = useDateRangePickerDefaultizedProps(inProps, 'MuiDesktopDateRangePicker');
|
|
27
26
|
const viewRenderers = _extends({
|
|
@@ -29,22 +28,19 @@ const DesktopDateRangePicker = /*#__PURE__*/React.forwardRef(function DesktopDat
|
|
|
29
28
|
}, defaultizedProps.viewRenderers);
|
|
30
29
|
const props = _extends({}, defaultizedProps, {
|
|
31
30
|
viewRenderers,
|
|
32
|
-
calendars:
|
|
31
|
+
calendars: defaultizedProps.calendars ?? 2,
|
|
33
32
|
views: ['day'],
|
|
34
33
|
openTo: 'day',
|
|
35
34
|
slots: _extends({
|
|
36
35
|
field: MultiInputDateRangeField
|
|
37
36
|
}, defaultizedProps.slots),
|
|
38
37
|
slotProps: _extends({}, defaultizedProps.slotProps, {
|
|
39
|
-
field: ownerState => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
ref
|
|
43
|
-
});
|
|
44
|
-
},
|
|
38
|
+
field: ownerState => _extends({}, resolveComponentProps(defaultizedProps.slotProps?.field, ownerState), extractValidationProps(defaultizedProps), {
|
|
39
|
+
ref
|
|
40
|
+
}),
|
|
45
41
|
toolbar: _extends({
|
|
46
42
|
hidden: true
|
|
47
|
-
},
|
|
43
|
+
}, defaultizedProps.slotProps?.toolbar)
|
|
48
44
|
})
|
|
49
45
|
});
|
|
50
46
|
const {
|
|
@@ -286,7 +282,7 @@ DesktopDateRangePicker.propTypes = {
|
|
|
286
282
|
/**
|
|
287
283
|
* Disable specific date.
|
|
288
284
|
*
|
|
289
|
-
* Warning: This function can be called multiple times (
|
|
285
|
+
* 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.
|
|
290
286
|
*
|
|
291
287
|
* @template TDate
|
|
292
288
|
* @param {TDate} day The date to test.
|
|
@@ -4,5 +4,15 @@ import { DesktopDateTimeRangePickerProps } from './DesktopDateTimeRangePicker.ty
|
|
|
4
4
|
type DesktopDateRangePickerComponent = (<TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean = false>(props: DesktopDateTimeRangePickerProps<TDate, TEnableAccessibleFieldDOMStructure> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
|
5
5
|
propTypes?: any;
|
|
6
6
|
};
|
|
7
|
+
/**
|
|
8
|
+
* Demos:
|
|
9
|
+
*
|
|
10
|
+
* - [DateTimeRangePicker](https://mui.com/x/react-date-pickers/date-time-range-picker/)
|
|
11
|
+
* - [Validation](https://mui.com/x/react-date-pickers/validation/)
|
|
12
|
+
*
|
|
13
|
+
* API:
|
|
14
|
+
*
|
|
15
|
+
* - [DesktopDateTimeRangePicker API](https://mui.com/x/api/date-pickers/desktop-date-time-range-picker/)
|
|
16
|
+
*/
|
|
7
17
|
declare const DesktopDateTimeRangePicker: DesktopDateRangePickerComponent;
|
|
8
18
|
export { DesktopDateTimeRangePicker };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["openTo", "rangePosition"
|
|
3
|
+
const _excluded = ["openTo", "rangePosition"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { extractValidationProps, isDatePickerView, isInternalTimeView } from '@mui/x-date-pickers/internals';
|
|
@@ -10,6 +10,7 @@ import { renderDigitalClockTimeView, renderMultiSectionDigitalClockTimeView } fr
|
|
|
10
10
|
import { multiSectionDigitalClockClasses, multiSectionDigitalClockSectionClasses } from '@mui/x-date-pickers/MultiSectionDigitalClock';
|
|
11
11
|
import Divider from '@mui/material/Divider';
|
|
12
12
|
import { digitalClockClasses } from '@mui/x-date-pickers/DigitalClock';
|
|
13
|
+
import { DesktopDateTimePickerLayout } from '@mui/x-date-pickers/DesktopDateTimePicker';
|
|
13
14
|
import { rangeValueManager } from '../internals/utils/valueManagers';
|
|
14
15
|
import { renderDateRangeViewCalendar } from '../dateRangeViewRenderers';
|
|
15
16
|
import { useDesktopRangePicker } from '../internals/hooks/useDesktopRangePicker';
|
|
@@ -18,31 +19,29 @@ import { useDateTimeRangePickerDefaultizedProps } from '../DateTimeRangePicker/s
|
|
|
18
19
|
import { MultiInputDateTimeRangeField } from '../MultiInputDateTimeRangeField';
|
|
19
20
|
import { DateTimeRangePickerTimeWrapper } from '../DateTimeRangePicker/DateTimeRangePickerTimeWrapper';
|
|
20
21
|
import { RANGE_VIEW_HEIGHT } from '../internals/constants/dimensions';
|
|
21
|
-
import { DesktopDateTimeRangePickerLayout } from './DesktopDateTimeRangePickerLayout';
|
|
22
22
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
23
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
24
|
const rendererInterceptor = function rendererInterceptor(inViewRenderers, popperView, rendererProps) {
|
|
25
|
-
var _inViewRenderers$day;
|
|
26
25
|
const {
|
|
27
26
|
openTo,
|
|
28
|
-
rangePosition
|
|
29
|
-
sx
|
|
27
|
+
rangePosition
|
|
30
28
|
} = rendererProps,
|
|
31
29
|
otherProps = _objectWithoutPropertiesLoose(rendererProps, _excluded);
|
|
32
30
|
const finalProps = _extends({}, otherProps, {
|
|
33
31
|
rangePosition,
|
|
34
32
|
focusedView: null,
|
|
35
33
|
sx: [{
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
[`&.${multiSectionDigitalClockClasses.root}`]: {
|
|
35
|
+
borderBottom: 0
|
|
36
|
+
},
|
|
38
37
|
[`&.${multiSectionDigitalClockClasses.root}, .${multiSectionDigitalClockSectionClasses.root}, &.${digitalClockClasses.root}`]: {
|
|
39
38
|
maxHeight: RANGE_VIEW_HEIGHT
|
|
40
39
|
}
|
|
41
|
-
}
|
|
40
|
+
}]
|
|
42
41
|
});
|
|
43
42
|
const isTimeViewActive = isInternalTimeView(popperView);
|
|
44
43
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
45
|
-
children: [
|
|
44
|
+
children: [inViewRenderers.day?.(_extends({}, rendererProps, {
|
|
46
45
|
availableRangePositions: [rangePosition],
|
|
47
46
|
view: !isTimeViewActive ? popperView : 'day',
|
|
48
47
|
views: rendererProps.views.filter(isDatePickerView)
|
|
@@ -50,13 +49,23 @@ const rendererInterceptor = function rendererInterceptor(inViewRenderers, popper
|
|
|
50
49
|
orientation: "vertical"
|
|
51
50
|
}), /*#__PURE__*/_jsx(DateTimeRangePickerTimeWrapper, _extends({}, finalProps, {
|
|
52
51
|
view: isTimeViewActive ? popperView : 'hours',
|
|
52
|
+
views: finalProps.views.filter(isInternalTimeView),
|
|
53
53
|
openTo: isInternalTimeView(openTo) ? openTo : 'hours',
|
|
54
54
|
viewRenderer: inViewRenderers[isTimeViewActive ? popperView : 'hours']
|
|
55
55
|
}))]
|
|
56
56
|
});
|
|
57
57
|
};
|
|
58
|
+
/**
|
|
59
|
+
* Demos:
|
|
60
|
+
*
|
|
61
|
+
* - [DateTimeRangePicker](https://mui.com/x/react-date-pickers/date-time-range-picker/)
|
|
62
|
+
* - [Validation](https://mui.com/x/react-date-pickers/validation/)
|
|
63
|
+
*
|
|
64
|
+
* API:
|
|
65
|
+
*
|
|
66
|
+
* - [DesktopDateTimeRangePicker API](https://mui.com/x/api/date-pickers/desktop-date-time-range-picker/)
|
|
67
|
+
*/
|
|
58
68
|
const DesktopDateTimeRangePicker = /*#__PURE__*/React.forwardRef(function DesktopDateTimeRangePicker(inProps, ref) {
|
|
59
|
-
var _viewRenderers$hours, _defaultizedProps$cal, _defaultizedProps$slo2, _defaultizedProps$slo3;
|
|
60
69
|
// Props with the default values common to all date time range pickers
|
|
61
70
|
const defaultizedProps = useDateTimeRangePickerDefaultizedProps(inProps, 'MuiDesktopDateTimeRangePicker');
|
|
62
71
|
const renderTimeView = defaultizedProps.shouldRenderTimeInASingleColumn ? renderDigitalClockTimeView : renderMultiSectionDigitalClockTimeView;
|
|
@@ -69,7 +78,7 @@ const DesktopDateTimeRangePicker = /*#__PURE__*/React.forwardRef(function Deskto
|
|
|
69
78
|
}, defaultizedProps.viewRenderers);
|
|
70
79
|
|
|
71
80
|
// Need to avoid adding the `meridiem` view when unexpected renderer is specified
|
|
72
|
-
const shouldHoursRendererContainMeridiemView =
|
|
81
|
+
const shouldHoursRendererContainMeridiemView = viewRenderers.hours?.name === renderMultiSectionDigitalClockTimeView.name;
|
|
73
82
|
const views = !shouldHoursRendererContainMeridiemView ? defaultizedProps.views.filter(view => view !== 'meridiem') : defaultizedProps.views;
|
|
74
83
|
const actionBarActions = defaultizedProps.shouldRenderTimeInASingleColumn ? [] : ['accept'];
|
|
75
84
|
const props = _extends({}, defaultizedProps, {
|
|
@@ -77,31 +86,25 @@ const DesktopDateTimeRangePicker = /*#__PURE__*/React.forwardRef(function Deskto
|
|
|
77
86
|
viewRenderers,
|
|
78
87
|
// force true to correctly handle `renderTimeViewClock` as a renderer
|
|
79
88
|
ampmInClock: true,
|
|
80
|
-
calendars:
|
|
89
|
+
calendars: defaultizedProps.calendars ?? 1,
|
|
81
90
|
slots: _extends({
|
|
82
91
|
field: MultiInputDateTimeRangeField,
|
|
83
|
-
layout:
|
|
92
|
+
layout: DesktopDateTimePickerLayout
|
|
84
93
|
}, defaultizedProps.slots),
|
|
85
94
|
slotProps: _extends({}, defaultizedProps.slotProps, {
|
|
86
|
-
field: ownerState => {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
ref
|
|
90
|
-
});
|
|
91
|
-
},
|
|
95
|
+
field: ownerState => _extends({}, resolveComponentProps(defaultizedProps.slotProps?.field, ownerState), extractValidationProps(defaultizedProps), {
|
|
96
|
+
ref
|
|
97
|
+
}),
|
|
92
98
|
tabs: _extends({
|
|
93
99
|
hidden: true
|
|
94
|
-
},
|
|
100
|
+
}, defaultizedProps.slotProps?.tabs),
|
|
95
101
|
toolbar: _extends({
|
|
96
102
|
hidden: true,
|
|
97
103
|
toolbarVariant: 'desktop'
|
|
98
|
-
},
|
|
99
|
-
actionBar: ownerState => {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
actions: actionBarActions
|
|
103
|
-
}, resolveComponentProps((_defaultizedProps$slo4 = defaultizedProps.slotProps) == null ? void 0 : _defaultizedProps$slo4.actionBar, ownerState));
|
|
104
|
-
}
|
|
104
|
+
}, defaultizedProps.slotProps?.toolbar),
|
|
105
|
+
actionBar: ownerState => _extends({
|
|
106
|
+
actions: actionBarActions
|
|
107
|
+
}, resolveComponentProps(defaultizedProps.slotProps?.actionBar, ownerState))
|
|
105
108
|
})
|
|
106
109
|
});
|
|
107
110
|
const {
|
|
@@ -389,7 +392,7 @@ DesktopDateTimeRangePicker.propTypes = {
|
|
|
389
392
|
/**
|
|
390
393
|
* Disable specific date.
|
|
391
394
|
*
|
|
392
|
-
* Warning: This function can be called multiple times (
|
|
395
|
+
* 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.
|
|
393
396
|
*
|
|
394
397
|
* @template TDate
|
|
395
398
|
* @param {TDate} day The date to test.
|
|
@@ -21,7 +21,6 @@ import { validateDateRange } from '../internals/utils/validation/validateDateRan
|
|
|
21
21
|
* - [MobileDateRangePicker API](https://mui.com/x/api/date-pickers/mobile-date-range-picker/)
|
|
22
22
|
*/
|
|
23
23
|
const MobileDateRangePicker = /*#__PURE__*/React.forwardRef(function MobileDateRangePicker(inProps, ref) {
|
|
24
|
-
var _defaultizedProps$slo2;
|
|
25
24
|
// Props with the default values common to all date time pickers
|
|
26
25
|
const defaultizedProps = useDateRangePickerDefaultizedProps(inProps, 'MuiMobileDateRangePicker');
|
|
27
26
|
const viewRenderers = _extends({
|
|
@@ -37,15 +36,12 @@ const MobileDateRangePicker = /*#__PURE__*/React.forwardRef(function MobileDateR
|
|
|
37
36
|
field: MultiInputDateRangeField
|
|
38
37
|
}, defaultizedProps.slots),
|
|
39
38
|
slotProps: _extends({}, defaultizedProps.slotProps, {
|
|
40
|
-
field: ownerState => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
ref
|
|
44
|
-
});
|
|
45
|
-
},
|
|
39
|
+
field: ownerState => _extends({}, resolveComponentProps(defaultizedProps.slotProps?.field, ownerState), extractValidationProps(defaultizedProps), {
|
|
40
|
+
ref
|
|
41
|
+
}),
|
|
46
42
|
toolbar: _extends({
|
|
47
43
|
hidden: false
|
|
48
|
-
},
|
|
44
|
+
}, defaultizedProps.slotProps?.toolbar)
|
|
49
45
|
})
|
|
50
46
|
});
|
|
51
47
|
const {
|
|
@@ -282,7 +278,7 @@ MobileDateRangePicker.propTypes = {
|
|
|
282
278
|
/**
|
|
283
279
|
* Disable specific date.
|
|
284
280
|
*
|
|
285
|
-
* Warning: This function can be called multiple times (
|
|
281
|
+
* 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.
|
|
286
282
|
*
|
|
287
283
|
* @template TDate
|
|
288
284
|
* @param {TDate} day The date to test.
|
|
@@ -4,5 +4,15 @@ import { MobileDateTimeRangePickerProps } from './MobileDateTimeRangePicker.type
|
|
|
4
4
|
type MobileDateRangePickerComponent = (<TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean = false>(props: MobileDateTimeRangePickerProps<TDate, TEnableAccessibleFieldDOMStructure> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
|
5
5
|
propTypes?: any;
|
|
6
6
|
};
|
|
7
|
+
/**
|
|
8
|
+
* Demos:
|
|
9
|
+
*
|
|
10
|
+
* - [DateTimeRangePicker](https://mui.com/x/react-date-pickers/date-time-range-picker/)
|
|
11
|
+
* - [Validation](https://mui.com/x/react-date-pickers/validation/)
|
|
12
|
+
*
|
|
13
|
+
* API:
|
|
14
|
+
*
|
|
15
|
+
* - [MobileDateTimeRangePicker API](https://mui.com/x/api/date-pickers/mobile-date-time-range-picker/)
|
|
16
|
+
*/
|
|
7
17
|
declare const MobileDateTimeRangePicker: MobileDateRangePickerComponent;
|
|
8
18
|
export { MobileDateTimeRangePicker };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["view", "openTo", "rangePosition"
|
|
3
|
+
const _excluded = ["view", "openTo", "rangePosition"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { refType } from '@mui/utils';
|
|
@@ -22,8 +22,7 @@ const rendererInterceptor = function rendererInterceptor(inViewRenderers, popper
|
|
|
22
22
|
const {
|
|
23
23
|
view,
|
|
24
24
|
openTo,
|
|
25
|
-
rangePosition
|
|
26
|
-
sx
|
|
25
|
+
rangePosition
|
|
27
26
|
} = rendererProps,
|
|
28
27
|
otherRendererProps = _objectWithoutPropertiesLoose(rendererProps, _excluded);
|
|
29
28
|
const finalProps = _extends({}, otherRendererProps, {
|
|
@@ -48,7 +47,7 @@ const rendererInterceptor = function rendererInterceptor(inViewRenderers, popper
|
|
|
48
47
|
[`&.${multiSectionDigitalClockClasses.root}, .${multiSectionDigitalClockSectionClasses.root}`]: {
|
|
49
48
|
maxHeight: RANGE_VIEW_HEIGHT - 1
|
|
50
49
|
}
|
|
51
|
-
}
|
|
50
|
+
}]
|
|
52
51
|
});
|
|
53
52
|
const isTimeView = isInternalTimeView(popperView);
|
|
54
53
|
const viewRenderer = inViewRenderers[popperView];
|
|
@@ -59,6 +58,7 @@ const rendererInterceptor = function rendererInterceptor(inViewRenderers, popper
|
|
|
59
58
|
return /*#__PURE__*/_jsx(DateTimeRangePickerTimeWrapper, _extends({}, finalProps, {
|
|
60
59
|
viewRenderer: viewRenderer,
|
|
61
60
|
view: view && isInternalTimeView(view) ? view : 'hours',
|
|
61
|
+
views: finalProps.views,
|
|
62
62
|
openTo: isInternalTimeView(openTo) ? openTo : 'hours'
|
|
63
63
|
}));
|
|
64
64
|
}
|
|
@@ -71,8 +71,17 @@ const rendererInterceptor = function rendererInterceptor(inViewRenderers, popper
|
|
|
71
71
|
openTo: isDatePickerView(openTo) ? openTo : 'day'
|
|
72
72
|
}));
|
|
73
73
|
};
|
|
74
|
+
/**
|
|
75
|
+
* Demos:
|
|
76
|
+
*
|
|
77
|
+
* - [DateTimeRangePicker](https://mui.com/x/react-date-pickers/date-time-range-picker/)
|
|
78
|
+
* - [Validation](https://mui.com/x/react-date-pickers/validation/)
|
|
79
|
+
*
|
|
80
|
+
* API:
|
|
81
|
+
*
|
|
82
|
+
* - [MobileDateTimeRangePicker API](https://mui.com/x/api/date-pickers/mobile-date-time-range-picker/)
|
|
83
|
+
*/
|
|
74
84
|
const MobileDateTimeRangePicker = /*#__PURE__*/React.forwardRef(function MobileDateTimeRangePicker(inProps, ref) {
|
|
75
|
-
var _defaultizedProps$slo2, _defaultizedProps$slo3;
|
|
76
85
|
// Props with the default values common to all date time range pickers
|
|
77
86
|
const defaultizedProps = useDateTimeRangePickerDefaultizedProps(inProps, 'MuiMobileDateTimeRangePicker');
|
|
78
87
|
const renderTimeView = defaultizedProps.shouldRenderTimeInASingleColumn ? renderDigitalClockTimeView : renderMultiSectionDigitalClockTimeView;
|
|
@@ -93,19 +102,16 @@ const MobileDateTimeRangePicker = /*#__PURE__*/React.forwardRef(function MobileD
|
|
|
93
102
|
field: MultiInputDateTimeRangeField
|
|
94
103
|
}, defaultizedProps.slots),
|
|
95
104
|
slotProps: _extends({}, defaultizedProps.slotProps, {
|
|
96
|
-
field: ownerState => {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
ref
|
|
100
|
-
});
|
|
101
|
-
},
|
|
105
|
+
field: ownerState => _extends({}, resolveComponentProps(defaultizedProps.slotProps?.field, ownerState), extractValidationProps(defaultizedProps), {
|
|
106
|
+
ref
|
|
107
|
+
}),
|
|
102
108
|
tabs: _extends({
|
|
103
109
|
hidden: false
|
|
104
|
-
},
|
|
110
|
+
}, defaultizedProps.slotProps?.tabs),
|
|
105
111
|
toolbar: _extends({
|
|
106
112
|
hidden: false,
|
|
107
113
|
toolbarVariant: 'mobile'
|
|
108
|
-
},
|
|
114
|
+
}, defaultizedProps.slotProps?.toolbar)
|
|
109
115
|
})
|
|
110
116
|
});
|
|
111
117
|
const {
|
|
@@ -388,7 +394,7 @@ MobileDateTimeRangePicker.propTypes = {
|
|
|
388
394
|
/**
|
|
389
395
|
* Disable specific date.
|
|
390
396
|
*
|
|
391
|
-
* Warning: This function can be called multiple times (
|
|
397
|
+
* 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.
|
|
392
398
|
*
|
|
393
399
|
* @template TDate
|
|
394
400
|
* @param {TDate} day The date to test.
|