@yelon/bis 15.1.0-29196db0 → 15.1.0-f09cdbae

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Component, ChangeDetectionStrategy, HostListener, Injectable, Inject, Input, Optional, NgModule, APP_INITIALIZER } from '@angular/core';
3
- import { of, forkJoin, map, Subject, takeUntil, mergeMap, mergeAll, BehaviorSubject, throwError, filter, take, switchMap, catchError } from 'rxjs';
3
+ import { Subject, takeUntil, of, catchError, forkJoin, map, mergeMap, mergeAll, BehaviorSubject, throwError, filter, take, switchMap } from 'rxjs';
4
4
  import * as i1$4 from '@yelon/util';
5
- import { WINDOW, log as log$1, deepCopy, YunzaiConfigService } from '@yelon/util';
5
+ import { WINDOW, hasFavicon, setFavicon, log as log$1, deepCopy, YunzaiConfigService } from '@yelon/util';
6
6
  import * as i1$5 from '@yelon/theme/layout-default';
7
7
  import * as i1$3 from '@yelon/cache';
8
8
  import { CacheService } from '@yelon/cache';
@@ -20,26 +20,25 @@ import * as i9 from 'ng-zorro-antd/avatar';
20
20
  import * as i1 from 'ng-zorro-antd/modal';
21
21
  import * as i1$1 from 'ng-zorro-antd/message';
22
22
  import * as i1$2 from '@yelon/theme';
23
- import { zh_CN as zh_CN$1, zh_TW as zh_TW$1, en_US as en_US$1, el_GR as el_GR$1, es_ES as es_ES$1, fr_FR as fr_FR$1, hr_HR as hr_HR$1, it_IT as it_IT$1, ja_JP as ja_JP$1, ko_KR as ko_KR$1, pl_PL as pl_PL$1, sl_SI as sl_SI$1, tr_TR as tr_TR$1, YunzaiI18nBaseService, YUNZAI_I18N_TOKEN, _HttpClient } from '@yelon/theme';
23
+ import { zh_CN as zh_CN$1, zh_TW as zh_TW$1, en_US as en_US$1, el_GR as el_GR$1, es_ES as es_ES$1, fr_FR as fr_FR$1, hr_HR as hr_HR$1, it_IT as it_IT$1, ko_KR as ko_KR$1, pl_PL as pl_PL$1, sl_SI as sl_SI$1, tr_TR as tr_TR$1, YunzaiI18nBaseService, YUNZAI_I18N_TOKEN, _HttpClient } from '@yelon/theme';
24
24
  import screenfull from 'screenfull';
25
25
  import { __decorate } from 'tslib';
26
26
  import { InputBoolean } from '@yelon/util/decorator';
27
- import ngElGr from '@angular/common/locales/el';
28
27
  import ngEn from '@angular/common/locales/en';
28
+ import { zhCN, zhTW, enUS, el, es, fr, hr, it, ko, pl, sl, tr } from 'date-fns/locale';
29
+ import * as i2 from 'ng-zorro-antd/i18n';
30
+ import { zh_CN, zh_TW, en_US, el_GR, es_ES, fr_FR, hr_HR, it_IT, ko_KR, pl_PL, sl_SI, tr_TR } from 'ng-zorro-antd/i18n';
31
+ import ngElGr from '@angular/common/locales/el';
29
32
  import ngEsEs from '@angular/common/locales/es';
30
33
  import ngFr from '@angular/common/locales/fr';
31
34
  import ngHr from '@angular/common/locales/hr';
32
35
  import ngIt from '@angular/common/locales/it';
33
- import ngJa from '@angular/common/locales/ja';
34
36
  import ngKo from '@angular/common/locales/ko';
35
37
  import ngPl from '@angular/common/locales/pl';
36
38
  import ngSl from '@angular/common/locales/sl';
37
39
  import ngTr from '@angular/common/locales/tr';
38
40
  import ngZh from '@angular/common/locales/zh';
39
41
  import ngZhTw from '@angular/common/locales/zh-Hant';
40
- import { zhCN, zhTW, enUS, el, es, fr, hr, it, ja, ko, pl, sl, tr } from 'date-fns/locale';
41
- import * as i2 from 'ng-zorro-antd/i18n';
42
- import { zh_CN, zh_TW, en_US, el_GR, es_ES, fr_FR, hr_HR, it_IT, ja_JP, ko_KR, pl_PL, sl_SI, tr_TR } from 'ng-zorro-antd/i18n';
43
42
  import * as i3$1 from '@angular/cdk/platform';
