1
0
Fork 0
mirror of https://gitlab.com/bramw/baserow.git synced 2025-05-17 14:22:02 +00:00
bramw_baserow/web-frontend/modules/database/components/row/RowEditFieldBoolean.vue

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

35 lines
752 B
Vue
Raw Permalink Normal View History

2020-05-11 17:27:35 +00:00
<template>
<div class="control__elements">
2020-05-11 17:27:35 +00:00
<div
class="field-boolean__checkbox"
2021-04-08 14:30:26 +00:00
:class="{ active: value, 'field-boolean__checkbox--disabled': readOnly }"
2020-05-11 17:27:35 +00:00
@click="toggle(value)"
>
2023-11-30 14:24:08 +00:00
<i class="iconoir-check check field-boolean__checkbox-icon"></i>
2020-05-11 17:27:35 +00:00
</div>
2021-07-11 18:02:37 +00:00
<div v-show="touched && !valid" class="error">
{{ error }}
</div>
2020-05-11 17:27:35 +00:00
</div>
</template>
<script>
import rowEditField from '@baserow/modules/database/mixins/rowEditField'
export default {
mixins: [rowEditField],
methods: {
toggle(value) {
2021-04-08 14:30:26 +00:00
if (this.readOnly) {
return
}
2020-05-11 17:27:35 +00:00
const oldValue = !!value
const newValue = !value
this.$emit('update', newValue, oldValue)
2021-07-11 18:02:37 +00:00
this.touch()
2020-05-11 17:27:35 +00:00
},
},
}
</script>