primeng
Version:
[](https://opensource.org/licenses/MIT) [](https://badge.fury.io/js/primeng) [{"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/animations"),require("@angular/common"),require("primeng/api")):"function"==typeof define&&define.amd?define("primeng/accordion",["exports","@angular/core","@angular/animations","@angular/common","primeng/api"],e):e(((t=t||self).primeng=t.primeng||{},t.primeng.accordion={}),t.ng.core,t.ng.animations,t.ng.common,t.primeng.api)}(this,(function(t,e,n,i,o){"use strict";var a=this&&this.__decorate||function(t,e,n,i){var o,a=arguments.length,r=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(r=(a<3?o(r):a>3?o(e,n,r):o(e,n))||r);return a>3&&r&&Object.defineProperty(e,n,r),r},r=this&&this.__param||function(t,e){return function(n,i){e(n,i,t)}},s=0,c=function(){function t(t,n){this.changeDetector=n,this.cache=!0,this.selectedChange=new e.EventEmitter,this.transitionOptions="400ms cubic-bezier(0.86, 0, 0.07, 1)",this.id="ui-accordiontab-"+s++,this.accordion=t}return Object.defineProperty(t.prototype,"selected",{get:function(){return this._selected},set:function(t){this._selected=t,this.loaded||this.changeDetector.detectChanges()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"animating",{get:function(){return this._animating},set:function(t){this._animating=t,this.changeDetector.destroyed||this.changeDetector.detectChanges()},enumerable:!0,configurable:!0}),t.prototype.ngAfterContentInit=function(){var t=this;this.templates.forEach((function(e){switch(e.getType()){case"content":default:t.contentTemplate=e.template}}))},t.prototype.toggle=function(t){if(this.disabled||this.animating)return!1;this.animating=!0;var e=this.findTabIndex();if(this.selected)this.selected=!1,this.accordion.onClose.emit({originalEvent:t,index:e});else{if(!this.accordion.multiple)for(var n=0;n<this.accordion.tabs.length;n++)this.accordion.tabs[n].selected=!1,this.accordion.tabs[n].selectedChange.emit(!1);this.selected=!0,this.loaded=!0,this.accordion.onOpen.emit({originalEvent:t,index:e})}this.selectedChange.emit(this.selected),this.accordion.updateActiveIndex(),t.preventDefault()},t.prototype.findTabIndex=function(){for(var t=-1,e=0;e<this.accordion.tabs.length;e++)if(this.accordion.tabs[e]==this){t=e;break}return t},Object.defineProperty(t.prototype,"hasHeaderFacet",{get:function(){return this.headerFacet&&this.headerFacet.length>0},enumerable:!0,configurable:!0}),t.prototype.onToggleDone=function(t){this.animating=!1},t.prototype.onKeydown=function(t){32!==t.which&&13!==t.which||(this.toggle(t),t.preventDefault())},t.prototype.ngOnDestroy=function(){this.accordion.tabs.splice(this.findTabIndex(),1)},t.ctorParameters=function(){return[{type:void 0,decorators:[{type:e.Inject,args:[e.forwardRef((function(){return d}))]}]},{type:e.ChangeDetectorRef}]},a([e.Input()],t.prototype,"header",void 0),a([e.Input()],t.prototype,"disabled",void 0),a([e.Input()],t.prototype,"cache",void 0),a([e.Output()],t.prototype,"selectedChange",void 0),a([e.Input()],t.prototype,"transitionOptions",void 0),a([e.ContentChildren(o.Header)],t.prototype,"headerFacet",void 0),a([e.ContentChildren(o.PrimeTemplate)],t.prototype,"templates",void 0),a([e.Input()],t.prototype,"selected",null),t=a([e.Component({selector:"p-accordionTab",template:'\n <div class="ui-accordion-header ui-state-default ui-corner-all" [ngClass]="{\'ui-state-active\': selected,\'ui-state-disabled\':disabled}">\n <a [attr.tabindex]="disabled ? -1 : 0" [attr.id]="id" [attr.aria-controls]="id + \'-content\'" role="tab" [attr.aria-expanded]="selected" (click)="toggle($event)" \n (keydown)="onKeydown($event)">\n <span class="ui-accordion-toggle-icon" [ngClass]="selected ? accordion.collapseIcon : accordion.expandIcon"></span>\n <span class="ui-accordion-header-text" *ngIf="!hasHeaderFacet">\n {{header}}\n </span>\n <ng-content select="p-header" *ngIf="hasHeaderFacet"></ng-content>\n </a>\n </div>\n <div [attr.id]="id + \'-content\'" class="ui-accordion-content-wrapper" [@tabContent]="selected ? {value: \'visible\', params: {transitionParams: animating ? transitionOptions : \'0ms\', height: \'*\'}} : {value: \'hidden\', params: {transitionParams: transitionOptions, height: \'0\'}}" (@tabContent.done)="onToggleDone($event)"\n [ngClass]="{\'ui-accordion-content-wrapper-overflown\': !selected||animating}" \n role="region" [attr.aria-hidden]="!selected" [attr.aria-labelledby]="id">\n <div class="ui-accordion-content ui-widget-content">\n <ng-content></ng-content>\n <ng-container *ngIf="contentTemplate && (cache ? loaded : selected)">\n <ng-container *ngTemplateOutlet="contentTemplate"></ng-container>\n </ng-container>\n </div>\n </div>\n ',animations:[n.trigger("tabContent",[n.state("hidden",n.style({height:"0"})),n.state("void",n.style({height:"{{height}}"}),{params:{height:"0"}}),n.state("visible",n.style({height:"*"})),n.transition("visible <=> hidden",n.animate("{{transitionParams}}")),n.transition("void => hidden",n.animate("{{transitionParams}}")),n.transition("void => visible",n.animate("{{transitionParams}}"))])],changeDetection:e.ChangeDetectionStrategy.Default}),r(0,e.Inject(e.forwardRef((function(){return d}))))],t)}(),d=function(){function t(t,n){this.el=t,this.changeDetector=n,this.onClose=new e.EventEmitter,this.onOpen=new e.EventEmitter,this.expandIcon="pi pi-fw pi-chevron-right",this.collapseIcon="pi pi-fw pi-chevron-down",this.activeIndexChange=new e.EventEmitter,this.tabs=[]}return t.prototype.ngAfterContentInit=function(){var t=this;this.initTabs(),this.tabListSubscription=this.tabList.changes.subscribe((function(e){t.initTabs(),t.changeDetector.markForCheck()}))},t.prototype.initTabs=function(){this.tabs=this.tabList.toArray(),this.updateSelectionState()},t.prototype.getBlockableElement=function(){return this.el.nativeElement.children[0]},Object.defineProperty(t.prototype,"activeIndex",{get:function(){return this._activeIndex},set:function(t){this._activeIndex=t,this.preventActiveIndexPropagation?this.preventActiveIndexPropagation=!1:this.updateSelectionState()},enumerable:!0,configurable:!0}),t.prototype.updateSelectionState=function(){if(this.tabs&&this.tabs.length&&null!=this._activeIndex)for(var t=0;t<this.tabs.length;t++){var e=this.multiple?this._activeIndex.includes(t):t===this._activeIndex;e!==this.tabs[t].selected&&(this.tabs[t].animating=!0,this.tabs[t].selected=e,this.tabs[t].selectedChange.emit(e))}},t.prototype.updateActiveIndex=function(){var t=this,e=this.multiple?[]:null;this.tabs.forEach((function(n,i){if(n.selected){if(!t.multiple)return void(e=i);e.push(i)}})),this.preventActiveIndexPropagation=!0,this.activeIndexChange.emit(e)},t.prototype.ngOnDestroy=function(){this.tabListSubscription&&this.tabListSubscription.unsubscribe()},t.ctorParameters=function(){return[{type:e.ElementRef},{type:e.ChangeDetectorRef}]},a([e.Input()],t.prototype,"multiple",void 0),a([e.Output()],t.prototype,"onClose",void 0),a([e.Output()],t.prototype,"onOpen",void 0),a([e.Input()],t.prototype,"style",void 0),a([e.Input()],t.prototype,"styleClass",void 0),a([e.Input()],t.prototype,"expandIcon",void 0),a([e.Input()],t.prototype,"collapseIcon",void 0),a([e.Output()],t.prototype,"activeIndexChange",void 0),a([e.ContentChildren(c)],t.prototype,"tabList",void 0),a([e.Input()],t.prototype,"activeIndex",null),t=a([e.Component({selector:"p-accordion",template:'\n <div [ngClass]="\'ui-accordion ui-widget ui-helper-reset\'" [ngStyle]="style" [class]="styleClass" role="tablist">\n <ng-content></ng-content>\n </div>\n '})],t)}(),p=function(){function t(){}return t=a([e.NgModule({imports:[i.CommonModule],exports:[d,c,o.SharedModule],declarations:[d,c]})],t)}();t.Accordion=d,t.AccordionModule=p,t.AccordionTab=c,Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=primeng-accordion.umd.min.js.map