@yelon/bis 12.0.10 → 12.0.11

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 (62) hide show
  1. package/LICENSE +21 -21
  2. package/bis.d.ts +4 -4
  3. package/bundles/bis.umd.js +7 -7
  4. package/bundles/layout.umd.js +1609 -1609
  5. package/bundles/shared.umd.js +1225 -1225
  6. package/esm2015/bis.js +4 -4
  7. package/esm2015/layout/bis.config.js +10 -10
  8. package/esm2015/layout/layout.js +5 -5
  9. package/esm2015/layout/layout.module.js +34 -34
  10. package/esm2015/layout/public_api.js +10 -10
  11. package/esm2015/layout/stomp.config.js +19 -19
  12. package/esm2015/layout/widgets/index.js +7 -7
  13. package/esm2015/layout/widgets/yz.application.component.js +132 -132
  14. package/esm2015/layout/widgets/yz.clear-storage.component.js +35 -35
  15. package/esm2015/layout/widgets/yz.fullscreen.component.js +32 -32
  16. package/esm2015/layout/widgets/yz.i18n.component.js +50 -50
  17. package/esm2015/layout/widgets/yz.notify.component.js +143 -143
  18. package/esm2015/layout/widgets/yz.them-btn.component.js +106 -106
  19. package/esm2015/layout/widgets/yz.user.component.js +57 -57
  20. package/esm2015/layout/yz.auth.service.js +157 -157
  21. package/esm2015/layout/yz.basic.component.js +40 -40
  22. package/esm2015/layout/yz.default.interceptor.js +191 -191
  23. package/esm2015/layout/yz.i18n.service.js +103 -103
  24. package/esm2015/layout/yz.startup.service.js +137 -137
  25. package/esm2015/layout/yz.stomp.service.js +90 -90
  26. package/esm2015/public_api.js +1 -1
  27. package/esm2015/shared/public_api.js +4 -4
  28. package/esm2015/shared/shared-yelon.module.js +107 -107
  29. package/esm2015/shared/shared-zorro.module.js +78 -78
  30. package/esm2015/shared/shared.js +4 -4
  31. package/esm2015/shared/shared.module.js +15 -15
  32. package/esm2015/shared/style-icons.js +795 -795
  33. package/fesm2015/bis.js +2 -2
  34. package/fesm2015/layout.js +1207 -1207
  35. package/fesm2015/shared.js +901 -901
  36. package/layout/bis.config.d.ts +3 -3
  37. package/layout/layout.d.ts +5 -5
  38. package/layout/layout.module.d.ts +2 -2
  39. package/layout/public_api.d.ts +10 -10
  40. package/layout/stomp.config.d.ts +3 -3
  41. package/layout/widgets/index.d.ts +7 -7
  42. package/layout/widgets/yz.application.component.d.ts +45 -45
  43. package/layout/widgets/yz.clear-storage.component.d.ts +8 -8
  44. package/layout/widgets/yz.fullscreen.component.d.ts +6 -6
  45. package/layout/widgets/yz.i18n.component.d.ts +19 -19
  46. package/layout/widgets/yz.notify.component.d.ts +25 -25
  47. package/layout/widgets/yz.them-btn.component.d.ts +29 -29
  48. package/layout/widgets/yz.user.component.d.ts +25 -25
  49. package/layout/yz.auth.service.d.ts +19 -19
  50. package/layout/yz.basic.component.d.ts +15 -15
  51. package/layout/yz.default.interceptor.d.ts +25 -25
  52. package/layout/yz.i18n.service.d.ts +24 -24
  53. package/layout/yz.startup.service.d.ts +31 -31
  54. package/layout/yz.stomp.service.d.ts +39 -39
  55. package/package.json +10 -10
  56. package/public_api.d.ts +2 -2
  57. package/shared/public_api.d.ts +4 -4
  58. package/shared/shared-yelon.module.d.ts +3 -3
  59. package/shared/shared-zorro.module.d.ts +2 -2
  60. package/shared/shared.d.ts +4 -4
  61. package/shared/shared.module.d.ts +2 -2
  62. package/shared/style-icons.d.ts +1 -1
@@ -1,8 +1,8 @@
1
- /**
2
- * @license ng-yunzai(devcui@outlook.com) v12.0.10
3
- * (c) 2020 devcui https://github.com/hbyunzai/yelon/
4
- * License: MIT
5
- */
1
+ /**
2
+ * @license ng-yunzai(devcui@outlook.com) v12.0.11
3
+ * (c) 2020 devcui https://github.com/hbyunzai/yelon/
4
+ * License: MIT
5
+ */
6
6
  (function (global, factory) {
7
7
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@yelon/cache'), require('@yelon/theme'), require('@yelon/util'), require('@angular/cdk/platform'), require('@angular/common'), require('@angular/common/locales/en'), require('@angular/common/locales/zh'), require('@angular/common/locales/zh-Hant'), require('date-fns/locale'), require('ng-zorro-antd/i18n'), require('@yelon/util/config'), require('@yelon/util/decorator'), require('rxjs'), require('rxjs/operators'), require('date-fns'), require('ng-zorro-antd/message'), require('@yelon/util/other'), require('@angular/cdk/bidi'), require('@yelon/theme/theme-btn'), require('@yelon/auth'), require('ng-zorro-antd/modal'), require('screenfull'), require('@angular/common/http'), require('@angular/forms'), require('@angular/router'), require('@yelon/bis/shared'), require('@stomp/rx-stomp'), require('ng-zorro-antd/notification'), require('ng-zorro-antd/icon'), require('@yelon/acl')) :
8
8
  typeof define === 'function' && define.amd ? define('@yelon/bis/layout', ['exports', '@angular/core', '@yelon/cache', '@yelon/theme', '@yelon/util', '@angular/cdk/platform', '@angular/common', '@angular/common/locales/en', '@angular/common/locales/zh', '@angular/common/locales/zh-Hant', 'date-fns/locale', 'ng-zorro-antd/i18n', '@yelon/util/config', '@yelon/util/decorator', 'rxjs', 'rxjs/operators', 'date-fns', 'ng-zorro-antd/message', '@yelon/util/other', '@angular/cdk/bidi', '@yelon/theme/theme-btn', '@yelon/auth', 'ng-zorro-antd/modal', 'screenfull', '@angular/common/http', '@angular/forms', '@angular/router', '@yelon/bis/shared', '@stomp/rx-stomp', 'ng-zorro-antd/notification', 'ng-zorro-antd/icon', '@yelon/acl'], factory) :
@@ -41,1644 +41,1644 @@
41
41
  var screenfull__namespace = /*#__PURE__*/_interopNamespace(screenfull);
42
42
  var i3__namespace$1 = /*#__PURE__*/_interopNamespace(i3$1);
43
43
 
44
- /*! *****************************************************************************
45
- Copyright (c) Microsoft Corporation.
46
-
47
- Permission to use, copy, modify, and/or distribute this software for any
48
- purpose with or without fee is hereby granted.
49
-
50
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
51
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
52
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
53
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
54
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
55
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
56
- PERFORMANCE OF THIS SOFTWARE.
57
- ***************************************************************************** */
58
- /* global Reflect, Promise */
59
- var extendStatics = function (d, b) {
60
- extendStatics = Object.setPrototypeOf ||
61
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
62
- function (d, b) { for (var p in b)
63
- if (Object.prototype.hasOwnProperty.call(b, p))
64
- d[p] = b[p]; };
65
- return extendStatics(d, b);
66
- };
67
- function __extends(d, b) {
68
- if (typeof b !== "function" && b !== null)
69
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
70
- extendStatics(d, b);
71
- function __() { this.constructor = d; }
72
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
73
- }
74
- var __assign = function () {
75
- __assign = Object.assign || function __assign(t) {
76
- for (var s, i = 1, n = arguments.length; i < n; i++) {
77
- s = arguments[i];
78
- for (var p in s)
79
- if (Object.prototype.hasOwnProperty.call(s, p))
80
- t[p] = s[p];
81
- }
82
- return t;
83
- };
84
- return __assign.apply(this, arguments);
85
- };
86
- function __rest(s, e) {
87
- var t = {};
88
- for (var p in s)
89
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
90
- t[p] = s[p];
91
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
92
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
93
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
94
- t[p[i]] = s[p[i]];
95
- }
96
- return t;
97
- }
98
- function __decorate(decorators, target, key, desc) {
99
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
100
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
101
- r = Reflect.decorate(decorators, target, key, desc);
102
- else
103
- for (var i = decorators.length - 1; i >= 0; i--)
104
- if (d = decorators[i])
105
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
106
- return c > 3 && r && Object.defineProperty(target, key, r), r;
107
- }
108
- function __param(paramIndex, decorator) {
109
- return function (target, key) { decorator(target, key, paramIndex); };
110
- }
111
- function __metadata(metadataKey, metadataValue) {
112
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
113
- return Reflect.metadata(metadataKey, metadataValue);
114
- }
115
- function __awaiter(thisArg, _arguments, P, generator) {
116
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
117
- return new (P || (P = Promise))(function (resolve, reject) {
118
- function fulfilled(value) { try {
119
- step(generator.next(value));
120
- }
121
- catch (e) {
122
- reject(e);
123
- } }
124
- function rejected(value) { try {
125
- step(generator["throw"](value));
126
- }
127
- catch (e) {
128
- reject(e);
129
- } }
130
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
131
- step((generator = generator.apply(thisArg, _arguments || [])).next());
132
- });
133
- }
134
- function __generator(thisArg, body) {
135
- var _ = { label: 0, sent: function () { if (t[0] & 1)
136
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
137
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
138
- function verb(n) { return function (v) { return step([n, v]); }; }
139
- function step(op) {
140
- if (f)
141
- throw new TypeError("Generator is already executing.");
142
- while (_)
143
- try {
144
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
145
- return t;
146
- if (y = 0, t)
147
- op = [op[0] & 2, t.value];
148
- switch (op[0]) {
149
- case 0:
150
- case 1:
151
- t = op;
152
- break;
153
- case 4:
154
- _.label++;
155
- return { value: op[1], done: false };
156
- case 5:
157
- _.label++;
158
- y = op[1];
159
- op = [0];
160
- continue;
161
- case 7:
162
- op = _.ops.pop();
163
- _.trys.pop();
164
- continue;
165
- default:
166
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
167
- _ = 0;
168
- continue;
169
- }
170
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
171
- _.label = op[1];
172
- break;
173
- }
174
- if (op[0] === 6 && _.label < t[1]) {
175
- _.label = t[1];
176
- t = op;
177
- break;
178
- }
179
- if (t && _.label < t[2]) {
180
- _.label = t[2];
181
- _.ops.push(op);
182
- break;
183
- }
184
- if (t[2])
185
- _.ops.pop();
186
- _.trys.pop();
187
- continue;
188
- }
189
- op = body.call(thisArg, _);
190
- }
191
- catch (e) {
192
- op = [6, e];
193
- y = 0;
194
- }
195
- finally {
196
- f = t = 0;
197
- }
198
- if (op[0] & 5)
199
- throw op[1];
200
- return { value: op[0] ? op[1] : void 0, done: true };
201
- }
202
- }
203
- var __createBinding = Object.create ? (function (o, m, k, k2) {
204
- if (k2 === undefined)
205
- k2 = k;
206
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
207
- }) : (function (o, m, k, k2) {
208
- if (k2 === undefined)
209
- k2 = k;
210
- o[k2] = m[k];
211
- });
212
- function __exportStar(m, o) {
213
- for (var p in m)
214
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
215
- __createBinding(o, m, p);
216
- }
217
- function __values(o) {
218
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
219
- if (m)
220
- return m.call(o);
221
- if (o && typeof o.length === "number")
222
- return {
223
- next: function () {
224
- if (o && i >= o.length)
225
- o = void 0;
226
- return { value: o && o[i++], done: !o };
227
- }
228
- };
229
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
230
- }
231
- function __read(o, n) {
232
- var m = typeof Symbol === "function" && o[Symbol.iterator];
233
- if (!m)
234
- return o;
235
- var i = m.call(o), r, ar = [], e;
236
- try {
237
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
238
- ar.push(r.value);
239
- }
240
- catch (error) {
241
- e = { error: error };
242
- }
243
- finally {
244
- try {
245
- if (r && !r.done && (m = i["return"]))
246
- m.call(i);
247
- }
248
- finally {
249
- if (e)
250
- throw e.error;
251
- }
252
- }
253
- return ar;
254
- }
255
- /** @deprecated */
256
- function __spread() {
257
- for (var ar = [], i = 0; i < arguments.length; i++)
258
- ar = ar.concat(__read(arguments[i]));
259
- return ar;
260
- }
261
- /** @deprecated */
262
- function __spreadArrays() {
263
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
264
- s += arguments[i].length;
265
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
266
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
267
- r[k] = a[j];
268
- return r;
269
- }
270
- function __spreadArray(to, from, pack) {
271
- if (pack || arguments.length === 2)
272
- for (var i = 0, l = from.length, ar; i < l; i++) {
273
- if (ar || !(i in from)) {
274
- if (!ar)
275
- ar = Array.prototype.slice.call(from, 0, i);
276
- ar[i] = from[i];
277
- }
278
- }
279
- return to.concat(ar || Array.prototype.slice.call(from));
280
- }
281
- function __await(v) {
282
- return this instanceof __await ? (this.v = v, this) : new __await(v);
283
- }
284
- function __asyncGenerator(thisArg, _arguments, generator) {
285
- if (!Symbol.asyncIterator)
286
- throw new TypeError("Symbol.asyncIterator is not defined.");
287
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
288
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
289
- function verb(n) { if (g[n])
290
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
291
- function resume(n, v) { try {
292
- step(g[n](v));
293
- }
294
- catch (e) {
295
- settle(q[0][3], e);
296
- } }
297
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
298
- function fulfill(value) { resume("next", value); }
299
- function reject(value) { resume("throw", value); }
300
- function settle(f, v) { if (f(v), q.shift(), q.length)
301
- resume(q[0][0], q[0][1]); }
302
- }
303
- function __asyncDelegator(o) {
304
- var i, p;
305
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
306
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
307
- }
308
- function __asyncValues(o) {
309
- if (!Symbol.asyncIterator)
310
- throw new TypeError("Symbol.asyncIterator is not defined.");
311
- var m = o[Symbol.asyncIterator], i;
312
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
313
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
314
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
315
- }
316
- function __makeTemplateObject(cooked, raw) {
317
- if (Object.defineProperty) {
318
- Object.defineProperty(cooked, "raw", { value: raw });
319
- }
320
- else {
321
- cooked.raw = raw;
322
- }
323
- return cooked;
324
- }
325
- ;
326
- var __setModuleDefault = Object.create ? (function (o, v) {
327
- Object.defineProperty(o, "default", { enumerable: true, value: v });
328
- }) : function (o, v) {
329
- o["default"] = v;
330
- };
331
- function __importStar(mod) {
332
- if (mod && mod.__esModule)
333
- return mod;
334
- var result = {};
335
- if (mod != null)
336
- for (var k in mod)
337
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
338
- __createBinding(result, mod, k);
339
- __setModuleDefault(result, mod);
340
- return result;
341
- }
342
- function __importDefault(mod) {
343
- return (mod && mod.__esModule) ? mod : { default: mod };
344
- }
345
- function __classPrivateFieldGet(receiver, state, kind, f) {
346
- if (kind === "a" && !f)
347
- throw new TypeError("Private accessor was defined without a getter");
348
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
349
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
350
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
351
- }
352
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
353
- if (kind === "m")
354
- throw new TypeError("Private method is not writable");
355
- if (kind === "a" && !f)
356
- throw new TypeError("Private accessor was defined without a setter");
357
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
358
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
359
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
44
+ /*! *****************************************************************************
45
+ Copyright (c) Microsoft Corporation.
46
+
47
+ Permission to use, copy, modify, and/or distribute this software for any
48
+ purpose with or without fee is hereby granted.
49
+
50
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
51
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
52
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
53
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
54
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
55
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
56
+ PERFORMANCE OF THIS SOFTWARE.
57
+ ***************************************************************************** */
58
+ /* global Reflect, Promise */
59
+ var extendStatics = function (d, b) {
60
+ extendStatics = Object.setPrototypeOf ||
61
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
62
+ function (d, b) { for (var p in b)
63
+ if (Object.prototype.hasOwnProperty.call(b, p))
64
+ d[p] = b[p]; };
65
+ return extendStatics(d, b);
66
+ };
67
+ function __extends(d, b) {
68
+ if (typeof b !== "function" && b !== null)
69
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
70
+ extendStatics(d, b);
71
+ function __() { this.constructor = d; }
72
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
73
+ }
74
+ var __assign = function () {
75
+ __assign = Object.assign || function __assign(t) {
76
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
77
+ s = arguments[i];
78
+ for (var p in s)
79
+ if (Object.prototype.hasOwnProperty.call(s, p))
80
+ t[p] = s[p];
81
+ }
82
+ return t;
83
+ };
84
+ return __assign.apply(this, arguments);
85
+ };
86
+ function __rest(s, e) {
87
+ var t = {};
88
+ for (var p in s)
89
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
90
+ t[p] = s[p];
91
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
92
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
93
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
94
+ t[p[i]] = s[p[i]];
95
+ }
96
+ return t;
97
+ }
98
+ function __decorate(decorators, target, key, desc) {
99
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
100
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
101
+ r = Reflect.decorate(decorators, target, key, desc);
102
+ else
103
+ for (var i = decorators.length - 1; i >= 0; i--)
104
+ if (d = decorators[i])
105
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
106
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
107
+ }
108
+ function __param(paramIndex, decorator) {
109
+ return function (target, key) { decorator(target, key, paramIndex); };
110
+ }
111
+ function __metadata(metadataKey, metadataValue) {
112
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
113
+ return Reflect.metadata(metadataKey, metadataValue);
114
+ }
115
+ function __awaiter(thisArg, _arguments, P, generator) {
116
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
117
+ return new (P || (P = Promise))(function (resolve, reject) {
118
+ function fulfilled(value) { try {
119
+ step(generator.next(value));
120
+ }
121
+ catch (e) {
122
+ reject(e);
123
+ } }
124
+ function rejected(value) { try {
125
+ step(generator["throw"](value));
126
+ }
127
+ catch (e) {
128
+ reject(e);
129
+ } }
130
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
131
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
132
+ });
133
+ }
134
+ function __generator(thisArg, body) {
135
+ var _ = { label: 0, sent: function () { if (t[0] & 1)
136
+ throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
137
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
138
+ function verb(n) { return function (v) { return step([n, v]); }; }
139
+ function step(op) {
140
+ if (f)
141
+ throw new TypeError("Generator is already executing.");
142
+ while (_)
143
+ try {
144
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
145
+ return t;
146
+ if (y = 0, t)
147
+ op = [op[0] & 2, t.value];
148
+ switch (op[0]) {
149
+ case 0:
150
+ case 1:
151
+ t = op;
152
+ break;
153
+ case 4:
154
+ _.label++;
155
+ return { value: op[1], done: false };
156
+ case 5:
157
+ _.label++;
158
+ y = op[1];
159
+ op = [0];
160
+ continue;
161
+ case 7:
162
+ op = _.ops.pop();
163
+ _.trys.pop();
164
+ continue;
165
+ default:
166
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
167
+ _ = 0;
168
+ continue;
169
+ }
170
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
171
+ _.label = op[1];
172
+ break;
173
+ }
174
+ if (op[0] === 6 && _.label < t[1]) {
175
+ _.label = t[1];
176
+ t = op;
177
+ break;
178
+ }
179
+ if (t && _.label < t[2]) {
180
+ _.label = t[2];
181
+ _.ops.push(op);
182
+ break;
183
+ }
184
+ if (t[2])
185
+ _.ops.pop();
186
+ _.trys.pop();
187
+ continue;
188
+ }
189
+ op = body.call(thisArg, _);
190
+ }
191
+ catch (e) {
192
+ op = [6, e];
193
+ y = 0;
194
+ }
195
+ finally {
196
+ f = t = 0;
197
+ }
198
+ if (op[0] & 5)
199
+ throw op[1];
200
+ return { value: op[0] ? op[1] : void 0, done: true };
201
+ }
202
+ }
203
+ var __createBinding = Object.create ? (function (o, m, k, k2) {
204
+ if (k2 === undefined)
205
+ k2 = k;
206
+ Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
207
+ }) : (function (o, m, k, k2) {
208
+ if (k2 === undefined)
209
+ k2 = k;
210
+ o[k2] = m[k];
211
+ });
212
+ function __exportStar(m, o) {
213
+ for (var p in m)
214
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
215
+ __createBinding(o, m, p);
216
+ }
217
+ function __values(o) {
218
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
219
+ if (m)
220
+ return m.call(o);
221
+ if (o && typeof o.length === "number")
222
+ return {
223
+ next: function () {
224
+ if (o && i >= o.length)
225
+ o = void 0;
226
+ return { value: o && o[i++], done: !o };
227
+ }
228
+ };
229
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
230
+ }
231
+ function __read(o, n) {
232
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
233
+ if (!m)
234
+ return o;
235
+ var i = m.call(o), r, ar = [], e;
236
+ try {
237
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
238
+ ar.push(r.value);
239
+ }
240
+ catch (error) {
241
+ e = { error: error };
242
+ }
243
+ finally {
244
+ try {
245
+ if (r && !r.done && (m = i["return"]))
246
+ m.call(i);
247
+ }
248
+ finally {
249
+ if (e)
250
+ throw e.error;
251
+ }
252
+ }
253
+ return ar;
254
+ }
255
+ /** @deprecated */
256
+ function __spread() {
257
+ for (var ar = [], i = 0; i < arguments.length; i++)
258
+ ar = ar.concat(__read(arguments[i]));
259
+ return ar;
260
+ }
261
+ /** @deprecated */
262
+ function __spreadArrays() {
263
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++)
264
+ s += arguments[i].length;
265
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
266
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
267
+ r[k] = a[j];
268
+ return r;
269
+ }
270
+ function __spreadArray(to, from, pack) {
271
+ if (pack || arguments.length === 2)
272
+ for (var i = 0, l = from.length, ar; i < l; i++) {
273
+ if (ar || !(i in from)) {
274
+ if (!ar)
275
+ ar = Array.prototype.slice.call(from, 0, i);
276
+ ar[i] = from[i];
277
+ }
278
+ }
279
+ return to.concat(ar || Array.prototype.slice.call(from));
280
+ }
281
+ function __await(v) {
282
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
283
+ }
284
+ function __asyncGenerator(thisArg, _arguments, generator) {
285
+ if (!Symbol.asyncIterator)
286
+ throw new TypeError("Symbol.asyncIterator is not defined.");
287
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
288
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
289
+ function verb(n) { if (g[n])
290
+ i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
291
+ function resume(n, v) { try {
292
+ step(g[n](v));
293
+ }
294
+ catch (e) {
295
+ settle(q[0][3], e);
296
+ } }
297
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
298
+ function fulfill(value) { resume("next", value); }
299
+ function reject(value) { resume("throw", value); }
300
+ function settle(f, v) { if (f(v), q.shift(), q.length)
301
+ resume(q[0][0], q[0][1]); }
302
+ }
303
+ function __asyncDelegator(o) {
304
+ var i, p;
305
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
306
+ function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
307
+ }
308
+ function __asyncValues(o) {
309
+ if (!Symbol.asyncIterator)
310
+ throw new TypeError("Symbol.asyncIterator is not defined.");
311
+ var m = o[Symbol.asyncIterator], i;
312
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
313
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
314
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
315
+ }
316
+ function __makeTemplateObject(cooked, raw) {
317
+ if (Object.defineProperty) {
318
+ Object.defineProperty(cooked, "raw", { value: raw });
319
+ }
320
+ else {
321
+ cooked.raw = raw;
322
+ }
323
+ return cooked;
324
+ }
325
+ ;
326
+ var __setModuleDefault = Object.create ? (function (o, v) {
327
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
328
+ }) : function (o, v) {
329
+ o["default"] = v;
330
+ };
331
+ function __importStar(mod) {
332
+ if (mod && mod.__esModule)
333
+ return mod;
334
+ var result = {};
335
+ if (mod != null)
336
+ for (var k in mod)
337
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
338
+ __createBinding(result, mod, k);
339
+ __setModuleDefault(result, mod);
340
+ return result;
341
+ }
342
+ function __importDefault(mod) {
343
+ return (mod && mod.__esModule) ? mod : { default: mod };
344
+ }
345
+ function __classPrivateFieldGet(receiver, state, kind, f) {
346
+ if (kind === "a" && !f)
347
+ throw new TypeError("Private accessor was defined without a getter");
348
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
349
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
350
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
351
+ }
352
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
353
+ if (kind === "m")
354
+ throw new TypeError("Private method is not writable");
355
+ if (kind === "a" && !f)
356
+ throw new TypeError("Private accessor was defined without a setter");
357
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
358
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
359
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
360
360
  }
