@mui/x-date-pickers-pro 6.0.0-alpha.6 → 6.0.0-alpha.7
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 +42 -0
- package/DateRangeCalendar/DateRangeCalendar.js +6 -6
- package/DateRangePicker/DateRangePicker.js +8 -10
- package/DateRangePicker/shared.d.ts +1 -2
- package/DateRangePicker/shared.js +1 -9
- package/DesktopDateRangePicker/DesktopDateRangePicker.js +11 -12
- package/MobileDateRangePicker/MobileDateRangePicker.js +11 -12
- package/MultiInputDateRangeField/MultiInputDateRangeField.js +24 -5
- package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +30 -12
- package/MultiInputTimeRangeField/MultiInputTimeRangeField.js +28 -10
- package/SingleInputDateRangeField/SingleInputDateRangeField.js +24 -5
- package/SingleInputDateRangeField/useSingleInputDateRangeField.js +3 -4
- package/StaticDateRangePicker/StaticDateRangePicker.js +11 -12
- package/index.js +1 -1
- package/internal/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +3 -3
- package/internal/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +3 -3
- package/internal/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +3 -3
- package/internal/utils/date-utils.d.ts +0 -1
- package/internal/utils/date-utils.js +0 -2
- package/internal/utils/releaseInfo.js +1 -1
- package/internal/utils/valueManagers.d.ts +11 -0
- package/internal/{hooks/valueManager/common.js → utils/valueManagers.js} +9 -1
- package/legacy/DateRangeCalendar/DateRangeCalendar.js +6 -6
- package/legacy/DateRangePicker/DateRangePicker.js +8 -10
- package/legacy/DateRangePicker/shared.js +1 -13
- package/legacy/DesktopDateRangePicker/DesktopDateRangePicker.js +11 -12
- package/legacy/MobileDateRangePicker/MobileDateRangePicker.js +11 -12
- package/legacy/MultiInputDateRangeField/MultiInputDateRangeField.js +24 -5
- package/legacy/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +30 -12
- package/legacy/MultiInputTimeRangeField/MultiInputTimeRangeField.js +28 -10
- package/legacy/SingleInputDateRangeField/SingleInputDateRangeField.js +24 -5
- package/legacy/SingleInputDateRangeField/useSingleInputDateRangeField.js +3 -4
- package/legacy/StaticDateRangePicker/StaticDateRangePicker.js +11 -12
- package/legacy/index.js +1 -1
- package/legacy/internal/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +3 -3
- package/legacy/internal/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +3 -3
- package/legacy/internal/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +3 -3
- package/legacy/internal/utils/date-utils.js +0 -7
- package/legacy/internal/utils/releaseInfo.js +1 -1
- package/legacy/internal/{hooks/valueManager/common.js → utils/valueManagers.js} +19 -1
- package/modern/DateRangeCalendar/DateRangeCalendar.js +6 -6
- package/modern/DateRangePicker/DateRangePicker.js +8 -10
- package/modern/DateRangePicker/shared.js +1 -9
- package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +11 -12
- package/modern/MobileDateRangePicker/MobileDateRangePicker.js +11 -12
- package/modern/MultiInputDateRangeField/MultiInputDateRangeField.js +24 -5
- package/modern/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +30 -12
- package/modern/MultiInputTimeRangeField/MultiInputTimeRangeField.js +28 -10
- package/modern/SingleInputDateRangeField/SingleInputDateRangeField.js +24 -5
- package/modern/SingleInputDateRangeField/useSingleInputDateRangeField.js +3 -4
- package/modern/StaticDateRangePicker/StaticDateRangePicker.js +11 -12
- package/modern/index.js +1 -1
- package/modern/internal/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +3 -3
- package/modern/internal/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +3 -3
- package/modern/internal/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +3 -3
- package/modern/internal/utils/date-utils.js +0 -2
- package/modern/internal/utils/releaseInfo.js +1 -1
- package/modern/internal/{hooks/valueManager/common.js → utils/valueManagers.js} +9 -1
- package/node/DateRangeCalendar/DateRangeCalendar.js +6 -6
- package/node/DateRangePicker/DateRangePicker.js +8 -10
- package/node/DateRangePicker/shared.js +1 -13
- package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +11 -11
- package/node/MobileDateRangePicker/MobileDateRangePicker.js +11 -11
- package/node/MultiInputDateRangeField/MultiInputDateRangeField.js +24 -5
- package/node/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +30 -12
- package/node/MultiInputTimeRangeField/MultiInputTimeRangeField.js +28 -10
- package/node/SingleInputDateRangeField/SingleInputDateRangeField.js +24 -5
- package/node/SingleInputDateRangeField/useSingleInputDateRangeField.js +3 -5
- package/node/StaticDateRangePicker/StaticDateRangePicker.js +11 -11
- package/node/index.js +1 -1
- package/node/internal/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +3 -3
- package/node/internal/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +3 -3
- package/node/internal/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +3 -3
- package/node/internal/utils/date-utils.js +1 -7
- package/node/internal/utils/releaseInfo.js +1 -1
- package/node/internal/{hooks/valueManager/common.js → utils/valueManagers.js} +12 -2
- package/package.json +4 -4
- package/internal/hooks/valueManager/common.d.ts +0 -3
- package/internal/hooks/valueManager/dateRangeValueManager.d.ts +0 -4
- package/internal/hooks/valueManager/dateRangeValueManager.js +0 -6
- package/internal/hooks/valueManager/dateTimeRangeValueManager.d.ts +0 -4
- package/internal/hooks/valueManager/dateTimeRangeValueManager.js +0 -6
- package/internal/hooks/valueManager/timeRangeValueManager.d.ts +0 -4
- package/internal/hooks/valueManager/timeRangeValueManager.js +0 -6
- package/legacy/internal/hooks/valueManager/dateRangeValueManager.js +0 -6
- package/legacy/internal/hooks/valueManager/dateTimeRangeValueManager.js +0 -6
- package/legacy/internal/hooks/valueManager/timeRangeValueManager.js +0 -6
- package/modern/internal/hooks/valueManager/dateRangeValueManager.js +0 -6
- package/modern/internal/hooks/valueManager/dateTimeRangeValueManager.js +0 -6
- package/modern/internal/hooks/valueManager/timeRangeValueManager.js +0 -6
- package/node/internal/hooks/valueManager/dateRangeValueManager.js +0 -19
- package/node/internal/hooks/valueManager/dateTimeRangeValueManager.js +0 -19
- package/node/internal/hooks/valueManager/timeRangeValueManager.js +0 -19
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,48 @@
|
|
|
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.0.0-alpha.7
|
|
7
|
+
|
|
8
|
+
_Nov 10, 2022_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 5 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- ⚙️ Removed everything marked as `@deprecated`
|
|
13
|
+
- 📚 Documentation improvements
|
|
14
|
+
- 🐞 Bugfixes
|
|
15
|
+
|
|
16
|
+
### `@mui/x-data-grid@v6.0.0-alpha.7` / `@mui/x-data-grid-pro@v6.0.0-alpha.7` / `@mui/x-data-grid-premium@v6.0.0-alpha.7`
|
|
17
|
+
|
|
18
|
+
#### Changes
|
|
19
|
+
|
|
20
|
+
- [DataGrid] Fix cell focus causing scroll jump when virtualization enabled (#6785) @yaredtsy
|
|
21
|
+
- [DataGrid] Remove items marked as `@deprecated` (#6505) @DanailH
|
|
22
|
+
|
|
23
|
+
### `@mui/x-date-pickers@v6.0.0-alpha.7` / `@mui/x-date-pickers-pro@v6.0.0-alpha.7`
|
|
24
|
+
|
|
25
|
+
#### Changes
|
|
26
|
+
|
|
27
|
+
- [fields] Rename section names to match the picker view nomenclature (#6779) @flaviendelangle
|
|
28
|
+
- [pickers] Fix pickers toolbar styling (#6793) @LukasTy
|
|
29
|
+
- [pickers] Improve validation JSDoc descriptions (#6777) @flaviendelangle
|
|
30
|
+
- [pickers] New `MobileDateTimePicker`, `DesktopDateTimePicker`, `DateTimePicker` and `StaticDateTimePicker` based on `DateTimeField` (#6767) @flaviendelangle
|
|
31
|
+
- [pickers] New `MobileTimePicker`, `DesktopTimePicker`, `TimePicker` and `StaticTimePicker` based on `TimeField` (#6728) @flaviendelangle
|
|
32
|
+
- [pickers] Support the `onError` prop and add context on the `onChange` prop (#6731) @flaviendelangle
|
|
33
|
+
|
|
34
|
+
### Docs
|
|
35
|
+
|
|
36
|
+
- [docs] Add missing Pro header suffix (#6775) @oliviertassinari
|
|
37
|
+
- [docs] Upgrade to Next.js 13 (#6790) @cherniavskii
|
|
38
|
+
|
|
39
|
+
### Core
|
|
40
|
+
|
|
41
|
+
- [core] Add OSSF Scorecard action (#6760) @oliviertassinari
|
|
42
|
+
- [core] Fix Pinned-Dependencies @oliviertassinari
|
|
43
|
+
- [core] Fix Scorecard fail Action @oliviertassinari
|
|
44
|
+
- [core] Pin GitHub Action dependencies (#6739) @renovate[bot]
|
|
45
|
+
- [core] Remove default access to GitHub action scopes @oliviertassinari
|
|
46
|
+
- [test] Fix test case name: Pro-> Premium @oliviertassinari
|
|
47
|
+
|
|
6
48
|
## 6.0.0-alpha.6
|
|
7
49
|
|
|
8
50
|
_Nov 4, 2022_
|
|
@@ -16,7 +16,7 @@ import { getDateRangeCalendarUtilityClass } from './dateRangeCalendarClasses';
|
|
|
16
16
|
import { isEndOfRange, isRangeValid, isStartOfRange, isWithinRange } from '../internal/utils/date-utils';
|
|
17
17
|
import { calculateRangeChange, calculateRangePreview } from '../DateRangePicker/date-range-manager';
|
|
18
18
|
import { DateRangePickerDay } from '../DateRangePickerDay';
|
|
19
|
-
import {
|
|
19
|
+
import { rangeValueManager } from '../internal/utils/valueManagers';
|
|
20
20
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
21
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
22
|
const releaseInfo = getReleaseInfo();
|
|
@@ -127,7 +127,7 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
|
|
|
127
127
|
|
|
128
128
|
const [value, setValue] = useControlled({
|
|
129
129
|
controlled: valueProp,
|
|
130
|
-
default: defaultValue != null ? defaultValue :
|
|
130
|
+
default: defaultValue != null ? defaultValue : rangeValueManager.emptyValue,
|
|
131
131
|
name: 'DateRangeCalendar',
|
|
132
132
|
state: 'value'
|
|
133
133
|
});
|
|
@@ -401,7 +401,7 @@ process.env.NODE_ENV !== "production" ? DateRangeCalendar.propTypes = {
|
|
|
401
401
|
disabled: PropTypes.bool,
|
|
402
402
|
|
|
403
403
|
/**
|
|
404
|
-
* If `true` disable values before the current time
|
|
404
|
+
* If `true` disable values before the current date for date components, time for time components and both for date time components.
|
|
405
405
|
* @default false
|
|
406
406
|
*/
|
|
407
407
|
disableFuture: PropTypes.bool,
|
|
@@ -413,7 +413,7 @@ process.env.NODE_ENV !== "production" ? DateRangeCalendar.propTypes = {
|
|
|
413
413
|
disableHighlightToday: PropTypes.bool,
|
|
414
414
|
|
|
415
415
|
/**
|
|
416
|
-
* If `true` disable values after the current time.
|
|
416
|
+
* If `true` disable values after the current date for date components, time for time components and both for date time components.
|
|
417
417
|
* @default false
|
|
418
418
|
*/
|
|
419
419
|
disablePast: PropTypes.bool,
|
|
@@ -433,12 +433,12 @@ process.env.NODE_ENV !== "production" ? DateRangeCalendar.propTypes = {
|
|
|
433
433
|
loading: PropTypes.bool,
|
|
434
434
|
|
|
435
435
|
/**
|
|
436
|
-
* Maximal selectable date.
|
|
436
|
+
* Maximal selectable date.
|
|
437
437
|
*/
|
|
438
438
|
maxDate: PropTypes.any,
|
|
439
439
|
|
|
440
440
|
/**
|
|
441
|
-
* Minimal selectable date.
|
|
441
|
+
* Minimal selectable date.
|
|
442
442
|
*/
|
|
443
443
|
minDate: PropTypes.any,
|
|
444
444
|
|
|
@@ -125,7 +125,7 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
|
|
|
125
125
|
disabled: PropTypes.bool,
|
|
126
126
|
|
|
127
127
|
/**
|
|
128
|
-
* If `true` disable values before the current time
|
|
128
|
+
* If `true` disable values before the current date for date components, time for time components and both for date time components.
|
|
129
129
|
* @default false
|
|
130
130
|
*/
|
|
131
131
|
disableFuture: PropTypes.bool,
|
|
@@ -149,7 +149,7 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
|
|
|
149
149
|
disableOpenPicker: PropTypes.bool,
|
|
150
150
|
|
|
151
151
|
/**
|
|
152
|
-
* If `true` disable values after the current time.
|
|
152
|
+
* If `true` disable values after the current date for date components, time for time components and both for date time components.
|
|
153
153
|
* @default false
|
|
154
154
|
*/
|
|
155
155
|
disablePast: PropTypes.bool,
|
|
@@ -210,12 +210,12 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
|
|
|
210
210
|
mask: PropTypes.string,
|
|
211
211
|
|
|
212
212
|
/**
|
|
213
|
-
* Maximal selectable date.
|
|
213
|
+
* Maximal selectable date.
|
|
214
214
|
*/
|
|
215
215
|
maxDate: PropTypes.any,
|
|
216
216
|
|
|
217
217
|
/**
|
|
218
|
-
* Minimal selectable date.
|
|
218
|
+
* Minimal selectable date.
|
|
219
219
|
*/
|
|
220
220
|
minDate: PropTypes.any,
|
|
221
221
|
|
|
@@ -343,20 +343,18 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
|
|
|
343
343
|
shouldDisableDate: PropTypes.func,
|
|
344
344
|
|
|
345
345
|
/**
|
|
346
|
-
* Disable specific
|
|
347
|
-
* Works like `shouldDisableDate` but for month selection view @DateIOType.
|
|
346
|
+
* Disable specific month.
|
|
348
347
|
* @template TDate
|
|
349
|
-
* @param {TDate} month The month to
|
|
348
|
+
* @param {TDate} month The month to test.
|
|
350
349
|
* @returns {boolean} If `true` the month will be disabled.
|
|
351
350
|
*/
|
|
352
351
|
shouldDisableMonth: PropTypes.func,
|
|
353
352
|
|
|
354
353
|
/**
|
|
355
|
-
* Disable specific
|
|
356
|
-
* Works like `shouldDisableDate` but for year selection view @DateIOType.
|
|
354
|
+
* Disable specific year.
|
|
357
355
|
* @template TDate
|
|
358
356
|
* @param {TDate} year The year to test.
|
|
359
|
-
* @returns {boolean}
|
|
357
|
+
* @returns {boolean} If `true` the year will be disabled.
|
|
360
358
|
*/
|
|
361
359
|
shouldDisableYear: PropTypes.func,
|
|
362
360
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { LocalizedComponent } from '@mui/x-date-pickers';
|
|
3
|
-
import { BasePickerProps,
|
|
3
|
+
import { BasePickerProps, ValidationCommonProps, DefaultizedProps, BaseDateValidationProps } from '@mui/x-date-pickers/internals';
|
|
4
4
|
import { DateRangePickerViewSlotsComponent, DateRangePickerViewSlotsComponentsProps, ExportedDateRangePickerViewProps } from './DateRangePickerView';
|
|
5
5
|
import { DateRangeValidationError } from '../internal/hooks/validation/useDateRangeValidation';
|
|
6
6
|
import { DateRange } from '../internal/models';
|
|
@@ -39,4 +39,3 @@ export interface BaseDateRangePickerProps<TDate> extends Omit<BasePickerProps<Da
|
|
|
39
39
|
export declare function useDateRangePickerDefaultizedProps<TDate, Props extends BaseDateRangePickerProps<TDate>>(props: Props, name: string): LocalizedComponent<TDate, DefaultizedProps<Props, 'calendars' | keyof BaseDateValidationProps<TDate>, {
|
|
40
40
|
inputFormat: string;
|
|
41
41
|
}>>;
|
|
42
|
-
export declare const dateRangePickerValueManager: PickerStateValueManager<[any, any], any>;
|
|
@@ -2,7 +2,6 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useDefaultDates, useUtils, applyDefaultDate } from '@mui/x-date-pickers/internals';
|
|
4
4
|
import { useThemeProps } from '@mui/material/styles';
|
|
5
|
-
import { replaceInvalidDatesByNull } from '../internal/utils/date-utils';
|
|
6
5
|
import { DateRangePickerToolbar } from './DateRangePickerToolbar';
|
|
7
6
|
export function useDateRangePickerDefaultizedProps(props, name) {
|
|
8
7
|
const utils = useUtils();
|
|
@@ -37,11 +36,4 @@ export function useDateRangePickerDefaultizedProps(props, name) {
|
|
|
37
36
|
Toolbar: DateRangePickerToolbar
|
|
38
37
|
}, themeProps.components)
|
|
39
38
|
});
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export const dateRangePickerValueManager = {
|
|
43
|
-
emptyValue: [null, null],
|
|
44
|
-
getTodayValue: utils => [utils.date(), utils.date()],
|
|
45
|
-
cleanValue: replaceInvalidDatesByNull,
|
|
46
|
-
areValuesEqual: (utils, a, b) => utils.isEqual(a[0], b[0]) && utils.isEqual(a[1], b[1])
|
|
47
|
-
};
|
|
39
|
+
}
|
|
@@ -9,7 +9,8 @@ import { DateRangePickerView } from '../DateRangePicker/DateRangePickerView';
|
|
|
9
9
|
import { DateRangePickerInput } from '../DateRangePicker/DateRangePickerInput';
|
|
10
10
|
import { useDateRangeValidation } from '../internal/hooks/validation/useDateRangeValidation';
|
|
11
11
|
import { getReleaseInfo } from '../internal/utils/releaseInfo';
|
|
12
|
-
import {
|
|
12
|
+
import { rangeValueManager } from '../internal/utils/valueManagers';
|
|
13
|
+
import { useDateRangePickerDefaultizedProps } from '../DateRangePicker/shared';
|
|
13
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
15
|
const releaseInfo = getReleaseInfo();
|
|
15
16
|
const KeyboardDateInputComponent = DateRangePickerInput;
|
|
@@ -33,7 +34,7 @@ export const DesktopDateRangePicker = /*#__PURE__*/React.forwardRef(function Des
|
|
|
33
34
|
pickerProps,
|
|
34
35
|
inputProps,
|
|
35
36
|
wrapperProps
|
|
36
|
-
} = usePickerState(props,
|
|
37
|
+
} = usePickerState(props, rangeValueManager);
|
|
37
38
|
|
|
38
39
|
const {
|
|
39
40
|
components,
|
|
@@ -137,7 +138,7 @@ process.env.NODE_ENV !== "production" ? DesktopDateRangePicker.propTypes = {
|
|
|
137
138
|
disabled: PropTypes.bool,
|
|
138
139
|
|
|
139
140
|
/**
|
|
140
|
-
* If `true` disable values before the current time
|
|
141
|
+
* If `true` disable values before the current date for date components, time for time components and both for date time components.
|
|
141
142
|
* @default false
|
|
142
143
|
*/
|
|
143
144
|
disableFuture: PropTypes.bool,
|
|
@@ -161,7 +162,7 @@ process.env.NODE_ENV !== "production" ? DesktopDateRangePicker.propTypes = {
|
|
|
161
162
|
disableOpenPicker: PropTypes.bool,
|
|
162
163
|
|
|
163
164
|
/**
|
|
164
|
-
* If `true` disable values after the current time.
|
|
165
|
+
* If `true` disable values after the current date for date components, time for time components and both for date time components.
|
|
165
166
|
* @default false
|
|
166
167
|
*/
|
|
167
168
|
disablePast: PropTypes.bool,
|
|
@@ -222,12 +223,12 @@ process.env.NODE_ENV !== "production" ? DesktopDateRangePicker.propTypes = {
|
|
|
222
223
|
mask: PropTypes.string,
|
|
223
224
|
|
|
224
225
|
/**
|
|
225
|
-
* Maximal selectable date.
|
|
226
|
+
* Maximal selectable date.
|
|
226
227
|
*/
|
|
227
228
|
maxDate: PropTypes.any,
|
|
228
229
|
|
|
229
230
|
/**
|
|
230
|
-
* Minimal selectable date.
|
|
231
|
+
* Minimal selectable date.
|
|
231
232
|
*/
|
|
232
233
|
minDate: PropTypes.any,
|
|
233
234
|
|
|
@@ -355,20 +356,18 @@ process.env.NODE_ENV !== "production" ? DesktopDateRangePicker.propTypes = {
|
|
|
355
356
|
shouldDisableDate: PropTypes.func,
|
|
356
357
|
|
|
357
358
|
/**
|
|
358
|
-
* Disable specific
|
|
359
|
-
* Works like `shouldDisableDate` but for month selection view @DateIOType.
|
|
359
|
+
* Disable specific month.
|
|
360
360
|
* @template TDate
|
|
361
|
-
* @param {TDate} month The month to
|
|
361
|
+
* @param {TDate} month The month to test.
|
|
362
362
|
* @returns {boolean} If `true` the month will be disabled.
|
|
363
363
|
*/
|
|
364
364
|
shouldDisableMonth: PropTypes.func,
|
|
365
365
|
|
|
366
366
|
/**
|
|
367
|
-
* Disable specific
|
|
368
|
-
* Works like `shouldDisableDate` but for year selection view @DateIOType.
|
|
367
|
+
* Disable specific year.
|
|
369
368
|
* @template TDate
|
|
370
369
|
* @param {TDate} year The year to test.
|
|
371
|
-
* @returns {boolean}
|
|
370
|
+
* @returns {boolean} If `true` the year will be disabled.
|
|
372
371
|
*/
|
|
373
372
|
shouldDisableYear: PropTypes.func,
|
|
374
373
|
|
|
@@ -9,7 +9,8 @@ import { useDateRangeValidation } from '../internal/hooks/validation/useDateRang
|
|
|
9
9
|
import { DateRangePickerView } from '../DateRangePicker/DateRangePickerView';
|
|
10
10
|
import { DateRangePickerInput } from '../DateRangePicker/DateRangePickerInput';
|
|
11
11
|
import { getReleaseInfo } from '../internal/utils/releaseInfo';
|
|
12
|
-
import {
|
|
12
|
+
import { rangeValueManager } from '../internal/utils/valueManagers';
|
|
13
|
+
import { useDateRangePickerDefaultizedProps } from '../DateRangePicker/shared';
|
|
13
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
15
|
const releaseInfo = getReleaseInfo();
|
|
15
16
|
const PureDateInputComponent = DateRangePickerInput;
|
|
@@ -48,7 +49,7 @@ export const MobileDateRangePicker = /*#__PURE__*/React.forwardRef(function Mobi
|
|
|
48
49
|
pickerProps,
|
|
49
50
|
inputProps,
|
|
50
51
|
wrapperProps
|
|
51
|
-
} = usePickerState(pickerStateProps,
|
|
52
|
+
} = usePickerState(pickerStateProps, rangeValueManager);
|
|
52
53
|
const validationError = useDateRangeValidation(props);
|
|
53
54
|
|
|
54
55
|
const DateInputProps = _extends({}, inputProps, other, {
|
|
@@ -147,7 +148,7 @@ process.env.NODE_ENV !== "production" ? MobileDateRangePicker.propTypes = {
|
|
|
147
148
|
disabled: PropTypes.bool,
|
|
148
149
|
|
|
149
150
|
/**
|
|
150
|
-
* If `true` disable values before the current time
|
|
151
|
+
* If `true` disable values before the current date for date components, time for time components and both for date time components.
|
|
151
152
|
* @default false
|
|
152
153
|
*/
|
|
153
154
|
disableFuture: PropTypes.bool,
|
|
@@ -171,7 +172,7 @@ process.env.NODE_ENV !== "production" ? MobileDateRangePicker.propTypes = {
|
|
|
171
172
|
disableOpenPicker: PropTypes.bool,
|
|
172
173
|
|
|
173
174
|
/**
|
|
174
|
-
* If `true` disable values after the current time.
|
|
175
|
+
* If `true` disable values after the current date for date components, time for time components and both for date time components.
|
|
175
176
|
* @default false
|
|
176
177
|
*/
|
|
177
178
|
disablePast: PropTypes.bool,
|
|
@@ -232,12 +233,12 @@ process.env.NODE_ENV !== "production" ? MobileDateRangePicker.propTypes = {
|
|
|
232
233
|
mask: PropTypes.string,
|
|
233
234
|
|
|
234
235
|
/**
|
|
235
|
-
* Maximal selectable date.
|
|
236
|
+
* Maximal selectable date.
|
|
236
237
|
*/
|
|
237
238
|
maxDate: PropTypes.any,
|
|
238
239
|
|
|
239
240
|
/**
|
|
240
|
-
* Minimal selectable date.
|
|
241
|
+
* Minimal selectable date.
|
|
241
242
|
*/
|
|
242
243
|
minDate: PropTypes.any,
|
|
243
244
|
|
|
@@ -365,20 +366,18 @@ process.env.NODE_ENV !== "production" ? MobileDateRangePicker.propTypes = {
|
|
|
365
366
|
shouldDisableDate: PropTypes.func,
|
|
366
367
|
|
|
367
368
|
/**
|
|
368
|
-
* Disable specific
|
|
369
|
-
* Works like `shouldDisableDate` but for month selection view @DateIOType.
|
|
369
|
+
* Disable specific month.
|
|
370
370
|
* @template TDate
|
|
371
|
-
* @param {TDate} month The month to
|
|
371
|
+
* @param {TDate} month The month to test.
|
|
372
372
|
* @returns {boolean} If `true` the month will be disabled.
|
|
373
373
|
*/
|
|
374
374
|
shouldDisableMonth: PropTypes.func,
|
|
375
375
|
|
|
376
376
|
/**
|
|
377
|
-
* Disable specific
|
|
378
|
-
* Works like `shouldDisableDate` but for year selection view @DateIOType.
|
|
377
|
+
* Disable specific year.
|
|
379
378
|
* @template TDate
|
|
380
379
|
* @param {TDate} year The year to test.
|
|
381
|
-
* @returns {boolean}
|
|
380
|
+
* @returns {boolean} If `true` the year will be disabled.
|
|
382
381
|
*/
|
|
383
382
|
shouldDisableYear: PropTypes.func,
|
|
384
383
|
|
|
@@ -163,13 +163,13 @@ process.env.NODE_ENV !== "production" ? MultiInputDateRangeField.propTypes = {
|
|
|
163
163
|
defaultValue: PropTypes.arrayOf(PropTypes.any),
|
|
164
164
|
|
|
165
165
|
/**
|
|
166
|
-
* If `true` disable values before the current time
|
|
166
|
+
* If `true` disable values before the current date for date components, time for time components and both for date time components.
|
|
167
167
|
* @default false
|
|
168
168
|
*/
|
|
169
169
|
disableFuture: PropTypes.bool,
|
|
170
170
|
|
|
171
171
|
/**
|
|
172
|
-
* If `true` disable values after the current time.
|
|
172
|
+
* If `true` disable values after the current date for date components, time for time components and both for date time components.
|
|
173
173
|
* @default false
|
|
174
174
|
*/
|
|
175
175
|
disablePast: PropTypes.bool,
|
|
@@ -180,15 +180,29 @@ process.env.NODE_ENV !== "production" ? MultiInputDateRangeField.propTypes = {
|
|
|
180
180
|
format: PropTypes.string,
|
|
181
181
|
|
|
182
182
|
/**
|
|
183
|
-
* Maximal selectable date.
|
|
183
|
+
* Maximal selectable date.
|
|
184
184
|
*/
|
|
185
185
|
maxDate: PropTypes.any,
|
|
186
186
|
|
|
187
187
|
/**
|
|
188
|
-
* Minimal selectable date.
|
|
188
|
+
* Minimal selectable date.
|
|
189
189
|
*/
|
|
190
190
|
minDate: PropTypes.any,
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Callback fired when the value changes.
|
|
194
|
+
* @template TValue, TError
|
|
195
|
+
* @param {TValue} value The new value.
|
|
196
|
+
* @param {FieldChangeHandlerContext<TError>} The context containing the validation result of the current value.
|
|
197
|
+
*/
|
|
191
198
|
onChange: PropTypes.func,
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Callback fired when the error associated to the current value changes.
|
|
202
|
+
* @template TValue, TError
|
|
203
|
+
* @param {TError} error The new error.
|
|
204
|
+
* @param {TValue} value The value associated to the error.
|
|
205
|
+
*/
|
|
192
206
|
onError: PropTypes.func,
|
|
193
207
|
|
|
194
208
|
/**
|
|
@@ -213,7 +227,7 @@ process.env.NODE_ENV !== "production" ? MultiInputDateRangeField.propTypes = {
|
|
|
213
227
|
* 4. If `null` is provided, no section will be selected
|
|
214
228
|
* If not provided, the selected sections will be handled internally.
|
|
215
229
|
*/
|
|
216
|
-
selectedSections: PropTypes.oneOfType([PropTypes.oneOf(['day', '
|
|
230
|
+
selectedSections: PropTypes.oneOfType([PropTypes.oneOf(['day', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'year']), PropTypes.number, PropTypes.shape({
|
|
217
231
|
endIndex: PropTypes.number.isRequired,
|
|
218
232
|
startIndex: PropTypes.number.isRequired
|
|
219
233
|
})]),
|
|
@@ -226,6 +240,11 @@ process.env.NODE_ENV !== "production" ? MultiInputDateRangeField.propTypes = {
|
|
|
226
240
|
* @returns {boolean} Returns `true` if the date should be disabled.
|
|
227
241
|
*/
|
|
228
242
|
shouldDisableDate: PropTypes.func,
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* The selected value.
|
|
246
|
+
* Used when the component is controlled.
|
|
247
|
+
*/
|
|
229
248
|
value: PropTypes.arrayOf(PropTypes.any)
|
|
230
249
|
} : void 0;
|
|
231
250
|
export { MultiInputDateRangeField };
|
|
@@ -181,7 +181,7 @@ process.env.NODE_ENV !== "production" ? MultiInputDateTimeRangeField.propTypes =
|
|
|
181
181
|
defaultValue: PropTypes.arrayOf(PropTypes.any),
|
|
182
182
|
|
|
183
183
|
/**
|
|
184
|
-
* If `true` disable values before the current time
|
|
184
|
+
* If `true` disable values before the current date for date components, time for time components and both for date time components.
|
|
185
185
|
* @default false
|
|
186
186
|
*/
|
|
187
187
|
disableFuture: PropTypes.bool,
|
|
@@ -193,7 +193,7 @@ process.env.NODE_ENV !== "production" ? MultiInputDateTimeRangeField.propTypes =
|
|
|
193
193
|
disableIgnoringDatePartForTimeValidation: PropTypes.bool,
|
|
194
194
|
|
|
195
195
|
/**
|
|
196
|
-
* If `true` disable values after the current time.
|
|
196
|
+
* If `true` disable values after the current date for date components, time for time components and both for date time components.
|
|
197
197
|
* @default false
|
|
198
198
|
*/
|
|
199
199
|
disablePast: PropTypes.bool,
|
|
@@ -204,7 +204,7 @@ process.env.NODE_ENV !== "production" ? MultiInputDateTimeRangeField.propTypes =
|
|
|
204
204
|
format: PropTypes.string,
|
|
205
205
|
|
|
206
206
|
/**
|
|
207
|
-
* Maximal selectable date.
|
|
207
|
+
* Maximal selectable date.
|
|
208
208
|
*/
|
|
209
209
|
maxDate: PropTypes.any,
|
|
210
210
|
|
|
@@ -214,13 +214,13 @@ process.env.NODE_ENV !== "production" ? MultiInputDateTimeRangeField.propTypes =
|
|
|
214
214
|
maxDateTime: PropTypes.any,
|
|
215
215
|
|
|
216
216
|
/**
|
|
217
|
-
*
|
|
218
|
-
*
|
|
217
|
+
* Maximal selectable time.
|
|
218
|
+
* The date part of the object will be ignored unless `props.disableIgnoringDatePartForTimeValidation === true`.
|
|
219
219
|
*/
|
|
220
220
|
maxTime: PropTypes.any,
|
|
221
221
|
|
|
222
222
|
/**
|
|
223
|
-
* Minimal selectable date.
|
|
223
|
+
* Minimal selectable date.
|
|
224
224
|
*/
|
|
225
225
|
minDate: PropTypes.any,
|
|
226
226
|
|
|
@@ -230,8 +230,8 @@ process.env.NODE_ENV !== "production" ? MultiInputDateTimeRangeField.propTypes =
|
|
|
230
230
|
minDateTime: PropTypes.any,
|
|
231
231
|
|
|
232
232
|
/**
|
|
233
|
-
*
|
|
234
|
-
*
|
|
233
|
+
* Minimal selectable time.
|
|
234
|
+
* The date part of the object will be ignored unless `props.disableIgnoringDatePartForTimeValidation === true`.
|
|
235
235
|
*/
|
|
236
236
|
minTime: PropTypes.any,
|
|
237
237
|
|
|
@@ -240,7 +240,21 @@ process.env.NODE_ENV !== "production" ? MultiInputDateTimeRangeField.propTypes =
|
|
|
240
240
|
* @default 1
|
|
241
241
|
*/
|
|
242
242
|
minutesStep: PropTypes.number,
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Callback fired when the value changes.
|
|
246
|
+
* @template TValue, TError
|
|
247
|
+
* @param {TValue} value The new value.
|
|
248
|
+
* @param {FieldChangeHandlerContext<TError>} The context containing the validation result of the current value.
|
|
249
|
+
*/
|
|
243
250
|
onChange: PropTypes.func,
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Callback fired when the error associated to the current value changes.
|
|
254
|
+
* @template TValue, TError
|
|
255
|
+
* @param {TError} error The new error.
|
|
256
|
+
* @param {TValue} value The value associated to the error.
|
|
257
|
+
*/
|
|
244
258
|
onError: PropTypes.func,
|
|
245
259
|
|
|
246
260
|
/**
|
|
@@ -265,7 +279,7 @@ process.env.NODE_ENV !== "production" ? MultiInputDateTimeRangeField.propTypes =
|
|
|
265
279
|
* 4. If `null` is provided, no section will be selected
|
|
266
280
|
* If not provided, the selected sections will be handled internally.
|
|
267
281
|
*/
|
|
268
|
-
selectedSections: PropTypes.oneOfType([PropTypes.oneOf(['day', '
|
|
282
|
+
selectedSections: PropTypes.oneOfType([PropTypes.oneOf(['day', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'year']), PropTypes.number, PropTypes.shape({
|
|
269
283
|
endIndex: PropTypes.number.isRequired,
|
|
270
284
|
startIndex: PropTypes.number.isRequired
|
|
271
285
|
})]),
|
|
@@ -280,13 +294,17 @@ process.env.NODE_ENV !== "production" ? MultiInputDateTimeRangeField.propTypes =
|
|
|
280
294
|
shouldDisableDate: PropTypes.func,
|
|
281
295
|
|
|
282
296
|
/**
|
|
283
|
-
*
|
|
284
|
-
* If returns `false` appropriate time point will ot be acceptable.
|
|
297
|
+
* Disable specific time.
|
|
285
298
|
* @param {number} timeValue The value to check.
|
|
286
299
|
* @param {ClockPickerView} view The clock type of the timeValue.
|
|
287
|
-
* @returns {boolean}
|
|
300
|
+
* @returns {boolean} If `true` the time will be disabled.
|
|
288
301
|
*/
|
|
289
302
|
shouldDisableTime: PropTypes.func,
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* The selected value.
|
|
306
|
+
* Used when the component is controlled.
|
|
307
|
+
*/
|
|
290
308
|
value: PropTypes.arrayOf(PropTypes.any)
|
|
291
309
|
} : void 0;
|
|
292
310
|
export { MultiInputDateTimeRangeField };
|
|
@@ -171,7 +171,7 @@ process.env.NODE_ENV !== "production" ? MultiInputTimeRangeField.propTypes = {
|
|
|
171
171
|
defaultValue: PropTypes.arrayOf(PropTypes.any),
|
|
172
172
|
|
|
173
173
|
/**
|
|
174
|
-
* If `true` disable values before the current time
|
|
174
|
+
* If `true` disable values before the current date for date components, time for time components and both for date time components.
|
|
175
175
|
* @default false
|
|
176
176
|
*/
|
|
177
177
|
disableFuture: PropTypes.bool,
|
|
@@ -183,7 +183,7 @@ process.env.NODE_ENV !== "production" ? MultiInputTimeRangeField.propTypes = {
|
|
|
183
183
|
disableIgnoringDatePartForTimeValidation: PropTypes.bool,
|
|
184
184
|
|
|
185
185
|
/**
|
|
186
|
-
* If `true` disable values after the current time.
|
|
186
|
+
* If `true` disable values after the current date for date components, time for time components and both for date time components.
|
|
187
187
|
* @default false
|
|
188
188
|
*/
|
|
189
189
|
disablePast: PropTypes.bool,
|
|
@@ -194,14 +194,14 @@ process.env.NODE_ENV !== "production" ? MultiInputTimeRangeField.propTypes = {
|
|
|
194
194
|
format: PropTypes.string,
|
|
195
195
|
|
|
196
196
|
/**
|
|
197
|
-
*
|
|
198
|
-
*
|
|
197
|
+
* Maximal selectable time.
|
|
198
|
+
* The date part of the object will be ignored unless `props.disableIgnoringDatePartForTimeValidation === true`.
|
|
199
199
|
*/
|
|
200
200
|
maxTime: PropTypes.any,
|
|
201
201
|
|
|
202
202
|
/**
|
|
203
|
-
*
|
|
204
|
-
*
|
|
203
|
+
* Minimal selectable time.
|
|
204
|
+
* The date part of the object will be ignored unless `props.disableIgnoringDatePartForTimeValidation === true`.
|
|
205
205
|
*/
|
|
206
206
|
minTime: PropTypes.any,
|
|
207
207
|
|
|
@@ -210,7 +210,21 @@ process.env.NODE_ENV !== "production" ? MultiInputTimeRangeField.propTypes = {
|
|
|
210
210
|
* @default 1
|
|
211
211
|
*/
|
|
212
212
|
minutesStep: PropTypes.number,
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Callback fired when the value changes.
|
|
216
|
+
* @template TValue, TError
|
|
217
|
+
* @param {TValue} value The new value.
|
|
218
|
+
* @param {FieldChangeHandlerContext<TError>} The context containing the validation result of the current value.
|
|
219
|
+
*/
|
|
213
220
|
onChange: PropTypes.func,
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Callback fired when the error associated to the current value changes.
|
|
224
|
+
* @template TValue, TError
|
|
225
|
+
* @param {TError} error The new error.
|
|
226
|
+
* @param {TValue} value The value associated to the error.
|
|
227
|
+
*/
|
|
214
228
|
onError: PropTypes.func,
|
|
215
229
|
|
|
216
230
|
/**
|
|
@@ -235,19 +249,23 @@ process.env.NODE_ENV !== "production" ? MultiInputTimeRangeField.propTypes = {
|
|
|
235
249
|
* 4. If `null` is provided, no section will be selected
|
|
236
250
|
* If not provided, the selected sections will be handled internally.
|
|
237
251
|
*/
|
|
238
|
-
selectedSections: PropTypes.oneOfType([PropTypes.oneOf(['day', '
|
|
252
|
+
selectedSections: PropTypes.oneOfType([PropTypes.oneOf(['day', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'year']), PropTypes.number, PropTypes.shape({
|
|
239
253
|
endIndex: PropTypes.number.isRequired,
|
|
240
254
|
startIndex: PropTypes.number.isRequired
|
|
241
255
|
})]),
|
|
242
256
|
|
|
243
257
|
/**
|
|
244
|
-
*
|
|
245
|
-
* If returns `false` appropriate time point will ot be acceptable.
|
|
258
|
+
* Disable specific time.
|
|
246
259
|
* @param {number} timeValue The value to check.
|
|
247
260
|
* @param {ClockPickerView} view The clock type of the timeValue.
|
|
248
|
-
* @returns {boolean}
|
|
261
|
+
* @returns {boolean} If `true` the time will be disabled.
|
|
249
262
|
*/
|
|
250
263
|
shouldDisableTime: PropTypes.func,
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* The selected value.
|
|
267
|
+
* Used when the component is controlled.
|
|
268
|
+
*/
|
|
251
269
|
value: PropTypes.arrayOf(PropTypes.any)
|
|
252
270
|
} : void 0;
|
|
253
271
|
export { MultiInputTimeRangeField };
|