ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
23 lines (21 loc) • 11.1 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/outlet"),require("ng-zorro-antd/core/util"),require("rxjs"),require("ng-zorro-antd/core/config"),require("ng-zorro-antd/core/logger"),require("ng-zorro-antd/core/services"),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/outlet","ng-zorro-antd/core/util","rxjs","ng-zorro-antd/core/config","ng-zorro-antd/core/logger","ng-zorro-antd/core/services","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.outlet,n["ng-zorro-antd"].core.util,n.rxjs,n["ng-zorro-antd"].core.config,n["ng-zorro-antd"].core.logger,n["ng-zorro-antd"].core.services,n.rxjs.operators)}(this,(function(n,t,e,o,r,i,a,s,c,p,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.
***************************************************************************** */function g(n,t,e,o){var r,i=arguments.length,a=i<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--)(r=n[s])&&(a=(i<3?r(a):i>3?r(t,e,a):r(t,e))||a);return i>3&&a&&Object.defineProperty(t,e,a),a}function d(n,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(n,t)}function u(n,t){var e="function"==typeof Symbol&&n[Symbol.iterator];if(!e)return n;var o,r,i=e.call(n),a=[];try{for(;(void 0===t||t-- >0)&&!(o=i.next()).done;)a.push(o.value)}catch(n){r={error:n}}finally{try{o&&!o.done&&(e=i.return)&&e.call(i)}finally{if(r)throw r.error}}return a}var m=function(){function n(){this.nzSpan=1,this.nzTitle="",this.inputChange$=new a.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:"\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}]},g([i.InputNumber(),d("design:type",Object)],n.prototype,"nzSpan",void 0),n}();var f={xxl:3,xl:3,lg:3,md:3,sm:2,xs:1},z=function(){function n(n,t,e){this.nzConfigService=n,this.cdr=t,this.breakpointService=e,this.nzLayout="horizontal",this.nzTitle="",this.itemMatrix=[],this.realColumn=3,this.breakpoint=p.NzBreakpointEnum.md,this.destroy$=new a.Subject}return n.prototype.ngOnChanges=function(n){n.nzColumn&&this.prepareMatrix()},n.prototype.ngAfterContentInit=function(){var n=this,t=this.items.changes.pipe(l.startWith(this.items),l.takeUntil(this.destroy$));a.merge(t,t.pipe(l.switchMap((function(){return a.merge.apply(void 0,function(){for(var n=[],t=0;t<arguments.length;t++)n=n.concat(u(arguments[t]));return n}(n.items.map((function(n){return n.inputChange$})))).pipe(l.auditTime(16))}))),this.breakpointService.subscribe(p.gridResponsiveMap).pipe(l.tap((function(t){return n.breakpoint=t})))).pipe(l.takeUntil(this.destroy$)).subscribe((function(){n.prepareMatrix(),n.cdr.markForCheck()}))},n.prototype.ngOnDestroy=function(){this.destroy$.next(),this.destroy$.complete()},n.prototype.prepareMatrix=function(){if(this.items){for(var n=[],t=0,e=this.realColumn=this.getColumn(),o=this.items.toArray(),r=o.length,i=[],a=function(){i.push(n),n=[],t=0},s=0;s<r;s++){var p=o[s],l=p.nzTitle,g=p.content,d=p.nzSpan;(t+=d)>=e?(t>e&&c.warn('"nzColumn" is '+e+" but we have row length "+t),n.push({title:l,content:g,span:e-(t-d)}),a()):s===r-1?(n.push({title:l,content:g,span:e-(t-d)}),a()):n.push({title:l,content:g,span:d})}this.itemMatrix=i}},n.prototype.getColumn=function(){return"number"!=typeof this.nzColumn?this.nzColumn[this.breakpoint]:this.nzColumn},n.decorators=[{type:o.Component,args:[{changeDetection:o.ChangeDetectionStrategy.OnPush,encapsulation:o.ViewEncapsulation.None,selector:"nz-descriptions",exportAs:"nzDescriptions",preserveWhitespaces:!1,template:'\n <div *ngIf="nzTitle" 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" *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" [colSpan]="item.span">\n <span class="ant-descriptions-item-label" [class.ant-descriptions-item-colon]="nzColon">\n <ng-container *nzStringTemplateOutlet="item.title">\n {{ item.title }}\n </ng-container>\n </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" *nzStringTemplateOutlet="item.title">\n <ng-container *nzStringTemplateOutlet="item.title">\n {{ item.title }}\n </ng-container>\n </td>\n <td class="ant-descriptions-item-content" [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" [colSpan]="item.span">\n <span class="ant-descriptions-item-label" [class.ant-descriptions-item-colon]="nzColon">\n <ng-container *nzStringTemplateOutlet="item.title">\n {{ item.title }}\n </ng-container>\n </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" [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" [colSpan]="item.span">\n <ng-container *nzStringTemplateOutlet="item.title">\n {{ item.title }}\n </ng-container>\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" [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 ',host:{class:"ant-descriptions","[class.ant-descriptions-bordered]":"nzBordered","[class.ant-descriptions-middle]":'nzSize === "middle"',"[class.ant-descriptions-small]":'nzSize === "small"'}}]}],n.ctorParameters=function(){return[{type:s.NzConfigService},{type:o.ChangeDetectorRef},{type:p.NzBreakpointService}]},n.propDecorators={items:[{type:o.ContentChildren,args:[m]}],nzBordered:[{type:o.Input}],nzLayout:[{type:o.Input}],nzColumn:[{type:o.Input}],nzSize:[{type:o.Input}],nzTitle:[{type:o.Input}],nzColon:[{type:o.Input}]},g([i.InputBoolean(),s.WithConfig("descriptions",!1),d("design:type",Boolean)],n.prototype,"nzBordered",void 0),g([s.WithConfig("descriptions",f),d("design:type",Object)],n.prototype,"nzColumn",void 0),g([s.WithConfig("descriptions","default"),d("design:type",String)],n.prototype,"nzSize",void 0),g([s.WithConfig("descriptions",!0),i.InputBoolean(),d("design:type",Boolean)],n.prototype,"nzColon",void 0),n}();var h=function(){function n(){}return n.decorators=[{type:o.NgModule,args:[{imports:[e.CommonModule,r.NzOutletModule,t.PlatformModule],declarations:[z,m],exports:[z,m]}]}],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=z,n.NzDescriptionsItemComponent=m,n.NzDescriptionsModule=h,Object.defineProperty(n,"__esModule",{value:!0})}));
//# sourceMappingURL=ng-zorro-antd-descriptions.umd.min.js.map