2018-01-09 18:38:17 -08:00
|
|
|
/**
|
|
|
|
|
* @license
|
|
|
|
|
* Copyright Google Inc. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
|
|
|
* found in the LICENSE file at https://angular.io/license
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import {QueryList} from '../../linker';
|
|
|
|
|
import {Type} from '../../type';
|
2018-01-17 17:55:55 +01:00
|
|
|
import {LNode} from './node';
|
2018-01-09 18:38:17 -08:00
|
|
|
|
|
|
|
|
/** Used for tracking queries (e.g. ViewChild, ContentChild). */
|
2018-01-29 14:51:37 +01:00
|
|
|
export interface LQueries {
|
2018-01-09 18:38:17 -08:00
|
|
|
/**
|
2018-01-29 14:51:37 +01:00
|
|
|
* Used to ask queries if those should be cloned to the child element.
|
2018-01-09 18:38:17 -08:00
|
|
|
*
|
|
|
|
|
* For example in the case of deep queries the `child()` returns
|
2018-01-29 14:51:37 +01:00
|
|
|
* queries for the child node. In case of shallow queries it returns
|
2018-01-09 18:38:17 -08:00
|
|
|
* `null`.
|
|
|
|
|
*/
|
2018-01-29 14:51:37 +01:00
|
|
|
child(): LQueries|null;
|
2018-01-09 18:38:17 -08:00
|
|
|
|
|
|
|
|
/**
|
2018-01-29 14:51:37 +01:00
|
|
|
* Notify `LQueries` that a new `LNode` has been created and needs to be added to query results
|
2018-01-17 17:55:55 +01:00
|
|
|
* if matching query predicate.
|
2018-01-09 18:38:17 -08:00
|
|
|
*/
|
|
|
|
|
addNode(node: LNode): void;
|
|
|
|
|
|
|
|
|
|
/**
|
2018-05-28 11:57:36 +02:00
|
|
|
* Notify `LQueries` that a new LContainer was added to ivy data structures. As a result we need
|
|
|
|
|
* to prepare room for views that might be inserted into this container.
|
2018-01-17 17:55:55 +01:00
|
|
|
*/
|
2018-01-29 14:51:37 +01:00
|
|
|
container(): LQueries|null;
|
2018-01-17 17:55:55 +01:00
|
|
|
|
|
|
|
|
/**
|
2018-05-28 11:57:36 +02:00
|
|
|
* Notify `LQueries` that a new `LView` has been created. As a result we need to prepare room
|
|
|
|
|
* and collect nodes that match query predicate.
|
|
|
|
|
*/
|
|
|
|
|
createView(): LQueries|null;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Notify `LQueries` that a new `LView` has been added to `LContainer`. As a result all
|
|
|
|
|
* the matching nodes from this view should be added to container's queries.
|
2018-01-09 18:38:17 -08:00
|
|
|
*/
|
2018-05-28 11:57:36 +02:00
|
|
|
insertView(newViewIndex: number): void;
|
2018-01-09 18:38:17 -08:00
|
|
|
|
|
|
|
|
/**
|
2018-05-28 11:57:36 +02:00
|
|
|
* Notify `LQueries` that an `LView` has been removed from `LContainer`. As a result all
|
2018-01-17 17:55:55 +01:00
|
|
|
* the matching nodes from this view should be removed from container's queries.
|
2018-01-09 18:38:17 -08:00
|
|
|
*/
|
2018-01-17 17:55:55 +01:00
|
|
|
removeView(removeIndex: number): void;
|
2018-01-09 18:38:17 -08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Add additional `QueryList` to track.
|
|
|
|
|
*
|
|
|
|
|
* @param queryList `QueryList` to update with changes.
|
|
|
|
|
* @param predicate Either `Type` or selector array of [key, value] predicates.
|
|
|
|
|
* @param descend If true the query will recursively apply to the children.
|
|
|
|
|
* @param read Indicates which token should be read from DI for this query.
|
|
|
|
|
*/
|
|
|
|
|
track<T>(
|
|
|
|
|
queryList: QueryList<T>, predicate: Type<any>|string[], descend?: boolean,
|
2018-01-17 09:45:40 -08:00
|
|
|
read?: QueryReadType<T>|Type<T>): void;
|
2018-01-09 18:38:17 -08:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 09:45:40 -08:00
|
|
|
export class QueryReadType<T> { private defeatStructuralTyping: any; }
|
2018-01-09 18:38:17 -08:00
|
|
|
|
|
|
|
|
// Note: This hack is necessary so we don't erroneously get a circular dependency
|
|
|
|
|
// failure based on types.
|
|
|
|
|
export const unusedValueExportToPlacateAjd = 1;
|