Skip to content

Commit 904dde1

Browse files
committed
Minor change
1 parent b6ff8d8 commit 904dde1

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

force-app/main/default/lwc/checkboxGroup/checkboxGroup.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default class CheckboxGroup extends LightningElement {
1111
_showError = false;
1212
_customValidityErrorMsg = "";
1313
_messageWhenValueMissing = DEFAULT_MESSAGE_WHEN_VALUE_MISSING;
14-
_checkboxes = [];
14+
_slot = [];
1515

1616
@api
1717
get label() {
@@ -60,22 +60,22 @@ export default class CheckboxGroup extends LightningElement {
6060

6161
@api
6262
clear() {
63-
this._checkboxes.forEach((checkbox) => {
63+
this._slot.forEach((checkbox) => {
6464
checkbox.checked = false;
6565
});
6666
}
6767

6868
@api
6969
blur() {
70-
this._checkboxes.forEach((checkbox) => {
70+
this._slot.forEach((checkbox) => {
7171
checkbox.blur();
7272
});
7373
}
7474

7575
@api
7676
focus() {
77-
if(this._checkboxes.length > 0) {
78-
this._checkboxes[0].focus();
77+
if(this._slot.length > 0) {
78+
this._slot[0].focus();
7979
}
8080
}
8181

@@ -84,7 +84,7 @@ export default class CheckboxGroup extends LightningElement {
8484
if(this._customValidityErrorMsg && !this.readOnly) {
8585
this._validity = false;
8686
} else if(this.required && !this.readOnly) {
87-
this._validity = this._checkboxes.reduce((acc, cb) => acc || cb.checked, false);
87+
this._validity = this._slot.reduce((acc, cb) => acc || cb.checked, false);
8888
} else {
8989
this._validity = true;
9090
}
@@ -105,14 +105,14 @@ export default class CheckboxGroup extends LightningElement {
105105
}
106106

107107
renderedCallback() {
108-
this._checkboxes.forEach((cb) => {
108+
this._slot.forEach((cb) => {
109109
cb.bind(this);
110110
});
111111
}
112112

113113
handleChange = (event) => {
114114
if(!this.multiple && event.target.checked) {
115-
this._checkboxes.filter(cb => cb !== event.target).forEach(cb => {
115+
this._slot.filter(cb => cb !== event.target).forEach(cb => {
116116
cb.checked = false;
117117
this.dispatchEvent(new CustomEvent("change", { detail: cb }));
118118
});
@@ -142,7 +142,7 @@ export default class CheckboxGroup extends LightningElement {
142142
handleSlotChange(event) {
143143
const slot = event.target;
144144

145-
this._checkboxes = slot.assignedNodes({ flatten: true }).filter(node => {
145+
this._slot = slot.assignedNodes({ flatten: true }).filter(node => {
146146
if(node.tagName !== 'C-CHECKBOX') {
147147
slot.removeChild(node);
148148
return false;
@@ -151,7 +151,7 @@ export default class CheckboxGroup extends LightningElement {
151151
return true;
152152
});
153153

154-
this._checkboxes.forEach(cb => {
154+
this._slot.forEach(cb => {
155155
cb.bind(this);
156156

157157
cb.removeEventListener('change', this.handleChange, true);

0 commit comments

Comments
 (0)