Skip to content
This repository was archived by the owner on Jun 27, 2023. It is now read-only.

Commit 1829005

Browse files
committed
Fix textarea issues
1 parent 3287610 commit 1829005

File tree

4 files changed

+28
-4
lines changed

4 files changed

+28
-4
lines changed

dev/App.vue

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import {
4848
required,
4949
email,
5050
pattern,
51+
maxLength,
5152
/* } from '../dist/as-dynamic-forms.common'; */
5253
} from '../src/main';
5354
@@ -94,8 +95,16 @@ const data = () => ({
9495
label: 'Bio',
9596
name: 'bio',
9697
cols: 30,
97-
rows: 5,
98+
rows: 10,
9899
customClass: 'col-12',
100+
value:
101+
'Prism whatever occupy, stumptown polaroid butcher activated charcoal seitan cornhole direct trade coloring book offal sriracha. 8-bit pitchfork kitsch crucifix chartreuse, tumblr adaptogen brunch stumptown. Drinking vinegar yuccie echo park lo-fi, poutine unicorn raclette adaptogen kale chips chia. Deep v austin fam organic kickstarter hexagon hell of wolf pour-over YOLO. 8-bit glossier lyft authentic, selfies aesthetic kinfolk prism tattooed irony quinoa distillery pug slow-carb post-ironic.',
102+
validations: [
103+
new FormValidation(
104+
maxLength(100),
105+
`This field should be less than 100 characters`,
106+
),
107+
],
99108
}),
100109
new FormField({
101110
type: 'select',

src/components/input-textarea/InputTextarea.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
class="form-control"
77
:cols="formControl.cols"
88
:rows="formControl.rows"
9+
@change="valueChange()"
10+
@focus="onFocus()"
11+
@blur="onBlur()"
912
></textarea>
1013
</template>
1114
<script src="./InputTextarea.js"></script>

src/core/utils/form-control.model.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ export function FormControl({
77
customClass = null,
88
options = [],
99
placeholder = null,
10+
rows = null,
11+
cols = null,
1012
errors = {},
1113
valid = true,
1214
touched = false,
@@ -24,6 +26,8 @@ export function FormControl({
2426
this.valid = valid;
2527
this.touched = touched;
2628
this.dirty = dirty;
29+
this.rows = rows;
30+
this.cols = cols;
2731
}
2832

2933
export function FormField({
@@ -37,6 +41,8 @@ export function FormField({
3741
options = [],
3842
placeholder = null,
3943
inline = false,
44+
rows = null,
45+
cols = null,
4046
}) {
4147
this.type = type;
4248
this.value = value;
@@ -48,6 +54,8 @@ export function FormField({
4854
this.options = options;
4955
this.placeholder = placeholder;
5056
this.inline = inline;
57+
this.rows = rows;
58+
this.cols = cols;
5159
}
5260

5361
export function FormValidation(

src/styles/themes/default.scss

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,16 @@ $input-error-color: #dc3545;
5555
padding: $input-padding-y $input-padding-x;
5656
font-family: $font-family;
5757
font-size: $font-size;
58-
height: calc(
59-
#{$line-height * 1em} + #{$input-padding-y * 2} + #{$input-border-width * 2}
60-
);
6158
border: $input-border-width solid $input-border-color;
6259
border-radius: $input-border-radius;
6360

61+
&:not(textarea) {
62+
height: calc(
63+
#{$line-height * 1em} + #{$input-padding-y * 2} + #{$input-border-width *
64+
2}
65+
);
66+
}
67+
6468
// Placeholder
6569
&::placeholder {
6670
color: $input-border-color;

0 commit comments

Comments
 (0)