import { Row } from '@/models/data/row' ; import useRootEmit from './useRootEmit' ; import useData from '../data/useData' ; export default ( data ) => { const { GtData } = useData ( ) ; const { IFClickRow , IFDblClickRow , IFCheckedRow } = useRootEmit ( ) ; function onChangeCheckbox ( checked , checkedList = [ ] ) { IFCheckedRow ( checked , data , [ data , ... checkedList ] ) ; } let rowRepeatClick = false ; function onClickRow ( ) { if ( rowRepeatClick ) { rowRepeatClick = false ; } else { GtData . setSelected ( { index : data ?. __uindex ?? - 1 , uuid : data ?. uuid } ) ; IFClickRow ( data ) ; rowRepeatClick = true ; window . setTimeout ( ( ) => { rowRepeatClick = false ; } , 500 ) ; } } function onDbClickRow ( ) { IFDblClickRow ( data ) ; } function onMouseEnterRow ( ) { GtData . setHovered ( { index : data ?. __uindex ?? - 1 , uuid : data ?. uuid } ) ; } function onMouseLeaveRow ( ) { GtData . setHovered ( { index : - 1 } ) ; } return { onChangeCheckbox , onClickRow , onDbClickRow , onMouseEnterRow , onMouseLeaveRow } ; } ;