44
43
  import * as i4 from '@yelon/util/config';
45
44
  import { YunzaiConfigService as YunzaiConfigService$1 } from '@yelon/util/config';
@@ -221,14 +220,6 @@ const YUNZAI_LANGS = {
221
220
  yelon: it_IT$1,
222
221
  abbr: '🇮🇹'
223
222
  },
224
- 'ja-JP': {
225
- text: '日本語',
226
- ng: ngJa,
227
- zorro: ja_JP,
228
- date: ja,
229
- yelon: ja_JP$1,
230
- abbr: '🇯🇵'
231
- },
232
223
  'ko-KR': {
233
224
  text: '한국어',
234
225
  ng: ngKo,
@@ -274,13 +265,14 @@ class YunzaiI18NService extends YunzaiI18nBaseService {
274
265
  this.platform = platform;
275
266
  this.cacheService = cacheService;
276
267
  this._defaultLang = DEFAULT;
277
- this._langs = Object.keys(YUNZAI_LANGS).map(code => {
278
- const item = YUNZAI_LANGS[code];
279
- return { code, text: item.text, abbr: item.abbr };
280
- });
281
- this.bisConf = mergeBisConfig(cogSrv);
268
+ this.destroy$ = new Subject();
282
269
  const defaultLang = this.getDefaultLang();
283
- this._defaultLang = this._langs.findIndex(w => w.code === defaultLang) === -1 ? DEFAULT : defaultLang;
270
+ this.bis = mergeBisConfig(cogSrv);
271
+ this.getLangs()
272
+ .pipe(takeUntil(this.destroy$))
273
+ .subscribe(langs => {
274
+ this._defaultLang = langs.findIndex(w => w.code === defaultLang) === -1 ? DEFAULT : defaultLang;
275
+ });
284
276
  }
285
277
  getDefaultLang() {
286
278
  if (!this.platform.isBrowser) {
@@ -303,7 +295,9 @@ class YunzaiI18NService extends YunzaiI18nBaseService {
303
295
  return this.http.get(`assets/tmp/i18n/${lang}.json`);
304
296
  }
305
297
  else {
306
- return this.http.get(`${this.bisConf.baseUrl}/i18n/${lang}`);
298
+ return this.http
299
+ .get(`${this.bis.baseUrl}/i18n/api/v2/${lang}?_allow_anonymous`)
300
+ .pipe(catchError(() => this.http.get(`assets/tmp/i18n/${lang}.json`)));
307
301
  }
308
302
  }
309
303
  }
@@ -312,17 +306,40 @@ class YunzaiI18NService extends YunzaiI18nBaseService {
312
306
  return;
313
307
  const key = `_yz_lang_${lang}`;
314
308
  this.cacheService.set(key, data);
309
+ this.cacheService.set(this.cacheDefaultKey, lang);
315
310
  this._data = this.flatData(data, []);
316
311
  const item = YUNZAI_LANGS[lang];
317
- registerLocaleData(item.ng);
318
- this.nzI18nService.setLocale(item.zorro);
319
- this.nzI18nService.setDateLocale(item.date);
320
- this.yelonLocaleService.setLocale(item.yelon);
321
- this._currentLang = lang;
322
- this._change$.next(lang);
312
+ if (item) {
313
+ registerLocaleData(item.ng);
314
+ this.nzI18nService.setLocale(item.zorro);
315
+ this.nzI18nService.setDateLocale(item.date);
316
+ this.yelonLocaleService.setLocale(item.yelon);
317
+ this._currentLang = lang;
318
+ this._change$.next(lang);
319
+ }
320
+ else {
321
+ registerLocaleData(ngEn);
322
+ this.nzI18nService.setLocale(en_US);
323
+ this.nzI18nService.setDateLocale(enUS);
324
+ this.yelonLocaleService.setLocale(en_US$1);
325
+ this._currentLang = lang;
326
+ this._change$.next(lang);
327
+ }
323
328
  }
324
329
  getLangs() {
325
- return this._langs;
330
+ const langs = Object.keys(YUNZAI_LANGS).map(code => {
331
+ const item = YUNZAI_LANGS[code];
332
+ return { code, text: item.text, abbr: item.abbr, icon: undefined };
333
+ });
334
+ if (ngDevMode) {
335
+ return of(langs);
336
+ }
337
+ else {
338
+ return this.http.get(`${this.bis.baseUrl}/i18n/api/v2/list?_allow_anonymous`).pipe(catchError(() => of(langs)));
339
+ }
340
+ }
341
+ ngOnDestroy() {
342
+ this.destroy$.complete();
326
343
  }
327
344
  }
328
345
  YunzaiI18NService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: YunzaiI18NService, deps: [{ token: i1$2._HttpClient }, { token: i1$2.SettingsService }, { token: i2.NzI18nService }, { token: i1$2.YelonLocaleService }, { token: i3$1.Platform }, { token: i4.YunzaiConfigService }, { token: i1$3.CacheService }], target: i0.ɵɵFactoryTarget.Injectable });
@@ -333,9 +350,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
333
350
  }], ctorParameters: function () { return [{ type: i1$2._HttpClient }, { type: i1$2.SettingsService }, { type: i2.NzI18nService }, { type: i1$2.YelonLocaleService }, { type: i3$1.Platform }, { type: i4.YunzaiConfigService }, { type: i1$3.CacheService }]; } });
334
351
 
335
352
  class YunzaiI18NComponent {
336
- get langs() {
337
- return this.i18n.getLangs();
338
- }
339
353
  get curLangCode() {
340
354
  return this.settings.layout.lang;
341
355
  }
@@ -343,8 +357,16 @@ class YunzaiI18NComponent {
343
357
  this.settings = settings;
344
358
  this.i18n = i18n;
345
359
  this.doc = doc;
360
+ this.destroy$ = new Subject();
346
361
  /** Whether to display language text */
347
362
  this.showLangText = true;
363
+ this.langs = [];
364
+ this.i18n
365
+ .getLangs()
366
+ .pipe(takeUntil(this.destroy$))
367
+ .subscribe(langs => {
368
+ this.langs = langs;
369
+ });
348
370
  }
349
371
  change(lang) {
350
372
  const spinEl = this.doc.createElement('div');
@@ -357,6 +379,9 @@ class YunzaiI18NComponent {
357
379
  setTimeout(() => this.doc.location.reload());
358
380
  });
359
381
  }
382
+ ngOnDestroy() {
383
+ this.destroy$.complete();
384
+ }
360
385
  }
361
386
  YunzaiI18NComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: YunzaiI18NComponent, deps: [{ token: i1$2.SettingsService }, { token: YUNZAI_I18N_TOKEN }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Component });
