@vaadin/field-base 24.0.0-rc2 → 24.0.1

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": "24.0.0-rc2",
3
+ "version": "24.0.1",
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": "24.0.0-rc2",
35
+ "@vaadin/component-base": "~24.0.1",
36
36
  "lit": "^2.0.0"
37
37
  },
38
38
  "devDependencies": {
@@ -40,5 +40,5 @@
40
40
  "@vaadin/testing-helpers": "^0.4.0",
41
41
  "sinon": "^13.0.2"
42
42
  },
43
- "gitHead": "7601e71eaf22c45309852d5d491e0e01bb6322f0"
43
+ "gitHead": "41f02b2407a3587da78bce6f0753027ff96f16d8"
44
44
  }
@@ -34,6 +34,18 @@ export declare class InputMixinClass {
34
34
  */
35
35
  protected readonly _hasValue: boolean;
36
36
 
37
+ /**
38
+ * A property for accessing the input element's value.
39
+ *
40
+ * Override this getter if the property is different from the default `value` one.
41
+ */
42
+ protected readonly _inputElementValueProperty: string;
43
+
44
+ /**
45
+ * The input element's value.
46
+ */
47
+ protected _inputElementValue: string | undefined;
48
+
37
49
  /**
38
50
  * Clear the value of the field.
39
51
  */
@@ -54,10 +54,7 @@ export const InputMixin = dedupingMixin(
54
54
  },
55
55
 
56
56
  /**
57
- * Whether the input element has user input.
58
- *
59
- * Note, the property indicates true only if the input has been entered by the user.
60
- * In the case of programmatic changes, the property must be reset to false.
57
+ * Whether the input element has a non-empty value.
61
58
  *
62
59
  * @protected
63
60
  */
@@ -86,6 +83,39 @@ export const InputMixin = dedupingMixin(
86
83
  return this.value != null && this.value !== '';
87
84
  }
88
85
 
86
+ /**
87
+ * A property for accessing the input element's value.
88
+ *
89
+ * Override this getter if the property is different from the default `value` one.
90
+ *
91
+ * @protected
92
+ * @return {string}
93
+ */
94
+ get _inputElementValueProperty() {
95
+ return 'value';
96
+ }
97
+
98
+ /**
99
+ * The input element's value.
100
+ *
101
+ * @protected
102
+ * @return {string}
103
+ */
104
+ get _inputElementValue() {
105
+ return this.inputElement ? this.inputElement[this._inputElementValueProperty] : undefined;
106
+ }
107
+
108
+ /**
109
+ * The input element's value.
110
+ *
111
+ * @protected
112
+ */
113
+ set _inputElementValue(value) {
114
+ if (this.inputElement) {
115
+ this.inputElement[this._inputElementValueProperty] = value;
116
+ }
117
+ }
118
+
89
119
  /**
90
120
  * Clear the value of the field.
91
121
  */
@@ -96,9 +126,7 @@ export const InputMixin = dedupingMixin(
96
126
 
97
127
  // Clear the input immediately without waiting for the observer.
98
128
  // Otherwise, when using Lit, the old value would be restored.
99
- if (this.inputElement) {
100
- this.inputElement.value = '';
101
- }
129
+ this._inputElementValue = '';
102
130
  }
103
131
 
104
132
  /**
@@ -138,11 +166,7 @@ export const InputMixin = dedupingMixin(
138
166
  return;
139
167
  }
140
168
 
141
- if (value != null) {
142
- this.inputElement.value = value;
143
- } else {
144
- this.inputElement.value = '';
145
- }
169
+ this._inputElementValue = value != null ? value : '';
146
170
  }
147
171
 
148
172
  /**