Skip to content

Commit

Permalink
fix(dropdown,rating,typeahead): remove global in order to be usable i…
Browse files Browse the repository at this point in the history
…n System.js (#1734)

* fix(dropdown,rating,typeahead): remove global in order to be useable with systemjs and aot

* chore(dropdown,rating,typeahead): replaced MouseEvent by Event
  • Loading branch information
karlhaas authored and valorkin committed Mar 10, 2017
1 parent 27a0229 commit 4a7719b
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 18 deletions.
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

0 comments on commit 4a7719b

Please sign in to comment.