1
0
Fork 0
mirror of https://gitlab.com/bramw/baserow.git synced 2025-04-09 15:17:50 +00:00
bramw_baserow/web-frontend/modules/database/components/view/grid/GridViewRowIdentifierDropdown.vue
Jonathan Adeline 4321aaea9a Replace icons
2023-09-28 13:39:41 +00:00

66 lines
1.5 KiB
Vue

<template>
<div class="grid-view__head-row-identifier">
<i
ref="contextAnchor"
class="grid-view__head-row-identifier-dropdown iconoir-numbered-list-left"
@click.prevent="toggle"
></i>
<Context
ref="context"
:overflow-scroll="true"
:max-height-if-outside-viewport="true"
>
<ul v-auto-overflow-scroll class="select__items">
<li
v-for="option in options"
:key="option"
class="select__item select__item-no-options"
:class="{ active: option === rowIdentifierTypeSelected }"
>
<a class="select__item-link" @click="setRowIdentifierTypes(option)">
<span class="select__item-name">
{{ $t(`gridViewIdentifierOptions.${option}`) }}
</span>
<i
v-if="option === rowIdentifierTypeSelected"
class="select__item-active-icon iconoir-check-circle"
></i>
</a>
</li>
</ul>
</Context>
</div>
</template>
<script>
export default {
name: 'GridViewRowIdentifierDropdown',
props: {
rowIdentifierTypeSelected: {
type: String,
required: true,
},
},
computed: {
options() {
return ['id', 'count']
},
},
methods: {
toggle() {
this.$refs.context.toggle(
this.$refs.contextAnchor,
'bottom',
'left',
10,
4
)
},
setRowIdentifierTypes(rowIdentifierType) {
this.$refs.context.hide()
this.$emit('change', rowIdentifierType)
},
},
}
</script>