From 5846c1e2ee9f0851e902550f7e873cc703fe7cb4 Mon Sep 17 00:00:00 2001 From: Benjamin Canac Date: Fri, 14 Feb 2025 15:00:06 +0100 Subject: [PATCH] feat(ContextMenu/DropdownMenu/NavigationMenu): add `external-icon` prop Resolves #2996 --- src/runtime/components/ContextMenu.vue | 8 ++ src/runtime/components/ContextMenuContent.vue | 6 +- src/runtime/components/DropdownMenu.vue | 8 ++ .../components/DropdownMenuContent.vue | 6 +- src/runtime/components/NavigationMenu.vue | 11 +- test/components/ContextMenu.spec.ts | 10 +- test/components/DropdownMenu.spec.ts | 2 + test/components/NavigationMenu.spec.ts | 2 + .../ContextMenu-vue.spec.ts.snap | 113 +++++++++++++++++ .../__snapshots__/ContextMenu.spec.ts.snap | 117 ++++++++++++++++++ .../DropdownMenu-vue.spec.ts.snap | 76 ++++++++++++ .../__snapshots__/DropdownMenu.spec.ts.snap | 80 ++++++++++++ .../NavigationMenu-vue.spec.ts.snap | 88 +++++++++++++ .../__snapshots__/NavigationMenu.spec.ts.snap | 88 +++++++++++++ 14 files changed, 607 insertions(+), 8 deletions(-) diff --git a/src/runtime/components/ContextMenu.vue b/src/runtime/components/ContextMenu.vue index f989d1af..c0a7060c 100644 --- a/src/runtime/components/ContextMenu.vue +++ b/src/runtime/components/ContextMenu.vue @@ -51,6 +51,12 @@ export interface ContextMenuProps extends Omit { * @defaultValue appConfig.ui.icons.loading */ loadingIcon?: string + /** + * The icon displayed when the item is an external link. + * Set to `false` to hide the external icon. + * @defaultValue appConfig.ui.icons.external + */ + externalIcon?: boolean | string /** The content of the menu. */ content?: Omit /** @@ -152,6 +158,7 @@ import UContextMenuContent from './ContextMenuContent.vue' const props = withDefaults(defineProps>(), { portal: true, modal: true, + externalIcon: true, labelKey: 'label' }) const emits = defineEmits() @@ -182,6 +189,7 @@ const ui = computed(() => contextMenu({ :label-key="labelKey" :checked-icon="checkedIcon" :loading-icon="loadingIcon" + :external-icon="externalIcon" >