@mui/x-date-pickers 7.0.0-beta.7 → 7.0.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/AdapterDateFns/AdapterDateFns.js +1 -1
- package/AdapterDateFnsBase/AdapterDateFnsBase.js +1 -2
- package/AdapterDateFnsJalali/AdapterDateFnsJalali.js +2 -4
- package/AdapterDateFnsV3/AdapterDateFnsV3.js +1 -1
- package/AdapterDayjs/AdapterDayjs.js +2 -4
- package/AdapterLuxon/AdapterLuxon.js +12 -9
- package/AdapterMoment/AdapterMoment.js +5 -6
- package/CHANGELOG.md +195 -12
- package/DateCalendar/DateCalendar.js +14 -16
- package/DateCalendar/DayCalendar.js +5 -6
- package/DateField/DateField.js +3 -4
- package/DatePicker/DatePicker.js +1 -1
- package/DatePicker/shared.d.ts +2 -1
- package/DatePicker/shared.js +3 -5
- package/DateTimeField/DateTimeField.js +3 -4
- package/DateTimePicker/DateTimePicker.js +1 -1
- package/DateTimePicker/DateTimePickerToolbar.js +1 -1
- package/DateTimePicker/shared.d.ts +2 -1
- package/DateTimePicker/shared.js +11 -13
- package/DesktopDatePicker/DesktopDatePicker.js +7 -11
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +72 -37
- package/DesktopDateTimePicker/DesktopDateTimePickerLayout.d.ts +12 -0
- package/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +101 -0
- package/DesktopDateTimePicker/index.d.ts +1 -0
- package/DesktopDateTimePicker/index.js +2 -1
- package/DesktopTimePicker/DesktopTimePicker.js +8 -12
- package/DigitalClock/DigitalClock.js +2 -3
- package/LocalizationProvider/LocalizationProvider.js +1 -2
- package/MobileDatePicker/MobileDatePicker.js +6 -10
- package/MobileDateTimePicker/MobileDateTimePicker.js +8 -12
- package/MobileTimePicker/MobileTimePicker.js +6 -10
- package/MonthCalendar/MonthCalendar.js +4 -4
- package/MonthCalendar/PickersMonth.js +1 -2
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -1
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.js +1 -1
- package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +3 -5
- package/PickersActionBar/PickersActionBar.js +1 -1
- package/PickersCalendarHeader/PickersCalendarHeader.js +4 -5
- package/PickersLayout/usePickerLayout.js +8 -9
- package/PickersSectionList/PickersSectionList.js +9 -11
- package/PickersTextField/PickersFilledInput/PickersFilledInput.js +2 -3
- package/PickersTextField/PickersInput/PickersInput.js +1 -1
- package/PickersTextField/PickersInputBase/PickersInputBase.js +4 -5
- package/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +2 -2
- package/README.md +1 -1
- package/StaticDatePicker/StaticDatePicker.js +4 -5
- package/StaticDateTimePicker/StaticDateTimePicker.js +6 -7
- package/StaticTimePicker/StaticTimePicker.js +3 -4
- package/TimeClock/TimeClock.js +1 -1
- package/TimeField/TimeField.js +2 -3
- package/TimePicker/shared.d.ts +2 -1
- package/TimePicker/shared.js +5 -7
- package/YearCalendar/YearCalendar.js +5 -6
- package/hooks/useClearableField.js +6 -7
- package/index.js +1 -1
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +8 -9
- package/internals/components/PickersModalDialog.js +6 -7
- package/internals/components/PickersPopper.js +13 -16
- package/internals/components/PickersToolbar.js +9 -12
- package/internals/hooks/date-helpers-hooks.js +1 -1
- package/internals/hooks/defaultizedFieldProps.js +15 -18
- package/internals/hooks/useClockReferenceDate.js +1 -1
- package/internals/hooks/useDesktopPicker/index.d.ts +1 -1
- package/internals/hooks/useDesktopPicker/useDesktopPicker.js +11 -12
- package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +2 -2
- package/internals/hooks/useField/buildSectionsFromFormat.js +35 -31
- package/internals/hooks/useField/useField.js +2 -2
- package/internals/hooks/useField/useField.utils.js +4 -7
- package/internals/hooks/useField/useFieldCharacterEditing.js +1 -2
- package/internals/hooks/useField/useFieldState.js +1 -1
- package/internals/hooks/useField/useFieldV6TextField.js +9 -15
- package/internals/hooks/useField/useFieldV7TextField.js +9 -11
- package/internals/hooks/useMobilePicker/useMobilePicker.js +7 -8
- package/internals/hooks/useOpenState.js +1 -1
- package/internals/hooks/usePicker/index.d.ts +1 -0
- package/internals/hooks/usePicker/usePickerViews.d.ts +4 -2
- package/internals/hooks/usePicker/usePickerViews.js +1 -2
- package/internals/hooks/useStaticPicker/useStaticPicker.js +13 -17
- package/internals/hooks/useValueWithTimezone.js +5 -6
- package/internals/hooks/useViews.js +3 -4
- package/internals/index.d.ts +1 -1
- package/internals/models/validation.d.ts +1 -1
- package/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +3 -3
- package/internals/utils/date-time-utils.js +2 -5
- package/internals/utils/fields.js +1 -1
- package/internals/utils/getDefaultReferenceDate.js +2 -6
- package/internals/utils/views.js +1 -1
- package/locales/csCZ.js +1 -4
- package/locales/daDK.js +1 -4
- package/locales/deDE.js +1 -4
- package/locales/huHU.js +1 -4
- package/locales/jaJP.js +1 -4
- package/locales/roRO.js +1 -4
- package/locales/skSK.js +1 -4
- package/modern/AdapterLuxon/AdapterLuxon.js +9 -4
- package/modern/DateCalendar/DateCalendar.js +1 -1
- package/modern/DateField/DateField.js +1 -1
- package/modern/DatePicker/DatePicker.js +1 -1
- package/modern/DateTimeField/DateTimeField.js +1 -1
- package/modern/DateTimePicker/DateTimePicker.js +1 -1
- package/modern/DesktopDatePicker/DesktopDatePicker.js +1 -1
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +64 -25
- package/modern/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +101 -0
- package/modern/DesktopDateTimePicker/index.js +2 -1
- package/modern/MobileDatePicker/MobileDatePicker.js +1 -1
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +1 -1
- package/modern/StaticDatePicker/StaticDatePicker.js +1 -1
- package/modern/StaticDateTimePicker/StaticDateTimePicker.js +1 -1
- package/modern/index.js +1 -1
- package/modern/internals/components/PickersPopper.js +1 -1
- package/modern/internals/hooks/useField/buildSectionsFromFormat.js +34 -30
- package/modern/internals/hooks/useField/useFieldV7TextField.js +1 -1
- package/modern/internals/hooks/useOpenState.js +1 -1
- package/modern/internals/utils/fields.js +1 -1
- package/node/AdapterLuxon/AdapterLuxon.js +9 -4
- package/node/DateCalendar/DateCalendar.js +1 -1
- package/node/DateField/DateField.js +1 -1
- package/node/DatePicker/DatePicker.js +1 -1
- package/node/DateTimeField/DateTimeField.js +1 -1
- package/node/DateTimePicker/DateTimePicker.js +1 -1
- package/node/DesktopDatePicker/DesktopDatePicker.js +1 -1
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +63 -25
- package/node/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +108 -0
- package/node/DesktopDateTimePicker/index.js +8 -1
- package/node/MobileDatePicker/MobileDatePicker.js +1 -1
- package/node/MobileDateTimePicker/MobileDateTimePicker.js +1 -1
- package/node/StaticDatePicker/StaticDatePicker.js +1 -1
- package/node/StaticDateTimePicker/StaticDateTimePicker.js +1 -1
- package/node/index.js +1 -1
- package/node/internals/components/PickersPopper.js +1 -1
- package/node/internals/hooks/useField/buildSectionsFromFormat.js +34 -30
- package/node/internals/hooks/useField/useFieldV7TextField.js +1 -1
- package/node/internals/hooks/useOpenState.js +1 -1
- package/node/internals/utils/fields.js +1 -1
- package/package.json +5 -5
- package/timeViewRenderers/timeViewRenderers.js +1 -1
- package/dateTimeViewRenderers/dateTimeViewRenderers.d.ts +0 -15
- package/dateTimeViewRenderers/dateTimeViewRenderers.js +0 -163
- package/dateTimeViewRenderers/index.d.ts +0 -2
- package/dateTimeViewRenderers/index.js +0 -1
- package/dateTimeViewRenderers/package.json +0 -6
- package/modern/dateTimeViewRenderers/dateTimeViewRenderers.js +0 -162
- package/modern/dateTimeViewRenderers/index.js +0 -1
- package/node/dateTimeViewRenderers/dateTimeViewRenderers.js +0 -171
- package/node/dateTimeViewRenderers/index.js +0 -12
|
@@ -366,7 +366,7 @@ export const useFieldV7TextField = params => {
|
|
|
366
366
|
const valueStr = React.useMemo(() => areAllSectionsEmpty ? '' : fieldValueManager.getV7HiddenInputValueFromSections(state.sections), [areAllSectionsEmpty, state.sections, fieldValueManager]);
|
|
367
367
|
React.useEffect(() => {
|
|
368
368
|
if (sectionListRef.current == null) {
|
|
369
|
-
throw new Error(['MUI X: The `sectionListRef` prop has not been initialized by `PickersSectionList`', 'You probably tried to pass a component to the `textField` slot that contains an `<input />` element instead of a `PickersSectionList`.', '', 'If you want to keep using an `<input />` HTML element for the editing, please remove the `enableAccessibleFieldDOMStructure` prop from your picker or field component:', '', '<DatePicker slots={{ textField: MyCustomTextField }} />', '', 'Learn more about the field accessible DOM structure on the MUI documentation: https://
|
|
369
|
+
throw new Error(['MUI X: The `sectionListRef` prop has not been initialized by `PickersSectionList`', 'You probably tried to pass a component to the `textField` slot that contains an `<input />` element instead of a `PickersSectionList`.', '', 'If you want to keep using an `<input />` HTML element for the editing, please remove the `enableAccessibleFieldDOMStructure` prop from your picker or field component:', '', '<DatePicker slots={{ textField: MyCustomTextField }} />', '', 'Learn more about the field accessible DOM structure on the MUI documentation: https://mui.com/x/react-date-pickers/fields/#fields-to-edit-a-single-element'].join('\n'));
|
|
370
370
|
}
|
|
371
371
|
if (autoFocus && sectionListRef.current) {
|
|
372
372
|
sectionListRef.current.getSectionContent(sectionOrder.startIndex).focus();
|
|
@@ -8,7 +8,7 @@ export const useOpenState = ({
|
|
|
8
8
|
const [openState, setIsOpenState] = React.useState(false);
|
|
9
9
|
|
|
10
10
|
// It is required to update inner state in useEffect in order to avoid situation when
|
|
11
|
-
// Our component is not mounted yet, but `open` state is set to `true` (
|
|
11
|
+
// Our component is not mounted yet, but `open` state is set to `true` (for example initially opened)
|
|
12
12
|
React.useEffect(() => {
|
|
13
13
|
if (isControllingOpenProp) {
|
|
14
14
|
if (typeof open !== 'boolean') {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import { DATE_TIME_VALIDATION_PROP_NAMES, DATE_VALIDATION_PROP_NAMES, TIME_VALIDATION_PROP_NAMES } from './validation/extractValidationProps';
|
|
3
|
-
const SHARED_FIELD_INTERNAL_PROP_NAMES = ['value', 'defaultValue', 'referenceDate', 'format', 'formatDensity', 'onChange', 'timezone', 'onError', 'shouldRespectLeadingZeros', 'selectedSections', 'onSelectedSectionsChange', 'unstableFieldRef', 'enableAccessibleFieldDOMStructure', 'disabled', 'readOnly'];
|
|
3
|
+
const SHARED_FIELD_INTERNAL_PROP_NAMES = ['value', 'defaultValue', 'referenceDate', 'format', 'formatDensity', 'onChange', 'timezone', 'onError', 'shouldRespectLeadingZeros', 'selectedSections', 'onSelectedSectionsChange', 'unstableFieldRef', 'enableAccessibleFieldDOMStructure', 'disabled', 'readOnly', 'dateSeparator'];
|
|
4
4
|
export const splitFieldInternalAndForwardedProps = (props, valueType) => {
|
|
5
5
|
const forwardedProps = _extends({}, props);
|
|
6
6
|
const internalProps = {};
|
|
@@ -248,6 +248,10 @@ class AdapterLuxon {
|
|
|
248
248
|
// Extract escaped section to avoid extending them
|
|
249
249
|
const catchEscapedSectionsRegexp = /''|'(''|[^'])+('|$)|[^']*/g;
|
|
250
250
|
|
|
251
|
+
// This RegExp tests if a string is only mad of supported tokens
|
|
252
|
+
const validTokens = [...Object.keys(this.formatTokenMap), 'yyyyy'];
|
|
253
|
+
const isWordComposedOfTokens = new RegExp(`^(${validTokens.join('|')})+$`);
|
|
254
|
+
|
|
251
255
|
// Extract words to test if they are a token or a word to escape.
|
|
252
256
|
const catchWordsRegexp = /(?:^|[^a-z])([a-z]+)(?:[^a-z]|$)|([a-z]+)/gi;
|
|
253
257
|
return format.match(catchEscapedSectionsRegexp).map(token => {
|
|
@@ -258,12 +262,13 @@ class AdapterLuxon {
|
|
|
258
262
|
const expandedToken = _luxon.DateTime.expandFormat(token, {
|
|
259
263
|
locale: this.locale
|
|
260
264
|
});
|
|
261
|
-
return expandedToken.replace(catchWordsRegexp, (
|
|
265
|
+
return expandedToken.replace(catchWordsRegexp, (substring, g1, g2) => {
|
|
262
266
|
const word = g1 || g2; // words are either in group 1 or group 2
|
|
263
|
-
|
|
264
|
-
|
|
267
|
+
|
|
268
|
+
if (isWordComposedOfTokens.test(word)) {
|
|
269
|
+
return substring;
|
|
265
270
|
}
|
|
266
|
-
return `'${
|
|
271
|
+
return `'${substring}'`;
|
|
267
272
|
});
|
|
268
273
|
}).join('')
|
|
269
274
|
// The returned format can contain `yyyyy` which means year between 4 and 6 digits.
|
|
@@ -495,7 +495,7 @@ process.env.NODE_ENV !== "production" ? DateCalendar.propTypes = {
|
|
|
495
495
|
/**
|
|
496
496
|
* Disable specific date.
|
|
497
497
|
*
|
|
498
|
-
* Warning: This function can be called multiple times (
|
|
498
|
+
* Warning: This function can be called multiple times (for example when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
499
499
|
*
|
|
500
500
|
* @template TDate
|
|
501
501
|
* @param {TDate} day The date to test.
|
|
@@ -250,7 +250,7 @@ process.env.NODE_ENV !== "production" ? DateField.propTypes = {
|
|
|
250
250
|
/**
|
|
251
251
|
* Disable specific date.
|
|
252
252
|
*
|
|
253
|
-
* Warning: This function can be called multiple times (
|
|
253
|
+
* Warning: This function can be called multiple times (for example when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
254
254
|
*
|
|
255
255
|
* @template TDate
|
|
256
256
|
* @param {TDate} day The date to test.
|
|
@@ -275,7 +275,7 @@ process.env.NODE_ENV !== "production" ? DatePicker.propTypes = {
|
|
|
275
275
|
/**
|
|
276
276
|
* Disable specific date.
|
|
277
277
|
*
|
|
278
|
-
* Warning: This function can be called multiple times (
|
|
278
|
+
* Warning: This function can be called multiple times (for example when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
279
279
|
*
|
|
280
280
|
* @template TDate
|
|
281
281
|
* @param {TDate} day The date to test.
|
|
@@ -283,7 +283,7 @@ process.env.NODE_ENV !== "production" ? DateTimeField.propTypes = {
|
|
|
283
283
|
/**
|
|
284
284
|
* Disable specific date.
|
|
285
285
|
*
|
|
286
|
-
* Warning: This function can be called multiple times (
|
|
286
|
+
* Warning: This function can be called multiple times (for example when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
287
287
|
*
|
|
288
288
|
* @template TDate
|
|
289
289
|
* @param {TDate} day The date to test.
|
|
@@ -313,7 +313,7 @@ process.env.NODE_ENV !== "production" ? DateTimePicker.propTypes = {
|
|
|
313
313
|
/**
|
|
314
314
|
* Disable specific date.
|
|
315
315
|
*
|
|
316
|
-
* Warning: This function can be called multiple times (
|
|
316
|
+
* Warning: This function can be called multiple times (for example when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
317
317
|
*
|
|
318
318
|
* @template TDate
|
|
319
319
|
* @param {TDate} day The date to test.
|
|
@@ -290,7 +290,7 @@ DesktopDatePicker.propTypes = {
|
|
|
290
290
|
/**
|
|
291
291
|
* Disable specific date.
|
|
292
292
|
*
|
|
293
|
-
* Warning: This function can be called multiple times (
|
|
293
|
+
* Warning: This function can be called multiple times (for example when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
294
294
|
*
|
|
295
295
|
* @template TDate
|
|
296
296
|
* @param {TDate} day The date to test.
|
|
@@ -6,23 +6,67 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.DesktopDateTimePicker = 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 _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
12
|
var _utils = require("@mui/base/utils");
|
|
12
13
|
var _utils2 = require("@mui/utils");
|
|
14
|
+
var _Divider = _interopRequireDefault(require("@mui/material/Divider"));
|
|
13
15
|
var _valueManagers = require("../internals/utils/valueManagers");
|
|
14
16
|
var _DateTimeField = require("../DateTimeField");
|
|
15
17
|
var _shared = require("../DateTimePicker/shared");
|
|
16
18
|
var _dateViewRenderers = require("../dateViewRenderers/dateViewRenderers");
|
|
17
|
-
var _dateTimeViewRenderers = require("../dateTimeViewRenderers");
|
|
18
19
|
var _useUtils = require("../internals/hooks/useUtils");
|
|
19
20
|
var _validateDateTime = require("../internals/utils/validation/validateDateTime");
|
|
20
21
|
var _icons = require("../icons");
|
|
21
22
|
var _useDesktopPicker = require("../internals/hooks/useDesktopPicker");
|
|
22
23
|
var _extractValidationProps = require("../internals/utils/validation/extractValidationProps");
|
|
23
24
|
var _dateTimeUtils = require("../internals/utils/date-time-utils");
|
|
25
|
+
var _timeViewRenderers = require("../timeViewRenderers");
|
|
26
|
+
var _internals = require("../internals");
|
|
27
|
+
var _MultiSectionDigitalClock = require("../MultiSectionDigitalClock");
|
|
28
|
+
var _DigitalClock = require("../DigitalClock");
|
|
29
|
+
var _DesktopDateTimePickerLayout = require("./DesktopDateTimePickerLayout");
|
|
30
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
31
|
+
const _excluded = ["openTo", "focusedView", "timeViewsCount"];
|
|
24
32
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
25
33
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
34
|
+
const rendererInterceptor = function rendererInterceptor(inViewRenderers, popperView, rendererProps) {
|
|
35
|
+
const {
|
|
36
|
+
openTo,
|
|
37
|
+
focusedView,
|
|
38
|
+
timeViewsCount
|
|
39
|
+
} = rendererProps,
|
|
40
|
+
otherProps = (0, _objectWithoutPropertiesLoose2.default)(rendererProps, _excluded);
|
|
41
|
+
const finalProps = (0, _extends2.default)({}, otherProps, {
|
|
42
|
+
focusedView: null,
|
|
43
|
+
sx: [{
|
|
44
|
+
[`&.${_MultiSectionDigitalClock.multiSectionDigitalClockClasses.root}`]: {
|
|
45
|
+
borderBottom: 0
|
|
46
|
+
},
|
|
47
|
+
[`&.${_MultiSectionDigitalClock.multiSectionDigitalClockClasses.root}, .${_MultiSectionDigitalClock.multiSectionDigitalClockSectionClasses.root}, &.${_DigitalClock.digitalClockClasses.root}`]: {
|
|
48
|
+
maxHeight: _internals.VIEW_HEIGHT
|
|
49
|
+
}
|
|
50
|
+
}]
|
|
51
|
+
});
|
|
52
|
+
const isTimeViewActive = (0, _internals.isInternalTimeView)(popperView);
|
|
53
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
54
|
+
children: [inViewRenderers[!isTimeViewActive ? popperView : 'day']?.((0, _extends2.default)({}, rendererProps, {
|
|
55
|
+
view: !isTimeViewActive ? popperView : 'day',
|
|
56
|
+
focusedView: focusedView && (0, _internals.isDatePickerView)(focusedView) ? focusedView : null,
|
|
57
|
+
views: rendererProps.views.filter(_internals.isDatePickerView)
|
|
58
|
+
})), timeViewsCount > 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
59
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Divider.default, {
|
|
60
|
+
orientation: "vertical"
|
|
61
|
+
}), inViewRenderers[isTimeViewActive ? popperView : 'hours']?.((0, _extends2.default)({}, finalProps, {
|
|
62
|
+
view: isTimeViewActive ? popperView : 'hours',
|
|
63
|
+
focusedView: focusedView && (0, _internals.isInternalTimeView)(focusedView) ? focusedView : null,
|
|
64
|
+
openTo: (0, _internals.isInternalTimeView)(openTo) ? openTo : 'hours',
|
|
65
|
+
views: rendererProps.views.filter(_internals.isInternalTimeView)
|
|
66
|
+
}))]
|
|
67
|
+
})]
|
|
68
|
+
});
|
|
69
|
+
};
|
|
26
70
|
/**
|
|
27
71
|
* Demos:
|
|
28
72
|
*
|
|
@@ -42,32 +86,24 @@ const DesktopDateTimePicker = exports.DesktopDateTimePicker = /*#__PURE__*/React
|
|
|
42
86
|
const {
|
|
43
87
|
shouldRenderTimeInASingleColumn,
|
|
44
88
|
thresholdToRenderTimeInASingleColumn,
|
|
45
|
-
views,
|
|
89
|
+
views: resolvedViews,
|
|
46
90
|
timeSteps
|
|
47
91
|
} = (0, _dateTimeUtils.resolveTimeViewsResponse)(defaultizedProps);
|
|
48
|
-
const
|
|
49
|
-
const viewRenderers =
|
|
50
|
-
// we can only ensure the expected two-column layout if none of the renderers are overridden
|
|
51
|
-
shouldUseNewRenderer ? {
|
|
52
|
-
day: _dateTimeViewRenderers.renderDesktopDateTimeView,
|
|
53
|
-
month: _dateTimeViewRenderers.renderDesktopDateTimeView,
|
|
54
|
-
year: _dateTimeViewRenderers.renderDesktopDateTimeView,
|
|
55
|
-
hours: _dateTimeViewRenderers.renderDesktopDateTimeView,
|
|
56
|
-
minutes: _dateTimeViewRenderers.renderDesktopDateTimeView,
|
|
57
|
-
seconds: _dateTimeViewRenderers.renderDesktopDateTimeView,
|
|
58
|
-
meridiem: _dateTimeViewRenderers.renderDesktopDateTimeView
|
|
59
|
-
} : (0, _extends2.default)({
|
|
92
|
+
const renderTimeView = shouldRenderTimeInASingleColumn ? _timeViewRenderers.renderDigitalClockTimeView : _timeViewRenderers.renderMultiSectionDigitalClockTimeView;
|
|
93
|
+
const viewRenderers = (0, _extends2.default)({
|
|
60
94
|
day: _dateViewRenderers.renderDateViewCalendar,
|
|
61
95
|
month: _dateViewRenderers.renderDateViewCalendar,
|
|
62
96
|
year: _dateViewRenderers.renderDateViewCalendar,
|
|
63
|
-
hours:
|
|
64
|
-
minutes:
|
|
65
|
-
seconds:
|
|
66
|
-
meridiem:
|
|
97
|
+
hours: renderTimeView,
|
|
98
|
+
minutes: renderTimeView,
|
|
99
|
+
seconds: renderTimeView,
|
|
100
|
+
meridiem: renderTimeView
|
|
67
101
|
}, defaultizedProps.viewRenderers);
|
|
68
102
|
const ampmInClock = defaultizedProps.ampmInClock ?? true;
|
|
69
|
-
//
|
|
70
|
-
const
|
|
103
|
+
// Need to avoid adding the `meridiem` view when unexpected renderer is specified
|
|
104
|
+
const shouldHoursRendererContainMeridiemView = viewRenderers.hours?.name === _timeViewRenderers.renderMultiSectionDigitalClockTimeView.name;
|
|
105
|
+
const views = !shouldHoursRendererContainMeridiemView ? resolvedViews.filter(view => view !== 'meridiem') : resolvedViews;
|
|
106
|
+
const actionBarActions = shouldRenderTimeInASingleColumn ? [] : ['accept'];
|
|
71
107
|
|
|
72
108
|
// Props with the default values specific to the desktop variant
|
|
73
109
|
const props = (0, _extends2.default)({}, defaultizedProps, {
|
|
@@ -81,6 +117,7 @@ const DesktopDateTimePicker = exports.DesktopDateTimePicker = /*#__PURE__*/React
|
|
|
81
117
|
shouldRenderTimeInASingleColumn,
|
|
82
118
|
slots: (0, _extends2.default)({
|
|
83
119
|
field: _DateTimeField.DateTimeField,
|
|
120
|
+
layout: _DesktopDateTimePickerLayout.DesktopDateTimePickerLayout,
|
|
84
121
|
openPickerIcon: _icons.CalendarIcon
|
|
85
122
|
}, defaultizedProps.slots),
|
|
86
123
|
slotProps: (0, _extends2.default)({}, defaultizedProps.slotProps, {
|
|
@@ -90,14 +127,14 @@ const DesktopDateTimePicker = exports.DesktopDateTimePicker = /*#__PURE__*/React
|
|
|
90
127
|
toolbar: (0, _extends2.default)({
|
|
91
128
|
hidden: true,
|
|
92
129
|
ampmInClock,
|
|
93
|
-
toolbarVariant:
|
|
130
|
+
toolbarVariant: 'desktop'
|
|
94
131
|
}, defaultizedProps.slotProps?.toolbar),
|
|
95
132
|
tabs: (0, _extends2.default)({
|
|
96
133
|
hidden: true
|
|
97
134
|
}, defaultizedProps.slotProps?.tabs),
|
|
98
|
-
actionBar: (0, _extends2.default)({
|
|
135
|
+
actionBar: ownerState => (0, _extends2.default)({
|
|
99
136
|
actions: actionBarActions
|
|
100
|
-
}, defaultizedProps.slotProps?.actionBar)
|
|
137
|
+
}, (0, _utils.resolveComponentProps)(defaultizedProps.slotProps?.actionBar, ownerState))
|
|
101
138
|
})
|
|
102
139
|
});
|
|
103
140
|
const {
|
|
@@ -107,7 +144,8 @@ const DesktopDateTimePicker = exports.DesktopDateTimePicker = /*#__PURE__*/React
|
|
|
107
144
|
valueManager: _valueManagers.singleItemValueManager,
|
|
108
145
|
valueType: 'date-time',
|
|
109
146
|
getOpenDialogAriaText: props.localeText?.openDatePickerDialogue ?? localeText.openDatePickerDialogue,
|
|
110
|
-
validator: _validateDateTime.validateDateTime
|
|
147
|
+
validator: _validateDateTime.validateDateTime,
|
|
148
|
+
rendererInterceptor
|
|
111
149
|
});
|
|
112
150
|
return renderPicker();
|
|
113
151
|
});
|
|
@@ -366,7 +404,7 @@ DesktopDateTimePicker.propTypes = {
|
|
|
366
404
|
/**
|
|
367
405
|
* Disable specific date.
|
|
368
406
|
*
|
|
369
|
-
* Warning: This function can be called multiple times (
|
|
407
|
+
* Warning: This function can be called multiple times (for example when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
370
408
|
*
|
|
371
409
|
* @template TDate
|
|
372
410
|
* @param {TDate} day The date to test.
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.DesktopDateTimePickerLayout = DesktopDateTimePickerLayout;
|
|
8
|
+
var React = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
11
|
+
var _Divider = _interopRequireDefault(require("@mui/material/Divider"));
|
|
12
|
+
var _PickersLayout = require("../PickersLayout");
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
15
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
|
+
/**
|
|
17
|
+
* @ignore - internal component.
|
|
18
|
+
*/
|
|
19
|
+
function DesktopDateTimePickerLayout(props) {
|
|
20
|
+
const {
|
|
21
|
+
toolbar,
|
|
22
|
+
tabs,
|
|
23
|
+
content,
|
|
24
|
+
actionBar,
|
|
25
|
+
shortcuts
|
|
26
|
+
} = (0, _PickersLayout.usePickerLayout)(props);
|
|
27
|
+
const {
|
|
28
|
+
sx,
|
|
29
|
+
className,
|
|
30
|
+
isLandscape,
|
|
31
|
+
ref
|
|
32
|
+
} = props;
|
|
33
|
+
const isActionBarVisible = actionBar && (actionBar.props.actions?.length ?? 0) > 0;
|
|
34
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PickersLayout.PickersLayoutRoot, {
|
|
35
|
+
ref: ref,
|
|
36
|
+
className: (0, _clsx.default)(className, _PickersLayout.pickersLayoutClasses.root),
|
|
37
|
+
sx: [{
|
|
38
|
+
[`& .${_PickersLayout.pickersLayoutClasses.tabs}`]: {
|
|
39
|
+
gridRow: 4,
|
|
40
|
+
gridColumn: '1 / 4'
|
|
41
|
+
},
|
|
42
|
+
[`& .${_PickersLayout.pickersLayoutClasses.actionBar}`]: {
|
|
43
|
+
gridRow: 5
|
|
44
|
+
}
|
|
45
|
+
}, ...(Array.isArray(sx) ? sx : [sx])],
|
|
46
|
+
ownerState: props,
|
|
47
|
+
children: [isLandscape ? shortcuts : toolbar, isLandscape ? toolbar : shortcuts, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PickersLayout.PickersLayoutContentWrapper, {
|
|
48
|
+
className: _PickersLayout.pickersLayoutClasses.contentWrapper,
|
|
49
|
+
sx: {
|
|
50
|
+
display: 'grid'
|
|
51
|
+
},
|
|
52
|
+
children: [content, tabs, isActionBarVisible && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Divider.default, {
|
|
53
|
+
sx: {
|
|
54
|
+
gridRow: 3,
|
|
55
|
+
gridColumn: '1 / 4'
|
|
56
|
+
}
|
|
57
|
+
})]
|
|
58
|
+
}), actionBar]
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
process.env.NODE_ENV !== "production" ? DesktopDateTimePickerLayout.propTypes = {
|
|
62
|
+
// ----------------------------- Warning --------------------------------
|
|
63
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
64
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
65
|
+
// ----------------------------------------------------------------------
|
|
66
|
+
children: _propTypes.default.node,
|
|
67
|
+
/**
|
|
68
|
+
* Override or extend the styles applied to the component.
|
|
69
|
+
*/
|
|
70
|
+
classes: _propTypes.default.object,
|
|
71
|
+
className: _propTypes.default.string,
|
|
72
|
+
disabled: _propTypes.default.bool,
|
|
73
|
+
isLandscape: _propTypes.default.bool.isRequired,
|
|
74
|
+
isValid: _propTypes.default.func.isRequired,
|
|
75
|
+
onAccept: _propTypes.default.func.isRequired,
|
|
76
|
+
onCancel: _propTypes.default.func.isRequired,
|
|
77
|
+
onChange: _propTypes.default.func.isRequired,
|
|
78
|
+
onClear: _propTypes.default.func.isRequired,
|
|
79
|
+
onClose: _propTypes.default.func.isRequired,
|
|
80
|
+
onDismiss: _propTypes.default.func.isRequired,
|
|
81
|
+
onOpen: _propTypes.default.func.isRequired,
|
|
82
|
+
onSelectShortcut: _propTypes.default.func.isRequired,
|
|
83
|
+
onSetToday: _propTypes.default.func.isRequired,
|
|
84
|
+
onViewChange: _propTypes.default.func.isRequired,
|
|
85
|
+
/**
|
|
86
|
+
* Force rendering in particular orientation.
|
|
87
|
+
*/
|
|
88
|
+
orientation: _propTypes.default.oneOf(['landscape', 'portrait']),
|
|
89
|
+
readOnly: _propTypes.default.bool,
|
|
90
|
+
/**
|
|
91
|
+
* The props used for each component slot.
|
|
92
|
+
* @default {}
|
|
93
|
+
*/
|
|
94
|
+
slotProps: _propTypes.default.object,
|
|
95
|
+
/**
|
|
96
|
+
* Overridable component slots.
|
|
97
|
+
* @default {}
|
|
98
|
+
*/
|
|
99
|
+
slots: _propTypes.default.object,
|
|
100
|
+
/**
|
|
101
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
102
|
+
*/
|
|
103
|
+
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
104
|
+
value: _propTypes.default.any,
|
|
105
|
+
view: _propTypes.default.oneOf(['day', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'year']),
|
|
106
|
+
views: _propTypes.default.arrayOf(_propTypes.default.oneOf(['day', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'year']).isRequired).isRequired,
|
|
107
|
+
wrapperVariant: _propTypes.default.oneOf(['desktop', 'mobile'])
|
|
108
|
+
} : void 0;
|
|
@@ -9,4 +9,11 @@ Object.defineProperty(exports, "DesktopDateTimePicker", {
|
|
|
9
9
|
return _DesktopDateTimePicker.DesktopDateTimePicker;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
|
|
12
|
+
Object.defineProperty(exports, "DesktopDateTimePickerLayout", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _DesktopDateTimePickerLayout.DesktopDateTimePickerLayout;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _DesktopDateTimePicker = require("./DesktopDateTimePicker");
|
|
19
|
+
var _DesktopDateTimePickerLayout = require("./DesktopDateTimePickerLayout");
|
|
@@ -287,7 +287,7 @@ MobileDatePicker.propTypes = {
|
|
|
287
287
|
/**
|
|
288
288
|
* Disable specific date.
|
|
289
289
|
*
|
|
290
|
-
* Warning: This function can be called multiple times (
|
|
290
|
+
* Warning: This function can be called multiple times (for example when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
291
291
|
*
|
|
292
292
|
* @template TDate
|
|
293
293
|
* @param {TDate} day The date to test.
|
|
@@ -335,7 +335,7 @@ MobileDateTimePicker.propTypes = {
|
|
|
335
335
|
/**
|
|
336
336
|
* Disable specific date.
|
|
337
337
|
*
|
|
338
|
-
* Warning: This function can be called multiple times (
|
|
338
|
+
* Warning: This function can be called multiple times (for example when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
339
339
|
*
|
|
340
340
|
* @template TDate
|
|
341
341
|
* @param {TDate} day The date to test.
|
|
@@ -217,7 +217,7 @@ StaticDatePicker.propTypes = {
|
|
|
217
217
|
/**
|
|
218
218
|
* Disable specific date.
|
|
219
219
|
*
|
|
220
|
-
* Warning: This function can be called multiple times (
|
|
220
|
+
* Warning: This function can be called multiple times (for example when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
221
221
|
*
|
|
222
222
|
* @template TDate
|
|
223
223
|
* @param {TDate} day The date to test.
|
|
@@ -265,7 +265,7 @@ StaticDateTimePicker.propTypes = {
|
|
|
265
265
|
/**
|
|
266
266
|
* Disable specific date.
|
|
267
267
|
*
|
|
268
|
-
* Warning: This function can be called multiple times (
|
|
268
|
+
* Warning: This function can be called multiple times (for example when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
269
269
|
*
|
|
270
270
|
* @template TDate
|
|
271
271
|
* @param {TDate} day The date to test.
|
package/node/index.js
CHANGED
|
@@ -155,7 +155,7 @@ function useClickAwayListener(active, onClickAway) {
|
|
|
155
155
|
// TODO This behavior is not tested automatically
|
|
156
156
|
// It's unclear whether this is due to different update semantics in test (batched in act() vs discrete on click).
|
|
157
157
|
// Or if this is a timing related issues due to different Transition components
|
|
158
|
-
// Once we get rid of all the manual scheduling (
|
|
158
|
+
// Once we get rid of all the manual scheduling (for example setTimeout(update, 0)) we can revisit this code+test.
|
|
159
159
|
if (active) {
|
|
160
160
|
const doc = (0, _utils2.unstable_ownerDocument)(nodeRef.current);
|
|
161
161
|
doc.addEventListener('click', handleClickAway);
|
|
@@ -159,49 +159,53 @@ const buildSections = params => {
|
|
|
159
159
|
const sections = [];
|
|
160
160
|
let startSeparator = '';
|
|
161
161
|
|
|
162
|
-
// This RegExp
|
|
163
|
-
const
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
162
|
+
// This RegExp tests if the beginning of a string corresponds to a supported token
|
|
163
|
+
const validTokens = Object.keys(utils.formatTokenMap).sort((a, b) => b.length - a.length); // Sort to put longest word first
|
|
164
|
+
|
|
165
|
+
const regExpFirstWordInFormat = /^([a-zA-Z]+)/;
|
|
166
|
+
const regExpWordOnlyComposedOfTokens = new RegExp(`^(${validTokens.join('|')})*$`);
|
|
167
|
+
const regExpFirstTokenInWord = new RegExp(`^(${validTokens.join('|')})`);
|
|
168
|
+
const getEscapedPartOfCurrentChar = i => escapedParts.find(escapeIndex => escapeIndex.start <= i && escapeIndex.end >= i);
|
|
169
|
+
let i = 0;
|
|
170
|
+
while (i < expandedFormat.length) {
|
|
171
|
+
const escapedPartOfCurrentChar = getEscapedPartOfCurrentChar(i);
|
|
170
172
|
const isEscapedChar = escapedPartOfCurrentChar != null;
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
173
|
+
const firstWordInFormat = regExpFirstWordInFormat.exec(expandedFormat.slice(i))?.[1];
|
|
174
|
+
|
|
175
|
+
// The first word in the format is only composed of tokens.
|
|
176
|
+
// We extract those tokens to create a new sections.
|
|
177
|
+
if (!isEscapedChar && firstWordInFormat != null && regExpWordOnlyComposedOfTokens.test(firstWordInFormat)) {
|
|
178
|
+
let word = firstWordInFormat;
|
|
179
|
+
while (word.length > 0) {
|
|
180
|
+
const firstWord = regExpFirstTokenInWord.exec(word)[1];
|
|
181
|
+
word = word.slice(firstWord.length);
|
|
182
|
+
sections.push(createSection((0, _extends2.default)({}, params, {
|
|
183
|
+
now,
|
|
184
|
+
token: firstWord,
|
|
185
|
+
startSeparator
|
|
186
|
+
})));
|
|
187
|
+
startSeparator = '';
|
|
188
|
+
}
|
|
189
|
+
i += firstWordInFormat.length;
|
|
190
|
+
}
|
|
191
|
+
// The remaining format does not start with a token,
|
|
192
|
+
// We take the first character and add it to the current section's end separator.
|
|
193
|
+
else {
|
|
194
|
+
const char = expandedFormat[i];
|
|
195
|
+
|
|
177
196
|
// If we are on the opening or closing character of an escaped part of the format,
|
|
178
197
|
// Then we ignore this character.
|
|
179
198
|
const isEscapeBoundary = isEscapedChar && escapedPartOfCurrentChar?.start === i || escapedPartOfCurrentChar?.end === i;
|
|
180
199
|
if (!isEscapeBoundary) {
|
|
181
|
-
if (currentTokenValue !== '') {
|
|
182
|
-
sections.push(createSection((0, _extends2.default)({}, params, {
|
|
183
|
-
now,
|
|
184
|
-
token: currentTokenValue,
|
|
185
|
-
startSeparator
|
|
186
|
-
})));
|
|
187
|
-
currentTokenValue = '';
|
|
188
|
-
}
|
|
189
200
|
if (sections.length === 0) {
|
|
190
201
|
startSeparator += char;
|
|
191
202
|
} else {
|
|
192
|
-
startSeparator = '';
|
|
193
203
|
sections[sections.length - 1].endSeparator += char;
|
|
194
204
|
}
|
|
195
205
|
}
|
|
206
|
+
i += 1;
|
|
196
207
|
}
|
|
197
208
|
}
|
|
198
|
-
if (currentTokenValue !== '') {
|
|
199
|
-
sections.push(createSection((0, _extends2.default)({}, params, {
|
|
200
|
-
now,
|
|
201
|
-
token: currentTokenValue,
|
|
202
|
-
startSeparator
|
|
203
|
-
})));
|
|
204
|
-
}
|
|
205
209
|
if (sections.length === 0 && startSeparator.length > 0) {
|
|
206
210
|
sections.push({
|
|
207
211
|
type: 'empty',
|
|
@@ -375,7 +375,7 @@ const useFieldV7TextField = params => {
|
|
|
375
375
|
const valueStr = React.useMemo(() => areAllSectionsEmpty ? '' : fieldValueManager.getV7HiddenInputValueFromSections(state.sections), [areAllSectionsEmpty, state.sections, fieldValueManager]);
|
|
376
376
|
React.useEffect(() => {
|
|
377
377
|
if (sectionListRef.current == null) {
|
|
378
|
-
throw new Error(['MUI X: The `sectionListRef` prop has not been initialized by `PickersSectionList`', 'You probably tried to pass a component to the `textField` slot that contains an `<input />` element instead of a `PickersSectionList`.', '', 'If you want to keep using an `<input />` HTML element for the editing, please remove the `enableAccessibleFieldDOMStructure` prop from your picker or field component:', '', '<DatePicker slots={{ textField: MyCustomTextField }} />', '', 'Learn more about the field accessible DOM structure on the MUI documentation: https://
|
|
378
|
+
throw new Error(['MUI X: The `sectionListRef` prop has not been initialized by `PickersSectionList`', 'You probably tried to pass a component to the `textField` slot that contains an `<input />` element instead of a `PickersSectionList`.', '', 'If you want to keep using an `<input />` HTML element for the editing, please remove the `enableAccessibleFieldDOMStructure` prop from your picker or field component:', '', '<DatePicker slots={{ textField: MyCustomTextField }} />', '', 'Learn more about the field accessible DOM structure on the MUI documentation: https://mui.com/x/react-date-pickers/fields/#fields-to-edit-a-single-element'].join('\n'));
|
|
379
379
|
}
|
|
380
380
|
if (autoFocus && sectionListRef.current) {
|
|
381
381
|
sectionListRef.current.getSectionContent(sectionOrder.startIndex).focus();
|
|
@@ -16,7 +16,7 @@ const useOpenState = ({
|
|
|
16
16
|
const [openState, setIsOpenState] = React.useState(false);
|
|
17
17
|
|
|
18
18
|
// It is required to update inner state in useEffect in order to avoid situation when
|
|
19
|
-
// Our component is not mounted yet, but `open` state is set to `true` (
|
|
19
|
+
// Our component is not mounted yet, but `open` state is set to `true` (for example initially opened)
|
|
20
20
|
React.useEffect(() => {
|
|
21
21
|
if (isControllingOpenProp) {
|
|
22
22
|
if (typeof open !== 'boolean') {
|
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.splitFieldInternalAndForwardedProps = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _extractValidationProps = require("./validation/extractValidationProps");
|
|
10
|
-
const SHARED_FIELD_INTERNAL_PROP_NAMES = ['value', 'defaultValue', 'referenceDate', 'format', 'formatDensity', 'onChange', 'timezone', 'onError', 'shouldRespectLeadingZeros', 'selectedSections', 'onSelectedSectionsChange', 'unstableFieldRef', 'enableAccessibleFieldDOMStructure', 'disabled', 'readOnly'];
|
|
10
|
+
const SHARED_FIELD_INTERNAL_PROP_NAMES = ['value', 'defaultValue', 'referenceDate', 'format', 'formatDensity', 'onChange', 'timezone', 'onError', 'shouldRespectLeadingZeros', 'selectedSections', 'onSelectedSectionsChange', 'unstableFieldRef', 'enableAccessibleFieldDOMStructure', 'disabled', 'readOnly', 'dateSeparator'];
|
|
11
11
|
const splitFieldInternalAndForwardedProps = (props, valueType) => {
|
|
12
12
|
const forwardedProps = (0, _extends2.default)({}, props);
|
|
13
13
|
const internalProps = {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-date-pickers",
|
|
3
|
-
"version": "7.0.0
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "The community edition of the date picker components (MUI X).",
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"main": "./node/index.js",
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@babel/runtime": "^7.24.0",
|
|
38
|
-
"@mui/base": "^5.0.0-beta.
|
|
39
|
-
"@mui/system": "^5.15.
|
|
40
|
-
"@mui/utils": "^5.15.
|
|
38
|
+
"@mui/base": "^5.0.0-beta.40",
|
|
39
|
+
"@mui/system": "^5.15.14",
|
|
40
|
+
"@mui/utils": "^5.15.14",
|
|
41
41
|
"@types/react-transition-group": "^4.4.10",
|
|
42
42
|
"clsx": "^2.1.0",
|
|
43
43
|
"prop-types": "^15.8.1",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"@emotion/react": "^11.9.0",
|
|
48
48
|
"@emotion/styled": "^11.8.1",
|
|
49
|
-
"@mui/material": "^5.15.
|
|
49
|
+
"@mui/material": "^5.15.14",
|
|
50
50
|
"date-fns": "^2.25.0 || ^3.2.0",
|
|
51
51
|
"date-fns-jalali": "^2.13.0-0",
|
|
52
52
|
"dayjs": "^1.10.7",
|
|
@@ -118,7 +118,7 @@ export const renderDigitalClockTimeView = ({
|
|
|
118
118
|
sx: sx,
|
|
119
119
|
autoFocus: autoFocus,
|
|
120
120
|
disableIgnoringDatePartForTimeValidation: disableIgnoringDatePartForTimeValidation,
|
|
121
|
-
timeStep: timeSteps
|
|
121
|
+
timeStep: timeSteps?.minutes,
|
|
122
122
|
skipDisabled: skipDisabled,
|
|
123
123
|
timezone: timezone
|
|
124
124
|
});
|