@vaadin/checkbox-group 24.5.0-rc1 → 24.6.0-alpha1
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 +10 -10
- package/src/vaadin-checkbox-group-mixin.js +11 -9
- package/web-types.json +1 -1
- package/web-types.lit.json +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/checkbox-group",
|
|
3
|
-
"version": "24.
|
|
3
|
+
"version": "24.6.0-alpha1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -39,17 +39,17 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
41
41
|
"@polymer/polymer": "^3.0.0",
|
|
42
|
-
"@vaadin/a11y-base": "24.
|
|
43
|
-
"@vaadin/checkbox": "24.
|
|
44
|
-
"@vaadin/component-base": "24.
|
|
45
|
-
"@vaadin/field-base": "24.
|
|
46
|
-
"@vaadin/vaadin-lumo-styles": "24.
|
|
47
|
-
"@vaadin/vaadin-material-styles": "24.
|
|
48
|
-
"@vaadin/vaadin-themable-mixin": "24.
|
|
42
|
+
"@vaadin/a11y-base": "24.6.0-alpha1",
|
|
43
|
+
"@vaadin/checkbox": "24.6.0-alpha1",
|
|
44
|
+
"@vaadin/component-base": "24.6.0-alpha1",
|
|
45
|
+
"@vaadin/field-base": "24.6.0-alpha1",
|
|
46
|
+
"@vaadin/vaadin-lumo-styles": "24.6.0-alpha1",
|
|
47
|
+
"@vaadin/vaadin-material-styles": "24.6.0-alpha1",
|
|
48
|
+
"@vaadin/vaadin-themable-mixin": "24.6.0-alpha1",
|
|
49
49
|
"lit": "^3.0.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@vaadin/chai-plugins": "24.
|
|
52
|
+
"@vaadin/chai-plugins": "24.6.0-alpha1",
|
|
53
53
|
"@vaadin/testing-helpers": "^1.0.0",
|
|
54
54
|
"sinon": "^18.0.0"
|
|
55
55
|
},
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"web-types.json",
|
|
58
58
|
"web-types.lit.json"
|
|
59
59
|
],
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "ae1fb0e6e7ce925999051c6cc62ba8476264c63f"
|
|
61
61
|
}
|
|
@@ -118,7 +118,7 @@ export const CheckboxGroupMixin = (superclass) =>
|
|
|
118
118
|
* @return {boolean}
|
|
119
119
|
*/
|
|
120
120
|
checkValidity() {
|
|
121
|
-
return !this.required || this.value.length > 0;
|
|
121
|
+
return !this.required || Boolean(this.value && this.value.length > 0);
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
/**
|
|
@@ -165,7 +165,7 @@ export const CheckboxGroupMixin = (superclass) =>
|
|
|
165
165
|
|
|
166
166
|
if (checkbox.checked) {
|
|
167
167
|
this.__addCheckboxToValue(checkbox.value);
|
|
168
|
-
} else if (this.value.includes(checkbox.value)) {
|
|
168
|
+
} else if (this.value && this.value.includes(checkbox.value)) {
|
|
169
169
|
checkbox.checked = true;
|
|
170
170
|
}
|
|
171
171
|
}
|
|
@@ -215,7 +215,9 @@ export const CheckboxGroupMixin = (superclass) =>
|
|
|
215
215
|
* @private
|
|
216
216
|
*/
|
|
217
217
|
__addCheckboxToValue(value) {
|
|
218
|
-
if (!this.value
|
|
218
|
+
if (!this.value) {
|
|
219
|
+
this.value = [value];
|
|
220
|
+
} else if (!this.value.includes(value)) {
|
|
219
221
|
this.value = [...this.value, value];
|
|
220
222
|
}
|
|
221
223
|
}
|
|
@@ -225,7 +227,7 @@ export const CheckboxGroupMixin = (superclass) =>
|
|
|
225
227
|
* @private
|
|
226
228
|
*/
|
|
227
229
|
__removeCheckboxFromValue(value) {
|
|
228
|
-
if (this.value.includes(value)) {
|
|
230
|
+
if (this.value && this.value.includes(value)) {
|
|
229
231
|
this.value = this.value.filter((v) => v !== value);
|
|
230
232
|
}
|
|
231
233
|
}
|
|
@@ -245,20 +247,20 @@ export const CheckboxGroupMixin = (superclass) =>
|
|
|
245
247
|
}
|
|
246
248
|
|
|
247
249
|
/**
|
|
248
|
-
* @param {string | null | undefined} value
|
|
249
|
-
* @param {string | null | undefined} oldValue
|
|
250
|
+
* @param {string[] | null | undefined} value
|
|
251
|
+
* @param {string[] | null | undefined} oldValue
|
|
250
252
|
* @private
|
|
251
253
|
*/
|
|
252
254
|
__valueChanged(value, oldValue) {
|
|
253
255
|
// Setting initial value to empty array, skip validation
|
|
254
|
-
if (value.length === 0 && oldValue === undefined) {
|
|
256
|
+
if (value && value.length === 0 && oldValue === undefined) {
|
|
255
257
|
return;
|
|
256
258
|
}
|
|
257
259
|
|
|
258
|
-
this.toggleAttribute('has-value', value.length > 0);
|
|
260
|
+
this.toggleAttribute('has-value', value && value.length > 0);
|
|
259
261
|
|
|
260
262
|
this.__checkboxes.forEach((checkbox) => {
|
|
261
|
-
checkbox.checked = value.includes(checkbox.value);
|
|
263
|
+
checkbox.checked = value && value.includes(checkbox.value);
|
|
262
264
|
});
|
|
263
265
|
|
|
264
266
|
if (oldValue !== undefined) {
|
package/web-types.json
CHANGED
package/web-types.lit.json
CHANGED