@yelon/bis 12.0.18 → 13.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/bis.d.ts +1 -0
  2. package/{esm2015/bis.js → esm2020/bis.mjs} +0 -0
  3. package/esm2020/layout/act.guard.mjs +108 -0
  4. package/{esm2015/layout/bis.config.js → esm2020/layout/bis.config.mjs} +0 -0
  5. package/esm2020/layout/contact/contact.component.mjs +492 -0
  6. package/esm2020/layout/contact/contact.service.mjs +146 -0
  7. package/esm2020/layout/layout.mjs +5 -0
  8. package/esm2020/layout/layout.module.mjs +73 -0
  9. package/{esm2015/layout/path-to-regexp.service.js → esm2020/layout/path-to-regexp.service.mjs} +9 -8
  10. package/{esm2015/layout/public_api.js → esm2020/layout/public_api.mjs} +3 -3
  11. package/esm2020/layout/stomp.config.mjs +18 -0
  12. package/{esm2015/layout/widgets/index.js → esm2020/layout/widgets/index.mjs} +0 -0
  13. package/esm2020/layout/widgets/yz.application.component.mjs +271 -0
  14. package/esm2020/layout/widgets/yz.clear-storage.component.mjs +45 -0
  15. package/esm2020/layout/widgets/yz.fullscreen.component.mjs +45 -0
  16. package/esm2020/layout/widgets/yz.i18n.component.mjs +115 -0
  17. package/esm2020/layout/widgets/yz.notify.component.mjs +184 -0
  18. package/esm2020/layout/widgets/yz.them-btn.component.mjs +196 -0
  19. package/esm2020/layout/widgets/yz.user.component.mjs +112 -0
  20. package/esm2020/layout/yz.auth.service.mjs +156 -0
  21. package/esm2020/layout/yz.basic.component.mjs +207 -0
  22. package/esm2020/layout/yz.default.interceptor.mjs +203 -0
  23. package/esm2020/layout/yz.i18n.service.mjs +93 -0
  24. package/esm2020/layout/yz.startup.service.mjs +137 -0
  25. package/esm2020/layout/yz.stomp.service.mjs +88 -0
  26. package/{esm2015/public_api.js → esm2020/public_api.mjs} +0 -0
  27. package/{esm2015/shared/public_api.js → esm2020/shared/public_api.mjs} +0 -0
  28. package/{esm2015/shared/shared-yelon.module.js → esm2020/shared/shared-yelon.module.mjs} +0 -0
  29. package/{esm2015/shared/shared-zorro.module.js → esm2020/shared/shared-zorro.module.mjs} +0 -0
  30. package/{esm2015/shared/shared.js → esm2020/shared/shared.mjs} +0 -0
  31. package/esm2020/shared/shared.module.mjs +116 -0
  32. package/{esm2015/shared/style-icons.js → esm2020/shared/style-icons.mjs} +0 -0
  33. package/fesm2015/{bis.js → bis.mjs} +1 -1
  34. package/fesm2015/bis.mjs.map +1 -0
  35. package/fesm2015/{layout.js → layout.mjs} +610 -279
  36. package/fesm2015/layout.mjs.map +1 -0
  37. package/fesm2015/{shared.js → shared.mjs} +101 -7
  38. package/fesm2015/shared.mjs.map +1 -0
  39. package/fesm2020/bis.mjs +6 -0
  40. package/fesm2020/bis.mjs.map +1 -0
  41. package/fesm2020/layout.mjs +2796 -0
  42. package/fesm2020/layout.mjs.map +1 -0
  43. package/fesm2020/shared.mjs +1106 -0
  44. package/fesm2020/shared.mjs.map +1 -0
  45. package/layout/act.guard.d.ts +3 -0
  46. package/layout/contact/contact.component.d.ts +4 -1
  47. package/layout/contact/contact.service.d.ts +4 -1
  48. package/layout/layout.d.ts +1 -3
  49. package/layout/layout.module.d.ts +18 -0
  50. package/layout/package.json +5 -6
  51. package/layout/path-to-regexp.service.d.ts +3 -0
  52. package/layout/public_api.d.ts +2 -0
  53. package/layout/widgets/yz.application.component.d.ts +3 -0
  54. package/layout/widgets/yz.clear-storage.component.d.ts +3 -0
  55. package/layout/widgets/yz.fullscreen.component.d.ts +3 -1
  56. package/layout/widgets/yz.i18n.component.d.ts +3 -0
  57. package/layout/widgets/yz.notify.component.d.ts +3 -0
  58. package/layout/widgets/yz.them-btn.component.d.ts +3 -0
  59. package/layout/widgets/yz.user.component.d.ts +3 -0
  60. package/layout/yz.auth.service.d.ts +3 -0
  61. package/layout/yz.basic.component.d.ts +11 -2
  62. package/layout/yz.default.interceptor.d.ts +3 -0
  63. package/layout/yz.i18n.service.d.ts +3 -0
  64. package/layout/yz.startup.service.d.ts +3 -0
  65. package/layout/yz.stomp.service.d.ts +6 -3
  66. package/package.json +46 -18
  67. package/shared/package.json +5 -6
  68. package/shared/shared-zorro.module.d.ts +2 -2
  69. package/shared/shared.d.ts +1 -0
  70. package/shared/shared.module.d.ts +93 -0
  71. package/bis.metadata.json +0 -1
  72. package/bundles/bis.umd.js +0 -18
  73. package/bundles/bis.umd.js.map +0 -1
  74. package/bundles/layout.umd.js +0 -2671
  75. package/bundles/layout.umd.js.map +0 -1
  76. package/bundles/shared.umd.js +0 -1249
  77. package/bundles/shared.umd.js.map +0 -1
  78. package/esm2015/layout/act.guard.js +0 -115
  79. package/esm2015/layout/contact/contact.component.js +0 -434
  80. package/esm2015/layout/contact/contact.service.js +0 -150
  81. package/esm2015/layout/layout.js +0 -8
  82. package/esm2015/layout/layout.module.js +0 -47
  83. package/esm2015/layout/stomp.config.js +0 -20
  84. package/esm2015/layout/widgets/yz.application.component.js +0 -200
  85. package/esm2015/layout/widgets/yz.clear-storage.component.js +0 -39
  86. package/esm2015/layout/widgets/yz.fullscreen.component.js +0 -36
  87. package/esm2015/layout/widgets/yz.i18n.component.js +0 -78
  88. package/esm2015/layout/widgets/yz.notify.component.js +0 -157
  89. package/esm2015/layout/widgets/yz.them-btn.component.js +0 -146
  90. package/esm2015/layout/widgets/yz.user.component.js +0 -81
  91. package/esm2015/layout/yz.auth.service.js +0 -158
  92. package/esm2015/layout/yz.basic.component.js +0 -101
  93. package/esm2015/layout/yz.default.interceptor.js +0 -204
  94. package/esm2015/layout/yz.i18n.service.js +0 -102
  95. package/esm2015/layout/yz.startup.service.js +0 -138
  96. package/esm2015/layout/yz.stomp.service.js +0 -91
  97. package/esm2015/shared/shared.module.js +0 -22
  98. package/fesm2015/bis.js.map +0 -1
  99. package/fesm2015/layout.js.map +0 -1
  100. package/fesm2015/shared.js.map +0 -1
  101. package/layout/layout.metadata.json +0 -1
  102. package/shared/shared.metadata.json +0 -1
