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