Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions packages/renderless/src/calendar-view/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,17 @@ export const handleMouseenter =
($event, val) => {
const tooltip = vm.$refs.tooltip
tooltip.state.referenceElm = $event.target
tooltip.state.popperElm && (tooltip.state.popperElm.style.display = 'none')
tooltip.doDestroy()

state.eventTipContent = val
state.eventTipVisible = true
setTimeout(tooltip.updatePopper, 20)
setTimeout(tooltip.show(), 20)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using setTimeout(tooltip.show(), 20) might cause unexpected behavior because tooltip.show() is executed immediately, and setTimeout will receive its return value, not the function itself. Consider passing the function reference: setTimeout(() => tooltip.show(), 20). This ensures tooltip.show() is called after the delay.

}

export const handleMouseleave =
({ state }) =>
({ vm }) =>
() => {
state.eventTipVisible = false
const tooltip = vm.$refs.tooltip
tooltip.setExpectedState(false)
tooltip.debounceClose()
}
Comment on lines +66 to 71
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fixed tooltip hover issue with improved close mechanism.

This is the core of the fix. By changing the mouse leave handler to:

  1. Access tooltip directly via vm.$refs.tooltip
  2. Set expected state to false with setExpectedState(false)
  3. Use debounceClose() to delay closing

This allows users to move their mouse from the event item onto the tooltip before it closes, fixing the "popper cant mouse enter" issue.


export const isSelectedDate =
Expand Down
3 changes: 1 addition & 2 deletions packages/renderless/src/calendar-view/vue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ const initState = ({ reactive, props, computed, api, images, modesIcon }) => {
showMonth: false,
showSelectedDateEvents: false,
multiSelect: computed(() => props.multiSelect),
eventTipVisible: false,
cascaderVisible: false,
eventTipContent: {},
activeYear: props.year,
Expand Down Expand Up @@ -287,7 +286,7 @@ const initApi = ({ vm, api, state, t, props, emit, nextTick }) => {
goPrevMonth: throttle(50, true, goPrevMonth({ state })),
goNextMonth: throttle(50, true, goNextMonth({ state })),
handleMouseenter: handleMouseenter({ vm, state }),
handleMouseleave: handleMouseleave({ state }),
handleMouseleave: handleMouseleave({ vm }),
isSelectedDate: isSelectedDate({ state }),
isStartOrEndDay: isStartOrEndDay({ state }),
getDayBgColor: getDayBgColor({ props }),
Expand Down
9 changes: 1 addition & 8 deletions packages/vue/src/calendar-view/src/mobile-first.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
<template>
<div data-tag="tiny-calendar-view" class="w-full h-auto">
<tiny-tooltip
ref="tooltip"
v-model="state.eventTipVisible"
popper-class="absolute max-w-[theme(spacing.80)]"
:manual="true"
effect="light"
placement="right"
>
<tiny-tooltip ref="tooltip" popper-class="absolute max-w-[theme(spacing.80)]" effect="light" placement="right">
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Improved tooltip interaction by removing visibility binding and manual control.

The removal of v-model="state.eventTipVisible" and :manual="true" attributes from the tooltip component allows for smoother user interaction with tooltip content. This change enables users to directly move their mouse onto the tooltip without it disappearing.

<template #content>
<div class="p-2 max-h-[80vh] overflow-auto">
<div class="px-1.5 mb-1.5 border-l-2 border-color-brand">{{ state.eventTipContent.title }}</div>
Expand Down
13 changes: 3 additions & 10 deletions packages/vue/src/calendar-view/src/pc.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
day.isLast || day.isNext
? 'is-next-or-last'
: isToday(day) || isSelectedDate(day)
? 'is-selected'
: '',
? 'is-selected'
: '',
day.disabled ? 'is-disabled' : ''
]"
>
Expand Down Expand Up @@ -212,14 +212,7 @@
</ul>
</div>
</div>
<tiny-tooltip
ref="tooltip"
v-model="state.eventTipVisible"
popper-class="tiny-calendar-view-tooltip"
:manual="true"
effect="light"
placement="right"
>
<tiny-tooltip ref="tooltip" popper-class="tiny-calendar-view-tooltip" effect="light" placement="right">
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Improved tooltip interaction by removing visibility binding and manual control.

The removal of v-model="state.eventTipVisible" and :manual="true" attributes from the tooltip component is consistent with the changes in mobile-first.vue and allows users to move their mouse onto the tooltip without it disappearing.

<template #content>
<div class="tooltip-main">
<div class="title">{{ state.eventTipContent.title }}</div>
Expand Down
Loading