From 4eea42cc68703598719665be82876cf1c6f5a1b1 Mon Sep 17 00:00:00 2001 From: yaroslav8765 Date: Mon, 27 Oct 2025 14:35:51 +0200 Subject: [PATCH 1/5] feat: add three dots menu for the each record in listView --- adminforth/modules/configValidator.ts | 8 +- .../src/components/ListActionsThreeDots.vue | 218 ++++++++++++++++++ .../spa/src/components/ResourceListTable.vue | 117 +++++----- .../components/ResourceListTableVirtual.vue | 117 +++++----- adminforth/spa/src/views/ListView.vue | 15 +- adminforth/types/Back.ts | 4 +- adminforth/types/Common.ts | 1 + 7 files changed, 370 insertions(+), 110 deletions(-) create mode 100644 adminforth/spa/src/components/ListActionsThreeDots.vue diff --git a/adminforth/modules/configValidator.ts b/adminforth/modules/configValidator.ts index 52755beb..e9bf4091 100644 --- a/adminforth/modules/configValidator.ts +++ b/adminforth/modules/configValidator.ts @@ -37,7 +37,7 @@ export default class ConfigValidator implements IConfigValidator { private static readonly LOGIN_INJECTION_KEYS = ['underInputs', 'underLoginButton', 'panelHeader']; private static readonly GLOBAL_INJECTION_KEYS = ['userMenu', 'header', 'sidebar', 'sidebarTop', 'everyPageBottom']; - private static readonly PAGE_INJECTION_KEYS = ['beforeBreadcrumbs', 'beforeActionButtons', 'afterBreadcrumbs', 'bottom', 'threeDotsDropdownItems', 'customActionIcons']; + private static readonly PAGE_INJECTION_KEYS = ['beforeBreadcrumbs', 'beforeActionButtons', 'afterBreadcrumbs', 'bottom', 'threeDotsDropdownItems', 'customActionIcons', 'customActionIconsThreeDotsMenuItems']; constructor(private adminforth: IAdminForth, private inputConfig: AdminForthInputConfig) { this.adminforth = adminforth; @@ -404,12 +404,14 @@ export default class ConfigValidator implements IConfigValidator { } if (!action.showIn) { action.showIn = { - list: true, + listQuickIcon: true, + listThreeDotsMenu: false, showButton: false, showThreeDotsMenu: false, } } else { - action.showIn.list = action.showIn.list ?? true; + action.showIn.listQuickIcon = action.showIn.listQuickIcon ?? true; + action.showIn.listThreeDotsMenu = action.showIn.listThreeDotsMenu ?? false; action.showIn.showButton = action.showIn.showButton ?? false; action.showIn.showThreeDotsMenu = action.showIn.showThreeDotsMenu ?? false; } diff --git a/adminforth/spa/src/components/ListActionsThreeDots.vue b/adminforth/spa/src/components/ListActionsThreeDots.vue new file mode 100644 index 00000000..78856e0c --- /dev/null +++ b/adminforth/spa/src/components/ListActionsThreeDots.vue @@ -0,0 +1,218 @@ + + + \ No newline at end of file diff --git a/adminforth/spa/src/components/ResourceListTable.vue b/adminforth/spa/src/components/ResourceListTable.vue index 09ac1171..c435c30a 100644 --- a/adminforth/spa/src/components/ResourceListTable.vue +++ b/adminforth/spa/src/components/ResourceListTable.vue @@ -113,57 +113,58 @@
- - - - - - - - - - - - - - - - - - - - - + +
@@ -312,6 +323,7 @@ import { Tooltip } from '@/afcl'; import type { AdminForthResourceCommon, AdminForthResourceColumnInputCommon, AdminForthResourceColumnCommon } from '@/types/Common'; import adminforth from '@/adminforth'; import Checkbox from '@/afcl/Checkbox.vue'; +import ListActionsThreeDots from '@/components/ListActionsThreeDots.vue'; const coreStore = useCoreStore(); const { t } = useI18n(); @@ -326,6 +338,7 @@ const props = defineProps<{ noRoundings?: boolean, customActionsInjection?: any[], tableBodyStartInjection?: any[], + customActionIconsThreeDotsMenuItems?: any[] }>(); // emits, update page diff --git a/adminforth/spa/src/components/ResourceListTableVirtual.vue b/adminforth/spa/src/components/ResourceListTableVirtual.vue index 7bdd93bc..adb1a514 100644 --- a/adminforth/spa/src/components/ResourceListTableVirtual.vue +++ b/adminforth/spa/src/components/ResourceListTableVirtual.vue @@ -123,57 +123,58 @@
- - - - - - - - - - - - - - - - - - - - - + +
@@ -329,6 +340,7 @@ import { Tooltip } from '@/afcl'; import type { AdminForthResourceCommon, AdminForthResourceColumnCommon } from '@/types/Common'; import adminforth from '@/adminforth'; import Checkbox from '@/afcl/Checkbox.vue'; +import ListActionsThreeDots from '@/components/ListActionsThreeDots.vue'; const coreStore = useCoreStore(); const { t } = useI18n(); @@ -346,6 +358,7 @@ const props = defineProps<{ containerHeight?: number, itemHeight?: number, bufferSize?: number, + customActionIconsThreeDotsMenuItems?: any[] }>(); // emits, update page diff --git a/adminforth/spa/src/views/ListView.vue b/adminforth/spa/src/views/ListView.vue index 22f39a3a..27ee9fb1 100644 --- a/adminforth/spa/src/views/ListView.vue +++ b/adminforth/spa/src/views/ListView.vue @@ -119,7 +119,7 @@ :adminUser="coreStore.adminUser" /> { await init(); initThreeDotsDropdown(); initInProcess = false; + console.log('ListView initialized:', coreStore.resourceOptions?.pageInjections?.list?.customActionIconsThreeDotsMenuItems); }); onUnmounted(() => { diff --git a/adminforth/types/Back.ts b/adminforth/types/Back.ts index 61556407..145455d5 100644 --- a/adminforth/types/Back.ts +++ b/adminforth/types/Back.ts @@ -839,7 +839,8 @@ interface AdminForthInputConfigCustomization { export interface AdminForthActionInput { name: string; showIn?: { - list?: boolean, + listQuickIcon?: boolean, + listThreeDotsMenu?: boolean, showButton?: boolean, showThreeDotsMenu?: boolean, }; @@ -1334,6 +1335,7 @@ export type AllowedActions = { */ export interface ResourceOptionsInput extends Omit, 'allowedActions' | 'bulkActions'> { + moveBaseActionsOutOfThreeDotsMenu?: boolean, /** * Custom bulk actions list. Bulk actions available in list view when user selects multiple records by * using checkboxes. diff --git a/adminforth/types/Common.ts b/adminforth/types/Common.ts index 5e0dbf54..034aaec9 100644 --- a/adminforth/types/Common.ts +++ b/adminforth/types/Common.ts @@ -487,6 +487,7 @@ export interface AdminForthResourceInputCommon { bottom?: AdminForthComponentDeclaration | Array, threeDotsDropdownItems?: AdminForthComponentDeclaration | Array, customActionIcons?: AdminForthComponentDeclaration | Array, + customActionIconsThreeDotsMenuItems?: AdminForthComponentDeclaration | Array, tableBodyStart?: AdminForthComponentDeclaration | Array, }, From 64f181014e198e3b389b2687bcb0dca9b5297a4c Mon Sep 17 00:00:00 2001 From: yaroslav8765 Date: Mon, 27 Oct 2025 14:53:19 +0200 Subject: [PATCH 2/5] chore: remove console log from ListView initialization --- adminforth/spa/src/views/ListView.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/adminforth/spa/src/views/ListView.vue b/adminforth/spa/src/views/ListView.vue index 27ee9fb1..f560374d 100644 --- a/adminforth/spa/src/views/ListView.vue +++ b/adminforth/spa/src/views/ListView.vue @@ -521,7 +521,6 @@ onMounted(async () => { await init(); initThreeDotsDropdown(); initInProcess = false; - console.log('ListView initialized:', coreStore.resourceOptions?.pageInjections?.list?.customActionIconsThreeDotsMenuItems); }); onUnmounted(() => { From 2fc9a839b55a964bda8f168d689fb3cbdaeb9866 Mon Sep 17 00:00:00 2001 From: yaroslav8765 Date: Mon, 27 Oct 2025 14:53:28 +0200 Subject: [PATCH 3/5] fix: handle potential null resourceOptions in actions filter --- adminforth/spa/src/components/ListActionsThreeDots.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adminforth/spa/src/components/ListActionsThreeDots.vue b/adminforth/spa/src/components/ListActionsThreeDots.vue index 78856e0c..abf17051 100644 --- a/adminforth/spa/src/components/ListActionsThreeDots.vue +++ b/adminforth/spa/src/components/ListActionsThreeDots.vue @@ -55,7 +55,7 @@ Delete item -
+