primeng
Version:
[](https://opensource.org/licenses/MIT) [](https://badge.fury.io/js/primeng) [{"object"==typeof exports&&"undefined"!=typeof module?n(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"],n):n(((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,n,t,o,i,r){"use strict";var s=this&&this.__decorate||function(e,n,t,o){var i,r=arguments.length,s=r<3?n:null===o?o=Object.getOwnPropertyDescriptor(n,t):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,n,t,o);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(r<3?i(s):r>3?i(n,t,s):i(n,t))||s);return r>3&&s&&Object.defineProperty(n,t,s),s},a=function(){function e(e){this.viewContainerRef=e}return e.ctorParameters=function(){return[{type:n.ViewContainerRef}]},e=s([n.Directive({selector:"[pDynamicDialogContent]"})],e)}(),c=function(){},l=function(){function e(){this._onClose=new r.Subject,this.onClose=this._onClose.asObservable(),this._onDestroy=new r.Subject,this.onDestroy=this._onDestroy.asObservable()}return e.prototype.close=function(e){this._onClose.next(e)},e.prototype.destroy=function(){this._onDestroy.next()},e}(),d=this&&this.__decorate||function(e,n,t,o){var i,r=arguments.length,s=r<3?n:null===o?o=Object.getOwnPropertyDescriptor(n,t):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,n,t,o);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(r<3?i(s):r>3?i(n,t,s):i(n,t))||s);return r>3&&s&&Object.defineProperty(n,t,s),s},u=t.animation([t.style({transform:"{{transform}}",opacity:0}),t.animate("{{transition}}",t.style({transform:"none",opacity:1}))]),p=t.animation([t.animate("{{transition}}",t.style({transform:"{{transform}}",opacity:0}))]),f=function(){function e(e,n,t,o,i,r){this.componentFactoryResolver=e,this.cd=n,this.renderer=t,this.config=o,this.dialogRef=i,this.zone=r,this.visible=!0,this.transformOptions="scale(0.7)"}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 n=this.componentFactoryResolver.resolveComponentFactory(e),t=this.insertionPoint.viewContainerRef;t.clear(),this.componentRef=t.createComponent(n)},e.prototype.moveOnTop=function(){if(!1!==this.config.autoZIndex){var e=(this.config.baseZIndex||0)+ ++i.DomHandler.zindex;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"),this.focus();break;case"void":this.onContainerDestroy()}},e.prototype.onAnimationEnd=function(e){"void"===e.toState&&this.dialogRef.destroy()},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.onKeydown=function(e){if(9===e.which){e.preventDefault();var n=i.DomHandler.getFocusableElements(this.container);if(n&&n.length>0)if(document.activeElement){var t=n.indexOf(document.activeElement);e.shiftKey?-1==t||0===t?n[n.length-1].focus():n[t-1].focus():-1==t||t===n.length-1?n[0].focus():n[t+1].focus()}else n[0].focus()}},e.prototype.focus=function(){var e=i.DomHandler.findSingle(this.container,"a");e&&this.zone.runOutsideAngular((function(){setTimeout((function(){return e.focus()}),5)}))},e.prototype.bindGlobalListeners=function(){this.bindDocumentKeydownListener(),!1!==this.config.closeOnEscape&&!1!==this.config.closable&&this.bindDocumentEscapeListener()},e.prototype.unbindGlobalListeners=function(){this.unbindDocumentKeydownListener(),this.unbindDocumentEscapeListener()},e.prototype.bindDocumentKeydownListener=function(){var e=this;this.zone.runOutsideAngular((function(){e.documentKeydownListener=e.onKeydown.bind(e),window.document.addEventListener("keydown",e.documentKeydownListener)}))},e.prototype.unbindDocumentKeydownListener=function(){this.documentKeydownListener&&(window.document.removeEventListener("keydown",this.documentKeydownListener),this.documentKeydownListener=null)},e.prototype.bindDocumentEscapeListener=function(){var e=this;this.documentEscapeListener=this.renderer.listen("document","keydown",(function(n){27==n.which&&parseInt(e.container.style.zIndex)==i.DomHandler.zindex+e.config.baseZIndex&&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:n.ComponentFactoryResolver},{type:n.ChangeDetectorRef},{type:n.Renderer2},{type:c},{type:l},{type:n.NgZone}]},d([n.ViewChild(a)],e.prototype,"insertionPoint",void 0),d([n.ViewChild("mask")],e.prototype,"maskViewChild",void 0),e=d([n.Component({selector:"p-dynamicDialog",template:'\n <div #mask class="ui-widget-overlay ui-dialog-mask ui-dialog-visible ui-dialog-mask-scrollblocker">\n <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 [@animation]="{value: \'visible\', params: {transform: transformOptions, transition: config.transitionOptions || \'150ms cubic-bezier(0, 0, 0.2, 1)\'}}"\n (@animation.start)="onAnimationStart($event)" (@animation.done)="onAnimationEnd($event)" role="dialog" *ngIf="visible"\n [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 <ng-template pDynamicDialogContent></ng-template>\n </div>\n <div class="ui-dialog-footer ui-widget-content" *ngIf="config.footer">\n {{config.footer}}\n </div>\n </div>\n </div>\n\t',animations:[t.trigger("animation",[t.transition("void => visible",[t.useAnimation(u)]),t.transition("visible => void",[t.useAnimation(p)])])],changeDetection:n.ChangeDetectionStrategy.Default})],e)}(),m=function(){function e(){}return e=d([n.NgModule({imports:[o.CommonModule],declarations:[f,a],entryComponents:[f]})],e)}(),h=function(){function e(e,n){this._parentInjector=e,this._additionalTokens=n}return e.prototype.get=function(e,n,t){var o=this._additionalTokens.get(e);return o||this._parentInjector.get(e,n)},e}(),y=this&&this.__decorate||function(e,n,t,o){var i,r=arguments.length,s=r<3?n:null===o?o=Object.getOwnPropertyDescriptor(n,t):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,n,t,o);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(r<3?i(s):r>3?i(n,t,s):i(n,t))||s);return r>3&&s&&Object.defineProperty(n,t,s),s},g=function(){function e(e,n,t){this.componentFactoryResolver=e,this.appRef=n,this.injector=t}return e.prototype.open=function(e,n){var t=this.appendDialogComponentToBody(n);return this.dialogComponentRef.instance.childComponentType=e,t},e.prototype.appendDialogComponentToBody=function(e){var n=this,t=new WeakMap;t.set(c,e);var o=new l;t.set(l,o);var i=o.onClose.subscribe((function(){n.dialogComponentRef.instance.close()})),r=o.onDestroy.subscribe((function(){n.removeDialogComponentFromBody(),r.unsubscribe(),i.unsubscribe()})),s=this.componentFactoryResolver.resolveComponentFactory(f).create(new h(this.injector,t));this.appRef.attachView(s.hostView);var a=s.hostView.rootNodes[0];return document.body.appendChild(a),this.dialogComponentRef=s,o},e.prototype.removeDialogComponentFromBody=function(){this.appRef.detachView(this.dialogComponentRef.hostView),this.dialogComponentRef.destroy()},e.ctorParameters=function(){return[{type:n.ComponentFactoryResolver},{type:n.ApplicationRef},{type:n.Injector}]},e=y([n.Injectable()],e)}();e.DialogService=g,e.DynamicDialogComponent=f,e.DynamicDialogConfig=c,e.DynamicDialogInjector=h,e.DynamicDialogModule=m,e.DynamicDialogRef=l,e.ɵa=a,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=primeng-dynamicdialog.umd.min.js.map