1 | /**
|
---|
2 | * @license
|
---|
3 | * Copyright Google LLC All Rights Reserved.
|
---|
4 | *
|
---|
5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
6 | * found in the LICENSE file at https://angular.io/license
|
---|
7 | */
|
---|
8 | import { ElementRef, unwrapElementRef } from '../linker/element_ref';
|
---|
9 | import { QueryList } from '../linker/query_list';
|
---|
10 | import { asElementData, asProviderData, asQueryList } from './types';
|
---|
11 | import { declaredViewContainer, filterQueryId, isEmbeddedView } from './util';
|
---|
12 | export function queryDef(flags, id, bindings) {
|
---|
13 | let bindingDefs = [];
|
---|
14 | for (let propName in bindings) {
|
---|
15 | const bindingType = bindings[propName];
|
---|
16 | bindingDefs.push({ propName, bindingType });
|
---|
17 | }
|
---|
18 | return {
|
---|
19 | // will bet set by the view definition
|
---|
20 | nodeIndex: -1,
|
---|
21 | parent: null,
|
---|
22 | renderParent: null,
|
---|
23 | bindingIndex: -1,
|
---|
24 | outputIndex: -1,
|
---|
25 | // regular values
|
---|
26 | // TODO(vicb): check
|
---|
27 | checkIndex: -1,
|
---|
28 | flags,
|
---|
29 | childFlags: 0,
|
---|
30 | directChildFlags: 0,
|
---|
31 | childMatchedQueries: 0,
|
---|
32 | ngContentIndex: -1,
|
---|
33 | matchedQueries: {},
|
---|
34 | matchedQueryIds: 0,
|
---|
35 | references: {},
|
---|
36 | childCount: 0,
|
---|
37 | bindings: [],
|
---|
38 | bindingFlags: 0,
|
---|
39 | outputs: [],
|
---|
40 | element: null,
|
---|
41 | provider: null,
|
---|
42 | text: null,
|
---|
43 | query: { id, filterId: filterQueryId(id), bindings: bindingDefs },
|
---|
44 | ngContent: null
|
---|
45 | };
|
---|
46 | }
|
---|
47 | export function createQuery(emitDistinctChangesOnly) {
|
---|
48 | return new QueryList(emitDistinctChangesOnly);
|
---|
49 | }
|
---|
50 | export function dirtyParentQueries(view) {
|
---|
51 | const queryIds = view.def.nodeMatchedQueries;
|
---|
52 | while (view.parent && isEmbeddedView(view)) {
|
---|
53 | let tplDef = view.parentNodeDef;
|
---|
54 | view = view.parent;
|
---|
55 | // content queries
|
---|
56 | const end = tplDef.nodeIndex + tplDef.childCount;
|
---|
57 | for (let i = 0; i <= end; i++) {
|
---|
58 | const nodeDef = view.def.nodes[i];
|
---|
59 | if ((nodeDef.flags & 67108864 /* TypeContentQuery */) &&
|
---|
60 | (nodeDef.flags & 536870912 /* DynamicQuery */) &&
|
---|
61 | (nodeDef.query.filterId & queryIds) === nodeDef.query.filterId) {
|
---|
62 | asQueryList(view, i).setDirty();
|
---|
63 | }
|
---|
64 | if ((nodeDef.flags & 1 /* TypeElement */ && i + nodeDef.childCount < tplDef.nodeIndex) ||
|
---|
65 | !(nodeDef.childFlags & 67108864 /* TypeContentQuery */) ||
|
---|
66 | !(nodeDef.childFlags & 536870912 /* DynamicQuery */)) {
|
---|
67 | // skip elements that don't contain the template element or no query.
|
---|
68 | i += nodeDef.childCount;
|
---|
69 | }
|
---|
70 | }
|
---|
71 | }
|
---|
72 | // view queries
|
---|
73 | if (view.def.nodeFlags & 134217728 /* TypeViewQuery */) {
|
---|
74 | for (let i = 0; i < view.def.nodes.length; i++) {
|
---|
75 | const nodeDef = view.def.nodes[i];
|
---|
76 | if ((nodeDef.flags & 134217728 /* TypeViewQuery */) && (nodeDef.flags & 536870912 /* DynamicQuery */)) {
|
---|
77 | asQueryList(view, i).setDirty();
|
---|
78 | }
|
---|
79 | // only visit the root nodes
|
---|
80 | i += nodeDef.childCount;
|
---|
81 | }
|
---|
82 | }
|
---|
83 | }
|
---|
84 | export function checkAndUpdateQuery(view, nodeDef) {
|
---|
85 | const queryList = asQueryList(view, nodeDef.nodeIndex);
|
---|
86 | if (!queryList.dirty) {
|
---|
87 | return;
|
---|
88 | }
|
---|
89 | let directiveInstance;
|
---|
90 | let newValues = undefined;
|
---|
91 | if (nodeDef.flags & 67108864 /* TypeContentQuery */) {
|
---|
92 | const elementDef = nodeDef.parent.parent;
|
---|
93 | newValues = calcQueryValues(view, elementDef.nodeIndex, elementDef.nodeIndex + elementDef.childCount, nodeDef.query, []);
|
---|
94 | directiveInstance = asProviderData(view, nodeDef.parent.nodeIndex).instance;
|
---|
95 | }
|
---|
96 | else if (nodeDef.flags & 134217728 /* TypeViewQuery */) {
|
---|
97 | newValues = calcQueryValues(view, 0, view.def.nodes.length - 1, nodeDef.query, []);
|
---|
98 | directiveInstance = view.component;
|
---|
99 | }
|
---|
100 | queryList.reset(newValues, unwrapElementRef);
|
---|
101 | const bindings = nodeDef.query.bindings;
|
---|
102 | let notify = false;
|
---|
103 | for (let i = 0; i < bindings.length; i++) {
|
---|
104 | const binding = bindings[i];
|
---|
105 | let boundValue;
|
---|
106 | switch (binding.bindingType) {
|
---|
107 | case 0 /* First */:
|
---|
108 | boundValue = queryList.first;
|
---|
109 | break;
|
---|
110 | case 1 /* All */:
|
---|
111 | boundValue = queryList;
|
---|
112 | notify = true;
|
---|
113 | break;
|
---|
114 | }
|
---|
115 | directiveInstance[binding.propName] = boundValue;
|
---|
116 | }
|
---|
117 | if (notify) {
|
---|
118 | queryList.notifyOnChanges();
|
---|
119 | }
|
---|
120 | }
|
---|
121 | function calcQueryValues(view, startIndex, endIndex, queryDef, values) {
|
---|
122 | for (let i = startIndex; i <= endIndex; i++) {
|
---|
123 | const nodeDef = view.def.nodes[i];
|
---|
124 | const valueType = nodeDef.matchedQueries[queryDef.id];
|
---|
125 | if (valueType != null) {
|
---|
126 | values.push(getQueryValue(view, nodeDef, valueType));
|
---|
127 | }
|
---|
128 | if (nodeDef.flags & 1 /* TypeElement */ && nodeDef.element.template &&
|
---|
129 | (nodeDef.element.template.nodeMatchedQueries & queryDef.filterId) ===
|
---|
130 | queryDef.filterId) {
|
---|
131 | const elementData = asElementData(view, i);
|
---|
132 | // check embedded views that were attached at the place of their template,
|
---|
133 | // but process child nodes first if some match the query (see issue #16568)
|
---|
134 | if ((nodeDef.childMatchedQueries & queryDef.filterId) === queryDef.filterId) {
|
---|
135 | calcQueryValues(view, i + 1, i + nodeDef.childCount, queryDef, values);
|
---|
136 | i += nodeDef.childCount;
|
---|
137 | }
|
---|
138 | if (nodeDef.flags & 16777216 /* EmbeddedViews */) {
|
---|
139 | const embeddedViews = elementData.viewContainer._embeddedViews;
|
---|
140 | for (let k = 0; k < embeddedViews.length; k++) {
|
---|
141 | const embeddedView = embeddedViews[k];
|
---|
142 | const dvc = declaredViewContainer(embeddedView);
|
---|
143 | if (dvc && dvc === elementData) {
|
---|
144 | calcQueryValues(embeddedView, 0, embeddedView.def.nodes.length - 1, queryDef, values);
|
---|
145 | }
|
---|
146 | }
|
---|
147 | }
|
---|
148 | const projectedViews = elementData.template._projectedViews;
|
---|
149 | if (projectedViews) {
|
---|
150 | for (let k = 0; k < projectedViews.length; k++) {
|
---|
151 | const projectedView = projectedViews[k];
|
---|
152 | calcQueryValues(projectedView, 0, projectedView.def.nodes.length - 1, queryDef, values);
|
---|
153 | }
|
---|
154 | }
|
---|
155 | }
|
---|
156 | if ((nodeDef.childMatchedQueries & queryDef.filterId) !== queryDef.filterId) {
|
---|
157 | // if no child matches the query, skip the children.
|
---|
158 | i += nodeDef.childCount;
|
---|
159 | }
|
---|
160 | }
|
---|
161 | return values;
|
---|
162 | }
|
---|
163 | export function getQueryValue(view, nodeDef, queryValueType) {
|
---|
164 | if (queryValueType != null) {
|
---|
165 | // a match
|
---|
166 | switch (queryValueType) {
|
---|
167 | case 1 /* RenderElement */:
|
---|
168 | return asElementData(view, nodeDef.nodeIndex).renderElement;
|
---|
169 | case 0 /* ElementRef */:
|
---|
170 | return new ElementRef(asElementData(view, nodeDef.nodeIndex).renderElement);
|
---|
171 | case 2 /* TemplateRef */:
|
---|
172 | return asElementData(view, nodeDef.nodeIndex).template;
|
---|
173 | case 3 /* ViewContainerRef */:
|
---|
174 | return asElementData(view, nodeDef.nodeIndex).viewContainer;
|
---|
175 | case 4 /* Provider */:
|
---|
176 | return asProviderData(view, nodeDef.nodeIndex).instance;
|
---|
177 | }
|
---|
178 | }
|
---|
179 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