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