361
361
 
362
- var DEFAULT = 'zh-CN';
363
- var LANGS = {
364
- 'zh-CN': {
365
- text: '简体中文',
366
- ng: ngZh__default["default"],
367
- zorro: i2.zh_CN,
368
- date: locale.zhCN,
369
- yelon: i1.zh_CN,
370
- abbr: '🇨🇳'
371
- },
372
- 'zh-TW': {
373
- text: '繁体中文',
374
- ng: ngZhTw__default["default"],
375
- zorro: i2.zh_TW,
376
- date: locale.zhTW,
377
- yelon: i1.zh_TW,
378
- abbr: '🇭🇰'
379
- },
380
- 'en-US': {
381
- text: 'English',
382
- ng: ngEn__default["default"],
383
- zorro: i2.en_US,
384
- date: locale.enUS,
385
- yelon: i1.en_US,
386
- abbr: '🇬🇧'
387
- }
388
- };
389
- var YzI18NService = /** @class */ (function (_super) {
390
- __extends(YzI18NService, _super);
391
- function YzI18NService(http, settings, nzI18nService, yelonLocaleService, platform, cogSrv) {
392
- var _this = _super.call(this, cogSrv) || this;
393
- _this.http = http;
394
- _this.settings = settings;
395
- _this.nzI18nService = nzI18nService;
396
- _this.yelonLocaleService = yelonLocaleService;
397
- _this.platform = platform;
398
- _this._defaultLang = DEFAULT;
399
- _this._langs = Object.keys(LANGS).map(function (code) {
400
- var item = LANGS[code];
401
- return { code: code, text: item.text, abbr: item.abbr };
402
- });
403
- var defaultLang = _this.getDefaultLang();
404
- if (_this._langs.findIndex(function (w) { return w.code === defaultLang; })) {
405
- _this._defaultLang = defaultLang;
406
- }
407
- return _this;
408
- }
409
- YzI18NService.prototype.getDefaultLang = function () {
410
- if (!this.platform.isBrowser) {
411
- return DEFAULT;
412
- }
413
- if (this.settings.layout.lang) {
414
- return this.settings.layout.lang;
415
- }
416
- var res = (navigator.languages ? navigator.languages[0] : null) || navigator.language;
417
- var arr = res.split('-');
418
- return arr.length <= 1 ? res : arr[0] + "-" + arr[1].toUpperCase();
419
- };
420
- YzI18NService.prototype.loadLangData = function (lang) {
421
- return this.http.get("assets/tmp/i18n/" + lang + ".json");
422
- };
423
- YzI18NService.prototype.use = function (lang, data) {
424
- if (this._currentLang === lang)
425
- return;
426
- this._data = data;
427
- var item = LANGS[lang];
428
- common.registerLocaleData(item.ng);
429
- this.nzI18nService.setLocale(item.zorro);
430
- this.nzI18nService.setDateLocale(item.date);
431
- this.yelonLocaleService.setLocale(item.yelon);
432
- this._currentLang = lang;
433
- this._change$.next(lang);
434
- };
435
- YzI18NService.prototype.getLangs = function () {
436
- return this._langs;
437
- };
438
- return YzI18NService;
439
- }(i1.YunzaiI18nBaseService));
440
- YzI18NService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function YzI18NService_Factory() { return new YzI18NService(i0__namespace.ɵɵinject(i1__namespace._HttpClient), i0__namespace.ɵɵinject(i1__namespace.SettingsService), i0__namespace.ɵɵinject(i2__namespace.NzI18nService), i0__namespace.ɵɵinject(i1__namespace.YelonLocaleService), i0__namespace.ɵɵinject(i3__namespace.Platform), i0__namespace.ɵɵinject(i4__namespace.YunzaiConfigService)); }, token: YzI18NService, providedIn: "root" });
441
- YzI18NService.decorators = [
442
- { type: i0.Injectable, args: [{ providedIn: 'root' },] }
443
- ];
444
- YzI18NService.ctorParameters = function () { return [
445
- { type: i1._HttpClient },
446
- { type: i1.SettingsService },
447
- { type: i2.NzI18nService },
448
- { type: i1.YelonLocaleService },
449
- { type: i3.Platform },
450
- { type: i4.YunzaiConfigService }
362
+ var DEFAULT = 'zh-CN';
363
+ var LANGS = {
364
+ 'zh-CN': {
365
+ text: '简体中文',
366
+ ng: ngZh__default["default"],
367
+ zorro: i2.zh_CN,
368
+ date: locale.zhCN,
369
+ yelon: i1.zh_CN,
370
+ abbr: '🇨🇳'
371
+ },
372
+ 'zh-TW': {
373
+ text: '繁体中文',
374
+ ng: ngZhTw__default["default"],
375
+ zorro: i2.zh_TW,
376
+ date: locale.zhTW,
377
+ yelon: i1.zh_TW,
378
+ abbr: '🇭🇰'
379
+ },
380
+ 'en-US': {
381
+ text: 'English',
382
+ ng: ngEn__default["default"],
383
+ zorro: i2.en_US,
384
+ date: locale.enUS,
385
+ yelon: i1.en_US,
386
+ abbr: '🇬🇧'
387
+ }
388
+ };
389
+ var YzI18NService = /** @class */ (function (_super) {
390
+ __extends(YzI18NService, _super);
391
+ function YzI18NService(http, settings, nzI18nService, yelonLocaleService, platform, cogSrv) {
392
+ var _this = _super.call(this, cogSrv) || this;
393
+ _this.http = http;
394
+ _this.settings = settings;
395
+ _this.nzI18nService = nzI18nService;
396
+ _this.yelonLocaleService = yelonLocaleService;
397
+ _this.platform = platform;
398
+ _this._defaultLang = DEFAULT;
399
+ _this._langs = Object.keys(LANGS).map(function (code) {
400
+ var item = LANGS[code];
401
+ return { code: code, text: item.text, abbr: item.abbr };
402
+ });
403
+ var defaultLang = _this.getDefaultLang();
404
+ if (_this._langs.findIndex(function (w) { return w.code === defaultLang; })) {
405
+ _this._defaultLang = defaultLang;
406
+ }
407
+ return _this;
408
+ }
409
+ YzI18NService.prototype.getDefaultLang = function () {
410
+ if (!this.platform.isBrowser) {
411
+ return DEFAULT;
412
+ }
413
+ if (this.settings.layout.lang) {
414
+ return this.settings.layout.lang;
415
+ }
416
+ var res = (navigator.languages ? navigator.languages[0] : null) || navigator.language;
417
+ var arr = res.split('-');
418
+ return arr.length <= 1 ? res : arr[0] + "-" + arr[1].toUpperCase();
419
+ };
420
+ YzI18NService.prototype.loadLangData = function (lang) {
421
+ return this.http.get("assets/tmp/i18n/" + lang + ".json");
422
+ };
423
+ YzI18NService.prototype.use = function (lang, data) {
424
+ if (this._currentLang === lang)
425
+ return;
426
+ this._data = data;
427
+ var item = LANGS[lang];
428
+ common.registerLocaleData(item.ng);
429
+ this.nzI18nService.setLocale(item.zorro);
430
+ this.nzI18nService.setDateLocale(item.date);
431
+ this.yelonLocaleService.setLocale(item.yelon);
432
+ this._currentLang = lang;
433
+ this._change$.next(lang);
434
+ };
435
+ YzI18NService.prototype.getLangs = function () {
436
+ return this._langs;
437
+ };
438
+ return YzI18NService;
439
+ }(i1.YunzaiI18nBaseService));
440
+ YzI18NService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function YzI18NService_Factory() { return new YzI18NService(i0__namespace.ɵɵinject(i1__namespace._HttpClient), i0__namespace.ɵɵinject(i1__namespace.SettingsService), i0__namespace.ɵɵinject(i2__namespace.NzI18nService), i0__namespace.ɵɵinject(i1__namespace.YelonLocaleService), i0__namespace.ɵɵinject(i3__namespace.Platform), i0__namespace.ɵɵinject(i4__namespace.YunzaiConfigService)); }, token: YzI18NService, providedIn: "root" });
441
+ YzI18NService.decorators = [
442
+ { type: i0.Injectable, args: [{ providedIn: 'root' },] }
443
+ ];
444
+ YzI18NService.ctorParameters = function () { return [
445
+ { type: i1._HttpClient },
446
+ { type: i1.SettingsService },
447
+ { type: i2.NzI18nService },
448
+ { type: i1.YelonLocaleService },
449
+ { type: i3.Platform },
450
+ { type: i4.YunzaiConfigService }
451
451
  ]; };
452
452
 
