多维表格
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.

39 lines
1.1 KiB

<script lang="ts" setup>
import type { RoleLabels } from 'nocodb-sdk'
import { toRef } from '#imports'
const props = defineProps<{
role: keyof typeof RoleLabels
roles: (keyof typeof RoleLabels)[]
inherit?: string
onRoleChange: (role: keyof typeof RoleLabels) => void
}>()
const roleRef = toRef(props, 'role')
const inheritRef = toRef(props, 'inherit')
</script>
<template>
<NcDropdown>
<RolesBadge class="border-1" :role="roleRef" clickable :inherit="inheritRef === role" />
<template #overlay>
<div class="flex flex-col gap-[4px] p-1">
<div class="flex flex-col gap-[4px]">
<NcDropdownItem
v-for="rl in props.roles"
:key="rl"
class="cursor-pointer"
:value="rl"
:selected="rl === roleRef"
@click="props.onRoleChange(rl)"
>
<RolesBadge class="!bg-white hover:!bg-gray-100" :role="rl" :inherit="inheritRef === rl" />
</NcDropdownItem>
</div>
</div>
</template>
</NcDropdown>
</template>
<style scoped lang="scss"></style>