@mui/x-date-pickers 8.10.0 → 8.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/AdapterDateFns/AdapterDateFns.js +194 -195
  2. package/AdapterDateFnsBase/AdapterDateFnsBase.js +57 -62
  3. package/AdapterDateFnsJalali/AdapterDateFnsJalali.js +197 -198
  4. package/AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.js +196 -196
  5. package/AdapterDateFnsV2/AdapterDateFnsV2.js +193 -193
  6. package/AdapterDayjs/AdapterDayjs.js +378 -379
  7. package/AdapterLuxon/AdapterLuxon.js +324 -326
  8. package/AdapterMoment/AdapterMoment.js +297 -302
  9. package/AdapterMomentHijri/AdapterMomentHijri.js +78 -78
  10. package/AdapterMomentJalaali/AdapterMomentJalaali.js +78 -80
  11. package/CHANGELOG.md +309 -0
  12. package/PickersTextField/PickersInputBase/PickersInputBase.js +14 -1
  13. package/PickersTextField/PickersTextField.js +3 -2
  14. package/esm/AdapterDateFns/AdapterDateFns.js +194 -194
  15. package/esm/AdapterDateFnsBase/AdapterDateFnsBase.js +57 -62
  16. package/esm/AdapterDateFnsJalali/AdapterDateFnsJalali.js +197 -197
  17. package/esm/AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.js +196 -196
  18. package/esm/AdapterDateFnsV2/AdapterDateFnsV2.js +193 -193
  19. package/esm/AdapterDayjs/AdapterDayjs.js +378 -379
  20. package/esm/AdapterLuxon/AdapterLuxon.js +324 -325
  21. package/esm/AdapterMoment/AdapterMoment.js +297 -301
  22. package/esm/AdapterMomentHijri/AdapterMomentHijri.js +78 -78
  23. package/esm/AdapterMomentJalaali/AdapterMomentJalaali.js +78 -80
  24. package/esm/PickersTextField/PickersInputBase/PickersInputBase.js +14 -1
  25. package/esm/PickersTextField/PickersTextField.js +3 -2
  26. package/esm/index.js +1 -1
  27. package/esm/internals/hooks/useField/syncSelectionToDOM.js +3 -1
  28. package/esm/internals/models/helpers.d.ts +1 -1
  29. package/esm/models/fields.d.ts +4 -0
  30. package/index.js +1 -1
  31. package/internals/hooks/useField/syncSelectionToDOM.js +3 -1
  32. package/internals/models/helpers.d.ts +1 -1
  33. package/models/fields.d.ts +4 -0
  34. package/package.json +15 -16
@@ -50,8 +50,6 @@ var _startOfYear = require("date-fns-jalali/startOfYear");
50
50
  var _isWithinInterval = require("date-fns-jalali/isWithinInterval");
51
51
  var _faIR = require("date-fns-jalali/locale/fa-IR");
52
52
  var _AdapterDateFnsBase = require("../AdapterDateFnsBase");
53
- /* eslint-disable class-methods-use-this */
54
-
55
53
  const defaultFormats = {
56
54
  year: 'yyyy',
57
55
  month: 'LLLL',
@@ -135,202 +133,203 @@ class AdapterDateFnsJalali extends _AdapterDateFnsBase.AdapterDateFnsBase {
135
133
  longFormatters: _format.longFormatters,
136
134
  lib: 'date-fns-jalali'
137
135
  });
