@mui/x-date-pickers-pro 6.2.1 → 6.3.1
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 +118 -3
- package/DateRangePicker/shared.d.ts +1 -1
- package/DesktopDateRangePicker/DesktopDateRangePicker.js +1 -1
- package/MobileDateRangePicker/MobileDateRangePicker.js +1 -1
- package/MultiInputDateRangeField/MultiInputDateRangeField.js +26 -4
- package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +27 -4
- package/MultiInputTimeRangeField/MultiInputTimeRangeField.js +27 -4
- package/README.md +0 -9
- package/SingleInputDateRangeField/SingleInputDateRangeField.js +24 -3
- package/SingleInputDateRangeField/useSingleInputDateRangeField.js +4 -2
- package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +25 -3
- package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +4 -2
- package/SingleInputTimeRangeField/SingleInputTimeRangeField.js +25 -3
- package/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +4 -2
- package/StaticDateRangePicker/StaticDateRangePicker.js +1 -1
- package/dateRangeViewRenderers/dateRangeViewRenderers.d.ts +2 -2
- package/index.d.ts +1 -3
- package/index.js +3 -2
- package/internal/hooks/useDesktopRangePicker/useDesktopRangePicker.d.ts +2 -2
- package/internal/hooks/useDesktopRangePicker/useDesktopRangePicker.types.d.ts +5 -5
- package/internal/hooks/useEnrichedRangePickerFieldProps.d.ts +4 -3
- package/internal/hooks/useMobileRangePicker/useMobileRangePicker.d.ts +2 -2
- package/internal/hooks/useMobileRangePicker/useMobileRangePicker.types.d.ts +5 -5
- package/internal/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +4 -1
- package/internal/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +4 -1
- package/internal/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +4 -1
- package/internal/hooks/useStaticRangePicker/useStaticRangePicker.d.ts +2 -2
- package/internal/hooks/useStaticRangePicker/useStaticRangePicker.types.d.ts +5 -5
- package/internal/models/dateRange.d.ts +1 -1
- package/internal/models/dateTimeRange.d.ts +3 -11
- package/internal/models/timeRange.d.ts +1 -1
- package/internal/utils/date-fields-utils.d.ts +4 -1
- package/internal/utils/releaseInfo.js +1 -1
- package/internal/{hooks/validation/useDateRangeValidation.d.ts → utils/validation/validateDateRange.d.ts} +1 -7
- package/internal/{hooks/validation/useDateRangeValidation.js → utils/validation/validateDateRange.js} +1 -1
- package/internal/utils/validation/validateDateTimeRange.d.ts +7 -0
- package/internal/{hooks/validation/useDateTimeRangeValidation.js → utils/validation/validateDateTimeRange.js} +2 -6
- package/internal/utils/validation/validateTimeRange.d.ts +6 -0
- package/internal/{hooks/validation/useTimeRangeValidation.js → utils/validation/validateTimeRange.js} +2 -6
- package/internal/utils/valueManagers.d.ts +1 -3
- package/internal/utils/valueManagers.js +1 -1
- package/legacy/DesktopDateRangePicker/DesktopDateRangePicker.js +1 -1
- package/legacy/MobileDateRangePicker/MobileDateRangePicker.js +1 -1
- package/legacy/MultiInputDateRangeField/MultiInputDateRangeField.js +26 -4
- package/legacy/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +27 -4
- package/legacy/MultiInputTimeRangeField/MultiInputTimeRangeField.js +27 -4
- package/legacy/SingleInputDateRangeField/SingleInputDateRangeField.js +24 -3
- package/legacy/SingleInputDateRangeField/useSingleInputDateRangeField.js +4 -2
- package/legacy/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +25 -3
- package/legacy/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +4 -2
- package/legacy/SingleInputTimeRangeField/SingleInputTimeRangeField.js +25 -3
- package/legacy/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +4 -2
- package/legacy/StaticDateRangePicker/StaticDateRangePicker.js +1 -1
- package/legacy/index.js +3 -2
- package/legacy/internal/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +4 -1
- package/legacy/internal/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +4 -1
- package/legacy/internal/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +4 -1
- package/legacy/internal/utils/releaseInfo.js +1 -1
- package/legacy/internal/{hooks/validation/useDateRangeValidation.js → utils/validation/validateDateRange.js} +1 -1
- package/legacy/internal/{hooks/validation/useDateTimeRangeValidation.js → utils/validation/validateDateTimeRange.js} +2 -6
- package/legacy/internal/{hooks/validation/useTimeRangeValidation.js → utils/validation/validateTimeRange.js} +2 -6
- package/legacy/internal/utils/valueManagers.js +1 -1
- package/legacy/models/index.js +1 -0
- package/legacy/models/validation.js +1 -0
- package/models/index.d.ts +1 -0
- package/models/index.js +1 -0
- package/models/package.json +6 -0
- package/models/validation.d.ts +9 -0
- package/models/validation.js +1 -0
- package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +1 -1
- package/modern/MobileDateRangePicker/MobileDateRangePicker.js +1 -1
- package/modern/MultiInputDateRangeField/MultiInputDateRangeField.js +26 -4
- package/modern/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +27 -4
- package/modern/MultiInputTimeRangeField/MultiInputTimeRangeField.js +27 -4
- package/modern/SingleInputDateRangeField/SingleInputDateRangeField.js +24 -3
- package/modern/SingleInputDateRangeField/useSingleInputDateRangeField.js +4 -2
- package/modern/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +25 -3
- package/modern/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +4 -2
- package/modern/SingleInputTimeRangeField/SingleInputTimeRangeField.js +25 -3
- package/modern/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +4 -2
- package/modern/StaticDateRangePicker/StaticDateRangePicker.js +1 -1
- package/modern/index.js +3 -2
- package/modern/internal/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +4 -1
- package/modern/internal/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +4 -1
- package/modern/internal/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +4 -1
- package/modern/internal/utils/releaseInfo.js +1 -1
- package/modern/internal/{hooks/validation/useDateRangeValidation.js → utils/validation/validateDateRange.js} +1 -1
- package/modern/internal/{hooks/validation/useDateTimeRangeValidation.js → utils/validation/validateDateTimeRange.js} +2 -6
- package/modern/internal/{hooks/validation/useTimeRangeValidation.js → utils/validation/validateTimeRange.js} +2 -6
- package/modern/internal/utils/valueManagers.js +1 -1
- package/modern/models/index.js +1 -0
- package/modern/models/validation.js +1 -0
- package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +2 -2
- package/node/MobileDateRangePicker/MobileDateRangePicker.js +2 -2
- package/node/MultiInputDateRangeField/MultiInputDateRangeField.js +26 -4
- package/node/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +27 -4
- package/node/MultiInputTimeRangeField/MultiInputTimeRangeField.js +27 -4
- package/node/SingleInputDateRangeField/SingleInputDateRangeField.js +24 -3
- package/node/SingleInputDateRangeField/useSingleInputDateRangeField.js +5 -3
- package/node/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +25 -3
- package/node/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +5 -3
- package/node/SingleInputTimeRangeField/SingleInputTimeRangeField.js +25 -3
- package/node/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +5 -3
- package/node/StaticDateRangePicker/StaticDateRangePicker.js +2 -2
- package/node/index.js +13 -1
- package/node/internal/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +6 -3
- package/node/internal/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +6 -3
- package/node/internal/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +6 -3
- package/node/internal/utils/releaseInfo.js +1 -1
- package/node/internal/{hooks/validation/useDateRangeValidation.js → utils/validation/validateDateRange.js} +1 -1
- package/node/internal/{hooks/validation/useDateTimeRangeValidation.js → utils/validation/validateDateTimeRange.js} +3 -8
- package/node/internal/{hooks/validation/useTimeRangeValidation.js → utils/validation/validateTimeRange.js} +3 -8
- package/node/internal/utils/valueManagers.js +1 -1
- package/node/models/index.js +16 -0
- package/node/models/validation.js +5 -0
- package/package.json +4 -7
- package/internal/hooks/validation/useDateTimeRangeValidation.d.ts +0 -14
- package/internal/hooks/validation/useTimeRangeValidation.d.ts +0 -13
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,121 @@
|
|
|
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.3.1
|
|
7
|
+
|
|
8
|
+
_May 5, 2023_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 7 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🐞 Bugfixes
|
|
13
|
+
- 📚 Documentation improvements
|
|
14
|
+
|
|
15
|
+
### `@mui/x-data-grid@v6.3.1` / `@mui/x-data-grid-pro@v6.3.1` / `@mui/x-data-grid-premium@v6.3.1`
|
|
16
|
+
|
|
17
|
+
#### Changes
|
|
18
|
+
|
|
19
|
+
- [DataGrid] Fix broken filtering in the value formatter demo (#8621) @cherniavskii
|
|
20
|
+
- [DataGrid] Fix falsy filter values not showing in filter button tooltip (#8550) @ithrforu
|
|
21
|
+
- [DataGrid] Fix missing watermark in Pro and Premium packages (#8797) @cherniavskii
|
|
22
|
+
- [DataGrid] Remove unwarranted warning log (#8847) @romgrk
|
|
23
|
+
- [DataGrid] Add Joy UI slots (`Select`, `SelectOption`, `InputLabel`, `FormControl`) (#8747) @cherniavskii
|
|
24
|
+
- [DataGridPremium] Fix expanded groups being collapsed after calling `updateRows` (#8823) @cherniavskii
|
|
25
|
+
|
|
26
|
+
### `@mui/x-date-pickers@v6.3.1` / `@mui/x-date-pickers-pro@v6.3.1`
|
|
27
|
+
|
|
28
|
+
#### Changes
|
|
29
|
+
|
|
30
|
+
- [pickers] Fix `minutesStep` validation prop behavior (#8794) @LukasTy
|
|
31
|
+
- [pickers] Fix time picker `viewRenderers` overriding (#8830) @LukasTy
|
|
32
|
+
- [pickers] Remove last additional character when using LTR (#8848) @alexfauquette
|
|
33
|
+
|
|
34
|
+
### Docs
|
|
35
|
+
|
|
36
|
+
- [docs] Fix controlled mode demo on Editing page (#8800) @yaredtsy
|
|
37
|
+
- [docs] Fix scrolling demo not working with React 18 (#6489) @cherniavskii
|
|
38
|
+
- [docs] Update demo to support agregation on popular feature cell (#8617) @BalaM314
|
|
39
|
+
- [docs] Clarify what `<path>` is (#8764) @alexfauquette
|
|
40
|
+
|
|
41
|
+
### Core
|
|
42
|
+
|
|
43
|
+
- [core] Do not include playground pages in `yarn typescript` script (#8822) @cherniavskii
|
|
44
|
+
- [core] Limit `typescript:ci` step memory limit (#8796) @LukasTy
|
|
45
|
+
- [core] Upgrade monorepo (#8835) @cherniavskii
|
|
46
|
+
- [test] Use `fake` clock on `MobileDateRangePicker` (#8861) @LukasTy
|
|
47
|
+
- [charts] Clean some styling (#8778) @alexfauquette
|
|
48
|
+
- [charts] Improve tooltip (#8792) @alexfauquette
|
|
49
|
+
- [charts] Improvement and docs on axis (#8654) @alexfauquette
|
|
50
|
+
- [charts] Defaultize attributes (#8788) @alexfauquette
|
|
51
|
+
|
|
52
|
+
## 6.3.0
|
|
53
|
+
|
|
54
|
+
_Apr 28, 2023_
|
|
55
|
+
|
|
56
|
+
We'd like to offer a big thanks to the 15 contributors who made this release possible. Here are some highlights ✨:
|
|
57
|
+
|
|
58
|
+
- 🚀 New [time-picking UI](https://mui.com/x/react-date-pickers/digital-clock/) designed for desktops (#7958) @LukasTy
|
|
59
|
+
|
|
60
|
+
<img src="https://user-images.githubusercontent.com/4941090/235072007-de39a397-e4a4-4c98-8e10-5ee4ad440108.gif" width="494" />
|
|
61
|
+
|
|
62
|
+
- ✨ Picker fields [now always include a leading zero](https://mui.com/x/react-date-pickers/adapters-locale/#respect-leading-zeros-in-fields) on digit sections (#8527) @flaviendelangle
|
|
63
|
+
- 🌍 Improve Chinese (zh-CN), French (fr-FR), and Turkish (tr-TR) locales
|
|
64
|
+
- 🐞 Bugfixes
|
|
65
|
+
- 📚 Documentation improvements
|
|
66
|
+
|
|
67
|
+
### `@mui/x-data-grid@v6.3.0` / `@mui/x-data-grid-pro@v6.3.0` / `@mui/x-data-grid-premium@v6.3.0`
|
|
68
|
+
|
|
69
|
+
#### Changes
|
|
70
|
+
|
|
71
|
+
- [DataGrid] Add overlay classes to `gridClasses` (#8686) @lindapaiste
|
|
72
|
+
- [DataGrid] Avoid passing `api` prop to div (#8679) @someden
|
|
73
|
+
- [DataGrid] Fix 'ResizeObserver loop limit exceeded' error (#8744) @m4theushw
|
|
74
|
+
- [DataGrid] Add Joy UI slots (button and switch) (#8699) @siriwatknp
|
|
75
|
+
- [DataGrid] Fix aggregation label alignment (#8694) @joserodolfofreitas
|
|
76
|
+
- [DataGridPremium] Fix infinite loop when updating grouped rows (#8693) @cherniavskii
|
|
77
|
+
- [DataGridPro] Fix error after updating `columns` and `columnGroupingModel` at once (#8730) @cherniavskii
|
|
78
|
+
- [l10n] Improve Chinese (zh-CN) locale (#8753) @SakumyZ
|
|
79
|
+
- [l10n] Improve French (fr-FR) locale (#8704) @Jul13nT
|
|
80
|
+
- [l10n] Improve Turkish (tr-TR) locale (#8783) @cccaaannn
|
|
81
|
+
|
|
82
|
+
### `@mui/x-date-pickers@v6.3.0` / `@mui/x-date-pickers-pro@v6.3.0`
|
|
83
|
+
|
|
84
|
+
#### Changes
|
|
85
|
+
|
|
86
|
+
- [fields] Always add leading zeroes on digit sections (#8527) @flaviendelangle
|
|
87
|
+
- [fields] Pass the `readOnly` prop to `InputProps` instead of `inputProps` (#8659) @flaviendelangle
|
|
88
|
+
- [pickers] Add missing export for `caES` locale (#8782) @flaviendelangle
|
|
89
|
+
- [pickers] Add new `DigitalClock` desktop time picking experience (#7958) @LukasTy
|
|
90
|
+
- [pickers] Do not use `instanceOf DateTime` in `AdapterLuxon` (#8734) @flaviendelangle
|
|
91
|
+
- [pickers] Fix date calendar `selected` & `disabled` day style (#8773) @LukasTy
|
|
92
|
+
- [pickers] Migrate `AdapterDateFns` to our repository (#8736) @flaviendelangle
|
|
93
|
+
- [pickers] Migrate `AdapterLuxon` to our repository (#8600) @flaviendelangle
|
|
94
|
+
- [pickers] Migrate `AdapterMomentHijri` to our repository (#8776) @flaviendelangle
|
|
95
|
+
- [pickers] Migrate `AdapterMomentJalaali` and `AdapterDateFnsJalali` to our repository (#8741) @flaviendelangle
|
|
96
|
+
- [pickers] Migrate `AdapterMoment` to our repository (#8700) @flaviendelangle
|
|
97
|
+
- [pickers] Refactor the validation files (#8622) @flaviendelangle
|
|
98
|
+
- [pickers] Use `en dash` instead of `em dash` in multi input range fields (#8738) @flaviendelangle
|
|
99
|
+
- [l10n] Improve Chinese (zh-CN) locale (#8753) @SakumyZ
|
|
100
|
+
- [l10n] Improve Turkish (tr-TR) locale (#8783) @cccaaannn
|
|
101
|
+
|
|
102
|
+
### Docs
|
|
103
|
+
|
|
104
|
+
- [docs] Add icons for charts menu (#8752) @alexfauquette
|
|
105
|
+
- [docs] Document the supported formats (#8746) @flaviendelangle
|
|
106
|
+
- [docs] Fix Hijri demo (#8698) @alexfauquette
|
|
107
|
+
- [docs] Fix `x-codemod` package version in changelog (#8690) @MBilalShafi
|
|
108
|
+
- [docs] Fix columns special properties code example (#8414) @mikkelhl
|
|
109
|
+
- [docs] Fix error in `minDateTime` `validation` page section (#8777) @LukasTy
|
|
110
|
+
- [docs] Update custom field pickers using theme scoping (#8609) @siriwatknp
|
|
111
|
+
- [docs] Use community version of data grid for column grouping demo (#7346) @ASchwad
|
|
112
|
+
- [docs] Use new `slots` / `slotProps` props in the pickers migration guide (#8341) @flaviendelangle
|
|
113
|
+
|
|
114
|
+
### Core
|
|
115
|
+
|
|
116
|
+
- [core] Cleanup picker tests (#8652) @flaviendelangle
|
|
117
|
+
- [core] Use `adapter.lib` instead of `adapterName` in `describeAdapters` (#8779) @flaviendelangle
|
|
118
|
+
- [charts] Adapt line and scatter plot to the "band" scale type (#8701) @alexfauquette
|
|
119
|
+
- [charts] Link the Gantt Charts issue in the docs (#8739) @flaviendelangle
|
|
120
|
+
|
|
6
121
|
## 6.2.1
|
|
7
122
|
|
|
8
123
|
_Apr 20, 2023_
|
|
@@ -31,7 +146,7 @@ We'd like to offer a big thanks to the 9 contributors who made this release poss
|
|
|
31
146
|
- [pickers] Do not include the time in date components when going to today (#8657) @flaviendelangle
|
|
32
147
|
- [pickers] Sync internal state with controlled value (#8674) @alexfauquette
|
|
33
148
|
|
|
34
|
-
### `@mui/x-codemod@v6.
|
|
149
|
+
### `@mui/x-codemod@v6.2.1`
|
|
35
150
|
|
|
36
151
|
#### Changes
|
|
37
152
|
|
|
@@ -195,9 +310,9 @@ We'd like to offer a big thanks to the 9 contributors who made this release poss
|
|
|
195
310
|
|
|
196
311
|
- [fields] Add missing tokens to `AdapterDateFnsJalali` (#8402) @flaviendelangle
|
|
197
312
|
- [fields] Clean the active date manager (#8370) @flaviendelangle
|
|
198
|
-
- [fields] Cleanup `useFieldState`
|
|
313
|
+
- [fields] Cleanup `useFieldState` (#8292) @flaviendelangle
|
|
199
314
|
- [fields] Only add RTL characters when needed (#8325) @flaviendelangle
|
|
200
|
-
- [pickers] Add support for single input fields in range pickers
|
|
315
|
+
- [pickers] Add support for single input fields in range pickers (#7927) @flaviendelangle
|
|
201
316
|
- [pickers] Allows non token characters in format (#8256) @alexfauquette
|
|
202
317
|
- [pickers] Avoid root imports and move public models to the models folder (#8337) @flaviendelangle
|
|
203
318
|
- [pickers] Update `view` when `views` or `openTo` changes (#8361) @LukasTy
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { LocalizedComponent } from '@mui/x-date-pickers/locales';
|
|
3
3
|
import { DefaultizedProps, BaseDateValidationProps, BasePickerInputProps, PickerViewRendererLookup, UncapitalizeObjectKeys } from '@mui/x-date-pickers/internals';
|
|
4
|
-
import { DateRangeValidationError } from '../
|
|
4
|
+
import { DateRangeValidationError } from '../models';
|
|
5
5
|
import { DateRange } from '../internal/models';
|
|
6
6
|
import { DateRangeCalendarSlotsComponent, DateRangeCalendarSlotsComponentsProps, ExportedDateRangeCalendarProps } from '../DateRangeCalendar';
|
|
7
7
|
import { DateRangePickerToolbarProps, ExportedDateRangePickerToolbarProps } from './DateRangePickerToolbar';
|
|
@@ -8,7 +8,7 @@ import { useDateRangePickerDefaultizedProps } from '../DateRangePicker/shared';
|
|
|
8
8
|
import { renderDateRangeViewCalendar } from '../dateRangeViewRenderers';
|
|
9
9
|
import { MultiInputDateRangeField } from '../MultiInputDateRangeField';
|
|
10
10
|
import { useDesktopRangePicker } from '../internal/hooks/useDesktopRangePicker';
|
|
11
|
-
import { validateDateRange } from '../internal/
|
|
11
|
+
import { validateDateRange } from '../internal/utils/validation/validateDateRange';
|
|
12
12
|
const DesktopDateRangePicker = /*#__PURE__*/React.forwardRef(function DesktopDateRangePicker(inProps, ref) {
|
|
13
13
|
var _defaultizedProps$cal, _defaultizedProps$slo2;
|
|
14
14
|
// Props with the default values common to all date time pickers
|
|
@@ -10,7 +10,7 @@ import { useDateRangePickerDefaultizedProps } from '../DateRangePicker/shared';
|
|
|
10
10
|
import { renderDateRangeViewCalendar } from '../dateRangeViewRenderers';
|
|
11
11
|
import { MultiInputDateRangeField } from '../MultiInputDateRangeField';
|
|
12
12
|
import { useMobileRangePicker } from '../internal/hooks/useMobileRangePicker';
|
|
13
|
-
import { validateDateRange } from '../internal/
|
|
13
|
+
import { validateDateRange } from '../internal/utils/validation/validateDateRange';
|
|
14
14
|
const MobileDateRangePicker = /*#__PURE__*/React.forwardRef(function MobileDateRangePicker(inProps, ref) {
|
|
15
15
|
var _defaultizedProps$slo2;
|
|
16
16
|
// Props with the default values common to all date time pickers
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["slots", "slotProps", "components", "componentsProps", "value", "defaultValue", "format", "formatDensity", "onChange", "readOnly", "disabled", "onError", "shouldDisableDate", "minDate", "maxDate", "disableFuture", "disablePast", "selectedSections", "onSelectedSectionsChange", "autoFocus"],
|
|
3
|
+
const _excluded = ["slots", "slotProps", "components", "componentsProps", "value", "defaultValue", "format", "formatDensity", "shouldRespectLeadingZeros", "onChange", "readOnly", "disabled", "onError", "shouldDisableDate", "minDate", "maxDate", "disableFuture", "disablePast", "selectedSections", "onSelectedSectionsChange", "autoFocus"],
|
|
4
4
|
_excluded2 = ["onKeyDown", "ref", "readOnly", "inputMode"],
|
|
5
5
|
_excluded3 = ["onKeyDown", "ref", "readOnly", "inputMode"];
|
|
6
6
|
import * as React from 'react';
|
|
@@ -27,7 +27,7 @@ const MultiInputDateRangeFieldRoot = styled( /*#__PURE__*/React.forwardRef((prop
|
|
|
27
27
|
const MultiInputDateRangeFieldSeparator = styled(props => {
|
|
28
28
|
var _props$children;
|
|
29
29
|
return /*#__PURE__*/_jsx(Typography, _extends({}, props, {
|
|
30
|
-
children: (_props$children = props.children) != null ? _props$children : '
|
|
30
|
+
children: (_props$children = props.children) != null ? _props$children : ' – '
|
|
31
31
|
}));
|
|
32
32
|
}, {
|
|
33
33
|
name: 'MuiMultiInputDateRangeField',
|
|
@@ -49,6 +49,7 @@ const MultiInputDateRangeField = /*#__PURE__*/React.forwardRef(function MultiInp
|
|
|
49
49
|
defaultValue,
|
|
50
50
|
format,
|
|
51
51
|
formatDensity,
|
|
52
|
+
shouldRespectLeadingZeros,
|
|
52
53
|
onChange,
|
|
53
54
|
readOnly,
|
|
54
55
|
disabled,
|
|
@@ -106,6 +107,7 @@ const MultiInputDateRangeField = /*#__PURE__*/React.forwardRef(function MultiInp
|
|
|
106
107
|
defaultValue,
|
|
107
108
|
format,
|
|
108
109
|
formatDensity,
|
|
110
|
+
shouldRespectLeadingZeros,
|
|
109
111
|
onChange,
|
|
110
112
|
readOnly,
|
|
111
113
|
disabled,
|
|
@@ -143,15 +145,20 @@ const MultiInputDateRangeField = /*#__PURE__*/React.forwardRef(function MultiInp
|
|
|
143
145
|
children: [/*#__PURE__*/_jsx(TextField, _extends({
|
|
144
146
|
fullWidth: true
|
|
145
147
|
}, startDateProps, {
|
|
148
|
+
InputProps: _extends({}, startDateProps.InputProps, {
|
|
149
|
+
readOnly: startReadOnly
|
|
150
|
+
}),
|
|
146
151
|
inputProps: _extends({}, startDateProps.inputProps, {
|
|
147
152
|
ref: startInputRef,
|
|
148
|
-
readOnly: startReadOnly,
|
|
149
153
|
inputMode: startInputMode,
|
|
150
154
|
onKeyDown: onStartInputKeyDown
|
|
151
155
|
})
|
|
152
156
|
})), /*#__PURE__*/_jsx(Separator, _extends({}, separatorProps)), /*#__PURE__*/_jsx(TextField, _extends({
|
|
153
157
|
fullWidth: true
|
|
154
158
|
}, endDateProps, {
|
|
159
|
+
InputProps: _extends({}, endDateProps.InputProps, {
|
|
160
|
+
readOnly: endReadOnly
|
|
161
|
+
}),
|
|
155
162
|
inputProps: _extends({}, endDateProps.inputProps, {
|
|
156
163
|
ref: endInputRef,
|
|
157
164
|
readOnly: endReadOnly,
|
|
@@ -275,6 +282,21 @@ process.env.NODE_ENV !== "production" ? MultiInputDateRangeField.propTypes = {
|
|
|
275
282
|
* @returns {boolean} Returns `true` if the date should be disabled.
|
|
276
283
|
*/
|
|
277
284
|
shouldDisableDate: PropTypes.func,
|
|
285
|
+
/**
|
|
286
|
+
* If `true`, the format will respect the leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
|
|
287
|
+
* If `false`, the format will always add leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
|
|
288
|
+
*
|
|
289
|
+
* Warning n°1: Luxon is not able to respect the leading zeroes when using macro tokens (e.g: "DD"), so `shouldRespectLeadingZeros={true}` might lead to inconsistencies when using `AdapterLuxon`.
|
|
290
|
+
*
|
|
291
|
+
* Warning n°2: When `shouldRespectLeadingZeros={true}`, the field will add an invisible character on the sections containing a single digit to make sure `onChange` is fired.
|
|
292
|
+
* If you need to get the clean value from the input, you can remove this character using `input.value.replace(/\u200e/g, '')`.
|
|
293
|
+
*
|
|
294
|
+
* Warning n°3: When used in strict mode, dayjs and moment require to respect the leading zeros.
|
|
295
|
+
* This mean that when using `shouldRespectLeadingZeros={false}`, if you retrieve the value directly from the input (not listening to `onChange`) and your format contains tokens without leading zeros, the value will not be parsed by your library.
|
|
296
|
+
*
|
|
297
|
+
* @default `false`
|
|
298
|
+
*/
|
|
299
|
+
shouldRespectLeadingZeros: PropTypes.bool,
|
|
278
300
|
/**
|
|
279
301
|
* The props used for each component slot.
|
|
280
302
|
* @default {}
|
|
@@ -300,7 +322,7 @@ process.env.NODE_ENV !== "production" ? MultiInputDateRangeField.propTypes = {
|
|
|
300
322
|
/**
|
|
301
323
|
* If `true`, the CSS flexbox `gap` is used instead of applying `margin` to children.
|
|
302
324
|
*
|
|
303
|
-
* While CSS `gap` removes the [known limitations](https://mui.com/joy-ui/react-stack
|
|
325
|
+
* While CSS `gap` removes the [known limitations](https://mui.com/joy-ui/react-stack/#limitations),
|
|
304
326
|
* it is not fully supported in some browsers. We recommend checking https://caniuse.com/?search=flex%20gap before using this flag.
|
|
305
327
|
*
|
|
306
328
|
* To enable this flag globally, follow the [theme's default props](https://mui.com/material-ui/customization/theme-components/#default-props) configuration.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["slots", "slotProps", "components", "componentsProps", "value", "defaultValue", "format", "formatDensity", "onChange", "readOnly", "disabled", "onError", "shouldDisableDate", "minDate", "maxDate", "minTime", "maxTime", "minDateTime", "maxDateTime", "minutesStep", "shouldDisableClock", "shouldDisableTime", "disableFuture", "disablePast", "selectedSections", "onSelectedSectionsChange", "unstableStartFieldRef", "unstableEndFieldRef", "autoFocus"],
|
|
3
|
+
const _excluded = ["slots", "slotProps", "components", "componentsProps", "value", "defaultValue", "format", "formatDensity", "shouldRespectLeadingZeros", "onChange", "readOnly", "disabled", "onError", "shouldDisableDate", "minDate", "maxDate", "minTime", "maxTime", "minDateTime", "maxDateTime", "minutesStep", "shouldDisableClock", "shouldDisableTime", "disableFuture", "disablePast", "selectedSections", "onSelectedSectionsChange", "unstableStartFieldRef", "unstableEndFieldRef", "autoFocus"],
|
|
4
4
|
_excluded2 = ["onKeyDown", "ref", "readOnly", "inputMode"],
|
|
5
5
|
_excluded3 = ["onKeyDown", "ref", "readOnly", "inputMode"];
|
|
6
6
|
import * as React from 'react';
|
|
@@ -27,7 +27,7 @@ const MultiInputDateTimeRangeFieldRoot = styled( /*#__PURE__*/React.forwardRef((
|
|
|
27
27
|
const MultiInputDateTimeRangeFieldSeparator = styled(props => {
|
|
28
28
|
var _props$children;
|
|
29
29
|
return /*#__PURE__*/_jsx(Typography, _extends({}, props, {
|
|
30
|
-
children: (_props$children = props.children) != null ? _props$children : '
|
|
30
|
+
children: (_props$children = props.children) != null ? _props$children : ' – '
|
|
31
31
|
}));
|
|
32
32
|
}, {
|
|
33
33
|
name: 'MuiMultiInputDateTimeRangeField',
|
|
@@ -49,6 +49,7 @@ const MultiInputDateTimeRangeField = /*#__PURE__*/React.forwardRef(function Mult
|
|
|
49
49
|
defaultValue,
|
|
50
50
|
format,
|
|
51
51
|
formatDensity,
|
|
52
|
+
shouldRespectLeadingZeros,
|
|
52
53
|
onChange,
|
|
53
54
|
readOnly,
|
|
54
55
|
disabled,
|
|
@@ -115,6 +116,7 @@ const MultiInputDateTimeRangeField = /*#__PURE__*/React.forwardRef(function Mult
|
|
|
115
116
|
defaultValue,
|
|
116
117
|
format,
|
|
117
118
|
formatDensity,
|
|
119
|
+
shouldRespectLeadingZeros,
|
|
118
120
|
onChange,
|
|
119
121
|
readOnly,
|
|
120
122
|
disabled,
|
|
@@ -161,15 +163,20 @@ const MultiInputDateTimeRangeField = /*#__PURE__*/React.forwardRef(function Mult
|
|
|
161
163
|
children: [/*#__PURE__*/_jsx(TextField, _extends({
|
|
162
164
|
fullWidth: true
|
|
163
165
|
}, startDateProps, {
|
|
166
|
+
InputProps: _extends({}, startDateProps.InputProps, {
|
|
167
|
+
readOnly: startReadOnly
|
|
168
|
+
}),
|
|
164
169
|
inputProps: _extends({}, startDateProps.inputProps, {
|
|
165
170
|
ref: startInputRef,
|
|
166
|
-
readOnly: startReadOnly,
|
|
167
171
|
inputMode: startInputMode,
|
|
168
172
|
onKeyDown: onStartInputKeyDown
|
|
169
173
|
})
|
|
170
174
|
})), /*#__PURE__*/_jsx(Separator, _extends({}, separatorProps)), /*#__PURE__*/_jsx(TextField, _extends({
|
|
171
175
|
fullWidth: true
|
|
172
176
|
}, endDateProps, {
|
|
177
|
+
InputProps: _extends({}, endDateProps.InputProps, {
|
|
178
|
+
readOnly: endReadOnly
|
|
179
|
+
}),
|
|
173
180
|
inputProps: _extends({}, endDateProps.inputProps, {
|
|
174
181
|
ref: endInputRef,
|
|
175
182
|
readOnly: endReadOnly,
|
|
@@ -336,11 +343,27 @@ process.env.NODE_ENV !== "production" ? MultiInputDateTimeRangeField.propTypes =
|
|
|
336
343
|
shouldDisableDate: PropTypes.func,
|
|
337
344
|
/**
|
|
338
345
|
* Disable specific time.
|
|
346
|
+
* @template TDate
|
|
339
347
|
* @param {TDate} value The value to check.
|
|
340
348
|
* @param {TimeView} view The clock type of the timeValue.
|
|
341
349
|
* @returns {boolean} If `true` the time will be disabled.
|
|
342
350
|
*/
|
|
343
351
|
shouldDisableTime: PropTypes.func,
|
|
352
|
+
/**
|
|
353
|
+
* If `true`, the format will respect the leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
|
|
354
|
+
* If `false`, the format will always add leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
|
|
355
|
+
*
|
|
356
|
+
* Warning n°1: Luxon is not able to respect the leading zeroes when using macro tokens (e.g: "DD"), so `shouldRespectLeadingZeros={true}` might lead to inconsistencies when using `AdapterLuxon`.
|
|
357
|
+
*
|
|
358
|
+
* Warning n°2: When `shouldRespectLeadingZeros={true}`, the field will add an invisible character on the sections containing a single digit to make sure `onChange` is fired.
|
|
359
|
+
* If you need to get the clean value from the input, you can remove this character using `input.value.replace(/\u200e/g, '')`.
|
|
360
|
+
*
|
|
361
|
+
* Warning n°3: When used in strict mode, dayjs and moment require to respect the leading zeros.
|
|
362
|
+
* This mean that when using `shouldRespectLeadingZeros={false}`, if you retrieve the value directly from the input (not listening to `onChange`) and your format contains tokens without leading zeros, the value will not be parsed by your library.
|
|
363
|
+
*
|
|
364
|
+
* @default `false`
|
|
365
|
+
*/
|
|
366
|
+
shouldRespectLeadingZeros: PropTypes.bool,
|
|
344
367
|
/**
|
|
345
368
|
* The props used for each component slot.
|
|
346
369
|
* @default {}
|
|
@@ -366,7 +389,7 @@ process.env.NODE_ENV !== "production" ? MultiInputDateTimeRangeField.propTypes =
|
|
|
366
389
|
/**
|
|
367
390
|
* If `true`, the CSS flexbox `gap` is used instead of applying `margin` to children.
|
|
368
391
|
*
|
|
369
|
-
* While CSS `gap` removes the [known limitations](https://mui.com/joy-ui/react-stack
|
|
392
|
+
* While CSS `gap` removes the [known limitations](https://mui.com/joy-ui/react-stack/#limitations),
|
|
370
393
|
* it is not fully supported in some browsers. We recommend checking https://caniuse.com/?search=flex%20gap before using this flag.
|
|
371
394
|
*
|
|
372
395
|
* To enable this flag globally, follow the [theme's default props](https://mui.com/material-ui/customization/theme-components/#default-props) configuration.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["slots", "slotProps", "components", "componentsProps", "value", "defaultValue", "format", "formatDensity", "onChange", "readOnly", "disabled", "onError", "minTime", "maxTime", "minutesStep", "shouldDisableClock", "shouldDisableTime", "disableFuture", "disablePast", "selectedSections", "onSelectedSectionsChange", "unstableStartFieldRef", "unstableEndFieldRef", "autoFocus"],
|
|
3
|
+
const _excluded = ["slots", "slotProps", "components", "componentsProps", "value", "defaultValue", "format", "formatDensity", "shouldRespectLeadingZeros", "onChange", "readOnly", "disabled", "onError", "minTime", "maxTime", "minutesStep", "shouldDisableClock", "shouldDisableTime", "disableFuture", "disablePast", "selectedSections", "onSelectedSectionsChange", "unstableStartFieldRef", "unstableEndFieldRef", "autoFocus"],
|
|
4
4
|
_excluded2 = ["onKeyDown", "ref", "readOnly", "inputMode"],
|
|
5
5
|
_excluded3 = ["onKeyDown", "ref", "readOnly", "inputMode"];
|
|
6
6
|
import * as React from 'react';
|
|
@@ -27,7 +27,7 @@ const MultiInputTimeRangeFieldRoot = styled( /*#__PURE__*/React.forwardRef((prop
|
|
|
27
27
|
const MultiInputTimeRangeFieldSeparator = styled(props => {
|
|
28
28
|
var _props$children;
|
|
29
29
|
return /*#__PURE__*/_jsx(Typography, _extends({}, props, {
|
|
30
|
-
children: (_props$children = props.children) != null ? _props$children : '
|
|
30
|
+
children: (_props$children = props.children) != null ? _props$children : ' – '
|
|
31
31
|
}));
|
|
32
32
|
}, {
|
|
33
33
|
name: 'MuiMultiInputTimeRangeField',
|
|
@@ -49,6 +49,7 @@ const MultiInputTimeRangeField = /*#__PURE__*/React.forwardRef(function MultiInp
|
|
|
49
49
|
defaultValue,
|
|
50
50
|
format,
|
|
51
51
|
formatDensity,
|
|
52
|
+
shouldRespectLeadingZeros,
|
|
52
53
|
onChange,
|
|
53
54
|
readOnly,
|
|
54
55
|
disabled,
|
|
@@ -110,6 +111,7 @@ const MultiInputTimeRangeField = /*#__PURE__*/React.forwardRef(function MultiInp
|
|
|
110
111
|
defaultValue,
|
|
111
112
|
format,
|
|
112
113
|
formatDensity,
|
|
114
|
+
shouldRespectLeadingZeros,
|
|
113
115
|
onChange,
|
|
114
116
|
readOnly,
|
|
115
117
|
disabled,
|
|
@@ -151,15 +153,20 @@ const MultiInputTimeRangeField = /*#__PURE__*/React.forwardRef(function MultiInp
|
|
|
151
153
|
children: [/*#__PURE__*/_jsx(TextField, _extends({
|
|
152
154
|
fullWidth: true
|
|
153
155
|
}, startDateProps, {
|
|
156
|
+
InputProps: _extends({}, startDateProps.InputProps, {
|
|
157
|
+
readOnly: startReadOnly
|
|
158
|
+
}),
|
|
154
159
|
inputProps: _extends({}, startDateProps.inputProps, {
|
|
155
160
|
ref: startInputRef,
|
|
156
|
-
readOnly: startReadOnly,
|
|
157
161
|
inputMode: startInputMode,
|
|
158
162
|
onKeyDown: onStartInputKeyDown
|
|
159
163
|
})
|
|
160
164
|
})), /*#__PURE__*/_jsx(Separator, _extends({}, separatorProps)), /*#__PURE__*/_jsx(TextField, _extends({
|
|
161
165
|
fullWidth: true
|
|
162
166
|
}, endDateProps, {
|
|
167
|
+
InputProps: _extends({}, endDateProps.InputProps, {
|
|
168
|
+
readOnly: endReadOnly
|
|
169
|
+
}),
|
|
163
170
|
inputProps: _extends({}, endDateProps.inputProps, {
|
|
164
171
|
ref: endInputRef,
|
|
165
172
|
readOnly: endReadOnly,
|
|
@@ -302,11 +309,27 @@ process.env.NODE_ENV !== "production" ? MultiInputTimeRangeField.propTypes = {
|
|
|
302
309
|
shouldDisableClock: PropTypes.func,
|
|
303
310
|
/**
|
|
304
311
|
* Disable specific time.
|
|
312
|
+
* @template TDate
|
|
305
313
|
* @param {TDate} value The value to check.
|
|
306
314
|
* @param {TimeView} view The clock type of the timeValue.
|
|
307
315
|
* @returns {boolean} If `true` the time will be disabled.
|
|
308
316
|
*/
|
|
309
317
|
shouldDisableTime: PropTypes.func,
|
|
318
|
+
/**
|
|
319
|
+
* If `true`, the format will respect the leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
|
|
320
|
+
* If `false`, the format will always add leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
|
|
321
|
+
*
|
|
322
|
+
* Warning n°1: Luxon is not able to respect the leading zeroes when using macro tokens (e.g: "DD"), so `shouldRespectLeadingZeros={true}` might lead to inconsistencies when using `AdapterLuxon`.
|
|
323
|
+
*
|
|
324
|
+
* Warning n°2: When `shouldRespectLeadingZeros={true}`, the field will add an invisible character on the sections containing a single digit to make sure `onChange` is fired.
|
|
325
|
+
* If you need to get the clean value from the input, you can remove this character using `input.value.replace(/\u200e/g, '')`.
|
|
326
|
+
*
|
|
327
|
+
* Warning n°3: When used in strict mode, dayjs and moment require to respect the leading zeros.
|
|
328
|
+
* This mean that when using `shouldRespectLeadingZeros={false}`, if you retrieve the value directly from the input (not listening to `onChange`) and your format contains tokens without leading zeros, the value will not be parsed by your library.
|
|
329
|
+
*
|
|
330
|
+
* @default `false`
|
|
331
|
+
*/
|
|
332
|
+
shouldRespectLeadingZeros: PropTypes.bool,
|
|
310
333
|
/**
|
|
311
334
|
* The props used for each component slot.
|
|
312
335
|
* @default {}
|
|
@@ -332,7 +355,7 @@ process.env.NODE_ENV !== "production" ? MultiInputTimeRangeField.propTypes = {
|
|
|
332
355
|
/**
|
|
333
356
|
* If `true`, the CSS flexbox `gap` is used instead of applying `margin` to children.
|
|
334
357
|
*
|
|
335
|
-
* While CSS `gap` removes the [known limitations](https://mui.com/joy-ui/react-stack
|
|
358
|
+
* While CSS `gap` removes the [known limitations](https://mui.com/joy-ui/react-stack/#limitations),
|
|
336
359
|
* it is not fully supported in some browsers. We recommend checking https://caniuse.com/?search=flex%20gap before using this flag.
|
|
337
360
|
*
|
|
338
361
|
* To enable this flag globally, follow the [theme's default props](https://mui.com/material-ui/customization/theme-components/#default-props) configuration.
|
package/README.md
CHANGED
|
@@ -42,15 +42,6 @@ This component has the following peer dependencies that you will need to install
|
|
|
42
42
|
},
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
If you need to use `js-joda`, `date-fns-jalali`, `jalaali`, or `hijri` library, you should be able to find the corresponding date-library from [`@date-io`](https://github.com/dmtrKovalenko/date-io#projects).
|
|
46
|
-
In such a case, you will have to install both the date-library and the corresponding @date-io adapter.
|
|
47
|
-
|
|
48
|
-
```jsx
|
|
49
|
-
// To use moment-jalaali
|
|
50
|
-
npm install moment-jalaali
|
|
51
|
-
npm install @date-io/jalaali
|
|
52
|
-
```
|
|
53
|
-
|
|
54
45
|
After installation completed, you have to set the `dateAdapter` prop of the `LocalizationProvider` accordingly.
|
|
55
46
|
The supported adapters are exported from `@mui/x-date-pickers-pro`.
|
|
56
47
|
|
|
@@ -55,11 +55,13 @@ const SingleInputDateRangeField = /*#__PURE__*/React.forwardRef(function SingleI
|
|
|
55
55
|
return /*#__PURE__*/_jsx(TextField, _extends({
|
|
56
56
|
ref: ref
|
|
57
57
|
}, fieldProps, {
|
|
58
|
+
InputProps: _extends({}, fieldProps.InputProps, {
|
|
59
|
+
readOnly
|
|
60
|
+
}),
|
|
58
61
|
inputProps: _extends({}, fieldProps.inputProps, {
|
|
59
|
-
ref: inputRef,
|
|
60
|
-
onPaste,
|
|
61
62
|
inputMode,
|
|
62
|
-
|
|
63
|
+
onPaste,
|
|
64
|
+
ref: inputRef
|
|
63
65
|
})
|
|
64
66
|
}));
|
|
65
67
|
});
|
|
@@ -204,6 +206,10 @@ process.env.NODE_ENV !== "production" ? SingleInputDateRangeField.propTypes = {
|
|
|
204
206
|
* @param {FieldChangeHandlerContext<TError>} context The context containing the validation result of the current value.
|
|
205
207
|
*/
|
|
206
208
|
onChange: PropTypes.func,
|
|
209
|
+
/**
|
|
210
|
+
* @ignore
|
|
211
|
+
*/
|
|
212
|
+
onClick: PropTypes.func,
|
|
207
213
|
/**
|
|
208
214
|
* Callback fired when the error associated to the current value changes.
|
|
209
215
|
* @template TValue The value type. Will be either the same type as `value` or `null`. Can be in `[start, end]` format in case of range value.
|
|
@@ -250,6 +256,21 @@ process.env.NODE_ENV !== "production" ? SingleInputDateRangeField.propTypes = {
|
|
|
250
256
|
* @returns {boolean} Returns `true` if the date should be disabled.
|
|
251
257
|
*/
|
|
252
258
|
shouldDisableDate: PropTypes.func,
|
|
259
|
+
/**
|
|
260
|
+
* If `true`, the format will respect the leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
|
|
261
|
+
* If `false`, the format will always add leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
|
|
262
|
+
*
|
|
263
|
+
* Warning n°1: Luxon is not able to respect the leading zeroes when using macro tokens (e.g: "DD"), so `shouldRespectLeadingZeros={true}` might lead to inconsistencies when using `AdapterLuxon`.
|
|
264
|
+
*
|
|
265
|
+
* Warning n°2: When `shouldRespectLeadingZeros={true}`, the field will add an invisible character on the sections containing a single digit to make sure `onChange` is fired.
|
|
266
|
+
* If you need to get the clean value from the input, you can remove this character using `input.value.replace(/\u200e/g, '')`.
|
|
267
|
+
*
|
|
268
|
+
* Warning n°3: When used in strict mode, dayjs and moment require to respect the leading zeros.
|
|
269
|
+
* This mean that when using `shouldRespectLeadingZeros={false}`, if you retrieve the value directly from the input (not listening to `onChange`) and your format contains tokens without leading zeros, the value will not be parsed by your library.
|
|
270
|
+
*
|
|
271
|
+
* @default `false`
|
|
272
|
+
*/
|
|
273
|
+
shouldRespectLeadingZeros: PropTypes.bool,
|
|
253
274
|
/**
|
|
254
275
|
* The size of the component.
|
|
255
276
|
*/
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["value", "defaultValue", "format", "formatDensity", "onChange", "readOnly", "onError", "shouldDisableDate", "minDate", "maxDate", "disableFuture", "disablePast", "selectedSections", "onSelectedSectionsChange", "unstableFieldRef"];
|
|
3
|
+
const _excluded = ["value", "defaultValue", "format", "formatDensity", "shouldRespectLeadingZeros", "onChange", "readOnly", "onError", "shouldDisableDate", "minDate", "maxDate", "disableFuture", "disablePast", "selectedSections", "onSelectedSectionsChange", "unstableFieldRef"];
|
|
4
4
|
import { useUtils, useDefaultDates, applyDefaultDate, useField } from '@mui/x-date-pickers/internals';
|
|
5
5
|
import { rangeValueManager, rangeFieldValueManager } from '../internal/utils/valueManagers';
|
|
6
|
-
import { validateDateRange } from '../internal/
|
|
6
|
+
import { validateDateRange } from '../internal/utils/validation/validateDateRange';
|
|
7
7
|
export const useDefaultizedDateRangeFieldProps = props => {
|
|
8
8
|
var _props$disablePast, _props$disableFuture, _props$format;
|
|
9
9
|
const utils = useUtils();
|
|
@@ -26,6 +26,7 @@ export const useSingleInputDateRangeField = ({
|
|
|
26
26
|
defaultValue,
|
|
27
27
|
format,
|
|
28
28
|
formatDensity,
|
|
29
|
+
shouldRespectLeadingZeros,
|
|
29
30
|
onChange,
|
|
30
31
|
readOnly,
|
|
31
32
|
onError,
|
|
@@ -47,6 +48,7 @@ export const useSingleInputDateRangeField = ({
|
|
|
47
48
|
defaultValue,
|
|
48
49
|
format,
|
|
49
50
|
formatDensity,
|
|
51
|
+
shouldRespectLeadingZeros,
|
|
50
52
|
onChange,
|
|
51
53
|
readOnly,
|
|
52
54
|
onError,
|
|
@@ -55,11 +55,13 @@ const SingleInputDateTimeRangeField = /*#__PURE__*/React.forwardRef(function Sin
|
|
|
55
55
|
return /*#__PURE__*/_jsx(TextField, _extends({
|
|
56
56
|
ref: ref
|
|
57
57
|
}, fieldProps, {
|
|
58
|
+
InputProps: _extends({}, fieldProps.InputProps, {
|
|
59
|
+
readOnly
|
|
60
|
+
}),
|
|
58
61
|
inputProps: _extends({}, fieldProps.inputProps, {
|
|
59
|
-
ref: inputRef,
|
|
60
|
-
onPaste,
|
|
61
62
|
inputMode,
|
|
62
|
-
|
|
63
|
+
onPaste,
|
|
64
|
+
ref: inputRef
|
|
63
65
|
})
|
|
64
66
|
}));
|
|
65
67
|
});
|
|
@@ -237,6 +239,10 @@ process.env.NODE_ENV !== "production" ? SingleInputDateTimeRangeField.propTypes
|
|
|
237
239
|
* @param {FieldChangeHandlerContext<TError>} context The context containing the validation result of the current value.
|
|
238
240
|
*/
|
|
239
241
|
onChange: PropTypes.func,
|
|
242
|
+
/**
|
|
243
|
+
* @ignore
|
|
244
|
+
*/
|
|
245
|
+
onClick: PropTypes.func,
|
|
240
246
|
/**
|
|
241
247
|
* Callback fired when the error associated to the current value changes.
|
|
242
248
|
* @template TValue The value type. Will be either the same type as `value` or `null`. Can be in `[start, end]` format in case of range value.
|
|
@@ -293,11 +299,27 @@ process.env.NODE_ENV !== "production" ? SingleInputDateTimeRangeField.propTypes
|
|
|
293
299
|
shouldDisableDate: PropTypes.func,
|
|
294
300
|
/**
|
|
295
301
|
* Disable specific time.
|
|
302
|
+
* @template TDate
|
|
296
303
|
* @param {TDate} value The value to check.
|
|
297
304
|
* @param {TimeView} view The clock type of the timeValue.
|
|
298
305
|
* @returns {boolean} If `true` the time will be disabled.
|
|
299
306
|
*/
|
|
300
307
|
shouldDisableTime: PropTypes.func,
|
|
308
|
+
/**
|
|
309
|
+
* If `true`, the format will respect the leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
|
|
310
|
+
* If `false`, the format will always add leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
|
|
311
|
+
*
|
|
312
|
+
* Warning n°1: Luxon is not able to respect the leading zeroes when using macro tokens (e.g: "DD"), so `shouldRespectLeadingZeros={true}` might lead to inconsistencies when using `AdapterLuxon`.
|
|
313
|
+
*
|
|
314
|
+
* Warning n°2: When `shouldRespectLeadingZeros={true}`, the field will add an invisible character on the sections containing a single digit to make sure `onChange` is fired.
|
|
315
|
+
* If you need to get the clean value from the input, you can remove this character using `input.value.replace(/\u200e/g, '')`.
|
|
316
|
+
*
|
|
317
|
+
* Warning n°3: When used in strict mode, dayjs and moment require to respect the leading zeros.
|
|
318
|
+
* This mean that when using `shouldRespectLeadingZeros={false}`, if you retrieve the value directly from the input (not listening to `onChange`) and your format contains tokens without leading zeros, the value will not be parsed by your library.
|
|
319
|
+
*
|
|
320
|
+
* @default `false`
|
|
321
|
+
*/
|
|
322
|
+
shouldRespectLeadingZeros: PropTypes.bool,
|
|
301
323
|
/**
|
|
302
324
|
* The size of the component.
|
|
303
325
|
*/
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["value", "defaultValue", "format", "formatDensity", "onChange", "readOnly", "onError", "shouldDisableDate", "minDate", "maxDate", "disableFuture", "disablePast", "minTime", "maxTime", "minDateTime", "maxDateTime", "minutesStep", "shouldDisableTime", "disableIgnoringDatePartForTimeValidation", "selectedSections", "onSelectedSectionsChange", "unstableFieldRef"];
|
|
3
|
+
const _excluded = ["value", "defaultValue", "format", "formatDensity", "shouldRespectLeadingZeros", "onChange", "readOnly", "onError", "shouldDisableDate", "minDate", "maxDate", "disableFuture", "disablePast", "minTime", "maxTime", "minDateTime", "maxDateTime", "minutesStep", "shouldDisableTime", "disableIgnoringDatePartForTimeValidation", "selectedSections", "onSelectedSectionsChange", "unstableFieldRef"];
|
|
4
4
|
import { useUtils, useField, applyDefaultDate, useDefaultDates } from '@mui/x-date-pickers/internals';
|
|
5
5
|
import { rangeValueManager, rangeFieldValueManager } from '../internal/utils/valueManagers';
|
|
6
|
-
import { validateDateTimeRange } from '../internal/
|
|
6
|
+
import { validateDateTimeRange } from '../internal/utils/validation/validateDateTimeRange';
|
|
7
7
|
export const useDefaultizedTimeRangeFieldProps = props => {
|
|
8
8
|
var _props$ampm, _props$disablePast, _props$disableFuture, _props$format, _props$minDateTime, _props$maxDateTime, _props$minDateTime2, _props$maxDateTime2;
|
|
9
9
|
const utils = useUtils();
|
|
@@ -31,6 +31,7 @@ export const useSingleInputDateTimeRangeField = ({
|
|
|
31
31
|
defaultValue,
|
|
32
32
|
format,
|
|
33
33
|
formatDensity,
|
|
34
|
+
shouldRespectLeadingZeros,
|
|
34
35
|
onChange,
|
|
35
36
|
readOnly,
|
|
36
37
|
onError,
|
|
@@ -57,6 +58,7 @@ export const useSingleInputDateTimeRangeField = ({
|
|
|
57
58
|
defaultValue,
|
|
58
59
|
format,
|
|
59
60
|
formatDensity,
|
|
61
|
+
shouldRespectLeadingZeros,
|
|
60
62
|
onChange,
|
|
61
63
|
readOnly,
|
|
62
64
|
onError,
|