|
|
@ -1,25 +1,25 @@ |
|
|
|
<script lang="ts" setup> |
|
|
|
<script lang="ts" setup> |
|
|
|
import { RoleColors, RoleDescriptions, RoleIcons, RoleLabels } from 'nocodb-sdk' |
|
|
|
import { RoleColors, RoleIcons, RoleLabels } from 'nocodb-sdk' |
|
|
|
import { toRef } from '#imports' |
|
|
|
import { toRef } from '#imports' |
|
|
|
|
|
|
|
|
|
|
|
const props = withDefaults( |
|
|
|
const props = withDefaults( |
|
|
|
defineProps<{ |
|
|
|
defineProps<{ |
|
|
|
role: keyof typeof RoleLabels |
|
|
|
role: keyof typeof RoleLabels |
|
|
|
description?: boolean |
|
|
|
|
|
|
|
clickable?: boolean |
|
|
|
clickable?: boolean |
|
|
|
inherit?: boolean |
|
|
|
inherit?: boolean |
|
|
|
|
|
|
|
border?: boolean |
|
|
|
}>(), |
|
|
|
}>(), |
|
|
|
{ |
|
|
|
{ |
|
|
|
description: true, |
|
|
|
|
|
|
|
clickable: false, |
|
|
|
clickable: false, |
|
|
|
inherit: false, |
|
|
|
inherit: false, |
|
|
|
|
|
|
|
border: true, |
|
|
|
}, |
|
|
|
}, |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
const roleRef = toRef(props, 'role') |
|
|
|
const roleRef = toRef(props, 'role') |
|
|
|
const descriptionRef = toRef(props, 'description') |
|
|
|
|
|
|
|
const clickableRef = toRef(props, 'clickable') |
|
|
|
const clickableRef = toRef(props, 'clickable') |
|
|
|
const inheritRef = toRef(props, 'inherit') |
|
|
|
const inheritRef = toRef(props, 'inherit') |
|
|
|
|
|
|
|
const borderRef = toRef(props, 'border') |
|
|
|
|
|
|
|
|
|
|
|
const roleProperties = computed(() => { |
|
|
|
const roleProperties = computed(() => { |
|
|
|
const role = roleRef.value |
|
|
|
const role = roleRef.value |
|
|
@ -27,13 +27,11 @@ const roleProperties = computed(() => { |
|
|
|
const color = RoleColors[role] |
|
|
|
const color = RoleColors[role] |
|
|
|
const icon = RoleIcons[role] |
|
|
|
const icon = RoleIcons[role] |
|
|
|
const label = RoleLabels[role] |
|
|
|
const label = RoleLabels[role] |
|
|
|
const descriptionText = RoleDescriptions[role] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
return { |
|
|
|
color, |
|
|
|
color, |
|
|
|
icon, |
|
|
|
icon, |
|
|
|
label, |
|
|
|
label, |
|
|
|
descriptionText, |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
@ -42,15 +40,13 @@ console.log('dummy') |
|
|
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<div |
|
|
|
<div |
|
|
|
class="flex flex-col py-[3px] px-[8px] gap-[4px] rounded-md bg-gray-50" |
|
|
|
class="flex items-center !border-0" |
|
|
|
:class="{ |
|
|
|
:class="{ |
|
|
|
'cursor-pointer hover:bg-gray-100': clickableRef, |
|
|
|
'cursor-pointer': clickableRef, |
|
|
|
'w-[350px]': descriptionRef, |
|
|
|
|
|
|
|
'w-[140px] items-center': !descriptionRef, |
|
|
|
|
|
|
|
}" |
|
|
|
}" |
|
|
|
|
|
|
|
style="width: fit-content" |
|
|
|
> |
|
|
|
> |
|
|
|
<div class="flex items-center"> |
|
|
|
<NcBadge class="!h-auto !px-[8px]" :color="roleProperties.color" :border="borderRef"> |
|
|
|
<NcBadge class="!h-auto !px-[8px]" :color="roleProperties.color"> |
|
|
|
|
|
|
|
<div |
|
|
|
<div |
|
|
|
class="badge-text flex items-center gap-[4px]" |
|
|
|
class="badge-text flex items-center gap-[4px]" |
|
|
|
:class="{ |
|
|
|
:class="{ |
|
|
@ -65,6 +61,7 @@ console.log('dummy') |
|
|
|
> |
|
|
|
> |
|
|
|
<GeneralIcon :icon="roleProperties.icon" /> |
|
|
|
<GeneralIcon :icon="roleProperties.icon" /> |
|
|
|
{{ roleProperties.label }} |
|
|
|
{{ roleProperties.label }} |
|
|
|
|
|
|
|
<GeneralIcon v-if="clickableRef" icon="arrowDown" /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</NcBadge> |
|
|
|
</NcBadge> |
|
|
|
<div class="flex-1"></div> |
|
|
|
<div class="flex-1"></div> |
|
|
@ -72,8 +69,6 @@ console.log('dummy') |
|
|
|
<div class="text-gray-400 text-xs p-1 rounded-md">Current Workspace Role</div> |
|
|
|
<div class="text-gray-400 text-xs p-1 rounded-md">Current Workspace Role</div> |
|
|
|
</a-tooltip> |
|
|
|
</a-tooltip> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div v-if="descriptionRef" class="text-gray-500">{{ roleProperties.descriptionText }}</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss"></style> |
|
|
|
<style scoped lang="scss"></style> |
|
|
|