@yelon/bis 14.1.1 → 15.0.0-beta.0

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.
Files changed (119) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +23 -1
  3. package/esm2020/bis.mjs +2 -2
  4. package/esm2020/index.mjs +2 -0
  5. package/esm2020/public_api.mjs +2 -2
  6. package/esm2020/src/bis.config.mjs +11 -0
  7. package/esm2020/src/icon/style-icons.mjs +796 -0
  8. package/esm2020/src/index.mjs +12 -0
  9. package/esm2020/src/layout-basic/index.mjs +4 -0
  10. package/esm2020/src/layout-basic/interface.mjs +7 -0
  11. package/esm2020/src/layout-basic/layout-basic.component.mjs +312 -0
  12. package/esm2020/src/layout-basic/layout-display.service.mjs +87 -0
  13. package/esm2020/src/layout-nav/index.mjs +5 -0
  14. package/esm2020/src/layout-nav/layout-nav-application.component.mjs +262 -0
  15. package/esm2020/{layout/widgets/yz.application.group.component.mjs → src/layout-nav/layout-nav-group.component.mjs} +23 -21
  16. package/esm2020/src/layout-nav/layout-nav-tile.component.mjs +15 -0
  17. package/esm2020/src/layout-nav/types.mjs +7 -0
  18. package/esm2020/src/widgets/index.mjs +7 -0
  19. package/esm2020/src/widgets/yunzai-clear-storage.component.mjs +45 -0
  20. package/esm2020/src/widgets/yunzai-fullscreen.component.mjs +45 -0
  21. package/esm2020/src/widgets/yunzai-i18n.component.mjs +115 -0
  22. package/esm2020/src/widgets/yunzai-notify.component.mjs +183 -0
  23. package/esm2020/src/widgets/yunzai-theme-btn.component.mjs +195 -0
  24. package/esm2020/{layout/widgets/yz.user.component.mjs → src/widgets/yunzai-user.component.mjs} +6 -6
  25. package/esm2020/src/yunzai-act.guard.mjs +107 -0
  26. package/esm2020/src/yunzai-auth.service.mjs +153 -0
  27. package/esm2020/src/yunzai-default.interceptor.mjs +207 -0
  28. package/esm2020/src/yunzai-i18n.service.mjs +94 -0
  29. package/esm2020/src/yunzai-layout.module.mjs +76 -0
  30. package/esm2020/src/yunzai-startup.service.mjs +157 -0
  31. package/fesm2015/bis.mjs +2960 -1
  32. package/fesm2015/bis.mjs.map +1 -1
  33. package/fesm2020/bis.mjs +2968 -1
  34. package/fesm2020/bis.mjs.map +1 -1
  35. package/index.d.ts +0 -4
  36. package/index.less +1 -1
  37. package/package.json +12 -27
  38. package/public_api.d.ts +1 -2
  39. package/{layout → src}/bis.config.d.ts +0 -0
  40. package/{shared → src/icon}/style-icons.d.ts +0 -0
  41. package/src/index.d.ts +11 -0
  42. package/src/layout-basic/index.d.ts +3 -0
  43. package/src/layout-basic/interface.d.ts +24 -0
  44. package/src/layout-basic/layout-basic.component.d.ts +33 -0
  45. package/src/layout-basic/layout-display.service.d.ts +15 -0
  46. package/src/layout-nav/index.d.ts +4 -0
  47. package/src/layout-nav/layout-nav-application.component.d.ts +26 -0
  48. package/src/layout-nav/layout-nav-group.component.d.ts +17 -0
  49. package/src/layout-nav/layout-nav-tile.component.d.ts +6 -0
  50. package/src/layout-nav/types.d.ts +20 -0
  51. package/src/widgets/index.d.ts +6 -0
  52. package/{layout/widgets/yz.clear-storage.component.d.ts → src/widgets/yunzai-clear-storage.component.d.ts} +3 -3
  53. package/src/widgets/yunzai-fullscreen.component.d.ts +8 -0
  54. package/{layout/widgets/yz.i18n.component.d.ts → src/widgets/yunzai-i18n.component.d.ts} +5 -5
  55. package/{layout/widgets/yz.notify.component.d.ts → src/widgets/yunzai-notify.component.d.ts} +5 -5
  56. package/{layout/widgets/yz.them-btn.component.d.ts → src/widgets/yunzai-theme-btn.component.d.ts} +5 -5
  57. package/{layout/widgets/yz.user.component.d.ts → src/widgets/yunzai-user.component.d.ts} +3 -3
  58. package/{layout/act.guard.d.ts → src/yunzai-act.guard.d.ts} +1 -2
  59. package/{layout/yz.auth.service.d.ts → src/yunzai-auth.service.d.ts} +6 -7
  60. package/{layout/yz.default.interceptor.d.ts → src/yunzai-default.interceptor.d.ts} +4 -6
  61. package/{layout/yz.i18n.service.d.ts → src/yunzai-i18n.service.d.ts} +4 -3
  62. package/src/yunzai-layout.module.d.ts +21 -0
  63. package/src/yunzai-startup.service.d.ts +37 -0
  64. package/esm2020/layout/act.guard.mjs +0 -108
  65. package/esm2020/layout/bis.config.mjs +0 -11
  66. package/esm2020/layout/contact/contact.component.mjs +0 -492
  67. package/esm2020/layout/contact/contact.service.mjs +0 -146
  68. package/esm2020/layout/layout.mjs +0 -5
  69. package/esm2020/layout/layout.module.mjs +0 -76
  70. package/esm2020/layout/path-to-regexp.service.mjs +0 -238
  71. package/esm2020/layout/public_api.mjs +0 -15
  72. package/esm2020/layout/stomp.config.mjs +0 -18
  73. package/esm2020/layout/widgets/index.mjs +0 -9
  74. package/esm2020/layout/widgets/yz.application.component.mjs +0 -271
  75. package/esm2020/layout/widgets/yz.clear-storage.component.mjs +0 -45
  76. package/esm2020/layout/widgets/yz.fullscreen.component.mjs +0 -45
  77. package/esm2020/layout/widgets/yz.i18n.component.mjs +0 -115
  78. package/esm2020/layout/widgets/yz.notify.component.mjs +0 -183
  79. package/esm2020/layout/widgets/yz.them-btn.component.mjs +0 -195
  80. package/esm2020/layout/yz.auth.service.mjs +0 -155
  81. package/esm2020/layout/yz.basic.component.mjs +0 -269
  82. package/esm2020/layout/yz.default.interceptor.mjs +0 -207
  83. package/esm2020/layout/yz.i18n.service.mjs +0 -93
  84. package/esm2020/layout/yz.startup.service.mjs +0 -139
  85. package/esm2020/layout/yz.stomp.service.mjs +0 -88
  86. package/esm2020/shared/public_api.mjs +0 -5
  87. package/esm2020/shared/shared-yelon.module.mjs +0 -106
  88. package/esm2020/shared/shared-zorro.module.mjs +0 -81
  89. package/esm2020/shared/shared.mjs +0 -5
  90. package/esm2020/shared/shared.module.mjs +0 -115
  91. package/esm2020/shared/style-icons.mjs +0 -796
  92. package/fesm2015/layout.mjs +0 -2968
  93. package/fesm2015/layout.mjs.map +0 -1
  94. package/fesm2015/shared.mjs +0 -1103
  95. package/fesm2015/shared.mjs.map +0 -1
  96. package/fesm2020/layout.mjs +0 -2977
  97. package/fesm2020/layout.mjs.map +0 -1
  98. package/fesm2020/shared.mjs +0 -1103
  99. package/fesm2020/shared.mjs.map +0 -1
  100. package/layout/contact/contact.component.d.ts +0 -169
  101. package/layout/contact/contact.service.d.ts +0 -118
  102. package/layout/index.d.ts +0 -5
  103. package/layout/layout.module.d.ts +0 -21
  104. package/layout/path-to-regexp.service.d.ts +0 -26
  105. package/layout/public_api.d.ts +0 -14
  106. package/layout/stomp.config.d.ts +0 -3
  107. package/layout/style/index.less +0 -155
  108. package/layout/widgets/index.d.ts +0 -8
  109. package/layout/widgets/yz.application.component.d.ts +0 -49
  110. package/layout/widgets/yz.application.group.component.d.ts +0 -19
  111. package/layout/widgets/yz.fullscreen.component.d.ts +0 -8
  112. package/layout/yz.basic.component.d.ts +0 -27
  113. package/layout/yz.startup.service.d.ts +0 -36
  114. package/layout/yz.stomp.service.d.ts +0 -42
  115. package/shared/index.d.ts +0 -5
  116. package/shared/public_api.d.ts +0 -4
  117. package/shared/shared-yelon.module.d.ts +0 -3
  118. package/shared/shared-zorro.module.d.ts +0 -2
  119. package/shared/shared.module.d.ts +0 -94
