@@ -9,7 +9,6 @@ import { VProgressCircular } from '@/components/VProgressCircular'
9
9
10
10
// Composables
11
11
import { IconValue } from '@/composables/icons'
12
- import { useLink } from '@/composables/router'
13
12
14
13
// Utilities
15
14
import { computed , inject , ref , toRaw } from 'vue'
@@ -32,29 +31,32 @@ export const VTreeviewItem = genericComponent<VListItemSlots>()({
32
31
33
32
props : makeVTreeviewItemProps ( ) ,
34
33
35
- setup ( props , { attrs, slots, emit } ) {
36
- const link = useLink ( props , attrs )
34
+ setup ( props , { slots } ) {
35
+ const visibleIds = inject ( VTreeviewSymbol , { visibleIds : ref ( ) } ) . visibleIds
36
+
37
37
const vListItemRef = ref < VListItem > ( )
38
38
39
39
const isActivatableGroupActivator = computed ( ( ) =>
40
40
( vListItemRef . value ?. root . activatable . value ) &&
41
41
vListItemRef . value ?. isGroupActivator
42
42
)
43
-
43
+ const vListItemRefIsClickable = computed ( ( ) => (
44
+ vListItemRef . value ?. link . isClickable . value ||
45
+ ( props . value != null && ! ! vListItemRef . value ?. list )
46
+ ) )
44
47
const isClickable = computed ( ( ) =>
45
48
! props . disabled &&
46
49
props . link !== false &&
47
- ( props . link || link . isClickable . value || ( props . value != null && ! ! vListItemRef . value ?. list ) || isActivatableGroupActivator . value )
50
+ ( props . link || vListItemRefIsClickable . value || isActivatableGroupActivator . value )
48
51
)
52
+ const isFiltered = computed ( ( ) => visibleIds . value && ! visibleIds . value . has ( toRaw ( vListItemRef . value ?. id ) ) )
49
53
50
54
function activateGroupActivator ( e : MouseEvent | KeyboardEvent ) {
51
55
if ( isClickable . value && isActivatableGroupActivator . value ) {
52
56
vListItemRef . value ?. activate ( ! vListItemRef . value ?. isActivated , e )
53
57
}
54
58
}
55
59
56
- const visibleIds = inject ( VTreeviewSymbol , { visibleIds : ref ( ) } ) . visibleIds
57
-
58
60
useRender ( ( ) => {
59
61
const listItemProps = omit ( VListItem . filterProps ( props ) , [ 'onClick' ] )
60
62
const hasPrepend = slots . prepend || props . toggleIcon
@@ -68,7 +70,7 @@ export const VTreeviewItem = genericComponent<VListItemSlots>()({
68
70
'v-treeview-item' ,
69
71
{
70
72
'v-treeview-item--activatable-group-activator' : isActivatableGroupActivator . value ,
71
- 'v-treeview-item--filtered' : visibleIds . value && ! visibleIds . value . has ( toRaw ( vListItemRef . value ?. id ) ) ,
73
+ 'v-treeview-item--filtered' : isFiltered . value ,
72
74
} ,
73
75
props . class ,
74
76
] }
0 commit comments