2020-07-27 18:22:34 +02:00
|
|
|
<template>
|
2020-10-28 16:49:43 +01:00
|
|
|
<b-input-group v-bind="$attrs">
|
|
|
|
<input-item
|
2020-08-03 19:32:53 +02:00
|
|
|
:id="id" :placeholder="placeholder"
|
2020-10-28 16:49:43 +01:00
|
|
|
:state="state" :aria-describedby="id + 'local-part-desc'"
|
|
|
|
v-model="value.localPart"
|
|
|
|
v-on="listeners"
|
2020-07-27 18:22:34 +02:00
|
|
|
/>
|
|
|
|
|
|
|
|
<b-input-group-append>
|
2020-10-28 16:49:43 +01:00
|
|
|
<b-input-group-text>{{ value.separator }}</b-input-group-text>
|
2020-07-27 18:22:34 +02:00
|
|
|
</b-input-group-append>
|
|
|
|
|
|
|
|
<b-input-group-append>
|
2020-10-28 16:49:43 +01:00
|
|
|
<select-item
|
|
|
|
v-model="value.domain"
|
|
|
|
:choices="choices"
|
|
|
|
:aria-describedby="id + 'domain-desc'"
|
2020-08-04 16:06:44 +02:00
|
|
|
/>
|
2020-07-27 18:22:34 +02:00
|
|
|
</b-input-group-append>
|
2020-10-28 16:49:43 +01:00
|
|
|
|
2020-10-30 13:58:44 +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" />
|
2020-07-27 18:22:34 +02:00
|
|
|
</b-input-group>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
2020-08-03 19:32:53 +02:00
|
|
|
name: 'AdressInputSelect',
|
2020-10-28 16:49:43 +01:00
|
|
|
|
|
|
|
inheritAttrs: false,
|
|
|
|
|
2020-07-27 18:22:34 +02:00
|
|
|
props: {
|
2020-08-04 16:06:44 +02:00
|
|
|
// `value` is actually passed thru the `v-model` directive
|
2020-10-28 16:49:43 +01:00
|
|
|
value: { type: Object, required: true },
|
|
|
|
choices: { type: Array, required: true },
|
2020-08-03 19:32:53 +02:00
|
|
|
placeholder: { type: String, default: null },
|
2020-07-27 18:22:34 +02:00
|
|
|
id: { type: String, default: null },
|
|
|
|
state: { type: null, default: null },
|
2020-10-30 13:58:44 +01:00
|
|
|
type: { type: String, default: 'email' }
|
2020-10-28 16:49:43 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
|
|
|
listeners: function () {
|
|
|
|
return Object.assign({},
|
|
|
|
// Forwards all parent events listeners
|
|
|
|
this.$listeners,
|
|
|
|
// Overwrite input behavior so this component can work with v-model
|
|
|
|
{
|
|
|
|
input: (event) => {
|
|
|
|
this.$parent.$emit('touch')
|
|
|
|
this.$emit('input', this.value)
|
|
|
|
},
|
|
|
|
|
|
|
|
blur: event => {
|
|
|
|
this.$parent.$emit('touch')
|
|
|
|
this.$emit('blur', this.value)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
)
|
|
|
|
}
|
2020-07-27 18:22:34 +02: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>
|