chore(): make members private

This commit is contained in:
Adam Bradley
2015-11-15 20:37:24 -06:00
parent 9ef27f8c56
commit 13fa14dff6
24 changed files with 301 additions and 140 deletions

View File

@ -39,10 +39,16 @@ export class IdRef {
this.component = appViewManager.getComponent(elementRef); this.component = appViewManager.getComponent(elementRef);
} }
/**
* @private
*/
onInit() { onInit() {
this.app.register(this.id, this.component); this.app.register(this.id, this.component);
} }
/**
* @private
*/
onDestroy() { onDestroy() {
this.app.unregister(this.id); this.app.unregister(this.id);
} }
@ -55,6 +61,10 @@ export class IdRef {
}) })
export class Attr { export class Attr {
constructor(private renderer: Renderer, private elementRef: ElementRef) {} constructor(private renderer: Renderer, private elementRef: ElementRef) {}
/**
* @private
*/
onInit() { onInit() {
this.renderer.setElementAttribute(this.elementRef, this.attr, ''); this.renderer.setElementAttribute(this.elementRef, this.attr, '');
} }

View File

@ -61,9 +61,6 @@ export class Checkbox {
if (ngControl) ngControl.valueAccessor = this; if (ngControl) ngControl.valueAccessor = this;
} }
/**
* TODO
*/
onInit() { onInit() {
this.labelId = 'label-' + this.inputId; this.labelId = 'label-' + this.inputId;
} }
@ -78,6 +75,7 @@ export class Checkbox {
} }
/** /**
* @private
* Click event handler to toggle the checkbox checked state. * Click event handler to toggle the checkbox checked state.
* @param {MouseEvent} ev The click event. * @param {MouseEvent} ev The click event.
*/ */
@ -114,6 +112,9 @@ export class Checkbox {
*/ */
registerOnTouched(fn) { this.onTouched = fn; } registerOnTouched(fn) { this.onTouched = fn; }
/**
* @private
*/
onDestroy() { onDestroy() {
this.form.deregister(this); this.form.deregister(this);
} }

View File

@ -47,7 +47,6 @@ export class Content extends Ion {
} }
/** /**
* TODO
* @private * @private
*/ */
onInit() { onInit() {
@ -132,6 +131,7 @@ export class Content extends Ion {
} }
/** /**
* @private
* Returns the content and scroll elements' dimensions. * Returns the content and scroll elements' dimensions.
* @returns {Object} dimensions The content and scroll elements' dimensions * @returns {Object} dimensions The content and scroll elements' dimensions
* {Number} dimensions.contentHeight content offsetHeight * {Number} dimensions.contentHeight content offsetHeight
@ -146,7 +146,6 @@ export class Content extends Ion {
* {Number} dimensions.scrollWidth scroll scrollWidth * {Number} dimensions.scrollWidth scroll scrollWidth
* {Number} dimensions.scrollLeft scroll scrollLeft * {Number} dimensions.scrollLeft scroll scrollLeft
* {Number} dimensions.scrollRight scroll scrollLeft + scrollWidth * {Number} dimensions.scrollRight scroll scrollLeft + scrollWidth
* TODO: figure out how to get this to work
*/ */
getDimensions() { getDimensions() {
let scrollElement = this.scrollElement; let scrollElement = this.scrollElement;

View File

@ -22,14 +22,15 @@ export class Icon {
config: Config, config: Config,
private renderer: Renderer private renderer: Renderer
) { ) {
this.eleRef = elementRef;
this.config = config; this.config = config;
this.mode = config.get('iconMode'); this.mode = config.get('iconMode');
} }
/**
* @private
*/
onInit() { onInit() {
let ele = this.eleRef.nativeElement; let ele = this.elementRef.nativeElement;
if (this.mode == 'ios' && this.ios) { if (this.mode == 'ios' && this.ios) {
this.name = this.ios; this.name = this.ios;
@ -59,15 +60,24 @@ export class Icon {
this.update(); this.update();
} }
/**
* @private
*/
get isActive() { get isActive() {
return (this._isActive === undefined || this._isActive === true || this._isActive === 'true'); return (this._isActive === undefined || this._isActive === true || this._isActive === 'true');
} }
/**
* @private
*/
set isActive(val) { set isActive(val) {
this._isActive = val; this._isActive = val;
this.update(); this.update();
} }
/**
* @private
*/
update() { update() {
if (this.name && this.mode == 'ios') { if (this.name && this.mode == 'ios') {

View File

@ -4,7 +4,6 @@ import {List} from '../list/list';
/** /**
* @name ionItem
* @description * @description
* Creates a list-item that can easily be swiped, * Creates a list-item that can easily be swiped,
* deleted, reordered, edited, and more. * deleted, reordered, edited, and more.

View File

@ -35,6 +35,9 @@ export class List extends Ion {
this.ele = elementRef.nativeElement; this.ele = elementRef.nativeElement;
} }
/**
* @private
*/
onInit() { onInit() {
super.onInit(); super.onInit();
@ -46,6 +49,9 @@ export class List extends Ion {
} }
} }
/**
* @private
*/
onDestroy() { onDestroy() {
this.ele = null; this.ele = null;
this.slidingGesture && this.slidingGesture.unlisten(); this.slidingGesture && this.slidingGesture.unlisten();
@ -53,7 +59,6 @@ export class List extends Ion {
/** /**
* @private * @private
* TODO
*/ */
_initVirtualScrolling() { _initVirtualScrolling() {
if(!this.content) { if(!this.content) {
@ -64,8 +69,7 @@ export class List extends Ion {
} }
/** /**
* TODO * @private
* @param {TODO} item TODO
*/ */
setItemTemplate(item) { setItemTemplate(item) {
this.itemTemplate = item; this.itemTemplate = item;
@ -92,6 +96,9 @@ export class List extends Ion {
this.slidingGesture && this.slidingGesture.closeOpened(); this.slidingGesture && this.slidingGesture.closeOpened();
} }
/**
* @private
*/
afterViewInit() { afterViewInit() {
this._init = true; this._init = true;
if (this._enableSliding) { if (this._enableSliding) {
@ -100,9 +107,7 @@ export class List extends Ion {
} }
} }
/**
* TODO
*/
@Directive({ @Directive({
selector: 'ion-header', selector: 'ion-header',
inputs: [ inputs: [

View File

@ -123,6 +123,9 @@ export class Menu extends Ion {
}; };
} }
/**
* @private
*/
_initGesture() { _initGesture() {
switch(this.side) { switch(this.side) {
case 'right': case 'right':
@ -136,6 +139,9 @@ export class Menu extends Ion {
this._targetGesture = new gestures.TargetGesture(this); this._targetGesture = new gestures.TargetGesture(this);
} }
/**
* @private
*/
_initType(type) { _initType(type) {
type = type && type.trim().toLowerCase(); type = type && type.trim().toLowerCase();
if (!type) { if (!type) {
@ -170,6 +176,9 @@ export class Menu extends Ion {
}); });
} }
/**
* @private
*/
setProgressStart() { setProgressStart() {
// user started swiping the menu open/close // user started swiping the menu open/close
if (this._isPrevented() || !this.isEnabled) return; if (this._isPrevented() || !this.isEnabled) return;
@ -179,6 +188,9 @@ export class Menu extends Ion {
this._type.setProgressStart(this.isOpen); this._type.setProgressStart(this.isOpen);
} }
/**
* @private
*/
setProgess(value) { setProgess(value) {
// user actively dragging the menu // user actively dragging the menu
if (this.isEnabled) { if (this.isEnabled) {
@ -188,6 +200,9 @@ export class Menu extends Ion {
} }
} }
/**
* @private
*/
setProgressEnd(shouldComplete) { setProgressEnd(shouldComplete) {
// user has finished dragging the menu // user has finished dragging the menu
if (this.isEnabled) { if (this.isEnabled) {
@ -199,6 +214,9 @@ export class Menu extends Ion {
} }
} }
/**
* @private
*/
_before() { _before() {
// this places the menu into the correct location before it animates in // this places the menu into the correct location before it animates in
// this css class doesn't actually kick off any animations // this css class doesn't actually kick off any animations
@ -212,6 +230,9 @@ export class Menu extends Ion {
} }
} }
/**
* @private
*/
_after(isOpen) { _after(isOpen) {
// keep opening/closing the menu disabled for a touch more yet // keep opening/closing the menu disabled for a touch more yet
if (this.isEnabled) { if (this.isEnabled) {
@ -233,12 +254,18 @@ export class Menu extends Ion {
} }
} }
/**
* @private
*/
_prevent() { _prevent() {
// used to prevent unwanted opening/closing after swiping open/close // used to prevent unwanted opening/closing after swiping open/close
// or swiping open the menu while pressing down on the menu-toggle // or swiping open the menu while pressing down on the menu-toggle
this._preventTime = Date.now() + 20; this._preventTime = Date.now() + 20;
} }
/**
* @private
*/
_isPrevented() { _isPrevented() {
return this._preventTime > Date.now(); return this._preventTime > Date.now();
} }
@ -267,29 +294,29 @@ export class Menu extends Ion {
return this.setOpen(!this.isOpen); return this.setOpen(!this.isOpen);
} }
/**
* @private
*/
enable(shouldEnable) { enable(shouldEnable) {
this.isEnabled = shouldEnable; this.isEnabled = shouldEnable;
} }
/** /**
* TODO * @private
* @return {Element} The Menu element.
*/ */
getMenuElement() { getMenuElement() {
return this.getNativeElement(); return this.getNativeElement();
} }
/** /**
* TODO * @private
* @return {Element} The Menu's associated content element.
*/ */
getContentElement() { getContentElement() {
return this._cntEle; return this._cntEle;
} }
/** /**
* TODO * @private
* @return {Element} The Menu's backdrop element.
*/ */
getBackdropElement() { getBackdropElement() {
return this.backdrop.elementRef.nativeElement; return this.backdrop.elementRef.nativeElement;
@ -299,6 +326,9 @@ export class Menu extends Ion {
menuTypes[name] = cls; menuTypes[name] = cls;
} }
/**
* @private
*/
onDestroy() { onDestroy() {
this.app.unregister(this.id); this.app.unregister(this.id);
this._gesture && this._gesture.destroy(); this._gesture && this._gesture.destroy();
@ -312,9 +342,6 @@ export class Menu extends Ion {
let menuTypes = {}; let menuTypes = {};
/**
* TODO
*/
@Directive({ @Directive({
selector: 'backdrop', selector: 'backdrop',
host: { host: {
@ -322,10 +349,7 @@ let menuTypes = {};
} }
}) })
class MenuBackdrop { class MenuBackdrop {
/**
* TODO
* @param {Menu} menu TODO
*/
constructor(@Host() menu: Menu, elementRef: ElementRef) { constructor(@Host() menu: Menu, elementRef: ElementRef) {
this.menu = menu; this.menu = menu;
this.elementRef = elementRef; this.elementRef = elementRef;
@ -333,8 +357,7 @@ class MenuBackdrop {
} }
/** /**
* TODO * @private
* @param {TODO} event TODO
*/ */
clicked(ev) { clicked(ev) {
console.debug('backdrop clicked') console.debug('backdrop clicked')

View File

@ -130,6 +130,9 @@ export class Nav extends NavController {
} }
} }
/**
* @private
*/
onInit() { onInit() {
super.onInit(); super.onInit();

View File

@ -88,6 +88,7 @@ class ToolbarBackground {
directives: [BackButton, BackButtonText, Icon, ToolbarBackground] directives: [BackButton, BackButtonText, Icon, ToolbarBackground]
}) })
export class Navbar extends ToolbarBase { export class Navbar extends ToolbarBase {
constructor( constructor(
app: IonicApp, app: IonicApp,
@Optional() viewCtrl: ViewController, @Optional() viewCtrl: ViewController,
@ -110,6 +111,9 @@ export class Navbar extends ToolbarBase {
this.bbDefault = config.get('backButtonText'); this.bbDefault = config.get('backButtonText');
} }
/**
* @private
*/
onInit() { onInit() {
super.onInit(); super.onInit();
let hideBackButton = this.hideBackButton; let hideBackButton = this.hideBackButton;
@ -122,34 +126,58 @@ export class Navbar extends ToolbarBase {
} }
} }
/**
* @private
*/
getBackButtonRef() { getBackButtonRef() {
return this.bbRef; return this.bbRef;
} }
/**
* @private
*/
setBackButtonRef(backButtonElementRef) { setBackButtonRef(backButtonElementRef) {
this.bbRef = backButtonElementRef; this.bbRef = backButtonElementRef;
} }
/**
* @private
*/
getBackButtonTextRef() { getBackButtonTextRef() {
return this.bbtRef; return this.bbtRef;
} }
/**
* @private
*/
setBackButtonTextRef(backButtonTextElementRef) { setBackButtonTextRef(backButtonTextElementRef) {
this.bbtRef = backButtonTextElementRef; this.bbtRef = backButtonTextElementRef;
} }
/**
* @private
*/
setBackgroundRef(backgrouneElementRef) { setBackgroundRef(backgrouneElementRef) {
this.bgRef = backgrouneElementRef; this.bgRef = backgrouneElementRef;
} }
/**
* @private
*/
getBackgroundRef() { getBackgroundRef() {
return this.bgRef; return this.bgRef;
} }
/**
* @private
*/
didEnter() { didEnter() {
this.app.setTitle(this.getTitleText()); this.app.setTitle(this.getTitleText());
} }
/**
* @private
*/
setHidden(isHidden) { setHidden(isHidden) {
this._hidden = isHidden this._hidden = isHidden
} }
@ -157,10 +185,11 @@ export class Navbar extends ToolbarBase {
} }
/* /**
Used to find and register headers in a view, and this directive's * @private
content will be moved up to the common navbar location, and created * Used to find and register headers in a view, and this directive's
using the same context as the view's content area. * content will be moved up to the common navbar location, and created
* using the same context as the view's content area.
*/ */
@Directive({ @Directive({
selector: 'template[navbar]' selector: 'template[navbar]'

View File

@ -3,6 +3,9 @@ import {Component, ElementRef, DynamicComponentLoader} from 'angular2/angular2';
import {OverlayController} from './overlay-controller'; import {OverlayController} from './overlay-controller';
/**
* @private
*/
@Component({ @Component({
selector: 'ion-overlay', selector: 'ion-overlay',
template: '<template #contents></template>' template: '<template #contents></template>'

View File

@ -41,7 +41,6 @@ import {ListHeader} from '../list/list';
* </ion-radio-group> * </ion-radio-group>
* ``` * ```
*/ */
@Directive({ @Directive({
selector: 'ion-radio-group', selector: 'ion-radio-group',
host: { host: {
@ -54,13 +53,6 @@ import {ListHeader} from '../list/list';
export class RadioGroup extends Ion { export class RadioGroup extends Ion {
radios: Array<RadioButton> = []; radios: Array<RadioButton> = [];
/**
* TODO
* @param {ElementRef} elementRef TODO
* @param {Config} config TODO
* @param {NgControl=} ngControl TODO
* @param {QueryList<ListHeader>} headerQuery TODO
*/
constructor( constructor(
elementRef: ElementRef, elementRef: ElementRef,
config: Config, config: Config,
@ -77,6 +69,9 @@ export class RadioGroup extends Ion {
if (ngControl) ngControl.valueAccessor = this; if (ngControl) ngControl.valueAccessor = this;
} }
/**
* @private
*/
onInit() { onInit() {
let header = this.headerQuery.first; let header = this.headerQuery.first;
if (header) { if (header) {
@ -88,6 +83,7 @@ export class RadioGroup extends Ion {
} }
/** /**
* @private
* Register the specified radio button with the radio group. * Register the specified radio button with the radio group.
* @param {RadioButton} radio The radio button to register. * @param {RadioButton} radio The radio button to register.
*/ */
@ -102,6 +98,7 @@ export class RadioGroup extends Ion {
} }
/** /**
* @private
* Update which radio button in the group is checked, unchecking all others. * Update which radio button in the group is checked, unchecking all others.
* @param {RadioButton} checkedRadio The radio button to check. * @param {RadioButton} checkedRadio The radio button to check.
*/ */
@ -147,8 +144,8 @@ export class RadioGroup extends Ion {
registerOnTouched(fn) { this.onTouched = fn; } registerOnTouched(fn) { this.onTouched = fn; }
} }
/** /**
* @name ionRadio
* @description * @description
* A single radio component. * A single radio component.
* *
@ -192,12 +189,7 @@ export class RadioGroup extends Ion {
'</div>' '</div>'
}) })
export class RadioButton extends Ion { export class RadioButton extends Ion {
/**
* Radio button constructor.
* @param {RadioGroup=} group The parent radio group, if any.
* @param {ElementRef} elementRef TODO
* @param {Config} config TODO
*/
constructor( constructor(
@Host() @Optional() group: RadioGroup, @Host() @Optional() group: RadioGroup,
elementRef: ElementRef, elementRef: ElementRef,
@ -209,12 +201,18 @@ export class RadioButton extends Ion {
this.tabIndex = 0; this.tabIndex = 0;
} }
/**
* @private
*/
onInit() { onInit() {
super.onInit(); super.onInit();
this.group.registerRadio(this); this.group.registerRadio(this);
this.labelId = 'label-' + this.id; this.labelId = 'label-' + this.id;
} }
/**
* @private
*/
click(ev) { click(ev) {
ev.preventDefault(); ev.preventDefault();
ev.stopPropagation(); ev.stopPropagation();

View File

@ -29,11 +29,7 @@ import * as util from 'ionic/util';
'</scroll-content>' '</scroll-content>'
}) })
export class Scroll extends Ion { export class Scroll extends Ion {
/**
* TODO
* @param {ElementRef} elementRef TODO
* @param {Config} config TODO
*/
constructor(elementRef: ElementRef, Config: Config) { constructor(elementRef: ElementRef, Config: Config) {
super(elementRef, Config); super(elementRef, Config);
@ -41,6 +37,9 @@ export class Scroll extends Ion {
this.zoomDuration = 250; this.zoomDuration = 250;
} }
/**
* @private
*/
onInit() { onInit() {
this.scrollElement = this.getNativeElement().children[0]; this.scrollElement = this.getNativeElement().children[0];
} }
@ -60,4 +59,5 @@ export class Scroll extends Ion {
this.scrollElement.removeEventListener('scroll', handler); this.scrollElement.removeEventListener('scroll', handler);
} }
} }
} }

View File

@ -6,7 +6,6 @@ import {ConfigComponent} from '../../config/decorators';
import {Icon} from '../icon/icon'; import {Icon} from '../icon/icon';
/** /**
* @name Search Bar
* @description * @description
* The Search Bar service adds an input field which can be used to search or filter items. * The Search Bar service adds an input field which can be used to search or filter items.
* *
@ -42,14 +41,12 @@ import {Icon} from '../icon/icon';
'<button *ng-if="showCancel" (click)="cancelAction($event, query)" class="searchbar-cancel">{{cancelText}}</button>', '<button *ng-if="showCancel" (click)="cancelAction($event, query)" class="searchbar-cancel">{{cancelText}}</button>',
directives: [FORM_DIRECTIVES, NgIf, NgClass, Icon] directives: [FORM_DIRECTIVES, NgIf, NgClass, Icon]
}) })
export class SearchBar extends Ion { export class SearchBar extends Ion {
query: string;
/** /**
* TODO * @private
* @param {ElementRef} elementRef TODO
* @param {Config} config TODO
*/ */
query: string;
constructor( constructor(
elementRef: ElementRef, elementRef: ElementRef,
config: Config, config: Config,
@ -68,7 +65,9 @@ export class SearchBar extends Ion {
this.ngControl.valueAccessor = this; this.ngControl.valueAccessor = this;
} }
// Add the margin for iOS /**
* @private
*/
afterViewInit() { afterViewInit() {
this.cancelButton = this.elementRef.nativeElement.querySelector('.searchbar-cancel'); this.cancelButton = this.elementRef.nativeElement.querySelector('.searchbar-cancel');
@ -83,6 +82,7 @@ export class SearchBar extends Ion {
} }
/** /**
* @private
* Much like ngModel, this is called from our valueAccessor for the attached * Much like ngModel, this is called from our valueAccessor for the attached
* ControlDirective to update the value internally. * ControlDirective to update the value internally.
*/ */
@ -90,19 +90,31 @@ export class SearchBar extends Ion {
this.query = value; this.query = value;
} }
/**
* @private
*/
registerOnChange(fn) { registerOnChange(fn) {
this.onChange = fn; this.onChange = fn;
} }
/**
* @private
*/
registerOnTouched(fn) { registerOnTouched(fn) {
this.onTouched = fn; this.onTouched = fn;
} }
/**
* @private
*/
inputChanged(event) { inputChanged(event) {
this.writeValue(event.target.value); this.writeValue(event.target.value);
this.onChange(event.target.value); this.onChange(event.target.value);
} }
/**
* @private
*/
inputFocused() { inputFocused() {
this.isFocused = true; this.isFocused = true;
this.shouldLeftAlign = true; this.shouldLeftAlign = true;
@ -112,6 +124,9 @@ export class SearchBar extends Ion {
} }
} }
/**
* @private
*/
inputBlurred() { inputBlurred() {
this.isFocused = false; this.isFocused = false;
this.shouldLeftAlign = this.ngControl.value && this.ngControl.value.trim() != ''; this.shouldLeftAlign = this.ngControl.value && this.ngControl.value.trim() != '';
@ -126,25 +141,3 @@ export class SearchBar extends Ion {
this.onChange(''); this.onChange('');
} }
} }
/*
export class SearchPipe extends Pipe {
constructor() {
super();
this.state = 0;
}
supports(newValue) {
return true;
}
transform(value, ...args) {
return value;
//return `${value} state:${this.state ++}`;
}
create(cdRef) {
return new SearchPipe(cdRef);
}
}
*/

View File

@ -3,8 +3,8 @@ import {Directive, Renderer, ElementRef, Host, Optional, NgControl} from 'angula
import {Ion} from '../ion'; import {Ion} from '../ion';
import {Config} from '../../config/config'; import {Config} from '../../config/config';
/** /**
* @name Segment
* @description * @description
* A Segment is a group of buttons, sometimes known as Segmented Controls, that allow the user to interact with a compact group of a number of controls. * A Segment is a group of buttons, sometimes known as Segmented Controls, that allow the user to interact with a compact group of a number of controls.
* *
@ -41,14 +41,11 @@ import {Config} from '../../config/config';
selector: 'ion-segment' selector: 'ion-segment'
}) })
export class Segment extends Ion { export class Segment extends Ion {
/**
* @private
*/
buttons: Array<SegmentButton> = []; buttons: Array<SegmentButton> = [];
/**
* TODO
* @param {NgControl} ngControl TODO
* @param {ElementRef} elementRef TODO
* @param {Config} config TODO
*/
constructor( constructor(
@Optional() ngControl: NgControl, @Optional() ngControl: NgControl,
elementRef: ElementRef, elementRef: ElementRef,
@ -62,15 +59,25 @@ export class Segment extends Ion {
if (ngControl) ngControl.valueAccessor = this; if (ngControl) ngControl.valueAccessor = this;
} }
/**
* @private
*/
writeValue(value) { writeValue(value) {
this.value = !value ? '' : value; this.value = !value ? '' : value;
} }
/**
* @private
*/
registerOnChange(fn) { this.onChange = fn; } registerOnChange(fn) { this.onChange = fn; }
/**
* @private
*/
registerOnTouched(fn) { this.onTouched = fn; } registerOnTouched(fn) { this.onTouched = fn; }
/** /**
* @private
* Called by child SegmentButtons to bind themselves to * Called by child SegmentButtons to bind themselves to
* the Segment. * the Segment.
* @param {SegmentButton} segmentButton The child SegmentButton to register. * @param {SegmentButton} segmentButton The child SegmentButton to register.
@ -86,6 +93,7 @@ export class Segment extends Ion {
} }
/** /**
* @private
* Select the button with the given value. * Select the button with the given value.
* @param {string} value Value of the button to select. * @param {string} value Value of the button to select.
*/ */
@ -101,6 +109,7 @@ export class Segment extends Ion {
} }
/** /**
* @private
* Indicate a button should be selected. * Indicate a button should be selected.
* @param {SegmentButton} segmentButton The button to select. * @param {SegmentButton} segmentButton The button to select.
*/ */
@ -115,9 +124,7 @@ export class Segment extends Ion {
} }
} }
/**
* TODO
*/
@Directive({ @Directive({
selector: 'ion-segment-button', selector: 'ion-segment-button',
inputs: [ inputs: [
@ -129,11 +136,7 @@ export class Segment extends Ion {
} }
}) })
export class SegmentButton { export class SegmentButton {
/**
* TODO
* @param {Segment} segment TODO
* @param {ElementRef} elementRef TODO
*/
constructor( constructor(
@Host() segment: Segment, @Host() segment: Segment,
elementRef: ElementRef, elementRef: ElementRef,
@ -145,10 +148,16 @@ export class SegmentButton {
renderer.setElementAttribute(elementRef, 'outline', ''); renderer.setElementAttribute(elementRef, 'outline', '');
} }
/**
* @private
*/
onInit() { onInit() {
this.segment.register(this); this.segment.register(this);
} }
/**
* @private
*/
click(event) { click(event) {
this.segment.selected(this, event); this.segment.selected(this, event);
} }

View File

@ -61,11 +61,7 @@ class DisplayWhen {
} }
}) })
export class ShowWhen extends DisplayWhen { export class ShowWhen extends DisplayWhen {
/**
* TODO
* @param {string} showWhen The value of the element's 'show-when' attribute
* @param {NgZone} ngZone TODO
*/
constructor( constructor(
@Attribute('show-when') showWhen: string, @Attribute('show-when') showWhen: string,
platform: Platform, platform: Platform,
@ -74,6 +70,9 @@ export class ShowWhen extends DisplayWhen {
super(showWhen, platform, ngZone); super(showWhen, platform, ngZone);
} }
/**
* @private
*/
get hidden() { get hidden() {
return !this.isMatch; return !this.isMatch;
} }
@ -90,11 +89,7 @@ export class ShowWhen extends DisplayWhen {
} }
}) })
export class HideWhen extends DisplayWhen { export class HideWhen extends DisplayWhen {
/**
* TODO
* @param {string} showWhen The value of the element's 'hide-when' attribute
* @param {NgZone} ngZone TODO
*/
constructor( constructor(
@Attribute('hide-when') hideWhen: string, @Attribute('hide-when') hideWhen: string,
platform: Platform, platform: Platform,
@ -103,6 +98,9 @@ export class HideWhen extends DisplayWhen {
super(hideWhen, platform, ngZone); super(hideWhen, platform, ngZone);
} }
/**
* @private
*/
get hidden() { get hidden() {
return this.isMatch; return this.isMatch;
} }

View File

@ -4,8 +4,8 @@ import {Form} from '../../util/form';
import {Config} from '../../config/config'; import {Config} from '../../config/config';
import {pointerCoord} from '../../util/dom'; import {pointerCoord} from '../../util/dom';
/** /**
* @name mediaSwitch
* @private * @private
*/ */
@Directive({ @Directive({
@ -99,12 +99,7 @@ class MediaSwitch {
directives: [MediaSwitch] directives: [MediaSwitch]
}) })
export class Switch { export class Switch {
/**
* TODO
* @param {ElementRef} elementRef TODO
* @param {Config} config TODO
* @param {NgControl=} ngControl TODO
*/
constructor( constructor(
form: Form, form: Form,
elementRef: ElementRef, elementRef: ElementRef,
@ -157,6 +152,9 @@ export class Switch {
}; };
} }
/**
* @private
*/
onInit() { onInit() {
this.labelId = 'label-' + this.inputId; this.labelId = 'label-' + this.inputId;
} }
@ -177,10 +175,16 @@ export class Switch {
this.check(!this.checked); this.check(!this.checked);
} }
/**
* @private
*/
writeValue(value) { writeValue(value) {
this.checked = value; this.checked = value;
} }
/**
* @private
*/
pointerDown(ev) { pointerDown(ev) {
if (/touch/.test(ev.type)) { if (/touch/.test(ev.type)) {
this.lastTouch = Date.now(); this.lastTouch = Date.now();
@ -196,6 +200,9 @@ export class Switch {
this.isActivated = true; this.isActivated = true;
} }
/**
* @private
*/
pointerUp(ev) { pointerUp(ev) {
if (this.isDisabled(ev)) return; if (this.isDisabled(ev)) return;
@ -213,18 +220,28 @@ export class Switch {
this.isActivated = false; this.isActivated = false;
} }
// Used by the view to update the model (Control) /**
// Up to us to call it in update() * @private
*/
registerOnChange(fn) { this.onChange = fn; } registerOnChange(fn) { this.onChange = fn; }
/**
* @private
*/
registerOnTouched(fn) { this.onTouched = fn; } registerOnTouched(fn) { this.onTouched = fn; }
/**
* @private
*/
onDestroy() { onDestroy() {
this.removeMoveListener(); this.removeMoveListener();
this.switchEle = this.addMoveListener = this.removeMoveListener = null; this.switchEle = this.addMoveListener = this.removeMoveListener = null;
this.form.deregister(this); this.form.deregister(this);
} }
/**
* @private
*/
isDisabled(ev) { isDisabled(ev) {
return (this.lastTouch + 999 > Date.now() && /mouse/.test(ev.type)) || (this.mode == 'ios' && ev.target.tagName == 'ION-SWITCH'); return (this.lastTouch + 999 > Date.now() && /mouse/.test(ev.type)) || (this.mode == 'ios' && ev.target.tagName == 'ION-SWITCH');
} }

View File

@ -85,6 +85,9 @@ export class Tab extends NavController {
this._isInitial = tabs.add(this); this._isInitial = tabs.add(this);
} }
/**
* @private
*/
onInit() { onInit() {
if (this._isInitial) { if (this._isInitial) {
this.tabs.select(this); this.tabs.select(this);
@ -104,6 +107,9 @@ export class Tab extends NavController {
} }
} }
/**
* @private
*/
load(opts, done) { load(opts, done) {
if (!this._loaded && this.root) { if (!this._loaded && this.root) {
this.push(this.root, null, opts).then(done); this.push(this.root, null, opts).then(done);
@ -114,6 +120,9 @@ export class Tab extends NavController {
} }
} }
/**
* @private
*/
loadPage(viewCtrl, navbarContainerRef, done) { loadPage(viewCtrl, navbarContainerRef, done) {
// by default a page's navbar goes into the shared tab's navbar section // by default a page's navbar goes into the shared tab's navbar section
navbarContainerRef = this.tabs.navbarContainerRef; navbarContainerRef = this.tabs.navbarContainerRef;
@ -138,6 +147,9 @@ export class Tab extends NavController {
this.hideNavbars(!isSelected); this.hideNavbars(!isSelected);
} }
/**
* @private
*/
hideNavbars(shouldHideNavbars) { hideNavbars(shouldHideNavbars) {
this._views.forEach(viewCtrl => { this._views.forEach(viewCtrl => {
let navbar = viewCtrl.getNavbar(); let navbar = viewCtrl.getNavbar();

View File

@ -134,6 +134,9 @@ export class Tabs extends Ion {
} }
} }
/**
* @private
*/
onInit() { onInit() {
super.onInit(); super.onInit();
if (this.highlight) { if (this.highlight) {

View File

@ -16,6 +16,9 @@ let win = null;
let doc = null; let doc = null;
/**
* @private
*/
export function initTapClick(windowInstance, documentInstance, appInstance, config, fastdom) { export function initTapClick(windowInstance, documentInstance, appInstance, config, fastdom) {
win = windowInstance; win = windowInstance;
doc = documentInstance; doc = documentInstance;
@ -185,6 +188,9 @@ function getActivatableTarget(ele) {
return null; return null;
} }
/**
* @private
*/
export function isActivatable(ele) { export function isActivatable(ele) {
if (ACTIVATABLE_ELEMENTS.test(ele.tagName)) { if (ACTIVATABLE_ELEMENTS.test(ele.tagName)) {
return true; return true;

View File

@ -4,9 +4,7 @@ import {Config} from '../../config/config';
import {TextInput} from './text-input'; import {TextInput} from './text-input';
import {pointerCoord, hasPointerMoved} from '../../util/dom'; import {pointerCoord, hasPointerMoved} from '../../util/dom';
/**
* TODO
*/
@Directive({ @Directive({
selector: 'ion-label', selector: 'ion-label',
inputs: [ inputs: [
@ -21,10 +19,7 @@ import {pointerCoord, hasPointerMoved} from '../../util/dom';
} }
}) })
export class Label { export class Label {
/**
* TODO
* @param {Config} config
*/
constructor(config: Config, @Optional() container: TextInput) { constructor(config: Config, @Optional() container: TextInput) {
this.scrollAssist = config.get('scrollAssist'); this.scrollAssist = config.get('scrollAssist');
if (!this.id) { if (!this.id) {
@ -35,8 +30,7 @@ export class Label {
} }
/** /**
* TODO * @private
* @param {TODO} ev TODO
*/ */
pointerStart(ev) { pointerStart(ev) {
if (this.scrollAssist) { if (this.scrollAssist) {
@ -46,8 +40,7 @@ export class Label {
} }
/** /**
* TODO * @private
* @param {TODO} ev TODO
*/ */
pointerEnd(ev) { pointerEnd(ev) {
if (this.container) { if (this.container) {

View File

@ -55,15 +55,24 @@ export class TextInput {
this.keyboardHeight = config.get('keyboardHeight'); this.keyboardHeight = config.get('keyboardHeight');
} }
/**
* @private
*/
registerInput(textInputElement) { registerInput(textInputElement) {
this.input = textInputElement; this.input = textInputElement;
this.type = textInputElement.type || 'text'; this.type = textInputElement.type || 'text';
} }
/**
* @private
*/
registerLabel(label) { registerLabel(label) {
this.label = label; this.label = label;
} }
/**
* @private
*/
onInit() { onInit() {
if (this.input && this.label) { if (this.input && this.label) {
// if there is an input and an label // if there is an input and an label
@ -83,6 +92,9 @@ export class TextInput {
}; };
} }
/**
* @private
*/
pointerStart(ev) { pointerStart(ev) {
if (this.scrollAssist && this.app.isEnabled()) { if (this.scrollAssist && this.app.isEnabled()) {
// remember where the touchstart/mousedown started // remember where the touchstart/mousedown started
@ -90,6 +102,9 @@ export class TextInput {
} }
} }
/**
* @private
*/
pointerEnd(ev) { pointerEnd(ev) {
if (!this.app.isEnabled()) { if (!this.app.isEnabled()) {
ev.preventDefault(); ev.preventDefault();
@ -119,6 +134,9 @@ export class TextInput {
} }
} }
/**
* @private
*/
initFocus() { initFocus() {
// begin the process of setting focus to the inner input element // begin the process of setting focus to the inner input element
@ -170,7 +188,7 @@ export class TextInput {
} }
/** /**
* TODO * @private
* @param {TODO} inputOffsetTop TODO * @param {TODO} inputOffsetTop TODO
* @param {TODO} inputOffsetHeight TODO * @param {TODO} inputOffsetHeight TODO
* @param {TODO} scrollViewDimensions TODO * @param {TODO} scrollViewDimensions TODO
@ -292,14 +310,23 @@ export class TextInput {
return scrollData; return scrollData;
} }
/**
* @private
*/
focusChange(hasFocus) { focusChange(hasFocus) {
this.renderer.setElementClass(this.elementRef, 'has-focus', hasFocus); this.renderer.setElementClass(this.elementRef, 'has-focus', hasFocus);
} }
/**
* @private
*/
hasValue(inputValue) { hasValue(inputValue) {
this.renderer.setElementClass(this.elementRef, 'has-value', inputValue && inputValue !== ''); this.renderer.setElementClass(this.elementRef, 'has-value', inputValue && inputValue !== '');
} }
/**
* @private
*/
setFocus() { setFocus() {
if (this.input) { if (this.input) {
this.form.setAsFocused(this); this.form.setAsFocused(this);
@ -317,14 +344,23 @@ export class TextInput {
} }
} }
/**
* @private
*/
deregListeners() { deregListeners() {
this.deregScroll && this.deregScroll(); this.deregScroll && this.deregScroll();
} }
/**
* @private
*/
get hasFocus() { get hasFocus() {
return !!this.input && this.input.hasFocus; return !!this.input && this.input.hasFocus;
} }
/**
* @private
*/
onDestroy() { onDestroy() {
this.deregListeners(); this.deregListeners();
this.form.deregister(this); this.form.deregister(this);
@ -333,6 +369,9 @@ export class TextInput {
} }
/**
* @private
*/
@Directive({ @Directive({
selector: 'textarea,input[type=text],input[type=password],input[type=number],input[type=search],input[type=email],input[type=url],input[type=tel]', selector: 'textarea,input[type=text],input[type=password],input[type=number],input[type=search],input[type=email],input[type=url],input[type=tel]',
inputs: ['value'], inputs: ['value'],

View File

@ -20,23 +20,29 @@ export class ToolbarBase extends Ion {
this.titleRef = null; this.titleRef = null;
} }
/**
* @private
*/
setTitleCmp(titleCmp) { setTitleCmp(titleCmp) {
this.titleCmp = titleCmp; this.titleCmp = titleCmp;
} }
/**
* @private
*/
getTitleText() { getTitleText() {
return (this.titleCmp && this.titleCmp.getTitleText()) || ''; return (this.titleCmp && this.titleCmp.getTitleText()) || '';
} }
/** /**
* TODO * @private
* @returns {TODO} TODO
*/ */
getTitleRef() { getTitleRef() {
return this.titleCmp && this.titleCmp.elementRef; return this.titleCmp && this.titleCmp.elementRef;
} }
/** /**
* @private
* A toolbar items include the left and right side `ion-nav-items`, * A toolbar items include the left and right side `ion-nav-items`,
* and every `menu-toggle`. It does not include the `ion-title`. * and every `menu-toggle`. It does not include the `ion-title`.
* @returns {TODO} Array of this toolbar's item ElementRefs. * @returns {TODO} Array of this toolbar's item ElementRefs.
@ -45,6 +51,9 @@ export class ToolbarBase extends Ion {
return this.itemRefs; return this.itemRefs;
} }
/**
* @private
*/
addItemRef(itemElementRef) { addItemRef(itemElementRef) {
this.itemRefs.push(itemElementRef); this.itemRefs.push(itemElementRef);
} }
@ -104,6 +113,9 @@ export class ToolbarTitle extends Ion {
} }
/**
* @private
*/
@Directive({ @Directive({
selector: 'ion-nav-items,[menu-toggle]' selector: 'ion-nav-items,[menu-toggle]'
}) })

View File

@ -57,15 +57,11 @@ import {isObject, isDefined, isFunction, isArray, extend} from '../util/util';
* Simply add `?ionic<PROPERTYNAME>=<value>` to the url. * Simply add `?ionic<PROPERTYNAME>=<value>` to the url.
* *
* ``` * ```
* http://localhost:8100/?IonictabbarPlacement=bottom * http://localhost:8100/?ionicTabbarPlacement=bottom
* ``` * ```
**/ **/
export class Config { export class Config {
/**
* TODO
* @param {Object} config The config for your app
*/
constructor(config) { constructor(config) {
this._s = config && isObject(config) && !isArray(config) ? config : {}; this._s = config && isObject(config) && !isArray(config) ? config : {};
this._c = {}; // cached values this._c = {}; // cached values
@ -246,8 +242,7 @@ export class Config {
} }
/** /**
* TODO * @private
* @param {Object} platform The platform
*/ */
setPlatform(platform) { setPlatform(platform) {
this._platform = platform; this._platform = platform;

View File

@ -78,7 +78,9 @@ export function Page(config={}) {
} }
} }
/**
* @private
*/
export function ConfigComponent(config) { export function ConfigComponent(config) {
return function(cls) { return function(cls) {
var annotations = Reflect.getMetadata('annotations', cls) || []; var annotations = Reflect.getMetadata('annotations', cls) || [];
@ -88,7 +90,9 @@ export function ConfigComponent(config) {
} }
} }
/**
* @private
*/
function appendConfig(cls, config) { function appendConfig(cls, config) {
config.host = config.host || {}; config.host = config.host || {};