ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
9 lines • 6.12 kB
JavaScript
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@angular/cdk/platform"),require("rxjs"),require("@angular/common"),require("@angular/core"),require("ng-zorro-antd/core")):"function"==typeof define&&define.amd?define("ng-zorro-antd/statistic",["exports","@angular/cdk/platform","rxjs","@angular/common","@angular/core","ng-zorro-antd/core"],n):n((t["ng-zorro-antd"]=t["ng-zorro-antd"]||{},t["ng-zorro-antd"].statistic={}),t.ng.cdk.platform,t.rxjs,t.ng.common,t.ng.core,t["ng-zorro-antd"].core)}(this,function(t,n,e,r,a,s){"use strict";var o=function(t,n){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)n.hasOwnProperty(e)&&(t[e]=n[e])})(t,n)};function c(t,n){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var a,r,o=e.call(t),i=[];try{for(;(void 0===n||0<n--)&&!(a=o.next()).done;)i.push(a.value)}catch(s){r={error:s}}finally{try{a&&!a.done&&(e=o["return"])&&e.call(o)}finally{if(r)throw r.error}}return i}
/**
* @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
*/var i=(u.decorators=[{type:a.Component,args:[{changeDetection:a.ChangeDetectionStrategy.OnPush,encapsulation:a.ViewEncapsulation.None,selector:"nz-statistic",exportAs:"nzStatistic",template:'<div class="ant-statistic-title">\n <ng-container *nzStringTemplateOutlet="nzTitle">{{ nzTitle }}</ng-container>\n</div>\n<div class="ant-statistic-content" [ngStyle]="nzValueStyle">\n <span *ngIf="nzPrefix" class="ant-statistic-content-prefix">\n <ng-container *nzStringTemplateOutlet="nzPrefix">{{ nzPrefix }}</ng-container>\n </span>\n <nz-statistic-number\n [nzValue]="nzValue"\n [nzValueTemplate]="nzValueTemplate">\n </nz-statistic-number>\n <span *ngIf="nzSuffix" class="ant-statistic-content-suffix">\n <ng-container *nzStringTemplateOutlet="nzSuffix">{{ nzSuffix }}</ng-container>\n </span>\n</div>\n',host:{"class":"ant-statistic"},styles:["nz-statistic { display: block; }"]}]}],u.propDecorators={nzPrefix:[{type:a.Input}],nzSuffix:[{type:a.Input}],nzTitle:[{type:a.Input}],nzValue:[{type:a.Input}],nzValueStyle:[{type:a.Input}],nzValueTemplate:[{type:a.Input}]},u);function u(){this.nzValueStyle={}}var l,p=(function T(t,n){function e(){this.constructor=t}o(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}(f,l=i),f.prototype.ngOnChanges=function(t){t.nzValue&&(this.target=Number(t.nzValue.currentValue),t.nzValue.isFirstChange()||this.syncTimer())},f.prototype.ngOnInit=function(){this.syncTimer()},f.prototype.ngOnDestroy=function(){this.stopTimer()},f.prototype.syncTimer=function(){this.target>=Date.now()?this.startTimer():this.stopTimer()},f.prototype.startTimer=function(){var t=this;this.platform.isBrowser&&this.ngZone.runOutsideAngular(function(){t.stopTimer(),t.updater_=e.interval(1e3/30).subscribe(function(){t.updateValue(),t.cdr.detectChanges()})})},f.prototype.stopTimer=function(){this.updater_&&(this.updater_.unsubscribe(),this.updater_=null)},f.prototype.updateValue=function(){this.diff=Math.max(this.target-Date.now(),0),0===this.diff&&this.stopTimer()},f.decorators=[{type:a.Component,args:[{changeDetection:a.ChangeDetectionStrategy.OnPush,encapsulation:a.ViewEncapsulation.None,selector:"nz-countdown",exportAs:"nzCountdown",template:'<nz-statistic\n [nzValue]="diff"\n [nzValueStyle]="nzValueStyle"\n [nzValueTemplate]="nzValueTemplate || countDownTpl"\n [nzTitle]="nzTitle"\n [nzPrefix]="nzPrefix"\n [nzSuffix]="nzSuffix">\n</nz-statistic>\n\n<ng-template #countDownTpl>{{ diff | nzTimeRange: nzFormat }}</ng-template>'}]}],f.ctorParameters=function(){return[{type:a.ChangeDetectorRef},{type:a.NgZone},{type:n.Platform}]},f.propDecorators={nzFormat:[{type:a.Input}]},f);function f(t,n,e){var a=l.call(this)||this;return a.cdr=t,a.ngZone=n,a.platform=e,a.nzFormat="HH:mm:ss",a}var m=(g.prototype.ngOnChanges=function(){this.formatNumber()},g.prototype.formatNumber=function(){var t="number"==typeof this.nzValue?".":r.getLocaleNumberSymbol(this.locale_id,r.NumberSymbol.Decimal),n=c(String(this.nzValue).split(t),2),e=n[0],a=n[1];this.displayInt=e,this.displayDecimal=a?""+t+a:""},g.decorators=[{type:a.Component,args:[{changeDetection:a.ChangeDetectionStrategy.OnPush,encapsulation:a.ViewEncapsulation.None,preserveWhitespaces:!1,selector:"nz-statistic-number",exportAs:"nzStatisticNumber",template:'<ng-container\n *ngIf="nzValueTemplate"\n [ngTemplateOutlet]="nzValueTemplate"\n [ngTemplateOutletContext]="{ $implicit: nzValue }">\n</ng-container>\n<ng-container *ngIf="!nzValueTemplate">\n <span *ngIf="displayInt" class="ant-statistic-content-value-int">{{ displayInt }}</span>\n <span *ngIf="displayDecimal" class="ant-statistic-content-value-decimal">{{ displayDecimal }}</span>\n</ng-container>\n',host:{"class":"ant-statistic-content-value"},styles:["nz-number { display: inline }"]}]}],g.ctorParameters=function(){return[{type:String,decorators:[{type:a.Inject,args:[a.LOCALE_ID]}]}]},g.propDecorators={nzValue:[{type:a.Input}],nzValueTemplate:[{type:a.Input}]},g);function g(t){this.locale_id=t,this.displayInt="",this.displayDecimal=""}var z=(y.prototype.transform=function(t,n){void 0===n&&(n="HH:mm:ss");var i=Number(t||0);return s.timeUnits.reduce(function(t,n){var e=c(n,2),a=e[0],r=e[1];if(-1===t.indexOf(a))return t;var o=Math.floor(i/r);return i-=o*r,t.replace(new RegExp(a+"+","g"),function(t){return s.padStart(o.toString(),t.length,"0")})},n)},y.decorators=[{type:a.Pipe,args:[{name:"nzTimeRange",pure:!0}]}],y);function y(){}var d=(h.decorators=[{type:a.NgModule,args:[{imports:[r.CommonModule,s.NzAddOnModule],declarations:[i,p,m,z],exports:[i,p,m,z]}]}],h);function h(){}t.NzCountdownComponent=p,t.NzStatisticComponent=i,t.NzStatisticModule=d,t.NzStatisticNumberComponent=m,t.NzTimeRangePipe=z,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=ng-zorro-antd-statistic.umd.min.js.map