1 | import * as i0 from '@angular/core';
|
---|
2 | import { EventEmitter, Component, ViewEncapsulation, Input, Output, ChangeDetectionStrategy, NgModule } from '@angular/core';
|
---|
3 | import * as i1 from '@angular/common';
|
---|
4 | import { CommonModule } from '@angular/common';
|
---|
5 | import { DomHandler, ConnectedOverlayScrollHandler } from 'primeng/dom';
|
---|
6 | import * as i4 from '@angular/router';
|
---|
7 | import { RouterModule } from '@angular/router';
|
---|
8 | import * as i3 from 'primeng/ripple';
|
---|
9 | import { RippleModule } from 'primeng/ripple';
|
---|
10 | import { trigger, transition, style, animate } from '@angular/animations';
|
---|
11 | import { ZIndexUtils } from 'primeng/utils';
|
---|
12 | import * as i2 from 'primeng/tooltip';
|
---|
13 | import { TooltipModule } from 'primeng/tooltip';
|
---|
14 | import * as i5 from 'primeng/api';
|
---|
15 |
|
---|
16 | class TieredMenuSub {
|
---|
17 | constructor(el, renderer, cd) {
|
---|
18 | this.el = el;
|
---|
19 | this.renderer = renderer;
|
---|
20 | this.cd = cd;
|
---|
21 | this.autoZIndex = true;
|
---|
22 | this.baseZIndex = 0;
|
---|
23 | this.leafClick = new EventEmitter();
|
---|
24 | this.keydownItem = new EventEmitter();
|
---|
25 | this.menuHoverActive = false;
|
---|
26 | }
|
---|
27 | get parentActive() {
|
---|
28 | return this._parentActive;
|
---|
29 | }
|
---|
30 | set parentActive(value) {
|
---|
31 | if (!this.root) {
|
---|
32 | this._parentActive = value;
|
---|
33 | if (!value)
|
---|
34 | this.activeItem = null;
|
---|
35 | }
|
---|
36 | }
|
---|
37 | onItemClick(event, item) {
|
---|
38 | if (item.disabled) {
|
---|
39 | event.preventDefault();
|
---|
40 | return;
|
---|
41 | }
|
---|
42 | if (!item.url && !item.routerLink) {
|
---|
43 | event.preventDefault();
|
---|
44 | }
|
---|
45 | if (item.command) {
|
---|
46 | item.command({
|
---|
47 | originalEvent: event,
|
---|
48 | item: item
|
---|
49 | });
|
---|
50 | }
|
---|
51 | if (item.items) {
|
---|
52 | if (this.activeItem && item === this.activeItem) {
|
---|
53 | this.activeItem = null;
|
---|
54 | this.unbindDocumentClickListener();
|
---|
55 | }
|
---|
56 | else {
|
---|
57 | this.activeItem = item;
|
---|
58 | if (this.root) {
|
---|
59 | this.bindDocumentClickListener();
|
---|
60 | }
|
---|
61 | }
|
---|
62 | }
|
---|
63 | if (!item.items) {
|
---|
64 | this.onLeafClick();
|
---|
65 | }
|
---|
66 | }
|
---|
67 | onItemMouseEnter(event, item) {
|
---|
68 | if (item.disabled || this.mobileActive) {
|
---|
69 | event.preventDefault();
|
---|
70 | return;
|
---|
71 | }
|
---|
72 | if (this.root) {
|
---|
73 | if (this.activeItem || this.autoDisplay || this.popup) {
|
---|
74 | this.activeItem = item;
|
---|
75 | this.bindDocumentClickListener();
|
---|
76 | }
|
---|
77 | }
|
---|
78 | else {
|
---|
79 | this.activeItem = item;
|
---|
80 | this.bindDocumentClickListener();
|
---|
81 | }
|
---|
82 | }
|
---|
83 | onLeafClick() {
|
---|
84 | this.activeItem = null;
|
---|
85 | if (this.root) {
|
---|
86 | this.unbindDocumentClickListener();
|
---|
87 | }
|
---|
88 | this.leafClick.emit();
|
---|
89 | }
|
---|
90 | onItemKeyDown(event, item) {
|
---|
91 | let listItem = event.currentTarget.parentElement;
|
---|
92 | switch (event.key) {
|
---|
93 | case 'ArrowDown':
|
---|
94 | var nextItem = this.findNextItem(listItem);
|
---|
95 | if (nextItem) {
|
---|
96 | nextItem.children[0].focus();
|
---|
97 | }
|
---|
98 | event.preventDefault();
|
---|
99 | break;
|
---|
100 | case 'ArrowUp':
|
---|
101 | var prevItem = this.findPrevItem(listItem);
|
---|
102 | if (prevItem) {
|
---|
103 | prevItem.children[0].focus();
|
---|
104 | }
|
---|
105 | event.preventDefault();
|
---|
106 | break;
|
---|
107 | case 'ArrowRight':
|
---|
108 | if (item.items) {
|
---|
109 | this.activeItem = item;
|
---|
110 | if (this.root) {
|
---|
111 | this.bindDocumentClickListener();
|
---|
112 | }
|
---|
113 | setTimeout(() => {
|
---|
114 | listItem.children[1].children[0].children[0].children[0].focus();
|
---|
115 | }, 50);
|
---|
116 | }
|
---|
117 | event.preventDefault();
|
---|
118 | break;
|
---|
119 | default:
|
---|
120 | break;
|
---|
121 | }
|
---|
122 | this.keydownItem.emit({
|
---|
123 | originalEvent: event,
|
---|
124 | element: listItem
|
---|
125 | });
|
---|
126 | }
|
---|
127 | findNextItem(item) {
|
---|
128 | let nextItem = item.nextElementSibling;
|
---|
129 | if (nextItem)
|
---|
130 | return DomHandler.hasClass(nextItem, 'p-disabled') || !DomHandler.hasClass(nextItem, 'p-menuitem') ? this.findNextItem(nextItem) : nextItem;
|
---|
131 | else
|
---|
132 | return null;
|
---|
133 | }
|
---|
134 | findPrevItem(item) {
|
---|
135 | let prevItem = item.previousElementSibling;
|
---|
136 | if (prevItem)
|
---|
137 | return DomHandler.hasClass(prevItem, 'p-disabled') || !DomHandler.hasClass(prevItem, 'p-menuitem') ? this.findPrevItem(prevItem) : prevItem;
|
---|
138 | else
|
---|
139 | return null;
|
---|
140 | }
|
---|
141 | onChildItemKeyDown(event) {
|
---|
142 | if (event.originalEvent.key === 'ArrowLeft') {
|
---|
143 | this.activeItem = null;
|
---|
144 | if (this.root) {
|
---|
145 | this.unbindDocumentClickListener();
|
---|
146 | }
|
---|
147 | event.element.parentElement.parentElement.parentElement.children[0].focus();
|
---|
148 | }
|
---|
149 | }
|
---|
150 | bindDocumentClickListener() {
|
---|
151 | if (!this.documentClickListener) {
|
---|
152 | this.documentClickListener = (event) => {
|
---|
153 | if (this.el && !this.el.nativeElement.contains(event.target)) {
|
---|
154 | this.activeItem = null;
|
---|
155 | this.cd.markForCheck();
|
---|
156 | this.unbindDocumentClickListener();
|
---|
157 | }
|
---|
158 | };
|
---|
159 | document.addEventListener('click', this.documentClickListener);
|
---|
160 | }
|
---|
161 | }
|
---|
162 | unbindDocumentClickListener() {
|
---|
163 | if (this.documentClickListener) {
|
---|
164 | document.removeEventListener('click', this.documentClickListener);
|
---|
165 | this.documentClickListener = null;
|
---|
166 | }
|
---|
167 | }
|
---|
168 | ngOnDestroy() {
|
---|
169 | this.unbindDocumentClickListener();
|
---|
170 | }
|
---|
171 | }
|
---|
172 | TieredMenuSub.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: TieredMenuSub, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
---|
173 | TieredMenuSub.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.0", type: TieredMenuSub, selector: "p-tieredMenuSub", inputs: { item: "item", root: "root", autoDisplay: "autoDisplay", autoZIndex: "autoZIndex", baseZIndex: "baseZIndex", mobileActive: "mobileActive", popup: "popup", parentActive: "parentActive" }, outputs: { leafClick: "leafClick", keydownItem: "keydownItem" }, host: { classAttribute: "p-element" }, ngImport: i0, template: `
|
---|
174 | <ul [ngClass]="{'p-submenu-list': !root}">
|
---|
175 | <ng-template ngFor let-child [ngForOf]="(root ? item : item.items)">
|
---|
176 | <li *ngIf="child.separator" class="p-menu-separator" [ngClass]="{'p-hidden': child.visible === false}">
|
---|
177 | <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" pTooltip [tooltipOptions]="child.tooltipOptions">
|
---|
178 | <a *ngIf="!child.routerLink" (keydown)="onItemKeyDown($event, child)" [attr.href]="child.url" [attr.data-automationid]="child.automationId" [attr.target]="child.target" [attr.title]="child.title" [attr.id]="child.id"
|
---|
179 | (click)="onItemClick($event, child)" (mouseenter)="onItemMouseEnter($event,child)"
|
---|
180 | [ngClass]="{'p-menuitem-link':true,'p-disabled':child.disabled}"
|
---|
181 | [attr.tabindex]="child.disabled ? null : '0'" [attr.aria-haspopup]="item.items != null" [attr.aria-expanded]="item === activeItem" pRipple>
|
---|
182 | <span class="p-menuitem-icon" *ngIf="child.icon" [ngClass]="child.icon"></span>
|
---|
183 | <span class="p-menuitem-text" *ngIf="child.escape !== false; else htmlLabel">{{child.label}}</span>
|
---|
184 | <ng-template #htmlLabel><span class="p-menuitem-text" [innerHTML]="child.label"></span></ng-template>
|
---|
185 | <span class="p-submenu-icon pi pi-angle-right" *ngIf="child.items"></span>
|
---|
186 | </a>
|
---|
187 | <a *ngIf="child.routerLink" (keydown)="onItemKeyDown($event, child)" [routerLink]="child.routerLink" [attr.data-automationid]="child.automationId" [queryParams]="child.queryParams" [routerLinkActive]="'p-menuitem-link-active'" [routerLinkActiveOptions]="child.routerLinkActiveOptions||{exact:false}"
|
---|
188 | [attr.target]="child.target" [attr.title]="child.title" [attr.id]="child.id" [attr.tabindex]="child.disabled ? null : '0'" role="menuitem"
|
---|
189 | (click)="onItemClick($event, child)" (mouseenter)="onItemMouseEnter($event,child)" [ngClass]="{'p-menuitem-link':true,'p-disabled':child.disabled}"
|
---|
190 | [fragment]="child.fragment" [queryParamsHandling]="child.queryParamsHandling" [preserveFragment]="child.preserveFragment" [skipLocationChange]="child.skipLocationChange" [replaceUrl]="child.replaceUrl" [state]="child.state" pRipple>
|
---|
191 | <span class="p-menuitem-icon" *ngIf="child.icon" [ngClass]="child.icon"></span>
|
---|
192 | <span class="p-menuitem-text" *ngIf="child.escape !== false; else htmlRouteLabel">{{child.label}}</span>
|
---|
193 | <ng-template #htmlRouteLabel><span class="p-menuitem-text" [innerHTML]="child.label"></span></ng-template>
|
---|
194 | <span class="p-submenu-icon pi pi-angle-right" *ngIf="child.items"></span>
|
---|
195 | </a>
|
---|
196 | <p-tieredMenuSub (keydownItem)="onChildItemKeyDown($event)" [parentActive]="child === activeItem" [item]="child" *ngIf="child.items" [mobileActive]="mobileActive" [autoDisplay]="autoDisplay" (leafClick)="onLeafClick()" [popup]="popup"></p-tieredMenuSub>
|
---|
197 | </li>
|
---|
198 | </ng-template>
|
---|
199 | </ul>
|
---|
200 | `, isInline: true, components: [{ type: TieredMenuSub, selector: "p-tieredMenuSub", inputs: ["item", "root", "autoDisplay", "autoZIndex", "baseZIndex", "mobileActive", "popup", "parentActive"], outputs: ["leafClick", "keydownItem"] }], 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 });
|
---|
201 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: TieredMenuSub, decorators: [{
|
---|
202 | type: Component,
|
---|
203 | args: [{
|
---|
204 | selector: 'p-tieredMenuSub',
|
---|
205 | template: `
|
---|
206 | <ul [ngClass]="{'p-submenu-list': !root}">
|
---|
207 | <ng-template ngFor let-child [ngForOf]="(root ? item : item.items)">
|
---|
208 | <li *ngIf="child.separator" class="p-menu-separator" [ngClass]="{'p-hidden': child.visible === false}">
|
---|
209 | <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" pTooltip [tooltipOptions]="child.tooltipOptions">
|
---|
210 | <a *ngIf="!child.routerLink" (keydown)="onItemKeyDown($event, child)" [attr.href]="child.url" [attr.data-automationid]="child.automationId" [attr.target]="child.target" [attr.title]="child.title" [attr.id]="child.id"
|
---|
211 | (click)="onItemClick($event, child)" (mouseenter)="onItemMouseEnter($event,child)"
|
---|
212 | [ngClass]="{'p-menuitem-link':true,'p-disabled':child.disabled}"
|
---|
213 | [attr.tabindex]="child.disabled ? null : '0'" [attr.aria-haspopup]="item.items != null" [attr.aria-expanded]="item === activeItem" pRipple>
|
---|
214 | <span class="p-menuitem-icon" *ngIf="child.icon" [ngClass]="child.icon"></span>
|
---|
215 | <span class="p-menuitem-text" *ngIf="child.escape !== false; else htmlLabel">{{child.label}}</span>
|
---|
216 | <ng-template #htmlLabel><span class="p-menuitem-text" [innerHTML]="child.label"></span></ng-template>
|
---|
217 | <span class="p-submenu-icon pi pi-angle-right" *ngIf="child.items"></span>
|
---|
218 | </a>
|
---|
219 | <a *ngIf="child.routerLink" (keydown)="onItemKeyDown($event, child)" [routerLink]="child.routerLink" [attr.data-automationid]="child.automationId" [queryParams]="child.queryParams" [routerLinkActive]="'p-menuitem-link-active'" [routerLinkActiveOptions]="child.routerLinkActiveOptions||{exact:false}"
|
---|
220 | [attr.target]="child.target" [attr.title]="child.title" [attr.id]="child.id" [attr.tabindex]="child.disabled ? null : '0'" role="menuitem"
|
---|
221 | (click)="onItemClick($event, child)" (mouseenter)="onItemMouseEnter($event,child)" [ngClass]="{'p-menuitem-link':true,'p-disabled':child.disabled}"
|
---|
222 | [fragment]="child.fragment" [queryParamsHandling]="child.queryParamsHandling" [preserveFragment]="child.preserveFragment" [skipLocationChange]="child.skipLocationChange" [replaceUrl]="child.replaceUrl" [state]="child.state" pRipple>
|
---|
223 | <span class="p-menuitem-icon" *ngIf="child.icon" [ngClass]="child.icon"></span>
|
---|
224 | <span class="p-menuitem-text" *ngIf="child.escape !== false; else htmlRouteLabel">{{child.label}}</span>
|
---|
225 | <ng-template #htmlRouteLabel><span class="p-menuitem-text" [innerHTML]="child.label"></span></ng-template>
|
---|
226 | <span class="p-submenu-icon pi pi-angle-right" *ngIf="child.items"></span>
|
---|
227 | </a>
|
---|
228 | <p-tieredMenuSub (keydownItem)="onChildItemKeyDown($event)" [parentActive]="child === activeItem" [item]="child" *ngIf="child.items" [mobileActive]="mobileActive" [autoDisplay]="autoDisplay" (leafClick)="onLeafClick()" [popup]="popup"></p-tieredMenuSub>
|
---|
229 | </li>
|
---|
230 | </ng-template>
|
---|
231 | </ul>
|
---|
232 | `,
|
---|
233 | encapsulation: ViewEncapsulation.None,
|
---|
234 | host: {
|
---|
235 | 'class': 'p-element'
|
---|
236 | }
|
---|
237 | }]
|
---|
238 | }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { item: [{
|
---|
239 | type: Input
|
---|
240 | }], root: [{
|
---|
241 | type: Input
|
---|
242 | }], autoDisplay: [{
|
---|
243 | type: Input
|
---|
244 | }], autoZIndex: [{
|
---|
245 | type: Input
|
---|
246 | }], baseZIndex: [{
|
---|
247 | type: Input
|
---|
248 | }], mobileActive: [{
|
---|
249 | type: Input
|
---|
250 | }], popup: [{
|
---|
251 | type: Input
|
---|
252 | }], parentActive: [{
|
---|
253 | type: Input
|
---|
254 | }], leafClick: [{
|
---|
255 | type: Output
|
---|
256 | }], keydownItem: [{
|
---|
257 | type: Output
|
---|
258 | }] } });
|
---|
259 | class TieredMenu {
|
---|
260 | constructor(el, renderer, cd, config, overlayService) {
|
---|
261 | this.el = el;
|
---|
262 | this.renderer = renderer;
|
---|
263 | this.cd = cd;
|
---|
264 | this.config = config;
|
---|
265 | this.overlayService = overlayService;
|
---|
266 | this.autoZIndex = true;
|
---|
267 | this.baseZIndex = 0;
|
---|
268 | this.showTransitionOptions = '.12s cubic-bezier(0, 0, 0.2, 1)';
|
---|
269 | this.hideTransitionOptions = '.1s linear';
|
---|
270 | }
|
---|
271 | toggle(event) {
|
---|
272 | if (this.visible)
|
---|
273 | this.hide();
|
---|
274 | else
|
---|
275 | this.show(event);
|
---|
276 | this.preventDocumentDefault = true;
|
---|
277 | }
|
---|
278 | show(event) {
|
---|
279 | this.target = event.currentTarget;
|
---|
280 | this.visible = true;
|
---|
281 | this.parentActive = true;
|
---|
282 | this.preventDocumentDefault = true;
|
---|
283 | this.cd.markForCheck();
|
---|
284 | }
|
---|
285 | onOverlayClick(event) {
|
---|
286 | if (this.popup) {
|
---|
287 | this.overlayService.add({
|
---|
288 | originalEvent: event,
|
---|
289 | target: this.el.nativeElement
|
---|
290 | });
|
---|
291 | }
|
---|
292 | this.preventDocumentDefault = true;
|
---|
293 | }
|
---|
294 | onOverlayAnimationStart(event) {
|
---|
295 | switch (event.toState) {
|
---|
296 | case 'visible':
|
---|
297 | if (this.popup) {
|
---|
298 | this.container = event.element;
|
---|
299 | this.moveOnTop();
|
---|
300 | this.appendOverlay();
|
---|
301 | DomHandler.absolutePosition(this.container, this.target);
|
---|
302 | this.bindDocumentClickListener();
|
---|
303 | this.bindDocumentResizeListener();
|
---|
304 | this.bindScrollListener();
|
---|
305 | }
|
---|
306 | break;
|
---|
307 | case 'void':
|
---|
308 | this.onOverlayHide();
|
---|
309 | break;
|
---|
310 | }
|
---|
311 | }
|
---|
312 | onOverlayAnimationEnd(event) {
|
---|
313 | switch (event.toState) {
|
---|
314 | case 'void':
|
---|
315 | ZIndexUtils.clear(event.element);
|
---|
316 | break;
|
---|
317 | }
|
---|
318 | }
|
---|
319 | appendOverlay() {
|
---|
320 | if (this.appendTo) {
|
---|
321 | if (this.appendTo === 'body')
|
---|
322 | document.body.appendChild(this.container);
|
---|
323 | else
|
---|
324 | DomHandler.appendChild(this.container, this.appendTo);
|
---|
325 | }
|
---|
326 | }
|
---|
327 | restoreOverlayAppend() {
|
---|
328 | if (this.container && this.appendTo) {
|
---|
329 | this.el.nativeElement.appendChild(this.container);
|
---|
330 | }
|
---|
331 | }
|
---|
332 | moveOnTop() {
|
---|
333 | if (this.autoZIndex) {
|
---|
334 | ZIndexUtils.set('menu', this.container, this.baseZIndex + this.config.zIndex.menu);
|
---|
335 | }
|
---|
336 | }
|
---|
337 | hide() {
|
---|
338 | this.visible = false;
|
---|
339 | this.parentActive = false;
|
---|
340 | this.cd.markForCheck();
|
---|
341 | }
|
---|
342 | onWindowResize() {
|
---|
343 | this.hide();
|
---|
344 | }
|
---|
345 | onLeafClick() {
|
---|
346 | if (this.popup) {
|
---|
347 | this.hide();
|
---|
348 | }
|
---|
349 | this.unbindDocumentClickListener();
|
---|
350 | }
|
---|
351 | bindDocumentClickListener() {
|
---|
352 | if (!this.documentClickListener) {
|
---|
353 | const documentTarget = this.el ? this.el.nativeElement.ownerDocument : 'document';
|
---|
354 | this.documentClickListener = this.renderer.listen(documentTarget, 'click', () => {
|
---|
355 | if (!this.preventDocumentDefault && this.popup) {
|
---|
356 | this.hide();
|
---|
357 | }
|
---|
358 | this.preventDocumentDefault = false;
|
---|
359 | });
|
---|
360 | }
|
---|
361 | }
|
---|
362 | unbindDocumentClickListener() {
|
---|
363 | if (this.documentClickListener) {
|
---|
364 | this.documentClickListener();
|
---|
365 | this.documentClickListener = null;
|
---|
366 | }
|
---|
367 | }
|
---|
368 | bindDocumentResizeListener() {
|
---|
369 | this.documentResizeListener = this.onWindowResize.bind(this);
|
---|
370 | window.addEventListener('resize', this.documentResizeListener);
|
---|
371 | }
|
---|
372 | unbindDocumentResizeListener() {
|
---|
373 | if (this.documentResizeListener) {
|
---|
374 | window.removeEventListener('resize', this.documentResizeListener);
|
---|
375 | this.documentResizeListener = null;
|
---|
376 | }
|
---|
377 | }
|
---|
378 | bindScrollListener() {
|
---|
379 | if (!this.scrollHandler) {
|
---|
380 | this.scrollHandler = new ConnectedOverlayScrollHandler(this.target, () => {
|
---|
381 | if (this.visible) {
|
---|
382 | this.hide();
|
---|
383 | }
|
---|
384 | });
|
---|
385 | }
|
---|
386 | this.scrollHandler.bindScrollListener();
|
---|
387 | }
|
---|
388 | unbindScrollListener() {
|
---|
389 | if (this.scrollHandler) {
|
---|
390 | this.scrollHandler.unbindScrollListener();
|
---|
391 | }
|
---|
392 | }
|
---|
393 | onOverlayHide() {
|
---|
394 | this.unbindDocumentClickListener();
|
---|
395 | this.unbindDocumentResizeListener();
|
---|
396 | this.unbindScrollListener();
|
---|
397 | this.preventDocumentDefault = false;
|
---|
398 | this.target = null;
|
---|
399 | }
|
---|
400 | ngOnDestroy() {
|
---|
401 | if (this.popup) {
|
---|
402 | if (this.scrollHandler) {
|
---|
403 | this.scrollHandler.destroy();
|
---|
404 | this.scrollHandler = null;
|
---|
405 | }
|
---|
406 | if (this.container && this.autoZIndex) {
|
---|
407 | ZIndexUtils.clear(this.container);
|
---|
408 | }
|
---|
409 | this.restoreOverlayAppend();
|
---|
410 | this.onOverlayHide();
|
---|
411 | }
|
---|
412 | }
|
---|
413 | }
|
---|
414 | TieredMenu.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: TieredMenu, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: i5.PrimeNGConfig }, { token: i5.OverlayService }], target: i0.ɵɵFactoryTarget.Component });
|
---|
415 | TieredMenu.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.0", type: TieredMenu, selector: "p-tieredMenu", inputs: { model: "model", popup: "popup", style: "style", styleClass: "styleClass", appendTo: "appendTo", autoZIndex: "autoZIndex", baseZIndex: "baseZIndex", autoDisplay: "autoDisplay", showTransitionOptions: "showTransitionOptions", hideTransitionOptions: "hideTransitionOptions" }, host: { classAttribute: "p-element" }, ngImport: i0, template: `
|
---|
416 | <div [ngClass]="{'p-tieredmenu p-component':true, 'p-tieredmenu-overlay':popup}" [class]="styleClass" [ngStyle]="style" (click)="onOverlayClick($event)"
|
---|
417 | [@overlayAnimation]="{value: 'visible', params: {showTransitionParams: showTransitionOptions, hideTransitionParams: hideTransitionOptions}}" [@.disabled]="popup !== true"
|
---|
418 | (@overlayAnimation.start)="onOverlayAnimationStart($event)" (@overlayAnimation.done)="onOverlayAnimationEnd($event)" *ngIf="!popup || visible">
|
---|
419 | <p-tieredMenuSub [item]="model" root="root" [parentActive]="parentActive" [baseZIndex]="baseZIndex" [autoZIndex]="autoZIndex" (leafClick)="onLeafClick()"
|
---|
420 | [autoDisplay]="autoDisplay" [popup]="popup"></p-tieredMenuSub>
|
---|
421 | </div>
|
---|
422 | `, isInline: true, styles: [".p-tieredmenu-overlay{position:absolute;top:0;left:0}.p-tieredmenu ul{margin:0;padding:0;list-style:none}.p-tieredmenu .p-submenu-list{position:absolute;min-width:100%;z-index:1;display:none}.p-tieredmenu .p-menuitem-link{cursor:pointer;display:flex;align-items:center;text-decoration:none;overflow:hidden;position:relative}.p-tieredmenu .p-menuitem-text{line-height:1}.p-tieredmenu .p-menuitem{position:relative}.p-tieredmenu .p-menuitem-link .p-submenu-icon{margin-left:auto}.p-tieredmenu .p-menuitem-active>p-tieredmenusub>.p-submenu-list{display:block;left:100%;top:0}\n"], components: [{ type: TieredMenuSub, selector: "p-tieredMenuSub", inputs: ["item", "root", "autoDisplay", "autoZIndex", "baseZIndex", "mobileActive", "popup", "parentActive"], outputs: ["leafClick", "keydownItem"] }], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], animations: [
|
---|
423 | trigger('overlayAnimation', [
|
---|
424 | transition(':enter', [
|
---|
425 | style({ opacity: 0, transform: 'scaleY(0.8)' }),
|
---|
426 | animate('{{showTransitionParams}}')
|
---|
427 | ]),
|
---|
428 | transition(':leave', [
|
---|
429 | animate('{{hideTransitionParams}}', style({ opacity: 0 }))
|
---|
430 | ])
|
---|
431 | ])
|
---|
432 | ], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
---|
433 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: TieredMenu, decorators: [{
|
---|
434 | type: Component,
|
---|
435 | args: [{ selector: 'p-tieredMenu', template: `
|
---|
436 | <div [ngClass]="{'p-tieredmenu p-component':true, 'p-tieredmenu-overlay':popup}" [class]="styleClass" [ngStyle]="style" (click)="onOverlayClick($event)"
|
---|
437 | [@overlayAnimation]="{value: 'visible', params: {showTransitionParams: showTransitionOptions, hideTransitionParams: hideTransitionOptions}}" [@.disabled]="popup !== true"
|
---|
438 | (@overlayAnimation.start)="onOverlayAnimationStart($event)" (@overlayAnimation.done)="onOverlayAnimationEnd($event)" *ngIf="!popup || visible">
|
---|
439 | <p-tieredMenuSub [item]="model" root="root" [parentActive]="parentActive" [baseZIndex]="baseZIndex" [autoZIndex]="autoZIndex" (leafClick)="onLeafClick()"
|
---|
440 | [autoDisplay]="autoDisplay" [popup]="popup"></p-tieredMenuSub>
|
---|
441 | </div>
|
---|
442 | `, animations: [
|
---|
443 | trigger('overlayAnimation', [
|
---|
444 | transition(':enter', [
|
---|
445 | style({ opacity: 0, transform: 'scaleY(0.8)' }),
|
---|
446 | animate('{{showTransitionParams}}')
|
---|
447 | ]),
|
---|
448 | transition(':leave', [
|
---|
449 | animate('{{hideTransitionParams}}', style({ opacity: 0 }))
|
---|
450 | ])
|
---|
451 | ])
|
---|
452 | ], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
---|
453 | 'class': 'p-element'
|
---|
454 | }, styles: [".p-tieredmenu-overlay{position:absolute;top:0;left:0}.p-tieredmenu ul{margin:0;padding:0;list-style:none}.p-tieredmenu .p-submenu-list{position:absolute;min-width:100%;z-index:1;display:none}.p-tieredmenu .p-menuitem-link{cursor:pointer;display:flex;align-items:center;text-decoration:none;overflow:hidden;position:relative}.p-tieredmenu .p-menuitem-text{line-height:1}.p-tieredmenu .p-menuitem{position:relative}.p-tieredmenu .p-menuitem-link .p-submenu-icon{margin-left:auto}.p-tieredmenu .p-menuitem-active>p-tieredmenusub>.p-submenu-list{display:block;left:100%;top:0}\n"] }]
|
---|
455 | }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: i5.PrimeNGConfig }, { type: i5.OverlayService }]; }, propDecorators: { model: [{
|
---|
456 | type: Input
|
---|
457 | }], popup: [{
|
---|
458 | type: Input
|
---|
459 | }], style: [{
|
---|
460 | type: Input
|
---|
461 | }], styleClass: [{
|
---|
462 | type: Input
|
---|
463 | }], appendTo: [{
|
---|
464 | type: Input
|
---|
465 | }], autoZIndex: [{
|
---|
466 | type: Input
|
---|
467 | }], baseZIndex: [{
|
---|
468 | type: Input
|
---|
469 | }], autoDisplay: [{
|
---|
470 | type: Input
|
---|
471 | }], showTransitionOptions: [{
|
---|
472 | type: Input
|
---|
473 | }], hideTransitionOptions: [{
|
---|
474 | type: Input
|
---|
475 | }] } });
|
---|
476 | class TieredMenuModule {
|
---|
477 | }
|
---|
478 | TieredMenuModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: TieredMenuModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
---|
479 | TieredMenuModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: TieredMenuModule, declarations: [TieredMenu, TieredMenuSub], imports: [CommonModule, RouterModule, RippleModule, TooltipModule], exports: [TieredMenu, RouterModule, TooltipModule] });
|
---|
480 | TieredMenuModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: TieredMenuModule, imports: [[CommonModule, RouterModule, RippleModule, TooltipModule], RouterModule, TooltipModule] });
|
---|
481 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: TieredMenuModule, decorators: [{
|
---|
482 | type: NgModule,
|
---|
483 | args: [{
|
---|
484 | imports: [CommonModule, RouterModule, RippleModule, TooltipModule],
|
---|
485 | exports: [TieredMenu, RouterModule, TooltipModule],
|
---|
486 | declarations: [TieredMenu, TieredMenuSub]
|
---|
487 | }]
|
---|
488 | }] });
|
---|
489 |
|
---|
490 | /**
|
---|
491 | * Generated bundle index. Do not edit.
|
---|
492 | */
|
---|
493 |
|
---|
494 | export { TieredMenu, TieredMenuModule, TieredMenuSub };
|
---|