From 79c52eafba6498bac41d9bbc46fe66289348e0ed Mon Sep 17 00:00:00 2001 From: Wenqi Chen <1264578441@qq.com> Date: Fri, 6 Nov 2020 13:40:00 +0800 Subject: [PATCH] fix(module:select): dropdown can be opened when disabled (#6008) close #6005 close #6007 --- .../select/select-top-control.component.ts | 32 ++++++------------- components/select/select.component.ts | 13 ++++++-- 2 files changed, 20 insertions(+), 25 deletions(-) diff --git a/components/select/select-top-control.component.ts b/components/select/select-top-control.component.ts index 892a84dd01b..46974aba649 100644 --- a/components/select/select-top-control.component.ts +++ b/components/select/select-top-control.component.ts @@ -57,16 +57,6 @@ import { NzSelectItemInterface, NzSelectModeType, NzSelectTopControlItemType } f - + `, host: { '[class.ant-select-selector]': 'true', - '(click)': 'onHostClick()', '(keydown)': 'onHostKeydown($event)' } }) @@ -108,7 +107,6 @@ export class NzSelectTopControlComponent implements OnChanges { @Output() readonly inputValueChange = new EventEmitter(); @Output() readonly animationEnd = new EventEmitter(); @Output() readonly deleteItem = new EventEmitter(); - @Output() readonly openChange = new EventEmitter(); @ViewChild(NzSelectSearchComponent) nzSelectSearchComponent!: NzSelectSearchComponent; listOfSlicedItem: NzSelectTopControlItemType[] = []; isShowPlaceholder = true; @@ -116,16 +114,6 @@ export class NzSelectTopControlComponent implements OnChanges { isComposing = false; inputValue: string | null = null; - onHostClick(): void { - if (this.open && this.showSearch) { - return; - } - - if (!this.disabled) { - this.openChange.next(!this.open); - } - } - onHostKeydown(e: KeyboardEvent): void { const inputValue = (e.target as HTMLInputElement).value; if (e.keyCode === BACKSPACE && this.mode !== 'default' && !inputValue && this.listOfTopItem.length > 0) { diff --git a/components/select/select.component.ts b/components/select/select.component.ts index cfbece51342..0e7a3cf89c6 100644 --- a/components/select/select.component.ts +++ b/components/select/select.component.ts @@ -92,7 +92,6 @@ export type NzSelectSizeType = 'large' | 'default' | 'small'; (animationEnd)="updateCdkConnectedOverlayPositions()" (deleteItem)="onItemDelete($event)" (keydown)="onKeyDown($event)" - (openChange)="setOpenState($event)" > !item.nzHide)