Files
baserow/web-frontend/modules/database/components/view/grid/GridViewRowAdd.vue
716d43a9a8 Nuxt 3 migration (#4342)
Update the nuxt3 version.

Co-authored-by: Jonathan Adeline <jonathan@baserow.io>
Co-authored-by: Bram Wiepjes <bramw@protonmail.com>
Co-authored-by: Cezary <cezary@baserow.io>
Co-authored-by: Tsering Paljor <tsering@baserow.io>
Co-authored-by: Przemyslaw Kukulski <przemyslaw+gh@baserow.io>
Co-authored-by: Bram <bram2w@users.noreply.github.com>
2026-01-22 10:27:19 +01:00

71 lines
1.6 KiB
Vue

<template>
<div class="grid-view__row" :style="{ width: width + 'px', height: '33px' }">
<div
class="grid-view__column"
:style="{ width: width + 'px', height: '33px' }"
>
<a
class="grid-view__add-row"
:class="{ hover: addHover }"
@mouseover="setHover(true)"
@mouseleave="setHover(false)"
@click="addRow"
@click.right.prevent="addRows"
>
<i
v-if="includeRowDetails"
class="grid-view__add-row-icon iconoir-plus"
></i>
</a>
</div>
</div>
</template>
<script>
import gridViewHelpers from '@baserow/modules/database/mixins/gridViewHelpers'
export default {
name: 'GridViewRowAdd',
mixins: [gridViewHelpers],
props: {
visibleFields: {
type: Array,
required: true,
},
includeRowDetails: {
type: Boolean,
required: true,
},
},
emits: ['add-row', 'add-rows'],
computed: {
width() {
let width = this.visibleFields.reduce(
(value, field) => this.getFieldWidth(field) + value,
0
)
if (this.includeRowDetails) {
width += this.gridViewRowDetailsWidth
}
return width
},
addHover() {
return this.$store.getters[this.storePrefix + 'view/grid/getAddRowHover']
},
},
methods: {
setHover(value) {
this.$store.dispatch(this.storePrefix + 'view/grid/setAddRowHover', value)
},
addRow(event) {
event.preventFieldCellUnselect = true
this.$emit('add-row')
},
addRows(event) {
event.preventFieldCellUnselect = true
this.$emit('add-rows', event)
},
},
}
</script>