@mui/x-date-pickers-pro 8.0.0-alpha.5 → 8.0.0-alpha.7
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/{AdapterDateFnsJalaliV3 → AdapterDateFnsJalaliV2}/index.d.ts +1 -1
- package/{AdapterDateFnsJalaliV3 → AdapterDateFnsJalaliV2}/index.js +1 -1
- package/{AdapterDateFnsJalaliV3 → AdapterDateFnsJalaliV2}/package.json +1 -1
- package/{AdapterDateFnsV3 → AdapterDateFnsV2}/index.d.ts +1 -1
- package/{AdapterDateFnsV3 → AdapterDateFnsV2}/index.js +1 -1
- package/{AdapterDateFnsV3 → AdapterDateFnsV2}/package.json +1 -1
- package/CHANGELOG.md +206 -1
- package/DateRangeCalendar/DateRangeCalendar.js +9 -7
- package/DateRangePicker/DateRangePicker.js +1 -1
- package/DateRangePicker/DateRangePicker.types.d.ts +5 -0
- package/DateRangePicker/DateRangePickerToolbar.d.ts +2 -3
- package/DateRangePicker/DateRangePickerToolbar.js +25 -31
- package/DateRangePicker/shared.d.ts +1 -1
- package/DateTimeRangePicker/DateTimeRangePicker.js +2 -2
- package/DateTimeRangePicker/DateTimeRangePickerTabs.d.ts +4 -5
- package/DateTimeRangePicker/DateTimeRangePickerTabs.js +25 -24
- package/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.d.ts +8 -10
- package/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +7 -5
- package/DateTimeRangePicker/DateTimeRangePickerToolbar.d.ts +2 -4
- package/DateTimeRangePicker/DateTimeRangePickerToolbar.js +66 -69
- package/DateTimeRangePicker/shared.d.ts +2 -2
- package/DesktopDateRangePicker/DesktopDateRangePicker.js +9 -3
- package/DesktopDateRangePicker/DesktopDateRangePicker.types.d.ts +7 -2
- package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +17 -14
- package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.types.d.ts +2 -3
- package/MobileDateRangePicker/MobileDateRangePicker.js +2 -2
- package/MobileDateRangePicker/MobileDateRangePicker.types.d.ts +2 -2
- package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +15 -8
- package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.types.d.ts +2 -3
- package/SingleInputDateRangeField/useSingleInputDateRangeField.d.ts +1 -1
- package/SingleInputDateRangeField/useSingleInputDateRangeField.js +13 -14
- package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.d.ts +1 -1
- package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +13 -14
- package/SingleInputTimeRangeField/useSingleInputTimeRangeField.d.ts +1 -1
- package/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +13 -14
- package/StaticDateRangePicker/StaticDateRangePicker.types.d.ts +2 -2
- package/dateRangeViewRenderers/dateRangeViewRenderers.d.ts +2 -2
- package/dateRangeViewRenderers/dateRangeViewRenderers.js +0 -6
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +1 -0
- package/hooks/package.json +6 -0
- package/hooks/usePickerRangePositionContext.d.ts +7 -0
- package/hooks/usePickerRangePositionContext.js +15 -0
- package/index.d.ts +2 -0
- package/index.js +4 -2
- package/internals/hooks/models/useRangePicker.d.ts +4 -4
- package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +35 -53
- package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.d.ts +7 -9
- package/internals/hooks/useEnrichedRangePickerFieldProps.d.ts +6 -6
- package/internals/hooks/useEnrichedRangePickerFieldProps.js +11 -8
- package/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +24 -40
- package/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.d.ts +7 -9
- package/internals/hooks/useMultiInputFieldSelectedSections.d.ts +10 -12
- package/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.d.ts +1 -1
- package/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +11 -6
- package/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.d.ts +2 -2
- package/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +12 -7
- package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.d.ts +2 -2
- package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +13 -8
- package/internals/hooks/useNullablePickerRangePositionContext.d.ts +5 -0
- package/internals/hooks/useNullablePickerRangePositionContext.js +10 -0
- package/internals/hooks/useRangePosition.d.ts +1 -1
- package/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +14 -24
- package/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.d.ts +6 -6
- package/internals/utils/date-range-manager.js +2 -1
- package/internals/utils/releaseInfo.js +1 -1
- package/internals/utils/valueManagers.js +7 -7
- package/managers/index.d.ts +6 -0
- package/managers/index.js +3 -0
- package/managers/package.json +6 -0
- package/managers/useDateRangeManager.d.ts +15 -0
- package/managers/useDateRangeManager.js +31 -0
- package/managers/useDateTimeRangeManager.d.ts +15 -0
- package/managers/useDateTimeRangeManager.js +31 -0
- package/managers/useTimeRangeManager.d.ts +15 -0
- package/managers/useTimeRangeManager.js +29 -0
- package/models/range.d.ts +0 -1
- package/modern/{AdapterDateFnsJalaliV3 → AdapterDateFnsJalaliV2}/index.js +1 -1
- package/modern/{AdapterDateFnsV3 → AdapterDateFnsV2}/index.js +1 -1
- package/modern/DateRangeCalendar/DateRangeCalendar.js +9 -7
- package/modern/DateRangePicker/DateRangePicker.js +1 -1
- package/modern/DateRangePicker/DateRangePickerToolbar.js +25 -31
- package/modern/DateTimeRangePicker/DateTimeRangePicker.js +2 -2
- package/modern/DateTimeRangePicker/DateTimeRangePickerTabs.js +25 -24
- package/modern/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +7 -5
- package/modern/DateTimeRangePicker/DateTimeRangePickerToolbar.js +66 -69
- package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +9 -3
- package/modern/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +17 -14
- package/modern/MobileDateRangePicker/MobileDateRangePicker.js +2 -2
- package/modern/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +15 -8
- package/modern/SingleInputDateRangeField/useSingleInputDateRangeField.js +13 -14
- package/modern/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +13 -14
- package/modern/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +13 -14
- package/modern/dateRangeViewRenderers/dateRangeViewRenderers.js +0 -6
- package/modern/hooks/index.js +1 -0
- package/modern/hooks/usePickerRangePositionContext.js +15 -0
- package/modern/index.js +4 -2
- package/modern/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +35 -53
- package/modern/internals/hooks/useEnrichedRangePickerFieldProps.js +11 -8
- package/modern/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +24 -40
- package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +11 -6
- package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +12 -7
- package/modern/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +13 -8
- package/modern/internals/hooks/useNullablePickerRangePositionContext.js +10 -0
- package/modern/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +14 -24
- package/modern/internals/utils/date-range-manager.js +2 -1
- package/modern/internals/utils/releaseInfo.js +1 -1
- package/modern/internals/utils/valueManagers.js +7 -7
- package/modern/managers/index.js +3 -0
- package/modern/managers/useDateRangeManager.js +31 -0
- package/modern/managers/useDateTimeRangeManager.js +31 -0
- package/modern/managers/useTimeRangeManager.js +29 -0
- package/node/{AdapterDateFnsJalaliV3 → AdapterDateFnsJalaliV2}/index.js +1 -1
- package/node/{AdapterDateFnsV3 → AdapterDateFnsV2}/index.js +1 -1
- package/node/DateRangeCalendar/DateRangeCalendar.js +9 -7
- package/node/DateRangePicker/DateRangePicker.js +1 -1
- package/node/DateRangePicker/DateRangePickerToolbar.js +24 -30
- package/node/DateTimeRangePicker/DateTimeRangePicker.js +2 -2
- package/node/DateTimeRangePicker/DateTimeRangePickerTabs.js +24 -23
- package/node/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +7 -5
- package/node/DateTimeRangePicker/DateTimeRangePickerToolbar.js +65 -68
- package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +9 -3
- package/node/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +17 -14
- package/node/MobileDateRangePicker/MobileDateRangePicker.js +2 -2
- package/node/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +15 -8
- package/node/SingleInputDateRangeField/useSingleInputDateRangeField.js +12 -14
- package/node/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +12 -14
- package/node/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +12 -14
- package/node/dateRangeViewRenderers/dateRangeViewRenderers.js +0 -6
- package/node/hooks/index.js +12 -0
- package/node/hooks/usePickerRangePositionContext.js +22 -0
- package/node/index.js +23 -1
- package/node/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +35 -53
- package/node/internals/hooks/useEnrichedRangePickerFieldProps.js +11 -8
- package/node/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +24 -40
- package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +10 -5
- package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +11 -6
- package/node/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +12 -7
- package/node/internals/hooks/useNullablePickerRangePositionContext.js +16 -0
- package/node/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +14 -24
- package/node/internals/utils/date-range-manager.js +2 -1
- package/node/internals/utils/releaseInfo.js +1 -1
- package/node/internals/utils/valueManagers.js +7 -7
- package/node/managers/index.js +26 -0
- package/node/managers/useDateRangeManager.js +38 -0
- package/node/managers/useDateTimeRangeManager.js +38 -0
- package/node/managers/useTimeRangeManager.js +36 -0
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
export { AdapterDateFnsJalali } from '@mui/x-date-pickers/
|
|
1
|
+
export { AdapterDateFnsJalali } from '@mui/x-date-pickers/AdapterDateFnsJalaliV2';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { AdapterDateFnsJalali } from '@mui/x-date-pickers/
|
|
1
|
+
export { AdapterDateFnsJalali } from '@mui/x-date-pickers/AdapterDateFnsJalaliV2';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { AdapterDateFns } from '@mui/x-date-pickers/
|
|
1
|
+
export { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFnsV2';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { AdapterDateFns } from '@mui/x-date-pickers/
|
|
1
|
+
export { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFnsV2';
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,211 @@
|
|
|
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
|
+
## 8.0.0-alpha.7
|
|
9
|
+
|
|
10
|
+
_Jan 9, 2025_
|
|
11
|
+
|
|
12
|
+
We'd like to offer a big thanks to the 13 contributors who made this release possible. Here are some highlights ✨:
|
|
13
|
+
|
|
14
|
+
- 📊 Charts legend is now an HTML element which can be styled more easily
|
|
15
|
+
- 💫 Support [aggregation with server-side data](/x/react-data-grid/server-side-data/aggregation/)
|
|
16
|
+
- 🏎️ Improve Data Grid aggregation performance
|
|
17
|
+
- 🌍 Add Chinese (Taiwan) (zh-TW) locale on the Date and Time Pickers
|
|
18
|
+
- 🌍 Improve Norwegian (nb-NO) locale on the Date and Time Pickers
|
|
19
|
+
- 🐞 Bugfixes
|
|
20
|
+
|
|
21
|
+
Special thanks go out to the community contributors who have helped make this release possible:
|
|
22
|
+
@derek-0000, @josteinjhauge, @k-rajat19, @nusr, @tomashauser.
|
|
23
|
+
Following are all team members who have contributed to this release:
|
|
24
|
+
@cherniavskii, @flaviendelangle, @JCQuintas, @LukasTy, @MBilalShafi, @arminmeh, @romgrk, @oliviertassinari.
|
|
25
|
+
|
|
26
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
27
|
+
|
|
28
|
+
### Data Grid
|
|
29
|
+
|
|
30
|
+
#### `@mui/x-data-grid@8.0.0-alpha.7`
|
|
31
|
+
|
|
32
|
+
- [DataGrid] Improve React 19 support (#15769) @LukasTy
|
|
33
|
+
- [DataGrid] Add `name` attribute to the checkbox selection column (#15178) @derek-0000
|
|
34
|
+
- [DataGrid] Fix number filter field formatting values while typing (#16062) @arminmeh
|
|
35
|
+
- [DataGrid] Fix select all checkbox state reset with server side data (#16034) @MBilalShafi
|
|
36
|
+
- [DataGrid] Refactor: create base button props (#15930) @romgrk
|
|
37
|
+
- [DataGrid] Refactor: create tooltip props (#16086) @romgrk
|
|
38
|
+
- [DataGrid] Fix TS error (#16046) @cherniavskii
|
|
39
|
+
|
|
40
|
+
#### `@mui/x-data-grid-pro@8.0.0-alpha.7` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
41
|
+
|
|
42
|
+
Same changes as in `@mui/x-data-grid@8.0.0-alpha.7`.
|
|
43
|
+
|
|
44
|
+
#### `@mui/x-data-grid-premium@8.0.0-alpha.7` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
45
|
+
|
|
46
|
+
Same changes as in `@mui/x-data-grid-pro@8.0.0-alpha.7`, plus:
|
|
47
|
+
|
|
48
|
+
- [DataGridPremium] Improve aggregation performance for multiple columns (#16097) @cherniavskii
|
|
49
|
+
- [DataGridPremium] Make Aggregation keyboard accessible in the column menu (#15934) @k-rajat19
|
|
50
|
+
- [DataGridPremium] Server-side aggregation with data source (#15741) @MBilalShafi
|
|
51
|
+
|
|
52
|
+
### Date and Time Pickers
|
|
53
|
+
|
|
54
|
+
#### Breaking changes
|
|
55
|
+
|
|
56
|
+
- The `date-fns` and `date-fns-jalali` date library adapters have been renamed to better align with the current stable major versions — [Learn more](https://next.mui.com/x/migration/migration-pickers-v7/#✅-rename-date-fns-adapter-imports)
|
|
57
|
+
- Update default `closeOnSelect` and Action Bar `actions` values - [Learn more](https://next.mui.com/x/migration/migration-pickers-v7/#update-default-closeonselect-and-action-bar-actions-values)
|
|
58
|
+
- The component passed to the `layout` slot no longer receives the `value`, `onChange` and `onSelectShortcut` props — [Learn more](https://next.mui.com/x/migration/migration-pickers-v7/#slot-layout).
|
|
59
|
+
- The component passed to the `toolbar` slot no longer receives the `value`, `onChange` and `isLandscape` props — [Learn more](https://next.mui.com/x/migration/migration-pickers-v7/#slot-toolbar).
|
|
60
|
+
- The component passed to the `shortcuts` slot no longer receives the `onChange`, `isValid` and `isLandscape` props — [Learn more](https://next.mui.com/x/migration/migration-pickers-v7/#slot-shortcuts).
|
|
61
|
+
- The `PickerShortcutChangeImportance` type has been renamed `PickerChangeImportance` — [Learn more](https://next.mui.com/x/migration/migration-pickers-v7/#renamed-variables-and-types).
|
|
62
|
+
- The component passed to the `layout` slot no longer receives the `rangePosition` and `onRangePositionChange` on range pickers — [Learn more](https://next.mui.com/x/migration/migration-pickers-v7/#slot-layout).
|
|
63
|
+
- The component passed to the `toolbar` slot no longer receives the `rangePosition` and `onRangePositionChange` on range pickers — [Learn more](https://next.mui.com/x/migration/migration-pickers-v7/#slot-toolbar).
|
|
64
|
+
- The component passed to the `tabs` slot no longer receives the `rangePosition` and `onRangePositionChange` on range pickers — [Learn more](https://next.mui.com/x/migration/migration-pickers-v7/#slot-tabs).
|
|
65
|
+
|
|
66
|
+
#### `@mui/x-date-pickers@8.0.0-alpha.7`
|
|
67
|
+
|
|
68
|
+
- [fields] Handle focusing container with `inputRef.current.focus` on `accessibleFieldDOMStructure` (#15985) @LukasTy
|
|
69
|
+
- [pickers] Always use `setValue` internally to update the picker value (#16056) @flaviendelangle
|
|
70
|
+
- [pickers] Create a new context to pass the range position props to the layout components and to the views (#15846) @flaviendelangle
|
|
71
|
+
- [pickers] Introduce a new concept of `manager` (#15339) @flaviendelangle
|
|
72
|
+
- [pickers] Improve React 19 support (#15769) @LukasTy
|
|
73
|
+
- [pickers] Memoize `<PickersActionBar />` (#16071) @LukasTy
|
|
74
|
+
- [pickers] Remove `NonEmptyDateRange` type (#16035) @flaviendelangle
|
|
75
|
+
- [pickers] Rename `AdapterDateFns` into `AdapterDateFnsV2` and `AdapterDateFnsV3` into `AdapterDateFns` (#16082) @LukasTy
|
|
76
|
+
- [pickers] Rename `ctx.onViewChange` to `ctx.setView` and add it to the actions context (#16044) @flaviendelangle
|
|
77
|
+
- [pickers] Support `date-fns-jalali` v4 (#16011) @LukasTy
|
|
78
|
+
- [pickers] Update `closeOnSelect` and `actionBar.actions` default values (#15944) @LukasTy
|
|
79
|
+
- [pickers] Use `usePickerContext()` and `usePickerActionsContext()` instead of passing props to the `shortcuts` and `toolbar` slots (#15948) @flaviendelangle
|
|
80
|
+
- [l10n] Add Chinese (Taiwan) (zh-TW) locale (#16033) @nusr
|
|
81
|
+
- [l10n] Improve Norwegian (nb-NO) locale (#16089) @josteinjhauge
|
|
82
|
+
|
|
83
|
+
#### `@mui/x-date-pickers-pro@8.0.0-alpha.7` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
84
|
+
|
|
85
|
+
Same changes as in `@mui/x-date-pickers@8.0.0-alpha.7`.
|
|
86
|
+
|
|
87
|
+
### Charts
|
|
88
|
+
|
|
89
|
+
#### Breaking changes
|
|
90
|
+
|
|
91
|
+
- Removed `DefaultChartsLegend` component, since it is now easier to create custom legends — [Learn more](https://next.mui.com/x/react-charts/components/#html-components).
|
|
92
|
+
- The default legend is now an HTML element and can be styled more easily.
|
|
93
|
+
- The `width` and `height` properties of the charts now only apply to the `svg` element, and not their wrappers, this might cause some layout shifts.
|
|
94
|
+
- `slotProps.legend.direction` now accepts `'horizontal' | 'vertical'` instead of `'row' | 'column'` — [Learn more](https://next.mui.com/x/migration/migration-charts-v7/#legend-direction-value-change-✅).
|
|
95
|
+
- The `getSeriesToDisplay` function was removed in favor of the `useLegend` hook. — [Learn more](https://next.mui.com/x/migration/migration-charts-v7/#the-getseriestodisplay-function-was-removed).
|
|
96
|
+
|
|
97
|
+
#### `@mui/x-charts@8.0.0-alpha.7`
|
|
98
|
+
|
|
99
|
+
- [charts] New HTML legend & styles (#15733) @JCQuintas
|
|
100
|
+
- [charts] Improve React 19 support (#15769) @LukasTy
|
|
101
|
+
- [charts] Fix 301 redirection in the API documentation @oliviertassinari
|
|
102
|
+
|
|
103
|
+
#### `@mui/x-charts-pro@8.0.0-alpha.7` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
104
|
+
|
|
105
|
+
Same changes as in `@mui/x-charts@8.0.0-alpha.7`.
|
|
106
|
+
|
|
107
|
+
### Tree View
|
|
108
|
+
|
|
109
|
+
#### `@mui/x-tree-view@8.0.0-alpha.7`
|
|
110
|
+
|
|
111
|
+
- [TreeView] Improve React 19 support (#15769) @LukasTy
|
|
112
|
+
|
|
113
|
+
#### `@mui/x-tree-view-pro@8.0.0-alpha.7` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
114
|
+
|
|
115
|
+
Same changes as in `@mui/x-tree-view@8.0.0-alpha.7`.
|
|
116
|
+
|
|
117
|
+
### Docs
|
|
118
|
+
|
|
119
|
+
- [docs] Fix `EditingWithDatePickers` demo (#15967) @k-rajat19
|
|
120
|
+
- [docs] Fix inconsistent multi input range field separators (#16043) @flaviendelangle
|
|
121
|
+
- [docs] Fix non-existing "adapter" property of `LocalizationProvider` (#16084) @tomashauser
|
|
122
|
+
- [docs] Refactor Data Grid with Date Pickers example (#15992) @LukasTy
|
|
123
|
+
- [docs] Unify the wording of the pickers slots breaking changes (#16036) @flaviendelangle
|
|
124
|
+
|
|
125
|
+
### Core
|
|
126
|
+
|
|
127
|
+
- [core] Clarify the release strategy (#16014) @MBilalShafi
|
|
128
|
+
- [core] Small fixes on docs @oliviertassinari
|
|
129
|
+
- [core] Sync with other repos @oliviertassinari
|
|
130
|
+
- [core] Update the `release:version` docs (#16038) @cherniavskii
|
|
131
|
+
- [code-infra] Add `testSkipIf` and `describeSkipIf` (#16049) @JCQuintas
|
|
132
|
+
- [test] Stabilize flaky Data Grid tests (#16053) @LukasTy
|
|
133
|
+
|
|
134
|
+
## 8.0.0-alpha.6
|
|
135
|
+
|
|
136
|
+
_Dec 26, 2024_
|
|
137
|
+
|
|
138
|
+
We'd like to offer a big thanks to the 8 contributors who made this release possible. Here are some highlights ✨:
|
|
139
|
+
|
|
140
|
+
- 🏎️ Improve Data Grid scrolling performance
|
|
141
|
+
- 🌍 Improve Dutch (nl-NL) locale on the Data Grid
|
|
142
|
+
- 🐞 Bugfixes
|
|
143
|
+
|
|
144
|
+
Special thanks go out to the community contributors who have helped make this release possible:
|
|
145
|
+
@JoepVerkoelen, @k-rajat19, @lauri865.
|
|
146
|
+
Following are all team members who have contributed to this release:
|
|
147
|
+
@flaviendelangle, @JCQuintas, @LukasTy, @MBilalShafi, @romgrk.
|
|
148
|
+
|
|
149
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
150
|
+
|
|
151
|
+
### Data Grid
|
|
152
|
+
|
|
153
|
+
#### Breaking changes
|
|
154
|
+
|
|
155
|
+
- The `sanitizeFilterItemValue()` utility is not exported anymore.
|
|
156
|
+
|
|
157
|
+
#### `@mui/x-data-grid@8.0.0-alpha.6`
|
|
158
|
+
|
|
159
|
+
- [DataGrid] Avoid subscribing to `renderContext` state in grid root for better scroll performance (#15986) @lauri865
|
|
160
|
+
- [DataGrid] Fix header filters showing clear button while empty (#15829) @k-rajat19
|
|
161
|
+
- [DataGrid] Improve test coverage of server side data source (#15942) @MBilalShafi
|
|
162
|
+
- [DataGrid] Move progress components to leaf import (#15914) @romgrk
|
|
163
|
+
- [DataGrid] Move skeleton to leaf import (#15931) @romgrk
|
|
164
|
+
- [DataGrid] Replace `forwardRef` with a shim for forward compatibility (#15955) @lauri865
|
|
165
|
+
- [l10n] Improve Dutch (nl-NL) locale (#15994) @JoepVerkoelen
|
|
166
|
+
|
|
167
|
+
#### `@mui/x-data-grid-pro@8.0.0-alpha.6` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
168
|
+
|
|
169
|
+
Same changes as in `@mui/x-data-grid@8.0.0-alpha.6`.
|
|
170
|
+
|
|
171
|
+
#### `@mui/x-data-grid-premium@8.0.0-alpha.6` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
172
|
+
|
|
173
|
+
Same changes as in `@mui/x-data-grid-pro@8.0.0-alpha.6`, plus:
|
|
174
|
+
|
|
175
|
+
- [DataGridPremium] Fix column unpinning with row grouping (#15908) @k-rajat19
|
|
176
|
+
|
|
177
|
+
### Date and Time Pickers
|
|
178
|
+
|
|
179
|
+
#### `@mui/x-date-pickers@8.0.0-alpha.6`
|
|
180
|
+
|
|
181
|
+
- [pickers] Use `usePickerContext()` and `usePickerActionsContext()` to get the actions in the `actionBar` slot and in internal components (#15843) @flaviendelangle
|
|
182
|
+
- [pickers] Use `usePickerContext()` to get the view-related props in the layout, toolbar and tabs slots (#15606) @flaviendelangle
|
|
183
|
+
|
|
184
|
+
#### `@mui/x-date-pickers-pro@8.0.0-alpha.6` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
185
|
+
|
|
186
|
+
Same changes as in `@mui/x-date-pickers@8.0.0-alpha.6`.
|
|
187
|
+
|
|
188
|
+
### Charts
|
|
189
|
+
|
|
190
|
+
#### `@mui/x-charts@8.0.0-alpha.6`
|
|
191
|
+
|
|
192
|
+
No changes since `@mui/x-charts@v8.0.0-alpha.5`.
|
|
193
|
+
|
|
194
|
+
#### `@mui/x-charts-pro@8.0.0-alpha.6` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
195
|
+
|
|
196
|
+
Same changes as in `@mui/x-charts@8.0.0-alpha.6`.
|
|
197
|
+
|
|
198
|
+
### Tree View
|
|
199
|
+
|
|
200
|
+
#### `@mui/x-tree-view@8.0.0-alpha.6`
|
|
201
|
+
|
|
202
|
+
No changes since `@mui/x-tree-view-pro@v8.0.0-alpha.5`.
|
|
203
|
+
|
|
204
|
+
#### `@mui/x-tree-view-pro@8.0.0-alpha.6` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
205
|
+
|
|
206
|
+
Same changes as in `@mui/x-tree-view@8.0.0-alpha.6`.
|
|
207
|
+
|
|
208
|
+
### Docs
|
|
209
|
+
|
|
210
|
+
- [docs] Remove production profiler from docs build (#15959) @lauri865
|
|
211
|
+
- [code-infra] Add new `next-env.d.ts` changes (#15947) @JCQuintas
|
|
212
|
+
|
|
8
213
|
## 8.0.0-alpha.5
|
|
9
214
|
|
|
10
215
|
_Dec 19, 2024_
|
|
@@ -25,7 +230,7 @@ Following are all team members who have contributed to this release:
|
|
|
25
230
|
|
|
26
231
|
#### Breaking changes
|
|
27
232
|
|
|
28
|
-
- Passing additional props (like `data-*`, `aria-*`) directly on the Data Grid component is no longer supported. To pass the props, use `slotProps
|
|
233
|
+
- Passing additional props (like `data-*`, `aria-*`) directly on the Data Grid component is no longer supported. To pass the props, use `slotProps`:
|
|
29
234
|
|
|
30
235
|
- For `.root` element, use `slotProps.root`.
|
|
31
236
|
- For `.main` element (the one with `role="grid"`), use `slotProps.main`.
|
|
@@ -27,6 +27,7 @@ import { useDragRange } from "./useDragRange.js";
|
|
|
27
27
|
import { useRangePosition } from "../internals/hooks/useRangePosition.js";
|
|
28
28
|
import { DAY_RANGE_SIZE, DAY_MARGIN } from "../internals/constants/dimensions.js";
|
|
29
29
|
import { PickersRangeCalendarHeader } from "../PickersRangeCalendarHeader/index.js";
|
|
30
|
+
import { useNullablePickerRangePositionContext } from "../internals/hooks/useNullablePickerRangePositionContext.js";
|
|
30
31
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
31
32
|
const releaseInfo = getReleaseInfo();
|
|
32
33
|
const DateRangeCalendarRoot = styled('div', {
|
|
@@ -135,8 +136,8 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
|
|
|
135
136
|
reduceAnimations,
|
|
136
137
|
onMonthChange,
|
|
137
138
|
rangePosition: rangePositionProp,
|
|
138
|
-
defaultRangePosition:
|
|
139
|
-
onRangePositionChange:
|
|
139
|
+
defaultRangePosition: defaultRangePositionProp,
|
|
140
|
+
onRangePositionChange: onRangePositionChangeProp,
|
|
140
141
|
calendars,
|
|
141
142
|
currentMonthCalendarPosition = 1,
|
|
142
143
|
slots,
|
|
@@ -161,6 +162,7 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
|
|
|
161
162
|
onViewChange
|
|
162
163
|
} = props,
|
|
163
164
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
165
|
+
const rangePositionContext = useNullablePickerRangePositionContext();
|
|
164
166
|
const {
|
|
165
167
|
value,
|
|
166
168
|
handleValueChange,
|
|
@@ -192,9 +194,9 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
|
|
|
192
194
|
rangePosition,
|
|
193
195
|
onRangePositionChange
|
|
194
196
|
} = useRangePosition({
|
|
195
|
-
rangePosition: rangePositionProp,
|
|
196
|
-
defaultRangePosition:
|
|
197
|
-
onRangePositionChange:
|
|
197
|
+
rangePosition: rangePositionProp ?? rangePositionContext?.rangePosition,
|
|
198
|
+
defaultRangePosition: defaultRangePositionProp,
|
|
199
|
+
onRangePositionChange: onRangePositionChangeProp ?? rangePositionContext?.onRangePositionChange
|
|
198
200
|
});
|
|
199
201
|
const handleDatePositionChange = useEventCallback(position => {
|
|
200
202
|
if (rangePosition !== position) {
|
|
@@ -228,7 +230,7 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
|
|
|
228
230
|
|
|
229
231
|
// Range going for the start of the start day to the end of the end day.
|
|
230
232
|
// This makes sure that `isWithinRange` works with any time in the start and end day.
|
|
231
|
-
const valueDayRange = React.useMemo(() => [
|
|
233
|
+
const valueDayRange = React.useMemo(() => [!utils.isValid(value[0]) ? value[0] : utils.startOfDay(value[0]), !utils.isValid(value[1]) ? value[1] : utils.endOfDay(value[1])], [value, utils]);
|
|
232
234
|
const _useDragRange = useDragRange({
|
|
233
235
|
disableDragEditing: shouldDisableDragEditing,
|
|
234
236
|
onDrop: handleDrop,
|
|
@@ -316,7 +318,7 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
|
|
|
316
318
|
const prevValue = React.useRef(null);
|
|
317
319
|
React.useEffect(() => {
|
|
318
320
|
const date = rangePosition === 'start' ? value[0] : value[1];
|
|
319
|
-
if (!
|
|
321
|
+
if (!utils.isValid(date)) {
|
|
320
322
|
return;
|
|
321
323
|
}
|
|
322
324
|
const prevDate = rangePosition === 'start' ? prevValue.current?.[0] : prevValue.current?.[1];
|
|
@@ -63,7 +63,7 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
|
|
|
63
63
|
calendars: PropTypes.oneOf([1, 2, 3]),
|
|
64
64
|
className: PropTypes.string,
|
|
65
65
|
/**
|
|
66
|
-
* If `true`, the
|
|
66
|
+
* If `true`, the Picker will close after submitting the full date.
|
|
67
67
|
* @default `true` for desktop, `false` for mobile (based on the chosen wrapper and `desktopModeMediaQuery` prop).
|
|
68
68
|
*/
|
|
69
69
|
closeOnSelect: PropTypes.bool,
|
|
@@ -24,6 +24,11 @@ export interface DateRangePickerProps<TEnableAccessibleFieldDOMStructure extends
|
|
|
24
24
|
* @default {}
|
|
25
25
|
*/
|
|
26
26
|
slotProps?: DateRangePickerSlotProps<TEnableAccessibleFieldDOMStructure>;
|
|
27
|
+
/**
|
|
28
|
+
* If `true`, the Picker will close after submitting the full date.
|
|
29
|
+
* @default `true` for desktop, `false` for mobile (based on the chosen wrapper and `desktopModeMediaQuery` prop).
|
|
30
|
+
*/
|
|
31
|
+
closeOnSelect?: boolean;
|
|
27
32
|
}
|
|
28
33
|
/**
|
|
29
34
|
* Props the field can receive when used inside a date range picker (<DateRangePicker />, <DesktopDateRangePicker /> or <MobileDateRangePicker /> component).
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { BaseToolbarProps, ExportedBaseToolbarProps
|
|
3
|
-
import { UseRangePositionResponse } from '../internals/hooks/useRangePosition';
|
|
2
|
+
import { BaseToolbarProps, ExportedBaseToolbarProps } from '@mui/x-date-pickers/internals';
|
|
4
3
|
import { DateRangePickerToolbarClasses } from './dateRangePickerToolbarClasses';
|
|
5
|
-
export interface DateRangePickerToolbarProps extends ExportedDateRangePickerToolbarProps, Omit<BaseToolbarProps
|
|
4
|
+
export interface DateRangePickerToolbarProps extends ExportedDateRangePickerToolbarProps, Omit<BaseToolbarProps, 'onChange' | 'isLandscape'> {
|
|
6
5
|
}
|
|
7
6
|
export interface ExportedDateRangePickerToolbarProps extends ExportedBaseToolbarProps {
|
|
8
7
|
/**
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["
|
|
5
|
+
const _excluded = ["toolbarFormat", "className", "classes"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import clsx from 'clsx';
|
|
@@ -10,8 +10,9 @@ import Typography from '@mui/material/Typography';
|
|
|
10
10
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
11
11
|
import composeClasses from '@mui/utils/composeClasses';
|
|
12
12
|
import { PickersToolbar, PickersToolbarButton, useUtils, useToolbarOwnerState } from '@mui/x-date-pickers/internals';
|
|
13
|
-
import { usePickerTranslations } from '@mui/x-date-pickers/hooks';
|
|
13
|
+
import { usePickerContext, usePickerTranslations } from '@mui/x-date-pickers/hooks';
|
|
14
14
|
import { getDateRangePickerToolbarUtilityClass } from "./dateRangePickerToolbarClasses.js";
|
|
15
|
+
import { usePickerRangePositionContext } from "../hooks/index.js";
|
|
15
16
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
17
|
const useUtilityClasses = classes => {
|
|
17
18
|
const slots = {
|
|
@@ -49,38 +50,48 @@ const DateRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateRangeP
|
|
|
49
50
|
name: 'MuiDateRangePickerToolbar'
|
|
50
51
|
});
|
|
51
52
|
const {
|
|
52
|
-
|
|
53
|
-
rangePosition,
|
|
54
|
-
onRangePositionChange,
|
|
55
|
-
toolbarFormat,
|
|
53
|
+
toolbarFormat: toolbarFormatProp,
|
|
56
54
|
className,
|
|
57
55
|
classes: classesProp
|
|
58
56
|
} = props,
|
|
59
57
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
58
|
+
const {
|
|
59
|
+
value
|
|
60
|
+
} = usePickerContext();
|
|
60
61
|
const translations = usePickerTranslations();
|
|
61
62
|
const ownerState = useToolbarOwnerState();
|
|
63
|
+
const {
|
|
64
|
+
rangePosition,
|
|
65
|
+
onRangePositionChange
|
|
66
|
+
} = usePickerRangePositionContext();
|
|
62
67
|
const classes = useUtilityClasses(classesProp);
|
|
63
|
-
|
|
64
|
-
|
|
68
|
+
|
|
69
|
+
// This can't be a default value when spreading because it breaks the API generation.
|
|
70
|
+
const toolbarFormat = toolbarFormatProp ?? utils.formats.shortDate;
|
|
71
|
+
const formatDate = (date, fallback) => {
|
|
72
|
+
if (!utils.isValid(date)) {
|
|
73
|
+
return fallback;
|
|
74
|
+
}
|
|
75
|
+
return utils.formatByString(date, toolbarFormat);
|
|
76
|
+
};
|
|
65
77
|
return /*#__PURE__*/_jsx(DateRangePickerToolbarRoot, _extends({}, other, {
|
|
66
78
|
toolbarTitle: translations.dateRangePickerToolbarTitle,
|
|
67
|
-
isLandscape: false,
|
|
68
79
|
className: clsx(classes.root, className),
|
|
69
80
|
ownerState: ownerState,
|
|
70
81
|
ref: ref,
|
|
71
82
|
children: /*#__PURE__*/_jsxs(DateRangePickerToolbarContainer, {
|
|
72
83
|
className: classes.container,
|
|
73
84
|
children: [/*#__PURE__*/_jsx(PickersToolbarButton, {
|
|
74
|
-
variant:
|
|
75
|
-
value:
|
|
85
|
+
variant: value[0] == null ? 'h6' : 'h5',
|
|
86
|
+
value: formatDate(value[0], translations.start),
|
|
76
87
|
selected: rangePosition === 'start',
|
|
77
88
|
onClick: () => onRangePositionChange('start')
|
|
78
89
|
}), /*#__PURE__*/_jsxs(Typography, {
|
|
79
90
|
variant: "h5",
|
|
80
91
|
children: ["\xA0", '–', "\xA0"]
|
|
81
92
|
}), /*#__PURE__*/_jsx(PickersToolbarButton, {
|
|
82
|
-
variant:
|
|
83
|
-
value:
|
|
93
|
+
variant: value[1] == null ? 'h6' : 'h5',
|
|
94
|
+
value: formatDate(value[1], translations.end),
|
|
84
95
|
selected: rangePosition === 'end',
|
|
85
96
|
onClick: () => onRangePositionChange('end')
|
|
86
97
|
})]
|
|
@@ -102,14 +113,6 @@ process.env.NODE_ENV !== "production" ? DateRangePickerToolbar.propTypes = {
|
|
|
102
113
|
* @default `true` for Desktop, `false` for Mobile.
|
|
103
114
|
*/
|
|
104
115
|
hidden: PropTypes.bool,
|
|
105
|
-
onRangePositionChange: PropTypes.func.isRequired,
|
|
106
|
-
/**
|
|
107
|
-
* Callback called when a toolbar is clicked
|
|
108
|
-
* @template TView
|
|
109
|
-
* @param {TView} view The view to open
|
|
110
|
-
*/
|
|
111
|
-
onViewChange: PropTypes.func.isRequired,
|
|
112
|
-
rangePosition: PropTypes.oneOf(['end', 'start']).isRequired,
|
|
113
116
|
/**
|
|
114
117
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
115
118
|
*/
|
|
@@ -123,15 +126,6 @@ process.env.NODE_ENV !== "production" ? DateRangePickerToolbar.propTypes = {
|
|
|
123
126
|
* Toolbar value placeholder—it is displayed when the value is empty.
|
|
124
127
|
* @default "––"
|
|
125
128
|
*/
|
|
126
|
-
toolbarPlaceholder: PropTypes.node
|
|
127
|
-
value: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
128
|
-
/**
|
|
129
|
-
* Currently visible picker view.
|
|
130
|
-
*/
|
|
131
|
-
view: PropTypes.oneOf(['day']).isRequired,
|
|
132
|
-
/**
|
|
133
|
-
* Available views.
|
|
134
|
-
*/
|
|
135
|
-
views: PropTypes.arrayOf(PropTypes.oneOf(['day'])).isRequired
|
|
129
|
+
toolbarPlaceholder: PropTypes.node
|
|
136
130
|
} : void 0;
|
|
137
131
|
export { DateRangePickerToolbar };
|
|
@@ -33,7 +33,7 @@ export interface BaseDateRangePickerProps extends Omit<BasePickerInputProps<Pick
|
|
|
33
33
|
* If `null`, the section will only have field editing.
|
|
34
34
|
* If `undefined`, internally defined view will be used.
|
|
35
35
|
*/
|
|
36
|
-
viewRenderers?: Partial<PickerViewRendererLookup<PickerRangeValue, 'day', DateRangeViewRendererProps<'day'
|
|
36
|
+
viewRenderers?: Partial<PickerViewRendererLookup<PickerRangeValue, 'day', DateRangeViewRendererProps<'day'>>>;
|
|
37
37
|
}
|
|
38
38
|
type UseDateRangePickerDefaultizedProps<Props extends BaseDateRangePickerProps> = LocalizedComponent<DefaultizedProps<Props, ValidateDateRangePropsToDefault>>;
|
|
39
39
|
export declare function useDateRangePickerDefaultizedProps<Props extends BaseDateRangePickerProps>(props: Props, name: string): UseDateRangePickerDefaultizedProps<Props>;
|
|
@@ -68,8 +68,8 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePicker.propTypes = {
|
|
|
68
68
|
calendars: PropTypes.oneOf([1, 2, 3]),
|
|
69
69
|
className: PropTypes.string,
|
|
70
70
|
/**
|
|
71
|
-
* If `true`, the
|
|
72
|
-
* @default
|
|
71
|
+
* If `true`, the Picker will close after submitting the full date.
|
|
72
|
+
* @default false
|
|
73
73
|
*/
|
|
74
74
|
closeOnSelect: PropTypes.bool,
|
|
75
75
|
/**
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ExportedBaseTabsProps } from '@mui/x-date-pickers/internals';
|
|
3
3
|
import { DateTimeRangePickerTabsClasses } from './dateTimeRangePickerTabsClasses';
|
|
4
|
-
import { UseRangePositionResponse } from '../internals/hooks/useRangePosition';
|
|
5
4
|
export interface ExportedDateTimeRangePickerTabsProps extends ExportedBaseTabsProps {
|
|
6
5
|
/**
|
|
7
6
|
* Toggles visibility of the tabs allowing view switching.
|
|
@@ -12,18 +11,18 @@ export interface ExportedDateTimeRangePickerTabsProps extends ExportedBaseTabsPr
|
|
|
12
11
|
* Date tab icon.
|
|
13
12
|
* @default DateRangeIcon
|
|
14
13
|
*/
|
|
15
|
-
dateIcon?: React.ReactElement
|
|
14
|
+
dateIcon?: React.ReactElement<any>;
|
|
16
15
|
/**
|
|
17
16
|
* Time tab icon.
|
|
18
17
|
* @default TimeIcon
|
|
19
18
|
*/
|
|
20
|
-
timeIcon?: React.ReactElement
|
|
19
|
+
timeIcon?: React.ReactElement<any>;
|
|
21
20
|
/**
|
|
22
21
|
* Override or extend the styles applied to the component.
|
|
23
22
|
*/
|
|
24
23
|
classes?: Partial<DateTimeRangePickerTabsClasses>;
|
|
25
24
|
}
|
|
26
|
-
export interface DateTimeRangePickerTabsProps extends ExportedDateTimeRangePickerTabsProps
|
|
25
|
+
export interface DateTimeRangePickerTabsProps extends ExportedDateTimeRangePickerTabsProps {
|
|
27
26
|
}
|
|
28
27
|
declare const DateTimeRangePickerTabs: {
|
|
29
28
|
(inProps: DateTimeRangePickerTabsProps): React.JSX.Element | null;
|
|
@@ -8,10 +8,11 @@ import composeClasses from '@mui/utils/composeClasses';
|
|
|
8
8
|
import useEventCallback from '@mui/utils/useEventCallback';
|
|
9
9
|
import { TimeIcon, DateRangeIcon, ArrowLeftIcon, ArrowRightIcon } from '@mui/x-date-pickers/icons';
|
|
10
10
|
import { isDatePickerView, usePickerPrivateContext } from '@mui/x-date-pickers/internals';
|
|
11
|
-
import { usePickerTranslations } from '@mui/x-date-pickers/hooks';
|
|
11
|
+
import { usePickerContext, usePickerTranslations } from '@mui/x-date-pickers/hooks';
|
|
12
12
|
import IconButton from '@mui/material/IconButton';
|
|
13
13
|
import Button from '@mui/material/Button';
|
|
14
14
|
import { getDateTimeRangePickerTabsUtilityClass } from "./dateTimeRangePickerTabsClasses.js";
|
|
15
|
+
import { usePickerRangePositionContext } from "../hooks/index.js";
|
|
15
16
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
17
|
const viewToTab = (view, rangePosition) => {
|
|
17
18
|
if (isDatePickerView(view)) {
|
|
@@ -69,12 +70,8 @@ const DateTimeRangePickerTabs = function DateTimeRangePickerTabs(inProps) {
|
|
|
69
70
|
});
|
|
70
71
|
const {
|
|
71
72
|
dateIcon = /*#__PURE__*/_jsx(DateRangeIcon, {}),
|
|
72
|
-
onViewChange,
|
|
73
73
|
timeIcon = /*#__PURE__*/_jsx(TimeIcon, {}),
|
|
74
|
-
view,
|
|
75
74
|
hidden = typeof window === 'undefined' || window.innerHeight < 667,
|
|
76
|
-
rangePosition,
|
|
77
|
-
onRangePositionChange,
|
|
78
75
|
className,
|
|
79
76
|
classes: classesProp,
|
|
80
77
|
sx
|
|
@@ -83,8 +80,16 @@ const DateTimeRangePickerTabs = function DateTimeRangePickerTabs(inProps) {
|
|
|
83
80
|
const {
|
|
84
81
|
ownerState
|
|
85
82
|
} = usePickerPrivateContext();
|
|
83
|
+
const {
|
|
84
|
+
view,
|
|
85
|
+
setView
|
|
86
|
+
} = usePickerContext();
|
|
86
87
|
const classes = useUtilityClasses(classesProp);
|
|
87
|
-
const
|
|
88
|
+
const {
|
|
89
|
+
rangePosition,
|
|
90
|
+
onRangePositionChange
|
|
91
|
+
} = usePickerRangePositionContext();
|
|
92
|
+
const value = React.useMemo(() => view == null ? null : viewToTab(view, rangePosition), [view, rangePosition]);
|
|
88
93
|
const isPreviousHidden = value === 'start-date';
|
|
89
94
|
const isNextHidden = value === 'end-time';
|
|
90
95
|
const tabLabel = React.useMemo(() => {
|
|
@@ -109,18 +114,26 @@ const DateTimeRangePickerTabs = function DateTimeRangePickerTabs(inProps) {
|
|
|
109
114
|
}
|
|
110
115
|
});
|
|
111
116
|
const changeToPreviousTab = useEventCallback(() => {
|
|
112
|
-
const previousTab = tabOptions[tabOptions.indexOf(value) - 1];
|
|
113
|
-
|
|
117
|
+
const previousTab = value == null ? tabOptions[0] : tabOptions[tabOptions.indexOf(value) - 1];
|
|
118
|
+
setView(tabToView(previousTab));
|
|
114
119
|
handleRangePositionChange(previousTab);
|
|
115
120
|
});
|
|
116
121
|
const changeToNextTab = useEventCallback(() => {
|
|
117
|
-
const nextTab = tabOptions[tabOptions.indexOf(value) + 1];
|
|
118
|
-
|
|
122
|
+
const nextTab = value == null ? tabOptions[0] : tabOptions[tabOptions.indexOf(value) + 1];
|
|
123
|
+
setView(tabToView(nextTab));
|
|
119
124
|
handleRangePositionChange(nextTab);
|
|
120
125
|
});
|
|
121
126
|
if (hidden) {
|
|
122
127
|
return null;
|
|
123
128
|
}
|
|
129
|
+
let startIcon;
|
|
130
|
+
if (view == null) {
|
|
131
|
+
startIcon = null;
|
|
132
|
+
} else if (isDatePickerView(view)) {
|
|
133
|
+
startIcon = dateIcon;
|
|
134
|
+
} else {
|
|
135
|
+
startIcon = timeIcon;
|
|
136
|
+
}
|
|
124
137
|
return /*#__PURE__*/_jsxs(DateTimeRangePickerTabsRoot, {
|
|
125
138
|
ownerState: ownerState,
|
|
126
139
|
className: clsx(classes.root, className),
|
|
@@ -133,7 +146,7 @@ const DateTimeRangePickerTabs = function DateTimeRangePickerTabs(inProps) {
|
|
|
133
146
|
}) : /*#__PURE__*/_jsx(DateTimeRangePickerTabFiller, {
|
|
134
147
|
className: classes.filler
|
|
135
148
|
}), /*#__PURE__*/_jsx(DateTimeRangePickerTab, {
|
|
136
|
-
startIcon:
|
|
149
|
+
startIcon: startIcon,
|
|
137
150
|
className: classes.tabButton,
|
|
138
151
|
size: "large",
|
|
139
152
|
children: tabLabel
|
|
@@ -167,14 +180,6 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePickerTabs.propTypes = {
|
|
|
167
180
|
* @default `window.innerHeight < 667` for `DesktopDateTimeRangePicker` and `MobileDateTimeRangePicker`
|
|
168
181
|
*/
|
|
169
182
|
hidden: PropTypes.bool,
|
|
170
|
-
onRangePositionChange: PropTypes.func.isRequired,
|
|
171
|
-
/**
|
|
172
|
-
* Callback called when a tab is clicked.
|
|
173
|
-
* @template TView
|
|
174
|
-
* @param {TView} view The view to open
|
|
175
|
-
*/
|
|
176
|
-
onViewChange: PropTypes.func.isRequired,
|
|
177
|
-
rangePosition: PropTypes.oneOf(['end', 'start']).isRequired,
|
|
178
183
|
/**
|
|
179
184
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
180
185
|
*/
|
|
@@ -183,10 +188,6 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePickerTabs.propTypes = {
|
|
|
183
188
|
* Time tab icon.
|
|
184
189
|
* @default TimeIcon
|
|
185
190
|
*/
|
|
186
|
-
timeIcon: PropTypes.element
|
|
187
|
-
/**
|
|
188
|
-
* Currently visible picker view.
|
|
189
|
-
*/
|
|
190
|
-
view: PropTypes.oneOf(['day', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'year']).isRequired
|
|
191
|
+
timeIcon: PropTypes.element
|
|
191
192
|
} : void 0;
|
|
192
193
|
export { DateTimeRangePickerTabs };
|