Skip to content

Beautiful Open-Source Form Builder

fix: multi select width bug (#303)

Favour Olayinka8321bd38dbcf
diff --git a/client/components/forms/SelectInput.vue b/client/components/forms/SelectInput.vue
index 521f83e76..e5cf34a91 100644
--- a/client/components/forms/SelectInput.vue
+++ b/client/components/forms/SelectInput.vue
@@ -5,7 +5,6 @@
<template #label>
<slot name="label" />
</template>
-
<v-select v-model="compVal"
:data="finalOptions"
:label="label"
@@ -26,14 +25,14 @@
:help-position="helpPosition"
@update-options="updateOptions"
+ @update:model-value="updateModelValue"
>
<template #selected="{option}">
<slot name="selected" :option="option" :optionName="getOptionName(option)">
<template v-if="multiple">
<div class="flex items-center truncate mr-6">
- <span v-for="(item,index) in option" :key="item" class="truncate">
- <span v-if="index!==0">, </span>
- {{ getOptionName(item) }}
+ <span class="truncate">
+ {{ selectedValues.join(', ') }}
</span>
</div>
</template>
@@ -104,7 +103,8 @@ export default {
data () {
return {
- additionalOptions: []
+ additionalOptions: [],
+ selectedValues:[],
}
},
@@ -121,6 +121,9 @@ export default {
if (option) return option[this.displayKey]
return null
},
+ updateModelValue(newValues){
+ this.selectedValues = newValues
+ },
updateOptions (newItem) {
if (newItem) {
this.additionalOptions.push(newItem)
diff --git a/client/components/forms/components/VSelect.vue b/client/components/forms/components/VSelect.vue
index 10c6a3940..96a96caae 100644
--- a/client/components/forms/components/VSelect.vue
+++ b/client/components/forms/components/VSelect.vue
@@ -1,5 +1,5 @@
<template>
- <div class="v-select relative" ref="select">
+ <div class="v-select relative" :class="[{'w-0': multiple, 'min-w-full':multiple}]" ref="select">
<span class="inline-block w-full rounded-md">
<button type="button" aria-haspopup="listbox" aria-expanded="true" aria-labelledby="listbox-label"
class="cursor-pointer"