2023-12-09 15:47:03 +01:00
|
|
|
<template>
|
2024-10-19 11:04:47 +02:00
|
|
|
<InputWrapper v-bind="inputWrapperProps">
|
2023-12-09 15:47:03 +01:00
|
|
|
<template #label>
|
|
|
|
|
<span />
|
|
|
|
|
</template>
|
|
|
|
|
|
2024-10-19 11:04:47 +02:00
|
|
|
<div class="flex space-x-2 items-center">
|
2024-11-20 17:06:11 +01:00
|
|
|
<VCheckbox
|
|
|
|
|
:id="id ? id : name"
|
|
|
|
|
v-model="compVal"
|
|
|
|
|
:value="value"
|
|
|
|
|
:disabled="disabled ? true : null"
|
|
|
|
|
:name="name"
|
|
|
|
|
:color="color"
|
|
|
|
|
:theme="theme"
|
|
|
|
|
/>
|
|
|
|
|
<div>
|
2025-03-20 15:33:14 +01:00
|
|
|
<slot
|
|
|
|
|
v-if="helpPosition === 'above_input'"
|
|
|
|
|
name="help"
|
|
|
|
|
>
|
|
|
|
|
<InputHelp
|
|
|
|
|
:help="help"
|
|
|
|
|
:help-classes="theme.default.help"
|
|
|
|
|
>
|
|
|
|
|
<template #after-help>
|
|
|
|
|
<slot name="bottom_after_help" />
|
|
|
|
|
</template>
|
|
|
|
|
</InputHelp>
|
|
|
|
|
</slot>
|
2024-10-19 11:04:47 +02:00
|
|
|
<slot name="label">
|
|
|
|
|
<label
|
|
|
|
|
:aria-label="id ? id : name"
|
|
|
|
|
:for="id ? id : name"
|
|
|
|
|
:class="theme.default.fontSize"
|
|
|
|
|
>
|
|
|
|
|
{{ label }}
|
|
|
|
|
<span
|
|
|
|
|
v-if="required"
|
|
|
|
|
class="text-red-500 required-dot"
|
|
|
|
|
>*</span>
|
|
|
|
|
</label>
|
|
|
|
|
</slot>
|
2025-03-20 15:33:14 +01:00
|
|
|
<slot
|
|
|
|
|
v-if="helpPosition === 'below_input'"
|
|
|
|
|
name="help"
|
|
|
|
|
>
|
2024-10-19 11:04:47 +02:00
|
|
|
<InputHelp
|
|
|
|
|
:help="help"
|
|
|
|
|
:help-classes="theme.default.help"
|
|
|
|
|
>
|
|
|
|
|
<template #after-help>
|
|
|
|
|
<slot name="bottom_after_help" />
|
|
|
|
|
</template>
|
|
|
|
|
</InputHelp>
|
|
|
|
|
</slot>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2023-12-09 15:47:03 +01:00
|
|
|
|
|
|
|
|
<template #help>
|
2024-10-19 11:04:47 +02:00
|
|
|
<span class="hidden" />
|
2023-12-09 15:47:03 +01:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<template #error>
|
|
|
|
|
<slot name="error" />
|
|
|
|
|
</template>
|
2024-10-19 11:04:47 +02:00
|
|
|
</InputWrapper>
|
2023-12-09 15:47:03 +01:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2024-10-19 11:04:47 +02:00
|
|
|
import { inputProps, useFormInput } from './useFormInput.js'
|
|
|
|
|
import VCheckbox from './components/VCheckbox.vue'
|
|
|
|
|
import InputWrapper from './components/InputWrapper.vue'
|
2023-12-09 15:47:03 +01:00
|
|
|
|
|
|
|
|
export default {
|
2024-10-19 11:04:47 +02:00
|
|
|
name: 'CheckboxInput',
|
2023-12-09 15:47:03 +01:00
|
|
|
|
|
|
|
|
components: { InputWrapper, VCheckbox },
|
|
|
|
|
props: {
|
2024-04-15 19:39:03 +02:00
|
|
|
...inputProps,
|
2024-08-12 11:14:02 +02:00
|
|
|
value: { type: [Boolean, String, Number, Object], required: false },
|
2023-12-09 15:47:03 +01:00
|
|
|
},
|
|
|
|
|
|
2024-04-15 19:39:03 +02:00
|
|
|
setup(props, context) {
|
2023-12-09 15:47:03 +01:00
|
|
|
return {
|
2024-04-15 19:39:03 +02:00
|
|
|
...useFormInput(props, context),
|
2023-12-09 15:47:03 +01:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
2024-04-15 19:39:03 +02:00
|
|
|
mounted() {
|
2024-10-19 11:04:47 +02:00
|
|
|
if (!this.compVal)
|
2024-01-17 14:52:32 +01:00
|
|
|
this.compVal = false
|
2024-04-15 19:39:03 +02:00
|
|
|
},
|
2023-12-09 15:47:03 +01:00
|
|
|
}
|
|
|
|
|
</script>
|