/* * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* eslint-disable import/order */ import { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core'; import { DelonACLModule } from '@delon/acl'; import { AlainThemeModule } from '@delon/theme'; import { AlainConfig, ALAIN_CONFIG } from '@delon/util/config'; import { throwIfAlreadyLoaded } from '@core'; import { environment } from '@env/environment'; // Please refer to: https://ng-alain.com/docs/global-config // #region NG-ALAIN Config const alainConfig: AlainConfig = { st: { modal: { size: 'lg' } }, pageHeader: { homeI18n: 'home' }, lodop: { license: `A59B099A586B3851E0F0D7FDBF37B603`, licenseA: `C94CEE276DB2187AE6B65D56B3FC2848` }, auth: { login_url: '/passport/login' } }; const alainModules: any[] = [AlainThemeModule.forRoot(), DelonACLModule.forRoot()]; const alainProvides = [{ provide: ALAIN_CONFIG, useValue: alainConfig }]; // #region reuse-tab /** * 若需要[路由复用](https://ng-alain.com/components/reuse-tab)需要: * 1、在 `shared-delon.module.ts` 导入 `ReuseTabModule` 模块 * 2、注册 `RouteReuseStrategy` * 3、在 `src/app/layout/default/default.component.html` 修改: * ```html *
* * *
* ``` */ // import { RouteReuseStrategy } from '@angular/router'; // import { ReuseTabService, ReuseTabStrategy } from '@delon/abc/reuse-tab'; // alainProvides.push({ // provide: RouteReuseStrategy, // useClass: ReuseTabStrategy, // deps: [ReuseTabService], // } as any); // #endregion // #endregion // Please refer to: https://ng.ant.design/docs/global-config/en#how-to-use // #region NG-ZORRO Config import { NzConfig, NZ_CONFIG } from 'ng-zorro-antd/core/config'; const ngZorroConfig: NzConfig = {}; const zorroProvides = [{ provide: NZ_CONFIG, useValue: ngZorroConfig }]; // #endregion @NgModule({ imports: [...alainModules, ...(environment.modules || [])] }) export class GlobalConfigModule { constructor(@Optional() @SkipSelf() parentModule: GlobalConfigModule) { throwIfAlreadyLoaded(parentModule, 'GlobalConfigModule'); } static forRoot(): ModuleWithProviders { return { ngModule: GlobalConfigModule, providers: [...alainProvides, ...zorroProvides] }; } }