@mui/x-date-pickers 6.3.1 → 6.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AdapterDateFns/AdapterDateFns.d.ts +3 -7
- package/AdapterDateFns/AdapterDateFns.js +2 -8
- package/AdapterDateFnsJalali/AdapterDateFnsJalali.d.ts +3 -7
- package/AdapterDateFnsJalali/AdapterDateFnsJalali.js +2 -8
- package/AdapterDayjs/AdapterDayjs.d.ts +3 -9
- package/AdapterDayjs/AdapterDayjs.js +2 -3
- package/AdapterLuxon/AdapterLuxon.d.ts +3 -8
- package/AdapterLuxon/AdapterLuxon.js +6 -5
- package/AdapterMoment/AdapterMoment.d.ts +3 -9
- package/AdapterMoment/AdapterMoment.js +2 -2
- package/AdapterMomentHijri/AdapterMomentHijri.d.ts +5 -14
- package/AdapterMomentHijri/AdapterMomentHijri.js +4 -10
- package/AdapterMomentJalaali/AdapterMomentJalaali.d.ts +6 -16
- package/AdapterMomentJalaali/AdapterMomentJalaali.js +15 -12
- package/CHANGELOG.md +57 -0
- package/DateCalendar/DateCalendar.js +2 -2
- package/DateCalendar/DayCalendar.js +11 -10
- package/DateCalendar/PickersCalendarHeader.js +2 -2
- package/DateCalendar/useCalendarState.d.ts +1 -1
- package/DatePicker/shared.d.ts +1 -1
- package/LocalizationProvider/LocalizationProvider.d.ts +10 -8
- package/LocalizationProvider/LocalizationProvider.js +3 -3
- package/MonthCalendar/MonthCalendar.js +2 -2
- package/index.js +1 -1
- package/internals/hooks/useField/useField.utils.d.ts +13 -13
- package/internals/hooks/useField/useField.utils.js +3 -2
- package/internals/hooks/useUtils.d.ts +1 -1
- package/internals/utils/date-utils.d.ts +6 -4
- package/internals/utils/date-utils.js +16 -0
- package/internals/utils/time-utils.d.ts +4 -4
- package/internals/utils/validation/extractValidationProps.d.ts +1 -1
- package/legacy/AdapterDateFns/AdapterDateFns.js +2 -8
- package/legacy/AdapterDateFnsJalali/AdapterDateFnsJalali.js +2 -8
- package/legacy/AdapterDayjs/AdapterDayjs.js +2 -3
- package/legacy/AdapterLuxon/AdapterLuxon.js +6 -5
- package/legacy/AdapterMoment/AdapterMoment.js +2 -2
- package/legacy/AdapterMomentHijri/AdapterMomentHijri.js +4 -10
- package/legacy/AdapterMomentJalaali/AdapterMomentJalaali.js +15 -12
- package/legacy/DateCalendar/DateCalendar.js +2 -2
- package/legacy/DateCalendar/DayCalendar.js +11 -10
- package/legacy/DateCalendar/PickersCalendarHeader.js +2 -2
- package/legacy/LocalizationProvider/LocalizationProvider.js +3 -3
- package/legacy/MonthCalendar/MonthCalendar.js +2 -2
- package/legacy/index.js +1 -1
- package/legacy/internals/hooks/useField/useField.utils.js +5 -4
- package/legacy/internals/utils/date-utils.js +16 -0
- package/legacy/locales/csCZ.js +3 -3
- package/legacy/locales/index.js +1 -0
- package/legacy/locales/skSK.js +93 -0
- package/legacy/locales/ukUA.js +3 -1
- package/legacy/tests/describeGregorianAdapter/describeGregorianAdapter.js +2 -7
- package/legacy/tests/describeGregorianAdapter/describeGregorianAdapter.utils.js +2 -0
- package/legacy/tests/describeGregorianAdapter/index.js +2 -1
- package/legacy/tests/describeGregorianAdapter/testCalculations.js +272 -200
- package/legacy/tests/describeGregorianAdapter/testLocalization.js +34 -0
- package/legacy/tests/describeHijriAdapter/describeHijriAdapter.js +1 -3
- package/legacy/tests/describeHijriAdapter/testCalculations.js +101 -28
- package/legacy/tests/describeHijriAdapter/testLocalization.js +8 -0
- package/legacy/tests/describeJalaliAdapter/describeJalaliAdapter.js +2 -6
- package/legacy/tests/describeJalaliAdapter/testCalculations.js +157 -24
- package/legacy/tests/describeJalaliAdapter/testLocalization.js +8 -0
- package/locales/beBY.d.ts +3 -3
- package/locales/caES.d.ts +3 -3
- package/locales/csCZ.d.ts +3 -3
- package/locales/csCZ.js +3 -3
- package/locales/daDK.d.ts +3 -3
- package/locales/deDE.d.ts +3 -3
- package/locales/enUS.d.ts +3 -3
- package/locales/esES.d.ts +3 -3
- package/locales/faIR.d.ts +3 -3
- package/locales/fiFI.d.ts +3 -3
- package/locales/frFR.d.ts +3 -3
- package/locales/heIL.d.ts +3 -3
- package/locales/huHU.d.ts +3 -3
- package/locales/index.d.ts +1 -0
- package/locales/index.js +1 -0
- package/locales/isIS.d.ts +3 -3
- package/locales/itIT.d.ts +3 -3
- package/locales/jaJP.d.ts +3 -3
- package/locales/koKR.d.ts +3 -3
- package/locales/kzKZ.d.ts +3 -3
- package/locales/nbNO.d.ts +3 -3
- package/locales/nlNL.d.ts +3 -3
- package/locales/plPL.d.ts +3 -3
- package/locales/ptBR.d.ts +3 -3
- package/locales/ruRU.d.ts +3 -3
- package/locales/skSK.d.ts +53 -0
- package/locales/skSK.js +61 -0
- package/locales/svSE.d.ts +3 -3
- package/locales/trTR.d.ts +3 -3
- package/locales/ukUA.d.ts +3 -3
- package/locales/ukUA.js +1 -1
- package/locales/urPK.d.ts +3 -3
- package/locales/utils/getPickersLocalization.d.ts +3 -3
- package/locales/zhCN.d.ts +3 -3
- package/models/adapters.d.ts +43 -35
- package/modern/AdapterDateFns/AdapterDateFns.js +2 -8
- package/modern/AdapterDateFnsJalali/AdapterDateFnsJalali.js +2 -8
- package/modern/AdapterDayjs/AdapterDayjs.js +2 -2
- package/modern/AdapterLuxon/AdapterLuxon.js +6 -5
- package/modern/AdapterMoment/AdapterMoment.js +2 -2
- package/modern/AdapterMomentHijri/AdapterMomentHijri.js +4 -10
- package/modern/AdapterMomentJalaali/AdapterMomentJalaali.js +15 -12
- package/modern/DateCalendar/DateCalendar.js +2 -2
- package/modern/DateCalendar/DayCalendar.js +11 -10
- package/modern/DateCalendar/PickersCalendarHeader.js +2 -2
- package/modern/LocalizationProvider/LocalizationProvider.js +3 -3
- package/modern/MonthCalendar/MonthCalendar.js +2 -2
- package/modern/index.js +1 -1
- package/modern/internals/hooks/useField/useField.utils.js +3 -2
- package/modern/internals/utils/date-utils.js +16 -0
- package/modern/locales/csCZ.js +3 -3
- package/modern/locales/index.js +1 -0
- package/modern/locales/skSK.js +58 -0
- package/modern/locales/ukUA.js +1 -1
- package/modern/tests/describeGregorianAdapter/describeGregorianAdapter.js +2 -7
- package/modern/tests/describeGregorianAdapter/describeGregorianAdapter.utils.js +2 -0
- package/modern/tests/describeGregorianAdapter/index.js +2 -1
- package/modern/tests/describeGregorianAdapter/testCalculations.js +272 -198
- package/modern/tests/describeGregorianAdapter/testLocalization.js +34 -0
- package/modern/tests/describeHijriAdapter/describeHijriAdapter.js +1 -3
- package/modern/tests/describeHijriAdapter/testCalculations.js +101 -28
- package/modern/tests/describeHijriAdapter/testLocalization.js +8 -0
- package/modern/tests/describeJalaliAdapter/describeJalaliAdapter.js +2 -6
- package/modern/tests/describeJalaliAdapter/testCalculations.js +157 -24
- package/modern/tests/describeJalaliAdapter/testLocalization.js +8 -0
- package/node/AdapterDateFns/AdapterDateFns.js +2 -8
- package/node/AdapterDateFnsJalali/AdapterDateFnsJalali.js +2 -8
- package/node/AdapterDayjs/AdapterDayjs.js +2 -2
- package/node/AdapterLuxon/AdapterLuxon.js +6 -5
- package/node/AdapterMoment/AdapterMoment.js +2 -2
- package/node/AdapterMomentHijri/AdapterMomentHijri.js +4 -10
- package/node/AdapterMomentJalaali/AdapterMomentJalaali.js +15 -12
- package/node/DateCalendar/DateCalendar.js +1 -1
- package/node/DateCalendar/DayCalendar.js +11 -10
- package/node/DateCalendar/PickersCalendarHeader.js +2 -2
- package/node/LocalizationProvider/LocalizationProvider.js +5 -5
- package/node/MonthCalendar/MonthCalendar.js +1 -1
- package/node/index.js +1 -1
- package/node/internals/hooks/useField/useField.utils.js +3 -2
- package/node/internals/utils/date-utils.js +20 -2
- package/node/locales/csCZ.js +3 -3
- package/node/locales/index.js +11 -0
- package/node/locales/skSK.js +65 -0
- package/node/locales/ukUA.js +1 -1
- package/node/tests/describeGregorianAdapter/describeGregorianAdapter.js +3 -9
- package/node/tests/describeGregorianAdapter/describeGregorianAdapter.utils.js +10 -0
- package/node/tests/describeGregorianAdapter/index.js +4 -3
- package/node/tests/describeGregorianAdapter/testCalculations.js +272 -198
- package/node/tests/describeGregorianAdapter/testLocalization.js +35 -0
- package/node/tests/describeHijriAdapter/describeHijriAdapter.js +1 -3
- package/node/tests/describeHijriAdapter/testCalculations.js +100 -27
- package/node/tests/describeHijriAdapter/testLocalization.js +8 -0
- package/node/tests/describeJalaliAdapter/describeJalaliAdapter.js +2 -6
- package/node/tests/describeJalaliAdapter/testCalculations.js +156 -23
- package/node/tests/describeJalaliAdapter/testLocalization.js +8 -0
- package/package.json +1 -1
- package/tests/describeGregorianAdapter/describeGregorianAdapter.js +2 -7
- package/tests/describeGregorianAdapter/describeGregorianAdapter.utils.js +2 -0
- package/tests/describeGregorianAdapter/index.js +2 -1
- package/tests/describeGregorianAdapter/testCalculations.js +272 -198
- package/tests/describeGregorianAdapter/testLocalization.js +34 -0
- package/tests/describeHijriAdapter/describeHijriAdapter.js +1 -3
- package/tests/describeHijriAdapter/testCalculations.js +101 -28
- package/tests/describeHijriAdapter/testLocalization.js +8 -0
- package/tests/describeJalaliAdapter/describeJalaliAdapter.js +2 -6
- package/tests/describeJalaliAdapter/testCalculations.js +157 -24
- package/tests/describeJalaliAdapter/testLocalization.js +8 -0
- package/themeAugmentation/props.d.ts +1 -1
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import defaultLocale from 'date-fns/locale/en-US';
|
|
2
|
-
import { AdapterFormats, AdapterUnits, FieldFormatTokenMap, MuiPickersAdapter } from '../models';
|
|
2
|
+
import { AdapterFormats, AdapterOptions, AdapterUnits, FieldFormatTokenMap, MuiPickersAdapter } from '../models';
|
|
3
3
|
type DateFnsLocale = typeof defaultLocale;
|
|
4
|
-
interface AdapterDateFnsOptions {
|
|
5
|
-
locale?: DateFnsLocale;
|
|
6
|
-
formats?: Partial<AdapterFormats>;
|
|
7
|
-
}
|
|
8
4
|
/**
|
|
9
5
|
* Based on `@date-io/date-fns`
|
|
10
6
|
*
|
|
@@ -30,7 +26,7 @@ interface AdapterDateFnsOptions {
|
|
|
30
26
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
31
27
|
* SOFTWARE.
|
|
32
28
|
*/
|
|
33
|
-
export declare class AdapterDateFns implements MuiPickersAdapter<Date> {
|
|
29
|
+
export declare class AdapterDateFns implements MuiPickersAdapter<Date, DateFnsLocale> {
|
|
34
30
|
isMUIAdapter: boolean;
|
|
35
31
|
lib: string;
|
|
36
32
|
locale?: DateFnsLocale;
|
|
@@ -40,7 +36,7 @@ export declare class AdapterDateFns implements MuiPickersAdapter<Date> {
|
|
|
40
36
|
start: string;
|
|
41
37
|
end: string;
|
|
42
38
|
};
|
|
43
|
-
constructor({ locale, formats }?:
|
|
39
|
+
constructor({ locale, formats }?: AdapterOptions<DateFnsLocale, never>);
|
|
44
40
|
date: (value?: any) => Date | null;
|
|
45
41
|
toJsDate: (value: Date) => Date;
|
|
46
42
|
parseISO: (isoString: string) => Date;
|
|
@@ -22,7 +22,6 @@ import endOfWeek from 'date-fns/endOfWeek';
|
|
|
22
22
|
import endOfYear from 'date-fns/endOfYear';
|
|
23
23
|
import dateFnsFormat from 'date-fns/format';
|
|
24
24
|
import getDate from 'date-fns/getDate';
|
|
25
|
-
import getDay from 'date-fns/getDay';
|
|
26
25
|
import getDaysInMonth from 'date-fns/getDaysInMonth';
|
|
27
26
|
import getHours from 'date-fns/getHours';
|
|
28
27
|
import getMinutes from 'date-fns/getMinutes';
|
|
@@ -559,17 +558,12 @@ export class AdapterDateFns {
|
|
|
559
558
|
let count = 0;
|
|
560
559
|
let current = start;
|
|
561
560
|
const nestedWeeks = [];
|
|
562
|
-
let lastDay = null;
|
|
563
561
|
while (isBefore(current, end)) {
|
|
564
562
|
const weekNumber = Math.floor(count / 7);
|
|
565
563
|
nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];
|
|
566
|
-
|
|
567
|
-
if (lastDay !== day) {
|
|
568
|
-
lastDay = day;
|
|
569
|
-
nestedWeeks[weekNumber].push(current);
|
|
570
|
-
count += 1;
|
|
571
|
-
}
|
|
564
|
+
nestedWeeks[weekNumber].push(current);
|
|
572
565
|
current = addDays(current, 1);
|
|
566
|
+
count += 1;
|
|
573
567
|
}
|
|
574
568
|
return nestedWeeks;
|
|
575
569
|
};
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import defaultLocale from 'date-fns-jalali/locale/fa-IR';
|
|
2
|
-
import { AdapterFormats, AdapterUnits, FieldFormatTokenMap, MuiPickersAdapter } from '../models';
|
|
2
|
+
import { AdapterFormats, AdapterOptions, AdapterUnits, FieldFormatTokenMap, MuiPickersAdapter } from '../models';
|
|
3
3
|
type DateFnsLocale = typeof defaultLocale;
|
|
4
|
-
interface AdapterDateFnsJalaliOptions {
|
|
5
|
-
locale?: DateFnsLocale;
|
|
6
|
-
formats?: Partial<AdapterFormats>;
|
|
7
|
-
}
|
|
8
4
|
/**
|
|
9
5
|
* Based on `@date-io/date-fns-jalali`
|
|
10
6
|
*
|
|
@@ -30,7 +26,7 @@ interface AdapterDateFnsJalaliOptions {
|
|
|
30
26
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
31
27
|
* SOFTWARE.
|
|
32
28
|
*/
|
|
33
|
-
export declare class AdapterDateFnsJalali implements MuiPickersAdapter<Date> {
|
|
29
|
+
export declare class AdapterDateFnsJalali implements MuiPickersAdapter<Date, DateFnsLocale> {
|
|
34
30
|
isMUIAdapter: boolean;
|
|
35
31
|
lib: string;
|
|
36
32
|
locale?: DateFnsLocale;
|
|
@@ -40,7 +36,7 @@ export declare class AdapterDateFnsJalali implements MuiPickersAdapter<Date> {
|
|
|
40
36
|
start: string;
|
|
41
37
|
end: string;
|
|
42
38
|
};
|
|
43
|
-
constructor({ locale, formats }?:
|
|
39
|
+
constructor({ locale, formats }?: AdapterOptions<DateFnsLocale, never>);
|
|
44
40
|
date: (value?: any) => Date | null;
|
|
45
41
|
toJsDate: (value: Date) => Date;
|
|
46
42
|
parseISO: (isoString: string) => Date;
|
|
@@ -28,7 +28,6 @@ import getWeek from 'date-fns-jalali/getWeek';
|
|
|
28
28
|
import getYear from 'date-fns-jalali/getYear';
|
|
29
29
|
import getMonth from 'date-fns-jalali/getMonth';
|
|
30
30
|
import getDate from 'date-fns-jalali/getDate';
|
|
31
|
-
import getDay from 'date-fns-jalali/getDay';
|
|
32
31
|
import getDaysInMonth from 'date-fns-jalali/getDaysInMonth';
|
|
33
32
|
import getMinutes from 'date-fns-jalali/getMinutes';
|
|
34
33
|
import isAfter from 'date-fns-jalali/isAfter';
|
|
@@ -571,17 +570,12 @@ export class AdapterDateFnsJalali {
|
|
|
571
570
|
let count = 0;
|
|
572
571
|
let current = start;
|
|
573
572
|
const nestedWeeks = [];
|
|
574
|
-
let lastDay = null;
|
|
575
573
|
while (isBefore(current, end)) {
|
|
576
574
|
const weekNumber = Math.floor(count / 7);
|
|
577
575
|
nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];
|
|
578
|
-
|
|
579
|
-
if (lastDay !== day) {
|
|
580
|
-
lastDay = day;
|
|
581
|
-
nestedWeeks[weekNumber].push(current);
|
|
582
|
-
count += 1;
|
|
583
|
-
}
|
|
576
|
+
nestedWeeks[weekNumber].push(current);
|
|
584
577
|
current = addDays(current, 1);
|
|
578
|
+
count += 1;
|
|
585
579
|
}
|
|
586
580
|
return nestedWeeks;
|
|
587
581
|
};
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import defaultDayjs, { Dayjs } from 'dayjs';
|
|
2
|
-
import { FieldFormatTokenMap, MuiPickersAdapter, AdapterFormats, AdapterUnits } from '../models';
|
|
3
|
-
interface AdapterDayjsOptions {
|
|
4
|
-
locale?: string;
|
|
5
|
-
/** Make sure that your dayjs instance extends customParseFormat and advancedFormat */
|
|
6
|
-
instance?: typeof defaultDayjs;
|
|
7
|
-
formats?: Partial<AdapterFormats>;
|
|
8
|
-
}
|
|
2
|
+
import { FieldFormatTokenMap, MuiPickersAdapter, AdapterFormats, AdapterUnits, AdapterOptions } from '../models';
|
|
9
3
|
type Constructor = (...args: Parameters<typeof defaultDayjs>) => Dayjs;
|
|
10
4
|
/**
|
|
11
5
|
* Based on `@date-io/dayjs`
|
|
@@ -32,7 +26,7 @@ type Constructor = (...args: Parameters<typeof defaultDayjs>) => Dayjs;
|
|
|
32
26
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
33
27
|
* SOFTWARE.
|
|
34
28
|
*/
|
|
35
|
-
export declare class AdapterDayjs implements MuiPickersAdapter<Dayjs> {
|
|
29
|
+
export declare class AdapterDayjs implements MuiPickersAdapter<Dayjs, string> {
|
|
36
30
|
isMUIAdapter: boolean;
|
|
37
31
|
lib: string;
|
|
38
32
|
rawDayJsInstance: typeof defaultDayjs;
|
|
@@ -44,7 +38,7 @@ export declare class AdapterDayjs implements MuiPickersAdapter<Dayjs> {
|
|
|
44
38
|
end: string;
|
|
45
39
|
};
|
|
46
40
|
formatTokenMap: FieldFormatTokenMap;
|
|
47
|
-
constructor({ locale, formats, instance }?:
|
|
41
|
+
constructor({ locale, formats, instance }?: AdapterOptions<string, typeof defaultDayjs>);
|
|
48
42
|
private getLocaleFormats;
|
|
49
43
|
date: (value?: any) => defaultDayjs.Dayjs | null;
|
|
50
44
|
toJsDate: (value: Dayjs) => Date;
|
|
@@ -167,8 +167,7 @@ export class AdapterDayjs {
|
|
|
167
167
|
};
|
|
168
168
|
this.formatTokenMap = formatTokenMap;
|
|
169
169
|
this.getLocaleFormats = () => {
|
|
170
|
-
|
|
171
|
-
const locales = (_this$rawDayJsInstanc = this.rawDayJsInstance.Ls) != null ? _this$rawDayJsInstanc : defaultDayjs.Ls;
|
|
170
|
+
const locales = defaultDayjs.Ls;
|
|
172
171
|
const locale = this.locale || 'en';
|
|
173
172
|
let localeObject = locales[locale];
|
|
174
173
|
if (localeObject === undefined) {
|
|
@@ -370,7 +369,7 @@ export class AdapterDayjs {
|
|
|
370
369
|
const monthArray = [firstMonth];
|
|
371
370
|
while (monthArray.length < 12) {
|
|
372
371
|
const prevMonth = monthArray[monthArray.length - 1];
|
|
373
|
-
monthArray.push(this.
|
|
372
|
+
monthArray.push(this.addMonths(prevMonth, 1));
|
|
374
373
|
}
|
|
375
374
|
return monthArray;
|
|
376
375
|
};
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { DateTime } from 'luxon';
|
|
2
|
-
import { AdapterFormats, AdapterUnits, FieldFormatTokenMap, MuiPickersAdapter } from '../models';
|
|
3
|
-
interface AdapterLuxonOptions {
|
|
4
|
-
formats?: Partial<AdapterFormats>;
|
|
5
|
-
locale?: string;
|
|
6
|
-
}
|
|
2
|
+
import { AdapterFormats, AdapterOptions, AdapterUnits, FieldFormatTokenMap, MuiPickersAdapter } from '../models';
|
|
7
3
|
/**
|
|
8
4
|
* Based on `@date-io/luxon`
|
|
9
5
|
*
|
|
@@ -29,7 +25,7 @@ interface AdapterLuxonOptions {
|
|
|
29
25
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
30
26
|
* SOFTWARE.
|
|
31
27
|
*/
|
|
32
|
-
export declare class AdapterLuxon implements MuiPickersAdapter<DateTime> {
|
|
28
|
+
export declare class AdapterLuxon implements MuiPickersAdapter<DateTime, string> {
|
|
33
29
|
isMUIAdapter: boolean;
|
|
34
30
|
lib: string;
|
|
35
31
|
locale: string;
|
|
@@ -39,7 +35,7 @@ export declare class AdapterLuxon implements MuiPickersAdapter<DateTime> {
|
|
|
39
35
|
end: string;
|
|
40
36
|
};
|
|
41
37
|
formatTokenMap: FieldFormatTokenMap;
|
|
42
|
-
constructor({ locale, formats }?:
|
|
38
|
+
constructor({ locale, formats }?: AdapterOptions<string, never>);
|
|
43
39
|
date: (value?: any) => DateTime | null;
|
|
44
40
|
toJsDate: (value: DateTime) => Date;
|
|
45
41
|
parseISO: (isoString: string) => DateTime;
|
|
@@ -105,4 +101,3 @@ export declare class AdapterLuxon implements MuiPickersAdapter<DateTime> {
|
|
|
105
101
|
getYearRange: (start: DateTime, end: DateTime) => DateTime[];
|
|
106
102
|
getMeridiemText: (ampm: 'am' | 'pm') => string;
|
|
107
103
|
}
|
|
108
|
-
export {};
|
|
@@ -9,7 +9,11 @@ const formatTokenMap = {
|
|
|
9
9
|
maxLength: 4
|
|
10
10
|
},
|
|
11
11
|
yy: 'year',
|
|
12
|
-
yyyy:
|
|
12
|
+
yyyy: {
|
|
13
|
+
sectionType: 'year',
|
|
14
|
+
contentType: 'digit',
|
|
15
|
+
maxLength: 4
|
|
16
|
+
},
|
|
13
17
|
// Month
|
|
14
18
|
L: {
|
|
15
19
|
sectionType: 'month',
|
|
@@ -228,9 +232,6 @@ export class AdapterLuxon {
|
|
|
228
232
|
})) == null ? void 0 : (_Intl$DateTimeFormat$ = _Intl$DateTimeFormat.resolvedOptions()) == null ? void 0 : _Intl$DateTimeFormat$.hour12);
|
|
229
233
|
};
|
|
230
234
|
this.expandFormat = format => {
|
|
231
|
-
if (!DateTime.expandFormat) {
|
|
232
|
-
throw Error('Your luxon version does not support `expandFormat`. Consider upgrading it to v3.0.2');
|
|
233
|
-
}
|
|
234
235
|
// Extract escaped section to avoid extending them
|
|
235
236
|
const longFormatRegexp = /''|'(''|[^'])+('|$)|[^']*/g;
|
|
236
237
|
return format.match(longFormatRegexp).map(token => {
|
|
@@ -454,7 +455,7 @@ export class AdapterLuxon {
|
|
|
454
455
|
const monthArray = [firstMonth];
|
|
455
456
|
while (monthArray.length < 12) {
|
|
456
457
|
const prevMonth = monthArray[monthArray.length - 1];
|
|
457
|
-
monthArray.push(this.
|
|
458
|
+
monthArray.push(this.addMonths(prevMonth, 1));
|
|
458
459
|
}
|
|
459
460
|
return monthArray;
|
|
460
461
|
};
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import defaultMoment, { Moment } from 'moment';
|
|
2
|
-
import { AdapterFormats, AdapterUnits, FieldFormatTokenMap, MuiPickersAdapter } from '../models';
|
|
3
|
-
interface AdapterMomentOptions {
|
|
4
|
-
locale?: string;
|
|
5
|
-
instance?: typeof defaultMoment;
|
|
6
|
-
formats?: Partial<AdapterFormats>;
|
|
7
|
-
}
|
|
2
|
+
import { AdapterFormats, AdapterOptions, AdapterUnits, FieldFormatTokenMap, MuiPickersAdapter } from '../models';
|
|
8
3
|
/**
|
|
9
4
|
* Based on `@date-io/moment`
|
|
10
5
|
*
|
|
@@ -30,7 +25,7 @@ interface AdapterMomentOptions {
|
|
|
30
25
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
31
26
|
* SOFTWARE.
|
|
32
27
|
*/
|
|
33
|
-
export declare class AdapterMoment implements MuiPickersAdapter<Moment> {
|
|
28
|
+
export declare class AdapterMoment implements MuiPickersAdapter<Moment, string> {
|
|
34
29
|
isMUIAdapter: boolean;
|
|
35
30
|
lib: string;
|
|
36
31
|
moment: typeof defaultMoment;
|
|
@@ -41,7 +36,7 @@ export declare class AdapterMoment implements MuiPickersAdapter<Moment> {
|
|
|
41
36
|
end: string;
|
|
42
37
|
};
|
|
43
38
|
formatTokenMap: FieldFormatTokenMap;
|
|
44
|
-
constructor({ locale, formats, instance }?:
|
|
39
|
+
constructor({ locale, formats, instance }?: AdapterOptions<string, typeof defaultMoment>);
|
|
45
40
|
date: (value?: any) => defaultMoment.Moment | null;
|
|
46
41
|
toJsDate: (value: Moment) => Date;
|
|
47
42
|
parseISO: (isoString: string) => defaultMoment.Moment;
|
|
@@ -107,4 +102,3 @@ export declare class AdapterMoment implements MuiPickersAdapter<Moment> {
|
|
|
107
102
|
getYearRange: (start: Moment, end: Moment) => defaultMoment.Moment[];
|
|
108
103
|
getMeridiemText: (ampm: 'am' | 'pm') => string;
|
|
109
104
|
}
|
|
110
|
-
export {};
|
|
@@ -359,7 +359,7 @@ export class AdapterMoment {
|
|
|
359
359
|
return value.clone().subtract(1, 'month');
|
|
360
360
|
};
|
|
361
361
|
this.getMonthArray = value => {
|
|
362
|
-
const firstMonth =
|
|
362
|
+
const firstMonth = this.startOfYear(value);
|
|
363
363
|
const monthArray = [firstMonth];
|
|
364
364
|
while (monthArray.length < 12) {
|
|
365
365
|
const prevMonth = monthArray[monthArray.length - 1];
|
|
@@ -405,7 +405,7 @@ export class AdapterMoment {
|
|
|
405
405
|
this.getMeridiemText = ampm => {
|
|
406
406
|
if (this.is12HourCycleInCurrentLocale()) {
|
|
407
407
|
// AM/PM translation only possible in those who have 12 hour cycle in locale.
|
|
408
|
-
return
|
|
408
|
+
return defaultMoment.localeData(this.getCurrentLocaleCode()).meridiem(ampm === 'am' ? 0 : 13, 0, false);
|
|
409
409
|
}
|
|
410
410
|
return ampm === 'am' ? 'AM' : 'PM'; // fallback for de, ru, ...etc
|
|
411
411
|
};
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import defaultHMoment, { Moment } from 'moment-hijri';
|
|
2
2
|
import { AdapterMoment } from '../AdapterMoment';
|
|
3
|
-
import {
|
|
4
|
-
interface AdapterMomentHijriOptions {
|
|
5
|
-
instance?: typeof defaultHMoment;
|
|
6
|
-
formats?: Partial<AdapterFormats>;
|
|
7
|
-
}
|
|
3
|
+
import { AdapterOptions, FieldFormatTokenMap, MuiPickersAdapter } from '../models';
|
|
8
4
|
/**
|
|
9
5
|
* Based on `@date-io/hijri`
|
|
10
6
|
*
|
|
@@ -30,15 +26,11 @@ interface AdapterMomentHijriOptions {
|
|
|
30
26
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
31
27
|
* SOFTWARE.
|
|
32
28
|
*/
|
|
33
|
-
export declare class AdapterMomentHijri extends AdapterMoment implements MuiPickersAdapter<Moment> {
|
|
34
|
-
|
|
29
|
+
export declare class AdapterMomentHijri extends AdapterMoment implements MuiPickersAdapter<Moment, string> {
|
|
30
|
+
lib: string;
|
|
31
|
+
moment: typeof defaultHMoment;
|
|
35
32
|
formatTokenMap: FieldFormatTokenMap;
|
|
36
|
-
|
|
37
|
-
start: string;
|
|
38
|
-
end: string;
|
|
39
|
-
};
|
|
40
|
-
constructor({ formats, instance }?: AdapterMomentHijriOptions);
|
|
41
|
-
private toIMoment;
|
|
33
|
+
constructor({ formats, instance }?: AdapterOptions<string, typeof defaultHMoment>);
|
|
42
34
|
date: (value?: any) => defaultHMoment.Moment | null;
|
|
43
35
|
parse: (value: string, format: string) => defaultHMoment.Moment | null;
|
|
44
36
|
getFormatHelperText: (format: string) => string;
|
|
@@ -64,4 +56,3 @@ export declare class AdapterMomentHijri extends AdapterMoment implements MuiPick
|
|
|
64
56
|
getYearRange: (start: Moment, end: Moment) => defaultHMoment.Moment[];
|
|
65
57
|
getMeridiemText: (ampm: 'am' | 'pm') => string;
|
|
66
58
|
}
|
|
67
|
-
export {};
|
|
@@ -142,15 +142,9 @@ export class AdapterMomentHijri extends AdapterMoment {
|
|
|
142
142
|
locale: 'ar-SA',
|
|
143
143
|
instance
|
|
144
144
|
});
|
|
145
|
-
this.
|
|
145
|
+
this.lib = 'moment-hijri';
|
|
146
|
+
this.moment = void 0;
|
|
146
147
|
this.formatTokenMap = formatTokenMap;
|
|
147
|
-
this.escapedCharacters = {
|
|
148
|
-
start: '[',
|
|
149
|
-
end: ']'
|
|
150
|
-
};
|
|
151
|
-
this.toIMoment = value => {
|
|
152
|
-
return this.moment(value ? value.clone() : undefined).locale('ar-SA');
|
|
153
|
-
};
|
|
154
148
|
this.date = value => {
|
|
155
149
|
if (value === null) {
|
|
156
150
|
return null;
|
|
@@ -219,7 +213,7 @@ export class AdapterMomentHijri extends AdapterMoment {
|
|
|
219
213
|
};
|
|
220
214
|
this.getWeekdays = () => {
|
|
221
215
|
return [0, 1, 2, 3, 4, 5, 6].map(dayOfWeek => {
|
|
222
|
-
return this.
|
|
216
|
+
return this.date().weekday(dayOfWeek).format('dd');
|
|
223
217
|
});
|
|
224
218
|
};
|
|
225
219
|
this.getWeekArray = value => {
|
|
@@ -260,7 +254,7 @@ export class AdapterMomentHijri extends AdapterMoment {
|
|
|
260
254
|
return years;
|
|
261
255
|
};
|
|
262
256
|
this.getMeridiemText = ampm => {
|
|
263
|
-
return ampm === 'am' ? this.
|
|
257
|
+
return ampm === 'am' ? this.date().hours(2).format('A') : this.date().hours(14).format('A');
|
|
264
258
|
};
|
|
265
259
|
this.moment = instance || defaultHMoment;
|
|
266
260
|
this.locale = 'ar-SA';
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import defaultJMoment, { Moment } from 'moment-jalaali';
|
|
2
2
|
import { AdapterMoment } from '../AdapterMoment';
|
|
3
|
-
import {
|
|
4
|
-
interface AdapterMomentJalaaliOptions {
|
|
5
|
-
instance?: typeof defaultJMoment;
|
|
6
|
-
formats?: Partial<AdapterFormats>;
|
|
7
|
-
}
|
|
3
|
+
import { AdapterOptions, FieldFormatTokenMap, MuiPickersAdapter } from '../models';
|
|
8
4
|
/**
|
|
9
5
|
* Based on `@date-io/jalaali`
|
|
10
6
|
*
|
|
@@ -30,25 +26,20 @@ interface AdapterMomentJalaaliOptions {
|
|
|
30
26
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
31
27
|
* SOFTWARE.
|
|
32
28
|
*/
|
|
33
|
-
export declare class AdapterMomentJalaali extends AdapterMoment implements MuiPickersAdapter<Moment> {
|
|
34
|
-
isMUIAdapter: boolean;
|
|
29
|
+
export declare class AdapterMomentJalaali extends AdapterMoment implements MuiPickersAdapter<Moment, string> {
|
|
35
30
|
lib: string;
|
|
36
31
|
moment: typeof defaultJMoment;
|
|
37
|
-
locale?: string;
|
|
38
|
-
formats: AdapterFormats;
|
|
39
32
|
formatTokenMap: FieldFormatTokenMap;
|
|
40
|
-
|
|
41
|
-
start: string;
|
|
42
|
-
end: string;
|
|
43
|
-
};
|
|
44
|
-
constructor({ formats, instance }?: AdapterMomentJalaaliOptions);
|
|
45
|
-
private toJMoment;
|
|
33
|
+
constructor({ formats, instance }?: AdapterOptions<string, typeof defaultJMoment>);
|
|
46
34
|
date: (value?: any) => defaultJMoment.Moment | null;
|
|
35
|
+
parseISO: (isoString: string) => defaultJMoment.Moment;
|
|
47
36
|
parse: (value: string, format: string) => defaultJMoment.Moment | null;
|
|
48
37
|
getFormatHelperText: (format: string) => string;
|
|
49
38
|
isValid: (value: any) => boolean;
|
|
50
39
|
formatNumber: (numberToFormat: string) => string;
|
|
51
40
|
isEqual: (value: any, comparing: any) => boolean;
|
|
41
|
+
isSameYear: (value: Moment, comparing: Moment) => boolean;
|
|
42
|
+
isSameMonth: (value: Moment, comparing: Moment) => boolean;
|
|
52
43
|
isAfterYear: (value: Moment, comparing: Moment) => boolean;
|
|
53
44
|
isBeforeYear: (value: Moment, comparing: Moment) => boolean;
|
|
54
45
|
startOfYear: (value: Moment) => defaultJMoment.Moment;
|
|
@@ -71,4 +62,3 @@ export declare class AdapterMomentJalaali extends AdapterMoment implements MuiPi
|
|
|
71
62
|
getYearRange: (start: Moment, end: Moment) => defaultJMoment.Moment[];
|
|
72
63
|
getMeridiemText: (ampm: 'am' | 'pm') => string;
|
|
73
64
|
}
|
|
74
|
-
export {};
|
|
@@ -140,25 +140,18 @@ export class AdapterMomentJalaali extends AdapterMoment {
|
|
|
140
140
|
locale: 'fa',
|
|
141
141
|
instance
|
|
142
142
|
});
|
|
143
|
-
this.isMUIAdapter = true;
|
|
144
143
|
this.lib = 'moment-jalaali';
|
|
145
144
|
this.moment = void 0;
|
|
146
|
-
this.locale = void 0;
|
|
147
|
-
this.formats = void 0;
|
|
148
145
|
this.formatTokenMap = formatTokenMap;
|
|
149
|
-
this.escapedCharacters = {
|
|
150
|
-
start: '[',
|
|
151
|
-
end: ']'
|
|
152
|
-
};
|
|
153
|
-
this.toJMoment = value => {
|
|
154
|
-
return this.moment(value ? value.clone() : undefined).locale('fa');
|
|
155
|
-
};
|
|
156
146
|
this.date = value => {
|
|
157
147
|
if (value === null) {
|
|
158
148
|
return null;
|
|
159
149
|
}
|
|
160
150
|
return this.moment(value).locale('fa');
|
|
161
151
|
};
|
|
152
|
+
this.parseISO = isoString => {
|
|
153
|
+
return this.moment(isoString).locale('fa');
|
|
154
|
+
};
|
|
162
155
|
this.parse = (value, format) => {
|
|
163
156
|
if (value === '') {
|
|
164
157
|
return null;
|
|
@@ -184,6 +177,16 @@ export class AdapterMomentJalaali extends AdapterMoment {
|
|
|
184
177
|
}
|
|
185
178
|
return this.moment(value).isSame(comparing);
|
|
186
179
|
};
|
|
180
|
+
this.isSameYear = (value, comparing) => {
|
|
181
|
+
// `isSame` seems to mutate the date on `moment-jalaali`
|
|
182
|
+
// @ts-ignore
|
|
183
|
+
return value.clone().isSame(comparing, 'jYear');
|
|
184
|
+
};
|
|
185
|
+
this.isSameMonth = (value, comparing) => {
|
|
186
|
+
// `isSame` seems to mutate the date on `moment-jalaali`
|
|
187
|
+
// @ts-ignore
|
|
188
|
+
return value.clone().isSame(comparing, 'jMonth');
|
|
189
|
+
};
|
|
187
190
|
this.isAfterYear = (value, comparing) => {
|
|
188
191
|
return value.jYear() > comparing.jYear();
|
|
189
192
|
};
|
|
@@ -234,7 +237,7 @@ export class AdapterMomentJalaali extends AdapterMoment {
|
|
|
234
237
|
};
|
|
235
238
|
this.getWeekdays = () => {
|
|
236
239
|
return [0, 1, 2, 3, 4, 5, 6].map(dayOfWeek => {
|
|
237
|
-
return this.
|
|
240
|
+
return this.date().weekday(dayOfWeek).format('dd');
|
|
238
241
|
});
|
|
239
242
|
};
|
|
240
243
|
this.getWeekArray = value => {
|
|
@@ -267,7 +270,7 @@ export class AdapterMomentJalaali extends AdapterMoment {
|
|
|
267
270
|
return years;
|
|
268
271
|
};
|
|
269
272
|
this.getMeridiemText = ampm => {
|
|
270
|
-
return ampm === 'am' ? this.
|
|
273
|
+
return ampm === 'am' ? this.date().hours(2).format('A') : this.date().hours(14).format('A');
|
|
271
274
|
};
|
|
272
275
|
this.moment = instance || defaultJMoment;
|
|
273
276
|
this.locale = 'fa';
|
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,63 @@
|
|
|
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
|
+
## v6.4.0
|
|
7
|
+
|
|
8
|
+
_May 12, 2023_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 12 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🎁 Introduce clipboard paste support for `DataGridPremium`:
|
|
13
|
+
|
|
14
|
+
https://github.com/mui/mui-x/assets/13808724/abfcb5c6-9db6-4677-9ba7-ae97de441080
|
|
15
|
+
|
|
16
|
+
See [the documentation](https://mui.com/x/react-data-grid/clipboard/#clipboard-paste) for more information
|
|
17
|
+
|
|
18
|
+
- 🌍 Improve French (fr-FR), German (de-DE), Portuguese (pt-BR) and Ukrainian (uk-UA) locales on the data grid
|
|
19
|
+
- 🌍 Add Slovak (sk-SK) locale on the pickers
|
|
20
|
+
- 🐞 Bugfixes
|
|
21
|
+
- 📚 Documentation improvements
|
|
22
|
+
|
|
23
|
+
### `@mui/x-data-grid@v6.4.0` / `@mui/x-data-grid-pro@v6.4.0` / `@mui/x-data-grid-premium@v6.4.0`
|
|
24
|
+
|
|
25
|
+
#### Changes
|
|
26
|
+
|
|
27
|
+
- [DataGrid] Fix DataGrid rendering in JSDOM (#8968) @cherniavskii
|
|
28
|
+
- [DataGrid] Fix layout when rendered inside a parent with `display: grid` (#8577) @cherniavskii
|
|
29
|
+
- [DataGrid] Add Joy UI icon slots (#8940) @siriwatknp
|
|
30
|
+
- [DataGrid] Add Joy UI pagination slot (#8871) @cherniavskii
|
|
31
|
+
- [DataGrid] Extract `baseChip` slot (#8748) @cherniavskii
|
|
32
|
+
- [DataGridPremium] Implement Clipboard import (#7389) @cherniavskii
|
|
33
|
+
- [l10n] Improve French (fr-FR) locale (#8825) @vallereaugabriel
|
|
34
|
+
- [l10n] Improve German (de-DE) locale (#8898) @marcauberer
|
|
35
|
+
- [l10n] Improve Portuguese (pt-BR) locale (#8960) @Sorriso337
|
|
36
|
+
- [l10n] Improve Ukrainian (uk-UA) locale (#8863) @Neonin
|
|
37
|
+
|
|
38
|
+
### `@mui/x-date-pickers@v6.4.0` / `@mui/x-date-pickers-pro@v6.4.0`
|
|
39
|
+
|
|
40
|
+
#### Changes
|
|
41
|
+
|
|
42
|
+
- [pickers] Fix trailing zeros inconsistency in `LuxonAdapter` (#8955) @alexfauquette
|
|
43
|
+
- [pickers] Stop using deprecated adapter methods (#8735) @flaviendelangle
|
|
44
|
+
- [pickers] Strictly type the `adapterLocale` prop of `LocalizationProvider` (#8780) @flaviendelangle
|
|
45
|
+
- [l10n] Add Slovak (sk-SK) locale (#8875) @MatejFacko
|
|
46
|
+
|
|
47
|
+
### Docs
|
|
48
|
+
|
|
49
|
+
- [docs] Fix date pickers typo in the docs (#8939) @richbustos
|
|
50
|
+
- [docs] Fix master detail demo (#8894) @m4theushw
|
|
51
|
+
- [docs] Fix typo in clipboard docs (#8971) @MBilalShafi
|
|
52
|
+
- [docs] Reduce list of dependencies in Codesandbox/Stackblitz demos (#8535) @cherniavskii
|
|
53
|
+
|
|
54
|
+
### Core
|
|
55
|
+
|
|
56
|
+
- [core] Improve testing of the adapters (#8789) @flaviendelangle
|
|
57
|
+
- [core] Update license key for tests (#8917) @LukasTy
|
|
58
|
+
- [charts] Make introduction docs pages for each chart (#8869) @alexfauquette
|
|
59
|
+
- [charts] Document Tooltip and Highlighs (#8867) @alexfauquette
|
|
60
|
+
- [test] Cover row grouping regression with a unit test (#8870) @cherniavskii
|
|
61
|
+
- [test] Fix flaky regression tests (#8954) @cherniavskii
|
|
62
|
+
|
|
6
63
|
## 6.3.1
|
|
7
64
|
|
|
8
65
|
_May 5, 2023_
|
|
@@ -14,7 +14,7 @@ import { MonthCalendar } from '../MonthCalendar';
|
|
|
14
14
|
import { YearCalendar } from '../YearCalendar';
|
|
15
15
|
import { useViews } from '../internals/hooks/useViews';
|
|
16
16
|
import { PickersCalendarHeader } from './PickersCalendarHeader';
|
|
17
|
-
import { findClosestEnabledDate, applyDefaultDate } from '../internals/utils/date-utils';
|
|
17
|
+
import { findClosestEnabledDate, applyDefaultDate, mergeDateAndTime } from '../internals/utils/date-utils';
|
|
18
18
|
import { PickerViewRoot } from '../internals/components/PickerViewRoot';
|
|
19
19
|
import { defaultReduceAnimations } from '../internals/utils/defaultReduceAnimations';
|
|
20
20
|
import { getDateCalendarUtilityClass } from './dateCalendarClasses';
|
|
@@ -209,7 +209,7 @@ export const DateCalendar = /*#__PURE__*/React.forwardRef(function DateCalendar(
|
|
|
209
209
|
const handleSelectedDayChange = useEventCallback(day => {
|
|
210
210
|
if (value && day) {
|
|
211
211
|
// If there is a date already selected, then we want to keep its time
|
|
212
|
-
return setValueAndGoToNextView(
|
|
212
|
+
return setValueAndGoToNextView(mergeDateAndTime(utils, day, value), 'finish');
|
|
213
213
|
}
|
|
214
214
|
return setValueAndGoToNextView(day, 'finish');
|
|
215
215
|
});
|
|
@@ -216,6 +216,7 @@ export function DayCalendar(inProps) {
|
|
|
216
216
|
});
|
|
217
217
|
const classes = useUtilityClasses(props);
|
|
218
218
|
const theme = useTheme();
|
|
219
|
+
const isRTL = theme.direction === 'rtl';
|
|
219
220
|
const {
|
|
220
221
|
onFocusedDayChange,
|
|
221
222
|
className,
|
|
@@ -290,13 +291,13 @@ export function DayCalendar(inProps) {
|
|
|
290
291
|
break;
|
|
291
292
|
case 'ArrowLeft':
|
|
292
293
|
{
|
|
293
|
-
const newFocusedDayDefault = utils.addDays(day,
|
|
294
|
-
const nextAvailableMonth =
|
|
294
|
+
const newFocusedDayDefault = utils.addDays(day, isRTL ? 1 : -1);
|
|
295
|
+
const nextAvailableMonth = utils.addMonths(day, isRTL ? 1 : -1);
|
|
295
296
|
const closestDayToFocus = findClosestEnabledDate({
|
|
296
297
|
utils,
|
|
297
298
|
date: newFocusedDayDefault,
|
|
298
|
-
minDate:
|
|
299
|
-
maxDate:
|
|
299
|
+
minDate: isRTL ? newFocusedDayDefault : utils.startOfMonth(nextAvailableMonth),
|
|
300
|
+
maxDate: isRTL ? utils.endOfMonth(nextAvailableMonth) : newFocusedDayDefault,
|
|
300
301
|
isDateDisabled
|
|
301
302
|
});
|
|
302
303
|
focusDay(closestDayToFocus || newFocusedDayDefault);
|
|
@@ -305,13 +306,13 @@ export function DayCalendar(inProps) {
|
|
|
305
306
|
}
|
|
306
307
|
case 'ArrowRight':
|
|
307
308
|
{
|
|
308
|
-
const newFocusedDayDefault = utils.addDays(day,
|
|
309
|
-
const nextAvailableMonth =
|
|
309
|
+
const newFocusedDayDefault = utils.addDays(day, isRTL ? -1 : 1);
|
|
310
|
+
const nextAvailableMonth = utils.addMonths(day, isRTL ? -1 : 1);
|
|
310
311
|
const closestDayToFocus = findClosestEnabledDate({
|
|
311
312
|
utils,
|
|
312
313
|
date: newFocusedDayDefault,
|
|
313
|
-
minDate:
|
|
314
|
-
maxDate:
|
|
314
|
+
minDate: isRTL ? utils.startOfMonth(nextAvailableMonth) : newFocusedDayDefault,
|
|
315
|
+
maxDate: isRTL ? newFocusedDayDefault : utils.endOfMonth(nextAvailableMonth),
|
|
315
316
|
isDateDisabled
|
|
316
317
|
});
|
|
317
318
|
focusDay(closestDayToFocus || newFocusedDayDefault);
|
|
@@ -327,11 +328,11 @@ export function DayCalendar(inProps) {
|
|
|
327
328
|
event.preventDefault();
|
|
328
329
|
break;
|
|
329
330
|
case 'PageUp':
|
|
330
|
-
focusDay(utils.
|
|
331
|
+
focusDay(utils.addMonths(day, 1));
|
|
331
332
|
event.preventDefault();
|
|
332
333
|
break;
|
|
333
334
|
case 'PageDown':
|
|
334
|
-
focusDay(utils.
|
|
335
|
+
focusDay(utils.addMonths(day, -1));
|
|
335
336
|
event.preventDefault();
|
|
336
337
|
break;
|
|
337
338
|
default:
|
|
@@ -141,8 +141,8 @@ export function PickersCalendarHeader(inProps) {
|
|
|
141
141
|
className: classes.switchViewIcon
|
|
142
142
|
}),
|
|
143
143
|
switchViewIconProps = _objectWithoutPropertiesLoose(_useSlotProps, _excluded);
|
|
144
|
-
const selectNextMonth = () => onMonthChange(utils.
|
|
145
|
-
const selectPreviousMonth = () => onMonthChange(utils.
|
|
144
|
+
const selectNextMonth = () => onMonthChange(utils.addMonths(month, 1), 'left');
|
|
145
|
+
const selectPreviousMonth = () => onMonthChange(utils.addMonths(month, -1), 'right');
|
|
146
146
|
const isNextMonthDisabled = useNextMonthDisabled(month, {
|
|
147
147
|
disableFuture,
|
|
148
148
|
maxDate
|
|
@@ -22,7 +22,7 @@ interface ChangeFocusedDayPayload<TDate> {
|
|
|
22
22
|
*/
|
|
23
23
|
withoutMonthSwitchingAnimation?: boolean;
|
|
24
24
|
}
|
|
25
|
-
export declare const createCalendarStateReducer: <TDate extends unknown>(reduceAnimations: boolean, disableSwitchToMonthOnDayFocus: boolean, utils: MuiPickersAdapter<TDate>) => (state: CalendarState<TDate>, action: {
|
|
25
|
+
export declare const createCalendarStateReducer: <TDate extends unknown>(reduceAnimations: boolean, disableSwitchToMonthOnDayFocus: boolean, utils: MuiPickersAdapter<TDate, any>) => (state: CalendarState<TDate>, action: {
|
|
26
26
|
type: "finishMonthSwitchingAnimation";
|
|
27
27
|
} | ReducerAction<"changeMonth", ChangeMonthPayload<TDate>> | ReducerAction<"changeFocusedDay", ChangeFocusedDayPayload<TDate>>) => CalendarState<TDate>;
|
|
28
28
|
interface CalendarStateInput<TDate> extends Pick<DateCalendarDefaultizedProps<TDate>, 'value' | 'defaultCalendarMonth' | 'disableFuture' | 'disablePast' | 'minDate' | 'maxDate' | 'onMonthChange' | 'reduceAnimations' | 'shouldDisableDate'> {
|
package/DatePicker/shared.d.ts
CHANGED
|
@@ -52,6 +52,6 @@ type UseDatePickerDefaultizedProps<TDate, Props extends BaseDatePickerProps<TDat
|
|
|
52
52
|
export declare const getDatePickerFieldFormat: (utils: MuiPickersAdapter<any>, { format, views }: {
|
|
53
53
|
format?: string | undefined;
|
|
54
54
|
views: readonly DateView[];
|
|
55
|
-
}) =>
|
|
55
|
+
}) => string | undefined;
|
|
56
56
|
export declare function useDatePickerDefaultizedProps<TDate, Props extends BaseDatePickerProps<TDate>>(props: Props, name: string): UseDatePickerDefaultizedProps<TDate, Props>;
|
|
57
57
|
export {};
|