@@ -1,2977 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { Injectable, Component, ChangeDetectionStrategy, Inject, Input, Optional, HostListener, EventEmitter, ViewChild, Output, isDevMode, NgModule, APP_INITIALIZER } from '@angular/core';
3
- import * as i1$3 from '@yelon/util';
4
- import { WINDOW, log as log$1, deepCopy } from '@yelon/util';
5
- import * as i1$1 from '@yelon/cache';
6
- import { CacheService } from '@yelon/cache';
7
- import * as i4$1 from '@angular/common';
8
- import { registerLocaleData, DOCUMENT, CommonModule } from '@angular/common';
9
- import ngEn from '@angular/common/locales/en';
10
- import ngZh from '@angular/common/locales/zh';
11
- import ngZhTw from '@angular/common/locales/zh-Hant';
12
- import { zhCN, zhTW, enUS } from 'date-fns/locale';
13
- import * as i1 from '@yelon/theme';
14
- import { zh_CN as zh_CN$1, zh_TW as zh_TW$1, en_US as en_US$1, YunzaiI18nBaseService, YUNZAI_I18N_TOKEN, _HttpClient } from '@yelon/theme';
15
- import * as i2 from 'ng-zorro-antd/i18n';
16
- import { zh_CN, zh_TW, en_US } from 'ng-zorro-antd/i18n';
17
- import * as i3 from '@angular/cdk/platform';
18
- import * as i4 from '@yelon/util/config';
19
- import { YunzaiConfigService } from '@yelon/util/config';
20
- import * as i5 from '@angular/forms';
21
- import { FormsModule, ReactiveFormsModule } from '@angular/forms';
22
- import * as i5$1 from 'ng-zorro-antd/core/transition-patch';
23
- import * as i7 from 'ng-zorro-antd/grid';
24
- import * as i8 from 'ng-zorro-antd/icon';
25
- import * as i9 from 'ng-zorro-antd/input';
26
- import { __decorate } from 'tslib';
27
- import { InputBoolean } from '@yelon/util/decorator';
28
- import * as i6 from 'ng-zorro-antd/menu';
29
- import * as i7$1 from 'ng-zorro-antd/dropdown';
30
- import { forkJoin, map, Subject, takeUntil, of, mergeMap, mergeAll, BehaviorSubject, throwError, filter, take, switchMap, catchError } from 'rxjs';
31
- import { formatDistanceToNow } from 'date-fns';
32
- import { log } from '@yelon/util/other';
33
- import * as i1$2 from 'ng-zorro-antd/message';
34
- import * as i4$2 from '@yelon/abc/notice-icon';
35
- import { YUNZAI_THEME_BTN_KEYS } from '@yelon/theme/theme-btn';
36
- import * as i3$1 from '@angular/cdk/bidi';
37
- import * as i8$1 from 'ng-zorro-antd/tooltip';
38
- import { YA_SERVICE_TOKEN, mergeConfig, ALLOW_ANONYMOUS } from '@yelon/auth';
39
- import * as i9$1 from 'ng-zorro-antd/avatar';
40
- import * as i1$4 from 'ng-zorro-antd/modal';
41
- import screenfull from 'screenfull';
42
- import * as i8$2 from 'ng-zorro-antd/tabs';
43
- import { HttpClientModule, HttpErrorResponse, HttpResponse, HttpResponseBase } from '@angular/common/http';
44
- import * as i5$3 from '@angular/router';
45
- import { RouterModule, Router } from '@angular/router';
46
- import { YzSharedModule, ICONS } from '@yelon/bis/shared';
47
- import * as i4$3 from '@yelon/abc/st';
48
- import * as i5$2 from '@yelon/abc/sg';
49
- import * as i6$1 from 'ng-zorro-antd/tree';
50
- import * as i7$2 from 'ng-zorro-antd/button';
51
- import * as i9$2 from 'ng-zorro-antd/core/wave';
52
- import * as i14 from 'ng-zorro-antd/list';
53
- import * as i15 from 'ng-zorro-antd/spin';
54
- import { RxStomp } from '@stomp/rx-stomp';
55
- import * as i3$2 from 'ng-zorro-antd/notification';
56
- import { NzNotificationService } from 'ng-zorro-antd/notification';
57
- import * as i3$3 from '@yelon/theme/layout-default';
58
- import * as i6$2 from '@yelon/abc/reuse-tab';
59
- import * as i3$4 from '@yelon/acl';
60
-
61
- const DEFAULT = 'zh-CN';
62
- const LANGS = {
63
- 'zh-CN': {
64
- text: '简体中文',
65
- ng: ngZh,
66
- zorro: zh_CN,
67
- date: zhCN,
68
- yelon: zh_CN$1,
69
- abbr: '🇨🇳'
70
- },
71
- 'zh-TW': {
72
- text: '繁体中文',
73
- ng: ngZhTw,
74
- zorro: zh_TW,
75
- date: zhTW,
76
- yelon: zh_TW$1,
77
- abbr: '🇭🇰'
78
- },
79
- 'en-US': {
80
- text: 'English',
81
- ng: ngEn,
82
- zorro: en_US,
83
- date: enUS,
84
- yelon: en_US$1,
85
- abbr: '🇬🇧'
86
- }
87
- };
88
- class YzI18NService extends YunzaiI18nBaseService {
89
- constructor(http, settings, nzI18nService, yelonLocaleService, platform, cogSrv) {
90
- super(cogSrv);
91
- this.http = http;
92
- this.settings = settings;
93
- this.nzI18nService = nzI18nService;
94
- this.yelonLocaleService = yelonLocaleService;
95
- this.platform = platform;
96
- this._defaultLang = DEFAULT;
97
- this._langs = Object.keys(LANGS).map(code => {
98
- const item = LANGS[code];
99
- return { code, text: item.text, abbr: item.abbr };
100
- });
101
- const defaultLang = this.getDefaultLang();
102
- this._defaultLang = this._langs.findIndex(w => w.code === defaultLang) === -1 ? DEFAULT : defaultLang;
103
- }
104
- getDefaultLang() {
105
- if (!this.platform.isBrowser) {
106
- return DEFAULT;
107
- }
108
- if (this.settings.layout.lang) {
109
- return this.settings.layout.lang;
110
- }
111
- let res = (navigator.languages ? navigator.languages[0] : null) || navigator.language;
112
- const arr = res.split('-');
113
- return arr.length <= 1 ? res : `${arr[0]}-${arr[1].toUpperCase()}`;
114
- }
115
- loadLangData(lang) {
116
- return this.http.get(`assets/tmp/i18n/${lang}.json`);
117
- }
118
- use(lang, data) {
119
- if (this._currentLang === lang)
120
- return;
121
- this._data = this.flatData(data, []);
122
- const item = LANGS[lang];
123
- registerLocaleData(item.ng);
124
- this.nzI18nService.setLocale(item.zorro);
125
- this.nzI18nService.setDateLocale(item.date);
126
- this.yelonLocaleService.setLocale(item.yelon);
127
- this._currentLang = lang;
128
- this._change$.next(lang);
129
- }
130
- getLangs() {
131
- return this._langs;
132
- }
133
- }
134
- YzI18NService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzI18NService, deps: [{ token: i1._HttpClient }, { token: i1.SettingsService }, { token: i2.NzI18nService }, { token: i1.YelonLocaleService }, { token: i3.Platform }, { token: i4.YunzaiConfigService }], target: i0.ɵɵFactoryTarget.Injectable });
135
- YzI18NService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzI18NService, providedIn: 'root' });
136
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzI18NService, decorators: [{
137
- type: Injectable,
138
- args: [{ providedIn: 'root' }]
139
- }], ctorParameters: function () { return [{ type: i1._HttpClient }, { type: i1.SettingsService }, { type: i2.NzI18nService }, { type: i1.YelonLocaleService }, { type: i3.Platform }, { type: i4.YunzaiConfigService }]; } });
140
-
141
- var TOPIC;
142
- (function (TOPIC) {
143
- TOPIC[TOPIC["FULL"] = 0] = "FULL";
144
- TOPIC[TOPIC["OWN"] = 1] = "OWN";
145
- TOPIC[TOPIC["EVERY"] = 2] = "EVERY";
146
- })(TOPIC || (TOPIC = {}));
147
- class YzHeaderApplicationComponent {
148
- constructor(inject, cacheService, i18n, http) {
149
- this.inject = inject;
150
- this.cacheService = cacheService;
151
- this.i18n = i18n;
152
- this.http = http;
153
- this.T = TOPIC;
154
- this.active = false;
155
- this.topicData = [];
156
- this.listData = [];
157
- this.topic = TOPIC.FULL;
158
- this.searchValue = null;
159
- this.subs = [];
160
- }
161
- ngOnInit() {
162
- this.topicData = this.cacheService.get('_yz_header', { mode: 'none' });
163
- this.listData = this.cacheService.get('_yz_header', { mode: 'none' });
164
- }
165
- ngOnDestroy() {
166
- this.subs.forEach(f => f.unsubscribe());
167
- }
168
- diffChange(flag) {
169
- if (flag) {
170
- this.active = flag;
171
- }
172
- else {
173
- this.active = !this.active;
174
- }
175
- }
176
- initTopic(topic) {
177
- this.searchValue = null;
178
- this.listData = this.cacheService.get('_yz_header', { mode: 'none' });
179
- this.topic = topic;
180
- }
181
- full() {
182
- this.initTopic(TOPIC.FULL);
183
- }
184
- own() {
185
- this.initTopic(TOPIC.OWN);
186
- const temp = this.cacheService.get('_yz_header', { mode: 'none' });
187
- this.listData = temp
188
- .filter((topic) => {
189
- topic.children = topic.children.filter((child) => {
190
- return child.auth;
191
- });
192
- return topic;
193
- })
194
- .filter((topic) => {
195
- return topic.children.length > 0;
196
- });
197
- }
198
- every(e) {
199
- this.initTopic(TOPIC.EVERY);
200
- this.choosed = e;
201
- const temp = this.cacheService.get('_yz_header', { mode: 'none' });
202
- this.listData = [...temp.filter(t => t.key === e.key)[0].children];
203
- }
204
- onSearch() {
205
- const temp = this.cacheService.get('_yz_header', { mode: 'none' });
206
- // 如果搜索输入的有值
207
- if (this.searchValue) {
208
- // 过滤菜单过滤出搜索的值
209
- this.listData = temp
210
- .filter((topic) => {
211
- if (this.i18n.fanyi(topic.name).includes(this.searchValue)) {
212
- return topic;
213
- }
214
- else {
215
- topic.children = topic.children.filter((child) => {
216
- return this.i18n.fanyi(child.name).includes(this.searchValue);
217
- });
218
- return topic;
219
- }
220
- })
221
- .filter((topic) => {
222
- return topic.children.length > 0;
223
- });
224
- }
225
- else {
226
- // 如果没有值,取消搜索
227
- this.listData = this.cacheService.get('_yz_header', { mode: 'none' });
228
- }
229
- }
230
- open(topic) {
231
- if (topic.key) {
232
- this.subs.push(this.http
233
- .post(`/app-manager/web-scan/save`, {
234
- appId: topic.key,
235
- createDate: new Date()
236
- })
237
- .subscribe());
238
- }
239
- switch (topic.target) {
240
- case 'href':
241
- this.inject.get(WINDOW).location.href = topic.url;
242
- break;
243
- case 'blank':
244
- this.inject.get(WINDOW).location.href = topic.url;
245
- break;
246
- case 'target':
247
- this.inject.get(WINDOW).location.href = topic.url;
248
- break;
249
- default:
250
- this.inject.get(WINDOW).location.href = topic.url;
251
- break;
252
- }
253
- }
254
- }
255
- YzHeaderApplicationComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzHeaderApplicationComponent, deps: [{ token: i0.Injector }, { token: i1$1.CacheService }, { token: YzI18NService }, { token: i1._HttpClient }], target: i0.ɵɵFactoryTarget.Component });
256
- YzHeaderApplicationComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.5", type: YzHeaderApplicationComponent, selector: "yz-header-application", ngImport: i0, template: `
257
- <!-- template start-->
258
- <ng-template #search>
259
- <div nz-row class="yz-application-list-search">
260
- <nz-input-group [nzPrefix]="prefixTemplate">
261
- <input
262
- type="text"
263
- nz-input
264
- placeholder="{{ 'application.search' | i18n }}"
265
- [(ngModel)]="searchValue"
266
- (ngModelChange)="onSearch()"
267
- />
268
- <ng-template #prefixTemplate>
269
- <i nz-icon nzType="search" nzTheme="outline"></i>
270
- </ng-template>
271
- </nz-input-group>
272
- </div>
273
- </ng-template>
274
- <ng-template #ld>
275
- <div class="yz-application-list">
276
- <ul>
277
- <li *ngFor="let d of listData">
278
- <h5>{{ d.name }}</h5>
279
- <a href="javascript:;" *ngFor="let cd of d.children" (click)="open(cd)">{{ cd.name }}</a>
280
- </li>
281
- </ul>
282
- </div>
283
- </ng-template>
284
- <!-- template end-->
285
-
286
- <!-- button start-->
287
- <div class="yunzai-default__nav-item" (click)="diffChange()"> {{ 'application.button' | i18n }}</div>
288
- <!-- button end-->
289
-
290
- <!-- header start-->
291
- <div class="yz-application" nz-row *ngIf="active">
292
- <div nz-col [nzSpan]="3" class="yz-application-topic">
293
- <div class="yz-application-text" (click)="full()">{{ 'application.all' | i18n }}</div>
294
- <div class="yz-application-text" (click)="own()">{{ 'application.mine' | i18n }}</div>
295
- <div class="yz-application-text" *ngFor="let d of topicData" (click)="every(d)">
296
- {{ d.name }}
297
- </div>
298
- </div>
299
- <div nz-col [nzSpan]="21" [ngSwitch]="topic" class="yz-application-container">
300
- <div *ngSwitchCase="T.FULL">
301
- <ng-template [ngTemplateOutlet]="search"></ng-template>
302
- <ng-template [ngTemplateOutlet]="ld"></ng-template>
303
- </div>
304
- <div *ngSwitchCase="T.OWN">
305
- <ng-template [ngTemplateOutlet]="search"></ng-template>
306
- <ng-template [ngTemplateOutlet]="ld"></ng-template>
307
- </div>
308
- <div *ngSwitchCase="T.EVERY" class="yz-application-list">
309
- <div class="yz-application-list-item">
310
- <ul>
311
- <li *ngFor="let d of listData" (click)="open(d)">
312
- <a href="javascript:;">
313
- <h4>{{ d.name }}</h4>
314
- <p>{{ d.intro }}</p>
315
- </a>
316
- </li>
317
- </ul>
318
- </div>
319
- </div>
320
- </div>
321
- </div>
322
- <!-- header end-->
323
- `, 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: i5$1.ɵ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.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.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.NzInputDirective, selector: "input[nz-input],textarea[nz-input]", inputs: ["nzBorderless", "nzSize", "nzStatus", "disabled"], exportAs: ["nzInput"] }, { kind: "component", type: i9.NzInputGroupComponent, selector: "nz-input-group", inputs: ["nzAddOnBeforeIcon", "nzAddOnAfterIcon", "nzPrefixIcon", "nzSuffixIcon", "nzAddOnBefore", "nzAddOnAfter", "nzPrefix", "nzStatus", "nzSuffix", "nzSize", "nzSearch", "nzCompact"], exportAs: ["nzInputGroup"] }, { kind: "directive", type: i9.NzInputGroupWhitSuffixOrPrefixDirective, selector: "nz-input-group[nzSuffix], nz-input-group[nzPrefix]" }, { kind: "pipe", type: i1.I18nPipe, name: "i18n" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
324
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzHeaderApplicationComponent, decorators: [{
325
- type: Component,
326
- args: [{
327
- selector: 'yz-header-application',
328
- template: `
329
- <!-- template start-->
330
- <ng-template #search>
331
- <div nz-row class="yz-application-list-search">
332
- <nz-input-group [nzPrefix]="prefixTemplate">
333
- <input
334
- type="text"
335
- nz-input
336
- placeholder="{{ 'application.search' | i18n }}"
337
- [(ngModel)]="searchValue"
338
- (ngModelChange)="onSearch()"
339
- />
340
- <ng-template #prefixTemplate>
341
- <i nz-icon nzType="search" nzTheme="outline"></i>
342
- </ng-template>
343
- </nz-input-group>
344
- </div>
345
- </ng-template>
346
- <ng-template #ld>
347
- <div class="yz-application-list">
348
- <ul>
349
- <li *ngFor="let d of listData">
350
- <h5>{{ d.name }}</h5>
351
- <a href="javascript:;" *ngFor="let cd of d.children" (click)="open(cd)">{{ cd.name }}</a>
352
- </li>
353
- </ul>
354
- </div>
355
- </ng-template>
356
- <!-- template end-->
357
-
358
- <!-- button start-->
359
- <div class="yunzai-default__nav-item" (click)="diffChange()"> {{ 'application.button' | i18n }}</div>
360
- <!-- button end-->
361
-
362
- <!-- header start-->
363
- <div class="yz-application" nz-row *ngIf="active">
364
- <div nz-col [nzSpan]="3" class="yz-application-topic">
365
- <div class="yz-application-text" (click)="full()">{{ 'application.all' | i18n }}</div>
366
- <div class="yz-application-text" (click)="own()">{{ 'application.mine' | i18n }}</div>
367
- <div class="yz-application-text" *ngFor="let d of topicData" (click)="every(d)">
368
- {{ d.name }}
369
- </div>
370
- </div>
371
- <div nz-col [nzSpan]="21" [ngSwitch]="topic" class="yz-application-container">
372
- <div *ngSwitchCase="T.FULL">
373
- <ng-template [ngTemplateOutlet]="search"></ng-template>
374
- <ng-template [ngTemplateOutlet]="ld"></ng-template>
375
- </div>
376
- <div *ngSwitchCase="T.OWN">
377
- <ng-template [ngTemplateOutlet]="search"></ng-template>
378
- <ng-template [ngTemplateOutlet]="ld"></ng-template>
379
- </div>
380
- <div *ngSwitchCase="T.EVERY" class="yz-application-list">
381
- <div class="yz-application-list-item">
382
- <ul>
383
- <li *ngFor="let d of listData" (click)="open(d)">
384
- <a href="javascript:;">
385
- <h4>{{ d.name }}</h4>
386
- <p>{{ d.intro }}</p>
387
- </a>
388
- </li>
389
- </ul>
390
- </div>
391
- </div>
392
- </div>
393
- </div>
394
- <!-- header end-->
395
- `,
396
- changeDetection: ChangeDetectionStrategy.OnPush
397
- }]
398
- }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i1$1.CacheService }, { type: YzI18NService }, { type: i1._HttpClient }]; } });
399
-
400
- class YzHeaderI18NComponent {
401
- constructor(settings, i18n, doc) {
402
- this.settings = settings;
403
- this.i18n = i18n;
404
- this.doc = doc;
405
- /** Whether to display language text */
406
- this.showLangText = true;
407
- }
408
- get langs() {
409
- return this.i18n.getLangs();
410
- }
411
- get curLangCode() {
412
- return this.settings.layout.lang;
413
- }
414
- change(lang) {
415
- const spinEl = this.doc.createElement('div');
416
- spinEl.setAttribute('class', `page-loading ant-spin ant-spin-lg ant-spin-spinning`);
417
- spinEl.innerHTML = `<span class="ant-spin-dot ant-spin-dot-spin"><i></i><i></i><i></i><i></i></span>`;
418
- this.doc.body.appendChild(spinEl);
419
- this.i18n.loadLangData(lang).subscribe(res => {
420
- this.i18n.use(lang, res);
421
- this.settings.setLayout('lang', lang);
422
- setTimeout(() => this.doc.location.reload());
423
- });
424
- }
425
- }
426
- YzHeaderI18NComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzHeaderI18NComponent, deps: [{ token: i1.SettingsService }, { token: YUNZAI_I18N_TOKEN }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Component });
427
- YzHeaderI18NComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.5", type: YzHeaderI18NComponent, selector: "yz-header-i18n", inputs: { showLangText: "showLangText" }, ngImport: i0, template: `
428
- <div *ngIf="showLangText" nz-dropdown [nzDropdownMenu]="langMenu" nzPlacement="bottomRight">
429
- <i nz-icon nzType="global"></i>
430
- {{ 'menu.lang' | i18n }}
431
- <i nz-icon nzType="down"></i>
432
- </div>
433
- <i
434
- *ngIf="!showLangText"
435
- nz-dropdown
436
- [nzDropdownMenu]="langMenu"
437
- nzPlacement="bottomRight"
438
- nz-icon
439
- nzType="global"
440
- ></i>
441
- <nz-dropdown-menu #langMenu="nzDropdownMenu">
442
- <ul nz-menu>
443
- <li
444
- nz-menu-item
445
- *ngFor="let item of langs"
446
- [nzSelected]="item.code === curLangCode"
447
- (click)="change(item.code)"
448
- >
449
- <span role="img" [attr.aria-label]="item.text" class="pr-xs">{{ item.abbr }}</span>
450
- {{ item.text }}
451
- </li>
452
- </ul>
453
- </nz-dropdown-menu>
454
- `, 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: i5$1.ɵ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: i6.NzMenuDirective, selector: "[nz-menu]", inputs: ["nzInlineIndent", "nzTheme", "nzMode", "nzInlineCollapsed", "nzSelectable"], outputs: ["nzClick"], exportAs: ["nzMenu"] }, { kind: "directive", type: i6.NzMenuItemDirective, selector: "[nz-menu-item]", inputs: ["nzPaddingLeft", "nzDisabled", "nzSelected", "nzDanger", "nzMatchRouterExact", "nzMatchRouter"], exportAs: ["nzMenuItem"] }, { kind: "directive", type: i7$1.NzDropDownDirective, selector: "[nz-dropdown]", inputs: ["nzDropdownMenu", "nzTrigger", "nzMatchWidthElement", "nzBackdrop", "nzClickHide", "nzDisabled", "nzVisible", "nzOverlayClassName", "nzOverlayStyle", "nzPlacement"], outputs: ["nzVisibleChange"], exportAs: ["nzDropdown"] }, { kind: "component", type: i7$1.NzDropdownMenuComponent, selector: "nz-dropdown-menu", exportAs: ["nzDropdownMenu"] }, { kind: "directive", type: i8.NzIconDirective, selector: "[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { kind: "pipe", type: i1.I18nPipe, name: "i18n" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
455
- __decorate([
456
- InputBoolean()
457
- ], YzHeaderI18NComponent.prototype, "showLangText", void 0);
458
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzHeaderI18NComponent, decorators: [{
459
- type: Component,
460
- args: [{
461
- selector: 'yz-header-i18n',
462
- template: `
463
- <div *ngIf="showLangText" nz-dropdown [nzDropdownMenu]="langMenu" nzPlacement="bottomRight">
464
- <i nz-icon nzType="global"></i>
465
- {{ 'menu.lang' | i18n }}
466
- <i nz-icon nzType="down"></i>
467
- </div>
468
- <i
469
- *ngIf="!showLangText"
470
- nz-dropdown
471
- [nzDropdownMenu]="langMenu"
472
- nzPlacement="bottomRight"
473
- nz-icon
474
- nzType="global"
475
- ></i>
476
- <nz-dropdown-menu #langMenu="nzDropdownMenu">
477
- <ul nz-menu>
478
- <li
479
- nz-menu-item
480
- *ngFor="let item of langs"
481
- [nzSelected]="item.code === curLangCode"
482
- (click)="change(item.code)"
483
- >
484
- <span role="img" [attr.aria-label]="item.text" class="pr-xs">{{ item.abbr }}</span>
485
- {{ item.text }}
486
- </li>
487
- </ul>
488
- </nz-dropdown-menu>
489
- `,
490
- changeDetection: ChangeDetectionStrategy.OnPush
491
- }]
492
- }], ctorParameters: function () { return [{ type: i1.SettingsService }, { type: YzI18NService, decorators: [{
493
- type: Inject,
494
- args: [YUNZAI_I18N_TOKEN]
495
- }] }, { type: undefined, decorators: [{
496
- type: Inject,
497
- args: [DOCUMENT]
498
- }] }]; }, propDecorators: { showLangText: [{
499
- type: Input
500
- }] } });
501
-
502
- class YzHeaderNotifyComponent {
503
- constructor(injector, msg, y18n, nzI18n, cdr, httpClient) {
504
- this.injector = injector;
505
- this.msg = msg;
506
- this.y18n = y18n;
507
- this.nzI18n = nzI18n;
508
- this.cdr = cdr;
509
- this.httpClient = httpClient;
510
- this.data = [
511
- {
512
- key: 'msg',
513
- title: this.y18n.fanyi('notify.message'),
514
- list: [],
515
- emptyText: this.y18n.fanyi('notify.message.emptyText'),
516
- emptyImage: './assets/tmp/img/message.svg',
517
- clearText: this.y18n.fanyi('notify.message.clearText')
518
- },
519
- {
520
- key: 'todo',
521
- title: this.y18n.fanyi('notify.todo'),
522
- list: [],
523
- emptyText: this.y18n.fanyi('notify.todo.emptyText'),
524
- emptyImage: './assets/tmp/img/todo.svg',
525
- clearText: this.y18n.fanyi('notify.todo.clearText')
526
- },
527
- {
528
- key: 'notice',
529
- title: this.y18n.fanyi('notify.notice'),
530
- list: [],
531
- emptyText: this.y18n.fanyi('notify.notice.emptyText'),
532
- emptyImage: './assets/tmp/img/notice.svg',
533
- clearText: this.y18n.fanyi('notify.notice.clearText')
534
- }
535
- ];
536
- this.loading = false;
537
- this.count = 0;
538
- this.subs = [];
539
- }
540
- ngOnInit() {
541
- this.loadData();
542
- }
543
- loadData() {
544
- this.count = 0;
545
- this.loading = true;
546
- this.subs.push(forkJoin(this.loadTodo(), this.loadMessage()).subscribe(() => {
547
- this.loading = false;
548
- this.cdr.detectChanges();
549
- }));
550
- }
551
- loadMessage() {
552
- log('notify.component: ', 'fetch message list');
553
- const formatMessageStatus = (status) => {
554
- switch (status) {
555
- case '0':
556
- return { extra: this.y18n.fanyi('notify.unread'), color: 'red' };
557
- case '1':
558
- return { extra: this.y18n.fanyi('notify.readed'), color: 'green' };
559
- default:
560
- return { extra: this.y18n.fanyi('notify.nostatus'), color: 'primary' };
561
- }
562
- };
563
- return this.httpClient
564
- .post(`/message-center-3/my-msg-and-todo/msg-list`, {
565
- pageNum: 1,
566
- pageSize: 10,
567
- status: '0'
568
- })
569
- .pipe(map((response) => {
570
- const viewMessage = this.data.filter(d => d.key === 'msg')[0];
571
- viewMessage.list = response.data.list.map((m) => {
572
- return {
573
- ...m,
574
- avatar: m?.imgUrl || './assets/tmp/img/message.png',
575
- title: m.systemName,
576
- description: m.content,
577
- extra: formatMessageStatus(m.status).extra,
578
- color: formatMessageStatus(m.status).color,
579
- datetime: formatDistanceToNow(new Date(m.date), { locale: this.nzI18n.getDateLocale() })
580
- };
581
- });
582
- this.count += viewMessage.list.length;
583
- }));
584
- }
585
- loadTodo() {
586
- log('notify.component: ', 'fetch todo list');
587
- const formatTodoStatus = (status) => {
588
- switch (status) {
589
- case '0':
590
- return { extra: this.y18n.fanyi('notify.unstart'), color: 'red' };
591
- case '1':
592
- return { extra: this.y18n.fanyi('notify.started'), color: 'green' };
593
- default:
594
- return { extra: this.y18n.fanyi('notify.nostatus'), color: 'primary' };
595
- }
596
- };
597
- return this.httpClient
598
- .post(`/message-center-3/my-msg-and-todo/todo-list`, {
599
- pageNum: 1,
600
- pageSize: 10,
601
- status: '0'
602
- })
603
- .pipe(map((response) => {
604
- const viewTodo = this.data.filter(d => d.key === 'todo')[0];
605
- viewTodo.list = response.data.list.map((t) => {
606
- return {
607
- ...t,
608
- avatar: t?.imgUrl || './assets/tmp/img/todo.png',
609
- title: t.systemName,
610
- description: t.content,
611
- datetime: formatDistanceToNow(new Date(t.date), { locale: this.nzI18n.getDateLocale() }),
612
- extra: formatTodoStatus(t.status).extra,
613
- color: formatTodoStatus(t.status).color
614
- };
615
- });
616
- this.count += viewTodo.list.length;
617
- }));
618
- }
619
- clear(type) {
620
- const t = this.data.filter(d => d.title === type)[0];
621
- if (t.key == 'msg' || t.key == 'notice') {
622
- this.subs.push(this.httpClient.post(`/message-center-3/my-msg-and-todo/msg-clear`, {}).subscribe(_ => {
623
- this.msg.success(`${this.y18n.fanyi('notify.clear')} ${type}`);
624
- this.loadData();
625
- }));
626
- }
627
- if (t.key == 'todo') {
628
- this.loadData();
629
- }
630
- }
631
- select(res) {
632
- this.injector.get(WINDOW).open(res.item.url);
633
- this.loadData();
634
- }
635
- ngOnDestroy() {
636
- this.subs.forEach(a => a.unsubscribe());
637
- }
638
- }
639
- YzHeaderNotifyComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzHeaderNotifyComponent, deps: [{ token: i0.Injector }, { token: i1$2.NzMessageService }, { token: YUNZAI_I18N_TOKEN }, { token: i2.NzI18nService }, { token: i0.ChangeDetectorRef }, { token: i1._HttpClient }], target: i0.ɵɵFactoryTarget.Component });
640
- YzHeaderNotifyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.5", type: YzHeaderNotifyComponent, selector: "yz-header-notify", ngImport: i0, template: `
641
- <notice-icon
642
- [data]="data"
643
- [count]="count"
644
- [loading]="loading"
645
- btnClass="yunzai-default__nav-item"
646
- btnIconClass="yunzai-default__nav-item-icon"
647
- (select)="select($event)"
648
- (clear)="clear($event)"
649
- ></notice-icon>
650
- `, isInline: true, dependencies: [{ kind: "component", type: i4$2.NoticeIconComponent, selector: "notice-icon", inputs: ["data", "count", "loading", "popoverVisible", "btnClass", "btnIconClass"], outputs: ["select", "clear", "popoverVisibleChange"], exportAs: ["noticeIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
651
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzHeaderNotifyComponent, decorators: [{
652
- type: Component,
653
- args: [{
654
- selector: 'yz-header-notify',
655
- template: `
656
- <notice-icon
657
- [data]="data"
658
- [count]="count"
659
- [loading]="loading"
660
- btnClass="yunzai-default__nav-item"
661
- btnIconClass="yunzai-default__nav-item-icon"
662
- (select)="select($event)"
663
- (clear)="clear($event)"
664
- ></notice-icon>
665
- `,
666
- changeDetection: ChangeDetectionStrategy.OnPush
667
- }]
668
- }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i1$2.NzMessageService }, { type: YzI18NService, decorators: [{
669
- type: Inject,
670
- args: [YUNZAI_I18N_TOKEN]
671
- }] }, { type: i2.NzI18nService }, { type: i0.ChangeDetectorRef }, { type: i1._HttpClient }]; } });
672
-
673
- class YzHeaderThemBtnComponent {
674
- constructor(renderer, configSrv, platform, doc, directionality, KEYS) {
675
- this.renderer = renderer;
676
- this.configSrv = configSrv;
677
- this.platform = platform;
678
- this.doc = doc;
679
- this.directionality = directionality;
680
- this.KEYS = KEYS;
681
- this.theme = 'default';
682
- this.types = [
683
- { key: 'default', text: 'theme.default', color: '#2163ff' },
684
- { key: 'compact', text: 'theme.compact', color: '#2163ff' },
685
- { key: 'dark', text: 'theme.dark', color: '#020202' },
686
- { key: 'yuhong', text: 'theme.yuhong', color: '#C04851' },
687
- { key: 'danjuhuang', text: 'theme.danjuhuang', color: '#FBA414' },
688
- { key: 'xinghuang', text: 'theme.xinghuang', color: '#F28E16' },
689
- { key: 'shilv', text: 'theme.shilv', color: '#57C3C2' },
690
- { key: 'zhulv', text: 'theme.zhulv', color: '#1BA784' },
691
- { key: 'youlan', text: 'theme.youlan', color: '#1781B5' },
692
- { key: 'dianqing', text: 'theme.dianqing', color: '#1661AB' },
693
- { key: 'shangengzi', text: 'theme.shangengzi', color: '#61649F' },
694
- { key: 'shuiniuhui', text: 'theme.shuiniuhui', color: '#2F2F35' }
695
- ];
696
- this.devTips = `When the dark.css file can't be found, you need to run it once: npm run theme`;
697
- this.deployUrl = '';
698
- this.destroy$ = new Subject();
699
- this.dir = 'ltr';
700
- }
701
- ngOnInit() {
702
- this.dir = this.directionality.value;
703
- this.directionality.change?.pipe(takeUntil(this.destroy$)).subscribe((direction) => {
704
- this.dir = direction;
705
- });
706
- this.initTheme();
707
- }
708
- initTheme() {
709
- if (!this.platform.isBrowser) {
710
- return;
711
- }
712
- this.theme = localStorage.getItem(this.KEYS) || 'default';
713
- this.updateChartTheme();
714
- this.onThemeChange(this.theme);
715
- }
716
- updateChartTheme() {
717
- this.configSrv.set('chart', { theme: this.theme === 'dark' ? 'dark' : '' });
718
- }
719
- onThemeChange(theme) {
720
- if (!this.platform.isBrowser) {
721
- return;
722
- }
723
- this.theme = theme;
724
- this.renderer.setAttribute(this.doc.body, 'data-theme', theme);
725
- const dom = this.doc.getElementById(this.KEYS);
726
- if (dom) {
727
- dom.remove();
728
- }
729
- localStorage.removeItem(this.KEYS);
730
- if (theme !== 'default') {
731
- const el = this.doc.createElement('link');
732
- el.type = 'text/css';
733
- el.rel = 'stylesheet';
734
- el.id = this.KEYS;
735
- el.href = `${this.deployUrl}assets/style.${theme}.css`;
736
- localStorage.setItem(this.KEYS, theme);
737
- this.doc.body.append(el);
738
- }
739
- this.updateChartTheme();
740
- }
741
- ngOnDestroy() {
742
- const el = this.doc.getElementById(this.KEYS);
743
- if (el != null) {
744
- this.doc.body.removeChild(el);
745
- }
746
- this.destroy$.next();
747
- this.destroy$.complete();
748
- }
749
- }
750
- YzHeaderThemBtnComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzHeaderThemBtnComponent, deps: [{ token: i0.Renderer2 }, { token: i4.YunzaiConfigService }, { token: i3.Platform }, { token: DOCUMENT }, { token: i3$1.Directionality, optional: true }, { token: YUNZAI_THEME_BTN_KEYS }], target: i0.ɵɵFactoryTarget.Component });
751
- YzHeaderThemBtnComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.5", type: YzHeaderThemBtnComponent, selector: "yz-header-theme-btn", inputs: { types: "types", devTips: "devTips", deployUrl: "deployUrl" }, ngImport: i0, template: `
752
- <div
753
- class="yunzai-default__nav-item"
754
- nz-dropdown
755
- [nzDropdownMenu]="iconMenu"
756
- nzTrigger="click"
757
- nzPlacement="bottomRight"
758
- >
759
- <svg nz-tooltip class="anticon" role="img" width="21" height="21" viewBox="0 0 21 21" fill="currentColor">
760
- <g fill-rule="evenodd">
761
- <g fill-rule="nonzero">
762
- <path
763
- d="M7.02 3.635l12.518 12.518a1.863 1.863 0 010 2.635l-1.317 1.318a1.863 1.863 0 01-2.635 0L3.068 7.588A2.795 2.795 0 117.02 3.635zm2.09 14.428a.932.932 0 110 1.864.932.932 0 010-1.864zm-.043-9.747L7.75 9.635l9.154 9.153 1.318-1.317-9.154-9.155zM3.52 12.473c.514 0 .931.417.931.931v.932h.932a.932.932 0 110 1.864h-.932v.931a.932.932 0 01-1.863 0l-.001-.931h-.93a.932.932 0 010-1.864h.93v-.932c0-.514.418-.931.933-.931zm15.374-3.727a1.398 1.398 0 110 2.795 1.398 1.398 0 010-2.795zM4.385 4.953a.932.932 0 000 1.317l2.046 2.047L7.75 7 5.703 4.953a.932.932 0 00-1.318 0zM14.701.36a.932.932 0 01.931.932v.931h.932a.932.932 0 010 1.864h-.933l.001.932a.932.932 0 11-1.863 0l-.001-.932h-.93a.932.932 0 110-1.864h.93v-.931a.932.932 0 01.933-.932z"
764
- ></path>
765
- </g>
766
- </g>
767
- </svg>
768
- </div>
769
- <nz-dropdown-menu #iconMenu="nzDropdownMenu">
770
- <ul nz-menu>
771
- <li
772
- nz-menu-item
773
- *ngFor="let theme of types"
774
- (click)="onThemeChange(theme.key)"
775
- [style]="{ color: theme.color }"
776
- >
777
- <i nz-icon nzType="bg-colors"></i>
778
- {{ theme.text | i18n }}
779
- </li>
780
- </ul>
781
- <!-- <div nz-menu class="wd-xl animated jello">-->
782
- <!-- <div nz-row [nzJustify]="'space-between'" [nzAlign]="'middle'" class="app-icons">-->
783
- <!-- <div nz-col [nzSpan]="4" *ngFor="let theme of types" (click)="onThemeChange(theme.key)">-->
784
- <!-- <i nz-icon nzType="bg-colors" class="text-white" [style]="{ backgroundColor: theme.color }"></i>-->
785
- <!-- <span [ngStyle]="{ color: theme.color }">{{ theme.text | i18n }}</span>-->
786
- <!-- </div>-->
787
- <!-- </div>-->
788
- <!-- </div>-->
789
- </nz-dropdown-menu>
790
- `, isInline: true, dependencies: [{ kind: "directive", type: i4$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i5$1.ɵ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: i6.NzMenuDirective, selector: "[nz-menu]", inputs: ["nzInlineIndent", "nzTheme", "nzMode", "nzInlineCollapsed", "nzSelectable"], outputs: ["nzClick"], exportAs: ["nzMenu"] }, { kind: "directive", type: i6.NzMenuItemDirective, selector: "[nz-menu-item]", inputs: ["nzPaddingLeft", "nzDisabled", "nzSelected", "nzDanger", "nzMatchRouterExact", "nzMatchRouter"], exportAs: ["nzMenuItem"] }, { kind: "directive", type: i7$1.NzDropDownDirective, selector: "[nz-dropdown]", inputs: ["nzDropdownMenu", "nzTrigger", "nzMatchWidthElement", "nzBackdrop", "nzClickHide", "nzDisabled", "nzVisible", "nzOverlayClassName", "nzOverlayStyle", "nzPlacement"], outputs: ["nzVisibleChange"], exportAs: ["nzDropdown"] }, { kind: "component", type: i7$1.NzDropdownMenuComponent, selector: "nz-dropdown-menu", exportAs: ["nzDropdownMenu"] }, { kind: "directive", type: i8$1.NzTooltipDirective, selector: "[nz-tooltip]", inputs: ["nzTooltipTitle", "nzTooltipTitleContext", "nz-tooltip", "nzTooltipTrigger", "nzTooltipPlacement", "nzTooltipOrigin", "nzTooltipVisible", "nzTooltipMouseEnterDelay", "nzTooltipMouseLeaveDelay", "nzTooltipOverlayClassName", "nzTooltipOverlayStyle", "nzTooltipArrowPointAtCenter", "nzTooltipColor"], outputs: ["nzTooltipVisibleChange"], exportAs: ["nzTooltip"] }, { kind: "directive", type: i8.NzIconDirective, selector: "[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { kind: "pipe", type: i1.I18nPipe, name: "i18n" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
791
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzHeaderThemBtnComponent, decorators: [{
792
- type: Component,
793
- args: [{
794
- selector: 'yz-header-theme-btn',
795
- template: `
796
- <div
797
- class="yunzai-default__nav-item"
798
- nz-dropdown
799
- [nzDropdownMenu]="iconMenu"
800
- nzTrigger="click"
801
- nzPlacement="bottomRight"
802
- >
803
- <svg nz-tooltip class="anticon" role="img" width="21" height="21" viewBox="0 0 21 21" fill="currentColor">
804
- <g fill-rule="evenodd">
805
- <g fill-rule="nonzero">
806
- <path
807
- d="M7.02 3.635l12.518 12.518a1.863 1.863 0 010 2.635l-1.317 1.318a1.863 1.863 0 01-2.635 0L3.068 7.588A2.795 2.795 0 117.02 3.635zm2.09 14.428a.932.932 0 110 1.864.932.932 0 010-1.864zm-.043-9.747L7.75 9.635l9.154 9.153 1.318-1.317-9.154-9.155zM3.52 12.473c.514 0 .931.417.931.931v.932h.932a.932.932 0 110 1.864h-.932v.931a.932.932 0 01-1.863 0l-.001-.931h-.93a.932.932 0 010-1.864h.93v-.932c0-.514.418-.931.933-.931zm15.374-3.727a1.398 1.398 0 110 2.795 1.398 1.398 0 010-2.795zM4.385 4.953a.932.932 0 000 1.317l2.046 2.047L7.75 7 5.703 4.953a.932.932 0 00-1.318 0zM14.701.36a.932.932 0 01.931.932v.931h.932a.932.932 0 010 1.864h-.933l.001.932a.932.932 0 11-1.863 0l-.001-.932h-.93a.932.932 0 110-1.864h.93v-.931a.932.932 0 01.933-.932z"
808
- ></path>
809
- </g>
810
- </g>
811
- </svg>
812
- </div>
813
- <nz-dropdown-menu #iconMenu="nzDropdownMenu">
814
- <ul nz-menu>
815
- <li
816
- nz-menu-item
817
- *ngFor="let theme of types"
818
- (click)="onThemeChange(theme.key)"
819
- [style]="{ color: theme.color }"
820
- >
821
- <i nz-icon nzType="bg-colors"></i>
822
- {{ theme.text | i18n }}
823
- </li>
824
- </ul>
825
- <!-- <div nz-menu class="wd-xl animated jello">-->
826
- <!-- <div nz-row [nzJustify]="'space-between'" [nzAlign]="'middle'" class="app-icons">-->
827
- <!-- <div nz-col [nzSpan]="4" *ngFor="let theme of types" (click)="onThemeChange(theme.key)">-->
828
- <!-- <i nz-icon nzType="bg-colors" class="text-white" [style]="{ backgroundColor: theme.color }"></i>-->
829
- <!-- <span [ngStyle]="{ color: theme.color }">{{ theme.text | i18n }}</span>-->
830
- <!-- </div>-->
831
- <!-- </div>-->
832
- <!-- </div>-->
833
- </nz-dropdown-menu>
834
- `,
835
- changeDetection: ChangeDetectionStrategy.OnPush
836
- }]
837
- }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i4.YunzaiConfigService }, { type: i3.Platform }, { type: undefined, decorators: [{
838
- type: Inject,
839
- args: [DOCUMENT]
840
- }] }, { type: i3$1.Directionality, decorators: [{
841
- type: Optional
842
- }] }, { type: undefined, decorators: [{
843
- type: Inject,
844
- args: [YUNZAI_THEME_BTN_KEYS]
845
- }] }]; }, propDecorators: { types: [{
846
- type: Input
847
- }], devTips: [{
848
- type: Input
849
- }], deployUrl: [{
850
- type: Input
851
- }] } });
852
-
853
- const BUSINESS_DEFAULT_CONFIG = {
854
- baseUrl: '/backstage',
855
- systemCode: 'portal',
856
- loginForm: null,
857
- refreshTokenEnabled: true,
858
- refreshTokenType: 're-request'
859
- };
860
- function mergeBisConfig(srv) {
861
- return srv.merge('bis', BUSINESS_DEFAULT_CONFIG);
862
- }
863
-
864
- class YzHeaderUserComponent {
865
- constructor(injector, msg, tokenService,
866
- // @ts-ignore
867
- configService, cacheService) {
868
- this.injector = injector;
869
- this.msg = msg;
870
- this.tokenService = tokenService;
871
- this.configService = configService;
872
- this.cacheService = cacheService;
873
- this.icon = '';
874
- this.username = '';
875
- this.menus = [];
876
- this.config = mergeBisConfig(configService);
877
- }
878
- ngOnInit() {
879
- const projectInfo = this.cacheService.get('_yz_project_info', { mode: 'none' });
880
- const user = this.cacheService.get('_yz_user', { mode: 'none' });
881
- this.username = user.realname ? user.realname : '未命名';
882
- this.icon = user.avatarId
883
- ? `${this.config.baseUrl}/filecenter/file/${user.avatarId}`
884
- : `./assets/tmp/img/avatar.jpg`;
885
- this.menus = projectInfo.profileList;
886
- }
887
- logout() {
888
- localStorage.clear();
889
- this.tokenService.clear();
890
- this.injector.get(WINDOW).location.href = `${this.config.baseUrl}/cas-proxy/app/logout`;
891
- }
892
- to(href) {
893
- if (href) {
894
- this.injector.get(WINDOW).open(href);
895
- }
896
- else {
897
- this.msg.error('该菜单没有配置链接!');
898
- }
899
- }
900
- }
901
- YzHeaderUserComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzHeaderUserComponent, deps: [{ token: i0.Injector }, { token: i1$2.NzMessageService }, { token: YA_SERVICE_TOKEN }, { token: i1$3.YunzaiConfigService }, { token: i1$1.CacheService }], target: i0.ɵɵFactoryTarget.Component });
902
- YzHeaderUserComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.5", type: YzHeaderUserComponent, selector: "yz-header-user", ngImport: i0, template: `
903
- <div
904
- class="yunzai-default__nav-item d-flex align-items-center px-sm"
905
- nz-dropdown
906
- nzPlacement="bottomRight"
907
- [nzDropdownMenu]="userMenu"
908
- >
909
- <div class="yz-user-name">
910
- <nz-avatar [nzSrc]="icon" nzSize="small" class="mr-sm"></nz-avatar>
911
- {{ username }}
912
- </div>
913
- </div>
914
- <nz-dropdown-menu #userMenu="nzDropdownMenu">
915
- <div nz-menu class="width-sm">
916
- <div nz-menu-item *ngFor="let m of menus" (click)="to(m.url)">
917
- <i nz-icon [nzType]="m.icon" class="mr-sm"></i>
918
- {{ m.name | i18n }}
919
- </div>
920
- <li nz-menu-divider></li>
921
- <div nz-menu-item (click)="logout()">
922
- <i nz-icon nzType="logout" class="mr-sm"></i>
923
- {{ 'menu.account.logout' | i18n }}
924
- </div>
925
- </div>
926
- </nz-dropdown-menu>
927
- `, isInline: true, dependencies: [{ kind: "directive", type: i4$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i5$1.ɵ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: i6.NzMenuDirective, selector: "[nz-menu]", inputs: ["nzInlineIndent", "nzTheme", "nzMode", "nzInlineCollapsed", "nzSelectable"], outputs: ["nzClick"], exportAs: ["nzMenu"] }, { kind: "directive", type: i6.NzMenuItemDirective, selector: "[nz-menu-item]", inputs: ["nzPaddingLeft", "nzDisabled", "nzSelected", "nzDanger", "nzMatchRouterExact", "nzMatchRouter"], exportAs: ["nzMenuItem"] }, { kind: "directive", type: i6.NzMenuDividerDirective, selector: "[nz-menu-divider]", exportAs: ["nzMenuDivider"] }, { kind: "directive", type: i7$1.NzDropDownDirective, selector: "[nz-dropdown]", inputs: ["nzDropdownMenu", "nzTrigger", "nzMatchWidthElement", "nzBackdrop", "nzClickHide", "nzDisabled", "nzVisible", "nzOverlayClassName", "nzOverlayStyle", "nzPlacement"], outputs: ["nzVisibleChange"], exportAs: ["nzDropdown"] }, { kind: "component", type: i7$1.NzDropdownMenuComponent, selector: "nz-dropdown-menu", exportAs: ["nzDropdownMenu"] }, { kind: "directive", type: i8.NzIconDirective, selector: "[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { kind: "component", type: i9$1.NzAvatarComponent, selector: "nz-avatar", inputs: ["nzShape", "nzSize", "nzGap", "nzText", "nzSrc", "nzSrcSet", "nzAlt", "nzIcon"], outputs: ["nzError"], exportAs: ["nzAvatar"] }, { kind: "pipe", type: i1.I18nPipe, name: "i18n" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
928
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzHeaderUserComponent, decorators: [{
929
- type: Component,
930
- args: [{
931
- selector: 'yz-header-user',
932
- template: `
933
- <div
934
- class="yunzai-default__nav-item d-flex align-items-center px-sm"
935
- nz-dropdown
936
- nzPlacement="bottomRight"
937
- [nzDropdownMenu]="userMenu"
938
- >
939
- <div class="yz-user-name">
940
- <nz-avatar [nzSrc]="icon" nzSize="small" class="mr-sm"></nz-avatar>
941
- {{ username }}
942
- </div>
943
- </div>
944
- <nz-dropdown-menu #userMenu="nzDropdownMenu">
945
- <div nz-menu class="width-sm">
946
- <div nz-menu-item *ngFor="let m of menus" (click)="to(m.url)">
947
- <i nz-icon [nzType]="m.icon" class="mr-sm"></i>
948
- {{ m.name | i18n }}
949
- </div>
950
- <li nz-menu-divider></li>
951
- <div nz-menu-item (click)="logout()">
952
- <i nz-icon nzType="logout" class="mr-sm"></i>
953
- {{ 'menu.account.logout' | i18n }}
954
- </div>
955
- </div>
956
- </nz-dropdown-menu>
957
- `,
958
- changeDetection: ChangeDetectionStrategy.OnPush
959
- }]
960
- }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i1$2.NzMessageService }, { type: undefined, decorators: [{
961
- type: Inject,
962
- args: [YA_SERVICE_TOKEN]
963
- }] }, { type: i1$3.YunzaiConfigService }, { type: i1$1.CacheService }]; } });
964
-
965
- class YzHeaderClearStorageComponent {
966
- constructor(modalSrv, messageSrv) {
967
- this.modalSrv = modalSrv;
968
- this.messageSrv = messageSrv;
969
- }
970
- _click() {
971
- this.modalSrv.confirm({
972
- nzTitle: 'Make sure clear all local storage?',
973
- nzOnOk: () => {
974
- localStorage.clear();
975
- this.messageSrv.success('Clear Finished!');
976
- }
977
- });
978
- }
979
- }
980
- YzHeaderClearStorageComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzHeaderClearStorageComponent, deps: [{ token: i1$4.NzModalService }, { token: i1$2.NzMessageService }], target: i0.ɵɵFactoryTarget.Component });
981
- YzHeaderClearStorageComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.5", type: YzHeaderClearStorageComponent, selector: "yz-header-clear-storage", host: { listeners: { "click": "_click()" }, properties: { "class.d-block": "true" } }, ngImport: i0, template: `
982
- <i nz-icon nzType="tool"></i>
983
- {{ 'menu.clear.local.storage' | i18n }}
984
- `, isInline: true, dependencies: [{ kind: "directive", type: i5$1.ɵ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: i8.NzIconDirective, selector: "[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { kind: "pipe", type: i1.I18nPipe, name: "i18n" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
985
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzHeaderClearStorageComponent, decorators: [{
986
- type: Component,
987
- args: [{
988
- selector: 'yz-header-clear-storage',
989
- template: `
990
- <i nz-icon nzType="tool"></i>
991
- {{ 'menu.clear.local.storage' | i18n }}
992
- `,
993
- host: {
994
- '[class.d-block]': 'true'
995
- },
996
- changeDetection: ChangeDetectionStrategy.OnPush
997
- }]
998
- }], ctorParameters: function () { return [{ type: i1$4.NzModalService }, { type: i1$2.NzMessageService }]; }, propDecorators: { _click: [{
999
- type: HostListener,
1000
- args: ['click']
1001
- }] } });
1002
-
1003
- class YzHeaderFullScreenComponent {
1004
- constructor() {
1005
- this.status = false;
1006
- }
1007
- _resize() {
1008
- this.status = screenfull.isFullscreen;
1009
- }
1010
- _click() {
1011
- if (screenfull.isEnabled) {
1012
- screenfull.toggle();
1013
- }
1014
- }
1015
- }
1016
- YzHeaderFullScreenComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzHeaderFullScreenComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1017
- YzHeaderFullScreenComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.5", type: YzHeaderFullScreenComponent, selector: "yz-header-fullscreen", host: { listeners: { "window:resize": "_resize()", "click": "_click()" }, properties: { "class.d-block": "true" } }, ngImport: i0, template: `
1018
- <i nz-icon [nzType]="status ? 'fullscreen-exit' : 'fullscreen'"></i>
1019
- {{ (status ? 'menu.fullscreen.exit' : 'menu.fullscreen') | i18n }}
1020
- `, isInline: true, dependencies: [{ kind: "directive", type: i5$1.ɵ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: i8.NzIconDirective, selector: "[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { kind: "pipe", type: i1.I18nPipe, name: "i18n" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1021
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzHeaderFullScreenComponent, decorators: [{
1022
- type: Component,
1023
- args: [{
1024
- selector: 'yz-header-fullscreen',
1025
- template: `
1026
- <i nz-icon [nzType]="status ? 'fullscreen-exit' : 'fullscreen'"></i>
1027
- {{ (status ? 'menu.fullscreen.exit' : 'menu.fullscreen') | i18n }}
1028
- `,
1029
- host: {
1030
- '[class.d-block]': 'true'
1031
- },
1032
- changeDetection: ChangeDetectionStrategy.OnPush
1033
- }]
1034
- }], propDecorators: { _resize: [{
1035
- type: HostListener,
1036
- args: ['window:resize']
1037
- }], _click: [{
1038
- type: HostListener,
1039
- args: ['click']
1040
- }] } });
1041
-
1042
- class YzHeaderApplicationGroupComponent {
1043
- constructor(inject, cacheService, http) {
1044
- this.inject = inject;
1045
- this.cacheService = cacheService;
1046
- this.http = http;
1047
- this.topicData = [];
1048
- this.subs = [];
1049
- }
1050
- ngOnInit() {
1051
- this.topicData = this.cacheService.get('_yz_header', { mode: 'none' });
1052
- console.log(this.topicData);
1053
- }
1054
- ngOnDestroy() {
1055
- this.subs.forEach(s => s.unsubscribe());
1056
- }
1057
- open(topic) {
1058
- if (topic.key) {
1059
- this.subs.push(this.http
1060
- .post(`/app-manager/web-scan/save`, {
1061
- appId: topic.key,
1062
- createDate: new Date()
1063
- })
1064
- .subscribe());
1065
- }
1066
- switch (topic.target) {
1067
- case 'href':
1068
- this.inject.get(WINDOW).location.href = topic.url;
1069
- break;
1070
- case 'blank':
1071
- this.inject.get(WINDOW).location.href = topic.url;
1072
- break;
1073
- case 'target':
1074
- this.inject.get(WINDOW).location.href = topic.url;
1075
- break;
1076
- default:
1077
- this.inject.get(WINDOW).location.href = topic.url;
1078
- break;
1079
- }
1080
- }
1081
- }
1082
- YzHeaderApplicationGroupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzHeaderApplicationGroupComponent, deps: [{ token: i0.Injector }, { token: i1$1.CacheService }, { token: i1._HttpClient }], target: i0.ɵɵFactoryTarget.Component });
1083
- YzHeaderApplicationGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.5", type: YzHeaderApplicationGroupComponent, selector: "yz-header-application-group", ngImport: i0, template: `
1084
- <div class="yz-application-group">
1085
- <nz-tabset>
1086
- <nz-tab *ngFor="let menu of topicData" [nzTitle]="groupTitleTpl">
1087
- <ng-template #groupTitleTpl>
1088
- <a
1089
- nz-dropdown
1090
- [nzDropdownMenu]="menuTpl"
1091
- [nzTrigger]="'click'"
1092
- [nzOverlayClassName]="'yz-application-dropdown'"
1093
- >
1094
- <i nz-icon *ngIf="menu.icon" [nzType]="menu.icon" nzTheme="outline"></i>
1095
- {{ menu.name | i18n }}
1096
- <i *ngIf="menu.children && menu.children.length > 0" nz-icon nzType="down" nzTheme="outline"></i>
1097
- </a>
1098
- <nz-dropdown-menu #menuTpl="nzDropdownMenu">
1099
- <ul nz-menu nzSelectable *ngIf="menu.children && menu.children.length > 0">
1100
- <ng-container *ngFor="let item of menu.children">
1101
- <li nz-menu-item (click)="open(item)">
1102
- <i nz-icon *ngIf="item.icon" [nzType]="item.icon" nzTheme="outline"></i>{{ item.name | i18n }}
1103
- </li>
1104
- </ng-container>
1105
- </ul>
1106
- </nz-dropdown-menu>
1107
- </ng-template>
1108
- </nz-tab>
1109
- </nz-tabset>
1110
- </div>
1111
- `, 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: i5$1.ɵ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: i6.NzMenuDirective, selector: "[nz-menu]", inputs: ["nzInlineIndent", "nzTheme", "nzMode", "nzInlineCollapsed", "nzSelectable"], outputs: ["nzClick"], exportAs: ["nzMenu"] }, { kind: "directive", type: i6.NzMenuItemDirective, selector: "[nz-menu-item]", inputs: ["nzPaddingLeft", "nzDisabled", "nzSelected", "nzDanger", "nzMatchRouterExact", "nzMatchRouter"], exportAs: ["nzMenuItem"] }, { kind: "directive", type: i7$1.NzDropDownDirective, selector: "[nz-dropdown]", inputs: ["nzDropdownMenu", "nzTrigger", "nzMatchWidthElement", "nzBackdrop", "nzClickHide", "nzDisabled", "nzVisible", "nzOverlayClassName", "nzOverlayStyle", "nzPlacement"], outputs: ["nzVisibleChange"], exportAs: ["nzDropdown"] }, { kind: "directive", type: i7$1.NzDropDownADirective, selector: "a[nz-dropdown]" }, { kind: "component", type: i7$1.NzDropdownMenuComponent, selector: "nz-dropdown-menu", exportAs: ["nzDropdownMenu"] }, { kind: "directive", type: i8.NzIconDirective, selector: "[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { kind: "component", type: i8$2.NzTabSetComponent, selector: "nz-tabset", inputs: ["nzSelectedIndex", "nzTabPosition", "nzTabBarExtraContent", "nzCanDeactivate", "nzAddIcon", "nzTabBarStyle", "nzType", "nzSize", "nzAnimated", "nzTabBarGutter", "nzHideAdd", "nzCentered", "nzHideAll", "nzLinkRouter", "nzLinkExact"], outputs: ["nzSelectChange", "nzSelectedIndexChange", "nzTabListScroll", "nzClose", "nzAdd"], exportAs: ["nzTabset"] }, { kind: "component", type: i8$2.NzTabComponent, selector: "nz-tab", inputs: ["nzTitle", "nzClosable", "nzCloseIcon", "nzDisabled", "nzForceRender"], outputs: ["nzSelect", "nzDeselect", "nzClick", "nzContextmenu"], exportAs: ["nzTab"] }, { kind: "pipe", type: i1.I18nPipe, name: "i18n" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1112
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzHeaderApplicationGroupComponent, decorators: [{
1113
- type: Component,
1114
- args: [{
1115
- selector: 'yz-header-application-group',
1116
- template: `
1117
- <div class="yz-application-group">
1118
- <nz-tabset>
1119
- <nz-tab *ngFor="let menu of topicData" [nzTitle]="groupTitleTpl">
1120
- <ng-template #groupTitleTpl>
1121
- <a
1122
- nz-dropdown
1123
- [nzDropdownMenu]="menuTpl"
1124
- [nzTrigger]="'click'"
1125
- [nzOverlayClassName]="'yz-application-dropdown'"
1126
- >
1127
- <i nz-icon *ngIf="menu.icon" [nzType]="menu.icon" nzTheme="outline"></i>
1128
- {{ menu.name | i18n }}
1129
- <i *ngIf="menu.children && menu.children.length > 0" nz-icon nzType="down" nzTheme="outline"></i>
1130
- </a>
1131
- <nz-dropdown-menu #menuTpl="nzDropdownMenu">
1132
- <ul nz-menu nzSelectable *ngIf="menu.children && menu.children.length > 0">
1133
- <ng-container *ngFor="let item of menu.children">
1134
- <li nz-menu-item (click)="open(item)">
1135
- <i nz-icon *ngIf="item.icon" [nzType]="item.icon" nzTheme="outline"></i>{{ item.name | i18n }}
1136
- </li>
1137
- </ng-container>
1138
- </ul>
1139
- </nz-dropdown-menu>
1140
- </ng-template>
1141
- </nz-tab>
1142
- </nz-tabset>
1143
- </div>
1144
- `,
1145
- changeDetection: ChangeDetectionStrategy.OnPush
1146
- }]
1147
- }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i1$1.CacheService }, { type: i1._HttpClient }]; } });
1148
-
1149
- class ContactService {
1150
- constructor(http, cache) {
1151
- this.http = http;
1152
- this.cache = cache;
1153
- }
1154
- /**
1155
- * 部门树查询
1156
- *
1157
- * @param clas 包含班级
1158
- * @param his 包含历史班级
1159
- * @param grade 系部
1160
- * @param gradeID 系部ID
1161
- * @returns 可观察部门树
1162
- */
1163
- dept(clas, his, grade, gradeID) {
1164
- let baseUrl = `/auth/baseDepartMent/tree?debug=false`;
1165
- if (clas) {
1166
- baseUrl += `&includeClass=true`;
1167
- }
1168
- else {
1169
- baseUrl += `&includeClass=false`;
1170
- }
1171
- if (his) {
1172
- baseUrl += `&includeHisClass=true`;
1173
- }
1174
- else {
1175
- baseUrl += `&includeHisClass=false`;
1176
- }
1177
- if (grade) {
1178
- baseUrl += `&deptTypes=2,class`;
1179
- }
1180
- if (gradeID) {
1181
- baseUrl += `&gradeId=${gradeID}`;
1182
- }
1183
- return this.http.get(baseUrl).pipe(map((response) => {
1184
- return response.data || [];
1185
- }));
1186
- }
1187
- page(uri, page) {
1188
- return this.http.post(`${uri}/queryListForPage`, page);
1189
- }
1190
- pageBaseUser(page) {
1191
- return this.page('/auth/baseUser', page);
1192
- }
1193
- getUserByIds(ids) {
1194
- return this.http
1195
- .post('/auth/baseUser/users', {
1196
- userIds: ids
1197
- })
1198
- .pipe((response) => {
1199
- return response.data || [];
1200
- });
1201
- }
1202
- /**
1203
- * 查询人员信息
1204
- *
1205
- * @param userIds[] 用户id数组,["aaa","bbb","ccc"]
1206
- */
1207
- getUserByUserIds(userIds) {
1208
- return this.http
1209
- .post(`/auth/baseUser/users`, {
1210
- userIds: userIds
1211
- })
1212
- .pipe(map((response) => {
1213
- return response.data ? response.data : [];
1214
- }));
1215
- }
1216
- /**
1217
- * 获取角色组角色
1218
- *
1219
- * @param roleGroupCode 角色组code
1220
- */
1221
- getGroupRole(roleGroupCode) {
1222
- return this.http
1223
- .post(`/auth/baseRole/findGroupRole`, {
1224
- roleGroupCode: roleGroupCode
1225
- })
1226
- .pipe(map((response) => {
1227
- return response.data ? response.data : [];
1228
- }));
1229
- }
1230
- /**
1231
- * 查询当前用户好友分组
1232
- */
1233
- getFriendGroup() {
1234
- return this.http.post(`/contact/appcontact/findGroup`, {}).pipe(map((response) => {
1235
- return response.data ? response.data : [];
1236
- }));
1237
- }
1238
- /**
1239
- * 查询年级
1240
- */
1241
- getGrade() {
1242
- return this.http.get(`/auth/gradeYear/queryListForPage`).pipe(map((response) => {
1243
- return response.data ? response.data : [];
1244
- }));
1245
- }
1246
- /**
1247
- * 查询人员类别列表
1248
- */
1249
- getRylbs() {
1250
- return this.http.post(`/auth/baseTeacher/queryRylbs`, {}).pipe(map((response) => {
1251
- return response.data ? response.data : [];
1252
- }));
1253
- }
1254
- /**
1255
- * 获取学生公寓树
1256
- *
1257
- * @param isPower 是否带有权限,默认false
1258
- * @param treeType 树类型 0:宿舍楼 1:宿舍楼+层 2:宿舍楼+层+房间
1259
- */
1260
- getDormTree(isPower, treeType) {
1261
- const user = this.cache.get('_yz_user', { mode: 'none' });
1262
- let params = {};
1263
- if (isPower) {
1264
- params = {
1265
- isPower: isPower,
1266
- userId: user.userId,
1267
- treeType: treeType
1268
- };
1269
- }
1270
- else {
1271
- params = {
1272
- isPower: isPower,
1273
- treeType: treeType
1274
- };
1275
- }
1276
- return this.http.post(`/auth/dorm/tree`, params).pipe(map((response) => {
1277
- return response.data ? response.data : [];
1278
- }));
1279
- }
1280
- }
1281
- ContactService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: ContactService, deps: [{ token: i1._HttpClient }, { token: i1$1.CacheService }], target: i0.ɵɵFactoryTarget.Injectable });
1282
- ContactService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: ContactService, providedIn: 'root' });
1283
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: ContactService, decorators: [{
1284
- type: Injectable,
1285
- args: [{
1286
- providedIn: 'root'
1287
- }]
1288
- }], ctorParameters: function () { return [{ type: i1._HttpClient }, { type: i1$1.CacheService }]; } });
1289
-
1290
- class ContactComponent {
1291
- constructor(contact, changeDetectorRef) {
1292
- this.contact = contact;
1293
- this.changeDetectorRef = changeDetectorRef;
1294
- this.subs = [];
1295
- /**
1296
- * tabset
1297
- */
1298
- this.nzTabsetSearch = null;
1299
- this.nzTabsetLoading = false;
1300
- /**
1301
- * 树展开状态
1302
- */
1303
- this.nzExpandAll = true;
1304
- /**
1305
- * 部门树和部门查询的一些选项/可传可不传
1306
- */
1307
- this.nzDepts = [];
1308
- this._nzDeptsCopy = [];
1309
- this.nzDeptTreeVirtualHeight = null;
1310
- this.nzDeptClass = true;
1311
- this.nzDeptClassHistory = true;
1312
- this.nzDeptGrade = false;
1313
- this.nzDeptGradeID = null;
1314
- /**
1315
- * 角色树
1316
- */
1317
- this.nzRoles = [];
1318
- this._nzRolesCopy = [];
1319
- this.nzRoleTreeVirtualHeight = null;
1320
- /**
1321
- * 好友分组
1322
- */
1323
- this.nzFriendGroups = [];
1324
- this._nzFriendGroupsCopy = [];
1325
- /**
1326
- * 联系人
1327
- */
1328
- this.defaultContacts = [];
1329
- this.nzContacts = [];
1330
- this.nzContactLoading = false;
1331
- /**
1332
- * 提交和提交按钮
1333
- */
1334
- this.button = true;
1335
- this.confirmed = new EventEmitter();
1336
- }
1337
- /**
1338
- * 初始化,首先加载部门树和默认选中的人的数据
1339
- */
1340
- ngOnInit() {
1341
- this.onTabsetDept();
1342
- this.onContactsInit();
1343
- }
1344
- /**
1345
- * 视图初始化完毕后进行table初始化
1346
- */
1347
- ngAfterViewInit() {
1348
- this.onTableInit();
1349
- }
1350
- /**
1351
- * 初始化默认选中联系人
1352
- */
1353
- onContactsInit() {
1354
- if (this.defaultContacts && this.defaultContacts.length > 0) {
1355
- this.nzContactLoading = true;
1356
- this.subs.push(this.contact.getUserByUserIds(this.defaultContacts).subscribe(contacts => {
1357
- this.nzContacts = contacts;
1358
- this.nzContactLoading = false;
1359
- this.refresh();
1360
- }));
1361
- }
1362
- }
1363
- /**
1364
- * table初始化
1365
- */
1366
- onTableInit() {
1367
- // 设置表头
1368
- this.st.resetColumns({
1369
- columns: [
1370
- { title: '选择', type: 'checkbox' },
1371
- { title: '序号', type: 'no' },
1372
- { title: '姓名', index: 'realName' },
1373
- { title: '学号/工号', index: 'userCode' },
1374
- { title: '部门', index: 'dept.deptName' }
1375
- ]
1376
- });
1377
- // 订阅table点击checkbox事件变化
1378
- this.subs.push(this.st.change.subscribe(e => {
1379
- if (e.type === 'checkbox') {
1380
- // 点击checkbox新增联系人
1381
- const contactIds = this.nzContacts.map(c => c.userId);
1382
- this.nzContacts = this.nzContacts.concat(e.checkbox.filter(c => !contactIds.includes(c.userId)));
1383
- // 取消checkbox取消联系人
1384
- const cancelIds = this.st.list.filter(d => !d.checked).map(d => d.userId);
1385
- this.nzContacts = this.nzContacts.filter(d => !cancelIds.includes(d.userId));
1386
- }
1387
- }));
1388
- }
1389
- /**
1390
- * tabset进入加载状态
1391
- */
1392
- onTabsetLoadStart() {
1393
- this.nzTabsetLoading = true;
1394
- }
1395
- /**
1396
- * tabset取消加载状态
1397
- */
1398
- onTabsetLoadEnd() {
1399
- this.nzTabsetLoading = false;
1400
- }
1401
- /**
1402
- * tabset搜索框清除
1403
- */
1404
- onTabsetSearchClean() {
1405
- this.nzDepts = this._nzDeptsCopy;
1406
- this.nzRoles = this._nzRolesCopy;
1407
- this.nzFriendGroups = this._nzFriendGroupsCopy;
1408
- this.nzTabsetSearch = null;
1409
- }
1410
- /**
1411
- * tabset搜索框输入
1412
- *
1413
- * @param type 类型
1414
- * @param value 值
1415
- */
1416
- onTabsetSearchChange(type, value) {
1417
- this.onTabsetLoadStart();
1418
- if (!value || value === '') {
1419
- this.nzDepts = this._nzDeptsCopy;
1420
- this.nzRoles = this._nzRolesCopy;
1421
- this.nzFriendGroups = this._nzFriendGroupsCopy;
1422
- }
1423
- else {
1424
- const trees = [];
1425
- if (type === 'dept') {
1426
- this.searchTree(value, this._nzDeptsCopy, trees);
1427
- this.nzDepts = trees;
1428
- }
1429
- if (type === 'role') {
1430
- this.searchTree(value, this._nzRolesCopy, trees);
1431
- this.nzRoles = trees;
1432
- }
1433
- if (type === 'friendGroup') {
1434
- this.nzFriendGroups = this._nzFriendGroupsCopy.filter(f => {
1435
- return !f.name.indexOf(value);
1436
- });
1437
- }
1438
- }
1439
- this.onTabsetLoadEnd();
1440
- this.refresh();
1441
- }
1442
- /**
1443
- * tabset切换到部门
1444
- */
1445
- onTabsetDept() {
1446
- this.onTabsetSearchClean();
1447
- if (!this.nzDepts || this.nzDepts.length === 0) {
1448
- this.onTabsetDeptFlush();
1449
- }
1450
- }
1451
- /**
1452
- * tabset切换到角色
1453
- */
1454
- onTabsetRole() {
1455
- this.onTabsetSearchClean();
1456
- if (!this.nzRoles || this.nzRoles.length === 0) {
1457
- this.onTabsetRoleFlush(null);
1458
- }
1459
- }
1460
- /**
1461
- * tabset切换到好友分组
1462
- */
1463
- onTabsetFriendGroup() {
1464
- this.onTabsetSearchClean();
1465
- if (!this.nzFriendGroups || this.nzFriendGroups.length === 0) {
1466
- this.onTabsetFriendGroupFlush();
1467
- }
1468
- }
1469
- /**
1470
- * 获取部门树
1471
- */
1472
- onTabsetDeptFlush() {
1473
- this.onTabsetLoadStart();
1474
- this.subs.push(this.contact
1475
- .dept(this.nzDeptClass, this.nzDeptClassHistory, this.nzDeptGrade, this.nzDeptGradeID)
1476
- .subscribe((trees) => {
1477
- this.expandTree(trees);
1478
- this.nzDepts = trees;
1479
- this._nzDeptsCopy = trees;
1480
- this.onTabsetLoadEnd();
1481
- this.refresh();
1482
- }));
1483
- }
1484
- // 获取角色树
1485
- onTabsetRoleFlush(groupRoleCode) {
1486
- this.onTabsetLoadStart();
1487
- this.subs.push(this.contact.getGroupRole(groupRoleCode).subscribe((roles) => {
1488
- this.expandTree(roles);
1489
- this.nzRoles = roles;
1490
- this._nzRolesCopy = roles;
1491
- this.onTabsetLoadEnd();
1492
- this.refresh();
1493
- }));
1494
- }
1495
- // 获取好友分组列表
1496
- onTabsetFriendGroupFlush() {
1497
- this.onTabsetLoadStart();
1498
- this.subs.push(this.contact.getFriendGroup().subscribe((group) => {
1499
- this.nzFriendGroups = group;
1500
- this._nzFriendGroupsCopy = group;
1501
- this.onTabsetLoadEnd();
1502
- this.refresh();
1503
- }));
1504
- }
1505
- /**
1506
- * 部门树点击
1507
- *
1508
- * @param e 节点
1509
- */
1510
- onDeptClick(e) {
1511
- // 构造分页请求,直接传入stTable组件,剩下的所有交给组件自己完成
1512
- this.st.data = '/auth/baseUser/queryListForPage';
1513
- this.st.req = {
1514
- allInBody: true,
1515
- method: 'POST',
1516
- type: 'page',
1517
- reName: {
1518
- pi: 'pageNum',
1519
- ps: 'pageSize'
1520
- },
1521
- body: {
1522
- pageParam: {
1523
- deptId: e.keys?.pop()
1524
- }
1525
- }
1526
- };
1527
- // table数据预处理
1528
- this.st.res = {
1529
- process: data => {
1530
- this.onTableCheck(data);
1531
- return data;
1532
- }
1533
- };
1534
- // 加载第一页
1535
- this.st.load(1);
1536
- }
1537
- /**
1538
- * 角色树点击
1539
- *
1540
- * @param e 节点
1541
- */
1542
- onRoleClick(e) {
1543
- // 构造分页请求,直接传入stTable组件,剩下的所有交给组件自己完成
1544
- this.st.data = '/auth/baseUser/queryListForPage';
1545
- this.st.req = {
1546
- allInBody: true,
1547
- method: 'POST',
1548
- type: 'page',
1549
- reName: {
1550
- pi: 'pageNum',
1551
- ps: 'pageSize'
1552
- },
1553
- body: {
1554
- pageParam: {
1555
- roleId: e.keys?.pop()
1556
- }
1557
- }
1558
- };
1559
- // table数据预处理
1560
- this.st.res = {
1561
- process: data => {
1562
- this.onTableCheck(data);
1563
- return data;
1564
- }
1565
- };
1566
- // 加载第一页
1567
- this.st.load(1);
1568
- }
1569
- /**
1570
- * 好友分组点击
1571
- *
1572
- * @param e 分组
1573
- */
1574
- onFriendGroupClick(e) {
1575
- // 构造分页请求,直接传入stTable组件,剩下的所有交给组件自己完成
1576
- this.st.data = '/auth/baseUser/queryListForPage';
1577
- this.st.req = {
1578
- allInBody: true,
1579
- method: 'POST',
1580
- type: 'page',
1581
- reName: {
1582
- pi: 'pageNum',
1583
- ps: 'pageSize'
1584
- },
1585
- body: {
1586
- pageParam: {
1587
- friendGroupId: e.id
1588
- }
1589
- }
1590
- };
1591
- // table数据预处理
1592
- this.st.res = {
1593
- process: data => {
1594
- this.onTableCheck(data);
1595
- return data;
1596
- }
1597
- };
1598
- // 加载第一页
1599
- this.st.load(1);
1600
- }
1601
- /**
1602
- * 点击右侧联系人进行删除
1603
- *
1604
- * @param c 点击的联系人
1605
- */
1606
- onContactRemove(c) {
1607
- this.nzContacts = this.nzContacts.filter(contact => {
1608
- return contact.userId != c.userId;
1609
- });
1610
- this.st.reload();
1611
- }
1612
- /**
1613
- * 预处理table当前页数据,和nzContat对比,确定checkbox状态
1614
- *
1615
- * @param data 预处理数据
1616
- */
1617
- onTableCheck(data) {
1618
- const ids = this.nzContacts.map(u => u.userId);
1619
- data.forEach(d => {
1620
- if (ids.includes(d.userId)) {
1621
- d.checked = true;
1622
- }
1623
- else {
1624
- d.checked = false;
1625
- }
1626
- });
1627
- }
1628
- /**
1629
- * 递归树寻找name相同节点
1630
- *
1631
- * @param name 名称
1632
- * @param trees 需要递归的树
1633
- * @param list 搜索结果
1634
- */
1635
- searchTree(name, trees, list) {
1636
- if (trees && trees.length && trees.length > 0) {
1637
- trees.forEach((tree) => {
1638
- if (tree.title.indexOf(name) != -1) {
1639
- list.push(tree);
1640
- }
1641
- if (tree.children) {
1642
- this.searchTree(name, tree.children, list);
1643
- }
1644
- });
1645
- }
1646
- }
1647
- /**
1648
- * 递归树展开所有有子节点的节点
1649
- *
1650
- * @param trees 需要展开的树
1651
- */
1652
- expandTree(trees) {
1653
- if (trees && trees.length && trees.length > 0) {
1654
- trees.forEach(tree => {
1655
- if (!tree.children || tree.children.length === 0) {
1656
- tree.expanded = false;
1657
- tree.isLeaf = true;
1658
- }
1659
- if (tree.children) {
1660
- tree.expanded = this.nzExpandAll;
1661
- tree.isLeaf = false;
1662
- this.expandTree(tree.children);
1663
- }
1664
- });
1665
- }
1666
- }
1667
- /**
1668
- * 刷新当前页面
1669
- */
1670
- refresh() {
1671
- this.changeDetectorRef.detectChanges();
1672
- }
1673
- /**
1674
- * 确认按钮output数据
1675
- */
1676
- confirm() {
1677
- this.confirmed.next(this.nzContacts);
1678
- }
1679
- /**
1680
- * 销毁函数
1681
- */
1682
- ngOnDestroy() {
1683
- this.nzDepts = [];
1684
- this.nzRoles = [];
1685
- this.nzContacts = [];
1686
- this.subs.forEach(s => s.unsubscribe());
1687
- }
1688
- }
1689
- ContactComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: ContactComponent, deps: [{ token: ContactService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
1690
- ContactComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.5", type: ContactComponent, selector: "contact", inputs: { nzTabsetSearch: "nzTabsetSearch", nzTabsetLoading: "nzTabsetLoading", nzExpandAll: "nzExpandAll", nzDepts: "nzDepts", nzDeptTreeVirtualHeight: "nzDeptTreeVirtualHeight", nzDeptClass: "nzDeptClass", nzDeptClassHistory: "nzDeptClassHistory", nzDeptGrade: "nzDeptGrade", nzDeptGradeID: "nzDeptGradeID", nzRoles: "nzRoles", nzRoleTreeVirtualHeight: "nzRoleTreeVirtualHeight", nzFriendGroups: "nzFriendGroups", defaultContacts: "defaultContacts", nzContacts: "nzContacts", nzContactLoading: "nzContactLoading", button: "button" }, outputs: { confirmed: "confirmed" }, viewQueries: [{ propertyName: "st", first: true, predicate: ["st"], descendants: true }], ngImport: i0, template: "<nz-row [nzGutter]=\"16\">\n <nz-col [nzXs]=\"24\" [nzSm]=\"24\" [nzMd]=\"24\" [nzLg]=\"8\" [nzXl]=\"6\" [nzXXl]=\"6\">\n <nz-tabset nzCentered>\n <nz-tab nzTitle=\"\u90E8\u95E8\" (nzSelect)=\"onTabsetDept()\">\n <div sg-container=\"2\">\n <sg col=\"1\" class=\"nz-tabset-sg\">\n <nz-input-group class=\"nz-tabset-input\" [nzSuffix]=\"searchInputTpl\">\n <input\n nz-input\n [(ngModel)]=\"nzTabsetSearch\"\n (ngModelChange)=\"onTabsetSearchChange('dept', $event)\"\n type=\"text\"\n placeholder=\"\u8BF7\u8F93\u5165\u90E8\u95E8\u540D\u79F0\"\n />\n </nz-input-group>\n </sg>\n <sg col=\"1\">\n <nz-spin [nzSpinning]=\"nzTabsetLoading\">\n <nz-tree\n class=\"nz-tabset-content\"\n (nzClick)=\"onDeptClick($event)\"\n [nzBlockNode]=\"true\"\n [nzShowLine]=\"true\"\n [nzHideUnMatched]=\"true\"\n [nzVirtualHeight]=\"nzDeptTreeVirtualHeight\"\n [nzData]=\"nzDepts\"\n ></nz-tree>\n </nz-spin>\n </sg>\n </div>\n </nz-tab>\n <nz-tab nzTitle=\"\u89D2\u8272\" (nzSelect)=\"onTabsetRole()\">\n <div sg-container=\"2\">\n <sg col=\"1\" class=\"nz-tabset-sg\">\n <nz-input-group class=\"nz-tabset-input\" [nzSuffix]=\"searchInputTpl\">\n <input\n nz-input\n [(ngModel)]=\"nzTabsetSearch\"\n (ngModelChange)=\"onTabsetSearchChange('role', $event)\"\n type=\"text\"\n placeholder=\"\u8BF7\u8F93\u5165\u89D2\u8272\u540D\u79F0\"\n />\n </nz-input-group>\n </sg>\n <sg col=\"1\">\n <nz-spin [nzSpinning]=\"nzTabsetLoading\">\n <nz-tree\n class=\"nz-tabset-content\"\n (nzClick)=\"onRoleClick($event)\"\n [nzBlockNode]=\"true\"\n [nzShowLine]=\"true\"\n [nzHideUnMatched]=\"true\"\n [nzVirtualHeight]=\"nzRoleTreeVirtualHeight\"\n [nzData]=\"nzRoles\"\n ></nz-tree>\n </nz-spin>\n </sg>\n </div>\n </nz-tab>\n <nz-tab nzTitle=\"\u597D\u53CB\" (nzSelect)=\"onTabsetFriendGroup()\">\n <div sg-container=\"2\">\n <sg col=\"1\" class=\"nz-tabset-sg\">\n <nz-input-group class=\"nz-tabset-input\" [nzSuffix]=\"searchInputTpl\">\n <input\n nz-input\n [(ngModel)]=\"nzTabsetSearch\"\n (ngModelChange)=\"onTabsetSearchChange('friendGroup', $event)\"\n type=\"text\"\n placeholder=\"\u8BF7\u8F93\u5165\u597D\u53CB\u540D\u79F0\"\n />\n </nz-input-group>\n </sg>\n <sg col=\"1\">\n <nz-spin [nzSpinning]=\"nzTabsetLoading\">\n <nz-list class=\"nz-tabset-content\" nzItemLayout=\"horizontal\" [nzSplit]=\"false\" nzSize=\"small\">\n <nz-list-item\n class=\"nz-tabset-content-item\"\n *ngFor=\"let group of nzFriendGroups\"\n (click)=\"onFriendGroupClick(group)\"\n >\n <nz-list-item-meta>\n <nz-list-item-meta-title>\n {{ group.name }}\n </nz-list-item-meta-title>\n </nz-list-item-meta>\n </nz-list-item>\n </nz-list>\n </nz-spin>\n </sg>\n </div>\n </nz-tab>\n </nz-tabset>\n </nz-col>\n\n <nz-col [nzXs]=\"24\" [nzSm]=\"24\" [nzMd]=\"24\" [nzLg]=\"16\" [nzXl]=\"13\" [nzXXl]=\"13\">\n <st #st responsiveHideHeaderFooter></st>\n </nz-col>\n\n <nz-col [nzXs]=\"24\" [nzSm]=\"24\" [nzMd]=\"24\" [nzLg]=\"24\" [nzXl]=\"5\" [nzXXl]=\"5\">\n <nz-spin [nzSpinning]=\"nzContactLoading\">\n <nz-list nzItemLayout=\"horizontal\" [nzSplit]=\"false\" nzSize=\"small\">\n <nz-list-item\n class=\"nz-tabset-content-item\"\n *ngFor=\"let contact of nzContacts\"\n (click)=\"onContactRemove(contact)\"\n >\n <nz-list-item-meta>\n <nz-list-item-meta-title>\n {{ contact.realName }}\n </nz-list-item-meta-title>\n </nz-list-item-meta>\n </nz-list-item>\n </nz-list>\n </nz-spin>\n </nz-col>\n</nz-row>\n\n<nz-row *ngIf=\"button\">\n <nz-col [nzSpan]=\"4\" [nzOffset]=\"20\">\n <button nz-button nzType=\"primary\" (click)=\"confirm()\">\u786E\u5B9A</button>\n </nz-col>\n</nz-row>\n\n<ng-template #searchInputTpl>\n <i nz-icon nzType=\"close\" nzTheme=\"outline\" *ngIf=\"nzTabsetSearch\" (click)=\"onTabsetSearchClean()\"></i>\n <i nz-icon nzType=\"search\" nzTheme=\"outline\" *ngIf=\"!nzTabsetSearch\"></i>\n</ng-template>\n", styles: [".nz-tabset-input{width:100%}.nz-tabset-content{padding:20px}.nz-tabset-sg{padding-right:38px!important;padding-left:38px!important}.nz-tabset-content-item:hover{background-color:#f1f1f1;cursor:pointer}\n"], 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: 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: "component", type: i4$3.STComponent, selector: "st", inputs: ["req", "res", "page", "data", "columns", "contextmenu", "ps", "pi", "total", "loading", "loadingDelay", "loadingIndicator", "bordered", "size", "scroll", "singleSort", "multiSort", "rowClassName", "clickRowClassName", "widthMode", "widthConfig", "resizable", "header", "showHeader", "footer", "bodyHeader", "body", "expandRowByClick", "expandAccordion", "expand", "noResult", "responsive", "responsiveHideHeaderFooter", "virtualScroll", "virtualItemSize", "virtualMaxBufferPx", "virtualMinBufferPx", "customRequest", "virtualForTrackBy"], outputs: ["error", "change"], exportAs: ["st"] }, { kind: "component", type: i5$2.SGContainerComponent, selector: "sg-container, [sg-container]", inputs: ["gutter", "sg-container", "col"], exportAs: ["sgContainer"] }, { kind: "component", type: i5$2.SGComponent, selector: "sg", inputs: ["col"], exportAs: ["sg"] }, { kind: "component", type: i6$1.NzTreeComponent, selector: "nz-tree", inputs: ["nzShowIcon", "nzHideUnMatched", "nzBlockNode", "nzExpandAll", "nzSelectMode", "nzCheckStrictly", "nzShowExpand", "nzShowLine", "nzCheckable", "nzAsyncData", "nzDraggable", "nzMultiple", "nzExpandedIcon", "nzVirtualItemSize", "nzVirtualMaxBufferPx", "nzVirtualMinBufferPx", "nzVirtualHeight", "nzTreeTemplate", "nzBeforeDrop", "nzData", "nzExpandedKeys", "nzSelectedKeys", "nzCheckedKeys", "nzSearchValue", "nzSearchFunc"], outputs: ["nzExpandedKeysChange", "nzSelectedKeysChange", "nzCheckedKeysChange", "nzSearchValueChange", "nzClick", "nzDblClick", "nzContextMenu", "nzCheckBoxChange", "nzExpandChange", "nzOnDragStart", "nzOnDragEnter", "nzOnDragOver", "nzOnDragLeave", "nzOnDrop", "nzOnDragEnd"], exportAs: ["nzTree"] }, { kind: "component", type: i7$2.NzButtonComponent, selector: "button[nz-button], a[nz-button]", inputs: ["nzBlock", "nzGhost", "nzSearch", "nzLoading", "nzDanger", "disabled", "tabIndex", "nzType", "nzShape", "nzSize"], exportAs: ["nzButton"] }, { kind: "directive", type: i5$1.ɵ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: i9$2.NzWaveDirective, selector: "[nz-wave],button[nz-button]:not([nzType=\"link\"]):not([nzType=\"text\"])", inputs: ["nzWaveExtraNode"], exportAs: ["nzWave"] }, { kind: "directive", type: i7.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.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: "component", type: i8$2.NzTabSetComponent, selector: "nz-tabset", inputs: ["nzSelectedIndex", "nzTabPosition", "nzTabBarExtraContent", "nzCanDeactivate", "nzAddIcon", "nzTabBarStyle", "nzType", "nzSize", "nzAnimated", "nzTabBarGutter", "nzHideAdd", "nzCentered", "nzHideAll", "nzLinkRouter", "nzLinkExact"], outputs: ["nzSelectChange", "nzSelectedIndexChange", "nzTabListScroll", "nzClose", "nzAdd"], exportAs: ["nzTabset"] }, { kind: "component", type: i8$2.NzTabComponent, selector: "nz-tab", inputs: ["nzTitle", "nzClosable", "nzCloseIcon", "nzDisabled", "nzForceRender"], outputs: ["nzSelect", "nzDeselect", "nzClick", "nzContextmenu"], exportAs: ["nzTab"] }, { kind: "directive", type: i9.NzInputDirective, selector: "input[nz-input],textarea[nz-input]", inputs: ["nzBorderless", "nzSize", "nzStatus", "disabled"], exportAs: ["nzInput"] }, { kind: "component", type: i9.NzInputGroupComponent, selector: "nz-input-group", inputs: ["nzAddOnBeforeIcon", "nzAddOnAfterIcon", "nzPrefixIcon", "nzSuffixIcon", "nzAddOnBefore", "nzAddOnAfter", "nzPrefix", "nzStatus", "nzSuffix", "nzSize", "nzSearch", "nzCompact"], exportAs: ["nzInputGroup"] }, { kind: "directive", type: i9.NzInputGroupWhitSuffixOrPrefixDirective, selector: "nz-input-group[nzSuffix], nz-input-group[nzPrefix]" }, { kind: "component", type: i14.NzListComponent, selector: "nz-list, [nz-list]", inputs: ["nzDataSource", "nzBordered", "nzGrid", "nzHeader", "nzFooter", "nzItemLayout", "nzRenderItem", "nzLoading", "nzLoadMore", "nzPagination", "nzSize", "nzSplit", "nzNoResult"], exportAs: ["nzList"] }, { kind: "component", type: i14.NzListItemComponent, selector: "nz-list-item, [nz-list-item]", inputs: ["nzActions", "nzContent", "nzExtra", "nzNoFlex"], exportAs: ["nzListItem"] }, { kind: "component", type: i14.NzListItemMetaComponent, selector: "nz-list-item-meta, [nz-list-item-meta]", inputs: ["nzAvatar", "nzTitle", "nzDescription"], exportAs: ["nzListItemMeta"] }, { kind: "component", type: i14.NzListItemMetaTitleComponent, selector: "nz-list-item-meta-title", exportAs: ["nzListItemMetaTitle"] }, { kind: "component", type: i15.NzSpinComponent, selector: "nz-spin", inputs: ["nzIndicator", "nzSize", "nzTip", "nzDelay", "nzSimple", "nzSpinning"], exportAs: ["nzSpin"] }] });
1691
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: ContactComponent, decorators: [{
1692
- type: Component,
1693
- args: [{ selector: 'contact', template: "<nz-row [nzGutter]=\"16\">\n <nz-col [nzXs]=\"24\" [nzSm]=\"24\" [nzMd]=\"24\" [nzLg]=\"8\" [nzXl]=\"6\" [nzXXl]=\"6\">\n <nz-tabset nzCentered>\n <nz-tab nzTitle=\"\u90E8\u95E8\" (nzSelect)=\"onTabsetDept()\">\n <div sg-container=\"2\">\n <sg col=\"1\" class=\"nz-tabset-sg\">\n <nz-input-group class=\"nz-tabset-input\" [nzSuffix]=\"searchInputTpl\">\n <input\n nz-input\n [(ngModel)]=\"nzTabsetSearch\"\n (ngModelChange)=\"onTabsetSearchChange('dept', $event)\"\n type=\"text\"\n placeholder=\"\u8BF7\u8F93\u5165\u90E8\u95E8\u540D\u79F0\"\n />\n </nz-input-group>\n </sg>\n <sg col=\"1\">\n <nz-spin [nzSpinning]=\"nzTabsetLoading\">\n <nz-tree\n class=\"nz-tabset-content\"\n (nzClick)=\"onDeptClick($event)\"\n [nzBlockNode]=\"true\"\n [nzShowLine]=\"true\"\n [nzHideUnMatched]=\"true\"\n [nzVirtualHeight]=\"nzDeptTreeVirtualHeight\"\n [nzData]=\"nzDepts\"\n ></nz-tree>\n </nz-spin>\n </sg>\n </div>\n </nz-tab>\n <nz-tab nzTitle=\"\u89D2\u8272\" (nzSelect)=\"onTabsetRole()\">\n <div sg-container=\"2\">\n <sg col=\"1\" class=\"nz-tabset-sg\">\n <nz-input-group class=\"nz-tabset-input\" [nzSuffix]=\"searchInputTpl\">\n <input\n nz-input\n [(ngModel)]=\"nzTabsetSearch\"\n (ngModelChange)=\"onTabsetSearchChange('role', $event)\"\n type=\"text\"\n placeholder=\"\u8BF7\u8F93\u5165\u89D2\u8272\u540D\u79F0\"\n />\n </nz-input-group>\n </sg>\n <sg col=\"1\">\n <nz-spin [nzSpinning]=\"nzTabsetLoading\">\n <nz-tree\n class=\"nz-tabset-content\"\n (nzClick)=\"onRoleClick($event)\"\n [nzBlockNode]=\"true\"\n [nzShowLine]=\"true\"\n [nzHideUnMatched]=\"true\"\n [nzVirtualHeight]=\"nzRoleTreeVirtualHeight\"\n [nzData]=\"nzRoles\"\n ></nz-tree>\n </nz-spin>\n </sg>\n </div>\n </nz-tab>\n <nz-tab nzTitle=\"\u597D\u53CB\" (nzSelect)=\"onTabsetFriendGroup()\">\n <div sg-container=\"2\">\n <sg col=\"1\" class=\"nz-tabset-sg\">\n <nz-input-group class=\"nz-tabset-input\" [nzSuffix]=\"searchInputTpl\">\n <input\n nz-input\n [(ngModel)]=\"nzTabsetSearch\"\n (ngModelChange)=\"onTabsetSearchChange('friendGroup', $event)\"\n type=\"text\"\n placeholder=\"\u8BF7\u8F93\u5165\u597D\u53CB\u540D\u79F0\"\n />\n </nz-input-group>\n </sg>\n <sg col=\"1\">\n <nz-spin [nzSpinning]=\"nzTabsetLoading\">\n <nz-list class=\"nz-tabset-content\" nzItemLayout=\"horizontal\" [nzSplit]=\"false\" nzSize=\"small\">\n <nz-list-item\n class=\"nz-tabset-content-item\"\n *ngFor=\"let group of nzFriendGroups\"\n (click)=\"onFriendGroupClick(group)\"\n >\n <nz-list-item-meta>\n <nz-list-item-meta-title>\n {{ group.name }}\n </nz-list-item-meta-title>\n </nz-list-item-meta>\n </nz-list-item>\n </nz-list>\n </nz-spin>\n </sg>\n </div>\n </nz-tab>\n </nz-tabset>\n </nz-col>\n\n <nz-col [nzXs]=\"24\" [nzSm]=\"24\" [nzMd]=\"24\" [nzLg]=\"16\" [nzXl]=\"13\" [nzXXl]=\"13\">\n <st #st responsiveHideHeaderFooter></st>\n </nz-col>\n\n <nz-col [nzXs]=\"24\" [nzSm]=\"24\" [nzMd]=\"24\" [nzLg]=\"24\" [nzXl]=\"5\" [nzXXl]=\"5\">\n <nz-spin [nzSpinning]=\"nzContactLoading\">\n <nz-list nzItemLayout=\"horizontal\" [nzSplit]=\"false\" nzSize=\"small\">\n <nz-list-item\n class=\"nz-tabset-content-item\"\n *ngFor=\"let contact of nzContacts\"\n (click)=\"onContactRemove(contact)\"\n >\n <nz-list-item-meta>\n <nz-list-item-meta-title>\n {{ contact.realName }}\n </nz-list-item-meta-title>\n </nz-list-item-meta>\n </nz-list-item>\n </nz-list>\n </nz-spin>\n </nz-col>\n</nz-row>\n\n<nz-row *ngIf=\"button\">\n <nz-col [nzSpan]=\"4\" [nzOffset]=\"20\">\n <button nz-button nzType=\"primary\" (click)=\"confirm()\">\u786E\u5B9A</button>\n </nz-col>\n</nz-row>\n\n<ng-template #searchInputTpl>\n <i nz-icon nzType=\"close\" nzTheme=\"outline\" *ngIf=\"nzTabsetSearch\" (click)=\"onTabsetSearchClean()\"></i>\n <i nz-icon nzType=\"search\" nzTheme=\"outline\" *ngIf=\"!nzTabsetSearch\"></i>\n</ng-template>\n", styles: [".nz-tabset-input{width:100%}.nz-tabset-content{padding:20px}.nz-tabset-sg{padding-right:38px!important;padding-left:38px!important}.nz-tabset-content-item:hover{background-color:#f1f1f1;cursor:pointer}\n"] }]
1694
- }], ctorParameters: function () { return [{ type: ContactService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { nzTabsetSearch: [{
1695
- type: Optional
1696
- }, {
1697
- type: Input
1698
- }], nzTabsetLoading: [{
1699
- type: Optional
1700
- }, {
1701
- type: Input
1702
- }], nzExpandAll: [{
1703
- type: Optional
1704
- }, {
1705
- type: Input
1706
- }], nzDepts: [{
1707
- type: Optional
1708
- }, {
1709
- type: Input
1710
- }], nzDeptTreeVirtualHeight: [{
1711
- type: Optional
1712
- }, {
1713
- type: Input
1714
- }], nzDeptClass: [{
1715
- type: Optional
1716
- }, {
1717
- type: Input
1718
- }], nzDeptClassHistory: [{
1719
- type: Optional
1720
- }, {
1721
- type: Input
1722
- }], nzDeptGrade: [{
1723
- type: Optional
1724
- }, {
1725
- type: Input
1726
- }], nzDeptGradeID: [{
1727
- type: Optional
1728
- }, {
1729
- type: Input
1730
- }], nzRoles: [{
1731
- type: Optional
1732
- }, {
1733
- type: Input
1734
- }], nzRoleTreeVirtualHeight: [{
1735
- type: Optional
1736
- }, {
1737
- type: Input
1738
- }], nzFriendGroups: [{
1739
- type: Optional
1740
- }, {
1741
- type: Input
1742
- }], st: [{
1743
- type: ViewChild,
1744
- args: ['st', { static: false }]
1745
- }], defaultContacts: [{
1746
- type: Optional
1747
- }, {
1748
- type: Input
1749
- }], nzContacts: [{
1750
- type: Optional
1751
- }, {
1752
- type: Input
1753
- }], nzContactLoading: [{
1754
- type: Optional
1755
- }, {
1756
- type: Input
1757
- }], button: [{
1758
- type: Optional
1759
- }, {
1760
- type: Input
1761
- }], confirmed: [{
1762
- type: Output
1763
- }] } });
1764
-
1765
- const STOMP_DEFAULT_CONFIG = {
1766
- connectHeaders: {
1767
- login: 'guest',
1768
- passcode: 'guest'
1769
- },
1770
- brokerURL: '/websocket/ws/',
1771
- heartbeatIncoming: 1000 * 60,
1772
- heartbeatOutgoing: 1000 * 60,
1773
- reconnectDelay: 30000000,
1774
- debug: msg => {
1775
- log$1(msg);
1776
- }
1777
- };
1778
- function mergeStompConfig(srv) {
1779
- return srv.merge('stomp', STOMP_DEFAULT_CONFIG);
1780
- }
1781
-
1782
- class YzStompService {
1783
- constructor(csr, cache, injector, notification) {
1784
- this.csr = csr;
1785
- this.cache = cache;
1786
- this.injector = injector;
1787
- this.notification = notification;
1788
- this.config = null;
1789
- this.bisConfig = null;
1790
- this.rxStomp = null;
1791
- this.subs = [];
1792
- if (!this.user) {
1793
- this.user = this.cache.get('_yz_user', { mode: 'none' });
1794
- }
1795
- if (!this.config) {
1796
- this.config = mergeStompConfig(this.csr);
1797
- }
1798
- if (!this.bisConfig) {
1799
- this.bisConfig = mergeBisConfig(csr);
1800
- }
1801
- if (!this.rxStomp) {
1802
- this.rxStomp = new RxStomp();
1803
- if (isDevMode()) {
1804
- log$1('yz.stomp.service: is dev mode');
1805
- log$1('yz.stomp.service: ', `config is ${JSON.stringify(this.config)}`);
1806
- this.rxStomp.configure(this.config);
1807
- return;
1808
- }
1809
- const { location } = this.injector.get(DOCUMENT);
1810
- const { protocol, host } = location;
1811
- log$1('yz.stomp.service: ', `protocol is ${protocol},host is ${host}`);
1812
- if (protocol.includes('http') && !protocol.includes('https')) {
1813
- this.config.brokerURL = `ws://${host}${this.config.brokerURL}`;
1814
- }
1815
- if (protocol.includes('https')) {
1816
- this.config.brokerURL = `wss://${host}${this.config.brokerURL}`;
1817
- }
1818
- log$1('yz.stomp.service: ', `config is ${this.config}`);
1819
- this.rxStomp.configure(this.config);
1820
- }
1821
- }
1822
- listen() {
1823
- this.subs.push(this.rxStomp.watch(`/topic/layout_${this.user.username}`).subscribe(message => {
1824
- this.createNotification(JSON.parse(message.body));
1825
- }));
1826
- this.subs.push(this.rxStomp.watch(`/topic/layout_xx_${this.user.username}`).subscribe((message) => {
1827
- this.logoutNotification(JSON.parse(message.body));
1828
- }));
1829
- this.rxStomp.activate();
1830
- }
1831
- createNotification(message) {
1832
- this.notification.create(message.type, message.title, `<a href=${message.href}>${message.content}</a>`);
1833
- }
1834
- logoutNotification(message) {
1835
- this.notification.create(message.type, message.title, `${message.content},剩余时间5秒`);
1836
- setTimeout(() => {
1837
- this.cache.clear();
1838
- localStorage.clear();
1839
- this.injector.get(WINDOW).location.href = `${this.bisConfig.baseUrl}/cas-proxy/app/logout`;
1840
- }, 5000);
1841
- }
1842
- unListen() {
1843
- this.subs.forEach(s => s.unsubscribe());
1844
- this.rxStomp.deactivate().then();
1845
- }
1846
- publish(parameters) {
1847
- this.rxStomp.publish(parameters);
1848
- }
1849
- watch(destination, headers) {
1850
- return this.rxStomp.watch(destination, headers);
1851
- }
1852
- }
1853
- YzStompService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzStompService, deps: [{ token: i1$3.YunzaiConfigService }, { token: i1$1.CacheService }, { token: i0.Injector }, { token: i3$2.NzNotificationService }], target: i0.ɵɵFactoryTarget.Injectable });
1854
- YzStompService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzStompService, providedIn: 'root' });
1855
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzStompService, decorators: [{
1856
- type: Injectable,
1857
- args: [{ providedIn: 'root' }]
1858
- }], ctorParameters: function () { return [{ type: i1$3.YunzaiConfigService }, { type: i1$1.CacheService }, { type: i0.Injector }, { type: i3$2.NzNotificationService }]; } });
1859
-
1860
- class YzLayoutBasicComponent {
1861
- constructor(cacheService, yzStompService, layoutService, injector) {
1862
- this.cacheService = cacheService;
1863
- this.yzStompService = yzStompService;
1864
- this.layoutService = layoutService;
1865
- this.injector = injector;
1866
- this.options = {
1867
- logoExpanded: `./assets/logo-full.svg`,
1868
- logoCollapsed: `./assets/logo.svg`
1869
- };
1870
- this.intro = '';
1871
- this.text = '';
1872
- this.icon = '';
1873
- this.showReuseTab = true;
1874
- this.showHeader = true;
1875
- this.showSider = true;
1876
- this.headerType = 'application';
1877
- }
1878
- get reuseStyleSheet() {
1879
- let cascadingStyleSheet = {};
1880
- if (!this.showHeader) {
1881
- cascadingStyleSheet = {
1882
- ...cascadingStyleSheet,
1883
- top: 0
1884
- };
1885
- }
1886
- if (!this.showSider) {
1887
- cascadingStyleSheet = {
1888
- ...cascadingStyleSheet,
1889
- left: '24px'
1890
- };
1891
- }
1892
- return cascadingStyleSheet;
1893
- }
1894
- ngOnInit() {
1895
- const current = this.cacheService.get('_yz_current', { mode: 'none' });
1896
- const project = this.cacheService.get('_yz_project_info', { mode: 'none' });
1897
- const headerType = this.cacheService.get('_yz_header_type', { mode: 'none' });
1898
- if (headerType)
1899
- this.headerType = headerType;
1900
- this.text = current.text ? current.text : '应用名称';
1901
- this.intro = current.intro ? current.intro : '应用描述';
1902
- this.icon = current.icon ? current.icon : `./assets/tmp/img/avatar.jpg`;
1903
- this.options.logoExpanded = project.maxLogoUrl ? project.maxLogoUrl : `./assets/logo-full.svg`;
1904
- this.options.logoCollapsed = project.miniLogoUrl ? project.miniLogoUrl : `./assets/logo.svg`;
1905
- this.yzStompService.listen();
1906
- this.layoutService.reuseTab.asObservable().subscribe(show => (this.showReuseTab = show));
1907
- this.layoutService.header.asObservable().subscribe(show => (this.showHeader = show));
1908
- this.layoutService.sidebar.asObservable().subscribe(show => (this.showSider = show));
1909
- }
1910
- onHeaderTypeChange(type) {
1911
- this.cacheService.set('_yz_header_type', type);
1912
- this.injector.get(WINDOW).location.reload();
1913
- }
1914
- ngOnDestroy() {
1915
- this.yzStompService.unListen();
1916
- }
1917
- }
1918
- YzLayoutBasicComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzLayoutBasicComponent, deps: [{ token: i1$1.CacheService }, { token: YzStompService }, { token: i3$3.LayoutService }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
1919
- YzLayoutBasicComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.5", type: YzLayoutBasicComponent, selector: "yz-layout-basic", ngImport: i0, template: `
1920
- <layout-default [options]="options" [asideUser]="asideUserTpl" [content]="showReuseTab ? contentTpl : noneTpl">
1921
- <layout-default-header-item direction="left">
1922
- <ng-container [ngSwitch]="headerType">
1923
- <ng-container *ngSwitchCase="'application'">
1924
- <yz-header-application></yz-header-application>
1925
- </ng-container>
1926
-
1927
- <ng-container *ngSwitchCase="'group'">
1928
- <yz-header-application-group></yz-header-application-group>
1929
- </ng-container>
1930
-
1931
- <ng-container *ngSwitchDefault>
1932
- <yz-header-application></yz-header-application>
1933
- </ng-container>
1934
- </ng-container>
1935
- </layout-default-header-item>
1936
-
1937
- <layout-default-header-item direction="right" hidden="mobile">
1938
- <yz-header-notify></yz-header-notify>
1939
- </layout-default-header-item>
1940
-
1941
- <layout-default-header-item direction="right" hidden="mobile">
1942
- <yz-header-theme-btn></yz-header-theme-btn>
1943
- </layout-default-header-item>
1944
-
1945
- <layout-default-header-item direction="right" hidden="mobile">
1946
- <div
1947
- layout-default-header-item-trigger
1948
- nz-dropdown
1949
- [nzDropdownMenu]="settingsMenu"
1950
- nzTrigger="click"
1951
- nzPlacement="bottomRight"
1952
- >
1953
- <i nz-icon nzType="setting"></i>
1954
- </div>
1955
- <nz-dropdown-menu #settingsMenu="nzDropdownMenu">
1956
- <div nz-menu style="width: 200px;">
1957
- <div nz-menu-item>
1958
- {{ 'menu.application.mode' | i18n }}
1959
- </div>
1960
-
1961
- <div nz-menu-item (click)="onHeaderTypeChange('application')">
1962
- <i nz-icon nzType="appstore" class="mr-sm"></i>
1963
- {{ 'menu.application.application' | i18n }}
1964
- </div>
1965
-
1966
- <div nz-menu-item (click)="onHeaderTypeChange('group')">
1967
- <i nz-icon nzType="group" class="mr-sm"></i>
1968
- {{ 'menu.application.group' | i18n }}
1969
- </div>
1970
-
1971
- <div nz-menu-item>
1972
- <yz-header-fullscreen></yz-header-fullscreen>
1973
- </div>
1974
- <div nz-menu-item>
1975
- <yz-header-clear-storage></yz-header-clear-storage>
1976
- </div>
1977
- <div nz-menu-item>
1978
- <yz-header-i18n></yz-header-i18n>
1979
- </div>
1980
- </div>
1981
- </nz-dropdown-menu>
1982
- </layout-default-header-item>
1983
- <layout-default-header-item direction="right">
1984
- <yz-header-user></yz-header-user>
1985
- </layout-default-header-item>
1986
- <ng-template #asideUserTpl>
1987
- <div nz-dropdown nzTrigger="click" [nzDropdownMenu]="userMenu" class="yunzai-default__aside-user">
1988
- <nz-avatar class="yunzai-default__aside-user-avatar" [nzSrc]="icon"></nz-avatar>
1989
- <div class="yunzai-default__aside-user-info">
1990
- <strong>{{ text }}</strong>
1991
- <p class="mb0">{{ intro }}</p>
1992
- </div>
1993
- </div>
1994
- <nz-dropdown-menu #userMenu="nzDropdownMenu">
1995
- <ul nz-menu>
1996
- <li nz-menu-item routerLink="/">{{ 'menu.backtohome' | i18n }}</li>
1997
- </ul>
1998
- </nz-dropdown-menu>
1999
- </ng-template>
2000
- <ng-template #contentTpl>
2001
- <reuse-tab #reuseTab [ngStyle]="reuseStyleSheet"></reuse-tab>
2002
- <router-outlet (activate)="reuseTab.activate($event)" (attach)="reuseTab.activate($event)"></router-outlet>
2003
- </ng-template>
2004
- <ng-template #noneTpl>
2005
- <router-outlet></router-outlet>
2006
- </ng-template>
2007
- </layout-default>
2008
- `, isInline: true, dependencies: [{ kind: "directive", type: i4$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i4$1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i4$1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i4$1.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { kind: "directive", type: i5$3.RouterOutlet, selector: "router-outlet", outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }, { kind: "directive", type: i5$3.RouterLink, selector: ":not(a):not(area)[routerLink]", inputs: ["queryParams", "fragment", "queryParamsHandling", "state", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: i6$2.ReuseTabComponent, selector: "reuse-tab, [reuse-tab]", inputs: ["mode", "i18n", "debug", "max", "tabMaxWidth", "excludes", "allowClose", "keepingScroll", "storageState", "keepingScrollContainer", "customContextMenu", "tabBarExtraContent", "tabBarGutter", "tabBarStyle", "tabType", "routeParamMatchMode", "disabled", "titleRender", "canClose"], outputs: ["change", "close"], exportAs: ["reuseTab"] }, { kind: "component", type: i3$3.LayoutDefaultComponent, selector: "layout-default", inputs: ["options", "asideUser", "nav", "content", "customError"], exportAs: ["layoutDefault"] }, { kind: "component", type: i3$3.LayoutDefaultHeaderItemComponent, selector: "layout-default-header-item", inputs: ["hidden", "direction"] }, { kind: "directive", type: i3$3.LayoutDefaultHeaderItemTriggerDirective, selector: "[layout-default-header-item-trigger]" }, { kind: "directive", type: i5$1.ɵ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: i6.NzMenuDirective, selector: "[nz-menu]", inputs: ["nzInlineIndent", "nzTheme", "nzMode", "nzInlineCollapsed", "nzSelectable"], outputs: ["nzClick"], exportAs: ["nzMenu"] }, { kind: "directive", type: i6.NzMenuItemDirective, selector: "[nz-menu-item]", inputs: ["nzPaddingLeft", "nzDisabled", "nzSelected", "nzDanger", "nzMatchRouterExact", "nzMatchRouter"], exportAs: ["nzMenuItem"] }, { kind: "directive", type: i7$1.NzDropDownDirective, selector: "[nz-dropdown]", inputs: ["nzDropdownMenu", "nzTrigger", "nzMatchWidthElement", "nzBackdrop", "nzClickHide", "nzDisabled", "nzVisible", "nzOverlayClassName", "nzOverlayStyle", "nzPlacement"], outputs: ["nzVisibleChange"], exportAs: ["nzDropdown"] }, { kind: "component", type: i7$1.NzDropdownMenuComponent, selector: "nz-dropdown-menu", exportAs: ["nzDropdownMenu"] }, { kind: "directive", type: i8.NzIconDirective, selector: "[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { kind: "component", type: i9$1.NzAvatarComponent, selector: "nz-avatar", inputs: ["nzShape", "nzSize", "nzGap", "nzText", "nzSrc", "nzSrcSet", "nzAlt", "nzIcon"], outputs: ["nzError"], exportAs: ["nzAvatar"] }, { kind: "component", type: YzHeaderApplicationComponent, selector: "yz-header-application" }, { kind: "component", type: YzHeaderNotifyComponent, selector: "yz-header-notify" }, { kind: "component", type: YzHeaderThemBtnComponent, selector: "yz-header-theme-btn", inputs: ["types", "devTips", "deployUrl"] }, { kind: "component", type: YzHeaderUserComponent, selector: "yz-header-user" }, { kind: "component", type: YzHeaderFullScreenComponent, selector: "yz-header-fullscreen" }, { kind: "component", type: YzHeaderClearStorageComponent, selector: "yz-header-clear-storage" }, { kind: "component", type: YzHeaderI18NComponent, selector: "yz-header-i18n", inputs: ["showLangText"] }, { kind: "component", type: YzHeaderApplicationGroupComponent, selector: "yz-header-application-group" }, { kind: "pipe", type: i1.I18nPipe, name: "i18n" }] });
2009
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzLayoutBasicComponent, decorators: [{
2010
- type: Component,
2011
- args: [{
2012
- selector: 'yz-layout-basic',
2013
- template: `
2014
- <layout-default [options]="options" [asideUser]="asideUserTpl" [content]="showReuseTab ? contentTpl : noneTpl">
2015
- <layout-default-header-item direction="left">
2016
- <ng-container [ngSwitch]="headerType">
2017
- <ng-container *ngSwitchCase="'application'">
2018
- <yz-header-application></yz-header-application>
2019
- </ng-container>
2020
-
2021
- <ng-container *ngSwitchCase="'group'">
2022
- <yz-header-application-group></yz-header-application-group>
2023
- </ng-container>
2024
-
2025
- <ng-container *ngSwitchDefault>
2026
- <yz-header-application></yz-header-application>
2027
- </ng-container>
2028
- </ng-container>
2029
- </layout-default-header-item>
2030
-
2031
- <layout-default-header-item direction="right" hidden="mobile">
2032
- <yz-header-notify></yz-header-notify>
2033
- </layout-default-header-item>
2034
-
2035
- <layout-default-header-item direction="right" hidden="mobile">
2036
- <yz-header-theme-btn></yz-header-theme-btn>
2037
- </layout-default-header-item>
2038
-
2039
- <layout-default-header-item direction="right" hidden="mobile">
2040
- <div
2041
- layout-default-header-item-trigger
2042
- nz-dropdown
2043
- [nzDropdownMenu]="settingsMenu"
2044
- nzTrigger="click"
2045
- nzPlacement="bottomRight"
2046
- >
2047
- <i nz-icon nzType="setting"></i>
2048
- </div>
2049
- <nz-dropdown-menu #settingsMenu="nzDropdownMenu">
2050
- <div nz-menu style="width: 200px;">
2051
- <div nz-menu-item>
2052
- {{ 'menu.application.mode' | i18n }}
2053
- </div>
2054
-
2055
- <div nz-menu-item (click)="onHeaderTypeChange('application')">
2056
- <i nz-icon nzType="appstore" class="mr-sm"></i>
2057
- {{ 'menu.application.application' | i18n }}
2058
- </div>
2059
-
2060
- <div nz-menu-item (click)="onHeaderTypeChange('group')">
2061
- <i nz-icon nzType="group" class="mr-sm"></i>
2062
- {{ 'menu.application.group' | i18n }}
2063
- </div>
2064
-
2065
- <div nz-menu-item>
2066
- <yz-header-fullscreen></yz-header-fullscreen>
2067
- </div>
2068
- <div nz-menu-item>
2069
- <yz-header-clear-storage></yz-header-clear-storage>
2070
- </div>
2071
- <div nz-menu-item>
2072
- <yz-header-i18n></yz-header-i18n>
2073
- </div>
2074
- </div>
2075
- </nz-dropdown-menu>
2076
- </layout-default-header-item>
2077
- <layout-default-header-item direction="right">
2078
- <yz-header-user></yz-header-user>
2079
- </layout-default-header-item>
2080
- <ng-template #asideUserTpl>
2081
- <div nz-dropdown nzTrigger="click" [nzDropdownMenu]="userMenu" class="yunzai-default__aside-user">
2082
- <nz-avatar class="yunzai-default__aside-user-avatar" [nzSrc]="icon"></nz-avatar>
2083
- <div class="yunzai-default__aside-user-info">
2084
- <strong>{{ text }}</strong>
2085
- <p class="mb0">{{ intro }}</p>
2086
- </div>
2087
- </div>
2088
- <nz-dropdown-menu #userMenu="nzDropdownMenu">
2089
- <ul nz-menu>
2090
- <li nz-menu-item routerLink="/">{{ 'menu.backtohome' | i18n }}</li>
2091
- </ul>
2092
- </nz-dropdown-menu>
2093
- </ng-template>
2094
- <ng-template #contentTpl>
2095
- <reuse-tab #reuseTab [ngStyle]="reuseStyleSheet"></reuse-tab>
2096
- <router-outlet (activate)="reuseTab.activate($event)" (attach)="reuseTab.activate($event)"></router-outlet>
2097
- </ng-template>
2098
- <ng-template #noneTpl>
2099
- <router-outlet></router-outlet>
2100
- </ng-template>
2101
- </layout-default>
2102
- `
2103
- }]
2104
- }], ctorParameters: function () { return [{ type: i1$1.CacheService }, { type: YzStompService }, { type: i3$3.LayoutService }, { type: i0.Injector }]; } });
2105
-
2106
- /*
2107
- * @Author: cui <devcui@outlook.com>
2108
- * @Editor: microsoft vscode
2109
- * @Date: 2021-11-27 11:30:50
2110
- * @LastEditTime: 2021-11-27 14:38:46
2111
- * @LastEditors: cui <devcui@outlook.com>
2112
- * @Description: empty description
2113
- * @FilePath: \yelon\packages\bis\layout\layout.module.ts
2114
- * LICENSE HERE
2115
- */
2116
- const COMPONENTS = [
2117
- ContactComponent,
2118
- YzLayoutBasicComponent,
2119
- YzHeaderApplicationComponent,
2120
- YzHeaderNotifyComponent,
2121
- YzHeaderThemBtnComponent,
2122
- YzHeaderUserComponent,
2123
- YzHeaderFullScreenComponent,
2124
- YzHeaderClearStorageComponent,
2125
- YzHeaderI18NComponent,
2126
- YzHeaderApplicationGroupComponent
2127
- ];
2128
- class YunzaiLayoutModule {
2129
- }
2130
- YunzaiLayoutModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YunzaiLayoutModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2131
- YunzaiLayoutModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.5", ngImport: i0, type: YunzaiLayoutModule, declarations: [ContactComponent,
2132
- YzLayoutBasicComponent,
2133
- YzHeaderApplicationComponent,
2134
- YzHeaderNotifyComponent,
2135
- YzHeaderThemBtnComponent,
2136
- YzHeaderUserComponent,
2137
- YzHeaderFullScreenComponent,
2138
- YzHeaderClearStorageComponent,
2139
- YzHeaderI18NComponent,
2140
- YzHeaderApplicationGroupComponent], imports: [HttpClientModule, CommonModule, FormsModule, RouterModule, ReactiveFormsModule, YzSharedModule], exports: [ContactComponent,
2141
- YzLayoutBasicComponent,
2142
- YzHeaderApplicationComponent,
2143
- YzHeaderNotifyComponent,
2144
- YzHeaderThemBtnComponent,
2145
- YzHeaderUserComponent,
2146
- YzHeaderFullScreenComponent,
2147
- YzHeaderClearStorageComponent,
2148
- YzHeaderI18NComponent,
2149
- YzHeaderApplicationGroupComponent] });
2150
- YunzaiLayoutModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YunzaiLayoutModule, providers: [
2151
- {
2152
- provide: YUNZAI_THEME_BTN_KEYS,
2153
- useValue: 'site-theme'
2154
- }
2155
- ], imports: [HttpClientModule, CommonModule, FormsModule, RouterModule, ReactiveFormsModule, YzSharedModule] });
2156
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YunzaiLayoutModule, decorators: [{
2157
- type: NgModule,
2158
- args: [{
2159
- imports: [HttpClientModule, CommonModule, FormsModule, RouterModule, ReactiveFormsModule, YzSharedModule],
2160
- providers: [
2161
- {
2162
- provide: YUNZAI_THEME_BTN_KEYS,
2163
- useValue: 'site-theme'
2164
- }
2165
- ],
2166
- declarations: [...COMPONENTS],
2167
- exports: [...COMPONENTS]
2168
- }]
2169
- }] });
2170
-
2171
- class YzAuthService {
2172
- constructor(injector) {
2173
- this.injector = injector;
2174
- this.option = mergeConfig(this.csr);
2175
- this.bis = mergeBisConfig(this.csr);
2176
- }
2177
- get csr() {
2178
- return this.injector.get(YunzaiConfigService);
2179
- }
2180
- get tokenService() {
2181
- return this.injector.get(YA_SERVICE_TOKEN);
2182
- }
2183
- get httpClient() {
2184
- return this.injector.get(_HttpClient);
2185
- }
2186
- get cacheService() {
2187
- return this.injector.get(CacheService);
2188
- }
2189
- askToken() {
2190
- log('yz.auth.service: ', 'askToken');
2191
- if (this.tokenService.get()?.token) {
2192
- return of(this.tokenService.get());
2193
- }
2194
- else {
2195
- if (this.bis.loginForm) {
2196
- return this.fetchTokenByUP();
2197
- }
2198
- else {
2199
- return this.fetchTokenByCas();
2200
- }
2201
- }
2202
- }
2203
- fetchTokenByUP() {
2204
- log('yz.auth.service: ', 'fetchTokenByUP');
2205
- return this.httpClient.post(`/auth/oauth/token?_allow_anonymous=true`, this.bis.loginForm).pipe(map((response) => {
2206
- const { access_token, expires_in, refresh_token, scope, token_type } = response;
2207
- return {
2208
- token: access_token,
2209
- expired: expires_in,
2210
- refreshToken: refresh_token,
2211
- tokenType: token_type,
2212
- scope
2213
- };
2214
- }));
2215
- }
2216
- fetchTokenByCas() {
2217
- log('yz.auth.service: ', 'fetchTokenByCas');
2218
- const uri = encodeURIComponent(this.injector.get(WINDOW).location.href);
2219
- return this.httpClient
2220
- .get(`/cas-proxy/app/validate_full?callback=${uri}&_allow_anonymous=true&timestamp=${new Date().getTime()}`)
2221
- .pipe(map((response) => {
2222
- switch (response.errcode) {
2223
- case 2000:
2224
- const { access_token, expires_in, refresh_token, scope, token_type } = response.data;
2225
- return {
2226
- token: access_token,
2227
- expired: expires_in,
2228
- refreshToken: refresh_token,
2229
- tokenType: token_type,
2230
- scope
2231
- };
2232
- case 2001:
2233
- this.injector.get(WINDOW).location.href = response.msg;
2234
- throw Error("Cookie Error: Can't find Cas Cookie,So jump to login!");
2235
- default:
2236
- if (response.data) {
2237
- console.error(response.data);
2238
- throw Error(response.data);
2239
- }
2240
- else if (response.msg) {
2241
- console.error(response.msg);
2242
- throw Error(response.msg);
2243
- }
2244
- else {
2245
- console.error('cas unknown error');
2246
- throw Error('Unknown Error: Cas auth exception!');
2247
- }
2248
- }
2249
- }));
2250
- }
2251
- login() {
2252
- log('yz.auth.service: ', 'login white login form->', this.bis.loginForm);
2253
- return this.askToken().pipe(mergeMap(token => {
2254
- log('yz.auth.service: get token->', token);
2255
- this.csr.set('auth', {
2256
- token_send_key: 'Authorization',
2257
- token_send_template: `${token.tokenType} \${token}`,
2258
- token_send_place: 'header'
2259
- });
2260
- log('yz.auth.service: ', 'set token');
2261
- this.tokenService.set(token);
2262
- return this.cacheInit();
2263
- }), mergeAll());
2264
- }
2265
- cacheInit() {
2266
- log('yz.auth.service: ', 'cacheInit');
2267
- const user = this.cacheService.get('_yz_user', { mode: 'none' });
2268
- const header = this.cacheService.get('_yz_header', { mode: 'none' });
2269
- const project = this.cacheService.get('_yz_project_info', { mode: 'none' });
2270
- return forkJoin(of(user), of(header), of(project)).pipe(mergeMap(([u, h, p]) => {
2271
- let list = [];
2272
- // user cache
2273
- if (!u) {
2274
- log('yz.auth.service: ', 'fetch user cache');
2275
- list.push(this.httpClient.get(`/auth/user`).pipe(map((user) => {
2276
- this.cacheService.set('_yz_user', user.principal);
2277
- })));
2278
- }
2279
- else {
2280
- log('yz.auth.service: ', 'user recache');
2281
- list.push(of(() => { }));
2282
- }
2283
- // header cache
2284
- if (!h) {
2285
- log('yz.auth.service: ', 'fetch header cache');
2286
- list.push(this.httpClient.get(`/auth/allheader/v2`).pipe(map((header) => {
2287
- this.cacheService.set('_yz_header', header.data);
2288
- })));
2289
- }
2290
- else {
2291
- log('yz.auth.service: ', 'header recache');
2292
- list.push(of(() => { }));
2293
- }
2294
- // project cache
2295
- if (!p) {
2296
- log('yz.auth.service: ', 'fetch project cache');
2297
- list.push(this.httpClient.get(`/app-manager/project/info`).pipe(map((info) => {
2298
- this.cacheService.set('_yz_project_info', info.data);
2299
- })));
2300
- }
2301
- else {
2302
- log('yz.auth.service: ', 'project recache');
2303
- list.push(of(() => { }));
2304
- }
2305
- return forkJoin(list);
2306
- }));
2307
- }
2308
- }
2309
- YzAuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzAuthService, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
2310
- YzAuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzAuthService, providedIn: 'root' });
2311
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzAuthService, decorators: [{
2312
- type: Injectable,
2313
- args: [{ providedIn: 'root' }]
2314
- }], ctorParameters: function () { return [{ type: i0.Injector }]; } });
2315
-
2316
- const CODEMESSAGE = {
2317
- 200: '服务器成功返回请求的数据。',
2318
- 201: '新建或修改数据成功。',
2319
- 202: '一个请求已经进入后台排队(异步任务)。',
2320
- 204: '删除数据成功。',
2321
- 400: '发出的请求有错误,服务器没有进行新建或修改数据的操作。',
2322
- 401: '用户没有权限(令牌、用户名、密码错误)。',
2323
- 403: '用户得到授权,但是访问是被禁止的。',
2324
- 404: '发出的请求针对的是不存在的记录,服务器没有进行操作。',
2325
- 406: '请求的格式不可得。',
2326
- 410: '请求的资源被永久删除,且不会再得到的。',
2327
- 422: '当创建一个对象时,发生一个验证错误。',
2328
- 500: '服务器发生错误,请检查服务器。',
2329
- 502: '网关错误。',
2330
- 503: '服务不可用,服务器暂时过载或维护。',
2331
- 504: '网关超时。'
2332
- };
2333
- /**
2334
- * 默认HTTP拦截器,其注册细节见 `app.module.ts`
2335
- */
2336
- class YzDefaultInterceptor {
2337
- constructor(injector) {
2338
- this.injector = injector;
2339
- this.jump = false;
2340
- this.refreshToking = false;
2341
- this.refreshToken$ = new BehaviorSubject(null);
2342
- if (this.config.refreshTokenType === 'auth-refresh') {
2343
- console.error("can't use auth-refresh, please change yz.default.interceptor to default.interceptor!");
2344
- }
2345
- }
2346
- get notification() {
2347
- return this.injector.get(NzNotificationService);
2348
- }
2349
- get tokenSrv() {
2350
- return this.injector.get(YA_SERVICE_TOKEN);
2351
- }
2352
- get http() {
2353
- return this.injector.get(_HttpClient);
2354
- }
2355
- get config() {
2356
- return mergeBisConfig(this.injector.get(YunzaiConfigService));
2357
- }
2358
- goTo(url) {
2359
- setTimeout(() => this.injector.get(Router).navigateByUrl(url));
2360
- }
2361
- checkStatus(ev) {
2362
- if ((ev.status >= 200 && ev.status < 300) || ev.status === 401) {
2363
- return;
2364
- }
2365
- if (ev instanceof HttpErrorResponse && (ev.error.message || ev.error.errorMessage)) {
2366
- if (ev.error.errorMessage) {
2367
- this.notification.error(`发生了一些错误 `, ev.error.errorMessage);
2368
- }
2369
- else {
2370
- this.notification.error(`发生了一些错误 `, ev.error.message);
2371
- }
2372
- return;
2373
- }
2374
- if (ev instanceof HttpResponse && ev.body.errorMessage) {
2375
- this.notification.error(`发生了一些错误 `, ev.body.errorMessage);
2376
- return;
2377
- }
2378
- const errortext = CODEMESSAGE[ev.status] || ev.statusText;
2379
- this.notification.error(`请求错误 ${ev.status}: ${ev.url}`, errortext);
2380
- }
2381
- ToLogin() {
2382
- this.notification.error(`未登录或登录状态已过期,5秒后将跳转到登录页面。`, ``);
2383
- setTimeout(() => {
2384
- localStorage.clear();
2385
- this.injector.get(WINDOW).location.href = `${this.config.baseUrl}/cas-proxy/app/logout`;
2386
- }, 5000);
2387
- }
2388
- reAttachToken(req) {
2389
- const token = this.tokenSrv.get()?.token;
2390
- return req.clone({
2391
- setHeaders: {
2392
- Authorization: `Bearer ${token}`
2393
- }
2394
- });
2395
- }
2396
- refreshTokenRequest() {
2397
- const model = this.tokenSrv.get();
2398
- const form = new FormData();
2399
- form.set('refresh_token', model?.refreshToken);
2400
- form.set('grant_type', 'refresh_token');
2401
- form.set('scope', 'webapp');
2402
- log('yz.default.interceptor: use the refresh token to request a new token', model?.refreshToken);
2403
- // return this.http.post(`/auth/user/token/refresh?_allow_anonymous=true`, form);
2404
- return this.http.post(`/auth/oauth/getOrCreateToken/webapp`, form);
2405
- }
2406
- tryRefreshToken(ev, req, next) {
2407
- // 连刷新Token的请求都错了,那就是真错了
2408
- if (['/auth/oauth/getOrCreateToken/webapp'].some(url => req.url.includes(url))) {
2409
- this.ToLogin();
2410
- return throwError(() => ev);
2411
- }
2412
- // 正在刷新token,所有其他请求排队
2413
- if (this.refreshToking) {
2414
- return this.refreshToken$.pipe(filter(v => !!v), take(1), switchMap(() => next.handle(this.reAttachToken(req))));
2415
- }
2416
- //尝试调用刷新 Token
2417
- this.refreshToking = true;
2418
- this.refreshToken$.next(null);
2419
- // 处理Token
2420
- return this.refreshTokenRequest().pipe(switchMap(res => {
2421
- log('yz.default.interceptor: refresh token accessed -> ', res);
2422
- // 重新保存新 token
2423
- const { access_token, expires_in, refresh_token, scope, token_type } = res;
2424
- this.tokenSrv.set({
2425
- token: access_token,
2426
- expired: expires_in,
2427
- refreshToken: refresh_token,
2428
- tokenType: token_type,
2429
- scope
2430
- });
2431
- // 通知后续请求继续执行
2432
- this.refreshToking = false;
2433
- this.refreshToken$.next(res);
2434
- // 重新发起请求
2435
- return next.handle(this.reAttachToken(req));
2436
- }), catchError(err => {
2437
- this.refreshToking = false;
2438
- this.ToLogin();
2439
- return throwError(() => err);
2440
- }));
2441
- }
2442
- getAdditionalHeaders(headers) {
2443
- const res = {};
2444
- const lang = this.injector.get(YUNZAI_I18N_TOKEN).currentLang;
2445
- if (!headers?.has('Accept-Language') && lang) {
2446
- res['Accept-Language'] = lang;
2447
- }
2448
- return res;
2449
- }
2450
- handleData(ev, req, next) {
2451
- this.checkStatus(ev);
2452
- switch (ev.status) {
2453
- case 200:
2454
- return of(ev);
2455
- case 401:
2456
- if (this.config.refreshTokenEnabled && this.config.refreshTokenType === 're-request') {
2457
- return this.tryRefreshToken(ev, req, next);
2458
- }
2459
- this.ToLogin();
2460
- break;
2461
- case 403:
2462
- case 404:
2463
- case 500:
2464
- if (this.jump) {
2465
- this.goTo(`/exception/${ev.status}`);
2466
- }
2467
- break;
2468
- default:
2469
- if (ev instanceof HttpErrorResponse) {
2470
- console.warn('未可知错误,大部分是由于后端不支持跨域CORS或无效配置引起,请参考 https://ng.yunzainfo.com/docs/server 解决跨域问题', ev);
2471
- }
2472
- break;
2473
- }
2474
- if (ev instanceof HttpErrorResponse) {
2475
- return throwError(() => ev);
2476
- }
2477
- else {
2478
- return of(ev);
2479
- }
2480
- }
2481
- intercept(req, next) {
2482
- if (req.context.get(ALLOW_ANONYMOUS))
2483
- return next.handle(req);
2484
- log('yz.default.interceptor.ts: ', 'request ', req);
2485
- // 统一加前缀
2486
- let url = req.url;
2487
- if (!url.startsWith('https://') && !url.startsWith('http://')) {
2488
- url = this.config.baseUrl + url;
2489
- }
2490
- if (url.includes('.json') && url.includes('assets')) {
2491
- url = req.url;
2492
- }
2493
- // 加入语言头
2494
- const newReq = req.clone({ url, setHeaders: this.getAdditionalHeaders(req.headers) });
2495
- return next.handle(newReq).pipe(mergeMap(ev => {
2496
- // 允许统一对请求错误处理
2497
- if (ev instanceof HttpResponseBase) {
2498
- return this.handleData(ev, newReq, next);
2499
- }
2500
- // 若一切都正常,则后续操作
2501
- return of(ev);
2502
- }), catchError((err) => this.handleData(err, newReq, next)));
2503
- }
2504
- }
2505
- YzDefaultInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzDefaultInterceptor, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
2506
- YzDefaultInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzDefaultInterceptor });
2507
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzDefaultInterceptor, decorators: [{
2508
- type: Injectable
2509
- }], ctorParameters: function () { return [{ type: i0.Injector }]; } });
2510
-
2511
- function mapYzSideToYelonMenu(menus) {
2512
- menus.forEach(menu => {
2513
- menu.badgeDot = menu.badge_dot || null;
2514
- menu.badgeStatus = menu.badge_status || null;
2515
- menu.shortcutRoot = menu.shortcut_root || null;
2516
- menu.reuse = true;
2517
- if (menu.children) {
2518
- mapYzSideToYelonMenu(menu.children);
2519
- }
2520
- });
2521
- }
2522
- function generateAbility(menus, abilities, prefix) {
2523
- menus.forEach(menu => {
2524
- if (menu.link) {
2525
- prefix += menu.link;
2526
- }
2527
- else {
2528
- prefix += '';
2529
- }
2530
- if (menu.menuAuths) {
2531
- menu.menuAuths.forEach((a) => {
2532
- abilities.push(`${prefix}:${a}`);
2533
- abilities.push(a);
2534
- });
2535
- }
2536
- if (menu.children) {
2537
- generateAbility(menu.children, abilities, prefix);
2538
- }
2539
- });
2540
- }
2541
- class YzStartupService {
2542
- constructor(iconSrv, menuService, i18n, win, settingService, aclService, titleService, yzAuthService, cacheService, configService) {
2543
- this.menuService = menuService;
2544
- this.i18n = i18n;
2545
- this.win = win;
2546
- this.settingService = settingService;
2547
- this.aclService = aclService;
2548
- this.titleService = titleService;
2549
- this.yzAuthService = yzAuthService;
2550
- this.cacheService = cacheService;
2551
- this.configService = configService;
2552
- this.bis = BUSINESS_DEFAULT_CONFIG;
2553
- this.bis = mergeBisConfig(this.configService);
2554
- iconSrv.addIcon(...ICONS);
2555
- }
2556
- load() {
2557
- log$1('startup.service: ', 'load');
2558
- const defaultLang = this.i18n.defaultLang;
2559
- return this.i18n.loadLangData(defaultLang).pipe(mergeMap(langData => {
2560
- log$1('startup.service: ', 'set i18n, defaultLang->', defaultLang, ' langData->', langData);
2561
- this.i18n.use(defaultLang, langData);
2562
- return of(null);
2563
- }), mergeMap(() => {
2564
- return this.yzAuthService.login();
2565
- }), mergeMap(v => {
2566
- // preloader finish
2567
- this.systemInit();
2568
- log$1('startup.service: preloader finish');
2569
- if (this.win && this.win.appBootstrap) {
2570
- this.win.appBootstrap();
2571
- }
2572
- return of(v);
2573
- }));
2574
- }
2575
- systemInit() {
2576
- log$1('startup.service: system init');
2577
- // user
2578
- const user = this.cacheService.get('_yz_user', { mode: 'none' });
2579
- // menu
2580
- const ms = deepCopy(user.menu).filter((m) => m.systemCode && m.systemCode === this.bis.systemCode);
2581
- mapYzSideToYelonMenu(ms);
2582
- const currentMenu = ms.pop() || [];
2583
- this.menuService.add([currentMenu]);
2584
- // logo app
2585
- this.settingService.setApp({ name: currentMenu.text, description: currentMenu.intro });
2586
- this.settingService.setUser({
2587
- name: user.realname || 'no name',
2588
- avatar: `${this.bis.baseUrl}/filecenter/file/${user.avatarId}` || '',
2589
- email: user.email || 'no email'
2590
- });
2591
- // title
2592
- this.titleService.default = currentMenu && currentMenu.text ? currentMenu.text : 'default application name';
2593
- this.titleService.setTitle(currentMenu && currentMenu.text ? currentMenu.text : 'no title');
2594
- // acl
2595
- const abilities = [];
2596
- generateAbility([currentMenu], abilities, '');
2597
- this.aclService.attachRole(user?.roles
2598
- .map((role) => {
2599
- return role.roleValue;
2600
- })
2601
- .filter((a) => !!a) || []);
2602
- this.aclService.attachAbility(abilities);
2603
- // cache current
2604
- this.cacheService.set('_yz_current', {
2605
- text: currentMenu.text,
2606
- intro: currentMenu.intro,
2607
- icon: currentMenu.appIconUrl
2608
- });
2609
- }
2610
- }
2611
- YzStartupService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzStartupService, deps: [{ token: i8.NzIconService }, { token: i1.MenuService }, { token: YUNZAI_I18N_TOKEN }, { token: WINDOW }, { token: i1.SettingsService }, { token: i3$4.ACLService }, { token: i1.TitleService }, { token: YzAuthService }, { token: i1$1.CacheService }, { token: i1$3.YunzaiConfigService }], target: i0.ɵɵFactoryTarget.Injectable });
2612
- YzStartupService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzStartupService });
2613
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzStartupService, decorators: [{
2614
- type: Injectable
2615
- }], ctorParameters: function () { return [{ type: i8.NzIconService }, { type: i1.MenuService }, { type: YzI18NService, decorators: [{
2616
- type: Inject,
2617
- args: [YUNZAI_I18N_TOKEN]
2618
- }] }, { type: undefined, decorators: [{
2619
- type: Inject,
2620
- args: [WINDOW]
2621
- }] }, { type: i1.SettingsService }, { type: i3$4.ACLService }, { type: i1.TitleService }, { type: YzAuthService }, { type: i1$1.CacheService }, { type: i1$3.YunzaiConfigService }]; } });
2622
- function YzStartupServiceFactory(startupService) {
2623
- return () => startupService.load();
2624
- }
2625
- //@ts-ignore
2626
- const YZ_APPINIT_PROVIDES = [
2627
- YzStartupService,
2628
- {
2629
- provide: APP_INITIALIZER,
2630
- useFactory: YzStartupServiceFactory,
2631
- deps: [YzStartupService],
2632
- multi: true
2633
- }
2634
- ];
2635
-
2636
- class PathToRegexpService {
2637
- constructor() {
2638
- this.DEFAULT_DELIMITER = '/';
2639
- this.PATH_REGEXP = new RegExp(['(\\\\.)', '(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?'].join('|'), 'g');
2640
- }
2641
- parse(str, options) {
2642
- const tokens = [];
2643
- let key = 0;
2644
- let index = 0;
2645
- let path = '';
2646
- const defaultDelimiter = (options && options.delimiter) || this.DEFAULT_DELIMITER;
2647
- const whitelist = (options && options.whitelist) || undefined;
2648
- let pathEscaped = false;
2649
- let res;
2650
- while ((res = this.PATH_REGEXP.exec(str)) !== null) {
2651
- const m = res[0];
2652
- const escaped = res[1];
2653
- const offset = res.index;
2654
- path += str.slice(index, offset);
2655
- index = offset + m.length;
2656
- // Ignore already escaped sequences.
2657
- if (escaped) {
2658
- path += escaped[1];
2659
- pathEscaped = true;
2660
- continue;
2661
- }
2662
- let prev = '';
2663
- const name = res[2];
2664
- const capture = res[3];
2665
- const group = res[4];
2666
- const modifier = res[5];
2667
- if (!pathEscaped && path.length) {
2668
- const k = path.length - 1;
2669
- const c = path[k];
2670
- const matches = whitelist ? whitelist.indexOf(c) > -1 : true;
2671
- if (matches) {
2672
- prev = c;
2673
- path = path.slice(0, k);
2674
- }
2675
- }
2676
- // Push the current path onto the tokens.
2677
- if (path) {
2678
- tokens.push(path);
2679
- path = '';
2680
- pathEscaped = false;
2681
- }
2682
- const repeat = modifier === '+' || modifier === '*';
2683
- const optional = modifier === '?' || modifier === '*';
2684
- const pattern = capture || group;
2685
- const delimiter = prev || defaultDelimiter;
2686
- tokens.push({
2687
- name: name || key++,
2688
- prefix: prev,
2689
- delimiter: delimiter,
2690
- optional: optional,
2691
- repeat: repeat,
2692
- pattern: pattern
2693
- ? this.escapeGroup(pattern)
2694
- : `[^${this.escapeString(delimiter === defaultDelimiter ? delimiter : delimiter + defaultDelimiter)}]+?`
2695
- });
2696
- }
2697
- // Push any remaining characters.
2698
- if (path || index < str.length) {
2699
- tokens.push(path + str.substr(index));
2700
- }
2701
- return tokens;
2702
- }
2703
- compile(str, options) {
2704
- return this.tokensToFunction(this.parse(str, options), options);
2705
- }
2706
- tokensToFunction(tokens, options) {
2707
- const matches = new Array(tokens.length);
2708
- for (let i = 0; i < tokens.length; i++) {
2709
- if (typeof tokens[i] === 'object') {
2710
- matches[i] = new RegExp(`^(?:${tokens[i].pattern})$`, this.flags(options));
2711
- }
2712
- }
2713
- return function (data, options) {
2714
- let path = '';
2715
- const encode = (options && options.encode) || encodeURIComponent;
2716
- const validate = options ? options.validate !== false : true;
2717
- for (let i = 0; i < tokens.length; i++) {
2718
- const token = tokens[i];
2719
- if (typeof token === 'string') {
2720
- path += token;
2721
- continue;
2722
- }
2723
- const value = data ? data[token.name] : undefined;
2724
- let segment;
2725
- if (Array.isArray(value)) {
2726
- if (!token.repeat) {
2727
- throw new TypeError(`Expected "${token.name}" to not repeat, but got array`);
2728
- }
2729
- if (value.length === 0) {
2730
- if (token.optional) {
2731
- continue;
2732
- }
2733
- throw new TypeError(`Expected "${token.name}" to not be empty`);
2734
- }
2735
- for (let j = 0; j < value.length; j++) {
2736
- segment = encode(value[j], token);
2737
- if (validate && !matches[i].test(segment)) {
2738
- throw new TypeError(`Expected all "${token.name}" to match "${token.pattern}"`);
2739
- }
2740
- path += (j === 0 ? token.prefix : token.delimiter) + segment;
2741
- }
2742
- continue;
2743
- }
2744
- if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
2745
- segment = encode(String(value), token);
2746
- if (validate && !matches[i].test(segment)) {
2747
- throw new TypeError(`Expected "${token.name}" to match "${token.pattern}", but got "${segment}"`);
2748
- }
2749
- path += token.prefix + segment;
2750
- continue;
2751
- }
2752
- if (token.optional) {
2753
- continue;
2754
- }
2755
- throw new TypeError(`Expected "${token.name}" to be ${token.repeat ? 'an array' : 'a string'}`);
2756
- }
2757
- return path;
2758
- };
2759
- }
2760
- escapeString(str) {
2761
- return str.replace(/([.+*?=^!:${}()[\]|/\\])/g, '\\$1');
2762
- }
2763
- escapeGroup(group) {
2764
- return group.replace(/([=!:$/()])/g, '\\$1');
2765
- }
2766
- flags(options) {
2767
- return options && options.sensitive ? '' : 'i';
2768
- }
2769
- regexpToRegexp(path, keys) {
2770
- if (!keys) {
2771
- return path;
2772
- }
2773
- const groups = path.source.match(/\((?!\?)/g);
2774
- if (groups) {
2775
- for (let i = 0; i < groups.length; i++) {
2776
- keys.push({
2777
- name: i,
2778
- prefix: null,
2779
- delimiter: null,
2780
- optional: false,
2781
- repeat: false,
2782
- pattern: null
2783
- });
2784
- }
2785
- }
2786
- return path;
2787
- }
2788
- arrayToRegexp(path, keys, options) {
2789
- const parts = [];
2790
- for (let i = 0; i < path.length; i++) {
2791
- parts.push(this.pathToRegexp(path[i], keys, options).source);
2792
- }
2793
- return new RegExp(`(?:${parts.join('|')})`, this.flags(options));
2794
- }
2795
- stringToRegexp(path, keys, options) {
2796
- return this.tokensToRegExp(this.parse(path, options), keys, options);
2797
- }
2798
- tokensToRegExp(tokens, keys, options) {
2799
- options = options || {};
2800
- const strict = options.strict;
2801
- const start = options.start !== false;
2802
- const end = options.end !== false;
2803
- const delimiter = options.delimiter || this.DEFAULT_DELIMITER;
2804
- const endsWith = []
2805
- .concat(options.endsWith || [])
2806
- .map(this.escapeString)
2807
- .concat('$')
2808
- .join('|');
2809
- let route = start ? '^' : '';
2810
- for (let i = 0; i < tokens.length; i++) {
2811
- const token = tokens[i];
2812
- if (typeof token === 'string') {
2813
- route += this.escapeString(token);
2814
- }
2815
- else {
2816
- const capture = token.repeat
2817
- ? `(?:${token.pattern})(?:${this.escapeString(token.delimiter)}(?:${token.pattern}))*`
2818
- : token.pattern;
2819
- if (keys) {
2820
- keys.push(token);
2821
- }
2822
- if (token.optional) {
2823
- if (!token.prefix) {
2824
- route += `(${capture})?`;
2825
- }
2826
- else {
2827
- route += `(?:${this.escapeString(token.prefix)}(${capture}))?`;
2828
- }
2829
- }
2830
- else {
2831
- route += `${this.escapeString(token.prefix)}(${capture})`;
2832
- }
2833
- }
2834
- }
2835
- if (end) {
2836
- if (!strict) {
2837
- route += `(?:${this.escapeString(delimiter)})?`;
2838
- }
2839
- route += endsWith === '$' ? '$' : `(?=${endsWith})`;
2840
- }
2841
- else {
2842
- const endToken = tokens[tokens.length - 1];
2843
- const isEndDelimited = typeof endToken === 'string' ? endToken[endToken.length - 1] === delimiter : endToken === undefined;
2844
- if (!strict) {
2845
- route += `(?:${this.escapeString(delimiter)}(?=${endsWith}))?`;
2846
- }
2847
- if (!isEndDelimited) {
2848
- route += `(?=${this.escapeString(delimiter)}|${endsWith})`;
2849
- }
2850
- }
2851
- return new RegExp(route, this.flags(options));
2852
- }
2853
- pathToRegexp(path, keys, options) {
2854
- if (path instanceof RegExp) {
2855
- return this.regexpToRegexp(path, keys);
2856
- }
2857
- if (Array.isArray(path)) {
2858
- return this.arrayToRegexp(/** @type {!Array} */ path, keys, options);
2859
- }
2860
- return this.stringToRegexp(/** @type {string} */ path, keys, options);
2861
- }
2862
- }
2863
- PathToRegexpService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: PathToRegexpService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2864
- PathToRegexpService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: PathToRegexpService, providedIn: 'root' });
2865
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: PathToRegexpService, decorators: [{
2866
- type: Injectable,
2867
- args: [{
2868
- providedIn: 'root'
2869
- }]
2870
- }], ctorParameters: function () { return []; } });
2871
-
2872
- class ActGuard {
2873
- constructor(configService, cacheService, pathToRegexp, router) {
2874
- this.configService = configService;
2875
- this.cacheService = cacheService;
2876
- this.pathToRegexp = pathToRegexp;
2877
- this.router = router;
2878
- this.bis = BUSINESS_DEFAULT_CONFIG;
2879
- this.menus = [];
2880
- this.links = [];
2881
- log$1('act: ');
2882
- this.bis = mergeBisConfig(this.configService);
2883
- log$1('act: config ', this.bis);
2884
- const user = this.cacheService.get('_yz_user', { mode: 'none' });
2885
- log$1('act: user ', user);
2886
- this.menus = deepCopy(user.menu).filter((m) => m.systemCode && m.systemCode === this.bis.systemCode);
2887
- log$1('act: menus ', this.menus);
2888
- this.getAllLinks(this.menus, this.links);
2889
- log$1('act: links ', this.links);
2890
- }
2891
- canActivate(_, state) {
2892
- log$1('act: can activate ', state);
2893
- if (this.preHandle(state)) {
2894
- return true;
2895
- }
2896
- log$1('act: can activate child prehandle success');
2897
- let canactivate = false;
2898
- this.links.forEach((link) => {
2899
- const regexp = this.pathToRegexp.stringToRegexp(link, null, null);
2900
- log$1(`act: ${link} test ${state.url.split('?')[0]}`);
2901
- if (regexp.test(state.url.split('?')[0])) {
2902
- canactivate = true;
2903
- log$1(`act: test value ${canactivate}`);
2904
- return;
2905
- }
2906
- });
2907
- if (canactivate) {
2908
- log$1(`act: test sucess`);
2909
- return true;
2910
- }
2911
- else {
2912
- log$1(`act: test error`);
2913
- this.router.navigate(['displayIndex']);
2914
- return false;
2915
- }
2916
- }
2917
- canActivateChild(_, state) {
2918
- log$1('act: can activate child ', state);
2919
- if (this.preHandle(state)) {
2920
- return true;
2921
- }
2922
- log$1('act: can activate child prehandle success');
2923
- let canactivate = false;
2924
- this.links.forEach((link) => {
2925
- const regexp = this.pathToRegexp.stringToRegexp(link, null, null);
2926
- if (regexp.test(state.url.split('?')[0])) {
2927
- log$1(`act: ${link} test ${state.url.split('?')[0]}`);
2928
- canactivate = true;
2929
- log$1(`act: test value ${canactivate}`);
2930
- return;
2931
- }
2932
- });
2933
- if (canactivate) {
2934
- log$1(`act: test sucess`);
2935
- return true;
2936
- }
2937
- else {
2938
- log$1(`act: test error`);
2939
- this.router.navigate(['displayIndex']);
2940
- return false;
2941
- }
2942
- }
2943
- preHandle(state) {
2944
- return (state.url.includes('error') ||
2945
- state.url.includes('exception') ||
2946
- state.url.includes('displayIndex') ||
2947
- state.url === '' ||
2948
- state.url === null ||
2949
- state.url === '/' ||
2950
- state.url.includes('iframePage'));
2951
- }
2952
- getAllLinks(menu, links) {
2953
- menu.forEach((sider) => {
2954
- if (sider.link) {
2955
- links.push(sider.link);
2956
- }
2957
- if (sider.children && sider.children.length > 0) {
2958
- this.getAllLinks(sider.children, links);
2959
- }
2960
- });
2961
- }
2962
- }
2963
- ActGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: ActGuard, deps: [{ token: i1$3.YunzaiConfigService }, { token: i1$1.CacheService }, { token: PathToRegexpService }, { token: i5$3.Router }], target: i0.ɵɵFactoryTarget.Injectable });
2964
- ActGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: ActGuard, providedIn: 'root' });
2965
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: ActGuard, decorators: [{
2966
- type: Injectable,
2967
- args: [{
2968
- providedIn: 'root'
2969
- }]
2970
- }], ctorParameters: function () { return [{ type: i1$3.YunzaiConfigService }, { type: i1$1.CacheService }, { type: PathToRegexpService }, { type: i5$3.Router }]; } });
2971
-
2972
- /**
2973
- * Generated bundle index. Do not edit.
2974
- */
2975
-
2976
- export { ActGuard, BUSINESS_DEFAULT_CONFIG, ContactComponent, ContactService, PathToRegexpService, STOMP_DEFAULT_CONFIG, TOPIC, YZ_APPINIT_PROVIDES, YunzaiLayoutModule, YzAuthService, YzDefaultInterceptor, YzHeaderApplicationComponent, YzHeaderApplicationGroupComponent, YzHeaderClearStorageComponent, YzHeaderFullScreenComponent, YzHeaderI18NComponent, YzHeaderNotifyComponent, YzHeaderThemBtnComponent, YzHeaderUserComponent, YzI18NService, YzLayoutBasicComponent, YzStartupService, YzStartupServiceFactory, YzStompService, generateAbility, mapYzSideToYelonMenu, mergeBisConfig, mergeStompConfig };
2977
- //# sourceMappingURL=layout.mjs.map