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

7
node_modules/@mui/x-date-pickers/hooks/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,7 @@
export { usePickerTranslations } from "./usePickerTranslations.js";
export { useSplitFieldProps } from "./useSplitFieldProps.js";
export { useParsedFormat } from "./useParsedFormat.js";
export { usePickerContext } from "./usePickerContext.js";
export { usePickerActionsContext } from "./usePickerActionsContext.js";
export { useIsValidValue } from "./useIsValidValue.js";
export { usePickerAdapter } from "./usePickerAdapter.js";

54
node_modules/@mui/x-date-pickers/hooks/index.js generated vendored Normal file
View file

@ -0,0 +1,54 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "useIsValidValue", {
enumerable: true,
get: function () {
return _useIsValidValue.useIsValidValue;
}
});
Object.defineProperty(exports, "useParsedFormat", {
enumerable: true,
get: function () {
return _useParsedFormat.useParsedFormat;
}
});
Object.defineProperty(exports, "usePickerActionsContext", {
enumerable: true,
get: function () {
return _usePickerActionsContext.usePickerActionsContext;
}
});
Object.defineProperty(exports, "usePickerAdapter", {
enumerable: true,
get: function () {
return _usePickerAdapter.usePickerAdapter;
}
});
Object.defineProperty(exports, "usePickerContext", {
enumerable: true,
get: function () {
return _usePickerContext.usePickerContext;
}
});
Object.defineProperty(exports, "usePickerTranslations", {
enumerable: true,
get: function () {
return _usePickerTranslations.usePickerTranslations;
}
});
Object.defineProperty(exports, "useSplitFieldProps", {
enumerable: true,
get: function () {
return _useSplitFieldProps.useSplitFieldProps;
}
});
var _usePickerTranslations = require("./usePickerTranslations");
var _useSplitFieldProps = require("./useSplitFieldProps");
var _useParsedFormat = require("./useParsedFormat");
var _usePickerContext = require("./usePickerContext");
var _usePickerActionsContext = require("./usePickerActionsContext");
var _useIsValidValue = require("./useIsValidValue");
var _usePickerAdapter = require("./usePickerAdapter");

View file

@ -0,0 +1,7 @@
import * as React from 'react';
import { PickerValidValue } from "../internals/models/index.js";
export declare const IsValidValueContext: React.Context<(value: any) => boolean>;
/**
* Returns a function to check if a value is valid according to the validation props passed to the parent Picker.
*/
export declare function useIsValidValue<TValue extends PickerValidValue>(): (value: TValue) => boolean;

View file

@ -0,0 +1,19 @@
"use strict";
'use client';
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.IsValidValueContext = void 0;
exports.useIsValidValue = useIsValidValue;
var React = _interopRequireWildcard(require("react"));
const IsValidValueContext = exports.IsValidValueContext = /*#__PURE__*/React.createContext(() => true);
/**
* Returns a function to check if a value is valid according to the validation props passed to the parent Picker.
*/
if (process.env.NODE_ENV !== "production") IsValidValueContext.displayName = "IsValidValueContext";
function useIsValidValue() {
return React.useContext(IsValidValueContext);
}

View file

@ -0,0 +1,16 @@
interface UseParsedFormatParameters {
/**
* Format to parse.
* @default the format provided by the Picker.
*/
format?: string;
}
/**
* Returns the parsed format to be rendered in the field when there is no value or in other parts of the Picker.
* This format is localized (for example `AAAA` for the year with the French locale) and cannot be parsed by your date library.
* @param {object} The parameters needed to build the placeholder.
* @param {string} params.format Format to parse.
* @returns
*/
export declare const useParsedFormat: (parameters?: UseParsedFormatParameters) => string;
export {};

View file

