ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
16 lines (14 loc) • 7.52 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,a,l){"use strict";
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */var p=function(){return(p=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 u(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.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=[0,0],n=this.nzGutter||0;return(Array.isArray(n)?n:[n,0]).forEach((function(n,r){"object"==typeof n?(e[r]=0,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||0})),e},t.prototype.setGutterStyle=function(){var t=this,e=u(this.getGutter(),2),n=e[0],r=e[1];this.actualGutter$.next([n,r]);var o=function(e,n){var r=t.elementRef.nativeElement;t.renderer.setStyle(r,e,"-"+n/2+"px")};n>0&&(o("margin-left",n),o("margin-right",n)),r>0&&(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=p(((t={})["ant-col"]=!0,t["ant-col-"+this.nzSpan]=a.isNotNil(this.nzSpan),t["ant-col-order-"+this.nzOrder]=a.isNotNil(this.nzOrder),t["ant-col-offset-"+this.nzOffset]=a.isNotNil(this.nzOffset),t["ant-col-pull-"+this.nzPull]=a.isNotNil(this.nzPull),t["ant-col-push-"+this.nzPush]=a.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=p({},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(a.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&&a.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=u(e,2),r=n[0],o=n[1],s=function(e,n){var r=t.elementRef.nativeElement;t.renderer.setStyle(r,e,n/2+"px")};r>0&&(s("padding-left",r),s("padding-right",r)),o>0&&(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:[l.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