1 | import * as i0 from '@angular/core';
|
---|
2 | import { Component, ChangeDetectionStrategy, ViewEncapsulation, Input, ViewChild, ContentChildren, NgModule } from '@angular/core';
|
---|
3 | import * as i1 from '@angular/common';
|
---|
4 | import { CommonModule } from '@angular/common';
|
---|
5 | import * as i3 from 'primeng/ripple';
|
---|
6 | import { RippleModule } from 'primeng/ripple';
|
---|
7 | import { PrimeTemplate, SharedModule } from 'primeng/api';
|
---|
8 | import * as i4 from '@angular/router';
|
---|
9 | import { RouterModule } from '@angular/router';
|
---|
10 | import { DomHandler } from 'primeng/dom';
|
---|
11 | import * as i2 from 'primeng/tooltip';
|
---|
12 | import { TooltipModule } from 'primeng/tooltip';
|
---|
13 |
|
---|
14 | class TabMenu {
|
---|
15 | ngAfterContentInit() {
|
---|
16 | this.templates.forEach((item) => {
|
---|
17 | switch (item.getType()) {
|
---|
18 | case 'item':
|
---|
19 | this.itemTemplate = item.template;
|
---|
20 | break;
|
---|
21 | default:
|
---|
22 | this.itemTemplate = item.template;
|
---|
23 | break;
|
---|
24 | }
|
---|
25 | });
|
---|
26 | }
|
---|
27 | ngAfterViewInit() {
|
---|
28 | this.updateInkBar();
|
---|
29 | }
|
---|
30 | ngAfterViewChecked() {
|
---|
31 | if (this.tabChanged) {
|
---|
32 | this.updateInkBar();
|
---|
33 | this.tabChanged = false;
|
---|
34 | }
|
---|
35 | }
|
---|
36 | itemClick(event, item) {
|
---|
37 | if (item.disabled) {
|
---|
38 | event.preventDefault();
|
---|
39 | return;
|
---|
40 | }
|
---|
41 | if (item.command) {
|
---|
42 | item.command({
|
---|
43 | originalEvent: event,
|
---|
44 | item: item
|
---|
45 | });
|
---|
46 | }
|
---|
47 | this.activeItem = item;
|
---|
48 | this.tabChanged = true;
|
---|
49 | }
|
---|
50 | updateInkBar() {
|
---|
51 | let tabHeader = DomHandler.findSingle(this.navbar.nativeElement, 'li.p-highlight');
|
---|
52 | if (tabHeader) {
|
---|
53 | this.inkbar.nativeElement.style.width = DomHandler.getWidth(tabHeader) + 'px';
|
---|
54 | this.inkbar.nativeElement.style.left = DomHandler.getOffset(tabHeader).left - DomHandler.getOffset(this.navbar.nativeElement).left + 'px';
|
---|
55 | }
|
---|
56 | }
|
---|
57 | }
|
---|
58 | TabMenu.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: TabMenu, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
---|
59 | TabMenu.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.0", type: TabMenu, selector: "p-tabMenu", inputs: { model: "model", activeItem: "activeItem", popup: "popup", style: "style", styleClass: "styleClass" }, host: { classAttribute: "p-element" }, queries: [{ propertyName: "templates", predicate: PrimeTemplate }], viewQueries: [{ propertyName: "navbar", first: true, predicate: ["navbar"], descendants: true }, { propertyName: "inkbar", first: true, predicate: ["inkbar"], descendants: true }], ngImport: i0, template: `
|
---|
60 | <div [ngClass]="'p-tabmenu p-component'" [ngStyle]="style" [class]="styleClass">
|
---|
61 | <ul #navbar class="p-tabmenu-nav p-reset" role="tablist">
|
---|
62 | <li *ngFor="let item of model; let i = index" role="tab" [ngStyle]="item.style" [class]="item.styleClass" [attr.aria-selected]="activeItem==item" [attr.aria-expanded]="activeItem==item"
|
---|
63 | [ngClass]="{'p-tabmenuitem':true,'p-disabled':item.disabled,'p-highlight':activeItem==item,'p-hidden': item.visible === false}" pTooltip [tooltipOptions]="item.tooltipOptions">
|
---|
64 | <a *ngIf="!item.routerLink" [attr.href]="item.url" class="p-menuitem-link" role="presentation" (click)="itemClick($event,item)" (keydown.enter)="itemClick($event,item)" [attr.tabindex]="item.disabled ? null : '0'"
|
---|
65 | [attr.target]="item.target" [attr.title]="item.title" [attr.id]="item.id" pRipple>
|
---|
66 | <ng-container *ngIf="!itemTemplate">
|
---|
67 | <span class="p-menuitem-icon" [ngClass]="item.icon" *ngIf="item.icon"></span>
|
---|
68 | <span class="p-menuitem-text" *ngIf="item.escape !== false; else htmlLabel">{{item.label}}</span>
|
---|
69 | <ng-template #htmlLabel><span class="p-menuitem-text" [innerHTML]="item.label"></span></ng-template>
|
---|
70 | </ng-container>
|
---|
71 | <ng-container *ngTemplateOutlet="itemTemplate; context: {$implicit: item, index: i}"></ng-container>
|
---|
72 | </a>
|
---|
73 | <a *ngIf="item.routerLink" [routerLink]="item.routerLink" [queryParams]="item.queryParams" [routerLinkActive]="'p-menuitem-link-active'" [routerLinkActiveOptions]="item.routerLinkActiveOptions||{exact:false}"
|
---|
74 | role="presentation" class="p-menuitem-link" (click)="itemClick($event,item)" (keydown.enter)="itemClick($event,item)" [attr.tabindex]="item.disabled ? null : '0'"
|
---|
75 | [attr.target]="item.target" [attr.title]="item.title" [attr.id]="item.id"
|
---|
76 | [fragment]="item.fragment" [queryParamsHandling]="item.queryParamsHandling" [preserveFragment]="item.preserveFragment" [skipLocationChange]="item.skipLocationChange" [replaceUrl]="item.replaceUrl" [state]="item.state" pRipple>
|
---|
77 | <ng-container *ngIf="!itemTemplate">
|
---|
78 | <span class="p-menuitem-icon" [ngClass]="item.icon" *ngIf="item.icon"></span>
|
---|
79 | <span class="p-menuitem-text" *ngIf="item.escape !== false; else htmlRouteLabel">{{item.label}}</span>
|
---|
80 | <ng-template #htmlRouteLabel><span class="p-menuitem-text" [innerHTML]="item.label"></span></ng-template>
|
---|
81 | </ng-container>
|
---|
82 | <ng-container *ngTemplateOutlet="itemTemplate; context: {$implicit: item, index: i}"></ng-container>
|
---|
83 | </a>
|
---|
84 | </li>
|
---|
85 | <li #inkbar class="p-tabmenu-ink-bar"></li>
|
---|
86 | </ul>
|
---|
87 | </div>
|
---|
88 | `, isInline: true, styles: [".p-tabmenu{overflow-x:auto}.p-tabmenu-nav{display:flex;margin:0;padding:0;list-style-type:none;flex-wrap:nowrap}.p-tabmenu-nav a{cursor:pointer;-webkit-user-select:none;-ms-user-select:none;user-select:none;display:flex;align-items:center;position:relative;text-decoration:none;overflow:hidden}.p-tabmenu-nav a:focus{z-index:1}.p-tabmenu-nav .p-menuitem-text{line-height:1}.p-tabmenu-ink-bar{display:none;z-index:1}.p-tabmenu::-webkit-scrollbar{display:none}\n"], directives: [{ type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.Ripple, selector: "[pRipple]" }, { type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i4.RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "preserveFragment", "skipLocationChange", "replaceUrl", "state", "relativeTo", "routerLink"] }, { type: i4.RouterLinkActive, selector: "[routerLinkActive]", inputs: ["routerLinkActiveOptions", "routerLinkActive"], outputs: ["isActiveChange"], exportAs: ["routerLinkActive"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
---|
89 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: TabMenu, decorators: [{
|
---|
90 | type: Component,
|
---|
91 | args: [{ selector: 'p-tabMenu', template: `
|
---|
92 | <div [ngClass]="'p-tabmenu p-component'" [ngStyle]="style" [class]="styleClass">
|
---|
93 | <ul #navbar class="p-tabmenu-nav p-reset" role="tablist">
|
---|
94 | <li *ngFor="let item of model; let i = index" role="tab" [ngStyle]="item.style" [class]="item.styleClass" [attr.aria-selected]="activeItem==item" [attr.aria-expanded]="activeItem==item"
|
---|
95 | [ngClass]="{'p-tabmenuitem':true,'p-disabled':item.disabled,'p-highlight':activeItem==item,'p-hidden': item.visible === false}" pTooltip [tooltipOptions]="item.tooltipOptions">
|
---|
96 | <a *ngIf="!item.routerLink" [attr.href]="item.url" class="p-menuitem-link" role="presentation" (click)="itemClick($event,item)" (keydown.enter)="itemClick($event,item)" [attr.tabindex]="item.disabled ? null : '0'"
|
---|
97 | [attr.target]="item.target" [attr.title]="item.title" [attr.id]="item.id" pRipple>
|
---|
98 | <ng-container *ngIf="!itemTemplate">
|
---|
99 | <span class="p-menuitem-icon" [ngClass]="item.icon" *ngIf="item.icon"></span>
|
---|
100 | <span class="p-menuitem-text" *ngIf="item.escape !== false; else htmlLabel">{{item.label}}</span>
|
---|
101 | <ng-template #htmlLabel><span class="p-menuitem-text" [innerHTML]="item.label"></span></ng-template>
|
---|
102 | </ng-container>
|
---|
103 | <ng-container *ngTemplateOutlet="itemTemplate; context: {$implicit: item, index: i}"></ng-container>
|
---|
104 | </a>
|
---|
105 | <a *ngIf="item.routerLink" [routerLink]="item.routerLink" [queryParams]="item.queryParams" [routerLinkActive]="'p-menuitem-link-active'" [routerLinkActiveOptions]="item.routerLinkActiveOptions||{exact:false}"
|
---|
106 | role="presentation" class="p-menuitem-link" (click)="itemClick($event,item)" (keydown.enter)="itemClick($event,item)" [attr.tabindex]="item.disabled ? null : '0'"
|
---|
107 | [attr.target]="item.target" [attr.title]="item.title" [attr.id]="item.id"
|
---|
108 | [fragment]="item.fragment" [queryParamsHandling]="item.queryParamsHandling" [preserveFragment]="item.preserveFragment" [skipLocationChange]="item.skipLocationChange" [replaceUrl]="item.replaceUrl" [state]="item.state" pRipple>
|
---|
109 | <ng-container *ngIf="!itemTemplate">
|
---|
110 | <span class="p-menuitem-icon" [ngClass]="item.icon" *ngIf="item.icon"></span>
|
---|
111 | <span class="p-menuitem-text" *ngIf="item.escape !== false; else htmlRouteLabel">{{item.label}}</span>
|
---|
112 | <ng-template #htmlRouteLabel><span class="p-menuitem-text" [innerHTML]="item.label"></span></ng-template>
|
---|
113 | </ng-container>
|
---|
114 | <ng-container *ngTemplateOutlet="itemTemplate; context: {$implicit: item, index: i}"></ng-container>
|
---|
115 | </a>
|
---|
116 | </li>
|
---|
117 | <li #inkbar class="p-tabmenu-ink-bar"></li>
|
---|
118 | </ul>
|
---|
119 | </div>
|
---|
120 | `, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
---|
121 | 'class': 'p-element'
|
---|
122 | }, styles: [".p-tabmenu{overflow-x:auto}.p-tabmenu-nav{display:flex;margin:0;padding:0;list-style-type:none;flex-wrap:nowrap}.p-tabmenu-nav a{cursor:pointer;-webkit-user-select:none;-ms-user-select:none;user-select:none;display:flex;align-items:center;position:relative;text-decoration:none;overflow:hidden}.p-tabmenu-nav a:focus{z-index:1}.p-tabmenu-nav .p-menuitem-text{line-height:1}.p-tabmenu-ink-bar{display:none;z-index:1}.p-tabmenu::-webkit-scrollbar{display:none}\n"] }]
|
---|
123 | }], propDecorators: { model: [{
|
---|
124 | type: Input
|
---|
125 | }], activeItem: [{
|
---|
126 | type: Input
|
---|
127 | }], popup: [{
|
---|
128 | type: Input
|
---|
129 | }], style: [{
|
---|
130 | type: Input
|
---|
131 | }], styleClass: [{
|
---|
132 | type: Input
|
---|
133 | }], navbar: [{
|
---|
134 | type: ViewChild,
|
---|
135 | args: ['navbar']
|
---|
136 | }], inkbar: [{
|
---|
137 | type: ViewChild,
|
---|
138 | args: ['inkbar']
|
---|
139 | }], templates: [{
|
---|
140 | type: ContentChildren,
|
---|
141 | args: [PrimeTemplate]
|
---|
142 | }] } });
|
---|
143 | class TabMenuModule {
|
---|
144 | }
|
---|
145 | TabMenuModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: TabMenuModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
---|
146 | TabMenuModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: TabMenuModule, declarations: [TabMenu], imports: [CommonModule, RouterModule, SharedModule, RippleModule, TooltipModule], exports: [TabMenu, RouterModule, SharedModule, TooltipModule] });
|
---|
147 | TabMenuModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: TabMenuModule, imports: [[CommonModule, RouterModule, SharedModule, RippleModule, TooltipModule], RouterModule, SharedModule, TooltipModule] });
|
---|
148 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: TabMenuModule, decorators: [{
|
---|
149 | type: NgModule,
|
---|
150 | args: [{
|
---|
151 | imports: [CommonModule, RouterModule, SharedModule, RippleModule, TooltipModule],
|
---|
152 | exports: [TabMenu, RouterModule, SharedModule, TooltipModule],
|
---|
153 | declarations: [TabMenu]
|
---|
154 | }]
|
---|
155 | }] });
|
---|
156 |
|
---|
157 | /**
|
---|
158 | * Generated bundle index. Do not edit.
|
---|
159 | */
|
---|
160 |
|
---|
161 | export { TabMenu, TabMenuModule };
|
---|