2020-05-11 17:27:35 +00:00
|
|
|
<template>
|
2020-06-22 21:22:16 +02:00
|
|
|
<div class="control__elements">
|
2020-05-11 17:27:35 +00:00
|
|
|
<div
|
2020-06-22 21:22:16 +02:00
|
|
|
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>
|