Skip to content

Commit

Permalink
TimePicer Fix tusen-ai#288
Browse files Browse the repository at this point in the history
  • Loading branch information
delowardev committed Jun 25, 2021
1 parent 4717271 commit 3f58cd4
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/time-picker/src/TimePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import {
Size,
timePickerInjectionKey
} from './interface'
import { happensIn } from 'seemly'

const timePickerProps = {
...(useTheme.props as ThemeProps<TimePickerTheme>),
Expand Down Expand Up @@ -297,6 +298,12 @@ export default defineComponent({
transitionDisabledRef.value = false
})
}
function handleTriggerClick (e: MouseEvent): void {
if (props.disabled || happensIn(e, 'clear')) return
if (!activeRef.value) {
openPanel()
}
}
function handleHourClick (hour: number): void {
if (mergedValueRef.value === null) {
doChange(getTime(setHours(startOfHour(new Date()), hour)))
Expand Down Expand Up @@ -533,6 +540,7 @@ export default defineComponent({
handleTimeInputClear,
handleFocusDetectorFocus,
handleMenuKeyDown,
handleTriggerClick,
mergedTheme: themeRef,
triggerCssVars: computed(() => {
const {
Expand Down Expand Up @@ -618,6 +626,7 @@ export default defineComponent({
onClear={this.handleTimeInputClear}
internalDeactivateOnEnter
internalForceFocus={this.active}
onClick={this.handleTriggerClick}
>
{this.showIcon
? {
Expand Down

0 comments on commit 3f58cd4

Please sign in to comment.