From 83093e28766e424d87efe7424b332799ff743e40 Mon Sep 17 00:00:00 2001 From: Fabio Date: Tue, 4 Jun 2024 12:25:42 -0400 Subject: [PATCH] FOUR-15537:Review the Hover action preview buton Tasks --- src/components/renderer/form-tasks.vue | 95 +++++++++++++++++++++++++- 1 file changed, 94 insertions(+), 1 deletion(-) diff --git a/src/components/renderer/form-tasks.vue b/src/components/renderer/form-tasks.vue index 690f3bb22..6a6662817 100755 --- a/src/components/renderer/form-tasks.vue +++ b/src/components/renderer/form-tasks.vue @@ -5,6 +5,8 @@ :data="tableData" :unread="unreadColumnName" :loading="shouldShowLoader" + @table-row-mouseover="handleRowMouseover" + @table-row-mouseleave="handleRowMouseleave" > + + +
@@ -141,7 +168,14 @@ export default { ], advancedFilter: "", tasksPreview: - (window.SharedComponents && window.SharedComponents.TasksHome) || {} + (window.SharedComponents && window.SharedComponents.TasksHome) || {}, + taskTooltip: + (window.SharedComponents && window.SharedComponents.TaskTooltip) || {}, + rowPosition: {}, + ellipsisShow: false, + isTooltipVisible: false, + disableRuleTooltip: false, + hiderTimer: null }; }, computed: { @@ -499,6 +533,65 @@ export default { .then(() => { this.fetch(); }); + }, + handleRowMouseover(row) { + debugger; + if (this.ellipsisShow) { + this.isTooltipVisible = !this.disableRuleTooltip; + this.clearHideTimer(); + return; + } + this.clearHideTimer(); + + const tableContainer = document.getElementById("table-container"); + const rectTableContainer = tableContainer.getBoundingClientRect(); + const topAdjust = rectTableContainer.top; + + let elementHeight = 28; + + this.isTooltipVisible = !this.disableRuleTooltip; + this.tooltipRowData = row; + + const rowElement = document.getElementById(`row-${row.id}`); + let yPosition = 0; + + const rect = rowElement.getBoundingClientRect(); + yPosition = rect.top + window.scrollY; + + const selectedFiltersBar = document.querySelector( + ".selected-filters-bar" + ); + const selectedFiltersBarHeight = selectedFiltersBar + ? selectedFiltersBar.offsetHeight + : 0; + + elementHeight -= selectedFiltersBarHeight; + + const rightBorderX = rect.right; + + const bottomBorderY = yPosition - topAdjust - elementHeight + 100; + + this.rowPosition = { + x: rightBorderX, + y: bottomBorderY + }; + }, + handleRowMouseleave() { + this.startHideTimer(); + }, + startHideTimer() { + this.hideTimer = setTimeout(() => { + this.hideTooltip(); + }, 500); + }, + clearHideTimer() { + clearTimeout(this.hideTimer); + }, + hideTooltip() { + if (this.ellipsisShow) { + return; + } + this.isTooltipVisible = false; } } };