@mui/x-date-pickers-pro 6.0.3 → 6.1.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 +119 -0
- package/DateRangeCalendar/useDragRange.d.ts +1 -1
- package/DateRangePicker/DateRangePicker.js +12 -0
- package/DateRangePicker/DateRangePickerToolbar.d.ts +1 -1
- package/DateRangePicker/shared.d.ts +1 -1
- package/DesktopDateRangePicker/DesktopDateRangePicker.js +12 -0
- package/MobileDateRangePicker/MobileDateRangePicker.js +12 -0
- package/MultiInputDateRangeField/MultiInputDateRangeField.js +10 -0
- package/MultiInputDateRangeField/MultiInputDateRangeField.types.d.ts +1 -1
- package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +10 -0
- package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.d.ts +1 -1
- package/MultiInputTimeRangeField/MultiInputTimeRangeField.js +10 -0
- package/MultiInputTimeRangeField/MultiInputTimeRangeField.types.d.ts +1 -1
- package/README.md +2 -2
- package/SingleInputDateRangeField/SingleInputDateRangeField.d.ts +1 -0
- package/SingleInputDateRangeField/SingleInputDateRangeField.js +23 -11
- package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.d.ts +1 -0
- package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +27 -15
- package/SingleInputTimeRangeField/SingleInputTimeRangeField.d.ts +1 -0
- package/SingleInputTimeRangeField/SingleInputTimeRangeField.js +27 -15
- package/dateRangeViewRenderers/dateRangeViewRenderers.d.ts +1 -1
- package/index.js +1 -1
- package/internal/hooks/useDesktopRangePicker/useDesktopRangePicker.d.ts +1 -1
- package/internal/hooks/useDesktopRangePicker/useDesktopRangePicker.js +32 -40
- package/internal/hooks/useDesktopRangePicker/useDesktopRangePicker.types.d.ts +9 -29
- package/internal/hooks/useEnrichedRangePickerFieldProps.d.ts +53 -0
- package/internal/hooks/useEnrichedRangePickerFieldProps.js +202 -0
- package/internal/hooks/useMobileRangePicker/useMobileRangePicker.d.ts +1 -1
- package/internal/hooks/useMobileRangePicker/useMobileRangePicker.js +36 -39
- package/internal/hooks/useMobileRangePicker/useMobileRangePicker.types.d.ts +9 -28
- package/internal/hooks/useMultiInputRangeField/useMultiInputDateRangeField.d.ts +1 -1
- package/internal/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.d.ts +1 -1
- package/internal/hooks/useMultiInputRangeField/useMultiInputRangeField.types.d.ts +3 -3
- package/internal/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.d.ts +1 -1
- package/internal/hooks/useRangePosition.d.ts +4 -0
- package/internal/hooks/useRangePosition.js +16 -1
- package/internal/hooks/useStaticRangePicker/useStaticRangePicker.d.ts +1 -1
- package/internal/hooks/useStaticRangePicker/useStaticRangePicker.types.d.ts +3 -2
- package/internal/hooks/validation/useDateRangeValidation.d.ts +2 -1
- package/internal/hooks/validation/useDateTimeRangeValidation.d.ts +2 -1
- package/internal/hooks/validation/useTimeRangeValidation.d.ts +2 -1
- package/internal/models/fields.d.ts +7 -2
- package/internal/models/index.d.ts +1 -0
- package/internal/models/index.js +2 -1
- package/internal/models/rangePickerProps.d.ts +17 -0
- package/internal/models/rangePickerProps.js +1 -0
- package/internal/utils/date-range-manager.d.ts +1 -1
- package/internal/utils/date-utils.d.ts +1 -1
- package/internal/utils/releaseInfo.js +1 -1
- package/internal/utils/valueManagers.d.ts +1 -1
- package/internal/utils/valueManagers.js +23 -21
- package/legacy/DateRangePicker/DateRangePicker.js +12 -0
- package/legacy/DesktopDateRangePicker/DesktopDateRangePicker.js +12 -0
- package/legacy/MobileDateRangePicker/MobileDateRangePicker.js +12 -0
- package/legacy/MultiInputDateRangeField/MultiInputDateRangeField.js +10 -0
- package/legacy/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +10 -0
- package/legacy/MultiInputTimeRangeField/MultiInputTimeRangeField.js +10 -0
- package/legacy/SingleInputDateRangeField/SingleInputDateRangeField.js +20 -10
- package/legacy/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +24 -14
- package/legacy/SingleInputTimeRangeField/SingleInputTimeRangeField.js +24 -14
- package/legacy/index.js +1 -1
- package/legacy/internal/hooks/useDesktopRangePicker/useDesktopRangePicker.js +32 -40
- package/legacy/internal/hooks/useEnrichedRangePickerFieldProps.js +200 -0
- package/legacy/internal/hooks/useMobileRangePicker/useMobileRangePicker.js +36 -39
- package/legacy/internal/hooks/useRangePosition.js +16 -1
- package/legacy/internal/models/index.js +2 -1
- package/legacy/internal/models/rangePickerProps.js +1 -0
- package/legacy/internal/utils/releaseInfo.js +1 -1
- package/legacy/internal/utils/valueManagers.js +24 -22
- package/modern/DateRangePicker/DateRangePicker.js +12 -0
- package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +12 -0
- package/modern/MobileDateRangePicker/MobileDateRangePicker.js +12 -0
- package/modern/MultiInputDateRangeField/MultiInputDateRangeField.js +10 -0
- package/modern/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +10 -0
- package/modern/MultiInputTimeRangeField/MultiInputTimeRangeField.js +10 -0
- package/modern/SingleInputDateRangeField/SingleInputDateRangeField.js +23 -11
- package/modern/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +27 -15
- package/modern/SingleInputTimeRangeField/SingleInputTimeRangeField.js +27 -15
- package/modern/index.js +1 -1
- package/modern/internal/hooks/useDesktopRangePicker/useDesktopRangePicker.js +30 -38
- package/modern/internal/hooks/useEnrichedRangePickerFieldProps.js +195 -0
- package/modern/internal/hooks/useMobileRangePicker/useMobileRangePicker.js +35 -38
- package/modern/internal/hooks/useRangePosition.js +16 -1
- package/modern/internal/models/index.js +2 -1
- package/modern/internal/models/rangePickerProps.js +1 -0
- package/modern/internal/utils/releaseInfo.js +1 -1
- package/modern/internal/utils/valueManagers.js +23 -21
- package/node/DateRangePicker/DateRangePicker.js +12 -0
- package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +12 -0
- package/node/MobileDateRangePicker/MobileDateRangePicker.js +12 -0
- package/node/MultiInputDateRangeField/MultiInputDateRangeField.js +10 -0
- package/node/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +10 -0
- package/node/MultiInputTimeRangeField/MultiInputTimeRangeField.js +10 -0
- package/node/SingleInputDateRangeField/SingleInputDateRangeField.js +23 -11
- package/node/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +26 -14
- package/node/SingleInputTimeRangeField/SingleInputTimeRangeField.js +26 -14
- package/node/index.js +1 -1
- package/node/internal/hooks/useDesktopRangePicker/useDesktopRangePicker.js +29 -37
- package/node/internal/hooks/useEnrichedRangePickerFieldProps.js +205 -0
- package/node/internal/hooks/useMobileRangePicker/useMobileRangePicker.js +34 -37
- package/node/internal/hooks/useRangePosition.js +18 -1
- package/node/internal/models/index.js +11 -0
- package/node/internal/models/rangePickerProps.js +5 -0
- package/node/internal/utils/releaseInfo.js +1 -1
- package/node/internal/utils/valueManagers.js +22 -20
- package/package.json +5 -5
- package/internal/hooks/useRangePickerInputProps.d.ts +0 -19
- package/internal/hooks/useRangePickerInputProps.js +0 -89
- package/legacy/internal/hooks/useRangePickerInputProps.js +0 -88
- package/modern/internal/hooks/useRangePickerInputProps.js +0 -86
- package/node/internal/hooks/useRangePickerInputProps.js +0 -96
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { useSlotProps } from '@mui/base/utils';
|
|
4
4
|
import { useLicenseVerifier } from '@mui/x-license-pro';
|
|
5
5
|
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
|
|
6
6
|
import { PickersLayout } from '@mui/x-date-pickers/PickersLayout';
|
|
7
7
|
import { executeInTheNextEventLoopTick, getActiveElement, usePicker, PickersPopper } from '@mui/x-date-pickers/internals';
|
|
8
|
-
import {
|
|
8
|
+
import { useEnrichedRangePickerFieldProps } from '../useEnrichedRangePickerFieldProps';
|
|
9
9
|
import { getReleaseInfo } from '../../utils/releaseInfo';
|
|
10
10
|
import { useRangePosition } from '../useRangePosition';
|
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
var releaseInfo = getReleaseInfo();
|
|
14
14
|
export var useDesktopRangePicker = function useDesktopRangePicker(_ref) {
|
|
15
|
-
var _slots$layout;
|
|
15
|
+
var _fieldType, _slots$layout;
|
|
16
16
|
var props = _ref.props,
|
|
17
17
|
valueManager = _ref.valueManager,
|
|
18
18
|
validator = _ref.validator;
|
|
@@ -22,16 +22,19 @@ export var useDesktopRangePicker = function useDesktopRangePicker(_ref) {
|
|
|
22
22
|
className = props.className,
|
|
23
23
|
sx = props.sx,
|
|
24
24
|
format = props.format,
|
|
25
|
+
label = props.label,
|
|
26
|
+
inputRef = props.inputRef,
|
|
25
27
|
readOnly = props.readOnly,
|
|
26
28
|
disabled = props.disabled,
|
|
27
29
|
autoFocus = props.autoFocus,
|
|
28
30
|
disableOpenPicker = props.disableOpenPicker,
|
|
29
31
|
localeText = props.localeText;
|
|
30
|
-
var
|
|
32
|
+
var fieldContainerRef = React.useRef(null);
|
|
31
33
|
var popperRef = React.useRef(null);
|
|
32
34
|
var _useRangePosition = useRangePosition(props),
|
|
33
35
|
rangePosition = _useRangePosition.rangePosition,
|
|
34
|
-
onRangePositionChange = _useRangePosition.onRangePositionChange
|
|
36
|
+
onRangePositionChange = _useRangePosition.onRangePositionChange,
|
|
37
|
+
singleInputFieldRef = _useRangePosition.singleInputFieldRef;
|
|
35
38
|
var _usePicker = usePicker({
|
|
36
39
|
props: props,
|
|
37
40
|
valueManager: valueManager,
|
|
@@ -51,26 +54,15 @@ export var useDesktopRangePicker = function useDesktopRangePicker(_ref) {
|
|
|
51
54
|
pickerFieldProps = _usePicker.fieldProps;
|
|
52
55
|
var handleBlur = function handleBlur() {
|
|
53
56
|
executeInTheNextEventLoopTick(function () {
|
|
54
|
-
var
|
|
55
|
-
if ((
|
|
57
|
+
var _fieldContainerRef$cu, _popperRef$current;
|
|
58
|
+
if ((_fieldContainerRef$cu = fieldContainerRef.current) != null && _fieldContainerRef$cu.contains(getActiveElement(document)) || (_popperRef$current = popperRef.current) != null && _popperRef$current.contains(getActiveElement(document))) {
|
|
56
59
|
return;
|
|
57
60
|
}
|
|
58
61
|
actions.onDismiss();
|
|
59
62
|
});
|
|
60
63
|
};
|
|
61
|
-
var fieldSlotProps = useRangePickerInputProps({
|
|
62
|
-
wrapperVariant: 'desktop',
|
|
63
|
-
open: open,
|
|
64
|
-
actions: actions,
|
|
65
|
-
readOnly: readOnly,
|
|
66
|
-
disabled: disabled,
|
|
67
|
-
disableOpenPicker: disableOpenPicker,
|
|
68
|
-
localeText: localeText,
|
|
69
|
-
onBlur: handleBlur,
|
|
70
|
-
rangePosition: rangePosition,
|
|
71
|
-
onRangePositionChange: onRangePositionChange
|
|
72
|
-
});
|
|
73
64
|
var Field = slots.field;
|
|
65
|
+
var fieldType = (_fieldType = Field.fieldType) != null ? _fieldType : 'multi-input';
|
|
74
66
|
var fieldProps = useSlotProps({
|
|
75
67
|
elementType: Field,
|
|
76
68
|
externalSlotProps: slotProps == null ? void 0 : slotProps.field,
|
|
@@ -81,25 +73,28 @@ export var useDesktopRangePicker = function useDesktopRangePicker(_ref) {
|
|
|
81
73
|
sx: sx,
|
|
82
74
|
format: format,
|
|
83
75
|
autoFocus: autoFocus && !props.open,
|
|
84
|
-
ref:
|
|
76
|
+
ref: fieldContainerRef
|
|
77
|
+
}, fieldType === 'single-input' && {
|
|
78
|
+
inputRef: inputRef
|
|
85
79
|
}),
|
|
86
80
|
ownerState: props
|
|
87
81
|
});
|
|
88
|
-
var
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
82
|
+
var enrichedFieldProps = useEnrichedRangePickerFieldProps({
|
|
83
|
+
wrapperVariant: 'desktop',
|
|
84
|
+
fieldType: fieldType,
|
|
85
|
+
open: open,
|
|
86
|
+
actions: actions,
|
|
87
|
+
readOnly: readOnly,
|
|
88
|
+
disableOpenPicker: disableOpenPicker,
|
|
89
|
+
label: label,
|
|
90
|
+
localeText: localeText,
|
|
91
|
+
onBlur: handleBlur,
|
|
92
|
+
rangePosition: rangePosition,
|
|
93
|
+
onRangePositionChange: onRangePositionChange,
|
|
94
|
+
singleInputFieldRef: singleInputFieldRef,
|
|
95
|
+
pickerSlotProps: slotProps,
|
|
96
|
+
pickerSlots: slots,
|
|
97
|
+
fieldProps: fieldProps
|
|
103
98
|
});
|
|
104
99
|
var slotPropsForLayout = _extends({}, slotProps, {
|
|
105
100
|
toolbar: _extends({}, slotProps == null ? void 0 : slotProps.toolbar, {
|
|
@@ -111,13 +106,10 @@ export var useDesktopRangePicker = function useDesktopRangePicker(_ref) {
|
|
|
111
106
|
var renderPicker = function renderPicker() {
|
|
112
107
|
return /*#__PURE__*/_jsxs(LocalizationProvider, {
|
|
113
108
|
localeText: localeText,
|
|
114
|
-
children: [/*#__PURE__*/_jsx(Field, _extends({},
|
|
115
|
-
slots: slotsForField,
|
|
116
|
-
slotProps: slotPropsForField
|
|
117
|
-
})), /*#__PURE__*/_jsx(PickersPopper, _extends({
|
|
109
|
+
children: [/*#__PURE__*/_jsx(Field, _extends({}, enrichedFieldProps)), /*#__PURE__*/_jsx(PickersPopper, _extends({
|
|
118
110
|
role: "tooltip",
|
|
119
111
|
containerRef: popperRef,
|
|
120
|
-
anchorEl:
|
|
112
|
+
anchorEl: fieldContainerRef.current,
|
|
121
113
|
onBlur: handleBlur
|
|
122
114
|
}, actions, {
|
|
123
115
|
open: open,
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { resolveComponentProps } from '@mui/base/utils';
|
|
4
|
+
import useEventCallback from '@mui/utils/useEventCallback';
|
|
5
|
+
import useForkRef from '@mui/utils/useForkRef';
|
|
6
|
+
import { onSpaceOrEnter, useLocaleText, getActiveElement } from '@mui/x-date-pickers/internals';
|
|
7
|
+
var useMultiInputFieldSlotProps = function useMultiInputFieldSlotProps(_ref) {
|
|
8
|
+
var wrapperVariant = _ref.wrapperVariant,
|
|
9
|
+
open = _ref.open,
|
|
10
|
+
actions = _ref.actions,
|
|
11
|
+
readOnly = _ref.readOnly,
|
|
12
|
+
labelId = _ref.labelId,
|
|
13
|
+
disableOpenPicker = _ref.disableOpenPicker,
|
|
14
|
+
onBlur = _ref.onBlur,
|
|
15
|
+
rangePosition = _ref.rangePosition,
|
|
16
|
+
onRangePositionChange = _ref.onRangePositionChange,
|
|
17
|
+
inLocaleText = _ref.localeText,
|
|
18
|
+
pickerSlotProps = _ref.pickerSlotProps,
|
|
19
|
+
pickerSlots = _ref.pickerSlots,
|
|
20
|
+
fieldProps = _ref.fieldProps;
|
|
21
|
+
var localeText = useLocaleText();
|
|
22
|
+
var startRef = React.useRef(null);
|
|
23
|
+
var endRef = React.useRef(null);
|
|
24
|
+
React.useEffect(function () {
|
|
25
|
+
if (!open) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (rangePosition === 'start') {
|
|
29
|
+
var _startRef$current;
|
|
30
|
+
(_startRef$current = startRef.current) == null ? void 0 : _startRef$current.focus();
|
|
31
|
+
} else if (rangePosition === 'end') {
|
|
32
|
+
var _endRef$current;
|
|
33
|
+
(_endRef$current = endRef.current) == null ? void 0 : _endRef$current.focus();
|
|
34
|
+
}
|
|
35
|
+
}, [rangePosition, open]);
|
|
36
|
+
var openRangeStartSelection = function openRangeStartSelection(event) {
|
|
37
|
+
event.stopPropagation();
|
|
38
|
+
onRangePositionChange('start');
|
|
39
|
+
if (!readOnly && !disableOpenPicker) {
|
|
40
|
+
actions.onOpen();
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
var openRangeEndSelection = function openRangeEndSelection(event) {
|
|
44
|
+
event.stopPropagation();
|
|
45
|
+
onRangePositionChange('end');
|
|
46
|
+
if (!readOnly && !disableOpenPicker) {
|
|
47
|
+
actions.onOpen();
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
var handleFocusStart = function handleFocusStart() {
|
|
51
|
+
if (open) {
|
|
52
|
+
onRangePositionChange('start');
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
var handleFocusEnd = function handleFocusEnd() {
|
|
56
|
+
if (open) {
|
|
57
|
+
onRangePositionChange('end');
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
var slots = _extends({
|
|
61
|
+
textField: pickerSlots == null ? void 0 : pickerSlots.textField,
|
|
62
|
+
root: pickerSlots == null ? void 0 : pickerSlots.fieldRoot,
|
|
63
|
+
separator: pickerSlots == null ? void 0 : pickerSlots.fieldSeparator
|
|
64
|
+
}, fieldProps.slots);
|
|
65
|
+
var slotProps = _extends({}, fieldProps.slotProps, {
|
|
66
|
+
textField: function textField(ownerState) {
|
|
67
|
+
var inputProps;
|
|
68
|
+
if (ownerState.position === 'start') {
|
|
69
|
+
var _inLocaleText$start;
|
|
70
|
+
inputProps = _extends({
|
|
71
|
+
inputRef: startRef,
|
|
72
|
+
label: (_inLocaleText$start = inLocaleText == null ? void 0 : inLocaleText.start) != null ? _inLocaleText$start : localeText.start,
|
|
73
|
+
onKeyDown: onSpaceOrEnter(openRangeStartSelection),
|
|
74
|
+
onFocus: handleFocusStart,
|
|
75
|
+
focused: open ? rangePosition === 'start' : undefined
|
|
76
|
+
}, !readOnly && !fieldProps.disabled && {
|
|
77
|
+
onClick: openRangeStartSelection
|
|
78
|
+
}, wrapperVariant === 'mobile' && {
|
|
79
|
+
readOnly: true
|
|
80
|
+
});
|
|
81
|
+
} else {
|
|
82
|
+
var _inLocaleText$end;
|
|
83
|
+
inputProps = _extends({
|
|
84
|
+
inputRef: endRef,
|
|
85
|
+
label: (_inLocaleText$end = inLocaleText == null ? void 0 : inLocaleText.end) != null ? _inLocaleText$end : localeText.end,
|
|
86
|
+
onKeyDown: onSpaceOrEnter(openRangeEndSelection),
|
|
87
|
+
onFocus: handleFocusEnd,
|
|
88
|
+
focused: open ? rangePosition === 'end' : undefined
|
|
89
|
+
}, !readOnly && !fieldProps.disabled && {
|
|
90
|
+
onClick: openRangeEndSelection
|
|
91
|
+
}, wrapperVariant === 'mobile' && {
|
|
92
|
+
readOnly: true
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
return _extends({}, labelId != null && {
|
|
96
|
+
id: "".concat(labelId, "-").concat(ownerState.position)
|
|
97
|
+
}, inputProps, resolveComponentProps(pickerSlotProps == null ? void 0 : pickerSlotProps.textField, ownerState));
|
|
98
|
+
},
|
|
99
|
+
root: function root(ownerState) {
|
|
100
|
+
var rootProps = {
|
|
101
|
+
onBlur: onBlur
|
|
102
|
+
};
|
|
103
|
+
return _extends({}, rootProps, resolveComponentProps(pickerSlotProps == null ? void 0 : pickerSlotProps.fieldRoot, ownerState));
|
|
104
|
+
},
|
|
105
|
+
separator: pickerSlotProps == null ? void 0 : pickerSlotProps.fieldSeparator
|
|
106
|
+
});
|
|
107
|
+
var enrichedFieldProps = _extends({}, fieldProps, {
|
|
108
|
+
slots: slots,
|
|
109
|
+
slotProps: slotProps
|
|
110
|
+
});
|
|
111
|
+
return enrichedFieldProps;
|
|
112
|
+
};
|
|
113
|
+
var useSingleInputFieldSlotProps = function useSingleInputFieldSlotProps(_ref2) {
|
|
114
|
+
var wrapperVariant = _ref2.wrapperVariant,
|
|
115
|
+
open = _ref2.open,
|
|
116
|
+
actions = _ref2.actions,
|
|
117
|
+
readOnly = _ref2.readOnly,
|
|
118
|
+
inInputRef = _ref2.inputRef,
|
|
119
|
+
labelId = _ref2.labelId,
|
|
120
|
+
disableOpenPicker = _ref2.disableOpenPicker,
|
|
121
|
+
label = _ref2.label,
|
|
122
|
+
onBlur = _ref2.onBlur,
|
|
123
|
+
rangePosition = _ref2.rangePosition,
|
|
124
|
+
onRangePositionChange = _ref2.onRangePositionChange,
|
|
125
|
+
singleInputFieldRef = _ref2.singleInputFieldRef,
|
|
126
|
+
pickerSlots = _ref2.pickerSlots,
|
|
127
|
+
pickerSlotProps = _ref2.pickerSlotProps,
|
|
128
|
+
fieldProps = _ref2.fieldProps;
|
|
129
|
+
var inputRef = React.useRef(null);
|
|
130
|
+
var handleInputRef = useForkRef(inInputRef, inputRef);
|
|
131
|
+
var handleFieldRef = useForkRef(fieldProps.unstableFieldRef, singleInputFieldRef);
|
|
132
|
+
React.useEffect(function () {
|
|
133
|
+
var _inputRef$current;
|
|
134
|
+
if (!open) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
(_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus();
|
|
138
|
+
}, [rangePosition, open]);
|
|
139
|
+
var updateRangePosition = function updateRangePosition() {
|
|
140
|
+
var _singleInputFieldRef$;
|
|
141
|
+
if (!singleInputFieldRef.current || inputRef.current !== getActiveElement(document)) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
var sections = singleInputFieldRef.current.getSections();
|
|
145
|
+
var activeSectionIndex = (_singleInputFieldRef$ = singleInputFieldRef.current) == null ? void 0 : _singleInputFieldRef$.getActiveSectionIndex();
|
|
146
|
+
var domRangePosition = activeSectionIndex == null || activeSectionIndex < sections.length / 2 ? 'start' : 'end';
|
|
147
|
+
if (domRangePosition != null && domRangePosition !== rangePosition) {
|
|
148
|
+
onRangePositionChange(domRangePosition);
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
var handleSelectedSectionsChange = useEventCallback(function (selectedSections) {
|
|
152
|
+
var _fieldProps$onSelecte;
|
|
153
|
+
setTimeout(updateRangePosition);
|
|
154
|
+
(_fieldProps$onSelecte = fieldProps.onSelectedSectionsChange) == null ? void 0 : _fieldProps$onSelecte.call(fieldProps, selectedSections);
|
|
155
|
+
});
|
|
156
|
+
var openPicker = function openPicker(event) {
|
|
157
|
+
event.stopPropagation();
|
|
158
|
+
if (!readOnly && !disableOpenPicker) {
|
|
159
|
+
actions.onOpen();
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
var slots = _extends({}, fieldProps.slots, {
|
|
163
|
+
textField: pickerSlots == null ? void 0 : pickerSlots.textField
|
|
164
|
+
});
|
|
165
|
+
var slotProps = _extends({}, fieldProps.slotProps, {
|
|
166
|
+
textField: pickerSlotProps == null ? void 0 : pickerSlotProps.textField
|
|
167
|
+
});
|
|
168
|
+
var enrichedFieldProps = _extends({}, fieldProps, {
|
|
169
|
+
slots: slots,
|
|
170
|
+
slotProps: slotProps,
|
|
171
|
+
label: label,
|
|
172
|
+
unstableFieldRef: handleFieldRef,
|
|
173
|
+
inputRef: handleInputRef,
|
|
174
|
+
onKeyDown: onSpaceOrEnter(openPicker, fieldProps.onKeyDown),
|
|
175
|
+
onSelectedSectionsChange: handleSelectedSectionsChange,
|
|
176
|
+
onBlur: onBlur,
|
|
177
|
+
focused: open
|
|
178
|
+
}, labelId != null && {
|
|
179
|
+
id: labelId
|
|
180
|
+
}, wrapperVariant === 'mobile' && {
|
|
181
|
+
readOnly: true
|
|
182
|
+
}, !readOnly && !fieldProps.disabled && {
|
|
183
|
+
onClick: openPicker
|
|
184
|
+
});
|
|
185
|
+
return enrichedFieldProps;
|
|
186
|
+
};
|
|
187
|
+
export var useEnrichedRangePickerFieldProps = function useEnrichedRangePickerFieldProps(params) {
|
|
188
|
+
/* eslint-disable react-hooks/rules-of-hooks */
|
|
189
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
190
|
+
var fieldTypeRef = React.useRef(params.fieldType);
|
|
191
|
+
if (params.fieldType !== fieldTypeRef.current) {
|
|
192
|
+
console.error('Should not switch between a multi input field and a single input field on a range picker.');
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
if (params.fieldType === 'multi-input') {
|
|
196
|
+
return useMultiInputFieldSlotProps(params);
|
|
197
|
+
}
|
|
198
|
+
return useSingleInputFieldSlotProps(params);
|
|
199
|
+
/* eslint-enable react-hooks/rules-of-hooks */
|
|
200
|
+
};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { useSlotProps } from '@mui/base/utils';
|
|
4
4
|
import { useLicenseVerifier } from '@mui/x-license-pro';
|
|
5
5
|
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
|
|
6
6
|
import { PickersLayout } from '@mui/x-date-pickers/PickersLayout';
|
|
7
7
|
import { usePicker, PickersModalDialog, useLocaleText } from '@mui/x-date-pickers/internals';
|
|
8
8
|
import useId from '@mui/utils/useId';
|
|
9
|
-
import {
|
|
9
|
+
import { useEnrichedRangePickerFieldProps } from '../useEnrichedRangePickerFieldProps';
|
|
10
10
|
import { getReleaseInfo } from '../../utils/releaseInfo';
|
|
11
11
|
import { useRangePosition } from '../useRangePosition';
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
14
|
var releaseInfo = getReleaseInfo();
|
|
15
15
|
export var useMobileRangePicker = function useMobileRangePicker(_ref) {
|
|
16
|
-
var _innerSlotProps$toolb, _innerSlotProps$toolb2, _slots$layout;
|
|
16
|
+
var _fieldType, _innerSlotProps$toolb, _innerSlotProps$toolb2, _slots$layout;
|
|
17
17
|
var props = _ref.props,
|
|
18
18
|
valueManager = _ref.valueManager,
|
|
19
19
|
validator = _ref.validator;
|
|
@@ -23,13 +23,16 @@ export var useMobileRangePicker = function useMobileRangePicker(_ref) {
|
|
|
23
23
|
className = props.className,
|
|
24
24
|
sx = props.sx,
|
|
25
25
|
format = props.format,
|
|
26
|
+
label = props.label,
|
|
27
|
+
inputRef = props.inputRef,
|
|
26
28
|
readOnly = props.readOnly,
|
|
27
29
|
disabled = props.disabled,
|
|
28
30
|
disableOpenPicker = props.disableOpenPicker,
|
|
29
31
|
localeText = props.localeText;
|
|
30
32
|
var _useRangePosition = useRangePosition(props),
|
|
31
33
|
rangePosition = _useRangePosition.rangePosition,
|
|
32
|
-
onRangePositionChange = _useRangePosition.onRangePositionChange
|
|
34
|
+
onRangePositionChange = _useRangePosition.onRangePositionChange,
|
|
35
|
+
singleInputFieldRef = _useRangePosition.singleInputFieldRef;
|
|
33
36
|
var labelId = useId();
|
|
34
37
|
var contextLocaleText = useLocaleText();
|
|
35
38
|
var _usePicker = usePicker({
|
|
@@ -48,18 +51,8 @@ export var useMobileRangePicker = function useMobileRangePicker(_ref) {
|
|
|
48
51
|
layoutProps = _usePicker.layoutProps,
|
|
49
52
|
renderCurrentView = _usePicker.renderCurrentView,
|
|
50
53
|
pickerFieldProps = _usePicker.fieldProps;
|
|
51
|
-
var fieldSlotProps = useRangePickerInputProps({
|
|
52
|
-
wrapperVariant: 'mobile',
|
|
53
|
-
open: open,
|
|
54
|
-
actions: actions,
|
|
55
|
-
readOnly: readOnly,
|
|
56
|
-
disabled: disabled,
|
|
57
|
-
disableOpenPicker: disableOpenPicker,
|
|
58
|
-
localeText: localeText,
|
|
59
|
-
rangePosition: rangePosition,
|
|
60
|
-
onRangePositionChange: onRangePositionChange
|
|
61
|
-
});
|
|
62
54
|
var Field = slots.field;
|
|
55
|
+
var fieldType = (_fieldType = Field.fieldType) != null ? _fieldType : 'multi-input';
|
|
63
56
|
var fieldProps = useSlotProps({
|
|
64
57
|
elementType: Field,
|
|
65
58
|
externalSlotProps: innerSlotProps == null ? void 0 : innerSlotProps.field,
|
|
@@ -69,25 +62,28 @@ export var useMobileRangePicker = function useMobileRangePicker(_ref) {
|
|
|
69
62
|
className: className,
|
|
70
63
|
sx: sx,
|
|
71
64
|
format: format
|
|
65
|
+
}, fieldType === 'single-input' && {
|
|
66
|
+
inputRef: inputRef
|
|
72
67
|
}),
|
|
73
68
|
ownerState: props
|
|
74
69
|
});
|
|
75
|
-
var slotsForField = _extends({
|
|
76
|
-
textField: slots.textField
|
|
77
|
-
}, fieldProps.slots);
|
|
78
70
|
var isToolbarHidden = (_innerSlotProps$toolb = innerSlotProps == null ? void 0 : (_innerSlotProps$toolb2 = innerSlotProps.toolbar) == null ? void 0 : _innerSlotProps$toolb2.hidden) != null ? _innerSlotProps$toolb : false;
|
|
79
|
-
var
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
71
|
+
var enrichedFieldProps = useEnrichedRangePickerFieldProps({
|
|
72
|
+
wrapperVariant: 'mobile',
|
|
73
|
+
fieldType: fieldType,
|
|
74
|
+
open: open,
|
|
75
|
+
actions: actions,
|
|
76
|
+
readOnly: readOnly,
|
|
77
|
+
labelId: labelId,
|
|
78
|
+
disableOpenPicker: disableOpenPicker,
|
|
79
|
+
label: label,
|
|
80
|
+
localeText: localeText,
|
|
81
|
+
rangePosition: rangePosition,
|
|
82
|
+
onRangePositionChange: onRangePositionChange,
|
|
83
|
+
singleInputFieldRef: singleInputFieldRef,
|
|
84
|
+
pickerSlots: slots,
|
|
85
|
+
pickerSlotProps: innerSlotProps,
|
|
86
|
+
fieldProps: fieldProps
|
|
91
87
|
});
|
|
92
88
|
var slotPropsForLayout = _extends({}, innerSlotProps, {
|
|
93
89
|
toolbar: _extends({}, innerSlotProps == null ? void 0 : innerSlotProps.toolbar, {
|
|
@@ -101,11 +97,15 @@ export var useMobileRangePicker = function useMobileRangePicker(_ref) {
|
|
|
101
97
|
var labelledById = labelId;
|
|
102
98
|
if (isToolbarHidden) {
|
|
103
99
|
var labels = [];
|
|
104
|
-
if (
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
100
|
+
if (fieldType === 'multi-input') {
|
|
101
|
+
if (finalLocaleText.start) {
|
|
102
|
+
labels.push("".concat(labelId, "-start-label"));
|
|
103
|
+
}
|
|
104
|
+
if (finalLocaleText.end) {
|
|
105
|
+
labels.push("".concat(labelId, "-end-label"));
|
|
106
|
+
}
|
|
107
|
+
} else if (label != null) {
|
|
108
|
+
labels.push("".concat(labelId, "-label"));
|
|
109
109
|
}
|
|
110
110
|
labelledById = labels.length > 0 ? labels.join(' ') : undefined;
|
|
111
111
|
}
|
|
@@ -117,10 +117,7 @@ export var useMobileRangePicker = function useMobileRangePicker(_ref) {
|
|
|
117
117
|
var renderPicker = function renderPicker() {
|
|
118
118
|
return /*#__PURE__*/_jsxs(LocalizationProvider, {
|
|
119
119
|
localeText: localeText,
|
|
120
|
-
children: [/*#__PURE__*/_jsx(Field, _extends({},
|
|
121
|
-
slots: slotsForField,
|
|
122
|
-
slotProps: slotPropsForField
|
|
123
|
-
})), /*#__PURE__*/_jsx(PickersModalDialog, _extends({}, actions, {
|
|
120
|
+
children: [/*#__PURE__*/_jsx(Field, _extends({}, enrichedFieldProps)), /*#__PURE__*/_jsx(PickersModalDialog, _extends({}, actions, {
|
|
124
121
|
open: open,
|
|
125
122
|
slots: slots,
|
|
126
123
|
slotProps: slotProps,
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import * as React from 'react';
|
|
2
3
|
import useControlled from '@mui/utils/useControlled';
|
|
3
4
|
import useEventCallback from '@mui/utils/useEventCallback';
|
|
4
5
|
export var useRangePosition = function useRangePosition(props) {
|
|
5
6
|
var _props$defaultRangePo;
|
|
7
|
+
var singleInputFieldRef = React.useRef();
|
|
6
8
|
var _useControlled = useControlled({
|
|
7
9
|
name: 'useRangePosition',
|
|
8
10
|
state: 'rangePosition',
|
|
@@ -12,13 +14,26 @@ export var useRangePosition = function useRangePosition(props) {
|
|
|
12
14
|
_useControlled2 = _slicedToArray(_useControlled, 2),
|
|
13
15
|
rangePosition = _useControlled2[0],
|
|
14
16
|
setRangePosition = _useControlled2[1];
|
|
17
|
+
|
|
18
|
+
// When using a single input field,
|
|
19
|
+
// we want to select the 1st section of the edited date when updating the range position.
|
|
20
|
+
var syncRangePositionWithSingleInputField = function syncRangePositionWithSingleInputField(newRangePosition) {
|
|
21
|
+
if (singleInputFieldRef.current == null) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
var sections = singleInputFieldRef.current.getSections();
|
|
25
|
+
var targetActiveSectionIndex = newRangePosition === 'start' ? 0 : sections.length / 2;
|
|
26
|
+
singleInputFieldRef.current.setSelectedSections(targetActiveSectionIndex);
|
|
27
|
+
};
|
|
15
28
|
var handleRangePositionChange = useEventCallback(function (newRangePosition) {
|
|
16
29
|
var _props$onRangePositio;
|
|
17
30
|
setRangePosition(newRangePosition);
|
|
18
31
|
(_props$onRangePositio = props.onRangePositionChange) == null ? void 0 : _props$onRangePositio.call(props, newRangePosition);
|
|
32
|
+
syncRangePositionWithSingleInputField(newRangePosition);
|
|
19
33
|
});
|
|
20
34
|
return {
|
|
21
35
|
rangePosition: rangePosition,
|
|
22
|
-
onRangePositionChange: handleRangePositionChange
|
|
36
|
+
onRangePositionChange: handleRangePositionChange,
|
|
37
|
+
singleInputFieldRef: singleInputFieldRef
|
|
23
38
|
};
|
|
24
39
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export var getReleaseInfo = function getReleaseInfo() {
|
|
3
|
-
var releaseInfo = "
|
|
3
|
+
var releaseInfo = "MTY4MTA3NDAwMDAwMA==";
|
|
4
4
|
if (process.env.NODE_ENV !== 'production') {
|
|
5
5
|
// A simple hack to set the value in the test environment (has no build step).
|
|
6
6
|
// eslint-disable-next-line no-useless-concat
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
|
-
import { replaceInvalidDateByNull,
|
|
4
|
+
import { replaceInvalidDateByNull, addPositionPropertiesToSections, createDateStrForInputFromSections, areDatesEqual } from '@mui/x-date-pickers/internals';
|
|
5
5
|
import { splitDateRangeSections, removeLastSeparator } from './date-fields-utils';
|
|
6
6
|
export var rangeValueManager = {
|
|
7
7
|
emptyValue: [null, null],
|
|
@@ -19,6 +19,9 @@ export var rangeValueManager = {
|
|
|
19
19
|
isSameError: function isSameError(a, b) {
|
|
20
20
|
return b !== null && a[1] === b[1] && a[0] === b[0];
|
|
21
21
|
},
|
|
22
|
+
hasError: function hasError(error) {
|
|
23
|
+
return error[0] != null || error[1] != null;
|
|
24
|
+
},
|
|
22
25
|
defaultErrorState: [null, null]
|
|
23
26
|
};
|
|
24
27
|
export var rangeFieldValueManager = {
|
|
@@ -36,20 +39,20 @@ export var rangeFieldValueManager = {
|
|
|
36
39
|
}
|
|
37
40
|
return [prevReferenceValue[1], value[1]];
|
|
38
41
|
},
|
|
39
|
-
getSectionsFromValue: function getSectionsFromValue(utils,
|
|
42
|
+
getSectionsFromValue: function getSectionsFromValue(utils, _ref, fallbackSections, isRTL, getSectionsFromDate) {
|
|
40
43
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
41
44
|
start = _ref2[0],
|
|
42
45
|
end = _ref2[1];
|
|
43
|
-
var
|
|
46
|
+
var separatedFallbackSections = fallbackSections == null ? {
|
|
44
47
|
startDate: null,
|
|
45
48
|
endDate: null
|
|
46
|
-
} : splitDateRangeSections(
|
|
47
|
-
var getSections = function getSections(newDate,
|
|
48
|
-
var shouldReUsePrevDateSections = !utils.isValid(newDate) && !!
|
|
49
|
+
} : splitDateRangeSections(fallbackSections);
|
|
50
|
+
var getSections = function getSections(newDate, fallbackDateSections, position) {
|
|
51
|
+
var shouldReUsePrevDateSections = !utils.isValid(newDate) && !!fallbackDateSections;
|
|
49
52
|
if (shouldReUsePrevDateSections) {
|
|
50
|
-
return
|
|
53
|
+
return fallbackDateSections;
|
|
51
54
|
}
|
|
52
|
-
var sections =
|
|
55
|
+
var sections = getSectionsFromDate(newDate);
|
|
53
56
|
return sections.map(function (section, sectionIndex) {
|
|
54
57
|
if (sectionIndex === sections.length - 1 && position === 'start') {
|
|
55
58
|
return _extends({}, section, {
|
|
@@ -62,16 +65,11 @@ export var rangeFieldValueManager = {
|
|
|
62
65
|
});
|
|
63
66
|
});
|
|
64
67
|
};
|
|
65
|
-
return addPositionPropertiesToSections([].concat(_toConsumableArray(getSections(start,
|
|
66
|
-
},
|
|
67
|
-
getValueStrFromSections: function getValueStrFromSections(sections) {
|
|
68
|
-
var dateRangeSections = splitDateRangeSections(sections);
|
|
69
|
-
return createDateStrForInputFromSections([].concat(_toConsumableArray(dateRangeSections.startDate), _toConsumableArray(dateRangeSections.endDate)));
|
|
68
|
+
return addPositionPropertiesToSections([].concat(_toConsumableArray(getSections(start, separatedFallbackSections.startDate, 'start')), _toConsumableArray(getSections(end, separatedFallbackSections.endDate, 'end'))), isRTL);
|
|
70
69
|
},
|
|
71
|
-
|
|
72
|
-
var index = activeSection.dateName === 'start' ? 0 : 1;
|
|
70
|
+
getValueStrFromSections: function getValueStrFromSections(sections, isRTL) {
|
|
73
71
|
var dateRangeSections = splitDateRangeSections(sections);
|
|
74
|
-
return
|
|
72
|
+
return createDateStrForInputFromSections([].concat(_toConsumableArray(dateRangeSections.startDate), _toConsumableArray(dateRangeSections.endDate)), isRTL);
|
|
75
73
|
},
|
|
76
74
|
parseValueStr: function parseValueStr(valueStr, referenceValue, parseDate) {
|
|
77
75
|
// TODO: Improve because it would not work if the date format has `–` as a separator.
|
|
@@ -92,17 +90,21 @@ export var rangeFieldValueManager = {
|
|
|
92
90
|
return index === 0 ? [newDate, prevDateRange[1]] : [prevDateRange[0], newDate];
|
|
93
91
|
};
|
|
94
92
|
return {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
93
|
+
date: state.value[index],
|
|
94
|
+
referenceDate: state.referenceValue[index],
|
|
95
|
+
getSections: function getSections(sections) {
|
|
96
|
+
var dateRangeSections = splitDateRangeSections(sections);
|
|
97
|
+
if (index === 0) {
|
|
98
|
+
return removeLastSeparator(dateRangeSections.startDate);
|
|
99
|
+
}
|
|
100
|
+
return dateRangeSections.endDate;
|
|
101
|
+
},
|
|
102
|
+
getNewValuesFromNewActiveDate: function getNewValuesFromNewActiveDate(newActiveDate) {
|
|
98
103
|
return {
|
|
99
104
|
value: updateDateInRange(newActiveDate, state.value),
|
|
100
105
|
referenceValue: newActiveDate == null || !utils.isValid(newActiveDate) ? state.referenceValue : updateDateInRange(newActiveDate, state.referenceValue)
|
|
101
106
|
};
|
|
102
107
|
}
|
|
103
108
|
};
|
|
104
|
-
},
|
|
105
|
-
hasError: function hasError(error) {
|
|
106
|
-
return error[0] != null || error[1] != null;
|
|
107
109
|
}
|
|
108
110
|
};
|
|
@@ -147,6 +147,18 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
|
|
|
147
147
|
* Defaults to localized format based on the used `views`.
|
|
148
148
|
*/
|
|
149
149
|
format: PropTypes.string,
|
|
150
|
+
/**
|
|
151
|
+
* Pass a ref to the `input` element.
|
|
152
|
+
* Ignored if the field has several inputs.
|
|
153
|
+
*/
|
|
154
|
+
inputRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
155
|
+
current: PropTypes.object
|
|
156
|
+
})]),
|
|
157
|
+
/**
|
|
158
|
+
* The label content.
|
|
159
|
+
* Ignored if the field has several inputs.
|
|
160
|
+
*/
|
|
161
|
+
label: PropTypes.node,
|
|
150
162
|
/**
|
|
151
163
|
* If `true`, calls `renderLoading` instead of rendering the day calendar.
|
|
152
164
|
* Can be used to preload information and show it in calendar.
|
|
@@ -151,6 +151,18 @@ DesktopDateRangePicker.propTypes = {
|
|
|
151
151
|
* Defaults to localized format based on the used `views`.
|
|
152
152
|
*/
|
|
153
153
|
format: PropTypes.string,
|
|
154
|
+
/**
|
|
155
|
+
* Pass a ref to the `input` element.
|
|
156
|
+
* Ignored if the field has several inputs.
|
|
157
|
+
*/
|
|
158
|
+
inputRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
159
|
+
current: PropTypes.object
|
|
160
|
+
})]),
|
|
161
|
+
/**
|
|
162
|
+
* The label content.
|
|
163
|
+
* Ignored if the field has several inputs.
|
|
164
|
+
*/
|
|
165
|
+
label: PropTypes.node,
|
|
154
166
|
/**
|
|
155
167
|
* If `true`, calls `renderLoading` instead of rendering the day calendar.
|
|
156
168
|
* Can be used to preload information and show it in calendar.
|