source: trip-planner-front/node_modules/primeng/fesm2020/primeng-menubar.mjs@ b738035

Last change on this file since b738035 was 59329aa, checked in by Ema <ema_spirova@…>, 3 years ago

adding photos

  • Property mode set to 100644
File size: 22.7 KB
RevLine 
[59329aa]1import * as i0 from '@angular/core';
2import { EventEmitter, Component, ViewEncapsulation, Input, Output, ChangeDetectionStrategy, ContentChildren, ViewChild, NgModule } from '@angular/core';
3import * as i1 from '@angular/common';
4import { CommonModule } from '@angular/common';
5import { ZIndexUtils } from 'primeng/utils';
6import * as i5 from 'primeng/api';
7import { PrimeTemplate } from 'primeng/api';
8import * as i4 from '@angular/router';
9import { RouterModule } from '@angular/router';
10import * as i3 from 'primeng/ripple';
11import { RippleModule } from 'primeng/ripple';
12import * as i2 from 'primeng/tooltip';
13import { TooltipModule } from 'primeng/tooltip';
14
15class MenubarSub {
16 constructor(el, renderer, cd) {
17 this.el = el;
18 this.renderer = renderer;
19 this.cd = cd;
20 this.autoZIndex = true;
21 this.baseZIndex = 0;
22 this.leafClick = new EventEmitter();
23 this.menuHoverActive = false;
24 }
25 get parentActive() {
26 return this._parentActive;
27 }
28 set parentActive(value) {
29 if (!this.root) {
30 this._parentActive = value;
31 if (!value)
32 this.activeItem = null;
33 }
34 }
35 onItemClick(event, item) {
36 if (item.disabled) {
37 event.preventDefault();
38 return;
39 }
40 if (!item.url && !item.routerLink) {
41 event.preventDefault();
42 }
43 if (item.command) {
44 item.command({
45 originalEvent: event,
46 item: item
47 });
48 }
49 if (item.items) {
50 if (this.activeItem && item === this.activeItem) {
51 this.activeItem = null;
52 this.unbindDocumentClickListener();
53 }
54 else {
55 this.activeItem = item;
56 if (this.root) {
57 this.bindDocumentClickListener();
58 }
59 }
60 }
61 if (!item.items) {
62 this.onLeafClick();
63 }
64 }
65 onItemMouseEnter(event, item) {
66 if (item.disabled || this.mobileActive) {
67 event.preventDefault();
68 return;
69 }
70 if (this.root) {
71 if (this.activeItem || this.autoDisplay) {
72 this.activeItem = item;
73 this.bindDocumentClickListener();
74 }
75 }
76 else {
77 this.activeItem = item;
78 this.bindDocumentClickListener();
79 }
80 }
81 onLeafClick() {
82 this.activeItem = null;
83 if (this.root) {
84 this.unbindDocumentClickListener();
85 }
86 this.leafClick.emit();
87 }
88 bindDocumentClickListener() {
89 if (!this.documentClickListener) {
90 this.documentClickListener = (event) => {
91 if (this.el && !this.el.nativeElement.contains(event.target)) {
92 this.activeItem = null;
93 this.cd.markForCheck();
94 this.unbindDocumentClickListener();
95 }
96 };
97 document.addEventListener('click', this.documentClickListener);
98 }
99 }
100 unbindDocumentClickListener() {
101 if (this.documentClickListener) {
102 document.removeEventListener('click', this.documentClickListener);
103 this.documentClickListener = null;
104 }
105 }
106 ngOnDestroy() {
107 this.unbindDocumentClickListener();
108 }
109}
110MenubarSub.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: MenubarSub, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
111MenubarSub.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.0", type: MenubarSub, selector: "p-menubarSub", inputs: { item: "item", root: "root", autoZIndex: "autoZIndex", baseZIndex: "baseZIndex", mobileActive: "mobileActive", autoDisplay: "autoDisplay", parentActive: "parentActive" }, outputs: { leafClick: "leafClick" }, host: { classAttribute: "p-element" }, ngImport: i0, template: `
112 <ul [ngClass]="{'p-submenu-list': !root, 'p-menubar-root-list': root}" [attr.role]="root ? 'menubar' : 'menu'">
113 <ng-template ngFor let-child [ngForOf]="(root ? item : item.items)">
114 <li *ngIf="child.separator" class="p-menu-separator" [ngClass]="{'p-hidden': child.visible === false}" role="separator">
115 <li *ngIf="!child.separator" #listItem [ngClass]="{'p-menuitem':true, 'p-menuitem-active': child === activeItem, 'p-hidden': child.visible === false}" [ngStyle]="child.style" [class]="child.styleClass" role="none" pTooltip [tooltipOptions]="child.tooltipOptions">
116 <a *ngIf="!child.routerLink" [attr.href]="child.url" [attr.data-automationid]="child.automationId" [attr.target]="child.target" [attr.title]="child.title" [attr.id]="child.id" role="menuitem"
117 (click)="onItemClick($event, child)" (mouseenter)="onItemMouseEnter($event,child)"
118 [ngClass]="{'p-menuitem-link':true,'p-disabled':child.disabled}" [attr.tabindex]="child.disabled ? null : '0'" [attr.aria-haspopup]="item.items != null" [attr.aria-expanded]="item === activeItem" pRipple>
119 <span class="p-menuitem-icon" *ngIf="child.icon" [ngClass]="child.icon"></span>
120 <span class="p-menuitem-text" *ngIf="child.escape !== false; else htmlLabel">{{child.label}}</span>
121 <ng-template #htmlLabel><span class="p-menuitem-text" [innerHTML]="child.label"></span></ng-template>
122 <span class="p-submenu-icon pi" *ngIf="child.items" [ngClass]="{'pi-angle-down':root,'pi-angle-right':!root}"></span>
123 </a>
124 <a *ngIf="child.routerLink" [routerLink]="child.routerLink" [attr.data-automationid]="child.automationId" [queryParams]="child.queryParams" [routerLinkActive]="'p-menuitem-link-active'" [routerLinkActiveOptions]="child.routerLinkActiveOptions||{exact:false}"
125 [attr.target]="child.target" [attr.title]="child.title" [attr.id]="child.id" [attr.tabindex]="child.disabled ? null : '0'" role="menuitem"
126 (click)="onItemClick($event, child)" (mouseenter)="onItemMouseEnter($event,child)"
127 [ngClass]="{'p-menuitem-link':true,'p-disabled':child.disabled}"
128 [fragment]="child.fragment" [queryParamsHandling]="child.queryParamsHandling" [preserveFragment]="child.preserveFragment" [skipLocationChange]="child.skipLocationChange" [replaceUrl]="child.replaceUrl" [state]="child.state" pRipple>
129 <span class="p-menuitem-icon" *ngIf="child.icon" [ngClass]="child.icon"></span>
130 <span class="p-menuitem-text" *ngIf="child.escape !== false; else htmlRouteLabel">{{child.label}}</span>
131 <ng-template #htmlRouteLabel><span class="p-menuitem-text" [innerHTML]="child.label"></span></ng-template>
132 <span class="p-submenu-icon pi" *ngIf="child.items" [ngClass]="{'pi-angle-down':root,'pi-angle-right':!root}"></span>
133 </a>
134 <p-menubarSub [parentActive]="child === activeItem" [item]="child" *ngIf="child.items" [mobileActive]="mobileActive" [autoDisplay]="autoDisplay" (leafClick)="onLeafClick()"></p-menubarSub>
135 </li>
136 </ng-template>
137 </ul>
138 `, isInline: true, components: [{ type: MenubarSub, selector: "p-menubarSub", inputs: ["item", "root", "autoZIndex", "baseZIndex", "mobileActive", "autoDisplay", "parentActive"], outputs: ["leafClick"] }], directives: [{ type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i3.Ripple, selector: "[pRipple]" }, { 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"] }], encapsulation: i0.ViewEncapsulation.None });
139i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: MenubarSub, decorators: [{
140 type: Component,
141 args: [{
142 selector: 'p-menubarSub',
143 template: `
144 <ul [ngClass]="{'p-submenu-list': !root, 'p-menubar-root-list': root}" [attr.role]="root ? 'menubar' : 'menu'">
145 <ng-template ngFor let-child [ngForOf]="(root ? item : item.items)">
146 <li *ngIf="child.separator" class="p-menu-separator" [ngClass]="{'p-hidden': child.visible === false}" role="separator">
147 <li *ngIf="!child.separator" #listItem [ngClass]="{'p-menuitem':true, 'p-menuitem-active': child === activeItem, 'p-hidden': child.visible === false}" [ngStyle]="child.style" [class]="child.styleClass" role="none" pTooltip [tooltipOptions]="child.tooltipOptions">
148 <a *ngIf="!child.routerLink" [attr.href]="child.url" [attr.data-automationid]="child.automationId" [attr.target]="child.target" [attr.title]="child.title" [attr.id]="child.id" role="menuitem"
149 (click)="onItemClick($event, child)" (mouseenter)="onItemMouseEnter($event,child)"
150 [ngClass]="{'p-menuitem-link':true,'p-disabled':child.disabled}" [attr.tabindex]="child.disabled ? null : '0'" [attr.aria-haspopup]="item.items != null" [attr.aria-expanded]="item === activeItem" pRipple>
151 <span class="p-menuitem-icon" *ngIf="child.icon" [ngClass]="child.icon"></span>
152 <span class="p-menuitem-text" *ngIf="child.escape !== false; else htmlLabel">{{child.label}}</span>
153 <ng-template #htmlLabel><span class="p-menuitem-text" [innerHTML]="child.label"></span></ng-template>
154 <span class="p-submenu-icon pi" *ngIf="child.items" [ngClass]="{'pi-angle-down':root,'pi-angle-right':!root}"></span>
155 </a>
156 <a *ngIf="child.routerLink" [routerLink]="child.routerLink" [attr.data-automationid]="child.automationId" [queryParams]="child.queryParams" [routerLinkActive]="'p-menuitem-link-active'" [routerLinkActiveOptions]="child.routerLinkActiveOptions||{exact:false}"
157 [attr.target]="child.target" [attr.title]="child.title" [attr.id]="child.id" [attr.tabindex]="child.disabled ? null : '0'" role="menuitem"
158 (click)="onItemClick($event, child)" (mouseenter)="onItemMouseEnter($event,child)"
159 [ngClass]="{'p-menuitem-link':true,'p-disabled':child.disabled}"
160 [fragment]="child.fragment" [queryParamsHandling]="child.queryParamsHandling" [preserveFragment]="child.preserveFragment" [skipLocationChange]="child.skipLocationChange" [replaceUrl]="child.replaceUrl" [state]="child.state" pRipple>
161 <span class="p-menuitem-icon" *ngIf="child.icon" [ngClass]="child.icon"></span>
162 <span class="p-menuitem-text" *ngIf="child.escape !== false; else htmlRouteLabel">{{child.label}}</span>
163 <ng-template #htmlRouteLabel><span class="p-menuitem-text" [innerHTML]="child.label"></span></ng-template>
164 <span class="p-submenu-icon pi" *ngIf="child.items" [ngClass]="{'pi-angle-down':root,'pi-angle-right':!root}"></span>
165 </a>
166 <p-menubarSub [parentActive]="child === activeItem" [item]="child" *ngIf="child.items" [mobileActive]="mobileActive" [autoDisplay]="autoDisplay" (leafClick)="onLeafClick()"></p-menubarSub>
167 </li>
168 </ng-template>
169 </ul>
170 `,
171 encapsulation: ViewEncapsulation.None,
172 host: {
173 'class': 'p-element'
174 }
175 }]
176 }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { item: [{
177 type: Input
178 }], root: [{
179 type: Input
180 }], autoZIndex: [{
181 type: Input
182 }], baseZIndex: [{
183 type: Input
184 }], mobileActive: [{
185 type: Input
186 }], autoDisplay: [{
187 type: Input
188 }], parentActive: [{
189 type: Input
190 }], leafClick: [{
191 type: Output
192 }] } });
193class Menubar {
194 constructor(el, renderer, cd, config) {
195 this.el = el;
196 this.renderer = renderer;
197 this.cd = cd;
198 this.config = config;
199 this.autoZIndex = true;
200 this.baseZIndex = 0;
201 }
202 ngAfterContentInit() {
203 this.templates.forEach((item) => {
204 switch (item.getType()) {
205 case 'start':
206 this.startTemplate = item.template;
207 break;
208 case 'end':
209 this.endTemplate = item.template;
210 break;
211 }
212 });
213 }
214 toggle(event) {
215 if (this.mobileActive) {
216 this.hide();
217 ZIndexUtils.clear(this.rootmenu.el.nativeElement);
218 }
219 else {
220 this.mobileActive = true;
221 ZIndexUtils.set('menu', this.rootmenu.el.nativeElement, this.config.zIndex.menu);
222 }
223 this.bindOutsideClickListener();
224 event.preventDefault();
225 }
226 bindOutsideClickListener() {
227 if (!this.outsideClickListener) {
228 this.outsideClickListener = (event) => {
229 if (this.mobileActive && this.rootmenu.el.nativeElement !== event.target && !this.rootmenu.el.nativeElement.contains(event.target)
230 && this.menubutton.nativeElement !== event.target && !this.menubutton.nativeElement.contains(event.target)) {
231 this.hide();
232 }
233 };
234 document.addEventListener('click', this.outsideClickListener);
235 }
236 }
237 hide() {
238 this.mobileActive = false;
239 this.cd.markForCheck();
240 ZIndexUtils.clear(this.rootmenu.el.nativeElement);
241 this.unbindOutsideClickListener();
242 }
243 onLeafClick() {
244 this.hide();
245 }
246 unbindOutsideClickListener() {
247 if (this.outsideClickListener) {
248 document.removeEventListener('click', this.outsideClickListener);
249 this.outsideClickListener = null;
250 }
251 }
252 ngOnDestroy() {
253 this.unbindOutsideClickListener();
254 }
255}
256Menubar.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: Menubar, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: i5.PrimeNGConfig }], target: i0.ɵɵFactoryTarget.Component });
257Menubar.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.0", type: Menubar, selector: "p-menubar", inputs: { model: "model", style: "style", styleClass: "styleClass", autoZIndex: "autoZIndex", baseZIndex: "baseZIndex", autoDisplay: "autoDisplay" }, host: { classAttribute: "p-element" }, queries: [{ propertyName: "templates", predicate: PrimeTemplate }], viewQueries: [{ propertyName: "menubutton", first: true, predicate: ["menubutton"], descendants: true }, { propertyName: "rootmenu", first: true, predicate: ["rootmenu"], descendants: true }], ngImport: i0, template: `
258 <div [ngClass]="{'p-menubar p-component':true, 'p-menubar-mobile-active': mobileActive}" [class]="styleClass" [ngStyle]="style">
259 <div class="p-menubar-start" *ngIf="startTemplate">
260 <ng-container *ngTemplateOutlet="startTemplate"></ng-container>
261 </div>
262 <a #menubutton tabindex="0" class="p-menubar-button" (click)="toggle($event)">
263 <i class="pi pi-bars"></i>
264 </a>
265 <p-menubarSub #rootmenu [item]="model" root="root" [baseZIndex]="baseZIndex" (leafClick)="onLeafClick()" [autoZIndex]="autoZIndex" [mobileActive]="mobileActive" [autoDisplay]="autoDisplay"></p-menubarSub>
266 <div class="p-menubar-end" *ngIf="endTemplate; else legacy">
267 <ng-container *ngTemplateOutlet="endTemplate"></ng-container>
268 </div>
269 <ng-template #legacy>
270 <div class="p-menubar-end">
271 <ng-content></ng-content>
272 </div>
273 </ng-template>
274 </div>
275 `, isInline: true, styles: [".p-menubar{display:flex;align-items:center}.p-menubar ul{margin:0;padding:0;list-style:none}.p-menubar .p-menuitem-link{cursor:pointer;display:flex;align-items:center;text-decoration:none;overflow:hidden;position:relative}.p-menubar .p-menuitem-text{line-height:1}.p-menubar .p-menuitem{position:relative}.p-menubar-root-list{display:flex;align-items:center}.p-menubar-root-list>li ul{display:none;z-index:1}.p-menubar-root-list>.p-menuitem-active>p-menubarsub>.p-submenu-list{display:block}.p-menubar .p-submenu-list{display:none;position:absolute;z-index:1}.p-menubar .p-submenu-list>.p-menuitem-active>p-menubarsub>.p-submenu-list{display:block;left:100%;top:0}.p-menubar .p-submenu-list .p-menuitem-link .p-submenu-icon{margin-left:auto}.p-menubar .p-menubar-custom,.p-menubar .p-menubar-end{margin-left:auto;align-self:center}.p-menubar-button{display:none;cursor:pointer;align-items:center;justify-content:center}\n"], components: [{ type: MenubarSub, selector: "p-menubarSub", inputs: ["item", "root", "autoZIndex", "baseZIndex", "mobileActive", "autoDisplay", "parentActive"], outputs: ["leafClick"] }], directives: [{ type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
276i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: Menubar, decorators: [{
277 type: Component,
278 args: [{ selector: 'p-menubar', template: `
279 <div [ngClass]="{'p-menubar p-component':true, 'p-menubar-mobile-active': mobileActive}" [class]="styleClass" [ngStyle]="style">
280 <div class="p-menubar-start" *ngIf="startTemplate">
281 <ng-container *ngTemplateOutlet="startTemplate"></ng-container>
282 </div>
283 <a #menubutton tabindex="0" class="p-menubar-button" (click)="toggle($event)">
284 <i class="pi pi-bars"></i>
285 </a>
286 <p-menubarSub #rootmenu [item]="model" root="root" [baseZIndex]="baseZIndex" (leafClick)="onLeafClick()" [autoZIndex]="autoZIndex" [mobileActive]="mobileActive" [autoDisplay]="autoDisplay"></p-menubarSub>
287 <div class="p-menubar-end" *ngIf="endTemplate; else legacy">
288 <ng-container *ngTemplateOutlet="endTemplate"></ng-container>
289 </div>
290 <ng-template #legacy>
291 <div class="p-menubar-end">
292 <ng-content></ng-content>
293 </div>
294 </ng-template>
295 </div>
296 `, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
297 'class': 'p-element'
298 }, styles: [".p-menubar{display:flex;align-items:center}.p-menubar ul{margin:0;padding:0;list-style:none}.p-menubar .p-menuitem-link{cursor:pointer;display:flex;align-items:center;text-decoration:none;overflow:hidden;position:relative}.p-menubar .p-menuitem-text{line-height:1}.p-menubar .p-menuitem{position:relative}.p-menubar-root-list{display:flex;align-items:center}.p-menubar-root-list>li ul{display:none;z-index:1}.p-menubar-root-list>.p-menuitem-active>p-menubarsub>.p-submenu-list{display:block}.p-menubar .p-submenu-list{display:none;position:absolute;z-index:1}.p-menubar .p-submenu-list>.p-menuitem-active>p-menubarsub>.p-submenu-list{display:block;left:100%;top:0}.p-menubar .p-submenu-list .p-menuitem-link .p-submenu-icon{margin-left:auto}.p-menubar .p-menubar-custom,.p-menubar .p-menubar-end{margin-left:auto;align-self:center}.p-menubar-button{display:none;cursor:pointer;align-items:center;justify-content:center}\n"] }]
299 }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: i5.PrimeNGConfig }]; }, propDecorators: { model: [{
300 type: Input
301 }], style: [{
302 type: Input
303 }], styleClass: [{
304 type: Input
305 }], autoZIndex: [{
306 type: Input
307 }], baseZIndex: [{
308 type: Input
309 }], autoDisplay: [{
310 type: Input
311 }], templates: [{
312 type: ContentChildren,
313 args: [PrimeTemplate]
314 }], menubutton: [{
315 type: ViewChild,
316 args: ['menubutton']
317 }], rootmenu: [{
318 type: ViewChild,
319 args: ['rootmenu']
320 }] } });
321class MenubarModule {
322}
323MenubarModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: MenubarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
324MenubarModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: MenubarModule, declarations: [Menubar, MenubarSub], imports: [CommonModule, RouterModule, RippleModule, TooltipModule], exports: [Menubar, RouterModule, TooltipModule] });
325MenubarModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: MenubarModule, imports: [[CommonModule, RouterModule, RippleModule, TooltipModule], RouterModule, TooltipModule] });
326i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: MenubarModule, decorators: [{
327 type: NgModule,
328 args: [{
329 imports: [CommonModule, RouterModule, RippleModule, TooltipModule],
330 exports: [Menubar, RouterModule, TooltipModule],
331 declarations: [Menubar, MenubarSub]
332 }]
333 }] });
334
335/**
336 * Generated bundle index. Do not edit.
337 */
338
339export { Menubar, MenubarModule, MenubarSub };
Note: See TracBrowser for help on using the repository browser.