@yelon/bis 12.0.16 → 13.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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/esm2020/shared/shared-yelon.module.mjs +108 -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.mjs +2787 -0
  36. package/fesm2015/layout.mjs.map +1 -0
  37. package/fesm2015/{shared.js → shared.mjs} +113 -12
  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 +169 -0
  47. package/layout/contact/contact.service.d.ts +118 -0
  48. package/layout/layout.d.ts +1 -1
  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 +8 -3
  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 +4 -1
  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 -2080
  75. package/bundles/layout.umd.js.map +0 -1
  76. package/bundles/shared.umd.js +0 -1253
  77. package/bundles/shared.umd.js.map +0 -1
  78. package/esm2015/layout/act.guard.js +0 -115
  79. package/esm2015/layout/layout.js +0 -6
  80. package/esm2015/layout/layout.module.js +0 -37
  81. package/esm2015/layout/stomp.config.js +0 -20
  82. package/esm2015/layout/widgets/yz.application.component.js +0 -200
  83. package/esm2015/layout/widgets/yz.clear-storage.component.js +0 -39
  84. package/esm2015/layout/widgets/yz.fullscreen.component.js +0 -36
  85. package/esm2015/layout/widgets/yz.i18n.component.js +0 -78
  86. package/esm2015/layout/widgets/yz.notify.component.js +0 -154
  87. package/esm2015/layout/widgets/yz.them-btn.component.js +0 -146
  88. package/esm2015/layout/widgets/yz.user.component.js +0 -81
  89. package/esm2015/layout/yz.auth.service.js +0 -158
  90. package/esm2015/layout/yz.basic.component.js +0 -101
  91. package/esm2015/layout/yz.default.interceptor.js +0 -204
  92. package/esm2015/layout/yz.i18n.service.js +0 -102
  93. package/esm2015/layout/yz.startup.service.js +0 -138
  94. package/esm2015/layout/yz.stomp.service.js +0 -91
  95. package/esm2015/shared/shared-yelon.module.js +0 -108
  96. package/esm2015/shared/shared.module.js +0 -16
  97. package/fesm2015/bis.js.map +0 -1
  98. package/fesm2015/layout.js +0 -1869
  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,2080 +0,0 @@