@@ -1,2671 +0,0 @@
1
- /**
2
- * @license ng-yunzai(devcui@outlook.com) v12.0.18
3
- * (c) 2020 devcui https://github.com/hbyunzai/yelon/
4
- * License: MIT
5
- */
6
- (function (global, factory) {
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('@yelon/util/config'), require('ng-zorro-antd/i18n'), require('@yelon/util/decorator'), require('rxjs'), require('rxjs/operators'), require('date-fns'), require('@yelon/util/other'), require('ng-zorro-antd/message'), 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('@yelon/acl'), require('ng-zorro-antd/icon')) :
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', '@yelon/util/config', 'ng-zorro-antd/i18n', '@yelon/util/decorator', 'rxjs', 'rxjs/operators', 'date-fns', '@yelon/util/other', 'ng-zorro-antd/message', '@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', '@yelon/acl', 'ng-zorro-antd/icon'], factory) :
9
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.yelon = global.yelon || {}, global.yelon.bis = global.yelon.bis || {}, global.yelon.bis.layout = {}), global.ng.core, global.yelon.cache, global.yelon.theme, global.yelon.util, global.ng.cdk.platform, global.ng.common, global.ng.common.locales.en, global.ng.common.locales.zh, global.ng.common.locales.zhHant, global.locale, global.yelon.util.config, global["ng-zorro-antd/i18n"], global.decorator, global.rxjs, global.rxjs.operators, global.DateFns, global.yelon.util.other, global.message, global.ng.cdk.bidi, global.themeBtn, global.yelon.auth, global["ng-zorro-antd/modal"], global.screenfull, global.ng.common.http, global.ng.forms, global.ng.router, global.yelon.bis.shared, global.rxStomp, global.i3$1, global.yelon.acl, global["ng-zorro-antd/icon"]));
10
- })(this, (function (exports, i0, i2$1, i1, util, i3, common, ngEn, ngZh, ngZhTw, locale, i1$1, i2, decorator, rxjs, operators, dateFns, other, message, bidi, themeBtn, auth, modal, screenfull, http, forms, i4, shared, rxStomp, i3$1, acl, icon) { 'use strict';
11
-
12
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
13
-
14
- function _interopNamespace(e) {
15
- if (e && e.__esModule) return e;
16
- var n = Object.create(null);
17
- if (e) {
18
- Object.keys(e).forEach(function (k) {
19
- if (k !== 'default') {
20
- var d = Object.getOwnPropertyDescriptor(e, k);
21
- Object.defineProperty(n, k, d.get ? d : {
22
- enumerable: true,
23
- get: function () { return e[k]; }
24
- });
25
- }
26
- });
27
- }
28
- n["default"] = e;
29
- return Object.freeze(n);
30
- }
31
-
32
- var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
33
- var i2__namespace$1 = /*#__PURE__*/_interopNamespace(i2$1);
34
- var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
35
- var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
36
- var ngEn__default = /*#__PURE__*/_interopDefaultLegacy(ngEn);
37
- var ngZh__default = /*#__PURE__*/_interopDefaultLegacy(ngZh);
38
- var ngZhTw__default = /*#__PURE__*/_interopDefaultLegacy(ngZhTw);
39
- var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
40
- var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
41
- var screenfull__namespace = /*#__PURE__*/_interopNamespace(screenfull);
42
- var i4__namespace = /*#__PURE__*/_interopNamespace(i4);
43
- var i3__namespace$1 = /*#__PURE__*/_interopNamespace(i3$1);
44
-
45
- /*! *****************************************************************************
46
- Copyright (c) Microsoft Corporation.
47
-
48
- Permission to use, copy, modify, and/or distribute this software for any
49
- purpose with or without fee is hereby granted.
50
-
51
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
52
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
53
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
54
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
55
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
56
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
57
- PERFORMANCE OF THIS SOFTWARE.
58
- ***************************************************************************** */
59
- /* global Reflect, Promise */
60
- var extendStatics = function (d, b) {
61
- extendStatics = Object.setPrototypeOf ||
62
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
63
- function (d, b) { for (var p in b)
64
- if (Object.prototype.hasOwnProperty.call(b, p))
65
- d[p] = b[p]; };
66
- return extendStatics(d, b);
67
- };
68
- function __extends(d, b) {
69
- if (typeof b !== "function" && b !== null)
70
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
71
- extendStatics(d, b);
72
- function __() { this.constructor = d; }
73
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
74
- }
75
- var __assign = function () {
76
- __assign = Object.assign || function __assign(t) {
77
- for (var s, i = 1, n = arguments.length; i < n; i++) {
78
- s = arguments[i];
79
- for (var p in s)
80
- if (Object.prototype.hasOwnProperty.call(s, p))
81
- t[p] = s[p];
82
- }
83
- return t;
84
- };
85
- return __assign.apply(this, arguments);
86
- };
87
- function __rest(s, e) {
88
- var t = {};
89
- for (var p in s)
90
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
91
- t[p] = s[p];
92
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
93
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
94
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
95
- t[p[i]] = s[p[i]];
96
- }
97
- return t;
98
- }
99
- function __decorate(decorators, target, key, desc) {
100
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
101
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
102
- r = Reflect.decorate(decorators, target, key, desc);
103
- else
104
- for (var i = decorators.length - 1; i >= 0; i--)
105
- if (d = decorators[i])
106
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
107
- return c > 3 && r && Object.defineProperty(target, key, r), r;
108
- }
109
- function __param(paramIndex, decorator) {
110
- return function (target, key) { decorator(target, key, paramIndex); };
111
- }
112
- function __metadata(metadataKey, metadataValue) {
113
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
114
- return Reflect.metadata(metadataKey, metadataValue);
115
- }
116
- function __awaiter(thisArg, _arguments, P, generator) {
117
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
118
- return new (P || (P = Promise))(function (resolve, reject) {
119
- function fulfilled(value) { try {
120
- step(generator.next(value));
121
- }
122
- catch (e) {
123
- reject(e);
124
- } }
125
- function rejected(value) { try {
126
- step(generator["throw"](value));
127
- }
128
- catch (e) {
129
- reject(e);
130
- } }
131
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
132
- step((generator = generator.apply(thisArg, _arguments || [])).next());
133
- });
134
- }
135
- function __generator(thisArg, body) {
136
- var _ = { label: 0, sent: function () { if (t[0] & 1)
137
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
138
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
139
- function verb(n) { return function (v) { return step([n, v]); }; }
140
- function step(op) {
141
- if (f)
142
- throw new TypeError("Generator is already executing.");
143
- while (_)
144
- try {
145
- 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)
146
- return t;
147
- if (y = 0, t)
148
- op = [op[0] & 2, t.value];
149
- switch (op[0]) {
150
- case 0:
151
- case 1:
152
- t = op;
153
- break;
154
- case 4:
155
- _.label++;
156
- return { value: op[1], done: false };
157
- case 5:
158
- _.label++;
159
- y = op[1];
160
- op = [0];
161
- continue;
162
- case 7:
163
- op = _.ops.pop();
164
- _.trys.pop();
165
- continue;
166
- default:
167
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
168
- _ = 0;
169
- continue;
170
- }
171
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
172
- _.label = op[1];
173
- break;
174
- }
175
- if (op[0] === 6 && _.label < t[1]) {
176
- _.label = t[1];
177
- t = op;
178
- break;
179
- }
180
- if (t && _.label < t[2]) {
181
- _.label = t[2];
182
- _.ops.push(op);
183
- break;
184
- }
185
- if (t[2])
186
- _.ops.pop();
187
- _.trys.pop();
188
- continue;
189
- }
190
- op = body.call(thisArg, _);
191
- }
192
- catch (e) {
193
- op = [6, e];
194
- y = 0;
195
- }
196
- finally {
197
- f = t = 0;
198
- }
199
- if (op[0] & 5)
200
- throw op[1];
201
- return { value: op[0] ? op[1] : void 0, done: true };
202
- }
203
- }
204
- var __createBinding = Object.create ? (function (o, m, k, k2) {
205
- if (k2 === undefined)
206
- k2 = k;
207
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
208
- }) : (function (o, m, k, k2) {
209
- if (k2 === undefined)
210
- k2 = k;
211
- o[k2] = m[k];
212
- });
213
- function __exportStar(m, o) {
214
- for (var p in m)
215
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
216
- __createBinding(o, m, p);
217
- }
218
- function __values(o) {
219
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
220
- if (m)
221
- return m.call(o);
222
- if (o && typeof o.length === "number")
223
- return {
224
- next: function () {
225
- if (o && i >= o.length)
226
- o = void 0;
227
- return { value: o && o[i++], done: !o };
228
- }
229
- };
230
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
231
- }
232
- function __read(o, n) {
233
- var m = typeof Symbol === "function" && o[Symbol.iterator];
234
- if (!m)
235
- return o;
236
- var i = m.call(o), r, ar = [], e;
237
- try {
238
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
239
- ar.push(r.value);
240
- }
241
- catch (error) {
242
- e = { error: error };
243
- }
244
- finally {
245
- try {
246
- if (r && !r.done && (m = i["return"]))
247
- m.call(i);
248
- }
249
- finally {
250
- if (e)
251
- throw e.error;
252
- }
253
- }
254
- return ar;
255
- }
256
- /** @deprecated */
257
- function __spread() {
258
- for (var ar = [], i = 0; i < arguments.length; i++)
259
- ar = ar.concat(__read(arguments[i]));
260
- return ar;
261
- }
262
- /** @deprecated */
263
- function __spreadArrays() {
264
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
265
- s += arguments[i].length;
266
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
267
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
268
- r[k] = a[j];
269
- return r;
270
- }
271
- function __spreadArray(to, from, pack) {
272
- if (pack || arguments.length === 2)
273
- for (var i = 0, l = from.length, ar; i < l; i++) {
274
- if (ar || !(i in from)) {
275
- if (!ar)
276
- ar = Array.prototype.slice.call(from, 0, i);
277
- ar[i] = from[i];
278
- }
279
- }
280
- return to.concat(ar || Array.prototype.slice.call(from));
281
- }
282
- function __await(v) {
283
- return this instanceof __await ? (this.v = v, this) : new __await(v);
284
- }
285
- function __asyncGenerator(thisArg, _arguments, generator) {
286
- if (!Symbol.asyncIterator)
287
- throw new TypeError("Symbol.asyncIterator is not defined.");
288
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
289
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
290
- function verb(n) { if (g[n])
291
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
292
- function resume(n, v) { try {
293
- step(g[n](v));
294
- }
295
- catch (e) {
296
- settle(q[0][3], e);
297
- } }
298
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
299
- function fulfill(value) { resume("next", value); }
300
- function reject(value) { resume("throw", value); }
301
- function settle(f, v) { if (f(v), q.shift(), q.length)
302
- resume(q[0][0], q[0][1]); }
303
- }
304
- function __asyncDelegator(o) {
305
- var i, p;
306
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
307
- 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; }
308
- }
309
- function __asyncValues(o) {
310
- if (!Symbol.asyncIterator)
311
- throw new TypeError("Symbol.asyncIterator is not defined.");
312
- var m = o[Symbol.asyncIterator], i;
313
- 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);
314
- 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); }); }; }
315
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
316
- }
317
- function __makeTemplateObject(cooked, raw) {
318
- if (Object.defineProperty) {
319
- Object.defineProperty(cooked, "raw", { value: raw });
320
- }
321
- else {
322
- cooked.raw = raw;
323
- }
324
- return cooked;
325
- }
326
- ;
327
- var __setModuleDefault = Object.create ? (function (o, v) {
328
- Object.defineProperty(o, "default", { enumerable: true, value: v });
329
- }) : function (o, v) {
330
- o["default"] = v;
331
- };
332
- function __importStar(mod) {
333
- if (mod && mod.__esModule)
334
- return mod;
335
- var result = {};
336
- if (mod != null)
337
- for (var k in mod)
338
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
339
- __createBinding(result, mod, k);
340
- __setModuleDefault(result, mod);
341
- return result;
342
- }
343
- function __importDefault(mod) {
344
- return (mod && mod.__esModule) ? mod : { default: mod };
345
- }
346
- function __classPrivateFieldGet(receiver, state, kind, f) {
347
- if (kind === "a" && !f)
348
- throw new TypeError("Private accessor was defined without a getter");
349
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
350
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
351
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
352
- }
353
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
354
- if (kind === "m")
355
- throw new TypeError("Private method is not writable");
356
- if (kind === "a" && !f)
357
- throw new TypeError("Private accessor was defined without a setter");
358
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
359
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
360
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
361
- }
362
-
363
- var DEFAULT = 'zh-CN';
364
- var LANGS = {
365
- 'zh-CN': {
366
- text: '简体中文',
367
- ng: ngZh__default["default"],
368
- zorro: i2.zh_CN,
369
- date: locale.zhCN,
370
- yelon: i1.zh_CN,
371
- abbr: '🇨🇳'
372
- },
373
- 'zh-TW': {
374
- text: '繁体中文',
375
- ng: ngZhTw__default["default"],
376
- zorro: i2.zh_TW,
377
- date: locale.zhTW,
378
- yelon: i1.zh_TW,
379
- abbr: '🇭🇰'
380
- },
381
- 'en-US': {
382
- text: 'English',
383
- ng: ngEn__default["default"],
384
- zorro: i2.en_US,
385
- date: locale.enUS,
386
- yelon: i1.en_US,
387
- abbr: '🇬🇧'
388
- }
389
- };
390
- var YzI18NService = /** @class */ (function (_super) {
391
- __extends(YzI18NService, _super);
392
- function YzI18NService(http, settings, nzI18nService, yelonLocaleService, platform, cogSrv) {
393
- var _this = _super.call(this, cogSrv) || this;
394
- _this.http = http;
395
- _this.settings = settings;
396
- _this.nzI18nService = nzI18nService;
397
- _this.yelonLocaleService = yelonLocaleService;
398
- _this.platform = platform;
399
- _this._defaultLang = DEFAULT;
400
- _this._langs = Object.keys(LANGS).map(function (code) {
401
- var item = LANGS[code];
402
- return { code: code, text: item.text, abbr: item.abbr };
403
- });
404
- var defaultLang = _this.getDefaultLang();
405
- _this._defaultLang = _this._langs.findIndex(function (w) { return w.code === defaultLang; }) === -1 ? DEFAULT : defaultLang;
406
- return _this;
407
- }
408
- YzI18NService.prototype.getDefaultLang = function () {
409
- if (!this.platform.isBrowser) {
410
- return DEFAULT;
411
- }
412
- if (this.settings.layout.lang) {
413
- return this.settings.layout.lang;
414
- }
415
- var res = (navigator.languages ? navigator.languages[0] : null) || navigator.language;
416
- var arr = res.split('-');
417
- return arr.length <= 1 ? res : arr[0] + "-" + arr[1].toUpperCase();
418
- };
419
- YzI18NService.prototype.loadLangData = function (lang) {
420
- return this.http.get("assets/tmp/i18n/" + lang + ".json");
421
- };
422
- YzI18NService.prototype.use = function (lang, data) {
423
- if (this._currentLang === lang)
424
- return;
425
- this._data = this.flatData(data, []);
426
- var item = LANGS[lang];
427
- common.registerLocaleData(item.ng);
428
- this.nzI18nService.setLocale(item.zorro);
429
- this.nzI18nService.setDateLocale(item.date);
430
- this.yelonLocaleService.setLocale(item.yelon);
431
- this._currentLang = lang;
432
- this._change$.next(lang);
433
- };
434
- YzI18NService.prototype.getLangs = function () {
435
- return this._langs;
436
- };
437
- return YzI18NService;
438
- }(i1.YunzaiI18nBaseService));
439
- 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(i1__namespace$1.YunzaiConfigService)); }, token: YzI18NService, providedIn: "root" });
440
- YzI18NService.decorators = [
441
- { type: i0.Injectable, args: [{ providedIn: 'root' },] }
442
- ];
443
- YzI18NService.ctorParameters = function () { return [
444
- { type: i1._HttpClient },
445
- { type: i1.SettingsService },
446
- { type: i2.NzI18nService },
447
- { type: i1.YelonLocaleService },
448
- { type: i3.Platform },
449
- { type: i1$1.YunzaiConfigService }
450
- ]; };
451
-
452
- exports.TOPIC = void 0;
453
- (function (TOPIC) {
454
- TOPIC[TOPIC["FULL"] = 0] = "FULL";
455
- TOPIC[TOPIC["OWN"] = 1] = "OWN";
456
- TOPIC[TOPIC["EVERY"] = 2] = "EVERY";
457
- })(exports.TOPIC || (exports.TOPIC = {}));
458
- var YzHeaderApplicationComponent = /** @class */ (function () {
459
- function YzHeaderApplicationComponent(inject, cacheService, i18n, http) {
460
- this.inject = inject;
461
- this.cacheService = cacheService;
462
- this.i18n = i18n;
463
- this.http = http;
464
- this.T = exports.TOPIC;
465
- this.active = false;
466
- this.topicData = [];
467
- this.listData = [];
468
- this.topic = exports.TOPIC.FULL;
469
- this.searchValue = null;
470
- this.subs = [];
471
- }
472
- YzHeaderApplicationComponent.prototype.ngOnInit = function () {
473
- this.topicData = this.cacheService.get('_yz_header', { mode: 'none' });
474
- this.listData = this.cacheService.get('_yz_header', { mode: 'none' });
475
- };
476
- YzHeaderApplicationComponent.prototype.ngOnDestroy = function () {
477
- this.subs.forEach(function (f) { return f.unsubscribe(); });
478
- };
479
- YzHeaderApplicationComponent.prototype.diffChange = function (flag) {
480
- if (flag) {
481
- this.active = flag;
482
- }
483
- else {
484
- this.active = !this.active;
485
- }
486
- };
487
- YzHeaderApplicationComponent.prototype.initTopic = function (topic) {
488
- this.searchValue = null;
489
- this.listData = this.cacheService.get('_yz_header', { mode: 'none' });
490
- this.topic = topic;
491
- };
492
- YzHeaderApplicationComponent.prototype.full = function () {
493
- this.initTopic(exports.TOPIC.FULL);
494
- };
495
- YzHeaderApplicationComponent.prototype.own = function () {
496
- this.initTopic(exports.TOPIC.OWN);
497
- var temp = this.cacheService.get('_yz_header', { mode: 'none' });
498
- this.listData = temp
499
- .filter(function (topic) {
500
- topic.children = topic.children.filter(function (child) {
501
- return child.auth;
502
- });
503
- return topic;
504
- })
505
- .filter(function (topic) {
506
- return topic.children.length > 0;
507
- });
508
- };
509
- YzHeaderApplicationComponent.prototype.every = function (e) {
510
- this.initTopic(exports.TOPIC.EVERY);
511
- this.choosed = e;
512
- var temp = this.cacheService.get('_yz_header', { mode: 'none' });
513
- this.listData = __spreadArray([], __read(temp.filter(function (t) { return t.key === e.key; })[0].children));
514
- };
515
- YzHeaderApplicationComponent.prototype.onSearch = function () {
516
- var _this = this;
517
- var temp = this.cacheService.get('_yz_header', { mode: 'none' });
518
- // 如果搜索输入的有值
519
- if (this.searchValue) {
520
- // 过滤菜单过滤出搜索的值
521
- this.listData = temp
522
- .filter(function (topic) {
523
- if (_this.i18n.fanyi(topic.name).includes(_this.searchValue)) {
524
- return topic;
525
- }
526
- else {
527
- topic.children = topic.children.filter(function (child) {
528
- return _this.i18n.fanyi(child.name).includes(_this.searchValue);
529
- });
530
- return topic;
531
- }
532
- })
533
- .filter(function (topic) {
534
- return topic.children.length > 0;
535
- });
536
- }
537
- else {
538
- // 如果没有值,取消搜索
539
- this.listData = this.cacheService.get('_yz_header', { mode: 'none' });
540
- }
541
- };
542
- YzHeaderApplicationComponent.prototype.open = function (topic) {
543
- if (topic.key) {
544
- this.subs.push(this.http
545
- .post("/app-manager/web-scan/save", {
546
- appId: topic.key,
547
- createDate: new Date()
548
- })
549
- .subscribe());
550
- }
551
- switch (topic.target) {
552
- case 'href':
553
- this.inject.get(util.WINDOW).location.href = topic.url;
554
- break;
555
- case 'blank':
556
- this.inject.get(util.WINDOW).location.href = topic.url;
557
- break;
558
- case 'target':
559
- this.inject.get(util.WINDOW).location.href = topic.url;
560
- break;
561
- default:
562
- this.inject.get(util.WINDOW).location.href = topic.url;
563
- break;
564
- }
565
- };
566
- return YzHeaderApplicationComponent;
567
- }());
568
- YzHeaderApplicationComponent.decorators = [
569
- { type: i0.Component, args: [{
570
- selector: 'yz-header-application',
571
- 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 ",
572
- changeDetection: i0.ChangeDetectionStrategy.OnPush
573
- },] }
574
- ];
575
- YzHeaderApplicationComponent.ctorParameters = function () { return [
576
- { type: i0.Injector },
577
- { type: i2$1.CacheService },
578
- { type: YzI18NService },
579
- { type: i1._HttpClient }
580
- ]; };
581
-
582
- var YzHeaderI18NComponent = /** @class */ (function () {
583
- function YzHeaderI18NComponent(settings, i18n, doc) {
584
- this.settings = settings;
585
- this.i18n = i18n;
586
- this.doc = doc;
587
- /** Whether to display language text */
588
- this.showLangText = true;
589
- }
590
- Object.defineProperty(YzHeaderI18NComponent.prototype, "langs", {
591
- get: function () {
592
- return this.i18n.getLangs();
593
- },
594
- enumerable: false,
595
- configurable: true
596
- });
597
- Object.defineProperty(YzHeaderI18NComponent.prototype, "curLangCode", {
598
- get: function () {
599
- return this.settings.layout.lang;
600
- },
601
- enumerable: false,
602
- configurable: true
603
- });
604
- YzHeaderI18NComponent.prototype.change = function (lang) {
605
- var _this = this;
606
- var spinEl = this.doc.createElement('div');
607
- spinEl.setAttribute('class', "page-loading ant-spin ant-spin-lg ant-spin-spinning");
608
- spinEl.innerHTML = "<span class=\"ant-spin-dot ant-spin-dot-spin\"><i></i><i></i><i></i><i></i></span>";
609
- this.doc.body.appendChild(spinEl);
610
- this.i18n.loadLangData(lang).subscribe(function (res) {
611
- _this.i18n.use(lang, res);
612
- _this.settings.setLayout('lang', lang);
613
- setTimeout(function () { return _this.doc.location.reload(); });
614
- });
615
- };
616
- return YzHeaderI18NComponent;
617
- }());
618
- YzHeaderI18NComponent.decorators = [
619
- { type: i0.Component, args: [{
620
- selector: 'yz-header-i18n',
621
- 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 ",
622
- changeDetection: i0.ChangeDetectionStrategy.OnPush
623
- },] }
624
- ];
625
- YzHeaderI18NComponent.ctorParameters = function () { return [
626
- { type: i1.SettingsService },
627
- { type: YzI18NService, decorators: [{ type: i0.Inject, args: [i1.YUNZAI_I18N_TOKEN,] }] },
628
- { type: undefined, decorators: [{ type: i0.Inject, args: [common.DOCUMENT,] }] }
629
- ]; };
630
- YzHeaderI18NComponent.propDecorators = {
631
- showLangText: [{ type: i0.Input }]
632
- };
633
- __decorate([
634
- decorator.InputBoolean()
635
- ], YzHeaderI18NComponent.prototype, "showLangText", void 0);
636
-
637
- var YzHeaderNotifyComponent = /** @class */ (function () {
638
- function YzHeaderNotifyComponent(injector, msg, y18n, nzI18n, cdr, httpClient) {
639
- this.injector = injector;
640
- this.msg = msg;
641
- this.y18n = y18n;
642
- this.nzI18n = nzI18n;
643
- this.cdr = cdr;
644
- this.httpClient = httpClient;
645
- this.data = [
646
- {
647
- key: 'msg',
648
- title: this.y18n.fanyi('notify.message'),
649
- list: [],
650
- emptyText: this.y18n.fanyi('notify.message.emptyText'),
651
- emptyImage: './assets/tmp/img/message.svg',
652
- clearText: this.y18n.fanyi('notify.message.clearText')
653
- },
654
- {
655
- key: 'todo',
656
- title: this.y18n.fanyi('notify.todo'),
657
- list: [],
658
- emptyText: this.y18n.fanyi('notify.todo.emptyText'),
659
- emptyImage: './assets/tmp/img/todo.svg',
660
- clearText: this.y18n.fanyi('notify.todo.clearText')
661
- },
662
- {
663
- key: 'notice',
664
- title: this.y18n.fanyi('notify.notice'),
665
- list: [],
666
- emptyText: this.y18n.fanyi('notify.notice.emptyText'),
667
- emptyImage: './assets/tmp/img/notice.svg',
668
- clearText: this.y18n.fanyi('notify.notice.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: _this.y18n.fanyi('notify.unread'), color: 'red' };
694
- case '1':
695
- return { extra: _this.y18n.fanyi('notify.readed'), color: 'green' };
696
- default:
697
- return { extra: _this.y18n.fanyi('notify.nostatus'), 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: _this.y18n.fanyi('notify.unstart'), color: 'red' };
721
- case '1':
722
- return { extra: _this.y18n.fanyi('notify.started'), color: 'green' };
723
- default:
724
- return { extra: _this.y18n.fanyi('notify.nostatus'), 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(_this.y18n.fanyi('notify.clear') + " " + 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: YzI18NService, decorators: [{ type: i0.Inject, args: [i1.YUNZAI_I18N_TOKEN,] }] },
774
- { type: i2.NzI18nService },
775
- { type: i0.ChangeDetectorRef },
776
- { type: i1._HttpClient }
777
- ]; };
778
-
779
- var YzHeaderThemBtnComponent = /** @class */ (function () {
780
- function YzHeaderThemBtnComponent(renderer, configSrv, platform, doc, directionality, KEYS) {
781
- this.renderer = renderer;
782
- this.configSrv = configSrv;
783
- this.platform = platform;
784
- this.doc = doc;
785
- this.directionality = directionality;
786
- this.KEYS = KEYS;
787
- this.theme = 'default';
788
- this.types = [
789
- { key: 'default', text: 'theme.default', color: '#2163ff' },
790
- { key: 'compact', text: 'theme.compact', color: '#2163ff' },
791
- { key: 'dark', text: 'theme.dark', color: '#020202' },
792
- { key: 'yuhong', text: 'theme.yuhong', color: '#C04851' },
793
- { key: 'danjuhuang', text: 'theme.danjuhuang', color: '#FBA414' },
794
- { key: 'xinghuang', text: 'theme.xinghuang', color: '#F28E16' },
795
- { key: 'shilv', text: 'theme.shilv', color: '#57C3C2' },
796
- { key: 'zhulv', text: 'theme.zhulv', color: '#1BA784' },
797
- { key: 'youlan', text: 'theme.youlan', color: '#1781B5' },
798
- { key: 'dianqing', text: 'theme.dianqing', color: '#1661AB' },
799
- { key: 'shangengzi', text: 'theme.shangengzi', color: '#61649F' },
800
- { key: 'shuiniuhui', text: 'theme.shuiniuhui', color: '#2F2F35' }
801
- ];
802
- this.devTips = "When the dark.css file can't be found, you need to run it once: npm run theme";
803
- this.deployUrl = '';
804
- this.destroy$ = new rxjs.Subject();
805
- this.dir = 'ltr';
806
- }
807
- YzHeaderThemBtnComponent.prototype.ngOnInit = function () {
808
- var _this = this;
809
- var _a;
810
- this.dir = this.directionality.value;
811
- (_a = this.directionality.change) === null || _a === void 0 ? void 0 : _a.pipe(operators.takeUntil(this.destroy$)).subscribe(function (direction) {
812
- _this.dir = direction;
813
- });
814
- this.initTheme();
815
- };
816
- YzHeaderThemBtnComponent.prototype.initTheme = function () {
817
- if (!this.platform.isBrowser) {
818
- return;
819
- }
820
- this.theme = localStorage.getItem(this.KEYS) || 'default';
821
- this.updateChartTheme();
822
- this.onThemeChange(this.theme);
823
- };
824
- YzHeaderThemBtnComponent.prototype.updateChartTheme = function () {
825
- this.configSrv.set('chart', { theme: this.theme === 'dark' ? 'dark' : '' });
826
- };
827
- YzHeaderThemBtnComponent.prototype.onThemeChange = function (theme) {
828
- if (!this.platform.isBrowser) {
829
- return;
830
- }
831
- this.theme = theme;
832
- this.renderer.setAttribute(this.doc.body, 'data-theme', theme);
833
- var dom = this.doc.getElementById(this.KEYS);
834
- if (dom) {
835
- dom.remove();
836
- }
837
- localStorage.removeItem(this.KEYS);
838
- if (theme !== 'default') {
839
- var el = this.doc.createElement('link');
840
- el.type = 'text/css';
841
- el.rel = 'stylesheet';
842
- el.id = this.KEYS;
843
- el.href = this.deployUrl + "assets/style." + theme + ".css";
844
- localStorage.setItem(this.KEYS, theme);
845
- this.doc.body.append(el);
846
- }
847
- this.updateChartTheme();
848
- };
849
- YzHeaderThemBtnComponent.prototype.ngOnDestroy = function () {
850
- var el = this.doc.getElementById(this.KEYS);
851
- if (el != null) {
852
- this.doc.body.removeChild(el);
853
- }
854
- this.destroy$.next();
855
- this.destroy$.complete();
856
- };
857
- return YzHeaderThemBtnComponent;
858
- }());
859
- YzHeaderThemBtnComponent.decorators = [
860
- { type: i0.Component, args: [{
861
- selector: 'yz-header-theme-btn',
862
- 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 ",
863
- changeDetection: i0.ChangeDetectionStrategy.OnPush
864
- },] }
865
- ];
866
- YzHeaderThemBtnComponent.ctorParameters = function () { return [
867
- { type: i0.Renderer2 },
868
- { type: i1$1.YunzaiConfigService },
869
- { type: i3.Platform },
870
- { type: undefined, decorators: [{ type: i0.Inject, args: [common.DOCUMENT,] }] },
871
- { type: bidi.Directionality, decorators: [{ type: i0.Optional }] },
872
- { type: String, decorators: [{ type: i0.Inject, args: [themeBtn.YUNZAI_THEME_BTN_KEYS,] }] }
873
- ]; };
874
- YzHeaderThemBtnComponent.propDecorators = {
875
- types: [{ type: i0.Input }],
876
- devTips: [{ type: i0.Input }],
877
- deployUrl: [{ type: i0.Input }]
878
- };
879
-
880
- var BUSINESS_DEFAULT_CONFIG = {
881
- baseUrl: '/backstage',
882
- systemCode: 'portal',
883
- loginForm: null,
884
- refreshTokenEnabled: true,
885
- refreshTokenType: 're-request'
886
- };
887
- function mergeBisConfig(srv) {
888
- return srv.merge('bis', BUSINESS_DEFAULT_CONFIG);
889
- }
890
-
891
- var YzHeaderUserComponent = /** @class */ (function () {
892
- function YzHeaderUserComponent(injector, msg, tokenService,
893
- // @ts-ignore
894
- configService, cacheService) {
895
- this.injector = injector;
896
- this.msg = msg;
897
- this.tokenService = tokenService;
898
- this.configService = configService;
899
- this.cacheService = cacheService;
900
- this.icon = '';
901
- this.username = '';
902
- this.menus = [];
903
- this.config = mergeBisConfig(configService);
904
- }
905
- YzHeaderUserComponent.prototype.ngOnInit = function () {
906
- var projectInfo = this.cacheService.get('_yz_project_info', { mode: 'none' });
907
- var user = this.cacheService.get('_yz_user', { mode: 'none' });
908
- this.username = user.realname ? user.realname : '未命名';
909
- this.icon = user.avatarId
910
- ? this.config.baseUrl + "/filecenter/file/" + user.avatarId
911
- : "./assets/tmp/img/avatar.jpg";
912
- this.menus = projectInfo.profileList;
913
- };
914
- YzHeaderUserComponent.prototype.logout = function () {
915
- localStorage.clear();
916
- this.tokenService.clear();
917
- this.injector.get(util.WINDOW).location.href = this.config.baseUrl + "/cas-proxy/app/logout";
918
- };
919
- YzHeaderUserComponent.prototype.to = function (href) {
920
- if (href) {
921
- this.injector.get(util.WINDOW).open(href);
922
- }
923
- else {
924
- this.msg.error('该菜单没有配置链接!');
925
- }
926
- };
927
- return YzHeaderUserComponent;
928
- }());
929
- YzHeaderUserComponent.decorators = [
930
- { type: i0.Component, args: [{
931
- selector: 'yz-header-user',
932
- 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 ",
933
- changeDetection: i0.ChangeDetectionStrategy.OnPush
934
- },] }
935
- ];
936
- YzHeaderUserComponent.ctorParameters = function () { return [
937
- { type: i0.Injector },
938
- { type: message.NzMessageService },
939
- { type: undefined, decorators: [{ type: i0.Inject, args: [auth.YA_SERVICE_TOKEN,] }] },
940
- { type: util.YunzaiConfigService },
941
- { type: i2$1.CacheService }
942
- ]; };
943
-
944
- var YzHeaderClearStorageComponent = /** @class */ (function () {
945
- function YzHeaderClearStorageComponent(modalSrv, messageSrv) {
946
- this.modalSrv = modalSrv;
947
- this.messageSrv = messageSrv;
948
- }
949
- YzHeaderClearStorageComponent.prototype._click = function () {
950
- var _this = this;
951
- this.modalSrv.confirm({
952
- nzTitle: 'Make sure clear all local storage?',
953
- nzOnOk: function () {
954
- localStorage.clear();
955
- _this.messageSrv.success('Clear Finished!');
956
- }
957
- });
958
- };
959
- return YzHeaderClearStorageComponent;
960
- }());
961
- YzHeaderClearStorageComponent.decorators = [
962
- { type: i0.Component, args: [{
963
- selector: 'yz-header-clear-storage',
964
- template: "\n <i nz-icon nzType=\"tool\"></i>\n {{ 'menu.clear.local.storage' | i18n }}\n ",
965
- host: {
966
- '[class.d-block]': 'true'
967
- },
968
- changeDetection: i0.ChangeDetectionStrategy.OnPush
969
- },] }
970
- ];
971
- YzHeaderClearStorageComponent.ctorParameters = function () { return [
972
- { type: modal.NzModalService },
973
- { type: message.NzMessageService }
974
- ]; };
975
- YzHeaderClearStorageComponent.propDecorators = {
976
- _click: [{ type: i0.HostListener, args: ['click',] }]
977
- };
978
-
979
- var YzHeaderFullScreenComponent = /** @class */ (function () {
980
- function YzHeaderFullScreenComponent() {
981
- this.status = false;
982
- }
983
- Object.defineProperty(YzHeaderFullScreenComponent.prototype, "sf", {
984
- get: function () {
985
- return screenfull__namespace;
986
- },
987
- enumerable: false,
988
- configurable: true
989
- });
990
- YzHeaderFullScreenComponent.prototype._resize = function () {
991
- this.status = this.sf.isFullscreen;
992
- };
993
- YzHeaderFullScreenComponent.prototype._click = function () {
994
- if (this.sf.isEnabled) {
995
- this.sf.toggle();
996
- }
997
- };
998
- return YzHeaderFullScreenComponent;
999
- }());
1000
- YzHeaderFullScreenComponent.decorators = [
1001
- { type: i0.Component, args: [{
1002
- selector: 'yz-header-fullscreen',
1003
- template: "\n <i nz-icon [nzType]=\"status ? 'fullscreen-exit' : 'fullscreen'\"></i>\n {{ (status ? 'menu.fullscreen.exit' : 'menu.fullscreen') | i18n }}\n ",
1004
- host: {
1005
- '[class.d-block]': 'true'
1006
- },
1007
- changeDetection: i0.ChangeDetectionStrategy.OnPush
1008
- },] }
1009
- ];
1010
- YzHeaderFullScreenComponent.propDecorators = {
1011
- _resize: [{ type: i0.HostListener, args: ['window:resize',] }],
1012
- _click: [{ type: i0.HostListener, args: ['click',] }]
1013
- };
1014
-
1015
- var ContactService = /** @class */ (function () {
1016
- function ContactService(http, cache) {
1017
- this.http = http;
1018
- this.cache = cache;
1019
- }
1020
- /**
1021
- * 部门树查询
1022
- *
1023
- * @param clas 包含班级
1024
- * @param his 包含历史班级
1025
- * @param grade 系部
1026
- * @param gradeID 系部ID
1027
- * @returns 可观察部门树
1028
- */
1029
- ContactService.prototype.dept = function (clas, his, grade, gradeID) {
1030
- var baseUrl = "/auth/baseDepartMent/tree?debug=false";
1031
- if (clas) {
1032
- baseUrl += "&includeClass=true";
1033
- }
1034
- else {
1035
- baseUrl += "&includeClass=false";
1036
- }
1037
- if (his) {
1038
- baseUrl += "&includeHisClass=true";
1039
- }
1040
- else {
1041
- baseUrl += "&includeHisClass=false";
1042
- }
1043
- if (grade) {
1044
- baseUrl += "&deptTypes=2,class";
1045
- }
1046
- if (gradeID) {
1047
- baseUrl += "&gradeId=" + gradeID;
1048
- }
1049
- return this.http.get(baseUrl).pipe(operators.map(function (response) {
1050
- return response.data || [];
1051
- }));
1052
- };
1053
- ContactService.prototype.page = function (uri, page) {
1054
- return this.http.post(uri + "/queryListForPage", page);
1055
- };
1056
- ContactService.prototype.pageBaseUser = function (page) {
1057
- return this.page('/auth/baseUser', page);
1058
- };
1059
- ContactService.prototype.getUserByIds = function (ids) {
1060
- return this.http
1061
- .post('/auth/baseUser/users', {
1062
- userIds: ids
1063
- })
1064
- .pipe(function (response) {
1065
- return response.data || [];
1066
- });
1067
- };
1068
- /**
1069
- * 查询人员信息
1070
- *
1071
- * @param userIds[] 用户id数组,["aaa","bbb","ccc"]
1072
- */
1073
- ContactService.prototype.getUserByUserIds = function (userIds) {
1074
- return this.http
1075
- .post("/auth/baseUser/users", {
1076
- userIds: userIds
1077
- })
1078
- .pipe(operators.map(function (response) {
1079
- return response.data ? response.data : [];
1080
- }));
1081
- };
1082
- /**
1083
- * 获取角色组角色
1084
- *
1085
- * @param roleGroupCode 角色组code
1086
- */
1087
- ContactService.prototype.getGroupRole = function (roleGroupCode) {
1088
- return this.http
1089
- .post("/auth/baseRole/findGroupRole", {
1090
- roleGroupCode: roleGroupCode
1091
- })
1092
- .pipe(operators.map(function (response) {
1093
- return response.data ? response.data : [];
1094
- }));
1095
- };
1096
- /**
1097
- * 查询当前用户好友分组
1098
- */
1099
- ContactService.prototype.getFriendGroup = function () {
1100
- return this.http.post("/contact/appcontact/findGroup", {}).pipe(operators.map(function (response) {
1101
- return response.data ? response.data : [];
1102
- }));
1103
- };
1104
- /**
1105
- * 查询年级
1106
- */
1107
- ContactService.prototype.getGrade = function () {
1108
- return this.http.get("/auth/gradeYear/queryListForPage").pipe(operators.map(function (response) {
1109
- return response.data ? response.data : [];
1110
- }));
1111
- };
1112
- /**
1113
- * 查询人员类别列表
1114
- */
1115
- ContactService.prototype.getRylbs = function () {
1116
- return this.http.post("/auth/baseTeacher/queryRylbs", {}).pipe(operators.map(function (response) {
1117
- return response.data ? response.data : [];
1118
- }));
1119
- };
1120
- /**
1121
- * 获取学生公寓树
1122
- *
1123
- * @param isPower 是否带有权限,默认false
1124
- * @param treeType 树类型 0:宿舍楼 1:宿舍楼+层 2:宿舍楼+层+房间
1125
- */
1126
- ContactService.prototype.getDormTree = function (isPower, treeType) {
1127
- var user = this.cache.get('_yz_user', { mode: 'none' });
1128
- var params = {};
1129
- if (isPower) {
1130
- params = {
1131
- isPower: isPower,
1132
- userId: user.userId,
1133
- treeType: treeType
1134
- };
1135
- }
1136
- else {
1137
- params = {
1138
- isPower: isPower,
1139
- treeType: treeType
1140
- };
1141
- }
1142
- return this.http.post("/auth/dorm/tree", params).pipe(operators.map(function (response) {
1143
- return response.data ? response.data : [];
1144
- }));
1145
- };
1146
- return ContactService;
1147
- }());
1148
- ContactService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function ContactService_Factory() { return new ContactService(i0__namespace.ɵɵinject(i1__namespace._HttpClient), i0__namespace.ɵɵinject(i2__namespace$1.CacheService)); }, token: ContactService, providedIn: "root" });
1149
- ContactService.decorators = [
1150
- { type: i0.Injectable, args: [{
1151
- providedIn: 'root'
1152
- },] }
1153
- ];
1154
- ContactService.ctorParameters = function () { return [
1155
- { type: i1._HttpClient },
1156
- { type: i2$1.CacheService }
1157
- ]; };
1158
-
1159
- var ContactComponent = /** @class */ (function () {
1160
- function ContactComponent(contact, changeDetectorRef) {
1161
- this.contact = contact;
1162
- this.changeDetectorRef = changeDetectorRef;
1163
- this.subs = [];
1164
- /**
1165
- * tabset
1166
- */
1167
- this.nzTabsetSearch = null;
1168
- this.nzTabsetLoading = false;
1169
- /**
1170
- * 树展开状态
1171
- */
1172
- this.nzExpandAll = true;
1173
- /**
1174
- * 部门树和部门查询的一些选项/可传可不传
1175
- */
1176
- this.nzDepts = [];
1177
- this._nzDeptsCopy = [];
1178
- this.nzDeptTreeVirtualHeight = null;
1179
- this.nzDeptClass = true;
1180
- this.nzDeptClassHistory = true;
1181
- this.nzDeptGrade = false;
1182
- /**
1183
- * 角色树
1184
- */
1185
- this.nzRoles = [];
1186
- this._nzRolesCopy = [];
1187
- this.nzRoleTreeVirtualHeight = null;
1188
- /**
1189
- * 好友分组
1190
- */
1191
- this.nzFriendGroups = [];
1192
- this._nzFriendGroupsCopy = [];
1193
- /**
1194
- * 联系人
1195
- */
1196
- this.defaultContacts = [];
1197
- this.nzContacts = [];
1198
- this.nzContactLoading = false;
1199
- /**
1200
- * 提交和提交按钮
1201
- */
1202
- this.button = true;
1203
- this.confirmed = new i0.EventEmitter();
1204
- }
1205
- /**
1206
- * 初始化,首先加载部门树和默认选中的人的数据
1207
- */
1208
- ContactComponent.prototype.ngOnInit = function () {
1209
- this.onTabsetDept();
1210
- this.onContactsInit();
1211
- };
1212
- /**
1213
- * 视图初始化完毕后进行table初始化
1214
- */
1215
- ContactComponent.prototype.ngAfterViewInit = function () {
1216
- this.onTableInit();
1217
- };
1218
- /**
1219
- * 初始化默认选中联系人
1220
- */
1221
- ContactComponent.prototype.onContactsInit = function () {
1222
- var _this = this;
1223
- if (this.defaultContacts && this.defaultContacts.length > 0) {
1224
- this.nzContactLoading = true;
1225
- this.subs.push(this.contact.getUserByUserIds(this.defaultContacts).subscribe(function (contacts) {
1226
- _this.nzContacts = contacts;
1227
- _this.nzContactLoading = false;
1228
- _this.refresh();
1229
- }));
1230
- }
1231
- };
1232
- /**
1233
- * table初始化
1234
- */
1235
- ContactComponent.prototype.onTableInit = function () {
1236
- var _this = this;
1237
- // 设置表头
1238
- this.st.resetColumns({
1239
- columns: [
1240
- { title: '选择', type: 'checkbox' },
1241
- { title: '序号', type: 'no' },
1242
- { title: '姓名', index: 'realName' },
1243
- { title: '学号/工号', index: 'userCode' },
1244
- { title: '部门', index: 'dept.deptName' }
1245
- ]
1246
- });
1247
- // 订阅table点击checkbox事件变化
1248
- this.subs.push(this.st.change.subscribe(function (e) {
1249
- if (e.type === 'checkbox') {
1250
- // 点击checkbox新增联系人
1251
- var contactIds_1 = _this.nzContacts.map(function (c) { return c.userId; });
1252
- _this.nzContacts = _this.nzContacts.concat(e.checkbox.filter(function (c) { return !contactIds_1.includes(c.userId); }));
1253
- // 取消checkbox取消联系人
1254
- var cancelIds_1 = _this.st.list.filter(function (d) { return !d.checked; }).map(function (d) { return d.userId; });
1255
- _this.nzContacts = _this.nzContacts.filter(function (d) { return !cancelIds_1.includes(d.userId); });
1256
- }
1257
- }));
1258
- };
1259
- /**
1260
- * tabset进入加载状态
1261
- */
1262
- ContactComponent.prototype.onTabsetLoadStart = function () {
1263
- this.nzTabsetLoading = true;
1264
- };
1265
- /**
1266
- * tabset取消加载状态
1267
- */
1268
- ContactComponent.prototype.onTabsetLoadEnd = function () {
1269
- this.nzTabsetLoading = false;
1270
- };
1271
- /**
1272
- * tabset搜索框清除
1273
- */
1274
- ContactComponent.prototype.onTabsetSearchClean = function () {
1275
- this.nzDepts = this._nzDeptsCopy;
1276
- this.nzRoles = this._nzRolesCopy;
1277
- this.nzFriendGroups = this._nzFriendGroupsCopy;
1278
- this.nzTabsetSearch = null;
1279
- };
1280
- /**
1281
- * tabset搜索框输入
1282
- *
1283
- * @param type 类型
1284
- * @param value 值
1285
- */
1286
- ContactComponent.prototype.onTabsetSearchChange = function (type, value) {
1287
- this.onTabsetLoadStart();
1288
- if (!value || value === '') {
1289
- this.nzDepts = this._nzDeptsCopy;
1290
- this.nzRoles = this._nzRolesCopy;
1291
- this.nzFriendGroups = this._nzFriendGroupsCopy;
1292
- }
1293
- else {
1294
- var trees = [];
1295
- if (type === 'dept') {
1296
- this.searchTree(value, this._nzDeptsCopy, trees);
1297
- this.nzDepts = trees;
1298
- }
1299
- if (type === 'role') {
1300
- this.searchTree(value, this._nzRolesCopy, trees);
1301
- this.nzRoles = trees;
1302
- }
1303
- if (type === 'friendGroup') {
1304
- this.nzFriendGroups = this._nzFriendGroupsCopy.filter(function (f) {
1305
- return !f.name.indexOf(value);
1306
- });
1307
- }
1308
- }
1309
- this.onTabsetLoadEnd();
1310
- this.refresh();
1311
- };
1312
- /**
1313
- * tabset切换到部门
1314
- */
1315
- ContactComponent.prototype.onTabsetDept = function () {
1316
- this.onTabsetSearchClean();
1317
- if (!this.nzDepts || this.nzDepts.length === 0) {
1318
- this.onTabsetDeptFlush();
1319
- }
1320
- };
1321
- /**
1322
- * tabset切换到角色
1323
- */
1324
- ContactComponent.prototype.onTabsetRole = function () {
1325
- this.onTabsetSearchClean();
1326
- if (!this.nzRoles || this.nzRoles.length === 0) {
1327
- this.onTabsetRoleFlush(null);
1328
- }
1329
- };
1330
- /**
1331
- * tabset切换到好友分组
1332
- */
1333
- ContactComponent.prototype.onTabsetFriendGroup = function () {
1334
- this.onTabsetSearchClean();
1335
- if (!this.nzFriendGroups || this.nzFriendGroups.length === 0) {
1336
- this.onTabsetFriendGroupFlush();
1337
- }
1338
- };
1339
- /**
1340
- * 获取部门树
1341
- */
1342
- ContactComponent.prototype.onTabsetDeptFlush = function () {
1343
- var _this = this;
1344
- this.onTabsetLoadStart();
1345
- this.subs.push(this.contact
1346
- .dept(this.nzDeptClass, this.nzDeptClassHistory, this.nzDeptGrade, this.nzDeptGradeID)
1347
- .subscribe(function (trees) {
1348
- _this.expandTree(trees);
1349
- _this.nzDepts = trees;
1350
- _this._nzDeptsCopy = trees;
1351
- _this.onTabsetLoadEnd();
1352
- _this.refresh();
1353
- }));
1354
- };
1355
- // 获取角色树
1356
- ContactComponent.prototype.onTabsetRoleFlush = function (groupRoleCode) {
1357
- var _this = this;
1358
- this.onTabsetLoadStart();
1359
- this.subs.push(this.contact.getGroupRole(groupRoleCode).subscribe(function (roles) {
1360
- _this.expandTree(roles);
1361
- _this.nzRoles = roles;
1362
- _this._nzRolesCopy = roles;
1363
- _this.onTabsetLoadEnd();
1364
- _this.refresh();
1365
- }));
1366
- };
1367
- // 获取好友分组列表
1368
- ContactComponent.prototype.onTabsetFriendGroupFlush = function () {
1369
- var _this = this;
1370
- this.onTabsetLoadStart();
1371
- this.subs.push(this.contact.getFriendGroup().subscribe(function (group) {
1372
- _this.nzFriendGroups = group;
1373
- _this._nzFriendGroupsCopy = group;
1374
- _this.onTabsetLoadEnd();
1375
- _this.refresh();
1376
- }));
1377
- };
1378
- /**
1379
- * 部门树点击
1380
- *
1381
- * @param e 节点
1382
- */
1383
- ContactComponent.prototype.onDeptClick = function (e) {
1384
- var _this = this;
1385
- var _a;
1386
- // 构造分页请求,直接传入stTable组件,剩下的所有交给组件自己完成
1387
- this.st.data = '/auth/baseUser/queryListForPage';
1388
- this.st.req = {
1389
- allInBody: true,
1390
- method: 'POST',
1391
- type: 'page',
1392
- reName: {
1393
- pi: 'pageNum',
1394
- ps: 'pageSize'
1395
- },
1396
- body: {
1397
- pageParam: {
1398
- deptId: (_a = e.keys) === null || _a === void 0 ? void 0 : _a.pop()
1399
- }
1400
- }
1401
- };
1402
- // table数据预处理
1403
- this.st.res = {
1404
- process: function (data) {
1405
- _this.onTableCheck(data);
1406
- return data;
1407
- }
1408
- };
1409
- // 加载第一页
1410
- this.st.load(1);
1411
- };
1412
- /**
1413
- * 角色树点击
1414
- *
1415
- * @param e 节点
1416
- */
1417
- ContactComponent.prototype.onRoleClick = function (e) {
1418
- var _this = this;
1419
- var _a;
1420
- // 构造分页请求,直接传入stTable组件,剩下的所有交给组件自己完成
1421
- this.st.data = '/auth/baseUser/queryListForPage';
1422
- this.st.req = {
1423
- allInBody: true,
1424
- method: 'POST',
1425
- type: 'page',
1426
- reName: {
1427
- pi: 'pageNum',
1428
- ps: 'pageSize'
1429
- },
1430
- body: {
1431
- pageParam: {
1432
- roleId: (_a = e.keys) === null || _a === void 0 ? void 0 : _a.pop()
1433
- }
1434
- }
1435
- };
1436
- // table数据预处理
1437
- this.st.res = {
1438
- process: function (data) {
1439
- _this.onTableCheck(data);
1440
- return data;
1441
- }
1442
- };
1443
- // 加载第一页
1444
- this.st.load(1);
1445
- };
1446
- /**
1447
- * 好友分组点击
1448
- *
1449
- * @param e 分组
1450
- */
1451
- ContactComponent.prototype.onFriendGroupClick = function (e) {
1452
- var _this = this;
1453
- // 构造分页请求,直接传入stTable组件,剩下的所有交给组件自己完成
1454
- this.st.data = '/auth/baseUser/queryListForPage';
1455
- this.st.req = {
1456
- allInBody: true,
1457
- method: 'POST',
1458
- type: 'page',
1459
- reName: {
1460
- pi: 'pageNum',
1461
- ps: 'pageSize'
1462
- },
1463
- body: {
1464
- pageParam: {
1465
- friendGroupId: e.id
1466
- }
1467
- }
1468
- };
1469
- // table数据预处理
1470
- this.st.res = {
1471
- process: function (data) {
1472
- _this.onTableCheck(data);
1473
- return data;
1474
- }
1475
- };
1476
- // 加载第一页
1477
- this.st.load(1);
1478
- };
1479
- /**
1480
- * 点击右侧联系人进行删除
1481
- *
1482
- * @param c 点击的联系人
1483
- */
1484
- ContactComponent.prototype.onContactRemove = function (c) {
1485
- this.nzContacts = this.nzContacts.filter(function (contact) {
1486
- return contact.userId != c.userId;
1487
- });
1488
- this.st.reload();
1489
- };
1490
- /**
1491
- * 预处理table当前页数据,和nzContat对比,确定checkbox状态
1492
- *
1493
- * @param data 预处理数据
1494
- */
1495
- ContactComponent.prototype.onTableCheck = function (data) {
1496
- var ids = this.nzContacts.map(function (u) { return u.userId; });
1497
- data.forEach(function (d) {
1498
- if (ids.includes(d.userId)) {
1499
- d.checked = true;
1500
- }
1501
- else {
1502
- d.checked = false;
1503
- }
1504
- });
1505
- };
1506
- /**
1507
- * 递归树寻找name相同节点
1508
- *
1509
- * @param name 名称
1510
- * @param trees 需要递归的树
1511
- * @param list 搜索结果
1512
- */
1513
- ContactComponent.prototype.searchTree = function (name, trees, list) {
1514
- var _this = this;
1515
- if (trees && trees.length && trees.length > 0) {
1516
- trees.forEach(function (tree) {
1517
- if (tree.title.indexOf(name) != -1) {
1518
- list.push(tree);
1519
- }
1520
- if (tree.children) {
1521
- _this.searchTree(name, tree.children, list);
1522
- }
1523
- });
1524
- }
1525
- };
1526
- /**
1527
- * 递归树展开所有有子节点的节点
1528
- *
1529
- * @param trees 需要展开的树
1530
- */
1531
- ContactComponent.prototype.expandTree = function (trees) {
1532
- var _this = this;
1533
- if (trees && trees.length && trees.length > 0) {
1534
- trees.forEach(function (tree) {
1535
- if (!tree.children || tree.children.length === 0) {
1536
- tree.expanded = false;
1537
- tree.isLeaf = true;
1538
- }
1539
- if (tree.children) {
1540
- tree.expanded = _this.nzExpandAll;
1541
- tree.isLeaf = false;
1542
- _this.expandTree(tree.children);
1543
- }
1544
- });
1545
- }
1546
- };
1547
- /**
1548
- * 刷新当前页面
1549
- */
1550
- ContactComponent.prototype.refresh = function () {
1551
- this.changeDetectorRef.detectChanges();
1552
- };
1553
- /**
1554
- * 确认按钮output数据
1555
- */
1556
- ContactComponent.prototype.confirm = function () {
1557
- this.confirmed.next(this.nzContacts);
1558
- };
1559
- /**
1560
- * 销毁函数
1561
- */
1562
- ContactComponent.prototype.ngOnDestroy = function () {
1563
- this.nzDepts = [];
1564
- this.nzRoles = [];
1565
- this.nzContacts = [];
1566
- this.subs.forEach(function (s) { return s.unsubscribe(); });
1567
- };
1568
- return ContactComponent;
1569
- }());
1570
- ContactComponent.decorators = [
1571
- { type: i0.Component, args: [{
1572
- selector: 'contact',
1573
- template: "<nz-row [nzGutter]=\"16\">\n <nz-col [nzXs]=\"24\" [nzSm]=\"24\" [nzMd]=\"24\" [nzLg]=\"8\" [nzXl]=\"6\" [nzXXl]=\"6\">\n <nz-tabset nzCentered>\n <nz-tab nzTitle=\"\u90E8\u95E8\" (nzSelect)=\"onTabsetDept()\">\n <div sg-container=\"2\">\n <sg col=\"1\" class=\"nz-tabset-sg\">\n <nz-input-group class=\"nz-tabset-input\" [nzSuffix]=\"searchInputTpl\">\n <input\n nz-input\n [(ngModel)]=\"nzTabsetSearch\"\n (ngModelChange)=\"onTabsetSearchChange('dept', $event)\"\n type=\"text\"\n placeholder=\"\u8BF7\u8F93\u5165\u90E8\u95E8\u540D\u79F0\"\n />\n </nz-input-group>\n </sg>\n <sg col=\"1\">\n <nz-spin [nzSpinning]=\"nzTabsetLoading\">\n <nz-tree\n class=\"nz-tabset-content\"\n (nzClick)=\"onDeptClick($event)\"\n [nzBlockNode]=\"true\"\n [nzShowLine]=\"true\"\n [nzHideUnMatched]=\"true\"\n [nzVirtualHeight]=\"nzDeptTreeVirtualHeight\"\n [nzData]=\"nzDepts\"\n ></nz-tree>\n </nz-spin>\n </sg>\n </div>\n </nz-tab>\n <nz-tab nzTitle=\"\u89D2\u8272\" (nzSelect)=\"onTabsetRole()\">\n <div sg-container=\"2\">\n <sg col=\"1\" class=\"nz-tabset-sg\">\n <nz-input-group class=\"nz-tabset-input\" [nzSuffix]=\"searchInputTpl\">\n <input\n nz-input\n [(ngModel)]=\"nzTabsetSearch\"\n (ngModelChange)=\"onTabsetSearchChange('role', $event)\"\n type=\"text\"\n placeholder=\"\u8BF7\u8F93\u5165\u89D2\u8272\u540D\u79F0\"\n />\n </nz-input-group>\n </sg>\n <sg col=\"1\">\n <nz-spin [nzSpinning]=\"nzTabsetLoading\">\n <nz-tree\n class=\"nz-tabset-content\"\n (nzClick)=\"onRoleClick($event)\"\n [nzBlockNode]=\"true\"\n [nzShowLine]=\"true\"\n [nzHideUnMatched]=\"true\"\n [nzVirtualHeight]=\"nzRoleTreeVirtualHeight\"\n [nzData]=\"nzRoles\"\n ></nz-tree>\n </nz-spin>\n </sg>\n </div>\n </nz-tab>\n <nz-tab nzTitle=\"\u597D\u53CB\" (nzSelect)=\"onTabsetFriendGroup()\">\n <div sg-container=\"2\">\n <sg col=\"1\" class=\"nz-tabset-sg\">\n <nz-input-group class=\"nz-tabset-input\" [nzSuffix]=\"searchInputTpl\">\n <input\n nz-input\n [(ngModel)]=\"nzTabsetSearch\"\n (ngModelChange)=\"onTabsetSearchChange('friendGroup', $event)\"\n type=\"text\"\n placeholder=\"\u8BF7\u8F93\u5165\u597D\u53CB\u540D\u79F0\"\n />\n </nz-input-group>\n </sg>\n <sg col=\"1\">\n <nz-spin [nzSpinning]=\"nzTabsetLoading\">\n <nz-list class=\"nz-tabset-content\" nzItemLayout=\"horizontal\" [nzSplit]=\"false\" nzSize=\"small\">\n <nz-list-item\n class=\"nz-tabset-content-item\"\n *ngFor=\"let group of nzFriendGroups\"\n (click)=\"onFriendGroupClick(group)\"\n >\n <nz-list-item-meta>\n <nz-list-item-meta-title>\n {{ group.name }}\n </nz-list-item-meta-title>\n </nz-list-item-meta>\n </nz-list-item>\n </nz-list>\n </nz-spin>\n </sg>\n </div>\n </nz-tab>\n </nz-tabset>\n </nz-col>\n\n <nz-col [nzXs]=\"24\" [nzSm]=\"24\" [nzMd]=\"24\" [nzLg]=\"16\" [nzXl]=\"13\" [nzXXl]=\"13\">\n <st #st responsiveHideHeaderFooter></st>\n </nz-col>\n\n <nz-col [nzXs]=\"24\" [nzSm]=\"24\" [nzMd]=\"24\" [nzLg]=\"24\" [nzXl]=\"5\" [nzXXl]=\"5\">\n <nz-spin [nzSpinning]=\"nzContactLoading\">\n <nz-list nzItemLayout=\"horizontal\" [nzSplit]=\"false\" nzSize=\"small\">\n <nz-list-item\n class=\"nz-tabset-content-item\"\n *ngFor=\"let contact of nzContacts\"\n (click)=\"onContactRemove(contact)\"\n >\n <nz-list-item-meta>\n <nz-list-item-meta-title>\n {{ contact.realName }}\n </nz-list-item-meta-title>\n </nz-list-item-meta>\n </nz-list-item>\n </nz-list>\n </nz-spin>\n </nz-col>\n</nz-row>\n\n<nz-row *ngIf=\"button\">\n <nz-col [nzSpan]=\"4\" [nzOffset]=\"20\">\n <button nz-button nzType=\"primary\" (click)=\"confirm()\">\u786E\u5B9A</button>\n </nz-col>\n</nz-row>\n\n<ng-template #searchInputTpl>\n <i nz-icon nzType=\"close\" nzTheme=\"outline\" *ngIf=\"nzTabsetSearch\" (click)=\"onTabsetSearchClean()\"></i>\n <i nz-icon nzType=\"search\" nzTheme=\"outline\" *ngIf=\"!nzTabsetSearch\"></i>\n</ng-template>\n",
1574
- styles: [".nz-tabset-input{width:100%}.nz-tabset-content{padding:20px}.nz-tabset-sg{padding-right:38px!important;padding-left:38px!important}.nz-tabset-content-item:hover{background-color:#f1f1f1;cursor:pointer}\n"]
1575
- },] }
1576
- ];
1577
- ContactComponent.ctorParameters = function () { return [
1578
- { type: ContactService },
1579
- { type: i0.ChangeDetectorRef }
1580
- ]; };
1581
- ContactComponent.propDecorators = {
1582
- nzTabsetSearch: [{ type: i0.Optional }, { type: i0.Input }],
1583
- nzTabsetLoading: [{ type: i0.Optional }, { type: i0.Input }],
1584
- nzExpandAll: [{ type: i0.Optional }, { type: i0.Input }],
1585
- nzDepts: [{ type: i0.Optional }, { type: i0.Input }],
1586
- nzDeptTreeVirtualHeight: [{ type: i0.Optional }, { type: i0.Input }],
1587
- nzDeptClass: [{ type: i0.Optional }, { type: i0.Input }],
1588
- nzDeptClassHistory: [{ type: i0.Optional }, { type: i0.Input }],
1589
- nzDeptGrade: [{ type: i0.Optional }, { type: i0.Input }],
1590
- nzDeptGradeID: [{ type: i0.Optional }, { type: i0.Input }],
1591
- nzRoles: [{ type: i0.Optional }, { type: i0.Input }],
1592
- nzRoleTreeVirtualHeight: [{ type: i0.Optional }, { type: i0.Input }],
1593
- nzFriendGroups: [{ type: i0.Optional }, { type: i0.Input }],
1594
- st: [{ type: i0.ViewChild, args: ['st', { static: false },] }],
1595
- defaultContacts: [{ type: i0.Optional }, { type: i0.Input }],
1596
- nzContacts: [{ type: i0.Optional }, { type: i0.Input }],
1597
- nzContactLoading: [{ type: i0.Optional }, { type: i0.Input }],
1598
- button: [{ type: i0.Optional }, { type: i0.Input }],
1599
- confirmed: [{ type: i0.Output }]
1600
- };
1601
-
1602
- var ɵ0 = function (msg) {
1603
- util.log(msg);
1604
- };
1605
- var STOMP_DEFAULT_CONFIG = {
1606
- connectHeaders: {
1607
- login: 'guest',
1608
- passcode: 'guest'
1609
- },
1610
- brokerURL: '/websocket/ws/',
1611
- heartbeatIncoming: 1000 * 60,
1612
- heartbeatOutgoing: 1000 * 60,
1613
- reconnectDelay: 30000000,
1614
- debug: ɵ0
1615
- };
1616
- function mergeStompConfig(srv) {
1617
- return srv.merge('stomp', STOMP_DEFAULT_CONFIG);
1618
- }
1619
-
1620
- var YzStompService = /** @class */ (function () {
1621
- function YzStompService(csr, cache, injector, notification) {
1622
- this.csr = csr;
1623
- this.cache = cache;
1624
- this.injector = injector;
1625
- this.notification = notification;
1626
- this.subs = [];
1627
- if (!this.user) {
1628
- this.user = this.cache.get('_yz_user', { mode: 'none' });
1629
- }
1630
- if (!this.config) {
1631
- this.config = mergeStompConfig(this.csr);
1632
- }
1633
- if (!this.bisConfig) {
1634
- this.bisConfig = mergeBisConfig(csr);
1635
- }
1636
- if (!this.rxStomp) {
1637
- this.rxStomp = new rxStomp.RxStomp();
1638
- if (i0.isDevMode()) {
1639
- util.log('yz.stomp.service: is dev mode');
1640
- util.log('yz.stomp.service: ', "config is " + JSON.stringify(this.config));
1641
- this.rxStomp.configure(this.config);
1642
- return;
1643
- }
1644
- var location = this.injector.get(common.DOCUMENT).location;
1645
- var protocol = location.protocol, host = location.host;
1646
- util.log('yz.stomp.service: ', "protocol is " + protocol + ",host is " + host);
1647
- if (protocol.includes('http') && !protocol.includes('https')) {
1648
- this.config.brokerURL = "ws://" + host + this.config.brokerURL;
1649
- }
1650
- if (protocol.includes('https')) {
1651
- this.config.brokerURL = "wss://" + host + this.config.brokerURL;
1652
- }
1653
- util.log('yz.stomp.service: ', "config is " + this.config);
1654
- this.rxStomp.configure(this.config);
1655
- }
1656
- }
1657
- YzStompService.prototype.listen = function () {
1658
- var _this = this;
1659
- this.subs.push(this.rxStomp.watch("/topic/layout_" + this.user.username).subscribe(function (message) {
1660
- _this.createNotification(JSON.parse(message.body));
1661
- }));
1662
- this.subs.push(this.rxStomp.watch("/topic/layout_xx_" + this.user.username).subscribe(function (message) {
1663
- _this.logoutNotification(JSON.parse(message.body));
1664
- }));
1665
- this.rxStomp.activate();
1666
- };
1667
- YzStompService.prototype.createNotification = function (message) {
1668
- this.notification.create(message.type, message.title, "<a href=" + message.href + ">" + message.content + "</a>");
1669
- };
1670
- YzStompService.prototype.logoutNotification = function (message) {
1671
- var _this = this;
1672
- this.notification.create(message.type, message.title, message.content + ",\u5269\u4F59\u65F6\u95F45\u79D2");
1673
- setTimeout(function () {
1674
- _this.cache.clear();
1675
- localStorage.clear();
1676
- _this.injector.get(util.WINDOW).location.href = _this.bisConfig.baseUrl + "/cas-proxy/app/logout";
1677
- }, 5000);
1678
- };
1679
- YzStompService.prototype.unListen = function () {
1680
- this.subs.forEach(function (s) { return s.unsubscribe(); });
1681
- this.rxStomp.deactivate().then();
1682
- };
1683
- YzStompService.prototype.publish = function (parameters) {
1684
- this.rxStomp.publish(parameters);
1685
- };
1686
- YzStompService.prototype.watch = function (destination, headers) {
1687
- return this.rxStomp.watch(destination, headers);
1688
- };
1689
- return YzStompService;
1690
- }());
1691
- YzStompService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function YzStompService_Factory() { return new YzStompService(i0__namespace.ɵɵinject(i1__namespace$1.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" });
1692
- YzStompService.decorators = [
1693
- { type: i0.Injectable, args: [{ providedIn: 'root' },] }
1694
- ];
1695
- YzStompService.ctorParameters = function () { return [
1696
- { type: util.YunzaiConfigService },
1697
- { type: i2$1.CacheService },
1698
- { type: i0.Injector },
1699
- { type: i3$1.NzNotificationService }
1700
- ]; };
1701
-
1702
- var YzLayoutBasicComponent = /** @class */ (function () {
1703
- function YzLayoutBasicComponent(cacheService, yzStompService) {
1704
- this.cacheService = cacheService;
1705
- this.yzStompService = yzStompService;
1706
- this.options = {
1707
- logoExpanded: "./assets/logo-full.svg",
1708
- logoCollapsed: "./assets/logo.svg"
1709
- };
1710
- this.intro = '';
1711
- this.text = '';
1712
- this.icon = '';
1713
- }
1714
- YzLayoutBasicComponent.prototype.ngOnInit = function () {
1715
- var current = this.cacheService.get('_yz_current', { mode: 'none' });
1716
- var project = this.cacheService.get('_yz_project_info', { mode: 'none' });
1717
- this.text = current.text ? current.text : '应用名称';
1718
- this.intro = current.intro ? current.intro : '应用描述';
1719
- this.icon = current.icon ? current.icon : "./assets/tmp/img/avatar.jpg";
1720
- this.options.logoExpanded = project.maxLogoUrl ? project.maxLogoUrl : "./assets/logo-full.svg";
1721
- this.options.logoCollapsed = project.miniLogoUrl ? project.miniLogoUrl : "./assets/logo.svg";
1722
- this.yzStompService.listen();
1723
- };
1724
- YzLayoutBasicComponent.prototype.ngOnDestroy = function () {
1725
- this.yzStompService.unListen();
1726
- };
1727
- return YzLayoutBasicComponent;
1728
- }());
1729
- YzLayoutBasicComponent.decorators = [
1730
- { type: i0.Component, args: [{
1731
- selector: 'yz-layout-basic',
1732
- 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 ",
1733
- changeDetection: i0.ChangeDetectionStrategy.OnPush
1734
- },] }
1735
- ];
1736
- YzLayoutBasicComponent.ctorParameters = function () { return [
1737
- { type: i2$1.CacheService },
1738
- { type: YzStompService }
1739
- ]; };
1740
-
1741
- var COMPONENTS = [
1742
- ContactComponent,
1743
- YzLayoutBasicComponent,
1744
- YzHeaderApplicationComponent,
1745
- YzHeaderNotifyComponent,
1746
- YzHeaderThemBtnComponent,
1747
- YzHeaderUserComponent,
1748
- YzHeaderFullScreenComponent,
1749
- YzHeaderClearStorageComponent,
1750
- YzHeaderI18NComponent
1751
- ];
1752
- var YunzaiLayoutModule = /** @class */ (function () {
1753
- function YunzaiLayoutModule() {
1754
- }
1755
- return YunzaiLayoutModule;
1756
- }());
1757
- YunzaiLayoutModule.decorators = [
1758
- { type: i0.NgModule, args: [{
1759
- imports: [http.HttpClientModule, common.CommonModule, forms.FormsModule, i4.RouterModule, forms.ReactiveFormsModule, shared.YzSharedModule],
1760
- providers: [
1761
- {
1762
- provide: themeBtn.YUNZAI_THEME_BTN_KEYS,
1763
- useValue: 'site-theme'
1764
- }
1765
- ],
1766
- declarations: __spreadArray([], __read(COMPONENTS)),
1767
- exports: __spreadArray([], __read(COMPONENTS))
1768
- },] }
1769
- ];
1770
-
1771
- var YzAuthService = /** @class */ (function () {
1772
- function YzAuthService(injector) {
1773
- this.injector = injector;
1774
- this.option = auth.mergeConfig(this.csr);
1775
- this.bis = mergeBisConfig(this.csr);
1776
- }
1777
- Object.defineProperty(YzAuthService.prototype, "csr", {
1778
- get: function () {
1779
- return this.injector.get(i1$1.YunzaiConfigService);
1780
- },
1781
- enumerable: false,
1782
- configurable: true
1783
- });
1784
- Object.defineProperty(YzAuthService.prototype, "tokenService", {
1785
- get: function () {
1786
- return this.injector.get(auth.YA_SERVICE_TOKEN);
1787
- },
1788
- enumerable: false,
1789
- configurable: true
1790
- });
1791
- Object.defineProperty(YzAuthService.prototype, "httpClient", {
1792
- get: function () {
1793
- return this.injector.get(i1._HttpClient);
1794
- },
1795
- enumerable: false,
1796
- configurable: true
1797
- });
1798
- Object.defineProperty(YzAuthService.prototype, "cacheService", {
1799
- get: function () {
1800
- return this.injector.get(i2$1.CacheService);
1801
- },
1802
- enumerable: false,
1803
- configurable: true
1804
- });
1805
- YzAuthService.prototype.askToken = function () {
1806
- var _a;
1807
- other.log('yz.auth.service: ', 'askToken');
1808
- if ((_a = this.tokenService.get()) === null || _a === void 0 ? void 0 : _a.token) {
1809
- return rxjs.of(this.tokenService.get());
1810
- }
1811
- else {
1812
- if (this.bis.loginForm) {
1813
- return this.fetchTokenByUP();
1814
- }
1815
- else {
1816
- return this.fetchTokenByCas();
1817
- }
1818
- }
1819
- };
1820
- YzAuthService.prototype.fetchTokenByUP = function () {
1821
- other.log('yz.auth.service: ', 'fetchTokenByUP');
1822
- return this.httpClient.post("/auth/oauth/token?_allow_anonymous=true", this.bis.loginForm).pipe(operators.map(function (response) {
1823
- var access_token = response.access_token, expires_in = response.expires_in, refresh_token = response.refresh_token, scope = response.scope, token_type = response.token_type;
1824
- return {
1825
- token: access_token,
1826
- expired: expires_in,
1827
- refreshToken: refresh_token,
1828
- tokenType: token_type,
1829
- scope: scope
1830
- };
1831
- }));
1832
- };
1833
- YzAuthService.prototype.fetchTokenByCas = function () {
1834
- var _this = this;
1835
- other.log('yz.auth.service: ', 'fetchTokenByCas');
1836
- var uri = encodeURIComponent(this.injector.get(util.WINDOW).location.href);
1837
- return this.httpClient
1838
- .get("/cas-proxy/app/validate_full?callback=" + uri + "&_allow_anonymous=true&timestamp=" + new Date().getTime())
1839
- .pipe(operators.map(function (response) {
1840
- switch (response.errcode) {
1841
- case 2000:
1842
- 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;
1843
- return {
1844
- token: access_token,
1845
- expired: expires_in,
1846
- refreshToken: refresh_token,
1847
- tokenType: token_type,
1848
- scope: scope
1849
- };
1850
- case 2001:
1851
- _this.injector.get(util.WINDOW).location.href = response.msg;
1852
- throw Error("Cookie Error: Can't find Cas Cookie,So jump to login!");
1853
- default:
1854
- if (response.data) {
1855
- console.error(response.data);
1856
- throw Error(response.data);
1857
- }
1858
- else if (response.msg) {
1859
- console.error(response.msg);
1860
- throw Error(response.msg);
1861
- }
1862
- else {
1863
- console.error('cas unknown error');
1864
- throw Error('Unknown Error: Cas auth exception!');
1865
- }
1866
- }
1867
- }));
1868
- };
1869
- YzAuthService.prototype.login = function () {
1870
- var _this = this;
1871
- other.log('yz.auth.service: ', 'login white login form->', this.bis.loginForm);
1872
- return this.askToken().pipe(operators.mergeMap(function (token) {
1873
- other.log('yz.auth.service: get token->', token);
1874
- _this.csr.set('auth', {
1875
- token_send_key: 'Authorization',
1876
- token_send_template: token.tokenType + " ${token}",
1877
- token_send_place: 'header'
1878
- });
1879
- other.log('yz.auth.service: ', 'set token');
1880
- _this.tokenService.set(token);
1881
- return _this.cacheInit();
1882
- }), operators.mergeAll());
1883
- };
1884
- YzAuthService.prototype.cacheInit = function () {
1885
- var _this = this;
1886
- other.log('yz.auth.service: ', 'cacheInit');
1887
- var user = this.cacheService.get('_yz_user', { mode: 'none' });
1888
- var header = this.cacheService.get('_yz_header', { mode: 'none' });
1889
- var project = this.cacheService.get('_yz_project_info', { mode: 'none' });
1890
- return rxjs.forkJoin(rxjs.of(user), rxjs.of(header), rxjs.of(project)).pipe(operators.mergeMap(function (_b) {
1891
- var _c = __read(_b, 3), u = _c[0], h = _c[1], p = _c[2];
1892
- var list = [];
1893
- // user cache
1894
- if (!u) {
1895
- other.log('yz.auth.service: ', 'fetch user cache');
1896
- list.push(_this.httpClient.get("/auth/user").pipe(operators.map(function (user) {
1897
- _this.cacheService.set('_yz_user', user.principal);
1898
- })));
1899
- }
1900
- else {
1901
- other.log('yz.auth.service: ', 'user recache');
1902
- list.push(rxjs.of(function () { }));
1903
- }
1904
- // header cache
1905
- if (!h) {
1906
- other.log('yz.auth.service: ', 'fetch header cache');
1907
- list.push(_this.httpClient.get("/auth/allheader/v2").pipe(operators.map(function (header) {
1908
- _this.cacheService.set('_yz_header', header.data);
1909
- })));
1910
- }
1911
- else {
1912
- other.log('yz.auth.service: ', 'header recache');
1913
- list.push(rxjs.of(function () { }));
1914
- }
1915
- // project cache
1916
- if (!p) {
1917
- other.log('yz.auth.service: ', 'fetch project cache');
1918
- list.push(_this.httpClient.get("/app-manager/project/info").pipe(operators.map(function (info) {
1919
- _this.cacheService.set('_yz_project_info', info.data);
1920
- })));
1921
- }
1922
- else {
1923
- other.log('yz.auth.service: ', 'project recache');
1924
- list.push(rxjs.of(function () { }));
1925
- }
1926
- return rxjs.forkJoin(list);
1927
- }));
1928
- };
1929
- return YzAuthService;
1930
- }());
1931
- YzAuthService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function YzAuthService_Factory() { return new YzAuthService(i0__namespace.ɵɵinject(i0__namespace.INJECTOR)); }, token: YzAuthService, providedIn: "root" });
1932
- YzAuthService.decorators = [
1933
- { type: i0.Injectable, args: [{ providedIn: 'root' },] }
1934
- ];
1935
- YzAuthService.ctorParameters = function () { return [
1936
- { type: i0.Injector }
1937
- ]; };
1938
-
1939
- var CODEMESSAGE = {
1940
- 200: '服务器成功返回请求的数据。',
1941
- 201: '新建或修改数据成功。',
1942
- 202: '一个请求已经进入后台排队(异步任务)。',
1943
- 204: '删除数据成功。',
1944
- 400: '发出的请求有错误,服务器没有进行新建或修改数据的操作。',
1945
- 401: '用户没有权限(令牌、用户名、密码错误)。',
1946
- 403: '用户得到授权,但是访问是被禁止的。',
1947
- 404: '发出的请求针对的是不存在的记录,服务器没有进行操作。',
1948
- 406: '请求的格式不可得。',
1949
- 410: '请求的资源被永久删除,且不会再得到的。',
1950
- 422: '当创建一个对象时,发生一个验证错误。',
1951
- 500: '服务器发生错误,请检查服务器。',
1952
- 502: '网关错误。',
1953
- 503: '服务不可用,服务器暂时过载或维护。',
1954
- 504: '网关超时。'
1955
- };
1956
- /**
1957
- * 默认HTTP拦截器,其注册细节见 `app.module.ts`
1958
- */
1959
- var YzDefaultInterceptor = /** @class */ (function () {
1960
- function YzDefaultInterceptor(injector) {
1961
- this.injector = injector;
1962
- this.jump = false;
1963
- this.refreshToking = false;
1964
- this.refreshToken$ = new rxjs.BehaviorSubject(null);
1965
- if (this.config.refreshTokenType === 'auth-refresh') {
1966
- console.error("can't use auth-refresh, please change yz.default.interceptor to default.interceptor!");
1967
- }
1968
- }
1969
- Object.defineProperty(YzDefaultInterceptor.prototype, "notification", {
1970
- get: function () {
1971
- return this.injector.get(i3$1.NzNotificationService);
1972
- },
1973
- enumerable: false,
1974
- configurable: true
1975
- });
1976
- Object.defineProperty(YzDefaultInterceptor.prototype, "tokenSrv", {
1977
- get: function () {
1978
- return this.injector.get(auth.YA_SERVICE_TOKEN);
1979
- },
1980
- enumerable: false,
1981
- configurable: true
1982
- });
1983
- Object.defineProperty(YzDefaultInterceptor.prototype, "http", {
1984
- get: function () {
1985
- return this.injector.get(i1._HttpClient);
1986
- },
1987
- enumerable: false,
1988
- configurable: true
1989
- });
1990
- Object.defineProperty(YzDefaultInterceptor.prototype, "config", {
1991
- get: function () {
1992
- return mergeBisConfig(this.injector.get(i1$1.YunzaiConfigService));
1993
- },
1994
- enumerable: false,
1995
- configurable: true
1996
- });
1997
- YzDefaultInterceptor.prototype.goTo = function (url) {
1998
- var _this = this;
1999
- setTimeout(function () { return _this.injector.get(i4.Router).navigateByUrl(url); });
2000
- };
2001
- YzDefaultInterceptor.prototype.checkStatus = function (ev) {
2002
- if ((ev.status >= 200 && ev.status < 300) || ev.status === 401) {
2003
- return;
2004
- }
2005
- if (ev instanceof http.HttpErrorResponse && (ev.error.message || ev.error.errorMessage)) {
2006
- if (ev.error.errorMessage) {
2007
- this.notification.error("\u53D1\u751F\u4E86\u4E00\u4E9B\u9519\u8BEF ", ev.error.errorMessage);
2008
- }
2009
- else {
2010
- this.notification.error("\u53D1\u751F\u4E86\u4E00\u4E9B\u9519\u8BEF ", ev.error.message);
2011
- }
2012
- return;
2013
- }
2014
- if (ev instanceof http.HttpResponse && ev.body.errorMessage) {
2015
- this.notification.error("\u53D1\u751F\u4E86\u4E00\u4E9B\u9519\u8BEF ", ev.body.errorMessage);
2016
- return;
2017
- }
2018
- var errortext = CODEMESSAGE[ev.status] || ev.statusText;
2019
- this.notification.error("\u8BF7\u6C42\u9519\u8BEF " + ev.status + ": " + ev.url, errortext);
2020
- };
2021
- YzDefaultInterceptor.prototype.ToLogin = function () {
2022
- var _this = this;
2023
- 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", "");
2024
- setTimeout(function () {
2025
- localStorage.clear();
2026
- _this.injector.get(util.WINDOW).location.href = _this.config.baseUrl + "/cas-proxy/app/logout";
2027
- }, 5000);
2028
- };
2029
- YzDefaultInterceptor.prototype.reAttachToken = function (req) {
2030
- var _a;
2031
- var token = (_a = this.tokenSrv.get()) === null || _a === void 0 ? void 0 : _a.token;
2032
- return req.clone({
2033
- setHeaders: {
2034
- Authorization: "Bearer " + token
2035
- }
2036
- });
2037
- };
2038
- YzDefaultInterceptor.prototype.refreshTokenRequest = function () {
2039
- var model = this.tokenSrv.get();
2040
- var form = new FormData();
2041
- form.set('refresh_token', model === null || model === void 0 ? void 0 : model.refreshToken);
2042
- other.log('yz.default.interceptor: use the refresh token to request a new token', model === null || model === void 0 ? void 0 : model.refreshToken);
2043
- return this.http.post("/auth/user/token/refresh?_allow_anonymous=true", form);
2044
- };
2045
- YzDefaultInterceptor.prototype.tryRefreshToken = function (ev, req, next) {
2046
- var _this = this;
2047
- // 连刷新Token的请求都错了,那就是真错了
2048
- if (['/auth/oauth/token'].some(function (url) { return req.url.includes(url); })) {
2049
- this.ToLogin();
2050
- return rxjs.throwError(ev);
2051
- }
2052
- // 正在刷新token,所有其他请求排队
2053
- if (this.refreshToking) {
2054
- return this.refreshToken$.pipe(operators.filter(function (v) { return !!v; }), operators.take(1), operators.switchMap(function () { return next.handle(_this.reAttachToken(req)); }));
2055
- }
2056
- //尝试调用刷新 Token
2057
- this.refreshToking = true;
2058
- this.refreshToken$.next(null);
2059
- // 处理Token
2060
- return this.refreshTokenRequest().pipe(operators.switchMap(function (res) {
2061
- other.log('yz.default.interceptor: refresh token accessed -> ', res);
2062
- // 重新保存新 token
2063
- var access_token = res.access_token, expires_in = res.expires_in, refresh_token = res.refresh_token, scope = res.scope, token_type = res.token_type;
2064
- _this.tokenSrv.set({
2065
- token: access_token,
2066
- expired: expires_in,
2067
- refreshToken: refresh_token,
2068
- tokenType: token_type,
2069
- scope: scope
2070
- });
2071
- // 通知后续请求继续执行
2072
- _this.refreshToking = false;
2073
- _this.refreshToken$.next(res);
2074
- // 重新发起请求
2075
- return next.handle(_this.reAttachToken(req));
2076
- }), operators.catchError(function (err) {
2077
- _this.refreshToking = false;
2078
- _this.ToLogin();
2079
- return rxjs.throwError(err);
2080
- }));
2081
- };
2082
- YzDefaultInterceptor.prototype.getAdditionalHeaders = function (headers) {
2083
- var res = {};
2084
- var lang = this.injector.get(i1.YUNZAI_I18N_TOKEN).currentLang;
2085
- if (!(headers === null || headers === void 0 ? void 0 : headers.has('Accept-Language')) && lang) {
2086
- res['Accept-Language'] = lang;
2087
- }
2088
- return res;
2089
- };
2090
- YzDefaultInterceptor.prototype.handleData = function (ev, req, next) {
2091
- this.checkStatus(ev);
2092
- switch (ev.status) {
2093
- case 200:
2094
- return rxjs.of(ev);
2095
- case 401:
2096
- if (this.config.refreshTokenEnabled && this.config.refreshTokenType === 're-request') {
2097
- return this.tryRefreshToken(ev, req, next);
2098
- }
2099
- this.ToLogin();
2100
- break;
2101
- case 403:
2102
- case 404:
2103
- case 500:
2104
- if (this.jump) {
2105
- this.goTo("/exception/" + ev.status);
2106
- }
2107
- break;
2108
- default:
2109
- if (ev instanceof http.HttpErrorResponse) {
2110
- console.warn('未可知错误,大部分是由于后端不支持跨域CORS或无效配置引起,请参考 https://ng.yunzainfo.com/docs/server 解决跨域问题', ev);
2111
- }
2112
- break;
2113
- }
2114
- if (ev instanceof http.HttpErrorResponse) {
2115
- return rxjs.throwError(ev);
2116
- }
2117
- else {
2118
- return rxjs.of(ev);
2119
- }
2120
- };
2121
- YzDefaultInterceptor.prototype.intercept = function (req, next) {
2122
- var _this = this;
2123
- other.log('yz.default.interceptor.ts: ', 'request ', req);
2124
- // 统一加前缀
2125
- var url = req.url;
2126
- if (!url.startsWith('https://') && !url.startsWith('http://')) {
2127
- url = this.config.baseUrl + url;
2128
- }
2129
- if (url.includes('.json') && url.includes('assets')) {
2130
- url = req.url;
2131
- }
2132
- // 加入语言头
2133
- var newReq = req.clone({ url: url, setHeaders: this.getAdditionalHeaders(req.headers) });
2134
- return next.handle(newReq).pipe(operators.mergeMap(function (ev) {
2135
- // 允许统一对请求错误处理
2136
- if (ev instanceof http.HttpResponseBase) {
2137
- return _this.handleData(ev, newReq, next);
2138
- }
2139
- // 若一切都正常,则后续操作
2140
- return rxjs.of(ev);
2141
- }), operators.catchError(function (err) { return _this.handleData(err, newReq, next); }));
2142
- };
2143
- return YzDefaultInterceptor;
2144
- }());
2145
- YzDefaultInterceptor.decorators = [
2146
- { type: i0.Injectable }
2147
- ];
2148
- YzDefaultInterceptor.ctorParameters = function () { return [
2149
- { type: i0.Injector }
2150
- ]; };
2151
-
2152
- function mapYzSideToYelonMenu(menus) {
2153
- menus.forEach(function (menu) {
2154
- menu.badgeDot = menu.badge_dot || null;
2155
- menu.badgeStatus = menu.badge_status || null;
2156
- menu.shortcutRoot = menu.shortcut_root || null;
2157
- menu.reuse = true;
2158
- if (menu.children) {
2159
- mapYzSideToYelonMenu(menu.children);
2160
- }
2161
- });
2162
- }
2163
- function generateAbility(menus, abilities, prefix) {
2164
- menus.forEach(function (menu) {
2165
- if (menu.link) {
2166
- prefix += menu.link;
2167
- }
2168
- else {
2169
- prefix += '';
2170
- }
2171
- if (menu.menuAuths) {
2172
- menu.menuAuths.forEach(function (a) {
2173
- abilities.push(prefix + ":" + a);
2174
- abilities.push(a);
2175
- });
2176
- }
2177
- if (menu.children) {
2178
- generateAbility(menu.children, abilities, prefix);
2179
- }
2180
- });
2181
- }
2182
- var YzStartupService = /** @class */ (function () {
2183
- function YzStartupService(iconSrv, menuService, i18n, settingService, aclService, titleService, yzAuthService, cacheService, configService) {
2184
- this.menuService = menuService;
2185
- this.i18n = i18n;
2186
- this.settingService = settingService;
2187
- this.aclService = aclService;
2188
- this.titleService = titleService;
2189
- this.yzAuthService = yzAuthService;
2190
- this.cacheService = cacheService;
2191
- this.configService = configService;
2192
- this.bis = BUSINESS_DEFAULT_CONFIG;
2193
- this.bis = mergeBisConfig(this.configService);
2194
- iconSrv.addIcon.apply(iconSrv, __spreadArray([], __read(shared.ICONS)));
2195
- }
2196
- YzStartupService.prototype.load = function () {
2197
- var _this = this;
2198
- util.log('startup.service: ', 'load');
2199
- var defaultLang = this.i18n.defaultLang;
2200
- return this.i18n.loadLangData(defaultLang).pipe(operators.mergeMap(function (langData) {
2201
- util.log('startup.service: ', 'set i18n, defaultLang->', defaultLang, ' langData->', langData);
2202
- _this.i18n.use(defaultLang, langData);
2203
- return rxjs.of(null);
2204
- }), operators.mergeMap(function () {
2205
- return _this.yzAuthService.login();
2206
- }), operators.mergeMap(function (v) {
2207
- // preloader finish
2208
- _this.systemInit();
2209
- util.log('startup.service: preloader finish');
2210
- var win = window;
2211
- if (win && win.appBootstrap) {
2212
- win.appBootstrap();
2213
- }
2214
- return rxjs.of(v);
2215
- }));
2216
- };
2217
- YzStartupService.prototype.systemInit = function () {
2218
- var _this = this;
2219
- util.log('startup.service: system init');
2220
- // user
2221
- var user = this.cacheService.get('_yz_user', { mode: 'none' });
2222
- // menu
2223
- var ms = util.deepCopy(user.menu).filter(function (m) { return m.systemCode && m.systemCode === _this.bis.systemCode; });
2224
- mapYzSideToYelonMenu(ms);
2225
- var currentMenu = ms.pop() || [];
2226
- this.menuService.add([currentMenu]);
2227
- // logo app
2228
- this.settingService.setApp({ name: currentMenu.text, description: currentMenu.intro });
2229
- this.settingService.setUser({
2230
- name: user.realname || 'no name',
2231
- avatar: this.bis.baseUrl + "/filecenter/file/" + user.avatarId || '',
2232
- email: user.email || 'no email'
2233
- });
2234
- // title
2235
- this.titleService.default = currentMenu && currentMenu.text ? currentMenu.text : 'default application name';
2236
- this.titleService.setTitle(currentMenu && currentMenu.text ? currentMenu.text : 'no title');
2237
- // acl
2238
- var abilities = [];
2239
- generateAbility([currentMenu], abilities, '');
2240
- this.aclService.attachRole((user === null || user === void 0 ? void 0 : user.roles.map(function (role) {
2241
- return role.roleValue;
2242
- }).filter(function (a) { return !!a; })) || []);
2243
- this.aclService.attachAbility(abilities);
2244
- // cache current
2245
- this.cacheService.set('_yz_current', {
2246
- text: currentMenu.text,
2247
- intro: currentMenu.intro,
2248
- icon: currentMenu.appIconUrl
2249
- });
2250
- };
2251
- return YzStartupService;
2252
- }());
2253
- YzStartupService.decorators = [
2254
- { type: i0.Injectable }
2255
- ];
2256
- YzStartupService.ctorParameters = function () { return [
2257
- { type: icon.NzIconService },
2258
- { type: i1.MenuService },
2259
- { type: YzI18NService, decorators: [{ type: i0.Inject, args: [i1.YUNZAI_I18N_TOKEN,] }] },
2260
- { type: i1.SettingsService },
2261
- { type: acl.ACLService },
2262
- { type: i1.TitleService },
2263
- { type: YzAuthService },
2264
- { type: i2$1.CacheService },
2265
- { type: util.YunzaiConfigService }
2266
- ]; };
2267
- function YzStartupServiceFactory(startupService) {
2268
- return function () { return startupService.load(); };
2269
- }
2270
- //@ts-ignore
2271
- var YZ_APPINIT_PROVIDES = [
2272
- YzStartupService,
2273
- {
2274
- provide: i0.APP_INITIALIZER,
2275
- useFactory: YzStartupServiceFactory,
2276
- deps: [YzStartupService],
2277
- multi: true
2278
- }
2279
- ];
2280
-
2281
- var PathToRegexpService = /** @class */ (function () {
2282
- function PathToRegexpService() {
2283
- this.DEFAULT_DELIMITER = '/';
2284
- this.PATH_REGEXP = new RegExp(['(\\\\.)', '(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?'].join('|'), 'g');
2285
- }
2286
- PathToRegexpService.prototype.parse = function (str, options) {
2287
- var tokens = [];
2288
- var key = 0;
2289
- var index = 0;
2290
- var path = '';
2291
- var defaultDelimiter = (options && options.delimiter) || this.DEFAULT_DELIMITER;
2292
- var whitelist = (options && options.whitelist) || undefined;
2293
- var pathEscaped = false;
2294
- var res;
2295
- while ((res = this.PATH_REGEXP.exec(str)) !== null) {
2296
- var m = res[0];
2297
- var escaped = res[1];
2298
- var offset = res.index;
2299
- path += str.slice(index, offset);
2300
- index = offset + m.length;
2301
- // Ignore already escaped sequences.
2302
- if (escaped) {
2303
- path += escaped[1];
2304
- pathEscaped = true;
2305
- continue;
2306
- }
2307
- var prev = '';
2308
- var name = res[2];
2309
- var capture = res[3];
2310
- var group = res[4];
2311
- var modifier = res[5];
2312
- if (!pathEscaped && path.length) {
2313
- var k = path.length - 1;
2314
- var c = path[k];
2315
- var matches = whitelist ? whitelist.indexOf(c) > -1 : true;
2316
- if (matches) {
2317
- prev = c;
2318
- path = path.slice(0, k);
2319
- }
2320
- }
2321
- // Push the current path onto the tokens.
2322
- if (path) {
2323
- tokens.push(path);
2324
- path = '';
2325
- pathEscaped = false;
2326
- }
2327
- var repeat = modifier === '+' || modifier === '*';
2328
- var optional = modifier === '?' || modifier === '*';
2329
- var pattern = capture || group;
2330
- var delimiter = prev || defaultDelimiter;
2331
- tokens.push({
2332
- name: name || key++,
2333
- prefix: prev,
2334
- delimiter: delimiter,
2335
- optional: optional,
2336
- repeat: repeat,
2337
- pattern: pattern
2338
- ? this.escapeGroup(pattern)
2339
- : "[^" + this.escapeString(delimiter === defaultDelimiter ? delimiter : delimiter + defaultDelimiter) + "]+?"
2340
- });
2341
- }
2342
- // Push any remaining characters.
2343
- if (path || index < str.length) {
2344
- tokens.push(path + str.substr(index));
2345
- }
2346
- return tokens;
2347
- };
2348
- PathToRegexpService.prototype.compile = function (str, options) {
2349
- return this.tokensToFunction(this.parse(str, options), options);
2350
- };
2351
- PathToRegexpService.prototype.tokensToFunction = function (tokens, options) {
2352
- var matches = new Array(tokens.length);
2353
- for (var i = 0; i < tokens.length; i++) {
2354
- if (typeof tokens[i] === 'object') {
2355
- matches[i] = new RegExp("^(?:" + tokens[i].pattern + ")$", this.flags(options));
2356
- }
2357
- }
2358
- return function (data, options) {
2359
- var path = '';
2360
- var encode = (options && options.encode) || encodeURIComponent;
2361
- var validate = options ? options.validate !== false : true;
2362
- for (var i = 0; i < tokens.length; i++) {
2363
- var token = tokens[i];
2364
- if (typeof token === 'string') {
2365
- path += token;
2366
- continue;
2367
- }
2368
- var value = data ? data[token.name] : undefined;
2369
- var segment = void 0;
2370
- if (Array.isArray(value)) {
2371
- if (!token.repeat) {
2372
- throw new TypeError("Expected \"" + token.name + "\" to not repeat, but got array");
2373
- }
2374
- if (value.length === 0) {
2375
- if (token.optional) {
2376
- continue;
2377
- }
2378
- throw new TypeError("Expected \"" + token.name + "\" to not be empty");
2379
- }
2380
- for (var j = 0; j < value.length; j++) {
2381
- segment = encode(value[j], token);
2382
- if (validate && !matches[i].test(segment)) {
2383
- throw new TypeError("Expected all \"" + token.name + "\" to match \"" + token.pattern + "\"");
2384
- }
2385
- path += (j === 0 ? token.prefix : token.delimiter) + segment;
2386
- }
2387
- continue;
2388
- }
2389
- if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
2390
- segment = encode(String(value), token);
2391
- if (validate && !matches[i].test(segment)) {
2392
- throw new TypeError("Expected \"" + token.name + "\" to match \"" + token.pattern + "\", but got \"" + segment + "\"");
2393
- }
2394
- path += token.prefix + segment;
2395
- continue;
2396
- }
2397
- if (token.optional) {
2398
- continue;
2399
- }
2400
- throw new TypeError("Expected \"" + token.name + "\" to be " + (token.repeat ? 'an array' : 'a string'));
2401
- }
2402
- return path;
2403
- };
2404
- };
2405
- PathToRegexpService.prototype.escapeString = function (str) {
2406
- return str.replace(/([.+*?=^!:${}()[\]|/\\])/g, '\\$1');
2407
- };
2408
- PathToRegexpService.prototype.escapeGroup = function (group) {
2409
- return group.replace(/([=!:$/()])/g, '\\$1');
2410
- };
2411
- PathToRegexpService.prototype.flags = function (options) {
2412
- return options && options.sensitive ? '' : 'i';
2413
- };
2414
- PathToRegexpService.prototype.regexpToRegexp = function (path, keys) {
2415
- if (!keys) {
2416
- return path;
2417
- }
2418
- var groups = path.source.match(/\((?!\?)/g);
2419
- if (groups) {
2420
- for (var i = 0; i < groups.length; i++) {
2421
- keys.push({
2422
- name: i,
2423
- prefix: null,
2424
- delimiter: null,
2425
- optional: false,
2426
- repeat: false,
2427
- pattern: null
2428
- });
2429
- }
2430
- }
2431
- return path;
2432
- };
2433
- PathToRegexpService.prototype.arrayToRegexp = function (path, keys, options) {
2434
- var parts = [];
2435
- for (var i = 0; i < path.length; i++) {
2436
- parts.push(this.pathToRegexp(path[i], keys, options).source);
2437
- }
2438
- return new RegExp("(?:" + parts.join('|') + ")", this.flags(options));
2439
- };
2440
- PathToRegexpService.prototype.stringToRegexp = function (path, keys, options) {
2441
- return this.tokensToRegExp(this.parse(path, options), keys, options);
2442
- };
2443
- PathToRegexpService.prototype.tokensToRegExp = function (tokens, keys, options) {
2444
- options = options || {};
2445
- var strict = options.strict;
2446
- var start = options.start !== false;
2447
- var end = options.end !== false;
2448
- var delimiter = options.delimiter || this.DEFAULT_DELIMITER;
2449
- var endsWith = []
2450
- .concat(options.endsWith || [])
2451
- .map(this.escapeString)
2452
- .concat('$')
2453
- .join('|');
2454
- var route = start ? '^' : '';
2455
- for (var i = 0; i < tokens.length; i++) {
2456
- var token = tokens[i];
2457
- if (typeof token === 'string') {
2458
- route += this.escapeString(token);
2459
- }
2460
- else {
2461
- var capture = token.repeat
2462
- ? "(?:" + token.pattern + ")(?:" + this.escapeString(token.delimiter) + "(?:" + token.pattern + "))*"
2463
- : token.pattern;
2464
- if (keys) {
2465
- keys.push(token);
2466
- }
2467
- if (token.optional) {
2468
- if (!token.prefix) {
2469
- route += "(" + capture + ")?";
2470
- }
2471
- else {
2472
- route += "(?:" + this.escapeString(token.prefix) + "(" + capture + "))?";
2473
- }
2474
- }
2475
- else {
2476
- route += this.escapeString(token.prefix) + "(" + capture + ")";
2477
- }
2478
- }
2479
- }
2480
- if (end) {
2481
- if (!strict) {
2482
- route += "(?:" + this.escapeString(delimiter) + ")?";
2483
- }
2484
- route += endsWith === '$' ? '$' : "(?=" + endsWith + ")";
2485
- }
2486
- else {
2487
- var endToken = tokens[tokens.length - 1];
2488
- var isEndDelimited = typeof endToken === 'string' ? endToken[endToken.length - 1] === delimiter : endToken === undefined;
2489
- if (!strict) {
2490
- route += "(?:" + this.escapeString(delimiter) + "(?=" + endsWith + "))?";
2491
- }
2492
- if (!isEndDelimited) {
2493
- route += "(?=" + this.escapeString(delimiter) + "|" + endsWith + ")";
2494
- }
2495
- }
2496
- return new RegExp(route, this.flags(options));
2497
- };
2498
- PathToRegexpService.prototype.pathToRegexp = function (path, keys, options) {
2499
- if (path instanceof RegExp) {
2500
- return this.regexpToRegexp(path, keys);
2501
- }
2502
- if (Array.isArray(path)) {
2503
- return this.arrayToRegexp(/** @type {!Array} */ path, keys, options);
2504
- }
2505
- return this.stringToRegexp(/** @type {string} */ path, keys, options);
2506
- };
2507
- return PathToRegexpService;
2508
- }());
2509
- PathToRegexpService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function PathToRegexpService_Factory() { return new PathToRegexpService(); }, token: PathToRegexpService, providedIn: "root" });
2510
- PathToRegexpService.decorators = [
2511
- { type: i0.Injectable, args: [{
2512
- providedIn: 'root'
2513
- },] }
2514
- ];
2515
- PathToRegexpService.ctorParameters = function () { return []; };
2516
-
2517
- var ActGuard = /** @class */ (function () {
2518
- function ActGuard(configService, cacheService, pathToRegexp, router) {
2519
- var _this = this;
2520
- this.configService = configService;
2521
- this.cacheService = cacheService;
2522
- this.pathToRegexp = pathToRegexp;
2523
- this.router = router;
2524
- this.bis = BUSINESS_DEFAULT_CONFIG;
2525
- this.menus = [];
2526
- this.links = [];
2527
- util.log('act: ');
2528
- this.bis = mergeBisConfig(this.configService);
2529
- util.log('act: config ', this.bis);
2530
- var user = this.cacheService.get('_yz_user', { mode: 'none' });
2531
- util.log('act: user ', user);
2532
- this.menus = util.deepCopy(user.menu).filter(function (m) { return m.systemCode && m.systemCode === _this.bis.systemCode; });
2533
- util.log('act: menus ', this.menus);
2534
- this.getAllLinks(this.menus, this.links);
2535
- util.log('act: links ', this.links);
2536
- }
2537
- ActGuard.prototype.canActivate = function (_, state) {
2538
- var _this = this;
2539
- util.log('act: can activate ', state);
2540
- if (this.preHandle(state)) {
2541
- return true;
2542
- }
2543
- util.log('act: can activate child prehandle success');
2544
- var canactivate = false;
2545
- this.links.forEach(function (link) {
2546
- var regexp = _this.pathToRegexp.stringToRegexp(link, null, null);
2547
- util.log("act: " + link + " test " + state.url.split('?')[0]);
2548
- if (regexp.test(state.url.split('?')[0])) {
2549
- canactivate = true;
2550
- util.log("act: test value " + canactivate);
2551
- return;
2552
- }
2553
- });
2554
- if (canactivate) {
2555
- util.log("act: test sucess");
2556
- return true;
2557
- }
2558
- else {
2559
- util.log("act: test error");
2560
- this.router.navigate(['displayIndex']);
2561
- return false;
2562
- }
2563
- };
2564
- ActGuard.prototype.canActivateChild = function (_, state) {
2565
- var _this = this;
2566
- util.log('act: can activate child ', state);
2567
- if (this.preHandle(state)) {
2568
- return true;
2569
- }
2570
- util.log('act: can activate child prehandle success');
2571
- var canactivate = false;
2572
- this.links.forEach(function (link) {
2573
- var regexp = _this.pathToRegexp.stringToRegexp(link, null, null);
2574
- if (regexp.test(state.url.split('?')[0])) {
2575
- util.log("act: " + link + " test " + state.url.split('?')[0]);
2576
- canactivate = true;
2577
- util.log("act: test value " + canactivate);
2578
- return;
2579
- }
2580
- });
2581
- if (canactivate) {
2582
- util.log("act: test sucess");
2583
- return true;
2584
- }
2585
- else {
2586
- util.log("act: test error");
2587
- this.router.navigate(['displayIndex']);
2588
- return false;
2589
- }
2590
- };
2591
- ActGuard.prototype.preHandle = function (state) {
2592
- return (state.url.includes('error') ||
2593
- state.url.includes('exception') ||
2594
- state.url.includes('displayIndex') ||
2595
- state.url === '' ||
2596
- state.url === null ||
2597
- state.url === '/' ||
2598
- state.url.includes('iframePage'));
2599
- };
2600
- ActGuard.prototype.getAllLinks = function (menu, links) {
2601
- var _this = this;
2602
- menu.forEach(function (sider) {
2603
- if (sider.link) {
2604
- links.push(sider.link);
2605
- }
2606
- if (sider.children && sider.children.length > 0) {
2607
- _this.getAllLinks(sider.children, links);
2608
- }
2609
- });
2610
- };
2611
- return ActGuard;
2612
- }());
2613
- ActGuard.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function ActGuard_Factory() { return new ActGuard(i0__namespace.ɵɵinject(i1__namespace$1.YunzaiConfigService), i0__namespace.ɵɵinject(i2__namespace$1.CacheService), i0__namespace.ɵɵinject(PathToRegexpService), i0__namespace.ɵɵinject(i4__namespace.Router)); }, token: ActGuard, providedIn: "root" });
2614
- ActGuard.decorators = [
2615
- { type: i0.Injectable, args: [{
2616
- providedIn: 'root'
2617
- },] }
2618
- ];
2619
- ActGuard.ctorParameters = function () { return [
2620
- { type: util.YunzaiConfigService },
2621
- { type: i2$1.CacheService },
2622
- { type: PathToRegexpService },
2623
- { type: i4.Router }
2624
- ]; };
2625
-
2626
- // export * from './contact/contact.component';
2627
- // export * from './contact/contact.service';
2628
-
2629
- /**
2630
- * Generated bundle index. Do not edit.
2631
- */
2632
-
2633
- exports.ActGuard = ActGuard;
2634
- exports.BUSINESS_DEFAULT_CONFIG = BUSINESS_DEFAULT_CONFIG;
2635
- exports.PathToRegexpService = PathToRegexpService;
2636
- exports.STOMP_DEFAULT_CONFIG = STOMP_DEFAULT_CONFIG;
2637
- exports.YZ_APPINIT_PROVIDES = YZ_APPINIT_PROVIDES;
2638
- exports.YunzaiLayoutModule = YunzaiLayoutModule;
2639
- exports.YzAuthService = YzAuthService;
2640
- exports.YzDefaultInterceptor = YzDefaultInterceptor;
2641
- exports.YzHeaderApplicationComponent = YzHeaderApplicationComponent;
2642
- exports.YzHeaderClearStorageComponent = YzHeaderClearStorageComponent;
2643
- exports.YzHeaderFullScreenComponent = YzHeaderFullScreenComponent;
2644
- exports.YzHeaderI18NComponent = YzHeaderI18NComponent;
2645
- exports.YzHeaderNotifyComponent = YzHeaderNotifyComponent;
2646
- exports.YzHeaderThemBtnComponent = YzHeaderThemBtnComponent;
2647
- exports.YzHeaderUserComponent = YzHeaderUserComponent;
2648
- exports.YzI18NService = YzI18NService;
2649
- exports.YzLayoutBasicComponent = YzLayoutBasicComponent;
2650
- exports.YzStartupService = YzStartupService;
2651
- exports.YzStartupServiceFactory = YzStartupServiceFactory;
2652
- exports.YzStompService = YzStompService;
2653
- exports.generateAbility = generateAbility;
2654
- exports.mapYzSideToYelonMenu = mapYzSideToYelonMenu;
2655
- exports.mergeBisConfig = mergeBisConfig;
2656
- exports.mergeStompConfig = mergeStompConfig;
2657
- exports["ɵ0"] = ɵ0;
2658
- exports["ɵa"] = ContactComponent;
2659
- exports["ɵb"] = ContactService;
2660
- exports["ɵc"] = YzHeaderApplicationComponent;
2661
- exports["ɵd"] = YzHeaderNotifyComponent;
2662
- exports["ɵe"] = YzHeaderThemBtnComponent;
2663
- exports["ɵf"] = YzHeaderUserComponent;
2664
- exports["ɵg"] = YzHeaderFullScreenComponent;
2665
- exports["ɵh"] = YzHeaderClearStorageComponent;
2666
- exports["ɵi"] = YzHeaderI18NComponent;
2667
-
2668
- Object.defineProperty(exports, '__esModule', { value: true });
2669
-
2670
- }));
2671
- //# sourceMappingURL=layout.umd.js.map