362
387
  YunzaiI18NComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: YunzaiI18NComponent, selector: "yunzai-i18n", inputs: { showLangText: "showLangText" }, ngImport: i0, template: `
@@ -381,7 +406,12 @@ YunzaiI18NComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", ve
381
406
  [nzSelected]="item.code === curLangCode"
382
407
  (click)="change(item.code)"
383
408
  >
384
- <span role="img" [attr.aria-label]="item.text" class="pr-xs">{{ item.abbr }}</span>
409
+ <template *ngIf="!item.image">
410
+ <span role="img" [attr.aria-label]="item.text" class="pr-xs">{{ item.abbr }}</span>
411
+ </template>
412
+ <template *ngIf="item.image">
413
+ <img [src]="'data:image/png;base64,' + item.image" [alt]="item.abbr" class="pr-xs" />
414
+ </template>
385
415
  {{ item.text }}
386
416
  </li>
387
417
  </ul>
@@ -416,7 +446,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
416
446
  [nzSelected]="item.code === curLangCode"
417
447
  (click)="change(item.code)"
418
448
  >
419
- <span role="img" [attr.aria-label]="item.text" class="pr-xs">{{ item.abbr }}</span>
449
+ <template *ngIf="!item.image">
450
+ <span role="img" [attr.aria-label]="item.text" class="pr-xs">{{ item.abbr }}</span>
451
+ </template>
452
+ <template *ngIf="item.image">
453
+ <img [src]="'data:image/png;base64,' + item.image" [alt]="item.abbr" class="pr-xs" />
454
+ </template>
420
455
  {{ item.text }}
421
456
  </li>
422
457
  </ul>
@@ -886,23 +921,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
886
921
  args: [YA_SERVICE_TOKEN]
887
922
  }] }, { type: i1$4.YunzaiConfigService }, { type: i1$3.CacheService }]; } });
888
923
 
889
- var TopicType;
890
- (function (TopicType) {
891
- TopicType[TopicType["FULL"] = 0] = "FULL";
892
- TopicType[TopicType["OWN"] = 1] = "OWN";
893
- TopicType[TopicType["EVERY"] = 2] = "EVERY";
894
- })(TopicType || (TopicType = {}));
895
-
896
924
  class LayoutNavApplicationComponent {
897
925
  constructor(cacheService, i18n, http, inject) {
898
926
  this.cacheService = cacheService;
899
927
  this.i18n = i18n;
900
928
  this.http = http;
901
929
  this.inject = inject;
902
- this.TopicType = TopicType;
903
930
  this.state = {
904
931
  active: false,
905
- type: TopicType.FULL,
932
+ type: 'all',
906
933
  topic: undefined,
907
934
  topics: [],
908
935
  list: [],
@@ -911,18 +938,32 @@ class LayoutNavApplicationComponent {
911
938
  };
912
939
  }
913
940
  ngOnInit() {
914
- this.state.list = this.state.topics = this.cacheService.get('_yz_header', { mode: 'none' });
941
+ this.fetchAllTopic();
942
+ this.attachNav('all');
915
943
  }
916
- initTopic(type) {
917
- this.state.search = null;
918
- this.state.list = this.cacheService.get('_yz_header', { mode: 'none' });
944
+ fetchAllTopic() {
945
+ this.state.topics = this.cacheService.get('_yz_header', { mode: 'none' });
946
+ }
947
+ attachNav(type, topic) {
919
948
  this.state.type = type;
949
+ this.clearSearch();
950
+ if (type === 'all') {
951
+ this.displayAllNav();
952
+ }
953
+ if (type === 'mine') {
954
+ this.displayMineNav();
955
+ }
956
+ if (type === 'other' && topic) {
957
+ this.displayOtherNav(topic);
958
+ }
920
959
  }
921
- full() {
922
- this.initTopic(TopicType.FULL);
960
+ clearSearch() {
961
+ this.state.search = null;
923
962
  }
924
- own() {
925
- this.initTopic(TopicType.OWN);
963
+ displayAllNav() {
964
+ this.state.list = this.cacheService.get('_yz_header', { mode: 'none' });
965
+ }
966
+ displayMineNav() {
926
967
  const temp = this.cacheService.get('_yz_header', { mode: 'none' });
927
968
  this.state.list = temp
928
969
  .filter((topic) => {
@@ -935,11 +976,10 @@ class LayoutNavApplicationComponent {
935
976
  return topic.children.length > 0;
936
977
  });
937
978
  }
938
- every(e) {
939
- this.initTopic(TopicType.EVERY);
940
- this.state.topic = e;
979
+ displayOtherNav(topic) {
980
+ this.state.topic = topic;
941
981
  const temp = this.cacheService.get('_yz_header', { mode: 'none' });
942
- this.state.list = [...temp.filter(t => t.key === e.key)[0].children];
982
+ this.state.list = temp.filter(t => t.key === topic.key)[0].children;
943
983
  }
944
984
  diffChange(flag) {
945
985
  if (flag) {
@@ -1003,7 +1043,7 @@ class LayoutNavApplicationComponent {
1003
1043
  }
1004
1044
  LayoutNavApplicationComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: LayoutNavApplicationComponent, deps: [{ token: i1$3.CacheService }, { token: YunzaiI18NService }, { token: i1$2._HttpClient }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
1005
1045
  LayoutNavApplicationComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: LayoutNavApplicationComponent, selector: "layout-nav-application", ngImport: i0, template: `
1006
- <!-- template start-->
1046
+ <!-- search start-->
1007
1047
  <ng-template #search>
1008
1048
  <div nz-row class="yz-application-list-search">
1009
1049
  <nz-input-group [nzPrefix]="prefixTemplate">
@@ -1020,17 +1060,20 @@ LayoutNavApplicationComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "1
1020
1060
  </nz-input-group>
1021
1061
  </div>
1022
1062
  </ng-template>
1063
+ <!-- search end -->
1064
+
1065
+ <!-- right menu start -->
1023
1066
  <ng-template #ld>
1024
1067
  <div class="yz-application-list">
1025
1068
  <ul>
1026
- <li *ngFor="let d of state.list">
1027
- <h5>{{ d.name }}</h5>
1028
- <a href="javascript:;" *ngFor="let cd of d.children" (click)="open(cd)">{{ cd.name }}</a>
1069
+ <li *ngFor="let topic of state.list">
1070
+ <h5>{{ topic.name | i18n }}</h5>
1071
+ <a href="javascript:;" *ngFor="let nav of topic.children" (click)="open(nav)">{{ nav.name | i18n }}</a>
1029
1072
  </li>
1030
1073
  </ul>
1031
1074
  </div>
1032
1075
  </ng-template>
1033
- <!-- template end-->
1076
+ <!-- right menu end -->
1034
1077
 
1035
1078
  <!-- button start-->
