@vaadin/field-base 23.2.0-alpha5 → 23.2.0-beta2
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": "23.2.0-
|
|
3
|
+
"version": "23.2.0-beta2",
|
|
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-beta2",
|
|
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": "42864949ade7e573ac534a64ecdd97fab32a87fc"
|
|
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-field-mixin.js
CHANGED
|
@@ -85,15 +85,17 @@ export const InputFieldMixin = (superclass) =>
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
/**
|
|
88
|
-
* Override an event listener from `
|
|
89
|
-
* @param {
|
|
88
|
+
* Override an event listener from `FocusMixin`.
|
|
89
|
+
* @param {boolean} focused
|
|
90
90
|
* @protected
|
|
91
91
|
* @override
|
|
92
92
|
*/
|
|
93
|
-
|
|
94
|
-
super.
|
|
93
|
+
_setFocused(focused) {
|
|
94
|
+
super._setFocused(focused);
|
|
95
95
|
|
|
96
|
-
|
|
96
|
+
if (!focused) {
|
|
97
|
+
this.validate();
|
|
98
|
+
}
|
|
97
99
|
}
|
|
98
100
|
|
|
99
101
|
/**
|
package/src/input-mixin.js
CHANGED
|
@@ -52,13 +52,23 @@ export const InputMixin = dedupingMixin(
|
|
|
52
52
|
observer: '_valueChanged',
|
|
53
53
|
notify: true,
|
|
54
54
|
},
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* When true, the input element has a non-empty value entered by the user.
|
|
58
|
+
* @protected
|
|
59
|
+
*/
|
|
60
|
+
_hasInputValue: {
|
|
61
|
+
type: Boolean,
|
|
62
|
+
value: false,
|
|
63
|
+
observer: '_hasInputValueChanged',
|
|
64
|
+
},
|
|
55
65
|
};
|
|
56
66
|
}
|
|
57
67
|
|
|
58
68
|
constructor() {
|
|
59
69
|
super();
|
|
60
70
|
|
|
61
|
-
this._boundOnInput = this.
|
|
71
|
+
this._boundOnInput = this.__onInput.bind(this);
|
|
62
72
|
this._boundOnChange = this._onChange.bind(this);
|
|
63
73
|
}
|
|
64
74
|
|
|
@@ -126,6 +136,33 @@ export const InputMixin = dedupingMixin(
|
|
|
126
136
|
}
|
|
127
137
|
}
|
|
128
138
|
|
|
139
|
+
/**
|
|
140
|
+
* Observer to notify about the change of private property.
|
|
141
|
+
*
|
|
142
|
+
* @private
|
|
143
|
+
*/
|
|
144
|
+
_hasInputValueChanged(hasValue, oldHasValue) {
|
|
145
|
+
if (hasValue || oldHasValue) {
|
|
146
|
+
this.dispatchEvent(new CustomEvent('has-input-value-changed'));
|
|
147
|
+
}
|
|
148
|
+
}
|
|
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
|
+
|
|
129
166
|
/**
|
|
130
167
|
* An input event listener used to update the field value.
|
|
131
168
|
*
|
|
@@ -133,9 +170,13 @@ export const InputMixin = dedupingMixin(
|
|
|
133
170
|
* @protected
|
|
134
171
|
*/
|
|
135
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];
|
|
136
177
|
// Ignore fake input events e.g. used by clear button.
|
|
137
178
|
this.__userInput = event.isTrusted;
|
|
138
|
-
this.value =
|
|
179
|
+
this.value = target.value;
|
|
139
180
|
this.__userInput = false;
|
|
140
181
|
}
|
|
141
182
|
|