<script setup lang="ts">
|
import type { ContextMenuItemEmits, ContextMenuItemProps } from 'radix-vue';
|
|
import { computed } from 'vue';
|
|
import { cn } from '@vben-core/shared/utils';
|
|
import { ContextMenuItem, useForwardPropsEmits } from 'radix-vue';
|
|
const props = defineProps<
|
ContextMenuItemProps & { class?: any; inset?: boolean }
|
>();
|
const emits = defineEmits<ContextMenuItemEmits>();
|
|
const delegatedProps = computed(() => {
|
const { class: _, ...delegated } = props;
|
|
return delegated;
|
});
|
|
const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
</script>
|
|
<template>
|
<ContextMenuItem
|
v-bind="forwarded"
|
:class="
|
cn(
|
'focus:bg-accent focus:text-accent-foreground relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
|
inset && 'pl-8',
|
props.class,
|
)
|
"
|
>
|
<slot></slot>
|
</ContextMenuItem>
|
</template>
|