Skip to content

Commit

Permalink
Merge pull request #10352 from abpframework/bs5-with-dev
Browse files Browse the repository at this point in the history
feat: move lazy style handler to theme basic
  • Loading branch information
mehmet-erim committed Oct 18, 2021
2 parents 45dc916 + eb41425 commit 29e7de2
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './lazy-style.handler';
Original file line number Diff line number Diff line change
Expand Up @@ -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[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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];

Expand Down Expand Up @@ -82,6 +83,7 @@ export class ThemeBasicModule {
provide: VALIDATION_INVALID_CLASSES,
useValue: 'is-invalid',
},
LazyStyleHandler,
],
};
}
Expand Down
1 change: 1 addition & 0 deletions npm/ng-packs/packages/theme-basic/src/lib/tokens/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './lazy-styles.token';
2 changes: 2 additions & 0 deletions npm/ng-packs/packages/theme-basic/src/public-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Original file line number Diff line number Diff line change
Expand Up @@ -179,5 +179,3 @@ ngb-typeahead-window, ngb-typeahead-window.dropdown-menu {
z-index: 1055 !important;
}
`;

export const BOOTSTRAP = 'bootstrap-{{dir}}.min.css';
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export * from './error.handler';
export * from './lazy-style.handler';
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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';
Expand All @@ -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';
Expand Down Expand Up @@ -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',
Expand Down
1 change: 0 additions & 1 deletion npm/ng-packs/packages/theme-shared/src/lib/tokens/index.ts
Original file line number Diff line number Diff line change
@@ -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';
1 change: 0 additions & 1 deletion npm/ng-packs/packages/theme-shared/src/public-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down

0 comments on commit 29e7de2

Please sign in to comment.