primeng
Version:
[](https://opensource.org/licenses/MIT) [](https://badge.fury.io/js/primeng) [{"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("primeng/dom"),require("@angular/animations")):"function"==typeof define&&define.amd?define("primeng/overlaypanel",["exports","@angular/core","@angular/common","primeng/dom","@angular/animations"],t):t(((e=e||self).primeng=e.primeng||{},e.primeng.overlaypanel={}),e.ng.core,e.ng.common,e.primeng.dom,e.ng.animations)}(this,(function(e,t,n,i,o){"use strict";var s=this&&this.__decorate||function(e,t,n,i){var o,s=arguments.length,r=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(s<3?o(r):s>3?o(t,n,r):o(t,n))||r);return s>3&&r&&Object.defineProperty(t,n,r),r},r=function(){function e(e,n,i,o){this.el=e,this.renderer=n,this.cd=i,this.zone=o,this.dismissable=!0,this.autoZIndex=!0,this.baseZIndex=0,this.showTransitionOptions="225ms ease-out",this.hideTransitionOptions="195ms ease-in",this.onShow=new t.EventEmitter,this.onHide=new t.EventEmitter,this.visible=!1,this.isContainerClicked=!0}return e.prototype.onContainerClick=function(){this.isContainerClicked=!0},e.prototype.bindDocumentClickListener=function(){var e=this;!this.documentClickListener&&this.dismissable&&this.zone.runOutsideAngular((function(){var t=i.DomHandler.isIOS()?"touchstart":"click";e.documentClickListener=e.renderer.listen("document",t,(function(t){e.container.contains(t.target)||e.target===t.target||e.target.contains(t.target)||e.isContainerClicked||e.zone.run((function(){e.hide()})),e.isContainerClicked=!1,e.cd.markForCheck()}))}))},e.prototype.unbindDocumentClickListener=function(){this.documentClickListener&&(this.documentClickListener(),this.documentClickListener=null)},e.prototype.toggle=function(e,t){var n=this;this.visible?(this.visible=!1,this.hasTargetChanged(e,t)&&(this.target=t||e.currentTarget||e.target,setTimeout((function(){n.visible=!0}),200))):this.show(e,t)},e.prototype.show=function(e,t){this.target=t||e.currentTarget||e.target,this.visible=!0},e.prototype.hasTargetChanged=function(e,t){return null!=this.target&&this.target!==(t||e.currentTarget||e.target)},e.prototype.appendContainer=function(){this.appendTo&&("body"===this.appendTo?document.body.appendChild(this.container):i.DomHandler.appendChild(this.container,this.appendTo))},e.prototype.restoreAppend=function(){this.container&&this.appendTo&&this.el.nativeElement.appendChild(this.container)},e.prototype.onAnimationStart=function(e){switch(e.toState){case"visible":this.container=e.element,this.onShow.emit(null),this.appendContainer(),this.autoZIndex&&(this.container.style.zIndex=String(this.baseZIndex+ ++i.DomHandler.zindex)),i.DomHandler.absolutePosition(this.container,this.target),i.DomHandler.getOffset(this.container).top<i.DomHandler.getOffset(this.target).top&&i.DomHandler.addClass(this.container,"ui-overlaypanel-flipped"),Math.floor(i.DomHandler.getOffset(this.container).left)<Math.floor(i.DomHandler.getOffset(this.target).left)&&i.DomHandler.getOffset(this.container).left>0&&i.DomHandler.addClass(this.container,"ui-overlaypanel-shifted"),this.bindDocumentClickListener(),this.bindDocumentResizeListener();break;case"void":this.onContainerDestroy(),this.onHide.emit({})}},e.prototype.hide=function(){this.visible=!1},e.prototype.onCloseClick=function(e){this.hide(),e.preventDefault()},e.prototype.onWindowResize=function(e){this.hide()},e.prototype.bindDocumentResizeListener=function(){this.documentResizeListener=this.onWindowResize.bind(this),window.addEventListener("resize",this.documentResizeListener)},e.prototype.unbindDocumentResizeListener=function(){this.documentResizeListener&&(window.removeEventListener("resize",this.documentResizeListener),this.documentResizeListener=null)},e.prototype.onContainerDestroy=function(){this.unbindDocumentClickListener(),this.unbindDocumentResizeListener()},e.prototype.ngOnDestroy=function(){this.target=null,this.container&&(this.restoreAppend(),this.onContainerDestroy())},e.ctorParameters=function(){return[{type:t.ElementRef},{type:t.Renderer2},{type:t.ChangeDetectorRef},{type:t.NgZone}]},s([t.Input()],e.prototype,"dismissable",void 0),s([t.Input()],e.prototype,"showCloseIcon",void 0),s([t.Input()],e.prototype,"style",void 0),s([t.Input()],e.prototype,"styleClass",void 0),s([t.Input()],e.prototype,"appendTo",void 0),s([t.Input()],e.prototype,"autoZIndex",void 0),s([t.Input()],e.prototype,"ariaCloseLabel",void 0),s([t.Input()],e.prototype,"baseZIndex",void 0),s([t.Input()],e.prototype,"showTransitionOptions",void 0),s([t.Input()],e.prototype,"hideTransitionOptions",void 0),s([t.Output()],e.prototype,"onShow",void 0),s([t.Output()],e.prototype,"onHide",void 0),e=s([t.Component({selector:"p-overlayPanel",template:'\n <div [ngClass]="\'ui-overlaypanel ui-widget ui-widget-content ui-corner-all ui-shadow\'" [ngStyle]="style" [class]="styleClass" (click)="onContainerClick()"\n [@animation]="{value: \'visible\', params: {showTransitionParams: showTransitionOptions, hideTransitionParams: hideTransitionOptions}}" (@animation.start)="onAnimationStart($event)" *ngIf="visible">\n <div class="ui-overlaypanel-content">\n <ng-content></ng-content>\n </div>\n <a tabindex="0" *ngIf="showCloseIcon" class="ui-overlaypanel-close ui-state-default" (click)="onCloseClick($event)" (keydown.enter)="hide()" [attr.aria-label]="ariaCloseLabel">\n <span class="ui-overlaypanel-close-icon pi pi-times"></span>\n </a>\n </div>\n ',animations:[o.trigger("animation",[o.state("void",o.style({transform:"translateY(5%)",opacity:0})),o.state("visible",o.style({transform:"translateY(0)",opacity:1})),o.transition("void => visible",o.animate("{{showTransitionParams}}")),o.transition("visible => void",o.animate("{{hideTransitionParams}}"))])]})],e)}(),a=function(){function e(){}return e=s([t.NgModule({imports:[n.CommonModule],exports:[r],declarations:[r]})],e)}();e.OverlayPanel=r,e.OverlayPanelModule=a,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=primeng-overlaypanel.umd.min.js.map