UNPKG

yoyo-ng-modulewindy

Version:

服务于52ABP模板的前端开源的相关组件内容。整合了ng-alain和你NG ZORRO的内容

70 lines 3.23 kB
import { Component, Input, EventEmitter, Output, HostListener, } from '@angular/core'; var ReuseTabContextMenuComponent = /** @class */ (function () { function ReuseTabContextMenuComponent() { this.close = new EventEmitter(); } Object.defineProperty(ReuseTabContextMenuComponent.prototype, "i18n", { get: function () { return this._i18n; }, set: function (value) { this._i18n = Object.assign({ close: '关闭标签', closeOther: '关闭其它标签', closeRight: '关闭右侧标签', clear: '清空', }, value); }, enumerable: true, configurable: true }); Object.defineProperty(ReuseTabContextMenuComponent.prototype, "includeNonCloseable", { get: function () { return this.event.ctrlKey; }, enumerable: true, configurable: true }); ReuseTabContextMenuComponent.prototype.notify = function (type, item) { this.close.next({ type: type, item: this.item, includeNonCloseable: this.includeNonCloseable, }); }; ReuseTabContextMenuComponent.prototype.ngOnInit = function () { if (this.includeNonCloseable) this.item.closable = true; }; ReuseTabContextMenuComponent.prototype.click = function (e, type) { e.preventDefault(); e.stopPropagation(); if (type === 'close' && !this.item.closable) return; if (type === 'closeRight' && this.item.last) return; this.notify(type, this.item); }; ReuseTabContextMenuComponent.prototype.closeMenu = function (event) { if (event.type === 'click' && event.button === 2) return; this.notify(null, null); }; ReuseTabContextMenuComponent.decorators = [ { type: Component, args: [{ selector: 'reuse-tab-context-menu', template: "\n <ul nz-menu>\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 <li nz-menu-item (click)=\"click($event, 'clear')\" data-type=\"clear\" [innerHTML]=\"i18n.clear\"></li>\n </ul>", preserveWhitespaces: false, },] }, ]; ReuseTabContextMenuComponent.propDecorators = { i18n: [{ type: Input }], item: [{ type: Input }], event: [{ type: Input }], close: [{ type: Output }], closeMenu: [{ type: HostListener, args: ['document:click', ['$event'],] }, { type: HostListener, args: ['document:contextmenu', ['$event'],] }] }; return ReuseTabContextMenuComponent; }()); export { ReuseTabContextMenuComponent }; //# sourceMappingURL=reuse-tab-context-menu.component.js.map