Bug 38201: Add an InputCheckboxElement component

Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Matt Blenkinsop 2025-05-23 10:25:33 +01:00 committed by Lucas Gass
parent 47be86b5c0
commit 4c8ba970b9
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
2 changed files with 44 additions and 3 deletions

View File

@ -0,0 +1,39 @@
<template>
<input
:id="id"
type="checkbox"
v-model="model"
:placeholder="placeholder"
:required="required"
@change="changeMethod()"
/>
</template>
<script>
export default {
props: {
id: String,
modelValue: String | Boolean,
placeholder: String,
required: Boolean,
changeMethod: {
type: Function,
default: () => {},
},
},
emits: ["update:modelValue"],
computed: {
model: {
get() {
return this.modelValue;
},
set(value) {
this.$emit("update:modelValue", value);
},
},
},
name: "InputCheckboxElement",
};
</script>
<style></style>

View File

@ -34,11 +34,11 @@
/>
</template>
<template v-else-if="attr.type == 'checkbox'">
<input
type="checkbox"
<InputCheckboxElement
:id="getElementId"
type="checkbox"
v-model="resource[attr.name]"
@change="attr.onChange && attr.onChange(resource)"
:changeMethod="attr.onChange && attr.onChange.bind(this, resource)"
/>
</template>
<template v-else-if="attr.type == 'radio'">
@ -185,6 +185,7 @@
import AdditionalFieldsEntry from "./AdditionalFieldsEntry.vue";
import BaseElement from "./BaseElement.vue";
import InputElement from "./Elements/InputElement.vue";
import InputCheckboxElement from "./Elements/InputCheckboxElement.vue";
import TextareaElement from "./Elements/TextareaElement.vue";
import FormRelationshipSelect from "./FormRelationshipSelect.vue";
import ToolTip from "./ToolTip.vue";
@ -262,6 +263,7 @@ export default {
ToolTip,
AdditionalFieldsEntry,
InputElement,
InputCheckboxElement,
TextareaElement,
},
};