UNPKG

@lxlib/theme

Version:

This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.1.1.

1,854 lines (1,836 loc) 115 kB
import { InjectionToken, Injectable, ɵɵdefineInjectable, Optional, Inject, ɵɵinject, Injector, INJECTOR, SkipSelf, NgModule, Pipe, Version } from '@angular/core'; 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 {?} */ const 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 {?} */ const body = (/** @type {?} */ (document.querySelector('body'))); /** @type {?} */ const 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 {?} */ () => { preloader.className = 'preloader-hidden'; })); preloader.className += ' preloader-hidden-add preloader-hidden-add-active'; } ((/** @type {?} */ (window))).appBootstrap = (/** * @return {?} */ () => { setTimeout((/** * @return {?} */ () => { 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 {?} */ const LXLIB_I18N_TOKEN = new InjectionToken('lxlibTranslatorToken', { providedIn: 'root', factory: LXLIB_I18N_TOKEN_FACTORY, }); /** * @return {?} */ function LXLIB_I18N_TOKEN_FACTORY() { return new LxlibI18NServiceFake(); } class LxlibI18NServiceFake { constructor() { this.change$ = new BehaviorSubject(null); } /** * @return {?} */ get change() { return (/** @type {?} */ (this.change$.asObservable().pipe(filter((/** * @param {?} w * @return {?} */ w => w != null))))); } /** * @param {?} lang * @return {?} */ use(lang) { this.change$.next(lang); } /** * @return {?} */ getLangs() { return []; } /** * @param {?} key * @return {?} */ fanyi(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" }); 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) */ class MenuService { /** * @param {?} i18nSrv * @param {?} aclService */ constructor(i18nSrv, aclService) { this.i18nSrv = i18nSrv; this.aclService = aclService; this._change$ = new BehaviorSubject([]); this.data = []; this.i18n$ = this.i18nSrv.change.subscribe((/** * @return {?} */ () => this.resume())); } /** * @return {?} */ get change() { return this._change$.pipe(share()); } /** * @param {?} data * @param {?} callback * @return {?} */ visit(data, callback) { /** @type {?} */ const inFn = (/** * @param {?} list * @param {?} parentMenu * @param {?} depth * @return {?} */ (list, parentMenu, depth) => { for (const item of list) { callback(item, parentMenu, depth); if (item.children && item.children.length > 0) { inFn(item.children, item, depth + 1); } else { item.children = []; } } }); inFn(data, null, 0); } /** * @param {?} items * @return {?} */ add(items) { this.data = items; this.resume(); } /** * 重置菜单,可能I18N、用户权限变动时需要调用刷新 * @param {?=} callback * @return {?} */ resume(callback) { /** @type {?} */ let i = 1; /** @type {?} */ const shortcuts = []; this.visit(this.data, (/** * @param {?} item * @param {?} parent * @param {?} depth * @return {?} */ (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 {?} */ let type = 'class'; /** @type {?} */ let 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, value })); } if (item.icon != null) { item.icon = Object.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节点位置 * @private * @param {?} shortcuts * @return {?} */ loadShortcut(shortcuts) { if (shortcuts.length === 0 || this.data.length === 0) { return; } /** @type {?} */ const ls = (/** @type {?} */ (this.data[0].children)); /** @type {?} */ let pos = ls.findIndex((/** * @param {?} w * @return {?} */ w => w.shortcutRoot === true)); if (pos === -1) { pos = ls.findIndex((/** * @param {?} w * @return {?} */ w => (/** @type {?} */ (w.link)).includes('dashboard'))); pos = (pos !== -1 ? pos : -1) + 1; /** @type {?} */ const shortcutMenu = (/** @type {?} */ ({ text: '快捷菜单', i18n: 'shortcut', icon: 'icon-rocket', children: [], })); (/** @type {?} */ (this.data[0].children)).splice(pos, 0, shortcutMenu); } /** @type {?} */ let _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 {?} */ i => { i._depth = 2; i.__parent = _data; return i; })); } /** * @return {?} */ get menus() { return this.data; } /** * 清空菜单 * @return {?} */ clear() { this.data = []; this._change$.next(this.data); } /** * @param {?} data * @param {?} url * @param {?=} recursive * @param {?=} cb * @return {?} */ getHit(data, url, recursive = false, cb = null) { /** @type {?} */ let item = null; while (!item && url) { this.visit(data, (/** * @param {?} i * @return {?} */ 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` 项 * @param {?} url * @param {?=} recursive * @return {?} */ openedByUrl(url, recursive = false) { if (!url) return; /** @type {?} */ let findItem = this.getHit(this.data, url, recursive, (/** * @param {?} i * @return {?} */ 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` 项 * @param {?} url * @param {?=} recursive * @return {?} */ getPathByUrl(url, recursive = false) { /** @type {?} */ const ret = []; /** @type {?} */ let 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` * @param {?} key * @return {?} */ getItem(key) { /** @type {?} */ let res = null; this.visit(this.data, (/** * @param {?} item * @return {?} */ item => { if (res == null && item.key === key) { res = item; } })); return res; } /** * Set menu based on `key` * @param {?} key * @param {?} value * @return {?} */ setItem(key, value) { /** @type {?} */ const item = this.getItem(key); if (item == null) return; Object.keys(value).forEach((/** * @param {?} k * @return {?} */ k => { item[k] = value[k]; })); this._change$.next(this.data); } /** * @return {?} */ ngOnDestroy() { this._change$.unsubscribe(); this.i18n$.unsubscribe(); } } MenuService.decorators = [ { type: Injectable, args: [{ providedIn: 'root' },] } ]; /** @nocollapse */ MenuService.ctorParameters = () => [ { 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" }); 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 */ class ScrollService { /** * @param {?} win * @param {?} doc */ constructor(win, doc) { this.win = win; this.doc = doc; } /** * 获取滚动条位置 * @param {?=} element 指定元素,默认 `window` * @return {?} */ getScrollPosition(element) { if (element && element !== this.win) { return [element.scrollLeft, element.scrollTop]; } else { return [this.win.pageXOffset, this.win.pageYOffset]; } } /** * 设置滚动条位置 * @param {?} element 指定元素 * @param {?} position * @return {?} */ scrollToPosition(element, position) { (element || this.win).scrollTo(position[0], position[1]); } /** * 设置滚动条至指定元素 * @param {?=} element 指定元素,默认 `document.body` * @param {?=} topOffset 偏移值,默认 `0` * @return {?} */ scrollToElement(element, topOffset = 0) { if (!element) element = this.doc.body; (/** @type {?} */ (element)).scrollIntoView(); /** @type {?} */ const 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` * @return {?} */ scrollToTop(topOffset = 0) { this.scrollToElement(this.doc.body, topOffset); } } ScrollService.decorators = [ { type: Injectable, args: [{ providedIn: 'root' },] } ]; /** @nocollapse */ ScrollService.ctorParameters = () => [ { 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" }); 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 {?} */ const LAYOUT = 'layout'; /** @type {?} */ const USER = 'user'; /** @type {?} */ const APP = 'app'; /** @type {?} */ const COMPANY = 'company'; class SettingsService { constructor() { this.notify$ = new Subject(); this._app = null; this._user = null; this._layout = null; this._company = null; } /** * @private * @param {?} key * @return {?} */ get(key) { return JSON.parse(localStorage.getItem(key) || 'null') || null; } /** * @private * @param {?} key * @param {?} value * @return {?} */ set(key, value) { localStorage.setItem(key, JSON.stringify(value)); } /** * @return {?} */ get layout() { if (!this._layout) { this._layout = Object.assign({ fixed: true, collapsed: false, boxed: false, lang: null }, this.get(LAYOUT)); this.set(LAYOUT, this._layout); } return (/** @type {?} */ (this._layout)); } /** * @return {?} */ get app() { if (!this._app) { this._app = Object.assign({ year: new Date().getFullYear() }, this.get(APP)); this.set(APP, this._app); } return (/** @type {?} */ (this._app)); } /** * @return {?} */ get company() { if (!this._company) { this._company = Object.assign({ last_login: new Date() }, this.get(COMPANY)); this.set(COMPANY, this._company); } return (/** @type {?} */ (this._company)); } /** * @return {?} */ get user() { if (!this._user) { this._user = Object.assign({}, this.get(USER)); this.set(USER, this._user); } return (/** @type {?} */ (this._user)); } /** * @return {?} */ get notify() { return this.notify$.asObservable(); } /** * @param {?} name * @param {?=} value * @return {?} */ setLayout(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, value }))); return true; } /** * @param {?} value * @return {?} */ setApp(value) { this._app = value; this.set(APP, value); this.notify$.next({ type: 'app', value }); return true; } /** * @param {?} value * @return {?} */ setUser(value) { this._user = value; this.set(USER, value); this.notify$.next({ type: 'user', value }); return true; } /** * @param {?} value * @return {?} */ setCompany(value) { this._company = value; this.set(COMPANY, value); this.notify$.next({ type: 'campany', value }); } } SettingsService.decorators = [ { type: Injectable, args: [{ providedIn: 'root' },] } ]; /** @nocollapse */ SettingsService.ɵprov = ɵɵdefineInjectable({ factory: function SettingsService_Factory() { return new SettingsService(); }, token: SettingsService, providedIn: "root" }); 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 */ class LxlibThemeConfig { } LxlibThemeConfig.decorators = [ { type: Injectable, args: [{ providedIn: 'root' },] } ]; /** @nocollapse */ LxlibThemeConfig.ɵprov = ɵɵdefineInjectable({ factory: function LxlibThemeConfig_Factory() { return new LxlibThemeConfig(); }, token: LxlibThemeConfig, providedIn: "root" }); 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 {?} */ const REP_MAX = 6; class ResponsiveService { /** * @param {?} cog */ constructor(cog) { this.cog = Object.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 {?} */ i => +i)) .some((/** * @param {?} i * @return {?} */ (i) => i < 1 || i > REP_MAX))) { throw new Error(`[theme] the responseive rule index value range must be 1-${REP_MAX}`); } } /** * @param {?} count * @return {?} */ genCls(count) { /** @type {?} */ const rule = this.cog.rules[count > REP_MAX ? REP_MAX : Math.max(count, 1)]; /** @type {?} */ const antColClass = 'ant-col'; /** @type {?} */ const 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 = () => [ { type: LxlibThemeConfig } ]; /** @nocollapse */ ResponsiveService.ɵprov = ɵɵdefineInjectable({ factory: function ResponsiveService_Factory() { return new ResponsiveService(ɵɵinject(LxlibThemeConfig)); }, token: ResponsiveService, providedIn: "root" }); 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 */ class TitleService { /** * @param {?} injector * @param {?} title * @param {?} menuSrv * @param {?} i18nSrv * @param {?} doc */ constructor(injector, title, menuSrv, i18nSrv, doc) { 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 {?} */ () => !!this.i18n$))).subscribe((/** * @return {?} */ () => this.setTitle())); } /** * 设置分隔符 * @param {?} value * @return {?} */ set separator(value) { this._separator = value; } /** * 设置前缀 * @param {?} value * @return {?} */ set prefix(value) { this._prefix = value; } /** * 设置后缀 * @param {?} value * @return {?} */ set suffix(value) { this._suffix = value; } /** * 设置是否反转 * @param {?} value * @return {?} */ set reverse(value) { this._reverse = value; } /** * @private * @return {?} */ getByElement() { /** @type {?} */ const el = (/** @type {?} */ ((this.doc.querySelector('.lxlib-default__content-title h1') || this.doc.querySelector('.page-header__title')))); if (el) { /** @type {?} */ let text = ''; el.childNodes.forEach((/** * @param {?} val * @return {?} */ val => { if (!text && val.nodeType === 3) { text = (/** @type {?} */ (val.textContent)).trim(); } })); return text || (/** @type {?} */ ((/** @type {?} */ (el.firstChild)).textContent)).trim(); } return ''; } /** * @private * @return {?} */ getByRoute() { /** @type {?} */ let next = this.injector.get(ActivatedRoute); while (next.firstChild) next = next.firstChild; /** @type {?} */ const data = (next.snapshot && next.snapshot.data) || {}; if (data.titleI18n && this.i18nSrv) data.title = this.i18nSrv.fanyi(data.titleI18n); return data.title; } /** * @private * @return {?} */ getByMenu() { /** @type {?} */ const menus = this.menuSrv.getPathByUrl(this.injector.get(Router).url); if (!menus || menus.length <= 0) return ''; /** @type {?} */ const item = menus[menus.length - 1]; /** @type {?} */ let title; if (item.i18n && this.i18nSrv) title = this.i18nSrv.fanyi(item.i18n); return title || (/** @type {?} */ (item.text)); } /** * @private * @param {?=} title * @return {?} */ _setTitle(title) { if (!title) { title = this.getByRoute() || this.getByMenu() || this.getByElement() || this.default; } if (title && !Array.isArray(title)) { title = [title]; } /** @type {?} */ let newTitles = []; if (this._prefix) { newTitles.push(this._prefix); } newTitles.push(...((/** @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) * @param {?=} title * @return {?} */ setTitle(title) { setTimeout((/** * @return {?} */ () => this._setTitle(title)), this.DELAY_TIME); } /** * Set i18n key of the document title * @param {?} key * @param {?=} params * @return {?} */ setTitleByI18n(key, params) { this.setTitle(this.i18nSrv.fanyi(key, params)); } /** * @return {?} */ ngOnDestroy() { this.i18n$.unsubscribe(); } } TitleService.decorators = [ { type: Injectable, args: [{ providedIn: 'root' },] } ]; /** @nocollapse */ TitleService.ctorParameters = () => [ { 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" }); 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 {?} */ const 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; /** @type {?} */ SFErrorLocaleData.prototype.dependencies; /** @type {?} */ SFErrorLocaleData.prototype.enum; /** @type {?} */ SFErrorLocaleData.prototype.format; /** @type {?} */ SFErrorLocaleData.prototype.type; /** @type {?} */ SFErrorLocaleData.prototype.required; /** @type {?} */ SFErrorLocaleData.prototype.maxLength; /** @type {?} */ SFErrorLocaleData.prototype.minLength; /** @type {?} */ SFErrorLocaleData.prototype.minimum; /** @type {?} */ SFErrorLocaleData.prototype.formatMinimum; /** @type {?} */ SFErrorLocaleData.prototype.maximum; /** @type {?} */ SFErrorLocaleData.prototype.formatMaximum; /** @type {?} */ SFErrorLocaleData.prototype.maxItems; /** @type {?} */ SFErrorLocaleData.prototype.minItems; /** @type {?} */ SFErrorLocaleData.prototype.maxProperties; /** @type {?} */ SFErrorLocaleData.prototype.minProperties; /** @type {?} */ SFErrorLocaleData.prototype.multipleOf; /** @type {?} */ SFErrorLocaleData.prototype.not; /** @type {?} */ SFErrorLocaleData.prototype.oneOf; /** @type {?} */ SFErrorLocaleData.prototype.pattern; /** @type {?} */ SFErrorLocaleData.prototype.uniqueItems; /** @type {?} */ SFErrorLocaleData.prototype.custom; /** @type {?} */ SFErrorLocaleData.prototype.propertyNames; /** @type {?} */ SFErrorLocaleData.prototype.patternRequired; /** @type {?} */ SFErrorLocaleData.prototype.switch; /** @type {?} */ SFErrorLocaleData.prototype.const; /** @type {?} */ SFErrorLocaleData.prototype.contains; /** @type {?} */ SFErrorLocaleData.prototype.formatExclusiveMaximum; /** @type {?} */ SFErrorLocaleData.prototype.formatExclusiveMinimum; /** @type {?} */ SFErrorLocaleData.prototype.if; } /** * @record */ function FullLocaleData() { } if (false) { /** @type {?} */ FullLocaleData.prototype.abbr; /** @type {?} */ FullLocaleData.prototype.exception; /** @type {?} */ FullLocaleData.prototype.noticeIcon; /** @type {?} */ FullLocaleData.prototype.reuseTab; /** @type {?} */ FullLocaleData.prototype.tagSelect; /** @type {?} */ FullLocaleData.prototype.miniProgress; /** @type {?} */ FullLocaleData.prototype.st; /** @type {?} */ FullLocaleData.prototype.sf; } /** * @fileoverview added by tsickle * Generated from: src/locale/languages/zh-CN.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var zhCN = (/** @type {?} */ ({ abbr: 'zh-CN', exception: { 403: '抱歉,你无权访问该页面', 404: '抱歉,你访问的页面不存在', 500: '抱歉,服务器出错了', backToHome: '返回首页', }, noticeIcon: { emptyText: '暂无数据', clearText: '清空', }, reuseTab: { close: '关闭标签', closeOther: '关闭其它标签', closeRight: '关闭右侧标签', clear: '清空', }, tagSelect: { expand: '展开', collapse: '收起', }, miniProgress: { target: '目标值:', }, st: { total: '共 {{total}} 条', filterConfirm: '确定', filterReset: '重置', }, sf: { submit: '提交', reset: '重置', search: '搜索', edit: '保存', addText: '添加', removeText: '移除', checkAllText: '全选', error: { 'false schema': `布尔模式出错`, $ref: `无法找到引用{ref}`, additionalItems: `不允许超过{limit}个元素`, additionalProperties: `不允许有额外的属性`, anyOf: `数据应为 anyOf 所指定的其中一个`, dependencies: `应当拥有属性{property}的依赖属性{deps}`, enum: `应当是预设定的枚举值之一`, format: `格式不正确`, type: `类型应当是 {type}`, required: `必填项`, maxLength: `至多 {limit} 个字符`, minLength: `至少 {limit} 个字符以上`, minimum: `必须 {comparison}{limit}`, formatMinimum: `必须 {comparison}{limit}`, maximum: `必须 {comparison}{limit}`, formatMaximum: `必须 {comparison}{limit}`, maxItems: `不应多于 {limit} 个项`, minItems: `不应少于 {limit} 个项`, maxProperties: `不应多于 {limit} 个属性`, minProperties: `不应少于 {limit} 个属性`, multipleOf: `应当是 {multipleOf} 的整数倍`, not: `不应当匹配 "not" schema`, oneOf: `只能匹配一个 "oneOf" 中的 schema`, pattern: `数据格式不正确`, uniqueItems: `不应当含有重复项 (第 {j} 项与第 {i} 项是重复的)`, custom: `格式不正确`, propertyNames: `属性名 "{propertyName}" 无效`, patternRequired: `应当有属性匹配模式 {missingPattern}`, switch: `由于 {caseIndex} 失败,未通过 "switch" 校验`, const: `应当等于常量`, contains: `应当包含一个有效项`, formatExclusiveMaximum: `formatExclusiveMaximum 应当是布尔值`, formatExclusiveMinimum: `formatExclusiveMinimum 应当是布尔值`, if: `应当匹配模式 "{failingKeyword}"`, }, }, })); /** * @fileoverview added by tsickle * Generated from: src/locale/locale.service.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ class LxlibLocaleService { /** * @param {?} locale */ constructor(locale) { this.change$ = new BehaviorSubject(this._locale); this.setLocale(locale || zhCN); } /** * @return {?} */ get change() { return this.change$.asObservable(); } /** * @param {?} locale * @return {?} */ setLocale(locale) { if (this._locale && this._locale.abbr === locale.abbr) { return; } this._locale = locale; this.change$.next(locale); } /** * @return {?} */ get locale() { return this._locale; } /** * @param {?} path * @return {?} */ getData(path) { return (/** @type {?} */ ((this._locale[path] || {}))); } } LxlibLocaleService.decorators = [ { type: Injectable } ]; /** @nocollapse */ LxlibLocaleService.ctorParameters = () => [ { type: undefined, decorators: [{ type: Inject, args: [LXLIB_LOCALE,] }] } ]; if (false) { /** * @type {?} * @private */ LxlibLocaleService.prototype._locale; /** * @type {?} * @private */ LxlibLocaleService.prototype.change$; } /** * @param {?} exist * @param {?} locale * @return {?} */ function LXLIB_LOCALE_SERVICE_PROVIDER_FACTORY(exist, locale) { return exist || new LxlibLocaleService(locale); } /** @type {?} */ const LXLIB_LOCALE_SERVICE_PROVIDER = { provide: LxlibLocaleService, useFactory: LXLIB_LOCALE_SERVICE_PROVIDER_FACTORY, deps: [[new Optional(), new SkipSelf(), LxlibLocaleService], LXLIB_LOCALE], }; /** * @fileoverview added by tsickle * Generated from: src/locale/locale.module.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ const ɵ0 = zhCN; class LxlibLocaleModule { } LxlibLocaleModule.decorators = [ { type: NgModule, args: [{ providers: [{ provide: LXLIB_LOCALE, useValue: ɵ0 }, LXLIB_LOCALE_SERVICE_PROVIDER], },] } ]; /** * @fileoverview added by tsickle * Generated from: src/locale/languages/en-US.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var enUS = (/** @type {?} */ ({ abbr: 'en-US', exception: { 403: `Sorry, you don't have access to this page`, 404: `Sorry, the page you visited does not exist`, 500: `Sorry, the server is reporting an error`, backToHome: 'Back To Home', }, noticeIcon: { emptyText: 'No data', clearText: 'Clear', }, reuseTab: { close: 'Close tab', closeOther: 'Close other tabs', closeRight: 'Close tabs to right', clear: 'Clear tabs', }, tagSelect: { expand: 'Expand', collapse: 'Collapse', }, miniProgress: { target: 'Target: ', }, st: { total: '{{range[0]}} - {{range[1]}} of {{total}}', filterConfirm: 'OK', filterReset: 'Reset', }, sf: { submit: 'Submit', reset: 'Reset', search: 'Search', edit: 'Save', addText: 'Add', removeText: 'Remove', checkAllText: 'Check all', error: { 'false schema': `Boolean schema is false`, $ref: `Can't resolve reference {ref}`, additionalItems: `Should not have more than {limit} item`, additionalProperties: `Should not have additional properties`, anyOf: `Should match some schema in "anyOf"`, dependencies: `should have property {deps} when property {property} is present`, enum: `Should be equal to one of predefined values`, format: `Should match format "{format}"`, type: `Sho