parent
1e7ca22078
commit
aea8832243
|
@ -17,19 +17,13 @@ export class EventListener {
|
|||
* @experimental All debugging apis are currently experimental.
|
||||
*/
|
||||
export class DebugNode {
|
||||
nativeNode: any;
|
||||
listeners: EventListener[];
|
||||
// TODO(issue/24571): remove '!'.
|
||||
parent !: DebugElement | null;
|
||||
listeners: EventListener[] = [];
|
||||
parent: DebugElement|null = null;
|
||||
|
||||
constructor(nativeNode: any, parent: DebugNode|null, private _debugContext: DebugContext) {
|
||||
this.nativeNode = nativeNode;
|
||||
constructor(public nativeNode: any, parent: DebugNode|null, private _debugContext: DebugContext) {
|
||||
if (parent && parent instanceof DebugElement) {
|
||||
parent.addChild(this);
|
||||
} else {
|
||||
this.parent = null;
|
||||
}
|
||||
this.listeners = [];
|
||||
}
|
||||
|
||||
get injector(): Injector { return this._debugContext.injector; }
|
||||
|
@ -47,22 +41,16 @@ export class DebugNode {
|
|||
* @experimental All debugging apis are currently experimental.
|
||||
*/
|
||||
export class DebugElement extends DebugNode {
|
||||
// TODO(issue/24571): remove '!'.
|
||||
name !: string;
|
||||
properties: {[key: string]: any};
|
||||
attributes: {[key: string]: string | null};
|
||||
classes: {[key: string]: boolean};
|
||||
styles: {[key: string]: string | null};
|
||||
childNodes: DebugNode[];
|
||||
properties: {[key: string]: any} = {};
|
||||
attributes: {[key: string]: string | null} = {};
|
||||
classes: {[key: string]: boolean} = {};
|
||||
styles: {[key: string]: string | null} = {};
|
||||
childNodes: DebugNode[] = [];
|
||||
nativeElement: any;
|
||||
|
||||
constructor(nativeNode: any, parent: any, _debugContext: DebugContext) {
|
||||
super(nativeNode, parent, _debugContext);
|
||||
this.properties = {};
|
||||
this.attributes = {};
|
||||
this.classes = {};
|
||||
this.styles = {};
|
||||
this.childNodes = [];
|
||||
this.nativeElement = nativeNode;
|
||||
}
|
||||
|
||||
|
|
|
@ -394,10 +394,6 @@ function isFactoryProvider(value: SingleProvider): value is FactoryProvider {
|
|||
return !!(value as FactoryProvider).useFactory;
|
||||
}
|
||||
|
||||
function isClassProvider(value: SingleProvider): value is ClassProvider {
|
||||
return !!(value as ClassProvider).useClass;
|
||||
}
|
||||
|
||||
function isTypeProvider(value: SingleProvider): value is TypeProvider {
|
||||
return typeof value === 'function';
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ export function renderComponent<T>(
|
|||
const componentDef =
|
||||
(componentType as ComponentType<T>).ngComponentDef as ComponentDefInternal<T>;
|
||||
if (componentDef.type != componentType) componentDef.type = componentType;
|
||||
let component: T;
|
||||
|
||||
// The first index of the first selector is the tag name.
|
||||
const componentTag = componentDef.selectors ![0] ![0] as string;
|
||||
const hostNode = locateHostElement(rendererFactory, opts.host || componentTag);
|
||||
|
@ -113,6 +113,7 @@ export function renderComponent<T>(
|
|||
|
||||
const oldView = enterView(rootView, null !);
|
||||
let elementNode: LElementNode;
|
||||
let component: T;
|
||||
try {
|
||||
if (rendererFactory.begin) rendererFactory.begin();
|
||||
|
||||
|
@ -120,8 +121,8 @@ export function renderComponent<T>(
|
|||
elementNode = hostElement(componentTag, hostNode, componentDef, sanitizer);
|
||||
|
||||
// Create directive instance with factory() and store at index 0 in directives array
|
||||
rootContext.components.push(
|
||||
component = baseDirectiveCreate(0, componentDef.factory(), componentDef) as T);
|
||||
component = baseDirectiveCreate(0, componentDef.factory() as T, componentDef);
|
||||
rootContext.components.push(component);
|
||||
|
||||
(elementNode.data as LViewData)[CONTEXT] = component;
|
||||
initChangeDetectorIfExisting(elementNode.nodeInjector, component, elementNode.data !);
|
||||
|
|
|
@ -6,17 +6,14 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {SimpleChange} from '../change_detection/change_detection_util';
|
||||
import {ChangeDetectionStrategy} from '../change_detection/constants';
|
||||
import {Provider} from '../core';
|
||||
import {OnChanges, SimpleChanges} from '../metadata/lifecycle_hooks';
|
||||
import {NgModuleDef, NgModuleDefInternal} from '../metadata/ng_module';
|
||||
import {RendererType2} from '../render/api';
|
||||
import {Type} from '../type';
|
||||
import {resolveRendererType2} from '../view/util';
|
||||
|
||||
import {diPublic} from './di';
|
||||
import {BaseDef, ComponentDefFeature, ComponentDefInternal, ComponentQuery, ComponentTemplate, ComponentType, DirectiveDefFeature, DirectiveDefInternal, DirectiveDefListOrFactory, DirectiveType, DirectiveTypesOrFactory, PipeDefInternal, PipeType, PipeTypesOrFactory} from './interfaces/definition';
|
||||
import {BaseDef, ComponentDefFeature, ComponentDefInternal, ComponentQuery, ComponentTemplate, ComponentType, DirectiveDefFeature, DirectiveDefInternal, DirectiveType, DirectiveTypesOrFactory, PipeDefInternal, PipeType, PipeTypesOrFactory} from './interfaces/definition';
|
||||
import {CssSelectorList, SelectorFlags} from './interfaces/projection';
|
||||
|
||||
|
||||
|
|
|
@ -772,13 +772,9 @@ export function getOrCreateTemplateRef<T>(di: LInjector): viewEngine.TemplateRef
|
|||
}
|
||||
|
||||
class TemplateRef<T> implements viewEngine.TemplateRef<T> {
|
||||
readonly elementRef: viewEngine.ElementRef;
|
||||
|
||||
constructor(
|
||||
private _declarationParentView: LViewData, elementRef: viewEngine.ElementRef,
|
||||
private _tView: TView, private _renderer: Renderer3, private _queries: LQueries|null) {
|
||||
this.elementRef = elementRef;
|
||||
}
|
||||
private _declarationParentView: LViewData, readonly elementRef: viewEngine.ElementRef,
|
||||
private _tView: TView, private _renderer: Renderer3, private _queries: LQueries|null) {}
|
||||
|
||||
createEmbeddedView(context: T, containerNode?: LContainerNode, index?: number):
|
||||
viewEngine.EmbeddedViewRef<T> {
|
||||
|
|
|
@ -11,7 +11,6 @@ import {defineBase, defineComponent, defineDirective, defineNgModule, definePipe
|
|||
import {InheritDefinitionFeature} from './features/inherit_definition_feature';
|
||||
import {NgOnChangesFeature} from './features/ng_onchanges_feature';
|
||||
import {PublicFeature} from './features/public_feature';
|
||||
import {I18nExpInstruction, I18nInstruction, i18nExpMapping, i18nInterpolation1, i18nInterpolation2, i18nInterpolation3, i18nInterpolation4, i18nInterpolation5, i18nInterpolation6, i18nInterpolation7, i18nInterpolation8, i18nInterpolationV} from './i18n';
|
||||
import {ComponentDef, ComponentDefInternal, ComponentTemplate, ComponentType, DirectiveDef, DirectiveDefFlags, DirectiveDefInternal, DirectiveType, PipeDef} from './interfaces/definition';
|
||||
|
||||
export {ComponentFactory, ComponentFactoryResolver, ComponentRef} from './component_ref';
|
||||
|
|
|
@ -12,7 +12,7 @@ import {Sanitizer} from '../../sanitization/security';
|
|||
|
||||
import {LContainer} from './container';
|
||||
import {ComponentQuery, ComponentTemplate, DirectiveDefInternal, DirectiveDefList, PipeDefInternal, PipeDefList} from './definition';
|
||||
import {LContainerNode, LElementNode, LViewNode, TNode} from './node';
|
||||
import {LElementNode, LViewNode, TNode} from './node';
|
||||
import {LQueries} from './query';
|
||||
import {Renderer3} from './renderer';
|
||||
|
||||
|
|
|
@ -22,11 +22,9 @@ import {convertDependencies, reflectDependencies} from './util';
|
|||
* Compile an Angular injectable according to its `Injectable` metadata, and patch the resulting
|
||||
* `ngInjectableDef` onto the injectable type.
|
||||
*/
|
||||
export function compileInjectable(type: Type<any>, meta?: Injectable): void {
|
||||
// TODO(alxhub): handle JIT of bare @Injectable().
|
||||
if (!meta) {
|
||||
return;
|
||||
}
|
||||
export function compileInjectable(type: Type<any>, srcMeta?: Injectable): void {
|
||||
// Allow the compilation of a class with a `@Injectable()` decorator without parameters
|
||||
const meta: Injectable = srcMeta || {providedIn: null};
|
||||
|
||||
let def: any = null;
|
||||
Object.defineProperty(type, NG_INJECTABLE_DEF, {
|
||||
|
|
|
@ -13,9 +13,8 @@ export const MODULE_SUFFIX = '';
|
|||
const builtinExternalReferences = createBuiltinExternalReferencesMap();
|
||||
|
||||
export class JitReflector implements CompileReflector {
|
||||
private reflectionCapabilities: ReflectionCapabilities;
|
||||
private builtinExternalReferences = new Map<ExternalReference, any>();
|
||||
constructor() { this.reflectionCapabilities = new ReflectionCapabilities(); }
|
||||
private reflectionCapabilities: ReflectionCapabilities = new ReflectionCapabilities();
|
||||
|
||||
componentModuleUrl(type: any, cmpMetadata: Component): string {
|
||||
const moduleId = cmpMetadata.moduleId;
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {COMPILER_OPTIONS, CompilerFactory, Injector, PlatformRef, StaticProvider, createPlatformFactory} from '@angular/core';
|
||||
import {TestComponentRenderer, ɵTestingCompilerFactory as TestingCompilerFactory} from '@angular/core/testing';
|
||||
import {COMPILER_OPTIONS, CompilerFactory, Injector, PlatformRef, createPlatformFactory} from '@angular/core';
|
||||
import {ɵTestingCompilerFactory as TestingCompilerFactory} from '@angular/core/testing';
|
||||
import {ɵplatformCoreDynamic as platformCoreDynamic} from '@angular/platform-browser-dynamic';
|
||||
|
||||
import {COMPILER_PROVIDERS, TestingCompilerFactoryImpl} from './compiler_factory';
|
||||
|
|
|
@ -7,20 +7,17 @@
|
|||
*/
|
||||
|
||||
import {CommonModule, PlatformLocation, ɵPLATFORM_BROWSER_ID as PLATFORM_BROWSER_ID} from '@angular/common';
|
||||
import {APP_ID, ApplicationModule, ClassProvider, ConstructorSansProvider, ErrorHandler, ExistingProvider, FactoryProvider, Inject, InjectionToken, ModuleWithProviders, NgModule, NgZone, Optional, PLATFORM_ID, PLATFORM_INITIALIZER, PlatformRef, RendererFactory2, RootRenderer, Sanitizer, SkipSelf, StaticProvider, Testability, TypeProvider, ValueProvider, createPlatformFactory, platformCore, ɵAPP_ROOT as APP_ROOT, ɵConsole as Console} from '@angular/core';
|
||||
import {APP_ID, ApplicationModule, ErrorHandler, Inject, ModuleWithProviders, NgModule, NgZone, Optional, PLATFORM_ID, PLATFORM_INITIALIZER, PlatformRef, RendererFactory2, Sanitizer, SkipSelf, StaticProvider, Testability, createPlatformFactory, platformCore, ɵAPP_ROOT as APP_ROOT, ɵConsole as Console} from '@angular/core';
|
||||
|
||||
import {BrowserDomAdapter} from './browser/browser_adapter';
|
||||
import {BrowserPlatformLocation} from './browser/location/browser_platform_location';
|
||||
import {Meta} from './browser/meta';
|
||||
import {SERVER_TRANSITION_PROVIDERS, TRANSITION_ID} from './browser/server-transition';
|
||||
import {BrowserGetTestability} from './browser/testability';
|
||||
import {Title} from './browser/title';
|
||||
import {ELEMENT_PROBE_PROVIDERS} from './dom/debug/ng_probe';
|
||||
import {getDOM} from './dom/dom_adapter';
|
||||
import {DomRendererFactory2} from './dom/dom_renderer';
|
||||
import {DOCUMENT} from './dom/dom_tokens';
|
||||
import {DomEventsPlugin} from './dom/events/dom_events';
|
||||
import {EVENT_MANAGER_PLUGINS, EventManager, EventManagerPlugin} from './dom/events/event_manager';
|
||||
import {EVENT_MANAGER_PLUGINS, EventManager} from './dom/events/event_manager';
|
||||
import {HAMMER_GESTURE_CONFIG, HAMMER_LOADER, HammerGestureConfig, HammerGesturesPlugin} from './dom/events/hammer_gestures';
|
||||
import {KeyEventsPlugin} from './dom/events/key_events';
|
||||
import {DomSharedStylesHost, SharedStylesHost} from './dom/shared_styles_host';
|
||||
|
|
Loading…
Reference in New Issue