@mui/x-date-pickers 7.9.0 → 7.11.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 +159 -0
- package/DesktopDateTimePicker/DesktopDateTimePickerLayout.d.ts +4 -4
- package/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +2 -3
- package/PickersCalendarHeader/PickersCalendarHeader.js +1 -1
- package/PickersCalendarHeader/PickersCalendarHeader.types.d.ts +1 -1
- package/PickersLayout/PickersLayout.d.ts +4 -4
- package/PickersLayout/PickersLayout.js +2 -4
- package/PickersLayout/PickersLayout.types.d.ts +0 -4
- package/PickersTextField/PickersInput/pickersInputClasses.d.ts +1 -1
- package/TimeClock/Clock.js +21 -32
- package/TimeClock/clockClasses.d.ts +2 -0
- package/TimeClock/clockClasses.js +1 -1
- package/index.js +1 -1
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -5
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.types.d.ts +2 -2
- package/internals/components/PickersArrowSwitcher/pickersArrowSwitcherClasses.d.ts +9 -1
- package/internals/components/PickersArrowSwitcher/pickersArrowSwitcherClasses.js +1 -1
- package/internals/hooks/useField/useFieldV6TextField.js +10 -9
- package/internals/hooks/useField/useFieldV7TextField.js +1 -4
- package/internals/index.d.ts +1 -1
- package/internals/index.js +1 -1
- package/internals/utils/date-time-utils.d.ts +1 -1
- package/locales/koKR.js +14 -16
- package/locales/ruRU.js +15 -18
- package/models/pickers.d.ts +1 -1
- package/modern/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +2 -3
- package/modern/PickersCalendarHeader/PickersCalendarHeader.js +1 -1
- package/modern/PickersLayout/PickersLayout.js +2 -4
- package/modern/TimeClock/Clock.js +21 -32
- package/modern/TimeClock/clockClasses.js +1 -1
- package/modern/index.js +1 -1
- package/modern/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -5
- package/modern/internals/components/PickersArrowSwitcher/pickersArrowSwitcherClasses.js +1 -1
- package/modern/internals/hooks/useField/useFieldV6TextField.js +10 -9
- package/modern/internals/hooks/useField/useFieldV7TextField.js +1 -4
- package/modern/internals/index.js +1 -1
- package/modern/locales/koKR.js +14 -16
- package/modern/locales/ruRU.js +15 -18
- package/node/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +3 -4
- package/node/PickersCalendarHeader/PickersCalendarHeader.js +1 -1
- package/node/PickersLayout/PickersLayout.js +2 -4
- package/node/TimeClock/Clock.js +21 -32
- package/node/TimeClock/clockClasses.js +1 -1
- package/node/index.js +1 -1
- package/node/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -5
- package/node/internals/components/PickersArrowSwitcher/pickersArrowSwitcherClasses.js +1 -1
- package/node/internals/hooks/useField/useFieldV6TextField.js +10 -9
- package/node/internals/hooks/useField/useFieldV7TextField.js +1 -4
- package/node/internals/index.js +6 -0
- package/node/locales/koKR.js +14 -16
- package/node/locales/ruRU.js +15 -18
- package/package.json +4 -4
package/locales/koKR.js
CHANGED
|
@@ -16,11 +16,10 @@ const koKRPickers = {
|
|
|
16
16
|
// DateRange labels
|
|
17
17
|
start: '시작',
|
|
18
18
|
end: '종료',
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
startDate: '시작 날짜',
|
|
20
|
+
startTime: '시작 시간',
|
|
21
|
+
endDate: '종료 날짜',
|
|
22
|
+
endTime: '종료 시간',
|
|
24
23
|
// Action bar
|
|
25
24
|
cancelButtonLabel: '취소',
|
|
26
25
|
clearButtonLabel: '초기화',
|
|
@@ -54,23 +53,22 @@ const koKRPickers = {
|
|
|
54
53
|
fieldYearPlaceholder: params => 'Y'.repeat(params.digitAmount),
|
|
55
54
|
fieldMonthPlaceholder: params => params.contentType === 'letter' ? 'MMMM' : 'MM',
|
|
56
55
|
fieldDayPlaceholder: () => 'DD',
|
|
57
|
-
|
|
56
|
+
fieldWeekDayPlaceholder: params => params.contentType === 'letter' ? 'EEEE' : 'EE',
|
|
58
57
|
fieldHoursPlaceholder: () => 'hh',
|
|
59
58
|
fieldMinutesPlaceholder: () => 'mm',
|
|
60
59
|
fieldSecondsPlaceholder: () => 'ss',
|
|
61
|
-
fieldMeridiemPlaceholder: () => 'aa'
|
|
62
|
-
|
|
60
|
+
fieldMeridiemPlaceholder: () => 'aa',
|
|
63
61
|
// View names
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
62
|
+
year: '년',
|
|
63
|
+
month: '월',
|
|
64
|
+
day: '일',
|
|
65
|
+
weekDay: '평일',
|
|
66
|
+
hours: '시간',
|
|
67
|
+
minutes: '분',
|
|
68
|
+
seconds: '초',
|
|
71
69
|
// meridiem: 'Meridiem',
|
|
72
70
|
|
|
73
71
|
// Common
|
|
74
|
-
|
|
72
|
+
empty: '공란'
|
|
75
73
|
};
|
|
76
74
|
export const koKR = getPickersLocalization(koKRPickers);
|
package/locales/ruRU.js
CHANGED
|
@@ -17,11 +17,10 @@ const ruRUPickers = {
|
|
|
17
17
|
// DateRange labels
|
|
18
18
|
start: 'Начало',
|
|
19
19
|
end: 'Конец',
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
startDate: 'Начальная дата',
|
|
21
|
+
startTime: 'Начальное время',
|
|
22
|
+
endDate: 'Конечная дата',
|
|
23
|
+
endTime: 'Конечное время',
|
|
25
24
|
// Action bar
|
|
26
25
|
cancelButtonLabel: 'Отмена',
|
|
27
26
|
clearButtonLabel: 'Очистить',
|
|
@@ -55,23 +54,21 @@ const ruRUPickers = {
|
|
|
55
54
|
fieldYearPlaceholder: params => 'Г'.repeat(params.digitAmount),
|
|
56
55
|
fieldMonthPlaceholder: params => params.contentType === 'letter' ? 'ММММ' : 'ММ',
|
|
57
56
|
fieldDayPlaceholder: () => 'ДД',
|
|
58
|
-
|
|
57
|
+
fieldWeekDayPlaceholder: params => params.contentType === 'letter' ? 'ДДДД' : 'ДД',
|
|
59
58
|
fieldHoursPlaceholder: () => 'чч',
|
|
60
59
|
fieldMinutesPlaceholder: () => 'мм',
|
|
61
60
|
fieldSecondsPlaceholder: () => 'сс',
|
|
62
|
-
fieldMeridiemPlaceholder: () => '(д|п)п'
|
|
63
|
-
|
|
61
|
+
fieldMeridiemPlaceholder: () => '(д|п)п',
|
|
64
62
|
// View names
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
63
|
+
year: 'Год',
|
|
64
|
+
month: 'Месяц',
|
|
65
|
+
day: 'День',
|
|
66
|
+
weekDay: 'День недели',
|
|
67
|
+
hours: 'Часы',
|
|
68
|
+
minutes: 'Минуты',
|
|
69
|
+
seconds: 'Секунды',
|
|
70
|
+
meridiem: 'Меридием',
|
|
74
71
|
// Common
|
|
75
|
-
|
|
72
|
+
empty: 'Пустой'
|
|
76
73
|
};
|
|
77
74
|
export const ruRU = getPickersLocalization(ruRUPickers);
|
package/models/pickers.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { PickersShortcutsItemContext } from '../PickersShortcuts';
|
|
|
2
2
|
export interface PickerChangeHandlerContext<TError> {
|
|
3
3
|
validationError: TError;
|
|
4
4
|
/**
|
|
5
|
-
* Shortcut causing this `onChange` call.
|
|
5
|
+
* Shortcut causing this `onChange` or `onAccept` call.
|
|
6
6
|
* If the call has not been caused by a shortcut selection, this property will be `undefined`.
|
|
7
7
|
*/
|
|
8
8
|
shortcut?: PickersShortcutsItemContext;
|
|
@@ -9,7 +9,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
9
9
|
/**
|
|
10
10
|
* @ignore - internal component.
|
|
11
11
|
*/
|
|
12
|
-
function DesktopDateTimePickerLayout(props) {
|
|
12
|
+
const DesktopDateTimePickerLayout = /*#__PURE__*/React.forwardRef(function DesktopDateTimePickerLayout(props, ref) {
|
|
13
13
|
const isRtl = useRtl();
|
|
14
14
|
const {
|
|
15
15
|
toolbar,
|
|
@@ -22,7 +22,6 @@ function DesktopDateTimePickerLayout(props) {
|
|
|
22
22
|
sx,
|
|
23
23
|
className,
|
|
24
24
|
isLandscape,
|
|
25
|
-
ref,
|
|
26
25
|
classes
|
|
27
26
|
} = props;
|
|
28
27
|
const isActionBarVisible = actionBar && (actionBar.props.actions?.length ?? 0) > 0;
|
|
@@ -55,7 +54,7 @@ function DesktopDateTimePickerLayout(props) {
|
|
|
55
54
|
})]
|
|
56
55
|
}), actionBar]
|
|
57
56
|
});
|
|
58
|
-
}
|
|
57
|
+
});
|
|
59
58
|
process.env.NODE_ENV !== "production" ? DesktopDateTimePickerLayout.propTypes = {
|
|
60
59
|
// ----------------------------- Warning --------------------------------
|
|
61
60
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -152,7 +152,7 @@ const PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCale
|
|
|
152
152
|
const _useSlotProps = useSlotProps({
|
|
153
153
|
elementType: SwitchViewIcon,
|
|
154
154
|
externalSlotProps: slotProps?.switchViewIcon,
|
|
155
|
-
ownerState
|
|
155
|
+
ownerState,
|
|
156
156
|
className: classes.switchViewIcon
|
|
157
157
|
}),
|
|
158
158
|
switchViewIconProps = _objectWithoutPropertiesLoose(_useSlotProps, _excluded2);
|
|
@@ -89,7 +89,6 @@ export const PickersLayoutContentWrapper = styled('div', {
|
|
|
89
89
|
display: 'flex',
|
|
90
90
|
flexDirection: 'column'
|
|
91
91
|
});
|
|
92
|
-
|
|
93
92
|
/**
|
|
94
93
|
* Demos:
|
|
95
94
|
*
|
|
@@ -99,7 +98,7 @@ export const PickersLayoutContentWrapper = styled('div', {
|
|
|
99
98
|
*
|
|
100
99
|
* - [PickersLayout API](https://mui.com/x/api/date-pickers/pickers-layout/)
|
|
101
100
|
*/
|
|
102
|
-
const PickersLayout = function PickersLayout(inProps) {
|
|
101
|
+
const PickersLayout = /*#__PURE__*/React.forwardRef(function PickersLayout(inProps, ref) {
|
|
103
102
|
const props = useThemeProps({
|
|
104
103
|
props: inProps,
|
|
105
104
|
name: 'MuiPickersLayout'
|
|
@@ -115,7 +114,6 @@ const PickersLayout = function PickersLayout(inProps) {
|
|
|
115
114
|
sx,
|
|
116
115
|
className,
|
|
117
116
|
isLandscape,
|
|
118
|
-
ref,
|
|
119
117
|
wrapperVariant
|
|
120
118
|
} = props;
|
|
121
119
|
const classes = useUtilityClasses(props);
|
|
@@ -133,7 +131,7 @@ const PickersLayout = function PickersLayout(inProps) {
|
|
|
133
131
|
})
|
|
134
132
|
}), actionBar]
|
|
135
133
|
});
|
|
136
|
-
};
|
|
134
|
+
});
|
|
137
135
|
process.env.NODE_ENV !== "production" ? PickersLayout.propTypes = {
|
|
138
136
|
// ----------------------------- Warning --------------------------------
|
|
139
137
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import clsx from 'clsx';
|
|
3
4
|
import IconButton from '@mui/material/IconButton';
|
|
@@ -13,7 +14,8 @@ import { formatMeridiem } from '../internals/utils/date-utils';
|
|
|
13
14
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
15
|
const useUtilityClasses = ownerState => {
|
|
15
16
|
const {
|
|
16
|
-
classes
|
|
17
|
+
classes,
|
|
18
|
+
meridiemMode
|
|
17
19
|
} = ownerState;
|
|
18
20
|
const slots = {
|
|
19
21
|
root: ['root'],
|
|
@@ -21,8 +23,8 @@ const useUtilityClasses = ownerState => {
|
|
|
21
23
|
wrapper: ['wrapper'],
|
|
22
24
|
squareMask: ['squareMask'],
|
|
23
25
|
pin: ['pin'],
|
|
24
|
-
amButton: ['amButton'],
|
|
25
|
-
pmButton: ['pmButton'],
|
|
26
|
+
amButton: ['amButton', meridiemMode === 'am' && 'selected'],
|
|
27
|
+
pmButton: ['pmButton', meridiemMode === 'pm' && 'selected'],
|
|
26
28
|
meridiemText: ['meridiemText']
|
|
27
29
|
};
|
|
28
30
|
return composeClasses(slots, getClockUtilityClass, classes);
|
|
@@ -105,23 +107,15 @@ const ClockPin = styled('div', {
|
|
|
105
107
|
left: '50%',
|
|
106
108
|
transform: 'translate(-50%, -50%)'
|
|
107
109
|
}));
|
|
108
|
-
const
|
|
109
|
-
name: 'MuiClock',
|
|
110
|
-
slot: 'AmButton',
|
|
111
|
-
overridesResolver: (_, styles) => styles.amButton
|
|
112
|
-
})(({
|
|
113
|
-
theme
|
|
114
|
-
}) => ({
|
|
110
|
+
const meridiemButtonCommonStyles = (theme, meridiemMode) => ({
|
|
115
111
|
zIndex: 1,
|
|
116
|
-
position: 'absolute',
|
|
117
112
|
bottom: 8,
|
|
118
|
-
left: 8,
|
|
119
113
|
paddingLeft: 4,
|
|
120
114
|
paddingRight: 4,
|
|
121
115
|
width: CLOCK_HOUR_WIDTH,
|
|
122
116
|
variants: [{
|
|
123
117
|
props: {
|
|
124
|
-
meridiemMode
|
|
118
|
+
meridiemMode
|
|
125
119
|
},
|
|
126
120
|
style: {
|
|
127
121
|
backgroundColor: (theme.vars || theme).palette.primary.main,
|
|
@@ -131,6 +125,17 @@ const ClockAmButton = styled(IconButton, {
|
|
|
131
125
|
}
|
|
132
126
|
}
|
|
133
127
|
}]
|
|
128
|
+
});
|
|
129
|
+
const ClockAmButton = styled(IconButton, {
|
|
130
|
+
name: 'MuiClock',
|
|
131
|
+
slot: 'AmButton',
|
|
132
|
+
overridesResolver: (_, styles) => styles.amButton
|
|
133
|
+
})(({
|
|
134
|
+
theme
|
|
135
|
+
}) => _extends({}, meridiemButtonCommonStyles(theme, 'am'), {
|
|
136
|
+
// keeping it here to make TS happy
|
|
137
|
+
position: 'absolute',
|
|
138
|
+
left: 8
|
|
134
139
|
}));
|
|
135
140
|
const ClockPmButton = styled(IconButton, {
|
|
136
141
|
name: 'MuiClock',
|
|
@@ -138,26 +143,10 @@ const ClockPmButton = styled(IconButton, {
|
|
|
138
143
|
overridesResolver: (_, styles) => styles.pmButton
|
|
139
144
|
})(({
|
|
140
145
|
theme
|
|
141
|
-
}) => ({
|
|
142
|
-
|
|
146
|
+
}) => _extends({}, meridiemButtonCommonStyles(theme, 'pm'), {
|
|
147
|
+
// keeping it here to make TS happy
|
|
143
148
|
position: 'absolute',
|
|
144
|
-
|
|
145
|
-
right: 8,
|
|
146
|
-
paddingLeft: 4,
|
|
147
|
-
paddingRight: 4,
|
|
148
|
-
width: CLOCK_HOUR_WIDTH,
|
|
149
|
-
variants: [{
|
|
150
|
-
props: {
|
|
151
|
-
meridiemMode: 'pm'
|
|
152
|
-
},
|
|
153
|
-
style: {
|
|
154
|
-
backgroundColor: (theme.vars || theme).palette.primary.main,
|
|
155
|
-
color: (theme.vars || theme).palette.primary.contrastText,
|
|
156
|
-
'&:hover': {
|
|
157
|
-
backgroundColor: (theme.vars || theme).palette.primary.light
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
}]
|
|
149
|
+
right: 8
|
|
161
150
|
}));
|
|
162
151
|
const ClockMeridiemText = styled(Typography, {
|
|
163
152
|
name: 'MuiClock',
|
|
@@ -2,4 +2,4 @@ import { unstable_generateUtilityClass as generateUtilityClass, unstable_generat
|
|
|
2
2
|
export function getClockUtilityClass(slot) {
|
|
3
3
|
return generateUtilityClass('MuiClock', slot);
|
|
4
4
|
}
|
|
5
|
-
export const clockClasses = generateUtilityClasses('MuiClock', ['root', 'clock', 'wrapper', 'squareMask', 'pin', 'amButton', 'pmButton', 'meridiemText']);
|
|
5
|
+
export const clockClasses = generateUtilityClasses('MuiClock', ['root', 'clock', 'wrapper', 'squareMask', 'pin', 'amButton', 'pmButton', 'meridiemText', 'selected']);
|
package/modern/index.js
CHANGED
|
@@ -51,7 +51,11 @@ const useUtilityClasses = ownerState => {
|
|
|
51
51
|
const slots = {
|
|
52
52
|
root: ['root'],
|
|
53
53
|
spacer: ['spacer'],
|
|
54
|
-
button: ['button']
|
|
54
|
+
button: ['button'],
|
|
55
|
+
previousIconButton: ['previousIconButton'],
|
|
56
|
+
nextIconButton: ['nextIconButton'],
|
|
57
|
+
leftArrowIcon: ['leftArrowIcon'],
|
|
58
|
+
rightArrowIcon: ['rightArrowIcon']
|
|
55
59
|
};
|
|
56
60
|
return composeClasses(slots, getPickersArrowSwitcherUtilityClass, classes);
|
|
57
61
|
};
|
|
@@ -106,7 +110,7 @@ export const PickersArrowSwitcher = /*#__PURE__*/React.forwardRef(function Picke
|
|
|
106
110
|
ownerState: _extends({}, ownerState, {
|
|
107
111
|
hidden: previousProps.isHidden
|
|
108
112
|
}),
|
|
109
|
-
className: classes.button
|
|
113
|
+
className: clsx(classes.button, classes.previousIconButton)
|
|
110
114
|
});
|
|
111
115
|
const NextIconButton = slots?.nextIconButton ?? PickersArrowSwitcherButton;
|
|
112
116
|
const nextIconButtonProps = useSlotProps({
|
|
@@ -123,7 +127,7 @@ export const PickersArrowSwitcher = /*#__PURE__*/React.forwardRef(function Picke
|
|
|
123
127
|
ownerState: _extends({}, ownerState, {
|
|
124
128
|
hidden: nextProps.isHidden
|
|
125
129
|
}),
|
|
126
|
-
className: classes.button
|
|
130
|
+
className: clsx(classes.button, classes.nextIconButton)
|
|
127
131
|
});
|
|
128
132
|
const LeftArrowIcon = slots?.leftArrowIcon ?? ArrowLeftIcon;
|
|
129
133
|
// The spread is here to avoid this bug mui/material-ui#34056
|
|
@@ -133,7 +137,8 @@ export const PickersArrowSwitcher = /*#__PURE__*/React.forwardRef(function Picke
|
|
|
133
137
|
additionalProps: {
|
|
134
138
|
fontSize: 'inherit'
|
|
135
139
|
},
|
|
136
|
-
ownerState
|
|
140
|
+
ownerState,
|
|
141
|
+
className: classes.leftArrowIcon
|
|
137
142
|
}),
|
|
138
143
|
leftArrowIconProps = _objectWithoutPropertiesLoose(_useSlotProps, _excluded2);
|
|
139
144
|
const RightArrowIcon = slots?.rightArrowIcon ?? ArrowRightIcon;
|
|
@@ -144,7 +149,8 @@ export const PickersArrowSwitcher = /*#__PURE__*/React.forwardRef(function Picke
|
|
|
144
149
|
additionalProps: {
|
|
145
150
|
fontSize: 'inherit'
|
|
146
151
|
},
|
|
147
|
-
ownerState
|
|
152
|
+
ownerState,
|
|
153
|
+
className: classes.rightArrowIcon
|
|
148
154
|
}),
|
|
149
155
|
rightArrowIconProps = _objectWithoutPropertiesLoose(_useSlotProps2, _excluded3);
|
|
150
156
|
return /*#__PURE__*/_jsxs(PickersArrowSwitcherRoot, _extends({
|
|
@@ -2,4 +2,4 @@ import { unstable_generateUtilityClass as generateUtilityClass, unstable_generat
|
|
|
2
2
|
export function getPickersArrowSwitcherUtilityClass(slot) {
|
|
3
3
|
return generateUtilityClass('MuiPickersArrowSwitcher', slot);
|
|
4
4
|
}
|
|
5
|
-
export const pickersArrowSwitcherClasses = generateUtilityClasses('MuiPickersArrowSwitcher', ['root', 'spacer', 'button']);
|
|
5
|
+
export const pickersArrowSwitcherClasses = generateUtilityClasses('MuiPickersArrowSwitcher', ['root', 'spacer', 'button', 'previousIconButton', 'nextIconButton', 'leftArrowIcon', 'rightArrowIcon']);
|
|
@@ -36,6 +36,7 @@ export const addPositionPropertiesToSections = (sections, localizedDigits, isRtl
|
|
|
36
36
|
export const useFieldV6TextField = params => {
|
|
37
37
|
const isRtl = useRtl();
|
|
38
38
|
const focusTimeoutRef = React.useRef();
|
|
39
|
+
const selectionSyncTimeoutRef = React.useRef();
|
|
39
40
|
const {
|
|
40
41
|
forwardedProps: {
|
|
41
42
|
onFocus,
|
|
@@ -103,10 +104,14 @@ export const useFieldV6TextField = params => {
|
|
|
103
104
|
inputRef.current.setSelectionRange(selectionStart, selectionEnd);
|
|
104
105
|
}
|
|
105
106
|
}
|
|
106
|
-
|
|
107
|
+
clearTimeout(selectionSyncTimeoutRef.current);
|
|
108
|
+
selectionSyncTimeoutRef.current = setTimeout(() => {
|
|
107
109
|
// handle case when the selection is not updated correctly
|
|
108
110
|
// could happen on Android
|
|
109
|
-
if (inputRef.current && inputRef.current === getActiveElement(document) &&
|
|
111
|
+
if (inputRef.current && inputRef.current === getActiveElement(document) &&
|
|
112
|
+
// The section might loose all selection, where `selectionStart === selectionEnd`
|
|
113
|
+
// https://github.com/mui/mui-x/pull/13652
|
|
114
|
+
inputRef.current.selectionStart === inputRef.current.selectionEnd && (inputRef.current.selectionStart !== selectionStart || inputRef.current.selectionEnd !== selectionEnd)) {
|
|
110
115
|
interactions.syncSelectionToDOM();
|
|
111
116
|
}
|
|
112
117
|
});
|
|
@@ -118,8 +123,7 @@ export const useFieldV6TextField = params => {
|
|
|
118
123
|
getActiveSectionIndexFromDOM: () => {
|
|
119
124
|
const browserStartIndex = inputRef.current.selectionStart ?? 0;
|
|
120
125
|
const browserEndIndex = inputRef.current.selectionEnd ?? 0;
|
|
121
|
-
|
|
122
|
-
if (browserStartIndex === 0 && browserEndIndex === 0 || isInputReadOnly) {
|
|
126
|
+
if (browserStartIndex === 0 && browserEndIndex === 0) {
|
|
123
127
|
return null;
|
|
124
128
|
}
|
|
125
129
|
const nextSectionIndex = browserStartIndex <= sections[0].startInInput ? 1 // Special case if browser index is in invisible characters at the beginning.
|
|
@@ -134,10 +138,6 @@ export const useFieldV6TextField = params => {
|
|
|
134
138
|
isFieldFocused: () => inputRef.current === getActiveElement(document)
|
|
135
139
|
}), [inputRef, parsedSelectedSections, sections, setSelectedSections]);
|
|
136
140
|
const syncSelectionFromDOM = () => {
|
|
137
|
-
if (readOnly) {
|
|
138
|
-
setSelectedSections(null);
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
141
|
const browserStartIndex = inputRef.current.selectionStart ?? 0;
|
|
142
142
|
let nextSectionIndex;
|
|
143
143
|
if (browserStartIndex <= sections[0].startInInput) {
|
|
@@ -162,7 +162,7 @@ export const useFieldV6TextField = params => {
|
|
|
162
162
|
if (!input || input !== inputRef.current) {
|
|
163
163
|
return;
|
|
164
164
|
}
|
|
165
|
-
if (activeSectionIndex != null
|
|
165
|
+
if (activeSectionIndex != null) {
|
|
166
166
|
return;
|
|
167
167
|
}
|
|
168
168
|
if (
|
|
@@ -296,6 +296,7 @@ export const useFieldV6TextField = params => {
|
|
|
296
296
|
}
|
|
297
297
|
return () => {
|
|
298
298
|
clearTimeout(focusTimeoutRef.current);
|
|
299
|
+
clearTimeout(selectionSyncTimeoutRef.current);
|
|
299
300
|
};
|
|
300
301
|
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
301
302
|
|
|
@@ -221,7 +221,7 @@ export const useFieldV7TextField = params => {
|
|
|
221
221
|
const getInputContainerClickHandler = useEventCallback(sectionIndex => event => {
|
|
222
222
|
// The click event on the clear button would propagate to the input, trigger this handler and result in a wrong section selection.
|
|
223
223
|
// We avoid this by checking if the call to this function is actually intended, or a side effect.
|
|
224
|
-
if (event.isDefaultPrevented()
|
|
224
|
+
if (event.isDefaultPrevented()) {
|
|
225
225
|
return;
|
|
226
226
|
}
|
|
227
227
|
setSelectedSections(sectionIndex);
|
|
@@ -231,9 +231,6 @@ export const useFieldV7TextField = params => {
|
|
|
231
231
|
event.preventDefault();
|
|
232
232
|
});
|
|
233
233
|
const getInputContentFocusHandler = useEventCallback(sectionIndex => () => {
|
|
234
|
-
if (readOnly) {
|
|
235
|
-
return;
|
|
236
|
-
}
|
|
237
234
|
setSelectedSections(sectionIndex);
|
|
238
235
|
});
|
|
239
236
|
const handleInputContentPaste = useEventCallback(event => {
|
|
@@ -19,7 +19,7 @@ export { useValidation } from './hooks/useValidation';
|
|
|
19
19
|
export { usePreviousMonthDisabled, useNextMonthDisabled } from './hooks/date-helpers-hooks';
|
|
20
20
|
export { convertFieldResponseIntoMuiTextFieldProps } from './utils/convertFieldResponseIntoMuiTextFieldProps';
|
|
21
21
|
export { applyDefaultDate, replaceInvalidDateByNull, areDatesEqual, getTodayDate, isDatePickerView, mergeDateAndTime, formatMeridiem } from './utils/date-utils';
|
|
22
|
-
export { resolveTimeViewsResponse } from './utils/date-time-utils';
|
|
22
|
+
export { resolveTimeViewsResponse, resolveDateTimeFormat } from './utils/date-time-utils';
|
|
23
23
|
export { splitFieldInternalAndForwardedProps } from './utils/fields';
|
|
24
24
|
export { getDefaultReferenceDate } from './utils/getDefaultReferenceDate';
|
|
25
25
|
export { executeInTheNextEventLoopTick, getActiveElement, onSpaceOrEnter, DEFAULT_DESKTOP_MODE_MEDIA_QUERY } from './utils/utils';
|
package/modern/locales/koKR.js
CHANGED
|
@@ -16,11 +16,10 @@ const koKRPickers = {
|
|
|
16
16
|
// DateRange labels
|
|
17
17
|
start: '시작',
|
|
18
18
|
end: '종료',
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
startDate: '시작 날짜',
|
|
20
|
+
startTime: '시작 시간',
|
|
21
|
+
endDate: '종료 날짜',
|
|
22
|
+
endTime: '종료 시간',
|
|
24
23
|
// Action bar
|
|
25
24
|
cancelButtonLabel: '취소',
|
|
26
25
|
clearButtonLabel: '초기화',
|
|
@@ -54,23 +53,22 @@ const koKRPickers = {
|
|
|
54
53
|
fieldYearPlaceholder: params => 'Y'.repeat(params.digitAmount),
|
|
55
54
|
fieldMonthPlaceholder: params => params.contentType === 'letter' ? 'MMMM' : 'MM',
|
|
56
55
|
fieldDayPlaceholder: () => 'DD',
|
|
57
|
-
|
|
56
|
+
fieldWeekDayPlaceholder: params => params.contentType === 'letter' ? 'EEEE' : 'EE',
|
|
58
57
|
fieldHoursPlaceholder: () => 'hh',
|
|
59
58
|
fieldMinutesPlaceholder: () => 'mm',
|
|
60
59
|
fieldSecondsPlaceholder: () => 'ss',
|
|
61
|
-
fieldMeridiemPlaceholder: () => 'aa'
|
|
62
|
-
|
|
60
|
+
fieldMeridiemPlaceholder: () => 'aa',
|
|
63
61
|
// View names
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
62
|
+
year: '년',
|
|
63
|
+
month: '월',
|
|
64
|
+
day: '일',
|
|
65
|
+
weekDay: '평일',
|
|
66
|
+
hours: '시간',
|
|
67
|
+
minutes: '분',
|
|
68
|
+
seconds: '초',
|
|
71
69
|
// meridiem: 'Meridiem',
|
|
72
70
|
|
|
73
71
|
// Common
|
|
74
|
-
|
|
72
|
+
empty: '공란'
|
|
75
73
|
};
|
|
76
74
|
export const koKR = getPickersLocalization(koKRPickers);
|
package/modern/locales/ruRU.js
CHANGED
|
@@ -17,11 +17,10 @@ const ruRUPickers = {
|
|
|
17
17
|
// DateRange labels
|
|
18
18
|
start: 'Начало',
|
|
19
19
|
end: 'Конец',
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
startDate: 'Начальная дата',
|
|
21
|
+
startTime: 'Начальное время',
|
|
22
|
+
endDate: 'Конечная дата',
|
|
23
|
+
endTime: 'Конечное время',
|
|
25
24
|
// Action bar
|
|
26
25
|
cancelButtonLabel: 'Отмена',
|
|
27
26
|
clearButtonLabel: 'Очистить',
|
|
@@ -55,23 +54,21 @@ const ruRUPickers = {
|
|
|
55
54
|
fieldYearPlaceholder: params => 'Г'.repeat(params.digitAmount),
|
|
56
55
|
fieldMonthPlaceholder: params => params.contentType === 'letter' ? 'ММММ' : 'ММ',
|
|
57
56
|
fieldDayPlaceholder: () => 'ДД',
|
|
58
|
-
|
|
57
|
+
fieldWeekDayPlaceholder: params => params.contentType === 'letter' ? 'ДДДД' : 'ДД',
|
|
59
58
|
fieldHoursPlaceholder: () => 'чч',
|
|
60
59
|
fieldMinutesPlaceholder: () => 'мм',
|
|
61
60
|
fieldSecondsPlaceholder: () => 'сс',
|
|
62
|
-
fieldMeridiemPlaceholder: () => '(д|п)п'
|
|
63
|
-
|
|
61
|
+
fieldMeridiemPlaceholder: () => '(д|п)п',
|
|
64
62
|
// View names
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
63
|
+
year: 'Год',
|
|
64
|
+
month: 'Месяц',
|
|
65
|
+
day: 'День',
|
|
66
|
+
weekDay: 'День недели',
|
|
67
|
+
hours: 'Часы',
|
|
68
|
+
minutes: 'Минуты',
|
|
69
|
+
seconds: 'Секунды',
|
|
70
|
+
meridiem: 'Меридием',
|
|
74
71
|
// Common
|
|
75
|
-
|
|
72
|
+
empty: 'Пустой'
|
|
76
73
|
};
|
|
77
74
|
export const ruRU = getPickersLocalization(ruRUPickers);
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.DesktopDateTimePickerLayout =
|
|
7
|
+
exports.DesktopDateTimePickerLayout = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -18,7 +18,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
18
18
|
/**
|
|
19
19
|
* @ignore - internal component.
|
|
20
20
|
*/
|
|
21
|
-
function DesktopDateTimePickerLayout(props) {
|
|
21
|
+
const DesktopDateTimePickerLayout = exports.DesktopDateTimePickerLayout = /*#__PURE__*/React.forwardRef(function DesktopDateTimePickerLayout(props, ref) {
|
|
22
22
|
const isRtl = (0, _RtlProvider.useRtl)();
|
|
23
23
|
const {
|
|
24
24
|
toolbar,
|
|
@@ -31,7 +31,6 @@ function DesktopDateTimePickerLayout(props) {
|
|
|
31
31
|
sx,
|
|
32
32
|
className,
|
|
33
33
|
isLandscape,
|
|
34
|
-
ref,
|
|
35
34
|
classes
|
|
36
35
|
} = props;
|
|
37
36
|
const isActionBarVisible = actionBar && (actionBar.props.actions?.length ?? 0) > 0;
|
|
@@ -64,7 +63,7 @@ function DesktopDateTimePickerLayout(props) {
|
|
|
64
63
|
})]
|
|
65
64
|
}), actionBar]
|
|
66
65
|
});
|
|
67
|
-
}
|
|
66
|
+
});
|
|
68
67
|
process.env.NODE_ENV !== "production" ? DesktopDateTimePickerLayout.propTypes = {
|
|
69
68
|
// ----------------------------- Warning --------------------------------
|
|
70
69
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -161,7 +161,7 @@ const PickersCalendarHeader = exports.PickersCalendarHeader = /*#__PURE__*/React
|
|
|
161
161
|
const _useSlotProps = (0, _utils.useSlotProps)({
|
|
162
162
|
elementType: SwitchViewIcon,
|
|
163
163
|
externalSlotProps: slotProps?.switchViewIcon,
|
|
164
|
-
ownerState
|
|
164
|
+
ownerState,
|
|
165
165
|
className: classes.switchViewIcon
|
|
166
166
|
}),
|
|
167
167
|
switchViewIconProps = (0, _objectWithoutPropertiesLoose2.default)(_useSlotProps, _excluded2);
|
|
@@ -98,7 +98,6 @@ const PickersLayoutContentWrapper = exports.PickersLayoutContentWrapper = (0, _s
|
|
|
98
98
|
display: 'flex',
|
|
99
99
|
flexDirection: 'column'
|
|
100
100
|
});
|
|
101
|
-
|
|
102
101
|
/**
|
|
103
102
|
* Demos:
|
|
104
103
|
*
|
|
@@ -108,7 +107,7 @@ const PickersLayoutContentWrapper = exports.PickersLayoutContentWrapper = (0, _s
|
|
|
108
107
|
*
|
|
109
108
|
* - [PickersLayout API](https://mui.com/x/api/date-pickers/pickers-layout/)
|
|
110
109
|
*/
|
|
111
|
-
const PickersLayout = exports.PickersLayout = function PickersLayout(inProps) {
|
|
110
|
+
const PickersLayout = exports.PickersLayout = /*#__PURE__*/React.forwardRef(function PickersLayout(inProps, ref) {
|
|
112
111
|
const props = (0, _styles.useThemeProps)({
|
|
113
112
|
props: inProps,
|
|
114
113
|
name: 'MuiPickersLayout'
|
|
@@ -124,7 +123,6 @@ const PickersLayout = exports.PickersLayout = function PickersLayout(inProps) {
|
|
|
124
123
|
sx,
|
|
125
124
|
className,
|
|
126
125
|
isLandscape,
|
|
127
|
-
ref,
|
|
128
126
|
wrapperVariant
|
|
129
127
|
} = props;
|
|
130
128
|
const classes = useUtilityClasses(props);
|
|
@@ -142,7 +140,7 @@ const PickersLayout = exports.PickersLayout = function PickersLayout(inProps) {
|
|
|
142
140
|
})
|
|
143
141
|
}), actionBar]
|
|
144
142
|
});
|
|
145
|
-
};
|
|
143
|
+
});
|
|
146
144
|
process.env.NODE_ENV !== "production" ? PickersLayout.propTypes = {
|
|
147
145
|
// ----------------------------- Warning --------------------------------
|
|
148
146
|
// | These PropTypes are generated from the TypeScript type definitions |
|