2022-09-20 19:59:52 +00:00
|
|
|
<template>
|
2023-11-28 07:47:40 +00:00
|
|
|
<input-wrapper
|
2023-12-01 20:24:38 +00:00
|
|
|
v-bind="inputWrapperProps"
|
2023-11-28 07:47:40 +00:00
|
|
|
>
|
|
|
|
<template #label>
|
|
|
|
<slot name="label" />
|
|
|
|
</template>
|
|
|
|
|
2023-12-01 20:24:38 +00:00
|
|
|
<textarea :id="id?id:name" v-model="compVal" :disabled="disabled?true:null"
|
2023-03-22 14:49:52 +00:00
|
|
|
:class="[theme.default.input,{ '!ring-red-500 !ring-2': hasValidation && form.errors.has(name), '!cursor-not-allowed !bg-gray-200':disabled }]"
|
2022-09-20 19:59:52 +00:00
|
|
|
class="resize-y"
|
|
|
|
:name="name" :style="inputStyle"
|
|
|
|
:placeholder="placeholder"
|
2023-02-22 16:41:37 +00:00
|
|
|
:maxlength="maxCharLimit"
|
2022-09-20 19:59:52 +00:00
|
|
|
/>
|
2023-11-28 07:47:40 +00:00
|
|
|
|
|
|
|
<template v-if="maxCharLimit && showCharLimit" #bottom_after_help>
|
|
|
|
<small :class="theme.default.help">
|
2023-12-01 20:24:38 +00:00
|
|
|
{{ charCount }}/{{ maxCharLimit }}
|
2023-02-22 16:41:37 +00:00
|
|
|
</small>
|
2023-11-28 07:47:40 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<template #error>
|
|
|
|
<slot name="error" />
|
|
|
|
</template>
|
|
|
|
</input-wrapper>
|
2022-09-20 19:59:52 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2023-11-28 07:47:40 +00:00
|
|
|
import { inputProps, useFormInput } from './useFormInput.js'
|
|
|
|
import InputWrapper from './components/InputWrapper.vue'
|
2022-09-20 19:59:52 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'TextAreaInput',
|
2023-11-28 07:47:40 +00:00
|
|
|
components: { InputWrapper },
|
|
|
|
mixins: [],
|
2023-02-22 16:41:37 +00:00
|
|
|
|
|
|
|
props: {
|
2023-11-28 07:47:40 +00:00
|
|
|
...inputProps,
|
2023-02-22 16:41:37 +00:00
|
|
|
maxCharLimit: { type: Number, required: false, default: null },
|
2023-12-01 20:24:38 +00:00
|
|
|
showCharLimit: { type: Boolean, required: false, default: false }
|
2023-02-22 16:41:37 +00:00
|
|
|
},
|
2023-11-28 07:47:40 +00:00
|
|
|
|
2023-12-01 20:24:38 +00:00
|
|
|
setup (props, context) {
|
2023-11-28 07:47:40 +00:00
|
|
|
return {
|
2023-12-01 20:24:38 +00:00
|
|
|
...useFormInput(props, context)
|
2023-11-28 07:47:40 +00:00
|
|
|
}
|
|
|
|
},
|
2023-12-01 20:24:38 +00:00
|
|
|
|
2023-02-22 16:41:37 +00:00
|
|
|
computed: {
|
2023-12-01 20:24:38 +00:00
|
|
|
charCount () {
|
2023-02-22 16:41:37 +00:00
|
|
|
return (this.compVal) ? this.compVal.length : 0
|
|
|
|
}
|
|
|
|
}
|
2022-09-20 19:59:52 +00:00
|
|
|
}
|
|
|
|
</script>
|