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,2 @@
export { useStaticPicker } from "./useStaticPicker.js";
export type { UseStaticPickerSlots, UseStaticPickerSlotProps, StaticOnlyPickerProps } from "./useStaticPicker.types.js";

View file

@ -0,0 +1 @@
export { useStaticPicker } from "./useStaticPicker.js";

View file

@ -0,0 +1,16 @@
import * as React from 'react';
import { UseStaticPickerParams, UseStaticPickerProps } from "./useStaticPicker.types.js";
import { DateOrTimeViewWithMeridiem } from "../../models/index.js";
/**
* Hook managing all the single-date static pickers:
* - StaticDatePicker
* - StaticDateTimePicker
* - StaticTimePicker
*/
export declare const useStaticPicker: <TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseStaticPickerProps<TView, any, TExternalProps>>({
props,
steps,
...pickerParams
}: UseStaticPickerParams<TView, TExternalProps>) => {
renderPicker: () => React.JSX.Element;
};

View file

@ -0,0 +1,70 @@
import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
const _excluded = ["props", "steps"];
import * as React from 'react';
import clsx from 'clsx';
import { styled } from '@mui/material/styles';
import { usePicker } from "../usePicker/index.js";
import { PickerProvider } from "../../components/PickerProvider.js";
import { PickersLayout } from "../../../PickersLayout/index.js";
import { DIALOG_WIDTH } from "../../constants/dimensions.js";
import { mergeSx } from "../../utils/utils.js";
import { createNonRangePickerStepNavigation } from "../../utils/createNonRangePickerStepNavigation.js";
import { jsx as _jsx } from "react/jsx-runtime";
const PickerStaticLayout = styled(PickersLayout)(({
theme
}) => ({
overflow: 'hidden',
minWidth: DIALOG_WIDTH,
backgroundColor: (theme.vars || theme).palette.background.paper
}));
/**
* Hook managing all the single-date static pickers:
* - StaticDatePicker
* - StaticDateTimePicker
* - StaticTimePicker
*/
export const useStaticPicker = _ref => {
let {
props,
steps
} = _ref,
pickerParams = _objectWithoutPropertiesLoose(_ref, _excluded);
const {
localeText,
slots,
slotProps,
displayStaticWrapperAs,
autoFocus
} = props;
const getStepNavigation = createNonRangePickerStepNavigation({
steps
});
const {
providerProps,
renderCurrentView
} = usePicker(_extends({}, pickerParams, {
props,
variant: displayStaticWrapperAs,
autoFocusView: autoFocus ?? false,
viewContainerRole: null,
localeText,
getStepNavigation
}));
const Layout = slots?.layout ?? PickerStaticLayout;
const renderPicker = () => /*#__PURE__*/_jsx(PickerProvider, _extends({}, providerProps, {
children: /*#__PURE__*/_jsx(Layout, _extends({}, slotProps?.layout, {
slots: slots,
slotProps: slotProps,
sx: mergeSx(providerProps.contextValue.rootSx, slotProps?.layout?.sx),
className: clsx(providerProps.contextValue.rootClassName, slotProps?.layout?.className),
ref: providerProps.contextValue.rootRef,
children: renderCurrentView()
}))
}));
if (process.env.NODE_ENV !== "production") renderPicker.displayName = "renderPicker";
return {
renderPicker
};
};

View file

@ -0,0 +1,46 @@
import { ExportedPickersLayoutSlots, ExportedPickersLayoutSlotProps } from "../../../PickersLayout/PickersLayout.types.js";
import { BasePickerProps } from "../../models/props/basePickerProps.js";
import { UsePickerParameters, UsePickerProps } from "../usePicker/index.js";
import { DateOrTimeViewWithMeridiem, PickerValue } from "../../models/index.js";
import { PickerStep } from "../../utils/createNonRangePickerStepNavigation.js";
export interface UseStaticPickerSlots extends ExportedPickersLayoutSlots<PickerValue> {}
export interface UseStaticPickerSlotProps extends ExportedPickersLayoutSlotProps<PickerValue> {}
export interface StaticOnlyPickerProps {
/**
* Force static wrapper inner components to be rendered in mobile or desktop mode.
* @default "mobile"
*/
displayStaticWrapperAs: 'desktop' | 'mobile';
/**
* If `true`, the view is focused during the first mount.
* @default false
*/
autoFocus?: boolean;
/**
* Callback fired when component requests to be closed.
* Can be fired when selecting (by default on `desktop` mode) or clearing a value.
* @deprecated Please avoid using as it will be removed in next major version.
*/
onClose?: () => void;
}
export interface UseStaticPickerProps<TView extends DateOrTimeViewWithMeridiem, TError, TExternalProps extends UsePickerProps<PickerValue, TView, TError, any>> extends BasePickerProps<PickerValue, TView, TError, TExternalProps>, StaticOnlyPickerProps {
/**
* Overridable component slots.
* @default {}
*/
slots?: UseStaticPickerSlots;
/**
* The props used for each component slot.
* @default {}
*/
slotProps?: UseStaticPickerSlotProps;
}
export interface UseStaticPickerParams<TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseStaticPickerProps<TView, any, TExternalProps>> extends Pick<UsePickerParameters<PickerValue, TView, TExternalProps>, 'valueManager' | 'valueType' | 'validator' | 'ref'> {
props: TExternalProps;
/**
* Steps available for the picker.
* This will be used to define the behavior of navigation actions.
* If null, the picker will not have any step navigation.
*/
steps: PickerStep[] | null;
}

View file

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