0 Star 1 Fork 5

蓝雨滴/angular2-layer

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
ng2-layer.min.js 8.69 KB
一键复制 编辑 原始数据 按行查看 历史
lw 提交于 2017-01-07 04:57 . README.md
System.register(["@angular/core"],function(a,b){"use strict";var f,g,h,i,c=this&&this.__decorate||function(a,b,c,d){var g,e=arguments.length,f=e<3?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):d;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)f=Reflect.decorate(a,b,c,d);else for(var h=a.length-1;h>=0;h--)(g=a[h])&&(f=(e<3?g(f):e>3?g(b,c,f):g(b,c))||f);return e>3&&f&&Object.defineProperty(b,c,f),f},d=this&&this.__metadata||function(a,b){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(a,b)};b&&b.id;return{setters:[function(a){f=a}],execute:function(){g=function(){function a(){}return a}(),a("LayerConfig",g),h=function(){function a(){}return a.prototype.close=function(){this.layerComponent.close()},a.prototype.showCloseBtn=function(a){return this.layerComponent.config.closeAble=a,this},a.prototype.setTitle=function(a){return this.layerComponent.config.title=a,this},a.prototype.setMessage=function(a){return this.layerComponent.config.message=a,this},a.prototype.setOnClose=function(a){return this.layerComponent.onClose=a,this},a.prototype.setOkText=function(a){return this.layerComponent.config.okTxt=a,this},a.prototype.setCancelText=function(a){return this.layerComponent.config.cancelTxt=a,this},a.prototype.ok=function(a){return this.layerComponent.onOk=a,this},a.prototype.cancel=function(a){return this.layerComponent.onCancel=a,this},a}(),a("NgLayerRef",h),i=function(){function a(a,b){this.compiler=a,this.appRef=b}return a.prototype.dialog=function(a){var b="layer_"+(new Date).getTime();return this.createComponent_(a,b)},a.prototype.alert=function(a){return this.confirmOralert_(a,!1)},a.prototype.confirm=function(a){return this.confirmOralert_(a,!0)},a.prototype.tip=function(a){return this.tipOrLoading_(a,!0)},a.prototype.loading=function(a){return this.tipOrLoading_(a,!1)},a.prototype.tipOrLoading_=function(a,b){a.outSelector||(a.outSelector="boingOut"),a=this.default_(a);var k,e='<div class="iconing_tip_body iconing_type_{{layerType}}">{{config.message}}</div>',g="layer_"+(new Date).getTime(),i=document.createElement("div"),j=i.classList;j.add("iconing_tip_backdrop"),j.add(g),(!a.align||["center","bottom","top"].indexOf(a.align)<0)&&(a.align="top"),a.isModal?(j.add("iconing_loading_modal"),k=".iconing_loading_modal"):k="",j.add("iconing_align_"+a.align),document.body.appendChild(i);var l=function(){function c(c,d){this.layerRef=c,this.self=d,this.layerType=b?"tip":"loading",this.config=a,c.layerComponent=this,this.layerRef=c}return c.prototype.ngAfterViewInit=function(){var c=this;this.layerEle=this.self.element.nativeElement.querySelector(".iconing_tip_body"),this.config.inSelector&&this.layerEle.classList.add(this.config.inSelector),b&&setTimeout(function(){return c.close()},a.tipDuration+this.calCss_())},c.prototype.close=function(){var a=this;if(this.config.outSelector){var b=this.layerEle.classList;b.remove(this.config.inSelector),b.add(this.config.outSelector),setTimeout(function(){a.thizRef.destroy()},this.calCss_())}else this.thizRef.destroy()},c.prototype.calCss_=function(){var a=getComputedStyle(this.layerEle).animationDuration,b=getComputedStyle(this.layerEle).animationDuration,c=parseFloat(a),d=parseFloat(b);if(c){var e=a.replace(c.toString(),"").toLowerCase();c="ms"==e?c:"s"==e?1e3*c:0}if(d){var e=a.replace(d.toString(),"").toLowerCase();d="ms"==e?d:"s"==e?1e3*d:0}return Math.max(c,d)-5},c}();l=c([f.Component({selector:".iconing_tip_backdrop."+g+".iconing_align_"+a.align+k,template:e,providers:[h]}),d("design:paramtypes",[h,f.ViewContainerRef])],l);var m=function(){function a(){}return a}();m=c([f.NgModule({declarations:[l]}),d("design:paramtypes",[])],m);var n=this.compiler.compileModuleAndAllComponentsSync(m),o=n.componentFactories[0],p=this.appRef.bootstrap(o);return p.instance.thizRef=p,p.instance.layerRef},a.prototype.confirmOralert_=function(a,b){var e="layer_"+(new Date).getTime(),g=document.createElement("div");g.classList.add("iconing_layer_backdrop"),g.classList.add(e),document.body.appendChild(g);var h='<div class="iconing_layer_body iconing_alert_body"><div class="iconing_content">{{config.message}}</div><div class="iconing_alert_btn">CANCELBUTTON<button class="iconing_btn_ok" (click)="ok()">{{config.okText}}</button></div></div>';h=b?h.replace("CANCELBUTTON",'<button class="iconing_btn_cancel" (click)="cancel()">{{config.cancelText}}</button>'):h.replace("CANCELBUTTON","");var i=this.createComponentClass_(a,h,e),j=function(){function a(){}return a}();j=c([f.NgModule({declarations:[i]}),d("design:paramtypes",[])],j);var k=this.compiler.compileModuleAndAllComponentsSync(j),l=k.componentFactories[0],m=this.appRef.bootstrap(l);return m.instance.thizRef=m,document.body.appendChild(m.location.nativeElement),m.instance.layerRef},a.prototype.createComponentClass_=function(a,b,e){a=this.default_(a);var g=function(){function b(b,c,d){this.layerRef=b,this.compiler=c,this.self=d,this.config=a,b.layerComponent=this}return b.prototype.ngAfterViewInit=function(){var a=this.config;this.layerEle=this.self.element.nativeElement.querySelector(".iconing_layer_body"),a.inSelector&&(this.layerEle.classList.add(a.inSelector),this.backdropStyle.background="rgba(95, 95, 95, 0.5)",this.backdropStyle.transition="background "+this.calCss_(this.layerEle)+"ms")},b.prototype.ngOnInit=function(){var b=this;if(this.backdropStyle=this.self.element.nativeElement.style,a.dialogComponent){var e=function(){function a(){}return a}();e=c([f.NgModule({declarations:[a.dialogComponent]}),d("design:paramtypes",[])],e);var g=this.compiler.compileModuleAndAllComponentsAsync(e);g.then(function(a){var c=f.ReflectiveInjector.fromResolvedProviders([],b.layerView.injector);b.layerView.createComponent(a.componentFactories[0],null,c,[])})}},b.prototype.close=function(){var a=this,b=this.config;if(!this.onClose||this.onClose())if(b.outSelector){var c=this.layerEle.classList;c.remove(b.inSelector),c.add(b.outSelector);var d=this.calCss_(this.layerEle);this.backdropStyle.background="rgba(138, 138, 138, 0.5)",this.backdropStyle.transition="background "+d+"ms",setTimeout(function(){a.thizRef.destroy()},d)}else this.thizRef.destroy()},b.prototype.cancel=function(){this.onCancel&&!this.onCancel()||this.close()},b.prototype.onClose=function(){return!0},b.prototype.onCancel=function(){return!0},b.prototype.onOk=function(){return!0},b.prototype.ok=function(){this.onOk&&!this.onOk()||this.close()},b.prototype.calCss_=function(a){var b=getComputedStyle(a).animationDuration,c=getComputedStyle(a).animationDuration,d=parseFloat(b),e=parseFloat(c);if(d){var f=b.replace(d.toString(),"").toLowerCase();d="ms"==f?d:"s"==f?1e3*d:0}if(e){var f=b.replace(e.toString(),"").toLowerCase();e="ms"==f?e:"s"==f?1e3*e:0}return Math.max(d,e)},b}();return c([f.ViewChild("iconing_layer_content",{read:f.ViewContainerRef}),d("design:type",f.ViewContainerRef)],g.prototype,"layerView",void 0),g=c([f.Component({selector:".iconing_layer_backdrop."+e,template:b,providers:[h]}),d("design:paramtypes",[h,f.Compiler,f.ViewContainerRef])],g)},a.prototype.modifySelector_=function(a,b){if(!Reflect||!Reflect.getOwnMetadata)throw"reflect-metadata shim is required when using class decorators";var c=Reflect.getOwnMetadata("annotations",(new a).constructor),d=c.find(function(a){if("@Component"===a.toString())return a});if(!d)throw"component type required a @Component decorator";for(var e={selector:""},g=0,h=Object.keys(d);g<h.length;g++){var i=h[g];e[i]=d[i]}e.selector="."+b;var j=f.Component(e)(a);return j},a.prototype.createComponent_=function(a,b){a.dialogComponent=this.modifySelector_(a.dialogComponent,"iconing_layer_content");var e='<div class="iconing_layer_body"><div class="iconing_layer_header"><div class="iconing_layer_title">{{config.title}}</div><button (click)="close();" class="iconing_layer_close_btn {{config.closeAble?\'iconing_layer_close_able\':\'\'}}"></button></div><div #iconing_layer_content></div></div>',g=this.createComponentClass_(a,e,b),h=function(){function a(){}return a}();h=c([f.NgModule({declarations:[g]}),d("design:paramtypes",[])],h);var i=this.compiler.compileModuleAndAllComponentsSync(h),j=i.componentFactories[0],k=null;if(parent){var l=f.ReflectiveInjector.fromResolvedProviders([],a.parent.injector);k=a.parent.createComponent(j,null,l,[]),k.instance.thizRef=k,document.body.appendChild(k.location.nativeElement)}else k=this.appRef.bootstrap(j),document.body.appendChild(k.location.nativeElement);return k.instance.layerRef},a.prototype.default_=function(a){var d,b={title:"",align:"center",closeAble:!0,cancelText:"cancel",okText:"ok",outSelector:"fadeOutDown",inSelector:"dropDown",parent:null,dialogComponent:null,isModal:!1,tipDuration:2500,message:""},c=Object.keys(b);for(var e in c)d=c[e],void 0==a[d]&&(a[d]=b[d]);return a},a}(),i=c([f.Injectable(),d("design:paramtypes",[f.Compiler,f.ApplicationRef])],i),a("NgLayer",i)}}});
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
TypeScript
1
https://gitee.com/jiaqiq/angular2-layer.git
[email protected]:jiaqiq/angular2-layer.git
jiaqiq
angular2-layer
angular2-layer
master

搜索帮助