-
Notifications
You must be signed in to change notification settings - Fork 62
Expand file tree
/
Copy pathSettingsSelect.vue
More file actions
62 lines (53 loc) · 1.35 KB
/
SettingsSelect.vue
File metadata and controls
62 lines (53 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<!--
- SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
<script setup lang="ts">
import { computed } from 'vue'
import NcSelect from '@nextcloud/vue/dist/Components/NcSelect.js'
import SettingsFormGroup from './SettingsFormGroup.vue'
import type { NcSelectOption } from '../../composables/useNcSelectModel.ts'
const props = defineProps<{
label: string
options: NcSelectOption<unknown>[]
modelValue: NcSelectOption<unknown>
}>()
const emit = defineEmits<{
(event: 'update:modelValue', value: NcSelectOption<unknown>): void
}>()
const model = computed({
get: () => props.modelValue,
set: (value: NcSelectOption<unknown>) => emit('update:modelValue', value),
})
</script>
<script lang="ts">
export default {
inheritAttrs: false,
model: {
prop: 'modelValue',
event: 'update:modelValue',
},
}
</script>
<template>
<SettingsFormGroup :label="label">
<template #icon="{ size }">
<slot name="icon" :size="size" />
</template>
<template #default="{ inputId }">
<NcSelect v-model="model"
class="settings-select"
:options="options"
:clearable="false"
:searchable="false"
:input-id="inputId"
label-outside />
</template>
</SettingsFormGroup>
</template>
<style scoped>
.settings-select {
/* TODO: fix in upstream? */
margin: 0 !important;
}
</style>