@vaadin/vaadin-text-field 2.8.6 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +9 -9
- package/src/vaadin-email-field.js +1 -1
- package/src/vaadin-integer-field.js +1 -1
- package/src/vaadin-number-field.js +1 -1
- package/src/vaadin-password-field.js +1 -1
- package/src/vaadin-text-area.d.ts +11 -0
- package/src/vaadin-text-area.js +45 -1
- package/src/vaadin-text-field.js +1 -1
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"repository": "vaadin/vaadin-text-field",
|
|
11
11
|
"homepage": "https://vaadin.com/components",
|
|
12
12
|
"name": "@vaadin/vaadin-text-field",
|
|
13
|
-
"version": "2.
|
|
13
|
+
"version": "2.9.0",
|
|
14
14
|
"main": "vaadin-text-field.js",
|
|
15
15
|
"author": "Vaadin Ltd",
|
|
16
16
|
"license": "Apache-2.0",
|
|
@@ -34,22 +34,22 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@polymer/polymer": "^3.0.0",
|
|
37
|
+
"@vaadin/vaadin-themable-mixin": "^1.6.1",
|
|
37
38
|
"@vaadin/vaadin-control-state-mixin": "^2.2.1",
|
|
38
|
-
"@vaadin/vaadin-element-mixin": "^2.4.1",
|
|
39
39
|
"@vaadin/vaadin-lumo-styles": "^1.6.0",
|
|
40
40
|
"@vaadin/vaadin-material-styles": "^1.3.2",
|
|
41
|
-
"@vaadin/vaadin-
|
|
41
|
+
"@vaadin/vaadin-element-mixin": "^2.4.1"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
"generate-typings": "gen-typescript-declarations --outDir . --verify"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
47
|
"@polymer/iron-component-page": "^4.0.0",
|
|
48
48
|
"@polymer/iron-form": "^3.0.0",
|
|
49
49
|
"@polymer/iron-test-helpers": "^3.0.0",
|
|
50
|
-
"@vaadin/vaadin-button": "^2.1.0",
|
|
51
|
-
"@vaadin/vaadin-demo-helpers": "^3.0.0",
|
|
52
50
|
"@webcomponents/webcomponentsjs": "^2.0.0",
|
|
53
|
-
"wct-browser-legacy": "^1.0.1"
|
|
51
|
+
"wct-browser-legacy": "^1.0.1",
|
|
52
|
+
"@vaadin/vaadin-demo-helpers": "^3.0.0",
|
|
53
|
+
"@vaadin/vaadin-button": "^2.1.0"
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -79,7 +79,18 @@ declare class TextAreaElement extends
|
|
|
79
79
|
ThemableMixin(
|
|
80
80
|
PolymerElement)))) {
|
|
81
81
|
readonly _slottedTagName: string;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* A regular expression that the value is checked against.
|
|
85
|
+
* The pattern must match the entire value, not just some subset.
|
|
86
|
+
*/
|
|
87
|
+
pattern: string|null|undefined;
|
|
82
88
|
ready(): void;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Returns true if the current textarea value satisfies all constraints (if any).
|
|
92
|
+
*/
|
|
93
|
+
checkValidity(): boolean;
|
|
83
94
|
}
|
|
84
95
|
|
|
85
96
|
declare global {
|
package/src/vaadin-text-area.js
CHANGED
|
@@ -110,6 +110,11 @@ class TextAreaElement extends
|
|
|
110
110
|
:host {
|
|
111
111
|
animation: 1ms vaadin-text-area-appear;
|
|
112
112
|
}
|
|
113
|
+
|
|
114
|
+
/* Workaround https://bugzilla.mozilla.org/show_bug.cgi?id=1739079 */
|
|
115
|
+
:host([disabled]) [part='value'] {
|
|
116
|
+
user-select: none;
|
|
117
|
+
}
|
|
113
118
|
</style>
|
|
114
119
|
|
|
115
120
|
<div class="vaadin-text-area-container">
|
|
@@ -144,7 +149,19 @@ class TextAreaElement extends
|
|
|
144
149
|
}
|
|
145
150
|
|
|
146
151
|
static get version() {
|
|
147
|
-
return '2.
|
|
152
|
+
return '2.9.0';
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
static get properties() {
|
|
156
|
+
return {
|
|
157
|
+
/**
|
|
158
|
+
* A regular expression that the value is checked against.
|
|
159
|
+
* The pattern must match the entire value, not just some subset.
|
|
160
|
+
*/
|
|
161
|
+
pattern: {
|
|
162
|
+
type: String
|
|
163
|
+
}
|
|
164
|
+
};
|
|
148
165
|
}
|
|
149
166
|
|
|
150
167
|
static get observers() {
|
|
@@ -222,6 +239,33 @@ class TextAreaElement extends
|
|
|
222
239
|
this._dispatchIronResizeEventIfNeeded('InputHeight', inputHeight);
|
|
223
240
|
}
|
|
224
241
|
|
|
242
|
+
/**
|
|
243
|
+
* Returns true if the current textarea value satisfies all constraints (if any).
|
|
244
|
+
* @return {boolean}
|
|
245
|
+
*/
|
|
246
|
+
checkValidity() {
|
|
247
|
+
if (!super.checkValidity()) {
|
|
248
|
+
return false;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// Native <textarea> does not support pattern attribute, so we have a custom logic
|
|
252
|
+
// according to WHATWG spec for <input>, with tests inspired by web-platform-tests
|
|
253
|
+
// https://html.spec.whatwg.org/multipage/input.html#the-pattern-attribute
|
|
254
|
+
|
|
255
|
+
if (!this.pattern || !this.inputElement.value) {
|
|
256
|
+
// Mark as valid if there is no pattern, or the value is empty
|
|
257
|
+
return true;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
try {
|
|
261
|
+
const match = this.inputElement.value.match(this.pattern);
|
|
262
|
+
return match ? match[0] === match.input : false;
|
|
263
|
+
} catch (_) {
|
|
264
|
+
// If the pattern can not be compiled, then report as valid
|
|
265
|
+
return true;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
225
269
|
/**
|
|
226
270
|
* Fired when the text-area height changes.
|
|
227
271
|
*
|