Skip to content

Commit 58b943e

Browse files
authored
Merge pull request #325 from devforth/ModifyAdminforthForBulkVisionPlugin
feat: enhance ThreeDotsMenu with checkbox handling and updateList int…
2 parents 24afc33 + 82a1eac commit 58b943e

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

adminforth/spa/src/components/ThreeDotsMenu.vue

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,20 @@
1515
class="z-20 hidden bg-lightThreeDotsMenuBodyBackground divide-y divide-gray-100 rounded-lg shadow w-44 dark:bg-darkThreeDotsMenuBodyBackground dark:divide-gray-600">
1616
<ul class="py-2 text-sm text-lightThreeDotsMenuBodyText dark:text-darkThreeDotsMenuBodyText" aria-labelledby="dropdownMenuIconButton">
1717
<li v-for="item in threeDotsDropdownItems" :key="`dropdown-item-${item.label}`">
18-
<a href="#" class="block px-4 py-2 hover:bg-lightThreeDotsMenuBodyBackgroundHover hover:text-lightThreeDotsMenuBodyTextHover dark:hover:bg-darkThreeDotsMenuBodyBackgroundHover dark:hover:text-darkThreeDotsMenuBodyTextHover">
18+
<a href="#"
19+
class="block px-4 py-2 hover:bg-lightThreeDotsMenuBodyBackgroundHover hover:text-lightThreeDotsMenuBodyTextHover dark:hover:bg-darkThreeDotsMenuBodyBackgroundHover dark:hover:text-darkThreeDotsMenuBodyTextHover"
20+
:class="{
21+
'pointer-events-none': !checkboxes.length,
22+
'opacity-50': !checkboxes.length,
23+
'cursor-not-allowed': !checkboxes.length,
24+
}">
1925
<component :is="getCustomComponent(item)"
2026
:meta="item.meta"
2127
:resource="coreStore.resource"
2228
:adminUser="coreStore.adminUser"
29+
:checkboxes="checkboxes"
30+
:updateList="props.updateList"
31+
:clearCheckboxes="clearCheckboxes"
2332
/>
2433
</a>
2534
</li>
@@ -74,7 +83,13 @@ const props = defineProps({
7483
threeDotsDropdownItems: Array,
7584
customActions: Array,
7685
bulkActions: Array,
77-
checkboxes: Array
86+
checkboxes: Array,
87+
updateList: {
88+
type: Function,
89+
},
90+
clearCheckboxes: {
91+
type: Function
92+
}
7893
});
7994
8095
const emit = defineEmits(['startBulkAction']);

adminforth/spa/src/views/ListView.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@
9797
:bulkActions="coreStore.resource?.options?.bulkActions"
9898
:checkboxes="checkboxes"
9999
@startBulkAction="startBulkAction"
100+
:updateList="getList"
101+
:clearCheckboxes="clearCheckboxes"
100102
></ThreeDotsMenu>
101103
</BreadcrumbsWithButtons>
102104

@@ -247,6 +249,10 @@ async function getList() {
247249
return {}
248250
}
249251
252+
function clearCheckboxes() {
253+
checkboxes.value = [];
254+
}
255+
250256
async function refreshExistingList(pk?: any) {
251257
const currentData = rows.value;
252258
if (!currentData) {

0 commit comments

Comments
 (0)