@@ -137,7 +137,7 @@ const defaultDisplayRender = (labels: string[]): string => labels.join(' / ');
137137 [mirrorSync]="true"
138138 [disabled]="nzDisabled"
139139 [autofocus]="nzAutoFocus"
140- [focusTrigger]="menuVisible"
140+ [focusTrigger]="menuVisible() "
141141 />
142142 </div>
143143 </div>
@@ -150,7 +150,7 @@ const defaultDisplayRender = (labels: string[]): string => labels.join(' / ');
150150 [mirrorSync]="false"
151151 [disabled]="nzDisabled"
152152 [autofocus]="nzAutoFocus"
153- [focusTrigger]="menuVisible"
153+ [focusTrigger]="menuVisible() "
154154 />
155155
156156 @if (showLabelRender) {
@@ -175,7 +175,7 @@ const defaultDisplayRender = (labels: string[]): string => labels.join(' / ');
175175 @if (nzShowArrow) {
176176 <span class="ant-select-arrow" [class.ant-select-arrow-loading]="isLoading">
177177 @if (!isLoading) {
178- <nz-icon [nzType]="$any(nzSuffixIcon)" [class.ant-cascader-picker-arrow-expand]="menuVisible" />
178+ <nz-icon [nzType]="$any(nzSuffixIcon)" [class.ant-cascader-picker-arrow-expand]="menuVisible() " />
179179 } @else {
180180 <nz-icon nzType="loading" />
181181 }
@@ -198,7 +198,7 @@ const defaultDisplayRender = (labels: string[]): string => labels.join(' / ');
198198 [cdkConnectedOverlayOrigin]="overlayOrigin"
199199 [cdkConnectedOverlayPositions]="positions"
200200 [cdkConnectedOverlayTransformOriginOn]="'.ant-cascader-dropdown'"
201- [cdkConnectedOverlayOpen]="menuVisible"
201+ [cdkConnectedOverlayOpen]="menuVisible() "
202202 (overlayOutsideClick)="onClickOutside($event)"
203203 (detach)="closeMenu()"
204204 (positionChange)="onPositionChange($event)"
@@ -220,7 +220,7 @@ const defaultDisplayRender = (labels: string[]): string => labels.join(' / ');
220220 #menu
221221 class="ant-cascader-menus"
222222 [class.ant-cascader-rtl]="dir === 'rtl'"
223- [class.ant-cascader-menus-hidden]="!menuVisible"
223+ [class.ant-cascader-menus-hidden]="!menuVisible() "
224224 [class.ant-cascader-menu-empty]="shouldShowEmpty"
225225 [class]="nzMenuClassName"
226226 [style]="nzMenuStyle"
@@ -291,7 +291,7 @@ const defaultDisplayRender = (labels: string[]): string => labels.join(' / ');
291291 '[class.ant-select-borderless]' : `nzVariant === 'borderless'` ,
292292 '[class.ant-select-filled]' : `nzVariant === 'filled'` ,
293293 '[class.ant-select-underlined]' : `nzVariant === 'underlined'` ,
294- '[class.ant-select-open]' : 'menuVisible' ,
294+ '[class.ant-select-open]' : 'menuVisible() ' ,
295295 '[class.ant-select-focused]' : 'isFocused' ,
296296 '[class.ant-select-multiple]' : 'nzMultiple' ,
297297 '[class.ant-select-single]' : '!nzMultiple' ,
@@ -416,7 +416,7 @@ export class NzCascaderComponent
416416 shouldShowEmpty : boolean = false ;
417417
418418 el : HTMLElement = this . elementRef . nativeElement ;
419- menuVisible = false ;
419+ readonly menuVisible = signal ( false ) ;
420420 isLoading = false ;
421421 labelRenderText ?: string ;
422422 labelRenderContext = { } ;
@@ -528,9 +528,7 @@ export class NzCascaderComponent
528528 map ( ( [ { status, hasFeedback } , noStatus ] ) => ( { status : noStatus ? '' : status , hasFeedback } ) ) ,
529529 takeUntilDestroyed ( this . destroyRef )
530530 )
531- . subscribe ( ( { status, hasFeedback } ) => {
532- this . setStatusStyles ( status , hasFeedback ) ;
533- } ) ;
531+ . subscribe ( ( { status, hasFeedback } ) => this . setStatusStyles ( status , hasFeedback ) ) ;
534532
535533 const srv = this . cascaderService ;
536534
@@ -570,9 +568,9 @@ export class NzCascaderComponent
570568 this . dropdownWidthStyle = '' ;
571569 } ) ;
572570
573- this . i18nService . localeChange . pipe ( startWith ( ) , takeUntilDestroyed ( this . destroyRef ) ) . subscribe ( ( ) => {
574- this . setLocale ( ) ;
575- } ) ;
571+ this . i18nService . localeChange
572+ . pipe ( startWith ( ) , takeUntilDestroyed ( this . destroyRef ) )
573+ . subscribe ( ( ) => this . setLocale ( ) ) ;
576574
577575 this . size . set ( this . nzSize ) ;
578576
@@ -672,7 +670,7 @@ export class NzCascaderComponent
672670 }
673671
674672 setMenuVisible ( visible : boolean ) : void {
675- if ( this . nzDisabled || this . menuVisible === visible ) {
673+ if ( this . nzDisabled || this . menuVisible ( ) === visible ) {
676674 return ;
677675 }
678676 if ( visible ) {
@@ -683,7 +681,7 @@ export class NzCascaderComponent
683681 this . inputValue = '' ;
684682 }
685683
686- this . menuVisible = visible ;
684+ this . menuVisible . set ( visible ) ;
687685 this . nzVisibleChange . emit ( visible ) ;
688686 this . cdr . detectChanges ( ) ;
689687 }
@@ -752,7 +750,7 @@ export class NzCascaderComponent
752750 }
753751
754752 handleInputBlur ( ) : void {
755- this . menuVisible ? this . focus ( ) : this . blur ( ) ;
753+ this . menuVisible ( ) ? this . focus ( ) : this . blur ( ) ;
756754 }
757755
758756 handleInputFocus ( ) : void {
@@ -772,7 +770,7 @@ export class NzCascaderComponent
772770 this . focus ( ) ;
773771 }
774772 if ( this . isActionTrigger ( 'click' ) ) {
775- this . delaySetMenuVisible ( ! this . menuVisible , 100 ) ;
773+ this . delaySetMenuVisible ( ! this . menuVisible ( ) , 100 ) ;
776774 }
777775 this . onTouched ( ) ;
778776 }
@@ -790,7 +788,7 @@ export class NzCascaderComponent
790788 onTriggerMouseLeave ( event : MouseEvent ) : void {
791789 if (
792790 this . nzDisabled ||
793- ! this . menuVisible ||
791+ ! this . menuVisible ( ) ||
794792 this . isOpening ||
795793 ! this . isActionTrigger ( 'hover' ) ||
796794 this . openControlled
@@ -1130,7 +1128,7 @@ export class NzCascaderComponent
11301128 * and may exceed the boundary of browser's window.
11311129 */
11321130 private reposition ( ) : void {
1133- if ( this . overlay && this . overlay . overlayRef && this . menuVisible ) {
1131+ if ( this . overlay && this . overlay . overlayRef && this . menuVisible ( ) ) {
11341132 Promise . resolve ( ) . then ( ( ) => {
11351133 this . overlay . overlayRef . updatePosition ( ) ;
11361134 this . cdr . markForCheck ( ) ;
@@ -1257,7 +1255,7 @@ export class NzCascaderComponent
12571255 }
12581256
12591257 // Press any keys above to reopen menu.
1260- if ( ! this . menuVisible && keyCode !== BACKSPACE && keyCode !== ESCAPE && ! this . openControlled ) {
1258+ if ( ! this . menuVisible ( ) && keyCode !== BACKSPACE && keyCode !== ESCAPE && ! this . openControlled ) {
12611259 // The `setMenuVisible` runs `detectChanges()`, so we don't need to run `markForCheck()` additionally.
12621260 return this . ngZone . run ( ( ) => this . setMenuVisible ( true ) ) ;
12631261 }
@@ -1267,7 +1265,7 @@ export class NzCascaderComponent
12671265 return ;
12681266 }
12691267
1270- if ( ! this . menuVisible ) {
1268+ if ( ! this . menuVisible ( ) ) {
12711269 return ;
12721270 }
12731271
0 commit comments