-
Notifications
You must be signed in to change notification settings - Fork 672
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
420 additions
and
513 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import { provideHttpClient, withInterceptors } from '@angular/common/http'; | ||
import { default as ngLang } from '@angular/common/locales/zh'; | ||
import { ApplicationConfig, EnvironmentProviders, Provider } from '@angular/core'; | ||
import { provideAnimations } from '@angular/platform-browser/animations'; | ||
import { provideRouter, withComponentInputBinding, withInMemoryScrolling, withHashLocation, RouterFeatures } from '@angular/router'; | ||
import { <% if (i18n) { %>I18NService, <% } %>defaultInterceptor, provideStartup } from '@core'; | ||
import { provideCellWidgets } from '@delon/abc/cell'; | ||
import { provideSTWidgets } from '@delon/abc/st'; | ||
import { authSimpleInterceptor, provideAuth } from '@delon/auth';<% if (form) { %> | ||
import { provideSFConfig } from '@delon/form';<% } %> | ||
import { AlainProvideLang, provideAlain, zh_CN as delonLang } from '@delon/theme'; | ||
import { AlainConfig } from '@delon/util/config'; | ||
import { environment } from '@env/environment'; | ||
import { CELL_WIDGETS, ST_WIDGETS<% if (form) { %>, SF_WIDGETS<% } %> } from '@shared'; | ||
import { zhCN as dateLang } from 'date-fns/locale'; | ||
import { NzConfig, provideNzConfig } from 'ng-zorro-antd/core/config'; | ||
import { zh_CN as zorroLang } from 'ng-zorro-antd/i18n'; | ||
import { ICONS } from 'src/style-icons'; | ||
import { ICONS_AUTO } from 'src/style-icons-auto'; | ||
|
||
import { provideBindAuthRefresh } from './core/net'; | ||
import { routes } from './routes/routes'; | ||
|
||
const defaultLang: AlainProvideLang = { | ||
abbr: 'zh-CN', | ||
ng: ngLang, | ||
zorro: zorroLang, | ||
date: dateLang, | ||
delon: delonLang | ||
}; | ||
|
||
const alainConfig: AlainConfig = { | ||
auth: { login_url: '/passport/login' } | ||
}; | ||
|
||
const ngZorroConfig: NzConfig = {}; | ||
|
||
const routerFeatures: RouterFeatures[] = [withComponentInputBinding(), withInMemoryScrolling({ scrollPositionRestoration: 'top' })]; | ||
if (environment.useHash) routerFeatures.push(withHashLocation()); | ||
|
||
const providers: Array<Provider | EnvironmentProviders> = [ | ||
provideHttpClient(withInterceptors([...(environment.interceptorFns ?? []), authSimpleInterceptor, defaultInterceptor])), | ||
provideAnimations(), | ||
provideRouter(routes, ...routerFeatures), | ||
provideAlain({ config: alainConfig, defaultLang<% if (i18n) { %>, i18nClass: I18NService<% } %>, icons: [...ICONS_AUTO, ...ICONS] }), | ||
provideNzConfig(ngZorroConfig), | ||
provideAuth(), | ||
provideCellWidgets(...CELL_WIDGETS), | ||
provideSTWidgets(...ST_WIDGETS),<% if (form) { %> | ||
provideSFConfig({ | ||
widgets: [ | ||
...SF_WIDGETS | ||
// withUploadWidget() | ||
] | ||
}),<% } %> | ||
provideStartup(), | ||
...(environment.providers || []) | ||
]; | ||
|
||
// If you use `@delon/auth` to refresh the token, additional registration `provideBindAuthRefresh` is required | ||
if (environment.api?.refreshTokenEnabled && environment.api.refreshTokenType === 'auth-refresh') { | ||
providers.push(provideBindAuthRefresh()); | ||
} | ||
|
||
export const appConfig: ApplicationConfig = { | ||
providers: providers | ||
}; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
<% if (i18n) { %>export * from './i18n/i18n.service';<% } %> | ||
export * from './module-import-guard'; | ||
export * from './net/default.interceptor'; | ||
export * from './startup/startup.service'; | ||
export * from './start-page.guard'; | ||
export * from './start-page.guard';<% if (i18n) { %> | ||
export * from './i18n/i18n.service';<% } %> |
122 changes: 56 additions & 66 deletions
122
schematics/application/files/src/app/core/startup/startup.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.