@mui/x-date-pickers 6.18.7 → 6.19.2
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/AdapterDateFns/AdapterDateFns.d.ts +4 -24
- package/AdapterDateFns/AdapterDateFns.js +11 -272
- package/AdapterDateFnsBase/AdapterDateFnsBase.d.ts +65 -0
- package/AdapterDateFnsBase/AdapterDateFnsBase.js +308 -0
- package/AdapterDateFnsBase/index.d.ts +1 -0
- package/AdapterDateFnsBase/index.js +1 -0
- package/AdapterDateFnsBase/package.json +6 -0
- package/AdapterDateFnsJalali/AdapterDateFnsJalali.d.ts +1 -0
- package/AdapterDateFnsV3/AdapterDateFnsV3.d.ts +88 -0
- package/AdapterDateFnsV3/AdapterDateFnsV3.js +358 -0
- package/AdapterDateFnsV3/index.d.ts +1 -0
- package/AdapterDateFnsV3/index.js +1 -0
- package/AdapterDateFnsV3/package.json +6 -0
- package/AdapterLuxon/AdapterLuxon.js +0 -1
- package/CHANGELOG.md +106 -0
- package/DateCalendar/useCalendarState.js +0 -1
- package/DatePicker/DatePickerToolbar.d.ts +2 -2
- package/DatePicker/DatePickerToolbar.js +2 -7
- package/DateTimePicker/DateTimePickerTabs.js +6 -3
- package/DigitalClock/DigitalClock.js +1 -0
- package/DigitalClock/DigitalClock.types.d.ts +5 -0
- package/MonthCalendar/MonthCalendar.js +0 -1
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -0
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.types.d.ts +5 -0
- package/PickersLayout/pickersLayoutClasses.js +3 -2
- package/PickersLayout/usePickerLayout.js +2 -1
- package/TimeClock/Clock.js +0 -1
- package/TimeClock/ClockPointer.js +0 -1
- package/TimeClock/TimeClock.js +1 -0
- package/TimeClock/TimeClock.types.d.ts +5 -0
- package/YearCalendar/YearCalendar.js +0 -1
- package/hooks/useClearableField.d.ts +1 -1
- package/hooks/useClearableField.js +3 -3
- package/index.js +1 -1
- package/internals/hooks/useClockReferenceDate.js +0 -1
- package/internals/hooks/useField/useField.utils.js +0 -2
- package/internals/hooks/useViews.js +0 -1
- package/internals/models/helpers.d.ts +1 -0
- package/internals/models/props/tabs.d.ts +1 -0
- package/legacy/AdapterDateFns/AdapterDateFns.js +278 -529
- package/legacy/AdapterDateFnsBase/AdapterDateFnsBase.js +308 -0
- package/legacy/AdapterDateFnsBase/index.js +1 -0
- package/legacy/AdapterDateFnsV3/AdapterDateFnsV3.js +376 -0
- package/legacy/AdapterDateFnsV3/index.js +1 -0
- package/legacy/AdapterLuxon/AdapterLuxon.js +0 -1
- package/legacy/AdapterMomentHijri/AdapterMomentHijri.js +5 -6
- package/legacy/AdapterMomentJalaali/AdapterMomentJalaali.js +5 -6
- package/legacy/DateCalendar/PickersSlideTransition.js +8 -9
- package/legacy/DateCalendar/useCalendarState.js +0 -1
- package/legacy/DatePicker/DatePickerToolbar.js +2 -7
- package/legacy/DateTimePicker/DateTimePickerTabs.js +6 -3
- package/legacy/DigitalClock/DigitalClock.js +1 -0
- package/legacy/MonthCalendar/MonthCalendar.js +0 -1
- package/legacy/MonthCalendar/PickersMonth.js +4 -5
- package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -0
- package/legacy/PickersDay/PickersDay.js +5 -6
- package/legacy/PickersLayout/PickersLayout.js +5 -6
- package/legacy/PickersLayout/pickersLayoutClasses.js +3 -2
- package/legacy/PickersLayout/usePickerLayout.js +2 -1
- package/legacy/TimeClock/Clock.js +0 -1
- package/legacy/TimeClock/ClockNumber.js +4 -5
- package/legacy/TimeClock/ClockPointer.js +0 -1
- package/legacy/TimeClock/TimeClock.js +1 -0
- package/legacy/TimePicker/TimePickerToolbar.js +1 -2
- package/legacy/YearCalendar/PickersYear.js +4 -5
- package/legacy/YearCalendar/YearCalendar.js +0 -1
- package/legacy/hooks/useClearableField.js +3 -3
- package/legacy/index.js +1 -1
- package/legacy/internals/components/PickersModalDialog.js +3 -4
- package/legacy/internals/hooks/useClockReferenceDate.js +0 -1
- package/legacy/internals/hooks/useField/useField.utils.js +0 -2
- package/legacy/internals/hooks/useViews.js +0 -1
- package/legacy/locales/index.js +1 -0
- package/legacy/locales/plPL.js +0 -1
- package/legacy/locales/svSE.js +0 -1
- package/legacy/locales/urPK.js +0 -1
- package/locales/index.d.ts +1 -0
- package/locales/index.js +1 -0
- package/locales/plPL.js +0 -1
- package/locales/svSE.js +0 -1
- package/locales/urPK.js +0 -1
- package/modern/AdapterDateFns/AdapterDateFns.js +11 -271
- package/modern/AdapterDateFnsBase/AdapterDateFnsBase.js +307 -0
- package/modern/AdapterDateFnsBase/index.js +1 -0
- package/modern/AdapterDateFnsV3/AdapterDateFnsV3.js +358 -0
- package/modern/AdapterDateFnsV3/index.js +1 -0
- package/modern/AdapterLuxon/AdapterLuxon.js +0 -1
- package/modern/DateCalendar/useCalendarState.js +0 -1
- package/modern/DatePicker/DatePickerToolbar.js +2 -7
- package/modern/DateTimePicker/DateTimePickerTabs.js +6 -3
- package/modern/DigitalClock/DigitalClock.js +1 -0
- package/modern/MonthCalendar/MonthCalendar.js +0 -1
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -0
- package/modern/PickersLayout/pickersLayoutClasses.js +3 -2
- package/modern/PickersLayout/usePickerLayout.js +2 -1
- package/modern/TimeClock/Clock.js +0 -1
- package/modern/TimeClock/ClockPointer.js +0 -1
- package/modern/TimeClock/TimeClock.js +1 -0
- package/modern/YearCalendar/YearCalendar.js +0 -1
- package/modern/hooks/useClearableField.js +3 -3
- package/modern/index.js +1 -1
- package/modern/internals/hooks/useClockReferenceDate.js +0 -1
- package/modern/internals/hooks/useField/useField.utils.js +0 -2
- package/modern/internals/hooks/useViews.js +0 -1
- package/modern/locales/index.js +1 -0
- package/modern/locales/plPL.js +0 -1
- package/modern/locales/svSE.js +0 -1
- package/modern/locales/urPK.js +0 -1
- package/node/AdapterDateFns/AdapterDateFns.js +11 -271
- package/node/AdapterDateFnsBase/AdapterDateFnsBase.js +315 -0
- package/node/AdapterDateFnsBase/index.js +12 -0
- package/node/AdapterDateFnsV3/AdapterDateFnsV3.js +366 -0
- package/node/AdapterDateFnsV3/index.js +12 -0
- package/node/AdapterLuxon/AdapterLuxon.js +0 -1
- package/node/DateCalendar/useCalendarState.js +0 -1
- package/node/DatePicker/DatePickerToolbar.js +0 -4
- package/node/DateTimePicker/DateTimePickerTabs.js +7 -4
- package/node/DigitalClock/DigitalClock.js +1 -0
- package/node/MonthCalendar/MonthCalendar.js +0 -1
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -0
- package/node/PickersLayout/pickersLayoutClasses.js +5 -3
- package/node/PickersLayout/usePickerLayout.js +2 -1
- package/node/TimeClock/Clock.js +0 -1
- package/node/TimeClock/ClockPointer.js +0 -1
- package/node/TimeClock/TimeClock.js +1 -0
- package/node/YearCalendar/YearCalendar.js +0 -1
- package/node/hooks/useClearableField.js +3 -3
- package/node/index.js +1 -1
- package/node/internals/hooks/useClockReferenceDate.js +0 -1
- package/node/internals/hooks/useField/useField.utils.js +0 -2
- package/node/internals/hooks/useViews.js +0 -1
- package/node/locales/index.js +11 -0
- package/node/locales/plPL.js +0 -1
- package/node/locales/svSE.js +0 -1
- package/node/locales/urPK.js +0 -1
- package/package.json +2 -2
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
/* eslint-disable class-methods-use-this */
|
|
2
|
+
// TODO remove when date-fns-v3 is the default
|
|
3
|
+
// @ts-nocheck
|
|
4
|
+
import { addDays } from 'date-fns/addDays';
|
|
5
|
+
import { addSeconds } from 'date-fns/addSeconds';
|
|
6
|
+
import { addMinutes } from 'date-fns/addMinutes';
|
|
7
|
+
import { addHours } from 'date-fns/addHours';
|
|
8
|
+
import { addWeeks } from 'date-fns/addWeeks';
|
|
9
|
+
import { addMonths } from 'date-fns/addMonths';
|
|
10
|
+
import { addYears } from 'date-fns/addYears';
|
|
11
|
+
import { differenceInYears } from 'date-fns/differenceInYears';
|
|
12
|
+
import { differenceInQuarters } from 'date-fns/differenceInQuarters';
|
|
13
|
+
import { differenceInMonths } from 'date-fns/differenceInMonths';
|
|
14
|
+
import { differenceInWeeks } from 'date-fns/differenceInWeeks';
|
|
15
|
+
import { differenceInDays } from 'date-fns/differenceInDays';
|
|
16
|
+
import { differenceInHours } from 'date-fns/differenceInHours';
|
|
17
|
+
import { differenceInMinutes } from 'date-fns/differenceInMinutes';
|
|
18
|
+
import { differenceInSeconds } from 'date-fns/differenceInSeconds';
|
|
19
|
+
import { differenceInMilliseconds } from 'date-fns/differenceInMilliseconds';
|
|
20
|
+
import { eachDayOfInterval } from 'date-fns/eachDayOfInterval';
|
|
21
|
+
import { endOfDay } from 'date-fns/endOfDay';
|
|
22
|
+
import { endOfWeek } from 'date-fns/endOfWeek';
|
|
23
|
+
import { endOfYear } from 'date-fns/endOfYear';
|
|
24
|
+
// @ts-ignore TODO remove when date-fns-v3 is the default
|
|
25
|
+
import { format as dateFnsFormat, longFormatters } from 'date-fns/format';
|
|
26
|
+
import { getDate } from 'date-fns/getDate';
|
|
27
|
+
import { getDaysInMonth } from 'date-fns/getDaysInMonth';
|
|
28
|
+
import { getHours } from 'date-fns/getHours';
|
|
29
|
+
import { getMinutes } from 'date-fns/getMinutes';
|
|
30
|
+
import { getMonth } from 'date-fns/getMonth';
|
|
31
|
+
import { getSeconds } from 'date-fns/getSeconds';
|
|
32
|
+
import { getMilliseconds } from 'date-fns/getMilliseconds';
|
|
33
|
+
import { getWeek } from 'date-fns/getWeek';
|
|
34
|
+
import { getYear } from 'date-fns/getYear';
|
|
35
|
+
import { isAfter } from 'date-fns/isAfter';
|
|
36
|
+
import { isBefore } from 'date-fns/isBefore';
|
|
37
|
+
import { isEqual } from 'date-fns/isEqual';
|
|
38
|
+
import { isSameDay } from 'date-fns/isSameDay';
|
|
39
|
+
import { isSameYear } from 'date-fns/isSameYear';
|
|
40
|
+
import { isSameMonth } from 'date-fns/isSameMonth';
|
|
41
|
+
import { isSameHour } from 'date-fns/isSameHour';
|
|
42
|
+
import { isValid } from 'date-fns/isValid';
|
|
43
|
+
import { parse as dateFnsParse } from 'date-fns/parse';
|
|
44
|
+
import { setDate } from 'date-fns/setDate';
|
|
45
|
+
import { setHours } from 'date-fns/setHours';
|
|
46
|
+
import { setMinutes } from 'date-fns/setMinutes';
|
|
47
|
+
import { setMonth } from 'date-fns/setMonth';
|
|
48
|
+
import { setSeconds } from 'date-fns/setSeconds';
|
|
49
|
+
import { setMilliseconds } from 'date-fns/setMilliseconds';
|
|
50
|
+
import { setYear } from 'date-fns/setYear';
|
|
51
|
+
import { startOfDay } from 'date-fns/startOfDay';
|
|
52
|
+
import { startOfMonth } from 'date-fns/startOfMonth';
|
|
53
|
+
import { endOfMonth } from 'date-fns/endOfMonth';
|
|
54
|
+
import { startOfWeek } from 'date-fns/startOfWeek';
|
|
55
|
+
import { startOfYear } from 'date-fns/startOfYear';
|
|
56
|
+
import { formatISO } from 'date-fns/formatISO';
|
|
57
|
+
import { parseISO } from 'date-fns/parseISO';
|
|
58
|
+
import { isWithinInterval } from 'date-fns/isWithinInterval';
|
|
59
|
+
import { enUS } from 'date-fns/locale/en-US';
|
|
60
|
+
// date-fns v2 does not export types
|
|
61
|
+
// @ts-ignore TODO remove when date-fns-v3 is the default
|
|
62
|
+
|
|
63
|
+
import { AdapterDateFnsBase } from '../AdapterDateFnsBase';
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Based on `@date-io/date-fns`
|
|
67
|
+
*
|
|
68
|
+
* MIT License
|
|
69
|
+
*
|
|
70
|
+
* Copyright (c) 2017 Dmitriy Kovalenko
|
|
71
|
+
*
|
|
72
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
73
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
74
|
+
* in the Software without restriction, including without limitation the rights
|
|
75
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
76
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
77
|
+
* furnished to do so, subject to the following conditions:
|
|
78
|
+
*
|
|
79
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
80
|
+
* copies or substantial portions of the Software.
|
|
81
|
+
*
|
|
82
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
83
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
84
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
85
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
86
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
87
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
88
|
+
* SOFTWARE.
|
|
89
|
+
*/
|
|
90
|
+
export class AdapterDateFns extends AdapterDateFnsBase {
|
|
91
|
+
constructor({
|
|
92
|
+
locale,
|
|
93
|
+
formats
|
|
94
|
+
} = {}) {
|
|
95
|
+
if (typeof addDays !== 'function') {
|
|
96
|
+
throw new Error([`MUI: The \`date-fns\` package v2.x is not compatible with this adapter.`, 'Please, install v3.x of the package or use the `AdapterDateFns` instead.'].join('\n'));
|
|
97
|
+
}
|
|
98
|
+
if (!longFormatters) {
|
|
99
|
+
throw new Error('MUI: The minimum supported `date-fns` package version compatible with this adapter is `3.2.x`.');
|
|
100
|
+
}
|
|
101
|
+
super({
|
|
102
|
+
locale: locale != null ? locale : enUS,
|
|
103
|
+
formats,
|
|
104
|
+
longFormatters
|
|
105
|
+
});
|
|
106
|
+
this.parseISO = isoString => {
|
|
107
|
+
return parseISO(isoString);
|
|
108
|
+
};
|
|
109
|
+
this.toISO = value => {
|
|
110
|
+
return formatISO(value, {
|
|
111
|
+
format: 'extended'
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
this.parse = (value, format) => {
|
|
115
|
+
if (value === '') {
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
return dateFnsParse(value, format, new Date(), {
|
|
119
|
+
locale: this.locale
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
this.isValid = value => {
|
|
123
|
+
return isValid(this.date(value));
|
|
124
|
+
};
|
|
125
|
+
this.format = (value, formatKey) => {
|
|
126
|
+
return this.formatByString(value, this.formats[formatKey]);
|
|
127
|
+
};
|
|
128
|
+
this.formatByString = (value, formatString) => {
|
|
129
|
+
return dateFnsFormat(value, formatString, {
|
|
130
|
+
locale: this.locale
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
this.getDiff = (value, comparing, unit) => {
|
|
134
|
+
switch (unit) {
|
|
135
|
+
case 'years':
|
|
136
|
+
return differenceInYears(value, this.date(comparing));
|
|
137
|
+
case 'quarters':
|
|
138
|
+
return differenceInQuarters(value, this.date(comparing));
|
|
139
|
+
case 'months':
|
|
140
|
+
return differenceInMonths(value, this.date(comparing));
|
|
141
|
+
case 'weeks':
|
|
142
|
+
return differenceInWeeks(value, this.date(comparing));
|
|
143
|
+
case 'days':
|
|
144
|
+
return differenceInDays(value, this.date(comparing));
|
|
145
|
+
case 'hours':
|
|
146
|
+
return differenceInHours(value, this.date(comparing));
|
|
147
|
+
case 'minutes':
|
|
148
|
+
return differenceInMinutes(value, this.date(comparing));
|
|
149
|
+
case 'seconds':
|
|
150
|
+
return differenceInSeconds(value, this.date(comparing));
|
|
151
|
+
default:
|
|
152
|
+
{
|
|
153
|
+
return differenceInMilliseconds(value, this.date(comparing));
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
this.isEqual = (value, comparing) => {
|
|
158
|
+
if (value === null && comparing === null) {
|
|
159
|
+
return true;
|
|
160
|
+
}
|
|
161
|
+
return isEqual(value, comparing);
|
|
162
|
+
};
|
|
163
|
+
this.isSameYear = (value, comparing) => {
|
|
164
|
+
return isSameYear(value, comparing);
|
|
165
|
+
};
|
|
166
|
+
this.isSameMonth = (value, comparing) => {
|
|
167
|
+
return isSameMonth(value, comparing);
|
|
168
|
+
};
|
|
169
|
+
this.isSameDay = (value, comparing) => {
|
|
170
|
+
return isSameDay(value, comparing);
|
|
171
|
+
};
|
|
172
|
+
this.isSameHour = (value, comparing) => {
|
|
173
|
+
return isSameHour(value, comparing);
|
|
174
|
+
};
|
|
175
|
+
this.isAfter = (value, comparing) => {
|
|
176
|
+
return isAfter(value, comparing);
|
|
177
|
+
};
|
|
178
|
+
this.isAfterYear = (value, comparing) => {
|
|
179
|
+
return isAfter(value, endOfYear(comparing));
|
|
180
|
+
};
|
|
181
|
+
this.isAfterDay = (value, comparing) => {
|
|
182
|
+
return isAfter(value, endOfDay(comparing));
|
|
183
|
+
};
|
|
184
|
+
this.isBefore = (value, comparing) => {
|
|
185
|
+
return isBefore(value, comparing);
|
|
186
|
+
};
|
|
187
|
+
this.isBeforeYear = (value, comparing) => {
|
|
188
|
+
return isBefore(value, this.startOfYear(comparing));
|
|
189
|
+
};
|
|
190
|
+
this.isBeforeDay = (value, comparing) => {
|
|
191
|
+
return isBefore(value, this.startOfDay(comparing));
|
|
192
|
+
};
|
|
193
|
+
this.isWithinRange = (value, [start, end]) => {
|
|
194
|
+
return isWithinInterval(value, {
|
|
195
|
+
start,
|
|
196
|
+
end
|
|
197
|
+
});
|
|
198
|
+
};
|
|
199
|
+
this.startOfYear = value => {
|
|
200
|
+
return startOfYear(value);
|
|
201
|
+
};
|
|
202
|
+
this.startOfMonth = value => {
|
|
203
|
+
return startOfMonth(value);
|
|
204
|
+
};
|
|
205
|
+
this.startOfWeek = value => {
|
|
206
|
+
return startOfWeek(value, {
|
|
207
|
+
locale: this.locale
|
|
208
|
+
});
|
|
209
|
+
};
|
|
210
|
+
this.startOfDay = value => {
|
|
211
|
+
return startOfDay(value);
|
|
212
|
+
};
|
|
213
|
+
this.endOfYear = value => {
|
|
214
|
+
return endOfYear(value);
|
|
215
|
+
};
|
|
216
|
+
this.endOfMonth = value => {
|
|
217
|
+
return endOfMonth(value);
|
|
218
|
+
};
|
|
219
|
+
this.endOfWeek = value => {
|
|
220
|
+
return endOfWeek(value, {
|
|
221
|
+
locale: this.locale
|
|
222
|
+
});
|
|
223
|
+
};
|
|
224
|
+
this.endOfDay = value => {
|
|
225
|
+
return endOfDay(value);
|
|
226
|
+
};
|
|
227
|
+
this.addYears = (value, amount) => {
|
|
228
|
+
return addYears(value, amount);
|
|
229
|
+
};
|
|
230
|
+
this.addMonths = (value, amount) => {
|
|
231
|
+
return addMonths(value, amount);
|
|
232
|
+
};
|
|
233
|
+
this.addWeeks = (value, amount) => {
|
|
234
|
+
return addWeeks(value, amount);
|
|
235
|
+
};
|
|
236
|
+
this.addDays = (value, amount) => {
|
|
237
|
+
return addDays(value, amount);
|
|
238
|
+
};
|
|
239
|
+
this.addHours = (value, amount) => {
|
|
240
|
+
return addHours(value, amount);
|
|
241
|
+
};
|
|
242
|
+
this.addMinutes = (value, amount) => {
|
|
243
|
+
return addMinutes(value, amount);
|
|
244
|
+
};
|
|
245
|
+
this.addSeconds = (value, amount) => {
|
|
246
|
+
return addSeconds(value, amount);
|
|
247
|
+
};
|
|
248
|
+
this.getYear = value => {
|
|
249
|
+
return getYear(value);
|
|
250
|
+
};
|
|
251
|
+
this.getMonth = value => {
|
|
252
|
+
return getMonth(value);
|
|
253
|
+
};
|
|
254
|
+
this.getDate = value => {
|
|
255
|
+
return getDate(value);
|
|
256
|
+
};
|
|
257
|
+
this.getHours = value => {
|
|
258
|
+
return getHours(value);
|
|
259
|
+
};
|
|
260
|
+
this.getMinutes = value => {
|
|
261
|
+
return getMinutes(value);
|
|
262
|
+
};
|
|
263
|
+
this.getSeconds = value => {
|
|
264
|
+
return getSeconds(value);
|
|
265
|
+
};
|
|
266
|
+
this.getMilliseconds = value => {
|
|
267
|
+
return getMilliseconds(value);
|
|
268
|
+
};
|
|
269
|
+
this.setYear = (value, year) => {
|
|
270
|
+
return setYear(value, year);
|
|
271
|
+
};
|
|
272
|
+
this.setMonth = (value, month) => {
|
|
273
|
+
return setMonth(value, month);
|
|
274
|
+
};
|
|
275
|
+
this.setDate = (value, date) => {
|
|
276
|
+
return setDate(value, date);
|
|
277
|
+
};
|
|
278
|
+
this.setHours = (value, hours) => {
|
|
279
|
+
return setHours(value, hours);
|
|
280
|
+
};
|
|
281
|
+
this.setMinutes = (value, minutes) => {
|
|
282
|
+
return setMinutes(value, minutes);
|
|
283
|
+
};
|
|
284
|
+
this.setSeconds = (value, seconds) => {
|
|
285
|
+
return setSeconds(value, seconds);
|
|
286
|
+
};
|
|
287
|
+
this.setMilliseconds = (value, milliseconds) => {
|
|
288
|
+
return setMilliseconds(value, milliseconds);
|
|
289
|
+
};
|
|
290
|
+
this.getDaysInMonth = value => {
|
|
291
|
+
return getDaysInMonth(value);
|
|
292
|
+
};
|
|
293
|
+
this.getNextMonth = value => {
|
|
294
|
+
return addMonths(value, 1);
|
|
295
|
+
};
|
|
296
|
+
this.getPreviousMonth = value => {
|
|
297
|
+
return addMonths(value, -1);
|
|
298
|
+
};
|
|
299
|
+
this.getMonthArray = value => {
|
|
300
|
+
const firstMonth = startOfYear(value);
|
|
301
|
+
const monthArray = [firstMonth];
|
|
302
|
+
while (monthArray.length < 12) {
|
|
303
|
+
const prevMonth = monthArray[monthArray.length - 1];
|
|
304
|
+
monthArray.push(this.getNextMonth(prevMonth));
|
|
305
|
+
}
|
|
306
|
+
return monthArray;
|
|
307
|
+
};
|
|
308
|
+
this.mergeDateAndTime = (dateParam, timeParam) => {
|
|
309
|
+
return this.setSeconds(this.setMinutes(this.setHours(dateParam, this.getHours(timeParam)), this.getMinutes(timeParam)), this.getSeconds(timeParam));
|
|
310
|
+
};
|
|
311
|
+
this.getWeekdays = () => {
|
|
312
|
+
const now = new Date();
|
|
313
|
+
return eachDayOfInterval({
|
|
314
|
+
start: startOfWeek(now, {
|
|
315
|
+
locale: this.locale
|
|
316
|
+
}),
|
|
317
|
+
end: endOfWeek(now, {
|
|
318
|
+
locale: this.locale
|
|
319
|
+
})
|
|
320
|
+
}).map(day => this.formatByString(day, 'EEEEEE'));
|
|
321
|
+
};
|
|
322
|
+
this.getWeekArray = value => {
|
|
323
|
+
const start = startOfWeek(startOfMonth(value), {
|
|
324
|
+
locale: this.locale
|
|
325
|
+
});
|
|
326
|
+
const end = endOfWeek(endOfMonth(value), {
|
|
327
|
+
locale: this.locale
|
|
328
|
+
});
|
|
329
|
+
let count = 0;
|
|
330
|
+
let current = start;
|
|
331
|
+
const nestedWeeks = [];
|
|
332
|
+
while (isBefore(current, end)) {
|
|
333
|
+
const weekNumber = Math.floor(count / 7);
|
|
334
|
+
nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];
|
|
335
|
+
nestedWeeks[weekNumber].push(current);
|
|
336
|
+
current = addDays(current, 1);
|
|
337
|
+
count += 1;
|
|
338
|
+
}
|
|
339
|
+
return nestedWeeks;
|
|
340
|
+
};
|
|
341
|
+
this.getWeekNumber = value => {
|
|
342
|
+
return getWeek(value, {
|
|
343
|
+
locale: this.locale
|
|
344
|
+
});
|
|
345
|
+
};
|
|
346
|
+
this.getYearRange = (start, end) => {
|
|
347
|
+
const startDate = startOfYear(start);
|
|
348
|
+
const endDate = endOfYear(end);
|
|
349
|
+
const years = [];
|
|
350
|
+
let current = startDate;
|
|
351
|
+
while (isBefore(current, endDate)) {
|
|
352
|
+
years.push(current);
|
|
353
|
+
current = addYears(current, 1);
|
|
354
|
+
}
|
|
355
|
+
return years;
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AdapterDateFns } from './AdapterDateFnsV3';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AdapterDateFns } from './AdapterDateFnsV3';
|
|
@@ -266,7 +266,6 @@ export class AdapterLuxon {
|
|
|
266
266
|
if (typeof Intl === 'undefined' || typeof Intl.DateTimeFormat === 'undefined') {
|
|
267
267
|
return true; // Luxon defaults to en-US if Intl not found
|
|
268
268
|
}
|
|
269
|
-
|
|
270
269
|
return Boolean((_Intl$DateTimeFormat = new Intl.DateTimeFormat(this.locale, {
|
|
271
270
|
hour: 'numeric'
|
|
272
271
|
})) == null || (_Intl$DateTimeFormat = _Intl$DateTimeFormat.resolvedOptions()) == null ? void 0 : _Intl$DateTimeFormat.hour12);
|
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,112 @@
|
|
|
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
|
+
## 6.19.2
|
|
7
|
+
|
|
8
|
+
_Jan 25, 2024_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 2 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🚀 Apply the `layout.tabs` class to `Tabs` slot (@LukasTy) (#11782)
|
|
13
|
+
- 🐞 Bugfixes
|
|
14
|
+
|
|
15
|
+
### Date Pickers
|
|
16
|
+
|
|
17
|
+
#### `@mui/x-date-pickers@6.19.2`
|
|
18
|
+
|
|
19
|
+
- [pickers] Apply the `layout.tabs` class to `Tabs` slot (@LukasTy) (#11782)
|
|
20
|
+
|
|
21
|
+
#### `@mui/x-date-pickers-pro@6.19.2` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
22
|
+
|
|
23
|
+
Same changes as in `@mui/x-date-pickers@6.19.2`, plus:
|
|
24
|
+
|
|
25
|
+
- [DateRangePicker] Remove `calendars` prop on `Mobile` (@LukasTy) (#11771)
|
|
26
|
+
|
|
27
|
+
### Data Grid
|
|
28
|
+
|
|
29
|
+
#### `@mui/x-data-grid@6.19.2`
|
|
30
|
+
|
|
31
|
+
- [DataGrid] Fix support for tree with more than 50,000 children (@zenazn) (#11808)
|
|
32
|
+
|
|
33
|
+
#### `@mui/x-data-grid-pro@6.19.2` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
34
|
+
|
|
35
|
+
Same changes as in `@mui/x-data-grid@6.19.2`.
|
|
36
|
+
|
|
37
|
+
#### `@mui/x-data-grid-premium@6.19.2` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
38
|
+
|
|
39
|
+
Same changes as in `@mui/x-data-grid-pro@6.19.2`.
|
|
40
|
+
|
|
41
|
+
## 6.19.1
|
|
42
|
+
|
|
43
|
+
_Jan 19, 2024_
|
|
44
|
+
|
|
45
|
+
We'd like to offer a big thanks to the 1 contributors who made this release possible. Here are some highlights ✨:
|
|
46
|
+
|
|
47
|
+
- 🌍 Add Croatian (hr-HR), Portuguese (pt-PT), and Chinese (Hong Kong) (zh-HK) locales (#11717) @BCaspari
|
|
48
|
+
- 🐞 Bugfixes
|
|
49
|
+
|
|
50
|
+
### Data Grid
|
|
51
|
+
|
|
52
|
+
#### `@mui/x-data-grid@6.19.1`
|
|
53
|
+
|
|
54
|
+
- [l10n] Add Croatian (hr-HR), Portuguese (pt-PT), and Chinese (Hong Kong) (zh-HK) locales (#11717) @BCaspari
|
|
55
|
+
|
|
56
|
+
#### `@mui/x-data-grid-pro@6.19.1` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
57
|
+
|
|
58
|
+
Same changes as in `@mui/x-data-grid@6.19.1`.
|
|
59
|
+
|
|
60
|
+
#### `@mui/x-data-grid-premium@6.19.1` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
61
|
+
|
|
62
|
+
Same changes as in `@mui/x-data-grid-pro@6.19.1`.
|
|
63
|
+
|
|
64
|
+
### Charts / `@mui/x-charts@6.19.1`
|
|
65
|
+
|
|
66
|
+
- [charts] Add `arcLabelRadius` property (#11563) @alexfauquette
|
|
67
|
+
- [charts] Do not propagate `innerRadius` and `outerRadius` to the DOM (#11719) @alexfauquette
|
|
68
|
+
- [charts] Fix default `stackOffset` for `LineChart` (#11703) @alexfauquette
|
|
69
|
+
|
|
70
|
+
## 6.19.0
|
|
71
|
+
|
|
72
|
+
_Jan 11, 2024_
|
|
73
|
+
|
|
74
|
+
We'd like to offer a big thanks to the 3 contributors who made this release possible. Here are some highlights ✨:
|
|
75
|
+
|
|
76
|
+
- ⏰ Support date-fns v3 (#11659) @LukasTy
|
|
77
|
+
Pickers support both v2 and v3 of date-fns. For v3 use `AdapterDateFnsV3`.
|
|
78
|
+
```js
|
|
79
|
+
// with date-fns v2.x
|
|
80
|
+
import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns';
|
|
81
|
+
import de from 'date-fns/locale/de';
|
|
82
|
+
```
|
|
83
|
+
```js
|
|
84
|
+
// with date-fns v3.x
|
|
85
|
+
import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFnsV3';
|
|
86
|
+
import { de } from 'date-fns/locale/de';
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Date Pickers
|
|
90
|
+
|
|
91
|
+
#### `@mui/x-date-pickers@6.19.0`
|
|
92
|
+
|
|
93
|
+
- [pickers] Add date-fns@3.x adapter (#11659) @LukasTy
|
|
94
|
+
- [pickers] Fix clearable behavior blocking focus return to `OpenPickerButton` (#11643) @noraleonte
|
|
95
|
+
- [l10n] Add missing Danish (da-DK) locale export (#11641) @etlos
|
|
96
|
+
|
|
97
|
+
#### `@mui/x-date-pickers-pro@6.19.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
98
|
+
|
|
99
|
+
Same changes as in `@mui/x-date-pickers@6.19.0`.
|
|
100
|
+
|
|
101
|
+
### Docs
|
|
102
|
+
|
|
103
|
+
- [docs] Add missing component @oliviertassinari
|
|
104
|
+
- [docs] Fix parsing of `x-date-pickers-pro` demo adapter imports (#11637) @LukasTy
|
|
105
|
+
- [docs] Push up the MUI X brand (#11533) @oliviertassinari
|
|
106
|
+
- [docs] Improve Server-side data grid docs (#11589) @oliviertassinari
|
|
107
|
+
- [docs] Add demo to the charts overview page (#11586) @danilo-leal
|
|
108
|
+
- [docs] Fix 404 links in the docs @oliviertassinari
|
|
109
|
+
- [docs] Improve landing page (#11570) @oliviertassinari
|
|
110
|
+
- [docs] Give a general revision to the docs (#11249) @danilo-leal
|
|
111
|
+
|
|
6
112
|
## 6.18.7
|
|
7
113
|
|
|
8
114
|
_Jan 5, 2024_
|
|
@@ -70,7 +70,6 @@ export const useCalendarState = params => {
|
|
|
70
70
|
});
|
|
71
71
|
}, [] // eslint-disable-line react-hooks/exhaustive-deps
|
|
72
72
|
);
|
|
73
|
-
|
|
74
73
|
const [calendarState, dispatch] = React.useReducer(reducerFn, {
|
|
75
74
|
isMonthSwitchingAnimating: false,
|
|
76
75
|
focusedDay: utils.isValid(value) ? value : now,
|
|
@@ -22,5 +22,5 @@ type DatePickerToolbarComponent = (<TDate>(props: DatePickerToolbarProps<TDate>
|
|
|
22
22
|
*
|
|
23
23
|
* - [DatePickerToolbar API](https://mui.com/x/api/date-pickers/date-picker-toolbar/)
|
|
24
24
|
*/
|
|
25
|
-
declare const DatePickerToolbar: DatePickerToolbarComponent;
|
|
26
|
-
export {
|
|
25
|
+
export declare const DatePickerToolbar: DatePickerToolbarComponent;
|
|
26
|
+
export {};
|
|
@@ -26,10 +26,6 @@ const DatePickerToolbarRoot = styled(PickersToolbar, {
|
|
|
26
26
|
slot: 'Root',
|
|
27
27
|
overridesResolver: (_, styles) => styles.root
|
|
28
28
|
})({});
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* @ignore - do not document.
|
|
32
|
-
*/
|
|
33
29
|
const DatePickerToolbarTitle = styled(Typography, {
|
|
34
30
|
name: 'MuiDatePickerToolbar',
|
|
35
31
|
slot: 'Title',
|
|
@@ -49,7 +45,7 @@ const DatePickerToolbarTitle = styled(Typography, {
|
|
|
49
45
|
*
|
|
50
46
|
* - [DatePickerToolbar API](https://mui.com/x/api/date-pickers/date-picker-toolbar/)
|
|
51
47
|
*/
|
|
52
|
-
const DatePickerToolbar = /*#__PURE__*/React.forwardRef(function DatePickerToolbar(inProps, ref) {
|
|
48
|
+
export const DatePickerToolbar = /*#__PURE__*/React.forwardRef(function DatePickerToolbar(inProps, ref) {
|
|
53
49
|
const props = useThemeProps({
|
|
54
50
|
props: inProps,
|
|
55
51
|
name: 'MuiDatePickerToolbar'
|
|
@@ -133,5 +129,4 @@ process.env.NODE_ENV !== "production" ? DatePickerToolbar.propTypes = {
|
|
|
133
129
|
*/
|
|
134
130
|
view: PropTypes.oneOf(['day', 'month', 'year']).isRequired,
|
|
135
131
|
views: PropTypes.arrayOf(PropTypes.oneOf(['day', 'month', 'year']).isRequired).isRequired
|
|
136
|
-
} : void 0;
|
|
137
|
-
export { DatePickerToolbar };
|
|
132
|
+
} : void 0;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
2
3
|
import PropTypes from 'prop-types';
|
|
3
4
|
import Tab from '@mui/material/Tab';
|
|
4
5
|
import Tabs, { tabsClasses } from '@mui/material/Tabs';
|
|
5
6
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
6
|
-
import
|
|
7
|
+
import composeClasses from '@mui/utils/composeClasses';
|
|
7
8
|
import { TimeIcon, DateRangeIcon } from '../icons';
|
|
8
9
|
import { useLocaleText } from '../internals/hooks/useUtils';
|
|
9
10
|
import { getDateTimePickerTabsUtilityClass } from './dateTimePickerTabsClasses';
|
|
@@ -68,7 +69,8 @@ const DateTimePickerTabs = function DateTimePickerTabs(inProps) {
|
|
|
68
69
|
onViewChange,
|
|
69
70
|
timeIcon = /*#__PURE__*/_jsx(TimeIcon, {}),
|
|
70
71
|
view,
|
|
71
|
-
hidden = typeof window === 'undefined' || window.innerHeight < 667
|
|
72
|
+
hidden = typeof window === 'undefined' || window.innerHeight < 667,
|
|
73
|
+
className
|
|
72
74
|
} = props;
|
|
73
75
|
const localeText = useLocaleText();
|
|
74
76
|
const classes = useUtilityClasses(props);
|
|
@@ -83,7 +85,7 @@ const DateTimePickerTabs = function DateTimePickerTabs(inProps) {
|
|
|
83
85
|
variant: "fullWidth",
|
|
84
86
|
value: viewToTab(view),
|
|
85
87
|
onChange: handleChange,
|
|
86
|
-
className: classes.root,
|
|
88
|
+
className: clsx(className, classes.root),
|
|
87
89
|
children: [/*#__PURE__*/_jsx(Tab, {
|
|
88
90
|
value: "date",
|
|
89
91
|
"aria-label": localeText.dateTableLabel,
|
|
@@ -108,6 +110,7 @@ process.env.NODE_ENV !== "production" ? DateTimePickerTabs.propTypes = {
|
|
|
108
110
|
* Override or extend the styles applied to the component.
|
|
109
111
|
*/
|
|
110
112
|
classes: PropTypes.object,
|
|
113
|
+
className: PropTypes.string,
|
|
111
114
|
/**
|
|
112
115
|
* Date tab icon.
|
|
113
116
|
* @default DateRange
|
|
@@ -18,6 +18,11 @@ export interface DigitalClockSlotsComponentsProps {
|
|
|
18
18
|
digitalClockItem?: SlotComponentProps<typeof MenuItem, {}, Record<string, any>>;
|
|
19
19
|
}
|
|
20
20
|
export interface DigitalClockProps<TDate> extends ExportedDigitalClockProps<TDate>, BaseClockProps<TDate, Extract<TimeView, 'hours'>> {
|
|
21
|
+
/**
|
|
22
|
+
* Available views.
|
|
23
|
+
* @default ['hours']
|
|
24
|
+
*/
|
|
25
|
+
views?: readonly 'hours'[];
|
|
21
26
|
/**
|
|
22
27
|
* Override or extend the styles applied to the component.
|
|
23
28
|
*/
|
|
@@ -111,7 +111,6 @@ export const MonthCalendar = /*#__PURE__*/React.forwardRef(function MonthCalenda
|
|
|
111
111
|
granularity: SECTION_TYPE_GRANULARITY.month
|
|
112
112
|
}), [] // eslint-disable-line react-hooks/exhaustive-deps
|
|
113
113
|
);
|
|
114
|
-
|
|
115
114
|
const ownerState = props;
|
|
116
115
|
const classes = useUtilityClasses(ownerState);
|
|
117
116
|
const todayMonth = React.useMemo(() => utils.getMonth(now), [utils, now]);
|
|
@@ -509,6 +509,7 @@ process.env.NODE_ENV !== "production" ? MultiSectionDigitalClock.propTypes = {
|
|
|
509
509
|
view: PropTypes.oneOf(['hours', 'meridiem', 'minutes', 'seconds']),
|
|
510
510
|
/**
|
|
511
511
|
* Available views.
|
|
512
|
+
* @default ['hours', 'minutes']
|
|
512
513
|
*/
|
|
513
514
|
views: PropTypes.arrayOf(PropTypes.oneOf(['hours', 'meridiem', 'minutes', 'seconds']).isRequired)
|
|
514
515
|
} : void 0;
|
|
@@ -28,6 +28,11 @@ export interface MultiSectionDigitalClockSlotsComponentsProps {
|
|
|
28
28
|
digitalClockSectionItem?: SlotComponentProps<typeof MenuItem, {}, Record<string, any>>;
|
|
29
29
|
}
|
|
30
30
|
export interface MultiSectionDigitalClockProps<TDate> extends ExportedMultiSectionDigitalClockProps<TDate>, BaseClockProps<TDate, TimeViewWithMeridiem> {
|
|
31
|
+
/**
|
|
32
|
+
* Available views.
|
|
33
|
+
* @default ['hours', 'minutes']
|
|
34
|
+
*/
|
|
35
|
+
views?: readonly TimeViewWithMeridiem[];
|
|
31
36
|
/**
|
|
32
37
|
* Override or extend the styles applied to the component.
|
|
33
38
|
*/
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
2
|
+
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
2
3
|
export function getPickersLayoutUtilityClass(slot) {
|
|
3
4
|
return generateUtilityClass('MuiPickersLayout', slot);
|
|
4
5
|
}
|
|
5
|
-
export const pickersLayoutClasses = generateUtilityClasses('MuiPickersLayout', ['root', 'landscape', 'contentWrapper', 'toolbar', 'actionBar', 'shortcuts']);
|
|
6
|
+
export const pickersLayoutClasses = generateUtilityClasses('MuiPickersLayout', ['root', 'landscape', 'contentWrapper', 'toolbar', 'actionBar', 'tabs', 'shortcuts']);
|
|
@@ -110,7 +110,8 @@ const usePickerLayout = props => {
|
|
|
110
110
|
const Tabs = slots == null ? void 0 : slots.tabs;
|
|
111
111
|
const tabs = view && Tabs ? /*#__PURE__*/_jsx(Tabs, _extends({
|
|
112
112
|
view: view,
|
|
113
|
-
onViewChange: onViewChange
|
|
113
|
+
onViewChange: onViewChange,
|
|
114
|
+
className: classes.tabs
|
|
114
115
|
}, slotProps == null ? void 0 : slotProps.tabs)) : null;
|
|
115
116
|
|
|
116
117
|
// Shortcuts
|
package/TimeClock/Clock.js
CHANGED
package/TimeClock/TimeClock.js
CHANGED
|
@@ -492,6 +492,7 @@ process.env.NODE_ENV !== "production" ? TimeClock.propTypes = {
|
|
|
492
492
|
view: PropTypes.oneOf(['hours', 'minutes', 'seconds']),
|
|
493
493
|
/**
|
|
494
494
|
* Available views.
|
|
495
|
+
* @default ['hours', 'minutes']
|
|
495
496
|
*/
|
|
496
497
|
views: PropTypes.arrayOf(PropTypes.oneOf(['hours', 'minutes', 'seconds']).isRequired)
|
|
497
498
|
} : void 0;
|