@vaadin/field-base 25.3.0-alpha6 → 25.3.0-alpha7
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/field-base",
|
|
3
|
-
"version": "25.3.0-
|
|
3
|
+
"version": "25.3.0-alpha7",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -32,17 +32,17 @@
|
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
35
|
-
"@vaadin/a11y-base": "25.3.0-
|
|
36
|
-
"@vaadin/component-base": "25.3.0-
|
|
35
|
+
"@vaadin/a11y-base": "25.3.0-alpha7",
|
|
36
|
+
"@vaadin/component-base": "25.3.0-alpha7",
|
|
37
37
|
"lit": "^3.0.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@vaadin/chai-plugins": "25.3.0-
|
|
41
|
-
"@vaadin/input-container": "25.3.0-
|
|
42
|
-
"@vaadin/test-runner-commands": "25.3.0-
|
|
40
|
+
"@vaadin/chai-plugins": "25.3.0-alpha7",
|
|
41
|
+
"@vaadin/input-container": "25.3.0-alpha7",
|
|
42
|
+
"@vaadin/test-runner-commands": "25.3.0-alpha7",
|
|
43
43
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
44
44
|
"sinon": "^22.0.0"
|
|
45
45
|
},
|
|
46
46
|
"customElements": "custom-elements.json",
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "ae7b9823df5598faebd7a482993029ee489c35ae"
|
|
48
48
|
}
|
|
@@ -10,23 +10,21 @@
|
|
|
10
10
|
export class LabelledInputController {
|
|
11
11
|
constructor(input, labelController) {
|
|
12
12
|
this.input = input;
|
|
13
|
-
this.__preventDuplicateLabelClick = this.__preventDuplicateLabelClick.bind(this);
|
|
14
13
|
|
|
15
14
|
labelController.addEventListener('slot-content-changed', (event) => {
|
|
16
|
-
this
|
|
15
|
+
this.#initLabel(event.detail.node);
|
|
17
16
|
});
|
|
18
17
|
|
|
19
18
|
// Initialize the default label element
|
|
20
|
-
this
|
|
19
|
+
this.#initLabel(labelController.node);
|
|
21
20
|
}
|
|
22
21
|
|
|
23
22
|
/**
|
|
24
23
|
* @param {HTMLElement} label
|
|
25
|
-
* @private
|
|
26
24
|
*/
|
|
27
|
-
|
|
25
|
+
#initLabel(label) {
|
|
28
26
|
if (label) {
|
|
29
|
-
label.addEventListener('click', this
|
|
27
|
+
label.addEventListener('click', this.#preventDuplicateLabelClick);
|
|
30
28
|
|
|
31
29
|
if (this.input) {
|
|
32
30
|
label.setAttribute('for', this.input.id);
|
|
@@ -40,13 +38,12 @@ export class LabelledInputController {
|
|
|
40
38
|
* This results in two click events arriving at the host, but we only want one.
|
|
41
39
|
* This method prevents the duplicate click and ensures the correct isTrusted event
|
|
42
40
|
* with the correct event.target arrives at the host.
|
|
43
|
-
* @private
|
|
44
41
|
*/
|
|
45
|
-
|
|
42
|
+
#preventDuplicateLabelClick = () => {
|
|
46
43
|
const inputClickHandler = (e) => {
|
|
47
44
|
e.stopImmediatePropagation();
|
|
48
45
|
this.input.removeEventListener('click', inputClickHandler);
|
|
49
46
|
};
|
|
50
47
|
this.input.addEventListener('click', inputClickHandler);
|
|
51
|
-
}
|
|
48
|
+
};
|
|
52
49
|
}
|
|
@@ -18,19 +18,18 @@ export class VirtualKeyboardController {
|
|
|
18
18
|
host.addEventListener('opened-changed', () => {
|
|
19
19
|
if (!host.opened) {
|
|
20
20
|
// Prevent opening the virtual keyboard when the input gets re-focused on dropdown close
|
|
21
|
-
this
|
|
21
|
+
this.#setVirtualKeyboardEnabled(false);
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
// Re-enable virtual keyboard on blur, so it gets opened when the field is focused again
|
|
26
|
-
host.addEventListener('blur', () => this
|
|
26
|
+
host.addEventListener('blur', () => this.#setVirtualKeyboardEnabled(true));
|
|
27
27
|
|
|
28
28
|
// Re-enable the virtual keyboard whenever the field is touched
|
|
29
|
-
host.addEventListener('touchstart', () => this
|
|
29
|
+
host.addEventListener('touchstart', () => this.#setVirtualKeyboardEnabled(true));
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
__setVirtualKeyboardEnabled(value) {
|
|
32
|
+
#setVirtualKeyboardEnabled(value) {
|
|
34
33
|
if (this.host.inputElement) {
|
|
35
34
|
this.host.inputElement.inputMode = value ? '' : 'none';
|
|
36
35
|
}
|