@yelon/bis 17.3.2 → 18.0.1

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 (70) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +1 -1
  3. package/config/bis.config.d.ts +3 -3
  4. package/config/index.d.ts +5 -5
  5. package/config/public_api.d.ts +1 -1
  6. package/esm2022/bis.mjs +4 -4
  7. package/esm2022/config/bis.config.mjs +14 -14
  8. package/esm2022/config/config.mjs +4 -4
  9. package/esm2022/config/public_api.mjs +1 -1
  10. package/esm2022/layout/layout-basic.component.mjs +518 -508
  11. package/esm2022/layout/layout-nav-application.component.mjs +372 -372
  12. package/esm2022/layout/layout-nav-group.component.mjs +166 -162
  13. package/esm2022/layout/layout-nav-tile.component.mjs +14 -14
  14. package/esm2022/layout/layout.mjs +4 -4
  15. package/esm2022/layout/layout.module.mjs +53 -53
  16. package/esm2022/layout/public_api.mjs +5 -5
  17. package/esm2022/public_api.mjs +8 -8
  18. package/esm2022/src/bis.module.mjs +16 -16
  19. package/esm2022/src/helper.mjs +44 -44
  20. package/esm2022/src/provide.mjs +7 -7
  21. package/esm2022/src/refresh-token.mjs +78 -78
  22. package/esm2022/src/startup.service.mjs +183 -183
  23. package/esm2022/src/yunzai-act.guard.mjs +87 -87
  24. package/esm2022/src/yunzai-analysis-addon.guard.mjs +98 -98
  25. package/esm2022/src/yunzai-default.interceptor.mjs +62 -62
  26. package/esm2022/yunzai-widgets/public_api.mjs +6 -6
  27. package/esm2022/yunzai-widgets/yunzai-clear-storage.component.mjs +46 -46
  28. package/esm2022/yunzai-widgets/yunzai-fullscreen.component.mjs +46 -46
  29. package/esm2022/yunzai-widgets/yunzai-i18n.component.mjs +138 -138
  30. package/esm2022/yunzai-widgets/yunzai-notify.component.mjs +179 -179
  31. package/esm2022/yunzai-widgets/yunzai-user.component.mjs +119 -119
  32. package/esm2022/yunzai-widgets/yunzai-widget.module.mjs +61 -61
  33. package/esm2022/yunzai-widgets/yunzai-widgets.mjs +4 -4
  34. package/fesm2022/bis.mjs +559 -559
  35. package/fesm2022/config.mjs +21 -21
  36. package/fesm2022/layout.mjs +1097 -1083
  37. package/fesm2022/layout.mjs.map +1 -1
  38. package/fesm2022/yunzai-widgets.mjs +563 -563
  39. package/index.d.ts +5 -5
  40. package/index.less +1 -1
  41. package/layout/index.d.ts +5 -5
  42. package/layout/layout-basic.component.d.ts +54 -54
  43. package/layout/layout-nav-application.component.d.ts +26 -26
  44. package/layout/layout-nav-group.component.d.ts +14 -14
  45. package/layout/layout-nav-tile.component.d.ts +5 -5
  46. package/layout/layout.module.d.ts +18 -18
  47. package/layout/public_api.d.ts +5 -5
  48. package/layout/style/index.less +181 -182
  49. package/package.json +68 -68
  50. package/public_api.d.ts +8 -8
  51. package/src/bis.module.d.ts +8 -8
  52. package/src/helper.d.ts +16 -16
  53. package/src/provide.d.ts +2 -2
  54. package/src/refresh-token.d.ts +6 -6
  55. package/src/startup.service.d.ts +24 -24
  56. package/src/yunzai-act.guard.d.ts +20 -20
  57. package/src/yunzai-analysis-addon.guard.d.ts +26 -26
  58. package/src/yunzai-default.interceptor.d.ts +2 -2
  59. package/theme-compact.less +3 -3
  60. package/theme-dark.less +46 -46
  61. package/theme-default.less +48 -48
  62. package/theme-variable.less +1 -0
  63. package/yunzai-widgets/index.d.ts +5 -5
  64. package/yunzai-widgets/public_api.d.ts +6 -6
  65. package/yunzai-widgets/yunzai-clear-storage.component.d.ts +8 -8
  66. package/yunzai-widgets/yunzai-fullscreen.component.d.ts +8 -8
  67. package/yunzai-widgets/yunzai-i18n.component.d.ts +19 -19
  68. package/yunzai-widgets/yunzai-notify.component.d.ts +25 -25
  69. package/yunzai-widgets/yunzai-user.component.d.ts +22 -22
  70. package/yunzai-widgets/yunzai-widget.module.d.ts +18 -18
