mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.1 KiB
46 lines
1.1 KiB
1 year ago
|
<script lang="ts" setup>
|
||
|
const props = withDefaults(
|
||
|
defineProps<{
|
||
|
trigger: Array<'click' | 'hover' | 'contextmenu'>
|
||
|
visible: boolean | undefined
|
||
|
overlayClassName?: string | undefined
|
||
|
}>(),
|
||
|
{
|
||
|
trigger: () => ['click'],
|
||
|
visible: undefined,
|
||
|
overlayClassName: undefined,
|
||
|
},
|
||
|
)
|
||
|
|
||
|
const emits = defineEmits(['update:visible'])
|
||
|
|
||
|
const trigger = toRef(props, 'trigger')
|
||
|
|
||
|
const overlayClassName = toRef(props, 'overlayClassName')
|
||
|
|
||
|
const overlayClassNameComputed = computed(() => {
|
||
|
let className = 'nc-dropdown bg-white rounded-2xl border-1 border-gray-100 shadow-md overflow-hidden'
|
||
|
if (overlayClassName.value) {
|
||
|
className += ` ${overlayClassName.value}`
|
||
|
}
|
||
|
return className
|
||
|
})
|
||
|
|
||
|
const visible = useVModel(props, 'visible', emits)
|
||
|
</script>
|
||
|
|
||
|
<template>
|
||
|
<a-dropdown
|
||
|
:visible="visible"
|
||
|
:trigger="trigger"
|
||
|
:overlay-class-name="overlayClassNameComputed"
|
||
|
@update:visible="visible !== undefined ? (visible = $event) : undefined"
|
||
|
>
|
||
|
<slot />
|
||
|
|
||
|
<template #overlay>
|
||
|
<slot name="overlay" />
|
||
|
</template>
|
||
|
</a-dropdown>
|
||
|
</template>
|