@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,2968 +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 () {
493
- return [{ type: i1.SettingsService }, { type: YzI18NService, decorators: [{
494
- type: Inject,
495
- args: [YUNZAI_I18N_TOKEN]
496
- }] }, { type: undefined, decorators: [{
497
- type: Inject,
498
- args: [DOCUMENT]
499
- }] }];
500
- }, propDecorators: { showLangText: [{
501
- type: Input
502
- }] } });
503
-
504
- class YzHeaderNotifyComponent {
505
- constructor(injector, msg, y18n, nzI18n, cdr, httpClient) {
506
- this.injector = injector;
507
- this.msg = msg;
508
- this.y18n = y18n;
509
- this.nzI18n = nzI18n;
510
- this.cdr = cdr;
511
- this.httpClient = httpClient;
512
- this.data = [
513
- {
514
- key: 'msg',
515
- title: this.y18n.fanyi('notify.message'),
516
- list: [],
517
- emptyText: this.y18n.fanyi('notify.message.emptyText'),
518
- emptyImage: './assets/tmp/img/message.svg',
519
- clearText: this.y18n.fanyi('notify.message.clearText')
520
- },
521
- {
522
- key: 'todo',
523
- title: this.y18n.fanyi('notify.todo'),
524
- list: [],
525
- emptyText: this.y18n.fanyi('notify.todo.emptyText'),
526
- emptyImage: './assets/tmp/img/todo.svg',
527
- clearText: this.y18n.fanyi('notify.todo.clearText')
528
- },
529
- {
530
- key: 'notice',
531
- title: this.y18n.fanyi('notify.notice'),
532
- list: [],
533
- emptyText: this.y18n.fanyi('notify.notice.emptyText'),
534
- emptyImage: './assets/tmp/img/notice.svg',
535
- clearText: this.y18n.fanyi('notify.notice.clearText')
536
- }
537
- ];
538
- this.loading = false;
539
- this.count = 0;
540
- this.subs = [];
541
- }
542
- ngOnInit() {
543
- this.loadData();
544
- }
545
- loadData() {
546
- this.count = 0;
547
- this.loading = true;
548
- this.subs.push(forkJoin(this.loadTodo(), this.loadMessage()).subscribe(() => {
549
- this.loading = false;
550
- this.cdr.detectChanges();
551
- }));
552
- }
553
- loadMessage() {
554
- log('notify.component: ', 'fetch message list');
555
- const formatMessageStatus = (status) => {
556
- switch (status) {
557
- case '0':
558
- return { extra: this.y18n.fanyi('notify.unread'), color: 'red' };
559
- case '1':
560
- return { extra: this.y18n.fanyi('notify.readed'), color: 'green' };
561
- default:
562
- return { extra: this.y18n.fanyi('notify.nostatus'), color: 'primary' };
563
- }
564
- };
565
- return this.httpClient
566
- .post(`/message-center-3/my-msg-and-todo/msg-list`, {
567
- pageNum: 1,
568
- pageSize: 10,
569
- status: '0'
570
- })
571
- .pipe(map((response) => {
572
- const viewMessage = this.data.filter(d => d.key === 'msg')[0];
573
- viewMessage.list = response.data.list.map((m) => {
574
- return Object.assign(Object.assign({}, m), { avatar: (m === null || m === void 0 ? void 0 : m.imgUrl) || './assets/tmp/img/message.png', title: m.systemName, description: m.content, extra: formatMessageStatus(m.status).extra, color: formatMessageStatus(m.status).color, datetime: formatDistanceToNow(new Date(m.date), { locale: this.nzI18n.getDateLocale() }) });
575
- });
576
- this.count += viewMessage.list.length;
577
- }));
578
- }
579
- loadTodo() {
580
- log('notify.component: ', 'fetch todo list');
581
- const formatTodoStatus = (status) => {
582
- switch (status) {
583
- case '0':
584
- return { extra: this.y18n.fanyi('notify.unstart'), color: 'red' };
585
- case '1':
586
- return { extra: this.y18n.fanyi('notify.started'), color: 'green' };
587
- default:
588
- return { extra: this.y18n.fanyi('notify.nostatus'), color: 'primary' };
589
- }
590
- };
591
- return this.httpClient
592
- .post(`/message-center-3/my-msg-and-todo/todo-list`, {
593
- pageNum: 1,
594
- pageSize: 10,
595
- status: '0'
596
- })
597
- .pipe(map((response) => {
598
- const viewTodo = this.data.filter(d => d.key === 'todo')[0];
599
- viewTodo.list = response.data.list.map((t) => {
600
- return Object.assign(Object.assign({}, t), { avatar: (t === null || t === void 0 ? void 0 : t.imgUrl) || './assets/tmp/img/todo.png', title: t.systemName, description: t.content, datetime: formatDistanceToNow(new Date(t.date), { locale: this.nzI18n.getDateLocale() }), extra: formatTodoStatus(t.status).extra, color: formatTodoStatus(t.status).color });
601
- });
602
- this.count += viewTodo.list.length;
603
- }));
604
- }
605
- clear(type) {
606
- const t = this.data.filter(d => d.title === type)[0];
607
- if (t.key == 'msg' || t.key == 'notice') {
608
- this.subs.push(this.httpClient.post(`/message-center-3/my-msg-and-todo/msg-clear`, {}).subscribe(_ => {
609
- this.msg.success(`${this.y18n.fanyi('notify.clear')} ${type}`);
610
- this.loadData();
611
- }));
612
- }
613
- if (t.key == 'todo') {
614
- this.loadData();
615
- }
616
- }
617
- select(res) {
618
- this.injector.get(WINDOW).open(res.item.url);
619
- this.loadData();
620
- }
621
- ngOnDestroy() {
622
- this.subs.forEach(a => a.unsubscribe());
623
- }
624
- }
625
- 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 });
626
- YzHeaderNotifyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.5", type: YzHeaderNotifyComponent, selector: "yz-header-notify", ngImport: i0, template: `
627
- <notice-icon
628
- [data]="data"
629
- [count]="count"
630
- [loading]="loading"
631
- btnClass="yunzai-default__nav-item"
632
- btnIconClass="yunzai-default__nav-item-icon"
633
- (select)="select($event)"
634
- (clear)="clear($event)"
635
- ></notice-icon>
636
- `, 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 });
637
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzHeaderNotifyComponent, decorators: [{
638
- type: Component,
639
- args: [{
640
- selector: 'yz-header-notify',
641
- template: `
642
- <notice-icon
643
- [data]="data"
644
- [count]="count"
645
- [loading]="loading"
646
- btnClass="yunzai-default__nav-item"
647
- btnIconClass="yunzai-default__nav-item-icon"
648
- (select)="select($event)"
649
- (clear)="clear($event)"
650
- ></notice-icon>
651
- `,
652
- changeDetection: ChangeDetectionStrategy.OnPush
653
- }]
654
- }], ctorParameters: function () {
655
- return [{ type: i0.Injector }, { type: i1$2.NzMessageService }, { type: YzI18NService, decorators: [{
656
- type: Inject,
657
- args: [YUNZAI_I18N_TOKEN]
658
- }] }, { type: i2.NzI18nService }, { type: i0.ChangeDetectorRef }, { type: i1._HttpClient }];
659
- } });
660
-
661
- class YzHeaderThemBtnComponent {
662
- constructor(renderer, configSrv, platform, doc, directionality, KEYS) {
663
- this.renderer = renderer;
664
- this.configSrv = configSrv;
665
- this.platform = platform;
666
- this.doc = doc;
667
- this.directionality = directionality;
668
- this.KEYS = KEYS;
669
- this.theme = 'default';
670
- this.types = [
671
- { key: 'default', text: 'theme.default', color: '#2163ff' },
672
- { key: 'compact', text: 'theme.compact', color: '#2163ff' },
673
- { key: 'dark', text: 'theme.dark', color: '#020202' },
674
- { key: 'yuhong', text: 'theme.yuhong', color: '#C04851' },
675
- { key: 'danjuhuang', text: 'theme.danjuhuang', color: '#FBA414' },
676
- { key: 'xinghuang', text: 'theme.xinghuang', color: '#F28E16' },
677
- { key: 'shilv', text: 'theme.shilv', color: '#57C3C2' },
678
- { key: 'zhulv', text: 'theme.zhulv', color: '#1BA784' },
679
- { key: 'youlan', text: 'theme.youlan', color: '#1781B5' },
680
- { key: 'dianqing', text: 'theme.dianqing', color: '#1661AB' },
681
- { key: 'shangengzi', text: 'theme.shangengzi', color: '#61649F' },
682
- { key: 'shuiniuhui', text: 'theme.shuiniuhui', color: '#2F2F35' }
683
- ];
684
- this.devTips = `When the dark.css file can't be found, you need to run it once: npm run theme`;
685
- this.deployUrl = '';
686
- this.destroy$ = new Subject();
687
- this.dir = 'ltr';
688
- }
689
- ngOnInit() {
690
- var _a;
691
- this.dir = this.directionality.value;
692
- (_a = this.directionality.change) === null || _a === void 0 ? void 0 : _a.pipe(takeUntil(this.destroy$)).subscribe((direction) => {
693
- this.dir = direction;
694
- });
695
- this.initTheme();
696
- }
697
- initTheme() {
698
- if (!this.platform.isBrowser) {
699
- return;
700
- }
701
- this.theme = localStorage.getItem(this.KEYS) || 'default';
702
- this.updateChartTheme();
703
- this.onThemeChange(this.theme);
704
- }
705
- updateChartTheme() {
706
- this.configSrv.set('chart', { theme: this.theme === 'dark' ? 'dark' : '' });
707
- }
708
- onThemeChange(theme) {
709
- if (!this.platform.isBrowser) {
710
- return;
711
- }
712
- this.theme = theme;
713
- this.renderer.setAttribute(this.doc.body, 'data-theme', theme);
714
- const dom = this.doc.getElementById(this.KEYS);
715
- if (dom) {
716
- dom.remove();
717
- }
718
- localStorage.removeItem(this.KEYS);
719
- if (theme !== 'default') {
720
- const el = this.doc.createElement('link');
721
- el.type = 'text/css';
722
- el.rel = 'stylesheet';
723
- el.id = this.KEYS;
724
- el.href = `${this.deployUrl}assets/style.${theme}.css`;
725
- localStorage.setItem(this.KEYS, theme);
726
- this.doc.body.append(el);
727
- }
728
- this.updateChartTheme();
729
- }
730
- ngOnDestroy() {
731
- const el = this.doc.getElementById(this.KEYS);
732
- if (el != null) {
733
- this.doc.body.removeChild(el);
734
- }
735
- this.destroy$.next();
736
- this.destroy$.complete();
737
- }
738
- }
739
- 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 });
740
- 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: `
741
- <div
742
- class="yunzai-default__nav-item"
743
- nz-dropdown
744
- [nzDropdownMenu]="iconMenu"
745
- nzTrigger="click"
746
- nzPlacement="bottomRight"
747
- >
748
- <svg nz-tooltip class="anticon" role="img" width="21" height="21" viewBox="0 0 21 21" fill="currentColor">
749
- <g fill-rule="evenodd">
750
- <g fill-rule="nonzero">
751
- <path
752
- 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"
753
- ></path>
754
- </g>
755
- </g>
756
- </svg>
757
- </div>
758
- <nz-dropdown-menu #iconMenu="nzDropdownMenu">
759
- <ul nz-menu>
760
- <li
761
- nz-menu-item
762
- *ngFor="let theme of types"
763
- (click)="onThemeChange(theme.key)"
764
- [style]="{ color: theme.color }"
765
- >
766
- <i nz-icon nzType="bg-colors"></i>
767
- {{ theme.text | i18n }}
768
- </li>
769
- </ul>
770
- <!-- <div nz-menu class="wd-xl animated jello">-->
771
- <!-- <div nz-row [nzJustify]="'space-between'" [nzAlign]="'middle'" class="app-icons">-->
772
- <!-- <div nz-col [nzSpan]="4" *ngFor="let theme of types" (click)="onThemeChange(theme.key)">-->
773
- <!-- <i nz-icon nzType="bg-colors" class="text-white" [style]="{ backgroundColor: theme.color }"></i>-->
774
- <!-- <span [ngStyle]="{ color: theme.color }">{{ theme.text | i18n }}</span>-->
775
- <!-- </div>-->
776
- <!-- </div>-->
777
- <!-- </div>-->
778
- </nz-dropdown-menu>
779
- `, 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 });
780
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzHeaderThemBtnComponent, decorators: [{
781
- type: Component,
782
- args: [{
783
- selector: 'yz-header-theme-btn',
784
- template: `
785
- <div
786
- class="yunzai-default__nav-item"
787
- nz-dropdown
788
- [nzDropdownMenu]="iconMenu"
789
- nzTrigger="click"
790
- nzPlacement="bottomRight"
791
- >
792
- <svg nz-tooltip class="anticon" role="img" width="21" height="21" viewBox="0 0 21 21" fill="currentColor">
793
- <g fill-rule="evenodd">
794
- <g fill-rule="nonzero">
795
- <path
796
- 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"
797
- ></path>
798
- </g>
799
- </g>
800
- </svg>
801
- </div>
802
- <nz-dropdown-menu #iconMenu="nzDropdownMenu">
803
- <ul nz-menu>
804
- <li
805
- nz-menu-item
806
- *ngFor="let theme of types"
807
- (click)="onThemeChange(theme.key)"
808
- [style]="{ color: theme.color }"
809
- >
810
- <i nz-icon nzType="bg-colors"></i>
811
- {{ theme.text | i18n }}
812
- </li>
813
- </ul>
814
- <!-- <div nz-menu class="wd-xl animated jello">-->
815
- <!-- <div nz-row [nzJustify]="'space-between'" [nzAlign]="'middle'" class="app-icons">-->
816
- <!-- <div nz-col [nzSpan]="4" *ngFor="let theme of types" (click)="onThemeChange(theme.key)">-->
817
- <!-- <i nz-icon nzType="bg-colors" class="text-white" [style]="{ backgroundColor: theme.color }"></i>-->
818
- <!-- <span [ngStyle]="{ color: theme.color }">{{ theme.text | i18n }}</span>-->
819
- <!-- </div>-->
820
- <!-- </div>-->
821
- <!-- </div>-->
822
- </nz-dropdown-menu>
823
- `,
824
- changeDetection: ChangeDetectionStrategy.OnPush
825
- }]
826
- }], ctorParameters: function () {
827
- return [{ type: i0.Renderer2 }, { type: i4.YunzaiConfigService }, { type: i3.Platform }, { type: undefined, decorators: [{
828
- type: Inject,
829
- args: [DOCUMENT]
830
- }] }, { type: i3$1.Directionality, decorators: [{
831
- type: Optional
832
- }] }, { type: undefined, decorators: [{
833
- type: Inject,
834
- args: [YUNZAI_THEME_BTN_KEYS]
835
- }] }];
836
- }, propDecorators: { types: [{
837
- type: Input
838
- }], devTips: [{
839
- type: Input
840
- }], deployUrl: [{
841
- type: Input
842
- }] } });
843
-
844
- const BUSINESS_DEFAULT_CONFIG = {
845
- baseUrl: '/backstage',
846
- systemCode: 'portal',
847
- loginForm: null,
848
- refreshTokenEnabled: true,
849
- refreshTokenType: 're-request'
850
- };
851
- function mergeBisConfig(srv) {
852
- return srv.merge('bis', BUSINESS_DEFAULT_CONFIG);
853
- }
854
-
855
- class YzHeaderUserComponent {
856
- constructor(injector, msg, tokenService,
857
- // @ts-ignore
858
- configService, cacheService) {
859
- this.injector = injector;
860
- this.msg = msg;
861
- this.tokenService = tokenService;
862
- this.configService = configService;
863
- this.cacheService = cacheService;
864
- this.icon = '';
865
- this.username = '';
866
- this.menus = [];
867
- this.config = mergeBisConfig(configService);
868
- }
869
- ngOnInit() {
870
- const projectInfo = this.cacheService.get('_yz_project_info', { mode: 'none' });
871
- const user = this.cacheService.get('_yz_user', { mode: 'none' });
872
- this.username = user.realname ? user.realname : '未命名';
873
- this.icon = user.avatarId
874
- ? `${this.config.baseUrl}/filecenter/file/${user.avatarId}`
875
- : `./assets/tmp/img/avatar.jpg`;
876
- this.menus = projectInfo.profileList;
877
- }
878
- logout() {
879
- localStorage.clear();
880
- this.tokenService.clear();
881
- this.injector.get(WINDOW).location.href = `${this.config.baseUrl}/cas-proxy/app/logout`;
882
- }
883
- to(href) {
884
- if (href) {
885
- this.injector.get(WINDOW).open(href);
886
- }
887
- else {
888
- this.msg.error('该菜单没有配置链接!');
889
- }
890
- }
891
- }
892
- 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 });
893
- YzHeaderUserComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.5", type: YzHeaderUserComponent, selector: "yz-header-user", ngImport: i0, template: `
894
- <div
895
- class="yunzai-default__nav-item d-flex align-items-center px-sm"
896
- nz-dropdown
897
- nzPlacement="bottomRight"
898
- [nzDropdownMenu]="userMenu"
899
- >
900
- <div class="yz-user-name">
901
- <nz-avatar [nzSrc]="icon" nzSize="small" class="mr-sm"></nz-avatar>
902
- {{ username }}
903
- </div>
904
- </div>
905
- <nz-dropdown-menu #userMenu="nzDropdownMenu">
906
- <div nz-menu class="width-sm">
907
- <div nz-menu-item *ngFor="let m of menus" (click)="to(m.url)">
908
- <i nz-icon [nzType]="m.icon" class="mr-sm"></i>
909
- {{ m.name | i18n }}
910
- </div>
911
- <li nz-menu-divider></li>
912
- <div nz-menu-item (click)="logout()">
913
- <i nz-icon nzType="logout" class="mr-sm"></i>
914
- {{ 'menu.account.logout' | i18n }}
915
- </div>
916
- </div>
917
- </nz-dropdown-menu>
918
- `, 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 });
919
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzHeaderUserComponent, decorators: [{
920
- type: Component,
921
- args: [{
922
- selector: 'yz-header-user',
923
- template: `
924
- <div
925
- class="yunzai-default__nav-item d-flex align-items-center px-sm"
926
- nz-dropdown
927
- nzPlacement="bottomRight"
928
- [nzDropdownMenu]="userMenu"
929
- >
930
- <div class="yz-user-name">
931
- <nz-avatar [nzSrc]="icon" nzSize="small" class="mr-sm"></nz-avatar>
932
- {{ username }}
933
- </div>
934
- </div>
935
- <nz-dropdown-menu #userMenu="nzDropdownMenu">
936
- <div nz-menu class="width-sm">
937
- <div nz-menu-item *ngFor="let m of menus" (click)="to(m.url)">
938
- <i nz-icon [nzType]="m.icon" class="mr-sm"></i>
939
- {{ m.name | i18n }}
940
- </div>
941
- <li nz-menu-divider></li>
942
- <div nz-menu-item (click)="logout()">
943
- <i nz-icon nzType="logout" class="mr-sm"></i>
944
- {{ 'menu.account.logout' | i18n }}
945
- </div>
946
- </div>
947
- </nz-dropdown-menu>
948
- `,
949
- changeDetection: ChangeDetectionStrategy.OnPush
950
- }]
951
- }], ctorParameters: function () {
952
- return [{ type: i0.Injector }, { type: i1$2.NzMessageService }, { type: undefined, decorators: [{
953
- type: Inject,
954
- args: [YA_SERVICE_TOKEN]
955
- }] }, { type: i1$3.YunzaiConfigService }, { type: i1$1.CacheService }];
956
- } });
957
-
958
- class YzHeaderClearStorageComponent {
959
- constructor(modalSrv, messageSrv) {
960
- this.modalSrv = modalSrv;
961
- this.messageSrv = messageSrv;
962
- }
963
- _click() {
964
- this.modalSrv.confirm({
965
- nzTitle: 'Make sure clear all local storage?',
966
- nzOnOk: () => {
967
- localStorage.clear();
968
- this.messageSrv.success('Clear Finished!');
969
- }
970
- });
971
- }
972
- }
973
- 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 });
974
- 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: `
975
- <i nz-icon nzType="tool"></i>
976
- {{ 'menu.clear.local.storage' | i18n }}
977
- `, 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 });
978
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzHeaderClearStorageComponent, decorators: [{
979
- type: Component,
980
- args: [{
981
- selector: 'yz-header-clear-storage',
982
- template: `
983
- <i nz-icon nzType="tool"></i>
984
- {{ 'menu.clear.local.storage' | i18n }}
985
- `,
986
- host: {
987
- '[class.d-block]': 'true'
988
- },
989
- changeDetection: ChangeDetectionStrategy.OnPush
990
- }]
991
- }], ctorParameters: function () { return [{ type: i1$4.NzModalService }, { type: i1$2.NzMessageService }]; }, propDecorators: { _click: [{
992
- type: HostListener,
993
- args: ['click']
994
- }] } });
995
-
996
- class YzHeaderFullScreenComponent {
997
- constructor() {
998
- this.status = false;
999
- }
1000
- _resize() {
1001
- this.status = screenfull.isFullscreen;
1002
- }
1003
- _click() {
1004
- if (screenfull.isEnabled) {
1005
- screenfull.toggle();
1006
- }
1007
- }
1008
- }
1009
- YzHeaderFullScreenComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzHeaderFullScreenComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1010
- 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: `
1011
- <i nz-icon [nzType]="status ? 'fullscreen-exit' : 'fullscreen'"></i>
1012
- {{ (status ? 'menu.fullscreen.exit' : 'menu.fullscreen') | i18n }}
1013
- `, 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 });
1014
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzHeaderFullScreenComponent, decorators: [{
1015
- type: Component,
1016
- args: [{
1017
- selector: 'yz-header-fullscreen',
1018
- template: `
1019
- <i nz-icon [nzType]="status ? 'fullscreen-exit' : 'fullscreen'"></i>
1020
- {{ (status ? 'menu.fullscreen.exit' : 'menu.fullscreen') | i18n }}
1021
- `,
1022
- host: {
1023
- '[class.d-block]': 'true'
1024
- },
1025
- changeDetection: ChangeDetectionStrategy.OnPush
1026
- }]
1027
- }], propDecorators: { _resize: [{
1028
- type: HostListener,
1029
- args: ['window:resize']
1030
- }], _click: [{
1031
- type: HostListener,
1032
- args: ['click']
1033
- }] } });
1034
-
1035
- class YzHeaderApplicationGroupComponent {
1036
- constructor(inject, cacheService, http) {
1037
- this.inject = inject;
1038
- this.cacheService = cacheService;
1039
- this.http = http;
1040
- this.topicData = [];
1041
- this.subs = [];
1042
- }
1043
- ngOnInit() {
1044
- this.topicData = this.cacheService.get('_yz_header', { mode: 'none' });
1045
- console.log(this.topicData);
1046
- }
1047
- ngOnDestroy() {
1048
- this.subs.forEach(s => s.unsubscribe());
1049
- }
1050
- open(topic) {
1051
- if (topic.key) {
1052
- this.subs.push(this.http
1053
- .post(`/app-manager/web-scan/save`, {
1054
- appId: topic.key,
1055
- createDate: new Date()
1056
- })
1057
- .subscribe());
1058
- }
1059
- switch (topic.target) {
1060
- case 'href':
1061
- this.inject.get(WINDOW).location.href = topic.url;
1062
- break;
1063
- case 'blank':
1064
- this.inject.get(WINDOW).location.href = topic.url;
1065
- break;
1066
- case 'target':
1067
- this.inject.get(WINDOW).location.href = topic.url;
1068
- break;
1069
- default:
1070
- this.inject.get(WINDOW).location.href = topic.url;
1071
- break;
1072
- }
1073
- }
1074
- }
1075
- 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 });
1076
- YzHeaderApplicationGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.5", type: YzHeaderApplicationGroupComponent, selector: "yz-header-application-group", ngImport: i0, template: `
1077
- <div class="yz-application-group">
1078
- <nz-tabset>
1079
- <nz-tab *ngFor="let menu of topicData" [nzTitle]="groupTitleTpl">
1080
- <ng-template #groupTitleTpl>
1081
- <a
1082
- nz-dropdown
1083
- [nzDropdownMenu]="menuTpl"
1084
- [nzTrigger]="'click'"
1085
- [nzOverlayClassName]="'yz-application-dropdown'"
1086
- >
1087
- <i nz-icon *ngIf="menu.icon" [nzType]="menu.icon" nzTheme="outline"></i>
1088
- {{ menu.name | i18n }}
1089
- <i *ngIf="menu.children && menu.children.length > 0" nz-icon nzType="down" nzTheme="outline"></i>
1090
- </a>
1091
- <nz-dropdown-menu #menuTpl="nzDropdownMenu">
1092
- <ul nz-menu nzSelectable *ngIf="menu.children && menu.children.length > 0">
1093
- <ng-container *ngFor="let item of menu.children">
1094
- <li nz-menu-item (click)="open(item)">
1095
- <i nz-icon *ngIf="item.icon" [nzType]="item.icon" nzTheme="outline"></i>{{ item.name | i18n }}
1096
- </li>
1097
- </ng-container>
1098
- </ul>
1099
- </nz-dropdown-menu>
1100
- </ng-template>
1101
- </nz-tab>
1102
- </nz-tabset>
1103
- </div>
1104
- `, 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 });
1105
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzHeaderApplicationGroupComponent, decorators: [{
1106
- type: Component,
1107
- args: [{
1108
- selector: 'yz-header-application-group',
1109
- template: `
1110
- <div class="yz-application-group">
1111
- <nz-tabset>
1112
- <nz-tab *ngFor="let menu of topicData" [nzTitle]="groupTitleTpl">
1113
- <ng-template #groupTitleTpl>
1114
- <a
1115
- nz-dropdown
1116
- [nzDropdownMenu]="menuTpl"
1117
- [nzTrigger]="'click'"
1118
- [nzOverlayClassName]="'yz-application-dropdown'"
1119
- >
1120
- <i nz-icon *ngIf="menu.icon" [nzType]="menu.icon" nzTheme="outline"></i>
1121
- {{ menu.name | i18n }}
1122
- <i *ngIf="menu.children && menu.children.length > 0" nz-icon nzType="down" nzTheme="outline"></i>
1123
- </a>
1124
- <nz-dropdown-menu #menuTpl="nzDropdownMenu">
1125
- <ul nz-menu nzSelectable *ngIf="menu.children && menu.children.length > 0">
1126
- <ng-container *ngFor="let item of menu.children">
1127
- <li nz-menu-item (click)="open(item)">
1128
- <i nz-icon *ngIf="item.icon" [nzType]="item.icon" nzTheme="outline"></i>{{ item.name | i18n }}
1129
- </li>
1130
- </ng-container>
1131
- </ul>
1132
- </nz-dropdown-menu>
1133
- </ng-template>
1134
- </nz-tab>
1135
- </nz-tabset>
1136
- </div>
1137
- `,
1138
- changeDetection: ChangeDetectionStrategy.OnPush
1139
- }]
1140
- }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i1$1.CacheService }, { type: i1._HttpClient }]; } });
1141
-
1142
- class ContactService {
1143
- constructor(http, cache) {
1144
- this.http = http;
1145
- this.cache = cache;
1146
- }
1147
- /**
1148
- * 部门树查询
1149
- *
1150
- * @param clas 包含班级
1151
- * @param his 包含历史班级
1152
- * @param grade 系部
1153
- * @param gradeID 系部ID
1154
- * @returns 可观察部门树
1155
- */
1156
- dept(clas, his, grade, gradeID) {
1157
- let baseUrl = `/auth/baseDepartMent/tree?debug=false`;
1158
- if (clas) {
1159
- baseUrl += `&includeClass=true`;
1160
- }
1161
- else {
1162
- baseUrl += `&includeClass=false`;
1163
- }
1164
- if (his) {
1165
- baseUrl += `&includeHisClass=true`;
1166
- }
1167
- else {
1168
- baseUrl += `&includeHisClass=false`;
1169
- }
1170
- if (grade) {
1171
- baseUrl += `&deptTypes=2,class`;
1172
- }
1173
- if (gradeID) {
1174
- baseUrl += `&gradeId=${gradeID}`;
1175
- }
1176
- return this.http.get(baseUrl).pipe(map((response) => {
1177
- return response.data || [];
1178
- }));
1179
- }
1180
- page(uri, page) {
1181
- return this.http.post(`${uri}/queryListForPage`, page);
1182
- }
1183
- pageBaseUser(page) {
1184
- return this.page('/auth/baseUser', page);
1185
- }
1186
- getUserByIds(ids) {
1187
- return this.http
1188
- .post('/auth/baseUser/users', {
1189
- userIds: ids
1190
- })
1191
- .pipe((response) => {
1192
- return response.data || [];
1193
- });
1194
- }
1195
- /**
1196
- * 查询人员信息
1197
- *
1198
- * @param userIds[] 用户id数组,["aaa","bbb","ccc"]
1199
- */
1200
- getUserByUserIds(userIds) {
1201
- return this.http
1202
- .post(`/auth/baseUser/users`, {
1203
- userIds: userIds
1204
- })
1205
- .pipe(map((response) => {
1206
- return response.data ? response.data : [];
1207
- }));
1208
- }
1209
- /**
1210
- * 获取角色组角色
1211
- *
1212
- * @param roleGroupCode 角色组code
1213
- */
1214
- getGroupRole(roleGroupCode) {
1215
- return this.http
1216
- .post(`/auth/baseRole/findGroupRole`, {
1217
- roleGroupCode: roleGroupCode
1218
- })
1219
- .pipe(map((response) => {
1220
- return response.data ? response.data : [];
1221
- }));
1222
- }
1223
- /**
1224
- * 查询当前用户好友分组
1225
- */
1226
- getFriendGroup() {
1227
- return this.http.post(`/contact/appcontact/findGroup`, {}).pipe(map((response) => {
1228
- return response.data ? response.data : [];
1229
- }));
1230
- }
1231
- /**
1232
- * 查询年级
1233
- */
1234
- getGrade() {
1235
- return this.http.get(`/auth/gradeYear/queryListForPage`).pipe(map((response) => {
1236
- return response.data ? response.data : [];
1237
- }));
1238
- }
1239
- /**
1240
- * 查询人员类别列表
1241
- */
1242
- getRylbs() {
1243
- return this.http.post(`/auth/baseTeacher/queryRylbs`, {}).pipe(map((response) => {
1244
- return response.data ? response.data : [];
1245
- }));
1246
- }
1247
- /**
1248
- * 获取学生公寓树
1249
- *
1250
- * @param isPower 是否带有权限,默认false
1251
- * @param treeType 树类型 0:宿舍楼 1:宿舍楼+层 2:宿舍楼+层+房间
1252
- */
1253
- getDormTree(isPower, treeType) {
1254
- const user = this.cache.get('_yz_user', { mode: 'none' });
1255
- let params = {};
1256
- if (isPower) {
1257
- params = {
1258
- isPower: isPower,
1259
- userId: user.userId,
1260
- treeType: treeType
1261
- };
1262
- }
1263
- else {
1264
- params = {
1265
- isPower: isPower,
1266
- treeType: treeType
1267
- };
1268
- }
1269
- return this.http.post(`/auth/dorm/tree`, params).pipe(map((response) => {
1270
- return response.data ? response.data : [];
1271
- }));
1272
- }
1273
- }
1274
- 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 });
1275
- ContactService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: ContactService, providedIn: 'root' });
1276
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: ContactService, decorators: [{
1277
- type: Injectable,
1278
- args: [{
1279
- providedIn: 'root'
1280
- }]
1281
- }], ctorParameters: function () { return [{ type: i1._HttpClient }, { type: i1$1.CacheService }]; } });
1282
-
1283
- class ContactComponent {
1284
- constructor(contact, changeDetectorRef) {
1285
- this.contact = contact;
1286
- this.changeDetectorRef = changeDetectorRef;
1287
- this.subs = [];
1288
- /**
1289
- * tabset
1290
- */
1291
- this.nzTabsetSearch = null;
1292
- this.nzTabsetLoading = false;
1293
- /**
1294
- * 树展开状态
1295
- */
1296
- this.nzExpandAll = true;
1297
- /**
1298
- * 部门树和部门查询的一些选项/可传可不传
1299
- */
1300
- this.nzDepts = [];
1301
- this._nzDeptsCopy = [];
1302
- this.nzDeptTreeVirtualHeight = null;
1303
- this.nzDeptClass = true;
1304
- this.nzDeptClassHistory = true;
1305
- this.nzDeptGrade = false;
1306
- this.nzDeptGradeID = null;
1307
- /**
1308
- * 角色树
1309
- */
1310
- this.nzRoles = [];
1311
- this._nzRolesCopy = [];
1312
- this.nzRoleTreeVirtualHeight = null;
1313
- /**
1314
- * 好友分组
1315
- */
1316
- this.nzFriendGroups = [];
1317
- this._nzFriendGroupsCopy = [];
1318
- /**
1319
- * 联系人
1320
- */
1321
- this.defaultContacts = [];
1322
- this.nzContacts = [];
1323
- this.nzContactLoading = false;
1324
- /**
1325
- * 提交和提交按钮
1326
- */
1327
- this.button = true;
1328
- this.confirmed = new EventEmitter();
1329
- }
1330
- /**
1331
- * 初始化,首先加载部门树和默认选中的人的数据
1332
- */
1333
- ngOnInit() {
1334
- this.onTabsetDept();
1335
- this.onContactsInit();
1336
- }
1337
- /**
1338
- * 视图初始化完毕后进行table初始化
1339
- */
1340
- ngAfterViewInit() {
1341
- this.onTableInit();
1342
- }
1343
- /**
1344
- * 初始化默认选中联系人
1345
- */
1346
- onContactsInit() {
1347
- if (this.defaultContacts && this.defaultContacts.length > 0) {
1348
- this.nzContactLoading = true;
1349
- this.subs.push(this.contact.getUserByUserIds(this.defaultContacts).subscribe(contacts => {
1350
- this.nzContacts = contacts;
1351
- this.nzContactLoading = false;
1352
- this.refresh();
1353
- }));
1354
- }
1355
- }
1356
- /**
1357
- * table初始化
1358
- */
1359
- onTableInit() {
1360
- // 设置表头
1361
- this.st.resetColumns({
1362
- columns: [
1363
- { title: '选择', type: 'checkbox' },
1364
- { title: '序号', type: 'no' },
1365
- { title: '姓名', index: 'realName' },
1366
- { title: '学号/工号', index: 'userCode' },
1367
- { title: '部门', index: 'dept.deptName' }
1368
- ]
1369
- });
1370
- // 订阅table点击checkbox事件变化
1371
- this.subs.push(this.st.change.subscribe(e => {
1372
- if (e.type === 'checkbox') {
1373
- // 点击checkbox新增联系人
1374
- const contactIds = this.nzContacts.map(c => c.userId);
1375
- this.nzContacts = this.nzContacts.concat(e.checkbox.filter(c => !contactIds.includes(c.userId)));
1376
- // 取消checkbox取消联系人
1377
- const cancelIds = this.st.list.filter(d => !d.checked).map(d => d.userId);
1378
- this.nzContacts = this.nzContacts.filter(d => !cancelIds.includes(d.userId));
1379
- }
1380
- }));
1381
- }
1382
- /**
1383
- * tabset进入加载状态
1384
- */
1385
- onTabsetLoadStart() {
1386
- this.nzTabsetLoading = true;
1387
- }
1388
- /**
1389
- * tabset取消加载状态
1390
- */
1391
- onTabsetLoadEnd() {
1392
- this.nzTabsetLoading = false;
1393
- }
1394
- /**
1395
- * tabset搜索框清除
1396
- */
1397
- onTabsetSearchClean() {
1398
- this.nzDepts = this._nzDeptsCopy;
1399
- this.nzRoles = this._nzRolesCopy;
1400
- this.nzFriendGroups = this._nzFriendGroupsCopy;
1401
- this.nzTabsetSearch = null;
1402
- }
1403
- /**
1404
- * tabset搜索框输入
1405
- *
1406
- * @param type 类型
1407
- * @param value 值
1408
- */
1409
- onTabsetSearchChange(type, value) {
1410
- this.onTabsetLoadStart();
1411
- if (!value || value === '') {
1412
- this.nzDepts = this._nzDeptsCopy;
1413
- this.nzRoles = this._nzRolesCopy;
1414
- this.nzFriendGroups = this._nzFriendGroupsCopy;
1415
- }
1416
- else {
1417
- const trees = [];
1418
- if (type === 'dept') {
1419
- this.searchTree(value, this._nzDeptsCopy, trees);
1420
- this.nzDepts = trees;
1421
- }
1422
- if (type === 'role') {
1423
- this.searchTree(value, this._nzRolesCopy, trees);
1424
- this.nzRoles = trees;
1425
- }
1426
- if (type === 'friendGroup') {
1427
- this.nzFriendGroups = this._nzFriendGroupsCopy.filter(f => {
1428
- return !f.name.indexOf(value);
1429
- });
1430
- }
1431
- }
1432
- this.onTabsetLoadEnd();
1433
- this.refresh();
1434
- }
1435
- /**
1436
- * tabset切换到部门
1437
- */
1438
- onTabsetDept() {
1439
- this.onTabsetSearchClean();
1440
- if (!this.nzDepts || this.nzDepts.length === 0) {
1441
- this.onTabsetDeptFlush();
1442
- }
1443
- }
1444
- /**
1445
- * tabset切换到角色
1446
- */
1447
- onTabsetRole() {
1448
- this.onTabsetSearchClean();
1449
- if (!this.nzRoles || this.nzRoles.length === 0) {
1450
- this.onTabsetRoleFlush(null);
1451
- }
1452
- }
1453
- /**
1454
- * tabset切换到好友分组
1455
- */
1456
- onTabsetFriendGroup() {
1457
- this.onTabsetSearchClean();
1458
- if (!this.nzFriendGroups || this.nzFriendGroups.length === 0) {
1459
- this.onTabsetFriendGroupFlush();
1460
- }
1461
- }
1462
- /**
1463
- * 获取部门树
1464
- */
1465
- onTabsetDeptFlush() {
1466
- this.onTabsetLoadStart();
1467
- this.subs.push(this.contact
1468
- .dept(this.nzDeptClass, this.nzDeptClassHistory, this.nzDeptGrade, this.nzDeptGradeID)
1469
- .subscribe((trees) => {
1470
- this.expandTree(trees);
1471
- this.nzDepts = trees;
1472
- this._nzDeptsCopy = trees;
1473
- this.onTabsetLoadEnd();
1474
- this.refresh();
1475
- }));
1476
- }
1477
- // 获取角色树
1478
- onTabsetRoleFlush(groupRoleCode) {
1479
- this.onTabsetLoadStart();
1480
- this.subs.push(this.contact.getGroupRole(groupRoleCode).subscribe((roles) => {
1481
- this.expandTree(roles);
1482
- this.nzRoles = roles;
1483
- this._nzRolesCopy = roles;
1484
- this.onTabsetLoadEnd();
1485
- this.refresh();
1486
- }));
1487
- }
1488
- // 获取好友分组列表
1489
- onTabsetFriendGroupFlush() {
1490
- this.onTabsetLoadStart();
1491
- this.subs.push(this.contact.getFriendGroup().subscribe((group) => {
1492
- this.nzFriendGroups = group;
1493
- this._nzFriendGroupsCopy = group;
1494
- this.onTabsetLoadEnd();
1495
- this.refresh();
1496
- }));
1497
- }
1498
- /**
1499
- * 部门树点击
1500
- *
1501
- * @param e 节点
1502
- */
1503
- onDeptClick(e) {
1504
- var _a;
1505
- // 构造分页请求,直接传入stTable组件,剩下的所有交给组件自己完成
1506
- this.st.data = '/auth/baseUser/queryListForPage';
1507
- this.st.req = {
1508
- allInBody: true,
1509
- method: 'POST',
1510
- type: 'page',
1511
- reName: {
1512
- pi: 'pageNum',
1513
- ps: 'pageSize'
1514
- },
1515
- body: {
1516
- pageParam: {
1517
- deptId: (_a = e.keys) === null || _a === void 0 ? void 0 : _a.pop()
1518
- }
1519
- }
1520
- };
1521
- // table数据预处理
1522
- this.st.res = {
1523
- process: data => {
1524
- this.onTableCheck(data);
1525
- return data;
1526
- }
1527
- };
1528
- // 加载第一页
1529
- this.st.load(1);
1530
- }
1531
- /**
1532
- * 角色树点击
1533
- *
1534
- * @param e 节点
1535
- */
1536
- onRoleClick(e) {
1537
- var _a;
1538
- // 构造分页请求,直接传入stTable组件,剩下的所有交给组件自己完成
1539
- this.st.data = '/auth/baseUser/queryListForPage';
1540
- this.st.req = {
1541
- allInBody: true,
1542
- method: 'POST',
1543
- type: 'page',
1544
- reName: {
1545
- pi: 'pageNum',
1546
- ps: 'pageSize'
1547
- },
1548
- body: {
1549
- pageParam: {
1550
- roleId: (_a = e.keys) === null || _a === void 0 ? void 0 : _a.pop()
1551
- }
1552
- }
1553
- };
1554
- // table数据预处理
1555
- this.st.res = {
1556
- process: data => {
1557
- this.onTableCheck(data);
1558
- return data;
1559
- }
1560
- };
1561
- // 加载第一页
1562
- this.st.load(1);
1563
- }
1564
- /**
1565
- * 好友分组点击
1566
- *
1567
- * @param e 分组
1568
- */
1569
- onFriendGroupClick(e) {
1570
- // 构造分页请求,直接传入stTable组件,剩下的所有交给组件自己完成
1571
- this.st.data = '/auth/baseUser/queryListForPage';
1572
- this.st.req = {
1573
- allInBody: true,
1574
- method: 'POST',
1575
- type: 'page',
1576
- reName: {
1577
- pi: 'pageNum',
1578
- ps: 'pageSize'
1579
- },
1580
- body: {
1581
- pageParam: {
1582
- friendGroupId: e.id
1583
- }
1584
- }
1585
- };
1586
- // table数据预处理
1587
- this.st.res = {
1588
- process: data => {
1589
- this.onTableCheck(data);
1590
- return data;
1591
- }
1592
- };
1593
- // 加载第一页
1594
- this.st.load(1);
1595
- }
1596
- /**
1597
- * 点击右侧联系人进行删除
1598
- *
1599
- * @param c 点击的联系人
1600
- */
1601
- onContactRemove(c) {
1602
- this.nzContacts = this.nzContacts.filter(contact => {
1603
- return contact.userId != c.userId;
1604
- });
1605
- this.st.reload();
1606
- }
1607
- /**
1608
- * 预处理table当前页数据,和nzContat对比,确定checkbox状态
1609
- *
1610
- * @param data 预处理数据
1611
- */
1612
- onTableCheck(data) {
1613
- const ids = this.nzContacts.map(u => u.userId);
1614
- data.forEach(d => {
1615
- if (ids.includes(d.userId)) {
1616
- d.checked = true;
1617
- }
1618
- else {
1619
- d.checked = false;
1620
- }
1621
- });
1622
- }
1623
- /**
1624
- * 递归树寻找name相同节点
1625
- *
1626
- * @param name 名称
1627
- * @param trees 需要递归的树
1628
- * @param list 搜索结果
1629
- */
1630
- searchTree(name, trees, list) {
1631
- if (trees && trees.length && trees.length > 0) {
1632
- trees.forEach((tree) => {
1633
- if (tree.title.indexOf(name) != -1) {
1634
- list.push(tree);
1635
- }
1636
- if (tree.children) {
1637
- this.searchTree(name, tree.children, list);
1638
- }
1639
- });
1640
- }
1641
- }
1642
- /**
1643
- * 递归树展开所有有子节点的节点
1644
- *
1645
- * @param trees 需要展开的树
1646
- */
1647
- expandTree(trees) {
1648
- if (trees && trees.length && trees.length > 0) {
1649
- trees.forEach(tree => {
1650
- if (!tree.children || tree.children.length === 0) {
1651
- tree.expanded = false;
1652
- tree.isLeaf = true;
1653
- }
1654
- if (tree.children) {
1655
- tree.expanded = this.nzExpandAll;
1656
- tree.isLeaf = false;
1657
- this.expandTree(tree.children);
1658
- }
1659
- });
1660
- }
1661
- }
1662
- /**
1663
- * 刷新当前页面
1664
- */
1665
- refresh() {
1666
- this.changeDetectorRef.detectChanges();
1667
- }
1668
- /**
1669
- * 确认按钮output数据
1670
- */
1671
- confirm() {
1672
- this.confirmed.next(this.nzContacts);
1673
- }
1674
- /**
1675
- * 销毁函数
1676
- */
1677
- ngOnDestroy() {
1678
- this.nzDepts = [];
1679
- this.nzRoles = [];
1680
- this.nzContacts = [];
1681
- this.subs.forEach(s => s.unsubscribe());
1682
- }
1683
- }
1684
- 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 });
1685
- 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"] }] });
1686
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: ContactComponent, decorators: [{
1687
- type: Component,
1688
- 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"] }]
1689
- }], ctorParameters: function () { return [{ type: ContactService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { nzTabsetSearch: [{
1690
- type: Optional
1691
- }, {
1692
- type: Input
1693
- }], nzTabsetLoading: [{
1694
- type: Optional
1695
- }, {
1696
- type: Input
1697
- }], nzExpandAll: [{
1698
- type: Optional
1699
- }, {
1700
- type: Input
1701
- }], nzDepts: [{
1702
- type: Optional
1703
- }, {
1704
- type: Input
1705
- }], nzDeptTreeVirtualHeight: [{
1706
- type: Optional
1707
- }, {
1708
- type: Input
1709
- }], nzDeptClass: [{
1710
- type: Optional
1711
- }, {
1712
- type: Input
1713
- }], nzDeptClassHistory: [{
1714
- type: Optional
1715
- }, {
1716
- type: Input
1717
- }], nzDeptGrade: [{
1718
- type: Optional
1719
- }, {
1720
- type: Input
1721
- }], nzDeptGradeID: [{
1722
- type: Optional
1723
- }, {
1724
- type: Input
1725
- }], nzRoles: [{
1726
- type: Optional
1727
- }, {
1728
- type: Input
1729
- }], nzRoleTreeVirtualHeight: [{
1730
- type: Optional
1731
- }, {
1732
- type: Input
1733
- }], nzFriendGroups: [{
1734
- type: Optional
1735
- }, {
1736
- type: Input
1737
- }], st: [{
1738
- type: ViewChild,
1739
- args: ['st', { static: false }]
1740
- }], defaultContacts: [{
1741
- type: Optional
1742
- }, {
1743
- type: Input
1744
- }], nzContacts: [{
1745
- type: Optional
1746
- }, {
1747
- type: Input
1748
- }], nzContactLoading: [{
1749
- type: Optional
1750
- }, {
1751
- type: Input
1752
- }], button: [{
1753
- type: Optional
1754
- }, {
1755
- type: Input
1756
- }], confirmed: [{
1757
- type: Output
1758
- }] } });
1759
-
1760
- const STOMP_DEFAULT_CONFIG = {
1761
- connectHeaders: {
1762
- login: 'guest',
1763
- passcode: 'guest'
1764
- },
1765
- brokerURL: '/websocket/ws/',
1766
- heartbeatIncoming: 1000 * 60,
1767
- heartbeatOutgoing: 1000 * 60,
1768
- reconnectDelay: 30000000,
1769
- debug: msg => {
1770
- log$1(msg);
1771
- }
1772
- };
1773
- function mergeStompConfig(srv) {
1774
- return srv.merge('stomp', STOMP_DEFAULT_CONFIG);
1775
- }
1776
-
1777
- class YzStompService {
1778
- constructor(csr, cache, injector, notification) {
1779
- this.csr = csr;
1780
- this.cache = cache;
1781
- this.injector = injector;
1782
- this.notification = notification;
1783
- this.config = null;
1784
- this.bisConfig = null;
1785
- this.rxStomp = null;
1786
- this.subs = [];
1787
- if (!this.user) {
1788
- this.user = this.cache.get('_yz_user', { mode: 'none' });
1789
- }
1790
- if (!this.config) {
1791
- this.config = mergeStompConfig(this.csr);
1792
- }
1793
- if (!this.bisConfig) {
1794
- this.bisConfig = mergeBisConfig(csr);
1795
- }
1796
- if (!this.rxStomp) {
1797
- this.rxStomp = new RxStomp();
1798
- if (isDevMode()) {
1799
- log$1('yz.stomp.service: is dev mode');
1800
- log$1('yz.stomp.service: ', `config is ${JSON.stringify(this.config)}`);
1801
- this.rxStomp.configure(this.config);
1802
- return;
1803
- }
1804
- const { location } = this.injector.get(DOCUMENT);
1805
- const { protocol, host } = location;
1806
- log$1('yz.stomp.service: ', `protocol is ${protocol},host is ${host}`);
1807
- if (protocol.includes('http') && !protocol.includes('https')) {
1808
- this.config.brokerURL = `ws://${host}${this.config.brokerURL}`;
1809
- }
1810
- if (protocol.includes('https')) {
1811
- this.config.brokerURL = `wss://${host}${this.config.brokerURL}`;
1812
- }
1813
- log$1('yz.stomp.service: ', `config is ${this.config}`);
1814
- this.rxStomp.configure(this.config);
1815
- }
1816
- }
1817
- listen() {
1818
- this.subs.push(this.rxStomp.watch(`/topic/layout_${this.user.username}`).subscribe(message => {
1819
- this.createNotification(JSON.parse(message.body));
1820
- }));
1821
- this.subs.push(this.rxStomp.watch(`/topic/layout_xx_${this.user.username}`).subscribe((message) => {
1822
- this.logoutNotification(JSON.parse(message.body));
1823
- }));
1824
- this.rxStomp.activate();
1825
- }
1826
- createNotification(message) {
1827
- this.notification.create(message.type, message.title, `<a href=${message.href}>${message.content}</a>`);
1828
- }
1829
- logoutNotification(message) {
1830
- this.notification.create(message.type, message.title, `${message.content},剩余时间5秒`);
1831
- setTimeout(() => {
1832
- this.cache.clear();
1833
- localStorage.clear();
1834
- this.injector.get(WINDOW).location.href = `${this.bisConfig.baseUrl}/cas-proxy/app/logout`;
1835
- }, 5000);
1836
- }
1837
- unListen() {
1838
- this.subs.forEach(s => s.unsubscribe());
1839
- this.rxStomp.deactivate().then();
1840
- }
1841
- publish(parameters) {
1842
- this.rxStomp.publish(parameters);
1843
- }
1844
- watch(destination, headers) {
1845
- return this.rxStomp.watch(destination, headers);
1846
- }
1847
- }
1848
- 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 });
1849
- YzStompService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzStompService, providedIn: 'root' });
1850
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzStompService, decorators: [{
1851
- type: Injectable,
1852
- args: [{ providedIn: 'root' }]
1853
- }], ctorParameters: function () { return [{ type: i1$3.YunzaiConfigService }, { type: i1$1.CacheService }, { type: i0.Injector }, { type: i3$2.NzNotificationService }]; } });
1854
-
1855
- class YzLayoutBasicComponent {
1856
- constructor(cacheService, yzStompService, layoutService, injector) {
1857
- this.cacheService = cacheService;
1858
- this.yzStompService = yzStompService;
1859
- this.layoutService = layoutService;
1860
- this.injector = injector;
1861
- this.options = {
1862
- logoExpanded: `./assets/logo-full.svg`,
1863
- logoCollapsed: `./assets/logo.svg`
1864
- };
1865
- this.intro = '';
1866
- this.text = '';
1867
- this.icon = '';
1868
- this.showReuseTab = true;
1869
- this.showHeader = true;
1870
- this.showSider = true;
1871
- this.headerType = 'application';
1872
- }
1873
- get reuseStyleSheet() {
1874
- let cascadingStyleSheet = {};
1875
- if (!this.showHeader) {
1876
- cascadingStyleSheet = Object.assign(Object.assign({}, cascadingStyleSheet), { top: 0 });
1877
- }
1878
- if (!this.showSider) {
1879
- cascadingStyleSheet = Object.assign(Object.assign({}, cascadingStyleSheet), { left: '24px' });
1880
- }
1881
- return cascadingStyleSheet;
1882
- }
1883
- ngOnInit() {
1884
- const current = this.cacheService.get('_yz_current', { mode: 'none' });
1885
- const project = this.cacheService.get('_yz_project_info', { mode: 'none' });
1886
- const headerType = this.cacheService.get('_yz_header_type', { mode: 'none' });
1887
- if (headerType)
1888
- this.headerType = headerType;
1889
- this.text = current.text ? current.text : '应用名称';
1890
- this.intro = current.intro ? current.intro : '应用描述';
1891
- this.icon = current.icon ? current.icon : `./assets/tmp/img/avatar.jpg`;
1892
- this.options.logoExpanded = project.maxLogoUrl ? project.maxLogoUrl : `./assets/logo-full.svg`;
1893
- this.options.logoCollapsed = project.miniLogoUrl ? project.miniLogoUrl : `./assets/logo.svg`;
1894
- this.yzStompService.listen();
1895
- this.layoutService.reuseTab.asObservable().subscribe(show => (this.showReuseTab = show));
1896
- this.layoutService.header.asObservable().subscribe(show => (this.showHeader = show));
1897
- this.layoutService.sidebar.asObservable().subscribe(show => (this.showSider = show));
1898
- }
1899
- onHeaderTypeChange(type) {
1900
- this.cacheService.set('_yz_header_type', type);
1901
- this.injector.get(WINDOW).location.reload();
1902
- }
1903
- ngOnDestroy() {
1904
- this.yzStompService.unListen();
1905
- }
1906
- }
1907
- 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 });
1908
- YzLayoutBasicComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.5", type: YzLayoutBasicComponent, selector: "yz-layout-basic", ngImport: i0, template: `
1909
- <layout-default [options]="options" [asideUser]="asideUserTpl" [content]="showReuseTab ? contentTpl : noneTpl">
1910
- <layout-default-header-item direction="left">
1911
- <ng-container [ngSwitch]="headerType">
1912
- <ng-container *ngSwitchCase="'application'">
1913
- <yz-header-application></yz-header-application>
1914
- </ng-container>
1915
-
1916
- <ng-container *ngSwitchCase="'group'">
1917
- <yz-header-application-group></yz-header-application-group>
1918
- </ng-container>
1919
-
1920
- <ng-container *ngSwitchDefault>
1921
- <yz-header-application></yz-header-application>
1922
- </ng-container>
1923
- </ng-container>
1924
- </layout-default-header-item>
1925
-
1926
- <layout-default-header-item direction="right" hidden="mobile">
1927
- <yz-header-notify></yz-header-notify>
1928
- </layout-default-header-item>
1929
-
1930
- <layout-default-header-item direction="right" hidden="mobile">
1931
- <yz-header-theme-btn></yz-header-theme-btn>
1932
- </layout-default-header-item>
1933
-
1934
- <layout-default-header-item direction="right" hidden="mobile">
1935
- <div
1936
- layout-default-header-item-trigger
1937
- nz-dropdown
1938
- [nzDropdownMenu]="settingsMenu"
1939
- nzTrigger="click"
1940
- nzPlacement="bottomRight"
1941
- >
1942
- <i nz-icon nzType="setting"></i>
1943
- </div>
1944
- <nz-dropdown-menu #settingsMenu="nzDropdownMenu">
1945
- <div nz-menu style="width: 200px;">
1946
- <div nz-menu-item>
1947
- {{ 'menu.application.mode' | i18n }}
1948
- </div>
1949
-
1950
- <div nz-menu-item (click)="onHeaderTypeChange('application')">
1951
- <i nz-icon nzType="appstore" class="mr-sm"></i>
1952
- {{ 'menu.application.application' | i18n }}
1953
- </div>
1954
-
1955
- <div nz-menu-item (click)="onHeaderTypeChange('group')">
1956
- <i nz-icon nzType="group" class="mr-sm"></i>
1957
- {{ 'menu.application.group' | i18n }}
1958
- </div>
1959
-
1960
- <div nz-menu-item>
1961
- <yz-header-fullscreen></yz-header-fullscreen>
1962
- </div>
1963
- <div nz-menu-item>
1964
- <yz-header-clear-storage></yz-header-clear-storage>
1965
- </div>
1966
- <div nz-menu-item>
1967
- <yz-header-i18n></yz-header-i18n>
1968
- </div>
1969
- </div>
1970
- </nz-dropdown-menu>
1971
- </layout-default-header-item>
1972
- <layout-default-header-item direction="right">
1973
- <yz-header-user></yz-header-user>
1974
- </layout-default-header-item>
1975
- <ng-template #asideUserTpl>
1976
- <div nz-dropdown nzTrigger="click" [nzDropdownMenu]="userMenu" class="yunzai-default__aside-user">
1977
- <nz-avatar class="yunzai-default__aside-user-avatar" [nzSrc]="icon"></nz-avatar>
1978
- <div class="yunzai-default__aside-user-info">
1979
- <strong>{{ text }}</strong>
1980
- <p class="mb0">{{ intro }}</p>
1981
- </div>
1982
- </div>
1983
- <nz-dropdown-menu #userMenu="nzDropdownMenu">
1984
- <ul nz-menu>
1985
- <li nz-menu-item routerLink="/">{{ 'menu.backtohome' | i18n }}</li>
1986
- </ul>
1987
- </nz-dropdown-menu>
1988
- </ng-template>
1989
- <ng-template #contentTpl>
1990
- <reuse-tab #reuseTab [ngStyle]="reuseStyleSheet"></reuse-tab>
1991
- <router-outlet (activate)="reuseTab.activate($event)" (attach)="reuseTab.activate($event)"></router-outlet>
1992
- </ng-template>
1993
- <ng-template #noneTpl>
1994
- <router-outlet></router-outlet>
1995
- </ng-template>
1996
- </layout-default>
1997
- `, 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" }] });
1998
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzLayoutBasicComponent, decorators: [{
1999
- type: Component,
2000
- args: [{
2001
- selector: 'yz-layout-basic',
2002
- template: `
2003
- <layout-default [options]="options" [asideUser]="asideUserTpl" [content]="showReuseTab ? contentTpl : noneTpl">
2004
- <layout-default-header-item direction="left">
2005
- <ng-container [ngSwitch]="headerType">
2006
- <ng-container *ngSwitchCase="'application'">
2007
- <yz-header-application></yz-header-application>
2008
- </ng-container>
2009
-
2010
- <ng-container *ngSwitchCase="'group'">
2011
- <yz-header-application-group></yz-header-application-group>
2012
- </ng-container>
2013
-
2014
- <ng-container *ngSwitchDefault>
2015
- <yz-header-application></yz-header-application>
2016
- </ng-container>
2017
- </ng-container>
2018
- </layout-default-header-item>
2019
-
2020
- <layout-default-header-item direction="right" hidden="mobile">
2021
- <yz-header-notify></yz-header-notify>
2022
- </layout-default-header-item>
2023
-
2024
- <layout-default-header-item direction="right" hidden="mobile">
2025
- <yz-header-theme-btn></yz-header-theme-btn>
2026
- </layout-default-header-item>
2027
-
2028
- <layout-default-header-item direction="right" hidden="mobile">
2029
- <div
2030
- layout-default-header-item-trigger
2031
- nz-dropdown
2032
- [nzDropdownMenu]="settingsMenu"
2033
- nzTrigger="click"
2034
- nzPlacement="bottomRight"
2035
- >
2036
- <i nz-icon nzType="setting"></i>
2037
- </div>
2038
- <nz-dropdown-menu #settingsMenu="nzDropdownMenu">
2039
- <div nz-menu style="width: 200px;">
2040
- <div nz-menu-item>
2041
- {{ 'menu.application.mode' | i18n }}
2042
- </div>
2043
-
2044
- <div nz-menu-item (click)="onHeaderTypeChange('application')">
2045
- <i nz-icon nzType="appstore" class="mr-sm"></i>
2046
- {{ 'menu.application.application' | i18n }}
2047
- </div>
2048
-
2049
- <div nz-menu-item (click)="onHeaderTypeChange('group')">
2050
- <i nz-icon nzType="group" class="mr-sm"></i>
2051
- {{ 'menu.application.group' | i18n }}
2052
- </div>
2053
-
2054
- <div nz-menu-item>
2055
- <yz-header-fullscreen></yz-header-fullscreen>
2056
- </div>
2057
- <div nz-menu-item>
2058
- <yz-header-clear-storage></yz-header-clear-storage>
2059
- </div>
2060
- <div nz-menu-item>
2061
- <yz-header-i18n></yz-header-i18n>
2062
- </div>
2063
- </div>
2064
- </nz-dropdown-menu>
2065
- </layout-default-header-item>
2066
- <layout-default-header-item direction="right">
2067
- <yz-header-user></yz-header-user>
2068
- </layout-default-header-item>
2069
- <ng-template #asideUserTpl>
2070
- <div nz-dropdown nzTrigger="click" [nzDropdownMenu]="userMenu" class="yunzai-default__aside-user">
2071
- <nz-avatar class="yunzai-default__aside-user-avatar" [nzSrc]="icon"></nz-avatar>
2072
- <div class="yunzai-default__aside-user-info">
2073
- <strong>{{ text }}</strong>
2074
- <p class="mb0">{{ intro }}</p>
2075
- </div>
2076
- </div>
2077
- <nz-dropdown-menu #userMenu="nzDropdownMenu">
2078
- <ul nz-menu>
2079
- <li nz-menu-item routerLink="/">{{ 'menu.backtohome' | i18n }}</li>
2080
- </ul>
2081
- </nz-dropdown-menu>
2082
- </ng-template>
2083
- <ng-template #contentTpl>
2084
- <reuse-tab #reuseTab [ngStyle]="reuseStyleSheet"></reuse-tab>
2085
- <router-outlet (activate)="reuseTab.activate($event)" (attach)="reuseTab.activate($event)"></router-outlet>
2086
- </ng-template>
2087
- <ng-template #noneTpl>
2088
- <router-outlet></router-outlet>
2089
- </ng-template>
2090
- </layout-default>
2091
- `
2092
- }]
2093
- }], ctorParameters: function () { return [{ type: i1$1.CacheService }, { type: YzStompService }, { type: i3$3.LayoutService }, { type: i0.Injector }]; } });
2094
-
2095
- /*
2096
- * @Author: cui <devcui@outlook.com>
2097
- * @Editor: microsoft vscode
2098
- * @Date: 2021-11-27 11:30:50
2099
- * @LastEditTime: 2021-11-27 14:38:46
2100
- * @LastEditors: cui <devcui@outlook.com>
2101
- * @Description: empty description
2102
- * @FilePath: \yelon\packages\bis\layout\layout.module.ts
2103
- * LICENSE HERE
2104
- */
2105
- const COMPONENTS = [
2106
- ContactComponent,
2107
- YzLayoutBasicComponent,
2108
- YzHeaderApplicationComponent,
2109
- YzHeaderNotifyComponent,
2110
- YzHeaderThemBtnComponent,
2111
- YzHeaderUserComponent,
2112
- YzHeaderFullScreenComponent,
2113
- YzHeaderClearStorageComponent,
2114
- YzHeaderI18NComponent,
2115
- YzHeaderApplicationGroupComponent
2116
- ];
2117
- class YunzaiLayoutModule {
2118
- }
2119
- YunzaiLayoutModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YunzaiLayoutModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2120
- YunzaiLayoutModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.5", ngImport: i0, type: YunzaiLayoutModule, declarations: [ContactComponent,
2121
- YzLayoutBasicComponent,
2122
- YzHeaderApplicationComponent,
2123
- YzHeaderNotifyComponent,
2124
- YzHeaderThemBtnComponent,
2125
- YzHeaderUserComponent,
2126
- YzHeaderFullScreenComponent,
2127
- YzHeaderClearStorageComponent,
2128
- YzHeaderI18NComponent,
2129
- YzHeaderApplicationGroupComponent], imports: [HttpClientModule, CommonModule, FormsModule, RouterModule, ReactiveFormsModule, YzSharedModule], exports: [ContactComponent,
2130
- YzLayoutBasicComponent,
2131
- YzHeaderApplicationComponent,
2132
- YzHeaderNotifyComponent,
2133
- YzHeaderThemBtnComponent,
2134
- YzHeaderUserComponent,
2135
- YzHeaderFullScreenComponent,
2136
- YzHeaderClearStorageComponent,
2137
- YzHeaderI18NComponent,
2138
- YzHeaderApplicationGroupComponent] });
2139
- YunzaiLayoutModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YunzaiLayoutModule, providers: [
2140
- {
2141
- provide: YUNZAI_THEME_BTN_KEYS,
2142
- useValue: 'site-theme'
2143
- }
2144
- ], imports: [HttpClientModule, CommonModule, FormsModule, RouterModule, ReactiveFormsModule, YzSharedModule] });
2145
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YunzaiLayoutModule, decorators: [{
2146
- type: NgModule,
2147
- args: [{
2148
- imports: [HttpClientModule, CommonModule, FormsModule, RouterModule, ReactiveFormsModule, YzSharedModule],
2149
- providers: [
2150
- {
2151
- provide: YUNZAI_THEME_BTN_KEYS,
2152
- useValue: 'site-theme'
2153
- }
2154
- ],
2155
- declarations: [...COMPONENTS],
2156
- exports: [...COMPONENTS]
2157
- }]
2158
- }] });
2159
-
2160
- class YzAuthService {
2161
- constructor(injector) {
2162
- this.injector = injector;
2163
- this.option = mergeConfig(this.csr);
2164
- this.bis = mergeBisConfig(this.csr);
2165
- }
2166
- get csr() {
2167
- return this.injector.get(YunzaiConfigService);
2168
- }
2169
- get tokenService() {
2170
- return this.injector.get(YA_SERVICE_TOKEN);
2171
- }
2172
- get httpClient() {
2173
- return this.injector.get(_HttpClient);
2174
- }
2175
- get cacheService() {
2176
- return this.injector.get(CacheService);
2177
- }
2178
- askToken() {
2179
- var _a;
2180
- log('yz.auth.service: ', 'askToken');
2181
- if ((_a = this.tokenService.get()) === null || _a === void 0 ? void 0 : _a.token) {
2182
- return of(this.tokenService.get());
2183
- }
2184
- else {
2185
- if (this.bis.loginForm) {
2186
- return this.fetchTokenByUP();
2187
- }
2188
- else {
2189
- return this.fetchTokenByCas();
2190
- }
2191
- }
2192
- }
2193
- fetchTokenByUP() {
2194
- log('yz.auth.service: ', 'fetchTokenByUP');
2195
- return this.httpClient.post(`/auth/oauth/token?_allow_anonymous=true`, this.bis.loginForm).pipe(map((response) => {
2196
- const { access_token, expires_in, refresh_token, scope, token_type } = response;
2197
- return {
2198
- token: access_token,
2199
- expired: expires_in,
2200
- refreshToken: refresh_token,
2201
- tokenType: token_type,
2202
- scope
2203
- };
2204
- }));
2205
- }
2206
- fetchTokenByCas() {
2207
- log('yz.auth.service: ', 'fetchTokenByCas');
2208
- const uri = encodeURIComponent(this.injector.get(WINDOW).location.href);
2209
- return this.httpClient
2210
- .get(`/cas-proxy/app/validate_full?callback=${uri}&_allow_anonymous=true&timestamp=${new Date().getTime()}`)
2211
- .pipe(map((response) => {
2212
- switch (response.errcode) {
2213
- case 2000:
2214
- const { access_token, expires_in, refresh_token, scope, token_type } = response.data;
2215
- return {
2216
- token: access_token,
2217
- expired: expires_in,
2218
- refreshToken: refresh_token,
2219
- tokenType: token_type,
2220
- scope
2221
- };
2222
- case 2001:
2223
- this.injector.get(WINDOW).location.href = response.msg;
2224
- throw Error("Cookie Error: Can't find Cas Cookie,So jump to login!");
2225
- default:
2226
- if (response.data) {
2227
- console.error(response.data);
2228
- throw Error(response.data);
2229
- }
2230
- else if (response.msg) {
2231
- console.error(response.msg);
2232
- throw Error(response.msg);
2233
- }
2234
- else {
2235
- console.error('cas unknown error');
2236
- throw Error('Unknown Error: Cas auth exception!');
2237
- }
2238
- }
2239
- }));
2240
- }
2241
- login() {
2242
- log('yz.auth.service: ', 'login white login form->', this.bis.loginForm);
2243
- return this.askToken().pipe(mergeMap(token => {
2244
- log('yz.auth.service: get token->', token);
2245
- this.csr.set('auth', {
2246
- token_send_key: 'Authorization',
2247
- token_send_template: `${token.tokenType} \${token}`,
2248
- token_send_place: 'header'
2249
- });
2250
- log('yz.auth.service: ', 'set token');
2251
- this.tokenService.set(token);
2252
- return this.cacheInit();
2253
- }), mergeAll());
2254
- }
2255
- cacheInit() {
2256
- log('yz.auth.service: ', 'cacheInit');
2257
- const user = this.cacheService.get('_yz_user', { mode: 'none' });
2258
- const header = this.cacheService.get('_yz_header', { mode: 'none' });
2259
- const project = this.cacheService.get('_yz_project_info', { mode: 'none' });
2260
- return forkJoin(of(user), of(header), of(project)).pipe(mergeMap(([u, h, p]) => {
2261
- let list = [];
2262
- // user cache
2263
- if (!u) {
2264
- log('yz.auth.service: ', 'fetch user cache');
2265
- list.push(this.httpClient.get(`/auth/user`).pipe(map((user) => {
2266
- this.cacheService.set('_yz_user', user.principal);
2267
- })));
2268
- }
2269
- else {
2270
- log('yz.auth.service: ', 'user recache');
2271
- list.push(of(() => { }));
2272
- }
2273
- // header cache
2274
- if (!h) {
2275
- log('yz.auth.service: ', 'fetch header cache');
2276
- list.push(this.httpClient.get(`/auth/allheader/v2`).pipe(map((header) => {
2277
- this.cacheService.set('_yz_header', header.data);
2278
- })));
2279
- }
2280
- else {
2281
- log('yz.auth.service: ', 'header recache');
2282
- list.push(of(() => { }));
2283
- }
2284
- // project cache
2285
- if (!p) {
2286
- log('yz.auth.service: ', 'fetch project cache');
2287
- list.push(this.httpClient.get(`/app-manager/project/info`).pipe(map((info) => {
2288
- this.cacheService.set('_yz_project_info', info.data);
2289
- })));
2290
- }
2291
- else {
2292
- log('yz.auth.service: ', 'project recache');
2293
- list.push(of(() => { }));
2294
- }
2295
- return forkJoin(list);
2296
- }));
2297
- }
2298
- }
2299
- YzAuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzAuthService, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
2300
- YzAuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzAuthService, providedIn: 'root' });
2301
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzAuthService, decorators: [{
2302
- type: Injectable,
2303
- args: [{ providedIn: 'root' }]
2304
- }], ctorParameters: function () { return [{ type: i0.Injector }]; } });
2305
-
2306
- const CODEMESSAGE = {
2307
- 200: '服务器成功返回请求的数据。',
2308
- 201: '新建或修改数据成功。',
2309
- 202: '一个请求已经进入后台排队(异步任务)。',
2310
- 204: '删除数据成功。',
2311
- 400: '发出的请求有错误,服务器没有进行新建或修改数据的操作。',
2312
- 401: '用户没有权限(令牌、用户名、密码错误)。',
2313
- 403: '用户得到授权,但是访问是被禁止的。',
2314
- 404: '发出的请求针对的是不存在的记录,服务器没有进行操作。',
2315
- 406: '请求的格式不可得。',
2316
- 410: '请求的资源被永久删除,且不会再得到的。',
2317
- 422: '当创建一个对象时,发生一个验证错误。',
2318
- 500: '服务器发生错误,请检查服务器。',
2319
- 502: '网关错误。',
2320
- 503: '服务不可用,服务器暂时过载或维护。',
2321
- 504: '网关超时。'
2322
- };
2323
- /**
2324
- * 默认HTTP拦截器,其注册细节见 `app.module.ts`
2325
- */
2326
- class YzDefaultInterceptor {
2327
- constructor(injector) {
2328
- this.injector = injector;
2329
- this.jump = false;
2330
- this.refreshToking = false;
2331
- this.refreshToken$ = new BehaviorSubject(null);
2332
- if (this.config.refreshTokenType === 'auth-refresh') {
2333
- console.error("can't use auth-refresh, please change yz.default.interceptor to default.interceptor!");
2334
- }
2335
- }
2336
- get notification() {
2337
- return this.injector.get(NzNotificationService);
2338
- }
2339
- get tokenSrv() {
2340
- return this.injector.get(YA_SERVICE_TOKEN);
2341
- }
2342
- get http() {
2343
- return this.injector.get(_HttpClient);
2344
- }
2345
- get config() {
2346
- return mergeBisConfig(this.injector.get(YunzaiConfigService));
2347
- }
2348
- goTo(url) {
2349
- setTimeout(() => this.injector.get(Router).navigateByUrl(url));
2350
- }
2351
- checkStatus(ev) {
2352
- if ((ev.status >= 200 && ev.status < 300) || ev.status === 401) {
2353
- return;
2354
- }
2355
- if (ev instanceof HttpErrorResponse && (ev.error.message || ev.error.errorMessage)) {
2356
- if (ev.error.errorMessage) {
2357
- this.notification.error(`发生了一些错误 `, ev.error.errorMessage);
2358
- }
2359
- else {
2360
- this.notification.error(`发生了一些错误 `, ev.error.message);
2361
- }
2362
- return;
2363
- }
2364
- if (ev instanceof HttpResponse && ev.body.errorMessage) {
2365
- this.notification.error(`发生了一些错误 `, ev.body.errorMessage);
2366
- return;
2367
- }
2368
- const errortext = CODEMESSAGE[ev.status] || ev.statusText;
2369
- this.notification.error(`请求错误 ${ev.status}: ${ev.url}`, errortext);
2370
- }
2371
- ToLogin() {
2372
- this.notification.error(`未登录或登录状态已过期,5秒后将跳转到登录页面。`, ``);
2373
- setTimeout(() => {
2374
- localStorage.clear();
2375
- this.injector.get(WINDOW).location.href = `${this.config.baseUrl}/cas-proxy/app/logout`;
2376
- }, 5000);
2377
- }
2378
- reAttachToken(req) {
2379
- var _a;
2380
- const token = (_a = this.tokenSrv.get()) === null || _a === void 0 ? void 0 : _a.token;
2381
- return req.clone({
2382
- setHeaders: {
2383
- Authorization: `Bearer ${token}`
2384
- }
2385
- });
2386
- }
2387
- refreshTokenRequest() {
2388
- const model = this.tokenSrv.get();
2389
- const form = new FormData();
2390
- form.set('refresh_token', model === null || model === void 0 ? void 0 : model.refreshToken);
2391
- form.set('grant_type', 'refresh_token');
2392
- form.set('scope', 'webapp');
2393
- log('yz.default.interceptor: use the refresh token to request a new token', model === null || model === void 0 ? void 0 : model.refreshToken);
2394
- // return this.http.post(`/auth/user/token/refresh?_allow_anonymous=true`, form);
2395
- return this.http.post(`/auth/oauth/getOrCreateToken/webapp`, form);
2396
- }
2397
- tryRefreshToken(ev, req, next) {
2398
- // 连刷新Token的请求都错了,那就是真错了
2399
- if (['/auth/oauth/getOrCreateToken/webapp'].some(url => req.url.includes(url))) {
2400
- this.ToLogin();
2401
- return throwError(() => ev);
2402
- }
2403
- // 正在刷新token,所有其他请求排队
2404
- if (this.refreshToking) {
2405
- return this.refreshToken$.pipe(filter(v => !!v), take(1), switchMap(() => next.handle(this.reAttachToken(req))));
2406
- }
2407
- //尝试调用刷新 Token
2408
- this.refreshToking = true;
2409
- this.refreshToken$.next(null);
2410
- // 处理Token
2411
- return this.refreshTokenRequest().pipe(switchMap(res => {
2412
- log('yz.default.interceptor: refresh token accessed -> ', res);
2413
- // 重新保存新 token
2414
- const { access_token, expires_in, refresh_token, scope, token_type } = res;
2415
- this.tokenSrv.set({
2416
- token: access_token,
2417
- expired: expires_in,
2418
- refreshToken: refresh_token,
2419
- tokenType: token_type,
2420
- scope
2421
- });
2422
- // 通知后续请求继续执行
2423
- this.refreshToking = false;
2424
- this.refreshToken$.next(res);
2425
- // 重新发起请求
2426
- return next.handle(this.reAttachToken(req));
2427
- }), catchError(err => {
2428
- this.refreshToking = false;
2429
- this.ToLogin();
2430
- return throwError(() => err);
2431
- }));
2432
- }
2433
- getAdditionalHeaders(headers) {
2434
- const res = {};
2435
- const lang = this.injector.get(YUNZAI_I18N_TOKEN).currentLang;
2436
- if (!(headers === null || headers === void 0 ? void 0 : headers.has('Accept-Language')) && lang) {
2437
- res['Accept-Language'] = lang;
2438
- }
2439
- return res;
2440
- }
2441
- handleData(ev, req, next) {
2442
- this.checkStatus(ev);
2443
- switch (ev.status) {
2444
- case 200:
2445
- return of(ev);
2446
- case 401:
2447
- if (this.config.refreshTokenEnabled && this.config.refreshTokenType === 're-request') {
2448
- return this.tryRefreshToken(ev, req, next);
2449
- }
2450
- this.ToLogin();
2451
- break;
2452
- case 403:
2453
- case 404:
2454
- case 500:
2455
- if (this.jump) {
2456
- this.goTo(`/exception/${ev.status}`);
2457
- }
2458
- break;
2459
- default:
2460
- if (ev instanceof HttpErrorResponse) {
2461
- console.warn('未可知错误,大部分是由于后端不支持跨域CORS或无效配置引起,请参考 https://ng.yunzainfo.com/docs/server 解决跨域问题', ev);
2462
- }
2463
- break;
2464
- }
2465
- if (ev instanceof HttpErrorResponse) {
2466
- return throwError(() => ev);
2467
- }
2468
- else {
2469
- return of(ev);
2470
- }
2471
- }
2472
- intercept(req, next) {
2473
- if (req.context.get(ALLOW_ANONYMOUS))
2474
- return next.handle(req);
2475
- log('yz.default.interceptor.ts: ', 'request ', req);
2476
- // 统一加前缀
2477
- let url = req.url;
2478
- if (!url.startsWith('https://') && !url.startsWith('http://')) {
2479
- url = this.config.baseUrl + url;
2480
- }
2481
- if (url.includes('.json') && url.includes('assets')) {
2482
- url = req.url;
2483
- }
2484
- // 加入语言头
2485
- const newReq = req.clone({ url, setHeaders: this.getAdditionalHeaders(req.headers) });
2486
- return next.handle(newReq).pipe(mergeMap(ev => {
2487
- // 允许统一对请求错误处理
2488
- if (ev instanceof HttpResponseBase) {
2489
- return this.handleData(ev, newReq, next);
2490
- }
2491
- // 若一切都正常,则后续操作
2492
- return of(ev);
2493
- }), catchError((err) => this.handleData(err, newReq, next)));
2494
- }
2495
- }
2496
- YzDefaultInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzDefaultInterceptor, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
2497
- YzDefaultInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzDefaultInterceptor });
2498
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzDefaultInterceptor, decorators: [{
2499
- type: Injectable
2500
- }], ctorParameters: function () { return [{ type: i0.Injector }]; } });
2501
-
2502
- function mapYzSideToYelonMenu(menus) {
2503
- menus.forEach(menu => {
2504
- menu.badgeDot = menu.badge_dot || null;
2505
- menu.badgeStatus = menu.badge_status || null;
2506
- menu.shortcutRoot = menu.shortcut_root || null;
2507
- menu.reuse = true;
2508
- if (menu.children) {
2509
- mapYzSideToYelonMenu(menu.children);
2510
- }
2511
- });
2512
- }
2513
- function generateAbility(menus, abilities, prefix) {
2514
- menus.forEach(menu => {
2515
- if (menu.link) {
2516
- prefix += menu.link;
2517
- }
2518
- else {
2519
- prefix += '';
2520
- }
2521
- if (menu.menuAuths) {
2522
- menu.menuAuths.forEach((a) => {
2523
- abilities.push(`${prefix}:${a}`);
2524
- abilities.push(a);
2525
- });
2526
- }
2527
- if (menu.children) {
2528
- generateAbility(menu.children, abilities, prefix);
2529
- }
2530
- });
2531
- }
2532
- class YzStartupService {
2533
- constructor(iconSrv, menuService, i18n, win, settingService, aclService, titleService, yzAuthService, cacheService, configService) {
2534
- this.menuService = menuService;
2535
- this.i18n = i18n;
2536
- this.win = win;
2537
- this.settingService = settingService;
2538
- this.aclService = aclService;
2539
- this.titleService = titleService;
2540
- this.yzAuthService = yzAuthService;
2541
- this.cacheService = cacheService;
2542
- this.configService = configService;
2543
- this.bis = BUSINESS_DEFAULT_CONFIG;
2544
- this.bis = mergeBisConfig(this.configService);
2545
- iconSrv.addIcon(...ICONS);
2546
- }
2547
- load() {
2548
- log$1('startup.service: ', 'load');
2549
- const defaultLang = this.i18n.defaultLang;
2550
- return this.i18n.loadLangData(defaultLang).pipe(mergeMap(langData => {
2551
- log$1('startup.service: ', 'set i18n, defaultLang->', defaultLang, ' langData->', langData);
2552
- this.i18n.use(defaultLang, langData);
2553
- return of(null);
2554
- }), mergeMap(() => {
2555
- return this.yzAuthService.login();
2556
- }), mergeMap(v => {
2557
- // preloader finish
2558
- this.systemInit();
2559
- log$1('startup.service: preloader finish');
2560
- if (this.win && this.win.appBootstrap) {
2561
- this.win.appBootstrap();
2562
- }
2563
- return of(v);
2564
- }));
2565
- }
2566
- systemInit() {
2567
- log$1('startup.service: system init');
2568
- // user
2569
- const user = this.cacheService.get('_yz_user', { mode: 'none' });
2570
- // menu
2571
- const ms = deepCopy(user.menu).filter((m) => m.systemCode && m.systemCode === this.bis.systemCode);
2572
- mapYzSideToYelonMenu(ms);
2573
- const currentMenu = ms.pop() || [];
2574
- this.menuService.add([currentMenu]);
2575
- // logo app
2576
- this.settingService.setApp({ name: currentMenu.text, description: currentMenu.intro });
2577
- this.settingService.setUser({
2578
- name: user.realname || 'no name',
2579
- avatar: `${this.bis.baseUrl}/filecenter/file/${user.avatarId}` || '',
2580
- email: user.email || 'no email'
2581
- });
2582
- // title
2583
- this.titleService.default = currentMenu && currentMenu.text ? currentMenu.text : 'default application name';
2584
- this.titleService.setTitle(currentMenu && currentMenu.text ? currentMenu.text : 'no title');
2585
- // acl
2586
- const abilities = [];
2587
- generateAbility([currentMenu], abilities, '');
2588
- this.aclService.attachRole((user === null || user === void 0 ? void 0 : user.roles.map((role) => {
2589
- return role.roleValue;
2590
- }).filter((a) => !!a)) || []);
2591
- this.aclService.attachAbility(abilities);
2592
- // cache current
2593
- this.cacheService.set('_yz_current', {
2594
- text: currentMenu.text,
2595
- intro: currentMenu.intro,
2596
- icon: currentMenu.appIconUrl
2597
- });
2598
- }
2599
- }
2600
- 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 });
2601
- YzStartupService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzStartupService });
2602
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: YzStartupService, decorators: [{
2603
- type: Injectable
2604
- }], ctorParameters: function () {
2605
- return [{ type: i8.NzIconService }, { type: i1.MenuService }, { type: YzI18NService, decorators: [{
2606
- type: Inject,
2607
- args: [YUNZAI_I18N_TOKEN]
2608
- }] }, { type: undefined, decorators: [{
2609
- type: Inject,
2610
- args: [WINDOW]
2611
- }] }, { type: i1.SettingsService }, { type: i3$4.ACLService }, { type: i1.TitleService }, { type: YzAuthService }, { type: i1$1.CacheService }, { type: i1$3.YunzaiConfigService }];
2612
- } });
2613
- function YzStartupServiceFactory(startupService) {
2614
- return () => startupService.load();
2615
- }
2616
- //@ts-ignore
2617
- const YZ_APPINIT_PROVIDES = [
2618
- YzStartupService,
2619
- {
2620
- provide: APP_INITIALIZER,
2621
- useFactory: YzStartupServiceFactory,
2622
- deps: [YzStartupService],
2623
- multi: true
2624
- }
2625
- ];
2626
-
2627
- class PathToRegexpService {
2628
- constructor() {
2629
- this.DEFAULT_DELIMITER = '/';
2630
- this.PATH_REGEXP = new RegExp(['(\\\\.)', '(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?'].join('|'), 'g');
2631
- }
2632
- parse(str, options) {
2633
- const tokens = [];
2634
- let key = 0;
2635
- let index = 0;
2636
- let path = '';
2637
- const defaultDelimiter = (options && options.delimiter) || this.DEFAULT_DELIMITER;
2638
- const whitelist = (options && options.whitelist) || undefined;
2639
- let pathEscaped = false;
2640
- let res;
2641
- while ((res = this.PATH_REGEXP.exec(str)) !== null) {
2642
- const m = res[0];
2643
- const escaped = res[1];
2644
- const offset = res.index;
2645
- path += str.slice(index, offset);
2646
- index = offset + m.length;
2647
- // Ignore already escaped sequences.
2648
- if (escaped) {
2649
- path += escaped[1];
2650
- pathEscaped = true;
2651
- continue;
2652
- }
2653
- let prev = '';
2654
- const name = res[2];
2655
- const capture = res[3];
2656
- const group = res[4];
2657
- const modifier = res[5];
2658
- if (!pathEscaped && path.length) {
2659
- const k = path.length - 1;
2660
- const c = path[k];
2661
- const matches = whitelist ? whitelist.indexOf(c) > -1 : true;
2662
- if (matches) {
2663
- prev = c;
2664
- path = path.slice(0, k);
2665
- }
2666
- }
2667
- // Push the current path onto the tokens.
2668
- if (path) {
2669
- tokens.push(path);
2670
- path = '';
2671
- pathEscaped = false;
2672
- }
2673
- const repeat = modifier === '+' || modifier === '*';
2674
- const optional = modifier === '?' || modifier === '*';
2675
- const pattern = capture || group;
2676
- const delimiter = prev || defaultDelimiter;
2677
- tokens.push({
2678
- name: name || key++,
2679
- prefix: prev,
2680
- delimiter: delimiter,
2681
- optional: optional,
2682
- repeat: repeat,
2683
- pattern: pattern
2684
- ? this.escapeGroup(pattern)
2685
- : `[^${this.escapeString(delimiter === defaultDelimiter ? delimiter : delimiter + defaultDelimiter)}]+?`
2686
- });
2687
- }
2688
- // Push any remaining characters.
2689
- if (path || index < str.length) {
2690
- tokens.push(path + str.substr(index));
2691
- }
2692
- return tokens;
2693
- }
2694
- compile(str, options) {
2695
- return this.tokensToFunction(this.parse(str, options), options);
2696
- }
2697
- tokensToFunction(tokens, options) {
2698
- const matches = new Array(tokens.length);
2699
- for (let i = 0; i < tokens.length; i++) {
2700
- if (typeof tokens[i] === 'object') {
2701
- matches[i] = new RegExp(`^(?:${tokens[i].pattern})$`, this.flags(options));
2702
- }
2703
- }
2704
- return function (data, options) {
2705
- let path = '';
2706
- const encode = (options && options.encode) || encodeURIComponent;
2707
- const validate = options ? options.validate !== false : true;
2708
- for (let i = 0; i < tokens.length; i++) {
2709
- const token = tokens[i];
2710
- if (typeof token === 'string') {
2711
- path += token;
2712
- continue;
2713
- }
2714
- const value = data ? data[token.name] : undefined;
2715
- let segment;
2716
- if (Array.isArray(value)) {
2717
- if (!token.repeat) {
2718
- throw new TypeError(`Expected "${token.name}" to not repeat, but got array`);
2719
- }
2720
- if (value.length === 0) {
2721
- if (token.optional) {
2722
- continue;
2723
- }
2724
- throw new TypeError(`Expected "${token.name}" to not be empty`);
2725
- }
2726
- for (let j = 0; j < value.length; j++) {
2727
- segment = encode(value[j], token);
2728
- if (validate && !matches[i].test(segment)) {
2729
- throw new TypeError(`Expected all "${token.name}" to match "${token.pattern}"`);
2730
- }
2731
- path += (j === 0 ? token.prefix : token.delimiter) + segment;
2732
- }
2733
- continue;
2734
- }
2735
- if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
2736
- segment = encode(String(value), token);
2737
- if (validate && !matches[i].test(segment)) {
2738
- throw new TypeError(`Expected "${token.name}" to match "${token.pattern}", but got "${segment}"`);
2739
- }
2740
- path += token.prefix + segment;
2741
- continue;
2742
- }
2743
- if (token.optional) {
2744
- continue;
2745
- }
2746
- throw new TypeError(`Expected "${token.name}" to be ${token.repeat ? 'an array' : 'a string'}`);
2747
- }
2748
- return path;
2749
- };
2750
- }
2751
- escapeString(str) {
2752
- return str.replace(/([.+*?=^!:${}()[\]|/\\])/g, '\\$1');
2753
- }
2754
- escapeGroup(group) {
2755
- return group.replace(/([=!:$/()])/g, '\\$1');
2756
- }
2757
- flags(options) {
2758
- return options && options.sensitive ? '' : 'i';
2759
- }
2760
- regexpToRegexp(path, keys) {
2761
- if (!keys) {
2762
- return path;
2763
- }
2764
- const groups = path.source.match(/\((?!\?)/g);
2765
- if (groups) {
2766
- for (let i = 0; i < groups.length; i++) {
2767
- keys.push({
2768
- name: i,
2769
- prefix: null,
2770
- delimiter: null,
2771
- optional: false,
2772
- repeat: false,
2773
- pattern: null
2774
- });
2775
- }
2776
- }
2777
- return path;
2778
- }
2779
- arrayToRegexp(path, keys, options) {
2780
- const parts = [];
2781
- for (let i = 0; i < path.length; i++) {
2782
- parts.push(this.pathToRegexp(path[i], keys, options).source);
2783
- }
2784
- return new RegExp(`(?:${parts.join('|')})`, this.flags(options));
2785
- }
2786
- stringToRegexp(path, keys, options) {
2787
- return this.tokensToRegExp(this.parse(path, options), keys, options);
2788
- }
2789
- tokensToRegExp(tokens, keys, options) {
2790
- options = options || {};
2791
- const strict = options.strict;
2792
- const start = options.start !== false;
2793
- const end = options.end !== false;
2794
- const delimiter = options.delimiter || this.DEFAULT_DELIMITER;
2795
- const endsWith = []
2796
- .concat(options.endsWith || [])
2797
- .map(this.escapeString)
2798
- .concat('$')
2799
- .join('|');
2800
- let route = start ? '^' : '';
2801
- for (let i = 0; i < tokens.length; i++) {
2802
- const token = tokens[i];
2803
- if (typeof token === 'string') {
2804
- route += this.escapeString(token);
2805
- }
2806
- else {
2807
- const capture = token.repeat
2808
- ? `(?:${token.pattern})(?:${this.escapeString(token.delimiter)}(?:${token.pattern}))*`
2809
- : token.pattern;
2810
- if (keys) {
2811
- keys.push(token);
2812
- }
2813
- if (token.optional) {
2814
- if (!token.prefix) {
2815
- route += `(${capture})?`;
2816
- }
2817
- else {
2818
- route += `(?:${this.escapeString(token.prefix)}(${capture}))?`;
2819
- }
2820
- }
2821
- else {
2822
- route += `${this.escapeString(token.prefix)}(${capture})`;
2823
- }
2824
- }
2825
- }
2826
- if (end) {
2827
- if (!strict) {
2828
- route += `(?:${this.escapeString(delimiter)})?`;
2829
- }
2830
- route += endsWith === '$' ? '$' : `(?=${endsWith})`;
2831
- }
2832
- else {
2833
- const endToken = tokens[tokens.length - 1];
2834
- const isEndDelimited = typeof endToken === 'string' ? endToken[endToken.length - 1] === delimiter : endToken === undefined;
2835
- if (!strict) {
2836
- route += `(?:${this.escapeString(delimiter)}(?=${endsWith}))?`;
2837
- }
2838
- if (!isEndDelimited) {
2839
- route += `(?=${this.escapeString(delimiter)}|${endsWith})`;
2840
- }
2841
- }
2842
- return new RegExp(route, this.flags(options));
2843
- }
2844
- pathToRegexp(path, keys, options) {
2845
- if (path instanceof RegExp) {
2846
- return this.regexpToRegexp(path, keys);
2847
- }
2848
- if (Array.isArray(path)) {
2849
- return this.arrayToRegexp(/** @type {!Array} */ path, keys, options);
2850
- }
2851
- return this.stringToRegexp(/** @type {string} */ path, keys, options);
2852
- }
2853
- }
2854
- PathToRegexpService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: PathToRegexpService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2855
- PathToRegexpService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: PathToRegexpService, providedIn: 'root' });
2856
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: PathToRegexpService, decorators: [{
2857
- type: Injectable,
2858
- args: [{
2859
- providedIn: 'root'
2860
- }]
2861
- }], ctorParameters: function () { return []; } });
2862
-
2863
- class ActGuard {
2864
- constructor(configService, cacheService, pathToRegexp, router) {
2865
- this.configService = configService;
2866
- this.cacheService = cacheService;
2867
- this.pathToRegexp = pathToRegexp;
2868
- this.router = router;
2869
- this.bis = BUSINESS_DEFAULT_CONFIG;
2870
- this.menus = [];
2871
- this.links = [];
2872
- log$1('act: ');
2873
- this.bis = mergeBisConfig(this.configService);
2874
- log$1('act: config ', this.bis);
2875
- const user = this.cacheService.get('_yz_user', { mode: 'none' });
2876
- log$1('act: user ', user);
2877
- this.menus = deepCopy(user.menu).filter((m) => m.systemCode && m.systemCode === this.bis.systemCode);
2878
- log$1('act: menus ', this.menus);
2879
- this.getAllLinks(this.menus, this.links);
2880
- log$1('act: links ', this.links);
2881
- }
2882
- canActivate(_, state) {
2883
- log$1('act: can activate ', state);
2884
- if (this.preHandle(state)) {
2885
- return true;
2886
- }
2887
- log$1('act: can activate child prehandle success');
2888
- let canactivate = false;
2889
- this.links.forEach((link) => {
2890
- const regexp = this.pathToRegexp.stringToRegexp(link, null, null);
2891
- log$1(`act: ${link} test ${state.url.split('?')[0]}`);
2892
- if (regexp.test(state.url.split('?')[0])) {
2893
- canactivate = true;
2894
- log$1(`act: test value ${canactivate}`);
2895
- return;
2896
- }
2897
- });
2898
- if (canactivate) {
2899
- log$1(`act: test sucess`);
2900
- return true;
2901
- }
2902
- else {
2903
- log$1(`act: test error`);
2904
- this.router.navigate(['displayIndex']);
2905
- return false;
2906
- }
2907
- }
2908
- canActivateChild(_, state) {
2909
- log$1('act: can activate child ', state);
2910
- if (this.preHandle(state)) {
2911
- return true;
2912
- }
2913
- log$1('act: can activate child prehandle success');
2914
- let canactivate = false;
2915
- this.links.forEach((link) => {
2916
- const regexp = this.pathToRegexp.stringToRegexp(link, null, null);
2917
- if (regexp.test(state.url.split('?')[0])) {
2918
- log$1(`act: ${link} test ${state.url.split('?')[0]}`);
2919
- canactivate = true;
2920
- log$1(`act: test value ${canactivate}`);
2921
- return;
2922
- }
2923
- });
2924
- if (canactivate) {
2925
- log$1(`act: test sucess`);
2926
- return true;
2927
- }
2928
- else {
2929
- log$1(`act: test error`);
2930
- this.router.navigate(['displayIndex']);
2931
- return false;
2932
- }
2933
- }
2934
- preHandle(state) {
2935
- return (state.url.includes('error') ||
2936
- state.url.includes('exception') ||
2937
- state.url.includes('displayIndex') ||
2938
- state.url === '' ||
2939
- state.url === null ||
2940
- state.url === '/' ||
2941
- state.url.includes('iframePage'));
2942
- }
2943
- getAllLinks(menu, links) {
2944
- menu.forEach((sider) => {
2945
- if (sider.link) {
2946
- links.push(sider.link);
2947
- }
2948
- if (sider.children && sider.children.length > 0) {
2949
- this.getAllLinks(sider.children, links);
2950
- }
2951
- });
2952
- }
2953
- }
2954
- 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 });
2955
- ActGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: ActGuard, providedIn: 'root' });
2956
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.5", ngImport: i0, type: ActGuard, decorators: [{
2957
- type: Injectable,
2958
- args: [{
2959
- providedIn: 'root'
2960
- }]
2961
- }], ctorParameters: function () { return [{ type: i1$3.YunzaiConfigService }, { type: i1$1.CacheService }, { type: PathToRegexpService }, { type: i5$3.Router }]; } });
2962
-
2963
- /**
2964
- * Generated bundle index. Do not edit.
2965
- */
2966
-
2967
- 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 };
2968
- //# sourceMappingURL=layout.mjs.map