diff --git a/npm/ng-packs/packages/theme-basic/src/lib/handlers/index.ts b/npm/ng-packs/packages/theme-basic/src/lib/handlers/index.ts new file mode 100644 index 0000000000..d671e474ee --- /dev/null +++ b/npm/ng-packs/packages/theme-basic/src/lib/handlers/index.ts @@ -0,0 +1 @@ +export * from './lazy-style.handler'; diff --git a/npm/ng-packs/packages/theme-shared/src/lib/handlers/lazy-style.handler.ts b/npm/ng-packs/packages/theme-basic/src/lib/handlers/lazy-style.handler.ts similarity index 94% rename from npm/ng-packs/packages/theme-shared/src/lib/handlers/lazy-style.handler.ts rename to npm/ng-packs/packages/theme-basic/src/lib/handlers/lazy-style.handler.ts index 79bed70563..36e9f5c1f1 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/handlers/lazy-style.handler.ts +++ b/npm/ng-packs/packages/theme-basic/src/lib/handlers/lazy-style.handler.ts @@ -4,15 +4,13 @@ import { LOADING_STRATEGY, LocalizationService, } from '@abp/ng.core'; +import { LocaleDirection } from '@abp/ng.theme.shared'; import { Injectable, Injector } from '@angular/core'; -import { map, startWith } from 'rxjs/operators'; -import { BOOTSTRAP } from '../constants/styles'; -import { LocaleDirection } from '../models/common'; +import { startWith } from 'rxjs/operators'; import { LAZY_STYLES } from '../tokens/lazy-styles.token'; +export const BOOTSTRAP = 'bootstrap-{{dir}}.min.css'; -@Injectable({ - providedIn: 'root', -}) +@Injectable() export class LazyStyleHandler { private lazyLoad: LazyLoadService; private styles: string[]; diff --git a/npm/ng-packs/packages/theme-basic/src/lib/theme-basic.module.ts b/npm/ng-packs/packages/theme-basic/src/lib/theme-basic.module.ts index 99a493c85a..5e87a42104 100644 --- a/npm/ng-packs/packages/theme-basic/src/lib/theme-basic.module.ts +++ b/npm/ng-packs/packages/theme-basic/src/lib/theme-basic.module.ts @@ -9,19 +9,20 @@ import { VALIDATION_TARGET_SELECTOR, } from '@ngx-validate/core'; import { AccountLayoutComponent } from './components/account-layout/account-layout.component'; +import { AuthWrapperComponent } from './components/account-layout/auth-wrapper/auth-wrapper.component'; +import { TenantBoxComponent } from './components/account-layout/tenant-box/tenant-box.component'; import { ApplicationLayoutComponent } from './components/application-layout/application-layout.component'; import { EmptyLayoutComponent } from './components/empty-layout/empty-layout.component'; import { LogoComponent } from './components/logo/logo.component'; import { CurrentUserComponent } from './components/nav-items/current-user.component'; import { LanguagesComponent } from './components/nav-items/languages.component'; import { NavItemsComponent } from './components/nav-items/nav-items.component'; +import { PageAlertContainerComponent } from './components/page-alert-container/page-alert-container.component'; import { RoutesComponent } from './components/routes/routes.component'; import { ValidationErrorComponent } from './components/validation-error/validation-error.component'; +import { LazyStyleHandler } from './handlers/lazy-style.handler'; import { BASIC_THEME_NAV_ITEM_PROVIDERS } from './providers/nav-item.provider'; import { BASIC_THEME_STYLES_PROVIDERS } from './providers/styles.provider'; -import { PageAlertContainerComponent } from './components/page-alert-container/page-alert-container.component'; -import { TenantBoxComponent } from './components/account-layout/tenant-box/tenant-box.component'; -import { AuthWrapperComponent } from './components/account-layout/auth-wrapper/auth-wrapper.component'; export const LAYOUTS = [ApplicationLayoutComponent, AccountLayoutComponent, EmptyLayoutComponent]; @@ -82,6 +83,7 @@ export class ThemeBasicModule { provide: VALIDATION_INVALID_CLASSES, useValue: 'is-invalid', }, + LazyStyleHandler, ], }; } diff --git a/npm/ng-packs/packages/theme-basic/src/lib/tokens/index.ts b/npm/ng-packs/packages/theme-basic/src/lib/tokens/index.ts new file mode 100644 index 0000000000..b817d0dba7 --- /dev/null +++ b/npm/ng-packs/packages/theme-basic/src/lib/tokens/index.ts @@ -0,0 +1 @@ +export * from './lazy-styles.token'; diff --git a/npm/ng-packs/packages/theme-shared/src/lib/tokens/lazy-styles.token.ts b/npm/ng-packs/packages/theme-basic/src/lib/tokens/lazy-styles.token.ts similarity index 100% rename from npm/ng-packs/packages/theme-shared/src/lib/tokens/lazy-styles.token.ts rename to npm/ng-packs/packages/theme-basic/src/lib/tokens/lazy-styles.token.ts diff --git a/npm/ng-packs/packages/theme-basic/src/public-api.ts b/npm/ng-packs/packages/theme-basic/src/public-api.ts index 9b5870914b..5c607ca06d 100644 --- a/npm/ng-packs/packages/theme-basic/src/public-api.ts +++ b/npm/ng-packs/packages/theme-basic/src/public-api.ts @@ -4,6 +4,8 @@ export * from './lib/components'; export * from './lib/enums'; +export * from './lib/handlers'; export * from './lib/models'; export * from './lib/providers'; export * from './lib/theme-basic.module'; +export * from './lib/tokens'; diff --git a/npm/ng-packs/packages/theme-shared/src/lib/constants/styles.ts b/npm/ng-packs/packages/theme-shared/src/lib/constants/styles.ts index c8e6d7f0d6..4a3d36861c 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/constants/styles.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/constants/styles.ts @@ -179,5 +179,3 @@ ngb-typeahead-window, ngb-typeahead-window.dropdown-menu { z-index: 1055 !important; } `; - -export const BOOTSTRAP = 'bootstrap-{{dir}}.min.css'; diff --git a/npm/ng-packs/packages/theme-shared/src/lib/handlers/index.ts b/npm/ng-packs/packages/theme-shared/src/lib/handlers/index.ts index 11eb07398e..7b46abdd69 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/handlers/index.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/handlers/index.ts @@ -1,2 +1 @@ export * from './error.handler'; -export * from './lazy-style.handler'; diff --git a/npm/ng-packs/packages/theme-shared/src/lib/theme-shared.module.ts b/npm/ng-packs/packages/theme-shared/src/lib/theme-shared.module.ts index 0dcbb525db..b863c992a5 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/theme-shared.module.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/theme-shared.module.ts @@ -1,6 +1,6 @@ import { CoreModule, noop } from '@abp/ng.core'; import { DatePipe } from '@angular/common'; -import { APP_INITIALIZER, Injector, ModuleWithProviders, NgModule } from '@angular/core'; +import { APP_INITIALIZER, ModuleWithProviders, NgModule } from '@angular/core'; import { NgbDateParserFormatter, NgbPaginationModule } from '@ng-bootstrap/ng-bootstrap'; import { defaultMapErrorsFn, @@ -10,8 +10,8 @@ import { VALIDATION_VALIDATE_ON_SUBMIT, } from '@ngx-validate/core'; import { NgxDatatableModule } from '@swimlane/ngx-datatable'; -import { BreadcrumbComponent } from './components/breadcrumb/breadcrumb.component'; import { BreadcrumbItemsComponent } from './components/breadcrumb-items/breadcrumb-items.component'; +import { BreadcrumbComponent } from './components/breadcrumb/breadcrumb.component'; import { ButtonComponent } from './components/button/button.component'; import { ConfirmationComponent } from './components/confirmation/confirmation.component'; import { HttpErrorWrapperComponent } from './components/http-error-wrapper/http-error-wrapper.component'; @@ -27,7 +27,6 @@ import { LoadingDirective } from './directives/loading.directive'; import { NgxDatatableDefaultDirective } from './directives/ngx-datatable-default.directive'; import { NgxDatatableListDirective } from './directives/ngx-datatable-list.directive'; import { ErrorHandler } from './handlers/error.handler'; -import { initLazyStyleHandler } from './handlers/lazy-style.handler'; import { RootParams } from './models/common'; import { NG_BOOTSTRAP_CONFIG_PROVIDERS } from './providers'; import { THEME_SHARED_ROUTE_PROVIDERS } from './providers/route.provider'; @@ -95,12 +94,6 @@ export class ThemeSharedModule { deps: [THEME_SHARED_APPEND_CONTENT], useFactory: noop, }, - { - provide: APP_INITIALIZER, - multi: true, - deps: [Injector], - useFactory: initLazyStyleHandler, - }, { provide: HTTP_ERROR_CONFIG, useValue: httpErrorConfig }, { provide: 'HTTP_ERROR_CONFIG', diff --git a/npm/ng-packs/packages/theme-shared/src/lib/tokens/index.ts b/npm/ng-packs/packages/theme-shared/src/lib/tokens/index.ts index 148c34084c..98edb1a87b 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/tokens/index.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/tokens/index.ts @@ -1,5 +1,4 @@ export * from './append-content.token'; export * from './http-error.token'; -export * from './lazy-styles.token'; export * from './ngx-datatable-messages.token'; export * from './suppress-unsaved-changes-warning.token'; diff --git a/npm/ng-packs/packages/theme-shared/src/public-api.ts b/npm/ng-packs/packages/theme-shared/src/public-api.ts index 845655402d..56cd9936a7 100644 --- a/npm/ng-packs/packages/theme-shared/src/public-api.ts +++ b/npm/ng-packs/packages/theme-shared/src/public-api.ts @@ -4,7 +4,6 @@ export * from './lib/animations'; export * from './lib/components'; -export { BOOTSTRAP } from './lib/constants/styles'; export * from './lib/constants/validation'; export * from './lib/directives'; export * from './lib/enums';