@mui/x-date-pickers-pro 6.2.1 → 6.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +70 -1
- 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 +20 -3
- package/SingleInputDateRangeField/useSingleInputDateRangeField.js +4 -2
- package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +21 -3
- package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +4 -2
- package/SingleInputTimeRangeField/SingleInputTimeRangeField.js +21 -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 +1 -1
- 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/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 +20 -3
- package/legacy/SingleInputDateRangeField/useSingleInputDateRangeField.js +4 -2
- package/legacy/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +21 -3
- package/legacy/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +4 -2
- package/legacy/SingleInputTimeRangeField/SingleInputTimeRangeField.js +21 -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/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 +20 -3
- package/modern/SingleInputDateRangeField/useSingleInputDateRangeField.js +4 -2
- package/modern/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +21 -3
- package/modern/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +4 -2
- package/modern/SingleInputTimeRangeField/SingleInputTimeRangeField.js +21 -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/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 +20 -3
- package/node/SingleInputDateRangeField/useSingleInputDateRangeField.js +5 -3
- package/node/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +21 -3
- package/node/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +5 -3
- package/node/SingleInputTimeRangeField/SingleInputTimeRangeField.js +21 -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/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,75 @@
|
|
|
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.0
|
|
7
|
+
|
|
8
|
+
_Apr 28, 2023_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 15 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🚀 New [time-picking UI](https://mui.com/x/react-date-pickers/digital-clock/) designed for desktops (#7958) @LukasTy
|
|
13
|
+
|
|
14
|
+
<img src="https://user-images.githubusercontent.com/4941090/235072007-de39a397-e4a4-4c98-8e10-5ee4ad440108.gif" width="494" />
|
|
15
|
+
|
|
16
|
+
- ✨ 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
|
|
17
|
+
- 🌍 Improve Chinese (zh-CN), French (fr-FR), and Turkish (tr-TR) locales
|
|
18
|
+
- 🐞 Bugfixes
|
|
19
|
+
- 📚 Documentation improvements
|
|
20
|
+
|
|
21
|
+
### `@mui/x-data-grid@v6.3.0` / `@mui/x-data-grid-pro@v6.3.0` / `@mui/x-data-grid-premium@v6.3.0`
|
|
22
|
+
|
|
23
|
+
#### Changes
|
|
24
|
+
|
|
25
|
+
- [DataGrid] Add overlay classes to `gridClasses` (#8686) @lindapaiste
|
|
26
|
+
- [DataGrid] Avoid passing `api` prop to div (#8679) @someden
|
|
27
|
+
- [DataGrid] Fix 'ResizeObserver loop limit exceeded' error (#8744) @m4theushw
|
|
28
|
+
- [DataGrid] Add Joy UI slots (button and switch) (#8699) @siriwatknp
|
|
29
|
+
- [DataGrid] Fix aggregation label alignment (#8694) @joserodolfofreitas
|
|
30
|
+
- [DataGridPremium] Fix infinite loop when updating grouped rows (#8693) @cherniavskii
|
|
31
|
+
- [DataGridPro] Fix error after updating `columns` and `columnGroupingModel` at once (#8730) @cherniavskii
|
|
32
|
+
- [l10n] Improve Chinese (zh-CN) locale (#8753) @SakumyZ
|
|
33
|
+
- [l10n] Improve French (fr-FR) locale (#8704) @Jul13nT
|
|
34
|
+
- [l10n] Improve Turkish (tr-TR) locale (#8783) @cccaaannn
|
|
35
|
+
|
|
36
|
+
### `@mui/x-date-pickers@v6.3.0` / `@mui/x-date-pickers-pro@v6.3.0`
|
|
37
|
+
|
|
38
|
+
#### Changes
|
|
39
|
+
|
|
40
|
+
- [fields] Always add leading zeroes on digit sections (#8527) @flaviendelangle
|
|
41
|
+
- [fields] Pass the `readOnly` prop to `InputProps` instead of `inputProps` (#8659) @flaviendelangle
|
|
42
|
+
- [pickers] Add missing export for `caES` locale (#8782) @flaviendelangle
|
|
43
|
+
- [pickers] Add new `DigitalClock` desktop time picking experience (#7958) @LukasTy
|
|
44
|
+
- [pickers] Do not use `instanceOf DateTime` in `AdapterLuxon` (#8734) @flaviendelangle
|
|
45
|
+
- [pickers] Fix date calendar `selected` & `disabled` day style (#8773) @LukasTy
|
|
46
|
+
- [pickers] Migrate `AdapterDateFns` to our repository (#8736) @flaviendelangle
|
|
47
|
+
- [pickers] Migrate `AdapterLuxon` to our repository (#8600) @flaviendelangle
|
|
48
|
+
- [pickers] Migrate `AdapterMomentHijri` to our repository (#8776) @flaviendelangle
|
|
49
|
+
- [pickers] Migrate `AdapterMomentJalaali` and `AdapterDateFnsJalali` to our repository (#8741) @flaviendelangle
|
|
50
|
+
- [pickers] Migrate `AdapterMoment` to our repository (#8700) @flaviendelangle
|
|
51
|
+
- [pickers] Refactor the validation files (#8622) @flaviendelangle
|
|
52
|
+
- [pickers] Use `en dash` instead of `em dash` in multi input range fields (#8738) @flaviendelangle
|
|
53
|
+
- [l10n] Improve Chinese (zh-CN) locale (#8753) @SakumyZ
|
|
54
|
+
- [l10n] Improve Turkish (tr-TR) locale (#8783) @cccaaannn
|
|
55
|
+
|
|
56
|
+
### Docs
|
|
57
|
+
|
|
58
|
+
- [docs] Add icons for charts menu (#8752) @alexfauquette
|
|
59
|
+
- [docs] Document the supported formats (#8746) @flaviendelangle
|
|
60
|
+
- [docs] Fix Hijri demo (#8698) @alexfauquette
|
|
61
|
+
- [docs] Fix `x-codemod` package version in changelog (#8690) @MBilalShafi
|
|
62
|
+
- [docs] Fix columns special properties code example (#8414) @mikkelhl
|
|
63
|
+
- [docs] Fix error in `minDateTime` `validation` page section (#8777) @LukasTy
|
|
64
|
+
- [docs] Update custom field pickers using theme scoping (#8609) @siriwatknp
|
|
65
|
+
- [docs] Use community version of data grid for column grouping demo (#7346) @ASchwad
|
|
66
|
+
- [docs] Use new `slots` / `slotProps` props in the pickers migration guide (#8341) @flaviendelangle
|
|
67
|
+
|
|
68
|
+
### Core
|
|
69
|
+
|
|
70
|
+
- [core] Cleanup picker tests (#8652) @flaviendelangle
|
|
71
|
+
- [core] Use `adapter.lib` instead of `adapterName` in `describeAdapters` (#8779) @flaviendelangle
|
|
72
|
+
- [charts] Adapt line and scatter plot to the "band" scale type (#8701) @alexfauquette
|
|
73
|
+
- [charts] Link the Gantt Charts issue in the docs (#8739) @flaviendelangle
|
|
74
|
+
|
|
6
75
|
## 6.2.1
|
|
7
76
|
|
|
8
77
|
_Apr 20, 2023_
|
|
@@ -31,7 +100,7 @@ We'd like to offer a big thanks to the 9 contributors who made this release poss
|
|
|
31
100
|
- [pickers] Do not include the time in date components when going to today (#8657) @flaviendelangle
|
|
32
101
|
- [pickers] Sync internal state with controlled value (#8674) @alexfauquette
|
|
33
102
|
|
|
34
|
-
### `@mui/x-codemod@v6.
|
|
103
|
+
### `@mui/x-codemod@v6.2.1`
|
|
35
104
|
|
|
36
105
|
#### Changes
|
|
37
106
|
|
|
@@ -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
|
});
|
|
@@ -250,6 +252,21 @@ process.env.NODE_ENV !== "production" ? SingleInputDateRangeField.propTypes = {
|
|
|
250
252
|
* @returns {boolean} Returns `true` if the date should be disabled.
|
|
251
253
|
*/
|
|
252
254
|
shouldDisableDate: PropTypes.func,
|
|
255
|
+
/**
|
|
256
|
+
* If `true`, the format will respect the leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
|
|
257
|
+
* If `false`, the format will always add leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
|
|
258
|
+
*
|
|
259
|
+
* 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`.
|
|
260
|
+
*
|
|
261
|
+
* 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.
|
|
262
|
+
* If you need to get the clean value from the input, you can remove this character using `input.value.replace(/\u200e/g, '')`.
|
|
263
|
+
*
|
|
264
|
+
* Warning n°3: When used in strict mode, dayjs and moment require to respect the leading zeros.
|
|
265
|
+
* 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.
|
|
266
|
+
*
|
|
267
|
+
* @default `false`
|
|
268
|
+
*/
|
|
269
|
+
shouldRespectLeadingZeros: PropTypes.bool,
|
|
253
270
|
/**
|
|
254
271
|
* The size of the component.
|
|
255
272
|
*/
|
|
@@ -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
|
});
|
|
@@ -293,11 +295,27 @@ process.env.NODE_ENV !== "production" ? SingleInputDateTimeRangeField.propTypes
|
|
|
293
295
|
shouldDisableDate: PropTypes.func,
|
|
294
296
|
/**
|
|
295
297
|
* Disable specific time.
|
|
298
|
+
* @template TDate
|
|
296
299
|
* @param {TDate} value The value to check.
|
|
297
300
|
* @param {TimeView} view The clock type of the timeValue.
|
|
298
301
|
* @returns {boolean} If `true` the time will be disabled.
|
|
299
302
|
*/
|
|
300
303
|
shouldDisableTime: PropTypes.func,
|
|
304
|
+
/**
|
|
305
|
+
* If `true`, the format will respect the leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
|
|
306
|
+
* If `false`, the format will always add leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
|
|
307
|
+
*
|
|
308
|
+
* 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`.
|
|
309
|
+
*
|
|
310
|
+
* 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.
|
|
311
|
+
* If you need to get the clean value from the input, you can remove this character using `input.value.replace(/\u200e/g, '')`.
|
|
312
|
+
*
|
|
313
|
+
* Warning n°3: When used in strict mode, dayjs and moment require to respect the leading zeros.
|
|
314
|
+
* 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.
|
|
315
|
+
*
|
|
316
|
+
* @default `false`
|
|
317
|
+
*/
|
|
318
|
+
shouldRespectLeadingZeros: PropTypes.bool,
|
|
301
319
|
/**
|
|
302
320
|
* The size of the component.
|
|
303
321
|
*/
|
|
@@ -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,
|
|
@@ -55,11 +55,13 @@ const SingleInputTimeRangeField = /*#__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
|
});
|
|
@@ -269,11 +271,27 @@ process.env.NODE_ENV !== "production" ? SingleInputTimeRangeField.propTypes = {
|
|
|
269
271
|
shouldDisableClock: PropTypes.func,
|
|
270
272
|
/**
|
|
271
273
|
* Disable specific time.
|
|
274
|
+
* @template TDate
|
|
272
275
|
* @param {TDate} value The value to check.
|
|
273
276
|
* @param {TimeView} view The clock type of the timeValue.
|
|
274
277
|
* @returns {boolean} If `true` the time will be disabled.
|
|
275
278
|
*/
|
|
276
279
|
shouldDisableTime: PropTypes.func,
|
|
280
|
+
/**
|
|
281
|
+
* If `true`, the format will respect the leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
|
|
282
|
+
* If `false`, the format will always add leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
|
|
283
|
+
*
|
|
284
|
+
* 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`.
|
|
285
|
+
*
|
|
286
|
+
* 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.
|
|
287
|
+
* If you need to get the clean value from the input, you can remove this character using `input.value.replace(/\u200e/g, '')`.
|
|
288
|
+
*
|
|
289
|
+
* Warning n°3: When used in strict mode, dayjs and moment require to respect the leading zeros.
|
|
290
|
+
* 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.
|
|
291
|
+
*
|
|
292
|
+
* @default `false`
|
|
293
|
+
*/
|
|
294
|
+
shouldRespectLeadingZeros: PropTypes.bool,
|
|
277
295
|
/**
|
|
278
296
|
* The size of the component.
|
|
279
297
|
*/
|
|
@@ -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", "minTime", "maxTime", "minutesStep", "shouldDisableTime", "disableFuture", "disablePast", "selectedSections", "onSelectedSectionsChange", "unstableFieldRef"];
|
|
3
|
+
const _excluded = ["value", "defaultValue", "format", "formatDensity", "shouldRespectLeadingZeros", "onChange", "readOnly", "onError", "minTime", "maxTime", "minutesStep", "shouldDisableTime", "disableFuture", "disablePast", "selectedSections", "onSelectedSectionsChange", "unstableFieldRef"];
|
|
4
4
|
import { useUtils, useField } from '@mui/x-date-pickers/internals';
|
|
5
5
|
import { rangeValueManager, rangeFieldValueManager } from '../internal/utils/valueManagers';
|
|
6
|
-
import { validateTimeRange } from '../internal/
|
|
6
|
+
import { validateTimeRange } from '../internal/utils/validation/validateTimeRange';
|
|
7
7
|
export const useDefaultizedTimeRangeFieldProps = props => {
|
|
8
8
|
var _props$ampm, _props$disablePast, _props$disableFuture, _props$format;
|
|
9
9
|
const utils = useUtils();
|
|
@@ -25,6 +25,7 @@ export const useSingleInputTimeRangeField = ({
|
|
|
25
25
|
defaultValue,
|
|
26
26
|
format,
|
|
27
27
|
formatDensity,
|
|
28
|
+
shouldRespectLeadingZeros,
|
|
28
29
|
onChange,
|
|
29
30
|
readOnly,
|
|
30
31
|
onError,
|
|
@@ -47,6 +48,7 @@ export const useSingleInputTimeRangeField = ({
|
|
|
47
48
|
defaultValue,
|
|
48
49
|
format,
|
|
49
50
|
formatDensity,
|
|
51
|
+
shouldRespectLeadingZeros,
|
|
50
52
|
onChange,
|
|
51
53
|
readOnly,
|
|
52
54
|
onError,
|
|
@@ -5,7 +5,7 @@ import { useStaticRangePicker } from '../internal/hooks/useStaticRangePicker';
|
|
|
5
5
|
import { useDateRangePickerDefaultizedProps } from '../DateRangePicker/shared';
|
|
6
6
|
import { renderDateRangeViewCalendar } from '../dateRangeViewRenderers';
|
|
7
7
|
import { rangeValueManager } from '../internal/utils/valueManagers';
|
|
8
|
-
import { validateDateRange } from '../internal/
|
|
8
|
+
import { validateDateRange } from '../internal/utils/validation/validateDateRange';
|
|
9
9
|
const StaticDateRangePicker = /*#__PURE__*/React.forwardRef(function StaticDateRangePicker(inProps, ref) {
|
|
10
10
|
var _defaultizedProps$dis, _defaultizedProps$cal, _defaultizedProps$slo;
|
|
11
11
|
const defaultizedProps = useDateRangePickerDefaultizedProps(inProps, 'MuiStaticDateRangePicker');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals/models';
|
|
3
3
|
import { DateRangeCalendarProps } from '../DateRangeCalendar';
|
|
4
|
-
export interface DateRangeViewRendererProps<TDate, TView extends
|
|
4
|
+
export interface DateRangeViewRendererProps<TDate, TView extends DateOrTimeViewWithMeridiem> extends DateRangeCalendarProps<TDate> {
|
|
5
5
|
view: TView;
|
|
6
6
|
onViewChange?: (view: TView) => void;
|
|
7
7
|
views: readonly TView[];
|