@mui/x-date-pickers-pro 7.0.0-beta.7 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +195 -12
- package/DateRangeCalendar/DateRangeCalendar.js +17 -22
- package/DateRangeCalendar/useDragRange.js +1 -2
- package/DateRangePicker/DateRangePicker.js +1 -1
- package/DateRangePicker/shared.js +3 -5
- package/DateTimeRangePicker/DateTimeRangePicker.d.ts +10 -0
- package/DateTimeRangePicker/DateTimeRangePicker.js +11 -1
- package/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.d.ts +4 -5
- package/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +2 -3
- package/DateTimeRangePicker/DateTimeRangePickerToolbar.js +2 -2
- package/DateTimeRangePicker/shared.d.ts +5 -4
- package/DateTimeRangePicker/shared.js +9 -10
- package/DesktopDateRangePicker/DesktopDateRangePicker.js +6 -10
- package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.d.ts +10 -0
- package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +31 -28
- package/MobileDateRangePicker/MobileDateRangePicker.js +5 -9
- package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.d.ts +10 -0
- package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +20 -14
- package/MultiInputDateRangeField/MultiInputDateRangeField.js +17 -15
- package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +17 -15
- package/MultiInputTimeRangeField/MultiInputTimeRangeField.js +16 -14
- package/PickersRangeCalendarHeader/PickersRangeCalendarHeader.js +1 -1
- package/README.md +1 -1
- package/SingleInputDateRangeField/SingleInputDateRangeField.js +8 -4
- package/SingleInputDateRangeField/useSingleInputDateRangeField.js +6 -2
- package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +8 -4
- package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +6 -2
- package/SingleInputTimeRangeField/SingleInputTimeRangeField.js +7 -3
- package/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +6 -2
- package/StaticDateRangePicker/StaticDateRangePicker.js +4 -5
- package/index.js +1 -1
- package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +9 -11
- package/internals/hooks/useEnrichedRangePickerFieldProps.js +25 -31
- package/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +9 -10
- package/internals/hooks/useMultiInputFieldSelectedSections.js +3 -6
- package/internals/hooks/useRangePosition.js +3 -5
- package/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +14 -18
- package/internals/models/dateRange.d.ts +3 -3
- package/internals/models/dateTimeRange.d.ts +2 -2
- package/internals/models/timeRange.d.ts +2 -2
- package/internals/utils/releaseInfo.js +1 -1
- package/internals/utils/validation/validateDateRange.js +2 -2
- package/internals/utils/validation/validateDateTimeRange.js +2 -2
- package/internals/utils/valueManagers.d.ts +3 -1
- package/internals/utils/valueManagers.js +9 -7
- package/models/fields.d.ts +8 -1
- package/modern/DateRangeCalendar/DateRangeCalendar.js +1 -1
- package/modern/DateRangePicker/DateRangePicker.js +1 -1
- package/modern/DateTimeRangePicker/DateTimeRangePicker.js +11 -1
- package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +1 -1
- package/modern/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +20 -9
- package/modern/MobileDateRangePicker/MobileDateRangePicker.js +1 -1
- package/modern/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +15 -5
- package/modern/MultiInputDateRangeField/MultiInputDateRangeField.js +10 -4
- package/modern/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +10 -4
- package/modern/MultiInputTimeRangeField/MultiInputTimeRangeField.js +9 -3
- package/modern/SingleInputDateRangeField/SingleInputDateRangeField.js +6 -1
- package/modern/SingleInputDateRangeField/useSingleInputDateRangeField.js +6 -2
- package/modern/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +6 -1
- package/modern/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +6 -2
- package/modern/SingleInputTimeRangeField/SingleInputTimeRangeField.js +5 -0
- package/modern/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +6 -2
- package/modern/StaticDateRangePicker/StaticDateRangePicker.js +1 -1
- package/modern/index.js +1 -1
- package/modern/internals/utils/releaseInfo.js +1 -1
- package/modern/internals/utils/valueManagers.js +7 -5
- package/node/DateRangeCalendar/DateRangeCalendar.js +1 -1
- package/node/DateRangePicker/DateRangePicker.js +1 -1
- package/node/DateTimeRangePicker/DateTimeRangePicker.js +11 -1
- package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +1 -1
- package/node/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +20 -9
- package/node/MobileDateRangePicker/MobileDateRangePicker.js +1 -1
- package/node/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +15 -5
- package/node/MultiInputDateRangeField/MultiInputDateRangeField.js +10 -4
- package/node/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +10 -4
- package/node/MultiInputTimeRangeField/MultiInputTimeRangeField.js +9 -3
- package/node/SingleInputDateRangeField/SingleInputDateRangeField.js +6 -1
- package/node/SingleInputDateRangeField/useSingleInputDateRangeField.js +7 -1
- package/node/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +6 -1
- package/node/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +7 -1
- package/node/SingleInputTimeRangeField/SingleInputTimeRangeField.js +5 -0
- package/node/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +7 -1
- package/node/StaticDateRangePicker/StaticDateRangePicker.js +1 -1
- package/node/index.js +1 -1
- package/node/internals/utils/releaseInfo.js +1 -1
- package/node/internals/utils/valueManagers.js +9 -6
- package/package.json +7 -7
- package/DesktopDateTimeRangePicker/DesktopDateTimeRangePickerLayout.d.ts +0 -9
- package/DesktopDateTimeRangePicker/DesktopDateTimeRangePickerLayout.js +0 -52
- package/modern/DesktopDateTimeRangePicker/DesktopDateTimeRangePickerLayout.js +0 -51
- package/node/DesktopDateTimeRangePicker/DesktopDateTimeRangePickerLayout.js +0 -59
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,189 @@
|
|
|
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
|
+
## v7.0.0
|
|
7
|
+
|
|
8
|
+
_Mar 22, 2024_
|
|
9
|
+
|
|
10
|
+
We're excited to [announce the first v7 stable release](https://mui.com/blog/mui-x-v7/)! 🎉🚀
|
|
11
|
+
|
|
12
|
+
This is now the officially supported major version, where we'll keep rolling out new features, bug fixes, and improvements.
|
|
13
|
+
Migration guides are available with a complete list of the breaking changes:
|
|
14
|
+
|
|
15
|
+
- [Data Grid](https://mui.com/x/migration/migration-data-grid-v6/)
|
|
16
|
+
- [Date and Time Pickers](https://mui.com/x/migration/migration-pickers-v6/)
|
|
17
|
+
- [Tree View](https://mui.com/x/migration/migration-tree-view-v6/)
|
|
18
|
+
- [Charts](https://mui.com/x/migration/migration-charts-v6/)
|
|
19
|
+
|
|
20
|
+
We'd like to offer a big thanks to the 12 contributors who made this release possible. Here are some highlights ✨:
|
|
21
|
+
|
|
22
|
+
- 🚀 Improve the usage of custom `viewRenderers` on `DateTimePicker` (#12441) @LukasTy
|
|
23
|
+
- ✨ Set focus on the focused Tree Item instead of the Tree View (#12226) @flaviendelangle
|
|
24
|
+
- 🕹️ Support controlled `density` for the Data Grid (#12332) @MBilalShafi
|
|
25
|
+
- 🎁 Dynamic virtualization range for the Data Grid (#12353) @romgrk
|
|
26
|
+
- 🐞 Bugfixes
|
|
27
|
+
- 📚 Documentation improvements
|
|
28
|
+
|
|
29
|
+
### Data Grid
|
|
30
|
+
|
|
31
|
+
#### Breaking changes
|
|
32
|
+
|
|
33
|
+
- The `density` is a [controlled prop](https://mui.com/x/react-data-grid/accessibility/#set-the-density-programmatically) now, if you were previously passing the `density` prop to the Data Grid, you will need to do one of the following:
|
|
34
|
+
|
|
35
|
+
1. Move it to the `initialState.density` to initialize it.
|
|
36
|
+
|
|
37
|
+
```diff
|
|
38
|
+
<DataGrid
|
|
39
|
+
- density="compact"
|
|
40
|
+
+ initialState={{ density: "compact" }}
|
|
41
|
+
/>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
2. Move it to the state and use `onDensityChange` callback to update the `density` prop accordingly for it to work as expected.
|
|
45
|
+
|
|
46
|
+
```diff
|
|
47
|
+
+ const [density, setDensity] = React.useState<GridDensity>('compact');
|
|
48
|
+
<DataGrid
|
|
49
|
+
- density="compact"
|
|
50
|
+
+ density={density}
|
|
51
|
+
+ onDensityChange={(newDensity) => setDensity(newDensity)}
|
|
52
|
+
/>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
- The selector `gridDensityValueSelector` was removed, use the `gridDensitySelector` instead.
|
|
56
|
+
|
|
57
|
+
- The props `rowBuffer` and `columnBuffer` were renamed to `rowBufferPx` and `columnBufferPx`.
|
|
58
|
+
Their value is now a pixel value rather than a number of items. Their default value is now `150`.
|
|
59
|
+
|
|
60
|
+
- The props `rowThreshold` and `columnThreshold` have been removed.
|
|
61
|
+
If you had the `rowThreshold` prop set to `0` to force new rows to be rendered more often – this is no longer necessary.
|
|
62
|
+
|
|
63
|
+
#### `@mui/x-data-grid@7.0.0`
|
|
64
|
+
|
|
65
|
+
- [DataGrid] Allow to control the grid density (#12332) @MBilalShafi
|
|
66
|
+
- [DataGrid] Dynamic virtualization range (#12353) @romgrk
|
|
67
|
+
- [DataGrid] Fix `ElementType` usage (#12479) @cherniavskii
|
|
68
|
+
- [DataGrid] Fix cell value formatting on copy (#12357) @sai6855
|
|
69
|
+
- [DataGrid] Fix checkbox selection is keeping selection when filtering (#11751) @g1mishra
|
|
70
|
+
- [DataGrid] Make `rows` an optional prop (#12478) @MBilalShafi
|
|
71
|
+
|
|
72
|
+
#### `@mui/x-data-grid-pro@7.0.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
73
|
+
|
|
74
|
+
Same changes as in `@mui/x-data-grid@7.0.0`.
|
|
75
|
+
|
|
76
|
+
#### `@mui/x-data-grid-premium@7.0.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
77
|
+
|
|
78
|
+
Same changes as in `@mui/x-data-grid-pro@7.0.0`, plus:
|
|
79
|
+
|
|
80
|
+
- [DataGridPremium] Add support for confirmation before clipboard paste (#12225) @cherniavskii
|
|
81
|
+
- [DataGridPremium] Fix single grouping column sorting (#9679) @cherniavskii
|
|
82
|
+
- [DataGridPremium] Fix boolean cell not rendered in group rows (#12492) @sai6855
|
|
83
|
+
|
|
84
|
+
### Date and Time Pickers
|
|
85
|
+
|
|
86
|
+
#### Breaking changes
|
|
87
|
+
|
|
88
|
+
- The `DesktopDateTimePicker` view rendering has been optimized by using the same technique as for `DesktopDateTimeRangePicker`.
|
|
89
|
+
- The `dateTimeViewRenderers` have been removed in favor of reusing existing time view renderers (`renderTimeViewClock`, `renderDigitalClockTimeView` and `renderMultiSectionDigitalClockTimeView`) and date view renderer (`renderDateViewCalendar`).
|
|
90
|
+
- Passing `renderTimeViewClock` to time view renderers will no longer revert to the old behavior of rendering only date or time view.
|
|
91
|
+
|
|
92
|
+
#### `@mui/x-date-pickers@7.0.0`
|
|
93
|
+
|
|
94
|
+
- [fields] Allow to override the separator between the start and the end date in all range fields (#12174) @flaviendelangle
|
|
95
|
+
- [fields] Support format without separator (#12489) @flaviendelangle
|
|
96
|
+
- [pickers] Use renderer interceptor on `DesktopDateTimePicker` (#12441) @LukasTy
|
|
97
|
+
|
|
98
|
+
#### `@mui/x-date-pickers-pro@7.0.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
99
|
+
|
|
100
|
+
Same changes as in `@mui/x-date-pickers@7.0.0`, plus:
|
|
101
|
+
|
|
102
|
+
- [DateTimeRangePicker] Add component `JSDoc` (#12518) @LukasTy
|
|
103
|
+
- [DateTimeRangePicker] Fix views behavior regression (#12529) @LukasTy
|
|
104
|
+
|
|
105
|
+
### Charts
|
|
106
|
+
|
|
107
|
+
#### `@mui/x-charts@7.0.0`
|
|
108
|
+
|
|
109
|
+
- [charts] Fix small typo in `CartesianContextProvider` (#12461) @Janpot
|
|
110
|
+
|
|
111
|
+
### Tree View
|
|
112
|
+
|
|
113
|
+
#### Breaking changes
|
|
114
|
+
|
|
115
|
+
- The required `nodeId` prop used by the `TreeItem` has been renamed to `itemId` for consistency:
|
|
116
|
+
|
|
117
|
+
```diff
|
|
118
|
+
<TreeView>
|
|
119
|
+
- <TreeItem label="Item 1" nodeId="one">
|
|
120
|
+
+ <TreeItem label="Item 1" itemId="one">
|
|
121
|
+
</TreeView>
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
- The focus is now applied to the Tree Item root element instead of the Tree View root element.
|
|
125
|
+
|
|
126
|
+
This change will allow new features that require the focus to be on the Tree Item,
|
|
127
|
+
like the drag and drop reordering of items.
|
|
128
|
+
It also solves several issues with focus management,
|
|
129
|
+
like the inability to scroll to the focused item when a lot of items are rendered.
|
|
130
|
+
|
|
131
|
+
This will mostly impact how you write tests to interact with the Tree View:
|
|
132
|
+
|
|
133
|
+
For example, if you were writing a test with `react-testing-library`, here is what the changes could look like:
|
|
134
|
+
|
|
135
|
+
```diff
|
|
136
|
+
it('test example on first item', () => {
|
|
137
|
+
- const { getByRole } = render(
|
|
138
|
+
+ const { getAllByRole } = render(
|
|
139
|
+
<SimpleTreeView>
|
|
140
|
+
<TreeItem nodeId="one" />
|
|
141
|
+
<TreeItem nodeId="two" />
|
|
142
|
+
</SimpleTreeView>
|
|
143
|
+
);
|
|
144
|
+
|
|
145
|
+
- const tree = getByRole('tree');
|
|
146
|
+
+ const firstTreeItem = getAllByRole('treeitem')[0];
|
|
147
|
+
act(() => {
|
|
148
|
+
- tree.focus();
|
|
149
|
+
+ firstTreeItem.focus();
|
|
150
|
+
});
|
|
151
|
+
- fireEvent.keyDown(tree, { key: 'ArrowDown' });
|
|
152
|
+
+ fireEvent.keyDown(firstTreeItem, { key: 'ArrowDown' });
|
|
153
|
+
})
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
#### `@mui/x-tree-view@7.0.0`
|
|
157
|
+
|
|
158
|
+
- [TreeView] Rename `nodeId` to `itemId` (#12418) @noraleonte
|
|
159
|
+
- [TreeView] Set focus on the focused Tree Item instead of the Tree View (#12226) @flaviendelangle
|
|
160
|
+
- [TreeView] Update JSDoc of the `ContentComponent` prop to avoid using the word "node" (#12476) @flaviendelangle
|
|
161
|
+
|
|
162
|
+
### `@mui/x-codemod@7.0.0`
|
|
163
|
+
|
|
164
|
+
- [codemod] Add a codemod and update the grid migration guide (#12488) @MBilalShafi
|
|
165
|
+
|
|
166
|
+
### Docs
|
|
167
|
+
|
|
168
|
+
- [docs] Finalize migration guide (#12501) @noraleonte
|
|
169
|
+
- [docs] Fix nested cells alignment in the popular features demo (#12450) @cherniavskii
|
|
170
|
+
- [docs] Fix some Vale errors (#12469) @oliviertassinari
|
|
171
|
+
- [docs] Remove mentions of pre release (#12513) @noraleonte
|
|
172
|
+
- [docs] Update branch name and tags (#12498) @cherniavskii
|
|
173
|
+
- [docs] Update links to v6 (#12496) @cherniavskii
|
|
174
|
+
- [docs] Update links to v7 docs (#12500) @noraleonte
|
|
175
|
+
- [docs] Update supported versions (#12508) @joserodolfofreitas
|
|
176
|
+
- [docs] Update "What's new in MUI X" page #12527 @cherniavskii
|
|
177
|
+
|
|
178
|
+
### Core
|
|
179
|
+
|
|
180
|
+
- [core] Bump `@mui/material` peer dependency for all packages (#12516) @LukasTy
|
|
181
|
+
- [core] Fix `no-restricted-imports` ESLint rule not working for Data Grid packages (#12477) @cherniavskii
|
|
182
|
+
- [core] Lower the frequency of `no-response` action runs (#12491) @michaldudak
|
|
183
|
+
- [core] Remove leftover `legacy` `browserlistrc` entry (#12415) @LukasTy
|
|
184
|
+
- [core] Update NPM tag (#12511) @cherniavskii
|
|
185
|
+
- [core] Update supported browsers (browserlistrc) (#12521) @LukasTy
|
|
186
|
+
- [core] Use Circle CI context @oliviertassinari
|
|
187
|
+
- [license] Fix grammar on expired license error message (#12460) @joserodolfofreitas
|
|
188
|
+
|
|
6
189
|
## 7.0.0-beta.7
|
|
7
190
|
|
|
8
191
|
_Mar 14, 2024_
|
|
@@ -90,7 +273,7 @@ The `onNodeFocus` callback has been renamed to `onItemFocus` for consistency:
|
|
|
90
273
|
- [docs] Add `legacy` bundle drop mention in migration pages (#12424) @LukasTy
|
|
91
274
|
- [docs] Add missing luxon `Info` import (#12427) @LukasTy
|
|
92
275
|
- [docs] Improve slots definitions for charts (#12408) @alexfauquette
|
|
93
|
-
- [docs] Polish What's new in MUI
|
|
276
|
+
- [docs] Polish What's new in MUI X blog titles (#12309) @oliviertassinari
|
|
94
277
|
- [docs] Replace `rel="noreferrer"` by `rel="noopener"` @oliviertassinari
|
|
95
278
|
- [docs] Update `date-fns` `weekStarsOn` overriding example (#12416) @LukasTy
|
|
96
279
|
|
|
@@ -252,7 +435,7 @@ Same changes as in `@mui/x-date-pickers@7.0.0-beta.5`.
|
|
|
252
435
|
### Docs
|
|
253
436
|
|
|
254
437
|
- [docs] Fix image layout shift when loading @oliviertassinari
|
|
255
|
-
- [docs] Match Material
|
|
438
|
+
- [docs] Match Material UI repo comment for redirections @oliviertassinari
|
|
256
439
|
- [docs] Non breaking spaces @oliviertassinari
|
|
257
440
|
- [docs] Polish the Date Picker playground (#11869) @zanivan
|
|
258
441
|
- [docs] Standardize WAI-ARIA references @oliviertassinari
|
|
@@ -263,9 +446,9 @@ Same changes as in `@mui/x-date-pickers@7.0.0-beta.5`.
|
|
|
263
446
|
- [core] Remove grid folder from `getComponentInfo` RegExp (#12241) @flaviendelangle
|
|
264
447
|
- [core] Remove `window.` reference for common globals @oliviertassinari
|
|
265
448
|
- [core] Use runtime agnostic setTimeout type @oliviertassinari
|
|
266
|
-
- [docs-infra] Fix Stack
|
|
449
|
+
- [docs-infra] Fix Stack Overflow breaking space @oliviertassinari
|
|
267
450
|
- [docs-infra] Fix missing non breaking spaces @oliviertassinari
|
|
268
|
-
- [
|
|
451
|
+
- [infra] Update `no-response` workflow (#12193) @MBilalShafi
|
|
269
452
|
- [infra] Fix missing permission reset @oliviertassinari
|
|
270
453
|
|
|
271
454
|
## 7.0.0-beta.4
|
|
@@ -282,7 +465,7 @@ We'd like to offer a big thanks to the 10 contributors who made this release pos
|
|
|
282
465
|
|
|
283
466
|
### Breaking changes
|
|
284
467
|
|
|
285
|
-
- The support for IE11 has been removed from all MUI
|
|
468
|
+
- The support for IE11 has been removed from all MUI X packages. The `legacy` bundle that used to support old browsers like IE11 is no longer included.
|
|
286
469
|
|
|
287
470
|
### Data Grid
|
|
288
471
|
|
|
@@ -324,7 +507,7 @@ Same changes as in `@mui/x-data-grid-pro@7.0.0-beta.4`.
|
|
|
324
507
|
- The headless field hooks (e.g.: `useDateField`) now returns a new prop called `enableAccessibleFieldDOMStructure`.
|
|
325
508
|
This property is utilized to determine whether the anticipated UI is constructed using an accessible DOM structure. Learn more about this new [accessible DOM structure](/x/react-date-pickers/fields/#accessible-dom-structure).
|
|
326
509
|
|
|
327
|
-
|
|
510
|
+
When building a custom UI, you are most-likely only supporting one DOM structure, so you can remove `enableAccessibleFieldDOMStructure` before it is passed to the DOM:
|
|
328
511
|
|
|
329
512
|
```diff
|
|
330
513
|
function MyCustomTextField(props) {
|
|
@@ -392,7 +575,7 @@ These components are no longer exported from `@mui/x-charts`:
|
|
|
392
575
|
### Docs
|
|
393
576
|
|
|
394
577
|
- [docs] Add recipe for hiding separator on non-resizable columns (#12134) @michelengelen
|
|
395
|
-
- [docs] Add small improvements to the Gauge
|
|
578
|
+
- [docs] Add small improvements to the Gauge page (#12076) @danilo-leal
|
|
396
579
|
- [docs] Add the 'point' scaleType to the axis documentation (#12179) @alexfauquette
|
|
397
580
|
- [docs] Clarify Pickers 'Component composition' section (#12097) @LukasTy
|
|
398
581
|
- [docs] Fix "Licensing" page link (#12156) @LukasTy
|
|
@@ -975,7 +1158,7 @@ Same changes as in `@mui/x-date-pickers@7.0.0-alpha.9`.
|
|
|
975
1158
|
|
|
976
1159
|
- [charts] Do not propagate `innerRadius` and `outerRadius` to the DOM (#11689) @alexfauquette
|
|
977
1160
|
- [charts] Fix default `stackOffset` for `LineChart` (#11647) @alexfauquette
|
|
978
|
-
- [charts] Remove a
|
|
1161
|
+
- [charts] Remove a TypeScript ignore (#11688) @alexfauquette
|
|
979
1162
|
|
|
980
1163
|
### Tree View
|
|
981
1164
|
|
|
@@ -1404,7 +1587,7 @@ Same changes as in `@mui/x-date-pickers@7.0.0-alpha.7`.
|
|
|
1404
1587
|
- [core] Fix release changelog (#11496) @romgrk
|
|
1405
1588
|
- [core] Fix use of ::before & ::after (#11515) @oliviertassinari
|
|
1406
1589
|
- [core] Localize the issue template to MUI X (#11511) @oliviertassinari
|
|
1407
|
-
- [core]
|
|
1590
|
+
- [core] Regenerate API files (#11542) @flaviendelangle
|
|
1408
1591
|
- [core] Remove issue emoji @oliviertassinari
|
|
1409
1592
|
- [core] Sync the release instructions with MUI Core @oliviertassinari
|
|
1410
1593
|
- [core] Yaml format match most common convention @oliviertassinari
|
|
@@ -1447,7 +1630,7 @@ We'd like to offer a big thanks to the 6 contributors who made this release poss
|
|
|
1447
1630
|
|
|
1448
1631
|
- The `filterModel` now supports `Date` objects as values for `date` and `dateTime` column types.
|
|
1449
1632
|
The `filterModel` still accepts strings as values for `date` and `dateTime` column types,
|
|
1450
|
-
but all updates to the `filterModel` coming from the UI (
|
|
1633
|
+
but all updates to the `filterModel` coming from the UI (for example filter panel) will set the value as a `Date` object.
|
|
1451
1634
|
|
|
1452
1635
|
#### `@mui/x-data-grid@7.0.0-alpha.6`
|
|
1453
1636
|
|
|
@@ -1658,7 +1841,7 @@ Same changes as in `@mui/x-date-pickers@7.0.0-alpha.5`, plus:
|
|
|
1658
1841
|
### Core
|
|
1659
1842
|
|
|
1660
1843
|
- [core] Automate cherry-pick of PRs from `next` -> `master` (#11382) @MBilalShafi
|
|
1661
|
-
- [
|
|
1844
|
+
- [infra] Update `no-response` workflow (#11369) @MBilalShafi
|
|
1662
1845
|
- [test] Fix flaky screenshots (#11388) @cherniavskii
|
|
1663
1846
|
|
|
1664
1847
|
## 7.0.0-alpha.4
|
|
@@ -1896,7 +2079,7 @@ Same changes as in `@mui/x-date-pickers@7.0.0-alpha.3`.
|
|
|
1896
2079
|
|
|
1897
2080
|
- [charts] Adjusted `defaultizeValueFormatter` util to accept an optional `series.valueFormatter` value (#11144) @michelengelen
|
|
1898
2081
|
- [charts] Apply `labelStyle` and `tickLabelStyle` props on `<ChartsYAxis />` (#11180) @akamfoad
|
|
1899
|
-
- [charts] Fix
|
|
2082
|
+
- [charts] Fix TypeScript config (#11259) @alexfauquette
|
|
1900
2083
|
- [charts] Fix error with empty dataset (#11063) @alexfauquette
|
|
1901
2084
|
- [charts] Fix export strategy (#11235) @alexfauquette
|
|
1902
2085
|
- [charts] Remove outdated prop-types (#11045) @alexfauquette
|
|
@@ -69,7 +69,6 @@ const DayCalendarForRange = styled(DayCalendar)(({
|
|
|
69
69
|
}
|
|
70
70
|
}));
|
|
71
71
|
function useDateRangeCalendarDefaultizedProps(props, name) {
|
|
72
|
-
var _themeProps$renderLoa, _themeProps$reduceAni, _props$loading, _props$disablePast, _props$disableFuture, _themeProps$openTo, _themeProps$views, _themeProps$calendars, _themeProps$disableDr, _themeProps$available;
|
|
73
72
|
const utils = useUtils();
|
|
74
73
|
const defaultDates = useDefaultDates();
|
|
75
74
|
const defaultReduceAnimations = useDefaultReduceAnimations();
|
|
@@ -78,20 +77,20 @@ function useDateRangeCalendarDefaultizedProps(props, name) {
|
|
|
78
77
|
name
|
|
79
78
|
});
|
|
80
79
|
return _extends({}, themeProps, {
|
|
81
|
-
renderLoading:
|
|
80
|
+
renderLoading: themeProps.renderLoading ?? (() => /*#__PURE__*/_jsx("span", {
|
|
82
81
|
children: "..."
|
|
83
|
-
}),
|
|
84
|
-
reduceAnimations:
|
|
85
|
-
loading:
|
|
86
|
-
disablePast:
|
|
87
|
-
disableFuture:
|
|
88
|
-
openTo:
|
|
89
|
-
views:
|
|
82
|
+
})),
|
|
83
|
+
reduceAnimations: themeProps.reduceAnimations ?? defaultReduceAnimations,
|
|
84
|
+
loading: props.loading ?? false,
|
|
85
|
+
disablePast: props.disablePast ?? false,
|
|
86
|
+
disableFuture: props.disableFuture ?? false,
|
|
87
|
+
openTo: themeProps.openTo ?? 'day',
|
|
88
|
+
views: themeProps.views ?? ['day'],
|
|
90
89
|
minDate: applyDefaultDate(utils, themeProps.minDate, defaultDates.minDate),
|
|
91
90
|
maxDate: applyDefaultDate(utils, themeProps.maxDate, defaultDates.maxDate),
|
|
92
|
-
calendars:
|
|
93
|
-
disableDragEditing:
|
|
94
|
-
availableRangePositions:
|
|
91
|
+
calendars: themeProps.calendars ?? 2,
|
|
92
|
+
disableDragEditing: themeProps.disableDragEditing ?? false,
|
|
93
|
+
availableRangePositions: themeProps.availableRangePositions ?? ['start', 'end']
|
|
95
94
|
});
|
|
96
95
|
}
|
|
97
96
|
const useUtilityClasses = ownerState => {
|
|
@@ -117,7 +116,6 @@ const useUtilityClasses = ownerState => {
|
|
|
117
116
|
* - [DateRangeCalendar API](https://mui.com/x/api/date-pickers/date-range-calendar/)
|
|
118
117
|
*/
|
|
119
118
|
const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalendar(inProps, ref) {
|
|
120
|
-
var _slots$calendarHeader;
|
|
121
119
|
const props = useDateRangeCalendarDefaultizedProps(inProps, 'MuiDateRangeCalendar');
|
|
122
120
|
const shouldHavePreview = useMediaQuery(DEFAULT_DESKTOP_MODE_MEDIA_QUERY, {
|
|
123
121
|
defaultMatches: false
|
|
@@ -283,10 +281,10 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
|
|
|
283
281
|
shouldDisableDate: wrappedShouldDisableDate,
|
|
284
282
|
timezone
|
|
285
283
|
});
|
|
286
|
-
const CalendarHeader =
|
|
284
|
+
const CalendarHeader = slots?.calendarHeader ?? PickersRangeCalendarHeader;
|
|
287
285
|
const calendarHeaderProps = useSlotProps({
|
|
288
286
|
elementType: CalendarHeader,
|
|
289
|
-
externalSlotProps: slotProps
|
|
287
|
+
externalSlotProps: slotProps?.calendarHeader,
|
|
290
288
|
additionalProps: {
|
|
291
289
|
calendars,
|
|
292
290
|
views: ['day'],
|
|
@@ -310,12 +308,11 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
|
|
|
310
308
|
});
|
|
311
309
|
const prevValue = React.useRef(null);
|
|
312
310
|
React.useEffect(() => {
|
|
313
|
-
var _prevValue$current, _prevValue$current2;
|
|
314
311
|
const date = rangePosition === 'start' ? value[0] : value[1];
|
|
315
312
|
if (!date || !utils.isValid(date)) {
|
|
316
313
|
return;
|
|
317
314
|
}
|
|
318
|
-
const prevDate = rangePosition === 'start' ?
|
|
315
|
+
const prevDate = rangePosition === 'start' ? prevValue.current?.[0] : prevValue.current?.[1];
|
|
319
316
|
prevValue.current = value;
|
|
320
317
|
|
|
321
318
|
// The current date did not change, this call comes either from a `rangePosition` change or a change in the other date.
|
|
@@ -367,7 +364,6 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
|
|
|
367
364
|
}, slots);
|
|
368
365
|
const slotPropsForDayCalendar = _extends({}, slotProps, {
|
|
369
366
|
day: dayOwnerState => {
|
|
370
|
-
var _resolveComponentProp;
|
|
371
367
|
const {
|
|
372
368
|
day
|
|
373
369
|
} = dayOwnerState;
|
|
@@ -396,7 +392,7 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
|
|
|
396
392
|
'data-position': datePosition
|
|
397
393
|
}, dragEventHandlers, {
|
|
398
394
|
draggable: isElementDraggable ? true : undefined
|
|
399
|
-
},
|
|
395
|
+
}, resolveComponentProps(slotProps?.day, dayOwnerState) ?? {});
|
|
400
396
|
}
|
|
401
397
|
});
|
|
402
398
|
const calendarMonths = React.useMemo(() => Array.from({
|
|
@@ -414,7 +410,6 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
|
|
|
414
410
|
}).map((_, index) => utils.addMonths(firstMonth, index));
|
|
415
411
|
}, [utils, calendarState.currentMonth, calendars, currentMonthCalendarPosition]);
|
|
416
412
|
const focusedMonth = React.useMemo(() => {
|
|
417
|
-
var _visibleMonths$find;
|
|
418
413
|
if (!autoFocus) {
|
|
419
414
|
return null;
|
|
420
415
|
}
|
|
@@ -431,7 +426,7 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
|
|
|
431
426
|
if (value[1] != null) {
|
|
432
427
|
return visibleMonths.find(month => utils.isSameMonth(month, value[1]));
|
|
433
428
|
}
|
|
434
|
-
return
|
|
429
|
+
return visibleMonths.find(month => utils.isSameMonth(month, now)) ?? visibleMonths[0];
|
|
435
430
|
}, [utils, value, visibleMonths, autoFocus, now]);
|
|
436
431
|
return /*#__PURE__*/_jsxs(DateRangeCalendarRoot, _extends({
|
|
437
432
|
ref: ref,
|
|
@@ -652,7 +647,7 @@ process.env.NODE_ENV !== "production" ? DateRangeCalendar.propTypes = {
|
|
|
652
647
|
/**
|
|
653
648
|
* Disable specific date.
|
|
654
649
|
*
|
|
655
|
-
* Warning: This function can be called multiple times (
|
|
650
|
+
* Warning: This function can be called multiple times (for example when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
656
651
|
*
|
|
657
652
|
* @template TDate
|
|
658
653
|
* @param {TDate} day The date to test.
|
|
@@ -27,9 +27,8 @@ const resolveButtonElement = element => {
|
|
|
27
27
|
return element;
|
|
28
28
|
};
|
|
29
29
|
const resolveElementFromTouch = (event, ignoreTouchTarget) => {
|
|
30
|
-
var _event$changedTouches;
|
|
31
30
|
// don't parse multi-touch result
|
|
32
|
-
if (
|
|
31
|
+
if (event.changedTouches?.length === 1 && event.touches.length <= 1) {
|
|
33
32
|
const element = document.elementFromPoint(event.changedTouches[0].clientX, event.changedTouches[0].clientY);
|
|
34
33
|
// `elementFromPoint` could have resolved preview div or wrapping div
|
|
35
34
|
// might need to recursively find the nested button
|
|
@@ -277,7 +277,7 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
|
|
|
277
277
|
/**
|
|
278
278
|
* Disable specific date.
|
|
279
279
|
*
|
|
280
|
-
* Warning: This function can be called multiple times (
|
|
280
|
+
* Warning: This function can be called multiple times (for example when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
281
281
|
*
|
|
282
282
|
* @template TDate
|
|
283
283
|
* @param {TDate} day The date to test.
|
|
@@ -4,7 +4,6 @@ import { useThemeProps } from '@mui/material/styles';
|
|
|
4
4
|
import { useDefaultDates, useUtils, applyDefaultDate } from '@mui/x-date-pickers/internals';
|
|
5
5
|
import { DateRangePickerToolbar } from './DateRangePickerToolbar';
|
|
6
6
|
export function useDateRangePickerDefaultizedProps(props, name) {
|
|
7
|
-
var _themeProps$disableFu, _themeProps$disablePa;
|
|
8
7
|
const utils = useUtils();
|
|
9
8
|
const defaultDates = useDefaultDates();
|
|
10
9
|
const themeProps = useThemeProps({
|
|
@@ -12,8 +11,7 @@ export function useDateRangePickerDefaultizedProps(props, name) {
|
|
|
12
11
|
name
|
|
13
12
|
});
|
|
14
13
|
const localeText = React.useMemo(() => {
|
|
15
|
-
|
|
16
|
-
if (((_themeProps$localeTex = themeProps.localeText) == null ? void 0 : _themeProps$localeTex.toolbarTitle) == null) {
|
|
14
|
+
if (themeProps.localeText?.toolbarTitle == null) {
|
|
17
15
|
return themeProps.localeText;
|
|
18
16
|
}
|
|
19
17
|
return _extends({}, themeProps.localeText, {
|
|
@@ -22,8 +20,8 @@ export function useDateRangePickerDefaultizedProps(props, name) {
|
|
|
22
20
|
}, [themeProps.localeText]);
|
|
23
21
|
return _extends({}, themeProps, {
|
|
24
22
|
localeText,
|
|
25
|
-
disableFuture:
|
|
26
|
-
disablePast:
|
|
23
|
+
disableFuture: themeProps.disableFuture ?? false,
|
|
24
|
+
disablePast: themeProps.disablePast ?? false,
|
|
27
25
|
minDate: applyDefaultDate(utils, themeProps.minDate, defaultDates.minDate),
|
|
28
26
|
maxDate: applyDefaultDate(utils, themeProps.maxDate, defaultDates.maxDate),
|
|
29
27
|
slots: _extends({
|
|
@@ -4,5 +4,15 @@ import { DateTimeRangePickerProps } from './DateTimeRangePicker.types';
|
|
|
4
4
|
type DateTimeRangePickerComponent = (<TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean = false>(props: DateTimeRangePickerProps<TDate, TEnableAccessibleFieldDOMStructure> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
|
5
5
|
propTypes?: any;
|
|
6
6
|
};
|
|
7
|
+
/**
|
|
8
|
+
* Demos:
|
|
9
|
+
*
|
|
10
|
+
* - [DateTimeRangePicker](https://mui.com/x/react-date-pickers/date-time-range-picker/)
|
|
11
|
+
* - [Validation](https://mui.com/x/react-date-pickers/validation/)
|
|
12
|
+
*
|
|
13
|
+
* API:
|
|
14
|
+
*
|
|
15
|
+
* - [DateTimeRangePicker API](https://mui.com/x/api/date-pickers/date-time-range-picker/)
|
|
16
|
+
*/
|
|
7
17
|
declare const DateTimeRangePicker: DateTimeRangePickerComponent;
|
|
8
18
|
export { DateTimeRangePicker };
|
|
@@ -9,6 +9,16 @@ import { useThemeProps } from '@mui/material/styles';
|
|
|
9
9
|
import { DesktopDateTimeRangePicker } from '../DesktopDateTimeRangePicker';
|
|
10
10
|
import { MobileDateTimeRangePicker } from '../MobileDateTimeRangePicker';
|
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
/**
|
|
13
|
+
* Demos:
|
|
14
|
+
*
|
|
15
|
+
* - [DateTimeRangePicker](https://mui.com/x/react-date-pickers/date-time-range-picker/)
|
|
16
|
+
* - [Validation](https://mui.com/x/react-date-pickers/validation/)
|
|
17
|
+
*
|
|
18
|
+
* API:
|
|
19
|
+
*
|
|
20
|
+
* - [DateTimeRangePicker API](https://mui.com/x/api/date-pickers/date-time-range-picker/)
|
|
21
|
+
*/
|
|
12
22
|
const DateTimeRangePicker = /*#__PURE__*/React.forwardRef(function DateTimeRangePicker(inProps, ref) {
|
|
13
23
|
const props = useThemeProps({
|
|
14
24
|
props: inProps,
|
|
@@ -312,7 +322,7 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePicker.propTypes = {
|
|
|
312
322
|
/**
|
|
313
323
|
* Disable specific date.
|
|
314
324
|
*
|
|
315
|
-
* Warning: This function can be called multiple times (
|
|
325
|
+
* Warning: This function can be called multiple times (for example when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
316
326
|
*
|
|
317
327
|
* @template TDate
|
|
318
328
|
* @param {TDate} day The date to test.
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { PickerSelectionState, PickerViewRenderer, TimeViewWithMeridiem, BaseClockProps } from '@mui/x-date-pickers/internals';
|
|
2
|
+
import { PickerSelectionState, PickerViewRenderer, TimeViewWithMeridiem, BaseClockProps, DefaultizedProps } from '@mui/x-date-pickers/internals';
|
|
3
3
|
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
4
|
-
import { DateTimeRangePickerView } from '../internals/models';
|
|
5
4
|
import { DateRange } from '../models';
|
|
6
5
|
import { UseRangePositionResponse } from '../internals/hooks/useRangePosition';
|
|
7
|
-
export type DateTimeRangePickerTimeWrapperProps<TDate extends PickerValidDate, TView extends
|
|
6
|
+
export type DateTimeRangePickerTimeWrapperProps<TDate extends PickerValidDate, TView extends TimeViewWithMeridiem, TComponentProps extends DefaultizedProps<Omit<BaseClockProps<TDate, TView>, 'value' | 'defaultValue' | 'onChange'>, 'views'>> = Pick<UseRangePositionResponse, 'rangePosition' | 'onRangePositionChange'> & Omit<TComponentProps, 'views' | 'view' | 'onViewChange' | 'value' | 'defaultValue' | 'onChange'> & {
|
|
8
7
|
view: TView;
|
|
9
8
|
onViewChange?: (view: TView) => void;
|
|
10
9
|
views: readonly TView[];
|
|
11
10
|
value?: DateRange<TDate>;
|
|
12
11
|
defaultValue?: DateRange<TDate>;
|
|
13
12
|
onChange?: (value: DateRange<TDate>, selectionState: PickerSelectionState, selectedView: TView) => void;
|
|
14
|
-
viewRenderer?: PickerViewRenderer<DateRange<TDate>, TView,
|
|
13
|
+
viewRenderer?: PickerViewRenderer<DateRange<TDate>, TView, TComponentProps, any> | null;
|
|
15
14
|
openTo?: TView;
|
|
16
15
|
};
|
|
17
16
|
/**
|
|
18
17
|
* @ignore - internal component.
|
|
19
18
|
*/
|
|
20
|
-
declare function DateTimeRangePickerTimeWrapper<TDate extends PickerValidDate, TView extends
|
|
19
|
+
declare function DateTimeRangePickerTimeWrapper<TDate extends PickerValidDate, TView extends TimeViewWithMeridiem, TComponentProps extends DefaultizedProps<Omit<BaseClockProps<TDate, TView>, 'value' | 'defaultValue' | 'onChange'>, 'views'>>(props: DateTimeRangePickerTimeWrapperProps<TDate, TView, TComponentProps>, ref: React.Ref<HTMLDivElement>): React.ReactNode;
|
|
21
20
|
export { DateTimeRangePickerTimeWrapper };
|
|
@@ -8,7 +8,6 @@ import { calculateRangeChange } from '../internals/utils/date-range-manager';
|
|
|
8
8
|
* @ignore - internal component.
|
|
9
9
|
*/
|
|
10
10
|
function DateTimeRangePickerTimeWrapper(props, ref) {
|
|
11
|
-
var _ref, _ref2;
|
|
12
11
|
const utils = useUtils();
|
|
13
12
|
const {
|
|
14
13
|
rangePosition,
|
|
@@ -24,8 +23,8 @@ function DateTimeRangePickerTimeWrapper(props, ref) {
|
|
|
24
23
|
if (!viewRenderer) {
|
|
25
24
|
return null;
|
|
26
25
|
}
|
|
27
|
-
const currentValue = (
|
|
28
|
-
const currentDefaultValue = (
|
|
26
|
+
const currentValue = (rangePosition === 'start' ? value?.[0] : value?.[1]) ?? null;
|
|
27
|
+
const currentDefaultValue = (rangePosition === 'start' ? defaultValue?.[0] : defaultValue?.[1]) ?? null;
|
|
29
28
|
const handleOnChange = (newDate, selectionState, selectedView) => {
|
|
30
29
|
if (!onChange || !value) {
|
|
31
30
|
return;
|
|
@@ -39,7 +39,7 @@ const DateTimeRangePickerToolbarStart = styled(DateTimePickerToolbar, {
|
|
|
39
39
|
ownerState
|
|
40
40
|
}) => _extends({
|
|
41
41
|
borderBottom: 'none'
|
|
42
|
-
},
|
|
42
|
+
}, ownerState?.toolbarVariant !== 'desktop' ? {
|
|
43
43
|
padding: '12px 8px 0 12px'
|
|
44
44
|
} : {
|
|
45
45
|
paddingBottom: 0
|
|
@@ -51,7 +51,7 @@ const DateTimeRangePickerToolbarEnd = styled(DateTimePickerToolbar, {
|
|
|
51
51
|
})(({
|
|
52
52
|
ownerState
|
|
53
53
|
}) => ({
|
|
54
|
-
padding:
|
|
54
|
+
padding: ownerState?.toolbarVariant !== 'desktop' ? '12px 8px 12px 12px' : undefined
|
|
55
55
|
}));
|
|
56
56
|
const DateTimeRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateTimeRangePickerToolbar(inProps, ref) {
|
|
57
57
|
const props = useThemeProps({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { LocalizedComponent } from '@mui/x-date-pickers/locales';
|
|
3
|
-
import { DefaultizedProps, BaseDateValidationProps, BasePickerInputProps, PickerViewRendererLookup, BaseClockProps, DesktopOnlyTimePickerProps, TimeViewWithMeridiem, UseViewsOptions, DateTimeValidationProps } from '@mui/x-date-pickers/internals';
|
|
3
|
+
import { DefaultizedProps, BaseDateValidationProps, BasePickerInputProps, PickerViewRendererLookup, BaseClockProps, DesktopOnlyTimePickerProps, TimeViewWithMeridiem, UseViewsOptions, DateTimeValidationProps, DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals';
|
|
4
4
|
import { PickerValidDate } from '@mui/x-date-pickers/models';
|
|
5
5
|
import { TimeViewRendererProps } from '@mui/x-date-pickers/timeViewRenderers';
|
|
6
6
|
import { DigitalClockSlots, DigitalClockSlotProps } from '@mui/x-date-pickers/DigitalClock';
|
|
@@ -33,6 +33,9 @@ export interface BaseDateTimeRangePickerSlotProps<TDate extends PickerValidDate>
|
|
|
33
33
|
*/
|
|
34
34
|
toolbar?: ExportedDateTimeRangePickerToolbarProps;
|
|
35
35
|
}
|
|
36
|
+
export type DateTimeRangePickerRenderers<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TAdditionalProps extends {} = {}> = PickerViewRendererLookup<DateRange<TDate>, TView, Omit<DateRangeViewRendererProps<TDate, 'day'>, 'view' | 'slots' | 'slotProps'> & Omit<TimeViewRendererProps<TimeViewWithMeridiem, BaseClockProps<TDate, TimeViewWithMeridiem>>, 'view' | 'slots' | 'slotProps'> & {
|
|
37
|
+
view: TView;
|
|
38
|
+
}, TAdditionalProps>;
|
|
36
39
|
export interface BaseDateTimeRangePickerProps<TDate extends PickerValidDate> extends Omit<BasePickerInputProps<DateRange<TDate>, TDate, DateTimeRangePickerView, DateTimeRangeValidationError>, 'orientation' | 'views' | 'openTo'>, ExportedDateRangeCalendarProps<TDate>, BaseDateValidationProps<TDate>, DesktopOnlyTimePickerProps<TDate>, Partial<Pick<UseViewsOptions<DateRange<TDate>, DateTimeRangePickerViewExternal>, 'openTo' | 'views'>>, DateTimeValidationProps<TDate> {
|
|
37
40
|
/**
|
|
38
41
|
* Overridable component slots.
|
|
@@ -49,9 +52,7 @@ export interface BaseDateTimeRangePickerProps<TDate extends PickerValidDate> ext
|
|
|
49
52
|
* If `null`, the section will only have field editing.
|
|
50
53
|
* If `undefined`, internally defined view will be the used.
|
|
51
54
|
*/
|
|
52
|
-
viewRenderers?: Partial<
|
|
53
|
-
view: DateTimeRangePickerView;
|
|
54
|
-
}, {}>>;
|
|
55
|
+
viewRenderers?: Partial<DateTimeRangePickerRenderers<TDate, DateTimeRangePickerView>>;
|
|
55
56
|
}
|
|
56
57
|
type UseDateTimeRangePickerDefaultizedProps<TDate extends PickerValidDate, Props extends BaseDateTimeRangePickerProps<TDate>> = LocalizedComponent<TDate, Omit<DefaultizedProps<Props, 'openTo' | 'ampm' | keyof BaseDateValidationProps<TDate>>, 'views'>> & {
|
|
57
58
|
shouldRenderTimeInASingleColumn: boolean;
|
|
@@ -4,14 +4,13 @@ import { useDefaultDates, useUtils, applyDefaultDate, applyDefaultViewProps, res
|
|
|
4
4
|
import { DateTimeRangePickerToolbar } from './DateTimeRangePickerToolbar';
|
|
5
5
|
import { DateTimeRangePickerTabs } from './DateTimeRangePickerTabs';
|
|
6
6
|
export function useDateTimeRangePickerDefaultizedProps(props, name) {
|
|
7
|
-
var _themeProps$ampm, _themeProps$disableFu, _themeProps$disablePa, _themeProps$minDateTi, _themeProps$maxDateTi, _themeProps$minDateTi2, _themeProps$maxDateTi2, _themeProps$disableIg, _themeProps$slotProps;
|
|
8
7
|
const utils = useUtils();
|
|
9
8
|
const defaultDates = useDefaultDates();
|
|
10
9
|
const themeProps = useThemeProps({
|
|
11
10
|
props,
|
|
12
11
|
name
|
|
13
12
|
});
|
|
14
|
-
const ampm =
|
|
13
|
+
const ampm = themeProps.ampm ?? utils.is12HourCycleInCurrentLocale();
|
|
15
14
|
const {
|
|
16
15
|
openTo,
|
|
17
16
|
views: defaultViews
|
|
@@ -39,13 +38,13 @@ export function useDateTimeRangePickerDefaultizedProps(props, name) {
|
|
|
39
38
|
thresholdToRenderTimeInASingleColumn,
|
|
40
39
|
views,
|
|
41
40
|
ampm,
|
|
42
|
-
disableFuture:
|
|
43
|
-
disablePast:
|
|
44
|
-
minDate: applyDefaultDate(utils,
|
|
45
|
-
maxDate: applyDefaultDate(utils,
|
|
46
|
-
minTime:
|
|
47
|
-
maxTime:
|
|
48
|
-
disableIgnoringDatePartForTimeValidation:
|
|
41
|
+
disableFuture: themeProps.disableFuture ?? false,
|
|
42
|
+
disablePast: themeProps.disablePast ?? false,
|
|
43
|
+
minDate: applyDefaultDate(utils, themeProps.minDateTime ?? themeProps.minDate, defaultDates.minDate),
|
|
44
|
+
maxDate: applyDefaultDate(utils, themeProps.maxDateTime ?? themeProps.maxDate, defaultDates.maxDate),
|
|
45
|
+
minTime: themeProps.minDateTime ?? themeProps.minTime,
|
|
46
|
+
maxTime: themeProps.maxDateTime ?? themeProps.maxTime,
|
|
47
|
+
disableIgnoringDatePartForTimeValidation: themeProps.disableIgnoringDatePartForTimeValidation ?? Boolean(themeProps.minDateTime || themeProps.maxDateTime ||
|
|
49
48
|
// allow digital clocks to correctly check time validity: https://github.com/mui/mui-x/issues/12048
|
|
50
49
|
themeProps.disablePast || themeProps.disableFuture),
|
|
51
50
|
slots: _extends({
|
|
@@ -53,7 +52,7 @@ export function useDateTimeRangePickerDefaultizedProps(props, name) {
|
|
|
53
52
|
toolbar: DateTimeRangePickerToolbar
|
|
54
53
|
}, themeProps.slots),
|
|
55
54
|
slotProps: _extends({}, themeProps.slotProps, {
|
|
56
|
-
toolbar: _extends({},
|
|
55
|
+
toolbar: _extends({}, themeProps.slotProps?.toolbar, {
|
|
57
56
|
ampm
|
|
58
57
|
})
|
|
59
58
|
})
|