@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
@@ -1,5 +1,4 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
- /* eslint-disable class-methods-use-this */
3
2
  import { addSeconds } from 'date-fns-jalali/addSeconds';
4
3
  import { addMinutes } from 'date-fns-jalali/addMinutes';
5
4
  import { addHours } from 'date-fns-jalali/addHours';
@@ -127,201 +126,202 @@ export class AdapterDateFnsJalali extends AdapterDateFnsBase {
127
126
  longFormatters,
128
127
  lib: 'date-fns-jalali'
129
128
  });
130
- // TODO: explicit return types can be removed once there is only one date-fns version supported
131
- this.parse = (value, format) => {
132
- if (value === '') {
133
- return null;
134
- }
135
- return dateFnsParse(value, format, new Date(), {
136
- locale: this.locale
137
- });
138
- };
139
- this.isValid = value => {
140
- if (value == null) {
141
- return false;
142
- }
143
- return isValid(value);
144
- };
145
- this.format = (value, formatKey) => {
146
- return this.formatByString(value, this.formats[formatKey]);
147
- };
148
- this.formatByString = (value, formatString) => {
149
- return dateFnsFormat(value, formatString, {
150
- locale: this.locale
151
- });
152
- };
153
- this.formatNumber = numberToFormat => {
154
- return numberToFormat.replace(/\d/g, match => NUMBER_SYMBOL_MAP[match]).replace(/,/g, '،');
155
- };
156
- this.isEqual = (value, comparing) => {
157
- if (value === null && comparing === null) {
158
- return true;
159
- }
160
- if (value === null || comparing === null) {
161
- return false;
162
- }
163
- return isEqual(value, comparing);
164
- };
165
- this.isSameYear = (value, comparing) => {
166
- return isSameYear(value, comparing);
167
- };
168
- this.isSameMonth = (value, comparing) => {
169
- return isSameMonth(value, comparing);
170
- };
171
- this.isSameDay = (value, comparing) => {
172
- return isSameDay(value, comparing);
173
- };
174
- this.isSameHour = (value, comparing) => {
175
- return isSameHour(value, comparing);
176
- };
177
- this.isAfter = (value, comparing) => {
178
- return isAfter(value, comparing);
179
- };
180
- this.isAfterYear = (value, comparing) => {
181
- return isAfter(value, this.endOfYear(comparing));
182
- };
183
- this.isAfterDay = (value, comparing) => {
184
- return isAfter(value, this.endOfDay(comparing));
185
- };
186
- this.isBefore = (value, comparing) => {
187
- return isBefore(value, comparing);
188
- };
189
- this.isBeforeYear = (value, comparing) => {
190
- return isBefore(value, this.startOfYear(comparing));
191
- };
192
- this.isBeforeDay = (value, comparing) => {
193
- return isBefore(value, this.startOfDay(comparing));
194
- };
195
- this.isWithinRange = (value, [start, end]) => {
196
- return isWithinInterval(value, {
197
- start,
198
- end
199
- });
200
- };
201
- this.startOfYear = value => {
202
- return startOfYear(value);
203
- };
204
- this.startOfMonth = value => {
205
- return startOfMonth(value);
206
- };
207
- this.startOfWeek = value => {
208
- return startOfWeek(value, {
209
- locale: this.locale
210
- });
211
- };
212
- this.startOfDay = value => {
213
- return startOfDay(value);
214
- };
215
- this.endOfYear = value => {
216
- return endOfYear(value);
217
- };
218
- this.endOfMonth = value => {
219
- return endOfMonth(value);
220
- };
221
- this.endOfWeek = value => {
222
- return endOfWeek(value, {
223
- locale: this.locale
224
- });
225
- };
226
- this.endOfDay = value => {
227
- return endOfDay(value);
228
- };
229
- this.addYears = (value, amount) => {
230
- return addYears(value, amount);
231
- };
232
- this.addMonths = (value, amount) => {
233
- return addMonths(value, amount);
234
- };
235
- this.addWeeks = (value, amount) => {
236
- return addWeeks(value, amount);
237
- };
238
- this.addDays = (value, amount) => {
239
- return addDays(value, amount);
240
- };
241
- this.addHours = (value, amount) => {
242
- return addHours(value, amount);
243
- };
244
- this.addMinutes = (value, amount) => {
245
- return addMinutes(value, amount);
246
- };
247
- this.addSeconds = (value, amount) => {
248
- return addSeconds(value, amount);
249
- };
250
- this.getYear = value => {
251
- return getYear(value);
252
- };
253
- this.getMonth = value => {
254
- return getMonth(value);
255
- };
256
- this.getDate = value => {
257
- return getDate(value);
258
- };
259
- this.getHours = value => {
260
- return getHours(value);
261
- };
262
- this.getMinutes = value => {
263
- return getMinutes(value);
264
- };
265
- this.getSeconds = value => {
266
- return getSeconds(value);
267
- };
268
- this.getMilliseconds = value => {
269
- return getMilliseconds(value);
270
- };
271
- this.setYear = (value, year) => {
272
- return setYear(value, year);
273
- };
274
- this.setMonth = (value, month) => {
275
- return setMonth(value, month);
276
- };
277
- this.setDate = (value, date) => {
278
- return setDate(value, date);
279
- };
280
- this.setHours = (value, hours) => {
281
- return setHours(value, hours);
282
- };
283
- this.setMinutes = (value, minutes) => {
284
- return setMinutes(value, minutes);
285
- };
286
- this.setSeconds = (value, seconds) => {
287
- return setSeconds(value, seconds);
288
- };
289
- this.setMilliseconds = (value, milliseconds) => {
290
- return setMilliseconds(value, milliseconds);
291
- };
292
- this.getDaysInMonth = value => {
293
- return getDaysInMonth(value);
294
- };
295
- this.getWeekArray = value => {
296
- const start = this.startOfWeek(this.startOfMonth(value));
297
- const end = this.endOfWeek(this.endOfMonth(value));
298
- let count = 0;
299
- let current = start;
300
- const nestedWeeks = [];
301
- while (this.isBefore(current, end)) {
302
- const weekNumber = Math.floor(count / 7);
303
- nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];
304
- nestedWeeks[weekNumber].push(current);
305
- current = this.addDays(current, 1);
306
- count += 1;
307
- }
308
- return nestedWeeks;
309
- };
310
- this.getWeekNumber = date => {
311
- return getWeek(date, {
312
- locale: this.locale
313
- });
314
- };
315
- this.getYearRange = ([start, end]) => {
316
- const startDate = this.startOfYear(start);
317
- const endDate = this.endOfYear(end);
318
- const years = [];
319
- let current = startDate;
320
- while (this.isBefore(current, endDate)) {
321
- years.push(current);
322
- current = this.addYears(current, 1);
323
- }
324
- return years;
325
- };
326
129
  }
