@angular/upgrade 17.1.0 → 17.1.2
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/esm2022/src/common/src/angular1.mjs +5 -5
- package/esm2022/src/common/src/component_info.mjs +1 -1
- package/esm2022/src/common/src/downgrade_component.mjs +17 -14
- package/esm2022/src/common/src/downgrade_component_adapter.mjs +19 -14
- package/esm2022/src/common/src/downgrade_injectable.mjs +1 -1
- package/esm2022/src/common/src/promise_util.mjs +3 -3
- package/esm2022/src/common/src/upgrade_helper.mjs +14 -13
- package/esm2022/src/common/src/util.mjs +16 -14
- package/esm2022/src/common/src/version.mjs +1 -1
- package/esm2022/src/dynamic/src/upgrade_adapter.mjs +31 -22
- package/esm2022/src/dynamic/src/upgrade_ng1_adapter.mjs +20 -17
- package/esm2022/static/public_api.mjs +2 -2
- package/esm2022/static/src/angular1_providers.mjs +2 -2
- package/esm2022/static/src/downgrade_module.mjs +10 -8
- package/esm2022/static/src/upgrade_component.mjs +15 -14
- package/esm2022/static/src/upgrade_module.mjs +16 -13
- package/esm2022/static/src/util.mjs +2 -2
- package/esm2022/static/testing/src/create_angular_testing_module.mjs +7 -6
- package/esm2022/static/testing/src/create_angularjs_testing_module.mjs +6 -6
- package/fesm2022/static/testing.mjs +12 -11
- package/fesm2022/static/testing.mjs.map +1 -1
- package/fesm2022/static.mjs +99 -83
- package/fesm2022/static.mjs.map +1 -1
- package/fesm2022/upgrade.mjs +107 -84
- package/fesm2022/upgrade.mjs.map +1 -1
- package/index.d.ts +1 -1
- package/package.json +5 -5
- package/static/index.d.ts +1 -1
- package/static/testing/index.d.ts +1 -1
package/fesm2022/static.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v17.1.
|
|
2
|
+
* @license Angular v17.1.2
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -20,7 +20,7 @@ let angular = {
|
|
|
20
20
|
injector: noNg,
|
|
21
21
|
version: undefined,
|
|
22
22
|
resumeBootstrap: noNg,
|
|
23
|
-
getTestability: noNg
|
|
23
|
+
getTestability: noNg,
|
|
24
24
|
};
|
|
25
25
|
try {
|
|
26
26
|
if (window.hasOwnProperty('angular')) {
|
|
@@ -68,11 +68,11 @@ const bootstrap = (e, modules, config) => angular.bootstrap(e, modules, config);
|
|
|
68
68
|
// Do not declare as `module` to avoid webpack bug
|
|
69
69
|
// (see https://github.com/angular/angular/issues/30050).
|
|
70
70
|
const module_ = (prefix, dependencies) => angular.module(prefix, dependencies);
|
|
71
|
-
const element = (e => angular.element(e));
|
|
72
|
-
element.cleanData = nodes => angular.element.cleanData(nodes);
|
|
71
|
+
const element = ((e) => angular.element(e));
|
|
72
|
+
element.cleanData = (nodes) => angular.element.cleanData(nodes);
|
|
73
73
|
const injector = (modules, strictDi) => angular.injector(modules, strictDi);
|
|
74
74
|
const resumeBootstrap = () => angular.resumeBootstrap();
|
|
75
|
-
const getTestability = e => angular.getTestability(e);
|
|
75
|
+
const getTestability = (e) => angular.getTestability(e);
|
|
76
76
|
|
|
77
77
|
var angular1 = /*#__PURE__*/Object.freeze({
|
|
78
78
|
__proto__: null,
|
|
@@ -207,7 +207,8 @@ function destroyApp($injector) {
|
|
|
207
207
|
cleanData($rootElement[0]);
|
|
208
208
|
}
|
|
209
209
|
function directiveNormalize(name) {
|
|
210
|
-
return name
|
|
210
|
+
return name
|
|
211
|
+
.replace(DIRECTIVE_PREFIX_REGEXP, '')
|
|
211
212
|
.replace(DIRECTIVE_SPECIAL_CHARS_REGEXP, (_, letter) => letter.toUpperCase());
|
|
212
213
|
}
|
|
213
214
|
function getTypeName(type) {
|
|
@@ -215,12 +216,14 @@ function getTypeName(type) {
|
|
|
215
216
|
return type.overriddenName || type.name || type.toString().split('\n')[0];
|
|
216
217
|
}
|
|
217
218
|
function getDowngradedModuleCount($injector) {
|
|
218
|
-
return $injector.has(DOWNGRADED_MODULE_COUNT_KEY)
|
|
219
|
-
|
|
219
|
+
return $injector.has(DOWNGRADED_MODULE_COUNT_KEY)
|
|
220
|
+
? $injector.get(DOWNGRADED_MODULE_COUNT_KEY)
|
|
221
|
+
: 0;
|
|
220
222
|
}
|
|
221
223
|
function getUpgradeAppType($injector) {
|
|
222
|
-
return $injector.has(UPGRADE_APP_TYPE_KEY)
|
|
223
|
-
|
|
224
|
+
return $injector.has(UPGRADE_APP_TYPE_KEY)
|
|
225
|
+
? $injector.get(UPGRADE_APP_TYPE_KEY)
|
|
226
|
+
: 0 /* UpgradeAppType.None */;
|
|
224
227
|
}
|
|
225
228
|
function isFunction(value) {
|
|
226
229
|
return typeof value === 'function';
|
|
@@ -241,15 +244,15 @@ function validateInjectionKey($injector, downgradedModule, injectionKey, attempt
|
|
|
241
244
|
case 2 /* UpgradeAppType.Static */:
|
|
242
245
|
if (downgradedModule) {
|
|
243
246
|
throw new Error(`Error while ${attemptedAction}: 'downgradedModule' unexpectedly specified.\n` +
|
|
244
|
-
|
|
245
|
-
|
|
247
|
+
"You should not specify a value for 'downgradedModule', unless you are downgrading " +
|
|
248
|
+
"more than one Angular module (via 'downgradeModule()').");
|
|
246
249
|
}
|
|
247
250
|
break;
|
|
248
251
|
case 3 /* UpgradeAppType.Lite */:
|
|
249
|
-
if (!downgradedModule &&
|
|
252
|
+
if (!downgradedModule && downgradedModuleCount >= 2) {
|
|
250
253
|
throw new Error(`Error while ${attemptedAction}: 'downgradedModule' not specified.\n` +
|
|
251
254
|
'This application contains more than one downgraded Angular module, thus you need to ' +
|
|
252
|
-
|
|
255
|
+
"always specify 'downgradedModule' when downgrading components and injectables.");
|
|
253
256
|
}
|
|
254
257
|
if (!$injector.has(injectionKey)) {
|
|
255
258
|
throw new Error(`Error while ${attemptedAction}: Unable to find the specified downgraded module.\n` +
|
|
@@ -277,8 +280,7 @@ class Deferred {
|
|
|
277
280
|
* compatibility.
|
|
278
281
|
*/
|
|
279
282
|
function supportsNgModel(component) {
|
|
280
|
-
return typeof component.writeValue === 'function' &&
|
|
281
|
-
typeof component.registerOnChange === 'function';
|
|
283
|
+
return (typeof component.writeValue === 'function' && typeof component.registerOnChange === 'function');
|
|
282
284
|
}
|
|
283
285
|
/**
|
|
284
286
|
* Glue the AngularJS `NgModelController` (if it exists) to the component
|
|
@@ -321,7 +323,7 @@ var util = /*#__PURE__*/Object.freeze({
|
|
|
321
323
|
});
|
|
322
324
|
|
|
323
325
|
const INITIAL_VALUE$1 = {
|
|
324
|
-
__UNINITIALIZED__: true
|
|
326
|
+
__UNINITIALIZED__: true,
|
|
325
327
|
};
|
|
326
328
|
class DowngradeComponentAdapter {
|
|
327
329
|
constructor(element, attrs, scope, ngModel, parentInjector, $compile, $parse, componentFactory, wrapCallback) {
|
|
@@ -342,9 +344,9 @@ class DowngradeComponentAdapter {
|
|
|
342
344
|
compileContents() {
|
|
343
345
|
const compiledProjectableNodes = [];
|
|
344
346
|
const projectableNodes = this.groupProjectableNodes();
|
|
345
|
-
const linkFns = projectableNodes.map(nodes => this.$compile(nodes));
|
|
347
|
+
const linkFns = projectableNodes.map((nodes) => this.$compile(nodes));
|
|
346
348
|
this.element.empty();
|
|
347
|
-
linkFns.forEach(linkFn => {
|
|
349
|
+
linkFns.forEach((linkFn) => {
|
|
348
350
|
linkFn(this.scope, (clone) => {
|
|
349
351
|
compiledProjectableNodes.push(clone);
|
|
350
352
|
this.element.append(clone);
|
|
@@ -361,7 +363,11 @@ class DowngradeComponentAdapter {
|
|
|
361
363
|
}
|
|
362
364
|
createComponent(projectableNodes) {
|
|
363
365
|
const providers = [{ provide: $SCOPE, useValue: this.componentScope }];
|
|
364
|
-
const childInjector = Injector.create({
|
|
366
|
+
const childInjector = Injector.create({
|
|
367
|
+
providers: providers,
|
|
368
|
+
parent: this.parentInjector,
|
|
369
|
+
name: 'DowngradeComponentAdapter',
|
|
370
|
+
});
|
|
365
371
|
const componentRef = this.componentFactory.create(childInjector, projectableNodes, this.element[0]);
|
|
366
372
|
const viewChangeDetector = componentRef.injector.get(ChangeDetectorRef);
|
|
367
373
|
const changeDetector = componentRef.changeDetectorRef;
|
|
@@ -371,7 +377,8 @@ class DowngradeComponentAdapter {
|
|
|
371
377
|
// testability hook.
|
|
372
378
|
const testability = componentRef.injector.get(Testability, null);
|
|
373
379
|
if (testability) {
|
|
374
|
-
componentRef.injector
|
|
380
|
+
componentRef.injector
|
|
381
|
+
.get(TestabilityRegistry)
|
|
375
382
|
.registerApplication(componentRef.location.nativeElement, testability);
|
|
376
383
|
}
|
|
377
384
|
hookupNgModel(this.ngModel, componentRef.instance);
|
|
@@ -384,7 +391,7 @@ class DowngradeComponentAdapter {
|
|
|
384
391
|
const inputBinding = new PropertyBinding(input.propName, input.templateName);
|
|
385
392
|
let expr = null;
|
|
386
393
|
if (attrs.hasOwnProperty(inputBinding.attr)) {
|
|
387
|
-
const observeFn = (prop => {
|
|
394
|
+
const observeFn = ((prop) => {
|
|
388
395
|
let prevValue = INITIAL_VALUE$1;
|
|
389
396
|
return (currValue) => {
|
|
390
397
|
// Initially, both `$observe()` and `$watch()` will call this function.
|
|
@@ -487,8 +494,9 @@ class DowngradeComponentAdapter {
|
|
|
487
494
|
const emitter = componentRef.instance[output.prop];
|
|
488
495
|
if (emitter) {
|
|
489
496
|
const subscription = emitter.subscribe({
|
|
490
|
-
next: isAssignment
|
|
491
|
-
(v) =>
|
|
497
|
+
next: isAssignment
|
|
498
|
+
? (v) => setter(this.scope, v)
|
|
499
|
+
: (v) => getter(this.scope, { '$event': v }),
|
|
492
500
|
});
|
|
493
501
|
componentRef.onDestroy(() => subscription.unsubscribe());
|
|
494
502
|
}
|
|
@@ -582,10 +590,9 @@ function findMatchingNgContentIndex(element, ngContentSelectors) {
|
|
|
582
590
|
function matchesSelector(el, selector) {
|
|
583
591
|
const elProto = Element.prototype;
|
|
584
592
|
return el.nodeType === Node.ELEMENT_NODE
|
|
585
|
-
// matches is supported by all browsers from 2014 onwards except non-chromium edge
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
false;
|
|
593
|
+
? // matches is supported by all browsers from 2014 onwards except non-chromium edge
|
|
594
|
+
(elProto.matches ?? elProto.msMatchesSelector).call(el, selector)
|
|
595
|
+
: false;
|
|
589
596
|
}
|
|
590
597
|
|
|
591
598
|
function isThenable(obj) {
|
|
@@ -610,7 +617,7 @@ class SyncPromise {
|
|
|
610
617
|
};
|
|
611
618
|
valuesOrPromises.forEach((p, idx) => {
|
|
612
619
|
if (isThenable(p)) {
|
|
613
|
-
p.then(v => resolve(idx, v));
|
|
620
|
+
p.then((v) => resolve(idx, v));
|
|
614
621
|
}
|
|
615
622
|
else {
|
|
616
623
|
resolve(idx, p);
|
|
@@ -625,7 +632,7 @@ class SyncPromise {
|
|
|
625
632
|
this.value = value;
|
|
626
633
|
this.resolved = true;
|
|
627
634
|
// Run the queued callbacks.
|
|
628
|
-
this.callbacks.forEach(callback => callback(value));
|
|
635
|
+
this.callbacks.forEach((callback) => callback(value));
|
|
629
636
|
this.callbacks.length = 0;
|
|
630
637
|
}
|
|
631
638
|
then(callback) {
|
|
@@ -698,10 +705,12 @@ function downgradeComponent(info) {
|
|
|
698
705
|
// inside the Angular zone (except if explicitly escaped, in which case we shouldn't
|
|
699
706
|
// force it back in).
|
|
700
707
|
const isNgUpgradeLite = getUpgradeAppType($injector) === 3 /* UpgradeAppType.Lite */;
|
|
701
|
-
const wrapCallback = !isNgUpgradeLite
|
|
708
|
+
const wrapCallback = !isNgUpgradeLite
|
|
709
|
+
? (cb) => cb
|
|
710
|
+
: (cb) => () => (NgZone.isInAngularZone() ? cb() : ngZone.run(cb));
|
|
702
711
|
let ngZone;
|
|
703
712
|
// When downgrading multiple modules, special handling is needed wrt injectors.
|
|
704
|
-
const hasMultipleDowngradedModules = isNgUpgradeLite &&
|
|
713
|
+
const hasMultipleDowngradedModules = isNgUpgradeLite && getDowngradedModuleCount($injector) > 1;
|
|
705
714
|
return {
|
|
706
715
|
restrict: 'E',
|
|
707
716
|
terminal: true,
|
|
@@ -784,20 +793,21 @@ function downgradeComponent(info) {
|
|
|
784
793
|
scope.$evalAsync(() => { });
|
|
785
794
|
}
|
|
786
795
|
};
|
|
787
|
-
const downgradeFn = !isNgUpgradeLite
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
796
|
+
const downgradeFn = !isNgUpgradeLite
|
|
797
|
+
? doDowngrade
|
|
798
|
+
: (pInjector, mInjector) => {
|
|
799
|
+
if (!ngZone) {
|
|
800
|
+
ngZone = pInjector.get(NgZone);
|
|
801
|
+
}
|
|
802
|
+
wrapCallback(() => doDowngrade(pInjector, mInjector))();
|
|
803
|
+
};
|
|
793
804
|
// NOTE:
|
|
794
805
|
// Not using `ParentInjectorPromise.all()` (which is inherited from `SyncPromise`), because
|
|
795
806
|
// Closure Compiler (or some related tool) complains:
|
|
796
807
|
// `TypeError: ...$src$downgrade_component_ParentInjectorPromise.all is not a function`
|
|
797
|
-
SyncPromise.all([finalParentInjector, finalModuleInjector])
|
|
798
|
-
.then(([pInjector, mInjector]) => downgradeFn(pInjector, mInjector));
|
|
808
|
+
SyncPromise.all([finalParentInjector, finalModuleInjector]).then(([pInjector, mInjector]) => downgradeFn(pInjector, mInjector));
|
|
799
809
|
ranAsync = true;
|
|
800
|
-
}
|
|
810
|
+
},
|
|
801
811
|
};
|
|
802
812
|
};
|
|
803
813
|
// bracket-notation because of closure - see #14441
|
|
@@ -912,7 +922,7 @@ function downgradeInjectable(token, downgradedModule = '') {
|
|
|
912
922
|
/**
|
|
913
923
|
* @publicApi
|
|
914
924
|
*/
|
|
915
|
-
const VERSION = new Version('17.1.
|
|
925
|
+
const VERSION = new Version('17.1.2');
|
|
916
926
|
|
|
917
927
|
// Constants
|
|
918
928
|
const REQUIRE_PREFIX_RE = /^(\^\^?)?(\?)?(\^\^?)?/;
|
|
@@ -983,8 +993,7 @@ class UpgradeHelper {
|
|
|
983
993
|
}
|
|
984
994
|
compileTemplate(template) {
|
|
985
995
|
if (template === undefined) {
|
|
986
|
-
template =
|
|
987
|
-
UpgradeHelper.getTemplate(this.$injector, this.directive, false, this.$element);
|
|
996
|
+
template = UpgradeHelper.getTemplate(this.$injector, this.directive, false, this.$element);
|
|
988
997
|
}
|
|
989
998
|
return this.compileHtml(template);
|
|
990
999
|
}
|
|
@@ -1014,7 +1023,7 @@ class UpgradeHelper {
|
|
|
1014
1023
|
const slotMap = Object.create(null);
|
|
1015
1024
|
const filledSlots = Object.create(null);
|
|
1016
1025
|
// Parse the element selectors.
|
|
1017
|
-
Object.keys(transclude).forEach(slotName => {
|
|
1026
|
+
Object.keys(transclude).forEach((slotName) => {
|
|
1018
1027
|
let selector = transclude[slotName];
|
|
1019
1028
|
const optional = selector.charAt(0) === '?';
|
|
1020
1029
|
selector = optional ? selector.substring(1) : selector;
|
|
@@ -1023,7 +1032,7 @@ class UpgradeHelper {
|
|
|
1023
1032
|
filledSlots[slotName] = optional; // Consider optional slots as filled.
|
|
1024
1033
|
});
|
|
1025
1034
|
// Add the matching elements into their slot.
|
|
1026
|
-
contentChildNodes.forEach(node => {
|
|
1035
|
+
contentChildNodes.forEach((node) => {
|
|
1027
1036
|
const slotName = slotMap[directiveNormalize(node.nodeName.toLowerCase())];
|
|
1028
1037
|
if (slotName) {
|
|
1029
1038
|
filledSlots[slotName] = true;
|
|
@@ -1035,12 +1044,14 @@ class UpgradeHelper {
|
|
|
1035
1044
|
}
|
|
1036
1045
|
});
|
|
1037
1046
|
// Check for required slots that were not filled.
|
|
1038
|
-
Object.keys(filledSlots).forEach(slotName => {
|
|
1047
|
+
Object.keys(filledSlots).forEach((slotName) => {
|
|
1039
1048
|
if (!filledSlots[slotName]) {
|
|
1040
1049
|
throw new Error(`Required transclusion slot '${slotName}' on directive: ${this.name}`);
|
|
1041
1050
|
}
|
|
1042
1051
|
});
|
|
1043
|
-
Object.keys(slots)
|
|
1052
|
+
Object.keys(slots)
|
|
1053
|
+
.filter((slotName) => slots[slotName])
|
|
1054
|
+
.forEach((slotName) => {
|
|
1044
1055
|
const nodes = slots[slotName];
|
|
1045
1056
|
slots[slotName] = (scope, cloneAttach) => {
|
|
1046
1057
|
return cloneAttach(nodes, scope);
|
|
@@ -1059,7 +1070,7 @@ class UpgradeHelper {
|
|
|
1059
1070
|
// to empty text nodes (which can only be a result of Angular removing their initial content).
|
|
1060
1071
|
// NOTE: Transcluded text content that starts with whitespace followed by an interpolation
|
|
1061
1072
|
// will still fail to be detected by AngularJS v1.6+
|
|
1062
|
-
$template.forEach(node => {
|
|
1073
|
+
$template.forEach((node) => {
|
|
1063
1074
|
if (node.nodeType === Node.TEXT_NODE && !node.nodeValue) {
|
|
1064
1075
|
node.nodeValue = '\u200C';
|
|
1065
1076
|
}
|
|
@@ -1072,7 +1083,7 @@ class UpgradeHelper {
|
|
|
1072
1083
|
const requiredControllers = this.resolveRequire(directiveRequire);
|
|
1073
1084
|
if (controllerInstance && this.directive.bindToController && isMap(directiveRequire)) {
|
|
1074
1085
|
const requiredControllersMap = requiredControllers;
|
|
1075
|
-
Object.keys(requiredControllersMap).forEach(key => {
|
|
1086
|
+
Object.keys(requiredControllersMap).forEach((key) => {
|
|
1076
1087
|
controllerInstance[key] = requiredControllersMap[key];
|
|
1077
1088
|
});
|
|
1078
1089
|
}
|
|
@@ -1085,7 +1096,7 @@ class UpgradeHelper {
|
|
|
1085
1096
|
extractChildNodes() {
|
|
1086
1097
|
const childNodes = [];
|
|
1087
1098
|
let childNode;
|
|
1088
|
-
while (childNode = this.element.firstChild) {
|
|
1099
|
+
while ((childNode = this.element.firstChild)) {
|
|
1089
1100
|
this.element.removeChild(childNode);
|
|
1090
1101
|
childNodes.push(childNode);
|
|
1091
1102
|
}
|
|
@@ -1109,11 +1120,11 @@ class UpgradeHelper {
|
|
|
1109
1120
|
return null;
|
|
1110
1121
|
}
|
|
1111
1122
|
else if (Array.isArray(require)) {
|
|
1112
|
-
return require.map(req => this.resolveRequire(req));
|
|
1123
|
+
return require.map((req) => this.resolveRequire(req));
|
|
1113
1124
|
}
|
|
1114
1125
|
else if (typeof require === 'object') {
|
|
1115
1126
|
const value = {};
|
|
1116
|
-
Object.keys(require).forEach(key => value[key] = this.resolveRequire(require[key]));
|
|
1127
|
+
Object.keys(require).forEach((key) => (value[key] = this.resolveRequire(require[key])));
|
|
1117
1128
|
return value;
|
|
1118
1129
|
}
|
|
1119
1130
|
else if (typeof require === 'string') {
|
|
@@ -1191,7 +1202,7 @@ const angular1Providers = [
|
|
|
1191
1202
|
{ provide: '$injector', useFactory: injectorFactory, deps: [] },
|
|
1192
1203
|
{ provide: '$rootScope', useFactory: rootScopeFactory, deps: ['$injector'] },
|
|
1193
1204
|
{ provide: '$compile', useFactory: compileFactory, deps: ['$injector'] },
|
|
1194
|
-
{ provide: '$parse', useFactory: parseFactory, deps: ['$injector'] }
|
|
1205
|
+
{ provide: '$parse', useFactory: parseFactory, deps: ['$injector'] },
|
|
1195
1206
|
];
|
|
1196
1207
|
|
|
1197
1208
|
class NgAdapterInjector {
|
|
@@ -1359,7 +1370,7 @@ function downgradeModule(moduleOrBootstrapFn) {
|
|
|
1359
1370
|
($injector) => {
|
|
1360
1371
|
setTempInjectorRef($injector);
|
|
1361
1372
|
const result = {
|
|
1362
|
-
promise: bootstrapFn(angular1Providers).then(ref => {
|
|
1373
|
+
promise: bootstrapFn(angular1Providers).then((ref) => {
|
|
1363
1374
|
injector = result.injector = new NgAdapterInjector(ref.injector);
|
|
1364
1375
|
injector.get($INJECTOR);
|
|
1365
1376
|
// Destroy the AngularJS app once the Angular `PlatformRef` is destroyed.
|
|
@@ -1369,16 +1380,17 @@ function downgradeModule(moduleOrBootstrapFn) {
|
|
|
1369
1380
|
// See https://github.com/angular/angular/issues/39935.
|
|
1370
1381
|
injector.get(PlatformRef).onDestroy(() => destroyApp($injector));
|
|
1371
1382
|
return injector;
|
|
1372
|
-
})
|
|
1383
|
+
}),
|
|
1373
1384
|
};
|
|
1374
1385
|
return result;
|
|
1375
|
-
}
|
|
1386
|
+
},
|
|
1376
1387
|
])
|
|
1377
1388
|
.config([
|
|
1378
|
-
$INJECTOR,
|
|
1389
|
+
$INJECTOR,
|
|
1390
|
+
$PROVIDE,
|
|
1379
1391
|
($injector, $provide) => {
|
|
1380
1392
|
$provide.constant(DOWNGRADED_MODULE_COUNT_KEY, getDowngradedModuleCount($injector) + 1);
|
|
1381
|
-
}
|
|
1393
|
+
},
|
|
1382
1394
|
]);
|
|
1383
1395
|
return lazyModuleName;
|
|
1384
1396
|
}
|
|
@@ -1388,7 +1400,7 @@ function identity(x) {
|
|
|
1388
1400
|
|
|
1389
1401
|
const NOT_SUPPORTED = 'NOT_SUPPORTED';
|
|
1390
1402
|
const INITIAL_VALUE = {
|
|
1391
|
-
__UNINITIALIZED__: true
|
|
1403
|
+
__UNINITIALIZED__: true,
|
|
1392
1404
|
};
|
|
1393
1405
|
class Bindings {
|
|
1394
1406
|
constructor() {
|
|
@@ -1475,9 +1487,9 @@ class UpgradeComponent {
|
|
|
1475
1487
|
// Instantiate controller
|
|
1476
1488
|
const controllerType = this.directive.controller;
|
|
1477
1489
|
const bindToController = this.directive.bindToController;
|
|
1478
|
-
let controllerInstance = controllerType
|
|
1479
|
-
this.helper.buildController(controllerType, this.$componentScope)
|
|
1480
|
-
undefined;
|
|
1490
|
+
let controllerInstance = controllerType
|
|
1491
|
+
? this.helper.buildController(controllerType, this.$componentScope)
|
|
1492
|
+
: undefined;
|
|
1481
1493
|
let bindingDestination;
|
|
1482
1494
|
if (!bindToController) {
|
|
1483
1495
|
bindingDestination = this.$componentScope;
|
|
@@ -1567,7 +1579,7 @@ class UpgradeComponent {
|
|
|
1567
1579
|
const context = btcIsObject ? directive.bindToController : directive.scope;
|
|
1568
1580
|
const bindings = new Bindings();
|
|
1569
1581
|
if (typeof context == 'object') {
|
|
1570
|
-
Object.keys(context).forEach(propName => {
|
|
1582
|
+
Object.keys(context).forEach((propName) => {
|
|
1571
1583
|
const definition = context[propName];
|
|
1572
1584
|
const bindingType = definition.charAt(0);
|
|
1573
1585
|
// QUESTION: What about `=*`? Ignore? Throw? Support?
|
|
@@ -1597,15 +1609,16 @@ class UpgradeComponent {
|
|
|
1597
1609
|
}
|
|
1598
1610
|
initializeOutputs() {
|
|
1599
1611
|
// Initialize the outputs for `=` and `&` bindings
|
|
1600
|
-
this.bindings.twoWayBoundProperties
|
|
1601
|
-
.
|
|
1612
|
+
this.bindings.twoWayBoundProperties
|
|
1613
|
+
.concat(this.bindings.expressionBoundProperties)
|
|
1614
|
+
.forEach((propName) => {
|
|
1602
1615
|
const outputName = this.bindings.propertyToOutputMap[propName];
|
|
1603
1616
|
this[outputName] = new EventEmitter();
|
|
1604
1617
|
});
|
|
1605
1618
|
}
|
|
1606
1619
|
bindOutputs(bindingDestination) {
|
|
1607
1620
|
// Bind `&` bindings to the corresponding outputs
|
|
1608
|
-
this.bindings.expressionBoundProperties.forEach(propName => {
|
|
1621
|
+
this.bindings.expressionBoundProperties.forEach((propName) => {
|
|
1609
1622
|
const outputName = this.bindings.propertyToOutputMap[propName];
|
|
1610
1623
|
const emitter = this[outputName];
|
|
1611
1624
|
bindingDestination[propName] = (value) => emitter.emit(value);
|
|
@@ -1613,15 +1626,15 @@ class UpgradeComponent {
|
|
|
1613
1626
|
}
|
|
1614
1627
|
forwardChanges(changes, bindingDestination) {
|
|
1615
1628
|
// Forward input changes to `bindingDestination`
|
|
1616
|
-
Object.keys(changes).forEach(propName => bindingDestination[propName] = changes[propName].currentValue);
|
|
1629
|
+
Object.keys(changes).forEach((propName) => (bindingDestination[propName] = changes[propName].currentValue));
|
|
1617
1630
|
if (isFunction(bindingDestination.$onChanges)) {
|
|
1618
1631
|
bindingDestination.$onChanges(changes);
|
|
1619
1632
|
}
|
|
1620
1633
|
}
|
|
1621
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.
|
|
1622
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.1.
|
|
1634
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: UpgradeComponent, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1635
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.1.2", type: UpgradeComponent, usesOnChanges: true, ngImport: i0 }); }
|
|
1623
1636
|
}
|
|
1624
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.
|
|
1637
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: UpgradeComponent, decorators: [{
|
|
1625
1638
|
type: Directive
|
|
1626
1639
|
}], ctorParameters: () => [{ type: undefined }, { type: i0.ElementRef }, { type: i0.Injector }] });
|
|
1627
1640
|
|
|
@@ -1780,9 +1793,13 @@ class UpgradeModule {
|
|
|
1780
1793
|
module_(INIT_MODULE_NAME, [])
|
|
1781
1794
|
.constant(UPGRADE_APP_TYPE_KEY, 2 /* ɵutil.UpgradeAppType.Static */)
|
|
1782
1795
|
.value(INJECTOR_KEY, this.injector)
|
|
1783
|
-
.factory(LAZY_MODULE_REF, [
|
|
1796
|
+
.factory(LAZY_MODULE_REF, [
|
|
1797
|
+
INJECTOR_KEY,
|
|
1798
|
+
(injector) => ({ injector }),
|
|
1799
|
+
])
|
|
1784
1800
|
.config([
|
|
1785
|
-
$PROVIDE,
|
|
1801
|
+
$PROVIDE,
|
|
1802
|
+
$INJECTOR,
|
|
1786
1803
|
($provide, $injector) => {
|
|
1787
1804
|
if ($injector.has($$TESTABILITY)) {
|
|
1788
1805
|
$provide.decorator($$TESTABILITY, [
|
|
@@ -1804,7 +1821,7 @@ class UpgradeModule {
|
|
|
1804
1821
|
};
|
|
1805
1822
|
testabilityDelegate.whenStable = newWhenStable;
|
|
1806
1823
|
return testabilityDelegate;
|
|
1807
|
-
}
|
|
1824
|
+
},
|
|
1808
1825
|
]);
|
|
1809
1826
|
}
|
|
1810
1827
|
if ($injector.has($INTERVAL)) {
|
|
@@ -1827,8 +1844,7 @@ class UpgradeModule {
|
|
|
1827
1844
|
}, delay, count, invokeApply, ...pass);
|
|
1828
1845
|
});
|
|
1829
1846
|
};
|
|
1830
|
-
Object.keys(intervalDelegate)
|
|
1831
|
-
.forEach(prop => wrappedInterval[prop] = intervalDelegate[prop]);
|
|
1847
|
+
Object.keys(intervalDelegate).forEach((prop) => (wrappedInterval[prop] = intervalDelegate[prop]));
|
|
1832
1848
|
// the `flush` method will be present when ngMocks is used
|
|
1833
1849
|
if (intervalDelegate.hasOwnProperty('flush')) {
|
|
1834
1850
|
wrappedInterval['flush'] = () => {
|
|
@@ -1837,10 +1853,10 @@ class UpgradeModule {
|
|
|
1837
1853
|
};
|
|
1838
1854
|
}
|
|
1839
1855
|
return wrappedInterval;
|
|
1840
|
-
}
|
|
1856
|
+
},
|
|
1841
1857
|
]);
|
|
1842
1858
|
}
|
|
1843
|
-
}
|
|
1859
|
+
},
|
|
1844
1860
|
])
|
|
1845
1861
|
.run([
|
|
1846
1862
|
$INJECTOR,
|
|
@@ -1874,7 +1890,7 @@ class UpgradeModule {
|
|
|
1874
1890
|
subscription.unsubscribe();
|
|
1875
1891
|
});
|
|
1876
1892
|
}, 0);
|
|
1877
|
-
}
|
|
1893
|
+
},
|
|
1878
1894
|
]);
|
|
1879
1895
|
const upgradeModule = module_(UPGRADE_MODULE_NAME, [INIT_MODULE_NAME].concat(modules));
|
|
1880
1896
|
// Make sure resumeBootstrap() only exists if the current bootstrap is deferred
|
|
@@ -1894,11 +1910,11 @@ class UpgradeModule {
|
|
|
1894
1910
|
}
|
|
1895
1911
|
return returnValue;
|
|
1896
1912
|
}
|
|
1897
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.
|
|
1898
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.1.
|
|
1899
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.1.
|
|
1913
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: UpgradeModule, deps: [{ token: i0.Injector }, { token: i0.NgZone }, { token: i0.PlatformRef }], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1914
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.1.2", ngImport: i0, type: UpgradeModule }); }
|
|
1915
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: UpgradeModule, providers: [angular1Providers] }); }
|
|
1900
1916
|
}
|
|
1901
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.
|
|
1917
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: UpgradeModule, decorators: [{
|
|
1902
1918
|
type: NgModule,
|
|
1903
1919
|
args: [{ providers: [angular1Providers] }]
|
|
1904
1920
|
}], ctorParameters: () => [{ type: i0.Injector }, { type: i0.NgZone }, { type: i0.PlatformRef }] });
|