1
0
Fork 0

Added Statistics calculation

Statistics now show calculated values
This commit is contained in:
Techognito 2025-09-04 17:30:00 +02:00
parent fe87374e47
commit fc0f69dacb
2147 changed files with 141321 additions and 39 deletions

View file

@ -0,0 +1,17 @@
import * as React from 'react';
import { DatePickerProps } from "./DatePicker.types.js";
type DatePickerComponent = (<TEnableAccessibleFieldDOMStructure extends boolean = true>(props: DatePickerProps<TEnableAccessibleFieldDOMStructure> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
propTypes?: any;
};
/**
* Demos:
*
* - [DatePicker](https://mui.com/x/react-date-pickers/date-picker/)
* - [Validation](https://mui.com/x/react-date-pickers/validation/)
*
* API:
*
* - [DatePicker API](https://mui.com/x/api/date-pickers/date-picker/)
*/
declare const DatePicker: DatePickerComponent;
export { DatePicker };

View file

@ -0,0 +1,369 @@
'use client';
import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
const _excluded = ["desktopModeMediaQuery"];
import * as React from 'react';
import PropTypes from 'prop-types';
import useMediaQuery from '@mui/material/useMediaQuery';
import { useThemeProps } from '@mui/material/styles';
import refType from '@mui/utils/refType';
import { DesktopDatePicker } from "../DesktopDatePicker/index.js";
import { MobileDatePicker } from "../MobileDatePicker/index.js";
import { DEFAULT_DESKTOP_MODE_MEDIA_QUERY } from "../internals/utils/utils.js";
import { jsx as _jsx } from "react/jsx-runtime";
/**
* Demos:
*
* - [DatePicker](https://mui.com/x/react-date-pickers/date-picker/)
* - [Validation](https://mui.com/x/react-date-pickers/validation/)
*
* API:
*
* - [DatePicker API](https://mui.com/x/api/date-pickers/date-picker/)
*/
const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker(inProps, ref) {
const props = useThemeProps({
props: inProps,
name: 'MuiDatePicker'
});
const {
desktopModeMediaQuery = DEFAULT_DESKTOP_MODE_MEDIA_QUERY
} = props,
other = _objectWithoutPropertiesLoose(props, _excluded);
// defaults to `true` in environments where `window.matchMedia` would not be available (i.e. test/jsdom)
const isDesktop = useMediaQuery(desktopModeMediaQuery, {
defaultMatches: true
});
if (isDesktop) {
return /*#__PURE__*/_jsx(DesktopDatePicker, _extends({
ref: ref
}, other));
}
return /*#__PURE__*/_jsx(MobileDatePicker, _extends({
ref: ref
}, other));
});
if (process.env.NODE_ENV !== "production") DatePicker.displayName = "DatePicker";
process.env.NODE_ENV !== "production" ? DatePicker.propTypes = {
// ----------------------------- Warning --------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them edit the TypeScript types and run "pnpm proptypes" |
// ----------------------------------------------------------------------
/**
* If `true`, the main element is focused during the first mount.
* This main element is:
* - the element chosen by the visible view if any (i.e: the selected day on the `day` view).
* - the `input` element if there is a field rendered.
*/
autoFocus: PropTypes.bool,
className: PropTypes.string,
/**
* If `true`, the Picker will close after submitting the full date.
* @default `true` for desktop, `false` for mobile (based on the chosen wrapper and `desktopModeMediaQuery` prop).
*/
closeOnSelect: PropTypes.bool,
/**
* Formats the day of week displayed in the calendar header.
* @param {PickerValidDate} date The date of the day of week provided by the adapter.
* @returns {string} The name to display.
* @default (date: PickerValidDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
*/
dayOfWeekFormatter: PropTypes.func,
/**
* The default value.
* Used when the component is not controlled.
*/
defaultValue: PropTypes.object,
/**
* CSS media query when `Mobile` mode will be changed to `Desktop`.
* @default '@media (pointer: fine)'
* @example '@media (min-width: 720px)' or theme.breakpoints.up("sm")
*/
desktopModeMediaQuery: PropTypes.string,
/**
* If `true`, the component is disabled.
* When disabled, the value cannot be changed and no interaction is possible.
* @default false
*/
disabled: PropTypes.bool,
/**
* If `true`, disable values after the current date for date components, time for time components and both for date time components.
* @default false
*/
disableFuture: PropTypes.bool,
/**
* If `true`, today's date is rendering without highlighting with circle.
* @default false
*/
disableHighlightToday: PropTypes.bool,
/**
* If `true`, the button to open the Picker will not be rendered (it will only render the field).
* @deprecated Use the [field component](https://mui.com/x/react-date-pickers/fields/) instead.
* @default false
*/
disableOpenPicker: PropTypes.bool,
/**
* If `true`, disable values before the current date for date components, time for time components and both for date time components.
* @default false
*/
disablePast: PropTypes.bool,
/**
* If `true`, the week number will be display in the calendar.
*/
displayWeekNumber: PropTypes.bool,
/**
* @default true
*/
enableAccessibleFieldDOMStructure: PropTypes.any,
/**
* The day view will show as many weeks as needed after the end of the current month to match this value.
* Put it to 6 to have a fixed number of weeks in Gregorian calendars
*/
fixedWeekNumber: PropTypes.number,
/**
* Format of the date when rendered in the input(s).
* Defaults to localized format based on the used `views`.
*/
format: PropTypes.string,
/**
* Density of the format when rendered in the input.
* Setting `formatDensity` to `"spacious"` will add a space before and after each `/`, `-` and `.` character.
* @default "dense"
*/
formatDensity: PropTypes.oneOf(['dense', 'spacious']),
/**
* Pass a ref to the `input` element.
*/
inputRef: refType,
/**
* The label content.
*/
label: PropTypes.node,
/**
* If `true`, calls `renderLoading` instead of rendering the day calendar.
* Can be used to preload information and show it in calendar.
* @default false
*/
loading: PropTypes.bool,
/**
* Locale for components texts.
* Allows overriding texts coming from `LocalizationProvider` and `theme`.
*/
localeText: PropTypes.object,
/**
* Maximal selectable date.
* @default 2099-12-31
*/
maxDate: PropTypes.object,
/**
* Minimal selectable date.
* @default 1900-01-01
*/
minDate: PropTypes.object,
/**
* Months rendered per row.
* @default 3
*/
monthsPerRow: PropTypes.oneOf([3, 4]),
/**
* Name attribute used by the `input` element in the Field.
*/
name: PropTypes.string,
/**
* Callback fired when the value is accepted.
* @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
* @template TError The validation error type. It will be either `string` or a `null`. It can be in `[start, end]` format in case of range value.
* @param {TValue} value The value that was just accepted.
* @param {FieldChangeHandlerContext<TError>} context The context containing the validation result of the current value.
*/
onAccept: PropTypes.func,
/**
* Callback fired when the value changes.
* @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
* @template TError The validation error type. It will be either `string` or a `null`. It can be in `[start, end]` format in case of range value.
* @param {TValue} value The new value.
* @param {FieldChangeHandlerContext<TError>} context The context containing the validation result of the current value.
*/
onChange: PropTypes.func,
/**
* Callback fired when the popup requests to be closed.
* Use in controlled mode (see `open`).
*/
onClose: PropTypes.func,
/**
* Callback fired when the error associated with the current value changes.
* When a validation error is detected, the `error` parameter contains a non-null value.
* This can be used to render an appropriate form error.
* @template TError The validation error type. It will be either `string` or a `null`. It can be in `[start, end]` format in case of range value.
* @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
* @param {TError} error The reason why the current value is not valid.
* @param {TValue} value The value associated with the error.
*/
onError: PropTypes.func,
/**
* Callback fired on month change.
* @param {PickerValidDate} month The new month.
*/
onMonthChange: PropTypes.func,
/**
* Callback fired when the popup requests to be opened.
* Use in controlled mode (see `open`).
*/
onOpen: PropTypes.func,
/**
* Callback fired when the selected sections change.
* @param {FieldSelectedSections} newValue The new selected sections.
*/
onSelectedSectionsChange: PropTypes.func,
/**
* Callback fired on view change.
* @template TView Type of the view. It will vary based on the Picker type and the `views` it uses.
* @param {TView} view The new view.
*/
onViewChange: PropTypes.func,
/**
* Callback fired on year change.
* @param {PickerValidDate} year The new year.
*/
onYearChange: PropTypes.func,
/**
* Control the popup or dialog open state.
* @default false
*/
open: PropTypes.bool,
/**
* The default visible view.
* Used when the component view is not controlled.
* Must be a valid option from `views` list.
*/
openTo: PropTypes.oneOf(['day', 'month', 'year']),
/**
* Force rendering in particular orientation.
*/
orientation: PropTypes.oneOf(['landscape', 'portrait']),
/**
* If `true`, the component is read-only.
* When read-only, the value cannot be changed but the user can interact with the interface.
* @default false
*/
readOnly: PropTypes.bool,
/**
* If `true`, disable heavy animations.
* @default `@media(prefers-reduced-motion: reduce)` || `navigator.userAgent` matches Android <10 or iOS <13
*/
reduceAnimations: PropTypes.bool,
/**
* The date used to generate the new value when both `value` and `defaultValue` are empty.
* @default The closest valid date-time using the validation props, except callbacks like `shouldDisable<...>`.
*/
referenceDate: PropTypes.object,
/**
* Component displaying when passed `loading` true.
* @returns {React.ReactNode} The node to render when loading.
* @default () => <span>...</span>
*/
renderLoading: PropTypes.func,
/**
* The currently selected sections.
* This prop accepts four formats:
* 1. If a number is provided, the section at this index will be selected.
* 2. If a string of type `FieldSectionType` is provided, the first section with that name will be selected.
* 3. If `"all"` is provided, all the sections will be selected.
* 4. If `null` is provided, no section will be selected.
* If not provided, the selected sections will be handled internally.
*/
selectedSections: PropTypes.oneOfType([PropTypes.oneOf(['all', 'day', 'empty', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'weekDay', 'year']), PropTypes.number]),
/**
* Disable specific date.
*
* Warning: This function can be called multiple times (for example when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
*
* @param {PickerValidDate} day The date to test.
* @returns {boolean} If `true` the date will be disabled.
*/
shouldDisableDate: PropTypes.func,
/**
* Disable specific month.
* @param {PickerValidDate} month The month to test.
* @returns {boolean} If `true`, the month will be disabled.
*/
shouldDisableMonth: PropTypes.func,
/**
* Disable specific year.
* @param {PickerValidDate} year The year to test.
* @returns {boolean} If `true`, the year will be disabled.
*/
shouldDisableYear: PropTypes.func,
/**
* If `true`, days outside the current month are rendered:
*
* - if `fixedWeekNumber` is defined, renders days to have the weeks requested.
*
* - if `fixedWeekNumber` is not defined, renders day to fill the first and last week of the current month.
*
* - ignored if `calendars` equals more than `1` on range pickers.
* @default false
*/
showDaysOutsideCurrentMonth: PropTypes.bool,
/**
* The props used for each component slot.
* @default {}
*/
slotProps: PropTypes.object,
/**
* Overridable component slots.
* @default {}
*/
slots: PropTypes.object,
/**
* The system prop that allows defining system overrides as well as additional CSS styles.
*/
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
/**
* Choose which timezone to use for the value.
* Example: "default", "system", "UTC", "America/New_York".
* If you pass values from other timezones to some props, they will be converted to this timezone before being used.
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documentation} for more details.
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
*/
timezone: PropTypes.string,
/**
* The selected value.
* Used when the component is controlled.
*/
value: PropTypes.object,
/**
* The visible view.
* Used when the component view is controlled.
* Must be a valid option from `views` list.
*/
view: PropTypes.oneOf(['day', 'month', 'year']),
/**
* Define custom view renderers for each section.
* If `null`, the section will only have field editing.
* If `undefined`, internally defined view will be used.
*/
viewRenderers: PropTypes.shape({
day: PropTypes.func,
month: PropTypes.func,
year: PropTypes.func
}),
/**
* Available views.
*/
views: PropTypes.arrayOf(PropTypes.oneOf(['day', 'month', 'year']).isRequired),
/**
* Years are displayed in ascending (chronological) order by default.
* If `desc`, years are displayed in descending order.
* @default 'asc'
*/
yearsOrder: PropTypes.oneOf(['asc', 'desc']),
/**
* Years rendered per row.
* @default 4 on desktop, 3 on mobile
*/
yearsPerRow: PropTypes.oneOf([3, 4])
} : void 0;
export { DatePicker };

