-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move walk systemicAnswer form field into own component #248
- Loading branch information
1 parent
54adcf8
commit b136f16
Showing
4 changed files
with
121 additions
and
129 deletions.
There are no files selected for viewing
73 changes: 73 additions & 0 deletions
73
web/assets/js/components/Common/Walk/WalkSystemicAnswerField.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<script setup lang="ts"> | ||
import {computed} from "vue"; | ||
import {getViolationsFeedback} from "../../../utils"; | ||
// const props = defineProps(['modelValue', 'value']); // vue3 | ||
// const emit = defineEmits(['update:modelValue']); // vue3 | ||
const emit = defineEmits(['input']); | ||
export interface Props { | ||
value: string, | ||
label?: string, | ||
description?: string, | ||
error?: any, | ||
isLoading?: boolean | ||
disabled?: boolean | ||
} | ||
const props = withDefaults(defineProps<Props>(), { | ||
label: 'Systemische Antwort', | ||
description: '', | ||
error: false, | ||
isLoading: false, | ||
disabled: false, | ||
}); | ||
const value = computed({ | ||
get() { | ||
// return props.modelValue // vue3 | ||
return props.value | ||
}, | ||
set(value) { | ||
// emit('update:modelValue', value); // vue3 | ||
emit('input', value) | ||
} | ||
}); | ||
const errorMessages = computed(() => { | ||
if (!props.error) { | ||
return '' | ||
} | ||
return getViolationsFeedback(['systemicAnswer'], props.error); | ||
}) | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<v-textarea | ||
v-model="value" | ||
:disabled="isLoading || disabled" | ||
minlength="1" | ||
maxlength="2500" | ||
:label="label" | ||
placeholder="Systemische Antwort" | ||
data-test="systemicAnswer" | ||
rows="3" | ||
trim | ||
max-rows="15" | ||
outlined | ||
dense | ||
:hint="description" | ||
:persistent-hint="!!description" | ||
:hide-details="!description" | ||
:error-messages="errorMessages" | ||
:error="!!errorMessages?.length" | ||
/> | ||
</div> | ||
</template> | ||
|
||
<style scoped> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters