Files
baserow/web-frontend/modules/builder/components/HorizontalAlignmentsSelector.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

70 lines
1.6 KiB
Vue

<template>
<RadioGroup
:model-value="currentValue"
:options="alignmentValues"
type="button"
@input="input"
/>
</template>
<script>
import { HORIZONTAL_ALIGNMENTS } from '@baserow/modules/builder/enums'
export default {
name: 'HorizontalAlignmentsSelector',
props: {
/**
* The model value of the component in Vue 3 style.
*/
modelValue: {
type: String,
default: undefined,
},
/**
* The model value of the component in Vue 2 style.
*/
value: {
type: String,
required: false,
default: null,
},
},
emits: ['input', 'update:modelValue'],
computed: {
// Prefer Vue 3 modelValue if provided, else fall back to Vue 2 value
currentValue() {
return this.modelValue !== undefined ? this.modelValue : this.value
},
alignmentValues() {
return [
{
title: this.$t('horizontalAlignmentSelector.alignmentLeft'),
value: HORIZONTAL_ALIGNMENTS.LEFT,
icon: 'iconoir-align-left',
},
{
title: this.$t('horizontalAlignmentSelector.alignmentCenter'),
value: HORIZONTAL_ALIGNMENTS.CENTER,
icon: 'iconoir-align-center',
},
{
title: this.$t('horizontalAlignmentSelector.alignmentRight'),
value: HORIZONTAL_ALIGNMENTS.RIGHT,
icon: 'iconoir-align-right',
},
]
},
},
methods: {
input(value) {
// Vue 3 emit
this.$emit('update:modelValue', value)
// Vue 2 emit
this.$emit('input', value)
},
},
}
</script>