@@ -1,563 +1,563 @@
1
- import * as i0 from '@angular/core';
2
- import { inject, Component, ChangeDetectionStrategy, HostListener, ChangeDetectorRef, booleanAttribute, Input, NgModule } from '@angular/core';
3
- import { I18nPipe, YUNZAI_I18N_TOKEN, _HttpClient, SettingsService } from '@yelon/theme';
4
- import * as i1 from 'ng-zorro-antd/icon';
5
- import { NzIconModule } from 'ng-zorro-antd/icon';
6
- import { NzMessageService } from 'ng-zorro-antd/message';
7
- import { NzModalService } from 'ng-zorro-antd/modal';
8
- import screenfull from 'screenfull';
9
- import { forkJoin, map, Subject, takeUntil } from 'rxjs';
10
- import { formatDistanceToNow } from 'date-fns';
11
- import * as i1$1 from '@yelon/abc/notice-icon';
12
- import { NoticeIconModule } from '@yelon/abc/notice-icon';
13
- import { WINDOW, YunzaiConfigService, useLocalStorageProjectInfo, useLocalStorageUser } from '@yelon/util';
14
- import { NzI18nService } from 'ng-zorro-antd/i18n';
15
- import { DOCUMENT, CommonModule } from '@angular/common';
16
- import * as i2 from 'ng-zorro-antd/dropdown';
17
- import { NzDropDownModule } from 'ng-zorro-antd/dropdown';
18
- import * as i1$2 from 'ng-zorro-antd/menu';
19
- import { RouterModule } from '@angular/router';
20
- import { YA_SERVICE_TOKEN } from '@yelon/auth';
21
- import { mergeBisConfig } from '@yelon/bis/config';
22
- import * as i4 from 'ng-zorro-antd/avatar';
23
- import { NzAvatarModule } from 'ng-zorro-antd/avatar';
24
-
25
- class YunzaiHeaderClearStorageComponent {
26
- constructor() {
27
- this.modalSrv = inject(NzModalService);
28
- this.messageSrv = inject(NzMessageService);
29
- }
30
- _click() {
31
- this.modalSrv.confirm({
32
- nzTitle: 'Make sure clear all local storage?',
33
- nzOnOk: () => {
34
- localStorage.clear();
35
- this.messageSrv.success('Clear Finished!');
36
- }
37
- });
38
- }
39
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: YunzaiHeaderClearStorageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
40
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.1", type: YunzaiHeaderClearStorageComponent, isStandalone: true, selector: "yunzai-header-clear-storage", host: { listeners: { "click": "_click()" }, properties: { "class.flex-1": "true" } }, ngImport: i0, template: `
41
- <i nz-icon nzType="tool"></i>
42
- {{ 'menu.clear.local.storage' | i18n }}
43
- `, isInline: true, dependencies: [{ kind: "ngmodule", type: NzIconModule }, { kind: "directive", type: i1.NzIconDirective, selector: "[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { kind: "pipe", type: I18nPipe, name: "i18n" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
44
- }
45
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: YunzaiHeaderClearStorageComponent, decorators: [{
46
- type: Component,
47
- args: [{
48
- selector: 'yunzai-header-clear-storage',
49
- template: `
50
- <i nz-icon nzType="tool"></i>
51
- {{ 'menu.clear.local.storage' | i18n }}
52
- `,
53
- host: {
54
- '[class.flex-1]': 'true'
55
- },
56
- changeDetection: ChangeDetectionStrategy.OnPush,
57
- standalone: true,
58
- imports: [NzIconModule, I18nPipe]
59
- }]
60
- }], propDecorators: { _click: [{
61
- type: HostListener,
62
- args: ['click']
63
- }] } });
64
-
65
- class YunzaiHeaderFullScreenComponent {
66
- constructor() {
67
- this.status = false;
68
- }
69
- _resize() {
70
- this.status = screenfull.isFullscreen;
71
- }
72
- _click() {
73
- if (screenfull.isEnabled) {
74
- screenfull.toggle();
75
- }
76
- }
77
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: YunzaiHeaderFullScreenComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
78
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.1", type: YunzaiHeaderFullScreenComponent, isStandalone: true, selector: "yunzai-header-fullscreen", host: { listeners: { "window:resize": "_resize()", "click": "_click()" }, properties: { "class.flex-1": "true" } }, ngImport: i0, template: `
79
- <i nz-icon [nzType]="status ? 'fullscreen-exit' : 'fullscreen'"></i>
80
- {{ (status ? 'menu.fullscreen.exit' : 'menu.fullscreen') | i18n }}
81
- `, isInline: true, dependencies: [{ kind: "ngmodule", type: NzIconModule }, { kind: "directive", type: i1.NzIconDirective, selector: "[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { kind: "pipe", type: I18nPipe, name: "i18n" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
82
- }
83
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: YunzaiHeaderFullScreenComponent, decorators: [{
84
- type: Component,
85
- args: [{
86
- selector: 'yunzai-header-fullscreen',
87
- template: `
88
- <i nz-icon [nzType]="status ? 'fullscreen-exit' : 'fullscreen'"></i>
89
- {{ (status ? 'menu.fullscreen.exit' : 'menu.fullscreen') | i18n }}
90
- `,
91
- host: {
92
- '[class.flex-1]': 'true'
93
- },
94
- changeDetection: ChangeDetectionStrategy.OnPush,
95
- standalone: true,
96
- imports: [NzIconModule, I18nPipe]
97
- }]
98
- }], propDecorators: { _resize: [{
99
- type: HostListener,
100
- args: ['window:resize']
101
- }], _click: [{
102
- type: HostListener,
103
- args: ['click']
104
- }] } });
105
-
106
- class YunzaiHeaderNotifyComponent {
107
- constructor() {
108
- this.i18n = inject(YUNZAI_I18N_TOKEN);
109
- this.msg = inject(NzMessageService);
110
- this.nzI18n = inject(NzI18nService);
111
- this.cdr = inject(ChangeDetectorRef);
112
- this.http = inject(_HttpClient);
113
- this.win = inject(WINDOW);
114
- this.loading = false;
115
- this.count = 0;
116
- this.subs = [];
117
- this.data = [
118
- {
119
- key: 'msg',
120
- title: this.i18n.fanyi('notify.message'),
121
- list: [],
122
- emptyText: this.i18n.fanyi('notify.message.empty'),
123
- emptyImage: './assets/tmp/img/message.svg',
124
- clearText: this.i18n.fanyi('notify.message.clear')
125
- },
126
- {
127
- key: 'todo',
128
- title: this.i18n.fanyi('notify.todo'),
129
- list: [],
130
- emptyText: this.i18n.fanyi('notify.todo.empty'),
131
- emptyImage: './assets/tmp/img/todo.svg',
132
- clearText: this.i18n.fanyi('notify.todo.clear')
133
- },
134
- {
135
- key: 'notice',
136
- title: this.i18n.fanyi('notify.notice'),
137
- list: [],
138
- emptyText: this.i18n.fanyi('notify.notice.empty'),
139
- emptyImage: './assets/tmp/img/notice.svg',
140
- clearText: this.i18n.fanyi('notify.notice.clear')
141
- }
142
- ];
143
- }
144
- ngOnInit() {
145
- this.loadData();
146
- }
147
- loadData() {
148
- this.count = 0;
149
- this.loading = true;
150
- this.subs.push(
151
- // @ts-ignore
152
- forkJoin(this.loadTodo(), this.loadMessage()).subscribe(() => {
153
- this.loading = false;
154
- this.cdr.detectChanges();
155
- }));
156
- }
157
- loadMessage() {
158
- const formatMessageStatus = (status) => {
159
- switch (status) {
160
- case '0':
161
- return { extra: this.i18n.fanyi('notify.unread'), color: 'red' };
162
- case '1':
163
- return { extra: this.i18n.fanyi('notify.readed'), color: 'green' };
164
- default:
165
- return { extra: this.i18n.fanyi('notify.nostatus'), color: 'primary' };
166
- }
167
- };
168
- return this.http
169
- .post(`/message-center-3/my-msg-and-todo/msg-list`, {
170
- pageNum: 1,
171
- pageSize: 10,
172
- status: '0'
173
- })
174
- .pipe(map((response) => {
175
- const viewMessage = this.data.filter(d => d.key === 'msg')[0];
176
- viewMessage.list = response.data.list.map((m) => {
177
- return {
178
- ...m,
179
- avatar: m?.imgUrl || './assets/tmp/img/message.png',
180
- title: m.systemName,
181
- description: m.content,
182
- extra: formatMessageStatus(m.status).extra,
183
- color: formatMessageStatus(m.status).color,
184
- datetime: formatDistanceToNow(new Date(m.date), { locale: this.nzI18n.getDateLocale() })
185
- };
186
- });
187
- this.count += viewMessage.list.length;
188
- }));
189
- }
190
- loadTodo() {
191
- const formatTodoStatus = (status) => {
192
- switch (status) {
193
- case '0':
194
- return { extra: this.i18n.fanyi('notify.unstart'), color: 'red' };
195
- case '1':
196
- return { extra: this.i18n.fanyi('notify.started'), color: 'green' };
197
- default:
198
- return { extra: this.i18n.fanyi('notify.nostatus'), color: 'primary' };
199
- }
200
- };
201
- return this.http
202
- .post(`/message-center-3/my-msg-and-todo/todo-list`, {
203
- pageNum: 1,
204
- pageSize: 10,
205
- status: '0'
206
- })
207
- .pipe(map((response) => {
208
- const viewTodo = this.data.filter(d => d.key === 'todo')[0];
209
- viewTodo.list = response.data.list.map((t) => {
210
- return {
211
- ...t,
212
- avatar: t?.imgUrl || './assets/tmp/img/todo.png',
213
- title: t.systemName,
214
- description: t.content,
215
- datetime: formatDistanceToNow(new Date(t.date), { locale: this.nzI18n.getDateLocale() }),
216
- extra: formatTodoStatus(t.status).extra,
217
- color: formatTodoStatus(t.status).color
218
- };
219
- });
220
- this.count += viewTodo.list.length;
221
- }));
222
- }
223
- clear(type) {
224
- const t = this.data.filter(d => d.title === type)[0];
225
- if (t.key == 'msg' || t.key == 'notice') {
226
- this.subs.push(this.http.post(`/message-center-3/my-msg-and-todo/msg-clear`, {}).subscribe(_ => {
227
- this.msg.success(`${this.i18n.fanyi('notify.clear')} ${type}`);
228
- this.loadData();
229
- }));
230
- }
231
- if (t.key == 'todo') {
232
- this.loadData();
233
- }
234
- }
235
- select(res) {
236
- this.win.open(res.item.url);
237
- this.loadData();
238
- }
239
- ngOnDestroy() {
240
- this.subs.forEach(a => a.unsubscribe());
241
- }
242
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: YunzaiHeaderNotifyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
243
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.1", type: YunzaiHeaderNotifyComponent, isStandalone: true, selector: "yunzai-header-notify", ngImport: i0, template: `
244
- <notice-icon
245
- [data]="data"
246
- [count]="count"
247
- [loading]="loading"
248
- btnClass="yunzai-default__nav-item"
249
- btnIconClass="yunzai-default__nav-item-icon"
250
- (select)="select($event)"
251
- (clear)="clear($event)"
252
- />
253
- `, isInline: true, dependencies: [{ kind: "ngmodule", type: NoticeIconModule }, { kind: "component", type: i1$1.NoticeIconComponent, selector: "notice-icon", inputs: ["data", "count", "loading", "popoverVisible", "btnClass", "btnIconClass", "centered"], outputs: ["select", "clear", "popoverVisibleChange"], exportAs: ["noticeIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
254
- }
255
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: YunzaiHeaderNotifyComponent, decorators: [{
256
- type: Component,
257
- args: [{
258
- selector: `yunzai-header-notify`,
259
- template: `
260
- <notice-icon
261
- [data]="data"
262
- [count]="count"
263
- [loading]="loading"
264
- btnClass="yunzai-default__nav-item"
265
- btnIconClass="yunzai-default__nav-item-icon"
266
- (select)="select($event)"
267
- (clear)="clear($event)"
268
- />
269
- `,
270
- standalone: true,
271
- imports: [NoticeIconModule],
272
- changeDetection: ChangeDetectionStrategy.OnPush
273
- }]
274
- }] });
275
-
276
- class YunzaiHeaderI18nComponent {
277
- constructor() {
278
- this.settings = inject(SettingsService);
279
- this.i18n = inject(YUNZAI_I18N_TOKEN);
280
- this.doc = inject(DOCUMENT);
281
- this.langs = [];
282
- this.destroy$ = new Subject();
283
- /** Whether to display language text */
284
- this.showLangText = true;
285
- }
286
- get curLangCode() {
287
- return this.settings.layout.lang;
288
- }
289
- ngOnInit() {
290
- this.i18n
291
- .getLangs()
292
- .pipe(takeUntil(this.destroy$))
293
- .subscribe(langs => {
294
- this.langs = langs;
295
- });
296
- }
297
- change(lang) {
298
- const spinEl = this.doc.createElement('div');
299
- spinEl.setAttribute('class', `page-loading ant-spin ant-spin-lg ant-spin-spinning`);
300
- spinEl.innerHTML = `<span class="ant-spin-dot ant-spin-dot-spin"><i></i><i></i><i></i><i></i></span>`;
301
- this.doc.body.appendChild(spinEl);
302
- this.i18n.loadLangData(lang).subscribe(res => {
303
- this.i18n.use(lang, res);
304
- this.settings.setLayout('lang', lang);
305
- setTimeout(() => this.doc.location.reload());
306
- });
307
- }
308
- ngOnDestroy() {
309
- this.destroy$.complete();
310
- }
311
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: YunzaiHeaderI18nComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
312
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.1", type: YunzaiHeaderI18nComponent, isStandalone: true, selector: "yunzai-header-i18n", inputs: { showLangText: ["showLangText", "showLangText", booleanAttribute] }, host: { properties: { "class.flex-1": "true" } }, ngImport: i0, template: `
313
- @if (showLangText) {
314
- <div nz-dropdown [nzDropdownMenu]="langMenu" nzPlacement="bottomRight">
315
- <i nz-icon nzType="global"></i>
316
- {{ 'lang.nav' | i18n }}
317
- <i nz-icon nzType="down"></i>
318
- </div>
319
- } @else {
320
- <i nz-dropdown [nzDropdownMenu]="langMenu" nzPlacement="bottomRight" nz-icon nzType="global"></i>
321
- }
322
- <nz-dropdown-menu data-event-id="_nav_lang" #langMenu="nzDropdownMenu">
323
- <ul nz-menu>
324
- @for (item of langs; track item) {
325
- <li
326
- data-event-id="_nav_lang"
327
- [attr.data-text]="item.text"
328
- nz-menu-item
329
- [nzSelected]="item.code === curLangCode"
330
- (click)="change(item.code)"
331
- >
332
- @if (!item.icon) {
333
- <span role="img" [attr.aria-label]="item.text" class="pr-xs">{{ item.abbr }}</span>
334
- } @else {
335
- <img
336
- style="margin-right:4px"
337
- width="50px"
338
- height="30px"
339
- [src]="'data:image/png;base64,' + item.icon"
340
- [alt]="item.abbr"
341
- class="pr-xs"
342
- />
343
- }
344
- {{ item.text }}
345
- </li>
346
- }
347
- </ul>
348
- </nz-dropdown-menu>
349
- `, isInline: true, dependencies: [{ kind: "ngmodule", type: NzDropDownModule }, { kind: "directive", type: i1$2.NzMenuDirective, selector: "[nz-menu]", inputs: ["nzInlineIndent", "nzTheme", "nzMode", "nzInlineCollapsed", "nzSelectable"], outputs: ["nzClick"], exportAs: ["nzMenu"] }, { kind: "component", type: i1$2.NzMenuItemComponent, selector: "[nz-menu-item]", inputs: ["nzPaddingLeft", "nzDisabled", "nzSelected", "nzDanger", "nzMatchRouterExact", "nzMatchRouter"], exportAs: ["nzMenuItem"] }, { kind: "directive", type: i2.NzDropDownDirective, selector: "[nz-dropdown]", inputs: ["nzDropdownMenu", "nzTrigger", "nzMatchWidthElement", "nzBackdrop", "nzClickHide", "nzDisabled", "nzVisible", "nzOverlayClassName", "nzOverlayStyle", "nzPlacement"], outputs: ["nzVisibleChange"], exportAs: ["nzDropdown"] }, { kind: "component", type: i2.NzDropdownMenuComponent, selector: "nz-dropdown-menu", exportAs: ["nzDropdownMenu"] }, { kind: "ngmodule", type: NzIconModule }, { kind: "directive", type: i1.NzIconDirective, selector: "[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { kind: "pipe", type: I18nPipe, name: "i18n" }, { kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
350
- }
351
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: YunzaiHeaderI18nComponent, decorators: [{
352
- type: Component,
353
- args: [{
354
- selector: `yunzai-header-i18n`,
355
- template: `
356
- @if (showLangText) {
357
- <div nz-dropdown [nzDropdownMenu]="langMenu" nzPlacement="bottomRight">
358
- <i nz-icon nzType="global"></i>
359
- {{ 'lang.nav' | i18n }}
360
- <i nz-icon nzType="down"></i>
361
- </div>
362
- } @else {
363
- <i nz-dropdown [nzDropdownMenu]="langMenu" nzPlacement="bottomRight" nz-icon nzType="global"></i>
364
- }
365
- <nz-dropdown-menu data-event-id="_nav_lang" #langMenu="nzDropdownMenu">
366
- <ul nz-menu>
367
- @for (item of langs; track item) {
368
- <li
369
- data-event-id="_nav_lang"
370
- [attr.data-text]="item.text"
371
- nz-menu-item
372
- [nzSelected]="item.code === curLangCode"
373
- (click)="change(item.code)"
374
- >
375
- @if (!item.icon) {
376
- <span role="img" [attr.aria-label]="item.text" class="pr-xs">{{ item.abbr }}</span>
377
- } @else {
378
- <img
379
- style="margin-right:4px"
380
- width="50px"
381
- height="30px"
382
- [src]="'data:image/png;base64,' + item.icon"
383
- [alt]="item.abbr"
384
- class="pr-xs"
385
- />
386
- }
387
- {{ item.text }}
388
- </li>
389
- }
390
- </ul>
391
- </nz-dropdown-menu>
392
- `,
393
- host: {
394
- '[class.flex-1]': 'true'
395
- },
396
- standalone: true,
397
- changeDetection: ChangeDetectionStrategy.OnPush,
398
- imports: [NzDropDownModule, NzIconModule, I18nPipe, CommonModule]
399
- }]
400
- }], propDecorators: { showLangText: [{
401
- type: Input,
402
- args: [{ transform: booleanAttribute }]
403
- }] } });
404
-
405
- class YunzaiHeaderUserComponent {
406
- constructor() {
407
- this.msg = inject(NzMessageService);
408
- this.tokenService = inject(YA_SERVICE_TOKEN);
409
- this.configService = inject(YunzaiConfigService);
410
- this.config = mergeBisConfig(this.configService);
411
- this.win = inject(WINDOW);
412
- this.icon = '';
413
- this.username = '';
414
- this.menus = [];
415
- }
416
- ngOnInit() {
417
- const [, getProjectInfo] = useLocalStorageProjectInfo();
418
- const [, getUser] = useLocalStorageUser();
419
- const projectInfo = getProjectInfo();
420
- const user = getUser();
421
- this.username = user.realname ? user.realname : '未命名';
422
- this.icon = user.avatarId
423
- ? `${this.config.baseUrl}/filecenter/file/${user.avatarId}`
424
- : `./assets/tmp/img/avatar.jpg`;
425
- this.menus = projectInfo.profileList;
426
- }
427
- logout() {
428
- localStorage.clear();
429
- this.tokenService.clear();
430
- this.win.location.href = `${this.config.baseUrl}/cas-proxy/app/logout`;
431
- }
432
- to(href) {
433
- if (href) {
434
- this.win.open(href);
435
- }
436
- else {
437
- this.msg.error('该菜单没有配置链接!');
438
- }
439
- }
440
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: YunzaiHeaderUserComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
441
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.1", type: YunzaiHeaderUserComponent, isStandalone: true, selector: "yunzai-header-user", ngImport: i0, template: `
442
- <div
443
- class="yunzai-default__nav-item d-flex align-items-center px-sm"
444
- data-event-id="_nav_user"
445
- nz-dropdown
446
- nzPlacement="bottomRight"
447
- [nzDropdownMenu]="userMenu"
448
- >
449
- <div class="yz-user-name">
450
- <nz-avatar [nzSrc]="icon" nzSize="small" class="mr-sm" />
451
- {{ username }}
452
- </div>
453
- </div>
454
- <nz-dropdown-menu #userMenu="nzDropdownMenu">
455
- <div nz-menu class="width-sm">
456
- @for (m of menus; track m) {
457
- <div data-event-id="_nav_user" [attr.data-name]="m.name | i18n" nz-menu-item (click)="to(m.url)">
458
- <i nz-icon [nzType]="m.icon" class="mr-sm"></i>
459
- {{ m.name | i18n }}
460
- </div>
461
- }
462
- <li nz-menu-divider></li>
463
- <div data-event-id="_nav_user" data-name="注销登录" nz-menu-item (click)="logout()">
464
- <i nz-icon nzType="logout" class="mr-sm"></i>
465
- {{ 'logout' | i18n }}
466
- </div>
467
- </div>
468
- </nz-dropdown-menu>
469
- `, isInline: true, dependencies: [{ kind: "ngmodule", type: NzDropDownModule }, { kind: "directive", type: i1$2.NzMenuDirective, selector: "[nz-menu]", inputs: ["nzInlineIndent", "nzTheme", "nzMode", "nzInlineCollapsed", "nzSelectable"], outputs: ["nzClick"], exportAs: ["nzMenu"] }, { kind: "component", type: i1$2.NzMenuItemComponent, selector: "[nz-menu-item]", inputs: ["nzPaddingLeft", "nzDisabled", "nzSelected", "nzDanger", "nzMatchRouterExact", "nzMatchRouter"], exportAs: ["nzMenuItem"] }, { kind: "directive", type: i1$2.NzMenuDividerDirective, selector: "[nz-menu-divider]", exportAs: ["nzMenuDivider"] }, { kind: "directive", type: i2.NzDropDownDirective, selector: "[nz-dropdown]", inputs: ["nzDropdownMenu", "nzTrigger", "nzMatchWidthElement", "nzBackdrop", "nzClickHide", "nzDisabled", "nzVisible", "nzOverlayClassName", "nzOverlayStyle", "nzPlacement"], outputs: ["nzVisibleChange"], exportAs: ["nzDropdown"] }, { kind: "component", type: i2.NzDropdownMenuComponent, selector: "nz-dropdown-menu", exportAs: ["nzDropdownMenu"] }, { kind: "pipe", type: I18nPipe, name: "i18n" }, { kind: "ngmodule", type: NzIconModule }, { kind: "directive", type: i1.NzIconDirective, selector: "[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { kind: "ngmodule", type: NzAvatarModule }, { kind: "component", type: i4.NzAvatarComponent, selector: "nz-avatar", inputs: ["nzShape", "nzSize", "nzGap", "nzText", "nzSrc", "nzSrcSet", "nzAlt", "nzIcon"], outputs: ["nzError"], exportAs: ["nzAvatar"] }, { kind: "ngmodule", type: RouterModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
470
- }
471
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: YunzaiHeaderUserComponent, decorators: [{
472
- type: Component,
473
- args: [{
474
- selector: `yunzai-header-user`,
475
- template: `
476
- <div
477
- class="yunzai-default__nav-item d-flex align-items-center px-sm"
478
- data-event-id="_nav_user"
479
- nz-dropdown
480
- nzPlacement="bottomRight"
481
- [nzDropdownMenu]="userMenu"
482
- >
483
- <div class="yz-user-name">
484
- <nz-avatar [nzSrc]="icon" nzSize="small" class="mr-sm" />
485
- {{ username }}
486
- </div>
487
- </div>
488
- <nz-dropdown-menu #userMenu="nzDropdownMenu">
489
- <div nz-menu class="width-sm">
490
- @for (m of menus; track m) {
491
- <div data-event-id="_nav_user" [attr.data-name]="m.name | i18n" nz-menu-item (click)="to(m.url)">
492
- <i nz-icon [nzType]="m.icon" class="mr-sm"></i>
493
- {{ m.name | i18n }}
494
- </div>
495
- }
496
- <li nz-menu-divider></li>
497
- <div data-event-id="_nav_user" data-name="注销登录" nz-menu-item (click)="logout()">
498
- <i nz-icon nzType="logout" class="mr-sm"></i>
499
- {{ 'logout' | i18n }}
500
- </div>
501
- </div>
502
- </nz-dropdown-menu>
503
- `,
504
- standalone: true,
505
- imports: [NzDropDownModule, I18nPipe, NzIconModule, NzAvatarModule, RouterModule],
506
- changeDetection: ChangeDetectionStrategy.OnPush
507
- }]
508
- }] });
509
-
510
- const COMPONENTS = [
511
- YunzaiHeaderClearStorageComponent,
512
- YunzaiHeaderFullScreenComponent,
513
- YunzaiHeaderNotifyComponent,
514
- YunzaiHeaderI18nComponent,
515
- YunzaiHeaderUserComponent
516
- ];
517
- class YunzaiWidgetsModule {
518
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: YunzaiWidgetsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
519
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.1", ngImport: i0, type: YunzaiWidgetsModule, imports: [NzAvatarModule,
520
- RouterModule,
521
- NoticeIconModule,
522
- NzDropDownModule,
523
- CommonModule,
524
- NzIconModule,
525
- I18nPipe, YunzaiHeaderClearStorageComponent,
526
- YunzaiHeaderFullScreenComponent,
527
- YunzaiHeaderNotifyComponent,
528
- YunzaiHeaderI18nComponent,
529
- YunzaiHeaderUserComponent], exports: [YunzaiHeaderClearStorageComponent,
530
- YunzaiHeaderFullScreenComponent,
531
- YunzaiHeaderNotifyComponent,
532
- YunzaiHeaderI18nComponent,
533
- YunzaiHeaderUserComponent] }); }
534
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: YunzaiWidgetsModule, imports: [NzAvatarModule,
535
- RouterModule,
536
- NoticeIconModule,
537
- NzDropDownModule,
538
- CommonModule,
539
- NzIconModule, COMPONENTS] }); }
540
- }
541
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: YunzaiWidgetsModule, decorators: [{
542
- type: NgModule,
543
- args: [{
544
- imports: [
545
- NzAvatarModule,
546
- RouterModule,
547
- NoticeIconModule,
548
- NzDropDownModule,
549
- CommonModule,
550
- NzIconModule,
551
- I18nPipe,
552
- ...COMPONENTS
553
- ],
554
- exports: COMPONENTS
555
- }]
556
- }] });
557
-
558
- /**
559
- * Generated bundle index. Do not edit.
560
- */
561
-
562
- export { YunzaiHeaderClearStorageComponent, YunzaiHeaderFullScreenComponent, YunzaiHeaderI18nComponent, YunzaiHeaderNotifyComponent, YunzaiHeaderUserComponent, YunzaiWidgetsModule };
563
- //# sourceMappingURL=yunzai-widgets.mjs.map
1
+ import * as i0 from '@angular/core';
2
+ import { inject, Component, ChangeDetectionStrategy, HostListener, ChangeDetectorRef, booleanAttribute, Input, NgModule } from '@angular/core';
3
+ import { I18nPipe, YUNZAI_I18N_TOKEN, _HttpClient, SettingsService } from '@yelon/theme';
4
+ import * as i1 from 'ng-zorro-antd/icon';
5
+ import { NzIconModule } from 'ng-zorro-antd/icon';
6
+ import { NzMessageService } from 'ng-zorro-antd/message';
7
+ import { NzModalService } from 'ng-zorro-antd/modal';
8
+ import screenfull from 'screenfull';
9
+ import { forkJoin, map, Subject, takeUntil } from 'rxjs';
10
+ import { formatDistanceToNow } from 'date-fns';
11
+ import * as i1$1 from '@yelon/abc/notice-icon';
12
+ import { NoticeIconModule } from '@yelon/abc/notice-icon';
13
+ import { WINDOW, YunzaiConfigService, useLocalStorageProjectInfo, useLocalStorageUser } from '@yelon/util';
14
+ import { NzI18nService } from 'ng-zorro-antd/i18n';
15
+ import { DOCUMENT, CommonModule } from '@angular/common';
16
+ import * as i2 from 'ng-zorro-antd/dropdown';
17
+ import { NzDropDownModule } from 'ng-zorro-antd/dropdown';
18
+ import * as i1$2 from 'ng-zorro-antd/menu';
19
+ import { RouterModule } from '@angular/router';
20
+ import { YA_SERVICE_TOKEN } from '@yelon/auth';
21
+ import { mergeBisConfig } from '@yelon/bis/config';
22
+ import * as i4 from 'ng-zorro-antd/avatar';
23
+ import { NzAvatarModule } from 'ng-zorro-antd/avatar';
24
+
25
+ class YunzaiHeaderClearStorageComponent {
26
+ constructor() {
27
+ this.modalSrv = inject(NzModalService);
28
+ this.messageSrv = inject(NzMessageService);
29
+ }
30
+ _click() {
31
+ this.modalSrv.confirm({
32
+ nzTitle: 'Make sure clear all local storage?',
33
+ nzOnOk: () => {
34
+ localStorage.clear();
35
+ this.messageSrv.success('Clear Finished!');
36
+ }
37
+ });
38
+ }
39
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.6", ngImport: i0, type: YunzaiHeaderClearStorageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
40
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.0.6", type: YunzaiHeaderClearStorageComponent, isStandalone: true, selector: "yunzai-header-clear-storage", host: { listeners: { "click": "_click()" }, properties: { "class.flex-1": "true" } }, ngImport: i0, template: `
41
+ <i nz-icon nzType="tool"></i>
42
+ {{ 'menu.clear.local.storage' | i18n }}
43
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: NzIconModule }, { kind: "directive", type: i1.NzIconDirective, selector: "[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { kind: "pipe", type: I18nPipe, name: "i18n" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
44
+ }
45
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.6", ngImport: i0, type: YunzaiHeaderClearStorageComponent, decorators: [{
46
+ type: Component,
47
+ args: [{
48
+ selector: 'yunzai-header-clear-storage',
49
+ template: `
50
+ <i nz-icon nzType="tool"></i>
51
+ {{ 'menu.clear.local.storage' | i18n }}
52
+ `,
53
+ host: {
54
+ '[class.flex-1]': 'true'
55
+ },
56
+ changeDetection: ChangeDetectionStrategy.OnPush,
57
+ standalone: true,
58
+ imports: [NzIconModule, I18nPipe]
59
+ }]
60
+ }], propDecorators: { _click: [{
61
+ type: HostListener,
62
+ args: ['click']
63
+ }] } });
64
+
65
+ class YunzaiHeaderFullScreenComponent {
66
+ constructor() {
67
+ this.status = false;
68
+ }
69
+ _resize() {
70
+ this.status = screenfull.isFullscreen;
71
+ }
72
+ _click() {
73
+ if (screenfull.isEnabled) {
74
+ screenfull.toggle();
75
+ }
76
+ }
77
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.6", ngImport: i0, type: YunzaiHeaderFullScreenComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
78
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.0.6", type: YunzaiHeaderFullScreenComponent, isStandalone: true, selector: "yunzai-header-fullscreen", host: { listeners: { "window:resize": "_resize()", "click": "_click()" }, properties: { "class.flex-1": "true" } }, ngImport: i0, template: `
79
+ <i nz-icon [nzType]="status ? 'fullscreen-exit' : 'fullscreen'"></i>
80
+ {{ (status ? 'menu.fullscreen.exit' : 'menu.fullscreen') | i18n }}
81
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: NzIconModule }, { kind: "directive", type: i1.NzIconDirective, selector: "[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { kind: "pipe", type: I18nPipe, name: "i18n" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
82
+ }
83
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.6", ngImport: i0, type: YunzaiHeaderFullScreenComponent, decorators: [{
84
+ type: Component,
85
+ args: [{
86
+ selector: 'yunzai-header-fullscreen',
87
+ template: `
88
+ <i nz-icon [nzType]="status ? 'fullscreen-exit' : 'fullscreen'"></i>
89
+ {{ (status ? 'menu.fullscreen.exit' : 'menu.fullscreen') | i18n }}
90
+ `,
91
+ host: {
92
+ '[class.flex-1]': 'true'
93
+ },
94
+ changeDetection: ChangeDetectionStrategy.OnPush,
95
+ standalone: true,
96
+ imports: [NzIconModule, I18nPipe]
97
+ }]
98
+ }], propDecorators: { _resize: [{
99
+ type: HostListener,
100
+ args: ['window:resize']
101
+ }], _click: [{
102
+ type: HostListener,
103
+ args: ['click']
104
+ }] } });
105
+
106
+ class YunzaiHeaderNotifyComponent {
107
+ constructor() {
108
+ this.i18n = inject(YUNZAI_I18N_TOKEN);
109
+ this.msg = inject(NzMessageService);
110
+ this.nzI18n = inject(NzI18nService);
111
+ this.cdr = inject(ChangeDetectorRef);
112
+ this.http = inject(_HttpClient);
113
+ this.win = inject(WINDOW);
114
+ this.loading = false;
115
+ this.count = 0;
116
+ this.subs = [];
117
+ this.data = [
118
+ {
119
+ key: 'msg',
120
+ title: this.i18n.fanyi('notify.message'),
121
+ list: [],
122
+ emptyText: this.i18n.fanyi('notify.message.empty'),
123
+ emptyImage: './assets/tmp/img/message.svg',
124
+ clearText: this.i18n.fanyi('notify.message.clear')
125
+ },
126
+ {
127
+ key: 'todo',
128
+ title: this.i18n.fanyi('notify.todo'),
129
+ list: [],
130
+ emptyText: this.i18n.fanyi('notify.todo.empty'),
131
+ emptyImage: './assets/tmp/img/todo.svg',
132
+ clearText: this.i18n.fanyi('notify.todo.clear')
133
+ },
134
+ {
135
+ key: 'notice',
136
+ title: this.i18n.fanyi('notify.notice'),
137
+ list: [],
138
+ emptyText: this.i18n.fanyi('notify.notice.empty'),
139
+ emptyImage: './assets/tmp/img/notice.svg',
140
+ clearText: this.i18n.fanyi('notify.notice.clear')
141
+ }
142
+ ];
143
+ }
144
+ ngOnInit() {
145
+ this.loadData();
146
+ }
147
+ loadData() {
148
+ this.count = 0;
149
+ this.loading = true;
150
+ this.subs.push(
151
+ // @ts-ignore
152
+ forkJoin(this.loadTodo(), this.loadMessage()).subscribe(() => {
153
+ this.loading = false;
154
+ this.cdr.detectChanges();
155
+ }));
156
+ }
157
+ loadMessage() {
158
+ const formatMessageStatus = (status) => {
159
+ switch (status) {
160
+ case '0':
161
+ return { extra: this.i18n.fanyi('notify.unread'), color: 'red' };
162
+ case '1':
163
+ return { extra: this.i18n.fanyi('notify.readed'), color: 'green' };
164
+ default:
165
+ return { extra: this.i18n.fanyi('notify.nostatus'), color: 'primary' };
166
+ }
167
+ };
168
+ return this.http
169
+ .post(`/message-center-3/my-msg-and-todo/msg-list`, {
170
+ pageNum: 1,
171
+ pageSize: 10,
172
+ status: '0'
173
+ })
174
+ .pipe(map((response) => {
175
+ const viewMessage = this.data.filter(d => d.key === 'msg')[0];
176
+ viewMessage.list = response.data.list.map((m) => {
177
+ return {
178
+ ...m,
179
+ avatar: m?.imgUrl || './assets/tmp/img/message.png',
180
+ title: m.systemName,
181
+ description: m.content,
182
+ extra: formatMessageStatus(m.status).extra,
183
+ color: formatMessageStatus(m.status).color,
184
+ datetime: formatDistanceToNow(new Date(m.date), { locale: this.nzI18n.getDateLocale() })
185
+ };
186
+ });
187
+ this.count += viewMessage.list.length;
188
+ }));
189
+ }
190
+ loadTodo() {
191
+ const formatTodoStatus = (status) => {
192
+ switch (status) {
193
+ case '0':
194
+ return { extra: this.i18n.fanyi('notify.unstart'), color: 'red' };
195
+ case '1':
196
+ return { extra: this.i18n.fanyi('notify.started'), color: 'green' };
197
+ default:
198
+ return { extra: this.i18n.fanyi('notify.nostatus'), color: 'primary' };
199
+ }
200
+ };
201
+ return this.http
202
+ .post(`/message-center-3/my-msg-and-todo/todo-list`, {
203
+ pageNum: 1,
204
+ pageSize: 10,
205
+ status: '0'
206
+ })
207
+ .pipe(map((response) => {
208
+ const viewTodo = this.data.filter(d => d.key === 'todo')[0];
209
+ viewTodo.list = response.data.list.map((t) => {
210
+ return {
211
+ ...t,
212
+ avatar: t?.imgUrl || './assets/tmp/img/todo.png',
213
+ title: t.systemName,
214
+ description: t.content,
215
+ datetime: formatDistanceToNow(new Date(t.date), { locale: this.nzI18n.getDateLocale() }),
216
+ extra: formatTodoStatus(t.status).extra,
217
+ color: formatTodoStatus(t.status).color
218
+ };
219
+ });
220
+ this.count += viewTodo.list.length;
221
+ }));
222
+ }
223
+ clear(type) {
224
+ const t = this.data.filter(d => d.title === type)[0];
225
+ if (t.key == 'msg' || t.key == 'notice') {
226
+ this.subs.push(this.http.post(`/message-center-3/my-msg-and-todo/msg-clear`, {}).subscribe(_ => {
227
+ this.msg.success(`${this.i18n.fanyi('notify.clear')} ${type}`);
228
+ this.loadData();
229
+ }));
230
+ }
231
+ if (t.key == 'todo') {
232
+ this.loadData();
233
+ }
234
+ }
235
+ select(res) {
236
+ this.win.open(res.item.url);
237
+ this.loadData();
238
+ }
239
+ ngOnDestroy() {
240
+ this.subs.forEach(a => a.unsubscribe());
241
+ }
242
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.6", ngImport: i0, type: YunzaiHeaderNotifyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
243
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.0.6", type: YunzaiHeaderNotifyComponent, isStandalone: true, selector: "yunzai-header-notify", ngImport: i0, template: `
244
+ <notice-icon
245
+ [data]="data"
246
+ [count]="count"
247
+ [loading]="loading"
248
+ btnClass="yunzai-default__nav-item"
249
+ btnIconClass="yunzai-default__nav-item-icon"
250
+ (select)="select($event)"
251
+ (clear)="clear($event)"
252
+ />
253
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: NoticeIconModule }, { kind: "component", type: i1$1.NoticeIconComponent, selector: "notice-icon", inputs: ["data", "count", "loading", "popoverVisible", "btnClass", "btnIconClass", "centered"], outputs: ["select", "clear", "popoverVisibleChange"], exportAs: ["noticeIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
254
+ }
255
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.6", ngImport: i0, type: YunzaiHeaderNotifyComponent, decorators: [{
256
+ type: Component,
257
+ args: [{
258
+ selector: `yunzai-header-notify`,
259
+ template: `
260
+ <notice-icon
261
+ [data]="data"
262
+ [count]="count"
263
+ [loading]="loading"
264
+ btnClass="yunzai-default__nav-item"
265
+ btnIconClass="yunzai-default__nav-item-icon"
266
+ (select)="select($event)"
267
+ (clear)="clear($event)"
268
+ />
269
+ `,
270
+ standalone: true,
271
+ imports: [NoticeIconModule],
272
+ changeDetection: ChangeDetectionStrategy.OnPush
273
+ }]
274
+ }] });
275
+
276
+ class YunzaiHeaderI18nComponent {
277
+ constructor() {
278
+ this.settings = inject(SettingsService);
279
+ this.i18n = inject(YUNZAI_I18N_TOKEN);
280
+ this.doc = inject(DOCUMENT);
281
+ this.langs = [];
282
+ this.destroy$ = new Subject();
283
+ /** Whether to display language text */
284
+ this.showLangText = true;
285
+ }
286
+ get curLangCode() {
287
+ return this.settings.layout.lang;
288
+ }
289
+ ngOnInit() {
290
+ this.i18n
291
+ .getLangs()
292
+ .pipe(takeUntil(this.destroy$))
293
+ .subscribe(langs => {
294
+ this.langs = langs;
295
+ });
296
+ }
297
+ change(lang) {
298
+ const spinEl = this.doc.createElement('div');
299
+ spinEl.setAttribute('class', `page-loading ant-spin ant-spin-lg ant-spin-spinning`);
300
+ spinEl.innerHTML = `<span class="ant-spin-dot ant-spin-dot-spin"><i></i><i></i><i></i><i></i></span>`;
301
+ this.doc.body.appendChild(spinEl);
302
+ this.i18n.loadLangData(lang).subscribe(res => {
303
+ this.i18n.use(lang, res);
304
+ this.settings.setLayout('lang', lang);
305
+ setTimeout(() => this.doc.location.reload());
306
+ });
307
+ }
308
+ ngOnDestroy() {
309
+ this.destroy$.complete();
310
+ }
311
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.6", ngImport: i0, type: YunzaiHeaderI18nComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
312
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.6", type: YunzaiHeaderI18nComponent, isStandalone: true, selector: "yunzai-header-i18n", inputs: { showLangText: ["showLangText", "showLangText", booleanAttribute] }, host: { properties: { "class.flex-1": "true" } }, ngImport: i0, template: `
313
+ @if (showLangText) {
314
+ <div nz-dropdown [nzDropdownMenu]="langMenu" nzPlacement="bottomRight">
315
+ <i nz-icon nzType="global"></i>
316
+ {{ 'lang.nav' | i18n }}
317
+ <i nz-icon nzType="down"></i>
318
+ </div>
319
+ } @else {
320
+ <i nz-dropdown [nzDropdownMenu]="langMenu" nzPlacement="bottomRight" nz-icon nzType="global"></i>
321
+ }
322
+ <nz-dropdown-menu data-event-id="_nav_lang" #langMenu="nzDropdownMenu">
323
+ <ul nz-menu>
324
+ @for (item of langs; track item) {
325
+ <li
326
+ data-event-id="_nav_lang"
327
+ [attr.data-text]="item.text"
328
+ nz-menu-item
329
+ [nzSelected]="item.code === curLangCode"
330
+ (click)="change(item.code)"
331
+ >
332
+ @if (!item.icon) {
333
+ <span role="img" [attr.aria-label]="item.text" class="pr-xs">{{ item.abbr }}</span>
334
+ } @else {
335
+ <img
336
+ style="margin-right:4px"
337
+ width="50px"
338
+ height="30px"
339
+ [src]="'data:image/png;base64,' + item.icon"
340
+ [alt]="item.abbr"
341
+ class="pr-xs"
342
+ />
343
+ }
344
+ {{ item.text }}
345
+ </li>
346
+ }
347
+ </ul>
348
+ </nz-dropdown-menu>
349
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: NzDropDownModule }, { kind: "directive", type: i1$2.NzMenuDirective, selector: "[nz-menu]", inputs: ["nzInlineIndent", "nzTheme", "nzMode", "nzInlineCollapsed", "nzSelectable"], outputs: ["nzClick"], exportAs: ["nzMenu"] }, { kind: "component", type: i1$2.NzMenuItemComponent, selector: "[nz-menu-item]", inputs: ["nzPaddingLeft", "nzDisabled", "nzSelected", "nzDanger", "nzMatchRouterExact", "nzMatchRouter"], exportAs: ["nzMenuItem"] }, { kind: "directive", type: i2.NzDropDownDirective, selector: "[nz-dropdown]", inputs: ["nzDropdownMenu", "nzTrigger", "nzMatchWidthElement", "nzBackdrop", "nzClickHide", "nzDisabled", "nzVisible", "nzOverlayClassName", "nzOverlayStyle", "nzPlacement"], outputs: ["nzVisibleChange"], exportAs: ["nzDropdown"] }, { kind: "component", type: i2.NzDropdownMenuComponent, selector: "nz-dropdown-menu", exportAs: ["nzDropdownMenu"] }, { kind: "ngmodule", type: NzIconModule }, { kind: "directive", type: i1.NzIconDirective, selector: "[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { kind: "pipe", type: I18nPipe, name: "i18n" }, { kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
350
+ }
351
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.6", ngImport: i0, type: YunzaiHeaderI18nComponent, decorators: [{
352
+ type: Component,
353
+ args: [{
354
+ selector: `yunzai-header-i18n`,
355
+ template: `
356
+ @if (showLangText) {
357
+ <div nz-dropdown [nzDropdownMenu]="langMenu" nzPlacement="bottomRight">
358
+ <i nz-icon nzType="global"></i>
359
+ {{ 'lang.nav' | i18n }}
360
+ <i nz-icon nzType="down"></i>
361
+ </div>
362
+ } @else {
363
+ <i nz-dropdown [nzDropdownMenu]="langMenu" nzPlacement="bottomRight" nz-icon nzType="global"></i>
364
+ }
365
+ <nz-dropdown-menu data-event-id="_nav_lang" #langMenu="nzDropdownMenu">
366
+ <ul nz-menu>
367
+ @for (item of langs; track item) {
368
+ <li
369
+ data-event-id="_nav_lang"
370
+ [attr.data-text]="item.text"
371
+ nz-menu-item
372
+ [nzSelected]="item.code === curLangCode"
373
+ (click)="change(item.code)"
374
+ >
375
+ @if (!item.icon) {
376
+ <span role="img" [attr.aria-label]="item.text" class="pr-xs">{{ item.abbr }}</span>
377
+ } @else {
378
+ <img
379
+ style="margin-right:4px"
380
+ width="50px"
381
+ height="30px"
382
+ [src]="'data:image/png;base64,' + item.icon"
383
+ [alt]="item.abbr"
384
+ class="pr-xs"
385
+ />
386
+ }
387
+ {{ item.text }}
388
+ </li>
389
+ }
390
+ </ul>
391
+ </nz-dropdown-menu>
392
+ `,
393
+ host: {
394
+ '[class.flex-1]': 'true'
395
+ },
396
+ standalone: true,
397
+ changeDetection: ChangeDetectionStrategy.OnPush,
398
+ imports: [NzDropDownModule, NzIconModule, I18nPipe, CommonModule]
399
+ }]
400
+ }], propDecorators: { showLangText: [{
401
+ type: Input,
402
+ args: [{ transform: booleanAttribute }]
403
+ }] } });
404
+
405
+ class YunzaiHeaderUserComponent {
406
+ constructor() {
407
+ this.msg = inject(NzMessageService);
408
+ this.tokenService = inject(YA_SERVICE_TOKEN);
409
+ this.configService = inject(YunzaiConfigService);
410
+ this.config = mergeBisConfig(this.configService);
411
+ this.win = inject(WINDOW);
412
+ this.icon = '';
413
+ this.username = '';
414
+ this.menus = [];
415
+ }
416
+ ngOnInit() {
417
+ const [, getProjectInfo] = useLocalStorageProjectInfo();
418
+ const [, getUser] = useLocalStorageUser();
419
+ const projectInfo = getProjectInfo();
420
+ const user = getUser();
421
+ this.username = user.realname ? user.realname : '未命名';
422
+ this.icon = user.avatarId
423
+ ? `${this.config.baseUrl}/filecenter/file/${user.avatarId}`
424
+ : `./assets/tmp/img/avatar.jpg`;
425
+ this.menus = projectInfo.profileList;
426
+ }
427
+ logout() {
428
+ localStorage.clear();
429
+ this.tokenService.clear();
430
+ this.win.location.href = `${this.config.baseUrl}/cas-proxy/app/logout`;
431
+ }
432
+ to(href) {
433
+ if (href) {
434
+ this.win.open(href);
435
+ }
436
+ else {
437
+ this.msg.error('该菜单没有配置链接!');
438
+ }
439
+ }
440
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.6", ngImport: i0, type: YunzaiHeaderUserComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
441
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.6", type: YunzaiHeaderUserComponent, isStandalone: true, selector: "yunzai-header-user", ngImport: i0, template: `
442
+ <div
443
+ class="yunzai-default__nav-item d-flex align-items-center px-sm"
444
+ data-event-id="_nav_user"
445
+ nz-dropdown
446
+ nzPlacement="bottomRight"
447
+ [nzDropdownMenu]="userMenu"
448
+ >
449
+ <div class="yz-user-name">
450
+ <nz-avatar [nzSrc]="icon" nzSize="small" class="mr-sm" />
451
+ {{ username }}
452
+ </div>
453
+ </div>
454
+ <nz-dropdown-menu #userMenu="nzDropdownMenu">
455
+ <div nz-menu class="width-sm">
456
+ @for (m of menus; track m) {
457
+ <div data-event-id="_nav_user" [attr.data-name]="m.name | i18n" nz-menu-item (click)="to(m.url)">
458
+ <i nz-icon [nzType]="m.icon" class="mr-sm"></i>
459
+ {{ m.name | i18n }}
460
+ </div>
461
+ }
462
+ <li nz-menu-divider></li>
463
+ <div data-event-id="_nav_user" data-name="注销登录" nz-menu-item (click)="logout()">
464
+ <i nz-icon nzType="logout" class="mr-sm"></i>
465
+ {{ 'logout' | i18n }}
466
+ </div>
467
+ </div>
468
+ </nz-dropdown-menu>
469
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: NzDropDownModule }, { kind: "directive", type: i1$2.NzMenuDirective, selector: "[nz-menu]", inputs: ["nzInlineIndent", "nzTheme", "nzMode", "nzInlineCollapsed", "nzSelectable"], outputs: ["nzClick"], exportAs: ["nzMenu"] }, { kind: "component", type: i1$2.NzMenuItemComponent, selector: "[nz-menu-item]", inputs: ["nzPaddingLeft", "nzDisabled", "nzSelected", "nzDanger", "nzMatchRouterExact", "nzMatchRouter"], exportAs: ["nzMenuItem"] }, { kind: "directive", type: i1$2.NzMenuDividerDirective, selector: "[nz-menu-divider]", exportAs: ["nzMenuDivider"] }, { kind: "directive", type: i2.NzDropDownDirective, selector: "[nz-dropdown]", inputs: ["nzDropdownMenu", "nzTrigger", "nzMatchWidthElement", "nzBackdrop", "nzClickHide", "nzDisabled", "nzVisible", "nzOverlayClassName", "nzOverlayStyle", "nzPlacement"], outputs: ["nzVisibleChange"], exportAs: ["nzDropdown"] }, { kind: "component", type: i2.NzDropdownMenuComponent, selector: "nz-dropdown-menu", exportAs: ["nzDropdownMenu"] }, { kind: "pipe", type: I18nPipe, name: "i18n" }, { kind: "ngmodule", type: NzIconModule }, { kind: "directive", type: i1.NzIconDirective, selector: "[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { kind: "ngmodule", type: NzAvatarModule }, { kind: "component", type: i4.NzAvatarComponent, selector: "nz-avatar", inputs: ["nzShape", "nzSize", "nzGap", "nzText", "nzSrc", "nzSrcSet", "nzAlt", "nzIcon"], outputs: ["nzError"], exportAs: ["nzAvatar"] }, { kind: "ngmodule", type: RouterModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
470
+ }
471
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.6", ngImport: i0, type: YunzaiHeaderUserComponent, decorators: [{
472
+ type: Component,
473
+ args: [{
474
+ selector: `yunzai-header-user`,
475
+ template: `
476
+ <div
477
+ class="yunzai-default__nav-item d-flex align-items-center px-sm"
478
+ data-event-id="_nav_user"
479
+ nz-dropdown
480
+ nzPlacement="bottomRight"
481
+ [nzDropdownMenu]="userMenu"
482
+ >
483
+ <div class="yz-user-name">
484
+ <nz-avatar [nzSrc]="icon" nzSize="small" class="mr-sm" />
485
+ {{ username }}
486
+ </div>
487
+ </div>
488
+ <nz-dropdown-menu #userMenu="nzDropdownMenu">
489
+ <div nz-menu class="width-sm">
490
+ @for (m of menus; track m) {
491
+ <div data-event-id="_nav_user" [attr.data-name]="m.name | i18n" nz-menu-item (click)="to(m.url)">
492
+ <i nz-icon [nzType]="m.icon" class="mr-sm"></i>
493
+ {{ m.name | i18n }}
494
+ </div>
495
+ }
496
+ <li nz-menu-divider></li>
497
+ <div data-event-id="_nav_user" data-name="注销登录" nz-menu-item (click)="logout()">
498
+ <i nz-icon nzType="logout" class="mr-sm"></i>
499
+ {{ 'logout' | i18n }}
500
+ </div>
501
+ </div>
502
+ </nz-dropdown-menu>
503
+ `,
504
+ standalone: true,
505
+ imports: [NzDropDownModule, I18nPipe, NzIconModule, NzAvatarModule, RouterModule],
506
+ changeDetection: ChangeDetectionStrategy.OnPush
507
+ }]
508
+ }] });
509
+
510
+ const COMPONENTS = [
511
+ YunzaiHeaderClearStorageComponent,
512
+ YunzaiHeaderFullScreenComponent,
513
+ YunzaiHeaderNotifyComponent,
514
+ YunzaiHeaderI18nComponent,
515
+ YunzaiHeaderUserComponent
516
+ ];
517
+ class YunzaiWidgetsModule {
518
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.6", ngImport: i0, type: YunzaiWidgetsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
519
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.0.6", ngImport: i0, type: YunzaiWidgetsModule, imports: [NzAvatarModule,
520
+ RouterModule,
521
+ NoticeIconModule,
522
+ NzDropDownModule,
523
+ CommonModule,
524
+ NzIconModule,
525
+ I18nPipe, YunzaiHeaderClearStorageComponent,
526
+ YunzaiHeaderFullScreenComponent,
527
+ YunzaiHeaderNotifyComponent,
528
+ YunzaiHeaderI18nComponent,
529
+ YunzaiHeaderUserComponent], exports: [YunzaiHeaderClearStorageComponent,
530
+ YunzaiHeaderFullScreenComponent,
531
+ YunzaiHeaderNotifyComponent,
532
+ YunzaiHeaderI18nComponent,
533
+ YunzaiHeaderUserComponent] }); }
534
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.0.6", ngImport: i0, type: YunzaiWidgetsModule, imports: [NzAvatarModule,
535
+ RouterModule,
536
+ NoticeIconModule,
537
+ NzDropDownModule,
538
+ CommonModule,
539
+ NzIconModule, COMPONENTS] }); }
540
+ }
541
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.6", ngImport: i0, type: YunzaiWidgetsModule, decorators: [{
542
+ type: NgModule,
543
+ args: [{
544
+ imports: [
545
+ NzAvatarModule,
546
+ RouterModule,
547
+ NoticeIconModule,
548
+ NzDropDownModule,
549
+ CommonModule,
550
+ NzIconModule,
551
+ I18nPipe,
552
+ ...COMPONENTS
553
+ ],
554
+ exports: COMPONENTS
555
+ }]
556
+ }] });
557
+
558
+ /**
559
+ * Generated bundle index. Do not edit.
560
+ */
561
+
562
+ export { YunzaiHeaderClearStorageComponent, YunzaiHeaderFullScreenComponent, YunzaiHeaderI18nComponent, YunzaiHeaderNotifyComponent, YunzaiHeaderUserComponent, YunzaiWidgetsModule };
563
+ //# sourceMappingURL=yunzai-widgets.mjs.map