@@ -51,12 +51,14 @@ function toTooltipIcon(value: string | NzFormTooltipIcon): Required<NzFormToolti
5151 ` ,
5252 host : {
5353 class : 'ant-form-item-label' ,
54- '[class.ant-form-item-label-left]' : `nzLabelAlign === 'left'`
54+ '[class.ant-form-item-label-left]' : `nzLabelAlign === 'left'` ,
55+ '[class.ant-form-item-label-wrap]' : `nzLabelWrap`
5556 }
5657} )
5758export class NzFormLabelComponent implements OnDestroy {
5859 static ngAcceptInputType_nzRequired : BooleanInput ;
5960 static ngAcceptInputType_nzNoColon : BooleanInput ;
61+ static ngAcceptInputType_nzLabelWrap : BooleanInput ;
6062
6163 @Input ( ) nzFor ?: string ;
6264 @Input ( ) @InputBoolean ( ) nzRequired = false ;
@@ -94,6 +96,17 @@ export class NzFormLabelComponent implements OnDestroy {
9496
9597 private labelAlign : NzLabelAlignType | 'default' = 'default' ;
9698
99+ @Input ( )
100+ set nzLabelWrap ( value : boolean ) {
101+ this . labelWrap = toBoolean ( value ) ;
102+ }
103+
104+ get nzLabelWrap ( ) : boolean {
105+ return this . labelWrap !== 'default' ? this . labelWrap : this . nzFormDirective ?. nzLabelWrap ;
106+ }
107+
108+ private labelWrap : boolean | 'default' = 'default' ;
109+
97110 private destroy$ = new Subject < boolean > ( ) ;
98111
99112 constructor ( private cdr : ChangeDetectorRef , @Optional ( ) @SkipSelf ( ) private nzFormDirective : NzFormDirective ) {
@@ -121,6 +134,14 @@ export class NzFormLabelComponent implements OnDestroy {
121134 takeUntil ( this . destroy$ )
122135 )
123136 . subscribe ( ( ) => this . cdr . markForCheck ( ) ) ;
137+
138+ this . nzFormDirective
139+ . getInputObservable ( 'nzLabelWrap' )
140+ . pipe (
141+ filter ( ( ) => this . labelWrap === 'default' ) ,
142+ takeUntil ( this . destroy$ )
143+ )
144+ . subscribe ( ( ) => this . cdr . markForCheck ( ) ) ;
124145 }
125146 }
126147
0 commit comments