-
Notifications
You must be signed in to change notification settings - Fork 1
/
AnText.vue
55 lines (50 loc) · 1.01 KB
/
AnText.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<template>
<textarea
:id="field_id"
v-model="field_data"
:required="field_required"
class="an-text"
@input="setTextareaHeight"
/>
</template>
<script>
import { string_autosetTextareaHeight } from '@/helpers/string.js';
import field from '@/mixins/field.js';
export default {
name: 'AnText',
mixins: [field],
mounted() {
this.setTextareaHeight();
},
methods: {
validate(value) {
this.$emit('update:field_valid', value?.replace(/^\s+/, '').length > 0);
},
setTextareaHeight() {
string_autosetTextareaHeight(this.$el, 16);
}
}
};
</script>
<style lang="scss" scoped>
.an-text {
border-color: $color-theme-darkgrey;
border-width: 1px;
border-style: solid;
border-radius: none;
width: 100%;
line-height: 1.5;
resize: none;
overflow: hidden;
@media screen {
padding: $spacer;
}
.an-checkboxes_activefields &,
.an-field__subfields &,
.an-plain-data & {
@media screen {
border: 2px solid $color-theme-lightgrey;
}
}
}
</style>