| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -130,7 +130,7 @@ export class Animation { | |||
| 130 | 130 | return this; | |
| 131 | 131 | } | |
| 132 | 132 | ||
| 133 | - duration(value) { | ||
| 133 | + duration(value?: number) { | ||
| 134 | 134 | if (arguments.length) { | |
| 135 | 135 | this._duration = value; | |
| 136 | 136 | return this; | |
@@ -145,7 +145,7 @@ export class Animation { | |||
| 145 | 145 | } | |
| 146 | 146 | } | |
| 147 | 147 | ||
| 148 | - easing(name, opts) { | ||
| 148 | + easing(name?: string, opts?: {}) { | ||
| 149 | 149 | if (arguments.length) { | |
| 150 | 150 | this._easing = { | |
| 151 | 151 | name: name, | |
@@ -156,7 +156,7 @@ export class Animation { | |||
| 156 | 156 | return this._easing || (this._parent && this._parent.easing()); | |
| 157 | 157 | } | |
| 158 | 158 | ||
| 159 | - playbackRate(value) { | ||
| 159 | + playbackRate(value?: number) { | ||
| 160 | 160 | if (arguments.length) { | |
| 161 | 161 | this._rate = value; | |
| 162 | 162 | let i; | |
@@ -237,7 +237,7 @@ export class Animation { | |||
| 237 | 237 | } | |
| 238 | 238 | } | |
| 239 | 239 | ||
| 240 | - play(done) { | ||
| 240 | + play(done?: Function) { | ||
| 241 | 241 | const self = this; | |
| 242 | 242 | ||
| 243 | 243 | // the actual play() method which may or may not start async | |
@@ -513,9 +513,9 @@ export class Animation { | |||
| 513 | 513 | return this; | |
| 514 | 514 | } | |
| 515 | 515 | ||
| 516 | - clone() { | ||
| 516 | + clone(): Animation { | ||
| 517 | 517 | ||
| 518 | - function copy(dest, src) { | ||
| 518 | + function copy(dest, src): Animation { | ||
| 519 | 519 | // undo what stage() may have already done | |
| 520 | 520 | assign(dest, src); | |
| 521 | 521 | ||
@@ -540,7 +540,7 @@ export class Animation { | |||
| 540 | 540 | this._chld[i].dispose(removeElement); | |
| 541 | 541 | } | |
| 542 | 542 | for (i = 0; i < this._ani.length; i++) { | |
| 543 | - this._ani[i].dispose(removeElement); | ||
| 543 | + this._ani[i].dispose(); | ||
| 544 | 544 | } | |
| 545 | 545 | if (removeElement) { | |
| 546 | 546 | for (i = 0; i < this._el.length; i++) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,11 +10,10 @@ import {Animation} from '../../animations/animation'; | |||
| 10 | 10 | * @private | |
| 11 | 11 | */ | |
| 12 | 12 | 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; | ||
| 18 | 17 | ||
| 19 | 18 | setOpen(shouldOpen) { | |
| 20 | 19 | return new Promise(resolve => { | |
| Original file line number | Diff line number | Diff 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'; | ||
| 2 | 2 | ||
| 3 | 3 | import {Ion} from '../ion'; | |
| 4 | 4 | import {IonicApp} from '../app/app'; | |
| 5 | 5 | import {Config} from '../../config/config'; | |
| 6 | 6 | import {Platform} from '../../platform/platform'; | |
| 7 | 7 | import {Keyboard} from '../../util/keyboard'; | |
| 8 | 8 | import * as gestures from './menu-gestures'; | |
| 9 | + import {Gesture} from '../../gestures/gesture'; | ||
| 10 | + import {MenuType} from './menu-types'; | ||
| 9 | 11 | ||
| 10 | 12 | ||
| 11 | 13 | /** | |
@@ -91,13 +93,6 @@ import * as gestures from './menu-gestures'; | |||
| 91 | 93 | */ | |
| 92 | 94 | @Component({ | |
| 93 | 95 | selector: 'ion-menu', | |
| 94 | - inputs: [ | ||
| 95 | - 'content', | ||
| 96 | - 'id', | ||
| 97 | - 'side', | ||
| 98 | - 'type', | ||
| 99 | - 'maxEdgeStart' | ||
| 100 | - ], | ||
| 101 | 96 | defaultInputs: { | |
| 102 | 97 | 'side': 'left', | |
| 103 | 98 | 'menuType': 'reveal' | |
@@ -112,6 +107,22 @@ import * as gestures from './menu-gestures'; | |||
| 112 | 107 | directives: [forwardRef(() => MenuBackdrop)] | |
| 113 | 108 | }) | |
| 114 | 109 | 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; | ||
| 115 | 126 | ||
| 116 | 127 | constructor( | |
| 117 | 128 | elementRef: ElementRef, | |
@@ -122,19 +133,13 @@ export class Menu extends Ion { | |||
| 122 | 133 | private zone: NgZone | |
| 123 | 134 | ) { | |
| 124 | 135 | super(elementRef); | |
| 125 | - | ||
| 126 | - this.opening = new EventEmitter('opening'); | ||
| 127 | - this.isOpen = false; | ||
| 128 | - this._preventTime = 0; | ||
| 129 | - this.isEnabled = true; | ||
| 130 | 136 | } | |
| 131 | 137 | ||
| 132 | 138 | /** | |
| 133 | 139 | * @private | |
| 134 | 140 | */ | |
| 135 | 141 | ngOnInit() { | |
| 136 | 142 | let self = this; | |
| 137 | - | ||
| 138 | 143 | let content = self.content; | |
| 139 | 144 | self._cntEle = (content instanceof Node) ? content : content && content.getNativeElement && content.getNativeElement(); | |
| 140 | 145 | ||
@@ -390,9 +395,10 @@ export class Menu extends Ion { | |||
| 390 | 395 | /** | |
| 391 | 396 | * @private | |
| 392 | 397 | */ | |
| 393 | - static register(name, cls) { | ||
| 398 | + static register(name: string, cls: new(...args: any[]) => MenuType) { | ||
| 394 | 399 | menuTypes[name] = cls; | |
| 395 | 400 | } | |
| 401 | + //static register(name:string , cls: typeof MenuType) { | ||
| 396 | 402 | ||
| 397 | 403 | /** | |
| 398 | 404 | * @private | |
@@ -431,8 +437,8 @@ export class Menu extends Ion { | |||
| 431 | 437 | ||
| 432 | 438 | } | |
| 433 | 439 | ||
| 434 | - let menuTypes = {}; | ||
| 435 | - let menuIds = 0; | ||
| 440 | + let menuTypes:{ [name: string]: new(...args: any[]) => MenuType } = {}; | ||
| 441 | + let menuIds:number = 0; | ||
| 436 | 442 | ||
| 437 | 443 | ||
| 438 | 444 | @Directive({ | |
@@ -441,11 +447,9 @@ let menuIds = 0; | |||
| 441 | 447 | '(click)': 'clicked($event)' | |
| 442 | 448 | } | |
| 443 | 449 | }) | |
| 444 | - class MenuBackdrop { | ||
| 450 | + export class MenuBackdrop { | ||
| 445 | 451 | ||
| 446 | - constructor(@Host() menu: Menu, elementRef: ElementRef) { | ||
| 447 | - this.menu = menu; | ||
| 448 | - this.elementRef = elementRef; | ||
| 452 | + constructor(@Host() private menu: Menu, public elementRef: ElementRef) { | ||
| 449 | 453 | menu.backdrop = this; | |
| 450 | 454 | } | |
| 451 | 455 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -28,7 +28,7 @@ export class ViewController { | |||
| 28 | 28 | public id: string; | |
| 29 | 29 | private _leavingOpts: any = null; | |
| 30 | 30 | private _onDismiss: Function = null; | |
| 31 | - private _nav: NavController; | ||
| 31 | + protected _nav: NavController; | ||
| 32 | 32 | private _nbTmpRef: TemplateRef; | |
| 33 | 33 | private _nbVwRef: ViewContainerRef; | |
| 34 | 34 | private _pgRef: ElementRef; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments