@mui/x-date-pickers-pro 6.14.0 → 6.16.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 +167 -0
- package/DateRangeCalendar/DateRangeCalendar.js +6 -2
- package/DateRangeCalendar/DateRangeCalendar.types.d.ts +1 -1
- package/DateRangePicker/DateRangePicker.js +6 -2
- package/DateRangePicker/DateRangePickerToolbar.js +1 -0
- package/DesktopDateRangePicker/DesktopDateRangePicker.js +6 -2
- package/MobileDateRangePicker/MobileDateRangePicker.js +6 -2
- package/MultiInputDateRangeField/MultiInputDateRangeField.js +3 -0
- package/MultiInputDateRangeField/MultiInputDateRangeField.types.d.ts +1 -1
- package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +3 -0
- package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.d.ts +1 -1
- package/MultiInputTimeRangeField/MultiInputTimeRangeField.types.d.ts +1 -1
- package/SingleInputDateRangeField/SingleInputDateRangeField.js +32 -4
- package/SingleInputDateRangeField/SingleInputDateRangeField.types.d.ts +3 -3
- package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +32 -4
- package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.types.d.ts +3 -3
- package/SingleInputTimeRangeField/SingleInputTimeRangeField.js +29 -4
- package/SingleInputTimeRangeField/SingleInputTimeRangeField.types.d.ts +3 -3
- package/StaticDateRangePicker/StaticDateRangePicker.js +6 -2
- package/index.js +1 -1
- package/internals/hooks/useEnrichedRangePickerFieldProps.d.ts +3 -3
- package/internals/hooks/useEnrichedRangePickerFieldProps.js +12 -3
- package/internals/hooks/useMultiInputRangeField/shared.d.ts +1 -0
- package/internals/hooks/useMultiInputRangeField/shared.js +9 -0
- package/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +5 -2
- package/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +5 -2
- package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +5 -2
- package/internals/models/dateRange.d.ts +3 -0
- package/internals/utils/releaseInfo.js +1 -1
- package/legacy/DateRangeCalendar/DateRangeCalendar.js +6 -2
- package/legacy/DateRangePicker/DateRangePicker.js +6 -2
- package/legacy/DateRangePicker/DateRangePickerToolbar.js +1 -0
- package/legacy/DesktopDateRangePicker/DesktopDateRangePicker.js +6 -2
- package/legacy/MobileDateRangePicker/MobileDateRangePicker.js +6 -2
- package/legacy/MultiInputDateRangeField/MultiInputDateRangeField.js +3 -0
- package/legacy/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +3 -0
- package/legacy/SingleInputDateRangeField/SingleInputDateRangeField.js +30 -3
- package/legacy/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +30 -3
- package/legacy/SingleInputTimeRangeField/SingleInputTimeRangeField.js +27 -3
- package/legacy/StaticDateRangePicker/StaticDateRangePicker.js +6 -2
- package/legacy/index.js +1 -1
- package/legacy/internals/hooks/useEnrichedRangePickerFieldProps.js +14 -3
- package/legacy/internals/hooks/useMultiInputRangeField/shared.js +9 -0
- package/legacy/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +5 -2
- package/legacy/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +5 -2
- package/legacy/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +5 -2
- package/legacy/internals/utils/releaseInfo.js +1 -1
- package/modern/DateRangeCalendar/DateRangeCalendar.js +6 -2
- package/modern/DateRangePicker/DateRangePicker.js +6 -2
- package/modern/DateRangePicker/DateRangePickerToolbar.js +1 -0
- package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +6 -2
- package/modern/MobileDateRangePicker/MobileDateRangePicker.js +6 -2
- package/modern/MultiInputDateRangeField/MultiInputDateRangeField.js +3 -0
- package/modern/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +3 -0
- package/modern/SingleInputDateRangeField/SingleInputDateRangeField.js +32 -4
- package/modern/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +32 -4
- package/modern/SingleInputTimeRangeField/SingleInputTimeRangeField.js +29 -4
- package/modern/StaticDateRangePicker/StaticDateRangePicker.js +6 -2
- package/modern/index.js +1 -1
- package/modern/internals/hooks/useEnrichedRangePickerFieldProps.js +12 -3
- package/modern/internals/hooks/useMultiInputRangeField/shared.js +9 -0
- package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +5 -2
- package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +5 -2
- package/modern/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +5 -2
- package/modern/internals/utils/releaseInfo.js +1 -1
- package/node/DateRangeCalendar/DateRangeCalendar.js +6 -2
- package/node/DateRangePicker/DateRangePicker.js +6 -2
- package/node/DateRangePicker/DateRangePickerToolbar.js +1 -0
- package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +6 -2
- package/node/MobileDateRangePicker/MobileDateRangePicker.js +6 -2
- package/node/MultiInputDateRangeField/MultiInputDateRangeField.js +3 -0
- package/node/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +3 -0
- package/node/SingleInputDateRangeField/SingleInputDateRangeField.js +32 -4
- package/node/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +32 -4
- package/node/SingleInputTimeRangeField/SingleInputTimeRangeField.js +29 -4
- package/node/StaticDateRangePicker/StaticDateRangePicker.js +6 -2
- package/node/index.js +1 -1
- package/node/internals/hooks/useEnrichedRangePickerFieldProps.js +12 -3
- package/node/internals/hooks/useMultiInputRangeField/shared.js +16 -0
- package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +5 -2
- package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +5 -2
- package/node/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +5 -2
- package/node/internals/utils/releaseInfo.js +1 -1
- package/package.json +2 -2
- package/legacy/tests/describeRangeValidation/describeRangeValidation.js +0 -29
- package/legacy/tests/describeRangeValidation/describeRangeValidation.types.js +0 -1
- package/legacy/tests/describeRangeValidation/index.js +0 -1
- package/legacy/tests/describeRangeValidation/testDayViewRangeValidation.js +0 -144
- package/legacy/tests/describeRangeValidation/testTextFieldKeyboardRangeValidation.js +0 -291
- package/legacy/tests/describeRangeValidation/testTextFieldRangeValidation.js +0 -518
- package/modern/tests/describeRangeValidation/describeRangeValidation.js +0 -29
- package/modern/tests/describeRangeValidation/describeRangeValidation.types.js +0 -1
- package/modern/tests/describeRangeValidation/index.js +0 -1
- package/modern/tests/describeRangeValidation/testDayViewRangeValidation.js +0 -145
- package/modern/tests/describeRangeValidation/testTextFieldKeyboardRangeValidation.js +0 -285
- package/modern/tests/describeRangeValidation/testTextFieldRangeValidation.js +0 -520
- package/node/tests/describeRangeValidation/describeRangeValidation.js +0 -37
- package/node/tests/describeRangeValidation/describeRangeValidation.types.js +0 -5
- package/node/tests/describeRangeValidation/index.js +0 -12
- package/node/tests/describeRangeValidation/testDayViewRangeValidation.js +0 -154
- package/node/tests/describeRangeValidation/testTextFieldKeyboardRangeValidation.js +0 -294
- package/node/tests/describeRangeValidation/testTextFieldRangeValidation.js +0 -530
- package/tests/describeRangeValidation/describeRangeValidation.js +0 -29
- package/tests/describeRangeValidation/describeRangeValidation.types.js +0 -1
- package/tests/describeRangeValidation/index.js +0 -1
- package/tests/describeRangeValidation/testDayViewRangeValidation.js +0 -145
- package/tests/describeRangeValidation/testTextFieldKeyboardRangeValidation.js +0 -285
- package/tests/describeRangeValidation/testTextFieldRangeValidation.js +0 -520
|
@@ -78,9 +78,10 @@ StaticDateRangePicker.propTypes = {
|
|
|
78
78
|
currentMonthCalendarPosition: PropTypes.oneOf([1, 2, 3]),
|
|
79
79
|
/**
|
|
80
80
|
* Formats the day of week displayed in the calendar header.
|
|
81
|
-
* @param {string} day The day of week provided by the adapter
|
|
81
|
+
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
82
|
+
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
82
83
|
* @returns {string} The name to display.
|
|
83
|
-
* @default (
|
|
84
|
+
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
84
85
|
*/
|
|
85
86
|
dayOfWeekFormatter: PropTypes.func,
|
|
86
87
|
/**
|
|
@@ -227,6 +228,9 @@ StaticDateRangePicker.propTypes = {
|
|
|
227
228
|
renderLoading: PropTypes.func,
|
|
228
229
|
/**
|
|
229
230
|
* Disable specific date.
|
|
231
|
+
*
|
|
232
|
+
* Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
233
|
+
*
|
|
230
234
|
* @template TDate
|
|
231
235
|
* @param {TDate} day The date to test.
|
|
232
236
|
* @param {string} position The date to test, 'start' or 'end'.
|
package/index.js
CHANGED
|
@@ -6,10 +6,10 @@ import { SlotComponentProps } from '@mui/base/utils';
|
|
|
6
6
|
import { BaseSingleInputFieldProps } from '@mui/x-date-pickers/models';
|
|
7
7
|
import { DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals/models';
|
|
8
8
|
import { PickersInputLocaleText } from '@mui/x-date-pickers/locales';
|
|
9
|
-
import { BaseFieldProps, UsePickerResponse, WrapperVariant, UncapitalizeObjectKeys, UsePickerProps } from '@mui/x-date-pickers/internals';
|
|
9
|
+
import { BaseFieldProps, UsePickerResponse, WrapperVariant, UncapitalizeObjectKeys, UsePickerProps, FieldSlotsComponents, FieldSlotsComponentsProps } from '@mui/x-date-pickers/internals';
|
|
10
10
|
import { BaseMultiInputFieldProps, DateRange, RangeFieldSection, RangePosition, UseDateRangeFieldProps } from '../models';
|
|
11
11
|
import { UseRangePositionResponse } from './useRangePosition';
|
|
12
|
-
export interface RangePickerFieldSlotsComponent {
|
|
12
|
+
export interface RangePickerFieldSlotsComponent extends FieldSlotsComponents {
|
|
13
13
|
Field: React.ElementType;
|
|
14
14
|
/**
|
|
15
15
|
* Element rendered at the root.
|
|
@@ -29,7 +29,7 @@ export interface RangePickerFieldSlotsComponent {
|
|
|
29
29
|
*/
|
|
30
30
|
TextField?: React.ElementType<TextFieldProps>;
|
|
31
31
|
}
|
|
32
|
-
export interface RangePickerFieldSlotsComponentsProps<TDate> {
|
|
32
|
+
export interface RangePickerFieldSlotsComponentsProps<TDate> extends FieldSlotsComponentsProps {
|
|
33
33
|
field?: SlotComponentProps<React.ElementType<BaseMultiInputFieldProps<DateRange<TDate>, TDate, RangeFieldSection, unknown>>, {}, UsePickerProps<DateRange<TDate>, TDate, any, RangeFieldSection, any, any, any>>;
|
|
34
34
|
fieldRoot?: SlotComponentProps<typeof Stack, {}, Record<string, any>>;
|
|
35
35
|
fieldSeparator?: SlotComponentProps<typeof Typography, {}, Record<string, any>>;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
1
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
+
const _excluded = ["clearable", "onClear"];
|
|
2
4
|
import * as React from 'react';
|
|
3
5
|
import { resolveComponentProps } from '@mui/base/utils';
|
|
4
6
|
import useEventCallback from '@mui/utils/useEventCallback';
|
|
@@ -115,7 +117,10 @@ const useMultiInputFieldSlotProps = ({
|
|
|
115
117
|
},
|
|
116
118
|
separator: pickerSlotProps == null ? void 0 : pickerSlotProps.fieldSeparator
|
|
117
119
|
});
|
|
118
|
-
|
|
120
|
+
|
|
121
|
+
/* TODO: remove this when a clearable behavior for multiple input range fields is implemented */
|
|
122
|
+
const restFieldProps = _objectWithoutPropertiesLoose(fieldProps, _excluded);
|
|
123
|
+
const enrichedFieldProps = _extends({}, restFieldProps, {
|
|
119
124
|
slots,
|
|
120
125
|
slotProps
|
|
121
126
|
});
|
|
@@ -173,10 +178,14 @@ const useSingleInputFieldSlotProps = ({
|
|
|
173
178
|
}
|
|
174
179
|
};
|
|
175
180
|
const slots = _extends({}, fieldProps.slots, {
|
|
176
|
-
textField: pickerSlots == null ? void 0 : pickerSlots.textField
|
|
181
|
+
textField: pickerSlots == null ? void 0 : pickerSlots.textField,
|
|
182
|
+
clearButton: pickerSlots == null ? void 0 : pickerSlots.clearButton,
|
|
183
|
+
clearIcon: pickerSlots == null ? void 0 : pickerSlots.clearIcon
|
|
177
184
|
});
|
|
178
185
|
const slotProps = _extends({}, fieldProps.slotProps, {
|
|
179
|
-
textField: pickerSlotProps == null ? void 0 : pickerSlotProps.textField
|
|
186
|
+
textField: pickerSlotProps == null ? void 0 : pickerSlotProps.textField,
|
|
187
|
+
clearButton: pickerSlots == null ? void 0 : pickerSlots.clearButton,
|
|
188
|
+
clearIcon: pickerSlots == null ? void 0 : pickerSlots.clearIcon
|
|
180
189
|
});
|
|
181
190
|
const enrichedFieldProps = _extends({}, fieldProps, {
|
|
182
191
|
slots,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const excludeProps: <TProps extends {}>(props: TProps, excludedProps: (keyof TProps)[]) => TProps;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/* TODO: remove this when a clearable behavior for multiple input range fields is implemented */
|
|
2
|
+
export const excludeProps = (props, excludedProps) => {
|
|
3
|
+
return Object.keys(props).reduce((acc, key) => {
|
|
4
|
+
if (!excludedProps.includes(key)) {
|
|
5
|
+
acc[key] = props[key];
|
|
6
|
+
}
|
|
7
|
+
return acc;
|
|
8
|
+
}, {});
|
|
9
|
+
};
|
|
@@ -5,6 +5,7 @@ import { useLocalizationContext, useValidation, useControlledValueWithTimezone }
|
|
|
5
5
|
import { useDefaultizedDateRangeFieldProps } from '../../../SingleInputDateRangeField/useSingleInputDateRangeField';
|
|
6
6
|
import { validateDateRange } from '../../utils/validation/validateDateRange';
|
|
7
7
|
import { rangeValueManager } from '../../utils/valueManagers';
|
|
8
|
+
import { excludeProps } from './shared';
|
|
8
9
|
export const useMultiInputDateRangeField = ({
|
|
9
10
|
sharedProps: inSharedProps,
|
|
10
11
|
startTextFieldProps,
|
|
@@ -104,8 +105,10 @@ export const useMultiInputDateRangeField = ({
|
|
|
104
105
|
props: endFieldProps,
|
|
105
106
|
inputRef: endInputRef
|
|
106
107
|
});
|
|
108
|
+
|
|
109
|
+
/* TODO: Undo this change when a clearable behavior for multiple input range fields is implemented */
|
|
107
110
|
return {
|
|
108
|
-
startDate: startDateResponse,
|
|
109
|
-
endDate: endDateResponse
|
|
111
|
+
startDate: excludeProps(startDateResponse, ['clearable', 'onClear']),
|
|
112
|
+
endDate: excludeProps(endDateResponse, ['clearable', 'onClear'])
|
|
110
113
|
};
|
|
111
114
|
};
|
|
@@ -4,6 +4,7 @@ import { unstable_useDateTimeField as useDateTimeField } from '@mui/x-date-picke
|
|
|
4
4
|
import { applyDefaultDate, useDefaultDates, useLocalizationContext, useUtils, useValidation, useControlledValueWithTimezone } from '@mui/x-date-pickers/internals';
|
|
5
5
|
import { validateDateTimeRange } from '../../utils/validation/validateDateTimeRange';
|
|
6
6
|
import { rangeValueManager } from '../../utils/valueManagers';
|
|
7
|
+
import { excludeProps } from './shared';
|
|
7
8
|
export const useDefaultizedDateTimeRangeFieldProps = props => {
|
|
8
9
|
var _props$ampm, _props$disablePast, _props$disableFuture, _props$format, _props$minDateTime, _props$maxDateTime, _props$minDateTime2, _props$maxDateTime2;
|
|
9
10
|
const utils = useUtils();
|
|
@@ -111,8 +112,10 @@ export const useMultiInputDateTimeRangeField = ({
|
|
|
111
112
|
props: endFieldProps,
|
|
112
113
|
inputRef: endInputRef
|
|
113
114
|
});
|
|
115
|
+
|
|
116
|
+
/* TODO: Undo this change when a clearable behavior for multiple input range fields is implemented */
|
|
114
117
|
return {
|
|
115
|
-
startDate: startDateResponse,
|
|
116
|
-
endDate: endDateResponse
|
|
118
|
+
startDate: excludeProps(startDateResponse, ['clearable', 'onClear']),
|
|
119
|
+
endDate: excludeProps(endDateResponse, ['clearable', 'onClear'])
|
|
117
120
|
};
|
|
118
121
|
};
|
|
@@ -4,6 +4,7 @@ import { unstable_useTimeField as useTimeField } from '@mui/x-date-pickers/TimeF
|
|
|
4
4
|
import { useLocalizationContext, useUtils, useValidation, useControlledValueWithTimezone } from '@mui/x-date-pickers/internals';
|
|
5
5
|
import { validateTimeRange } from '../../utils/validation/validateTimeRange';
|
|
6
6
|
import { rangeValueManager } from '../../utils/valueManagers';
|
|
7
|
+
import { excludeProps } from './shared';
|
|
7
8
|
export const useDefaultizedTimeRangeFieldProps = props => {
|
|
8
9
|
var _props$ampm, _props$disablePast, _props$disableFuture, _props$format;
|
|
9
10
|
const utils = useUtils();
|
|
@@ -105,8 +106,10 @@ export const useMultiInputTimeRangeField = ({
|
|
|
105
106
|
props: endFieldProps,
|
|
106
107
|
inputRef: endInputRef
|
|
107
108
|
});
|
|
109
|
+
|
|
110
|
+
/* TODO: Undo this change when a clearable behavior for multiple input range fields is implemented */
|
|
108
111
|
return {
|
|
109
|
-
startDate: startDateResponse,
|
|
110
|
-
endDate: endDateResponse
|
|
112
|
+
startDate: excludeProps(startDateResponse, ['clearable', 'onClear']),
|
|
113
|
+
endDate: excludeProps(endDateResponse, ['clearable', 'onClear'])
|
|
111
114
|
};
|
|
112
115
|
};
|
|
@@ -8,6 +8,9 @@ import { RangeFieldSection } from './fields';
|
|
|
8
8
|
export interface DayRangeValidationProps<TDate> {
|
|
9
9
|
/**
|
|
10
10
|
* Disable specific date.
|
|
11
|
+
*
|
|
12
|
+
* Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
13
|
+
*
|
|
11
14
|
* @template TDate
|
|
12
15
|
* @param {TDate} day The date to test.
|
|
13
16
|
* @param {string} position The date to test, 'start' or 'end'.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export const getReleaseInfo = () => {
|
|
3
|
-
const releaseInfo = "
|
|
3
|
+
const releaseInfo = "MTY5NTkzODQwMDAwMA==";
|
|
4
4
|
if (process.env.NODE_ENV !== 'production') {
|
|
5
5
|
// A simple hack to set the value in the test environment (has no build step).
|
|
6
6
|
// eslint-disable-next-line no-useless-concat
|
|
@@ -532,9 +532,10 @@ process.env.NODE_ENV !== "production" ? DateRangeCalendar.propTypes = {
|
|
|
532
532
|
currentMonthCalendarPosition: PropTypes.oneOf([1, 2, 3]),
|
|
533
533
|
/**
|
|
534
534
|
* Formats the day of week displayed in the calendar header.
|
|
535
|
-
* @param {string} day The day of week provided by the adapter
|
|
535
|
+
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
536
|
+
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
536
537
|
* @returns {string} The name to display.
|
|
537
|
-
* @default (
|
|
538
|
+
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
538
539
|
*/
|
|
539
540
|
dayOfWeekFormatter: PropTypes.func,
|
|
540
541
|
/**
|
|
@@ -652,6 +653,9 @@ process.env.NODE_ENV !== "production" ? DateRangeCalendar.propTypes = {
|
|
|
652
653
|
renderLoading: PropTypes.func,
|
|
653
654
|
/**
|
|
654
655
|
* Disable specific date.
|
|
656
|
+
*
|
|
657
|
+
* Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
658
|
+
*
|
|
655
659
|
* @template TDate
|
|
656
660
|
* @param {TDate} day The date to test.
|
|
657
661
|
* @param {string} position The date to test, 'start' or 'end'.
|
|
@@ -76,9 +76,10 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
|
|
|
76
76
|
currentMonthCalendarPosition: PropTypes.oneOf([1, 2, 3]),
|
|
77
77
|
/**
|
|
78
78
|
* Formats the day of week displayed in the calendar header.
|
|
79
|
-
* @param {string} day The day of week provided by the adapter
|
|
79
|
+
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
80
|
+
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
80
81
|
* @returns {string} The name to display.
|
|
81
|
-
* @default (
|
|
82
|
+
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
82
83
|
*/
|
|
83
84
|
dayOfWeekFormatter: PropTypes.func,
|
|
84
85
|
/**
|
|
@@ -279,6 +280,9 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
|
|
|
279
280
|
})]),
|
|
280
281
|
/**
|
|
281
282
|
* Disable specific date.
|
|
283
|
+
*
|
|
284
|
+
* Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
285
|
+
*
|
|
282
286
|
* @template TDate
|
|
283
287
|
* @param {TDate} day The date to test.
|
|
284
288
|
* @param {string} position The date to test, 'start' or 'end'.
|
|
@@ -103,6 +103,7 @@ process.env.NODE_ENV !== "production" ? DateRangePickerToolbar.propTypes = {
|
|
|
103
103
|
onRangePositionChange: PropTypes.func.isRequired,
|
|
104
104
|
rangePosition: PropTypes.oneOf(['end', 'start']).isRequired,
|
|
105
105
|
readOnly: PropTypes.bool,
|
|
106
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
106
107
|
titleId: PropTypes.string,
|
|
107
108
|
/**
|
|
108
109
|
* Toolbar date format.
|
|
@@ -91,9 +91,10 @@ DesktopDateRangePicker.propTypes = {
|
|
|
91
91
|
currentMonthCalendarPosition: PropTypes.oneOf([1, 2, 3]),
|
|
92
92
|
/**
|
|
93
93
|
* Formats the day of week displayed in the calendar header.
|
|
94
|
-
* @param {string} day The day of week provided by the adapter
|
|
94
|
+
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
95
|
+
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
95
96
|
* @returns {string} The name to display.
|
|
96
|
-
* @default (
|
|
97
|
+
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
97
98
|
*/
|
|
98
99
|
dayOfWeekFormatter: PropTypes.func,
|
|
99
100
|
/**
|
|
@@ -288,6 +289,9 @@ DesktopDateRangePicker.propTypes = {
|
|
|
288
289
|
})]),
|
|
289
290
|
/**
|
|
290
291
|
* Disable specific date.
|
|
292
|
+
*
|
|
293
|
+
* Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
294
|
+
*
|
|
291
295
|
* @template TDate
|
|
292
296
|
* @param {TDate} day The date to test.
|
|
293
297
|
* @param {string} position The date to test, 'start' or 'end'.
|
|
@@ -91,9 +91,10 @@ MobileDateRangePicker.propTypes = {
|
|
|
91
91
|
currentMonthCalendarPosition: PropTypes.oneOf([1, 2, 3]),
|
|
92
92
|
/**
|
|
93
93
|
* Formats the day of week displayed in the calendar header.
|
|
94
|
-
* @param {string} day The day of week provided by the adapter
|
|
94
|
+
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
95
|
+
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
95
96
|
* @returns {string} The name to display.
|
|
96
|
-
* @default (
|
|
97
|
+
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
97
98
|
*/
|
|
98
99
|
dayOfWeekFormatter: PropTypes.func,
|
|
99
100
|
/**
|
|
@@ -288,6 +289,9 @@ MobileDateRangePicker.propTypes = {
|
|
|
288
289
|
})]),
|
|
289
290
|
/**
|
|
290
291
|
* Disable specific date.
|
|
292
|
+
*
|
|
293
|
+
* Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
294
|
+
*
|
|
291
295
|
* @template TDate
|
|
292
296
|
* @param {TDate} day The date to test.
|
|
293
297
|
* @param {string} position The date to test, 'start' or 'end'.
|
|
@@ -282,6 +282,9 @@ process.env.NODE_ENV !== "production" ? MultiInputDateRangeField.propTypes = {
|
|
|
282
282
|
})]),
|
|
283
283
|
/**
|
|
284
284
|
* Disable specific date.
|
|
285
|
+
*
|
|
286
|
+
* Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
287
|
+
*
|
|
285
288
|
* @template TDate
|
|
286
289
|
* @param {TDate} day The date to test.
|
|
287
290
|
* @param {string} position The date to test, 'start' or 'end'.
|
|
@@ -323,6 +323,9 @@ process.env.NODE_ENV !== "production" ? MultiInputDateTimeRangeField.propTypes =
|
|
|
323
323
|
shouldDisableClock: PropTypes.func,
|
|
324
324
|
/**
|
|
325
325
|
* Disable specific date.
|
|
326
|
+
*
|
|
327
|
+
* Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
328
|
+
*
|
|
326
329
|
* @template TDate
|
|
327
330
|
* @param {TDate} day The date to test.
|
|
328
331
|
* @param {string} position The date to test, 'start' or 'end'.
|
|
@@ -2,12 +2,13 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["slots", "slotProps", "components", "componentsProps", "InputProps", "inputProps"],
|
|
4
4
|
_excluded2 = ["inputRef"],
|
|
5
|
-
_excluded3 = ["ref", "onPaste", "onKeyDown", "inputMode", "readOnly"];
|
|
5
|
+
_excluded3 = ["ref", "onPaste", "onKeyDown", "inputMode", "readOnly", "clearable", "onClear"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import MuiTextField from '@mui/material/TextField';
|
|
9
9
|
import { useThemeProps } from '@mui/material/styles';
|
|
10
10
|
import { useSlotProps } from '@mui/base/utils';
|
|
11
|
+
import { useClearableField } from '@mui/x-date-pickers/hooks';
|
|
11
12
|
import { refType } from '@mui/utils';
|
|
12
13
|
import { useSingleInputDateRangeField } from './useSingleInputDateRangeField';
|
|
13
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -47,11 +48,25 @@ var SingleInputDateRangeField = /*#__PURE__*/React.forwardRef(function SingleInp
|
|
|
47
48
|
onKeyDown = _useSingleInputDateRa.onKeyDown,
|
|
48
49
|
inputMode = _useSingleInputDateRa.inputMode,
|
|
49
50
|
readOnly = _useSingleInputDateRa.readOnly,
|
|
51
|
+
clearable = _useSingleInputDateRa.clearable,
|
|
52
|
+
onClear = _useSingleInputDateRa.onClear,
|
|
50
53
|
fieldProps = _objectWithoutProperties(_useSingleInputDateRa, _excluded3);
|
|
54
|
+
var _useClearableField = useClearableField({
|
|
55
|
+
onClear: onClear,
|
|
56
|
+
clearable: clearable,
|
|
57
|
+
fieldProps: fieldProps,
|
|
58
|
+
InputProps: fieldProps.InputProps,
|
|
59
|
+
slots: slots,
|
|
60
|
+
slotProps: slotProps,
|
|
61
|
+
components: components,
|
|
62
|
+
componentsProps: componentsProps
|
|
63
|
+
}),
|
|
64
|
+
ProcessedInputProps = _useClearableField.InputProps,
|
|
65
|
+
processedFieldProps = _useClearableField.fieldProps;
|
|
51
66
|
return /*#__PURE__*/_jsx(TextField, _extends({
|
|
52
67
|
ref: ref
|
|
53
|
-
},
|
|
54
|
-
InputProps: _extends({},
|
|
68
|
+
}, processedFieldProps, {
|
|
69
|
+
InputProps: _extends({}, ProcessedInputProps, {
|
|
55
70
|
readOnly: readOnly
|
|
56
71
|
}),
|
|
57
72
|
inputProps: _extends({}, fieldProps.inputProps, {
|
|
@@ -74,6 +89,11 @@ process.env.NODE_ENV !== "production" ? SingleInputDateRangeField.propTypes = {
|
|
|
74
89
|
*/
|
|
75
90
|
autoFocus: PropTypes.bool,
|
|
76
91
|
className: PropTypes.string,
|
|
92
|
+
/**
|
|
93
|
+
* If `true`, a clear button will be shown in the field allowing value clearing.
|
|
94
|
+
* @default false
|
|
95
|
+
*/
|
|
96
|
+
clearable: PropTypes.bool,
|
|
77
97
|
/**
|
|
78
98
|
* The color of the component.
|
|
79
99
|
* It supports both default and custom theme colors, which can be added as shown in the
|
|
@@ -202,6 +222,10 @@ process.env.NODE_ENV !== "production" ? SingleInputDateRangeField.propTypes = {
|
|
|
202
222
|
* @param {FieldChangeHandlerContext<TError>} context The context containing the validation result of the current value.
|
|
203
223
|
*/
|
|
204
224
|
onChange: PropTypes.func,
|
|
225
|
+
/**
|
|
226
|
+
* Callback fired when the clear button is clicked.
|
|
227
|
+
*/
|
|
228
|
+
onClear: PropTypes.func,
|
|
205
229
|
/**
|
|
206
230
|
* Callback fired when the error associated to the current value changes.
|
|
207
231
|
* @template TValue The value type. Will be either the same type as `value` or `null`. Can be in `[start, end]` format in case of range value.
|
|
@@ -248,6 +272,9 @@ process.env.NODE_ENV !== "production" ? SingleInputDateRangeField.propTypes = {
|
|
|
248
272
|
})]),
|
|
249
273
|
/**
|
|
250
274
|
* Disable specific date.
|
|
275
|
+
*
|
|
276
|
+
* Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
277
|
+
*
|
|
251
278
|
* @template TDate
|
|
252
279
|
* @param {TDate} day The date to test.
|
|
253
280
|
* @param {string} position The date to test, 'start' or 'end'.
|
|
@@ -2,12 +2,13 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["slots", "slotProps", "components", "componentsProps", "InputProps", "inputProps"],
|
|
4
4
|
_excluded2 = ["inputRef"],
|
|
5
|
-
_excluded3 = ["ref", "onPaste", "onKeyDown", "inputMode", "readOnly"];
|
|
5
|
+
_excluded3 = ["ref", "onPaste", "onKeyDown", "inputMode", "readOnly", "clearable", "onClear"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import MuiTextField from '@mui/material/TextField';
|
|
9
9
|
import { useThemeProps } from '@mui/material/styles';
|
|
10
10
|
import { useSlotProps } from '@mui/base/utils';
|
|
11
|
+
import { useClearableField } from '@mui/x-date-pickers/hooks';
|
|
11
12
|
import { refType } from '@mui/utils';
|
|
12
13
|
import { useSingleInputDateTimeRangeField } from './useSingleInputDateTimeRangeField';
|
|
13
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -47,11 +48,25 @@ var SingleInputDateTimeRangeField = /*#__PURE__*/React.forwardRef(function Singl
|
|
|
47
48
|
onKeyDown = _useSingleInputDateTi.onKeyDown,
|
|
48
49
|
inputMode = _useSingleInputDateTi.inputMode,
|
|
49
50
|
readOnly = _useSingleInputDateTi.readOnly,
|
|
51
|
+
clearable = _useSingleInputDateTi.clearable,
|
|
52
|
+
onClear = _useSingleInputDateTi.onClear,
|
|
50
53
|
fieldProps = _objectWithoutProperties(_useSingleInputDateTi, _excluded3);
|
|
54
|
+
var _useClearableField = useClearableField({
|
|
55
|
+
onClear: onClear,
|
|
56
|
+
clearable: clearable,
|
|
57
|
+
fieldProps: fieldProps,
|
|
58
|
+
InputProps: fieldProps.InputProps,
|
|
59
|
+
slots: slots,
|
|
60
|
+
slotProps: slotProps,
|
|
61
|
+
components: components,
|
|
62
|
+
componentsProps: componentsProps
|
|
63
|
+
}),
|
|
64
|
+
ProcessedInputProps = _useClearableField.InputProps,
|
|
65
|
+
processedFieldProps = _useClearableField.fieldProps;
|
|
51
66
|
return /*#__PURE__*/_jsx(TextField, _extends({
|
|
52
67
|
ref: ref
|
|
53
|
-
},
|
|
54
|
-
InputProps: _extends({},
|
|
68
|
+
}, processedFieldProps, {
|
|
69
|
+
InputProps: _extends({}, ProcessedInputProps, {
|
|
55
70
|
readOnly: readOnly
|
|
56
71
|
}),
|
|
57
72
|
inputProps: _extends({}, fieldProps.inputProps, {
|
|
@@ -79,6 +94,11 @@ process.env.NODE_ENV !== "production" ? SingleInputDateTimeRangeField.propTypes
|
|
|
79
94
|
*/
|
|
80
95
|
autoFocus: PropTypes.bool,
|
|
81
96
|
className: PropTypes.string,
|
|
97
|
+
/**
|
|
98
|
+
* If `true`, a clear button will be shown in the field allowing value clearing.
|
|
99
|
+
* @default false
|
|
100
|
+
*/
|
|
101
|
+
clearable: PropTypes.bool,
|
|
82
102
|
/**
|
|
83
103
|
* The color of the component.
|
|
84
104
|
* It supports both default and custom theme colors, which can be added as shown in the
|
|
@@ -235,6 +255,10 @@ process.env.NODE_ENV !== "production" ? SingleInputDateTimeRangeField.propTypes
|
|
|
235
255
|
* @param {FieldChangeHandlerContext<TError>} context The context containing the validation result of the current value.
|
|
236
256
|
*/
|
|
237
257
|
onChange: PropTypes.func,
|
|
258
|
+
/**
|
|
259
|
+
* Callback fired when the clear button is clicked.
|
|
260
|
+
*/
|
|
261
|
+
onClear: PropTypes.func,
|
|
238
262
|
/**
|
|
239
263
|
* Callback fired when the error associated to the current value changes.
|
|
240
264
|
* @template TValue The value type. Will be either the same type as `value` or `null`. Can be in `[start, end]` format in case of range value.
|
|
@@ -289,6 +313,9 @@ process.env.NODE_ENV !== "production" ? SingleInputDateTimeRangeField.propTypes
|
|
|
289
313
|
shouldDisableClock: PropTypes.func,
|
|
290
314
|
/**
|
|
291
315
|
* Disable specific date.
|
|
316
|
+
*
|
|
317
|
+
* Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
318
|
+
*
|
|
292
319
|
* @template TDate
|
|
293
320
|
* @param {TDate} day The date to test.
|
|
294
321
|
* @param {string} position The date to test, 'start' or 'end'.
|
|
@@ -2,9 +2,10 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["slots", "slotProps", "components", "componentsProps", "InputProps", "inputProps"],
|
|
4
4
|
_excluded2 = ["inputRef"],
|
|
5
|
-
_excluded3 = ["ref", "onPaste", "onKeyDown", "inputMode", "readOnly"];
|
|
5
|
+
_excluded3 = ["ref", "onPaste", "onKeyDown", "inputMode", "readOnly", "clearable", "onClear"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
+
import { useClearableField } from '@mui/x-date-pickers/hooks';
|
|
8
9
|
import MuiTextField from '@mui/material/TextField';
|
|
9
10
|
import { useThemeProps } from '@mui/material/styles';
|
|
10
11
|
import { useSlotProps } from '@mui/base/utils';
|
|
@@ -47,11 +48,25 @@ var SingleInputTimeRangeField = /*#__PURE__*/React.forwardRef(function SingleInp
|
|
|
47
48
|
onKeyDown = _useSingleInputTimeRa.onKeyDown,
|
|
48
49
|
inputMode = _useSingleInputTimeRa.inputMode,
|
|
49
50
|
readOnly = _useSingleInputTimeRa.readOnly,
|
|
51
|
+
clearable = _useSingleInputTimeRa.clearable,
|
|
52
|
+
onClear = _useSingleInputTimeRa.onClear,
|
|
50
53
|
fieldProps = _objectWithoutProperties(_useSingleInputTimeRa, _excluded3);
|
|
54
|
+
var _useClearableField = useClearableField({
|
|
55
|
+
onClear: onClear,
|
|
56
|
+
clearable: clearable,
|
|
57
|
+
fieldProps: fieldProps,
|
|
58
|
+
InputProps: fieldProps.InputProps,
|
|
59
|
+
slots: slots,
|
|
60
|
+
slotProps: slotProps,
|
|
61
|
+
components: components,
|
|
62
|
+
componentsProps: componentsProps
|
|
63
|
+
}),
|
|
64
|
+
ProcessedInputProps = _useClearableField.InputProps,
|
|
65
|
+
processedFieldProps = _useClearableField.fieldProps;
|
|
51
66
|
return /*#__PURE__*/_jsx(TextField, _extends({
|
|
52
67
|
ref: ref
|
|
53
|
-
},
|
|
54
|
-
InputProps: _extends({},
|
|
68
|
+
}, processedFieldProps, {
|
|
69
|
+
InputProps: _extends({}, ProcessedInputProps, {
|
|
55
70
|
readOnly: readOnly
|
|
56
71
|
}),
|
|
57
72
|
inputProps: _extends({}, fieldProps.inputProps, {
|
|
@@ -79,6 +94,11 @@ process.env.NODE_ENV !== "production" ? SingleInputTimeRangeField.propTypes = {
|
|
|
79
94
|
*/
|
|
80
95
|
autoFocus: PropTypes.bool,
|
|
81
96
|
className: PropTypes.string,
|
|
97
|
+
/**
|
|
98
|
+
* If `true`, a clear button will be shown in the field allowing value clearing.
|
|
99
|
+
* @default false
|
|
100
|
+
*/
|
|
101
|
+
clearable: PropTypes.bool,
|
|
82
102
|
/**
|
|
83
103
|
* The color of the component.
|
|
84
104
|
* It supports both default and custom theme colors, which can be added as shown in the
|
|
@@ -219,6 +239,10 @@ process.env.NODE_ENV !== "production" ? SingleInputTimeRangeField.propTypes = {
|
|
|
219
239
|
* @param {FieldChangeHandlerContext<TError>} context The context containing the validation result of the current value.
|
|
220
240
|
*/
|
|
221
241
|
onChange: PropTypes.func,
|
|
242
|
+
/**
|
|
243
|
+
* Callback fired when the clear button is clicked.
|
|
244
|
+
*/
|
|
245
|
+
onClear: PropTypes.func,
|
|
222
246
|
/**
|
|
223
247
|
* Callback fired when the error associated to the current value changes.
|
|
224
248
|
* @template TValue The value type. Will be either the same type as `value` or `null`. Can be in `[start, end]` format in case of range value.
|
|
@@ -77,9 +77,10 @@ StaticDateRangePicker.propTypes = {
|
|
|
77
77
|
currentMonthCalendarPosition: PropTypes.oneOf([1, 2, 3]),
|
|
78
78
|
/**
|
|
79
79
|
* Formats the day of week displayed in the calendar header.
|
|
80
|
-
* @param {string} day The day of week provided by the adapter
|
|
80
|
+
* @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
|
|
81
|
+
* @param {TDate} date The date of the day of week provided by the adapter.
|
|
81
82
|
* @returns {string} The name to display.
|
|
82
|
-
* @default (
|
|
83
|
+
* @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
|
|
83
84
|
*/
|
|
84
85
|
dayOfWeekFormatter: PropTypes.func,
|
|
85
86
|
/**
|
|
@@ -226,6 +227,9 @@ StaticDateRangePicker.propTypes = {
|
|
|
226
227
|
renderLoading: PropTypes.func,
|
|
227
228
|
/**
|
|
228
229
|
* Disable specific date.
|
|
230
|
+
*
|
|
231
|
+
* Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
|
|
232
|
+
*
|
|
229
233
|
* @template TDate
|
|
230
234
|
* @param {TDate} day The date to test.
|
|
231
235
|
* @param {string} position The date to test, 'start' or 'end'.
|
package/legacy/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
1
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
+
var _excluded = ["clearable", "onClear"];
|
|
2
4
|
import * as React from 'react';
|
|
3
5
|
import { resolveComponentProps } from '@mui/base/utils';
|
|
4
6
|
import useEventCallback from '@mui/utils/useEventCallback';
|
|
@@ -114,7 +116,12 @@ var useMultiInputFieldSlotProps = function useMultiInputFieldSlotProps(_ref) {
|
|
|
114
116
|
},
|
|
115
117
|
separator: pickerSlotProps == null ? void 0 : pickerSlotProps.fieldSeparator
|
|
116
118
|
});
|
|
117
|
-
|
|
119
|
+
|
|
120
|
+
/* TODO: remove this when a clearable behavior for multiple input range fields is implemented */
|
|
121
|
+
var clearable = fieldProps.clearable,
|
|
122
|
+
onClear = fieldProps.onClear,
|
|
123
|
+
restFieldProps = _objectWithoutProperties(fieldProps, _excluded);
|
|
124
|
+
var enrichedFieldProps = _extends({}, restFieldProps, {
|
|
118
125
|
slots: slots,
|
|
119
126
|
slotProps: slotProps
|
|
120
127
|
});
|
|
@@ -171,10 +178,14 @@ var useSingleInputFieldSlotProps = function useSingleInputFieldSlotProps(_ref2)
|
|
|
171
178
|
}
|
|
172
179
|
};
|
|
173
180
|
var slots = _extends({}, fieldProps.slots, {
|
|
174
|
-
textField: pickerSlots == null ? void 0 : pickerSlots.textField
|
|
181
|
+
textField: pickerSlots == null ? void 0 : pickerSlots.textField,
|
|
182
|
+
clearButton: pickerSlots == null ? void 0 : pickerSlots.clearButton,
|
|
183
|
+
clearIcon: pickerSlots == null ? void 0 : pickerSlots.clearIcon
|
|
175
184
|
});
|
|
176
185
|
var slotProps = _extends({}, fieldProps.slotProps, {
|
|
177
|
-
textField: pickerSlotProps == null ? void 0 : pickerSlotProps.textField
|
|
186
|
+
textField: pickerSlotProps == null ? void 0 : pickerSlotProps.textField,
|
|
187
|
+
clearButton: pickerSlots == null ? void 0 : pickerSlots.clearButton,
|
|
188
|
+
clearIcon: pickerSlots == null ? void 0 : pickerSlots.clearIcon
|
|
178
189
|
});
|
|
179
190
|
var enrichedFieldProps = _extends({}, fieldProps, {
|
|
180
191
|
slots: slots,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/* TODO: remove this when a clearable behavior for multiple input range fields is implemented */
|
|
2
|
+
export var excludeProps = function excludeProps(props, excludedProps) {
|
|
3
|
+
return Object.keys(props).reduce(function (acc, key) {
|
|
4
|
+
if (!excludedProps.includes(key)) {
|
|
5
|
+
acc[key] = props[key];
|
|
6
|
+
}
|
|
7
|
+
return acc;
|
|
8
|
+
}, {});
|
|
9
|
+
};
|
|
@@ -5,6 +5,7 @@ import { useLocalizationContext, useValidation, useControlledValueWithTimezone }
|
|
|
5
5
|
import { useDefaultizedDateRangeFieldProps } from '../../../SingleInputDateRangeField/useSingleInputDateRangeField';
|
|
6
6
|
import { validateDateRange } from '../../utils/validation/validateDateRange';
|
|
7
7
|
import { rangeValueManager } from '../../utils/valueManagers';
|
|
8
|
+
import { excludeProps } from './shared';
|
|
8
9
|
export var useMultiInputDateRangeField = function useMultiInputDateRangeField(_ref) {
|
|
9
10
|
var inSharedProps = _ref.sharedProps,
|
|
10
11
|
startTextFieldProps = _ref.startTextFieldProps,
|
|
@@ -100,8 +101,10 @@ export var useMultiInputDateRangeField = function useMultiInputDateRangeField(_r
|
|
|
100
101
|
props: endFieldProps,
|
|
101
102
|
inputRef: endInputRef
|
|
102
103
|
});
|
|
104
|
+
|
|
105
|
+
/* TODO: Undo this change when a clearable behavior for multiple input range fields is implemented */
|
|
103
106
|
return {
|
|
104
|
-
startDate: startDateResponse,
|
|
105
|
-
endDate: endDateResponse
|
|
107
|
+
startDate: excludeProps(startDateResponse, ['clearable', 'onClear']),
|
|
108
|
+
endDate: excludeProps(endDateResponse, ['clearable', 'onClear'])
|
|
106
109
|
};
|
|
107
110
|
};
|