2023-01-04 13:41:19 +03:00
|
|
|
<script setup lang="ts">
|
|
|
|
const { editing } = defineProps<{
|
|
|
|
editing?: boolean
|
|
|
|
}>()
|
|
|
|
|
2023-04-12 15:35:35 +03:00
|
|
|
let { modelValue } = $defineModels<{
|
2023-01-04 13:41:19 +03:00
|
|
|
modelValue: string
|
|
|
|
}>()
|
|
|
|
|
|
|
|
const currentVisibility = $computed(() =>
|
|
|
|
statusVisibilities.find(v => v.value === modelValue) || statusVisibilities[0],
|
|
|
|
)
|
|
|
|
|
2023-03-30 22:01:24 +03:00
|
|
|
function chooseVisibility(visibility: string) {
|
2023-01-04 13:41:19 +03:00
|
|
|
modelValue = visibility
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<CommonTooltip placement="top" :content="editing ? $t(`visibility.${currentVisibility.value}`) : $t('tooltip.change_content_visibility')">
|
|
|
|
<CommonDropdown placement="bottom">
|
|
|
|
<slot :visibility="currentVisibility" />
|
|
|
|
<template #popper>
|
|
|
|
<CommonDropdownItem
|
|
|
|
v-for="visibility in statusVisibilities"
|
|
|
|
:key="visibility.value"
|
|
|
|
:icon="visibility.icon"
|
|
|
|
:text="$t(`visibility.${visibility.value}`)"
|
|
|
|
:description="$t(`visibility.${visibility.value}_desc`)"
|
|
|
|
:checked="visibility.value === modelValue"
|
|
|
|
@click="chooseVisibility(visibility.value)"
|
|
|
|
/>
|
|
|
|
</template>
|
|
|
|
</CommonDropdown>
|
|
|
|
</CommonTooltip>
|
|
|
|
</template>
|