@mui/x-date-pickers-pro 7.0.0-beta.4 → 7.0.0-beta.6
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 +271 -61
- package/DateRangePicker/DateRangePickerToolbar.d.ts +3 -3
- package/DateRangePicker/DateRangePickerToolbar.js +16 -2
- package/DateTimeRangePicker/DateTimeRangePickerToolbar.js +39 -9
- package/DateTimeRangePicker/shared.js +8 -3
- package/DesktopDateRangePicker/DesktopDateRangePicker.types.d.ts +1 -1
- package/MobileDateRangePicker/MobileDateRangePicker.types.d.ts +1 -1
- package/StaticDateRangePicker/StaticDateRangePicker.types.d.ts +1 -1
- package/index.js +1 -1
- package/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +1 -1
- package/internals/utils/releaseInfo.js +1 -1
- package/modern/DateRangePicker/DateRangePickerToolbar.js +16 -2
- package/modern/DateTimeRangePicker/DateTimeRangePickerToolbar.js +39 -9
- package/modern/DateTimeRangePicker/shared.js +7 -2
- package/modern/index.js +1 -1
- package/modern/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +1 -1
- package/modern/internals/utils/releaseInfo.js +1 -1
- package/node/DateRangePicker/DateRangePickerToolbar.js +16 -2
- package/node/DateTimeRangePicker/DateTimeRangePickerToolbar.js +39 -9
- package/node/DateTimeRangePicker/shared.js +7 -2
- package/node/index.js +1 -1
- package/node/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +1 -1
- package/node/internals/utils/releaseInfo.js +1 -1
- package/package.json +4 -4
- package/themeAugmentation/props.d.ts +3 -2
|
@@ -4,14 +4,14 @@ import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
|
4
4
|
import { DateRange } from '../models';
|
|
5
5
|
import { UseRangePositionResponse } from '../internals/hooks/useRangePosition';
|
|
6
6
|
import { DateRangePickerToolbarClasses } from './dateRangePickerToolbarClasses';
|
|
7
|
-
export interface DateRangePickerToolbarProps<TDate extends PickerValidDate> extends Omit<BaseToolbarProps<DateRange<TDate>, 'day'>, '
|
|
7
|
+
export interface DateRangePickerToolbarProps<TDate extends PickerValidDate> extends ExportedDateRangePickerToolbarProps, Omit<BaseToolbarProps<DateRange<TDate>, 'day'>, 'onChange' | 'isLandscape'>, Pick<UseRangePositionResponse, 'rangePosition' | 'onRangePositionChange'> {
|
|
8
|
+
}
|
|
9
|
+
export interface ExportedDateRangePickerToolbarProps extends ExportedBaseToolbarProps {
|
|
8
10
|
/**
|
|
9
11
|
* Override or extend the styles applied to the component.
|
|
10
12
|
*/
|
|
11
13
|
classes?: Partial<DateRangePickerToolbarClasses>;
|
|
12
14
|
}
|
|
13
|
-
export interface ExportedDateRangePickerToolbarProps extends ExportedBaseToolbarProps {
|
|
14
|
-
}
|
|
15
15
|
/**
|
|
16
16
|
* Demos:
|
|
17
17
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["value", "rangePosition", "onRangePositionChange", "toolbarFormat", "className"];
|
|
3
|
+
const _excluded = ["value", "rangePosition", "onRangePositionChange", "toolbarFormat", "className", "onViewChange", "view", "views"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import clsx from 'clsx';
|
|
@@ -105,6 +105,12 @@ process.env.NODE_ENV !== "production" ? DateRangePickerToolbar.propTypes = {
|
|
|
105
105
|
*/
|
|
106
106
|
hidden: PropTypes.bool,
|
|
107
107
|
onRangePositionChange: PropTypes.func.isRequired,
|
|
108
|
+
/**
|
|
109
|
+
* Callback called when a toolbar is clicked
|
|
110
|
+
* @template TView
|
|
111
|
+
* @param {TView} view The view to open
|
|
112
|
+
*/
|
|
113
|
+
onViewChange: PropTypes.func.isRequired,
|
|
108
114
|
rangePosition: PropTypes.oneOf(['end', 'start']).isRequired,
|
|
109
115
|
readOnly: PropTypes.bool,
|
|
110
116
|
/**
|
|
@@ -121,6 +127,14 @@ process.env.NODE_ENV !== "production" ? DateRangePickerToolbar.propTypes = {
|
|
|
121
127
|
* @default "––"
|
|
122
128
|
*/
|
|
123
129
|
toolbarPlaceholder: PropTypes.node,
|
|
124
|
-
value: PropTypes.arrayOf(PropTypes.object).isRequired
|
|
130
|
+
value: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
131
|
+
/**
|
|
132
|
+
* Currently visible picker view.
|
|
133
|
+
*/
|
|
134
|
+
view: PropTypes.oneOf(['day']).isRequired,
|
|
135
|
+
/**
|
|
136
|
+
* Available views.
|
|
137
|
+
*/
|
|
138
|
+
views: PropTypes.arrayOf(PropTypes.oneOf(['day'])).isRequired
|
|
125
139
|
} : void 0;
|
|
126
140
|
export { DateRangePickerToolbar };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["value", "rangePosition", "onRangePositionChange", "className", "onViewChange", "toolbarVariant", "onChange", "classes", "view"];
|
|
3
|
+
const _excluded = ["value", "rangePosition", "onRangePositionChange", "className", "onViewChange", "toolbarVariant", "onChange", "classes", "view", "isLandscape", "views", "ampm", "disabled", "readOnly", "hidden", "toolbarFormat", "toolbarPlaceholder", "titleId", "sx"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import clsx from 'clsx';
|
|
@@ -66,9 +66,29 @@ const DateTimeRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateTi
|
|
|
66
66
|
className,
|
|
67
67
|
onViewChange,
|
|
68
68
|
onChange,
|
|
69
|
-
view
|
|
69
|
+
view,
|
|
70
|
+
isLandscape,
|
|
71
|
+
views,
|
|
72
|
+
ampm,
|
|
73
|
+
disabled,
|
|
74
|
+
readOnly,
|
|
75
|
+
hidden,
|
|
76
|
+
toolbarFormat,
|
|
77
|
+
toolbarPlaceholder,
|
|
78
|
+
titleId,
|
|
79
|
+
sx
|
|
70
80
|
} = props,
|
|
71
81
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
82
|
+
const commonToolbarProps = {
|
|
83
|
+
isLandscape,
|
|
84
|
+
views,
|
|
85
|
+
ampm,
|
|
86
|
+
disabled,
|
|
87
|
+
readOnly,
|
|
88
|
+
hidden,
|
|
89
|
+
toolbarFormat,
|
|
90
|
+
toolbarPlaceholder
|
|
91
|
+
};
|
|
72
92
|
const localeText = useLocaleText();
|
|
73
93
|
const ownerState = props;
|
|
74
94
|
const classes = useUtilityClasses(ownerState);
|
|
@@ -104,11 +124,16 @@ const DateTimeRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateTi
|
|
|
104
124
|
onRangePositionChange(nextSelection);
|
|
105
125
|
onChange(newRange);
|
|
106
126
|
}, [onChange, onRangePositionChange, props.value, rangePosition, utils]);
|
|
107
|
-
|
|
127
|
+
if (hidden) {
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
return /*#__PURE__*/_jsxs(DateTimeRangePickerToolbarRoot, _extends({
|
|
108
131
|
className: clsx(className, classes.root),
|
|
109
132
|
ownerState: ownerState,
|
|
110
133
|
ref: ref,
|
|
111
|
-
|
|
134
|
+
sx: sx
|
|
135
|
+
}, other, {
|
|
136
|
+
children: [/*#__PURE__*/_jsx(DateTimeRangePickerToolbarStart, _extends({
|
|
112
137
|
value: start,
|
|
113
138
|
onViewChange: handleStartRangeViewChange,
|
|
114
139
|
toolbarTitle: localeText.start,
|
|
@@ -116,8 +141,9 @@ const DateTimeRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateTi
|
|
|
116
141
|
toolbarVariant: "desktop",
|
|
117
142
|
view: rangePosition === 'start' ? view : undefined,
|
|
118
143
|
className: classes.startToolbar,
|
|
119
|
-
onChange: handleOnChange
|
|
120
|
-
|
|
144
|
+
onChange: handleOnChange,
|
|
145
|
+
titleId: titleId ? `${titleId}-start-toolbar` : undefined
|
|
146
|
+
}, commonToolbarProps)), /*#__PURE__*/_jsx(DateTimeRangePickerToolbarEnd, _extends({
|
|
121
147
|
value: end,
|
|
122
148
|
onViewChange: handleEndRangeViewChange,
|
|
123
149
|
toolbarTitle: localeText.end,
|
|
@@ -125,9 +151,10 @@ const DateTimeRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateTi
|
|
|
125
151
|
toolbarVariant: "desktop",
|
|
126
152
|
view: rangePosition === 'end' ? view : undefined,
|
|
127
153
|
className: classes.endToolbar,
|
|
128
|
-
onChange: handleOnChange
|
|
129
|
-
|
|
130
|
-
|
|
154
|
+
onChange: handleOnChange,
|
|
155
|
+
titleId: titleId ? `${titleId}-end-toolbar` : undefined
|
|
156
|
+
}, commonToolbarProps))]
|
|
157
|
+
}));
|
|
131
158
|
});
|
|
132
159
|
process.env.NODE_ENV !== "production" ? DateTimeRangePickerToolbar.propTypes = {
|
|
133
160
|
// ----------------------------- Warning --------------------------------
|
|
@@ -177,6 +204,9 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePickerToolbar.propTypes = {
|
|
|
177
204
|
* Currently visible picker view.
|
|
178
205
|
*/
|
|
179
206
|
view: PropTypes.oneOf(['day', 'hours', 'meridiem', 'minutes', 'seconds']).isRequired,
|
|
207
|
+
/**
|
|
208
|
+
* Available views.
|
|
209
|
+
*/
|
|
180
210
|
views: PropTypes.arrayOf(PropTypes.oneOf(['day', 'hours', 'meridiem', 'minutes', 'seconds']).isRequired).isRequired
|
|
181
211
|
} : void 0;
|
|
182
212
|
export { DateTimeRangePickerToolbar };
|
|
@@ -4,7 +4,7 @@ import { useDefaultDates, useUtils, applyDefaultDate, applyDefaultViewProps, res
|
|
|
4
4
|
import { DateTimeRangePickerToolbar } from './DateTimeRangePickerToolbar';
|
|
5
5
|
import { DateTimeRangePickerTabs } from './DateTimeRangePickerTabs';
|
|
6
6
|
export function useDateTimeRangePickerDefaultizedProps(props, name) {
|
|
7
|
-
var _themeProps$ampm, _themeProps$disableFu, _themeProps$disablePa, _themeProps$slotProps;
|
|
7
|
+
var _themeProps$ampm, _themeProps$disableFu, _themeProps$disablePa, _themeProps$minDateTi, _themeProps$maxDateTi, _themeProps$minDateTi2, _themeProps$maxDateTi2, _themeProps$disableIg, _themeProps$slotProps;
|
|
8
8
|
const utils = useUtils();
|
|
9
9
|
const defaultDates = useDefaultDates();
|
|
10
10
|
const themeProps = useThemeProps({
|
|
@@ -41,8 +41,13 @@ export function useDateTimeRangePickerDefaultizedProps(props, name) {
|
|
|
41
41
|
ampm,
|
|
42
42
|
disableFuture: (_themeProps$disableFu = themeProps.disableFuture) != null ? _themeProps$disableFu : false,
|
|
43
43
|
disablePast: (_themeProps$disablePa = themeProps.disablePast) != null ? _themeProps$disablePa : false,
|
|
44
|
-
minDate: applyDefaultDate(utils, themeProps.minDate, defaultDates.minDate),
|
|
45
|
-
maxDate: applyDefaultDate(utils, themeProps.maxDate, defaultDates.maxDate),
|
|
44
|
+
minDate: applyDefaultDate(utils, (_themeProps$minDateTi = themeProps.minDateTime) != null ? _themeProps$minDateTi : themeProps.minDate, defaultDates.minDate),
|
|
45
|
+
maxDate: applyDefaultDate(utils, (_themeProps$maxDateTi = themeProps.maxDateTime) != null ? _themeProps$maxDateTi : themeProps.maxDate, defaultDates.maxDate),
|
|
46
|
+
minTime: (_themeProps$minDateTi2 = themeProps.minDateTime) != null ? _themeProps$minDateTi2 : themeProps.minTime,
|
|
47
|
+
maxTime: (_themeProps$maxDateTi2 = themeProps.maxDateTime) != null ? _themeProps$maxDateTi2 : themeProps.maxTime,
|
|
48
|
+
disableIgnoringDatePartForTimeValidation: (_themeProps$disableIg = themeProps.disableIgnoringDatePartForTimeValidation) != null ? _themeProps$disableIg : Boolean(themeProps.minDateTime || themeProps.maxDateTime ||
|
|
49
|
+
// allow digital clocks to correctly check time validity: https://github.com/mui/mui-x/issues/12048
|
|
50
|
+
themeProps.disablePast || themeProps.disableFuture),
|
|
46
51
|
slots: _extends({
|
|
47
52
|
tabs: DateTimeRangePickerTabs,
|
|
48
53
|
toolbar: DateTimeRangePickerToolbar
|
|
@@ -4,7 +4,7 @@ import { UseDesktopRangePickerSlots, UseDesktopRangePickerSlotProps, DesktopRang
|
|
|
4
4
|
import { BaseDateRangePickerProps, BaseDateRangePickerSlots, BaseDateRangePickerSlotProps } from '../DateRangePicker/shared';
|
|
5
5
|
export interface DesktopDateRangePickerSlots<TDate extends PickerValidDate> extends BaseDateRangePickerSlots<TDate>, MakeOptional<UseDesktopRangePickerSlots<TDate, 'day'>, 'field'> {
|
|
6
6
|
}
|
|
7
|
-
export interface DesktopDateRangePickerSlotProps<TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean> extends BaseDateRangePickerSlotProps<TDate>, Omit<UseDesktopRangePickerSlotProps<TDate, 'day', TEnableAccessibleFieldDOMStructure>, 'tabs'> {
|
|
7
|
+
export interface DesktopDateRangePickerSlotProps<TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean> extends BaseDateRangePickerSlotProps<TDate>, Omit<UseDesktopRangePickerSlotProps<TDate, 'day', TEnableAccessibleFieldDOMStructure>, 'tabs' | 'toolbar'> {
|
|
8
8
|
}
|
|
9
9
|
export interface DesktopDateRangePickerProps<TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean = false> extends BaseDateRangePickerProps<TDate>, DesktopRangeOnlyPickerProps {
|
|
10
10
|
/**
|
|
@@ -4,7 +4,7 @@ import { UseMobileRangePickerSlots, UseMobileRangePickerSlotProps, MobileRangeOn
|
|
|
4
4
|
import { BaseDateRangePickerProps, BaseDateRangePickerSlots, BaseDateRangePickerSlotProps } from '../DateRangePicker/shared';
|
|
5
5
|
export interface MobileDateRangePickerSlots<TDate extends PickerValidDate> extends BaseDateRangePickerSlots<TDate>, MakeOptional<UseMobileRangePickerSlots<TDate, 'day'>, 'field'> {
|
|
6
6
|
}
|
|
7
|
-
export interface MobileDateRangePickerSlotProps<TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean> extends BaseDateRangePickerSlotProps<TDate>, Omit<UseMobileRangePickerSlotProps<TDate, 'day', TEnableAccessibleFieldDOMStructure>, 'tabs'> {
|
|
7
|
+
export interface MobileDateRangePickerSlotProps<TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean> extends BaseDateRangePickerSlotProps<TDate>, Omit<UseMobileRangePickerSlotProps<TDate, 'day', TEnableAccessibleFieldDOMStructure>, 'tabs' | 'toolbar'> {
|
|
8
8
|
}
|
|
9
9
|
export interface MobileDateRangePickerProps<TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean = false> extends BaseDateRangePickerProps<TDate>, MobileRangeOnlyPickerProps {
|
|
10
10
|
/**
|
|
@@ -4,7 +4,7 @@ import { StaticRangeOnlyPickerProps, UseStaticRangePickerSlots, UseStaticRangePi
|
|
|
4
4
|
import { BaseDateRangePickerProps, BaseDateRangePickerSlots, BaseDateRangePickerSlotProps } from '../DateRangePicker/shared';
|
|
5
5
|
export interface StaticDateRangePickerSlots<TDate extends PickerValidDate> extends BaseDateRangePickerSlots<TDate>, UseStaticRangePickerSlots<TDate, 'day'> {
|
|
6
6
|
}
|
|
7
|
-
export interface StaticDateRangePickerSlotProps<TDate extends PickerValidDate> extends BaseDateRangePickerSlotProps<TDate>, UseStaticRangePickerSlotProps<TDate, 'day'> {
|
|
7
|
+
export interface StaticDateRangePickerSlotProps<TDate extends PickerValidDate> extends BaseDateRangePickerSlotProps<TDate>, Omit<UseStaticRangePickerSlotProps<TDate, 'day'>, 'toolbar'> {
|
|
8
8
|
}
|
|
9
9
|
export interface StaticDateRangePickerProps<TDate extends PickerValidDate> extends BaseDateRangePickerProps<TDate>, MakeOptional<StaticRangeOnlyPickerProps, 'displayStaticWrapperAs'> {
|
|
10
10
|
/**
|
package/index.js
CHANGED
|
@@ -118,7 +118,7 @@ export const useMobileRangePicker = _ref => {
|
|
|
118
118
|
});
|
|
119
119
|
const Layout = (_slots$layout = slots == null ? void 0 : slots.layout) != null ? _slots$layout : PickersLayout;
|
|
120
120
|
const finalLocaleText = _extends({}, contextLocaleText, localeText);
|
|
121
|
-
let labelledById = labelId;
|
|
121
|
+
let labelledById = pickerParams.valueType === 'date-time' ? `${labelId}-start-toolbar ${labelId}-end-toolbar` : labelId;
|
|
122
122
|
if (isToolbarHidden) {
|
|
123
123
|
const labels = [];
|
|
124
124
|
if (fieldType === 'multi-input') {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export const getReleaseInfo = () => {
|
|
3
|
-
const releaseInfo = "
|
|
3
|
+
const releaseInfo = "MTcwOTg1MjQwMDAwMA==";
|
|
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,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["value", "rangePosition", "onRangePositionChange", "toolbarFormat", "className"];
|
|
3
|
+
const _excluded = ["value", "rangePosition", "onRangePositionChange", "toolbarFormat", "className", "onViewChange", "view", "views"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import clsx from 'clsx';
|
|
@@ -105,6 +105,12 @@ process.env.NODE_ENV !== "production" ? DateRangePickerToolbar.propTypes = {
|
|
|
105
105
|
*/
|
|
106
106
|
hidden: PropTypes.bool,
|
|
107
107
|
onRangePositionChange: PropTypes.func.isRequired,
|
|
108
|
+
/**
|
|
109
|
+
* Callback called when a toolbar is clicked
|
|
110
|
+
* @template TView
|
|
111
|
+
* @param {TView} view The view to open
|
|
112
|
+
*/
|
|
113
|
+
onViewChange: PropTypes.func.isRequired,
|
|
108
114
|
rangePosition: PropTypes.oneOf(['end', 'start']).isRequired,
|
|
109
115
|
readOnly: PropTypes.bool,
|
|
110
116
|
/**
|
|
@@ -121,6 +127,14 @@ process.env.NODE_ENV !== "production" ? DateRangePickerToolbar.propTypes = {
|
|
|
121
127
|
* @default "––"
|
|
122
128
|
*/
|
|
123
129
|
toolbarPlaceholder: PropTypes.node,
|
|
124
|
-
value: PropTypes.arrayOf(PropTypes.object).isRequired
|
|
130
|
+
value: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
131
|
+
/**
|
|
132
|
+
* Currently visible picker view.
|
|
133
|
+
*/
|
|
134
|
+
view: PropTypes.oneOf(['day']).isRequired,
|
|
135
|
+
/**
|
|
136
|
+
* Available views.
|
|
137
|
+
*/
|
|
138
|
+
views: PropTypes.arrayOf(PropTypes.oneOf(['day'])).isRequired
|
|
125
139
|
} : void 0;
|
|
126
140
|
export { DateRangePickerToolbar };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["value", "rangePosition", "onRangePositionChange", "className", "onViewChange", "toolbarVariant", "onChange", "classes", "view"];
|
|
3
|
+
const _excluded = ["value", "rangePosition", "onRangePositionChange", "className", "onViewChange", "toolbarVariant", "onChange", "classes", "view", "isLandscape", "views", "ampm", "disabled", "readOnly", "hidden", "toolbarFormat", "toolbarPlaceholder", "titleId", "sx"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import clsx from 'clsx';
|
|
@@ -66,9 +66,29 @@ const DateTimeRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateTi
|
|
|
66
66
|
className,
|
|
67
67
|
onViewChange,
|
|
68
68
|
onChange,
|
|
69
|
-
view
|
|
69
|
+
view,
|
|
70
|
+
isLandscape,
|
|
71
|
+
views,
|
|
72
|
+
ampm,
|
|
73
|
+
disabled,
|
|
74
|
+
readOnly,
|
|
75
|
+
hidden,
|
|
76
|
+
toolbarFormat,
|
|
77
|
+
toolbarPlaceholder,
|
|
78
|
+
titleId,
|
|
79
|
+
sx
|
|
70
80
|
} = props,
|
|
71
81
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
82
|
+
const commonToolbarProps = {
|
|
83
|
+
isLandscape,
|
|
84
|
+
views,
|
|
85
|
+
ampm,
|
|
86
|
+
disabled,
|
|
87
|
+
readOnly,
|
|
88
|
+
hidden,
|
|
89
|
+
toolbarFormat,
|
|
90
|
+
toolbarPlaceholder
|
|
91
|
+
};
|
|
72
92
|
const localeText = useLocaleText();
|
|
73
93
|
const ownerState = props;
|
|
74
94
|
const classes = useUtilityClasses(ownerState);
|
|
@@ -104,11 +124,16 @@ const DateTimeRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateTi
|
|
|
104
124
|
onRangePositionChange(nextSelection);
|
|
105
125
|
onChange(newRange);
|
|
106
126
|
}, [onChange, onRangePositionChange, props.value, rangePosition, utils]);
|
|
107
|
-
|
|
127
|
+
if (hidden) {
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
return /*#__PURE__*/_jsxs(DateTimeRangePickerToolbarRoot, _extends({
|
|
108
131
|
className: clsx(className, classes.root),
|
|
109
132
|
ownerState: ownerState,
|
|
110
133
|
ref: ref,
|
|
111
|
-
|
|
134
|
+
sx: sx
|
|
135
|
+
}, other, {
|
|
136
|
+
children: [/*#__PURE__*/_jsx(DateTimeRangePickerToolbarStart, _extends({
|
|
112
137
|
value: start,
|
|
113
138
|
onViewChange: handleStartRangeViewChange,
|
|
114
139
|
toolbarTitle: localeText.start,
|
|
@@ -116,8 +141,9 @@ const DateTimeRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateTi
|
|
|
116
141
|
toolbarVariant: "desktop",
|
|
117
142
|
view: rangePosition === 'start' ? view : undefined,
|
|
118
143
|
className: classes.startToolbar,
|
|
119
|
-
onChange: handleOnChange
|
|
120
|
-
|
|
144
|
+
onChange: handleOnChange,
|
|
145
|
+
titleId: titleId ? `${titleId}-start-toolbar` : undefined
|
|
146
|
+
}, commonToolbarProps)), /*#__PURE__*/_jsx(DateTimeRangePickerToolbarEnd, _extends({
|
|
121
147
|
value: end,
|
|
122
148
|
onViewChange: handleEndRangeViewChange,
|
|
123
149
|
toolbarTitle: localeText.end,
|
|
@@ -125,9 +151,10 @@ const DateTimeRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateTi
|
|
|
125
151
|
toolbarVariant: "desktop",
|
|
126
152
|
view: rangePosition === 'end' ? view : undefined,
|
|
127
153
|
className: classes.endToolbar,
|
|
128
|
-
onChange: handleOnChange
|
|
129
|
-
|
|
130
|
-
|
|
154
|
+
onChange: handleOnChange,
|
|
155
|
+
titleId: titleId ? `${titleId}-end-toolbar` : undefined
|
|
156
|
+
}, commonToolbarProps))]
|
|
157
|
+
}));
|
|
131
158
|
});
|
|
132
159
|
process.env.NODE_ENV !== "production" ? DateTimeRangePickerToolbar.propTypes = {
|
|
133
160
|
// ----------------------------- Warning --------------------------------
|
|
@@ -177,6 +204,9 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePickerToolbar.propTypes = {
|
|
|
177
204
|
* Currently visible picker view.
|
|
178
205
|
*/
|
|
179
206
|
view: PropTypes.oneOf(['day', 'hours', 'meridiem', 'minutes', 'seconds']).isRequired,
|
|
207
|
+
/**
|
|
208
|
+
* Available views.
|
|
209
|
+
*/
|
|
180
210
|
views: PropTypes.arrayOf(PropTypes.oneOf(['day', 'hours', 'meridiem', 'minutes', 'seconds']).isRequired).isRequired
|
|
181
211
|
} : void 0;
|
|
182
212
|
export { DateTimeRangePickerToolbar };
|
|
@@ -40,8 +40,13 @@ export function useDateTimeRangePickerDefaultizedProps(props, name) {
|
|
|
40
40
|
ampm,
|
|
41
41
|
disableFuture: themeProps.disableFuture ?? false,
|
|
42
42
|
disablePast: themeProps.disablePast ?? false,
|
|
43
|
-
minDate: applyDefaultDate(utils, themeProps.minDate, defaultDates.minDate),
|
|
44
|
-
maxDate: applyDefaultDate(utils, themeProps.maxDate, defaultDates.maxDate),
|
|
43
|
+
minDate: applyDefaultDate(utils, themeProps.minDateTime ?? themeProps.minDate, defaultDates.minDate),
|
|
44
|
+
maxDate: applyDefaultDate(utils, themeProps.maxDateTime ?? themeProps.maxDate, defaultDates.maxDate),
|
|
45
|
+
minTime: themeProps.minDateTime ?? themeProps.minTime,
|
|
46
|
+
maxTime: themeProps.maxDateTime ?? themeProps.maxTime,
|
|
47
|
+
disableIgnoringDatePartForTimeValidation: themeProps.disableIgnoringDatePartForTimeValidation ?? Boolean(themeProps.minDateTime || themeProps.maxDateTime ||
|
|
48
|
+
// allow digital clocks to correctly check time validity: https://github.com/mui/mui-x/issues/12048
|
|
49
|
+
themeProps.disablePast || themeProps.disableFuture),
|
|
45
50
|
slots: _extends({
|
|
46
51
|
tabs: DateTimeRangePickerTabs,
|
|
47
52
|
toolbar: DateTimeRangePickerToolbar
|
package/modern/index.js
CHANGED
|
@@ -117,7 +117,7 @@ export const useMobileRangePicker = _ref => {
|
|
|
117
117
|
});
|
|
118
118
|
const Layout = slots?.layout ?? PickersLayout;
|
|
119
119
|
const finalLocaleText = _extends({}, contextLocaleText, localeText);
|
|
120
|
-
let labelledById = labelId;
|
|
120
|
+
let labelledById = pickerParams.valueType === 'date-time' ? `${labelId}-start-toolbar ${labelId}-end-toolbar` : labelId;
|
|
121
121
|
if (isToolbarHidden) {
|
|
122
122
|
const labels = [];
|
|
123
123
|
if (fieldType === 'multi-input') {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export const getReleaseInfo = () => {
|
|
3
|
-
const releaseInfo = "
|
|
3
|
+
const releaseInfo = "MTcwOTg1MjQwMDAwMA==";
|
|
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
|
|
@@ -16,7 +16,7 @@ var _utils = require("@mui/utils");
|
|
|
16
16
|
var _internals = require("@mui/x-date-pickers/internals");
|
|
17
17
|
var _dateRangePickerToolbarClasses = require("./dateRangePickerToolbarClasses");
|
|
18
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
-
const _excluded = ["value", "rangePosition", "onRangePositionChange", "toolbarFormat", "className"];
|
|
19
|
+
const _excluded = ["value", "rangePosition", "onRangePositionChange", "toolbarFormat", "className", "onViewChange", "view", "views"];
|
|
20
20
|
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); }
|
|
21
21
|
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 && Object.prototype.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; }
|
|
22
22
|
const useUtilityClasses = ownerState => {
|
|
@@ -113,6 +113,12 @@ process.env.NODE_ENV !== "production" ? DateRangePickerToolbar.propTypes = {
|
|
|
113
113
|
*/
|
|
114
114
|
hidden: _propTypes.default.bool,
|
|
115
115
|
onRangePositionChange: _propTypes.default.func.isRequired,
|
|
116
|
+
/**
|
|
117
|
+
* Callback called when a toolbar is clicked
|
|
118
|
+
* @template TView
|
|
119
|
+
* @param {TView} view The view to open
|
|
120
|
+
*/
|
|
121
|
+
onViewChange: _propTypes.default.func.isRequired,
|
|
116
122
|
rangePosition: _propTypes.default.oneOf(['end', 'start']).isRequired,
|
|
117
123
|
readOnly: _propTypes.default.bool,
|
|
118
124
|
/**
|
|
@@ -129,5 +135,13 @@ process.env.NODE_ENV !== "production" ? DateRangePickerToolbar.propTypes = {
|
|
|
129
135
|
* @default "––"
|
|
130
136
|
*/
|
|
131
137
|
toolbarPlaceholder: _propTypes.default.node,
|
|
132
|
-
value: _propTypes.default.arrayOf(_propTypes.default.object).isRequired
|
|
138
|
+
value: _propTypes.default.arrayOf(_propTypes.default.object).isRequired,
|
|
139
|
+
/**
|
|
140
|
+
* Currently visible picker view.
|
|
141
|
+
*/
|
|
142
|
+
view: _propTypes.default.oneOf(['day']).isRequired,
|
|
143
|
+
/**
|
|
144
|
+
* Available views.
|
|
145
|
+
*/
|
|
146
|
+
views: _propTypes.default.arrayOf(_propTypes.default.oneOf(['day'])).isRequired
|
|
133
147
|
} : void 0;
|
|
@@ -17,7 +17,7 @@ var _DateTimePicker = require("@mui/x-date-pickers/DateTimePicker");
|
|
|
17
17
|
var _dateTimeRangePickerToolbarClasses = require("./dateTimeRangePickerToolbarClasses");
|
|
18
18
|
var _dateRangeManager = require("../internals/utils/date-range-manager");
|
|
19
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
|
-
const _excluded = ["value", "rangePosition", "onRangePositionChange", "className", "onViewChange", "toolbarVariant", "onChange", "classes", "view"];
|
|
20
|
+
const _excluded = ["value", "rangePosition", "onRangePositionChange", "className", "onViewChange", "toolbarVariant", "onChange", "classes", "view", "isLandscape", "views", "ampm", "disabled", "readOnly", "hidden", "toolbarFormat", "toolbarPlaceholder", "titleId", "sx"];
|
|
21
21
|
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); }
|
|
22
22
|
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 && Object.prototype.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; }
|
|
23
23
|
const useUtilityClasses = ownerState => {
|
|
@@ -74,9 +74,29 @@ const DateTimeRangePickerToolbar = exports.DateTimeRangePickerToolbar = /*#__PUR
|
|
|
74
74
|
className,
|
|
75
75
|
onViewChange,
|
|
76
76
|
onChange,
|
|
77
|
-
view
|
|
77
|
+
view,
|
|
78
|
+
isLandscape,
|
|
79
|
+
views,
|
|
80
|
+
ampm,
|
|
81
|
+
disabled,
|
|
82
|
+
readOnly,
|
|
83
|
+
hidden,
|
|
84
|
+
toolbarFormat,
|
|
85
|
+
toolbarPlaceholder,
|
|
86
|
+
titleId,
|
|
87
|
+
sx
|
|
78
88
|
} = props,
|
|
79
89
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
90
|
+
const commonToolbarProps = {
|
|
91
|
+
isLandscape,
|
|
92
|
+
views,
|
|
93
|
+
ampm,
|
|
94
|
+
disabled,
|
|
95
|
+
readOnly,
|
|
96
|
+
hidden,
|
|
97
|
+
toolbarFormat,
|
|
98
|
+
toolbarPlaceholder
|
|
99
|
+
};
|
|
80
100
|
const localeText = (0, _internals.useLocaleText)();
|
|
81
101
|
const ownerState = props;
|
|
82
102
|
const classes = useUtilityClasses(ownerState);
|
|
@@ -112,11 +132,16 @@ const DateTimeRangePickerToolbar = exports.DateTimeRangePickerToolbar = /*#__PUR
|
|
|
112
132
|
onRangePositionChange(nextSelection);
|
|
113
133
|
onChange(newRange);
|
|
114
134
|
}, [onChange, onRangePositionChange, props.value, rangePosition, utils]);
|
|
115
|
-
|
|
135
|
+
if (hidden) {
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(DateTimeRangePickerToolbarRoot, (0, _extends2.default)({
|
|
116
139
|
className: (0, _clsx.default)(className, classes.root),
|
|
117
140
|
ownerState: ownerState,
|
|
118
141
|
ref: ref,
|
|
119
|
-
|
|
142
|
+
sx: sx
|
|
143
|
+
}, other, {
|
|
144
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(DateTimeRangePickerToolbarStart, (0, _extends2.default)({
|
|
120
145
|
value: start,
|
|
121
146
|
onViewChange: handleStartRangeViewChange,
|
|
122
147
|
toolbarTitle: localeText.start,
|
|
@@ -124,8 +149,9 @@ const DateTimeRangePickerToolbar = exports.DateTimeRangePickerToolbar = /*#__PUR
|
|
|
124
149
|
toolbarVariant: "desktop",
|
|
125
150
|
view: rangePosition === 'start' ? view : undefined,
|
|
126
151
|
className: classes.startToolbar,
|
|
127
|
-
onChange: handleOnChange
|
|
128
|
-
|
|
152
|
+
onChange: handleOnChange,
|
|
153
|
+
titleId: titleId ? `${titleId}-start-toolbar` : undefined
|
|
154
|
+
}, commonToolbarProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(DateTimeRangePickerToolbarEnd, (0, _extends2.default)({
|
|
129
155
|
value: end,
|
|
130
156
|
onViewChange: handleEndRangeViewChange,
|
|
131
157
|
toolbarTitle: localeText.end,
|
|
@@ -133,9 +159,10 @@ const DateTimeRangePickerToolbar = exports.DateTimeRangePickerToolbar = /*#__PUR
|
|
|
133
159
|
toolbarVariant: "desktop",
|
|
134
160
|
view: rangePosition === 'end' ? view : undefined,
|
|
135
161
|
className: classes.endToolbar,
|
|
136
|
-
onChange: handleOnChange
|
|
137
|
-
|
|
138
|
-
|
|
162
|
+
onChange: handleOnChange,
|
|
163
|
+
titleId: titleId ? `${titleId}-end-toolbar` : undefined
|
|
164
|
+
}, commonToolbarProps))]
|
|
165
|
+
}));
|
|
139
166
|
});
|
|
140
167
|
process.env.NODE_ENV !== "production" ? DateTimeRangePickerToolbar.propTypes = {
|
|
141
168
|
// ----------------------------- Warning --------------------------------
|
|
@@ -185,5 +212,8 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePickerToolbar.propTypes = {
|
|
|
185
212
|
* Currently visible picker view.
|
|
186
213
|
*/
|
|
187
214
|
view: _propTypes.default.oneOf(['day', 'hours', 'meridiem', 'minutes', 'seconds']).isRequired,
|
|
215
|
+
/**
|
|
216
|
+
* Available views.
|
|
217
|
+
*/
|
|
188
218
|
views: _propTypes.default.arrayOf(_propTypes.default.oneOf(['day', 'hours', 'meridiem', 'minutes', 'seconds']).isRequired).isRequired
|
|
189
219
|
} : void 0;
|
|
@@ -47,8 +47,13 @@ function useDateTimeRangePickerDefaultizedProps(props, name) {
|
|
|
47
47
|
ampm,
|
|
48
48
|
disableFuture: themeProps.disableFuture ?? false,
|
|
49
49
|
disablePast: themeProps.disablePast ?? false,
|
|
50
|
-
minDate: (0, _internals.applyDefaultDate)(utils, themeProps.minDate, defaultDates.minDate),
|
|
51
|
-
maxDate: (0, _internals.applyDefaultDate)(utils, themeProps.maxDate, defaultDates.maxDate),
|
|
50
|
+
minDate: (0, _internals.applyDefaultDate)(utils, themeProps.minDateTime ?? themeProps.minDate, defaultDates.minDate),
|
|
51
|
+
maxDate: (0, _internals.applyDefaultDate)(utils, themeProps.maxDateTime ?? themeProps.maxDate, defaultDates.maxDate),
|
|
52
|
+
minTime: themeProps.minDateTime ?? themeProps.minTime,
|
|
53
|
+
maxTime: themeProps.maxDateTime ?? themeProps.maxTime,
|
|
54
|
+
disableIgnoringDatePartForTimeValidation: themeProps.disableIgnoringDatePartForTimeValidation ?? Boolean(themeProps.minDateTime || themeProps.maxDateTime ||
|
|
55
|
+
// allow digital clocks to correctly check time validity: https://github.com/mui/mui-x/issues/12048
|
|
56
|
+
themeProps.disablePast || themeProps.disableFuture),
|
|
52
57
|
slots: (0, _extends2.default)({
|
|
53
58
|
tabs: _DateTimeRangePickerTabs.DateTimeRangePickerTabs,
|
|
54
59
|
toolbar: _DateTimeRangePickerToolbar.DateTimeRangePickerToolbar
|
package/node/index.js
CHANGED
|
@@ -125,7 +125,7 @@ const useMobileRangePicker = _ref => {
|
|
|
125
125
|
});
|
|
126
126
|
const Layout = slots?.layout ?? _PickersLayout.PickersLayout;
|
|
127
127
|
const finalLocaleText = (0, _extends2.default)({}, contextLocaleText, localeText);
|
|
128
|
-
let labelledById = labelId;
|
|
128
|
+
let labelledById = pickerParams.valueType === 'date-time' ? `${labelId}-start-toolbar ${labelId}-end-toolbar` : labelId;
|
|
129
129
|
if (isToolbarHidden) {
|
|
130
130
|
const labels = [];
|
|
131
131
|
if (fieldType === 'multi-input') {
|
|
@@ -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 = "MTcwOTg1MjQwMDAwMA==";
|
|
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.0.0-beta.
|
|
3
|
+
"version": "7.0.0-beta.6",
|
|
4
4
|
"description": "The commercial edition of the date picker components (MUI X).",
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"main": "./node/index.js",
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
"directory": "packages/x-date-pickers-pro"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@babel/runtime": "^7.
|
|
34
|
+
"@babel/runtime": "^7.24.0",
|
|
35
35
|
"@mui/base": "^5.0.0-beta.36",
|
|
36
36
|
"@mui/system": "^5.15.9",
|
|
37
37
|
"@mui/utils": "^5.15.9",
|
|
38
|
-
"@mui/x-date-pickers": "7.0.0-beta.
|
|
39
|
-
"@mui/x-license": "7.0.0-beta.
|
|
38
|
+
"@mui/x-date-pickers": "7.0.0-beta.6",
|
|
39
|
+
"@mui/x-license": "7.0.0-beta.6",
|
|
40
40
|
"clsx": "^2.1.0",
|
|
41
41
|
"prop-types": "^15.8.1",
|
|
42
42
|
"react-transition-group": "^4.4.5"
|
|
@@ -3,7 +3,8 @@ import { DateRangePickerDayProps } from '../DateRangePickerDay';
|
|
|
3
3
|
import { MultiInputDateRangeFieldProps } from '../MultiInputDateRangeField/MultiInputDateRangeField.types';
|
|
4
4
|
import { SingleInputDateRangeFieldProps } from '../SingleInputDateRangeField/SingleInputDateRangeField.types';
|
|
5
5
|
import { DateRangeCalendarProps } from '../DateRangeCalendar';
|
|
6
|
-
import { DateRangePickerProps
|
|
6
|
+
import { DateRangePickerProps } from '../DateRangePicker';
|
|
7
|
+
import { ExportedDateRangePickerToolbarProps } from '../DateRangePicker/DateRangePickerToolbar';
|
|
7
8
|
import { DesktopDateRangePickerProps } from '../DesktopDateRangePicker';
|
|
8
9
|
import { MobileDateRangePickerProps } from '../MobileDateRangePicker';
|
|
9
10
|
import { StaticDateRangePickerProps } from '../StaticDateRangePicker';
|
|
@@ -21,7 +22,7 @@ export interface PickersProComponentsPropsList {
|
|
|
21
22
|
MuiDateRangeCalendar: DateRangeCalendarProps<PickerValidDate>;
|
|
22
23
|
MuiDateRangePickerDay: DateRangePickerDayProps<PickerValidDate>;
|
|
23
24
|
MuiDateTimeRangePickerTabs: ExportedDateTimeRangePickerTabsProps;
|
|
24
|
-
MuiDateRangePickerToolbar:
|
|
25
|
+
MuiDateRangePickerToolbar: ExportedDateRangePickerToolbarProps;
|
|
25
26
|
MuiDateTimeRangePickerToolbar: ExportedDateTimeRangePickerToolbarProps;
|
|
26
27
|
|
|
27
28
|
// Multi input range fields
|