@mui/x-date-pickers-pro 7.15.0 → 7.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +185 -1
- package/DateRangeCalendar/DateRangeCalendar.js +16 -13
- package/DateRangeCalendar/index.js +2 -2
- package/DateRangeCalendar/useDragRange.js +3 -1
- package/DateRangePicker/DateRangePicker.js +15 -13
- package/DateRangePicker/DateRangePickerToolbar.js +3 -1
- package/DateRangePicker/index.js +3 -3
- package/DateRangePicker/shared.js +1 -1
- package/DateRangePickerDay/DateRangePickerDay.js +4 -2
- package/DateRangePickerDay/index.js +2 -2
- package/DateTimeRangePicker/DateTimeRangePicker.js +15 -13
- package/DateTimeRangePicker/DateTimeRangePickerTabs.js +3 -1
- package/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +2 -2
- package/DateTimeRangePicker/DateTimeRangePickerToolbar.js +4 -2
- package/DateTimeRangePicker/index.js +5 -5
- package/DateTimeRangePicker/shared.js +2 -2
- package/DesktopDateRangePicker/DesktopDateRangePicker.js +20 -18
- package/DesktopDateRangePicker/index.js +1 -1
- package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +23 -20
- package/DesktopDateTimeRangePicker/index.js +1 -1
- package/MobileDateRangePicker/MobileDateRangePicker.js +20 -18
- package/MobileDateRangePicker/index.js +1 -1
- package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +23 -20
- package/MobileDateTimeRangePicker/index.js +1 -1
- package/MultiInputDateRangeField/MultiInputDateRangeField.js +16 -11
- package/MultiInputDateRangeField/index.js +2 -2
- package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +16 -11
- package/MultiInputDateTimeRangeField/index.js +2 -2
- package/MultiInputTimeRangeField/MultiInputTimeRangeField.js +16 -11
- package/MultiInputTimeRangeField/index.js +2 -2
- package/PickersRangeCalendarHeader/PickersRangeCalendarHeader.js +2 -0
- package/PickersRangeCalendarHeader/index.js +1 -1
- package/SingleInputDateRangeField/SingleInputDateRangeField.js +12 -8
- package/SingleInputDateRangeField/index.js +2 -2
- package/SingleInputDateRangeField/useSingleInputDateRangeField.d.ts +1 -1
- package/SingleInputDateRangeField/useSingleInputDateRangeField.js +7 -4
- package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +12 -8
- package/SingleInputDateTimeRangeField/index.js +2 -2
- package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.d.ts +1 -1
- package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +7 -4
- package/SingleInputTimeRangeField/SingleInputTimeRangeField.js +12 -8
- package/SingleInputTimeRangeField/index.js +2 -2
- package/SingleInputTimeRangeField/useSingleInputTimeRangeField.d.ts +1 -1
- package/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +7 -4
- package/StaticDateRangePicker/StaticDateRangePicker.js +18 -16
- package/StaticDateRangePicker/index.js +1 -1
- package/dateRangeViewRenderers/dateRangeViewRenderers.js +1 -1
- package/dateRangeViewRenderers/index.js +1 -1
- package/index.d.ts +1 -0
- package/index.js +20 -19
- package/internals/hooks/useDesktopRangePicker/index.js +1 -1
- package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +3 -3
- package/internals/hooks/useMobileRangePicker/index.js +1 -1
- package/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +3 -3
- package/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +17 -17
- package/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +17 -17
- package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +17 -17
- package/internals/hooks/useStaticRangePicker/index.js +1 -1
- package/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +1 -1
- package/internals/models/index.js +4 -4
- package/internals/utils/releaseInfo.js +1 -1
- package/internals/utils/valueManagers.js +1 -1
- package/models/index.js +5 -5
- package/modern/DateRangeCalendar/DateRangeCalendar.js +16 -13
- package/modern/DateRangeCalendar/index.js +2 -2
- package/modern/DateRangeCalendar/useDragRange.js +3 -1
- package/modern/DateRangePicker/DateRangePicker.js +15 -13
- package/modern/DateRangePicker/DateRangePickerToolbar.js +3 -1
- package/modern/DateRangePicker/index.js +3 -3
- package/modern/DateRangePicker/shared.js +1 -1
- package/modern/DateRangePickerDay/DateRangePickerDay.js +4 -2
- package/modern/DateRangePickerDay/index.js +2 -2
- package/modern/DateTimeRangePicker/DateTimeRangePicker.js +15 -13
- package/modern/DateTimeRangePicker/DateTimeRangePickerTabs.js +3 -1
- package/modern/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +2 -2
- package/modern/DateTimeRangePicker/DateTimeRangePickerToolbar.js +4 -2
- package/modern/DateTimeRangePicker/index.js +5 -5
- package/modern/DateTimeRangePicker/shared.js +2 -2
- package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +20 -18
- package/modern/DesktopDateRangePicker/index.js +1 -1
- package/modern/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +23 -20
- package/modern/DesktopDateTimeRangePicker/index.js +1 -1
- package/modern/MobileDateRangePicker/MobileDateRangePicker.js +20 -18
- package/modern/MobileDateRangePicker/index.js +1 -1
- package/modern/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +23 -20
- package/modern/MobileDateTimeRangePicker/index.js +1 -1
- package/modern/MultiInputDateRangeField/MultiInputDateRangeField.js +16 -11
- package/modern/MultiInputDateRangeField/index.js +2 -2
- package/modern/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +16 -11
- package/modern/MultiInputDateTimeRangeField/index.js +2 -2
- package/modern/MultiInputTimeRangeField/MultiInputTimeRangeField.js +16 -11
- package/modern/MultiInputTimeRangeField/index.js +2 -2
- package/modern/PickersRangeCalendarHeader/PickersRangeCalendarHeader.js +2 -0
- package/modern/PickersRangeCalendarHeader/index.js +1 -1
- package/modern/SingleInputDateRangeField/SingleInputDateRangeField.js +12 -8
- package/modern/SingleInputDateRangeField/index.js +2 -2
- package/modern/SingleInputDateRangeField/useSingleInputDateRangeField.js +7 -4
- package/modern/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +12 -8
- package/modern/SingleInputDateTimeRangeField/index.js +2 -2
- package/modern/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +7 -4
- package/modern/SingleInputTimeRangeField/SingleInputTimeRangeField.js +12 -8
- package/modern/SingleInputTimeRangeField/index.js +2 -2
- package/modern/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +7 -4
- package/modern/StaticDateRangePicker/StaticDateRangePicker.js +18 -16
- package/modern/StaticDateRangePicker/index.js +1 -1
- package/modern/dateRangeViewRenderers/dateRangeViewRenderers.js +1 -1
- package/modern/dateRangeViewRenderers/index.js +1 -1
- package/modern/index.js +20 -19
- package/modern/internals/hooks/useDesktopRangePicker/index.js +1 -1
- package/modern/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +3 -3
- package/modern/internals/hooks/useMobileRangePicker/index.js +1 -1
- package/modern/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +3 -3
- package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +17 -17
- package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +17 -17
- package/modern/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +17 -17
- package/modern/internals/hooks/useStaticRangePicker/index.js +1 -1
- package/modern/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +1 -1
- package/modern/internals/models/index.js +4 -4
- package/modern/internals/utils/releaseInfo.js +1 -1
- package/modern/internals/utils/valueManagers.js +1 -1
- package/modern/models/index.js +5 -5
- package/modern/themeAugmentation/index.js +1 -4
- package/modern/validation/index.js +3 -0
- package/modern/{internals/utils/validation → validation}/validateDateRange.js +10 -5
- package/modern/{internals/utils/validation → validation}/validateDateTimeRange.js +10 -5
- package/{internals/utils → modern}/validation/validateTimeRange.js +10 -5
- package/node/DateRangeCalendar/DateRangeCalendar.js +7 -6
- package/node/DateRangeCalendar/useDragRange.js +3 -3
- package/node/DateRangePicker/DateRangePicker.js +14 -14
- package/node/DateRangePicker/DateRangePickerToolbar.js +3 -3
- package/node/DateRangePicker/shared.js +2 -3
- package/node/DateRangePickerDay/DateRangePickerDay.js +3 -3
- package/node/DateTimeRangePicker/DateTimeRangePicker.js +14 -14
- package/node/DateTimeRangePicker/DateTimeRangePickerTabs.js +3 -3
- package/node/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +1 -1
- package/node/DateTimeRangePicker/DateTimeRangePickerToolbar.js +3 -3
- package/node/DateTimeRangePicker/dateTimeRangePickerTabsClasses.js +1 -1
- package/node/DateTimeRangePicker/shared.js +1 -1
- package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +18 -18
- package/node/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +18 -17
- package/node/MobileDateRangePicker/MobileDateRangePicker.js +18 -18
- package/node/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +18 -17
- package/node/MultiInputDateRangeField/MultiInputDateRangeField.js +15 -12
- package/node/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +15 -12
- package/node/MultiInputTimeRangeField/MultiInputTimeRangeField.js +15 -12
- package/node/PickersRangeCalendarHeader/PickersRangeCalendarHeader.js +3 -3
- package/node/SingleInputDateRangeField/SingleInputDateRangeField.js +12 -10
- package/node/SingleInputDateRangeField/useSingleInputDateRangeField.js +6 -5
- package/node/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +12 -10
- package/node/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +6 -5
- package/node/SingleInputTimeRangeField/SingleInputTimeRangeField.js +12 -10
- package/node/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +6 -5
- package/node/StaticDateRangePicker/StaticDateRangePicker.js +16 -16
- package/node/dateRangeViewRenderers/dateRangeViewRenderers.js +1 -2
- package/node/index.js +13 -1
- package/node/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +2 -3
- package/node/internals/hooks/useEnrichedRangePickerFieldProps.js +2 -3
- package/node/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +2 -3
- package/node/internals/hooks/useMultiInputFieldSelectedSections.js +2 -3
- package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +14 -14
- package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +14 -14
- package/node/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +14 -14
- package/node/internals/hooks/useRangePosition.js +1 -1
- package/node/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +2 -3
- package/node/internals/utils/date-fields-utils.js +1 -1
- package/node/internals/utils/releaseInfo.js +1 -1
- package/node/internals/utils/valueManagers.js +1 -1
- package/node/themeAugmentation/index.js +0 -33
- package/node/validation/index.js +26 -0
- package/node/{internals/utils/validation → validation}/validateDateRange.js +13 -8
- package/node/{internals/utils/validation → validation}/validateDateTimeRange.js +13 -8
- package/node/{internals/utils/validation → validation}/validateTimeRange.js +12 -7
- package/package.json +5 -4
- package/themeAugmentation/index.d.ts +3 -3
- package/themeAugmentation/index.js +1 -4
- package/validation/index.d.ts +6 -0
- package/validation/index.js +3 -0
- package/validation/package.json +6 -0
- package/validation/validateDateRange.d.ts +8 -0
- package/{internals/utils/validation → validation}/validateDateRange.js +10 -5
- package/validation/validateDateTimeRange.d.ts +8 -0
- package/{internals/utils/validation → validation}/validateDateTimeRange.js +10 -5
- package/validation/validateTimeRange.d.ts +6 -0
- package/{modern/internals/utils/validation → validation}/validateTimeRange.js +10 -5
- package/internals/utils/validation/validateDateRange.d.ts +0 -7
- package/internals/utils/validation/validateDateTimeRange.d.ts +0 -7
- package/internals/utils/validation/validateTimeRange.d.ts +0 -6
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
5
|
const _excluded = ["slots", "slotProps", "InputProps", "inputProps"];
|
|
@@ -10,7 +12,7 @@ import { useThemeProps } from '@mui/material/styles';
|
|
|
10
12
|
import { refType } from '@mui/utils';
|
|
11
13
|
import useSlotProps from '@mui/utils/useSlotProps';
|
|
12
14
|
import { useClearableField } from '@mui/x-date-pickers/hooks';
|
|
13
|
-
import { useSingleInputDateTimeRangeField } from
|
|
15
|
+
import { useSingleInputDateTimeRangeField } from "./useSingleInputDateTimeRangeField.js";
|
|
14
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
17
|
/**
|
|
16
18
|
* Demos:
|
|
@@ -228,8 +230,8 @@ process.env.NODE_ENV !== "production" ? SingleInputDateTimeRangeField.propTypes
|
|
|
228
230
|
onBlur: PropTypes.func,
|
|
229
231
|
/**
|
|
230
232
|
* Callback fired when the value changes.
|
|
231
|
-
* @template TValue The value type.
|
|
232
|
-
* @template TError The validation error type.
|
|
233
|
+
* @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
|
|
234
|
+
* @template TError The validation error type. It will be either `string` or a `null`. It can be in `[start, end]` format in case of range value.
|
|
233
235
|
* @param {TValue} value The new value.
|
|
234
236
|
* @param {FieldChangeHandlerContext<TError>} context The context containing the validation result of the current value.
|
|
235
237
|
*/
|
|
@@ -239,11 +241,13 @@ process.env.NODE_ENV !== "production" ? SingleInputDateTimeRangeField.propTypes
|
|
|
239
241
|
*/
|
|
240
242
|
onClear: PropTypes.func,
|
|
241
243
|
/**
|
|
242
|
-
* Callback fired when the error associated
|
|
243
|
-
*
|
|
244
|
-
*
|
|
245
|
-
* @
|
|
246
|
-
* @
|
|
244
|
+
* Callback fired when the error associated with the current value changes.
|
|
245
|
+
* When a validation error is detected, the `error` parameter contains a non-null value.
|
|
246
|
+
* This can be used to render an appropriate form error.
|
|
247
|
+
* @template TError The validation error type. It will be either `string` or a `null`. It can be in `[start, end]` format in case of range value.
|
|
248
|
+
* @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
|
|
249
|
+
* @param {TError} error The reason why the current value is not valid.
|
|
250
|
+
* @param {TValue} value The value associated with the error.
|
|
247
251
|
*/
|
|
248
252
|
onError: PropTypes.func,
|
|
249
253
|
onFocus: PropTypes.func,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { SingleInputDateTimeRangeField } from
|
|
2
|
-
export { useSingleInputDateTimeRangeField as unstable_useSingleInputDateTimeRangeField } from
|
|
1
|
+
export { SingleInputDateTimeRangeField } from "./SingleInputDateTimeRangeField.js";
|
|
2
|
+
export { useSingleInputDateTimeRangeField as unstable_useSingleInputDateTimeRangeField } from "./useSingleInputDateTimeRangeField.js";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
2
2
|
import { UseSingleInputDateTimeRangeFieldProps } from './SingleInputDateTimeRangeField.types';
|
|
3
|
-
export declare const useSingleInputDateTimeRangeField: <TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean, TAllProps extends UseSingleInputDateTimeRangeFieldProps<TDate, TEnableAccessibleFieldDOMStructure>>(inProps: TAllProps) => import("@mui/x-date-pickers/internals").UseFieldResponse<TEnableAccessibleFieldDOMStructure, Omit<TAllProps & Omit<UseSingleInputDateTimeRangeFieldProps<TDate, TEnableAccessibleFieldDOMStructure>, keyof import("@mui/x-date-pickers/internals/hooks/defaultizedFieldProps").UseDefaultizedDateTimeFieldBaseProps<any>> & Required<Pick<UseSingleInputDateTimeRangeFieldProps<TDate, TEnableAccessibleFieldDOMStructure>, keyof import("@mui/x-date-pickers/internals/hooks/defaultizedFieldProps").UseDefaultizedDateTimeFieldBaseProps<any>>>,
|
|
3
|
+
export declare const useSingleInputDateTimeRangeField: <TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean, TAllProps extends UseSingleInputDateTimeRangeFieldProps<TDate, TEnableAccessibleFieldDOMStructure>>(inProps: TAllProps) => import("@mui/x-date-pickers/internals").UseFieldResponse<TEnableAccessibleFieldDOMStructure, Omit<TAllProps & Omit<UseSingleInputDateTimeRangeFieldProps<TDate, TEnableAccessibleFieldDOMStructure>, keyof import("@mui/x-date-pickers/internals/hooks/defaultizedFieldProps").UseDefaultizedDateTimeFieldBaseProps<any>> & Required<Pick<UseSingleInputDateTimeRangeFieldProps<TDate, TEnableAccessibleFieldDOMStructure>, keyof import("@mui/x-date-pickers/internals/hooks/defaultizedFieldProps").UseDefaultizedDateTimeFieldBaseProps<any>>>, "disabled" | "format" | "onChange" | "onError" | "defaultValue" | "value" | "readOnly" | "referenceDate" | "timezone" | "formatDensity" | "enableAccessibleFieldDOMStructure" | "selectedSections" | "onSelectedSectionsChange" | "shouldRespectLeadingZeros" | "unstableFieldRef" | "ampm" | "disableFuture" | "maxDate" | "disablePast" | "minDate" | "minTime" | "maxTime" | "minutesStep" | "shouldDisableTime" | "disableIgnoringDatePartForTimeValidation" | "minDateTime" | "maxDateTime" | "shouldDisableDate" | "shouldDisableMonth" | "shouldDisableYear" | "dateSeparator">>;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import * as React from 'react';
|
|
2
|
-
import { useField,
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
4
|
+
import { useField, useDefaultizedDateTimeField } from '@mui/x-date-pickers/internals';
|
|
5
|
+
import { useSplitFieldProps } from '@mui/x-date-pickers/hooks';
|
|
6
|
+
import { rangeValueManager, getRangeFieldValueManager } from "../internals/utils/valueManagers.js";
|
|
7
|
+
import { validateDateTimeRange } from "../validation/index.js";
|
|
5
8
|
export const useSingleInputDateTimeRangeField = inProps => {
|
|
6
9
|
const props = useDefaultizedDateTimeField(inProps);
|
|
7
10
|
const {
|
|
8
11
|
forwardedProps,
|
|
9
12
|
internalProps
|
|
10
|
-
} =
|
|
13
|
+
} = useSplitFieldProps(props, 'date-time');
|
|
11
14
|
const fieldValueManager = React.useMemo(() => getRangeFieldValueManager({
|
|
12
15
|
dateSeparator: internalProps.dateSeparator
|
|
13
16
|
}), [internalProps.dateSeparator]);
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
5
|
const _excluded = ["slots", "slotProps", "InputProps", "inputProps"];
|
|
@@ -10,7 +12,7 @@ import { PickersTextField } from '@mui/x-date-pickers/PickersTextField';
|
|
|
10
12
|
import { useThemeProps } from '@mui/material/styles';
|
|
11
13
|
import useSlotProps from '@mui/utils/useSlotProps';
|
|
12
14
|
import { refType } from '@mui/utils';
|
|
13
|
-
import { useSingleInputTimeRangeField } from
|
|
15
|
+
import { useSingleInputTimeRangeField } from "./useSingleInputTimeRangeField.js";
|
|
14
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
17
|
/**
|
|
16
18
|
* Demos:
|
|
@@ -210,8 +212,8 @@ process.env.NODE_ENV !== "production" ? SingleInputTimeRangeField.propTypes = {
|
|
|
210
212
|
onBlur: PropTypes.func,
|
|
211
213
|
/**
|
|
212
214
|
* Callback fired when the value changes.
|
|
213
|
-
* @template TValue The value type.
|
|
214
|
-
* @template TError The validation error type.
|
|
215
|
+
* @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
|
|
216
|
+
* @template TError The validation error type. It will be either `string` or a `null`. It can be in `[start, end]` format in case of range value.
|
|
215
217
|
* @param {TValue} value The new value.
|
|
216
218
|
* @param {FieldChangeHandlerContext<TError>} context The context containing the validation result of the current value.
|
|
217
219
|
*/
|
|
@@ -221,11 +223,13 @@ process.env.NODE_ENV !== "production" ? SingleInputTimeRangeField.propTypes = {
|
|
|
221
223
|
*/
|
|
222
224
|
onClear: PropTypes.func,
|
|
223
225
|
/**
|
|
224
|
-
* Callback fired when the error associated
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
* @
|
|
228
|
-
* @
|
|
226
|
+
* Callback fired when the error associated with the current value changes.
|
|
227
|
+
* When a validation error is detected, the `error` parameter contains a non-null value.
|
|
228
|
+
* This can be used to render an appropriate form error.
|
|
229
|
+
* @template TError The validation error type. It will be either `string` or a `null`. It can be in `[start, end]` format in case of range value.
|
|
230
|
+
* @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
|
|
231
|
+
* @param {TError} error The reason why the current value is not valid.
|
|
232
|
+
* @param {TValue} value The value associated with the error.
|
|
229
233
|
*/
|
|
230
234
|
onError: PropTypes.func,
|
|
231
235
|
onFocus: PropTypes.func,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { SingleInputTimeRangeField } from
|
|
2
|
-
export { useSingleInputTimeRangeField as unstable_useSingleInputTimeRangeField } from
|
|
1
|
+
export { SingleInputTimeRangeField } from "./SingleInputTimeRangeField.js";
|
|
2
|
+
export { useSingleInputTimeRangeField as unstable_useSingleInputTimeRangeField } from "./useSingleInputTimeRangeField.js";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
2
2
|
import { UseSingleInputTimeRangeFieldProps } from './SingleInputTimeRangeField.types';
|
|
3
|
-
export declare const useSingleInputTimeRangeField: <TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean, TAllProps extends UseSingleInputTimeRangeFieldProps<TDate, TEnableAccessibleFieldDOMStructure>>(inProps: TAllProps) => import("@mui/x-date-pickers/internals").UseFieldResponse<TEnableAccessibleFieldDOMStructure, Omit<TAllProps & Omit<UseSingleInputTimeRangeFieldProps<TDate, TEnableAccessibleFieldDOMStructure>, keyof import("@mui/x-date-pickers/internals/hooks/defaultizedFieldProps").UseDefaultizedTimeFieldBaseProps> & Required<Pick<UseSingleInputTimeRangeFieldProps<TDate, TEnableAccessibleFieldDOMStructure>, keyof import("@mui/x-date-pickers/internals/hooks/defaultizedFieldProps").UseDefaultizedTimeFieldBaseProps>>, keyof
|
|
3
|
+
export declare const useSingleInputTimeRangeField: <TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean, TAllProps extends UseSingleInputTimeRangeFieldProps<TDate, TEnableAccessibleFieldDOMStructure>>(inProps: TAllProps) => import("@mui/x-date-pickers/internals").UseFieldResponse<TEnableAccessibleFieldDOMStructure, Omit<TAllProps & Omit<UseSingleInputTimeRangeFieldProps<TDate, TEnableAccessibleFieldDOMStructure>, keyof import("@mui/x-date-pickers/internals/hooks/defaultizedFieldProps").UseDefaultizedTimeFieldBaseProps> & Required<Pick<UseSingleInputTimeRangeFieldProps<TDate, TEnableAccessibleFieldDOMStructure>, keyof import("@mui/x-date-pickers/internals/hooks/defaultizedFieldProps").UseDefaultizedTimeFieldBaseProps>>, "disabled" | "format" | "onChange" | "onError" | "defaultValue" | "value" | "readOnly" | "referenceDate" | "timezone" | "formatDensity" | "enableAccessibleFieldDOMStructure" | "selectedSections" | "onSelectedSectionsChange" | "shouldRespectLeadingZeros" | "unstableFieldRef" | "ampm" | keyof import("@mui/x-date-pickers/internals").BaseTimeValidationProps | keyof import("@mui/x-date-pickers/internals").TimeValidationProps<any> | "dateSeparator">>;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import * as React from 'react';
|
|
2
|
-
import { useField,
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
4
|
+
import { useField, useDefaultizedTimeField } from '@mui/x-date-pickers/internals';
|
|
5
|
+
import { useSplitFieldProps } from '@mui/x-date-pickers/hooks';
|
|
6
|
+
import { rangeValueManager, getRangeFieldValueManager } from "../internals/utils/valueManagers.js";
|
|
7
|
+
import { validateTimeRange } from "../validation/index.js";
|
|
5
8
|
export const useSingleInputTimeRangeField = inProps => {
|
|
6
9
|
const props = useDefaultizedTimeField(inProps);
|
|
7
10
|
const {
|
|
8
11
|
forwardedProps,
|
|
9
12
|
internalProps
|
|
10
|
-
} =
|
|
13
|
+
} = useSplitFieldProps(props, 'time');
|
|
11
14
|
const fieldValueManager = React.useMemo(() => getRangeFieldValueManager({
|
|
12
15
|
dateSeparator: internalProps.dateSeparator
|
|
13
16
|
}), [internalProps.dateSeparator]);
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
4
|
import * as React from 'react';
|
|
3
5
|
import PropTypes from 'prop-types';
|
|
4
|
-
import { useStaticRangePicker } from
|
|
5
|
-
import { useDateRangePickerDefaultizedProps } from
|
|
6
|
-
import { renderDateRangeViewCalendar } from
|
|
7
|
-
import { rangeValueManager } from
|
|
8
|
-
import { validateDateRange } from
|
|
6
|
+
import { useStaticRangePicker } from "../internals/hooks/useStaticRangePicker/index.js";
|
|
7
|
+
import { useDateRangePickerDefaultizedProps } from "../DateRangePicker/shared.js";
|
|
8
|
+
import { renderDateRangeViewCalendar } from "../dateRangeViewRenderers/index.js";
|
|
9
|
+
import { rangeValueManager } from "../internals/utils/valueManagers.js";
|
|
10
|
+
import { validateDateRange } from "../validation/index.js";
|
|
9
11
|
/**
|
|
10
12
|
* Demos:
|
|
11
13
|
*
|
|
@@ -155,16 +157,16 @@ StaticDateRangePicker.propTypes = {
|
|
|
155
157
|
minDate: PropTypes.object,
|
|
156
158
|
/**
|
|
157
159
|
* Callback fired when the value is accepted.
|
|
158
|
-
* @template TValue The value type.
|
|
159
|
-
* @template TError The validation error type.
|
|
160
|
+
* @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
|
|
161
|
+
* @template TError The validation error type. It will be either `string` or a `null`. It can be in `[start, end]` format in case of range value.
|
|
160
162
|
* @param {TValue} value The value that was just accepted.
|
|
161
163
|
* @param {FieldChangeHandlerContext<TError>} context The context containing the validation result of the current value.
|
|
162
164
|
*/
|
|
163
165
|
onAccept: PropTypes.func,
|
|
164
166
|
/**
|
|
165
167
|
* Callback fired when the value changes.
|
|
166
|
-
* @template TValue The value type.
|
|
167
|
-
* @template TError The validation error type.
|
|
168
|
+
* @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
|
|
169
|
+
* @template TError The validation error type. It will be either `string` or a `null`. It can be in `[start, end]` format in case of range value.
|
|
168
170
|
* @param {TValue} value The new value.
|
|
169
171
|
* @param {FieldChangeHandlerContext<TError>} context The context containing the validation result of the current value.
|
|
170
172
|
*/
|
|
@@ -176,13 +178,13 @@ StaticDateRangePicker.propTypes = {
|
|
|
176
178
|
*/
|
|
177
179
|
onClose: PropTypes.func,
|
|
178
180
|
/**
|
|
179
|
-
* Callback fired when the error associated
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
* @template
|
|
183
|
-
* @template
|
|
184
|
-
* @param {TError} error The
|
|
185
|
-
* @param {TValue} value The value associated
|
|
181
|
+
* Callback fired when the error associated with the current value changes.
|
|
182
|
+
* When a validation error is detected, the `error` parameter contains a non-null value.
|
|
183
|
+
* This can be used to render an appropriate form error.
|
|
184
|
+
* @template TError The validation error type. It will be either `string` or a `null`. It can be in `[start, end]` format in case of range value.
|
|
185
|
+
* @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
|
|
186
|
+
* @param {TError} error The reason why the current value is not valid.
|
|
187
|
+
* @param {TValue} value The value associated with the error.
|
|
186
188
|
*/
|
|
187
189
|
onError: PropTypes.func,
|
|
188
190
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { StaticDateRangePicker } from
|
|
1
|
+
export { StaticDateRangePicker } from "./StaticDateRangePicker.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { DateRangeCalendar } from
|
|
2
|
+
import { DateRangeCalendar } from "../DateRangeCalendar/index.js";
|
|
3
3
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
4
|
/**
|
|
5
5
|
* We don't pass all the props down to `DateRangeCalendar`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { renderDateRangeViewCalendar } from
|
|
1
|
+
export { renderDateRangeViewCalendar } from "./dateRangeViewRenderers.js";
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-date-pickers-pro v7.
|
|
2
|
+
* @mui/x-date-pickers-pro v7.17.0
|
|
3
3
|
*
|
|
4
4
|
* @license MUI X Commercial
|
|
5
5
|
* This source code is licensed under the commercial license found in the
|
|
@@ -12,29 +12,30 @@ import { LicenseInfo as LicenseInfoExport } from '@mui/x-license';
|
|
|
12
12
|
*/
|
|
13
13
|
export class LicenseInfo extends LicenseInfoExport {}
|
|
14
14
|
export * from '@mui/x-date-pickers';
|
|
15
|
-
export * from
|
|
15
|
+
export * from "./DateRangePickerDay/index.js";
|
|
16
16
|
|
|
17
17
|
// Fields
|
|
18
|
-
export * from
|
|
19
|
-
export * from
|
|
20
|
-
export * from
|
|
21
|
-
export * from
|
|
22
|
-
export * from
|
|
23
|
-
export * from
|
|
18
|
+
export * from "./MultiInputDateRangeField/index.js";
|
|
19
|
+
export * from "./MultiInputTimeRangeField/index.js";
|
|
20
|
+
export * from "./MultiInputDateTimeRangeField/index.js";
|
|
21
|
+
export * from "./SingleInputDateRangeField/index.js";
|
|
22
|
+
export * from "./SingleInputTimeRangeField/index.js";
|
|
23
|
+
export * from "./SingleInputDateTimeRangeField/index.js";
|
|
24
24
|
|
|
25
25
|
// Calendars
|
|
26
|
-
export * from
|
|
27
|
-
export * from
|
|
26
|
+
export * from "./DateRangeCalendar/index.js";
|
|
27
|
+
export * from "./PickersRangeCalendarHeader/index.js";
|
|
28
28
|
|
|
29
29
|
// New pickers
|
|
30
|
-
export * from
|
|
31
|
-
export * from
|
|
32
|
-
export * from
|
|
33
|
-
export * from
|
|
34
|
-
export * from
|
|
35
|
-
export * from
|
|
36
|
-
export * from
|
|
30
|
+
export * from "./DateRangePicker/index.js";
|
|
31
|
+
export * from "./DesktopDateRangePicker/index.js";
|
|
32
|
+
export * from "./MobileDateRangePicker/index.js";
|
|
33
|
+
export * from "./StaticDateRangePicker/index.js";
|
|
34
|
+
export * from "./DateTimeRangePicker/index.js";
|
|
35
|
+
export * from "./DesktopDateTimeRangePicker/index.js";
|
|
36
|
+
export * from "./MobileDateTimeRangePicker/index.js";
|
|
37
37
|
|
|
38
38
|
// View renderers
|
|
39
|
-
export * from
|
|
40
|
-
export * from
|
|
39
|
+
export * from "./dateRangeViewRenderers/index.js";
|
|
40
|
+
export * from "./models/index.js";
|
|
41
|
+
export * from "./validation/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { useDesktopRangePicker } from
|
|
1
|
+
export { useDesktopRangePicker } from "./useDesktopRangePicker.js";
|
|
@@ -7,9 +7,9 @@ import { useLicenseVerifier } from '@mui/x-license';
|
|
|
7
7
|
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
|
|
8
8
|
import { PickersLayout } from '@mui/x-date-pickers/PickersLayout';
|
|
9
9
|
import { executeInTheNextEventLoopTick, getActiveElement, usePicker, PickersPopper } from '@mui/x-date-pickers/internals';
|
|
10
|
-
import { useEnrichedRangePickerFieldProps } from
|
|
11
|
-
import { getReleaseInfo } from
|
|
12
|
-
import { useRangePosition } from
|
|
10
|
+
import { useEnrichedRangePickerFieldProps } from "../useEnrichedRangePickerFieldProps.js";
|
|
11
|
+
import { getReleaseInfo } from "../../utils/releaseInfo.js";
|
|
12
|
+
import { useRangePosition } from "../useRangePosition.js";
|
|
13
13
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
14
|
const releaseInfo = getReleaseInfo();
|
|
15
15
|
export const useDesktopRangePicker = _ref => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { useMobileRangePicker } from
|
|
1
|
+
export { useMobileRangePicker } from "./useMobileRangePicker.js";
|
|
@@ -9,9 +9,9 @@ import { PickersLayout } from '@mui/x-date-pickers/PickersLayout';
|
|
|
9
9
|
import { usePicker, PickersModalDialog } from '@mui/x-date-pickers/internals';
|
|
10
10
|
import { usePickersTranslations } from '@mui/x-date-pickers/hooks';
|
|
11
11
|
import useId from '@mui/utils/useId';
|
|
12
|
-
import { useEnrichedRangePickerFieldProps } from
|
|
13
|
-
import { getReleaseInfo } from
|
|
14
|
-
import { useRangePosition } from
|
|
12
|
+
import { useEnrichedRangePickerFieldProps } from "../useEnrichedRangePickerFieldProps.js";
|
|
13
|
+
import { getReleaseInfo } from "../../utils/releaseInfo.js";
|
|
14
|
+
import { useRangePosition } from "../useRangePosition.js";
|
|
15
15
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
16
|
const releaseInfo = getReleaseInfo();
|
|
17
17
|
export const useMobileRangePicker = _ref => {
|
|
@@ -1,11 +1,12 @@
|
|
|
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 {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
4
|
+
import { useControlledValueWithTimezone, useDefaultizedDateField } from '@mui/x-date-pickers/internals';
|
|
5
|
+
import { useValidation } from '@mui/x-date-pickers/validation';
|
|
6
|
+
import { validateDateRange } from "../../../validation/index.js";
|
|
7
|
+
import { rangeValueManager } from "../../utils/valueManagers.js";
|
|
8
|
+
import { excludeProps } from "./shared.js";
|
|
9
|
+
import { useMultiInputFieldSelectedSections } from "../useMultiInputFieldSelectedSections.js";
|
|
9
10
|
export const useMultiInputDateRangeField = ({
|
|
10
11
|
sharedProps: inSharedProps,
|
|
11
12
|
startTextFieldProps,
|
|
@@ -14,7 +15,6 @@ export const useMultiInputDateRangeField = ({
|
|
|
14
15
|
unstableEndFieldRef
|
|
15
16
|
}) => {
|
|
16
17
|
const sharedProps = useDefaultizedDateField(inSharedProps);
|
|
17
|
-
const adapter = useLocalizationContext();
|
|
18
18
|
const {
|
|
19
19
|
value: valueProp,
|
|
20
20
|
defaultValue,
|
|
@@ -42,29 +42,29 @@ export const useMultiInputDateRangeField = ({
|
|
|
42
42
|
onChange,
|
|
43
43
|
valueManager: rangeValueManager
|
|
44
44
|
});
|
|
45
|
+
const {
|
|
46
|
+
validationError,
|
|
47
|
+
getValidationErrorForNewValue
|
|
48
|
+
} = useValidation({
|
|
49
|
+
props: sharedProps,
|
|
50
|
+
value,
|
|
51
|
+
timezone,
|
|
52
|
+
validator: validateDateRange,
|
|
53
|
+
onError: sharedProps.onError
|
|
54
|
+
});
|
|
45
55
|
|
|
46
56
|
// TODO: Maybe export utility from `useField` instead of copy/pasting the logic
|
|
47
57
|
const buildChangeHandler = index => {
|
|
48
58
|
return (newDate, rawContext) => {
|
|
49
59
|
const newDateRange = index === 0 ? [newDate, value[1]] : [value[0], newDate];
|
|
50
60
|
const context = _extends({}, rawContext, {
|
|
51
|
-
validationError:
|
|
52
|
-
adapter,
|
|
53
|
-
value: newDateRange,
|
|
54
|
-
props: _extends({}, sharedProps, {
|
|
55
|
-
timezone
|
|
56
|
-
})
|
|
57
|
-
})
|
|
61
|
+
validationError: getValidationErrorForNewValue(newDateRange)
|
|
58
62
|
});
|
|
59
63
|
handleValueChange(newDateRange, context);
|
|
60
64
|
};
|
|
61
65
|
};
|
|
62
66
|
const handleStartDateChange = useEventCallback(buildChangeHandler(0));
|
|
63
67
|
const handleEndDateChange = useEventCallback(buildChangeHandler(1));
|
|
64
|
-
const validationError = useValidation(_extends({}, sharedProps, {
|
|
65
|
-
value,
|
|
66
|
-
timezone
|
|
67
|
-
}), validateDateRange, rangeValueManager.isSameError, rangeValueManager.defaultErrorState);
|
|
68
68
|
const selectedSectionsResponse = useMultiInputFieldSelectedSections({
|
|
69
69
|
selectedSections,
|
|
70
70
|
onSelectedSectionsChange,
|
|
@@ -1,11 +1,12 @@
|
|
|
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 {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
4
|
+
import { useControlledValueWithTimezone, useDefaultizedDateTimeField } from '@mui/x-date-pickers/internals';
|
|
5
|
+
import { useValidation } from '@mui/x-date-pickers/validation';
|
|
6
|
+
import { validateDateTimeRange } from "../../../validation/index.js";
|
|
7
|
+
import { rangeValueManager } from "../../utils/valueManagers.js";
|
|
8
|
+
import { excludeProps } from "./shared.js";
|
|
9
|
+
import { useMultiInputFieldSelectedSections } from "../useMultiInputFieldSelectedSections.js";
|
|
9
10
|
export const useMultiInputDateTimeRangeField = ({
|
|
10
11
|
sharedProps: inSharedProps,
|
|
11
12
|
startTextFieldProps,
|
|
@@ -14,7 +15,6 @@ export const useMultiInputDateTimeRangeField = ({
|
|
|
14
15
|
unstableEndFieldRef
|
|
15
16
|
}) => {
|
|
16
17
|
const sharedProps = useDefaultizedDateTimeField(inSharedProps);
|
|
17
|
-
const adapter = useLocalizationContext();
|
|
18
18
|
const {
|
|
19
19
|
value: valueProp,
|
|
20
20
|
defaultValue,
|
|
@@ -42,29 +42,29 @@ export const useMultiInputDateTimeRangeField = ({
|
|
|
42
42
|
onChange,
|
|
43
43
|
valueManager: rangeValueManager
|
|
44
44
|
});
|
|
45
|
+
const {
|
|
46
|
+
validationError,
|
|
47
|
+
getValidationErrorForNewValue
|
|
48
|
+
} = useValidation({
|
|
49
|
+
props: sharedProps,
|
|
50
|
+
value,
|
|
51
|
+
timezone,
|
|
52
|
+
validator: validateDateTimeRange,
|
|
53
|
+
onError: sharedProps.onError
|
|
54
|
+
});
|
|
45
55
|
|
|
46
56
|
// TODO: Maybe export utility from `useField` instead of copy/pasting the logic
|
|
47
57
|
const buildChangeHandler = index => {
|
|
48
58
|
return (newDate, rawContext) => {
|
|
49
59
|
const newDateRange = index === 0 ? [newDate, value[1]] : [value[0], newDate];
|
|
50
60
|
const context = _extends({}, rawContext, {
|
|
51
|
-
validationError:
|
|
52
|
-
adapter,
|
|
53
|
-
value: newDateRange,
|
|
54
|
-
props: _extends({}, sharedProps, {
|
|
55
|
-
timezone
|
|
56
|
-
})
|
|
57
|
-
})
|
|
61
|
+
validationError: getValidationErrorForNewValue(newDateRange)
|
|
58
62
|
});
|
|
59
63
|
handleValueChange(newDateRange, context);
|
|
60
64
|
};
|
|
61
65
|
};
|
|
62
66
|
const handleStartDateChange = useEventCallback(buildChangeHandler(0));
|
|
63
67
|
const handleEndDateChange = useEventCallback(buildChangeHandler(1));
|
|
64
|
-
const validationError = useValidation(_extends({}, sharedProps, {
|
|
65
|
-
value,
|
|
66
|
-
timezone
|
|
67
|
-
}), validateDateTimeRange, rangeValueManager.isSameError, rangeValueManager.defaultErrorState);
|
|
68
68
|
const selectedSectionsResponse = useMultiInputFieldSelectedSections({
|
|
69
69
|
selectedSections,
|
|
70
70
|
onSelectedSectionsChange,
|
|
@@ -1,11 +1,12 @@
|
|
|
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 {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
4
|
+
import { useControlledValueWithTimezone, useDefaultizedTimeField } from '@mui/x-date-pickers/internals';
|
|
5
|
+
import { useValidation } from '@mui/x-date-pickers/validation';
|
|
6
|
+
import { validateTimeRange } from "../../../validation/index.js";
|
|
7
|
+
import { rangeValueManager } from "../../utils/valueManagers.js";
|
|
8
|
+
import { excludeProps } from "./shared.js";
|
|
9
|
+
import { useMultiInputFieldSelectedSections } from "../useMultiInputFieldSelectedSections.js";
|
|
9
10
|
export const useMultiInputTimeRangeField = ({
|
|
10
11
|
sharedProps: inSharedProps,
|
|
11
12
|
startTextFieldProps,
|
|
@@ -14,7 +15,6 @@ export const useMultiInputTimeRangeField = ({
|
|
|
14
15
|
unstableEndFieldRef
|
|
15
16
|
}) => {
|
|
16
17
|
const sharedProps = useDefaultizedTimeField(inSharedProps);
|
|
17
|
-
const adapter = useLocalizationContext();
|
|
18
18
|
const {
|
|
19
19
|
value: valueProp,
|
|
20
20
|
defaultValue,
|
|
@@ -42,29 +42,29 @@ export const useMultiInputTimeRangeField = ({
|
|
|
42
42
|
onChange,
|
|
43
43
|
valueManager: rangeValueManager
|
|
44
44
|
});
|
|
45
|
+
const {
|
|
46
|
+
validationError,
|
|
47
|
+
getValidationErrorForNewValue
|
|
48
|
+
} = useValidation({
|
|
49
|
+
props: sharedProps,
|
|
50
|
+
validator: validateTimeRange,
|
|
51
|
+
value,
|
|
52
|
+
timezone,
|
|
53
|
+
onError: sharedProps.onError
|
|
54
|
+
});
|
|
45
55
|
|
|
46
56
|
// TODO: Maybe export utility from `useField` instead of copy/pasting the logic
|
|
47
57
|
const buildChangeHandler = index => {
|
|
48
58
|
return (newDate, rawContext) => {
|
|
49
59
|
const newDateRange = index === 0 ? [newDate, value[1]] : [value[0], newDate];
|
|
50
60
|
const context = _extends({}, rawContext, {
|
|
51
|
-
validationError:
|
|
52
|
-
adapter,
|
|
53
|
-
value: newDateRange,
|
|
54
|
-
props: _extends({}, sharedProps, {
|
|
55
|
-
timezone
|
|
56
|
-
})
|
|
57
|
-
})
|
|
61
|
+
validationError: getValidationErrorForNewValue(newDateRange)
|
|
58
62
|
});
|
|
59
63
|
handleValueChange(newDateRange, context);
|
|
60
64
|
};
|
|
61
65
|
};
|
|
62
66
|
const handleStartDateChange = useEventCallback(buildChangeHandler(0));
|
|
63
67
|
const handleEndDateChange = useEventCallback(buildChangeHandler(1));
|
|
64
|
-
const validationError = useValidation(_extends({}, sharedProps, {
|
|
65
|
-
value,
|
|
66
|
-
timezone
|
|
67
|
-
}), validateTimeRange, rangeValueManager.isSameError, rangeValueManager.defaultErrorState);
|
|
68
68
|
const selectedSectionsResponse = useMultiInputFieldSelectedSections({
|
|
69
69
|
selectedSections,
|
|
70
70
|
onSelectedSectionsChange,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { useStaticRangePicker } from
|
|
1
|
+
export { useStaticRangePicker } from "./useStaticRangePicker.js";
|
|
@@ -7,7 +7,7 @@ import { styled } from '@mui/material/styles';
|
|
|
7
7
|
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
|
|
8
8
|
import { PickersLayout } from '@mui/x-date-pickers/PickersLayout';
|
|
9
9
|
import { usePicker, DIALOG_WIDTH } from '@mui/x-date-pickers/internals';
|
|
10
|
-
import { useRangePosition } from
|
|
10
|
+
import { useRangePosition } from "../useRangePosition.js";
|
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
const PickerStaticLayout = styled(PickersLayout)(({
|
|
13
13
|
theme
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
1
|
+
export * from "./dateRange.js";
|
|
2
|
+
export * from "./dateTimeRange.js";
|
|
3
|
+
export * from "./timeRange.js";
|
|
4
|
+
export * from "./rangePickerProps.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export const getReleaseInfo = () => {
|
|
3
|
-
const releaseInfo = "
|
|
3
|
+
const releaseInfo = "MTcyNjE5NjQwMDAwMA==";
|
|
4
4
|
if (process.env.NODE_ENV !== 'production') {
|
|
5
5
|
// A simple hack to set the value in the test environment (has no build step).
|
|
6
6
|
// eslint-disable-next-line no-useless-concat
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
3
|
const _excluded = ["value", "referenceDate"];
|
|
4
4
|
import { replaceInvalidDateByNull, createDateStrForV7HiddenInputFromSections, createDateStrForV6InputFromSections, areDatesEqual, getTodayDate, getDefaultReferenceDate } from '@mui/x-date-pickers/internals';
|
|
5
|
-
import { splitDateRangeSections, removeLastSeparator } from
|
|
5
|
+
import { splitDateRangeSections, removeLastSeparator } from "./date-fields-utils.js";
|
|
6
6
|
export const rangeValueManager = {
|
|
7
7
|
emptyValue: [null, null],
|
|
8
8
|
getTodayValue: (utils, timezone, valueType) => [getTodayDate(utils, timezone, valueType), getTodayDate(utils, timezone, valueType)],
|
package/models/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
1
|
+
export * from "./dateRange.js";
|
|
2
|
+
export * from "./fields.js";
|
|
3
|
+
export * from "./range.js";
|
|
4
|
+
export * from "./validation.js";
|
|
5
|
+
export * from "./multiInputRangeFieldClasses.js";
|