138
- // TODO: explicit return types can be removed once there is only one date-fns version supported
139
- this.parse = (value, format) => {
140
- if (value === '') {
141
- return null;
142
- }
143
- return (0, _parse.parse)(value, format, new Date(), {
144
- locale: this.locale
145
- });
146
- };
147
- this.isValid = value => {
148
- if (value == null) {
149
- return false;
150
- }
151
- return (0, _isValid.isValid)(value);
152
- };
153
- this.format = (value, formatKey) => {
154
- return this.formatByString(value, this.formats[formatKey]);
155
- };
156
- this.formatByString = (value, formatString) => {
157
- return (0, _format.format)(value, formatString, {
158
- locale: this.locale
159
- });
160
- };
161
- this.formatNumber = numberToFormat => {
162
- return numberToFormat.replace(/\d/g, match => NUMBER_SYMBOL_MAP[match]).replace(/,/g, '،');
163
- };
164
- this.isEqual = (value, comparing) => {
165
- if (value === null && comparing === null) {
166
- return true;
167
- }
168
- if (value === null || comparing === null) {
169
- return false;
170
- }
171
- return (0, _isEqual.isEqual)(value, comparing);
172
- };
173
- this.isSameYear = (value, comparing) => {
174
- return (0, _isSameYear.isSameYear)(value, comparing);
175
- };
176
- this.isSameMonth = (value, comparing) => {
177
- return (0, _isSameMonth.isSameMonth)(value, comparing);
178
- };
179
- this.isSameDay = (value, comparing) => {
180
- return (0, _isSameDay.isSameDay)(value, comparing);
181
- };
182
- this.isSameHour = (value, comparing) => {
183
- return (0, _isSameHour.isSameHour)(value, comparing);
184
- };
185
- this.isAfter = (value, comparing) => {
186
- return (0, _isAfter.isAfter)(value, comparing);
187
- };
188
- this.isAfterYear = (value, comparing) => {
189
- return (0, _isAfter.isAfter)(value, this.endOfYear(comparing));
190
- };
191
- this.isAfterDay = (value, comparing) => {
192
- return (0, _isAfter.isAfter)(value, this.endOfDay(comparing));
193
- };
194
- this.isBefore = (value, comparing) => {
195
- return (0, _isBefore.isBefore)(value, comparing);
196
- };
197
- this.isBeforeYear = (value, comparing) => {
198
- return (0, _isBefore.isBefore)(value, this.startOfYear(comparing));
199
- };
200
- this.isBeforeDay = (value, comparing) => {
201
- return (0, _isBefore.isBefore)(value, this.startOfDay(comparing));
202
- };
203
- this.isWithinRange = (value, [start, end]) => {
204
- return (0, _isWithinInterval.isWithinInterval)(value, {
205
- start,
206
- end
207
- });
208
- };
209
- this.startOfYear = value => {
210
- return (0, _startOfYear.startOfYear)(value);
211
- };
212
- this.startOfMonth = value => {
213
- return (0, _startOfMonth.startOfMonth)(value);
214
- };
215
- this.startOfWeek = value => {
216
- return (0, _startOfWeek.startOfWeek)(value, {
217
- locale: this.locale
218
- });
219
- };
220
- this.startOfDay = value => {
221
- return (0, _startOfDay.startOfDay)(value);
222
- };
223
- this.endOfYear = value => {
224
- return (0, _endOfYear.endOfYear)(value);
225
- };
226
- this.endOfMonth = value => {
227
- return (0, _endOfMonth.endOfMonth)(value);
228
- };
229
- this.endOfWeek = value => {
230
- return (0, _endOfWeek.endOfWeek)(value, {
231
- locale: this.locale
232
- });
233
- };
234
- this.endOfDay = value => {
235
- return (0, _endOfDay.endOfDay)(value);
236
- };
237
- this.addYears = (value, amount) => {
238
- return (0, _addYears.addYears)(value, amount);
239
- };
240
- this.addMonths = (value, amount) => {
241
- return (0, _addMonths.addMonths)(value, amount);
242
- };
243
- this.addWeeks = (value, amount) => {
244
- return (0, _addWeeks.addWeeks)(value, amount);
245
- };
246
- this.addDays = (value, amount) => {
247
- return (0, _addDays.addDays)(value, amount);
248
- };
249
- this.addHours = (value, amount) => {
250
- return (0, _addHours.addHours)(value, amount);
251
- };
252
- this.addMinutes = (value, amount) => {
253
- return (0, _addMinutes.addMinutes)(value, amount);
254
- };
255
- this.addSeconds = (value, amount) => {
256
- return (0, _addSeconds.addSeconds)(value, amount);
257
- };
258
- this.getYear = value => {
259
- return (0, _getYear.getYear)(value);
260
- };
261
- this.getMonth = value => {
262
- return (0, _getMonth.getMonth)(value);
263
- };
264
- this.getDate = value => {
265
- return (0, _getDate.getDate)(value);
266
- };
267
- this.getHours = value => {
268
- return (0, _getHours.getHours)(value);
269
- };
270
- this.getMinutes = value => {
271
- return (0, _getMinutes.getMinutes)(value);
272
- };
273
- this.getSeconds = value => {
274
- return (0, _getSeconds.getSeconds)(value);
275
- };
276
- this.getMilliseconds = value => {
277
- return (0, _getMilliseconds.getMilliseconds)(value);
278
- };
279
- this.setYear = (value, year) => {
280
- return (0, _setYear.setYear)(value, year);
281
- };
282
- this.setMonth = (value, month) => {
283
- return (0, _setMonth.setMonth)(value, month);
284
- };
285
- this.setDate = (value, date) => {
286
- return (0, _setDate.setDate)(value, date);
287
- };
288
- this.setHours = (value, hours) => {
289
- return (0, _setHours.setHours)(value, hours);
290
- };
291
- this.setMinutes = (value, minutes) => {
292
- return (0, _setMinutes.setMinutes)(value, minutes);
293
- };
294
- this.setSeconds = (value, seconds) => {
295
- return (0, _setSeconds.setSeconds)(value, seconds);
296
- };
297
- this.setMilliseconds = (value, milliseconds) => {
298
- return (0, _setMilliseconds.setMilliseconds)(value, milliseconds);
299
- };
300
- this.getDaysInMonth = value => {
301
- return (0, _getDaysInMonth.getDaysInMonth)(value);
302
- };
303
- this.getWeekArray = value => {
304
- const start = this.startOfWeek(this.startOfMonth(value));
305
- const end = this.endOfWeek(this.endOfMonth(value));
306
- let count = 0;
307
- let current = start;
308
- const nestedWeeks = [];
309
- while (this.isBefore(current, end)) {
310
- const weekNumber = Math.floor(count / 7);
311
- nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];
312
- nestedWeeks[weekNumber].push(current);
313
- current = this.addDays(current, 1);
314
- count += 1;
315
- }
316
- return nestedWeeks;
317
- };
318
- this.getWeekNumber = date => {
319
- return (0, _getWeek.getWeek)(date, {
320
- locale: this.locale
321
- });
322
- };
323
- this.getYearRange = ([start, end]) => {
324
- const startDate = this.startOfYear(start);
325
- const endDate = this.endOfYear(end);
326
- const years = [];
327
- let current = startDate;
328
- while (this.isBefore(current, endDate)) {
329
- years.push(current);
330
- current = this.addYears(current, 1);
331
- }
332
- return years;
333
- };
334
136
  }
