@mui/x-date-pickers 6.0.2 → 6.0.3
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/index.js +1 -0
- package/AdapterDateFnsJalali/index.js +1 -0
- package/AdapterDayjs/index.js +5 -0
- package/AdapterLuxon/index.js +1 -0
- package/AdapterMoment/index.js +5 -0
- package/AdapterMomentHijri/index.js +5 -0
- package/AdapterMomentJalaali/index.js +5 -0
- package/CHANGELOG.md +58 -5
- package/DateField/DateField.js +4 -0
- package/DateField/DateField.types.d.ts +2 -2
- package/DateField/useDateField.js +5 -3
- package/DateTimeField/DateTimeField.js +4 -0
- package/DateTimeField/DateTimeField.types.d.ts +2 -2
- package/DateTimeField/useDateTimeField.js +5 -3
- package/PickersDay/PickersDay.js +4 -4
- package/TimeField/TimeField.js +4 -0
- package/TimeField/TimeField.types.d.ts +2 -2
- package/TimeField/useTimeField.js +5 -3
- package/index.d.ts +1 -6
- package/index.js +4 -2
- package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +5 -4
- package/internals/hooks/useField/index.d.ts +2 -2
- package/internals/hooks/useField/index.js +1 -1
- package/internals/hooks/useField/useField.d.ts +1 -1
- package/internals/hooks/useField/useField.js +54 -25
- package/internals/hooks/useField/useField.types.d.ts +24 -12
- package/internals/hooks/useField/useFieldState.d.ts +1 -2
- package/internals/hooks/useField/useFieldState.js +1 -6
- package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +5 -4
- package/internals/hooks/usePicker/usePicker.d.ts +2 -1
- package/internals/hooks/usePicker/usePicker.types.d.ts +4 -3
- package/internals/hooks/usePicker/usePickerValue.d.ts +8 -8
- package/internals/hooks/usePicker/usePickerValue.js +7 -11
- package/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +2 -1
- package/internals/index.d.ts +2 -2
- package/internals/index.js +2 -2
- package/internals/models/fields.d.ts +3 -3
- package/internals/utils/date-utils.d.ts +1 -0
- package/internals/utils/date-utils.js +6 -0
- package/internals/utils/valueManagers.js +4 -5
- package/legacy/AdapterDateFns/index.js +1 -0
- package/legacy/AdapterDateFnsJalali/index.js +1 -0
- package/legacy/AdapterDayjs/index.js +5 -0
- package/legacy/AdapterLuxon/index.js +1 -0
- package/legacy/AdapterMoment/index.js +5 -0
- package/legacy/AdapterMomentHijri/index.js +5 -0
- package/legacy/AdapterMomentJalaali/index.js +5 -0
- package/legacy/DateField/DateField.js +4 -0
- package/legacy/DateField/useDateField.js +4 -2
- package/legacy/DateTimeField/DateTimeField.js +4 -0
- package/legacy/DateTimeField/useDateTimeField.js +4 -2
- package/legacy/PickersDay/PickersDay.js +4 -4
- package/legacy/TimeField/TimeField.js +4 -0
- package/legacy/TimeField/useTimeField.js +4 -2
- package/legacy/index.js +4 -2
- package/legacy/internals/hooks/useField/index.js +1 -1
- package/legacy/internals/hooks/useField/useField.js +79 -39
- package/legacy/internals/hooks/useField/useFieldState.js +1 -8
- package/legacy/internals/hooks/usePicker/usePickerValue.js +9 -13
- package/legacy/internals/index.js +2 -2
- package/legacy/internals/utils/date-utils.js +6 -0
- package/legacy/internals/utils/valueManagers.js +3 -8
- package/legacy/locales/faIR.js +33 -16
- package/legacy/locales/nlNL.js +12 -10
- package/legacy/locales/plPL.js +12 -10
- package/legacy/models/index.js +1 -0
- package/legacy/tests/describeValue/testPickerOpenCloseLifeCycle.js +2 -3
- package/locales/faIR.js +13 -16
- package/locales/nlNL.js +8 -10
- package/locales/plPL.js +8 -10
- package/models/index.d.ts +6 -0
- package/models/index.js +1 -0
- package/models/package.json +6 -0
- package/modern/AdapterDateFns/index.js +1 -0
- package/modern/AdapterDateFnsJalali/index.js +1 -0
- package/modern/AdapterDayjs/index.js +5 -0
- package/modern/AdapterLuxon/index.js +1 -0
- package/modern/AdapterMoment/index.js +5 -0
- package/modern/AdapterMomentHijri/index.js +5 -0
- package/modern/AdapterMomentJalaali/index.js +5 -0
- package/modern/DateField/DateField.js +4 -0
- package/modern/DateField/useDateField.js +5 -3
- package/modern/DateTimeField/DateTimeField.js +4 -0
- package/modern/DateTimeField/useDateTimeField.js +5 -3
- package/modern/PickersDay/PickersDay.js +4 -4
- package/modern/TimeField/TimeField.js +4 -0
- package/modern/TimeField/useTimeField.js +5 -3
- package/modern/index.js +4 -2
- package/modern/internals/hooks/useField/index.js +1 -1
- package/modern/internals/hooks/useField/useField.js +53 -25
- package/modern/internals/hooks/useField/useFieldState.js +1 -6
- package/modern/internals/hooks/usePicker/usePickerValue.js +7 -11
- package/modern/internals/index.js +2 -2
- package/modern/internals/utils/date-utils.js +6 -0
- package/modern/internals/utils/valueManagers.js +4 -5
- package/modern/locales/faIR.js +13 -16
- package/modern/locales/nlNL.js +8 -10
- package/modern/locales/plPL.js +8 -10
- package/modern/models/index.js +1 -0
- package/modern/tests/describeValue/testPickerOpenCloseLifeCycle.js +2 -3
- package/node/AdapterDateFns/index.js +1 -0
- package/node/AdapterDateFnsJalali/index.js +1 -0
- package/node/AdapterDayjs/index.js +5 -0
- package/node/AdapterLuxon/index.js +1 -0
- package/node/AdapterMoment/index.js +5 -0
- package/node/AdapterMomentHijri/index.js +5 -0
- package/node/AdapterMomentJalaali/index.js +5 -0
- package/node/DateField/DateField.js +4 -0
- package/node/DateField/useDateField.js +5 -3
- package/node/DateTimeField/DateTimeField.js +4 -0
- package/node/DateTimeField/useDateTimeField.js +5 -3
- package/node/PickersDay/PickersDay.js +4 -4
- package/node/TimeField/TimeField.js +4 -0
- package/node/TimeField/useTimeField.js +5 -3
- package/node/index.js +14 -2
- package/node/internals/hooks/useField/index.js +0 -6
- package/node/internals/hooks/useField/useField.js +52 -24
- package/node/internals/hooks/useField/useFieldState.js +1 -6
- package/node/internals/hooks/usePicker/usePickerValue.js +7 -11
- package/node/internals/index.js +6 -6
- package/node/internals/utils/date-utils.js +9 -2
- package/node/internals/utils/valueManagers.js +2 -3
- package/node/locales/faIR.js +13 -16
- package/node/locales/nlNL.js +8 -10
- package/node/locales/plPL.js +8 -10
- package/node/models/index.js +5 -0
- package/node/tests/describeValue/testPickerOpenCloseLifeCycle.js +2 -3
- package/package.json +2 -2
- package/tests/describeValue/testPickerOpenCloseLifeCycle.js +2 -3
package/legacy/locales/faIR.js
CHANGED
|
@@ -36,11 +36,14 @@ var faIRPickers = {
|
|
|
36
36
|
return "".concat(seconds, " \u062B\u0627\u0646\u06CC\u0647 \u0647\u0627");
|
|
37
37
|
},
|
|
38
38
|
// Calendar labels
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
calendarWeekNumberHeaderLabel: 'عدد هفته',
|
|
40
|
+
calendarWeekNumberHeaderText: '#',
|
|
41
|
+
calendarWeekNumberAriaLabelText: function calendarWeekNumberAriaLabelText(weekNumber) {
|
|
42
|
+
return "\u0647\u0641\u062A\u0647 ".concat(weekNumber);
|
|
43
|
+
},
|
|
44
|
+
calendarWeekNumberText: function calendarWeekNumberText(weekNumber) {
|
|
45
|
+
return "".concat(weekNumber);
|
|
46
|
+
},
|
|
44
47
|
// Open picker labels
|
|
45
48
|
openDatePickerDialogue: function openDatePickerDialogue(value, utils) {
|
|
46
49
|
return value !== null && utils.isValid(value) ? "\u062A\u0627\u0631\u06CC\u062E \u0631\u0627 \u0627\u0646\u062A\u062E\u0627\u0628 \u06A9\u0646\u06CC\u062F\u060C \u062A\u0627\u0631\u06CC\u062E \u0627\u0646\u062A\u062E\u0627\u0628 \u0634\u062F\u0647 ".concat(utils.format(value, 'fullDate'), " \u0645\u06CC \u0628\u0627\u0634\u062F") : 'تاریخ را انتخاب کنید';
|
|
@@ -50,17 +53,31 @@ var faIRPickers = {
|
|
|
50
53
|
},
|
|
51
54
|
// Table labels
|
|
52
55
|
timeTableLabel: 'انتخاب تاریخ',
|
|
53
|
-
dateTableLabel: 'انتخاب ساعت'
|
|
54
|
-
|
|
56
|
+
dateTableLabel: 'انتخاب ساعت',
|
|
55
57
|
// Field section placeholders
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
58
|
+
fieldYearPlaceholder: function fieldYearPlaceholder(params) {
|
|
59
|
+
return 'Y'.repeat(params.digitAmount);
|
|
60
|
+
},
|
|
61
|
+
fieldMonthPlaceholder: function fieldMonthPlaceholder(params) {
|
|
62
|
+
return params.contentType === 'letter' ? 'MMMM' : 'MM';
|
|
63
|
+
},
|
|
64
|
+
fieldDayPlaceholder: function fieldDayPlaceholder() {
|
|
65
|
+
return 'DD';
|
|
66
|
+
},
|
|
67
|
+
fieldWeekDayPlaceholder: function fieldWeekDayPlaceholder(params) {
|
|
68
|
+
return params.contentType === 'letter' ? 'EEEE' : 'EE';
|
|
69
|
+
},
|
|
70
|
+
fieldHoursPlaceholder: function fieldHoursPlaceholder() {
|
|
71
|
+
return 'hh';
|
|
72
|
+
},
|
|
73
|
+
fieldMinutesPlaceholder: function fieldMinutesPlaceholder() {
|
|
74
|
+
return 'mm';
|
|
75
|
+
},
|
|
76
|
+
fieldSecondsPlaceholder: function fieldSecondsPlaceholder() {
|
|
77
|
+
return 'ss';
|
|
78
|
+
},
|
|
79
|
+
fieldMeridiemPlaceholder: function fieldMeridiemPlaceholder() {
|
|
80
|
+
return 'aa';
|
|
81
|
+
}
|
|
64
82
|
};
|
|
65
|
-
|
|
66
83
|
export var faIR = getPickersLocalization(faIRPickers);
|
package/legacy/locales/nlNL.js
CHANGED
|
@@ -18,11 +18,10 @@ var nlNLPickers = {
|
|
|
18
18
|
okButtonLabel: 'OK',
|
|
19
19
|
todayButtonLabel: 'Vandaag',
|
|
20
20
|
// Toolbar titles
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
datePickerToolbarTitle: 'Selecteer datum',
|
|
22
|
+
dateTimePickerToolbarTitle: 'Selecteer datum & tijd',
|
|
23
|
+
timePickerToolbarTitle: 'Selecteer tijd',
|
|
24
|
+
dateRangePickerToolbarTitle: 'Selecteer datumbereik',
|
|
26
25
|
// Clock labels
|
|
27
26
|
clockLabelText: function clockLabelText(view, time, adapter) {
|
|
28
27
|
return "Selecteer ".concat(view, ". ").concat(time === null ? 'Geen tijd geselecteerd' : "Geselecteerde tijd is ".concat(adapter.format(time, 'fullTime')));
|
|
@@ -37,11 +36,14 @@ var nlNLPickers = {
|
|
|
37
36
|
return "".concat(seconds, " seconden");
|
|
38
37
|
},
|
|
39
38
|
// Calendar labels
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
calendarWeekNumberHeaderLabel: 'Weeknummer',
|
|
40
|
+
calendarWeekNumberHeaderText: '#',
|
|
41
|
+
calendarWeekNumberAriaLabelText: function calendarWeekNumberAriaLabelText(weekNumber) {
|
|
42
|
+
return "Week ".concat(weekNumber);
|
|
43
|
+
},
|
|
44
|
+
calendarWeekNumberText: function calendarWeekNumberText(weekNumber) {
|
|
45
|
+
return "".concat(weekNumber);
|
|
46
|
+
},
|
|
45
47
|
// Open picker labels
|
|
46
48
|
openDatePickerDialogue: function openDatePickerDialogue(value, utils) {
|
|
47
49
|
return value !== null && utils.isValid(value) ? "Kies datum, geselecteerde datum is ".concat(utils.format(value, 'fullDate')) : 'Kies datum';
|
package/legacy/locales/plPL.js
CHANGED
|
@@ -18,11 +18,10 @@ var plPLPickers = {
|
|
|
18
18
|
okButtonLabel: 'Zatwierdź',
|
|
19
19
|
todayButtonLabel: 'Dzisiaj',
|
|
20
20
|
// Toolbar titles
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
datePickerToolbarTitle: 'Wybierz datę',
|
|
22
|
+
dateTimePickerToolbarTitle: 'Wybierz datę i czas',
|
|
23
|
+
timePickerToolbarTitle: 'Wybierz czas',
|
|
24
|
+
dateRangePickerToolbarTitle: 'Wybierz zakres dat',
|
|
26
25
|
// Clock labels
|
|
27
26
|
clockLabelText: function clockLabelText(view, time, adapter) {
|
|
28
27
|
return "Select ".concat(view, ". ").concat(time === null ? 'Nie wybrano czasu' : "Wybrany czas to ".concat(adapter.format(time, 'fullTime')));
|
|
@@ -37,11 +36,14 @@ var plPLPickers = {
|
|
|
37
36
|
return "".concat(seconds, " sekund");
|
|
38
37
|
},
|
|
39
38
|
// Calendar labels
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
calendarWeekNumberHeaderLabel: 'Numer tygodnia',
|
|
40
|
+
calendarWeekNumberHeaderText: '#',
|
|
41
|
+
calendarWeekNumberAriaLabelText: function calendarWeekNumberAriaLabelText(weekNumber) {
|
|
42
|
+
return "Tydzie\u0144 ".concat(weekNumber);
|
|
43
|
+
},
|
|
44
|
+
calendarWeekNumberText: function calendarWeekNumberText(weekNumber) {
|
|
45
|
+
return "".concat(weekNumber);
|
|
46
|
+
},
|
|
45
47
|
// Open picker labels
|
|
46
48
|
openDatePickerDialogue: function openDatePickerDialogue(value, utils) {
|
|
47
49
|
return value != null && utils.isValid(value) ? "Wybierz dat\u0119, obecnie wybrana data to ".concat(utils.format(value, 'fullDate')) : 'Wybierz datę';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -85,7 +85,7 @@ export var testPickerOpenCloseLifeCycle = function testPickerOpenCloseLifeCycle(
|
|
|
85
85
|
expect(onAccept.callCount).to.equal(pickerParams.variant === 'mobile' ? 0 : 1);
|
|
86
86
|
expect(onClose.callCount).to.equal(pickerParams.variant === 'mobile' ? 0 : 1);
|
|
87
87
|
});
|
|
88
|
-
it('should not select
|
|
88
|
+
it('should not select input content after closing on mobile', function () {
|
|
89
89
|
if (pickerParams.variant !== 'mobile') {
|
|
90
90
|
return;
|
|
91
91
|
}
|
|
@@ -101,8 +101,7 @@ export var testPickerOpenCloseLifeCycle = function testPickerOpenCloseLifeCycle(
|
|
|
101
101
|
} else {
|
|
102
102
|
textbox = getTextbox();
|
|
103
103
|
}
|
|
104
|
-
expect(textbox.
|
|
105
|
-
expect(textbox.selectionEnd).to.be.equal(0);
|
|
104
|
+
expect(textbox.scrollLeft).to.be.equal(0);
|
|
106
105
|
});
|
|
107
106
|
it('should call onChange, onClose and onAccept when selecting a value and `props.closeOnSelect` is true', function () {
|
|
108
107
|
var onChange = spy();
|
package/locales/faIR.js
CHANGED
|
@@ -26,27 +26,24 @@ const faIRPickers = {
|
|
|
26
26
|
minutesClockNumberText: minutes => `${minutes} دقیقه ها`,
|
|
27
27
|
secondsClockNumberText: seconds => `${seconds} ثانیه ها`,
|
|
28
28
|
// Calendar labels
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
calendarWeekNumberHeaderLabel: 'عدد هفته',
|
|
30
|
+
calendarWeekNumberHeaderText: '#',
|
|
31
|
+
calendarWeekNumberAriaLabelText: weekNumber => `هفته ${weekNumber}`,
|
|
32
|
+
calendarWeekNumberText: weekNumber => `${weekNumber}`,
|
|
34
33
|
// Open picker labels
|
|
35
34
|
openDatePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `تاریخ را انتخاب کنید، تاریخ انتخاب شده ${utils.format(value, 'fullDate')} می باشد` : 'تاریخ را انتخاب کنید',
|
|
36
35
|
openTimePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `ساعت را انتخاب کنید، ساعت انتخاب شده ${utils.format(value, 'fullTime')} می باشد` : 'ساعت را انتخاب کنید',
|
|
37
36
|
// Table labels
|
|
38
37
|
timeTableLabel: 'انتخاب تاریخ',
|
|
39
|
-
dateTableLabel: 'انتخاب ساعت'
|
|
40
|
-
|
|
38
|
+
dateTableLabel: 'انتخاب ساعت',
|
|
41
39
|
// Field section placeholders
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
40
|
+
fieldYearPlaceholder: params => 'Y'.repeat(params.digitAmount),
|
|
41
|
+
fieldMonthPlaceholder: params => params.contentType === 'letter' ? 'MMMM' : 'MM',
|
|
42
|
+
fieldDayPlaceholder: () => 'DD',
|
|
43
|
+
fieldWeekDayPlaceholder: params => params.contentType === 'letter' ? 'EEEE' : 'EE',
|
|
44
|
+
fieldHoursPlaceholder: () => 'hh',
|
|
45
|
+
fieldMinutesPlaceholder: () => 'mm',
|
|
46
|
+
fieldSecondsPlaceholder: () => 'ss',
|
|
47
|
+
fieldMeridiemPlaceholder: () => 'aa'
|
|
50
48
|
};
|
|
51
|
-
|
|
52
49
|
export const faIR = getPickersLocalization(faIRPickers);
|
package/locales/nlNL.js
CHANGED
|
@@ -16,22 +16,20 @@ const nlNLPickers = {
|
|
|
16
16
|
okButtonLabel: 'OK',
|
|
17
17
|
todayButtonLabel: 'Vandaag',
|
|
18
18
|
// Toolbar titles
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
datePickerToolbarTitle: 'Selecteer datum',
|
|
20
|
+
dateTimePickerToolbarTitle: 'Selecteer datum & tijd',
|
|
21
|
+
timePickerToolbarTitle: 'Selecteer tijd',
|
|
22
|
+
dateRangePickerToolbarTitle: 'Selecteer datumbereik',
|
|
24
23
|
// Clock labels
|
|
25
24
|
clockLabelText: (view, time, adapter) => `Selecteer ${view}. ${time === null ? 'Geen tijd geselecteerd' : `Geselecteerde tijd is ${adapter.format(time, 'fullTime')}`}`,
|
|
26
25
|
hoursClockNumberText: hours => `${hours} uren`,
|
|
27
26
|
minutesClockNumberText: minutes => `${minutes} minuten`,
|
|
28
27
|
secondsClockNumberText: seconds => `${seconds} seconden`,
|
|
29
28
|
// Calendar labels
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
calendarWeekNumberHeaderLabel: 'Weeknummer',
|
|
30
|
+
calendarWeekNumberHeaderText: '#',
|
|
31
|
+
calendarWeekNumberAriaLabelText: weekNumber => `Week ${weekNumber}`,
|
|
32
|
+
calendarWeekNumberText: weekNumber => `${weekNumber}`,
|
|
35
33
|
// Open picker labels
|
|
36
34
|
openDatePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `Kies datum, geselecteerde datum is ${utils.format(value, 'fullDate')}` : 'Kies datum',
|
|
37
35
|
openTimePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `Kies tijd, geselecteerde tijd is ${utils.format(value, 'fullTime')}` : 'Kies tijd',
|
package/locales/plPL.js
CHANGED
|
@@ -16,22 +16,20 @@ const plPLPickers = {
|
|
|
16
16
|
okButtonLabel: 'Zatwierdź',
|
|
17
17
|
todayButtonLabel: 'Dzisiaj',
|
|
18
18
|
// Toolbar titles
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
datePickerToolbarTitle: 'Wybierz datę',
|
|
20
|
+
dateTimePickerToolbarTitle: 'Wybierz datę i czas',
|
|
21
|
+
timePickerToolbarTitle: 'Wybierz czas',
|
|
22
|
+
dateRangePickerToolbarTitle: 'Wybierz zakres dat',
|
|
24
23
|
// Clock labels
|
|
25
24
|
clockLabelText: (view, time, adapter) => `Select ${view}. ${time === null ? 'Nie wybrano czasu' : `Wybrany czas to ${adapter.format(time, 'fullTime')}`}`,
|
|
26
25
|
hoursClockNumberText: hours => `${hours} godzin`,
|
|
27
26
|
minutesClockNumberText: minutes => `${minutes} minut`,
|
|
28
27
|
secondsClockNumberText: seconds => `${seconds} sekund`,
|
|
29
28
|
// Calendar labels
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
calendarWeekNumberHeaderLabel: 'Numer tygodnia',
|
|
30
|
+
calendarWeekNumberHeaderText: '#',
|
|
31
|
+
calendarWeekNumberAriaLabelText: weekNumber => `Tydzień ${weekNumber}`,
|
|
32
|
+
calendarWeekNumberText: weekNumber => `${weekNumber}`,
|
|
35
33
|
// Open picker labels
|
|
36
34
|
openDatePickerDialogue: (value, utils) => value != null && utils.isValid(value) ? `Wybierz datę, obecnie wybrana data to ${utils.format(value, 'fullDate')}` : 'Wybierz datę',
|
|
37
35
|
openTimePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `Wybierz czas, obecnie wybrany czas to ${utils.format(value, 'fullTime')}` : 'Wybierz czas',
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type { FieldSection, FieldSelectedSections, FieldRef } from '../internals/hooks/useField';
|
|
2
|
+
export type { BaseSingleInputFieldProps } from '../internals/models/fields';
|
|
3
|
+
export type { FieldSectionType } from '../internals/models/muiPickersAdapter';
|
|
4
|
+
export type { DateValidationError } from '../internals/hooks/validation/useDateValidation';
|
|
5
|
+
export type { TimeValidationError } from '../internals/hooks/validation/useTimeValidation';
|
|
6
|
+
export type { DateTimeValidationError } from '../internals/hooks/validation/useDateTimeValidation';
|
package/models/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -136,6 +136,7 @@ export class AdapterDateFns extends BaseAdapterDateFns {
|
|
|
136
136
|
return token;
|
|
137
137
|
}).join('');
|
|
138
138
|
};
|
|
139
|
+
// Redefined here just to show how it can be written using expandFormat
|
|
139
140
|
this.getFormatHelperText = format => {
|
|
140
141
|
return this.expandFormat(format).replace(/(aaa|aa|a)/g, '(a|p)m').toLocaleLowerCase();
|
|
141
142
|
};
|
|
@@ -67,6 +67,7 @@ export class AdapterDateFnsJalali extends BaseAdapterDateFnsJalali {
|
|
|
67
67
|
return token;
|
|
68
68
|
}).join('');
|
|
69
69
|
};
|
|
70
|
+
// Redefined here just to show how it can be written using expandFormat
|
|
70
71
|
this.getFormatHelperText = format => {
|
|
71
72
|
return this.expandFormat(format).replace(/(aaa|aa|a)/g, '(a|p)m').toLocaleLowerCase();
|
|
72
73
|
};
|
|
@@ -75,6 +75,10 @@ export class AdapterDayjs extends BaseAdapterDayjs {
|
|
|
75
75
|
/* istanbul ignore next */
|
|
76
76
|
return /A|a/.test(this.getLocaleFormats().LT || '');
|
|
77
77
|
};
|
|
78
|
+
/**
|
|
79
|
+
* The current getFormatHelperText method uses an outdated format parsing logic.
|
|
80
|
+
* We should use this one in the future to support all localized formats.
|
|
81
|
+
*/
|
|
78
82
|
this.expandFormat = format => {
|
|
79
83
|
const localeFormats = this.getLocaleFormats();
|
|
80
84
|
|
|
@@ -85,6 +89,7 @@ export class AdapterDayjs extends BaseAdapterDayjs {
|
|
|
85
89
|
return a || localeFormats[b] || t(localeFormats[B]);
|
|
86
90
|
});
|
|
87
91
|
};
|
|
92
|
+
// Redefined here just to show how it can be written using expandFormat
|
|
88
93
|
this.getFormatHelperText = format => {
|
|
89
94
|
return this.expandFormat(format).replace(/a/gi, '(a|p)m').toLocaleLowerCase();
|
|
90
95
|
};
|
|
@@ -91,6 +91,7 @@ export class AdapterLuxon extends BaseAdapterLuxon {
|
|
|
91
91
|
locale: this.locale
|
|
92
92
|
}).replace('yyyyy', 'yyyy');
|
|
93
93
|
};
|
|
94
|
+
// Redefined here just to show how it can be written using expandFormat
|
|
94
95
|
this.getFormatHelperText = format => {
|
|
95
96
|
return this.expandFormat(format).replace(/(a)/g, '(a|p)m').toLocaleLowerCase();
|
|
96
97
|
};
|
|
@@ -64,6 +64,10 @@ export class AdapterMoment extends BaseAdapterMoment {
|
|
|
64
64
|
start: '[',
|
|
65
65
|
end: ']'
|
|
66
66
|
};
|
|
67
|
+
/**
|
|
68
|
+
* The current getFormatHelperText method uses an outdated format parsing logic.
|
|
69
|
+
* We should use this one in the future to support all localized formats.
|
|
70
|
+
*/
|
|
67
71
|
this.expandFormat = format => {
|
|
68
72
|
// @see https://github.com/moment/moment/blob/develop/src/lib/format/format.js#L6
|
|
69
73
|
const localFormattingTokens = /(\[[^[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})|./g;
|
|
@@ -78,6 +82,7 @@ export class AdapterMoment extends BaseAdapterMoment {
|
|
|
78
82
|
this.getCurrentLocaleCode = () => {
|
|
79
83
|
return this.locale || defaultMoment.locale();
|
|
80
84
|
};
|
|
85
|
+
// Redefined here just to show how it can be written using expandFormat
|
|
81
86
|
this.getFormatHelperText = format => {
|
|
82
87
|
return this.expandFormat(format).replace(/a/gi, '(a|p)m').toLocaleLowerCase();
|
|
83
88
|
};
|
|
@@ -48,6 +48,10 @@ export class AdapterMomentHijri extends BaseAdapterMomentHijri {
|
|
|
48
48
|
start: '[',
|
|
49
49
|
end: ']'
|
|
50
50
|
};
|
|
51
|
+
/**
|
|
52
|
+
* The current getFormatHelperText method uses an outdated format parsing logic.
|
|
53
|
+
* We should use this one in the future to support all localized formats.
|
|
54
|
+
*/
|
|
51
55
|
this.expandFormat = format => {
|
|
52
56
|
// @see https://github.com/moment/moment/blob/develop/src/lib/format/format.js#L6
|
|
53
57
|
const localFormattingTokens = /(\[[^[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})|./g;
|
|
@@ -59,6 +63,7 @@ export class AdapterMomentHijri extends BaseAdapterMomentHijri {
|
|
|
59
63
|
return token;
|
|
60
64
|
}).join('').replace('dd', 'iDD'); // Fix for https://github.com/dmtrKovalenko/date-io/pull/632
|
|
61
65
|
};
|
|
66
|
+
// Redefined here just to show how it can be written using expandFormat
|
|
62
67
|
this.getFormatHelperText = format => {
|
|
63
68
|
return this.expandFormat(format).replace(/a/gi, '(a|p)m').replace('iY', 'Y').replace('iM', 'M').replace('iD', 'D').toLocaleLowerCase();
|
|
64
69
|
};
|
|
@@ -45,6 +45,10 @@ export class AdapterMomentJalaali extends BaseAdapterMomentJalaali {
|
|
|
45
45
|
start: '[',
|
|
46
46
|
end: ']'
|
|
47
47
|
};
|
|
48
|
+
/**
|
|
49
|
+
* The current getFormatHelperText method uses an outdated format parsing logic.
|
|
50
|
+
* We should use this one in the future to support all localized formats.
|
|
51
|
+
*/
|
|
48
52
|
this.expandFormat = format => {
|
|
49
53
|
// @see https://github.com/moment/moment/blob/develop/src/lib/format/format.js#L6
|
|
50
54
|
const localFormattingTokens = /(\[[^[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})|./g;
|
|
@@ -56,6 +60,7 @@ export class AdapterMomentJalaali extends BaseAdapterMomentJalaali {
|
|
|
56
60
|
return token;
|
|
57
61
|
}).join('').replace('dd', 'jDD'); // Fix for https://github.com/dmtrKovalenko/date-io/pull/632;
|
|
58
62
|
};
|
|
63
|
+
// Redefined here just to show how it can be written using expandFormat
|
|
59
64
|
this.getFormatHelperText = format => {
|
|
60
65
|
return this.expandFormat(format).replace(/a/gi, '(a|p)m').replace('jY', 'Y').replace('jM', 'M').replace('jD', 'D').toLocaleLowerCase();
|
|
61
66
|
};
|
|
@@ -268,6 +268,10 @@ process.env.NODE_ENV !== "production" ? DateField.propTypes = {
|
|
|
268
268
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
269
269
|
*/
|
|
270
270
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
271
|
+
/**
|
|
272
|
+
* The ref object used to imperatively interact with the field.
|
|
273
|
+
*/
|
|
274
|
+
unstableFieldRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
271
275
|
/**
|
|
272
276
|
* The selected value.
|
|
273
277
|
* Used when the component is controlled.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["value", "defaultValue", "format", "onChange", "readOnly", "onError", "shouldDisableDate", "shouldDisableMonth", "shouldDisableYear", "minDate", "maxDate", "disableFuture", "disablePast", "selectedSections", "onSelectedSectionsChange"];
|
|
3
|
+
const _excluded = ["value", "defaultValue", "format", "onChange", "readOnly", "onError", "shouldDisableDate", "shouldDisableMonth", "shouldDisableYear", "minDate", "maxDate", "disableFuture", "disablePast", "selectedSections", "onSelectedSectionsChange", "unstableFieldRef"];
|
|
4
4
|
import { singleItemFieldValueManager, singleItemValueManager } from '../internals/utils/valueManagers';
|
|
5
5
|
import { useField } from '../internals/hooks/useField';
|
|
6
6
|
import { validateDate } from '../internals/hooks/validation/useDateValidation';
|
|
@@ -37,7 +37,8 @@ export const useDateField = ({
|
|
|
37
37
|
disableFuture,
|
|
38
38
|
disablePast,
|
|
39
39
|
selectedSections,
|
|
40
|
-
onSelectedSectionsChange
|
|
40
|
+
onSelectedSectionsChange,
|
|
41
|
+
unstableFieldRef
|
|
41
42
|
} = _useDefaultizedDateFi,
|
|
42
43
|
other = _objectWithoutPropertiesLoose(_useDefaultizedDateFi, _excluded);
|
|
43
44
|
return useField({
|
|
@@ -58,7 +59,8 @@ export const useDateField = ({
|
|
|
58
59
|
disableFuture,
|
|
59
60
|
disablePast,
|
|
60
61
|
selectedSections,
|
|
61
|
-
onSelectedSectionsChange
|
|
62
|
+
onSelectedSectionsChange,
|
|
63
|
+
unstableFieldRef
|
|
62
64
|
},
|
|
63
65
|
valueManager: singleItemValueManager,
|
|
64
66
|
fieldValueManager: singleItemFieldValueManager,
|
|
@@ -316,6 +316,10 @@ process.env.NODE_ENV !== "production" ? DateTimeField.propTypes = {
|
|
|
316
316
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
317
317
|
*/
|
|
318
318
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
319
|
+
/**
|
|
320
|
+
* The ref object used to imperatively interact with the field.
|
|
321
|
+
*/
|
|
322
|
+
unstableFieldRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
319
323
|
/**
|
|
320
324
|
* The selected value.
|
|
321
325
|
* Used when the component is controlled.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["value", "defaultValue", "format", "onChange", "readOnly", "onError", "shouldDisableDate", "shouldDisableMonth", "shouldDisableYear", "minDate", "maxDate", "disableFuture", "disablePast", "minTime", "maxTime", "minDateTime", "maxDateTime", "minutesStep", "disableIgnoringDatePartForTimeValidation", "shouldDisableClock", "shouldDisableTime", "selectedSections", "onSelectedSectionsChange", "ampm"];
|
|
3
|
+
const _excluded = ["value", "defaultValue", "format", "onChange", "readOnly", "onError", "shouldDisableDate", "shouldDisableMonth", "shouldDisableYear", "minDate", "maxDate", "disableFuture", "disablePast", "minTime", "maxTime", "minDateTime", "maxDateTime", "minutesStep", "disableIgnoringDatePartForTimeValidation", "shouldDisableClock", "shouldDisableTime", "selectedSections", "onSelectedSectionsChange", "ampm", "unstableFieldRef"];
|
|
4
4
|
import { singleItemFieldValueManager, singleItemValueManager } from '../internals/utils/valueManagers';
|
|
5
5
|
import { useField } from '../internals/hooks/useField';
|
|
6
6
|
import { validateDateTime } from '../internals/hooks/validation/useDateTimeValidation';
|
|
@@ -49,7 +49,8 @@ export const useDateTimeField = ({
|
|
|
49
49
|
shouldDisableTime,
|
|
50
50
|
selectedSections,
|
|
51
51
|
onSelectedSectionsChange,
|
|
52
|
-
ampm
|
|
52
|
+
ampm,
|
|
53
|
+
unstableFieldRef
|
|
53
54
|
} = _useDefaultizedDateTi,
|
|
54
55
|
other = _objectWithoutPropertiesLoose(_useDefaultizedDateTi, _excluded);
|
|
55
56
|
return useField({
|
|
@@ -77,7 +78,8 @@ export const useDateTimeField = ({
|
|
|
77
78
|
disableIgnoringDatePartForTimeValidation,
|
|
78
79
|
selectedSections,
|
|
79
80
|
onSelectedSectionsChange,
|
|
80
|
-
ampm
|
|
81
|
+
ampm,
|
|
82
|
+
unstableFieldRef
|
|
81
83
|
},
|
|
82
84
|
valueManager: singleItemValueManager,
|
|
83
85
|
fieldValueManager: singleItemFieldValueManager,
|
|
@@ -36,16 +36,16 @@ const styleArg = ({
|
|
|
36
36
|
height: DAY_SIZE,
|
|
37
37
|
borderRadius: '50%',
|
|
38
38
|
padding: 0,
|
|
39
|
-
//
|
|
40
|
-
backgroundColor:
|
|
39
|
+
// explicitly setting to `transparent` to avoid potentially getting impacted by change from the overridden component
|
|
40
|
+
backgroundColor: 'transparent',
|
|
41
41
|
color: (theme.vars || theme).palette.text.primary,
|
|
42
42
|
'@media (pointer: fine)': {
|
|
43
43
|
'&:hover': {
|
|
44
|
-
backgroundColor: theme.vars ? `rgba(${theme.vars.palette.
|
|
44
|
+
backgroundColor: theme.vars ? `rgba(${theme.vars.palette.primary.mainChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha(theme.palette.primary.main, theme.palette.action.hoverOpacity)
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
'&:focus': {
|
|
48
|
-
backgroundColor: theme.vars ? `rgba(${theme.vars.palette.
|
|
48
|
+
backgroundColor: theme.vars ? `rgba(${theme.vars.palette.primary.mainChannel} / ${theme.vars.palette.action.focusOpacity})` : alpha(theme.palette.primary.main, theme.palette.action.focusOpacity),
|
|
49
49
|
[`&.${pickersDayClasses.selected}`]: {
|
|
50
50
|
willChange: 'background-color',
|
|
51
51
|
backgroundColor: (theme.vars || theme).palette.primary.dark
|
|
@@ -279,6 +279,10 @@ process.env.NODE_ENV !== "production" ? TimeField.propTypes = {
|
|
|
279
279
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
280
280
|
*/
|
|
281
281
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
282
|
+
/**
|
|
283
|
+
* The ref object used to imperatively interact with the field.
|
|
284
|
+
*/
|
|
285
|
+
unstableFieldRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
282
286
|
/**
|
|
283
287
|
* The selected value.
|
|
284
288
|
* Used when the component is controlled.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["value", "defaultValue", "format", "onChange", "readOnly", "onError", "disableFuture", "disablePast", "minTime", "maxTime", "minutesStep", "shouldDisableClock", "shouldDisableTime", "disableIgnoringDatePartForTimeValidation", "selectedSections", "onSelectedSectionsChange", "ampm"];
|
|
3
|
+
const _excluded = ["value", "defaultValue", "format", "onChange", "readOnly", "onError", "disableFuture", "disablePast", "minTime", "maxTime", "minutesStep", "shouldDisableClock", "shouldDisableTime", "disableIgnoringDatePartForTimeValidation", "selectedSections", "onSelectedSectionsChange", "ampm", "unstableFieldRef"];
|
|
4
4
|
import { singleItemFieldValueManager, singleItemValueManager } from '../internals/utils/valueManagers';
|
|
5
5
|
import { useField } from '../internals/hooks/useField';
|
|
6
6
|
import { validateTime } from '../internals/hooks/validation/useTimeValidation';
|
|
@@ -37,7 +37,8 @@ export const useTimeField = ({
|
|
|
37
37
|
disableIgnoringDatePartForTimeValidation,
|
|
38
38
|
selectedSections,
|
|
39
39
|
onSelectedSectionsChange,
|
|
40
|
-
ampm
|
|
40
|
+
ampm,
|
|
41
|
+
unstableFieldRef
|
|
41
42
|
} = _useDefaultizedTimeFi,
|
|
42
43
|
other = _objectWithoutPropertiesLoose(_useDefaultizedTimeFi, _excluded);
|
|
43
44
|
return useField({
|
|
@@ -60,7 +61,8 @@ export const useTimeField = ({
|
|
|
60
61
|
disableIgnoringDatePartForTimeValidation,
|
|
61
62
|
selectedSections,
|
|
62
63
|
onSelectedSectionsChange,
|
|
63
|
-
ampm
|
|
64
|
+
ampm,
|
|
65
|
+
unstableFieldRef
|
|
64
66
|
},
|
|
65
67
|
valueManager: singleItemValueManager,
|
|
66
68
|
fieldValueManager: singleItemFieldValueManager,
|
package/modern/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-date-pickers v6.0.
|
|
2
|
+
* @mui/x-date-pickers v6.0.3
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -14,6 +14,7 @@ export * from './locales';
|
|
|
14
14
|
export * from './DateField';
|
|
15
15
|
export * from './TimeField';
|
|
16
16
|
export * from './DateTimeField';
|
|
17
|
+
|
|
17
18
|
// Calendars
|
|
18
19
|
export * from './DateCalendar';
|
|
19
20
|
export * from './MonthCalendar';
|
|
@@ -42,4 +43,5 @@ export * from './timeViewRenderers';
|
|
|
42
43
|
export * from './PickersLayout';
|
|
43
44
|
export * from './PickersActionBar';
|
|
44
45
|
export * from './PickersShortcuts';
|
|
45
|
-
export { DEFAULT_DESKTOP_MODE_MEDIA_QUERY } from './internals/utils/utils';
|
|
46
|
+
export { DEFAULT_DESKTOP_MODE_MEDIA_QUERY } from './internals/utils/utils';
|
|
47
|
+
export * from './models';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { useField } from './useField';
|
|
2
|
-
export { splitFormatIntoSections, addPositionPropertiesToSections, createDateStrForInputFromSections
|
|
2
|
+
export { splitFormatIntoSections, addPositionPropertiesToSections, createDateStrForInputFromSections } from './useField.utils';
|