@progressio_resources/gravity-design-system 4.0.15 → 4.0.16
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.
|
@@ -5419,11 +5419,44 @@ class TreeService {
|
|
|
5419
5419
|
return states.filter((nodeState) => nodeState.hasFilteredChildren || value === '' || nodeState.nodeItem.name.toLowerCase().indexOf(value) !== -1);
|
|
5420
5420
|
}
|
|
5421
5421
|
checkboxClick(state) {
|
|
5422
|
-
|
|
5422
|
+
if (!state.parent) {
|
|
5423
|
+
this.toggleRootSubtree(state);
|
|
5424
|
+
}
|
|
5425
|
+
else {
|
|
5426
|
+
this.toggleSelectedState(state, false);
|
|
5427
|
+
}
|
|
5423
5428
|
if (this.callbacks?.toggle) {
|
|
5424
5429
|
this.callbacks.toggle(state.nodeItem);
|
|
5425
5430
|
}
|
|
5426
5431
|
}
|
|
5432
|
+
toggleRootSubtree(state) {
|
|
5433
|
+
if (state.disabled) {
|
|
5434
|
+
return;
|
|
5435
|
+
}
|
|
5436
|
+
const shouldCheck = state.selectedState !== NodeSelectedState.checked;
|
|
5437
|
+
this.setSubtreeSelected(state, shouldCheck);
|
|
5438
|
+
this.selectedItemsSubject.next(this.selectedItems);
|
|
5439
|
+
}
|
|
5440
|
+
setSubtreeSelected(state, checked) {
|
|
5441
|
+
if (!state.disabled && state.showCheckbox) {
|
|
5442
|
+
if (checked) {
|
|
5443
|
+
state.selectedState = NodeSelectedState.checked;
|
|
5444
|
+
state.selected = true;
|
|
5445
|
+
this.addSelected(state);
|
|
5446
|
+
}
|
|
5447
|
+
else {
|
|
5448
|
+
state.selectedState = NodeSelectedState.unChecked;
|
|
5449
|
+
state.selected = false;
|
|
5450
|
+
this.removeSelected(state.nodeItem.item);
|
|
5451
|
+
if (this.callbacks?.unSelect) {
|
|
5452
|
+
this.callbacks.unSelect(state.nodeItem);
|
|
5453
|
+
}
|
|
5454
|
+
}
|
|
5455
|
+
}
|
|
5456
|
+
for (const child of state.children) {
|
|
5457
|
+
this.setSubtreeSelected(child, checked);
|
|
5458
|
+
}
|
|
5459
|
+
}
|
|
5427
5460
|
toggleSelectedState(state, ignoreDisabled) {
|
|
5428
5461
|
if (state.disabled && !ignoreDisabled) {
|
|
5429
5462
|
return;
|