FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

chore(): fix menu types · Java1024/ionic@c4d5900 · GitHub

Repository navigation

Commit c4d5900

Browse files
committed
chore(): fix menu types
1 parent 3e5a36a commit c4d5900

4 files changed

Lines changed: 37 additions & 34 deletions

File tree

‎ionic/animations/animation.ts‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ export class Animation {
130130
return this;
131131
}
132132

133-
duration(value) {
133+
duration(value?: number) {
134134
if (arguments.length) {
135135
this._duration = value;
136136
return this;
@@ -145,7 +145,7 @@ export class Animation {
145145
}
146146
}
147147

148-
easing(name, opts) {
148+
easing(name?: string, opts?: {}) {
149149
if (arguments.length) {
150150
this._easing = {
151151
name: name,
@@ -156,7 +156,7 @@ export class Animation {
156156
return this._easing || (this._parent && this._parent.easing());
157157
}
158158

159-
playbackRate(value) {
159+
playbackRate(value?: number) {
160160
if (arguments.length) {
161161
this._rate = value;
162162
let i;
@@ -237,7 +237,7 @@ export class Animation {
237237
}
238238
}
239239

240-
play(done) {
240+
play(done?: Function) {
241241
const self = this;
242242

243243
// the actual play() method which may or may not start async
@@ -513,9 +513,9 @@ export class Animation {
513513
return this;
514514
}
515515

516-
clone() {
516+
clone(): Animation {
517517

518-
function copy(dest, src) {
518+
function copy(dest, src): Animation {
519519
// undo what stage() may have already done
520520
assign(dest, src);
521521

@@ -540,7 +540,7 @@ export class Animation {
540540
this._chld[i].dispose(removeElement);
541541
}
542542
for (i = 0; i < this._ani.length; i++) {
543-
this._ani[i].dispose(removeElement);
543+
this._ani[i].dispose();
544544
}
545545
if (removeElement) {
546546
for (i = 0; i < this._el.length; i++) {

‎ionic/components/menu/menu-types.ts‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@ import {Animation} from '../../animations/animation';
1010
* @private
1111
*/
1212
export class MenuType {
13-
14-
constructor() {
15-
this.open = new Animation();
16-
this.close = new Animation();
17-
}
13+
open: Animation = new Animation();
14+
close: Animation = new Animation();
15+
isOpening: boolean;
16+
seek: Animation;
1817

1918
setOpen(shouldOpen) {
2019
return new Promise(resolve => {

‎ionic/components/menu/menu.ts‎

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
import {Component, forwardRef, Directive, Host, EventEmitter, ElementRef, NgZone} from 'angular2/core';
1+
import {Component, forwardRef, Directive, Host, EventEmitter, ElementRef, NgZone, Input} from 'angular2/core';
22

33
import {Ion} from '../ion';
44
import {IonicApp} from '../app/app';
55
import {Config} from '../../config/config';
66
import {Platform} from '../../platform/platform';
77
import {Keyboard} from '../../util/keyboard';
88
import * as gestures from './menu-gestures';
9+
import {Gesture} from '../../gestures/gesture';
10+
import {MenuType} from './menu-types';
911

1012

1113
/**
@@ -91,13 +93,6 @@ import * as gestures from './menu-gestures';
9193
*/
9294
@Component({
9395
selector: 'ion-menu',
94-
inputs: [
95-
'content',
96-
'id',
97-
'side',
98-
'type',
99-
'maxEdgeStart'
100-
],
10196
defaultInputs: {
10297
'side': 'left',
10398
'menuType': 'reveal'
@@ -112,6 +107,22 @@ import * as gestures from './menu-gestures';
112107
directives: [forwardRef(() => MenuBackdrop)]
113108
})
114109
export class Menu extends Ion {
110+
private _preventTime: number = 0;
111+
private _cntEle: HTMLElement;
112+
private _gesture: Gesture;
113+
private _targetGesture: Gesture;
114+
private _type: MenuType;
115+
opening: EventEmitter<Menu> = new EventEmitter();
116+
isOpen: boolean = false;
117+
isEnabled: boolean = true;
118+
backdrop: MenuBackdrop;
119+
onContentClick: Function;
120+
121+
@Input() content: any;
122+
@Input() id: string;
123+
@Input() side: string;
124+
@Input() type: string;
125+
@Input() maxEdgeStart;
115126

116127
constructor(
117128
elementRef: ElementRef,
@@ -122,19 +133,13 @@ export class Menu extends Ion {
122133
private zone: NgZone
123134
) {
124135
super(elementRef);
125-
126-
this.opening = new EventEmitter('opening');
127-
this.isOpen = false;
128-
this._preventTime = 0;
129-
this.isEnabled = true;
130136
}
131137

132138
/**
133139
* @private
134140
*/
135141
ngOnInit() {
136142
let self = this;
137-
138143
let content = self.content;
139144
self._cntEle = (content instanceof Node) ? content : content && content.getNativeElement && content.getNativeElement();
140145

@@ -390,9 +395,10 @@ export class Menu extends Ion {
390395
/**
391396
* @private
392397
*/
393-
static register(name, cls) {
398+
static register(name: string, cls: new(...args: any[]) => MenuType) {
394399
menuTypes[name] = cls;
395400
}
401+
//static register(name:string , cls: typeof MenuType) {
396402

397403
/**
398404
* @private
@@ -431,8 +437,8 @@ export class Menu extends Ion {
431437

432438
}
433439

434-
let menuTypes = {};
435-
let menuIds = 0;
440+
let menuTypes:{ [name: string]: new(...args: any[]) => MenuType } = {};
441+
let menuIds:number = 0;
436442

437443

438444
@Directive({
@@ -441,11 +447,9 @@ let menuIds = 0;
441447
'(click)': 'clicked($event)'
442448
}
443449
})
444-
class MenuBackdrop {
450+
export class MenuBackdrop {
445451

446-
constructor(@Host() menu: Menu, elementRef: ElementRef) {
447-
this.menu = menu;
448-
this.elementRef = elementRef;
452+
constructor(@Host() private menu: Menu, public elementRef: ElementRef) {
449453
menu.backdrop = this;
450454
}
451455

‎ionic/components/nav/view-controller.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class ViewController {
2828
public id: string;
2929
private _leavingOpts: any = null;
3030
private _onDismiss: Function = null;
31-
private _nav: NavController;
31+
protected _nav: NavController;
3232
private _nbTmpRef: TemplateRef;
3333
private _nbVwRef: ViewContainerRef;
3434
private _pgRef: ElementRef;

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL