Skip to content

Commit

Permalink
fix(module:datepicker): fix open panel when input change (NG-ZORRO#5284)
Browse files Browse the repository at this point in the history
  • Loading branch information
DeckardCainCN committed Jun 23, 2020
1 parent dfc443d commit af7f381
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions components/date-picker/picker.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ import { PREFIX_CLASS } from './util';
[size]="inputSize"
(focus)="onFocus()"
(blur)="onBlur()"
(input)="onInputKeyup($event)"
(keyup.enter)="onInputKeyup($event, true)"
(input)="onInputKeyup($event, true, false)"
(keyup.enter)="onInputKeyup($event, true, true)"
/>
<ng-container *ngTemplateOutlet="tplRightRest"></ng-container>
</div>
Expand Down Expand Up @@ -93,9 +93,9 @@ import { PREFIX_CLASS } from './util';
[size]="inputSize"
(click)="onClickInputBox($event, partType)"
(blur)="onBlur()"
(input)="onInputKeyup($event, false)"
(input)="onInputKeyup($event, true, false)"
(focus)="onFocus(partType)"
(keyup.enter)="onInputKeyup($event, true)"
(keyup.enter)="onInputKeyup($event, true, true)"
[(ngModel)]="inputValue[datePickerService.getActiveIndex(partType)]"
placeholder="{{ getPlaceholder(partType) }}"
/>
Expand Down Expand Up @@ -406,14 +406,14 @@ export class NzPickerComponent implements OnInit, AfterViewInit, OnChanges, OnDe
return this.dateHelper.format(value && (value as CandyDate).nativeDate, this.format);
}

onInputKeyup(event: Event, isEnter: boolean = false): void {
if (isEnter && !this.realOpenState) {
onInputKeyup(event: Event, OpenPanel: boolean = false, emitValue: boolean = false): void {
if (OpenPanel && !this.realOpenState) {
this.showOverlay();
return;
}
const date = this.checkValidInputDate((event as KeyboardEvent).target!);
if (this.panel && date) {
this.panel.changeValueFromSelect(date, isEnter);
this.panel.changeValueFromSelect(date, emitValue);
}
}

Expand Down

0 comments on commit af7f381

Please sign in to comment.