UNPKG

6.55 kBJavaScriptView Raw
1!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/animations"),require("@angular/common"),require("primeng/dom")):"function"==typeof define&&define.amd?define("primeng/sidebar",["exports","@angular/core","@angular/animations","@angular/common","primeng/dom"],t):t(((e=e||self).primeng=e.primeng||{},e.primeng.sidebar={}),e.ng.core,e.ng.animations,e.ng.common,e.primeng.dom)}(this,(function(e,t,i,n,o){"use strict";var s=this&&this.__decorate||function(e,t,i,n){var o,s=arguments.length,a=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var r=e.length-1;r>=0;r--)(o=e[r])&&(a=(s<3?o(a):s>3?o(t,i,a):o(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a},a=function(){function e(e,i){this.el=e,this.renderer=i,this.position="left",this.blockScroll=!1,this.autoZIndex=!0,this.baseZIndex=0,this.modal=!0,this.dismissible=!0,this.showCloseIcon=!0,this.closeOnEscape=!0,this.onShow=new t.EventEmitter,this.onHide=new t.EventEmitter,this.visibleChange=new t.EventEmitter}return e.prototype.ngAfterViewInit=function(){this.initialized=!0,this.appendTo&&("body"===this.appendTo?document.body.appendChild(this.containerViewChild.nativeElement):o.DomHandler.appendChild(this.containerViewChild.nativeElement,this.appendTo)),this.visible&&this.show()},Object.defineProperty(e.prototype,"visible",{get:function(){return this._visible},set:function(e){this._visible=e,this.initialized&&this.containerViewChild&&this.containerViewChild.nativeElement&&(this._visible?this.show():this.preventVisibleChangePropagation?this.preventVisibleChangePropagation=!1:this.hide())},enumerable:!0,configurable:!0}),e.prototype.ngAfterViewChecked=function(){this.executePostDisplayActions&&(this.onShow.emit({}),this.executePostDisplayActions=!1)},e.prototype.show=function(){this.executePostDisplayActions=!0,this.autoZIndex&&(this.containerViewChild.nativeElement.style.zIndex=String(this.baseZIndex+ ++o.DomHandler.zindex)),this.modal&&this.enableModality()},e.prototype.hide=function(){this.onHide.emit({}),this.modal&&this.disableModality()},e.prototype.close=function(e){this.preventVisibleChangePropagation=!0,this.hide(),this.visibleChange.emit(!1),e.preventDefault()},e.prototype.enableModality=function(){var e=this;this.mask||(this.mask=document.createElement("div"),this.mask.style.zIndex=String(parseInt(this.containerViewChild.nativeElement.style.zIndex)-1),o.DomHandler.addMultipleClasses(this.mask,"ui-widget-overlay ui-sidebar-mask"),this.dismissible&&(this.maskClickListener=this.renderer.listen(this.mask,"click",(function(t){e.dismissible&&e.close(t)}))),document.body.appendChild(this.mask),this.blockScroll&&o.DomHandler.addClass(document.body,"ui-overflow-hidden"))},e.prototype.disableModality=function(){this.mask&&(this.unbindMaskClickListener(),document.body.removeChild(this.mask),this.blockScroll&&o.DomHandler.removeClass(document.body,"ui-overflow-hidden"),this.mask=null)},e.prototype.onAnimationStart=function(e){switch(e.toState){case"visible":this.closeOnEscape&&this.bindDocumentEscapeListener();break;case"hidden":this.unbindGlobalListeners()}},e.prototype.bindDocumentEscapeListener=function(){var e=this;this.documentEscapeListener=this.renderer.listen("document","keydown",(function(t){27==t.which&&parseInt(e.containerViewChild.nativeElement.style.zIndex)===o.DomHandler.zindex+e.baseZIndex&&e.close(t)}))},e.prototype.unbindDocumentEscapeListener=function(){this.documentEscapeListener&&(this.documentEscapeListener(),this.documentEscapeListener=null)},e.prototype.unbindMaskClickListener=function(){this.maskClickListener&&(this.maskClickListener(),this.maskClickListener=null)},e.prototype.unbindGlobalListeners=function(){this.unbindMaskClickListener(),this.unbindDocumentEscapeListener()},e.prototype.ngOnDestroy=function(){this.initialized=!1,this.visible&&this.hide(),this.appendTo&&this.el.nativeElement.appendChild(this.containerViewChild.nativeElement),this.unbindGlobalListeners()},e.ctorParameters=function(){return[{type:t.ElementRef},{type:t.Renderer2}]},s([t.Input()],e.prototype,"position",void 0),s([t.Input()],e.prototype,"fullScreen",void 0),s([t.Input()],e.prototype,"appendTo",void 0),s([t.Input()],e.prototype,"blockScroll",void 0),s([t.Input()],e.prototype,"style",void 0),s([t.Input()],e.prototype,"styleClass",void 0),s([t.Input()],e.prototype,"ariaCloseLabel",void 0),s([t.Input()],e.prototype,"autoZIndex",void 0),s([t.Input()],e.prototype,"baseZIndex",void 0),s([t.Input()],e.prototype,"modal",void 0),s([t.Input()],e.prototype,"dismissible",void 0),s([t.Input()],e.prototype,"showCloseIcon",void 0),s([t.Input()],e.prototype,"closeOnEscape",void 0),s([t.ViewChild("container")],e.prototype,"containerViewChild",void 0),s([t.Output()],e.prototype,"onShow",void 0),s([t.Output()],e.prototype,"onHide",void 0),s([t.Output()],e.prototype,"visibleChange",void 0),s([t.Input()],e.prototype,"visible",null),e=s([t.Component({selector:"p-sidebar",template:'\n <div #container [ngClass]="{\'ui-sidebar ui-widget ui-widget-content ui-shadow\':true, \'ui-sidebar-active\': visible, \n \'ui-sidebar-left\': (position === \'left\'), \'ui-sidebar-right\': (position === \'right\'),\n \'ui-sidebar-top\': (position === \'top\'), \'ui-sidebar-bottom\': (position === \'bottom\'), \n \'ui-sidebar-full\': fullScreen}"\n [@panelState]="visible ? \'visible\' : \'hidden\'" (@panelState.start)="onAnimationStart($event)" [ngStyle]="style" [class]="styleClass" role="complementary" [attr.aria-modal]="modal">\n <a [ngClass]="{\'ui-sidebar-close ui-corner-all\':true}" *ngIf="showCloseIcon" tabindex="0" role="button" (click)="close($event)" (keydown.enter)="close($event)" [attr.aria-label]="ariaCloseLabel">\n <span class="pi pi-times"></span>\n </a>\n <ng-content></ng-content>\n </div>\n ',animations:[i.trigger("panelState",[i.state("hidden",i.style({opacity:0})),i.state("visible",i.style({opacity:1})),i.transition("visible => hidden",i.animate("300ms ease-in")),i.transition("hidden => visible",i.animate("300ms ease-out"))])],changeDetection:t.ChangeDetectionStrategy.Default})],e)}(),r=function(){function e(){}return e=s([t.NgModule({imports:[n.CommonModule],exports:[a],declarations:[a]})],e)}();e.Sidebar=a,e.SidebarModule=r,Object.defineProperty(e,"__esModule",{value:!0})}));
2//# sourceMappingURL=primeng-sidebar.umd.min.js.map
\No newline at end of file