@mui/x-date-pickers-pro 7.8.0 → 7.10.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 +140 -0
- package/DateRangePicker/DateRangePickerToolbar.js +6 -5
- package/DateTimeRangePicker/DateTimeRangePickerTabs.d.ts +2 -1
- package/DateTimeRangePicker/DateTimeRangePickerTabs.js +10 -9
- package/DateTimeRangePicker/DateTimeRangePickerToolbar.js +5 -4
- package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +3 -1
- package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +3 -1
- package/PickersRangeCalendarHeader/PickersRangeCalendarHeader.js +22 -18
- package/index.js +1 -1
- package/internals/hooks/useEnrichedRangePickerFieldProps.js +5 -4
- package/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +4 -3
- package/internals/utils/releaseInfo.js +1 -1
- package/modern/DateRangePicker/DateRangePickerToolbar.js +6 -5
- package/modern/DateTimeRangePicker/DateTimeRangePickerTabs.js +10 -9
- package/modern/DateTimeRangePicker/DateTimeRangePickerToolbar.js +5 -4
- package/modern/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +3 -1
- package/modern/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +3 -1
- package/modern/PickersRangeCalendarHeader/PickersRangeCalendarHeader.js +22 -18
- package/modern/index.js +1 -1
- package/modern/internals/hooks/useEnrichedRangePickerFieldProps.js +5 -4
- package/modern/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +4 -3
- package/modern/internals/utils/releaseInfo.js +1 -1
- package/node/DateRangePicker/DateRangePickerToolbar.js +5 -4
- package/node/DateTimeRangePicker/DateTimeRangePickerTabs.js +9 -8
- package/node/DateTimeRangePicker/DateTimeRangePickerToolbar.js +4 -3
- package/node/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +2 -0
- package/node/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +2 -0
- package/node/PickersRangeCalendarHeader/PickersRangeCalendarHeader.js +21 -17
- package/node/index.js +1 -1
- package/node/internals/hooks/useEnrichedRangePickerFieldProps.js +4 -3
- package/node/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +3 -2
- package/node/internals/utils/releaseInfo.js +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,146 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 7.10.0
|
|
7
|
+
|
|
8
|
+
_Jul 11, 2024_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 12 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🎁 Add selectors to support showing child row count in footer in the Data Grid
|
|
13
|
+
- ✨ New APIs for retrieving current item tree and item's children IDs in the Tree View
|
|
14
|
+
- 🌍 Improve Spanish (es-ES) locale on the Data Grid
|
|
15
|
+
- 🐞 Bugfixes
|
|
16
|
+
- 📚 Documentation improvements
|
|
17
|
+
|
|
18
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
19
|
+
|
|
20
|
+
### Data Grid
|
|
21
|
+
|
|
22
|
+
#### `@mui/x-data-grid@7.10.0`
|
|
23
|
+
|
|
24
|
+
- [DataGrid] Add selectors to support showing child row count in footer (#13725) @KenanYusuf
|
|
25
|
+
- [DataGrid] Fix incorrect panels position when using a toolbar (#13474) @oukunan
|
|
26
|
+
- [DataGrid] Set default variant to `'standard'` in `GridFilterInputMultipleValue` (#13129) @tarunrajput
|
|
27
|
+
- [DataGrid] Use `readonly` on more array props (#13331) @pcorpet
|
|
28
|
+
- [l10n] Improve Spanish (es-ES) locale (#13772) @joserealdev
|
|
29
|
+
|
|
30
|
+
#### `@mui/x-data-grid-pro@7.10.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
31
|
+
|
|
32
|
+
Same changes as in `@mui/x-data-grid@7.10.0`, plus:
|
|
33
|
+
|
|
34
|
+
- [DataGridPro] Keep bottom pinned row at the bottom (#13313) @romgrk
|
|
35
|
+
|
|
36
|
+
#### `@mui/x-data-grid-premium@7.10.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
37
|
+
|
|
38
|
+
Same changes as in `@mui/x-data-grid-pro@7.10.0`.
|
|
39
|
+
|
|
40
|
+
### Date and Time Pickers
|
|
41
|
+
|
|
42
|
+
#### `@mui/x-date-pickers@7.10.0`
|
|
43
|
+
|
|
44
|
+
- [fields] Prevent infinite recursion when ensuring selection (#13779) @LukasTy
|
|
45
|
+
- [fields] Unify fields behavior regardless of the `readOnly` flag (#13688) @LukasTy
|
|
46
|
+
|
|
47
|
+
#### `@mui/x-date-pickers-pro@7.10.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
48
|
+
|
|
49
|
+
Same changes as in `@mui/x-date-pickers@7.10.0`, plus:
|
|
50
|
+
|
|
51
|
+
- [DateRangePicker] Fix `calendarHeader` slot props propagation (#13780) @LukasTy
|
|
52
|
+
- [DateTimeRangePicker] Resolve `format` from given `views` (#13743) @LukasTy
|
|
53
|
+
|
|
54
|
+
### Charts
|
|
55
|
+
|
|
56
|
+
#### `@mui/x-charts@7.10.0`
|
|
57
|
+
|
|
58
|
+
- [charts] Fix displaying area of a `LineChart` when using the `log` scale (#13791) @alexfauquette
|
|
59
|
+
- [charts] Use correct click handler prop on pie chart `OnSeriesItemClick` documentation (#13761) @tonyhallett
|
|
60
|
+
|
|
61
|
+
### Tree View
|
|
62
|
+
|
|
63
|
+
#### `@mui/x-tree-view@7.10.0`
|
|
64
|
+
|
|
65
|
+
- [TreeView] Add `getItemTree` and `getItemOrderedChildrenIds` methods to the public API (#13804) @flaviendelangle
|
|
66
|
+
- [TreeView] Add utility function to check if an optional plugin is present (#13788) @flaviendelangle
|
|
67
|
+
|
|
68
|
+
### Docs
|
|
69
|
+
|
|
70
|
+
- [docs] Add missing default `loading` prop value (#13604) @oliviertassinari
|
|
71
|
+
- [docs] Add the `DateTimeRangePicker` to the "Commonly used components" demo (#13775) @flaviendelangle
|
|
72
|
+
- [docs] Fix Pickers customization playground overflow (#13742) @LukasTy
|
|
73
|
+
- [docs] Move Pickers dialog guidelines to accessibility page (#13778) @arthurbalduini
|
|
74
|
+
|
|
75
|
+
### Core
|
|
76
|
+
|
|
77
|
+
- [core] Sort `DATA_GRID_PROPS_DEFAULT_VALUES` alphabetically (#13783) @oliviertassinari
|
|
78
|
+
- [test] Fix split infinitive use in tests @oliviertassinari
|
|
79
|
+
|
|
80
|
+
## 7.9.0
|
|
81
|
+
|
|
82
|
+
_Jul 5, 2024_
|
|
83
|
+
|
|
84
|
+
We'd like to offer a big thanks to the 7 contributors who made this release possible. Here are some highlights ✨:
|
|
85
|
+
|
|
86
|
+
- 🔄 Add loading overlay variants, including a skeleton loader option to the Data Grid component. See [Loading overlay docs](https://mui.com/x/react-data-grid/overlays/#loading-overlay) for more details.
|
|
87
|
+
- 🌳 Add `selectItem` and `getItemDOMElement` methods to the TreeView component public API
|
|
88
|
+
- ⛏️ Make the `usePickersTranslations` hook public in the pickers component
|
|
89
|
+
- 🐞 Bugfixes
|
|
90
|
+
|
|
91
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
92
|
+
|
|
93
|
+
### Data Grid
|
|
94
|
+
|
|
95
|
+
#### `@mui/x-data-grid@7.9.0`
|
|
96
|
+
|
|
97
|
+
- [DataGrid] Add skeleton loading overlay support (#13293) @KenanYusuf
|
|
98
|
+
- [DataGrid] Fix pagination when `pagination={undefined}` (#13349) @sai6855
|
|
99
|
+
|
|
100
|
+
#### `@mui/x-data-grid-pro@7.9.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
101
|
+
|
|
102
|
+
Same changes as in `@mui/x-data-grid@7.9.0`.
|
|
103
|
+
|
|
104
|
+
#### `@mui/x-data-grid-premium@7.9.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
105
|
+
|
|
106
|
+
Same changes as in `@mui/x-data-grid-pro@7.9.0`.
|
|
107
|
+
|
|
108
|
+
### Date and Time Pickers
|
|
109
|
+
|
|
110
|
+
#### `@mui/x-date-pickers@7.9.0`
|
|
111
|
+
|
|
112
|
+
- [pickers] Make the `usePickersTranslations` hook public (#13657) @flaviendelangle
|
|
113
|
+
|
|
114
|
+
#### `@mui/x-date-pickers-pro@7.9.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
115
|
+
|
|
116
|
+
Same changes as in `@mui/x-date-pickers@7.9.0`.
|
|
117
|
+
|
|
118
|
+
### Charts
|
|
119
|
+
|
|
120
|
+
#### `@mui/x-charts@7.9.0`
|
|
121
|
+
|
|
122
|
+
- [charts] Add Heatmap (unreleased) (#13209) @alexfauquette
|
|
123
|
+
- [charts] Add initial `Zoom&Pan` to the Pro charts (unreleased) (#13405) @JCQuintas
|
|
124
|
+
- [charts] Fix Axis Highlight on horizontal bar charts regression (#13717) @JCQuintas
|
|
125
|
+
- [charts] Improve charts interaction for mobile users (#13692) @JCQuintas
|
|
126
|
+
- [charts] Add documentation on how to disable the tooltip on charts (#13724) @JCQuintas
|
|
127
|
+
|
|
128
|
+
### Tree View
|
|
129
|
+
|
|
130
|
+
#### `@mui/x-tree-view@7.9.0`
|
|
131
|
+
|
|
132
|
+
- [TreeView] Add `selectItem` and `getItemDOMElement` methods to the public API (#13485) @flaviendelangle
|
|
133
|
+
|
|
134
|
+
### Docs
|
|
135
|
+
|
|
136
|
+
- [docs] Fix custom "no results overlay" demo in dark mode (#13715) @KenanYusuf
|
|
137
|
+
|
|
138
|
+
### Core
|
|
139
|
+
|
|
140
|
+
- [core] Add `react_next` workflow in CircleCI (#13360) @cherniavskii
|
|
141
|
+
- [core] Create a new package to share utils across X packages (#13528) @flaviendelangle
|
|
142
|
+
- [core] Fix dependency setup (#13684) @LukasTy
|
|
143
|
+
- [core] Remove `jscodeshift-add-imports` package (#13720) @LukasTy
|
|
144
|
+
- [code-infra] Cleanup monorepo and `@mui/docs` usage (#13713) @LukasTy
|
|
145
|
+
|
|
6
146
|
## 7.8.0
|
|
7
147
|
|
|
8
148
|
_Jun 28, 2024_
|
|
@@ -7,7 +7,8 @@ import clsx from 'clsx';
|
|
|
7
7
|
import Typography from '@mui/material/Typography';
|
|
8
8
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
9
9
|
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
10
|
-
import { PickersToolbar, PickersToolbarButton, useUtils
|
|
10
|
+
import { PickersToolbar, PickersToolbarButton, useUtils } from '@mui/x-date-pickers/internals';
|
|
11
|
+
import { usePickersTranslations } from '@mui/x-date-pickers/hooks';
|
|
11
12
|
import { getDateRangePickerToolbarUtilityClass } from './dateRangePickerToolbarClasses';
|
|
12
13
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
14
|
const useUtilityClasses = ownerState => {
|
|
@@ -57,13 +58,13 @@ const DateRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateRangeP
|
|
|
57
58
|
className
|
|
58
59
|
} = props,
|
|
59
60
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
60
|
-
const
|
|
61
|
-
const startDateValue = start ? utils.formatByString(start, toolbarFormat || utils.formats.shortDate) :
|
|
62
|
-
const endDateValue = end ? utils.formatByString(end, toolbarFormat || utils.formats.shortDate) :
|
|
61
|
+
const translations = usePickersTranslations();
|
|
62
|
+
const startDateValue = start ? utils.formatByString(start, toolbarFormat || utils.formats.shortDate) : translations.start;
|
|
63
|
+
const endDateValue = end ? utils.formatByString(end, toolbarFormat || utils.formats.shortDate) : translations.end;
|
|
63
64
|
const ownerState = props;
|
|
64
65
|
const classes = useUtilityClasses(ownerState);
|
|
65
66
|
return /*#__PURE__*/_jsx(DateRangePickerToolbarRoot, _extends({}, other, {
|
|
66
|
-
toolbarTitle:
|
|
67
|
+
toolbarTitle: translations.dateRangePickerToolbarTitle,
|
|
67
68
|
isLandscape: false,
|
|
68
69
|
className: clsx(className, classes.root),
|
|
69
70
|
ownerState: ownerState,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
2
3
|
import { DateOrTimeViewWithMeridiem, BaseTabsProps, ExportedBaseTabsProps } from '@mui/x-date-pickers/internals';
|
|
3
4
|
import { DateTimeRangePickerTabsClasses } from './dateTimeRangePickerTabsClasses';
|
|
4
5
|
import { UseRangePositionResponse } from '../internals/hooks/useRangePosition';
|
|
@@ -26,7 +27,7 @@ export interface ExportedDateTimeRangePickerTabsProps extends ExportedBaseTabsPr
|
|
|
26
27
|
export interface DateTimeRangePickerTabsProps extends ExportedDateTimeRangePickerTabsProps, BaseTabsProps<DateOrTimeViewWithMeridiem>, Pick<UseRangePositionResponse, 'rangePosition' | 'onRangePositionChange'> {
|
|
27
28
|
}
|
|
28
29
|
declare const DateTimeRangePickerTabs: {
|
|
29
|
-
(inProps: DateTimeRangePickerTabsProps): React.JSX.Element | null;
|
|
30
|
+
<TDate extends PickerValidDate>(inProps: DateTimeRangePickerTabsProps): React.JSX.Element | null;
|
|
30
31
|
propTypes: any;
|
|
31
32
|
};
|
|
32
33
|
export { DateTimeRangePickerTabs };
|
|
@@ -5,7 +5,8 @@ import { styled, useThemeProps } from '@mui/material/styles';
|
|
|
5
5
|
import composeClasses from '@mui/utils/composeClasses';
|
|
6
6
|
import useEventCallback from '@mui/utils/useEventCallback';
|
|
7
7
|
import { TimeIcon, DateRangeIcon, ArrowLeftIcon, ArrowRightIcon } from '@mui/x-date-pickers/icons';
|
|
8
|
-
import {
|
|
8
|
+
import { isDatePickerView } from '@mui/x-date-pickers/internals';
|
|
9
|
+
import { usePickersTranslations } from '@mui/x-date-pickers/hooks';
|
|
9
10
|
import IconButton from '@mui/material/IconButton';
|
|
10
11
|
import Button from '@mui/material/Button';
|
|
11
12
|
import { getDateTimeRangePickerTabsUtilityClass } from './dateTimeRangePickerTabsClasses';
|
|
@@ -78,7 +79,7 @@ const DateTimeRangePickerTabs = function DateTimeRangePickerTabs(inProps) {
|
|
|
78
79
|
className,
|
|
79
80
|
sx
|
|
80
81
|
} = props;
|
|
81
|
-
const
|
|
82
|
+
const translations = usePickersTranslations();
|
|
82
83
|
const classes = useUtilityClasses(props);
|
|
83
84
|
const value = React.useMemo(() => viewToTab(view, rangePosition), [view, rangePosition]);
|
|
84
85
|
const isPreviousHidden = value === 'start-date';
|
|
@@ -86,17 +87,17 @@ const DateTimeRangePickerTabs = function DateTimeRangePickerTabs(inProps) {
|
|
|
86
87
|
const tabLabel = React.useMemo(() => {
|
|
87
88
|
switch (value) {
|
|
88
89
|
case 'start-date':
|
|
89
|
-
return
|
|
90
|
+
return translations.startDate;
|
|
90
91
|
case 'start-time':
|
|
91
|
-
return
|
|
92
|
+
return translations.startTime;
|
|
92
93
|
case 'end-date':
|
|
93
|
-
return
|
|
94
|
+
return translations.endDate;
|
|
94
95
|
case 'end-time':
|
|
95
|
-
return
|
|
96
|
+
return translations.endTime;
|
|
96
97
|
default:
|
|
97
98
|
return '';
|
|
98
99
|
}
|
|
99
|
-
}, [
|
|
100
|
+
}, [translations.endDate, translations.endTime, translations.startDate, translations.startTime, value]);
|
|
100
101
|
const handleRangePositionChange = useEventCallback(newTab => {
|
|
101
102
|
if (newTab.includes('start')) {
|
|
102
103
|
onRangePositionChange('start');
|
|
@@ -124,7 +125,7 @@ const DateTimeRangePickerTabs = function DateTimeRangePickerTabs(inProps) {
|
|
|
124
125
|
children: [!isPreviousHidden ? /*#__PURE__*/_jsx(IconButton, {
|
|
125
126
|
onClick: changeToPreviousTab,
|
|
126
127
|
className: classes.navigationButton,
|
|
127
|
-
title:
|
|
128
|
+
title: translations.openPreviousView,
|
|
128
129
|
children: /*#__PURE__*/_jsx(ArrowLeftIcon, {})
|
|
129
130
|
}) : /*#__PURE__*/_jsx(DateTimeRangePickerTabFiller, {
|
|
130
131
|
className: classes.filler
|
|
@@ -136,7 +137,7 @@ const DateTimeRangePickerTabs = function DateTimeRangePickerTabs(inProps) {
|
|
|
136
137
|
}), !isNextHidden ? /*#__PURE__*/_jsx(IconButton, {
|
|
137
138
|
onClick: changeToNextTab,
|
|
138
139
|
className: classes.navigationButton,
|
|
139
|
-
title:
|
|
140
|
+
title: translations.openNextView,
|
|
140
141
|
children: /*#__PURE__*/_jsx(ArrowRightIcon, {})
|
|
141
142
|
}) : /*#__PURE__*/_jsx(DateTimeRangePickerTabFiller, {
|
|
142
143
|
className: classes.filler
|
|
@@ -6,7 +6,8 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import clsx from 'clsx';
|
|
7
7
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
8
8
|
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
9
|
-
import {
|
|
9
|
+
import { useUtils } from '@mui/x-date-pickers/internals';
|
|
10
|
+
import { usePickersTranslations } from '@mui/x-date-pickers/hooks';
|
|
10
11
|
import { DateTimePickerToolbar } from '@mui/x-date-pickers/DateTimePicker';
|
|
11
12
|
import { getDateTimeRangePickerToolbarUtilityClass } from './dateTimeRangePickerToolbarClasses';
|
|
12
13
|
import { calculateRangeChange } from '../internals/utils/date-range-manager';
|
|
@@ -102,7 +103,7 @@ const DateTimeRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateTi
|
|
|
102
103
|
toolbarFormat,
|
|
103
104
|
toolbarPlaceholder
|
|
104
105
|
};
|
|
105
|
-
const
|
|
106
|
+
const translations = usePickersTranslations();
|
|
106
107
|
const ownerState = props;
|
|
107
108
|
const classes = useUtilityClasses(ownerState);
|
|
108
109
|
const handleStartRangeViewChange = React.useCallback(newView => {
|
|
@@ -149,7 +150,7 @@ const DateTimeRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateTi
|
|
|
149
150
|
children: [/*#__PURE__*/_jsx(DateTimeRangePickerToolbarStart, _extends({
|
|
150
151
|
value: start,
|
|
151
152
|
onViewChange: handleStartRangeViewChange,
|
|
152
|
-
toolbarTitle:
|
|
153
|
+
toolbarTitle: translations.start,
|
|
153
154
|
ownerState: ownerState,
|
|
154
155
|
toolbarVariant: "desktop",
|
|
155
156
|
view: rangePosition === 'start' ? view : undefined,
|
|
@@ -159,7 +160,7 @@ const DateTimeRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateTi
|
|
|
159
160
|
}, commonToolbarProps)), /*#__PURE__*/_jsx(DateTimeRangePickerToolbarEnd, _extends({
|
|
160
161
|
value: end,
|
|
161
162
|
onViewChange: handleEndRangeViewChange,
|
|
162
|
-
toolbarTitle:
|
|
163
|
+
toolbarTitle: translations.end,
|
|
163
164
|
ownerState: ownerState,
|
|
164
165
|
toolbarVariant: "desktop",
|
|
165
166
|
view: rangePosition === 'end' ? view : undefined,
|
|
@@ -3,7 +3,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
3
3
|
const _excluded = ["openTo", "rangePosition"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import { extractValidationProps, isDatePickerView, isInternalTimeView } from '@mui/x-date-pickers/internals';
|
|
6
|
+
import { extractValidationProps, isDatePickerView, isInternalTimeView, resolveDateTimeFormat, useUtils } from '@mui/x-date-pickers/internals';
|
|
7
7
|
import { resolveComponentProps } from '@mui/base/utils';
|
|
8
8
|
import { refType } from '@mui/utils';
|
|
9
9
|
import { renderDigitalClockTimeView, renderMultiSectionDigitalClockTimeView } from '@mui/x-date-pickers/timeViewRenderers';
|
|
@@ -74,6 +74,7 @@ const rendererInterceptor = function rendererInterceptor(inViewRenderers, popper
|
|
|
74
74
|
* - [DesktopDateTimeRangePicker API](https://mui.com/x/api/date-pickers/desktop-date-time-range-picker/)
|
|
75
75
|
*/
|
|
76
76
|
const DesktopDateTimeRangePicker = /*#__PURE__*/React.forwardRef(function DesktopDateTimeRangePicker(inProps, ref) {
|
|
77
|
+
const utils = useUtils();
|
|
77
78
|
// Props with the default values common to all date time range pickers
|
|
78
79
|
const defaultizedProps = useDateTimeRangePickerDefaultizedProps(inProps, 'MuiDesktopDateTimeRangePicker');
|
|
79
80
|
const renderTimeView = defaultizedProps.shouldRenderTimeInASingleColumn ? renderDigitalClockTimeView : renderMultiSectionDigitalClockTimeView;
|
|
@@ -92,6 +93,7 @@ const DesktopDateTimeRangePicker = /*#__PURE__*/React.forwardRef(function Deskto
|
|
|
92
93
|
const props = _extends({}, defaultizedProps, {
|
|
93
94
|
views,
|
|
94
95
|
viewRenderers,
|
|
96
|
+
format: resolveDateTimeFormat(utils, defaultizedProps),
|
|
95
97
|
// force true to correctly handle `renderTimeViewClock` as a renderer
|
|
96
98
|
ampmInClock: true,
|
|
97
99
|
calendars: defaultizedProps.calendars ?? 1,
|
|
@@ -4,7 +4,7 @@ const _excluded = ["view", "openTo", "rangePosition"];
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { refType } from '@mui/utils';
|
|
7
|
-
import { DIALOG_WIDTH, VIEW_HEIGHT, extractValidationProps, isInternalTimeView, isDatePickerView } from '@mui/x-date-pickers/internals';
|
|
7
|
+
import { DIALOG_WIDTH, VIEW_HEIGHT, extractValidationProps, isInternalTimeView, isDatePickerView, resolveDateTimeFormat, useUtils } from '@mui/x-date-pickers/internals';
|
|
8
8
|
import { resolveComponentProps } from '@mui/base/utils';
|
|
9
9
|
import { renderDigitalClockTimeView, renderMultiSectionDigitalClockTimeView } from '@mui/x-date-pickers/timeViewRenderers';
|
|
10
10
|
import { multiSectionDigitalClockClasses, multiSectionDigitalClockSectionClasses } from '@mui/x-date-pickers/MultiSectionDigitalClock';
|
|
@@ -82,6 +82,7 @@ const rendererInterceptor = function rendererInterceptor(inViewRenderers, popper
|
|
|
82
82
|
* - [MobileDateTimeRangePicker API](https://mui.com/x/api/date-pickers/mobile-date-time-range-picker/)
|
|
83
83
|
*/
|
|
84
84
|
const MobileDateTimeRangePicker = /*#__PURE__*/React.forwardRef(function MobileDateTimeRangePicker(inProps, ref) {
|
|
85
|
+
const utils = useUtils();
|
|
85
86
|
// Props with the default values common to all date time range pickers
|
|
86
87
|
const defaultizedProps = useDateTimeRangePickerDefaultizedProps(inProps, 'MuiMobileDateTimeRangePicker');
|
|
87
88
|
const renderTimeView = defaultizedProps.shouldRenderTimeInASingleColumn ? renderDigitalClockTimeView : renderMultiSectionDigitalClockTimeView;
|
|
@@ -94,6 +95,7 @@ const MobileDateTimeRangePicker = /*#__PURE__*/React.forwardRef(function MobileD
|
|
|
94
95
|
}, defaultizedProps.viewRenderers);
|
|
95
96
|
const props = _extends({}, defaultizedProps, {
|
|
96
97
|
viewRenderers,
|
|
98
|
+
format: resolveDateTimeFormat(utils, defaultizedProps),
|
|
97
99
|
// Force one calendar on mobile to avoid layout issues
|
|
98
100
|
calendars: 1,
|
|
99
101
|
// force true to correctly handle `renderTimeViewClock` as a renderer
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["calendars", "month", "monthIndex", "labelId"]
|
|
3
|
+
const _excluded = ["calendars", "month", "monthIndex", "labelId"],
|
|
4
|
+
_excluded2 = ["format", "slots", "slotProps", "currentMonth", "onMonthChange", "disableFuture", "disablePast", "minDate", "maxDate", "timezone", "reduceAnimations", "views", "view"];
|
|
4
5
|
import * as React from 'react';
|
|
5
6
|
import PropTypes from 'prop-types';
|
|
6
7
|
import { styled } from '@mui/material/styles';
|
|
7
8
|
import { PickersCalendarHeader } from '@mui/x-date-pickers/PickersCalendarHeader';
|
|
8
|
-
import { PickersArrowSwitcher,
|
|
9
|
+
import { PickersArrowSwitcher, useNextMonthDisabled, usePreviousMonthDisabled, useUtils } from '@mui/x-date-pickers/internals';
|
|
10
|
+
import { usePickersTranslations } from '@mui/x-date-pickers/hooks';
|
|
9
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
12
|
const PickersRangeCalendarHeaderContentMultipleCalendars = styled(PickersArrowSwitcher)({
|
|
11
13
|
padding: '12px 16px 4px 16px',
|
|
@@ -15,7 +17,7 @@ const PickersRangeCalendarHeaderContentMultipleCalendars = styled(PickersArrowSw
|
|
|
15
17
|
});
|
|
16
18
|
const PickersRangeCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersRangeCalendarHeader(props, ref) {
|
|
17
19
|
const utils = useUtils();
|
|
18
|
-
const
|
|
20
|
+
const translations = usePickersTranslations();
|
|
19
21
|
const {
|
|
20
22
|
calendars,
|
|
21
23
|
month,
|
|
@@ -24,17 +26,19 @@ const PickersRangeCalendarHeader = /*#__PURE__*/React.forwardRef(function Picker
|
|
|
24
26
|
} = props,
|
|
25
27
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
26
28
|
const {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
29
|
+
format,
|
|
30
|
+
slots,
|
|
31
|
+
slotProps,
|
|
32
|
+
currentMonth,
|
|
33
|
+
onMonthChange,
|
|
34
|
+
disableFuture,
|
|
35
|
+
disablePast,
|
|
36
|
+
minDate,
|
|
37
|
+
maxDate,
|
|
38
|
+
timezone
|
|
39
|
+
// omit props that are not used in the PickersArrowSwitcher
|
|
40
|
+
} = other,
|
|
41
|
+
otherRangeProps = _objectWithoutPropertiesLoose(other, _excluded2);
|
|
38
42
|
const isNextMonthDisabled = useNextMonthDisabled(currentMonth, {
|
|
39
43
|
disableFuture,
|
|
40
44
|
maxDate,
|
|
@@ -53,21 +57,21 @@ const PickersRangeCalendarHeader = /*#__PURE__*/React.forwardRef(function Picker
|
|
|
53
57
|
}
|
|
54
58
|
const selectNextMonth = () => onMonthChange(utils.addMonths(currentMonth, 1), 'left');
|
|
55
59
|
const selectPreviousMonth = () => onMonthChange(utils.addMonths(currentMonth, -1), 'right');
|
|
56
|
-
return /*#__PURE__*/_jsx(PickersRangeCalendarHeaderContentMultipleCalendars, {
|
|
60
|
+
return /*#__PURE__*/_jsx(PickersRangeCalendarHeaderContentMultipleCalendars, _extends({}, otherRangeProps, {
|
|
57
61
|
ref: ref,
|
|
58
62
|
onGoToPrevious: selectPreviousMonth,
|
|
59
63
|
onGoToNext: selectNextMonth,
|
|
60
64
|
isPreviousHidden: monthIndex !== 0,
|
|
61
65
|
isPreviousDisabled: isPreviousMonthDisabled,
|
|
62
|
-
previousLabel:
|
|
66
|
+
previousLabel: translations.previousMonth,
|
|
63
67
|
isNextHidden: monthIndex !== calendars - 1,
|
|
64
68
|
isNextDisabled: isNextMonthDisabled,
|
|
65
|
-
nextLabel:
|
|
69
|
+
nextLabel: translations.nextMonth,
|
|
66
70
|
slots: slots,
|
|
67
71
|
slotProps: slotProps,
|
|
68
72
|
labelId: labelId,
|
|
69
73
|
children: utils.formatByString(month, format ?? `${utils.formats.month} ${utils.formats.year}`)
|
|
70
|
-
});
|
|
74
|
+
}));
|
|
71
75
|
});
|
|
72
76
|
process.env.NODE_ENV !== "production" ? PickersRangeCalendarHeader.propTypes = {
|
|
73
77
|
// ----------------------------- Warning --------------------------------
|
package/index.js
CHANGED
|
@@ -5,7 +5,8 @@ import * as React from 'react';
|
|
|
5
5
|
import { resolveComponentProps } from '@mui/base/utils';
|
|
6
6
|
import useEventCallback from '@mui/utils/useEventCallback';
|
|
7
7
|
import useForkRef from '@mui/utils/useForkRef';
|
|
8
|
-
import {
|
|
8
|
+
import { usePickersTranslations } from '@mui/x-date-pickers/hooks';
|
|
9
|
+
import { onSpaceOrEnter } from '@mui/x-date-pickers/internals';
|
|
9
10
|
const useMultiInputFieldSlotProps = ({
|
|
10
11
|
wrapperVariant,
|
|
11
12
|
open,
|
|
@@ -27,7 +28,7 @@ const useMultiInputFieldSlotProps = ({
|
|
|
27
28
|
startFieldRef,
|
|
28
29
|
endFieldRef
|
|
29
30
|
}) => {
|
|
30
|
-
const
|
|
31
|
+
const translations = usePickersTranslations();
|
|
31
32
|
const handleStartFieldRef = useForkRef(fieldProps.unstableStartFieldRef, startFieldRef);
|
|
32
33
|
const handleEndFieldRef = useForkRef(fieldProps.unstableEndFieldRef, endFieldRef);
|
|
33
34
|
const previousRangePosition = React.useRef(rangePosition);
|
|
@@ -91,7 +92,7 @@ const useMultiInputFieldSlotProps = ({
|
|
|
91
92
|
let InputProps;
|
|
92
93
|
if (ownerState.position === 'start') {
|
|
93
94
|
textFieldProps = _extends({
|
|
94
|
-
label: inLocaleText?.start ??
|
|
95
|
+
label: inLocaleText?.start ?? translations.start,
|
|
95
96
|
onKeyDown: onSpaceOrEnter(openRangeStartSelection),
|
|
96
97
|
onFocus: handleFocusStart,
|
|
97
98
|
focused: open ? rangePosition === 'start' : undefined
|
|
@@ -107,7 +108,7 @@ const useMultiInputFieldSlotProps = ({
|
|
|
107
108
|
}
|
|
108
109
|
} else {
|
|
109
110
|
textFieldProps = _extends({
|
|
110
|
-
label: inLocaleText?.end ??
|
|
111
|
+
label: inLocaleText?.end ?? translations.end,
|
|
111
112
|
onKeyDown: onSpaceOrEnter(openRangeEndSelection),
|
|
112
113
|
onFocus: handleFocusEnd,
|
|
113
114
|
focused: open ? rangePosition === 'end' : undefined
|
|
@@ -6,7 +6,8 @@ import { useSlotProps } from '@mui/base/utils';
|
|
|
6
6
|
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
|
-
import { usePicker, PickersModalDialog
|
|
9
|
+
import { usePicker, PickersModalDialog } from '@mui/x-date-pickers/internals';
|
|
10
|
+
import { usePickersTranslations } from '@mui/x-date-pickers/hooks';
|
|
10
11
|
import useId from '@mui/utils/useId';
|
|
11
12
|
import { useEnrichedRangePickerFieldProps } from '../useEnrichedRangePickerFieldProps';
|
|
12
13
|
import { getReleaseInfo } from '../../utils/releaseInfo';
|
|
@@ -46,7 +47,7 @@ export const useMobileRangePicker = _ref => {
|
|
|
46
47
|
onRangePositionChange
|
|
47
48
|
} = useRangePosition(props, fieldType === 'single-input' ? startFieldRef : undefined);
|
|
48
49
|
const labelId = useId();
|
|
49
|
-
const
|
|
50
|
+
const contextTranslations = usePickersTranslations();
|
|
50
51
|
const {
|
|
51
52
|
open,
|
|
52
53
|
actions,
|
|
@@ -115,7 +116,7 @@ export const useMobileRangePicker = _ref => {
|
|
|
115
116
|
})
|
|
116
117
|
});
|
|
117
118
|
const Layout = slots?.layout ?? PickersLayout;
|
|
118
|
-
const finalLocaleText = _extends({},
|
|
119
|
+
const finalLocaleText = _extends({}, contextTranslations, localeText);
|
|
119
120
|
let labelledById = pickerParams.valueType === 'date-time' ? `${labelId}-start-toolbar ${labelId}-end-toolbar` : labelId;
|
|
120
121
|
if (isToolbarHidden) {
|
|
121
122
|
const labels = [];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export const getReleaseInfo = () => {
|
|
3
|
-
const releaseInfo = "
|
|
3
|
+
const releaseInfo = "MTcyMDY0ODgwMDAwMA==";
|
|
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
|
|
@@ -7,7 +7,8 @@ import clsx from 'clsx';
|
|
|
7
7
|
import Typography from '@mui/material/Typography';
|
|
8
8
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
9
9
|
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
10
|
-
import { PickersToolbar, PickersToolbarButton, useUtils
|
|
10
|
+
import { PickersToolbar, PickersToolbarButton, useUtils } from '@mui/x-date-pickers/internals';
|
|
11
|
+
import { usePickersTranslations } from '@mui/x-date-pickers/hooks';
|
|
11
12
|
import { getDateRangePickerToolbarUtilityClass } from './dateRangePickerToolbarClasses';
|
|
12
13
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
14
|
const useUtilityClasses = ownerState => {
|
|
@@ -57,13 +58,13 @@ const DateRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateRangeP
|
|
|
57
58
|
className
|
|
58
59
|
} = props,
|
|
59
60
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
60
|
-
const
|
|
61
|
-
const startDateValue = start ? utils.formatByString(start, toolbarFormat || utils.formats.shortDate) :
|
|
62
|
-
const endDateValue = end ? utils.formatByString(end, toolbarFormat || utils.formats.shortDate) :
|
|
61
|
+
const translations = usePickersTranslations();
|
|
62
|
+
const startDateValue = start ? utils.formatByString(start, toolbarFormat || utils.formats.shortDate) : translations.start;
|
|
63
|
+
const endDateValue = end ? utils.formatByString(end, toolbarFormat || utils.formats.shortDate) : translations.end;
|
|
63
64
|
const ownerState = props;
|
|
64
65
|
const classes = useUtilityClasses(ownerState);
|
|
65
66
|
return /*#__PURE__*/_jsx(DateRangePickerToolbarRoot, _extends({}, other, {
|
|
66
|
-
toolbarTitle:
|
|
67
|
+
toolbarTitle: translations.dateRangePickerToolbarTitle,
|
|
67
68
|
isLandscape: false,
|
|
68
69
|
className: clsx(className, classes.root),
|
|
69
70
|
ownerState: ownerState,
|
|
@@ -5,7 +5,8 @@ import { styled, useThemeProps } from '@mui/material/styles';
|
|
|
5
5
|
import composeClasses from '@mui/utils/composeClasses';
|
|
6
6
|
import useEventCallback from '@mui/utils/useEventCallback';
|
|
7
7
|
import { TimeIcon, DateRangeIcon, ArrowLeftIcon, ArrowRightIcon } from '@mui/x-date-pickers/icons';
|
|
8
|
-
import {
|
|
8
|
+
import { isDatePickerView } from '@mui/x-date-pickers/internals';
|
|
9
|
+
import { usePickersTranslations } from '@mui/x-date-pickers/hooks';
|
|
9
10
|
import IconButton from '@mui/material/IconButton';
|
|
10
11
|
import Button from '@mui/material/Button';
|
|
11
12
|
import { getDateTimeRangePickerTabsUtilityClass } from './dateTimeRangePickerTabsClasses';
|
|
@@ -78,7 +79,7 @@ const DateTimeRangePickerTabs = function DateTimeRangePickerTabs(inProps) {
|
|
|
78
79
|
className,
|
|
79
80
|
sx
|
|
80
81
|
} = props;
|
|
81
|
-
const
|
|
82
|
+
const translations = usePickersTranslations();
|
|
82
83
|
const classes = useUtilityClasses(props);
|
|
83
84
|
const value = React.useMemo(() => viewToTab(view, rangePosition), [view, rangePosition]);
|
|
84
85
|
const isPreviousHidden = value === 'start-date';
|
|
@@ -86,17 +87,17 @@ const DateTimeRangePickerTabs = function DateTimeRangePickerTabs(inProps) {
|
|
|
86
87
|
const tabLabel = React.useMemo(() => {
|
|
87
88
|
switch (value) {
|
|
88
89
|
case 'start-date':
|
|
89
|
-
return
|
|
90
|
+
return translations.startDate;
|
|
90
91
|
case 'start-time':
|
|
91
|
-
return
|
|
92
|
+
return translations.startTime;
|
|
92
93
|
case 'end-date':
|
|
93
|
-
return
|
|
94
|
+
return translations.endDate;
|
|
94
95
|
case 'end-time':
|
|
95
|
-
return
|
|
96
|
+
return translations.endTime;
|
|
96
97
|
default:
|
|
97
98
|
return '';
|
|
98
99
|
}
|
|
99
|
-
}, [
|
|
100
|
+
}, [translations.endDate, translations.endTime, translations.startDate, translations.startTime, value]);
|
|
100
101
|
const handleRangePositionChange = useEventCallback(newTab => {
|
|
101
102
|
if (newTab.includes('start')) {
|
|
102
103
|
onRangePositionChange('start');
|
|
@@ -124,7 +125,7 @@ const DateTimeRangePickerTabs = function DateTimeRangePickerTabs(inProps) {
|
|
|
124
125
|
children: [!isPreviousHidden ? /*#__PURE__*/_jsx(IconButton, {
|
|
125
126
|
onClick: changeToPreviousTab,
|
|
126
127
|
className: classes.navigationButton,
|
|
127
|
-
title:
|
|
128
|
+
title: translations.openPreviousView,
|
|
128
129
|
children: /*#__PURE__*/_jsx(ArrowLeftIcon, {})
|
|
129
130
|
}) : /*#__PURE__*/_jsx(DateTimeRangePickerTabFiller, {
|
|
130
131
|
className: classes.filler
|
|
@@ -136,7 +137,7 @@ const DateTimeRangePickerTabs = function DateTimeRangePickerTabs(inProps) {
|
|
|
136
137
|
}), !isNextHidden ? /*#__PURE__*/_jsx(IconButton, {
|
|
137
138
|
onClick: changeToNextTab,
|
|
138
139
|
className: classes.navigationButton,
|
|
139
|
-
title:
|
|
140
|
+
title: translations.openNextView,
|
|
140
141
|
children: /*#__PURE__*/_jsx(ArrowRightIcon, {})
|
|
141
142
|
}) : /*#__PURE__*/_jsx(DateTimeRangePickerTabFiller, {
|
|
142
143
|
className: classes.filler
|
|
@@ -6,7 +6,8 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import clsx from 'clsx';
|
|
7
7
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
8
8
|
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
9
|
-
import {
|
|
9
|
+
import { useUtils } from '@mui/x-date-pickers/internals';
|
|
10
|
+
import { usePickersTranslations } from '@mui/x-date-pickers/hooks';
|
|
10
11
|
import { DateTimePickerToolbar } from '@mui/x-date-pickers/DateTimePicker';
|
|
11
12
|
import { getDateTimeRangePickerToolbarUtilityClass } from './dateTimeRangePickerToolbarClasses';
|
|
12
13
|
import { calculateRangeChange } from '../internals/utils/date-range-manager';
|
|
@@ -102,7 +103,7 @@ const DateTimeRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateTi
|
|
|
102
103
|
toolbarFormat,
|
|
103
104
|
toolbarPlaceholder
|
|
104
105
|
};
|
|
105
|
-
const
|
|
106
|
+
const translations = usePickersTranslations();
|
|
106
107
|
const ownerState = props;
|
|
107
108
|
const classes = useUtilityClasses(ownerState);
|
|
108
109
|
const handleStartRangeViewChange = React.useCallback(newView => {
|
|
@@ -149,7 +150,7 @@ const DateTimeRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateTi
|
|
|
149
150
|
children: [/*#__PURE__*/_jsx(DateTimeRangePickerToolbarStart, _extends({
|
|
150
151
|
value: start,
|
|
151
152
|
onViewChange: handleStartRangeViewChange,
|
|
152
|
-
toolbarTitle:
|
|
153
|
+
toolbarTitle: translations.start,
|
|
153
154
|
ownerState: ownerState,
|
|
154
155
|
toolbarVariant: "desktop",
|
|
155
156
|
view: rangePosition === 'start' ? view : undefined,
|
|
@@ -159,7 +160,7 @@ const DateTimeRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateTi
|
|
|
159
160
|
}, commonToolbarProps)), /*#__PURE__*/_jsx(DateTimeRangePickerToolbarEnd, _extends({
|
|
160
161
|
value: end,
|
|
161
162
|
onViewChange: handleEndRangeViewChange,
|
|
162
|
-
toolbarTitle:
|
|
163
|
+
toolbarTitle: translations.end,
|
|
163
164
|
ownerState: ownerState,
|
|
164
165
|
toolbarVariant: "desktop",
|
|
165
166
|
view: rangePosition === 'end' ? view : undefined,
|
|
@@ -3,7 +3,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
3
3
|
const _excluded = ["openTo", "rangePosition"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import { extractValidationProps, isDatePickerView, isInternalTimeView } from '@mui/x-date-pickers/internals';
|
|
6
|
+
import { extractValidationProps, isDatePickerView, isInternalTimeView, resolveDateTimeFormat, useUtils } from '@mui/x-date-pickers/internals';
|
|
7
7
|
import { resolveComponentProps } from '@mui/base/utils';
|
|
8
8
|
import { refType } from '@mui/utils';
|
|
9
9
|
import { renderDigitalClockTimeView, renderMultiSectionDigitalClockTimeView } from '@mui/x-date-pickers/timeViewRenderers';
|
|
@@ -74,6 +74,7 @@ const rendererInterceptor = function rendererInterceptor(inViewRenderers, popper
|
|
|
74
74
|
* - [DesktopDateTimeRangePicker API](https://mui.com/x/api/date-pickers/desktop-date-time-range-picker/)
|
|
75
75
|
*/
|
|
76
76
|
const DesktopDateTimeRangePicker = /*#__PURE__*/React.forwardRef(function DesktopDateTimeRangePicker(inProps, ref) {
|
|
77
|
+
const utils = useUtils();
|
|
77
78
|
// Props with the default values common to all date time range pickers
|
|
78
79
|
const defaultizedProps = useDateTimeRangePickerDefaultizedProps(inProps, 'MuiDesktopDateTimeRangePicker');
|
|
79
80
|
const renderTimeView = defaultizedProps.shouldRenderTimeInASingleColumn ? renderDigitalClockTimeView : renderMultiSectionDigitalClockTimeView;
|
|
@@ -92,6 +93,7 @@ const DesktopDateTimeRangePicker = /*#__PURE__*/React.forwardRef(function Deskto
|
|
|
92
93
|
const props = _extends({}, defaultizedProps, {
|
|
93
94
|
views,
|
|
94
95
|
viewRenderers,
|
|
96
|
+
format: resolveDateTimeFormat(utils, defaultizedProps),
|
|
95
97
|
// force true to correctly handle `renderTimeViewClock` as a renderer
|
|
96
98
|
ampmInClock: true,
|
|
97
99
|
calendars: defaultizedProps.calendars ?? 1,
|
|
@@ -4,7 +4,7 @@ const _excluded = ["view", "openTo", "rangePosition"];
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { refType } from '@mui/utils';
|
|
7
|
-
import { DIALOG_WIDTH, VIEW_HEIGHT, extractValidationProps, isInternalTimeView, isDatePickerView } from '@mui/x-date-pickers/internals';
|
|
7
|
+
import { DIALOG_WIDTH, VIEW_HEIGHT, extractValidationProps, isInternalTimeView, isDatePickerView, resolveDateTimeFormat, useUtils } from '@mui/x-date-pickers/internals';
|
|
8
8
|
import { resolveComponentProps } from '@mui/base/utils';
|
|
9
9
|
import { renderDigitalClockTimeView, renderMultiSectionDigitalClockTimeView } from '@mui/x-date-pickers/timeViewRenderers';
|
|
10
10
|
import { multiSectionDigitalClockClasses, multiSectionDigitalClockSectionClasses } from '@mui/x-date-pickers/MultiSectionDigitalClock';
|
|
@@ -82,6 +82,7 @@ const rendererInterceptor = function rendererInterceptor(inViewRenderers, popper
|
|
|
82
82
|
* - [MobileDateTimeRangePicker API](https://mui.com/x/api/date-pickers/mobile-date-time-range-picker/)
|
|
83
83
|
*/
|
|
84
84
|
const MobileDateTimeRangePicker = /*#__PURE__*/React.forwardRef(function MobileDateTimeRangePicker(inProps, ref) {
|
|
85
|
+
const utils = useUtils();
|
|
85
86
|
// Props with the default values common to all date time range pickers
|
|
86
87
|
const defaultizedProps = useDateTimeRangePickerDefaultizedProps(inProps, 'MuiMobileDateTimeRangePicker');
|
|
87
88
|
const renderTimeView = defaultizedProps.shouldRenderTimeInASingleColumn ? renderDigitalClockTimeView : renderMultiSectionDigitalClockTimeView;
|
|
@@ -94,6 +95,7 @@ const MobileDateTimeRangePicker = /*#__PURE__*/React.forwardRef(function MobileD
|
|
|
94
95
|
}, defaultizedProps.viewRenderers);
|
|
95
96
|
const props = _extends({}, defaultizedProps, {
|
|
96
97
|
viewRenderers,
|
|
98
|
+
format: resolveDateTimeFormat(utils, defaultizedProps),
|
|
97
99
|
// Force one calendar on mobile to avoid layout issues
|
|
98
100
|
calendars: 1,
|
|
99
101
|
// force true to correctly handle `renderTimeViewClock` as a renderer
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["calendars", "month", "monthIndex", "labelId"]
|
|
3
|
+
const _excluded = ["calendars", "month", "monthIndex", "labelId"],
|
|
4
|
+
_excluded2 = ["format", "slots", "slotProps", "currentMonth", "onMonthChange", "disableFuture", "disablePast", "minDate", "maxDate", "timezone", "reduceAnimations", "views", "view"];
|
|
4
5
|
import * as React from 'react';
|
|
5
6
|
import PropTypes from 'prop-types';
|
|
6
7
|
import { styled } from '@mui/material/styles';
|
|
7
8
|
import { PickersCalendarHeader } from '@mui/x-date-pickers/PickersCalendarHeader';
|
|
8
|
-
import { PickersArrowSwitcher,
|
|
9
|
+
import { PickersArrowSwitcher, useNextMonthDisabled, usePreviousMonthDisabled, useUtils } from '@mui/x-date-pickers/internals';
|
|
10
|
+
import { usePickersTranslations } from '@mui/x-date-pickers/hooks';
|
|
9
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
12
|
const PickersRangeCalendarHeaderContentMultipleCalendars = styled(PickersArrowSwitcher)({
|
|
11
13
|
padding: '12px 16px 4px 16px',
|
|
@@ -15,7 +17,7 @@ const PickersRangeCalendarHeaderContentMultipleCalendars = styled(PickersArrowSw
|
|
|
15
17
|
});
|
|
16
18
|
const PickersRangeCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersRangeCalendarHeader(props, ref) {
|
|
17
19
|
const utils = useUtils();
|
|
18
|
-
const
|
|
20
|
+
const translations = usePickersTranslations();
|
|
19
21
|
const {
|
|
20
22
|
calendars,
|
|
21
23
|
month,
|
|
@@ -24,17 +26,19 @@ const PickersRangeCalendarHeader = /*#__PURE__*/React.forwardRef(function Picker
|
|
|
24
26
|
} = props,
|
|
25
27
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
26
28
|
const {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
29
|
+
format,
|
|
30
|
+
slots,
|
|
31
|
+
slotProps,
|
|
32
|
+
currentMonth,
|
|
33
|
+
onMonthChange,
|
|
34
|
+
disableFuture,
|
|
35
|
+
disablePast,
|
|
36
|
+
minDate,
|
|
37
|
+
maxDate,
|
|
38
|
+
timezone
|
|
39
|
+
// omit props that are not used in the PickersArrowSwitcher
|
|
40
|
+
} = other,
|
|
41
|
+
otherRangeProps = _objectWithoutPropertiesLoose(other, _excluded2);
|
|
38
42
|
const isNextMonthDisabled = useNextMonthDisabled(currentMonth, {
|
|
39
43
|
disableFuture,
|
|
40
44
|
maxDate,
|
|
@@ -53,21 +57,21 @@ const PickersRangeCalendarHeader = /*#__PURE__*/React.forwardRef(function Picker
|
|
|
53
57
|
}
|
|
54
58
|
const selectNextMonth = () => onMonthChange(utils.addMonths(currentMonth, 1), 'left');
|
|
55
59
|
const selectPreviousMonth = () => onMonthChange(utils.addMonths(currentMonth, -1), 'right');
|
|
56
|
-
return /*#__PURE__*/_jsx(PickersRangeCalendarHeaderContentMultipleCalendars, {
|
|
60
|
+
return /*#__PURE__*/_jsx(PickersRangeCalendarHeaderContentMultipleCalendars, _extends({}, otherRangeProps, {
|
|
57
61
|
ref: ref,
|
|
58
62
|
onGoToPrevious: selectPreviousMonth,
|
|
59
63
|
onGoToNext: selectNextMonth,
|
|
60
64
|
isPreviousHidden: monthIndex !== 0,
|
|
61
65
|
isPreviousDisabled: isPreviousMonthDisabled,
|
|
62
|
-
previousLabel:
|
|
66
|
+
previousLabel: translations.previousMonth,
|
|
63
67
|
isNextHidden: monthIndex !== calendars - 1,
|
|
64
68
|
isNextDisabled: isNextMonthDisabled,
|
|
65
|
-
nextLabel:
|
|
69
|
+
nextLabel: translations.nextMonth,
|
|
66
70
|
slots: slots,
|
|
67
71
|
slotProps: slotProps,
|
|
68
72
|
labelId: labelId,
|
|
69
73
|
children: utils.formatByString(month, format ?? `${utils.formats.month} ${utils.formats.year}`)
|
|
70
|
-
});
|
|
74
|
+
}));
|
|
71
75
|
});
|
|
72
76
|
process.env.NODE_ENV !== "production" ? PickersRangeCalendarHeader.propTypes = {
|
|
73
77
|
// ----------------------------- Warning --------------------------------
|
package/modern/index.js
CHANGED
|
@@ -5,7 +5,8 @@ import * as React from 'react';
|
|
|
5
5
|
import { resolveComponentProps } from '@mui/base/utils';
|
|
6
6
|
import useEventCallback from '@mui/utils/useEventCallback';
|
|
7
7
|
import useForkRef from '@mui/utils/useForkRef';
|
|
8
|
-
import {
|
|
8
|
+
import { usePickersTranslations } from '@mui/x-date-pickers/hooks';
|
|
9
|
+
import { onSpaceOrEnter } from '@mui/x-date-pickers/internals';
|
|
9
10
|
const useMultiInputFieldSlotProps = ({
|
|
10
11
|
wrapperVariant,
|
|
11
12
|
open,
|
|
@@ -27,7 +28,7 @@ const useMultiInputFieldSlotProps = ({
|
|
|
27
28
|
startFieldRef,
|
|
28
29
|
endFieldRef
|
|
29
30
|
}) => {
|
|
30
|
-
const
|
|
31
|
+
const translations = usePickersTranslations();
|
|
31
32
|
const handleStartFieldRef = useForkRef(fieldProps.unstableStartFieldRef, startFieldRef);
|
|
32
33
|
const handleEndFieldRef = useForkRef(fieldProps.unstableEndFieldRef, endFieldRef);
|
|
33
34
|
const previousRangePosition = React.useRef(rangePosition);
|
|
@@ -91,7 +92,7 @@ const useMultiInputFieldSlotProps = ({
|
|
|
91
92
|
let InputProps;
|
|
92
93
|
if (ownerState.position === 'start') {
|
|
93
94
|
textFieldProps = _extends({
|
|
94
|
-
label: inLocaleText?.start ??
|
|
95
|
+
label: inLocaleText?.start ?? translations.start,
|
|
95
96
|
onKeyDown: onSpaceOrEnter(openRangeStartSelection),
|
|
96
97
|
onFocus: handleFocusStart,
|
|
97
98
|
focused: open ? rangePosition === 'start' : undefined
|
|
@@ -107,7 +108,7 @@ const useMultiInputFieldSlotProps = ({
|
|
|
107
108
|
}
|
|
108
109
|
} else {
|
|
109
110
|
textFieldProps = _extends({
|
|
110
|
-
label: inLocaleText?.end ??
|
|
111
|
+
label: inLocaleText?.end ?? translations.end,
|
|
111
112
|
onKeyDown: onSpaceOrEnter(openRangeEndSelection),
|
|
112
113
|
onFocus: handleFocusEnd,
|
|
113
114
|
focused: open ? rangePosition === 'end' : undefined
|
|
@@ -6,7 +6,8 @@ import { useSlotProps } from '@mui/base/utils';
|
|
|
6
6
|
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
|
-
import { usePicker, PickersModalDialog
|
|
9
|
+
import { usePicker, PickersModalDialog } from '@mui/x-date-pickers/internals';
|
|
10
|
+
import { usePickersTranslations } from '@mui/x-date-pickers/hooks';
|
|
10
11
|
import useId from '@mui/utils/useId';
|
|
11
12
|
import { useEnrichedRangePickerFieldProps } from '../useEnrichedRangePickerFieldProps';
|
|
12
13
|
import { getReleaseInfo } from '../../utils/releaseInfo';
|
|
@@ -46,7 +47,7 @@ export const useMobileRangePicker = _ref => {
|
|
|
46
47
|
onRangePositionChange
|
|
47
48
|
} = useRangePosition(props, fieldType === 'single-input' ? startFieldRef : undefined);
|
|
48
49
|
const labelId = useId();
|
|
49
|
-
const
|
|
50
|
+
const contextTranslations = usePickersTranslations();
|
|
50
51
|
const {
|
|
51
52
|
open,
|
|
52
53
|
actions,
|
|
@@ -115,7 +116,7 @@ export const useMobileRangePicker = _ref => {
|
|
|
115
116
|
})
|
|
116
117
|
});
|
|
117
118
|
const Layout = slots?.layout ?? PickersLayout;
|
|
118
|
-
const finalLocaleText = _extends({},
|
|
119
|
+
const finalLocaleText = _extends({}, contextTranslations, localeText);
|
|
119
120
|
let labelledById = pickerParams.valueType === 'date-time' ? `${labelId}-start-toolbar ${labelId}-end-toolbar` : labelId;
|
|
120
121
|
if (isToolbarHidden) {
|
|
121
122
|
const labels = [];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export const getReleaseInfo = () => {
|
|
3
|
-
const releaseInfo = "
|
|
3
|
+
const releaseInfo = "MTcyMDY0ODgwMDAwMA==";
|
|
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
|
|
@@ -14,6 +14,7 @@ var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
|
14
14
|
var _styles = require("@mui/material/styles");
|
|
15
15
|
var _utils = require("@mui/utils");
|
|
16
16
|
var _internals = require("@mui/x-date-pickers/internals");
|
|
17
|
+
var _hooks = require("@mui/x-date-pickers/hooks");
|
|
17
18
|
var _dateRangePickerToolbarClasses = require("./dateRangePickerToolbarClasses");
|
|
18
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
20
|
const _excluded = ["value", "rangePosition", "onRangePositionChange", "toolbarFormat", "className", "onViewChange", "view", "views"];
|
|
@@ -66,13 +67,13 @@ const DateRangePickerToolbar = exports.DateRangePickerToolbar = /*#__PURE__*/Rea
|
|
|
66
67
|
className
|
|
67
68
|
} = props,
|
|
68
69
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
69
|
-
const
|
|
70
|
-
const startDateValue = start ? utils.formatByString(start, toolbarFormat || utils.formats.shortDate) :
|
|
71
|
-
const endDateValue = end ? utils.formatByString(end, toolbarFormat || utils.formats.shortDate) :
|
|
70
|
+
const translations = (0, _hooks.usePickersTranslations)();
|
|
71
|
+
const startDateValue = start ? utils.formatByString(start, toolbarFormat || utils.formats.shortDate) : translations.start;
|
|
72
|
+
const endDateValue = end ? utils.formatByString(end, toolbarFormat || utils.formats.shortDate) : translations.end;
|
|
72
73
|
const ownerState = props;
|
|
73
74
|
const classes = useUtilityClasses(ownerState);
|
|
74
75
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(DateRangePickerToolbarRoot, (0, _extends2.default)({}, other, {
|
|
75
|
-
toolbarTitle:
|
|
76
|
+
toolbarTitle: translations.dateRangePickerToolbarTitle,
|
|
76
77
|
isLandscape: false,
|
|
77
78
|
className: (0, _clsx.default)(className, classes.root),
|
|
78
79
|
ownerState: ownerState,
|
|
@@ -13,6 +13,7 @@ var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"
|
|
|
13
13
|
var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallback"));
|
|
14
14
|
var _icons = require("@mui/x-date-pickers/icons");
|
|
15
15
|
var _internals = require("@mui/x-date-pickers/internals");
|
|
16
|
+
var _hooks = require("@mui/x-date-pickers/hooks");
|
|
16
17
|
var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
|
|
17
18
|
var _Button = _interopRequireDefault(require("@mui/material/Button"));
|
|
18
19
|
var _dateTimeRangePickerTabsClasses = require("./dateTimeRangePickerTabsClasses");
|
|
@@ -87,7 +88,7 @@ const DateTimeRangePickerTabs = exports.DateTimeRangePickerTabs = function DateT
|
|
|
87
88
|
className,
|
|
88
89
|
sx
|
|
89
90
|
} = props;
|
|
90
|
-
const
|
|
91
|
+
const translations = (0, _hooks.usePickersTranslations)();
|
|
91
92
|
const classes = useUtilityClasses(props);
|
|
92
93
|
const value = React.useMemo(() => viewToTab(view, rangePosition), [view, rangePosition]);
|
|
93
94
|
const isPreviousHidden = value === 'start-date';
|
|
@@ -95,17 +96,17 @@ const DateTimeRangePickerTabs = exports.DateTimeRangePickerTabs = function DateT
|
|
|
95
96
|
const tabLabel = React.useMemo(() => {
|
|
96
97
|
switch (value) {
|
|
97
98
|
case 'start-date':
|
|
98
|
-
return
|
|
99
|
+
return translations.startDate;
|
|
99
100
|
case 'start-time':
|
|
100
|
-
return
|
|
101
|
+
return translations.startTime;
|
|
101
102
|
case 'end-date':
|
|
102
|
-
return
|
|
103
|
+
return translations.endDate;
|
|
103
104
|
case 'end-time':
|
|
104
|
-
return
|
|
105
|
+
return translations.endTime;
|
|
105
106
|
default:
|
|
106
107
|
return '';
|
|
107
108
|
}
|
|
108
|
-
}, [
|
|
109
|
+
}, [translations.endDate, translations.endTime, translations.startDate, translations.startTime, value]);
|
|
109
110
|
const handleRangePositionChange = (0, _useEventCallback.default)(newTab => {
|
|
110
111
|
if (newTab.includes('start')) {
|
|
111
112
|
onRangePositionChange('start');
|
|
@@ -133,7 +134,7 @@ const DateTimeRangePickerTabs = exports.DateTimeRangePickerTabs = function DateT
|
|
|
133
134
|
children: [!isPreviousHidden ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
|
|
134
135
|
onClick: changeToPreviousTab,
|
|
135
136
|
className: classes.navigationButton,
|
|
136
|
-
title:
|
|
137
|
+
title: translations.openPreviousView,
|
|
137
138
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.ArrowLeftIcon, {})
|
|
138
139
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(DateTimeRangePickerTabFiller, {
|
|
139
140
|
className: classes.filler
|
|
@@ -145,7 +146,7 @@ const DateTimeRangePickerTabs = exports.DateTimeRangePickerTabs = function DateT
|
|
|
145
146
|
}), !isNextHidden ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
|
|
146
147
|
onClick: changeToNextTab,
|
|
147
148
|
className: classes.navigationButton,
|
|
148
|
-
title:
|
|
149
|
+
title: translations.openNextView,
|
|
149
150
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.ArrowRightIcon, {})
|
|
150
151
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(DateTimeRangePickerTabFiller, {
|
|
151
152
|
className: classes.filler
|
|
@@ -13,6 +13,7 @@ var _clsx = _interopRequireDefault(require("clsx"));
|
|
|
13
13
|
var _styles = require("@mui/material/styles");
|
|
14
14
|
var _utils = require("@mui/utils");
|
|
15
15
|
var _internals = require("@mui/x-date-pickers/internals");
|
|
16
|
+
var _hooks = require("@mui/x-date-pickers/hooks");
|
|
16
17
|
var _DateTimePicker = require("@mui/x-date-pickers/DateTimePicker");
|
|
17
18
|
var _dateTimeRangePickerToolbarClasses = require("./dateTimeRangePickerToolbarClasses");
|
|
18
19
|
var _dateRangeManager = require("../internals/utils/date-range-manager");
|
|
@@ -111,7 +112,7 @@ const DateTimeRangePickerToolbar = exports.DateTimeRangePickerToolbar = /*#__PUR
|
|
|
111
112
|
toolbarFormat,
|
|
112
113
|
toolbarPlaceholder
|
|
113
114
|
};
|
|
114
|
-
const
|
|
115
|
+
const translations = (0, _hooks.usePickersTranslations)();
|
|
115
116
|
const ownerState = props;
|
|
116
117
|
const classes = useUtilityClasses(ownerState);
|
|
117
118
|
const handleStartRangeViewChange = React.useCallback(newView => {
|
|
@@ -158,7 +159,7 @@ const DateTimeRangePickerToolbar = exports.DateTimeRangePickerToolbar = /*#__PUR
|
|
|
158
159
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(DateTimeRangePickerToolbarStart, (0, _extends2.default)({
|
|
159
160
|
value: start,
|
|
160
161
|
onViewChange: handleStartRangeViewChange,
|
|
161
|
-
toolbarTitle:
|
|
162
|
+
toolbarTitle: translations.start,
|
|
162
163
|
ownerState: ownerState,
|
|
163
164
|
toolbarVariant: "desktop",
|
|
164
165
|
view: rangePosition === 'start' ? view : undefined,
|
|
@@ -168,7 +169,7 @@ const DateTimeRangePickerToolbar = exports.DateTimeRangePickerToolbar = /*#__PUR
|
|
|
168
169
|
}, commonToolbarProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(DateTimeRangePickerToolbarEnd, (0, _extends2.default)({
|
|
169
170
|
value: end,
|
|
170
171
|
onViewChange: handleEndRangeViewChange,
|
|
171
|
-
toolbarTitle:
|
|
172
|
+
toolbarTitle: translations.end,
|
|
172
173
|
ownerState: ownerState,
|
|
173
174
|
toolbarVariant: "desktop",
|
|
174
175
|
view: rangePosition === 'end' ? view : undefined,
|
|
@@ -83,6 +83,7 @@ const rendererInterceptor = function rendererInterceptor(inViewRenderers, popper
|
|
|
83
83
|
* - [DesktopDateTimeRangePicker API](https://mui.com/x/api/date-pickers/desktop-date-time-range-picker/)
|
|
84
84
|
*/
|
|
85
85
|
const DesktopDateTimeRangePicker = exports.DesktopDateTimeRangePicker = /*#__PURE__*/React.forwardRef(function DesktopDateTimeRangePicker(inProps, ref) {
|
|
86
|
+
const utils = (0, _internals.useUtils)();
|
|
86
87
|
// Props with the default values common to all date time range pickers
|
|
87
88
|
const defaultizedProps = (0, _shared.useDateTimeRangePickerDefaultizedProps)(inProps, 'MuiDesktopDateTimeRangePicker');
|
|
88
89
|
const renderTimeView = defaultizedProps.shouldRenderTimeInASingleColumn ? _timeViewRenderers.renderDigitalClockTimeView : _timeViewRenderers.renderMultiSectionDigitalClockTimeView;
|
|
@@ -101,6 +102,7 @@ const DesktopDateTimeRangePicker = exports.DesktopDateTimeRangePicker = /*#__PUR
|
|
|
101
102
|
const props = (0, _extends2.default)({}, defaultizedProps, {
|
|
102
103
|
views,
|
|
103
104
|
viewRenderers,
|
|
105
|
+
format: (0, _internals.resolveDateTimeFormat)(utils, defaultizedProps),
|
|
104
106
|
// force true to correctly handle `renderTimeViewClock` as a renderer
|
|
105
107
|
ampmInClock: true,
|
|
106
108
|
calendars: defaultizedProps.calendars ?? 1,
|
|
@@ -91,6 +91,7 @@ const rendererInterceptor = function rendererInterceptor(inViewRenderers, popper
|
|
|
91
91
|
* - [MobileDateTimeRangePicker API](https://mui.com/x/api/date-pickers/mobile-date-time-range-picker/)
|
|
92
92
|
*/
|
|
93
93
|
const MobileDateTimeRangePicker = exports.MobileDateTimeRangePicker = /*#__PURE__*/React.forwardRef(function MobileDateTimeRangePicker(inProps, ref) {
|
|
94
|
+
const utils = (0, _internals.useUtils)();
|
|
94
95
|
// Props with the default values common to all date time range pickers
|
|
95
96
|
const defaultizedProps = (0, _shared.useDateTimeRangePickerDefaultizedProps)(inProps, 'MuiMobileDateTimeRangePicker');
|
|
96
97
|
const renderTimeView = defaultizedProps.shouldRenderTimeInASingleColumn ? _timeViewRenderers.renderDigitalClockTimeView : _timeViewRenderers.renderMultiSectionDigitalClockTimeView;
|
|
@@ -103,6 +104,7 @@ const MobileDateTimeRangePicker = exports.MobileDateTimeRangePicker = /*#__PURE_
|
|
|
103
104
|
}, defaultizedProps.viewRenderers);
|
|
104
105
|
const props = (0, _extends2.default)({}, defaultizedProps, {
|
|
105
106
|
viewRenderers,
|
|
107
|
+
format: (0, _internals.resolveDateTimeFormat)(utils, defaultizedProps),
|
|
106
108
|
// Force one calendar on mobile to avoid layout issues
|
|
107
109
|
calendars: 1,
|
|
108
110
|
// force true to correctly handle `renderTimeViewClock` as a renderer
|
|
@@ -12,8 +12,10 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
12
12
|
var _styles = require("@mui/material/styles");
|
|
13
13
|
var _PickersCalendarHeader = require("@mui/x-date-pickers/PickersCalendarHeader");
|
|
14
14
|
var _internals = require("@mui/x-date-pickers/internals");
|
|
15
|
+
var _hooks = require("@mui/x-date-pickers/hooks");
|
|
15
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
-
const _excluded = ["calendars", "month", "monthIndex", "labelId"]
|
|
17
|
+
const _excluded = ["calendars", "month", "monthIndex", "labelId"],
|
|
18
|
+
_excluded2 = ["format", "slots", "slotProps", "currentMonth", "onMonthChange", "disableFuture", "disablePast", "minDate", "maxDate", "timezone", "reduceAnimations", "views", "view"];
|
|
17
19
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
18
20
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
19
21
|
const PickersRangeCalendarHeaderContentMultipleCalendars = (0, _styles.styled)(_internals.PickersArrowSwitcher)({
|
|
@@ -24,7 +26,7 @@ const PickersRangeCalendarHeaderContentMultipleCalendars = (0, _styles.styled)(_
|
|
|
24
26
|
});
|
|
25
27
|
const PickersRangeCalendarHeader = exports.PickersRangeCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersRangeCalendarHeader(props, ref) {
|
|
26
28
|
const utils = (0, _internals.useUtils)();
|
|
27
|
-
const
|
|
29
|
+
const translations = (0, _hooks.usePickersTranslations)();
|
|
28
30
|
const {
|
|
29
31
|
calendars,
|
|
30
32
|
month,
|
|
@@ -33,17 +35,19 @@ const PickersRangeCalendarHeader = exports.PickersRangeCalendarHeader = /*#__PUR
|
|
|
33
35
|
} = props,
|
|
34
36
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
35
37
|
const {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
38
|
+
format,
|
|
39
|
+
slots,
|
|
40
|
+
slotProps,
|
|
41
|
+
currentMonth,
|
|
42
|
+
onMonthChange,
|
|
43
|
+
disableFuture,
|
|
44
|
+
disablePast,
|
|
45
|
+
minDate,
|
|
46
|
+
maxDate,
|
|
47
|
+
timezone
|
|
48
|
+
// omit props that are not used in the PickersArrowSwitcher
|
|
49
|
+
} = other,
|
|
50
|
+
otherRangeProps = (0, _objectWithoutPropertiesLoose2.default)(other, _excluded2);
|
|
47
51
|
const isNextMonthDisabled = (0, _internals.useNextMonthDisabled)(currentMonth, {
|
|
48
52
|
disableFuture,
|
|
49
53
|
maxDate,
|
|
@@ -62,21 +66,21 @@ const PickersRangeCalendarHeader = exports.PickersRangeCalendarHeader = /*#__PUR
|
|
|
62
66
|
}
|
|
63
67
|
const selectNextMonth = () => onMonthChange(utils.addMonths(currentMonth, 1), 'left');
|
|
64
68
|
const selectPreviousMonth = () => onMonthChange(utils.addMonths(currentMonth, -1), 'right');
|
|
65
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(PickersRangeCalendarHeaderContentMultipleCalendars, {
|
|
69
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(PickersRangeCalendarHeaderContentMultipleCalendars, (0, _extends2.default)({}, otherRangeProps, {
|
|
66
70
|
ref: ref,
|
|
67
71
|
onGoToPrevious: selectPreviousMonth,
|
|
68
72
|
onGoToNext: selectNextMonth,
|
|
69
73
|
isPreviousHidden: monthIndex !== 0,
|
|
70
74
|
isPreviousDisabled: isPreviousMonthDisabled,
|
|
71
|
-
previousLabel:
|
|
75
|
+
previousLabel: translations.previousMonth,
|
|
72
76
|
isNextHidden: monthIndex !== calendars - 1,
|
|
73
77
|
isNextDisabled: isNextMonthDisabled,
|
|
74
|
-
nextLabel:
|
|
78
|
+
nextLabel: translations.nextMonth,
|
|
75
79
|
slots: slots,
|
|
76
80
|
slotProps: slotProps,
|
|
77
81
|
labelId: labelId,
|
|
78
82
|
children: utils.formatByString(month, format ?? `${utils.formats.month} ${utils.formats.year}`)
|
|
79
|
-
});
|
|
83
|
+
}));
|
|
80
84
|
});
|
|
81
85
|
process.env.NODE_ENV !== "production" ? PickersRangeCalendarHeader.propTypes = {
|
|
82
86
|
// ----------------------------- Warning --------------------------------
|
package/node/index.js
CHANGED
|
@@ -11,6 +11,7 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
var _utils = require("@mui/base/utils");
|
|
12
12
|
var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallback"));
|
|
13
13
|
var _useForkRef = _interopRequireDefault(require("@mui/utils/useForkRef"));
|
|
14
|
+
var _hooks = require("@mui/x-date-pickers/hooks");
|
|
14
15
|
var _internals = require("@mui/x-date-pickers/internals");
|
|
15
16
|
const _excluded = ["clearable", "onClear"];
|
|
16
17
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
@@ -36,7 +37,7 @@ const useMultiInputFieldSlotProps = ({
|
|
|
36
37
|
startFieldRef,
|
|
37
38
|
endFieldRef
|
|
38
39
|
}) => {
|
|
39
|
-
const
|
|
40
|
+
const translations = (0, _hooks.usePickersTranslations)();
|
|
40
41
|
const handleStartFieldRef = (0, _useForkRef.default)(fieldProps.unstableStartFieldRef, startFieldRef);
|
|
41
42
|
const handleEndFieldRef = (0, _useForkRef.default)(fieldProps.unstableEndFieldRef, endFieldRef);
|
|
42
43
|
const previousRangePosition = React.useRef(rangePosition);
|
|
@@ -100,7 +101,7 @@ const useMultiInputFieldSlotProps = ({
|
|
|
100
101
|
let InputProps;
|
|
101
102
|
if (ownerState.position === 'start') {
|
|
102
103
|
textFieldProps = (0, _extends2.default)({
|
|
103
|
-
label: inLocaleText?.start ??
|
|
104
|
+
label: inLocaleText?.start ?? translations.start,
|
|
104
105
|
onKeyDown: (0, _internals.onSpaceOrEnter)(openRangeStartSelection),
|
|
105
106
|
onFocus: handleFocusStart,
|
|
106
107
|
focused: open ? rangePosition === 'start' : undefined
|
|
@@ -116,7 +117,7 @@ const useMultiInputFieldSlotProps = ({
|
|
|
116
117
|
}
|
|
117
118
|
} else {
|
|
118
119
|
textFieldProps = (0, _extends2.default)({
|
|
119
|
-
label: inLocaleText?.end ??
|
|
120
|
+
label: inLocaleText?.end ?? translations.end,
|
|
120
121
|
onKeyDown: (0, _internals.onSpaceOrEnter)(openRangeEndSelection),
|
|
121
122
|
onFocus: handleFocusEnd,
|
|
122
123
|
focused: open ? rangePosition === 'end' : undefined
|
|
@@ -13,6 +13,7 @@ var _xLicense = require("@mui/x-license");
|
|
|
13
13
|
var _LocalizationProvider = require("@mui/x-date-pickers/LocalizationProvider");
|
|
14
14
|
var _PickersLayout = require("@mui/x-date-pickers/PickersLayout");
|
|
15
15
|
var _internals = require("@mui/x-date-pickers/internals");
|
|
16
|
+
var _hooks = require("@mui/x-date-pickers/hooks");
|
|
16
17
|
var _useId = _interopRequireDefault(require("@mui/utils/useId"));
|
|
17
18
|
var _useEnrichedRangePickerFieldProps = require("../useEnrichedRangePickerFieldProps");
|
|
18
19
|
var _releaseInfo = require("../../utils/releaseInfo");
|
|
@@ -55,7 +56,7 @@ const useMobileRangePicker = _ref => {
|
|
|
55
56
|
onRangePositionChange
|
|
56
57
|
} = (0, _useRangePosition.useRangePosition)(props, fieldType === 'single-input' ? startFieldRef : undefined);
|
|
57
58
|
const labelId = (0, _useId.default)();
|
|
58
|
-
const
|
|
59
|
+
const contextTranslations = (0, _hooks.usePickersTranslations)();
|
|
59
60
|
const {
|
|
60
61
|
open,
|
|
61
62
|
actions,
|
|
@@ -124,7 +125,7 @@ const useMobileRangePicker = _ref => {
|
|
|
124
125
|
})
|
|
125
126
|
});
|
|
126
127
|
const Layout = slots?.layout ?? _PickersLayout.PickersLayout;
|
|
127
|
-
const finalLocaleText = (0, _extends2.default)({},
|
|
128
|
+
const finalLocaleText = (0, _extends2.default)({}, contextTranslations, localeText);
|
|
128
129
|
let labelledById = pickerParams.valueType === 'date-time' ? `${labelId}-start-toolbar ${labelId}-end-toolbar` : labelId;
|
|
129
130
|
if (isToolbarHidden) {
|
|
130
131
|
const labels = [];
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.getReleaseInfo = void 0;
|
|
7
7
|
var _utils = require("@mui/utils");
|
|
8
8
|
const getReleaseInfo = () => {
|
|
9
|
-
const releaseInfo = "
|
|
9
|
+
const releaseInfo = "MTcyMDY0ODgwMDAwMA==";
|
|
10
10
|
if (process.env.NODE_ENV !== 'production') {
|
|
11
11
|
// A simple hack to set the value in the test environment (has no build step).
|
|
12
12
|
// eslint-disable-next-line no-useless-concat
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-date-pickers-pro",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.10.0",
|
|
4
4
|
"description": "The Pro plan edition of the Date and Time Picker components (MUI X).",
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"main": "./node/index.js",
|
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@babel/runtime": "^7.24.7",
|
|
36
36
|
"@mui/base": "^5.0.0-beta.40",
|
|
37
|
-
"@mui/system": "^5.
|
|
38
|
-
"@mui/utils": "^5.
|
|
37
|
+
"@mui/system": "^5.16.0",
|
|
38
|
+
"@mui/utils": "^5.16.0",
|
|
39
39
|
"clsx": "^2.1.1",
|
|
40
40
|
"prop-types": "^15.8.1",
|
|
41
41
|
"react-transition-group": "^4.4.5",
|
|
42
|
-
"@mui/x-date-pickers": "7.
|
|
43
|
-
"@mui/x-license": "7.
|
|
42
|
+
"@mui/x-date-pickers": "7.10.0",
|
|
43
|
+
"@mui/x-license": "7.10.0"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"@emotion/react": "^11.9.0",
|