@mui/x-date-pickers-pro 6.2.0 → 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 +118 -1
- package/DateRangePicker/shared.d.ts +1 -1
- package/DesktopDateRangePicker/DesktopDateRangePicker.js +2 -1
- package/MobileDateRangePicker/MobileDateRangePicker.js +2 -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 +2 -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.js +9 -9
- 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.js +9 -9
- 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.js +10 -10
- 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/internal/utils/valueManagers.js +1 -1
- package/legacy/DesktopDateRangePicker/DesktopDateRangePicker.js +2 -1
- package/legacy/MobileDateRangePicker/MobileDateRangePicker.js +2 -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 +2 -1
- package/legacy/index.js +3 -2
- package/legacy/internal/hooks/useDesktopRangePicker/useDesktopRangePicker.js +5 -6
- package/legacy/internal/hooks/useMobileRangePicker/useMobileRangePicker.js +5 -6
- 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/hooks/useStaticRangePicker/useStaticRangePicker.js +6 -7
- 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 +2 -2
- 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 +2 -1
- package/modern/MobileDateRangePicker/MobileDateRangePicker.js +2 -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 +2 -1
- package/modern/index.js +3 -2
- package/modern/internal/hooks/useDesktopRangePicker/useDesktopRangePicker.js +9 -9
- package/modern/internal/hooks/useMobileRangePicker/useMobileRangePicker.js +9 -9
- 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/hooks/useStaticRangePicker/useStaticRangePicker.js +10 -10
- 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 +3 -2
- package/node/MobileDateRangePicker/MobileDateRangePicker.js +3 -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 +3 -2
- package/node/index.js +13 -1
- package/node/internal/hooks/useDesktopRangePicker/useDesktopRangePicker.js +9 -9
- package/node/internal/hooks/useMobileRangePicker/useMobileRangePicker.js +9 -9
- 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/hooks/useStaticRangePicker/useStaticRangePicker.js +10 -10
- 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
|
@@ -17,7 +17,7 @@ var _utils = require("@mui/base/utils");
|
|
|
17
17
|
var _internals = require("@mui/x-date-pickers/internals");
|
|
18
18
|
var _useMultiInputDateRangeField = require("../internal/hooks/useMultiInputRangeField/useMultiInputDateRangeField");
|
|
19
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
|
-
const _excluded = ["slots", "slotProps", "components", "componentsProps", "value", "defaultValue", "format", "formatDensity", "onChange", "readOnly", "disabled", "onError", "shouldDisableDate", "minDate", "maxDate", "disableFuture", "disablePast", "selectedSections", "onSelectedSectionsChange", "autoFocus"],
|
|
20
|
+
const _excluded = ["slots", "slotProps", "components", "componentsProps", "value", "defaultValue", "format", "formatDensity", "shouldRespectLeadingZeros", "onChange", "readOnly", "disabled", "onError", "shouldDisableDate", "minDate", "maxDate", "disableFuture", "disablePast", "selectedSections", "onSelectedSectionsChange", "autoFocus"],
|
|
21
21
|
_excluded2 = ["onKeyDown", "ref", "readOnly", "inputMode"],
|
|
22
22
|
_excluded3 = ["onKeyDown", "ref", "readOnly", "inputMode"];
|
|
23
23
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -33,7 +33,7 @@ const MultiInputDateRangeFieldRoot = (0, _styles.styled)( /*#__PURE__*/React.for
|
|
|
33
33
|
overridesResolver: (props, styles) => styles.root
|
|
34
34
|
})({});
|
|
35
35
|
const MultiInputDateRangeFieldSeparator = (0, _styles.styled)(props => /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, (0, _extends2.default)({}, props, {
|
|
36
|
-
children: props.children ?? '
|
|
36
|
+
children: props.children ?? ' – '
|
|
37
37
|
})), {
|
|
38
38
|
name: 'MuiMultiInputDateRangeField',
|
|
39
39
|
slot: 'Separator',
|
|
@@ -53,6 +53,7 @@ const MultiInputDateRangeField = /*#__PURE__*/React.forwardRef(function MultiInp
|
|
|
53
53
|
defaultValue,
|
|
54
54
|
format,
|
|
55
55
|
formatDensity,
|
|
56
|
+
shouldRespectLeadingZeros,
|
|
56
57
|
onChange,
|
|
57
58
|
readOnly,
|
|
58
59
|
disabled,
|
|
@@ -110,6 +111,7 @@ const MultiInputDateRangeField = /*#__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,
|
|
@@ -147,15 +149,20 @@ const MultiInputDateRangeField = /*#__PURE__*/React.forwardRef(function MultiInp
|
|
|
147
149
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(TextField, (0, _extends2.default)({
|
|
148
150
|
fullWidth: true
|
|
149
151
|
}, startDateProps, {
|
|
152
|
+
InputProps: (0, _extends2.default)({}, startDateProps.InputProps, {
|
|
153
|
+
readOnly: startReadOnly
|
|
154
|
+
}),
|
|
150
155
|
inputProps: (0, _extends2.default)({}, startDateProps.inputProps, {
|
|
151
156
|
ref: startInputRef,
|
|
152
|
-
readOnly: startReadOnly,
|
|
153
157
|
inputMode: startInputMode,
|
|
154
158
|
onKeyDown: onStartInputKeyDown
|
|
155
159
|
})
|
|
156
160
|
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(Separator, (0, _extends2.default)({}, separatorProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(TextField, (0, _extends2.default)({
|
|
157
161
|
fullWidth: true
|
|
158
162
|
}, endDateProps, {
|
|
163
|
+
InputProps: (0, _extends2.default)({}, endDateProps.InputProps, {
|
|
164
|
+
readOnly: endReadOnly
|
|
165
|
+
}),
|
|
159
166
|
inputProps: (0, _extends2.default)({}, endDateProps.inputProps, {
|
|
160
167
|
ref: endInputRef,
|
|
161
168
|
readOnly: endReadOnly,
|
|
@@ -280,6 +287,21 @@ process.env.NODE_ENV !== "production" ? MultiInputDateRangeField.propTypes = {
|
|
|
280
287
|
* @returns {boolean} Returns `true` if the date should be disabled.
|
|
281
288
|
*/
|
|
282
289
|
shouldDisableDate: _propTypes.default.func,
|
|
290
|
+
/**
|
|
291
|
+
* If `true`, the format will respect the leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
|
|
292
|
+
* If `false`, the format will always add leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
|
|
293
|
+
*
|
|
294
|
+
* 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`.
|
|
295
|
+
*
|
|
296
|
+
* 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.
|
|
297
|
+
* If you need to get the clean value from the input, you can remove this character using `input.value.replace(/\u200e/g, '')`.
|
|
298
|
+
*
|
|
299
|
+
* Warning n°3: When used in strict mode, dayjs and moment require to respect the leading zeros.
|
|
300
|
+
* 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.
|
|
301
|
+
*
|
|
302
|
+
* @default `false`
|
|
303
|
+
*/
|
|
304
|
+
shouldRespectLeadingZeros: _propTypes.default.bool,
|
|
283
305
|
/**
|
|
284
306
|
* The props used for each component slot.
|
|
285
307
|
* @default {}
|
|
@@ -305,7 +327,7 @@ process.env.NODE_ENV !== "production" ? MultiInputDateRangeField.propTypes = {
|
|
|
305
327
|
/**
|
|
306
328
|
* If `true`, the CSS flexbox `gap` is used instead of applying `margin` to children.
|
|
307
329
|
*
|
|
308
|
-
* While CSS `gap` removes the [known limitations](https://mui.com/joy-ui/react-stack
|
|
330
|
+
* While CSS `gap` removes the [known limitations](https://mui.com/joy-ui/react-stack/#limitations),
|
|
309
331
|
* it is not fully supported in some browsers. We recommend checking https://caniuse.com/?search=flex%20gap before using this flag.
|
|
310
332
|
*
|
|
311
333
|
* To enable this flag globally, follow the [theme's default props](https://mui.com/material-ui/customization/theme-components/#default-props) configuration.
|
|
@@ -17,7 +17,7 @@ var _utils = require("@mui/base/utils");
|
|
|
17
17
|
var _internals = require("@mui/x-date-pickers/internals");
|
|
18
18
|
var _useMultiInputDateTimeRangeField = require("../internal/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField");
|
|
19
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
|
-
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"],
|
|
20
|
+
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"],
|
|
21
21
|
_excluded2 = ["onKeyDown", "ref", "readOnly", "inputMode"],
|
|
22
22
|
_excluded3 = ["onKeyDown", "ref", "readOnly", "inputMode"];
|
|
23
23
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -33,7 +33,7 @@ const MultiInputDateTimeRangeFieldRoot = (0, _styles.styled)( /*#__PURE__*/React
|
|
|
33
33
|
overridesResolver: (props, styles) => styles.root
|
|
34
34
|
})({});
|
|
35
35
|
const MultiInputDateTimeRangeFieldSeparator = (0, _styles.styled)(props => /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, (0, _extends2.default)({}, props, {
|
|
36
|
-
children: props.children ?? '
|
|
36
|
+
children: props.children ?? ' – '
|
|
37
37
|
})), {
|
|
38
38
|
name: 'MuiMultiInputDateTimeRangeField',
|
|
39
39
|
slot: 'Separator',
|
|
@@ -53,6 +53,7 @@ const MultiInputDateTimeRangeField = /*#__PURE__*/React.forwardRef(function Mult
|
|
|
53
53
|
defaultValue,
|
|
54
54
|
format,
|
|
55
55
|
formatDensity,
|
|
56
|
+
shouldRespectLeadingZeros,
|
|
56
57
|
onChange,
|
|
57
58
|
readOnly,
|
|
58
59
|
disabled,
|
|
@@ -119,6 +120,7 @@ const MultiInputDateTimeRangeField = /*#__PURE__*/React.forwardRef(function Mult
|
|
|
119
120
|
defaultValue,
|
|
120
121
|
format,
|
|
121
122
|
formatDensity,
|
|
123
|
+
shouldRespectLeadingZeros,
|
|
122
124
|
onChange,
|
|
123
125
|
readOnly,
|
|
124
126
|
disabled,
|
|
@@ -165,15 +167,20 @@ const MultiInputDateTimeRangeField = /*#__PURE__*/React.forwardRef(function Mult
|
|
|
165
167
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(TextField, (0, _extends2.default)({
|
|
166
168
|
fullWidth: true
|
|
167
169
|
}, startDateProps, {
|
|
170
|
+
InputProps: (0, _extends2.default)({}, startDateProps.InputProps, {
|
|
171
|
+
readOnly: startReadOnly
|
|
172
|
+
}),
|
|
168
173
|
inputProps: (0, _extends2.default)({}, startDateProps.inputProps, {
|
|
169
174
|
ref: startInputRef,
|
|
170
|
-
readOnly: startReadOnly,
|
|
171
175
|
inputMode: startInputMode,
|
|
172
176
|
onKeyDown: onStartInputKeyDown
|
|
173
177
|
})
|
|
174
178
|
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(Separator, (0, _extends2.default)({}, separatorProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(TextField, (0, _extends2.default)({
|
|
175
179
|
fullWidth: true
|
|
176
180
|
}, endDateProps, {
|
|
181
|
+
InputProps: (0, _extends2.default)({}, endDateProps.InputProps, {
|
|
182
|
+
readOnly: endReadOnly
|
|
183
|
+
}),
|
|
177
184
|
inputProps: (0, _extends2.default)({}, endDateProps.inputProps, {
|
|
178
185
|
ref: endInputRef,
|
|
179
186
|
readOnly: endReadOnly,
|
|
@@ -341,11 +348,27 @@ process.env.NODE_ENV !== "production" ? MultiInputDateTimeRangeField.propTypes =
|
|
|
341
348
|
shouldDisableDate: _propTypes.default.func,
|
|
342
349
|
/**
|
|
343
350
|
* Disable specific time.
|
|
351
|
+
* @template TDate
|
|
344
352
|
* @param {TDate} value The value to check.
|
|
345
353
|
* @param {TimeView} view The clock type of the timeValue.
|
|
346
354
|
* @returns {boolean} If `true` the time will be disabled.
|
|
347
355
|
*/
|
|
348
356
|
shouldDisableTime: _propTypes.default.func,
|
|
357
|
+
/**
|
|
358
|
+
* If `true`, the format will respect the leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
|
|
359
|
+
* If `false`, the format will always add leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
|
|
360
|
+
*
|
|
361
|
+
* 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`.
|
|
362
|
+
*
|
|
363
|
+
* 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.
|
|
364
|
+
* If you need to get the clean value from the input, you can remove this character using `input.value.replace(/\u200e/g, '')`.
|
|
365
|
+
*
|
|
366
|
+
* Warning n°3: When used in strict mode, dayjs and moment require to respect the leading zeros.
|
|
367
|
+
* 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.
|
|
368
|
+
*
|
|
369
|
+
* @default `false`
|
|
370
|
+
*/
|
|
371
|
+
shouldRespectLeadingZeros: _propTypes.default.bool,
|
|
349
372
|
/**
|
|
350
373
|
* The props used for each component slot.
|
|
351
374
|
* @default {}
|
|
@@ -371,7 +394,7 @@ process.env.NODE_ENV !== "production" ? MultiInputDateTimeRangeField.propTypes =
|
|
|
371
394
|
/**
|
|
372
395
|
* If `true`, the CSS flexbox `gap` is used instead of applying `margin` to children.
|
|
373
396
|
*
|
|
374
|
-
* While CSS `gap` removes the [known limitations](https://mui.com/joy-ui/react-stack
|
|
397
|
+
* While CSS `gap` removes the [known limitations](https://mui.com/joy-ui/react-stack/#limitations),
|
|
375
398
|
* it is not fully supported in some browsers. We recommend checking https://caniuse.com/?search=flex%20gap before using this flag.
|
|
376
399
|
*
|
|
377
400
|
* To enable this flag globally, follow the [theme's default props](https://mui.com/material-ui/customization/theme-components/#default-props) configuration.
|
|
@@ -17,7 +17,7 @@ var _utils = require("@mui/base/utils");
|
|
|
17
17
|
var _internals = require("@mui/x-date-pickers/internals");
|
|
18
18
|
var _useMultiInputTimeRangeField = require("../internal/hooks/useMultiInputRangeField/useMultiInputTimeRangeField");
|
|
19
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
|
-
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"],
|
|
20
|
+
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"],
|
|
21
21
|
_excluded2 = ["onKeyDown", "ref", "readOnly", "inputMode"],
|
|
22
22
|
_excluded3 = ["onKeyDown", "ref", "readOnly", "inputMode"];
|
|
23
23
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -33,7 +33,7 @@ const MultiInputTimeRangeFieldRoot = (0, _styles.styled)( /*#__PURE__*/React.for
|
|
|
33
33
|
overridesResolver: (props, styles) => styles.root
|
|
34
34
|
})({});
|
|
35
35
|
const MultiInputTimeRangeFieldSeparator = (0, _styles.styled)(props => /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, (0, _extends2.default)({}, props, {
|
|
36
|
-
children: props.children ?? '
|
|
36
|
+
children: props.children ?? ' – '
|
|
37
37
|
})), {
|
|
38
38
|
name: 'MuiMultiInputTimeRangeField',
|
|
39
39
|
slot: 'Separator',
|
|
@@ -53,6 +53,7 @@ const MultiInputTimeRangeField = /*#__PURE__*/React.forwardRef(function MultiInp
|
|
|
53
53
|
defaultValue,
|
|
54
54
|
format,
|
|
55
55
|
formatDensity,
|
|
56
|
+
shouldRespectLeadingZeros,
|
|
56
57
|
onChange,
|
|
57
58
|
readOnly,
|
|
58
59
|
disabled,
|
|
@@ -114,6 +115,7 @@ const MultiInputTimeRangeField = /*#__PURE__*/React.forwardRef(function MultiInp
|
|
|
114
115
|
defaultValue,
|
|
115
116
|
format,
|
|
116
117
|
formatDensity,
|
|
118
|
+
shouldRespectLeadingZeros,
|
|
117
119
|
onChange,
|
|
118
120
|
readOnly,
|
|
119
121
|
disabled,
|
|
@@ -155,15 +157,20 @@ const MultiInputTimeRangeField = /*#__PURE__*/React.forwardRef(function MultiInp
|
|
|
155
157
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(TextField, (0, _extends2.default)({
|
|
156
158
|
fullWidth: true
|
|
157
159
|
}, startDateProps, {
|
|
160
|
+
InputProps: (0, _extends2.default)({}, startDateProps.InputProps, {
|
|
161
|
+
readOnly: startReadOnly
|
|
162
|
+
}),
|
|
158
163
|
inputProps: (0, _extends2.default)({}, startDateProps.inputProps, {
|
|
159
164
|
ref: startInputRef,
|
|
160
|
-
readOnly: startReadOnly,
|
|
161
165
|
inputMode: startInputMode,
|
|
162
166
|
onKeyDown: onStartInputKeyDown
|
|
163
167
|
})
|
|
164
168
|
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(Separator, (0, _extends2.default)({}, separatorProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(TextField, (0, _extends2.default)({
|
|
165
169
|
fullWidth: true
|
|
166
170
|
}, endDateProps, {
|
|
171
|
+
InputProps: (0, _extends2.default)({}, endDateProps.InputProps, {
|
|
172
|
+
readOnly: endReadOnly
|
|
173
|
+
}),
|
|
167
174
|
inputProps: (0, _extends2.default)({}, endDateProps.inputProps, {
|
|
168
175
|
ref: endInputRef,
|
|
169
176
|
readOnly: endReadOnly,
|
|
@@ -307,11 +314,27 @@ process.env.NODE_ENV !== "production" ? MultiInputTimeRangeField.propTypes = {
|
|
|
307
314
|
shouldDisableClock: _propTypes.default.func,
|
|
308
315
|
/**
|
|
309
316
|
* Disable specific time.
|
|
317
|
+
* @template TDate
|
|
310
318
|
* @param {TDate} value The value to check.
|
|
311
319
|
* @param {TimeView} view The clock type of the timeValue.
|
|
312
320
|
* @returns {boolean} If `true` the time will be disabled.
|
|
313
321
|
*/
|
|
314
322
|
shouldDisableTime: _propTypes.default.func,
|
|
323
|
+
/**
|
|
324
|
+
* If `true`, the format will respect the leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
|
|
325
|
+
* If `false`, the format will always add leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
|
|
326
|
+
*
|
|
327
|
+
* 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`.
|
|
328
|
+
*
|
|
329
|
+
* 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.
|
|
330
|
+
* If you need to get the clean value from the input, you can remove this character using `input.value.replace(/\u200e/g, '')`.
|
|
331
|
+
*
|
|
332
|
+
* Warning n°3: When used in strict mode, dayjs and moment require to respect the leading zeros.
|
|
333
|
+
* 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.
|
|
334
|
+
*
|
|
335
|
+
* @default `false`
|
|
336
|
+
*/
|
|
337
|
+
shouldRespectLeadingZeros: _propTypes.default.bool,
|
|
315
338
|
/**
|
|
316
339
|
* The props used for each component slot.
|
|
317
340
|
* @default {}
|
|
@@ -337,7 +360,7 @@ process.env.NODE_ENV !== "production" ? MultiInputTimeRangeField.propTypes = {
|
|
|
337
360
|
/**
|
|
338
361
|
* If `true`, the CSS flexbox `gap` is used instead of applying `margin` to children.
|
|
339
362
|
*
|
|
340
|
-
* While CSS `gap` removes the [known limitations](https://mui.com/joy-ui/react-stack
|
|
363
|
+
* While CSS `gap` removes the [known limitations](https://mui.com/joy-ui/react-stack/#limitations),
|
|
341
364
|
* it is not fully supported in some browsers. We recommend checking https://caniuse.com/?search=flex%20gap before using this flag.
|
|
342
365
|
*
|
|
343
366
|
* To enable this flag globally, follow the [theme's default props](https://mui.com/material-ui/customization/theme-components/#default-props) configuration.
|
|
@@ -63,11 +63,13 @@ const SingleInputDateRangeField = /*#__PURE__*/React.forwardRef(function SingleI
|
|
|
63
63
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(TextField, (0, _extends2.default)({
|
|
64
64
|
ref: ref
|
|
65
65
|
}, fieldProps, {
|
|
66
|
+
InputProps: (0, _extends2.default)({}, fieldProps.InputProps, {
|
|
67
|
+
readOnly
|
|
68
|
+
}),
|
|
66
69
|
inputProps: (0, _extends2.default)({}, fieldProps.inputProps, {
|
|
67
|
-
ref: inputRef,
|
|
68
|
-
onPaste,
|
|
69
70
|
inputMode,
|
|
70
|
-
|
|
71
|
+
onPaste,
|
|
72
|
+
ref: inputRef
|
|
71
73
|
})
|
|
72
74
|
}));
|
|
73
75
|
});
|
|
@@ -259,6 +261,21 @@ process.env.NODE_ENV !== "production" ? SingleInputDateRangeField.propTypes = {
|
|
|
259
261
|
* @returns {boolean} Returns `true` if the date should be disabled.
|
|
260
262
|
*/
|
|
261
263
|
shouldDisableDate: _propTypes.default.func,
|
|
264
|
+
/**
|
|
265
|
+
* If `true`, the format will respect the leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
|
|
266
|
+
* If `false`, the format will always add leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
|
|
267
|
+
*
|
|
268
|
+
* 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`.
|
|
269
|
+
*
|
|
270
|
+
* 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.
|
|
271
|
+
* If you need to get the clean value from the input, you can remove this character using `input.value.replace(/\u200e/g, '')`.
|
|
272
|
+
*
|
|
273
|
+
* Warning n°3: When used in strict mode, dayjs and moment require to respect the leading zeros.
|
|
274
|
+
* 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.
|
|
275
|
+
*
|
|
276
|
+
* @default `false`
|
|
277
|
+
*/
|
|
278
|
+
shouldRespectLeadingZeros: _propTypes.default.bool,
|
|
262
279
|
/**
|
|
263
280
|
* The size of the component.
|
|
264
281
|
*/
|
|
@@ -9,8 +9,8 @@ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runt
|
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _internals = require("@mui/x-date-pickers/internals");
|
|
11
11
|
var _valueManagers = require("../internal/utils/valueManagers");
|
|
12
|
-
var
|
|
13
|
-
const _excluded = ["value", "defaultValue", "format", "formatDensity", "onChange", "readOnly", "onError", "shouldDisableDate", "minDate", "maxDate", "disableFuture", "disablePast", "selectedSections", "onSelectedSectionsChange", "unstableFieldRef"];
|
|
12
|
+
var _validateDateRange = require("../internal/utils/validation/validateDateRange");
|
|
13
|
+
const _excluded = ["value", "defaultValue", "format", "formatDensity", "shouldRespectLeadingZeros", "onChange", "readOnly", "onError", "shouldDisableDate", "minDate", "maxDate", "disableFuture", "disablePast", "selectedSections", "onSelectedSectionsChange", "unstableFieldRef"];
|
|
14
14
|
const useDefaultizedDateRangeFieldProps = props => {
|
|
15
15
|
const utils = (0, _internals.useUtils)();
|
|
16
16
|
const defaultDates = (0, _internals.useDefaultDates)();
|
|
@@ -33,6 +33,7 @@ const useSingleInputDateRangeField = ({
|
|
|
33
33
|
defaultValue,
|
|
34
34
|
format,
|
|
35
35
|
formatDensity,
|
|
36
|
+
shouldRespectLeadingZeros,
|
|
36
37
|
onChange,
|
|
37
38
|
readOnly,
|
|
38
39
|
onError,
|
|
@@ -54,6 +55,7 @@ const useSingleInputDateRangeField = ({
|
|
|
54
55
|
defaultValue,
|
|
55
56
|
format,
|
|
56
57
|
formatDensity,
|
|
58
|
+
shouldRespectLeadingZeros,
|
|
57
59
|
onChange,
|
|
58
60
|
readOnly,
|
|
59
61
|
onError,
|
|
@@ -68,7 +70,7 @@ const useSingleInputDateRangeField = ({
|
|
|
68
70
|
},
|
|
69
71
|
valueManager: _valueManagers.rangeValueManager,
|
|
70
72
|
fieldValueManager: _valueManagers.rangeFieldValueManager,
|
|
71
|
-
validator:
|
|
73
|
+
validator: _validateDateRange.validateDateRange,
|
|
72
74
|
valueType: 'date'
|
|
73
75
|
});
|
|
74
76
|
};
|
|
@@ -63,11 +63,13 @@ const SingleInputDateTimeRangeField = /*#__PURE__*/React.forwardRef(function Sin
|
|
|
63
63
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(TextField, (0, _extends2.default)({
|
|
64
64
|
ref: ref
|
|
65
65
|
}, fieldProps, {
|
|
66
|
+
InputProps: (0, _extends2.default)({}, fieldProps.InputProps, {
|
|
67
|
+
readOnly
|
|
68
|
+
}),
|
|
66
69
|
inputProps: (0, _extends2.default)({}, fieldProps.inputProps, {
|
|
67
|
-
ref: inputRef,
|
|
68
|
-
onPaste,
|
|
69
70
|
inputMode,
|
|
70
|
-
|
|
71
|
+
onPaste,
|
|
72
|
+
ref: inputRef
|
|
71
73
|
})
|
|
72
74
|
}));
|
|
73
75
|
});
|
|
@@ -302,11 +304,27 @@ process.env.NODE_ENV !== "production" ? SingleInputDateTimeRangeField.propTypes
|
|
|
302
304
|
shouldDisableDate: _propTypes.default.func,
|
|
303
305
|
/**
|
|
304
306
|
* Disable specific time.
|
|
307
|
+
* @template TDate
|
|
305
308
|
* @param {TDate} value The value to check.
|
|
306
309
|
* @param {TimeView} view The clock type of the timeValue.
|
|
307
310
|
* @returns {boolean} If `true` the time will be disabled.
|
|
308
311
|
*/
|
|
309
312
|
shouldDisableTime: _propTypes.default.func,
|
|
313
|
+
/**
|
|
314
|
+
* If `true`, the format will respect the leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
|
|
315
|
+
* If `false`, the format will always add leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
|
|
316
|
+
*
|
|
317
|
+
* 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`.
|
|
318
|
+
*
|
|
319
|
+
* 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.
|
|
320
|
+
* If you need to get the clean value from the input, you can remove this character using `input.value.replace(/\u200e/g, '')`.
|
|
321
|
+
*
|
|
322
|
+
* Warning n°3: When used in strict mode, dayjs and moment require to respect the leading zeros.
|
|
323
|
+
* 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.
|
|
324
|
+
*
|
|
325
|
+
* @default `false`
|
|
326
|
+
*/
|
|
327
|
+
shouldRespectLeadingZeros: _propTypes.default.bool,
|
|
310
328
|
/**
|
|
311
329
|
* The size of the component.
|
|
312
330
|
*/
|
|
@@ -9,8 +9,8 @@ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runt
|
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _internals = require("@mui/x-date-pickers/internals");
|
|
11
11
|
var _valueManagers = require("../internal/utils/valueManagers");
|
|
12
|
-
var
|
|
13
|
-
const _excluded = ["value", "defaultValue", "format", "formatDensity", "onChange", "readOnly", "onError", "shouldDisableDate", "minDate", "maxDate", "disableFuture", "disablePast", "minTime", "maxTime", "minDateTime", "maxDateTime", "minutesStep", "shouldDisableTime", "disableIgnoringDatePartForTimeValidation", "selectedSections", "onSelectedSectionsChange", "unstableFieldRef"];
|
|
12
|
+
var _validateDateTimeRange = require("../internal/utils/validation/validateDateTimeRange");
|
|
13
|
+
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"];
|
|
14
14
|
const useDefaultizedTimeRangeFieldProps = props => {
|
|
15
15
|
const utils = (0, _internals.useUtils)();
|
|
16
16
|
const defaultDates = (0, _internals.useDefaultDates)();
|
|
@@ -38,6 +38,7 @@ const useSingleInputDateTimeRangeField = ({
|
|
|
38
38
|
defaultValue,
|
|
39
39
|
format,
|
|
40
40
|
formatDensity,
|
|
41
|
+
shouldRespectLeadingZeros,
|
|
41
42
|
onChange,
|
|
42
43
|
readOnly,
|
|
43
44
|
onError,
|
|
@@ -64,6 +65,7 @@ const useSingleInputDateTimeRangeField = ({
|
|
|
64
65
|
defaultValue,
|
|
65
66
|
format,
|
|
66
67
|
formatDensity,
|
|
68
|
+
shouldRespectLeadingZeros,
|
|
67
69
|
onChange,
|
|
68
70
|
readOnly,
|
|
69
71
|
onError,
|
|
@@ -83,7 +85,7 @@ const useSingleInputDateTimeRangeField = ({
|
|
|
83
85
|
},
|
|
84
86
|
valueManager: _valueManagers.rangeValueManager,
|
|
85
87
|
fieldValueManager: _valueManagers.rangeFieldValueManager,
|
|
86
|
-
validator:
|
|
88
|
+
validator: _validateDateTimeRange.validateDateTimeRange,
|
|
87
89
|
valueType: 'date-time'
|
|
88
90
|
});
|
|
89
91
|
};
|
|
@@ -63,11 +63,13 @@ const SingleInputTimeRangeField = /*#__PURE__*/React.forwardRef(function SingleI
|
|
|
63
63
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(TextField, (0, _extends2.default)({
|
|
64
64
|
ref: ref
|
|
65
65
|
}, fieldProps, {
|
|
66
|
+
InputProps: (0, _extends2.default)({}, fieldProps.InputProps, {
|
|
67
|
+
readOnly
|
|
68
|
+
}),
|
|
66
69
|
inputProps: (0, _extends2.default)({}, fieldProps.inputProps, {
|
|
67
|
-
ref: inputRef,
|
|
68
|
-
onPaste,
|
|
69
70
|
inputMode,
|
|
70
|
-
|
|
71
|
+
onPaste,
|
|
72
|
+
ref: inputRef
|
|
71
73
|
})
|
|
72
74
|
}));
|
|
73
75
|
});
|
|
@@ -278,11 +280,27 @@ process.env.NODE_ENV !== "production" ? SingleInputTimeRangeField.propTypes = {
|
|
|
278
280
|
shouldDisableClock: _propTypes.default.func,
|
|
279
281
|
/**
|
|
280
282
|
* Disable specific time.
|
|
283
|
+
* @template TDate
|
|
281
284
|
* @param {TDate} value The value to check.
|
|
282
285
|
* @param {TimeView} view The clock type of the timeValue.
|
|
283
286
|
* @returns {boolean} If `true` the time will be disabled.
|
|
284
287
|
*/
|
|
285
288
|
shouldDisableTime: _propTypes.default.func,
|
|
289
|
+
/**
|
|
290
|
+
* If `true`, the format will respect the leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
|
|
291
|
+
* If `false`, the format will always add leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
|
|
292
|
+
*
|
|
293
|
+
* 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`.
|
|
294
|
+
*
|
|
295
|
+
* 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.
|
|
296
|
+
* If you need to get the clean value from the input, you can remove this character using `input.value.replace(/\u200e/g, '')`.
|
|
297
|
+
*
|
|
298
|
+
* Warning n°3: When used in strict mode, dayjs and moment require to respect the leading zeros.
|
|
299
|
+
* 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.
|
|
300
|
+
*
|
|
301
|
+
* @default `false`
|
|
302
|
+
*/
|
|
303
|
+
shouldRespectLeadingZeros: _propTypes.default.bool,
|
|
286
304
|
/**
|
|
287
305
|
* The size of the component.
|
|
288
306
|
*/
|
|
@@ -9,8 +9,8 @@ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runt
|
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _internals = require("@mui/x-date-pickers/internals");
|
|
11
11
|
var _valueManagers = require("../internal/utils/valueManagers");
|
|
12
|
-
var
|
|
13
|
-
const _excluded = ["value", "defaultValue", "format", "formatDensity", "onChange", "readOnly", "onError", "minTime", "maxTime", "minutesStep", "shouldDisableTime", "disableFuture", "disablePast", "selectedSections", "onSelectedSectionsChange", "unstableFieldRef"];
|
|
12
|
+
var _validateTimeRange = require("../internal/utils/validation/validateTimeRange");
|
|
13
|
+
const _excluded = ["value", "defaultValue", "format", "formatDensity", "shouldRespectLeadingZeros", "onChange", "readOnly", "onError", "minTime", "maxTime", "minutesStep", "shouldDisableTime", "disableFuture", "disablePast", "selectedSections", "onSelectedSectionsChange", "unstableFieldRef"];
|
|
14
14
|
const useDefaultizedTimeRangeFieldProps = props => {
|
|
15
15
|
const utils = (0, _internals.useUtils)();
|
|
16
16
|
const ampm = props.ampm ?? utils.is12HourCycleInCurrentLocale();
|
|
@@ -32,6 +32,7 @@ const useSingleInputTimeRangeField = ({
|
|
|
32
32
|
defaultValue,
|
|
33
33
|
format,
|
|
34
34
|
formatDensity,
|
|
35
|
+
shouldRespectLeadingZeros,
|
|
35
36
|
onChange,
|
|
36
37
|
readOnly,
|
|
37
38
|
onError,
|
|
@@ -54,6 +55,7 @@ const useSingleInputTimeRangeField = ({
|
|
|
54
55
|
defaultValue,
|
|
55
56
|
format,
|
|
56
57
|
formatDensity,
|
|
58
|
+
shouldRespectLeadingZeros,
|
|
57
59
|
onChange,
|
|
58
60
|
readOnly,
|
|
59
61
|
onError,
|
|
@@ -69,7 +71,7 @@ const useSingleInputTimeRangeField = ({
|
|
|
69
71
|
},
|
|
70
72
|
valueManager: _valueManagers.rangeValueManager,
|
|
71
73
|
fieldValueManager: _valueManagers.rangeFieldValueManager,
|
|
72
|
-
validator:
|
|
74
|
+
validator: _validateTimeRange.validateTimeRange,
|
|
73
75
|
valueType: 'time'
|
|
74
76
|
});
|
|
75
77
|
};
|
|
@@ -12,7 +12,7 @@ var _useStaticRangePicker = require("../internal/hooks/useStaticRangePicker");
|
|
|
12
12
|
var _shared = require("../DateRangePicker/shared");
|
|
13
13
|
var _dateRangeViewRenderers = require("../dateRangeViewRenderers");
|
|
14
14
|
var _valueManagers = require("../internal/utils/valueManagers");
|
|
15
|
-
var
|
|
15
|
+
var _validateDateRange = require("../internal/utils/validation/validateDateRange");
|
|
16
16
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
17
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
18
18
|
const StaticDateRangePicker = /*#__PURE__*/React.forwardRef(function StaticDateRangePicker(inProps, ref) {
|
|
@@ -40,7 +40,8 @@ const StaticDateRangePicker = /*#__PURE__*/React.forwardRef(function StaticDateR
|
|
|
40
40
|
} = (0, _useStaticRangePicker.useStaticRangePicker)({
|
|
41
41
|
props,
|
|
42
42
|
valueManager: _valueManagers.rangeValueManager,
|
|
43
|
-
|
|
43
|
+
valueType: 'date',
|
|
44
|
+
validator: _validateDateRange.validateDateRange,
|
|
44
45
|
ref
|
|
45
46
|
});
|
|
46
47
|
return renderPicker();
|
package/node/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-date-pickers-pro v6.
|
|
2
|
+
* @mui/x-date-pickers-pro v6.3.0
|
|
3
3
|
*
|
|
4
4
|
* @license MUI X Commercial
|
|
5
5
|
* This source code is licensed under the commercial license found in the
|
|
@@ -187,4 +187,16 @@ Object.keys(_dateRangeViewRenderers).forEach(function (key) {
|
|
|
187
187
|
return _dateRangeViewRenderers[key];
|
|
188
188
|
}
|
|
189
189
|
});
|
|
190
|
+
});
|
|
191
|
+
var _models = require("./models");
|
|
192
|
+
Object.keys(_models).forEach(function (key) {
|
|
193
|
+
if (key === "default" || key === "__esModule") return;
|
|
194
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
195
|
+
if (key in exports && exports[key] === _models[key]) return;
|
|
196
|
+
Object.defineProperty(exports, key, {
|
|
197
|
+
enumerable: true,
|
|
198
|
+
get: function () {
|
|
199
|
+
return _models[key];
|
|
200
|
+
}
|
|
201
|
+
});
|
|
190
202
|
});
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.useDesktopRangePicker = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
9
10
|
var React = _interopRequireWildcard(require("react"));
|
|
10
11
|
var _utils = require("@mui/base/utils");
|
|
11
12
|
var _xLicensePro = require("@mui/x-license-pro");
|
|
@@ -16,14 +17,15 @@ var _useEnrichedRangePickerFieldProps = require("../useEnrichedRangePickerFieldP
|
|
|
16
17
|
var _releaseInfo = require("../../utils/releaseInfo");
|
|
17
18
|
var _useRangePosition = require("../useRangePosition");
|
|
18
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
|
+
const _excluded = ["props"];
|
|
19
21
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
20
22
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
23
|
const releaseInfo = (0, _releaseInfo.getReleaseInfo)();
|
|
22
|
-
const useDesktopRangePicker =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
const useDesktopRangePicker = _ref => {
|
|
25
|
+
let {
|
|
26
|
+
props
|
|
27
|
+
} = _ref,
|
|
28
|
+
pickerParams = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
|
|
27
29
|
(0, _xLicensePro.useLicenseVerifier)('x-date-pickers-pro', releaseInfo);
|
|
28
30
|
const {
|
|
29
31
|
slots,
|
|
@@ -54,17 +56,15 @@ const useDesktopRangePicker = ({
|
|
|
54
56
|
renderCurrentView,
|
|
55
57
|
shouldRestoreFocus,
|
|
56
58
|
fieldProps: pickerFieldProps
|
|
57
|
-
} = (0, _internals.usePicker)({
|
|
59
|
+
} = (0, _internals.usePicker)((0, _extends2.default)({}, pickerParams, {
|
|
58
60
|
props,
|
|
59
|
-
valueManager,
|
|
60
61
|
wrapperVariant: 'desktop',
|
|
61
|
-
validator,
|
|
62
62
|
autoFocusView: true,
|
|
63
63
|
additionalViewProps: {
|
|
64
64
|
rangePosition,
|
|
65
65
|
onRangePositionChange
|
|
66
66
|
}
|
|
67
|
-
});
|
|
67
|
+
}));
|
|
68
68
|
const handleBlur = () => {
|
|
69
69
|
(0, _internals.executeInTheNextEventLoopTick)(() => {
|
|
70
70
|
if (fieldContainerRef.current?.contains((0, _internals.getActiveElement)(document)) || popperRef.current?.contains((0, _internals.getActiveElement)(document))) {
|