Skip to content

Commit

Permalink
fix(date-picker): Fixed spinning only when the editor is focused #3034 (
Browse files Browse the repository at this point in the history
#4027)

* fix(date-picker): Fixed spinning only when the editor is focused #3034

* fix(date-picker): Hidden internal event #4027

* fix(date-picker): Added missing disabled prop for editable date picker #4027
  • Loading branch information
sboykova authored and bkulov committed Feb 27, 2019
1 parent 83474d4 commit 6fe0289
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</igx-prefix>
<label *ngIf="labelVisibility" igxLabel>{{label}}</label>
<input #editableInput class="igx-date-picker__input-date" igxInput type="text" [value]="transformedDate"
[igxMask]="inputMask" [placeholder]="mask" [displayValuePipe]="displayValuePipe"
[igxMask]="inputMask" [placeholder]="mask" [disabled]="disabled" [displayValuePipe]="displayValuePipe"
[focusedValuePipe]="inputValuePipe" (blur)="onBlur($event)" (wheel)="onWheel($event)"
(input)="onInput($event)" (keydown)="onKeyDown($event)" (focus)=onFocus() />
<igx-suffix *ngIf="!isEmpty" (click)="clear()">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,9 @@ export class IgxDatePickerComponent implements IDatePicker, ControlValueAccessor
private _modalOverlaySettings: OverlaySettings;
private _transformedDate;

/**
* @hidden
*/
@HostListener('keydown.spacebar', ['$event'])
@HostListener('keydown.space', ['$event'])
public onSpaceClick(event: KeyboardEvent) {
Expand Down Expand Up @@ -1008,11 +1011,12 @@ export class IgxDatePickerComponent implements IDatePicker, ControlValueAccessor
* @hidden
*/
public onWheel(event) {
event.preventDefault();
event.stopPropagation();
const sign = (event.deltaY > 0) ? -1 : 1;
this.spinValue(event.target.value, sign, event.type);

if (this._isInEditMode) {
event.preventDefault();
event.stopPropagation();
const sign = (event.deltaY > 0) ? -1 : 1;
this.spinValue(event.target.value, sign, event.type);
}
}

/**
Expand Down

0 comments on commit 6fe0289

Please sign in to comment.