2015-03-23 14:10:55 -07:00
|
|
|
import {isPresent} from 'angular2/src/facade/lang';
|
|
|
|
import {DOM} from 'angular2/src/dom/dom_adapter';
|
|
|
|
|
|
|
|
import {List, Map, ListWrapper, MapWrapper} from 'angular2/src/facade/collection';
|
|
|
|
|
|
|
|
import {ElementBinder} from './element_binder';
|
|
|
|
import {NG_BINDING_CLASS} from '../util';
|
|
|
|
|
|
|
|
export class ProtoView {
|
|
|
|
element;
|
|
|
|
elementBinders:List<ElementBinder>;
|
|
|
|
isTemplateElement:boolean;
|
|
|
|
isRootView:boolean;
|
|
|
|
rootBindingOffset:int;
|
|
|
|
|
|
|
|
constructor({
|
|
|
|
elementBinders,
|
|
|
|
element,
|
2015-04-02 14:40:49 -07:00
|
|
|
isRootView
|
2015-03-23 14:10:55 -07:00
|
|
|
}) {
|
|
|
|
this.element = element;
|
|
|
|
this.elementBinders = elementBinders;
|
|
|
|
this.isTemplateElement = DOM.isTemplateElement(this.element);
|
|
|
|
this.isRootView = isRootView;
|
|
|
|
this.rootBindingOffset = (isPresent(this.element) && DOM.hasClass(this.element, NG_BINDING_CLASS)) ? 1 : 0;
|
|
|
|
}
|
|
|
|
|
2015-04-07 17:24:09 -07:00
|
|
|
mergeChildComponentProtoViews(componentProtoViews:List<ProtoView>) {
|
|
|
|
var componentProtoViewIndex = 0;
|
2015-03-23 14:10:55 -07:00
|
|
|
for (var i=0; i<this.elementBinders.length; i++) {
|
|
|
|
var eb = this.elementBinders[i];
|
2015-04-07 17:24:09 -07:00
|
|
|
if (isPresent(eb.componentId)) {
|
|
|
|
eb.nestedProtoView = componentProtoViews[componentProtoViewIndex];
|
|
|
|
componentProtoViewIndex++;
|
2015-03-23 14:10:55 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|