Skip to content

Commit a87cad1

Browse files
gaaftmorehouse
authored andcommitted
feat(table): Add row-unhovered event (#1874)
* feat(table): Add row-unhovered event Some users might want to know not only when the mouse is hovering a row, but also when the mouse leaves the row. For example for dynamically showing (and hiding) some row content based on mouse hovering. * Make function name match event
1 parent 1eced46 commit a87cad1

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

src/components/table/package.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,24 @@
7777
}
7878
]
7979
},
80+
{
81+
"event": "row-unhovered",
82+
"description": "Emitted when a row is unhovered.",
83+
"args": [
84+
{
85+
"arg": "item",
86+
"description": "Item data of the row being unhovered."
87+
},
88+
{
89+
"arg": "index",
90+
"description": "Index of the row being unhovered."
91+
},
92+
{
93+
"arg": "event",
94+
"description": "Native event object."
95+
}
96+
]
97+
},
8098
{
8199
"event": "head-clicked",
82100
"description": "Emitted when a header or footer cell is clicked.",

src/components/table/table.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,9 @@ export default {
274274
},
275275
mouseenter: evt => {
276276
this.rowHovered(evt, item, rowIndex)
277+
},
278+
mouseleave: evt => {
279+
this.rowUnhovered(evt, item, rowIndex)
277280
}
278281
}
279282
},
@@ -946,6 +949,13 @@ export default {
946949
}
947950
this.$emit('row-hovered', item, index, e)
948951
},
952+
rowUnhovered (e, item, index) {
953+
if (this.stopIfBusy(e)) {
954+
// If table is busy (via provider) then don't propagate
955+
return
956+
}
957+
this.$emit('row-unhovered', item, index, e)
958+
},
949959
rowContextmenu (e, item, index) {
950960
if (this.stopIfBusy(e)) {
951961
// If table is busy (via provider) then don't propagate

0 commit comments

Comments
 (0)