@lxlib/theme
Version:
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.1.1.
1,824 lines (1,809 loc) • 140 kB
JavaScript
import { InjectionToken, Injectable, ɵɵdefineInjectable, Optional, Inject, ɵɵinject, Injector, INJECTOR, SkipSelf, NgModule, Pipe, Version } from '@angular/core';
import { __values, __assign, __spread, __extends } from 'tslib';
import { ACLService } from '@lxlib/acl';
import { BehaviorSubject, Subject, Observable, throwError, of } from 'rxjs';
import { filter, share, tap, catchError, switchMap } from 'rxjs/operators';
import { DOCUMENT, CurrencyPipe, CommonModule } from '@angular/common';
import { Title, DomSanitizer } from '@angular/platform-browser';
import { ActivatedRoute, Router, RouterModule } from '@angular/router';
import { deepMerge } from '@lxlib/util';
import { NzModalService } from 'ng-zorro-antd/modal';
import { NzDrawerService } from 'ng-zorro-antd/drawer';
import { HttpParams, HttpClient } from '@angular/common/http';
import format from 'date-fns/format';
import formatDistanceToNow from 'date-fns/formatDistanceToNow';
import parse from 'date-fns/parse';
import { NzI18nService, NzI18nModule } from 'ng-zorro-antd/i18n';
import { OverlayModule } from '@angular/cdk/overlay';
import { BellOutline, DeleteOutline, PlusOutline, InboxOutline } from '@ant-design/icons-angular/icons';
import { NzIconService } from 'ng-zorro-antd/icon';
/**
* @fileoverview added by tsickle
* Generated from: src/win_tokens.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @return {?}
*/
function WINDOW_FACTORY() {
return window;
}
/** @type {?} */
var WINDOW = new InjectionToken('Window', {
providedIn: 'root',
factory: WINDOW_FACTORY,
});
/**
* @fileoverview added by tsickle
* Generated from: src/services/preloader/preloader.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @return {?}
*/
function preloaderFinished() {
/** @type {?} */
var body = (/** @type {?} */ (document.querySelector('body')));
/** @type {?} */
var preloader = (/** @type {?} */ (document.querySelector('.preloader')));
body.style.overflow = 'hidden';
/**
* @return {?}
*/
function remove() {
// preloader value null when running --hmr
if (!preloader)
return;
preloader.addEventListener('transitionend', (/**
* @return {?}
*/
function () {
preloader.className = 'preloader-hidden';
}));
preloader.className += ' preloader-hidden-add preloader-hidden-add-active';
}
((/** @type {?} */ (window))).appBootstrap = (/**
* @return {?}
*/
function () {
setTimeout((/**
* @return {?}
*/
function () {
remove();
body.style.overflow = '';
}), 100);
});
}
/**
* @fileoverview added by tsickle
* Generated from: src/services/menu/interface.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @record
*/
function MenuIcon() { }
if (false) {
/**
* Type for icon
* @type {?}
*/
MenuIcon.prototype.type;
/**
* Value for the icon, can be set Class Name, nz-icon of `nzType`, image
* @type {?|undefined}
*/
MenuIcon.prototype.value;
/**
* Type of the ant design icon, default: `outline`
* @type {?|undefined}
*/
MenuIcon.prototype.theme;
/**
* Rotate icon with animation, default: `false`
* @type {?|undefined}
*/
MenuIcon.prototype.spin;
/**
* Only support the two-tone icon. Specific the primary color
* @type {?|undefined}
*/
MenuIcon.prototype.twoToneColor;
/**
* Type of the icon from iconfont
* @type {?|undefined}
*/
MenuIcon.prototype.iconfont;
}
/**
* @record
*/
function Menu() { }
if (false) {
/**
* Text of menu item, can be choose one of `text` or `i18n` (Support HTML)
* @type {?|undefined}
*/
Menu.prototype.text;
/**
* I18n key of menu item, can be choose one of `text` or `i18n` (Support HTML)
* @type {?|undefined}
*/
Menu.prototype.i18n;
/**
* Whether to display the group name, default: `true`
* @type {?|undefined}
*/
Menu.prototype.group;
/**
* Routing for the menu item, can be choose one of `link` or `externalLink`
* @type {?|undefined}
*/
Menu.prototype.link;
/**
* External link for the menu item, can be choose one of `link` or `externalLink`
* @type {?|undefined}
*/
Menu.prototype.externalLink;
/**
* Specifies `externalLink` where to display the linked URL
* @type {?|undefined}
*/
Menu.prototype.target;
/**
* Icon for the menu item, only valid for the first level menu
* @type {?|undefined}
*/
Menu.prototype.icon;
/**
* Badget for the menu item when `group` is `true`
* @type {?|undefined}
*/
Menu.prototype.badge;
/**
* Whether to display a red dot instead of `badge` value
* @type {?|undefined}
*/
Menu.prototype.badgeDot;
/**
* Badge [color](https://ng.ant.design/components/badge/en#nz-badge)
* @type {?|undefined}
*/
Menu.prototype.badgeStatus;
/**
* Whether disable for the menu item
* @type {?|undefined}
*/
Menu.prototype.disabled;
/**
* Whether hidden for the menu item
* @type {?|undefined}
*/
Menu.prototype.hide;
/**
* Whether hide in breadcrumbs, which are valid when the `page-header` component automatically generates breadcrumbs
* @type {?|undefined}
*/
Menu.prototype.hideInBreadcrumb;
/**
* ACL configuration, it's equivalent to `ACLService.can(roleOrAbility: ACLCanType)` parameter value
* @type {?|undefined}
*/
Menu.prototype.acl;
/**
* Whether shortcut menu item
* @type {?|undefined}
*/
Menu.prototype.shortcut;
/**
* Wheter shortcut menu root node
* @type {?|undefined}
*/
Menu.prototype.shortcutRoot;
/**
* Whether to allow reuse, need to cooperate with the `reuse-tab` component
* @type {?|undefined}
*/
Menu.prototype.reuse;
/**
* Whether to expand, when `checkStrictly` is valid in `sidebar-nav` component
* @type {?|undefined}
*/
Menu.prototype.open;
/**
* Unique identifier of the menu item, can be used in `getItem`,` setItem` to update a menu
* @type {?|undefined}
*/
Menu.prototype.key;
/**
* Children menu of menu item
* @type {?|undefined}
*/
Menu.prototype.children;
/* Skipping unhandled member: [key: string]: any;*/
}
/**
* @fileoverview added by tsickle
* Generated from: src/services/i18n/i18n.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @record
*/
function LxlibI18NService() { }
if (false) {
/**
* 调用 `use` 触发变更通知
* @type {?}
*/
LxlibI18NService.prototype.change;
/* Skipping unhandled member: [key: string]: any;*/
/**
* 变更语言
* @param {?} lang 语言代码
* @param {?=} emit 是否触发 `change`,默认:true
* @return {?}
*/
LxlibI18NService.prototype.use = function (lang, emit) { };
/**
* 返回当前语言列表
* @return {?}
*/
LxlibI18NService.prototype.getLangs = function () { };
/**
* 翻译
* - `params` 模板所需要的参数对象
* - `isSafe` 是否返回安全字符,自动调用 `bypassSecurityTrustHtml`
* @param {?} key
* @param {?=} params
* @param {?=} isSafe
* @return {?}
*/
LxlibI18NService.prototype.fanyi = function (key, params, isSafe) { };
}
/** @type {?} */
var LXLIB_I18N_TOKEN = new InjectionToken('lxlibTranslatorToken', {
providedIn: 'root',
factory: LXLIB_I18N_TOKEN_FACTORY,
});
/**
* @return {?}
*/
function LXLIB_I18N_TOKEN_FACTORY() {
return new LxlibI18NServiceFake();
}
var LxlibI18NServiceFake = /** @class */ (function () {
function LxlibI18NServiceFake() {
this.change$ = new BehaviorSubject(null);
}
Object.defineProperty(LxlibI18NServiceFake.prototype, "change", {
get: /**
* @return {?}
*/
function () {
return (/** @type {?} */ (this.change$.asObservable().pipe(filter((/**
* @param {?} w
* @return {?}
*/
function (w) { return w != null; })))));
},
enumerable: true,
configurable: true
});
/**
* @param {?} lang
* @return {?}
*/
LxlibI18NServiceFake.prototype.use = /**
* @param {?} lang
* @return {?}
*/
function (lang) {
this.change$.next(lang);
};
/**
* @return {?}
*/
LxlibI18NServiceFake.prototype.getLangs = /**
* @return {?}
*/
function () {
return [];
};
/**
* @param {?} key
* @return {?}
*/
LxlibI18NServiceFake.prototype.fanyi = /**
* @param {?} key
* @return {?}
*/
function (key) {
return key;
};
LxlibI18NServiceFake.decorators = [
{ type: Injectable, args: [{ providedIn: 'root' },] }
];
/** @nocollapse */ LxlibI18NServiceFake.ɵprov = ɵɵdefineInjectable({ factory: function LxlibI18NServiceFake_Factory() { return new LxlibI18NServiceFake(); }, token: LxlibI18NServiceFake, providedIn: "root" });
return LxlibI18NServiceFake;
}());
if (false) {
/**
* @type {?}
* @private
*/
LxlibI18NServiceFake.prototype.change$;
}
/**
* @fileoverview added by tsickle
* Generated from: src/services/menu/menu.service.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* 菜单服务,[在线文档](https://ng-alain.com/theme/menu)
*/
var MenuService = /** @class */ (function () {
function MenuService(i18nSrv, aclService) {
var _this = this;
this.i18nSrv = i18nSrv;
this.aclService = aclService;
this._change$ = new BehaviorSubject([]);
this.data = [];
this.i18n$ = this.i18nSrv.change.subscribe((/**
* @return {?}
*/
function () { return _this.resume(); }));
}
Object.defineProperty(MenuService.prototype, "change", {
get: /**
* @return {?}
*/
function () {
return this._change$.pipe(share());
},
enumerable: true,
configurable: true
});
/**
* @param {?} data
* @param {?} callback
* @return {?}
*/
MenuService.prototype.visit = /**
* @param {?} data
* @param {?} callback
* @return {?}
*/
function (data, callback) {
/** @type {?} */
var inFn = (/**
* @param {?} list
* @param {?} parentMenu
* @param {?} depth
* @return {?}
*/
function (list, parentMenu, depth) {
var e_1, _a;
try {
for (var list_1 = __values(list), list_1_1 = list_1.next(); !list_1_1.done; list_1_1 = list_1.next()) {
var item = list_1_1.value;
callback(item, parentMenu, depth);
if (item.children && item.children.length > 0) {
inFn(item.children, item, depth + 1);
}
else {
item.children = [];
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (list_1_1 && !list_1_1.done && (_a = list_1.return)) _a.call(list_1);
}
finally { if (e_1) throw e_1.error; }
}
});
inFn(data, null, 0);
};
/**
* @param {?} items
* @return {?}
*/
MenuService.prototype.add = /**
* @param {?} items
* @return {?}
*/
function (items) {
this.data = items;
this.resume();
};
/**
* 重置菜单,可能I18N、用户权限变动时需要调用刷新
*/
/**
* 重置菜单,可能I18N、用户权限变动时需要调用刷新
* @param {?=} callback
* @return {?}
*/
MenuService.prototype.resume = /**
* 重置菜单,可能I18N、用户权限变动时需要调用刷新
* @param {?=} callback
* @return {?}
*/
function (callback) {
var _this = this;
/** @type {?} */
var i = 1;
/** @type {?} */
var shortcuts = [];
this.visit(this.data, (/**
* @param {?} item
* @param {?} parent
* @param {?} depth
* @return {?}
*/
function (item, parent, depth) {
item.__id = i++;
item.__parent = parent;
item._depth = depth;
if (!item.link)
item.link = '';
if (!item.externalLink)
item.externalLink = '';
// badge
if (item.badge) {
if (item.badgeDot !== true) {
item.badgeDot = false;
}
if (!item.badgeStatus) {
item.badgeStatus = 'error';
}
}
item._type = item.externalLink ? 2 : 1;
if (item.children && item.children.length > 0) {
item._type = 3;
}
// icon
if (typeof item.icon === 'string') {
/** @type {?} */
var type = 'class';
/** @type {?} */
var value = item.icon;
// compatible `anticon anticon-user`
if (~item.icon.indexOf("anticon-")) {
type = 'icon';
value = value.split('-').slice(1).join('-');
}
else if (/^https?:\/\//.test(item.icon)) {
type = 'img';
}
item.icon = (/** @type {?} */ ({ type: type, value: value }));
}
if (item.icon != null) {
item.icon = __assign({ theme: 'outline', spin: false }, ((/** @type {?} */ (item.icon))));
}
item.text = item.i18n && _this.i18nSrv ? _this.i18nSrv.fanyi(item.i18n) : item.text;
// group
item.group = item.group !== false;
// hidden
item._hidden = typeof item.hide === 'undefined' ? false : item.hide;
// disabled
item.disabled = typeof item.disabled === 'undefined' ? false : item.disabled;
// acl
item._aclResult = item.acl && _this.aclService ? _this.aclService.can(item.acl) : true;
// shortcut
if (parent && item.shortcut === true && parent.shortcutRoot !== true) {
shortcuts.push(item);
}
if (callback)
callback(item, parent, depth);
}));
this.loadShortcut(shortcuts);
this._change$.next(this.data);
};
/**
* 加载快捷菜单,加载位置规则如下:
* 1、统一在下标0的节点下(即【主导航】节点下方)
* 1、若 children 存在 【shortcutRoot: true】则最优先【推荐】这种方式
* 2、否则查找带有【dashboard】字样链接,若存在则在此菜单的下方创建快捷入口
* 3、否则放在0节点位置
*/
/**
* 加载快捷菜单,加载位置规则如下:
* 1、统一在下标0的节点下(即【主导航】节点下方)
* 1、若 children 存在 【shortcutRoot: true】则最优先【推荐】这种方式
* 2、否则查找带有【dashboard】字样链接,若存在则在此菜单的下方创建快捷入口
* 3、否则放在0节点位置
* @private
* @param {?} shortcuts
* @return {?}
*/
MenuService.prototype.loadShortcut = /**
* 加载快捷菜单,加载位置规则如下:
* 1、统一在下标0的节点下(即【主导航】节点下方)
* 1、若 children 存在 【shortcutRoot: true】则最优先【推荐】这种方式
* 2、否则查找带有【dashboard】字样链接,若存在则在此菜单的下方创建快捷入口
* 3、否则放在0节点位置
* @private
* @param {?} shortcuts
* @return {?}
*/
function (shortcuts) {
if (shortcuts.length === 0 || this.data.length === 0) {
return;
}
/** @type {?} */
var ls = (/** @type {?} */ (this.data[0].children));
/** @type {?} */
var pos = ls.findIndex((/**
* @param {?} w
* @return {?}
*/
function (w) { return w.shortcutRoot === true; }));
if (pos === -1) {
pos = ls.findIndex((/**
* @param {?} w
* @return {?}
*/
function (w) { return (/** @type {?} */ (w.link)).includes('dashboard'); }));
pos = (pos !== -1 ? pos : -1) + 1;
/** @type {?} */
var shortcutMenu = (/** @type {?} */ ({
text: '快捷菜单',
i18n: 'shortcut',
icon: 'icon-rocket',
children: [],
}));
(/** @type {?} */ (this.data[0].children)).splice(pos, 0, shortcutMenu);
}
/** @type {?} */
var _data = (/** @type {?} */ (this.data[0].children))[pos];
if (_data.i18n && this.i18nSrv)
_data.text = this.i18nSrv.fanyi(_data.i18n);
// tslint:disable-next-line:prefer-object-spread
_data = Object.assign(_data, {
shortcutRoot: true,
__id: -1,
__parent: null,
_type: 3,
_depth: 1,
});
_data.children = shortcuts.map((/**
* @param {?} i
* @return {?}
*/
function (i) {
i._depth = 2;
i.__parent = _data;
return i;
}));
};
Object.defineProperty(MenuService.prototype, "menus", {
get: /**
* @return {?}
*/
function () {
return this.data;
},
enumerable: true,
configurable: true
});
/**
* 清空菜单
*/
/**
* 清空菜单
* @return {?}
*/
MenuService.prototype.clear = /**
* 清空菜单
* @return {?}
*/
function () {
this.data = [];
this._change$.next(this.data);
};
/**
* @param {?} data
* @param {?} url
* @param {?=} recursive
* @param {?=} cb
* @return {?}
*/
MenuService.prototype.getHit = /**
* @param {?} data
* @param {?} url
* @param {?=} recursive
* @param {?=} cb
* @return {?}
*/
function (data, url, recursive, cb) {
if (recursive === void 0) { recursive = false; }
if (cb === void 0) { cb = null; }
/** @type {?} */
var item = null;
while (!item && url) {
this.visit(data, (/**
* @param {?} i
* @return {?}
*/
function (i) {
if (cb) {
cb(i);
}
if (i.link != null && i.link === url) {
item = i;
}
}));
if (!recursive)
break;
if (url.includes('?')) {
url = url.split('?')[0];
}
else {
url = url.split('/').slice(0, -1).join('/');
}
}
return item;
};
/**
* 根据URL设置菜单 `_open` 属性
* - 若 `recursive: true` 则会自动向上递归查找
* - 菜单数据源包含 `/ware`,则 `/ware/1` 也视为 `/ware` 项
*/
/**
* 根据URL设置菜单 `_open` 属性
* - 若 `recursive: true` 则会自动向上递归查找
* - 菜单数据源包含 `/ware`,则 `/ware/1` 也视为 `/ware` 项
* @param {?} url
* @param {?=} recursive
* @return {?}
*/
MenuService.prototype.openedByUrl = /**
* 根据URL设置菜单 `_open` 属性
* - 若 `recursive: true` 则会自动向上递归查找
* - 菜单数据源包含 `/ware`,则 `/ware/1` 也视为 `/ware` 项
* @param {?} url
* @param {?=} recursive
* @return {?}
*/
function (url, recursive) {
if (recursive === void 0) { recursive = false; }
if (!url)
return;
/** @type {?} */
var findItem = this.getHit(this.data, url, recursive, (/**
* @param {?} i
* @return {?}
*/
function (i) {
i._selected = false;
i._open = false;
}));
if (findItem == null)
return;
do {
findItem._selected = true;
findItem._open = true;
findItem = findItem.__parent;
} while (findItem);
};
/**
* 根据url获取菜单列表
* - 若 `recursive: true` 则会自动向上递归查找
* - 菜单数据源包含 `/ware`,则 `/ware/1` 也视为 `/ware` 项
*/
/**
* 根据url获取菜单列表
* - 若 `recursive: true` 则会自动向上递归查找
* - 菜单数据源包含 `/ware`,则 `/ware/1` 也视为 `/ware` 项
* @param {?} url
* @param {?=} recursive
* @return {?}
*/
MenuService.prototype.getPathByUrl = /**
* 根据url获取菜单列表
* - 若 `recursive: true` 则会自动向上递归查找
* - 菜单数据源包含 `/ware`,则 `/ware/1` 也视为 `/ware` 项
* @param {?} url
* @param {?=} recursive
* @return {?}
*/
function (url, recursive) {
if (recursive === void 0) { recursive = false; }
/** @type {?} */
var ret = [];
/** @type {?} */
var item = this.getHit(this.data, url, recursive);
if (!item)
return ret;
do {
ret.splice(0, 0, item);
item = item.__parent;
} while (item);
return ret;
};
/**
* Get menu based on `key`
*/
/**
* Get menu based on `key`
* @param {?} key
* @return {?}
*/
MenuService.prototype.getItem = /**
* Get menu based on `key`
* @param {?} key
* @return {?}
*/
function (key) {
/** @type {?} */
var res = null;
this.visit(this.data, (/**
* @param {?} item
* @return {?}
*/
function (item) {
if (res == null && item.key === key) {
res = item;
}
}));
return res;
};
/**
* Set menu based on `key`
*/
/**
* Set menu based on `key`
* @param {?} key
* @param {?} value
* @return {?}
*/
MenuService.prototype.setItem = /**
* Set menu based on `key`
* @param {?} key
* @param {?} value
* @return {?}
*/
function (key, value) {
/** @type {?} */
var item = this.getItem(key);
if (item == null)
return;
Object.keys(value).forEach((/**
* @param {?} k
* @return {?}
*/
function (k) {
item[k] = value[k];
}));
this._change$.next(this.data);
};
/**
* @return {?}
*/
MenuService.prototype.ngOnDestroy = /**
* @return {?}
*/
function () {
this._change$.unsubscribe();
this.i18n$.unsubscribe();
};
MenuService.decorators = [
{ type: Injectable, args: [{ providedIn: 'root' },] }
];
/** @nocollapse */
MenuService.ctorParameters = function () { return [
{ type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [LXLIB_I18N_TOKEN,] }] },
{ type: ACLService, decorators: [{ type: Optional }] }
]; };
/** @nocollapse */ MenuService.ɵprov = ɵɵdefineInjectable({ factory: function MenuService_Factory() { return new MenuService(ɵɵinject(LXLIB_I18N_TOKEN, 8), ɵɵinject(ACLService, 8)); }, token: MenuService, providedIn: "root" });
return MenuService;
}());
if (false) {
/**
* @type {?}
* @private
*/
MenuService.prototype._change$;
/**
* @type {?}
* @private
*/
MenuService.prototype.i18n$;
/**
* @type {?}
* @private
*/
MenuService.prototype.data;
/**
* @type {?}
* @private
*/
MenuService.prototype.i18nSrv;
/**
* @type {?}
* @private
*/
MenuService.prototype.aclService;
}
/**
* @fileoverview added by tsickle
* Generated from: src/services/scroll/scroll.service.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var ScrollService = /** @class */ (function () {
function ScrollService(win, doc) {
this.win = win;
this.doc = doc;
}
/**
* 获取滚动条位置
* @param element 指定元素,默认 `window`
*/
/**
* 获取滚动条位置
* @param {?=} element 指定元素,默认 `window`
* @return {?}
*/
ScrollService.prototype.getScrollPosition = /**
* 获取滚动条位置
* @param {?=} element 指定元素,默认 `window`
* @return {?}
*/
function (element) {
if (element && element !== this.win) {
return [element.scrollLeft, element.scrollTop];
}
else {
return [this.win.pageXOffset, this.win.pageYOffset];
}
};
/**
* 设置滚动条位置
* @param element 指定元素
*/
/**
* 设置滚动条位置
* @param {?} element 指定元素
* @param {?} position
* @return {?}
*/
ScrollService.prototype.scrollToPosition = /**
* 设置滚动条位置
* @param {?} element 指定元素
* @param {?} position
* @return {?}
*/
function (element, position) {
(element || this.win).scrollTo(position[0], position[1]);
};
/**
* 设置滚动条至指定元素
* @param element 指定元素,默认 `document.body`
* @param topOffset 偏移值,默认 `0`
*/
/**
* 设置滚动条至指定元素
* @param {?=} element 指定元素,默认 `document.body`
* @param {?=} topOffset 偏移值,默认 `0`
* @return {?}
*/
ScrollService.prototype.scrollToElement = /**
* 设置滚动条至指定元素
* @param {?=} element 指定元素,默认 `document.body`
* @param {?=} topOffset 偏移值,默认 `0`
* @return {?}
*/
function (element, topOffset) {
if (topOffset === void 0) { topOffset = 0; }
if (!element)
element = this.doc.body;
(/** @type {?} */ (element)).scrollIntoView();
/** @type {?} */
var w = this.win;
if (w && w.scrollBy) {
w.scrollBy(0, (/** @type {?} */ (element)).getBoundingClientRect().top - topOffset);
if (w.pageYOffset < 20) {
w.scrollBy(0, -w.pageYOffset);
}
}
};
/**
* 滚动至顶部
* @param topOffset 偏移值,默认 `0`
*/
/**
* 滚动至顶部
* @param {?=} topOffset 偏移值,默认 `0`
* @return {?}
*/
ScrollService.prototype.scrollToTop = /**
* 滚动至顶部
* @param {?=} topOffset 偏移值,默认 `0`
* @return {?}
*/
function (topOffset) {
if (topOffset === void 0) { topOffset = 0; }
this.scrollToElement(this.doc.body, topOffset);
};
ScrollService.decorators = [
{ type: Injectable, args: [{ providedIn: 'root' },] }
];
/** @nocollapse */
ScrollService.ctorParameters = function () { return [
{ type: undefined, decorators: [{ type: Inject, args: [WINDOW,] }] },
{ type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
]; };
/** @nocollapse */ ScrollService.ɵprov = ɵɵdefineInjectable({ factory: function ScrollService_Factory() { return new ScrollService(ɵɵinject(WINDOW), ɵɵinject(DOCUMENT)); }, token: ScrollService, providedIn: "root" });
return ScrollService;
}());
if (false) {
/**
* @type {?}
* @private
*/
ScrollService.prototype.win;
/**
* @type {?}
* @private
*/
ScrollService.prototype.doc;
}
/**
* @fileoverview added by tsickle
* Generated from: src/services/settings/interface.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @record
*/
function App() { }
if (false) {
/**
* Name for app
* @type {?|undefined}
*/
App.prototype.name;
/**
* Description for app
* @type {?|undefined}
*/
App.prototype.description;
/* Skipping unhandled member: [key: string]: any;*/
}
/**
* @record
*/
function User() { }
if (false) {
/**
* Name for current user
* @type {?|undefined}
*/
User.prototype.name;
/**
* Avatar for current user
* @type {?|undefined}
*/
User.prototype.avatar;
/**
* Email for current user
* @type {?|undefined}
*/
User.prototype.email;
/* Skipping unhandled member: [key: string]: any;*/
}
/**
* @record
*/
function Layout() { }
if (false) {
/**
* Whether to fold menu
* @type {?}
*/
Layout.prototype.collapsed;
/**
* Current language
* @type {?}
*/
Layout.prototype.lang;
/**
* Color weak
* @type {?}
*/
Layout.prototype.colorWeak;
/* Skipping unhandled member: [key: string]: any;*/
}
/**
* @record
*/
function Company() { }
if (false) {
/**
* 公司名称
* @type {?}
*/
Company.prototype.name;
/**
* 公司简称
* @type {?}
*/
Company.prototype.shot_name;
/* Skipping unhandled member: [key: string]: any;*/
}
/**
* @record
*/
function SettingsNotify() { }
if (false) {
/** @type {?} */
SettingsNotify.prototype.type;
/**
* Update `key` name, limited `layout` type
* @type {?|undefined}
*/
SettingsNotify.prototype.name;
/** @type {?} */
SettingsNotify.prototype.value;
}
/**
* @fileoverview added by tsickle
* Generated from: src/services/settings/settings.service.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
var LAYOUT = 'layout';
/** @type {?} */
var USER = 'user';
/** @type {?} */
var APP = 'app';
/** @type {?} */
var COMPANY = 'company';
var SettingsService = /** @class */ (function () {
function SettingsService() {
this.notify$ = new Subject();
this._app = null;
this._user = null;
this._layout = null;
this._company = null;
}
/**
* @private
* @param {?} key
* @return {?}
*/
SettingsService.prototype.get = /**
* @private
* @param {?} key
* @return {?}
*/
function (key) {
return JSON.parse(localStorage.getItem(key) || 'null') || null;
};
/**
* @private
* @param {?} key
* @param {?} value
* @return {?}
*/
SettingsService.prototype.set = /**
* @private
* @param {?} key
* @param {?} value
* @return {?}
*/
function (key, value) {
localStorage.setItem(key, JSON.stringify(value));
};
Object.defineProperty(SettingsService.prototype, "layout", {
get: /**
* @return {?}
*/
function () {
if (!this._layout) {
this._layout = __assign({ fixed: true, collapsed: false, boxed: false, lang: null }, this.get(LAYOUT));
this.set(LAYOUT, this._layout);
}
return (/** @type {?} */ (this._layout));
},
enumerable: true,
configurable: true
});
Object.defineProperty(SettingsService.prototype, "app", {
get: /**
* @return {?}
*/
function () {
if (!this._app) {
this._app = __assign({ year: new Date().getFullYear() }, this.get(APP));
this.set(APP, this._app);
}
return (/** @type {?} */ (this._app));
},
enumerable: true,
configurable: true
});
Object.defineProperty(SettingsService.prototype, "company", {
get: /**
* @return {?}
*/
function () {
if (!this._company) {
this._company = __assign({ last_login: new Date() }, this.get(COMPANY));
this.set(COMPANY, this._company);
}
return (/** @type {?} */ (this._company));
},
enumerable: true,
configurable: true
});
Object.defineProperty(SettingsService.prototype, "user", {
get: /**
* @return {?}
*/
function () {
if (!this._user) {
this._user = __assign({}, this.get(USER));
this.set(USER, this._user);
}
return (/** @type {?} */ (this._user));
},
enumerable: true,
configurable: true
});
Object.defineProperty(SettingsService.prototype, "notify", {
get: /**
* @return {?}
*/
function () {
return this.notify$.asObservable();
},
enumerable: true,
configurable: true
});
/**
* @param {?} name
* @param {?=} value
* @return {?}
*/
SettingsService.prototype.setLayout = /**
* @param {?} name
* @param {?=} value
* @return {?}
*/
function (name, value) {
if (typeof name === 'string') {
this.layout[name] = value;
}
else {
this._layout = name;
}
this.set(LAYOUT, this._layout);
this.notify$.next((/** @type {?} */ ({ type: 'layout', name: name, value: value })));
return true;
};
/**
* @param {?} value
* @return {?}
*/
SettingsService.prototype.setApp = /**
* @param {?} value
* @return {?}
*/
function (value) {
this._app = value;
this.set(APP, value);
this.notify$.next({ type: 'app', value: value });
return true;
};
/**
* @param {?} value
* @return {?}
*/
SettingsService.prototype.setUser = /**
* @param {?} value
* @return {?}
*/
function (value) {
this._user = value;
this.set(USER, value);
this.notify$.next({ type: 'user', value: value });
return true;
};
/**
* @param {?} value
* @return {?}
*/
SettingsService.prototype.setCompany = /**
* @param {?} value
* @return {?}
*/
function (value) {
this._company = value;
this.set(COMPANY, value);
this.notify$.next({ type: 'campany', value: value });
};
SettingsService.decorators = [
{ type: Injectable, args: [{ providedIn: 'root' },] }
];
/** @nocollapse */ SettingsService.ɵprov = ɵɵdefineInjectable({ factory: function SettingsService_Factory() { return new SettingsService(); }, token: SettingsService, providedIn: "root" });
return SettingsService;
}());
if (false) {
/**
* @type {?}
* @private
*/
SettingsService.prototype.notify$;
/**
* @type {?}
* @private
*/
SettingsService.prototype._app;
/**
* @type {?}
* @private
*/
SettingsService.prototype._user;
/**
* @type {?}
* @private
*/
SettingsService.prototype._layout;
/**
* @type {?}
* @private
*/
SettingsService.prototype._company;
}
/**
* @fileoverview added by tsickle
* Generated from: src/services/responsive/responsive.config.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @record
*/
function ResponsiveConfig() { }
if (false) {
/** @type {?} */
ResponsiveConfig.prototype.rules;
}
/**
* @record
*/
function ResponsiveConfigRule() { }
if (false) {
/** @type {?|undefined} */
ResponsiveConfigRule.prototype.xs;
/** @type {?|undefined} */
ResponsiveConfigRule.prototype.sm;
/** @type {?|undefined} */
ResponsiveConfigRule.prototype.md;
/** @type {?|undefined} */
ResponsiveConfigRule.prototype.lg;
/** @type {?|undefined} */
ResponsiveConfigRule.prototype.xl;
/** @type {?|undefined} */
ResponsiveConfigRule.prototype.xxl;
}
/**
* @fileoverview added by tsickle
* Generated from: src/theme.config.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var LxlibThemeConfig = /** @class */ (function () {
function LxlibThemeConfig() {
}
LxlibThemeConfig.decorators = [
{ type: Injectable, args: [{ providedIn: 'root' },] }
];
/** @nocollapse */ LxlibThemeConfig.ɵprov = ɵɵdefineInjectable({ factory: function LxlibThemeConfig_Factory() { return new LxlibThemeConfig(); }, token: LxlibThemeConfig, providedIn: "root" });
return LxlibThemeConfig;
}());
if (false) {
/** @type {?} */
LxlibThemeConfig.prototype.http;
/** @type {?} */
LxlibThemeConfig.prototype.responsive;
}
/**
* @fileoverview added by tsickle
* Generated from: src/services/responsive/responsive.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
var REP_MAX = 6;
var ResponsiveService = /** @class */ (function () {
function ResponsiveService(cog) {
this.cog = __assign({ rules: {
1: { xs: 24 },
2: { xs: 24, sm: 12 },
3: { xs: 24, sm: 12, md: 8 },
4: { xs: 24, sm: 12, md: 8, lg: 6 },
5: { xs: 24, sm: 12, md: 8, lg: 6, xl: 4 },
6: { xs: 24, sm: 12, md: 8, lg: 6, xl: 4, xxl: 2 },
} }, (/** @type {?} */ (cog)).responsive);
if (Object.keys(this.cog.rules)
.map((/**
* @param {?} i
* @return {?}
*/
function (i) { return +i; }))
.some((/**
* @param {?} i
* @return {?}
*/
function (i) { return i < 1 || i > REP_MAX; }))) {
throw new Error("[theme] the responseive rule index value range must be 1-" + REP_MAX);
}
}
/**
* @param {?} count
* @return {?}
*/
ResponsiveService.prototype.genCls = /**
* @param {?} count
* @return {?}
*/
function (count) {
/** @type {?} */
var rule = this.cog.rules[count > REP_MAX ? REP_MAX : Math.max(count, 1)];
/** @type {?} */
var antColClass = 'ant-col';
/** @type {?} */
var clsMap = [antColClass + "-xs-" + rule.xs];
if (rule.sm)
clsMap.push(antColClass + "-sm-" + rule.sm);
if (rule.md)
clsMap.push(antColClass + "-md-" + rule.md);
if (rule.lg)
clsMap.push(antColClass + "-lg-" + rule.lg);
if (rule.xl)
clsMap.push(antColClass + "-xl-" + rule.xl);
if (rule.xxl)
clsMap.push(antColClass + "-xxl-" + rule.xxl);
return clsMap;
};
ResponsiveService.decorators = [
{ type: Injectable, args: [{ providedIn: 'root' },] }
];
/** @nocollapse */
ResponsiveService.ctorParameters = function () { return [
{ type: LxlibThemeConfig }
]; };
/** @nocollapse */ ResponsiveService.ɵprov = ɵɵdefineInjectable({ factory: function ResponsiveService_Factory() { return new ResponsiveService(ɵɵinject(LxlibThemeConfig)); }, token: ResponsiveService, providedIn: "root" });
return ResponsiveService;
}());
if (false) {
/**
* @type {?}
* @private
*/
ResponsiveService.prototype.cog;
}
/**
* @fileoverview added by tsickle
* Generated from: src/services/title/title.service.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var TitleService = /** @class */ (function () {
function TitleService(injector, title, menuSrv, i18nSrv, doc) {
var _this = this;
this.injector = injector;
this.title = title;
this.menuSrv = menuSrv;
this.i18nSrv = i18nSrv;
this.doc = doc;
this._prefix = '';
this._suffix = '';
this._separator = ' - ';
this._reverse = false;
this.DELAY_TIME = 25;
/**
* 设置默认标题名
*/
this.default = "Not Page Name";
this.i18n$ = this.i18nSrv.change.pipe(filter((/**
* @return {?}
*/
function () { return !!_this.i18n$; }))).subscribe((/**
* @return {?}
*/
function () { return _this.setTitle(); }));
}
Object.defineProperty(TitleService.prototype, "separator", {
/** 设置分隔符 */
set: /**
* 设置分隔符
* @param {?} value
* @return {?}
*/
function (value) {
this._separator = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(TitleService.prototype, "prefix", {
/** 设置前缀 */
set: /**
* 设置前缀
* @param {?} value
* @return {?}
*/
function (value) {
this._prefix = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(TitleService.prototype, "suffix", {
/** 设置后缀 */
set: /**
* 设置后缀
* @param {?} value
* @return {?}
*/
function (value) {
this._suffix = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(TitleService.prototype, "reverse", {
/** 设置是否反转 */
set: /**
* 设置是否反转
* @param {?} value
* @return {?}
*/
function (value) {
this._reverse = value;
},
enumerable: true,
configurable: true
});
/**
* @private
* @return {?}
*/
TitleService.prototype.getByElement = /**
* @private
* @return {?}
*/
function () {
/** @type {?} */
var el = (/** @type {?} */ ((this.doc.querySelector('.lxlib-default__content-title h1') || this.doc.querySelector('.page-header__title'))));
if (el) {
/** @type {?} */
var text_1 = '';
el.childNodes.forEach((/**
* @param {?} val
* @return {?}
*/
function (val) {
if (!text_1 && val.nodeType === 3) {
text_1 = (/** @type {?} */ (val.textContent)).trim();
}
}));
return text_1 || (/** @type {?} */ ((/** @type {?} */ (el.firstChild)).textContent)).trim();
}
return '';
};
/**
* @private
* @return {?}
*/
TitleService.prototype.getByRoute = /**
* @private
* @return {?}
*/
function () {
/** @type {?} */
var next = this.injector.get(ActivatedRoute);
while (next.firstChild)
next = next.firstChild;
/** @type {?} */
var data = (next.snapshot && next.snapshot.data) || {};
if (data.titleI18n && this.i18nSrv)
data.title = this.i18nSrv.fanyi(data.titleI18n);
return data.title;
};
/**
* @private
* @return {?}
*/
TitleService.prototype.getByMenu = /**
* @private
* @return {?}
*/
function () {
/** @type {?} */
var menus = this.menuSrv.getPathByUrl(this.injector.get(Router).url);
if (!menus || menus.length <= 0)
return '';
/** @type {?} */
var item = menus[menus.length - 1];
/** @type {?} */
var title;
if (item.i18n && this.i18nSrv)
title = this.i18nSrv.fanyi(item.i18n);
return title || (/** @type {?} */ (item.text));
};
/**
* @private
* @param {?=} title
* @return {?}
*/
TitleService.prototype._setTitle = /**
* @private
* @param {?=} title
* @return {?}
*/
function (title) {
if (!title) {
title = this.getByRoute() || this.getByMenu() || this.getByElement() || this.default;
}
if (title && !Array.isArray(title)) {
title = [title];
}
/** @type {?} */
var newTitles = [];
if (this._prefix) {
newTitles.push(this._prefix);
}
newTitles.push.apply(newTitles, __spread(((/** @type {?} */ (title)))));
if (this._suffix) {
newTitles.push(this._suffix);
}
if (this._reverse) {
newTitles = newTitles.reverse();
}
this.title.setTitle(newTitles.join(this._separator));
};
/**
* Set the document title, will be delay `25ms`, pls refer to [#1261](https://github.com/ng-alain/ng-alain/issues/1261)
*/
/**
* Set the document title, will be delay `25ms`, pls refer to [#1261](https://github.com/ng-alain/ng-alain/issues/1261)
* @param {?=} title
* @return {?}
*/
TitleService.prototype.setTitle = /**
* Set the document title, will be delay `25ms`, pls refer to [#1261](https://github.com/ng-alain/ng-alain/issues/1261)
* @param {?=} title
* @return {?}
*/
function (title) {
var _this = this;
setTimeout((/**
* @return {?}
*/
function () { return _this._setTitle(title); }), this.DELAY_TIME);
};
/**
* Set i18n key of the document title
*/
/**
* Set i18n key of the document title
* @param {?} key
* @param {?=} params
* @return {?}
*/
TitleService.prototype.setTitleByI18n = /**
* Set i18n key of the document title
* @param {?} key
* @param {?=} params
* @return {?}
*/
function (key, params) {
this.setTitle(this.i18nSrv.fanyi(key, params));
};
/**
* @return {?}
*/
TitleService.prototype.ngOnDestroy = /**
* @return {?}
*/
function () {
this.i18n$.unsubscribe();
};
TitleService.decorators = [
{ type: Injectable, args: [{ providedIn: 'root' },] }
];
/** @nocollapse */
TitleService.ctorParameters = function () { return [
{ type: Injector },
{ type: Title },
{ type: MenuService },
{ type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [LXLIB_I18N_TOKEN,] }] },
{ type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
]; };
/** @nocollapse */ TitleService.ɵprov = ɵɵdefineInjectable({ factory: function TitleService_Factory() { return new TitleService(ɵɵinject(INJECTOR), ɵɵinject(Title), ɵɵinject(MenuService), ɵɵinject(LXLIB_I18N_TOKEN, 8), ɵɵinject(DOCUMENT)); }, token: TitleService, providedIn: "root" });
return TitleService;
}());
if (false) {
/**
* @type {?}
* @private
*/
TitleService.prototype._prefix;
/**
* @type {?}
* @private
*/
TitleService.prototype._suffix;
/**
* @type {?}
* @private
*/
TitleService.prototype._separator;
/**
* @type {?}
* @private
*/
TitleService.prototype._reverse;
/**
* @type {?}
* @private
*/
TitleService.prototype.i18n$;
/** @type {?} */
TitleService.prototype.DELAY_TIME;
/**
* 设置默认标题名
* @type {?}
*/
TitleService.prototype.default;
/**
* @type {?}
* @private
*/
TitleService.prototype.injector;
/**
* @type {?}
* @private
*/
TitleService.prototype.title;
/**
* @type {?}
* @private
*/
TitleService.prototype.menuSrv;
/**
* @type {?}
* @private
*/
TitleService.prototype.i18nSrv;
/**
* @type {?}
* @private
*/
TitleService.prototype.doc;
}
/**
* @fileoverview added by tsickle
* Generated from: src/locale/locale.tokens.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
var LXLIB_LOCALE = new InjectionToken('lxlib-locale');
/**
* @fileoverview added by tsickle
* Generated from: src/locale/locale.types.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @record
*/
function LocaleData() { }
/**
* @record
*/
function ExceptionLocaleData() { }
if (false) {
/* Skipping unnamed member:
403: string;*/
/* Skipping unnamed member:
404: string;*/
/* Skipping unnamed member:
500: string;*/
/** @type {?} */
ExceptionLocaleData.prototype.backToHome;
}
/**
* @record
*/
function NoticeIconLocaleData() { }
if (false) {
/** @type {?} */
NoticeIconLocaleData.prototype.emptyText;
/** @type {?} */
NoticeIconLocaleData.prototype.clearText;
}
/**
* @record
*/
function ReuseTabLocaleData() { }
if (false) {
/** @type {?} */
ReuseTabLocaleData.prototype.close;
/** @type {?} */
ReuseTabLocaleData.prototype.closeOther;
/** @type {?} */
ReuseTabLocaleData.prototype.closeRight;
/** @type {?} */
ReuseTabLocaleData.prototype.clear;
}
/**
* @record
*/
function TagSelectLocaleData() { }
if (false) {
/** @type {?} */
TagSelectLocaleData.prototype.expand;
/** @type {?} */
TagSelectLocaleData.prototype.collapse;
}
/**
* @record
*/
function MiniProgressLocaleData() { }
if (false) {
/** @type {?} */
MiniProgressLocaleData.prototype.target;
}
/**
* @record
*/
function STLocaleData() { }
if (false) {
/** @type {?} */
STLocaleData.prototype.total;
/** @type {?} */
STLocaleData.prototype.filterConfirm;
/** @type {?} */
STLocaleData.prototype.filterReset;
}
/**
* @record
*/
function SFLocaleData() { }
if (false) {
/** @type {?} */
SFLocaleData.prototype.submit;
/** @type {?} */
SFLocaleData.prototype.reset;
/** @type {?} */
SFLocaleData.prototype.search;
/** @type {?} */
SFLocaleData.prototype.edit;
/** @type {?} */
SFLocaleData.prototype.addText;
/** @type {?} */
SFLocaleData.prototype.removeText;
/** @type {?} */
SFLocaleData.prototype.checkAllText;
/** @type {?} */
SFLocaleData.prototype.error;
}
/**
* @record
*/
function SFErrorLocaleData() { }
if (false) {
/* Skipping unnamed member:
'false schema': string;*/
/** @type {?} */
SFErrorLocaleData.prototype.$ref;
/** @type {?} */
SFErrorLocaleData.prototype.additionalItems;
/** @type {?} */
SFErrorLocaleData.prototype.additionalProperties;
/** @type {?} */
SFErrorLocaleData.prototype.anyOf;