1466 lines
182 KiB
JavaScript
1466 lines
182 KiB
JavaScript
|
import { animate, style, transition, trigger } from '@angular/animations';
|
||
|
import { CommonModule, DOCUMENT, isPlatformBrowser } from '@angular/common';
|
||
|
import { ChangeDetectionStrategy, Component, ContentChildren, EventEmitter, Inject, Input, NgModule, Output, PLATFORM_ID, ViewChild, ViewEncapsulation, booleanAttribute, effect, forwardRef, numberAttribute, signal } from '@angular/core';
|
||
|
import { RouterModule } from '@angular/router';
|
||
|
import { PrimeTemplate, SharedModule } from 'primeng/api';
|
||
|
import { DomHandler } from 'primeng/dom';
|
||
|
import { AngleRightIcon } from 'primeng/icons/angleright';
|
||
|
import { RippleModule } from 'primeng/ripple';
|
||
|
import { TooltipModule } from 'primeng/tooltip';
|
||
|
import { ObjectUtils, UniqueComponentId, ZIndexUtils } from 'primeng/utils';
|
||
|
import { CaretLeftIcon } from 'primeng/icons/caretleft';
|
||
|
import * as i0 from "@angular/core";
|
||
|
import * as i1 from "@angular/common";
|
||
|
import * as i2 from "@angular/router";
|
||
|
import * as i3 from "primeng/ripple";
|
||
|
import * as i4 from "primeng/tooltip";
|
||
|
import * as i5 from "primeng/api";
|
||
|
export class SlideMenuSub {
|
||
|
document;
|
||
|
el;
|
||
|
renderer;
|
||
|
cd;
|
||
|
slideMenu;
|
||
|
items;
|
||
|
menuWidth;
|
||
|
root = false;
|
||
|
easing = 'ease-out';
|
||
|
effectDuration;
|
||
|
autoDisplay;
|
||
|
autoZIndex = true;
|
||
|
baseZIndex = 0;
|
||
|
popup;
|
||
|
menuId;
|
||
|
ariaLabel;
|
||
|
ariaLabelledBy;
|
||
|
level = 0;
|
||
|
focusedItemId;
|
||
|
activeItemPath;
|
||
|
tabindex = 0;
|
||
|
itemClick = new EventEmitter();
|
||
|
itemMouseEnter = new EventEmitter();
|
||
|
menuFocus = new EventEmitter();
|
||
|
menuBlur = new EventEmitter();
|
||
|
menuKeydown = new EventEmitter();
|
||
|
sublistViewChild;
|
||
|
get isActive() {
|
||
|
return -this.slideMenu.left == this.level * this.menuWidth;
|
||
|
}
|
||
|
constructor(document, el, renderer, cd, slideMenu) {
|
||
|
this.document = document;
|
||
|
this.el = el;
|
||
|
this.renderer = renderer;
|
||
|
this.cd = cd;
|
||
|
this.slideMenu = slideMenu;
|
||
|
}
|
||
|
getItemProp(processedItem, name, params = null) {
|
||
|
return processedItem && processedItem.item ? ObjectUtils.getItemValue(processedItem.item[name], params) : undefined;
|
||
|
}
|
||
|
getItemId(processedItem) {
|
||
|
return processedItem.item && processedItem.item?.id ? processedItem.item.id : `${this.menuId}_${processedItem.key}`;
|
||
|
}
|
||
|
getItemKey(processedItem) {
|
||
|
return this.getItemId(processedItem);
|
||
|
}
|
||
|
getItemClass(processedItem) {
|
||
|
return {
|
||
|
...this.getItemProp(processedItem, 'class'),
|
||
|
'p-menuitem': true,
|
||
|
'p-menuitem-active': this.isItemActive(processedItem),
|
||
|
'p-focus': this.isItemFocused(processedItem),
|
||
|
'p-disabled': this.isItemDisabled(processedItem)
|
||
|
};
|
||
|
}
|
||
|
getItemLabel(processedItem) {
|
||
|
return this.getItemProp(processedItem, 'label');
|
||
|
}
|
||
|
getSeparatorItemClass(processedItem) {
|
||
|
return {
|
||
|
...this.getItemProp(processedItem, 'class'),
|
||
|
'p-menuitem-separator': true
|
||
|
};
|
||
|
}
|
||
|
getAriaSetSize() {
|
||
|
return this.items.filter((processedItem) => this.isItemVisible(processedItem) && !this.getItemProp(processedItem, 'separator')).length;
|
||
|
}
|
||
|
getAriaPosInset(index) {
|
||
|
return index - this.items.slice(0, index).filter((processedItem) => this.isItemVisible(processedItem) && this.getItemProp(processedItem, 'separator')).length + 1;
|
||
|
}
|
||
|
isItemVisible(processedItem) {
|
||
|
return this.getItemProp(processedItem, 'visible') !== false;
|
||
|
}
|
||
|
isItemActive(processedItem) {
|
||
|
if (this.activeItemPath) {
|
||
|
return this.activeItemPath.some((path) => path.key === processedItem.key);
|
||
|
}
|
||
|
}
|
||
|
isItemDisabled(processedItem) {
|
||
|
return this.getItemProp(processedItem, 'disabled');
|
||
|
}
|
||
|
isItemFocused(processedItem) {
|
||
|
return this.focusedItemId === this.getItemId(processedItem);
|
||
|
}
|
||
|
isItemGroup(processedItem) {
|
||
|
return ObjectUtils.isNotEmpty(processedItem.items);
|
||
|
}
|
||
|
onItemClick(event, processedItem) {
|
||
|
this.getItemProp(processedItem, 'command', { originalEvent: event, item: processedItem.item });
|
||
|
this.itemClick.emit({ originalEvent: event, processedItem, isFocus: true });
|
||
|
event.preventDefault();
|
||
|
}
|
||
|
onMenuKeyDown(event) {
|
||
|
this.menuKeydown.emit(event);
|
||
|
}
|
||
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: SlideMenuSub, deps: [{ token: DOCUMENT }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: forwardRef(() => SlideMenu) }], target: i0.ɵɵFactoryTarget.Component });
|
||
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "17.3.7", type: SlideMenuSub, selector: "p-slideMenuSub", inputs: { items: "items", menuWidth: ["menuWidth", "menuWidth", numberAttribute], root: ["root", "root", booleanAttribute], easing: "easing", effectDuration: ["effectDuration", "effectDuration", numberAttribute], autoDisplay: ["autoDisplay", "autoDisplay", booleanAttribute], autoZIndex: ["autoZIndex", "autoZIndex", booleanAttribute], baseZIndex: ["baseZIndex", "baseZIndex", numberAttribute], popup: ["popup", "popup", booleanAttribute], menuId: "menuId", ariaLabel: "ariaLabel", ariaLabelledBy: "ariaLabelledBy", level: ["level", "level", numberAttribute], focusedItemId: "focusedItemId", activeItemPath: "activeItemPath", tabindex: ["tabindex", "tabindex", numberAttribute] }, outputs: { itemClick: "itemClick", itemMouseEnter: "itemMouseEnter", menuFocus: "menuFocus", menuBlur: "menuBlur", menuKeydown: "menuKeydown" }, host: { classAttribute: "p-element" }, viewQueries: [{ propertyName: "sublistViewChild", first: true, predicate: ["sublist"], descendants: true, static: true }], ngImport: i0, template: `
|
||
|
<ul
|
||
|
#sublist
|
||
|
role="menu"
|
||
|
[ngClass]="{ 'p-submenu-list': !root, 'p-slidemenu-root-list': root, 'p-active-submenu': isActive }"
|
||
|
[id]="menuId + '_list'"
|
||
|
[style.width.px]="menuWidth"
|
||
|
[style.left.px]="root ? slideMenu.left : slideMenu.menuWidth"
|
||
|
[style.transitionProperty]="root ? 'left' : 'none'"
|
||
|
[style.transitionDuration]="effectDuration + 'ms'"
|
||
|
[style.transitionTimingFunction]="easing"
|
||
|
[tabindex]="tabindex"
|
||
|
[attr.aria-label]="ariaLabel"
|
||
|
[attr.aria-labelledBy]="ariaLabelledBy"
|
||
|
[attr.aria-aria-activedescendant]="focusedItemId"
|
||
|
[attr.aria-orientation]="'vertical'"
|
||
|
[attr.data-pc-section]="'menu'"
|
||
|
(keydown)="menuKeydown.emit($event)"
|
||
|
(focusin)="menuFocus.emit($event)"
|
||
|
[attr.data-pc-state]="isActive ? 'active' : 'inactive'"
|
||
|
>
|
||
|
<ng-template ngFor let-processedItem [ngForOf]="items" let-index="index">
|
||
|
<li
|
||
|
*ngIf="isItemVisible(processedItem) && getItemProp(processedItem, 'separator')"
|
||
|
[id]="getItemId(processedItem)"
|
||
|
[style]="getItemProp(processedItem, 'style')"
|
||
|
[ngClass]="getSeparatorItemClass(processedItem)"
|
||
|
role="separator"
|
||
|
[attr.data-pc-section]="'separator'"
|
||
|
></li>
|
||
|
<li
|
||
|
#listItem
|
||
|
*ngIf="isItemVisible(processedItem) && !getItemProp(processedItem, 'separator')"
|
||
|
role="menuitem"
|
||
|
[id]="getItemId(processedItem)"
|
||
|
[attr.data-pc-section]="'menuitem'"
|
||
|
[attr.data-p-highlight]="isItemActive(processedItem)"
|
||
|
[attr.data-p-focused]="isItemFocused(processedItem)"
|
||
|
[attr.data-p-disabled]="isItemDisabled(processedItem)"
|
||
|
[attr.aria-label]="getItemLabel(processedItem)"
|
||
|
[attr.aria-disabled]="isItemDisabled(processedItem) || undefined"
|
||
|
[attr.aria-haspopup]="isItemGroup(processedItem) && !getItemProp(processedItem, 'to') ? 'menu' : undefined"
|
||
|
[attr.aria-expanded]="isItemGroup(processedItem) ? isItemActive(processedItem) : undefined"
|
||
|
[attr.aria-level]="level + 1"
|
||
|
[attr.aria-setsize]="getAriaSetSize()"
|
||
|
[attr.aria-posinset]="getAriaPosInset(index)"
|
||
|
[ngStyle]="getItemProp(processedItem, 'style')"
|
||
|
[ngClass]="getItemClass(processedItem)"
|
||
|
[class]="getItemProp(processedItem, 'styleClass')"
|
||
|
pTooltip
|
||
|
[tooltipOptions]="getItemProp(processedItem, 'tooltipOptions')"
|
||
|
>
|
||
|
<div [attr.data-pc-section]="'content'" class="p-menuitem-content" (click)="onItemClick($event, processedItem)" (mouseenter)="itemMouseEnter.emit({ originalEvent: $event, processedItem })">
|
||
|
<a
|
||
|
*ngIf="!getItemProp(processedItem, 'routerLink')"
|
||
|
[attr.href]="getItemProp(processedItem, 'url')"
|
||
|
[attr.aria-hidden]="true"
|
||
|
[attr.data-automationid]="getItemProp(processedItem, 'automationId')"
|
||
|
[attr.data-pc-section]="'action'"
|
||
|
[target]="getItemProp(processedItem, 'target')"
|
||
|
[ngClass]="{ 'p-menuitem-link': true, 'p-disabled': getItemProp(processedItem, 'disabled') }"
|
||
|
[attr.tabindex]="-1"
|
||
|
pRipple
|
||
|
>
|
||
|
<span
|
||
|
*ngIf="getItemProp(processedItem, 'icon')"
|
||
|
class="p-menuitem-icon"
|
||
|
[ngClass]="getItemProp(processedItem, 'icon')"
|
||
|
[ngStyle]="getItemProp(processedItem, 'iconStyle')"
|
||
|
[attr.data-pc-section]="'icon'"
|
||
|
[attr.aria-hidden]="true"
|
||
|
[attr.tabindex]="-1"
|
||
|
>
|
||
|
</span>
|
||
|
<span *ngIf="getItemProp(processedItem, 'escape'); else htmlLabel" class="p-menuitem-text" [attr.data-pc-section]="'label'">
|
||
|
{{ getItemLabel(processedItem) }}
|
||
|
</span>
|
||
|
<ng-template #htmlLabel>
|
||
|
<span class="p-menuitem-text" [innerHTML]="getItemLabel(processedItem)" [attr.data-pc-section]="'label'"></span>
|
||
|
</ng-template>
|
||
|
<span class="p-menuitem-badge" *ngIf="getItemProp(processedItem, 'badge')" [ngClass]="getItemProp(processedItem, 'badgeStyleClass')">{{ getItemProp(processedItem, 'badge') }}</span>
|
||
|
|
||
|
<ng-container *ngIf="isItemGroup(processedItem)">
|
||
|
<AngleRightIcon *ngIf="!slideMenu.submenuIconTemplate" [styleClass]="'p-submenu-icon'" [attr.data-pc-section]="'submenuicon'" [attr.aria-hidden]="true" />
|
||
|
<ng-template *ngTemplateOutlet="slideMenu.submenuIconTemplate" [attr.data-pc-section]="'submenuicon'" [attr.aria-hidden]="true"></ng-template>
|
||
|
</ng-container>
|
||
|
</a>
|
||
|
<a
|
||
|
*ngIf="getItemProp(processedItem, 'routerLink')"
|
||
|
[routerLink]="getItemProp(processedItem, 'routerLink')"
|
||
|
[attr.data-automationid]="getItemProp(processedItem, 'automationId')"
|
||
|
[attr.tabindex]="-1"
|
||
|
[attr.aria-hidden]="true"
|
||
|
[attr.data-pc-section]="'action'"
|
||
|
[queryParams]="getItemProp(processedItem, 'queryParams')"
|
||
|
[routerLinkActive]="'p-menuitem-link-active'"
|
||
|
[routerLinkActiveOptions]="getItemProp(processedItem, 'routerLinkActiveOptions') || { exact: false }"
|
||
|
[target]="getItemProp(processedItem, 'target')"
|
||
|
[ngClass]="{ 'p-menuitem-link': true, 'p-disabled': getItemProp(processedItem, 'disabled') }"
|
||
|
[fragment]="getItemProp(processedItem, 'fragment')"
|
||
|
[queryParamsHandling]="getItemProp(processedItem, 'queryParamsHandling')"
|
||
|
[preserveFragment]="getItemProp(processedItem, 'preserveFragment')"
|
||
|
[skipLocationChange]="getItemProp(processedItem, 'skipLocationChange')"
|
||
|
[replaceUrl]="getItemProp(processedItem, 'replaceUrl')"
|
||
|
[state]="getItemProp(processedItem, 'state')"
|
||
|
pRipple
|
||
|
>
|
||
|
<span
|
||
|
*ngIf="getItemProp(processedItem, 'icon')"
|
||
|
class="p-menuitem-icon"
|
||
|
[ngClass]="getItemProp(processedItem, 'icon')"
|
||
|
[ngStyle]="getItemProp(processedItem, 'iconStyle')"
|
||
|
[attr.data-pc-section]="'icon'"
|
||
|
[attr.aria-hidden]="true"
|
||
|
[attr.tabindex]="-1"
|
||
|
>
|
||
|
</span>
|
||
|
<span *ngIf="getItemProp(processedItem, 'escape'); else htmlLabel" class="p-menuitem-text" [attr.data-pc-section]="'label'">
|
||
|
{{ getItemLabel(processedItem) }}
|
||
|
</span>
|
||
|
<ng-template #htmlLabel>
|
||
|
<span class="p-menuitem-text" [innerHTML]="getItemLabel(processedItem)" [attr.data-pc-section]="'label'"></span>
|
||
|
</ng-template>
|
||
|
<span class="p-menuitem-badge" *ngIf="getItemProp(processedItem, 'badge')" [ngClass]="getItemProp(processedItem, 'badgeStyleClass')">{{ getItemProp(processedItem, 'badge') }}</span>
|
||
|
|
||
|
<ng-container *ngIf="isItemGroup(processedItem)">
|
||
|
<AngleRightIcon *ngIf="!slideMenu.submenuIconTemplate" [styleClass]="'p-submenu-icon'" [attr.data-pc-section]="'submenuicon'" [attr.aria-hidden]="true" />
|
||
|
<ng-template *ngTemplateOutlet="slideMenu.submenuIconTemplate" [attr.data-pc-section]="'submenuicon'" [attr.aria-hidden]="true"></ng-template>
|
||
|
</ng-container>
|
||
|
</a>
|
||
|
</div>
|
||
|
|
||
|
<p-slideMenuSub
|
||
|
*ngIf="isItemVisible(processedItem) && isItemGroup(processedItem)"
|
||
|
class="p-submenu"
|
||
|
[items]="processedItem.items"
|
||
|
[autoDisplay]="autoDisplay"
|
||
|
[menuId]="menuId"
|
||
|
[activeItemPath]="activeItemPath"
|
||
|
[focusedItemId]="focusedItemId"
|
||
|
[level]="level + 1"
|
||
|
[menuWidth]="menuWidth"
|
||
|
(itemClick)="itemClick.emit($event)"
|
||
|
(itemMouseEnter)="itemMouseEnter.emit($event)"
|
||
|
></p-slideMenuSub>
|
||
|
</li>
|
||
|
</ng-template>
|
||
|
</ul>
|
||
|
`, isInline: true, dependencies: [{ kind: "directive", type: i0.forwardRef(() => i1.NgClass), selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i0.forwardRef(() => i1.NgForOf), selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i0.forwardRef(() => i1.NgIf), selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i0.forwardRef(() => i1.NgTemplateOutlet), selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i0.forwardRef(() => i1.NgStyle), selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i0.forwardRef(() => i2.RouterLink), selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "directive", type: i0.forwardRef(() => i2.RouterLinkActive), selector: "[routerLinkActive]", inputs: ["routerLinkActiveOptions", "ariaCurrentWhenActive", "routerLinkActive"], outputs: ["isActiveChange"], exportAs: ["routerLinkActive"] }, { kind: "directive", type: i0.forwardRef(() => i3.Ripple), selector: "[pRipple]" }, { kind: "directive", type: i0.forwardRef(() => i4.Tooltip), selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { kind: "component", type: i0.forwardRef(() => AngleRightIcon), selector: "AngleRightIcon" }, { kind: "component", type: i0.forwardRef(() => SlideMenuSub), selector: "p-slideMenuSub", inputs: ["items", "menuWidth", "root", "easing", "effectDuration", "autoDisplay", "autoZIndex", "baseZIndex", "popup", "menuId", "ariaLabel", "ariaLabelledBy", "level", "focusedItemId", "activeItemPath", "tabindex"], outputs: ["itemClick", "itemMouseEnter", "menuFocus", "menuBlur", "menuKeydown"] }], encapsulation: i0.ViewEncapsulation.None });
|
||
|
}
|
||
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: SlideMenuSub, decorators: [{
|
||
|
type: Component,
|
||
|
args: [{
|
||
|
selector: 'p-slideMenuSub',
|
||
|
template: `
|
||
|
<ul
|
||
|
#sublist
|
||
|
role="menu"
|
||
|
[ngClass]="{ 'p-submenu-list': !root, 'p-slidemenu-root-list': root, 'p-active-submenu': isActive }"
|
||
|
[id]="menuId + '_list'"
|
||
|
[style.width.px]="menuWidth"
|
||
|
[style.left.px]="root ? slideMenu.left : slideMenu.menuWidth"
|
||
|
[style.transitionProperty]="root ? 'left' : 'none'"
|
||
|
[style.transitionDuration]="effectDuration + 'ms'"
|
||
|
[style.transitionTimingFunction]="easing"
|
||
|
[tabindex]="tabindex"
|
||
|
[attr.aria-label]="ariaLabel"
|
||
|
[attr.aria-labelledBy]="ariaLabelledBy"
|
||
|
[attr.aria-aria-activedescendant]="focusedItemId"
|
||
|
[attr.aria-orientation]="'vertical'"
|
||
|
[attr.data-pc-section]="'menu'"
|
||
|
(keydown)="menuKeydown.emit($event)"
|
||
|
(focusin)="menuFocus.emit($event)"
|
||
|
[attr.data-pc-state]="isActive ? 'active' : 'inactive'"
|
||
|
>
|
||
|
<ng-template ngFor let-processedItem [ngForOf]="items" let-index="index">
|
||
|
<li
|
||
|
*ngIf="isItemVisible(processedItem) && getItemProp(processedItem, 'separator')"
|
||
|
[id]="getItemId(processedItem)"
|
||
|
[style]="getItemProp(processedItem, 'style')"
|
||
|
[ngClass]="getSeparatorItemClass(processedItem)"
|
||
|
role="separator"
|
||
|
[attr.data-pc-section]="'separator'"
|
||
|
></li>
|
||
|
<li
|
||
|
#listItem
|
||
|
*ngIf="isItemVisible(processedItem) && !getItemProp(processedItem, 'separator')"
|
||
|
role="menuitem"
|
||
|
[id]="getItemId(processedItem)"
|
||
|
[attr.data-pc-section]="'menuitem'"
|
||
|
[attr.data-p-highlight]="isItemActive(processedItem)"
|
||
|
[attr.data-p-focused]="isItemFocused(processedItem)"
|
||
|
[attr.data-p-disabled]="isItemDisabled(processedItem)"
|
||
|
[attr.aria-label]="getItemLabel(processedItem)"
|
||
|
[attr.aria-disabled]="isItemDisabled(processedItem) || undefined"
|
||
|
[attr.aria-haspopup]="isItemGroup(processedItem) && !getItemProp(processedItem, 'to') ? 'menu' : undefined"
|
||
|
[attr.aria-expanded]="isItemGroup(processedItem) ? isItemActive(processedItem) : undefined"
|
||
|
[attr.aria-level]="level + 1"
|
||
|
[attr.aria-setsize]="getAriaSetSize()"
|
||
|
[attr.aria-posinset]="getAriaPosInset(index)"
|
||
|
[ngStyle]="getItemProp(processedItem, 'style')"
|
||
|
[ngClass]="getItemClass(processedItem)"
|
||
|
[class]="getItemProp(processedItem, 'styleClass')"
|
||
|
pTooltip
|
||
|
[tooltipOptions]="getItemProp(processedItem, 'tooltipOptions')"
|
||
|
>
|
||
|
<div [attr.data-pc-section]="'content'" class="p-menuitem-content" (click)="onItemClick($event, processedItem)" (mouseenter)="itemMouseEnter.emit({ originalEvent: $event, processedItem })">
|
||
|
<a
|
||
|
*ngIf="!getItemProp(processedItem, 'routerLink')"
|
||
|
[attr.href]="getItemProp(processedItem, 'url')"
|
||
|
[attr.aria-hidden]="true"
|
||
|
[attr.data-automationid]="getItemProp(processedItem, 'automationId')"
|
||
|
[attr.data-pc-section]="'action'"
|
||
|
[target]="getItemProp(processedItem, 'target')"
|
||
|
[ngClass]="{ 'p-menuitem-link': true, 'p-disabled': getItemProp(processedItem, 'disabled') }"
|
||
|
[attr.tabindex]="-1"
|
||
|
pRipple
|
||
|
>
|
||
|
<span
|
||
|
*ngIf="getItemProp(processedItem, 'icon')"
|
||
|
class="p-menuitem-icon"
|
||
|
[ngClass]="getItemProp(processedItem, 'icon')"
|
||
|
[ngStyle]="getItemProp(processedItem, 'iconStyle')"
|
||
|
[attr.data-pc-section]="'icon'"
|
||
|
[attr.aria-hidden]="true"
|
||
|
[attr.tabindex]="-1"
|
||
|
>
|
||
|
</span>
|
||
|
<span *ngIf="getItemProp(processedItem, 'escape'); else htmlLabel" class="p-menuitem-text" [attr.data-pc-section]="'label'">
|
||
|
{{ getItemLabel(processedItem) }}
|
||
|
</span>
|
||
|
<ng-template #htmlLabel>
|
||
|
<span class="p-menuitem-text" [innerHTML]="getItemLabel(processedItem)" [attr.data-pc-section]="'label'"></span>
|
||
|
</ng-template>
|
||
|
<span class="p-menuitem-badge" *ngIf="getItemProp(processedItem, 'badge')" [ngClass]="getItemProp(processedItem, 'badgeStyleClass')">{{ getItemProp(processedItem, 'badge') }}</span>
|
||
|
|
||
|
<ng-container *ngIf="isItemGroup(processedItem)">
|
||
|
<AngleRightIcon *ngIf="!slideMenu.submenuIconTemplate" [styleClass]="'p-submenu-icon'" [attr.data-pc-section]="'submenuicon'" [attr.aria-hidden]="true" />
|
||
|
<ng-template *ngTemplateOutlet="slideMenu.submenuIconTemplate" [attr.data-pc-section]="'submenuicon'" [attr.aria-hidden]="true"></ng-template>
|
||
|
</ng-container>
|
||
|
</a>
|
||
|
<a
|
||
|
*ngIf="getItemProp(processedItem, 'routerLink')"
|
||
|
[routerLink]="getItemProp(processedItem, 'routerLink')"
|
||
|
[attr.data-automationid]="getItemProp(processedItem, 'automationId')"
|
||
|
[attr.tabindex]="-1"
|
||
|
[attr.aria-hidden]="true"
|
||
|
[attr.data-pc-section]="'action'"
|
||
|
[queryParams]="getItemProp(processedItem, 'queryParams')"
|
||
|
[routerLinkActive]="'p-menuitem-link-active'"
|
||
|
[routerLinkActiveOptions]="getItemProp(processedItem, 'routerLinkActiveOptions') || { exact: false }"
|
||
|
[target]="getItemProp(processedItem, 'target')"
|
||
|
[ngClass]="{ 'p-menuitem-link': true, 'p-disabled': getItemProp(processedItem, 'disabled') }"
|
||
|
[fragment]="getItemProp(processedItem, 'fragment')"
|
||
|
[queryParamsHandling]="getItemProp(processedItem, 'queryParamsHandling')"
|
||
|
[preserveFragment]="getItemProp(processedItem, 'preserveFragment')"
|
||
|
[skipLocationChange]="getItemProp(processedItem, 'skipLocationChange')"
|
||
|
[replaceUrl]="getItemProp(processedItem, 'replaceUrl')"
|
||
|
[state]="getItemProp(processedItem, 'state')"
|
||
|
pRipple
|
||
|
>
|
||
|
<span
|
||
|
*ngIf="getItemProp(processedItem, 'icon')"
|
||
|
class="p-menuitem-icon"
|
||
|
[ngClass]="getItemProp(processedItem, 'icon')"
|
||
|
[ngStyle]="getItemProp(processedItem, 'iconStyle')"
|
||
|
[attr.data-pc-section]="'icon'"
|
||
|
[attr.aria-hidden]="true"
|
||
|
[attr.tabindex]="-1"
|
||
|
>
|
||
|
</span>
|
||
|
<span *ngIf="getItemProp(processedItem, 'escape'); else htmlLabel" class="p-menuitem-text" [attr.data-pc-section]="'label'">
|
||
|
{{ getItemLabel(processedItem) }}
|
||
|
</span>
|
||
|
<ng-template #htmlLabel>
|
||
|
<span class="p-menuitem-text" [innerHTML]="getItemLabel(processedItem)" [attr.data-pc-section]="'label'"></span>
|
||
|
</ng-template>
|
||
|
<span class="p-menuitem-badge" *ngIf="getItemProp(processedItem, 'badge')" [ngClass]="getItemProp(processedItem, 'badgeStyleClass')">{{ getItemProp(processedItem, 'badge') }}</span>
|
||
|
|
||
|
<ng-container *ngIf="isItemGroup(processedItem)">
|
||
|
<AngleRightIcon *ngIf="!slideMenu.submenuIconTemplate" [styleClass]="'p-submenu-icon'" [attr.data-pc-section]="'submenuicon'" [attr.aria-hidden]="true" />
|
||
|
<ng-template *ngTemplateOutlet="slideMenu.submenuIconTemplate" [attr.data-pc-section]="'submenuicon'" [attr.aria-hidden]="true"></ng-template>
|
||
|
</ng-container>
|
||
|
</a>
|
||
|
</div>
|
||
|
|
||
|
<p-slideMenuSub
|
||
|
*ngIf="isItemVisible(processedItem) && isItemGroup(processedItem)"
|
||
|
class="p-submenu"
|
||
|
[items]="processedItem.items"
|
||
|
[autoDisplay]="autoDisplay"
|
||
|
[menuId]="menuId"
|
||
|
[activeItemPath]="activeItemPath"
|
||
|
[focusedItemId]="focusedItemId"
|
||
|
[level]="level + 1"
|
||
|
[menuWidth]="menuWidth"
|
||
|
(itemClick)="itemClick.emit($event)"
|
||
|
(itemMouseEnter)="itemMouseEnter.emit($event)"
|
||
|
></p-slideMenuSub>
|
||
|
</li>
|
||
|
</ng-template>
|
||
|
</ul>
|
||
|
`,
|
||
|
encapsulation: ViewEncapsulation.None,
|
||
|
host: {
|
||
|
class: 'p-element'
|
||
|
}
|
||
|
}]
|
||
|
}], ctorParameters: () => [{ type: Document, decorators: [{
|
||
|
type: Inject,
|
||
|
args: [DOCUMENT]
|
||
|
}] }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: SlideMenu, decorators: [{
|
||
|
type: Inject,
|
||
|
args: [forwardRef(() => SlideMenu)]
|
||
|
}] }], propDecorators: { items: [{
|
||
|
type: Input
|
||
|
}], menuWidth: [{
|
||
|
type: Input,
|
||
|
args: [{ transform: numberAttribute }]
|
||
|
}], root: [{
|
||
|
type: Input,
|
||
|
args: [{ transform: booleanAttribute }]
|
||
|
}], easing: [{
|
||
|
type: Input
|
||
|
}], effectDuration: [{
|
||
|
type: Input,
|
||
|
args: [{ transform: numberAttribute }]
|
||
|
}], autoDisplay: [{
|
||
|
type: Input,
|
||
|
args: [{ transform: booleanAttribute }]
|
||
|
}], autoZIndex: [{
|
||
|
type: Input,
|
||
|
args: [{ transform: booleanAttribute }]
|
||
|
}], baseZIndex: [{
|
||
|
type: Input,
|
||
|
args: [{ transform: numberAttribute }]
|
||
|
}], popup: [{
|
||
|
type: Input,
|
||
|
args: [{ transform: booleanAttribute }]
|
||
|
}], menuId: [{
|
||
|
type: Input
|
||
|
}], ariaLabel: [{
|
||
|
type: Input
|
||
|
}], ariaLabelledBy: [{
|
||
|
type: Input
|
||
|
}], level: [{
|
||
|
type: Input,
|
||
|
args: [{ transform: numberAttribute }]
|
||
|
}], focusedItemId: [{
|
||
|
type: Input
|
||
|
}], activeItemPath: [{
|
||
|
type: Input
|
||
|
}], tabindex: [{
|
||
|
type: Input,
|
||
|
args: [{ transform: numberAttribute }]
|
||
|
}], itemClick: [{
|
||
|
type: Output
|
||
|
}], itemMouseEnter: [{
|
||
|
type: Output
|
||
|
}], menuFocus: [{
|
||
|
type: Output
|
||
|
}], menuBlur: [{
|
||
|
type: Output
|
||
|
}], menuKeydown: [{
|
||
|
type: Output
|
||
|
}], sublistViewChild: [{
|
||
|
type: ViewChild,
|
||
|
args: ['sublist', { static: true }]
|
||
|
}] } });
|
||
|
/**
|
||
|
* SlideMenu displays submenus with slide animation.
|
||
|
* @group Components
|
||
|
*/
|
||
|
export class SlideMenu {
|
||
|
document;
|
||
|
platformId;
|
||
|
el;
|
||
|
renderer;
|
||
|
cd;
|
||
|
config;
|
||
|
overlayService;
|
||
|
/**
|
||
|
* An array of menuitems.
|
||
|
* @group Props
|
||
|
*/
|
||
|
set model(value) {
|
||
|
this._model = value;
|
||
|
this._processedItems = this.createProcessedItems(this._model || []);
|
||
|
}
|
||
|
get model() {
|
||
|
return this._model;
|
||
|
}
|
||
|
/**
|
||
|
* Width of the submenus.
|
||
|
* @group Props
|
||
|
*/
|
||
|
menuWidth = 190;
|
||
|
/**
|
||
|
* Height of the scrollable area, a scrollbar appears if a menu height is longer than this value.
|
||
|
* @group Props
|
||
|
*/
|
||
|
viewportHeight = 180;
|
||
|
/**
|
||
|
* Duration of the sliding animation in milliseconds.
|
||
|
* @group Props
|
||
|
*/
|
||
|
effectDuration = 250;
|
||
|
/**
|
||
|
* Easing animation to use for sliding.
|
||
|
* @group Props
|
||
|
*/
|
||
|
easing = 'ease-out';
|
||
|
/**
|
||
|
* Label of element to navigate back.
|
||
|
* @group Props
|
||
|
*/
|
||
|
backLabel = 'Back';
|
||
|
/**
|
||
|
* When present, it specifies that the component should be disabled.
|
||
|
* @group Props
|
||
|
*/
|
||
|
disabled = false;
|
||
|
/**
|
||
|
* Index of the element in tabbing order.
|
||
|
* @group Props
|
||
|
*/
|
||
|
tabindex = 0;
|
||
|
/**
|
||
|
* Defines if menu would displayed as a popup.
|
||
|
* @group Props
|
||
|
*/
|
||
|
popup;
|
||
|
/**
|
||
|
* Inline style of the component.
|
||
|
* @group Props
|
||
|
*/
|
||
|
style;
|
||
|
/**
|
||
|
* Style class of the component.
|
||
|
* @group Props
|
||
|
*/
|
||
|
styleClass;
|
||
|
/**
|
||
|
* Target element to attach the overlay, valid values are "body" or a local ng-template variable of another element.
|
||
|
* @group Props
|
||
|
*/
|
||
|
appendTo;
|
||
|
/**
|
||
|
* Whether to automatically manage layering.
|
||
|
* @group Props
|
||
|
*/
|
||
|
autoZIndex = true;
|
||
|
/**
|
||
|
* Base zIndex value to use in layering.
|
||
|
* @group Props
|
||
|
*/
|
||
|
baseZIndex = 0;
|
||
|
/**
|
||
|
* Whether to show a root submenu on mouse over.
|
||
|
* @defaultValue true
|
||
|
* @group Props
|
||
|
*/
|
||
|
autoDisplay = true;
|
||
|
/**
|
||
|
* Transition options of the show animation.
|
||
|
* @group Props
|
||
|
*/
|
||
|
showTransitionOptions = '.12s cubic-bezier(0, 0, 0.2, 1)';
|
||
|
/**
|
||
|
* Transition options of the hide animation.
|
||
|
* @group Props
|
||
|
*/
|
||
|
hideTransitionOptions = '.1s linear';
|
||
|
/**
|
||
|
* Current id state as a string.
|
||
|
* @group Props
|
||
|
*/
|
||
|
id;
|
||
|
/**
|
||
|
* Defines a string value that labels an interactive element.
|
||
|
* @group Props
|
||
|
*/
|
||
|
ariaLabel;
|
||
|
/**
|
||
|
* Identifier of the underlying input element.
|
||
|
* @group Props
|
||
|
*/
|
||
|
ariaLabelledBy;
|
||
|
/**
|
||
|
* Callback to invoke when overlay menu is shown.
|
||
|
* @group Emits
|
||
|
*/
|
||
|
onShow = new EventEmitter();
|
||
|
/**
|
||
|
* Callback to invoke when overlay menu is hidden.
|
||
|
* @group Emits
|
||
|
*/
|
||
|
onHide = new EventEmitter();
|
||
|
templates;
|
||
|
rootmenu;
|
||
|
containerViewChild;
|
||
|
set backward(element) {
|
||
|
this.backwardViewChild = element;
|
||
|
}
|
||
|
slideMenuContentViewChild;
|
||
|
submenuIconTemplate;
|
||
|
backIconTemplate;
|
||
|
outsideClickListener;
|
||
|
resizeListener;
|
||
|
transitionEndListener;
|
||
|
transitionStartListener;
|
||
|
backwardViewChild;
|
||
|
transition = false;
|
||
|
left = 0;
|
||
|
animating = false;
|
||
|
target;
|
||
|
visible;
|
||
|
relativeAlign;
|
||
|
window;
|
||
|
focused = false;
|
||
|
activeItemPath = signal([]);
|
||
|
focusedItemInfo = signal({ index: -1, level: 0, parentKey: '' });
|
||
|
searchValue = '';
|
||
|
searchTimeout;
|
||
|
_processedItems;
|
||
|
_model;
|
||
|
container;
|
||
|
itemClick = false;
|
||
|
get visibleItems() {
|
||
|
const processedItem = this.activeItemPath().find((p) => p.key === this.focusedItemInfo().parentKey);
|
||
|
return processedItem ? processedItem.items : this.processedItems;
|
||
|
}
|
||
|
get processedItems() {
|
||
|
if (!this._processedItems || !this._processedItems.length) {
|
||
|
this._processedItems = this.createProcessedItems(this.model || []);
|
||
|
}
|
||
|
return this._processedItems;
|
||
|
}
|
||
|
get focusedItemId() {
|
||
|
const focusedItem = this.focusedItemInfo();
|
||
|
return focusedItem.item && focusedItem.item?.id ? focusedItem.item.id : focusedItem.index !== -1 ? `${this.id}${ObjectUtils.isNotEmpty(focusedItem.parentKey) ? '_' + focusedItem.parentKey : ''}_${focusedItem.index}` : null;
|
||
|
}
|
||
|
constructor(document, platformId, el, renderer, cd, config, overlayService) {
|
||
|
this.document = document;
|
||
|
this.platformId = platformId;
|
||
|
this.el = el;
|
||
|
this.renderer = renderer;
|
||
|
this.cd = cd;
|
||
|
this.config = config;
|
||
|
this.overlayService = overlayService;
|
||
|
this.window = this.document.defaultView;
|
||
|
effect(() => {
|
||
|
const path = this.activeItemPath();
|
||
|
if (this.popup) {
|
||
|
if (ObjectUtils.isNotEmpty(path)) {
|
||
|
this.bindOutsideClickListener();
|
||
|
this.bindResizeListener();
|
||
|
}
|
||
|
else {
|
||
|
this.unbindOutsideClickListener();
|
||
|
this.unbindResizeListener();
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
documentFocusListener;
|
||
|
ngOnInit() {
|
||
|
this.id = this.id || UniqueComponentId();
|
||
|
}
|
||
|
ngAfterContentInit() {
|
||
|
this.templates.forEach((item) => {
|
||
|
switch (item.getType()) {
|
||
|
case 'backicon':
|
||
|
this.backIconTemplate = item.template;
|
||
|
break;
|
||
|
case 'submenuicon':
|
||
|
this.submenuIconTemplate = item.template;
|
||
|
break;
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
createProcessedItems(items, level = 0, parent = {}, parentKey = '') {
|
||
|
const processedItems = [];
|
||
|
items &&
|
||
|
items.forEach((item, index) => {
|
||
|
const key = (parentKey !== '' ? parentKey + '_' : '') + index;
|
||
|
const newItem = {
|
||
|
item,
|
||
|
index,
|
||
|
level,
|
||
|
key,
|
||
|
parent,
|
||
|
parentKey
|
||
|
};
|
||
|
newItem['items'] = this.createProcessedItems(item.items, level + 1, newItem, key);
|
||
|
processedItems.push(newItem);
|
||
|
});
|
||
|
return processedItems;
|
||
|
}
|
||
|
getItemProp(item, name) {
|
||
|
return item ? ObjectUtils.getItemValue(item[name]) : undefined;
|
||
|
}
|
||
|
getProccessedItemLabel(processedItem) {
|
||
|
return processedItem ? this.getItemLabel(processedItem.item) : undefined;
|
||
|
}
|
||
|
getItemLabel(item) {
|
||
|
return this.getItemProp(item, 'label');
|
||
|
}
|
||
|
isProcessedItemGroup(processedItem) {
|
||
|
return processedItem && ObjectUtils.isNotEmpty(processedItem.items);
|
||
|
}
|
||
|
isSelected(processedItem) {
|
||
|
return this.activeItemPath().some((p) => p.key === processedItem.key);
|
||
|
}
|
||
|
isValidSelectedItem(processedItem) {
|
||
|
return this.isValidItem(processedItem) && this.isSelected(processedItem);
|
||
|
}
|
||
|
isValidItem(processedItem) {
|
||
|
return !!processedItem && !this.isItemDisabled(processedItem.item) && !this.isItemSeparator(processedItem.item);
|
||
|
}
|
||
|
isItemDisabled(item) {
|
||
|
return this.getItemProp(item, 'disabled');
|
||
|
}
|
||
|
isItemSeparator(item) {
|
||
|
return this.getItemProp(item, 'separator');
|
||
|
}
|
||
|
isItemMatched(processedItem) {
|
||
|
return this.isValidItem(processedItem) && this.getProccessedItemLabel(processedItem).toLocaleLowerCase().startsWith(this.searchValue.toLocaleLowerCase());
|
||
|
}
|
||
|
isProccessedItemGroup(processedItem) {
|
||
|
return processedItem && ObjectUtils.isNotEmpty(processedItem.items);
|
||
|
}
|
||
|
onOverlayClick(event) {
|
||
|
if (this.popup) {
|
||
|
this.overlayService.add({
|
||
|
originalEvent: event,
|
||
|
target: this.el.nativeElement
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
goBack(event) {
|
||
|
this.animate('left');
|
||
|
event.stopPropagation();
|
||
|
event.preventDefault();
|
||
|
}
|
||
|
onItemClick(event) {
|
||
|
if (this.transition) {
|
||
|
return;
|
||
|
}
|
||
|
else {
|
||
|
if (!this.itemClick) {
|
||
|
this.itemClick = true;
|
||
|
this.onMenuFocus();
|
||
|
}
|
||
|
const { originalEvent, processedItem } = event;
|
||
|
const grouped = this.isProcessedItemGroup(processedItem);
|
||
|
const focusedItemInfo = this.focusedItemInfo();
|
||
|
if (grouped) {
|
||
|
this.focusedItemInfo.set({ ...focusedItemInfo, index: -1, level: focusedItemInfo.level + 1, parentKey: processedItem.key, item: processedItem.item });
|
||
|
this.animate('right');
|
||
|
}
|
||
|
else {
|
||
|
this.onItemChange(event);
|
||
|
this.popup && this.hide();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
onItemMouseEnter(event) {
|
||
|
this.onItemChange(event);
|
||
|
}
|
||
|
onKeyDown(event) {
|
||
|
if (!this.transition) {
|
||
|
const metaKey = event.metaKey || event.ctrlKey;
|
||
|
switch (event.code) {
|
||
|
case 'ArrowDown':
|
||
|
this.onArrowDownKey(event);
|
||
|
break;
|
||
|
case 'ArrowUp':
|
||
|
this.onArrowUpKey(event);
|
||
|
break;
|
||
|
case 'ArrowLeft':
|
||
|
this.onArrowLeftKey(event);
|
||
|
break;
|
||
|
case 'ArrowRight':
|
||
|
this.onArrowRightKey(event);
|
||
|
break;
|
||
|
case 'Home':
|
||
|
this.onHomeKey(event);
|
||
|
break;
|
||
|
case 'End':
|
||
|
this.onEndKey(event);
|
||
|
break;
|
||
|
case 'Space':
|
||
|
this.onSpaceKey(event);
|
||
|
break;
|
||
|
case 'Enter':
|
||
|
this.onEnterKey(event);
|
||
|
break;
|
||
|
case 'Escape':
|
||
|
this.onEscapeKey(event);
|
||
|
break;
|
||
|
case 'Tab':
|
||
|
this.onTabKey(event);
|
||
|
break;
|
||
|
case 'PageDown':
|
||
|
case 'PageUp':
|
||
|
case 'Backspace':
|
||
|
case 'ShiftLeft':
|
||
|
case 'ShiftRight':
|
||
|
//NOOP
|
||
|
break;
|
||
|
default:
|
||
|
if (!metaKey && ObjectUtils.isPrintableCharacter(event.key)) {
|
||
|
this.searchItems(event, event.key);
|
||
|
}
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
onNavigationKeyDown(event) {
|
||
|
switch (event.code) {
|
||
|
case 'Enter':
|
||
|
case 'Space':
|
||
|
this.onArrowLeftKey(event);
|
||
|
const focusedItemInfo = this.focusedItemInfo();
|
||
|
this.focusedItemInfo.set({
|
||
|
...focusedItemInfo,
|
||
|
index: -1,
|
||
|
item: null
|
||
|
});
|
||
|
break;
|
||
|
default:
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
animate(to) {
|
||
|
switch (to) {
|
||
|
case 'right':
|
||
|
this.left -= this.menuWidth;
|
||
|
break;
|
||
|
case 'left':
|
||
|
this.left += this.menuWidth;
|
||
|
break;
|
||
|
default:
|
||
|
break;
|
||
|
}
|
||
|
this.animating = true;
|
||
|
setTimeout(() => (this.animating = false), this.effectDuration);
|
||
|
}
|
||
|
onArrowDownKey(event) {
|
||
|
const itemIndex = this.focusedItemInfo().index !== -1 ? this.findNextItemIndex(this.focusedItemInfo().index) : this.findFirstFocusedItemIndex();
|
||
|
this.changeFocusedItemIndex(event, itemIndex);
|
||
|
event.preventDefault();
|
||
|
}
|
||
|
onArrowRightKey(event) {
|
||
|
const focusedItemInfo = this.focusedItemInfo();
|
||
|
if (focusedItemInfo.index === -1) {
|
||
|
focusedItemInfo.index = 0;
|
||
|
}
|
||
|
const processedItem = this.visibleItems[this.focusedItemInfo().index];
|
||
|
const grouped = this.isProccessedItemGroup(processedItem);
|
||
|
if (grouped) {
|
||
|
let { index, level, key, item } = processedItem;
|
||
|
this.onItemChange({ originalEvent: event, processedItem });
|
||
|
this.focusedItemInfo.set({ index: 0, level: level, parentKey: key });
|
||
|
this.searchValue = '';
|
||
|
this.animate('right');
|
||
|
}
|
||
|
event.preventDefault();
|
||
|
}
|
||
|
onArrowUpKey(event) {
|
||
|
if (event.altKey) {
|
||
|
if (this.focusedItemInfo().index !== -1) {
|
||
|
const processedItem = this.visibleItems[this.focusedItemInfo().index];
|
||
|
const grouped = this.isProccessedItemGroup(processedItem);
|
||
|
!grouped && this.onItemChange({ originalEvent: event, processedItem });
|
||
|
}
|
||
|
this.popup && this.hide(event, true);
|
||
|
event.preventDefault();
|
||
|
}
|
||
|
else {
|
||
|
const itemIndex = this.focusedItemInfo().index !== -1 ? this.findPrevItemIndex(this.focusedItemInfo().index) : this.findLastFocusedItemIndex();
|
||
|
this.changeFocusedItemIndex(event, itemIndex);
|
||
|
event.preventDefault();
|
||
|
}
|
||
|
}
|
||
|
onArrowLeftKey(event) {
|
||
|
const focusedItemInfo = this.focusedItemInfo();
|
||
|
if (focusedItemInfo.index === -1) {
|
||
|
focusedItemInfo.index = 0;
|
||
|
}
|
||
|
const processedItem = this.visibleItems[focusedItemInfo.index];
|
||
|
const parentItem = this.activeItemPath().find((p) => p.key === processedItem.parentKey);
|
||
|
const root = ObjectUtils.isEmpty(processedItem.parent);
|
||
|
if (!root) {
|
||
|
let { level, index, parentKey } = parentItem;
|
||
|
this.focusedItemInfo.set({ index, level, parentKey, item: parentItem.item });
|
||
|
this.searchValue = '';
|
||
|
}
|
||
|
const activeItemPath = this.activeItemPath().filter((p) => p.parentKey !== focusedItemInfo.parentKey);
|
||
|
this.activeItemPath.set(activeItemPath);
|
||
|
parentItem && this.animate('left');
|
||
|
event.preventDefault();
|
||
|
}
|
||
|
onHomeKey(event) {
|
||
|
this.changeFocusedItemIndex(event, this.findFirstItemIndex());
|
||
|
event.preventDefault();
|
||
|
}
|
||
|
onEndKey(event) {
|
||
|
this.changeFocusedItemIndex(event, this.findLastItemIndex());
|
||
|
event.preventDefault();
|
||
|
}
|
||
|
onSpaceKey(event) {
|
||
|
this.onEnterKey(event);
|
||
|
}
|
||
|
onEscapeKey(event) {
|
||
|
if (this.popup) {
|
||
|
this.hide(event, true);
|
||
|
const focusedItemInfo = this.focusedItemInfo();
|
||
|
this.focusedItemInfo.set({
|
||
|
...focusedItemInfo,
|
||
|
index: this.findLastFocusedItemIndex(),
|
||
|
item: null
|
||
|
});
|
||
|
event.preventDefault();
|
||
|
}
|
||
|
}
|
||
|
onTabKey(event) {
|
||
|
if (this.backwardViewChild.nativeElement.style.display !== 'none') {
|
||
|
this.backwardViewChild.nativeElement.focus();
|
||
|
}
|
||
|
if (this.popup && !this.containerViewChild.nativeElement.contains(event.target)) {
|
||
|
this.hide();
|
||
|
}
|
||
|
event.preventDefault();
|
||
|
}
|
||
|
onEnterKey(event) {
|
||
|
if (this.focusedItemInfo().index !== -1) {
|
||
|
const processedItem = this.visibleItems[this.focusedItemInfo().index];
|
||
|
const grouped = this.isProccessedItemGroup(processedItem);
|
||
|
if (grouped) {
|
||
|
this.onArrowRightKey(event);
|
||
|
}
|
||
|
else {
|
||
|
const element = DomHandler.findSingle(this.rootmenu.el.nativeElement, `li[id="${`${this.focusedItemId}`}"]`);
|
||
|
const anchorElement = element && DomHandler.findSingle(element, 'a[data-pc-section="action"]');
|
||
|
anchorElement ? anchorElement.click() : element && element.click();
|
||
|
const focusedItemInfo = this.focusedItemInfo();
|
||
|
this.focusedItemInfo.set({
|
||
|
...focusedItemInfo,
|
||
|
index: processedItem.index,
|
||
|
item: processedItem.item
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
event.preventDefault();
|
||
|
}
|
||
|
onItemChange(event) {
|
||
|
const { processedItem, isFocus } = event;
|
||
|
if (ObjectUtils.isEmpty(processedItem))
|
||
|
return;
|
||
|
const { index, key, level, parentKey, items, item } = processedItem;
|
||
|
const grouped = ObjectUtils.isNotEmpty(items);
|
||
|
const activeItemPath = this.activeItemPath().filter((p) => p.parentKey !== parentKey && p.parentKey !== key);
|
||
|
grouped && activeItemPath.push(processedItem);
|
||
|
this.focusedItemInfo.set({ index, level, parentKey, item });
|
||
|
this.activeItemPath.set(activeItemPath);
|
||
|
isFocus && DomHandler.focus(this.rootmenu.sublistViewChild.nativeElement);
|
||
|
}
|
||
|
onMenuFocus() {
|
||
|
this.focused = true;
|
||
|
this.bindOutsideClickListener();
|
||
|
this.bindTransitionListeners();
|
||
|
if (!this.left && this.focusedItemInfo().level > 0) {
|
||
|
this.focusedItemInfo.set({ index: 0, level: 0, parentKey: '', item: this.findVisibleItem(0).item });
|
||
|
}
|
||
|
if (this.focusedItemInfo().index === -1 && this.left < 0) {
|
||
|
this.focusedItemInfo.set({ ...this.focusedItemInfo(), index: 0 });
|
||
|
}
|
||
|
if (this.focusedItemInfo().index === -1 && !this.left) {
|
||
|
this.focusedItemInfo.set({ index: 0, level: 0, parentKey: '', item: this.findVisibleItem(0).item });
|
||
|
}
|
||
|
}
|
||
|
onMenuBlur() {
|
||
|
this.focused = false;
|
||
|
this.popup && this.focusedItemInfo.set({ index: -1, level: 0, parentKey: '', item: null });
|
||
|
if (!this.popup) {
|
||
|
this.focusedItemInfo.set({
|
||
|
...this.focusedItemInfo(),
|
||
|
index: -1,
|
||
|
item: null
|
||
|
});
|
||
|
}
|
||
|
this.searchValue = '';
|
||
|
!this.popup && this.unbindOutsideClickListener();
|
||
|
}
|
||
|
activeLevel = signal(0);
|
||
|
bindTransitionListeners() {
|
||
|
if (!this.transitionStartListener) {
|
||
|
this.transitionStartListener = this.renderer.listen(this.rootmenu.sublistViewChild.nativeElement, 'transitionstart', (event) => {
|
||
|
this.transition = true;
|
||
|
event.preventDefault();
|
||
|
});
|
||
|
}
|
||
|
if (!this.transitionEndListener) {
|
||
|
this.transitionEndListener = this.renderer.listen(this.rootmenu.sublistViewChild.nativeElement, 'transitionend', (event) => {
|
||
|
const activeMenu = DomHandler.findSingle(this.rootmenu.el.nativeElement, `ul[data-pc-state="active"]`);
|
||
|
const activeLevel = DomHandler.getAttribute(activeMenu.firstElementChild, 'aria-level') - 1;
|
||
|
this.activeLevel.set(activeLevel);
|
||
|
if (!this.left) {
|
||
|
this.rootmenu.sublistViewChild.nativeElement.focus();
|
||
|
}
|
||
|
else {
|
||
|
const activeLevel = DomHandler.getAttribute(activeMenu.firstElementChild, 'aria-level') - 1;
|
||
|
this.activeLevel.set(activeLevel);
|
||
|
if (this.focusedItemInfo().level > this.activeLevel()) {
|
||
|
let newActiveItemPath = this.activeItemPath().slice(0, this.activeItemPath().length - 1);
|
||
|
let lastActiveParent = newActiveItemPath[newActiveItemPath.length - 1];
|
||
|
this.focusedItemInfo.set({ index: -1, level: this.activeLevel(), parentKey: lastActiveParent.key });
|
||
|
this.activeItemPath.set(newActiveItemPath);
|
||
|
}
|
||
|
}
|
||
|
this.transition = false;
|
||
|
event.preventDefault();
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
unbindTransitionListeners() {
|
||
|
if (this.transitionEndListener) {
|
||
|
this.transitionEndListener();
|
||
|
this.transitionEndListener = null;
|
||
|
}
|
||
|
if (this.transitionStartListener) {
|
||
|
this.transitionStartListener();
|
||
|
this.transitionStartListener = null;
|
||
|
}
|
||
|
}
|
||
|
onOverlayAnimationStart(event) {
|
||
|
switch (event.toState) {
|
||
|
case 'visible':
|
||
|
if (this.popup) {
|
||
|
this.container = event.element;
|
||
|
this.moveOnTop();
|
||
|
this.onShow.emit({});
|
||
|
this.appendOverlay();
|
||
|
this.alignOverlay();
|
||
|
this.bindOutsideClickListener();
|
||
|
this.bindResizeListener();
|
||
|
DomHandler.focus(this.rootmenu.sublistViewChild.nativeElement);
|
||
|
this.scrollInView();
|
||
|
}
|
||
|
break;
|
||
|
case 'void':
|
||
|
this.onOverlayHide();
|
||
|
this.onHide.emit({});
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
alignOverlay() {
|
||
|
if (this.relativeAlign)
|
||
|
DomHandler.relativePosition(this.container, this.target);
|
||
|
else
|
||
|
DomHandler.absolutePosition(this.container, this.target);
|
||
|
}
|
||
|
onOverlayAnimationEnd(event) {
|
||
|
switch (event.toState) {
|
||
|
case 'void':
|
||
|
ZIndexUtils.clear(event.element);
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
appendOverlay() {
|
||
|
if (this.appendTo) {
|
||
|
if (this.appendTo === 'body')
|
||
|
this.renderer.appendChild(this.document.body, this.containerViewChild.nativeElement);
|
||
|
else
|
||
|
DomHandler.appendChild(this.container, this.appendTo);
|
||
|
}
|
||
|
}
|
||
|
restoreOverlayAppend() {
|
||
|
if (this.containerViewChild && this.appendTo) {
|
||
|
this.renderer.appendChild(this.el.nativeElement, this.container);
|
||
|
}
|
||
|
}
|
||
|
moveOnTop() {
|
||
|
if (this.autoZIndex) {
|
||
|
ZIndexUtils.set('menu', this.container, this.baseZIndex + this.config.zIndex.menu);
|
||
|
}
|
||
|
}
|
||
|
/**
|
||
|
* Hides the popup menu.
|
||
|
* @group Method
|
||
|
*/
|
||
|
hide(event, isFocus) {
|
||
|
if (this.popup) {
|
||
|
this.onHide.emit({});
|
||
|
this.visible = false;
|
||
|
}
|
||
|
isFocus && DomHandler.focus(this.target || this.rootmenu.sublistViewChild.nativeElement);
|
||
|
}
|
||
|
/**
|
||
|
* Toggles the visibility of the popup menu.
|
||
|
* @param {Event} event - Browser event.
|
||
|
* @group Method
|
||
|
*/
|
||
|
toggle(event) {
|
||
|
this.visible ? this.hide(event, true) : this.show(event);
|
||
|
}
|
||
|
/**
|
||
|
* Displays the popup menu.
|
||
|
* @param {Event} even - Browser event.
|
||
|
* @group Method
|
||
|
*/
|
||
|
show(event, isFocus) {
|
||
|
if (this.popup) {
|
||
|
this.visible = true;
|
||
|
this.target = event.currentTarget;
|
||
|
}
|
||
|
this.focusedItemInfo.set({ index: this.findFirstFocusedItemIndex(), level: 0, parentKey: '' });
|
||
|
if (!this.popup) {
|
||
|
isFocus && DomHandler.focus(this.rootmenu.sublistViewChild.nativeElement);
|
||
|
}
|
||
|
this.cd.markForCheck();
|
||
|
}
|
||
|
searchItems(event, char) {
|
||
|
this.searchValue = (this.searchValue || '') + char;
|
||
|
let itemIndex = -1;
|
||
|
let matched = false;
|
||
|
if (this.focusedItemInfo().index !== -1) {
|
||
|
itemIndex = this.visibleItems.slice(this.focusedItemInfo().index).findIndex((processedItem) => this.isItemMatched(processedItem));
|
||
|
itemIndex = itemIndex === -1 ? this.visibleItems.slice(0, this.focusedItemInfo().index).findIndex((processedItem) => this.isItemMatched(processedItem)) : itemIndex + this.focusedItemInfo().index;
|
||
|
}
|
||
|
else {
|
||
|
itemIndex = this.visibleItems.findIndex((processedItem) => this.isItemMatched(processedItem));
|
||
|
}
|
||
|
if (itemIndex !== -1) {
|
||
|
matched = true;
|
||
|
}
|
||
|
if (itemIndex === -1 && this.focusedItemInfo().index === -1) {
|
||
|
itemIndex = this.findFirstFocusedItemIndex();
|
||
|
}
|
||
|
if (itemIndex !== -1) {
|
||
|
this.changeFocusedItemIndex(event, itemIndex);
|
||
|
}
|
||
|
if (this.searchTimeout) {
|
||
|
clearTimeout(this.searchTimeout);
|
||
|
}
|
||
|
this.searchTimeout = setTimeout(() => {
|
||
|
this.searchValue = '';
|
||
|
this.searchTimeout = null;
|
||
|
}, 500);
|
||
|
return matched;
|
||
|
}
|
||
|
findVisibleItem(index) {
|
||
|
return ObjectUtils.isNotEmpty(this.visibleItems) ? this.visibleItems[index] : null;
|
||
|
}
|
||
|
findLastFocusedItemIndex() {
|
||
|
const selectedIndex = this.findSelectedItemIndex();
|
||
|
return selectedIndex < 0 ? this.findLastItemIndex() : selectedIndex;
|
||
|
}
|
||
|
findLastItemIndex() {
|
||
|
return ObjectUtils.findLastIndex(this.visibleItems, (processedItem) => this.isValidItem(processedItem));
|
||
|
}
|
||
|
findPrevItemIndex(index) {
|
||
|
const matchedItemIndex = index > 0 ? ObjectUtils.findLastIndex(this.visibleItems.slice(0, index), (processedItem) => this.isValidItem(processedItem)) : -1;
|
||
|
return matchedItemIndex > -1 ? matchedItemIndex : index;
|
||
|
}
|
||
|
findNextItemIndex(index) {
|
||
|
const matchedItemIndex = index < this.visibleItems.length - 1 ? this.visibleItems.slice(index + 1).findIndex((processedItem) => this.isValidItem(processedItem)) : -1;
|
||
|
return matchedItemIndex > -1 ? matchedItemIndex + index + 1 : index;
|
||
|
}
|
||
|
findFirstFocusedItemIndex() {
|
||
|
const selectedIndex = this.findSelectedItemIndex();
|
||
|
return selectedIndex < 0 ? this.findFirstItemIndex() : selectedIndex;
|
||
|
}
|
||
|
findFirstItemIndex() {
|
||
|
return this.visibleItems.findIndex((processedItem) => this.isValidItem(processedItem));
|
||
|
}
|
||
|
findSelectedItemIndex() {
|
||
|
return this.visibleItems.findIndex((processedItem) => this.isValidSelectedItem(processedItem));
|
||
|
}
|
||
|
changeFocusedItemIndex(event, index) {
|
||
|
if (this.focusedItemInfo().index !== index) {
|
||
|
this.focusedItemInfo.set({ ...this.focusedItemInfo(), index });
|
||
|
this.scrollInView();
|
||
|
}
|
||
|
}
|
||
|
scrollInView(index = -1) {
|
||
|
const id = index !== -1 ? `${this.id}_${index}` : this.focusedItemId;
|
||
|
const element = DomHandler.findSingle(this.rootmenu.el.nativeElement, `li[id="${id}"]`);
|
||
|
if (element) {
|
||
|
element.scrollIntoView && element.scrollIntoView({ block: 'nearest', inline: 'nearest' });
|
||
|
}
|
||
|
}
|
||
|
bindResizeListener() {
|
||
|
if (isPlatformBrowser(this.platformId)) {
|
||
|
if (!this.resizeListener) {
|
||
|
this.resizeListener = this.renderer.listen(this.document.defaultView, 'resize', (event) => {
|
||
|
if (!DomHandler.isTouchDevice()) {
|
||
|
this.hide(event, true);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
bindOutsideClickListener() {
|
||
|
if (isPlatformBrowser(this.platformId)) {
|
||
|
if (!this.outsideClickListener) {
|
||
|
this.outsideClickListener = this.renderer.listen(this.document, 'click', (event) => {
|
||
|
const isOutsideContainer = this.containerViewChild && !this.containerViewChild.nativeElement.contains(event.target);
|
||
|
const isOutsideTarget = this.popup ? !(this.target && (this.target === event.target || this.target.contains(event.target))) : true;
|
||
|
if (this.popup) {
|
||
|
if (isOutsideContainer && isOutsideTarget) {
|
||
|
this.onMenuBlur();
|
||
|
this.hide();
|
||
|
}
|
||
|
}
|
||
|
else {
|
||
|
if (isOutsideContainer && isOutsideTarget && this.focused) {
|
||
|
this.onMenuBlur();
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
unbindOutsideClickListener() {
|
||
|
if (this.outsideClickListener) {
|
||
|
this.outsideClickListener();
|
||
|
this.outsideClickListener = null;
|
||
|
}
|
||
|
}
|
||
|
unbindResizeListener() {
|
||
|
if (this.resizeListener) {
|
||
|
this.resizeListener();
|
||
|
this.resizeListener = null;
|
||
|
}
|
||
|
}
|
||
|
onOverlayHide() {
|
||
|
this.unbindOutsideClickListener();
|
||
|
this.unbindResizeListener();
|
||
|
this.left = 0;
|
||
|
if (!this.cd.destroyed) {
|
||
|
this.target = null;
|
||
|
}
|
||
|
if (this.container) {
|
||
|
this.container = null;
|
||
|
}
|
||
|
}
|
||
|
ngOnDestroy() {
|
||
|
if (this.popup) {
|
||
|
if (this.container && this.autoZIndex) {
|
||
|
ZIndexUtils.clear(this.container);
|
||
|
}
|
||
|
this.restoreOverlayAppend();
|
||
|
this.onOverlayHide();
|
||
|
}
|
||
|
this.unbindTransitionListeners();
|
||
|
}
|
||
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: SlideMenu, deps: [{ token: DOCUMENT }, { token: PLATFORM_ID }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: i5.PrimeNGConfig }, { token: i5.OverlayService }], target: i0.ɵɵFactoryTarget.Component });
|
||
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "17.3.7", type: SlideMenu, selector: "p-slideMenu", inputs: { model: "model", menuWidth: ["menuWidth", "menuWidth", numberAttribute], viewportHeight: ["viewportHeight", "viewportHeight", numberAttribute], effectDuration: ["effectDuration", "effectDuration", numberAttribute], easing: "easing", backLabel: "backLabel", disabled: ["disabled", "disabled", booleanAttribute], tabindex: ["tabindex", "tabindex", numberAttribute], popup: ["popup", "popup", booleanAttribute], style: "style", styleClass: "styleClass", appendTo: "appendTo", autoZIndex: ["autoZIndex", "autoZIndex", booleanAttribute], baseZIndex: ["baseZIndex", "baseZIndex", numberAttribute], autoDisplay: ["autoDisplay", "autoDisplay", booleanAttribute], showTransitionOptions: "showTransitionOptions", hideTransitionOptions: "hideTransitionOptions", id: "id", ariaLabel: "ariaLabel", ariaLabelledBy: "ariaLabelledBy" }, outputs: { onShow: "onShow", onHide: "onHide" }, host: { classAttribute: "p-element" }, queries: [{ propertyName: "templates", predicate: PrimeTemplate }], viewQueries: [{ propertyName: "rootmenu", first: true, predicate: ["rootmenu"], descendants: true }, { propertyName: "containerViewChild", first: true, predicate: ["container"], descendants: true }, { propertyName: "backward", first: true, predicate: ["backward"], descendants: true }, { propertyName: "slideMenuContentViewChild", first: true, predicate: ["slideMenuContent"], descendants: true }], ngImport: i0, template: `
|
||
|
<div
|
||
|
#container
|
||
|
[attr.data-pc-section]="'root'"
|
||
|
[attr.data-pc-name]="'slidemenu'"
|
||
|
[id]="id"
|
||
|
[ngClass]="{ 'p-slidemenu p-component': true, 'p-slidemenu-overlay': popup }"
|
||
|
[class]="styleClass"
|
||
|
[ngStyle]="style"
|
||
|
(click)="onOverlayClick($event)"
|
||
|
[@overlayAnimation]="{ value: 'visible', params: { showTransitionParams: showTransitionOptions, hideTransitionParams: hideTransitionOptions } }"
|
||
|
[@.disabled]="popup !== true"
|
||
|
(@overlayAnimation.start)="onOverlayAnimationStart($event)"
|
||
|
(@overlayAnimation.done)="onOverlayAnimationEnd($event)"
|
||
|
*ngIf="!popup || visible"
|
||
|
>
|
||
|
<div class="p-slidemenu-wrapper" [style.height]="left ? viewportHeight + 'px' : 'auto'" [style.width]="menuWidth + 'px'">
|
||
|
<div #slideMenuContent class="p-slidemenu-content" (focus)="logFocus($event, slideMenuContent)">
|
||
|
<p-slideMenuSub
|
||
|
#rootmenu
|
||
|
[root]="true"
|
||
|
[items]="processedItems"
|
||
|
[menuId]="id"
|
||
|
[tabindex]="!disabled ? tabindex : -1"
|
||
|
[ariaLabel]="ariaLabel"
|
||
|
[ariaLabelledBy]="ariaLabelledBy"
|
||
|
[baseZIndex]="baseZIndex"
|
||
|
[autoZIndex]="autoZIndex"
|
||
|
[autoDisplay]="autoDisplay"
|
||
|
[menuWidth]="menuWidth"
|
||
|
[popup]="popup"
|
||
|
[effectDuration]="effectDuration"
|
||
|
[easing]="easing"
|
||
|
[focusedItemId]="focused ? focusedItemId : undefined"
|
||
|
[activeItemPath]="activeItemPath()"
|
||
|
(itemClick)="onItemClick($event)"
|
||
|
(menuFocus)="onMenuFocus($event)"
|
||
|
(menuKeydown)="onKeyDown($event)"
|
||
|
(itemMouseEnter)="onItemMouseEnter($event)"
|
||
|
></p-slideMenuSub>
|
||
|
</div>
|
||
|
<a #backward class="p-slidemenu-backward p-menuitem-link" tabindex="0" [style.display]="left ? 'block' : 'none'" (click)="goBack($event)" (keydown)="onNavigationKeyDown($event)" [attr.data-pc-section]="'navigation'">
|
||
|
<CaretLeftIcon *ngIf="!backIconTemplate" [styleClass]="'p-slidemenu-backward-icon'" [ngStyle]="{ 'vertical-align': 'middle' }" />
|
||
|
<ng-template *ngTemplateOutlet="backIconTemplate"></ng-template>
|
||
|
<span>{{ backLabel }}</span>
|
||
|
</a>
|
||
|
</div>
|
||
|
</div>
|
||
|
`, isInline: true, styles: ["@layer primeng{.p-slidemenu .p-slidemenu-root-list{position:relative;top:0}.p-slidemenu-overlay{position:absolute;top:0;left:0}.p-slidemenu .p-menuitem-active{position:static}.p-slidemenu .p-slidemenu-wrapper{position:relative}.p-slidemenu ul{margin:0;padding:0;list-style:none}.p-slidemenu .p-submenu-list{position:absolute;min-width:100%;z-index:1;display:none}.p-slidemenu .p-slidemenu-content{overflow-x:hidden;overflow-y:auto;position:relative;height:100%}.p-slidemenu .p-menuitem-link:not(.p-slidemenu-backward){cursor:pointer;display:flex;align-items:center;text-decoration:none;overflow:hidden;position:relative}.p-slidemenu .p-menuitem-text{line-height:1}.p-slidemenu .p-menuitem{position:relative}.p-slidemenu .p-menuitem-link .p-submenu-icon:not(svg){margin-left:auto}.p-slidemenu .p-menuitem-link .p-icon-wrapper{margin-left:auto}.p-slidemenu .p-menuitem-active>p-slidemenusub>.p-submenu-list{display:block;left:100%;top:0}.p-slidemenu .p-menuitem-active>.p-menuitem-content>.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-menuitem-content>.p-submenu>.p-submenu-list{display:none}.p-slidemenu .p-active-submenu>.p-menuitem-active~.p-menuitem{display:block}.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}}\n"], dependencies: [{ kind: "directive", type: i0.forwardRef(() => i1.NgClass), selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i0.forwardRef(() => i1.NgIf), selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i0.forwardRef(() => i1.NgTemplateOutlet), selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i0.forwardRef(() => i1.NgStyle), selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i0.forwardRef(() => CaretLeftIcon), selector: "CaretLeftIcon" }, { kind: "component", type: i0.forwardRef(() => SlideMenuSub), selector: "p-slideMenuSub", inputs: ["items", "menuWidth", "root", "easing", "effectDuration", "autoDisplay", "autoZIndex", "baseZIndex", "popup", "menuId", "ariaLabel", "ariaLabelledBy", "level", "focusedItemId", "activeItemPath", "tabindex"], outputs: ["itemClick", "itemMouseEnter", "menuFocus", "menuBlur", "menuKeydown"] }], animations: [trigger('overlayAnimation', [transition(':enter', [style({ opacity: 0, transform: 'scaleY(0.8)' }), animate('{{showTransitionParams}}')]), transition(':leave', [animate('{{hideTransitionParams}}', style({ opacity: 0 }))])])], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
||
|
}
|
||
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: SlideMenu, decorators: [{
|
||
|
type: Component,
|
||
|
args: [{ selector: 'p-slideMenu', template: `
|
||
|
<div
|
||
|
#container
|
||
|
[attr.data-pc-section]="'root'"
|
||
|
[attr.data-pc-name]="'slidemenu'"
|
||
|
[id]="id"
|
||
|
[ngClass]="{ 'p-slidemenu p-component': true, 'p-slidemenu-overlay': popup }"
|
||
|
[class]="styleClass"
|
||
|
[ngStyle]="style"
|
||
|
(click)="onOverlayClick($event)"
|
||
|
[@overlayAnimation]="{ value: 'visible', params: { showTransitionParams: showTransitionOptions, hideTransitionParams: hideTransitionOptions } }"
|
||
|
[@.disabled]="popup !== true"
|
||
|
(@overlayAnimation.start)="onOverlayAnimationStart($event)"
|
||
|
(@overlayAnimation.done)="onOverlayAnimationEnd($event)"
|
||
|
*ngIf="!popup || visible"
|
||
|
>
|
||
|
<div class="p-slidemenu-wrapper" [style.height]="left ? viewportHeight + 'px' : 'auto'" [style.width]="menuWidth + 'px'">
|
||
|
<div #slideMenuContent class="p-slidemenu-content" (focus)="logFocus($event, slideMenuContent)">
|
||
|
<p-slideMenuSub
|
||
|
#rootmenu
|
||
|
[root]="true"
|
||
|
[items]="processedItems"
|
||
|
[menuId]="id"
|
||
|
[tabindex]="!disabled ? tabindex : -1"
|
||
|
[ariaLabel]="ariaLabel"
|
||
|
[ariaLabelledBy]="ariaLabelledBy"
|
||
|
[baseZIndex]="baseZIndex"
|
||
|
[autoZIndex]="autoZIndex"
|
||
|
[autoDisplay]="autoDisplay"
|
||
|
[menuWidth]="menuWidth"
|
||
|
[popup]="popup"
|
||
|
[effectDuration]="effectDuration"
|
||
|
[easing]="easing"
|
||
|
[focusedItemId]="focused ? focusedItemId : undefined"
|
||
|
[activeItemPath]="activeItemPath()"
|
||
|
(itemClick)="onItemClick($event)"
|
||
|
(menuFocus)="onMenuFocus($event)"
|
||
|
(menuKeydown)="onKeyDown($event)"
|
||
|
(itemMouseEnter)="onItemMouseEnter($event)"
|
||
|
></p-slideMenuSub>
|
||
|
</div>
|
||
|
<a #backward class="p-slidemenu-backward p-menuitem-link" tabindex="0" [style.display]="left ? 'block' : 'none'" (click)="goBack($event)" (keydown)="onNavigationKeyDown($event)" [attr.data-pc-section]="'navigation'">
|
||
|
<CaretLeftIcon *ngIf="!backIconTemplate" [styleClass]="'p-slidemenu-backward-icon'" [ngStyle]="{ 'vertical-align': 'middle' }" />
|
||
|
<ng-template *ngTemplateOutlet="backIconTemplate"></ng-template>
|
||
|
<span>{{ backLabel }}</span>
|
||
|
</a>
|
||
|
</div>
|
||
|
</div>
|
||
|
`, animations: [trigger('overlayAnimation', [transition(':enter', [style({ opacity: 0, transform: 'scaleY(0.8)' }), animate('{{showTransitionParams}}')]), transition(':leave', [animate('{{hideTransitionParams}}', style({ opacity: 0 }))])])], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
||
|
class: 'p-element'
|
||
|
}, styles: ["@layer primeng{.p-slidemenu .p-slidemenu-root-list{position:relative;top:0}.p-slidemenu-overlay{position:absolute;top:0;left:0}.p-slidemenu .p-menuitem-active{position:static}.p-slidemenu .p-slidemenu-wrapper{position:relative}.p-slidemenu ul{margin:0;padding:0;list-style:none}.p-slidemenu .p-submenu-list{position:absolute;min-width:100%;z-index:1;display:none}.p-slidemenu .p-slidemenu-content{overflow-x:hidden;overflow-y:auto;position:relative;height:100%}.p-slidemenu .p-menuitem-link:not(.p-slidemenu-backward){cursor:pointer;display:flex;align-items:center;text-decoration:none;overflow:hidden;position:relative}.p-slidemenu .p-menuitem-text{line-height:1}.p-slidemenu .p-menuitem{position:relative}.p-slidemenu .p-menuitem-link .p-submenu-icon:not(svg){margin-left:auto}.p-slidemenu .p-menuitem-link .p-icon-wrapper{margin-left:auto}.p-slidemenu .p-menuitem-active>p-slidemenusub>.p-submenu-list{display:block;left:100%;top:0}.p-slidemenu .p-menuitem-active>.p-menuitem-content>.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-menuitem-content>.p-submenu>.p-submenu-list{display:none}.p-slidemenu .p-active-submenu>.p-menuitem-active~.p-menuitem{display:block}.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}}\n"] }]
|
||
|
}], ctorParameters: () => [{ type: Document, decorators: [{
|
||
|
type: Inject,
|
||
|
args: [DOCUMENT]
|
||
|
}] }, { type: undefined, decorators: [{
|
||
|
type: Inject,
|
||
|
args: [PLATFORM_ID]
|
||
|
}] }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: i5.PrimeNGConfig }, { type: i5.OverlayService }], propDecorators: { model: [{
|
||
|
type: Input
|
||
|
}], menuWidth: [{
|
||
|
type: Input,
|
||
|
args: [{ transform: numberAttribute }]
|
||
|
}], viewportHeight: [{
|
||
|
type: Input,
|
||
|
args: [{ transform: numberAttribute }]
|
||
|
}], effectDuration: [{
|
||
|
type: Input,
|
||
|
args: [{ transform: numberAttribute }]
|
||
|
}], easing: [{
|
||
|
type: Input
|
||
|
}], backLabel: [{
|
||
|
type: Input
|
||
|
}], disabled: [{
|
||
|
type: Input,
|
||
|
args: [{ transform: booleanAttribute }]
|
||
|
}], tabindex: [{
|
||
|
type: Input,
|
||
|
args: [{ transform: numberAttribute }]
|
||
|
}], popup: [{
|
||
|
type: Input,
|
||
|
args: [{ transform: booleanAttribute }]
|
||
|
}], style: [{
|
||
|
type: Input
|
||
|
}], styleClass: [{
|
||
|
type: Input
|
||
|
}], appendTo: [{
|
||
|
type: Input
|
||
|
}], autoZIndex: [{
|
||
|
type: Input,
|
||
|
args: [{ transform: booleanAttribute }]
|
||
|
}], baseZIndex: [{
|
||
|
type: Input,
|
||
|
args: [{ transform: numberAttribute }]
|
||
|
}], autoDisplay: [{
|
||
|
type: Input,
|
||
|
args: [{ transform: booleanAttribute }]
|
||
|
}], showTransitionOptions: [{
|
||
|
type: Input
|
||
|
}], hideTransitionOptions: [{
|
||
|
type: Input
|
||
|
}], id: [{
|
||
|
type: Input
|
||
|
}], ariaLabel: [{
|
||
|
type: Input
|
||
|
}], ariaLabelledBy: [{
|
||
|
type: Input
|
||
|
}], onShow: [{
|
||
|
type: Output
|
||
|
}], onHide: [{
|
||
|
type: Output
|
||
|
}], templates: [{
|
||
|
type: ContentChildren,
|
||
|
args: [PrimeTemplate]
|
||
|
}], rootmenu: [{
|
||
|
type: ViewChild,
|
||
|
args: ['rootmenu']
|
||
|
}], containerViewChild: [{
|
||
|
type: ViewChild,
|
||
|
args: ['container']
|
||
|
}], backward: [{
|
||
|
type: ViewChild,
|
||
|
args: ['backward']
|
||
|
}], slideMenuContentViewChild: [{
|
||
|
type: ViewChild,
|
||
|
args: ['slideMenuContent']
|
||
|
}] } });
|
||
|
export class SlideMenuModule {
|
||
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: SlideMenuModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
||
|
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.7", ngImport: i0, type: SlideMenuModule, declarations: [SlideMenu, SlideMenuSub], imports: [CommonModule, RouterModule, RippleModule, TooltipModule, AngleRightIcon, SharedModule, CaretLeftIcon], exports: [SlideMenu, RouterModule, TooltipModule, SharedModule] });
|
||
|
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: SlideMenuModule, imports: [CommonModule, RouterModule, RippleModule, TooltipModule, AngleRightIcon, SharedModule, CaretLeftIcon, RouterModule, TooltipModule, SharedModule] });
|
||
|
}
|
||
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: SlideMenuModule, decorators: [{
|
||
|
type: NgModule,
|
||
|
args: [{
|
||
|
imports: [CommonModule, RouterModule, RippleModule, TooltipModule, AngleRightIcon, SharedModule, CaretLeftIcon],
|
||
|
exports: [SlideMenu, RouterModule, TooltipModule, SharedModule],
|
||
|
declarations: [SlideMenu, SlideMenuSub]
|
||
|
}]
|
||
|
}] });
|
||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2xpZGVtZW51LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2FwcC9jb21wb25lbnRzL3NsaWRlbWVudS9zbGlkZW1lbnUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFrQixPQUFPLEVBQUUsS0FBSyxFQUFFLFVBQVUsRUFBRSxPQUFPLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUMxRixPQUFPLEVBQUUsWUFBWSxFQUFFLFFBQVEsRUFBRSxpQkFBaUIsRUFBRSxNQUFNLGlCQUFpQixDQUFDO0FBQzVFLE9BQU8sRUFFSCx1QkFBdUIsRUFFdkIsU0FBUyxFQUNULGVBQWUsRUFFZixZQUFZLEVBQ1osTUFBTSxFQUNOLEtBQUssRUFDTCxRQUFRLEVBR1IsTUFBTSxFQUNOLFdBQVcsRUFJWCxTQUFTLEVBQ1QsaUJBQWlCLEVBRWpCLGdCQUFnQixFQUNoQixNQUFNLEVBQ04sVUFBVSxFQUNWLGVBQWUsRUFDZixNQUFNLEVBQ1QsTUFBTSxlQUFlLENBQUM7QUFDdkIsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLGlCQUFpQixDQUFDO0FBQy9DLE9BQU8sRUFBMkMsYUFBYSxFQUFFLFlBQVksRUFBRSxNQUFNLGFBQWEsQ0FBQztBQUNuRyxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sYUFBYSxDQUFDO0FBQ3pDLE9BQU8sRUFBRSxjQUFjLEVBQUUsTUFBTSwwQkFBMEIsQ0FBQztBQUMxRCxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sZ0JBQWdCLENBQUM7QUFDOUMsT0FBTyxFQUFFLGFBQWEsRUFBRSxNQUFNLGlCQUFpQixDQUFDO0FBQ2hELE9BQU8sRUFBRSxXQUFXLEVBQUUsaUJBQWlCLEVBQUUsV0FBVyxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBRTVFLE9BQU8sRUFBRSxhQUFhLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQzs7Ozs7OztBQThKeEQsTUFBTSxPQUFPLFlBQVk7SUFpRGlCO0lBQTJCO0lBQXVCO0lBQTZC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
|