@@ -23,7 +23,6 @@ export default {
23
23
*/
24
24
value: {
25
25
type: [String , Number ],
26
- required: false ,
27
26
default: ' '
28
27
},
29
28
@@ -32,7 +31,6 @@ export default {
32
31
*/
33
32
autosize: {
34
33
type: Boolean ,
35
- required: false ,
36
34
default: true
37
35
},
38
36
@@ -41,7 +39,6 @@ export default {
41
39
*/
42
40
minHeight: {
43
41
type: [Number ],
44
- required: false ,
45
42
' default' : null
46
43
},
47
44
@@ -50,8 +47,15 @@ export default {
50
47
*/
51
48
maxHeight: {
52
49
type: [Number ],
53
- required: false ,
54
50
' default' : null
51
+ },
52
+
53
+ /*
54
+ * Force !important for style properties
55
+ */
56
+ important: {
57
+ type: [Boolean , Array ],
58
+ default: false
55
59
}
56
60
},
57
61
@@ -71,13 +75,28 @@ export default {
71
75
let objStyles = {}
72
76
73
77
if (this .autosize ) {
74
- objStyles .resize = ' none'
78
+ objStyles .resize = ! this . isResizeImportant ? ' none' : ' none !important '
75
79
if (! this .maxHeightScroll ) {
76
- objStyles .overflow = ' hidden'
80
+ objStyles .overflow = ! this . isOverflowImportant ? ' hidden' : ' hidden !important '
77
81
}
78
82
}
79
83
80
84
return objStyles
85
+ },
86
+
87
+ isResizeImportant () {
88
+ const imp = this .important
89
+ return imp === true || (Array .isArray (imp) && imp .includes (' resize' ))
90
+ },
91
+
92
+ isOverflowImportant () {
93
+ const imp = this .important
94
+ return imp === true || (Array .isArray (imp) && imp .includes (' overflow' ))
95
+ },
96
+
97
+ isHeightImportant () {
98
+ const imp = this .important
99
+ return imp === true || (Array .isArray (imp) && imp .includes (' height' ))
81
100
}
82
101
},
83
102
@@ -93,7 +112,10 @@ export default {
93
112
* Auto resize textarea by height
94
113
*/
95
114
resize : function () {
96
- this .$el .style .height = ' auto'
115
+ const important = this .isHeightImportant ? ' important' : undefined
116
+
117
+ this .$el .style .setProperty (' height' , ' auto' , important)
118
+
97
119
let contentHeight = this .$el .scrollHeight + 1
98
120
99
121
if (this .minHeight ) {
@@ -109,7 +131,8 @@ export default {
109
131
}
110
132
}
111
133
112
- this .$el .style .height = contentHeight + ' px'
134
+ const heightVal = contentHeight + ' px'
135
+ this .$el .style .setProperty (' height' , heightVal, important)
113
136
return this
114
137
}
115
138
},
0 commit comments