1
- /**
2
- * @license ng-yunzai(devcui@outlook.com) v12.0.16
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('ng-zorro-antd/message'), require('@yelon/util/other'), require('@angular/cdk/bidi'), require('@yelon/theme/theme-btn'), require('@yelon/auth'), require('ng-zorro-antd/modal'), require('screenfull'), require('@angular/common/http'), require('@angular/forms'), require('@angular/router'), require('@yelon/bis/shared'), require('@stomp/rx-stomp'), require('ng-zorro-antd/notification'), require('ng-zorro-antd/icon'), require('@yelon/acl')) :
8
- 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', 'ng-zorro-antd/message', '@yelon/util/other', '@angular/cdk/bidi', '@yelon/theme/theme-btn', '@yelon/auth', 'ng-zorro-antd/modal', 'screenfull', '@angular/common/http', '@angular/forms', '@angular/router', '@yelon/bis/shared', '@stomp/rx-stomp', 'ng-zorro-antd/notification', 'ng-zorro-antd/icon', '@yelon/acl'], factory) :
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.message, global.yelon.util.other, 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["ng-zorro-antd/icon"], global.yelon.acl));
10
- })(this, (function (exports, i0, i2$1, i1, util, i3, common, ngEn, ngZh, ngZhTw, locale, i1$1, i2, decorator, rxjs, operators, dateFns, message, other, bidi, themeBtn, auth, modal, screenfull, http, forms, i4, shared, rxStomp, i3$1, icon, acl) { '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, nzI18n, cdr, httpClient) {
639
- this.injector = injector;
640
- this.msg = msg;
641
- this.nzI18n = nzI18n;
642
- this.cdr = cdr;
643
- this.httpClient = httpClient;
644
- this.data = [
645
- {
646
- key: 'msg',
647
- title: '消息',
648
- list: [],
649
- emptyText: '您已读完所有消息',
650
- emptyImage: './assets/tmp/img/message.svg',
651
- clearText: '清空消息'
652
- },
653
- {
654
- key: 'todo',
655
- title: '待办',
656
- list: [],
657
- emptyText: '你已完成所有待办',
658
- emptyImage: './assets/tmp/img/todo.svg',
659
- clearText: '重新加载'
660
- },
661
- {
662
- key: 'notice',
663
- title: '通知',
664
- list: [],
665
- emptyText: '你已查看所有通知',
666
- emptyImage: './assets/tmp/img/notice.svg',
667
- clearText: '重新加载'
668
- }
669
- ];
670
- this.loading = false;
671
- this.count = 0;
672
- this.subs = [];
673
- }
674
- YzHeaderNotifyComponent.prototype.ngOnInit = function () {
675
- this.loadData();
676
- };
677
- YzHeaderNotifyComponent.prototype.loadData = function () {
678
- var _this = this;
679
- this.count = 0;
680
- this.loading = true;
681
- this.subs.push(rxjs.forkJoin(this.loadTodo(), this.loadMessage()).subscribe(function () {
682
- _this.loading = false;
683
- _this.cdr.detectChanges();
684
- }));
685
- };
686
- YzHeaderNotifyComponent.prototype.loadMessage = function () {
687
- var _this = this;
688
- other.log('notify.component: ', 'fetch message list');
689
- var formatMessageStatus = function (status) {
690
- switch (status) {
691
- case '0':
692
- return { extra: '未读', color: 'red' };
693
- case '1':
694
- return { extra: '已读', color: 'green' };
695
- default:
696
- return { extra: '无状态', color: 'primary' };
697
- }
698
- };
699
- return this.httpClient
700
- .post("/message-center-3/my-msg-and-todo/msg-list", {
701
- pageNum: 1,
702
- pageSize: 10,
703
- status: '0'
704
- })
705
- .pipe(operators.map(function (response) {
706
- var viewMessage = _this.data.filter(function (d) { return d.key === 'msg'; })[0];
707
- viewMessage.list = response.data.list.map(function (m) {
708
- 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() }) });
709
- });
710
- _this.count += viewMessage.list.length;
711
- }));
712
- };
713
- YzHeaderNotifyComponent.prototype.loadTodo = function () {
714
- var _this = this;
715
- other.log('notify.component: ', 'fetch todo list');
716
- var formatTodoStatus = function (status) {
717
- switch (status) {
718
- case '0':
719
- return { extra: '未开始', color: 'red' };
720
- case '1':
721
- return { extra: '已开始', color: 'green' };
722
- default:
723
- return { extra: '无状态', color: 'primary' };
724
- }
725
- };
726
- return this.httpClient
727
- .post("/message-center-3/my-msg-and-todo/todo-list", {
728
- pageNum: 1,
729
- pageSize: 10,
730
- status: '0'
731
- })
732
- .pipe(operators.map(function (response) {
733
- var viewTodo = _this.data.filter(function (d) { return d.key === 'todo'; })[0];
734
- viewTodo.list = response.data.list.map(function (t) {
735
- 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 });
736
- });
737
- _this.count += viewTodo.list.length;
738
- }));
739
- };
740
- YzHeaderNotifyComponent.prototype.clear = function (type) {
741
- var _this = this;
742
- var t = this.data.filter(function (d) { return d.title === type; })[0];
743
- if (t.key == 'msg' || t.key == 'notice') {
744
- this.subs.push(this.httpClient.post("/message-center-3/my-msg-and-todo/msg-clear", {}).subscribe(function (_) {
745
- _this.msg.success("\u6E05\u7A7A\u4E86 " + type);
746
- _this.loadData();
747
- }));
748
- }
749
- if (t.key == 'todo') {
750
- this.loadData();
751
- }
752
- };
753
- YzHeaderNotifyComponent.prototype.select = function (res) {
754
- this.injector.get(util.WINDOW).open(res.item.url);
755
- this.loadData();
756
- };
757
- YzHeaderNotifyComponent.prototype.ngOnDestroy = function () {
758
- this.subs.forEach(function (a) { return a.unsubscribe(); });
759
- };
760
- return YzHeaderNotifyComponent;
761
- }());
762
- YzHeaderNotifyComponent.decorators = [
763
- { type: i0.Component, args: [{
764
- selector: 'yz-header-notify',
765
- 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 ",
766
- changeDetection: i0.ChangeDetectionStrategy.OnPush
767
- },] }
768
- ];
769
- YzHeaderNotifyComponent.ctorParameters = function () { return [
770
- { type: i0.Injector },
771
- { type: message.NzMessageService },
772
- { type: i2.NzI18nService },
773
- { type: i0.ChangeDetectorRef },
774
- { type: i1._HttpClient }
775
- ]; };
776
-
777
- var YzHeaderThemBtnComponent = /** @class */ (function () {
778
- function YzHeaderThemBtnComponent(renderer, configSrv, platform, doc, directionality, KEYS) {
779
- this.renderer = renderer;
780
- this.configSrv = configSrv;
781
- this.platform = platform;
782
- this.doc = doc;
783
- this.directionality = directionality;
784
- this.KEYS = KEYS;
785
- this.theme = 'default';
786
- this.types = [
787
- { key: 'default', text: 'theme.default', color: '#2163ff' },
788
- { key: 'compact', text: 'theme.compact', color: '#2163ff' },
789
- { key: 'dark', text: 'theme.dark', color: '#020202' },
790
- { key: 'yuhong', text: 'theme.yuhong', color: '#C04851' },
791
- { key: 'danjuhuang', text: 'theme.danjuhuang', color: '#FBA414' },
792
- { key: 'xinghuang', text: 'theme.xinghuang', color: '#F28E16' },
793
- { key: 'shilv', text: 'theme.shilv', color: '#57C3C2' },
794
- { key: 'zhulv', text: 'theme.zhulv', color: '#1BA784' },
795
- { key: 'youlan', text: 'theme.youlan', color: '#1781B5' },
796
- { key: 'dianqing', text: 'theme.dianqing', color: '#1661AB' },
797
- { key: 'shangengzi', text: 'theme.shangengzi', color: '#61649F' },
798
- { key: 'shuiniuhui', text: 'theme.shuiniuhui', color: '#2F2F35' }
799
- ];
800
- this.devTips = "When the dark.css file can't be found, you need to run it once: npm run theme";
801
- this.deployUrl = '';
802
- this.destroy$ = new rxjs.Subject();
803
- this.dir = 'ltr';
804
- }
805
- YzHeaderThemBtnComponent.prototype.ngOnInit = function () {
806
- var _this = this;
807
- var _a;
808
- this.dir = this.directionality.value;
809
- (_a = this.directionality.change) === null || _a === void 0 ? void 0 : _a.pipe(operators.takeUntil(this.destroy$)).subscribe(function (direction) {
810
- _this.dir = direction;
811
- });
812
- this.initTheme();
813
- };
814
- YzHeaderThemBtnComponent.prototype.initTheme = function () {
815
- if (!this.platform.isBrowser) {
816
- return;
817
- }
818
- this.theme = localStorage.getItem(this.KEYS) || 'default';
819
- this.updateChartTheme();
820
- this.onThemeChange(this.theme);
821
- };
822
- YzHeaderThemBtnComponent.prototype.updateChartTheme = function () {
823
- this.configSrv.set('chart', { theme: this.theme === 'dark' ? 'dark' : '' });
824
- };
825
- YzHeaderThemBtnComponent.prototype.onThemeChange = function (theme) {
826
- if (!this.platform.isBrowser) {
827
- return;
828
- }
829
- this.theme = theme;
830
- this.renderer.setAttribute(this.doc.body, 'data-theme', theme);
831
- var dom = this.doc.getElementById(this.KEYS);
832
- if (dom) {
833
- dom.remove();
834
- }
835
- localStorage.removeItem(this.KEYS);
836
- if (theme !== 'default') {
837
- var el = this.doc.createElement('link');
838
- el.type = 'text/css';
839
- el.rel = 'stylesheet';
840
- el.id = this.KEYS;
841
- el.href = this.deployUrl + "assets/style." + theme + ".css";
842
- localStorage.setItem(this.KEYS, theme);
843
- this.doc.body.append(el);
844
- }
845
- this.updateChartTheme();
846
- };
847
- YzHeaderThemBtnComponent.prototype.ngOnDestroy = function () {
848
- var el = this.doc.getElementById(this.KEYS);
849
- if (el != null) {
850
- this.doc.body.removeChild(el);
851
- }
852
- this.destroy$.next();
853
- this.destroy$.complete();
854
- };
855
- return YzHeaderThemBtnComponent;
856
- }());
857
- YzHeaderThemBtnComponent.decorators = [
858
- { type: i0.Component, args: [{
859
- selector: 'yz-header-theme-btn',
860
- 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 ",
861
- changeDetection: i0.ChangeDetectionStrategy.OnPush
862
- },] }
863
- ];
864
- YzHeaderThemBtnComponent.ctorParameters = function () { return [
865
- { type: i0.Renderer2 },
866
- { type: i1$1.YunzaiConfigService },
867
- { type: i3.Platform },
868
- { type: undefined, decorators: [{ type: i0.Inject, args: [common.DOCUMENT,] }] },
869
- { type: bidi.Directionality, decorators: [{ type: i0.Optional }] },
870
- { type: String, decorators: [{ type: i0.Inject, args: [themeBtn.YUNZAI_THEME_BTN_KEYS,] }] }
871
- ]; };
872
- YzHeaderThemBtnComponent.propDecorators = {
873
- types: [{ type: i0.Input }],
874
- devTips: [{ type: i0.Input }],
875
- deployUrl: [{ type: i0.Input }]
876
- };
877
-
878
- var BUSINESS_DEFAULT_CONFIG = {
879
- baseUrl: '/backstage',
880
- systemCode: 'portal',
881
- loginForm: null,
882
- refreshTokenEnabled: true,
883
- refreshTokenType: 're-request'
884
- };
885
- function mergeBisConfig(srv) {
886
- return srv.merge('bis', BUSINESS_DEFAULT_CONFIG);
887
- }
888
-
889
- var YzHeaderUserComponent = /** @class */ (function () {
890
- function YzHeaderUserComponent(injector, msg, tokenService,
891
- // @ts-ignore
892
- configService, cacheService) {
893
- this.injector = injector;
894
- this.msg = msg;
895
- this.tokenService = tokenService;
896
- this.configService = configService;
897
- this.cacheService = cacheService;
898
- this.icon = '';
899
- this.username = '';
900
- this.menus = [];
901
- this.config = mergeBisConfig(configService);
902
- }
903
- YzHeaderUserComponent.prototype.ngOnInit = function () {
904
- var projectInfo = this.cacheService.get('_yz_project_info', { mode: 'none' });
905
- var user = this.cacheService.get('_yz_user', { mode: 'none' });
906
- this.username = user.realname ? user.realname : '未命名';
907
- this.icon = user.avatarId
908
- ? this.config.baseUrl + "/filecenter/file/" + user.avatarId
909
- : "./assets/tmp/img/avatar.jpg";
910
- this.menus = projectInfo.profileList;
911
- };
912
- YzHeaderUserComponent.prototype.logout = function () {
913
- localStorage.clear();
914
- this.tokenService.clear();
915
- this.injector.get(util.WINDOW).location.href = this.config.baseUrl + "/cas-proxy/app/logout";
916
- };
917
- YzHeaderUserComponent.prototype.to = function (href) {
918
- if (href) {
919
- this.injector.get(util.WINDOW).open(href);
920
- }
921
- else {
922
- this.msg.error('该菜单没有配置链接!');
923
- }
924
- };
925
- return YzHeaderUserComponent;
926
- }());
927
- YzHeaderUserComponent.decorators = [
928
- { type: i0.Component, args: [{
929
- selector: 'yz-header-user',
930
- 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 ",
931
- changeDetection: i0.ChangeDetectionStrategy.OnPush
932
- },] }
933
- ];
934
- YzHeaderUserComponent.ctorParameters = function () { return [
935
- { type: i0.Injector },
936
- { type: message.NzMessageService },
937
- { type: undefined, decorators: [{ type: i0.Inject, args: [auth.YA_SERVICE_TOKEN,] }] },
938
- { type: util.YunzaiConfigService },
939
- { type: i2$1.CacheService }
940
- ]; };
941
-
942
- var YzHeaderClearStorageComponent = /** @class */ (function () {
943
- function YzHeaderClearStorageComponent(modalSrv, messageSrv) {
944
- this.modalSrv = modalSrv;
945
- this.messageSrv = messageSrv;
946
- }
947
- YzHeaderClearStorageComponent.prototype._click = function () {
948
- var _this = this;
949
- this.modalSrv.confirm({
950
- nzTitle: 'Make sure clear all local storage?',
951
- nzOnOk: function () {
952
- localStorage.clear();
953
- _this.messageSrv.success('Clear Finished!');
954
- }
955
- });
956
- };
957
- return YzHeaderClearStorageComponent;
958
- }());
959
- YzHeaderClearStorageComponent.decorators = [
960
- { type: i0.Component, args: [{
961
- selector: 'yz-header-clear-storage',
962
- template: "\n <i nz-icon nzType=\"tool\"></i>\n {{ 'menu.clear.local.storage' | i18n }}\n ",
963
- host: {
964
- '[class.d-block]': 'true'
965
- },
966
- changeDetection: i0.ChangeDetectionStrategy.OnPush
967
- },] }
968
- ];
969
- YzHeaderClearStorageComponent.ctorParameters = function () { return [
970
- { type: modal.NzModalService },
971
- { type: message.NzMessageService }
972
- ]; };
973
- YzHeaderClearStorageComponent.propDecorators = {
974
- _click: [{ type: i0.HostListener, args: ['click',] }]
975
- };
976
-
977
- var YzHeaderFullScreenComponent = /** @class */ (function () {
978
- function YzHeaderFullScreenComponent() {
979
- this.status = false;
980
- }
981
- Object.defineProperty(YzHeaderFullScreenComponent.prototype, "sf", {
982
- get: function () {
983
- return screenfull__namespace;
984
- },
985
- enumerable: false,
986
- configurable: true
987
- });
988
- YzHeaderFullScreenComponent.prototype._resize = function () {
989
- this.status = this.sf.isFullscreen;
990
- };
991
- YzHeaderFullScreenComponent.prototype._click = function () {
992
- if (this.sf.isEnabled) {
993
- this.sf.toggle();
994
- }
995
- };
996
- return YzHeaderFullScreenComponent;
997
- }());
998
- YzHeaderFullScreenComponent.decorators = [
999
- { type: i0.Component, args: [{
1000
- selector: 'yz-header-fullscreen',
1001
- template: "\n <i nz-icon [nzType]=\"status ? 'fullscreen-exit' : 'fullscreen'\"></i>\n {{ (status ? 'menu.fullscreen.exit' : 'menu.fullscreen') | i18n }}\n ",
1002
- host: {
1003
- '[class.d-block]': 'true'
1004
- },
1005
- changeDetection: i0.ChangeDetectionStrategy.OnPush
1006
- },] }
1007
- ];
1008
- YzHeaderFullScreenComponent.propDecorators = {
1009
- _resize: [{ type: i0.HostListener, args: ['window:resize',] }],
1010
- _click: [{ type: i0.HostListener, args: ['click',] }]
1011
- };
1012
-
1013
- var ɵ0 = function (msg) {
1014
- util.log(msg);
1015
- };
1016
- var STOMP_DEFAULT_CONFIG = {
1017
- connectHeaders: {
1018
- login: 'guest',
1019
- passcode: 'guest'
1020
- },
1021
- brokerURL: '/websocket/ws/',
1022
- heartbeatIncoming: 1000 * 60,
1023
- heartbeatOutgoing: 1000 * 60,
1024
- reconnectDelay: 30000000,
1025
- debug: ɵ0
1026
- };
1027
- function mergeStompConfig(srv) {
1028
- return srv.merge('stomp', STOMP_DEFAULT_CONFIG);
1029
- }
1030
-
1031
- var YzStompService = /** @class */ (function () {
1032
- function YzStompService(csr, cache, injector, notification) {
1033
- this.csr = csr;
1034
- this.cache = cache;
1035
- this.injector = injector;
1036
- this.notification = notification;
1037
- this.subs = [];
1038
- if (!this.user) {
1039
- this.user = this.cache.get('_yz_user', { mode: 'none' });
1040
- }
1041
- if (!this.config) {
1042
- this.config = mergeStompConfig(this.csr);
1043
- }
1044
- if (!this.bisConfig) {
1045
- this.bisConfig = mergeBisConfig(csr);
1046
- }
1047
- if (!this.rxStomp) {
1048
- this.rxStomp = new rxStomp.RxStomp();
1049
- if (i0.isDevMode()) {
1050
- util.log('yz.stomp.service: is dev mode');
1051
- util.log('yz.stomp.service: ', "config is " + JSON.stringify(this.config));
1052
- this.rxStomp.configure(this.config);
1053
- return;
1054
- }
1055
- var location = this.injector.get(common.DOCUMENT).location;
1056
- var protocol = location.protocol, host = location.host;
1057
- util.log('yz.stomp.service: ', "protocol is " + protocol + ",host is " + host);
1058
- if (protocol.includes('http') && !protocol.includes('https')) {
1059
- this.config.brokerURL = "ws://" + host + this.config.brokerURL;
1060
- }
1061
- if (protocol.includes('https')) {
1062
- this.config.brokerURL = "wss://" + host + this.config.brokerURL;
1063
- }
1064
- util.log('yz.stomp.service: ', "config is " + this.config);
1065
- this.rxStomp.configure(this.config);
1066
- }
1067
- }
1068
- YzStompService.prototype.listen = function () {
1069
- var _this = this;
1070
- this.subs.push(this.rxStomp.watch("/topic/layout_" + this.user.username).subscribe(function (message) {
1071
- _this.createNotification(JSON.parse(message.body));
1072
- }));
1073
- this.subs.push(this.rxStomp.watch("/topic/layout_xx_" + this.user.username).subscribe(function (message) {
1074
- _this.logoutNotification(JSON.parse(message.body));
1075
- }));
1076
- this.rxStomp.activate();
1077
- };
1078
- YzStompService.prototype.createNotification = function (message) {
1079
- this.notification.create(message.type, message.title, "<a href=" + message.href + ">" + message.content + "</a>");
1080
- };
1081
- YzStompService.prototype.logoutNotification = function (message) {
1082
- var _this = this;
1083
- this.notification.create(message.type, message.title, message.content + ",\u5269\u4F59\u65F6\u95F45\u79D2");
1084
- setTimeout(function () {
1085
- _this.cache.clear();
1086
- localStorage.clear();
1087
- _this.injector.get(util.WINDOW).location.href = _this.bisConfig.baseUrl + "/cas-proxy/app/logout";
1088
- }, 5000);
1089
- };
1090
- YzStompService.prototype.unListen = function () {
1091
- this.subs.forEach(function (s) { return s.unsubscribe(); });
1092
- this.rxStomp.deactivate().then();
1093
- };
1094
- YzStompService.prototype.publish = function (parameters) {
1095
- this.rxStomp.publish(parameters);
1096
- };
1097
- YzStompService.prototype.watch = function (destination, headers) {
1098
- return this.rxStomp.watch(destination, headers);
1099
- };
1100
- return YzStompService;
1101
- }());
1102
- 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" });
1103
- YzStompService.decorators = [
1104
- { type: i0.Injectable, args: [{ providedIn: 'root' },] }
1105
- ];
1106
- YzStompService.ctorParameters = function () { return [
1107
- { type: util.YunzaiConfigService },
1108
- { type: i2$1.CacheService },
1109
- { type: i0.Injector },
1110
- { type: i3$1.NzNotificationService }
1111
- ]; };
1112
-
1113
- var YzLayoutBasicComponent = /** @class */ (function () {
1114
- function YzLayoutBasicComponent(cacheService, yzStompService) {
1115
- this.cacheService = cacheService;
1116
- this.yzStompService = yzStompService;
1117
- this.options = {
1118
- logoExpanded: "./assets/logo-full.svg",
1119
- logoCollapsed: "./assets/logo.svg"
1120
- };
1121
- this.intro = '';
1122
- this.text = '';
1123
- this.icon = '';
1124
- }
1125
- YzLayoutBasicComponent.prototype.ngOnInit = function () {
1126
- var current = this.cacheService.get('_yz_current', { mode: 'none' });
1127
- var project = this.cacheService.get('_yz_project_info', { mode: 'none' });
1128
- this.text = current.text ? current.text : '应用名称';
1129
- this.intro = current.intro ? current.intro : '应用描述';
1130
- this.icon = current.icon ? current.icon : "./assets/tmp/img/avatar.jpg";
1131
- this.options.logoExpanded = project.maxLogoUrl ? project.maxLogoUrl : "./assets/logo-full.svg";
1132
- this.options.logoCollapsed = project.miniLogoUrl ? project.miniLogoUrl : "./assets/logo.svg";
1133
- this.yzStompService.listen();
1134
- };
1135
- YzLayoutBasicComponent.prototype.ngOnDestroy = function () {
1136
- this.yzStompService.unListen();
1137
- };
1138
- return YzLayoutBasicComponent;
1139
- }());
1140
- YzLayoutBasicComponent.decorators = [
1141
- { type: i0.Component, args: [{
1142
- selector: 'yz-layout-basic',
1143
- 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 ",
1144
- changeDetection: i0.ChangeDetectionStrategy.OnPush
1145
- },] }
1146
- ];
1147
- YzLayoutBasicComponent.ctorParameters = function () { return [
1148
- { type: i2$1.CacheService },
1149
- { type: YzStompService }
1150
- ]; };
1151
-
1152
- var COMPONENTS = [
1153
- // ContactComponent,
1154
- YzLayoutBasicComponent,
1155
- YzHeaderApplicationComponent,
1156
- YzHeaderNotifyComponent,
1157
- YzHeaderThemBtnComponent,
1158
- YzHeaderUserComponent,
1159
- YzHeaderFullScreenComponent,
1160
- YzHeaderClearStorageComponent,
1161
- YzHeaderI18NComponent
1162
- ];
1163
- var YunzaiLayoutModule = /** @class */ (function () {
1164
- function YunzaiLayoutModule() {
1165
- }
1166
- return YunzaiLayoutModule;
1167
- }());
1168
- YunzaiLayoutModule.decorators = [
1169
- { type: i0.NgModule, args: [{
1170
- imports: [http.HttpClientModule, common.CommonModule, forms.FormsModule, i4.RouterModule, forms.ReactiveFormsModule, shared.YzSharedModule],
1171
- providers: [
1172
- {
1173
- provide: themeBtn.YUNZAI_THEME_BTN_KEYS,
1174
- useValue: 'site-theme'
1175
- }
1176
- ],
1177
- declarations: __spreadArray([], __read(COMPONENTS)),
1178
- exports: __spreadArray([], __read(COMPONENTS))
1179
- },] }
1180
- ];
1181
-
1182
- var YzAuthService = /** @class */ (function () {
1183
- function YzAuthService(injector) {
1184
- this.injector = injector;
1185
- this.option = auth.mergeConfig(this.csr);
1186
- this.bis = mergeBisConfig(this.csr);
1187
- }
1188
- Object.defineProperty(YzAuthService.prototype, "csr", {
1189
- get: function () {
1190
- return this.injector.get(i1$1.YunzaiConfigService);
1191
- },
1192
- enumerable: false,
1193
- configurable: true
1194
- });
1195
- Object.defineProperty(YzAuthService.prototype, "tokenService", {
1196
- get: function () {
1197
- return this.injector.get(auth.YA_SERVICE_TOKEN);
1198
- },
1199
- enumerable: false,
1200
- configurable: true
1201
- });
1202
- Object.defineProperty(YzAuthService.prototype, "httpClient", {
1203
- get: function () {
1204
- return this.injector.get(i1._HttpClient);
1205
- },
1206
- enumerable: false,
1207
- configurable: true
1208
- });
1209
- Object.defineProperty(YzAuthService.prototype, "cacheService", {
1210
- get: function () {
1211
- return this.injector.get(i2$1.CacheService);
1212
- },
1213
- enumerable: false,
1214
- configurable: true
1215
- });
1216
- YzAuthService.prototype.askToken = function () {
1217
- var _a;
1218
- other.log('yz.auth.service: ', 'askToken');
1219
- if ((_a = this.tokenService.get()) === null || _a === void 0 ? void 0 : _a.token) {
1220
- return rxjs.of(this.tokenService.get());
1221
- }
1222
- else {
1223
- if (this.bis.loginForm) {
1224
- return this.fetchTokenByUP();
1225
- }
1226
- else {
1227
- return this.fetchTokenByCas();
1228
- }
1229
- }
1230
- };
1231
- YzAuthService.prototype.fetchTokenByUP = function () {
1232
- other.log('yz.auth.service: ', 'fetchTokenByUP');
1233
- return this.httpClient.post("/auth/oauth/token?_allow_anonymous=true", this.bis.loginForm).pipe(operators.map(function (response) {
1234
- var access_token = response.access_token, expires_in = response.expires_in, refresh_token = response.refresh_token, scope = response.scope, token_type = response.token_type;
1235
- return {
1236
- token: access_token,
1237
- expired: expires_in,
1238
- refreshToken: refresh_token,
1239
- tokenType: token_type,
1240
- scope: scope
1241
- };
1242
- }));
1243
- };
1244
- YzAuthService.prototype.fetchTokenByCas = function () {
1245
- var _this = this;
1246
- other.log('yz.auth.service: ', 'fetchTokenByCas');
1247
- var uri = encodeURIComponent(this.injector.get(util.WINDOW).location.href);
1248
- return this.httpClient
1249
- .get("/cas-proxy/app/validate_full?callback=" + uri + "&_allow_anonymous=true&timestamp=" + new Date().getTime())
1250
- .pipe(operators.map(function (response) {
1251
- switch (response.errcode) {
1252
- case 2000:
1253
- var _b = response.data, access_token = _b.access_token, expires_in = _b.expires_in, refresh_token = _b.refresh_token, scope = _b.scope, token_type = _b.token_type;
1254
- return {
1255
- token: access_token,
1256
- expired: expires_in,
1257
- refreshToken: refresh_token,
1258
- tokenType: token_type,
1259
- scope: scope
1260
- };
1261
- case 2001:
1262
- _this.injector.get(util.WINDOW).location.href = response.msg;
1263
- throw Error("Cookie Error: Can't find Cas Cookie,So jump to login!");
1264
- default:
1265
- if (response.data) {
1266
- console.error(response.data);
1267
- throw Error(response.data);
1268
- }
1269
- else if (response.msg) {
1270
- console.error(response.msg);
1271
- throw Error(response.msg);
1272
- }
1273
- else {
1274
- console.error('cas unknown error');
1275
- throw Error('Unknown Error: Cas auth exception!');
1276
- }
1277
- }
1278
- }));
1279
- };
1280
- YzAuthService.prototype.login = function () {
1281
- var _this = this;
1282
- other.log('yz.auth.service: ', 'login white login form->', this.bis.loginForm);
1283
- return this.askToken().pipe(operators.mergeMap(function (token) {
1284
- other.log('yz.auth.service: get token->', token);
1285
- _this.csr.set('auth', {
1286
- token_send_key: 'Authorization',
1287
- token_send_template: token.tokenType + " ${token}",
1288
- token_send_place: 'header'
1289
- });
1290
- other.log('yz.auth.service: ', 'set token');
1291
- _this.tokenService.set(token);
1292
- return _this.cacheInit();
1293
- }), operators.mergeAll());
1294
- };
1295
- YzAuthService.prototype.cacheInit = function () {
1296
- var _this = this;
1297
- other.log('yz.auth.service: ', 'cacheInit');
1298
- var user = this.cacheService.get('_yz_user', { mode: 'none' });
1299
- var header = this.cacheService.get('_yz_header', { mode: 'none' });
1300
- var project = this.cacheService.get('_yz_project_info', { mode: 'none' });
1301
- return rxjs.forkJoin(rxjs.of(user), rxjs.of(header), rxjs.of(project)).pipe(operators.mergeMap(function (_b) {
1302
- var _c = __read(_b, 3), u = _c[0], h = _c[1], p = _c[2];
1303
- var list = [];
1304
- // user cache
1305
- if (!u) {
1306
- other.log('yz.auth.service: ', 'fetch user cache');
1307
- list.push(_this.httpClient.get("/auth/user").pipe(operators.map(function (user) {
1308
- _this.cacheService.set('_yz_user', user.principal);
1309
- })));
1310
- }
1311
- else {
1312
- other.log('yz.auth.service: ', 'user recache');
1313
- list.push(rxjs.of(function () { }));
1314
- }
1315
- // header cache
1316
- if (!h) {
1317
- other.log('yz.auth.service: ', 'fetch header cache');
1318
- list.push(_this.httpClient.get("/auth/allheader/v2").pipe(operators.map(function (header) {
1319
- _this.cacheService.set('_yz_header', header.data);
1320
- })));
1321
- }
1322
- else {
1323
- other.log('yz.auth.service: ', 'header recache');
1324
- list.push(rxjs.of(function () { }));
1325
- }
1326
- // project cache
1327
- if (!p) {
1328
- other.log('yz.auth.service: ', 'fetch project cache');
1329
- list.push(_this.httpClient.get("/app-manager/project/info").pipe(operators.map(function (info) {
1330
- _this.cacheService.set('_yz_project_info', info.data);
1331
- })));
1332
- }
1333
- else {
1334
- other.log('yz.auth.service: ', 'project recache');
1335
- list.push(rxjs.of(function () { }));
1336
- }
1337
- return rxjs.forkJoin(list);
1338
- }));
1339
- };
1340
- return YzAuthService;
1341
- }());
1342
- YzAuthService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function YzAuthService_Factory() { return new YzAuthService(i0__namespace.ɵɵinject(i0__namespace.INJECTOR)); }, token: YzAuthService, providedIn: "root" });
1343
- YzAuthService.decorators = [
1344
- { type: i0.Injectable, args: [{ providedIn: 'root' },] }
1345
- ];
1346
- YzAuthService.ctorParameters = function () { return [
1347
- { type: i0.Injector }
1348
- ]; };
1349
-
1350
- var CODEMESSAGE = {
1351
- 200: '服务器成功返回请求的数据。',
1352
- 201: '新建或修改数据成功。',
1353
- 202: '一个请求已经进入后台排队(异步任务)。',
1354
- 204: '删除数据成功。',
1355
- 400: '发出的请求有错误,服务器没有进行新建或修改数据的操作。',
1356
- 401: '用户没有权限(令牌、用户名、密码错误)。',
1357
- 403: '用户得到授权,但是访问是被禁止的。',
1358
- 404: '发出的请求针对的是不存在的记录,服务器没有进行操作。',
1359
- 406: '请求的格式不可得。',
1360
- 410: '请求的资源被永久删除,且不会再得到的。',
1361
- 422: '当创建一个对象时,发生一个验证错误。',
1362
- 500: '服务器发生错误,请检查服务器。',
1363
- 502: '网关错误。',
1364
- 503: '服务不可用,服务器暂时过载或维护。',
1365
- 504: '网关超时。'
1366
- };
1367
- /**
1368
- * 默认HTTP拦截器,其注册细节见 `app.module.ts`
1369
- */
1370
- var YzDefaultInterceptor = /** @class */ (function () {
1371
- function YzDefaultInterceptor(injector) {
1372
- this.injector = injector;
1373
- this.jump = false;
1374
- this.refreshToking = false;
1375
- this.refreshToken$ = new rxjs.BehaviorSubject(null);
1376
- if (this.config.refreshTokenType === 'auth-refresh') {
1377
- console.error("can't use auth-refresh, please change yz.default.interceptor to default.interceptor!");
1378
- }
1379
- }
1380
- Object.defineProperty(YzDefaultInterceptor.prototype, "notification", {
1381
- get: function () {
1382
- return this.injector.get(i3$1.NzNotificationService);
1383
- },
1384
- enumerable: false,
1385
- configurable: true
1386
- });
1387
- Object.defineProperty(YzDefaultInterceptor.prototype, "tokenSrv", {
1388
- get: function () {
1389
- return this.injector.get(auth.YA_SERVICE_TOKEN);
1390
- },
1391
- enumerable: false,
1392
- configurable: true
1393
- });
1394
- Object.defineProperty(YzDefaultInterceptor.prototype, "http", {
1395
- get: function () {
1396
- return this.injector.get(i1._HttpClient);
1397
- },
1398
- enumerable: false,
1399
- configurable: true
1400
- });
1401
- Object.defineProperty(YzDefaultInterceptor.prototype, "config", {
1402
- get: function () {
1403
- return mergeBisConfig(this.injector.get(i1$1.YunzaiConfigService));
1404
- },
1405
- enumerable: false,
1406
- configurable: true
1407
- });
1408
- YzDefaultInterceptor.prototype.goTo = function (url) {
1409
- var _this = this;
1410
- setTimeout(function () { return _this.injector.get(i4.Router).navigateByUrl(url); });
1411
- };
1412
- YzDefaultInterceptor.prototype.checkStatus = function (ev) {
1413
- if ((ev.status >= 200 && ev.status < 300) || ev.status === 401) {
1414
- return;
1415
- }
1416
- if (ev instanceof http.HttpErrorResponse && (ev.error.message || ev.error.errorMessage)) {
1417
- if (ev.error.errorMessage) {
1418
- this.notification.error("\u53D1\u751F\u4E86\u4E00\u4E9B\u9519\u8BEF ", ev.error.errorMessage);
1419
- }
1420
- else {
1421
- this.notification.error("\u53D1\u751F\u4E86\u4E00\u4E9B\u9519\u8BEF ", ev.error.message);
1422
- }
1423
- return;
1424
- }
1425
- if (ev instanceof http.HttpResponse && ev.body.errorMessage) {
1426
- this.notification.error("\u53D1\u751F\u4E86\u4E00\u4E9B\u9519\u8BEF ", ev.body.errorMessage);
1427
- return;
1428
- }
1429
- var errortext = CODEMESSAGE[ev.status] || ev.statusText;
1430
- this.notification.error("\u8BF7\u6C42\u9519\u8BEF " + ev.status + ": " + ev.url, errortext);
1431
- };
1432
- YzDefaultInterceptor.prototype.ToLogin = function () {
1433
- var _this = this;
1434
- 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", "");
1435
- setTimeout(function () {
1436
- localStorage.clear();
1437
- _this.injector.get(util.WINDOW).location.href = _this.config.baseUrl + "/cas-proxy/app/logout";
1438
- }, 5000);
1439
- };
1440
- YzDefaultInterceptor.prototype.reAttachToken = function (req) {
1441
- var _a;
1442
- var token = (_a = this.tokenSrv.get()) === null || _a === void 0 ? void 0 : _a.token;
1443
- return req.clone({
1444
- setHeaders: {
1445
- Authorization: "Bearer " + token
1446
- }
1447
- });
1448
- };
1449
- YzDefaultInterceptor.prototype.refreshTokenRequest = function () {
1450
- var model = this.tokenSrv.get();
1451
- var form = new FormData();
1452
- form.set('refresh_token', model === null || model === void 0 ? void 0 : model.refreshToken);
1453
- other.log('yz.default.interceptor: use the refresh token to request a new token', model === null || model === void 0 ? void 0 : model.refreshToken);
1454
- return this.http.post("/auth/user/token/refresh?_allow_anonymous=true", form);
1455
- };
1456
- YzDefaultInterceptor.prototype.tryRefreshToken = function (ev, req, next) {
1457
- var _this = this;
1458
- // 连刷新Token的请求都错了,那就是真错了
1459
- if (['/auth/oauth/token'].some(function (url) { return req.url.includes(url); })) {
1460
- this.ToLogin();
1461
- return rxjs.throwError(ev);
1462
- }
1463
- // 正在刷新token,所有其他请求排队
1464
- if (this.refreshToking) {
1465
- return this.refreshToken$.pipe(operators.filter(function (v) { return !!v; }), operators.take(1), operators.switchMap(function () { return next.handle(_this.reAttachToken(req)); }));
1466
- }
1467
- //尝试调用刷新 Token
1468
- this.refreshToking = true;
1469
- this.refreshToken$.next(null);
1470
- // 处理Token
1471
- return this.refreshTokenRequest().pipe(operators.switchMap(function (res) {
1472
- other.log('yz.default.interceptor: refresh token accessed -> ', res);
1473
- // 重新保存新 token
1474
- var access_token = res.access_token, expires_in = res.expires_in, refresh_token = res.refresh_token, scope = res.scope, token_type = res.token_type;
1475
- _this.tokenSrv.set({
1476
- token: access_token,
1477
- expired: expires_in,
1478
- refreshToken: refresh_token,
1479
- tokenType: token_type,
1480
- scope: scope
1481
- });
1482
- // 通知后续请求继续执行
1483
- _this.refreshToking = false;
1484
- _this.refreshToken$.next(res);
1485
- // 重新发起请求
1486
- return next.handle(_this.reAttachToken(req));
1487
- }), operators.catchError(function (err) {
1488
- _this.refreshToking = false;
1489
- _this.ToLogin();
1490
- return rxjs.throwError(err);
1491
- }));
1492
- };
1493
- YzDefaultInterceptor.prototype.getAdditionalHeaders = function (headers) {
1494
- var res = {};
1495
- var lang = this.injector.get(i1.YUNZAI_I18N_TOKEN).currentLang;
1496
- if (!(headers === null || headers === void 0 ? void 0 : headers.has('Accept-Language')) && lang) {
1497
- res['Accept-Language'] = lang;
1498
- }
1499
- return res;
1500
- };
1501
- YzDefaultInterceptor.prototype.handleData = function (ev, req, next) {
1502
- this.checkStatus(ev);
1503
- switch (ev.status) {
1504
- case 200:
1505
- return rxjs.of(ev);
1506
- case 401:
1507
- if (this.config.refreshTokenEnabled && this.config.refreshTokenType === 're-request') {
1508
- return this.tryRefreshToken(ev, req, next);
1509
- }
1510
- this.ToLogin();
1511
- break;
1512
- case 403:
1513
- case 404:
1514
- case 500:
1515
- if (this.jump) {
1516
- this.goTo("/exception/" + ev.status);
1517
- }
1518
- break;
1519
- default:
1520
- if (ev instanceof http.HttpErrorResponse) {
1521
- console.warn('未可知错误,大部分是由于后端不支持跨域CORS或无效配置引起,请参考 https://ng.yunzainfo.com/docs/server 解决跨域问题', ev);
1522
- }
1523
- break;
1524
- }
1525
- if (ev instanceof http.HttpErrorResponse) {
1526
- return rxjs.throwError(ev);
1527
- }
1528
- else {
1529
- return rxjs.of(ev);
1530
- }
1531
- };
1532
- YzDefaultInterceptor.prototype.intercept = function (req, next) {
1533
- var _this = this;
1534
- other.log('yz.default.interceptor.ts: ', 'request ', req);
1535
- // 统一加前缀
1536
- var url = req.url;
1537
- if (!url.startsWith('https://') && !url.startsWith('http://')) {
1538
- url = this.config.baseUrl + url;
1539
- }
1540
- if (url.includes('.json') && url.includes('assets')) {
1541
- url = req.url;
1542
- }
1543
- // 加入语言头
1544
- var newReq = req.clone({ url: url, setHeaders: this.getAdditionalHeaders(req.headers) });
1545
- return next.handle(newReq).pipe(operators.mergeMap(function (ev) {
1546
- // 允许统一对请求错误处理
1547
- if (ev instanceof http.HttpResponseBase) {
1548
- return _this.handleData(ev, newReq, next);
1549
- }
1550
- // 若一切都正常,则后续操作
1551
- return rxjs.of(ev);
1552
- }), operators.catchError(function (err) { return _this.handleData(err, newReq, next); }));
1553
- };
1554
- return YzDefaultInterceptor;
1555
- }());
1556
- YzDefaultInterceptor.decorators = [
1557
- { type: i0.Injectable }
1558
- ];
1559
- YzDefaultInterceptor.ctorParameters = function () { return [
1560
- { type: i0.Injector }
1561
- ]; };
1562
-
1563
- function mapYzSideToYelonMenu(menus) {
1564
- menus.forEach(function (menu) {
1565
- menu.badgeDot = menu.badge_dot || null;
1566
- menu.badgeStatus = menu.badge_status || null;
1567
- menu.shortcutRoot = menu.shortcut_root || null;
1568
- menu.reuse = true;
1569
- if (menu.children) {
1570
- mapYzSideToYelonMenu(menu.children);
1571
- }
1572
- });
1573
- }
1574
- function generateAbility(menus, abilities, prefix) {
1575
- menus.forEach(function (menu) {
1576
- if (menu.link) {
1577
- prefix += menu.link;
1578
- }
1579
- else {
1580
- prefix += '';
1581
- }
1582
- if (menu.menuAuths) {
1583
- menu.menuAuths.forEach(function (a) {
1584
- abilities.push(prefix + ":" + a);
1585
- abilities.push(a);
1586
- });
1587
- }
1588
- if (menu.children) {
1589
- generateAbility(menu.children, abilities, prefix);
1590
- }
1591
- });
1592
- }
1593
- var YzStartupService = /** @class */ (function () {
1594
- function YzStartupService(iconSrv, menuService, i18n, settingService, aclService, titleService, yzAuthService, cacheService, configService) {
1595
- this.menuService = menuService;
1596
- this.i18n = i18n;
1597
- this.settingService = settingService;
1598
- this.aclService = aclService;
1599
- this.titleService = titleService;
1600
- this.yzAuthService = yzAuthService;
1601
- this.cacheService = cacheService;
1602
- this.configService = configService;
1603
- this.bis = BUSINESS_DEFAULT_CONFIG;
1604
- this.bis = mergeBisConfig(this.configService);
1605
- iconSrv.addIcon.apply(iconSrv, __spreadArray([], __read(shared.ICONS)));
1606
- }
1607
- YzStartupService.prototype.load = function () {
1608
- var _this = this;
1609
- util.log('startup.service: ', 'load');
1610
- var defaultLang = this.i18n.defaultLang;
1611
- return this.i18n.loadLangData(defaultLang).pipe(operators.mergeMap(function (langData) {
1612
- util.log('startup.service: ', 'set i18n, defaultLang->', defaultLang, ' langData->', langData);
1613
- _this.i18n.use(defaultLang, langData);
1614
- return rxjs.of(null);
1615
- }), operators.mergeMap(function () {
1616
- return _this.yzAuthService.login();
1617
- }), operators.mergeMap(function (v) {
1618
- // preloader finish
1619
- _this.systemInit();
1620
- util.log('startup.service: preloader finish');
1621
- var win = window;
1622
- if (win && win.appBootstrap) {
1623
- win.appBootstrap();
1624
- }
1625
- return rxjs.of(v);
1626
- }));
1627
- };
1628
- YzStartupService.prototype.systemInit = function () {
1629
- var _this = this;
1630
- util.log('startup.service: system init');
1631
- // user
1632
- var user = this.cacheService.get('_yz_user', { mode: 'none' });
1633
- // menu
1634
- var ms = util.deepCopy(user.menu).filter(function (m) { return m.systemCode && m.systemCode === _this.bis.systemCode; });
1635
- mapYzSideToYelonMenu(ms);
1636
- var currentMenu = ms.pop();
1637
- this.menuService.add([currentMenu]);
1638
- // logo app
1639
- this.settingService.setApp({ name: currentMenu.text, description: currentMenu.intro });
1640
- this.settingService.setUser({
1641
- name: user.realname || 'no name',
1642
- avatar: this.bis.baseUrl + "/filecenter/file/" + user.avatarId || '',
1643
- email: user.email || 'no email'
1644
- });
1645
- // title
1646
- this.titleService.default = currentMenu.text || 'default application name';
1647
- this.titleService.setTitle(currentMenu.text || 'no title');
1648
- // acl
1649
- var abilities = [];
1650
- generateAbility([currentMenu], abilities, '');
1651
- this.aclService.attachRole((user === null || user === void 0 ? void 0 : user.roles.map(function (role) {
1652
- return role.roleValue;
1653
- }).filter(function (a) { return !!a; })) || []);
1654
- this.aclService.attachAbility(abilities);
1655
- // cache current
1656
- this.cacheService.set('_yz_current', {
1657
- text: currentMenu.text,
1658
- intro: currentMenu.intro,
1659
- icon: currentMenu.appIconUrl
1660
- });
1661
- };
1662
- return YzStartupService;
1663
- }());
1664
- YzStartupService.decorators = [
1665
- { type: i0.Injectable }
1666
- ];
1667
- YzStartupService.ctorParameters = function () { return [
1668
- { type: icon.NzIconService },
1669
- { type: i1.MenuService },
1670
- { type: YzI18NService, decorators: [{ type: i0.Inject, args: [i1.YUNZAI_I18N_TOKEN,] }] },
1671
- { type: i1.SettingsService },
1672
- { type: acl.ACLService },
1673
- { type: i1.TitleService },
1674
- { type: YzAuthService },
1675
- { type: i2$1.CacheService },
1676
- { type: util.YunzaiConfigService }
1677
- ]; };
1678
- function YzStartupServiceFactory(startupService) {
1679
- return function () { return startupService.load(); };
1680
- }
1681
- //@ts-ignore
1682
- var YZ_APPINIT_PROVIDES = [
1683
- YzStartupService,
1684
- {
1685
- provide: i0.APP_INITIALIZER,
1686
- useFactory: YzStartupServiceFactory,
1687
- deps: [YzStartupService],
1688
- multi: true
1689
- }
1690
- ];
1691
-
1692
- var PathToRegexpService = /** @class */ (function () {
1693
- function PathToRegexpService() {
1694
- this.DEFAULT_DELIMITER = '/';
1695
- this.PATH_REGEXP = new RegExp(['(\\\\.)', '(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?'].join('|'), 'g');
1696
- }
1697
- PathToRegexpService.prototype.parse = function (str, options) {
1698
- var tokens = [];
1699
- var key = 0;
1700
- var index = 0;
1701
- var path = '';
1702
- var defaultDelimiter = (options && options.delimiter) || this.DEFAULT_DELIMITER;
1703
- var whitelist = (options && options.whitelist) || undefined;
1704
- var pathEscaped = false;
1705
- var res;
1706
- while ((res = this.PATH_REGEXP.exec(str)) !== null) {
1707
- var m = res[0];
1708
- var escaped = res[1];
1709
- var offset = res.index;
1710
- path += str.slice(index, offset);
1711
- index = offset + m.length;
1712
- // Ignore already escaped sequences.
1713
- if (escaped) {
1714
- path += escaped[1];
1715
- pathEscaped = true;
1716
- continue;
1717
- }
1718
- var prev = '';
1719
- var name = res[2];
1720
- var capture = res[3];
1721
- var group = res[4];
1722
- var modifier = res[5];
1723
- if (!pathEscaped && path.length) {
1724
- var k = path.length - 1;
1725
- var c = path[k];
1726
- var matches = whitelist ? whitelist.indexOf(c) > -1 : true;
1727
- if (matches) {
1728
- prev = c;
1729
- path = path.slice(0, k);
1730
- }
1731
- }
1732
- // Push the current path onto the tokens.
1733
- if (path) {
1734
- tokens.push(path);
1735
- path = '';
1736
- pathEscaped = false;
1737
- }
1738
- var repeat = modifier === '+' || modifier === '*';
1739
- var optional = modifier === '?' || modifier === '*';
1740
- var pattern = capture || group;
1741
- var delimiter = prev || defaultDelimiter;
1742
- tokens.push({
1743
- name: name || key++,
1744
- prefix: prev,
1745
- delimiter: delimiter,
1746
- optional: optional,
1747
- repeat: repeat,
1748
- pattern: pattern
1749
- ? this.escapeGroup(pattern)
1750
- : "[^" + this.escapeString(delimiter === defaultDelimiter ? delimiter : delimiter + defaultDelimiter) + "]+?"
1751
- });
1752
- }
1753
- // Push any remaining characters.
1754
- if (path || index < str.length) {
1755
- tokens.push(path + str.substr(index));
1756
- }
1757
- return tokens;
1758
- };
1759
- PathToRegexpService.prototype.compile = function (str, options) {
1760
- return this.tokensToFunction(this.parse(str, options), options);
1761
- };
1762
- PathToRegexpService.prototype.tokensToFunction = function (tokens, options) {
1763
- var matches = new Array(tokens.length);
1764
- for (var i = 0; i < tokens.length; i++) {
1765
- if (typeof tokens[i] === 'object') {
1766
- matches[i] = new RegExp("^(?:" + tokens[i].pattern + ")$", this.flags(options));
1767
- }
1768
- }
1769
- return function (data, options) {
1770
- var path = '';
1771
- var encode = (options && options.encode) || encodeURIComponent;
1772
- var validate = options ? options.validate !== false : true;
1773
- for (var i = 0; i < tokens.length; i++) {
1774
- var token = tokens[i];
1775
- if (typeof token === 'string') {
1776
- path += token;
1777
- continue;
1778
- }
1779
- var value = data ? data[token.name] : undefined;
1780
- var segment = void 0;
1781
- if (Array.isArray(value)) {
1782
- if (!token.repeat) {
1783
- throw new TypeError("Expected \"" + token.name + "\" to not repeat, but got array");
1784
- }
1785
- if (value.length === 0) {
1786
- if (token.optional) {
1787
- continue;
1788
- }
1789
- throw new TypeError("Expected \"" + token.name + "\" to not be empty");
1790
- }
1791
- for (var j = 0; j < value.length; j++) {
1792
- segment = encode(value[j], token);
1793
- if (validate && !matches[i].test(segment)) {
1794
- throw new TypeError("Expected all \"" + token.name + "\" to match \"" + token.pattern + "\"");
1795
- }
1796
- path += (j === 0 ? token.prefix : token.delimiter) + segment;
1797
- }
1798
- continue;
1799
- }
1800
- if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
1801
- segment = encode(String(value), token);
1802
- if (validate && !matches[i].test(segment)) {
1803
- throw new TypeError("Expected \"" + token.name + "\" to match \"" + token.pattern + "\", but got \"" + segment + "\"");
1804
- }
1805
- path += token.prefix + segment;
1806
- continue;
1807
- }
1808
- if (token.optional) {
1809
- continue;
1810
- }
1811
- throw new TypeError("Expected \"" + token.name + "\" to be " + (token.repeat ? 'an array' : 'a string'));
1812
- }
1813
- return path;
1814
- };
1815
- };
1816
- PathToRegexpService.prototype.escapeString = function (str) {
1817
- return str.replace(/([.+*?=^!:${}()[\]|/\\])/g, '\\$1');
1818
- };
1819
- PathToRegexpService.prototype.escapeGroup = function (group) {
1820
- return group.replace(/([=!:$/()])/g, '\\$1');
1821
- };
1822
- PathToRegexpService.prototype.flags = function (options) {
1823
- return options && options.sensitive ? '' : 'i';
1824
- };
1825
- PathToRegexpService.prototype.regexpToRegexp = function (path, keys) {
1826
- if (!keys) {
1827
- return path;
1828
- }
1829
- var groups = path.source.match(/\((?!\?)/g);
1830
- if (groups) {
1831
- for (var i = 0; i < groups.length; i++) {
1832
- keys.push({
1833
- name: i,
1834
- prefix: null,
1835
- delimiter: null,
1836
- optional: false,
1837
- repeat: false,
1838
- pattern: null
1839
- });
1840
- }
1841
- }
1842
- return path;
1843
- };
1844
- PathToRegexpService.prototype.arrayToRegexp = function (path, keys, options) {
1845
- var parts = [];
1846
- for (var i = 0; i < path.length; i++) {
1847
- parts.push(this.pathToRegexp(path[i], keys, options).source);
1848
- }
1849
- return new RegExp("(?:" + parts.join('|') + ")", this.flags(options));
1850
- };
1851
- PathToRegexpService.prototype.stringToRegexp = function (path, keys, options) {
1852
- return this.tokensToRegExp(this.parse(path, options), keys, options);
1853
- };
1854
- PathToRegexpService.prototype.tokensToRegExp = function (tokens, keys, options) {
1855
- options = options || {};
1856
- var strict = options.strict;
1857
- var start = options.start !== false;
1858
- var end = options.end !== false;
1859
- var delimiter = options.delimiter || this.DEFAULT_DELIMITER;
1860
- var endsWith = []
1861
- .concat(options.endsWith || [])
1862
- .map(this.escapeString)
1863
- .concat('$')
1864
- .join('|');
1865
- var route = start ? '^' : '';
1866
- for (var i = 0; i < tokens.length; i++) {
1867
- var token = tokens[i];
1868
- if (typeof token === 'string') {
1869
- route += this.escapeString(token);
1870
- }
1871
- else {
1872
- var capture = token.repeat
1873
- ? "(?:" + token.pattern + ")(?:" + this.escapeString(token.delimiter) + "(?:" + token.pattern + "))*"
1874
- : token.pattern;
1875
- if (keys) {
1876
- keys.push(token);
1877
- }
1878
- if (token.optional) {
1879
- if (!token.prefix) {
1880
- route += "(" + capture + ")?";
1881
- }
1882
- else {
1883
- route += "(?:" + this.escapeString(token.prefix) + "(" + capture + "))?";
1884
- }
1885
- }
1886
- else {
1887
- route += this.escapeString(token.prefix) + "(" + capture + ")";
1888
- }
1889
- }
1890
- }
1891
- if (end) {
1892
- if (!strict) {
1893
- route += "(?:" + this.escapeString(delimiter) + ")?";
1894
- }
1895
- route += endsWith === '$' ? '$' : "(?=" + endsWith + ")";
1896
- }
1897
- else {
1898
- var endToken = tokens[tokens.length - 1];
1899
- var isEndDelimited = typeof endToken === 'string' ? endToken[endToken.length - 1] === delimiter : endToken === undefined;
1900
- if (!strict) {
1901
- route += "(?:" + this.escapeString(delimiter) + "(?=" + endsWith + "))?";
1902
- }
1903
- if (!isEndDelimited) {
1904
- route += "(?=" + this.escapeString(delimiter) + "|" + endsWith + ")";
1905
- }
1906
- }
1907
- return new RegExp(route, this.flags(options));
1908
- };
1909
- PathToRegexpService.prototype.pathToRegexp = function (path, keys, options) {
1910
- if (path instanceof RegExp) {
1911
- return this.regexpToRegexp(path, keys);
1912
- }
1913
- if (Array.isArray(path)) {
1914
- return this.arrayToRegexp(/** @type {!Array} */ path, keys, options);
1915
- }
1916
- return this.stringToRegexp(/** @type {string} */ path, keys, options);
1917
- };
1918
- return PathToRegexpService;
1919
- }());
1920
- PathToRegexpService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function PathToRegexpService_Factory() { return new PathToRegexpService(); }, token: PathToRegexpService, providedIn: "root" });
1921
- PathToRegexpService.decorators = [
1922
- { type: i0.Injectable, args: [{
1923
- providedIn: 'root'
1924
- },] }
1925
- ];
1926
- PathToRegexpService.ctorParameters = function () { return []; };
1927
-
1928
- var ActGuard = /** @class */ (function () {
1929
- function ActGuard(configService, cacheService, pathToRegexp, router) {
1930
- var _this = this;
1931
- this.configService = configService;
1932
- this.cacheService = cacheService;
1933
- this.pathToRegexp = pathToRegexp;
1934
- this.router = router;
1935
- this.bis = BUSINESS_DEFAULT_CONFIG;
1936
- this.menus = [];
1937
- this.links = [];
1938
- util.log('act: ');
1939
- this.bis = mergeBisConfig(this.configService);
1940
- util.log('act: config ', this.bis);
1941
- var user = this.cacheService.get('_yz_user', { mode: 'none' });
1942
- util.log('act: user ', user);
1943
- this.menus = util.deepCopy(user.menu).filter(function (m) { return m.systemCode && m.systemCode === _this.bis.systemCode; });
1944
- util.log('act: menus ', this.menus);
1945
- this.getAllLinks(this.menus, this.links);
1946
- util.log('act: links ', this.links);
1947
- }
1948
- ActGuard.prototype.canActivate = function (_, state) {
1949
- var _this = this;
1950
- util.log('act: can activate ', state);
1951
- if (this.preHandle(state)) {
1952
- return true;
1953
- }
1954
- util.log('act: can activate child prehandle success');
1955
- var canactivate = false;
1956
- this.links.forEach(function (link) {
1957
- var regexp = _this.pathToRegexp.stringToRegexp(link, null, null);
1958
- util.log("act: " + link + " test " + state.url.split('?')[0]);
1959
- if (regexp.test(state.url.split('?')[0])) {
1960
- canactivate = true;
1961
- util.log("act: test value " + canactivate);
1962
- return;
1963
- }
1964
- });
1965
- if (canactivate) {
1966
- util.log("act: test sucess");
1967
- return true;
1968
- }
1969
- else {
1970
- util.log("act: test error");
1971
- this.router.navigate(['displayIndex']);
1972
- return false;
1973
- }
1974
- };
1975
- ActGuard.prototype.canActivateChild = function (_, state) {
1976
- var _this = this;
1977
- util.log('act: can activate child ', state);
1978
- if (this.preHandle(state)) {
1979
- return true;
1980
- }
1981
- util.log('act: can activate child prehandle success');
1982
- var canactivate = false;
1983
- this.links.forEach(function (link) {
1984
- var regexp = _this.pathToRegexp.stringToRegexp(link, null, null);
1985
- if (regexp.test(state.url.split('?')[0])) {
1986
- util.log("act: " + link + " test " + state.url.split('?')[0]);
1987
- canactivate = true;
1988
- util.log("act: test value " + canactivate);
1989
- return;
1990
- }
1991
- });
1992
- if (canactivate) {
1993
- util.log("act: test sucess");
1994
- return true;
1995
- }
1996
- else {
1997
- util.log("act: test error");
1998
- this.router.navigate(['displayIndex']);
1999
- return false;
2000
- }
2001
- };
2002
- ActGuard.prototype.preHandle = function (state) {
2003
- return (state.url.includes('error') ||
2004
- state.url.includes('exception') ||
2005
- state.url.includes('displayIndex') ||
2006
- state.url === '' ||
2007
- state.url === null ||
2008
- state.url === '/' ||
2009
- state.url.includes('iframePage'));
2010
- };
2011
- ActGuard.prototype.getAllLinks = function (menu, links) {
2012
- var _this = this;
2013
- menu.forEach(function (sider) {
2014
- if (sider.link) {
2015
- links.push(sider.link);
2016
- }
2017
- if (sider.children && sider.children.length > 0) {
2018
- _this.getAllLinks(sider.children, links);
2019
- }
2020
- });
2021
- };
2022
- return ActGuard;
2023
- }());
2024
- 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" });
2025
- ActGuard.decorators = [
2026
- { type: i0.Injectable, args: [{
2027
- providedIn: 'root'
2028
- },] }
2029
- ];
2030
- ActGuard.ctorParameters = function () { return [
2031
- { type: util.YunzaiConfigService },
2032
- { type: i2$1.CacheService },
2033
- { type: PathToRegexpService },
2034
- { type: i4.Router }
2035
- ]; };
2036
-
2037
- // export * from './contact/contact.component';
2038
- // export * from './contact/contact.service';
2039
-
2040
- /**
2041
- * Generated bundle index. Do not edit.
2042
- */
2043
-
2044
- exports.ActGuard = ActGuard;
2045
- exports.BUSINESS_DEFAULT_CONFIG = BUSINESS_DEFAULT_CONFIG;
2046
- exports.PathToRegexpService = PathToRegexpService;
2047
- exports.STOMP_DEFAULT_CONFIG = STOMP_DEFAULT_CONFIG;
2048
- exports.YZ_APPINIT_PROVIDES = YZ_APPINIT_PROVIDES;
2049
- exports.YunzaiLayoutModule = YunzaiLayoutModule;
2050
- exports.YzAuthService = YzAuthService;
2051
- exports.YzDefaultInterceptor = YzDefaultInterceptor;
2052
- exports.YzHeaderApplicationComponent = YzHeaderApplicationComponent;
2053
- exports.YzHeaderClearStorageComponent = YzHeaderClearStorageComponent;
2054
- exports.YzHeaderFullScreenComponent = YzHeaderFullScreenComponent;
2055
- exports.YzHeaderI18NComponent = YzHeaderI18NComponent;
2056
- exports.YzHeaderNotifyComponent = YzHeaderNotifyComponent;
2057
- exports.YzHeaderThemBtnComponent = YzHeaderThemBtnComponent;
2058
- exports.YzHeaderUserComponent = YzHeaderUserComponent;
2059
- exports.YzI18NService = YzI18NService;
2060
- exports.YzLayoutBasicComponent = YzLayoutBasicComponent;
2061
- exports.YzStartupService = YzStartupService;
2062
- exports.YzStartupServiceFactory = YzStartupServiceFactory;
2063
- exports.YzStompService = YzStompService;
2064
- exports.generateAbility = generateAbility;
2065
- exports.mapYzSideToYelonMenu = mapYzSideToYelonMenu;
2066
- exports.mergeBisConfig = mergeBisConfig;
2067
- exports.mergeStompConfig = mergeStompConfig;
2068
- exports["ɵ0"] = ɵ0;
2069
- exports["ɵa"] = YzHeaderApplicationComponent;
2070
- exports["ɵb"] = YzHeaderNotifyComponent;
2071
- exports["ɵc"] = YzHeaderThemBtnComponent;
2072
- exports["ɵd"] = YzHeaderUserComponent;
2073
- exports["ɵe"] = YzHeaderFullScreenComponent;
2074
- exports["ɵf"] = YzHeaderClearStorageComponent;
2075
- exports["ɵg"] = YzHeaderI18NComponent;
2076
-
2077
- Object.defineProperty(exports, '__esModule', { value: true });
2078
-
2079
- }));
2080
- //# sourceMappingURL=layout.umd.js.map