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
240
node_modules/@mui/x-date-pickers/esm/TimePicker/TimePickerToolbar.js
generated
vendored
Normal file
240
node_modules/@mui/x-date-pickers/esm/TimePicker/TimePickerToolbar.js
generated
vendored
Normal file
|
|
@ -0,0 +1,240 @@
|
|||
'use client';
|
||||
|
||||
import _extends from "@babel/runtime/helpers/esm/extends";
|
||||
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
||||
const _excluded = ["ampm", "ampmInClock", "className", "classes"];
|
||||
import * as React from 'react';
|
||||
import clsx from 'clsx';
|
||||
import PropTypes from 'prop-types';
|
||||
import { styled, useThemeProps } from '@mui/material/styles';
|
||||
import composeClasses from '@mui/utils/composeClasses';
|
||||
import { PickersToolbarText } from "../internals/components/PickersToolbarText.js";
|
||||
import { PickersToolbarButton } from "../internals/components/PickersToolbarButton.js";
|
||||
import { PickersToolbar } from "../internals/components/PickersToolbar.js";
|
||||
import { arrayIncludes } from "../internals/utils/utils.js";
|
||||
import { usePickerAdapter, usePickerContext, usePickerTranslations } from "../hooks/index.js";
|
||||
import { useMeridiemMode } from "../internals/hooks/date-helpers-hooks.js";
|
||||
import { getTimePickerToolbarUtilityClass, timePickerToolbarClasses } from "./timePickerToolbarClasses.js";
|
||||
import { formatMeridiem } from "../internals/utils/date-utils.js";
|
||||
import { useToolbarOwnerState } from "../internals/hooks/useToolbarOwnerState.js";
|
||||
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
||||
const useUtilityClasses = (classes, ownerState) => {
|
||||
const {
|
||||
pickerOrientation,
|
||||
toolbarDirection
|
||||
} = ownerState;
|
||||
const slots = {
|
||||
root: ['root'],
|
||||
separator: ['separator'],
|
||||
hourMinuteLabel: ['hourMinuteLabel', pickerOrientation === 'landscape' && 'hourMinuteLabelLandscape', toolbarDirection === 'rtl' && 'hourMinuteLabelReverse'],
|
||||
ampmSelection: ['ampmSelection', pickerOrientation === 'landscape' && 'ampmLandscape'],
|
||||
ampmLabel: ['ampmLabel']
|
||||
};
|
||||
return composeClasses(slots, getTimePickerToolbarUtilityClass, classes);
|
||||
};
|
||||
const TimePickerToolbarRoot = styled(PickersToolbar, {
|
||||
name: 'MuiTimePickerToolbar',
|
||||
slot: 'Root'
|
||||
})({});
|
||||
const TimePickerToolbarSeparator = styled(PickersToolbarText, {
|
||||
name: 'MuiTimePickerToolbar',
|
||||
slot: 'Separator'
|
||||
})({
|
||||
outline: 0,
|
||||
margin: '0 4px 0 2px',
|
||||
cursor: 'default'
|
||||
});
|
||||
const TimePickerToolbarHourMinuteLabel = styled('div', {
|
||||
name: 'MuiTimePickerToolbar',
|
||||
slot: 'HourMinuteLabel',
|
||||
overridesResolver: (props, styles) => [{
|
||||
[`&.${timePickerToolbarClasses.hourMinuteLabelLandscape}`]: styles.hourMinuteLabelLandscape,
|
||||
[`&.${timePickerToolbarClasses.hourMinuteLabelReverse}`]: styles.hourMinuteLabelReverse
|
||||
}, styles.hourMinuteLabel]
|
||||
})({
|
||||
display: 'flex',
|
||||
justifyContent: 'flex-end',
|
||||
alignItems: 'flex-end',
|
||||
variants: [{
|
||||
props: {
|
||||
toolbarDirection: 'rtl'
|
||||
},
|
||||
style: {
|
||||
flexDirection: 'row-reverse'
|
||||
}
|
||||
}, {
|
||||
props: {
|
||||
pickerOrientation: 'landscape'
|
||||
},
|
||||
style: {
|
||||
marginTop: 'auto'
|
||||
}
|
||||
}]
|
||||
});
|
||||
const TimePickerToolbarAmPmSelection = styled('div', {
|
||||
name: 'MuiTimePickerToolbar',
|
||||
slot: 'AmPmSelection',
|
||||
overridesResolver: (props, styles) => [{
|
||||
[`.${timePickerToolbarClasses.ampmLabel}`]: styles.ampmLabel
|
||||
}, {
|
||||
[`&.${timePickerToolbarClasses.ampmLandscape}`]: styles.ampmLandscape
|
||||
}, styles.ampmSelection]
|
||||
})({
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
marginRight: 'auto',
|
||||
marginLeft: 12,
|
||||
[`& .${timePickerToolbarClasses.ampmLabel}`]: {
|
||||
fontSize: 17
|
||||
},
|
||||
variants: [{
|
||||
props: {
|
||||
pickerOrientation: 'landscape'
|
||||
},
|
||||
style: {
|
||||
margin: '4px 0 auto',
|
||||
flexDirection: 'row',
|
||||
justifyContent: 'space-around',
|
||||
flexBasis: '100%'
|
||||
}
|
||||
}]
|
||||
});
|
||||
|
||||
/**
|
||||
* Demos:
|
||||
*
|
||||
* - [TimePicker](https://mui.com/x/react-date-pickers/time-picker/)
|
||||
* - [Custom components](https://mui.com/x/react-date-pickers/custom-components/)
|
||||
*
|
||||
* API:
|
||||
*
|
||||
* - [TimePickerToolbar API](https://mui.com/x/api/date-pickers/time-picker-toolbar/)
|
||||
*/
|
||||
function TimePickerToolbar(inProps) {
|
||||
const props = useThemeProps({
|
||||
props: inProps,
|
||||
name: 'MuiTimePickerToolbar'
|
||||
});
|
||||
const {
|
||||
ampm,
|
||||
ampmInClock,
|
||||
className,
|
||||
classes: classesProp
|
||||
} = props,
|
||||
other = _objectWithoutPropertiesLoose(props, _excluded);
|
||||
const adapter = usePickerAdapter();
|
||||
const translations = usePickerTranslations();
|
||||
const ownerState = useToolbarOwnerState();
|
||||
const classes = useUtilityClasses(classesProp, ownerState);
|
||||
const {
|
||||
value,
|
||||
setValue,
|
||||
disabled,
|
||||
readOnly,
|
||||
view,
|
||||
setView,
|
||||
views
|
||||
} = usePickerContext();
|
||||
const showAmPmControl = Boolean(ampm && !ampmInClock && views.includes('hours'));
|
||||
const {
|
||||
meridiemMode,
|
||||
handleMeridiemChange
|
||||
} = useMeridiemMode(value, ampm, newValue => setValue(newValue, {
|
||||
changeImportance: 'set'
|
||||
}));
|
||||
const formatSection = format => {
|
||||
if (!adapter.isValid(value)) {
|
||||
return '--';
|
||||
}
|
||||
return adapter.format(value, format);
|
||||
};
|
||||
const separator = /*#__PURE__*/_jsx(TimePickerToolbarSeparator, {
|
||||
tabIndex: -1,
|
||||
value: ":",
|
||||
variant: "h3",
|
||||
selected: false,
|
||||
className: classes.separator
|
||||
});
|
||||
return /*#__PURE__*/_jsxs(TimePickerToolbarRoot, _extends({
|
||||
landscapeDirection: "row",
|
||||
toolbarTitle: translations.timePickerToolbarTitle,
|
||||
ownerState: ownerState,
|
||||
className: clsx(classes.root, className)
|
||||
}, other, {
|
||||
children: [/*#__PURE__*/_jsxs(TimePickerToolbarHourMinuteLabel, {
|
||||
className: classes.hourMinuteLabel,
|
||||
ownerState: ownerState,
|
||||
children: [arrayIncludes(views, 'hours') && /*#__PURE__*/_jsx(PickersToolbarButton, {
|
||||
tabIndex: -1,
|
||||
variant: "h3",
|
||||
onClick: () => setView('hours'),
|
||||
selected: view === 'hours',
|
||||
value: formatSection(ampm ? 'hours12h' : 'hours24h')
|
||||
}), arrayIncludes(views, ['hours', 'minutes']) && separator, arrayIncludes(views, 'minutes') && /*#__PURE__*/_jsx(PickersToolbarButton, {
|
||||
tabIndex: -1,
|
||||
variant: "h3",
|
||||
onClick: () => setView('minutes'),
|
||||
selected: view === 'minutes',
|
||||
value: formatSection('minutes')
|
||||
}), arrayIncludes(views, ['minutes', 'seconds']) && separator, arrayIncludes(views, 'seconds') && /*#__PURE__*/_jsx(PickersToolbarButton, {
|
||||
variant: "h3",
|
||||
onClick: () => setView('seconds'),
|
||||
selected: view === 'seconds',
|
||||
value: formatSection('seconds')
|
||||
})]
|
||||
}), showAmPmControl && /*#__PURE__*/_jsxs(TimePickerToolbarAmPmSelection, {
|
||||
className: classes.ampmSelection,
|
||||
ownerState: ownerState,
|
||||
children: [/*#__PURE__*/_jsx(PickersToolbarButton, {
|
||||
disableRipple: true,
|
||||
variant: "subtitle2",
|
||||
selected: meridiemMode === 'am',
|
||||
typographyClassName: classes.ampmLabel,
|
||||
value: formatMeridiem(adapter, 'am'),
|
||||
onClick: readOnly ? undefined : () => handleMeridiemChange('am'),
|
||||
disabled: disabled
|
||||
}), /*#__PURE__*/_jsx(PickersToolbarButton, {
|
||||
disableRipple: true,
|
||||
variant: "subtitle2",
|
||||
selected: meridiemMode === 'pm',
|
||||
typographyClassName: classes.ampmLabel,
|
||||
value: formatMeridiem(adapter, 'pm'),
|
||||
onClick: readOnly ? undefined : () => handleMeridiemChange('pm'),
|
||||
disabled: disabled
|
||||
})]
|
||||
})]
|
||||
}));
|
||||
}
|
||||
process.env.NODE_ENV !== "production" ? TimePickerToolbar.propTypes = {
|
||||
// ----------------------------- Warning --------------------------------
|
||||
// | These PropTypes are generated from the TypeScript type definitions |
|
||||
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
||||
// ----------------------------------------------------------------------
|
||||
ampm: PropTypes.bool,
|
||||
ampmInClock: PropTypes.bool,
|
||||
/**
|
||||
* 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 placeholder—it is displayed when the value is empty.
|
||||
* @default "––"
|
||||
*/
|
||||
toolbarPlaceholder: PropTypes.node
|
||||
} : void 0;
|
||||
export { TimePickerToolbar };
|
||||
Loading…
Add table
Add a link
Reference in a new issue