@mui/x-date-pickers-pro 7.16.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 +87 -0
- package/DateRangeCalendar/DateRangeCalendar.js +5 -2
- package/DateRangeCalendar/useDragRange.js +2 -0
- package/DateRangePicker/DateRangePicker.js +2 -0
- package/DateRangePicker/DateRangePickerToolbar.js +2 -0
- package/DateRangePickerDay/DateRangePickerDay.js +2 -0
- package/DateTimeRangePicker/DateTimeRangePicker.js +2 -0
- package/DateTimeRangePicker/DateTimeRangePickerTabs.js +2 -0
- package/DateTimeRangePicker/DateTimeRangePickerToolbar.js +2 -0
- package/DesktopDateRangePicker/DesktopDateRangePicker.js +4 -2
- package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +5 -2
- package/MobileDateRangePicker/MobileDateRangePicker.js +4 -2
- package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +5 -2
- package/MultiInputDateRangeField/MultiInputDateRangeField.js +5 -2
- package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +5 -2
- package/MultiInputTimeRangeField/MultiInputTimeRangeField.js +5 -2
- package/PickersRangeCalendarHeader/PickersRangeCalendarHeader.js +2 -0
- package/SingleInputDateRangeField/SingleInputDateRangeField.js +2 -0
- package/SingleInputDateRangeField/useSingleInputDateRangeField.d.ts +1 -1
- package/SingleInputDateRangeField/useSingleInputDateRangeField.js +6 -3
- package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +2 -0
- package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.d.ts +1 -1
- package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +6 -3
- package/SingleInputTimeRangeField/SingleInputTimeRangeField.js +2 -0
- package/SingleInputTimeRangeField/useSingleInputTimeRangeField.d.ts +1 -1
- package/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +6 -3
- package/StaticDateRangePicker/StaticDateRangePicker.js +3 -1
- package/index.d.ts +1 -0
- package/index.js +3 -2
- package/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +14 -14
- package/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +14 -14
- package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +14 -14
- package/internals/utils/releaseInfo.js +1 -1
- package/modern/DateRangeCalendar/DateRangeCalendar.js +5 -2
- package/modern/DateRangeCalendar/useDragRange.js +2 -0
- package/modern/DateRangePicker/DateRangePicker.js +2 -0
- package/modern/DateRangePicker/DateRangePickerToolbar.js +2 -0
- package/modern/DateRangePickerDay/DateRangePickerDay.js +2 -0
- package/modern/DateTimeRangePicker/DateTimeRangePicker.js +2 -0
- package/modern/DateTimeRangePicker/DateTimeRangePickerTabs.js +2 -0
- package/modern/DateTimeRangePicker/DateTimeRangePickerToolbar.js +2 -0
- package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +4 -2
- package/modern/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +5 -2
- package/modern/MobileDateRangePicker/MobileDateRangePicker.js +4 -2
- package/modern/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +5 -2
- package/modern/MultiInputDateRangeField/MultiInputDateRangeField.js +5 -2
- package/modern/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +5 -2
- package/modern/MultiInputTimeRangeField/MultiInputTimeRangeField.js +5 -2
- package/modern/PickersRangeCalendarHeader/PickersRangeCalendarHeader.js +2 -0
- package/modern/SingleInputDateRangeField/SingleInputDateRangeField.js +2 -0
- package/modern/SingleInputDateRangeField/useSingleInputDateRangeField.js +6 -3
- package/modern/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +2 -0
- package/modern/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +6 -3
- package/modern/SingleInputTimeRangeField/SingleInputTimeRangeField.js +2 -0
- package/modern/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +6 -3
- package/modern/StaticDateRangePicker/StaticDateRangePicker.js +3 -1
- package/modern/index.js +3 -2
- package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +14 -14
- package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +14 -14
- package/modern/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +14 -14
- package/modern/internals/utils/releaseInfo.js +1 -1
- 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 +4 -2
- package/node/DateRangeCalendar/useDragRange.js +1 -0
- package/node/DateRangePicker/DateRangePicker.js +1 -0
- package/node/DateRangePicker/DateRangePickerToolbar.js +1 -0
- package/node/DateRangePickerDay/DateRangePickerDay.js +1 -0
- package/node/DateTimeRangePicker/DateTimeRangePicker.js +1 -0
- package/node/DateTimeRangePicker/DateTimeRangePickerTabs.js +1 -0
- package/node/DateTimeRangePicker/DateTimeRangePickerToolbar.js +1 -0
- package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +5 -4
- package/node/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +5 -3
- package/node/MobileDateRangePicker/MobileDateRangePicker.js +5 -4
- package/node/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +5 -3
- package/node/MultiInputDateRangeField/MultiInputDateRangeField.js +3 -1
- package/node/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +3 -1
- package/node/MultiInputTimeRangeField/MultiInputTimeRangeField.js +3 -1
- package/node/PickersRangeCalendarHeader/PickersRangeCalendarHeader.js +1 -0
- package/node/SingleInputDateRangeField/SingleInputDateRangeField.js +1 -0
- package/node/SingleInputDateRangeField/useSingleInputDateRangeField.js +5 -3
- package/node/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +1 -0
- package/node/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +5 -3
- package/node/SingleInputTimeRangeField/SingleInputTimeRangeField.js +1 -0
- package/node/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +5 -3
- package/node/StaticDateRangePicker/StaticDateRangePicker.js +3 -2
- package/node/index.js +13 -1
- package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +13 -13
- package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +13 -13
- package/node/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +13 -13
- package/node/internals/utils/releaseInfo.js +1 -1
- package/node/validation/index.js +26 -0
- package/node/{internals/utils/validation → validation}/validateDateRange.js +12 -7
- package/node/{internals/utils/validation → validation}/validateDateTimeRange.js +12 -7
- package/node/{internals/utils/validation → validation}/validateTimeRange.js +12 -7
- package/package.json +4 -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,8 +1,9 @@
|
|
|
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 {
|
|
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";
|
|
6
7
|
import { rangeValueManager } from "../../utils/valueManagers.js";
|
|
7
8
|
import { excludeProps } from "./shared.js";
|
|
8
9
|
import { useMultiInputFieldSelectedSections } from "../useMultiInputFieldSelectedSections.js";
|
|
@@ -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,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
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
4
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
5
|
const _excluded = ["value", "defaultValue", "referenceDate", "onChange", "className", "disableFuture", "disablePast", "minDate", "maxDate", "shouldDisableDate", "reduceAnimations", "onMonthChange", "rangePosition", "defaultRangePosition", "onRangePositionChange", "calendars", "currentMonthCalendarPosition", "slots", "slotProps", "loading", "renderLoading", "disableHighlightToday", "readOnly", "disabled", "showDaysOutsideCurrentMonth", "dayOfWeekFormatter", "disableAutoMonthSwitching", "autoFocus", "fixedWeekNumber", "disableDragEditing", "displayWeekNumber", "timezone", "availableRangePositions", "views", "view", "openTo", "onViewChange"],
|
|
@@ -13,7 +15,8 @@ import { styled, useThemeProps } from '@mui/material/styles';
|
|
|
13
15
|
import composeClasses from '@mui/utils/composeClasses';
|
|
14
16
|
import useId from '@mui/utils/useId';
|
|
15
17
|
import { Watermark } from '@mui/x-license';
|
|
16
|
-
import { applyDefaultDate, DayCalendar, useDefaultReduceAnimations, useCalendarState, useDefaultDates, useUtils, useNow, DEFAULT_DESKTOP_MODE_MEDIA_QUERY,
|
|
18
|
+
import { applyDefaultDate, DayCalendar, useDefaultReduceAnimations, useCalendarState, useDefaultDates, useUtils, useNow, DEFAULT_DESKTOP_MODE_MEDIA_QUERY, useControlledValueWithTimezone, useViews } from '@mui/x-date-pickers/internals';
|
|
19
|
+
import { warnOnce } from '@mui/x-internals/warning';
|
|
17
20
|
import { getReleaseInfo } from "../internals/utils/releaseInfo.js";
|
|
18
21
|
import { dateRangeCalendarClasses, getDateRangeCalendarUtilityClass } from "./dateRangeCalendarClasses.js";
|
|
19
22
|
import { isEndOfRange, isRangeValid, isStartOfRange, isWithinRange } from "../internals/utils/date-utils.js";
|
|
@@ -321,7 +324,7 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
|
|
|
321
324
|
if (disableAutoMonthSwitching && prevDate && utils.isEqual(prevDate, date)) {
|
|
322
325
|
return;
|
|
323
326
|
}
|
|
324
|
-
const displayingMonthRange = calendars -
|
|
327
|
+
const displayingMonthRange = calendars - currentMonthCalendarPosition;
|
|
325
328
|
const currentMonthNumber = utils.getMonth(calendarState.currentMonth);
|
|
326
329
|
const requestedMonthNumber = utils.getMonth(date);
|
|
327
330
|
if (!utils.isSameYear(calendarState.currentMonth, date) || requestedMonthNumber < currentMonthNumber || requestedMonthNumber > currentMonthNumber + displayingMonthRange) {
|
|
@@ -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 = ["value", "rangePosition", "onRangePositionChange", "toolbarFormat", "className", "onViewChange", "view", "views"];
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
4
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
5
|
const _excluded = ["className", "day", "outsideCurrentMonth", "isEndOfHighlighting", "isEndOfPreviewing", "isHighlighting", "isPreviewing", "isStartOfHighlighting", "isStartOfPreviewing", "selected", "isVisuallySelected", "sx", "draggable", "isFirstVisibleCell", "isLastVisibleCell"];
|
|
@@ -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 = ["value", "rangePosition", "onRangePositionChange", "className", "onViewChange", "toolbarVariant", "onChange", "classes", "view", "isLandscape", "views", "ampm", "disabled", "readOnly", "hidden", "toolbarFormat", "toolbarPlaceholder", "titleId", "sx"];
|
|
@@ -1,7 +1,9 @@
|
|
|
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 { extractValidationProps } from '@mui/x-date-pickers/
|
|
6
|
+
import { extractValidationProps } from '@mui/x-date-pickers/validation';
|
|
5
7
|
import resolveComponentProps from '@mui/utils/resolveComponentProps';
|
|
6
8
|
import { refType } from '@mui/utils';
|
|
7
9
|
import { rangeValueManager } from "../internals/utils/valueManagers.js";
|
|
@@ -9,7 +11,7 @@ import { useDateRangePickerDefaultizedProps } from "../DateRangePicker/shared.js
|
|
|
9
11
|
import { renderDateRangeViewCalendar } from "../dateRangeViewRenderers/index.js";
|
|
10
12
|
import { MultiInputDateRangeField } from "../MultiInputDateRangeField/index.js";
|
|
11
13
|
import { useDesktopRangePicker } from "../internals/hooks/useDesktopRangePicker/index.js";
|
|
12
|
-
import { validateDateRange } from "../
|
|
14
|
+
import { validateDateRange } from "../validation/index.js";
|
|
13
15
|
/**
|
|
14
16
|
* Demos:
|
|
15
17
|
*
|
|
@@ -1,9 +1,12 @@
|
|
|
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 = ["openTo", "rangePosition"];
|
|
4
6
|
import * as React from 'react';
|
|
5
7
|
import PropTypes from 'prop-types';
|
|
6
|
-
import {
|
|
8
|
+
import { isDatePickerView, isInternalTimeView, resolveDateTimeFormat, useUtils } from '@mui/x-date-pickers/internals';
|
|
9
|
+
import { extractValidationProps } from '@mui/x-date-pickers/validation';
|
|
7
10
|
import resolveComponentProps from '@mui/utils/resolveComponentProps';
|
|
8
11
|
import { refType } from '@mui/utils';
|
|
9
12
|
import { renderDigitalClockTimeView, renderMultiSectionDigitalClockTimeView } from '@mui/x-date-pickers/timeViewRenderers';
|
|
@@ -14,7 +17,7 @@ import { DesktopDateTimePickerLayout } from '@mui/x-date-pickers/DesktopDateTime
|
|
|
14
17
|
import { rangeValueManager } from "../internals/utils/valueManagers.js";
|
|
15
18
|
import { renderDateRangeViewCalendar } from "../dateRangeViewRenderers/index.js";
|
|
16
19
|
import { useDesktopRangePicker } from "../internals/hooks/useDesktopRangePicker/index.js";
|
|
17
|
-
import { validateDateTimeRange } from "../
|
|
20
|
+
import { validateDateTimeRange } from "../validation/index.js";
|
|
18
21
|
import { useDateTimeRangePickerDefaultizedProps } from "../DateTimeRangePicker/shared.js";
|
|
19
22
|
import { MultiInputDateTimeRangeField } from "../MultiInputDateTimeRangeField/index.js";
|
|
20
23
|
import { DateTimeRangePickerTimeWrapper } from "../DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js";
|
|
@@ -1,7 +1,9 @@
|
|
|
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 { extractValidationProps } from '@mui/x-date-pickers/
|
|
6
|
+
import { extractValidationProps } from '@mui/x-date-pickers/validation';
|
|
5
7
|
import resolveComponentProps from '@mui/utils/resolveComponentProps';
|
|
6
8
|
import { refType } from '@mui/utils';
|
|
7
9
|
import { rangeValueManager } from "../internals/utils/valueManagers.js";
|
|
@@ -9,7 +11,7 @@ import { useDateRangePickerDefaultizedProps } from "../DateRangePicker/shared.js
|
|
|
9
11
|
import { renderDateRangeViewCalendar } from "../dateRangeViewRenderers/index.js";
|
|
10
12
|
import { MultiInputDateRangeField } from "../MultiInputDateRangeField/index.js";
|
|
11
13
|
import { useMobileRangePicker } from "../internals/hooks/useMobileRangePicker/index.js";
|
|
12
|
-
import { validateDateRange } from "../
|
|
14
|
+
import { validateDateRange } from "../validation/index.js";
|
|
13
15
|
/**
|
|
14
16
|
* Demos:
|
|
15
17
|
*
|
|
@@ -1,10 +1,13 @@
|
|
|
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 = ["view", "openTo", "rangePosition"];
|
|
4
6
|
import * as React from 'react';
|
|
5
7
|
import PropTypes from 'prop-types';
|
|
6
8
|
import { refType } from '@mui/utils';
|
|
7
|
-
import { DIALOG_WIDTH, VIEW_HEIGHT,
|
|
9
|
+
import { DIALOG_WIDTH, VIEW_HEIGHT, isInternalTimeView, isDatePickerView, resolveDateTimeFormat, useUtils } from '@mui/x-date-pickers/internals';
|
|
10
|
+
import { extractValidationProps } from '@mui/x-date-pickers/validation';
|
|
8
11
|
import resolveComponentProps from '@mui/utils/resolveComponentProps';
|
|
9
12
|
import { renderDigitalClockTimeView, renderMultiSectionDigitalClockTimeView } from '@mui/x-date-pickers/timeViewRenderers';
|
|
10
13
|
import { multiSectionDigitalClockClasses, multiSectionDigitalClockSectionClasses } from '@mui/x-date-pickers/MultiSectionDigitalClock';
|
|
@@ -12,7 +15,7 @@ import { digitalClockClasses } from '@mui/x-date-pickers/DigitalClock';
|
|
|
12
15
|
import { rangeValueManager } from "../internals/utils/valueManagers.js";
|
|
13
16
|
import { renderDateRangeViewCalendar } from "../dateRangeViewRenderers/index.js";
|
|
14
17
|
import { useMobileRangePicker } from "../internals/hooks/useMobileRangePicker/index.js";
|
|
15
|
-
import { validateDateTimeRange } from "../
|
|
18
|
+
import { validateDateTimeRange } from "../validation/index.js";
|
|
16
19
|
import { useDateTimeRangePickerDefaultizedProps } from "../DateTimeRangePicker/shared.js";
|
|
17
20
|
import { MultiInputDateTimeRangeField } from "../MultiInputDateTimeRangeField/index.js";
|
|
18
21
|
import { DateTimeRangePickerTimeWrapper } from "../DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js";
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
4
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
5
|
const _excluded = ["slots", "slotProps", "unstableStartFieldRef", "unstableEndFieldRef", "className"];
|
|
@@ -10,7 +12,8 @@ import Typography from '@mui/material/Typography';
|
|
|
10
12
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
11
13
|
import useSlotProps from '@mui/utils/useSlotProps';
|
|
12
14
|
import { unstable_composeClasses as composeClasses, unstable_generateUtilityClass as generateUtilityClass, unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
|
|
13
|
-
import {
|
|
15
|
+
import { convertFieldResponseIntoMuiTextFieldProps } from '@mui/x-date-pickers/internals';
|
|
16
|
+
import { useSplitFieldProps } from '@mui/x-date-pickers/hooks';
|
|
14
17
|
import { PickersTextField } from '@mui/x-date-pickers/PickersTextField';
|
|
15
18
|
import { useMultiInputDateRangeField } from "../internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js";
|
|
16
19
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -61,7 +64,7 @@ const MultiInputDateRangeField = /*#__PURE__*/React.forwardRef(function MultiInp
|
|
|
61
64
|
const {
|
|
62
65
|
internalProps,
|
|
63
66
|
forwardedProps
|
|
64
|
-
} =
|
|
67
|
+
} = useSplitFieldProps(themeProps, 'date');
|
|
65
68
|
const {
|
|
66
69
|
slots,
|
|
67
70
|
slotProps,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
4
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
5
|
const _excluded = ["slots", "slotProps", "unstableStartFieldRef", "unstableEndFieldRef", "className"];
|
|
@@ -10,7 +12,8 @@ import Typography from '@mui/material/Typography';
|
|
|
10
12
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
11
13
|
import useSlotProps from '@mui/utils/useSlotProps';
|
|
12
14
|
import { unstable_composeClasses as composeClasses, unstable_generateUtilityClass as generateUtilityClass, unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
|
|
13
|
-
import {
|
|
15
|
+
import { convertFieldResponseIntoMuiTextFieldProps } from '@mui/x-date-pickers/internals';
|
|
16
|
+
import { useSplitFieldProps } from '@mui/x-date-pickers/hooks';
|
|
14
17
|
import { PickersTextField } from '@mui/x-date-pickers/PickersTextField';
|
|
15
18
|
import { useMultiInputDateTimeRangeField } from "../internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js";
|
|
16
19
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -61,7 +64,7 @@ const MultiInputDateTimeRangeField = /*#__PURE__*/React.forwardRef(function Mult
|
|
|
61
64
|
const {
|
|
62
65
|
internalProps,
|
|
63
66
|
forwardedProps
|
|
64
|
-
} =
|
|
67
|
+
} = useSplitFieldProps(themeProps, 'date-time');
|
|
65
68
|
const {
|
|
66
69
|
slots,
|
|
67
70
|
slotProps,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
4
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
5
|
const _excluded = ["slots", "slotProps", "unstableStartFieldRef", "unstableEndFieldRef", "className"];
|
|
@@ -10,7 +12,8 @@ import Typography from '@mui/material/Typography';
|
|
|
10
12
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
11
13
|
import useSlotProps from '@mui/utils/useSlotProps';
|
|
12
14
|
import { unstable_composeClasses as composeClasses, unstable_generateUtilityClass as generateUtilityClass, unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
|
|
13
|
-
import {
|
|
15
|
+
import { convertFieldResponseIntoMuiTextFieldProps } from '@mui/x-date-pickers/internals';
|
|
16
|
+
import { useSplitFieldProps } from '@mui/x-date-pickers/hooks';
|
|
14
17
|
import { PickersTextField } from '@mui/x-date-pickers/PickersTextField';
|
|
15
18
|
import { useMultiInputTimeRangeField } from "../internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js";
|
|
16
19
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -61,7 +64,7 @@ const MultiInputTimeRangeField = /*#__PURE__*/React.forwardRef(function MultiInp
|
|
|
61
64
|
const {
|
|
62
65
|
internalProps,
|
|
63
66
|
forwardedProps
|
|
64
|
-
} =
|
|
67
|
+
} = useSplitFieldProps(themeProps, 'time');
|
|
65
68
|
const {
|
|
66
69
|
slots,
|
|
67
70
|
slotProps,
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import * as React from 'react';
|
|
2
|
-
import { useField,
|
|
4
|
+
import { useField, useDefaultizedDateField } from '@mui/x-date-pickers/internals';
|
|
5
|
+
import { useSplitFieldProps } from '@mui/x-date-pickers/hooks';
|
|
3
6
|
import { rangeValueManager, getRangeFieldValueManager } from "../internals/utils/valueManagers.js";
|
|
4
|
-
import { validateDateRange } from "../
|
|
7
|
+
import { validateDateRange } from "../validation/index.js";
|
|
5
8
|
export const useSingleInputDateRangeField = inProps => {
|
|
6
9
|
const props = useDefaultizedDateField(inProps);
|
|
7
10
|
const {
|
|
8
11
|
forwardedProps,
|
|
9
12
|
internalProps
|
|
10
|
-
} =
|
|
13
|
+
} = useSplitFieldProps(props, 'date');
|
|
11
14
|
const fieldValueManager = React.useMemo(() => getRangeFieldValueManager({
|
|
12
15
|
dateSeparator: internalProps.dateSeparator
|
|
13
16
|
}), [internalProps.dateSeparator]);
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import * as React from 'react';
|
|
2
|
-
import { useField,
|
|
4
|
+
import { useField, useDefaultizedDateTimeField } from '@mui/x-date-pickers/internals';
|
|
5
|
+
import { useSplitFieldProps } from '@mui/x-date-pickers/hooks';
|
|
3
6
|
import { rangeValueManager, getRangeFieldValueManager } from "../internals/utils/valueManagers.js";
|
|
4
|
-
import { validateDateTimeRange } from "../
|
|
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,13 +1,16 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import * as React from 'react';
|
|
2
|
-
import { useField,
|
|
4
|
+
import { useField, useDefaultizedTimeField } from '@mui/x-date-pickers/internals';
|
|
5
|
+
import { useSplitFieldProps } from '@mui/x-date-pickers/hooks';
|
|
3
6
|
import { rangeValueManager, getRangeFieldValueManager } from "../internals/utils/valueManagers.js";
|
|
4
|
-
import { validateTimeRange } from "../
|
|
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,3 +1,5 @@
|
|
|
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';
|
|
@@ -5,7 +7,7 @@ import { useStaticRangePicker } from "../internals/hooks/useStaticRangePicker/in
|
|
|
5
7
|
import { useDateRangePickerDefaultizedProps } from "../DateRangePicker/shared.js";
|
|
6
8
|
import { renderDateRangeViewCalendar } from "../dateRangeViewRenderers/index.js";
|
|
7
9
|
import { rangeValueManager } from "../internals/utils/valueManagers.js";
|
|
8
|
-
import { validateDateRange } from "../
|
|
10
|
+
import { validateDateRange } from "../validation/index.js";
|
|
9
11
|
/**
|
|
10
12
|
* Demos:
|
|
11
13
|
*
|
package/modern/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
|
|
@@ -37,4 +37,5 @@ export * from "./MobileDateTimeRangePicker/index.js";
|
|
|
37
37
|
|
|
38
38
|
// View renderers
|
|
39
39
|
export * from "./dateRangeViewRenderers/index.js";
|
|
40
|
-
export * from "./models/index.js";
|
|
40
|
+
export * from "./models/index.js";
|
|
41
|
+
export * from "./validation/index.js";
|
|
@@ -1,8 +1,9 @@
|
|
|
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 {
|
|
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";
|
|
6
7
|
import { rangeValueManager } from "../../utils/valueManagers.js";
|
|
7
8
|
import { excludeProps } from "./shared.js";
|
|
8
9
|
import { useMultiInputFieldSelectedSections } from "../useMultiInputFieldSelectedSections.js";
|
|
@@ -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,8 +1,9 @@
|
|
|
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 {
|
|
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";
|
|
6
7
|
import { rangeValueManager } from "../../utils/valueManagers.js";
|
|
7
8
|
import { excludeProps } from "./shared.js";
|
|
8
9
|
import { useMultiInputFieldSelectedSections } from "../useMultiInputFieldSelectedSections.js";
|
|
@@ -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,8 +1,9 @@
|
|
|
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 {
|
|
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";
|
|
6
7
|
import { rangeValueManager } from "../../utils/valueManagers.js";
|
|
7
8
|
import { excludeProps } from "./shared.js";
|
|
8
9
|
import { useMultiInputFieldSelectedSections } from "../useMultiInputFieldSelectedSections.js";
|
|
@@ -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,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
|