@mui/x-date-pickers-pro 7.0.0-alpha.0 → 7.0.0-alpha.1
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 +409 -1
- package/DateRangeCalendar/DateRangeCalendar.js +70 -60
- package/DateRangeCalendar/DateRangeCalendar.types.d.ts +8 -1
- package/DateRangePicker/DateRangePicker.js +0 -1
- package/DateRangePicker/shared.d.ts +1 -1
- package/DesktopDateRangePicker/DesktopDateRangePicker.js +0 -1
- package/MobileDateRangePicker/MobileDateRangePicker.js +0 -1
- package/StaticDateRangePicker/StaticDateRangePicker.js +0 -1
- package/index.js +1 -1
- package/internals/utils/date-fields-utils.d.ts +0 -1
- package/internals/utils/releaseInfo.js +1 -1
- package/legacy/DateRangeCalendar/DateRangeCalendar.js +35 -27
- package/legacy/DateRangePicker/DateRangePicker.js +0 -1
- package/legacy/DesktopDateRangePicker/DesktopDateRangePicker.js +0 -1
- package/legacy/MobileDateRangePicker/MobileDateRangePicker.js +0 -1
- package/legacy/StaticDateRangePicker/StaticDateRangePicker.js +0 -1
- package/legacy/index.js +1 -1
- package/legacy/internals/utils/releaseInfo.js +1 -1
- package/modern/DateRangeCalendar/DateRangeCalendar.js +31 -25
- package/modern/DateRangePicker/DateRangePicker.js +0 -1
- package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +0 -1
- package/modern/MobileDateRangePicker/MobileDateRangePicker.js +0 -1
- package/modern/StaticDateRangePicker/StaticDateRangePicker.js +0 -1
- package/modern/index.js +1 -1
- package/modern/internals/utils/releaseInfo.js +1 -1
- package/node/DateRangeCalendar/DateRangeCalendar.js +30 -24
- package/node/DateRangePicker/DateRangePicker.js +0 -1
- package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +0 -1
- package/node/MobileDateRangePicker/MobileDateRangePicker.js +0 -1
- package/node/StaticDateRangePicker/StaticDateRangePicker.js +0 -1
- package/node/index.js +1 -1
- package/node/internals/utils/releaseInfo.js +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,413 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 7.0.0-alpha.1
|
|
7
|
+
|
|
8
|
+
_Nov 17, 2023_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 3 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🐞 Bugfixes
|
|
13
|
+
- 📚 Documentation improvements
|
|
14
|
+
|
|
15
|
+
### Date Pickers
|
|
16
|
+
|
|
17
|
+
#### `@mui/x-date-pickers@7.0.0-alpha.1` / `@mui/x-date-pickers-pro@7.0.0-alpha.1` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
18
|
+
|
|
19
|
+
#### Breaking changes
|
|
20
|
+
|
|
21
|
+
- The string argument of the `dayOfWeekFormatter` prop has been replaced in favor of the date object to allow more flexibility.
|
|
22
|
+
|
|
23
|
+
```diff
|
|
24
|
+
<DateCalendar
|
|
25
|
+
// If you were still using the day string, you can get it back with your date library.
|
|
26
|
+
- dayOfWeekFormatter={dayStr => `${dayStr}.`}
|
|
27
|
+
+ dayOfWeekFormatter={day => `${day.format('dd')}.`}
|
|
28
|
+
|
|
29
|
+
// If you were already using the day object, just remove the first argument.
|
|
30
|
+
- dayOfWeekFormatter={(_dayStr, day) => `${day.format('dd')}.`}
|
|
31
|
+
+ dayOfWeekFormatter={day => `${day.format('dd')}.`}
|
|
32
|
+
/>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
- The imports related to the `calendarHeader` slot have been moved from `@mui/x-date-pickers/DateCalendar` to `@mui/x-date-pickers/PIckersCalendarHeader`:
|
|
36
|
+
|
|
37
|
+
```diff
|
|
38
|
+
export {
|
|
39
|
+
pickersCalendarHeaderClasses,
|
|
40
|
+
PickersCalendarHeaderClassKey,
|
|
41
|
+
PickersCalendarHeaderClasses,
|
|
42
|
+
PickersCalendarHeader,
|
|
43
|
+
PickersCalendarHeaderProps,
|
|
44
|
+
PickersCalendarHeaderSlotsComponent,
|
|
45
|
+
PickersCalendarHeaderSlotsComponentsProps,
|
|
46
|
+
ExportedPickersCalendarHeaderProps,
|
|
47
|
+
- } from '@mui/x-date-pickers/DateCalendar';
|
|
48
|
+
+ } from '@mui/x-date-pickers/PickersCalendarHeader';
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
- The `monthAndYear` format has been removed.
|
|
53
|
+
It was used in the header of the calendar views, you can replace it with the new `format` prop of the `calendarHeader` slot:
|
|
54
|
+
|
|
55
|
+
```diff
|
|
56
|
+
<LocalizationProvider
|
|
57
|
+
adapter={AdapterDayJS}
|
|
58
|
+
- formats={{ monthAndYear: 'MM/YYYY' }}
|
|
59
|
+
/>
|
|
60
|
+
<DatePicker
|
|
61
|
+
+ slotProps={{ calendarHeader: { format: 'MM/YYYY' }}}
|
|
62
|
+
/>
|
|
63
|
+
<DateRangePicker
|
|
64
|
+
+ slotProps={{ calendarHeader: { format: 'MM/YYYY' }}}
|
|
65
|
+
/>
|
|
66
|
+
<LocalizationProvider />
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
- The `adapter.getDiff` method have been removed, you can directly use your date library:
|
|
70
|
+
|
|
71
|
+
```diff
|
|
72
|
+
// For Day.js
|
|
73
|
+
- const diff = adapter.getDiff(value, comparing, unit);
|
|
74
|
+
+ const diff = value.diff(comparing, unit);
|
|
75
|
+
|
|
76
|
+
// For Luxon
|
|
77
|
+
- const diff = adapter.getDiff(value, comparing, unit);
|
|
78
|
+
+ const getDiff = (value: DateTime, comparing: DateTime | string, unit?: AdapterUnits) => {
|
|
79
|
+
+ const parsedComparing = typeof comparing === 'string'
|
|
80
|
+
+ ? DateTime.fromJSDate(new Date(comparing))
|
|
81
|
+
+ : comparing;
|
|
82
|
+
+ if (unit) {
|
|
83
|
+
+ return Math.floor(value.diff(comparing).as(unit));
|
|
84
|
+
+ }
|
|
85
|
+
+ return value.diff(comparing).as('millisecond');
|
|
86
|
+
+ };
|
|
87
|
+
+
|
|
88
|
+
+ const diff = getDiff(value, comparing, unit);
|
|
89
|
+
|
|
90
|
+
// For DateFns
|
|
91
|
+
- const diff = adapter.getDiff(value, comparing, unit);
|
|
92
|
+
+ const getDiff = (value: Date, comparing: Date | string, unit?: AdapterUnits) => {
|
|
93
|
+
+ const parsedComparing = typeof comparing === 'string' ? new Date(comparing) : comparing;
|
|
94
|
+
+ switch (unit) {
|
|
95
|
+
+ case 'years':
|
|
96
|
+
+ return dateFns.differenceInYears(value, parsedComparing);
|
|
97
|
+
+ case 'quarters':
|
|
98
|
+
+ return dateFns.differenceInQuarters(value, parsedComparing);
|
|
99
|
+
+ case 'months':
|
|
100
|
+
+ return dateFns.differenceInMonths(value, parsedComparing);
|
|
101
|
+
+ case 'weeks':
|
|
102
|
+
+ return dateFns.differenceInWeeks(value, parsedComparing);
|
|
103
|
+
+ case 'days':
|
|
104
|
+
+ return dateFns.differenceInDays(value, parsedComparing);
|
|
105
|
+
+ case 'hours':
|
|
106
|
+
+ return dateFns.differenceInHours(value, parsedComparing);
|
|
107
|
+
+ case 'minutes':
|
|
108
|
+
+ return dateFns.differenceInMinutes(value, parsedComparing);
|
|
109
|
+
+ case 'seconds':
|
|
110
|
+
+ return dateFns.differenceInSeconds(value, parsedComparing);
|
|
111
|
+
+ default: {
|
|
112
|
+
+ return dateFns.differenceInMilliseconds(value, parsedComparing);
|
|
113
|
+
+ }
|
|
114
|
+
+ }
|
|
115
|
+
+ };
|
|
116
|
+
+
|
|
117
|
+
+ const diff = getDiff(value, comparing, unit);
|
|
118
|
+
|
|
119
|
+
// For Moment
|
|
120
|
+
- const diff = adapter.getDiff(value, comparing, unit);
|
|
121
|
+
+ const diff = value.diff(comparing, unit);
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
- The `adapter.getFormatHelperText` method have been removed, you can use the `adapter.expandFormat` instead:
|
|
125
|
+
|
|
126
|
+
```diff
|
|
127
|
+
- const expandedFormat = adapter.getFormatHelperText(format);
|
|
128
|
+
+ const expandedFormat = adapter.expandFormat(format);
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
And if you need the exact same output you can apply the following transformation:
|
|
132
|
+
|
|
133
|
+
```diff
|
|
134
|
+
// For Day.js
|
|
135
|
+
- const expandedFormat = adapter.getFormatHelperText(format);
|
|
136
|
+
+ const expandedFormat = adapter.expandFormat(format).replace(/a/gi, '(a|p)m').toLocaleLowerCase();
|
|
137
|
+
|
|
138
|
+
// For Luxon
|
|
139
|
+
- const expandedFormat = adapter.getFormatHelperText(format);
|
|
140
|
+
+ const expandedFormat = adapter.expandFormat(format).replace(/(a)/g, '(a|p)m').toLocaleLowerCase();
|
|
141
|
+
|
|
142
|
+
// For DateFns
|
|
143
|
+
- const expandedFormat = adapter.getFormatHelperText(format);
|
|
144
|
+
+ const expandedFormat = adapter.expandFormat(format).replace(/(aaa|aa|a)/g, '(a|p)m').toLocaleLowerCase();
|
|
145
|
+
|
|
146
|
+
// For Moment
|
|
147
|
+
- const expandedFormat = adapter.getFormatHelperText(format);
|
|
148
|
+
+ const expandedFormat = adapter.expandFormat(format).replace(/a/gi, '(a|p)m').toLocaleLowerCase();
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
- The `adapter.getMeridiemText` method have been removed, you can use the `adapter.setHours`, `adapter.date` and `adapter.format` methods to recreate its behavior:
|
|
152
|
+
|
|
153
|
+
```diff
|
|
154
|
+
- const meridiem = adapter.getMeridiemText('am');
|
|
155
|
+
+ const getMeridiemText = (meridiem: 'am' | 'pm') => {
|
|
156
|
+
+ const date = adapter.setHours(adapter.date()!, meridiem === 'am' ? 2 : 14);
|
|
157
|
+
+ return utils.format(date, 'meridiem');
|
|
158
|
+
+ };
|
|
159
|
+
+
|
|
160
|
+
+ const meridiem = getMeridiemText('am');
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
- The `adapter.getMonthArray` method have been removed, you can use the `adapter.startOfYear` and `adapter.addMonths` methods to recreate its behavior:
|
|
164
|
+
|
|
165
|
+
```diff
|
|
166
|
+
- const monthArray = adapter.getMonthArray(value);
|
|
167
|
+
+ const getMonthArray = (year) => {
|
|
168
|
+
+ const firstMonth = utils.startOfYear(year);
|
|
169
|
+
+ const months = [firstMonth];
|
|
170
|
+
+
|
|
171
|
+
+ while (months.length < 12) {
|
|
172
|
+
+ const prevMonth = months[months.length - 1];
|
|
173
|
+
+ months.push(utils.addMonths(prevMonth, 1));
|
|
174
|
+
+ }
|
|
175
|
+
+
|
|
176
|
+
+ return months;
|
|
177
|
+
+ }
|
|
178
|
+
+
|
|
179
|
+
+ const monthArray = getMonthArray(value);
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
- The `adapter.getNextMonth` method have been removed, you can use the `adapter.addMonths` method instead:
|
|
183
|
+
|
|
184
|
+
```diff
|
|
185
|
+
- const nextMonth = adapter.getNextMonth(value);
|
|
186
|
+
+ const nextMonth = adapter.addMonths(value, 1);
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
- The `adapter.getPreviousMonth` method have been removed, you can use the `adapter.addMonths` method instead:
|
|
190
|
+
|
|
191
|
+
```diff
|
|
192
|
+
- const previousMonth = adapter.getPreviousMonth(value);
|
|
193
|
+
+ const previousMonth = adapter.addMonths(value, -1);
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
- The `adapter.getWeekdays` method have been removed, you can use the `adapter.startOfWeek` and `adapter.addDays` methods instead:
|
|
197
|
+
|
|
198
|
+
```diff
|
|
199
|
+
- const weekDays = adapter.getWeekdays(value);
|
|
200
|
+
+ const getWeekdays = (value) => {
|
|
201
|
+
+ const start = adapter.startOfWeek(value);
|
|
202
|
+
+ return [0, 1, 2, 3, 4, 5, 6].map((diff) => utils.addDays(start, diff));
|
|
203
|
+
+ };
|
|
204
|
+
+
|
|
205
|
+
+ const weekDays = getWeekdays(value);
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
- The `isNull` method have been removed, you can replace it with a very basic check:
|
|
209
|
+
|
|
210
|
+
```diff
|
|
211
|
+
- const isNull = adapter.isNull(value);
|
|
212
|
+
+ const isNull = value === null;
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
- The `adapter.mergeDateAndTime` method have been removed, you can use the `adapter.setHours`, `adapter.setMinutes`, and `adapter.setSeconds` methods to recreate its behavior:
|
|
216
|
+
|
|
217
|
+
```diff
|
|
218
|
+
- const result = adapter.mergeDateAndTime(valueWithDate, valueWithTime);
|
|
219
|
+
+ const mergeDateAndTime = <TDate>(
|
|
220
|
+
+ dateParam,
|
|
221
|
+
+ timeParam,
|
|
222
|
+
+ ) => {
|
|
223
|
+
+ let mergedDate = dateParam;
|
|
224
|
+
+ mergedDate = utils.setHours(mergedDate, utils.getHours(timeParam));
|
|
225
|
+
+ mergedDate = utils.setMinutes(mergedDate, utils.getMinutes(timeParam));
|
|
226
|
+
+ mergedDate = utils.setSeconds(mergedDate, utils.getSeconds(timeParam));
|
|
227
|
+
+
|
|
228
|
+
+ return mergedDate;
|
|
229
|
+
+ };
|
|
230
|
+
+
|
|
231
|
+
+ const result = mergeDateAndTime(valueWithDate, valueWithTime);
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
- The `adapter.parseISO` method have been removed, you can directly use your date library:
|
|
235
|
+
|
|
236
|
+
```diff
|
|
237
|
+
// For Day.js
|
|
238
|
+
- const value = adapter.parseISO(isoString);
|
|
239
|
+
+ const value = dayjs(isoString);
|
|
240
|
+
|
|
241
|
+
// For Luxon
|
|
242
|
+
- const value = adapter.parseISO(isoString);
|
|
243
|
+
+ const value = DateTime.fromISO(isoString);
|
|
244
|
+
|
|
245
|
+
// For DateFns
|
|
246
|
+
- const value = adapter.parseISO(isoString);
|
|
247
|
+
+ const value = dateFns.parseISO(isoString);
|
|
248
|
+
|
|
249
|
+
// For Moment
|
|
250
|
+
- const value = adapter.parseISO(isoString);
|
|
251
|
+
+ const value = moment(isoString, true);
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
- The `adapter.toISO` method have been removed, you can directly use your date library:
|
|
255
|
+
|
|
256
|
+
```diff
|
|
257
|
+
- const isoString = adapter.toISO(value);
|
|
258
|
+
+ const isoString = value.toISOString();
|
|
259
|
+
+ const isoString = value.toUTC().toISO({ format: 'extended' });
|
|
260
|
+
+ const isoString = dateFns.formatISO(value, { format: 'extended' });
|
|
261
|
+
+ const isoString = value.toISOString();
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
- The `adapter.isEqual` method used to accept any type of value for its two input and tried to parse them before checking if they were equal.
|
|
265
|
+
The method has been simplified and now only accepts an already-parsed date or `null` (ie: the same formats used by the `value` prop in the pickers)
|
|
266
|
+
|
|
267
|
+
```diff
|
|
268
|
+
const adapterDayjs = new AdapterDayjs();
|
|
269
|
+
const adapterLuxon = new AdapterLuxon();
|
|
270
|
+
const adapterDateFns = new AdapterDateFns();
|
|
271
|
+
const adapterMoment = new AdatperMoment();
|
|
272
|
+
|
|
273
|
+
// Supported formats
|
|
274
|
+
const isEqual = adapterDayjs.isEqual(null, null); // Same for the other adapters
|
|
275
|
+
const isEqual = adapterLuxon.isEqual(DateTime.now(), DateTime.fromISO('2022-04-17'));
|
|
276
|
+
const isEqual = adapterMoment.isEqual(moment(), moment('2022-04-17'));
|
|
277
|
+
const isEqual = adapterDateFns.isEqual(new Date(), new Date('2022-04-17'));
|
|
278
|
+
|
|
279
|
+
// Non-supported formats (JS Date)
|
|
280
|
+
- const isEqual = adapterDayjs.isEqual(new Date(), new Date('2022-04-17'));
|
|
281
|
+
+ const isEqual = adapterDayjs.isEqual(dayjs(), dayjs('2022-04-17'));
|
|
282
|
+
|
|
283
|
+
- const isEqual = adapterLuxon.isEqual(new Date(), new Date('2022-04-17'));
|
|
284
|
+
+ const isEqual = adapterLuxon.isEqual(DateTime.now(), DateTime.fromISO('2022-04-17'));
|
|
285
|
+
|
|
286
|
+
- const isEqual = adapterMoment.isEqual(new Date(), new Date('2022-04-17'));
|
|
287
|
+
+ const isEqual = adapterMoment.isEqual(moment(), moment('2022-04-17'));
|
|
288
|
+
|
|
289
|
+
// Non-supported formats (string)
|
|
290
|
+
- const isEqual = adapterDayjs.isEqual('2022-04-16', '2022-04-17');
|
|
291
|
+
+ const isEqual = adapterDayjs.isEqual(dayjs('2022-04-17'), dayjs('2022-04-17'));
|
|
292
|
+
|
|
293
|
+
- const isEqual = adapterLuxon.isEqual('2022-04-16', '2022-04-17');
|
|
294
|
+
+ const isEqual = adapterLuxon.isEqual(DateTime.fromISO('2022-04-17'), DateTime.fromISO('2022-04-17'));
|
|
295
|
+
|
|
296
|
+
- const isEqual = adapterMoment.isEqual('2022-04-16', '2022-04-17');
|
|
297
|
+
+ const isEqual = adapterMoment.isEqual(moment('2022-04-17'), moment('2022-04-17'));
|
|
298
|
+
|
|
299
|
+
- const isEqual = adapterDateFns.isEqual('2022-04-16', '2022-04-17');
|
|
300
|
+
+ const isEqual = adapterDateFns.isEqual(new Date('2022-04-17'), new Date('2022-04-17'));
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
- The `dateLibInstance` prop of `LocalizationProvider` does not work with `AdapterDayjs` anymore (#11023). This prop was used to set the pickers in UTC mode before the implementation of a proper timezone support in the components.
|
|
304
|
+
You can learn more about the new approach on the [dedicated doc page](https://mui.com/x/react-date-pickers/timezone/).
|
|
305
|
+
|
|
306
|
+
```diff
|
|
307
|
+
// When a `value` or a `defaultValue` is provided
|
|
308
|
+
<LocalizationProvider
|
|
309
|
+
adapter={AdapterDayjs}
|
|
310
|
+
- dateLibInstance={dayjs.utc}
|
|
311
|
+
>
|
|
312
|
+
<DatePicker value={dayjs.utc('2022-04-17')} />
|
|
313
|
+
</LocalizationProvider>
|
|
314
|
+
|
|
315
|
+
// When no `value` or `defaultValue` is provided
|
|
316
|
+
<LocalizationProvider
|
|
317
|
+
adapter={AdapterDayjs}
|
|
318
|
+
- dateLibInstance={dayjs.utc}
|
|
319
|
+
>
|
|
320
|
+
- <DatePicker />
|
|
321
|
+
+ <DatePicker timezone="UTC" />
|
|
322
|
+
</LocalizationProvider>
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
- The property `hasLeadingZeros` has been removed from the sections in favor of the more precise `hasLeadingZerosInFormat` and `hasLeadingZerosInInput` properties (#10994). To keep the same behavior, you can replace it by `hasLeadingZerosInFormat`:
|
|
326
|
+
|
|
327
|
+
```diff
|
|
328
|
+
const fieldRef = React.useRef<FieldRef<FieldSection>>(null);
|
|
329
|
+
|
|
330
|
+
React.useEffect(() => {
|
|
331
|
+
const firstSection = fieldRef.current!.getSections()[0]
|
|
332
|
+
- console.log(firstSection.hasLeadingZeros)
|
|
333
|
+
+ console.log(firstSection.hasLeadingZerosInFormat)
|
|
334
|
+
}, [])
|
|
335
|
+
|
|
336
|
+
return (
|
|
337
|
+
<DateField unstableFieldRef={fieldRef} />
|
|
338
|
+
);
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
- The `adapter.getYearRange` method used to accept two params and now accepts a tuple to be consistent with the `adapter.isWithinRange` method (#10978):
|
|
342
|
+
|
|
343
|
+
```diff
|
|
344
|
+
- adapter.getYearRange(start, end);
|
|
345
|
+
+ adapter.getYearRange([start, end])
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
- The `adapter.isValid` method used to accept any type of value and tried to parse them before checking their validity (#10971).
|
|
349
|
+
The method has been simplified and now only accepts an already-parsed date or `null`.
|
|
350
|
+
Which is the same type as the one accepted by the components `value` prop.
|
|
351
|
+
|
|
352
|
+
```diff
|
|
353
|
+
const adapterDayjs = new AdapterDayjs();
|
|
354
|
+
const adapterLuxon = new AdapterLuxon();
|
|
355
|
+
const adapterDateFns = new AdapterDateFns();
|
|
356
|
+
const adapterMoment = new AdatperMoment();
|
|
357
|
+
|
|
358
|
+
// Supported formats
|
|
359
|
+
const isValid = adapterDayjs.isValid(null); // Same for the other adapters
|
|
360
|
+
const isValid = adapterLuxon.isValid(DateTime.now());
|
|
361
|
+
const isValid = adapterMoment.isValid(moment());
|
|
362
|
+
const isValid = adapterDateFns.isValid(new Date());
|
|
363
|
+
|
|
364
|
+
// Non-supported formats (JS Date)
|
|
365
|
+
- const isValid = adapterDayjs.isValid(new Date('2022-04-17'));
|
|
366
|
+
+ const isValid = adapterDayjs.isValid(dayjs('2022-04-17'));
|
|
367
|
+
|
|
368
|
+
- const isValid = adapterLuxon.isValid(new Date('2022-04-17'));
|
|
369
|
+
+ const isValid = adapterLuxon.isValid(DateTime.fromISO('2022-04-17'));
|
|
370
|
+
|
|
371
|
+
- const isValid = adapterMoment.isValid(new Date('2022-04-17'));
|
|
372
|
+
+ const isValid = adapterMoment.isValid(moment('2022-04-17'));
|
|
373
|
+
|
|
374
|
+
// Non-supported formats (string)
|
|
375
|
+
- const isValid = adapterDayjs.isValid('2022-04-17');
|
|
376
|
+
+ const isValid = adapterDayjs.isValid(dayjs('2022-04-17'));
|
|
377
|
+
|
|
378
|
+
- const isValid = adapterLuxon.isValid('2022-04-17');
|
|
379
|
+
+ const isValid = adapterLuxon.isValid(DateTime.fromISO('2022-04-17'));
|
|
380
|
+
|
|
381
|
+
- const isValid = adapterMoment.isValid('2022-04-17');
|
|
382
|
+
+ const isValid = adapterMoment.isValid(moment('2022-04-17'));
|
|
383
|
+
|
|
384
|
+
- const isValid = adapterDateFns.isValid('2022-04-17');
|
|
385
|
+
+ const isValid = adapterDateFns.isValid(new Date('2022-04-17'));
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
#### Changes
|
|
389
|
+
|
|
390
|
+
- [pickers] Change the input format of `adapter.getYearRange` to be consistent with `adapter.isWithinRange` (#10978) @flaviendelangle
|
|
391
|
+
- [pickers] Clean remaining `components` / `componentsProps` typings (#11040) @flaviendelangle
|
|
392
|
+
- [pickers] Modify `adapter.isEqual` method to accept `TDate | null` instead of `any` (#10976) @flaviendelangle
|
|
393
|
+
- [pickers] Modify `adapter.isValid` method to accept `TDate | null` instead of `any` (#10971) @flaviendelangle
|
|
394
|
+
- [pickers] Remove the `hasLeadingZeros` property from `FieldSection` (#10994) @flaviendelangle
|
|
395
|
+
- [pickers] Remove the deprecated methods and formats from the adapters (#10776) @flaviendelangle
|
|
396
|
+
- [pickers] Remove the legacy UTC implementation for `dayjs` (#11023) @flaviendelangle
|
|
397
|
+
- [pickers] Remove unused code (#11048) @flaviendelangle
|
|
398
|
+
- [pickers] Move the exports of the `calendarHeader` slot to `@mui/x-date-pickers/PickersCalendarHeader` (#11020) @flaviendelangle
|
|
399
|
+
- [DateCalendar] Allow to override the format of the header with a prop (#10990) @flaviendelangle
|
|
400
|
+
- [DateCalendar] Remove the string argument of the `dayOfWeekFormatter` prop (#10992) @flaviendelangle
|
|
401
|
+
|
|
402
|
+
### Docs
|
|
403
|
+
|
|
404
|
+
- [docs] Fix incorrect component name in the "Custom slots and subcomponents" page (#11024) @flaviendelangle
|
|
405
|
+
- [docs] Fix typos in pickers migration guide (#11057) @flaviendelangle
|
|
406
|
+
|
|
407
|
+
### Core
|
|
408
|
+
|
|
409
|
+
- [core] Clean the component slots doc generation (#11021) @flaviendelangle
|
|
410
|
+
- [core] Fix script to release with `next` tag (#10996) @LukasTy
|
|
411
|
+
- [test] Wait for images to load (#11004) @cherniavskii
|
|
412
|
+
|
|
6
413
|
## 7.0.0-alpha.0
|
|
7
414
|
|
|
8
415
|
_Nov 10, 2023_
|
|
@@ -384,7 +791,7 @@ Same changes as in `@mui/x-date-pickers@6.16.3`, plus:
|
|
|
384
791
|
|
|
385
792
|
- [charts] Add reference links to area + bar chart components (#10652) @michelengelen
|
|
386
793
|
- [charts] Add reference links to line chart + sparkline components (#10650) @michelengelen
|
|
387
|
-
- [charts] Add reference links to pie + scatter chart components
|
|
794
|
+
- [charts] Add reference links to pie + scatter chart components (#10653) @michelengelen
|
|
388
795
|
- [charts] Render only when `width` and `height` are resolved (#10714) @alexfauquette
|
|
389
796
|
- [charts] Support animation on `BarChart` (#9926) @alexfauquette
|
|
390
797
|
- [charts] Use new text component to avoid tick label overflow on x-axis (#10648) @alexfauquette
|
|
@@ -460,6 +867,7 @@ It adds line break support and avoids overlapping text in the legend.
|
|
|
460
867
|
This comes with some breaking changes.
|
|
461
868
|
|
|
462
869
|
- The DOM structure is modified. An intermediary `<tspan />` element has been added. This can impact how your style is applied.
|
|
870
|
+
|
|
463
871
|
```diff
|
|
464
872
|
- <text>The label</text>
|
|
465
873
|
+ <text><tspan>The label</tspan></text>
|
|
@@ -7,7 +7,7 @@ import PropTypes from 'prop-types';
|
|
|
7
7
|
import clsx from 'clsx';
|
|
8
8
|
import useEventCallback from '@mui/utils/useEventCallback';
|
|
9
9
|
import useMediaQuery from '@mui/material/useMediaQuery';
|
|
10
|
-
import { resolveComponentProps } from '@mui/base/utils';
|
|
10
|
+
import { resolveComponentProps, useSlotProps } from '@mui/base/utils';
|
|
11
11
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
12
12
|
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
13
13
|
import { Watermark } from '@mui/x-license-pro';
|
|
@@ -120,6 +120,7 @@ const useUtilityClasses = ownerState => {
|
|
|
120
120
|
* - [DateRangeCalendar API](https://mui.com/x/api/date-pickers/date-range-calendar/)
|
|
121
121
|
*/
|
|
122
122
|
const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalendar(inProps, ref) {
|
|
123
|
+
var _slots$calendarHeader;
|
|
123
124
|
const props = useDateRangeCalendarDefaultizedProps(inProps, 'MuiDateRangeCalendar');
|
|
124
125
|
const shouldHavePreview = useMediaQuery(DEFAULT_DESKTOP_MODE_MEDIA_QUERY, {
|
|
125
126
|
defaultMatches: false
|
|
@@ -268,6 +269,34 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
|
|
|
268
269
|
shouldDisableDate: wrappedShouldDisableDate,
|
|
269
270
|
timezone
|
|
270
271
|
});
|
|
272
|
+
|
|
273
|
+
// When disabled, limit the view to the selected date
|
|
274
|
+
const minDateWithDisabled = disabled && value[0] || minDate;
|
|
275
|
+
const maxDateWithDisabled = disabled && value[1] || maxDate;
|
|
276
|
+
const CalendarHeader = (_slots$calendarHeader = slots == null ? void 0 : slots.calendarHeader) != null ? _slots$calendarHeader : PickersCalendarHeader;
|
|
277
|
+
const calendarHeaderProps = useSlotProps({
|
|
278
|
+
elementType: CalendarHeader,
|
|
279
|
+
externalSlotProps: slotProps == null ? void 0 : slotProps.calendarHeader,
|
|
280
|
+
additionalProps: {
|
|
281
|
+
views: ['day'],
|
|
282
|
+
view: 'day',
|
|
283
|
+
currentMonth: calendarState.currentMonth,
|
|
284
|
+
onMonthChange: (newMonth, direction) => handleChangeMonth({
|
|
285
|
+
newMonth,
|
|
286
|
+
direction
|
|
287
|
+
}),
|
|
288
|
+
minDate: minDateWithDisabled,
|
|
289
|
+
maxDate: maxDateWithDisabled,
|
|
290
|
+
disabled,
|
|
291
|
+
disablePast,
|
|
292
|
+
disableFuture,
|
|
293
|
+
reduceAnimations,
|
|
294
|
+
slots,
|
|
295
|
+
slotProps,
|
|
296
|
+
timezone
|
|
297
|
+
},
|
|
298
|
+
ownerState: props
|
|
299
|
+
});
|
|
271
300
|
const prevValue = React.useRef(null);
|
|
272
301
|
React.useEffect(() => {
|
|
273
302
|
var _prevValue$current, _prevValue$current2;
|
|
@@ -321,10 +350,6 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
|
|
|
321
350
|
readOnly,
|
|
322
351
|
disabled
|
|
323
352
|
};
|
|
324
|
-
|
|
325
|
-
// When disabled, limit the view to the selected date
|
|
326
|
-
const minDateWithDisabled = disabled && value[0] || minDate;
|
|
327
|
-
const maxDateWithDisabled = disabled && value[1] || maxDate;
|
|
328
353
|
const [rangePreviewDay, setRangePreviewDay] = React.useState(null);
|
|
329
354
|
const CalendarTransitionProps = React.useMemo(() => ({
|
|
330
355
|
onMouseLeave: () => setRangePreviewDay(null)
|
|
@@ -421,60 +446,46 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
|
|
|
421
446
|
children: [/*#__PURE__*/_jsx(Watermark, {
|
|
422
447
|
packageName: "x-date-pickers-pro",
|
|
423
448
|
releaseInfo: releaseInfo
|
|
424
|
-
}), calendarMonths.map((month, index) =>
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
TransitionProps: CalendarTransitionProps,
|
|
465
|
-
shouldDisableDate: wrappedShouldDisableDate,
|
|
466
|
-
showDaysOutsideCurrentMonth: calendars === 1 && showDaysOutsideCurrentMonth,
|
|
467
|
-
dayOfWeekFormatter: dayOfWeekFormatter,
|
|
468
|
-
loading: loading,
|
|
469
|
-
renderLoading: renderLoading,
|
|
470
|
-
slots: slotsForDayCalendar,
|
|
471
|
-
slotProps: slotPropsForDayCalendar,
|
|
472
|
-
autoFocus: month === focusedMonth,
|
|
473
|
-
fixedWeekNumber: fixedWeekNumber,
|
|
474
|
-
displayWeekNumber: displayWeekNumber,
|
|
475
|
-
timezone: timezone
|
|
476
|
-
}), index)]
|
|
477
|
-
}, month))]
|
|
449
|
+
}), calendarMonths.map((month, index) => {
|
|
450
|
+
var _calendarHeaderProps$;
|
|
451
|
+
return /*#__PURE__*/_jsxs(DateRangeCalendarMonthContainer, {
|
|
452
|
+
className: classes.monthContainer,
|
|
453
|
+
children: [calendars === 1 ? /*#__PURE__*/_jsx(CalendarHeader, _extends({}, calendarHeaderProps)) : /*#__PURE__*/_jsx(DateRangeCalendarArrowSwitcher, {
|
|
454
|
+
onGoToPrevious: selectPreviousMonth,
|
|
455
|
+
onGoToNext: selectNextMonth,
|
|
456
|
+
isPreviousHidden: index !== 0,
|
|
457
|
+
isPreviousDisabled: isPreviousMonthDisabled,
|
|
458
|
+
previousLabel: localeText.previousMonth,
|
|
459
|
+
isNextHidden: index !== calendars - 1,
|
|
460
|
+
isNextDisabled: isNextMonthDisabled,
|
|
461
|
+
nextLabel: localeText.nextMonth,
|
|
462
|
+
slots: slots,
|
|
463
|
+
slotProps: slotProps,
|
|
464
|
+
children: utils.formatByString(visibleMonths[month], (_calendarHeaderProps$ = calendarHeaderProps.format) != null ? _calendarHeaderProps$ : `${utils.formats.month} ${utils.formats.year}`)
|
|
465
|
+
}), /*#__PURE__*/_jsx(DayCalendarForRange, _extends({
|
|
466
|
+
className: classes.dayCalendar
|
|
467
|
+
}, calendarState, baseDateValidationProps, commonViewProps, {
|
|
468
|
+
onMonthSwitchingAnimationEnd: onMonthSwitchingAnimationEnd,
|
|
469
|
+
onFocusedDayChange: changeFocusedDay,
|
|
470
|
+
reduceAnimations: reduceAnimations,
|
|
471
|
+
selectedDays: value,
|
|
472
|
+
onSelectedDaysChange: handleSelectedDayChange,
|
|
473
|
+
currentMonth: visibleMonths[month],
|
|
474
|
+
TransitionProps: CalendarTransitionProps,
|
|
475
|
+
shouldDisableDate: wrappedShouldDisableDate,
|
|
476
|
+
showDaysOutsideCurrentMonth: calendars === 1 && showDaysOutsideCurrentMonth,
|
|
477
|
+
dayOfWeekFormatter: dayOfWeekFormatter,
|
|
478
|
+
loading: loading,
|
|
479
|
+
renderLoading: renderLoading,
|
|
480
|
+
slots: slotsForDayCalendar,
|
|
481
|
+
slotProps: slotPropsForDayCalendar,
|
|
482
|
+
autoFocus: month === focusedMonth,
|
|
483
|
+
fixedWeekNumber: fixedWeekNumber,
|
|
484
|
+
displayWeekNumber: displayWeekNumber,
|
|
485
|
+
timezone: timezone
|
|
486
|
+
}), index)]
|
|
487
|
+
}, month);
|
|
488
|
+
})]
|
|
478
489
|
}));
|
|
479
490
|
});
|
|
480
491
|
process.env.NODE_ENV !== "production" ? DateRangeCalendar.propTypes = {
|
|
@@ -503,7 +514,6 @@ process.env.NODE_ENV !== "production" ? DateRangeCalendar.propTypes = {
|
|
|
503
514
|
currentMonthCalendarPosition: PropTypes.oneOf([1, 2, 3]),
|
|
504
515
|
/**
|
|
505
516
|
* Formats the day of week displayed in the calendar header.
|
|
506
|
-
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
507
517
|
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
508
518
|
* @returns {string} The name to display.
|
|
509
519
|
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
@@ -3,7 +3,7 @@ import { SxProps } from '@mui/system';
|
|
|
3
3
|
import { SlotComponentProps } from '@mui/base/utils';
|
|
4
4
|
import { Theme } from '@mui/material/styles';
|
|
5
5
|
import { TimezoneProps } from '@mui/x-date-pickers/models';
|
|
6
|
-
import { PickersCalendarHeaderSlotsComponent, PickersCalendarHeaderSlotsComponentsProps } from '@mui/x-date-pickers/PickersCalendarHeader';
|
|
6
|
+
import { PickersCalendarHeader, PickersCalendarHeaderProps, PickersCalendarHeaderSlotsComponent, PickersCalendarHeaderSlotsComponentsProps } from '@mui/x-date-pickers/PickersCalendarHeader';
|
|
7
7
|
import { BaseDateValidationProps, DefaultizedProps, ExportedDayCalendarProps, DayCalendarSlotsComponent, DayCalendarSlotsComponentsProps, PickersArrowSwitcherSlotsComponent, PickersArrowSwitcherSlotsComponentsProps, PickerSelectionState, DayCalendarProps, ExportedUseViewsOptions } from '@mui/x-date-pickers/internals';
|
|
8
8
|
import { DateRange, DayRangeValidationProps } from '../internals/models';
|
|
9
9
|
import { DateRangeCalendarClasses } from './dateRangeCalendarClasses';
|
|
@@ -11,6 +11,12 @@ import { DateRangePickerDay, DateRangePickerDayProps } from '../DateRangePickerD
|
|
|
11
11
|
import { UseRangePositionProps } from '../internals/hooks/useRangePosition';
|
|
12
12
|
export type DateRangePosition = 'start' | 'end';
|
|
13
13
|
export interface DateRangeCalendarSlotsComponent<TDate> extends PickersArrowSwitcherSlotsComponent, Omit<DayCalendarSlotsComponent<TDate>, 'day'>, PickersCalendarHeaderSlotsComponent {
|
|
14
|
+
/**
|
|
15
|
+
* Custom component for calendar header.
|
|
16
|
+
* Check the [PickersCalendarHeader](https://mui.com/x/api/date-pickers/pickers-calendar-header/) component.
|
|
17
|
+
* @default PickersCalendarHeader
|
|
18
|
+
*/
|
|
19
|
+
calendarHeader?: React.ElementType<PickersCalendarHeaderProps<TDate>>;
|
|
14
20
|
/**
|
|
15
21
|
* Custom component for day in range pickers.
|
|
16
22
|
* Check the [DateRangePickersDay](https://mui.com/x/api/date-pickers/date-range-picker-day/) component.
|
|
@@ -19,6 +25,7 @@ export interface DateRangeCalendarSlotsComponent<TDate> extends PickersArrowSwit
|
|
|
19
25
|
day?: React.ElementType<DateRangePickerDayProps<TDate>>;
|
|
20
26
|
}
|
|
21
27
|
export interface DateRangeCalendarSlotsComponentsProps<TDate> extends PickersArrowSwitcherSlotsComponentsProps, Omit<DayCalendarSlotsComponentsProps<TDate>, 'day'>, PickersCalendarHeaderSlotsComponentsProps<TDate> {
|
|
28
|
+
calendarHeader?: SlotComponentProps<typeof PickersCalendarHeader, {}, DateRangeCalendarProps<TDate>>;
|
|
22
29
|
day?: SlotComponentProps<typeof DateRangePickerDay, {}, DayCalendarProps<TDate> & {
|
|
23
30
|
day: TDate;
|
|
24
31
|
selected: boolean;
|
|
@@ -75,7 +75,6 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
|
|
|
75
75
|
currentMonthCalendarPosition: PropTypes.oneOf([1, 2, 3]),
|
|
76
76
|
/**
|
|
77
77
|
* Formats the day of week displayed in the calendar header.
|
|
78
|
-
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
79
78
|
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
80
79
|
* @returns {string} The name to display.
|
|
81
80
|
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
@@ -35,5 +35,5 @@ export interface BaseDateRangePickerProps<TDate> extends Omit<BasePickerInputPro
|
|
|
35
35
|
viewRenderers?: Partial<PickerViewRendererLookup<DateRange<TDate>, 'day', DateRangeViewRendererProps<TDate, 'day'>, {}>>;
|
|
36
36
|
}
|
|
37
37
|
type UseDateRangePickerDefaultizedProps<TDate, Props extends BaseDateRangePickerProps<TDate>> = LocalizedComponent<TDate, DefaultizedProps<Props, keyof BaseDateValidationProps<TDate>>>;
|
|
38
|
-
export declare function useDateRangePickerDefaultizedProps<TDate, Props extends BaseDateRangePickerProps<TDate>>(props: Props, name: string): UseDateRangePickerDefaultizedProps<TDate,
|
|
38
|
+
export declare function useDateRangePickerDefaultizedProps<TDate, Props extends BaseDateRangePickerProps<TDate>>(props: Props, name: string): UseDateRangePickerDefaultizedProps<TDate, Props>;
|
|
39
39
|
export {};
|
|
@@ -90,7 +90,6 @@ DesktopDateRangePicker.propTypes = {
|
|
|
90
90
|
currentMonthCalendarPosition: PropTypes.oneOf([1, 2, 3]),
|
|
91
91
|
/**
|
|
92
92
|
* Formats the day of week displayed in the calendar header.
|
|
93
|
-
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
94
93
|
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
95
94
|
* @returns {string} The name to display.
|
|
96
95
|
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
@@ -90,7 +90,6 @@ MobileDateRangePicker.propTypes = {
|
|
|
90
90
|
currentMonthCalendarPosition: PropTypes.oneOf([1, 2, 3]),
|
|
91
91
|
/**
|
|
92
92
|
* Formats the day of week displayed in the calendar header.
|
|
93
|
-
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
94
93
|
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
95
94
|
* @returns {string} The name to display.
|
|
96
95
|
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
@@ -76,7 +76,6 @@ StaticDateRangePicker.propTypes = {
|
|
|
76
76
|
currentMonthCalendarPosition: PropTypes.oneOf([1, 2, 3]),
|
|
77
77
|
/**
|
|
78
78
|
* Formats the day of week displayed in the calendar header.
|
|
79
|
-
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
80
79
|
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
81
80
|
* @returns {string} The name to display.
|
|
82
81
|
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
package/index.js
CHANGED
|
@@ -12,7 +12,6 @@ export declare const removeLastSeparator: (dateSections: RangeFieldSection[]) =>
|
|
|
12
12
|
placeholder: string;
|
|
13
13
|
type: import("@mui/x-date-pickers").FieldSectionType;
|
|
14
14
|
contentType: import("@mui/x-date-pickers").FieldSectionContentType;
|
|
15
|
-
hasLeadingZeros: boolean;
|
|
16
15
|
hasLeadingZerosInFormat: boolean;
|
|
17
16
|
hasLeadingZerosInInput: boolean;
|
|
18
17
|
modified: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export const getReleaseInfo = () => {
|
|
3
|
-
const releaseInfo = "
|
|
3
|
+
const releaseInfo = "MTcwMDE3MjAwMDAwMA==";
|
|
4
4
|
if (process.env.NODE_ENV !== 'production') {
|
|
5
5
|
// A simple hack to set the value in the test environment (has no build step).
|
|
6
6
|
// eslint-disable-next-line no-useless-concat
|
|
@@ -9,7 +9,7 @@ import PropTypes from 'prop-types';
|
|
|
9
9
|
import clsx from 'clsx';
|
|
10
10
|
import useEventCallback from '@mui/utils/useEventCallback';
|
|
11
11
|
import useMediaQuery from '@mui/material/useMediaQuery';
|
|
12
|
-
import { resolveComponentProps } from '@mui/base/utils';
|
|
12
|
+
import { resolveComponentProps, useSlotProps } from '@mui/base/utils';
|
|
13
13
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
14
14
|
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
15
15
|
import { Watermark } from '@mui/x-license-pro';
|
|
@@ -124,6 +124,7 @@ var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
|
124
124
|
* - [DateRangeCalendar API](https://mui.com/x/api/date-pickers/date-range-calendar/)
|
|
125
125
|
*/
|
|
126
126
|
var DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalendar(inProps, ref) {
|
|
127
|
+
var _slots$calendarHeader;
|
|
127
128
|
var props = useDateRangeCalendarDefaultizedProps(inProps, 'MuiDateRangeCalendar');
|
|
128
129
|
var shouldHavePreview = useMediaQuery(DEFAULT_DESKTOP_MODE_MEDIA_QUERY, {
|
|
129
130
|
defaultMatches: false
|
|
@@ -270,6 +271,36 @@ var DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalendar
|
|
|
270
271
|
changeMonth = _useCalendarState.changeMonth,
|
|
271
272
|
handleChangeMonth = _useCalendarState.handleChangeMonth,
|
|
272
273
|
onMonthSwitchingAnimationEnd = _useCalendarState.onMonthSwitchingAnimationEnd;
|
|
274
|
+
|
|
275
|
+
// When disabled, limit the view to the selected date
|
|
276
|
+
var minDateWithDisabled = disabled && value[0] || minDate;
|
|
277
|
+
var maxDateWithDisabled = disabled && value[1] || maxDate;
|
|
278
|
+
var CalendarHeader = (_slots$calendarHeader = slots == null ? void 0 : slots.calendarHeader) != null ? _slots$calendarHeader : PickersCalendarHeader;
|
|
279
|
+
var calendarHeaderProps = useSlotProps({
|
|
280
|
+
elementType: CalendarHeader,
|
|
281
|
+
externalSlotProps: slotProps == null ? void 0 : slotProps.calendarHeader,
|
|
282
|
+
additionalProps: {
|
|
283
|
+
views: ['day'],
|
|
284
|
+
view: 'day',
|
|
285
|
+
currentMonth: calendarState.currentMonth,
|
|
286
|
+
onMonthChange: function onMonthChange(newMonth, direction) {
|
|
287
|
+
return handleChangeMonth({
|
|
288
|
+
newMonth: newMonth,
|
|
289
|
+
direction: direction
|
|
290
|
+
});
|
|
291
|
+
},
|
|
292
|
+
minDate: minDateWithDisabled,
|
|
293
|
+
maxDate: maxDateWithDisabled,
|
|
294
|
+
disabled: disabled,
|
|
295
|
+
disablePast: disablePast,
|
|
296
|
+
disableFuture: disableFuture,
|
|
297
|
+
reduceAnimations: reduceAnimations,
|
|
298
|
+
slots: slots,
|
|
299
|
+
slotProps: slotProps,
|
|
300
|
+
timezone: timezone
|
|
301
|
+
},
|
|
302
|
+
ownerState: props
|
|
303
|
+
});
|
|
273
304
|
var prevValue = React.useRef(null);
|
|
274
305
|
React.useEffect(function () {
|
|
275
306
|
var _prevValue$current, _prevValue$current2;
|
|
@@ -323,10 +354,6 @@ var DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalendar
|
|
|
323
354
|
readOnly: readOnly,
|
|
324
355
|
disabled: disabled
|
|
325
356
|
};
|
|
326
|
-
|
|
327
|
-
// When disabled, limit the view to the selected date
|
|
328
|
-
var minDateWithDisabled = disabled && value[0] || minDate;
|
|
329
|
-
var maxDateWithDisabled = disabled && value[1] || maxDate;
|
|
330
357
|
var _React$useState = React.useState(null),
|
|
331
358
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
332
359
|
rangePreviewDay = _React$useState2[0],
|
|
@@ -441,28 +468,10 @@ var DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalendar
|
|
|
441
468
|
packageName: "x-date-pickers-pro",
|
|
442
469
|
releaseInfo: releaseInfo
|
|
443
470
|
}), calendarMonths.map(function (month, index) {
|
|
471
|
+
var _calendarHeaderProps$;
|
|
444
472
|
return /*#__PURE__*/_jsxs(DateRangeCalendarMonthContainer, {
|
|
445
473
|
className: classes.monthContainer,
|
|
446
|
-
children: [calendars === 1 ? /*#__PURE__*/_jsx(
|
|
447
|
-
views: ['day'],
|
|
448
|
-
view: 'day',
|
|
449
|
-
currentMonth: calendarState.currentMonth,
|
|
450
|
-
onMonthChange: function onMonthChange(newMonth, direction) {
|
|
451
|
-
return handleChangeMonth({
|
|
452
|
-
newMonth: newMonth,
|
|
453
|
-
direction: direction
|
|
454
|
-
});
|
|
455
|
-
},
|
|
456
|
-
minDate: minDateWithDisabled,
|
|
457
|
-
maxDate: maxDateWithDisabled,
|
|
458
|
-
disabled: disabled,
|
|
459
|
-
disablePast: disablePast,
|
|
460
|
-
disableFuture: disableFuture,
|
|
461
|
-
reduceAnimations: reduceAnimations,
|
|
462
|
-
slots: slots,
|
|
463
|
-
slotProps: slotProps,
|
|
464
|
-
timezone: timezone
|
|
465
|
-
}) : /*#__PURE__*/_jsx(DateRangeCalendarArrowSwitcher, {
|
|
474
|
+
children: [calendars === 1 ? /*#__PURE__*/_jsx(CalendarHeader, _extends({}, calendarHeaderProps)) : /*#__PURE__*/_jsx(DateRangeCalendarArrowSwitcher, {
|
|
466
475
|
onGoToPrevious: selectPreviousMonth,
|
|
467
476
|
onGoToNext: selectNextMonth,
|
|
468
477
|
isPreviousHidden: index !== 0,
|
|
@@ -473,7 +482,7 @@ var DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalendar
|
|
|
473
482
|
nextLabel: localeText.nextMonth,
|
|
474
483
|
slots: slots,
|
|
475
484
|
slotProps: slotProps,
|
|
476
|
-
children: utils.
|
|
485
|
+
children: utils.formatByString(visibleMonths[month], (_calendarHeaderProps$ = calendarHeaderProps.format) != null ? _calendarHeaderProps$ : "".concat(utils.formats.month, " ").concat(utils.formats.year))
|
|
477
486
|
}), /*#__PURE__*/_jsx(DayCalendarForRange, _extends({
|
|
478
487
|
className: classes.dayCalendar
|
|
479
488
|
}, calendarState, baseDateValidationProps, commonViewProps, {
|
|
@@ -526,7 +535,6 @@ process.env.NODE_ENV !== "production" ? DateRangeCalendar.propTypes = {
|
|
|
526
535
|
currentMonthCalendarPosition: PropTypes.oneOf([1, 2, 3]),
|
|
527
536
|
/**
|
|
528
537
|
* Formats the day of week displayed in the calendar header.
|
|
529
|
-
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
530
538
|
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
531
539
|
* @returns {string} The name to display.
|
|
532
540
|
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
@@ -74,7 +74,6 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
|
|
|
74
74
|
currentMonthCalendarPosition: PropTypes.oneOf([1, 2, 3]),
|
|
75
75
|
/**
|
|
76
76
|
* Formats the day of week displayed in the calendar header.
|
|
77
|
-
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
78
77
|
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
79
78
|
* @returns {string} The name to display.
|
|
80
79
|
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
@@ -89,7 +89,6 @@ DesktopDateRangePicker.propTypes = {
|
|
|
89
89
|
currentMonthCalendarPosition: PropTypes.oneOf([1, 2, 3]),
|
|
90
90
|
/**
|
|
91
91
|
* Formats the day of week displayed in the calendar header.
|
|
92
|
-
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
93
92
|
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
94
93
|
* @returns {string} The name to display.
|
|
95
94
|
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
@@ -89,7 +89,6 @@ MobileDateRangePicker.propTypes = {
|
|
|
89
89
|
currentMonthCalendarPosition: PropTypes.oneOf([1, 2, 3]),
|
|
90
90
|
/**
|
|
91
91
|
* Formats the day of week displayed in the calendar header.
|
|
92
|
-
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
93
92
|
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
94
93
|
* @returns {string} The name to display.
|
|
95
94
|
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
@@ -75,7 +75,6 @@ StaticDateRangePicker.propTypes = {
|
|
|
75
75
|
currentMonthCalendarPosition: PropTypes.oneOf([1, 2, 3]),
|
|
76
76
|
/**
|
|
77
77
|
* Formats the day of week displayed in the calendar header.
|
|
78
|
-
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
79
78
|
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
80
79
|
* @returns {string} The name to display.
|
|
81
80
|
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
package/legacy/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export var getReleaseInfo = function getReleaseInfo() {
|
|
3
|
-
var releaseInfo = "
|
|
3
|
+
var releaseInfo = "MTcwMDE3MjAwMDAwMA==";
|
|
4
4
|
if (process.env.NODE_ENV !== 'production') {
|
|
5
5
|
// A simple hack to set the value in the test environment (has no build step).
|
|
6
6
|
// eslint-disable-next-line no-useless-concat
|
|
@@ -7,7 +7,7 @@ import PropTypes from 'prop-types';
|
|
|
7
7
|
import clsx from 'clsx';
|
|
8
8
|
import useEventCallback from '@mui/utils/useEventCallback';
|
|
9
9
|
import useMediaQuery from '@mui/material/useMediaQuery';
|
|
10
|
-
import { resolveComponentProps } from '@mui/base/utils';
|
|
10
|
+
import { resolveComponentProps, useSlotProps } from '@mui/base/utils';
|
|
11
11
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
12
12
|
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
13
13
|
import { Watermark } from '@mui/x-license-pro';
|
|
@@ -267,6 +267,34 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
|
|
|
267
267
|
shouldDisableDate: wrappedShouldDisableDate,
|
|
268
268
|
timezone
|
|
269
269
|
});
|
|
270
|
+
|
|
271
|
+
// When disabled, limit the view to the selected date
|
|
272
|
+
const minDateWithDisabled = disabled && value[0] || minDate;
|
|
273
|
+
const maxDateWithDisabled = disabled && value[1] || maxDate;
|
|
274
|
+
const CalendarHeader = slots?.calendarHeader ?? PickersCalendarHeader;
|
|
275
|
+
const calendarHeaderProps = useSlotProps({
|
|
276
|
+
elementType: CalendarHeader,
|
|
277
|
+
externalSlotProps: slotProps?.calendarHeader,
|
|
278
|
+
additionalProps: {
|
|
279
|
+
views: ['day'],
|
|
280
|
+
view: 'day',
|
|
281
|
+
currentMonth: calendarState.currentMonth,
|
|
282
|
+
onMonthChange: (newMonth, direction) => handleChangeMonth({
|
|
283
|
+
newMonth,
|
|
284
|
+
direction
|
|
285
|
+
}),
|
|
286
|
+
minDate: minDateWithDisabled,
|
|
287
|
+
maxDate: maxDateWithDisabled,
|
|
288
|
+
disabled,
|
|
289
|
+
disablePast,
|
|
290
|
+
disableFuture,
|
|
291
|
+
reduceAnimations,
|
|
292
|
+
slots,
|
|
293
|
+
slotProps,
|
|
294
|
+
timezone
|
|
295
|
+
},
|
|
296
|
+
ownerState: props
|
|
297
|
+
});
|
|
270
298
|
const prevValue = React.useRef(null);
|
|
271
299
|
React.useEffect(() => {
|
|
272
300
|
const date = rangePosition === 'start' ? value[0] : value[1];
|
|
@@ -319,10 +347,6 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
|
|
|
319
347
|
readOnly,
|
|
320
348
|
disabled
|
|
321
349
|
};
|
|
322
|
-
|
|
323
|
-
// When disabled, limit the view to the selected date
|
|
324
|
-
const minDateWithDisabled = disabled && value[0] || minDate;
|
|
325
|
-
const maxDateWithDisabled = disabled && value[1] || maxDate;
|
|
326
350
|
const [rangePreviewDay, setRangePreviewDay] = React.useState(null);
|
|
327
351
|
const CalendarTransitionProps = React.useMemo(() => ({
|
|
328
352
|
onMouseLeave: () => setRangePreviewDay(null)
|
|
@@ -419,24 +443,7 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
|
|
|
419
443
|
releaseInfo: releaseInfo
|
|
420
444
|
}), calendarMonths.map((month, index) => /*#__PURE__*/_jsxs(DateRangeCalendarMonthContainer, {
|
|
421
445
|
className: classes.monthContainer,
|
|
422
|
-
children: [calendars === 1 ? /*#__PURE__*/_jsx(
|
|
423
|
-
views: ['day'],
|
|
424
|
-
view: 'day',
|
|
425
|
-
currentMonth: calendarState.currentMonth,
|
|
426
|
-
onMonthChange: (newMonth, direction) => handleChangeMonth({
|
|
427
|
-
newMonth,
|
|
428
|
-
direction
|
|
429
|
-
}),
|
|
430
|
-
minDate: minDateWithDisabled,
|
|
431
|
-
maxDate: maxDateWithDisabled,
|
|
432
|
-
disabled: disabled,
|
|
433
|
-
disablePast: disablePast,
|
|
434
|
-
disableFuture: disableFuture,
|
|
435
|
-
reduceAnimations: reduceAnimations,
|
|
436
|
-
slots: slots,
|
|
437
|
-
slotProps: slotProps,
|
|
438
|
-
timezone: timezone
|
|
439
|
-
}) : /*#__PURE__*/_jsx(DateRangeCalendarArrowSwitcher, {
|
|
446
|
+
children: [calendars === 1 ? /*#__PURE__*/_jsx(CalendarHeader, _extends({}, calendarHeaderProps)) : /*#__PURE__*/_jsx(DateRangeCalendarArrowSwitcher, {
|
|
440
447
|
onGoToPrevious: selectPreviousMonth,
|
|
441
448
|
onGoToNext: selectNextMonth,
|
|
442
449
|
isPreviousHidden: index !== 0,
|
|
@@ -447,7 +454,7 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
|
|
|
447
454
|
nextLabel: localeText.nextMonth,
|
|
448
455
|
slots: slots,
|
|
449
456
|
slotProps: slotProps,
|
|
450
|
-
children: utils.
|
|
457
|
+
children: utils.formatByString(visibleMonths[month], calendarHeaderProps.format ?? `${utils.formats.month} ${utils.formats.year}`)
|
|
451
458
|
}), /*#__PURE__*/_jsx(DayCalendarForRange, _extends({
|
|
452
459
|
className: classes.dayCalendar
|
|
453
460
|
}, calendarState, baseDateValidationProps, commonViewProps, {
|
|
@@ -499,7 +506,6 @@ process.env.NODE_ENV !== "production" ? DateRangeCalendar.propTypes = {
|
|
|
499
506
|
currentMonthCalendarPosition: PropTypes.oneOf([1, 2, 3]),
|
|
500
507
|
/**
|
|
501
508
|
* Formats the day of week displayed in the calendar header.
|
|
502
|
-
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
503
509
|
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
504
510
|
* @returns {string} The name to display.
|
|
505
511
|
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
@@ -75,7 +75,6 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
|
|
|
75
75
|
currentMonthCalendarPosition: PropTypes.oneOf([1, 2, 3]),
|
|
76
76
|
/**
|
|
77
77
|
* Formats the day of week displayed in the calendar header.
|
|
78
|
-
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
79
78
|
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
80
79
|
* @returns {string} The name to display.
|
|
81
80
|
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
@@ -86,7 +86,6 @@ DesktopDateRangePicker.propTypes = {
|
|
|
86
86
|
currentMonthCalendarPosition: PropTypes.oneOf([1, 2, 3]),
|
|
87
87
|
/**
|
|
88
88
|
* Formats the day of week displayed in the calendar header.
|
|
89
|
-
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
90
89
|
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
91
90
|
* @returns {string} The name to display.
|
|
92
91
|
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
@@ -86,7 +86,6 @@ MobileDateRangePicker.propTypes = {
|
|
|
86
86
|
currentMonthCalendarPosition: PropTypes.oneOf([1, 2, 3]),
|
|
87
87
|
/**
|
|
88
88
|
* Formats the day of week displayed in the calendar header.
|
|
89
|
-
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
90
89
|
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
91
90
|
* @returns {string} The name to display.
|
|
92
91
|
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
@@ -75,7 +75,6 @@ StaticDateRangePicker.propTypes = {
|
|
|
75
75
|
currentMonthCalendarPosition: PropTypes.oneOf([1, 2, 3]),
|
|
76
76
|
/**
|
|
77
77
|
* Formats the day of week displayed in the calendar header.
|
|
78
|
-
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
79
78
|
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
80
79
|
* @returns {string} The name to display.
|
|
81
80
|
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
package/modern/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export const getReleaseInfo = () => {
|
|
3
|
-
const releaseInfo = "
|
|
3
|
+
const releaseInfo = "MTcwMDE3MjAwMDAwMA==";
|
|
4
4
|
if (process.env.NODE_ENV !== 'production') {
|
|
5
5
|
// A simple hack to set the value in the test environment (has no build step).
|
|
6
6
|
// eslint-disable-next-line no-useless-concat
|
|
@@ -275,6 +275,34 @@ const DateRangeCalendar = exports.DateRangeCalendar = /*#__PURE__*/React.forward
|
|
|
275
275
|
shouldDisableDate: wrappedShouldDisableDate,
|
|
276
276
|
timezone
|
|
277
277
|
});
|
|
278
|
+
|
|
279
|
+
// When disabled, limit the view to the selected date
|
|
280
|
+
const minDateWithDisabled = disabled && value[0] || minDate;
|
|
281
|
+
const maxDateWithDisabled = disabled && value[1] || maxDate;
|
|
282
|
+
const CalendarHeader = slots?.calendarHeader ?? _PickersCalendarHeader.PickersCalendarHeader;
|
|
283
|
+
const calendarHeaderProps = (0, _utils.useSlotProps)({
|
|
284
|
+
elementType: CalendarHeader,
|
|
285
|
+
externalSlotProps: slotProps?.calendarHeader,
|
|
286
|
+
additionalProps: {
|
|
287
|
+
views: ['day'],
|
|
288
|
+
view: 'day',
|
|
289
|
+
currentMonth: calendarState.currentMonth,
|
|
290
|
+
onMonthChange: (newMonth, direction) => handleChangeMonth({
|
|
291
|
+
newMonth,
|
|
292
|
+
direction
|
|
293
|
+
}),
|
|
294
|
+
minDate: minDateWithDisabled,
|
|
295
|
+
maxDate: maxDateWithDisabled,
|
|
296
|
+
disabled,
|
|
297
|
+
disablePast,
|
|
298
|
+
disableFuture,
|
|
299
|
+
reduceAnimations,
|
|
300
|
+
slots,
|
|
301
|
+
slotProps,
|
|
302
|
+
timezone
|
|
303
|
+
},
|
|
304
|
+
ownerState: props
|
|
305
|
+
});
|
|
278
306
|
const prevValue = React.useRef(null);
|
|
279
307
|
React.useEffect(() => {
|
|
280
308
|
const date = rangePosition === 'start' ? value[0] : value[1];
|
|
@@ -327,10 +355,6 @@ const DateRangeCalendar = exports.DateRangeCalendar = /*#__PURE__*/React.forward
|
|
|
327
355
|
readOnly,
|
|
328
356
|
disabled
|
|
329
357
|
};
|
|
330
|
-
|
|
331
|
-
// When disabled, limit the view to the selected date
|
|
332
|
-
const minDateWithDisabled = disabled && value[0] || minDate;
|
|
333
|
-
const maxDateWithDisabled = disabled && value[1] || maxDate;
|
|
334
358
|
const [rangePreviewDay, setRangePreviewDay] = React.useState(null);
|
|
335
359
|
const CalendarTransitionProps = React.useMemo(() => ({
|
|
336
360
|
onMouseLeave: () => setRangePreviewDay(null)
|
|
@@ -427,24 +451,7 @@ const DateRangeCalendar = exports.DateRangeCalendar = /*#__PURE__*/React.forward
|
|
|
427
451
|
releaseInfo: releaseInfo
|
|
428
452
|
}), calendarMonths.map((month, index) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(DateRangeCalendarMonthContainer, {
|
|
429
453
|
className: classes.monthContainer,
|
|
430
|
-
children: [calendars === 1 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
431
|
-
views: ['day'],
|
|
432
|
-
view: 'day',
|
|
433
|
-
currentMonth: calendarState.currentMonth,
|
|
434
|
-
onMonthChange: (newMonth, direction) => handleChangeMonth({
|
|
435
|
-
newMonth,
|
|
436
|
-
direction
|
|
437
|
-
}),
|
|
438
|
-
minDate: minDateWithDisabled,
|
|
439
|
-
maxDate: maxDateWithDisabled,
|
|
440
|
-
disabled: disabled,
|
|
441
|
-
disablePast: disablePast,
|
|
442
|
-
disableFuture: disableFuture,
|
|
443
|
-
reduceAnimations: reduceAnimations,
|
|
444
|
-
slots: slots,
|
|
445
|
-
slotProps: slotProps,
|
|
446
|
-
timezone: timezone
|
|
447
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(DateRangeCalendarArrowSwitcher, {
|
|
454
|
+
children: [calendars === 1 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(CalendarHeader, (0, _extends2.default)({}, calendarHeaderProps)) : /*#__PURE__*/(0, _jsxRuntime.jsx)(DateRangeCalendarArrowSwitcher, {
|
|
448
455
|
onGoToPrevious: selectPreviousMonth,
|
|
449
456
|
onGoToNext: selectNextMonth,
|
|
450
457
|
isPreviousHidden: index !== 0,
|
|
@@ -455,7 +462,7 @@ const DateRangeCalendar = exports.DateRangeCalendar = /*#__PURE__*/React.forward
|
|
|
455
462
|
nextLabel: localeText.nextMonth,
|
|
456
463
|
slots: slots,
|
|
457
464
|
slotProps: slotProps,
|
|
458
|
-
children: utils.
|
|
465
|
+
children: utils.formatByString(visibleMonths[month], calendarHeaderProps.format ?? `${utils.formats.month} ${utils.formats.year}`)
|
|
459
466
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(DayCalendarForRange, (0, _extends2.default)({
|
|
460
467
|
className: classes.dayCalendar
|
|
461
468
|
}, calendarState, baseDateValidationProps, commonViewProps, {
|
|
@@ -507,7 +514,6 @@ process.env.NODE_ENV !== "production" ? DateRangeCalendar.propTypes = {
|
|
|
507
514
|
currentMonthCalendarPosition: _propTypes.default.oneOf([1, 2, 3]),
|
|
508
515
|
/**
|
|
509
516
|
* Formats the day of week displayed in the calendar header.
|
|
510
|
-
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
511
517
|
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
512
518
|
* @returns {string} The name to display.
|
|
513
519
|
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
@@ -84,7 +84,6 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
|
|
|
84
84
|
currentMonthCalendarPosition: _propTypes.default.oneOf([1, 2, 3]),
|
|
85
85
|
/**
|
|
86
86
|
* Formats the day of week displayed in the calendar header.
|
|
87
|
-
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
88
87
|
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
89
88
|
* @returns {string} The name to display.
|
|
90
89
|
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
@@ -95,7 +95,6 @@ DesktopDateRangePicker.propTypes = {
|
|
|
95
95
|
currentMonthCalendarPosition: _propTypes.default.oneOf([1, 2, 3]),
|
|
96
96
|
/**
|
|
97
97
|
* Formats the day of week displayed in the calendar header.
|
|
98
|
-
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
99
98
|
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
100
99
|
* @returns {string} The name to display.
|
|
101
100
|
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
@@ -95,7 +95,6 @@ MobileDateRangePicker.propTypes = {
|
|
|
95
95
|
currentMonthCalendarPosition: _propTypes.default.oneOf([1, 2, 3]),
|
|
96
96
|
/**
|
|
97
97
|
* Formats the day of week displayed in the calendar header.
|
|
98
|
-
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
99
98
|
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
100
99
|
* @returns {string} The name to display.
|
|
101
100
|
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
@@ -84,7 +84,6 @@ StaticDateRangePicker.propTypes = {
|
|
|
84
84
|
currentMonthCalendarPosition: _propTypes.default.oneOf([1, 2, 3]),
|
|
85
85
|
/**
|
|
86
86
|
* Formats the day of week displayed in the calendar header.
|
|
87
|
-
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
88
87
|
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
89
88
|
* @returns {string} The name to display.
|
|
90
89
|
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
package/node/index.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.getReleaseInfo = void 0;
|
|
7
7
|
var _utils = require("@mui/utils");
|
|
8
8
|
const getReleaseInfo = () => {
|
|
9
|
-
const releaseInfo = "
|
|
9
|
+
const releaseInfo = "MTcwMDE3MjAwMDAwMA==";
|
|
10
10
|
if (process.env.NODE_ENV !== 'production') {
|
|
11
11
|
// A simple hack to set the value in the test environment (has no build step).
|
|
12
12
|
// eslint-disable-next-line no-useless-concat
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-date-pickers-pro",
|
|
3
|
-
"version": "7.0.0-alpha.
|
|
3
|
+
"version": "7.0.0-alpha.1",
|
|
4
4
|
"description": "The commercial edition of the date picker components (MUI X).",
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"main": "./node/index.js",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"@babel/runtime": "^7.23.2",
|
|
34
34
|
"@mui/base": "^5.0.0-beta.22",
|
|
35
35
|
"@mui/utils": "^5.14.16",
|
|
36
|
-
"@mui/x-date-pickers": "7.0.0-alpha.
|
|
37
|
-
"@mui/x-license-pro": "7.0.0-alpha.
|
|
36
|
+
"@mui/x-date-pickers": "7.0.0-alpha.1",
|
|
37
|
+
"@mui/x-license-pro": "7.0.0-alpha.1",
|
|
38
38
|
"clsx": "^2.0.0",
|
|
39
39
|
"prop-types": "^15.8.1",
|
|
40
40
|
"react-transition-group": "^4.4.5"
|