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:
parent
47be86b5c0
commit
4c8ba970b9
|
|
@ -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>
|
||||
|
|
@ -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,
|
||||
},
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue