From 83cdc847d5a3eec31d8f21821a01bc87ab071777 Mon Sep 17 00:00:00 2001 From: Yadong Xie Date: Fri, 24 Apr 2020 17:40:05 +0800 Subject: [PATCH] fix(module:select): fix ie11 select search input (#5117) close #5110 --- README-zh_CN.md | 4 ---- README.md | 4 ---- .../transition-patch/transition-patch.directive.ts | 2 +- components/select/option-container.component.ts | 2 +- components/select/select-search.component.ts | 10 ++++++++-- components/select/select.module.ts | 2 ++ 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README-zh_CN.md b/README-zh_CN.md index 1da96412bd0..7b9c27d69b8 100644 --- a/README-zh_CN.md +++ b/README-zh_CN.md @@ -120,10 +120,6 @@ $ npm run start 浏览器会自动打开。 -## 🗺 Road Map - -查看 [这个 issue](https://github.com/NG-ZORRO/ng-zorro-antd/issues/2025) 来了解我们 2019 年的开发计划。 - ## 🤝 如何贡献 [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://github.com/NG-ZORRO/ng-zorro-antd/pulls) diff --git a/README.md b/README.md index ddc90090178..baed50a158c 100644 --- a/README.md +++ b/README.md @@ -128,10 +128,6 @@ $ npm run start Browser would open automatically. -## 🗺 Road Map - -Check [this issue](https://github.com/NG-ZORRO/ng-zorro-antd/issues/2025) to read our plans for 2019. - ## 🤝 Contributing [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://github.com/NG-ZORRO/ng-zorro-antd/pulls) diff --git a/components/core/transition-patch/transition-patch.directive.ts b/components/core/transition-patch/transition-patch.directive.ts index d0347bd5471..d262430d931 100644 --- a/components/core/transition-patch/transition-patch.directive.ts +++ b/components/core/transition-patch/transition-patch.directive.ts @@ -15,7 +15,7 @@ import { NzSafeAny } from 'ng-zorro-antd/core/types'; * https://github.com/angular/angular/issues/34718 */ @Directive({ - selector: '[nz-button],nz-button-group,[nz-icon],[nz-menu-item],[nz-submenu],nz-select-top-control' + selector: '[nz-button],nz-button-group,[nz-icon],[nz-menu-item],[nz-submenu],nz-select-top-control,nz-select-placeholder' }) export class NzTransitionPatchDirective implements AfterViewInit, OnChanges { @Input() hidden: NzSafeAny = null; diff --git a/components/select/option-container.component.ts b/components/select/option-container.component.ts index ecdcbec316c..b9816533f3b 100644 --- a/components/select/option-container.component.ts +++ b/components/select/option-container.component.ts @@ -72,7 +72,7 @@ import { NzSelectItemInterface, NzSelectModeType } from './select.types'; } }) export class NzOptionContainerComponent implements OnChanges { - @Input() notFoundContent: string | undefined = undefined; + @Input() notFoundContent: string | TemplateRef | undefined = undefined; @Input() menuItemSelectedIcon: TemplateRef | null = null; @Input() dropdownRender: TemplateRef | null = null; @Input() activatedValue: NzSafeAny | null = null; diff --git a/components/select/select-search.component.ts b/components/select/select-search.component.ts index 405c5176019..40b1d8cad3f 100644 --- a/components/select/select-search.component.ts +++ b/components/select/select-search.component.ts @@ -35,7 +35,6 @@ import { [attr.autofocus]="autofocus ? 'autofocus' : null" [disabled]="disabled" [style.opacity]="showInput ? null : 0" - [readOnly]="!showInput" (ngModelChange)="onValueChange($event)" (compositionstart)="setCompositionState(true)" (compositionend)="setCompositionState(false)" @@ -97,10 +96,17 @@ export class NzSelectSearchComponent implements AfterViewInit, OnChanges { ngOnChanges(changes: SimpleChanges): void { const inputDOM = this.inputElement.nativeElement; - const { focusTrigger } = changes; + const { focusTrigger, showInput } = changes; if (focusTrigger && focusTrigger.currentValue === true && focusTrigger.previousValue === false) { inputDOM.focus(); } + if (showInput) { + if (this.showInput) { + this.renderer.removeAttribute(inputDOM, 'readonly'); + } else { + this.renderer.setAttribute(inputDOM, 'readonly', 'readonly'); + } + } } ngAfterViewInit(): void { diff --git a/components/select/select.module.ts b/components/select/select.module.ts index a9b1c6635de..74a044d8f46 100644 --- a/components/select/select.module.ts +++ b/components/select/select.module.ts @@ -15,6 +15,7 @@ import { FormsModule } from '@angular/forms'; import { NzNoAnimationModule } from 'ng-zorro-antd/core/no-animation'; import { NzOutletModule } from 'ng-zorro-antd/core/outlet'; import { NzOverlayModule } from 'ng-zorro-antd/core/overlay'; +import { ɵNzTransitionPatchModule as NzTransitionPatchModule } from 'ng-zorro-antd/core/transition-patch'; import { NzEmptyModule } from 'ng-zorro-antd/empty'; import { NzI18nModule } from 'ng-zorro-antd/i18n'; import { NzIconModule } from 'ng-zorro-antd/icon'; @@ -43,6 +44,7 @@ import { NzSelectComponent } from './select.component'; NzEmptyModule, NzOverlayModule, NzNoAnimationModule, + NzTransitionPatchModule, ScrollingModule, A11yModule ],