UNPKG

@lxlib/seed

Version:

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

228 lines (222 loc) 7.45 kB
import { Component, ChangeDetectionStrategy, ViewEncapsulation, ViewChild, Input, NgModule } from '@angular/core'; import { DomSanitizer } from '@angular/platform-browser'; import { LxlibLocaleService, LxlibLocaleModule } from '@lxlib/theme'; import { isEmpty, LxlibUtilModule } from '@lxlib/util'; import { __spread } from 'tslib'; import { CommonModule } from '@angular/common'; import { RouterModule } from '@angular/router'; import { NzButtonModule } from 'ng-zorro-antd/button'; /** * @fileoverview added by tsickle * Generated from: exception.component.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var ExceptionComponent = /** @class */ (function () { function ExceptionComponent(i18n, dom) { this.i18n = i18n; this.dom = dom; this.locale = {}; this.hasCon = false; this._img = ''; this._title = ''; this._desc = ''; } Object.defineProperty(ExceptionComponent.prototype, "type", { set: /** * @param {?} value * @return {?} */ function (value) { /** @type {?} */ var item = { 403: { img: 'https://gw.alipayobjects.com/zos/rmsportal/wZcnGqRDyhPOEYFcZDnb.svg', title: '403', }, 404: { img: 'https://gw.alipayobjects.com/zos/rmsportal/KpnpchXsobRgLElEozzI.svg', title: '404', }, 500: { img: 'https://gw.alipayobjects.com/zos/rmsportal/RVRUAYdCGeYNBWoKiIwB.svg', title: '500', }, }[value]; if (!item) return; this.fixImg(item.img); this._type = value; this._title = item.title; this._desc = ''; }, enumerable: true, configurable: true }); /** * @private * @param {?} src * @return {?} */ ExceptionComponent.prototype.fixImg = /** * @private * @param {?} src * @return {?} */ function (src) { this._img = this.dom.bypassSecurityTrustStyle("url('" + src + "')"); }; Object.defineProperty(ExceptionComponent.prototype, "img", { set: /** * @param {?} value * @return {?} */ function (value) { this.fixImg(value); }, enumerable: true, configurable: true }); Object.defineProperty(ExceptionComponent.prototype, "title", { set: /** * @param {?} value * @return {?} */ function (value) { this._title = this.dom.bypassSecurityTrustHtml(value); }, enumerable: true, configurable: true }); Object.defineProperty(ExceptionComponent.prototype, "desc", { set: /** * @param {?} value * @return {?} */ function (value) { this._desc = this.dom.bypassSecurityTrustHtml(value); }, enumerable: true, configurable: true }); /** * @return {?} */ ExceptionComponent.prototype.checkContent = /** * @return {?} */ function () { this.hasCon = !isEmpty(this.conTpl.nativeElement); }; /** * @return {?} */ ExceptionComponent.prototype.ngOnInit = /** * @return {?} */ function () { var _this = this; this.i18n$ = this.i18n.change.subscribe((/** * @return {?} */ function () { return (_this.locale = _this.i18n.getData('exception')); })); this.checkContent(); }; /** * @return {?} */ ExceptionComponent.prototype.ngOnDestroy = /** * @return {?} */ function () { this.i18n$.unsubscribe(); }; ExceptionComponent.decorators = [ { type: Component, args: [{ selector: 'exception', exportAs: 'exception', template: "<div class=\"exception__img-block\">\n <div class=\"exception__img\" [style.backgroundImage]=\"_img\"></div>\n</div>\n<div class=\"exception__cont\">\n <h1 class=\"exception__cont-title\"\n [innerHTML]=\"_title\"></h1>\n <div class=\"exception__cont-desc\"\n [innerHTML]=\"_desc || locale[_type]\"></div>\n <div class=\"exception__cont-actions\">\n <div (cdkObserveContent)=\"checkContent()\"\n #conTpl>\n <ng-content></ng-content>\n </div>\n <button *ngIf=\"!hasCon\"\n nz-button\n [routerLink]=\"['/']\"\n [nzType]=\"'primary'\">{{locale.backToHome}}</button>\n </div>\n</div>\n", host: { '[class.exception]': 'true' }, preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None }] } ]; /** @nocollapse */ ExceptionComponent.ctorParameters = function () { return [ { type: LxlibLocaleService }, { type: DomSanitizer } ]; }; ExceptionComponent.propDecorators = { conTpl: [{ type: ViewChild, args: ['conTpl', { static: true },] }], type: [{ type: Input }], img: [{ type: Input }], title: [{ type: Input }], desc: [{ type: Input }] }; return ExceptionComponent; }()); if (false) { /** * @type {?} * @private */ ExceptionComponent.prototype.i18n$; /** * @type {?} * @private */ ExceptionComponent.prototype.conTpl; /** @type {?} */ ExceptionComponent.prototype._type; /** @type {?} */ ExceptionComponent.prototype.locale; /** @type {?} */ ExceptionComponent.prototype.hasCon; /** @type {?} */ ExceptionComponent.prototype._img; /** @type {?} */ ExceptionComponent.prototype._title; /** @type {?} */ ExceptionComponent.prototype._desc; /** * @type {?} * @private */ ExceptionComponent.prototype.i18n; /** * @type {?} * @private */ ExceptionComponent.prototype.dom; } /** * @fileoverview added by tsickle * Generated from: exception.module.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var COMPONENTS = [ExceptionComponent]; var ExceptionModule = /** @class */ (function () { function ExceptionModule() { } ExceptionModule.decorators = [ { type: NgModule, args: [{ imports: [CommonModule, RouterModule, LxlibUtilModule, LxlibLocaleModule, NzButtonModule], declarations: __spread(COMPONENTS), exports: __spread(COMPONENTS), },] } ]; return ExceptionModule; }()); /** * @fileoverview added by tsickle * Generated from: public_api.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * Generated from: exception.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ export { ExceptionComponent, ExceptionModule }; //# sourceMappingURL=exception.js.map