UNPKG

primeng

Version:

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![npm version](https://badge.fury.io/js/primeng.svg)](https://badge.fury.io/js/primeng) [![Build Status](https://travis-ci.org/primefaces/primeng.

2 lines 7.81 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/animations"),require("@angular/common"),require("primeng/dom"),require("rxjs")):"function"==typeof define&&define.amd?define("primeng/dynamicdialog",["exports","@angular/core","@angular/animations","@angular/common","primeng/dom","rxjs"],t):t(((e=e||self).primeng=e.primeng||{},e.primeng.dynamicdialog={}),e.ng.core,e.ng.animations,e.ng.common,e.primeng.dom,e.rxjs)}(this,(function(e,t,n,o,i,r){"use strict";var a=this&&this.__decorate||function(e,t,n,o){var i,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,o);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(r<3?i(a):r>3?i(t,n,a):i(t,n))||a);return r>3&&a&&Object.defineProperty(t,n,a),a},s=function(){function e(e){this.viewContainerRef=e}return e.ctorParameters=function(){return[{type:t.ViewContainerRef}]},e=a([t.Directive({selector:"[pDynamicDialogContent]"})],e)}(),c=function(){},l=function(){function e(){this._onClose=new r.Subject,this.onClose=this._onClose.asObservable()}return e.prototype.close=function(e){this._onClose.next(e)},e}(),p=this&&this.__decorate||function(e,t,n,o){var i,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,o);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(r<3?i(a):r>3?i(t,n,a):i(t,n))||a);return r>3&&a&&Object.defineProperty(t,n,a),a},d=function(){function e(e,t,n,o,i,r){this.componentFactoryResolver=e,this.cd=t,this.renderer=n,this.config=o,this.dialogRef=i,this.zone=r,this.visible=!0}return e.prototype.ngAfterViewInit=function(){this.loadChildComponent(this.childComponentType),this.cd.detectChanges()},e.prototype.onOverlayClicked=function(e){this.dialogRef.close()},e.prototype.onDialogClicked=function(e){e.stopPropagation()},e.prototype.loadChildComponent=function(e){var t=this.componentFactoryResolver.resolveComponentFactory(e),n=this.insertionPoint.viewContainerRef;n.clear(),this.componentRef=n.createComponent(t)},e.prototype.moveOnTop=function(){if(!1!==this.config.autoZIndex){var e=this.config.baseZIndex||++i.DomHandler.zindex+0;this.container.style.zIndex=String(e),this.maskViewChild.nativeElement.style.zIndex=String(e-1)}},e.prototype.onAnimationStart=function(e){switch(e.toState){case"visible":this.container=e.element,this.moveOnTop(),this.bindGlobalListeners(),i.DomHandler.addClass(document.body,"ui-overflow-hidden");break;case"void":this.onContainerDestroy()}},e.prototype.onAnimationEnd=function(e){"void"===e.toState&&this.dialogRef.close()},e.prototype.onContainerDestroy=function(){i.DomHandler.removeClass(document.body,"ui-overflow-hidden"),this.unbindGlobalListeners(),this.container=null},e.prototype.close=function(){this.visible=!1},e.prototype.onMaskClick=function(){this.config.dismissableMask&&this.close()},e.prototype.bindGlobalListeners=function(){!1!==this.config.closeOnEscape&&!1!==this.config.closable&&this.bindDocumentEscapeListener()},e.prototype.unbindGlobalListeners=function(){this.unbindDocumentEscapeListener()},e.prototype.bindDocumentEscapeListener=function(){var e=this;this.documentEscapeListener=this.renderer.listen("document","keydown",(function(t){27==t.which&&parseInt(e.container.style.zIndex)==i.DomHandler.zindex&&e.close()}))},e.prototype.unbindDocumentEscapeListener=function(){this.documentEscapeListener&&(this.documentEscapeListener(),this.documentEscapeListener=null)},e.prototype.ngOnDestroy=function(){this.onContainerDestroy(),this.componentRef&&this.componentRef.destroy()},e.ctorParameters=function(){return[{type:t.ComponentFactoryResolver},{type:t.ChangeDetectorRef},{type:t.Renderer2},{type:c},{type:l},{type:t.NgZone}]},p([t.ViewChild(s,{static:!1})],e.prototype,"insertionPoint",void 0),p([t.ViewChild("mask",{static:!1})],e.prototype,"maskViewChild",void 0),e=p([t.Component({selector:"p-dynamicDialog",template:'\n\t\t<div #mask class="ui-widget-overlay ui-dialog-mask ui-dialog-mask-scrollblocker" *ngIf="visible" (click)="onMaskClick()"></div>\n\t\t<div [ngClass]="{\'ui-dialog ui-dynamicdialog ui-widget ui-widget-content ui-corner-all ui-shadow\':true, \'ui-dialog-rtl\': config.rtl}" [ngStyle]="config.style" [class]="config.styleClass"\n\t\t\t[@animation]="{value: \'visible\', params: {transitionParams: config.transitionOptions || \'150ms cubic-bezier(0, 0, 0.2, 1)\'}}" \n\t\t\t(@animation.start)="onAnimationStart($event)" (@animation.done)="onAnimationEnd($event)" role="dialog" *ngIf="visible"\n\t\t\t[style.width]="config.width" [style.height]="config.height">\n <div class="ui-dialog-titlebar ui-widget-header ui-helper-clearfix ui-corner-top" *ngIf="config.showHeader === false ? false: true">\n <span class="ui-dialog-title">{{config.header}}</span>\n <div class="ui-dialog-titlebar-icons">\n <a [ngClass]="\'ui-dialog-titlebar-icon ui-dialog-titlebar-close ui-corner-all\'" tabindex="0" role="button" (click)="close()" (keydown.enter)="close()" *ngIf="config.closable !== false">\n <span class="pi pi-times"></span>\n </a>\n </div>\n </div>\n <div class="ui-dialog-content ui-widget-content" [ngStyle]="config.contentStyle">\n\t\t\t\t<ng-template pDynamicDialogContent></ng-template>\n\t\t\t</div>\n\t\t\t<div class="ui-dialog-footer ui-widget-content" *ngIf="config.footer">\n\t\t\t\t{{config.footer}}\n </div>\n\t\t</div>\n\t',animations:[n.trigger("animation",[n.state("void",n.style({transform:"translateX(-50%) translateY(-50%) scale(0.7)",opacity:0})),n.state("visible",n.style({transform:"translateX(-50%) translateY(-50%) scale(1)",opacity:1})),n.transition("* => *",n.animate("{{transitionParams}}"))])]})],e)}(),u=function(){function e(){}return e=p([t.NgModule({imports:[o.CommonModule],declarations:[d,s],entryComponents:[d]})],e)}(),f=function(){function e(e,t){this._parentInjector=e,this._additionalTokens=t}return e.prototype.get=function(e,t,n){var o=this._additionalTokens.get(e);return o||this._parentInjector.get(e,t)},e}(),m=this&&this.__decorate||function(e,t,n,o){var i,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,o);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(r<3?i(a):r>3?i(t,n,a):i(t,n))||a);return r>3&&a&&Object.defineProperty(t,n,a),a},g=function(){function e(e,t,n){this.componentFactoryResolver=e,this.appRef=t,this.injector=n}return e.prototype.open=function(e,t){var n=this.appendDialogComponentToBody(t);return this.dialogComponentRef.instance.childComponentType=e,n},e.prototype.appendDialogComponentToBody=function(e){var t=this,n=new WeakMap;n.set(c,e);var o=new l;n.set(l,o);var i=o.onClose.subscribe((function(){t.removeDialogComponentFromBody(),i.unsubscribe()})),r=this.componentFactoryResolver.resolveComponentFactory(d).create(new f(this.injector,n));this.appRef.attachView(r.hostView);var a=r.hostView.rootNodes[0];return document.body.appendChild(a),this.dialogComponentRef=r,o},e.prototype.removeDialogComponentFromBody=function(){this.appRef.detachView(this.dialogComponentRef.hostView),this.dialogComponentRef.destroy()},e.ctorParameters=function(){return[{type:t.ComponentFactoryResolver},{type:t.ApplicationRef},{type:t.Injector}]},e=m([t.Injectable()],e)}();e.DialogService=g,e.DynamicDialogComponent=d,e.DynamicDialogConfig=c,e.DynamicDialogInjector=f,e.DynamicDialogModule=u,e.DynamicDialogRef=l,e.ɵa=s,Object.defineProperty(e,"__esModule",{value:!0})})); //# sourceMappingURL=primeng-dynamicdialog.umd.min.js.map