453
- exports.TOPIC = void 0;
454
- (function (TOPIC) {
455
- TOPIC[TOPIC["FULL"] = 0] = "FULL";
456
- TOPIC[TOPIC["OWN"] = 1] = "OWN";
457
- TOPIC[TOPIC["EVERY"] = 2] = "EVERY";
458
- })(exports.TOPIC || (exports.TOPIC = {}));
459
- var YzHeaderApplicationComponent = /** @class */ (function () {
460
- function YzHeaderApplicationComponent(inject, cacheService, i18n, http) {
461
- this.inject = inject;
462
- this.cacheService = cacheService;
463
- this.i18n = i18n;
464
- this.http = http;
465
- this.T = exports.TOPIC;
466
- this.active = false;
467
- this.topicData = [];
468
- this.listData = [];
469
- this.topic = exports.TOPIC.FULL;
470
- this.searchValue = null;
471
- this.subs = [];
472
- }
473
- YzHeaderApplicationComponent.prototype.ngOnInit = function () {
474
- this.topicData = this.cacheService.get('_yz_header', { mode: 'none' });
475
- this.listData = this.cacheService.get('_yz_header', { mode: 'none' });
476
- };
477
- YzHeaderApplicationComponent.prototype.ngOnDestroy = function () {
478
- this.subs.forEach(function (f) { return f.unsubscribe(); });
479
- };
480
- YzHeaderApplicationComponent.prototype.diffChange = function (flag) {
481
- if (flag) {
482
- this.active = flag;
483
- }
484
- else {
485
- this.active = !this.active;
486
- }
487
- };
488
- YzHeaderApplicationComponent.prototype.initTopic = function (topic) {
489
- this.searchValue = null;
490
- this.listData = this.cacheService.get('_yz_header', { mode: 'none' });
491
- this.topic = topic;
492
- };
493
- YzHeaderApplicationComponent.prototype.full = function () {
494
- this.initTopic(exports.TOPIC.FULL);
495
- };
496
- YzHeaderApplicationComponent.prototype.own = function () {
497
- this.initTopic(exports.TOPIC.OWN);
498
- var temp = this.cacheService.get('_yz_header', { mode: 'none' });
499
- this.listData = temp
500
- .filter(function (topic) {
501
- topic.children = topic.children.filter(function (child) {
502
- return child.auth;
503
- });
504
- return topic;
505
- })
506
- .filter(function (topic) {
507
- return topic.children.length > 0;
508
- });
509
- };
510
- YzHeaderApplicationComponent.prototype.every = function (e) {
511
- this.initTopic(exports.TOPIC.EVERY);
512
- this.choosed = e;
513
- var temp = this.cacheService.get('_yz_header', { mode: 'none' });
514
- this.listData = __spreadArray([], __read(temp.filter(function (t) { return t.key === e.key; })[0].children));
515
- };
516
- YzHeaderApplicationComponent.prototype.onSearch = function () {
517
- var _this = this;
518
- var temp = this.cacheService.get('_yz_header', { mode: 'none' });
519
- // 如果搜索输入的有值
520
- if (this.searchValue) {
521
- // 过滤菜单过滤出搜索的值
522
- this.listData = temp
523
- .filter(function (topic) {
524
- if (_this.i18n.fanyi(topic.name).includes(_this.searchValue)) {
525
- return topic;
526
- }
527
- else {
528
- topic.children = topic.children.filter(function (child) {
529
- return _this.i18n.fanyi(child.name).includes(_this.searchValue);
530
- });
531
- return topic;
532
- }
533
- })
534
- .filter(function (topic) {
535
- return topic.children.length > 0;
536
- });
537
- }
538
- else {
539
- // 如果没有值,取消搜索
540
- this.listData = this.cacheService.get('_yz_header', { mode: 'none' });
541
- }
542
- };
543
- YzHeaderApplicationComponent.prototype.open = function (topic) {
544
- if (topic.key) {
545
- this.subs.push(this.http
546
- .post("/app-manager/web-scan/save", {
547
- appId: topic.key,
548
- createDate: new Date()
549
- })
550
- .subscribe());
551
- }
552
- switch (topic.target) {
553
- case 'href':
554
- this.inject.get(util.WINDOW).location.href = topic.url;
555
- break;
556
- case 'blank':
557
- this.inject.get(util.WINDOW).location.href = topic.url;
558
- break;
559
- case 'target':
560
- this.inject.get(util.WINDOW).location.href = topic.url;
561
- break;
562
- default:
563
- this.inject.get(util.WINDOW).location.href = topic.url;
564
- break;
565
- }
566
- };
567
- return YzHeaderApplicationComponent;
568
- }());
569
- YzHeaderApplicationComponent.decorators = [
570
- { type: i0.Component, args: [{
571
- selector: 'yz-header-application',
572
- template: "\n <!-- template start-->\n <ng-template #search>\n <div nz-row class=\"yz-application-list-search\">\n <nz-input-group [nzPrefix]=\"prefixTemplate\">\n <input\n type=\"text\"\n nz-input\n placeholder=\"{{ 'application.search' | i18n }}\"\n [(ngModel)]=\"searchValue\"\n (ngModelChange)=\"onSearch()\"\n />\n <ng-template #prefixTemplate>\n <i nz-icon nzType=\"search\" nzTheme=\"outline\"></i>\n </ng-template>\n </nz-input-group>\n </div>\n </ng-template>\n <ng-template #ld>\n <div class=\"yz-application-list\">\n <ul>\n <li *ngFor=\"let d of listData\">\n <h5>{{ d.name }}</h5>\n <a href=\"javascript:;\" *ngFor=\"let cd of d.children\" (click)=\"open(cd)\">{{ cd.name }}</a>\n </li>\n </ul>\n </div>\n </ng-template>\n <!-- template end-->\n\n <!-- button start-->\n <div class=\"yunzai-default__nav-item\" (click)=\"diffChange()\"> {{ 'application.button' | i18n }}</div>\n <!-- button end-->\n\n <!-- header start-->\n <div class=\"yz-application\" nz-row *ngIf=\"active\">\n <div nz-col [nzSpan]=\"3\" class=\"yz-application-topic\">\n <div class=\"yz-application-text\" (click)=\"full()\">{{ 'application.all' | i18n }}</div>\n <div class=\"yz-application-text\" (click)=\"own()\">{{ 'application.mine' | i18n }}</div>\n <div class=\"yz-application-text\" *ngFor=\"let d of topicData\" (click)=\"every(d)\">\n {{ d.name }}\n </div>\n </div>\n <div nz-col [nzSpan]=\"21\" [ngSwitch]=\"topic\" class=\"yz-application-container\">\n <div *ngSwitchCase=\"T.FULL\">\n <ng-template [ngTemplateOutlet]=\"search\"></ng-template>\n <ng-template [ngTemplateOutlet]=\"ld\"></ng-template>\n </div>\n <div *ngSwitchCase=\"T.OWN\">\n <ng-template [ngTemplateOutlet]=\"search\"></ng-template>\n <ng-template [ngTemplateOutlet]=\"ld\"></ng-template>\n </div>\n <div *ngSwitchCase=\"T.EVERY\" class=\"yz-application-list\">\n <div class=\"yz-application-list-item\">\n <ul>\n <li *ngFor=\"let d of listData\" (click)=\"open(d)\">\n <a href=\"javascript:;\">\n <h4>{{ d.name }}</h4>\n <p>{{ d.intro }}</p>\n </a>\n </li>\n </ul>\n </div>\n </div>\n </div>\n </div>\n <!-- header end-->\n ",
573
- changeDetection: i0.ChangeDetectionStrategy.OnPush
574
- },] }
575
- ];
576
- YzHeaderApplicationComponent.ctorParameters = function () { return [
577
- { type: i0.Injector },
578
- { type: i2$1.CacheService },
579
- { type: YzI18NService },
580
- { type: i1._HttpClient }
453
+ exports.TOPIC = void 0;
454
+ (function (TOPIC) {
455
+ TOPIC[TOPIC["FULL"] = 0] = "FULL";
456
+ TOPIC[TOPIC["OWN"] = 1] = "OWN";
457
+ TOPIC[TOPIC["EVERY"] = 2] = "EVERY";
458
+ })(exports.TOPIC || (exports.TOPIC = {}));
459
+ var YzHeaderApplicationComponent = /** @class */ (function () {
460
+ function YzHeaderApplicationComponent(inject, cacheService, i18n, http) {
461
+ this.inject = inject;
462
+ this.cacheService = cacheService;
463
+ this.i18n = i18n;
464
+ this.http = http;
465
+ this.T = exports.TOPIC;
466
+ this.active = false;
467
+ this.topicData = [];
468
+ this.listData = [];
469
+ this.topic = exports.TOPIC.FULL;
470
+ this.searchValue = null;
471
+ this.subs = [];
472
+ }
473
+ YzHeaderApplicationComponent.prototype.ngOnInit = function () {
474
+ this.topicData = this.cacheService.get('_yz_header', { mode: 'none' });
475
+ this.listData = this.cacheService.get('_yz_header', { mode: 'none' });
476
+ };
477
+ YzHeaderApplicationComponent.prototype.ngOnDestroy = function () {
478
+ this.subs.forEach(function (f) { return f.unsubscribe(); });
479
+ };
480
+ YzHeaderApplicationComponent.prototype.diffChange = function (flag) {
481
+ if (flag) {
482
+ this.active = flag;
483
+ }
484
+ else {
485
+ this.active = !this.active;
486
+ }
487
+ };
488
+ YzHeaderApplicationComponent.prototype.initTopic = function (topic) {
489
+ this.searchValue = null;
490
+ this.listData = this.cacheService.get('_yz_header', { mode: 'none' });
491
+ this.topic = topic;
492
+ };
493
+ YzHeaderApplicationComponent.prototype.full = function () {
494
+ this.initTopic(exports.TOPIC.FULL);
495
+ };
496
+ YzHeaderApplicationComponent.prototype.own = function () {
497
+ this.initTopic(exports.TOPIC.OWN);
498
+ var temp = this.cacheService.get('_yz_header', { mode: 'none' });
499
+ this.listData = temp
500
+ .filter(function (topic) {
501
+ topic.children = topic.children.filter(function (child) {
502
+ return child.auth;
503
+ });
504
+ return topic;
505
+ })
506
+ .filter(function (topic) {
507
+ return topic.children.length > 0;
508
+ });
509
+ };
510
+ YzHeaderApplicationComponent.prototype.every = function (e) {
511
+ this.initTopic(exports.TOPIC.EVERY);
512
+ this.choosed = e;
513
+ var temp = this.cacheService.get('_yz_header', { mode: 'none' });
514
+ this.listData = __spreadArray([], __read(temp.filter(function (t) { return t.key === e.key; })[0].children));
515
+ };
516
+ YzHeaderApplicationComponent.prototype.onSearch = function () {
517
+ var _this = this;
518
+ var temp = this.cacheService.get('_yz_header', { mode: 'none' });
519
+ // 如果搜索输入的有值
520
+ if (this.searchValue) {
521
+ // 过滤菜单过滤出搜索的值
522
+ this.listData = temp
523
+ .filter(function (topic) {
524
+ if (_this.i18n.fanyi(topic.name).includes(_this.searchValue)) {
525
+ return topic;
526
+ }
527
+ else {
528
+ topic.children = topic.children.filter(function (child) {
529
+ return _this.i18n.fanyi(child.name).includes(_this.searchValue);
530
+ });
531
+ return topic;
532
+ }
533
+ })
534
+ .filter(function (topic) {
535
+ return topic.children.length > 0;
536
+ });
537
+ }
538
+ else {
539
+ // 如果没有值,取消搜索
540
+ this.listData = this.cacheService.get('_yz_header', { mode: 'none' });
541
+ }
542
+ };
543
+ YzHeaderApplicationComponent.prototype.open = function (topic) {
544
+ if (topic.key) {
545
+ this.subs.push(this.http
546
+ .post("/app-manager/web-scan/save", {
547
+ appId: topic.key,
548
+ createDate: new Date()
549
+ })
550
+ .subscribe());
551
+ }
552
+ switch (topic.target) {
553
+ case 'href':
554
+ this.inject.get(util.WINDOW).location.href = topic.url;
555
+ break;
556
+ case 'blank':
557
+ this.inject.get(util.WINDOW).location.href = topic.url;
558
+ break;
559
+ case 'target':
560
+ this.inject.get(util.WINDOW).location.href = topic.url;
561
+ break;
562
+ default:
563
+ this.inject.get(util.WINDOW).location.href = topic.url;
564
+ break;
565
+ }
566
+ };
567
+ return YzHeaderApplicationComponent;
568
+ }());
569
+ YzHeaderApplicationComponent.decorators = [
570
+ { type: i0.Component, args: [{
571
+ selector: 'yz-header-application',
572
+ template: "\n <!-- template start-->\n <ng-template #search>\n <div nz-row class=\"yz-application-list-search\">\n <nz-input-group [nzPrefix]=\"prefixTemplate\">\n <input\n type=\"text\"\n nz-input\n placeholder=\"{{ 'application.search' | i18n }}\"\n [(ngModel)]=\"searchValue\"\n (ngModelChange)=\"onSearch()\"\n />\n <ng-template #prefixTemplate>\n <i nz-icon nzType=\"search\" nzTheme=\"outline\"></i>\n </ng-template>\n </nz-input-group>\n </div>\n </ng-template>\n <ng-template #ld>\n <div class=\"yz-application-list\">\n <ul>\n <li *ngFor=\"let d of listData\">\n <h5>{{ d.name }}</h5>\n <a href=\"javascript:;\" *ngFor=\"let cd of d.children\" (click)=\"open(cd)\">{{ cd.name }}</a>\n </li>\n </ul>\n </div>\n </ng-template>\n <!-- template end-->\n\n <!-- button start-->\n <div class=\"yunzai-default__nav-item\" (click)=\"diffChange()\"> {{ 'application.button' | i18n }}</div>\n <!-- button end-->\n\n <!-- header start-->\n <div class=\"yz-application\" nz-row *ngIf=\"active\">\n <div nz-col [nzSpan]=\"3\" class=\"yz-application-topic\">\n <div class=\"yz-application-text\" (click)=\"full()\">{{ 'application.all' | i18n }}</div>\n <div class=\"yz-application-text\" (click)=\"own()\">{{ 'application.mine' | i18n }}</div>\n <div class=\"yz-application-text\" *ngFor=\"let d of topicData\" (click)=\"every(d)\">\n {{ d.name }}\n </div>\n </div>\n <div nz-col [nzSpan]=\"21\" [ngSwitch]=\"topic\" class=\"yz-application-container\">\n <div *ngSwitchCase=\"T.FULL\">\n <ng-template [ngTemplateOutlet]=\"search\"></ng-template>\n <ng-template [ngTemplateOutlet]=\"ld\"></ng-template>\n </div>\n <div *ngSwitchCase=\"T.OWN\">\n <ng-template [ngTemplateOutlet]=\"search\"></ng-template>\n <ng-template [ngTemplateOutlet]=\"ld\"></ng-template>\n </div>\n <div *ngSwitchCase=\"T.EVERY\" class=\"yz-application-list\">\n <div class=\"yz-application-list-item\">\n <ul>\n <li *ngFor=\"let d of listData\" (click)=\"open(d)\">\n <a href=\"javascript:;\">\n <h4>{{ d.name }}</h4>\n <p>{{ d.intro }}</p>\n </a>\n </li>\n </ul>\n </div>\n </div>\n </div>\n </div>\n <!-- header end-->\n ",
573
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
574
+ },] }
575
+ ];
576
+ YzHeaderApplicationComponent.ctorParameters = function () { return [
577
+ { type: i0.Injector },
578
+ { type: i2$1.CacheService },
579
+ { type: YzI18NService },
580
+ { type: i1._HttpClient }
581
581
  ]; };
582
582
 
583
- var YzHeaderI18NComponent = /** @class */ (function () {
584
- function YzHeaderI18NComponent(settings, i18n, doc) {
585
- this.settings = settings;
586
- this.i18n = i18n;
587
- this.doc = doc;
588
- /** Whether to display language text */
589
- this.showLangText = true;
590
- }
591
- Object.defineProperty(YzHeaderI18NComponent.prototype, "langs", {
592
- get: function () {
593
- return this.i18n.getLangs();
594
- },
595
- enumerable: false,
596
- configurable: true
597
- });
598
- Object.defineProperty(YzHeaderI18NComponent.prototype, "curLangCode", {
599
- get: function () {
600
- return this.settings.layout.lang;
601
- },
602
- enumerable: false,
603
- configurable: true
604
- });
605
- YzHeaderI18NComponent.prototype.change = function (lang) {
606
- var _this = this;
607
- var spinEl = this.doc.createElement('div');
608
- spinEl.setAttribute('class', "page-loading ant-spin ant-spin-lg ant-spin-spinning");
609
- spinEl.innerHTML = "<span class=\"ant-spin-dot ant-spin-dot-spin\"><i></i><i></i><i></i><i></i></span>";
610
- this.doc.body.appendChild(spinEl);
611
- this.i18n.loadLangData(lang).subscribe(function (res) {
612
- _this.i18n.use(lang, res);
613
- _this.settings.setLayout('lang', lang);
614
- setTimeout(function () { return _this.doc.location.reload(); });
615
- });
616
- };
617
- return YzHeaderI18NComponent;
618
- }());
619
- YzHeaderI18NComponent.decorators = [
620
- { type: i0.Component, args: [{
621
- selector: 'yz-header-i18n',
622
- template: "\n <div *ngIf=\"showLangText\" nz-dropdown [nzDropdownMenu]=\"langMenu\" nzPlacement=\"bottomRight\">\n <i nz-icon nzType=\"global\"></i>\n {{ 'menu.lang' | i18n }}\n <i nz-icon nzType=\"down\"></i>\n </div>\n <i\n *ngIf=\"!showLangText\"\n nz-dropdown\n [nzDropdownMenu]=\"langMenu\"\n nzPlacement=\"bottomRight\"\n nz-icon\n nzType=\"global\"\n ></i>\n <nz-dropdown-menu #langMenu=\"nzDropdownMenu\">\n <ul nz-menu>\n <li\n nz-menu-item\n *ngFor=\"let item of langs\"\n [nzSelected]=\"item.code === curLangCode\"\n (click)=\"change(item.code)\"\n >\n <span role=\"img\" [attr.aria-label]=\"item.text\" class=\"pr-xs\">{{ item.abbr }}</span>\n {{ item.text }}\n </li>\n </ul>\n </nz-dropdown-menu>\n ",
623
- changeDetection: i0.ChangeDetectionStrategy.OnPush
624
- },] }
625
- ];
626
- YzHeaderI18NComponent.ctorParameters = function () { return [
627
- { type: i1.SettingsService },
628
- { type: YzI18NService, decorators: [{ type: i0.Inject, args: [i1.YUNZAI_I18N_TOKEN,] }] },
629
- { type: undefined, decorators: [{ type: i0.Inject, args: [common.DOCUMENT,] }] }
630
- ]; };
631
- YzHeaderI18NComponent.propDecorators = {
632
- showLangText: [{ type: i0.Input }]
633
- };
634
- __decorate([
635
- decorator.InputBoolean()
583
+ var YzHeaderI18NComponent = /** @class */ (function () {
584
+ function YzHeaderI18NComponent(settings, i18n, doc) {
585
+ this.settings = settings;
586
+ this.i18n = i18n;
587
+ this.doc = doc;
588
+ /** Whether to display language text */
589
+ this.showLangText = true;
590
+ }
591
+ Object.defineProperty(YzHeaderI18NComponent.prototype, "langs", {
592
+ get: function () {
593
+ return this.i18n.getLangs();
594
+ },
595
+ enumerable: false,
596
+ configurable: true
597
+ });
598
+ Object.defineProperty(YzHeaderI18NComponent.prototype, "curLangCode", {
599
+ get: function () {
600
+ return this.settings.layout.lang;
601
+ },
602
+ enumerable: false,
603
+ configurable: true
604
+ });
605
+ YzHeaderI18NComponent.prototype.change = function (lang) {
606
+ var _this = this;
607
+ var spinEl = this.doc.createElement('div');
608
+ spinEl.setAttribute('class', "page-loading ant-spin ant-spin-lg ant-spin-spinning");
609
+ spinEl.innerHTML = "<span class=\"ant-spin-dot ant-spin-dot-spin\"><i></i><i></i><i></i><i></i></span>";
610
+ this.doc.body.appendChild(spinEl);
611
+ this.i18n.loadLangData(lang).subscribe(function (res) {
612
+ _this.i18n.use(lang, res);
613
+ _this.settings.setLayout('lang', lang);
614
+ setTimeout(function () { return _this.doc.location.reload(); });
615
+ });
616
+ };
617
+ return YzHeaderI18NComponent;
618
+ }());
619
+ YzHeaderI18NComponent.decorators = [
620
+ { type: i0.Component, args: [{
621
+ selector: 'yz-header-i18n',
622
+ template: "\n <div *ngIf=\"showLangText\" nz-dropdown [nzDropdownMenu]=\"langMenu\" nzPlacement=\"bottomRight\">\n <i nz-icon nzType=\"global\"></i>\n {{ 'menu.lang' | i18n }}\n <i nz-icon nzType=\"down\"></i>\n </div>\n <i\n *ngIf=\"!showLangText\"\n nz-dropdown\n [nzDropdownMenu]=\"langMenu\"\n nzPlacement=\"bottomRight\"\n nz-icon\n nzType=\"global\"\n ></i>\n <nz-dropdown-menu #langMenu=\"nzDropdownMenu\">\n <ul nz-menu>\n <li\n nz-menu-item\n *ngFor=\"let item of langs\"\n [nzSelected]=\"item.code === curLangCode\"\n (click)=\"change(item.code)\"\n >\n <span role=\"img\" [attr.aria-label]=\"item.text\" class=\"pr-xs\">{{ item.abbr }}</span>\n {{ item.text }}\n </li>\n </ul>\n </nz-dropdown-menu>\n ",
623
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
624
+ },] }
625
+ ];
626
+ YzHeaderI18NComponent.ctorParameters = function () { return [
627
+ { type: i1.SettingsService },
628
+ { type: YzI18NService, decorators: [{ type: i0.Inject, args: [i1.YUNZAI_I18N_TOKEN,] }] },
629
+ { type: undefined, decorators: [{ type: i0.Inject, args: [common.DOCUMENT,] }] }
630
+ ]; };
631
+ YzHeaderI18NComponent.propDecorators = {
632
+ showLangText: [{ type: i0.Input }]
633
+ };
634
+ __decorate([
635
+ decorator.InputBoolean()
636
636
  ], YzHeaderI18NComponent.prototype, "showLangText", void 0);
637
637
 
638
- var YzHeaderNotifyComponent = /** @class */ (function () {
639
- function YzHeaderNotifyComponent(injector, msg, nzI18n, cdr, httpClient) {
640
- this.injector = injector;
641
- this.msg = msg;
642
- this.nzI18n = nzI18n;
643
- this.cdr = cdr;
644
- this.httpClient = httpClient;
645
- this.data = [
646
- {
647
- key: 'msg',
648
- title: '消息',
649
- list: [],
650
- emptyText: '您已读完所有消息',
651
- emptyImage: './assets/tmp/img/message.svg',
652
- clearText: '清空消息'
653
- },
654
- {
655
- key: 'todo',
656
- title: '待办',
657
- list: [],
658
- emptyText: '你已完成所有待办',
659
- emptyImage: './assets/tmp/img/todo.svg',
660
- clearText: '重新加载'
661
- },
662
- {
663
- key: 'notice',
664
- title: '通知',
665
- list: [],
666
- emptyText: '你已查看所有通知',
667
- emptyImage: './assets/tmp/img/notice.svg',
668
- clearText: '重新加载'
669
- }
670
- ];
671
- this.loading = false;
672
- this.count = 0;
673
- this.subs = [];
674
- }
675
- YzHeaderNotifyComponent.prototype.ngOnInit = function () {
676
- this.loadData();
677
- };
678
- YzHeaderNotifyComponent.prototype.loadData = function () {
679
- var _this = this;
680
- this.count = 0;
681
- this.loading = true;
682
- this.subs.push(rxjs.forkJoin(this.loadTodo(), this.loadMessage()).subscribe(function () {
683
- _this.loading = false;
684
- _this.cdr.detectChanges();
685
- }));
686
- };
687
- YzHeaderNotifyComponent.prototype.loadMessage = function () {
688
- var _this = this;
689
- other.log('notify.component: ', 'fetch message list');
690
- var formatMessageStatus = function (status) {
691
- switch (status) {
692
- case '0':
693
- return { extra: '未读', color: 'red' };
694
- case '1':
695
- return { extra: '已读', color: 'green' };
696
- default:
697
- return { extra: '无状态', color: 'primary' };
698
- }
699
- };
700
- return this.httpClient
701
- .post("/message-center-3/my-msg-and-todo/msg-list", {
702
- pageNum: 1,
703
- pageSize: 10,
704
- status: '0'
705
- })
706
- .pipe(operators.map(function (response) {
707
- var viewMessage = _this.data.filter(function (d) { return d.key === 'msg'; })[0];
708
- viewMessage.list = response.data.list.map(function (m) {
709
- 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: dateFns.formatDistanceToNow(new Date(m.date), { locale: _this.nzI18n.getDateLocale() }) });
710
- });
711
- _this.count += viewMessage.list.length;
712
- }));
713
- };
714
- YzHeaderNotifyComponent.prototype.loadTodo = function () {
715
- var _this = this;
716
- other.log('notify.component: ', 'fetch todo list');
717
- var formatTodoStatus = function (status) {
718
- switch (status) {
719
- case '0':
720
- return { extra: '未开始', color: 'red' };
721
- case '1':
722
- return { extra: '已开始', color: 'green' };
723
- default:
724
- return { extra: '无状态', color: 'primary' };
725
- }
726
- };
727
- return this.httpClient
728
- .post("/message-center-3/my-msg-and-todo/todo-list", {
729
- pageNum: 1,
730
- pageSize: 10,
731
- status: '0'
732
- })
733
- .pipe(operators.map(function (response) {
734
- var viewTodo = _this.data.filter(function (d) { return d.key === 'todo'; })[0];
735
- viewTodo.list = response.data.list.map(function (t) {
736
- 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: dateFns.formatDistanceToNow(new Date(t.date), { locale: _this.nzI18n.getDateLocale() }), extra: formatTodoStatus(t.status).extra, color: formatTodoStatus(t.status).color });
737
- });
738
- _this.count += viewTodo.list.length;
739
- }));
740
- };
741
- YzHeaderNotifyComponent.prototype.clear = function (type) {
742
- var _this = this;
743
- var t = this.data.filter(function (d) { return d.title === type; })[0];
744
- if (t.key == 'msg' || t.key == 'notice') {
745
- this.subs.push(this.httpClient.post("/message-center-3/my-msg-and-todo/msg-clear", {}).subscribe(function (_) {
746
- _this.msg.success("\u6E05\u7A7A\u4E86 " + type);
747
- _this.loadData();
748
- }));
749
- }
750
- if (t.key == 'todo') {
751
- this.loadData();
752
- }
753
- };
754
- YzHeaderNotifyComponent.prototype.select = function (res) {
755
- this.injector.get(util.WINDOW).open(res.item.url);
756
- this.loadData();
757
- };
758
- YzHeaderNotifyComponent.prototype.ngOnDestroy = function () {
759
- this.subs.forEach(function (a) { return a.unsubscribe(); });
760
- };
761
- return YzHeaderNotifyComponent;
762
- }());
763
- YzHeaderNotifyComponent.decorators = [
764
- { type: i0.Component, args: [{
765
- selector: 'yz-header-notify',
766
- template: "\n <notice-icon\n [data]=\"data\"\n [count]=\"count\"\n [loading]=\"loading\"\n btnClass=\"yunzai-default__nav-item\"\n btnIconClass=\"yunzai-default__nav-item-icon\"\n (select)=\"select($event)\"\n (clear)=\"clear($event)\"\n ></notice-icon>\n ",
767
- changeDetection: i0.ChangeDetectionStrategy.OnPush
768
- },] }
769
- ];
770
- YzHeaderNotifyComponent.ctorParameters = function () { return [
771
- { type: i0.Injector },
772
- { type: message.NzMessageService },
773
- { type: i2.NzI18nService },
774
- { type: i0.ChangeDetectorRef },
775
- { type: i1._HttpClient }
638
+ var YzHeaderNotifyComponent = /** @class */ (function () {
639
+ function YzHeaderNotifyComponent(injector, msg, nzI18n, cdr, httpClient) {
640
+ this.injector = injector;
641
+ this.msg = msg;
642
+ this.nzI18n = nzI18n;
643
+ this.cdr = cdr;
644
+ this.httpClient = httpClient;
645
+ this.data = [
646
+ {
647
+ key: 'msg',
648
+ title: '消息',
649
+ list: [],
650
+ emptyText: '您已读完所有消息',
651
+ emptyImage: './assets/tmp/img/message.svg',
652
+ clearText: '清空消息'
653
+ },
654
+ {
655
+ key: 'todo',
656
+ title: '待办',
657
+ list: [],
658
+ emptyText: '你已完成所有待办',
659
+ emptyImage: './assets/tmp/img/todo.svg',
660
+ clearText: '重新加载'
661
+ },
662
+ {
663
+ key: 'notice',
664
+ title: '通知',
665
+ list: [],
666
+ emptyText: '你已查看所有通知',
667
+ emptyImage: './assets/tmp/img/notice.svg',
668
+ clearText: '重新加载'
669
+ }
670
+ ];
671
+ this.loading = false;
672
+ this.count = 0;
673
+ this.subs = [];
674
+ }
675
+ YzHeaderNotifyComponent.prototype.ngOnInit = function () {
676
+ this.loadData();
677
+ };
678
+ YzHeaderNotifyComponent.prototype.loadData = function () {
679
+ var _this = this;
680
+ this.count = 0;
681
+ this.loading = true;
682
+ this.subs.push(rxjs.forkJoin(this.loadTodo(), this.loadMessage()).subscribe(function () {
683
+ _this.loading = false;
684
+ _this.cdr.detectChanges();
685
+ }));
686
+ };
687
+ YzHeaderNotifyComponent.prototype.loadMessage = function () {
688
+ var _this = this;
689
+ other.log('notify.component: ', 'fetch message list');
690
+ var formatMessageStatus = function (status) {
691
+ switch (status) {
692
+ case '0':
693
+ return { extra: '未读', color: 'red' };
694
+ case '1':
695
+ return { extra: '已读', color: 'green' };
696
+ default:
697
+ return { extra: '无状态', color: 'primary' };
698
+ }
699
+ };
700
+ return this.httpClient
701
+ .post("/message-center-3/my-msg-and-todo/msg-list", {
702
+ pageNum: 1,
703
+ pageSize: 10,
704
+ status: '0'
705
+ })
706
+ .pipe(operators.map(function (response) {
707
+ var viewMessage = _this.data.filter(function (d) { return d.key === 'msg'; })[0];
708
+ viewMessage.list = response.data.list.map(function (m) {
709
+ 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: dateFns.formatDistanceToNow(new Date(m.date), { locale: _this.nzI18n.getDateLocale() }) });
710
+ });
711
+ _this.count += viewMessage.list.length;
712
+ }));
713
+ };
714
+ YzHeaderNotifyComponent.prototype.loadTodo = function () {
715
+ var _this = this;
716
+ other.log('notify.component: ', 'fetch todo list');
717
+ var formatTodoStatus = function (status) {
718
+ switch (status) {
719
+ case '0':
720
+ return { extra: '未开始', color: 'red' };
721
+ case '1':
722
+ return { extra: '已开始', color: 'green' };
723
+ default:
724
+ return { extra: '无状态', color: 'primary' };
725
+ }
726
+ };
727
+ return this.httpClient
728
+ .post("/message-center-3/my-msg-and-todo/todo-list", {
729
+ pageNum: 1,
730
+ pageSize: 10,
731
+ status: '0'
732
+ })
733
+ .pipe(operators.map(function (response) {
734
+ var viewTodo = _this.data.filter(function (d) { return d.key === 'todo'; })[0];
735
+ viewTodo.list = response.data.list.map(function (t) {
736
+ 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: dateFns.formatDistanceToNow(new Date(t.date), { locale: _this.nzI18n.getDateLocale() }), extra: formatTodoStatus(t.status).extra, color: formatTodoStatus(t.status).color });
737
+ });
738
+ _this.count += viewTodo.list.length;
739
+ }));
740
+ };
741
+ YzHeaderNotifyComponent.prototype.clear = function (type) {
742
+ var _this = this;
743
+ var t = this.data.filter(function (d) { return d.title === type; })[0];
744
+ if (t.key == 'msg' || t.key == 'notice') {
745
+ this.subs.push(this.httpClient.post("/message-center-3/my-msg-and-todo/msg-clear", {}).subscribe(function (_) {
746
+ _this.msg.success("\u6E05\u7A7A\u4E86 " + type);
747
+ _this.loadData();
748
+ }));
749
+ }
750
+ if (t.key == 'todo') {
751
+ this.loadData();
752
+ }
753
+ };
754
+ YzHeaderNotifyComponent.prototype.select = function (res) {
755
+ this.injector.get(util.WINDOW).open(res.item.url);
756
+ this.loadData();
757
+ };
758
+ YzHeaderNotifyComponent.prototype.ngOnDestroy = function () {
759
+ this.subs.forEach(function (a) { return a.unsubscribe(); });
760
+ };
761
+ return YzHeaderNotifyComponent;
762
+ }());
763
+ YzHeaderNotifyComponent.decorators = [
764
+ { type: i0.Component, args: [{
765
+ selector: 'yz-header-notify',
766
+ template: "\n <notice-icon\n [data]=\"data\"\n [count]=\"count\"\n [loading]=\"loading\"\n btnClass=\"yunzai-default__nav-item\"\n btnIconClass=\"yunzai-default__nav-item-icon\"\n (select)=\"select($event)\"\n (clear)=\"clear($event)\"\n ></notice-icon>\n ",
767
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
768
+ },] }
769
+ ];
770
+ YzHeaderNotifyComponent.ctorParameters = function () { return [
771
+ { type: i0.Injector },
772
+ { type: message.NzMessageService },
773
+ { type: i2.NzI18nService },
774
+ { type: i0.ChangeDetectorRef },
775
+ { type: i1._HttpClient }
776
776
  ]; };