130
+
131
+ // TODO: explicit return types can be removed once there is only one date-fns version supported
132
+ parse = (value, format) => {
133
+ if (value === '') {
134
+ return null;
135
+ }
136
+ return dateFnsParse(value, format, new Date(), {
137
+ locale: this.locale
138
+ });
139
+ };
140
+ isValid = value => {
141
+ if (value == null) {
142
+ return false;
143
+ }
144
+ return isValid(value);
145
+ };
146
+ format = (value, formatKey) => {
147
+ return this.formatByString(value, this.formats[formatKey]);
148
+ };
149
+ formatByString = (value, formatString) => {
150
+ return dateFnsFormat(value, formatString, {
151
+ locale: this.locale
152
+ });
153
+ };
154
+ formatNumber = numberToFormat => {
155
+ return numberToFormat.replace(/\d/g, match => NUMBER_SYMBOL_MAP[match]).replace(/,/g, '،');
156
+ };
157
+ isEqual = (value, comparing) => {
158
+ if (value === null && comparing === null) {
159
+ return true;
160
+ }
161
+ if (value === null || comparing === null) {
162
+ return false;
163
+ }
164
+ return isEqual(value, comparing);
165
+ };
166
+ isSameYear = (value, comparing) => {
167
+ return isSameYear(value, comparing);
168
+ };
169
+ isSameMonth = (value, comparing) => {
170
+ return isSameMonth(value, comparing);
171
+ };
172
+ isSameDay = (value, comparing) => {
173
+ return isSameDay(value, comparing);
174
+ };
175
+ isSameHour = (value, comparing) => {
176
+ return isSameHour(value, comparing);
177
+ };
178
+ isAfter = (value, comparing) => {
179
+ return isAfter(value, comparing);
180
+ };
181
+ isAfterYear = (value, comparing) => {
182
+ return isAfter(value, this.endOfYear(comparing));
183
+ };
184
+ isAfterDay = (value, comparing) => {
185
+ return isAfter(value, this.endOfDay(comparing));
186
+ };
187
+ isBefore = (value, comparing) => {
188
+ return isBefore(value, comparing);
189
+ };
190
+ isBeforeYear = (value, comparing) => {
191
+ return isBefore(value, this.startOfYear(comparing));
192
+ };
193
+ isBeforeDay = (value, comparing) => {
194
+ return isBefore(value, this.startOfDay(comparing));
195
+ };
196
+ isWithinRange = (value, [start, end]) => {
197
+ return isWithinInterval(value, {
198
+ start,
199
+ end
200
+ });
201
+ };
202
+ startOfYear = value => {
203
+ return startOfYear(value);
204
+ };
205
+ startOfMonth = value => {
206
+ return startOfMonth(value);
207
+ };
208
+ startOfWeek = value => {
209
+ return startOfWeek(value, {
210
+ locale: this.locale
211
+ });
212
+ };
213
+ startOfDay = value => {
214
+ return startOfDay(value);
215
+ };
216
+ endOfYear = value => {
217
+ return endOfYear(value);
218
+ };
219
+ endOfMonth = value => {
220
+ return endOfMonth(value);
221
+ };
222
+ endOfWeek = value => {
223
+ return endOfWeek(value, {
224
+ locale: this.locale
225
+ });
226
+ };
227
+ endOfDay = value => {
228
+ return endOfDay(value);
229
+ };
230
+ addYears = (value, amount) => {
231
+ return addYears(value, amount);
232
+ };
233
+ addMonths = (value, amount) => {
234
+ return addMonths(value, amount);
235
+ };
236
+ addWeeks = (value, amount) => {
237
+ return addWeeks(value, amount);
238
+ };
239
+ addDays = (value, amount) => {
240
+ return addDays(value, amount);
241
+ };
242
+ addHours = (value, amount) => {
243
+ return addHours(value, amount);
244
+ };
245
+ addMinutes = (value, amount) => {
246
+ return addMinutes(value, amount);
247
+ };
248
+ addSeconds = (value, amount) => {
249
+ return addSeconds(value, amount);
250
+ };
251
+ getYear = value => {
252
+ return getYear(value);
253
+ };
254
+ getMonth = value => {
255
+ return getMonth(value);
256
+ };
257
+ getDate = value => {
258
+ return getDate(value);
259
+ };
260
+ getHours = value => {
261
+ return getHours(value);
262
+ };
263
+ getMinutes = value => {
264
+ return getMinutes(value);
265
+ };
266
+ getSeconds = value => {
267
+ return getSeconds(value);
268
+ };
269
+ getMilliseconds = value => {
270
+ return getMilliseconds(value);
271
+ };
272
+ setYear = (value, year) => {
273
+ return setYear(value, year);
274
+ };
275
+ setMonth = (value, month) => {
276
+ return setMonth(value, month);
277
+ };
278
+ setDate = (value, date) => {
279
+ return setDate(value, date);
280
+ };
281
+ setHours = (value, hours) => {
282
+ return setHours(value, hours);
283
+ };
284
+ setMinutes = (value, minutes) => {
285
+ return setMinutes(value, minutes);
286
+ };
287
+ setSeconds = (value, seconds) => {
288
+ return setSeconds(value, seconds);
289
+ };
290
+ setMilliseconds = (value, milliseconds) => {
291
+ return setMilliseconds(value, milliseconds);
292
+ };
293
+ getDaysInMonth = value => {
294
+ return getDaysInMonth(value);
295
+ };
296
+ getWeekArray = value => {
297
+ const start = this.startOfWeek(this.startOfMonth(value));
298
+ const end = this.endOfWeek(this.endOfMonth(value));
299
+ let count = 0;
300
+ let current = start;
301
+ const nestedWeeks = [];
302
+ while (this.isBefore(current, end)) {
303
+ const weekNumber = Math.floor(count / 7);
304
+ nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];
305
+ nestedWeeks[weekNumber].push(current);
306
+ current = this.addDays(current, 1);
307
+ count += 1;
308
+ }
309
+ return nestedWeeks;
310
+ };
311
+ getWeekNumber = date => {
312
+ return getWeek(date, {
313
+ locale: this.locale
314
+ });
315
+ };
316
+ getYearRange = ([start, end]) => {
317
+ const startDate = this.startOfYear(start);
318
+ const endDate = this.endOfYear(end);
319
+ const years = [];
320
+ let current = startDate;
321
+ while (this.isBefore(current, endDate)) {
322
+ years.push(current);
323
+ current = this.addYears(current, 1);
324
+ }
325
+ return years;
326
+ };
327
327
  }