refactor: date
parent
53f3c6e1a5
commit
571369bb66
|
@ -1,4 +1,5 @@
|
||||||
import { inject, InjectionKey, provide, Ref } from 'vue';
|
import type { InjectionKey, Ref } from 'vue';
|
||||||
|
import { inject, provide } from 'vue';
|
||||||
import type { OnSelect, PanelMode } from './interface';
|
import type { OnSelect, PanelMode } from './interface';
|
||||||
|
|
||||||
export type ContextOperationRefProps = {
|
export type ContextOperationRefProps = {
|
||||||
|
|
|
@ -20,27 +20,19 @@ import PickerPanel from './PickerPanel';
|
||||||
import PickerTrigger from './PickerTrigger';
|
import PickerTrigger from './PickerTrigger';
|
||||||
import { formatValue, isEqual, parseValue } from './utils/dateUtil';
|
import { formatValue, isEqual, parseValue } from './utils/dateUtil';
|
||||||
import getDataOrAriaProps, { toArray } from './utils/miscUtil';
|
import getDataOrAriaProps, { toArray } from './utils/miscUtil';
|
||||||
import { ContextOperationRefProps, useProvidePanel } from './PanelContext';
|
import type { ContextOperationRefProps } from './PanelContext';
|
||||||
|
import { useProvidePanel } from './PanelContext';
|
||||||
import type { CustomFormat, PickerMode } from './interface';
|
import type { CustomFormat, PickerMode } from './interface';
|
||||||
import { getDefaultFormat, getInputSize, elementsContains } from './utils/uiUtil';
|
import { getDefaultFormat, getInputSize, elementsContains } from './utils/uiUtil';
|
||||||
import usePickerInput from './hooks/usePickerInput';
|
import usePickerInput from './hooks/usePickerInput';
|
||||||
import useTextValueMapping from './hooks/useTextValueMapping';
|
import useTextValueMapping from './hooks/useTextValueMapping';
|
||||||
import useValueTexts from './hooks/useValueTexts';
|
import useValueTexts from './hooks/useValueTexts';
|
||||||
import useHoverValue from './hooks/useHoverValue';
|
import useHoverValue from './hooks/useHoverValue';
|
||||||
import {
|
import type { CSSProperties, HtmlHTMLAttributes, Ref } from 'vue';
|
||||||
computed,
|
import { computed, createVNode, defineComponent, ref, toRef, watch } from 'vue';
|
||||||
createVNode,
|
import type { ChangeEvent, FocusEventHandler, MouseEventHandler } from '../_util/EventInterface';
|
||||||
CSSProperties,
|
import type { VueNode } from '../_util/type';
|
||||||
defineComponent,
|
import type { AlignType } from '../vc-align/interface';
|
||||||
HtmlHTMLAttributes,
|
|
||||||
ref,
|
|
||||||
Ref,
|
|
||||||
toRef,
|
|
||||||
watch,
|
|
||||||
} from 'vue';
|
|
||||||
import { ChangeEvent, FocusEventHandler, MouseEventHandler } from '../_util/EventInterface';
|
|
||||||
import { VueNode } from '../_util/type';
|
|
||||||
import { AlignType } from '../vc-align/interface';
|
|
||||||
import useMergedState from '../_util/hooks/useMergedState';
|
import useMergedState from '../_util/hooks/useMergedState';
|
||||||
import { warning } from '../vc-util/warning';
|
import { warning } from '../vc-util/warning';
|
||||||
import classNames from '../_util/classNames';
|
import classNames from '../_util/classNames';
|
||||||
|
@ -137,6 +129,7 @@ type MergedPickerProps<DateType> = {
|
||||||
function Picker<DateType>() {
|
function Picker<DateType>() {
|
||||||
return defineComponent<MergedPickerProps<DateType>>({
|
return defineComponent<MergedPickerProps<DateType>>({
|
||||||
name: 'Picker',
|
name: 'Picker',
|
||||||
|
inheritAttrs: false,
|
||||||
props: [
|
props: [
|
||||||
'prefixCls',
|
'prefixCls',
|
||||||
'id',
|
'id',
|
||||||
|
@ -181,7 +174,6 @@ function Picker<DateType>() {
|
||||||
'direction',
|
'direction',
|
||||||
'autocomplete',
|
'autocomplete',
|
||||||
] as any,
|
] as any,
|
||||||
inheritAttrs: false,
|
|
||||||
slots: [
|
slots: [
|
||||||
'suffixIcon',
|
'suffixIcon',
|
||||||
'clearIcon',
|
'clearIcon',
|
||||||
|
@ -267,7 +259,7 @@ function Picker<DateType>() {
|
||||||
onChange(
|
onChange(
|
||||||
newValue,
|
newValue,
|
||||||
newValue
|
newValue
|
||||||
? formatValue(newValue, { generateConfig, locale, format: formatList[0] })
|
? formatValue(newValue, { generateConfig, locale, format: formatList.value[0] })
|
||||||
: '',
|
: '',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -317,7 +309,7 @@ function Picker<DateType>() {
|
||||||
triggerOpen,
|
triggerOpen,
|
||||||
forwardKeyDown,
|
forwardKeyDown,
|
||||||
isClickOutside: target =>
|
isClickOutside: target =>
|
||||||
!elementsContains([panelDivRef.current, inputDivRef.current], target as HTMLElement),
|
!elementsContains([panelDivRef.value, inputDivRef.value], target as HTMLElement),
|
||||||
onSubmit: () => {
|
onSubmit: () => {
|
||||||
if (props.disabledDate && props.disabledDate(selectedValue.value)) {
|
if (props.disabledDate && props.disabledDate(selectedValue.value)) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -32,17 +32,9 @@ import { useInjectRange } from './RangeContext';
|
||||||
import getExtraFooter from './utils/getExtraFooter';
|
import getExtraFooter from './utils/getExtraFooter';
|
||||||
import getRanges from './utils/getRanges';
|
import getRanges from './utils/getRanges';
|
||||||
import { getLowerBoundTime, setDateTime, setTime } from './utils/timeUtil';
|
import { getLowerBoundTime, setDateTime, setTime } from './utils/timeUtil';
|
||||||
import { VueNode } from '../_util/type';
|
import type { VueNode } from '../_util/type';
|
||||||
import {
|
import type { HTMLAttributes } from 'vue';
|
||||||
computed,
|
import { computed, createVNode, defineComponent, ref, toRef, watch, watchEffect } from 'vue';
|
||||||
createVNode,
|
|
||||||
defineComponent,
|
|
||||||
HTMLAttributes,
|
|
||||||
ref,
|
|
||||||
toRef,
|
|
||||||
watch,
|
|
||||||
watchEffect,
|
|
||||||
} from 'vue';
|
|
||||||
import useMergedState from '../_util/hooks/useMergedState';
|
import useMergedState from '../_util/hooks/useMergedState';
|
||||||
import { warning } from '../vc-util/warning';
|
import { warning } from '../vc-util/warning';
|
||||||
import KeyCode from '../_util/KeyCode';
|
import KeyCode from '../_util/KeyCode';
|
||||||
|
@ -292,7 +284,7 @@ function PickerPanel<DateType>() {
|
||||||
const triggerSelect = (
|
const triggerSelect = (
|
||||||
date: DateType,
|
date: DateType,
|
||||||
type: 'key' | 'mouse' | 'submit',
|
type: 'key' | 'mouse' | 'submit',
|
||||||
forceTriggerSelect: boolean = false,
|
forceTriggerSelect = false,
|
||||||
) => {
|
) => {
|
||||||
const { picker, generateConfig, onSelect, onChange, disabledDate } = props;
|
const { picker, generateConfig, onSelect, onChange, disabledDate } = props;
|
||||||
if (mergedMode.value === picker || forceTriggerSelect) {
|
if (mergedMode.value === picker || forceTriggerSelect) {
|
||||||
|
@ -359,9 +351,9 @@ function PickerPanel<DateType>() {
|
||||||
generateConfig.getHour(now),
|
generateConfig.getHour(now),
|
||||||
generateConfig.getMinute(now),
|
generateConfig.getMinute(now),
|
||||||
generateConfig.getSecond(now),
|
generateConfig.getSecond(now),
|
||||||
isHourStepValid ? hourStep : 1,
|
isHourStepValid.value ? hourStep : 1,
|
||||||
isMinuteStepValid ? minuteStep : 1,
|
isMinuteStepValid.value ? minuteStep : 1,
|
||||||
isSecondStepValid ? secondStep : 1,
|
isSecondStepValid.value ? secondStep : 1,
|
||||||
);
|
);
|
||||||
const adjustedNow = setTime(
|
const adjustedNow = setTime(
|
||||||
generateConfig,
|
generateConfig,
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { CSSProperties } from '@vue/runtime-dom';
|
import type { CSSProperties } from '@vue/runtime-dom';
|
||||||
import { AlignType } from '../vc-align/interface';
|
import type { AlignType } from '../vc-align/interface';
|
||||||
import Trigger from '../vc-trigger';
|
import Trigger from '../vc-trigger';
|
||||||
import classNames from '../_util/classNames';
|
import classNames from '../_util/classNames';
|
||||||
import { VueNode } from '../_util/type';
|
import type { VueNode } from '../_util/type';
|
||||||
import useMergeProps from './hooks/useMergeProps';
|
import useMergeProps from './hooks/useMergeProps';
|
||||||
|
|
||||||
const BUILT_IN_PLACEMENTS = {
|
const BUILT_IN_PLACEMENTS = {
|
||||||
|
|
|
@ -1,14 +1,5 @@
|
||||||
import {
|
import type { InjectionKey, PropType, Ref } from 'vue';
|
||||||
defineComponent,
|
import { defineComponent, inject, provide, ref, toRef, watch } from 'vue';
|
||||||
inject,
|
|
||||||
InjectionKey,
|
|
||||||
PropType,
|
|
||||||
provide,
|
|
||||||
ref,
|
|
||||||
Ref,
|
|
||||||
toRef,
|
|
||||||
watch,
|
|
||||||
} from 'vue';
|
|
||||||
import type { NullableDateType, RangeValue } from './interface';
|
import type { NullableDateType, RangeValue } from './interface';
|
||||||
|
|
||||||
export type RangeContextProps = {
|
export type RangeContextProps = {
|
||||||
|
|
|
@ -6,7 +6,8 @@ import PickerPanel from './PickerPanel';
|
||||||
import usePickerInput from './hooks/usePickerInput';
|
import usePickerInput from './hooks/usePickerInput';
|
||||||
import getDataOrAriaProps, { toArray, getValue, updateValues } from './utils/miscUtil';
|
import getDataOrAriaProps, { toArray, getValue, updateValues } from './utils/miscUtil';
|
||||||
import { getDefaultFormat, getInputSize, elementsContains } from './utils/uiUtil';
|
import { getDefaultFormat, getInputSize, elementsContains } from './utils/uiUtil';
|
||||||
import { ContextOperationRefProps, useProvidePanel } from './PanelContext';
|
import type { ContextOperationRefProps } from './PanelContext';
|
||||||
|
import { useProvidePanel } from './PanelContext';
|
||||||
import {
|
import {
|
||||||
isEqual,
|
isEqual,
|
||||||
getClosingViewDate,
|
getClosingViewDate,
|
||||||
|
@ -27,18 +28,10 @@ import getRanges from './utils/getRanges';
|
||||||
import useRangeViewDates from './hooks/useRangeViewDates';
|
import useRangeViewDates from './hooks/useRangeViewDates';
|
||||||
import type { DateRender } from './panels/DatePanel/DateBody';
|
import type { DateRender } from './panels/DatePanel/DateBody';
|
||||||
import useHoverValue from './hooks/useHoverValue';
|
import useHoverValue from './hooks/useHoverValue';
|
||||||
import { VueNode } from '../_util/type';
|
import type { VueNode } from '../_util/type';
|
||||||
import { ChangeEvent, FocusEventHandler, MouseEventHandler } from '../_util/EventInterface';
|
import type { ChangeEvent, FocusEventHandler, MouseEventHandler } from '../_util/EventInterface';
|
||||||
import {
|
import type { HTMLAttributes } from 'vue';
|
||||||
computed,
|
import { computed, createVNode, defineComponent, ref, toRef, watch, watchEffect } from 'vue';
|
||||||
createVNode,
|
|
||||||
defineComponent,
|
|
||||||
HTMLAttributes,
|
|
||||||
ref,
|
|
||||||
toRef,
|
|
||||||
watch,
|
|
||||||
watchEffect,
|
|
||||||
} from 'vue';
|
|
||||||
import useMergedState from '../_util/hooks/useMergedState';
|
import useMergedState from '../_util/hooks/useMergedState';
|
||||||
import { warning } from '../vc-util/warning';
|
import { warning } from '../vc-util/warning';
|
||||||
import useState from '../_util/hooks/useState';
|
import useState from '../_util/hooks/useState';
|
||||||
|
@ -291,7 +284,7 @@ function RangerPicker<DateType>() {
|
||||||
postState: values => {
|
postState: values => {
|
||||||
let postValues = values;
|
let postValues = values;
|
||||||
|
|
||||||
if (mergedDisabled[0] && mergedDisabled[1]) {
|
if (mergedDisabled.value[0] && mergedDisabled.value[1]) {
|
||||||
return postValues;
|
return postValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -449,11 +442,11 @@ function RangerPicker<DateType>() {
|
||||||
|
|
||||||
const startStr =
|
const startStr =
|
||||||
values && values[0]
|
values && values[0]
|
||||||
? formatValue(values[0], { generateConfig, locale, format: formatList[0] })
|
? formatValue(values[0], { generateConfig, locale, format: formatList.value[0] })
|
||||||
: '';
|
: '';
|
||||||
const endStr =
|
const endStr =
|
||||||
values && values[1]
|
values && values[1]
|
||||||
? formatValue(values[1], { generateConfig, locale, format: formatList[0] })
|
? formatValue(values[1], { generateConfig, locale, format: formatList.value[0] })
|
||||||
: '';
|
: '';
|
||||||
|
|
||||||
if (onCalendarChange) {
|
if (onCalendarChange) {
|
||||||
|
@ -941,8 +934,8 @@ function RangerPicker<DateType>() {
|
||||||
direction,
|
direction,
|
||||||
autocomplete = 'off',
|
autocomplete = 'off',
|
||||||
} = props;
|
} = props;
|
||||||
let arrowLeft: number = 0;
|
let arrowLeft = 0;
|
||||||
let panelLeft: number = 0;
|
let panelLeft = 0;
|
||||||
if (
|
if (
|
||||||
mergedActivePickerIndex.value &&
|
mergedActivePickerIndex.value &&
|
||||||
startInputDivRef.value &&
|
startInputDivRef.value &&
|
||||||
|
@ -1094,10 +1087,10 @@ function RangerPicker<DateType>() {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
let values = mergedValue.value;
|
let values = mergedValue.value;
|
||||||
|
|
||||||
if (!mergedDisabled[0]) {
|
if (!mergedDisabled.value[0]) {
|
||||||
values = updateValues(values, null, 0);
|
values = updateValues(values, null, 0);
|
||||||
}
|
}
|
||||||
if (!mergedDisabled[1]) {
|
if (!mergedDisabled.value[1]) {
|
||||||
values = updateValues(values, null, 1);
|
values = updateValues(values, null, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1112,11 +1105,11 @@ function RangerPicker<DateType>() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const inputSharedProps = {
|
const inputSharedProps = {
|
||||||
size: getInputSize(picker, formatList[0], generateConfig),
|
size: getInputSize(picker, formatList.value[0], generateConfig),
|
||||||
};
|
};
|
||||||
|
|
||||||
let activeBarLeft: number = 0;
|
let activeBarLeft = 0;
|
||||||
let activeBarWidth: number = 0;
|
let activeBarWidth = 0;
|
||||||
if (startInputDivRef.value && endInputDivRef.value && separatorRef.value) {
|
if (startInputDivRef.value && endInputDivRef.value && separatorRef.value) {
|
||||||
if (mergedActivePickerIndex.value === 0) {
|
if (mergedActivePickerIndex.value === 0) {
|
||||||
activeBarWidth = startInputDivRef.value.offsetWidth;
|
activeBarWidth = startInputDivRef.value.offsetWidth;
|
||||||
|
|
|
@ -2,12 +2,6 @@ import Picker, { PickerProps } from './Picker';
|
||||||
import PickerPanel, { PickerPanelProps } from './PickerPanel';
|
import PickerPanel, { PickerPanelProps } from './PickerPanel';
|
||||||
import RangePicker, { RangePickerProps } from './RangePicker';
|
import RangePicker, { RangePickerProps } from './RangePicker';
|
||||||
|
|
||||||
export {
|
export { PickerPanel, RangePicker, PickerProps, PickerPanelProps, RangePickerProps };
|
||||||
PickerPanel,
|
|
||||||
RangePicker,
|
|
||||||
PickerProps,
|
|
||||||
PickerPanelProps,
|
|
||||||
RangePickerProps,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Picker;
|
export default Picker;
|
||||||
|
|
|
@ -28,20 +28,7 @@ const locale: Locale = {
|
||||||
previousCentury: 'Século anterior',
|
previousCentury: 'Século anterior',
|
||||||
nextCentury: 'Próximo século',
|
nextCentury: 'Próximo século',
|
||||||
shortWeekDays: ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb'],
|
shortWeekDays: ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb'],
|
||||||
shortMonths: [
|
shortMonths: ['Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'],
|
||||||
'Jan',
|
|
||||||
'Fev',
|
|
||||||
'Mar',
|
|
||||||
'Abr',
|
|
||||||
'Mai',
|
|
||||||
'Jun',
|
|
||||||
'Jul',
|
|
||||||
'Ago',
|
|
||||||
'Set',
|
|
||||||
'Out',
|
|
||||||
'Nov',
|
|
||||||
'Dez',
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default locale;
|
export default locale;
|
||||||
|
|
|
@ -9,7 +9,7 @@ import {
|
||||||
import type { Locale } from '../../interface';
|
import type { Locale } from '../../interface';
|
||||||
import useCellClassName from '../../hooks/useCellClassName';
|
import useCellClassName from '../../hooks/useCellClassName';
|
||||||
import PanelBody from '../PanelBody';
|
import PanelBody from '../PanelBody';
|
||||||
import { VueNode } from '../../../_util/type';
|
import type { VueNode } from '../../../_util/type';
|
||||||
import { useInjectRange } from '../../RangeContext';
|
import { useInjectRange } from '../../RangeContext';
|
||||||
import useMergeProps from '../../hooks/useMergeProps';
|
import useMergeProps from '../../hooks/useMergeProps';
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ import type { Locale } from '../../interface';
|
||||||
import type { GenerateConfig } from '../../generate';
|
import type { GenerateConfig } from '../../generate';
|
||||||
import { useInjectPanel } from '../../PanelContext';
|
import { useInjectPanel } from '../../PanelContext';
|
||||||
import { formatValue } from '../../utils/dateUtil';
|
import { formatValue } from '../../utils/dateUtil';
|
||||||
import { VueNode } from '../../../_util/type';
|
import type { VueNode } from '../../../_util/type';
|
||||||
import useMergeProps from '../../hooks/useMergeProps';
|
import useMergeProps from '../../hooks/useMergeProps';
|
||||||
|
|
||||||
export type DateHeaderProps<DateType> = {
|
export type DateHeaderProps<DateType> = {
|
||||||
|
|
|
@ -6,7 +6,6 @@ import { WEEK_DAY_COUNT } from '../../utils/dateUtil';
|
||||||
import type { KeyboardConfig } from '../../utils/uiUtil';
|
import type { KeyboardConfig } from '../../utils/uiUtil';
|
||||||
import { createKeyDownHandler } from '../../utils/uiUtil';
|
import { createKeyDownHandler } from '../../utils/uiUtil';
|
||||||
import classNames from '../../../_util/classNames';
|
import classNames from '../../../_util/classNames';
|
||||||
import { ref } from '@vue/reactivity';
|
|
||||||
import useMergeProps from '../../hooks/useMergeProps';
|
import useMergeProps from '../../hooks/useMergeProps';
|
||||||
|
|
||||||
const DATE_ROW_COUNT = 6;
|
const DATE_ROW_COUNT = 6;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { CSSProperties } from 'vue';
|
import type { CSSProperties } from 'vue';
|
||||||
import { VueNode } from '../../_util/type';
|
import type { VueNode } from '../../_util/type';
|
||||||
import useMergeProps from '../hooks/useMergeProps';
|
import useMergeProps from '../hooks/useMergeProps';
|
||||||
import { useInjectPanel } from '../PanelContext';
|
import { useInjectPanel } from '../PanelContext';
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { formatValue, isSameMonth } from '../../utils/dateUtil';
|
||||||
import { useInjectRange } from '../../RangeContext';
|
import { useInjectRange } from '../../RangeContext';
|
||||||
import useCellClassName from '../../hooks/useCellClassName';
|
import useCellClassName from '../../hooks/useCellClassName';
|
||||||
import PanelBody from '../PanelBody';
|
import PanelBody from '../PanelBody';
|
||||||
import { VueNode } from '../../../_util/type';
|
import type { VueNode } from '../../../_util/type';
|
||||||
import useMergeProps from '../../hooks/useMergeProps';
|
import useMergeProps from '../../hooks/useMergeProps';
|
||||||
|
|
||||||
export const MONTH_COL_COUNT = 3;
|
export const MONTH_COL_COUNT = 3;
|
||||||
|
|
|
@ -3,7 +3,7 @@ import type { GenerateConfig } from '../generate';
|
||||||
import { getLastDay } from '../utils/timeUtil';
|
import { getLastDay } from '../utils/timeUtil';
|
||||||
import type { PanelMode } from '../interface';
|
import type { PanelMode } from '../interface';
|
||||||
import { getCellDateDisabled } from '../utils/dateUtil';
|
import { getCellDateDisabled } from '../utils/dateUtil';
|
||||||
import { VueNode } from '../../_util/type';
|
import type { VueNode } from '../../_util/type';
|
||||||
import classNames from '../../_util/classNames';
|
import classNames from '../../_util/classNames';
|
||||||
import useMergeProps from '../hooks/useMergeProps';
|
import useMergeProps from '../hooks/useMergeProps';
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import type { GenerateConfig } from '../../generate';
|
import type { GenerateConfig } from '../../generate';
|
||||||
import type { Locale } from '../../interface';
|
import type { Locale } from '../../interface';
|
||||||
import { formatValue, isSameQuarter } from '../../utils/dateUtil';
|
import { formatValue, isSameQuarter } from '../../utils/dateUtil';
|
||||||
import RangeContext, { useInjectRange } from '../../RangeContext';
|
import { useInjectRange } from '../../RangeContext';
|
||||||
import useCellClassName from '../../hooks/useCellClassName';
|
import useCellClassName from '../../hooks/useCellClassName';
|
||||||
import PanelBody from '../PanelBody';
|
import PanelBody from '../PanelBody';
|
||||||
import useMergeProps from '../../hooks/useMergeProps';
|
import useMergeProps from '../../hooks/useMergeProps';
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { leftPad } from '../../utils/miscUtil';
|
||||||
import type { SharedTimeProps } from '.';
|
import type { SharedTimeProps } from '.';
|
||||||
import { setTime as utilSetTime } from '../../utils/timeUtil';
|
import { setTime as utilSetTime } from '../../utils/timeUtil';
|
||||||
import { cloneElement } from '../../../_util/vnode';
|
import { cloneElement } from '../../../_util/vnode';
|
||||||
import { VueNode } from '../../../_util/type';
|
import type { VueNode } from '../../../_util/type';
|
||||||
import type { Ref } from 'vue';
|
import type { Ref } from 'vue';
|
||||||
import { computed, defineComponent } from 'vue';
|
import { computed, defineComponent } from 'vue';
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ const TimeBody = defineComponent({
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
let hour = computed(() => {
|
const hour = computed(() => {
|
||||||
// Should additional logic to handle 12 hours
|
// Should additional logic to handle 12 hours
|
||||||
if (props.use12Hours) {
|
if (props.use12Hours) {
|
||||||
return originHour.value % 12;
|
return originHour.value % 12;
|
||||||
|
@ -134,7 +134,7 @@ const TimeBody = defineComponent({
|
||||||
const hours = computed(() => {
|
const hours = computed(() => {
|
||||||
if (!props.use12Hours) return rawHours.value;
|
if (!props.use12Hours) return rawHours.value;
|
||||||
return rawHours.value
|
return rawHours.value
|
||||||
.filter(isPM ? hourMeta => hourMeta.value >= 12 : hourMeta => hourMeta.value < 12)
|
.filter(isPM.value ? hourMeta => hourMeta.value >= 12 : hourMeta => hourMeta.value < 12)
|
||||||
.map(hourMeta => {
|
.map(hourMeta => {
|
||||||
const hourValue = hourMeta.value % 12;
|
const hourValue = hourMeta.value % 12;
|
||||||
const hourLabel = hourValue === 0 ? '12' : leftPad(hourValue, 2);
|
const hourLabel = hourValue === 0 ? '12' : leftPad(hourValue, 2);
|
||||||
|
@ -260,8 +260,8 @@ const TimeBody = defineComponent({
|
||||||
|
|
||||||
// 12 Hours
|
// 12 Hours
|
||||||
let PMIndex = -1;
|
let PMIndex = -1;
|
||||||
if (typeof isPM === 'boolean') {
|
if (typeof isPM.value === 'boolean') {
|
||||||
PMIndex = isPM ? 1 : 0;
|
PMIndex = isPM.value ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
addColumnNode(
|
addColumnNode(
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { VueNode } from '../../_util/type';
|
import type { VueNode } from '../../_util/type';
|
||||||
import type { Components, RangeList, Locale } from '../interface';
|
import type { Components, RangeList, Locale } from '../interface';
|
||||||
|
|
||||||
export type RangesProps = {
|
export type RangesProps = {
|
||||||
|
|
Loading…
Reference in New Issue