View file

@ -0,0 +1,38 @@
import { DesktopDatePickerProps, DesktopDatePickerSlots, DesktopDatePickerSlotProps } from "../DesktopDatePicker/index.js";
import { BaseSingleInputFieldProps } from "../internals/models/index.js";
import { MobileDatePickerProps, MobileDatePickerSlots, MobileDatePickerSlotProps } from "../MobileDatePicker/index.js";
import { ValidateDateProps } from "../validation/validateDate.js";
export interface DatePickerSlots extends DesktopDatePickerSlots, MobileDatePickerSlots {}
export interface DatePickerSlotProps<TEnableAccessibleFieldDOMStructure extends boolean> extends DesktopDatePickerSlotProps<TEnableAccessibleFieldDOMStructure>, MobileDatePickerSlotProps<TEnableAccessibleFieldDOMStructure> {}
export interface DatePickerProps<TEnableAccessibleFieldDOMStructure extends boolean = true> extends DesktopDatePickerProps<TEnableAccessibleFieldDOMStructure>, MobileDatePickerProps<TEnableAccessibleFieldDOMStructure> {
/**
* CSS media query when `Mobile` mode will be changed to `Desktop`.
* @default '@media (pointer: fine)'
* @example '@media (min-width: 720px)' or theme.breakpoints.up("sm")
*/
desktopModeMediaQuery?: string;
/**
* Overridable component slots.
* @default {}
*/
slots?: DatePickerSlots;
/**
* The props used for each component slot.
* @default {}
*/
slotProps?: DatePickerSlotProps<TEnableAccessibleFieldDOMStructure>;
/**
* Years rendered per row.
* @default 4 on desktop, 3 on mobile
*/
yearsPerRow?: 3 | 4;
/**
* If `true`, the Picker will close after submitting the full date.
* @default `true` for desktop, `false` for mobile (based on the chosen wrapper and `desktopModeMediaQuery` prop).
*/
closeOnSelect?: boolean;
}
/**
* Props the field can receive when used inside a Date Picker (<DatePicker />, <DesktopDatePicker /> or <MobileDatePicker /> component).
*/
export type DatePickerFieldProps = ValidateDateProps & BaseSingleInputFieldProps;

