From c37db90b2d495310ba9fdc4b944aaecde1f7c715 Mon Sep 17 00:00:00 2001 From: wenqi73 <1264578441@qq.com> Date: Thu, 17 Oct 2019 18:45:02 +0800 Subject: [PATCH] fix(module:date-picker): animation start after overlay open --- .../lib/calendar/calendar-input.component.ts | 2 +- components/date-picker/picker.component.html | 1 - components/date-picker/picker.component.ts | 15 +++++++++++++-- docs/i18n.zh-CN.md | 2 +- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/components/date-picker/lib/calendar/calendar-input.component.ts b/components/date-picker/lib/calendar/calendar-input.component.ts index 39c6feb8011..5f0bbc95ae6 100644 --- a/components/date-picker/lib/calendar/calendar-input.component.ts +++ b/components/date-picker/lib/calendar/calendar-input.component.ts @@ -48,7 +48,7 @@ export class CalendarInputComponent implements OnInit { ngOnInit(): void { if (this.autoFocus) { - this.inputRef.nativeElement.focus(); + setTimeout(() => this.inputRef.nativeElement.focus()); } } diff --git a/components/date-picker/picker.component.html b/components/date-picker/picker.component.html index de39fcd54c6..b1d35e26dab 100644 --- a/components/date-picker/picker.component.html +++ b/components/date-picker/picker.component.html @@ -82,7 +82,6 @@
{ if (this.cdkConnectedOverlay && this.cdkConnectedOverlay.overlayRef) { @@ -211,7 +220,9 @@ export class NzPickerComponent implements AfterViewInit { } animationDone(): void { - this.animationOpenState = this.realOpenState; + if (!this.realOpenState) { + this.animationOpenState = false; + } } } diff --git a/docs/i18n.zh-CN.md b/docs/i18n.zh-CN.md index 1e45343d0df..f1d1f9137a5 100755 --- a/docs/i18n.zh-CN.md +++ b/docs/i18n.zh-CN.md @@ -8,7 +8,7 @@ title: 国际化 ## 全局配置 -`ng-zorro-antd` 提供了几个配置型 token 用于全局配置国际化文案和日期,`NZ_I18N`用于国际化文案,`NZ_DATE_CONFIG`用于修改日期相关特性,。除此之外,我们默认使用Angular的语言包来进行日期格式化(需要引入相应的Angular语言包)。 +`ng-zorro-antd` 提供了几个配置型 token 用于全局配置国际化文案和日期,`NZ_I18N`用于国际化文案,`NZ_DATE_CONFIG`用于修改日期相关特性,除此之外,我们默认使用Angular的语言包来进行日期格式化(需要引入相应的Angular语言包)。 另外,我们还提供了可选的`NZ_DATE_LOCALE`用于date-fns方式来格式化本地日期(依赖 [`date-fns`](https://date-fns.org/docs/I18n) 库,详见下方的`如何使用 date-fns 进行日期格式化`)。