@ngx-smz/core 21.1.7 → 21.1.10

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.
@@ -34425,7 +34425,7 @@ class MenuHelperService {
34425
34425
  profileCreationData;
34426
34426
  accessMenuBehavior = 'hide';
34427
34427
  accessProfileBehavior = 'hide';
34428
- menuRebuildRevision = signal(0, ...(ngDevMode ? [{ debugName: "menuRebuildRevision" }] : []));
34428
+ sidebarNavigationTargets = [];
34429
34429
  constructor(actions$, store) {
34430
34430
  this.actions$ = actions$;
34431
34431
  this.store = store;
@@ -34453,7 +34453,7 @@ class MenuHelperService {
34453
34453
  else {
34454
34454
  this.setupProfile();
34455
34455
  }
34456
- this.menuRebuildRevision.update((revision) => revision + 1);
34456
+ this.refreshSidebarNavigationBindings();
34457
34457
  }
34458
34458
  setMenuBuild(callback) {
34459
34459
  this.menuCreationCallback = () => sortMenuItemsByLabel(callback());
@@ -34477,6 +34477,36 @@ class MenuHelperService {
34477
34477
  clearNotifications() {
34478
34478
  this.notifications = [];
34479
34479
  }
34480
+ bindNavigationMenuToSidebar(sidebar) {
34481
+ const without = this.sidebarNavigationTargets.filter((s) => s !== sidebar);
34482
+ this.sidebarNavigationTargets.length = 0;
34483
+ this.sidebarNavigationTargets.push(...without, sidebar);
34484
+ this.refreshSidebarNavigationBindings();
34485
+ }
34486
+ refreshSidebarNavigationBindings() {
34487
+ for (const target of this.sidebarNavigationTargets) {
34488
+ const stripped = this.stripAuthorizationNavigationMenuFromMenuItems(cloneDeep(target()));
34489
+ target.set(this.mergeNavigationMenuIntoMenuItems(stripped));
34490
+ }
34491
+ }
34492
+ stripAuthorizationNavigationMenuFromMenuItems(sidebarItems) {
34493
+ const items = cloneDeep(sidebarItems ?? []);
34494
+ if (GlobalInjector?.config?.rbkUtils?.authorization?.navigationMenu == null) {
34495
+ return items;
34496
+ }
34497
+ const navigationMenu = GlobalInjector.config.rbkUtils.authorization.navigationMenu;
34498
+ const navigationRootChildLabels = new Set((navigationMenu.items ?? [])
34499
+ .map((c) => c.label)
34500
+ .filter((label) => label != null));
34501
+ const sameLabelNode = items.find((x) => x.label === navigationMenu.label);
34502
+ if (sameLabelNode != null) {
34503
+ if (sameLabelNode.items?.length) {
34504
+ sameLabelNode.items = sameLabelNode.items.filter((child) => !navigationRootChildLabels.has(child.label));
34505
+ }
34506
+ return items;
34507
+ }
34508
+ return items.filter((x) => x.label !== navigationMenu.label);
34509
+ }
34480
34510
  mergeNavigationMenuIntoMenuItems(sidebarItems) {
34481
34511
  const items = cloneDeep(sidebarItems ?? []);
34482
34512
  if (GlobalInjector?.config?.rbkUtils?.authorization?.navigationMenu == null) {