@ngx-smz/core 21.1.6 → 21.1.7
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.
|
@@ -34423,8 +34423,9 @@ class MenuHelperService {
|
|
|
34423
34423
|
profileCreationCallback;
|
|
34424
34424
|
menuCreationData;
|
|
34425
34425
|
profileCreationData;
|
|
34426
|
-
accessMenuBehavior;
|
|
34427
|
-
accessProfileBehavior;
|
|
34426
|
+
accessMenuBehavior = 'hide';
|
|
34427
|
+
accessProfileBehavior = 'hide';
|
|
34428
|
+
menuRebuildRevision = signal(0, ...(ngDevMode ? [{ debugName: "menuRebuildRevision" }] : []));
|
|
34428
34429
|
constructor(actions$, store) {
|
|
34429
34430
|
this.actions$ = actions$;
|
|
34430
34431
|
this.store = store;
|
|
@@ -34452,6 +34453,7 @@ class MenuHelperService {
|
|
|
34452
34453
|
else {
|
|
34453
34454
|
this.setupProfile();
|
|
34454
34455
|
}
|
|
34456
|
+
this.menuRebuildRevision.update((revision) => revision + 1);
|
|
34455
34457
|
}
|
|
34456
34458
|
setMenuBuild(callback) {
|
|
34457
34459
|
this.menuCreationCallback = () => sortMenuItemsByLabel(callback());
|
|
@@ -34475,29 +34477,61 @@ class MenuHelperService {
|
|
|
34475
34477
|
clearNotifications() {
|
|
34476
34478
|
this.notifications = [];
|
|
34477
34479
|
}
|
|
34478
|
-
|
|
34479
|
-
|
|
34480
|
-
|
|
34481
|
-
|
|
34482
|
-
|
|
34483
|
-
const
|
|
34484
|
-
|
|
34485
|
-
|
|
34486
|
-
|
|
34487
|
-
if (withSameLabel
|
|
34488
|
-
|
|
34489
|
-
|
|
34490
|
-
|
|
34480
|
+
mergeNavigationMenuIntoMenuItems(sidebarItems) {
|
|
34481
|
+
const items = cloneDeep(sidebarItems ?? []);
|
|
34482
|
+
if (GlobalInjector?.config?.rbkUtils?.authorization?.navigationMenu == null) {
|
|
34483
|
+
return items;
|
|
34484
|
+
}
|
|
34485
|
+
const navigationMenu = GlobalInjector.config.rbkUtils.authorization.navigationMenu;
|
|
34486
|
+
const navigationChildCreations = navigationMenu.items ?? [];
|
|
34487
|
+
const withSameLabel = items.find(x => x.label === navigationMenu.label);
|
|
34488
|
+
if (withSameLabel != null) {
|
|
34489
|
+
if (withSameLabel.items == null) {
|
|
34490
|
+
withSameLabel.items = [];
|
|
34491
|
+
}
|
|
34492
|
+
const mergedFromNavigation = [];
|
|
34493
|
+
for (const creation of navigationChildCreations) {
|
|
34494
|
+
const subItem = this.addMenuItemRecursive(creation, this.accessMenuBehavior);
|
|
34495
|
+
if (subItem != null) {
|
|
34496
|
+
mergedFromNavigation.push(subItem);
|
|
34491
34497
|
}
|
|
34492
|
-
// Merge dos itens desse menu
|
|
34493
|
-
withSameLabel.items = sortArrayOfObjects([...withSameLabel.items, ...navigationMenu.items], 'label', 1);
|
|
34494
34498
|
}
|
|
34495
|
-
|
|
34496
|
-
|
|
34497
|
-
|
|
34498
|
-
|
|
34499
|
+
withSameLabel.items = sortArrayOfObjects([...withSameLabel.items, ...mergedFromNavigation], 'label', 1);
|
|
34500
|
+
}
|
|
34501
|
+
else {
|
|
34502
|
+
const item = this.addMenuItemRecursive(navigationMenu, this.accessMenuBehavior);
|
|
34503
|
+
if (item?.items?.length > 0 || item?.command != null || item?.routerLink != null) {
|
|
34504
|
+
items.push(item);
|
|
34505
|
+
}
|
|
34506
|
+
}
|
|
34507
|
+
return items;
|
|
34508
|
+
}
|
|
34509
|
+
applyAuthorizationNavigationMenuToMenuCreations(creationData) {
|
|
34510
|
+
const extras = [];
|
|
34511
|
+
if (GlobalInjector.config.rbkUtils.authorization.navigationMenu == null) {
|
|
34512
|
+
return extras;
|
|
34513
|
+
}
|
|
34514
|
+
const navigationMenu = GlobalInjector.config.rbkUtils.authorization.navigationMenu;
|
|
34515
|
+
const navigationItems = navigationMenu.items ?? [];
|
|
34516
|
+
const withSameLabel = creationData.find(x => x.label === navigationMenu.label);
|
|
34517
|
+
if (withSameLabel != null) {
|
|
34518
|
+
if (withSameLabel.items == null) {
|
|
34519
|
+
withSameLabel.items = [];
|
|
34499
34520
|
}
|
|
34521
|
+
withSameLabel.items = sortArrayOfObjects([...withSameLabel.items, ...navigationItems], 'label', 1);
|
|
34522
|
+
}
|
|
34523
|
+
else {
|
|
34524
|
+
extras.push(navigationMenu);
|
|
34500
34525
|
}
|
|
34526
|
+
return extras;
|
|
34527
|
+
}
|
|
34528
|
+
setupMenu() {
|
|
34529
|
+
if (this.menuCreationData == null) {
|
|
34530
|
+
return;
|
|
34531
|
+
}
|
|
34532
|
+
const creationData = this.menuCreationData;
|
|
34533
|
+
this.menu = [];
|
|
34534
|
+
const extras = this.applyAuthorizationNavigationMenuToMenuCreations(creationData);
|
|
34501
34535
|
for (const creation of creationData) {
|
|
34502
34536
|
const item = this.addMenuItemRecursive(creation, this.accessMenuBehavior);
|
|
34503
34537
|
if (item?.items?.length > 0 || (item?.command != null || item?.routerLink != null)) {
|