44 */
55
66import { Direction , Directionality } from '@angular/cdk/bidi' ;
7- import { NgIf , NgStyle } from '@angular/common' ;
7+ import { NgStyle } from '@angular/common' ;
88import {
99 ChangeDetectionStrategy ,
1010 ChangeDetectorRef ,
@@ -14,13 +14,15 @@ import {
1414 OnInit ,
1515 Optional ,
1616 TemplateRef ,
17- ViewEncapsulation
17+ ViewEncapsulation ,
18+ booleanAttribute
1819} from '@angular/core' ;
1920import { Subject } from 'rxjs' ;
2021import { takeUntil } from 'rxjs/operators' ;
2122
2223import { NzOutletModule } from 'ng-zorro-antd/core/outlet' ;
2324import { NgStyleInterface } from 'ng-zorro-antd/core/types' ;
25+ import { NzSkeletonModule } from 'ng-zorro-antd/skeleton' ;
2426
2527import { NzStatisticNumberComponent } from './statistic-number.component' ;
2628import { NzStatisticValueType } from './typings' ;
@@ -34,21 +36,29 @@ import { NzStatisticValueType } from './typings';
3436 <div class="ant-statistic-title">
3537 <ng-container *nzStringTemplateOutlet="nzTitle">{{ nzTitle }}</ng-container>
3638 </div>
37- <div class="ant-statistic-content" [ngStyle]="nzValueStyle">
38- <span *ngIf="nzPrefix" class="ant-statistic-content-prefix">
39- <ng-container *nzStringTemplateOutlet="nzPrefix">{{ nzPrefix }}</ng-container>
40- </span>
41- <nz-statistic-number [nzValue]="nzValue" [nzValueTemplate]="nzValueTemplate"></nz-statistic-number>
42- <span *ngIf="nzSuffix" class="ant-statistic-content-suffix">
43- <ng-container *nzStringTemplateOutlet="nzSuffix">{{ nzSuffix }}</ng-container>
44- </span>
45- </div>
39+ @if (nzLoading) {
40+ <nz-skeleton class="ant-statistic-skeleton" [nzParagraph]="false" />
41+ } @else {
42+ <div class="ant-statistic-content" [ngStyle]="nzValueStyle">
43+ @if (nzPrefix) {
44+ <span class="ant-statistic-content-prefix">
45+ <ng-container *nzStringTemplateOutlet="nzPrefix">{{ nzPrefix }}</ng-container>
46+ </span>
47+ }
48+ <nz-statistic-number [nzValue]="nzValue" [nzValueTemplate]="nzValueTemplate"></nz-statistic-number>
49+ @if (nzSuffix) {
50+ <span class="ant-statistic-content-suffix">
51+ <ng-container *nzStringTemplateOutlet="nzSuffix">{{ nzSuffix }}</ng-container>
52+ </span>
53+ }
54+ </div>
55+ }
4656 ` ,
4757 host : {
4858 class : 'ant-statistic' ,
4959 '[class.ant-statistic-rtl]' : `dir === 'rtl'`
5060 } ,
51- imports : [ NzStatisticNumberComponent , NgIf , NzOutletModule , NgStyle ] ,
61+ imports : [ NzSkeletonModule , NzStatisticNumberComponent , NzOutletModule , NgStyle ] ,
5262 standalone : true
5363} )
5464export class NzStatisticComponent implements OnDestroy , OnInit {
@@ -58,6 +68,7 @@ export class NzStatisticComponent implements OnDestroy, OnInit {
5868 @Input ( ) nzValue ?: NzStatisticValueType ;
5969 @Input ( ) nzValueStyle : NgStyleInterface = { } ;
6070 @Input ( ) nzValueTemplate ?: TemplateRef < { $implicit : NzStatisticValueType } > ;
71+ @Input ( { transform : booleanAttribute } ) nzLoading : boolean = false ;
6172 dir : Direction = 'ltr' ;
6273
6374 private destroy$ = new Subject < void > ( ) ;
0 commit comments