@angular/core 13.2.1 → 13.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core.d.ts +55 -80
- package/esm2020/src/application_module.mjs +1 -10
- package/esm2020/src/application_ref.mjs +3 -22
- package/esm2020/src/debug/debug_node.mjs +128 -45
- package/esm2020/src/linker/view_container_ref.mjs +24 -6
- package/esm2020/src/render3/instructions/element.mjs +7 -1
- package/esm2020/src/render3/instructions/element_container.mjs +7 -1
- package/esm2020/src/version.mjs +1 -1
- package/esm2020/testing/src/logger.mjs +3 -3
- package/esm2020/testing/src/ng_zone_mock.mjs +3 -3
- package/fesm2015/core.mjs +166 -80
- package/fesm2015/core.mjs.map +1 -1
- package/fesm2015/testing.mjs +1 -1
- package/fesm2020/core.mjs +166 -80
- package/fesm2020/core.mjs.map +1 -1
- package/fesm2020/testing.mjs +1 -1
- package/package.json +1 -1
- package/testing/testing.d.ts +1 -1
package/fesm2015/testing.mjs
CHANGED
package/fesm2020/core.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v13.2.
|
|
2
|
+
* @license Angular v13.2.4
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -14506,6 +14506,7 @@ function elementStartFirstCreatePass(index, tView, lView, native, name, attrsInd
|
|
|
14506
14506
|
* @param name Name of the DOM Node
|
|
14507
14507
|
* @param attrsIndex Index of the element's attributes in the `consts` array.
|
|
14508
14508
|
* @param localRefsIndex Index of the element's local references in the `consts` array.
|
|
14509
|
+
* @returns This function returns itself so that it may be chained.
|
|
14509
14510
|
*
|
|
14510
14511
|
* Attributes and localRefs are passed as an array of strings where elements with an even index
|
|
14511
14512
|
* hold an attribute name and elements with an odd index hold an attribute value, ex.:
|
|
@@ -14557,9 +14558,11 @@ function ɵɵelementStart(index, name, attrsIndex, localRefsIndex) {
|
|
|
14557
14558
|
if (localRefsIndex !== null) {
|
|
14558
14559
|
saveResolvedLocalsInData(lView, tNode);
|
|
14559
14560
|
}
|
|
14561
|
+
return ɵɵelementStart;
|
|
14560
14562
|
}
|
|
14561
14563
|
/**
|
|
14562
14564
|
* Mark the end of the element.
|
|
14565
|
+
* @returns This function returns itself so that it may be chained.
|
|
14563
14566
|
*
|
|
14564
14567
|
* @codeGenApi
|
|
14565
14568
|
*/
|
|
@@ -14590,6 +14593,7 @@ function ɵɵelementEnd() {
|
|
|
14590
14593
|
if (tNode.stylesWithoutHost != null && hasStyleInput(tNode)) {
|
|
14591
14594
|
setDirectiveInputsWhichShadowsStyling(tView, tNode, getLView(), tNode.stylesWithoutHost, false);
|
|
14592
14595
|
}
|
|
14596
|
+
return ɵɵelementEnd;
|
|
14593
14597
|
}
|
|
14594
14598
|
/**
|
|
14595
14599
|
* Creates an empty element using {@link elementStart} and {@link elementEnd}
|
|
@@ -14598,12 +14602,14 @@ function ɵɵelementEnd() {
|
|
|
14598
14602
|
* @param name Name of the DOM Node
|
|
14599
14603
|
* @param attrsIndex Index of the element's attributes in the `consts` array.
|
|
14600
14604
|
* @param localRefsIndex Index of the element's local references in the `consts` array.
|
|
14605
|
+
* @returns This function returns itself so that it may be chained.
|
|
14601
14606
|
*
|
|
14602
14607
|
* @codeGenApi
|
|
14603
14608
|
*/
|
|
14604
14609
|
function ɵɵelement(index, name, attrsIndex, localRefsIndex) {
|
|
14605
14610
|
ɵɵelementStart(index, name, attrsIndex, localRefsIndex);
|
|
14606
14611
|
ɵɵelementEnd();
|
|
14612
|
+
return ɵɵelement;
|
|
14607
14613
|
}
|
|
14608
14614
|
function logUnknownElementError(tView, element, tNode, hasDirectives) {
|
|
14609
14615
|
const schemas = tView.schemas;
|
|
@@ -14672,6 +14678,7 @@ function elementContainerStartFirstCreatePass(index, tView, lView, attrsIndex, l
|
|
|
14672
14678
|
* @param index Index of the element in the LView array
|
|
14673
14679
|
* @param attrsIndex Index of the container attributes in the `consts` array.
|
|
14674
14680
|
* @param localRefsIndex Index of the container's local references in the `consts` array.
|
|
14681
|
+
* @returns This function returns itself so that it may be chained.
|
|
14675
14682
|
*
|
|
14676
14683
|
* Even if this instruction accepts a set of attributes no actual attribute values are propagated to
|
|
14677
14684
|
* the DOM (as a comment node can't have attributes). Attributes are here only for directive
|
|
@@ -14702,9 +14709,11 @@ function ɵɵelementContainerStart(index, attrsIndex, localRefsIndex) {
|
|
|
14702
14709
|
if (localRefsIndex != null) {
|
|
14703
14710
|
saveResolvedLocalsInData(lView, tNode);
|
|
14704
14711
|
}
|
|
14712
|
+
return ɵɵelementContainerStart;
|
|
14705
14713
|
}
|
|
14706
14714
|
/**
|
|
14707
14715
|
* Mark the end of the <ng-container>.
|
|
14716
|
+
* @returns This function returns itself so that it may be chained.
|
|
14708
14717
|
*
|
|
14709
14718
|
* @codeGenApi
|
|
14710
14719
|
*/
|
|
@@ -14726,6 +14735,7 @@ function ɵɵelementContainerEnd() {
|
|
|
14726
14735
|
tView.queries.elementEnd(currentTNode);
|
|
14727
14736
|
}
|
|
14728
14737
|
}
|
|
14738
|
+
return ɵɵelementContainerEnd;
|
|
14729
14739
|
}
|
|
14730
14740
|
/**
|
|
14731
14741
|
* Creates an empty logical container using {@link elementContainerStart}
|
|
@@ -14734,12 +14744,14 @@ function ɵɵelementContainerEnd() {
|
|
|
14734
14744
|
* @param index Index of the element in the LView array
|
|
14735
14745
|
* @param attrsIndex Index of the container attributes in the `consts` array.
|
|
14736
14746
|
* @param localRefsIndex Index of the container's local references in the `consts` array.
|
|
14747
|
+
* @returns This function returns itself so that it may be chained.
|
|
14737
14748
|
*
|
|
14738
14749
|
* @codeGenApi
|
|
14739
14750
|
*/
|
|
14740
14751
|
function ɵɵelementContainer(index, attrsIndex, localRefsIndex) {
|
|
14741
14752
|
ɵɵelementContainerStart(index, attrsIndex, localRefsIndex);
|
|
14742
14753
|
ɵɵelementContainerEnd();
|
|
14754
|
+
return ɵɵelementContainer;
|
|
14743
14755
|
}
|
|
14744
14756
|
|
|
14745
14757
|
/**
|
|
@@ -21090,7 +21102,7 @@ class Version {
|
|
|
21090
21102
|
/**
|
|
21091
21103
|
* @publicApi
|
|
21092
21104
|
*/
|
|
21093
|
-
const VERSION = new Version('13.2.
|
|
21105
|
+
const VERSION = new Version('13.2.4');
|
|
21094
21106
|
|
|
21095
21107
|
/**
|
|
21096
21108
|
* @license
|
|
@@ -22841,11 +22853,29 @@ const R3ViewContainerRef = class ViewContainerRef extends VE_ViewContainerRef {
|
|
|
22841
22853
|
componentFactoryOrType :
|
|
22842
22854
|
new ComponentFactory(getComponentDef(componentFactoryOrType));
|
|
22843
22855
|
const contextInjector = injector || this.parentInjector;
|
|
22844
|
-
|
|
22845
|
-
|
|
22846
|
-
//
|
|
22847
|
-
//
|
|
22848
|
-
|
|
22856
|
+
// If an `NgModuleRef` is not provided explicitly, try retrieving it from the DI tree.
|
|
22857
|
+
if (!ngModuleRef && componentFactory.ngModule == null) {
|
|
22858
|
+
// For the `ComponentFactory` case, entering this logic is very unlikely, since we expect that
|
|
22859
|
+
// an instance of a `ComponentFactory`, resolved via `ComponentFactoryResolver` would have an
|
|
22860
|
+
// `ngModule` field. This is possible in some test scenarios and potentially in some JIT-based
|
|
22861
|
+
// use-cases. For the `ComponentFactory` case we preserve backwards-compatibility and try
|
|
22862
|
+
// using a provided injector first, then fall back to the parent injector of this
|
|
22863
|
+
// `ViewContainerRef` instance.
|
|
22864
|
+
//
|
|
22865
|
+
// For the factory-less case, it's critical to establish a connection with the module
|
|
22866
|
+
// injector tree (by retrieving an instance of an `NgModuleRef` and accessing its injector),
|
|
22867
|
+
// so that a component can use DI tokens provided in MgModules. For this reason, we can not
|
|
22868
|
+
// rely on the provided injector, since it might be detached from the DI tree (for example, if
|
|
22869
|
+
// it was created via `Injector.create` without specifying a parent injector, or if an
|
|
22870
|
+
// injector is retrieved from an `NgModuleRef` created via `createNgModuleRef` using an
|
|
22871
|
+
// NgModule outside of a module tree). Instead, we always use `ViewContainerRef`'s parent
|
|
22872
|
+
// injector, which is normally connected to the DI tree, which includes module injector
|
|
22873
|
+
// subtree.
|
|
22874
|
+
const _injector = isComponentFactory ? contextInjector : this.parentInjector;
|
|
22875
|
+
// DO NOT REFACTOR. The code here used to have a `injector.get(NgModuleRef, null) ||
|
|
22876
|
+
// undefined` expression which seems to cause internal google apps to fail. This is documented
|
|
22877
|
+
// in the following internal bug issue: go/b/142967802
|
|
22878
|
+
const result = _injector.get(NgModuleRef$1, null);
|
|
22849
22879
|
if (result) {
|
|
22850
22880
|
ngModuleRef = result;
|
|
22851
22881
|
}
|
|
@@ -26014,26 +26044,7 @@ class PlatformRef {
|
|
|
26014
26044
|
this._destroyed = false;
|
|
26015
26045
|
}
|
|
26016
26046
|
/**
|
|
26017
|
-
* Creates an instance of an `@NgModule` for the given platform
|
|
26018
|
-
*
|
|
26019
|
-
* @usageNotes
|
|
26020
|
-
*
|
|
26021
|
-
* The following example creates the NgModule for a browser platform.
|
|
26022
|
-
*
|
|
26023
|
-
* ```typescript
|
|
26024
|
-
* my_module.ts:
|
|
26025
|
-
*
|
|
26026
|
-
* @NgModule({
|
|
26027
|
-
* imports: [BrowserModule]
|
|
26028
|
-
* })
|
|
26029
|
-
* class MyModule {}
|
|
26030
|
-
*
|
|
26031
|
-
* main.ts:
|
|
26032
|
-
* import {MyModuleNgFactory} from './my_module.ngfactory';
|
|
26033
|
-
* import {platformBrowser} from '@angular/platform-browser';
|
|
26034
|
-
*
|
|
26035
|
-
* let moduleRef = platformBrowser().bootstrapModuleFactory(MyModuleNgFactory);
|
|
26036
|
-
* ```
|
|
26047
|
+
* Creates an instance of an `@NgModule` for the given platform.
|
|
26037
26048
|
*
|
|
26038
26049
|
* @deprecated Passing NgModule factories as the `PlatformRef.bootstrapModuleFactory` function
|
|
26039
26050
|
* argument is deprecated. Use the `PlatformRef.bootstrapModule` API instead.
|
|
@@ -26087,7 +26098,7 @@ class PlatformRef {
|
|
|
26087
26098
|
});
|
|
26088
26099
|
}
|
|
26089
26100
|
/**
|
|
26090
|
-
* Creates an instance of an `@NgModule` for a given platform
|
|
26101
|
+
* Creates an instance of an `@NgModule` for a given platform.
|
|
26091
26102
|
*
|
|
26092
26103
|
* @usageNotes
|
|
26093
26104
|
* ### Simple Example
|
|
@@ -26830,8 +26841,6 @@ var ng_module_factory_loader_impl = {};
|
|
|
26830
26841
|
* Use of this source code is governed by an MIT-style license that can be
|
|
26831
26842
|
* found in the LICENSE file at https://angular.io/license
|
|
26832
26843
|
*/
|
|
26833
|
-
// TODO(alxhub): recombine the interfaces and implementations here and move the docs back onto the
|
|
26834
|
-
// original classes.
|
|
26835
26844
|
/**
|
|
26836
26845
|
* @publicApi
|
|
26837
26846
|
*/
|
|
@@ -26847,43 +26856,88 @@ class DebugEventListener {
|
|
|
26847
26856
|
function asNativeElements(debugEls) {
|
|
26848
26857
|
return debugEls.map((el) => el.nativeElement);
|
|
26849
26858
|
}
|
|
26850
|
-
|
|
26859
|
+
/**
|
|
26860
|
+
* @publicApi
|
|
26861
|
+
*/
|
|
26862
|
+
class DebugNode {
|
|
26851
26863
|
constructor(nativeNode) {
|
|
26852
26864
|
this.nativeNode = nativeNode;
|
|
26853
26865
|
}
|
|
26866
|
+
/**
|
|
26867
|
+
* The `DebugElement` parent. Will be `null` if this is the root element.
|
|
26868
|
+
*/
|
|
26854
26869
|
get parent() {
|
|
26855
26870
|
const parent = this.nativeNode.parentNode;
|
|
26856
|
-
return parent ? new
|
|
26871
|
+
return parent ? new DebugElement(parent) : null;
|
|
26857
26872
|
}
|
|
26873
|
+
/**
|
|
26874
|
+
* The host dependency injector. For example, the root element's component instance injector.
|
|
26875
|
+
*/
|
|
26858
26876
|
get injector() {
|
|
26859
26877
|
return getInjector(this.nativeNode);
|
|
26860
26878
|
}
|
|
26879
|
+
/**
|
|
26880
|
+
* The element's own component instance, if it has one.
|
|
26881
|
+
*/
|
|
26861
26882
|
get componentInstance() {
|
|
26862
26883
|
const nativeElement = this.nativeNode;
|
|
26863
26884
|
return nativeElement &&
|
|
26864
26885
|
(getComponent$1(nativeElement) || getOwningComponent(nativeElement));
|
|
26865
26886
|
}
|
|
26887
|
+
/**
|
|
26888
|
+
* An object that provides parent context for this element. Often an ancestor component instance
|
|
26889
|
+
* that governs this element.
|
|
26890
|
+
*
|
|
26891
|
+
* When an element is repeated within *ngFor, the context is an `NgForOf` whose `$implicit`
|
|
26892
|
+
* property is the value of the row instance value. For example, the `hero` in `*ngFor="let hero
|
|
26893
|
+
* of heroes"`.
|
|
26894
|
+
*/
|
|
26866
26895
|
get context() {
|
|
26867
26896
|
return getComponent$1(this.nativeNode) || getContext(this.nativeNode);
|
|
26868
26897
|
}
|
|
26898
|
+
/**
|
|
26899
|
+
* The callbacks attached to the component's @Output properties and/or the element's event
|
|
26900
|
+
* properties.
|
|
26901
|
+
*/
|
|
26869
26902
|
get listeners() {
|
|
26870
26903
|
return getListeners(this.nativeNode).filter(listener => listener.type === 'dom');
|
|
26871
26904
|
}
|
|
26905
|
+
/**
|
|
26906
|
+
* Dictionary of objects associated with template local variables (e.g. #foo), keyed by the local
|
|
26907
|
+
* variable name.
|
|
26908
|
+
*/
|
|
26872
26909
|
get references() {
|
|
26873
26910
|
return getLocalRefs(this.nativeNode);
|
|
26874
26911
|
}
|
|
26912
|
+
/**
|
|
26913
|
+
* This component's injector lookup tokens. Includes the component itself plus the tokens that the
|
|
26914
|
+
* component lists in its providers metadata.
|
|
26915
|
+
*/
|
|
26875
26916
|
get providerTokens() {
|
|
26876
26917
|
return getInjectionTokens(this.nativeNode);
|
|
26877
26918
|
}
|
|
26878
26919
|
}
|
|
26879
|
-
|
|
26920
|
+
/**
|
|
26921
|
+
* @publicApi
|
|
26922
|
+
*
|
|
26923
|
+
* @see [Component testing scenarios](guide/testing-components-scenarios)
|
|
26924
|
+
* @see [Basics of testing components](guide/testing-components-basics)
|
|
26925
|
+
* @see [Testing utility APIs](guide/testing-utility-apis)
|
|
26926
|
+
*/
|
|
26927
|
+
class DebugElement extends DebugNode {
|
|
26880
26928
|
constructor(nativeNode) {
|
|
26881
26929
|
ngDevMode && assertDomNode(nativeNode);
|
|
26882
26930
|
super(nativeNode);
|
|
26883
26931
|
}
|
|
26932
|
+
/**
|
|
26933
|
+
* The underlying DOM element at the root of the component.
|
|
26934
|
+
*/
|
|
26884
26935
|
get nativeElement() {
|
|
26885
26936
|
return this.nativeNode.nodeType == Node.ELEMENT_NODE ? this.nativeNode : null;
|
|
26886
26937
|
}
|
|
26938
|
+
/**
|
|
26939
|
+
* The element tag name, if it is an element.
|
|
26940
|
+
*/
|
|
26887
26941
|
get name() {
|
|
26888
26942
|
const context = getLContext(this.nativeNode);
|
|
26889
26943
|
if (context !== null) {
|
|
@@ -26924,6 +26978,9 @@ class DebugElement__POST_R3__ extends DebugNode__POST_R3__ {
|
|
|
26924
26978
|
collectPropertyBindings(properties, tNode, lView, tData);
|
|
26925
26979
|
return properties;
|
|
26926
26980
|
}
|
|
26981
|
+
/**
|
|
26982
|
+
* A map of attribute names to attribute values for an element.
|
|
26983
|
+
*/
|
|
26927
26984
|
get attributes() {
|
|
26928
26985
|
const attributes = {};
|
|
26929
26986
|
const element = this.nativeElement;
|
|
@@ -26972,12 +27029,29 @@ class DebugElement__POST_R3__ extends DebugNode__POST_R3__ {
|
|
|
26972
27029
|
}
|
|
26973
27030
|
return attributes;
|
|
26974
27031
|
}
|
|
27032
|
+
/**
|
|
27033
|
+
* The inline styles of the DOM element.
|
|
27034
|
+
*
|
|
27035
|
+
* Will be `null` if there is no `style` property on the underlying DOM element.
|
|
27036
|
+
*
|
|
27037
|
+
* @see [ElementCSSInlineStyle](https://developer.mozilla.org/en-US/docs/Web/API/ElementCSSInlineStyle/style)
|
|
27038
|
+
*/
|
|
26975
27039
|
get styles() {
|
|
26976
27040
|
if (this.nativeElement && this.nativeElement.style) {
|
|
26977
27041
|
return this.nativeElement.style;
|
|
26978
27042
|
}
|
|
26979
27043
|
return {};
|
|
26980
27044
|
}
|
|
27045
|
+
/**
|
|
27046
|
+
* A map containing the class names on the element as keys.
|
|
27047
|
+
*
|
|
27048
|
+
* This map is derived from the `className` property of the DOM element.
|
|
27049
|
+
*
|
|
27050
|
+
* Note: The values of this object will always be `true`. The class key will not appear in the KV
|
|
27051
|
+
* object if it does not exist on the element.
|
|
27052
|
+
*
|
|
27053
|
+
* @see [Element.className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className)
|
|
27054
|
+
*/
|
|
26981
27055
|
get classes() {
|
|
26982
27056
|
const result = {};
|
|
26983
27057
|
const element = this.nativeElement;
|
|
@@ -26987,15 +27061,23 @@ class DebugElement__POST_R3__ extends DebugNode__POST_R3__ {
|
|
|
26987
27061
|
classes.forEach((value) => result[value] = true);
|
|
26988
27062
|
return result;
|
|
26989
27063
|
}
|
|
27064
|
+
/**
|
|
27065
|
+
* The `childNodes` of the DOM element as a `DebugNode` array.
|
|
27066
|
+
*
|
|
27067
|
+
* @see [Node.childNodes](https://developer.mozilla.org/en-US/docs/Web/API/Node/childNodes)
|
|
27068
|
+
*/
|
|
26990
27069
|
get childNodes() {
|
|
26991
27070
|
const childNodes = this.nativeNode.childNodes;
|
|
26992
27071
|
const children = [];
|
|
26993
27072
|
for (let i = 0; i < childNodes.length; i++) {
|
|
26994
27073
|
const element = childNodes[i];
|
|
26995
|
-
children.push(
|
|
27074
|
+
children.push(getDebugNode(element));
|
|
26996
27075
|
}
|
|
26997
27076
|
return children;
|
|
26998
27077
|
}
|
|
27078
|
+
/**
|
|
27079
|
+
* The immediate `DebugElement` children. Walk the tree by descending through `children`.
|
|
27080
|
+
*/
|
|
26999
27081
|
get children() {
|
|
27000
27082
|
const nativeElement = this.nativeElement;
|
|
27001
27083
|
if (!nativeElement)
|
|
@@ -27004,24 +27086,45 @@ class DebugElement__POST_R3__ extends DebugNode__POST_R3__ {
|
|
|
27004
27086
|
const children = [];
|
|
27005
27087
|
for (let i = 0; i < childNodes.length; i++) {
|
|
27006
27088
|
const element = childNodes[i];
|
|
27007
|
-
children.push(
|
|
27089
|
+
children.push(getDebugNode(element));
|
|
27008
27090
|
}
|
|
27009
27091
|
return children;
|
|
27010
27092
|
}
|
|
27093
|
+
/**
|
|
27094
|
+
* @returns the first `DebugElement` that matches the predicate at any depth in the subtree.
|
|
27095
|
+
*/
|
|
27011
27096
|
query(predicate) {
|
|
27012
27097
|
const results = this.queryAll(predicate);
|
|
27013
27098
|
return results[0] || null;
|
|
27014
27099
|
}
|
|
27100
|
+
/**
|
|
27101
|
+
* @returns All `DebugElement` matches for the predicate at any depth in the subtree.
|
|
27102
|
+
*/
|
|
27015
27103
|
queryAll(predicate) {
|
|
27016
27104
|
const matches = [];
|
|
27017
|
-
|
|
27105
|
+
_queryAll(this, predicate, matches, true);
|
|
27018
27106
|
return matches;
|
|
27019
27107
|
}
|
|
27108
|
+
/**
|
|
27109
|
+
* @returns All `DebugNode` matches for the predicate at any depth in the subtree.
|
|
27110
|
+
*/
|
|
27020
27111
|
queryAllNodes(predicate) {
|
|
27021
27112
|
const matches = [];
|
|
27022
|
-
|
|
27113
|
+
_queryAll(this, predicate, matches, false);
|
|
27023
27114
|
return matches;
|
|
27024
27115
|
}
|
|
27116
|
+
/**
|
|
27117
|
+
* Triggers the event by its name if there is a corresponding listener in the element's
|
|
27118
|
+
* `listeners` collection.
|
|
27119
|
+
*
|
|
27120
|
+
* If the event lacks a listener or there's some other problem, consider
|
|
27121
|
+
* calling `nativeElement.dispatchEvent(eventObject)`.
|
|
27122
|
+
*
|
|
27123
|
+
* @param eventName The name of the event to trigger
|
|
27124
|
+
* @param eventObj The _event object_ expected by the handler
|
|
27125
|
+
*
|
|
27126
|
+
* @see [Testing components scenarios](guide/testing-components-scenarios#trigger-event-handler)
|
|
27127
|
+
*/
|
|
27025
27128
|
triggerEventHandler(eventName, eventObj) {
|
|
27026
27129
|
const node = this.nativeNode;
|
|
27027
27130
|
const invokedListeners = [];
|
|
@@ -27080,11 +27183,11 @@ function isPrimitiveValue(value) {
|
|
|
27080
27183
|
return typeof value === 'string' || typeof value === 'boolean' || typeof value === 'number' ||
|
|
27081
27184
|
value === null;
|
|
27082
27185
|
}
|
|
27083
|
-
function
|
|
27186
|
+
function _queryAll(parentElement, predicate, matches, elementsOnly) {
|
|
27084
27187
|
const context = getLContext(parentElement.nativeNode);
|
|
27085
27188
|
if (context !== null) {
|
|
27086
27189
|
const parentTNode = context.lView[TVIEW].data[context.nodeIndex];
|
|
27087
|
-
|
|
27190
|
+
_queryNodeChildren(parentTNode, context.lView, predicate, matches, elementsOnly, parentElement.nativeNode);
|
|
27088
27191
|
}
|
|
27089
27192
|
else {
|
|
27090
27193
|
// If the context is null, then `parentElement` was either created with Renderer2 or native DOM
|
|
@@ -27102,26 +27205,26 @@ function _queryAllR3(parentElement, predicate, matches, elementsOnly) {
|
|
|
27102
27205
|
* @param elementsOnly whether only elements should be searched
|
|
27103
27206
|
* @param rootNativeNode the root native node on which predicate should not be matched
|
|
27104
27207
|
*/
|
|
27105
|
-
function
|
|
27208
|
+
function _queryNodeChildren(tNode, lView, predicate, matches, elementsOnly, rootNativeNode) {
|
|
27106
27209
|
ngDevMode && assertTNodeForLView(tNode, lView);
|
|
27107
27210
|
const nativeNode = getNativeByTNodeOrNull(tNode, lView);
|
|
27108
27211
|
// For each type of TNode, specific logic is executed.
|
|
27109
27212
|
if (tNode.type & (3 /* AnyRNode */ | 8 /* ElementContainer */)) {
|
|
27110
27213
|
// Case 1: the TNode is an element
|
|
27111
27214
|
// The native node has to be checked.
|
|
27112
|
-
|
|
27215
|
+
_addQueryMatch(nativeNode, predicate, matches, elementsOnly, rootNativeNode);
|
|
27113
27216
|
if (isComponentHost(tNode)) {
|
|
27114
27217
|
// If the element is the host of a component, then all nodes in its view have to be processed.
|
|
27115
27218
|
// Note: the component's content (tNode.child) will be processed from the insertion points.
|
|
27116
27219
|
const componentView = getComponentLViewByIndex(tNode.index, lView);
|
|
27117
27220
|
if (componentView && componentView[TVIEW].firstChild) {
|
|
27118
|
-
|
|
27221
|
+
_queryNodeChildren(componentView[TVIEW].firstChild, componentView, predicate, matches, elementsOnly, rootNativeNode);
|
|
27119
27222
|
}
|
|
27120
27223
|
}
|
|
27121
27224
|
else {
|
|
27122
27225
|
if (tNode.child) {
|
|
27123
27226
|
// Otherwise, its children have to be processed.
|
|
27124
|
-
|
|
27227
|
+
_queryNodeChildren(tNode.child, lView, predicate, matches, elementsOnly, rootNativeNode);
|
|
27125
27228
|
}
|
|
27126
27229
|
// We also have to query the DOM directly in order to catch elements inserted through
|
|
27127
27230
|
// Renderer2. Note that this is __not__ optimal, because we're walking similar trees multiple
|
|
@@ -27137,16 +27240,16 @@ function _queryNodeChildrenR3(tNode, lView, predicate, matches, elementsOnly, ro
|
|
|
27137
27240
|
// processed.
|
|
27138
27241
|
const nodeOrContainer = lView[tNode.index];
|
|
27139
27242
|
if (isLContainer(nodeOrContainer)) {
|
|
27140
|
-
|
|
27243
|
+
_queryNodeChildrenInContainer(nodeOrContainer, predicate, matches, elementsOnly, rootNativeNode);
|
|
27141
27244
|
}
|
|
27142
27245
|
}
|
|
27143
27246
|
else if (tNode.type & 4 /* Container */) {
|
|
27144
27247
|
// Case 2: the TNode is a container
|
|
27145
27248
|
// The native node has to be checked.
|
|
27146
27249
|
const lContainer = lView[tNode.index];
|
|
27147
|
-
|
|
27250
|
+
_addQueryMatch(lContainer[NATIVE], predicate, matches, elementsOnly, rootNativeNode);
|
|
27148
27251
|
// Each view inside the container has to be processed.
|
|
27149
|
-
|
|
27252
|
+
_queryNodeChildrenInContainer(lContainer, predicate, matches, elementsOnly, rootNativeNode);
|
|
27150
27253
|
}
|
|
27151
27254
|
else if (tNode.type & 16 /* Projection */) {
|
|
27152
27255
|
// Case 3: the TNode is a projection insertion point (i.e. a <ng-content>).
|
|
@@ -27156,18 +27259,18 @@ function _queryNodeChildrenR3(tNode, lView, predicate, matches, elementsOnly, ro
|
|
|
27156
27259
|
const head = componentHost.projection[tNode.projection];
|
|
27157
27260
|
if (Array.isArray(head)) {
|
|
27158
27261
|
for (let nativeNode of head) {
|
|
27159
|
-
|
|
27262
|
+
_addQueryMatch(nativeNode, predicate, matches, elementsOnly, rootNativeNode);
|
|
27160
27263
|
}
|
|
27161
27264
|
}
|
|
27162
27265
|
else if (head) {
|
|
27163
27266
|
const nextLView = componentView[PARENT];
|
|
27164
27267
|
const nextTNode = nextLView[TVIEW].data[head.index];
|
|
27165
|
-
|
|
27268
|
+
_queryNodeChildren(nextTNode, nextLView, predicate, matches, elementsOnly, rootNativeNode);
|
|
27166
27269
|
}
|
|
27167
27270
|
}
|
|
27168
27271
|
else if (tNode.child) {
|
|
27169
27272
|
// Case 4: the TNode is a view.
|
|
27170
|
-
|
|
27273
|
+
_queryNodeChildren(tNode.child, lView, predicate, matches, elementsOnly, rootNativeNode);
|
|
27171
27274
|
}
|
|
27172
27275
|
// We don't want to go to the next sibling of the root node.
|
|
27173
27276
|
if (rootNativeNode !== nativeNode) {
|
|
@@ -27175,7 +27278,7 @@ function _queryNodeChildrenR3(tNode, lView, predicate, matches, elementsOnly, ro
|
|
|
27175
27278
|
// link, depending on whether the current node has been projected.
|
|
27176
27279
|
const nextTNode = (tNode.flags & 4 /* isProjected */) ? tNode.projectionNext : tNode.next;
|
|
27177
27280
|
if (nextTNode) {
|
|
27178
|
-
|
|
27281
|
+
_queryNodeChildren(nextTNode, lView, predicate, matches, elementsOnly, rootNativeNode);
|
|
27179
27282
|
}
|
|
27180
27283
|
}
|
|
27181
27284
|
}
|
|
@@ -27188,12 +27291,12 @@ function _queryNodeChildrenR3(tNode, lView, predicate, matches, elementsOnly, ro
|
|
|
27188
27291
|
* @param elementsOnly whether only elements should be searched
|
|
27189
27292
|
* @param rootNativeNode the root native node on which predicate should not be matched
|
|
27190
27293
|
*/
|
|
27191
|
-
function
|
|
27294
|
+
function _queryNodeChildrenInContainer(lContainer, predicate, matches, elementsOnly, rootNativeNode) {
|
|
27192
27295
|
for (let i = CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) {
|
|
27193
27296
|
const childView = lContainer[i];
|
|
27194
27297
|
const firstChild = childView[TVIEW].firstChild;
|
|
27195
27298
|
if (firstChild) {
|
|
27196
|
-
|
|
27299
|
+
_queryNodeChildren(firstChild, childView, predicate, matches, elementsOnly, rootNativeNode);
|
|
27197
27300
|
}
|
|
27198
27301
|
}
|
|
27199
27302
|
}
|
|
@@ -27206,7 +27309,7 @@ function _queryNodeChildrenInContainerR3(lContainer, predicate, matches, element
|
|
|
27206
27309
|
* @param elementsOnly whether only elements should be searched
|
|
27207
27310
|
* @param rootNativeNode the root native node on which predicate should not be matched
|
|
27208
27311
|
*/
|
|
27209
|
-
function
|
|
27312
|
+
function _addQueryMatch(nativeNode, predicate, matches, elementsOnly, rootNativeNode) {
|
|
27210
27313
|
if (rootNativeNode !== nativeNode) {
|
|
27211
27314
|
const debugNode = getDebugNode(nativeNode);
|
|
27212
27315
|
if (!debugNode) {
|
|
@@ -27215,7 +27318,7 @@ function _addQueryMatchR3(nativeNode, predicate, matches, elementsOnly, rootNati
|
|
|
27215
27318
|
// Type of the "predicate and "matches" array are set based on the value of
|
|
27216
27319
|
// the "elementsOnly" parameter. TypeScript is not able to properly infer these
|
|
27217
27320
|
// types with generics, so we manually cast the parameters accordingly.
|
|
27218
|
-
if (elementsOnly && debugNode instanceof
|
|
27321
|
+
if (elementsOnly && (debugNode instanceof DebugElement) && predicate(debugNode) &&
|
|
27219
27322
|
matches.indexOf(debugNode) === -1) {
|
|
27220
27323
|
matches.push(debugNode);
|
|
27221
27324
|
}
|
|
@@ -27240,7 +27343,7 @@ function _queryNativeNodeDescendants(parentNode, predicate, matches, elementsOnl
|
|
|
27240
27343
|
const node = nodes[i];
|
|
27241
27344
|
const debugNode = getDebugNode(node);
|
|
27242
27345
|
if (debugNode) {
|
|
27243
|
-
if (elementsOnly && debugNode instanceof
|
|
27346
|
+
if (elementsOnly && (debugNode instanceof DebugElement) && predicate(debugNode) &&
|
|
27244
27347
|
matches.indexOf(debugNode) === -1) {
|
|
27245
27348
|
matches.push(debugNode);
|
|
27246
27349
|
}
|
|
@@ -27281,25 +27384,24 @@ function collectPropertyBindings(properties, tNode, lView, tData) {
|
|
|
27281
27384
|
// Need to keep the nodes in a global Map so that multiple angular apps are supported.
|
|
27282
27385
|
const _nativeNodeToDebugNode = new Map();
|
|
27283
27386
|
const NG_DEBUG_PROPERTY = '__ng_debug__';
|
|
27284
|
-
|
|
27387
|
+
/**
|
|
27388
|
+
* @publicApi
|
|
27389
|
+
*/
|
|
27390
|
+
function getDebugNode(nativeNode) {
|
|
27285
27391
|
if (nativeNode instanceof Node) {
|
|
27286
27392
|
if (!(nativeNode.hasOwnProperty(NG_DEBUG_PROPERTY))) {
|
|
27287
27393
|
nativeNode[NG_DEBUG_PROPERTY] = nativeNode.nodeType == Node.ELEMENT_NODE ?
|
|
27288
|
-
new
|
|
27289
|
-
new
|
|
27394
|
+
new DebugElement(nativeNode) :
|
|
27395
|
+
new DebugNode(nativeNode);
|
|
27290
27396
|
}
|
|
27291
27397
|
return nativeNode[NG_DEBUG_PROPERTY];
|
|
27292
27398
|
}
|
|
27293
27399
|
return null;
|
|
27294
27400
|
}
|
|
27295
|
-
|
|
27296
|
-
|
|
27297
|
-
*/
|
|
27298
|
-
const getDebugNode = getDebugNode__POST_R3__;
|
|
27299
|
-
function getDebugNodeR2__POST_R3__(_nativeNode) {
|
|
27401
|
+
// TODO: cleanup all references to this function and remove it.
|
|
27402
|
+
function getDebugNodeR2(_nativeNode) {
|
|
27300
27403
|
return null;
|
|
27301
27404
|
}
|
|
27302
|
-
const getDebugNodeR2 = getDebugNodeR2__POST_R3__;
|
|
27303
27405
|
function getAllDebugNodes() {
|
|
27304
27406
|
return Array.from(_nativeNodeToDebugNode.values());
|
|
27305
27407
|
}
|
|
@@ -27309,14 +27411,6 @@ function indexDebugNode(node) {
|
|
|
27309
27411
|
function removeDebugNodeFromIndex(node) {
|
|
27310
27412
|
_nativeNodeToDebugNode.delete(node.nativeNode);
|
|
27311
27413
|
}
|
|
27312
|
-
/**
|
|
27313
|
-
* @publicApi
|
|
27314
|
-
*/
|
|
27315
|
-
const DebugNode = DebugNode__POST_R3__;
|
|
27316
|
-
/**
|
|
27317
|
-
* @publicApi
|
|
27318
|
-
*/
|
|
27319
|
-
const DebugElement = DebugElement__POST_R3__;
|
|
27320
27414
|
|
|
27321
27415
|
/**
|
|
27322
27416
|
* @license
|
|
@@ -28444,12 +28538,6 @@ const platformCore = createPlatformFactory(null, 'core', _CORE_PLATFORM_PROVIDER
|
|
|
28444
28538
|
* Use of this source code is governed by an MIT-style license that can be
|
|
28445
28539
|
* found in the LICENSE file at https://angular.io/license
|
|
28446
28540
|
*/
|
|
28447
|
-
function _iterableDiffersFactory() {
|
|
28448
|
-
return defaultIterableDiffers;
|
|
28449
|
-
}
|
|
28450
|
-
function _keyValueDiffersFactory() {
|
|
28451
|
-
return defaultKeyValueDiffers;
|
|
28452
|
-
}
|
|
28453
28541
|
function _localeFactory(locale) {
|
|
28454
28542
|
return locale || getGlobalLocale();
|
|
28455
28543
|
}
|
|
@@ -28498,8 +28586,6 @@ const APPLICATION_MODULE_PROVIDERS = [
|
|
|
28498
28586
|
},
|
|
28499
28587
|
{ provide: Compiler, useClass: Compiler, deps: [] },
|
|
28500
28588
|
APP_ID_RANDOM_PROVIDER,
|
|
28501
|
-
{ provide: IterableDiffers, useFactory: _iterableDiffersFactory, deps: [] },
|
|
28502
|
-
{ provide: KeyValueDiffers, useFactory: _keyValueDiffersFactory, deps: [] },
|
|
28503
28589
|
{
|
|
28504
28590
|
provide: LOCALE_ID,
|
|
28505
28591
|
useFactory: _localeFactory,
|