|
|
|
@ -26,8 +26,8 @@ class _Context {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export class AbstractChangeDetector<T> implements ChangeDetector {
|
|
|
|
|
lightDomChildren: any[] = [];
|
|
|
|
|
shadowDomChildren: any[] = [];
|
|
|
|
|
contentChildren: any[] = [];
|
|
|
|
|
viewChildren: any[] = [];
|
|
|
|
|
parent: ChangeDetector;
|
|
|
|
|
ref: ChangeDetectorRef;
|
|
|
|
|
|
|
|
|
@ -50,21 +50,21 @@ export class AbstractChangeDetector<T> implements ChangeDetector {
|
|
|
|
|
this.ref = new ChangeDetectorRef_(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
addChild(cd: ChangeDetector): void {
|
|
|
|
|
this.lightDomChildren.push(cd);
|
|
|
|
|
addContentChild(cd: ChangeDetector): void {
|
|
|
|
|
this.contentChildren.push(cd);
|
|
|
|
|
cd.parent = this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
removeChild(cd: ChangeDetector): void { ListWrapper.remove(this.lightDomChildren, cd); }
|
|
|
|
|
removeContentChild(cd: ChangeDetector): void { ListWrapper.remove(this.contentChildren, cd); }
|
|
|
|
|
|
|
|
|
|
addShadowDomChild(cd: ChangeDetector): void {
|
|
|
|
|
this.shadowDomChildren.push(cd);
|
|
|
|
|
addViewChild(cd: ChangeDetector): void {
|
|
|
|
|
this.viewChildren.push(cd);
|
|
|
|
|
cd.parent = this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
removeShadowDomChild(cd: ChangeDetector): void { ListWrapper.remove(this.shadowDomChildren, cd); }
|
|
|
|
|
removeViewChild(cd: ChangeDetector): void { ListWrapper.remove(this.viewChildren, cd); }
|
|
|
|
|
|
|
|
|
|
remove(): void { this.parent.removeChild(this); }
|
|
|
|
|
remove(): void { this.parent.removeContentChild(this); }
|
|
|
|
|
|
|
|
|
|
handleEvent(eventName: string, elIndex: number, locals: Locals): boolean {
|
|
|
|
|
var res = this.handleEventInternal(eventName, elIndex, locals);
|
|
|
|
@ -86,10 +86,10 @@ export class AbstractChangeDetector<T> implements ChangeDetector {
|
|
|
|
|
|
|
|
|
|
this.detectChangesInRecords(throwOnChange);
|
|
|
|
|
|
|
|
|
|
this._detectChangesInLightDomChildren(throwOnChange);
|
|
|
|
|
this._detectChangesContentChildren(throwOnChange);
|
|
|
|
|
if (!throwOnChange) this.afterContentLifecycleCallbacks();
|
|
|
|
|
|
|
|
|
|
this._detectChangesInShadowDomChildren(throwOnChange);
|
|
|
|
|
this._detectChangesInViewChildren(throwOnChange);
|
|
|
|
|
if (!throwOnChange) this.afterViewLifecycleCallbacks();
|
|
|
|
|
|
|
|
|
|
if (this.mode === ChangeDetectionStrategy.CheckOnce)
|
|
|
|
@ -130,7 +130,7 @@ export class AbstractChangeDetector<T> implements ChangeDetector {
|
|
|
|
|
|
|
|
|
|
// This method is not intended to be overridden. Subclasses should instead provide an
|
|
|
|
|
// implementation of `hydrateDirectives`.
|
|
|
|
|
hydrate(context: T, locals: Locals, directives: any, pipes: any): void {
|
|
|
|
|
hydrate(context: T, locals: Locals, directives: any, pipes: Pipes): void {
|
|
|
|
|
this.mode = ChangeDetectionUtil.changeDetectionMode(this.strategy);
|
|
|
|
|
this.context = context;
|
|
|
|
|
|
|
|
|
@ -183,16 +183,16 @@ export class AbstractChangeDetector<T> implements ChangeDetector {
|
|
|
|
|
afterViewLifecycleCallbacksInternal(): void {}
|
|
|
|
|
|
|
|
|
|
/** @internal */
|
|
|
|
|
_detectChangesInLightDomChildren(throwOnChange: boolean): void {
|
|
|
|
|
var c = this.lightDomChildren;
|
|
|
|
|
_detectChangesContentChildren(throwOnChange: boolean): void {
|
|
|
|
|
var c = this.contentChildren;
|
|
|
|
|
for (var i = 0; i < c.length; ++i) {
|
|
|
|
|
c[i].runDetectChanges(throwOnChange);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** @internal */
|
|
|
|
|
_detectChangesInShadowDomChildren(throwOnChange: boolean): void {
|
|
|
|
|
var c = this.shadowDomChildren;
|
|
|
|
|
_detectChangesInViewChildren(throwOnChange: boolean): void {
|
|
|
|
|
var c = this.viewChildren;
|
|
|
|
|
for (var i = 0; i < c.length; ++i) {
|
|
|
|
|
c[i].runDetectChanges(throwOnChange);
|
|
|
|
|
}
|
|
|
|
|