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(dropdown,rating,typeahead): remove global in order to be usable … #1734

Merged
merged 2 commits into from
Mar 10, 2017
Merged
Show file tree
Hide file tree
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
5 changes: 1 addition & 4 deletions src/dropdown/dropdown-toggle.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ import {

import { DropdownDirective } from './dropdown.directive';

/* tslint:disable-next-line */
const MouseEvent = (global as any).MouseEvent as MouseEvent;

/** Mark element which can toggle dropdown visibility with this directive */
@Directive({
selector: '[dropdownToggle]',
Expand Down Expand Up @@ -42,7 +39,7 @@ export class DropdownToggleDirective implements OnInit {
}

@HostListener('click', ['$event'])
public toggleDropdown(event:MouseEvent):boolean {
public toggleDropdown(event:Event):boolean {
event.stopPropagation();

if (!this.isDisabled) {
Expand Down
7 changes: 1 addition & 6 deletions src/dropdown/dropdown.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ export const DISABLED = 'disabled';
export const OUTSIDECLICK = 'outsideClick';
export const NONINPUT = 'nonInput';

/* tslint:disable-next-line */
const KeyboardEvent = (global as any).KeyboardEvent as KeyboardEvent;
/* tslint:disable-next-line */
const MouseEvent = (global as any).MouseEvent as MouseEvent;

@Injectable()
export class DropdownService {
private openScope:DropdownDirective;
Expand Down Expand Up @@ -48,7 +43,7 @@ export class DropdownService {
clearTimeout(this.suspendedEvent);
}

protected closeDropdown(event:MouseEvent):void {
protected closeDropdown(event:Event):void {
this.suspendedEvent = setTimeout(() => {
if (!this.openScope) {
return;
Expand Down
2 changes: 1 addition & 1 deletion src/pagination/pager.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export class PagerComponent implements ControlValueAccessor, OnInit {
this.onTouched = fn;
}

public selectPage(page: number, event?: MouseEvent): void {
public selectPage(page: number, event?: Event): void {
if (event) {
event.preventDefault();
}
Expand Down
2 changes: 1 addition & 1 deletion src/pagination/pagination.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ export class PaginationComponent implements ControlValueAccessor, OnInit {
this.onTouched = fn;
}

public selectPage(page:number, event?:MouseEvent):void {
public selectPage(page:number, event?:Event):void {
if (event) {
event.preventDefault();
}
Expand Down
3 changes: 0 additions & 3 deletions src/rating/rating.component.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { Component, EventEmitter, HostListener, Input, OnInit, Output, forwardRef } from '@angular/core';
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';

/* tslint:disable-next-line */
const KeyboardEvent = (global as any).KeyboardEvent as KeyboardEvent;

export const RATING_CONTROL_VALUE_ACCESSOR: any = {
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => RatingComponent),
Expand Down
3 changes: 0 additions & 3 deletions src/typeahead/typeahead.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ import 'rxjs/add/operator/toArray';
import { TypeaheadMatch } from './typeahead-match.class';
import { ComponentLoaderFactory, ComponentLoader } from '../component-loader';

/* tslint:disable-next-line */
const KeyboardEvent = (global as any).KeyboardEvent as KeyboardEvent;

@Directive({selector: '[typeahead]'})
export class TypeaheadDirective implements OnInit, OnDestroy {
/** options source, can be Array of strings, objects or an Observable for external matching process */
Expand Down