import { Subscription } from "rxjs" ; export abstract class SideBarItemBase implements SideBarItem { protected subscriptions : Subscription [ ] = [ ] ; private classes = [ 'side-bar-item' , 'side-bar-item-icon' ] ; protected constructor ( public displayText , public route , sideBarClasses ? , visible ? ) { if ( sideBarClasses ) { sideBarClasses . forEach ( c => this . classes . push ( c ) ) ; } this . visible = null == visible ? true : visible ; } public getClasses ( ) { const classObject = { } ; this . classes . forEach ( c => { classObject [ c ] = true ; } ) ; this . getStatusClasses ( ) . forEach ( c => { classObject [ c ] = true ; } ) ; if ( this . selected ) { classObject [ 'selected' ] = true ; } return classObject ; } public dispose ( ) { this . subscriptions . forEach ( subscription => subscription . unsubscribe ( ) ) ; } protected abstract getStatusClasses ( ) ; public getIndicatorClasses ( ) { return [ ] ; } order : number ; selected : boolean ; visible : boolean ; disabled ? : boolean ; iconClass ? : any ; } export class SimpleSideBarItem extends SideBarItemBase { constructor ( displayText , route , sideBarClasses ? , visible ? ) { super ( displayText , route , sideBarClasses , visible ) ; } protected getStatusClasses ( ) { return [ ] ; } } export interface SideBarItem { disabled ? : boolean ; iconClass ? : any ; selected : boolean ; displayText : string ; visible : boolean ; getClasses ( ) : any ; getIndicatorClasses ( ) : string [ ] ; route : string ; order : number ; }