import { Injector , ElementRef } from '@angular/core' ; import { AppConsts } from '@shared/AppConsts' ; import { AppUrlService } from './nav/app-url.service' ; import { AppSessionService } from './session/app-session.service' ; import { ModalHelper } from '@delon/theme' ; import { LocalizationService , PermissionCheckerService , FeatureCheckerService , NotifyService , SettingService , MessageService , AbpMultiTenancyService } from 'abp-ng2-module' ; export abstract class AppComponentBase { localizationSourceName = AppConsts . localization . defaultLocalizationSourceName ; localization : LocalizationService ; permission : PermissionCheckerService ; feature : FeatureCheckerService ; notify : NotifyService ; setting : SettingService ; message : MessageService ; multiTenancy : AbpMultiTenancyService ; appSession : AppSessionService ; elementRef : ElementRef ; appUrlService : AppUrlService ; modalHelper : ModalHelper ; constructor ( injector ) { this . localization = injector . get ( LocalizationService ) ; this . permission = injector . get ( PermissionCheckerService ) ; this . feature = injector . get ( FeatureCheckerService ) ; this . notify = injector . get ( NotifyService ) ; this . setting = injector . get ( SettingService ) ; this . message = injector . get ( MessageService ) ; this . multiTenancy = injector . get ( AbpMultiTenancyService ) ; this . appSession = injector . get ( AppSessionService ) ; this . elementRef = injector . get ( ElementRef ) ; this . appUrlService = injector . get ( AppUrlService ) ; this . modalHelper = injector . get ( ModalHelper ) ; } l ( key , ... args ) { args . unshift ( key ) ; args . unshift ( this . localizationSourceName ) ; return this . ls . apply ( this , args ) ; } ls ( sourcename , key , ... args ) { let localizedText = this . localization . localize ( key , sourcename ) ; if ( ! localizedText ) { localizedText = key ; } if ( ! args || ! args . length ) { return localizedText ; } args . unshift ( localizedText ) ; return abp . utils . formatString . apply ( this , args ) ; } isGranted ( permissionName ) { return this . permission . isGranted ( permissionName ) ; } isGrantedAny ( ... permissions ) { if ( ! permissions ) { return false ; } for ( const permission of permissions ) { if ( this . isGranted ( permission ) ) { return true ; } } return false ; } s ( key ) { return abp . setting . get ( key ) ; } appRootUrl ( ) { return this . appUrlService . appRootUrl ; } }