mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-21 04:53:58 +08:00
chore(): fix menu types
This commit is contained in:
@ -130,7 +130,7 @@ export class Animation {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
duration(value) {
|
duration(value?: number) {
|
||||||
if (arguments.length) {
|
if (arguments.length) {
|
||||||
this._duration = value;
|
this._duration = value;
|
||||||
return this;
|
return this;
|
||||||
@ -145,7 +145,7 @@ export class Animation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
easing(name, opts) {
|
easing(name?: string, opts?: {}) {
|
||||||
if (arguments.length) {
|
if (arguments.length) {
|
||||||
this._easing = {
|
this._easing = {
|
||||||
name: name,
|
name: name,
|
||||||
@ -156,7 +156,7 @@ export class Animation {
|
|||||||
return this._easing || (this._parent && this._parent.easing());
|
return this._easing || (this._parent && this._parent.easing());
|
||||||
}
|
}
|
||||||
|
|
||||||
playbackRate(value) {
|
playbackRate(value?: number) {
|
||||||
if (arguments.length) {
|
if (arguments.length) {
|
||||||
this._rate = value;
|
this._rate = value;
|
||||||
let i;
|
let i;
|
||||||
@ -237,7 +237,7 @@ export class Animation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
play(done) {
|
play(done?: Function) {
|
||||||
const self = this;
|
const self = this;
|
||||||
|
|
||||||
// the actual play() method which may or may not start async
|
// the actual play() method which may or may not start async
|
||||||
@ -513,9 +513,9 @@ export class Animation {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
clone() {
|
clone(): Animation {
|
||||||
|
|
||||||
function copy(dest, src) {
|
function copy(dest, src): Animation {
|
||||||
// undo what stage() may have already done
|
// undo what stage() may have already done
|
||||||
assign(dest, src);
|
assign(dest, src);
|
||||||
|
|
||||||
@ -540,7 +540,7 @@ export class Animation {
|
|||||||
this._chld[i].dispose(removeElement);
|
this._chld[i].dispose(removeElement);
|
||||||
}
|
}
|
||||||
for (i = 0; i < this._ani.length; i++) {
|
for (i = 0; i < this._ani.length; i++) {
|
||||||
this._ani[i].dispose(removeElement);
|
this._ani[i].dispose();
|
||||||
}
|
}
|
||||||
if (removeElement) {
|
if (removeElement) {
|
||||||
for (i = 0; i < this._el.length; i++) {
|
for (i = 0; i < this._el.length; i++) {
|
||||||
|
@ -10,11 +10,10 @@ import {Animation} from '../../animations/animation';
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
export class MenuType {
|
export class MenuType {
|
||||||
|
open: Animation = new Animation();
|
||||||
constructor() {
|
close: Animation = new Animation();
|
||||||
this.open = new Animation();
|
isOpening: boolean;
|
||||||
this.close = new Animation();
|
seek: Animation;
|
||||||
}
|
|
||||||
|
|
||||||
setOpen(shouldOpen) {
|
setOpen(shouldOpen) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import {Component, forwardRef, Directive, Host, EventEmitter, ElementRef, NgZone} from 'angular2/core';
|
import {Component, forwardRef, Directive, Host, EventEmitter, ElementRef, NgZone, Input} from 'angular2/core';
|
||||||
|
|
||||||
import {Ion} from '../ion';
|
import {Ion} from '../ion';
|
||||||
import {IonicApp} from '../app/app';
|
import {IonicApp} from '../app/app';
|
||||||
@ -6,6 +6,8 @@ import {Config} from '../../config/config';
|
|||||||
import {Platform} from '../../platform/platform';
|
import {Platform} from '../../platform/platform';
|
||||||
import {Keyboard} from '../../util/keyboard';
|
import {Keyboard} from '../../util/keyboard';
|
||||||
import * as gestures from './menu-gestures';
|
import * as gestures from './menu-gestures';
|
||||||
|
import {Gesture} from '../../gestures/gesture';
|
||||||
|
import {MenuType} from './menu-types';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -91,13 +93,6 @@ import * as gestures from './menu-gestures';
|
|||||||
*/
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ion-menu',
|
selector: 'ion-menu',
|
||||||
inputs: [
|
|
||||||
'content',
|
|
||||||
'id',
|
|
||||||
'side',
|
|
||||||
'type',
|
|
||||||
'maxEdgeStart'
|
|
||||||
],
|
|
||||||
defaultInputs: {
|
defaultInputs: {
|
||||||
'side': 'left',
|
'side': 'left',
|
||||||
'menuType': 'reveal'
|
'menuType': 'reveal'
|
||||||
@ -112,6 +107,22 @@ import * as gestures from './menu-gestures';
|
|||||||
directives: [forwardRef(() => MenuBackdrop)]
|
directives: [forwardRef(() => MenuBackdrop)]
|
||||||
})
|
})
|
||||||
export class Menu extends Ion {
|
export class Menu extends Ion {
|
||||||
|
private _preventTime: number = 0;
|
||||||
|
private _cntEle: HTMLElement;
|
||||||
|
private _gesture: Gesture;
|
||||||
|
private _targetGesture: Gesture;
|
||||||
|
private _type: MenuType;
|
||||||
|
opening: EventEmitter<Menu> = new EventEmitter();
|
||||||
|
isOpen: boolean = false;
|
||||||
|
isEnabled: boolean = true;
|
||||||
|
backdrop: MenuBackdrop;
|
||||||
|
onContentClick: Function;
|
||||||
|
|
||||||
|
@Input() content: any;
|
||||||
|
@Input() id: string;
|
||||||
|
@Input() side: string;
|
||||||
|
@Input() type: string;
|
||||||
|
@Input() maxEdgeStart;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
elementRef: ElementRef,
|
elementRef: ElementRef,
|
||||||
@ -122,11 +133,6 @@ export class Menu extends Ion {
|
|||||||
private zone: NgZone
|
private zone: NgZone
|
||||||
) {
|
) {
|
||||||
super(elementRef);
|
super(elementRef);
|
||||||
|
|
||||||
this.opening = new EventEmitter('opening');
|
|
||||||
this.isOpen = false;
|
|
||||||
this._preventTime = 0;
|
|
||||||
this.isEnabled = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -134,7 +140,6 @@ export class Menu extends Ion {
|
|||||||
*/
|
*/
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
let self = this;
|
let self = this;
|
||||||
|
|
||||||
let content = self.content;
|
let content = self.content;
|
||||||
self._cntEle = (content instanceof Node) ? content : content && content.getNativeElement && content.getNativeElement();
|
self._cntEle = (content instanceof Node) ? content : content && content.getNativeElement && content.getNativeElement();
|
||||||
|
|
||||||
@ -390,9 +395,10 @@ export class Menu extends Ion {
|
|||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
static register(name, cls) {
|
static register(name: string, cls: new(...args: any[]) => MenuType) {
|
||||||
menuTypes[name] = cls;
|
menuTypes[name] = cls;
|
||||||
}
|
}
|
||||||
|
//static register(name:string , cls: typeof MenuType) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@ -431,8 +437,8 @@ export class Menu extends Ion {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let menuTypes = {};
|
let menuTypes:{ [name: string]: new(...args: any[]) => MenuType } = {};
|
||||||
let menuIds = 0;
|
let menuIds:number = 0;
|
||||||
|
|
||||||
|
|
||||||
@Directive({
|
@Directive({
|
||||||
@ -441,11 +447,9 @@ let menuIds = 0;
|
|||||||
'(click)': 'clicked($event)'
|
'(click)': 'clicked($event)'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
class MenuBackdrop {
|
export class MenuBackdrop {
|
||||||
|
|
||||||
constructor(@Host() menu: Menu, elementRef: ElementRef) {
|
constructor(@Host() private menu: Menu, public elementRef: ElementRef) {
|
||||||
this.menu = menu;
|
|
||||||
this.elementRef = elementRef;
|
|
||||||
menu.backdrop = this;
|
menu.backdrop = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ export class ViewController {
|
|||||||
public id: string;
|
public id: string;
|
||||||
private _leavingOpts: any = null;
|
private _leavingOpts: any = null;
|
||||||
private _onDismiss: Function = null;
|
private _onDismiss: Function = null;
|
||||||
private _nav: NavController;
|
protected _nav: NavController;
|
||||||
private _nbTmpRef: TemplateRef;
|
private _nbTmpRef: TemplateRef;
|
||||||
private _nbVwRef: ViewContainerRef;
|
private _nbVwRef: ViewContainerRef;
|
||||||
private _pgRef: ElementRef;
|
private _pgRef: ElementRef;
|
||||||
|
Reference in New Issue
Block a user