Added Statistics calculation
Statistics now show calculated values
This commit is contained in:
parent
fe87374e47
commit
fc0f69dacb
2147 changed files with 141321 additions and 39 deletions
53
node_modules/@mui/x-date-pickers/esm/internals/hooks/useField/useFieldInternalPropsWithDefaults.js
generated
vendored
Normal file
53
node_modules/@mui/x-date-pickers/esm/internals/hooks/useField/useFieldInternalPropsWithDefaults.js
generated
vendored
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
import _extends from "@babel/runtime/helpers/esm/extends";
|
||||
import * as React from 'react';
|
||||
import useForkRef from '@mui/utils/useForkRef';
|
||||
import { useNullablePickerContext } from "../useNullablePickerContext.js";
|
||||
import { useNullableFieldPrivateContext } from "../useNullableFieldPrivateContext.js";
|
||||
|
||||
/**
|
||||
* Applies the default values to the field internal props.
|
||||
* This is a temporary hook that will be removed during a follow up when `useField` will receive the internal props without the defaults.
|
||||
* It is only here to allow the migration to be done in smaller steps.
|
||||
*/
|
||||
export function useFieldInternalPropsWithDefaults(parameters) {
|
||||
const {
|
||||
manager: {
|
||||
internal_useApplyDefaultValuesToFieldInternalProps: useApplyDefaultValuesToFieldInternalProps
|
||||
},
|
||||
internalProps,
|
||||
skipContextFieldRefAssignment
|
||||
} = parameters;
|
||||
const pickerContext = useNullablePickerContext();
|
||||
const fieldPrivateContext = useNullableFieldPrivateContext();
|
||||
const handleFieldRef = useForkRef(internalProps.unstableFieldRef, skipContextFieldRefAssignment ? null : fieldPrivateContext?.fieldRef);
|
||||
const setValue = pickerContext?.setValue;
|
||||
const handleChangeFromPicker = React.useCallback((newValue, ctx) => {
|
||||
return setValue?.(newValue, {
|
||||
validationError: ctx.validationError,
|
||||
shouldClose: false
|
||||
});
|
||||
}, [setValue]);
|
||||
const internalPropsWithDefaultsFromContext = React.useMemo(() => {
|
||||
// If one of the context is null,
|
||||
// Then the field is used as a standalone component and the other context will be null as well.
|
||||
if (fieldPrivateContext != null && pickerContext != null) {
|
||||
return _extends({
|
||||
value: pickerContext.value,
|
||||
onChange: handleChangeFromPicker,
|
||||
timezone: pickerContext.timezone,
|
||||
disabled: pickerContext.disabled,
|
||||
readOnly: pickerContext.readOnly,
|
||||
autoFocus: pickerContext.autoFocus && !pickerContext.open,
|
||||
focused: pickerContext.open ? true : undefined,
|
||||
format: pickerContext.fieldFormat,
|
||||
formatDensity: fieldPrivateContext.formatDensity,
|
||||
enableAccessibleFieldDOMStructure: fieldPrivateContext.enableAccessibleFieldDOMStructure,
|
||||
selectedSections: fieldPrivateContext.selectedSections,
|
||||
onSelectedSectionsChange: fieldPrivateContext.onSelectedSectionsChange,
|
||||
unstableFieldRef: handleFieldRef
|
||||
}, internalProps);
|
||||
}
|
||||
return internalProps;
|
||||
}, [pickerContext, fieldPrivateContext, internalProps, handleChangeFromPicker, handleFieldRef]);
|
||||
return useApplyDefaultValuesToFieldInternalProps(internalPropsWithDefaultsFromContext);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue