@mui/x-date-pickers 7.0.0-alpha.8 → 7.0.0-alpha.9
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/AdapterLuxon/AdapterLuxon.d.ts +1 -1
- package/AdapterLuxon/AdapterLuxon.js +4 -12
- package/CHANGELOG.md +379 -2
- package/DatePicker/DatePicker.js +0 -3
- package/DatePicker/DatePickerToolbar.js +0 -3
- package/DateTimePicker/DateTimePicker.js +0 -3
- package/DateTimePicker/DateTimePickerToolbar.js +0 -3
- package/DesktopDatePicker/DesktopDatePicker.js +0 -3
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -3
- package/DesktopTimePicker/DesktopTimePicker.js +0 -3
- package/MobileDatePicker/MobileDatePicker.js +0 -3
- package/MobileDateTimePicker/MobileDateTimePicker.js +0 -3
- package/MobileTimePicker/MobileTimePicker.js +0 -3
- package/MonthCalendar/MonthCalendar.js +0 -3
- package/MonthCalendar/MonthCalendar.types.d.ts +0 -3
- package/PickersCalendarHeader/PickersCalendarHeader.js +0 -3
- package/PickersCalendarHeader/PickersCalendarHeader.types.d.ts +0 -3
- package/PickersSectionList/PickersSectionList.js +6 -1
- package/PickersTextField/PickersFilledInput/PickersFilledInput.d.ts +11 -0
- package/{internals/components/PickersInput → PickersTextField/PickersFilledInput}/PickersFilledInput.js +98 -25
- package/PickersTextField/PickersFilledInput/index.d.ts +4 -0
- package/PickersTextField/PickersFilledInput/index.js +2 -0
- package/PickersTextField/PickersFilledInput/pickersFilledInputClasses.d.ts +23 -0
- package/PickersTextField/PickersFilledInput/pickersFilledInputClasses.js +8 -0
- package/PickersTextField/PickersInput/PickersInput.d.ts +10 -0
- package/PickersTextField/PickersInput/PickersInput.js +196 -0
- package/{internals/components → PickersTextField}/PickersInput/index.d.ts +2 -2
- package/PickersTextField/PickersInput/index.js +2 -0
- package/PickersTextField/PickersInput/pickersInputClasses.d.ts +22 -0
- package/PickersTextField/PickersInput/pickersInputClasses.js +8 -0
- package/PickersTextField/PickersInputBase/PickersInputBase.d.ts +16 -0
- package/{internals/components/PickersInput/PickersInput.js → PickersTextField/PickersInputBase/PickersInputBase.js} +106 -27
- package/{internals/components/PickersInput/PickersInput.types.d.ts → PickersTextField/PickersInputBase/PickersInputBase.types.d.ts} +3 -13
- package/PickersTextField/PickersInputBase/index.d.ts +4 -0
- package/PickersTextField/PickersInputBase/index.js +2 -0
- package/PickersTextField/PickersInputBase/pickersInputBaseClasses.d.ts +31 -0
- package/PickersTextField/PickersInputBase/pickersInputBaseClasses.js +6 -0
- package/{internals/components/PickersInput → PickersTextField/PickersOutlinedInput}/Outline.d.ts +3 -0
- package/{modern/internals/components/PickersInput → PickersTextField/PickersOutlinedInput}/Outline.js +5 -1
- package/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.d.ts +10 -0
- package/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +190 -0
- package/PickersTextField/PickersOutlinedInput/index.d.ts +4 -0
- package/PickersTextField/PickersOutlinedInput/index.js +2 -0
- package/PickersTextField/PickersOutlinedInput/pickersOutlinedInputClasses.d.ts +22 -0
- package/PickersTextField/PickersOutlinedInput/pickersOutlinedInputClasses.js +8 -0
- package/PickersTextField/PickersTextField.d.ts +3 -0
- package/PickersTextField/PickersTextField.js +258 -0
- package/{internals/components/PickersTextField → PickersTextField}/PickersTextField.types.d.ts +5 -2
- package/PickersTextField/index.d.ts +8 -0
- package/PickersTextField/index.js +6 -0
- package/PickersTextField/package.json +6 -0
- package/README.md +1 -1
- package/StaticDatePicker/StaticDatePicker.js +0 -3
- package/StaticDateTimePicker/StaticDateTimePicker.js +0 -3
- package/StaticTimePicker/StaticTimePicker.js +0 -3
- package/TimePicker/TimePicker.js +0 -3
- package/TimePicker/TimePickerToolbar.js +0 -3
- package/YearCalendar/YearCalendar.js +0 -3
- package/YearCalendar/YearCalendar.types.d.ts +0 -3
- package/index.d.ts +2 -1
- package/index.js +3 -2
- package/internals/hooks/useField/useField.js +6 -4
- package/internals/hooks/useField/useField.types.d.ts +4 -2
- package/internals/hooks/useField/useField.utils.d.ts +19 -9
- package/internals/hooks/useField/useField.utils.js +68 -21
- package/internals/hooks/useField/useFieldCharacterEditing.d.ts +2 -1
- package/internals/hooks/useField/useFieldCharacterEditing.js +12 -8
- package/internals/hooks/useField/useFieldState.d.ts +1 -0
- package/internals/hooks/useField/useFieldState.js +9 -7
- package/internals/models/props/basePickerProps.d.ts +0 -3
- package/internals/models/props/toolbar.d.ts +0 -3
- package/internals/utils/valueManagers.js +2 -2
- package/legacy/AdapterLuxon/AdapterLuxon.js +4 -12
- package/legacy/DatePicker/DatePicker.js +0 -3
- package/legacy/DatePicker/DatePickerToolbar.js +0 -3
- package/legacy/DateTimePicker/DateTimePicker.js +0 -3
- package/legacy/DateTimePicker/DateTimePickerToolbar.js +0 -3
- package/legacy/DesktopDatePicker/DesktopDatePicker.js +0 -3
- package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -3
- package/legacy/DesktopTimePicker/DesktopTimePicker.js +0 -3
- package/legacy/MobileDatePicker/MobileDatePicker.js +0 -3
- package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +0 -3
- package/legacy/MobileTimePicker/MobileTimePicker.js +0 -3
- package/legacy/MonthCalendar/MonthCalendar.js +0 -3
- package/legacy/PickersCalendarHeader/PickersCalendarHeader.js +0 -3
- package/legacy/PickersSectionList/PickersSectionList.js +6 -1
- package/legacy/{internals/components/PickersInput → PickersTextField/PickersFilledInput}/PickersFilledInput.js +99 -26
- package/legacy/PickersTextField/PickersFilledInput/index.js +2 -0
- package/legacy/PickersTextField/PickersFilledInput/pickersFilledInputClasses.js +8 -0
- package/legacy/PickersTextField/PickersInput/PickersInput.js +190 -0
- package/legacy/PickersTextField/PickersInput/index.js +2 -0
- package/legacy/PickersTextField/PickersInput/pickersInputClasses.js +8 -0
- package/legacy/{internals/components/PickersInput/PickersInput.js → PickersTextField/PickersInputBase/PickersInputBase.js} +106 -27
- package/legacy/PickersTextField/PickersInputBase/index.js +2 -0
- package/legacy/PickersTextField/PickersInputBase/pickersInputBaseClasses.js +6 -0
- package/legacy/{internals/components/PickersInput → PickersTextField/PickersOutlinedInput}/Outline.js +7 -1
- package/legacy/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +183 -0
- package/legacy/PickersTextField/PickersOutlinedInput/index.js +2 -0
- package/legacy/PickersTextField/PickersOutlinedInput/pickersOutlinedInputClasses.js +8 -0
- package/legacy/{internals/components/PickersTextField → PickersTextField}/PickersTextField.js +128 -8
- package/legacy/PickersTextField/index.js +6 -0
- package/legacy/StaticDatePicker/StaticDatePicker.js +0 -3
- package/legacy/StaticDateTimePicker/StaticDateTimePicker.js +0 -3
- package/legacy/StaticTimePicker/StaticTimePicker.js +0 -3
- package/legacy/TimePicker/TimePicker.js +0 -3
- package/legacy/TimePicker/TimePickerToolbar.js +0 -3
- package/legacy/YearCalendar/YearCalendar.js +0 -3
- package/legacy/index.js +3 -2
- package/legacy/internals/hooks/useField/useField.js +6 -4
- package/legacy/internals/hooks/useField/useField.utils.js +71 -20
- package/legacy/internals/hooks/useField/useFieldCharacterEditing.js +12 -8
- package/legacy/internals/hooks/useField/useFieldState.js +15 -11
- package/legacy/internals/utils/valueManagers.js +2 -2
- package/modern/AdapterLuxon/AdapterLuxon.js +3 -11
- package/modern/DatePicker/DatePicker.js +0 -3
- package/modern/DatePicker/DatePickerToolbar.js +0 -3
- package/modern/DateTimePicker/DateTimePicker.js +0 -3
- package/modern/DateTimePicker/DateTimePickerToolbar.js +0 -3
- package/modern/DesktopDatePicker/DesktopDatePicker.js +0 -3
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -3
- package/modern/DesktopTimePicker/DesktopTimePicker.js +0 -3
- package/modern/MobileDatePicker/MobileDatePicker.js +0 -3
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +0 -3
- package/modern/MobileTimePicker/MobileTimePicker.js +0 -3
- package/modern/MonthCalendar/MonthCalendar.js +0 -3
- package/modern/PickersCalendarHeader/PickersCalendarHeader.js +0 -3
- package/modern/PickersSectionList/PickersSectionList.js +6 -1
- package/modern/{internals/components/PickersInput → PickersTextField/PickersFilledInput}/PickersFilledInput.js +98 -25
- package/modern/PickersTextField/PickersFilledInput/index.js +2 -0
- package/modern/PickersTextField/PickersFilledInput/pickersFilledInputClasses.js +8 -0
- package/modern/PickersTextField/PickersInput/PickersInput.js +196 -0
- package/modern/PickersTextField/PickersInput/index.js +2 -0
- package/modern/PickersTextField/PickersInput/pickersInputClasses.js +8 -0
- package/modern/{internals/components/PickersInput/PickersInput.js → PickersTextField/PickersInputBase/PickersInputBase.js} +106 -27
- package/modern/PickersTextField/PickersInputBase/index.js +2 -0
- package/modern/PickersTextField/PickersInputBase/pickersInputBaseClasses.js +6 -0
- package/{internals/components/PickersInput → modern/PickersTextField/PickersOutlinedInput}/Outline.js +5 -1
- package/modern/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +190 -0
- package/modern/PickersTextField/PickersOutlinedInput/index.js +2 -0
- package/modern/PickersTextField/PickersOutlinedInput/pickersOutlinedInputClasses.js +8 -0
- package/modern/PickersTextField/PickersTextField.js +258 -0
- package/modern/PickersTextField/index.js +6 -0
- package/modern/StaticDatePicker/StaticDatePicker.js +0 -3
- package/modern/StaticDateTimePicker/StaticDateTimePicker.js +0 -3
- package/modern/StaticTimePicker/StaticTimePicker.js +0 -3
- package/modern/TimePicker/TimePicker.js +0 -3
- package/modern/TimePicker/TimePickerToolbar.js +0 -3
- package/modern/YearCalendar/YearCalendar.js +0 -3
- package/modern/index.js +3 -2
- package/modern/internals/hooks/useField/useField.js +5 -3
- package/modern/internals/hooks/useField/useField.utils.js +68 -21
- package/modern/internals/hooks/useField/useFieldCharacterEditing.js +12 -8
- package/modern/internals/hooks/useField/useFieldState.js +9 -7
- package/modern/internals/utils/valueManagers.js +2 -2
- package/node/AdapterLuxon/AdapterLuxon.js +3 -11
- package/node/DatePicker/DatePicker.js +0 -3
- package/node/DatePicker/DatePickerToolbar.js +0 -3
- package/node/DateTimePicker/DateTimePicker.js +0 -3
- package/node/DateTimePicker/DateTimePickerToolbar.js +0 -3
- package/node/DesktopDatePicker/DesktopDatePicker.js +0 -3
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -3
- package/node/DesktopTimePicker/DesktopTimePicker.js +0 -3
- package/node/MobileDatePicker/MobileDatePicker.js +0 -3
- package/node/MobileDateTimePicker/MobileDateTimePicker.js +0 -3
- package/node/MobileTimePicker/MobileTimePicker.js +0 -3
- package/node/MonthCalendar/MonthCalendar.js +0 -3
- package/node/PickersCalendarHeader/PickersCalendarHeader.js +0 -3
- package/node/PickersSectionList/PickersSectionList.js +6 -1
- package/node/{internals/components/PickersInput → PickersTextField/PickersFilledInput}/PickersFilledInput.js +102 -30
- package/node/PickersTextField/PickersFilledInput/index.js +25 -0
- package/node/PickersTextField/PickersFilledInput/pickersFilledInputClasses.js +16 -0
- package/node/PickersTextField/PickersInput/PickersInput.js +204 -0
- package/node/{internals/components → PickersTextField}/PickersInput/index.js +0 -7
- package/node/PickersTextField/PickersInput/pickersInputClasses.js +16 -0
- package/node/{internals/components/PickersInput/PickersInput.js → PickersTextField/PickersInputBase/PickersInputBase.js} +105 -27
- package/node/PickersTextField/PickersInputBase/index.js +25 -0
- package/node/PickersTextField/PickersInputBase/pickersInputBaseClasses.js +14 -0
- package/node/{internals/components/PickersInput → PickersTextField/PickersOutlinedInput}/Outline.js +5 -1
- package/node/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +197 -0
- package/node/PickersTextField/PickersOutlinedInput/index.js +25 -0
- package/node/PickersTextField/PickersOutlinedInput/pickersOutlinedInputClasses.js +16 -0
- package/node/{internals/components/PickersTextField → PickersTextField}/PickersTextField.js +128 -9
- package/node/PickersTextField/index.js +78 -0
- package/node/StaticDatePicker/StaticDatePicker.js +0 -3
- package/node/StaticDateTimePicker/StaticDateTimePicker.js +0 -3
- package/node/StaticTimePicker/StaticTimePicker.js +0 -3
- package/node/TimePicker/TimePicker.js +0 -3
- package/node/TimePicker/TimePickerToolbar.js +0 -3
- package/node/YearCalendar/YearCalendar.js +0 -3
- package/node/index.js +17 -5
- package/node/internals/hooks/useField/useField.js +5 -3
- package/node/internals/hooks/useField/useField.utils.js +73 -22
- package/node/internals/hooks/useField/useFieldCharacterEditing.js +11 -7
- package/node/internals/hooks/useField/useFieldState.js +8 -6
- package/node/internals/utils/valueManagers.js +2 -2
- package/package.json +7 -7
- package/themeAugmentation/components.d.ts +26 -0
- package/themeAugmentation/overrides.d.ts +16 -0
- package/themeAugmentation/props.d.ts +16 -0
- package/internals/components/PickersInput/PickersFilledInput.d.ts +0 -3
- package/internals/components/PickersInput/PickersInput.d.ts +0 -13
- package/internals/components/PickersInput/PickersOutlinedInput.d.ts +0 -3
- package/internals/components/PickersInput/PickersOutlinedInput.js +0 -117
- package/internals/components/PickersInput/PickersStandardInput.d.ts +0 -3
- package/internals/components/PickersInput/PickersStandardInput.js +0 -123
- package/internals/components/PickersInput/index.js +0 -3
- package/internals/components/PickersInput/pickersInputClasses.d.ts +0 -84
- package/internals/components/PickersInput/pickersInputClasses.js +0 -18
- package/internals/components/PickersTextField/PickersTextField.d.ts +0 -2
- package/internals/components/PickersTextField/PickersTextField.js +0 -138
- package/internals/components/PickersTextField/index.d.ts +0 -1
- package/internals/components/PickersTextField/index.js +0 -1
- package/legacy/internals/components/PickersInput/PickersOutlinedInput.js +0 -110
- package/legacy/internals/components/PickersInput/PickersStandardInput.js +0 -117
- package/legacy/internals/components/PickersInput/index.js +0 -3
- package/legacy/internals/components/PickersInput/pickersInputClasses.js +0 -18
- package/legacy/internals/components/PickersTextField/index.js +0 -1
- package/modern/internals/components/PickersInput/PickersOutlinedInput.js +0 -117
- package/modern/internals/components/PickersInput/PickersStandardInput.js +0 -123
- package/modern/internals/components/PickersInput/index.js +0 -3
- package/modern/internals/components/PickersInput/pickersInputClasses.js +0 -18
- package/modern/internals/components/PickersTextField/PickersTextField.js +0 -138
- package/modern/internals/components/PickersTextField/index.js +0 -1
- package/node/internals/components/PickersInput/PickersOutlinedInput.js +0 -125
- package/node/internals/components/PickersInput/PickersStandardInput.js +0 -132
- package/node/internals/components/PickersInput/pickersInputClasses.js +0 -29
- package/node/internals/components/PickersTextField/index.js +0 -12
- /package/{internals/components/PickersInput/PickersInput.types.js → PickersTextField/PickersInputBase/PickersInputBase.types.js} +0 -0
- /package/{internals/components/PickersTextField → PickersTextField}/PickersTextField.types.js +0 -0
- /package/{internals/components/PickersTextField → PickersTextField}/pickersTextFieldClasses.d.ts +0 -0
- /package/{internals/components/PickersTextField → PickersTextField}/pickersTextFieldClasses.js +0 -0
- /package/legacy/{internals/components/PickersInput/PickersInput.types.js → PickersTextField/PickersInputBase/PickersInputBase.types.js} +0 -0
- /package/legacy/{internals/components/PickersTextField → PickersTextField}/PickersTextField.types.js +0 -0
- /package/legacy/{internals/components/PickersTextField → PickersTextField}/pickersTextFieldClasses.js +0 -0
- /package/modern/{internals/components/PickersInput/PickersInput.types.js → PickersTextField/PickersInputBase/PickersInputBase.types.js} +0 -0
- /package/modern/{internals/components/PickersTextField → PickersTextField}/PickersTextField.types.js +0 -0
- /package/modern/{internals/components/PickersTextField → PickersTextField}/pickersTextFieldClasses.js +0 -0
- /package/node/{internals/components/PickersInput/PickersInput.types.js → PickersTextField/PickersInputBase/PickersInputBase.types.js} +0 -0
- /package/node/{internals/components/PickersTextField → PickersTextField}/PickersTextField.types.js +0 -0
- /package/node/{internals/components/PickersTextField → PickersTextField}/pickersTextFieldClasses.js +0 -0
|
@@ -65,7 +65,54 @@ export const getLetterEditingOptions = (utils, timezone, sectionType, format) =>
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
|
-
|
|
68
|
+
|
|
69
|
+
// This format should be the same on all the adapters
|
|
70
|
+
// If some adapter does not respect this convention, then we will need to hardcode the format on each adapter.
|
|
71
|
+
export const FORMAT_SECONDS_NO_LEADING_ZEROS = 's';
|
|
72
|
+
const NON_LOCALIZED_DIGITS = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
|
|
73
|
+
export const getLocalizedDigits = utils => {
|
|
74
|
+
const today = utils.date(undefined);
|
|
75
|
+
const formattedZero = utils.formatByString(utils.setSeconds(today, 0), FORMAT_SECONDS_NO_LEADING_ZEROS);
|
|
76
|
+
if (formattedZero === '0') {
|
|
77
|
+
return NON_LOCALIZED_DIGITS;
|
|
78
|
+
}
|
|
79
|
+
return Array.from({
|
|
80
|
+
length: 10
|
|
81
|
+
}).map((_, index) => utils.formatByString(utils.setSeconds(today, index), FORMAT_SECONDS_NO_LEADING_ZEROS));
|
|
82
|
+
};
|
|
83
|
+
export const removeLocalizedDigits = (valueStr, localizedDigits) => {
|
|
84
|
+
if (localizedDigits[0] === '0') {
|
|
85
|
+
return valueStr;
|
|
86
|
+
}
|
|
87
|
+
const digits = [];
|
|
88
|
+
let currentFormattedDigit = '';
|
|
89
|
+
for (let i = 0; i < valueStr.length; i += 1) {
|
|
90
|
+
currentFormattedDigit += valueStr[i];
|
|
91
|
+
const matchingDigitIndex = localizedDigits.indexOf(currentFormattedDigit);
|
|
92
|
+
if (matchingDigitIndex > -1) {
|
|
93
|
+
digits.push(matchingDigitIndex.toString());
|
|
94
|
+
currentFormattedDigit = '';
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return digits.join('');
|
|
98
|
+
};
|
|
99
|
+
export const applyLocalizedDigits = (valueStr, localizedDigits) => {
|
|
100
|
+
if (localizedDigits[0] === '0') {
|
|
101
|
+
return valueStr;
|
|
102
|
+
}
|
|
103
|
+
return valueStr.split('').map(char => localizedDigits[Number(char)]).join('');
|
|
104
|
+
};
|
|
105
|
+
export const isStringNumber = (valueStr, localizedDigits) => {
|
|
106
|
+
const nonLocalizedValueStr = removeLocalizedDigits(valueStr, localizedDigits);
|
|
107
|
+
return !Number.isNaN(Number(nonLocalizedValueStr));
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Remove the leading zeroes to a digit section value.
|
|
112
|
+
* E.g.: `03` => `3`
|
|
113
|
+
* Warning: Should only be called with non-localized digits. Call `removeLocalizedDigits` with your value if needed.
|
|
114
|
+
*/
|
|
115
|
+
export const cleanLeadingZeros = (valueStr, size) => {
|
|
69
116
|
let cleanValueStr = valueStr;
|
|
70
117
|
|
|
71
118
|
// Remove the leading zeros
|
|
@@ -77,7 +124,7 @@ export const cleanLeadingZeros = (utils, valueStr, size) => {
|
|
|
77
124
|
}
|
|
78
125
|
return cleanValueStr;
|
|
79
126
|
};
|
|
80
|
-
export const cleanDigitSectionValue = (utils,
|
|
127
|
+
export const cleanDigitSectionValue = (utils, value, sectionBoundaries, localizedDigits, section) => {
|
|
81
128
|
if (process.env.NODE_ENV !== 'production') {
|
|
82
129
|
if (section.type !== 'day' && section.contentType === 'digit-with-letter') {
|
|
83
130
|
throw new Error([`MUI X: The token "${section.format}" is a digit format with letter in it.'
|
|
@@ -90,13 +137,13 @@ export const cleanDigitSectionValue = (utils, timezone, value, sectionBoundaries
|
|
|
90
137
|
}
|
|
91
138
|
|
|
92
139
|
// queryValue without leading `0` (`01` => `1`)
|
|
93
|
-
|
|
140
|
+
let valueStr = value.toString();
|
|
94
141
|
if (section.hasLeadingZerosInInput) {
|
|
95
|
-
|
|
142
|
+
valueStr = cleanLeadingZeros(valueStr, section.maxLength);
|
|
96
143
|
}
|
|
97
|
-
return valueStr;
|
|
144
|
+
return applyLocalizedDigits(valueStr, localizedDigits);
|
|
98
145
|
};
|
|
99
|
-
export const adjustSectionValue = (utils, timezone, section, keyCode, sectionsValueBoundaries, activeDate, stepsAttributes) => {
|
|
146
|
+
export const adjustSectionValue = (utils, timezone, section, keyCode, sectionsValueBoundaries, localizedDigits, activeDate, stepsAttributes) => {
|
|
100
147
|
const delta = getDeltaFromKeyCode(keyCode);
|
|
101
148
|
const isStart = keyCode === 'Home';
|
|
102
149
|
const isEnd = keyCode === 'End';
|
|
@@ -107,9 +154,9 @@ export const adjustSectionValue = (utils, timezone, section, keyCode, sectionsVa
|
|
|
107
154
|
format: section.format,
|
|
108
155
|
contentType: section.contentType
|
|
109
156
|
});
|
|
110
|
-
const getCleanValue = value => cleanDigitSectionValue(utils,
|
|
157
|
+
const getCleanValue = value => cleanDigitSectionValue(utils, value, sectionBoundaries, localizedDigits, section);
|
|
111
158
|
const step = section.type === 'minutes' && stepsAttributes != null && stepsAttributes.minutesStep ? stepsAttributes.minutesStep : 1;
|
|
112
|
-
const currentSectionValue = parseInt(section.value, 10);
|
|
159
|
+
const currentSectionValue = parseInt(removeLocalizedDigits(section.value, localizedDigits), 10);
|
|
113
160
|
let newSectionValueNumber = currentSectionValue + delta * step;
|
|
114
161
|
if (shouldSetAbsolute) {
|
|
115
162
|
if (section.type === 'year' && !isEnd && !isStart) {
|
|
@@ -157,11 +204,11 @@ export const adjustSectionValue = (utils, timezone, section, keyCode, sectionsVa
|
|
|
157
204
|
}
|
|
158
205
|
return adjustLetterSection();
|
|
159
206
|
};
|
|
160
|
-
export const getSectionVisibleValue = (section, target) => {
|
|
207
|
+
export const getSectionVisibleValue = (section, target, localizedDigits) => {
|
|
161
208
|
let value = section.value || section.placeholder;
|
|
162
209
|
const hasLeadingZeros = target === 'non-input' ? section.hasLeadingZerosInFormat : section.hasLeadingZerosInInput;
|
|
163
210
|
if (target === 'non-input' && section.hasLeadingZerosInInput && !section.hasLeadingZerosInFormat) {
|
|
164
|
-
value = Number(value).toString();
|
|
211
|
+
value = Number(removeLocalizedDigits(value, localizedDigits)).toString();
|
|
165
212
|
}
|
|
166
213
|
|
|
167
214
|
// In the input, we add an empty character at the end of each section without leading zeros.
|
|
@@ -179,13 +226,13 @@ export const getSectionVisibleValue = (section, target) => {
|
|
|
179
226
|
return value;
|
|
180
227
|
};
|
|
181
228
|
export const cleanString = dirtyString => dirtyString.replace(/[\u2066\u2067\u2068\u2069]/g, '');
|
|
182
|
-
export const addPositionPropertiesToSections = (sections, isRTL) => {
|
|
229
|
+
export const addPositionPropertiesToSections = (sections, localizedDigits, isRTL) => {
|
|
183
230
|
let position = 0;
|
|
184
231
|
let positionInInput = isRTL ? 1 : 0;
|
|
185
232
|
const newSections = [];
|
|
186
233
|
for (let i = 0; i < sections.length; i += 1) {
|
|
187
234
|
const section = sections[i];
|
|
188
|
-
const renderedValue = getSectionVisibleValue(section, isRTL ? 'input-rtl' : 'input-ltr');
|
|
235
|
+
const renderedValue = getSectionVisibleValue(section, isRTL ? 'input-rtl' : 'input-ltr', localizedDigits);
|
|
189
236
|
const sectionStr = `${section.startSeparator}${renderedValue}${section.endSeparator}`;
|
|
190
237
|
const sectionLength = cleanString(sectionStr).length;
|
|
191
238
|
const sectionLengthInInput = sectionStr.length;
|
|
@@ -337,7 +384,7 @@ const getEscapedPartsFromFormat = (utils, format) => {
|
|
|
337
384
|
}
|
|
338
385
|
return escapedParts;
|
|
339
386
|
};
|
|
340
|
-
export const splitFormatIntoSections = (utils, timezone, localeText, format, date, formatDensity, shouldRespectLeadingZeros, isRTL) => {
|
|
387
|
+
export const splitFormatIntoSections = (utils, timezone, localeText, localizedDigits, format, date, formatDensity, shouldRespectLeadingZeros, isRTL) => {
|
|
341
388
|
let startSeparator = '';
|
|
342
389
|
const sections = [];
|
|
343
390
|
const now = utils.date();
|
|
@@ -360,7 +407,7 @@ export const splitFormatIntoSections = (utils, timezone, localeText, format, dat
|
|
|
360
407
|
}
|
|
361
408
|
maxLength = sectionConfig.maxLength;
|
|
362
409
|
if (isValidDate) {
|
|
363
|
-
sectionValue = cleanLeadingZeros(
|
|
410
|
+
sectionValue = applyLocalizedDigits(cleanLeadingZeros(removeLocalizedDigits(sectionValue, localizedDigits), maxLength), localizedDigits);
|
|
364
411
|
}
|
|
365
412
|
}
|
|
366
413
|
}
|
|
@@ -461,7 +508,7 @@ export const splitFormatIntoSections = (utils, timezone, localeText, format, dat
|
|
|
461
508
|
* Some date libraries like `dayjs` don't support parsing from date with escaped characters.
|
|
462
509
|
* To make sure that the parsing works, we are building a format and a date without any separator.
|
|
463
510
|
*/
|
|
464
|
-
export const getDateFromDateSections = (utils, sections) => {
|
|
511
|
+
export const getDateFromDateSections = (utils, sections, localizedDigits) => {
|
|
465
512
|
// If we have both a day and a weekDay section,
|
|
466
513
|
// Then we skip the weekDay in the parsing because libraries like dayjs can't parse complicated formats containing a weekDay.
|
|
467
514
|
// dayjs(dayjs().format('dddd MMMM D YYYY'), 'dddd MMMM D YYYY')) // returns `Invalid Date` even if the format is valid.
|
|
@@ -473,16 +520,16 @@ export const getDateFromDateSections = (utils, sections) => {
|
|
|
473
520
|
const shouldSkip = shouldSkipWeekDays && section.type === 'weekDay';
|
|
474
521
|
if (!shouldSkip) {
|
|
475
522
|
sectionFormats.push(section.format);
|
|
476
|
-
sectionValues.push(getSectionVisibleValue(section, 'non-input'));
|
|
523
|
+
sectionValues.push(getSectionVisibleValue(section, 'non-input', localizedDigits));
|
|
477
524
|
}
|
|
478
525
|
}
|
|
479
526
|
const formatWithoutSeparator = sectionFormats.join(' ');
|
|
480
527
|
const dateWithoutSeparatorStr = sectionValues.join(' ');
|
|
481
528
|
return utils.parse(dateWithoutSeparatorStr, formatWithoutSeparator);
|
|
482
529
|
};
|
|
483
|
-
export const createDateStrForInputFromSections = (sections, isRTL) => {
|
|
530
|
+
export const createDateStrForInputFromSections = (sections, localizedDigits, isRTL) => {
|
|
484
531
|
const formattedSections = sections.map(section => {
|
|
485
|
-
const dateValue = getSectionVisibleValue(section, isRTL ? 'input-rtl' : 'input-ltr');
|
|
532
|
+
const dateValue = getSectionVisibleValue(section, isRTL ? 'input-rtl' : 'input-ltr', localizedDigits);
|
|
486
533
|
return `${section.startSeparator}${dateValue}${section.endSeparator}`;
|
|
487
534
|
});
|
|
488
535
|
const dateStr = formattedSections.join('');
|
|
@@ -497,7 +544,7 @@ export const createDateStrForInputFromSections = (sections, isRTL) => {
|
|
|
497
544
|
// wrap into an isolated group such that separators can split the string in smaller ones by adding \u2069\u2068
|
|
498
545
|
return `\u2066${dateStr}\u2069`;
|
|
499
546
|
};
|
|
500
|
-
export const getSectionsBoundaries = (utils, timezone) => {
|
|
547
|
+
export const getSectionsBoundaries = (utils, localizedDigits, timezone) => {
|
|
501
548
|
const today = utils.date(undefined, timezone);
|
|
502
549
|
const endOfYear = utils.endOfYear(today);
|
|
503
550
|
const endOfDay = utils.endOfDay(today);
|
|
@@ -556,11 +603,11 @@ export const getSectionsBoundaries = (utils, timezone) => {
|
|
|
556
603
|
format
|
|
557
604
|
}) => {
|
|
558
605
|
const lastHourInDay = utils.getHours(endOfDay);
|
|
559
|
-
const hasMeridiem = utils.formatByString(utils.endOfDay(today), format) !== lastHourInDay.toString();
|
|
606
|
+
const hasMeridiem = removeLocalizedDigits(utils.formatByString(utils.endOfDay(today), format), localizedDigits) !== lastHourInDay.toString();
|
|
560
607
|
if (hasMeridiem) {
|
|
561
608
|
return {
|
|
562
609
|
minimum: 1,
|
|
563
|
-
maximum: Number(utils.formatByString(utils.startOfDay(today), format))
|
|
610
|
+
maximum: Number(removeLocalizedDigits(utils.formatByString(utils.startOfDay(today), format), localizedDigits))
|
|
564
611
|
};
|
|
565
612
|
}
|
|
566
613
|
return {
|
|
@@ -9,6 +9,7 @@ interface UseFieldEditingParams<TDate, TSection extends FieldSection> {
|
|
|
9
9
|
sections: TSection[];
|
|
10
10
|
updateSectionValue: (params: UpdateSectionValueParams<TSection>) => void;
|
|
11
11
|
sectionsValueBoundaries: FieldSectionsValueBoundaries<TDate>;
|
|
12
|
+
localizedDigits: string[];
|
|
12
13
|
setTempAndroidValueStr: (newValue: string | null) => void;
|
|
13
14
|
timezone: PickersTimezone;
|
|
14
15
|
}
|
|
@@ -19,7 +20,7 @@ interface UseFieldEditingParams<TDate, TSection extends FieldSection> {
|
|
|
19
20
|
* 1. The numeric editing when the user presses a digit
|
|
20
21
|
* 2. The letter editing when the user presses another key
|
|
21
22
|
*/
|
|
22
|
-
export declare const useFieldCharacterEditing: <TDate, TSection extends FieldSection>({ sections, updateSectionValue, sectionsValueBoundaries, setTempAndroidValueStr, timezone, }: UseFieldEditingParams<TDate, TSection>) => {
|
|
23
|
+
export declare const useFieldCharacterEditing: <TDate, TSection extends FieldSection>({ sections, updateSectionValue, sectionsValueBoundaries, localizedDigits, setTempAndroidValueStr, timezone, }: UseFieldEditingParams<TDate, TSection>) => {
|
|
23
24
|
applyCharacterEditing: (params: ApplyCharacterEditingParams) => void;
|
|
24
25
|
resetCharacterQuery: () => void;
|
|
25
26
|
};
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import useEventCallback from '@mui/utils/useEventCallback';
|
|
4
4
|
import { useUtils } from '../useUtils';
|
|
5
|
-
import { changeSectionValueFormat, cleanDigitSectionValue, doesSectionFormatHaveLeadingZeros, getDateSectionConfigFromFormatToken, getDaysInWeekStr, getLetterEditingOptions } from './useField.utils';
|
|
5
|
+
import { changeSectionValueFormat, cleanDigitSectionValue, doesSectionFormatHaveLeadingZeros, getDateSectionConfigFromFormatToken, getDaysInWeekStr, getLetterEditingOptions, applyLocalizedDigits, removeLocalizedDigits, isStringNumber } from './useField.utils';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* The letter editing and the numeric editing each define a `CharacterEditingApplier`.
|
|
@@ -40,6 +40,7 @@ export const useFieldCharacterEditing = ({
|
|
|
40
40
|
sections,
|
|
41
41
|
updateSectionValue,
|
|
42
42
|
sectionsValueBoundaries,
|
|
43
|
+
localizedDigits,
|
|
43
44
|
setTempAndroidValueStr,
|
|
44
45
|
timezone
|
|
45
46
|
}) => {
|
|
@@ -69,7 +70,7 @@ export const useFieldCharacterEditing = ({
|
|
|
69
70
|
const activeSection = sections[sectionIndex];
|
|
70
71
|
|
|
71
72
|
// The current query targets the section being editing
|
|
72
|
-
// We can try to
|
|
73
|
+
// We can try to concatenate the value
|
|
73
74
|
if (query != null && (!isValidQueryValue || isValidQueryValue(query.value)) && query.sectionIndex === sectionIndex) {
|
|
74
75
|
const concatenatedQueryValue = `${query.value}${cleanKeyPressed}`;
|
|
75
76
|
const queryResponse = getFirstSectionValueMatchingWithQuery(concatenatedQueryValue, activeSection);
|
|
@@ -163,7 +164,8 @@ export const useFieldCharacterEditing = ({
|
|
|
163
164
|
};
|
|
164
165
|
const applyNumericEditing = params => {
|
|
165
166
|
const getNewSectionValue = (queryValue, section) => {
|
|
166
|
-
const
|
|
167
|
+
const cleanQueryValue = removeLocalizedDigits(queryValue, localizedDigits);
|
|
168
|
+
const queryValueNumber = Number(cleanQueryValue);
|
|
167
169
|
const sectionBoundaries = sectionsValueBoundaries[section.type]({
|
|
168
170
|
currentDate: null,
|
|
169
171
|
format: section.format,
|
|
@@ -183,8 +185,8 @@ export const useFieldCharacterEditing = ({
|
|
|
183
185
|
saveQuery: true
|
|
184
186
|
};
|
|
185
187
|
}
|
|
186
|
-
const shouldGoToNextSection =
|
|
187
|
-
const newSectionValue = cleanDigitSectionValue(utils,
|
|
188
|
+
const shouldGoToNextSection = queryValueNumber * 10 > sectionBoundaries.maximum || cleanQueryValue.length === sectionBoundaries.maximum.toString().length;
|
|
189
|
+
const newSectionValue = cleanDigitSectionValue(utils, queryValueNumber, sectionBoundaries, localizedDigits, section);
|
|
188
190
|
return {
|
|
189
191
|
sectionValue: newSectionValue,
|
|
190
192
|
shouldGoToNextSection
|
|
@@ -232,12 +234,14 @@ export const useFieldCharacterEditing = ({
|
|
|
232
234
|
saveQuery: false
|
|
233
235
|
};
|
|
234
236
|
};
|
|
235
|
-
return applyQuery(params, getFirstSectionValueMatchingWithQuery, queryValue =>
|
|
237
|
+
return applyQuery(params, getFirstSectionValueMatchingWithQuery, queryValue => isStringNumber(queryValue, localizedDigits));
|
|
236
238
|
};
|
|
237
239
|
const applyCharacterEditing = useEventCallback(params => {
|
|
238
240
|
const activeSection = sections[params.sectionIndex];
|
|
239
|
-
const isNumericEditing =
|
|
240
|
-
const response = isNumericEditing ? applyNumericEditing(params
|
|
241
|
+
const isNumericEditing = isStringNumber(params.keyPressed, localizedDigits);
|
|
242
|
+
const response = isNumericEditing ? applyNumericEditing(_extends({}, params, {
|
|
243
|
+
keyPressed: applyLocalizedDigits(params.keyPressed, localizedDigits)
|
|
244
|
+
})) : applyLetterEditing(params);
|
|
241
245
|
if (response == null) {
|
|
242
246
|
setTempAndroidValueStr(null);
|
|
243
247
|
} else {
|
|
@@ -24,6 +24,7 @@ export declare const useFieldState: <TValue, TDate, TSection extends FieldSectio
|
|
|
24
24
|
updateValueFromValueStr: (valueStr: string) => void;
|
|
25
25
|
setTempAndroidValueStr: (tempValueStrAndroid: string | null) => void;
|
|
26
26
|
sectionsValueBoundaries: import("./useField.types").FieldSectionsValueBoundaries<TDate>;
|
|
27
|
+
localizedDigits: string[];
|
|
27
28
|
placeholder: string;
|
|
28
29
|
timezone: string;
|
|
29
30
|
};
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import useControlled from '@mui/utils/useControlled';
|
|
4
4
|
import { useTheme } from '@mui/material/styles';
|
|
5
5
|
import { useUtils, useLocaleText, useLocalizationContext } from '../useUtils';
|
|
6
|
-
import { addPositionPropertiesToSections, splitFormatIntoSections, mergeDateIntoReferenceDate, getSectionsBoundaries, validateSections, getDateFromDateSections } from './useField.utils';
|
|
6
|
+
import { addPositionPropertiesToSections, splitFormatIntoSections, mergeDateIntoReferenceDate, getSectionsBoundaries, validateSections, getDateFromDateSections, getLocalizedDigits } from './useField.utils';
|
|
7
7
|
import { useValueWithTimezone } from '../useValueWithTimezone';
|
|
8
8
|
import { getSectionTypeGranularity } from '../../utils/getDefaultReferenceDate';
|
|
9
9
|
export const useFieldState = params => {
|
|
@@ -42,9 +42,10 @@ export const useFieldState = params => {
|
|
|
42
42
|
onChange,
|
|
43
43
|
valueManager
|
|
44
44
|
});
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
const
|
|
45
|
+
const localizedDigits = React.useMemo(() => getLocalizedDigits(utils), [utils]);
|
|
46
|
+
const sectionsValueBoundaries = React.useMemo(() => getSectionsBoundaries(utils, localizedDigits, timezone), [utils, localizedDigits, timezone]);
|
|
47
|
+
const getSectionsFromValue = React.useCallback((value, fallbackSections = null) => fieldValueManager.getSectionsFromValue(utils, value, fallbackSections, localizedDigits, isRTL, date => splitFormatIntoSections(utils, timezone, localeText, localizedDigits, format, date, formatDensity, shouldRespectLeadingZeros, isRTL)), [fieldValueManager, format, localeText, localizedDigits, isRTL, shouldRespectLeadingZeros, utils, formatDensity, timezone]);
|
|
48
|
+
const placeholder = React.useMemo(() => fieldValueManager.getValueStrFromSections(getSectionsFromValue(valueManager.emptyValue), localizedDigits, isRTL), [fieldValueManager, getSectionsFromValue, valueManager.emptyValue, localizedDigits, isRTL]);
|
|
48
49
|
const [state, setState] = React.useState(() => {
|
|
49
50
|
const sections = getSectionsFromValue(valueFromTheOutside);
|
|
50
51
|
validateSections(sections, valueType);
|
|
@@ -142,7 +143,7 @@ export const useFieldState = params => {
|
|
|
142
143
|
value: newSectionValue,
|
|
143
144
|
modified: true
|
|
144
145
|
});
|
|
145
|
-
return addPositionPropertiesToSections(newSections, isRTL);
|
|
146
|
+
return addPositionPropertiesToSections(newSections, localizedDigits, isRTL);
|
|
146
147
|
};
|
|
147
148
|
const clearValue = () => {
|
|
148
149
|
publishValue({
|
|
@@ -179,7 +180,7 @@ export const useFieldState = params => {
|
|
|
179
180
|
if (date == null || !utils.isValid(date)) {
|
|
180
181
|
return null;
|
|
181
182
|
}
|
|
182
|
-
const sections = splitFormatIntoSections(utils, timezone, localeText, format, date, formatDensity, shouldRespectLeadingZeros, isRTL);
|
|
183
|
+
const sections = splitFormatIntoSections(utils, timezone, localeText, localizedDigits, format, date, formatDensity, shouldRespectLeadingZeros, isRTL);
|
|
183
184
|
return mergeDateIntoReferenceDate(utils, timezone, date, sections, referenceDate, false);
|
|
184
185
|
};
|
|
185
186
|
const newValue = fieldValueManager.parseValueStr(valueStr, state.referenceValue, parseDateStr);
|
|
@@ -210,7 +211,7 @@ export const useFieldState = params => {
|
|
|
210
211
|
const activeDateManager = fieldValueManager.getActiveDateManager(utils, state, activeSection);
|
|
211
212
|
const newSections = setSectionValue(selectedSectionIndexes.startIndex, newSectionValue);
|
|
212
213
|
const newActiveDateSections = activeDateManager.getSections(newSections);
|
|
213
|
-
const newActiveDate = getDateFromDateSections(utils, newActiveDateSections);
|
|
214
|
+
const newActiveDate = getDateFromDateSections(utils, newActiveDateSections, localizedDigits);
|
|
214
215
|
let values;
|
|
215
216
|
let shouldPublish;
|
|
216
217
|
|
|
@@ -278,6 +279,7 @@ export const useFieldState = params => {
|
|
|
278
279
|
updateValueFromValueStr,
|
|
279
280
|
setTempAndroidValueStr,
|
|
280
281
|
sectionsValueBoundaries,
|
|
282
|
+
localizedDigits,
|
|
281
283
|
placeholder,
|
|
282
284
|
timezone
|
|
283
285
|
};
|
|
@@ -10,9 +10,6 @@ import { DateOrTimeViewWithMeridiem } from '../common';
|
|
|
10
10
|
* Props common to all pickers after applying the default props on each picker.
|
|
11
11
|
*/
|
|
12
12
|
export interface BasePickerProps<TValue, TDate, TView extends DateOrTimeViewWithMeridiem, TError, TExternalProps extends UsePickerViewsProps<TValue, TDate, TView, any, any>, TAdditionalProps extends {}> extends UsePickerBaseProps<TValue, TDate, TView, TError, TExternalProps, TAdditionalProps> {
|
|
13
|
-
/**
|
|
14
|
-
* Class name applied to the root element.
|
|
15
|
-
*/
|
|
16
13
|
className?: string;
|
|
17
14
|
/**
|
|
18
15
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
@@ -30,12 +30,12 @@ export const singleItemValueManager = {
|
|
|
30
30
|
};
|
|
31
31
|
export const singleItemFieldValueManager = {
|
|
32
32
|
updateReferenceValue: (utils, value, prevReferenceValue) => value == null || !utils.isValid(value) ? prevReferenceValue : value,
|
|
33
|
-
getSectionsFromValue: (utils, date, prevSections, isRTL, getSectionsFromDate) => {
|
|
33
|
+
getSectionsFromValue: (utils, date, prevSections, localizedDigits, isRTL, getSectionsFromDate) => {
|
|
34
34
|
const shouldReUsePrevDateSections = !utils.isValid(date) && !!prevSections;
|
|
35
35
|
if (shouldReUsePrevDateSections) {
|
|
36
36
|
return prevSections;
|
|
37
37
|
}
|
|
38
|
-
return addPositionPropertiesToSections(getSectionsFromDate(date), isRTL);
|
|
38
|
+
return addPositionPropertiesToSections(getSectionsFromDate(date), localizedDigits, isRTL);
|
|
39
39
|
},
|
|
40
40
|
getValueStrFromSections: createDateStrForInputFromSections,
|
|
41
41
|
getActiveDateManager: (utils, state) => ({
|
|
@@ -348,10 +348,7 @@ export var AdapterLuxon = /*#__PURE__*/_createClass(function AdapterLuxon() {
|
|
|
348
348
|
return value.startOf('month');
|
|
349
349
|
};
|
|
350
350
|
this.startOfWeek = function (value) {
|
|
351
|
-
return value.startOf('week',
|
|
352
|
-
// TODO: remove when `@types/luxon` add support for the parameter.
|
|
353
|
-
// @ts-ignore
|
|
354
|
-
{
|
|
351
|
+
return value.startOf('week', {
|
|
355
352
|
useLocaleWeeks: true
|
|
356
353
|
});
|
|
357
354
|
};
|
|
@@ -365,10 +362,7 @@ export var AdapterLuxon = /*#__PURE__*/_createClass(function AdapterLuxon() {
|
|
|
365
362
|
return value.endOf('month');
|
|
366
363
|
};
|
|
367
364
|
this.endOfWeek = function (value) {
|
|
368
|
-
return value.endOf('week',
|
|
369
|
-
// TODO: remove when `@types/luxon` add support for the parameter.
|
|
370
|
-
// @ts-ignore
|
|
371
|
-
{
|
|
365
|
+
return value.endOf('week', {
|
|
372
366
|
useLocaleWeeks: true
|
|
373
367
|
});
|
|
374
368
|
};
|
|
@@ -493,10 +487,8 @@ export var AdapterLuxon = /*#__PURE__*/_createClass(function AdapterLuxon() {
|
|
|
493
487
|
return weeks;
|
|
494
488
|
};
|
|
495
489
|
this.getWeekNumber = function (value) {
|
|
496
|
-
var _value$
|
|
497
|
-
|
|
498
|
-
// @ts-ignore
|
|
499
|
-
return (_value$localeWeekNumb = value.localeWeekNumber) != null ? _value$localeWeekNumb : value.weekNumber;
|
|
490
|
+
var _value$localWeekNumbe;
|
|
491
|
+
return (_value$localWeekNumbe = value.localWeekNumber) != null ? _value$localWeekNumbe : value.weekNumber;
|
|
500
492
|
};
|
|
501
493
|
this.getYearRange = function (_ref4) {
|
|
502
494
|
var _ref5 = _slicedToArray(_ref4, 2),
|
|
@@ -54,9 +54,6 @@ process.env.NODE_ENV !== "production" ? DatePicker.propTypes = {
|
|
|
54
54
|
* - the `input` element if there is a field rendered.
|
|
55
55
|
*/
|
|
56
56
|
autoFocus: PropTypes.bool,
|
|
57
|
-
/**
|
|
58
|
-
* Class name applied to the root element.
|
|
59
|
-
*/
|
|
60
57
|
className: PropTypes.string,
|
|
61
58
|
/**
|
|
62
59
|
* If `true`, the popover or modal will close after submitting the full date.
|
|
@@ -96,9 +96,6 @@ process.env.NODE_ENV !== "production" ? DatePickerToolbar.propTypes = {
|
|
|
96
96
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
97
97
|
// ----------------------------------------------------------------------
|
|
98
98
|
classes: PropTypes.object,
|
|
99
|
-
/**
|
|
100
|
-
* className applied to the root component.
|
|
101
|
-
*/
|
|
102
99
|
className: PropTypes.string,
|
|
103
100
|
disabled: PropTypes.bool,
|
|
104
101
|
/**
|
|
@@ -64,9 +64,6 @@ process.env.NODE_ENV !== "production" ? DateTimePicker.propTypes = {
|
|
|
64
64
|
* - the `input` element if there is a field rendered.
|
|
65
65
|
*/
|
|
66
66
|
autoFocus: PropTypes.bool,
|
|
67
|
-
/**
|
|
68
|
-
* Class name applied to the root element.
|
|
69
|
-
*/
|
|
70
67
|
className: PropTypes.string,
|
|
71
68
|
/**
|
|
72
69
|
* If `true`, the popover or modal will close after submitting the full date.
|
|
@@ -333,9 +333,6 @@ process.env.NODE_ENV !== "production" ? DateTimePickerToolbar.propTypes = {
|
|
|
333
333
|
* Override or extend the styles applied to the component.
|
|
334
334
|
*/
|
|
335
335
|
classes: PropTypes.object,
|
|
336
|
-
/**
|
|
337
|
-
* className applied to the root component.
|
|
338
|
-
*/
|
|
339
336
|
className: PropTypes.string,
|
|
340
337
|
disabled: PropTypes.bool,
|
|
341
338
|
/**
|
|
@@ -79,9 +79,6 @@ DesktopDatePicker.propTypes = {
|
|
|
79
79
|
* - the `input` element if there is a field rendered.
|
|
80
80
|
*/
|
|
81
81
|
autoFocus: PropTypes.bool,
|
|
82
|
-
/**
|
|
83
|
-
* Class name applied to the root element.
|
|
84
|
-
*/
|
|
85
82
|
className: PropTypes.string,
|
|
86
83
|
/**
|
|
87
84
|
* If `true`, the popover or modal will close after submitting the full date.
|
|
@@ -126,9 +126,6 @@ DesktopDateTimePicker.propTypes = {
|
|
|
126
126
|
* - the `input` element if there is a field rendered.
|
|
127
127
|
*/
|
|
128
128
|
autoFocus: PropTypes.bool,
|
|
129
|
-
/**
|
|
130
|
-
* Class name applied to the root element.
|
|
131
|
-
*/
|
|
132
129
|
className: PropTypes.string,
|
|
133
130
|
/**
|
|
134
131
|
* If `true`, the popover or modal will close after submitting the full date.
|
|
@@ -111,9 +111,6 @@ DesktopTimePicker.propTypes = {
|
|
|
111
111
|
* - the `input` element if there is a field rendered.
|
|
112
112
|
*/
|
|
113
113
|
autoFocus: PropTypes.bool,
|
|
114
|
-
/**
|
|
115
|
-
* Class name applied to the root element.
|
|
116
|
-
*/
|
|
117
114
|
className: PropTypes.string,
|
|
118
115
|
/**
|
|
119
116
|
* If `true`, the popover or modal will close after submitting the full date.
|
|
@@ -76,9 +76,6 @@ MobileDatePicker.propTypes = {
|
|
|
76
76
|
* - the `input` element if there is a field rendered.
|
|
77
77
|
*/
|
|
78
78
|
autoFocus: PropTypes.bool,
|
|
79
|
-
/**
|
|
80
|
-
* Class name applied to the root element.
|
|
81
|
-
*/
|
|
82
79
|
className: PropTypes.string,
|
|
83
80
|
/**
|
|
84
81
|
* If `true`, the popover or modal will close after submitting the full date.
|
|
@@ -96,9 +96,6 @@ MobileDateTimePicker.propTypes = {
|
|
|
96
96
|
* - the `input` element if there is a field rendered.
|
|
97
97
|
*/
|
|
98
98
|
autoFocus: PropTypes.bool,
|
|
99
|
-
/**
|
|
100
|
-
* Class name applied to the root element.
|
|
101
|
-
*/
|
|
102
99
|
className: PropTypes.string,
|
|
103
100
|
/**
|
|
104
101
|
* If `true`, the popover or modal will close after submitting the full date.
|
|
@@ -89,9 +89,6 @@ MobileTimePicker.propTypes = {
|
|
|
89
89
|
* - the `input` element if there is a field rendered.
|
|
90
90
|
*/
|
|
91
91
|
autoFocus: PropTypes.bool,
|
|
92
|
-
/**
|
|
93
|
-
* Class name applied to the root element.
|
|
94
|
-
*/
|
|
95
92
|
className: PropTypes.string,
|
|
96
93
|
/**
|
|
97
94
|
* If `true`, the popover or modal will close after submitting the full date.
|
|
@@ -254,9 +254,6 @@ process.env.NODE_ENV !== "production" ? MonthCalendar.propTypes = {
|
|
|
254
254
|
* Override or extend the styles applied to the component.
|
|
255
255
|
*/
|
|
256
256
|
classes: PropTypes.object,
|
|
257
|
-
/**
|
|
258
|
-
* className applied to the root element.
|
|
259
|
-
*/
|
|
260
257
|
className: PropTypes.string,
|
|
261
258
|
/**
|
|
262
259
|
* The default selected value.
|
|
@@ -247,9 +247,6 @@ process.env.NODE_ENV !== "production" ? PickersCalendarHeader.propTypes = {
|
|
|
247
247
|
* Override or extend the styles applied to the component.
|
|
248
248
|
*/
|
|
249
249
|
classes: PropTypes.object,
|
|
250
|
-
/**
|
|
251
|
-
* className applied to the root element.
|
|
252
|
-
*/
|
|
253
250
|
className: PropTypes.string,
|
|
254
251
|
currentMonth: PropTypes.any.isRequired,
|
|
255
252
|
disabled: PropTypes.bool,
|
|
@@ -7,6 +7,7 @@ import PropTypes from 'prop-types';
|
|
|
7
7
|
import { useSlotProps } from '@mui/base/utils';
|
|
8
8
|
import composeClasses from '@mui/utils/composeClasses';
|
|
9
9
|
import useForkRef from '@mui/utils/useForkRef';
|
|
10
|
+
import { useThemeProps } from '@mui/material/styles';
|
|
10
11
|
import { getPickersSectionListUtilityClass, pickersSectionListClasses } from './pickersSectionListClasses';
|
|
11
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
13
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -109,8 +110,12 @@ function PickersSection(props) {
|
|
|
109
110
|
children: [/*#__PURE__*/_jsx(SectionSeparator, _extends({}, sectionSeparatorBeforeProps)), /*#__PURE__*/_jsx(SectionContent, _extends({}, sectionContentProps)), /*#__PURE__*/_jsx(SectionSeparator, _extends({}, sectionSeparatorAfterProps))]
|
|
110
111
|
}));
|
|
111
112
|
}
|
|
112
|
-
var PickersSectionList = /*#__PURE__*/React.forwardRef(function PickersSectionList(
|
|
113
|
+
var PickersSectionList = /*#__PURE__*/React.forwardRef(function PickersSectionList(inProps, ref) {
|
|
113
114
|
var _slots$root;
|
|
115
|
+
var props = useThemeProps({
|
|
116
|
+
props: inProps,
|
|
117
|
+
name: 'MuiPickersSectionList'
|
|
118
|
+
});
|
|
114
119
|
var slots = props.slots,
|
|
115
120
|
slotProps = props.slotProps,
|
|
116
121
|
elements = props.elements,
|