@ -0,0 +1,48 @@
"use strict";
'use client';
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.useParsedFormat = void 0;
var React = _interopRequireWildcard(require("react"));
var _RtlProvider = require("@mui/system/RtlProvider");
var _usePickerAdapter = require("./usePickerAdapter");
var _buildSectionsFromFormat = require("../internals/hooks/useField/buildSectionsFromFormat");
var _useField = require("../internals/hooks/useField/useField.utils");
var _usePickerTranslations = require("./usePickerTranslations");
var _useNullablePickerContext = require("../internals/hooks/useNullablePickerContext");
/**
* Returns the parsed format to be rendered in the field when there is no value or in other parts of the Picker.
* This format is localized (for example `AAAA` for the year with the French locale) and cannot be parsed by your date library.
* @param {object} The parameters needed to build the placeholder.
* @param {string} params.format Format to parse.
* @returns
*/
const useParsedFormat = (parameters = {}) => {
const pickerContext = (0, _useNullablePickerContext.useNullablePickerContext)();
const adapter = (0, _usePickerAdapter.usePickerAdapter)();
const isRtl = (0, _RtlProvider.useRtl)();
const translations = (0, _usePickerTranslations.usePickerTranslations)();
const localizedDigits = React.useMemo(() => (0, _useField.getLocalizedDigits)(adapter), [adapter]);
const {
format = pickerContext?.fieldFormat ?? adapter.formats.fullDate
} = parameters;
return React.useMemo(() => {
const sections = (0, _buildSectionsFromFormat.buildSectionsFromFormat)({
adapter,
format,
formatDensity: 'dense',
isRtl,
shouldRespectLeadingZeros: true,
localeText: translations,
localizedDigits,
date: null,
// TODO v9: Make sure we still don't reverse in `buildSectionsFromFormat` when using `useParsedFormat`.
enableAccessibleFieldDOMStructure: false
});
return sections.map(section => `${section.startSeparator}${section.placeholder}${section.endSeparator}`).join('');
}, [adapter, isRtl, translations, localizedDigits, format]);
};
exports.useParsedFormat = useParsedFormat;

View file

@ -0,0 +1,7 @@
import { PickerActionsContextValue } from "../internals/components/PickerProvider.js";
import { DateOrTimeViewWithMeridiem, PickerValidValue, PickerValue } from "../internals/models/index.js";
/**
* Returns a subset of the context passed by the Picker wrapping the current component.
* It only contains the actions and never causes a re-render of the component using it.
*/
export declare const usePickerActionsContext: <TValue extends PickerValidValue = PickerValue, TView extends DateOrTimeViewWithMeridiem = DateOrTimeViewWithMeridiem, TError = string | null>() => PickerActionsContextValue<TValue, TView, TError>;

View file

@ -0,0 +1,22 @@
"use strict";
'use client';
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.usePickerActionsContext = void 0;
var React = _interopRequireWildcard(require("react"));
var _PickerProvider = require("../internals/components/PickerProvider");
/**
* Returns a subset of the context passed by the Picker wrapping the current component.
* It only contains the actions and never causes a re-render of the component using it.
*/
const usePickerActionsContext = () => {
const value = React.useContext(_PickerProvider.PickerActionsContext);
if (value == null) {
throw new Error(['MUI X: The `usePickerActionsContext` can only be called in fields that are used as a slot of a Picker component'].join('\n'));
}
return value;
};
exports.usePickerActionsContext = usePickerActionsContext;

View file

@ -0,0 +1,7 @@
import { PickersAdapterContextValue } from "../LocalizationProvider/LocalizationProvider.js";
import { PickersLocaleText } from "../locales/utils/pickersLocaleTextApi.js";
export declare const useLocalizationContext: () => UseLocalizationContextReturnValue;
export interface UseLocalizationContextReturnValue extends Omit<PickersAdapterContextValue, 'localeText'> {
localeText: PickersLocaleText;
}
export declare const usePickerAdapter: () => import("@mui/x-date-pickers/models").MuiPickersAdapter<any>;

View file

