import { Component, ViewEncapsulation, ChangeDetectorRef, Input, ChangeDetectionStrategy, NgModule } from '@angular/core';
import { trigger, state, style, transition, animate } from '@angular/animations';
import { CommonModule } from '@angular/common';
import { RouterModule } from '@angular/router';
class BasePanelMenuItem {
constructor(ref) {
this.ref = ref;
}
handleClick(event, item) {
if (item.disabled) {
event.preventDefault();
return;
}
item.expanded = !item.expanded;
this.ref.detectChanges();
if (!item.url) {
event.preventDefault();
}
if (item.command) {
item.command({
originalEvent: event,
item: item
});
}
}
}
class PanelMenuSub extends BasePanelMenuItem {
constructor(ref) {
super(ref);
}
}
PanelMenuSub.decorators = [
{ type: Component, args: [{
selector: 'p-panelMenuSub',
template: `
`,
animations: [
trigger('submenu', [
state('hidden', style({
height: '0',
overflow: 'hidden'
})),
state('visible', style({
height: '*'
})),
transition('visible <=> hidden', [style({ overflow: 'hidden' }), animate('{{transitionParams}}')]),
transition('void => *', animate(0))
])
],
encapsulation: ViewEncapsulation.None
},] }
];
PanelMenuSub.ctorParameters = () => [
{ type: ChangeDetectorRef }
];
PanelMenuSub.propDecorators = {
item: [{ type: Input }],
expanded: [{ type: Input }],
transitionOptions: [{ type: Input }],
root: [{ type: Input }]
};
class PanelMenu extends BasePanelMenuItem {
constructor(ref) {
super(ref);
this.multiple = true;
this.transitionOptions = '400ms cubic-bezier(0.86, 0, 0.07, 1)';
}
collapseAll() {
for (let item of this.model) {
if (item.expanded) {
item.expanded = false;
}
}
}
handleClick(event, item) {
if (!this.multiple) {
for (let modelItem of this.model) {
if (item !== modelItem && modelItem.expanded) {
modelItem.expanded = false;
}
}
}
this.animating = true;
super.handleClick(event, item);
}
onToggleDone() {
this.animating = false;
}
}
PanelMenu.decorators = [
{ type: Component, args: [{
selector: 'p-panelMenu',
template: `
`,
animations: [
trigger('rootItem', [
state('hidden', style({
height: '0',
overflow: 'hidden'
})),
state('visible', style({
height: '*'
})),
transition('visible <=> hidden', [style({ overflow: 'hidden' }), animate('{{transitionParams}}')]),
transition('void => *', animate(0))
])
],
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
styles: [".p-panelmenu .p-panelmenu-header-link{-moz-user-select:none;-ms-flex-align:center;-ms-user-select:none;-webkit-user-select:none;align-items:center;cursor:pointer;display:-ms-flexbox;display:flex;position:relative;text-decoration:none;user-select:none}.p-panelmenu .p-panelmenu-header-link:focus{z-index:1}.p-panelmenu .p-submenu-list{list-style:none;margin:0;padding:0}.p-panelmenu .p-menuitem-link{-moz-user-select:none;-ms-flex-align:center;-ms-user-select:none;-webkit-user-select:none;align-items:center;cursor:pointer;display:-ms-flexbox;display:flex;text-decoration:none;user-select:none}.p-panelmenu .p-menuitem-text{line-height:1}"]
},] }
];
PanelMenu.ctorParameters = () => [
{ type: ChangeDetectorRef }
];
PanelMenu.propDecorators = {
model: [{ type: Input }],
style: [{ type: Input }],
styleClass: [{ type: Input }],
multiple: [{ type: Input }],
transitionOptions: [{ type: Input }]
};
class PanelMenuModule {
}
PanelMenuModule.decorators = [
{ type: NgModule, args: [{
imports: [CommonModule, RouterModule],
exports: [PanelMenu, RouterModule],
declarations: [PanelMenu, PanelMenuSub]
},] }
];
/**
* Generated bundle index. Do not edit.
*/
export { BasePanelMenuItem, PanelMenu, PanelMenuModule, PanelMenuSub };
//# sourceMappingURL=primeng-panelmenu.js.map