@agorapulse/ui-components 22.0.12 → 22.0.14
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/agorapulse-ui-components-22.0.14.tgz +0 -0
- package/fesm2022/agorapulse-ui-components-nav-selector.mjs +15 -1
- package/fesm2022/agorapulse-ui-components-nav-selector.mjs.map +1 -1
- package/fesm2022/agorapulse-ui-components-text-measurement.mjs +2 -2
- package/fesm2022/agorapulse-ui-components-text-measurement.mjs.map +1 -1
- package/package.json +1 -1
- package/types/agorapulse-ui-components-nav-selector.d.ts +5 -0
- package/agorapulse-ui-components-22.0.12.tgz +0 -0
|
Binary file
|
|
@@ -1887,10 +1887,24 @@ class NavSelectorState {
|
|
|
1887
1887
|
newEntries = NavSelectorBuilder.build(entries, initialSelectedEntryUids?.[0] ?? null, detailsDisplayedLimit);
|
|
1888
1888
|
}
|
|
1889
1889
|
this._entries.update(oldEntries => {
|
|
1890
|
+
const previouslySelectedUids = this.collectSelectedUids(oldEntries);
|
|
1890
1891
|
const mergeEntries = NavSelectorMerger.mergeInternalNavSelectorEntries(newEntries, oldEntries);
|
|
1891
|
-
|
|
1892
|
+
const unfoldedEntries = this.unfoldParentsOfNewlySelectedEntries(mergeEntries, previouslySelectedUids);
|
|
1893
|
+
return NavSelectorFilter.filter(unfoldedEntries, this.search(), this.multipleModeEnabled());
|
|
1892
1894
|
});
|
|
1893
1895
|
}
|
|
1896
|
+
/**
|
|
1897
|
+
* Re-applies the unfold the merger discarded, only for newly selected entries: unfolding on every update
|
|
1898
|
+
* would re-open a node the user has just folded.
|
|
1899
|
+
*/
|
|
1900
|
+
unfoldParentsOfNewlySelectedEntries(entries, previouslySelectedUids) {
|
|
1901
|
+
const newlySelectedUids = this.collectSelectedUids(entries).filter(uid => !previouslySelectedUids.includes(uid));
|
|
1902
|
+
if (!newlySelectedUids.length) {
|
|
1903
|
+
return entries;
|
|
1904
|
+
}
|
|
1905
|
+
const options = this.getFoldingOptions();
|
|
1906
|
+
return newlySelectedUids.reduce((unfoldedEntries, uid) => NavSelectorFolding.unfoldParents(unfoldedEntries, uid, options), entries);
|
|
1907
|
+
}
|
|
1894
1908
|
onGroupToggleFolding(group) {
|
|
1895
1909
|
this._entries.update(entries => NavSelectorFolding.toggleFolding(entries, group.uid, this.getFoldingOptions()));
|
|
1896
1910
|
}
|