@ -0,0 +1,29 @@
"use strict";
'use client';
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.usePickerAdapter = exports.useLocalizationContext = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var React = _interopRequireWildcard(require("react"));
var _enUS = require("../locales/enUS");
var _LocalizationProvider = require("../LocalizationProvider/LocalizationProvider");
const useLocalizationContext = () => {
const localization = React.useContext(_LocalizationProvider.PickerAdapterContext);
if (localization === null) {
throw new Error(['MUI X: Can not find the date and time pickers localization context.', 'It looks like you forgot to wrap your component in LocalizationProvider.', 'This can also happen if you are bundling multiple versions of the `@mui/x-date-pickers` package'].join('\n'));
}
if (localization.adapter === null) {
throw new Error(['MUI X: Can not find the date and time pickers adapter from its localization context.', 'It looks like you forgot to pass a `dateAdapter` to your LocalizationProvider.'].join('\n'));
}
const localeText = React.useMemo(() => (0, _extends2.default)({}, _enUS.DEFAULT_LOCALE, localization.localeText), [localization.localeText]);
return React.useMemo(() => (0, _extends2.default)({}, localization, {
localeText
}), [localization, localeText]);
};
exports.useLocalizationContext = useLocalizationContext;
const usePickerAdapter = () => useLocalizationContext().adapter;
exports.usePickerAdapter = usePickerAdapter;

View file

@ -0,0 +1,8 @@
import * as React from 'react';
import type { PickerContextValue } from "../internals/components/PickerProvider.js";
import { DateOrTimeViewWithMeridiem, PickerValidValue, PickerValue } from "../internals/models/index.js";
export declare const PickerContext: React.Context<PickerContextValue<any, any, any> | null>;
/**
* Returns the context passed by the Picker wrapping the current component.
*/
export declare const usePickerContext: <TValue extends PickerValidValue = PickerValue, TView extends DateOrTimeViewWithMeridiem = DateOrTimeViewWithMeridiem, TError = string | null>() => PickerContextValue<TValue, TView, TError>;

View file

@ -0,0 +1,23 @@
"use strict";
'use client';
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.usePickerContext = exports.PickerContext = void 0;
var React = _interopRequireWildcard(require("react"));
const PickerContext = exports.PickerContext = /*#__PURE__*/React.createContext(null);
/**
* Returns the context passed by the Picker wrapping the current component.
*/
if (process.env.NODE_ENV !== "production") PickerContext.displayName = "PickerContext";
const usePickerContext = () => {
const value = React.useContext(PickerContext);
if (value == null) {
throw new Error('MUI X: The `usePickerContext` hook can only be called inside the context of a Picker component');
}
return value;
};
exports.usePickerContext = usePickerContext;

View file

@ -0,0 +1 @@
export declare const usePickerTranslations: () => import("../index.js").PickersLocaleText;

View file

@ -0,0 +1,10 @@
"use strict";
'use client';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.usePickerTranslations = void 0;
var _usePickerAdapter = require("./usePickerAdapter");
const usePickerTranslations = () => (0, _usePickerAdapter.useLocalizationContext)().localeText;
exports.usePickerTranslations = usePickerTranslations;

View file

