@volo/ngx-lepton-x.core 5.0.1 → 5.0.3
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.
|
@@ -3,6 +3,7 @@ import { inject, ViewContainerRef, TemplateRef, Input, Directive, NgModule, Inje
|
|
|
3
3
|
import { CommonModule, isPlatformBrowser, DOCUMENT as DOCUMENT$1, Location, NgClass, NgTemplateOutlet, AsyncPipe, NgComponentOutlet } from '@angular/common';
|
|
4
4
|
import { of, from, Observable, EMPTY, BehaviorSubject, Subject, fromEvent, Subscription, combineLatest, map as map$1 } from 'rxjs';
|
|
5
5
|
import { Router, NavigationEnd, RouterLink, RouterModule } from '@angular/router';
|
|
6
|
+
import { LOGO_URL_TOKEN, LOGO_APP_NAME_TOKEN } from '@abp/ng.theme.shared';
|
|
6
7
|
import { map, distinctUntilChanged, filter, take, switchMap, distinctUntilKeyChanged, startWith, tap } from 'rxjs/operators';
|
|
7
8
|
import { RoutesService as RoutesService$1, LocalizationService, LocalizationPipe } from '@abp/ng.core';
|
|
8
9
|
import { toSignal } from '@angular/core/rxjs-interop';
|
|
@@ -823,9 +824,6 @@ function createWindowProvider(windowObj) {
|
|
|
823
824
|
};
|
|
824
825
|
}
|
|
825
826
|
|
|
826
|
-
const LOGO_URL_TOKEN = new InjectionToken('LOGO_URL_TOKEN');
|
|
827
|
-
const LOGO_APP_NAME_TOKEN = new InjectionToken('LOGO_APP_NAME_TOKEN');
|
|
828
|
-
|
|
829
827
|
var LpxLogoFeatureKind;
|
|
830
828
|
(function (LpxLogoFeatureKind) {
|
|
831
829
|
LpxLogoFeatureKind[LpxLogoFeatureKind["Options"] = 0] = "Options";
|
|
@@ -1182,6 +1180,9 @@ class NavbarService {
|
|
|
1182
1180
|
this.menuItems = inject(LPX_MENU_ITEMS);
|
|
1183
1181
|
this.store = new DataStore(this.addContainerLinks(this.menuItems));
|
|
1184
1182
|
this.navbarItems$ = this.store.sliceState((state) => state);
|
|
1183
|
+
// Source reference to navbar items, used for checking item existence
|
|
1184
|
+
// without being affected by potential future transformations of navbarItems$
|
|
1185
|
+
this.sourceNavbarItems$ = this.navbarItems$;
|
|
1185
1186
|
this.groupedNavbarItems$ = this.store
|
|
1186
1187
|
.sliceState((state) => state)
|
|
1187
1188
|
.pipe(map((items) => {
|
|
@@ -1202,28 +1203,31 @@ class NavbarService {
|
|
|
1202
1203
|
setNavbarItems(...menuItems) {
|
|
1203
1204
|
this.store.set([...this.addContainerLinks(menuItems)]);
|
|
1204
1205
|
}
|
|
1205
|
-
// TODO: muhammed: refactor this method to be readable
|
|
1206
1206
|
addChildren(id, ...menuItems) {
|
|
1207
1207
|
const parent = this.findById(id, this.store.state);
|
|
1208
1208
|
const update = (items, location, link = '') => {
|
|
1209
|
-
const
|
|
1209
|
+
const [currentIndex, ...remainingPath] = location;
|
|
1210
1210
|
return items.reduce((acc, item, index) => {
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1211
|
+
if (index === currentIndex) {
|
|
1212
|
+
const containerLink = item.containerLink || '';
|
|
1213
|
+
const childLink = `${link}/${containerLink}`;
|
|
1214
|
+
const isTargetParent = remainingPath.length === 0;
|
|
1215
|
+
let updatedChildren = update(item.children || [], remainingPath, childLink);
|
|
1216
|
+
if (isTargetParent) {
|
|
1217
|
+
updatedChildren = [
|
|
1218
|
+
...(item.children || []),
|
|
1219
|
+
...this.addContainerLinks(menuItems, childLink),
|
|
1220
|
+
];
|
|
1221
|
+
}
|
|
1222
|
+
return [
|
|
1223
|
+
...acc,
|
|
1224
|
+
{
|
|
1225
|
+
...item,
|
|
1226
|
+
children: updatedChildren,
|
|
1227
|
+
},
|
|
1228
|
+
];
|
|
1229
|
+
}
|
|
1230
|
+
return [...acc, item];
|
|
1227
1231
|
}, []);
|
|
1228
1232
|
};
|
|
1229
1233
|
const updated = update(this.store.state, parent.location);
|
|
@@ -1687,7 +1691,7 @@ class NavbarComponent {
|
|
|
1687
1691
|
this.injector = inject(Injector);
|
|
1688
1692
|
this.didResized = false;
|
|
1689
1693
|
this.initialHover = false;
|
|
1690
|
-
this.showFilterMenu$ = this.service.
|
|
1694
|
+
this.showFilterMenu$ = this.service.sourceNavbarItems$.pipe(map$1((items) => !!items.length));
|
|
1691
1695
|
this.contentBefore = this.flatContents(CONTENT_BEFORE_ROUTES);
|
|
1692
1696
|
this.contentAfter = this.flatContents(CONTENT_AFTER_ROUTES);
|
|
1693
1697
|
}
|