ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
16 lines (14 loc) • 7.56 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/cdk/layout"),require("@angular/cdk/platform"),require("@angular/core"),require("ng-zorro-antd/core/services"),require("rxjs"),require("rxjs/operators"),require("ng-zorro-antd/core/util"),require("@angular/common")):"function"==typeof define&&define.amd?define("ng-zorro-antd/grid",["exports","@angular/cdk/layout","@angular/cdk/platform","@angular/core","ng-zorro-antd/core/services","rxjs","rxjs/operators","ng-zorro-antd/core/util","@angular/common"],e):e(((t=t||self)["ng-zorro-antd"]=t["ng-zorro-antd"]||{},t["ng-zorro-antd"].grid={}),t.ng.cdk.layout,t.ng.cdk.platform,t.ng.core,t["ng-zorro-antd"].core.services,t.rxjs,t.rxjs.operators,t["ng-zorro-antd"].core.util,t.ng.common)}(this,(function(t,e,n,r,o,s,i,l,a){"use strict";
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var u=function(){return(u=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function p(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,s=n.call(t),i=[];try{for(;(void 0===e||e-- >0)&&!(r=s.next()).done;)i.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=s.return)&&n.call(s)}finally{if(o)throw o.error}}return i}var c=function(){function t(t,e,n,r,o,i){this.elementRef=t,this.renderer=e,this.mediaMatcher=n,this.ngZone=r,this.platform=o,this.breakpointService=i,this.nzType="flex",this.nzAlign=null,this.nzJustify=null,this.nzGutter=null,this.actualGutter$=new s.ReplaySubject(1),this.destroy$=new s.Subject}return t.prototype.getGutter=function(){var t=this,e=[null,null],n=this.nzGutter||0;return(Array.isArray(n)?n:[n,null]).forEach((function(n,r){"object"==typeof n&&null!==n?(e[r]=null,Object.keys(o.gridResponsiveMap).map((function(s){var i=s;t.mediaMatcher.matchMedia(o.gridResponsiveMap[i]).matches&&n[i]&&(e[r]=n[i])}))):e[r]=n||null})),e},t.prototype.setGutterStyle=function(){var t=this,e=p(this.getGutter(),2),n=e[0],r=e[1];this.actualGutter$.next([n,r]);var o=function(e,n){var r=t.elementRef.nativeElement;null!==n&&t.renderer.setStyle(r,e,"-"+n/2+"px")};o("margin-left",n),o("margin-right",n),o("margin-top",r),o("margin-bottom",r)},t.prototype.ngOnInit=function(){this.setGutterStyle()},t.prototype.ngOnChanges=function(t){t.nzGutter&&this.setGutterStyle()},t.prototype.ngAfterViewInit=function(){var t=this;this.platform.isBrowser&&this.breakpointService.subscribe(o.gridResponsiveMap).pipe(i.takeUntil(this.destroy$)).subscribe((function(){t.setGutterStyle()}))},t.prototype.ngOnDestroy=function(){this.destroy$.next(),this.destroy$.complete()},t.decorators=[{type:r.Directive,args:[{selector:"[nz-row],nz-row,nz-form-item",exportAs:"nzRow",host:{"[class.ant-row]":"true","[class.ant-row-top]":"nzAlign === 'top'","[class.ant-row-middle]":"nzAlign === 'middle'","[class.ant-row-bottom]":"nzAlign === 'bottom'","[class.ant-row-start]":"nzJustify === 'start'","[class.ant-row-end]":"nzJustify === 'end'","[class.ant-row-center]":"nzJustify === 'center'","[class.ant-row-space-around]":"nzJustify === 'space-around'","[class.ant-row-space-between]":"nzJustify === 'space-between'"}}]}],t.ctorParameters=function(){return[{type:r.ElementRef},{type:r.Renderer2},{type:e.MediaMatcher},{type:r.NgZone},{type:n.Platform},{type:o.NzBreakpointService}]},t.propDecorators={nzType:[{type:r.Input}],nzAlign:[{type:r.Input}],nzJustify:[{type:r.Input}],nzGutter:[{type:r.Input}]},t}();var h=function(){function t(t,e,n){this.elementRef=t,this.nzRowDirective=e,this.renderer=n,this.classMap={},this.destroy$=new s.Subject,this.hostFlexStyle=null,this.nzFlex=null,this.nzSpan=null,this.nzOrder=null,this.nzOffset=null,this.nzPush=null,this.nzPull=null,this.nzXs=null,this.nzSm=null,this.nzMd=null,this.nzLg=null,this.nzXl=null,this.nzXXl=null}return t.prototype.setHostClassMap=function(){var t,e=u(((t={})["ant-col"]=!0,t["ant-col-"+this.nzSpan]=l.isNotNil(this.nzSpan),t["ant-col-order-"+this.nzOrder]=l.isNotNil(this.nzOrder),t["ant-col-offset-"+this.nzOffset]=l.isNotNil(this.nzOffset),t["ant-col-pull-"+this.nzPull]=l.isNotNil(this.nzPull),t["ant-col-push-"+this.nzPush]=l.isNotNil(this.nzPush),t),this.generateClass());for(var n in this.classMap)this.classMap.hasOwnProperty(n)&&this.renderer.removeClass(this.elementRef.nativeElement,n);for(var n in this.classMap=u({},e),this.classMap)this.classMap.hasOwnProperty(n)&&this.classMap[n]&&this.renderer.addClass(this.elementRef.nativeElement,n)},t.prototype.setHostFlexStyle=function(){this.hostFlexStyle=this.parseFlex(this.nzFlex)},t.prototype.parseFlex=function(t){return"number"==typeof t?t+" "+t+" auto":"string"==typeof t&&/^\d+(\.\d+)?(px|em|rem|%)$/.test(t)?"0 0 "+t:t},t.prototype.generateClass=function(){var t=this,e={};return["nzXs","nzSm","nzMd","nzLg","nzXl","nzXXl"].forEach((function(n){var r=n.replace("nz","").toLowerCase();if(l.isNotNil(t[n]))if("number"==typeof t[n]||"string"==typeof t[n])e["ant-col-"+r+"-"+t[n]]=!0;else{var o=t[n];["span","pull","push","offset","order"].forEach((function(t){e["ant-col-"+r+("span"===t?"-":"-"+t+"-")+o[t]]=o&&l.isNotNil(o[t])}))}})),e},t.prototype.ngOnInit=function(){this.setHostClassMap(),this.setHostFlexStyle()},t.prototype.ngOnChanges=function(t){this.setHostClassMap(),t.nzFlex&&this.setHostFlexStyle()},t.prototype.ngAfterViewInit=function(){var t=this;this.nzRowDirective&&this.nzRowDirective.actualGutter$.pipe(i.takeUntil(this.destroy$)).subscribe((function(e){var n=p(e,2),r=n[0],o=n[1],s=function(e,n){var r=t.elementRef.nativeElement;null!==n&&t.renderer.setStyle(r,e,n/2+"px")};s("padding-left",r),s("padding-right",r),s("padding-top",o),s("padding-bottom",o)}))},t.prototype.ngOnDestroy=function(){this.destroy$.next(),this.destroy$.complete()},t.decorators=[{type:r.Directive,args:[{selector:"[nz-col],nz-col,nz-form-control,nz-form-label",exportAs:"nzCol",host:{"[style.flex]":"hostFlexStyle"}}]}],t.ctorParameters=function(){return[{type:r.ElementRef},{type:c,decorators:[{type:r.Optional},{type:r.Host}]},{type:r.Renderer2}]},t.propDecorators={nzFlex:[{type:r.Input}],nzSpan:[{type:r.Input}],nzOrder:[{type:r.Input}],nzOffset:[{type:r.Input}],nzPush:[{type:r.Input}],nzPull:[{type:r.Input}],nzXs:[{type:r.Input}],nzSm:[{type:r.Input}],nzMd:[{type:r.Input}],nzLg:[{type:r.Input}],nzXl:[{type:r.Input}],nzXXl:[{type:r.Input}]},t}();var f=function(){function t(){}return t.decorators=[{type:r.NgModule,args:[{declarations:[h,c],exports:[h,c],imports:[a.CommonModule,e.LayoutModule,n.PlatformModule]}]}],t}();t.NzColDirective=h,t.NzGridModule=f,t.NzRowDirective=c,Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=ng-zorro-antd-grid.umd.min.js.map