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

Added ionDragEnd output event to be emitted on leave for ion-range #10761

Merged
merged 3 commits into from
Mar 15, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/components/range/range.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,11 +302,20 @@ export class Range extends Ion implements AfterViewInit, ControlValueAccessor, O
return null;
}

/**
* @output {Range} Emitted when the range selector drag starts.
*/
@Output() ionFocus: EventEmitter<Range> = new EventEmitter<Range>();

/**
* @output {Range} Emitted when the range value changes.
*/
@Output() ionChange: EventEmitter<Range> = new EventEmitter<Range>();

/**
* @output {Range} Emitted when the range selector drag ends.
*/
@Output() ionBlur: EventEmitter<Range> = new EventEmitter<Range>();

constructor(
private _form: Form,
Expand Down Expand Up @@ -356,6 +365,9 @@ export class Range extends Ion implements AfterViewInit, ControlValueAccessor, O
return false;
}

// trigger ionFocus event
this.ionFocus.emit(this);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's move this at the bottom of the function just to make sure we don't break anything!

Copy link
Contributor Author

@AmitMY AmitMY Mar 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be more correct there, as if I put this at the end, the order of firing would be:
ionChange -> ionFocus -> ionChange x many -> ionBlur

Instead of:
ionFocus -> ionChange x (many+1) -> ionBlur

Still think I should change?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shit! you right


// prevent default so scrolling does not happen
ev.preventDefault();
ev.stopPropagation();
Expand Down Expand Up @@ -411,6 +423,9 @@ export class Range extends Ion implements AfterViewInit, ControlValueAccessor, O

// trigger a haptic end
this._haptic.gestureSelectionEnd();

// trigger ionBlur event
this.ionBlur.emit(this);
}
}

Expand Down