@mui/x-date-pickers-pro 8.0.0-alpha.6 → 8.0.0-alpha.8
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/{AdapterDateFnsJalaliV3 → AdapterDateFnsJalaliV2}/index.d.ts +1 -1
- package/{AdapterDateFnsJalaliV3 → AdapterDateFnsJalaliV2}/index.js +1 -1
- package/{AdapterDateFnsJalaliV3 → AdapterDateFnsJalaliV2}/package.json +1 -1
- package/{AdapterDateFnsV3 → AdapterDateFnsV2}/index.d.ts +1 -1
- package/{AdapterDateFnsV3 → AdapterDateFnsV2}/index.js +1 -1
- package/{AdapterDateFnsV3 → AdapterDateFnsV2}/package.json +1 -1
- package/CHANGELOG.md +242 -1
- package/DateRangeCalendar/DateRangeCalendar.js +12 -10
- package/DateRangePicker/DateRangePicker.js +1 -1
- package/DateRangePicker/DateRangePicker.types.d.ts +5 -0
- package/DateRangePicker/DateRangePickerToolbar.d.ts +2 -3
- package/DateRangePicker/DateRangePickerToolbar.js +27 -19
- package/DateRangePicker/shared.d.ts +1 -1
- package/DateTimeRangePicker/DateTimeRangePicker.js +2 -2
- package/DateTimeRangePicker/DateTimeRangePickerTabs.d.ts +3 -4
- package/DateTimeRangePicker/DateTimeRangePickerTabs.js +10 -9
- package/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.d.ts +8 -10
- package/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +8 -6
- package/DateTimeRangePicker/DateTimeRangePickerToolbar.d.ts +2 -3
- package/DateTimeRangePicker/DateTimeRangePickerToolbar.js +29 -31
- package/DateTimeRangePicker/shared.d.ts +2 -2
- package/DesktopDateRangePicker/DesktopDateRangePicker.js +9 -3
- package/DesktopDateRangePicker/DesktopDateRangePicker.types.d.ts +5 -0
- package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +17 -14
- package/MobileDateRangePicker/MobileDateRangePicker.js +2 -2
- package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +15 -8
- package/MultiInputDateRangeField/MultiInputDateRangeField.d.ts +9 -4
- package/MultiInputDateRangeField/MultiInputDateRangeField.js +12 -116
- package/MultiInputDateRangeField/index.d.ts +5 -3
- package/MultiInputDateRangeField/index.js +2 -2
- package/MultiInputDateRangeField/multiInputDateRangeFieldClasses.d.ts +6 -0
- package/MultiInputDateRangeField/multiInputDateRangeFieldClasses.js +4 -0
- package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.d.ts +9 -4
- package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +12 -116
- package/MultiInputDateTimeRangeField/index.d.ts +5 -3
- package/MultiInputDateTimeRangeField/index.js +2 -2
- package/MultiInputDateTimeRangeField/multiInputDateTimeRangeFieldClasses.d.ts +6 -0
- package/MultiInputDateTimeRangeField/multiInputDateTimeRangeFieldClasses.js +4 -0
- package/MultiInputTimeRangeField/MultiInputTimeRangeField.d.ts +9 -4
- package/MultiInputTimeRangeField/MultiInputTimeRangeField.js +13 -117
- package/MultiInputTimeRangeField/index.d.ts +5 -3
- package/MultiInputTimeRangeField/index.js +2 -2
- package/MultiInputTimeRangeField/multiInputTimeRangeFieldClasses.d.ts +6 -0
- package/MultiInputTimeRangeField/multiInputTimeRangeFieldClasses.js +4 -0
- package/SingleInputDateRangeField/SingleInputDateRangeField.js +20 -30
- package/SingleInputDateRangeField/SingleInputDateRangeField.types.d.ts +6 -17
- package/SingleInputDateRangeField/useSingleInputDateRangeField.d.ts +1 -1
- package/SingleInputDateRangeField/useSingleInputDateRangeField.js +14 -14
- package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +20 -30
- package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.types.d.ts +6 -18
- package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.d.ts +1 -1
- package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +14 -14
- package/SingleInputTimeRangeField/SingleInputTimeRangeField.js +20 -30
- package/SingleInputTimeRangeField/SingleInputTimeRangeField.types.d.ts +6 -18
- package/SingleInputTimeRangeField/useSingleInputTimeRangeField.d.ts +1 -1
- package/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +14 -14
- package/dateRangeViewRenderers/dateRangeViewRenderers.d.ts +2 -2
- package/dateRangeViewRenderers/dateRangeViewRenderers.js +0 -6
- package/hooks/index.d.ts +2 -0
- package/hooks/index.js +2 -0
- package/hooks/package.json +6 -0
- package/hooks/useMultiInputRangeField/index.d.ts +1 -0
- package/hooks/useMultiInputRangeField/index.js +1 -0
- package/hooks/useMultiInputRangeField/useMultiInputRangeField.d.ts +53 -0
- package/hooks/useMultiInputRangeField/useMultiInputRangeField.js +149 -0
- package/hooks/useMultiInputRangeField/useMultiInputRangeFieldSelectedSections.d.ts +17 -0
- package/{internals/hooks/useMultiInputFieldSelectedSections.js → hooks/useMultiInputRangeField/useMultiInputRangeFieldSelectedSections.js} +10 -8
- package/hooks/useMultiInputRangeField/useMultiInputRangeFieldTextFieldProps.d.ts +17 -0
- package/hooks/useMultiInputRangeField/useMultiInputRangeFieldTextFieldProps.js +59 -0
- package/hooks/usePickerRangePositionContext.d.ts +7 -0
- package/hooks/usePickerRangePositionContext.js +15 -0
- package/index.d.ts +2 -0
- package/index.js +4 -2
- package/internals/hooks/models/index.d.ts +1 -1
- package/internals/hooks/models/useRangePicker.d.ts +6 -8
- package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +40 -67
- package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.d.ts +3 -5
- package/internals/hooks/{useEnrichedRangePickerFieldProps.d.ts → useEnrichedRangePickerField.d.ts} +18 -9
- package/internals/hooks/{useEnrichedRangePickerFieldProps.js → useEnrichedRangePickerField.js} +39 -52
- package/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +33 -56
- package/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.d.ts +3 -5
- package/internals/hooks/useNullablePickerRangePositionContext.d.ts +5 -0
- package/internals/hooks/useNullablePickerRangePositionContext.js +10 -0
- package/internals/hooks/useRangePosition.d.ts +2 -2
- package/internals/hooks/useRangePosition.js +1 -1
- package/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +14 -24
- package/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.d.ts +2 -2
- package/internals/models/dateTimeRange.d.ts +1 -6
- package/internals/models/fields.d.ts +1 -2
- package/internals/models/index.d.ts +0 -1
- package/internals/models/index.js +0 -1
- package/internals/models/managers.d.ts +3 -0
- package/internals/utils/createMultiInputRangeField/createMultiInputRangeField.d.ts +3 -0
- package/internals/utils/createMultiInputRangeField/createMultiInputRangeField.js +133 -0
- package/internals/utils/createMultiInputRangeField/createMultiInputRangeField.types.d.ts +72 -0
- package/internals/utils/createMultiInputRangeField/index.d.ts +3 -0
- package/internals/utils/createMultiInputRangeField/index.js +2 -0
- package/internals/utils/date-range-manager.js +2 -1
- package/internals/utils/releaseInfo.js +1 -1
- package/internals/utils/valueManagers.js +7 -7
- package/managers/index.d.ts +6 -0
- package/managers/index.js +3 -0
- package/managers/package.json +6 -0
- package/managers/useDateRangeManager.d.ts +15 -0
- package/managers/useDateRangeManager.js +33 -0
- package/managers/useDateTimeRangeManager.d.ts +15 -0
- package/managers/useDateTimeRangeManager.js +33 -0
- package/managers/useTimeRangeManager.d.ts +15 -0
- package/managers/useTimeRangeManager.js +31 -0
- package/models/fields.d.ts +1 -2
- package/models/index.d.ts +0 -2
- package/models/index.js +0 -2
- package/models/range.d.ts +0 -1
- package/modern/{AdapterDateFnsJalaliV3 → AdapterDateFnsJalaliV2}/index.js +1 -1
- package/modern/{AdapterDateFnsV3 → AdapterDateFnsV2}/index.js +1 -1
- package/modern/DateRangeCalendar/DateRangeCalendar.js +12 -10
- package/modern/DateRangePicker/DateRangePicker.js +1 -1
- package/modern/DateRangePicker/DateRangePickerToolbar.js +27 -19
- package/modern/DateTimeRangePicker/DateTimeRangePicker.js +2 -2
- package/modern/DateTimeRangePicker/DateTimeRangePickerTabs.js +10 -9
- package/modern/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +8 -6
- package/modern/DateTimeRangePicker/DateTimeRangePickerToolbar.js +29 -31
- package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +9 -3
- package/modern/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +17 -14
- package/modern/MobileDateRangePicker/MobileDateRangePicker.js +2 -2
- package/modern/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +15 -8
- package/modern/MultiInputDateRangeField/MultiInputDateRangeField.js +12 -116
- package/modern/MultiInputDateRangeField/index.js +2 -2
- package/modern/MultiInputDateRangeField/multiInputDateRangeFieldClasses.js +4 -0
- package/modern/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +12 -116
- package/modern/MultiInputDateTimeRangeField/index.js +2 -2
- package/modern/MultiInputDateTimeRangeField/multiInputDateTimeRangeFieldClasses.js +4 -0
- package/modern/MultiInputTimeRangeField/MultiInputTimeRangeField.js +13 -117
- package/modern/MultiInputTimeRangeField/index.js +2 -2
- package/modern/MultiInputTimeRangeField/multiInputTimeRangeFieldClasses.js +4 -0
- package/modern/SingleInputDateRangeField/SingleInputDateRangeField.js +20 -30
- package/modern/SingleInputDateRangeField/useSingleInputDateRangeField.js +14 -14
- package/modern/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +20 -30
- package/modern/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +14 -14
- package/modern/SingleInputTimeRangeField/SingleInputTimeRangeField.js +20 -30
- package/modern/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +14 -14
- package/modern/dateRangeViewRenderers/dateRangeViewRenderers.js +0 -6
- package/modern/hooks/index.js +2 -0
- package/modern/hooks/useMultiInputRangeField/index.js +1 -0
- package/modern/hooks/useMultiInputRangeField/useMultiInputRangeField.js +149 -0
- package/modern/{internals/hooks/useMultiInputFieldSelectedSections.js → hooks/useMultiInputRangeField/useMultiInputRangeFieldSelectedSections.js} +10 -8
- package/modern/hooks/useMultiInputRangeField/useMultiInputRangeFieldTextFieldProps.js +59 -0
- package/modern/hooks/usePickerRangePositionContext.js +15 -0
- package/modern/index.js +4 -2
- package/modern/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +40 -67
- package/modern/internals/hooks/{useEnrichedRangePickerFieldProps.js → useEnrichedRangePickerField.js} +39 -52
- package/modern/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +33 -56
- package/modern/internals/hooks/useNullablePickerRangePositionContext.js +10 -0
- package/modern/internals/hooks/useRangePosition.js +1 -1
- package/modern/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +14 -24
- package/modern/internals/models/index.js +0 -1
- package/modern/internals/utils/createMultiInputRangeField/createMultiInputRangeField.js +133 -0
- package/modern/internals/utils/createMultiInputRangeField/index.js +2 -0
- package/modern/internals/utils/date-range-manager.js +2 -1
- package/modern/internals/utils/releaseInfo.js +1 -1
- package/modern/internals/utils/valueManagers.js +7 -7
- package/modern/managers/index.js +3 -0
- package/modern/managers/useDateRangeManager.js +33 -0
- package/modern/managers/useDateTimeRangeManager.js +33 -0
- package/modern/managers/useTimeRangeManager.js +31 -0
- package/modern/models/index.js +0 -2
- package/node/{AdapterDateFnsJalaliV3 → AdapterDateFnsJalaliV2}/index.js +1 -1
- package/node/{AdapterDateFnsV3 → AdapterDateFnsV2}/index.js +1 -1
- package/node/DateRangeCalendar/DateRangeCalendar.js +12 -10
- package/node/DateRangePicker/DateRangePicker.js +1 -1
- package/node/DateRangePicker/DateRangePickerToolbar.js +26 -18
- package/node/DateTimeRangePicker/DateTimeRangePicker.js +2 -2
- package/node/DateTimeRangePicker/DateTimeRangePickerTabs.js +10 -9
- package/node/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +8 -6
- package/node/DateTimeRangePicker/DateTimeRangePickerToolbar.js +29 -31
- package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +9 -3
- package/node/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +17 -14
- package/node/MobileDateRangePicker/MobileDateRangePicker.js +2 -2
- package/node/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +15 -8
- package/node/MultiInputDateRangeField/MultiInputDateRangeField.js +11 -119
- package/node/MultiInputDateRangeField/index.js +3 -9
- package/node/MultiInputDateRangeField/multiInputDateRangeFieldClasses.js +12 -0
- package/node/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +11 -119
- package/node/MultiInputDateTimeRangeField/index.js +3 -9
- package/node/MultiInputDateTimeRangeField/multiInputDateTimeRangeFieldClasses.js +12 -0
- package/node/MultiInputTimeRangeField/MultiInputTimeRangeField.js +12 -120
- package/node/MultiInputTimeRangeField/index.js +3 -9
- package/node/MultiInputTimeRangeField/multiInputTimeRangeFieldClasses.js +12 -0
- package/node/SingleInputDateRangeField/SingleInputDateRangeField.js +19 -29
- package/node/SingleInputDateRangeField/useSingleInputDateRangeField.js +13 -14
- package/node/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +19 -29
- package/node/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +13 -14
- package/node/SingleInputTimeRangeField/SingleInputTimeRangeField.js +19 -29
- package/node/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +13 -14
- package/node/dateRangeViewRenderers/dateRangeViewRenderers.js +0 -6
- package/node/hooks/index.js +19 -0
- package/node/hooks/useMultiInputRangeField/index.js +12 -0
- package/node/hooks/useMultiInputRangeField/useMultiInputRangeField.js +155 -0
- package/node/{internals/hooks/useMultiInputFieldSelectedSections.js → hooks/useMultiInputRangeField/useMultiInputRangeFieldSelectedSections.js} +11 -10
- package/node/hooks/useMultiInputRangeField/useMultiInputRangeFieldTextFieldProps.js +66 -0
- package/node/hooks/usePickerRangePositionContext.js +22 -0
- package/node/index.js +23 -1
- package/node/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +39 -66
- package/node/internals/hooks/{useEnrichedRangePickerFieldProps.js → useEnrichedRangePickerField.js} +41 -54
- package/node/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +32 -55
- package/node/internals/hooks/useNullablePickerRangePositionContext.js +16 -0
- package/node/internals/hooks/useRangePosition.js +1 -1
- package/node/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +14 -24
- package/node/internals/models/index.js +0 -11
- package/node/internals/utils/createMultiInputRangeField/createMultiInputRangeField.js +140 -0
- package/node/internals/utils/createMultiInputRangeField/index.js +19 -0
- package/node/internals/utils/date-range-manager.js +2 -1
- package/node/internals/utils/releaseInfo.js +1 -1
- package/node/internals/utils/valueManagers.js +7 -7
- package/node/managers/index.js +26 -0
- package/node/managers/useDateRangeManager.js +40 -0
- package/node/managers/useDateTimeRangeManager.js +40 -0
- package/node/managers/useTimeRangeManager.js +38 -0
- package/node/models/index.js +0 -22
- package/package.json +5 -5
- package/themeAugmentation/overrides.d.ts +6 -4
- package/themeAugmentation/props.d.ts +2 -2
- package/MultiInputDateRangeField/MultiInputDateRangeField.types.d.ts +0 -55
- package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.d.ts +0 -56
- package/MultiInputTimeRangeField/MultiInputTimeRangeField.types.d.ts +0 -56
- package/internals/hooks/useMultiInputFieldSelectedSections.d.ts +0 -20
- package/internals/hooks/useMultiInputRangeField/shared.d.ts +0 -1
- package/internals/hooks/useMultiInputRangeField/shared.js +0 -9
- package/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.d.ts +0 -3
- package/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +0 -113
- package/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.d.ts +0 -3
- package/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +0 -113
- package/internals/hooks/useMultiInputRangeField/useMultiInputRangeField.types.d.ts +0 -11
- package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.d.ts +0 -3
- package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +0 -113
- package/internals/models/timeRange.d.ts +0 -6
- package/internals/models/timeRange.js +0 -1
- package/models/dateRange.d.ts +0 -7
- package/models/dateRange.js +0 -1
- package/models/multiInputRangeFieldClasses.d.ts +0 -7
- package/models/multiInputRangeFieldClasses.js +0 -1
- package/modern/MultiInputDateRangeField/MultiInputDateRangeField.types.js +0 -1
- package/modern/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.js +0 -1
- package/modern/MultiInputTimeRangeField/MultiInputTimeRangeField.types.js +0 -1
- package/modern/internals/hooks/useMultiInputRangeField/shared.js +0 -9
- package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +0 -113
- package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +0 -113
- package/modern/internals/hooks/useMultiInputRangeField/useMultiInputRangeField.types.js +0 -1
- package/modern/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +0 -113
- package/modern/internals/models/timeRange.js +0 -1
- package/modern/models/dateRange.js +0 -1
- package/modern/models/multiInputRangeFieldClasses.js +0 -1
- package/node/MultiInputTimeRangeField/MultiInputTimeRangeField.types.js +0 -5
- package/node/internals/hooks/useMultiInputRangeField/shared.js +0 -16
- package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +0 -121
- package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +0 -121
- package/node/internals/hooks/useMultiInputRangeField/useMultiInputRangeField.types.js +0 -5
- package/node/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +0 -121
- package/node/internals/models/timeRange.js +0 -5
- package/node/models/dateRange.js +0 -5
- package/node/models/multiInputRangeFieldClasses.js +0 -5
- /package/{MultiInputDateRangeField/MultiInputDateRangeField.types.js → internals/models/managers.js} +0 -0
- /package/{MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.js → internals/utils/createMultiInputRangeField/createMultiInputRangeField.types.js} +0 -0
- /package/{MultiInputTimeRangeField/MultiInputTimeRangeField.types.js → modern/internals/models/managers.js} +0 -0
- /package/{internals/hooks/useMultiInputRangeField/useMultiInputRangeField.types.js → modern/internals/utils/createMultiInputRangeField/createMultiInputRangeField.types.js} +0 -0
- /package/node/{MultiInputDateRangeField/MultiInputDateRangeField.types.js → internals/models/managers.js} +0 -0
- /package/node/{MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.js → internals/utils/createMultiInputRangeField/createMultiInputRangeField.types.js} +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
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 = ["
|
|
5
|
+
const _excluded = ["toolbarFormat", "className", "classes"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import clsx from 'clsx';
|
|
@@ -10,8 +10,9 @@ 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, useToolbarOwnerState } from '@mui/x-date-pickers/internals';
|
|
13
|
-
import { usePickerTranslations } from '@mui/x-date-pickers/hooks';
|
|
13
|
+
import { usePickerContext, usePickerTranslations } from '@mui/x-date-pickers/hooks';
|
|
14
14
|
import { getDateRangePickerToolbarUtilityClass } from "./dateRangePickerToolbarClasses.js";
|
|
15
|
+
import { usePickerRangePositionContext } from "../hooks/index.js";
|
|
15
16
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
17
|
const useUtilityClasses = classes => {
|
|
17
18
|
const slots = {
|
|
@@ -49,40 +50,50 @@ const DateRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateRangeP
|
|
|
49
50
|
name: 'MuiDateRangePickerToolbar'
|
|
50
51
|
});
|
|
51
52
|
const {
|
|
52
|
-
|
|
53
|
-
rangePosition,
|
|
54
|
-
onRangePositionChange,
|
|
55
|
-
toolbarFormat,
|
|
53
|
+
toolbarFormat: toolbarFormatProp,
|
|
56
54
|
className,
|
|
57
55
|
classes: classesProp
|
|
58
56
|
} = props,
|
|
59
57
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
58
|
+
const {
|
|
59
|
+
value
|
|
60
|
+
} = usePickerContext();
|
|
60
61
|
const translations = usePickerTranslations();
|
|
61
62
|
const ownerState = useToolbarOwnerState();
|
|
63
|
+
const {
|
|
64
|
+
rangePosition,
|
|
65
|
+
setRangePosition
|
|
66
|
+
} = usePickerRangePositionContext();
|
|
62
67
|
const classes = useUtilityClasses(classesProp);
|
|
63
|
-
|
|
64
|
-
|
|
68
|
+
|
|
69
|
+
// This can't be a default value when spreading because it breaks the API generation.
|
|
70
|
+
const toolbarFormat = toolbarFormatProp ?? utils.formats.shortDate;
|
|
71
|
+
const formatDate = (date, fallback) => {
|
|
72
|
+
if (!utils.isValid(date)) {
|
|
73
|
+
return fallback;
|
|
74
|
+
}
|
|
75
|
+
return utils.formatByString(date, toolbarFormat);
|
|
76
|
+
};
|
|
65
77
|
return /*#__PURE__*/_jsx(DateRangePickerToolbarRoot, _extends({}, other, {
|
|
66
78
|
toolbarTitle: translations.dateRangePickerToolbarTitle,
|
|
67
|
-
isLandscape: false,
|
|
68
79
|
className: clsx(classes.root, className),
|
|
69
80
|
ownerState: ownerState,
|
|
70
81
|
ref: ref,
|
|
71
82
|
children: /*#__PURE__*/_jsxs(DateRangePickerToolbarContainer, {
|
|
72
83
|
className: classes.container,
|
|
73
84
|
children: [/*#__PURE__*/_jsx(PickersToolbarButton, {
|
|
74
|
-
variant:
|
|
75
|
-
value:
|
|
85
|
+
variant: value[0] == null ? 'h6' : 'h5',
|
|
86
|
+
value: formatDate(value[0], translations.start),
|
|
76
87
|
selected: rangePosition === 'start',
|
|
77
|
-
onClick: () =>
|
|
88
|
+
onClick: () => setRangePosition('start')
|
|
78
89
|
}), /*#__PURE__*/_jsxs(Typography, {
|
|
79
90
|
variant: "h5",
|
|
80
91
|
children: ["\xA0", '–', "\xA0"]
|
|
81
92
|
}), /*#__PURE__*/_jsx(PickersToolbarButton, {
|
|
82
|
-
variant:
|
|
83
|
-
value:
|
|
93
|
+
variant: value[1] == null ? 'h6' : 'h5',
|
|
94
|
+
value: formatDate(value[1], translations.end),
|
|
84
95
|
selected: rangePosition === 'end',
|
|
85
|
-
onClick: () =>
|
|
96
|
+
onClick: () => setRangePosition('end')
|
|
86
97
|
})]
|
|
87
98
|
})
|
|
88
99
|
}));
|
|
@@ -102,8 +113,6 @@ process.env.NODE_ENV !== "production" ? DateRangePickerToolbar.propTypes = {
|
|
|
102
113
|
* @default `true` for Desktop, `false` for Mobile.
|
|
103
114
|
*/
|
|
104
115
|
hidden: PropTypes.bool,
|
|
105
|
-
onRangePositionChange: PropTypes.func.isRequired,
|
|
106
|
-
rangePosition: PropTypes.oneOf(['end', 'start']).isRequired,
|
|
107
116
|
/**
|
|
108
117
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
109
118
|
*/
|
|
@@ -117,7 +126,6 @@ process.env.NODE_ENV !== "production" ? DateRangePickerToolbar.propTypes = {
|
|
|
117
126
|
* Toolbar value placeholder—it is displayed when the value is empty.
|
|
118
127
|
* @default "––"
|
|
119
128
|
*/
|
|
120
|
-
toolbarPlaceholder: PropTypes.node
|
|
121
|
-
value: PropTypes.arrayOf(PropTypes.object).isRequired
|
|
129
|
+
toolbarPlaceholder: PropTypes.node
|
|
122
130
|
} : void 0;
|
|
123
131
|
export { DateRangePickerToolbar };
|
|
@@ -68,8 +68,8 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePicker.propTypes = {
|
|
|
68
68
|
calendars: PropTypes.oneOf([1, 2, 3]),
|
|
69
69
|
className: PropTypes.string,
|
|
70
70
|
/**
|
|
71
|
-
* If `true`, the
|
|
72
|
-
* @default
|
|
71
|
+
* If `true`, the Picker will close after submitting the full date.
|
|
72
|
+
* @default false
|
|
73
73
|
*/
|
|
74
74
|
closeOnSelect: PropTypes.bool,
|
|
75
75
|
/**
|
|
@@ -12,6 +12,7 @@ import { usePickerContext, usePickerTranslations } from '@mui/x-date-pickers/hoo
|
|
|
12
12
|
import IconButton from '@mui/material/IconButton';
|
|
13
13
|
import Button from '@mui/material/Button';
|
|
14
14
|
import { getDateTimeRangePickerTabsUtilityClass } from "./dateTimeRangePickerTabsClasses.js";
|
|
15
|
+
import { usePickerRangePositionContext } from "../hooks/index.js";
|
|
15
16
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
17
|
const viewToTab = (view, rangePosition) => {
|
|
17
18
|
if (isDatePickerView(view)) {
|
|
@@ -71,8 +72,6 @@ const DateTimeRangePickerTabs = function DateTimeRangePickerTabs(inProps) {
|
|
|
71
72
|
dateIcon = /*#__PURE__*/_jsx(DateRangeIcon, {}),
|
|
72
73
|
timeIcon = /*#__PURE__*/_jsx(TimeIcon, {}),
|
|
73
74
|
hidden = typeof window === 'undefined' || window.innerHeight < 667,
|
|
74
|
-
rangePosition,
|
|
75
|
-
onRangePositionChange,
|
|
76
75
|
className,
|
|
77
76
|
classes: classesProp,
|
|
78
77
|
sx
|
|
@@ -83,9 +82,13 @@ const DateTimeRangePickerTabs = function DateTimeRangePickerTabs(inProps) {
|
|
|
83
82
|
} = usePickerPrivateContext();
|
|
84
83
|
const {
|
|
85
84
|
view,
|
|
86
|
-
|
|
85
|
+
setView
|
|
87
86
|
} = usePickerContext();
|
|
88
87
|
const classes = useUtilityClasses(classesProp);
|
|
88
|
+
const {
|
|
89
|
+
rangePosition,
|
|
90
|
+
setRangePosition
|
|
91
|
+
} = usePickerRangePositionContext();
|
|
89
92
|
const value = React.useMemo(() => view == null ? null : viewToTab(view, rangePosition), [view, rangePosition]);
|
|
90
93
|
const isPreviousHidden = value === 'start-date';
|
|
91
94
|
const isNextHidden = value === 'end-time';
|
|
@@ -105,19 +108,19 @@ const DateTimeRangePickerTabs = function DateTimeRangePickerTabs(inProps) {
|
|
|
105
108
|
}, [translations.endDate, translations.endTime, translations.startDate, translations.startTime, value]);
|
|
106
109
|
const handleRangePositionChange = useEventCallback(newTab => {
|
|
107
110
|
if (newTab.includes('start')) {
|
|
108
|
-
|
|
111
|
+
setRangePosition('start');
|
|
109
112
|
} else {
|
|
110
|
-
|
|
113
|
+
setRangePosition('end');
|
|
111
114
|
}
|
|
112
115
|
});
|
|
113
116
|
const changeToPreviousTab = useEventCallback(() => {
|
|
114
117
|
const previousTab = value == null ? tabOptions[0] : tabOptions[tabOptions.indexOf(value) - 1];
|
|
115
|
-
|
|
118
|
+
setView(tabToView(previousTab));
|
|
116
119
|
handleRangePositionChange(previousTab);
|
|
117
120
|
});
|
|
118
121
|
const changeToNextTab = useEventCallback(() => {
|
|
119
122
|
const nextTab = value == null ? tabOptions[0] : tabOptions[tabOptions.indexOf(value) + 1];
|
|
120
|
-
|
|
123
|
+
setView(tabToView(nextTab));
|
|
121
124
|
handleRangePositionChange(nextTab);
|
|
122
125
|
});
|
|
123
126
|
if (hidden) {
|
|
@@ -177,8 +180,6 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePickerTabs.propTypes = {
|
|
|
177
180
|
* @default `window.innerHeight < 667` for `DesktopDateTimeRangePicker` and `MobileDateTimeRangePicker`
|
|
178
181
|
*/
|
|
179
182
|
hidden: PropTypes.bool,
|
|
180
|
-
onRangePositionChange: PropTypes.func.isRequired,
|
|
181
|
-
rangePosition: PropTypes.oneOf(['end', 'start']).isRequired,
|
|
182
183
|
/**
|
|
183
184
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
184
185
|
*/
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["
|
|
3
|
+
const _excluded = ["viewRenderer", "value", "onChange", "defaultValue", "onViewChange", "views", "className"];
|
|
4
4
|
import { isInternalTimeView, useUtils } from '@mui/x-date-pickers/internals';
|
|
5
5
|
import { isRangeValid } from "../internals/utils/date-utils.js";
|
|
6
6
|
import { calculateRangeChange } from "../internals/utils/date-range-manager.js";
|
|
7
|
+
import { usePickerRangePositionContext } from "../hooks/index.js";
|
|
7
8
|
/**
|
|
8
9
|
* @ignore - internal component.
|
|
9
10
|
*/
|
|
10
|
-
function DateTimeRangePickerTimeWrapper(props
|
|
11
|
+
function DateTimeRangePickerTimeWrapper(props) {
|
|
11
12
|
const utils = useUtils();
|
|
12
13
|
const {
|
|
13
|
-
rangePosition,
|
|
14
|
-
onRangePositionChange,
|
|
15
14
|
viewRenderer,
|
|
16
15
|
value,
|
|
17
16
|
onChange,
|
|
@@ -20,6 +19,10 @@ function DateTimeRangePickerTimeWrapper(props, ref) {
|
|
|
20
19
|
views
|
|
21
20
|
} = props,
|
|
22
21
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
22
|
+
const {
|
|
23
|
+
rangePosition,
|
|
24
|
+
setRangePosition
|
|
25
|
+
} = usePickerRangePositionContext();
|
|
23
26
|
if (!viewRenderer) {
|
|
24
27
|
return null;
|
|
25
28
|
}
|
|
@@ -42,12 +45,11 @@ function DateTimeRangePickerTimeWrapper(props, ref) {
|
|
|
42
45
|
// reset view to the first time view and swap range position after selecting the last time view (start or end position)
|
|
43
46
|
if (selectedView === timeViews[timeViews.length - 1] && onViewChange) {
|
|
44
47
|
onViewChange(views[0]);
|
|
45
|
-
|
|
48
|
+
setRangePosition(rangePosition === 'start' ? 'end' : 'start');
|
|
46
49
|
}
|
|
47
50
|
onChange(newRange, isFullRangeSelected ? 'finish' : 'partial', selectedView);
|
|
48
51
|
};
|
|
49
52
|
return viewRenderer(_extends({}, other, {
|
|
50
|
-
ref,
|
|
51
53
|
views,
|
|
52
54
|
onViewChange,
|
|
53
55
|
value: currentValue,
|
|
@@ -2,7 +2,7 @@
|
|
|
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 = ["
|
|
5
|
+
const _excluded = ["className", "classes", "classes", "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';
|
|
@@ -13,6 +13,7 @@ import { usePickerContext, usePickerTranslations } from '@mui/x-date-pickers/hoo
|
|
|
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";
|
|
16
|
+
import { usePickerRangePositionContext } from "../hooks/index.js";
|
|
16
17
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
18
|
const useUtilityClasses = classes => {
|
|
18
19
|
const slots = {
|
|
@@ -50,13 +51,8 @@ const DateTimeRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateTi
|
|
|
50
51
|
});
|
|
51
52
|
const utils = useUtils();
|
|
52
53
|
const {
|
|
53
|
-
value: [start, end],
|
|
54
|
-
rangePosition,
|
|
55
|
-
onRangePositionChange,
|
|
56
54
|
className,
|
|
57
55
|
classes: classesProp,
|
|
58
|
-
onChange,
|
|
59
|
-
isLandscape,
|
|
60
56
|
ampm,
|
|
61
57
|
hidden,
|
|
62
58
|
toolbarFormat,
|
|
@@ -66,17 +62,22 @@ const DateTimeRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateTi
|
|
|
66
62
|
} = props,
|
|
67
63
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
68
64
|
const {
|
|
65
|
+
value,
|
|
66
|
+
setValue,
|
|
69
67
|
disabled,
|
|
70
68
|
readOnly,
|
|
71
69
|
view,
|
|
72
|
-
|
|
70
|
+
setView,
|
|
73
71
|
views
|
|
74
72
|
} = usePickerContext();
|
|
75
73
|
const translations = usePickerTranslations();
|
|
76
74
|
const ownerState = useToolbarOwnerState();
|
|
75
|
+
const {
|
|
76
|
+
rangePosition,
|
|
77
|
+
setRangePosition
|
|
78
|
+
} = usePickerRangePositionContext();
|
|
77
79
|
const classes = useUtilityClasses(classesProp);
|
|
78
80
|
const commonToolbarProps = {
|
|
79
|
-
isLandscape,
|
|
80
81
|
views,
|
|
81
82
|
ampm,
|
|
82
83
|
disabled,
|
|
@@ -85,52 +86,58 @@ const DateTimeRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateTi
|
|
|
85
86
|
toolbarFormat,
|
|
86
87
|
toolbarPlaceholder
|
|
87
88
|
};
|
|
88
|
-
const
|
|
89
|
+
const wrappedSetValue = React.useCallback(newDate => {
|
|
89
90
|
const {
|
|
90
91
|
nextSelection,
|
|
91
92
|
newRange
|
|
92
93
|
} = calculateRangeChange({
|
|
93
94
|
newDate,
|
|
94
95
|
utils,
|
|
95
|
-
range:
|
|
96
|
+
range: value,
|
|
96
97
|
rangePosition,
|
|
97
98
|
allowRangeFlip: true
|
|
98
99
|
});
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
setRangePosition(nextSelection);
|
|
101
|
+
setValue(newRange, {
|
|
102
|
+
changeImportance: 'set'
|
|
103
|
+
});
|
|
104
|
+
}, [setValue, setRangePosition, value, rangePosition, utils]);
|
|
102
105
|
const startOverrides = React.useMemo(() => {
|
|
103
106
|
const handleStartRangeViewChange = newView => {
|
|
104
107
|
if (newView === 'year' || newView === 'month') {
|
|
105
108
|
return;
|
|
106
109
|
}
|
|
107
110
|
if (rangePosition !== 'start') {
|
|
108
|
-
|
|
111
|
+
setRangePosition('start');
|
|
109
112
|
}
|
|
110
|
-
|
|
113
|
+
setView(newView);
|
|
111
114
|
};
|
|
112
115
|
return {
|
|
116
|
+
value: value[0],
|
|
117
|
+
setValue: wrappedSetValue,
|
|
113
118
|
forceDesktopVariant: true,
|
|
114
|
-
|
|
119
|
+
setView: handleStartRangeViewChange,
|
|
115
120
|
view: rangePosition === 'start' ? view : null
|
|
116
121
|
};
|
|
117
|
-
}, [rangePosition, view,
|
|
122
|
+
}, [value, wrappedSetValue, rangePosition, view, setRangePosition, setView]);
|
|
118
123
|
const endOverrides = React.useMemo(() => {
|
|
119
124
|
const handleEndRangeViewChange = newView => {
|
|
120
125
|
if (newView === 'year' || newView === 'month') {
|
|
121
126
|
return;
|
|
122
127
|
}
|
|
123
128
|
if (rangePosition !== 'end') {
|
|
124
|
-
|
|
129
|
+
setRangePosition('end');
|
|
125
130
|
}
|
|
126
|
-
|
|
131
|
+
setView(newView);
|
|
127
132
|
};
|
|
128
133
|
return {
|
|
134
|
+
value: value[1],
|
|
135
|
+
setValue: wrappedSetValue,
|
|
129
136
|
forceDesktopVariant: true,
|
|
130
|
-
|
|
137
|
+
setView: handleEndRangeViewChange,
|
|
131
138
|
view: rangePosition === 'end' ? view : null
|
|
132
139
|
};
|
|
133
|
-
}, [rangePosition, view,
|
|
140
|
+
}, [value, wrappedSetValue, rangePosition, view, setRangePosition, setView]);
|
|
134
141
|
if (hidden) {
|
|
135
142
|
return null;
|
|
136
143
|
}
|
|
@@ -143,21 +150,17 @@ const DateTimeRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateTi
|
|
|
143
150
|
children: [/*#__PURE__*/_jsx(DateTimePickerToolbarOverrideContext.Provider, {
|
|
144
151
|
value: startOverrides,
|
|
145
152
|
children: /*#__PURE__*/_jsx(DateTimeRangePickerToolbarStart, _extends({
|
|
146
|
-
value: start,
|
|
147
153
|
toolbarTitle: translations.start,
|
|
148
154
|
ownerState: ownerState,
|
|
149
155
|
className: classes.startToolbar,
|
|
150
|
-
onChange: handleOnChange,
|
|
151
156
|
titleId: titleId ? `${titleId}-start-toolbar` : undefined
|
|
152
157
|
}, commonToolbarProps))
|
|
153
158
|
}), /*#__PURE__*/_jsx(DateTimePickerToolbarOverrideContext.Provider, {
|
|
154
159
|
value: endOverrides,
|
|
155
160
|
children: /*#__PURE__*/_jsx(DateTimeRangePickerToolbarEnd, _extends({
|
|
156
|
-
value: end,
|
|
157
161
|
toolbarTitle: translations.end,
|
|
158
162
|
ownerState: ownerState,
|
|
159
163
|
className: classes.endToolbar,
|
|
160
|
-
onChange: handleOnChange,
|
|
161
164
|
titleId: titleId ? `${titleId}-end-toolbar` : undefined
|
|
162
165
|
}, commonToolbarProps))
|
|
163
166
|
})]
|
|
@@ -179,10 +182,6 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePickerToolbar.propTypes = {
|
|
|
179
182
|
* @default `true` for Desktop, `false` for Mobile.
|
|
180
183
|
*/
|
|
181
184
|
hidden: PropTypes.bool,
|
|
182
|
-
isLandscape: PropTypes.bool.isRequired,
|
|
183
|
-
onChange: PropTypes.func.isRequired,
|
|
184
|
-
onRangePositionChange: PropTypes.func.isRequired,
|
|
185
|
-
rangePosition: PropTypes.oneOf(['end', 'start']).isRequired,
|
|
186
185
|
/**
|
|
187
186
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
188
187
|
*/
|
|
@@ -196,7 +195,6 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePickerToolbar.propTypes = {
|
|
|
196
195
|
* Toolbar value placeholder—it is displayed when the value is empty.
|
|
197
196
|
* @default "––"
|
|
198
197
|
*/
|
|
199
|
-
toolbarPlaceholder: PropTypes.node
|
|
200
|
-
value: PropTypes.arrayOf(PropTypes.object).isRequired
|
|
198
|
+
toolbarPlaceholder: PropTypes.node
|
|
201
199
|
} : void 0;
|
|
202
200
|
export { DateTimeRangePickerToolbar };
|
|
@@ -13,6 +13,8 @@ import { renderDateRangeViewCalendar } from "../dateRangeViewRenderers/index.js"
|
|
|
13
13
|
import { MultiInputDateRangeField } from "../MultiInputDateRangeField/index.js";
|
|
14
14
|
import { useDesktopRangePicker } from "../internals/hooks/useDesktopRangePicker/index.js";
|
|
15
15
|
import { validateDateRange } from "../validation/index.js";
|
|
16
|
+
const emptyActions = [];
|
|
17
|
+
|
|
16
18
|
/**
|
|
17
19
|
* Demos:
|
|
18
20
|
*
|
|
@@ -32,6 +34,7 @@ const DesktopDateRangePicker = /*#__PURE__*/React.forwardRef(function DesktopDat
|
|
|
32
34
|
day: renderDateRangeViewCalendar
|
|
33
35
|
}, defaultizedProps.viewRenderers);
|
|
34
36
|
const props = _extends({}, defaultizedProps, {
|
|
37
|
+
closeOnSelect: defaultizedProps.closeOnSelect ?? true,
|
|
35
38
|
viewRenderers,
|
|
36
39
|
format: utils.formats.keyboardDate,
|
|
37
40
|
calendars: defaultizedProps.calendars ?? 2,
|
|
@@ -46,7 +49,10 @@ const DesktopDateRangePicker = /*#__PURE__*/React.forwardRef(function DesktopDat
|
|
|
46
49
|
}),
|
|
47
50
|
toolbar: _extends({
|
|
48
51
|
hidden: true
|
|
49
|
-
}, defaultizedProps.slotProps?.toolbar)
|
|
52
|
+
}, defaultizedProps.slotProps?.toolbar),
|
|
53
|
+
actionBar: ownerState => _extends({
|
|
54
|
+
actions: emptyActions
|
|
55
|
+
}, resolveComponentProps(defaultizedProps.slotProps?.actionBar, ownerState))
|
|
50
56
|
})
|
|
51
57
|
});
|
|
52
58
|
const {
|
|
@@ -78,8 +84,8 @@ DesktopDateRangePicker.propTypes = {
|
|
|
78
84
|
calendars: PropTypes.oneOf([1, 2, 3]),
|
|
79
85
|
className: PropTypes.string,
|
|
80
86
|
/**
|
|
81
|
-
* If `true`, the
|
|
82
|
-
* @default
|
|
87
|
+
* If `true`, the Picker will close after submitting the full date.
|
|
88
|
+
* @default true
|
|
83
89
|
*/
|
|
84
90
|
closeOnSelect: PropTypes.bool,
|
|
85
91
|
/**
|
|
@@ -2,7 +2,7 @@
|
|
|
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 = ["openTo"
|
|
5
|
+
const _excluded = ["openTo"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { isDatePickerView, isInternalTimeView, resolveDateTimeFormat, useUtils } from '@mui/x-date-pickers/internals';
|
|
@@ -22,15 +22,22 @@ import { useDateTimeRangePickerDefaultizedProps } from "../DateTimeRangePicker/s
|
|
|
22
22
|
import { MultiInputDateTimeRangeField } from "../MultiInputDateTimeRangeField/index.js";
|
|
23
23
|
import { DateTimeRangePickerTimeWrapper } from "../DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js";
|
|
24
24
|
import { RANGE_VIEW_HEIGHT } from "../internals/constants/dimensions.js";
|
|
25
|
+
import { usePickerRangePositionContext } from "../hooks/index.js";
|
|
25
26
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
26
|
-
const rendererInterceptor = function
|
|
27
|
+
const rendererInterceptor = function RendererInterceptor(props) {
|
|
27
28
|
const {
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
viewRenderers,
|
|
30
|
+
popperView,
|
|
31
|
+
rendererProps
|
|
32
|
+
} = props;
|
|
33
|
+
const {
|
|
34
|
+
openTo
|
|
30
35
|
} = rendererProps,
|
|
31
36
|
otherProps = _objectWithoutPropertiesLoose(rendererProps, _excluded);
|
|
37
|
+
const {
|
|
38
|
+
rangePosition
|
|
39
|
+
} = usePickerRangePositionContext();
|
|
32
40
|
const finalProps = _extends({}, otherProps, {
|
|
33
|
-
rangePosition,
|
|
34
41
|
focusedView: null,
|
|
35
42
|
sx: [{
|
|
36
43
|
[`&.${multiSectionDigitalClockClasses.root}`]: {
|
|
@@ -43,7 +50,7 @@ const rendererInterceptor = function rendererInterceptor(inViewRenderers, popper
|
|
|
43
50
|
});
|
|
44
51
|
const isTimeViewActive = isInternalTimeView(popperView);
|
|
45
52
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
46
|
-
children: [
|
|
53
|
+
children: [viewRenderers.day?.(_extends({}, rendererProps, {
|
|
47
54
|
availableRangePositions: [rangePosition],
|
|
48
55
|
view: !isTimeViewActive ? popperView : 'day',
|
|
49
56
|
views: rendererProps.views.filter(isDatePickerView),
|
|
@@ -59,7 +66,7 @@ const rendererInterceptor = function rendererInterceptor(inViewRenderers, popper
|
|
|
59
66
|
view: isTimeViewActive ? popperView : 'hours',
|
|
60
67
|
views: finalProps.views.filter(isInternalTimeView),
|
|
61
68
|
openTo: isInternalTimeView(openTo) ? openTo : 'hours',
|
|
62
|
-
viewRenderer:
|
|
69
|
+
viewRenderer: viewRenderers[isTimeViewActive ? popperView : 'hours'],
|
|
63
70
|
sx: [{
|
|
64
71
|
gridColumn: 3
|
|
65
72
|
}, ...finalProps.sx]
|
|
@@ -92,7 +99,6 @@ const DesktopDateTimeRangePicker = /*#__PURE__*/React.forwardRef(function Deskto
|
|
|
92
99
|
// Need to avoid adding the `meridiem` view when unexpected renderer is specified
|
|
93
100
|
const shouldHoursRendererContainMeridiemView = viewRenderers.hours?.name === renderMultiSectionDigitalClockTimeView.name;
|
|
94
101
|
const views = !shouldHoursRendererContainMeridiemView ? defaultizedProps.views.filter(view => view !== 'meridiem') : defaultizedProps.views;
|
|
95
|
-
const actionBarActions = defaultizedProps.shouldRenderTimeInASingleColumn ? [] : ['accept'];
|
|
96
102
|
const props = _extends({}, defaultizedProps, {
|
|
97
103
|
views,
|
|
98
104
|
viewRenderers,
|
|
@@ -113,10 +119,7 @@ const DesktopDateTimeRangePicker = /*#__PURE__*/React.forwardRef(function Deskto
|
|
|
113
119
|
}, defaultizedProps.slotProps?.tabs),
|
|
114
120
|
toolbar: _extends({
|
|
115
121
|
hidden: true
|
|
116
|
-
}, defaultizedProps.slotProps?.toolbar)
|
|
117
|
-
actionBar: ownerState => _extends({
|
|
118
|
-
actions: actionBarActions
|
|
119
|
-
}, resolveComponentProps(defaultizedProps.slotProps?.actionBar, ownerState))
|
|
122
|
+
}, defaultizedProps.slotProps?.toolbar)
|
|
120
123
|
})
|
|
121
124
|
});
|
|
122
125
|
const {
|
|
@@ -154,8 +157,8 @@ DesktopDateTimeRangePicker.propTypes = {
|
|
|
154
157
|
calendars: PropTypes.oneOf([1, 2, 3]),
|
|
155
158
|
className: PropTypes.string,
|
|
156
159
|
/**
|
|
157
|
-
* If `true`, the
|
|
158
|
-
* @default
|
|
160
|
+
* If `true`, the Picker will close after submitting the full date.
|
|
161
|
+
* @default false
|
|
159
162
|
*/
|
|
160
163
|
closeOnSelect: PropTypes.bool,
|
|
161
164
|
/**
|
|
@@ -74,8 +74,8 @@ MobileDateRangePicker.propTypes = {
|
|
|
74
74
|
autoFocus: PropTypes.bool,
|
|
75
75
|
className: PropTypes.string,
|
|
76
76
|
/**
|
|
77
|
-
* If `true`, the
|
|
78
|
-
* @default
|
|
77
|
+
* If `true`, the Picker will close after submitting the full date.
|
|
78
|
+
* @default false
|
|
79
79
|
*/
|
|
80
80
|
closeOnSelect: PropTypes.bool,
|
|
81
81
|
/**
|
|
@@ -2,7 +2,7 @@
|
|
|
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 = ["view", "openTo"
|
|
5
|
+
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';
|
|
@@ -20,16 +20,23 @@ import { useDateTimeRangePickerDefaultizedProps } from "../DateTimeRangePicker/s
|
|
|
20
20
|
import { MultiInputDateTimeRangeField } from "../MultiInputDateTimeRangeField/index.js";
|
|
21
21
|
import { DateTimeRangePickerTimeWrapper } from "../DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js";
|
|
22
22
|
import { RANGE_VIEW_HEIGHT } from "../internals/constants/dimensions.js";
|
|
23
|
+
import { usePickerRangePositionContext } from "../hooks/index.js";
|
|
23
24
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
-
const rendererInterceptor = function
|
|
25
|
+
const rendererInterceptor = function RendererInterceptor(props) {
|
|
26
|
+
const {
|
|
27
|
+
viewRenderers,
|
|
28
|
+
popperView,
|
|
29
|
+
rendererProps
|
|
30
|
+
} = props;
|
|
31
|
+
const {
|
|
32
|
+
rangePosition
|
|
33
|
+
} = usePickerRangePositionContext();
|
|
25
34
|
const {
|
|
26
35
|
view,
|
|
27
|
-
openTo
|
|
28
|
-
rangePosition
|
|
36
|
+
openTo
|
|
29
37
|
} = rendererProps,
|
|
30
38
|
otherRendererProps = _objectWithoutPropertiesLoose(rendererProps, _excluded);
|
|
31
39
|
const finalProps = _extends({}, otherRendererProps, {
|
|
32
|
-
rangePosition,
|
|
33
40
|
focusedView: null,
|
|
34
41
|
sx: [{
|
|
35
42
|
width: DIALOG_WIDTH,
|
|
@@ -53,7 +60,7 @@ const rendererInterceptor = function rendererInterceptor(inViewRenderers, popper
|
|
|
53
60
|
}]
|
|
54
61
|
});
|
|
55
62
|
const isTimeView = isInternalTimeView(popperView);
|
|
56
|
-
const viewRenderer =
|
|
63
|
+
const viewRenderer = viewRenderers[popperView];
|
|
57
64
|
if (!viewRenderer) {
|
|
58
65
|
return null;
|
|
59
66
|
}
|
|
@@ -148,8 +155,8 @@ MobileDateTimeRangePicker.propTypes = {
|
|
|
148
155
|
autoFocus: PropTypes.bool,
|
|
149
156
|
className: PropTypes.string,
|
|
150
157
|
/**
|
|
151
|
-
* If `true`, the
|
|
152
|
-
* @default
|
|
158
|
+
* If `true`, the Picker will close after submitting the full date.
|
|
159
|
+
* @default false
|
|
153
160
|
*/
|
|
154
161
|
closeOnSelect: PropTypes.bool,
|
|
155
162
|
/**
|