@mui/x-date-pickers 7.7.1 → 7.8.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/AdapterDateFns/AdapterDateFns.d.ts +0 -1
- package/AdapterDateFnsJalali/AdapterDateFnsJalali.d.ts +0 -1
- package/CHANGELOG.md +100 -1
- package/DateCalendar/useCalendarState.d.ts +1 -1
- package/DateTimePicker/DateTimePickerToolbar.js +1 -1
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +3 -1
- package/DesktopDateTimePicker/DesktopDateTimePickerLayout.d.ts +1 -1
- package/TimeClock/ClockNumbers.d.ts +1 -1
- package/index.js +1 -1
- package/internals/components/PickerViewRoot/PickerViewRoot.d.ts +0 -1
- package/internals/hooks/date-helpers-hooks.d.ts +1 -1
- package/internals/hooks/defaultizedFieldProps.d.ts +2 -2
- package/internals/hooks/useField/useField.d.ts +3 -3
- package/internals/hooks/useField/useField.utils.d.ts +3 -3
- package/internals/hooks/useField/useFieldV6TextField.js +9 -3
- package/internals/hooks/usePicker/usePickerValue.types.d.ts +0 -1
- package/internals/utils/date-utils.d.ts +1 -1
- package/internals/utils/views.d.ts +1 -1
- package/internals/utils/warning.d.ts +1 -1
- package/modern/DateTimePicker/DateTimePickerToolbar.js +1 -1
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +3 -1
- package/modern/index.js +1 -1
- package/modern/internals/hooks/useField/useFieldV6TextField.js +9 -3
- package/node/DateTimePicker/DateTimePickerToolbar.js +2 -2
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +10 -8
- package/node/index.js +1 -1
- package/node/internals/hooks/useField/useFieldV6TextField.js +9 -3
- package/package.json +1 -1
- package/timeViewRenderers/timeViewRenderers.d.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,105 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 7.8.0
|
|
7
|
+
|
|
8
|
+
_Jun 28, 2024_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 10 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🛰 Introduce server-side data source for improved server integration in the Data Grid.
|
|
13
|
+
|
|
14
|
+
Supports server-side pagination, sorting and filtering on plain and tree data, and automatic caching.
|
|
15
|
+
|
|
16
|
+
To enable, provide a `getRows` function to the `unstable_dataSource` prop on the Data Grid component.
|
|
17
|
+
|
|
18
|
+
```tsx
|
|
19
|
+
const dataSource = {
|
|
20
|
+
getRows: async (params: GridServerGetRowsParams) => {
|
|
21
|
+
const data = await fetch(
|
|
22
|
+
`https://api.example.com/data?${new URLSearchParams({
|
|
23
|
+
page: params.page,
|
|
24
|
+
pageSize: params.pageSize,
|
|
25
|
+
sortModel: JSON.stringify(params.sortModel),
|
|
26
|
+
filterModel: JSON.stringify(params.filterModel),
|
|
27
|
+
}).toString()}`,
|
|
28
|
+
);
|
|
29
|
+
return {
|
|
30
|
+
rows: data.rows,
|
|
31
|
+
totalRows: data.totalRows,
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
}
|
|
35
|
+
<DataGridPro
|
|
36
|
+
unstable_dataSource={dataSource}
|
|
37
|
+
{...otherProps}
|
|
38
|
+
/>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
See [server-side data documentation](https://mui.com/x/react-data-grid/server-side-data/) for more details.
|
|
42
|
+
|
|
43
|
+
- 📈 Support Date data on the BarChart component
|
|
44
|
+
- ↕️ Support custom column sort icons on the Data Grid
|
|
45
|
+
- 🖱️ Support modifying the expansion trigger on the Tree View components
|
|
46
|
+
|
|
47
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
48
|
+
|
|
49
|
+
### Data Grid
|
|
50
|
+
|
|
51
|
+
#### `@mui/x-data-grid@7.8.0`
|
|
52
|
+
|
|
53
|
+
- [DataGrid] Add `columnHeaderSortIcon` slot (#13563) @arminmeh
|
|
54
|
+
- [DataGrid] Fix dimensions lag issue after autosize (#13587) @MBilalShafi
|
|
55
|
+
- [DataGrid] Fix print export failure when `hideFooter` option is set (#13034) @tarunrajput
|
|
56
|
+
|
|
57
|
+
#### `@mui/x-data-grid-pro@7.8.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
58
|
+
|
|
59
|
+
Same changes as in `@mui/x-data-grid@7.8.0`, plus:
|
|
60
|
+
|
|
61
|
+
- [DataGridPro] Fix multi-sorting indicator being cut off (#13625) @KenanYusuf
|
|
62
|
+
- [DataGridPro] Server-side tree data support (#12317) @MBilalShafi
|
|
63
|
+
|
|
64
|
+
#### `@mui/x-data-grid-premium@7.8.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
65
|
+
|
|
66
|
+
Same changes as in `@mui/x-data-grid-pro@7.8.0`.
|
|
67
|
+
|
|
68
|
+
### Date and Time Pickers
|
|
69
|
+
|
|
70
|
+
#### `@mui/x-date-pickers@7.8.0`
|
|
71
|
+
|
|
72
|
+
- [fields] Fix section clearing behavior on Android (#13652) @LukasTy
|
|
73
|
+
|
|
74
|
+
#### `@mui/x-date-pickers-pro@7.8.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
75
|
+
|
|
76
|
+
Same changes as in `@mui/x-date-pickers@7.8.0`.
|
|
77
|
+
|
|
78
|
+
### Charts
|
|
79
|
+
|
|
80
|
+
#### `@mui/x-charts@7.8.0`
|
|
81
|
+
|
|
82
|
+
- [charts] Fix line chart props not passing correct event handlers (#13609) @JCQuintas
|
|
83
|
+
- [charts] Support BarChart with `Date` data (#13471) @alexfauquette
|
|
84
|
+
- [charts] Support RTL for y-axis (#13614) @alexfauquette
|
|
85
|
+
- [charts] Use default values instead of non-null assertion to prevent error being thrown (#13637) @JCQuintas
|
|
86
|
+
|
|
87
|
+
### Tree View
|
|
88
|
+
|
|
89
|
+
#### `@mui/x-tree-view@7.8.0`
|
|
90
|
+
|
|
91
|
+
- [TreeView] Add `expansionTrigger` prop (#13533) @noraleonte
|
|
92
|
+
- [TreeView] Support experimental features from plugin's dependencies (#13632) @flaviendelangle
|
|
93
|
+
|
|
94
|
+
### Docs
|
|
95
|
+
|
|
96
|
+
- [docs] Add callout for `Luxon` `throwOnInvalid` support (#13621) @LukasTy
|
|
97
|
+
- [docs] Add "Overlays" section to the Data Grid documentation (#13624) @KenanYusuf
|
|
98
|
+
|
|
99
|
+
### Core
|
|
100
|
+
|
|
101
|
+
- [core] Add eslint rule to restrict import from `../internals` root (#13633) @JCQuintas
|
|
102
|
+
- [docs-infra] Sync `\_app` folder with monorepo (#13582) @Janpot
|
|
103
|
+
- [license] Allow usage of charts and tree view pro package for old premium licenses (#13619) @flaviendelangle
|
|
104
|
+
|
|
6
105
|
## 7.7.1
|
|
7
106
|
|
|
8
107
|
_Jun 21, 2024_
|
|
@@ -44,7 +143,7 @@ Same changes as in `@mui/x-data-grid-pro@7.7.1`.
|
|
|
44
143
|
- [pickers] Always use the same timezone in the field, the view and the layout components (#13481) @flaviendelangle
|
|
45
144
|
- [pickers] Fix `AdapterDateFnsV3` generated method types (#13464) @alexey-kozlenkov
|
|
46
145
|
- [pickers] Fix controlled `view` behavior (#13552) @LukasTy
|
|
47
|
-
- [TimePicker] Improves RTL verification for the time pickers default views
|
|
146
|
+
- [TimePicker] Improves RTL verification for the time pickers default views (#13447) @arthurbalduini
|
|
48
147
|
|
|
49
148
|
#### `@mui/x-date-pickers-pro@7.7.1` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
50
149
|
|
|
@@ -22,7 +22,7 @@ interface ChangeFocusedDayPayload<TDate extends PickerValidDate> {
|
|
|
22
22
|
*/
|
|
23
23
|
withoutMonthSwitchingAnimation?: boolean;
|
|
24
24
|
}
|
|
25
|
-
export declare const createCalendarStateReducer: <TDate extends PickerValidDate>(reduceAnimations: boolean, disableSwitchToMonthOnDayFocus: boolean, utils: MuiPickersAdapter<TDate>) => (state: CalendarState<TDate>, action: ReducerAction<
|
|
25
|
+
export declare const createCalendarStateReducer: <TDate extends PickerValidDate>(reduceAnimations: boolean, disableSwitchToMonthOnDayFocus: boolean, utils: MuiPickersAdapter<TDate>) => (state: CalendarState<TDate>, action: ReducerAction<"finishMonthSwitchingAnimation"> | ReducerAction<"changeMonth", ChangeMonthPayload<TDate>> | ReducerAction<"changeFocusedDay", ChangeFocusedDayPayload<TDate>>) => CalendarState<TDate>;
|
|
26
26
|
interface UseCalendarStateParams<TDate extends PickerValidDate> extends Pick<DateCalendarDefaultizedProps<TDate>, 'value' | 'referenceDate' | 'disableFuture' | 'disablePast' | 'minDate' | 'maxDate' | 'onMonthChange' | 'reduceAnimations' | 'shouldDisableDate'> {
|
|
27
27
|
disableSwitchToMonthOnDayFocus?: boolean;
|
|
28
28
|
timezone: PickersTimezone;
|
|
@@ -16,7 +16,7 @@ import { useMeridiemMode } from '../internals/hooks/date-helpers-hooks';
|
|
|
16
16
|
import { MULTI_SECTION_CLOCK_SECTION_WIDTH } from '../internals/constants/dimensions';
|
|
17
17
|
import { formatMeridiem } from '../internals/utils/date-utils';
|
|
18
18
|
import { pickersToolbarTextClasses } from '../internals/components/pickersToolbarTextClasses';
|
|
19
|
-
import { pickersToolbarClasses } from '../internals';
|
|
19
|
+
import { pickersToolbarClasses } from '../internals/components/pickersToolbarClasses';
|
|
20
20
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
21
|
const useUtilityClasses = ownerState => {
|
|
22
22
|
const {
|
|
@@ -17,10 +17,12 @@ import { useDesktopPicker } from '../internals/hooks/useDesktopPicker';
|
|
|
17
17
|
import { extractValidationProps } from '../internals/utils/validation/extractValidationProps';
|
|
18
18
|
import { resolveDateTimeFormat, resolveTimeViewsResponse } from '../internals/utils/date-time-utils';
|
|
19
19
|
import { renderDigitalClockTimeView, renderMultiSectionDigitalClockTimeView } from '../timeViewRenderers';
|
|
20
|
-
import { VIEW_HEIGHT, isDatePickerView, isInternalTimeView } from '../internals';
|
|
21
20
|
import { multiSectionDigitalClockClasses, multiSectionDigitalClockSectionClasses } from '../MultiSectionDigitalClock';
|
|
22
21
|
import { digitalClockClasses } from '../DigitalClock';
|
|
23
22
|
import { DesktopDateTimePickerLayout } from './DesktopDateTimePickerLayout';
|
|
23
|
+
import { VIEW_HEIGHT } from '../internals/constants/dimensions';
|
|
24
|
+
import { isInternalTimeView } from '../internals/utils/time-utils';
|
|
25
|
+
import { isDatePickerView } from '../internals/utils/date-utils';
|
|
24
26
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
25
27
|
const rendererInterceptor = function rendererInterceptor(inViewRenderers, popperView, rendererProps) {
|
|
26
28
|
const {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { PickersLayoutProps } from '../PickersLayout';
|
|
3
3
|
import { PickerValidDate } from '../models';
|
|
4
|
-
import { DateOrTimeViewWithMeridiem } from '../internals';
|
|
4
|
+
import { DateOrTimeViewWithMeridiem } from '../internals/models/common';
|
|
5
5
|
/**
|
|
6
6
|
* @ignore - internal component.
|
|
7
7
|
*/
|
|
@@ -18,7 +18,7 @@ interface GetHourNumbersOptions<TDate extends PickerValidDate> {
|
|
|
18
18
|
* @ignore - internal component.
|
|
19
19
|
*/
|
|
20
20
|
export declare const getHourNumbers: <TDate extends PickerValidDate>({ ampm, value, getClockNumberText, isDisabled, selectedId, utils, }: GetHourNumbersOptions<TDate>) => React.JSX.Element[];
|
|
21
|
-
export declare const getMinutesNumbers: <TDate extends PickerValidDate>({ utils, value, isDisabled, getClockNumberText, selectedId, }: Omit<GetHourNumbersOptions<TDate>,
|
|
21
|
+
export declare const getMinutesNumbers: <TDate extends PickerValidDate>({ utils, value, isDisabled, getClockNumberText, selectedId, }: Omit<GetHourNumbersOptions<TDate>, "ampm" | "value"> & {
|
|
22
22
|
value: number;
|
|
23
23
|
}) => React.JSX.Element[];
|
|
24
24
|
export {};
|
package/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
export declare const PickerViewRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -12,5 +12,5 @@ export declare function useNextMonthDisabled<TDate extends PickerValidDate>(mont
|
|
|
12
12
|
export declare function usePreviousMonthDisabled<TDate extends PickerValidDate>(month: TDate, { disablePast, minDate, timezone, }: Pick<MonthValidationOptions<TDate>, 'disablePast' | 'minDate' | 'timezone'>): boolean;
|
|
13
13
|
export declare function useMeridiemMode<TDate extends PickerValidDate>(date: TDate | null, ampm: boolean | undefined, onChange: PickerOnChangeFn<TDate>, selectionState?: PickerSelectionState): {
|
|
14
14
|
meridiemMode: import("../utils/time-utils").Meridiem | null;
|
|
15
|
-
handleMeridiemChange: (mode:
|
|
15
|
+
handleMeridiemChange: (mode: "am" | "pm") => void;
|
|
16
16
|
};
|
|
@@ -9,11 +9,11 @@ export interface UseDefaultizedTimeFieldBaseProps extends BaseTimeValidationProp
|
|
|
9
9
|
format?: string;
|
|
10
10
|
}
|
|
11
11
|
export declare const useDefaultizedTimeField: <TDate extends PickerValidDate, TKnownProps extends UseDefaultizedTimeFieldBaseProps & {
|
|
12
|
-
ampm?: boolean
|
|
12
|
+
ampm?: boolean;
|
|
13
13
|
}, TAllProps extends {}>(props: TKnownProps & TAllProps) => TAllProps & DefaultizedProps<TKnownProps, keyof UseDefaultizedTimeFieldBaseProps>;
|
|
14
14
|
export interface UseDefaultizedDateTimeFieldBaseProps<TDate extends PickerValidDate> extends BaseDateValidationProps<TDate>, BaseTimeValidationProps {
|
|
15
15
|
format?: string;
|
|
16
16
|
}
|
|
17
17
|
export declare const useDefaultizedDateTimeField: <TDate extends PickerValidDate, TKnownProps extends UseDefaultizedDateTimeFieldBaseProps<TDate> & DateTimeValidationProps<TDate> & TimeValidationProps<TDate> & {
|
|
18
|
-
ampm?: boolean
|
|
18
|
+
ampm?: boolean;
|
|
19
19
|
}, TAllProps extends {}>(props: TKnownProps & TAllProps) => TAllProps & DefaultizedProps<TKnownProps, keyof UseDefaultizedDateTimeFieldBaseProps<any>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { UseFieldParams, UseFieldResponse, UseFieldCommonForwardedProps, UseFieldInternalProps } from './useField.types';
|
|
1
|
+
import { UseFieldParams, UseFieldResponse, UseFieldCommonForwardedProps, UseFieldInternalProps, UseFieldForwardedProps } from './useField.types';
|
|
2
2
|
import { PickerValidDate, FieldSection } from '../../../models';
|
|
3
|
-
export declare const useField: <TValue, TDate extends PickerValidDate, TSection extends FieldSection, TEnableAccessibleFieldDOMStructure extends boolean, TForwardedProps extends UseFieldCommonForwardedProps &
|
|
4
|
-
minutesStep?: number
|
|
3
|
+
export declare const useField: <TValue, TDate extends PickerValidDate, TSection extends FieldSection, TEnableAccessibleFieldDOMStructure extends boolean, TForwardedProps extends UseFieldCommonForwardedProps & UseFieldForwardedProps<TEnableAccessibleFieldDOMStructure>, TInternalProps extends UseFieldInternalProps<any, any, any, TEnableAccessibleFieldDOMStructure, any> & {
|
|
4
|
+
minutesStep?: number;
|
|
5
5
|
}>(params: UseFieldParams<TValue, TDate, TSection, TEnableAccessibleFieldDOMStructure, TForwardedProps, TInternalProps>) => UseFieldResponse<TEnableAccessibleFieldDOMStructure, TForwardedProps>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AvailableAdjustKeyCode, FieldSectionsValueBoundaries, SectionOrdering, FieldSectionValueBoundaries, FieldParsedSelectedSections } from './useField.types';
|
|
2
2
|
import { FieldSectionType, FieldValueType, FieldSection, MuiPickersAdapter, FieldSectionContentType, PickersTimezone, PickerValidDate, FieldSelectedSections } from '../../../models';
|
|
3
|
-
export declare const getDateSectionConfigFromFormatToken: <TDate extends PickerValidDate>(utils: MuiPickersAdapter<TDate>, formatToken: string) => Pick<FieldSection,
|
|
3
|
+
export declare const getDateSectionConfigFromFormatToken: <TDate extends PickerValidDate>(utils: MuiPickersAdapter<TDate>, formatToken: string) => Pick<FieldSection, "type" | "contentType"> & {
|
|
4
4
|
maxLength: number | undefined;
|
|
5
5
|
};
|
|
6
6
|
export declare const getDaysInWeekStr: <TDate extends PickerValidDate>(utils: MuiPickersAdapter<TDate>, timezone: PickersTimezone, format: string) => string[];
|
|
@@ -16,11 +16,11 @@ export declare const isStringNumber: (valueStr: string, localizedDigits: string[
|
|
|
16
16
|
* Warning: Should only be called with non-localized digits. Call `removeLocalizedDigits` with your value if needed.
|
|
17
17
|
*/
|
|
18
18
|
export declare const cleanLeadingZeros: (valueStr: string, size: number) => string;
|
|
19
|
-
export declare const cleanDigitSectionValue: <TDate extends PickerValidDate>(utils: MuiPickersAdapter<TDate>, value: number, sectionBoundaries: FieldSectionValueBoundaries<TDate, any>, localizedDigits: string[], section: Pick<FieldSection,
|
|
19
|
+
export declare const cleanDigitSectionValue: <TDate extends PickerValidDate>(utils: MuiPickersAdapter<TDate>, value: number, sectionBoundaries: FieldSectionValueBoundaries<TDate, any>, localizedDigits: string[], section: Pick<FieldSection, "format" | "type" | "contentType" | "hasLeadingZerosInFormat" | "hasLeadingZerosInInput" | "maxLength">) => string;
|
|
20
20
|
export declare const adjustSectionValue: <TDate extends PickerValidDate, TSection extends FieldSection>(utils: MuiPickersAdapter<TDate>, timezone: PickersTimezone, section: TSection, keyCode: AvailableAdjustKeyCode, sectionsValueBoundaries: FieldSectionsValueBoundaries<TDate>, localizedDigits: string[], activeDate: TDate | null, stepsAttributes?: {
|
|
21
21
|
minutesStep?: number;
|
|
22
22
|
}) => string;
|
|
23
|
-
export declare const getSectionVisibleValue: (section: FieldSection, target:
|
|
23
|
+
export declare const getSectionVisibleValue: (section: FieldSection, target: "input-rtl" | "input-ltr" | "non-input", localizedDigits: string[]) => string;
|
|
24
24
|
export declare const changeSectionValueFormat: <TDate extends PickerValidDate>(utils: MuiPickersAdapter<TDate>, valueStr: string, currentFormat: string, newFormat: string) => string;
|
|
25
25
|
export declare const doesSectionFormatHaveLeadingZeros: <TDate extends PickerValidDate>(utils: MuiPickersAdapter<TDate>, timezone: PickersTimezone, contentType: FieldSectionContentType, sectionType: FieldSectionType, format: string) => boolean;
|
|
26
26
|
/**
|
|
@@ -103,6 +103,13 @@ export const useFieldV6TextField = params => {
|
|
|
103
103
|
inputRef.current.setSelectionRange(selectionStart, selectionEnd);
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
+
setTimeout(() => {
|
|
107
|
+
// handle case when the selection is not updated correctly
|
|
108
|
+
// could happen on Android
|
|
109
|
+
if (inputRef.current && inputRef.current === getActiveElement(document) && (inputRef.current.selectionStart !== selectionStart || inputRef.current.selectionEnd !== selectionEnd)) {
|
|
110
|
+
interactions.syncSelectionToDOM();
|
|
111
|
+
}
|
|
112
|
+
});
|
|
106
113
|
}
|
|
107
114
|
|
|
108
115
|
// Even reading this variable seems to do the trick, but also setting it just to make use of it
|
|
@@ -265,10 +272,9 @@ export const useFieldV6TextField = params => {
|
|
|
265
272
|
if (keyPressed.length === 0) {
|
|
266
273
|
if (isAndroid()) {
|
|
267
274
|
setTempAndroidValueStr(valueStr);
|
|
268
|
-
} else {
|
|
269
|
-
resetCharacterQuery();
|
|
270
|
-
clearActiveSection();
|
|
271
275
|
}
|
|
276
|
+
resetCharacterQuery();
|
|
277
|
+
clearActiveSection();
|
|
272
278
|
return;
|
|
273
279
|
}
|
|
274
280
|
applyCharacterEditing({
|
|
@@ -17,7 +17,7 @@ export declare const applyDefaultDate: <TDate extends PickerValidDate>(utils: Mu
|
|
|
17
17
|
export declare const areDatesEqual: <TDate extends PickerValidDate>(utils: MuiPickersAdapter<TDate>, a: TDate, b: TDate) => boolean;
|
|
18
18
|
export declare const getMonthsInYear: <TDate extends PickerValidDate>(utils: MuiPickersAdapter<TDate>, year: TDate) => TDate[];
|
|
19
19
|
export declare const getTodayDate: <TDate extends PickerValidDate>(utils: MuiPickersAdapter<TDate>, timezone: PickersTimezone, valueType?: FieldValueType) => TDate;
|
|
20
|
-
export declare const formatMeridiem: <TDate extends PickerValidDate>(utils: MuiPickersAdapter<TDate>, meridiem:
|
|
20
|
+
export declare const formatMeridiem: <TDate extends PickerValidDate>(utils: MuiPickersAdapter<TDate>, meridiem: "am" | "pm") => string;
|
|
21
21
|
export declare const isDatePickerView: (view: DateOrTimeViewWithMeridiem) => view is DateView;
|
|
22
22
|
export declare const resolveDateFormat: <TDate extends PickerValidDate>(utils: MuiPickersAdapter<TDate>, { format, views }: {
|
|
23
23
|
format?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DateOrTimeView } from '../../models';
|
|
2
2
|
import { DateOrTimeViewWithMeridiem } from '../models';
|
|
3
|
-
export declare const areViewsEqual: <TView extends DateOrTimeView>(views: ReadonlyArray<DateOrTimeView>, expectedViews: TView[]) => views is
|
|
3
|
+
export declare const areViewsEqual: <TView extends DateOrTimeView>(views: ReadonlyArray<DateOrTimeView>, expectedViews: TView[]) => views is ReadonlyArray<TView>;
|
|
4
4
|
export declare const applyDefaultViewProps: <TView extends DateOrTimeViewWithMeridiem>({ openTo, defaultOpenTo, views, defaultViews, }: {
|
|
5
5
|
openTo: TView | undefined;
|
|
6
6
|
defaultOpenTo: TView;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const buildDeprecatedPropsWarning: (message: string | string[]) => (deprecatedProps: {
|
|
2
2
|
[key: string]: any;
|
|
3
3
|
}) => void;
|
|
4
|
-
export declare const buildWarning: (message: string | string[], gravity?:
|
|
4
|
+
export declare const buildWarning: (message: string | string[], gravity?: "warning" | "error") => () => void;
|
|
@@ -16,7 +16,7 @@ import { useMeridiemMode } from '../internals/hooks/date-helpers-hooks';
|
|
|
16
16
|
import { MULTI_SECTION_CLOCK_SECTION_WIDTH } from '../internals/constants/dimensions';
|
|
17
17
|
import { formatMeridiem } from '../internals/utils/date-utils';
|
|
18
18
|
import { pickersToolbarTextClasses } from '../internals/components/pickersToolbarTextClasses';
|
|
19
|
-
import { pickersToolbarClasses } from '../internals';
|
|
19
|
+
import { pickersToolbarClasses } from '../internals/components/pickersToolbarClasses';
|
|
20
20
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
21
|
const useUtilityClasses = ownerState => {
|
|
22
22
|
const {
|
|
@@ -17,10 +17,12 @@ import { useDesktopPicker } from '../internals/hooks/useDesktopPicker';
|
|
|
17
17
|
import { extractValidationProps } from '../internals/utils/validation/extractValidationProps';
|
|
18
18
|
import { resolveDateTimeFormat, resolveTimeViewsResponse } from '../internals/utils/date-time-utils';
|
|
19
19
|
import { renderDigitalClockTimeView, renderMultiSectionDigitalClockTimeView } from '../timeViewRenderers';
|
|
20
|
-
import { VIEW_HEIGHT, isDatePickerView, isInternalTimeView } from '../internals';
|
|
21
20
|
import { multiSectionDigitalClockClasses, multiSectionDigitalClockSectionClasses } from '../MultiSectionDigitalClock';
|
|
22
21
|
import { digitalClockClasses } from '../DigitalClock';
|
|
23
22
|
import { DesktopDateTimePickerLayout } from './DesktopDateTimePickerLayout';
|
|
23
|
+
import { VIEW_HEIGHT } from '../internals/constants/dimensions';
|
|
24
|
+
import { isInternalTimeView } from '../internals/utils/time-utils';
|
|
25
|
+
import { isDatePickerView } from '../internals/utils/date-utils';
|
|
24
26
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
25
27
|
const rendererInterceptor = function rendererInterceptor(inViewRenderers, popperView, rendererProps) {
|
|
26
28
|
const {
|
package/modern/index.js
CHANGED
|
@@ -103,6 +103,13 @@ export const useFieldV6TextField = params => {
|
|
|
103
103
|
inputRef.current.setSelectionRange(selectionStart, selectionEnd);
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
+
setTimeout(() => {
|
|
107
|
+
// handle case when the selection is not updated correctly
|
|
108
|
+
// could happen on Android
|
|
109
|
+
if (inputRef.current && inputRef.current === getActiveElement(document) && (inputRef.current.selectionStart !== selectionStart || inputRef.current.selectionEnd !== selectionEnd)) {
|
|
110
|
+
interactions.syncSelectionToDOM();
|
|
111
|
+
}
|
|
112
|
+
});
|
|
106
113
|
}
|
|
107
114
|
|
|
108
115
|
// Even reading this variable seems to do the trick, but also setting it just to make use of it
|
|
@@ -265,10 +272,9 @@ export const useFieldV6TextField = params => {
|
|
|
265
272
|
if (keyPressed.length === 0) {
|
|
266
273
|
if (isAndroid()) {
|
|
267
274
|
setTempAndroidValueStr(valueStr);
|
|
268
|
-
} else {
|
|
269
|
-
resetCharacterQuery();
|
|
270
|
-
clearActiveSection();
|
|
271
275
|
}
|
|
276
|
+
resetCharacterQuery();
|
|
277
|
+
clearActiveSection();
|
|
272
278
|
return;
|
|
273
279
|
}
|
|
274
280
|
applyCharacterEditing({
|
|
@@ -22,7 +22,7 @@ var _dateHelpersHooks = require("../internals/hooks/date-helpers-hooks");
|
|
|
22
22
|
var _dimensions = require("../internals/constants/dimensions");
|
|
23
23
|
var _dateUtils = require("../internals/utils/date-utils");
|
|
24
24
|
var _pickersToolbarTextClasses = require("../internals/components/pickersToolbarTextClasses");
|
|
25
|
-
var
|
|
25
|
+
var _pickersToolbarClasses = require("../internals/components/pickersToolbarClasses");
|
|
26
26
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
27
27
|
const _excluded = ["ampm", "ampmInClock", "value", "onChange", "view", "isLandscape", "onViewChange", "toolbarFormat", "toolbarPlaceholder", "views", "disabled", "readOnly", "toolbarVariant", "toolbarTitle", "className"];
|
|
28
28
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
@@ -61,7 +61,7 @@ const DateTimePickerToolbarRoot = (0, _styles.styled)(_PickersToolbar.PickersToo
|
|
|
61
61
|
},
|
|
62
62
|
style: {
|
|
63
63
|
borderBottom: `1px solid ${(theme.vars || theme).palette.divider}`,
|
|
64
|
-
[`& .${
|
|
64
|
+
[`& .${_pickersToolbarClasses.pickersToolbarClasses.content} .${_pickersToolbarTextClasses.pickersToolbarTextClasses.selected}`]: {
|
|
65
65
|
color: (theme.vars || theme).palette.primary.main,
|
|
66
66
|
fontWeight: theme.typography.fontWeightBold
|
|
67
67
|
}
|
|
@@ -23,10 +23,12 @@ var _useDesktopPicker = require("../internals/hooks/useDesktopPicker");
|
|
|
23
23
|
var _extractValidationProps = require("../internals/utils/validation/extractValidationProps");
|
|
24
24
|
var _dateTimeUtils = require("../internals/utils/date-time-utils");
|
|
25
25
|
var _timeViewRenderers = require("../timeViewRenderers");
|
|
26
|
-
var _internals = require("../internals");
|
|
27
26
|
var _MultiSectionDigitalClock = require("../MultiSectionDigitalClock");
|
|
28
27
|
var _DigitalClock = require("../DigitalClock");
|
|
29
28
|
var _DesktopDateTimePickerLayout = require("./DesktopDateTimePickerLayout");
|
|
29
|
+
var _dimensions = require("../internals/constants/dimensions");
|
|
30
|
+
var _timeUtils = require("../internals/utils/time-utils");
|
|
31
|
+
var _dateUtils = require("../internals/utils/date-utils");
|
|
30
32
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
31
33
|
const _excluded = ["openTo", "focusedView", "timeViewsCount"];
|
|
32
34
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
@@ -45,16 +47,16 @@ const rendererInterceptor = function rendererInterceptor(inViewRenderers, popper
|
|
|
45
47
|
borderBottom: 0
|
|
46
48
|
},
|
|
47
49
|
[`&.${_MultiSectionDigitalClock.multiSectionDigitalClockClasses.root}, .${_MultiSectionDigitalClock.multiSectionDigitalClockSectionClasses.root}, &.${_DigitalClock.digitalClockClasses.root}`]: {
|
|
48
|
-
maxHeight:
|
|
50
|
+
maxHeight: _dimensions.VIEW_HEIGHT
|
|
49
51
|
}
|
|
50
52
|
}]
|
|
51
53
|
});
|
|
52
|
-
const isTimeViewActive = (0,
|
|
54
|
+
const isTimeViewActive = (0, _timeUtils.isInternalTimeView)(popperView);
|
|
53
55
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
54
56
|
children: [inViewRenderers[!isTimeViewActive ? popperView : 'day']?.((0, _extends2.default)({}, rendererProps, {
|
|
55
57
|
view: !isTimeViewActive ? popperView : 'day',
|
|
56
|
-
focusedView: focusedView && (0,
|
|
57
|
-
views: rendererProps.views.filter(
|
|
58
|
+
focusedView: focusedView && (0, _dateUtils.isDatePickerView)(focusedView) ? focusedView : null,
|
|
59
|
+
views: rendererProps.views.filter(_dateUtils.isDatePickerView),
|
|
58
60
|
sx: [{
|
|
59
61
|
gridColumn: 1
|
|
60
62
|
}, ...finalProps.sx]
|
|
@@ -66,9 +68,9 @@ const rendererInterceptor = function rendererInterceptor(inViewRenderers, popper
|
|
|
66
68
|
}
|
|
67
69
|
}), inViewRenderers[isTimeViewActive ? popperView : 'hours']?.((0, _extends2.default)({}, finalProps, {
|
|
68
70
|
view: isTimeViewActive ? popperView : 'hours',
|
|
69
|
-
focusedView: focusedView && (0,
|
|
70
|
-
openTo: (0,
|
|
71
|
-
views: rendererProps.views.filter(
|
|
71
|
+
focusedView: focusedView && (0, _timeUtils.isInternalTimeView)(focusedView) ? focusedView : null,
|
|
72
|
+
openTo: (0, _timeUtils.isInternalTimeView)(openTo) ? openTo : 'hours',
|
|
73
|
+
views: rendererProps.views.filter(_timeUtils.isInternalTimeView),
|
|
72
74
|
sx: [{
|
|
73
75
|
gridColumn: 3
|
|
74
76
|
}, ...finalProps.sx]
|
package/node/index.js
CHANGED
|
@@ -113,6 +113,13 @@ const useFieldV6TextField = params => {
|
|
|
113
113
|
inputRef.current.setSelectionRange(selectionStart, selectionEnd);
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
+
setTimeout(() => {
|
|
117
|
+
// handle case when the selection is not updated correctly
|
|
118
|
+
// could happen on Android
|
|
119
|
+
if (inputRef.current && inputRef.current === (0, _utils.getActiveElement)(document) && (inputRef.current.selectionStart !== selectionStart || inputRef.current.selectionEnd !== selectionEnd)) {
|
|
120
|
+
interactions.syncSelectionToDOM();
|
|
121
|
+
}
|
|
122
|
+
});
|
|
116
123
|
}
|
|
117
124
|
|
|
118
125
|
// Even reading this variable seems to do the trick, but also setting it just to make use of it
|
|
@@ -275,10 +282,9 @@ const useFieldV6TextField = params => {
|
|
|
275
282
|
if (keyPressed.length === 0) {
|
|
276
283
|
if ((0, _useField.isAndroid)()) {
|
|
277
284
|
setTempAndroidValueStr(valueStr);
|
|
278
|
-
} else {
|
|
279
|
-
resetCharacterQuery();
|
|
280
|
-
clearActiveSection();
|
|
281
285
|
}
|
|
286
|
+
resetCharacterQuery();
|
|
287
|
+
clearActiveSection();
|
|
282
288
|
return;
|
|
283
289
|
}
|
|
284
290
|
applyCharacterEditing({
|
package/package.json
CHANGED
|
@@ -12,5 +12,5 @@ export type TimeViewRendererProps<TView extends TimeViewWithMeridiem, TComponent
|
|
|
12
12
|
views: readonly TView[];
|
|
13
13
|
};
|
|
14
14
|
export declare const renderTimeViewClock: <TDate extends PickerValidDate>({ view, onViewChange, focusedView, onFocusedViewChange, views, value, defaultValue, referenceDate, onChange, className, classes, disableFuture, disablePast, minTime, maxTime, shouldDisableTime, minutesStep, ampm, ampmInClock, slots, slotProps, readOnly, disabled, sx, autoFocus, showViewSwitcher, disableIgnoringDatePartForTimeValidation, timezone, }: TimeViewRendererProps<TimeView, TimeClockProps<TDate, TimeView>>) => React.JSX.Element;
|
|
15
|
-
export declare const renderDigitalClockTimeView: <TDate extends PickerValidDate>({ view, onViewChange, focusedView, onFocusedViewChange, views, value, defaultValue, referenceDate, onChange, className, classes, disableFuture, disablePast, minTime, maxTime, shouldDisableTime, minutesStep, ampm, slots, slotProps, readOnly, disabled, sx, autoFocus, disableIgnoringDatePartForTimeValidation, timeSteps, skipDisabled, timezone, }: TimeViewRendererProps<Extract<TimeView,
|
|
15
|
+
export declare const renderDigitalClockTimeView: <TDate extends PickerValidDate>({ view, onViewChange, focusedView, onFocusedViewChange, views, value, defaultValue, referenceDate, onChange, className, classes, disableFuture, disablePast, minTime, maxTime, shouldDisableTime, minutesStep, ampm, slots, slotProps, readOnly, disabled, sx, autoFocus, disableIgnoringDatePartForTimeValidation, timeSteps, skipDisabled, timezone, }: TimeViewRendererProps<Extract<TimeView, "hours">, Omit<DigitalClockProps<TDate>, "timeStep"> & Pick<TimePickerProps<TDate>, "timeSteps">>) => React.JSX.Element;
|
|
16
16
|
export declare const renderMultiSectionDigitalClockTimeView: <TDate extends PickerValidDate>({ view, onViewChange, focusedView, onFocusedViewChange, views, value, defaultValue, referenceDate, onChange, className, classes, disableFuture, disablePast, minTime, maxTime, shouldDisableTime, minutesStep, ampm, slots, slotProps, readOnly, disabled, sx, autoFocus, disableIgnoringDatePartForTimeValidation, timeSteps, skipDisabled, timezone, }: TimeViewRendererProps<TimeViewWithMeridiem, MultiSectionDigitalClockProps<TDate>>) => React.JSX.Element;
|