@mui/x-date-pickers-pro 7.0.0-beta.2 → 7.0.0-beta.4
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 +298 -23
- package/DateRangeCalendar/DateRangeCalendar.js +3 -1
- package/DateRangeCalendar/DateRangeCalendar.types.d.ts +3 -0
- package/DateRangePicker/DateRangePicker.d.ts +1 -1
- package/DateRangePicker/DateRangePicker.js +9 -9
- package/DateRangePicker/DateRangePicker.types.d.ts +3 -3
- package/DateRangePicker/DateRangePickerToolbar.d.ts +3 -0
- package/DateRangePicker/DateRangePickerToolbar.js +6 -0
- package/DateTimeRangePicker/DateTimeRangePicker.d.ts +1 -1
- package/DateTimeRangePicker/DateTimeRangePicker.js +11 -12
- package/DateTimeRangePicker/DateTimeRangePicker.types.d.ts +3 -3
- package/DateTimeRangePicker/DateTimeRangePickerTabs.js +7 -1
- package/DateTimeRangePicker/DateTimeRangePickerToolbar.d.ts +3 -0
- package/DateTimeRangePicker/DateTimeRangePickerToolbar.js +6 -0
- package/DesktopDateRangePicker/DesktopDateRangePicker.d.ts +1 -1
- package/DesktopDateRangePicker/DesktopDateRangePicker.js +9 -9
- package/DesktopDateRangePicker/DesktopDateRangePicker.types.d.ts +3 -3
- package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.d.ts +1 -1
- package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +11 -12
- package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.types.d.ts +3 -3
- package/MobileDateRangePicker/MobileDateRangePicker.d.ts +1 -1
- package/MobileDateRangePicker/MobileDateRangePicker.js +9 -9
- package/MobileDateRangePicker/MobileDateRangePicker.types.d.ts +3 -3
- package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.d.ts +1 -1
- package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +11 -12
- package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.types.d.ts +3 -3
- package/MultiInputDateRangeField/MultiInputDateRangeField.d.ts +1 -1
- package/MultiInputDateRangeField/MultiInputDateRangeField.js +17 -19
- package/MultiInputDateRangeField/MultiInputDateRangeField.types.d.ts +11 -14
- package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.d.ts +1 -1
- package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +17 -19
- package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.d.ts +12 -16
- package/MultiInputTimeRangeField/MultiInputTimeRangeField.d.ts +1 -1
- package/MultiInputTimeRangeField/MultiInputTimeRangeField.js +17 -19
- package/MultiInputTimeRangeField/MultiInputTimeRangeField.types.d.ts +12 -16
- package/SingleInputDateRangeField/SingleInputDateRangeField.d.ts +2 -2
- package/SingleInputDateRangeField/SingleInputDateRangeField.js +12 -10
- package/SingleInputDateRangeField/SingleInputDateRangeField.types.d.ts +11 -14
- package/SingleInputDateRangeField/index.d.ts +1 -1
- package/SingleInputDateRangeField/useSingleInputDateRangeField.d.ts +2 -3
- package/SingleInputDateRangeField/useSingleInputDateRangeField.js +2 -15
- package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.d.ts +2 -2
- package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +12 -10
- package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.types.d.ts +12 -15
- package/SingleInputDateTimeRangeField/index.d.ts +1 -1
- package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.d.ts +2 -3
- package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +2 -20
- package/SingleInputTimeRangeField/SingleInputTimeRangeField.d.ts +2 -2
- package/SingleInputTimeRangeField/SingleInputTimeRangeField.js +11 -9
- package/SingleInputTimeRangeField/SingleInputTimeRangeField.types.d.ts +12 -15
- package/SingleInputTimeRangeField/index.d.ts +1 -1
- package/SingleInputTimeRangeField/useSingleInputTimeRangeField.d.ts +2 -3
- package/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +2 -14
- package/StaticDateRangePicker/StaticDateRangePicker.js +0 -1
- package/index.d.ts +0 -1
- package/index.js +2 -1
- package/internals/hooks/models/useRangePicker.d.ts +5 -5
- package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.d.ts +1 -1
- package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +16 -7
- package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.d.ts +5 -5
- package/internals/hooks/useEnrichedRangePickerFieldProps.d.ts +15 -15
- package/internals/hooks/useEnrichedRangePickerFieldProps.js +37 -40
- package/internals/hooks/useMobileRangePicker/useMobileRangePicker.d.ts +1 -1
- package/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +17 -8
- package/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.d.ts +5 -5
- package/internals/hooks/useMultiInputFieldSelectedSections.d.ts +21 -0
- package/internals/hooks/useMultiInputFieldSelectedSections.js +43 -0
- package/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.d.ts +1 -1
- package/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +17 -12
- package/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.d.ts +2 -3
- package/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +23 -31
- package/internals/hooks/useMultiInputRangeField/useMultiInputRangeField.types.d.ts +4 -4
- package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.d.ts +2 -3
- package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +23 -25
- package/internals/hooks/useRangePosition.d.ts +2 -4
- package/internals/hooks/useRangePosition.js +3 -6
- package/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +1 -0
- package/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.d.ts +1 -2
- package/internals/models/dateRange.d.ts +3 -15
- package/internals/models/dateTimeRange.d.ts +4 -6
- package/internals/models/index.d.ts +0 -1
- package/internals/models/index.js +0 -1
- package/internals/models/timeRange.d.ts +3 -6
- package/internals/utils/date-fields-utils.d.ts +1 -5
- package/internals/utils/releaseInfo.js +1 -1
- package/internals/utils/valueManagers.d.ts +1 -2
- package/internals/utils/valueManagers.js +11 -6
- package/models/fields.d.ts +69 -0
- package/models/index.d.ts +1 -0
- package/models/index.js +1 -0
- package/modern/DateRangeCalendar/DateRangeCalendar.js +3 -1
- package/modern/DateRangePicker/DateRangePicker.js +9 -9
- package/modern/DateRangePicker/DateRangePickerToolbar.js +6 -0
- package/modern/DateTimeRangePicker/DateTimeRangePicker.js +11 -12
- package/modern/DateTimeRangePicker/DateTimeRangePickerTabs.js +7 -1
- package/modern/DateTimeRangePicker/DateTimeRangePickerToolbar.js +6 -0
- package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +9 -9
- package/modern/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +11 -12
- package/modern/MobileDateRangePicker/MobileDateRangePicker.js +9 -9
- package/modern/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +11 -12
- package/modern/MultiInputDateRangeField/MultiInputDateRangeField.js +17 -19
- package/modern/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +17 -19
- package/modern/MultiInputTimeRangeField/MultiInputTimeRangeField.js +17 -19
- package/modern/SingleInputDateRangeField/SingleInputDateRangeField.js +12 -10
- package/modern/SingleInputDateRangeField/useSingleInputDateRangeField.js +2 -14
- package/modern/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +12 -10
- package/modern/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +2 -19
- package/modern/SingleInputTimeRangeField/SingleInputTimeRangeField.js +11 -9
- package/modern/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +2 -13
- package/modern/StaticDateRangePicker/StaticDateRangePicker.js +0 -1
- package/modern/index.js +2 -1
- package/modern/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +16 -7
- package/modern/internals/hooks/useEnrichedRangePickerFieldProps.js +34 -37
- package/modern/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +17 -8
- package/modern/internals/hooks/useMultiInputFieldSelectedSections.js +40 -0
- package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +17 -12
- package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +23 -30
- package/modern/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +23 -24
- package/modern/internals/hooks/useRangePosition.js +3 -6
- package/modern/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +1 -0
- package/modern/internals/models/index.js +0 -1
- package/modern/internals/utils/releaseInfo.js +1 -1
- package/modern/internals/utils/valueManagers.js +11 -6
- package/modern/models/index.js +1 -0
- package/node/DateRangeCalendar/DateRangeCalendar.js +3 -1
- package/node/DateRangePicker/DateRangePicker.js +9 -9
- package/node/DateRangePicker/DateRangePickerToolbar.js +6 -0
- package/node/DateTimeRangePicker/DateTimeRangePicker.js +11 -12
- package/node/DateTimeRangePicker/DateTimeRangePickerTabs.js +7 -1
- package/node/DateTimeRangePicker/DateTimeRangePickerToolbar.js +6 -0
- package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +9 -9
- package/node/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +11 -12
- package/node/MobileDateRangePicker/MobileDateRangePicker.js +9 -9
- package/node/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +13 -14
- package/node/MultiInputDateRangeField/MultiInputDateRangeField.js +17 -19
- package/node/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +17 -19
- package/node/MultiInputTimeRangeField/MultiInputTimeRangeField.js +17 -19
- package/node/SingleInputDateRangeField/SingleInputDateRangeField.js +12 -10
- package/node/SingleInputDateRangeField/useSingleInputDateRangeField.js +2 -16
- package/node/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +15 -13
- package/node/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +2 -21
- package/node/SingleInputTimeRangeField/SingleInputTimeRangeField.js +11 -9
- package/node/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +2 -15
- package/node/StaticDateRangePicker/StaticDateRangePicker.js +0 -1
- package/node/index.js +1 -1
- package/node/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +16 -7
- package/node/internals/hooks/useEnrichedRangePickerFieldProps.js +33 -36
- package/node/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +17 -8
- package/node/internals/hooks/useMultiInputFieldSelectedSections.js +50 -0
- package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +16 -11
- package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +23 -31
- package/node/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +23 -25
- package/node/internals/hooks/useRangePosition.js +3 -8
- package/node/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +1 -0
- package/node/internals/models/index.js +0 -11
- package/node/internals/utils/releaseInfo.js +1 -1
- package/node/internals/utils/valueManagers.js +10 -5
- package/node/models/index.js +11 -0
- package/package.json +5 -5
- package/themeAugmentation/props.d.ts +12 -12
- package/internals/models/fields.d.ts +0 -49
- package/legacy/AdapterDateFns/index.js +0 -1
- package/legacy/AdapterDateFnsJalali/index.js +0 -1
- package/legacy/AdapterDateFnsV3/index.js +0 -1
- package/legacy/AdapterDayjs/index.js +0 -1
- package/legacy/AdapterLuxon/index.js +0 -1
- package/legacy/AdapterMoment/index.js +0 -1
- package/legacy/AdapterMomentHijri/index.js +0 -1
- package/legacy/AdapterMomentJalaali/index.js +0 -1
- package/legacy/DateRangeCalendar/DateRangeCalendar.js +0 -764
- package/legacy/DateRangeCalendar/DateRangeCalendar.types.js +0 -1
- package/legacy/DateRangeCalendar/dateRangeCalendarClasses.js +0 -5
- package/legacy/DateRangeCalendar/index.js +0 -2
- package/legacy/DateRangeCalendar/useDragRange.js +0 -258
- package/legacy/DateRangePicker/DateRangePicker.js +0 -334
- package/legacy/DateRangePicker/DateRangePicker.types.js +0 -1
- package/legacy/DateRangePicker/DateRangePickerToolbar.js +0 -127
- package/legacy/DateRangePicker/dateRangePickerToolbarClasses.js +0 -5
- package/legacy/DateRangePicker/index.js +0 -3
- package/legacy/DateRangePicker/shared.js +0 -33
- package/legacy/DateRangePickerDay/DateRangePickerDay.js +0 -366
- package/legacy/DateRangePickerDay/dateRangePickerDayClasses.js +0 -5
- package/legacy/DateRangePickerDay/index.js +0 -2
- package/legacy/DateTimeRangePicker/DateTimeRangePicker.js +0 -413
- package/legacy/DateTimeRangePicker/DateTimeRangePicker.types.js +0 -1
- package/legacy/DateTimeRangePicker/DateTimeRangePickerTabs.js +0 -191
- package/legacy/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +0 -57
- package/legacy/DateTimeRangePicker/DateTimeRangePickerToolbar.js +0 -184
- package/legacy/DateTimeRangePicker/dateTimeRangePickerTabsClasses.js +0 -6
- package/legacy/DateTimeRangePicker/dateTimeRangePickerToolbarClasses.js +0 -5
- package/legacy/DateTimeRangePicker/index.js +0 -5
- package/legacy/DateTimeRangePicker/shared.js +0 -54
- package/legacy/DesktopDateRangePicker/DesktopDateRangePicker.js +0 -343
- package/legacy/DesktopDateRangePicker/DesktopDateRangePicker.types.js +0 -1
- package/legacy/DesktopDateRangePicker/index.js +0 -1
- package/legacy/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +0 -491
- package/legacy/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.types.js +0 -1
- package/legacy/DesktopDateTimeRangePicker/DesktopDateTimeRangePickerLayout.js +0 -48
- package/legacy/DesktopDateTimeRangePicker/index.js +0 -1
- package/legacy/MobileDateRangePicker/MobileDateRangePicker.js +0 -339
- package/legacy/MobileDateRangePicker/MobileDateRangePicker.types.js +0 -1
- package/legacy/MobileDateRangePicker/index.js +0 -1
- package/legacy/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +0 -484
- package/legacy/MobileDateTimeRangePicker/MobileDateTimeRangePicker.types.js +0 -1
- package/legacy/MobileDateTimeRangePicker/index.js +0 -1
- package/legacy/MultiInputDateRangeField/MultiInputDateRangeField.js +0 -316
- package/legacy/MultiInputDateRangeField/MultiInputDateRangeField.types.js +0 -1
- package/legacy/MultiInputDateRangeField/index.js +0 -2
- package/legacy/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +0 -357
- package/legacy/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.js +0 -1
- package/legacy/MultiInputDateTimeRangeField/index.js +0 -2
- package/legacy/MultiInputTimeRangeField/MultiInputTimeRangeField.js +0 -330
- package/legacy/MultiInputTimeRangeField/MultiInputTimeRangeField.types.js +0 -1
- package/legacy/MultiInputTimeRangeField/index.js +0 -2
- package/legacy/SingleInputDateRangeField/SingleInputDateRangeField.js +0 -307
- package/legacy/SingleInputDateRangeField/SingleInputDateRangeField.types.js +0 -1
- package/legacy/SingleInputDateRangeField/index.js +0 -2
- package/legacy/SingleInputDateRangeField/useSingleInputDateRangeField.js +0 -30
- package/legacy/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +0 -348
- package/legacy/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.types.js +0 -1
- package/legacy/SingleInputDateTimeRangeField/index.js +0 -2
- package/legacy/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +0 -35
- package/legacy/SingleInputTimeRangeField/SingleInputTimeRangeField.js +0 -321
- package/legacy/SingleInputTimeRangeField/SingleInputTimeRangeField.types.js +0 -1
- package/legacy/SingleInputTimeRangeField/index.js +0 -2
- package/legacy/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +0 -29
- package/legacy/StaticDateRangePicker/StaticDateRangePicker.js +0 -276
- package/legacy/StaticDateRangePicker/StaticDateRangePicker.types.js +0 -1
- package/legacy/StaticDateRangePicker/index.js +0 -1
- package/legacy/dateRangeViewRenderers/dateRangeViewRenderers.js +0 -87
- package/legacy/dateRangeViewRenderers/index.js +0 -1
- package/legacy/index.js +0 -52
- package/legacy/internals/constants/dimensions.js +0 -5
- package/legacy/internals/hooks/models/index.js +0 -1
- package/legacy/internals/hooks/models/useRangePicker.js +0 -1
- package/legacy/internals/hooks/useDesktopRangePicker/index.js +0 -1
- package/legacy/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +0 -154
- package/legacy/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.js +0 -1
- package/legacy/internals/hooks/useEnrichedRangePickerFieldProps.js +0 -258
- package/legacy/internals/hooks/useMobileRangePicker/index.js +0 -1
- package/legacy/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +0 -144
- package/legacy/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.js +0 -1
- package/legacy/internals/hooks/useMultiInputRangeField/shared.js +0 -9
- package/legacy/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +0 -102
- package/legacy/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +0 -115
- package/legacy/internals/hooks/useMultiInputRangeField/useMultiInputRangeField.types.js +0 -1
- package/legacy/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +0 -109
- package/legacy/internals/hooks/useRangePosition.js +0 -39
- package/legacy/internals/hooks/useStaticRangePicker/index.js +0 -1
- package/legacy/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +0 -76
- package/legacy/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.js +0 -1
- package/legacy/internals/models/dateRange.js +0 -1
- package/legacy/internals/models/dateTimeRange.js +0 -1
- package/legacy/internals/models/index.js +0 -5
- package/legacy/internals/models/rangePickerProps.js +0 -1
- package/legacy/internals/models/timeRange.js +0 -1
- package/legacy/internals/utils/date-fields-utils.js +0 -26
- package/legacy/internals/utils/date-range-manager.js +0 -65
- package/legacy/internals/utils/date-utils.js +0 -12
- package/legacy/internals/utils/releaseInfo.js +0 -13
- package/legacy/internals/utils/validation/validateDateRange.js +0 -45
- package/legacy/internals/utils/validation/validateDateTimeRange.js +0 -45
- package/legacy/internals/utils/validation/validateTimeRange.js +0 -32
- package/legacy/internals/utils/valueManagers.js +0 -135
- package/legacy/locales/index.js +0 -1
- package/legacy/models/index.js +0 -3
- package/legacy/models/multiInputRangeFieldClasses.js +0 -1
- package/legacy/models/range.js +0 -1
- package/legacy/models/validation.js +0 -1
- package/legacy/themeAugmentation/index.js +0 -4
- package/modern/internals/models/fields.js +0 -1
- /package/{internals/models → models}/fields.js +0 -0
- /package/{legacy/internals → modern}/models/fields.js +0 -0
- /package/node/{internals/models → models}/fields.js +0 -0
|
@@ -2,6 +2,6 @@ import * as React from 'react';
|
|
|
2
2
|
import { DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals';
|
|
3
3
|
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
4
4
|
import { UseMobileRangePickerParams, UseMobileRangePickerProps } from './useMobileRangePicker.types';
|
|
5
|
-
export declare const useMobileRangePicker: <TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseMobileRangePickerProps<TDate, TView, any, TExternalProps>>({ props, ...pickerParams }: UseMobileRangePickerParams<TDate, TView, TExternalProps>) => {
|
|
5
|
+
export declare const useMobileRangePicker: <TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TExternalProps extends UseMobileRangePickerProps<TDate, TView, TEnableAccessibleFieldDOMStructure, any, TExternalProps>>({ props, ...pickerParams }: UseMobileRangePickerParams<TDate, TView, TEnableAccessibleFieldDOMStructure, TExternalProps>) => {
|
|
6
6
|
renderPicker: () => React.JSX.Element;
|
|
7
7
|
};
|
|
@@ -28,6 +28,9 @@ export const useMobileRangePicker = _ref => {
|
|
|
28
28
|
sx,
|
|
29
29
|
format,
|
|
30
30
|
formatDensity,
|
|
31
|
+
enableAccessibleFieldDOMStructure,
|
|
32
|
+
selectedSections,
|
|
33
|
+
onSelectedSectionsChange,
|
|
31
34
|
timezone,
|
|
32
35
|
label,
|
|
33
36
|
inputRef,
|
|
@@ -37,11 +40,13 @@ export const useMobileRangePicker = _ref => {
|
|
|
37
40
|
disableOpenPicker,
|
|
38
41
|
localeText
|
|
39
42
|
} = props;
|
|
43
|
+
const startFieldRef = React.useRef(null);
|
|
44
|
+
const endFieldRef = React.useRef(null);
|
|
45
|
+
const fieldType = (_fieldType = slots.field.fieldType) != null ? _fieldType : 'multi-input';
|
|
40
46
|
const {
|
|
41
47
|
rangePosition,
|
|
42
|
-
onRangePositionChange
|
|
43
|
-
|
|
44
|
-
} = useRangePosition(props);
|
|
48
|
+
onRangePositionChange
|
|
49
|
+
} = useRangePosition(props, fieldType === 'single-input' ? startFieldRef : undefined);
|
|
45
50
|
const labelId = useId();
|
|
46
51
|
const contextLocaleText = useLocaleText();
|
|
47
52
|
const {
|
|
@@ -54,13 +59,13 @@ export const useMobileRangePicker = _ref => {
|
|
|
54
59
|
props,
|
|
55
60
|
wrapperVariant: 'mobile',
|
|
56
61
|
autoFocusView: true,
|
|
62
|
+
fieldRef: rangePosition === 'start' ? startFieldRef : endFieldRef,
|
|
57
63
|
additionalViewProps: {
|
|
58
64
|
rangePosition,
|
|
59
65
|
onRangePositionChange
|
|
60
66
|
}
|
|
61
67
|
}));
|
|
62
68
|
const Field = slots.field;
|
|
63
|
-
const fieldType = (_fieldType = Field.fieldType) != null ? _fieldType : 'multi-input';
|
|
64
69
|
const fieldProps = useSlotProps({
|
|
65
70
|
elementType: Field,
|
|
66
71
|
externalSlotProps: innerSlotProps == null ? void 0 : innerSlotProps.field,
|
|
@@ -71,11 +76,14 @@ export const useMobileRangePicker = _ref => {
|
|
|
71
76
|
sx,
|
|
72
77
|
format,
|
|
73
78
|
formatDensity,
|
|
79
|
+
enableAccessibleFieldDOMStructure,
|
|
80
|
+
selectedSections,
|
|
81
|
+
onSelectedSectionsChange,
|
|
74
82
|
timezone
|
|
75
|
-
},
|
|
83
|
+
}, inputRef ? {
|
|
76
84
|
inputRef,
|
|
77
85
|
name
|
|
78
|
-
}),
|
|
86
|
+
} : {}),
|
|
79
87
|
ownerState: props
|
|
80
88
|
});
|
|
81
89
|
const isToolbarHidden = (_innerSlotProps$toolb = innerSlotProps == null || (_innerSlotProps$toolb2 = innerSlotProps.toolbar) == null ? void 0 : _innerSlotProps$toolb2.hidden) != null ? _innerSlotProps$toolb : false;
|
|
@@ -91,10 +99,11 @@ export const useMobileRangePicker = _ref => {
|
|
|
91
99
|
localeText,
|
|
92
100
|
rangePosition,
|
|
93
101
|
onRangePositionChange,
|
|
94
|
-
singleInputFieldRef,
|
|
95
102
|
pickerSlots: slots,
|
|
96
103
|
pickerSlotProps: innerSlotProps,
|
|
97
|
-
fieldProps
|
|
104
|
+
fieldProps,
|
|
105
|
+
startFieldRef,
|
|
106
|
+
endFieldRef
|
|
98
107
|
});
|
|
99
108
|
const slotPropsForLayout = _extends({}, innerSlotProps, {
|
|
100
109
|
tabs: _extends({}, innerSlotProps == null ? void 0 : innerSlotProps.tabs, {
|
|
@@ -3,11 +3,11 @@ import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
|
3
3
|
import { RangeOnlyPickerProps, RangePickerAdditionalViewProps, UseRangePickerParams, UseRangePickerProps, UseRangePickerSlotProps, UseRangePickerSlots } from '../models/useRangePicker';
|
|
4
4
|
export interface UseMobileRangePickerSlots<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem> extends UseRangePickerSlots<TDate, TView>, PickersModalDialogSlots {
|
|
5
5
|
}
|
|
6
|
-
export interface UseMobileRangePickerSlotProps<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem> extends UseRangePickerSlotProps<TDate, TView>, PickersModalDialogSlotProps {
|
|
6
|
+
export interface UseMobileRangePickerSlotProps<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean> extends UseRangePickerSlotProps<TDate, TView, TEnableAccessibleFieldDOMStructure>, PickersModalDialogSlotProps {
|
|
7
7
|
}
|
|
8
|
-
export interface MobileRangeOnlyPickerProps
|
|
8
|
+
export interface MobileRangeOnlyPickerProps extends RangeOnlyPickerProps {
|
|
9
9
|
}
|
|
10
|
-
export interface UseMobileRangePickerProps<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TError, TExternalProps extends UsePickerViewsProps<any, any, TView, any, any>> extends UseRangePickerProps<TDate, TView, TError, TExternalProps, MobileRangePickerAdditionalViewProps> {
|
|
10
|
+
export interface UseMobileRangePickerProps<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TError, TExternalProps extends UsePickerViewsProps<any, any, TView, any, any>> extends UseRangePickerProps<TDate, TView, TError, TExternalProps, MobileRangePickerAdditionalViewProps> {
|
|
11
11
|
/**
|
|
12
12
|
* Overridable component slots.
|
|
13
13
|
* @default {}
|
|
@@ -17,9 +17,9 @@ export interface UseMobileRangePickerProps<TDate extends PickerValidDate, TView
|
|
|
17
17
|
* The props used for each component slot.
|
|
18
18
|
* @default {}
|
|
19
19
|
*/
|
|
20
|
-
slotProps?: UseMobileRangePickerSlotProps<TDate, TView>;
|
|
20
|
+
slotProps?: UseMobileRangePickerSlotProps<TDate, TView, TEnableAccessibleFieldDOMStructure>;
|
|
21
21
|
}
|
|
22
22
|
export interface MobileRangePickerAdditionalViewProps extends RangePickerAdditionalViewProps {
|
|
23
23
|
}
|
|
24
|
-
export interface UseMobileRangePickerParams<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseMobileRangePickerProps<TDate, TView, any, TExternalProps>> extends UseRangePickerParams<TDate, TView, TExternalProps, MobileRangePickerAdditionalViewProps> {
|
|
24
|
+
export interface UseMobileRangePickerParams<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TExternalProps extends UseMobileRangePickerProps<TDate, TView, TEnableAccessibleFieldDOMStructure, any, TExternalProps>> extends UseRangePickerParams<TDate, TView, TExternalProps, MobileRangePickerAdditionalViewProps> {
|
|
25
25
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { UseFieldInternalProps } from '@mui/x-date-pickers/internals';
|
|
3
|
+
import { FieldRef, FieldSelectedSections } from '@mui/x-date-pickers/models';
|
|
4
|
+
import { RangeFieldSection } from '../../models';
|
|
5
|
+
interface UseMultiInputFieldSelectedSectionsParams extends Pick<UseFieldInternalProps<any, any, RangeFieldSection, any, any>, 'selectedSections' | 'onSelectedSectionsChange'> {
|
|
6
|
+
unstableStartFieldRef?: React.Ref<FieldRef<RangeFieldSection>>;
|
|
7
|
+
unstableEndFieldRef?: React.Ref<FieldRef<RangeFieldSection>>;
|
|
8
|
+
}
|
|
9
|
+
export declare const useMultiInputFieldSelectedSections: (params: UseMultiInputFieldSelectedSectionsParams) => {
|
|
10
|
+
start: {
|
|
11
|
+
unstableFieldRef: React.Ref<FieldRef<RangeFieldSection>> | undefined;
|
|
12
|
+
selectedSections: FieldSelectedSections;
|
|
13
|
+
onSelectedSectionsChange: (newSelectedSections: FieldSelectedSections) => void;
|
|
14
|
+
};
|
|
15
|
+
end: {
|
|
16
|
+
unstableFieldRef: ((instance: FieldRef<RangeFieldSection> | null) => void) | null;
|
|
17
|
+
selectedSections: FieldSelectedSections;
|
|
18
|
+
onSelectedSectionsChange: (newSelectedSections: FieldSelectedSections) => void;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import useForkRef from '@mui/utils/useForkRef';
|
|
3
|
+
import useEventCallback from '@mui/utils/useEventCallback';
|
|
4
|
+
export const useMultiInputFieldSelectedSections = params => {
|
|
5
|
+
var _params$selectedSecti;
|
|
6
|
+
const unstableEndFieldRef = React.useRef(null);
|
|
7
|
+
const handleUnstableEndFieldRef = useForkRef(params.unstableEndFieldRef, unstableEndFieldRef);
|
|
8
|
+
const [startSelectedSection, setStartSelectedSection] = React.useState((_params$selectedSecti = params.selectedSections) != null ? _params$selectedSecti : null);
|
|
9
|
+
const [endSelectedSection, setEndSelectedSection] = React.useState(null);
|
|
10
|
+
const getActiveField = () => {
|
|
11
|
+
if (unstableEndFieldRef.current && unstableEndFieldRef.current.isFieldFocused()) {
|
|
12
|
+
return 'end';
|
|
13
|
+
}
|
|
14
|
+
return 'start';
|
|
15
|
+
};
|
|
16
|
+
const handleStartSelectedSectionChange = useEventCallback(newSelectedSections => {
|
|
17
|
+
setStartSelectedSection(newSelectedSections);
|
|
18
|
+
if (getActiveField() === 'start') {
|
|
19
|
+
var _params$onSelectedSec;
|
|
20
|
+
(_params$onSelectedSec = params.onSelectedSectionsChange) == null || _params$onSelectedSec.call(params, newSelectedSections);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const handleEndSelectedSectionChange = useEventCallback(newSelectedSections => {
|
|
24
|
+
setEndSelectedSection(newSelectedSections);
|
|
25
|
+
if (getActiveField() === 'end') {
|
|
26
|
+
var _params$onSelectedSec2;
|
|
27
|
+
(_params$onSelectedSec2 = params.onSelectedSectionsChange) == null || _params$onSelectedSec2.call(params, newSelectedSections);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
const activeField = getActiveField();
|
|
31
|
+
return {
|
|
32
|
+
start: {
|
|
33
|
+
unstableFieldRef: params.unstableStartFieldRef,
|
|
34
|
+
selectedSections: activeField === 'start' && params.selectedSections !== undefined ? params.selectedSections : startSelectedSection,
|
|
35
|
+
onSelectedSectionsChange: handleStartSelectedSectionChange
|
|
36
|
+
},
|
|
37
|
+
end: {
|
|
38
|
+
unstableFieldRef: handleUnstableEndFieldRef,
|
|
39
|
+
selectedSections: activeField === 'end' && params.selectedSections !== undefined ? params.selectedSections : endSelectedSection,
|
|
40
|
+
onSelectedSectionsChange: handleEndSelectedSectionChange
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
2
2
|
import { UseMultiInputDateRangeFieldParams } from '../../../MultiInputDateRangeField/MultiInputDateRangeField.types';
|
|
3
3
|
import type { UseMultiInputRangeFieldResponse } from './useMultiInputRangeField.types';
|
|
4
|
-
export declare const useMultiInputDateRangeField: <TDate extends PickerValidDate, TTextFieldSlotProps extends {}>({ sharedProps: inSharedProps, startTextFieldProps, unstableStartFieldRef, endTextFieldProps, unstableEndFieldRef, }: UseMultiInputDateRangeFieldParams<TDate, TTextFieldSlotProps>) => UseMultiInputRangeFieldResponse<TTextFieldSlotProps>;
|
|
4
|
+
export declare const useMultiInputDateRangeField: <TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean, TTextFieldSlotProps extends {}>({ sharedProps: inSharedProps, startTextFieldProps, unstableStartFieldRef, endTextFieldProps, unstableEndFieldRef, }: UseMultiInputDateRangeFieldParams<TDate, TEnableAccessibleFieldDOMStructure, TTextFieldSlotProps>) => UseMultiInputRangeFieldResponse<TEnableAccessibleFieldDOMStructure, TTextFieldSlotProps>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import useEventCallback from '@mui/utils/useEventCallback';
|
|
3
3
|
import { unstable_useDateField as useDateField } from '@mui/x-date-pickers/DateField';
|
|
4
|
-
import { useLocalizationContext, useValidation, useControlledValueWithTimezone } from '@mui/x-date-pickers/internals';
|
|
5
|
-
import { useDefaultizedDateRangeFieldProps } from '../../../SingleInputDateRangeField/useSingleInputDateRangeField';
|
|
4
|
+
import { useLocalizationContext, useValidation, useControlledValueWithTimezone, useDefaultizedDateField } from '@mui/x-date-pickers/internals';
|
|
6
5
|
import { validateDateRange } from '../../utils/validation/validateDateRange';
|
|
7
6
|
import { rangeValueManager } from '../../utils/valueManagers';
|
|
8
7
|
import { excludeProps } from './shared';
|
|
8
|
+
import { useMultiInputFieldSelectedSections } from '../useMultiInputFieldSelectedSections';
|
|
9
9
|
export const useMultiInputDateRangeField = ({
|
|
10
10
|
sharedProps: inSharedProps,
|
|
11
11
|
startTextFieldProps,
|
|
@@ -13,7 +13,7 @@ export const useMultiInputDateRangeField = ({
|
|
|
13
13
|
endTextFieldProps,
|
|
14
14
|
unstableEndFieldRef
|
|
15
15
|
}) => {
|
|
16
|
-
const sharedProps =
|
|
16
|
+
const sharedProps = useDefaultizedDateField(inSharedProps);
|
|
17
17
|
const adapter = useLocalizationContext();
|
|
18
18
|
const {
|
|
19
19
|
value: valueProp,
|
|
@@ -26,7 +26,9 @@ export const useMultiInputDateRangeField = ({
|
|
|
26
26
|
readOnly,
|
|
27
27
|
selectedSections,
|
|
28
28
|
onSelectedSectionsChange,
|
|
29
|
-
timezone: timezoneProp
|
|
29
|
+
timezone: timezoneProp,
|
|
30
|
+
enableAccessibleFieldDOMStructure,
|
|
31
|
+
autoFocus
|
|
30
32
|
} = sharedProps;
|
|
31
33
|
const {
|
|
32
34
|
value,
|
|
@@ -63,37 +65,40 @@ export const useMultiInputDateRangeField = ({
|
|
|
63
65
|
value,
|
|
64
66
|
timezone
|
|
65
67
|
}), validateDateRange, rangeValueManager.isSameError, rangeValueManager.defaultErrorState);
|
|
68
|
+
const selectedSectionsResponse = useMultiInputFieldSelectedSections({
|
|
69
|
+
selectedSections,
|
|
70
|
+
onSelectedSectionsChange,
|
|
71
|
+
unstableStartFieldRef,
|
|
72
|
+
unstableEndFieldRef
|
|
73
|
+
});
|
|
66
74
|
const startFieldProps = _extends({
|
|
67
75
|
error: !!validationError[0]
|
|
68
|
-
}, startTextFieldProps, {
|
|
76
|
+
}, startTextFieldProps, selectedSectionsResponse.start, {
|
|
69
77
|
disabled,
|
|
70
78
|
readOnly,
|
|
71
79
|
format,
|
|
72
80
|
formatDensity,
|
|
73
81
|
shouldRespectLeadingZeros,
|
|
74
82
|
timezone,
|
|
75
|
-
unstableFieldRef: unstableStartFieldRef,
|
|
76
83
|
value: valueProp === undefined ? undefined : valueProp[0],
|
|
77
84
|
defaultValue: defaultValue === undefined ? undefined : defaultValue[0],
|
|
78
85
|
onChange: handleStartDateChange,
|
|
79
|
-
|
|
80
|
-
|
|
86
|
+
enableAccessibleFieldDOMStructure,
|
|
87
|
+
autoFocus // Do not add on end field.
|
|
81
88
|
});
|
|
82
89
|
const endFieldProps = _extends({
|
|
83
90
|
error: !!validationError[1]
|
|
84
|
-
}, endTextFieldProps, {
|
|
91
|
+
}, endTextFieldProps, selectedSectionsResponse.end, {
|
|
85
92
|
format,
|
|
86
93
|
formatDensity,
|
|
87
94
|
shouldRespectLeadingZeros,
|
|
88
95
|
disabled,
|
|
89
96
|
readOnly,
|
|
90
97
|
timezone,
|
|
91
|
-
unstableFieldRef: unstableEndFieldRef,
|
|
92
98
|
value: valueProp === undefined ? undefined : valueProp[1],
|
|
93
99
|
defaultValue: defaultValue === undefined ? undefined : defaultValue[1],
|
|
94
100
|
onChange: handleEndDateChange,
|
|
95
|
-
|
|
96
|
-
onSelectedSectionsChange
|
|
101
|
+
enableAccessibleFieldDOMStructure
|
|
97
102
|
});
|
|
98
103
|
const startDateResponse = useDateField(startFieldProps);
|
|
99
104
|
const endDateResponse = useDateField(endFieldProps);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
2
|
-
import type {
|
|
2
|
+
import type { UseMultiInputDateTimeRangeFieldParams } from '../../../MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types';
|
|
3
3
|
import type { UseMultiInputRangeFieldResponse } from './useMultiInputRangeField.types';
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const useMultiInputDateTimeRangeField: <TDate extends PickerValidDate, TTextFieldSlotProps extends {}>({ sharedProps: inSharedProps, startTextFieldProps, unstableStartFieldRef, endTextFieldProps, unstableEndFieldRef, }: UseMultiInputDateTimeRangeFieldParams<TDate, TTextFieldSlotProps>) => UseMultiInputRangeFieldResponse<TTextFieldSlotProps>;
|
|
4
|
+
export declare const useMultiInputDateTimeRangeField: <TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean, TTextFieldSlotProps extends {}>({ sharedProps: inSharedProps, startTextFieldProps, unstableStartFieldRef, endTextFieldProps, unstableEndFieldRef, }: UseMultiInputDateTimeRangeFieldParams<TDate, TEnableAccessibleFieldDOMStructure, TTextFieldSlotProps>) => UseMultiInputRangeFieldResponse<TEnableAccessibleFieldDOMStructure, TTextFieldSlotProps>;
|
|
@@ -1,27 +1,11 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import useEventCallback from '@mui/utils/useEventCallback';
|
|
3
3
|
import { unstable_useDateTimeField as useDateTimeField } from '@mui/x-date-pickers/DateTimeField';
|
|
4
|
-
import {
|
|
4
|
+
import { useLocalizationContext, useValidation, useControlledValueWithTimezone, useDefaultizedDateTimeField } from '@mui/x-date-pickers/internals';
|
|
5
5
|
import { validateDateTimeRange } from '../../utils/validation/validateDateTimeRange';
|
|
6
6
|
import { rangeValueManager } from '../../utils/valueManagers';
|
|
7
7
|
import { excludeProps } from './shared';
|
|
8
|
-
|
|
9
|
-
var _props$ampm, _props$disablePast, _props$disableFuture, _props$format, _props$minDateTime, _props$maxDateTime, _props$minDateTime2, _props$maxDateTime2;
|
|
10
|
-
const utils = useUtils();
|
|
11
|
-
const defaultDates = useDefaultDates();
|
|
12
|
-
const ampm = (_props$ampm = props.ampm) != null ? _props$ampm : utils.is12HourCycleInCurrentLocale();
|
|
13
|
-
const defaultFormat = ampm ? utils.formats.keyboardDateTime12h : utils.formats.keyboardDateTime24h;
|
|
14
|
-
return _extends({}, props, {
|
|
15
|
-
disablePast: (_props$disablePast = props.disablePast) != null ? _props$disablePast : false,
|
|
16
|
-
disableFuture: (_props$disableFuture = props.disableFuture) != null ? _props$disableFuture : false,
|
|
17
|
-
format: (_props$format = props.format) != null ? _props$format : defaultFormat,
|
|
18
|
-
minDate: applyDefaultDate(utils, (_props$minDateTime = props.minDateTime) != null ? _props$minDateTime : props.minDate, defaultDates.minDate),
|
|
19
|
-
maxDate: applyDefaultDate(utils, (_props$maxDateTime = props.maxDateTime) != null ? _props$maxDateTime : props.maxDate, defaultDates.maxDate),
|
|
20
|
-
minTime: (_props$minDateTime2 = props.minDateTime) != null ? _props$minDateTime2 : props.minTime,
|
|
21
|
-
maxTime: (_props$maxDateTime2 = props.maxDateTime) != null ? _props$maxDateTime2 : props.maxTime,
|
|
22
|
-
disableIgnoringDatePartForTimeValidation: Boolean(props.minDateTime || props.maxDateTime)
|
|
23
|
-
});
|
|
24
|
-
};
|
|
8
|
+
import { useMultiInputFieldSelectedSections } from '../useMultiInputFieldSelectedSections';
|
|
25
9
|
export const useMultiInputDateTimeRangeField = ({
|
|
26
10
|
sharedProps: inSharedProps,
|
|
27
11
|
startTextFieldProps,
|
|
@@ -29,19 +13,22 @@ export const useMultiInputDateTimeRangeField = ({
|
|
|
29
13
|
endTextFieldProps,
|
|
30
14
|
unstableEndFieldRef
|
|
31
15
|
}) => {
|
|
32
|
-
const sharedProps =
|
|
16
|
+
const sharedProps = useDefaultizedDateTimeField(inSharedProps);
|
|
33
17
|
const adapter = useLocalizationContext();
|
|
34
18
|
const {
|
|
35
19
|
value: valueProp,
|
|
36
20
|
defaultValue,
|
|
37
21
|
format,
|
|
22
|
+
formatDensity,
|
|
38
23
|
shouldRespectLeadingZeros,
|
|
39
|
-
timezone: timezoneProp,
|
|
40
24
|
onChange,
|
|
41
25
|
disabled,
|
|
42
26
|
readOnly,
|
|
43
27
|
selectedSections,
|
|
44
|
-
onSelectedSectionsChange
|
|
28
|
+
onSelectedSectionsChange,
|
|
29
|
+
timezone: timezoneProp,
|
|
30
|
+
enableAccessibleFieldDOMStructure,
|
|
31
|
+
autoFocus
|
|
45
32
|
} = sharedProps;
|
|
46
33
|
const {
|
|
47
34
|
value,
|
|
@@ -78,35 +65,40 @@ export const useMultiInputDateTimeRangeField = ({
|
|
|
78
65
|
value,
|
|
79
66
|
timezone
|
|
80
67
|
}), validateDateTimeRange, rangeValueManager.isSameError, rangeValueManager.defaultErrorState);
|
|
68
|
+
const selectedSectionsResponse = useMultiInputFieldSelectedSections({
|
|
69
|
+
selectedSections,
|
|
70
|
+
onSelectedSectionsChange,
|
|
71
|
+
unstableStartFieldRef,
|
|
72
|
+
unstableEndFieldRef
|
|
73
|
+
});
|
|
81
74
|
const startFieldProps = _extends({
|
|
82
75
|
error: !!validationError[0]
|
|
83
|
-
}, startTextFieldProps, {
|
|
84
|
-
format,
|
|
85
|
-
shouldRespectLeadingZeros,
|
|
76
|
+
}, startTextFieldProps, selectedSectionsResponse.start, {
|
|
86
77
|
disabled,
|
|
87
78
|
readOnly,
|
|
79
|
+
format,
|
|
80
|
+
formatDensity,
|
|
81
|
+
shouldRespectLeadingZeros,
|
|
88
82
|
timezone,
|
|
89
|
-
unstableFieldRef: unstableStartFieldRef,
|
|
90
83
|
value: valueProp === undefined ? undefined : valueProp[0],
|
|
91
84
|
defaultValue: defaultValue === undefined ? undefined : defaultValue[0],
|
|
92
85
|
onChange: handleStartDateChange,
|
|
93
|
-
|
|
94
|
-
|
|
86
|
+
enableAccessibleFieldDOMStructure,
|
|
87
|
+
autoFocus // Do not add on end field.
|
|
95
88
|
});
|
|
96
89
|
const endFieldProps = _extends({
|
|
97
90
|
error: !!validationError[1]
|
|
98
|
-
}, endTextFieldProps, {
|
|
91
|
+
}, endTextFieldProps, selectedSectionsResponse.end, {
|
|
99
92
|
format,
|
|
93
|
+
formatDensity,
|
|
100
94
|
shouldRespectLeadingZeros,
|
|
101
95
|
disabled,
|
|
102
96
|
readOnly,
|
|
103
97
|
timezone,
|
|
104
|
-
unstableFieldRef: unstableEndFieldRef,
|
|
105
98
|
value: valueProp === undefined ? undefined : valueProp[1],
|
|
106
99
|
defaultValue: defaultValue === undefined ? undefined : defaultValue[1],
|
|
107
100
|
onChange: handleEndDateChange,
|
|
108
|
-
|
|
109
|
-
onSelectedSectionsChange
|
|
101
|
+
enableAccessibleFieldDOMStructure
|
|
110
102
|
});
|
|
111
103
|
const startDateResponse = useDateTimeField(startFieldProps);
|
|
112
104
|
const endDateResponse = useDateTimeField(endFieldProps);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { UseFieldResponse } from '@mui/x-date-pickers/internals';
|
|
2
|
-
import { MultiInputFieldRefs } from '
|
|
2
|
+
import { MultiInputFieldRefs } from '../../../models';
|
|
3
3
|
export interface UseMultiInputRangeFieldParams<TSharedProps extends {}, TTextFieldSlotProps extends {}> extends MultiInputFieldRefs {
|
|
4
4
|
sharedProps: TSharedProps;
|
|
5
5
|
startTextFieldProps: TTextFieldSlotProps;
|
|
6
6
|
endTextFieldProps: TTextFieldSlotProps;
|
|
7
7
|
}
|
|
8
|
-
export interface UseMultiInputRangeFieldResponse<TForwardedProps extends {}> {
|
|
9
|
-
startDate: UseFieldResponse<TForwardedProps>;
|
|
10
|
-
endDate: UseFieldResponse<TForwardedProps>;
|
|
8
|
+
export interface UseMultiInputRangeFieldResponse<TEnableAccessibleFieldDOMStructure extends boolean, TForwardedProps extends {}> {
|
|
9
|
+
startDate: UseFieldResponse<TEnableAccessibleFieldDOMStructure, TForwardedProps>;
|
|
10
|
+
endDate: UseFieldResponse<TEnableAccessibleFieldDOMStructure, TForwardedProps>;
|
|
11
11
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
2
|
-
import type {
|
|
2
|
+
import type { UseMultiInputTimeRangeFieldParams } from '../../../MultiInputTimeRangeField/MultiInputTimeRangeField.types';
|
|
3
3
|
import type { UseMultiInputRangeFieldResponse } from './useMultiInputRangeField.types';
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const useMultiInputTimeRangeField: <TDate extends PickerValidDate, TTextFieldSlotProps extends {}>({ sharedProps: inSharedProps, startTextFieldProps, unstableStartFieldRef, endTextFieldProps, unstableEndFieldRef, }: UseMultiInputTimeRangeFieldParams<TDate, TTextFieldSlotProps>) => UseMultiInputRangeFieldResponse<TTextFieldSlotProps>;
|
|
4
|
+
export declare const useMultiInputTimeRangeField: <TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean, TTextFieldSlotProps extends {}>({ sharedProps: inSharedProps, startTextFieldProps, unstableStartFieldRef, endTextFieldProps, unstableEndFieldRef, }: UseMultiInputTimeRangeFieldParams<TDate, TEnableAccessibleFieldDOMStructure, TTextFieldSlotProps>) => UseMultiInputRangeFieldResponse<TEnableAccessibleFieldDOMStructure, TTextFieldSlotProps>;
|
|
@@ -1,21 +1,11 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import useEventCallback from '@mui/utils/useEventCallback';
|
|
3
3
|
import { unstable_useTimeField as useTimeField } from '@mui/x-date-pickers/TimeField';
|
|
4
|
-
import { useLocalizationContext,
|
|
4
|
+
import { useLocalizationContext, useValidation, useControlledValueWithTimezone, useDefaultizedTimeField } from '@mui/x-date-pickers/internals';
|
|
5
5
|
import { validateTimeRange } from '../../utils/validation/validateTimeRange';
|
|
6
6
|
import { rangeValueManager } from '../../utils/valueManagers';
|
|
7
7
|
import { excludeProps } from './shared';
|
|
8
|
-
|
|
9
|
-
var _props$ampm, _props$disablePast, _props$disableFuture, _props$format;
|
|
10
|
-
const utils = useUtils();
|
|
11
|
-
const ampm = (_props$ampm = props.ampm) != null ? _props$ampm : utils.is12HourCycleInCurrentLocale();
|
|
12
|
-
const defaultFormat = ampm ? utils.formats.fullTime12h : utils.formats.fullTime24h;
|
|
13
|
-
return _extends({}, props, {
|
|
14
|
-
disablePast: (_props$disablePast = props.disablePast) != null ? _props$disablePast : false,
|
|
15
|
-
disableFuture: (_props$disableFuture = props.disableFuture) != null ? _props$disableFuture : false,
|
|
16
|
-
format: (_props$format = props.format) != null ? _props$format : defaultFormat
|
|
17
|
-
});
|
|
18
|
-
};
|
|
8
|
+
import { useMultiInputFieldSelectedSections } from '../useMultiInputFieldSelectedSections';
|
|
19
9
|
export const useMultiInputTimeRangeField = ({
|
|
20
10
|
sharedProps: inSharedProps,
|
|
21
11
|
startTextFieldProps,
|
|
@@ -23,19 +13,22 @@ export const useMultiInputTimeRangeField = ({
|
|
|
23
13
|
endTextFieldProps,
|
|
24
14
|
unstableEndFieldRef
|
|
25
15
|
}) => {
|
|
26
|
-
const sharedProps =
|
|
16
|
+
const sharedProps = useDefaultizedTimeField(inSharedProps);
|
|
27
17
|
const adapter = useLocalizationContext();
|
|
28
18
|
const {
|
|
29
19
|
value: valueProp,
|
|
30
20
|
defaultValue,
|
|
31
21
|
format,
|
|
22
|
+
formatDensity,
|
|
32
23
|
shouldRespectLeadingZeros,
|
|
33
|
-
timezone: timezoneProp,
|
|
34
24
|
onChange,
|
|
35
25
|
disabled,
|
|
36
26
|
readOnly,
|
|
37
27
|
selectedSections,
|
|
38
|
-
onSelectedSectionsChange
|
|
28
|
+
onSelectedSectionsChange,
|
|
29
|
+
timezone: timezoneProp,
|
|
30
|
+
enableAccessibleFieldDOMStructure,
|
|
31
|
+
autoFocus
|
|
39
32
|
} = sharedProps;
|
|
40
33
|
const {
|
|
41
34
|
value,
|
|
@@ -72,35 +65,40 @@ export const useMultiInputTimeRangeField = ({
|
|
|
72
65
|
value,
|
|
73
66
|
timezone
|
|
74
67
|
}), validateTimeRange, rangeValueManager.isSameError, rangeValueManager.defaultErrorState);
|
|
68
|
+
const selectedSectionsResponse = useMultiInputFieldSelectedSections({
|
|
69
|
+
selectedSections,
|
|
70
|
+
onSelectedSectionsChange,
|
|
71
|
+
unstableStartFieldRef,
|
|
72
|
+
unstableEndFieldRef
|
|
73
|
+
});
|
|
75
74
|
const startFieldProps = _extends({
|
|
76
75
|
error: !!validationError[0]
|
|
77
|
-
}, startTextFieldProps, {
|
|
78
|
-
format,
|
|
79
|
-
shouldRespectLeadingZeros,
|
|
76
|
+
}, startTextFieldProps, selectedSectionsResponse.start, {
|
|
80
77
|
disabled,
|
|
81
78
|
readOnly,
|
|
79
|
+
format,
|
|
80
|
+
formatDensity,
|
|
81
|
+
shouldRespectLeadingZeros,
|
|
82
82
|
timezone,
|
|
83
|
-
unstableFieldRef: unstableStartFieldRef,
|
|
84
83
|
value: valueProp === undefined ? undefined : valueProp[0],
|
|
85
84
|
defaultValue: defaultValue === undefined ? undefined : defaultValue[0],
|
|
86
85
|
onChange: handleStartDateChange,
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
enableAccessibleFieldDOMStructure,
|
|
87
|
+
autoFocus // Do not add on end field.
|
|
89
88
|
});
|
|
90
89
|
const endFieldProps = _extends({
|
|
91
90
|
error: !!validationError[1]
|
|
92
|
-
}, endTextFieldProps, {
|
|
91
|
+
}, endTextFieldProps, selectedSectionsResponse.end, {
|
|
93
92
|
format,
|
|
93
|
+
formatDensity,
|
|
94
94
|
shouldRespectLeadingZeros,
|
|
95
95
|
disabled,
|
|
96
96
|
readOnly,
|
|
97
97
|
timezone,
|
|
98
|
-
unstableFieldRef: unstableEndFieldRef,
|
|
99
98
|
value: valueProp === undefined ? undefined : valueProp[1],
|
|
100
99
|
defaultValue: defaultValue === undefined ? undefined : defaultValue[1],
|
|
101
100
|
onChange: handleEndDateChange,
|
|
102
|
-
|
|
103
|
-
onSelectedSectionsChange
|
|
101
|
+
enableAccessibleFieldDOMStructure
|
|
104
102
|
});
|
|
105
103
|
const startDateResponse = useTimeField(startFieldProps);
|
|
106
104
|
const endDateResponse = useTimeField(endFieldProps);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { FieldRef } from '@mui/x-date-pickers/models';
|
|
3
|
-
import { RangePosition } from '../../models';
|
|
4
|
-
import { RangeFieldSection } from '../models/fields';
|
|
3
|
+
import { RangePosition, RangeFieldSection } from '../../models';
|
|
5
4
|
export interface UseRangePositionProps {
|
|
6
5
|
/**
|
|
7
6
|
* The position in the currently edited date range.
|
|
@@ -23,6 +22,5 @@ export interface UseRangePositionProps {
|
|
|
23
22
|
export interface UseRangePositionResponse {
|
|
24
23
|
rangePosition: RangePosition;
|
|
25
24
|
onRangePositionChange: (newPosition: RangePosition) => void;
|
|
26
|
-
singleInputFieldRef: React.MutableRefObject<FieldRef<RangeFieldSection> | undefined>;
|
|
27
25
|
}
|
|
28
|
-
export declare const useRangePosition: (props: UseRangePositionProps) => UseRangePositionResponse;
|
|
26
|
+
export declare const useRangePosition: (props: UseRangePositionProps, singleInputFieldRef?: React.RefObject<FieldRef<RangeFieldSection>>) => UseRangePositionResponse;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import useControlled from '@mui/utils/useControlled';
|
|
3
2
|
import useEventCallback from '@mui/utils/useEventCallback';
|
|
4
|
-
export const useRangePosition = props => {
|
|
3
|
+
export const useRangePosition = (props, singleInputFieldRef) => {
|
|
5
4
|
var _props$defaultRangePo;
|
|
6
|
-
const singleInputFieldRef = React.useRef();
|
|
7
5
|
const [rangePosition, setRangePosition] = useControlled({
|
|
8
6
|
name: 'useRangePosition',
|
|
9
7
|
state: 'rangePosition',
|
|
@@ -14,7 +12,7 @@ export const useRangePosition = props => {
|
|
|
14
12
|
// When using a single input field,
|
|
15
13
|
// we want to select the 1st section of the edited date when updating the range position.
|
|
16
14
|
const syncRangePositionWithSingleInputField = newRangePosition => {
|
|
17
|
-
if (singleInputFieldRef.current == null) {
|
|
15
|
+
if ((singleInputFieldRef == null ? void 0 : singleInputFieldRef.current) == null) {
|
|
18
16
|
return;
|
|
19
17
|
}
|
|
20
18
|
const sections = singleInputFieldRef.current.getSections();
|
|
@@ -29,7 +27,6 @@ export const useRangePosition = props => {
|
|
|
29
27
|
});
|
|
30
28
|
return {
|
|
31
29
|
rangePosition,
|
|
32
|
-
onRangePositionChange: handleRangePositionChange
|
|
33
|
-
singleInputFieldRef
|
|
30
|
+
onRangePositionChange: handleRangePositionChange
|
|
34
31
|
};
|
|
35
32
|
};
|
|
@@ -2,9 +2,8 @@ import * as React from 'react';
|
|
|
2
2
|
import { BasePickerProps, UsePickerParams, ExportedBaseToolbarProps, StaticOnlyPickerProps, DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals';
|
|
3
3
|
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
4
4
|
import { ExportedPickersLayoutSlots, ExportedPickersLayoutSlotProps } from '@mui/x-date-pickers/PickersLayout';
|
|
5
|
-
import { DateRange } from '../../../models';
|
|
5
|
+
import { RangeFieldSection, DateRange } from '../../../models';
|
|
6
6
|
import { UseRangePositionProps } from '../useRangePosition';
|
|
7
|
-
import { RangeFieldSection } from '../../models/fields';
|
|
8
7
|
export interface UseStaticRangePickerSlots<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem> extends ExportedPickersLayoutSlots<DateRange<TDate>, TDate, TView> {
|
|
9
8
|
}
|
|
10
9
|
export interface UseStaticRangePickerSlotProps<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem> extends ExportedPickersLayoutSlotProps<DateRange<TDate>, TDate, TView> {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { BaseDateValidationProps,
|
|
1
|
+
import { BaseDateValidationProps, MakeOptional, UseFieldInternalProps } from '@mui/x-date-pickers/internals';
|
|
2
2
|
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
3
|
-
import type { DateRangeValidationError, DateRange } from '../../models';
|
|
4
|
-
import { RangeFieldSection } from './fields';
|
|
3
|
+
import type { DateRangeValidationError, RangeFieldSection, DateRange } from '../../models';
|
|
5
4
|
/**
|
|
6
5
|
* Props used to validate a day value in range pickers.
|
|
7
6
|
*/
|
|
@@ -18,16 +17,5 @@ export interface DayRangeValidationProps<TDate extends PickerValidDate> {
|
|
|
18
17
|
*/
|
|
19
18
|
shouldDisableDate?: (day: TDate, position: 'start' | 'end') => boolean;
|
|
20
19
|
}
|
|
21
|
-
|
|
22
|
-
* Props used in every range picker.
|
|
23
|
-
*/
|
|
24
|
-
export interface BaseRangeProps {
|
|
25
|
-
/**
|
|
26
|
-
* If `true`, the component is disabled.
|
|
27
|
-
* @default false
|
|
28
|
-
*/
|
|
29
|
-
disabled?: boolean;
|
|
30
|
-
}
|
|
31
|
-
export interface UseDateRangeFieldProps<TDate extends PickerValidDate> extends MakeOptional<UseFieldInternalProps<DateRange<TDate>, TDate, RangeFieldSection, DateRangeValidationError>, 'format'>, DayRangeValidationProps<TDate>, BaseDateValidationProps<TDate>, BaseRangeProps {
|
|
20
|
+
export interface UseDateRangeFieldProps<TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean> extends MakeOptional<Omit<UseFieldInternalProps<DateRange<TDate>, TDate, RangeFieldSection, TEnableAccessibleFieldDOMStructure, DateRangeValidationError>, 'unstableFieldRef'>, 'format'>, DayRangeValidationProps<TDate>, BaseDateValidationProps<TDate> {
|
|
32
21
|
}
|
|
33
|
-
export type UseDateRangeFieldDefaultizedProps<TDate extends PickerValidDate> = DefaultizedProps<UseDateRangeFieldProps<TDate>, keyof BaseDateValidationProps<TDate> | 'format'>;
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import { BaseDateValidationProps, TimeValidationProps,
|
|
1
|
+
import { BaseDateValidationProps, TimeValidationProps, MakeOptional, UseFieldInternalProps, DateTimeValidationProps, DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals';
|
|
2
2
|
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
3
|
-
import {
|
|
4
|
-
import { DateTimeRangeValidationError, DateRange } from '../../models';
|
|
5
|
-
|
|
6
|
-
export interface UseDateTimeRangeFieldProps<TDate extends PickerValidDate> extends MakeOptional<UseFieldInternalProps<DateRange<TDate>, TDate, RangeFieldSection, DateTimeRangeValidationError>, 'format'>, DayRangeValidationProps<TDate>, TimeValidationProps<TDate>, BaseDateValidationProps<TDate>, DateTimeValidationProps<TDate>, BaseRangeProps {
|
|
3
|
+
import { DayRangeValidationProps } from './dateRange';
|
|
4
|
+
import { DateTimeRangeValidationError, RangeFieldSection, DateRange } from '../../models';
|
|
5
|
+
export interface UseDateTimeRangeFieldProps<TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean> extends MakeOptional<Omit<UseFieldInternalProps<DateRange<TDate>, TDate, RangeFieldSection, TEnableAccessibleFieldDOMStructure, DateTimeRangeValidationError>, 'unstableFieldRef'>, 'format'>, DayRangeValidationProps<TDate>, TimeValidationProps<TDate>, BaseDateValidationProps<TDate>, DateTimeValidationProps<TDate> {
|
|
7
6
|
/**
|
|
8
7
|
* 12h/24h view for hour selection clock.
|
|
9
8
|
* @default `utils.is12HourCycleInCurrentLocale()`
|
|
10
9
|
*/
|
|
11
10
|
ampm?: boolean;
|
|
12
11
|
}
|
|
13
|
-
export type UseDateTimeRangeFieldDefaultizedProps<TDate extends PickerValidDate> = DefaultizedProps<UseDateTimeRangeFieldProps<TDate>, keyof BaseDateValidationProps<TDate> | 'format' | 'disableIgnoringDatePartForTimeValidation'>;
|
|
14
12
|
export type DateTimeRangePickerView = Exclude<DateOrTimeViewWithMeridiem, 'month' | 'year'>;
|
|
15
13
|
export type DateTimeRangePickerViewExternal = Exclude<DateTimeRangePickerView, 'meridiem'>;
|