View file

@ -0,0 +1 @@
export {};

View file

@ -0,0 +1,25 @@
import * as React from 'react';
import { BaseToolbarProps, ExportedBaseToolbarProps } from "../internals/models/props/toolbar.js";
import { DatePickerToolbarClasses } from "./datePickerToolbarClasses.js";
export interface DatePickerToolbarProps extends BaseToolbarProps, ExportedDatePickerToolbarProps {}
export interface ExportedDatePickerToolbarProps extends ExportedBaseToolbarProps {
/**
* Override or extend the styles applied to the component.
*/
classes?: Partial<DatePickerToolbarClasses>;
}
type DatePickerToolbarComponent = ((props: DatePickerToolbarProps & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
propTypes?: any;
};
/**
* Demos:
*
* - [DatePicker](https://mui.com/x/react-date-pickers/date-picker/)
* - [Custom components](https://mui.com/x/react-date-pickers/custom-components/)
*
* API:
*
* - [DatePickerToolbar API](https://mui.com/x/api/date-pickers/date-picker-toolbar/)
*/
export declare const DatePickerToolbar: DatePickerToolbarComponent;
export {};

View file

@ -0,0 +1,127 @@
'use client';
import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
const _excluded = ["toolbarFormat", "toolbarPlaceholder", "className", "classes"];
import * as React from 'react';
import clsx from 'clsx';
import PropTypes from 'prop-types';
import Typography from '@mui/material/Typography';
import { styled, useThemeProps } from '@mui/material/styles';
import composeClasses from '@mui/utils/composeClasses';
import { PickersToolbar } from "../internals/components/PickersToolbar.js";
import { usePickerAdapter, usePickerContext, usePickerTranslations } from "../hooks/index.js";
import { getDatePickerToolbarUtilityClass } from "./datePickerToolbarClasses.js";
import { resolveDateFormat } from "../internals/utils/date-utils.js";
import { useToolbarOwnerState } from "../internals/hooks/useToolbarOwnerState.js";
import { jsx as _jsx } from "react/jsx-runtime";
const useUtilityClasses = classes => {
const slots = {
root: ['root'],
title: ['title']
};
return composeClasses(slots, getDatePickerToolbarUtilityClass, classes);
};
const DatePickerToolbarRoot = styled(PickersToolbar, {
name: 'MuiDatePickerToolbar',
slot: 'Root'
})({});
const DatePickerToolbarTitle = styled(Typography, {
name: 'MuiDatePickerToolbar',
slot: 'Title'
})({
variants: [{
props: {
pickerOrientation: 'landscape'
},
style: {
margin: 'auto 16px auto auto'
}
}]
});
/**
* Demos:
*
* - [DatePicker](https://mui.com/x/react-date-pickers/date-picker/)
* - [Custom components](https://mui.com/x/react-date-pickers/custom-components/)
*
* API:
*
* - [DatePickerToolbar API](https://mui.com/x/api/date-pickers/date-picker-toolbar/)
*/
export const DatePickerToolbar = /*#__PURE__*/React.forwardRef(function DatePickerToolbar(inProps, ref) {
const props = useThemeProps({
props: inProps,
name: 'MuiDatePickerToolbar'
});
const {
toolbarFormat,
toolbarPlaceholder = '',
className,
classes: classesProp
} = props,
other = _objectWithoutPropertiesLoose(props, _excluded);
const adapter = usePickerAdapter();
const {
value,
views,
orientation
} = usePickerContext();
const translations = usePickerTranslations();
const ownerState = useToolbarOwnerState();
const classes = useUtilityClasses(classesProp);
const dateText = React.useMemo(() => {
if (!adapter.isValid(value)) {
return toolbarPlaceholder;
}
const formatFromViews = resolveDateFormat(adapter, {
format: toolbarFormat,
views
}, true);
return adapter.formatByString(value, formatFromViews);
}, [value, toolbarFormat, toolbarPlaceholder, adapter, views]);
return /*#__PURE__*/_jsx(DatePickerToolbarRoot, _extends({
ref: ref,
toolbarTitle: translations.datePickerToolbarTitle,
className: clsx(classes.root, className)
}, other, {
children: /*#__PURE__*/_jsx(DatePickerToolbarTitle, {
variant: "h4",
align: orientation === 'landscape' ? 'left' : 'center',
ownerState: ownerState,
className: classes.title,
children: dateText
})
}));
});
if (process.env.NODE_ENV !== "production") DatePickerToolbar.displayName = "DatePickerToolbar";
process.env.NODE_ENV !== "production" ? DatePickerToolbar.propTypes = {
// ----------------------------- Warning --------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them edit the TypeScript types and run "pnpm proptypes" |
// ----------------------------------------------------------------------
/**
* Override or extend the styles applied to the component.
*/
classes: PropTypes.object,
className: PropTypes.string,
/**
* If `true`, show the toolbar even in desktop mode.
* @default `true` for Desktop, `false` for Mobile.
*/
hidden: PropTypes.bool,
/**
* The system prop that allows defining system overrides as well as additional CSS styles.
*/
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
titleId: PropTypes.string,
/**
* Toolbar date format.
*/
toolbarFormat: PropTypes.string,
/**
* Toolbar value placeholderit is displayed when the value is empty.
* @default ""
*/
toolbarPlaceholder: PropTypes.node
} : void 0;

View file

@ -0,0 +1,9 @@
export interface DatePickerToolbarClasses {
/** Styles applied to the root element. */
root: string;
/** Styles applied to the title element. */
title: string;
}
export type DatePickerToolbarClassKey = keyof DatePickerToolbarClasses;
export declare function getDatePickerToolbarUtilityClass(slot: string): string;
export declare const datePickerToolbarClasses: DatePickerToolbarClasses;

View file

@ -0,0 +1,6 @@
import generateUtilityClass from '@mui/utils/generateUtilityClass';
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
export function getDatePickerToolbarUtilityClass(slot) {
return generateUtilityClass('MuiDatePickerToolbar', slot);
}
export const datePickerToolbarClasses = generateUtilityClasses('MuiDatePickerToolbar', ['root', 'title']);

View file

@ -0,0 +1,6 @@
export { DatePicker } from "./DatePicker.js";
export type { DatePickerProps, DatePickerSlots, DatePickerSlotProps, DatePickerFieldProps } from "./DatePicker.types.js";
export { DatePickerToolbar } from "./DatePickerToolbar.js";
export type { DatePickerToolbarProps } from "./DatePickerToolbar.js";
export { datePickerToolbarClasses } from "./datePickerToolbarClasses.js";
export type { DatePickerToolbarClassKey, DatePickerToolbarClasses } from "./datePickerToolbarClasses.js";

View file

@ -0,0 +1,3 @@
export { DatePicker } from "./DatePicker.js";
export { DatePickerToolbar } from "./DatePickerToolbar.js";
export { datePickerToolbarClasses } from "./datePickerToolbarClasses.js";

View file

@ -0,0 +1,43 @@
import * as React from 'react';
import { DefaultizedProps } from '@mui/x-internals/types';
import { DateCalendarSlots, DateCalendarSlotProps, ExportedDateCalendarProps } from "../DateCalendar/DateCalendar.types.js";
import { DateValidationError, DateView } from "../models/index.js";
import { BasePickerInputProps } from "../internals/models/props/basePickerProps.js";
import { LocalizedComponent } from "../locales/utils/pickersLocaleTextApi.js";
import { DatePickerToolbarProps, ExportedDatePickerToolbarProps } from "./DatePickerToolbar.js";
import { PickerViewRendererLookup } from "../internals/hooks/usePicker/index.js";
import { DateViewRendererProps } from "../dateViewRenderers/index.js";
import { PickerValue } from "../internals/models/index.js";
import { ValidateDatePropsToDefault } from "../validation/validateDate.js";
export interface BaseDatePickerSlots extends DateCalendarSlots {
/**
* Custom component for the toolbar rendered above the views.
* @default DatePickerToolbar
*/
toolbar?: React.JSXElementConstructor<DatePickerToolbarProps>;
}
export interface BaseDatePickerSlotProps extends DateCalendarSlotProps {
toolbar?: ExportedDatePickerToolbarProps;
}
export type DatePickerViewRenderers<TView extends DateView> = PickerViewRendererLookup<PickerValue, TView, DateViewRendererProps<TView>>;
export interface BaseDatePickerProps extends BasePickerInputProps<PickerValue, DateView, DateValidationError>, ExportedDateCalendarProps {
/**
* Overridable component slots.
* @default {}
*/
slots?: BaseDatePickerSlots;
/**
* The props used for each component slot.
* @default {}
*/
slotProps?: BaseDatePickerSlotProps;
/**
* Define custom view renderers for each section.
* If `null`, the section will only have field editing.
* If `undefined`, internally defined view will be used.
*/
viewRenderers?: Partial<DatePickerViewRenderers<DateView>>;
}
type UseDatePickerDefaultizedProps<Props extends BaseDatePickerProps> = LocalizedComponent<DefaultizedProps<Props, 'views' | 'openTo' | ValidateDatePropsToDefault>>;
export declare function useDatePickerDefaultizedProps<Props extends BaseDatePickerProps>(props: Props, name: string): UseDatePickerDefaultizedProps<Props>;
export {};

View file

@ -0,0 +1,33 @@
import _extends from "@babel/runtime/helpers/esm/extends";
import * as React from 'react';
import { useThemeProps } from '@mui/material/styles';
import { applyDefaultViewProps } from "../internals/utils/views.js";
import { DatePickerToolbar } from "./DatePickerToolbar.js";
import { useApplyDefaultValuesToDateValidationProps } from "../managers/useDateManager.js";
export function useDatePickerDefaultizedProps(props, name) {
const themeProps = useThemeProps({
props,
name
});
const validationProps = useApplyDefaultValuesToDateValidationProps(themeProps);
const localeText = React.useMemo(() => {
if (themeProps.localeText?.toolbarTitle == null) {
return themeProps.localeText;
}
return _extends({}, themeProps.localeText, {
datePickerToolbarTitle: themeProps.localeText.toolbarTitle
});
}, [themeProps.localeText]);
return _extends({}, themeProps, validationProps, {
localeText
}, applyDefaultViewProps({
views: themeProps.views,
openTo: themeProps.openTo,
defaultViews: ['year', 'day'],
defaultOpenTo: 'day'
}), {
slots: _extends({
toolbar: DatePickerToolbar
}, themeProps.slots)
});
}