UNPKG

ng2-modal-dialog

Version:
1 lines 3.17 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("rxjs/Rx")):"function"==typeof define&&define.amd?define(["exports","@angular/core","rxjs/Rx"],t):t((e.ng=e.ng||{},e.ng.modal=e.ng.modal||{},e.ng.modal.dialog={}),e.core,e.Rx)}(this,function(e,t,n){"use strict";var o=function(){function e(e){this.compiler=e,this.activeInstances=0}return e.prototype.registerViewContainerRef=function(e){this.vcRef=e},e.prototype.registerInjector=function(e){this.injector=e},e.prototype.create=function(e,o){var r=this,i=function(){return function(){}}(),a=new n.ReplaySubject;return this.compiler.compileModuleAndAllComponentsAsync(i).then(function(n){var i=n.componentFactories.filter(function(t){return t.componentType===e})[0],c=t.ReflectiveInjector.resolveAndCreate([],r.injector),s=r.vcRef.createComponent(i,0,c);Object.assign(s.instance,o),r.activeInstances++,s.instance.destroy=function(){r.activeInstances--,s.destroy()},a.next(s),a.complete()},function(e){console.log(e)}),a.asObservable()},e.prototype.createFromFactory=function(e,o){var r=this,i=new n.ReplaySubject,a=t.ReflectiveInjector.resolveAndCreate([],this.injector),c=this.vcRef.createComponent(e,0,a);return Object.assign(c.instance,o),this.activeInstances++,c.instance.destroy=function(){r.activeInstances--,c.destroy()},i.next(c),i.complete(),i.asObservable()},e.decorators=[{type:t.Injectable}],e.ctorParameters=function(){return[{type:t.Compiler}]},e}(),r=function(){function e(e,t){this.modalService=e,this.injector=t}return e.prototype.ngOnInit=function(){this.modalService.registerViewContainerRef(this.viewContainerRef),this.modalService.registerInjector(this.injector)},e.decorators=[{type:t.Component,args:[{selector:"app-root",template:"<div class='ng2-modal'><div class='ng2-modal-content'><div #modalplaceholder></div></div></div><div class='ng2-modal-overlay'></div>",styles:[".ng2-modal {/* This way it could be display flex or grid or whatever also. */display: block;/* Probably need media queries here */width: 600px;max-width: 100%;height: 400px;max - height: 100%;position: fixed;z-index: 9000;left: 50 %;top: 50 %;/* Use this for centering if unknown width/height */transform: translate(-50 %, -50 %);/* If known, negative margins are probably better (less chance of blurry text). *//* margin: -200px 0 0 -200px; */background: white;box-shadow: 0 0 60px 10px rgba(0, 0, 0, 0.9);}",".ng2 - modal - content {position: absolute;top: 10 %;left: 0;width: 100 %;height: 100 %;overflow: auto;padding: 20px 50px 20px 20px;}",".ng2 - modal - overlay {position: fixed;top: 0;left: 0;width: 100 %;height: 100 %;z-index: 8000;background: rgba(0, 0, 0, 0.6);}"]}]}],e.ctorParameters=function(){return[{type:o},{type:t.Injector}]},e.propDecorators={viewContainerRef:[{type:t.ViewChild,args:["approot",{read:t.ViewContainerRef}]}]},e}(),i=(function(){function e(){}e.prototype.closeModal=function(){this.destroy()}}(),function(){function e(){}return e.decorators=[{type:t.NgModule,args:[{declarations:[r],exports:[r],providers:[o]}]}],e.ctorParameters=function(){return[]},e}());e.ModalModule=i,Object.defineProperty(e,"__esModule",{value:!0})});