@mui/x-date-pickers 7.21.0 → 7.22.1
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/CHANGELOG.md +142 -0
- package/DateCalendar/DayCalendar.js +3 -4
- package/DateCalendar/useCalendarState.d.ts +3 -1
- package/DateCalendar/useCalendarState.js +27 -2
- package/DigitalClock/DigitalClock.js +8 -4
- package/index.js +1 -1
- package/locales/plPL.js +13 -16
- package/modern/DateCalendar/DayCalendar.js +3 -4
- package/modern/DateCalendar/useCalendarState.js +27 -2
- package/modern/DigitalClock/DigitalClock.js +8 -4
- package/modern/index.js +1 -1
- package/modern/locales/plPL.js +13 -16
- package/node/DateCalendar/DayCalendar.js +3 -4
- package/node/DateCalendar/useCalendarState.js +27 -2
- package/node/DigitalClock/DigitalClock.js +8 -4
- package/node/index.js +1 -1
- package/node/locales/plPL.js +13 -16
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,148 @@
|
|
|
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
|
+
## 7.22.1
|
|
7
|
+
|
|
8
|
+
_Nov 1, 2024_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 7 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🐞 Bugfixes
|
|
13
|
+
- 📚 Documentation improvements
|
|
14
|
+
- 🌍 Improve Polish (pl-PL) locale on the Date Pickers
|
|
15
|
+
|
|
16
|
+
Special thanks go out to the community contributors who have helped make this release possible:
|
|
17
|
+
@wojtkolos, @dpak-maurya, @k-rajat19.
|
|
18
|
+
Following are all team members who have contributed to this release:
|
|
19
|
+
@LukasTy, @arminmeh, @MBilalShafi, @KenanYusuf, @flaviendelangle.
|
|
20
|
+
|
|
21
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
22
|
+
|
|
23
|
+
### Data Grid
|
|
24
|
+
|
|
25
|
+
#### `@mui/x-data-grid@7.22.1`
|
|
26
|
+
|
|
27
|
+
- [DataGrid] Fix right column group header border (#15152) @KenanYusuf
|
|
28
|
+
- [DataGrid] Fix scroll jump when holding down arrow keys (#15167) @arminmeh
|
|
29
|
+
- [DataGrid] Move `rowGroupingModelChange` handler to respective hook (#15127) @MBilalShafi
|
|
30
|
+
- [DataGrid] Prevent error when deleting the last row (#15153) @dpak-maurya
|
|
31
|
+
- [DataGrid] Fix overlay height in autoHeight mode (#15205) @cherniavskii
|
|
32
|
+
|
|
33
|
+
#### `@mui/x-data-grid-pro@7.22.1` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
34
|
+
|
|
35
|
+
Same changes as in `@mui/x-data-grid@7.22.1`, plus:
|
|
36
|
+
|
|
37
|
+
- [DataGridPro] Add list view tests (#15166) @KenanYusuf
|
|
38
|
+
|
|
39
|
+
#### `@mui/x-data-grid-premium@7.22.1` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
40
|
+
|
|
41
|
+
- [DataGridPremium] Keep focus on the grouping cell on space bar press #15155 @k-rajat19
|
|
42
|
+
|
|
43
|
+
### Date and Time Pickers
|
|
44
|
+
|
|
45
|
+
#### `@mui/x-date-pickers@7.22.1`
|
|
46
|
+
|
|
47
|
+
- [l10n] Improve Polish (pl-PL) locale (#15177) @wojtkolos
|
|
48
|
+
|
|
49
|
+
#### `@mui/x-date-pickers-pro@7.22.1` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
50
|
+
|
|
51
|
+
Same changes as in `@mui/x-date-pickers@7.22.1`.
|
|
52
|
+
|
|
53
|
+
### Tree View
|
|
54
|
+
|
|
55
|
+
#### `@mui/x-tree-view@7.22.1`
|
|
56
|
+
|
|
57
|
+
- [TreeView] Export `TreeItem2DragAndDropOverlay` and `TreeItem2LabelInput` from the root of each package (#15208) @flaviendelangle
|
|
58
|
+
- [TreeView] Fix drag and drop color usage (#15149) @LukasTy
|
|
59
|
+
|
|
60
|
+
#### `@mui/x-tree-view-pro@7.22.1` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
61
|
+
|
|
62
|
+
Same changes as in `@mui/x-tree-view@7.22.1`.
|
|
63
|
+
|
|
64
|
+
### Docs
|
|
65
|
+
|
|
66
|
+
- [docs] Add section explaining how to keep the selection while filtering in Data grid docs (#15199) @arminmeh
|
|
67
|
+
|
|
68
|
+
## 7.22.0
|
|
69
|
+
|
|
70
|
+
_Oct 25, 2024_
|
|
71
|
+
|
|
72
|
+
We'd like to offer a big thanks to the 11 contributors who made this release possible. Here are some highlights ✨:
|
|
73
|
+
|
|
74
|
+
- 🛰 Introduce [server-side support for Data Grid row grouping](https://mui.com/x/react-data-grid/server-side-data/row-grouping/)
|
|
75
|
+
- 🐞 Bugfixes
|
|
76
|
+
- 📚 Documentation improvements
|
|
77
|
+
- 🌍 Improve Portuguese (pt-BR) locale on the Data Grid component
|
|
78
|
+
|
|
79
|
+
Special thanks go out to the community contributors who have helped make this release possible:
|
|
80
|
+
@clins1994, @GITPHLAP, @k-rajat19, @kalyan90, @merotosc, @yash49.
|
|
81
|
+
Following are all team members who have contributed to this release:
|
|
82
|
+
@cherniavskii, @flaviendelangle, @LukasTy, @MBilalShafi, @romgrk.
|
|
83
|
+
|
|
84
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
85
|
+
|
|
86
|
+
### Data Grid
|
|
87
|
+
|
|
88
|
+
#### `@mui/x-data-grid@7.22.0`
|
|
89
|
+
|
|
90
|
+
- [DataGrid] Fix `GridPanelAnchor` positioning (#15022) @k-rajat19
|
|
91
|
+
- [DataGrid] Fix ugly prop-types for the `pageStyle` prop of the `GridPrintExportMenuItem` component (#15015) @flaviendelangle
|
|
92
|
+
- [DataGrid] Fix value type in filter model for number and boolean column type (#14733) @k-rajat19
|
|
93
|
+
- [DataGrid] Focus next row when the focused row is deleted (#15067) @cherniavskii
|
|
94
|
+
- [DataGrid] Remove some usages of `<Box />` and `<Badge />` (#15013) @romgrk
|
|
95
|
+
- [DataGrid] Fix number of rows to display for page size options with negative value (#14890) @kalyan90
|
|
96
|
+
- [l10n] Improve Portuguese (pt-BR) locale (#15021) @k-rajat19
|
|
97
|
+
|
|
98
|
+
#### `@mui/x-data-grid-pro@7.22.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
99
|
+
|
|
100
|
+
Same changes as in `@mui/x-data-grid@7.22.0`, plus:
|
|
101
|
+
|
|
102
|
+
- [DataGridPro] Fix column pinning layout (#15073) @cherniavskii
|
|
103
|
+
|
|
104
|
+
#### `@mui/x-data-grid-premium@7.22.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
105
|
+
|
|
106
|
+
Same changes as in `@mui/x-data-grid-pro@7.22.0`, plus:
|
|
107
|
+
|
|
108
|
+
- [DataGridPremium] Server-side data source with row grouping (#15109) @MBilalShafi
|
|
109
|
+
|
|
110
|
+
### Date and Time Pickers
|
|
111
|
+
|
|
112
|
+
#### `@mui/x-date-pickers@7.22.0`
|
|
113
|
+
|
|
114
|
+
- [pickers] Fix `DateCalendar` timezone management (#15119) @LukasTy
|
|
115
|
+
- [pickers] Fix `DigitalClock` time options on a `DST` switch day (#15092) @LukasTy
|
|
116
|
+
|
|
117
|
+
#### `@mui/x-date-pickers-pro@7.22.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
118
|
+
|
|
119
|
+
Same changes as in `@mui/x-date-pickers@7.22.0`.
|
|
120
|
+
|
|
121
|
+
### Charts
|
|
122
|
+
|
|
123
|
+
#### `@mui/x-charts@7.22.0`
|
|
124
|
+
|
|
125
|
+
- [charts] Export data type in `onAxisClick(_, data)` callback (#15038) @clins1994
|
|
126
|
+
|
|
127
|
+
#### `@mui/x-charts-pro@7.0.0-beta.6` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
128
|
+
|
|
129
|
+
Same changes as in `@mui/x-charts@7.22.0`.
|
|
130
|
+
|
|
131
|
+
### Tree View
|
|
132
|
+
|
|
133
|
+
#### `@mui/x-tree-view@7.22.0`
|
|
134
|
+
|
|
135
|
+
- [TreeView] Make the cancellable event types public (#14992) @flaviendelangle
|
|
136
|
+
|
|
137
|
+
### Docs
|
|
138
|
+
|
|
139
|
+
- [docs] Fix typo in Tree View docs (#15047) @yash49
|
|
140
|
+
|
|
141
|
+
### Core
|
|
142
|
+
|
|
143
|
+
- [core] Adjust cherry-pick GH actions (#15101) @LukasTy
|
|
144
|
+
- [core] Update prettier target branch (#15100) @MBilalShafi
|
|
145
|
+
- [core] Update some `default-branch-switch` instances for `v7.x` (#15085) @MBilalShafi
|
|
146
|
+
- [test] Revert to using `fireEvent` instead of `userEvent` (#14927) @LukasTy
|
|
147
|
+
|
|
6
148
|
## 7.21.0
|
|
7
149
|
|
|
8
150
|
_Oct 17, 2024_
|
|
@@ -378,9 +378,8 @@ export function DayCalendar(inProps) {
|
|
|
378
378
|
return internalFocusedDay;
|
|
379
379
|
}, [currentMonth, disableFuture, disablePast, internalFocusedDay, isDateDisabled, utils, timezone]);
|
|
380
380
|
const weeksToDisplay = React.useMemo(() => {
|
|
381
|
-
const
|
|
382
|
-
|
|
383
|
-
let nextMonth = utils.addMonths(currentMonthWithTimezone, 1);
|
|
381
|
+
const toDisplay = utils.getWeekArray(currentMonth);
|
|
382
|
+
let nextMonth = utils.addMonths(currentMonth, 1);
|
|
384
383
|
while (fixedWeekNumber && toDisplay.length < fixedWeekNumber) {
|
|
385
384
|
const additionalWeeks = utils.getWeekArray(nextMonth);
|
|
386
385
|
const hasCommonWeek = utils.isSameDay(toDisplay[toDisplay.length - 1][0], additionalWeeks[0][0]);
|
|
@@ -392,7 +391,7 @@ export function DayCalendar(inProps) {
|
|
|
392
391
|
nextMonth = utils.addMonths(nextMonth, 1);
|
|
393
392
|
}
|
|
394
393
|
return toDisplay;
|
|
395
|
-
}, [currentMonth, fixedWeekNumber, utils
|
|
394
|
+
}, [currentMonth, fixedWeekNumber, utils]);
|
|
396
395
|
return /*#__PURE__*/_jsxs(PickersCalendarDayRoot, {
|
|
397
396
|
role: "grid",
|
|
398
397
|
"aria-labelledby": gridLabelId,
|
|
@@ -22,7 +22,9 @@ interface ChangeFocusedDayPayload<TDate extends PickerValidDate> {
|
|
|
22
22
|
*/
|
|
23
23
|
withoutMonthSwitchingAnimation?: boolean;
|
|
24
24
|
}
|
|
25
|
-
export declare const createCalendarStateReducer: <TDate extends PickerValidDate>(reduceAnimations: boolean, disableSwitchToMonthOnDayFocus: boolean, utils: MuiPickersAdapter<TDate>) => (state: CalendarState<TDate>, action: ReducerAction<"finishMonthSwitchingAnimation"> | ReducerAction<"changeMonth", ChangeMonthPayload<TDate>> | ReducerAction<"
|
|
25
|
+
export declare const createCalendarStateReducer: <TDate extends PickerValidDate>(reduceAnimations: boolean, disableSwitchToMonthOnDayFocus: boolean, utils: MuiPickersAdapter<TDate>) => (state: CalendarState<TDate>, action: ReducerAction<"finishMonthSwitchingAnimation"> | ReducerAction<"changeMonth", ChangeMonthPayload<TDate>> | ReducerAction<"changeMonthTimezone", {
|
|
26
|
+
newTimezone: string;
|
|
27
|
+
}> | ReducerAction<"changeFocusedDay", ChangeFocusedDayPayload<TDate>>) => CalendarState<TDate>;
|
|
26
28
|
interface UseCalendarStateParams<TDate extends PickerValidDate> extends Pick<DateCalendarDefaultizedProps<TDate>, 'value' | 'referenceDate' | 'disableFuture' | 'disablePast' | 'minDate' | 'maxDate' | 'onMonthChange' | 'reduceAnimations' | 'shouldDisableDate'> {
|
|
27
29
|
disableSwitchToMonthOnDayFocus?: boolean;
|
|
28
30
|
timezone: PickersTimezone;
|
|
@@ -15,6 +15,20 @@ export const createCalendarStateReducer = (reduceAnimations, disableSwitchToMont
|
|
|
15
15
|
currentMonth: action.newMonth,
|
|
16
16
|
isMonthSwitchingAnimating: !reduceAnimations
|
|
17
17
|
});
|
|
18
|
+
case 'changeMonthTimezone':
|
|
19
|
+
{
|
|
20
|
+
const newTimezone = action.newTimezone;
|
|
21
|
+
if (utils.getTimezone(state.currentMonth) === newTimezone) {
|
|
22
|
+
return state;
|
|
23
|
+
}
|
|
24
|
+
let newCurrentMonth = utils.setTimezone(state.currentMonth, newTimezone);
|
|
25
|
+
if (utils.getMonth(newCurrentMonth) !== utils.getMonth(state.currentMonth)) {
|
|
26
|
+
newCurrentMonth = utils.setMonth(newCurrentMonth, utils.getMonth(state.currentMonth));
|
|
27
|
+
}
|
|
28
|
+
return _extends({}, state, {
|
|
29
|
+
currentMonth: newCurrentMonth
|
|
30
|
+
});
|
|
31
|
+
}
|
|
18
32
|
case 'finishMonthSwitchingAnimation':
|
|
19
33
|
return _extends({}, state, {
|
|
20
34
|
isMonthSwitchingAnimating: false
|
|
@@ -61,14 +75,25 @@ export const useCalendarState = params => {
|
|
|
61
75
|
referenceDate: referenceDateProp,
|
|
62
76
|
granularity: SECTION_TYPE_GRANULARITY.day
|
|
63
77
|
});
|
|
64
|
-
},
|
|
65
|
-
)
|
|
78
|
+
},
|
|
79
|
+
// We want the `referenceDate` to update on prop and `timezone` change (https://github.com/mui/mui-x/issues/10804)
|
|
80
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
81
|
+
[referenceDateProp, timezone]);
|
|
66
82
|
const [calendarState, dispatch] = React.useReducer(reducerFn, {
|
|
67
83
|
isMonthSwitchingAnimating: false,
|
|
68
84
|
focusedDay: referenceDate,
|
|
69
85
|
currentMonth: utils.startOfMonth(referenceDate),
|
|
70
86
|
slideDirection: 'left'
|
|
71
87
|
});
|
|
88
|
+
|
|
89
|
+
// Ensure that `calendarState.currentMonth` timezone is updated when `referenceDate` (or timezone changes)
|
|
90
|
+
// https://github.com/mui/mui-x/issues/10804
|
|
91
|
+
React.useEffect(() => {
|
|
92
|
+
dispatch({
|
|
93
|
+
type: 'changeMonthTimezone',
|
|
94
|
+
newTimezone: utils.getTimezone(referenceDate)
|
|
95
|
+
});
|
|
96
|
+
}, [referenceDate, utils]);
|
|
72
97
|
const handleChangeMonth = React.useCallback(payload => {
|
|
73
98
|
dispatch(_extends({
|
|
74
99
|
type: 'changeMonth'
|
|
@@ -232,10 +232,14 @@ export const DigitalClock = /*#__PURE__*/React.forwardRef(function DigitalClock(
|
|
|
232
232
|
return !containsValidTime() || !isValidValue();
|
|
233
233
|
}, [disableIgnoringDatePartForTimeValidation, utils, minTime, maxTime, disableFuture, now, disablePast, minutesStep, shouldDisableTime]);
|
|
234
234
|
const timeOptions = React.useMemo(() => {
|
|
235
|
+
const result = [];
|
|
235
236
|
const startOfDay = utils.startOfDay(valueOrReferenceDate);
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
237
|
+
let nextTimeStepOption = startOfDay;
|
|
238
|
+
while (utils.isSameDay(valueOrReferenceDate, nextTimeStepOption)) {
|
|
239
|
+
result.push(nextTimeStepOption);
|
|
240
|
+
nextTimeStepOption = utils.addMinutes(nextTimeStepOption, timeStep);
|
|
241
|
+
}
|
|
242
|
+
return result;
|
|
239
243
|
}, [valueOrReferenceDate, timeStep, utils]);
|
|
240
244
|
const focusedOptionIndex = timeOptions.findIndex(option => utils.isEqual(option, valueOrReferenceDate));
|
|
241
245
|
const handleKeyDown = event => {
|
|
@@ -298,7 +302,7 @@ export const DigitalClock = /*#__PURE__*/React.forwardRef(function DigitalClock(
|
|
|
298
302
|
tabIndex: tabIndex
|
|
299
303
|
}, clockItemProps, {
|
|
300
304
|
children: formattedValue
|
|
301
|
-
}), formattedValue);
|
|
305
|
+
}), `${option.valueOf()}-${formattedValue}`);
|
|
302
306
|
})
|
|
303
307
|
})
|
|
304
308
|
}));
|
package/index.js
CHANGED
package/locales/plPL.js
CHANGED
|
@@ -16,11 +16,10 @@ const plPLPickers = {
|
|
|
16
16
|
// DateRange labels
|
|
17
17
|
start: 'Początek',
|
|
18
18
|
end: 'Koniec',
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
startDate: 'Data rozpoczęcia',
|
|
20
|
+
startTime: 'Czas rozpoczęcia',
|
|
21
|
+
endDate: 'Data zakończenia',
|
|
22
|
+
endTime: 'Czas zakończenia',
|
|
24
23
|
// Action bar
|
|
25
24
|
cancelButtonLabel: 'Anuluj',
|
|
26
25
|
clearButtonLabel: 'Wyczyść',
|
|
@@ -46,12 +45,10 @@ const plPLPickers = {
|
|
|
46
45
|
// Open picker labels
|
|
47
46
|
openDatePickerDialogue: (value, utils, formattedDate) => value != null && utils.isValid(value) ? `Wybierz datę, obecnie wybrana data to ${formattedDate ?? utils.format(value, 'fullDate')}` : 'Wybierz datę',
|
|
48
47
|
openTimePickerDialogue: (value, utils, formattedTime) => formattedTime || value !== null && utils.isValid(value) ? `Wybierz czas, obecnie wybrany czas to ${formattedTime ?? utils.format(value, 'fullTime')}` : 'Wybierz czas',
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
fieldClearLabel: 'Wyczyść',
|
|
51
49
|
// Table labels
|
|
52
50
|
timeTableLabel: 'wybierz czas',
|
|
53
|
-
dateTableLabel: 'wybierz datę'
|
|
54
|
-
|
|
51
|
+
dateTableLabel: 'wybierz datę',
|
|
55
52
|
// Field section placeholders
|
|
56
53
|
// fieldYearPlaceholder: params => 'Y'.repeat(params.digitAmount),
|
|
57
54
|
// fieldMonthPlaceholder: params => params.contentType === 'letter' ? 'MMMM' : 'MM',
|
|
@@ -63,13 +60,13 @@ const plPLPickers = {
|
|
|
63
60
|
// fieldMeridiemPlaceholder: () => 'aa',
|
|
64
61
|
|
|
65
62
|
// View names
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
63
|
+
year: 'Rok',
|
|
64
|
+
month: 'Miesiąc',
|
|
65
|
+
day: 'Dzień',
|
|
66
|
+
weekDay: 'Dzień tygodnia',
|
|
67
|
+
hours: 'Godzin',
|
|
68
|
+
minutes: 'Minut',
|
|
69
|
+
seconds: 'Sekund'
|
|
73
70
|
// meridiem: 'Meridiem',
|
|
74
71
|
|
|
75
72
|
// Common
|
|
@@ -378,9 +378,8 @@ export function DayCalendar(inProps) {
|
|
|
378
378
|
return internalFocusedDay;
|
|
379
379
|
}, [currentMonth, disableFuture, disablePast, internalFocusedDay, isDateDisabled, utils, timezone]);
|
|
380
380
|
const weeksToDisplay = React.useMemo(() => {
|
|
381
|
-
const
|
|
382
|
-
|
|
383
|
-
let nextMonth = utils.addMonths(currentMonthWithTimezone, 1);
|
|
381
|
+
const toDisplay = utils.getWeekArray(currentMonth);
|
|
382
|
+
let nextMonth = utils.addMonths(currentMonth, 1);
|
|
384
383
|
while (fixedWeekNumber && toDisplay.length < fixedWeekNumber) {
|
|
385
384
|
const additionalWeeks = utils.getWeekArray(nextMonth);
|
|
386
385
|
const hasCommonWeek = utils.isSameDay(toDisplay[toDisplay.length - 1][0], additionalWeeks[0][0]);
|
|
@@ -392,7 +391,7 @@ export function DayCalendar(inProps) {
|
|
|
392
391
|
nextMonth = utils.addMonths(nextMonth, 1);
|
|
393
392
|
}
|
|
394
393
|
return toDisplay;
|
|
395
|
-
}, [currentMonth, fixedWeekNumber, utils
|
|
394
|
+
}, [currentMonth, fixedWeekNumber, utils]);
|
|
396
395
|
return /*#__PURE__*/_jsxs(PickersCalendarDayRoot, {
|
|
397
396
|
role: "grid",
|
|
398
397
|
"aria-labelledby": gridLabelId,
|
|
@@ -15,6 +15,20 @@ export const createCalendarStateReducer = (reduceAnimations, disableSwitchToMont
|
|
|
15
15
|
currentMonth: action.newMonth,
|
|
16
16
|
isMonthSwitchingAnimating: !reduceAnimations
|
|
17
17
|
});
|
|
18
|
+
case 'changeMonthTimezone':
|
|
19
|
+
{
|
|
20
|
+
const newTimezone = action.newTimezone;
|
|
21
|
+
if (utils.getTimezone(state.currentMonth) === newTimezone) {
|
|
22
|
+
return state;
|
|
23
|
+
}
|
|
24
|
+
let newCurrentMonth = utils.setTimezone(state.currentMonth, newTimezone);
|
|
25
|
+
if (utils.getMonth(newCurrentMonth) !== utils.getMonth(state.currentMonth)) {
|
|
26
|
+
newCurrentMonth = utils.setMonth(newCurrentMonth, utils.getMonth(state.currentMonth));
|
|
27
|
+
}
|
|
28
|
+
return _extends({}, state, {
|
|
29
|
+
currentMonth: newCurrentMonth
|
|
30
|
+
});
|
|
31
|
+
}
|
|
18
32
|
case 'finishMonthSwitchingAnimation':
|
|
19
33
|
return _extends({}, state, {
|
|
20
34
|
isMonthSwitchingAnimating: false
|
|
@@ -61,14 +75,25 @@ export const useCalendarState = params => {
|
|
|
61
75
|
referenceDate: referenceDateProp,
|
|
62
76
|
granularity: SECTION_TYPE_GRANULARITY.day
|
|
63
77
|
});
|
|
64
|
-
},
|
|
65
|
-
)
|
|
78
|
+
},
|
|
79
|
+
// We want the `referenceDate` to update on prop and `timezone` change (https://github.com/mui/mui-x/issues/10804)
|
|
80
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
81
|
+
[referenceDateProp, timezone]);
|
|
66
82
|
const [calendarState, dispatch] = React.useReducer(reducerFn, {
|
|
67
83
|
isMonthSwitchingAnimating: false,
|
|
68
84
|
focusedDay: referenceDate,
|
|
69
85
|
currentMonth: utils.startOfMonth(referenceDate),
|
|
70
86
|
slideDirection: 'left'
|
|
71
87
|
});
|
|
88
|
+
|
|
89
|
+
// Ensure that `calendarState.currentMonth` timezone is updated when `referenceDate` (or timezone changes)
|
|
90
|
+
// https://github.com/mui/mui-x/issues/10804
|
|
91
|
+
React.useEffect(() => {
|
|
92
|
+
dispatch({
|
|
93
|
+
type: 'changeMonthTimezone',
|
|
94
|
+
newTimezone: utils.getTimezone(referenceDate)
|
|
95
|
+
});
|
|
96
|
+
}, [referenceDate, utils]);
|
|
72
97
|
const handleChangeMonth = React.useCallback(payload => {
|
|
73
98
|
dispatch(_extends({
|
|
74
99
|
type: 'changeMonth'
|
|
@@ -232,10 +232,14 @@ export const DigitalClock = /*#__PURE__*/React.forwardRef(function DigitalClock(
|
|
|
232
232
|
return !containsValidTime() || !isValidValue();
|
|
233
233
|
}, [disableIgnoringDatePartForTimeValidation, utils, minTime, maxTime, disableFuture, now, disablePast, minutesStep, shouldDisableTime]);
|
|
234
234
|
const timeOptions = React.useMemo(() => {
|
|
235
|
+
const result = [];
|
|
235
236
|
const startOfDay = utils.startOfDay(valueOrReferenceDate);
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
237
|
+
let nextTimeStepOption = startOfDay;
|
|
238
|
+
while (utils.isSameDay(valueOrReferenceDate, nextTimeStepOption)) {
|
|
239
|
+
result.push(nextTimeStepOption);
|
|
240
|
+
nextTimeStepOption = utils.addMinutes(nextTimeStepOption, timeStep);
|
|
241
|
+
}
|
|
242
|
+
return result;
|
|
239
243
|
}, [valueOrReferenceDate, timeStep, utils]);
|
|
240
244
|
const focusedOptionIndex = timeOptions.findIndex(option => utils.isEqual(option, valueOrReferenceDate));
|
|
241
245
|
const handleKeyDown = event => {
|
|
@@ -298,7 +302,7 @@ export const DigitalClock = /*#__PURE__*/React.forwardRef(function DigitalClock(
|
|
|
298
302
|
tabIndex: tabIndex
|
|
299
303
|
}, clockItemProps, {
|
|
300
304
|
children: formattedValue
|
|
301
|
-
}), formattedValue);
|
|
305
|
+
}), `${option.valueOf()}-${formattedValue}`);
|
|
302
306
|
})
|
|
303
307
|
})
|
|
304
308
|
}));
|
package/modern/index.js
CHANGED
package/modern/locales/plPL.js
CHANGED
|
@@ -16,11 +16,10 @@ const plPLPickers = {
|
|
|
16
16
|
// DateRange labels
|
|
17
17
|
start: 'Początek',
|
|
18
18
|
end: 'Koniec',
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
startDate: 'Data rozpoczęcia',
|
|
20
|
+
startTime: 'Czas rozpoczęcia',
|
|
21
|
+
endDate: 'Data zakończenia',
|
|
22
|
+
endTime: 'Czas zakończenia',
|
|
24
23
|
// Action bar
|
|
25
24
|
cancelButtonLabel: 'Anuluj',
|
|
26
25
|
clearButtonLabel: 'Wyczyść',
|
|
@@ -46,12 +45,10 @@ const plPLPickers = {
|
|
|
46
45
|
// Open picker labels
|
|
47
46
|
openDatePickerDialogue: (value, utils, formattedDate) => value != null && utils.isValid(value) ? `Wybierz datę, obecnie wybrana data to ${formattedDate ?? utils.format(value, 'fullDate')}` : 'Wybierz datę',
|
|
48
47
|
openTimePickerDialogue: (value, utils, formattedTime) => formattedTime || value !== null && utils.isValid(value) ? `Wybierz czas, obecnie wybrany czas to ${formattedTime ?? utils.format(value, 'fullTime')}` : 'Wybierz czas',
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
fieldClearLabel: 'Wyczyść',
|
|
51
49
|
// Table labels
|
|
52
50
|
timeTableLabel: 'wybierz czas',
|
|
53
|
-
dateTableLabel: 'wybierz datę'
|
|
54
|
-
|
|
51
|
+
dateTableLabel: 'wybierz datę',
|
|
55
52
|
// Field section placeholders
|
|
56
53
|
// fieldYearPlaceholder: params => 'Y'.repeat(params.digitAmount),
|
|
57
54
|
// fieldMonthPlaceholder: params => params.contentType === 'letter' ? 'MMMM' : 'MM',
|
|
@@ -63,13 +60,13 @@ const plPLPickers = {
|
|
|
63
60
|
// fieldMeridiemPlaceholder: () => 'aa',
|
|
64
61
|
|
|
65
62
|
// View names
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
63
|
+
year: 'Rok',
|
|
64
|
+
month: 'Miesiąc',
|
|
65
|
+
day: 'Dzień',
|
|
66
|
+
weekDay: 'Dzień tygodnia',
|
|
67
|
+
hours: 'Godzin',
|
|
68
|
+
minutes: 'Minut',
|
|
69
|
+
seconds: 'Sekund'
|
|
73
70
|
// meridiem: 'Meridiem',
|
|
74
71
|
|
|
75
72
|
// Common
|
|
@@ -386,9 +386,8 @@ function DayCalendar(inProps) {
|
|
|
386
386
|
return internalFocusedDay;
|
|
387
387
|
}, [currentMonth, disableFuture, disablePast, internalFocusedDay, isDateDisabled, utils, timezone]);
|
|
388
388
|
const weeksToDisplay = React.useMemo(() => {
|
|
389
|
-
const
|
|
390
|
-
|
|
391
|
-
let nextMonth = utils.addMonths(currentMonthWithTimezone, 1);
|
|
389
|
+
const toDisplay = utils.getWeekArray(currentMonth);
|
|
390
|
+
let nextMonth = utils.addMonths(currentMonth, 1);
|
|
392
391
|
while (fixedWeekNumber && toDisplay.length < fixedWeekNumber) {
|
|
393
392
|
const additionalWeeks = utils.getWeekArray(nextMonth);
|
|
394
393
|
const hasCommonWeek = utils.isSameDay(toDisplay[toDisplay.length - 1][0], additionalWeeks[0][0]);
|
|
@@ -400,7 +399,7 @@ function DayCalendar(inProps) {
|
|
|
400
399
|
nextMonth = utils.addMonths(nextMonth, 1);
|
|
401
400
|
}
|
|
402
401
|
return toDisplay;
|
|
403
|
-
}, [currentMonth, fixedWeekNumber, utils
|
|
402
|
+
}, [currentMonth, fixedWeekNumber, utils]);
|
|
404
403
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(PickersCalendarDayRoot, {
|
|
405
404
|
role: "grid",
|
|
406
405
|
"aria-labelledby": gridLabelId,
|
|
@@ -22,6 +22,20 @@ const createCalendarStateReducer = (reduceAnimations, disableSwitchToMonthOnDayF
|
|
|
22
22
|
currentMonth: action.newMonth,
|
|
23
23
|
isMonthSwitchingAnimating: !reduceAnimations
|
|
24
24
|
});
|
|
25
|
+
case 'changeMonthTimezone':
|
|
26
|
+
{
|
|
27
|
+
const newTimezone = action.newTimezone;
|
|
28
|
+
if (utils.getTimezone(state.currentMonth) === newTimezone) {
|
|
29
|
+
return state;
|
|
30
|
+
}
|
|
31
|
+
let newCurrentMonth = utils.setTimezone(state.currentMonth, newTimezone);
|
|
32
|
+
if (utils.getMonth(newCurrentMonth) !== utils.getMonth(state.currentMonth)) {
|
|
33
|
+
newCurrentMonth = utils.setMonth(newCurrentMonth, utils.getMonth(state.currentMonth));
|
|
34
|
+
}
|
|
35
|
+
return (0, _extends2.default)({}, state, {
|
|
36
|
+
currentMonth: newCurrentMonth
|
|
37
|
+
});
|
|
38
|
+
}
|
|
25
39
|
case 'finishMonthSwitchingAnimation':
|
|
26
40
|
return (0, _extends2.default)({}, state, {
|
|
27
41
|
isMonthSwitchingAnimating: false
|
|
@@ -69,14 +83,25 @@ const useCalendarState = params => {
|
|
|
69
83
|
referenceDate: referenceDateProp,
|
|
70
84
|
granularity: _getDefaultReferenceDate.SECTION_TYPE_GRANULARITY.day
|
|
71
85
|
});
|
|
72
|
-
},
|
|
73
|
-
)
|
|
86
|
+
},
|
|
87
|
+
// We want the `referenceDate` to update on prop and `timezone` change (https://github.com/mui/mui-x/issues/10804)
|
|
88
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
89
|
+
[referenceDateProp, timezone]);
|
|
74
90
|
const [calendarState, dispatch] = React.useReducer(reducerFn, {
|
|
75
91
|
isMonthSwitchingAnimating: false,
|
|
76
92
|
focusedDay: referenceDate,
|
|
77
93
|
currentMonth: utils.startOfMonth(referenceDate),
|
|
78
94
|
slideDirection: 'left'
|
|
79
95
|
});
|
|
96
|
+
|
|
97
|
+
// Ensure that `calendarState.currentMonth` timezone is updated when `referenceDate` (or timezone changes)
|
|
98
|
+
// https://github.com/mui/mui-x/issues/10804
|
|
99
|
+
React.useEffect(() => {
|
|
100
|
+
dispatch({
|
|
101
|
+
type: 'changeMonthTimezone',
|
|
102
|
+
newTimezone: utils.getTimezone(referenceDate)
|
|
103
|
+
});
|
|
104
|
+
}, [referenceDate, utils]);
|
|
80
105
|
const handleChangeMonth = React.useCallback(payload => {
|
|
81
106
|
dispatch((0, _extends2.default)({
|
|
82
107
|
type: 'changeMonth'
|
|
@@ -239,10 +239,14 @@ const DigitalClock = exports.DigitalClock = /*#__PURE__*/React.forwardRef(functi
|
|
|
239
239
|
return !containsValidTime() || !isValidValue();
|
|
240
240
|
}, [disableIgnoringDatePartForTimeValidation, utils, minTime, maxTime, disableFuture, now, disablePast, minutesStep, shouldDisableTime]);
|
|
241
241
|
const timeOptions = React.useMemo(() => {
|
|
242
|
+
const result = [];
|
|
242
243
|
const startOfDay = utils.startOfDay(valueOrReferenceDate);
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
244
|
+
let nextTimeStepOption = startOfDay;
|
|
245
|
+
while (utils.isSameDay(valueOrReferenceDate, nextTimeStepOption)) {
|
|
246
|
+
result.push(nextTimeStepOption);
|
|
247
|
+
nextTimeStepOption = utils.addMinutes(nextTimeStepOption, timeStep);
|
|
248
|
+
}
|
|
249
|
+
return result;
|
|
246
250
|
}, [valueOrReferenceDate, timeStep, utils]);
|
|
247
251
|
const focusedOptionIndex = timeOptions.findIndex(option => utils.isEqual(option, valueOrReferenceDate));
|
|
248
252
|
const handleKeyDown = event => {
|
|
@@ -305,7 +309,7 @@ const DigitalClock = exports.DigitalClock = /*#__PURE__*/React.forwardRef(functi
|
|
|
305
309
|
tabIndex: tabIndex
|
|
306
310
|
}, clockItemProps, {
|
|
307
311
|
children: formattedValue
|
|
308
|
-
}), formattedValue);
|
|
312
|
+
}), `${option.valueOf()}-${formattedValue}`);
|
|
309
313
|
})
|
|
310
314
|
})
|
|
311
315
|
}));
|
package/node/index.js
CHANGED
package/node/locales/plPL.js
CHANGED
|
@@ -22,11 +22,10 @@ const plPLPickers = {
|
|
|
22
22
|
// DateRange labels
|
|
23
23
|
start: 'Początek',
|
|
24
24
|
end: 'Koniec',
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
startDate: 'Data rozpoczęcia',
|
|
26
|
+
startTime: 'Czas rozpoczęcia',
|
|
27
|
+
endDate: 'Data zakończenia',
|
|
28
|
+
endTime: 'Czas zakończenia',
|
|
30
29
|
// Action bar
|
|
31
30
|
cancelButtonLabel: 'Anuluj',
|
|
32
31
|
clearButtonLabel: 'Wyczyść',
|
|
@@ -52,12 +51,10 @@ const plPLPickers = {
|
|
|
52
51
|
// Open picker labels
|
|
53
52
|
openDatePickerDialogue: (value, utils, formattedDate) => value != null && utils.isValid(value) ? `Wybierz datę, obecnie wybrana data to ${formattedDate ?? utils.format(value, 'fullDate')}` : 'Wybierz datę',
|
|
54
53
|
openTimePickerDialogue: (value, utils, formattedTime) => formattedTime || value !== null && utils.isValid(value) ? `Wybierz czas, obecnie wybrany czas to ${formattedTime ?? utils.format(value, 'fullTime')}` : 'Wybierz czas',
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
fieldClearLabel: 'Wyczyść',
|
|
57
55
|
// Table labels
|
|
58
56
|
timeTableLabel: 'wybierz czas',
|
|
59
|
-
dateTableLabel: 'wybierz datę'
|
|
60
|
-
|
|
57
|
+
dateTableLabel: 'wybierz datę',
|
|
61
58
|
// Field section placeholders
|
|
62
59
|
// fieldYearPlaceholder: params => 'Y'.repeat(params.digitAmount),
|
|
63
60
|
// fieldMonthPlaceholder: params => params.contentType === 'letter' ? 'MMMM' : 'MM',
|
|
@@ -69,13 +66,13 @@ const plPLPickers = {
|
|
|
69
66
|
// fieldMeridiemPlaceholder: () => 'aa',
|
|
70
67
|
|
|
71
68
|
// View names
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
69
|
+
year: 'Rok',
|
|
70
|
+
month: 'Miesiąc',
|
|
71
|
+
day: 'Dzień',
|
|
72
|
+
weekDay: 'Dzień tygodnia',
|
|
73
|
+
hours: 'Godzin',
|
|
74
|
+
minutes: 'Minut',
|
|
75
|
+
seconds: 'Sekund'
|
|
79
76
|
// meridiem: 'Meridiem',
|
|
80
77
|
|
|
81
78
|
// Common
|