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). */
|
|
|
|
|
export interface LQuery {
|
|
|
|
|
/**
|
|
|
|
|
* Used to ask query if it should be cloned to the child element.
|
|
|
|
|
*
|
|
|
|
|
* For example in the case of deep queries the `child()` returns
|
|
|
|
|
* query for the child node. In case of shallow queries it returns
|
|
|
|
|
* `null`.
|
|
|
|
|
*/
|
|
|
|
|
child(): LQuery|null;
|
|
|
|
|
|
|
|
|
|
/**
|
2018-01-17 17:55:55 +01:00
|
|
|
* Notify `LQuery` that a new `LNode` has been created and needs to be added to query results
|
|
|
|
|
* if matching query predicate.
|
2018-01-09 18:38:17 -08:00
|
|
|
*/
|
|
|
|
|
addNode(node: LNode): void;
|
|
|
|
|
|
|
|
|
|
/**
|
2018-01-17 17:55:55 +01:00
|
|
|
* Notify `LQuery` that a `LNode` has been created and needs to be added to query results
|
|
|
|
|
* if matching query predicate.
|
|
|
|
|
*/
|
|
|
|
|
container(): LQuery|null;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Notify `LQuery` that a new view was created and is being entered in the creation mode.
|
|
|
|
|
* This allow queries to prepare space for matching nodes from views.
|
2018-01-09 18:38:17 -08:00
|
|
|
*/
|
2018-01-17 17:55:55 +01:00
|
|
|
enterView(newViewIndex: number): LQuery|null;
|
2018-01-09 18:38:17 -08:00
|
|
|
|
|
|
|
|
/**
|
2018-01-17 17:55:55 +01:00
|
|
|
* Notify `LQuery` that an `LViewNode` has been removed from `LContainerNode`. As a result all
|
|
|
|
|
* 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;
|