mirror of
https://github.com/akveo/ngx-admin.git
synced 2026-01-23 17:56:09 +01:00
feat(layouts): layouts + theme settings panel preview
This commit is contained in:
parent
6fe593295d
commit
eef4d0633c
20 changed files with 636 additions and 19 deletions
|
|
@ -3,10 +3,12 @@ import { CommonModule } from '@angular/common';
|
|||
|
||||
import { UserService } from './users.service';
|
||||
import { ElectricityService } from './electricity.service';
|
||||
import { StateService } from './state.service';
|
||||
|
||||
const SERVICES = [
|
||||
UserService,
|
||||
ElectricityService,
|
||||
StateService,
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ export class ElectricityService {
|
|||
constructor() {
|
||||
}
|
||||
|
||||
// TODO: observables
|
||||
getData() {
|
||||
return this.data;
|
||||
}
|
||||
|
|
|
|||
74
src/app/@core/data/state.service.ts
Normal file
74
src/app/@core/data/state.service.ts
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
|
||||
import 'rxjs/add/observable/of';
|
||||
|
||||
@Injectable()
|
||||
export class StateService {
|
||||
|
||||
protected layouts: any = [
|
||||
{
|
||||
name: 'One Column',
|
||||
icon: 'ion ion-grid',
|
||||
id: 'one-column',
|
||||
selected: true,
|
||||
},
|
||||
{
|
||||
name: 'Two Column',
|
||||
icon: 'ion ion-grid',
|
||||
id: 'two-column',
|
||||
},
|
||||
{
|
||||
name: 'Three Column',
|
||||
icon: 'ion ion-grid',
|
||||
id: 'three-column',
|
||||
},
|
||||
{
|
||||
name: 'Center Column',
|
||||
icon: 'ion ion-grid',
|
||||
id: 'center-column',
|
||||
},
|
||||
];
|
||||
|
||||
protected sidebars: any = [
|
||||
{
|
||||
name: 'Left Sidebar',
|
||||
icon: 'ion ion-grid',
|
||||
id: 'left',
|
||||
selected: true,
|
||||
},
|
||||
{
|
||||
name: 'Right Sidebar',
|
||||
icon: 'ion ion-grid',
|
||||
id: 'right',
|
||||
},
|
||||
];
|
||||
|
||||
protected layoutState$ = new BehaviorSubject(this.layouts[0]);
|
||||
protected sidebarState$ = new BehaviorSubject(this.sidebars[0]);
|
||||
|
||||
setLayoutState(state: any): any {
|
||||
this.layoutState$.next(state);
|
||||
}
|
||||
|
||||
getLayoutStates(): Observable<any[]> {
|
||||
return Observable.of(this.layouts);
|
||||
}
|
||||
|
||||
onLayoutState(): Observable<any> {
|
||||
return this.layoutState$.asObservable();
|
||||
}
|
||||
|
||||
setSidebarState(state: any): any {
|
||||
this.sidebarState$.next(state);
|
||||
}
|
||||
|
||||
getSidebarStates(): Observable<any[]> {
|
||||
return Observable.of(this.sidebars);
|
||||
}
|
||||
|
||||
onSidebarState(): Observable<any> {
|
||||
return this.sidebarState$.asObservable();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue