yunohost-admin/app/src/components/AdressInputSelect.vue

75 lines
1.7 KiB
Vue
Raw Normal View History

<template>
2024-02-24 14:33:11 +01:00
<BInputGroup v-bind="$attrs">
<InputItem
2023-03-24 21:35:31 +01:00
:id="id"
2024-03-10 19:50:13 +01:00
:modelValue="modelValue.localPart"
2023-03-24 21:35:31 +01:00
:placeholder="placeholder"
:state="state"
:aria-describedby="id + 'local-part-desc'"
2024-03-10 19:50:13 +01:00
@update:modelValue="onInput('localPart', $event)"
2023-03-24 21:35:31 +01:00
@blur="$parent.$emit('touch')"
/>
2024-02-24 14:33:11 +01:00
<BInputGroupAppend>
2024-03-10 19:50:13 +01:00
<BInputGroupText>{{ modelValue.separator }}</BInputGroupText>
2024-02-24 14:33:11 +01:00
</BInputGroupAppend>
2024-02-24 14:33:11 +01:00
<BInputGroupAppend>
<SelectItem
2024-03-10 19:50:13 +01:00
:modelValue="modelValue.domain"
2020-10-28 16:49:43 +01:00
:choices="choices"
:aria-describedby="id + 'domain-desc'"
2024-03-10 19:50:13 +01:00
@update:modelValue="onInput('domain', $event)"
2023-03-24 21:35:31 +01:00
@blur="$parent.$emit('touch')"
/>
2024-02-24 14:33:11 +01:00
</BInputGroupAppend>
2020-10-28 16:49:43 +01:00
2024-02-24 18:25:12 +01:00
<span
class="sr-only"
:id="id + 'local-part-desc'"
v-t="'address.local_part_description.' + type"
/>
<span
class="sr-only"
:id="id + 'domain-desc'"
v-t="'address.domain_description.' + type"
/>
2024-02-24 14:33:11 +01:00
</BInputGroup>
</template>
<script>
export default {
2020-08-03 19:32:53 +02:00
name: 'AdressInputSelect',
2020-10-28 16:49:43 +01:00
inheritAttrs: false,
props: {
2024-03-10 19:50:13 +01:00
modelValue: { type: Object, required: true },
2020-10-28 16:49:43 +01:00
choices: { type: Array, required: true },
2020-08-03 19:32:53 +02:00
placeholder: { type: String, default: null },
id: { type: String, default: null },
state: { type: null, default: null },
2024-02-24 18:25:12 +01:00
type: { type: String, default: 'email' },
2020-10-28 16:49:43 +01:00
},
2023-03-24 21:35:31 +01:00
methods: {
2024-03-10 19:50:13 +01:00
onInput(key, modelValue) {
this.$emit('update:modelValue', {
...this.modelValue,
[key]: modelValue,
2023-03-24 21:35:31 +01:00
})
2024-02-24 18:25:12 +01:00
},
},
}
</script>
2020-08-07 19:04:22 +02:00
<style lang="scss" scoped>
.input-group-append ~ .input-group-append {
2020-10-28 16:49:43 +01:00
flex-basis: 40%;
2020-08-07 19:04:22 +02:00
}
select {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
</style>