@yelon/bis 12.0.12 → 12.0.16
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.
- package/bundles/bis.umd.js +1 -1
- package/bundles/layout.umd.js +377 -18
- package/bundles/layout.umd.js.map +1 -1
- package/bundles/shared.umd.js +7 -6
- package/bundles/shared.umd.js.map +1 -1
- package/esm2015/layout/act.guard.js +115 -0
- package/esm2015/layout/layout.module.js +3 -1
- package/esm2015/layout/path-to-regexp.service.js +237 -0
- package/esm2015/layout/public_api.js +5 -1
- package/esm2015/layout/yz.default.interceptor.js +10 -1
- package/esm2015/layout/yz.i18n.service.js +4 -6
- package/esm2015/shared/shared-yelon.module.js +3 -3
- package/esm2015/shared/shared-zorro.module.js +3 -1
- package/fesm2015/layout.js +361 -10
- package/fesm2015/layout.js.map +1 -1
- package/fesm2015/shared.js +3 -2
- package/fesm2015/shared.js.map +1 -1
- package/layout/act.guard.d.ts +20 -0
- package/layout/layout.metadata.json +1 -1
- package/layout/path-to-regexp.service.d.ts +23 -0
- package/layout/public_api.d.ts +2 -0
- package/layout/yz.i18n.service.d.ts +3 -3
- package/package.json +10 -10
- package/shared/shared-zorro.module.d.ts +2 -2
- package/shared/shared.metadata.json +1 -1
package/bundles/bis.umd.js
CHANGED
package/bundles/layout.umd.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license ng-yunzai(devcui@outlook.com) v12.0.
|
|
2
|
+
* @license ng-yunzai(devcui@outlook.com) v12.0.16
|
|
3
3
|
* (c) 2020 devcui https://github.com/hbyunzai/yelon/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
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('
|
|
8
|
-
typeof define === 'function' && define.amd ? define('@yelon/bis/layout', ['exports', '@angular/core', '@yelon/cache', '@yelon/theme', '@yelon/util', '@angular/cdk/platform', '@angular/common', '@angular/common/locales/en', '@angular/common/locales/zh', '@angular/common/locales/zh-Hant', 'date-fns/locale', 'ng-zorro-antd/i18n', '@yelon/util/
|
|
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["ng-zorro-antd/i18n"], global.
|
|
10
|
-
})(this, (function (exports, i0, i2$1, i1, util, i3, common, ngEn, ngZh, ngZhTw, locale,
|
|
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
11
|
|
|
12
12
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
13
|
|
|
@@ -36,9 +36,10 @@
|
|
|
36
36
|
var ngEn__default = /*#__PURE__*/_interopDefaultLegacy(ngEn);
|
|
37
37
|
var ngZh__default = /*#__PURE__*/_interopDefaultLegacy(ngZh);
|
|
38
38
|
var ngZhTw__default = /*#__PURE__*/_interopDefaultLegacy(ngZhTw);
|
|
39
|
+
var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
|
|
39
40
|
var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
|
|
40
|
-
var i4__namespace = /*#__PURE__*/_interopNamespace(i4);
|
|
41
41
|
var screenfull__namespace = /*#__PURE__*/_interopNamespace(screenfull);
|
|
42
|
+
var i4__namespace = /*#__PURE__*/_interopNamespace(i4);
|
|
42
43
|
var i3__namespace$1 = /*#__PURE__*/_interopNamespace(i3$1);
|
|
43
44
|
|
|
44
45
|
/*! *****************************************************************************
|
|
@@ -401,9 +402,7 @@
|
|
|
401
402
|
return { code: code, text: item.text, abbr: item.abbr };
|
|
402
403
|
});
|
|
403
404
|
var defaultLang = _this.getDefaultLang();
|
|
404
|
-
|
|
405
|
-
_this._defaultLang = defaultLang;
|
|
406
|
-
}
|
|
405
|
+
_this._defaultLang = _this._langs.findIndex(function (w) { return w.code === defaultLang; }) === -1 ? DEFAULT : defaultLang;
|
|
407
406
|
return _this;
|
|
408
407
|
}
|
|
409
408
|
YzI18NService.prototype.getDefaultLang = function () {
|
|
@@ -423,7 +422,7 @@
|
|
|
423
422
|
YzI18NService.prototype.use = function (lang, data) {
|
|
424
423
|
if (this._currentLang === lang)
|
|
425
424
|
return;
|
|
426
|
-
this._data = data;
|
|
425
|
+
this._data = this.flatData(data, []);
|
|
427
426
|
var item = LANGS[lang];
|
|
428
427
|
common.registerLocaleData(item.ng);
|
|
429
428
|
this.nzI18nService.setLocale(item.zorro);
|
|
@@ -437,7 +436,7 @@
|
|
|
437
436
|
};
|
|
438
437
|
return YzI18NService;
|
|
439
438
|
}(i1.YunzaiI18nBaseService));
|
|
440
|
-
YzI18NService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function YzI18NService_Factory() { return new YzI18NService(i0__namespace.ɵɵinject(i1__namespace._HttpClient), i0__namespace.ɵɵinject(i1__namespace.SettingsService), i0__namespace.ɵɵinject(i2__namespace.NzI18nService), i0__namespace.ɵɵinject(i1__namespace.YelonLocaleService), i0__namespace.ɵɵinject(i3__namespace.Platform), i0__namespace.ɵɵinject(
|
|
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" });
|
|
441
440
|
YzI18NService.decorators = [
|
|
442
441
|
{ type: i0.Injectable, args: [{ providedIn: 'root' },] }
|
|
443
442
|
];
|
|
@@ -447,7 +446,7 @@
|
|
|
447
446
|
{ type: i2.NzI18nService },
|
|
448
447
|
{ type: i1.YelonLocaleService },
|
|
449
448
|
{ type: i3.Platform },
|
|
450
|
-
{ type:
|
|
449
|
+
{ type: i1$1.YunzaiConfigService }
|
|
451
450
|
]; };
|
|
452
451
|
|
|
453
452
|
exports.TOPIC = void 0;
|
|
@@ -864,7 +863,7 @@
|
|
|
864
863
|
];
|
|
865
864
|
YzHeaderThemBtnComponent.ctorParameters = function () { return [
|
|
866
865
|
{ type: i0.Renderer2 },
|
|
867
|
-
{ type:
|
|
866
|
+
{ type: i1$1.YunzaiConfigService },
|
|
868
867
|
{ type: i3.Platform },
|
|
869
868
|
{ type: undefined, decorators: [{ type: i0.Inject, args: [common.DOCUMENT,] }] },
|
|
870
869
|
{ type: bidi.Directionality, decorators: [{ type: i0.Optional }] },
|
|
@@ -1100,7 +1099,7 @@
|
|
|
1100
1099
|
};
|
|
1101
1100
|
return YzStompService;
|
|
1102
1101
|
}());
|
|
1103
|
-
YzStompService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function YzStompService_Factory() { return new YzStompService(i0__namespace.ɵɵinject(
|
|
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" });
|
|
1104
1103
|
YzStompService.decorators = [
|
|
1105
1104
|
{ type: i0.Injectable, args: [{ providedIn: 'root' },] }
|
|
1106
1105
|
];
|
|
@@ -1151,6 +1150,7 @@
|
|
|
1151
1150
|
]; };
|
|
1152
1151
|
|
|
1153
1152
|
var COMPONENTS = [
|
|
1153
|
+
// ContactComponent,
|
|
1154
1154
|
YzLayoutBasicComponent,
|
|
1155
1155
|
YzHeaderApplicationComponent,
|
|
1156
1156
|
YzHeaderNotifyComponent,
|
|
@@ -1167,7 +1167,7 @@
|
|
|
1167
1167
|
}());
|
|
1168
1168
|
YunzaiLayoutModule.decorators = [
|
|
1169
1169
|
{ type: i0.NgModule, args: [{
|
|
1170
|
-
imports: [http.HttpClientModule, common.CommonModule, forms.FormsModule,
|
|
1170
|
+
imports: [http.HttpClientModule, common.CommonModule, forms.FormsModule, i4.RouterModule, forms.ReactiveFormsModule, shared.YzSharedModule],
|
|
1171
1171
|
providers: [
|
|
1172
1172
|
{
|
|
1173
1173
|
provide: themeBtn.YUNZAI_THEME_BTN_KEYS,
|
|
@@ -1187,7 +1187,7 @@
|
|
|
1187
1187
|
}
|
|
1188
1188
|
Object.defineProperty(YzAuthService.prototype, "csr", {
|
|
1189
1189
|
get: function () {
|
|
1190
|
-
return this.injector.get(
|
|
1190
|
+
return this.injector.get(i1$1.YunzaiConfigService);
|
|
1191
1191
|
},
|
|
1192
1192
|
enumerable: false,
|
|
1193
1193
|
configurable: true
|
|
@@ -1400,19 +1400,28 @@
|
|
|
1400
1400
|
});
|
|
1401
1401
|
Object.defineProperty(YzDefaultInterceptor.prototype, "config", {
|
|
1402
1402
|
get: function () {
|
|
1403
|
-
return mergeBisConfig(this.injector.get(
|
|
1403
|
+
return mergeBisConfig(this.injector.get(i1$1.YunzaiConfigService));
|
|
1404
1404
|
},
|
|
1405
1405
|
enumerable: false,
|
|
1406
1406
|
configurable: true
|
|
1407
1407
|
});
|
|
1408
1408
|
YzDefaultInterceptor.prototype.goTo = function (url) {
|
|
1409
1409
|
var _this = this;
|
|
1410
|
-
setTimeout(function () { return _this.injector.get(
|
|
1410
|
+
setTimeout(function () { return _this.injector.get(i4.Router).navigateByUrl(url); });
|
|
1411
1411
|
};
|
|
1412
1412
|
YzDefaultInterceptor.prototype.checkStatus = function (ev) {
|
|
1413
1413
|
if ((ev.status >= 200 && ev.status < 300) || ev.status === 401) {
|
|
1414
1414
|
return;
|
|
1415
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
|
+
}
|
|
1416
1425
|
if (ev instanceof http.HttpResponse && ev.body.errorMessage) {
|
|
1417
1426
|
this.notification.error("\u53D1\u751F\u4E86\u4E00\u4E9B\u9519\u8BEF ", ev.body.errorMessage);
|
|
1418
1427
|
return;
|
|
@@ -1680,11 +1689,361 @@
|
|
|
1680
1689
|
}
|
|
1681
1690
|
];
|
|
1682
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
|
+
|
|
1683
2040
|
/**
|
|
1684
2041
|
* Generated bundle index. Do not edit.
|
|
1685
2042
|
*/
|
|
1686
2043
|
|
|
2044
|
+
exports.ActGuard = ActGuard;
|
|
1687
2045
|
exports.BUSINESS_DEFAULT_CONFIG = BUSINESS_DEFAULT_CONFIG;
|
|
2046
|
+
exports.PathToRegexpService = PathToRegexpService;
|
|
1688
2047
|
exports.STOMP_DEFAULT_CONFIG = STOMP_DEFAULT_CONFIG;
|
|
1689
2048
|
exports.YZ_APPINIT_PROVIDES = YZ_APPINIT_PROVIDES;
|
|
1690
2049
|
exports.YunzaiLayoutModule = YunzaiLayoutModule;
|