ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
2 lines • 5.94 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/common"),require("@angular/core"),require("ng-zorro-antd/core"),require("@angular/cdk/layout"),require("@angular/cdk/platform"),require("rxjs"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("ng-zorro-antd/descriptions",["exports","@angular/common","@angular/core","ng-zorro-antd/core","@angular/cdk/layout","@angular/cdk/platform","rxjs","rxjs/operators"],e):e(((t=t||self)["ng-zorro-antd"]=t["ng-zorro-antd"]||{},t["ng-zorro-antd"].descriptions={}),t.ng.common,t.ng.core,t["ng-zorro-antd"].core,t.ng.cdk.layout,t.ng.cdk.platform,t.rxjs,t.rxjs.operators)}(this,function(t,e,n,o,r,i,s,a){"use strict";function c(t,e,n,o){var r,i=arguments.length,s=i<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,o);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(i<3?r(s):i>3?r(e,n,s):r(e,n))||s);return i>3&&s&&Object.defineProperty(e,n,s),s}function p(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}var l=function(){function t(){this.nzSpan=1,this.nzTitle=""}return t.decorators=[{type:n.Component,args:[{changeDetection:n.ChangeDetectionStrategy.OnPush,encapsulation:n.ViewEncapsulation.None,selector:"nz-descriptions-item",template:"\x3c!-- Use a template to wrap contents so contents wouldn't be displayed. --\x3e\n<ng-template>\n <ng-content></ng-content>\n</ng-template>\n",exportAs:"nzDescriptionsItem",preserveWhitespaces:!1}]}],t.propDecorators={content:[{type:n.ViewChild,args:[n.TemplateRef,{"static":!0}]}],nzSpan:[{type:n.Input}],nzTitle:[{type:n.Input}]},c([o.InputNumber(),p("design:type",Object)],t.prototype,"nzSpan",void 0),t}(),d={xxl:3,xl:3,lg:3,md:3,sm:2,xs:1},u=function(){function t(t,e,n,o){this.cdr=t,this.ngZone=e,this.mediaMatcher=n,this.platform=o,this.nzBordered=!1,this.nzColumn=d,this.nzSize="default",this.nzTitle="",this.itemMatrix=[],this.realColumn=3,this.destroy$=new s.Subject,this.resize$=new s.Subject}return t.prototype.ngOnChanges=function(t){t.nzColumn&&this.resize$.next()},t.prototype.ngAfterContentInit=function(){var t=this;s.merge(this.items.changes.pipe(a.startWith(this.items),a.takeUntil(this.destroy$)),this.resize$).pipe(a.takeUntil(this.destroy$)).subscribe(function(){t.prepareMatrix(),t.cdr.markForCheck()}),this.platform.isBrowser&&this.ngZone.runOutsideAngular(function(){s.fromEvent(window,"resize").pipe(a.auditTime(16),a.takeUntil(t.destroy$)).subscribe(function(){t.ngZone.run(function(){t.resize$.next()})})})},t.prototype.ngOnDestroy=function(){this.destroy$.next(),this.destroy$.complete(),this.resize$.complete()},t.prototype.prepareMatrix=function(){var t=[],e=0,r=this.realColumn=this.getColumn(),i=this.items.toArray(),s=[],a=function(){s.push(t),t=[],e=0};i.forEach(function(i){var s=i.nzTitle,c=i.content,p=i.nzSpan;t.push({title:s,content:c,span:p}),(e+=p)>=r&&(e>r&&n.isDevMode()&&o.warn('"nzColumn" is '+r+" but we have row length "+e),a())}),t.length&&a(),this.itemMatrix=s},t.prototype.matchMedia=function(){var t=this,e=o.Breakpoint.md;return Object.keys(o.responsiveMap).map(function(n){var r=n;t.mediaMatcher.matchMedia(o.responsiveMap[r]).matches&&(e=r)}),e},t.prototype.getColumn=function(){return"number"!=typeof this.nzColumn?this.nzColumn[this.matchMedia()]:this.nzColumn},t.decorators=[{type:n.Component,args:[{changeDetection:n.ChangeDetectionStrategy.OnPush,encapsulation:n.ViewEncapsulation.None,selector:"nz-descriptions",template:'<div *ngIf="nzTitle"\n class="ant-descriptions-title">\n <ng-container *nzStringTemplateOutlet="nzTitle">{{ nzTitle }}</ng-container>\n</div>\n<div class="ant-descriptions-view">\n <table>\n <tbody>\n <tr class="ant-descriptions-row"\n *ngFor="let row of itemMatrix; let i = index">\n <ng-container *ngFor="let item of row; let isLast = last">\n <ng-container *ngIf="!nzBordered">\n <td class="ant-descriptions-item"\n [colSpan]="isLast ? (realColumn - (row.length - 1)) * 2 - 1 : item.span">\n <span class="ant-descriptions-item-label">{{ item.title }}</span>\n <span class="ant-descriptions-item-content">\n <ng-template [ngTemplateOutlet]="item.content"></ng-template>\n </span>\n </td>\n </ng-container>\n <ng-container *ngIf="nzBordered">\n <td class="ant-descriptions-item-label"\n *nzStringTemplateOutlet="item.title">{{ item.title }}</td>\n <td class="ant-descriptions-item-content"\n [colSpan]="isLast ? (realColumn - (row.length - 1)) * 2 - 1 : item.span">\n <ng-template [ngTemplateOutlet]="item.content"></ng-template>\n </td>\n </ng-container>\n </ng-container>\n </tr>\n </tbody>\n\n </table>\n</div>\n',exportAs:"nzDescriptions",preserveWhitespaces:!1,host:{"class":"ant-descriptions","[class.bordered]":"nzBordered","[class.middle]":'nzSize === "middle"',"[class.small]":'nzSize === "small"'},styles:["\n nz-descriptions {\n display: block;\n }\n "]}]}],t.ctorParameters=function(){return[{type:n.ChangeDetectorRef},{type:n.NgZone},{type:r.MediaMatcher},{type:i.Platform}]},t.propDecorators={items:[{type:n.ContentChildren,args:[l]}],nzBordered:[{type:n.Input}],nzColumn:[{type:n.Input}],nzSize:[{type:n.Input}],nzTitle:[{type:n.Input}]},c([o.InputBoolean(),p("design:type",Object)],t.prototype,"nzBordered",void 0),t}(),m=function(){function t(){}return t.decorators=[{type:n.NgModule,args:[{imports:[e.CommonModule,o.NzAddOnModule],declarations:[u,l],exports:[u,l]}]}],t}();t.NzDescriptionsComponent=u,t.NzDescriptionsItemComponent=l,t.NzDescriptionsModule=m,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=ng-zorro-antd-descriptions.umd.min.js.map