1036
1079
  <div class="yunzai-default__nav-item" (click)="diffChange()"> {{ 'mode.nav' | i18n }}</div>
@@ -1039,26 +1082,28 @@ LayoutNavApplicationComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "1
1039
1082
  <!-- header start-->
1040
1083
  <div class="yz-application" nz-row *ngIf="state.active">
1041
1084
  <div nz-col [nzSpan]="3" class="yz-application-topic">
1042
- <div class="yz-application-text" (click)="full()">{{ 'mode.nav.all' | i18n }}</div>
1043
- <div class="yz-application-text" (click)="own()">{{ 'mode.nav.mine' | i18n }}</div>
1044
- <div class="yz-application-text" *ngFor="let d of state.topics" (click)="every(d)">{{ d.name | i18n }}</div>
1085
+ <div class="yz-application-text" (click)="attachNav('all')">{{ 'mode.nav.all' | i18n }}</div>
1086
+ <div class="yz-application-text" (click)="attachNav('mine')">{{ 'mode.nav.mine' | i18n }}</div>
1087
+ <div class="yz-application-text" *ngFor="let nav of state.topics" (click)="attachNav('other', nav)">{{
1088
+ nav.name | i18n
1089
+ }}</div>
1045
1090
  </div>
1046
1091
  <div nz-col [nzSpan]="21" [ngSwitch]="state.topic" class="yz-application-container">
1047
- <div *ngSwitchCase="TopicType.FULL">
1092
+ <div *ngIf="state.type === 'all'">
1048
1093
  <ng-template [ngTemplateOutlet]="search"></ng-template>
1049
1094
  <ng-template [ngTemplateOutlet]="ld"></ng-template>
1050
1095
  </div>
1051
- <div *ngSwitchCase="TopicType.OWN">
1096
+ <div *ngIf="state.type === 'mine'">
1052
1097
  <ng-template [ngTemplateOutlet]="search"></ng-template>
1053
1098
  <ng-template [ngTemplateOutlet]="ld"></ng-template>
1054
1099
  </div>
1055
- <div *ngSwitchCase="TopicType.EVERY" class="yz-application-list">
1100
+ <div *ngIf="state.type === 'other'" class="yz-application-list">
1056
1101
  <div class="yz-application-list-item">
1057
1102
  <ul>
1058
- <li *ngFor="let d of state.list" (click)="open(d)">
1103
+ <li *ngFor="let nav of state.list" (click)="open(nav)">
1059
1104
  <a href="javascript:;">
1060
- <h4>{{ d.name | i18n }}</h4>
1061
- <p>{{ d.intro | i18n }}</p>
1105
+ <h4>{{ nav.name | i18n }}</h4>
1106
+ <p>{{ nav.intro | i18n }}</p>
1062
1107
  </a>
1063
1108
  </li>
1064
1109
  </ul>
@@ -1067,13 +1112,13 @@ LayoutNavApplicationComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "1
1067
1112
  </div>
1068
1113
  </div>
1069
1114
  <!-- header end-->
