@mui/x-date-pickers-pro 6.11.1 → 6.11.2
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 +57 -1
- package/DateRangeCalendar/DateRangeCalendar.js +2 -2
- package/DateRangeCalendar/DateRangeCalendar.types.d.ts +2 -2
- package/DateRangePicker/DateRangePicker.js +2 -2
- package/DesktopDateRangePicker/DesktopDateRangePicker.js +2 -2
- package/MobileDateRangePicker/MobileDateRangePicker.js +2 -2
- package/StaticDateRangePicker/StaticDateRangePicker.js +2 -2
- package/index.js +1 -1
- package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +3 -1
- package/internals/utils/releaseInfo.js +1 -1
- package/legacy/DateRangeCalendar/DateRangeCalendar.js +2 -2
- package/legacy/DateRangePicker/DateRangePicker.js +2 -2
- package/legacy/DesktopDateRangePicker/DesktopDateRangePicker.js +2 -2
- package/legacy/MobileDateRangePicker/MobileDateRangePicker.js +2 -2
- package/legacy/StaticDateRangePicker/StaticDateRangePicker.js +2 -2
- package/legacy/index.js +1 -1
- package/legacy/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +3 -1
- package/legacy/internals/utils/releaseInfo.js +1 -1
- package/legacy/tests/describeRangeValidation/testDayViewRangeValidation.js +1 -1
- package/legacy/tests/describeRangeValidation/testTextFieldKeyboardRangeValidation.js +1 -1
- package/legacy/tests/describeRangeValidation/testTextFieldRangeValidation.js +1 -1
- package/modern/DateRangeCalendar/DateRangeCalendar.js +2 -2
- package/modern/DateRangePicker/DateRangePicker.js +2 -2
- package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +2 -2
- package/modern/MobileDateRangePicker/MobileDateRangePicker.js +2 -2
- package/modern/StaticDateRangePicker/StaticDateRangePicker.js +2 -2
- package/modern/index.js +1 -1
- package/modern/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +3 -1
- package/modern/internals/utils/releaseInfo.js +1 -1
- package/modern/tests/describeRangeValidation/testDayViewRangeValidation.js +1 -1
- package/modern/tests/describeRangeValidation/testTextFieldKeyboardRangeValidation.js +1 -1
- package/modern/tests/describeRangeValidation/testTextFieldRangeValidation.js +1 -1
- package/node/DateRangeCalendar/DateRangeCalendar.js +2 -2
- package/node/DateRangePicker/DateRangePicker.js +2 -2
- package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +2 -2
- package/node/MobileDateRangePicker/MobileDateRangePicker.js +2 -2
- package/node/StaticDateRangePicker/StaticDateRangePicker.js +2 -2
- package/node/index.js +1 -1
- package/node/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +3 -1
- package/node/internals/utils/releaseInfo.js +1 -1
- package/node/tests/describeRangeValidation/testDayViewRangeValidation.js +21 -21
- package/node/tests/describeRangeValidation/testTextFieldKeyboardRangeValidation.js +30 -30
- package/node/tests/describeRangeValidation/testTextFieldRangeValidation.js +32 -32
- package/package.json +3 -3
- package/tests/describeRangeValidation/testDayViewRangeValidation.js +1 -1
- package/tests/describeRangeValidation/testTextFieldKeyboardRangeValidation.js +1 -1
- package/tests/describeRangeValidation/testTextFieldRangeValidation.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,62 @@
|
|
|
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
|
+
## 6.11.2
|
|
7
|
+
|
|
8
|
+
_Aug 17, 2023_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 8 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🏎️ Lower the filtering delay in the grid
|
|
13
|
+
- 🌍 Improve Spanish (es-ES) locale on the data grid
|
|
14
|
+
- 🐞 Bugfixes
|
|
15
|
+
- 📚 Documentation improvements
|
|
16
|
+
|
|
17
|
+
### Data Grid
|
|
18
|
+
|
|
19
|
+
#### `@mui/x-data-grid@v6.11.2`
|
|
20
|
+
|
|
21
|
+
- [DataGrid] Fix `eval` blocked by CSP (#9863) @romgrk
|
|
22
|
+
- [DataGrid] Fix row id bug (#10051) @romgrk
|
|
23
|
+
- [DataGrid] Honor `disableExport` flag in Print Export (#10044) @MBilalShafi
|
|
24
|
+
- [DataGrid] Lower filter debounce delay (#9712) @romgrk
|
|
25
|
+
- [DataGrid] Unhide potential ref binding issue (#9965) @oliviertassinari
|
|
26
|
+
- [l10n] Improve Chinese (zh-CN) and Chinese(traditional) (zh-TW) locales (#9999) @MyNameIsTakenOMG
|
|
27
|
+
- [l10n] Improve Spanish (es-ES) locale (#10037) @Macampu420
|
|
28
|
+
|
|
29
|
+
#### `@mui/x-data-grid-pro@v6.11.2` [](https://mui.com/r/x-pro-svg-link)
|
|
30
|
+
|
|
31
|
+
Same changes as in `@mui/x-data-grid@v6.11.2`.
|
|
32
|
+
|
|
33
|
+
#### `@mui/x-data-grid-premium@v6.11.2` [](https://mui.com/r/x-premium-svg-link)
|
|
34
|
+
|
|
35
|
+
Same changes as in `@mui/x-data-grid-pro@v6.11.2`.
|
|
36
|
+
|
|
37
|
+
### Date Pickers
|
|
38
|
+
|
|
39
|
+
#### `@mui/x-date-pickers@v6.11.2`
|
|
40
|
+
|
|
41
|
+
- [pickers] Fix month switcher RTL (#10003) @alexfauquette
|
|
42
|
+
- [pickers] Follow-up on using device motion reduction preference (#9858) @LukasTy
|
|
43
|
+
- [pickers] Pass the shortcut information in the `onChange` context (#9985) @flaviendelangle
|
|
44
|
+
- [pickers] Replace `Grid` toolbar component with a styled `div` (#10052) @LukasTy
|
|
45
|
+
|
|
46
|
+
#### `@mui/x-date-pickers-pro@v6.11.2` [](https://mui.com/r/x-pro-svg-link)
|
|
47
|
+
|
|
48
|
+
Same changes as in `@mui/x-date-pickers@v6.11.2`.
|
|
49
|
+
|
|
50
|
+
### Docs
|
|
51
|
+
|
|
52
|
+
- [docs] Add migration guide for the Tree View (#9987) @flaviendelangle
|
|
53
|
+
- [docs] Fix en-US changelog @oliviertassinari
|
|
54
|
+
- [docs] Update column types (#10040) @romgrk
|
|
55
|
+
|
|
56
|
+
### Core
|
|
57
|
+
|
|
58
|
+
- [core] Remove unnecessary Box (#9831) @oliviertassinari
|
|
59
|
+
- [core] Set GitHub Action top level permission @oliviertassinari
|
|
60
|
+
- [core] Split the pickers test utils (#9976) @flaviendelangle
|
|
61
|
+
|
|
6
62
|
## 6.11.1
|
|
7
63
|
|
|
8
64
|
_Aug 11, 2023_
|
|
@@ -2872,7 +2928,7 @@ We'd like to offer a big thanks to the 8 contributors who made this release poss
|
|
|
2872
2928
|
|
|
2873
2929
|
#### Changes
|
|
2874
2930
|
|
|
2875
|
-
- [DateRangePicker] Fix input focused style and mobile
|
|
2931
|
+
- [DateRangePicker] Fix input focused style and mobile behavior (#6645) @LukasTy
|
|
2876
2932
|
- [fields] Update sections when the locale changes (#6649) @flaviendelangle
|
|
2877
2933
|
- [pickers] Add Ukrainian (uk-UA) locale (#6661) @Dufran
|
|
2878
2934
|
- [pickers] Allow non-controlled usage of the calendar components (#6643) @flaviendelangle
|
|
@@ -610,8 +610,8 @@ process.env.NODE_ENV !== "production" ? DateRangeCalendar.propTypes = {
|
|
|
610
610
|
*/
|
|
611
611
|
readOnly: PropTypes.bool,
|
|
612
612
|
/**
|
|
613
|
-
*
|
|
614
|
-
* @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
613
|
+
* If `true`, disable heavy animations.
|
|
614
|
+
* @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
615
615
|
*/
|
|
616
616
|
reduceAnimations: PropTypes.bool,
|
|
617
617
|
/**
|
|
@@ -45,8 +45,8 @@ export interface ExportedDateRangeCalendarProps<TDate> extends ExportedDayCalend
|
|
|
45
45
|
*/
|
|
46
46
|
readOnly?: boolean;
|
|
47
47
|
/**
|
|
48
|
-
*
|
|
49
|
-
* @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
48
|
+
* If `true`, disable heavy animations.
|
|
49
|
+
* @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
50
50
|
*/
|
|
51
51
|
reduceAnimations?: boolean;
|
|
52
52
|
/**
|
|
@@ -251,8 +251,8 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
|
|
|
251
251
|
rangePosition: PropTypes.oneOf(['end', 'start']),
|
|
252
252
|
readOnly: PropTypes.bool,
|
|
253
253
|
/**
|
|
254
|
-
*
|
|
255
|
-
* @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
254
|
+
* If `true`, disable heavy animations.
|
|
255
|
+
* @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
256
256
|
*/
|
|
257
257
|
reduceAnimations: PropTypes.bool,
|
|
258
258
|
/**
|
|
@@ -260,8 +260,8 @@ DesktopDateRangePicker.propTypes = {
|
|
|
260
260
|
rangePosition: PropTypes.oneOf(['end', 'start']),
|
|
261
261
|
readOnly: PropTypes.bool,
|
|
262
262
|
/**
|
|
263
|
-
*
|
|
264
|
-
* @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
263
|
+
* If `true`, disable heavy animations.
|
|
264
|
+
* @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
265
265
|
*/
|
|
266
266
|
reduceAnimations: PropTypes.bool,
|
|
267
267
|
/**
|
|
@@ -260,8 +260,8 @@ MobileDateRangePicker.propTypes = {
|
|
|
260
260
|
rangePosition: PropTypes.oneOf(['end', 'start']),
|
|
261
261
|
readOnly: PropTypes.bool,
|
|
262
262
|
/**
|
|
263
|
-
*
|
|
264
|
-
* @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
263
|
+
* If `true`, disable heavy animations.
|
|
264
|
+
* @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
265
265
|
*/
|
|
266
266
|
reduceAnimations: PropTypes.bool,
|
|
267
267
|
/**
|
|
@@ -210,8 +210,8 @@ StaticDateRangePicker.propTypes = {
|
|
|
210
210
|
rangePosition: PropTypes.oneOf(['end', 'start']),
|
|
211
211
|
readOnly: PropTypes.bool,
|
|
212
212
|
/**
|
|
213
|
-
*
|
|
214
|
-
* @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
213
|
+
* If `true`, disable heavy animations.
|
|
214
|
+
* @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
215
215
|
*/
|
|
216
216
|
reduceAnimations: PropTypes.bool,
|
|
217
217
|
/**
|
package/index.js
CHANGED
|
@@ -34,7 +34,8 @@ export const useDesktopRangePicker = _ref => {
|
|
|
34
34
|
disabled,
|
|
35
35
|
autoFocus,
|
|
36
36
|
disableOpenPicker,
|
|
37
|
-
localeText
|
|
37
|
+
localeText,
|
|
38
|
+
reduceAnimations
|
|
38
39
|
} = props;
|
|
39
40
|
const fieldContainerRef = React.useRef(null);
|
|
40
41
|
const popperRef = React.useRef(null);
|
|
@@ -124,6 +125,7 @@ export const useDesktopRangePicker = _ref => {
|
|
|
124
125
|
slots: slots,
|
|
125
126
|
slotProps: slotProps,
|
|
126
127
|
shouldRestoreFocus: shouldRestoreFocus,
|
|
128
|
+
reduceAnimations: reduceAnimations,
|
|
127
129
|
children: /*#__PURE__*/_jsx(Layout, _extends({}, layoutProps, slotProps == null ? void 0 : slotProps.layout, {
|
|
128
130
|
slots: slots,
|
|
129
131
|
slotProps: slotPropsForLayout,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export const getReleaseInfo = () => {
|
|
3
|
-
const releaseInfo = "
|
|
3
|
+
const releaseInfo = "MTY5MjI0NDgwMDAwMA==";
|
|
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
|
|
@@ -633,8 +633,8 @@ process.env.NODE_ENV !== "production" ? DateRangeCalendar.propTypes = {
|
|
|
633
633
|
*/
|
|
634
634
|
readOnly: PropTypes.bool,
|
|
635
635
|
/**
|
|
636
|
-
*
|
|
637
|
-
* @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
636
|
+
* If `true`, disable heavy animations.
|
|
637
|
+
* @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
638
638
|
*/
|
|
639
639
|
reduceAnimations: PropTypes.bool,
|
|
640
640
|
/**
|
|
@@ -250,8 +250,8 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
|
|
|
250
250
|
rangePosition: PropTypes.oneOf(['end', 'start']),
|
|
251
251
|
readOnly: PropTypes.bool,
|
|
252
252
|
/**
|
|
253
|
-
*
|
|
254
|
-
* @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
253
|
+
* If `true`, disable heavy animations.
|
|
254
|
+
* @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
255
255
|
*/
|
|
256
256
|
reduceAnimations: PropTypes.bool,
|
|
257
257
|
/**
|
|
@@ -259,8 +259,8 @@ DesktopDateRangePicker.propTypes = {
|
|
|
259
259
|
rangePosition: PropTypes.oneOf(['end', 'start']),
|
|
260
260
|
readOnly: PropTypes.bool,
|
|
261
261
|
/**
|
|
262
|
-
*
|
|
263
|
-
* @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
262
|
+
* If `true`, disable heavy animations.
|
|
263
|
+
* @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
264
264
|
*/
|
|
265
265
|
reduceAnimations: PropTypes.bool,
|
|
266
266
|
/**
|
|
@@ -259,8 +259,8 @@ MobileDateRangePicker.propTypes = {
|
|
|
259
259
|
rangePosition: PropTypes.oneOf(['end', 'start']),
|
|
260
260
|
readOnly: PropTypes.bool,
|
|
261
261
|
/**
|
|
262
|
-
*
|
|
263
|
-
* @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
262
|
+
* If `true`, disable heavy animations.
|
|
263
|
+
* @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
264
264
|
*/
|
|
265
265
|
reduceAnimations: PropTypes.bool,
|
|
266
266
|
/**
|
|
@@ -209,8 +209,8 @@ StaticDateRangePicker.propTypes = {
|
|
|
209
209
|
rangePosition: PropTypes.oneOf(['end', 'start']),
|
|
210
210
|
readOnly: PropTypes.bool,
|
|
211
211
|
/**
|
|
212
|
-
*
|
|
213
|
-
* @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
212
|
+
* If `true`, disable heavy animations.
|
|
213
|
+
* @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
214
214
|
*/
|
|
215
215
|
reduceAnimations: PropTypes.bool,
|
|
216
216
|
/**
|
package/legacy/index.js
CHANGED
|
@@ -31,7 +31,8 @@ export var useDesktopRangePicker = function useDesktopRangePicker(_ref) {
|
|
|
31
31
|
disabled = props.disabled,
|
|
32
32
|
autoFocus = props.autoFocus,
|
|
33
33
|
disableOpenPicker = props.disableOpenPicker,
|
|
34
|
-
localeText = props.localeText
|
|
34
|
+
localeText = props.localeText,
|
|
35
|
+
reduceAnimations = props.reduceAnimations;
|
|
35
36
|
var fieldContainerRef = React.useRef(null);
|
|
36
37
|
var popperRef = React.useRef(null);
|
|
37
38
|
var _useRangePosition = useRangePosition(props),
|
|
@@ -119,6 +120,7 @@ export var useDesktopRangePicker = function useDesktopRangePicker(_ref) {
|
|
|
119
120
|
slots: slots,
|
|
120
121
|
slotProps: slotProps,
|
|
121
122
|
shouldRestoreFocus: shouldRestoreFocus,
|
|
123
|
+
reduceAnimations: reduceAnimations,
|
|
122
124
|
children: /*#__PURE__*/_jsx(Layout, _extends({}, layoutProps, slotProps == null ? void 0 : slotProps.layout, {
|
|
123
125
|
slots: slots,
|
|
124
126
|
slotProps: slotPropsForLayout,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export var getReleaseInfo = function getReleaseInfo() {
|
|
3
|
-
var releaseInfo = "
|
|
3
|
+
var releaseInfo = "MTY5MjI0NDgwMDAwMA==";
|
|
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
|
|
@@ -5,7 +5,7 @@ var _excluded = ["defaultCalendarMonth"],
|
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { expect } from 'chai';
|
|
7
7
|
import { screen } from '@mui/monorepo/test/utils';
|
|
8
|
-
import { adapterToUse } from 'test/utils/pickers
|
|
8
|
+
import { adapterToUse } from 'test/utils/pickers';
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
10
|
var isDisable = function isDisable(el) {
|
|
11
11
|
return el.getAttribute('disabled') !== null;
|
|
@@ -4,7 +4,7 @@ import * as React from 'react';
|
|
|
4
4
|
import { expect } from 'chai';
|
|
5
5
|
import { spy } from 'sinon';
|
|
6
6
|
import { screen } from '@mui/monorepo/test/utils';
|
|
7
|
-
import { adapterToUse } from 'test/utils/pickers
|
|
7
|
+
import { adapterToUse } from 'test/utils/pickers';
|
|
8
8
|
import { act } from '@mui/monorepo/test/utils/createRenderer';
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
10
|
var testInvalidStatus = function testInvalidStatus(expectedAnswer, isSingleInput) {
|
|
@@ -5,7 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import { expect } from 'chai';
|
|
6
6
|
import { spy } from 'sinon';
|
|
7
7
|
import { screen } from '@mui/monorepo/test/utils';
|
|
8
|
-
import { adapterToUse } from 'test/utils/pickers
|
|
8
|
+
import { adapterToUse } from 'test/utils/pickers';
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
10
|
var testInvalidStatus = function testInvalidStatus(expectedAnswer, isSingleInput) {
|
|
11
11
|
var answers = isSingleInput ? [expectedAnswer[0] || expectedAnswer[1]] : expectedAnswer;
|
|
@@ -606,8 +606,8 @@ process.env.NODE_ENV !== "production" ? DateRangeCalendar.propTypes = {
|
|
|
606
606
|
*/
|
|
607
607
|
readOnly: PropTypes.bool,
|
|
608
608
|
/**
|
|
609
|
-
*
|
|
610
|
-
* @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
609
|
+
* If `true`, disable heavy animations.
|
|
610
|
+
* @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
611
611
|
*/
|
|
612
612
|
reduceAnimations: PropTypes.bool,
|
|
613
613
|
/**
|
|
@@ -251,8 +251,8 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
|
|
|
251
251
|
rangePosition: PropTypes.oneOf(['end', 'start']),
|
|
252
252
|
readOnly: PropTypes.bool,
|
|
253
253
|
/**
|
|
254
|
-
*
|
|
255
|
-
* @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
254
|
+
* If `true`, disable heavy animations.
|
|
255
|
+
* @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
256
256
|
*/
|
|
257
257
|
reduceAnimations: PropTypes.bool,
|
|
258
258
|
/**
|
|
@@ -256,8 +256,8 @@ DesktopDateRangePicker.propTypes = {
|
|
|
256
256
|
rangePosition: PropTypes.oneOf(['end', 'start']),
|
|
257
257
|
readOnly: PropTypes.bool,
|
|
258
258
|
/**
|
|
259
|
-
*
|
|
260
|
-
* @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
259
|
+
* If `true`, disable heavy animations.
|
|
260
|
+
* @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
261
261
|
*/
|
|
262
262
|
reduceAnimations: PropTypes.bool,
|
|
263
263
|
/**
|
|
@@ -256,8 +256,8 @@ MobileDateRangePicker.propTypes = {
|
|
|
256
256
|
rangePosition: PropTypes.oneOf(['end', 'start']),
|
|
257
257
|
readOnly: PropTypes.bool,
|
|
258
258
|
/**
|
|
259
|
-
*
|
|
260
|
-
* @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
259
|
+
* If `true`, disable heavy animations.
|
|
260
|
+
* @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
261
261
|
*/
|
|
262
262
|
reduceAnimations: PropTypes.bool,
|
|
263
263
|
/**
|
|
@@ -209,8 +209,8 @@ StaticDateRangePicker.propTypes = {
|
|
|
209
209
|
rangePosition: PropTypes.oneOf(['end', 'start']),
|
|
210
210
|
readOnly: PropTypes.bool,
|
|
211
211
|
/**
|
|
212
|
-
*
|
|
213
|
-
* @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
212
|
+
* If `true`, disable heavy animations.
|
|
213
|
+
* @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
214
214
|
*/
|
|
215
215
|
reduceAnimations: PropTypes.bool,
|
|
216
216
|
/**
|
package/modern/index.js
CHANGED
|
@@ -33,7 +33,8 @@ export const useDesktopRangePicker = _ref => {
|
|
|
33
33
|
disabled,
|
|
34
34
|
autoFocus,
|
|
35
35
|
disableOpenPicker,
|
|
36
|
-
localeText
|
|
36
|
+
localeText,
|
|
37
|
+
reduceAnimations
|
|
37
38
|
} = props;
|
|
38
39
|
const fieldContainerRef = React.useRef(null);
|
|
39
40
|
const popperRef = React.useRef(null);
|
|
@@ -122,6 +123,7 @@ export const useDesktopRangePicker = _ref => {
|
|
|
122
123
|
slots: slots,
|
|
123
124
|
slotProps: slotProps,
|
|
124
125
|
shouldRestoreFocus: shouldRestoreFocus,
|
|
126
|
+
reduceAnimations: reduceAnimations,
|
|
125
127
|
children: /*#__PURE__*/_jsx(Layout, _extends({}, layoutProps, slotProps?.layout, {
|
|
126
128
|
slots: slots,
|
|
127
129
|
slotProps: slotPropsForLayout,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export const getReleaseInfo = () => {
|
|
3
|
-
const releaseInfo = "
|
|
3
|
+
const releaseInfo = "MTY5MjI0NDgwMDAwMA==";
|
|
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
|
|
@@ -5,7 +5,7 @@ const _excluded = ["defaultCalendarMonth"],
|
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { expect } from 'chai';
|
|
7
7
|
import { screen } from '@mui/monorepo/test/utils';
|
|
8
|
-
import { adapterToUse } from 'test/utils/pickers
|
|
8
|
+
import { adapterToUse } from 'test/utils/pickers';
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
10
|
const isDisable = el => el.getAttribute('disabled') !== null;
|
|
11
11
|
const testDisabledDate = (day, expectedAnswer, isDesktop) => {
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { expect } from 'chai';
|
|
3
3
|
import { spy } from 'sinon';
|
|
4
4
|
import { screen } from '@mui/monorepo/test/utils';
|
|
5
|
-
import { adapterToUse } from 'test/utils/pickers
|
|
5
|
+
import { adapterToUse } from 'test/utils/pickers';
|
|
6
6
|
import { act } from '@mui/monorepo/test/utils/createRenderer';
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
8
|
const testInvalidStatus = (expectedAnswer, isSingleInput) => {
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { expect } from 'chai';
|
|
4
4
|
import { spy } from 'sinon';
|
|
5
5
|
import { screen } from '@mui/monorepo/test/utils';
|
|
6
|
-
import { adapterToUse } from 'test/utils/pickers
|
|
6
|
+
import { adapterToUse } from 'test/utils/pickers';
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
8
|
const testInvalidStatus = (expectedAnswer, isSingleInput) => {
|
|
9
9
|
const answers = isSingleInput ? [expectedAnswer[0] || expectedAnswer[1]] : expectedAnswer;
|
|
@@ -615,8 +615,8 @@ process.env.NODE_ENV !== "production" ? DateRangeCalendar.propTypes = {
|
|
|
615
615
|
*/
|
|
616
616
|
readOnly: _propTypes.default.bool,
|
|
617
617
|
/**
|
|
618
|
-
*
|
|
619
|
-
* @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
618
|
+
* If `true`, disable heavy animations.
|
|
619
|
+
* @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
620
620
|
*/
|
|
621
621
|
reduceAnimations: _propTypes.default.bool,
|
|
622
622
|
/**
|
|
@@ -261,8 +261,8 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
|
|
|
261
261
|
rangePosition: _propTypes.default.oneOf(['end', 'start']),
|
|
262
262
|
readOnly: _propTypes.default.bool,
|
|
263
263
|
/**
|
|
264
|
-
*
|
|
265
|
-
* @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
264
|
+
* If `true`, disable heavy animations.
|
|
265
|
+
* @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
266
266
|
*/
|
|
267
267
|
reduceAnimations: _propTypes.default.bool,
|
|
268
268
|
/**
|
|
@@ -266,8 +266,8 @@ DesktopDateRangePicker.propTypes = {
|
|
|
266
266
|
rangePosition: _propTypes.default.oneOf(['end', 'start']),
|
|
267
267
|
readOnly: _propTypes.default.bool,
|
|
268
268
|
/**
|
|
269
|
-
*
|
|
270
|
-
* @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
269
|
+
* If `true`, disable heavy animations.
|
|
270
|
+
* @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
271
271
|
*/
|
|
272
272
|
reduceAnimations: _propTypes.default.bool,
|
|
273
273
|
/**
|
|
@@ -266,8 +266,8 @@ MobileDateRangePicker.propTypes = {
|
|
|
266
266
|
rangePosition: _propTypes.default.oneOf(['end', 'start']),
|
|
267
267
|
readOnly: _propTypes.default.bool,
|
|
268
268
|
/**
|
|
269
|
-
*
|
|
270
|
-
* @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
269
|
+
* If `true`, disable heavy animations.
|
|
270
|
+
* @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
271
271
|
*/
|
|
272
272
|
reduceAnimations: _propTypes.default.bool,
|
|
273
273
|
/**
|
|
@@ -219,8 +219,8 @@ StaticDateRangePicker.propTypes = {
|
|
|
219
219
|
rangePosition: _propTypes.default.oneOf(['end', 'start']),
|
|
220
220
|
readOnly: _propTypes.default.bool,
|
|
221
221
|
/**
|
|
222
|
-
*
|
|
223
|
-
* @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
222
|
+
* If `true`, disable heavy animations.
|
|
223
|
+
* @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
224
224
|
*/
|
|
225
225
|
reduceAnimations: _propTypes.default.bool,
|
|
226
226
|
/**
|
package/node/index.js
CHANGED
|
@@ -41,7 +41,8 @@ const useDesktopRangePicker = _ref => {
|
|
|
41
41
|
disabled,
|
|
42
42
|
autoFocus,
|
|
43
43
|
disableOpenPicker,
|
|
44
|
-
localeText
|
|
44
|
+
localeText,
|
|
45
|
+
reduceAnimations
|
|
45
46
|
} = props;
|
|
46
47
|
const fieldContainerRef = React.useRef(null);
|
|
47
48
|
const popperRef = React.useRef(null);
|
|
@@ -130,6 +131,7 @@ const useDesktopRangePicker = _ref => {
|
|
|
130
131
|
slots: slots,
|
|
131
132
|
slotProps: slotProps,
|
|
132
133
|
shouldRestoreFocus: shouldRestoreFocus,
|
|
134
|
+
reduceAnimations: reduceAnimations,
|
|
133
135
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Layout, (0, _extends2.default)({}, layoutProps, slotProps?.layout, {
|
|
134
136
|
slots: slots,
|
|
135
137
|
slotProps: slotPropsForLayout,
|
|
@@ -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 = "MTY5MjI0NDgwMDAwMA==";
|
|
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
|
|
@@ -10,7 +10,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _chai = require("chai");
|
|
12
12
|
var _utils = require("@mui/monorepo/test/utils");
|
|
13
|
-
var
|
|
13
|
+
var _pickers = require("test/utils/pickers");
|
|
14
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
15
|
const _excluded = ["defaultCalendarMonth"],
|
|
16
16
|
_excluded2 = ["defaultCalendarMonth"];
|
|
@@ -49,7 +49,7 @@ function testDayViewRangeValidation(ElementToTest, getOptions) {
|
|
|
49
49
|
}
|
|
50
50
|
const isDesktop = variant === 'desktop';
|
|
51
51
|
const defaultProps = {
|
|
52
|
-
defaultCalendarMonth:
|
|
52
|
+
defaultCalendarMonth: _pickers.adapterToUse.date(new Date(2018, 2, 12)),
|
|
53
53
|
open: true
|
|
54
54
|
};
|
|
55
55
|
it('should apply shouldDisableDate', function test() {
|
|
@@ -57,7 +57,7 @@ function testDayViewRangeValidation(ElementToTest, getOptions) {
|
|
|
57
57
|
render
|
|
58
58
|
} = getOptions();
|
|
59
59
|
render( /*#__PURE__*/(0, _jsxRuntime.jsx)(ElementToTest, (0, _extends2.default)({}, defaultProps, {
|
|
60
|
-
shouldDisableDate: date =>
|
|
60
|
+
shouldDisableDate: date => _pickers.adapterToUse.isAfter(date, _pickers.adapterToUse.date(new Date(2018, 2, 10)))
|
|
61
61
|
})));
|
|
62
62
|
testDisabledDate('10', [false, true], isDesktop);
|
|
63
63
|
testDisabledDate('11', [true, true], isDesktop);
|
|
@@ -69,7 +69,7 @@ function testDayViewRangeValidation(ElementToTest, getOptions) {
|
|
|
69
69
|
} = getOptions();
|
|
70
70
|
let now;
|
|
71
71
|
function WithFakeTimer(props) {
|
|
72
|
-
now =
|
|
72
|
+
now = _pickers.adapterToUse.date(new Date());
|
|
73
73
|
const otherProps = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
74
74
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ElementToTest, (0, _extends2.default)({
|
|
75
75
|
value: [now, null]
|
|
@@ -80,17 +80,17 @@ function testDayViewRangeValidation(ElementToTest, getOptions) {
|
|
|
80
80
|
} = render( /*#__PURE__*/(0, _jsxRuntime.jsx)(WithFakeTimer, (0, _extends2.default)({}, defaultProps, {
|
|
81
81
|
disablePast: true
|
|
82
82
|
})));
|
|
83
|
-
const tomorrow =
|
|
84
|
-
const yesterday =
|
|
85
|
-
testDisabledDate(
|
|
86
|
-
testDisabledDate(
|
|
87
|
-
if (!
|
|
83
|
+
const tomorrow = _pickers.adapterToUse.addDays(now, 1);
|
|
84
|
+
const yesterday = _pickers.adapterToUse.addDays(now, -1);
|
|
85
|
+
testDisabledDate(_pickers.adapterToUse.format(now, 'dayOfMonth'), [false, false], isDesktop);
|
|
86
|
+
testDisabledDate(_pickers.adapterToUse.format(tomorrow, 'dayOfMonth'), [false, false], isDesktop);
|
|
87
|
+
if (!_pickers.adapterToUse.isSameMonth(yesterday, tomorrow)) {
|
|
88
88
|
setProps({
|
|
89
89
|
value: [yesterday, null]
|
|
90
90
|
});
|
|
91
91
|
clock.runToLast();
|
|
92
92
|
}
|
|
93
|
-
testDisabledDate(
|
|
93
|
+
testDisabledDate(_pickers.adapterToUse.format(yesterday, 'dayOfMonth'), [true, false], isDesktop);
|
|
94
94
|
});
|
|
95
95
|
it('should apply disableFuture', function test() {
|
|
96
96
|
const {
|
|
@@ -99,7 +99,7 @@ function testDayViewRangeValidation(ElementToTest, getOptions) {
|
|
|
99
99
|
} = getOptions();
|
|
100
100
|
let now;
|
|
101
101
|
function WithFakeTimer(props) {
|
|
102
|
-
now =
|
|
102
|
+
now = _pickers.adapterToUse.date(new Date());
|
|
103
103
|
const otherProps = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded2);
|
|
104
104
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ElementToTest, (0, _extends2.default)({
|
|
105
105
|
value: [now, null]
|
|
@@ -110,25 +110,25 @@ function testDayViewRangeValidation(ElementToTest, getOptions) {
|
|
|
110
110
|
} = render( /*#__PURE__*/(0, _jsxRuntime.jsx)(WithFakeTimer, (0, _extends2.default)({}, defaultProps, {
|
|
111
111
|
disableFuture: true
|
|
112
112
|
})));
|
|
113
|
-
const tomorrow =
|
|
114
|
-
const yesterday =
|
|
115
|
-
testDisabledDate(
|
|
116
|
-
testDisabledDate(
|
|
117
|
-
if (!
|
|
113
|
+
const tomorrow = _pickers.adapterToUse.addDays(now, 1);
|
|
114
|
+
const yesterday = _pickers.adapterToUse.addDays(now, -1);
|
|
115
|
+
testDisabledDate(_pickers.adapterToUse.format(now, 'dayOfMonth'), [false, true], isDesktop);
|
|
116
|
+
testDisabledDate(_pickers.adapterToUse.format(tomorrow, 'dayOfMonth'), [true, true], isDesktop);
|
|
117
|
+
if (!_pickers.adapterToUse.isSameMonth(yesterday, tomorrow)) {
|
|
118
118
|
setProps({
|
|
119
119
|
value: [yesterday, null]
|
|
120
120
|
});
|
|
121
121
|
clock.runToLast();
|
|
122
122
|
}
|
|
123
|
-
testDisabledDate(
|
|
123
|
+
testDisabledDate(_pickers.adapterToUse.format(yesterday, 'dayOfMonth'), [false, true], isDesktop);
|
|
124
124
|
});
|
|
125
125
|
it('should apply minDate', function test() {
|
|
126
126
|
const {
|
|
127
127
|
render
|
|
128
128
|
} = getOptions();
|
|
129
129
|
render( /*#__PURE__*/(0, _jsxRuntime.jsx)(ElementToTest, (0, _extends2.default)({}, defaultProps, {
|
|
130
|
-
defaultCalendarMonth:
|
|
131
|
-
minDate:
|
|
130
|
+
defaultCalendarMonth: _pickers.adapterToUse.date(new Date(2019, 5, 15)),
|
|
131
|
+
minDate: _pickers.adapterToUse.date(new Date(2019, 5, 4))
|
|
132
132
|
})));
|
|
133
133
|
testDisabledDate('1', [true, false], isDesktop);
|
|
134
134
|
testDisabledDate('3', [true, false], isDesktop);
|
|
@@ -141,8 +141,8 @@ function testDayViewRangeValidation(ElementToTest, getOptions) {
|
|
|
141
141
|
render
|
|
142
142
|
} = getOptions();
|
|
143
143
|
render( /*#__PURE__*/(0, _jsxRuntime.jsx)(ElementToTest, (0, _extends2.default)({}, defaultProps, {
|
|
144
|
-
defaultCalendarMonth:
|
|
145
|
-
maxDate:
|
|
144
|
+
defaultCalendarMonth: _pickers.adapterToUse.date(new Date(2019, 5, 15)),
|
|
145
|
+
maxDate: _pickers.adapterToUse.date(new Date(2019, 5, 4))
|
|
146
146
|
})));
|
|
147
147
|
testDisabledDate('1', [false, true], isDesktop);
|
|
148
148
|
testDisabledDate('4', [false, true], isDesktop);
|
|
@@ -8,7 +8,7 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
8
8
|
var _chai = require("chai");
|
|
9
9
|
var _sinon = require("sinon");
|
|
10
10
|
var _utils = require("@mui/monorepo/test/utils");
|
|
11
|
-
var
|
|
11
|
+
var _pickers = require("test/utils/pickers");
|
|
12
12
|
var _createRenderer = require("@mui/monorepo/test/utils/createRenderer");
|
|
13
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
14
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -22,7 +22,7 @@ const testInvalidStatus = (expectedAnswer, isSingleInput) => {
|
|
|
22
22
|
});
|
|
23
23
|
};
|
|
24
24
|
const dateParser = value => {
|
|
25
|
-
return value.map(date => date === null ? date :
|
|
25
|
+
return value.map(date => date === null ? date : _pickers.adapterToUse.date(new Date(...date)));
|
|
26
26
|
};
|
|
27
27
|
const testTextFieldKeyboardRangeValidation = (ElementToTest, getOptions) => {
|
|
28
28
|
const {
|
|
@@ -63,7 +63,7 @@ const testTextFieldKeyboardRangeValidation = (ElementToTest, getOptions) => {
|
|
|
63
63
|
setProps
|
|
64
64
|
} = render( /*#__PURE__*/(0, _jsxRuntime.jsx)(ElementToTest, {
|
|
65
65
|
onError: onErrorMock,
|
|
66
|
-
shouldDisableDate: date =>
|
|
66
|
+
shouldDisableDate: date => _pickers.adapterToUse.isAfter(date, _pickers.adapterToUse.date(new Date(2018, 2, 11)))
|
|
67
67
|
}));
|
|
68
68
|
(0, _createRenderer.act)(() => {
|
|
69
69
|
dateParser([[2018, 2, 9], [2018, 2, 10]]).forEach((date, index) => {
|
|
@@ -75,7 +75,7 @@ const testTextFieldKeyboardRangeValidation = (ElementToTest, getOptions) => {
|
|
|
75
75
|
(0, _chai.expect)(onErrorMock.callCount).to.equal(0);
|
|
76
76
|
testInvalidStatus([false, false], isSingleInput);
|
|
77
77
|
(0, _createRenderer.act)(() => {
|
|
78
|
-
inputValue(
|
|
78
|
+
inputValue(_pickers.adapterToUse.date(new Date(2018, 2, 13)), {
|
|
79
79
|
setEndDate: true
|
|
80
80
|
});
|
|
81
81
|
});
|
|
@@ -83,13 +83,13 @@ const testTextFieldKeyboardRangeValidation = (ElementToTest, getOptions) => {
|
|
|
83
83
|
(0, _chai.expect)(onErrorMock.lastCall.args[0]).to.deep.equal([null, 'shouldDisableDate']);
|
|
84
84
|
testInvalidStatus([false, true], isSingleInput);
|
|
85
85
|
(0, _createRenderer.act)(() => {
|
|
86
|
-
inputValue(
|
|
86
|
+
inputValue(_pickers.adapterToUse.date(new Date(2018, 2, 12)));
|
|
87
87
|
});
|
|
88
88
|
(0, _chai.expect)(onErrorMock.callCount).to.equal(2);
|
|
89
89
|
(0, _chai.expect)(onErrorMock.lastCall.args[0]).to.deep.equal(['shouldDisableDate', 'shouldDisableDate']);
|
|
90
90
|
testInvalidStatus([true, true], isSingleInput);
|
|
91
91
|
setProps({
|
|
92
|
-
shouldDisableDate: date =>
|
|
92
|
+
shouldDisableDate: date => _pickers.adapterToUse.isBefore(date, _pickers.adapterToUse.date(new Date(2018, 2, 13)))
|
|
93
93
|
});
|
|
94
94
|
(0, _chai.expect)(onErrorMock.callCount).to.equal(3);
|
|
95
95
|
(0, _chai.expect)(onErrorMock.lastCall.args[0]).to.deep.equal(['shouldDisableDate', null]);
|
|
@@ -97,28 +97,28 @@ const testTextFieldKeyboardRangeValidation = (ElementToTest, getOptions) => {
|
|
|
97
97
|
});
|
|
98
98
|
it('should apply disablePast', function test() {
|
|
99
99
|
const onErrorMock = (0, _sinon.spy)();
|
|
100
|
-
const now =
|
|
100
|
+
const now = _pickers.adapterToUse.date(new Date());
|
|
101
101
|
render( /*#__PURE__*/(0, _jsxRuntime.jsx)(ElementToTest, {
|
|
102
102
|
disablePast: true,
|
|
103
103
|
onError: onErrorMock
|
|
104
104
|
}));
|
|
105
105
|
let past = null;
|
|
106
106
|
if (withDate) {
|
|
107
|
-
past =
|
|
108
|
-
} else if (
|
|
109
|
-
past =
|
|
107
|
+
past = _pickers.adapterToUse.addDays(now, -1);
|
|
108
|
+
} else if (_pickers.adapterToUse.isSameDay(_pickers.adapterToUse.addHours(now, -1), now)) {
|
|
109
|
+
past = _pickers.adapterToUse.addHours(now, -1);
|
|
110
110
|
}
|
|
111
111
|
if (past === null) {
|
|
112
112
|
return;
|
|
113
113
|
}
|
|
114
114
|
(0, _createRenderer.act)(() => {
|
|
115
|
-
inputValue(
|
|
115
|
+
inputValue(_pickers.adapterToUse.date(past));
|
|
116
116
|
});
|
|
117
117
|
(0, _chai.expect)(onErrorMock.callCount).to.equal(1);
|
|
118
118
|
(0, _chai.expect)(onErrorMock.lastCall.args[0]).to.deep.equal(['disablePast', null]);
|
|
119
119
|
testInvalidStatus([true, false], isSingleInput);
|
|
120
120
|
(0, _createRenderer.act)(() => {
|
|
121
|
-
inputValue(
|
|
121
|
+
inputValue(_pickers.adapterToUse.date(past), {
|
|
122
122
|
setEndDate: true
|
|
123
123
|
});
|
|
124
124
|
});
|
|
@@ -126,7 +126,7 @@ const testTextFieldKeyboardRangeValidation = (ElementToTest, getOptions) => {
|
|
|
126
126
|
(0, _chai.expect)(onErrorMock.lastCall.args[0]).to.deep.equal(['disablePast', 'disablePast']);
|
|
127
127
|
testInvalidStatus([true, true], isSingleInput);
|
|
128
128
|
(0, _createRenderer.act)(() => {
|
|
129
|
-
inputValue(
|
|
129
|
+
inputValue(_pickers.adapterToUse.date(now));
|
|
130
130
|
});
|
|
131
131
|
(0, _chai.expect)(onErrorMock.callCount).to.equal(3);
|
|
132
132
|
(0, _chai.expect)(onErrorMock.lastCall.args[0]).to.deep.equal([null, 'disablePast']);
|
|
@@ -134,22 +134,22 @@ const testTextFieldKeyboardRangeValidation = (ElementToTest, getOptions) => {
|
|
|
134
134
|
});
|
|
135
135
|
it('should apply disableFuture', function test() {
|
|
136
136
|
const onErrorMock = (0, _sinon.spy)();
|
|
137
|
-
const now =
|
|
137
|
+
const now = _pickers.adapterToUse.date(new Date());
|
|
138
138
|
render( /*#__PURE__*/(0, _jsxRuntime.jsx)(ElementToTest, {
|
|
139
139
|
disableFuture: true,
|
|
140
140
|
onError: onErrorMock
|
|
141
141
|
}));
|
|
142
142
|
let future = null;
|
|
143
143
|
if (withDate) {
|
|
144
|
-
future =
|
|
145
|
-
} else if (
|
|
146
|
-
future =
|
|
144
|
+
future = _pickers.adapterToUse.addDays(now, 1);
|
|
145
|
+
} else if (_pickers.adapterToUse.isSameDay(_pickers.adapterToUse.addHours(now, 1), now)) {
|
|
146
|
+
future = _pickers.adapterToUse.addHours(now, 1);
|
|
147
147
|
}
|
|
148
148
|
if (future === null) {
|
|
149
149
|
return;
|
|
150
150
|
}
|
|
151
151
|
(0, _createRenderer.act)(() => {
|
|
152
|
-
inputValue(
|
|
152
|
+
inputValue(_pickers.adapterToUse.date(future), {
|
|
153
153
|
setEndDate: true
|
|
154
154
|
});
|
|
155
155
|
});
|
|
@@ -157,13 +157,13 @@ const testTextFieldKeyboardRangeValidation = (ElementToTest, getOptions) => {
|
|
|
157
157
|
(0, _chai.expect)(onErrorMock.lastCall.args[0]).to.deep.equal([null, 'disableFuture']);
|
|
158
158
|
testInvalidStatus([false, true], isSingleInput);
|
|
159
159
|
(0, _createRenderer.act)(() => {
|
|
160
|
-
inputValue(
|
|
160
|
+
inputValue(_pickers.adapterToUse.date(future));
|
|
161
161
|
});
|
|
162
162
|
(0, _chai.expect)(onErrorMock.callCount).to.equal(2);
|
|
163
163
|
(0, _chai.expect)(onErrorMock.lastCall.args[0]).to.deep.equal(['disableFuture', 'disableFuture']);
|
|
164
164
|
testInvalidStatus([true, true], isSingleInput);
|
|
165
165
|
(0, _createRenderer.act)(() => {
|
|
166
|
-
inputValue(
|
|
166
|
+
inputValue(_pickers.adapterToUse.date(now));
|
|
167
167
|
});
|
|
168
168
|
(0, _chai.expect)(onErrorMock.callCount).to.equal(3);
|
|
169
169
|
(0, _chai.expect)(onErrorMock.lastCall.args[0]).to.deep.equal([null, 'disableFuture']);
|
|
@@ -176,7 +176,7 @@ const testTextFieldKeyboardRangeValidation = (ElementToTest, getOptions) => {
|
|
|
176
176
|
const onErrorMock = (0, _sinon.spy)();
|
|
177
177
|
render( /*#__PURE__*/(0, _jsxRuntime.jsx)(ElementToTest, {
|
|
178
178
|
onError: onErrorMock,
|
|
179
|
-
minDate:
|
|
179
|
+
minDate: _pickers.adapterToUse.date(new Date(2018, 2, 15))
|
|
180
180
|
}));
|
|
181
181
|
(0, _createRenderer.act)(() => {
|
|
182
182
|
dateParser([[2018, 2, 9], [2018, 2, 10]]).forEach((date, index) => {
|
|
@@ -189,13 +189,13 @@ const testTextFieldKeyboardRangeValidation = (ElementToTest, getOptions) => {
|
|
|
189
189
|
(0, _chai.expect)(onErrorMock.lastCall.args[0]).to.deep.equal(['minDate', 'minDate']);
|
|
190
190
|
testInvalidStatus([true, true], isSingleInput);
|
|
191
191
|
(0, _createRenderer.act)(() => {
|
|
192
|
-
inputValue(
|
|
192
|
+
inputValue(_pickers.adapterToUse.date(new Date(2018, 2, 15)));
|
|
193
193
|
});
|
|
194
194
|
(0, _chai.expect)(onErrorMock.callCount).to.equal(3);
|
|
195
195
|
(0, _chai.expect)(onErrorMock.lastCall.args[0]).to.deep.equal([null, 'minDate']);
|
|
196
196
|
testInvalidStatus([false, true], isSingleInput);
|
|
197
197
|
(0, _createRenderer.act)(() => {
|
|
198
|
-
inputValue(
|
|
198
|
+
inputValue(_pickers.adapterToUse.date(new Date(2018, 2, 16)), {
|
|
199
199
|
setEndDate: true
|
|
200
200
|
});
|
|
201
201
|
});
|
|
@@ -210,7 +210,7 @@ const testTextFieldKeyboardRangeValidation = (ElementToTest, getOptions) => {
|
|
|
210
210
|
const onErrorMock = (0, _sinon.spy)();
|
|
211
211
|
render( /*#__PURE__*/(0, _jsxRuntime.jsx)(ElementToTest, {
|
|
212
212
|
onError: onErrorMock,
|
|
213
|
-
maxDate:
|
|
213
|
+
maxDate: _pickers.adapterToUse.date(new Date(2018, 2, 15))
|
|
214
214
|
}));
|
|
215
215
|
(0, _createRenderer.act)(() => {
|
|
216
216
|
dateParser([[2018, 2, 15], [2018, 2, 17]]).forEach((date, index) => {
|
|
@@ -223,7 +223,7 @@ const testTextFieldKeyboardRangeValidation = (ElementToTest, getOptions) => {
|
|
|
223
223
|
(0, _chai.expect)(onErrorMock.lastCall.args[0]).to.deep.equal([null, 'maxDate']);
|
|
224
224
|
testInvalidStatus([false, true], isSingleInput);
|
|
225
225
|
(0, _createRenderer.act)(() => {
|
|
226
|
-
inputValue(
|
|
226
|
+
inputValue(_pickers.adapterToUse.date(new Date(2018, 2, 16)));
|
|
227
227
|
});
|
|
228
228
|
(0, _chai.expect)(onErrorMock.callCount).to.equal(2);
|
|
229
229
|
(0, _chai.expect)(onErrorMock.lastCall.args[0]).to.deep.equal(['maxDate', 'maxDate']);
|
|
@@ -236,7 +236,7 @@ const testTextFieldKeyboardRangeValidation = (ElementToTest, getOptions) => {
|
|
|
236
236
|
const onErrorMock = (0, _sinon.spy)();
|
|
237
237
|
render( /*#__PURE__*/(0, _jsxRuntime.jsx)(ElementToTest, {
|
|
238
238
|
onError: onErrorMock,
|
|
239
|
-
minTime:
|
|
239
|
+
minTime: _pickers.adapterToUse.date(new Date(2018, 2, 10, 12, 0, 0))
|
|
240
240
|
}));
|
|
241
241
|
(0, _createRenderer.act)(() => {
|
|
242
242
|
dateParser([[2018, 2, 10, 9, 0, 0], [2018, 2, 10, 10, 0, 0]]).forEach((date, index) => {
|
|
@@ -249,7 +249,7 @@ const testTextFieldKeyboardRangeValidation = (ElementToTest, getOptions) => {
|
|
|
249
249
|
(0, _chai.expect)(onErrorMock.lastCall.args[0]).to.deep.equal(['minTime', 'minTime']);
|
|
250
250
|
testInvalidStatus([true, true], isSingleInput);
|
|
251
251
|
(0, _createRenderer.act)(() => {
|
|
252
|
-
inputValue(
|
|
252
|
+
inputValue(_pickers.adapterToUse.date(new Date(2018, 2, 10, 12, 10, 0)), {
|
|
253
253
|
setEndDate: true
|
|
254
254
|
});
|
|
255
255
|
});
|
|
@@ -257,7 +257,7 @@ const testTextFieldKeyboardRangeValidation = (ElementToTest, getOptions) => {
|
|
|
257
257
|
(0, _chai.expect)(onErrorMock.lastCall.args[0]).to.deep.equal(['minTime', null]);
|
|
258
258
|
testInvalidStatus([true, false], isSingleInput);
|
|
259
259
|
(0, _createRenderer.act)(() => {
|
|
260
|
-
inputValue(
|
|
260
|
+
inputValue(_pickers.adapterToUse.date(new Date(2018, 2, 10, 12, 5, 0)));
|
|
261
261
|
});
|
|
262
262
|
(0, _chai.expect)(onErrorMock.callCount).to.equal(4);
|
|
263
263
|
(0, _chai.expect)(onErrorMock.lastCall.args[0]).to.deep.equal([null, null]);
|
|
@@ -270,7 +270,7 @@ const testTextFieldKeyboardRangeValidation = (ElementToTest, getOptions) => {
|
|
|
270
270
|
const onErrorMock = (0, _sinon.spy)();
|
|
271
271
|
render( /*#__PURE__*/(0, _jsxRuntime.jsx)(ElementToTest, {
|
|
272
272
|
onError: onErrorMock,
|
|
273
|
-
maxTime:
|
|
273
|
+
maxTime: _pickers.adapterToUse.date(new Date(2018, 2, 10, 12, 0))
|
|
274
274
|
}));
|
|
275
275
|
(0, _createRenderer.act)(() => {
|
|
276
276
|
dateParser([[2018, 2, 10, 9, 0, 0], [2018, 2, 10, 12, 15, 0]]).forEach((date, index) => {
|
|
@@ -283,7 +283,7 @@ const testTextFieldKeyboardRangeValidation = (ElementToTest, getOptions) => {
|
|
|
283
283
|
(0, _chai.expect)(onErrorMock.lastCall.args[0]).to.deep.equal([null, 'maxTime']);
|
|
284
284
|
testInvalidStatus([false, true], isSingleInput);
|
|
285
285
|
(0, _createRenderer.act)(() => {
|
|
286
|
-
inputValue(
|
|
286
|
+
inputValue(_pickers.adapterToUse.date(new Date(2018, 2, 10, 12, 5, 0)));
|
|
287
287
|
});
|
|
288
288
|
(0, _chai.expect)(onErrorMock.callCount).to.equal(2);
|
|
289
289
|
(0, _chai.expect)(onErrorMock.lastCall.args[0]).to.deep.equal(['maxTime', 'maxTime']);
|
|
@@ -10,7 +10,7 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
10
10
|
var _chai = require("chai");
|
|
11
11
|
var _sinon = require("sinon");
|
|
12
12
|
var _utils = require("@mui/monorepo/test/utils");
|
|
13
|
-
var
|
|
13
|
+
var _pickers = require("test/utils/pickers");
|
|
14
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
15
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -23,7 +23,7 @@ const testInvalidStatus = (expectedAnswer, isSingleInput) => {
|
|
|
23
23
|
});
|
|
24
24
|
};
|
|
25
25
|
const dateParser = value => {
|
|
26
|
-
return value.map(date => date === null ? date :
|
|
26
|
+
return value.map(date => date === null ? date : _pickers.adapterToUse.date(new Date(...date)));
|
|
27
27
|
};
|
|
28
28
|
const testTextFieldRangeValidation = (ElementToTest, getOptions) => {
|
|
29
29
|
const {
|
|
@@ -66,7 +66,7 @@ const testTextFieldRangeValidation = (ElementToTest, getOptions) => {
|
|
|
66
66
|
} = render( /*#__PURE__*/(0, _jsxRuntime.jsx)(ElementToTest, {
|
|
67
67
|
onError: onErrorMock,
|
|
68
68
|
value: dateParser([[2018, 2, 9], [2018, 2, 10]]),
|
|
69
|
-
shouldDisableDate: date =>
|
|
69
|
+
shouldDisableDate: date => _pickers.adapterToUse.isAfter(date, _pickers.adapterToUse.date(new Date(2018, 2, 10)))
|
|
70
70
|
}));
|
|
71
71
|
(0, _chai.expect)(onErrorMock.callCount).to.equal(0);
|
|
72
72
|
testInvalidStatus([false, false], isSingleInput);
|
|
@@ -84,7 +84,7 @@ const testTextFieldRangeValidation = (ElementToTest, getOptions) => {
|
|
|
84
84
|
testInvalidStatus([true, true], isSingleInput);
|
|
85
85
|
setProps({
|
|
86
86
|
value: dateParser([[2018, 2, 12], [2018, 2, 13]]),
|
|
87
|
-
shouldDisableDate: date =>
|
|
87
|
+
shouldDisableDate: date => _pickers.adapterToUse.isBefore(date, _pickers.adapterToUse.date(new Date(2018, 2, 13)))
|
|
88
88
|
});
|
|
89
89
|
(0, _chai.expect)(onErrorMock.callCount).to.equal(3);
|
|
90
90
|
(0, _chai.expect)(onErrorMock.lastCall.args[0]).to.deep.equal(['shouldDisableDate', null]);
|
|
@@ -100,7 +100,7 @@ const testTextFieldRangeValidation = (ElementToTest, getOptions) => {
|
|
|
100
100
|
} = render( /*#__PURE__*/(0, _jsxRuntime.jsx)(ElementToTest, {
|
|
101
101
|
onError: onErrorMock,
|
|
102
102
|
value: dateParser([[2018, 2, 9], [2018, 2, 10]]),
|
|
103
|
-
shouldDisableDate: (date, position) => position === 'end' ?
|
|
103
|
+
shouldDisableDate: (date, position) => position === 'end' ? _pickers.adapterToUse.isAfter(date, _pickers.adapterToUse.date(new Date(2018, 2, 10))) : false
|
|
104
104
|
}));
|
|
105
105
|
(0, _chai.expect)(onErrorMock.callCount).to.equal(0);
|
|
106
106
|
testInvalidStatus([false, false], isSingleInput);
|
|
@@ -118,7 +118,7 @@ const testTextFieldRangeValidation = (ElementToTest, getOptions) => {
|
|
|
118
118
|
testInvalidStatus([false, true], isSingleInput);
|
|
119
119
|
setProps({
|
|
120
120
|
value: dateParser([[2018, 2, 12], [2018, 2, 13]]),
|
|
121
|
-
shouldDisableDate: (date, position) => position === 'end' ?
|
|
121
|
+
shouldDisableDate: (date, position) => position === 'end' ? _pickers.adapterToUse.isBefore(date, _pickers.adapterToUse.date(new Date(2018, 2, 13))) : false
|
|
122
122
|
});
|
|
123
123
|
(0, _chai.expect)(onErrorMock.callCount).to.equal(2);
|
|
124
124
|
(0, _chai.expect)(onErrorMock.lastCall.args[0]).to.deep.equal([null, null]);
|
|
@@ -134,7 +134,7 @@ const testTextFieldRangeValidation = (ElementToTest, getOptions) => {
|
|
|
134
134
|
} = render( /*#__PURE__*/(0, _jsxRuntime.jsx)(ElementToTest, {
|
|
135
135
|
onError: onErrorMock,
|
|
136
136
|
value: dateParser([[2018, 2, 9], [2018, 2, 10]]),
|
|
137
|
-
shouldDisableDate: (date, position) => position === 'start' ?
|
|
137
|
+
shouldDisableDate: (date, position) => position === 'start' ? _pickers.adapterToUse.isAfter(date, _pickers.adapterToUse.date(new Date(2018, 2, 10))) : false
|
|
138
138
|
}));
|
|
139
139
|
(0, _chai.expect)(onErrorMock.callCount).to.equal(0);
|
|
140
140
|
testInvalidStatus([false, false], isSingleInput);
|
|
@@ -150,7 +150,7 @@ const testTextFieldRangeValidation = (ElementToTest, getOptions) => {
|
|
|
150
150
|
(0, _chai.expect)(onErrorMock.lastCall.args[0]).to.deep.equal(['shouldDisableDate', null]);
|
|
151
151
|
testInvalidStatus([true, false], isSingleInput);
|
|
152
152
|
setProps({
|
|
153
|
-
shouldDisableDate: (date, position) => position === 'start' ?
|
|
153
|
+
shouldDisableDate: (date, position) => position === 'start' ? _pickers.adapterToUse.isBefore(date, _pickers.adapterToUse.date(new Date(2018, 2, 13))) : false
|
|
154
154
|
});
|
|
155
155
|
(0, _chai.expect)(onErrorMock.callCount).to.equal(1);
|
|
156
156
|
testInvalidStatus([true, false], isSingleInput);
|
|
@@ -159,7 +159,7 @@ const testTextFieldRangeValidation = (ElementToTest, getOptions) => {
|
|
|
159
159
|
const onErrorMock = (0, _sinon.spy)();
|
|
160
160
|
let now;
|
|
161
161
|
function WithFakeTimer(props) {
|
|
162
|
-
now =
|
|
162
|
+
now = _pickers.adapterToUse.date(new Date());
|
|
163
163
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ElementToTest, (0, _extends2.default)({
|
|
164
164
|
value: [now, now]
|
|
165
165
|
}, props));
|
|
@@ -172,9 +172,9 @@ const testTextFieldRangeValidation = (ElementToTest, getOptions) => {
|
|
|
172
172
|
}));
|
|
173
173
|
let past = null;
|
|
174
174
|
if (withDate) {
|
|
175
|
-
past =
|
|
176
|
-
} else if (
|
|
177
|
-
past =
|
|
175
|
+
past = _pickers.adapterToUse.addDays(now, -1);
|
|
176
|
+
} else if (_pickers.adapterToUse.isSameDay(_pickers.adapterToUse.addHours(now, -1), now)) {
|
|
177
|
+
past = _pickers.adapterToUse.addHours(now, -1);
|
|
178
178
|
}
|
|
179
179
|
if (past === null) {
|
|
180
180
|
return;
|
|
@@ -196,7 +196,7 @@ const testTextFieldRangeValidation = (ElementToTest, getOptions) => {
|
|
|
196
196
|
const onErrorMock = (0, _sinon.spy)();
|
|
197
197
|
let now;
|
|
198
198
|
function WithFakeTimer(props) {
|
|
199
|
-
now =
|
|
199
|
+
now = _pickers.adapterToUse.date(new Date());
|
|
200
200
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ElementToTest, (0, _extends2.default)({
|
|
201
201
|
value: [now, now]
|
|
202
202
|
}, props));
|
|
@@ -209,9 +209,9 @@ const testTextFieldRangeValidation = (ElementToTest, getOptions) => {
|
|
|
209
209
|
}));
|
|
210
210
|
let future = null;
|
|
211
211
|
if (withDate) {
|
|
212
|
-
future =
|
|
213
|
-
} else if (
|
|
214
|
-
future =
|
|
212
|
+
future = _pickers.adapterToUse.addDays(now, 1);
|
|
213
|
+
} else if (_pickers.adapterToUse.isSameDay(_pickers.adapterToUse.addHours(now, 1), now)) {
|
|
214
|
+
future = _pickers.adapterToUse.addHours(now, 1);
|
|
215
215
|
}
|
|
216
216
|
if (future === null) {
|
|
217
217
|
return;
|
|
@@ -239,7 +239,7 @@ const testTextFieldRangeValidation = (ElementToTest, getOptions) => {
|
|
|
239
239
|
} = render( /*#__PURE__*/(0, _jsxRuntime.jsx)(ElementToTest, {
|
|
240
240
|
onError: onErrorMock,
|
|
241
241
|
value: dateParser([[2018, 2, 9], [2018, 2, 10]]),
|
|
242
|
-
minDate:
|
|
242
|
+
minDate: _pickers.adapterToUse.date(new Date(2018, 2, 15))
|
|
243
243
|
}));
|
|
244
244
|
(0, _chai.expect)(onErrorMock.callCount).to.equal(1);
|
|
245
245
|
(0, _chai.expect)(onErrorMock.lastCall.args[0]).to.deep.equal(['minDate', 'minDate']);
|
|
@@ -267,7 +267,7 @@ const testTextFieldRangeValidation = (ElementToTest, getOptions) => {
|
|
|
267
267
|
} = render( /*#__PURE__*/(0, _jsxRuntime.jsx)(ElementToTest, {
|
|
268
268
|
onError: onErrorMock,
|
|
269
269
|
value: dateParser([[2018, 2, 9], null]),
|
|
270
|
-
minDate:
|
|
270
|
+
minDate: _pickers.adapterToUse.date(new Date(2018, 2, 11))
|
|
271
271
|
}));
|
|
272
272
|
(0, _chai.expect)(onErrorMock.callCount).to.equal(1);
|
|
273
273
|
(0, _chai.expect)(onErrorMock.lastCall.args[0]).to.deep.equal(['minDate', null]);
|
|
@@ -289,7 +289,7 @@ const testTextFieldRangeValidation = (ElementToTest, getOptions) => {
|
|
|
289
289
|
} = render( /*#__PURE__*/(0, _jsxRuntime.jsx)(ElementToTest, {
|
|
290
290
|
onError: onErrorMock,
|
|
291
291
|
value: dateParser([null, [2018, 2, 9]]),
|
|
292
|
-
minDate:
|
|
292
|
+
minDate: _pickers.adapterToUse.date(new Date(2018, 2, 15))
|
|
293
293
|
}));
|
|
294
294
|
(0, _chai.expect)(onErrorMock.callCount).to.equal(1);
|
|
295
295
|
(0, _chai.expect)(onErrorMock.lastCall.args[0]).to.deep.equal([null, 'minDate']);
|
|
@@ -311,7 +311,7 @@ const testTextFieldRangeValidation = (ElementToTest, getOptions) => {
|
|
|
311
311
|
} = render( /*#__PURE__*/(0, _jsxRuntime.jsx)(ElementToTest, {
|
|
312
312
|
onError: onErrorMock,
|
|
313
313
|
value: dateParser([[2018, 2, 9], [2018, 2, 10]]),
|
|
314
|
-
maxDate:
|
|
314
|
+
maxDate: _pickers.adapterToUse.date(new Date(2018, 2, 15))
|
|
315
315
|
}));
|
|
316
316
|
(0, _chai.expect)(onErrorMock.callCount).to.equal(0);
|
|
317
317
|
testInvalidStatus([false, false], isSingleInput);
|
|
@@ -338,7 +338,7 @@ const testTextFieldRangeValidation = (ElementToTest, getOptions) => {
|
|
|
338
338
|
} = render( /*#__PURE__*/(0, _jsxRuntime.jsx)(ElementToTest, {
|
|
339
339
|
onError: onErrorMock,
|
|
340
340
|
value: dateParser([[2018, 2, 10, 9, 0, 0], [2018, 2, 10, 10, 0, 0]]),
|
|
341
|
-
minTime:
|
|
341
|
+
minTime: _pickers.adapterToUse.date(new Date(2018, 2, 10, 12, 0))
|
|
342
342
|
}));
|
|
343
343
|
(0, _chai.expect)(onErrorMock.callCount).to.equal(1);
|
|
344
344
|
(0, _chai.expect)(onErrorMock.lastCall.args[0]).to.deep.equal(['minTime', 'minTime']);
|
|
@@ -366,7 +366,7 @@ const testTextFieldRangeValidation = (ElementToTest, getOptions) => {
|
|
|
366
366
|
} = render( /*#__PURE__*/(0, _jsxRuntime.jsx)(ElementToTest, {
|
|
367
367
|
onError: onErrorMock,
|
|
368
368
|
value: dateParser([[2018, 2, 5, 9, 0, 0], [2018, 2, 15, 10, 0, 0]]),
|
|
369
|
-
minTime:
|
|
369
|
+
minTime: _pickers.adapterToUse.date(new Date(2018, 2, 10, 12, 0))
|
|
370
370
|
}));
|
|
371
371
|
(0, _chai.expect)(onErrorMock.callCount).to.equal(1);
|
|
372
372
|
(0, _chai.expect)(onErrorMock.lastCall.args[0]).to.deep.equal(['minTime', 'minTime']);
|
|
@@ -388,7 +388,7 @@ const testTextFieldRangeValidation = (ElementToTest, getOptions) => {
|
|
|
388
388
|
} = render( /*#__PURE__*/(0, _jsxRuntime.jsx)(ElementToTest, {
|
|
389
389
|
onError: onErrorMock,
|
|
390
390
|
value: dateParser([[2018, 1, 1, 15], null]),
|
|
391
|
-
minTime:
|
|
391
|
+
minTime: _pickers.adapterToUse.date(new Date(2018, 1, 1, 12))
|
|
392
392
|
}));
|
|
393
393
|
(0, _chai.expect)(onErrorMock.callCount).to.equal(0);
|
|
394
394
|
testInvalidStatus([false, false], isSingleInput);
|
|
@@ -409,7 +409,7 @@ const testTextFieldRangeValidation = (ElementToTest, getOptions) => {
|
|
|
409
409
|
} = render( /*#__PURE__*/(0, _jsxRuntime.jsx)(ElementToTest, {
|
|
410
410
|
onError: onErrorMock,
|
|
411
411
|
value: dateParser([null, [2018, 1, 1, 15]]),
|
|
412
|
-
minTime:
|
|
412
|
+
minTime: _pickers.adapterToUse.date(new Date(2018, 1, 1, 12))
|
|
413
413
|
}));
|
|
414
414
|
(0, _chai.expect)(onErrorMock.callCount).to.equal(0);
|
|
415
415
|
testInvalidStatus([false, false], isSingleInput);
|
|
@@ -430,7 +430,7 @@ const testTextFieldRangeValidation = (ElementToTest, getOptions) => {
|
|
|
430
430
|
} = render( /*#__PURE__*/(0, _jsxRuntime.jsx)(ElementToTest, {
|
|
431
431
|
onError: onErrorMock,
|
|
432
432
|
value: dateParser([[2018, 2, 10, 9, 0, 0], [2018, 2, 10, 10, 0, 0]]),
|
|
433
|
-
maxTime:
|
|
433
|
+
maxTime: _pickers.adapterToUse.date(new Date(2018, 2, 10, 12, 0))
|
|
434
434
|
}));
|
|
435
435
|
(0, _chai.expect)(onErrorMock.callCount).to.equal(0);
|
|
436
436
|
testInvalidStatus([false, false], isSingleInput);
|
|
@@ -457,7 +457,7 @@ const testTextFieldRangeValidation = (ElementToTest, getOptions) => {
|
|
|
457
457
|
} = render( /*#__PURE__*/(0, _jsxRuntime.jsx)(ElementToTest, {
|
|
458
458
|
onError: onErrorMock,
|
|
459
459
|
value: dateParser([[2018, 2, 5, 9, 0, 0], [2018, 2, 15, 10, 0, 0]]),
|
|
460
|
-
maxTime:
|
|
460
|
+
maxTime: _pickers.adapterToUse.date(new Date(2018, 2, 10, 12, 0))
|
|
461
461
|
}));
|
|
462
462
|
(0, _chai.expect)(onErrorMock.callCount).to.equal(0);
|
|
463
463
|
testInvalidStatus([false, false], isSingleInput);
|
|
@@ -479,18 +479,18 @@ const testTextFieldRangeValidation = (ElementToTest, getOptions) => {
|
|
|
479
479
|
} = render( /*#__PURE__*/(0, _jsxRuntime.jsx)(ElementToTest, {
|
|
480
480
|
onError: onErrorMock,
|
|
481
481
|
value: dateParser([[2018, 2, 1, 9, 0, 0], [2018, 2, 2, 12, 0, 0]]),
|
|
482
|
-
maxDateTime:
|
|
482
|
+
maxDateTime: _pickers.adapterToUse.date(new Date(2018, 2, 2, 13, 0))
|
|
483
483
|
}));
|
|
484
484
|
(0, _chai.expect)(onErrorMock.callCount).to.equal(0);
|
|
485
485
|
testInvalidStatus([false, false], isSingleInput);
|
|
486
486
|
setProps({
|
|
487
|
-
maxDateTime:
|
|
487
|
+
maxDateTime: _pickers.adapterToUse.date(new Date(2018, 2, 2, 8, 0))
|
|
488
488
|
});
|
|
489
489
|
(0, _chai.expect)(onErrorMock.callCount).to.equal(1);
|
|
490
490
|
(0, _chai.expect)(onErrorMock.lastCall.args[0]).to.deep.equal([null, 'maxTime']);
|
|
491
491
|
testInvalidStatus([false, true], isSingleInput);
|
|
492
492
|
setProps({
|
|
493
|
-
maxDateTime:
|
|
493
|
+
maxDateTime: _pickers.adapterToUse.date(new Date(2018, 2, 1, 5, 0))
|
|
494
494
|
});
|
|
495
495
|
(0, _chai.expect)(onErrorMock.callCount).to.equal(2);
|
|
496
496
|
(0, _chai.expect)(onErrorMock.lastCall.args[0]).to.deep.equal(['maxTime', 'maxDate']);
|
|
@@ -507,19 +507,19 @@ const testTextFieldRangeValidation = (ElementToTest, getOptions) => {
|
|
|
507
507
|
} = render( /*#__PURE__*/(0, _jsxRuntime.jsx)(ElementToTest, {
|
|
508
508
|
onError: onErrorMock,
|
|
509
509
|
value: dateParser([[2018, 2, 1, 9, 0, 0], [2018, 2, 2, 12, 0, 0]]),
|
|
510
|
-
minDateTime:
|
|
510
|
+
minDateTime: _pickers.adapterToUse.date(new Date(2018, 2, 2, 13, 0))
|
|
511
511
|
}));
|
|
512
512
|
(0, _chai.expect)(onErrorMock.callCount).to.equal(1);
|
|
513
513
|
(0, _chai.expect)(onErrorMock.lastCall.args[0]).to.deep.equal(['minDate', 'minTime']);
|
|
514
514
|
testInvalidStatus([true, true], isSingleInput);
|
|
515
515
|
setProps({
|
|
516
|
-
minDateTime:
|
|
516
|
+
minDateTime: _pickers.adapterToUse.date(new Date(2018, 2, 2, 8, 0))
|
|
517
517
|
});
|
|
518
518
|
(0, _chai.expect)(onErrorMock.callCount).to.equal(2);
|
|
519
519
|
(0, _chai.expect)(onErrorMock.lastCall.args[0]).to.deep.equal(['minDate', null]);
|
|
520
520
|
testInvalidStatus([true, false], isSingleInput);
|
|
521
521
|
setProps({
|
|
522
|
-
minDateTime:
|
|
522
|
+
minDateTime: _pickers.adapterToUse.date(new Date(2018, 2, 1, 5, 0))
|
|
523
523
|
});
|
|
524
524
|
(0, _chai.expect)(onErrorMock.callCount).to.equal(3);
|
|
525
525
|
(0, _chai.expect)(onErrorMock.lastCall.args[0]).to.deep.equal([null, null]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-date-pickers-pro",
|
|
3
|
-
"version": "6.11.
|
|
3
|
+
"version": "6.11.2",
|
|
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,8 +31,8 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/runtime": "^7.22.6",
|
|
34
|
-
"@mui/utils": "^5.14.
|
|
35
|
-
"@mui/x-date-pickers": "6.11.
|
|
34
|
+
"@mui/utils": "^5.14.5",
|
|
35
|
+
"@mui/x-date-pickers": "6.11.2",
|
|
36
36
|
"@mui/x-license-pro": "6.10.2",
|
|
37
37
|
"clsx": "^2.0.0",
|
|
38
38
|
"prop-types": "^15.8.1",
|
|
@@ -5,7 +5,7 @@ const _excluded = ["defaultCalendarMonth"],
|
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { expect } from 'chai';
|
|
7
7
|
import { screen } from '@mui/monorepo/test/utils';
|
|
8
|
-
import { adapterToUse } from 'test/utils/pickers
|
|
8
|
+
import { adapterToUse } from 'test/utils/pickers';
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
10
|
const isDisable = el => el.getAttribute('disabled') !== null;
|
|
11
11
|
const testDisabledDate = (day, expectedAnswer, isDesktop) => {
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { expect } from 'chai';
|
|
3
3
|
import { spy } from 'sinon';
|
|
4
4
|
import { screen } from '@mui/monorepo/test/utils';
|
|
5
|
-
import { adapterToUse } from 'test/utils/pickers
|
|
5
|
+
import { adapterToUse } from 'test/utils/pickers';
|
|
6
6
|
import { act } from '@mui/monorepo/test/utils/createRenderer';
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
8
|
const testInvalidStatus = (expectedAnswer, isSingleInput) => {
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { expect } from 'chai';
|
|
4
4
|
import { spy } from 'sinon';
|
|
5
5
|
import { screen } from '@mui/monorepo/test/utils';
|
|
6
|
-
import { adapterToUse } from 'test/utils/pickers
|
|
6
|
+
import { adapterToUse } from 'test/utils/pickers';
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
8
|
const testInvalidStatus = (expectedAnswer, isSingleInput) => {
|
|
9
9
|
const answers = isSingleInput ? [expectedAnswer[0] || expectedAnswer[1]] : expectedAnswer;
|