mirror of https://github.com/abpframework/abp.git
committed by
GitHub
9 changed files with 78 additions and 61 deletions
@ -0,0 +1 @@ |
|||||
|
export * from './styles.provider'; |
||||
@ -0,0 +1,42 @@ |
|||||
|
import { AddReplaceableComponent, CONTENT_STRATEGY, DomInsertionService } from '@abp/ng.core'; |
||||
|
import { APP_INITIALIZER } from '@angular/core'; |
||||
|
import { Store } from '@ngxs/store'; |
||||
|
import { AccountLayoutComponent } from '../components/account-layout/account-layout.component'; |
||||
|
import { ApplicationLayoutComponent } from '../components/application-layout/application-layout.component'; |
||||
|
import { EmptyLayoutComponent } from '../components/empty-layout/empty-layout.component'; |
||||
|
import styles from '../constants/styles'; |
||||
|
import { eThemeBasicComponents } from '../enums/components'; |
||||
|
|
||||
|
export const BASIC_THEME_STYLES_PROVIDERS = [ |
||||
|
{ |
||||
|
provide: APP_INITIALIZER, |
||||
|
useFactory: configureStyles, |
||||
|
deps: [DomInsertionService, Store], |
||||
|
multi: true, |
||||
|
}, |
||||
|
]; |
||||
|
|
||||
|
export function configureStyles(domInsertion: DomInsertionService, store: Store) { |
||||
|
return () => { |
||||
|
domInsertion.insertContent(CONTENT_STRATEGY.AppendStyleToHead(styles)); |
||||
|
|
||||
|
initLayouts(store); |
||||
|
}; |
||||
|
} |
||||
|
|
||||
|
function initLayouts(store: Store) { |
||||
|
store.dispatch([ |
||||
|
new AddReplaceableComponent({ |
||||
|
key: eThemeBasicComponents.ApplicationLayout, |
||||
|
component: ApplicationLayoutComponent, |
||||
|
}), |
||||
|
new AddReplaceableComponent({ |
||||
|
key: eThemeBasicComponents.AccountLayout, |
||||
|
component: AccountLayoutComponent, |
||||
|
}), |
||||
|
new AddReplaceableComponent({ |
||||
|
key: eThemeBasicComponents.EmptyLayout, |
||||
|
component: EmptyLayoutComponent, |
||||
|
}), |
||||
|
]); |
||||
|
} |
||||
@ -1,2 +1 @@ |
|||||
export * from './initial.service'; |
|
||||
export * from './layout-state.service'; |
export * from './layout-state.service'; |
||||
|
|||||
@ -1,34 +0,0 @@ |
|||||
import { DomInsertionService, AddReplaceableComponent, CONTENT_STRATEGY } from '@abp/ng.core'; |
|
||||
import { Injectable } from '@angular/core'; |
|
||||
import { Store } from '@ngxs/store'; |
|
||||
import styles from '../constants/styles'; |
|
||||
import { ApplicationLayoutComponent } from '../components/application-layout/application-layout.component'; |
|
||||
import { AccountLayoutComponent } from '../components/account-layout/account-layout.component'; |
|
||||
import { EmptyLayoutComponent } from '../components/empty-layout/empty-layout.component'; |
|
||||
import { eThemeBasicComponents } from '../enums/components'; |
|
||||
|
|
||||
@Injectable({ providedIn: 'root' }) |
|
||||
export class InitialService { |
|
||||
constructor(private domInsertion: DomInsertionService, private store: Store) { |
|
||||
this.appendStyle(); |
|
||||
|
|
||||
this.store.dispatch([ |
|
||||
new AddReplaceableComponent({ |
|
||||
key: eThemeBasicComponents.ApplicationLayout, |
|
||||
component: ApplicationLayoutComponent, |
|
||||
}), |
|
||||
new AddReplaceableComponent({ |
|
||||
key: eThemeBasicComponents.AccountLayout, |
|
||||
component: AccountLayoutComponent, |
|
||||
}), |
|
||||
new AddReplaceableComponent({ |
|
||||
key: eThemeBasicComponents.EmptyLayout, |
|
||||
component: EmptyLayoutComponent, |
|
||||
}), |
|
||||
]); |
|
||||
} |
|
||||
|
|
||||
appendStyle() { |
|
||||
this.domInsertion.insertContent(CONTENT_STRATEGY.AppendStyleToHead(styles)); |
|
||||
} |
|
||||
} |
|
||||
Loading…
Reference in new issue