@vaadin/field-base 23.2.0-alpha6 → 23.2.0-beta1
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 +3 -3
- package/src/helper-controller.d.ts +1 -1
- package/src/helper-controller.js +1 -1
- package/src/input-mixin.js +23 -15
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/field-base",
|
|
3
|
-
"version": "23.2.0-
|
|
3
|
+
"version": "23.2.0-beta1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
34
34
|
"@polymer/polymer": "^3.0.0",
|
|
35
|
-
"@vaadin/component-base": "23.2.0-
|
|
35
|
+
"@vaadin/component-base": "23.2.0-beta1",
|
|
36
36
|
"lit": "^2.0.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"@vaadin/testing-helpers": "^0.3.2",
|
|
41
41
|
"sinon": "^13.0.2"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "82ff7254f27a1a089367e4dd005f63879e33c188"
|
|
44
44
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 Vaadin Ltd.
|
|
3
|
+
* Copyright (c) 2021 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { SlotController } from '@vaadin/component-base/src/slot-controller.js';
|
package/src/helper-controller.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 Vaadin Ltd.
|
|
3
|
+
* Copyright (c) 2021 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { SlotController } from '@vaadin/component-base/src/slot-controller.js';
|
package/src/input-mixin.js
CHANGED
|
@@ -68,8 +68,8 @@ export const InputMixin = dedupingMixin(
|
|
|
68
68
|
constructor() {
|
|
69
69
|
super();
|
|
70
70
|
|
|
71
|
-
this._boundOnInput = this.
|
|
72
|
-
this._boundOnChange = this.
|
|
71
|
+
this._boundOnInput = this.__onInput.bind(this);
|
|
72
|
+
this._boundOnChange = this._onChange.bind(this);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
/**
|
|
@@ -147,6 +147,22 @@ export const InputMixin = dedupingMixin(
|
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
+
/**
|
|
151
|
+
* An input event listener used to update `_hasInputValue` property.
|
|
152
|
+
* Do not override this method.
|
|
153
|
+
*
|
|
154
|
+
* @param {Event} event
|
|
155
|
+
* @private
|
|
156
|
+
*/
|
|
157
|
+
__onInput(event) {
|
|
158
|
+
// In the case a custom web component is passed as `inputElement`,
|
|
159
|
+
// the actual native input element, on which the event occurred,
|
|
160
|
+
// can be inside shadow trees.
|
|
161
|
+
const target = event.composedPath()[0];
|
|
162
|
+
this._hasInputValue = target.value.length > 0;
|
|
163
|
+
this._onInput(event);
|
|
164
|
+
}
|
|
165
|
+
|
|
150
166
|
/**
|
|
151
167
|
* An input event listener used to update the field value.
|
|
152
168
|
*
|
|
@@ -154,9 +170,13 @@ export const InputMixin = dedupingMixin(
|
|
|
154
170
|
* @protected
|
|
155
171
|
*/
|
|
156
172
|
_onInput(event) {
|
|
173
|
+
// In the case a custom web component is passed as `inputElement`,
|
|
174
|
+
// the actual native input element, on which the event occurred,
|
|
175
|
+
// can be inside shadow trees.
|
|
176
|
+
const target = event.composedPath()[0];
|
|
157
177
|
// Ignore fake input events e.g. used by clear button.
|
|
158
178
|
this.__userInput = event.isTrusted;
|
|
159
|
-
this.value =
|
|
179
|
+
this.value = target.value;
|
|
160
180
|
this.__userInput = false;
|
|
161
181
|
}
|
|
162
182
|
|
|
@@ -168,18 +188,6 @@ export const InputMixin = dedupingMixin(
|
|
|
168
188
|
*/
|
|
169
189
|
_onChange(_event) {}
|
|
170
190
|
|
|
171
|
-
/**
|
|
172
|
-
* A change event listener used to update `_hasInputValue` property.
|
|
173
|
-
* Do not override this method.
|
|
174
|
-
*
|
|
175
|
-
* @param {Event} event
|
|
176
|
-
* @private
|
|
177
|
-
*/
|
|
178
|
-
__onChange(event) {
|
|
179
|
-
this._hasInputValue = event.target.value.length > 0;
|
|
180
|
-
this._onChange(event);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
191
|
/**
|
|
184
192
|
* Toggle the has-value attribute based on the value property.
|
|
185
193
|
* @param {boolean} hasValue
|