mirror of
https://github.com/baserow/baserow.git
synced 2026-12-04 08:18:42 +00:00
* feat(builder): add click events to images, text and headings * fix(builder): allow element clicks to dismiss menus * feat(builder): add click actions to columns and containers * fix(builder): isolate nested interactive controls * feat(builder): add selection change events * test(builder): complete event fixtures for CI * fix: keep heading semantics and limit click areas on clickable builder elements --------- Co-authored-by: peter_baserow <peter@baserow.io>
80 lines
1.5 KiB
Vue
80 lines
1.5 KiB
Vue
<template>
|
|
<div class="ab-radio" data-builder-interactive @click="toggle">
|
|
<input
|
|
type="radio"
|
|
:checked="modelValue"
|
|
:required="required"
|
|
class="ab-radio__input"
|
|
:disabled="disabled"
|
|
:class="{
|
|
'ab-radio--error': error,
|
|
'ab-radio--readonly': readOnly,
|
|
}"
|
|
:aria-disabled="disabled"
|
|
/>
|
|
<label v-if="hasSlot" class="ab-radio__label">
|
|
<slot></slot>
|
|
</label>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
name: 'ABRadio',
|
|
props: {
|
|
/**
|
|
* The state of the radio.
|
|
*/
|
|
modelValue: {
|
|
type: Boolean,
|
|
required: false,
|
|
default: false,
|
|
},
|
|
/**
|
|
* Whether the radio is disabled.
|
|
*/
|
|
disabled: {
|
|
type: Boolean,
|
|
required: false,
|
|
default: false,
|
|
},
|
|
/**
|
|
* Whether the radio is required.
|
|
*/
|
|
required: {
|
|
type: Boolean,
|
|
required: false,
|
|
default: false,
|
|
},
|
|
/**
|
|
* Whether the radio is in error state.
|
|
*/
|
|
error: {
|
|
type: Boolean,
|
|
required: false,
|
|
default: false,
|
|
},
|
|
/**
|
|
* Whether the radio is readonly.
|
|
*/
|
|
readOnly: {
|
|
type: Boolean,
|
|
required: false,
|
|
default: false,
|
|
},
|
|
},
|
|
emits: ['update:modelValue'],
|
|
computed: {
|
|
hasSlot() {
|
|
return !!this.$slots.default
|
|
},
|
|
},
|
|
methods: {
|
|
toggle() {
|
|
if (this.disabled || this.readOnly) return
|
|
this.$emit('update:modelValue', !this.value)
|
|
},
|
|
},
|
|
}
|
|
</script>
|