dbweb-common
Version:
用`yarn add dbweb-common`安装,不要忘记修改`angular.json`里的 `architect\build\options\assets`,加上
1,086 lines (1,052 loc) • 1.24 MB
JavaScript
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('dbweb-core'), require('@angular/material'), require('@angular/cdk/drag-drop'), require('@angular/forms'), require('@angular/material/badge'), require('@angular/material/button'), require('@angular/material/core'), require('@angular/material/dialog'), require('@angular/material/divider'), require('@angular/material/icon'), require('@angular/material/menu'), require('@angular/material/sidenav'), require('@angular/material/tabs'), require('@angular/material/toolbar'), require('@angular/material/tree'), require('@angular/platform-browser'), require('@angular/platform-browser/animations'), require('@angular/router'), require('ngx-clipboard'), require('@angular/animations'), require('rxjs/operators'), require('rxjs'), require('@angular/cdk/tree'), require('@angular/material/input'), require('@angular/material/form-field'), require('@angular/common/locales/zh-Hans'), require('pinyin'), require('ng2-ace-editor'), require('uuid'), require('ace-builds'), require('@angular/common/http'), require('@angular/cdk/overlay'), require('ng5-slider'), require('@angular/material/checkbox'), require('@angular/material/expansion'), require('@angular/material/progress-bar'), require('@angular/material/select'), require('@angular/material/stepper'), require('@angular/material/table'), require('angular-calendar'), require('angular-calendar/date-adapters/date-fns'), require('@angular/material/card'), require('@angular/material/chips'), require('@angular/material/grid-list'), require('@angular/material/tooltip'), require('@angular/cdk/collections'), require('@angular/material/sort'), require('@angular/material/radio'), require('@angular/material/snack-bar'), require('ts-md5')) :
typeof define === 'function' && define.amd ? define('dbweb-common', ['exports', '@angular/common', '@angular/core', 'dbweb-core', '@angular/material', '@angular/cdk/drag-drop', '@angular/forms', '@angular/material/badge', '@angular/material/button', '@angular/material/core', '@angular/material/dialog', '@angular/material/divider', '@angular/material/icon', '@angular/material/menu', '@angular/material/sidenav', '@angular/material/tabs', '@angular/material/toolbar', '@angular/material/tree', '@angular/platform-browser', '@angular/platform-browser/animations', '@angular/router', 'ngx-clipboard', '@angular/animations', 'rxjs/operators', 'rxjs', '@angular/cdk/tree', '@angular/material/input', '@angular/material/form-field', '@angular/common/locales/zh-Hans', 'pinyin', 'ng2-ace-editor', 'uuid', 'ace-builds', '@angular/common/http', '@angular/cdk/overlay', 'ng5-slider', '@angular/material/checkbox', '@angular/material/expansion', '@angular/material/progress-bar', '@angular/material/select', '@angular/material/stepper', '@angular/material/table', 'angular-calendar', 'angular-calendar/date-adapters/date-fns', '@angular/material/card', '@angular/material/chips', '@angular/material/grid-list', '@angular/material/tooltip', '@angular/cdk/collections', '@angular/material/sort', '@angular/material/radio', '@angular/material/snack-bar', 'ts-md5'], factory) :
(global = global || self, factory(global['dbweb-common'] = {}, global.ng.common, global.ng.core, global['dbweb-core'], global.ng.material, global.ng.cdk['drag-drop'], global.ng.forms, global.ng.material.badge, global.ng.material.button, global.ng.material.core, global.ng.material.dialog, global.ng.material.divider, global.ng.material.icon, global.ng.material.menu, global.ng.material.sidenav, global.ng.material.tabs, global.ng.material.toolbar, global.ng.material.tree, global.ng.platformBrowser, global.ng.platformBrowser.animations, global.ng.router, global.ngxClipboard, global.ng.animations, global.rxjs.operators, global.rxjs, global.ng.cdk.tree, global.ng.material.input, global.ng.material['form-field'], global.ng.common.locales['zh-Hans'], global.pinyin_, global.ng2AceEditor, global.uuid, global.ace, global.ng.common.http, global.ng.cdk.overlay, global.ng5Slider, global.ng.material.checkbox, global.ng.material.expansion, global.ng.material['progress-bar'], global.ng.material.select, global.ng.material.stepper, global.ng.material.table, global.angularCalendar, global.dateFns, global.ng.material.card, global.ng.material.chips, global.ng.material['grid-list'], global.ng.material.tooltip, global.ng.cdk.collections, global.ng.material.sort, global.ng.material.radio, global.ng.material['snack-bar'], global['ts-md5']));
}(this, function (exports, common, core, dbwebCore, material, dragDrop, forms, badge, button, core$1, dialog, divider, icon, menu, sidenav, tabs, toolbar, tree, platformBrowser, animations, router, ngxClipboard, animations$1, operators, rxjs, tree$1, input, formField, localeZh, pinyin_, ng2AceEditor, uuid, ace, http, overlay, ng5Slider, checkbox, expansion, progressBar, select, stepper, table, angularCalendar, dateFns, card, chips, gridList, tooltip, collections, sort, radio, snackBar, tsMd5) { 'use strict';
localeZh = localeZh && localeZh.hasOwnProperty('default') ? localeZh['default'] : localeZh;
var pinyin___default = 'default' in pinyin_ ? pinyin_['default'] : pinyin_;
ace = ace && ace.hasOwnProperty('default') ? ace['default'] : ace;
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/* global Reflect, Promise */
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
function __extends(d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
var __assign = function() {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
function __rest(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
}
function __decorate(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
}
function __param(paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
}
function __metadata(metadataKey, metadataValue) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
}
function __awaiter(thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
function __generator(thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
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) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
}
function __exportStar(m, exports) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
function __values(o) {
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
if (m) return m.call(o);
return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
}
function __read(o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
}
function __spread() {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(__read(arguments[i]));
return ar;
}
function __spreadArrays() {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
function __await(v) {
return this instanceof __await ? (this.v = v, this) : new __await(v);
}
function __asyncGenerator(thisArg, _arguments, generator) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var g = generator.apply(thisArg, _arguments || []), i, q = [];
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
}
function __asyncDelegator(o) {
var i, p;
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
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; }
}
function __asyncValues(o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator], i;
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);
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); }); }; }
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
}
function __makeTemplateObject(cooked, raw) {
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
return cooked;
};
function __importStar(mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result.default = mod;
return result;
}
function __importDefault(mod) {
return (mod && mod.__esModule) ? mod : { default: mod };
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var ConfirmDialogComponent = /** @class */ (function () {
function ConfirmDialogComponent(dialogRef, data) {
this.dialogRef = dialogRef;
this.data = data;
this.hostClass = true;
}
/**
* @return {?}
*/
ConfirmDialogComponent.prototype.onNoClick = /**
* @return {?}
*/
function () {
this.dialogRef.close();
};
/**
* @return {?}
*/
ConfirmDialogComponent.prototype.ngOnInit = /**
* @return {?}
*/
function () {
this.removeView.nativeElement.parentElement.parentElement.style = 'padding:0px';
};
ConfirmDialogComponent.decorators = [
{ type: core.Component, args: [{
selector: 'common-confirm-dialog',
template: "<div #removeView class=\"\u5220\u9664\">\r\n\t<div class=\"tit\">\r\n\t\t\t<b >{{ data }}</b>\r\n\t</div>\r\n\t<div class=\"\u529F\u80FD\u6309\u94AE\">\r\n\t\t<button class=\"false-icon\" mat-button [mat-dialog-close]=\"false\">\u53D6\u6D88</button>\r\n\t\t<button class=\"true-icon\" color=\"primary\" mat-button [mat-dialog-close]=\"true\">\u786E\u5B9A</button>\r\n\t</div>\r\n</div>\r\n",
styles: ["@charset \"UTF-8\";.\u5220\u9664{position:relative;display:flex;justify-content:space-between;flex-direction:column;width:100%;height:100%;box-sizing:border-box;padding:24px 24px 16px}.\u5220\u9664 b{font-size:20px}.tit{display:flex;align-items:center;box-sizing:border-box;width:100%;height:104px}.\u529F\u80FD\u6309\u94AE{width:100%;box-sizing:border-box;text-align:right}.\u529F\u80FD\u6309\u94AE .mat-button{width:64px;height:32px}.\u529F\u80FD\u6309\u94AE .true-icon{margin-left:8px}"]
}] }
];
/** @nocollapse */
ConfirmDialogComponent.ctorParameters = function () { return [
{ type: material.MatDialogRef },
{ type: String, decorators: [{ type: core.Inject, args: [material.MAT_DIALOG_DATA,] }] }
]; };
ConfirmDialogComponent.propDecorators = {
hostClass: [{ type: core.HostBinding, args: ['class.confirm-dialog-theme',] }],
removeView: [{ type: core.ViewChild, args: ['removeView', { static: true },] }]
};
return ConfirmDialogComponent;
}());
if (false) {
/** @type {?} */
ConfirmDialogComponent.prototype.hostClass;
/** @type {?} */
ConfirmDialogComponent.prototype.removeView;
/** @type {?} */
ConfirmDialogComponent.prototype.dialogRef;
/** @type {?} */
ConfirmDialogComponent.prototype.data;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var ConfirmDialogModule = /** @class */ (function () {
function ConfirmDialogModule() {
}
ConfirmDialogModule.decorators = [
{ type: core.NgModule, args: [{
declarations: [ConfirmDialogComponent],
imports: [common.CommonModule, material.MatDialogModule, material.MatButtonModule],
exports: [ConfirmDialogComponent],
entryComponents: [ConfirmDialogComponent]
},] }
];
return ConfirmDialogModule;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
var CTRL_RECORDVIEW = 'recordview';
/** @type {?} */
var CTRL_INDEX = 'index';
/** @type {?} */
var CTRL_EXPORT = 'export';
/** @type {?} */
var CTRL_LOGIN = 'login';
/** @type {?} */
var CTRL_ELEMENT = 'element';
/** @type {?} */
var CTRL_VERSION = 'version';
/** @type {?} */
var CTRL_TASK = 'task';
/** @type {?} */
var CTRL_IMPORT = 'import';
/** @type {?} */
var CTRL_USERINFO = 'userinfo';
/** @type {?} */
var CTRL_UPDATE = 'update';
/** @type {?} */
var CTRL_ROLE = 'role';
/** @type {?} */
var CTRL_USER = 'user';
/** @type {?} */
var CTRL_NOTICE = 'notice';
/** @type {?} */
var CTRL_REMOVESEL = 'removesel';
/** @type {?} */
var CTRL_DUMP_INSTITUTION = 'dumpInstitution';
/** @type {?} */
var portraitDefault = '/front/assets/userinfo/portrait_default.png';
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @param {?} e
* @return {?}
*/
function label(e) {
if (e.Label) {
return dbwebCore.clearText(e.Label);
}
return dbwebCore.clearText(e.Name);
}
var HomeTabfunctionService = /** @class */ (function () {
function HomeTabfunctionService(eles) {
this.eles = eles;
}
Object.defineProperty(HomeTabfunctionService.prototype, "category", {
get: /**
* @return {?}
*/
function () {
return this.eles.currentElementListen.pipe(operators.map((/**
* @param {?} v
* @return {?}
*/
function (v) { return (v ? dbwebCore.clearCategory(v.element.Category).replace('/', '>') + '>' + label(v.element) : null); })));
},
enumerable: true,
configurable: true
});
HomeTabfunctionService.decorators = [
{ type: core.Injectable, args: [{
providedIn: 'root'
},] }
];
/** @nocollapse */
HomeTabfunctionService.ctorParameters = function () { return [
{ type: dbwebCore.RouteElementService }
]; };
/** @nocollapse */ HomeTabfunctionService.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function HomeTabfunctionService_Factory() { return new HomeTabfunctionService(core.ɵɵinject(dbwebCore.RouteElementService)); }, token: HomeTabfunctionService, providedIn: "root" });
return HomeTabfunctionService;
}());
if (false) {
/** @type {?} */
HomeTabfunctionService.prototype.eles;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var Tab = /** @class */ (function () {
function Tab(state) {
var e_1, _a;
try {
for (var _b = __values(Object.keys(state)), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
this[key] = state[key];
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
this.titleObservable = new rxjs.BehaviorSubject(state.title);
}
/**
* @return {?}
*/
Tab.prototype.data = /**
* @return {?}
*/
function () {
return {
url: this.url,
key: this.key,
title: this.title
};
};
return Tab;
}());
if (false) {
/** @type {?} */
Tab.prototype.url;
/** @type {?} */
Tab.prototype.key;
/** @type {?} */
Tab.prototype.title;
/** @type {?} */
Tab.prototype.titleObservable;
}
var TabsService = /** @class */ (function () {
function TabsService(router, eles) {
this.router = router;
this.eles = eles;
this.tabs = [];
}
// 激活一个tab,如果不存在,则新增并激活
// 激活一个tab,如果不存在,则新增并激活
/**
* @param {?} data
* @return {?}
*/
TabsService.prototype.activeTab =
// 激活一个tab,如果不存在,则新增并激活
/**
* @param {?} data
* @return {?}
*/
function (data) {
/** @type {?} */
var find = this.tabs.findIndex((/**
* @param {?} v
* @return {?}
*/
function (v) { return v.key === data.key; }));
if (find === -1) {
this.tabs.push(new Tab(data));
this._activeIndex = this.tabs.length - 1;
}
else {
this._activeIndex = find;
// 同时需要更新url和title
this.tabs[this._activeIndex].url = data.url;
this.tabs[this._activeIndex].title = data.title;
}
};
// 删除指定序号的tab,并切换激活的tab,如果只有一个tab,则不能被删除
// 返回true指示激活页已经切换
// 删除指定序号的tab,并切换激活的tab,如果只有一个tab,则不能被删除
// 返回true指示激活页已经切换
/**
* @param {?} index
* @return {?}
*/
TabsService.prototype.removeTab =
// 删除指定序号的tab,并切换激活的tab,如果只有一个tab,则不能被删除
// 返回true指示激活页已经切换
/**
* @param {?} index
* @return {?}
*/
function (index) {
if (this.tabs.length === 1) {
return false;
}
/** @type {?} */
var deleteURL = this.tabs[index].url.toString();
// 如果是关闭当前页面,则会引起路由变化,所以需要在导航结束事件中删除,因为导航过程中还会进行保存
if (index === this._activeIndex) {
/** @type {?} */
var sub_1 = this.router.events.subscribe((/**
* @param {?} v
* @return {?}
*/
function (v) {
if (v instanceof router.NavigationEnd) {
dbwebCore.SimpleReuseStrategy.deleteRouteSnapshot(deleteURL);
sub_1.unsubscribe();
}
}));
}
else {
dbwebCore.SimpleReuseStrategy.deleteRouteSnapshot(deleteURL);
}
this.tabs.splice(index, 1);
if (this._activeIndex === index) {
this._activeIndex = Math.min(this.tabs.length - 1, index);
return true;
}
if (this._activeIndex > index) {
this._activeIndex--;
}
return false;
};
// 删除所有的页,一般是logout
// 删除所有的页,一般是logout
/**
* @return {?}
*/
TabsService.prototype.clear =
// 删除所有的页,一般是logout
/**
* @return {?}
*/
function () {
this.tabs.splice(0);
this._activeIndex = undefined;
dbwebCore.SimpleReuseStrategy.clearRouteSnapshot();
};
// 关闭当前页,并自动导航到新的页
// 关闭当前页,并自动导航到新的页
/**
* @return {?}
*/
TabsService.prototype.close =
// 关闭当前页,并自动导航到新的页
/**
* @return {?}
*/
function () {
var _this = this;
if (this.activeIndex >= 0) {
/** @type {?} */
var idx_1 = this.activeIndex;
if (this.tabs.length === 1) {
this.router.navigateByUrl(this.eles.frontElementURL(this.eles.indexElementName)).then((/**
* @return {?}
*/
function () {
_this.removeTab(idx_1);
}));
}
if (this.removeTab(idx_1)) {
this.router.navigateByUrl(this.active.url, {
state: this.active.data()
});
}
}
};
Object.defineProperty(TabsService.prototype, "active", {
get: /**
* @return {?}
*/
function () {
if (this._activeIndex >= 0) {
return this.tabs[this._activeIndex];
}
return undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(TabsService.prototype, "activeIndex", {
get: /**
* @return {?}
*/
function () {
return this._activeIndex;
},
set: /**
* @param {?} val
* @return {?}
*/
function (val) {
this._activeIndex = val;
},
enumerable: true,
configurable: true
});
TabsService.decorators = [
{ type: core.Injectable, args: [{
providedIn: 'root'
},] }
];
/** @nocollapse */
TabsService.ctorParameters = function () { return [
{ type: router.Router },
{ type: dbwebCore.ElementsService }
]; };
/** @nocollapse */ TabsService.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function TabsService_Factory() { return new TabsService(core.ɵɵinject(router.Router), core.ɵɵinject(dbwebCore.ElementsService)); }, token: TabsService, providedIn: "root" });
return TabsService;
}());
if (false) {
/** @type {?} */
TabsService.prototype.tabs;
/** @type {?} */
TabsService.prototype._activeIndex;
/**
* @type {?}
* @private
*/
TabsService.prototype.router;
/**
* @type {?}
* @private
*/
TabsService.prototype.eles;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var HomeComponent = /** @class */ (function () {
function HomeComponent(routerEle, eles, tabFun, tabs) {
var _this = this;
this.routerEle = routerEle;
this.eles = eles;
this.tabFun = tabFun;
this.tabs = tabs;
this.hostClass = true;
this.subs = [];
this.copystate = false;
this.subs.push(this.routerEle.currentElementListen
.pipe(operators.filter((/**
* @param {?} ele
* @return {?}
*/
function (ele) { return ele && ele.element && ele.element.Controller !== CTRL_LOGIN; })))
.subscribe((/**
* @param {?} ele
* @return {?}
*/
function (ele) {
/** @type {?} */
var state = (/** @type {?} */ (ele.state));
if (!state) {
/** @type {?} */
var key = ele.url;
/** @type {?} */
var arr = key.split('/');
// 功能类的,需要去除子路由作为key,防止出现多余的tab
if (!ele.element.Bill && arr.length > 5) {
key = arr.slice(0, 5).join('/');
// 需要处理query
/** @type {?} */
var queryArr = arr[arr.length - 1].split('?');
if (queryArr.length > 1) {
key += '?' + queryArr[1];
}
}
state = {
url: ele.urlObj,
key: key,
title: ele.element.title()
};
}
_this.tabs.activeTab(state);
})));
this.category = this.tabFun.category;
}
/**
* @return {?}
*/
HomeComponent.prototype.ngOnInit = /**
* @return {?}
*/
function () { };
/**
* @return {?}
*/
HomeComponent.prototype.ngOnDestroy = /**
* @return {?}
*/
function () {
this.subs.forEach((/**
* @param {?} v
* @return {?}
*/
function (v) { return v.unsubscribe(); }));
};
HomeComponent.decorators = [
{ type: core.Component, args: [{
selector: 'common-home',
template: "<div class=\"home-container-nav\">\r\n\t<common-home-nav></common-home-nav>\r\n</div>\r\n<div class=\"home-container-content\">\r\n\t<div class=\"tab-all\">\r\n\t\t<app-router-tab #tabNav class=\"tabNav\">\r\n\t\t\t<app-router-tab-item\r\n\t\t\t\t*ngFor=\"let tab of tabs.tabs; let index = index\"\r\n\t\t\t\t[routerLink]=\"tab.url\" class=\"tabA\"\r\n\t\t\t\tlabel=\"{{ tab.titleObservable | async }}\">\r\n\t\t\t</app-router-tab-item>\r\n\t\t</app-router-tab>\r\n\t\t<div class=\"tab-nav-right\">\r\n\t\t\t<button mat-icon-button ngxClipboard [cbContent]=\"category | async\"\r\n\t\t\t\t(mousemove)=\"copystate = true\" (mouseout)=\"copystate = false\">\r\n\t\t\t\t<mat-icon class=\"\u590D\u5236\u56FE\u6807\" [class.\u590D\u5236\u60AC\u6D6E]=\"copystate\"\r\n\t\t\t\t\taria-label=\"\u590D\u5236\u7C7B\u522B\" svgIcon=\"content_copy\"></mat-icon>\r\n\t\t\t</button>\r\n\t\t\t<button mat-stroked-button class=\"\u8BED\u8A00\">Eng</button>\r\n\t\t</div>\r\n\t\t<div class=\"\u590D\u5236\u8DEF\u5F84\" [class.\u590D\u5236\u60AC\u6D6E\u72B6\u6001]=\"!copystate\">\r\n\t\t\t<span class=\"\u7C7B\u522B\">{{ category | async }}</span>\r\n\t\t</div>\r\n\t</div>\r\n\r\n\t<div class=\"content-home\" [@routerTransition]=\"tabs.activeIndex\">\r\n\t\t<core-router-outlet #outlet=\"coreRouterOutlet\"></core-router-outlet>\r\n\t</div>\r\n</div>",
animations: [
animations$1.trigger('routerTransition', [
animations$1.transition(':enter, * => -1', []),
animations$1.transition(':increment', [
animations$1.style({ position: 'relative', overflow: 'hidden' }),
animations$1.query(':enter, :leave', animations$1.style({ position: 'absolute', width: '100%', height: '100%' }), {
optional: true
}),
animations$1.group([
animations$1.query(':enter', [
animations$1.style({ transform: 'translateX(-100%)' }),
animations$1.animate('0.5s ease-in-out', animations$1.style({ transform: 'translateX(0%)' }))
], { optional: true }),
animations$1.query(':leave', [
animations$1.style({ transform: 'translateX(0%)' }),
animations$1.animate('0.5s ease-in-out', animations$1.style({ transform: 'translateX(100%)' }))
], { optional: true })
])
]),
animations$1.transition(':decrement', [
animations$1.style({ position: 'relative', overflow: 'hidden' }),
animations$1.query(':enter, :leave', animations$1.style({ position: 'absolute', width: '100%', height: '100%' }), {
optional: true
}),
animations$1.group([
animations$1.query(':enter', [
animations$1.style({ transform: 'translateX(100%)' }),
animations$1.animate('0.5s ease-in-out', animations$1.style({ transform: 'translateX(0%)' }))
], { optional: true }),
animations$1.query(':leave', [
animations$1.style({ transform: 'translateX(0%)' }),
animations$1.animate('0.5s ease-in-out', animations$1.style({ transform: 'translateX(-100%)' }))
], { optional: true })
])
])
])
],
styles: ["@charset \"UTF-8\";:host{width:100%;height:100%;padding:0;margin:0;display:flex;align-items:stretch}.home-container-nav{flex-shrink:0;z-index:10}.home-container-content{height:100%;display:flex;flex-direction:column;width:10%;flex-grow:1;flex-shrink:1}.home-container-content .tab-all{display:flex;height:30px}.home-container-content .tab-all .tabNav{width:10%;flex-grow:1;flex-shrink:1}.home-container-content .tab-all .tab-nav-right{height:30px;line-height:30px;font-size:12px;position:relative;display:block}.home-container-content .tab-all .tab-nav-right button{width:24px;height:24px;line-height:24px}.home-container-content .tab-all .tab-nav-right button .\u590D\u5236\u56FE\u6807{width:16px;height:16px;margin-bottom:6px}.home-container-content .tab-all .tab-nav-right .\u8BED\u8A00{font-size:12px;height:24px;width:64px;margin:0 8px;padding:0;line-height:20px;text-align:center}.home-container-content .\u590D\u5236\u8DEF\u5F84{height:32px;position:absolute;right:0;top:30px;font-size:12px;color:#fff;line-height:32px;border-radius:4px;padding:0 8px;z-index:9;text-align:center;background-color:rgba(0,0,0,.6);box-shadow:0 4px 8px 0 rgba(0,0,0,.14)}.home-container-content .\u590D\u5236\u60AC\u6D6E\u72B6\u6001{display:none}.home-container-content .content-home{width:100%;height:10%;box-sizing:border-box;flex-grow:1;flex-shrink:1}"]
}] }
];
/** @nocollapse */
HomeComponent.ctorParameters = function () { return [
{ type: dbwebCore.RouteElementService },
{ type: dbwebCore.RouteElementService },
{ type: HomeTabfunctionService },
{ type: TabsService }
]; };
HomeComponent.propDecorators = {
hostClass: [{ type: core.HostBinding, args: ['class.c-home',] }],
tabNavs: [{ type: core.ViewChild, args: ['tabNav', { static: true },] }]
};
return HomeComponent;
}());
if (false) {
/** @type {?} */
HomeComponent.prototype.hostClass;
/** @type {?} */
HomeComponent.prototype.subs;
/** @type {?} */
HomeComponent.prototype.tabNavs;
/** @type {?} */
HomeComponent.prototype.category;
/** @type {?} */
HomeComponent.prototype.copystate;
/**
* @type {?}
* @private
*/
HomeComponent.prototype.routerEle;
/** @type {?} */
HomeComponent.prototype.eles;
/**
* @type {?}
* @private
*/
HomeComponent.prototype.tabFun;
/** @type {?} */
HomeComponent.prototype.tabs;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @param {?} val
* @return {?}
*/
function convertBoolean(val) {
return val === 'true';
}
var MainNavService = /** @class */ (function () {
function MainNavService() {
this._navMin = new rxjs.BehaviorSubject(convertBoolean(localStorage.getItem('main-nav-min')));
this.navMin = this._navMin.pipe(operators.tap((/**
* @param {?} v
* @return {?}
*/
function (v) {
localStorage.setItem('main-nav-min', v ? 'true' : 'false');
})));
}
/**
* @param {?} val
* @return {?}
*/
MainNavService.prototype.setNavMin = /**
* @param {?} val
* @return {?}
*/
function (val) {
this._navMin.next(val);
};
/**
* @return {?}
*/
MainNavService.prototype.getCurrent = /**
* @return {?}
*/
function () {
return this._navMin.getValue();
};
MainNavService.decorators = [
{ type: core.Injectable, args: [{
providedIn: 'root'
},] }
];
/** @nocollapse */ MainNavService.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function MainNavService_Factory() { return new MainNavService(); }, token: MainNavService, providedIn: "root" });
return MainNavService;
}());
if (false) {
/**
* @type {?}
* @private
*/
MainNavService.prototype._navMin;
/** @type {?} */
MainNavService.prototype.navMin;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var NavtreeService = /** @class */ (function () {
// get data(): NavItem[] {
// console.log(this.dataChange.value);
// return this.dataChange.value;
// }
function NavtreeService(eles, project) {
this.eles = eles;
this.project = project;
this.root = { children: [] };
// dataChange = new BehaviorSubject<NavItem[]>([]);
this.icons = ['security', 'dns', 'gamepad']; // 图标
// this.initialize();
this.init();
for (var i = 0; i < Math.min(this.root.children.length, this.icons.length); i++) {
this.root.children[i].iconName = this.icons[i];
}
}
/**
* @return {?}
*/
NavtreeService.prototype.init = /**
* @return {?}
*/
function () {
var _this = this;
// 设置项目图标
if (this.project.categoryIcons && this.project.categoryIcons.length > 0) {
this.icons = this.project.categoryIcons;
}
// 如果已经初始化过,则跳出
if (this.root.children.length > 0) {
return;
}
this.eles.getElesAsArray().forEach((/**
* @param {?} element
* @return {?}
*/
function (element) {
// 后端api或者子级工作元素的,不需要加入到node列表中
if (!element.NotMenu) {
_this.addElement(element, _this.root, element.Category.split('/'), 0, null, element.Icon);
}
}));
// console.log(this.root.children[0].iconName);
// console.log(this.root);
};
/**
* @private
* @param {?} str
* @return {?}
*/
NavtreeService.prototype.clearText = /**
* @private
* @param {?} str
* @return {?}
*/
function (str) {
if (str.search(/[0-9]{2}\./) > -1) {
return str.substr(3);
}
return str;
};
// 采用插入排序方法逐条插入
// 采用插入排序方法逐条插入
/**
* @private
* @param {?} ele
* @param {?} parent
* @param {?} paths
* @param {?} level
* @param {?} parents
* @param {?} iconName
* @return {?}
*/
NavtreeService.prototype.addElement =
// 采用插入排序方法逐条插入
/**
* @private
* @param {?} ele
* @param {?} parent
* @param {?} paths
* @param {?} level
* @param {?} parents
* @param {?} iconName
* @return {?}
*/
function (ele, parent, paths, level, parents, iconName) {
if (paths.length === 0) {
// 实际插入的菜单项,也需要排序
/** @type {?} */
var idx = parent.children.findIndex((/**
* @param {?} item
* @return {?}
*/
function (item) { return (ele.Label || ele.Name).localeCompare(item.fullTitle || item.name) <= 0; }));
/** @type {?} */
var node = {
name: ele.Name,
fullTitle: ele.Label,
title: this.clearText(ele.Label || ele.Name),
url: this.eles.frontElementURL(ele.Name, decodeURI(ele.URL)),
level: level,
parent: parents,
iconName: iconName
};
if (idx === -1) {
parent.children.push(node);
}
else {
parent.children.splice(idx, 0, node);
}
return;
}
/** @type {?} */
var findIdx = parent.children.findIndex((/**
* @param {?} item
* @return {?}
*/
function (item) { return paths[0].localeCompare(item.name) <= 0; }));
/** @type {?} */
var categoryNode;
if (findIdx !== -1 && parent.children[findIdx].name === paths[0]) {
categoryNode = parent.children[findIdx];
}
else {
categoryNode = {
name: paths[0],
fullTitle: paths[0],
title: this.clearText(paths[0]),
level: level,
parent: parents,
iconName: iconName,
children: []
};
// 如果找不到,则说明比里面任何一个都大,则是追加到最后一个
if (findIdx === -1) {
parent.children.push(categoryNode);
}
else {
parent.children.splice(findIdx, 0, categoryNode);
}
}
this.addElement(ele, categoryNode, paths.slice(1), level + 1, categoryNode, iconName);
};
NavtreeService.decorators = [
{ type: core.Injectable }
];
/** @nocollapse */
NavtreeService.ctorParameters = function () { return [
{ type: dbwebCore.ElementsService },
{ type: dbwebCore.ProjectService }
]; };
return NavtreeService;
}());
if (false) {
/** @type {?} */
NavtreeService.prototype.root;
/** @type {?} */
NavtreeService.prototype.icons;
/**
* @type {?}
* @private
*/
NavtreeService.prototype.eles;
/**
* @type {?}
* @private
*/
NavtreeService.prototype.project;
}
var NavHome = /** @class */ (function () {
function NavHome(current, database, prj) {
this.current = current;
this.database = database;
this.prj = prj;
this.chatMessages = [];
this.unread = null; // 未读信息数
// 未读信息数
this.openNodeCurrent = [];
this.activeNode = [];
this.subs = [];
}
/**
* @param {?} node
* @return {?}
*/
NavHome.prototype.recursionFun = /**
* @param {?} node
* @return {?}
*/
function (node) {
if (node.level <= 0) {
return this.openNodeCurrent.push(node);
}
if (node.level >= 1) {
this.openNodeCurrent.push(node);
this.recursionFun(node.parent);
}
};
/**
* @param {?} node
* @return {?}
*/
NavHome.prototype.recursionFuns = /**
* @param {?} node
* @return {?}
*/
function (node) {
if (node.level <= 0) {
return this.activeNode.push(node);
}
if (node.level >= 1) {
this.activeNode.push(node);
this.recursionFuns(node.parent);
}
};
/**
* @param {?} node
* @return {?}
*/
NavHome.prototype.gradually = /**
* @param {?} node
* @return {?}
*/
function (node) {
if (this.activeNode.length !== 0) {
this.activeNode.splice(0, this.activeNode.length);
}
this.recursionFuns(node);
};
/**
* @param {?} node
* @return {?}
*/
NavHome.prototype.openNode = /**
* @param {?} node
* @return {?}
*/
function (node) {
/** @type {?} */
var openboolean = this.openNodeCurrent.includes(node);
if (this.openNodeCurrent.length !== 0) {
this.openNodeCurrent.splice(0, this.openNodeCurrent.length);
}
if (openboolean) {
if (node.level >= 1) {
this.recursionFun(node.parent);
}
if (node.level === 0) {
this.recursionFun(this.database.root);
}
}
else {
this.recursionFun(node);
}
};
/**
* @return {?}
*/
NavHome.prototype.messages = /**
* @return {?}