21
21
'pointer-events-none': checkboxes && checkboxes.length === 0 && item.meta?.disabledWhenNoCheckboxes,
22
22
'opacity-50': checkboxes && checkboxes.length === 0 && item.meta?.disabledWhenNoCheckboxes,
23
23
'cursor-not-allowed': checkboxes && checkboxes.length === 0 && item.meta?.disabledWhenNoCheckboxes,
24
- }" >
25
- <component :is =" getCustomComponent(item)"
24
+ }"
25
+ @click =" injectedComponentClick(i)" >
26
+ <component :ref =" (el: any) => setComponentRef(el, i)" :is =" getCustomComponent(item)"
26
27
:meta =" item.meta"
27
28
:resource =" coreStore.resource"
28
29
:adminUser =" coreStore.adminUser"
@@ -75,10 +76,12 @@ import adminforth from '@/adminforth';
75
76
import { callAdminForthApi } from ' @/utils' ;
76
77
import { useRoute , useRouter } from ' vue-router' ;
77
78
import type { AdminForthComponentDeclarationFull , AdminForthBulkActionCommon , AdminForthActionInput } from ' @/types/Common.js' ;
79
+ import { ref , type ComponentPublicInstance } from ' vue' ;
78
80
79
81
const route = useRoute ();
80
82
const coreStore = useCoreStore ();
81
83
const router = useRouter ();
84
+ const threeDotsDropdownItemsRefs = ref <Array <ComponentPublicInstance | null >>([]);
82
85
83
86
const props = defineProps ({
84
87
threeDotsDropdownItems: Array < AdminForthComponentDeclarationFull > ,
@@ -95,6 +98,12 @@ const props = defineProps({
95
98
96
99
const emit = defineEmits ([' startBulkAction' ]);
97
100
101
+ function setComponentRef(el : ComponentPublicInstance | null , index : number ) {
102
+ if (el ) {
103
+ threeDotsDropdownItemsRefs .value [index ] = el ;
104
+ }
105
+ }
106
+
98
107
async function handleActionClick(action : AdminForthActionInput ) {
99
108
adminforth .list .closeThreeDotsDropdown ();
100
109
@@ -151,4 +160,11 @@ function startBulkAction(actionId: string) {
151
160
adminforth .list .closeThreeDotsDropdown ();
152
161
emit (' startBulkAction' , actionId );
153
162
}
163
+
164
+ async function injectedComponentClick(index : number ) {
165
+ const componentRef = threeDotsDropdownItemsRefs .value [index ];
166
+ if (componentRef && ' click' in componentRef ) {
167
+ (componentRef as any ).click ?.();
168
+ }
169
+ }
154
170
</script >
0 commit comments