1
0
mirror of https://gitlab.com/bramw/baserow.git synced 2024-11-24 16:36:46 +00:00
bramw_baserow/web-frontend/modules/database/components/row/RowEditFieldBoolean.vue
Jonathan Adeline 604cd2b6ae fix checkbox
2023-11-30 14:24:08 +00:00

35 lines
752 B
Vue

<template>
<div class="control__elements">
<div
class="field-boolean__checkbox"
:class="{ active: value, 'field-boolean__checkbox--disabled': readOnly }"
@click="toggle(value)"
>
<i class="iconoir-check check field-boolean__checkbox-icon"></i>
</div>
<div v-show="touched && !valid" class="error">
{{ error }}
</div>
</div>
</template>
<script>
import rowEditField from '@baserow/modules/database/mixins/rowEditField'
export default {
mixins: [rowEditField],
methods: {
toggle(value) {
if (this.readOnly) {
return
}
const oldValue = !!value
const newValue = !value
this.$emit('update', newValue, oldValue)
this.touch()
},
},
}
</script>