@@ -21,6 +21,7 @@ import {
2121 ChangeDetectionStrategy ,
2222 ChangeDetectorRef ,
2323 Component ,
24+ computed ,
2425 contentChild ,
2526 ContentChild ,
2627 DestroyRef ,
@@ -36,6 +37,7 @@ import {
3637 Output ,
3738 QueryList ,
3839 Renderer2 ,
40+ signal ,
3941 SimpleChanges ,
4042 TemplateRef ,
4143 ViewChild ,
@@ -48,7 +50,7 @@ import { distinctUntilChanged, map, startWith, switchMap, withLatestFrom } from
4850
4951import { NzFormItemFeedbackIconComponent , NzFormNoStatusService , NzFormStatusService } from 'ng-zorro-antd/core/form' ;
5052import { DEFAULT_MENTION_BOTTOM_POSITIONS , DEFAULT_MENTION_TOP_POSITIONS } from 'ng-zorro-antd/core/overlay' ;
51- import { NgClassInterface , NzSafeAny , NzStatus , NzValidateStatus } from 'ng-zorro-antd/core/types' ;
53+ import { NgClassInterface , NzSafeAny , NzStatus , NzValidateStatus , NzVariant } from 'ng-zorro-antd/core/types' ;
5254import {
5355 fromEventOutsideAngular ,
5456 getCaretCoordinates ,
@@ -122,7 +124,12 @@ export type MentionPlacement = 'top' | 'bottom';
122124 changeDetection : ChangeDetectionStrategy . OnPush ,
123125 host : {
124126 class : 'ant-mentions' ,
125- '[class.ant-mentions-rtl]' : `dir === 'rtl'`
127+ '[class.ant-mentions-rtl]' : `dir === 'rtl'` ,
128+ '[class.ant-mentions-borderless]' : `nzVariant === 'borderless'` ,
129+ '[class.ant-mentions-filled]' : `nzVariant === 'filled'` ,
130+ '[class.ant-mentions-underlined]' : `nzVariant === 'underlined'` ,
131+ '[class.ant-mentions-focused]' : `focused()` ,
132+ '[class.ant-mentions-disabled]' : `disabled()`
126133 } ,
127134 imports : [ NgTemplateOutlet , NzIconModule , NzEmptyModule , NzFormItemFeedbackIconComponent ]
128135} )
@@ -142,6 +149,7 @@ export class NzMentionComponent implements OnInit, AfterViewInit, OnChanges {
142149 @Input ( ) nzPlacement : MentionPlacement = 'bottom' ;
143150 @Input ( ) nzSuggestions : NzSafeAny [ ] = [ ] ;
144151 @Input ( ) nzStatus : NzStatus = '' ;
152+ @Input ( ) nzVariant : NzVariant = 'outlined' ;
145153 @Output ( ) readonly nzOnSelect = new EventEmitter < NzSafeAny > ( ) ;
146154 @Output ( ) readonly nzOnSearchChange = new EventEmitter < MentionOnSearchTypes > ( ) ;
147155
@@ -168,6 +176,11 @@ export class NzMentionComponent implements OnInit, AfterViewInit, OnChanges {
168176 statusCls : NgClassInterface = { } ;
169177 status : NzValidateStatus = '' ;
170178 hasFeedback : boolean = false ;
179+ readonly focused = signal ( false ) ;
180+
181+ readonly disabled = computed ( ( ) => {
182+ return this . trigger ( ) . disabled ( ) ;
183+ } ) ;
171184
172185 private previousValue : string | null = null ;
173186 private cursorMention : string | null = null ;
@@ -327,6 +340,8 @@ export class NzMentionComponent implements OnInit, AfterViewInit, OnChanges {
327340 }
328341
329342 private bindTriggerEvents ( ) : void {
343+ this . trigger ( ) . onFocusin . subscribe ( ( ) => this . focused . set ( true ) ) ;
344+ this . trigger ( ) . onBlur . subscribe ( ( ) => this . focused . set ( false ) ) ;
330345 this . trigger ( ) . onInput . subscribe ( ( e : KeyboardEvent ) => this . handleInput ( e ) ) ;
331346 this . trigger ( ) . onKeydown . subscribe ( ( e : KeyboardEvent ) => this . handleKeydown ( e ) ) ;
332347 this . trigger ( ) . onClick . subscribe ( ( ) => this . handleClick ( ) ) ;
0 commit comments