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
84
node_modules/@mui/x-date-pickers/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.js
generated
vendored
Normal file
84
node_modules/@mui/x-date-pickers/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.js
generated
vendored
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getTimeSectionOptions = exports.getHourSectionOptions = void 0;
|
||||
const getHourSectionOptions = ({
|
||||
now,
|
||||
value,
|
||||
adapter,
|
||||
ampm,
|
||||
isDisabled,
|
||||
resolveAriaLabel,
|
||||
timeStep,
|
||||
valueOrReferenceDate
|
||||
}) => {
|
||||
const currentHours = value ? adapter.getHours(value) : null;
|
||||
const result = [];
|
||||
const isSelected = (hour, overriddenCurrentHours) => {
|
||||
const resolvedCurrentHours = overriddenCurrentHours ?? currentHours;
|
||||
if (resolvedCurrentHours === null) {
|
||||
return false;
|
||||
}
|
||||
if (ampm) {
|
||||
if (hour === 12) {
|
||||
return resolvedCurrentHours === 12 || resolvedCurrentHours === 0;
|
||||
}
|
||||
return resolvedCurrentHours === hour || resolvedCurrentHours - 12 === hour;
|
||||
}
|
||||
return resolvedCurrentHours === hour;
|
||||
};
|
||||
const isFocused = hour => {
|
||||
return isSelected(hour, adapter.getHours(valueOrReferenceDate));
|
||||
};
|
||||
const endHour = ampm ? 11 : 23;
|
||||
for (let hour = 0; hour <= endHour; hour += timeStep) {
|
||||
let label = adapter.format(adapter.setHours(now, hour), ampm ? 'hours12h' : 'hours24h');
|
||||
const ariaLabel = resolveAriaLabel(parseInt(label, 10).toString());
|
||||
label = adapter.formatNumber(label);
|
||||
result.push({
|
||||
value: hour,
|
||||
label,
|
||||
isSelected,
|
||||
isDisabled,
|
||||
isFocused,
|
||||
ariaLabel
|
||||
});
|
||||
}
|
||||
return result;
|
||||
};
|
||||
exports.getHourSectionOptions = getHourSectionOptions;
|
||||
const getTimeSectionOptions = ({
|
||||
value,
|
||||
adapter,
|
||||
isDisabled,
|
||||
timeStep,
|
||||
resolveLabel,
|
||||
resolveAriaLabel,
|
||||
hasValue = true
|
||||
}) => {
|
||||
const isSelected = timeValue => {
|
||||
if (value === null) {
|
||||
return false;
|
||||
}
|
||||
return hasValue && value === timeValue;
|
||||
};
|
||||
const isFocused = timeValue => {
|
||||
return value === timeValue;
|
||||
};
|
||||
return [...Array.from({
|
||||
length: Math.ceil(60 / timeStep)
|
||||
}, (_, index) => {
|
||||
const timeValue = timeStep * index;
|
||||
return {
|
||||
value: timeValue,
|
||||
label: adapter.formatNumber(resolveLabel(timeValue)),
|
||||
isDisabled,
|
||||
isSelected,
|
||||
isFocused,
|
||||
ariaLabel: resolveAriaLabel(timeValue.toString())
|
||||
};
|
||||
})];
|
||||
};
|
||||
exports.getTimeSectionOptions = getTimeSectionOptions;
|
||||
Loading…
Add table
Add a link
Reference in a new issue