1
0
Fork 0
mirror of https://gitlab.com/bramw/baserow.git synced 2025-04-04 05:05:24 +00:00
bramw_baserow/web-frontend/modules/core/components/Dropdown.vue
2021-12-28 12:37:58 +00:00

49 lines
1.3 KiB
Vue

<template>
<div
class="dropdown"
:class="{
'dropdown--floating': !showInput,
'dropdown--disabled': disabled,
}"
>
<a v-if="showInput" class="dropdown__selected" @click="show()">
<template v-if="hasValue()">
<slot name="value">
<i
v-if="selectedIcon"
class="dropdown__selected-icon fas"
:class="'fa-' + selectedIcon"
/>
{{ selectedName }}
</slot>
</template>
<template v-else>{{ $t('action.makeChoice') }}</template>
<i class="dropdown__toggle-icon fas fa-caret-down"></i>
</a>
<div class="dropdown__items" :class="{ hidden: !open }">
<div v-if="showSearch" class="select__search">
<i class="select__search-icon fas fa-search"></i>
<input
ref="search"
v-model="query"
type="text"
class="select__search-input"
:placeholder="searchText === null ? $t('action.search') : searchText"
@keyup="search(query)"
/>
</div>
<ul ref="items" v-auto-overflow-scroll class="select__items">
<slot></slot>
</ul>
</div>
</div>
</template>
<script>
import dropdown from '@baserow/modules/core/mixins/dropdown'
export default {
name: 'Dropdown',
mixins: [dropdown],
}
</script>