数据可视化大屏
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

91 rinda
3.0KB

  1. import { provideHttpClient, withInterceptors } from '@angular/common/http';
  2. import { default as ngLang } from '@angular/common/locales/zh';
  3. import { ApplicationConfig, EnvironmentProviders, Provider } from '@angular/core';
  4. import { provideAnimations } from '@angular/platform-browser/animations';
  5. import {
  6. provideRouter,
  7. withComponentInputBinding,
  8. withViewTransitions,
  9. withInMemoryScrolling,
  10. withHashLocation,
  11. RouterFeatures
  12. } from '@angular/router';
  13. import { defaultInterceptor, provideStartup } from '@core';
  14. import { provideCellWidgets } from '@delon/abc/cell';
  15. import { provideSTWidgets } from '@delon/abc/st';
  16. import { authSimpleInterceptor, provideAuth } from '@delon/auth';
  17. import { provideSFConfig } from '@delon/form';
  18. import { AlainProvideLang, provideAlain, zh_CN as delonLang } from '@delon/theme';
  19. import { AlainConfig } from '@delon/util/config';
  20. import { environment } from '@env/environment';
  21. import { CELL_WIDGETS, ST_WIDGETS, SF_WIDGETS } from '@shared';
  22. import { zhCN as dateLang } from 'date-fns/locale';
  23. import { NzConfig, provideNzConfig } from 'ng-zorro-antd/core/config';
  24. import { zh_CN as zorroLang } from 'ng-zorro-antd/i18n';
  25. import { provideBindAuthRefresh } from './core/net';
  26. import { routes } from './routes/routes';
  27. import { ICONS } from '../style-icons';
  28. import { ICONS_AUTO } from '../style-icons-auto';
  29. import { IMqttServiceOptions, MqttService } from 'ngx-mqtt';
  30. export const MQTT_SERVICE_OPTIONS: IMqttServiceOptions = {
  31. hostname: '127.0.0.1',
  32. port: 1883,
  33. path: '/mqtt',
  34. protocol: 'ws'
  35. // ...其他配置项,例如用户名和密码
  36. };
  37. const defaultLang: AlainProvideLang = {
  38. abbr: 'zh-CN',
  39. ng: ngLang,
  40. zorro: zorroLang,
  41. date: dateLang,
  42. delon: delonLang
  43. };
  44. const alainConfig: AlainConfig = {
  45. auth: { login_url: '/passport/login' }
  46. };
  47. const ngZorroConfig: NzConfig = {};
  48. const routerFeatures: RouterFeatures[] = [
  49. withComponentInputBinding(),
  50. withViewTransitions(),
  51. withInMemoryScrolling({ scrollPositionRestoration: 'top' })
  52. ];
  53. if (environment.useHash) routerFeatures.push(withHashLocation());
  54. const providers: Array<Provider | EnvironmentProviders> = [
  55. provideHttpClient(withInterceptors([...(environment.interceptorFns ?? []), authSimpleInterceptor, defaultInterceptor])),
  56. provideAnimations(),
  57. provideRouter(routes, ...routerFeatures),
  58. provideAlain({ config: alainConfig, defaultLang, icons: [...ICONS_AUTO, ...ICONS] }),
  59. provideNzConfig(ngZorroConfig),
  60. provideAuth(),
  61. provideCellWidgets(...CELL_WIDGETS),
  62. provideSTWidgets(...ST_WIDGETS),
  63. provideSFConfig({
  64. widgets: [...SF_WIDGETS]
  65. }),
  66. provideStartup(),
  67. {
  68. provide: MqttService,
  69. useFactory: () => {
  70. return new MqttService(MQTT_SERVICE_OPTIONS);
  71. }
  72. },
  73. ...(environment.providers || [])
  74. ];
  75. // If you use `@delon/auth` to refresh the token, additional registration `provideBindAuthRefresh` is required
  76. if (environment.api?.refreshTokenEnabled && environment.api.refreshTokenType === 'auth-refresh') {
  77. providers.push(provideBindAuthRefresh());
  78. }
  79. export const appConfig: ApplicationConfig = {
  80. providers: providers
  81. };