UNPKG

@ohayojp.com/components

Version:

Common business components of ohayojp.

7 lines 27 kB
/** * @license ohayojp(cipchk@qq.com) v1.0.0 * (c) 2020 cipchk https://ohayojp.com/ * License: MIT */ !function (e, t) { "object" == typeof exports && "undefined" != typeof module ? t(exports, require("@angular/core"), require("@ohayojp.com/theme"), require("rxjs"), require("@angular/cdk/overlay"), require("@angular/cdk/portal"), require("@angular/common"), require("@angular/router"), require("@ohayojp.com/util"), require("rxjs/operators"), require("ng-zorro-antd/icon"), require("ng-zorro-antd/menu"), require("ng-zorro-antd/tabs")) : "function" == typeof define && define.amd ? define("@ohayojp.com/components/reuse-tab", ["exports", "@angular/core", "@ohayojp.com/theme", "rxjs", "@angular/cdk/overlay", "@angular/cdk/portal", "@angular/common", "@angular/router", "@ohayojp.com/util", "rxjs/operators", "ng-zorro-antd/icon", "ng-zorro-antd/menu", "ng-zorro-antd/tabs"], t) : t(((e = "undefined" != typeof globalThis ? globalThis : e || self).ohayo = e.ohayo || {}, e.ohayo.components = e.ohayo.components || {}, e.ohayo.components["reuse-tab"] = {}), e.ng.core, e.ohayo.theme, e.rxjs, e.ng.cdk.overlay, e.ng.cdk.portal, e.ng.common, e.ng.router, e.ohayo.util, e.rxjs.operators, e["ng-zorro-antd/icon"], e["ng-zorro-antd/menu"], e["ng-zorro-antd/tabs"]) }(this, (function (e, t, n, o, i, r, s, c, a, u, l, h, p) { "use strict"; var d = function () { function e(e) { this.i18nSrv = e, this.close = new t.EventEmitter } return Object.defineProperty(e.prototype, "i18n", { get: function () { return this._i18n }, set: function (e) { this._i18n = Object.assign(Object.assign({}, this.i18nSrv.getData("reuseTab")), e) }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "includeNonCloseable", { get: function () { return this.event.ctrlKey }, enumerable: !1, configurable: !0 }), e.prototype.notify = function (e) { this.close.next({ type: e, item: this.item, includeNonCloseable: this.includeNonCloseable }) }, e.prototype.ngOnInit = function () { this.includeNonCloseable && (this.item.closable = !0) }, e.prototype.click = function (e, t, n) { if (e.preventDefault(), e.stopPropagation(), ("close" !== t || this.item.closable) && ("closeRight" !== t || !this.item.last)) { if (n) { if (this.isDisabled(n)) return; n.fn(this.item, n) } this.notify(t) } }, e.prototype.isDisabled = function (e) { return !!e.disabled && e.disabled(this.item) }, e.prototype.closeMenu = function (e) { "click" === e.type && 2 === e.button || this.notify(null) }, e }(); d.decorators = [{ type: t.Component, args: [{ selector: "reuse-tab-context-menu", template: '<ul nz-menu>\n <li nz-menu-item (click)="click($event, \'refresh\')" data-type="refresh" [innerHTML]="i18n.refresh"></li>\n <li nz-menu-item (click)="click($event, \'close\')" data-type="close" [nzDisabled]="!item.closable" [innerHTML]="i18n.close"></li>\n <li nz-menu-item (click)="click($event, \'closeOther\')" data-type="closeOther" [innerHTML]="i18n.closeOther"></li>\n <li nz-menu-item (click)="click($event, \'closeRight\')" data-type="closeRight" [nzDisabled]="item.last" [innerHTML]="i18n.closeRight"></li>\n <ng-container *ngIf="customContextMenu!.length > 0">\n <li nz-menu-divider></li>\n <li\n *ngFor="let i of customContextMenu"\n nz-menu-item\n [attr.data-type]="i.id"\n [nzDisabled]="isDisabled(i)"\n (click)="click($event, \'custom\', i)"\n [innerHTML]="i.title"\n ></li>\n </ng-container>\n</ul>\n', host: { "(document:click)": "closeMenu($event)", "(document:contextmenu)": "closeMenu($event)" }, preserveWhitespaces: !1, changeDetection: t.ChangeDetectionStrategy.OnPush, encapsulation: t.ViewEncapsulation.None }] }], d.ctorParameters = function () { return [{ type: n.OhayoLocaleService }] }, d.propDecorators = { i18n: [{ type: t.Input }], item: [{ type: t.Input }], event: [{ type: t.Input }], customContextMenu: [{ type: t.Input }], close: [{ type: t.Output }] }; var f = function () { function e(e) { this.overlay = e, this.show = new o.Subject, this.close = new o.Subject } return e.prototype.remove = function () { this.ref && (this.ref.detach(), this.ref.dispose(), this.ref = null) }, e.prototype.open = function (e) { var n = this; this.remove(); var s = e.event, c = e.item, a = e.customContextMenu, u = new t.ElementRef({ getBoundingClientRect: function () { return { bottom: s.clientY, height: 0, left: s.clientX, right: s.clientX, top: s.clientY, width: 0 } } }), l = [new i.ConnectionPositionPair({ originX: "start", originY: "bottom" }, { overlayX: "start", overlayY: "top" }), new i.ConnectionPositionPair({ originX: "start", originY: "top" }, { overlayX: "start", overlayY: "bottom" })], h = this.overlay.position().flexibleConnectedTo(u).withPositions(l); this.ref = this.overlay.create({ positionStrategy: h, panelClass: "reuse-tab__cm", scrollStrategy: this.overlay.scrollStrategies.close() }); var p = this.ref.attach(new r.ComponentPortal(d)), f = p.instance; f.i18n = this.i18n, f.item = Object.assign({}, c), f.customContextMenu = a, f.event = s; var g = new o.Subscription; g.add(f.close.subscribe((function (e) { n.close.next(e), n.remove() }))), p.onDestroy((function () { return g.unsubscribe() })) }, e }(); f.decorators = [{ type: t.Injectable }], f.ctorParameters = function () { return [{ type: i.Overlay }] }; var g = function () { function e(e) { var n = this; this.srv = e, this.sub$ = new o.Subscription, this.change = new t.EventEmitter, this.sub$.add(e.show.subscribe((function (e) { return n.srv.open(e) }))), this.sub$.add(e.close.subscribe((function (e) { return n.change.emit(e) }))) } return Object.defineProperty(e.prototype, "i18n", { set: function (e) { this.srv.i18n = e }, enumerable: !1, configurable: !0 }), e.prototype.ngOnDestroy = function () { this.sub$.unsubscribe() }, e }(); g.decorators = [{ type: t.Component, args: [{ selector: "reuse-tab-context", template: "" }] }], g.ctorParameters = function () { return [{ type: f }] }, g.propDecorators = { i18n: [{ type: t.Input }], change: [{ type: t.Output }] }; var y = function () { function e(e) { this.srv = e } return e.prototype._onContextMenu = function (e) { this.srv.show.next({ event: e, item: this.item, customContextMenu: this.customContextMenu }), e.preventDefault(), e.stopPropagation() }, e }(); y.decorators = [{ type: t.Directive, args: [{ selector: "[reuse-tab-context-menu]", exportAs: "reuseTcomponentsontextMenu", host: { "(contextmenu)": "_onContextMenu($event)" } }] }], y.ctorParameters = function () { return [{ type: f }] }, y.propDecorators = { item: [{ type: t.Input, args: ["reuse-tab-context-menu"] }], customContextMenu: [{ type: t.Input }] }; function b(e, t, n, o) { var i, r = arguments.length, s = r < 3 ? t : null === o ? o = Object.getOwnPropertyDescriptor(t, n) : o; if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) s = Reflect.decorate(e, t, n, o); else for (var c = e.length - 1; c >= 0; c--)(i = e[c]) && (s = (r < 3 ? i(s) : r > 3 ? i(t, n, s) : i(t, n)) || s); return r > 3 && s && Object.defineProperty(t, n, s), s } function v(e, t) { if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(e, t) } Object.create; function m(e, t) { var n = "function" == typeof Symbol && e[Symbol.iterator]; if (!n) return e; var o, i, r = n.call(e), s = []; try { for (; (void 0 === t || t-- > 0) && !(o = r.next()).done;)s.push(o.value) } catch (e) { i = { error: e } } finally { try { o && !o.done && (n = r.return) && n.call(r) } finally { if (i) throw i.error } } return s } function x() { for (var e = [], t = 0; t < arguments.length; t++)e = e.concat(m(arguments[t])); return e } Object.create; var C = { Menu: 0, MenuForce: 1, URL: 2 }; C[C.Menu] = "Menu", C[C.MenuForce] = "MenuForce", C[C.URL] = "URL"; var _ = function () { function e(e, t) { this.injector = e, this.menuService = t, this._inited = !1, this._max = 10, this._keepingScroll = !1, this._cachedChange = new o.BehaviorSubject(null), this._cached = [], this._titleCached = {}, this._closableCached = {}, this.positionBuffer = {}, this.debug = !1, this.routeParamMatchMode = "strict", this.mode = C.Menu, this.excludes = [] } return Object.defineProperty(e.prototype, "snapshot", { get: function () { return this.injector.get(c.ActivatedRoute).snapshot }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "inited", { get: function () { return this._inited }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "curUrl", { get: function () { return this.getUrl(this.snapshot) }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "max", { set: function (e) { this._max = Math.min(Math.max(e, 2), 100); for (var t = this._cached.length; t > this._max; t--)this._cached.pop() }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "keepingScroll", { get: function () { return this._keepingScroll }, set: function (e) { this._keepingScroll = e, this.initScroll() }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "items", { get: function () { return this._cached }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "count", { get: function () { return this._cached.length }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "change", { get: function () { return this._cachedChange.asObservable() }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "title", { set: function (e) { var t = this.curUrl; "string" == typeof e && (e = { text: e }), this._titleCached[t] = e, this.di("update current tag title: ", e), this._cachedChange.next({ active: "title", url: t, title: e, list: this._cached }) }, enumerable: !1, configurable: !0 }), e.prototype.index = function (e) { return this._cached.findIndex((function (t) { return t.url === e })) }, e.prototype.exists = function (e) { return -1 !== this.index(e) }, e.prototype.get = function (e) { return e && this._cached.find((function (t) { return t.url === e })) || null }, e.prototype.remove = function (e, t) { var n = "string" == typeof e ? this.index(e) : e, o = -1 !== n ? this._cached[n] : null; return !(!o || !t && !o.closable) && (this.destroy(o._handle), this._cached.splice(n, 1), delete this._titleCached[e], !0) }, e.prototype.close = function (e, t) { return void 0 === t && (t = !1), this.removeUrlBuffer = e, this.remove(e, t), this._cachedChange.next({ active: "close", url: e, list: this._cached }), this.di("close tag", e), !0 }, e.prototype.closeRight = function (e, t) { void 0 === t && (t = !1); for (var n = this.index(e), o = this.count - 1; o > n; o--)this.remove(o, t); return this.removeUrlBuffer = null, this._cachedChange.next({ active: "closeRight", url: e, list: this._cached }), this.di("close right tages", e), !0 }, e.prototype.clear = function (e) { var t = this; void 0 === e && (e = !1), this._cached.forEach((function (n) { !e && n.closable && t.destroy(n._handle) })), this._cached = this._cached.filter((function (t) { return !e && !t.closable })), this.removeUrlBuffer = null, this._cachedChange.next({ active: "clear", list: this._cached }), this.di("clear all catch") }, e.prototype.move = function (e, t) { var n = this._cached.findIndex((function (t) { return t.url === e })); if (-1 !== n) { var o = this._cached.slice(); o.splice(t < 0 ? o.length + t : t, 0, o.splice(n, 1)[0]), this._cached = o, this._cachedChange.next({ active: "move", url: e, position: t, list: this._cached }) } }, e.prototype.replace = function (e) { var t = this.curUrl; this.exists(t) ? this.close(t, !0) : this.removeUrlBuffer = t, this.injector.get(c.Router).navigateByUrl(e) }, e.prototype.getTitle = function (e, t) { if (this._titleCached[e]) return this._titleCached[e]; if (t && t.data && (t.data.titleI18n || t.data.title)) return { text: t.data.title, i18n: t.data.titleI18n }; var n = this.getMenu(e); return n ? { text: n.text, i18n: n.i18n } : { text: e } }, e.prototype.clearTitleCached = function () { this._titleCached = {} }, Object.defineProperty(e.prototype, "closable", { set: function (e) { var t = this.curUrl; this._closableCached[t] = e, this.di("update current tag closable: ", e), this._cachedChange.next({ active: "closable", closable: e, list: this._cached }) }, enumerable: !1, configurable: !0 }), e.prototype.getClosable = function (e, t) { if (void 0 !== this._closableCached[e]) return this._closableCached[e]; if (t && t.data && "boolean" == typeof t.data.reuseClosable) return t.data.reuseClosable; var n = this.mode !== C.URL ? this.getMenu(e) : null; return !n || "boolean" != typeof n.reuseClosable || n.reuseClosable }, e.prototype.clearClosableCached = function () { this._closableCached = {} }, e.prototype.getTruthRoute = function (e) { for (var t = e; t.firstChild;)t = t.firstChild; return t }, e.prototype.getUrl = function (e) { for (var t = this.getTruthRoute(e), n = []; t;)n.push(t.url.join("/")), t = t.parent; return "/" + n.filter((function (e) { return e })).reverse().join("/") }, e.prototype.can = function (e) { var t = this.getUrl(e); if (t === this.removeUrlBuffer) return !1; if (e.data && "boolean" == typeof e.data.reuse) return e.data.reuse; if (this.mode !== C.URL) { var n = this.getMenu(t); if (!n) return !1; if (this.mode === C.Menu) { if (!1 === n.reuse) return !1 } else if (!n.reuse || !0 !== n.reuse) return !1; return !0 } return !this.isExclude(t) }, e.prototype.isExclude = function (e) { return -1 !== this.excludes.findIndex((function (t) { return t.test(e) })) }, e.prototype.refresh = function (e) { this._cachedChange.next({ active: "refresh", data: e }) }, e.prototype.destroy = function (e) { e && e.componentRef && e.componentRef.destroy && e.componentRef.destroy() }, e.prototype.di = function () { for (var e = [], t = 0; t < arguments.length; t++)e[t] = arguments[t]; this.debug && console.warn.apply(console, x(e)) }, e.prototype.init = function () { this.initScroll(), this._inited = !0 }, e.prototype.getMenu = function (e) { var t = this.menuService.getPathByUrl(e); return t && 0 !== t.length ? t.pop() : null }, e.prototype.runHook = function (e, t, n) { (void 0 === n && (n = "init"), "number" == typeof t) && (t = this._cached[t]._handle.componentRef); var o = t.instance; if (null != t && o) { var i = o[e]; "function" == typeof i && ("_onReuseInit" === e ? i.call(o, n) : i.call(o)) } }, e.prototype.hasInValidRoute = function (e) { return !e.routeConfig || !!e.routeConfig.loadChildren || !!e.routeConfig.children }, e.prototype.shouldDetach = function (e) { return !this.hasInValidRoute(e) && (this.di("#shouldDetach", this.can(e), this.getUrl(e)), this.can(e)) }, e.prototype.store = function (e, t) { var n = this.getUrl(e), o = this.index(n), i = -1 === o, r = { title: this.getTitle(n, e), closable: this.getClosable(n, e), position: this.getKeepingScroll(n, e) ? this.positionBuffer[n] : null, url: n, _snapshot: e, _handle: t }; if (i) { if (this.count >= this._max) { var s = this._cached.findIndex((function (e) { return e.closable })); -1 !== s && this.remove(s, !1) } this._cached.push(r) } else this._cached[o] = r; this.removeUrlBuffer = null, this.di("#store", i ? "[new]" : "[override]", n), t && t.componentRef && this.runHook("_onReuseDestroy", t.componentRef), i || this._cachedChange.next({ active: "override", item: r, list: this._cached }) }, e.prototype.shouldAttach = function (e) { if (this.hasInValidRoute(e)) return !1; var t = this.getUrl(e), n = this.get(t), o = !(!n || !n._handle); if (this.di("#shouldAttach", o, t), o) { var i = n._handle.componentRef; i && (this.componentRef = i, this.runHook("_onReuseInit", i)) } else this._cachedChange.next({ active: "add", url: t, list: this._cached }); return o }, e.prototype.retrieve = function (e) { if (this.hasInValidRoute(e)) return null; var t = this.getUrl(e), n = this.get(t), o = n && n._handle || null; return this.di("#retrieve", t, o), o }, e.prototype.shouldReuseRoute = function (e, t) { var n = e.routeConfig === t.routeConfig; if (!n) return !1; var o = e.routeConfig && e.routeConfig.path || ""; return o.length > 0 && ~o.indexOf(":") && (n = "strict" === this.routeParamMatchMode ? this.getUrl(e) === this.getUrl(t) : o === (t.routeConfig && t.routeConfig.path || "")), this.di("====================="), this.di("#shouldReuseRoute", n, this.getUrl(t) + "=>" + this.getUrl(e), e, t), n }, e.prototype.getKeepingScroll = function (e, t) { if (t && t.data && "boolean" == typeof t.data.keepingScroll) return t.data.keepingScroll; var n = this.mode !== C.URL ? this.getMenu(e) : null; return n && "boolean" == typeof n.keepingScroll ? n.keepingScroll : this.keepingScroll }, Object.defineProperty(e.prototype, "isDisabledInRouter", { get: function () { return "disabled" === this.injector.get(c.ROUTER_CONFIGURATION, {}).scrollPositionRestoration }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "ss", { get: function () { return this.injector.get(n.ScrollService) }, enumerable: !1, configurable: !0 }), e.prototype.initScroll = function () { var e = this; this._router$ && this._router$.unsubscribe(), this._router$ = this.injector.get(c.Router).events.subscribe((function (t) { if (t instanceof c.NavigationStart) { var n = e.curUrl; e.getKeepingScroll(n, e.getTruthRoute(e.snapshot)) ? e.positionBuffer[n] = e.ss.getScrollPosition(e.keepingScrollContainer) : delete e.positionBuffer[n] } else if (t instanceof c.NavigationEnd) { n = e.curUrl; var o = e.get(n); o && o.position && e.getKeepingScroll(n, e.getTruthRoute(e.snapshot)) && (e.isDisabledInRouter ? e.ss.scrollToPosition(e.keepingScrollContainer, o.position) : setTimeout((function () { return e.ss.scrollToPosition(e.keepingScrollContainer, o.position) }), 1)) } })) }, e.prototype.ngOnDestroy = function () { var e = this._cachedChange, t = this._router$; this.clear(), this._cached = [], e.complete(), t && t.unsubscribe() }, e }(); _.decorators = [{ type: t.Injectable, args: [{ providedIn: "root" }] }], _.ctorParameters = function () { return [{ type: t.Injector }, { type: n.MenuService }] }, _.ɵprov = t.ɵɵdefineInjectable({ factory: function () { return new _(t.ɵɵinject(t.INJECTOR), t.ɵɵinject(n.MenuService)) }, token: _, providedIn: "root" }); var M = function () { function e(e, n, i, r, s, c) { this.srv = e, this.cdr = n, this.router = i, this.route = r, this.i18nSrv = s, this.doc = c, this.unsubscribe$ = new o.Subject, this.updatePos$ = new o.Subject, this.list = [], this.pos = 0, this.mode = C.Menu, this.debug = !1, this.allowClose = !0, this.keepingScroll = !1, this.customContextMenu = [], this.tabType = "line", this.routeParamMatchMode = "strict", this.change = new t.EventEmitter, this.close = new t.EventEmitter } return Object.defineProperty(e.prototype, "keepingScrollContainer", { set: function (e) { this._keepingScrollContainer = "string" == typeof e ? this.doc.querySelector(e) : e }, enumerable: !1, configurable: !0 }), e.prototype.genTit = function (e) { return e.i18n && this.i18nSrv ? this.i18nSrv.fanyi(e.i18n) : e.text }, Object.defineProperty(e.prototype, "curUrl", { get: function () { return this.srv.getUrl(this.route.snapshot) }, enumerable: !1, configurable: !0 }), e.prototype.genCurItem = function () { var e = this.curUrl, t = this.srv.getTruthRoute(this.route.snapshot); return { url: e, title: this.genTit(this.srv.getTitle(e, t)), closable: this.allowClose && this.srv.count > 0 && this.srv.getClosable(e, t), active: !1, last: !1, index: 0 } }, e.prototype.genList = function (e) { var t = this, n = this.srv.items.map((function (e, n) { return { url: e.url, title: t.genTit(e.title), closable: t.allowClose && e.closable && t.srv.count > 0, index: n, active: !1, last: !1 } })), o = this.curUrl, i = -1 === n.findIndex((function (e) { return e.url === o })); if (e && "close" === e.active && e.url === o) { i = !1; var r = 0, s = this.list.find((function (e) { return e.url === o })); s.index === n.length ? r = n.length - 1 : s.index < n.length && (r = Math.max(0, s.index)), this.router.navigateByUrl(n[r].url) } i && n.push(this.genCurItem()), n.forEach((function (e, t) { return e.index = t })), 1 === n.length && (n[0].closable = !1), this.list = n, this.cdr.detectChanges(), this.updatePos$.next() }, e.prototype.updateTitle = function (e) { var t = this.list.find((function (t) { return t.url === e.url })); t && (t.title = this.genTit(e.title), this.cdr.detectChanges()) }, e.prototype.refresh = function (e) { this.srv.runHook("_onReuseInit", this.pos === e.index ? this.srv.componentRef : e.index, "refresh") }, e.prototype.contextMenuChange = function (e) { var t = this, n = null; switch (e.type) { case "refresh": this.refresh(e.item); break; case "close": this._close(null, e.item.index, e.includeNonCloseable); break; case "closeRight": n = function () { t.srv.closeRight(e.item.url, e.includeNonCloseable), t.close.emit(null) }; break; case "closeOther": n = function () { t.srv.clear(e.includeNonCloseable), t.close.emit(null) } }n && (!e.item.active && e.item.index <= this.list.find((function (e) { return e.active })).index ? this._to(e.item.index, n) : n()) }, e.prototype._to = function (e, t) { var n = this; e = Math.max(0, Math.min(e, this.list.length - 1)); var o = this.list[e]; this.router.navigateByUrl(o.url).then((function (e) { e && (n.item = o, n.change.emit(o), t && t()) })) }, e.prototype._close = function (e, t, n) { null != e && (e.preventDefault(), e.stopPropagation()); var o = this.list[t]; return this.srv.close(o.url, n), this.close.emit(o), this.cdr.detectChanges(), !1 }, e.prototype.activate = function (e) { this.srv.componentRef = { instance: e } }, e.prototype.ngOnInit = function () { var e = this; this.updatePos$.pipe(u.takeUntil(this.unsubscribe$), u.debounceTime(50)).subscribe((function () { var t = e.srv.getUrl(e.route.snapshot), n = e.list.filter((function (n) { return n.url === t || !e.srv.isExclude(n.url) })); if (0 !== n.length) { var o = n[n.length - 1], i = n.find((function (e) { return e.url === t })); o.last = !0; var r = null == i ? o.index : i.index; n.forEach((function (e, t) { return e.active = r === t })), e.pos = r, e.tabset.nzSelectedIndex = r, e.list = n, e.cdr.detectChanges() } })), this.srv.change.pipe(u.takeUntil(this.unsubscribe$)).subscribe((function (t) { var n; switch (null == t ? void 0 : t.active) { case "title": return void e.updateTitle(t); case "override": if ((null === (n = null == t ? void 0 : t.list) || void 0 === n ? void 0 : n.length) === e.list.length) return void e.updatePos$.next() }e.genList(t) })), this.i18nSrv.change.pipe(u.filter((function () { return e.srv.inited })), u.takeUntil(this.unsubscribe$), u.debounceTime(100)).subscribe((function () { return e.genList({ active: "title" }) })), this.srv.init() }, e.prototype.ngOnChanges = function (e) { e.max && (this.srv.max = this.max), e.excludes && (this.srv.excludes = this.excludes), e.mode && (this.srv.mode = this.mode), e.routeParamMatchMode && (this.srv.routeParamMatchMode = this.routeParamMatchMode), e.keepingScroll && (this.srv.keepingScroll = this.keepingScroll, this.srv.keepingScrollContainer = this._keepingScrollContainer), this.srv.debug = this.debug, this.cdr.detectChanges() }, e.prototype.ngOnDestroy = function () { var e = this.unsubscribe$; e.next(), e.complete() }, e }(); M.decorators = [{ type: t.Component, args: [{ selector: "reuse-tab, [reuse-tab]", exportAs: "reuseTab", template: '<nz-tabset\n #tabset\n [nzSelectedIndex]="pos"\n [nzAnimated]="false"\n [nzType]="tabType"\n [nzTabBarExtraContent]="tabBarExtraContent"\n [nzTabBarGutter]="tabBarGutter"\n [nzTabBarStyle]="tabBarStyle"\n>\n <nz-tab *ngFor="let i of list; let index = index" [nzTitle]="titleTemplate" (nzClick)="_to(index)">\n <ng-template #titleTemplate>\n <div [reuse-tab-context-menu]="i" [customContextMenu]="customContextMenu" class="reuse-tab__name" [attr.title]="i.title">\n <span [class.reuse-tab__name-width]="tabMaxWidth" [style.max-width.px]="tabMaxWidth">\n {{ i.title }}\n </span>\n </div>\n <i *ngIf="i.closable" nz-icon nzType="close" class="reuse-tab__op" (click)="_close($event, index, false)"></i>\n </ng-template>\n </nz-tab>\n</nz-tabset>\n<reuse-tab-context [i18n]="i18n" (change)="contextMenuChange($event)"></reuse-tab-context>\n', host: { "[class.reuse-tab]": "true", "[class.reuse-tab__line]": "tabType === 'line'", "[class.reuse-tab__card]": "tabType === 'card'" }, providers: [f], preserveWhitespaces: !1, changeDetection: t.ChangeDetectionStrategy.OnPush, encapsulation: t.ViewEncapsulation.None }] }], M.ctorParameters = function () { return [{ type: _ }, { type: t.ChangeDetectorRef }, { type: c.Router }, { type: c.ActivatedRoute }, { type: void 0, decorators: [{ type: t.Optional }, { type: t.Inject, args: [n.OHAYO_I18N_TOKEN] }] }, { type: void 0, decorators: [{ type: t.Inject, args: [s.DOCUMENT] }] }] }, M.propDecorators = { tabset: [{ type: t.ViewChild, args: ["tabset"] }], mode: [{ type: t.Input }], i18n: [{ type: t.Input }], debug: [{ type: t.Input }], max: [{ type: t.Input }], tabMaxWidth: [{ type: t.Input }], excludes: [{ type: t.Input }], allowClose: [{ type: t.Input }], keepingScroll: [{ type: t.Input }], keepingScrollContainer: [{ type: t.Input }], customContextMenu: [{ type: t.Input }], tabBarExtraContent: [{ type: t.Input }], tabBarGutter: [{ type: t.Input }], tabBarStyle: [{ type: t.Input }], tabType: [{ type: t.Input }], routeParamMatchMode: [{ type: t.Input }], change: [{ type: t.Output }], close: [{ type: t.Output }] }, b([a.InputBoolean(), v("design:type", Object)], M.prototype, "debug", void 0), b([a.InputNumber(), v("design:type", Number)], M.prototype, "max", void 0), b([a.InputNumber(), v("design:type", Number)], M.prototype, "tabMaxWidth", void 0), b([a.InputBoolean(), v("design:type", Object)], M.prototype, "allowClose", void 0), b([a.InputBoolean(), v("design:type", Object)], M.prototype, "keepingScroll", void 0); var R = function () { function e(e) { this.srv = e } return e.prototype.shouldDetach = function (e) { return this.srv.shouldDetach(e) }, e.prototype.store = function (e, t) { this.srv.store(e, t) }, e.prototype.shouldAttach = function (e) { return this.srv.shouldAttach(e) }, e.prototype.retrieve = function (e) { return this.srv.retrieve(e) }, e.prototype.shouldReuseRoute = function (e, t) { return this.srv.shouldReuseRoute(e, t) }, e }(); var S = [M], I = [d, g, y], O = function () { }; O.decorators = [{ type: t.NgModule, args: [{ imports: [s.CommonModule, c.RouterModule, n.OhayoLocaleModule, h.NzMenuModule, p.NzTabsModule, l.NzIconModule, i.OverlayModule], declarations: x(S, I), exports: S }] }], e.ReuseTabMatchMode = C, e.ReuseTabModule = O, e.ReuseTabService = _, e.ReuseTabStrategy = R, e.ReuseTcomponentsomponent = M, e.ReuseTcomponentsontextComponent = g, e.ReuseTcomponentsontextDirective = y, e.ReuseTcomponentsontextMenuComponent = d, e.ReuseTcomponentsontextService = f, Object.defineProperty(e, "__esModule", { value: !0 }) })); //# sourceMappingURL=reuseTab.umd.min.js.map