-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(layout.service): provide some information to archive responsive …
…view
- Loading branch information
Showing
3 changed files
with
71 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* tslint:disable:no-unused-variable */ | ||
|
||
import { async, inject, TestBed } from '@angular/core/testing'; | ||
import { LayoutService } from './layout.service'; | ||
|
||
describe('Service: Layout', () => { | ||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
providers: [LayoutService], | ||
}); | ||
}); | ||
|
||
it('should ...', inject([LayoutService], (service: LayoutService) => { | ||
expect(service).toBeTruthy(); | ||
})); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { NbSidebarComponent } from '@nebular/theme'; | ||
import { mainModule } from 'process'; | ||
import { Observable, Subject } from 'rxjs'; | ||
import { map } from 'rxjs/operators'; | ||
import { CombErr, NothingFlow } from '../@dataflow/core'; | ||
|
||
export enum SidebarStatus { | ||
None, | ||
Icon, | ||
Full, | ||
} | ||
|
||
/** | ||
* @description provide some information to archive responsive view | ||
* @class LayoutService | ||
*/ | ||
@Injectable({ | ||
providedIn: 'root', | ||
}) | ||
export class LayoutService { | ||
mainSidebarTrigger = new Subject<SidebarStatus>(); | ||
// TODO: use it to replace other place | ||
mainSidebar$: NothingFlow<SidebarStatus>; | ||
constructor() { | ||
const outer = this; | ||
this.mainSidebar$ = new (class extends NothingFlow<SidebarStatus> { | ||
public prerequest$: Observable<CombErr<SidebarStatus>> = outer.mainSidebarTrigger.pipe( | ||
map(x => [x, []]) | ||
); | ||
})(); | ||
this.mainSidebar$.deploy(); | ||
this.mainSidebar$.getOutput().subscribe(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters