@mui/x-date-pickers 6.1.0 → 6.2.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/AdapterDayjs/AdapterDayjs.d.ts +114 -0
- package/AdapterDayjs/AdapterDayjs.js +387 -0
- package/AdapterDayjs/index.d.ts +1 -28
- package/AdapterDayjs/index.js +1 -102
- package/CHANGELOG.md +53 -1
- package/DateCalendar/DateCalendar.types.d.ts +1 -1
- package/DateCalendar/DayCalendar.d.ts +1 -1
- package/DateField/DateField.js +6 -0
- package/DateField/useDateField.js +3 -1
- package/DatePicker/DatePicker.js +6 -0
- package/DateTimeField/DateTimeField.js +6 -0
- package/DateTimeField/useDateTimeField.js +3 -1
- package/DateTimePicker/DateTimePicker.js +6 -0
- package/DateTimePicker/shared.js +3 -1
- package/DesktopDatePicker/DesktopDatePicker.js +6 -0
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +6 -0
- package/DesktopTimePicker/DesktopTimePicker.js +6 -0
- package/MobileDatePicker/MobileDatePicker.js +6 -0
- package/MobileDateTimePicker/MobileDateTimePicker.js +6 -0
- package/MobileTimePicker/MobileTimePicker.js +6 -0
- package/README.md +1 -0
- package/TimeClock/TimeClock.types.d.ts +1 -1
- package/TimeField/TimeField.js +6 -0
- package/TimeField/useTimeField.js +3 -1
- package/TimePicker/TimePicker.js +6 -0
- package/index.js +1 -1
- package/internals/components/PickersModalDialog.d.ts +1 -1
- package/internals/components/PickersPopper.d.ts +1 -1
- package/internals/hooks/useDesktopPicker/useDesktopPicker.js +2 -0
- package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +1 -1
- package/internals/hooks/useField/useField.types.d.ts +6 -0
- package/internals/hooks/useField/useField.utils.d.ts +1 -1
- package/internals/hooks/useField/useField.utils.js +16 -4
- package/internals/hooks/useField/useFieldState.js +3 -2
- package/internals/hooks/useMobilePicker/useMobilePicker.js +2 -0
- package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +1 -1
- package/internals/hooks/usePicker/index.d.ts +1 -1
- package/internals/hooks/usePicker/usePicker.types.d.ts +1 -1
- package/internals/hooks/usePicker/usePickerLayoutProps.d.ts +1 -1
- package/internals/hooks/usePicker/usePickerValue.d.ts +3 -179
- package/internals/hooks/usePicker/usePickerValue.js +187 -153
- package/internals/hooks/usePicker/usePickerValue.types.d.ts +233 -0
- package/internals/hooks/usePicker/usePickerValue.types.js +1 -0
- package/internals/hooks/usePicker/usePickerViews.d.ts +1 -1
- package/internals/index.d.ts +1 -1
- package/internals/models/props/basePickerProps.d.ts +6 -0
- package/legacy/AdapterDayjs/AdapterDayjs.js +403 -0
- package/legacy/AdapterDayjs/index.js +1 -119
- package/legacy/DateField/DateField.js +6 -0
- package/legacy/DateField/useDateField.js +3 -1
- package/legacy/DatePicker/DatePicker.js +6 -0
- package/legacy/DateTimeField/DateTimeField.js +6 -0
- package/legacy/DateTimeField/useDateTimeField.js +3 -1
- package/legacy/DateTimePicker/DateTimePicker.js +6 -0
- package/legacy/DateTimePicker/shared.js +3 -1
- package/legacy/DesktopDatePicker/DesktopDatePicker.js +6 -0
- package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +6 -0
- package/legacy/DesktopTimePicker/DesktopTimePicker.js +6 -0
- package/legacy/MobileDatePicker/MobileDatePicker.js +6 -0
- package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +6 -0
- package/legacy/MobileTimePicker/MobileTimePicker.js +6 -0
- package/legacy/TimeField/TimeField.js +6 -0
- package/legacy/TimeField/useTimeField.js +3 -1
- package/legacy/TimePicker/TimePicker.js +6 -0
- package/legacy/index.js +1 -1
- package/legacy/internals/hooks/useDesktopPicker/useDesktopPicker.js +2 -0
- package/legacy/internals/hooks/useField/useField.utils.js +24 -9
- package/legacy/internals/hooks/useField/useFieldState.js +5 -3
- package/legacy/internals/hooks/useMobilePicker/useMobilePicker.js +2 -0
- package/legacy/internals/hooks/usePicker/usePickerValue.js +184 -153
- package/legacy/internals/hooks/usePicker/usePickerValue.types.js +1 -0
- package/legacy/tests/describeGregorianAdapter/describeGregorianAdapter.js +20 -0
- package/legacy/tests/describeGregorianAdapter/describeGregorianAdapter.types.js +1 -0
- package/legacy/tests/describeGregorianAdapter/index.js +1 -0
- package/legacy/tests/describeGregorianAdapter/testCalculations.js +273 -0
- package/legacy/tests/describeGregorianAdapter/testFormat.js +26 -0
- package/legacy/tests/describeGregorianAdapter/testLocalization.js +15 -0
- package/legacy/tests/describeValidation/describeValidation.js +2 -1
- package/legacy/tests/describeValidation/testMinutesViewValidation.js +201 -0
- package/legacy/tests/describeValue/testPickerActionBar.js +52 -3
- package/legacy/tests/describeValue/testPickerOpenCloseLifeCycle.js +6 -6
- package/models/adapters.d.ts +21 -20
- package/modern/AdapterDayjs/AdapterDayjs.js +386 -0
- package/modern/AdapterDayjs/index.js +1 -101
- package/modern/DateField/DateField.js +6 -0
- package/modern/DateField/useDateField.js +3 -1
- package/modern/DatePicker/DatePicker.js +6 -0
- package/modern/DateTimeField/DateTimeField.js +6 -0
- package/modern/DateTimeField/useDateTimeField.js +3 -1
- package/modern/DateTimePicker/DateTimePicker.js +6 -0
- package/modern/DateTimePicker/shared.js +3 -1
- package/modern/DesktopDatePicker/DesktopDatePicker.js +6 -0
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +6 -0
- package/modern/DesktopTimePicker/DesktopTimePicker.js +6 -0
- package/modern/MobileDatePicker/MobileDatePicker.js +6 -0
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +6 -0
- package/modern/MobileTimePicker/MobileTimePicker.js +6 -0
- package/modern/TimeField/TimeField.js +6 -0
- package/modern/TimeField/useTimeField.js +3 -1
- package/modern/TimePicker/TimePicker.js +6 -0
- package/modern/index.js +1 -1
- package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +2 -0
- package/modern/internals/hooks/useField/useField.utils.js +16 -4
- package/modern/internals/hooks/useField/useFieldState.js +3 -2
- package/modern/internals/hooks/useMobilePicker/useMobilePicker.js +2 -0
- package/modern/internals/hooks/usePicker/usePickerValue.js +187 -153
- package/modern/internals/hooks/usePicker/usePickerValue.types.js +1 -0
- package/modern/tests/describeGregorianAdapter/describeGregorianAdapter.js +20 -0
- package/modern/tests/describeGregorianAdapter/describeGregorianAdapter.types.js +1 -0
- package/modern/tests/describeGregorianAdapter/index.js +1 -0
- package/modern/tests/describeGregorianAdapter/testCalculations.js +272 -0
- package/modern/tests/describeGregorianAdapter/testFormat.js +27 -0
- package/modern/tests/describeGregorianAdapter/testLocalization.js +16 -0
- package/modern/tests/describeValidation/describeValidation.js +2 -1
- package/modern/tests/describeValidation/testMinutesViewValidation.js +200 -0
- package/modern/tests/describeValue/testPickerActionBar.js +52 -3
- package/modern/tests/describeValue/testPickerOpenCloseLifeCycle.js +6 -6
- package/node/AdapterDayjs/AdapterDayjs.js +395 -0
- package/node/AdapterDayjs/index.js +6 -104
- package/node/DateField/DateField.js +6 -0
- package/node/DateField/useDateField.js +3 -1
- package/node/DatePicker/DatePicker.js +6 -0
- package/node/DateTimeField/DateTimeField.js +6 -0
- package/node/DateTimeField/useDateTimeField.js +3 -1
- package/node/DateTimePicker/DateTimePicker.js +6 -0
- package/node/DateTimePicker/shared.js +3 -1
- package/node/DesktopDatePicker/DesktopDatePicker.js +6 -0
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +6 -0
- package/node/DesktopTimePicker/DesktopTimePicker.js +6 -0
- package/node/MobileDatePicker/MobileDatePicker.js +6 -0
- package/node/MobileDateTimePicker/MobileDateTimePicker.js +6 -0
- package/node/MobileTimePicker/MobileTimePicker.js +6 -0
- package/node/TimeField/TimeField.js +6 -0
- package/node/TimeField/useTimeField.js +3 -1
- package/node/TimePicker/TimePicker.js +6 -0
- package/node/index.js +1 -1
- package/node/internals/hooks/useDesktopPicker/useDesktopPicker.js +2 -0
- package/node/internals/hooks/useField/useField.utils.js +16 -4
- package/node/internals/hooks/useField/useFieldState.js +3 -2
- package/node/internals/hooks/useMobilePicker/useMobilePicker.js +2 -0
- package/node/internals/hooks/usePicker/usePickerValue.js +187 -152
- package/node/internals/hooks/usePicker/usePickerValue.types.js +5 -0
- package/node/tests/describeGregorianAdapter/describeGregorianAdapter.js +29 -0
- package/node/tests/describeGregorianAdapter/describeGregorianAdapter.types.js +5 -0
- package/node/tests/describeGregorianAdapter/index.js +18 -0
- package/node/tests/describeGregorianAdapter/testCalculations.js +279 -0
- package/node/tests/describeGregorianAdapter/testFormat.js +34 -0
- package/node/tests/describeGregorianAdapter/testLocalization.js +23 -0
- package/node/tests/describeValidation/describeValidation.js +2 -1
- package/node/tests/describeValidation/testMinutesViewValidation.js +210 -0
- package/node/tests/describeValue/testPickerActionBar.js +52 -3
- package/node/tests/describeValue/testPickerOpenCloseLifeCycle.js +6 -6
- package/package.json +9 -9
- package/tests/describeGregorianAdapter/describeGregorianAdapter.js +20 -0
- package/tests/describeGregorianAdapter/describeGregorianAdapter.types.js +1 -0
- package/tests/describeGregorianAdapter/index.js +1 -0
- package/tests/describeGregorianAdapter/testCalculations.js +272 -0
- package/tests/describeGregorianAdapter/testFormat.js +27 -0
- package/tests/describeGregorianAdapter/testLocalization.js +16 -0
- package/tests/describeValidation/describeValidation.js +2 -1
- package/tests/describeValidation/testMinutesViewValidation.js +200 -0
- package/tests/describeValue/testPickerActionBar.js +52 -3
- package/tests/describeValue/testPickerOpenCloseLifeCycle.js +6 -6
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.AdapterDayjs = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
10
|
+
var _weekOfYear = _interopRequireDefault(require("dayjs/plugin/weekOfYear"));
|
|
11
|
+
var _customParseFormat = _interopRequireDefault(require("dayjs/plugin/customParseFormat"));
|
|
12
|
+
var _localizedFormat = _interopRequireDefault(require("dayjs/plugin/localizedFormat"));
|
|
13
|
+
var _isBetween = _interopRequireDefault(require("dayjs/plugin/isBetween"));
|
|
14
|
+
var _warning = require("../internals/utils/warning");
|
|
15
|
+
/* eslint-disable class-methods-use-this */
|
|
16
|
+
|
|
17
|
+
_dayjs.default.extend(_customParseFormat.default);
|
|
18
|
+
_dayjs.default.extend(_localizedFormat.default);
|
|
19
|
+
_dayjs.default.extend(_isBetween.default);
|
|
20
|
+
const localeNotFoundWarning = (0, _warning.buildWarning)(['Your locale has not been found.', 'Either the locale key is not a supported one. Locales supported by dayjs are available here: https://github.com/iamkun/dayjs/tree/dev/src/locale', "Or you forget to import the locale with `require('dayjs/locale/{localeUsed}')`", 'fallback on English locale']);
|
|
21
|
+
const formatTokenMap = {
|
|
22
|
+
// Year
|
|
23
|
+
YY: 'year',
|
|
24
|
+
YYYY: 'year',
|
|
25
|
+
// Month
|
|
26
|
+
M: 'month',
|
|
27
|
+
MM: 'month',
|
|
28
|
+
MMM: {
|
|
29
|
+
sectionType: 'month',
|
|
30
|
+
contentType: 'letter'
|
|
31
|
+
},
|
|
32
|
+
MMMM: {
|
|
33
|
+
sectionType: 'month',
|
|
34
|
+
contentType: 'letter'
|
|
35
|
+
},
|
|
36
|
+
// Day of the month
|
|
37
|
+
D: 'day',
|
|
38
|
+
DD: 'day',
|
|
39
|
+
Do: 'day',
|
|
40
|
+
// Day of the week
|
|
41
|
+
d: 'weekDay',
|
|
42
|
+
dd: {
|
|
43
|
+
sectionType: 'weekDay',
|
|
44
|
+
contentType: 'letter'
|
|
45
|
+
},
|
|
46
|
+
ddd: {
|
|
47
|
+
sectionType: 'weekDay',
|
|
48
|
+
contentType: 'letter'
|
|
49
|
+
},
|
|
50
|
+
dddd: {
|
|
51
|
+
sectionType: 'weekDay',
|
|
52
|
+
contentType: 'letter'
|
|
53
|
+
},
|
|
54
|
+
// Meridiem
|
|
55
|
+
A: 'meridiem',
|
|
56
|
+
a: 'meridiem',
|
|
57
|
+
// Hours
|
|
58
|
+
H: 'hours',
|
|
59
|
+
HH: 'hours',
|
|
60
|
+
h: 'hours',
|
|
61
|
+
hh: 'hours',
|
|
62
|
+
// Minutes
|
|
63
|
+
m: 'minutes',
|
|
64
|
+
mm: 'minutes',
|
|
65
|
+
// Seconds
|
|
66
|
+
s: 'seconds',
|
|
67
|
+
ss: 'seconds'
|
|
68
|
+
};
|
|
69
|
+
const defaultFormats = {
|
|
70
|
+
normalDateWithWeekday: 'ddd, MMM D',
|
|
71
|
+
normalDate: 'D MMMM',
|
|
72
|
+
shortDate: 'MMM D',
|
|
73
|
+
monthAndDate: 'MMMM D',
|
|
74
|
+
dayOfMonth: 'D',
|
|
75
|
+
year: 'YYYY',
|
|
76
|
+
month: 'MMMM',
|
|
77
|
+
monthShort: 'MMM',
|
|
78
|
+
monthAndYear: 'MMMM YYYY',
|
|
79
|
+
weekday: 'dddd',
|
|
80
|
+
weekdayShort: 'ddd',
|
|
81
|
+
minutes: 'mm',
|
|
82
|
+
hours12h: 'hh',
|
|
83
|
+
hours24h: 'HH',
|
|
84
|
+
seconds: 'ss',
|
|
85
|
+
fullTime: 'LT',
|
|
86
|
+
fullTime12h: 'hh:mm A',
|
|
87
|
+
fullTime24h: 'HH:mm',
|
|
88
|
+
fullDate: 'll',
|
|
89
|
+
fullDateWithWeekday: 'dddd, LL',
|
|
90
|
+
fullDateTime: 'lll',
|
|
91
|
+
fullDateTime12h: 'll hh:mm A',
|
|
92
|
+
fullDateTime24h: 'll HH:mm',
|
|
93
|
+
keyboardDate: 'L',
|
|
94
|
+
keyboardDateTime: 'L LT',
|
|
95
|
+
keyboardDateTime12h: 'L hh:mm A',
|
|
96
|
+
keyboardDateTime24h: 'L HH:mm'
|
|
97
|
+
};
|
|
98
|
+
const withLocale = (dayjs, locale) => !locale ? dayjs : (...args) => dayjs(...args).locale(locale);
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Based on `@date-io/dayjs`
|
|
102
|
+
*
|
|
103
|
+
* MIT License
|
|
104
|
+
*
|
|
105
|
+
* Copyright (c) 2017 Dmitriy Kovalenko
|
|
106
|
+
*
|
|
107
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
108
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
109
|
+
* in the Software without restriction, including without limitation the rights
|
|
110
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
111
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
112
|
+
* furnished to do so, subject to the following conditions:
|
|
113
|
+
*
|
|
114
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
115
|
+
* copies or substantial portions of the Software.
|
|
116
|
+
*
|
|
117
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
118
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
119
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
120
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
121
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
122
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
123
|
+
* SOFTWARE.
|
|
124
|
+
*/
|
|
125
|
+
class AdapterDayjs {
|
|
126
|
+
constructor({
|
|
127
|
+
locale: _locale,
|
|
128
|
+
formats,
|
|
129
|
+
instance
|
|
130
|
+
} = {}) {
|
|
131
|
+
this.isMUIAdapter = true;
|
|
132
|
+
this.rawDayJsInstance = void 0;
|
|
133
|
+
this.lib = 'dayjs';
|
|
134
|
+
this.dayjs = void 0;
|
|
135
|
+
this.locale = void 0;
|
|
136
|
+
this.formats = void 0;
|
|
137
|
+
this.escapedCharacters = {
|
|
138
|
+
start: '[',
|
|
139
|
+
end: ']'
|
|
140
|
+
};
|
|
141
|
+
this.formatTokenMap = formatTokenMap;
|
|
142
|
+
this.getLocaleFormats = () => {
|
|
143
|
+
const locales = this.rawDayJsInstance.Ls ?? _dayjs.default.Ls;
|
|
144
|
+
const locale = this.locale || 'en';
|
|
145
|
+
let localeObject = locales[locale];
|
|
146
|
+
if (localeObject === undefined) {
|
|
147
|
+
localeNotFoundWarning();
|
|
148
|
+
localeObject = locales.en;
|
|
149
|
+
}
|
|
150
|
+
return localeObject.formats;
|
|
151
|
+
};
|
|
152
|
+
this.date = value => {
|
|
153
|
+
if (value === null) {
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
return this.dayjs(value);
|
|
157
|
+
};
|
|
158
|
+
this.toJsDate = value => {
|
|
159
|
+
return value.toDate();
|
|
160
|
+
};
|
|
161
|
+
this.parseISO = isoString => {
|
|
162
|
+
return this.dayjs(isoString);
|
|
163
|
+
};
|
|
164
|
+
this.toISO = value => {
|
|
165
|
+
return value.toISOString();
|
|
166
|
+
};
|
|
167
|
+
this.parse = (value, format) => {
|
|
168
|
+
if (value === '') {
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
return this.dayjs(value, format, this.locale, true);
|
|
172
|
+
};
|
|
173
|
+
this.getCurrentLocaleCode = () => {
|
|
174
|
+
return this.locale || 'en';
|
|
175
|
+
};
|
|
176
|
+
this.is12HourCycleInCurrentLocale = () => {
|
|
177
|
+
/* istanbul ignore next */
|
|
178
|
+
return /A|a/.test(this.getLocaleFormats().LT || '');
|
|
179
|
+
};
|
|
180
|
+
this.expandFormat = format => {
|
|
181
|
+
const localeFormats = this.getLocaleFormats();
|
|
182
|
+
|
|
183
|
+
// @see https://github.com/iamkun/dayjs/blob/dev/src/plugin/localizedFormat/index.js
|
|
184
|
+
const t = formatBis => formatBis.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (_, a, b) => a || b.slice(1));
|
|
185
|
+
return format.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, (_, a, b) => {
|
|
186
|
+
const B = b && b.toUpperCase();
|
|
187
|
+
return a || localeFormats[b] || t(localeFormats[B]);
|
|
188
|
+
});
|
|
189
|
+
};
|
|
190
|
+
this.getFormatHelperText = format => {
|
|
191
|
+
return this.expandFormat(format).replace(/a/gi, '(a|p)m').toLocaleLowerCase();
|
|
192
|
+
};
|
|
193
|
+
this.isNull = date => {
|
|
194
|
+
return date === null;
|
|
195
|
+
};
|
|
196
|
+
this.isValid = value => {
|
|
197
|
+
return this.dayjs(value).isValid();
|
|
198
|
+
};
|
|
199
|
+
this.format = (date, formatKey) => {
|
|
200
|
+
return this.formatByString(date, this.formats[formatKey]);
|
|
201
|
+
};
|
|
202
|
+
this.formatByString = (date, formatString) => {
|
|
203
|
+
return this.dayjs(date).format(formatString);
|
|
204
|
+
};
|
|
205
|
+
this.formatNumber = numberToFormat => {
|
|
206
|
+
return numberToFormat;
|
|
207
|
+
};
|
|
208
|
+
this.getDiff = (date, comparing, units) => {
|
|
209
|
+
return date.diff(comparing, units);
|
|
210
|
+
};
|
|
211
|
+
this.isEqual = (value, comparing) => {
|
|
212
|
+
if (value === null && comparing === null) {
|
|
213
|
+
return true;
|
|
214
|
+
}
|
|
215
|
+
return this.dayjs(value).isSame(comparing);
|
|
216
|
+
};
|
|
217
|
+
this.isSameYear = (date, comparing) => {
|
|
218
|
+
return date.isSame(comparing, 'year');
|
|
219
|
+
};
|
|
220
|
+
this.isSameMonth = (date, comparing) => {
|
|
221
|
+
return date.isSame(comparing, 'month');
|
|
222
|
+
};
|
|
223
|
+
this.isSameDay = (date, comparing) => {
|
|
224
|
+
return date.isSame(comparing, 'day');
|
|
225
|
+
};
|
|
226
|
+
this.isSameHour = (date, comparing) => {
|
|
227
|
+
return date.isSame(comparing, 'hour');
|
|
228
|
+
};
|
|
229
|
+
this.isAfter = (date, value) => {
|
|
230
|
+
return date.isAfter(value);
|
|
231
|
+
};
|
|
232
|
+
this.isAfterYear = (date, value) => {
|
|
233
|
+
return date.isAfter(value, 'year');
|
|
234
|
+
};
|
|
235
|
+
this.isAfterDay = (date, value) => {
|
|
236
|
+
return date.isAfter(value, 'day');
|
|
237
|
+
};
|
|
238
|
+
this.isBefore = (date, value) => {
|
|
239
|
+
return date.isBefore(value);
|
|
240
|
+
};
|
|
241
|
+
this.isBeforeYear = (date, value) => {
|
|
242
|
+
return date.isBefore(value, 'year');
|
|
243
|
+
};
|
|
244
|
+
this.isBeforeDay = (date, value) => {
|
|
245
|
+
return date.isBefore(value, 'day');
|
|
246
|
+
};
|
|
247
|
+
this.isWithinRange = (date, [start, end]) => {
|
|
248
|
+
return date.isBetween(start, end, null, '[]');
|
|
249
|
+
};
|
|
250
|
+
this.startOfYear = date => {
|
|
251
|
+
return date.startOf('year');
|
|
252
|
+
};
|
|
253
|
+
this.startOfMonth = date => {
|
|
254
|
+
return date.startOf('month');
|
|
255
|
+
};
|
|
256
|
+
this.endOfYear = date => {
|
|
257
|
+
return date.endOf('year');
|
|
258
|
+
};
|
|
259
|
+
this.startOfWeek = date => {
|
|
260
|
+
return date.startOf('week');
|
|
261
|
+
};
|
|
262
|
+
this.startOfDay = date => {
|
|
263
|
+
return date.startOf('day');
|
|
264
|
+
};
|
|
265
|
+
this.endOfMonth = date => {
|
|
266
|
+
return date.endOf('month');
|
|
267
|
+
};
|
|
268
|
+
this.endOfWeek = date => {
|
|
269
|
+
return date.endOf('week');
|
|
270
|
+
};
|
|
271
|
+
this.endOfDay = date => {
|
|
272
|
+
return date.endOf('day');
|
|
273
|
+
};
|
|
274
|
+
this.addYears = (date, count) => {
|
|
275
|
+
return count < 0 ? date.subtract(Math.abs(count), 'year') : date.add(count, 'year');
|
|
276
|
+
};
|
|
277
|
+
this.addMonths = (date, count) => {
|
|
278
|
+
return count < 0 ? date.subtract(Math.abs(count), 'month') : date.add(count, 'month');
|
|
279
|
+
};
|
|
280
|
+
this.addWeeks = (date, count) => {
|
|
281
|
+
return count < 0 ? date.subtract(Math.abs(count), 'week') : date.add(count, 'week');
|
|
282
|
+
};
|
|
283
|
+
this.addDays = (date, count) => {
|
|
284
|
+
return count < 0 ? date.subtract(Math.abs(count), 'day') : date.add(count, 'day');
|
|
285
|
+
};
|
|
286
|
+
this.addHours = (date, count) => {
|
|
287
|
+
return count < 0 ? date.subtract(Math.abs(count), 'hour') : date.add(count, 'hour');
|
|
288
|
+
};
|
|
289
|
+
this.addMinutes = (date, count) => {
|
|
290
|
+
return count < 0 ? date.subtract(Math.abs(count), 'minute') : date.add(count, 'minute');
|
|
291
|
+
};
|
|
292
|
+
this.addSeconds = (date, count) => {
|
|
293
|
+
return count < 0 ? date.subtract(Math.abs(count), 'second') : date.add(count, 'second');
|
|
294
|
+
};
|
|
295
|
+
this.getYear = date => {
|
|
296
|
+
return date.year();
|
|
297
|
+
};
|
|
298
|
+
this.getMonth = date => {
|
|
299
|
+
return date.month();
|
|
300
|
+
};
|
|
301
|
+
this.getDate = date => {
|
|
302
|
+
return date.date();
|
|
303
|
+
};
|
|
304
|
+
this.getHours = date => {
|
|
305
|
+
return date.hour();
|
|
306
|
+
};
|
|
307
|
+
this.getMinutes = date => {
|
|
308
|
+
return date.minute();
|
|
309
|
+
};
|
|
310
|
+
this.getSeconds = date => {
|
|
311
|
+
return date.second();
|
|
312
|
+
};
|
|
313
|
+
this.setYear = (date, year) => {
|
|
314
|
+
return date.set('year', year);
|
|
315
|
+
};
|
|
316
|
+
this.setMonth = (date, count) => {
|
|
317
|
+
return date.set('month', count);
|
|
318
|
+
};
|
|
319
|
+
this.setDate = (date, count) => {
|
|
320
|
+
return date.set('date', count);
|
|
321
|
+
};
|
|
322
|
+
this.setHours = (date, count) => {
|
|
323
|
+
return date.set('hour', count);
|
|
324
|
+
};
|
|
325
|
+
this.setMinutes = (date, count) => {
|
|
326
|
+
return date.set('minute', count);
|
|
327
|
+
};
|
|
328
|
+
this.setSeconds = (date, count) => {
|
|
329
|
+
return date.set('second', count);
|
|
330
|
+
};
|
|
331
|
+
this.getDaysInMonth = date => {
|
|
332
|
+
return date.daysInMonth();
|
|
333
|
+
};
|
|
334
|
+
this.getNextMonth = date => {
|
|
335
|
+
return date.add(1, 'month');
|
|
336
|
+
};
|
|
337
|
+
this.getPreviousMonth = date => {
|
|
338
|
+
return date.subtract(1, 'month');
|
|
339
|
+
};
|
|
340
|
+
this.getMonthArray = date => {
|
|
341
|
+
const firstMonth = date.startOf('year');
|
|
342
|
+
const monthArray = [firstMonth];
|
|
343
|
+
while (monthArray.length < 12) {
|
|
344
|
+
const prevMonth = monthArray[monthArray.length - 1];
|
|
345
|
+
monthArray.push(this.getNextMonth(prevMonth));
|
|
346
|
+
}
|
|
347
|
+
return monthArray;
|
|
348
|
+
};
|
|
349
|
+
this.mergeDateAndTime = (date, time) => {
|
|
350
|
+
return date.hour(time.hour()).minute(time.minute()).second(time.second());
|
|
351
|
+
};
|
|
352
|
+
this.getWeekdays = () => {
|
|
353
|
+
const start = this.dayjs().startOf('week');
|
|
354
|
+
return [0, 1, 2, 3, 4, 5, 6].map(diff => this.formatByString(start.add(diff, 'day'), 'dd'));
|
|
355
|
+
};
|
|
356
|
+
this.getWeekArray = date => {
|
|
357
|
+
const start = this.dayjs(date).startOf('month').startOf('week');
|
|
358
|
+
const end = this.dayjs(date).endOf('month').endOf('week');
|
|
359
|
+
let count = 0;
|
|
360
|
+
let current = start;
|
|
361
|
+
const nestedWeeks = [];
|
|
362
|
+
while (current.isBefore(end)) {
|
|
363
|
+
const weekNumber = Math.floor(count / 7);
|
|
364
|
+
nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];
|
|
365
|
+
nestedWeeks[weekNumber].push(current);
|
|
366
|
+
current = current.add(1, 'day');
|
|
367
|
+
count += 1;
|
|
368
|
+
}
|
|
369
|
+
return nestedWeeks;
|
|
370
|
+
};
|
|
371
|
+
this.getWeekNumber = date => {
|
|
372
|
+
return date.week();
|
|
373
|
+
};
|
|
374
|
+
this.getYearRange = (start, end) => {
|
|
375
|
+
const startDate = this.dayjs(start).startOf('year');
|
|
376
|
+
const endDate = this.dayjs(end).endOf('year');
|
|
377
|
+
const years = [];
|
|
378
|
+
let current = startDate;
|
|
379
|
+
while (current.isBefore(endDate)) {
|
|
380
|
+
years.push(current);
|
|
381
|
+
current = current.add(1, 'year');
|
|
382
|
+
}
|
|
383
|
+
return years;
|
|
384
|
+
};
|
|
385
|
+
this.getMeridiemText = ampm => {
|
|
386
|
+
return ampm === 'am' ? 'AM' : 'PM';
|
|
387
|
+
};
|
|
388
|
+
this.rawDayJsInstance = instance || _dayjs.default;
|
|
389
|
+
this.dayjs = withLocale(this.rawDayJsInstance, _locale);
|
|
390
|
+
this.locale = _locale;
|
|
391
|
+
this.formats = (0, _extends2.default)({}, defaultFormats, formats);
|
|
392
|
+
_dayjs.default.extend(_weekOfYear.default);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
exports.AdapterDayjs = AdapterDayjs;
|
|
@@ -1,110 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
|
-
exports
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var _warning = require("../internals/utils/warning");
|
|
12
|
-
/* eslint-disable class-methods-use-this */
|
|
13
|
-
|
|
14
|
-
const localeNotFoundWarning = (0, _warning.buildWarning)(['Your locale has not been found.', 'Either the locale key is not a supported one. Locales supported by dayjs are available here: https://github.com/iamkun/dayjs/tree/dev/src/locale', "Or you forget to import the locale with `require('dayjs/locale/{localeUsed}')`", 'fallback on English locale']);
|
|
15
|
-
const formatTokenMap = {
|
|
16
|
-
// Year
|
|
17
|
-
YY: 'year',
|
|
18
|
-
YYYY: 'year',
|
|
19
|
-
// Month
|
|
20
|
-
M: 'month',
|
|
21
|
-
MM: 'month',
|
|
22
|
-
MMM: {
|
|
23
|
-
sectionType: 'month',
|
|
24
|
-
contentType: 'letter'
|
|
25
|
-
},
|
|
26
|
-
MMMM: {
|
|
27
|
-
sectionType: 'month',
|
|
28
|
-
contentType: 'letter'
|
|
29
|
-
},
|
|
30
|
-
// Day of the month
|
|
31
|
-
D: 'day',
|
|
32
|
-
DD: 'day',
|
|
33
|
-
Do: 'day',
|
|
34
|
-
// Day of the week
|
|
35
|
-
d: 'weekDay',
|
|
36
|
-
dd: {
|
|
37
|
-
sectionType: 'weekDay',
|
|
38
|
-
contentType: 'letter'
|
|
39
|
-
},
|
|
40
|
-
ddd: {
|
|
41
|
-
sectionType: 'weekDay',
|
|
42
|
-
contentType: 'letter'
|
|
43
|
-
},
|
|
44
|
-
dddd: {
|
|
45
|
-
sectionType: 'weekDay',
|
|
46
|
-
contentType: 'letter'
|
|
47
|
-
},
|
|
48
|
-
// Meridiem
|
|
49
|
-
A: 'meridiem',
|
|
50
|
-
a: 'meridiem',
|
|
51
|
-
// Hours
|
|
52
|
-
H: 'hours',
|
|
53
|
-
HH: 'hours',
|
|
54
|
-
h: 'hours',
|
|
55
|
-
hh: 'hours',
|
|
56
|
-
// Minutes
|
|
57
|
-
m: 'minutes',
|
|
58
|
-
mm: 'minutes',
|
|
59
|
-
// Seconds
|
|
60
|
-
s: 'seconds',
|
|
61
|
-
ss: 'seconds'
|
|
62
|
-
};
|
|
63
|
-
class AdapterDayjs extends _dayjs2.default {
|
|
64
|
-
constructor(options) {
|
|
65
|
-
super(options);
|
|
66
|
-
this.isMUIAdapter = true;
|
|
67
|
-
this.formatTokenMap = formatTokenMap;
|
|
68
|
-
this.escapedCharacters = {
|
|
69
|
-
start: '[',
|
|
70
|
-
end: ']'
|
|
71
|
-
};
|
|
72
|
-
this.getLocaleFormats = () => {
|
|
73
|
-
const locales = this.rawDayJsInstance.Ls ?? _dayjs.default.Ls;
|
|
74
|
-
const locale = this.locale || 'en';
|
|
75
|
-
let localeObject = locales[locale];
|
|
76
|
-
if (localeObject === undefined) {
|
|
77
|
-
localeNotFoundWarning();
|
|
78
|
-
localeObject = locales.en;
|
|
79
|
-
}
|
|
80
|
-
return localeObject.formats;
|
|
81
|
-
};
|
|
82
|
-
this.is12HourCycleInCurrentLocale = () => {
|
|
83
|
-
/* istanbul ignore next */
|
|
84
|
-
return /A|a/.test(this.getLocaleFormats().LT || '');
|
|
85
|
-
};
|
|
86
|
-
/**
|
|
87
|
-
* The current getFormatHelperText method uses an outdated format parsing logic.
|
|
88
|
-
* We should use this one in the future to support all localized formats.
|
|
89
|
-
*/
|
|
90
|
-
this.expandFormat = format => {
|
|
91
|
-
const localeFormats = this.getLocaleFormats();
|
|
92
|
-
|
|
93
|
-
// @see https://github.com/iamkun/dayjs/blob/dev/src/plugin/localizedFormat/index.js
|
|
94
|
-
const t = formatBis => formatBis.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (_, a, b) => a || b.slice(1));
|
|
95
|
-
return format.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, (_, a, b) => {
|
|
96
|
-
const B = b && b.toUpperCase();
|
|
97
|
-
return a || localeFormats[b] || t(localeFormats[B]);
|
|
98
|
-
});
|
|
99
|
-
};
|
|
100
|
-
// Redefined here just to show how it can be written using expandFormat
|
|
101
|
-
this.getFormatHelperText = format => {
|
|
102
|
-
return this.expandFormat(format).replace(/a/gi, '(a|p)m').toLocaleLowerCase();
|
|
103
|
-
};
|
|
104
|
-
this.getWeekNumber = date => {
|
|
105
|
-
return date.week();
|
|
106
|
-
};
|
|
107
|
-
_dayjs.default.extend(_weekOfYear.default);
|
|
6
|
+
Object.defineProperty(exports, "AdapterDayjs", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _AdapterDayjs.AdapterDayjs;
|
|
108
10
|
}
|
|
109
|
-
}
|
|
110
|
-
|
|
11
|
+
});
|
|
12
|
+
var _AdapterDayjs = require("./AdapterDayjs");
|
|
@@ -129,6 +129,12 @@ process.env.NODE_ENV !== "production" ? DateField.propTypes = {
|
|
|
129
129
|
* Format of the date when rendered in the input(s).
|
|
130
130
|
*/
|
|
131
131
|
format: _propTypes.default.string,
|
|
132
|
+
/**
|
|
133
|
+
* Density of the format when rendered in the input.
|
|
134
|
+
* Setting `formatDensity` to `"spacious"` will add a space before and after each `/`, `-` and `.` character.
|
|
135
|
+
* @default "dense"
|
|
136
|
+
*/
|
|
137
|
+
formatDensity: _propTypes.default.oneOf(['dense', 'spacious']),
|
|
132
138
|
/**
|
|
133
139
|
* Props applied to the [`FormHelperText`](/material-ui/api/form-helper-text/) element.
|
|
134
140
|
*/
|
|
@@ -12,7 +12,7 @@ var _useField = require("../internals/hooks/useField");
|
|
|
12
12
|
var _useDateValidation = require("../internals/hooks/validation/useDateValidation");
|
|
13
13
|
var _dateUtils = require("../internals/utils/date-utils");
|
|
14
14
|
var _useUtils = require("../internals/hooks/useUtils");
|
|
15
|
-
const _excluded = ["value", "defaultValue", "format", "onChange", "readOnly", "onError", "shouldDisableDate", "shouldDisableMonth", "shouldDisableYear", "minDate", "maxDate", "disableFuture", "disablePast", "selectedSections", "onSelectedSectionsChange", "unstableFieldRef"];
|
|
15
|
+
const _excluded = ["value", "defaultValue", "format", "formatDensity", "onChange", "readOnly", "onError", "shouldDisableDate", "shouldDisableMonth", "shouldDisableYear", "minDate", "maxDate", "disableFuture", "disablePast", "selectedSections", "onSelectedSectionsChange", "unstableFieldRef"];
|
|
16
16
|
const useDefaultizedDateField = props => {
|
|
17
17
|
const utils = (0, _useUtils.useUtils)();
|
|
18
18
|
const defaultDates = (0, _useUtils.useDefaultDates)();
|
|
@@ -33,6 +33,7 @@ const useDateField = ({
|
|
|
33
33
|
value,
|
|
34
34
|
defaultValue,
|
|
35
35
|
format,
|
|
36
|
+
formatDensity,
|
|
36
37
|
onChange,
|
|
37
38
|
readOnly,
|
|
38
39
|
onError,
|
|
@@ -55,6 +56,7 @@ const useDateField = ({
|
|
|
55
56
|
value,
|
|
56
57
|
defaultValue,
|
|
57
58
|
format,
|
|
59
|
+
formatDensity,
|
|
58
60
|
onChange,
|
|
59
61
|
readOnly,
|
|
60
62
|
onError,
|
|
@@ -137,6 +137,12 @@ process.env.NODE_ENV !== "production" ? DatePicker.propTypes = {
|
|
|
137
137
|
* Defaults to localized format based on the used `views`.
|
|
138
138
|
*/
|
|
139
139
|
format: _propTypes.default.string,
|
|
140
|
+
/**
|
|
141
|
+
* Density of the format when rendered in the input.
|
|
142
|
+
* Setting `formatDensity` to `"spacious"` will add a space before and after each `/`, `-` and `.` character.
|
|
143
|
+
* @default "dense"
|
|
144
|
+
*/
|
|
145
|
+
formatDensity: _propTypes.default.oneOf(['dense', 'spacious']),
|
|
140
146
|
/**
|
|
141
147
|
* Pass a ref to the `input` element.
|
|
142
148
|
*/
|
|
@@ -139,6 +139,12 @@ process.env.NODE_ENV !== "production" ? DateTimeField.propTypes = {
|
|
|
139
139
|
* Format of the date when rendered in the input(s).
|
|
140
140
|
*/
|
|
141
141
|
format: _propTypes.default.string,
|
|
142
|
+
/**
|
|
143
|
+
* Density of the format when rendered in the input.
|
|
144
|
+
* Setting `formatDensity` to `"spacious"` will add a space before and after each `/`, `-` and `.` character.
|
|
145
|
+
* @default "dense"
|
|
146
|
+
*/
|
|
147
|
+
formatDensity: _propTypes.default.oneOf(['dense', 'spacious']),
|
|
142
148
|
/**
|
|
143
149
|
* Props applied to the [`FormHelperText`](/material-ui/api/form-helper-text/) element.
|
|
144
150
|
*/
|
|
@@ -12,7 +12,7 @@ var _useField = require("../internals/hooks/useField");
|
|
|
12
12
|
var _useDateTimeValidation = require("../internals/hooks/validation/useDateTimeValidation");
|
|
13
13
|
var _dateUtils = require("../internals/utils/date-utils");
|
|
14
14
|
var _useUtils = require("../internals/hooks/useUtils");
|
|
15
|
-
const _excluded = ["value", "defaultValue", "format", "onChange", "readOnly", "onError", "shouldDisableDate", "shouldDisableMonth", "shouldDisableYear", "minDate", "maxDate", "disableFuture", "disablePast", "minTime", "maxTime", "minDateTime", "maxDateTime", "minutesStep", "disableIgnoringDatePartForTimeValidation", "shouldDisableClock", "shouldDisableTime", "selectedSections", "onSelectedSectionsChange", "ampm", "unstableFieldRef"];
|
|
15
|
+
const _excluded = ["value", "defaultValue", "format", "formatDensity", "onChange", "readOnly", "onError", "shouldDisableDate", "shouldDisableMonth", "shouldDisableYear", "minDate", "maxDate", "disableFuture", "disablePast", "minTime", "maxTime", "minDateTime", "maxDateTime", "minutesStep", "disableIgnoringDatePartForTimeValidation", "shouldDisableClock", "shouldDisableTime", "selectedSections", "onSelectedSectionsChange", "ampm", "unstableFieldRef"];
|
|
16
16
|
const useDefaultizedDateTimeField = props => {
|
|
17
17
|
const utils = (0, _useUtils.useUtils)();
|
|
18
18
|
const defaultDates = (0, _useUtils.useDefaultDates)();
|
|
@@ -38,6 +38,7 @@ const useDateTimeField = ({
|
|
|
38
38
|
value,
|
|
39
39
|
defaultValue,
|
|
40
40
|
format,
|
|
41
|
+
formatDensity,
|
|
41
42
|
onChange,
|
|
42
43
|
readOnly,
|
|
43
44
|
onError,
|
|
@@ -67,6 +68,7 @@ const useDateTimeField = ({
|
|
|
67
68
|
value,
|
|
68
69
|
defaultValue,
|
|
69
70
|
format,
|
|
71
|
+
formatDensity,
|
|
70
72
|
onChange,
|
|
71
73
|
readOnly,
|
|
72
74
|
onError,
|
|
@@ -152,6 +152,12 @@ process.env.NODE_ENV !== "production" ? DateTimePicker.propTypes = {
|
|
|
152
152
|
* Defaults to localized format based on the used `views`.
|
|
153
153
|
*/
|
|
154
154
|
format: _propTypes.default.string,
|
|
155
|
+
/**
|
|
156
|
+
* Density of the format when rendered in the input.
|
|
157
|
+
* Setting `formatDensity` to `"spacious"` will add a space before and after each `/`, `-` and `.` character.
|
|
158
|
+
* @default "dense"
|
|
159
|
+
*/
|
|
160
|
+
formatDensity: _propTypes.default.oneOf(['dense', 'spacious']),
|
|
155
161
|
/**
|
|
156
162
|
* Pass a ref to the `input` element.
|
|
157
163
|
*/
|
|
@@ -44,7 +44,9 @@ function useDateTimePickerDefaultizedProps(props, name) {
|
|
|
44
44
|
localeText,
|
|
45
45
|
orientation: themeProps.orientation ?? 'portrait',
|
|
46
46
|
// TODO: Remove from public API
|
|
47
|
-
disableIgnoringDatePartForTimeValidation: themeProps.disableIgnoringDatePartForTimeValidation ?? Boolean(themeProps.minDateTime || themeProps.maxDateTime
|
|
47
|
+
disableIgnoringDatePartForTimeValidation: themeProps.disableIgnoringDatePartForTimeValidation ?? Boolean(themeProps.minDateTime || themeProps.maxDateTime ||
|
|
48
|
+
// allow time clock to correctly check time validity: https://github.com/mui/mui-x/issues/8520
|
|
49
|
+
themeProps.disablePast || themeProps.disableFuture),
|
|
48
50
|
disableFuture: themeProps.disableFuture ?? false,
|
|
49
51
|
disablePast: themeProps.disablePast ?? false,
|
|
50
52
|
minDate: (0, _dateUtils.applyDefaultDate)(utils, themeProps.minDateTime ?? themeProps.minDate, defaultDates.minDate),
|
|
@@ -149,6 +149,12 @@ DesktopDatePicker.propTypes = {
|
|
|
149
149
|
* Defaults to localized format based on the used `views`.
|
|
150
150
|
*/
|
|
151
151
|
format: _propTypes.default.string,
|
|
152
|
+
/**
|
|
153
|
+
* Density of the format when rendered in the input.
|
|
154
|
+
* Setting `formatDensity` to `"spacious"` will add a space before and after each `/`, `-` and `.` character.
|
|
155
|
+
* @default "dense"
|
|
156
|
+
*/
|
|
157
|
+
formatDensity: _propTypes.default.oneOf(['dense', 'spacious']),
|
|
152
158
|
/**
|
|
153
159
|
* Pass a ref to the `input` element.
|
|
154
160
|
*/
|
|
@@ -172,6 +172,12 @@ DesktopDateTimePicker.propTypes = {
|
|
|
172
172
|
* Defaults to localized format based on the used `views`.
|
|
173
173
|
*/
|
|
174
174
|
format: _propTypes.default.string,
|
|
175
|
+
/**
|
|
176
|
+
* Density of the format when rendered in the input.
|
|
177
|
+
* Setting `formatDensity` to `"spacious"` will add a space before and after each `/`, `-` and `.` character.
|
|
178
|
+
* @default "dense"
|
|
179
|
+
*/
|
|
180
|
+
formatDensity: _propTypes.default.oneOf(['dense', 'spacious']),
|
|
175
181
|
/**
|
|
176
182
|
* Pass a ref to the `input` element.
|
|
177
183
|
*/
|
|
@@ -138,6 +138,12 @@ DesktopTimePicker.propTypes = {
|
|
|
138
138
|
* Defaults to localized format based on the used `views`.
|
|
139
139
|
*/
|
|
140
140
|
format: _propTypes.default.string,
|
|
141
|
+
/**
|
|
142
|
+
* Density of the format when rendered in the input.
|
|
143
|
+
* Setting `formatDensity` to `"spacious"` will add a space before and after each `/`, `-` and `.` character.
|
|
144
|
+
* @default "dense"
|
|
145
|
+
*/
|
|
146
|
+
formatDensity: _propTypes.default.oneOf(['dense', 'spacious']),
|
|
141
147
|
/**
|
|
142
148
|
* Pass a ref to the `input` element.
|
|
143
149
|
*/
|
|
@@ -146,6 +146,12 @@ MobileDatePicker.propTypes = {
|
|
|
146
146
|
* Defaults to localized format based on the used `views`.
|
|
147
147
|
*/
|
|
148
148
|
format: _propTypes.default.string,
|
|
149
|
+
/**
|
|
150
|
+
* Density of the format when rendered in the input.
|
|
151
|
+
* Setting `formatDensity` to `"spacious"` will add a space before and after each `/`, `-` and `.` character.
|
|
152
|
+
* @default "dense"
|
|
153
|
+
*/
|
|
154
|
+
formatDensity: _propTypes.default.oneOf(['dense', 'spacious']),
|
|
149
155
|
/**
|
|
150
156
|
* Pass a ref to the `input` element.
|
|
151
157
|
*/
|