update to alpha.28)

domElement renamed to nativeElement
This commit is contained in:
Adam Bradley
2015-06-27 12:12:16 -05:00
parent a97527e0ad
commit 504ab46eb3
31 changed files with 5199 additions and 4348 deletions

View File

@ -1,5 +1,3 @@
// import {NgElement, Component, View, Parent} from 'angular2/angular2'
/* /*
@Component({ @Component({
@ -22,16 +20,5 @@
</div> </div>
</div>` </div>`
}) })
export class Alert { export class Alert {}
constructor(
@NgElement() ngElement:NgElement
) {
this.domElement = ngElement.domElement
this.config = Alert.config.invoke(this)
}
static open(opts) {
let alert = new Alert();
}
}
*/ */

View File

@ -75,7 +75,7 @@ export class ParallaxEffect {
constructor( constructor(
elementRef: ElementRef elementRef: ElementRef
) { ) {
this.domElement = elementRef.domElement; this.ele = elementRef.nativeElement;
setTimeout(() => { setTimeout(() => {
Object.observe(this, (changes) => { Object.observe(this, (changes) => {
@ -88,7 +88,7 @@ export class ParallaxEffect {
}); });
} }
parallaxItems() { parallaxItems() {
let list = this.domElement; let list = this.ele;
console.log('Moving items', this.parallax); console.log('Moving items', this.parallax);
var x = Math.max(0, (1 - this.parallax) * 20); var x = Math.max(0, (1 - this.parallax) * 20);
var y = 0;//Math.max(0, (1 - this.parallax) * 10); var y = 0;//Math.max(0, (1 - this.parallax) * 10);

View File

@ -37,8 +37,8 @@ export class ParallaxEffect {
content: Content, content: Content,
elementRef: ElementRef elementRef: ElementRef
) { ) {
this.domElement = elementRef.domElement; this.ele = elementRef.nativeElement;
this.scroller = this.domElement.querySelector('.scroll-content'); this.scroller = this.ele.querySelector('.scroll-content');
this.scroller.addEventListener('scroll', (e) => { this.scroller.addEventListener('scroll', (e) => {
//this.counter.innerHTML = e.target.scrollTop; //this.counter.innerHTML = e.target.scrollTop;
dom.raf(() => { dom.raf(() => {

View File

@ -46,19 +46,19 @@ export class Aside {
} }
constructor(elementRef: ElementRef) { constructor(elementRef: ElementRef) {
this.domElement = elementRef.domElement this.ele = elementRef.nativeElement
this.opening = new EventEmitter('opening'); this.opening = new EventEmitter('opening');
// TODO: Use Animation Class // TODO: Use Animation Class
this.domElement.addEventListener('transitionend', ev => { this.ele.addEventListener('transitionend', ev => {
this.setChanging(false) this.setChanging(false)
}) })
} }
onInit() { onInit() {
console.log('Aside content', this.content); console.log('Aside content', this.content);
this.contentElement = (this.content instanceof Node) ? this.content : this.content.domElement; this.contentElement = (this.content instanceof Node) ? this.content : this.content.ele;
Aside.applyConfig(this); Aside.applyConfig(this);
this.gestureDelegate = Aside.getDelegate(this, 'gesture'); this.gestureDelegate = Aside.getDelegate(this, 'gesture');
@ -86,7 +86,7 @@ export class Aside {
setChanging(isChanging) { setChanging(isChanging) {
if (isChanging !== this.isChanging) { if (isChanging !== this.isChanging) {
this.isChanging = isChanging this.isChanging = isChanging
this.domElement.classList[isChanging ? 'add' : 'remove']('changing'); this.ele.classList[isChanging ? 'add' : 'remove']('changing');
} }
} }

View File

@ -47,7 +47,7 @@ class AsideGesture extends SlideEdgeGesture {
getSlideBoundaries() { getSlideBoundaries() {
return { return {
min: 0, min: 0,
max: this.aside.domElement.offsetWidth max: this.aside.ele.offsetWidth
}; };
} }
} }
@ -60,7 +60,7 @@ export class RightAsideGesture extends LeftAsideGesture {
} }
getSlideBoundaries() { getSlideBoundaries() {
return { return {
min: -this.aside.domElement.offsetWidth, min: -this.aside.ele.offsetWidth,
max: 0 max: 0
}; };
} }
@ -74,7 +74,7 @@ export class TopAsideGesture extends AsideGesture {
getSlideBoundaries() { getSlideBoundaries() {
return { return {
min: 0, min: 0,
max: this.aside.domElement.offsetHeight max: this.aside.ele.offsetHeight
}; };
} }
} }
@ -85,7 +85,7 @@ export class BottomAsideGesture extends TopAsideGesture {
} }
getSlideBoundaries() { getSlideBoundaries() {
return { return {
min: -this.aside.domElement.offsetHeight, min: -this.aside.ele.offsetHeight,
max: 0 max: 0
}; };
} }

View File

@ -4,13 +4,13 @@ import {CSS} from 'ionic/util/dom'
// TODO use setters instead of direct dom manipulation // TODO use setters instead of direct dom manipulation
const asideManipulator = { const asideManipulator = {
setSliding(sliding) { setSliding(sliding) {
this.aside.domElement.classList[sliding ? 'add' : 'remove']('no-transition'); this.aside.ele.classList[sliding ? 'add' : 'remove']('no-transition');
}, },
setOpen(open) { setOpen(open) {
this.aside.domElement.classList[open ? 'add' : 'remove']('open'); this.aside.ele.classList[open ? 'add' : 'remove']('open');
}, },
setTransform(t) { setTransform(t) {
this.aside.domElement.style[CSS.transform] = t; this.aside.ele.style[CSS.transform] = t;
} }
} }
const contentManipulator = { const contentManipulator = {

View File

@ -11,13 +11,13 @@ import {View} from 'angular2/src/core/annotations_impl/view';
}) })
export class Content { export class Content {
constructor(elementRef: ElementRef) { constructor(elementRef: ElementRef) {
// TODO(maxlynch): we need this domElement for things like aside, etc. // TODO(maxlynch): we need this nativeElement for things like aside, etc.
// but we should be able to stamp out this behavior with a base IonicComponent // but we should be able to stamp out this behavior with a base IonicComponent
// or something, so all elements have a domElement reference or a getElement() method // or something, so all elements have a nativeElement reference or a getElement() method
this.domElement = elementRef.domElement; this.ele = elementRef.nativeElement;
setTimeout(() => { setTimeout(() => {
this.scrollElement = this.domElement.children[0]; this.scrollElement = this.ele.children[0];
}); });
} }

View File

@ -15,11 +15,11 @@ import {ElementRef} from 'angular2/src/core/compiler/element_ref';
}) })
export class Icon { export class Icon {
constructor(elementRef: ElementRef) { constructor(elementRef: ElementRef) {
this.domElement = elementRef.domElement; this.ele = elementRef.nativeElement;
} }
onInit() { onInit() {
if (this.name) { if (this.name) {
this.domElement.classList.add(this.name); this.ele.classList.add(this.name);
this.label = this.name; this.label = this.name;
} }
} }

View File

@ -12,7 +12,7 @@ export class ItemPrimarySwipeButtons {
@Parent() item: Item @Parent() item: Item
) { ) {
item.primarySwipeButtons = this item.primarySwipeButtons = this
this.domElement = elementRef.domElement this.ele = elementRef.nativeElement
this.parentItem = item this.parentItem = item
this.gesture = new ItemSlideGesture(this) this.gesture = new ItemSlideGesture(this)
this.gesture.listen() this.gesture.listen()
@ -22,7 +22,7 @@ export class ItemPrimarySwipeButtons {
if (isOpen !== this.isOpen) { if (isOpen !== this.isOpen) {
this.isOpen = isOpen this.isOpen = isOpen
requestAnimationFrame(() => { requestAnimationFrame(() => {
this.domElement.classList[isOpen?'add':'remove'](isOpen) this.ele.classList[isOpen?'add':'remove'](isOpen)
}) })
} }
} }
@ -36,13 +36,13 @@ export class ItemSecondarySwipeButtons {
class ItemSlideGesture extends SlideGesture { class ItemSlideGesture extends SlideGesture {
constructor(buttons) { constructor(buttons) {
super(buttons.parentItem.domElement) super(buttons.parentItem.ele)
this.buttons = buttons this.buttons = buttons
} }
getSlideBoundaries() { getSlideBoundaries() {
return { return {
min: -this.buttons.domElement.offsetWidth, min: -this.buttons.ele.offsetWidth,
max: 0, max: 0,
}; };
} }
@ -52,18 +52,18 @@ class ItemSlideGesture extends SlideGesture {
} }
onSlideBeforeStart() { onSlideBeforeStart() {
this.buttons.domElement.classList.add('changing') this.buttons.ele.classList.add('changing')
this.buttons.domElement.classList.add('no-transition') this.buttons.ele.classList.add('no-transition')
return new Promise(resolve => { return new Promise(resolve => {
requestAnimationFrame(resolve) requestAnimationFrame(resolve)
}) })
} }
onSlide(slide, ev) { onSlide(slide, ev) {
this.buttons.domElement.style.transform = 'translate3d(' + slide.distance + 'px,0,0)'; this.buttons.ele.style.transform = 'translate3d(' + slide.distance + 'px,0,0)';
} }
onSlideEnd(slide, ev) { onSlideEnd(slide, ev) {
this.buttons.domElement.style.transform = '' this.buttons.ele.style.transform = ''
this.buttons.domElement.classList.remove('no-transition') this.buttons.ele.classList.remove('no-transition')
if (Math.abs(ev.velocityX) > 0.2 || Math.abs(slide.delta) > Math.abs(slide.max) * 0.5) { if (Math.abs(ev.velocityX) > 0.2 || Math.abs(slide.delta) > Math.abs(slide.max) * 0.5) {
this.buttons.setOpen(!this.buttons.isOpen); this.buttons.setOpen(!this.buttons.isOpen);
} }

View File

@ -58,7 +58,7 @@ export class Item {
this._isTransitioning = false; this._isTransitioning = false;
this._transform = ''; this._transform = '';
this.domElement = elementRef.domElement; this.ele = elementRef.nativeElement;
this.swipeButtons = {}; this.swipeButtons = {};
this.optionButtons = {}; this.optionButtons = {};
} }

View File

@ -1,4 +1,4 @@
import {NgElement, Component, View, Parent} from 'angular2/angular2' import {ElementRef, Component, View, Parent} from 'angular2/angular2'
@Component({ @Component({
@ -12,10 +12,10 @@ import {NgElement, Component, View, Parent} from 'angular2/angular2'
}) })
export class Layout { export class Layout {
constructor( constructor(
@NgElement() ngElement:NgElement @ElementRef() elementRef:ElementRef
) { ) {
this.domElement = ngElement.domElement this.ele = ngElement.nativeElement
this.eqEle = this.domElement.lastElementChild this.eqEle = this.ele.lastElementChild
window.requestAnimationFrame(() => { window.requestAnimationFrame(() => {
this.initLayout() this.initLayout()
@ -26,8 +26,8 @@ export class Layout {
this.mqs = {} this.mqs = {}
for (let x = 0; x < this.domElement.attributes.length; x++) { for (let x = 0; x < this.ele.attributes.length; x++) {
let attr = this.domElement.attributes[x] let attr = this.ele.attributes[x]
let val = attr.nodeValue let val = attr.nodeValue
let mqClassname = attr.nodeName let mqClassname = attr.nodeName
@ -38,7 +38,7 @@ export class Layout {
this.mqs[mql.media] = (mql) => { this.mqs[mql.media] = (mql) => {
console.log(mql.media, mql.matches, mqClassname) console.log(mql.media, mql.matches, mqClassname)
window.requestAnimationFrame(() => { window.requestAnimationFrame(() => {
this.domElement.classList[mql.matches ? 'add' : 'remove'](mqClassname) this.ele.classList[mql.matches ? 'add' : 'remove'](mqClassname)
}) })
} }

View File

@ -22,7 +22,7 @@ export class List {
} }
constructor(elementRef: ElementRef) { constructor(elementRef: ElementRef) {
this.domElement = elementRef.domElement; this.ele = elementRef.nativeElement;
} }
onInit() { onInit() {

View File

@ -5,7 +5,7 @@ export class ListVirtualScroll {
this.list = list; this.list = list;
this.content = this.list.content; this.content = this.list.content;
this.viewportHeight = this.content.domElement.offsetHeight; this.viewportHeight = this.content.ele.offsetHeight;
this.viewContainer = this.list.itemTemplate.viewContainer; this.viewContainer = this.list.itemTemplate.viewContainer;
@ -31,7 +31,7 @@ export class ListVirtualScroll {
} }
resize() { resize() {
this.viewportHeight = this.content.domElement.offsetHeight; this.viewportHeight = this.content.ele.offsetHeight;
this.viewportScrollHeight = this.content.scrollElement.scrollHeight; this.viewportScrollHeight = this.content.scrollElement.scrollHeight;
this.virtualHeight = this.list.items.length * this.itemHeight; this.virtualHeight = this.list.items.length * this.itemHeight;
@ -100,7 +100,7 @@ export class ListVirtualScroll {
} }
console.log('VIRTUAL SCROLL: scroll(scrollTop:', st, 'topIndex:', topIndex, 'bottomIndex:', bottomIndex, ')'); console.log('VIRTUAL SCROLL: scroll(scrollTop:', st, 'topIndex:', topIndex, 'bottomIndex:', bottomIndex, ')');
console.log('Container has', this.list.domElement.children.length, 'children'); console.log('Container has', this.list.ele.children.length, 'children');
} }
cellAtIndex(index) { cellAtIndex(index) {

View File

@ -39,8 +39,8 @@ import * as dom from '../../util/dom';
}) })
export class Navbar { export class Navbar {
constructor(item: ViewItem, elementRef: ElementRef) { constructor(item: ViewItem, elementRef: ElementRef) {
this._ele = elementRef.domElement; this.ele = elementRef.nativeElement;
this._itmEles = []; this.itemEles = [];
item.navbarView(this); item.navbarView(this);
this.bbDefault = 'Back'; this.bbDefault = 'Back';
@ -48,40 +48,40 @@ export class Navbar {
} }
element() { element() {
return this._ele; return this.ele;
} }
backButtonElement() { backButtonElement(ele) {
if (arguments.length) { if (arguments.length) {
this._bbEle = arguments[0]; this._bbEle = ele;
} }
return this._bbEle; return this._bbEle;
} }
backButtonTextElement() { backButtonTextElement(ele) {
if (arguments.length) { if (arguments.length) {
this._bbTxEle = arguments[0]; this._bbTxEle = ele;
} }
return this._bbTxEle; return this._bbTxEle;
} }
titleElement() { titleElement(ele) {
if (arguments.length) { if (arguments.length) {
this._nbTlEle = arguments[0]; this._nbTlEle = ele;
} }
return this._nbTlEle; return this._nbTlEle;
} }
itemElements() { itemElements(ele) {
if (arguments.length) { if (arguments.length) {
this._itmEles.push(arguments[0]); this.itemEles.push(ele);
} }
return this._itmEles; return this.itemEles;
} }
titleText() { titleText(ele) {
if (arguments.length) { if (arguments.length) {
this._ttTxt.push(arguments[0]); this._ttTxt.push(ele);
} }
return this._ttTxt; return this._ttTxt;
} }
@ -89,7 +89,7 @@ export class Navbar {
alignTitle() { alignTitle() {
// called after the navbar/title has had a moment to // called after the navbar/title has had a moment to
// finish rendering in their correct locations // finish rendering in their correct locations
const navbarEle = this._ele; const navbarEle = this.ele;
const titleEle = this._ttEle || (this._ttEle = navbarEle.querySelector('ion-title')); const titleEle = this._ttEle || (this._ttEle = navbarEle.querySelector('ion-title'));
// don't bother if there's no title element // don't bother if there's no title element
@ -125,7 +125,7 @@ export class Navbar {
didEnter() { didEnter() {
setTimeout(() => { setTimeout(() => {
const titleEle = this._ttEle || (this._ttEle = this._ele.querySelector('ion-title')); const titleEle = this._ttEle || (this._ttEle = this.ele.querySelector('ion-title'));
//this.titleText((titleEle && titleEle.textContent) || ''); //this.titleText((titleEle && titleEle.textContent) || '');
}, 32); }, 32);
} }
@ -140,7 +140,7 @@ export class Navbar {
class BackButton { class BackButton {
constructor(@Parent() navbar: Navbar, item: ViewItem, elementRef: ElementRef) { constructor(@Parent() navbar: Navbar, item: ViewItem, elementRef: ElementRef) {
this.item = item; this.item = item;
navbar.backButtonElement(elementRef.domElement); navbar.backButtonElement(elementRef.nativeElement);
} }
goBack(ev) { goBack(ev) {
@ -155,7 +155,7 @@ class BackButton {
}) })
class BackButtonText { class BackButtonText {
constructor(@Parent() navbar: Navbar, elementRef: ElementRef) { constructor(@Parent() navbar: Navbar, elementRef: ElementRef) {
navbar.backButtonTextElement(elementRef.domElement); navbar.backButtonTextElement(elementRef.nativeElement);
} }
} }
@ -164,7 +164,7 @@ class BackButtonText {
}) })
class Title { class Title {
constructor(@Parent() navbar: Navbar, elementRef: ElementRef) { constructor(@Parent() navbar: Navbar, elementRef: ElementRef) {
navbar.titleElement(elementRef.domElement); navbar.titleElement(elementRef.nativeElement);
} }
} }
@ -173,7 +173,7 @@ class Title {
}) })
class NavbarItem { class NavbarItem {
constructor(@Parent() navbar: Navbar, elementRef: ElementRef) { constructor(@Parent() navbar: Navbar, elementRef: ElementRef) {
navbar.itemElements(elementRef.domElement); navbar.itemElements(elementRef.nativeElement);
} }
} }

View File

@ -39,7 +39,10 @@ export class PaneController {
// add a Pane element // add a Pane element
// when the Pane is added, it'll also add its reference to the panes object // when the Pane is added, it'll also add its reference to the panes object
viewCtrl.loader.loadNextToExistingLocation(Pane, viewCtrl.anchorElementRef(), injector).then(() => { // viewCtrl.compiler.compileInHost(this.ComponentType).then(componentProtoViewRef => {
// });
viewCtrl.loader.loadNextToLocation(Pane, viewCtrl.anchorElementRef(), injector).then(() => {
// get the pane reference by name // get the pane reference by name
pane = this.panes[key]; pane = this.panes[key];
@ -62,7 +65,7 @@ export class PaneController {
// as each section is compiled and added to the Pane // as each section is compiled and added to the Pane
// the section will add a reference to itself in the Pane's sections object // the section will add a reference to itself in the Pane's sections object
promises.push( promises.push(
viewCtrl.loader.loadNextToExistingLocation(SectionClass, sectionAnchorElementRef) viewCtrl.loader.loadNextToLocation(SectionClass, sectionAnchorElementRef)
); );
}); });
@ -108,16 +111,16 @@ export class Pane {
} }
constructor(viewCtrl: ViewController, elementRef: ElementRef) { constructor(viewCtrl: ViewController, elementRef: ElementRef) {
this.domElement = elementRef.domElement; this.ele = elementRef.nativeElement;
viewCtrl.panes.add(this); viewCtrl.panes.add(this);
} }
width() { width() {
return this.domElement.offsetWidth; return this.ele.offsetWidth;
} }
showPane(val) { showPane(val) {
this.domElement.classList[val ? 'add' : 'remove']('show-pane'); this.ele.classList[val ? 'add' : 'remove']('show-pane');
} }
} }

View File

@ -11,7 +11,7 @@ import {Gesture} from 'ionic/gestures/gesture';
@Directive({ @Directive({
selector: '.swipe-handle', selector: '.swipe-handle',
host: { host: {
'[class.show-handle]': 'showHandle()' '[class.show-handle]': 'showHandle'
} }
}) })
export class SwipeHandle { export class SwipeHandle {
@ -27,7 +27,7 @@ export class SwipeHandle {
self.pane = pane; self.pane = pane;
self.viewCtrl = viewCtrl; self.viewCtrl = viewCtrl;
let gesture = self.gesture = new Gesture(elementRef.domElement); let gesture = self.gesture = new Gesture(elementRef.nativeElement);
gesture.listen(); gesture.listen();
function dragHorizontal(ev) { function dragHorizontal(ev) {
@ -92,7 +92,7 @@ export class SwipeHandle {
this.viewCtrl.swipeBackProgress( (ev.gesture.center.x - this.startX) / this.width ); this.viewCtrl.swipeBackProgress( (ev.gesture.center.x - this.startX) / this.width );
} }
showHandle() { get showHandle() {
return (this.viewCtrl ? this.viewCtrl.swipeBackEnabled() : false); return (this.viewCtrl ? this.viewCtrl.swipeBackEnabled() : false);
} }

View File

@ -24,7 +24,7 @@ export class Overlay {
overlay.setApp(app); overlay.setApp(app);
overlay._type = overlayType; overlay._type = overlayType;
overlay._handle = opts && opts.handle; overlay._handle = opts && opts.handle;
overlay._domElement = ref.elementRef.domElement; overlay._ele = ref.elementRef.nativeElement;
overlay.extendOptions(opts); overlay.extendOptions(opts);
overlay.zIndex = ROOT_Z_INDEX; overlay.zIndex = ROOT_Z_INDEX;
@ -49,7 +49,7 @@ export class Overlay {
_open(opts) { _open(opts) {
let animationName = (opts && opts.animation) || this.options.enterAnimation; let animationName = (opts && opts.animation) || this.options.enterAnimation;
let enterAnimation = Animation.create(this._domElement, animationName); let enterAnimation = Animation.create(this._ele, animationName);
enterAnimation.before.addClass('ion-app'); enterAnimation.before.addClass('ion-app');
enterAnimation.before.addClass('show-overlay'); enterAnimation.before.addClass('show-overlay');
ClickBlock(true, enterAnimation.duration() + 200); ClickBlock(true, enterAnimation.duration() + 200);
@ -66,7 +66,7 @@ export class Overlay {
close(opts) { close(opts) {
return new Promise(resolve => { return new Promise(resolve => {
let animationName = (opts && opts.animation) || this.options.leaveAnimation; let animationName = (opts && opts.animation) || this.options.leaveAnimation;
let leavingAnimation = Animation.create(this._domElement, animationName); let leavingAnimation = Animation.create(this._ele, animationName);
leavingAnimation.after.removeClass('show-overlay'); leavingAnimation.after.removeClass('show-overlay');
ClickBlock(true, leavingAnimation.duration() + 200); ClickBlock(true, leavingAnimation.duration() + 200);

View File

@ -20,12 +20,12 @@ export class RadioGroup {
elementRef: ElementRef//, elementRef: ElementRef//,
//cd:ControlDirective //cd:ControlDirective
) { ) {
this.domElement = elementRef.domElement this.ele = elementRef.nativeElement
// this.config = RadioGroup.config.invoke(this) // this.config = RadioGroup.config.invoke(this)
// this.controlDirective = cd; // this.controlDirective = cd;
// cd.valueAccessor = this; //ControlDirective should inject CheckboxControlDirective // cd.valueAccessor = this; //ControlDirective should inject CheckboxControlDirective
this.domElement.classList.add('list'); this.ele.classList.add('list');
this.buttons = []; this.buttons = [];
} }
@ -122,10 +122,10 @@ export class RadioButton {
@Ancestor() group: RadioGroup, @Ancestor() group: RadioGroup,
elementRef: ElementRef elementRef: ElementRef
) { ) {
this.domElement = elementRef.domElement; this.ele = elementRef.ele;
this.domElement.classList.add('item') this.ele.classList.add('item')
this.domElement.setAttribute('aria-checked', true) this.ele.setAttribute('aria-checked', true)
this.group = group; this.group = group;
@ -133,13 +133,13 @@ export class RadioButton {
} }
setActive(isActive) { setActive(isActive) {
// TODO: No domElement // TODO: No ele
if(isActive) { if(isActive) {
this.domElement.classList.add('active'); this.ele.classList.add('active');
this.domElement.setAttribute('aria-checked', true) this.ele.setAttribute('aria-checked', true)
} else { } else {
this.domElement.classList.remove('active'); this.ele.classList.remove('active');
this.domElement.setAttribute('aria-checked', false) this.ele.setAttribute('aria-checked', false)
} }
} }

View File

@ -17,8 +17,8 @@ export class Refresher {
@Parent() content: Content, @Parent() content: Content,
element: ElementRef element: ElementRef
) { ) {
this.domElement = element.domElement; this.ele = element.nativeElement;
this.domElement.classList.add('content'); this.ele.classList.add('content');
this.refresh = new EventEmitter('refresh'); this.refresh = new EventEmitter('refresh');

View File

@ -37,7 +37,7 @@ export class SearchBar {
elementRef: ElementRef//, elementRef: ElementRef//,
//cd:ControlDirective //cd:ControlDirective
) { ) {
this.domElement = elementRef.domElement; this.ele = elementRef.nativeElement;
// this.controlDirective = cd; // this.controlDirective = cd;
// cd.valueAccessor = this; //ControlDirective should inject CheckboxControlDirective // cd.valueAccessor = this; //ControlDirective should inject CheckboxControlDirective

View File

@ -89,7 +89,7 @@ export class Segment {
elementRef: ElementRef, elementRef: ElementRef,
renderer: Renderer renderer: Renderer
) { ) {
this.domElement = elementRef.domElement this.ele = elementRef.nativeElement
this.elementRef = elementRef; this.elementRef = elementRef;
this.renderer = renderer; this.renderer = renderer;
@ -177,7 +177,7 @@ export class SegmentButton {
@Ancestor() segment: Segment, @Ancestor() segment: Segment,
elementRef: ElementRef elementRef: ElementRef
) { ) {
this.domElement = elementRef.domElement this.ele = elementRef.ele
this.segment = segment; this.segment = segment;
} }

View File

@ -49,7 +49,7 @@ export class Slides {
constructor(elementRef: ElementRef) { constructor(elementRef: ElementRef) {
// Grab the main container, and the slides-view wrapper // Grab the main container, and the slides-view wrapper
this.domElement = elementRef.domElement; this.ele = elementRef.nativeElement;
this.slides = []; this.slides = [];
this.currentIndex = 0; this.currentIndex = 0;
@ -72,7 +72,7 @@ export class Slides {
this.continuous = util.isDefined(this.loop) && (this.slides.length > 1 ? true : false); this.continuous = util.isDefined(this.loop) && (this.slides.length > 1 ? true : false);
// Grab the wrapper element that contains the slides // Grab the wrapper element that contains the slides
this.wrapperElement = this.domElement.children[0]; this.wrapperElement = this.ele.children[0];
this.resize(); this.resize();
@ -115,7 +115,7 @@ export class Slides {
resize() { resize() {
// Get the width of the container, which is the viewport // Get the width of the container, which is the viewport
// that the user will actually see. // that the user will actually see.
this.containerWidth = this.domElement.offsetWidth || this.domElement.getBoundingClientRect().width; this.containerWidth = this.ele.offsetWidth || this.ele.getBoundingClientRect().width;
// Set the wrapper element to the total width of the child elements // Set the wrapper element to the total width of the child elements
this.wrapperElement.style.width = ((this.containerWidth * this.slides.length)) + 'px'; this.wrapperElement.style.width = ((this.containerWidth * this.slides.length)) + 'px';
@ -467,7 +467,7 @@ export class Slide {
@Ancestor() slides: Slides, @Ancestor() slides: Slides,
elementRef: ElementRef elementRef: ElementRef
) { ) {
this.domElement = elementRef.domElement; this.ele = elementRef.nativeElement;
slides.add(this); slides.add(this);
} }
@ -484,8 +484,8 @@ export class Slide {
duration = duration || 0; duration = duration || 0;
this.domElement.style[dom.CSS.transition + 'Duration'] = duration + 'ms'; this.ele.style[dom.CSS.transition + 'Duration'] = duration + 'ms';
this.domElement.style[dom.CSS.transform] = 'translate3d(' + x + 'px, 0, 0)'; this.ele.style[dom.CSS.transform] = 'translate3d(' + x + 'px, 0, 0)';
} }
get translateX() { get translateX() {
@ -494,7 +494,7 @@ export class Slide {
set left(x) { set left(x) {
this._left = x; this._left = x;
this.domElement.style.left = x + 'px'; this.ele.style.left = x + 'px';
} }
get left() { get left() {
return this._left; return this._left;
@ -502,7 +502,7 @@ export class Slide {
set width(width) { set width(width) {
this._width = width; this._width = width;
this.domElement.style.width = width + 'px'; this.ele.style.width = width + 'px';
} }
get width() { get width() {
@ -524,7 +524,7 @@ export class SlidePager {
@Ancestor() slides: Slides, @Ancestor() slides: Slides,
elementRef: ElementRef elementRef: ElementRef
) { ) {
this.domElement = elementRef.domElement; this.ele = elementRef.nativeElement;
this.slides = slides; this.slides = slides;
@ -545,7 +545,7 @@ export class SlidePager {
export class SlidesGesture extends DragGesture { export class SlidesGesture extends DragGesture {
constructor(slides) { constructor(slides) {
super(slides.domElement); super(slides.ele);
this.slides = slides; this.slides = slides;
} }
onDrag(event) { onDrag(event) {

View File

@ -1,4 +1,4 @@
import {Component, Parent, Decorator, View, NgElement} from 'angular2/angular2' import {Component, Parent, Decorator, View, ElementRef} from 'angular2/angular2'
import {Nav} from 'ionic/components/nav/nav' import {Nav} from 'ionic/components/nav/nav'
import * as util from 'ionic/util' import * as util from 'ionic/util'
@ -59,10 +59,10 @@ ion-split-view > [split-viewport] {
}) })
export class SplitView { export class SplitView {
constructor( constructor(
element: NgElement, elementRef: ElementRef,
@Parent() navPane: NavPane @Parent() navPane: NavPane
) { ) {
this.domElement = element.domElement this.ele = elementRef.nativeElement
this.navPane = navPane this.navPane = navPane
// TODO mq.addEventListener() doesn't work with zone.js // TODO mq.addEventListener() doesn't work with zone.js

View File

@ -36,21 +36,21 @@ export class Switch {
elementRef: ElementRef, elementRef: ElementRef,
cd: ControlDirective cd: ControlDirective
) { ) {
this.domElement = elementRef.domElement this.ele = elementRef.nativeElement
this.config = Switch.config.invoke(this) this.config = Switch.config.invoke(this)
this.controlDirective = cd; this.controlDirective = cd;
cd.valueAccessor = this; cd.valueAccessor = this;
// TODO: These are temporary until we figure out what to do // TODO: These are temporary until we figure out what to do
// with @PropertSetter // with @PropertSetter
let setAriaRole = (v) => this.domElement.setAttribute('aria-role', v) let setAriaRole = (v) => this.ele.setAttribute('aria-role', v)
let setAriaChecked = (v) => this.domElement.setAttribute('aria-checked', v) let setAriaChecked = (v) => this.ele.setAttribute('aria-checked', v)
let setAriaInvalid = (v) => this.domElement.setAttribute('aria-invalid', v) let setAriaInvalid = (v) => this.ele.setAttribute('aria-invalid', v)
let setAriaDisabled = (v) => this.domElement.setAttribute('aria-disabled', v) let setAriaDisabled = (v) => this.ele.setAttribute('aria-disabled', v)
//let setChecked = (v) => this.domElement.setAttribute('checked', v); //let setChecked = (v) => this.ele.setAttribute('checked', v);
this.domElement.classList.add('item') this.ele.classList.add('item')
// TODO: These rely on the commented-out PropertySetter's above // TODO: These rely on the commented-out PropertySetter's above
//setAriaRole('checkbox') //setAriaRole('checkbox')

View File

@ -23,7 +23,7 @@ import {Content} from '../content/content';
host: { host: {
'[attr.id]': 'panelId', '[attr.id]': 'panelId',
'[attr.aria-labelledby]': 'labeledBy', '[attr.aria-labelledby]': 'labeledBy',
'[attr.aria-hidden]': '!isSelected', '[attr.aria-hidden]': 'isNotSelected',
'[class.tab-selected]': 'isSelected', '[class.tab-selected]': 'isSelected',
'role': 'tabpanel' 'role': 'tabpanel'
} }
@ -51,7 +51,7 @@ export class Tab extends ViewController {
let item = this.item = new ViewItem(tabs.parent); let item = this.item = new ViewItem(tabs.parent);
item.setInstance(this); item.setInstance(this);
item.viewElement(elementRef.domElement); item.viewElement(elementRef.nativeElement);
tabs.addTab(this); tabs.addTab(this);
this.navbarView = item.navbarView = () => { this.navbarView = item.navbarView = () => {
@ -97,6 +97,10 @@ export class Tab extends ViewController {
return this.tabs.isActive(this.item); return this.tabs.isActive(this.item);
} }
get isNotSelected() {
return !this.tabs.isActive(this.item);
}
} }

View File

@ -20,7 +20,7 @@ import * as dom from '../../util/dom';
}) })
export class Toolbar { export class Toolbar {
constructor(elementRef:ElementRef, ngZone:NgZone) { constructor(elementRef:ElementRef, ngZone:NgZone) {
this.domElement = elementRef.domElement; this.ele = elementRef.nativeElement;
Toolbar.config.invoke(this); Toolbar.config.invoke(this);
/* /*
@ -34,7 +34,7 @@ export class Toolbar {
} }
alignTitle() { alignTitle() {
const toolbarEle = this.domElement; const toolbarEle = this.ele;
const innerTitleEle = this._innerTitleEle || (this._innerTitleEle = toolbarEle.querySelector('.toolbar-inner-title')); const innerTitleEle = this._innerTitleEle || (this._innerTitleEle = toolbarEle.querySelector('.toolbar-inner-title'));
const titleEle = this._titleEle || (this._titleEle = innerTitleEle.querySelector('ion-title')); const titleEle = this._titleEle || (this._titleEle = innerTitleEle.querySelector('ion-title'));
const style = this._style || (this._style = window.getComputedStyle(titleEle)); const style = this._style || (this._style = window.getComputedStyle(titleEle));

View File

@ -28,7 +28,7 @@ export class ViewController {
this.injector = injector; this.injector = injector;
// TODO: Make this generic? // TODO: Make this generic?
this.domElement = elementRef.domElement; this.ele = elementRef.nativeElement;
this.items = []; this.items = [];
this.navCtrl = new NavController(this); this.navCtrl = new NavController(this);

View File

@ -10,7 +10,6 @@ import {ViewItem} from './view-item';
}) })
export class IonView { export class IonView {
constructor(@Optional() item: ViewItem, elementRef: ElementRef) { constructor(@Optional() item: ViewItem, elementRef: ElementRef) {
console.log('View constructor', item) this.ele = elementRef.nativeElement;
this.domElement = elementRef.domElement;
} }
} }

View File

@ -67,7 +67,7 @@ export class Transition extends Animation {
this.leavingTitle = new Animation(leavingItem.titleElement()); this.leavingTitle = new Animation(leavingItem.titleElement());
leavingNavbar.add(this.leavingTitle); leavingNavbar.add(this.leavingTitle);
this.leavingNavbarItems = new Animation(leavingItem.navbarItemElements()) this.leavingNavbarItems = new Animation(leavingItem.navbarItemElements());
this.leavingNavbarItems.fadeOut(); this.leavingNavbarItems.fadeOut();
leavingNavbar.add(this.leavingNavbarItems); leavingNavbar.add(this.leavingNavbarItems);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff