@mozaic-ds/angular 2.0.54 → 2.0.55
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.
|
@@ -16772,9 +16772,9 @@ class MozComboboxComponent {
|
|
|
16772
16772
|
return Math.min(count * ITEM_SIZE_PX, VIEWPORT_HEIGHT_PX);
|
|
16773
16773
|
}, ...(ngDevMode ? [{ debugName: "viewportHeight" }] : /* istanbul ignore next */ []));
|
|
16774
16774
|
/**
|
|
16775
|
-
* Whether a section
|
|
16776
|
-
* so
|
|
16777
|
-
*
|
|
16775
|
+
* Whether all non-disabled children of a section are selected. Disabled
|
|
16776
|
+
* children are ignored so the header state stays aligned with what a click
|
|
16777
|
+
* on the section checkbox will actually toggle.
|
|
16778
16778
|
*/
|
|
16779
16779
|
isSectionFullySelected = (sectionTitle) => {
|
|
16780
16780
|
const val = this._currentValueAsArray();
|
|
@@ -16782,18 +16782,18 @@ class MozComboboxComponent {
|
|
|
16782
16782
|
return false;
|
|
16783
16783
|
const cmp = this.compareWith();
|
|
16784
16784
|
const children = this.flatItems()
|
|
16785
|
-
.filter((i) => isFlatOption(i) && i.sectionTitle === sectionTitle)
|
|
16785
|
+
.filter((i) => isFlatOption(i) && i.sectionTitle === sectionTitle && !i.disabled)
|
|
16786
16786
|
.map((i) => i.value);
|
|
16787
16787
|
return children.length > 0 && children.every((cv) => val.some((sv) => cmp(sv, cv)));
|
|
16788
16788
|
};
|
|
16789
|
-
/** Whether a section's children are partially selected
|
|
16789
|
+
/** Whether a section's non-disabled children are partially selected. */
|
|
16790
16790
|
isSectionPartiallySelected = (sectionTitle) => {
|
|
16791
16791
|
const val = this._currentValueAsArray();
|
|
16792
16792
|
if (val.length === 0)
|
|
16793
16793
|
return false;
|
|
16794
16794
|
const cmp = this.compareWith();
|
|
16795
16795
|
const children = this.flatItems()
|
|
16796
|
-
.filter((i) => isFlatOption(i) && i.sectionTitle === sectionTitle)
|
|
16796
|
+
.filter((i) => isFlatOption(i) && i.sectionTitle === sectionTitle && !i.disabled)
|
|
16797
16797
|
.map((i) => i.value);
|
|
16798
16798
|
const selectedCount = children.filter((cv) => val.some((sv) => cmp(sv, cv))).length;
|
|
16799
16799
|
return selectedCount > 0 && selectedCount < children.length;
|
|
@@ -17043,10 +17043,20 @@ class MozComboboxComponent {
|
|
|
17043
17043
|
this.value.set([...this.allSelectableValues()]);
|
|
17044
17044
|
}
|
|
17045
17045
|
clearSelection() {
|
|
17046
|
+
const cmp = this.compareWith();
|
|
17047
|
+
const disabledValues = this.flatItems()
|
|
17048
|
+
.filter((i) => isFlatOption(i) && !!i.disabled)
|
|
17049
|
+
.map((i) => i.value);
|
|
17046
17050
|
if (this.multiple()) {
|
|
17047
|
-
this.
|
|
17051
|
+
const current = this._currentValueAsArray();
|
|
17052
|
+
const kept = current.filter((sv) => disabledValues.some((dv) => cmp(sv, dv)));
|
|
17053
|
+
this.value.set(kept);
|
|
17048
17054
|
}
|
|
17049
17055
|
else {
|
|
17056
|
+
const raw = this.value();
|
|
17057
|
+
if (raw != null && !Array.isArray(raw) && disabledValues.some((dv) => cmp(raw, dv))) {
|
|
17058
|
+
return;
|
|
17059
|
+
}
|
|
17050
17060
|
this.value.set(null);
|
|
17051
17061
|
}
|
|
17052
17062
|
}
|