ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
16 lines (14 loc) • 8.08 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/cdk/bidi"),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/bidi","@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="undefined"!=typeof globalThis?globalThis:t||self)["ng-zorro-antd"]=t["ng-zorro-antd"]||{},t["ng-zorro-antd"].grid={}),t.ng.cdk.bidi,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,i,s,o,l,a,u){"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.
***************************************************************************** */Object.create;function p(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,s=n.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(r=s.next()).done;)o.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=s.return)&&n.call(s)}finally{if(i)throw i.error}}return o}Object.create;var c=function(){function t(t,e,n,r,i,s,l){this.elementRef=t,this.renderer=e,this.mediaMatcher=n,this.ngZone=r,this.platform=i,this.breakpointService=s,this.directionality=l,this.nzAlign=null,this.nzJustify=null,this.nzGutter=null,this.actualGutter$=new o.ReplaySubject(1),this.dir="ltr",this.destroy$=new o.Subject,this.elementRef.nativeElement.classList.add("ant-row")}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(s.gridResponsiveMap).map((function(i){var o=i;t.mediaMatcher.matchMedia(s.gridResponsiveMap[o]).matches&&n[o]&&(e[r]=n[o])}))):e[r]=Number(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 i=function(e,n){var r=t.elementRef.nativeElement;null!==n&&t.renderer.setStyle(r,e,"-"+n/2+"px")};i("margin-left",n),i("margin-right",n),i("margin-top",r),i("margin-bottom",r)},t.prototype.ngOnInit=function(){var t,e=this;this.dir=this.directionality.value,null===(t=this.directionality.change)||void 0===t||t.pipe(l.takeUntil(this.destroy$)).subscribe((function(t){e.dir=t})),this.setGutterStyle()},t.prototype.ngOnChanges=function(t){t.nzGutter&&this.setGutterStyle()},t.prototype.ngAfterViewInit=function(){var t=this;this.platform.isBrowser&&this.breakpointService.subscribe(s.gridResponsiveMap).pipe(l.takeUntil(this.destroy$)).subscribe((function(){t.setGutterStyle()}))},t.prototype.ngOnDestroy=function(){this.destroy$.next(),this.destroy$.complete()},t}();c.decorators=[{type:i.Directive,args:[{selector:"[nz-row],nz-row,nz-form-item",exportAs:"nzRow",host:{"[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'","[class.ant-row-rtl]":'dir === "rtl"'}}]}],c.ctorParameters=function(){return[{type:i.ElementRef},{type:i.Renderer2},{type:n.MediaMatcher},{type:i.NgZone},{type:r.Platform},{type:s.NzBreakpointService},{type:e.Directionality,decorators:[{type:i.Optional}]}]},c.propDecorators={nzAlign:[{type:i.Input}],nzJustify:[{type:i.Input}],nzGutter:[{type:i.Input}]};var h=function(){function t(t,e,n,r){this.elementRef=t,this.nzRowDirective=e,this.renderer=n,this.directionality=r,this.classMap={},this.destroy$=new o.Subject,this.hostFlexStyle=null,this.dir="ltr",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=Object.assign(((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["ant-col-rtl"]="rtl"===this.dir,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=Object.assign({},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 i=t[n];["span","pull","push","offset","order"].forEach((function(t){e["ant-col-"+r+("span"===t?"-":"-"+t+"-")+i[t]]=i&&a.isNotNil(i[t])}))}})),e},t.prototype.ngOnInit=function(){var t=this;this.dir=this.directionality.value,this.directionality.change.pipe(l.takeUntil(this.destroy$)).subscribe((function(e){t.dir=e,t.setHostClassMap()})),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(l.takeUntil(this.destroy$)).subscribe((function(e){var n=p(e,2),r=n[0],i=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",i),s("padding-bottom",i)}))},t.prototype.ngOnDestroy=function(){this.destroy$.next(),this.destroy$.complete()},t}();h.decorators=[{type:i.Directive,args:[{selector:"[nz-col],nz-col,nz-form-control,nz-form-label",exportAs:"nzCol",host:{"[style.flex]":"hostFlexStyle"}}]}],h.ctorParameters=function(){return[{type:i.ElementRef},{type:c,decorators:[{type:i.Optional},{type:i.Host}]},{type:i.Renderer2},{type:e.Directionality,decorators:[{type:i.Optional}]}]},h.propDecorators={nzFlex:[{type:i.Input}],nzSpan:[{type:i.Input}],nzOrder:[{type:i.Input}],nzOffset:[{type:i.Input}],nzPush:[{type:i.Input}],nzPull:[{type:i.Input}],nzXs:[{type:i.Input}],nzSm:[{type:i.Input}],nzMd:[{type:i.Input}],nzLg:[{type:i.Input}],nzXl:[{type:i.Input}],nzXXl:[{type:i.Input}]};var d=function(){};d.decorators=[{type:i.NgModule,args:[{declarations:[h,c],exports:[h,c],imports:[e.BidiModule,u.CommonModule,n.LayoutModule,r.PlatformModule]}]}],t.NzColDirective=h,t.NzGridModule=d,t.NzRowDirective=c,Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=ng-zorro-antd-grid.umd.min.js.map