3
3
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
4
4
*/
5
5
6
- import { isPlatformBrowser } from '@angular/common' ;
6
+ import { isPlatformBrowser , NgTemplateOutlet } from '@angular/common' ;
7
7
import {
8
8
AfterViewInit ,
9
9
booleanAttribute ,
@@ -21,12 +21,14 @@ import {
21
21
Output ,
22
22
PLATFORM_ID ,
23
23
SimpleChanges ,
24
+ TemplateRef ,
24
25
ViewChild
25
26
} from '@angular/core' ;
26
27
import { Subject } from 'rxjs' ;
27
28
import { takeUntil } from 'rxjs/operators' ;
28
29
29
30
import { NzButtonModule } from 'ng-zorro-antd/button' ;
31
+ import { NzStringTemplateOutletDirective } from 'ng-zorro-antd/core/outlet' ;
30
32
import { NzI18nService , NzQRCodeI18nInterface } from 'ng-zorro-antd/i18n' ;
31
33
import { NzIconModule } from 'ng-zorro-antd/icon' ;
32
34
import { NzSpinModule } from 'ng-zorro-antd/spin' ;
@@ -38,7 +40,11 @@ import { drawCanvas, ERROR_LEVEL_MAP, plotQRCodeData } from './qrcode';
38
40
selector : 'nz-qrcode' ,
39
41
exportAs : 'nzQRCode' ,
40
42
template : `
41
- @if (nzStatus !== 'active') {
43
+ @if (!!nzStatusRender) {
44
+ <div class="ant-qrcode-mask">
45
+ <ng-container *nzStringTemplateOutlet="nzStatusRender">{{ nzStatusRender }}</ng-container>
46
+ </div>
47
+ } @else if (nzStatus !== 'active') {
42
48
<div class="ant-qrcode-mask">
43
49
@switch (nzStatus) {
44
50
@case ('loading') {
@@ -70,7 +76,7 @@ import { drawCanvas, ERROR_LEVEL_MAP, plotQRCodeData } from './qrcode';
70
76
class : 'ant-qrcode' ,
71
77
'[class.ant-qrcode-border]' : `nzBordered`
72
78
} ,
73
- imports : [ NzSpinModule , NzButtonModule , NzIconModule ] ,
79
+ imports : [ NzSpinModule , NzButtonModule , NzIconModule , NgTemplateOutlet , NzStringTemplateOutletDirective ] ,
74
80
standalone : true
75
81
} )
76
82
export class NzQRCodeComponent implements OnInit , AfterViewInit , OnChanges , OnDestroy {
@@ -85,6 +91,7 @@ export class NzQRCodeComponent implements OnInit, AfterViewInit, OnChanges, OnDe
85
91
@Input ( { transform : booleanAttribute } ) nzBordered : boolean = true ;
86
92
@Input ( ) nzStatus : 'active' | 'expired' | 'loading' | 'scanned' = 'active' ;
87
93
@Input ( ) nzLevel : keyof typeof ERROR_LEVEL_MAP = 'M' ;
94
+ @Input ( ) nzStatusRender ?: TemplateRef < void > | string | null = null ;
88
95
89
96
@Output ( ) readonly nzRefresh = new EventEmitter < string > ( ) ;
90
97
0 commit comments