feat(ivy): support providers and viewProviders (#25803)
PR Close #25803
This commit is contained in:

committed by
Matias Niemelä

parent
9dc52d9d04
commit
b0476f308b
@ -54,7 +54,7 @@ export function defineComponent<T>(componentDefinition: {
|
||||
/**
|
||||
* Factory method used to create an instance of directive.
|
||||
*/
|
||||
factory: () => T;
|
||||
factory: (t: Type<T>| null) => T;
|
||||
|
||||
/**
|
||||
* The number of nodes, local refs, and pipes in this component template.
|
||||
@ -154,7 +154,7 @@ export function defineComponent<T>(componentDefinition: {
|
||||
/**
|
||||
* Function to create instances of content queries associated with a given directive.
|
||||
*/
|
||||
contentQueries?: (() => void);
|
||||
contentQueries?: ((dirIndex: number) => void);
|
||||
|
||||
/** Refreshes content queries associated with directives in a given view */
|
||||
contentQueriesRefresh?: ((directiveIndex: number, queryIndex: number) => void);
|
||||
@ -210,7 +210,7 @@ export function defineComponent<T>(componentDefinition: {
|
||||
/**
|
||||
* A list of optional features to apply.
|
||||
*
|
||||
* See: {@link NgOnChangesFeature}, {@link PublicFeature}
|
||||
* See: {@link NgOnChangesFeature}, {@link ProvidersFeature}
|
||||
*/
|
||||
features?: ComponentDefFeature[];
|
||||
|
||||
@ -238,17 +238,6 @@ export function defineComponent<T>(componentDefinition: {
|
||||
*/
|
||||
changeDetection?: ChangeDetectionStrategy;
|
||||
|
||||
/**
|
||||
* Defines the set of injectable objects that are visible to a Directive and its light DOM
|
||||
* children.
|
||||
*/
|
||||
providers?: Provider[];
|
||||
|
||||
/**
|
||||
* Defines the set of injectable objects that are visible to its view DOM children.
|
||||
*/
|
||||
viewProviders?: Provider[];
|
||||
|
||||
/**
|
||||
* Registry of directives and components that may be found in this component's view.
|
||||
*
|
||||
@ -270,7 +259,7 @@ export function defineComponent<T>(componentDefinition: {
|
||||
const declaredInputs: {[key: string]: string} = {} as any;
|
||||
const def: Mutable<ComponentDef<any>, keyof ComponentDef<any>> = {
|
||||
type: type,
|
||||
diPublic: null,
|
||||
providersResolver: null,
|
||||
consts: componentDefinition.consts,
|
||||
vars: componentDefinition.vars,
|
||||
hostVars: componentDefinition.hostVars || 0,
|
||||
@ -301,8 +290,6 @@ export function defineComponent<T>(componentDefinition: {
|
||||
// TODO(misko): convert ViewEncapsulation into const enum so that it can be used directly in the
|
||||
// next line. Also `None` should be 0 not 2.
|
||||
encapsulation: componentDefinition.encapsulation || ViewEncapsulation.Emulated,
|
||||
providers: EMPTY_ARRAY,
|
||||
viewProviders: EMPTY_ARRAY,
|
||||
id: 'c',
|
||||
styles: componentDefinition.styles || EMPTY_ARRAY,
|
||||
_: null as never,
|
||||
@ -525,7 +512,7 @@ export const defineDirective = defineComponent as any as<T>(directiveDefinition:
|
||||
/**
|
||||
* Factory method used to create an instance of directive.
|
||||
*/
|
||||
factory: () => T;
|
||||
factory: (t: Type<T>| null) => T;
|
||||
|
||||
/**
|
||||
* Static attributes to set on host element.
|
||||
@ -595,7 +582,7 @@ export const defineDirective = defineComponent as any as<T>(directiveDefinition:
|
||||
/**
|
||||
* A list of optional features to apply.
|
||||
*
|
||||
* See: {@link NgOnChangesFeature}, {@link PublicFeature}, {@link InheritDefinitionFeature}
|
||||
* See: {@link NgOnChangesFeature}, {@link ProvidersFeature}, {@link InheritDefinitionFeature}
|
||||
*/
|
||||
features?: DirectiveDefFeature[];
|
||||
|
||||
@ -615,7 +602,7 @@ export const defineDirective = defineComponent as any as<T>(directiveDefinition:
|
||||
/**
|
||||
* Function to create instances of content queries associated with a given directive.
|
||||
*/
|
||||
contentQueries?: (() => void);
|
||||
contentQueries?: ((directiveIndex: number) => void);
|
||||
|
||||
/** Refreshes content queries associated with directives in a given view */
|
||||
contentQueriesRefresh?: ((directiveIndex: number, queryIndex: number) => void);
|
||||
@ -650,7 +637,7 @@ export function definePipe<T>(pipeDef: {
|
||||
type: Type<T>,
|
||||
|
||||
/** A factory for creating a pipe instance. */
|
||||
factory: () => T,
|
||||
factory: (t: Type<T>| null) => T,
|
||||
|
||||
/** Whether the pipe is pure. */
|
||||
pure?: boolean
|
||||
|
Reference in New Issue
Block a user