@mui/x-date-pickers 8.0.0-alpha.1 → 8.0.0-alpha.2
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/AdapterMoment/AdapterMoment.js +10 -0
- package/CHANGELOG.md +228 -7
- package/DateCalendar/DateCalendar.types.d.ts +2 -1
- package/DateCalendar/PickersFadeTransitionGroup.js +4 -6
- package/DateCalendar/PickersSlideTransition.js +12 -5
- package/DateCalendar/useCalendarState.d.ts +6 -4
- package/DateField/DateField.js +5 -4
- package/DateField/DateField.types.d.ts +10 -9
- package/DatePicker/DatePicker.types.d.ts +3 -3
- package/DatePicker/DatePickerToolbar.d.ts +3 -2
- package/DatePicker/shared.d.ts +6 -5
- package/DateTimeField/DateTimeField.js +5 -4
- package/DateTimeField/DateTimeField.types.d.ts +10 -10
- package/DateTimePicker/DateTimePicker.types.d.ts +3 -3
- package/DateTimePicker/DateTimePickerTabs.js +8 -6
- package/DateTimePicker/DateTimePickerToolbar.d.ts +2 -3
- package/DateTimePicker/shared.d.ts +6 -6
- package/DayCalendarSkeleton/DayCalendarSkeleton.js +10 -19
- package/DesktopDateTimePicker/DesktopDateTimePickerLayout.d.ts +2 -1
- package/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +10 -21
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.types.d.ts +6 -6
- package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.d.ts +4 -4
- package/PickersCalendarHeader/PickersCalendarHeader.js +8 -7
- package/PickersCalendarHeader/PickersCalendarHeader.types.d.ts +3 -4
- package/PickersLayout/PickersLayout.d.ts +7 -5
- package/PickersLayout/PickersLayout.js +22 -27
- package/PickersLayout/PickersLayout.types.d.ts +14 -15
- package/PickersLayout/usePickerLayout.d.ts +5 -4
- package/PickersLayout/usePickerLayout.js +19 -12
- package/PickersShortcuts/PickersShortcuts.d.ts +7 -6
- package/README.md +7 -4
- package/TimeField/TimeField.js +5 -4
- package/TimeField/TimeField.types.d.ts +10 -10
- package/TimePicker/TimePicker.types.d.ts +3 -3
- package/TimePicker/TimePickerToolbar.d.ts +2 -3
- package/TimePicker/shared.d.ts +6 -6
- package/hooks/useParsedFormat.d.ts +2 -2
- package/hooks/useParsedFormat.js +1 -1
- package/index.js +1 -1
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -10
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.types.d.ts +11 -8
- package/internals/components/PickersToolbar.d.ts +3 -3
- package/internals/hooks/useClockReferenceDate.d.ts +2 -1
- package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +14 -14
- package/internals/hooks/useField/useField.d.ts +3 -3
- package/internals/hooks/useField/useField.types.d.ts +45 -45
- package/internals/hooks/useField/useField.utils.d.ts +4 -3
- package/internals/hooks/useField/useFieldCharacterEditing.d.ts +6 -5
- package/internals/hooks/useField/useFieldState.d.ts +9 -8
- package/internals/hooks/useField/useFieldState.js +0 -1
- package/internals/hooks/useField/useFieldV6TextField.d.ts +4 -3
- package/internals/hooks/useFieldOwnerState.d.ts +6 -0
- package/internals/hooks/useFieldOwnerState.js +12 -0
- package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +11 -11
- package/internals/hooks/usePicker/usePicker.d.ts +3 -3
- package/internals/hooks/usePicker/usePicker.js +2 -8
- package/internals/hooks/usePicker/usePicker.types.d.ts +7 -7
- package/internals/hooks/usePicker/usePickerProvider.d.ts +4 -5
- package/internals/hooks/usePicker/usePickerValue.d.ts +3 -2
- package/internals/hooks/usePicker/usePickerValue.js +0 -1
- package/internals/hooks/usePicker/usePickerValue.types.d.ts +25 -24
- package/internals/hooks/usePicker/usePickerViews.d.ts +10 -10
- package/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +5 -6
- package/internals/hooks/useValueWithTimezone.d.ts +5 -4
- package/internals/hooks/useViews.d.ts +5 -5
- package/internals/index.d.ts +4 -2
- package/internals/index.js +1 -0
- package/internals/models/fields.d.ts +6 -1
- package/internals/models/pickers.d.ts +1 -0
- package/internals/models/pickers.js +1 -0
- package/internals/models/props/basePickerProps.d.ts +4 -3
- package/internals/models/props/time.d.ts +2 -1
- package/internals/models/props/toolbar.d.ts +2 -1
- package/internals/models/value.d.ts +9 -0
- package/internals/utils/date-utils.d.ts +1 -1
- package/internals/utils/valueManagers.d.ts +4 -3
- package/locales/nlNL.js +7 -7
- package/models/adapters.d.ts +4 -4
- package/models/fields.d.ts +19 -5
- package/models/validation.d.ts +2 -1
- package/modern/AdapterMoment/AdapterMoment.js +10 -0
- package/modern/DateCalendar/PickersFadeTransitionGroup.js +4 -6
- package/modern/DateCalendar/PickersSlideTransition.js +12 -5
- package/modern/DateField/DateField.js +5 -4
- package/modern/DateTimeField/DateTimeField.js +5 -4
- package/modern/DateTimePicker/DateTimePickerTabs.js +8 -6
- package/modern/DayCalendarSkeleton/DayCalendarSkeleton.js +10 -19
- package/modern/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +10 -21
- package/modern/PickersCalendarHeader/PickersCalendarHeader.js +8 -7
- package/modern/PickersLayout/PickersLayout.js +22 -27
- package/modern/PickersLayout/usePickerLayout.js +19 -12
- package/modern/TimeField/TimeField.js +5 -4
- package/modern/hooks/useParsedFormat.js +1 -1
- package/modern/index.js +1 -1
- package/modern/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -10
- package/modern/internals/hooks/useField/useFieldState.js +0 -1
- package/modern/internals/hooks/useFieldOwnerState.js +12 -0
- package/modern/internals/hooks/usePicker/usePicker.js +2 -8
- package/modern/internals/hooks/usePicker/usePickerValue.js +0 -1
- package/modern/internals/index.js +1 -0
- package/modern/internals/models/pickers.js +1 -0
- package/modern/locales/nlNL.js +7 -7
- package/modern/validation/useValidation.js +1 -1
- package/modern/validation/validateDate.js +8 -0
- package/modern/validation/validateDateTime.js +8 -0
- package/modern/validation/validateTime.js +8 -0
- package/node/AdapterMoment/AdapterMoment.js +10 -0
- package/node/DateCalendar/PickersFadeTransitionGroup.js +4 -6
- package/node/DateCalendar/PickersSlideTransition.js +12 -5
- package/node/DateField/DateField.js +5 -4
- package/node/DateTimeField/DateTimeField.js +5 -4
- package/node/DateTimePicker/DateTimePickerTabs.js +8 -6
- package/node/DayCalendarSkeleton/DayCalendarSkeleton.js +10 -19
- package/node/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +11 -22
- package/node/PickersCalendarHeader/PickersCalendarHeader.js +8 -7
- package/node/PickersLayout/PickersLayout.js +22 -27
- package/node/PickersLayout/usePickerLayout.js +19 -12
- package/node/TimeField/TimeField.js +5 -4
- package/node/hooks/useParsedFormat.js +1 -1
- package/node/index.js +1 -1
- package/node/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -10
- package/node/internals/hooks/useField/useFieldState.js +0 -1
- package/node/internals/hooks/useFieldOwnerState.js +20 -0
- package/node/internals/hooks/usePicker/usePicker.js +3 -8
- package/node/internals/index.js +7 -0
- package/node/internals/models/pickers.js +5 -0
- package/node/locales/nlNL.js +7 -7
- package/node/validation/useValidation.js +1 -1
- package/node/validation/validateDate.js +8 -0
- package/node/validation/validateDateTime.js +8 -0
- package/node/validation/validateTime.js +8 -0
- package/package.json +2 -2
- package/themeAugmentation/overrides.d.ts +1 -1
- package/themeAugmentation/props.d.ts +3 -2
- package/validation/useValidation.d.ts +7 -6
- package/validation/useValidation.js +1 -1
- package/validation/validateDate.d.ts +12 -3
- package/validation/validateDate.js +8 -0
- package/validation/validateDateTime.d.ts +12 -4
- package/validation/validateDateTime.js +8 -0
- package/validation/validateTime.d.ts +12 -3
- package/validation/validateTime.js +8 -0
- package/internals/hooks/useIsLandscape.d.ts +0 -4
- package/internals/hooks/useIsLandscape.js +0 -35
- package/internals/hooks/usePicker/usePickerLayoutProps.d.ts +0 -32
- package/internals/hooks/usePicker/usePickerLayoutProps.js +0 -31
- package/modern/internals/hooks/useIsLandscape.js +0 -35
- package/modern/internals/hooks/usePicker/usePickerLayoutProps.js +0 -31
- package/node/internals/hooks/useIsLandscape.js +0 -43
- package/node/internals/hooks/usePicker/usePickerLayoutProps.js +0 -38
|
@@ -430,12 +430,22 @@ export class AdapterMoment {
|
|
|
430
430
|
const end = this.endOfWeek(this.endOfMonth(value));
|
|
431
431
|
let count = 0;
|
|
432
432
|
let current = start;
|
|
433
|
+
let currentDayOfYear = current.get('dayOfYear');
|
|
433
434
|
const nestedWeeks = [];
|
|
434
435
|
while (current.isBefore(end)) {
|
|
435
436
|
const weekNumber = Math.floor(count / 7);
|
|
436
437
|
nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];
|
|
437
438
|
nestedWeeks[weekNumber].push(current);
|
|
439
|
+
const prevDayOfYear = currentDayOfYear;
|
|
438
440
|
current = this.addDays(current, 1);
|
|
441
|
+
currentDayOfYear = current.get('dayOfYear');
|
|
442
|
+
|
|
443
|
+
// If there is a TZ change at midnight, adding 1 day may only increase the date by 23 hours to 11pm
|
|
444
|
+
// To fix, bump the date into the next day (add 12 hours) and then revert to the start of the day
|
|
445
|
+
// See https://github.com/moment/moment/issues/4743#issuecomment-811306874 for context.
|
|
446
|
+
if (prevDayOfYear === currentDayOfYear) {
|
|
447
|
+
current = current.add(12, 'h').startOf('day');
|
|
448
|
+
}
|
|
439
449
|
count += 1;
|
|
440
450
|
}
|
|
441
451
|
return nestedWeeks;
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,133 @@
|
|
|
5
5
|
All notable changes to this project will be documented in this file.
|
|
6
6
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
7
7
|
|
|
8
|
+
## v8.0.0-alpha.2
|
|
9
|
+
|
|
10
|
+
_Nov 29, 2024_
|
|
11
|
+
|
|
12
|
+
We'd like to offer a big thanks to the 17 contributors who made this release possible. Here are some highlights ✨:
|
|
13
|
+
|
|
14
|
+
- 👨🏽💻 Improve resize performance on the Data Gird.
|
|
15
|
+
- `<ChartDataProvider />` and `<ChartsSurface />` components are now fully divided — [Learn more](https://next.mui.com/x/react-charts/composition/#overview).
|
|
16
|
+
- Users can create their own HTML components using chart data — [Learn more](https://next.mui.com/x/react-charts/components/#html-components).
|
|
17
|
+
- 🌍 Improve Spanish, Portuguese, Chinese locales on the Data Grid component.
|
|
18
|
+
- 🌍 Improve Dutch locale on the Date and Time Pickers components.
|
|
19
|
+
- 🐞 Bugfixes
|
|
20
|
+
- 📚 Documentation improvements
|
|
21
|
+
|
|
22
|
+
Special thanks go out to the community contributors who have helped make this release possible:
|
|
23
|
+
@dloeda, @headironc, @jedesroches, @k-rajat19, @lauri865, @mathzdev, @nphmuller, @zinoroman.
|
|
24
|
+
Following are all team members who have contributed to this release:
|
|
25
|
+
@arminmeh, @alexfauquette, @cherniavskii, @flaviendelangle, @JCQuintas, @KenanYusuf, @LukasTy, @MBilalShafi, @oliviertassinari.
|
|
26
|
+
|
|
27
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
28
|
+
|
|
29
|
+
### Data Grid
|
|
30
|
+
|
|
31
|
+
#### Breaking changes
|
|
32
|
+
|
|
33
|
+
- The `<GridOverlays />` component is not exported anymore.
|
|
34
|
+
- The `indeterminateCheckboxAction` prop has been removed. Clicking on an indeterminate checkbox "selects" the unselected descendants.
|
|
35
|
+
- The `apiRef.current.resize()` method was removed.
|
|
36
|
+
- The default value of the `rowSelectionPropagation` prop has been changed to `{ parents: true, descendants: true }` which means that the selection will be propagated to the parents and descendants by default.
|
|
37
|
+
To revert to the previous behavior, pass `rowSelectionPropagation` as `{ parents: false, descendants: false }`.
|
|
38
|
+
- If `estimatedRowCount` is used, the text provided to the [Table Pagination](/material-ui/api/table-pagination/) component from the Material UI library is updated and requires additional translations. Check the example at the end of [Index-based pagination section](/x/react-data-grid/pagination/#index-based-pagination).
|
|
39
|
+
|
|
40
|
+
#### `@mui/x-data-grid@v8.0.0-alpha.2`
|
|
41
|
+
|
|
42
|
+
- [DataGrid] Change test dom check from `/jsdom/` to `/jsdom|HappyDOM/`. (#15634) @jedesroches
|
|
43
|
+
- [DataGrid] Clear timers on unmount (#15620) @cherniavskii
|
|
44
|
+
- [DataGrid] Fix order of spread props on toolbar items (#15556) @KenanYusuf
|
|
45
|
+
- [DataGrid] Improve resize performance (#15549) @lauri865
|
|
46
|
+
- [DataGrid] Make estimation label more accurate (#15632) @arminmeh
|
|
47
|
+
- [DataGrid] Remove `<GridOverlays />` export (#15573) @k-rajat19
|
|
48
|
+
- [DataGrid] Remove `indeterminateCheckboxAction` prop (#15522) @MBilalShafi
|
|
49
|
+
- [DataGrid] Remove try/catch from `<GridCell />` due to performance issues (#15616) @lauri865
|
|
50
|
+
- [DataGrid] Remove unused `resize` method (#15599) @cherniavskii
|
|
51
|
+
- [DataGrid] Support column virtualization with dynamic row height (#15541) @cherniavskii
|
|
52
|
+
- [DataGrid] Update the default value for `rowSelectionPropagation` (#15523) @MBilalShafi
|
|
53
|
+
- [l10n] Improve Chinese (zh-CN) locale (#15570) @headironc
|
|
54
|
+
- [l10n] Improve Portuguese (pt-PT) locale (#15561) @mathzdev
|
|
55
|
+
|
|
56
|
+
#### `@mui/x-data-grid-pro@v8.0.0-alpha.2` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
57
|
+
|
|
58
|
+
Same changes as in `@mui/x-data-grid@v8.0.0-alpha.2`, plus:
|
|
59
|
+
|
|
60
|
+
- [DataGridPro] Fix header filtering with `boolean` column type (#15528) @k-rajat19
|
|
61
|
+
- [DataGridPro] Fix pagination state not updating if the data source response has no rows (#15622) @zinoroman
|
|
62
|
+
- [DataGridPro] Fix selection propagation issue on initialization (#15461) @MBilalShafi
|
|
63
|
+
|
|
64
|
+
#### `@mui/x-data-grid-premium@v8.0.0-alpha.2` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
65
|
+
|
|
66
|
+
Same changes as in `@mui/x-data-grid-pro@v8.0.0-alpha.2`.
|
|
67
|
+
|
|
68
|
+
### Date and Time Pickers
|
|
69
|
+
|
|
70
|
+
#### Breaking changes
|
|
71
|
+
|
|
72
|
+
- The props received by the `layout` and the `toolbar` slots have been reworked — [Learn more](https://next.mui.com/x/migration/migration-pickers-v7/#do-not-pass-the-section-type-as-a-generic).
|
|
73
|
+
|
|
74
|
+
- The `TSection` generic of the `FieldRef` type has been replaced with the `TValue` generic — [Learn more](https://next.mui.com/x/migration/migration-pickers-v7/#slots-breaking-changes).
|
|
75
|
+
|
|
76
|
+
#### `@mui/x-date-pickers@v8.0.0-alpha.2`
|
|
77
|
+
|
|
78
|
+
- [l10n] Improve Dutch (nl-NL) locale (#15564) @nphmuller
|
|
79
|
+
- [pickers] Fix DST issue with `America/Asuncion` timezone and `AdapterMoment` (#15552) @flaviendelangle
|
|
80
|
+
- [pickers] Improve validation internals (#15419) @flaviendelangle
|
|
81
|
+
- [pickers] Remove `TSection` and strictly type `TValue` (#15434) @flaviendelangle
|
|
82
|
+
- [pickers] Remove `orientation`, `isLandscape`, `isRtl`, `wrapperVariant` and `disabled` props from `PickersLayout` (#15494) @flaviendelangle
|
|
83
|
+
- [pickers] Use the new `ownerState` in `<PickersCalendarHeader />`, `<PickersArrowSwitcher />` and `<DayCalendarSkeleton />` (#15499) @flaviendelangle
|
|
84
|
+
- [pickers] Use the new `ownerState` object in all the field components (#15510) @flaviendelangle
|
|
85
|
+
|
|
86
|
+
#### `@mui/x-date-pickers-pro@v8.0.0-alpha.2` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
87
|
+
|
|
88
|
+
Same changes as in `@mui/x-date-pickers@v8.0.0-alpha.2`.
|
|
89
|
+
|
|
90
|
+
### Charts
|
|
91
|
+
|
|
92
|
+
#### Breaking changes
|
|
93
|
+
|
|
94
|
+
- Charts Container don't have a `<div />` wrapping them anymore. All props are now passed to the root `<svg />` instead of the `<div />`.
|
|
95
|
+
|
|
96
|
+
#### `@mui/x-charts@v8.0.0-alpha.2`
|
|
97
|
+
|
|
98
|
+
- [charts] Allow the creation of custom HTML components using charts data (#15511) @JCQuintas
|
|
99
|
+
- [charts] Flatten imports from `@mui/utils` and `@mui/system` (#15603) @alexfauquette
|
|
100
|
+
- [charts] Introduce the plugin system (#15513) @alexfauquette
|
|
101
|
+
- [charts] Prevent invalid `releasePointerCapture` (#15602) @alexfauquette
|
|
102
|
+
- [charts] Fix custom Tooltip demos (#15631) @alexfauquette
|
|
103
|
+
|
|
104
|
+
#### `@mui/x-charts-pro@v8.0.0-alpha.2` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
105
|
+
|
|
106
|
+
Same changes as in `@mui/x-charts@v8.0.0-alpha.2`.
|
|
107
|
+
|
|
108
|
+
### Tree View
|
|
109
|
+
|
|
110
|
+
#### `@mui/x-tree-view@v8.0.0-alpha.2`
|
|
111
|
+
|
|
112
|
+
- [TreeView] Flatten import from `@mui/utils` and `@mui/system` (#15604) @alexfauquette
|
|
113
|
+
|
|
114
|
+
#### `@mui/x-tree-view-pro@v8.0.0-alpha.2`
|
|
115
|
+
|
|
116
|
+
Same changes as in `@mui/x-tree-view@v8.0.0-alpha.2`.
|
|
117
|
+
|
|
118
|
+
### Docs
|
|
119
|
+
|
|
120
|
+
- [docs] Fix 404 links (#15575) @oliviertassinari
|
|
121
|
+
- [docs] Fix bash comments (#15571) @oliviertassinari
|
|
122
|
+
- [docs] Fix Pickers theme augmentation example (#15672) @LukasTy
|
|
123
|
+
- [docs] Replace use of "e.g." with "for example" (#15572) @oliviertassinari
|
|
124
|
+
- [docs] Update stale `new` and `preview` tags in v8 docs (#15547) @JCQuintas
|
|
125
|
+
- [docs] Fix layout shift image on Tree View docs (#15626) @oliviertassinari
|
|
126
|
+
- [docs] Fix `anchorEl` API page for charts (#15625) @oliviertassinari
|
|
127
|
+
- [docs] Add documentation for the list view feature (#15344) @KenanYusuf
|
|
128
|
+
|
|
129
|
+
### Core
|
|
130
|
+
|
|
131
|
+
- [core] Follow `()` function convention for docs @oliviertassinari
|
|
132
|
+
- [core] Remove dead translation key (#15566) @oliviertassinari
|
|
133
|
+
- [code-infra] Auto-merge `@types/node` bumps (#15591) @LukasTy
|
|
134
|
+
|
|
8
135
|
## v8.0.0-alpha.1
|
|
9
136
|
|
|
10
137
|
_Nov 22, 2024_
|
|
@@ -17,8 +144,6 @@ We'd like to offer a big thanks to the 16 contributors who made this release pos
|
|
|
17
144
|
- 🐞 Bugfixes
|
|
18
145
|
- 📚 Documentation improvements
|
|
19
146
|
|
|
20
|
-
### Breaking change
|
|
21
|
-
|
|
22
147
|
Special thanks go out to the community contributors who have helped make this release possible:
|
|
23
148
|
@CarlosLopezLg, @headironc, @hendrikpeilke, @k-rajat19, @lhilgert9, @viktormelin.
|
|
24
149
|
Following are all team members who have contributed to this release:
|
|
@@ -56,7 +181,7 @@ Same changes as in `@mui/x-data-grid-pro@v8.0.0-alpha.1`, plus:
|
|
|
56
181
|
#### Breaking change
|
|
57
182
|
|
|
58
183
|
- The `FieldValueType` type has been renamed to `PickerValueType` — [Learn more](https://next.mui.com/x/migration/migration-pickers-v7/#renamed-variables).
|
|
59
|
-
- The `toolbar` and `layout` slots no longer receive the
|
|
184
|
+
- The `toolbar` and `layout` slots no longer receive the `disabled` and `readOnly` props — [Learn more](https://next.mui.com/x/migration/migration-pickers-v7/#slots-breaking-changes).
|
|
60
185
|
|
|
61
186
|
#### `@mui/x-date-pickers@v8.0.0-alpha.1`
|
|
62
187
|
|
|
@@ -64,9 +189,9 @@ Same changes as in `@mui/x-data-grid-pro@v8.0.0-alpha.1`, plus:
|
|
|
64
189
|
- [pickers] React 19 support (#15342) @arminmeh
|
|
65
190
|
- [pickers] Add new properties to `PickerOwnerState` and `PickerContextValue` (#15415) @flaviendelangle
|
|
66
191
|
- [pickers] Always use `props.value` when it changes (#15490) @flaviendelangle
|
|
67
|
-
- [pickers] Ensure internal value timezone is updated
|
|
192
|
+
- [pickers] Ensure internal value timezone is updated (#15435) @LukasTy
|
|
68
193
|
- [pickers] Fix unused code in `<PickersToolbar />` component (#15515) @LukasTy
|
|
69
|
-
- [pickers] Remove
|
|
194
|
+
- [pickers] Remove `FieldValueType` in favor of `PickerValueType` (#15259) @arthurbalduini
|
|
70
195
|
- [pickers] Remove the form props from the layout and the toolbar slots (#15492) @flaviendelangle
|
|
71
196
|
- [pickers] Use `props.referenceDate` timezone when `props.value` and `props.defaultValue` are not defined (#15532) @flaviendelangle
|
|
72
197
|
- [TimePicker] Prevent mouse events after `touchend` event (#15346) @arthurbalduini
|
|
@@ -82,12 +207,14 @@ Same changes as in `@mui/x-date-pickers@v8.0.0-alpha.1`, plus:
|
|
|
82
207
|
#### Breaking change
|
|
83
208
|
|
|
84
209
|
- The DX of the Tooltip customization has been refactored
|
|
210
|
+
|
|
85
211
|
- The `tooltip` prop has been removed in favor of `slotProps.tooltip` for consistency.
|
|
86
|
-
- The `popper`, `axisContent`,
|
|
212
|
+
- The `popper`, `axisContent`, and `itemContent` slots have been removed in favor of the `tooltip` slot which overrides the entire tooltip.
|
|
87
213
|
- To override the tooltip content, use the `useItemTooltip` or `useAxisTooltip` hook to get the data, and wrap your component in `ChartsTooltipContainer` to follow the pointer position.
|
|
88
214
|
- To override the tooltip placement, use the `ChartsItemTooltipContent` or `ChartsItemTooltipContent` to get default data and place them in your custom tooltip.
|
|
89
215
|
|
|
90
216
|
- The library now uses the SVG `filter` attribute instead of `d3-color` for color manipulation.
|
|
217
|
+
|
|
91
218
|
- This modification impacts the `LinePlot`, `AreaPlot`, and `BarPlot` components.
|
|
92
219
|
If you've customized the `fill` of those elements, you might need to override it by using the CSS `filter`.
|
|
93
220
|
- The `theme.styleOverride` is removed for `MuiLineElement`, `MuiAreaElement`, and `MuiBarElement` to improve performance.
|
|
@@ -338,6 +465,100 @@ Same changes as in `@mui/x-charts@8.0.0-alpha.0`.
|
|
|
338
465
|
- [release] v8 preparation (#15054) @michelengelen
|
|
339
466
|
- [test] Fix advanced list view regression test snapshot (#15260) @KenanYusuf
|
|
340
467
|
|
|
468
|
+
## 7.23.0
|
|
469
|
+
|
|
470
|
+
_Nov 29, 2024_
|
|
471
|
+
|
|
472
|
+
We'd like to offer a big thanks to the 10 contributors who made this release possible. Here are some highlights ✨:
|
|
473
|
+
|
|
474
|
+
- ✨ Support for a new display mode on the Data Grid with the [List View feature](https://mui.com/x/react-data-grid/list-view/), offering an extremely flexible way to render datasets and enabling developers to adapt how data is displayed across different screen sizes.
|
|
475
|
+
|
|
476
|
+
https://github.com/user-attachments/assets/61286adc-03fc-4323-9739-8ca726fcc16c
|
|
477
|
+
|
|
478
|
+
- ⚛️ React 19 support
|
|
479
|
+
- 📚 Documentation improvements
|
|
480
|
+
- 🌍 Improve Spanish, Portuguese, Chinese locales on the Data Grid component.
|
|
481
|
+
- 🌍 Improve Dutch locale on the Date and Time Picker components.
|
|
482
|
+
- 🐞 Bugfixes
|
|
483
|
+
|
|
484
|
+
Special thanks go out to the community contributors who have helped make this release possible:
|
|
485
|
+
@dloeda, @headironc, @mathzdev, @nphmuller, @lhilgert9, @lauri865.
|
|
486
|
+
Following are all team members who have contributed to this release:
|
|
487
|
+
@oliviertassinari, @arminmeh, @KenanYusuf, @flaviendelangle, @MBilalShafi.
|
|
488
|
+
|
|
489
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
490
|
+
|
|
491
|
+
### Data Grid
|
|
492
|
+
|
|
493
|
+
#### `@mui/x-data-grid@v7.23.0`
|
|
494
|
+
|
|
495
|
+
- [DataGrid] React 19 support (#15557) @arminmeh
|
|
496
|
+
- [DataGrid] Change test dom check from `/jsdom/` to `/jsdom|HappyDOM/`. (#15642) @jedesroches
|
|
497
|
+
- [DataGrid] Fix last separator not being hidden when grid is scrollable (#15551) @KenanYusuf
|
|
498
|
+
- [DataGrid] Fix order of spread props on toolbar items (#15556) @KenanYusuf
|
|
499
|
+
- [DataGrid] Fix row-spanning in combination with column-pinning (#15460) @lhilgert9
|
|
500
|
+
- [DataGrid] Improve resize performance (#15592) @lauri865
|
|
501
|
+
- [DataGrid] Support column virtualization with dynamic row height (#15567) @cherniavskii
|
|
502
|
+
- [DataGrid] Improve `GridCell` performance (#15621) @lauri865
|
|
503
|
+
- [l10n] Improve Chinese (zh-CN) locale (#15570) @headironc
|
|
504
|
+
- [l10n] Improve Portuguese (pt-PT) locale (#15561) @mathzdev
|
|
505
|
+
|
|
506
|
+
#### `@mui/x-data-grid-pro@v7.23.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
507
|
+
|
|
508
|
+
Same changes as in `@mui/x-data-grid@v7.23.0`, plus:
|
|
509
|
+
|
|
510
|
+
- [DataGridPro] Fix header filtering with `boolean` column type (#15640) @k-rajat19
|
|
511
|
+
- [DataGridPro] Fix pagination state not updating if the data source response has no rows (#15643) @zinoroman
|
|
512
|
+
- [DataGridPro] Fix selection propagation issue on initialization (#15593) @MBilalShafi
|
|
513
|
+
|
|
514
|
+
#### `@mui/x-data-grid-premium@v7.23.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
515
|
+
|
|
516
|
+
Same changes as in `@mui/x-data-grid-pro@v7.23.0`.
|
|
517
|
+
|
|
518
|
+
### Date and Time Pickers
|
|
519
|
+
|
|
520
|
+
#### `@mui/x-date-pickers@v7.23.0`
|
|
521
|
+
|
|
522
|
+
- [pickers] React 19 support (#15557) @arminmeh
|
|
523
|
+
- [pickers] Fix DST issue with `America/Asuncion` timezone and `AdapterMoment` (#15653) @flaviendelangle
|
|
524
|
+
- [pickers] Use `props.referenceDate` timezone when `props.value` and `props.defaultValue` are not defined (#15544) @flaviendelangle
|
|
525
|
+
- [l10n] Improve Dutch (nl-NL) locale (#15564) @nphmuller
|
|
526
|
+
|
|
527
|
+
#### `@mui/x-date-pickers-pro@v7.23.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
528
|
+
|
|
529
|
+
Same changes as in `@mui/x-date-pickers@v7.23.0`.
|
|
530
|
+
|
|
531
|
+
### Charts
|
|
532
|
+
|
|
533
|
+
#### `@mui/x-charts@v7.23.0`
|
|
534
|
+
|
|
535
|
+
- [charts] React 19 support (#15557) @arminmeh
|
|
536
|
+
- [charts] Prevent invalid `releasePointerCapture` (#15609) @alexfauquette
|
|
537
|
+
|
|
538
|
+
#### `@mui/x-charts-pro@v7.23.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
539
|
+
|
|
540
|
+
Same changes as in `@mui/x-charts@v7.23.0`.
|
|
541
|
+
|
|
542
|
+
### Tree View
|
|
543
|
+
|
|
544
|
+
#### `@mui/x-tree-view@v7.23.0`
|
|
545
|
+
|
|
546
|
+
- [TreeView] React 19 support (#15557) @arminmeh
|
|
547
|
+
|
|
548
|
+
#### `@mui/x-tree-view-pro@7.23.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
549
|
+
|
|
550
|
+
Same changes as in `@mui/x-tree-view@7.23.0`.
|
|
551
|
+
|
|
552
|
+
### Docs
|
|
553
|
+
|
|
554
|
+
- [docs] Add data caching to lazy loaded detail panel demo (#15555) @cherniavskii
|
|
555
|
+
- [docs] Remove selectors section from list view docs (#15639) @KenanYusuf
|
|
556
|
+
- [docs] Add documentation for the list view feature (#15344) @KenanYusuf
|
|
557
|
+
|
|
558
|
+
### Core
|
|
559
|
+
|
|
560
|
+
- [core] Update @mui/monorepo (#15574) @oliviertassinari
|
|
561
|
+
|
|
341
562
|
## v7.22.3
|
|
342
563
|
|
|
343
564
|
_Nov 21, 2024_
|
|
@@ -4803,7 +5024,7 @@ Same changes as in `@mui/x-data-grid-pro@7.0.0-alpha.5`.
|
|
|
4803
5024
|
|
|
4804
5025
|
The `useClearableField` hook API has been simplified to now take a `props` parameter instead of a `fieldProps`, `InputProps`, `clearable`, `onClear`, `slots` and `slotProps` parameters.
|
|
4805
5026
|
|
|
4806
|
-
You should now be able to directly pass the returned value from your field hook (
|
|
5027
|
+
You should now be able to directly pass the returned value from your field hook (for example `useDateField`) to `useClearableField`
|
|
4807
5028
|
|
|
4808
5029
|
```diff
|
|
4809
5030
|
const fieldResponse = useDateField(props);
|
|
@@ -13,6 +13,7 @@ import { ExportedYearCalendarProps, YearCalendarSlots, YearCalendarSlotProps } f
|
|
|
13
13
|
import { ExportedMonthCalendarProps, MonthCalendarSlots, MonthCalendarSlotProps } from '../MonthCalendar/MonthCalendar.types';
|
|
14
14
|
import { ExportedValidateDateProps } from '../validation/validateDate';
|
|
15
15
|
import { FormProps } from '../internals/models/formProps';
|
|
16
|
+
import { PickerValue } from '../internals/models';
|
|
16
17
|
export interface DateCalendarSlots extends PickersCalendarHeaderSlots, DayCalendarSlots, MonthCalendarSlots, YearCalendarSlots {
|
|
17
18
|
/**
|
|
18
19
|
* Custom component for calendar header.
|
|
@@ -47,7 +48,7 @@ export interface ExportedDateCalendarProps extends ExportedDayCalendarProps, Exp
|
|
|
47
48
|
*/
|
|
48
49
|
onMonthChange?: (month: PickerValidDate) => void;
|
|
49
50
|
}
|
|
50
|
-
export interface DateCalendarProps extends ExportedDateCalendarProps, ExportedUseViewsOptions<
|
|
51
|
+
export interface DateCalendarProps extends ExportedDateCalendarProps, ExportedUseViewsOptions<PickerValue, DateView> {
|
|
51
52
|
/**
|
|
52
53
|
* The selected value.
|
|
53
54
|
* Used when the component is controlled.
|
|
@@ -6,10 +6,7 @@ import { styled, useTheme, useThemeProps } from '@mui/material/styles';
|
|
|
6
6
|
import composeClasses from '@mui/utils/composeClasses';
|
|
7
7
|
import { getPickersFadeTransitionGroupUtilityClass } from "./pickersFadeTransitionGroupClasses.js";
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
-
const useUtilityClasses =
|
|
10
|
-
const {
|
|
11
|
-
classes
|
|
12
|
-
} = ownerState;
|
|
9
|
+
const useUtilityClasses = classes => {
|
|
13
10
|
const slots = {
|
|
14
11
|
root: ['root']
|
|
15
12
|
};
|
|
@@ -36,9 +33,10 @@ export function PickersFadeTransitionGroup(inProps) {
|
|
|
36
33
|
children,
|
|
37
34
|
className,
|
|
38
35
|
reduceAnimations,
|
|
39
|
-
transKey
|
|
36
|
+
transKey,
|
|
37
|
+
classes: classesProp
|
|
40
38
|
} = props;
|
|
41
|
-
const classes = useUtilityClasses(
|
|
39
|
+
const classes = useUtilityClasses(classesProp);
|
|
42
40
|
const theme = useTheme();
|
|
43
41
|
if (reduceAnimations) {
|
|
44
42
|
return children;
|
|
@@ -7,10 +7,10 @@ import { styled, useTheme, useThemeProps } from '@mui/material/styles';
|
|
|
7
7
|
import composeClasses from '@mui/utils/composeClasses';
|
|
8
8
|
import { CSSTransition, TransitionGroup } from 'react-transition-group';
|
|
9
9
|
import { getPickersSlideTransitionUtilityClass, pickersSlideTransitionClasses } from "./pickersSlideTransitionClasses.js";
|
|
10
|
+
import { usePickerPrivateContext } from "../internals/hooks/usePickerPrivateContext.js";
|
|
10
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
-
const useUtilityClasses = ownerState => {
|
|
12
|
+
const useUtilityClasses = (classes, ownerState) => {
|
|
12
13
|
const {
|
|
13
|
-
classes,
|
|
14
14
|
slideDirection
|
|
15
15
|
} = ownerState;
|
|
16
16
|
const slots = {
|
|
@@ -99,11 +99,18 @@ export function PickersSlideTransition(inProps) {
|
|
|
99
99
|
children,
|
|
100
100
|
className,
|
|
101
101
|
reduceAnimations,
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
slideDirection,
|
|
103
|
+
transKey,
|
|
104
|
+
classes: classesProp
|
|
104
105
|
} = props,
|
|
105
106
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
106
|
-
const
|
|
107
|
+
const {
|
|
108
|
+
ownerState: pickerOwnerState
|
|
109
|
+
} = usePickerPrivateContext();
|
|
110
|
+
const ownerState = _extends({}, pickerOwnerState, {
|
|
111
|
+
slideDirection
|
|
112
|
+
});
|
|
113
|
+
const classes = useUtilityClasses(classesProp, ownerState);
|
|
107
114
|
const theme = useTheme();
|
|
108
115
|
if (reduceAnimations) {
|
|
109
116
|
return /*#__PURE__*/_jsx("div", {
|
|
@@ -25,17 +25,19 @@ interface ChangeFocusedDayPayload {
|
|
|
25
25
|
export declare const createCalendarStateReducer: (reduceAnimations: boolean, disableSwitchToMonthOnDayFocus: boolean, utils: MuiPickersAdapter) => (state: CalendarState, action: ReducerAction<"finishMonthSwitchingAnimation"> | ReducerAction<"changeMonth", ChangeMonthPayload> | ReducerAction<"changeMonthTimezone", {
|
|
26
26
|
newTimezone: string;
|
|
27
27
|
}> | ReducerAction<"changeFocusedDay", ChangeFocusedDayPayload>) => CalendarState;
|
|
28
|
-
interface
|
|
28
|
+
interface UseCalendarStateParameters extends Pick<DateCalendarDefaultizedProps, 'referenceDate' | 'disableFuture' | 'disablePast' | 'minDate' | 'maxDate' | 'onMonthChange' | 'reduceAnimations' | 'shouldDisableDate'> {
|
|
29
|
+
value: PickerValidDate | null;
|
|
29
30
|
disableSwitchToMonthOnDayFocus?: boolean;
|
|
30
31
|
timezone: PickersTimezone;
|
|
31
32
|
}
|
|
32
|
-
|
|
33
|
-
referenceDate:
|
|
33
|
+
interface UseCalendarStateReturnValue {
|
|
34
|
+
referenceDate: PickerValidDate;
|
|
34
35
|
calendarState: CalendarState;
|
|
35
36
|
changeMonth: (newDate: PickerValidDate) => void;
|
|
36
37
|
changeFocusedDay: (newFocusedDate: PickerValidDate | null, withoutMonthSwitchingAnimation?: boolean) => void;
|
|
37
38
|
isDateDisabled: (day: PickerValidDate | null) => boolean;
|
|
38
39
|
onMonthSwitchingAnimationEnd: () => void;
|
|
39
40
|
handleChangeMonth: (payload: ChangeMonthPayload) => void;
|
|
40
|
-
}
|
|
41
|
+
}
|
|
42
|
+
export declare const useCalendarState: (params: UseCalendarStateParameters) => UseCalendarStateReturnValue;
|
|
41
43
|
export {};
|
package/DateField/DateField.js
CHANGED
|
@@ -13,6 +13,7 @@ import { useDateField } from "./useDateField.js";
|
|
|
13
13
|
import { useClearableField } from "../hooks/index.js";
|
|
14
14
|
import { PickersTextField } from "../PickersTextField/index.js";
|
|
15
15
|
import { convertFieldResponseIntoMuiTextFieldProps } from "../internals/utils/convertFieldResponseIntoMuiTextFieldProps.js";
|
|
16
|
+
import { useFieldOwnerState } from "../internals/hooks/useFieldOwnerState.js";
|
|
16
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
18
|
/**
|
|
18
19
|
* Demos:
|
|
@@ -36,7 +37,7 @@ const DateField = /*#__PURE__*/React.forwardRef(function DateField(inProps, inRe
|
|
|
36
37
|
inputProps
|
|
37
38
|
} = themeProps,
|
|
38
39
|
other = _objectWithoutPropertiesLoose(themeProps, _excluded);
|
|
39
|
-
const ownerState = themeProps;
|
|
40
|
+
const ownerState = useFieldOwnerState(themeProps);
|
|
40
41
|
const TextField = slots?.textField ?? (inProps.enableAccessibleFieldDOMStructure === false ? MuiTextField : PickersTextField);
|
|
41
42
|
const textFieldProps = useSlotProps({
|
|
42
43
|
elementType: TextField,
|
|
@@ -267,10 +268,10 @@ process.env.NODE_ENV !== "production" ? DateField.propTypes = {
|
|
|
267
268
|
*/
|
|
268
269
|
shouldDisableYear: PropTypes.func,
|
|
269
270
|
/**
|
|
270
|
-
* If `true`, the format will respect the leading zeroes (
|
|
271
|
-
* If `false`, the format will always add leading zeroes (
|
|
271
|
+
* If `true`, the format will respect the leading zeroes (for example on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
|
|
272
|
+
* If `false`, the format will always add leading zeroes (for example on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
|
|
272
273
|
*
|
|
273
|
-
* Warning n°1: Luxon is not able to respect the leading zeroes when using macro tokens (
|
|
274
|
+
* Warning n°1: Luxon is not able to respect the leading zeroes when using macro tokens (for example "DD"), so `shouldRespectLeadingZeros={true}` might lead to inconsistencies when using `AdapterLuxon`.
|
|
274
275
|
*
|
|
275
276
|
* Warning n°2: When `shouldRespectLeadingZeros={true}`, the field will add an invisible character on the sections containing a single digit to make sure `onChange` is fired.
|
|
276
277
|
* If you need to get the clean value from the input, you can remove this character using `input.value.replace(/\u200e/g, '')`.
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { MakeOptional } from '@mui/x-internals/types';
|
|
4
|
-
import TextField from '@mui/material/TextField';
|
|
2
|
+
import type { TextFieldProps } from '@mui/material/TextField';
|
|
3
|
+
import { MakeOptional, SlotComponentPropsFromProps } from '@mui/x-internals/types';
|
|
5
4
|
import { ExportedUseClearableFieldProps, UseClearableFieldSlots, UseClearableFieldSlotProps } from '../hooks/useClearableField';
|
|
6
|
-
import { DateValidationError,
|
|
5
|
+
import { DateValidationError, BuiltInFieldTextFieldProps, FieldOwnerState } from '../models';
|
|
7
6
|
import { UseFieldInternalProps } from '../internals/hooks/useField';
|
|
8
7
|
import { ExportedValidateDateProps } from '../validation/validateDate';
|
|
9
|
-
|
|
8
|
+
import { PickersTextFieldProps } from '../PickersTextField';
|
|
9
|
+
import { PickerValue } from '../internals/models';
|
|
10
|
+
export interface UseDateFieldProps<TEnableAccessibleFieldDOMStructure extends boolean> extends MakeOptional<UseFieldInternalProps<PickerValue, TEnableAccessibleFieldDOMStructure, DateValidationError>, 'format'>, ExportedValidateDateProps, ExportedUseClearableFieldProps {
|
|
10
11
|
}
|
|
11
12
|
export type DateFieldProps<TEnableAccessibleFieldDOMStructure extends boolean = true> = UseDateFieldProps<TEnableAccessibleFieldDOMStructure> & Omit<BuiltInFieldTextFieldProps<TEnableAccessibleFieldDOMStructure>, keyof UseDateFieldProps<TEnableAccessibleFieldDOMStructure>> & {
|
|
12
13
|
/**
|
|
@@ -18,16 +19,16 @@ export type DateFieldProps<TEnableAccessibleFieldDOMStructure extends boolean =
|
|
|
18
19
|
* The props used for each component slot.
|
|
19
20
|
* @default {}
|
|
20
21
|
*/
|
|
21
|
-
slotProps?: DateFieldSlotProps
|
|
22
|
+
slotProps?: DateFieldSlotProps;
|
|
22
23
|
};
|
|
23
24
|
export type DateFieldOwnerState<TEnableAccessibleFieldDOMStructure extends boolean> = DateFieldProps<TEnableAccessibleFieldDOMStructure>;
|
|
24
25
|
export interface DateFieldSlots extends UseClearableFieldSlots {
|
|
25
26
|
/**
|
|
26
27
|
* Form control with an input to render the value.
|
|
27
|
-
* @default TextField from '@mui/material'
|
|
28
|
+
* @default <PickersTextField />, or <TextField /> from '@mui/material' if `enableAccessibleFieldDOMStructure` is `false`.
|
|
28
29
|
*/
|
|
29
30
|
textField?: React.ElementType;
|
|
30
31
|
}
|
|
31
|
-
export interface DateFieldSlotProps
|
|
32
|
-
textField?:
|
|
32
|
+
export interface DateFieldSlotProps extends UseClearableFieldSlotProps {
|
|
33
|
+
textField?: SlotComponentPropsFromProps<PickersTextFieldProps | TextFieldProps, {}, FieldOwnerState>;
|
|
33
34
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DesktopDatePickerProps, DesktopDatePickerSlots, DesktopDatePickerSlotProps } from '../DesktopDatePicker';
|
|
2
|
-
import { BaseSingleInputFieldProps } from '../internals/models';
|
|
2
|
+
import { BaseSingleInputFieldProps, PickerValue } from '../internals/models';
|
|
3
3
|
import { MobileDatePickerProps, MobileDatePickerSlots, MobileDatePickerSlotProps } from '../MobileDatePicker';
|
|
4
|
-
import { DateValidationError
|
|
4
|
+
import { DateValidationError } from '../models';
|
|
5
5
|
import { ValidateDateProps } from '../validation/validateDate';
|
|
6
6
|
export interface DatePickerSlots extends DesktopDatePickerSlots, MobileDatePickerSlots {
|
|
7
7
|
}
|
|
@@ -33,4 +33,4 @@ export interface DatePickerProps<TEnableAccessibleFieldDOMStructure extends bool
|
|
|
33
33
|
/**
|
|
34
34
|
* Props the field can receive when used inside a date picker (<DatePicker />, <DesktopDatePicker /> or <MobileDatePicker /> component).
|
|
35
35
|
*/
|
|
36
|
-
export type DatePickerFieldProps<TEnableAccessibleFieldDOMStructure extends boolean = true> = ValidateDateProps & BaseSingleInputFieldProps<
|
|
36
|
+
export type DatePickerFieldProps<TEnableAccessibleFieldDOMStructure extends boolean = true> = ValidateDateProps & BaseSingleInputFieldProps<PickerValue, TEnableAccessibleFieldDOMStructure, DateValidationError>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { BaseToolbarProps, ExportedBaseToolbarProps } from '../internals/models/props/toolbar';
|
|
3
|
-
import { DateView
|
|
3
|
+
import { DateView } from '../models';
|
|
4
4
|
import { DatePickerToolbarClasses } from './datePickerToolbarClasses';
|
|
5
|
-
|
|
5
|
+
import { PickerValue } from '../internals/models';
|
|
6
|
+
export interface DatePickerToolbarProps extends BaseToolbarProps<PickerValue, DateView>, ExportedDatePickerToolbarProps {
|
|
6
7
|
}
|
|
7
8
|
export interface ExportedDatePickerToolbarProps extends ExportedBaseToolbarProps {
|
|
8
9
|
/**
|
package/DatePicker/shared.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { DefaultizedProps } from '@mui/x-internals/types';
|
|
3
3
|
import { DateCalendarSlots, DateCalendarSlotProps, ExportedDateCalendarProps } from '../DateCalendar/DateCalendar.types';
|
|
4
|
-
import { DateValidationError, DateView
|
|
4
|
+
import { DateValidationError, DateView } from '../models';
|
|
5
5
|
import { BasePickerInputProps } from '../internals/models/props/basePickerProps';
|
|
6
|
-
import { BaseDateValidationProps } from '../internals/models/validation';
|
|
7
6
|
import { LocalizedComponent } from '../locales/utils/pickersLocaleTextApi';
|
|
8
7
|
import { DatePickerToolbarProps, ExportedDatePickerToolbarProps } from './DatePickerToolbar';
|
|
9
8
|
import { PickerViewRendererLookup } from '../internals/hooks/usePicker/usePickerViews';
|
|
10
9
|
import { DateViewRendererProps } from '../dateViewRenderers';
|
|
10
|
+
import { PickerValue } from '../internals/models';
|
|
11
|
+
import { ValidateDatePropsToDefault } from '../validation/validateDate';
|
|
11
12
|
export interface BaseDatePickerSlots extends DateCalendarSlots {
|
|
12
13
|
/**
|
|
13
14
|
* Custom component for the toolbar rendered above the views.
|
|
@@ -18,8 +19,8 @@ export interface BaseDatePickerSlots extends DateCalendarSlots {
|
|
|
18
19
|
export interface BaseDatePickerSlotProps extends DateCalendarSlotProps {
|
|
19
20
|
toolbar?: ExportedDatePickerToolbarProps;
|
|
20
21
|
}
|
|
21
|
-
export type DatePickerViewRenderers<TView extends DateView, TAdditionalProps extends {} = {}> = PickerViewRendererLookup<
|
|
22
|
-
export interface BaseDatePickerProps extends BasePickerInputProps<
|
|
22
|
+
export type DatePickerViewRenderers<TView extends DateView, TAdditionalProps extends {} = {}> = PickerViewRendererLookup<PickerValue, TView, DateViewRendererProps<TView>, TAdditionalProps>;
|
|
23
|
+
export interface BaseDatePickerProps extends BasePickerInputProps<PickerValue, DateView, DateValidationError>, ExportedDateCalendarProps {
|
|
23
24
|
/**
|
|
24
25
|
* Overridable component slots.
|
|
25
26
|
* @default {}
|
|
@@ -37,6 +38,6 @@ export interface BaseDatePickerProps extends BasePickerInputProps<PickerValidDat
|
|
|
37
38
|
*/
|
|
38
39
|
viewRenderers?: Partial<DatePickerViewRenderers<DateView>>;
|
|
39
40
|
}
|
|
40
|
-
type UseDatePickerDefaultizedProps<Props extends BaseDatePickerProps> = LocalizedComponent<DefaultizedProps<Props, 'views' | 'openTo' |
|
|
41
|
+
type UseDatePickerDefaultizedProps<Props extends BaseDatePickerProps> = LocalizedComponent<DefaultizedProps<Props, 'views' | 'openTo' | ValidateDatePropsToDefault>>;
|
|
41
42
|
export declare function useDatePickerDefaultizedProps<Props extends BaseDatePickerProps>(props: Props, name: string): UseDatePickerDefaultizedProps<Props>;
|
|
42
43
|
export {};
|
|
@@ -13,6 +13,7 @@ import { useDateTimeField } from "./useDateTimeField.js";
|
|
|
13
13
|
import { useClearableField } from "../hooks/index.js";
|
|
14
14
|
import { PickersTextField } from "../PickersTextField/index.js";
|
|
15
15
|
import { convertFieldResponseIntoMuiTextFieldProps } from "../internals/utils/convertFieldResponseIntoMuiTextFieldProps.js";
|
|
16
|
+
import { useFieldOwnerState } from "../internals/hooks/useFieldOwnerState.js";
|
|
16
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
18
|
/**
|
|
18
19
|
* Demos:
|
|
@@ -36,7 +37,7 @@ const DateTimeField = /*#__PURE__*/React.forwardRef(function DateTimeField(inPro
|
|
|
36
37
|
inputProps
|
|
37
38
|
} = themeProps,
|
|
38
39
|
other = _objectWithoutPropertiesLoose(themeProps, _excluded);
|
|
39
|
-
const ownerState = themeProps;
|
|
40
|
+
const ownerState = useFieldOwnerState(themeProps);
|
|
40
41
|
const TextField = slots?.textField ?? (inProps.enableAccessibleFieldDOMStructure === false ? MuiTextField : PickersTextField);
|
|
41
42
|
const textFieldProps = useSlotProps({
|
|
42
43
|
elementType: TextField,
|
|
@@ -307,10 +308,10 @@ process.env.NODE_ENV !== "production" ? DateTimeField.propTypes = {
|
|
|
307
308
|
*/
|
|
308
309
|
shouldDisableYear: PropTypes.func,
|
|
309
310
|
/**
|
|
310
|
-
* If `true`, the format will respect the leading zeroes (
|
|
311
|
-
* If `false`, the format will always add leading zeroes (
|
|
311
|
+
* If `true`, the format will respect the leading zeroes (for example on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
|
|
312
|
+
* If `false`, the format will always add leading zeroes (for example on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
|
|
312
313
|
*
|
|
313
|
-
* Warning n°1: Luxon is not able to respect the leading zeroes when using macro tokens (
|
|
314
|
+
* Warning n°1: Luxon is not able to respect the leading zeroes when using macro tokens (for example "DD"), so `shouldRespectLeadingZeros={true}` might lead to inconsistencies when using `AdapterLuxon`.
|
|
314
315
|
*
|
|
315
316
|
* Warning n°2: When `shouldRespectLeadingZeros={true}`, the field will add an invisible character on the sections containing a single digit to make sure `onChange` is fired.
|
|
316
317
|
* If you need to get the clean value from the input, you can remove this character using `input.value.replace(/\u200e/g, '')`.
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import { DateTimeValidationError, FieldSection, PickerValidDate, BuiltInFieldTextFieldProps } from '../models';
|
|
2
|
+
import { MakeOptional, SlotComponentPropsFromProps } from '@mui/x-internals/types';
|
|
3
|
+
import { TextFieldProps } from '@mui/material/TextField';
|
|
4
|
+
import { DateTimeValidationError, BuiltInFieldTextFieldProps, FieldOwnerState } from '../models';
|
|
6
5
|
import { UseFieldInternalProps } from '../internals/hooks/useField';
|
|
7
6
|
import { ExportedUseClearableFieldProps, UseClearableFieldSlots, UseClearableFieldSlotProps } from '../hooks/useClearableField';
|
|
8
7
|
import { ExportedValidateDateTimeProps } from '../validation/validateDateTime';
|
|
9
8
|
import { AmPmProps } from '../internals/models/props/time';
|
|
10
|
-
|
|
9
|
+
import { PickerValue } from '../internals/models';
|
|
10
|
+
import { PickersTextFieldProps } from '../PickersTextField';
|
|
11
|
+
export interface UseDateTimeFieldProps<TEnableAccessibleFieldDOMStructure extends boolean> extends MakeOptional<UseFieldInternalProps<PickerValue, TEnableAccessibleFieldDOMStructure, DateTimeValidationError>, 'format'>, ExportedValidateDateTimeProps, ExportedUseClearableFieldProps, AmPmProps {
|
|
11
12
|
}
|
|
12
13
|
export type DateTimeFieldProps<TEnableAccessibleFieldDOMStructure extends boolean = true> = UseDateTimeFieldProps<TEnableAccessibleFieldDOMStructure> & Omit<BuiltInFieldTextFieldProps<TEnableAccessibleFieldDOMStructure>, keyof UseDateTimeFieldProps<TEnableAccessibleFieldDOMStructure>> & {
|
|
13
14
|
/**
|
|
@@ -19,16 +20,15 @@ export type DateTimeFieldProps<TEnableAccessibleFieldDOMStructure extends boolea
|
|
|
19
20
|
* The props used for each component slot.
|
|
20
21
|
* @default {}
|
|
21
22
|
*/
|
|
22
|
-
slotProps?: DateTimeFieldSlotProps
|
|
23
|
+
slotProps?: DateTimeFieldSlotProps;
|
|
23
24
|
};
|
|
24
|
-
export type DateTimeFieldOwnerState<TEnableAccessibleFieldDOMStructure extends boolean> = DateTimeFieldProps<TEnableAccessibleFieldDOMStructure>;
|
|
25
25
|
export interface DateTimeFieldSlots extends UseClearableFieldSlots {
|
|
26
26
|
/**
|
|
27
27
|
* Form control with an input to render the value.
|
|
28
|
-
* @default TextField from '@mui/material'
|
|
28
|
+
* @default <PickersTextField />, or <TextField /> from '@mui/material' if `enableAccessibleFieldDOMStructure` is `false`.
|
|
29
29
|
*/
|
|
30
30
|
textField?: React.ElementType;
|
|
31
31
|
}
|
|
32
|
-
export interface DateTimeFieldSlotProps
|
|
33
|
-
textField?:
|
|
32
|
+
export interface DateTimeFieldSlotProps extends UseClearableFieldSlotProps {
|
|
33
|
+
textField?: SlotComponentPropsFromProps<PickersTextFieldProps | TextFieldProps, {}, FieldOwnerState>;
|
|
34
34
|
}
|