refactor(ivy): remove content query creation from directive factories (#24811)

PR Close #24811
This commit is contained in:
Pawel Kozlowski
2018-07-10 10:43:07 +02:00
committed by Matias Niemelä
parent 328971ffcc
commit 0399c6972a
11 changed files with 205 additions and 75 deletions

View File

@ -48,7 +48,7 @@ export function defineComponent<T>(componentDefinition: {
/**
* Factory method used to create an instance of directive.
*/
factory: () => T | ({0: T} & any[]); /* trying to say T | [T, ...any] */
factory: () => T;
/**
* Static attributes to set on host element.
@ -120,6 +120,14 @@ export function defineComponent<T>(componentDefinition: {
*/
hostBindings?: (directiveIndex: number, elementIndex: number) => void;
/**
* Function to create instances of content queries associated with a given directive.
*/
contentQueries?: (() => void);
/** Refreshes content queries associated with directives in a given view */
contentQueriesRefresh?: ((directiveIndex: number, queryIndex: number) => void);
/**
* Defines the name that can be used in the template to assign this directive to a variable.
*
@ -216,6 +224,8 @@ export function defineComponent<T>(componentDefinition: {
factory: componentDefinition.factory,
template: componentDefinition.template || null !,
hostBindings: componentDefinition.hostBindings || null,
contentQueries: componentDefinition.contentQueries || null,
contentQueriesRefresh: componentDefinition.contentQueriesRefresh || null,
attributes: componentDefinition.attributes || null,
inputs: invertObject(componentDefinition.inputs, declaredInputs),
declaredInputs: declaredInputs,
@ -448,6 +458,14 @@ export const defineDirective = defineComponent as any as<T>(directiveDefinition:
*/
hostBindings?: (directiveIndex: number, elementIndex: number) => void;
/**
* Function to create instances of content queries associated with a given directive.
*/
contentQueries?: (() => void);
/** Refreshes content queries associated with directives in a given view */
contentQueriesRefresh?: ((directiveIndex: number, queryIndex: number) => void);
/**
* Defines the name that can be used in the template to assign this directive to a variable.
*