137
+
138
+ // TODO: explicit return types can be removed once there is only one date-fns version supported
139
+ parse = (value, format) => {
140
+ if (value === '') {
141
+ return null;
142
+ }
143
+ return (0, _parse.parse)(value, format, new Date(), {
144
+ locale: this.locale
145
+ });
146
+ };
147
+ isValid = value => {
148
+ if (value == null) {
149
+ return false;
150
+ }
151
+ return (0, _isValid.isValid)(value);
152
+ };
153
+ format = (value, formatKey) => {
154
+ return this.formatByString(value, this.formats[formatKey]);
155
+ };
156
+ formatByString = (value, formatString) => {
157
+ return (0, _format.format)(value, formatString, {
158
+ locale: this.locale
159
+ });
160
+ };
161
+ formatNumber = numberToFormat => {
162
+ return numberToFormat.replace(/\d/g, match => NUMBER_SYMBOL_MAP[match]).replace(/,/g, '،');
163
+ };
164
+ isEqual = (value, comparing) => {
165
+ if (value === null && comparing === null) {
166
+ return true;
167
+ }
168
+ if (value === null || comparing === null) {
169
+ return false;
170
+ }
171
+ return (0, _isEqual.isEqual)(value, comparing);
172
+ };
173
+ isSameYear = (value, comparing) => {
174
+ return (0, _isSameYear.isSameYear)(value, comparing);
175
+ };
176
+ isSameMonth = (value, comparing) => {
177
+ return (0, _isSameMonth.isSameMonth)(value, comparing);
178
+ };
179
+ isSameDay = (value, comparing) => {
180
+ return (0, _isSameDay.isSameDay)(value, comparing);
181
+ };
182
+ isSameHour = (value, comparing) => {
183
+ return (0, _isSameHour.isSameHour)(value, comparing);
184
+ };
185
+ isAfter = (value, comparing) => {
186
+ return (0, _isAfter.isAfter)(value, comparing);
187
+ };
188
+ isAfterYear = (value, comparing) => {
189
+ return (0, _isAfter.isAfter)(value, this.endOfYear(comparing));
190
+ };
191
+ isAfterDay = (value, comparing) => {
192
+ return (0, _isAfter.isAfter)(value, this.endOfDay(comparing));
193
+ };
194
+ isBefore = (value, comparing) => {
195
+ return (0, _isBefore.isBefore)(value, comparing);
196
+ };
197
+ isBeforeYear = (value, comparing) => {
198
+ return (0, _isBefore.isBefore)(value, this.startOfYear(comparing));
199
+ };
200
+ isBeforeDay = (value, comparing) => {
201
+ return (0, _isBefore.isBefore)(value, this.startOfDay(comparing));
202
+ };
203
+ isWithinRange = (value, [start, end]) => {
204
+ return (0, _isWithinInterval.isWithinInterval)(value, {
205
+ start,
206
+ end
207
+ });
208
+ };
209
+ startOfYear = value => {
210
+ return (0, _startOfYear.startOfYear)(value);
211
+ };
212
+ startOfMonth = value => {
213
+ return (0, _startOfMonth.startOfMonth)(value);
214
+ };
215
+ startOfWeek = value => {
216
+ return (0, _startOfWeek.startOfWeek)(value, {
217
+ locale: this.locale
218
+ });
219
+ };
220
+ startOfDay = value => {
221
+ return (0, _startOfDay.startOfDay)(value);
222
+ };
223
+ endOfYear = value => {
224
+ return (0, _endOfYear.endOfYear)(value);
225
+ };
226
+ endOfMonth = value => {
227
+ return (0, _endOfMonth.endOfMonth)(value);
228
+ };
229
+ endOfWeek = value => {
230
+ return (0, _endOfWeek.endOfWeek)(value, {
231
+ locale: this.locale
232
+ });
233
+ };
234
+ endOfDay = value => {
235
+ return (0, _endOfDay.endOfDay)(value);
236
+ };
237
+ addYears = (value, amount) => {
238
+ return (0, _addYears.addYears)(value, amount);
239
+ };
240
+ addMonths = (value, amount) => {
241
+ return (0, _addMonths.addMonths)(value, amount);
242
+ };
243
+ addWeeks = (value, amount) => {
244
+ return (0, _addWeeks.addWeeks)(value, amount);
245
+ };
246
+ addDays = (value, amount) => {
247
+ return (0, _addDays.addDays)(value, amount);
248
+ };
249
+ addHours = (value, amount) => {
250
+ return (0, _addHours.addHours)(value, amount);
251
+ };
252
+ addMinutes = (value, amount) => {
253
+ return (0, _addMinutes.addMinutes)(value, amount);
254
+ };
255
+ addSeconds = (value, amount) => {
256
+ return (0, _addSeconds.addSeconds)(value, amount);
257
+ };
258
+ getYear = value => {
259
+ return (0, _getYear.getYear)(value);
260
+ };
261
+ getMonth = value => {
262
+ return (0, _getMonth.getMonth)(value);
263
+ };
264
+ getDate = value => {
265
+ return (0, _getDate.getDate)(value);
266
+ };
267
+ getHours = value => {
268
+ return (0, _getHours.getHours)(value);
269
+ };
270
+ getMinutes = value => {
271
+ return (0, _getMinutes.getMinutes)(value);
272
+ };
273
+ getSeconds = value => {
274
+ return (0, _getSeconds.getSeconds)(value);
275
+ };
276
+ getMilliseconds = value => {
277
+ return (0, _getMilliseconds.getMilliseconds)(value);
278
+ };
279
+ setYear = (value, year) => {
280
+ return (0, _setYear.setYear)(value, year);
281
+ };
282
+ setMonth = (value, month) => {
283
+ return (0, _setMonth.setMonth)(value, month);
284
+ };
285
+ setDate = (value, date) => {
286
+ return (0, _setDate.setDate)(value, date);
287
+ };
288
+ setHours = (value, hours) => {
289
+ return (0, _setHours.setHours)(value, hours);
290
+ };
291
+ setMinutes = (value, minutes) => {
292
+ return (0, _setMinutes.setMinutes)(value, minutes);
293
+ };
294
+ setSeconds = (value, seconds) => {
295
+ return (0, _setSeconds.setSeconds)(value, seconds);
296
+ };
297
+ setMilliseconds = (value, milliseconds) => {
298
+ return (0, _setMilliseconds.setMilliseconds)(value, milliseconds);
299
+ };
300
+ getDaysInMonth = value => {
301
+ return (0, _getDaysInMonth.getDaysInMonth)(value);
302
+ };
303
+ getWeekArray = value => {
304
+ const start = this.startOfWeek(this.startOfMonth(value));
305
+ const end = this.endOfWeek(this.endOfMonth(value));
306
+ let count = 0;
307
+ let current = start;
308
+ const nestedWeeks = [];
309
+ while (this.isBefore(current, end)) {
310
+ const weekNumber = Math.floor(count / 7);
311
+ nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];
312
+ nestedWeeks[weekNumber].push(current);
313
+ current = this.addDays(current, 1);
314
+ count += 1;
315
+ }
316
+ return nestedWeeks;
317
+ };
318
+ getWeekNumber = date => {
319
+ return (0, _getWeek.getWeek)(date, {
320
+ locale: this.locale
321
+ });
322
+ };
323
+ getYearRange = ([start, end]) => {
324
+ const startDate = this.startOfYear(start);
325
+ const endDate = this.endOfYear(end);
326
+ const years = [];
327
+ let current = startDate;
328
+ while (this.isBefore(current, endDate)) {
329
+ years.push(current);
330
+ current = this.addYears(current, 1);
331
+ }
332
+ return years;
333
+ };
335
334
  }
336
335
  exports.AdapterDateFnsJalali = AdapterDateFnsJalali;