Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 7 commits into from
Feb 27, 2019
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