gradido/admin/src/components/input/EditableGroupableLabel.vue
MateuszMichalowski a58ba48604
feat(frontend): fix postmigration fix (#3378)
* feat(frontend): migration fixes

* feat(admin): post migration fixes

* feat(admin): revert docker change

* feat(admin): update tests
2024-10-31 18:05:48 +01:00

53 lines
1.0 KiB
Vue

<template>
<BFormGroup :label="label" :label-for="idName">
<BFormInput :id="idName" :model-value="modelValue" @update:model-value="inputValue = $event" />
</BFormGroup>
</template>
<script>
export default {
name: 'EditableGroupableLabel',
props: {
modelValue: {
type: String,
required: false,
default: null,
},
label: {
type: String,
required: true,
},
idName: {
type: String,
required: true,
},
},
emits: ['update:model-value'],
data() {
return {
inputValue: this.modelValue,
originalValue: this.modelValue,
}
},
watch: {
inputValue() {
this.updateValue()
},
},
methods: {
updateValue() {
if (this.inputValue !== this.originalValue) {
if (this.$parent.valueChanged) {
this.$parent.valueChanged()
}
} else {
if (this.$parent.invalidValues) {
this.$parent.invalidValues()
}
}
this.$emit('update:model-value', this.inputValue)
},
},
}
</script>