@ -0,0 +1,24 @@
import { DATE_TIME_VALIDATION_PROP_NAMES, DATE_VALIDATION_PROP_NAMES, TIME_VALIDATION_PROP_NAMES } from "../validation/extractValidationProps.js";
import { PickerValueType } from "../models/common.js";
declare const SHARED_FIELD_INTERNAL_PROP_NAMES: readonly ["value", "defaultValue", "referenceDate", "format", "formatDensity", "onChange", "timezone", "onError", "shouldRespectLeadingZeros", "selectedSections", "onSelectedSectionsChange", "unstableFieldRef", "unstableStartFieldRef", "unstableEndFieldRef", "enableAccessibleFieldDOMStructure", "disabled", "readOnly", "dateSeparator", "autoFocus", "focused"];
export type InternalPropNames<TValueType extends PickerValueType> = (typeof SHARED_FIELD_INTERNAL_PROP_NAMES)[number] | (TValueType extends 'date' | 'date-time' ? (typeof DATE_VALIDATION_PROP_NAMES)[number] : never) | (TValueType extends 'time' | 'date-time' ? (typeof TIME_VALIDATION_PROP_NAMES)[number] : never) | (TValueType extends 'date-time' ? (typeof DATE_TIME_VALIDATION_PROP_NAMES)[number] : never);
/**
* Split the props received by the field component into:
* - `internalProps` which are used by the various hooks called by the field component.
* - `forwardedProps` which are passed to the underlying component.
* Note that some forwarded props might be used by the hooks as well.
* For instance, hooks like `useDateField` need props like `onKeyDown` to merge the default event handler and the one provided by the application.
* @template TProps, TValueType
* @param {TProps} props The props received by the field component.
* @param {TValueType} valueType The type of the field value ('date', 'time', or 'date-time').
*/
export declare const useSplitFieldProps: <TValueType extends PickerValueType, TProps extends { [key in InternalPropNames<TValueType>]?: any }>(props: TProps, valueType: TValueType) => {
forwardedProps: Omit<TProps, InternalPropNames<TValueType>>;
internalProps: ExtractInternalProps<TValueType, TProps>;
};
/**
* Extract the internal props from the props received by the field component.
* This makes sure that the internal props not defined in the props are not present in the result.
*/
type ExtractInternalProps<TValueType extends PickerValueType, TProps extends { [key in InternalPropNames<TValueType>]?: any }> = { [K in keyof TProps]: K extends InternalPropNames<TValueType> ? TProps[K] : never };
export {};

View file

@ -0,0 +1,56 @@
"use strict";
'use client';
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.useSplitFieldProps = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var React = _interopRequireWildcard(require("react"));
var _extractValidationProps = require("../validation/extractValidationProps");
const SHARED_FIELD_INTERNAL_PROP_NAMES = ['value', 'defaultValue', 'referenceDate', 'format', 'formatDensity', 'onChange', 'timezone', 'onError', 'shouldRespectLeadingZeros', 'selectedSections', 'onSelectedSectionsChange', 'unstableFieldRef', 'unstableStartFieldRef', 'unstableEndFieldRef', 'enableAccessibleFieldDOMStructure', 'disabled', 'readOnly', 'dateSeparator', 'autoFocus', 'focused'];
/**
* Split the props received by the field component into:
* - `internalProps` which are used by the various hooks called by the field component.
* - `forwardedProps` which are passed to the underlying component.
* Note that some forwarded props might be used by the hooks as well.
* For instance, hooks like `useDateField` need props like `onKeyDown` to merge the default event handler and the one provided by the application.
* @template TProps, TValueType
* @param {TProps} props The props received by the field component.
* @param {TValueType} valueType The type of the field value ('date', 'time', or 'date-time').
*/
const useSplitFieldProps = (props, valueType) => {
return React.useMemo(() => {
const forwardedProps = (0, _extends2.default)({}, props);
const internalProps = {};
const extractProp = propName => {
if (forwardedProps.hasOwnProperty(propName)) {
// @ts-ignore
internalProps[propName] = forwardedProps[propName];
delete forwardedProps[propName];
}
};
SHARED_FIELD_INTERNAL_PROP_NAMES.forEach(extractProp);
if (valueType === 'date') {
_extractValidationProps.DATE_VALIDATION_PROP_NAMES.forEach(extractProp);
} else if (valueType === 'time') {
_extractValidationProps.TIME_VALIDATION_PROP_NAMES.forEach(extractProp);
} else if (valueType === 'date-time') {
_extractValidationProps.DATE_VALIDATION_PROP_NAMES.forEach(extractProp);
_extractValidationProps.TIME_VALIDATION_PROP_NAMES.forEach(extractProp);
_extractValidationProps.DATE_TIME_VALIDATION_PROP_NAMES.forEach(extractProp);
}
return {
forwardedProps,
internalProps
};
}, [props, valueType]);
};
/**
* Extract the internal props from the props received by the field component.
* This makes sure that the internal props not defined in the props are not present in the result.
*/
exports.useSplitFieldProps = useSplitFieldProps;