zhangwencui
7 天以前 f35825c1922149df154e3913d6dfebee57ee8cee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<script setup lang="ts">
import type { ContextMenuSubTriggerProps } from 'reka-ui';
 
import type { HTMLAttributes } from 'vue';
 
import { cn } from '../../../../../base/shared/src/utils';
 
import { ChevronRight } from '@lucide/vue';
import { reactiveOmit } from '@vueuse/core';
import { ContextMenuSubTrigger, useForwardProps } from 'reka-ui';
 
const props = defineProps<
  ContextMenuSubTriggerProps & {
    class?: HTMLAttributes['class'];
    inset?: boolean;
  }
>();
 
const delegatedProps = reactiveOmit(props, 'class');
 
const forwardedProps = useForwardProps(delegatedProps);
</script>
 
<template>
  <ContextMenuSubTrigger
    data-slot="context-menu-sub-trigger"
    :data-inset="inset ? '' : undefined"
    v-bind="forwardedProps"
    :class="
      cn(
        'focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=\'size-\'])]:size-4',
        props.class,
      )
    "
  >
    <slot></slot>
    <ChevronRight class="ml-auto size-4" />
  </ContextMenuSubTrigger>
</template>