UNPKG

@ohayojp.com/components

Version:

Common business components of ohayojp.

7 lines 4.56 kB
/** * @license ohayojp(cipchk@qq.com) v1.0.0 * (c) 2020 cipchk https://ohayojp.com/ * License: MIT */ !function (t, e) { "object" == typeof exports && "undefined" != typeof module ? e(exports, require("@angular/core"), require("@angular/platform-browser"), require("@ohayojp.com/theme"), require("@ohayojp.com/util"), require("@angular/common"), require("@angular/router"), require("ng-zorro-antd/button")) : "function" == typeof define && define.amd ? define("@ohayojp.com/components/exception", ["exports", "@angular/core", "@angular/platform-browser", "@ohayojp.com/theme", "@ohayojp.com/util", "@angular/common", "@angular/router", "ng-zorro-antd/button"], e) : e(((t = "undefined" != typeof globalThis ? globalThis : t || self).ohayo = t.ohayo || {}, t.ohayo.components = t.ohayo.components || {}, t.ohayo.components.exception = {}), t.ng.core, t.ng.platformBrowser, t.ohayo.theme, t.ohayo.util, t.ng.common, t.ng.router, t["ng-zorro-antd/button"]) }(this, (function (t, e, o, n, i, r, c, s) { "use strict"; var a = function () { function t(t, e) { this.i18n = t, this.dom = e, this.locale = {}, this.hasCon = !1, this._img = "", this._title = "", this._desc = "" } return Object.defineProperty(t.prototype, "type", { set: function (t) { var e = { 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" } }[t]; e && (this.fixImg(e.img), this._type = t, this._title = e.title, this._desc = "") }, enumerable: !1, configurable: !0 }), t.prototype.fixImg = function (t) { this._img = this.dom.bypassSecurityTrustStyle("url('" + t + "')") }, Object.defineProperty(t.prototype, "img", { set: function (t) { this.fixImg(t) }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "title", { set: function (t) { this._title = this.dom.bypassSecurityTrustHtml(t) }, enumerable: !1, configurable: !0 }), Object.defineProperty(t.prototype, "desc", { set: function (t) { this._desc = this.dom.bypassSecurityTrustHtml(t) }, enumerable: !1, configurable: !0 }), t.prototype.checkContent = function () { this.hasCon = !i.isEmpty(this.conTpl.nativeElement) }, t.prototype.ngOnInit = function () { var t = this; this.i18n$ = this.i18n.change.subscribe((function () { return t.locale = t.i18n.getData("exception") })), this.checkContent() }, t.prototype.ngOnDestroy = function () { this.i18n$.unsubscribe() }, t }(); a.decorators = [{ type: e.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" [innerHTML]="_title"></h1>\n <div class="exception__cont-desc" [innerHTML]="_desc || locale[_type]"></div>\n <div class="exception__cont-actions">\n <div (cdkObserveContent)="checkContent()" #conTpl>\n <ng-content></ng-content>\n </div>\n <button *ngIf="!hasCon" nz-button [routerLink]="[\'/\']" [nzType]="\'primary\'">{{ locale.backToHome }}</button>\n </div>\n</div>\n', host: { "[class.exception]": "true" }, preserveWhitespaces: !1, changeDetection: e.ChangeDetectionStrategy.OnPush, encapsulation: e.ViewEncapsulation.None }] }], a.ctorParameters = function () { return [{ type: n.OhayoLocaleService }, { type: o.DomSanitizer }] }, a.propDecorators = { conTpl: [{ type: e.ViewChild, args: ["conTpl", { static: !0 }] }], type: [{ type: e.Input }], img: [{ type: e.Input }], title: [{ type: e.Input }], desc: [{ type: e.Input }] }; Object.create; function l(t, e) { var o = "function" == typeof Symbol && t[Symbol.iterator]; if (!o) return t; var n, i, r = o.call(t), c = []; try { for (; (void 0 === e || e-- > 0) && !(n = r.next()).done;)c.push(n.value) } catch (t) { i = { error: t } } finally { try { n && !n.done && (o = r.return) && o.call(r) } finally { if (i) throw i.error } } return c } function p() { for (var t = [], e = 0; e < arguments.length; e++)t = t.concat(l(arguments[e])); return t } Object.create; var u = [a], h = function () { }; h.decorators = [{ type: e.NgModule, args: [{ imports: [r.CommonModule, c.RouterModule, i.OhayoUtilModule, n.OhayoLocaleModule, s.NzButtonModule], declarations: p(u), exports: p(u) }] }], t.ExceptionComponent = a, t.ExceptionModule = h, Object.defineProperty(t, "__esModule", { value: !0 }) })); //# sourceMappingURL=exception.umd.min.js.map