777
777
 
778
- var YzHeaderThemBtnComponent = /** @class */ (function () {
779
- function YzHeaderThemBtnComponent(renderer, configSrv, platform, doc, directionality, KEYS) {
780
- this.renderer = renderer;
781
- this.configSrv = configSrv;
782
- this.platform = platform;
783
- this.doc = doc;
784
- this.directionality = directionality;
785
- this.KEYS = KEYS;
786
- this.theme = 'default';
787
- this.types = [
788
- { key: 'default', text: 'theme.default', color: '#2163ff' },
789
- { key: 'compact', text: 'theme.compact', color: '#2163ff' },
790
- { key: 'dark', text: 'theme.dark', color: '#020202' },
791
- { key: 'yuhong', text: 'theme.yuhong', color: '#C04851' },
792
- { key: 'danjuhuang', text: 'theme.danjuhuang', color: '#FBA414' },
793
- { key: 'xinghuang', text: 'theme.xinghuang', color: '#F28E16' },
794
- { key: 'shilv', text: 'theme.shilv', color: '#57C3C2' },
795
- { key: 'zhulv', text: 'theme.zhulv', color: '#1BA784' },
796
- { key: 'youlan', text: 'theme.youlan', color: '#1781B5' },
797
- { key: 'dianqing', text: 'theme.dianqing', color: '#1661AB' },
798
- { key: 'shangengzi', text: 'theme.shangengzi', color: '#61649F' },
799
- { key: 'shuiniuhui', text: 'theme.shuiniuhui', color: '#2F2F35' }
800
- ];
801
- this.devTips = "When the dark.css file can't be found, you need to run it once: npm run theme";
802
- this.deployUrl = '';
803
- this.destroy$ = new rxjs.Subject();
804
- this.dir = 'ltr';
805
- }
806
- YzHeaderThemBtnComponent.prototype.ngOnInit = function () {
807
- var _this = this;
808
- var _a;
809
- this.dir = this.directionality.value;
810
- (_a = this.directionality.change) === null || _a === void 0 ? void 0 : _a.pipe(operators.takeUntil(this.destroy$)).subscribe(function (direction) {
811
- _this.dir = direction;
812
- });
813
- this.initTheme();
814
- };
815
- YzHeaderThemBtnComponent.prototype.initTheme = function () {
816
- if (!this.platform.isBrowser) {
817
- return;
818
- }
819
- this.theme = localStorage.getItem(this.KEYS) || 'default';
820
- this.updateChartTheme();
821
- this.onThemeChange(this.theme);
822
- };
823
- YzHeaderThemBtnComponent.prototype.updateChartTheme = function () {
824
- this.configSrv.set('chart', { theme: this.theme === 'dark' ? 'dark' : '' });
825
- };
826
- YzHeaderThemBtnComponent.prototype.onThemeChange = function (theme) {
827
- if (!this.platform.isBrowser) {
828
- return;
829
- }
830
- this.theme = theme;
831
- this.renderer.setAttribute(this.doc.body, 'data-theme', theme);
832
- var dom = this.doc.getElementById(this.KEYS);
833
- if (dom) {
834
- dom.remove();
835
- }
836
- localStorage.removeItem(this.KEYS);
837
- if (theme !== 'default') {
838
- var el = this.doc.createElement('link');
839
- el.type = 'text/css';
840
- el.rel = 'stylesheet';
841
- el.id = this.KEYS;
842
- el.href = this.deployUrl + "assets/style." + theme + ".css";
843
- localStorage.setItem(this.KEYS, theme);
844
- this.doc.body.append(el);
845
- }
846
- this.updateChartTheme();
847
- };
848
- YzHeaderThemBtnComponent.prototype.ngOnDestroy = function () {
849
- var el = this.doc.getElementById(this.KEYS);
850
- if (el != null) {
851
- this.doc.body.removeChild(el);
852
- }
853
- this.destroy$.next();
854
- this.destroy$.complete();
855
- };
856
- return YzHeaderThemBtnComponent;
857
- }());
858
- YzHeaderThemBtnComponent.decorators = [
859
- { type: i0.Component, args: [{
860
- selector: 'yz-header-theme-btn',
861
- template: "\n <div\n class=\"yunzai-default__nav-item\"\n nz-dropdown\n [nzDropdownMenu]=\"iconMenu\"\n nzTrigger=\"click\"\n nzPlacement=\"bottomRight\"\n >\n <svg nz-tooltip class=\"anticon\" role=\"img\" width=\"21\" height=\"21\" viewBox=\"0 0 21 21\" fill=\"currentColor\">\n <g fill-rule=\"evenodd\">\n <g fill-rule=\"nonzero\">\n <path\n 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\"\n ></path>\n </g>\n </g>\n </svg>\n </div>\n <nz-dropdown-menu #iconMenu=\"nzDropdownMenu\">\n <ul nz-menu>\n <li\n nz-menu-item\n *ngFor=\"let theme of types\"\n (click)=\"onThemeChange(theme.key)\"\n [style]=\"{ color: theme.color }\"\n >\n <i nz-icon nzType=\"bg-colors\"></i>\n {{ theme.text | i18n }}\n </li>\n </ul>\n <!-- <div nz-menu class=\"wd-xl animated jello\">-->\n <!-- <div nz-row [nzJustify]=\"'space-between'\" [nzAlign]=\"'middle'\" class=\"app-icons\">-->\n <!-- <div nz-col [nzSpan]=\"4\" *ngFor=\"let theme of types\" (click)=\"onThemeChange(theme.key)\">-->\n <!-- <i nz-icon nzType=\"bg-colors\" class=\"text-white\" [style]=\"{ backgroundColor: theme.color }\"></i>-->\n <!-- <span [ngStyle]=\"{ color: theme.color }\">{{ theme.text | i18n }}</span>-->\n <!-- </div>-->\n <!-- </div>-->\n <!-- </div>-->\n </nz-dropdown-menu>\n ",
862
- changeDetection: i0.ChangeDetectionStrategy.OnPush
863
- },] }
864
- ];
865
- YzHeaderThemBtnComponent.ctorParameters = function () { return [
866
- { type: i0.Renderer2 },
867
- { type: i4.YunzaiConfigService },
868
- { type: i3.Platform },
869
- { type: undefined, decorators: [{ type: i0.Inject, args: [common.DOCUMENT,] }] },
870
- { type: bidi.Directionality, decorators: [{ type: i0.Optional }] },
871
- { type: String, decorators: [{ type: i0.Inject, args: [themeBtn.YUNZAI_THEME_BTN_KEYS,] }] }
872
- ]; };
873
- YzHeaderThemBtnComponent.propDecorators = {
874
- types: [{ type: i0.Input }],
875
- devTips: [{ type: i0.Input }],
876
- deployUrl: [{ type: i0.Input }]
778
+ var YzHeaderThemBtnComponent = /** @class */ (function () {
779
+ function YzHeaderThemBtnComponent(renderer, configSrv, platform, doc, directionality, KEYS) {
780
+ this.renderer = renderer;
781
+ this.configSrv = configSrv;
782
+ this.platform = platform;
783
+ this.doc = doc;
784
+ this.directionality = directionality;
785
+ this.KEYS = KEYS;
786
+ this.theme = 'default';
787
+ this.types = [
788
+ { key: 'default', text: 'theme.default', color: '#2163ff' },
789
+ { key: 'compact', text: 'theme.compact', color: '#2163ff' },
790
+ { key: 'dark', text: 'theme.dark', color: '#020202' },
791
+ { key: 'yuhong', text: 'theme.yuhong', color: '#C04851' },
792
+ { key: 'danjuhuang', text: 'theme.danjuhuang', color: '#FBA414' },
793
+ { key: 'xinghuang', text: 'theme.xinghuang', color: '#F28E16' },
794
+ { key: 'shilv', text: 'theme.shilv', color: '#57C3C2' },
795
+ { key: 'zhulv', text: 'theme.zhulv', color: '#1BA784' },
796
+ { key: 'youlan', text: 'theme.youlan', color: '#1781B5' },
797
+ { key: 'dianqing', text: 'theme.dianqing', color: '#1661AB' },
798
+ { key: 'shangengzi', text: 'theme.shangengzi', color: '#61649F' },
799
+ { key: 'shuiniuhui', text: 'theme.shuiniuhui', color: '#2F2F35' }
800
+ ];
801
+ this.devTips = "When the dark.css file can't be found, you need to run it once: npm run theme";
802
+ this.deployUrl = '';
803
+ this.destroy$ = new rxjs.Subject();
804
+ this.dir = 'ltr';
805
+ }
806
+ YzHeaderThemBtnComponent.prototype.ngOnInit = function () {
807
+ var _this = this;
808
+ var _a;
809
+ this.dir = this.directionality.value;
810
+ (_a = this.directionality.change) === null || _a === void 0 ? void 0 : _a.pipe(operators.takeUntil(this.destroy$)).subscribe(function (direction) {
811
+ _this.dir = direction;
812
+ });
813
+ this.initTheme();
814
+ };
815
+ YzHeaderThemBtnComponent.prototype.initTheme = function () {
816
+ if (!this.platform.isBrowser) {
817
+ return;
818
+ }
819
+ this.theme = localStorage.getItem(this.KEYS) || 'default';
820
+ this.updateChartTheme();
821
+ this.onThemeChange(this.theme);
822
+ };
823
+ YzHeaderThemBtnComponent.prototype.updateChartTheme = function () {
824
+ this.configSrv.set('chart', { theme: this.theme === 'dark' ? 'dark' : '' });
825
+ };
826
+ YzHeaderThemBtnComponent.prototype.onThemeChange = function (theme) {
827
+ if (!this.platform.isBrowser) {
828
+ return;
829
+ }
830
+ this.theme = theme;
831
+ this.renderer.setAttribute(this.doc.body, 'data-theme', theme);
832
+ var dom = this.doc.getElementById(this.KEYS);
833
+ if (dom) {
834
+ dom.remove();
835
+ }
836
+ localStorage.removeItem(this.KEYS);
837
+ if (theme !== 'default') {
838
+ var el = this.doc.createElement('link');
839
+ el.type = 'text/css';
840
+ el.rel = 'stylesheet';
841
+ el.id = this.KEYS;
842
+ el.href = this.deployUrl + "assets/style." + theme + ".css";
843
+ localStorage.setItem(this.KEYS, theme);
844
+ this.doc.body.append(el);
845
+ }
846
+ this.updateChartTheme();
847
+ };
848
+ YzHeaderThemBtnComponent.prototype.ngOnDestroy = function () {
849
+ var el = this.doc.getElementById(this.KEYS);
850
+ if (el != null) {
851
+ this.doc.body.removeChild(el);
852
+ }
853
+ this.destroy$.next();
854
+ this.destroy$.complete();
855
+ };
856
+ return YzHeaderThemBtnComponent;
857
+ }());
858
+ YzHeaderThemBtnComponent.decorators = [
859
+ { type: i0.Component, args: [{
860
+ selector: 'yz-header-theme-btn',
861
+ template: "\n <div\n class=\"yunzai-default__nav-item\"\n nz-dropdown\n [nzDropdownMenu]=\"iconMenu\"\n nzTrigger=\"click\"\n nzPlacement=\"bottomRight\"\n >\n <svg nz-tooltip class=\"anticon\" role=\"img\" width=\"21\" height=\"21\" viewBox=\"0 0 21 21\" fill=\"currentColor\">\n <g fill-rule=\"evenodd\">\n <g fill-rule=\"nonzero\">\n <path\n 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\"\n ></path>\n </g>\n </g>\n </svg>\n </div>\n <nz-dropdown-menu #iconMenu=\"nzDropdownMenu\">\n <ul nz-menu>\n <li\n nz-menu-item\n *ngFor=\"let theme of types\"\n (click)=\"onThemeChange(theme.key)\"\n [style]=\"{ color: theme.color }\"\n >\n <i nz-icon nzType=\"bg-colors\"></i>\n {{ theme.text | i18n }}\n </li>\n </ul>\n <!-- <div nz-menu class=\"wd-xl animated jello\">-->\n <!-- <div nz-row [nzJustify]=\"'space-between'\" [nzAlign]=\"'middle'\" class=\"app-icons\">-->\n <!-- <div nz-col [nzSpan]=\"4\" *ngFor=\"let theme of types\" (click)=\"onThemeChange(theme.key)\">-->\n <!-- <i nz-icon nzType=\"bg-colors\" class=\"text-white\" [style]=\"{ backgroundColor: theme.color }\"></i>-->\n <!-- <span [ngStyle]=\"{ color: theme.color }\">{{ theme.text | i18n }}</span>-->\n <!-- </div>-->\n <!-- </div>-->\n <!-- </div>-->\n </nz-dropdown-menu>\n ",
862
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
863
+ },] }
864
+ ];
865
+ YzHeaderThemBtnComponent.ctorParameters = function () { return [
866
+ { type: i0.Renderer2 },
867
+ { type: i4.YunzaiConfigService },
868
+ { type: i3.Platform },
869
+ { type: undefined, decorators: [{ type: i0.Inject, args: [common.DOCUMENT,] }] },
870
+ { type: bidi.Directionality, decorators: [{ type: i0.Optional }] },
871
+ { type: String, decorators: [{ type: i0.Inject, args: [themeBtn.YUNZAI_THEME_BTN_KEYS,] }] }
872
+ ]; };
873
+ YzHeaderThemBtnComponent.propDecorators = {
874
+ types: [{ type: i0.Input }],
875
+ devTips: [{ type: i0.Input }],
876
+ deployUrl: [{ type: i0.Input }]
877
877
  };
878
878
 
879
- var BUSINESS_DEFAULT_CONFIG = {
880
- baseUrl: '/backstage',
881
- systemCode: 'portal',
882
- loginForm: null,
883
- refreshTokenEnabled: true,
884
- refreshTokenType: 're-request'
885
- };
886
- function mergeBisConfig(srv) {
887
- return srv.merge('bis', BUSINESS_DEFAULT_CONFIG);
879
+ var BUSINESS_DEFAULT_CONFIG = {
880
+ baseUrl: '/backstage',
881
+ systemCode: 'portal',
882
+ loginForm: null,
883
+ refreshTokenEnabled: true,
884
+ refreshTokenType: 're-request'
885
+ };
886
+ function mergeBisConfig(srv) {
887
+ return srv.merge('bis', BUSINESS_DEFAULT_CONFIG);
888
888
  }
889
889
 
890
- var YzHeaderUserComponent = /** @class */ (function () {
891
- function YzHeaderUserComponent(injector, msg, tokenService,
892
- // @ts-ignore
893
- configService, cacheService) {
894
- this.injector = injector;
895
- this.msg = msg;
896
- this.tokenService = tokenService;
897
- this.configService = configService;
898
- this.cacheService = cacheService;
899
- this.icon = '';
900
- this.username = '';
901
- this.menus = [];
902
- this.config = mergeBisConfig(configService);
903
- }
904
- YzHeaderUserComponent.prototype.ngOnInit = function () {
905
- var projectInfo = this.cacheService.get('_yz_project_info', { mode: 'none' });
906
- var user = this.cacheService.get('_yz_user', { mode: 'none' });
907
- this.username = user.realname ? user.realname : '未命名';
908
- this.icon = user.avatarId
909
- ? this.config.baseUrl + "/filecenter/file/" + user.avatarId
910
- : "./assets/tmp/img/avatar.jpg";
911
- this.menus = projectInfo.profileList;
912
- };
913
- YzHeaderUserComponent.prototype.logout = function () {
914
- localStorage.clear();
915
- this.tokenService.clear();
916
- this.injector.get(util.WINDOW).location.href = this.config.baseUrl + "/cas-proxy/app/logout";
917
- };
918
- YzHeaderUserComponent.prototype.to = function (href) {
919
- if (href) {
920
- this.injector.get(util.WINDOW).open(href);
921
- }
922
- else {
923
- this.msg.error('该菜单没有配置链接!');
924
- }
925
- };
926
- return YzHeaderUserComponent;
927
- }());
928
- YzHeaderUserComponent.decorators = [
929
- { type: i0.Component, args: [{
930
- selector: 'yz-header-user',
931
- template: "\n <div\n class=\"yunzai-default__nav-item d-flex align-items-center px-sm\"\n nz-dropdown\n nzPlacement=\"bottomRight\"\n [nzDropdownMenu]=\"userMenu\"\n >\n <nz-avatar [nzSrc]=\"icon\" nzSize=\"small\" class=\"mr-sm\"></nz-avatar>\n {{ username }}\n </div>\n <nz-dropdown-menu #userMenu=\"nzDropdownMenu\">\n <div nz-menu class=\"width-sm\">\n <div nz-menu-item *ngFor=\"let m of menus\" (click)=\"to(m.url)\">\n <i nz-icon [nzType]=\"m.icon\" class=\"mr-sm\"></i>\n {{ m.name | i18n }}\n </div>\n <li nz-menu-divider></li>\n <div nz-menu-item (click)=\"logout()\">\n <i nz-icon nzType=\"logout\" class=\"mr-sm\"></i>\n {{ 'menu.account.logout' | i18n }}\n </div>\n </div>\n </nz-dropdown-menu>\n ",
932
- changeDetection: i0.ChangeDetectionStrategy.OnPush
933
- },] }
934
- ];
935
- YzHeaderUserComponent.ctorParameters = function () { return [
936
- { type: i0.Injector },
937
- { type: message.NzMessageService },
938
- { type: undefined, decorators: [{ type: i0.Inject, args: [auth.YA_SERVICE_TOKEN,] }] },
939
- { type: util.YunzaiConfigService },
940
- { type: i2$1.CacheService }
890
+ var YzHeaderUserComponent = /** @class */ (function () {
891
+ function YzHeaderUserComponent(injector, msg, tokenService,
892
+ // @ts-ignore
893
+ configService, cacheService) {
894
+ this.injector = injector;
895
+ this.msg = msg;
896
+ this.tokenService = tokenService;
897
+ this.configService = configService;
898
+ this.cacheService = cacheService;
899
+ this.icon = '';
900
+ this.username = '';
901
+ this.menus = [];
902
+ this.config = mergeBisConfig(configService);
903
+ }
904
+ YzHeaderUserComponent.prototype.ngOnInit = function () {
905
+ var projectInfo = this.cacheService.get('_yz_project_info', { mode: 'none' });
906
+ var user = this.cacheService.get('_yz_user', { mode: 'none' });
907
+ this.username = user.realname ? user.realname : '未命名';
908
+ this.icon = user.avatarId
909
+ ? this.config.baseUrl + "/filecenter/file/" + user.avatarId
910
+ : "./assets/tmp/img/avatar.jpg";
911
+ this.menus = projectInfo.profileList;
912
+ };
913
+ YzHeaderUserComponent.prototype.logout = function () {
914
+ localStorage.clear();
915
+ this.tokenService.clear();
916
+ this.injector.get(util.WINDOW).location.href = this.config.baseUrl + "/cas-proxy/app/logout";
917
+ };
918
+ YzHeaderUserComponent.prototype.to = function (href) {
919
+ if (href) {
920
+ this.injector.get(util.WINDOW).open(href);
921
+ }
922
+ else {
923
+ this.msg.error('该菜单没有配置链接!');
924
+ }
925
+ };
926
+ return YzHeaderUserComponent;
927
+ }());
928
+ YzHeaderUserComponent.decorators = [
929
+ { type: i0.Component, args: [{
930
+ selector: 'yz-header-user',
931
+ template: "\n <div\n class=\"yunzai-default__nav-item d-flex align-items-center px-sm\"\n nz-dropdown\n nzPlacement=\"bottomRight\"\n [nzDropdownMenu]=\"userMenu\"\n >\n <nz-avatar [nzSrc]=\"icon\" nzSize=\"small\" class=\"mr-sm\"></nz-avatar>\n {{ username }}\n </div>\n <nz-dropdown-menu #userMenu=\"nzDropdownMenu\">\n <div nz-menu class=\"width-sm\">\n <div nz-menu-item *ngFor=\"let m of menus\" (click)=\"to(m.url)\">\n <i nz-icon [nzType]=\"m.icon\" class=\"mr-sm\"></i>\n {{ m.name | i18n }}\n </div>\n <li nz-menu-divider></li>\n <div nz-menu-item (click)=\"logout()\">\n <i nz-icon nzType=\"logout\" class=\"mr-sm\"></i>\n {{ 'menu.account.logout' | i18n }}\n </div>\n </div>\n </nz-dropdown-menu>\n ",
932
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
933
+ },] }
934
+ ];
935
+ YzHeaderUserComponent.ctorParameters = function () { return [
936
+ { type: i0.Injector },
937
+ { type: message.NzMessageService },
938
+ { type: undefined, decorators: [{ type: i0.Inject, args: [auth.YA_SERVICE_TOKEN,] }] },
939
+ { type: util.YunzaiConfigService },
940
+ { type: i2$1.CacheService }
941
941
  ]; };
942
942
 
943
- var YzHeaderClearStorageComponent = /** @class */ (function () {
944
- function YzHeaderClearStorageComponent(modalSrv, messageSrv) {
945
- this.modalSrv = modalSrv;
946
- this.messageSrv = messageSrv;
947
- }
948
- YzHeaderClearStorageComponent.prototype._click = function () {
949
- var _this = this;
950
- this.modalSrv.confirm({
951
- nzTitle: 'Make sure clear all local storage?',
952
- nzOnOk: function () {
953
- localStorage.clear();
954
- _this.messageSrv.success('Clear Finished!');
955
- }
956
- });
957
- };
958
- return YzHeaderClearStorageComponent;
959
- }());
960
- YzHeaderClearStorageComponent.decorators = [
961
- { type: i0.Component, args: [{
962
- selector: 'yz-header-clear-storage',
963
- template: "\n <i nz-icon nzType=\"tool\"></i>\n {{ 'menu.clear.local.storage' | i18n }}\n ",
964
- host: {
965
- '[class.d-block]': 'true'
966
- },
967
- changeDetection: i0.ChangeDetectionStrategy.OnPush
968
- },] }
969
- ];
970
- YzHeaderClearStorageComponent.ctorParameters = function () { return [
971
- { type: modal.NzModalService },
972
- { type: message.NzMessageService }
973
- ]; };
974
- YzHeaderClearStorageComponent.propDecorators = {
975
- _click: [{ type: i0.HostListener, args: ['click',] }]
943
+ var YzHeaderClearStorageComponent = /** @class */ (function () {
944
+ function YzHeaderClearStorageComponent(modalSrv, messageSrv) {
945
+ this.modalSrv = modalSrv;
946
+ this.messageSrv = messageSrv;
947
+ }
948
+ YzHeaderClearStorageComponent.prototype._click = function () {
949
+ var _this = this;
950
+ this.modalSrv.confirm({
951
+ nzTitle: 'Make sure clear all local storage?',
952
+ nzOnOk: function () {
953
+ localStorage.clear();
954
+ _this.messageSrv.success('Clear Finished!');
955
+ }
956
+ });
957
+ };
958
+ return YzHeaderClearStorageComponent;
959
+ }());
960
+ YzHeaderClearStorageComponent.decorators = [
961
+ { type: i0.Component, args: [{
962
+ selector: 'yz-header-clear-storage',
963
+ template: "\n <i nz-icon nzType=\"tool\"></i>\n {{ 'menu.clear.local.storage' | i18n }}\n ",
964
+ host: {
965
+ '[class.d-block]': 'true'
966
+ },
967
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
968
+ },] }
969
+ ];
970
+ YzHeaderClearStorageComponent.ctorParameters = function () { return [
971
+ { type: modal.NzModalService },
972
+ { type: message.NzMessageService }
973
+ ]; };
974
+ YzHeaderClearStorageComponent.propDecorators = {
975
+ _click: [{ type: i0.HostListener, args: ['click',] }]
976
976
  };
977
977
 
978
- var YzHeaderFullScreenComponent = /** @class */ (function () {
979
- function YzHeaderFullScreenComponent() {
980
- this.status = false;
981
- }
982
- Object.defineProperty(YzHeaderFullScreenComponent.prototype, "sf", {
983
- get: function () {
984
- return screenfull__namespace;
985
- },
986
- enumerable: false,
987
- configurable: true
988
- });
989
- YzHeaderFullScreenComponent.prototype._resize = function () {
990
- this.status = this.sf.isFullscreen;
991
- };
992
- YzHeaderFullScreenComponent.prototype._click = function () {
993
- if (this.sf.isEnabled) {
994
- this.sf.toggle();
995
- }
996
- };
997
- return YzHeaderFullScreenComponent;
998
- }());
999
- YzHeaderFullScreenComponent.decorators = [
1000
- { type: i0.Component, args: [{
1001
- selector: 'yz-header-fullscreen',
1002
- template: "\n <i nz-icon [nzType]=\"status ? 'fullscreen-exit' : 'fullscreen'\"></i>\n {{ (status ? 'menu.fullscreen.exit' : 'menu.fullscreen') | i18n }}\n ",
1003
- host: {
1004
- '[class.d-block]': 'true'
1005
- },
1006
- changeDetection: i0.ChangeDetectionStrategy.OnPush
1007
- },] }
1008
- ];
1009
- YzHeaderFullScreenComponent.propDecorators = {
1010
- _resize: [{ type: i0.HostListener, args: ['window:resize',] }],
1011
- _click: [{ type: i0.HostListener, args: ['click',] }]
978
+ var YzHeaderFullScreenComponent = /** @class */ (function () {
979
+ function YzHeaderFullScreenComponent() {
980
+ this.status = false;
981
+ }
982
+ Object.defineProperty(YzHeaderFullScreenComponent.prototype, "sf", {
983
+ get: function () {
984
+ return screenfull__namespace;
985
+ },
986
+ enumerable: false,
987
+ configurable: true
988
+ });
989
+ YzHeaderFullScreenComponent.prototype._resize = function () {
990
+ this.status = this.sf.isFullscreen;
991
+ };
992
+ YzHeaderFullScreenComponent.prototype._click = function () {
993
+ if (this.sf.isEnabled) {
994
+ this.sf.toggle();
995
+ }
996
+ };
997
+ return YzHeaderFullScreenComponent;
998
+ }());
999
+ YzHeaderFullScreenComponent.decorators = [
1000
+ { type: i0.Component, args: [{
1001
+ selector: 'yz-header-fullscreen',
1002
+ template: "\n <i nz-icon [nzType]=\"status ? 'fullscreen-exit' : 'fullscreen'\"></i>\n {{ (status ? 'menu.fullscreen.exit' : 'menu.fullscreen') | i18n }}\n ",
1003
+ host: {
1004
+ '[class.d-block]': 'true'
1005
+ },
1006
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
1007
+ },] }
1008
+ ];
1009
+ YzHeaderFullScreenComponent.propDecorators = {
1010
+ _resize: [{ type: i0.HostListener, args: ['window:resize',] }],
1011
+ _click: [{ type: i0.HostListener, args: ['click',] }]
1012
1012
  };
1013
1013
 
1014
- var ɵ0 = function (msg) {
1015
- util.log(msg);
1016
- };
1017
- var STOMP_DEFAULT_CONFIG = {
1018
- connectHeaders: {
1019
- login: 'guest',
1020
- passcode: 'guest'
1021
- },
1022
- brokerURL: '/websocket/ws/',
1023
- heartbeatIncoming: 1000 * 60,
1024
- heartbeatOutgoing: 1000 * 60,
1025
- reconnectDelay: 30000000,
1026
- debug: ɵ0
1027
- };
1028
- function mergeStompConfig(srv) {
1029
- return srv.merge('stomp', STOMP_DEFAULT_CONFIG);
1014
+ var ɵ0 = function (msg) {
1015
+ util.log(msg);
1016
+ };
1017
+ var STOMP_DEFAULT_CONFIG = {
1018
+ connectHeaders: {
1019
+ login: 'guest',
1020
+ passcode: 'guest'
1021
+ },
1022
+ brokerURL: '/websocket/ws/',
1023
+ heartbeatIncoming: 1000 * 60,
1024
+ heartbeatOutgoing: 1000 * 60,
1025
+ reconnectDelay: 30000000,
1026
+ debug: ɵ0
1027
+ };
1028
+ function mergeStompConfig(srv) {
1029
+ return srv.merge('stomp', STOMP_DEFAULT_CONFIG);
1030
1030
  }
1031
1031
 
1032
- var YzStompService = /** @class */ (function () {
1033
- function YzStompService(csr, cache, injector, notification) {
1034
- this.csr = csr;
1035
- this.cache = cache;
1036
- this.injector = injector;
1037
- this.notification = notification;
1038
- this.subs = [];
1039
- if (!this.user) {
1040
- this.user = this.cache.get('_yz_user', { mode: 'none' });
1041
- }
1042
- if (!this.config) {
1043
- this.config = mergeStompConfig(this.csr);
1044
- }
1045
- if (!this.bisConfig) {
1046
- this.bisConfig = mergeBisConfig(csr);
1047
- }
1048
- if (!this.rxStomp) {
1049
- this.rxStomp = new rxStomp.RxStomp();
1050
- if (i0.isDevMode()) {
1051
- util.log('yz.stomp.service: is dev mode');
1052
- util.log('yz.stomp.service: ', "config is " + this.config);
1053
- this.rxStomp.configure(this.config);
1054
- return;
1055
- }
1056
- var location = this.injector.get(common.DOCUMENT).location;
1057
- var protocol = location.protocol, host = location.host;
1058
- util.log('yz.stomp.service: ', "protocol is " + protocol + ",host is " + host);
1059
- if (protocol.includes('http') && !protocol.includes('https')) {
1060
- this.config.brokerURL = "ws://" + host + this.config.brokerURL;
1061
- }
1062
- if (protocol.includes('https')) {
1063
- this.config.brokerURL = "wss://" + host + this.config.brokerURL;
1064
- }
1065
- util.log('yz.stomp.service: ', "config is " + this.config);
1066
- this.rxStomp.configure(this.config);
1067
- }
1068
- }
1069
- YzStompService.prototype.listen = function () {
1070
- var _this = this;
1071
- this.subs.push(this.rxStomp.watch("/topic/layout_" + this.user.username).subscribe(function (message) {
1072
- _this.createNotification(JSON.parse(message.body));
1073
- }));
1074
- this.subs.push(this.rxStomp.watch("/topic/layout_xx_" + this.user.username).subscribe(function (message) {
1075
- _this.logoutNotification(JSON.parse(message.body));
1076
- }));
1077
- this.rxStomp.activate();
1078
- };
1079
- YzStompService.prototype.createNotification = function (message) {
1080
- this.notification.create(message.type, message.title, "<a href=" + message.href + ">" + message.content + "</a>");
1081
- };
1082
- YzStompService.prototype.logoutNotification = function (message) {
1083
- var _this = this;
1084
- this.notification.create(message.type, message.title, message.content + ",\u5269\u4F59\u65F6\u95F45\u79D2");
1085
- setTimeout(function () {
1086
- _this.cache.clear();
1087
- localStorage.clear();
1088
- _this.injector.get(util.WINDOW).location.href = _this.bisConfig.baseUrl + "/cas-proxy/app/logout";
1089
- }, 5000);
1090
- };
1091
- YzStompService.prototype.unListen = function () {
1092
- this.subs.forEach(function (s) { return s.unsubscribe(); });
1093
- this.rxStomp.deactivate().then();
1094
- };
1095
- YzStompService.prototype.publish = function (parameters) {
1096
- this.rxStomp.publish(parameters);
1097
- };
1098
- YzStompService.prototype.watch = function (destination, headers) {
1099
- return this.rxStomp.watch(destination, headers);
1100
- };
1101
- return YzStompService;
1102
- }());
1103
- YzStompService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function YzStompService_Factory() { return new YzStompService(i0__namespace.ɵɵinject(i4__namespace.YunzaiConfigService), i0__namespace.ɵɵinject(i2__namespace$1.CacheService), i0__namespace.ɵɵinject(i0__namespace.INJECTOR), i0__namespace.ɵɵinject(i3__namespace$1.NzNotificationService)); }, token: YzStompService, providedIn: "root" });
1104
- YzStompService.decorators = [
1105
- { type: i0.Injectable, args: [{ providedIn: 'root' },] }
1106
- ];
1107
- YzStompService.ctorParameters = function () { return [
1108
- { type: util.YunzaiConfigService },
1109
- { type: i2$1.CacheService },
1110
- { type: i0.Injector },
1111
- { type: i3$1.NzNotificationService }
1032
+ var YzStompService = /** @class */ (function () {
1033
+ function YzStompService(csr, cache, injector, notification) {
1034
+ this.csr = csr;
1035
+ this.cache = cache;
1036
+ this.injector = injector;
1037
+ this.notification = notification;
1038
+ this.subs = [];
1039
+ if (!this.user) {
1040
+ this.user = this.cache.get('_yz_user', { mode: 'none' });
1041
+ }
1042
+ if (!this.config) {
1043
+ this.config = mergeStompConfig(this.csr);
1044
+ }
1045
+ if (!this.bisConfig) {
1046
+ this.bisConfig = mergeBisConfig(csr);
1047
+ }
1048
+ if (!this.rxStomp) {
1049
+ this.rxStomp = new rxStomp.RxStomp();
1050
+ if (i0.isDevMode()) {
1051
+ util.log('yz.stomp.service: is dev mode');
1052
+ util.log('yz.stomp.service: ', "config is " + this.config);
1053
+ this.rxStomp.configure(this.config);
1054
+ return;
1055
+ }
1056
+ var location = this.injector.get(common.DOCUMENT).location;
1057
+ var protocol = location.protocol, host = location.host;
1058
+ util.log('yz.stomp.service: ', "protocol is " + protocol + ",host is " + host);
1059
+ if (protocol.includes('http') && !protocol.includes('https')) {
1060
+ this.config.brokerURL = "ws://" + host + this.config.brokerURL;
1061
+ }
1062
+ if (protocol.includes('https')) {
1063
+ this.config.brokerURL = "wss://" + host + this.config.brokerURL;
1064
+ }
1065
+ util.log('yz.stomp.service: ', "config is " + this.config);
1066
+ this.rxStomp.configure(this.config);
1067
+ }
1068
+ }
1069
+ YzStompService.prototype.listen = function () {
1070
+ var _this = this;
1071
+ this.subs.push(this.rxStomp.watch("/topic/layout_" + this.user.username).subscribe(function (message) {
1072
+ _this.createNotification(JSON.parse(message.body));
1073
+ }));
1074
+ this.subs.push(this.rxStomp.watch("/topic/layout_xx_" + this.user.username).subscribe(function (message) {
1075
+ _this.logoutNotification(JSON.parse(message.body));
1076
+ }));
1077
+ this.rxStomp.activate();
1078
+ };
1079
+ YzStompService.prototype.createNotification = function (message) {
1080
+ this.notification.create(message.type, message.title, "<a href=" + message.href + ">" + message.content + "</a>");
1081
+ };
1082
+ YzStompService.prototype.logoutNotification = function (message) {
1083
+ var _this = this;
1084
+ this.notification.create(message.type, message.title, message.content + ",\u5269\u4F59\u65F6\u95F45\u79D2");
1085
+ setTimeout(function () {
1086
+ _this.cache.clear();
1087
+ localStorage.clear();
1088
+ _this.injector.get(util.WINDOW).location.href = _this.bisConfig.baseUrl + "/cas-proxy/app/logout";
1089
+ }, 5000);
1090
+ };
1091
+ YzStompService.prototype.unListen = function () {
1092
+ this.subs.forEach(function (s) { return s.unsubscribe(); });
1093
+ this.rxStomp.deactivate().then();
1094
+ };
1095
+ YzStompService.prototype.publish = function (parameters) {
1096
+ this.rxStomp.publish(parameters);
1097
+ };
1098
+ YzStompService.prototype.watch = function (destination, headers) {
1099
+ return this.rxStomp.watch(destination, headers);
1100
+ };
1101
+ return YzStompService;
1102
+ }());
1103
+ YzStompService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function YzStompService_Factory() { return new YzStompService(i0__namespace.ɵɵinject(i4__namespace.YunzaiConfigService), i0__namespace.ɵɵinject(i2__namespace$1.CacheService), i0__namespace.ɵɵinject(i0__namespace.INJECTOR), i0__namespace.ɵɵinject(i3__namespace$1.NzNotificationService)); }, token: YzStompService, providedIn: "root" });
1104
+ YzStompService.decorators = [
1105
+ { type: i0.Injectable, args: [{ providedIn: 'root' },] }
1106
+ ];
1107
+ YzStompService.ctorParameters = function () { return [
1108
+ { type: util.YunzaiConfigService },
1109
+ { type: i2$1.CacheService },
1110
+ { type: i0.Injector },
1111
+ { type: i3$1.NzNotificationService }
1112
1112
  ]; };
1113
1113
 
1114
- var YzLayoutBasicComponent = /** @class */ (function () {
1115
- function YzLayoutBasicComponent(cacheService, yzStompService) {
1116
- this.cacheService = cacheService;
1117
- this.yzStompService = yzStompService;
1118
- this.options = {
1119
- logoExpanded: "./assets/logo-full.svg",
1120
- logoCollapsed: "./assets/logo.svg"
1121
- };
1122
- this.intro = '';
1123
- this.text = '';
1124
- this.icon = '';
1125
- }
1126
- YzLayoutBasicComponent.prototype.ngOnInit = function () {
1127
- var current = this.cacheService.get('_yz_current', { mode: 'none' });
1128
- var project = this.cacheService.get('_yz_project_info', { mode: 'none' });
1129
- this.text = current.text ? current.text : '应用名称';
1130
- this.intro = current.intro ? current.intro : '应用描述';
1131
- this.icon = current.icon ? current.icon : "./assets/tmp/img/avatar.jpg";
1132
- this.options.logoExpanded = project.maxLogoUrl ? project.maxLogoUrl : "./assets/logo-full.svg";
1133
- this.options.logoCollapsed = project.miniLogoUrl ? project.miniLogoUrl : "./assets/logo.svg";
1134
- this.yzStompService.listen();
1135
- };
1136
- YzLayoutBasicComponent.prototype.ngOnDestroy = function () {
1137
- this.yzStompService.unListen();
1138
- };
1139
- return YzLayoutBasicComponent;
1140
- }());
1141
- YzLayoutBasicComponent.decorators = [
1142
- { type: i0.Component, args: [{
1143
- selector: 'yz-layout-basic',
1144
- template: "\n <layout-default [options]=\"options\" [asideUser]=\"asideUserTpl\" [content]=\"contentTpl\">\n <layout-default-header-item direction=\"left\">\n <yz-header-application></yz-header-application>\n </layout-default-header-item>\n\n <layout-default-header-item direction=\"right\" hidden=\"mobile\">\n <yz-header-notify></yz-header-notify>\n </layout-default-header-item>\n\n <layout-default-header-item direction=\"right\" hidden=\"mobile\">\n <yz-header-theme-btn></yz-header-theme-btn>\n </layout-default-header-item>\n\n <layout-default-header-item direction=\"right\" hidden=\"mobile\">\n <div\n layout-default-header-item-trigger\n nz-dropdown\n [nzDropdownMenu]=\"settingsMenu\"\n nzTrigger=\"click\"\n nzPlacement=\"bottomRight\"\n >\n <i nz-icon nzType=\"setting\"></i>\n </div>\n <nz-dropdown-menu #settingsMenu=\"nzDropdownMenu\">\n <div nz-menu style=\"width: 200px;\">\n <div nz-menu-item>\n <yz-header-fullscreen></yz-header-fullscreen>\n </div>\n <div nz-menu-item>\n <yz-header-clear-storage></yz-header-clear-storage>\n </div>\n <div nz-menu-item>\n <yz-header-i18n></yz-header-i18n>\n </div>\n </div>\n </nz-dropdown-menu>\n </layout-default-header-item>\n <layout-default-header-item direction=\"right\">\n <yz-header-user></yz-header-user>\n </layout-default-header-item>\n <ng-template #asideUserTpl>\n <div nz-dropdown nzTrigger=\"click\" [nzDropdownMenu]=\"userMenu\" class=\"yunzai-default__aside-user\">\n <nz-avatar class=\"yunzai-default__aside-user-avatar\" [nzSrc]=\"icon\"></nz-avatar>\n <div class=\"yunzai-default__aside-user-info\">\n <strong>{{ text }}</strong>\n <p class=\"mb0\">{{ intro }}</p>\n </div>\n </div>\n <nz-dropdown-menu #userMenu=\"nzDropdownMenu\">\n <ul nz-menu>\n <li nz-menu-item routerLink=\"/\">{{ 'menu.backtohome' | i18n }}</li>\n </ul>\n </nz-dropdown-menu>\n </ng-template>\n <ng-template #contentTpl>\n <reuse-tab #reuseTab></reuse-tab>\n <router-outlet (activate)=\"reuseTab.activate($event)\"></router-outlet>\n </ng-template>\n </layout-default>\n ",
1145
- changeDetection: i0.ChangeDetectionStrategy.OnPush
1146
- },] }
1147
- ];
1148
- YzLayoutBasicComponent.ctorParameters = function () { return [
1149
- { type: i2$1.CacheService },
1150
- { type: YzStompService }
1114
+ var YzLayoutBasicComponent = /** @class */ (function () {
1115
+ function YzLayoutBasicComponent(cacheService, yzStompService) {
1116
+ this.cacheService = cacheService;
1117
+ this.yzStompService = yzStompService;
1118
+ this.options = {
1119
+ logoExpanded: "./assets/logo-full.svg",
1120
+ logoCollapsed: "./assets/logo.svg"
1121
+ };
1122
+ this.intro = '';
1123
+ this.text = '';
1124
+ this.icon = '';
1125
+ }
1126
+ YzLayoutBasicComponent.prototype.ngOnInit = function () {
1127
+ var current = this.cacheService.get('_yz_current', { mode: 'none' });
1128
+ var project = this.cacheService.get('_yz_project_info', { mode: 'none' });
1129
+ this.text = current.text ? current.text : '应用名称';
1130
+ this.intro = current.intro ? current.intro : '应用描述';
1131
+ this.icon = current.icon ? current.icon : "./assets/tmp/img/avatar.jpg";
1132
+ this.options.logoExpanded = project.maxLogoUrl ? project.maxLogoUrl : "./assets/logo-full.svg";
1133
+ this.options.logoCollapsed = project.miniLogoUrl ? project.miniLogoUrl : "./assets/logo.svg";
1134
+ this.yzStompService.listen();
1135
+ };
1136
+ YzLayoutBasicComponent.prototype.ngOnDestroy = function () {
1137
+ this.yzStompService.unListen();
1138
+ };
1139
+ return YzLayoutBasicComponent;
1140
+ }());
1141
+ YzLayoutBasicComponent.decorators = [
1142
+ { type: i0.Component, args: [{
1143
+ selector: 'yz-layout-basic',
1144
+ template: "\n <layout-default [options]=\"options\" [asideUser]=\"asideUserTpl\" [content]=\"contentTpl\">\n <layout-default-header-item direction=\"left\">\n <yz-header-application></yz-header-application>\n </layout-default-header-item>\n\n <layout-default-header-item direction=\"right\" hidden=\"mobile\">\n <yz-header-notify></yz-header-notify>\n </layout-default-header-item>\n\n <layout-default-header-item direction=\"right\" hidden=\"mobile\">\n <yz-header-theme-btn></yz-header-theme-btn>\n </layout-default-header-item>\n\n <layout-default-header-item direction=\"right\" hidden=\"mobile\">\n <div\n layout-default-header-item-trigger\n nz-dropdown\n [nzDropdownMenu]=\"settingsMenu\"\n nzTrigger=\"click\"\n nzPlacement=\"bottomRight\"\n >\n <i nz-icon nzType=\"setting\"></i>\n </div>\n <nz-dropdown-menu #settingsMenu=\"nzDropdownMenu\">\n <div nz-menu style=\"width: 200px;\">\n <div nz-menu-item>\n <yz-header-fullscreen></yz-header-fullscreen>\n </div>\n <div nz-menu-item>\n <yz-header-clear-storage></yz-header-clear-storage>\n </div>\n <div nz-menu-item>\n <yz-header-i18n></yz-header-i18n>\n </div>\n </div>\n </nz-dropdown-menu>\n </layout-default-header-item>\n <layout-default-header-item direction=\"right\">\n <yz-header-user></yz-header-user>\n </layout-default-header-item>\n <ng-template #asideUserTpl>\n <div nz-dropdown nzTrigger=\"click\" [nzDropdownMenu]=\"userMenu\" class=\"yunzai-default__aside-user\">\n <nz-avatar class=\"yunzai-default__aside-user-avatar\" [nzSrc]=\"icon\"></nz-avatar>\n <div class=\"yunzai-default__aside-user-info\">\n <strong>{{ text }}</strong>\n <p class=\"mb0\">{{ intro }}</p>\n </div>\n </div>\n <nz-dropdown-menu #userMenu=\"nzDropdownMenu\">\n <ul nz-menu>\n <li nz-menu-item routerLink=\"/\">{{ 'menu.backtohome' | i18n }}</li>\n </ul>\n </nz-dropdown-menu>\n </ng-template>\n <ng-template #contentTpl>\n <reuse-tab #reuseTab></reuse-tab>\n <router-outlet (activate)=\"reuseTab.activate($event)\"></router-outlet>\n </ng-template>\n </layout-default>\n ",
1145
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
1146
+ },] }
1147
+ ];
1148
+ YzLayoutBasicComponent.ctorParameters = function () { return [
1149
+ { type: i2$1.CacheService },
1150
+ { type: YzStompService }
1151
1151
  ]; };
1152
1152
 
1153
- var COMPONENTS = [
1154
- YzLayoutBasicComponent,
1155
- YzHeaderApplicationComponent,
1156
- YzHeaderNotifyComponent,
1157
- YzHeaderThemBtnComponent,
1158
- YzHeaderUserComponent,
1159
- YzHeaderFullScreenComponent,
1160
- YzHeaderClearStorageComponent,
1161
- YzHeaderI18NComponent
1162
- ];
1163
- var YunzaiLayoutModule = /** @class */ (function () {
1164
- function YunzaiLayoutModule() {
1165
- }
1166
- return YunzaiLayoutModule;
1167
- }());
1168
- YunzaiLayoutModule.decorators = [
1169
- { type: i0.NgModule, args: [{
1170
- imports: [http.HttpClientModule, common.CommonModule, forms.FormsModule, router.RouterModule, forms.ReactiveFormsModule, shared.YzSharedModule],
1171
- providers: [
1172
- {
1173
- provide: themeBtn.YUNZAI_THEME_BTN_KEYS,
1174
- useValue: 'site-theme'
1175
- }
1176
- ],
1177
- declarations: __spreadArray([], __read(COMPONENTS)),
1178
- exports: __spreadArray([], __read(COMPONENTS))
1179
- },] }
1153
+ var COMPONENTS = [
1154
+ YzLayoutBasicComponent,
1155
+ YzHeaderApplicationComponent,
1156
+ YzHeaderNotifyComponent,
1157
+ YzHeaderThemBtnComponent,
1158
+ YzHeaderUserComponent,
1159
+ YzHeaderFullScreenComponent,
1160
+ YzHeaderClearStorageComponent,
1161
+ YzHeaderI18NComponent
1162
+ ];
1163
+ var YunzaiLayoutModule = /** @class */ (function () {
1164
+ function YunzaiLayoutModule() {
1165
+ }
1166
+ return YunzaiLayoutModule;
1167
+ }());
1168
+ YunzaiLayoutModule.decorators = [
1169
+ { type: i0.NgModule, args: [{
1170
+ imports: [http.HttpClientModule, common.CommonModule, forms.FormsModule, router.RouterModule, forms.ReactiveFormsModule, shared.YzSharedModule],
1171
+ providers: [
1172
+ {
1173
+ provide: themeBtn.YUNZAI_THEME_BTN_KEYS,
1174
+ useValue: 'site-theme'
1175
+ }
1176
+ ],
1177
+ declarations: __spreadArray([], __read(COMPONENTS)),
1178
+ exports: __spreadArray([], __read(COMPONENTS))
1179
+ },] }
1180
1180
  ];
1181
1181
 
1182
- var YzAuthService = /** @class */ (function () {
1183
- function YzAuthService(injector) {
1184
- this.injector = injector;
1185
- this.option = auth.mergeConfig(this.csr);
1186
- this.bis = mergeBisConfig(this.csr);
1187
- }
1188
- Object.defineProperty(YzAuthService.prototype, "csr", {
1189
- get: function () {
1190
- return this.injector.get(i4.YunzaiConfigService);
1191
- },
1192
- enumerable: false,
1193
- configurable: true
1194
- });
1195
- Object.defineProperty(YzAuthService.prototype, "tokenService", {
1196
- get: function () {
1197
- return this.injector.get(auth.YA_SERVICE_TOKEN);
1198
- },
1199
- enumerable: false,
1200
- configurable: true
1201
- });
1202
- Object.defineProperty(YzAuthService.prototype, "httpClient", {
1203
- get: function () {
1204
- return this.injector.get(i1._HttpClient);
1205
- },
1206
- enumerable: false,
1207
- configurable: true
1208
- });
1209
- Object.defineProperty(YzAuthService.prototype, "cacheService", {
1210
- get: function () {
1211
- return this.injector.get(i2$1.CacheService);
1212
- },
1213
- enumerable: false,
1214
- configurable: true
1215
- });
1216
- YzAuthService.prototype.askToken = function () {
1217
- var _a;
1218
- other.log('yz.auth.service: ', 'askToken');
1219
- if ((_a = this.tokenService.get()) === null || _a === void 0 ? void 0 : _a.token) {
1220
- return rxjs.of(this.tokenService.get());
1221
- }
1222
- else {
1223
- if (this.bis.loginForm) {
1224
- return this.fetchTokenByUP();
1225
- }
1226
- else {
1227
- return this.fetchTokenByCas();
1228
- }
1229
- }
1230
- };
1231
- YzAuthService.prototype.fetchTokenByUP = function () {
1232
- other.log('yz.auth.service: ', 'fetchTokenByUP');
1233
- return this.httpClient.post("/auth/oauth/token?_allow_anonymous=true", this.bis.loginForm).pipe(operators.map(function (response) {
1234
- var access_token = response.access_token, expires_in = response.expires_in, refresh_token = response.refresh_token, scope = response.scope, token_type = response.token_type;
1235
- return {
1236
- token: access_token,
1237
- expired: expires_in,
1238
- refreshToken: refresh_token,
1239
- tokenType: token_type,
1240
- scope: scope
1241
- };
1242
- }));
1243
- };
1244
- YzAuthService.prototype.fetchTokenByCas = function () {
1245
- var _this = this;
1246
- other.log('yz.auth.service: ', 'fetchTokenByCas');
1247
- var uri = encodeURIComponent(this.injector.get(util.WINDOW).location.href);
1248
- return this.httpClient
1249
- .get("/cas-proxy/app/validate_full?callback=" + uri + "&_allow_anonymous=true&timestamp=" + new Date().getTime())
1250
- .pipe(operators.map(function (response) {
1251
- switch (response.errcode) {
1252
- case 2000:
1253
- var _b = response.data, access_token = _b.access_token, expires_in = _b.expires_in, refresh_token = _b.refresh_token, scope = _b.scope, token_type = _b.token_type;
1254
- return {
1255
- token: access_token,
1256
- expired: expires_in,
1257
- refreshToken: refresh_token,
1258
- tokenType: token_type,
1259
- scope: scope
1260
- };
1261
- case 2001:
1262
- _this.injector.get(util.WINDOW).location.href = response.msg;
1263
- throw Error("Cookie Error: Can't find Cas Cookie,So jump to login!");
1264
- default:
1265
- if (response.data) {
1266
- console.error(response.data);
1267
- throw Error(response.data);
1268
- }
1269
- else if (response.msg) {
1270
- console.error(response.msg);
1271
- throw Error(response.msg);
1272
- }
1273
- else {
1274
- console.error('cas unknown error');
1275
- throw Error('Unknown Error: Cas auth exception!');
1276
- }
1277
- }
1278
- }));
1279
- };
1280
- YzAuthService.prototype.login = function () {
1281
- var _this = this;
1282
- other.log('yz.auth.service: ', 'login white login form->', this.bis.loginForm);
1283
- return this.askToken().pipe(operators.mergeMap(function (token) {
1284
- other.log('yz.auth.service: get token->', token);
1285
- _this.csr.set('auth', {
1286
- token_send_key: 'Authorization',
1287
- token_send_template: token.tokenType + " ${token}",
1288
- token_send_place: 'header'
1289
- });
1290
- other.log('yz.auth.service: ', 'set token');
1291
- _this.tokenService.set(token);
1292
- return _this.cacheInit();
1293
- }), operators.mergeAll());
1294
- };
1295
- YzAuthService.prototype.cacheInit = function () {
1296
- var _this = this;
1297
- other.log('yz.auth.service: ', 'cacheInit');
1298
- var user = this.cacheService.get('_yz_user', { mode: 'none' });
1299
- var header = this.cacheService.get('_yz_header', { mode: 'none' });
1300
- var project = this.cacheService.get('_yz_project_info', { mode: 'none' });
1301
- return rxjs.forkJoin(rxjs.of(user), rxjs.of(header), rxjs.of(project)).pipe(operators.mergeMap(function (_b) {
1302
- var _c = __read(_b, 3), u = _c[0], h = _c[1], p = _c[2];
1303
- var list = [];
1304
- // user cache
1305
- if (!u) {
1306
- other.log('yz.auth.service: ', 'fetch user cache');
1307
- list.push(_this.httpClient.get("/auth/user").pipe(operators.map(function (user) {
1308
- _this.cacheService.set('_yz_user', user.principal);
1309
- })));
1310
- }
1311
- else {
1312
- other.log('yz.auth.service: ', 'user recache');
1313
- list.push(rxjs.of(function () { }));
1314
- }
1315
- // header cache
1316
- if (!h) {
1317
- other.log('yz.auth.service: ', 'fetch header cache');
1318
- list.push(_this.httpClient.get("/auth/allheader/v2").pipe(operators.map(function (header) {
1319
- _this.cacheService.set('_yz_header', header.data);
1320
- })));
1321
- }
1322
- else {
1323
- other.log('yz.auth.service: ', 'header recache');
1324
- list.push(rxjs.of(function () { }));
1325
- }
1326
- // project cache
1327
- if (!p) {
1328
- other.log('yz.auth.service: ', 'fetch project cache');
1329
- list.push(_this.httpClient.get("/app-manager/project/info").pipe(operators.map(function (info) {
1330
- _this.cacheService.set('_yz_project_info', info.data);
1331
- })));
1332
- }
1333
- else {
1334
- other.log('yz.auth.service: ', 'project recache');
1335
- list.push(rxjs.of(function () { }));
1336
- }
1337
- return rxjs.forkJoin(list);
1338
- }));
1339
- };
1340
- return YzAuthService;
1341
- }());
1342
- YzAuthService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function YzAuthService_Factory() { return new YzAuthService(i0__namespace.ɵɵinject(i0__namespace.INJECTOR)); }, token: YzAuthService, providedIn: "root" });
1343
- YzAuthService.decorators = [
1344
- { type: i0.Injectable, args: [{ providedIn: 'root' },] }
1345
- ];
1346
- YzAuthService.ctorParameters = function () { return [
1347
- { type: i0.Injector }
1182
+ var YzAuthService = /** @class */ (function () {
1183
+ function YzAuthService(injector) {
1184
+ this.injector = injector;
1185
+ this.option = auth.mergeConfig(this.csr);
1186
+ this.bis = mergeBisConfig(this.csr);
1187
+ }
1188
+ Object.defineProperty(YzAuthService.prototype, "csr", {
1189
+ get: function () {
1190
+ return this.injector.get(i4.YunzaiConfigService);
1191
+ },
1192
+ enumerable: false,
1193
+ configurable: true
1194
+ });
1195
+ Object.defineProperty(YzAuthService.prototype, "tokenService", {
1196
+ get: function () {
1197
+ return this.injector.get(auth.YA_SERVICE_TOKEN);
1198
+ },
1199
+ enumerable: false,
1200
+ configurable: true
1201
+ });
1202
+ Object.defineProperty(YzAuthService.prototype, "httpClient", {
1203
+ get: function () {
1204
+ return this.injector.get(i1._HttpClient);
1205
+ },
1206
+ enumerable: false,
1207
+ configurable: true
1208
+ });
1209
+ Object.defineProperty(YzAuthService.prototype, "cacheService", {
1210
+ get: function () {
1211
+ return this.injector.get(i2$1.CacheService);
1212
+ },
1213
+ enumerable: false,
1214
+ configurable: true
1215
+ });
1216
+ YzAuthService.prototype.askToken = function () {
1217
+ var _a;
1218
+ other.log('yz.auth.service: ', 'askToken');
1219
+ if ((_a = this.tokenService.get()) === null || _a === void 0 ? void 0 : _a.token) {
1220
+ return rxjs.of(this.tokenService.get());
1221
+ }
1222
+ else {
1223
+ if (this.bis.loginForm) {
1224
+ return this.fetchTokenByUP();
1225
+ }
1226
+ else {
1227
+ return this.fetchTokenByCas();
1228
+ }
1229
+ }
1230
+ };
1231
+ YzAuthService.prototype.fetchTokenByUP = function () {
1232
+ other.log('yz.auth.service: ', 'fetchTokenByUP');
1233
+ return this.httpClient.post("/auth/oauth/token?_allow_anonymous=true", this.bis.loginForm).pipe(operators.map(function (response) {
1234
+ var access_token = response.access_token, expires_in = response.expires_in, refresh_token = response.refresh_token, scope = response.scope, token_type = response.token_type;
1235
+ return {
1236
+ token: access_token,
1237
+ expired: expires_in,
1238
+ refreshToken: refresh_token,
1239
+ tokenType: token_type,
1240
+ scope: scope
1241
+ };
1242
+ }));
1243
+ };
1244
+ YzAuthService.prototype.fetchTokenByCas = function () {
1245
+ var _this = this;
1246
+ other.log('yz.auth.service: ', 'fetchTokenByCas');
1247
+ var uri = encodeURIComponent(this.injector.get(util.WINDOW).location.href);
1248
+ return this.httpClient
1249
+ .get("/cas-proxy/app/validate_full?callback=" + uri + "&_allow_anonymous=true&timestamp=" + new Date().getTime())
1250
+ .pipe(operators.map(function (response) {
1251
+ switch (response.errcode) {
1252
+ case 2000:
1253
+ var _b = response.data, access_token = _b.access_token, expires_in = _b.expires_in, refresh_token = _b.refresh_token, scope = _b.scope, token_type = _b.token_type;
1254
+ return {
1255
+ token: access_token,
1256
+ expired: expires_in,
1257
+ refreshToken: refresh_token,
1258
+ tokenType: token_type,
1259
+ scope: scope
1260
+ };
1261
+ case 2001:
1262
+ _this.injector.get(util.WINDOW).location.href = response.msg;
1263
+ throw Error("Cookie Error: Can't find Cas Cookie,So jump to login!");
1264
+ default:
1265
+ if (response.data) {
1266
+ console.error(response.data);
1267
+ throw Error(response.data);
1268
+ }
1269
+ else if (response.msg) {
1270
+ console.error(response.msg);
1271
+ throw Error(response.msg);
1272
+ }
1273
+ else {
1274
+ console.error('cas unknown error');
1275
+ throw Error('Unknown Error: Cas auth exception!');
1276
+ }
1277
+ }
1278
+ }));
1279
+ };
1280
+ YzAuthService.prototype.login = function () {
1281
+ var _this = this;
1282
+ other.log('yz.auth.service: ', 'login white login form->', this.bis.loginForm);
1283
+ return this.askToken().pipe(operators.mergeMap(function (token) {
1284
+ other.log('yz.auth.service: get token->', token);
1285
+ _this.csr.set('auth', {
1286
+ token_send_key: 'Authorization',
1287
+ token_send_template: token.tokenType + " ${token}",
1288
+ token_send_place: 'header'
1289
+ });
1290
+ other.log('yz.auth.service: ', 'set token');
1291
+ _this.tokenService.set(token);
1292
+ return _this.cacheInit();
1293
+ }), operators.mergeAll());
1294
+ };
1295
+ YzAuthService.prototype.cacheInit = function () {
1296
+ var _this = this;
1297
+ other.log('yz.auth.service: ', 'cacheInit');
1298
+ var user = this.cacheService.get('_yz_user', { mode: 'none' });
1299
+ var header = this.cacheService.get('_yz_header', { mode: 'none' });
1300
+ var project = this.cacheService.get('_yz_project_info', { mode: 'none' });
1301
+ return rxjs.forkJoin(rxjs.of(user), rxjs.of(header), rxjs.of(project)).pipe(operators.mergeMap(function (_b) {
1302
+ var _c = __read(_b, 3), u = _c[0], h = _c[1], p = _c[2];
1303
+ var list = [];
1304
+ // user cache
1305
+ if (!u) {
1306
+ other.log('yz.auth.service: ', 'fetch user cache');
1307
+ list.push(_this.httpClient.get("/auth/user").pipe(operators.map(function (user) {
1308
+ _this.cacheService.set('_yz_user', user.principal);
1309
+ })));
1310
+ }
1311
+ else {
1312
+ other.log('yz.auth.service: ', 'user recache');
1313
+ list.push(rxjs.of(function () { }));
1314
+ }
1315
+ // header cache
1316
+ if (!h) {
1317
+ other.log('yz.auth.service: ', 'fetch header cache');
1318
+ list.push(_this.httpClient.get("/auth/allheader/v2").pipe(operators.map(function (header) {
1319
+ _this.cacheService.set('_yz_header', header.data);
1320
+ })));
1321
+ }
1322
+ else {
1323
+ other.log('yz.auth.service: ', 'header recache');
1324
+ list.push(rxjs.of(function () { }));
1325
+ }
1326
+ // project cache
1327
+ if (!p) {
1328
+ other.log('yz.auth.service: ', 'fetch project cache');
1329
+ list.push(_this.httpClient.get("/app-manager/project/info").pipe(operators.map(function (info) {
1330
+ _this.cacheService.set('_yz_project_info', info.data);
1331
+ })));
1332
+ }
1333
+ else {
1334
+ other.log('yz.auth.service: ', 'project recache');
1335
+ list.push(rxjs.of(function () { }));
1336
+ }
1337
+ return rxjs.forkJoin(list);
1338
+ }));
1339
+ };
1340
+ return YzAuthService;
1341
+ }());
1342
+ YzAuthService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function YzAuthService_Factory() { return new YzAuthService(i0__namespace.ɵɵinject(i0__namespace.INJECTOR)); }, token: YzAuthService, providedIn: "root" });
1343
+ YzAuthService.decorators = [
1344
+ { type: i0.Injectable, args: [{ providedIn: 'root' },] }
1345
+ ];
1346
+ YzAuthService.ctorParameters = function () { return [
1347
+ { type: i0.Injector }
1348
1348
  ]; };
1349
1349
 
1350
- var CODEMESSAGE = {
1351
- 200: '服务器成功返回请求的数据。',
1352
- 201: '新建或修改数据成功。',
1353
- 202: '一个请求已经进入后台排队(异步任务)。',
1354
- 204: '删除数据成功。',
1355
- 400: '发出的请求有错误,服务器没有进行新建或修改数据的操作。',
1356
- 401: '用户没有权限(令牌、用户名、密码错误)。',
1357
- 403: '用户得到授权,但是访问是被禁止的。',
1358
- 404: '发出的请求针对的是不存在的记录,服务器没有进行操作。',
1359
- 406: '请求的格式不可得。',
1360
- 410: '请求的资源被永久删除,且不会再得到的。',
1361
- 422: '当创建一个对象时,发生一个验证错误。',
1362
- 500: '服务器发生错误,请检查服务器。',
1363
- 502: '网关错误。',
1364
- 503: '服务不可用,服务器暂时过载或维护。',
1365
- 504: '网关超时。'
1366
- };
1367
- /**
1368
- * 默认HTTP拦截器,其注册细节见 `app.module.ts`
1369
- */
1370
- var YzDefaultInterceptor = /** @class */ (function () {
1371
- function YzDefaultInterceptor(injector) {
1372
- this.injector = injector;
1373
- this.refreshToking = false;
1374
- this.refreshToken$ = new rxjs.BehaviorSubject(null);
1375
- if (this.config.refreshTokenType === 'auth-refresh') {
1376
- console.error("can't use auth-refresh, please change yz.default.interceptor to default.interceptor!");
1377
- }
1378
- }
1379
- Object.defineProperty(YzDefaultInterceptor.prototype, "notification", {
1380
- get: function () {
1381
- return this.injector.get(i3$1.NzNotificationService);
1382
- },
1383
- enumerable: false,
1384
- configurable: true
1385
- });
1386
- Object.defineProperty(YzDefaultInterceptor.prototype, "tokenSrv", {
1387
- get: function () {
1388
- return this.injector.get(auth.YA_SERVICE_TOKEN);
1389
- },
1390
- enumerable: false,
1391
- configurable: true
1392
- });
1393
- Object.defineProperty(YzDefaultInterceptor.prototype, "http", {
1394
- get: function () {
1395
- return this.injector.get(i1._HttpClient);
1396
- },
1397
- enumerable: false,
1398
- configurable: true
1399
- });
1400
- Object.defineProperty(YzDefaultInterceptor.prototype, "config", {
1401
- get: function () {
1402
- return mergeBisConfig(this.injector.get(i4.YunzaiConfigService));
1403
- },
1404
- enumerable: false,
1405
- configurable: true
1406
- });
1407
- YzDefaultInterceptor.prototype.goTo = function (url) {
1408
- var _this = this;
1409
- setTimeout(function () { return _this.injector.get(router.Router).navigateByUrl(url); });
1410
- };
1411
- YzDefaultInterceptor.prototype.checkStatus = function (ev) {
1412
- if ((ev.status >= 200 && ev.status < 300) || ev.status === 401) {
1413
- return;
1414
- }
1415
- if (ev instanceof http.HttpResponse && ev.body.errorMessage) {
1416
- this.notification.error("\u53D1\u751F\u4E86\u4E00\u4E9B\u9519\u8BEF ", ev.body.errorMessage);
1417
- return;
1418
- }
1419
- var errortext = CODEMESSAGE[ev.status] || ev.statusText;
1420
- this.notification.error("\u8BF7\u6C42\u9519\u8BEF " + ev.status + ": " + ev.url, errortext);
1421
- };
1422
- YzDefaultInterceptor.prototype.ToLogin = function () {
1423
- var _this = this;
1424
- this.notification.error("\u672A\u767B\u5F55\u6216\u767B\u5F55\u72B6\u6001\u5DF2\u8FC7\u671F\uFF0C5\u79D2\u540E\u5C06\u8DF3\u8F6C\u5230\u767B\u5F55\u9875\u9762\u3002", "");
1425
- setTimeout(function () {
1426
- localStorage.clear();
1427
- _this.injector.get(util.WINDOW).location.href = _this.config.baseUrl + "/cas-proxy/app/logout";
1428
- }, 5000);
1429
- };
1430
- YzDefaultInterceptor.prototype.reAttachToken = function (req) {
1431
- var _a;
1432
- var token = (_a = this.tokenSrv.get()) === null || _a === void 0 ? void 0 : _a.token;
1433
- return req.clone({
1434
- setHeaders: {
1435
- Authorization: "Bearer " + token
1436
- }
1437
- });
1438
- };
1439
- YzDefaultInterceptor.prototype.refreshTokenRequest = function () {
1440
- var model = this.tokenSrv.get();
1441
- var form = new FormData();
1442
- form.set('refresh_token', model === null || model === void 0 ? void 0 : model.refreshToken);
1443
- other.log('yz.default.interceptor: use the refresh token to request a new token', model === null || model === void 0 ? void 0 : model.refreshToken);
1444
- return this.http.post("/auth/user/token/refresh?_allow_anonymous=true", form);
1445
- };
1446
- YzDefaultInterceptor.prototype.tryRefreshToken = function (ev, req, next) {
1447
- var _this = this;
1448
- // 连刷新Token的请求都错了,那就是真错了
1449
- if (['/auth/oauth/token'].some(function (url) { return req.url.includes(url); })) {
1450
- this.ToLogin();
1451
- return rxjs.throwError(ev);
1452
- }
1453
- // 正在刷新token,所有其他请求排队
1454
- if (this.refreshToking) {
1455
- return this.refreshToken$.pipe(operators.filter(function (v) { return !!v; }), operators.take(1), operators.switchMap(function () { return next.handle(_this.reAttachToken(req)); }));
1456
- }
1457
- //尝试调用刷新 Token
1458
- this.refreshToking = true;
1459
- this.refreshToken$.next(null);
1460
- // 处理Token
1461
- return this.refreshTokenRequest().pipe(operators.switchMap(function (res) {
1462
- other.log('yz.default.interceptor: refresh token accessed -> ', res);
1463
- // 重新保存新 token
1464
- var access_token = res.access_token, expires_in = res.expires_in, refresh_token = res.refresh_token, scope = res.scope, token_type = res.token_type;
1465
- _this.tokenSrv.set({
1466
- token: access_token,
1467
- expired: expires_in,
1468
- refreshToken: refresh_token,
1469
- tokenType: token_type,
1470
- scope: scope
1471
- });
1472
- // 通知后续请求继续执行
1473
- _this.refreshToking = false;
1474
- _this.refreshToken$.next(res);
1475
- // 重新发起请求
1476
- return next.handle(_this.reAttachToken(req));
1477
- }), operators.catchError(function (err) {
1478
- _this.refreshToking = false;
1479
- _this.ToLogin();
1480
- return rxjs.throwError(err);
1481
- }));
1482
- };
1483
- YzDefaultInterceptor.prototype.getAdditionalHeaders = function (headers) {
1484
- var res = {};
1485
- var lang = this.injector.get(i1.YUNZAI_I18N_TOKEN).currentLang;
1486
- if (!(headers === null || headers === void 0 ? void 0 : headers.has('Accept-Language')) && lang) {
1487
- res['Accept-Language'] = lang;
1488
- }
1489
- return res;
1490
- };
1491
- YzDefaultInterceptor.prototype.handleData = function (ev, req, next) {
1492
- this.checkStatus(ev);
1493
- switch (ev.status) {
1494
- case 200:
1495
- return rxjs.of(ev);
1496
- case 401:
1497
- if (this.config.refreshTokenEnabled && this.config.refreshTokenType === 're-request') {
1498
- return this.tryRefreshToken(ev, req, next);
1499
- }
1500
- this.ToLogin();
1501
- break;
1502
- case 403:
1503
- case 404:
1504
- case 500:
1505
- this.goTo("/exception/" + ev.status);
1506
- break;
1507
- default:
1508
- if (ev instanceof http.HttpErrorResponse) {
1509
- console.warn('未可知错误,大部分是由于后端不支持跨域CORS或无效配置引起,请参考 https://ng.yunzainfo.com/docs/server 解决跨域问题', ev);
1510
- }
1511
- break;
1512
- }
1513
- if (ev instanceof http.HttpErrorResponse) {
1514
- return rxjs.throwError(ev);
1515
- }
1516
- else {
1517
- return rxjs.of(ev);
1518
- }
1519
- };
1520
- YzDefaultInterceptor.prototype.intercept = function (req, next) {
1521
- var _this = this;
1522
- other.log('yz.default.interceptor.ts: ', 'request ', req);
1523
- // 统一加前缀
1524
- var url = req.url;
1525
- if (!url.startsWith('https://') && !url.startsWith('http://')) {
1526
- url = this.config.baseUrl + url;
1527
- }
1528
- if (url.includes('.json') && url.includes('assets')) {
1529
- url = req.url;
1530
- }
1531
- // 加入语言头
1532
- var newReq = req.clone({ url: url, setHeaders: this.getAdditionalHeaders(req.headers) });
1533
- return next.handle(newReq).pipe(operators.mergeMap(function (ev) {
1534
- // 允许统一对请求错误处理
1535
- if (ev instanceof http.HttpResponseBase) {
1536
- return _this.handleData(ev, newReq, next);
1537
- }
1538
- // 若一切都正常,则后续操作
1539
- return rxjs.of(ev);
1540
- }), operators.catchError(function (err) { return _this.handleData(err, newReq, next); }));
1541
- };
1542
- return YzDefaultInterceptor;
1543
- }());
1544
- YzDefaultInterceptor.decorators = [
1545
- { type: i0.Injectable }
1546
- ];
1547
- YzDefaultInterceptor.ctorParameters = function () { return [
1548
- { type: i0.Injector }
1350
+ var CODEMESSAGE = {
1351
+ 200: '服务器成功返回请求的数据。',
1352
+ 201: '新建或修改数据成功。',
1353
+ 202: '一个请求已经进入后台排队(异步任务)。',
1354
+ 204: '删除数据成功。',
1355
+ 400: '发出的请求有错误,服务器没有进行新建或修改数据的操作。',
1356
+ 401: '用户没有权限(令牌、用户名、密码错误)。',
1357
+ 403: '用户得到授权,但是访问是被禁止的。',
1358
+ 404: '发出的请求针对的是不存在的记录,服务器没有进行操作。',
1359
+ 406: '请求的格式不可得。',
1360
+ 410: '请求的资源被永久删除,且不会再得到的。',
1361
+ 422: '当创建一个对象时,发生一个验证错误。',
1362
+ 500: '服务器发生错误,请检查服务器。',
1363
+ 502: '网关错误。',
1364
+ 503: '服务不可用,服务器暂时过载或维护。',
1365
+ 504: '网关超时。'
1366
+ };
1367
+ /**
1368
+ * 默认HTTP拦截器,其注册细节见 `app.module.ts`
1369
+ */
1370
+ var YzDefaultInterceptor = /** @class */ (function () {
1371
+ function YzDefaultInterceptor(injector) {
1372
+ this.injector = injector;
1373
+ this.refreshToking = false;
1374
+ this.refreshToken$ = new rxjs.BehaviorSubject(null);
1375
+ if (this.config.refreshTokenType === 'auth-refresh') {
1376
+ console.error("can't use auth-refresh, please change yz.default.interceptor to default.interceptor!");
1377
+ }
1378
+ }
1379
+ Object.defineProperty(YzDefaultInterceptor.prototype, "notification", {
1380
+ get: function () {
1381
+ return this.injector.get(i3$1.NzNotificationService);
1382
+ },
1383
+ enumerable: false,
1384
+ configurable: true
1385
+ });
1386
+ Object.defineProperty(YzDefaultInterceptor.prototype, "tokenSrv", {
1387
+ get: function () {
1388
+ return this.injector.get(auth.YA_SERVICE_TOKEN);
1389
+ },
1390
+ enumerable: false,
1391
+ configurable: true
1392
+ });
1393
+ Object.defineProperty(YzDefaultInterceptor.prototype, "http", {
1394
+ get: function () {
1395
+ return this.injector.get(i1._HttpClient);
1396
+ },
1397
+ enumerable: false,
1398
+ configurable: true
1399
+ });
1400
+ Object.defineProperty(YzDefaultInterceptor.prototype, "config", {
1401
+ get: function () {
1402
+ return mergeBisConfig(this.injector.get(i4.YunzaiConfigService));
1403
+ },
1404
+ enumerable: false,
1405
+ configurable: true
1406
+ });
1407
+ YzDefaultInterceptor.prototype.goTo = function (url) {
1408
+ var _this = this;
1409
+ setTimeout(function () { return _this.injector.get(router.Router).navigateByUrl(url); });
1410
+ };
1411
+ YzDefaultInterceptor.prototype.checkStatus = function (ev) {
1412
+ if ((ev.status >= 200 && ev.status < 300) || ev.status === 401) {
1413
+ return;
1414
+ }
1415
+ if (ev instanceof http.HttpResponse && ev.body.errorMessage) {
1416
+ this.notification.error("\u53D1\u751F\u4E86\u4E00\u4E9B\u9519\u8BEF ", ev.body.errorMessage);
1417
+ return;
1418
+ }
1419
+ var errortext = CODEMESSAGE[ev.status] || ev.statusText;
1420
+ this.notification.error("\u8BF7\u6C42\u9519\u8BEF " + ev.status + ": " + ev.url, errortext);
1421
+ };
1422
+ YzDefaultInterceptor.prototype.ToLogin = function () {
1423
+ var _this = this;
1424
+ this.notification.error("\u672A\u767B\u5F55\u6216\u767B\u5F55\u72B6\u6001\u5DF2\u8FC7\u671F\uFF0C5\u79D2\u540E\u5C06\u8DF3\u8F6C\u5230\u767B\u5F55\u9875\u9762\u3002", "");
1425
+ setTimeout(function () {
1426
+ localStorage.clear();
1427
+ _this.injector.get(util.WINDOW).location.href = _this.config.baseUrl + "/cas-proxy/app/logout";
1428
+ }, 5000);
1429
+ };
1430
+ YzDefaultInterceptor.prototype.reAttachToken = function (req) {
1431
+ var _a;
1432
+ var token = (_a = this.tokenSrv.get()) === null || _a === void 0 ? void 0 : _a.token;
1433
+ return req.clone({
1434
+ setHeaders: {
1435
+ Authorization: "Bearer " + token
1436
+ }
1437
+ });
1438
+ };
1439
+ YzDefaultInterceptor.prototype.refreshTokenRequest = function () {
1440
+ var model = this.tokenSrv.get();
1441
+ var form = new FormData();
1442
+ form.set('refresh_token', model === null || model === void 0 ? void 0 : model.refreshToken);
1443
+ other.log('yz.default.interceptor: use the refresh token to request a new token', model === null || model === void 0 ? void 0 : model.refreshToken);
1444
+ return this.http.post("/auth/user/token/refresh?_allow_anonymous=true", form);
1445
+ };
1446
+ YzDefaultInterceptor.prototype.tryRefreshToken = function (ev, req, next) {
1447
+ var _this = this;
1448
+ // 连刷新Token的请求都错了,那就是真错了
1449
+ if (['/auth/oauth/token'].some(function (url) { return req.url.includes(url); })) {
1450
+ this.ToLogin();
1451
+ return rxjs.throwError(ev);
1452
+ }
1453
+ // 正在刷新token,所有其他请求排队
1454
+ if (this.refreshToking) {
1455
+ return this.refreshToken$.pipe(operators.filter(function (v) { return !!v; }), operators.take(1), operators.switchMap(function () { return next.handle(_this.reAttachToken(req)); }));
1456
+ }
1457
+ //尝试调用刷新 Token
1458
+ this.refreshToking = true;
1459
+ this.refreshToken$.next(null);
1460
+ // 处理Token
1461
+ return this.refreshTokenRequest().pipe(operators.switchMap(function (res) {
1462
+ other.log('yz.default.interceptor: refresh token accessed -> ', res);
1463
+ // 重新保存新 token
1464
+ var access_token = res.access_token, expires_in = res.expires_in, refresh_token = res.refresh_token, scope = res.scope, token_type = res.token_type;
1465
+ _this.tokenSrv.set({
1466
+ token: access_token,
1467
+ expired: expires_in,
1468
+ refreshToken: refresh_token,
1469
+ tokenType: token_type,
1470
+ scope: scope
1471
+ });
1472
+ // 通知后续请求继续执行
1473
+ _this.refreshToking = false;
1474
+ _this.refreshToken$.next(res);
1475
+ // 重新发起请求
1476
+ return next.handle(_this.reAttachToken(req));
1477
+ }), operators.catchError(function (err) {
1478
+ _this.refreshToking = false;
1479
+ _this.ToLogin();
1480
+ return rxjs.throwError(err);
1481
+ }));
1482
+ };
1483
+ YzDefaultInterceptor.prototype.getAdditionalHeaders = function (headers) {
1484
+ var res = {};
1485
+ var lang = this.injector.get(i1.YUNZAI_I18N_TOKEN).currentLang;
1486
+ if (!(headers === null || headers === void 0 ? void 0 : headers.has('Accept-Language')) && lang) {
1487
+ res['Accept-Language'] = lang;
1488
+ }
1489
+ return res;
1490
+ };
1491
+ YzDefaultInterceptor.prototype.handleData = function (ev, req, next) {
1492
+ this.checkStatus(ev);
1493
+ switch (ev.status) {
1494
+ case 200:
1495
+ return rxjs.of(ev);
1496
+ case 401:
1497
+ if (this.config.refreshTokenEnabled && this.config.refreshTokenType === 're-request') {
1498
+ return this.tryRefreshToken(ev, req, next);
1499
+ }
1500
+ this.ToLogin();
1501
+ break;
1502
+ case 403:
1503
+ case 404:
1504
+ case 500:
1505
+ this.goTo("/exception/" + ev.status);
1506
+ break;
1507
+ default:
1508
+ if (ev instanceof http.HttpErrorResponse) {
1509
+ console.warn('未可知错误,大部分是由于后端不支持跨域CORS或无效配置引起,请参考 https://ng.yunzainfo.com/docs/server 解决跨域问题', ev);
1510
+ }
1511
+ break;
1512
+ }
1513
+ if (ev instanceof http.HttpErrorResponse) {
1514
+ return rxjs.throwError(ev);
1515
+ }
1516
+ else {
1517
+ return rxjs.of(ev);
1518
+ }
1519
+ };
1520
+ YzDefaultInterceptor.prototype.intercept = function (req, next) {
1521
+ var _this = this;
1522
+ other.log('yz.default.interceptor.ts: ', 'request ', req);
1523
+ // 统一加前缀
1524
+ var url = req.url;
1525
+ if (!url.startsWith('https://') && !url.startsWith('http://')) {
1526
+ url = this.config.baseUrl + url;
1527
+ }
1528
+ if (url.includes('.json') && url.includes('assets')) {
1529
+ url = req.url;
1530
+ }
1531
+ // 加入语言头
1532
+ var newReq = req.clone({ url: url, setHeaders: this.getAdditionalHeaders(req.headers) });
1533
+ return next.handle(newReq).pipe(operators.mergeMap(function (ev) {
1534
+ // 允许统一对请求错误处理
1535
+ if (ev instanceof http.HttpResponseBase) {
1536
+ return _this.handleData(ev, newReq, next);
1537
+ }
1538
+ // 若一切都正常,则后续操作
1539
+ return rxjs.of(ev);
1540
+ }), operators.catchError(function (err) { return _this.handleData(err, newReq, next); }));
1541
+ };
1542
+ return YzDefaultInterceptor;
1543
+ }());
1544
+ YzDefaultInterceptor.decorators = [
1545
+ { type: i0.Injectable }
1546
+ ];
1547
+ YzDefaultInterceptor.ctorParameters = function () { return [
1548
+ { type: i0.Injector }
1549
1549
  ]; };
1550
1550
 
1551
- function mapYzSideToYelonMenu(menus) {
1552
- menus.forEach(function (menu) {
1553
- menu.badgeDot = menu.badge_dot || null;
1554
- menu.badgeStatus = menu.badge_status || null;
1555
- menu.shortcutRoot = menu.shortcut_root || null;
1556
- menu.reuse = true;
1557
- if (menu.children) {
1558
- mapYzSideToYelonMenu(menu.children);
1559
- }
1560
- });
1561
- }
1562
- function generateAbility(menus, abilities, prefix) {
1563
- menus.forEach(function (menu) {
1564
- if (menu.link) {
1565
- prefix += menu.link;
1566
- }
1567
- else {
1568
- prefix += '';
1569
- }
1570
- if (menu.menuAuths) {
1571
- menu.menuAuths.forEach(function (a) {
1572
- abilities.push(prefix + ":" + a);
1573
- abilities.push(a);
1574
- });
1575
- }
1576
- if (menu.children) {
1577
- generateAbility(menu.children, abilities, prefix);
1578
- }
1579
- });
1580
- }
1581
- var YzStartupService = /** @class */ (function () {
1582
- function YzStartupService(iconSrv, menuService, i18n, settingService, aclService, titleService, yzAuthService, cacheService, configService) {
1583
- this.menuService = menuService;
1584
- this.i18n = i18n;
1585
- this.settingService = settingService;
1586
- this.aclService = aclService;
1587
- this.titleService = titleService;
1588
- this.yzAuthService = yzAuthService;
1589
- this.cacheService = cacheService;
1590
- this.configService = configService;
1591
- this.bis = BUSINESS_DEFAULT_CONFIG;
1592
- this.bis = mergeBisConfig(this.configService);
1593
- iconSrv.addIcon.apply(iconSrv, __spreadArray([], __read(shared.ICONS)));
1594
- }
1595
- YzStartupService.prototype.load = function () {
1596
- var _this = this;
1597
- util.log('startup.service: ', 'load');
1598
- var defaultLang = this.i18n.defaultLang;
1599
- return this.i18n.loadLangData(defaultLang).pipe(operators.mergeMap(function (langData) {
1600
- util.log('startup.service: ', 'set i18n, defaultLang->', defaultLang, ' langData->', langData);
1601
- _this.i18n.use(defaultLang, langData);
1602
- return rxjs.of(null);
1603
- }), operators.mergeMap(function () {
1604
- return _this.yzAuthService.login();
1605
- }), operators.mergeMap(function (v) {
1606
- // preloader finish
1607
- _this.systemInit();
1608
- util.log('startup.service: preloader finish');
1609
- var win = window;
1610
- if (win && win.appBootstrap) {
1611
- win.appBootstrap();
1612
- }
1613
- return rxjs.of(v);
1614
- }));
1615
- };
1616
- YzStartupService.prototype.systemInit = function () {
1617
- var _this = this;
1618
- util.log('startup.service: system init');
1619
- // user
1620
- var user = this.cacheService.get('_yz_user', { mode: 'none' });
1621
- // menu
1622
- var ms = util.deepCopy(user.menu).filter(function (m) { return m.systemCode && m.systemCode === _this.bis.systemCode; });
1623
- mapYzSideToYelonMenu(ms);
1624
- var currentMenu = ms.pop();
1625
- this.menuService.add([currentMenu]);
1626
- // logo app
1627
- this.settingService.setApp({ name: currentMenu.text, description: currentMenu.intro });
1628
- this.settingService.setUser({
1629
- name: user.realname || 'no name',
1630
- avatar: this.bis.baseUrl + "/filecenter/file/" + user.avatarId || '',
1631
- email: user.email || 'no email'
1632
- });
1633
- // title
1634
- this.titleService.default = currentMenu.text || 'default application name';
1635
- this.titleService.setTitle(currentMenu.text || 'no title');
1636
- // acl
1637
- var abilities = [];
1638
- generateAbility([currentMenu], abilities, '');
1639
- this.aclService.attachRole((user === null || user === void 0 ? void 0 : user.roles.map(function (role) {
1640
- return role.roleValue;
1641
- }).filter(function (a) { return !!a; })) || []);
1642
- this.aclService.attachAbility(abilities);
1643
- // cache current
1644
- this.cacheService.set('_yz_current', {
1645
- text: currentMenu.text,
1646
- intro: currentMenu.intro,
1647
- icon: currentMenu.appIconUrl
1648
- });
1649
- };
1650
- return YzStartupService;
1651
- }());
1652
- YzStartupService.decorators = [
1653
- { type: i0.Injectable }
1654
- ];
1655
- YzStartupService.ctorParameters = function () { return [
1656
- { type: icon.NzIconService },
1657
- { type: i1.MenuService },
1658
- { type: YzI18NService, decorators: [{ type: i0.Inject, args: [i1.YUNZAI_I18N_TOKEN,] }] },
1659
- { type: i1.SettingsService },
1660
- { type: acl.ACLService },
1661
- { type: i1.TitleService },
1662
- { type: YzAuthService },
1663
- { type: i2$1.CacheService },
1664
- { type: util.YunzaiConfigService }
1665
- ]; };
1666
- function YzStartupServiceFactory(startupService) {
1667
- return function () { return startupService.load(); };
1668
- }
1669
- //@ts-ignore
1670
- var YZ_APPINIT_PROVIDES = [
1671
- YzStartupService,
1672
- {
1673
- provide: i0.APP_INITIALIZER,
1674
- useFactory: YzStartupServiceFactory,
1675
- deps: [YzStartupService],
1676
- multi: true
1677
- }
1551
+ function mapYzSideToYelonMenu(menus) {
1552
+ menus.forEach(function (menu) {
1553
+ menu.badgeDot = menu.badge_dot || null;
1554
+ menu.badgeStatus = menu.badge_status || null;
1555
+ menu.shortcutRoot = menu.shortcut_root || null;
1556
+ menu.reuse = true;
1557
+ if (menu.children) {
1558
+ mapYzSideToYelonMenu(menu.children);
1559
+ }
1560
+ });
1561
+ }
1562
+ function generateAbility(menus, abilities, prefix) {
1563
+ menus.forEach(function (menu) {
1564
+ if (menu.link) {
1565
+ prefix += menu.link;
1566
+ }
1567
+ else {
1568
+ prefix += '';
1569
+ }
1570
+ if (menu.menuAuths) {
1571
+ menu.menuAuths.forEach(function (a) {
1572
+ abilities.push(prefix + ":" + a);
1573
+ abilities.push(a);
1574
+ });
1575
+ }
1576
+ if (menu.children) {
1577
+ generateAbility(menu.children, abilities, prefix);
1578
+ }
1579
+ });
1580
+ }
1581
+ var YzStartupService = /** @class */ (function () {
1582
+ function YzStartupService(iconSrv, menuService, i18n, settingService, aclService, titleService, yzAuthService, cacheService, configService) {
1583
+ this.menuService = menuService;
1584
+ this.i18n = i18n;
1585
+ this.settingService = settingService;
1586
+ this.aclService = aclService;
1587
+ this.titleService = titleService;
1588
+ this.yzAuthService = yzAuthService;
1589
+ this.cacheService = cacheService;
1590
+ this.configService = configService;
1591
+ this.bis = BUSINESS_DEFAULT_CONFIG;
1592
+ this.bis = mergeBisConfig(this.configService);
1593
+ iconSrv.addIcon.apply(iconSrv, __spreadArray([], __read(shared.ICONS)));
1594
+ }
1595
+ YzStartupService.prototype.load = function () {
1596
+ var _this = this;
1597
+ util.log('startup.service: ', 'load');
1598
+ var defaultLang = this.i18n.defaultLang;
1599
+ return this.i18n.loadLangData(defaultLang).pipe(operators.mergeMap(function (langData) {
1600
+ util.log('startup.service: ', 'set i18n, defaultLang->', defaultLang, ' langData->', langData);
1601
+ _this.i18n.use(defaultLang, langData);
1602
+ return rxjs.of(null);
1603
+ }), operators.mergeMap(function () {
1604
+ return _this.yzAuthService.login();
1605
+ }), operators.mergeMap(function (v) {
1606
+ // preloader finish
1607
+ _this.systemInit();
1608
+ util.log('startup.service: preloader finish');
1609
+ var win = window;
1610
+ if (win && win.appBootstrap) {
1611
+ win.appBootstrap();
1612
+ }
1613
+ return rxjs.of(v);
1614
+ }));
1615
+ };
1616
+ YzStartupService.prototype.systemInit = function () {
1617
+ var _this = this;
1618
+ util.log('startup.service: system init');
1619
+ // user
1620
+ var user = this.cacheService.get('_yz_user', { mode: 'none' });
1621
+ // menu
1622
+ var ms = util.deepCopy(user.menu).filter(function (m) { return m.systemCode && m.systemCode === _this.bis.systemCode; });
1623
+ mapYzSideToYelonMenu(ms);
1624
+ var currentMenu = ms.pop();
1625
+ this.menuService.add([currentMenu]);
1626
+ // logo app
1627
+ this.settingService.setApp({ name: currentMenu.text, description: currentMenu.intro });
1628
+ this.settingService.setUser({
1629
+ name: user.realname || 'no name',
1630
+ avatar: this.bis.baseUrl + "/filecenter/file/" + user.avatarId || '',
1631
+ email: user.email || 'no email'
1632
+ });
1633
+ // title
1634
+ this.titleService.default = currentMenu.text || 'default application name';
1635
+ this.titleService.setTitle(currentMenu.text || 'no title');
1636
+ // acl
1637
+ var abilities = [];
1638
+ generateAbility([currentMenu], abilities, '');
1639
+ this.aclService.attachRole((user === null || user === void 0 ? void 0 : user.roles.map(function (role) {
1640
+ return role.roleValue;
1641
+ }).filter(function (a) { return !!a; })) || []);
1642
+ this.aclService.attachAbility(abilities);
1643
+ // cache current
1644
+ this.cacheService.set('_yz_current', {
1645
+ text: currentMenu.text,
1646
+ intro: currentMenu.intro,
1647
+ icon: currentMenu.appIconUrl
1648
+ });
1649
+ };
1650
+ return YzStartupService;
1651
+ }());
1652
+ YzStartupService.decorators = [
1653
+ { type: i0.Injectable }
1654
+ ];
1655
+ YzStartupService.ctorParameters = function () { return [
1656
+ { type: icon.NzIconService },
1657
+ { type: i1.MenuService },
1658
+ { type: YzI18NService, decorators: [{ type: i0.Inject, args: [i1.YUNZAI_I18N_TOKEN,] }] },
1659
+ { type: i1.SettingsService },
1660
+ { type: acl.ACLService },
1661
+ { type: i1.TitleService },
1662
+ { type: YzAuthService },
1663
+ { type: i2$1.CacheService },
1664
+ { type: util.YunzaiConfigService }
1665
+ ]; };
1666
+ function YzStartupServiceFactory(startupService) {
1667
+ return function () { return startupService.load(); };
1668
+ }
1669
+ //@ts-ignore
1670
+ var YZ_APPINIT_PROVIDES = [
1671
+ YzStartupService,
1672
+ {
1673
+ provide: i0.APP_INITIALIZER,
1674
+ useFactory: YzStartupServiceFactory,
1675
+ deps: [YzStartupService],
1676
+ multi: true
1677
+ }
1678
1678
  ];
1679
1679
 
1680
- /**
1681
- * Generated bundle index. Do not edit.
1680
+ /**
1681
+ * Generated bundle index. Do not edit.
1682
1682
  */
1683
1683
 
1684
1684
  exports.BUSINESS_DEFAULT_CONFIG = BUSINESS_DEFAULT_CONFIG;