Skip to content

Commit 8f9151d

Browse files
committed
add layoutStore.setSidebarLeftMenuActiveUrl
1 parent 5a5ce68 commit 8f9151d

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

src/layout/layout.state.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export interface LayoutState {
1010
sidebarLeftElementHeight?: number;
1111
sidebarRightElementHeight?: number;
1212
sidebarLeftMenu?: Array<Object>;
13+
sidebarLeftMenuActiveUrl?: string;
1314
skin?: string;
1415
windowInnerHeight?: number;
1516
windowInnerWidth?: number;

src/layout/layout.store.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export class LayoutStore {
2323
isSidebarRightOverContent: true,
2424
layout: 'normal',
2525
sidebarLeftMenu: [],
26+
sidebarLeftMenuActiveUrl: '',
2627
skin: 'blue',
2728
};
2829

@@ -126,6 +127,15 @@ export class LayoutStore {
126127
return <Observable<Array<any>>>this.layoutState.pluck('sidebarLeftMenu').distinctUntilChanged();
127128
}
128129

130+
/**
131+
* [sidebarLeftMenuActiveUrl description]
132+
* @method sidebarLeftMenuActiveUrl
133+
* @return {Observable} [description]
134+
*/
135+
get sidebarLeftMenuActiveUrl(): Observable<string> {
136+
return <Observable<string>>this.layoutState.pluck('sidebarLeftMenuActiveUrl').distinctUntilChanged();
137+
}
138+
129139
/**
130140
* [sidebarLeftElementHeight description]
131141
* @method sidebarLeftElementHeight
@@ -253,14 +263,25 @@ export class LayoutStore {
253263
/**
254264
* [setSidebarLeftMenu description]
255265
* @method setSidebarLeftMenu
256-
* @param {string} value [description]
266+
* @param {Array<any>} value [description]
257267
*/
258268
public setSidebarLeftMenu(value: Array<any>): void {
259269
this._layoutState.next(
260270
Object.assign(this._layoutState.value, {sidebarLeftMenu: value})
261271
);
262272
}
263273

274+
/**
275+
* [setSidebarLeftMenuActiveUrl description]
276+
* @method setSidebarLeftMenuActiveUrl
277+
* @param {string} value [description]
278+
*/
279+
public setSidebarLeftMenuActiveUrl(value: string): void {
280+
this._layoutState.next(
281+
Object.assign(this._layoutState.value, {sidebarLeftMenuActiveUrl: value})
282+
);
283+
}
284+
264285
/**
265286
* [setLayout description]
266287
* @method setLayout

src/layout/sidebar-left/sidebar-left.component.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ export class SidebarLeftComponent implements OnInit, AfterViewInit, OnDestroy {
8585
this.menu = value;
8686
this.monkeyPatchMenu(this.menu);
8787
}));
88+
this.subscriptions.push(this.layoutStore.sidebarLeftMenuActiveUrl.subscribe(value => {
89+
this.setMenuListeners(value);
90+
}));
8891
this.subscriptions.push(this.routingService.events.subscribe((event: RouterEvent) => {
8992
if(event instanceof NavigationEnd) {
9093
this.setMenuListeners(event.url);

0 commit comments

Comments
 (0)