feat: add styles provider to theme basic package

pull/4455/head
Arman Ozak 5 years ago
parent a78702de40
commit f607958b0e

@ -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,
}),
]);
}

@ -2,10 +2,11 @@
* Public API Surface of theme-basic
*/
export * from './lib/theme-basic.module';
export * from './lib/actions';
export * from './lib/components';
export * from './lib/enums';
export * from './lib/models';
export * from './lib/providers';
export * from './lib/services';
export * from './lib/states';
export * from './lib/theme-basic.module';

Loading…
Cancel
Save