1070
- `, isInline: true, dependencies: [{ kind: "directive", type: i4$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i4$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i4$1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i4$1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i5.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i5.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i3.ɵNzTransitionPatchDirective, selector: "[nz-button], nz-button-group, [nz-icon], [nz-menu-item], [nz-submenu], nz-select-top-control, nz-select-placeholder, nz-input-group", inputs: ["hidden"] }, { kind: "directive", type: i7$1.NzColDirective, selector: "[nz-col],nz-col,nz-form-control,nz-form-label", inputs: ["nzFlex", "nzSpan", "nzOrder", "nzOffset", "nzPush", "nzPull", "nzXs", "nzSm", "nzMd", "nzLg", "nzXl", "nzXXl"], exportAs: ["nzCol"] }, { kind: "directive", type: i7$1.NzRowDirective, selector: "[nz-row],nz-row,nz-form-item", inputs: ["nzAlign", "nzJustify", "nzGutter"], exportAs: ["nzRow"] }, { kind: "directive", type: i8.NzIconDirective, selector: "[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { kind: "directive", type: i9$1.NzInputDirective, selector: "input[nz-input],textarea[nz-input]", inputs: ["nzBorderless", "nzSize", "nzStatus", "disabled"], exportAs: ["nzInput"] }, { kind: "component", type: i9$1.NzInputGroupComponent, selector: "nz-input-group", inputs: ["nzAddOnBeforeIcon", "nzAddOnAfterIcon", "nzPrefixIcon", "nzSuffixIcon", "nzAddOnBefore", "nzAddOnAfter", "nzPrefix", "nzStatus", "nzSuffix", "nzSize", "nzSearch", "nzCompact"], exportAs: ["nzInputGroup"] }, { kind: "directive", type: i9$1.NzInputGroupWhitSuffixOrPrefixDirective, selector: "nz-input-group[nzSuffix], nz-input-group[nzPrefix]" }, { kind: "pipe", type: i1$2.I18nPipe, name: "i18n" }] });
1115
+ `, isInline: true, dependencies: [{ kind: "directive", type: i4$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i4$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i4$1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i5.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i5.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i3.ɵNzTransitionPatchDirective, selector: "[nz-button], nz-button-group, [nz-icon], [nz-menu-item], [nz-submenu], nz-select-top-control, nz-select-placeholder, nz-input-group", inputs: ["hidden"] }, { kind: "directive", type: i7$1.NzColDirective, selector: "[nz-col],nz-col,nz-form-control,nz-form-label", inputs: ["nzFlex", "nzSpan", "nzOrder", "nzOffset", "nzPush", "nzPull", "nzXs", "nzSm", "nzMd", "nzLg", "nzXl", "nzXXl"], exportAs: ["nzCol"] }, { kind: "directive", type: i7$1.NzRowDirective, selector: "[nz-row],nz-row,nz-form-item", inputs: ["nzAlign", "nzJustify", "nzGutter"], exportAs: ["nzRow"] }, { kind: "directive", type: i8.NzIconDirective, selector: "[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { kind: "directive", type: i9$1.NzInputDirective, selector: "input[nz-input],textarea[nz-input]", inputs: ["nzBorderless", "nzSize", "nzStatus", "disabled"], exportAs: ["nzInput"] }, { kind: "component", type: i9$1.NzInputGroupComponent, selector: "nz-input-group", inputs: ["nzAddOnBeforeIcon", "nzAddOnAfterIcon", "nzPrefixIcon", "nzSuffixIcon", "nzAddOnBefore", "nzAddOnAfter", "nzPrefix", "nzStatus", "nzSuffix", "nzSize", "nzSearch", "nzCompact"], exportAs: ["nzInputGroup"] }, { kind: "directive", type: i9$1.NzInputGroupWhitSuffixOrPrefixDirective, selector: "nz-input-group[nzSuffix], nz-input-group[nzPrefix]" }, { kind: "pipe", type: i1$2.I18nPipe, name: "i18n" }] });
1071
1116
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: LayoutNavApplicationComponent, decorators: [{
1072
1117
  type: Component,
1073
1118
  args: [{
1074
1119
  selector: `layout-nav-application`,
1075
1120
  template: `
1076
- <!-- template start-->
1121
+ <!-- search start-->
1077
1122
  <ng-template #search>
1078
1123
  <div nz-row class="yz-application-list-search">
1079
1124
  <nz-input-group [nzPrefix]="prefixTemplate">
@@ -1090,17 +1135,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
1090
1135
  </nz-input-group>
1091
1136
  </div>
1092
1137
  </ng-template>
1138
+ <!-- search end -->
1139
+
1140
+ <!-- right menu start -->
1093
1141
  <ng-template #ld>
1094
1142
  <div class="yz-application-list">
1095
1143
  <ul>
1096
- <li *ngFor="let d of state.list">
1097
- <h5>{{ d.name }}</h5>
1098
- <a href="javascript:;" *ngFor="let cd of d.children" (click)="open(cd)">{{ cd.name }}</a>
1144
+ <li *ngFor="let topic of state.list">
1145
+ <h5>{{ topic.name | i18n }}</h5>
1146
+ <a href="javascript:;" *ngFor="let nav of topic.children" (click)="open(nav)">{{ nav.name | i18n }}</a>
1099
1147
  </li>
1100
1148
  </ul>
1101
1149
  </div>
1102
1150
  </ng-template>
1103
- <!-- template end-->
1151
+ <!-- right menu end -->
1104
1152
 
1105
1153
  <!-- button start-->
1106
1154
  <div class="yunzai-default__nav-item" (click)="diffChange()"> {{ 'mode.nav' | i18n }}</div>
@@ -1109,26 +1157,28 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
1109
1157
  <!-- header start-->
1110
1158
  <div class="yz-application" nz-row *ngIf="state.active">
1111
1159
  <div nz-col [nzSpan]="3" class="yz-application-topic">
1112
- <div class="yz-application-text" (click)="full()">{{ 'mode.nav.all' | i18n }}</div>
1113
- <div class="yz-application-text" (click)="own()">{{ 'mode.nav.mine' | i18n }}</div>
1114
- <div class="yz-application-text" *ngFor="let d of state.topics" (click)="every(d)">{{ d.name | i18n }}</div>
1160
+ <div class="yz-application-text" (click)="attachNav('all')">{{ 'mode.nav.all' | i18n }}</div>
1161
+ <div class="yz-application-text" (click)="attachNav('mine')">{{ 'mode.nav.mine' | i18n }}</div>
1162
+ <div class="yz-application-text" *ngFor="let nav of state.topics" (click)="attachNav('other', nav)">{{
1163
+ nav.name | i18n
1164
+ }}</div>
1115
1165
  </div>
1116
1166
  <div nz-col [nzSpan]="21" [ngSwitch]="state.topic" class="yz-application-container">
1117
- <div *ngSwitchCase="TopicType.FULL">
1167
+ <div *ngIf="state.type === 'all'">
1118
1168
  <ng-template [ngTemplateOutlet]="search"></ng-template>
1119
1169
  <ng-template [ngTemplateOutlet]="ld"></ng-template>
1120
1170
  </div>
1121
- <div *ngSwitchCase="TopicType.OWN">
1171
+ <div *ngIf="state.type === 'mine'">
1122
1172
  <ng-template [ngTemplateOutlet]="search"></ng-template>
1123
1173
  <ng-template [ngTemplateOutlet]="ld"></ng-template>
1124
1174
  </div>
1125
- <div *ngSwitchCase="TopicType.EVERY" class="yz-application-list">
1175
+ <div *ngIf="state.type === 'other'" class="yz-application-list">
1126
1176
  <div class="yz-application-list-item">
1127
1177
  <ul>
1128
- <li *ngFor="let d of state.list" (click)="open(d)">
1178
+ <li *ngFor="let nav of state.list" (click)="open(nav)">
1129
1179
  <a href="javascript:;">
1130
- <h4>{{ d.name | i18n }}</h4>
1131
- <p>{{ d.intro | i18n }}</p>
1180
+ <h4>{{ nav.name | i18n }}</h4>
1181
+ <p>{{ nav.intro | i18n }}</p>
1132
1182
  </a>
1133
1183
  </li>
1134
1184
  </ul>
@@ -1318,12 +1368,27 @@ class YunzaiLayoutBasicComponent {
1318
1368
  }
1319
1369
  ngOnInit() {
1320
1370
  this.initLogo();
1371
+ this.initFavicon();
1321
1372
  this.initNavType();
1322
1373
  this.initAside();
1323
1374
  this.addLayoutDisplayListener();
1324
1375
  this.stompService.listen();
1325
1376
  this.toIndex();
1326
1377
  }
1378
+ initFavicon() {
1379
+ console.log('init favicon');
1380
+ const projectInfo = this.cacheService.get('_yz_project_info', { mode: 'none' });
1381
+ if (projectInfo.faviconUrl) {
1382
+ hasFavicon(projectInfo.faviconUrl).then((has) => {
1383
+ if (has) {
1384
+ setFavicon(projectInfo.faviconUrl);
1385
+ }
1386
+ else {
1387
+ setFavicon('./assets/favicon.ico');
1388
+ }
1389
+ });
1390
+ }
1391
+ }
1327
1392
  initAside() {
1328
1393
  const aside = this.cacheService.get('_yz_current', { mode: 'none' });
1329
1394
  this.state.aside = { ...aside };
@@ -1442,8 +1507,8 @@ YunzaiLayoutBasicComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0
1442
1507
  <div nz-dropdown nzTrigger="click" [nzDropdownMenu]="userMenu" class="yunzai-default__aside-user">
1443
1508
  <nz-avatar class="yunzai-default__aside-user-avatar" [nzSrc]="aside.icon"></nz-avatar>
1444
1509
  <div class="yunzai-default__aside-user-info">
1445
- <strong>{{ aside.name }}</strong>
1446
- <p class="mb0">{{ aside.intro }}</p>
1510
+ <strong>{{ aside.name | i18n }}</strong>
1511
+ <p class="mb0">{{ aside.intro | i18n }}</p>
1447
1512
  </div>
1448
1513
  </div>
1449
1514
  <nz-dropdown-menu #userMenu="nzDropdownMenu">
@@ -1530,8 +1595,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
1530
1595
  <div nz-dropdown nzTrigger="click" [nzDropdownMenu]="userMenu" class="yunzai-default__aside-user">
1531
1596
  <nz-avatar class="yunzai-default__aside-user-avatar" [nzSrc]="aside.icon"></nz-avatar>
1532
1597
  <div class="yunzai-default__aside-user-info">
1533
- <strong>{{ aside.name }}</strong>
1534
- <p class="mb0">{{ aside.intro }}</p>
1598
+ <strong>{{ aside.name | i18n }}</strong>
1599
+ <p class="mb0">{{ aside.intro | i18n }}</p>
1535
1600
  </div>
1536
1601
  </div>
1537
1602
  <nz-dropdown-menu #userMenu="nzDropdownMenu">
@@ -1973,6 +2038,8 @@ class YunzaiDefaultInterceptor {
1973
2038
  if (url.includes('.json') && url.includes('assets')) {
1974
2039
  url = req.url;
1975
2040
  }
2041
+ if (url.includes('i18n'))
2042
+ return next.handle(req);
1976
2043
  // 加入语言头
1977
2044
  const newReq = req.clone({ url, setHeaders: this.getAdditionalHeaders(req.headers) });
1978
2045
  return next.handle(newReq).pipe(mergeMap(ev => {
@@ -2868,7 +2935,9 @@ class YunzaiStartupService {
2868
2935
  }
2869
2936
  load() {
2870
2937
  log$1('startup.service: ', 'load');
2871
- const defaultLang = this.i18n.defaultLang;
2938
+ let defaultLang = this.cacheService.getNone(this.i18n.cacheDefaultKey);
2939
+ if (!defaultLang)
2940
+ defaultLang = this.i18n.defaultLang;
2872
2941
  return this.i18n.loadLangData(defaultLang).pipe(mergeMap(langData => {
2873
2942
  log$1('startup.service: ', 'set i18n, defaultLang->', defaultLang, ' langData->', langData);
2874
2943
  this.i18n.use(defaultLang, langData);
@@ -2997,5 +3066,5 @@ const YUNZAI_APPINIT_PROVIDES = [
2997
3066
  * Generated bundle index. Do not edit.
2998
3067
  */
2999
3068
 
3000
- export { ActGuard, BUSINESS_DEFAULT_CONFIG, LayoutNavApplicationComponent, LayoutNavGroupComponent, LayoutNavTileComponent, NavType, TopicType, YUNZAI_APPINIT_PROVIDES, YUNZAI_APPINIT_PROVIDES as YZ_APPINIT_PROVIDES, YunzaiAuthService, YunzaiClearStorageComponent, YunzaiDefaultInterceptor, YunzaiFullScreenComponent, YunzaiI18NComponent, YunzaiI18NService, YunzaiLayoutBasicComponent, YunzaiLayoutModule, YunzaiNotifyComponent, YunzaiStartupService, YunzaiStartupServiceFactory, YunzaiThemBtnComponent, YunzaiUserComponent, YunzaiAuthService as YzAuthService, YunzaiDefaultInterceptor as YzDefaultInterceptor, YunzaiI18NService as YzI18NService, YunzaiLayoutBasicComponent as YzLayoutBasicComponent, YunzaiStartupService as YzStartupService, YunzaiStartupServiceFactory as YzStartupServiceFactory, generateAbility, mapYzSideToYelonMenu, mergeBisConfig };
3069
+ export { ActGuard, BUSINESS_DEFAULT_CONFIG, LayoutNavApplicationComponent, LayoutNavGroupComponent, LayoutNavTileComponent, NavType, YUNZAI_APPINIT_PROVIDES, YUNZAI_LANGS, YUNZAI_APPINIT_PROVIDES as YZ_APPINIT_PROVIDES, YunzaiAuthService, YunzaiClearStorageComponent, YunzaiDefaultInterceptor, YunzaiFullScreenComponent, YunzaiI18NComponent, YunzaiI18NService, YunzaiLayoutBasicComponent, YunzaiLayoutModule, YunzaiNotifyComponent, YunzaiStartupService, YunzaiStartupServiceFactory, YunzaiThemBtnComponent, YunzaiUserComponent, YunzaiAuthService as YzAuthService, YunzaiDefaultInterceptor as YzDefaultInterceptor, YunzaiI18NService as YzI18NService, YunzaiLayoutBasicComponent as YzLayoutBasicComponent, YunzaiStartupService as YzStartupService, YunzaiStartupServiceFactory as YzStartupServiceFactory, generateAbility, mapYzSideToYelonMenu, mergeBisConfig };
3001
3070
  //# sourceMappingURL=layout.mjs.map