11import classNames from '../../_util/classNames' ;
2- import { filterEmpty , flattenChildren , isValidElement } from '../../_util/props-util' ;
2+ import { filterEmpty , findDOMNode , flattenChildren , isValidElement } from '../../_util/props-util' ;
33import type { CSSProperties , VNodeArrayChildren } from 'vue' ;
4- import { Text , computed , defineComponent , isVNode } from 'vue' ;
4+ import { watch , shallowRef , Text , computed , defineComponent , isVNode } from 'vue' ;
55
66import type {
77 DataIndex ,
@@ -24,6 +24,7 @@ import { warning } from '../../vc-util/warning';
2424import type { MouseEventHandler } from '../../_util/EventInterface' ;
2525import eagerComputed from '../../_util/eagerComputed' ;
2626import { customRenderSlot } from '../../_util/vnode' ;
27+ import { addClass , removeClass } from '../../vc-util/Dom/class' ;
2728
2829/** Check if cell is in hover range */
2930function inHoverRange ( cellStartRow : number , cellRowSpan : number , startRow : number , endRow : number ) {
@@ -157,6 +158,17 @@ export default defineComponent<CellProps>({
157158 return vnode ;
158159 }
159160 } ;
161+
162+ const hoverRef = shallowRef ( null ) ;
163+ watch ( [ hovering , ( ) => props . prefixCls , hoverRef ] , ( ) => {
164+ const cellDom = findDOMNode ( hoverRef . value ) ;
165+ if ( ! cellDom ) return ;
166+ if ( hovering . value ) {
167+ addClass ( cellDom , `${ props . prefixCls } -cell-row-hover` ) ;
168+ } else {
169+ removeClass ( cellDom , `${ props . prefixCls } -cell-row-hover` ) ;
170+ }
171+ } ) ;
160172 return ( ) => {
161173 const {
162174 prefixCls,
@@ -334,7 +346,6 @@ export default defineComponent<CellProps>({
334346 [ `${ cellPrefixCls } -with-append` ] : appendNode ,
335347 [ `${ cellPrefixCls } -fix-sticky` ] :
336348 ( isFixLeft || isFixRight ) && isSticky && supportSticky . value ,
337- [ `${ cellPrefixCls } -row-hover` ] : ! cellProps && hovering . value ,
338349 } ,
339350 additionalProps . class ,
340351 cellClassName ,
@@ -347,7 +358,7 @@ export default defineComponent<CellProps>({
347358 } ;
348359
349360 return (
350- < Component { ...componentProps } >
361+ < Component { ...componentProps } ref = { hoverRef } >
351362 { appendNode }
352363 { childNode }
353364 { slots . dragHandle ?.( ) }
0 commit comments