UNPKG

ng-zorro-antd

Version:

An enterprise-class UI components based on Ant Design and Angular

2 lines 5.83 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/cdk/layout"),require("@angular/cdk/platform"),require("ng-zorro-antd/core"),require("rxjs"),require("rxjs/operators"),require("@angular/common")):"function"==typeof define&&define.amd?define("ng-zorro-antd/grid",["exports","@angular/core","@angular/cdk/layout","@angular/cdk/platform","ng-zorro-antd/core","rxjs","rxjs/operators","@angular/common"],e):e(((t=t||self)["ng-zorro-antd"]=t["ng-zorro-antd"]||{},t["ng-zorro-antd"].grid={}),t.ng.core,t.ng.cdk.layout,t.ng.cdk.platform,t["ng-zorro-antd"].core,t.rxjs,t.rxjs.operators,t.ng.common)}(this,function(t,e,r,n,s,i,o,a){"use strict";var p=function(){return(p=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var s in e=arguments[r])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t}).apply(this,arguments)};var u=function(){function t(t,e,r,n,s,o,a){this.elementRef=t,this.renderer=e,this.nzUpdateHostClassService=r,this.mediaMatcher=n,this.ngZone=s,this.platform=o,this.nzDomEventService=a,this.nzAlign="top",this.nzJustify="start",this.el=this.elementRef.nativeElement,this.prefixCls="ant-row",this.actualGutter$=new i.Subject,this.destroy$=new i.Subject}return t.prototype.calculateGutter=function(){return"object"!=typeof this.nzGutter?this.nzGutter:this.breakPoint&&this.nzGutter[this.breakPoint]?this.nzGutter[this.breakPoint]:0},t.prototype.updateGutter=function(){var t=this.calculateGutter();this.actualGutter!==t&&(this.actualGutter=t,this.actualGutter$.next(this.actualGutter),this.renderer.setStyle(this.el,"margin-left","-"+this.actualGutter/2+"px"),this.renderer.setStyle(this.el,"margin-right","-"+this.actualGutter/2+"px"))},t.prototype.watchMedia=function(){var t=this;Object.keys(s.responsiveMap).map(function(e){var r=e;t.mediaMatcher.matchMedia(s.responsiveMap[r]).matches&&(t.breakPoint=r)}),this.updateGutter()},t.prototype.setClassMap=function(){var t,e=((t={})[""+this.prefixCls]=!this.nzType,t[this.prefixCls+"-"+this.nzType]=this.nzType,t[this.prefixCls+"-"+this.nzType+"-"+this.nzAlign]=this.nzType&&this.nzAlign,t[this.prefixCls+"-"+this.nzType+"-"+this.nzJustify]=this.nzType&&this.nzJustify,t);this.nzUpdateHostClassService.updateHostClass(this.el,e)},t.prototype.ngOnInit=function(){this.setClassMap(),this.watchMedia()},t.prototype.ngOnChanges=function(t){(t.nzType||t.nzAlign||t.nzJustify)&&this.setClassMap(),t.nzGutter&&this.updateGutter()},t.prototype.ngAfterViewInit=function(){var t=this;this.platform.isBrowser&&this.nzDomEventService.registerResizeListener().pipe(o.takeUntil(this.destroy$),o.finalize(function(){return t.nzDomEventService.unregisterResizeListener()})).subscribe(function(){return t.watchMedia()})},t.prototype.ngOnDestroy=function(){this.destroy$.next(),this.destroy$.complete()},t.decorators=[{type:e.Directive,args:[{selector:"[nz-row],nz-row",exportAs:"nzRow",providers:[s.NzUpdateHostClassService]}]}],t.ctorParameters=function(){return[{type:e.ElementRef},{type:e.Renderer2},{type:s.NzUpdateHostClassService},{type:r.MediaMatcher},{type:e.NgZone},{type:n.Platform},{type:s.NzDomEventService}]},t.propDecorators={nzType:[{type:e.Input}],nzAlign:[{type:e.Input}],nzJustify:[{type:e.Input}],nzGutter:[{type:e.Input}]},t}();var l=function(){function t(t,e,r,n){this.nzUpdateHostClassService=t,this.elementRef=e,this.nzRowDirective=r,this.renderer=n,this.el=this.elementRef.nativeElement,this.prefixCls="ant-col",this.destroy$=new i.Subject}return t.prototype.setClassMap=function(){var t,e=p(((t={})[""+this.prefixCls]=!0,t[this.prefixCls+"-"+this.nzSpan]=s.isNotNil(this.nzSpan),t[this.prefixCls+"-order-"+this.nzOrder]=s.isNotNil(this.nzOrder),t[this.prefixCls+"-offset-"+this.nzOffset]=s.isNotNil(this.nzOffset),t[this.prefixCls+"-pull-"+this.nzPull]=s.isNotNil(this.nzPull),t[this.prefixCls+"-push-"+this.nzPush]=s.isNotNil(this.nzPush),t),this.generateClass());this.nzUpdateHostClassService.updateHostClass(this.el,e)},t.prototype.generateClass=function(){var t=this,e={};return["nzXs","nzSm","nzMd","nzLg","nzXl","nzXXl"].forEach(function(r){var n=r.replace("nz","").toLowerCase();if(s.isNotNil(t[r]))if("number"==typeof t[r]||"string"==typeof t[r])e[t.prefixCls+"-"+n+"-"+t[r]]=!0;else{var i=t[r];["span","pull","push","offset","order"].forEach(function(r){var o="span"===r?"-":"-"+r+"-";e[t.prefixCls+"-"+n+o+i[r]]=i&&s.isNotNil(i[r])})}}),e},t.prototype.ngOnChanges=function(){this.setClassMap()},t.prototype.ngAfterViewInit=function(){var t=this;this.nzRowDirective&&this.nzRowDirective.actualGutter$.pipe(o.startWith(this.nzRowDirective.actualGutter),o.takeUntil(this.destroy$)).subscribe(function(e){t.renderer.setStyle(t.el,"padding-left",e/2+"px"),t.renderer.setStyle(t.el,"padding-right",e/2+"px")})},t.prototype.ngOnInit=function(){this.setClassMap()},t.prototype.ngOnDestroy=function(){this.destroy$.next(),this.destroy$.complete()},t.decorators=[{type:e.Directive,args:[{selector:"[nz-col],nz-col",exportAs:"nzCol",providers:[s.NzUpdateHostClassService]}]}],t.ctorParameters=function(){return[{type:s.NzUpdateHostClassService},{type:e.ElementRef},{type:u,decorators:[{type:e.Optional},{type:e.Host}]},{type:e.Renderer2}]},t.propDecorators={nzSpan:[{type:e.Input}],nzOrder:[{type:e.Input}],nzOffset:[{type:e.Input}],nzPush:[{type:e.Input}],nzPull:[{type:e.Input}],nzXs:[{type:e.Input}],nzSm:[{type:e.Input}],nzMd:[{type:e.Input}],nzLg:[{type:e.Input}],nzXl:[{type:e.Input}],nzXXl:[{type:e.Input}]},t}();var h=function(){function t(){}return t.decorators=[{type:e.NgModule,args:[{declarations:[l,u],exports:[l,u],imports:[a.CommonModule,r.LayoutModule,n.PlatformModule]}]}],t}();t.NzColDirective=l,t.NzGridModule=h,t.NzRowDirective=u,Object.defineProperty(t,"__esModule",{value:!0})}); //# sourceMappingURL=ng-zorro-antd-grid.umd.min.js.map