UNPKG

ng-zorro-antd

Version:

An enterprise-class UI components based on Ant Design and Angular

173 lines 18.1 kB
/** * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */ import { NgForOf, NgIf } from '@angular/common'; import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output, ViewEncapsulation } from '@angular/core'; import { NzOutletModule } from 'ng-zorro-antd/core/outlet'; import { NzDropDownDirective, NzDropdownMenuComponent } from 'ng-zorro-antd/dropdown'; import { NzIconModule } from 'ng-zorro-antd/icon'; import { NzMenuModule } from 'ng-zorro-antd/menu'; import { NzTabAddButtonComponent } from './tab-add-button.component'; import * as i0 from "@angular/core"; import * as i1 from "ng-zorro-antd/icon"; import * as i2 from "ng-zorro-antd/core/outlet"; import * as i3 from "ng-zorro-antd/menu"; export class NzTabNavOperationComponent { constructor(cdr, elementRef) { this.cdr = cdr; this.elementRef = elementRef; this.items = []; this.addable = false; this.addIcon = 'plus'; this.addClicked = new EventEmitter(); this.selected = new EventEmitter(); this.menuOpened = false; this.element = this.elementRef.nativeElement; } onSelect(item) { if (!item.disabled) { // ignore nzCanDeactivate item.tab.nzClick.emit(); this.selected.emit(item); } } onContextmenu(item, e) { if (!item.disabled) { item.tab.nzContextmenu.emit(e); } } showItems() { clearTimeout(this.closeAnimationWaitTimeoutId); this.menuOpened = true; this.cdr.markForCheck(); } menuVisChange(visible) { if (!visible) { this.closeAnimationWaitTimeoutId = setTimeout(() => { this.menuOpened = false; this.cdr.markForCheck(); }, 150); } } getElementWidth() { return this.element?.offsetWidth || 0; } getElementHeight() { return this.element?.offsetHeight || 0; } ngOnDestroy() { clearTimeout(this.closeAnimationWaitTimeoutId); } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: NzTabNavOperationComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); } static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.4", type: NzTabNavOperationComponent, isStandalone: true, selector: "nz-tab-nav-operation", inputs: { items: "items", addable: "addable", addIcon: "addIcon" }, outputs: { addClicked: "addClicked", selected: "selected" }, host: { properties: { "class.ant-tabs-nav-operations-hidden": "items.length === 0" }, classAttribute: "ant-tabs-nav-operations" }, exportAs: ["nzTabNavOperation"], ngImport: i0, template: ` <button nz-dropdown class="ant-tabs-nav-more" type="button" tabindex="-1" aria-hidden="true" nzOverlayClassName="nz-tabs-dropdown" #dropdownTrigger="nzDropdown" [nzDropdownMenu]="menu" [nzOverlayStyle]="{ minWidth: '46px' }" [nzMatchWidthElement]="null" (nzVisibleChange)="menuVisChange($event)" (mouseenter)="showItems()" > <span nz-icon nzType="ellipsis"></span> </button> <nz-dropdown-menu #menu="nzDropdownMenu"> <ul nz-menu *ngIf="menuOpened"> <li nz-menu-item *ngFor="let item of items" class="ant-tabs-dropdown-menu-item" [class.ant-tabs-dropdown-menu-item-disabled]="item.disabled" [nzSelected]="item.active" [nzDisabled]="item.disabled" (click)="onSelect(item)" (contextmenu)="onContextmenu(item, $event)" > <ng-container *nzStringTemplateOutlet="item.tab.label; context: { visible: false }"> {{ item.tab.label }} </ng-container> </li> </ul> </nz-dropdown-menu> <button *ngIf="addable" nz-tab-add-button [addIcon]="addIcon" (click)="addClicked.emit()"></button> `, isInline: true, dependencies: [{ kind: "ngmodule", type: NzIconModule }, { kind: "directive", type: i1.NzIconDirective, selector: "[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "ngmodule", type: NzOutletModule }, { kind: "directive", type: i2.NzStringTemplateOutletDirective, selector: "[nzStringTemplateOutlet]", inputs: ["nzStringTemplateOutletContext", "nzStringTemplateOutlet"], exportAs: ["nzStringTemplateOutlet"] }, { kind: "component", type: NzTabAddButtonComponent, selector: "nz-tab-add-button, button[nz-tab-add-button]", inputs: ["addIcon"] }, { kind: "component", type: NzDropdownMenuComponent, selector: "nz-dropdown-menu", exportAs: ["nzDropdownMenu"] }, { kind: "ngmodule", type: NzMenuModule }, { kind: "directive", type: i3.NzMenuDirective, selector: "[nz-menu]", inputs: ["nzInlineIndent", "nzTheme", "nzMode", "nzInlineCollapsed", "nzSelectable"], outputs: ["nzClick"], exportAs: ["nzMenu"] }, { kind: "component", type: i3.NzMenuItemComponent, selector: "[nz-menu-item]", inputs: ["nzPaddingLeft", "nzDisabled", "nzSelected", "nzDanger", "nzMatchRouterExact", "nzMatchRouter"], exportAs: ["nzMenuItem"] }, { kind: "directive", type: NzDropDownDirective, selector: "[nz-dropdown]", inputs: ["nzDropdownMenu", "nzTrigger", "nzMatchWidthElement", "nzBackdrop", "nzClickHide", "nzDisabled", "nzVisible", "nzOverlayClassName", "nzOverlayStyle", "nzPlacement"], outputs: ["nzVisibleChange"], exportAs: ["nzDropdown"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: NzTabNavOperationComponent, decorators: [{ type: Component, args: [{ selector: 'nz-tab-nav-operation', exportAs: 'nzTabNavOperation', preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: ` <button nz-dropdown class="ant-tabs-nav-more" type="button" tabindex="-1" aria-hidden="true" nzOverlayClassName="nz-tabs-dropdown" #dropdownTrigger="nzDropdown" [nzDropdownMenu]="menu" [nzOverlayStyle]="{ minWidth: '46px' }" [nzMatchWidthElement]="null" (nzVisibleChange)="menuVisChange($event)" (mouseenter)="showItems()" > <span nz-icon nzType="ellipsis"></span> </button> <nz-dropdown-menu #menu="nzDropdownMenu"> <ul nz-menu *ngIf="menuOpened"> <li nz-menu-item *ngFor="let item of items" class="ant-tabs-dropdown-menu-item" [class.ant-tabs-dropdown-menu-item-disabled]="item.disabled" [nzSelected]="item.active" [nzDisabled]="item.disabled" (click)="onSelect(item)" (contextmenu)="onContextmenu(item, $event)" > <ng-container *nzStringTemplateOutlet="item.tab.label; context: { visible: false }"> {{ item.tab.label }} </ng-container> </li> </ul> </nz-dropdown-menu> <button *ngIf="addable" nz-tab-add-button [addIcon]="addIcon" (click)="addClicked.emit()"></button> `, host: { class: 'ant-tabs-nav-operations', '[class.ant-tabs-nav-operations-hidden]': 'items.length === 0' }, imports: [ NzIconModule, NgIf, NgForOf, NzOutletModule, NzTabAddButtonComponent, NzDropdownMenuComponent, NzMenuModule, NzDropDownDirective ], standalone: true }] }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }], propDecorators: { items: [{ type: Input }], addable: [{ type: Input }], addIcon: [{ type: Input }], addClicked: [{ type: Output }], selected: [{ type: Output }] } }); //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFiLW5hdi1vcGVyYXRpb24uY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vY29tcG9uZW50cy90YWJzL3RhYi1uYXYtb3BlcmF0aW9uLmNvbXBvbmVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7O0dBR0c7QUFFSCxPQUFPLEVBQUUsT0FBTyxFQUFFLElBQUksRUFBRSxNQUFNLGlCQUFpQixDQUFDO0FBQ2hELE9BQU8sRUFDTCx1QkFBdUIsRUFFdkIsU0FBUyxFQUVULFlBQVksRUFDWixLQUFLLEVBRUwsTUFBTSxFQUVOLGlCQUFpQixFQUNsQixNQUFNLGVBQWUsQ0FBQztBQUV2QixPQUFPLEVBQUUsY0FBYyxFQ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