ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
9 lines • 9.72 kB
JavaScript
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/cdk/platform"),require("@angular/common"),require("@angular/core"),require("ng-zorro-antd/core"),require("rxjs"),require("@angular/cdk/layout"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("ng-zorro-antd/descriptions",["exports","@angular/cdk/platform","@angular/common","@angular/core","ng-zorro-antd/core","rxjs","@angular/cdk/layout","rxjs/operators"],t):t(((n=n||self)["ng-zorro-antd"]=n["ng-zorro-antd"]||{},n["ng-zorro-antd"].descriptions={}),n.ng.cdk.platform,n.ng.common,n.ng.core,n["ng-zorro-antd"].core,n.rxjs,n.ng.cdk.layout,n.rxjs.operators)}(this,function(n,t,e,o,i,r,a,s){"use strict";function c(n,t,e,o){var i,r=arguments.length,a=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,e):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(n,t,e,o);else for(var s=n.length-1;s>=0;s--)(i=n[s])&&(a=(r<3?i(a):r>3?i(t,e,a):i(t,e))||a);return r>3&&a&&Object.defineProperty(t,e,a),a}function p(n,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(n,t)}function l(n,t){var e="function"==typeof Symbol&&n[Symbol.iterator];if(!e)return n;var o,i,r=e.call(n),a=[];try{for(;(void 0===t||t-- >0)&&!(o=r.next()).done;)a.push(o.value)}catch(n){i={error:n}}finally{try{o&&!o.done&&(e=r.return)&&e.call(r)}finally{if(i)throw i.error}}return a}var d=function(){function n(){this.nzSpan=1,this.nzTitle="",this.inputChange$=new r.Subject}return n.prototype.ngOnChanges=function(){this.inputChange$.next()},n.prototype.ngOnDestroy=function(){this.inputChange$.complete()},n.decorators=[{type:o.Component,args:[{changeDetection:o.ChangeDetectionStrategy.OnPush,encapsulation:o.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}]}],n.propDecorators={content:[{type:o.ViewChild,args:[o.TemplateRef,{static:!0}]}],nzSpan:[{type:o.Input}],nzTitle:[{type:o.Input}]},c([i.InputNumber(),p("design:type",Object)],n.prototype,"nzSpan",void 0),n}();var u={xxl:3,xl:3,lg:3,md:3,sm:2,xs:1},m=function(){function n(n,t,e,o,i){this.nzConfigService=n,this.cdr=t,this.mediaMatcher=e,this.platform=o,this.nzDomEventService=i,this.nzLayout="horizontal",this.nzTitle="",this.itemMatrix=[],this.realColumn=3,this.destroy$=new r.Subject,this.resize$=new r.Subject}return n.prototype.ngOnChanges=function(n){n.nzColumn&&this.resize$.next()},n.prototype.ngAfterContentInit=function(){var n=this,t=this.items.changes.pipe(s.startWith(this.items),s.takeUntil(this.destroy$));r.merge(t,t.pipe(s.switchMap(function(){return r.merge.apply(void 0,function(){for(var n=[],t=0;t<arguments.length;t++)n=n.concat(l(arguments[t]));return n}(n.items.map(function(n){return n.inputChange$}))).pipe(s.auditTime(16))})),this.resize$).pipe(s.takeUntil(this.destroy$)).subscribe(function(){n.prepareMatrix(),n.cdr.markForCheck()}),this.platform.isBrowser&&this.nzDomEventService.registerResizeListener().pipe(s.takeUntil(this.destroy$),s.finalize(function(){return n.nzDomEventService.unregisterResizeListener()})).subscribe(function(){return n.resize$.next()})},n.prototype.ngOnDestroy=function(){this.destroy$.next(),this.destroy$.complete(),this.resize$.complete()},n.prototype.prepareMatrix=function(){for(var n=[],t=0,e=this.realColumn=this.getColumn(),o=this.items.toArray(),r=o.length,a=[],s=function(){a.push(n),n=[],t=0},c=0;c<r;c++){var p=o[c],l=p.nzTitle,d=p.content,u=p.nzSpan;(t+=u)>=e?(t>e&&i.warn('"nzColumn" is '+e+" but we have row length "+t),n.push({title:l,content:d,span:e-(t-u)}),s()):c===r-1?(n.push({title:l,content:d,span:e-(t-u)}),s()):n.push({title:l,content:d,span:u})}this.itemMatrix=a},n.prototype.matchMedia=function(){var n=this,t=i.NzBreakpoint.md;return Object.keys(i.responsiveMap).map(function(e){var o=e;n.mediaMatcher.matchMedia(i.responsiveMap[o]).matches&&(t=o)}),t},n.prototype.getColumn=function(){return"number"!=typeof this.nzColumn?this.nzColumn[this.matchMedia()]:this.nzColumn},n.decorators=[{type:o.Component,args:[{changeDetection:o.ChangeDetectionStrategy.OnPush,encapsulation:o.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 <ng-container *ngIf="nzLayout === \'horizontal\'">\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 \x3c!-- Horizontal & NOT Bordered --\x3e\n <ng-container *ngIf="!nzBordered">\n <td class="ant-descriptions-item"\n [colSpan]="item.span">\n <span class="ant-descriptions-item-label"\n [class.ant-descriptions-item-colon]="nzColon">{{ 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 \x3c!-- Horizontal & Bordered --\x3e\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]="item.span * 2 - 1">\n <ng-template [ngTemplateOutlet]="item.content"></ng-template>\n </td>\n </ng-container>\n </ng-container>\n </tr>\n </ng-container>\n\n <ng-container *ngIf="nzLayout === \'vertical\'">\n \x3c!-- Vertical & NOT Bordered --\x3e\n <ng-container *ngIf="!nzBordered">\n <ng-container *ngFor="let row of itemMatrix; let i = index">\n <tr class="ant-descriptions-row">\n <ng-container *ngFor="let item of row; let isLast = last">\n <td class="ant-descriptions-item"\n [colSpan]="item.span">\n <span class="ant-descriptions-item-label"\n [class.ant-descriptions-item-colon]="nzColon">{{ item.title }}</span>\n </td>\n </ng-container>\n </tr>\n <tr class="ant-descriptions-row">\n <ng-container *ngFor="let item of row; let isLast = last">\n <td class="ant-descriptions-item"\n [colSpan]="item.span">\n <span class="ant-descriptions-item-content">\n <ng-template [ngTemplateOutlet]="item.content"></ng-template>\n </span>\n </td>\n </ng-container>\n </tr>\n </ng-container>\n </ng-container>\n \x3c!-- Vertical & Bordered --\x3e\n <ng-container *ngIf="nzBordered">\n <ng-container *ngFor="let row of itemMatrix; let i = index">\n <tr class="ant-descriptions-row">\n <ng-container *ngFor="let item of row; let isLast = last">\n <td class="ant-descriptions-item-label"\n [colSpan]="item.span">\n {{ item.title }}\n </td>\n </ng-container>\n </tr>\n <tr class="ant-descriptions-row">\n <ng-container *ngFor="let item of row; let isLast = last">\n <td class="ant-descriptions-item-content"\n [colSpan]="item.span">\n <ng-template [ngTemplateOutlet]="item.content"></ng-template>\n </td>\n </ng-container>\n </tr>\n </ng-container>\n </ng-container>\n </ng-container>\n </tbody>\n </table>\n</div>\n',exportAs:"nzDescriptions",preserveWhitespaces:!1,host:{class:"ant-descriptions","[class.ant-descriptions-bordered]":"nzBordered","[class.ant-descriptions-middle]":'nzSize === "middle"',"[class.ant-descriptions-small]":'nzSize === "small"'},styles:["\n nz-descriptions {\n display: block;\n }\n "]}]}],n.ctorParameters=function(){return[{type:i.NzConfigService},{type:o.ChangeDetectorRef},{type:a.MediaMatcher},{type:t.Platform},{type:i.NzDomEventService}]},n.propDecorators={items:[{type:o.ContentChildren,args:[d]}],nzBordered:[{type:o.Input}],nzLayout:[{type:o.Input}],nzColumn:[{type:o.Input}],nzSize:[{type:o.Input}],nzTitle:[{type:o.Input}],nzColon:[{type:o.Input}]},c([i.InputBoolean(),i.WithConfig(!1),p("design:type",Boolean)],n.prototype,"nzBordered",void 0),c([i.WithConfig(u),p("design:type",Object)],n.prototype,"nzColumn",void 0),c([i.WithConfig("default"),p("design:type",String)],n.prototype,"nzSize",void 0),c([i.WithConfig(!0),i.InputBoolean(),p("design:type",Boolean)],n.prototype,"nzColon",void 0),n}();var g=function(){function n(){}return n.decorators=[{type:o.NgModule,args:[{imports:[e.CommonModule,i.NzAddOnModule,t.PlatformModule],declarations:[m,d],exports:[m,d]}]}],n}();
/**
* @license
* Copyright Alibaba.com All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
*/n.NzDescriptionsComponent=m,n.NzDescriptionsItemComponent=d,n.NzDescriptionsModule=g,Object.defineProperty(n,"__esModule",{value:!0})});
//# sourceMappingURL=ng-zorro-antd-descriptions.umd.min.js.map