ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
2 lines • 4.11 kB
JavaScript
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("ng-zorro-antd/core"),require("@angular/common"),require("@angular/core")):"function"==typeof define&&define.amd?define("ng-zorro-antd/skeleton",["exports","ng-zorro-antd/core","@angular/common","@angular/core"],n):n((t["ng-zorro-antd"]=t["ng-zorro-antd"]||{},t["ng-zorro-antd"].skeleton={}),t["ng-zorro-antd"].core,t.ng.common,t.ng.core)}(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||0<n--)&&!(r=o.next()).done;)i.push(r.value)}catch(s){a={error:s}}finally{try{r&&!r.done&&(e=o["return"])&&e.call(o)}finally{if(a)throw a.error}}return i}var i=(s.prototype.toCSSUnit=function(t){return void 0===t&&(t=""),n.toCssPixel(t)},s.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))},s.prototype.getAvatarProps=function(){var t=this.nzTitle&&!this.nzParagraph?"square":"circle";return a({shape:t,size:"large"},this.getProps(this.nzAvatar))},s.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))},s.prototype.getProps=function(t){return t&&"object"==typeof t?t:{}},s.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},s.prototype.updateProps=function(){this.title=this.getTitleProps(),this.avatar=this.getAvatarProps(),this.paragraph=this.getParagraphProps(),this.rowsList=function e(){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()},s.prototype.ngOnInit=function(){this.updateProps()},s.prototype.ngOnChanges=function(t){(t.nzTitle||t.nzAvatar||t.nzParagraph)&&this.updateProps()},s.decorators=[{type:r.Component,args:[{changeDetection:r.ChangeDetectionStrategy.OnPush,encapsulation:r.ViewEncapsulation.None,selector:"nz-skeleton",exportAs:"nzSkeleton",template:'<ng-container *ngIf="nzLoading">\n <div class="ant-skeleton-header">\n <span\n *ngIf="!!nzAvatar"\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"}}]}],s.ctorParameters=function(){return[{type:r.ChangeDetectorRef},{type:r.Renderer2},{type:r.ElementRef}]},s.propDecorators={nzActive:[{type:r.Input}],nzLoading:[{type:r.Input}],nzTitle:[{type:r.Input}],nzAvatar:[{type:r.Input}],nzParagraph:[{type:r.Input}]},s);function s(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")}var p=(l.decorators=[{type:r.NgModule,args:[{declarations:[i],imports:[e.CommonModule],exports:[i]}]}],l);function l(){}t.NzSkeletonComponent=i,t.NzSkeletonModule=p,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=ng-zorro-antd-skeleton.umd.min.js.map