This commit is contained in:
Tim Lancina
2015-08-28 12:35:24 -07:00
parent 91bb745e50
commit 8830059b20
4 changed files with 105 additions and 9 deletions

View File

@ -67,7 +67,8 @@ export class ActionMenu extends Overlay {
* Create and open a new Action Menu. This is the * Create and open a new Action Menu. This is the
* public API, and most often you will only use ActionMenu.open() * public API, and most often you will only use ActionMenu.open()
* *
* @return Promise that resolves when the action menu is open. * @param {Object} [opts={}] TODO
* @return {Promise} Promise that resolves when the action menu is open.
*/ */
open(opts={}) { open(opts={}) {
let config = this.config; let config = this.config;
@ -85,6 +86,7 @@ export class ActionMenu extends Overlay {
/** /**
* TODO * TODO
* @returns {TODO} TODO
*/ */
get() { get() {
return Modal.getByType(OVERLAY_TYPE); return Modal.getByType(OVERLAY_TYPE);

View File

@ -4,6 +4,9 @@ import {Ion} from '../ion';
import {IonicApp} from './app'; import {IonicApp} from './app';
/**
* TODO
*/
@Directive({ @Directive({
selector: '[register]', selector: '[register]',
properties: [ properties: [
@ -15,11 +18,17 @@ import {IonicApp} from './app';
} }
}) })
export class Register { export class Register {
/**
* TODO
* @param {Object} app TODO
*/
constructor(app: IonicApp) { constructor(app: IonicApp) {
this.app = app; this.app = app;
} }
/**
* TODO
*/
onInit() { onInit() {
if (this.register && this.registerId) { if (this.register && this.registerId) {
this.app.register(this.registerId, this.register); this.app.register(this.registerId, this.register);
@ -28,7 +37,9 @@ export class Register {
} }
/**
* TODO
*/
@Directive({ @Directive({
selector: '[ref]', selector: '[ref]',
properties: [ properties: [
@ -40,11 +51,19 @@ export class Register {
}) })
export class Ref { export class Ref {
/**
* TODO
* @param {TODO} app TODO
* @param {TODO} component TODO
*/
constructor(app: IonicApp, @Self() component: any) { constructor(app: IonicApp, @Self() component: any) {
this.app = app; this.app = app;
console.log('Register on any', component) console.log('Register on any', component)
} }
/**
* TODO
*/
onInit() { onInit() {
/* /*
if (this.register && this.registerId) { if (this.register && this.registerId) {

View File

@ -2,7 +2,9 @@ import {Directive} from 'angular2/angular2';
import {IonicApp} from '../app/app'; import {IonicApp} from '../app/app';
/**
* TODO
*/
@Directive({ @Directive({
selector: '[aside-toggle]', selector: '[aside-toggle]',
host: { host: {
@ -10,12 +12,19 @@ import {IonicApp} from '../app/app';
} }
}) })
export class AsideToggle { export class AsideToggle {
/**
* TODO
* @param {IonicApp} app TODO
*/
constructor(app: IonicApp) { constructor(app: IonicApp) {
//TODO(mlynch): don't hard code this, evaluate with ref system //TODO(mlynch): don't hard code this, evaluate with ref system
this.aside = app.getComponent('menu'); this.aside = app.getComponent('menu');
} }
/**
* TODO
* @param {TODO} event TODO
*/
toggle(event) { toggle(event) {
this.aside && this.aside.toggle(); this.aside && this.aside.toggle();
} }

View File

@ -11,7 +11,6 @@ import {dom} from 'ionic/util'
/** /**
* TODO (?) add docs about how to have a root aside and a nested aside, then hide the root one * TODO (?) add docs about how to have a root aside and a nested aside, then hide the root one
*/ */
@IonicComponent({ @IonicComponent({
selector: 'ion-aside', selector: 'ion-aside',
properties: [ properties: [
@ -42,7 +41,11 @@ import {dom} from 'ionic/util'
directives: [forwardRef(() => AsideBackdrop)] directives: [forwardRef(() => AsideBackdrop)]
}) })
export class Aside extends Ion { export class Aside extends Ion {
/**
* TODO
* @param {IonicApp} app TODO
* @param {ElementRef} elementRef Reference to the element.
*/
constructor(app: IonicApp, elementRef: ElementRef, config: IonicConfig) { constructor(app: IonicApp, elementRef: ElementRef, config: IonicConfig) {
super(elementRef, config); super(elementRef, config);
@ -59,10 +62,16 @@ export class Aside extends Ion {
}) })
} }
/**
* TODO
*/
onDestroy() { onDestroy() {
app.unregister(this); app.unregister(this);
} }
/**
* TODO
*/
onInit() { onInit() {
super.onInit(); super.onInit();
this.contentElement = (this.content instanceof Node) ? this.content : this.content.getNativeElement(); this.contentElement = (this.content instanceof Node) ? this.content : this.content.getNativeElement();
@ -71,28 +80,52 @@ export class Aside extends Ion {
this.typeDelegate = this.getDelegate('type'); this.typeDelegate = this.getDelegate('type');
} }
/**
* TODO
* @return {Element} The Aside's content element.
*/
getContentElement() { getContentElement() {
return this.contentElement; return this.contentElement;
} }
/**
* TODO
* @param {TODO} v TODO
*/
setOpenAmt(v) { setOpenAmt(v) {
this.opening.next(v); this.opening.next(v);
} }
/**
* TODO
* @param {boolean} willOpen TODO
*/
setDoneTransforming(willOpen) { setDoneTransforming(willOpen) {
this.typeDelegate.setDoneTransforming(willOpen); this.typeDelegate.setDoneTransforming(willOpen);
} }
/**
* TODO
* @param {TODO} transform TODO
*/
setTransform(transform) { setTransform(transform) {
this.typeDelegate.setTransform(transform) this.typeDelegate.setTransform(transform)
} }
/**
* TODO
* @param {boolean} isSliding TODO
*/
setSliding(isSliding) { setSliding(isSliding) {
if (isSliding !== this.isSliding) { if (isSliding !== this.isSliding) {
this.typeDelegate.setSliding(isSliding) this.typeDelegate.setSliding(isSliding)
} }
} }
/**
* TODO
* @param {boolean} isChanging TODO
*/
setChanging(isChanging) { setChanging(isChanging) {
if (isChanging !== this.isChanging) { if (isChanging !== this.isChanging) {
this.isChanging = isChanging this.isChanging = isChanging
@ -100,6 +133,11 @@ export class Aside extends Ion {
} }
} }
/**
* Sets the state of the Aside to open or not.
* @param {boolean} isOpen If the Aside is open or not.
* @return {Promise} TODO
*/
setOpen(isOpen) { setOpen(isOpen) {
if (isOpen !== this.isOpen) { if (isOpen !== this.isOpen) {
this.isOpen = isOpen this.isOpen = isOpen
@ -114,21 +152,35 @@ export class Aside extends Ion {
} }
} }
/**
* TODO
* @return {TODO} TODO
*/
open() { open() {
return this.setOpen(true); return this.setOpen(true);
} }
/**
* TODO
* @return {TODO} TODO
*/
close() { close() {
return this.setOpen(false); return this.setOpen(false);
} }
/**
* TODO
* @return {TODO} TODO
*/
toggle() { toggle() {
return this.setOpen(!this.isOpen); return this.setOpen(!this.isOpen);
} }
} }
/**
* TODO
*/
@Component({ @Component({
selector: 'ion-aside-backdrop', selector: 'ion-aside-backdrop',
host: { host: {
@ -138,11 +190,16 @@ export class Aside extends Ion {
'(click)': 'clicked($event)' '(click)': 'clicked($event)'
} }
}) })
@View({ @View({
template: '' template: ''
}) })
export class AsideBackdrop extends Ion { export class AsideBackdrop extends Ion {
/**
* TODO
* @param {ElementReg} elementRef TODO
* @param {IonicConfig} config TODO
* @param {Aside} aside TODO
*/
constructor(elementRef: ElementRef, config: IonicConfig, @Host() aside: Aside) { constructor(elementRef: ElementRef, config: IonicConfig, @Host() aside: Aside) {
super(elementRef, config); super(elementRef, config);
@ -152,12 +209,21 @@ export class AsideBackdrop extends Ion {
this.backgroundColor = 'rgba(0,0,0,0)'; this.backgroundColor = 'rgba(0,0,0,0)';
} }
/**
* TODO
*/
onInit() { onInit() {
let ww = window.innerWidth; let ww = window.innerWidth;
let wh = window.innerHeight; let wh = window.innerHeight;
this.width = ww + 'px'; this.width = ww + 'px';
this.height = wh + 'px'; this.height = wh + 'px';
} }
/**
* TODO
* @param {TODO} event TODO
*/
clicked(event) { clicked(event) {
this.aside.close(); this.aside.close();
} }