UNPKG

ng-zorro-antd

Version:

An enterprise-class UI components based on Ant Design and Angular

9 lines 4.41 kB
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@angular/core"),require("ng-zorro-antd/core"),require("@angular/common")):"function"==typeof define&&define.amd?define("ng-zorro-antd/skeleton",["exports","@angular/core","ng-zorro-antd/core","@angular/common"],n):n(((t=t||self)["ng-zorro-antd"]=t["ng-zorro-antd"]||{},t["ng-zorro-antd"].skeleton={}),t.ng.core,t["ng-zorro-antd"].core,t.ng.common)}(this,function(t,n,e,r){"use strict";var a=function(){return(a=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var a in n=arguments[e])Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a]);return t}).apply(this,arguments)};function o(t,n){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var r,a,o=e.call(t),i=[];try{for(;(void 0===n||n-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(t){a={error:t}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(a)throw a.error}}return i}var i=function(){function t(t,n,e){this.cdr=t,this.nzActive=!1,this.nzLoading=!0,this.nzTitle=!0,this.nzAvatar=!1,this.nzParagraph=!0,this.rowsList=[],this.widthList=[],n.addClass(e.nativeElement,"ant-skeleton")}return t.prototype.toCSSUnit=function(t){return void 0===t&&(t=""),e.toCssPixel(t)},t.prototype.getTitleProps=function(){var t=!!this.nzAvatar,n=!!this.nzParagraph,e="";return!t&&n?e="38%":t&&n&&(e="50%"),a({width:e},this.getProps(this.nzTitle))},t.prototype.getAvatarProps=function(){var t=this.nzTitle&&!this.nzParagraph?"square":"circle";return a({shape:t,size:"large"},this.getProps(this.nzAvatar))},t.prototype.getParagraphProps=function(){var t=!!this.nzAvatar,n=!!this.nzTitle,e={};return t&&n||(e.width="61%"),e.rows=!t&&n?3:2,a({},e,this.getProps(this.nzParagraph))},t.prototype.getProps=function(t){return t&&"object"==typeof t?t:{}},t.prototype.getWidthList=function(){var t=this.paragraph,n=t.width,e=t.rows,r=[];return n&&Array.isArray(n)?r=n:n&&!Array.isArray(n)&&((r=[])[e-1]=n),r},t.prototype.updateProps=function(){this.title=this.getTitleProps(),this.avatar=this.getAvatarProps(),this.paragraph=this.getParagraphProps(),this.rowsList=function(){for(var t=[],n=0;n<arguments.length;n++)t=t.concat(o(arguments[n]));return t}(Array(this.paragraph.rows)),this.widthList=this.getWidthList(),this.cdr.markForCheck()},t.prototype.ngOnInit=function(){this.updateProps()},t.prototype.ngOnChanges=function(t){(t.nzTitle||t.nzAvatar||t.nzParagraph)&&this.updateProps()},t.decorators=[{type:n.Component,args:[{changeDetection:n.ChangeDetectionStrategy.OnPush,encapsulation:n.ViewEncapsulation.None,selector:"nz-skeleton",exportAs:"nzSkeleton",template:'<ng-container *ngIf="nzLoading">\n <div class="ant-skeleton-header" *ngIf="!!nzAvatar">\n <span\n class="ant-skeleton-avatar"\n [class.ant-skeleton-avatar-lg]="avatar.size === \'large\'"\n [class.ant-skeleton-avatar-sm]="avatar.size === \'small\'"\n [class.ant-skeleton-avatar-circle]="avatar.shape === \'circle\'"\n [class.ant-skeleton-avatar-square]="avatar.shape === \'square\'">\n </span>\n </div>\n <div class="ant-skeleton-content">\n <h3 *ngIf="!!nzTitle" class="ant-skeleton-title" [style.width]="toCSSUnit(title.width)"></h3>\n <ul *ngIf="!!nzParagraph" class="ant-skeleton-paragraph">\n <li *ngFor="let row of rowsList; let i=index" [style.width]="toCSSUnit(widthList[i])">\n </li>\n </ul>\n </div>\n</ng-container>\n<ng-container *ngIf="!nzLoading">\n <ng-content></ng-content>\n</ng-container>',host:{"[class.ant-skeleton-with-avatar]":"!!nzAvatar","[class.ant-skeleton-active]":"nzActive"}}]}],t.ctorParameters=function(){return[{type:n.ChangeDetectorRef},{type:n.Renderer2},{type:n.ElementRef}]},t.propDecorators={nzActive:[{type:n.Input}],nzLoading:[{type:n.Input}],nzTitle:[{type:n.Input}],nzAvatar:[{type:n.Input}],nzParagraph:[{type:n.Input}]},t}();var s=function(){function t(){}return t.decorators=[{type:n.NgModule,args:[{declarations:[i],imports:[r.CommonModule],exports:[i]}]}],t}(); /** * @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 */t.NzSkeletonComponent=i,t.NzSkeletonModule=s,Object.defineProperty(t,"__esModule",{value:!0})}); //# sourceMappingURL=ng-zorro-antd-skeleton.umd.min.js.map