1515
1616 <div class =" recipient-row__desc" >
1717 <span class =" recipient-row__name" >{{ recipient.display_name }}</span >
18- <NcSelect
19- class="recipient-row__preset"
20- :modelValue =" selectedPreset "
21- :clearable =" false "
22- :searchable =" false "
23- :inputLabel =" t (' Permissions' )"
24- :hideLabel =" true "
25- :options =" presetOptions "
26- :placeholder =" t (' Can…' )"
27- @update :modelValue =" onPresetChange " />
18+ <span class =" recipient-row__subtitle" >{{ currentPresetLabel }}</span >
2819 </div >
2920
30- <NcActions class="recipient-row__actions" :aria-label =" t (' Recipient actions' )" >
21+ <NcActions class="recipient-row__actions" :aria-label =" t (' Recipient actions' )" :forceMenu =" true " >
22+ <NcActionCaption :name =" t (' Permissions' )" />
23+ <NcActionButton
24+ v-for =" preset in presets "
25+ :key =" preset .value "
26+ @click =" onPresetChange (preset )" >
27+ <template #icon >
28+ <NcIconSvgWrapper v-if =" preset .value === currentPresetValue " :svg =" IconCheck " :size =" 20 " />
29+ </template >
30+ {{ preset.label }}
31+ </NcActionButton >
3132 <NcActionButton @click =" modalOpen = true " >
3233 <template #icon >
33- <NcIconSvgWrapper :svg =" IconTune " :size =" 20 " />
34+ <NcIconSvgWrapper :svg =" isCustom ? IconCheck : IconTune " :size =" 20 " />
3435 </template >
3536 {{ t('Custom permissions') }}
3637 </NcActionButton >
38+ <NcActionSeparator />
3739 <NcActionButton @click =" remove " >
3840 <template #icon >
3941 <NcIconSvgWrapper :svg =" IconDelete " :size =" 20 " />
6567
6668<script setup lang="ts">
6769import type { Share } from ' ../api/share.ts'
70+ import type { PresetOption } from ' ../composables/useRecipientPermissions.ts'
6871import type { SharingRecipient } from ' ../types/api.ts'
6972
73+ import IconCheck from ' @mdi/svg/svg/check.svg?raw'
7074import IconDelete from ' @mdi/svg/svg/delete.svg?raw'
7175import IconTune from ' @mdi/svg/svg/tune-variant.svg?raw'
7276import { computed , ref } from ' vue'
7377import NcActionButton from ' @nextcloud/vue/components/NcActionButton'
78+ import NcActionCaption from ' @nextcloud/vue/components/NcActionCaption'
7479import NcActions from ' @nextcloud/vue/components/NcActions'
80+ import NcActionSeparator from ' @nextcloud/vue/components/NcActionSeparator'
7581import NcAvatar from ' @nextcloud/vue/components/NcAvatar'
7682import NcDialog from ' @nextcloud/vue/components/NcDialog'
7783import NcIconSvgWrapper from ' @nextcloud/vue/components/NcIconSvgWrapper'
78- import NcSelect from ' @nextcloud/vue/components/NcSelect'
7984import PermissionEditor from ' ./PermissionEditor.vue'
80- import { useRecipientPermissions } from ' ../composables/useRecipientPermissions.ts'
85+ import { CUSTOM_VALUE , useRecipientPermissions } from ' ../composables/useRecipientPermissions.ts'
8186import { RECIPIENT_TYPE_USER } from ' ../constants.ts'
8287import { t } from ' ../utils/l10n.ts'
8388import { logger } from ' ../utils/logger.ts'
@@ -105,6 +110,13 @@ const {
105110 onPermissionToggle,
106111} = useRecipientPermissions (props .share , () => props .recipient )
107112
113+ const currentPresetValue = computed (() => selectedPreset .value .value )
114+ const isCustom = computed (() => currentPresetValue .value === CUSTOM_VALUE )
115+ // Preset shortcuts in the menu, excluding the "custom" sentinel.
116+ const presets = computed <PresetOption []>(() => presetOptions .value .filter ((option ) => option .value !== CUSTOM_VALUE ))
117+ // Static label shown under the recipient name.
118+ const currentPresetLabel = computed (() => isCustom .value ? t (' Custom permissions' ) : selectedPreset .value .label )
119+
108120/**
109121 * Remove this recipient from the share.
110122 */
@@ -129,21 +141,18 @@ async function remove() {
129141 flex-direction : column ;
130142 flex : 1 1 auto ;
131143 min-width : 0 ;
144+ line-height : 1.2em ;
132145 }
133146
134- & __name {
147+ & __name ,
148+ & __subtitle {
135149 overflow : hidden ;
136150 text-overflow : ellipsis ;
137151 white-space : nowrap ;
138152 }
139153
140- // Compact, borderless preset dropdown sitting under the name.
141- & __preset {
142- min-width : 0 ;
143- :deep (.vs__dropdown-toggle ) {
144- border : none ;
145- color : var (--color-text-maxcontrast );
146- }
154+ & __subtitle {
155+ color : var (--color-text-maxcontrast );
147156 }
148157
149158 & __actions {
0 commit comments