1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | (function (global, factory) {
|
7 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('rxjs/Observable'), require('rxjs/observable/merge'), require('rxjs/operator/share'), require('rxjs/Subject')) :
|
8 | typeof define === 'function' && define.amd ? define(['exports', 'rxjs/Observable', 'rxjs/observable/merge', 'rxjs/operator/share', 'rxjs/Subject'], factory) :
|
9 | (factory((global.ng = global.ng || {}, global.ng.core = global.ng.core || {}),global.Rx,global.Rx.Observable,global.Rx.Observable.prototype,global.Rx));
|
10 | }(this, (function (exports,rxjs_Observable,rxjs_observable_merge,rxjs_operator_share,rxjs_Subject) { 'use strict';
|
11 |
|
12 | var __extends = (undefined && undefined.__extends) || function (d, b) {
|
13 | for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
14 | function __() { this.constructor = d; }
|
15 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
16 | };
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 | var OpaqueToken = (function () {
|
46 | |
47 |
|
48 |
|
49 | function OpaqueToken(_desc) {
|
50 | this._desc = _desc;
|
51 | }
|
52 | |
53 |
|
54 |
|
55 | OpaqueToken.prototype.toString = function () { return "Token " + this._desc; };
|
56 | return OpaqueToken;
|
57 | }());
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 | var InjectionToken = (function (_super) {
|
81 | __extends(InjectionToken, _super);
|
82 | |
83 |
|
84 |
|
85 | function InjectionToken(desc) {
|
86 | return _super.call(this, desc) || this;
|
87 | }
|
88 | |
89 |
|
90 |
|
91 | InjectionToken.prototype.toString = function () { return "InjectionToken " + this._desc; };
|
92 | return InjectionToken;
|
93 | }(OpaqueToken));
|
94 |
|
95 |
|
96 |
|
97 |
|
98 |
|
99 |
|
100 |
|
101 | var __window = typeof window !== 'undefined' && window;
|
102 | var __self = typeof self !== 'undefined' && typeof WorkerGlobalScope !== 'undefined' &&
|
103 | self instanceof WorkerGlobalScope && self;
|
104 | var __global = typeof global !== 'undefined' && global;
|
105 | var _global = __window || __global || __self;
|
106 | var _symbolIterator = null;
|
107 |
|
108 |
|
109 |
|
110 | function getSymbolIterator() {
|
111 | if (!_symbolIterator) {
|
112 | var Symbol = _global['Symbol'];
|
113 | if (Symbol && Symbol.iterator) {
|
114 | _symbolIterator = Symbol.iterator;
|
115 | }
|
116 | else {
|
117 |
|
118 | var keys = Object.getOwnPropertyNames(Map.prototype);
|
119 | for (var i = 0; i < keys.length; ++i) {
|
120 | var key = keys[i];
|
121 | if (key !== 'entries' && key !== 'size' &&
|
122 | ((Map)).prototype[key] === Map.prototype['entries']) {
|
123 | _symbolIterator = key;
|
124 | }
|
125 | }
|
126 | }
|
127 | }
|
128 | return _symbolIterator;
|
129 | }
|
130 |
|
131 |
|
132 |
|
133 |
|
134 | function scheduleMicroTask(fn) {
|
135 | Zone.current.scheduleMicroTask('scheduleMicrotask', fn);
|
136 | }
|
137 |
|
138 |
|
139 |
|
140 |
|
141 |
|
142 | function looseIdentical(a, b) {
|
143 | return a === b || typeof a === 'number' && typeof b === 'number' && isNaN(a) && isNaN(b);
|
144 | }
|
145 |
|
146 |
|
147 |
|
148 |
|
149 | function stringify(token) {
|
150 | if (typeof token === 'string') {
|
151 | return token;
|
152 | }
|
153 | if (token == null) {
|
154 | return '' + token;
|
155 | }
|
156 | if (token.overriddenName) {
|
157 | return "" + token.overriddenName;
|
158 | }
|
159 | if (token.name) {
|
160 | return "" + token.name;
|
161 | }
|
162 | var res = token.toString();
|
163 | if (res == null) {
|
164 | return '' + res;
|
165 | }
|
166 | var newLineIndex = res.indexOf('\n');
|
167 | return newLineIndex === -1 ? res : res.substring(0, newLineIndex);
|
168 | }
|
169 |
|
170 |
|
171 |
|
172 |
|
173 |
|
174 |
|
175 |
|
176 | var _nextClassId = 0;
|
177 | var Reflect = _global['Reflect'];
|
178 |
|
179 |
|
180 |
|
181 |
|
182 | function extractAnnotation(annotation) {
|
183 | if (typeof annotation === 'function' && annotation.hasOwnProperty('annotation')) {
|
184 |
|
185 | annotation = annotation.annotation;
|
186 | }
|
187 | return annotation;
|
188 | }
|
189 |
|
190 |
|
191 |
|
192 |
|
193 |
|
194 | function applyParams(fnOrArray, key) {
|
195 | if (fnOrArray === Object || fnOrArray === String || fnOrArray === Function ||
|
196 | fnOrArray === Number || fnOrArray === Array) {
|
197 | throw new Error("Can not use native " + stringify(fnOrArray) + " as constructor");
|
198 | }
|
199 | if (typeof fnOrArray === 'function') {
|
200 | return fnOrArray;
|
201 | }
|
202 | if (Array.isArray(fnOrArray)) {
|
203 | var annotations = (fnOrArray);
|
204 | var annoLength = annotations.length - 1;
|
205 | var fn = fnOrArray[annoLength];
|
206 | if (typeof fn !== 'function') {
|
207 | throw new Error("Last position of Class method array must be Function in key " + key + " was '" + stringify(fn) + "'");
|
208 | }
|
209 | if (annoLength != fn.length) {
|
210 | throw new Error("Number of annotations (" + annoLength + ") does not match number of arguments (" + fn.length + ") in the function: " + stringify(fn));
|
211 | }
|
212 | var paramsAnnotations = [];
|
213 | for (var i = 0, ii = annotations.length - 1; i < ii; i++) {
|
214 | var paramAnnotations = [];
|
215 | paramsAnnotations.push(paramAnnotations);
|
216 | var annotation = annotations[i];
|
217 | if (Array.isArray(annotation)) {
|
218 | for (var j = 0; j < annotation.length; j++) {
|
219 | paramAnnotations.push(extractAnnotation(annotation[j]));
|
220 | }
|
221 | }
|
222 | else if (typeof annotation === 'function') {
|
223 | paramAnnotations.push(extractAnnotation(annotation));
|
224 | }
|
225 | else {
|
226 | paramAnnotations.push(annotation);
|
227 | }
|
228 | }
|
229 | Reflect.defineMetadata('parameters', paramsAnnotations, fn);
|
230 | return fn;
|
231 | }
|
232 | throw new Error("Only Function or Array is supported in Class definition for key '" + key + "' is '" + stringify(fnOrArray) + "'");
|
233 | }
|
234 |
|
235 |
|
236 |
|
237 |
|
238 |
|
239 |
|
240 |
|
241 |
|
242 |
|
243 |
|
244 |
|
245 |
|
246 |
|
247 |
|
248 |
|
249 |
|
250 |
|
251 |
|
252 |
|
253 |
|
254 |
|
255 |
|
256 |
|
257 |
|
258 |
|
259 |
|
260 |
|
261 |
|
262 |
|
263 |
|
264 |
|
265 |
|
266 |
|
267 |
|
268 |
|
269 |
|
270 |
|
271 |
|
272 |
|
273 |
|
274 |
|
275 |
|
276 |
|
277 |
|
278 |
|
279 |
|
280 |
|
281 |
|
282 |
|
283 |
|
284 |
|
285 |
|
286 |
|
287 |
|
288 |
|
289 |
|
290 |
|
291 |
|
292 |
|
293 |
|
294 |
|
295 |
|
296 |
|
297 |
|
298 |
|
299 |
|
300 |
|
301 |
|
302 |
|
303 |
|
304 |
|
305 |
|
306 |
|
307 |
|
308 |
|
309 |
|
310 |
|
311 |
|
312 |
|
313 |
|
314 |
|
315 |
|
316 |
|
317 |
|
318 |
|
319 | function Class(clsDef) {
|
320 | var constructor = applyParams(clsDef.hasOwnProperty('constructor') ? clsDef.constructor : undefined, 'constructor');
|
321 | var /** @type {?} */ proto = constructor.prototype;
|
322 | if (clsDef.hasOwnProperty('extends')) {
|
323 | if (typeof clsDef.extends === 'function') {
|
324 | ((constructor)).prototype = proto =
|
325 | Object.create(((clsDef.extends)).prototype);
|
326 | }
|
327 | else {
|
328 | throw new Error("Class definition 'extends' property must be a constructor function was: " + stringify(clsDef.extends));
|
329 | }
|
330 | }
|
331 | for (var key in clsDef) {
|
332 | if (key !== 'extends' && key !== 'prototype' && clsDef.hasOwnProperty(key)) {
|
333 | proto[key] = applyParams(clsDef[key], key);
|
334 | }
|
335 | }
|
336 | if (this && this.annotations instanceof Array) {
|
337 | Reflect.defineMetadata('annotations', this.annotations, constructor);
|
338 | }
|
339 | var /** @type {?} */ constructorName = constructor['name'];
|
340 | if (!constructorName || constructorName === 'constructor') {
|
341 | ((constructor))['overriddenName'] = "class" + _nextClassId++;
|
342 | }
|
343 | return (constructor);
|
344 | }
|
345 | /**
|
346 | * @suppress {globalThis}
|
347 | * @param {?} name
|
348 | * @param {?} props
|
349 | * @param {?=} parentClass
|
350 | * @param {?=} chainFn
|
351 | * @return {?}
|
352 | */
|
353 | function makeDecorator(name, props, parentClass, chainFn) {
|
354 | var metaCtor = makeMetadataCtor([props]);
|
355 | |
356 |
|
357 |
|
358 |
|
359 | function DecoratorFactory(objOrType) {
|
360 | if (!(Reflect && Reflect.getOwnMetadata)) {
|
361 | throw 'reflect-metadata shim is required when using class decorators';
|
362 | }
|
363 | if (this instanceof DecoratorFactory) {
|
364 | metaCtor.call(this, objOrType);
|
365 | return this;
|
366 | }
|
367 | var annotationInstance = new ((DecoratorFactory))(objOrType);
|
368 | var chainAnnotation = typeof this === 'function' && Array.isArray(this.annotations) ? this.annotations : [];
|
369 | chainAnnotation.push(annotationInstance);
|
370 | var TypeDecorator = (function TypeDecorator(cls) {
|
371 | var annotations = Reflect.getOwnMetadata('annotations', cls) || [];
|
372 | annotations.push(annotationInstance);
|
373 | Reflect.defineMetadata('annotations', annotations, cls);
|
374 | return cls;
|
375 | });
|
376 | TypeDecorator.annotations = chainAnnotation;
|
377 | TypeDecorator.Class = Class;
|
378 | if (chainFn)
|
379 | chainFn(TypeDecorator);
|
380 | return TypeDecorator;
|
381 | }
|
382 | if (parentClass) {
|
383 | DecoratorFactory.prototype = Object.create(parentClass.prototype);
|
384 | }
|
385 | DecoratorFactory.prototype.toString = function () { return "@" + name; };
|
386 | ((DecoratorFactory)).annotationCls = DecoratorFactory;
|
387 | return DecoratorFactory;
|
388 | }
|
389 |
|
390 |
|
391 |
|
392 |
|
393 | function makeMetadataCtor(props) {
|
394 | return function ctor() {
|
395 | var _this = this;
|
396 | var args = [];
|
397 | for (var _i = 0; _i < arguments.length; _i++) {
|
398 | args[_i] = arguments[_i];
|
399 | }
|
400 | props.forEach(function (prop, i) {
|
401 | var argVal = args[i];
|
402 | if (Array.isArray(prop)) {
|
403 |
|
404 | _this[prop[0]] = argVal === undefined ? prop[1] : argVal;
|
405 | }
|
406 | else {
|
407 | for (var propName in prop) {
|
408 | _this[propName] =
|
409 | argVal && argVal.hasOwnProperty(propName) ? argVal[propName] : prop[propName];
|
410 | }
|
411 | }
|
412 | });
|
413 | };
|
414 | }
|
415 |
|
416 |
|
417 |
|
418 |
|
419 |
|
420 |
|
421 | function makeParamDecorator(name, props, parentClass) {
|
422 | var metaCtor = makeMetadataCtor(props);
|
423 | |
424 |
|
425 |
|
426 |
|
427 | function ParamDecoratorFactory() {
|
428 | var args = [];
|
429 | for (var _i = 0; _i < arguments.length; _i++) {
|
430 | args[_i] = arguments[_i];
|
431 | }
|
432 | if (this instanceof ParamDecoratorFactory) {
|
433 | metaCtor.apply(this, args);
|
434 | return this;
|
435 | }
|
436 | var annotationInstance = new (((ParamDecoratorFactory)).bind.apply(((ParamDecoratorFactory)), [void 0].concat(args)))();
|
437 | ((ParamDecorator)).annotation = annotationInstance;
|
438 | return ParamDecorator;
|
439 | |
440 |
|
441 |
|
442 |
|
443 |
|
444 |
|
445 | function ParamDecorator(cls, unusedKey, index) {
|
446 | var parameters = Reflect.getOwnMetadata('parameters', cls) || [];
|
447 |
|
448 |
|
449 | while (parameters.length <= index) {
|
450 | parameters.push(null);
|
451 | }
|
452 | parameters[index] = parameters[index] || [];
|
453 | ((parameters[index])).push(annotationInstance);
|
454 | Reflect.defineMetadata('parameters', parameters, cls);
|
455 | return cls;
|
456 | }
|
457 | }
|
458 | if (parentClass) {
|
459 | ParamDecoratorFactory.prototype = Object.create(parentClass.prototype);
|
460 | }
|
461 | ParamDecoratorFactory.prototype.toString = function () { return "@" + name; };
|
462 | ((ParamDecoratorFactory)).annotationCls = ParamDecoratorFactory;
|
463 | return ParamDecoratorFactory;
|
464 | }
|
465 |
|
466 |
|
467 |
|
468 |
|
469 |
|
470 |
|
471 | function makePropDecorator(name, props, parentClass) {
|
472 | var metaCtor = makeMetadataCtor(props);
|
473 | |
474 |
|
475 |
|
476 |
|
477 | function PropDecoratorFactory() {
|
478 | var args = [];
|
479 | for (var _i = 0; _i < arguments.length; _i++) {
|
480 | args[_i] = arguments[_i];
|
481 | }
|
482 | if (this instanceof PropDecoratorFactory) {
|
483 | metaCtor.apply(this, args);
|
484 | return this;
|
485 | }
|
486 | var decoratorInstance = new (((PropDecoratorFactory)).bind.apply(((PropDecoratorFactory)), [void 0].concat(args)))();
|
487 | return function PropDecorator(target, name) {
|
488 | var meta = Reflect.getOwnMetadata('propMetadata', target.constructor) || {};
|
489 | meta[name] = meta.hasOwnProperty(name) && meta[name] || [];
|
490 | meta[name].unshift(decoratorInstance);
|
491 | Reflect.defineMetadata('propMetadata', meta, target.constructor);
|
492 | };
|
493 | }
|
494 | if (parentClass) {
|
495 | PropDecoratorFactory.prototype = Object.create(parentClass.prototype);
|
496 | }
|
497 | PropDecoratorFactory.prototype.toString = function () { return "@" + name; };
|
498 | ((PropDecoratorFactory)).annotationCls = PropDecoratorFactory;
|
499 | return PropDecoratorFactory;
|
500 | }
|
501 |
|
502 |
|
503 |
|
504 |
|
505 |
|
506 |
|
507 |
|
508 |
|
509 |
|
510 |
|
511 |
|
512 |
|
513 |
|
514 |
|
515 |
|
516 |
|
517 |
|
518 |
|
519 |
|
520 |
|
521 |
|
522 |
|
523 |
|
524 |
|
525 |
|
526 |
|
527 |
|
528 |
|
529 |
|
530 |
|
531 |
|
532 |
|
533 |
|
534 |
|
535 |
|
536 |
|
537 |
|
538 |
|
539 |
|
540 |
|
541 |
|
542 | var ANALYZE_FOR_ENTRY_COMPONENTS = new InjectionToken('AnalyzeForEntryComponents');
|
543 |
|
544 |
|
545 |
|
546 |
|
547 |
|
548 |
|
549 | var Attribute = makeParamDecorator('Attribute', [['attributeName', undefined]]);
|
550 |
|
551 |
|
552 |
|
553 |
|
554 |
|
555 |
|
556 |
|
557 |
|
558 |
|
559 | var Query = (function () {
|
560 | function Query() {
|
561 | }
|
562 | return Query;
|
563 | }());
|
564 |
|
565 |
|
566 |
|
567 |
|
568 |
|
569 |
|
570 | var ContentChildren = makePropDecorator('ContentChildren', [
|
571 | ['selector', undefined], {
|
572 | first: false,
|
573 | isViewQuery: false,
|
574 | descendants: false,
|
575 | read: undefined,
|
576 | }
|
577 | ], Query);
|
578 |
|
579 |
|
580 |
|
581 |
|
582 |
|
583 |
|
584 | var ContentChild = makePropDecorator('ContentChild', [
|
585 | ['selector', undefined], {
|
586 | first: true,
|
587 | isViewQuery: false,
|
588 | descendants: true,
|
589 | read: undefined,
|
590 | }
|
591 | ], Query);
|
592 |
|
593 |
|
594 |
|
595 |
|
596 |
|
597 |
|
598 | var ViewChildren = makePropDecorator('ViewChildren', [
|
599 | ['selector', undefined], {
|
600 | first: false,
|
601 | isViewQuery: true,
|
602 | descendants: true,
|
603 | read: undefined,
|
604 | }
|
605 | ], Query);
|
606 |
|
607 |
|
608 |
|
609 |
|
610 |
|
611 |
|
612 | var ViewChild = makePropDecorator('ViewChild', [
|
613 | ['selector', undefined], {
|
614 | first: true,
|
615 | isViewQuery: true,
|
616 | descendants: true,
|
617 | read: undefined,
|
618 | }
|
619 | ], Query);
|
620 | var ChangeDetectionStrategy = {};
|
621 | ChangeDetectionStrategy.OnPush = 0;
|
622 | ChangeDetectionStrategy.Default = 1;
|
623 | ChangeDetectionStrategy[ChangeDetectionStrategy.OnPush] = "OnPush";
|
624 | ChangeDetectionStrategy[ChangeDetectionStrategy.Default] = "Default";
|
625 | var ChangeDetectorStatus = {};
|
626 | ChangeDetectorStatus.CheckOnce = 0;
|
627 | ChangeDetectorStatus.Checked = 1;
|
628 | ChangeDetectorStatus.CheckAlways = 2;
|
629 | ChangeDetectorStatus.Detached = 3;
|
630 | ChangeDetectorStatus.Errored = 4;
|
631 | ChangeDetectorStatus.Destroyed = 5;
|
632 | ChangeDetectorStatus[ChangeDetectorStatus.CheckOnce] = "CheckOnce";
|
633 | ChangeDetectorStatus[ChangeDetectorStatus.Checked] = "Checked";
|
634 | ChangeDetectorStatus[ChangeDetectorStatus.CheckAlways] = "CheckAlways";
|
635 | ChangeDetectorStatus[ChangeDetectorStatus.Detached] = "Detached";
|
636 | ChangeDetectorStatus[ChangeDetectorStatus.Errored] = "Errored";
|
637 | ChangeDetectorStatus[ChangeDetectorStatus.Destroyed] = "Destroyed";
|
638 |
|
639 |
|
640 |
|
641 |
|
642 | function isDefaultChangeDetectionStrategy(changeDetectionStrategy) {
|
643 | return changeDetectionStrategy == null ||
|
644 | changeDetectionStrategy === ChangeDetectionStrategy.Default;
|
645 | }
|
646 |
|
647 |
|
648 |
|
649 |
|
650 |
|
651 |
|
652 |
|
653 |
|
654 |
|
655 |
|
656 |
|
657 |
|
658 |
|
659 | var Directive = makeDecorator('Directive', {
|
660 | selector: undefined,
|
661 | inputs: undefined,
|
662 | outputs: undefined,
|
663 | host: undefined,
|
664 | providers: undefined,
|
665 | exportAs: undefined,
|
666 | queries: undefined
|
667 | });
|
668 |
|
669 |
|
670 |
|
671 |
|
672 |
|
673 |
|
674 | var Component = makeDecorator('Component', {
|
675 | selector: undefined,
|
676 | inputs: undefined,
|
677 | outputs: undefined,
|
678 | host: undefined,
|
679 | exportAs: undefined,
|
680 | moduleId: undefined,
|
681 | providers: undefined,
|
682 | viewProviders: undefined,
|
683 | changeDetection: ChangeDetectionStrategy.Default,
|
684 | queries: undefined,
|
685 | templateUrl: undefined,
|
686 | template: undefined,
|
687 | styleUrls: undefined,
|
688 | styles: undefined,
|
689 | animations: undefined,
|
690 | encapsulation: undefined,
|
691 | interpolation: undefined,
|
692 | entryComponents: undefined
|
693 | }, Directive);
|
694 |
|
695 |
|
696 |
|
697 |
|
698 |
|
699 |
|
700 | var Pipe = makeDecorator('Pipe', {
|
701 | name: undefined,
|
702 | pure: true,
|
703 | });
|
704 |
|
705 |
|
706 |
|
707 |
|
708 |
|
709 |
|
710 | var Input = makePropDecorator('Input', [['bindingPropertyName', undefined]]);
|
711 |
|
712 |
|
713 |
|
714 |
|
715 |
|
716 |
|
717 | var Output = makePropDecorator('Output', [['bindingPropertyName', undefined]]);
|
718 |
|
719 |
|
720 |
|
721 |
|
722 |
|
723 |
|
724 | var HostBinding = makePropDecorator('HostBinding', [['hostPropertyName', undefined]]);
|
725 |
|
726 |
|
727 |
|
728 |
|
729 |
|
730 |
|
731 | var HostListener = makePropDecorator('HostListener', [['eventName', undefined], ['args', []]]);
|
732 |
|
733 |
|
734 |
|
735 |
|
736 |
|
737 |
|
738 |
|
739 |
|
740 |
|
741 |
|
742 |
|
743 |
|
744 |
|
745 |
|
746 |
|
747 | var CUSTOM_ELEMENTS_SCHEMA = {
|
748 | name: 'custom-elements'
|
749 | };
|
750 |
|
751 |
|
752 |
|
753 |
|
754 |
|
755 | var NO_ERRORS_SCHEMA = {
|
756 | name: 'no-errors-schema'
|
757 | };
|
758 |
|
759 |
|
760 |
|
761 |
|
762 |
|
763 |
|
764 | var NgModule = makeDecorator('NgModule', {
|
765 | providers: undefined,
|
766 | declarations: undefined,
|
767 | imports: undefined,
|
768 | exports: undefined,
|
769 | entryComponents: undefined,
|
770 | bootstrap: undefined,
|
771 | schemas: undefined,
|
772 | id: undefined,
|
773 | });
|
774 | var ViewEncapsulation = {};
|
775 | ViewEncapsulation.Emulated = 0;
|
776 | ViewEncapsulation.Native = 1;
|
777 | ViewEncapsulation.None = 2;
|
778 | ViewEncapsulation[ViewEncapsulation.Emulated] = "Emulated";
|
779 | ViewEncapsulation[ViewEncapsulation.Native] = "Native";
|
780 | ViewEncapsulation[ViewEncapsulation.None] = "None";
|
781 |
|
782 |
|
783 |
|
784 |
|
785 |
|
786 |
|
787 |
|
788 |
|
789 |
|
790 |
|
791 |
|
792 |
|
793 |
|
794 |
|
795 |
|
796 |
|
797 |
|
798 |
|
799 |
|
800 |
|
801 |
|
802 |
|
803 |
|
804 |
|
805 |
|
806 | var ViewMetadata = (function () {
|
807 | |
808 |
|
809 |
|
810 | function ViewMetadata(_a) {
|
811 | var _b = _a === void 0 ? {} : _a, templateUrl = _b.templateUrl, template = _b.template, encapsulation = _b.encapsulation, styles = _b.styles, styleUrls = _b.styleUrls, animations = _b.animations, interpolation = _b.interpolation;
|
812 | this.templateUrl = templateUrl;
|
813 | this.template = template;
|
814 | this.styleUrls = styleUrls;
|
815 | this.styles = styles;
|
816 | this.encapsulation = encapsulation;
|
817 | this.animations = animations;
|
818 | this.interpolation = interpolation;
|
819 | }
|
820 | return ViewMetadata;
|
821 | }());
|
822 |
|
823 |
|
824 |
|
825 |
|
826 |
|
827 |
|
828 |
|
829 |
|
830 |
|
831 |
|
832 |
|
833 |
|
834 | var Version = (function () {
|
835 | |
836 |
|
837 |
|
838 | function Version(full) {
|
839 | this.full = full;
|
840 | }
|
841 | Object.defineProperty(Version.prototype, "major", {
|
842 | |
843 |
|
844 |
|
845 | get: function () { return this.full.split('.')[0]; },
|
846 | enumerable: true,
|
847 | configurable: true
|
848 | });
|
849 | Object.defineProperty(Version.prototype, "minor", {
|
850 | |
851 |
|
852 |
|
853 | get: function () { return this.full.split('.')[1]; },
|
854 | enumerable: true,
|
855 | configurable: true
|
856 | });
|
857 | Object.defineProperty(Version.prototype, "patch", {
|
858 | |
859 |
|
860 |
|
861 | get: function () { return this.full.split('.').slice(2).join('.'); },
|
862 | enumerable: true,
|
863 | configurable: true
|
864 | });
|
865 | return Version;
|
866 | }());
|
867 |
|
868 |
|
869 |
|
870 | var VERSION = new Version('4.1.1');
|
871 |
|
872 |
|
873 |
|
874 |
|
875 |
|
876 |
|
877 |
|
878 |
|
879 |
|
880 |
|
881 |
|
882 |
|
883 |
|
884 | var Inject = makeParamDecorator('Inject', [['token', undefined]]);
|
885 |
|
886 |
|
887 |
|
888 |
|
889 |
|
890 |
|
891 | var Optional = makeParamDecorator('Optional', []);
|
892 |
|
893 |
|
894 |
|
895 |
|
896 |
|
897 |
|
898 | var Injectable = makeDecorator('Injectable', []);
|
899 |
|
900 |
|
901 |
|
902 |
|
903 |
|
904 |
|
905 | var Self = makeParamDecorator('Self', []);
|
906 |
|
907 |
|
908 |
|
909 |
|
910 |
|
911 |
|
912 | var SkipSelf = makeParamDecorator('SkipSelf', []);
|
913 |
|
914 |
|
915 |
|
916 |
|
917 |
|
918 |
|
919 | var Host = makeParamDecorator('Host', []);
|
920 |
|
921 |
|
922 |
|
923 |
|
924 |
|
925 |
|
926 |
|
927 |
|
928 |
|
929 |
|
930 |
|
931 |
|
932 |
|
933 |
|
934 |
|
935 |
|
936 |
|
937 |
|
938 |
|
939 |
|
940 |
|
941 | function forwardRef(forwardRefFn) {
|
942 | ((forwardRefFn)).__forward_ref__ = forwardRef;
|
943 | ((forwardRefFn)).toString = function () { return stringify(this()); };
|
944 | return (((forwardRefFn)));
|
945 | }
|
946 |
|
947 |
|
948 |
|
949 |
|
950 |
|
951 |
|
952 |
|
953 |
|
954 |
|
955 |
|
956 |
|
957 |
|
958 |
|
959 |
|
960 | function resolveForwardRef(type) {
|
961 | if (typeof type === 'function' && type.hasOwnProperty('__forward_ref__') &&
|
962 | type.__forward_ref__ === forwardRef) {
|
963 | return ((type))();
|
964 | }
|
965 | else {
|
966 | return type;
|
967 | }
|
968 | }
|
969 |
|
970 |
|
971 |
|
972 |
|
973 |
|
974 |
|
975 |
|
976 | var _THROW_IF_NOT_FOUND = new Object();
|
977 | var THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND;
|
978 | var _NullInjector = (function () {
|
979 | function _NullInjector() {
|
980 | }
|
981 | |
982 |
|
983 |
|
984 |
|
985 |
|
986 | _NullInjector.prototype.get = function (token, notFoundValue) {
|
987 | if (notFoundValue === void 0) { notFoundValue = _THROW_IF_NOT_FOUND; }
|
988 | if (notFoundValue === _THROW_IF_NOT_FOUND) {
|
989 | throw new Error("No provider for " + stringify(token) + "!");
|
990 | }
|
991 | return notFoundValue;
|
992 | };
|
993 | return _NullInjector;
|
994 | }());
|
995 |
|
996 |
|
997 |
|
998 |
|
999 |
|
1000 |
|
1001 |
|
1002 |
|
1003 |
|
1004 |
|
1005 |
|
1006 |
|
1007 |
|
1008 |
|
1009 |
|
1010 |
|
1011 |
|
1012 |
|
1013 |
|
1014 |
|
1015 |
|
1016 | var Injector = (function () {
|
1017 | function Injector() {
|
1018 | }
|
1019 | |
1020 |
|
1021 |
|
1022 |
|
1023 |
|
1024 |
|
1025 |
|
1026 |
|
1027 |
|
1028 |
|
1029 |
|
1030 |
|
1031 | Injector.prototype.get = function (token, notFoundValue) { };
|
1032 | |
1033 |
|
1034 |
|
1035 |
|
1036 |
|
1037 |
|
1038 |
|
1039 |
|
1040 | Injector.prototype.get = function (token, notFoundValue) { };
|
1041 | return Injector;
|
1042 | }());
|
1043 | Injector.THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND;
|
1044 | Injector.NULL = new _NullInjector();
|
1045 |
|
1046 |
|
1047 |
|
1048 |
|
1049 |
|
1050 |
|
1051 |
|
1052 | var ERROR_COMPONENT_TYPE = 'ngComponentType';
|
1053 | var ERROR_DEBUG_CONTEXT = 'ngDebugContext';
|
1054 | var ERROR_ORIGINAL_ERROR = 'ngOriginalError';
|
1055 | var ERROR_LOGGER = 'ngErrorLogger';
|
1056 |
|
1057 |
|
1058 |
|
1059 |
|
1060 |
|
1061 |
|
1062 |
|
1063 |
|
1064 | function getDebugContext(error) {
|
1065 | return ((error))[ERROR_DEBUG_CONTEXT];
|
1066 | }
|
1067 |
|
1068 |
|
1069 |
|
1070 |
|
1071 | function getOriginalError(error) {
|
1072 | return ((error))[ERROR_ORIGINAL_ERROR];
|
1073 | }
|
1074 |
|
1075 |
|
1076 |
|
1077 |
|
1078 | function getErrorLogger(error) {
|
1079 | return ((error))[ERROR_LOGGER] || defaultErrorLogger;
|
1080 | }
|
1081 |
|
1082 |
|
1083 |
|
1084 |
|
1085 |
|
1086 | function defaultErrorLogger(console) {
|
1087 | var values = [];
|
1088 | for (var _i = 1; _i < arguments.length; _i++) {
|
1089 | values[_i - 1] = arguments[_i];
|
1090 | }
|
1091 | console.error.apply(console, values);
|
1092 | }
|
1093 |
|
1094 |
|
1095 |
|
1096 |
|
1097 |
|
1098 |
|
1099 |
|
1100 |
|
1101 |
|
1102 |
|
1103 |
|
1104 |
|
1105 |
|
1106 |
|
1107 |
|
1108 |
|
1109 |
|
1110 |
|
1111 |
|
1112 |
|
1113 |
|
1114 |
|
1115 |
|
1116 |
|
1117 |
|
1118 |
|
1119 |
|
1120 |
|
1121 |
|
1122 |
|
1123 |
|
1124 |
|
1125 |
|
1126 | var ErrorHandler = (function () {
|
1127 | |
1128 |
|
1129 |
|
1130 | function ErrorHandler(
|
1131 | /**
|
1132 | * @deprecated since v4.0 parameter no longer has an effect, as ErrorHandler will never
|
1133 | * rethrow.
|
1134 | */
|
1135 | deprecatedParameter) {
|
1136 | |
1137 |
|
1138 |
|
1139 | this._console = console;
|
1140 | }
|
1141 | |
1142 |
|
1143 |
|
1144 |
|
1145 | ErrorHandler.prototype.handleError = function (error) {
|
1146 | var originalError = this._findOriginalError(error);
|
1147 | var context = this._findContext(error);
|
1148 |
|
1149 |
|
1150 | var errorLogger = getErrorLogger(error);
|
1151 | errorLogger(this._console, "ERROR", error);
|
1152 | if (originalError) {
|
1153 | errorLogger(this._console, "ORIGINAL ERROR", originalError);
|
1154 | }
|
1155 | if (context) {
|
1156 | errorLogger(this._console, 'ERROR CONTEXT', context);
|
1157 | }
|
1158 | };
|
1159 | |
1160 |
|
1161 |
|
1162 |
|
1163 |
|
1164 | ErrorHandler.prototype._findContext = function (error) {
|
1165 | if (error) {
|
1166 | return getDebugContext(error) ? getDebugContext(error) :
|
1167 | this._findContext(getOriginalError(error));
|
1168 | }
|
1169 | return null;
|
1170 | };
|
1171 | |
1172 |
|
1173 |
|
1174 |
|
1175 |
|
1176 | ErrorHandler.prototype._findOriginalError = function (error) {
|
1177 | var e = getOriginalError(error);
|
1178 | while (e && getOriginalError(e)) {
|
1179 | e = getOriginalError(e);
|
1180 | }
|
1181 | return e;
|
1182 | };
|
1183 | return ErrorHandler;
|
1184 | }());
|
1185 |
|
1186 |
|
1187 |
|
1188 |
|
1189 |
|
1190 | function wrappedError(message, originalError) {
|
1191 | var msg = message + " caused by: " + (originalError instanceof Error ? originalError.message : originalError);
|
1192 | var error = Error(msg);
|
1193 | ((error))[ERROR_ORIGINAL_ERROR] = originalError;
|
1194 | return error;
|
1195 | }
|
1196 |
|
1197 |
|
1198 |
|
1199 |
|
1200 |
|
1201 |
|
1202 |
|
1203 |
|
1204 |
|
1205 |
|
1206 |
|
1207 | function findFirstClosedCycle(keys) {
|
1208 | var res = [];
|
1209 | for (var i = 0; i < keys.length; ++i) {
|
1210 | if (res.indexOf(keys[i]) > -1) {
|
1211 | res.push(keys[i]);
|
1212 | return res;
|
1213 | }
|
1214 | res.push(keys[i]);
|
1215 | }
|
1216 | return res;
|
1217 | }
|
1218 |
|
1219 |
|
1220 |
|
1221 |
|
1222 | function constructResolvingPath(keys) {
|
1223 | if (keys.length > 1) {
|
1224 | var reversed = findFirstClosedCycle(keys.slice().reverse());
|
1225 | var tokenStrs = reversed.map(function (k) { return stringify(k.token); });
|
1226 | return ' (' + tokenStrs.join(' -> ') + ')';
|
1227 | }
|
1228 | return '';
|
1229 | }
|
1230 |
|
1231 |
|
1232 |
|
1233 |
|
1234 |
|
1235 |
|
1236 |
|
1237 | function injectionError(injector, key, constructResolvingMessage, originalError) {
|
1238 | var error = ((originalError ? wrappedError('', originalError) : Error()));
|
1239 | error.addKey = addKey;
|
1240 | error.keys = [key];
|
1241 | error.injectors = [injector];
|
1242 | error.constructResolvingMessage = constructResolvingMessage;
|
1243 | error.message = error.constructResolvingMessage();
|
1244 | ((error))[ERROR_ORIGINAL_ERROR] = originalError;
|
1245 | return error;
|
1246 | }
|
1247 |
|
1248 |
|
1249 |
|
1250 |
|
1251 |
|
1252 |
|
1253 | function addKey(injector, key) {
|
1254 | this.injectors.push(injector);
|
1255 | this.keys.push(key);
|
1256 | this.message = this.constructResolvingMessage();
|
1257 | }
|
1258 |
|
1259 |
|
1260 |
|
1261 |
|
1262 |
|
1263 |
|
1264 |
|
1265 |
|
1266 |
|
1267 |
|
1268 |
|
1269 |
|
1270 |
|
1271 |
|
1272 |
|
1273 |
|
1274 |
|
1275 | function noProviderError(injector, key) {
|
1276 | return injectionError(injector, key, function () {
|
1277 | var first = stringify(this.keys[0].token);
|
1278 | return "No provider for " + first + "!" + constructResolvingPath(this.keys);
|
1279 | });
|
1280 | }
|
1281 |
|
1282 |
|
1283 |
|
1284 |
|
1285 |
|
1286 |
|
1287 |
|
1288 |
|
1289 |
|
1290 |
|
1291 |
|
1292 |
|
1293 |
|
1294 |
|
1295 |
|
1296 |
|
1297 |
|
1298 |
|
1299 |
|
1300 | function cyclicDependencyError(injector, key) {
|
1301 | return injectionError(injector, key, function () {
|
1302 | return "Cannot instantiate cyclic dependency!" + constructResolvingPath(this.keys);
|
1303 | });
|
1304 | }
|
1305 |
|
1306 |
|
1307 |
|
1308 |
|
1309 |
|
1310 |
|
1311 |
|
1312 |
|
1313 |
|
1314 |
|
1315 |
|
1316 |
|
1317 |
|
1318 |
|
1319 |
|
1320 |
|
1321 |
|
1322 |
|
1323 |
|
1324 |
|
1325 |
|
1326 |
|
1327 |
|
1328 |
|
1329 |
|
1330 |
|
1331 |
|
1332 |
|
1333 |
|
1334 |
|
1335 | function instantiationError(injector, originalException, originalStack, key) {
|
1336 | return injectionError(injector, key, function () {
|
1337 | var first = stringify(this.keys[0].token);
|
1338 | return getOriginalError(this).message + ": Error during instantiation of " + first + "!" + constructResolvingPath(this.keys) + ".";
|
1339 | }, originalException);
|
1340 | }
|
1341 |
|
1342 |
|
1343 |
|
1344 |
|
1345 |
|
1346 |
|
1347 |
|
1348 |
|
1349 |
|
1350 |
|
1351 |
|
1352 |
|
1353 | function invalidProviderError(provider) {
|
1354 | return Error("Invalid provider - only instances of Provider and Type are allowed, got: " + provider);
|
1355 | }
|
1356 |
|
1357 |
|
1358 |
|
1359 |
|
1360 |
|
1361 |
|
1362 |
|
1363 |
|
1364 |
|
1365 |
|
1366 |
|
1367 |
|
1368 |
|
1369 |
|
1370 |
|
1371 |
|
1372 |
|
1373 |
|
1374 |
|
1375 |
|
1376 |
|
1377 |
|
1378 |
|
1379 |
|
1380 |
|
1381 |
|
1382 |
|
1383 |
|
1384 |
|
1385 |
|
1386 |
|
1387 |
|
1388 | function noAnnotationError(typeOrFunc, params) {
|
1389 | var signature = [];
|
1390 | for (var i = 0, ii = params.length; i < ii; i++) {
|
1391 | var parameter = params[i];
|
1392 | if (!parameter || parameter.length == 0) {
|
1393 | signature.push('?');
|
1394 | }
|
1395 | else {
|
1396 | signature.push(parameter.map(stringify).join(' '));
|
1397 | }
|
1398 | }
|
1399 | return Error('Cannot resolve all parameters for \'' + stringify(typeOrFunc) + '\'(' +
|
1400 | signature.join(', ') + '). ' +
|
1401 | 'Make sure that all the parameters are decorated with Inject or have valid type annotations and that \'' +
|
1402 | stringify(typeOrFunc) + '\' is decorated with Injectable.');
|
1403 | }
|
1404 |
|
1405 |
|
1406 |
|
1407 |
|
1408 |
|
1409 |
|
1410 |
|
1411 |
|
1412 |
|
1413 |
|
1414 |
|
1415 |
|
1416 |
|
1417 |
|
1418 |
|
1419 |
|
1420 | function outOfBoundsError(index) {
|
1421 | return Error("Index " + index + " is out-of-bounds.");
|
1422 | }
|
1423 |
|
1424 |
|
1425 |
|
1426 |
|
1427 |
|
1428 |
|
1429 |
|
1430 |
|
1431 |
|
1432 |
|
1433 |
|
1434 |
|
1435 |
|
1436 |
|
1437 |
|
1438 | function mixingMultiProvidersWithRegularProvidersError(provider1, provider2) {
|
1439 | return Error("Cannot mix multi providers and regular providers, got: " + provider1 + " " + provider2);
|
1440 | }
|
1441 |
|
1442 |
|
1443 |
|
1444 |
|
1445 |
|
1446 |
|
1447 |
|
1448 |
|
1449 |
|
1450 |
|
1451 |
|
1452 |
|
1453 |
|
1454 |
|
1455 |
|
1456 |
|
1457 |
|
1458 |
|
1459 |
|
1460 |
|
1461 |
|
1462 |
|
1463 |
|
1464 | var ReflectiveKey = (function () {
|
1465 | |
1466 |
|
1467 |
|
1468 |
|
1469 |
|
1470 | function ReflectiveKey(token, id) {
|
1471 | this.token = token;
|
1472 | this.id = id;
|
1473 | if (!token) {
|
1474 | throw new Error('Token must be defined!');
|
1475 | }
|
1476 | }
|
1477 | Object.defineProperty(ReflectiveKey.prototype, "displayName", {
|
1478 | |
1479 |
|
1480 |
|
1481 |
|
1482 | get: function () { return stringify(this.token); },
|
1483 | enumerable: true,
|
1484 | configurable: true
|
1485 | });
|
1486 | |
1487 |
|
1488 |
|
1489 |
|
1490 |
|
1491 | ReflectiveKey.get = function (token) {
|
1492 | return _globalKeyRegistry.get(resolveForwardRef(token));
|
1493 | };
|
1494 | Object.defineProperty(ReflectiveKey, "numberOfKeys", {
|
1495 | |
1496 |
|
1497 |
|
1498 | get: function () { return _globalKeyRegistry.numberOfKeys; },
|
1499 | enumerable: true,
|
1500 | configurable: true
|
1501 | });
|
1502 | return ReflectiveKey;
|
1503 | }());
|
1504 |
|
1505 |
|
1506 |
|
1507 | var KeyRegistry = (function () {
|
1508 | function KeyRegistry() {
|
1509 | this._allKeys = new Map();
|
1510 | }
|
1511 | |
1512 |
|
1513 |
|
1514 |
|
1515 | KeyRegistry.prototype.get = function (token) {
|
1516 | if (token instanceof ReflectiveKey)
|
1517 | return token;
|
1518 | if (this._allKeys.has(token)) {
|
1519 | return ((this._allKeys.get(token)));
|
1520 | }
|
1521 | var newKey = new ReflectiveKey(token, ReflectiveKey.numberOfKeys);
|
1522 | this._allKeys.set(token, newKey);
|
1523 | return newKey;
|
1524 | };
|
1525 | Object.defineProperty(KeyRegistry.prototype, "numberOfKeys", {
|
1526 | |
1527 |
|
1528 |
|
1529 | get: function () { return this._allKeys.size; },
|
1530 | enumerable: true,
|
1531 | configurable: true
|
1532 | });
|
1533 | return KeyRegistry;
|
1534 | }());
|
1535 | var _globalKeyRegistry = new KeyRegistry();
|
1536 |
|
1537 |
|
1538 |
|
1539 |
|
1540 |
|
1541 |
|
1542 |
|
1543 |
|
1544 |
|
1545 |
|
1546 | var Type = Function;
|
1547 |
|
1548 |
|
1549 |
|
1550 |
|
1551 | function isType(v) {
|
1552 | return typeof v === 'function';
|
1553 | }
|
1554 |
|
1555 |
|
1556 |
|
1557 |
|
1558 |
|
1559 |
|
1560 |
|
1561 |
|
1562 |
|
1563 |
|
1564 | var DELEGATE_CTOR = /^function\s+\S+\(\)\s*{[\s\S]+\.apply\(this,\s*arguments\)/;
|
1565 | var ReflectionCapabilities = (function () {
|
1566 | |
1567 |
|
1568 |
|
1569 | function ReflectionCapabilities(reflect) {
|
1570 | this._reflect = reflect || _global['Reflect'];
|
1571 | }
|
1572 | |
1573 |
|
1574 |
|
1575 | ReflectionCapabilities.prototype.isReflectionEnabled = function () { return true; };
|
1576 | |
1577 |
|
1578 |
|
1579 |
|
1580 |
|
1581 | ReflectionCapabilities.prototype.factory = function (t) { return function () {
|
1582 | var args = [];
|
1583 | for (var _i = 0; _i < arguments.length; _i++) {
|
1584 | args[_i] = arguments[_i];
|
1585 | }
|
1586 | return new (t.bind.apply(t, [void 0].concat(args)))();
|
1587 | }; };
|
1588 | |
1589 |
|
1590 |
|
1591 |
|
1592 |
|
1593 |
|
1594 | ReflectionCapabilities.prototype._zipTypesAndAnnotations = function (paramTypes, paramAnnotations) {
|
1595 | var result;
|
1596 | if (typeof paramTypes === 'undefined') {
|
1597 | result = new Array(paramAnnotations.length);
|
1598 | }
|
1599 | else {
|
1600 | result = new Array(paramTypes.length);
|
1601 | }
|
1602 | for (var i = 0; i < result.length; i++) {
|
1603 |
|
1604 |
|
1605 |
|
1606 | if (typeof paramTypes === 'undefined') {
|
1607 | result[i] = [];
|
1608 | }
|
1609 | else if (paramTypes[i] != Object) {
|
1610 | result[i] = [paramTypes[i]];
|
1611 | }
|
1612 | else {
|
1613 | result[i] = [];
|
1614 | }
|
1615 | if (paramAnnotations && paramAnnotations[i] != null) {
|
1616 | result[i] = result[i].concat(paramAnnotations[i]);
|
1617 | }
|
1618 | }
|
1619 | return result;
|
1620 | };
|
1621 | |
1622 |
|
1623 |
|
1624 |
|
1625 |
|
1626 | ReflectionCapabilities.prototype._ownParameters = function (type, parentCtor) {
|
1627 |
|
1628 |
|
1629 |
|
1630 |
|
1631 |
|
1632 |
|
1633 |
|
1634 | if (DELEGATE_CTOR.exec(type.toString())) {
|
1635 | return null;
|
1636 | }
|
1637 |
|
1638 | if (((type)).parameters && ((type)).parameters !== parentCtor.parameters) {
|
1639 | return ((type)).parameters;
|
1640 | }
|
1641 |
|
1642 | var tsickleCtorParams = ((type)).ctorParameters;
|
1643 | if (tsickleCtorParams && tsickleCtorParams !== parentCtor.ctorParameters) {
|
1644 |
|
1645 |
|
1646 | var ctorParameters = typeof tsickleCtorParams === 'function' ? tsickleCtorParams() : tsickleCtorParams;
|
1647 | var paramTypes = ctorParameters.map(function (ctorParam) { return ctorParam && ctorParam.type; });
|
1648 | var paramAnnotations = ctorParameters.map(function (ctorParam) { return ctorParam && convertTsickleDecoratorIntoMetadata(ctorParam.decorators); });
|
1649 | return this._zipTypesAndAnnotations(paramTypes, paramAnnotations);
|
1650 | }
|
1651 |
|
1652 | if (this._reflect != null && this._reflect.getOwnMetadata != null) {
|
1653 | var paramAnnotations = this._reflect.getOwnMetadata('parameters', type);
|
1654 | var paramTypes = this._reflect.getOwnMetadata('design:paramtypes', type);
|
1655 | if (paramTypes || paramAnnotations) {
|
1656 | return this._zipTypesAndAnnotations(paramTypes, paramAnnotations);
|
1657 | }
|
1658 | }
|
1659 |
|
1660 |
|
1661 |
|
1662 |
|
1663 | return new Array(((type.length))).fill(undefined);
|
1664 | };
|
1665 | |
1666 |
|
1667 |
|
1668 |
|
1669 | ReflectionCapabilities.prototype.parameters = function (type) {
|
1670 |
|
1671 |
|
1672 | if (!isType(type)) {
|
1673 | return [];
|
1674 | }
|
1675 | var parentCtor = getParentCtor(type);
|
1676 | var parameters = this._ownParameters(type, parentCtor);
|
1677 | if (!parameters && parentCtor !== Object) {
|
1678 | parameters = this.parameters(parentCtor);
|
1679 | }
|
1680 | return parameters || [];
|
1681 | };
|
1682 | |
1683 |
|
1684 |
|
1685 |
|
1686 |
|
1687 | ReflectionCapabilities.prototype._ownAnnotations = function (typeOrFunc, parentCtor) {
|
1688 |
|
1689 | if (((typeOrFunc)).annotations && ((typeOrFunc)).annotations !== parentCtor.annotations) {
|
1690 | var annotations = ((typeOrFunc)).annotations;
|
1691 | if (typeof annotations === 'function' && annotations.annotations) {
|
1692 | annotations = annotations.annotations;
|
1693 | }
|
1694 | return annotations;
|
1695 | }
|
1696 |
|
1697 | if (((typeOrFunc)).decorators && ((typeOrFunc)).decorators !== parentCtor.decorators) {
|
1698 | return convertTsickleDecoratorIntoMetadata(((typeOrFunc)).decorators);
|
1699 | }
|
1700 |
|
1701 | if (this._reflect && this._reflect.getOwnMetadata) {
|
1702 | return this._reflect.getOwnMetadata('annotations', typeOrFunc);
|
1703 | }
|
1704 | return null;
|
1705 | };
|
1706 | |
1707 |
|
1708 |
|
1709 |
|
1710 | ReflectionCapabilities.prototype.annotations = function (typeOrFunc) {
|
1711 | if (!isType(typeOrFunc)) {
|
1712 | return [];
|
1713 | }
|
1714 | var parentCtor = getParentCtor(typeOrFunc);
|
1715 | var ownAnnotations = this._ownAnnotations(typeOrFunc, parentCtor) || [];
|
1716 | var parentAnnotations = parentCtor !== Object ? this.annotations(parentCtor) : [];
|
1717 | return parentAnnotations.concat(ownAnnotations);
|
1718 | };
|
1719 | |
1720 |
|
1721 |
|
1722 |
|
1723 |
|
1724 | ReflectionCapabilities.prototype._ownPropMetadata = function (typeOrFunc, parentCtor) {
|
1725 |
|
1726 | if (((typeOrFunc)).propMetadata &&
|
1727 | ((typeOrFunc)).propMetadata !== parentCtor.propMetadata) {
|
1728 | var propMetadata = ((typeOrFunc)).propMetadata;
|
1729 | if (typeof propMetadata === 'function' && propMetadata.propMetadata) {
|
1730 | propMetadata = propMetadata.propMetadata;
|
1731 | }
|
1732 | return propMetadata;
|
1733 | }
|
1734 |
|
1735 | if (((typeOrFunc)).propDecorators &&
|
1736 | ((typeOrFunc)).propDecorators !== parentCtor.propDecorators) {
|
1737 | var propDecorators_1 = ((typeOrFunc)).propDecorators;
|
1738 | var propMetadata_1 = ({});
|
1739 | Object.keys(propDecorators_1).forEach(function (prop) {
|
1740 | propMetadata_1[prop] = convertTsickleDecoratorIntoMetadata(propDecorators_1[prop]);
|
1741 | });
|
1742 | return propMetadata_1;
|
1743 | }
|
1744 |
|
1745 | if (this._reflect && this._reflect.getOwnMetadata) {
|
1746 | return this._reflect.getOwnMetadata('propMetadata', typeOrFunc);
|
1747 | }
|
1748 | return null;
|
1749 | };
|
1750 | |
1751 |
|
1752 |
|
1753 |
|
1754 | ReflectionCapabilities.prototype.propMetadata = function (typeOrFunc) {
|
1755 | if (!isType(typeOrFunc)) {
|
1756 | return {};
|
1757 | }
|
1758 | var parentCtor = getParentCtor(typeOrFunc);
|
1759 | var propMetadata = {};
|
1760 | if (parentCtor !== Object) {
|
1761 | var parentPropMetadata_1 = this.propMetadata(parentCtor);
|
1762 | Object.keys(parentPropMetadata_1).forEach(function (propName) {
|
1763 | propMetadata[propName] = parentPropMetadata_1[propName];
|
1764 | });
|
1765 | }
|
1766 | var ownPropMetadata = this._ownPropMetadata(typeOrFunc, parentCtor);
|
1767 | if (ownPropMetadata) {
|
1768 | Object.keys(ownPropMetadata).forEach(function (propName) {
|
1769 | var decorators = [];
|
1770 | if (propMetadata.hasOwnProperty(propName)) {
|
1771 | decorators.push.apply(decorators, propMetadata[propName]);
|
1772 | }
|
1773 | decorators.push.apply(decorators, ownPropMetadata[propName]);
|
1774 | propMetadata[propName] = decorators;
|
1775 | });
|
1776 | }
|
1777 | return propMetadata;
|
1778 | };
|
1779 | |
1780 |
|
1781 |
|
1782 |
|
1783 |
|
1784 | ReflectionCapabilities.prototype.hasLifecycleHook = function (type, lcProperty) {
|
1785 | return type instanceof Type && lcProperty in type.prototype;
|
1786 | };
|
1787 | |
1788 |
|
1789 |
|
1790 |
|
1791 | ReflectionCapabilities.prototype.getter = function (name) { return (new Function('o', 'return o.' + name + ';')); };
|
1792 | |
1793 |
|
1794 |
|
1795 |
|
1796 | ReflectionCapabilities.prototype.setter = function (name) {
|
1797 | return (new Function('o', 'v', 'return o.' + name + ' = v;'));
|
1798 | };
|
1799 | |
1800 |
|
1801 |
|
1802 |
|
1803 | ReflectionCapabilities.prototype.method = function (name) {
|
1804 | var functionBody = "if (!o." + name + ") throw new Error('\"" + name + "\" is undefined');\n return o." + name + ".apply(o, args);";
|
1805 | return (new Function('o', 'args', functionBody));
|
1806 | };
|
1807 | |
1808 |
|
1809 |
|
1810 |
|
1811 | ReflectionCapabilities.prototype.importUri = function (type) {
|
1812 |
|
1813 | if (typeof type === 'object' && type['filePath']) {
|
1814 | return type['filePath'];
|
1815 | }
|
1816 |
|
1817 | return "./" + stringify(type);
|
1818 | };
|
1819 | |
1820 |
|
1821 |
|
1822 |
|
1823 | ReflectionCapabilities.prototype.resourceUri = function (type) { return "./" + stringify(type); };
|
1824 | |
1825 |
|
1826 |
|
1827 |
|
1828 |
|
1829 |
|
1830 |
|
1831 | ReflectionCapabilities.prototype.resolveIdentifier = function (name, moduleUrl, members, runtime) {
|
1832 | return runtime;
|
1833 | };
|
1834 | |
1835 |
|
1836 |
|
1837 |
|
1838 |
|
1839 | ReflectionCapabilities.prototype.resolveEnum = function (enumIdentifier, name) { return enumIdentifier[name]; };
|
1840 | return ReflectionCapabilities;
|
1841 | }());
|
1842 |
|
1843 |
|
1844 |
|
1845 |
|
1846 | function convertTsickleDecoratorIntoMetadata(decoratorInvocations) {
|
1847 | if (!decoratorInvocations) {
|
1848 | return [];
|
1849 | }
|
1850 | return decoratorInvocations.map(function (decoratorInvocation) {
|
1851 | var decoratorType = decoratorInvocation.type;
|
1852 | var annotationCls = decoratorType.annotationCls;
|
1853 | var annotationArgs = decoratorInvocation.args ? decoratorInvocation.args : [];
|
1854 | return new (annotationCls.bind.apply(annotationCls, [void 0].concat(annotationArgs)))();
|
1855 | });
|
1856 | }
|
1857 |
|
1858 |
|
1859 |
|
1860 |
|
1861 | function getParentCtor(ctor) {
|
1862 | var parentProto = Object.getPrototypeOf(ctor.prototype);
|
1863 | var parentCtor = parentProto ? parentProto.constructor : null;
|
1864 |
|
1865 |
|
1866 | return parentCtor || Object;
|
1867 | }
|
1868 |
|
1869 |
|
1870 |
|
1871 |
|
1872 |
|
1873 | var ReflectorReader = (function () {
|
1874 | function ReflectorReader() {
|
1875 | }
|
1876 | |
1877 |
|
1878 |
|
1879 |
|
1880 |
|
1881 | ReflectorReader.prototype.parameters = function (typeOrFunc) { };
|
1882 | |
1883 |
|
1884 |
|
1885 |
|
1886 |
|
1887 | ReflectorReader.prototype.annotations = function (typeOrFunc) { };
|
1888 | |
1889 |
|
1890 |
|
1891 |
|
1892 |
|
1893 | ReflectorReader.prototype.propMetadata = function (typeOrFunc) { };
|
1894 | |
1895 |
|
1896 |
|
1897 |
|
1898 |
|
1899 | ReflectorReader.prototype.importUri = function (typeOrFunc) { };
|
1900 | |
1901 |
|
1902 |
|
1903 |
|
1904 |
|
1905 | ReflectorReader.prototype.resourceUri = function (typeOrFunc) { };
|
1906 | |
1907 |
|
1908 |
|
1909 |
|
1910 |
|
1911 |
|
1912 |
|
1913 |
|
1914 | ReflectorReader.prototype.resolveIdentifier = function (name, moduleUrl, members, runtime) { };
|
1915 | |
1916 |
|
1917 |
|
1918 |
|
1919 |
|
1920 |
|
1921 | ReflectorReader.prototype.resolveEnum = function (identifier, name) { };
|
1922 | return ReflectorReader;
|
1923 | }());
|
1924 |
|
1925 |
|
1926 |
|
1927 |
|
1928 |
|
1929 |
|
1930 |
|
1931 |
|
1932 |
|
1933 |
|
1934 |
|
1935 | var Reflector = (function (_super) {
|
1936 | __extends(Reflector, _super);
|
1937 | |
1938 |
|
1939 |
|
1940 | function Reflector(reflectionCapabilities) {
|
1941 | var _this = _super.call(this) || this;
|
1942 | _this.reflectionCapabilities = reflectionCapabilities;
|
1943 | return _this;
|
1944 | }
|
1945 | |
1946 |
|
1947 |
|
1948 |
|
1949 | Reflector.prototype.updateCapabilities = function (caps) { this.reflectionCapabilities = caps; };
|
1950 | |
1951 |
|
1952 |
|
1953 |
|
1954 | Reflector.prototype.factory = function (type) { return this.reflectionCapabilities.factory(type); };
|
1955 | |
1956 |
|
1957 |
|
1958 |
|
1959 | Reflector.prototype.parameters = function (typeOrFunc) {
|
1960 | return this.reflectionCapabilities.parameters(typeOrFunc);
|
1961 | };
|
1962 | |
1963 |
|
1964 |
|
1965 |
|
1966 | Reflector.prototype.annotations = function (typeOrFunc) {
|
1967 | return this.reflectionCapabilities.annotations(typeOrFunc);
|
1968 | };
|
1969 | |
1970 |
|
1971 |
|
1972 |
|
1973 | Reflector.prototype.propMetadata = function (typeOrFunc) {
|
1974 | return this.reflectionCapabilities.propMetadata(typeOrFunc);
|
1975 | };
|
1976 | |
1977 |
|
1978 |
|
1979 |
|
1980 |
|
1981 | Reflector.prototype.hasLifecycleHook = function (type, lcProperty) {
|
1982 | return this.reflectionCapabilities.hasLifecycleHook(type, lcProperty);
|
1983 | };
|
1984 | |
1985 |
|
1986 |
|
1987 |
|
1988 | Reflector.prototype.getter = function (name) { return this.reflectionCapabilities.getter(name); };
|
1989 | |
1990 |
|
1991 |
|
1992 |
|
1993 | Reflector.prototype.setter = function (name) { return this.reflectionCapabilities.setter(name); };
|
1994 | |
1995 |
|
1996 |
|
1997 |
|
1998 | Reflector.prototype.method = function (name) { return this.reflectionCapabilities.method(name); };
|
1999 | |
2000 |
|
2001 |
|
2002 |
|
2003 | Reflector.prototype.importUri = function (type) { return this.reflectionCapabilities.importUri(type); };
|
2004 | |
2005 |
|
2006 |
|
2007 |
|
2008 | Reflector.prototype.resourceUri = function (type) { return this.reflectionCapabilities.resourceUri(type); };
|
2009 | |
2010 |
|
2011 |
|
2012 |
|
2013 |
|
2014 |
|
2015 |
|
2016 | Reflector.prototype.resolveIdentifier = function (name, moduleUrl, members, runtime) {
|
2017 | return this.reflectionCapabilities.resolveIdentifier(name, moduleUrl, members, runtime);
|
2018 | };
|
2019 | |
2020 |
|
2021 |
|
2022 |
|
2023 |
|
2024 | Reflector.prototype.resolveEnum = function (identifier, name) {
|
2025 | return this.reflectionCapabilities.resolveEnum(identifier, name);
|
2026 | };
|
2027 | return Reflector;
|
2028 | }(ReflectorReader));
|
2029 |
|
2030 |
|
2031 |
|
2032 |
|
2033 |
|
2034 |
|
2035 |
|
2036 |
|
2037 |
|
2038 |
|
2039 |
|
2040 | var reflector = new Reflector(new ReflectionCapabilities());
|
2041 |
|
2042 |
|
2043 |
|
2044 |
|
2045 |
|
2046 |
|
2047 |
|
2048 |
|
2049 |
|
2050 |
|
2051 |
|
2052 | var ReflectiveDependency = (function () {
|
2053 | |
2054 |
|
2055 |
|
2056 |
|
2057 |
|
2058 | function ReflectiveDependency(key, optional, visibility) {
|
2059 | this.key = key;
|
2060 | this.optional = optional;
|
2061 | this.visibility = visibility;
|
2062 | }
|
2063 | |
2064 |
|
2065 |
|
2066 |
|
2067 | ReflectiveDependency.fromKey = function (key) {
|
2068 | return new ReflectiveDependency(key, false, null);
|
2069 | };
|
2070 | return ReflectiveDependency;
|
2071 | }());
|
2072 | var _EMPTY_LIST = [];
|
2073 | var ResolvedReflectiveProvider_ = (function () {
|
2074 | |
2075 |
|
2076 |
|
2077 |
|
2078 |
|
2079 | function ResolvedReflectiveProvider_(key, resolvedFactories, multiProvider) {
|
2080 | this.key = key;
|
2081 | this.resolvedFactories = resolvedFactories;
|
2082 | this.multiProvider = multiProvider;
|
2083 | }
|
2084 | Object.defineProperty(ResolvedReflectiveProvider_.prototype, "resolvedFactory", {
|
2085 | |
2086 |
|
2087 |
|
2088 | get: function () { return this.resolvedFactories[0]; },
|
2089 | enumerable: true,
|
2090 | configurable: true
|
2091 | });
|
2092 | return ResolvedReflectiveProvider_;
|
2093 | }());
|
2094 |
|
2095 |
|
2096 |
|
2097 |
|
2098 |
|
2099 | var ResolvedReflectiveFactory = (function () {
|
2100 | |
2101 |
|
2102 |
|
2103 |
|
2104 | function ResolvedReflectiveFactory(factory, dependencies) {
|
2105 | this.factory = factory;
|
2106 | this.dependencies = dependencies;
|
2107 | }
|
2108 | return ResolvedReflectiveFactory;
|
2109 | }());
|
2110 |
|
2111 |
|
2112 |
|
2113 |
|
2114 |
|
2115 | function resolveReflectiveFactory(provider) {
|
2116 | var factoryFn;
|
2117 | var resolvedDeps;
|
2118 | if (provider.useClass) {
|
2119 | var useClass = resolveForwardRef(provider.useClass);
|
2120 | factoryFn = reflector.factory(useClass);
|
2121 | resolvedDeps = _dependenciesFor(useClass);
|
2122 | }
|
2123 | else if (provider.useExisting) {
|
2124 | factoryFn = function (aliasInstance) { return aliasInstance; };
|
2125 | resolvedDeps = [ReflectiveDependency.fromKey(ReflectiveKey.get(provider.useExisting))];
|
2126 | }
|
2127 | else if (provider.useFactory) {
|
2128 | factoryFn = provider.useFactory;
|
2129 | resolvedDeps = constructDependencies(provider.useFactory, provider.deps);
|
2130 | }
|
2131 | else {
|
2132 | factoryFn = function () { return provider.useValue; };
|
2133 | resolvedDeps = _EMPTY_LIST;
|
2134 | }
|
2135 | return new ResolvedReflectiveFactory(factoryFn, resolvedDeps);
|
2136 | }
|
2137 |
|
2138 |
|
2139 |
|
2140 |
|
2141 |
|
2142 |
|
2143 |
|
2144 |
|
2145 | function resolveReflectiveProvider(provider) {
|
2146 | return new ResolvedReflectiveProvider_(ReflectiveKey.get(provider.provide), [resolveReflectiveFactory(provider)], provider.multi || false);
|
2147 | }
|
2148 |
|
2149 |
|
2150 |
|
2151 |
|
2152 |
|
2153 | function resolveReflectiveProviders(providers) {
|
2154 | var normalized = _normalizeProviders(providers, []);
|
2155 | var resolved = normalized.map(resolveReflectiveProvider);
|
2156 | var resolvedProviderMap = mergeResolvedReflectiveProviders(resolved, new Map());
|
2157 | return Array.from(resolvedProviderMap.values());
|
2158 | }
|
2159 |
|
2160 |
|
2161 |
|
2162 |
|
2163 |
|
2164 |
|
2165 |
|
2166 |
|
2167 | function mergeResolvedReflectiveProviders(providers, normalizedProvidersMap) {
|
2168 | for (var i = 0; i < providers.length; i++) {
|
2169 | var provider = providers[i];
|
2170 | var existing = normalizedProvidersMap.get(provider.key.id);
|
2171 | if (existing) {
|
2172 | if (provider.multiProvider !== existing.multiProvider) {
|
2173 | throw mixingMultiProvidersWithRegularProvidersError(existing, provider);
|
2174 | }
|
2175 | if (provider.multiProvider) {
|
2176 | for (var j = 0; j < provider.resolvedFactories.length; j++) {
|
2177 | existing.resolvedFactories.push(provider.resolvedFactories[j]);
|
2178 | }
|
2179 | }
|
2180 | else {
|
2181 | normalizedProvidersMap.set(provider.key.id, provider);
|
2182 | }
|
2183 | }
|
2184 | else {
|
2185 | var resolvedProvider = void 0;
|
2186 | if (provider.multiProvider) {
|
2187 | resolvedProvider = new ResolvedReflectiveProvider_(provider.key, provider.resolvedFactories.slice(), provider.multiProvider);
|
2188 | }
|
2189 | else {
|
2190 | resolvedProvider = provider;
|
2191 | }
|
2192 | normalizedProvidersMap.set(provider.key.id, resolvedProvider);
|
2193 | }
|
2194 | }
|
2195 | return normalizedProvidersMap;
|
2196 | }
|
2197 |
|
2198 |
|
2199 |
|
2200 |
|
2201 |
|
2202 | function _normalizeProviders(providers, res) {
|
2203 | providers.forEach(function (b) {
|
2204 | if (b instanceof Type) {
|
2205 | res.push({ provide: b, useClass: b });
|
2206 | }
|
2207 | else if (b && typeof b == 'object' && ((b)).provide !== undefined) {
|
2208 | res.push( (b));
|
2209 | }
|
2210 | else if (b instanceof Array) {
|
2211 | _normalizeProviders(b, res);
|
2212 | }
|
2213 | else {
|
2214 | throw invalidProviderError(b);
|
2215 | }
|
2216 | });
|
2217 | return res;
|
2218 | }
|
2219 |
|
2220 |
|
2221 |
|
2222 |
|
2223 |
|
2224 | function constructDependencies(typeOrFunc, dependencies) {
|
2225 | if (!dependencies) {
|
2226 | return _dependenciesFor(typeOrFunc);
|
2227 | }
|
2228 | else {
|
2229 | var params_1 = dependencies.map(function (t) { return [t]; });
|
2230 | return dependencies.map(function (t) { return _extractToken(typeOrFunc, t, params_1); });
|
2231 | }
|
2232 | }
|
2233 |
|
2234 |
|
2235 |
|
2236 |
|
2237 | function _dependenciesFor(typeOrFunc) {
|
2238 | var params = reflector.parameters(typeOrFunc);
|
2239 | if (!params)
|
2240 | return [];
|
2241 | if (params.some(function (p) { return p == null; })) {
|
2242 | throw noAnnotationError(typeOrFunc, params);
|
2243 | }
|
2244 | return params.map(function (p) { return _extractToken(typeOrFunc, p, params); });
|
2245 | }
|
2246 |
|
2247 |
|
2248 |
|
2249 |
|
2250 |
|
2251 |
|
2252 | function _extractToken(typeOrFunc, metadata, params) {
|
2253 | var token = null;
|
2254 | var optional = false;
|
2255 | if (!Array.isArray(metadata)) {
|
2256 | if (metadata instanceof Inject) {
|
2257 | return _createDependency(metadata['token'], optional, null);
|
2258 | }
|
2259 | else {
|
2260 | return _createDependency(metadata, optional, null);
|
2261 | }
|
2262 | }
|
2263 | var visibility = null;
|
2264 | for (var i = 0; i < metadata.length; ++i) {
|
2265 | var paramMetadata = metadata[i];
|
2266 | if (paramMetadata instanceof Type) {
|
2267 | token = paramMetadata;
|
2268 | }
|
2269 | else if (paramMetadata instanceof Inject) {
|
2270 | token = paramMetadata['token'];
|
2271 | }
|
2272 | else if (paramMetadata instanceof Optional) {
|
2273 | optional = true;
|
2274 | }
|
2275 | else if (paramMetadata instanceof Self || paramMetadata instanceof SkipSelf) {
|
2276 | visibility = paramMetadata;
|
2277 | }
|
2278 | else if (paramMetadata instanceof InjectionToken) {
|
2279 | token = paramMetadata;
|
2280 | }
|
2281 | }
|
2282 | token = resolveForwardRef(token);
|
2283 | if (token != null) {
|
2284 | return _createDependency(token, optional, visibility);
|
2285 | }
|
2286 | else {
|
2287 | throw noAnnotationError(typeOrFunc, params);
|
2288 | }
|
2289 | }
|
2290 |
|
2291 |
|
2292 |
|
2293 |
|
2294 |
|
2295 |
|
2296 | function _createDependency(token, optional, visibility) {
|
2297 | return new ReflectiveDependency(ReflectiveKey.get(token), optional, visibility);
|
2298 | }
|
2299 |
|
2300 |
|
2301 |
|
2302 |
|
2303 |
|
2304 |
|
2305 |
|
2306 |
|
2307 | var UNDEFINED = new Object();
|
2308 |
|
2309 |
|
2310 |
|
2311 |
|
2312 |
|
2313 |
|
2314 |
|
2315 |
|
2316 |
|
2317 |
|
2318 |
|
2319 |
|
2320 |
|
2321 |
|
2322 |
|
2323 |
|
2324 |
|
2325 |
|
2326 |
|
2327 |
|
2328 |
|
2329 |
|
2330 |
|
2331 |
|
2332 |
|
2333 |
|
2334 |
|
2335 |
|
2336 |
|
2337 |
|
2338 |
|
2339 |
|
2340 |
|
2341 |
|
2342 |
|
2343 |
|
2344 | var ReflectiveInjector = (function () {
|
2345 | function ReflectiveInjector() {
|
2346 | }
|
2347 | |
2348 |
|
2349 |
|
2350 |
|
2351 |
|
2352 |
|
2353 |
|
2354 |
|
2355 |
|
2356 |
|
2357 |
|
2358 |
|
2359 |
|
2360 |
|
2361 |
|
2362 |
|
2363 |
|
2364 |
|
2365 |
|
2366 |
|
2367 |
|
2368 |
|
2369 |
|
2370 |
|
2371 |
|
2372 |
|
2373 |
|
2374 |
|
2375 |
|
2376 |
|
2377 |
|
2378 |
|
2379 |
|
2380 |
|
2381 |
|
2382 | ReflectiveInjector.resolve = function (providers) {
|
2383 | return resolveReflectiveProviders(providers);
|
2384 | };
|
2385 | |
2386 |
|
2387 |
|
2388 |
|
2389 |
|
2390 |
|
2391 |
|
2392 |
|
2393 |
|
2394 |
|
2395 |
|
2396 |
|
2397 |
|
2398 |
|
2399 |
|
2400 |
|
2401 |
|
2402 |
|
2403 |
|
2404 |
|
2405 |
|
2406 |
|
2407 |
|
2408 |
|
2409 |
|
2410 |
|
2411 |
|
2412 |
|
2413 |
|
2414 | ReflectiveInjector.resolveAndCreate = function (providers, parent) {
|
2415 | var ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers);
|
2416 | return ReflectiveInjector.fromResolvedProviders(ResolvedReflectiveProviders, parent);
|
2417 | };
|
2418 | |
2419 |
|
2420 |
|
2421 |
|
2422 |
|
2423 |
|
2424 |
|
2425 |
|
2426 |
|
2427 |
|
2428 |
|
2429 |
|
2430 |
|
2431 |
|
2432 |
|
2433 |
|
2434 |
|
2435 |
|
2436 |
|
2437 |
|
2438 |
|
2439 |
|
2440 |
|
2441 |
|
2442 |
|
2443 |
|
2444 | ReflectiveInjector.fromResolvedProviders = function (providers, parent) {
|
2445 | return new ReflectiveInjector_(providers, parent);
|
2446 | };
|
2447 | |
2448 |
|
2449 |
|
2450 |
|
2451 |
|
2452 |
|
2453 |
|
2454 |
|
2455 |
|
2456 |
|
2457 |
|
2458 |
|
2459 |
|
2460 |
|
2461 |
|
2462 |
|
2463 | ReflectiveInjector.prototype.parent = function () { };
|
2464 | |
2465 |
|
2466 |
|
2467 |
|
2468 |
|
2469 |
|
2470 |
|
2471 |
|
2472 |
|
2473 |
|
2474 |
|
2475 |
|
2476 |
|
2477 |
|
2478 |
|
2479 |
|
2480 |
|
2481 |
|
2482 |
|
2483 |
|
2484 |
|
2485 |
|
2486 |
|
2487 |
|
2488 |
|
2489 |
|
2490 |
|
2491 |
|
2492 |
|
2493 |
|
2494 | ReflectiveInjector.prototype.resolveAndCreateChild = function (providers) { };
|
2495 | |
2496 |
|
2497 |
|
2498 |
|
2499 |
|
2500 |
|
2501 |
|
2502 |
|
2503 |
|
2504 |
|
2505 |
|
2506 |
|
2507 |
|
2508 |
|
2509 |
|
2510 |
|
2511 |
|
2512 |
|
2513 |
|
2514 |
|
2515 |
|
2516 |
|
2517 |
|
2518 |
|
2519 |
|
2520 |
|
2521 |
|
2522 |
|
2523 | ReflectiveInjector.prototype.createChildFromResolved = function (providers) { };
|
2524 | |
2525 |
|
2526 |
|
2527 |
|
2528 |
|
2529 |
|
2530 |
|
2531 |
|
2532 |
|
2533 |
|
2534 |
|
2535 |
|
2536 |
|
2537 |
|
2538 |
|
2539 |
|
2540 |
|
2541 |
|
2542 |
|
2543 |
|
2544 |
|
2545 |
|
2546 |
|
2547 |
|
2548 |
|
2549 |
|
2550 |
|
2551 | ReflectiveInjector.prototype.resolveAndInstantiate = function (provider) { };
|
2552 | |
2553 |
|
2554 |
|
2555 |
|
2556 |
|
2557 |
|
2558 |
|
2559 |
|
2560 |
|
2561 |
|
2562 |
|
2563 |
|
2564 |
|
2565 |
|
2566 |
|
2567 |
|
2568 |
|
2569 |
|
2570 |
|
2571 |
|
2572 |
|
2573 |
|
2574 |
|
2575 |
|
2576 |
|
2577 |
|
2578 |
|
2579 | ReflectiveInjector.prototype.instantiateResolved = function (provider) { };
|
2580 | |
2581 |
|
2582 |
|
2583 |
|
2584 |
|
2585 |
|
2586 | ReflectiveInjector.prototype.get = function (token, notFoundValue) { };
|
2587 | return ReflectiveInjector;
|
2588 | }());
|
2589 | var ReflectiveInjector_ = (function () {
|
2590 | |
2591 |
|
2592 |
|
2593 |
|
2594 |
|
2595 | function ReflectiveInjector_(_providers, _parent) {
|
2596 | |
2597 |
|
2598 |
|
2599 | this._constructionCounter = 0;
|
2600 | this._providers = _providers;
|
2601 | this._parent = _parent || null;
|
2602 | var len = _providers.length;
|
2603 | this.keyIds = new Array(len);
|
2604 | this.objs = new Array(len);
|
2605 | for (var i = 0; i < len; i++) {
|
2606 | this.keyIds[i] = _providers[i].key.id;
|
2607 | this.objs[i] = UNDEFINED;
|
2608 | }
|
2609 | }
|
2610 | |
2611 |
|
2612 |
|
2613 |
|
2614 |
|
2615 | ReflectiveInjector_.prototype.get = function (token, notFoundValue) {
|
2616 | if (notFoundValue === void 0) { notFoundValue = THROW_IF_NOT_FOUND; }
|
2617 | return this._getByKey(ReflectiveKey.get(token), null, notFoundValue);
|
2618 | };
|
2619 | Object.defineProperty(ReflectiveInjector_.prototype, "parent", {
|
2620 | |
2621 |
|
2622 |
|
2623 | get: function () { return this._parent; },
|
2624 | enumerable: true,
|
2625 | configurable: true
|
2626 | });
|
2627 | |
2628 |
|
2629 |
|
2630 |
|
2631 | ReflectiveInjector_.prototype.resolveAndCreateChild = function (providers) {
|
2632 | var ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers);
|
2633 | return this.createChildFromResolved(ResolvedReflectiveProviders);
|
2634 | };
|
2635 | |
2636 |
|
2637 |
|
2638 |
|
2639 | ReflectiveInjector_.prototype.createChildFromResolved = function (providers) {
|
2640 | var inj = new ReflectiveInjector_(providers);
|
2641 | inj._parent = this;
|
2642 | return inj;
|
2643 | };
|
2644 | |
2645 |
|
2646 |
|
2647 |
|
2648 | ReflectiveInjector_.prototype.resolveAndInstantiate = function (provider) {
|
2649 | return this.instantiateResolved(ReflectiveInjector.resolve([provider])[0]);
|
2650 | };
|
2651 | |
2652 |
|
2653 |
|
2654 |
|
2655 | ReflectiveInjector_.prototype.instantiateResolved = function (provider) {
|
2656 | return this._instantiateProvider(provider);
|
2657 | };
|
2658 | |
2659 |
|
2660 |
|
2661 |
|
2662 | ReflectiveInjector_.prototype.getProviderAtIndex = function (index) {
|
2663 | if (index < 0 || index >= this._providers.length) {
|
2664 | throw outOfBoundsError(index);
|
2665 | }
|
2666 | return this._providers[index];
|
2667 | };
|
2668 | |
2669 |
|
2670 |
|
2671 |
|
2672 |
|
2673 | ReflectiveInjector_.prototype._new = function (provider) {
|
2674 | if (this._constructionCounter++ > this._getMaxNumberOfObjects()) {
|
2675 | throw cyclicDependencyError(this, provider.key);
|
2676 | }
|
2677 | return this._instantiateProvider(provider);
|
2678 | };
|
2679 | |
2680 |
|
2681 |
|
2682 | ReflectiveInjector_.prototype._getMaxNumberOfObjects = function () { return this.objs.length; };
|
2683 | |
2684 |
|
2685 |
|
2686 |
|
2687 | ReflectiveInjector_.prototype._instantiateProvider = function (provider) {
|
2688 | if (provider.multiProvider) {
|
2689 | var res = new Array(provider.resolvedFactories.length);
|
2690 | for (var i = 0; i < provider.resolvedFactories.length; ++i) {
|
2691 | res[i] = this._instantiate(provider, provider.resolvedFactories[i]);
|
2692 | }
|
2693 | return res;
|
2694 | }
|
2695 | else {
|
2696 | return this._instantiate(provider, provider.resolvedFactories[0]);
|
2697 | }
|
2698 | };
|
2699 | |
2700 |
|
2701 |
|
2702 |
|
2703 |
|
2704 | ReflectiveInjector_.prototype._instantiate = function (provider, ResolvedReflectiveFactory$$1) {
|
2705 | var _this = this;
|
2706 | var factory = ResolvedReflectiveFactory$$1.factory;
|
2707 | var deps;
|
2708 | try {
|
2709 | deps =
|
2710 | ResolvedReflectiveFactory$$1.dependencies.map(function (dep) { return _this._getByReflectiveDependency(dep); });
|
2711 | }
|
2712 | catch (e) {
|
2713 | if (e.addKey) {
|
2714 | e.addKey(this, provider.key);
|
2715 | }
|
2716 | throw e;
|
2717 | }
|
2718 | var obj;
|
2719 | try {
|
2720 | obj = factory.apply(void 0, deps);
|
2721 | }
|
2722 | catch (e) {
|
2723 | throw instantiationError(this, e, e.stack, provider.key);
|
2724 | }
|
2725 | return obj;
|
2726 | };
|
2727 | |
2728 |
|
2729 |
|
2730 |
|
2731 | ReflectiveInjector_.prototype._getByReflectiveDependency = function (dep) {
|
2732 | return this._getByKey(dep.key, dep.visibility, dep.optional ? null : THROW_IF_NOT_FOUND);
|
2733 | };
|
2734 | |
2735 |
|
2736 |
|
2737 |
|
2738 |
|
2739 |
|
2740 | ReflectiveInjector_.prototype._getByKey = function (key, visibility, notFoundValue) {
|
2741 | if (key === INJECTOR_KEY) {
|
2742 | return this;
|
2743 | }
|
2744 | if (visibility instanceof Self) {
|
2745 | return this._getByKeySelf(key, notFoundValue);
|
2746 | }
|
2747 | else {
|
2748 | return this._getByKeyDefault(key, notFoundValue, visibility);
|
2749 | }
|
2750 | };
|
2751 | |
2752 |
|
2753 |
|
2754 |
|
2755 | ReflectiveInjector_.prototype._getObjByKeyId = function (keyId) {
|
2756 | for (var i = 0; i < this.keyIds.length; i++) {
|
2757 | if (this.keyIds[i] === keyId) {
|
2758 | if (this.objs[i] === UNDEFINED) {
|
2759 | this.objs[i] = this._new(this._providers[i]);
|
2760 | }
|
2761 | return this.objs[i];
|
2762 | }
|
2763 | }
|
2764 | return UNDEFINED;
|
2765 | };
|
2766 | |
2767 |
|
2768 |
|
2769 |
|
2770 |
|
2771 |
|
2772 | ReflectiveInjector_.prototype._throwOrNull = function (key, notFoundValue) {
|
2773 | if (notFoundValue !== THROW_IF_NOT_FOUND) {
|
2774 | return notFoundValue;
|
2775 | }
|
2776 | else {
|
2777 | throw noProviderError(this, key);
|
2778 | }
|
2779 | };
|
2780 | |
2781 |
|
2782 |
|
2783 |
|
2784 |
|
2785 |
|
2786 | ReflectiveInjector_.prototype._getByKeySelf = function (key, notFoundValue) {
|
2787 | var obj = this._getObjByKeyId(key.id);
|
2788 | return (obj !== UNDEFINED) ? obj : this._throwOrNull(key, notFoundValue);
|
2789 | };
|
2790 | |
2791 |
|
2792 |
|
2793 |
|
2794 |
|
2795 |
|
2796 |
|
2797 | ReflectiveInjector_.prototype._getByKeyDefault = function (key, notFoundValue, visibility) {
|
2798 | var inj;
|
2799 | if (visibility instanceof SkipSelf) {
|
2800 | inj = this._parent;
|
2801 | }
|
2802 | else {
|
2803 | inj = this;
|
2804 | }
|
2805 | while (inj instanceof ReflectiveInjector_) {
|
2806 | var inj_ = (inj);
|
2807 | var obj = inj_._getObjByKeyId(key.id);
|
2808 | if (obj !== UNDEFINED)
|
2809 | return obj;
|
2810 | inj = inj_._parent;
|
2811 | }
|
2812 | if (inj !== null) {
|
2813 | return inj.get(key.token, notFoundValue);
|
2814 | }
|
2815 | else {
|
2816 | return this._throwOrNull(key, notFoundValue);
|
2817 | }
|
2818 | };
|
2819 | Object.defineProperty(ReflectiveInjector_.prototype, "displayName", {
|
2820 | |
2821 |
|
2822 |
|
2823 | get: function () {
|
2824 | var providers = _mapProviders(this, function (b) { return ' "' + b.key.displayName + '" '; })
|
2825 | .join(', ');
|
2826 | return "ReflectiveInjector(providers: [" + providers + "])";
|
2827 | },
|
2828 | enumerable: true,
|
2829 | configurable: true
|
2830 | });
|
2831 | |
2832 |
|
2833 |
|
2834 | ReflectiveInjector_.prototype.toString = function () { return this.displayName; };
|
2835 | return ReflectiveInjector_;
|
2836 | }());
|
2837 | var INJECTOR_KEY = ReflectiveKey.get(Injector);
|
2838 |
|
2839 |
|
2840 |
|
2841 |
|
2842 |
|
2843 | function _mapProviders(injector, fn) {
|
2844 | var res = new Array(injector._providers.length);
|
2845 | for (var i = 0; i < injector._providers.length; ++i) {
|
2846 | res[i] = fn(injector.getProviderAtIndex(i));
|
2847 | }
|
2848 | return res;
|
2849 | }
|
2850 |
|
2851 |
|
2852 |
|
2853 |
|
2854 |
|
2855 |
|
2856 |
|
2857 |
|
2858 |
|
2859 |
|
2860 |
|
2861 |
|
2862 |
|
2863 |
|
2864 |
|
2865 |
|
2866 |
|
2867 |
|
2868 |
|
2869 |
|
2870 |
|
2871 |
|
2872 |
|
2873 |
|
2874 | function isPromise(obj) {
|
2875 |
|
2876 |
|
2877 | return !!obj && typeof obj.then === 'function';
|
2878 | }
|
2879 |
|
2880 |
|
2881 |
|
2882 |
|
2883 |
|
2884 | function isObservable(obj) {
|
2885 |
|
2886 | return !!obj && typeof obj.subscribe === 'function';
|
2887 | }
|
2888 |
|
2889 |
|
2890 |
|
2891 |
|
2892 |
|
2893 |
|
2894 |
|
2895 |
|
2896 |
|
2897 |
|
2898 |
|
2899 | var APP_INITIALIZER = new InjectionToken('Application Initializer');
|
2900 |
|
2901 |
|
2902 |
|
2903 |
|
2904 |
|
2905 | var ApplicationInitStatus = (function () {
|
2906 | |
2907 |
|
2908 |
|
2909 | function ApplicationInitStatus(appInits) {
|
2910 | var _this = this;
|
2911 | this._done = false;
|
2912 | var asyncInitPromises = [];
|
2913 | if (appInits) {
|
2914 | for (var i = 0; i < appInits.length; i++) {
|
2915 | var initResult = appInits[i]();
|
2916 | if (isPromise(initResult)) {
|
2917 | asyncInitPromises.push(initResult);
|
2918 | }
|
2919 | }
|
2920 | }
|
2921 | this._donePromise = Promise.all(asyncInitPromises).then(function () { _this._done = true; });
|
2922 | if (asyncInitPromises.length === 0) {
|
2923 | this._done = true;
|
2924 | }
|
2925 | }
|
2926 | Object.defineProperty(ApplicationInitStatus.prototype, "done", {
|
2927 | |
2928 |
|
2929 |
|
2930 | get: function () { return this._done; },
|
2931 | enumerable: true,
|
2932 | configurable: true
|
2933 | });
|
2934 | Object.defineProperty(ApplicationInitStatus.prototype, "donePromise", {
|
2935 | |
2936 |
|
2937 |
|
2938 | get: function () { return this._donePromise; },
|
2939 | enumerable: true,
|
2940 | configurable: true
|
2941 | });
|
2942 | return ApplicationInitStatus;
|
2943 | }());
|
2944 | ApplicationInitStatus.decorators = [
|
2945 | { type: Injectable },
|
2946 | ];
|
2947 |
|
2948 |
|
2949 |
|
2950 | ApplicationInitStatus.ctorParameters = function () { return [
|
2951 | { type: Array, decorators: [{ type: Inject, args: [APP_INITIALIZER,] }, { type: Optional },] },
|
2952 | ]; };
|
2953 |
|
2954 |
|
2955 |
|
2956 |
|
2957 |
|
2958 |
|
2959 |
|
2960 |
|
2961 |
|
2962 |
|
2963 |
|
2964 |
|
2965 |
|
2966 |
|
2967 |
|
2968 |
|
2969 |
|
2970 | var APP_ID = new InjectionToken('AppId');
|
2971 |
|
2972 |
|
2973 |
|
2974 | function _appIdRandomProviderFactory() {
|
2975 | return "" + _randomChar() + _randomChar() + _randomChar();
|
2976 | }
|
2977 |
|
2978 |
|
2979 |
|
2980 |
|
2981 | var APP_ID_RANDOM_PROVIDER = {
|
2982 | provide: APP_ID,
|
2983 | useFactory: _appIdRandomProviderFactory,
|
2984 | deps: [],
|
2985 | };
|
2986 |
|
2987 |
|
2988 |
|
2989 | function _randomChar() {
|
2990 | return String.fromCharCode(97 + Math.floor(Math.random() * 25));
|
2991 | }
|
2992 |
|
2993 |
|
2994 |
|
2995 |
|
2996 | var PLATFORM_INITIALIZER = new InjectionToken('Platform Initializer');
|
2997 |
|
2998 |
|
2999 |
|
3000 |
|
3001 | var PLATFORM_ID = new InjectionToken('Platform ID');
|
3002 |
|
3003 |
|
3004 |
|
3005 |
|
3006 |
|
3007 |
|
3008 |
|
3009 |
|
3010 | var APP_BOOTSTRAP_LISTENER = new InjectionToken('appBootstrapListener');
|
3011 |
|
3012 |
|
3013 |
|
3014 |
|
3015 | var PACKAGE_ROOT_URL = new InjectionToken('Application Packages Root URL');
|
3016 |
|
3017 |
|
3018 |
|
3019 |
|
3020 |
|
3021 |
|
3022 |
|
3023 | var Console = (function () {
|
3024 | function Console() {
|
3025 | }
|
3026 | |
3027 |
|
3028 |
|
3029 |
|
3030 | Console.prototype.log = function (message) {
|
3031 |
|
3032 | console.log(message);
|
3033 | };
|
3034 | |
3035 |
|
3036 |
|
3037 |
|
3038 | Console.prototype.warn = function (message) {
|
3039 |
|
3040 | console.warn(message);
|
3041 | };
|
3042 | return Console;
|
3043 | }());
|
3044 | Console.decorators = [
|
3045 | { type: Injectable },
|
3046 | ];
|
3047 |
|
3048 |
|
3049 |
|
3050 | Console.ctorParameters = function () { return []; };
|
3051 |
|
3052 |
|
3053 |
|
3054 |
|
3055 |
|
3056 |
|
3057 |
|
3058 |
|
3059 |
|
3060 |
|
3061 |
|
3062 |
|
3063 | var ModuleWithComponentFactories = (function () {
|
3064 | |
3065 |
|
3066 |
|
3067 |
|
3068 | function ModuleWithComponentFactories(ngModuleFactory, componentFactories) {
|
3069 | this.ngModuleFactory = ngModuleFactory;
|
3070 | this.componentFactories = componentFactories;
|
3071 | }
|
3072 | return ModuleWithComponentFactories;
|
3073 | }());
|
3074 |
|
3075 |
|
3076 |
|
3077 | function _throwError() {
|
3078 | throw new Error("Runtime compiler is not loaded");
|
3079 | }
|
3080 |
|
3081 |
|
3082 |
|
3083 |
|
3084 |
|
3085 |
|
3086 |
|
3087 |
|
3088 |
|
3089 |
|
3090 | var Compiler = (function () {
|
3091 | function Compiler() {
|
3092 | }
|
3093 | |
3094 |
|
3095 |
|
3096 |
|
3097 |
|
3098 |
|
3099 |
|
3100 | Compiler.prototype.compileModuleSync = function (moduleType) { throw _throwError(); };
|
3101 | |
3102 |
|
3103 |
|
3104 |
|
3105 |
|
3106 |
|
3107 | Compiler.prototype.compileModuleAsync = function (moduleType) { throw _throwError(); };
|
3108 | |
3109 |
|
3110 |
|
3111 |
|
3112 |
|
3113 |
|
3114 | Compiler.prototype.compileModuleAndAllComponentsSync = function (moduleType) {
|
3115 | throw _throwError();
|
3116 | };
|
3117 | |
3118 |
|
3119 |
|
3120 |
|
3121 |
|
3122 |
|
3123 | Compiler.prototype.compileModuleAndAllComponentsAsync = function (moduleType) {
|
3124 | throw _throwError();
|
3125 | };
|
3126 | |
3127 |
|
3128 |
|
3129 |
|
3130 |
|
3131 |
|
3132 |
|
3133 |
|
3134 |
|
3135 |
|
3136 | Compiler.prototype.getNgContentSelectors = function (component) { throw _throwError(); };
|
3137 | |
3138 |
|
3139 |
|
3140 |
|
3141 | Compiler.prototype.clearCache = function () { };
|
3142 | |
3143 |
|
3144 |
|
3145 |
|
3146 |
|
3147 | Compiler.prototype.clearCacheFor = function (type) { };
|
3148 | return Compiler;
|
3149 | }());
|
3150 | Compiler.decorators = [
|
3151 | { type: Injectable },
|
3152 | ];
|
3153 |
|
3154 |
|
3155 |
|
3156 | Compiler.ctorParameters = function () { return []; };
|
3157 |
|
3158 |
|
3159 |
|
3160 |
|
3161 |
|
3162 | var COMPILER_OPTIONS = new InjectionToken('compilerOptions');
|
3163 |
|
3164 |
|
3165 |
|
3166 |
|
3167 |
|
3168 |
|
3169 | var CompilerFactory = (function () {
|
3170 | function CompilerFactory() {
|
3171 | }
|
3172 | |
3173 |
|
3174 |
|
3175 |
|
3176 |
|
3177 | CompilerFactory.prototype.createCompiler = function (options) { };
|
3178 | return CompilerFactory;
|
3179 | }());
|
3180 |
|
3181 |
|
3182 |
|
3183 |
|
3184 |
|
3185 |
|
3186 |
|
3187 |
|
3188 |
|
3189 |
|
3190 |
|
3191 |
|
3192 |
|
3193 |
|
3194 |
|
3195 |
|
3196 | var ComponentRef = (function () {
|
3197 | function ComponentRef() {
|
3198 | }
|
3199 | |
3200 |
|
3201 |
|
3202 |
|
3203 |
|
3204 | ComponentRef.prototype.location = function () { };
|
3205 | |
3206 |
|
3207 |
|
3208 |
|
3209 |
|
3210 | ComponentRef.prototype.injector = function () { };
|
3211 | |
3212 |
|
3213 |
|
3214 |
|
3215 |
|
3216 | ComponentRef.prototype.instance = function () { };
|
3217 | |
3218 |
|
3219 |
|
3220 |
|
3221 |
|
3222 | ComponentRef.prototype.hostView = function () { };
|
3223 | |
3224 |
|
3225 |
|
3226 |
|
3227 |
|
3228 | ComponentRef.prototype.changeDetectorRef = function () { };
|
3229 | |
3230 |
|
3231 |
|
3232 |
|
3233 |
|
3234 | ComponentRef.prototype.componentType = function () { };
|
3235 | |
3236 |
|
3237 |
|
3238 |
|
3239 |
|
3240 | ComponentRef.prototype.destroy = function () { };
|
3241 | |
3242 |
|
3243 |
|
3244 |
|
3245 |
|
3246 |
|
3247 | ComponentRef.prototype.onDestroy = function (callback) { };
|
3248 | return ComponentRef;
|
3249 | }());
|
3250 |
|
3251 |
|
3252 |
|
3253 |
|
3254 | var ComponentFactory = (function () {
|
3255 | function ComponentFactory() {
|
3256 | }
|
3257 | |
3258 |
|
3259 |
|
3260 |
|
3261 | ComponentFactory.prototype.selector = function () { };
|
3262 | |
3263 |
|
3264 |
|
3265 |
|
3266 | ComponentFactory.prototype.componentType = function () { };
|
3267 | |
3268 |
|
3269 |
|
3270 |
|
3271 |
|
3272 | ComponentFactory.prototype.ngContentSelectors = function () { };
|
3273 | |
3274 |
|
3275 |
|
3276 |
|
3277 |
|
3278 | ComponentFactory.prototype.inputs = function () { };
|
3279 | |
3280 |
|
3281 |
|
3282 |
|
3283 |
|
3284 | ComponentFactory.prototype.outputs = function () { };
|
3285 | |
3286 |
|
3287 |
|
3288 |
|
3289 |
|
3290 |
|
3291 |
|
3292 |
|
3293 |
|
3294 | ComponentFactory.prototype.create = function (injector, projectableNodes, rootSelectorOrNode, ngModule) { };
|
3295 | return ComponentFactory;
|
3296 | }());
|
3297 |
|
3298 |
|
3299 |
|
3300 |
|
3301 |
|
3302 |
|
3303 |
|
3304 |
|
3305 |
|
3306 |
|
3307 |
|
3308 | function noComponentFactoryError(component) {
|
3309 | var error = Error("No component factory found for " + stringify(component) + ". Did you add it to @NgModule.entryComponents?");
|
3310 | ((error))[ERROR_COMPONENT] = component;
|
3311 | return error;
|
3312 | }
|
3313 | var ERROR_COMPONENT = 'ngComponent';
|
3314 |
|
3315 |
|
3316 |
|
3317 |
|
3318 | var _NullComponentFactoryResolver = (function () {
|
3319 | function _NullComponentFactoryResolver() {
|
3320 | }
|
3321 | |
3322 |
|
3323 |
|
3324 |
|
3325 |
|
3326 | _NullComponentFactoryResolver.prototype.resolveComponentFactory = function (component) {
|
3327 | throw noComponentFactoryError(component);
|
3328 | };
|
3329 | return _NullComponentFactoryResolver;
|
3330 | }());
|
3331 |
|
3332 |
|
3333 |
|
3334 |
|
3335 | var ComponentFactoryResolver = (function () {
|
3336 | function ComponentFactoryResolver() {
|
3337 | }
|
3338 | |
3339 |
|
3340 |
|
3341 |
|
3342 |
|
3343 |
|
3344 | ComponentFactoryResolver.prototype.resolveComponentFactory = function (component) { };
|
3345 | return ComponentFactoryResolver;
|
3346 | }());
|
3347 | ComponentFactoryResolver.NULL = new _NullComponentFactoryResolver();
|
3348 | var CodegenComponentFactoryResolver = (function () {
|
3349 | |
3350 |
|
3351 |
|
3352 |
|
3353 |
|
3354 | function CodegenComponentFactoryResolver(factories, _parent, _ngModule) {
|
3355 | this._parent = _parent;
|
3356 | this._ngModule = _ngModule;
|
3357 | this._factories = new Map();
|
3358 | for (var i = 0; i < factories.length; i++) {
|
3359 | var factory = factories[i];
|
3360 | this._factories.set(factory.componentType, factory);
|
3361 | }
|
3362 | }
|
3363 | |
3364 |
|
3365 |
|
3366 |
|
3367 |
|
3368 | CodegenComponentFactoryResolver.prototype.resolveComponentFactory = function (component) {
|
3369 | var factory = this._factories.get(component) || this._parent.resolveComponentFactory(component);
|
3370 | return new ComponentFactoryBoundToModule(factory, this._ngModule);
|
3371 | };
|
3372 | return CodegenComponentFactoryResolver;
|
3373 | }());
|
3374 | var ComponentFactoryBoundToModule = (function (_super) {
|
3375 | __extends(ComponentFactoryBoundToModule, _super);
|
3376 | |
3377 |
|
3378 |
|
3379 |
|
3380 | function ComponentFactoryBoundToModule(factory, ngModule) {
|
3381 | var _this = _super.call(this) || this;
|
3382 | _this.factory = factory;
|
3383 | _this.ngModule = ngModule;
|
3384 | return _this;
|
3385 | }
|
3386 | Object.defineProperty(ComponentFactoryBoundToModule.prototype, "selector", {
|
3387 | |
3388 |
|
3389 |
|
3390 | get: function () { return this.factory.selector; },
|
3391 | enumerable: true,
|
3392 | configurable: true
|
3393 | });
|
3394 | Object.defineProperty(ComponentFactoryBoundToModule.prototype, "componentType", {
|
3395 | |
3396 |
|
3397 |
|
3398 | get: function () { return this.factory.componentType; },
|
3399 | enumerable: true,
|
3400 | configurable: true
|
3401 | });
|
3402 | Object.defineProperty(ComponentFactoryBoundToModule.prototype, "ngContentSelectors", {
|
3403 | |
3404 |
|
3405 |
|
3406 | get: function () { return this.factory.ngContentSelectors; },
|
3407 | enumerable: true,
|
3408 | configurable: true
|
3409 | });
|
3410 | Object.defineProperty(ComponentFactoryBoundToModule.prototype, "inputs", {
|
3411 | |
3412 |
|
3413 |
|
3414 | get: function () { return this.factory.inputs; },
|
3415 | enumerable: true,
|
3416 | configurable: true
|
3417 | });
|
3418 | Object.defineProperty(ComponentFactoryBoundToModule.prototype, "outputs", {
|
3419 | |
3420 |
|
3421 |
|
3422 | get: function () { return this.factory.outputs; },
|
3423 | enumerable: true,
|
3424 | configurable: true
|
3425 | });
|
3426 | |
3427 |
|
3428 |
|
3429 |
|
3430 |
|
3431 |
|
3432 |
|
3433 | ComponentFactoryBoundToModule.prototype.create = function (injector, projectableNodes, rootSelectorOrNode, ngModule) {
|
3434 | return this.factory.create(injector, projectableNodes, rootSelectorOrNode, ngModule || this.ngModule);
|
3435 | };
|
3436 | return ComponentFactoryBoundToModule;
|
3437 | }(ComponentFactory));
|
3438 |
|
3439 |
|
3440 |
|
3441 |
|
3442 |
|
3443 |
|
3444 |
|
3445 |
|
3446 |
|
3447 |
|
3448 |
|
3449 |
|
3450 |
|
3451 |
|
3452 |
|
3453 |
|
3454 | var NgModuleRef = (function () {
|
3455 | function NgModuleRef() {
|
3456 | }
|
3457 | |
3458 |
|
3459 |
|
3460 |
|
3461 |
|
3462 | NgModuleRef.prototype.injector = function () { };
|
3463 | |
3464 |
|
3465 |
|
3466 |
|
3467 |
|
3468 |
|
3469 | NgModuleRef.prototype.componentFactoryResolver = function () { };
|
3470 | |
3471 |
|
3472 |
|
3473 |
|
3474 |
|
3475 | NgModuleRef.prototype.instance = function () { };
|
3476 | |
3477 |
|
3478 |
|
3479 |
|
3480 |
|
3481 | NgModuleRef.prototype.destroy = function () { };
|
3482 | |
3483 |
|
3484 |
|
3485 |
|
3486 |
|
3487 |
|
3488 | NgModuleRef.prototype.onDestroy = function (callback) { };
|
3489 | return NgModuleRef;
|
3490 | }());
|
3491 |
|
3492 |
|
3493 |
|
3494 | var NgModuleFactory = (function () {
|
3495 | |
3496 |
|
3497 |
|
3498 |
|
3499 | function NgModuleFactory(_injectorClass, _moduleType) {
|
3500 | this._injectorClass = _injectorClass;
|
3501 | this._moduleType = _moduleType;
|
3502 | }
|
3503 | Object.defineProperty(NgModuleFactory.prototype, "moduleType", {
|
3504 | |
3505 |
|
3506 |
|
3507 | get: function () { return this._moduleType; },
|
3508 | enumerable: true,
|
3509 | configurable: true
|
3510 | });
|
3511 | |
3512 |
|
3513 |
|
3514 |
|
3515 | NgModuleFactory.prototype.create = function (parentInjector) {
|
3516 | var instance = new this._injectorClass(parentInjector || Injector.NULL);
|
3517 | instance.create();
|
3518 | return instance;
|
3519 | };
|
3520 | return NgModuleFactory;
|
3521 | }());
|
3522 | var _UNDEFINED = new Object();
|
3523 |
|
3524 |
|
3525 |
|
3526 | var NgModuleInjector = (function () {
|
3527 | |
3528 |
|
3529 |
|
3530 |
|
3531 |
|
3532 | function NgModuleInjector(parent, factories, bootstrapFactories) {
|
3533 | var _this = this;
|
3534 | this.parent = parent;
|
3535 | this._destroyListeners = [];
|
3536 | this._destroyed = false;
|
3537 | this.bootstrapFactories =
|
3538 | bootstrapFactories.map(function (f) { return new ComponentFactoryBoundToModule(f, _this); });
|
3539 | this._cmpFactoryResolver = new CodegenComponentFactoryResolver(factories, parent.get(ComponentFactoryResolver, ComponentFactoryResolver.NULL), this);
|
3540 | }
|
3541 | |
3542 |
|
3543 |
|
3544 | NgModuleInjector.prototype.create = function () { this.instance = this.createInternal(); };
|
3545 | |
3546 |
|
3547 |
|
3548 |
|
3549 | NgModuleInjector.prototype.createInternal = function () { };
|
3550 | |
3551 |
|
3552 |
|
3553 |
|
3554 |
|
3555 | NgModuleInjector.prototype.get = function (token, notFoundValue) {
|
3556 | if (notFoundValue === void 0) { notFoundValue = THROW_IF_NOT_FOUND; }
|
3557 | if (token === Injector || token === NgModuleRef) {
|
3558 | return this;
|
3559 | }
|
3560 | if (token === ComponentFactoryResolver) {
|
3561 | return this._cmpFactoryResolver;
|
3562 | }
|
3563 | var result = this.getInternal(token, _UNDEFINED);
|
3564 | return result === _UNDEFINED ? this.parent.get(token, notFoundValue) : result;
|
3565 | };
|
3566 | |
3567 |
|
3568 |
|
3569 |
|
3570 |
|
3571 |
|
3572 | NgModuleInjector.prototype.getInternal = function (token, notFoundValue) { };
|
3573 | Object.defineProperty(NgModuleInjector.prototype, "injector", {
|
3574 | |
3575 |
|
3576 |
|
3577 | get: function () { return this; },
|
3578 | enumerable: true,
|
3579 | configurable: true
|
3580 | });
|
3581 | Object.defineProperty(NgModuleInjector.prototype, "componentFactoryResolver", {
|
3582 | |
3583 |
|
3584 |
|
3585 | get: function () { return this._cmpFactoryResolver; },
|
3586 | enumerable: true,
|
3587 | configurable: true
|
3588 | });
|
3589 | |
3590 |
|
3591 |
|
3592 | NgModuleInjector.prototype.destroy = function () {
|
3593 | if (this._destroyed) {
|
3594 | throw new Error("The ng module " + stringify(this.instance.constructor) + " has already been destroyed.");
|
3595 | }
|
3596 | this._destroyed = true;
|
3597 | this.destroyInternal();
|
3598 | this._destroyListeners.forEach(function (listener) { return listener(); });
|
3599 | };
|
3600 | |
3601 |
|
3602 |
|
3603 |
|
3604 | NgModuleInjector.prototype.onDestroy = function (callback) { this._destroyListeners.push(callback); };
|
3605 | |
3606 |
|
3607 |
|
3608 |
|
3609 | NgModuleInjector.prototype.destroyInternal = function () { };
|
3610 | return NgModuleInjector;
|
3611 | }());
|
3612 |
|
3613 |
|
3614 |
|
3615 |
|
3616 |
|
3617 |
|
3618 |
|
3619 | var trace;
|
3620 | var events;
|
3621 |
|
3622 |
|
3623 |
|
3624 | function detectWTF() {
|
3625 | var wtf = ((_global) )['wtf'];
|
3626 | if (wtf) {
|
3627 | trace = wtf['trace'];
|
3628 | if (trace) {
|
3629 | events = trace['events'];
|
3630 | return true;
|
3631 | }
|
3632 | }
|
3633 | return false;
|
3634 | }
|
3635 |
|
3636 |
|
3637 |
|
3638 |
|
3639 |
|
3640 | function createScope$1(signature, flags) {
|
3641 | if (flags === void 0) { flags = null; }
|
3642 | return events.createScope(signature, flags);
|
3643 | }
|
3644 |
|
3645 |
|
3646 |
|
3647 |
|
3648 |
|
3649 |
|
3650 | function leave(scope, returnValue) {
|
3651 | trace.leaveScope(scope, returnValue);
|
3652 | return returnValue;
|
3653 | }
|
3654 |
|
3655 |
|
3656 |
|
3657 |
|
3658 |
|
3659 | function startTimeRange(rangeType, action) {
|
3660 | return trace.beginTimeRange(rangeType, action);
|
3661 | }
|
3662 |
|
3663 |
|
3664 |
|
3665 |
|
3666 | function endTimeRange(range) {
|
3667 | trace.endTimeRange(range);
|
3668 | }
|
3669 |
|
3670 |
|
3671 |
|
3672 |
|
3673 |
|
3674 |
|
3675 |
|
3676 |
|
3677 |
|
3678 |
|
3679 | var wtfEnabled = detectWTF();
|
3680 |
|
3681 |
|
3682 |
|
3683 |
|
3684 |
|
3685 | function noopScope(arg0, arg1) {
|
3686 | return null;
|
3687 | }
|
3688 |
|
3689 |
|
3690 |
|
3691 |
|
3692 |
|
3693 |
|
3694 |
|
3695 |
|
3696 |
|
3697 |
|
3698 |
|
3699 |
|
3700 |
|
3701 |
|
3702 |
|
3703 |
|
3704 |
|
3705 |
|
3706 |
|
3707 |
|
3708 |
|
3709 |
|
3710 |
|
3711 |
|
3712 |
|
3713 |
|
3714 |
|
3715 |
|
3716 |
|
3717 |
|
3718 | var wtfCreateScope = wtfEnabled ? createScope$1 : function (signature, flags) { return noopScope; };
|
3719 |
|
3720 |
|
3721 |
|
3722 |
|
3723 |
|
3724 |
|
3725 |
|
3726 |
|
3727 |
|
3728 | var wtfLeave = wtfEnabled ? leave : function (s, r) { return r; };
|
3729 |
|
3730 |
|
3731 |
|
3732 |
|
3733 |
|
3734 |
|
3735 |
|
3736 |
|
3737 |
|
3738 |
|
3739 |
|
3740 |
|
3741 |
|
3742 | var wtfStartTimeRange = wtfEnabled ? startTimeRange : function (rangeType, action) { return null; };
|
3743 |
|
3744 |
|
3745 |
|
3746 |
|
3747 |
|
3748 |
|
3749 | var wtfEndTimeRange = wtfEnabled ? endTimeRange : function (r) { return null; };
|
3750 |
|
3751 |
|
3752 |
|
3753 |
|
3754 |
|
3755 |
|
3756 |
|
3757 |
|
3758 |
|
3759 |
|
3760 |
|
3761 |
|
3762 |
|
3763 |
|
3764 |
|
3765 |
|
3766 |
|
3767 |
|
3768 |
|
3769 |
|
3770 |
|
3771 |
|
3772 |
|
3773 |
|
3774 |
|
3775 |
|
3776 |
|
3777 |
|
3778 |
|
3779 |
|
3780 |
|
3781 |
|
3782 |
|
3783 |
|
3784 |
|
3785 |
|
3786 |
|
3787 |
|
3788 |
|
3789 |
|
3790 |
|
3791 |
|
3792 |
|
3793 |
|
3794 |
|
3795 |
|
3796 |
|
3797 |
|
3798 |
|
3799 |
|
3800 |
|
3801 |
|
3802 |
|
3803 |
|
3804 | var EventEmitter = (function (_super) {
|
3805 | __extends(EventEmitter, _super);
|
3806 | |
3807 |
|
3808 |
|
3809 |
|
3810 |
|
3811 | function EventEmitter(isAsync) {
|
3812 | if (isAsync === void 0) { isAsync = false; }
|
3813 | var _this = _super.call(this) || this;
|
3814 | _this.__isAsync = isAsync;
|
3815 | return _this;
|
3816 | }
|
3817 | |
3818 |
|
3819 |
|
3820 |
|
3821 | EventEmitter.prototype.emit = function (value) { _super.prototype.next.call(this, value); };
|
3822 | |
3823 |
|
3824 |
|
3825 |
|
3826 |
|
3827 |
|
3828 | EventEmitter.prototype.subscribe = function (generatorOrNext, error, complete) {
|
3829 | var schedulerFn;
|
3830 | var errorFn = function (err) { return null; };
|
3831 | var completeFn = function () { return null; };
|
3832 | if (generatorOrNext && typeof generatorOrNext === 'object') {
|
3833 | schedulerFn = this.__isAsync ? function (value) {
|
3834 | setTimeout(function () { return generatorOrNext.next(value); });
|
3835 | } : function (value) { generatorOrNext.next(value); };
|
3836 | if (generatorOrNext.error) {
|
3837 | errorFn = this.__isAsync ? function (err) { setTimeout(function () { return generatorOrNext.error(err); }); } :
|
3838 | function (err) { generatorOrNext.error(err); };
|
3839 | }
|
3840 | if (generatorOrNext.complete) {
|
3841 | completeFn = this.__isAsync ? function () { setTimeout(function () { return generatorOrNext.complete(); }); } :
|
3842 | function () { generatorOrNext.complete(); };
|
3843 | }
|
3844 | }
|
3845 | else {
|
3846 | schedulerFn = this.__isAsync ? function (value) { setTimeout(function () { return generatorOrNext(value); }); } :
|
3847 | function (value) { generatorOrNext(value); };
|
3848 | if (error) {
|
3849 | errorFn =
|
3850 | this.__isAsync ? function (err) { setTimeout(function () { return error(err); }); } : function (err) { error(err); };
|
3851 | }
|
3852 | if (complete) {
|
3853 | completeFn =
|
3854 | this.__isAsync ? function () { setTimeout(function () { return complete(); }); } : function () { complete(); };
|
3855 | }
|
3856 | }
|
3857 | return _super.prototype.subscribe.call(this, schedulerFn, errorFn, completeFn);
|
3858 | };
|
3859 | return EventEmitter;
|
3860 | }(rxjs_Subject.Subject));
|
3861 |
|
3862 |
|
3863 |
|
3864 |
|
3865 |
|
3866 |
|
3867 |
|
3868 |
|
3869 |
|
3870 |
|
3871 |
|
3872 |
|
3873 |
|
3874 |
|
3875 |
|
3876 |
|
3877 |
|
3878 |
|
3879 |
|
3880 |
|
3881 |
|
3882 |
|
3883 |
|
3884 |
|
3885 |
|
3886 |
|
3887 |
|
3888 |
|
3889 |
|
3890 |
|
3891 |
|
3892 |
|
3893 |
|
3894 |
|
3895 |
|
3896 |
|
3897 |
|
3898 |
|
3899 |
|
3900 |
|
3901 |
|
3902 |
|
3903 |
|
3904 |
|
3905 |
|
3906 |
|
3907 |
|
3908 |
|
3909 |
|
3910 |
|
3911 |
|
3912 |
|
3913 |
|
3914 |
|
3915 |
|
3916 |
|
3917 |
|
3918 |
|
3919 |
|
3920 |
|
3921 |
|
3922 |
|
3923 |
|
3924 |
|
3925 |
|
3926 |
|
3927 |
|
3928 |
|
3929 |
|
3930 |
|
3931 |
|
3932 |
|
3933 |
|
3934 |
|
3935 |
|
3936 |
|
3937 |
|
3938 |
|
3939 |
|
3940 | var NgZone = (function () {
|
3941 | |
3942 |
|
3943 |
|
3944 | function NgZone(_a) {
|
3945 | var _b = _a.enableLongStackTrace, enableLongStackTrace = _b === void 0 ? false : _b;
|
3946 | this._hasPendingMicrotasks = false;
|
3947 | this._hasPendingMacrotasks = false;
|
3948 | this._isStable = true;
|
3949 | this._nesting = 0;
|
3950 | this._onUnstable = new EventEmitter(false);
|
3951 | this._onMicrotaskEmpty = new EventEmitter(false);
|
3952 | this._onStable = new EventEmitter(false);
|
3953 | this._onErrorEvents = new EventEmitter(false);
|
3954 | if (typeof Zone == 'undefined') {
|
3955 | throw new Error('Angular requires Zone.js prolyfill.');
|
3956 | }
|
3957 | Zone.assertZonePatched();
|
3958 | this.outer = this.inner = Zone.current;
|
3959 | if (Zone['wtfZoneSpec']) {
|
3960 | this.inner = this.inner.fork(Zone['wtfZoneSpec']);
|
3961 | }
|
3962 | if (enableLongStackTrace && Zone['longStackTraceZoneSpec']) {
|
3963 | this.inner = this.inner.fork(Zone['longStackTraceZoneSpec']);
|
3964 | }
|
3965 | this.forkInnerZoneWithAngularBehavior();
|
3966 | }
|
3967 | |
3968 |
|
3969 |
|
3970 | NgZone.isInAngularZone = function () { return Zone.current.get('isAngularZone') === true; };
|
3971 | |
3972 |
|
3973 |
|
3974 | NgZone.assertInAngularZone = function () {
|
3975 | if (!NgZone.isInAngularZone()) {
|
3976 | throw new Error('Expected to be in Angular Zone, but it is not!');
|
3977 | }
|
3978 | };
|
3979 | |
3980 |
|
3981 |
|
3982 | NgZone.assertNotInAngularZone = function () {
|
3983 | if (NgZone.isInAngularZone()) {
|
3984 | throw new Error('Expected to not be in Angular Zone, but it is!');
|
3985 | }
|
3986 | };
|
3987 | |
3988 |
|
3989 |
|
3990 |
|
3991 |
|
3992 |
|
3993 |
|
3994 |
|
3995 |
|
3996 |
|
3997 |
|
3998 |
|
3999 |
|
4000 |
|
4001 | NgZone.prototype.run = function (fn) { return this.inner.run(fn); };
|
4002 | |
4003 |
|
4004 |
|
4005 |
|
4006 |
|
4007 |
|
4008 | NgZone.prototype.runGuarded = function (fn) { return this.inner.runGuarded(fn); };
|
4009 | |
4010 |
|
4011 |
|
4012 |
|
4013 |
|
4014 |
|
4015 |
|
4016 |
|
4017 |
|
4018 |
|
4019 |
|
4020 |
|
4021 |
|
4022 |
|
4023 |
|
4024 | NgZone.prototype.runOutsideAngular = function (fn) { return this.outer.run(fn); };
|
4025 | Object.defineProperty(NgZone.prototype, "onUnstable", {
|
4026 | |
4027 |
|
4028 |
|
4029 |
|
4030 | get: function () { return this._onUnstable; },
|
4031 | enumerable: true,
|
4032 | configurable: true
|
4033 | });
|
4034 | Object.defineProperty(NgZone.prototype, "onMicrotaskEmpty", {
|
4035 | |
4036 |
|
4037 |
|
4038 |
|
4039 |
|
4040 |
|
4041 | get: function () { return this._onMicrotaskEmpty; },
|
4042 | enumerable: true,
|
4043 | configurable: true
|
4044 | });
|
4045 | Object.defineProperty(NgZone.prototype, "onStable", {
|
4046 | |
4047 |
|
4048 |
|
4049 |
|
4050 |
|
4051 |
|
4052 | get: function () { return this._onStable; },
|
4053 | enumerable: true,
|
4054 | configurable: true
|
4055 | });
|
4056 | Object.defineProperty(NgZone.prototype, "onError", {
|
4057 | |
4058 |
|
4059 |
|
4060 |
|
4061 | get: function () { return this._onErrorEvents; },
|
4062 | enumerable: true,
|
4063 | configurable: true
|
4064 | });
|
4065 | Object.defineProperty(NgZone.prototype, "isStable", {
|
4066 | |
4067 |
|
4068 |
|
4069 |
|
4070 | get: function () { return this._isStable; },
|
4071 | enumerable: true,
|
4072 | configurable: true
|
4073 | });
|
4074 | Object.defineProperty(NgZone.prototype, "hasPendingMicrotasks", {
|
4075 | |
4076 |
|
4077 |
|
4078 | get: function () { return this._hasPendingMicrotasks; },
|
4079 | enumerable: true,
|
4080 | configurable: true
|
4081 | });
|
4082 | Object.defineProperty(NgZone.prototype, "hasPendingMacrotasks", {
|
4083 | |
4084 |
|
4085 |
|
4086 | get: function () { return this._hasPendingMacrotasks; },
|
4087 | enumerable: true,
|
4088 | configurable: true
|
4089 | });
|
4090 | |
4091 |
|
4092 |
|
4093 | NgZone.prototype.checkStable = function () {
|
4094 | var _this = this;
|
4095 | if (this._nesting == 0 && !this._hasPendingMicrotasks && !this._isStable) {
|
4096 | try {
|
4097 | this._nesting++;
|
4098 | this._onMicrotaskEmpty.emit(null);
|
4099 | }
|
4100 | finally {
|
4101 | this._nesting--;
|
4102 | if (!this._hasPendingMicrotasks) {
|
4103 | try {
|
4104 | this.runOutsideAngular(function () { return _this._onStable.emit(null); });
|
4105 | }
|
4106 | finally {
|
4107 | this._isStable = true;
|
4108 | }
|
4109 | }
|
4110 | }
|
4111 | }
|
4112 | };
|
4113 | |
4114 |
|
4115 |
|
4116 | NgZone.prototype.forkInnerZoneWithAngularBehavior = function () {
|
4117 | var _this = this;
|
4118 | this.inner = this.inner.fork({
|
4119 | name: 'angular',
|
4120 | properties: ({ 'isAngularZone': true }),
|
4121 | onInvokeTask: function (delegate, current, target, task, applyThis, applyArgs) {
|
4122 | try {
|
4123 | _this.onEnter();
|
4124 | return delegate.invokeTask(target, task, applyThis, applyArgs);
|
4125 | }
|
4126 | finally {
|
4127 | _this.onLeave();
|
4128 | }
|
4129 | },
|
4130 | onInvoke: function (delegate, current, target, callback, applyThis, applyArgs, source) {
|
4131 | try {
|
4132 | _this.onEnter();
|
4133 | return delegate.invoke(target, callback, applyThis, applyArgs, source);
|
4134 | }
|
4135 | finally {
|
4136 | _this.onLeave();
|
4137 | }
|
4138 | },
|
4139 | onHasTask: function (delegate, current, target, hasTaskState) {
|
4140 | delegate.hasTask(target, hasTaskState);
|
4141 | if (current === target) {
|
4142 |
|
4143 |
|
4144 | if (hasTaskState.change == 'microTask') {
|
4145 | _this.setHasMicrotask(hasTaskState.microTask);
|
4146 | }
|
4147 | else if (hasTaskState.change == 'macroTask') {
|
4148 | _this.setHasMacrotask(hasTaskState.macroTask);
|
4149 | }
|
4150 | }
|
4151 | },
|
4152 | onHandleError: function (delegate, current, target, error) {
|
4153 | delegate.handleError(target, error);
|
4154 | _this.triggerError(error);
|
4155 | return false;
|
4156 | }
|
4157 | });
|
4158 | };
|
4159 | |
4160 |
|
4161 |
|
4162 | NgZone.prototype.onEnter = function () {
|
4163 | this._nesting++;
|
4164 | if (this._isStable) {
|
4165 | this._isStable = false;
|
4166 | this._onUnstable.emit(null);
|
4167 | }
|
4168 | };
|
4169 | |
4170 |
|
4171 |
|
4172 | NgZone.prototype.onLeave = function () {
|
4173 | this._nesting--;
|
4174 | this.checkStable();
|
4175 | };
|
4176 | |
4177 |
|
4178 |
|
4179 |
|
4180 | NgZone.prototype.setHasMicrotask = function (hasMicrotasks) {
|
4181 | this._hasPendingMicrotasks = hasMicrotasks;
|
4182 | this.checkStable();
|
4183 | };
|
4184 | |
4185 |
|
4186 |
|
4187 |
|
4188 | NgZone.prototype.setHasMacrotask = function (hasMacrotasks) { this._hasPendingMacrotasks = hasMacrotasks; };
|
4189 | |
4190 |
|
4191 |
|
4192 |
|
4193 | NgZone.prototype.triggerError = function (error) { this._onErrorEvents.emit(error); };
|
4194 | return NgZone;
|
4195 | }());
|
4196 |
|
4197 |
|
4198 |
|
4199 |
|
4200 |
|
4201 |
|
4202 |
|
4203 |
|
4204 |
|
4205 |
|
4206 |
|
4207 |
|
4208 |
|
4209 | var Testability = (function () {
|
4210 | |
4211 |
|
4212 |
|
4213 | function Testability(_ngZone) {
|
4214 | this._ngZone = _ngZone;
|
4215 | |
4216 |
|
4217 |
|
4218 | this._pendingCount = 0;
|
4219 | |
4220 |
|
4221 |
|
4222 | this._isZoneStable = true;
|
4223 | |
4224 |
|
4225 |
|
4226 |
|
4227 |
|
4228 |
|
4229 | this._didWork = false;
|
4230 | |
4231 |
|
4232 |
|
4233 | this._callbacks = [];
|
4234 | this._watchAngularEvents();
|
4235 | }
|
4236 | |
4237 |
|
4238 |
|
4239 |
|
4240 | Testability.prototype._watchAngularEvents = function () {
|
4241 | var _this = this;
|
4242 | this._ngZone.onUnstable.subscribe({
|
4243 | next: function () {
|
4244 | _this._didWork = true;
|
4245 | _this._isZoneStable = false;
|
4246 | }
|
4247 | });
|
4248 | this._ngZone.runOutsideAngular(function () {
|
4249 | _this._ngZone.onStable.subscribe({
|
4250 | next: function () {
|
4251 | NgZone.assertNotInAngularZone();
|
4252 | scheduleMicroTask(function () {
|
4253 | _this._isZoneStable = true;
|
4254 | _this._runCallbacksIfReady();
|
4255 | });
|
4256 | }
|
4257 | });
|
4258 | });
|
4259 | };
|
4260 | |
4261 |
|
4262 |
|
4263 | Testability.prototype.increasePendingRequestCount = function () {
|
4264 | this._pendingCount += 1;
|
4265 | this._didWork = true;
|
4266 | return this._pendingCount;
|
4267 | };
|
4268 | |
4269 |
|
4270 |
|
4271 | Testability.prototype.decreasePendingRequestCount = function () {
|
4272 | this._pendingCount -= 1;
|
4273 | if (this._pendingCount < 0) {
|
4274 | throw new Error('pending async requests below zero');
|
4275 | }
|
4276 | this._runCallbacksIfReady();
|
4277 | return this._pendingCount;
|
4278 | };
|
4279 | |
4280 |
|
4281 |
|
4282 | Testability.prototype.isStable = function () {
|
4283 | return this._isZoneStable && this._pendingCount == 0 && !this._ngZone.hasPendingMacrotasks;
|
4284 | };
|
4285 | |
4286 |
|
4287 |
|
4288 |
|
4289 | Testability.prototype._runCallbacksIfReady = function () {
|
4290 | var _this = this;
|
4291 | if (this.isStable()) {
|
4292 |
|
4293 | scheduleMicroTask(function () {
|
4294 | while (_this._callbacks.length !== 0) {
|
4295 | (((_this._callbacks.pop())))(_this._didWork);
|
4296 | }
|
4297 | _this._didWork = false;
|
4298 | });
|
4299 | }
|
4300 | else {
|
4301 |
|
4302 | this._didWork = true;
|
4303 | }
|
4304 | };
|
4305 | |
4306 |
|
4307 |
|
4308 |
|
4309 | Testability.prototype.whenStable = function (callback) {
|
4310 | this._callbacks.push(callback);
|
4311 | this._runCallbacksIfReady();
|
4312 | };
|
4313 | |
4314 |
|
4315 |
|
4316 | Testability.prototype.getPendingRequestCount = function () { return this._pendingCount; };
|
4317 | |
4318 |
|
4319 |
|
4320 |
|
4321 |
|
4322 |
|
4323 |
|
4324 | Testability.prototype.findBindings = function (using, provider, exactMatch) {
|
4325 |
|
4326 | return [];
|
4327 | };
|
4328 | |
4329 |
|
4330 |
|
4331 |
|
4332 |
|
4333 |
|
4334 | Testability.prototype.findProviders = function (using, provider, exactMatch) {
|
4335 |
|
4336 | return [];
|
4337 | };
|
4338 | return Testability;
|
4339 | }());
|
4340 | Testability.decorators = [
|
4341 | { type: Injectable },
|
4342 | ];
|
4343 |
|
4344 |
|
4345 |
|
4346 | Testability.ctorParameters = function () { return [
|
4347 | { type: NgZone, },
|
4348 | ]; };
|
4349 |
|
4350 |
|
4351 |
|
4352 |
|
4353 | var TestabilityRegistry = (function () {
|
4354 | function TestabilityRegistry() {
|
4355 | |
4356 |
|
4357 |
|
4358 | this._applications = new Map();
|
4359 | _testabilityGetter.addToWindow(this);
|
4360 | }
|
4361 | |
4362 |
|
4363 |
|
4364 |
|
4365 |
|
4366 | TestabilityRegistry.prototype.registerApplication = function (token, testability) {
|
4367 | this._applications.set(token, testability);
|
4368 | };
|
4369 | |
4370 |
|
4371 |
|
4372 |
|
4373 | TestabilityRegistry.prototype.getTestability = function (elem) { return this._applications.get(elem) || null; };
|
4374 | |
4375 |
|
4376 |
|
4377 | TestabilityRegistry.prototype.getAllTestabilities = function () { return Array.from(this._applications.values()); };
|
4378 | |
4379 |
|
4380 |
|
4381 | TestabilityRegistry.prototype.getAllRootElements = function () { return Array.from(this._applications.keys()); };
|
4382 | |
4383 |
|
4384 |
|
4385 |
|
4386 |
|
4387 | TestabilityRegistry.prototype.findTestabilityInTree = function (elem, findInAncestors) {
|
4388 | if (findInAncestors === void 0) { findInAncestors = true; }
|
4389 | return _testabilityGetter.findTestabilityInTree(this, elem, findInAncestors);
|
4390 | };
|
4391 | return TestabilityRegistry;
|
4392 | }());
|
4393 | TestabilityRegistry.decorators = [
|
4394 | { type: Injectable },
|
4395 | ];
|
4396 |
|
4397 |
|
4398 |
|
4399 | TestabilityRegistry.ctorParameters = function () { return []; };
|
4400 | var _NoopGetTestability = (function () {
|
4401 | function _NoopGetTestability() {
|
4402 | }
|
4403 | |
4404 |
|
4405 |
|
4406 |
|
4407 | _NoopGetTestability.prototype.addToWindow = function (registry) { };
|
4408 | |
4409 |
|
4410 |
|
4411 |
|
4412 |
|
4413 |
|
4414 | _NoopGetTestability.prototype.findTestabilityInTree = function (registry, elem, findInAncestors) {
|
4415 | return null;
|
4416 | };
|
4417 | return _NoopGetTestability;
|
4418 | }());
|
4419 |
|
4420 |
|
4421 |
|
4422 |
|
4423 |
|
4424 |
|
4425 | function setTestabilityGetter(getter) {
|
4426 | _testabilityGetter = getter;
|
4427 | }
|
4428 | var _testabilityGetter = new _NoopGetTestability();
|
4429 |
|
4430 |
|
4431 |
|
4432 |
|
4433 |
|
4434 |
|
4435 |
|
4436 | var _devMode = true;
|
4437 | var _runModeLocked = false;
|
4438 | var _platform;
|
4439 | var ALLOW_MULTIPLE_PLATFORMS = new InjectionToken('AllowMultipleToken');
|
4440 |
|
4441 |
|
4442 |
|
4443 |
|
4444 |
|
4445 |
|
4446 |
|
4447 |
|
4448 |
|
4449 |
|
4450 |
|
4451 | function enableProdMode() {
|
4452 | if (_runModeLocked) {
|
4453 | throw new Error('Cannot enable prod mode after platform setup.');
|
4454 | }
|
4455 | _devMode = false;
|
4456 | }
|
4457 |
|
4458 |
|
4459 |
|
4460 |
|
4461 |
|
4462 |
|
4463 |
|
4464 |
|
4465 |
|
4466 | function isDevMode() {
|
4467 | _runModeLocked = true;
|
4468 | return _devMode;
|
4469 | }
|
4470 |
|
4471 |
|
4472 |
|
4473 |
|
4474 |
|
4475 | var NgProbeToken = (function () {
|
4476 | |
4477 |
|
4478 |
|
4479 |
|
4480 | function NgProbeToken(name, token) {
|
4481 | this.name = name;
|
4482 | this.token = token;
|
4483 | }
|
4484 | return NgProbeToken;
|
4485 | }());
|
4486 |
|
4487 |
|
4488 |
|
4489 |
|
4490 |
|
4491 |
|
4492 |
|
4493 |
|
4494 | function createPlatform(injector) {
|
4495 | if (_platform && !_platform.destroyed &&
|
4496 | !_platform.injector.get(ALLOW_MULTIPLE_PLATFORMS, false)) {
|
4497 | throw new Error('There can be only one platform. Destroy the previous one to create a new one.');
|
4498 | }
|
4499 | _platform = injector.get(PlatformRef);
|
4500 | var inits = injector.get(PLATFORM_INITIALIZER, null);
|
4501 | if (inits)
|
4502 | inits.forEach(function (init) { return init(); });
|
4503 | return _platform;
|
4504 | }
|
4505 |
|
4506 |
|
4507 |
|
4508 |
|
4509 |
|
4510 |
|
4511 |
|
4512 |
|
4513 |
|
4514 | function createPlatformFactory(parentPlatformFactory, name, providers) {
|
4515 | if (providers === void 0) { providers = []; }
|
4516 | var marker = new InjectionToken("Platform: " + name);
|
4517 | return function (extraProviders) {
|
4518 | if (extraProviders === void 0) { extraProviders = []; }
|
4519 | var platform = getPlatform();
|
4520 | if (!platform || platform.injector.get(ALLOW_MULTIPLE_PLATFORMS, false)) {
|
4521 | if (parentPlatformFactory) {
|
4522 | parentPlatformFactory(providers.concat(extraProviders).concat({ provide: marker, useValue: true }));
|
4523 | }
|
4524 | else {
|
4525 | createPlatform(ReflectiveInjector.resolveAndCreate(providers.concat(extraProviders).concat({ provide: marker, useValue: true })));
|
4526 | }
|
4527 | }
|
4528 | return assertPlatform(marker);
|
4529 | };
|
4530 | }
|
4531 |
|
4532 |
|
4533 |
|
4534 |
|
4535 |
|
4536 |
|
4537 |
|
4538 | function assertPlatform(requiredToken) {
|
4539 | var platform = getPlatform();
|
4540 | if (!platform) {
|
4541 | throw new Error('No platform exists!');
|
4542 | }
|
4543 | if (!platform.injector.get(requiredToken, null)) {
|
4544 | throw new Error('A platform with a different configuration has been created. Please destroy it first.');
|
4545 | }
|
4546 | return platform;
|
4547 | }
|
4548 |
|
4549 |
|
4550 |
|
4551 |
|
4552 |
|
4553 |
|
4554 | function destroyPlatform() {
|
4555 | if (_platform && !_platform.destroyed) {
|
4556 | _platform.destroy();
|
4557 | }
|
4558 | }
|
4559 |
|
4560 |
|
4561 |
|
4562 |
|
4563 |
|
4564 |
|
4565 | function getPlatform() {
|
4566 | return _platform && !_platform.destroyed ? _platform : null;
|
4567 | }
|
4568 |
|
4569 |
|
4570 |
|
4571 |
|
4572 |
|
4573 |
|
4574 |
|
4575 |
|
4576 |
|
4577 |
|
4578 |
|
4579 | var PlatformRef = (function () {
|
4580 | function PlatformRef() {
|
4581 | }
|
4582 | |
4583 |
|
4584 |
|
4585 |
|
4586 |
|
4587 |
|
4588 |
|
4589 |
|
4590 |
|
4591 |
|
4592 |
|
4593 |
|
4594 |
|
4595 |
|
4596 |
|
4597 |
|
4598 |
|
4599 |
|
4600 |
|
4601 |
|
4602 |
|
4603 |
|
4604 |
|
4605 |
|
4606 |
|
4607 |
|
4608 |
|
4609 | PlatformRef.prototype.bootstrapModuleFactory = function (moduleFactory) { };
|
4610 | |
4611 |
|
4612 |
|
4613 |
|
4614 |
|
4615 |
|
4616 |
|
4617 |
|
4618 |
|
4619 |
|
4620 |
|
4621 |
|
4622 |
|
4623 |
|
4624 |
|
4625 |
|
4626 |
|
4627 |
|
4628 |
|
4629 |
|
4630 | PlatformRef.prototype.bootstrapModule = function (moduleType, compilerOptions) { };
|
4631 | |
4632 |
|
4633 |
|
4634 |
|
4635 |
|
4636 |
|
4637 | PlatformRef.prototype.onDestroy = function (callback) { };
|
4638 | |
4639 |
|
4640 |
|
4641 |
|
4642 |
|
4643 |
|
4644 | PlatformRef.prototype.injector = function () { };
|
4645 | |
4646 |
|
4647 |
|
4648 |
|
4649 |
|
4650 | PlatformRef.prototype.destroy = function () { };
|
4651 | |
4652 |
|
4653 |
|
4654 |
|
4655 | PlatformRef.prototype.destroyed = function () { };
|
4656 | return PlatformRef;
|
4657 | }());
|
4658 |
|
4659 |
|
4660 |
|
4661 |
|
4662 |
|
4663 | function _callAndReportToErrorHandler(errorHandler, callback) {
|
4664 | try {
|
4665 | var result = callback();
|
4666 | if (isPromise(result)) {
|
4667 | return result.catch(function (e) {
|
4668 | errorHandler.handleError(e);
|
4669 |
|
4670 | throw e;
|
4671 | });
|
4672 | }
|
4673 | return result;
|
4674 | }
|
4675 | catch (e) {
|
4676 | errorHandler.handleError(e);
|
4677 |
|
4678 | throw e;
|
4679 | }
|
4680 | }
|
4681 |
|
4682 |
|
4683 |
|
4684 |
|
4685 | var PlatformRef_ = (function (_super) {
|
4686 | __extends(PlatformRef_, _super);
|
4687 | |
4688 |
|
4689 |
|
4690 | function PlatformRef_(_injector) {
|
4691 | var _this = _super.call(this) || this;
|
4692 | _this._injector = _injector;
|
4693 | _this._modules = [];
|
4694 | _this._destroyListeners = [];
|
4695 | _this._destroyed = false;
|
4696 | return _this;
|
4697 | }
|
4698 | |
4699 |
|
4700 |
|
4701 |
|
4702 | PlatformRef_.prototype.onDestroy = function (callback) { this._destroyListeners.push(callback); };
|
4703 | Object.defineProperty(PlatformRef_.prototype, "injector", {
|
4704 | |
4705 |
|
4706 |
|
4707 | get: function () { return this._injector; },
|
4708 | enumerable: true,
|
4709 | configurable: true
|
4710 | });
|
4711 | Object.defineProperty(PlatformRef_.prototype, "destroyed", {
|
4712 | |
4713 |
|
4714 |
|
4715 | get: function () { return this._destroyed; },
|
4716 | enumerable: true,
|
4717 | configurable: true
|
4718 | });
|
4719 | |
4720 |
|
4721 |
|
4722 | PlatformRef_.prototype.destroy = function () {
|
4723 | if (this._destroyed) {
|
4724 | throw new Error('The platform has already been destroyed!');
|
4725 | }
|
4726 | this._modules.slice().forEach(function (module) { return module.destroy(); });
|
4727 | this._destroyListeners.forEach(function (listener) { return listener(); });
|
4728 | this._destroyed = true;
|
4729 | };
|
4730 | |
4731 |
|
4732 |
|
4733 |
|
4734 |
|
4735 | PlatformRef_.prototype.bootstrapModuleFactory = function (moduleFactory) {
|
4736 | return this._bootstrapModuleFactoryWithZone(moduleFactory);
|
4737 | };
|
4738 | |
4739 |
|
4740 |
|
4741 |
|
4742 |
|
4743 |
|
4744 | PlatformRef_.prototype._bootstrapModuleFactoryWithZone = function (moduleFactory, ngZone) {
|
4745 | var _this = this;
|
4746 |
|
4747 |
|
4748 |
|
4749 |
|
4750 | if (!ngZone)
|
4751 | ngZone = new NgZone({ enableLongStackTrace: isDevMode() });
|
4752 |
|
4753 |
|
4754 | return ngZone.run(function () {
|
4755 | var ngZoneInjector = ReflectiveInjector.resolveAndCreate([{ provide: NgZone, useValue: ngZone }], _this.injector);
|
4756 | var moduleRef = (moduleFactory.create(ngZoneInjector));
|
4757 | var exceptionHandler = moduleRef.injector.get(ErrorHandler, null);
|
4758 | if (!exceptionHandler) {
|
4759 | throw new Error('No ErrorHandler. Is platform module (BrowserModule) included?');
|
4760 | }
|
4761 | moduleRef.onDestroy(function () { return remove(_this._modules, moduleRef); });
|
4762 | ((ngZone)).onError.subscribe({ next: function (error) { exceptionHandler.handleError(error); } });
|
4763 | return _callAndReportToErrorHandler(exceptionHandler, function () {
|
4764 | var initStatus = moduleRef.injector.get(ApplicationInitStatus);
|
4765 | return initStatus.donePromise.then(function () {
|
4766 | _this._moduleDoBootstrap(moduleRef);
|
4767 | return moduleRef;
|
4768 | });
|
4769 | });
|
4770 | });
|
4771 | };
|
4772 | |
4773 |
|
4774 |
|
4775 |
|
4776 |
|
4777 |
|
4778 | PlatformRef_.prototype.bootstrapModule = function (moduleType, compilerOptions) {
|
4779 | if (compilerOptions === void 0) { compilerOptions = []; }
|
4780 | return this._bootstrapModuleWithZone(moduleType, compilerOptions);
|
4781 | };
|
4782 | |
4783 |
|
4784 |
|
4785 |
|
4786 |
|
4787 |
|
4788 |
|
4789 | PlatformRef_.prototype._bootstrapModuleWithZone = function (moduleType, compilerOptions, ngZone) {
|
4790 | var _this = this;
|
4791 | if (compilerOptions === void 0) { compilerOptions = []; }
|
4792 | var compilerFactory = this.injector.get(CompilerFactory);
|
4793 | var compiler = compilerFactory.createCompiler(Array.isArray(compilerOptions) ? compilerOptions : [compilerOptions]);
|
4794 | return compiler.compileModuleAsync(moduleType)
|
4795 | .then(function (moduleFactory) { return _this._bootstrapModuleFactoryWithZone(moduleFactory, ngZone); });
|
4796 | };
|
4797 | |
4798 |
|
4799 |
|
4800 |
|
4801 | PlatformRef_.prototype._moduleDoBootstrap = function (moduleRef) {
|
4802 | var appRef = moduleRef.injector.get(ApplicationRef);
|
4803 | if (moduleRef.bootstrapFactories.length > 0) {
|
4804 | moduleRef.bootstrapFactories.forEach(function (f) { return appRef.bootstrap(f); });
|
4805 | }
|
4806 | else if (moduleRef.instance.ngDoBootstrap) {
|
4807 | moduleRef.instance.ngDoBootstrap(appRef);
|
4808 | }
|
4809 | else {
|
4810 | throw new Error("The module " + stringify(moduleRef.instance.constructor) + " was bootstrapped, but it does not declare \"@NgModule.bootstrap\" components nor a \"ngDoBootstrap\" method. " +
|
4811 | "Please define one of these.");
|
4812 | }
|
4813 | this._modules.push(moduleRef);
|
4814 | };
|
4815 | return PlatformRef_;
|
4816 | }(PlatformRef));
|
4817 | PlatformRef_.decorators = [
|
4818 | { type: Injectable },
|
4819 | ];
|
4820 |
|
4821 |
|
4822 |
|
4823 | PlatformRef_.ctorParameters = function () { return [
|
4824 | { type: Injector, },
|
4825 | ]; };
|
4826 |
|
4827 |
|
4828 |
|
4829 |
|
4830 |
|
4831 |
|
4832 | var ApplicationRef = (function () {
|
4833 | function ApplicationRef() {
|
4834 | }
|
4835 | |
4836 |
|
4837 |
|
4838 |
|
4839 |
|
4840 |
|
4841 |
|
4842 |
|
4843 |
|
4844 |
|
4845 |
|
4846 |
|
4847 |
|
4848 |
|
4849 |
|
4850 |
|
4851 | ApplicationRef.prototype.bootstrap = function (componentFactory) { };
|
4852 | |
4853 |
|
4854 |
|
4855 |
|
4856 |
|
4857 |
|
4858 |
|
4859 |
|
4860 |
|
4861 |
|
4862 |
|
4863 |
|
4864 | ApplicationRef.prototype.tick = function () { };
|
4865 | |
4866 |
|
4867 |
|
4868 |
|
4869 |
|
4870 |
|
4871 | ApplicationRef.prototype.componentTypes = function () { };
|
4872 | |
4873 |
|
4874 |
|
4875 |
|
4876 |
|
4877 | ApplicationRef.prototype.components = function () { };
|
4878 | |
4879 |
|
4880 |
|
4881 |
|
4882 |
|
4883 |
|
4884 |
|
4885 |
|
4886 | ApplicationRef.prototype.attachView = function (view) { };
|
4887 | |
4888 |
|
4889 |
|
4890 |
|
4891 |
|
4892 |
|
4893 | ApplicationRef.prototype.detachView = function (view) { };
|
4894 | |
4895 |
|
4896 |
|
4897 |
|
4898 |
|
4899 | ApplicationRef.prototype.viewCount = function () { };
|
4900 | |
4901 |
|
4902 |
|
4903 |
|
4904 |
|
4905 | ApplicationRef.prototype.isStable = function () { };
|
4906 | return ApplicationRef;
|
4907 | }());
|
4908 |
|
4909 |
|
4910 |
|
4911 |
|
4912 | var ApplicationRef_ = (function (_super) {
|
4913 | __extends(ApplicationRef_, _super);
|
4914 | |
4915 |
|
4916 |
|
4917 |
|
4918 |
|
4919 |
|
4920 |
|
4921 |
|
4922 | function ApplicationRef_(_zone, _console, _injector, _exceptionHandler, _componentFactoryResolver, _initStatus) {
|
4923 | var _this = _super.call(this) || this;
|
4924 | _this._zone = _zone;
|
4925 | _this._console = _console;
|
4926 | _this._injector = _injector;
|
4927 | _this._exceptionHandler = _exceptionHandler;
|
4928 | _this._componentFactoryResolver = _componentFactoryResolver;
|
4929 | _this._initStatus = _initStatus;
|
4930 | _this._bootstrapListeners = [];
|
4931 | _this._rootComponents = [];
|
4932 | _this._rootComponentTypes = [];
|
4933 | _this._views = [];
|
4934 | _this._runningTick = false;
|
4935 | _this._enforceNoNewChanges = false;
|
4936 | _this._stable = true;
|
4937 | _this._enforceNoNewChanges = isDevMode();
|
4938 | _this._zone.onMicrotaskEmpty.subscribe({ next: function () { _this._zone.run(function () { _this.tick(); }); } });
|
4939 | var isCurrentlyStable = new rxjs_Observable.Observable(function (observer) {
|
4940 | _this._stable = _this._zone.isStable && !_this._zone.hasPendingMacrotasks &&
|
4941 | !_this._zone.hasPendingMicrotasks;
|
4942 | _this._zone.runOutsideAngular(function () {
|
4943 | observer.next(_this._stable);
|
4944 | observer.complete();
|
4945 | });
|
4946 | });
|
4947 | var isStable = new rxjs_Observable.Observable(function (observer) {
|
4948 | var stableSub = _this._zone.onStable.subscribe(function () {
|
4949 | NgZone.assertNotInAngularZone();
|
4950 |
|
4951 |
|
4952 | scheduleMicroTask(function () {
|
4953 | if (!_this._stable && !_this._zone.hasPendingMacrotasks &&
|
4954 | !_this._zone.hasPendingMicrotasks) {
|
4955 | _this._stable = true;
|
4956 | observer.next(true);
|
4957 | }
|
4958 | });
|
4959 | });
|
4960 | var unstableSub = _this._zone.onUnstable.subscribe(function () {
|
4961 | NgZone.assertInAngularZone();
|
4962 | if (_this._stable) {
|
4963 | _this._stable = false;
|
4964 | _this._zone.runOutsideAngular(function () { observer.next(false); });
|
4965 | }
|
4966 | });
|
4967 | return function () {
|
4968 | stableSub.unsubscribe();
|
4969 | unstableSub.unsubscribe();
|
4970 | };
|
4971 | });
|
4972 | _this._isStable = rxjs_observable_merge.merge(isCurrentlyStable, rxjs_operator_share.share.call(isStable));
|
4973 | return _this;
|
4974 | }
|
4975 | |
4976 |
|
4977 |
|
4978 |
|
4979 | ApplicationRef_.prototype.attachView = function (viewRef) {
|
4980 | var view = ((viewRef));
|
4981 | this._views.push(view);
|
4982 | view.attachToAppRef(this);
|
4983 | };
|
4984 | |
4985 |
|
4986 |
|
4987 |
|
4988 | ApplicationRef_.prototype.detachView = function (viewRef) {
|
4989 | var view = ((viewRef));
|
4990 | remove(this._views, view);
|
4991 | view.detachFromAppRef();
|
4992 | };
|
4993 | |
4994 |
|
4995 |
|
4996 |
|
4997 |
|
4998 | ApplicationRef_.prototype.bootstrap = function (componentOrFactory) {
|
4999 | var _this = this;
|
5000 | if (!this._initStatus.done) {
|
5001 | throw new Error('Cannot bootstrap as there are still asynchronous initializers running. Bootstrap components in the `ngDoBootstrap` method of the root module.');
|
5002 | }
|
5003 | var componentFactory;
|
5004 | if (componentOrFactory instanceof ComponentFactory) {
|
5005 | componentFactory = componentOrFactory;
|
5006 | }
|
5007 | else {
|
5008 | componentFactory = ((this._componentFactoryResolver.resolveComponentFactory(componentOrFactory)));
|
5009 | }
|
5010 | this._rootComponentTypes.push(componentFactory.componentType);
|
5011 |
|
5012 | var ngModule = componentFactory instanceof ComponentFactoryBoundToModule ?
|
5013 | null :
|
5014 | this._injector.get(NgModuleRef);
|
5015 | var compRef = componentFactory.create(Injector.NULL, [], componentFactory.selector, ngModule);
|
5016 | compRef.onDestroy(function () { _this._unloadComponent(compRef); });
|
5017 | var testability = compRef.injector.get(Testability, null);
|
5018 | if (testability) {
|
5019 | compRef.injector.get(TestabilityRegistry)
|
5020 | .registerApplication(compRef.location.nativeElement, testability);
|
5021 | }
|
5022 | this._loadComponent(compRef);
|
5023 | if (isDevMode()) {
|
5024 | this._console.log("Angular is running in the development mode. Call enableProdMode() to enable the production mode.");
|
5025 | }
|
5026 | return compRef;
|
5027 | };
|
5028 | |
5029 |
|
5030 |
|
5031 |
|
5032 | ApplicationRef_.prototype._loadComponent = function (componentRef) {
|
5033 | this.attachView(componentRef.hostView);
|
5034 | this.tick();
|
5035 | this._rootComponents.push(componentRef);
|
5036 |
|
5037 | var listeners = this._injector.get(APP_BOOTSTRAP_LISTENER, []).concat(this._bootstrapListeners);
|
5038 | listeners.forEach(function (listener) { return listener(componentRef); });
|
5039 | };
|
5040 | |
5041 |
|
5042 |
|
5043 |
|
5044 | ApplicationRef_.prototype._unloadComponent = function (componentRef) {
|
5045 | this.detachView(componentRef.hostView);
|
5046 | remove(this._rootComponents, componentRef);
|
5047 | };
|
5048 | |
5049 |
|
5050 |
|
5051 | ApplicationRef_.prototype.tick = function () {
|
5052 | if (this._runningTick) {
|
5053 | throw new Error('ApplicationRef.tick is called recursively');
|
5054 | }
|
5055 | var scope = ApplicationRef_._tickScope();
|
5056 | try {
|
5057 | this._runningTick = true;
|
5058 | this._views.forEach(function (view) { return view.detectChanges(); });
|
5059 | if (this._enforceNoNewChanges) {
|
5060 | this._views.forEach(function (view) { return view.checkNoChanges(); });
|
5061 | }
|
5062 | }
|
5063 | catch (e) {
|
5064 |
|
5065 | this._exceptionHandler.handleError(e);
|
5066 | }
|
5067 | finally {
|
5068 | this._runningTick = false;
|
5069 | wtfLeave(scope);
|
5070 | }
|
5071 | };
|
5072 | |
5073 |
|
5074 |
|
5075 | ApplicationRef_.prototype.ngOnDestroy = function () {
|
5076 |
|
5077 | this._views.slice().forEach(function (view) { return view.destroy(); });
|
5078 | };
|
5079 | Object.defineProperty(ApplicationRef_.prototype, "viewCount", {
|
5080 | |
5081 |
|
5082 |
|
5083 | get: function () { return this._views.length; },
|
5084 | enumerable: true,
|
5085 | configurable: true
|
5086 | });
|
5087 | Object.defineProperty(ApplicationRef_.prototype, "componentTypes", {
|
5088 | |
5089 |
|
5090 |
|
5091 | get: function () { return this._rootComponentTypes; },
|
5092 | enumerable: true,
|
5093 | configurable: true
|
5094 | });
|
5095 | Object.defineProperty(ApplicationRef_.prototype, "components", {
|
5096 | |
5097 |
|
5098 |
|
5099 | get: function () { return this._rootComponents; },
|
5100 | enumerable: true,
|
5101 | configurable: true
|
5102 | });
|
5103 | Object.defineProperty(ApplicationRef_.prototype, "isStable", {
|
5104 | |
5105 |
|
5106 |
|
5107 | get: function () { return this._isStable; },
|
5108 | enumerable: true,
|
5109 | configurable: true
|
5110 | });
|
5111 | return ApplicationRef_;
|
5112 | }(ApplicationRef));
|
5113 |
|
5114 |
|
5115 |
|
5116 | ApplicationRef_._tickScope = wtfCreateScope('ApplicationRef#tick()');
|
5117 | ApplicationRef_.decorators = [
|
5118 | { type: Injectable },
|
5119 | ];
|
5120 |
|
5121 |
|
5122 |
|
5123 | ApplicationRef_.ctorParameters = function () { return [
|
5124 | { type: NgZone, },
|
5125 | { type: Console, },
|
5126 | { type: Injector, },
|
5127 | { type: ErrorHandler, },
|
5128 | { type: ComponentFactoryResolver, },
|
5129 | { type: ApplicationInitStatus, },
|
5130 | ]; };
|
5131 |
|
5132 |
|
5133 |
|
5134 |
|
5135 |
|
5136 |
|
5137 | function remove(list, el) {
|
5138 | var index = list.indexOf(el);
|
5139 | if (index > -1) {
|
5140 | list.splice(index, 1);
|
5141 | }
|
5142 | }
|
5143 |
|
5144 |
|
5145 |
|
5146 |
|
5147 |
|
5148 |
|
5149 |
|
5150 |
|
5151 |
|
5152 |
|
5153 |
|
5154 |
|
5155 |
|
5156 |
|
5157 |
|
5158 |
|
5159 |
|
5160 |
|
5161 | var RenderComponentType = (function () {
|
5162 | |
5163 |
|
5164 |
|
5165 |
|
5166 |
|
5167 |
|
5168 |
|
5169 |
|
5170 | function RenderComponentType(id, templateUrl, slotCount, encapsulation, styles, animations) {
|
5171 | this.id = id;
|
5172 | this.templateUrl = templateUrl;
|
5173 | this.slotCount = slotCount;
|
5174 | this.encapsulation = encapsulation;
|
5175 | this.styles = styles;
|
5176 | this.animations = animations;
|
5177 | }
|
5178 | return RenderComponentType;
|
5179 | }());
|
5180 |
|
5181 |
|
5182 |
|
5183 |
|
5184 | var RenderDebugInfo = (function () {
|
5185 | function RenderDebugInfo() {
|
5186 | }
|
5187 | |
5188 |
|
5189 |
|
5190 |
|
5191 | RenderDebugInfo.prototype.injector = function () { };
|
5192 | |
5193 |
|
5194 |
|
5195 |
|
5196 | RenderDebugInfo.prototype.component = function () { };
|
5197 | |
5198 |
|
5199 |
|
5200 |
|
5201 | RenderDebugInfo.prototype.providerTokens = function () { };
|
5202 | |
5203 |
|
5204 |
|
5205 |
|
5206 | RenderDebugInfo.prototype.references = function () { };
|
5207 | |
5208 |
|
5209 |
|
5210 |
|
5211 | RenderDebugInfo.prototype.context = function () { };
|
5212 | |
5213 |
|
5214 |
|
5215 |
|
5216 | RenderDebugInfo.prototype.source = function () { };
|
5217 | return RenderDebugInfo;
|
5218 | }());
|
5219 |
|
5220 |
|
5221 |
|
5222 |
|
5223 | var Renderer = (function () {
|
5224 | function Renderer() {
|
5225 | }
|
5226 | |
5227 |
|
5228 |
|
5229 |
|
5230 |
|
5231 |
|
5232 | Renderer.prototype.selectRootElement = function (selectorOrNode, debugInfo) { };
|
5233 | |
5234 |
|
5235 |
|
5236 |
|
5237 |
|
5238 |
|
5239 |
|
5240 | Renderer.prototype.createElement = function (parentElement, name, debugInfo) { };
|
5241 | |
5242 |
|
5243 |
|
5244 |
|
5245 |
|
5246 | Renderer.prototype.createViewRoot = function (hostElement) { };
|
5247 | |
5248 |
|
5249 |
|
5250 |
|
5251 |
|
5252 |
|
5253 | Renderer.prototype.createTemplateAnchor = function (parentElement, debugInfo) { };
|
5254 | |
5255 |
|
5256 |
|
5257 |
|
5258 |
|
5259 |
|
5260 |
|
5261 | Renderer.prototype.createText = function (parentElement, value, debugInfo) { };
|
5262 | |
5263 |
|
5264 |
|
5265 |
|
5266 |
|
5267 |
|
5268 | Renderer.prototype.projectNodes = function (parentElement, nodes) { };
|
5269 | |
5270 |
|
5271 |
|
5272 |
|
5273 |
|
5274 |
|
5275 | Renderer.prototype.attachViewAfter = function (node, viewRootNodes) { };
|
5276 | |
5277 |
|
5278 |
|
5279 |
|
5280 |
|
5281 | Renderer.prototype.detachView = function (viewRootNodes) { };
|
5282 | |
5283 |
|
5284 |
|
5285 |
|
5286 |
|
5287 |
|
5288 | Renderer.prototype.destroyView = function (hostElement, viewAllNodes) { };
|
5289 | |
5290 |
|
5291 |
|
5292 |
|
5293 |
|
5294 |
|
5295 |
|
5296 | Renderer.prototype.listen = function (renderElement, name, callback) { };
|
5297 | |
5298 |
|
5299 |
|
5300 |
|
5301 |
|
5302 |
|
5303 |
|
5304 | Renderer.prototype.listenGlobal = function (target, name, callback) { };
|
5305 | |
5306 |
|
5307 |
|
5308 |
|
5309 |
|
5310 |
|
5311 |
|
5312 | Renderer.prototype.setElementProperty = function (renderElement, propertyName, propertyValue) { };
|
5313 | |
5314 |
|
5315 |
|
5316 |
|
5317 |
|
5318 |
|
5319 |
|
5320 | Renderer.prototype.setElementAttribute = function (renderElement, attributeName, attributeValue) { };
|
5321 | |
5322 |
|
5323 |
|
5324 |
|
5325 |
|
5326 |
|
5327 |
|
5328 |
|
5329 | Renderer.prototype.setBindingDebugInfo = function (renderElement, propertyName, propertyValue) { };
|
5330 | |
5331 |
|
5332 |
|
5333 |
|
5334 |
|
5335 |
|
5336 |
|
5337 | Renderer.prototype.setElementClass = function (renderElement, className, isAdd) { };
|
5338 | |
5339 |
|
5340 |
|
5341 |
|
5342 |
|
5343 |
|
5344 |
|
5345 | Renderer.prototype.setElementStyle = function (renderElement, styleName, styleValue) { };
|
5346 | |
5347 |
|
5348 |
|
5349 |
|
5350 |
|
5351 |
|
5352 |
|
5353 | Renderer.prototype.invokeElementMethod = function (renderElement, methodName, args) { };
|
5354 | |
5355 |
|
5356 |
|
5357 |
|
5358 |
|
5359 |
|
5360 | Renderer.prototype.setText = function (renderNode, text) { };
|
5361 | |
5362 |
|
5363 |
|
5364 |
|
5365 |
|
5366 |
|
5367 |
|
5368 |
|
5369 |
|
5370 |
|
5371 |
|
5372 | Renderer.prototype.animate = function (element, startingStyles, keyframes, duration, delay, easing, previousPlayers) { };
|
5373 | return Renderer;
|
5374 | }());
|
5375 | var Renderer2Interceptor = new InjectionToken('Renderer2Interceptor');
|
5376 |
|
5377 |
|
5378 |
|
5379 |
|
5380 |
|
5381 |
|
5382 |
|
5383 |
|
5384 |
|
5385 |
|
5386 |
|
5387 |
|
5388 |
|
5389 |
|
5390 |
|
5391 | var RootRenderer = (function () {
|
5392 | function RootRenderer() {
|
5393 | }
|
5394 | |
5395 |
|
5396 |
|
5397 |
|
5398 |
|
5399 | RootRenderer.prototype.renderComponent = function (componentType) { };
|
5400 | return RootRenderer;
|
5401 | }());
|
5402 |
|
5403 |
|
5404 |
|
5405 |
|
5406 | var RendererFactory2 = (function () {
|
5407 | function RendererFactory2() {
|
5408 | }
|
5409 | |
5410 |
|
5411 |
|
5412 |
|
5413 |
|
5414 |
|
5415 | RendererFactory2.prototype.createRenderer = function (hostElement, type) { };
|
5416 | return RendererFactory2;
|
5417 | }());
|
5418 | var RendererStyleFlags2 = {};
|
5419 | RendererStyleFlags2.Important = 1;
|
5420 | RendererStyleFlags2.DashCase = 2;
|
5421 | RendererStyleFlags2[RendererStyleFlags2.Important] = "Important";
|
5422 | RendererStyleFlags2[RendererStyleFlags2.DashCase] = "DashCase";
|
5423 |
|
5424 |
|
5425 |
|
5426 |
|
5427 | var Renderer2 = (function () {
|
5428 | function Renderer2() {
|
5429 | }
|
5430 | |
5431 |
|
5432 |
|
5433 |
|
5434 |
|
5435 |
|
5436 | Renderer2.prototype.data = function () { };
|
5437 | |
5438 |
|
5439 |
|
5440 |
|
5441 | Renderer2.prototype.destroy = function () { };
|
5442 | |
5443 |
|
5444 |
|
5445 |
|
5446 |
|
5447 |
|
5448 | Renderer2.prototype.createElement = function (name, namespace) { };
|
5449 | |
5450 |
|
5451 |
|
5452 |
|
5453 |
|
5454 | Renderer2.prototype.createComment = function (value) { };
|
5455 | |
5456 |
|
5457 |
|
5458 |
|
5459 |
|
5460 | Renderer2.prototype.createText = function (value) { };
|
5461 | |
5462 |
|
5463 |
|
5464 |
|
5465 |
|
5466 |
|
5467 | Renderer2.prototype.appendChild = function (parent, newChild) { };
|
5468 | |
5469 |
|
5470 |
|
5471 |
|
5472 |
|
5473 |
|
5474 |
|
5475 | Renderer2.prototype.insertBefore = function (parent, newChild, refChild) { };
|
5476 | |
5477 |
|
5478 |
|
5479 |
|
5480 |
|
5481 |
|
5482 | Renderer2.prototype.removeChild = function (parent, oldChild) { };
|
5483 | |
5484 |
|
5485 |
|
5486 |
|
5487 |
|
5488 | Renderer2.prototype.selectRootElement = function (selectorOrNode) { };
|
5489 | |
5490 |
|
5491 |
|
5492 |
|
5493 |
|
5494 |
|
5495 |
|
5496 |
|
5497 | Renderer2.prototype.parentNode = function (node) { };
|
5498 | |
5499 |
|
5500 |
|
5501 |
|
5502 |
|
5503 |
|
5504 |
|
5505 |
|
5506 | Renderer2.prototype.nextSibling = function (node) { };
|
5507 | |
5508 |
|
5509 |
|
5510 |
|
5511 |
|
5512 |
|
5513 |
|
5514 |
|
5515 | Renderer2.prototype.setAttribute = function (el, name, value, namespace) { };
|
5516 | |
5517 |
|
5518 |
|
5519 |
|
5520 |
|
5521 |
|
5522 |
|
5523 | Renderer2.prototype.removeAttribute = function (el, name, namespace) { };
|
5524 | |
5525 |
|
5526 |
|
5527 |
|
5528 |
|
5529 |
|
5530 | Renderer2.prototype.addClass = function (el, name) { };
|
5531 | |
5532 |
|
5533 |
|
5534 |
|
5535 |
|
5536 |
|
5537 | Renderer2.prototype.removeClass = function (el, name) { };
|
5538 | |
5539 |
|
5540 |
|
5541 |
|
5542 |
|
5543 |
|
5544 |
|
5545 |
|
5546 | Renderer2.prototype.setStyle = function (el, style, value, flags) { };
|
5547 | |
5548 |
|
5549 |
|
5550 |
|
5551 |
|
5552 |
|
5553 |
|
5554 | Renderer2.prototype.removeStyle = function (el, style, flags) { };
|
5555 | |
5556 |
|
5557 |
|
5558 |
|
5559 |
|
5560 |
|
5561 |
|
5562 | Renderer2.prototype.setProperty = function (el, name, value) { };
|
5563 | |
5564 |
|
5565 |
|
5566 |
|
5567 |
|
5568 |
|
5569 | Renderer2.prototype.setValue = function (node, value) { };
|
5570 | |
5571 |
|
5572 |
|
5573 |
|
5574 |
|
5575 |
|
5576 |
|
5577 | Renderer2.prototype.listen = function (target, eventName, callback) { };
|
5578 | return Renderer2;
|
5579 | }());
|
5580 |
|
5581 |
|
5582 |
|
5583 |
|
5584 |
|
5585 |
|
5586 |
|
5587 |
|
5588 | var ElementRef = (function () {
|
5589 | |
5590 |
|
5591 |
|
5592 | function ElementRef(nativeElement) {
|
5593 | this.nativeElement = nativeElement;
|
5594 | }
|
5595 | return ElementRef;
|
5596 | }());
|
5597 |
|
5598 |
|
5599 |
|
5600 |
|
5601 |
|
5602 |
|
5603 |
|
5604 |
|
5605 |
|
5606 |
|
5607 |
|
5608 |
|
5609 | var NgModuleFactoryLoader = (function () {
|
5610 | function NgModuleFactoryLoader() {
|
5611 | }
|
5612 | |
5613 |
|
5614 |
|
5615 |
|
5616 |
|
5617 | NgModuleFactoryLoader.prototype.load = function (path) { };
|
5618 | return NgModuleFactoryLoader;
|
5619 | }());
|
5620 | var moduleFactories = new Map();
|
5621 |
|
5622 |
|
5623 |
|
5624 |
|
5625 |
|
5626 |
|
5627 |
|
5628 | function registerModuleFactory(id, factory) {
|
5629 | var existing = moduleFactories.get(id);
|
5630 | if (existing) {
|
5631 | throw new Error("Duplicate module registered for " + id + " - " + existing.moduleType.name + " vs " + factory.moduleType.name);
|
5632 | }
|
5633 | moduleFactories.set(id, factory);
|
5634 | }
|
5635 |
|
5636 |
|
5637 |
|
5638 |
|
5639 |
|
5640 |
|
5641 |
|
5642 |
|
5643 |
|
5644 |
|
5645 |
|
5646 | function getModuleFactory(id) {
|
5647 | var factory = moduleFactories.get(id);
|
5648 | if (!factory)
|
5649 | throw new Error("No module with ID " + id + " loaded");
|
5650 | return factory;
|
5651 | }
|
5652 |
|
5653 |
|
5654 |
|
5655 |
|
5656 |
|
5657 |
|
5658 |
|
5659 |
|
5660 |
|
5661 |
|
5662 |
|
5663 |
|
5664 |
|
5665 |
|
5666 |
|
5667 |
|
5668 |
|
5669 |
|
5670 |
|
5671 |
|
5672 |
|
5673 |
|
5674 |
|
5675 |
|
5676 |
|
5677 |
|
5678 |
|
5679 |
|
5680 |
|
5681 |
|
5682 |
|
5683 | var QueryList = (function () {
|
5684 | function QueryList() {
|
5685 | this._dirty = true;
|
5686 | this._results = [];
|
5687 | this._emitter = new EventEmitter();
|
5688 | }
|
5689 | Object.defineProperty(QueryList.prototype, "changes", {
|
5690 | |
5691 |
|
5692 |
|
5693 | get: function () { return this._emitter; },
|
5694 | enumerable: true,
|
5695 | configurable: true
|
5696 | });
|
5697 | Object.defineProperty(QueryList.prototype, "length", {
|
5698 | |
5699 |
|
5700 |
|
5701 | get: function () { return this._results.length; },
|
5702 | enumerable: true,
|
5703 | configurable: true
|
5704 | });
|
5705 | Object.defineProperty(QueryList.prototype, "first", {
|
5706 | |
5707 |
|
5708 |
|
5709 | get: function () { return this._results[0]; },
|
5710 | enumerable: true,
|
5711 | configurable: true
|
5712 | });
|
5713 | Object.defineProperty(QueryList.prototype, "last", {
|
5714 | |
5715 |
|
5716 |
|
5717 | get: function () { return this._results[this.length - 1]; },
|
5718 | enumerable: true,
|
5719 | configurable: true
|
5720 | });
|
5721 | |
5722 |
|
5723 |
|
5724 |
|
5725 |
|
5726 |
|
5727 |
|
5728 | QueryList.prototype.map = function (fn) { return this._results.map(fn); };
|
5729 | |
5730 |
|
5731 |
|
5732 |
|
5733 |
|
5734 |
|
5735 | QueryList.prototype.filter = function (fn) {
|
5736 | return this._results.filter(fn);
|
5737 | };
|
5738 | |
5739 |
|
5740 |
|
5741 |
|
5742 |
|
5743 |
|
5744 | QueryList.prototype.find = function (fn) {
|
5745 | return this._results.find(fn);
|
5746 | };
|
5747 | |
5748 |
|
5749 |
|
5750 |
|
5751 |
|
5752 |
|
5753 |
|
5754 |
|
5755 | QueryList.prototype.reduce = function (fn, init) {
|
5756 | return this._results.reduce(fn, init);
|
5757 | };
|
5758 | |
5759 |
|
5760 |
|
5761 |
|
5762 |
|
5763 |
|
5764 | QueryList.prototype.forEach = function (fn) { this._results.forEach(fn); };
|
5765 | |
5766 |
|
5767 |
|
5768 |
|
5769 |
|
5770 |
|
5771 | QueryList.prototype.some = function (fn) {
|
5772 | return this._results.some(fn);
|
5773 | };
|
5774 | |
5775 |
|
5776 |
|
5777 | QueryList.prototype.toArray = function () { return this._results.slice(); };
|
5778 | |
5779 |
|
5780 |
|
5781 | QueryList.prototype[getSymbolIterator()] = function () { return ((this._results))[getSymbolIterator()](); };
|
5782 | |
5783 |
|
5784 |
|
5785 | QueryList.prototype.toString = function () { return this._results.toString(); };
|
5786 | |
5787 |
|
5788 |
|
5789 |
|
5790 | QueryList.prototype.reset = function (res) {
|
5791 | this._results = flatten(res);
|
5792 | this._dirty = false;
|
5793 | };
|
5794 | |
5795 |
|
5796 |
|
5797 | QueryList.prototype.notifyOnChanges = function () { this._emitter.emit(this); };
|
5798 | |
5799 |
|
5800 |
|
5801 |
|
5802 | QueryList.prototype.setDirty = function () { this._dirty = true; };
|
5803 | Object.defineProperty(QueryList.prototype, "dirty", {
|
5804 | |
5805 |
|
5806 |
|
5807 |
|
5808 | get: function () { return this._dirty; },
|
5809 | enumerable: true,
|
5810 | configurable: true
|
5811 | });
|
5812 | return QueryList;
|
5813 | }());
|
5814 |
|
5815 |
|
5816 |
|
5817 |
|
5818 |
|
5819 | function flatten(list) {
|
5820 | return list.reduce(function (flat, item) {
|
5821 | var flatItem = Array.isArray(item) ? flatten(item) : item;
|
5822 | return ((flat)).concat(flatItem);
|
5823 | }, []);
|
5824 | }
|
5825 |
|
5826 |
|
5827 |
|
5828 |
|
5829 |
|
5830 |
|
5831 |
|
5832 | var _SEPARATOR = '#';
|
5833 | var FACTORY_CLASS_SUFFIX = 'NgFactory';
|
5834 |
|
5835 |
|
5836 |
|
5837 |
|
5838 |
|
5839 |
|
5840 |
|
5841 | var SystemJsNgModuleLoaderConfig = (function () {
|
5842 | function SystemJsNgModuleLoaderConfig() {
|
5843 | }
|
5844 | return SystemJsNgModuleLoaderConfig;
|
5845 | }());
|
5846 | var DEFAULT_CONFIG = {
|
5847 | factoryPathPrefix: '',
|
5848 | factoryPathSuffix: '.ngfactory',
|
5849 | };
|
5850 |
|
5851 |
|
5852 |
|
5853 |
|
5854 | var SystemJsNgModuleLoader = (function () {
|
5855 | |
5856 |
|
5857 |
|
5858 |
|
5859 | function SystemJsNgModuleLoader(_compiler, config) {
|
5860 | this._compiler = _compiler;
|
5861 | this._config = config || DEFAULT_CONFIG;
|
5862 | }
|
5863 | |
5864 |
|
5865 |
|
5866 |
|
5867 | SystemJsNgModuleLoader.prototype.load = function (path) {
|
5868 | var offlineMode = this._compiler instanceof Compiler;
|
5869 | return offlineMode ? this.loadFactory(path) : this.loadAndCompile(path);
|
5870 | };
|
5871 | |
5872 |
|
5873 |
|
5874 |
|
5875 | SystemJsNgModuleLoader.prototype.loadAndCompile = function (path) {
|
5876 | var _this = this;
|
5877 | var _a = path.split(_SEPARATOR), module = _a[0], exportName = _a[1];
|
5878 | if (exportName === undefined) {
|
5879 | exportName = 'default';
|
5880 | }
|
5881 | return System.import(module)
|
5882 | .then(function (module) { return module[exportName]; })
|
5883 | .then(function (type) { return checkNotEmpty(type, module, exportName); })
|
5884 | .then(function (type) { return _this._compiler.compileModuleAsync(type); });
|
5885 | };
|
5886 | |
5887 |
|
5888 |
|
5889 |
|
5890 | SystemJsNgModuleLoader.prototype.loadFactory = function (path) {
|
5891 | var _a = path.split(_SEPARATOR), module = _a[0], exportName = _a[1];
|
5892 | var factoryClassSuffix = FACTORY_CLASS_SUFFIX;
|
5893 | if (exportName === undefined) {
|
5894 | exportName = 'default';
|
5895 | factoryClassSuffix = '';
|
5896 | }
|
5897 | return System.import(this._config.factoryPathPrefix + module + this._config.factoryPathSuffix)
|
5898 | .then(function (module) { return module[exportName + factoryClassSuffix]; })
|
5899 | .then(function (factory) { return checkNotEmpty(factory, module, exportName); });
|
5900 | };
|
5901 | return SystemJsNgModuleLoader;
|
5902 | }());
|
5903 | SystemJsNgModuleLoader.decorators = [
|
5904 | { type: Injectable },
|
5905 | ];
|
5906 |
|
5907 |
|
5908 |
|
5909 | SystemJsNgModuleLoader.ctorParameters = function () { return [
|
5910 | { type: Compiler, },
|
5911 | { type: SystemJsNgModuleLoaderConfig, decorators: [{ type: Optional },] },
|
5912 | ]; };
|
5913 |
|
5914 |
|
5915 |
|
5916 |
|
5917 |
|
5918 |
|
5919 | function checkNotEmpty(value, modulePath, exportName) {
|
5920 | if (!value) {
|
5921 | throw new Error("Cannot find '" + exportName + "' in '" + modulePath + "'");
|
5922 | }
|
5923 | return value;
|
5924 | }
|
5925 |
|
5926 |
|
5927 |
|
5928 |
|
5929 |
|
5930 |
|
5931 |
|
5932 |
|
5933 |
|
5934 |
|
5935 |
|
5936 |
|
5937 |
|
5938 |
|
5939 |
|
5940 |
|
5941 |
|
5942 |
|
5943 |
|
5944 |
|
5945 |
|
5946 | var TemplateRef = (function () {
|
5947 | function TemplateRef() {
|
5948 | }
|
5949 | |
5950 |
|
5951 |
|
5952 |
|
5953 | TemplateRef.prototype.elementRef = function () { };
|
5954 | |
5955 |
|
5956 |
|
5957 |
|
5958 |
|
5959 | TemplateRef.prototype.createEmbeddedView = function (context) { };
|
5960 | return TemplateRef;
|
5961 | }());
|
5962 |
|
5963 |
|
5964 |
|
5965 |
|
5966 |
|
5967 |
|
5968 |
|
5969 |
|
5970 |
|
5971 |
|
5972 |
|
5973 |
|
5974 |
|
5975 |
|
5976 |
|
5977 |
|
5978 |
|
5979 |
|
5980 |
|
5981 |
|
5982 |
|
5983 |
|
5984 |
|
5985 |
|
5986 |
|
5987 |
|
5988 | var ViewContainerRef = (function () {
|
5989 | function ViewContainerRef() {
|
5990 | }
|
5991 | |
5992 |
|
5993 |
|
5994 |
|
5995 |
|
5996 |
|
5997 | ViewContainerRef.prototype.element = function () { };
|
5998 | |
5999 |
|
6000 |
|
6001 |
|
6002 | ViewContainerRef.prototype.injector = function () { };
|
6003 | |
6004 |
|
6005 |
|
6006 |
|
6007 | ViewContainerRef.prototype.parentInjector = function () { };
|
6008 | |
6009 |
|
6010 |
|
6011 |
|
6012 |
|
6013 | ViewContainerRef.prototype.clear = function () { };
|
6014 | |
6015 |
|
6016 |
|
6017 |
|
6018 |
|
6019 |
|
6020 | ViewContainerRef.prototype.get = function (index) { };
|
6021 | |
6022 |
|
6023 |
|
6024 |
|
6025 |
|
6026 | ViewContainerRef.prototype.length = function () { };
|
6027 | |
6028 |
|
6029 |
|
6030 |
|
6031 |
|
6032 |
|
6033 |
|
6034 |
|
6035 |
|
6036 |
|
6037 |
|
6038 |
|
6039 |
|
6040 |
|
6041 | ViewContainerRef.prototype.createEmbeddedView = function (templateRef, context, index) { };
|
6042 | |
6043 |
|
6044 |
|
6045 |
|
6046 |
|
6047 |
|
6048 |
|
6049 |
|
6050 |
|
6051 |
|
6052 |
|
6053 |
|
6054 |
|
6055 |
|
6056 |
|
6057 |
|
6058 |
|
6059 |
|
6060 |
|
6061 |
|
6062 |
|
6063 | ViewContainerRef.prototype.createComponent = function (componentFactory, index, injector, projectableNodes, ngModule) { };
|
6064 | |
6065 |
|
6066 |
|
6067 |
|
6068 |
|
6069 |
|
6070 |
|
6071 |
|
6072 |
|
6073 |
|
6074 |
|
6075 | ViewContainerRef.prototype.insert = function (viewRef, index) { };
|
6076 | |
6077 |
|
6078 |
|
6079 |
|
6080 |
|
6081 |
|
6082 |
|
6083 |
|
6084 |
|
6085 | ViewContainerRef.prototype.move = function (viewRef, currentIndex) { };
|
6086 | |
6087 |
|
6088 |
|
6089 |
|
6090 |
|
6091 |
|
6092 |
|
6093 | ViewContainerRef.prototype.indexOf = function (viewRef) { };
|
6094 | |
6095 |
|
6096 |
|
6097 |
|
6098 |
|
6099 |
|
6100 |
|
6101 |
|
6102 | ViewContainerRef.prototype.remove = function (index) { };
|
6103 | |
6104 |
|
6105 |
|
6106 |
|
6107 |
|
6108 |
|
6109 |
|
6110 |
|
6111 | ViewContainerRef.prototype.detach = function (index) { };
|
6112 | return ViewContainerRef;
|
6113 | }());
|
6114 |
|
6115 |
|
6116 |
|
6117 |
|
6118 | var ChangeDetectorRef = (function () {
|
6119 | function ChangeDetectorRef() {
|
6120 | }
|
6121 | |
6122 |
|
6123 |
|
6124 |
|
6125 |
|
6126 |
|
6127 |
|
6128 |
|
6129 |
|
6130 |
|
6131 |
|
6132 |
|
6133 |
|
6134 |
|
6135 |
|
6136 |
|
6137 |
|
6138 |
|
6139 |
|
6140 |
|
6141 |
|
6142 |
|
6143 |
|
6144 |
|
6145 |
|
6146 |
|
6147 |
|
6148 |
|
6149 |
|
6150 |
|
6151 |
|
6152 |
|
6153 |
|
6154 |
|
6155 |
|
6156 |
|
6157 |
|
6158 |
|
6159 | ChangeDetectorRef.prototype.markForCheck = function () { };
|
6160 | |
6161 |
|
6162 |
|
6163 |
|
6164 |
|
6165 |
|
6166 |
|
6167 |
|
6168 |
|
6169 |
|
6170 |
|
6171 |
|
6172 |
|
6173 |
|
6174 |
|
6175 |
|
6176 |
|
6177 |
|
6178 |
|
6179 |
|
6180 |
|
6181 |
|
6182 |
|
6183 |
|
6184 |
|
6185 |
|
6186 |
|
6187 |
|
6188 |
|
6189 |
|
6190 |
|
6191 |
|
6192 |
|
6193 |
|
6194 |
|
6195 |
|
6196 |
|
6197 |
|
6198 |
|
6199 |
|
6200 |
|
6201 |
|
6202 |
|
6203 |
|
6204 |
|
6205 |
|
6206 |
|
6207 |
|
6208 |
|
6209 |
|
6210 |
|
6211 |
|
6212 |
|
6213 |
|
6214 |
|
6215 | ChangeDetectorRef.prototype.detach = function () { };
|
6216 | |
6217 |
|
6218 |
|
6219 |
|
6220 |
|
6221 |
|
6222 |
|
6223 |
|
6224 |
|
6225 |
|
6226 |
|
6227 |
|
6228 |
|
6229 |
|
6230 |
|
6231 |
|
6232 |
|
6233 |
|
6234 |
|
6235 |
|
6236 |
|
6237 |
|
6238 |
|
6239 |
|
6240 | ChangeDetectorRef.prototype.detectChanges = function () { };
|
6241 | |
6242 |
|
6243 |
|
6244 |
|
6245 |
|
6246 |
|
6247 |
|
6248 |
|
6249 | ChangeDetectorRef.prototype.checkNoChanges = function () { };
|
6250 | |
6251 |
|
6252 |
|
6253 |
|
6254 |
|
6255 |
|
6256 |
|
6257 |
|
6258 |
|
6259 |
|
6260 |
|
6261 |
|
6262 |
|
6263 |
|
6264 |
|
6265 |
|
6266 |
|
6267 |
|
6268 |
|
6269 |
|
6270 |
|
6271 |
|
6272 |
|
6273 |
|
6274 |
|
6275 |
|
6276 |
|
6277 |
|
6278 |
|
6279 |
|
6280 |
|
6281 |
|
6282 |
|
6283 |
|
6284 |
|
6285 |
|
6286 |
|
6287 |
|
6288 |
|
6289 |
|
6290 |
|
6291 |
|
6292 |
|
6293 |
|
6294 |
|
6295 |
|
6296 |
|
6297 |
|
6298 |
|
6299 |
|
6300 |
|
6301 |
|
6302 |
|
6303 |
|
6304 |
|
6305 |
|
6306 | ChangeDetectorRef.prototype.reattach = function () { };
|
6307 | return ChangeDetectorRef;
|
6308 | }());
|
6309 |
|
6310 |
|
6311 |
|
6312 |
|
6313 |
|
6314 |
|
6315 |
|
6316 |
|
6317 |
|
6318 |
|
6319 |
|
6320 | var ViewRef = (function (_super) {
|
6321 | __extends(ViewRef, _super);
|
6322 | function ViewRef() {
|
6323 | return _super !== null && _super.apply(this, arguments) || this;
|
6324 | }
|
6325 | |
6326 |
|
6327 |
|
6328 |
|
6329 |
|
6330 | ViewRef.prototype.destroy = function () { };
|
6331 | |
6332 |
|
6333 |
|
6334 |
|
6335 | ViewRef.prototype.destroyed = function () { };
|
6336 | |
6337 |
|
6338 |
|
6339 |
|
6340 |
|
6341 | ViewRef.prototype.onDestroy = function (callback) { };
|
6342 | return ViewRef;
|
6343 | }(ChangeDetectorRef));
|
6344 |
|
6345 |
|
6346 |
|
6347 |
|
6348 |
|
6349 |
|
6350 |
|
6351 |
|
6352 |
|
6353 |
|
6354 |
|
6355 |
|
6356 |
|
6357 |
|
6358 |
|
6359 |
|
6360 |
|
6361 |
|
6362 |
|
6363 |
|
6364 |
|
6365 |
|
6366 |
|
6367 |
|
6368 |
|
6369 |
|
6370 |
|
6371 |
|
6372 |
|
6373 |
|
6374 |
|
6375 |
|
6376 |
|
6377 |
|
6378 |
|
6379 |
|
6380 |
|
6381 |
|
6382 |
|
6383 |
|
6384 |
|
6385 |
|
6386 |
|
6387 |
|
6388 |
|
6389 |
|
6390 |
|
6391 |
|
6392 |
|
6393 |
|
6394 |
|
6395 |
|
6396 |
|
6397 |
|
6398 |
|
6399 | var EmbeddedViewRef = (function (_super) {
|
6400 | __extends(EmbeddedViewRef, _super);
|
6401 | function EmbeddedViewRef() {
|
6402 | return _super !== null && _super.apply(this, arguments) || this;
|
6403 | }
|
6404 | |
6405 |
|
6406 |
|
6407 |
|
6408 | EmbeddedViewRef.prototype.context = function () { };
|
6409 | |
6410 |
|
6411 |
|
6412 |
|
6413 | EmbeddedViewRef.prototype.rootNodes = function () { };
|
6414 | return EmbeddedViewRef;
|
6415 | }(ViewRef));
|
6416 |
|
6417 |
|
6418 |
|
6419 |
|
6420 |
|
6421 |
|
6422 |
|
6423 |
|
6424 |
|
6425 |
|
6426 |
|
6427 |
|
6428 |
|
6429 |
|
6430 |
|
6431 | var EventListener = (function () {
|
6432 | |
6433 |
|
6434 |
|
6435 |
|
6436 | function EventListener(name, callback) {
|
6437 | this.name = name;
|
6438 | this.callback = callback;
|
6439 | }
|
6440 |
|
6441 | return EventListener;
|
6442 | }());
|
6443 |
|
6444 |
|
6445 |
|
6446 | var DebugNode = (function () {
|
6447 | |
6448 |
|
6449 |
|
6450 |
|
6451 |
|
6452 | function DebugNode(nativeNode, parent, _debugContext) {
|
6453 | this._debugContext = _debugContext;
|
6454 | this.nativeNode = nativeNode;
|
6455 | if (parent && parent instanceof DebugElement) {
|
6456 | parent.addChild(this);
|
6457 | }
|
6458 | else {
|
6459 | this.parent = null;
|
6460 | }
|
6461 | this.listeners = [];
|
6462 | }
|
6463 | Object.defineProperty(DebugNode.prototype, "injector", {
|
6464 | |
6465 |
|
6466 |
|
6467 | get: function () { return this._debugContext.injector; },
|
6468 | enumerable: true,
|
6469 | configurable: true
|
6470 | });
|
6471 | Object.defineProperty(DebugNode.prototype, "componentInstance", {
|
6472 | |
6473 |
|
6474 |
|
6475 | get: function () { return this._debugContext.component; },
|
6476 | enumerable: true,
|
6477 | configurable: true
|
6478 | });
|
6479 | Object.defineProperty(DebugNode.prototype, "context", {
|
6480 | |
6481 |
|
6482 |
|
6483 | get: function () { return this._debugContext.context; },
|
6484 | enumerable: true,
|
6485 | configurable: true
|
6486 | });
|
6487 | Object.defineProperty(DebugNode.prototype, "references", {
|
6488 | |
6489 |
|
6490 |
|
6491 | get: function () { return this._debugContext.references; },
|
6492 | enumerable: true,
|
6493 | configurable: true
|
6494 | });
|
6495 | Object.defineProperty(DebugNode.prototype, "providerTokens", {
|
6496 | |
6497 |
|
6498 |
|
6499 | get: function () { return this._debugContext.providerTokens; },
|
6500 | enumerable: true,
|
6501 | configurable: true
|
6502 | });
|
6503 | Object.defineProperty(DebugNode.prototype, "source", {
|
6504 | |
6505 |
|
6506 |
|
6507 |
|
6508 | get: function () { return 'Deprecated since v4'; },
|
6509 | enumerable: true,
|
6510 | configurable: true
|
6511 | });
|
6512 | return DebugNode;
|
6513 | }());
|
6514 |
|
6515 |
|
6516 |
|
6517 | var DebugElement = (function (_super) {
|
6518 | __extends(DebugElement, _super);
|
6519 | |
6520 |
|
6521 |
|
6522 |
|
6523 |
|
6524 | function DebugElement(nativeNode, parent, _debugContext) {
|
6525 | var _this = _super.call(this, nativeNode, parent, _debugContext) || this;
|
6526 | _this.properties = {};
|
6527 | _this.attributes = {};
|
6528 | _this.classes = {};
|
6529 | _this.styles = {};
|
6530 | _this.childNodes = [];
|
6531 | _this.nativeElement = nativeNode;
|
6532 | return _this;
|
6533 | }
|
6534 | |
6535 |
|
6536 |
|
6537 |
|
6538 | DebugElement.prototype.addChild = function (child) {
|
6539 | if (child) {
|
6540 | this.childNodes.push(child);
|
6541 | child.parent = this;
|
6542 | }
|
6543 | };
|
6544 | |
6545 |
|
6546 |
|
6547 |
|
6548 | DebugElement.prototype.removeChild = function (child) {
|
6549 | var childIndex = this.childNodes.indexOf(child);
|
6550 | if (childIndex !== -1) {
|
6551 | child.parent = null;
|
6552 | this.childNodes.splice(childIndex, 1);
|
6553 | }
|
6554 | };
|
6555 | |
6556 |
|
6557 |
|
6558 |
|
6559 |
|
6560 | DebugElement.prototype.insertChildrenAfter = function (child, newChildren) {
|
6561 | var _this = this;
|
6562 | var siblingIndex = this.childNodes.indexOf(child);
|
6563 | if (siblingIndex !== -1) {
|
6564 | (_a = this.childNodes).splice.apply(_a, [siblingIndex + 1, 0].concat(newChildren));
|
6565 | newChildren.forEach(function (c) {
|
6566 | if (c.parent) {
|
6567 | c.parent.removeChild(c);
|
6568 | }
|
6569 | c.parent = _this;
|
6570 | });
|
6571 | }
|
6572 | var _a;
|
6573 | };
|
6574 | |
6575 |
|
6576 |
|
6577 |
|
6578 |
|
6579 | DebugElement.prototype.insertBefore = function (refChild, newChild) {
|
6580 | var refIndex = this.childNodes.indexOf(refChild);
|
6581 | if (refIndex === -1) {
|
6582 | this.addChild(newChild);
|
6583 | }
|
6584 | else {
|
6585 | if (newChild.parent) {
|
6586 | newChild.parent.removeChild(newChild);
|
6587 | }
|
6588 | newChild.parent = this;
|
6589 | this.childNodes.splice(refIndex, 0, newChild);
|
6590 | }
|
6591 | };
|
6592 | |
6593 |
|
6594 |
|
6595 |
|
6596 | DebugElement.prototype.query = function (predicate) {
|
6597 | var results = this.queryAll(predicate);
|
6598 | return results[0] || null;
|
6599 | };
|
6600 | |
6601 |
|
6602 |
|
6603 |
|
6604 | DebugElement.prototype.queryAll = function (predicate) {
|
6605 | var matches = [];
|
6606 | _queryElementChildren(this, predicate, matches);
|
6607 | return matches;
|
6608 | };
|
6609 | |
6610 |
|
6611 |
|
6612 |
|
6613 | DebugElement.prototype.queryAllNodes = function (predicate) {
|
6614 | var matches = [];
|
6615 | _queryNodeChildren(this, predicate, matches);
|
6616 | return matches;
|
6617 | };
|
6618 | Object.defineProperty(DebugElement.prototype, "children", {
|
6619 | |
6620 |
|
6621 |
|
6622 | get: function () {
|
6623 | return (this.childNodes.filter(function (node) { return node instanceof DebugElement; }));
|
6624 | },
|
6625 | enumerable: true,
|
6626 | configurable: true
|
6627 | });
|
6628 | |
6629 |
|
6630 |
|
6631 |
|
6632 |
|
6633 | DebugElement.prototype.triggerEventHandler = function (eventName, eventObj) {
|
6634 | this.listeners.forEach(function (listener) {
|
6635 | if (listener.name == eventName) {
|
6636 | listener.callback(eventObj);
|
6637 | }
|
6638 | });
|
6639 | };
|
6640 | return DebugElement;
|
6641 | }(DebugNode));
|
6642 |
|
6643 |
|
6644 |
|
6645 |
|
6646 |
|
6647 | function asNativeElements(debugEls) {
|
6648 | return debugEls.map(function (el) { return el.nativeElement; });
|
6649 | }
|
6650 |
|
6651 |
|
6652 |
|
6653 |
|
6654 |
|
6655 |
|
6656 | function _queryElementChildren(element, predicate, matches) {
|
6657 | element.childNodes.forEach(function (node) {
|
6658 | if (node instanceof DebugElement) {
|
6659 | if (predicate(node)) {
|
6660 | matches.push(node);
|
6661 | }
|
6662 | _queryElementChildren(node, predicate, matches);
|
6663 | }
|
6664 | });
|
6665 | }
|
6666 |
|
6667 |
|
6668 |
|
6669 |
|
6670 |
|
6671 |
|
6672 | function _queryNodeChildren(parentNode, predicate, matches) {
|
6673 | if (parentNode instanceof DebugElement) {
|
6674 | parentNode.childNodes.forEach(function (node) {
|
6675 | if (predicate(node)) {
|
6676 | matches.push(node);
|
6677 | }
|
6678 | if (node instanceof DebugElement) {
|
6679 | _queryNodeChildren(node, predicate, matches);
|
6680 | }
|
6681 | });
|
6682 | }
|
6683 | }
|
6684 |
|
6685 | var _nativeNodeToDebugNode = new Map();
|
6686 |
|
6687 |
|
6688 |
|
6689 |
|
6690 |
|
6691 | function getDebugNode(nativeNode) {
|
6692 | return _nativeNodeToDebugNode.get(nativeNode) || null;
|
6693 | }
|
6694 |
|
6695 |
|
6696 |
|
6697 |
|
6698 |
|
6699 |
|
6700 |
|
6701 | function indexDebugNode(node) {
|
6702 | _nativeNodeToDebugNode.set(node.nativeNode, node);
|
6703 | }
|
6704 |
|
6705 |
|
6706 |
|
6707 |
|
6708 | function removeDebugNodeFromIndex(node) {
|
6709 | _nativeNodeToDebugNode.delete(node.nativeNode);
|
6710 | }
|
6711 |
|
6712 |
|
6713 |
|
6714 |
|
6715 |
|
6716 |
|
6717 |
|
6718 |
|
6719 |
|
6720 |
|
6721 |
|
6722 |
|
6723 | function devModeEqual(a, b) {
|
6724 | var isListLikeIterableA = isListLikeIterable(a);
|
6725 | var isListLikeIterableB = isListLikeIterable(b);
|
6726 | if (isListLikeIterableA && isListLikeIterableB) {
|
6727 | return areIterablesEqual(a, b, devModeEqual);
|
6728 | }
|
6729 | else {
|
6730 | var isAObject = a && (typeof a === 'object' || typeof a === 'function');
|
6731 | var isBObject = b && (typeof b === 'object' || typeof b === 'function');
|
6732 | if (!isListLikeIterableA && isAObject && !isListLikeIterableB && isBObject) {
|
6733 | return true;
|
6734 | }
|
6735 | else {
|
6736 | return looseIdentical(a, b);
|
6737 | }
|
6738 | }
|
6739 | }
|
6740 |
|
6741 |
|
6742 |
|
6743 |
|
6744 |
|
6745 |
|
6746 |
|
6747 |
|
6748 |
|
6749 |
|
6750 |
|
6751 |
|
6752 |
|
6753 |
|
6754 |
|
6755 |
|
6756 |
|
6757 |
|
6758 |
|
6759 | var WrappedValue = (function () {
|
6760 | |
6761 |
|
6762 |
|
6763 | function WrappedValue(wrapped) {
|
6764 | this.wrapped = wrapped;
|
6765 | }
|
6766 | |
6767 |
|
6768 |
|
6769 |
|
6770 | WrappedValue.wrap = function (value) { return new WrappedValue(value); };
|
6771 | return WrappedValue;
|
6772 | }());
|
6773 |
|
6774 |
|
6775 |
|
6776 | var ValueUnwrapper = (function () {
|
6777 | function ValueUnwrapper() {
|
6778 | this.hasWrappedValue = false;
|
6779 | }
|
6780 | |
6781 |
|
6782 |
|
6783 |
|
6784 | ValueUnwrapper.prototype.unwrap = function (value) {
|
6785 | if (value instanceof WrappedValue) {
|
6786 | this.hasWrappedValue = true;
|
6787 | return value.wrapped;
|
6788 | }
|
6789 | return value;
|
6790 | };
|
6791 | |
6792 |
|
6793 |
|
6794 | ValueUnwrapper.prototype.reset = function () { this.hasWrappedValue = false; };
|
6795 | return ValueUnwrapper;
|
6796 | }());
|
6797 |
|
6798 |
|
6799 |
|
6800 |
|
6801 | var SimpleChange = (function () {
|
6802 | |
6803 |
|
6804 |
|
6805 |
|
6806 |
|
6807 | function SimpleChange(previousValue, currentValue, firstChange) {
|
6808 | this.previousValue = previousValue;
|
6809 | this.currentValue = currentValue;
|
6810 | this.firstChange = firstChange;
|
6811 | }
|
6812 | |
6813 |
|
6814 |
|
6815 |
|
6816 | SimpleChange.prototype.isFirstChange = function () { return this.firstChange; };
|
6817 | return SimpleChange;
|
6818 | }());
|
6819 |
|
6820 |
|
6821 |
|
6822 |
|
6823 | function isListLikeIterable(obj) {
|
6824 | if (!isJsObject(obj))
|
6825 | return false;
|
6826 | return Array.isArray(obj) ||
|
6827 | (!(obj instanceof Map) &&
|
6828 | getSymbolIterator() in obj);
|
6829 | }
|
6830 |
|
6831 |
|
6832 |
|
6833 |
|
6834 |
|
6835 |
|
6836 | function areIterablesEqual(a, b, comparator) {
|
6837 | var iterator1 = a[getSymbolIterator()]();
|
6838 | var iterator2 = b[getSymbolIterator()]();
|
6839 | while (true) {
|
6840 | var item1 = iterator1.next();
|
6841 | var item2 = iterator2.next();
|
6842 | if (item1.done && item2.done)
|
6843 | return true;
|
6844 | if (item1.done || item2.done)
|
6845 | return false;
|
6846 | if (!comparator(item1.value, item2.value))
|
6847 | return false;
|
6848 | }
|
6849 | }
|
6850 |
|
6851 |
|
6852 |
|
6853 |
|
6854 |
|
6855 | function iterateListLike(obj, fn) {
|
6856 | if (Array.isArray(obj)) {
|
6857 | for (var i = 0; i < obj.length; i++) {
|
6858 | fn(obj[i]);
|
6859 | }
|
6860 | }
|
6861 | else {
|
6862 | var iterator = obj[getSymbolIterator()]();
|
6863 | var item = void 0;
|
6864 | while (!((item = iterator.next()).done)) {
|
6865 | fn(item.value);
|
6866 | }
|
6867 | }
|
6868 | }
|
6869 |
|
6870 |
|
6871 |
|
6872 |
|
6873 | function isJsObject(o) {
|
6874 | return o !== null && (typeof o === 'function' || typeof o === 'object');
|
6875 | }
|
6876 |
|
6877 |
|
6878 |
|
6879 |
|
6880 |
|
6881 |
|
6882 |
|
6883 | var DefaultIterableDifferFactory = (function () {
|
6884 | function DefaultIterableDifferFactory() {
|
6885 | }
|
6886 | |
6887 |
|
6888 |
|
6889 |
|
6890 | DefaultIterableDifferFactory.prototype.supports = function (obj) { return isListLikeIterable(obj); };
|
6891 | |
6892 |
|
6893 |
|
6894 |
|
6895 |
|
6896 |
|
6897 |
|
6898 | DefaultIterableDifferFactory.prototype.create = function (cdRefOrTrackBy, trackByFn) {
|
6899 | return new DefaultIterableDiffer(trackByFn || (cdRefOrTrackBy));
|
6900 | };
|
6901 | return DefaultIterableDifferFactory;
|
6902 | }());
|
6903 | var trackByIdentity = function (index, item) { return item; };
|
6904 |
|
6905 |
|
6906 |
|
6907 | var DefaultIterableDiffer = (function () {
|
6908 | |
6909 |
|
6910 |
|
6911 | function DefaultIterableDiffer(trackByFn) {
|
6912 | this._length = 0;
|
6913 | this._collection = null;
|
6914 | this._linkedRecords = null;
|
6915 | this._unlinkedRecords = null;
|
6916 | this._previousItHead = null;
|
6917 | this._itHead = null;
|
6918 | this._itTail = null;
|
6919 | this._additionsHead = null;
|
6920 | this._additionsTail = null;
|
6921 | this._movesHead = null;
|
6922 | this._movesTail = null;
|
6923 | this._removalsHead = null;
|
6924 | this._removalsTail = null;
|
6925 | this._identityChangesHead = null;
|
6926 | this._identityChangesTail = null;
|
6927 | this._trackByFn = trackByFn || trackByIdentity;
|
6928 | }
|
6929 | Object.defineProperty(DefaultIterableDiffer.prototype, "collection", {
|
6930 | |
6931 |
|
6932 |
|
6933 | get: function () { return this._collection; },
|
6934 | enumerable: true,
|
6935 | configurable: true
|
6936 | });
|
6937 | Object.defineProperty(DefaultIterableDiffer.prototype, "length", {
|
6938 | |
6939 |
|
6940 |
|
6941 | get: function () { return this._length; },
|
6942 | enumerable: true,
|
6943 | configurable: true
|
6944 | });
|
6945 | |
6946 |
|
6947 |
|
6948 |
|
6949 | DefaultIterableDiffer.prototype.forEachItem = function (fn) {
|
6950 | var record;
|
6951 | for (record = this._itHead; record !== null; record = record._next) {
|
6952 | fn(record);
|
6953 | }
|
6954 | };
|
6955 | |
6956 |
|
6957 |
|
6958 |
|
6959 | DefaultIterableDiffer.prototype.forEachOperation = function (fn) {
|
6960 | var nextIt = this._itHead;
|
6961 | var nextRemove = this._removalsHead;
|
6962 | var addRemoveOffset = 0;
|
6963 | var moveOffsets = null;
|
6964 | while (nextIt || nextRemove) {
|
6965 |
|
6966 |
|
6967 | var record = !nextRemove ||
|
6968 | nextIt && ((nextIt.currentIndex)) <
|
6969 | getPreviousIndex(nextRemove, addRemoveOffset, moveOffsets) ? ((nextIt)) :
|
6970 | nextRemove;
|
6971 | var adjPreviousIndex = getPreviousIndex(record, addRemoveOffset, moveOffsets);
|
6972 | var currentIndex = record.currentIndex;
|
6973 |
|
6974 | if (record === nextRemove) {
|
6975 | addRemoveOffset--;
|
6976 | nextRemove = nextRemove._nextRemoved;
|
6977 | }
|
6978 | else {
|
6979 | nextIt = ((nextIt))._next;
|
6980 | if (record.previousIndex == null) {
|
6981 | addRemoveOffset++;
|
6982 | }
|
6983 | else {
|
6984 |
|
6985 | if (!moveOffsets)
|
6986 | moveOffsets = [];
|
6987 | var localMovePreviousIndex = adjPreviousIndex - addRemoveOffset;
|
6988 | var localCurrentIndex = ((currentIndex)) - addRemoveOffset;
|
6989 | if (localMovePreviousIndex != localCurrentIndex) {
|
6990 | for (var i = 0; i < localMovePreviousIndex; i++) {
|
6991 | var offset = i < moveOffsets.length ? moveOffsets[i] : (moveOffsets[i] = 0);
|
6992 | var index = offset + i;
|
6993 | if (localCurrentIndex <= index && index < localMovePreviousIndex) {
|
6994 | moveOffsets[i] = offset + 1;
|
6995 | }
|
6996 | }
|
6997 | var previousIndex = record.previousIndex;
|
6998 | moveOffsets[previousIndex] = localCurrentIndex - localMovePreviousIndex;
|
6999 | }
|
7000 | }
|
7001 | }
|
7002 | if (adjPreviousIndex !== currentIndex) {
|
7003 | fn(record, adjPreviousIndex, currentIndex);
|
7004 | }
|
7005 | }
|
7006 | };
|
7007 | |
7008 |
|
7009 |
|
7010 |
|
7011 | DefaultIterableDiffer.prototype.forEachPreviousItem = function (fn) {
|
7012 | var record;
|
7013 | for (record = this._previousItHead; record !== null; record = record._nextPrevious) {
|
7014 | fn(record);
|
7015 | }
|
7016 | };
|
7017 | |
7018 |
|
7019 |
|
7020 |
|
7021 | DefaultIterableDiffer.prototype.forEachAddedItem = function (fn) {
|
7022 | var record;
|
7023 | for (record = this._additionsHead; record !== null; record = record._nextAdded) {
|
7024 | fn(record);
|
7025 | }
|
7026 | };
|
7027 | |
7028 |
|
7029 |
|
7030 |
|
7031 | DefaultIterableDiffer.prototype.forEachMovedItem = function (fn) {
|
7032 | var record;
|
7033 | for (record = this._movesHead; record !== null; record = record._nextMoved) {
|
7034 | fn(record);
|
7035 | }
|
7036 | };
|
7037 | |
7038 |
|
7039 |
|
7040 |
|
7041 | DefaultIterableDiffer.prototype.forEachRemovedItem = function (fn) {
|
7042 | var record;
|
7043 | for (record = this._removalsHead; record !== null; record = record._nextRemoved) {
|
7044 | fn(record);
|
7045 | }
|
7046 | };
|
7047 | |
7048 |
|
7049 |
|
7050 |
|
7051 | DefaultIterableDiffer.prototype.forEachIdentityChange = function (fn) {
|
7052 | var record;
|
7053 | for (record = this._identityChangesHead; record !== null; record = record._nextIdentityChange) {
|
7054 | fn(record);
|
7055 | }
|
7056 | };
|
7057 | |
7058 |
|
7059 |
|
7060 |
|
7061 | DefaultIterableDiffer.prototype.diff = function (collection) {
|
7062 | if (collection == null)
|
7063 | collection = [];
|
7064 | if (!isListLikeIterable(collection)) {
|
7065 | throw new Error("Error trying to diff '" + stringify(collection) + "'. Only arrays and iterables are allowed");
|
7066 | }
|
7067 | if (this.check(collection)) {
|
7068 | return this;
|
7069 | }
|
7070 | else {
|
7071 | return null;
|
7072 | }
|
7073 | };
|
7074 | |
7075 |
|
7076 |
|
7077 | DefaultIterableDiffer.prototype.onDestroy = function () { };
|
7078 | |
7079 |
|
7080 |
|
7081 |
|
7082 | DefaultIterableDiffer.prototype.check = function (collection) {
|
7083 | var _this = this;
|
7084 | this._reset();
|
7085 | var record = this._itHead;
|
7086 | var mayBeDirty = false;
|
7087 | var index;
|
7088 | var item;
|
7089 | var itemTrackBy;
|
7090 | if (Array.isArray(collection)) {
|
7091 | this._length = collection.length;
|
7092 | for (var index_1 = 0; index_1 < this._length; index_1++) {
|
7093 | item = collection[index_1];
|
7094 | itemTrackBy = this._trackByFn(index_1, item);
|
7095 | if (record === null || !looseIdentical(record.trackById, itemTrackBy)) {
|
7096 | record = this._mismatch(record, item, itemTrackBy, index_1);
|
7097 | mayBeDirty = true;
|
7098 | }
|
7099 | else {
|
7100 | if (mayBeDirty) {
|
7101 |
|
7102 | record = this._verifyReinsertion(record, item, itemTrackBy, index_1);
|
7103 | }
|
7104 | if (!looseIdentical(record.item, item))
|
7105 | this._addIdentityChange(record, item);
|
7106 | }
|
7107 | record = record._next;
|
7108 | }
|
7109 | }
|
7110 | else {
|
7111 | index = 0;
|
7112 | iterateListLike(collection, function (item) {
|
7113 | itemTrackBy = _this._trackByFn(index, item);
|
7114 | if (record === null || !looseIdentical(record.trackById, itemTrackBy)) {
|
7115 | record = _this._mismatch(record, item, itemTrackBy, index);
|
7116 | mayBeDirty = true;
|
7117 | }
|
7118 | else {
|
7119 | if (mayBeDirty) {
|
7120 |
|
7121 | record = _this._verifyReinsertion(record, item, itemTrackBy, index);
|
7122 | }
|
7123 | if (!looseIdentical(record.item, item))
|
7124 | _this._addIdentityChange(record, item);
|
7125 | }
|
7126 | record = record._next;
|
7127 | index++;
|
7128 | });
|
7129 | this._length = index;
|
7130 | }
|
7131 | this._truncate(record);
|
7132 | this._collection = collection;
|
7133 | return this.isDirty;
|
7134 | };
|
7135 | Object.defineProperty(DefaultIterableDiffer.prototype, "isDirty", {
|
7136 | |
7137 |
|
7138 |
|
7139 | get: function () {
|
7140 | return this._additionsHead !== null || this._movesHead !== null ||
|
7141 | this._removalsHead !== null || this._identityChangesHead !== null;
|
7142 | },
|
7143 | enumerable: true,
|
7144 | configurable: true
|
7145 | });
|
7146 | |
7147 |
|
7148 |
|
7149 |
|
7150 |
|
7151 |
|
7152 |
|
7153 |
|
7154 |
|
7155 | DefaultIterableDiffer.prototype._reset = function () {
|
7156 | if (this.isDirty) {
|
7157 | var record = void 0;
|
7158 | var nextRecord = void 0;
|
7159 | for (record = this._previousItHead = this._itHead; record !== null; record = record._next) {
|
7160 | record._nextPrevious = record._next;
|
7161 | }
|
7162 | for (record = this._additionsHead; record !== null; record = record._nextAdded) {
|
7163 | record.previousIndex = record.currentIndex;
|
7164 | }
|
7165 | this._additionsHead = this._additionsTail = null;
|
7166 | for (record = this._movesHead; record !== null; record = nextRecord) {
|
7167 | record.previousIndex = record.currentIndex;
|
7168 | nextRecord = record._nextMoved;
|
7169 | }
|
7170 | this._movesHead = this._movesTail = null;
|
7171 | this._removalsHead = this._removalsTail = null;
|
7172 | this._identityChangesHead = this._identityChangesTail = null;
|
7173 | }
|
7174 | };
|
7175 | |
7176 |
|
7177 |
|
7178 |
|
7179 |
|
7180 |
|
7181 |
|
7182 |
|
7183 |
|
7184 |
|
7185 |
|
7186 |
|
7187 |
|
7188 |
|
7189 |
|
7190 | DefaultIterableDiffer.prototype._mismatch = function (record, item, itemTrackBy, index) {
|
7191 |
|
7192 | var previousRecord;
|
7193 | if (record === null) {
|
7194 | previousRecord = ((this._itTail));
|
7195 | }
|
7196 | else {
|
7197 | previousRecord = ((record._prev));
|
7198 |
|
7199 | this._remove(record);
|
7200 | }
|
7201 |
|
7202 | record = this._linkedRecords === null ? null : this._linkedRecords.get(itemTrackBy, index);
|
7203 | if (record !== null) {
|
7204 |
|
7205 |
|
7206 | if (!looseIdentical(record.item, item))
|
7207 | this._addIdentityChange(record, item);
|
7208 | this._moveAfter(record, previousRecord, index);
|
7209 | }
|
7210 | else {
|
7211 |
|
7212 | record = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(itemTrackBy, null);
|
7213 | if (record !== null) {
|
7214 |
|
7215 |
|
7216 | if (!looseIdentical(record.item, item))
|
7217 | this._addIdentityChange(record, item);
|
7218 | this._reinsertAfter(record, previousRecord, index);
|
7219 | }
|
7220 | else {
|
7221 |
|
7222 | record =
|
7223 | this._addAfter(new IterableChangeRecord_(item, itemTrackBy), previousRecord, index);
|
7224 | }
|
7225 | }
|
7226 | return record;
|
7227 | };
|
7228 | |
7229 |
|
7230 |
|
7231 |
|
7232 |
|
7233 |
|
7234 |
|
7235 |
|
7236 |
|
7237 |
|
7238 |
|
7239 |
|
7240 |
|
7241 |
|
7242 |
|
7243 |
|
7244 |
|
7245 |
|
7246 |
|
7247 |
|
7248 |
|
7249 |
|
7250 |
|
7251 |
|
7252 |
|
7253 |
|
7254 |
|
7255 |
|
7256 |
|
7257 |
|
7258 |
|
7259 |
|
7260 | DefaultIterableDiffer.prototype._verifyReinsertion = function (record, item, itemTrackBy, index) {
|
7261 | var reinsertRecord = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(itemTrackBy, null);
|
7262 | if (reinsertRecord !== null) {
|
7263 | record = this._reinsertAfter(reinsertRecord, ((record._prev)), index);
|
7264 | }
|
7265 | else if (record.currentIndex != index) {
|
7266 | record.currentIndex = index;
|
7267 | this._addToMoves(record, index);
|
7268 | }
|
7269 | return record;
|
7270 | };
|
7271 | |
7272 |
|
7273 |
|
7274 |
|
7275 |
|
7276 |
|
7277 |
|
7278 |
|
7279 |
|
7280 | DefaultIterableDiffer.prototype._truncate = function (record) {
|
7281 |
|
7282 | while (record !== null) {
|
7283 | var nextRecord = record._next;
|
7284 | this._addToRemovals(this._unlink(record));
|
7285 | record = nextRecord;
|
7286 | }
|
7287 | if (this._unlinkedRecords !== null) {
|
7288 | this._unlinkedRecords.clear();
|
7289 | }
|
7290 | if (this._additionsTail !== null) {
|
7291 | this._additionsTail._nextAdded = null;
|
7292 | }
|
7293 | if (this._movesTail !== null) {
|
7294 | this._movesTail._nextMoved = null;
|
7295 | }
|
7296 | if (this._itTail !== null) {
|
7297 | this._itTail._next = null;
|
7298 | }
|
7299 | if (this._removalsTail !== null) {
|
7300 | this._removalsTail._nextRemoved = null;
|
7301 | }
|
7302 | if (this._identityChangesTail !== null) {
|
7303 | this._identityChangesTail._nextIdentityChange = null;
|
7304 | }
|
7305 | };
|
7306 | |
7307 |
|
7308 |
|
7309 |
|
7310 |
|
7311 |
|
7312 |
|
7313 | DefaultIterableDiffer.prototype._reinsertAfter = function (record, prevRecord, index) {
|
7314 | if (this._unlinkedRecords !== null) {
|
7315 | this._unlinkedRecords.remove(record);
|
7316 | }
|
7317 | var prev = record._prevRemoved;
|
7318 | var next = record._nextRemoved;
|
7319 | if (prev === null) {
|
7320 | this._removalsHead = next;
|
7321 | }
|
7322 | else {
|
7323 | prev._nextRemoved = next;
|
7324 | }
|
7325 | if (next === null) {
|
7326 | this._removalsTail = prev;
|
7327 | }
|
7328 | else {
|
7329 | next._prevRemoved = prev;
|
7330 | }
|
7331 | this._insertAfter(record, prevRecord, index);
|
7332 | this._addToMoves(record, index);
|
7333 | return record;
|
7334 | };
|
7335 | |
7336 |
|
7337 |
|
7338 |
|
7339 |
|
7340 |
|
7341 |
|
7342 | DefaultIterableDiffer.prototype._moveAfter = function (record, prevRecord, index) {
|
7343 | this._unlink(record);
|
7344 | this._insertAfter(record, prevRecord, index);
|
7345 | this._addToMoves(record, index);
|
7346 | return record;
|
7347 | };
|
7348 | |
7349 |
|
7350 |
|
7351 |
|
7352 |
|
7353 |
|
7354 |
|
7355 | DefaultIterableDiffer.prototype._addAfter = function (record, prevRecord, index) {
|
7356 | this._insertAfter(record, prevRecord, index);
|
7357 | if (this._additionsTail === null) {
|
7358 |
|
7359 |
|
7360 | this._additionsTail = this._additionsHead = record;
|
7361 | }
|
7362 | else {
|
7363 |
|
7364 |
|
7365 |
|
7366 | this._additionsTail = this._additionsTail._nextAdded = record;
|
7367 | }
|
7368 | return record;
|
7369 | };
|
7370 | |
7371 |
|
7372 |
|
7373 |
|
7374 |
|
7375 |
|
7376 |
|
7377 | DefaultIterableDiffer.prototype._insertAfter = function (record, prevRecord, index) {
|
7378 |
|
7379 |
|
7380 |
|
7381 |
|
7382 | var next = prevRecord === null ? this._itHead : prevRecord._next;
|
7383 |
|
7384 |
|
7385 |
|
7386 | record._next = next;
|
7387 | record._prev = prevRecord;
|
7388 | if (next === null) {
|
7389 | this._itTail = record;
|
7390 | }
|
7391 | else {
|
7392 | next._prev = record;
|
7393 | }
|
7394 | if (prevRecord === null) {
|
7395 | this._itHead = record;
|
7396 | }
|
7397 | else {
|
7398 | prevRecord._next = record;
|
7399 | }
|
7400 | if (this._linkedRecords === null) {
|
7401 | this._linkedRecords = new _DuplicateMap();
|
7402 | }
|
7403 | this._linkedRecords.put(record);
|
7404 | record.currentIndex = index;
|
7405 | return record;
|
7406 | };
|
7407 | |
7408 |
|
7409 |
|
7410 |
|
7411 |
|
7412 | DefaultIterableDiffer.prototype._remove = function (record) {
|
7413 | return this._addToRemovals(this._unlink(record));
|
7414 | };
|
7415 | |
7416 |
|
7417 |
|
7418 |
|
7419 |
|
7420 | DefaultIterableDiffer.prototype._unlink = function (record) {
|
7421 | if (this._linkedRecords !== null) {
|
7422 | this._linkedRecords.remove(record);
|
7423 | }
|
7424 | var prev = record._prev;
|
7425 | var next = record._next;
|
7426 |
|
7427 |
|
7428 |
|
7429 | if (prev === null) {
|
7430 | this._itHead = next;
|
7431 | }
|
7432 | else {
|
7433 | prev._next = next;
|
7434 | }
|
7435 | if (next === null) {
|
7436 | this._itTail = prev;
|
7437 | }
|
7438 | else {
|
7439 | next._prev = prev;
|
7440 | }
|
7441 | return record;
|
7442 | };
|
7443 | |
7444 |
|
7445 |
|
7446 |
|
7447 |
|
7448 |
|
7449 | DefaultIterableDiffer.prototype._addToMoves = function (record, toIndex) {
|
7450 |
|
7451 |
|
7452 | if (record.previousIndex === toIndex) {
|
7453 | return record;
|
7454 | }
|
7455 | if (this._movesTail === null) {
|
7456 |
|
7457 |
|
7458 | this._movesTail = this._movesHead = record;
|
7459 | }
|
7460 | else {
|
7461 |
|
7462 |
|
7463 | this._movesTail = this._movesTail._nextMoved = record;
|
7464 | }
|
7465 | return record;
|
7466 | };
|
7467 | |
7468 |
|
7469 |
|
7470 |
|
7471 | DefaultIterableDiffer.prototype._addToRemovals = function (record) {
|
7472 | if (this._unlinkedRecords === null) {
|
7473 | this._unlinkedRecords = new _DuplicateMap();
|
7474 | }
|
7475 | this._unlinkedRecords.put(record);
|
7476 | record.currentIndex = null;
|
7477 | record._nextRemoved = null;
|
7478 | if (this._removalsTail === null) {
|
7479 |
|
7480 |
|
7481 | this._removalsTail = this._removalsHead = record;
|
7482 | record._prevRemoved = null;
|
7483 | }
|
7484 | else {
|
7485 |
|
7486 |
|
7487 |
|
7488 | record._prevRemoved = this._removalsTail;
|
7489 | this._removalsTail = this._removalsTail._nextRemoved = record;
|
7490 | }
|
7491 | return record;
|
7492 | };
|
7493 | |
7494 |
|
7495 |
|
7496 |
|
7497 |
|
7498 |
|
7499 | DefaultIterableDiffer.prototype._addIdentityChange = function (record, item) {
|
7500 | record.item = item;
|
7501 | if (this._identityChangesTail === null) {
|
7502 | this._identityChangesTail = this._identityChangesHead = record;
|
7503 | }
|
7504 | else {
|
7505 | this._identityChangesTail = this._identityChangesTail._nextIdentityChange = record;
|
7506 | }
|
7507 | return record;
|
7508 | };
|
7509 | |
7510 |
|
7511 |
|
7512 | DefaultIterableDiffer.prototype.toString = function () {
|
7513 | var list = [];
|
7514 | this.forEachItem(function (record) { return list.push(record); });
|
7515 | var previous = [];
|
7516 | this.forEachPreviousItem(function (record) { return previous.push(record); });
|
7517 | var additions = [];
|
7518 | this.forEachAddedItem(function (record) { return additions.push(record); });
|
7519 | var moves = [];
|
7520 | this.forEachMovedItem(function (record) { return moves.push(record); });
|
7521 | var removals = [];
|
7522 | this.forEachRemovedItem(function (record) { return removals.push(record); });
|
7523 | var identityChanges = [];
|
7524 | this.forEachIdentityChange(function (record) { return identityChanges.push(record); });
|
7525 | return 'collection: ' + list.join(', ') + '\n' +
|
7526 | 'previous: ' + previous.join(', ') + '\n' +
|
7527 | 'additions: ' + additions.join(', ') + '\n' +
|
7528 | 'moves: ' + moves.join(', ') + '\n' +
|
7529 | 'removals: ' + removals.join(', ') + '\n' +
|
7530 | 'identityChanges: ' + identityChanges.join(', ') + '\n';
|
7531 | };
|
7532 | return DefaultIterableDiffer;
|
7533 | }());
|
7534 |
|
7535 |
|
7536 |
|
7537 | var IterableChangeRecord_ = (function () {
|
7538 | |
7539 |
|
7540 |
|
7541 |
|
7542 | function IterableChangeRecord_(item, trackById) {
|
7543 | this.item = item;
|
7544 | this.trackById = trackById;
|
7545 | this.currentIndex = null;
|
7546 | this.previousIndex = null;
|
7547 | |
7548 |
|
7549 |
|
7550 | this._nextPrevious = null;
|
7551 | |
7552 |
|
7553 |
|
7554 | this._prev = null;
|
7555 | |
7556 |
|
7557 |
|
7558 | this._next = null;
|
7559 | |
7560 |
|
7561 |
|
7562 | this._prevDup = null;
|
7563 | |
7564 |
|
7565 |
|
7566 | this._nextDup = null;
|
7567 | |
7568 |
|
7569 |
|
7570 | this._prevRemoved = null;
|
7571 | |
7572 |
|
7573 |
|
7574 | this._nextRemoved = null;
|
7575 | |
7576 |
|
7577 |
|
7578 | this._nextAdded = null;
|
7579 | |
7580 |
|
7581 |
|
7582 | this._nextMoved = null;
|
7583 | |
7584 |
|
7585 |
|
7586 | this._nextIdentityChange = null;
|
7587 | }
|
7588 | |
7589 |
|
7590 |
|
7591 | IterableChangeRecord_.prototype.toString = function () {
|
7592 | return this.previousIndex === this.currentIndex ? stringify(this.item) :
|
7593 | stringify(this.item) + '[' +
|
7594 | stringify(this.previousIndex) + '->' + stringify(this.currentIndex) + ']';
|
7595 | };
|
7596 | return IterableChangeRecord_;
|
7597 | }());
|
7598 | var _DuplicateItemRecordList = (function () {
|
7599 | function _DuplicateItemRecordList() {
|
7600 | |
7601 |
|
7602 |
|
7603 | this._head = null;
|
7604 | |
7605 |
|
7606 |
|
7607 | this._tail = null;
|
7608 | }
|
7609 | |
7610 |
|
7611 |
|
7612 |
|
7613 |
|
7614 |
|
7615 |
|
7616 | _DuplicateItemRecordList.prototype.add = function (record) {
|
7617 | if (this._head === null) {
|
7618 | this._head = this._tail = record;
|
7619 | record._nextDup = null;
|
7620 | record._prevDup = null;
|
7621 | }
|
7622 | else {
|
7623 | ((
|
7624 |
|
7625 |
|
7626 |
|
7627 | this._tail))._nextDup = record;
|
7628 | record._prevDup = this._tail;
|
7629 | record._nextDup = null;
|
7630 | this._tail = record;
|
7631 | }
|
7632 | };
|
7633 | |
7634 |
|
7635 |
|
7636 |
|
7637 |
|
7638 | _DuplicateItemRecordList.prototype.get = function (trackById, afterIndex) {
|
7639 | var record;
|
7640 | for (record = this._head; record !== null; record = record._nextDup) {
|
7641 | if ((afterIndex === null || afterIndex < record.currentIndex) &&
|
7642 | looseIdentical(record.trackById, trackById)) {
|
7643 | return record;
|
7644 | }
|
7645 | }
|
7646 | return null;
|
7647 | };
|
7648 | |
7649 |
|
7650 |
|
7651 |
|
7652 |
|
7653 |
|
7654 |
|
7655 | _DuplicateItemRecordList.prototype.remove = function (record) {
|
7656 |
|
7657 |
|
7658 |
|
7659 |
|
7660 |
|
7661 |
|
7662 |
|
7663 |
|
7664 | var prev = record._prevDup;
|
7665 | var next = record._nextDup;
|
7666 | if (prev === null) {
|
7667 | this._head = next;
|
7668 | }
|
7669 | else {
|
7670 | prev._nextDup = next;
|
7671 | }
|
7672 | if (next === null) {
|
7673 | this._tail = prev;
|
7674 | }
|
7675 | else {
|
7676 | next._prevDup = prev;
|
7677 | }
|
7678 | return this._head === null;
|
7679 | };
|
7680 | return _DuplicateItemRecordList;
|
7681 | }());
|
7682 | var _DuplicateMap = (function () {
|
7683 | function _DuplicateMap() {
|
7684 | this.map = new Map();
|
7685 | }
|
7686 | |
7687 |
|
7688 |
|
7689 |
|
7690 | _DuplicateMap.prototype.put = function (record) {
|
7691 | var key = record.trackById;
|
7692 | var duplicates = this.map.get(key);
|
7693 | if (!duplicates) {
|
7694 | duplicates = new _DuplicateItemRecordList();
|
7695 | this.map.set(key, duplicates);
|
7696 | }
|
7697 | duplicates.add(record);
|
7698 | };
|
7699 | |
7700 |
|
7701 |
|
7702 |
|
7703 |
|
7704 |
|
7705 |
|
7706 |
|
7707 |
|
7708 |
|
7709 | _DuplicateMap.prototype.get = function (trackById, afterIndex) {
|
7710 | var key = trackById;
|
7711 | var recordList = this.map.get(key);
|
7712 | return recordList ? recordList.get(trackById, afterIndex) : null;
|
7713 | };
|
7714 | |
7715 |
|
7716 |
|
7717 |
|
7718 |
|
7719 |
|
7720 |
|
7721 | _DuplicateMap.prototype.remove = function (record) {
|
7722 | var key = record.trackById;
|
7723 | var recordList = ((this.map.get(key)));
|
7724 |
|
7725 | if (recordList.remove(record)) {
|
7726 | this.map.delete(key);
|
7727 | }
|
7728 | return record;
|
7729 | };
|
7730 | Object.defineProperty(_DuplicateMap.prototype, "isEmpty", {
|
7731 | |
7732 |
|
7733 |
|
7734 | get: function () { return this.map.size === 0; },
|
7735 | enumerable: true,
|
7736 | configurable: true
|
7737 | });
|
7738 | |
7739 |
|
7740 |
|
7741 | _DuplicateMap.prototype.clear = function () { this.map.clear(); };
|
7742 | |
7743 |
|
7744 |
|
7745 | _DuplicateMap.prototype.toString = function () { return '_DuplicateMap(' + stringify(this.map) + ')'; };
|
7746 | return _DuplicateMap;
|
7747 | }());
|
7748 |
|
7749 |
|
7750 |
|
7751 |
|
7752 |
|
7753 |
|
7754 | function getPreviousIndex(item, addRemoveOffset, moveOffsets) {
|
7755 | var previousIndex = item.previousIndex;
|
7756 | if (previousIndex === null)
|
7757 | return previousIndex;
|
7758 | var moveOffset = 0;
|
7759 | if (moveOffsets && previousIndex < moveOffsets.length) {
|
7760 | moveOffset = moveOffsets[previousIndex];
|
7761 | }
|
7762 | return previousIndex + addRemoveOffset + moveOffset;
|
7763 | }
|
7764 |
|
7765 |
|
7766 |
|
7767 |
|
7768 |
|
7769 |
|
7770 |
|
7771 | var DefaultKeyValueDifferFactory = (function () {
|
7772 | function DefaultKeyValueDifferFactory() {
|
7773 | }
|
7774 | |
7775 |
|
7776 |
|
7777 |
|
7778 | DefaultKeyValueDifferFactory.prototype.supports = function (obj) { return obj instanceof Map || isJsObject(obj); };
|
7779 | |
7780 |
|
7781 |
|
7782 |
|
7783 |
|
7784 |
|
7785 | DefaultKeyValueDifferFactory.prototype.create = function (cd) {
|
7786 | return new DefaultKeyValueDiffer();
|
7787 | };
|
7788 | return DefaultKeyValueDifferFactory;
|
7789 | }());
|
7790 | var DefaultKeyValueDiffer = (function () {
|
7791 | function DefaultKeyValueDiffer() {
|
7792 | this._records = new Map();
|
7793 | this._mapHead = null;
|
7794 | this._appendAfter = null;
|
7795 | this._previousMapHead = null;
|
7796 | this._changesHead = null;
|
7797 | this._changesTail = null;
|
7798 | this._additionsHead = null;
|
7799 | this._additionsTail = null;
|
7800 | this._removalsHead = null;
|
7801 | this._removalsTail = null;
|
7802 | }
|
7803 | Object.defineProperty(DefaultKeyValueDiffer.prototype, "isDirty", {
|
7804 | |
7805 |
|
7806 |
|
7807 | get: function () {
|
7808 | return this._additionsHead !== null || this._changesHead !== null ||
|
7809 | this._removalsHead !== null;
|
7810 | },
|
7811 | enumerable: true,
|
7812 | configurable: true
|
7813 | });
|
7814 | |
7815 |
|
7816 |
|
7817 |
|
7818 | DefaultKeyValueDiffer.prototype.forEachItem = function (fn) {
|
7819 | var record;
|
7820 | for (record = this._mapHead; record !== null; record = record._next) {
|
7821 | fn(record);
|
7822 | }
|
7823 | };
|
7824 | |
7825 |
|
7826 |
|
7827 |
|
7828 | DefaultKeyValueDiffer.prototype.forEachPreviousItem = function (fn) {
|
7829 | var record;
|
7830 | for (record = this._previousMapHead; record !== null; record = record._nextPrevious) {
|
7831 | fn(record);
|
7832 | }
|
7833 | };
|
7834 | |
7835 |
|
7836 |
|
7837 |
|
7838 | DefaultKeyValueDiffer.prototype.forEachChangedItem = function (fn) {
|
7839 | var record;
|
7840 | for (record = this._changesHead; record !== null; record = record._nextChanged) {
|
7841 | fn(record);
|
7842 | }
|
7843 | };
|
7844 | |
7845 |
|
7846 |
|
7847 |
|
7848 | DefaultKeyValueDiffer.prototype.forEachAddedItem = function (fn) {
|
7849 | var record;
|
7850 | for (record = this._additionsHead; record !== null; record = record._nextAdded) {
|
7851 | fn(record);
|
7852 | }
|
7853 | };
|
7854 | |
7855 |
|
7856 |
|
7857 |
|
7858 | DefaultKeyValueDiffer.prototype.forEachRemovedItem = function (fn) {
|
7859 | var record;
|
7860 | for (record = this._removalsHead; record !== null; record = record._nextRemoved) {
|
7861 | fn(record);
|
7862 | }
|
7863 | };
|
7864 | |
7865 |
|
7866 |
|
7867 |
|
7868 | DefaultKeyValueDiffer.prototype.diff = function (map) {
|
7869 | if (!map) {
|
7870 | map = new Map();
|
7871 | }
|
7872 | else if (!(map instanceof Map || isJsObject(map))) {
|
7873 | throw new Error("Error trying to diff '" + stringify(map) + "'. Only maps and objects are allowed");
|
7874 | }
|
7875 | return this.check(map) ? this : null;
|
7876 | };
|
7877 | |
7878 |
|
7879 |
|
7880 | DefaultKeyValueDiffer.prototype.onDestroy = function () { };
|
7881 | |
7882 |
|
7883 |
|
7884 |
|
7885 |
|
7886 |
|
7887 | DefaultKeyValueDiffer.prototype.check = function (map) {
|
7888 | var _this = this;
|
7889 | this._reset();
|
7890 | var insertBefore = this._mapHead;
|
7891 | this._appendAfter = null;
|
7892 | this._forEach(map, function (value, key) {
|
7893 | if (insertBefore && insertBefore.key === key) {
|
7894 | _this._maybeAddToChanges(insertBefore, value);
|
7895 | _this._appendAfter = insertBefore;
|
7896 | insertBefore = insertBefore._next;
|
7897 | }
|
7898 | else {
|
7899 | var record = _this._getOrCreateRecordForKey(key, value);
|
7900 | insertBefore = _this._insertBeforeOrAppend(insertBefore, record);
|
7901 | }
|
7902 | });
|
7903 |
|
7904 | if (insertBefore) {
|
7905 | if (insertBefore._prev) {
|
7906 | insertBefore._prev._next = null;
|
7907 | }
|
7908 | this._removalsHead = insertBefore;
|
7909 | for (var record = insertBefore; record !== null; record = record._nextRemoved) {
|
7910 | if (record === this._mapHead) {
|
7911 | this._mapHead = null;
|
7912 | }
|
7913 | this._records.delete(record.key);
|
7914 | record._nextRemoved = record._next;
|
7915 | record.previousValue = record.currentValue;
|
7916 | record.currentValue = null;
|
7917 | record._prev = null;
|
7918 | record._next = null;
|
7919 | }
|
7920 | }
|
7921 |
|
7922 | if (this._changesTail)
|
7923 | this._changesTail._nextChanged = null;
|
7924 | if (this._additionsTail)
|
7925 | this._additionsTail._nextAdded = null;
|
7926 | return this.isDirty;
|
7927 | };
|
7928 | |
7929 |
|
7930 |
|
7931 |
|
7932 |
|
7933 |
|
7934 |
|
7935 |
|
7936 |
|
7937 |
|
7938 |
|
7939 | DefaultKeyValueDiffer.prototype._insertBeforeOrAppend = function (before, record) {
|
7940 | if (before) {
|
7941 | var prev = before._prev;
|
7942 | record._next = before;
|
7943 | record._prev = prev;
|
7944 | before._prev = record;
|
7945 | if (prev) {
|
7946 | prev._next = record;
|
7947 | }
|
7948 | if (before === this._mapHead) {
|
7949 | this._mapHead = record;
|
7950 | }
|
7951 | this._appendAfter = before;
|
7952 | return before;
|
7953 | }
|
7954 | if (this._appendAfter) {
|
7955 | this._appendAfter._next = record;
|
7956 | record._prev = this._appendAfter;
|
7957 | }
|
7958 | else {
|
7959 | this._mapHead = record;
|
7960 | }
|
7961 | this._appendAfter = record;
|
7962 | return null;
|
7963 | };
|
7964 | |
7965 |
|
7966 |
|
7967 |
|
7968 |
|
7969 | DefaultKeyValueDiffer.prototype._getOrCreateRecordForKey = function (key, value) {
|
7970 | if (this._records.has(key)) {
|
7971 | var record_1 = ((this._records.get(key)));
|
7972 | this._maybeAddToChanges(record_1, value);
|
7973 | var prev = record_1._prev;
|
7974 | var next = record_1._next;
|
7975 | if (prev) {
|
7976 | prev._next = next;
|
7977 | }
|
7978 | if (next) {
|
7979 | next._prev = prev;
|
7980 | }
|
7981 | record_1._next = null;
|
7982 | record_1._prev = null;
|
7983 | return record_1;
|
7984 | }
|
7985 | var record = new KeyValueChangeRecord_(key);
|
7986 | this._records.set(key, record);
|
7987 | record.currentValue = value;
|
7988 | this._addToAdditions(record);
|
7989 | return record;
|
7990 | };
|
7991 | |
7992 |
|
7993 |
|
7994 |
|
7995 | DefaultKeyValueDiffer.prototype._reset = function () {
|
7996 | if (this.isDirty) {
|
7997 | var record = void 0;
|
7998 |
|
7999 | this._previousMapHead = this._mapHead;
|
8000 | for (record = this._previousMapHead; record !== null; record = record._next) {
|
8001 | record._nextPrevious = record._next;
|
8002 | }
|
8003 |
|
8004 |
|
8005 | for (record = this._changesHead; record !== null; record = record._nextChanged) {
|
8006 | record.previousValue = record.currentValue;
|
8007 | }
|
8008 | for (record = this._additionsHead; record != null; record = record._nextAdded) {
|
8009 | record.previousValue = record.currentValue;
|
8010 | }
|
8011 | this._changesHead = this._changesTail = null;
|
8012 | this._additionsHead = this._additionsTail = null;
|
8013 | this._removalsHead = null;
|
8014 | }
|
8015 | };
|
8016 | |
8017 |
|
8018 |
|
8019 |
|
8020 |
|
8021 | DefaultKeyValueDiffer.prototype._maybeAddToChanges = function (record, newValue) {
|
8022 | if (!looseIdentical(newValue, record.currentValue)) {
|
8023 | record.previousValue = record.currentValue;
|
8024 | record.currentValue = newValue;
|
8025 | this._addToChanges(record);
|
8026 | }
|
8027 | };
|
8028 | |
8029 |
|
8030 |
|
8031 |
|
8032 | DefaultKeyValueDiffer.prototype._addToAdditions = function (record) {
|
8033 | if (this._additionsHead === null) {
|
8034 | this._additionsHead = this._additionsTail = record;
|
8035 | }
|
8036 | else {
|
8037 | ((this._additionsTail))._nextAdded = record;
|
8038 | this._additionsTail = record;
|
8039 | }
|
8040 | };
|
8041 | |
8042 |
|
8043 |
|
8044 |
|
8045 | DefaultKeyValueDiffer.prototype._addToChanges = function (record) {
|
8046 | if (this._changesHead === null) {
|
8047 | this._changesHead = this._changesTail = record;
|
8048 | }
|
8049 | else {
|
8050 | ((this._changesTail))._nextChanged = record;
|
8051 | this._changesTail = record;
|
8052 | }
|
8053 | };
|
8054 | |
8055 |
|
8056 |
|
8057 | DefaultKeyValueDiffer.prototype.toString = function () {
|
8058 | var items = [];
|
8059 | var previous = [];
|
8060 | var changes = [];
|
8061 | var additions = [];
|
8062 | var removals = [];
|
8063 | this.forEachItem(function (r) { return items.push(stringify(r)); });
|
8064 | this.forEachPreviousItem(function (r) { return previous.push(stringify(r)); });
|
8065 | this.forEachChangedItem(function (r) { return changes.push(stringify(r)); });
|
8066 | this.forEachAddedItem(function (r) { return additions.push(stringify(r)); });
|
8067 | this.forEachRemovedItem(function (r) { return removals.push(stringify(r)); });
|
8068 | return 'map: ' + items.join(', ') + '\n' +
|
8069 | 'previous: ' + previous.join(', ') + '\n' +
|
8070 | 'additions: ' + additions.join(', ') + '\n' +
|
8071 | 'changes: ' + changes.join(', ') + '\n' +
|
8072 | 'removals: ' + removals.join(', ') + '\n';
|
8073 | };
|
8074 | |
8075 |
|
8076 |
|
8077 |
|
8078 |
|
8079 |
|
8080 |
|
8081 | DefaultKeyValueDiffer.prototype._forEach = function (obj, fn) {
|
8082 | if (obj instanceof Map) {
|
8083 | obj.forEach(fn);
|
8084 | }
|
8085 | else {
|
8086 | Object.keys(obj).forEach(function (k) { return fn(obj[k], k); });
|
8087 | }
|
8088 | };
|
8089 | return DefaultKeyValueDiffer;
|
8090 | }());
|
8091 |
|
8092 |
|
8093 |
|
8094 | var KeyValueChangeRecord_ = (function () {
|
8095 | |
8096 |
|
8097 |
|
8098 | function KeyValueChangeRecord_(key) {
|
8099 | this.key = key;
|
8100 | this.previousValue = null;
|
8101 | this.currentValue = null;
|
8102 | |
8103 |
|
8104 |
|
8105 | this._nextPrevious = null;
|
8106 | |
8107 |
|
8108 |
|
8109 | this._next = null;
|
8110 | |
8111 |
|
8112 |
|
8113 | this._prev = null;
|
8114 | |
8115 |
|
8116 |
|
8117 | this._nextAdded = null;
|
8118 | |
8119 |
|
8120 |
|
8121 | this._nextRemoved = null;
|
8122 | |
8123 |
|
8124 |
|
8125 | this._nextChanged = null;
|
8126 | }
|
8127 | |
8128 |
|
8129 |
|
8130 | KeyValueChangeRecord_.prototype.toString = function () {
|
8131 | return looseIdentical(this.previousValue, this.currentValue) ?
|
8132 | stringify(this.key) :
|
8133 | (stringify(this.key) + '[' + stringify(this.previousValue) + '->' +
|
8134 | stringify(this.currentValue) + ']');
|
8135 | };
|
8136 | return KeyValueChangeRecord_;
|
8137 | }());
|
8138 |
|
8139 |
|
8140 |
|
8141 |
|
8142 |
|
8143 |
|
8144 |
|
8145 |
|
8146 |
|
8147 |
|
8148 |
|
8149 | var IterableDiffers = (function () {
|
8150 | |
8151 |
|
8152 |
|
8153 | function IterableDiffers(factories) {
|
8154 | this.factories = factories;
|
8155 | }
|
8156 | |
8157 |
|
8158 |
|
8159 |
|
8160 |
|
8161 | IterableDiffers.create = function (factories, parent) {
|
8162 | if (parent != null) {
|
8163 | var copied = parent.factories.slice();
|
8164 | factories = factories.concat(copied);
|
8165 | return new IterableDiffers(factories);
|
8166 | }
|
8167 | else {
|
8168 | return new IterableDiffers(factories);
|
8169 | }
|
8170 | };
|
8171 | |
8172 |
|
8173 |
|
8174 |
|
8175 |
|
8176 |
|
8177 |
|
8178 |
|
8179 |
|
8180 |
|
8181 |
|
8182 |
|
8183 |
|
8184 |
|
8185 |
|
8186 |
|
8187 |
|
8188 |
|
8189 |
|
8190 |
|
8191 |
|
8192 | IterableDiffers.extend = function (factories) {
|
8193 | return {
|
8194 | provide: IterableDiffers,
|
8195 | useFactory: function (parent) {
|
8196 | if (!parent) {
|
8197 |
|
8198 |
|
8199 |
|
8200 | throw new Error('Cannot extend IterableDiffers without a parent injector');
|
8201 | }
|
8202 | return IterableDiffers.create(factories, parent);
|
8203 | },
|
8204 |
|
8205 | deps: [[IterableDiffers, new SkipSelf(), new Optional()]]
|
8206 | };
|
8207 | };
|
8208 | |
8209 |
|
8210 |
|
8211 |
|
8212 | IterableDiffers.prototype.find = function (iterable) {
|
8213 | var factory = this.factories.find(function (f) { return f.supports(iterable); });
|
8214 | if (factory != null) {
|
8215 | return factory;
|
8216 | }
|
8217 | else {
|
8218 | throw new Error("Cannot find a differ supporting object '" + iterable + "' of type '" + getTypeNameForDebugging(iterable) + "'");
|
8219 | }
|
8220 | };
|
8221 | return IterableDiffers;
|
8222 | }());
|
8223 |
|
8224 |
|
8225 |
|
8226 |
|
8227 | function getTypeNameForDebugging(type) {
|
8228 | return type['name'] || typeof type;
|
8229 | }
|
8230 |
|
8231 |
|
8232 |
|
8233 |
|
8234 |
|
8235 |
|
8236 |
|
8237 |
|
8238 |
|
8239 |
|
8240 |
|
8241 | var KeyValueDiffers = (function () {
|
8242 | |
8243 |
|
8244 |
|
8245 | function KeyValueDiffers(factories) {
|
8246 | this.factories = factories;
|
8247 | }
|
8248 | |
8249 |
|
8250 |
|
8251 |
|
8252 |
|
8253 |
|
8254 | KeyValueDiffers.create = function (factories, parent) {
|
8255 | if (parent) {
|
8256 | var copied = parent.factories.slice();
|
8257 | factories = factories.concat(copied);
|
8258 | }
|
8259 | return new KeyValueDiffers(factories);
|
8260 | };
|
8261 | |
8262 |
|
8263 |
|
8264 |
|
8265 |
|
8266 |
|
8267 |
|
8268 |
|
8269 |
|
8270 |
|
8271 |
|
8272 |
|
8273 |
|
8274 |
|
8275 |
|
8276 |
|
8277 |
|
8278 |
|
8279 |
|
8280 |
|
8281 |
|
8282 |
|
8283 | KeyValueDiffers.extend = function (factories) {
|
8284 | return {
|
8285 | provide: KeyValueDiffers,
|
8286 | useFactory: function (parent) {
|
8287 | if (!parent) {
|
8288 |
|
8289 |
|
8290 | throw new Error('Cannot extend KeyValueDiffers without a parent injector');
|
8291 | }
|
8292 | return KeyValueDiffers.create(factories, parent);
|
8293 | },
|
8294 |
|
8295 | deps: [[KeyValueDiffers, new SkipSelf(), new Optional()]]
|
8296 | };
|
8297 | };
|
8298 | |
8299 |
|
8300 |
|
8301 |
|
8302 | KeyValueDiffers.prototype.find = function (kv) {
|
8303 | var factory = this.factories.find(function (f) { return f.supports(kv); });
|
8304 | if (factory) {
|
8305 | return factory;
|
8306 | }
|
8307 | throw new Error("Cannot find a differ supporting object '" + kv + "'");
|
8308 | };
|
8309 | return KeyValueDiffers;
|
8310 | }());
|
8311 |
|
8312 |
|
8313 |
|
8314 |
|
8315 |
|
8316 |
|
8317 |
|
8318 |
|
8319 |
|
8320 |
|
8321 | var keyValDiff = [new DefaultKeyValueDifferFactory()];
|
8322 |
|
8323 |
|
8324 |
|
8325 | var iterableDiff = [new DefaultIterableDifferFactory()];
|
8326 | var defaultIterableDiffers = new IterableDiffers(iterableDiff);
|
8327 | var defaultKeyValueDiffers = new KeyValueDiffers(keyValDiff);
|
8328 |
|
8329 |
|
8330 |
|
8331 |
|
8332 |
|
8333 |
|
8334 |
|
8335 |
|
8336 |
|
8337 |
|
8338 |
|
8339 |
|
8340 |
|
8341 |
|
8342 |
|
8343 |
|
8344 |
|
8345 |
|
8346 |
|
8347 |
|
8348 |
|
8349 |
|
8350 | function _reflector() {
|
8351 | return reflector;
|
8352 | }
|
8353 | var _CORE_PLATFORM_PROVIDERS = [
|
8354 |
|
8355 | { provide: PLATFORM_ID, useValue: 'unknown' },
|
8356 | PlatformRef_,
|
8357 | { provide: PlatformRef, useExisting: PlatformRef_ },
|
8358 | { provide: Reflector, useFactory: _reflector, deps: [] },
|
8359 | { provide: ReflectorReader, useExisting: Reflector },
|
8360 | TestabilityRegistry,
|
8361 | Console,
|
8362 | ];
|
8363 |
|
8364 |
|
8365 |
|
8366 |
|
8367 |
|
8368 | var platformCore = createPlatformFactory(null, 'core', _CORE_PLATFORM_PROVIDERS);
|
8369 |
|
8370 |
|
8371 |
|
8372 |
|
8373 |
|
8374 |
|
8375 |
|
8376 |
|
8377 |
|
8378 |
|
8379 | var LOCALE_ID = new InjectionToken('LocaleId');
|
8380 |
|
8381 |
|
8382 |
|
8383 | var TRANSLATIONS = new InjectionToken('Translations');
|
8384 |
|
8385 |
|
8386 |
|
8387 | var TRANSLATIONS_FORMAT = new InjectionToken('TranslationsFormat');
|
8388 | var MissingTranslationStrategy = {};
|
8389 | MissingTranslationStrategy.Error = 0;
|
8390 | MissingTranslationStrategy.Warning = 1;
|
8391 | MissingTranslationStrategy.Ignore = 2;
|
8392 | MissingTranslationStrategy[MissingTranslationStrategy.Error] = "Error";
|
8393 | MissingTranslationStrategy[MissingTranslationStrategy.Warning] = "Warning";
|
8394 | MissingTranslationStrategy[MissingTranslationStrategy.Ignore] = "Ignore";
|
8395 | var SecurityContext = {};
|
8396 | SecurityContext.NONE = 0;
|
8397 | SecurityContext.HTML = 1;
|
8398 | SecurityContext.STYLE = 2;
|
8399 | SecurityContext.SCRIPT = 3;
|
8400 | SecurityContext.URL = 4;
|
8401 | SecurityContext.RESOURCE_URL = 5;
|
8402 | SecurityContext[SecurityContext.NONE] = "NONE";
|
8403 | SecurityContext[SecurityContext.HTML] = "HTML";
|
8404 | SecurityContext[SecurityContext.STYLE] = "STYLE";
|
8405 | SecurityContext[SecurityContext.SCRIPT] = "SCRIPT";
|
8406 | SecurityContext[SecurityContext.URL] = "URL";
|
8407 | SecurityContext[SecurityContext.RESOURCE_URL] = "RESOURCE_URL";
|
8408 |
|
8409 |
|
8410 |
|
8411 |
|
8412 |
|
8413 |
|
8414 | var Sanitizer = (function () {
|
8415 | function Sanitizer() {
|
8416 | }
|
8417 | |
8418 |
|
8419 |
|
8420 |
|
8421 |
|
8422 |
|
8423 | Sanitizer.prototype.sanitize = function (context, value) { };
|
8424 | return Sanitizer;
|
8425 | }());
|
8426 |
|
8427 |
|
8428 |
|
8429 |
|
8430 |
|
8431 |
|
8432 |
|
8433 |
|
8434 |
|
8435 |
|
8436 |
|
8437 |
|
8438 |
|
8439 |
|
8440 |
|
8441 |
|
8442 |
|
8443 |
|
8444 |
|
8445 |
|
8446 |
|
8447 |
|
8448 |
|
8449 |
|
8450 | function asTextData(view, index) {
|
8451 | return (view.nodes[index]);
|
8452 | }
|
8453 |
|
8454 |
|
8455 |
|
8456 |
|
8457 |
|
8458 |
|
8459 | function asElementData(view, index) {
|
8460 | return (view.nodes[index]);
|
8461 | }
|
8462 |
|
8463 |
|
8464 |
|
8465 |
|
8466 |
|
8467 |
|
8468 | function asProviderData(view, index) {
|
8469 | return (view.nodes[index]);
|
8470 | }
|
8471 |
|
8472 |
|
8473 |
|
8474 |
|
8475 |
|
8476 |
|
8477 | function asPureExpressionData(view, index) {
|
8478 | return (view.nodes[index]);
|
8479 | }
|
8480 |
|
8481 |
|
8482 |
|
8483 |
|
8484 |
|
8485 |
|
8486 | function asQueryList(view, index) {
|
8487 | return (view.nodes[index]);
|
8488 | }
|
8489 |
|
8490 |
|
8491 |
|
8492 | var DebugContext = (function () {
|
8493 | function DebugContext() {
|
8494 | }
|
8495 | |
8496 |
|
8497 |
|
8498 |
|
8499 | DebugContext.prototype.view = function () { };
|
8500 | |
8501 |
|
8502 |
|
8503 |
|
8504 | DebugContext.prototype.nodeIndex = function () { };
|
8505 | |
8506 |
|
8507 |
|
8508 |
|
8509 | DebugContext.prototype.injector = function () { };
|
8510 | |
8511 |
|
8512 |
|
8513 |
|
8514 | DebugContext.prototype.component = function () { };
|
8515 | |
8516 |
|
8517 |
|
8518 |
|
8519 | DebugContext.prototype.providerTokens = function () { };
|
8520 | |
8521 |
|
8522 |
|
8523 |
|
8524 | DebugContext.prototype.references = function () { };
|
8525 | |
8526 |
|
8527 |
|
8528 |
|
8529 | DebugContext.prototype.context = function () { };
|
8530 | |
8531 |
|
8532 |
|
8533 |
|
8534 | DebugContext.prototype.componentRenderElement = function () { };
|
8535 | |
8536 |
|
8537 |
|
8538 |
|
8539 | DebugContext.prototype.renderNode = function () { };
|
8540 | |
8541 |
|
8542 |
|
8543 |
|
8544 |
|
8545 |
|
8546 | DebugContext.prototype.logError = function (console) {
|
8547 | var values = [];
|
8548 | for (var _i = 1; _i < arguments.length; _i++) {
|
8549 | values[_i - 1] = arguments[_i];
|
8550 | }
|
8551 | };
|
8552 | return DebugContext;
|
8553 | }());
|
8554 |
|
8555 |
|
8556 |
|
8557 |
|
8558 | var Services = {
|
8559 | setCurrentNode: ((undefined)),
|
8560 | createRootView: ((undefined)),
|
8561 | createEmbeddedView: ((undefined)),
|
8562 | checkAndUpdateView: ((undefined)),
|
8563 | checkNoChangesView: ((undefined)),
|
8564 | destroyView: ((undefined)),
|
8565 | resolveDep: ((undefined)),
|
8566 | createDebugContext: ((undefined)),
|
8567 | handleEvent: ((undefined)),
|
8568 | updateDirectives: ((undefined)),
|
8569 | updateRenderer: ((undefined)),
|
8570 | dirtyParentQueries: ((undefined)),
|
8571 | };
|
8572 |
|
8573 |
|
8574 |
|
8575 |
|
8576 |
|
8577 |
|
8578 |
|
8579 |
|
8580 |
|
8581 |
|
8582 |
|
8583 |
|
8584 |
|
8585 |
|
8586 | function expressionChangedAfterItHasBeenCheckedError(context, oldValue, currValue, isFirstCheck) {
|
8587 | var msg = "ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: '" + oldValue + "'. Current value: '" + currValue + "'.";
|
8588 | if (isFirstCheck) {
|
8589 | msg +=
|
8590 | " It seems like the view has been created after its parent and its children have been dirty checked." +
|
8591 | " Has it been created in a change detection hook ?";
|
8592 | }
|
8593 | return viewDebugError(msg, context);
|
8594 | }
|
8595 |
|
8596 |
|
8597 |
|
8598 |
|
8599 |
|
8600 | function viewWrappedDebugError(err, context) {
|
8601 | if (!(err instanceof Error)) {
|
8602 |
|
8603 |
|
8604 | err = new Error(err.toString());
|
8605 | }
|
8606 | _addDebugContext(err, context);
|
8607 | return err;
|
8608 | }
|
8609 |
|
8610 |
|
8611 |
|
8612 |
|
8613 |
|
8614 | function viewDebugError(msg, context) {
|
8615 | var err = new Error(msg);
|
8616 | _addDebugContext(err, context);
|
8617 | return err;
|
8618 | }
|
8619 |
|
8620 |
|
8621 |
|
8622 |
|
8623 |
|
8624 | function _addDebugContext(err, context) {
|
8625 | ((err))[ERROR_DEBUG_CONTEXT] = context;
|
8626 | ((err))[ERROR_LOGGER] = context.logError.bind(context);
|
8627 | }
|
8628 |
|
8629 |
|
8630 |
|
8631 |
|
8632 | function isViewDebugError(err) {
|
8633 | return !!getDebugContext(err);
|
8634 | }
|
8635 |
|
8636 |
|
8637 |
|
8638 |
|
8639 | function viewDestroyedError(action) {
|
8640 | return new Error("ViewDestroyedError: Attempt to use a destroyed view: " + action);
|
8641 | }
|
8642 |
|
8643 |
|
8644 |
|
8645 |
|
8646 |
|
8647 |
|
8648 |
|
8649 | var NOOP = function () { };
|
8650 | var _tokenKeyCache = new Map();
|
8651 |
|
8652 |
|
8653 |
|
8654 |
|
8655 | function tokenKey(token) {
|
8656 | var key = _tokenKeyCache.get(token);
|
8657 | if (!key) {
|
8658 | key = stringify(token) + '_' + _tokenKeyCache.size;
|
8659 | _tokenKeyCache.set(token, key);
|
8660 | }
|
8661 | return key;
|
8662 | }
|
8663 |
|
8664 |
|
8665 |
|
8666 |
|
8667 |
|
8668 |
|
8669 |
|
8670 | function unwrapValue(view, nodeIdx, bindingIdx, value) {
|
8671 | if (value instanceof WrappedValue) {
|
8672 | value = value.wrapped;
|
8673 | var globalBindingIdx = view.def.nodes[nodeIdx].bindingIndex + bindingIdx;
|
8674 | var oldValue = view.oldValues[globalBindingIdx];
|
8675 | if (oldValue instanceof WrappedValue) {
|
8676 | oldValue = oldValue.wrapped;
|
8677 | }
|
8678 | view.oldValues[globalBindingIdx] = new WrappedValue(oldValue);
|
8679 | }
|
8680 | return value;
|
8681 | }
|
8682 | var UNDEFINED_RENDERER_TYPE_ID = '$$undefined';
|
8683 | var EMPTY_RENDERER_TYPE_ID = '$$empty';
|
8684 |
|
8685 |
|
8686 |
|
8687 |
|
8688 | function createRendererType2(values) {
|
8689 | return {
|
8690 | id: UNDEFINED_RENDERER_TYPE_ID,
|
8691 | styles: values.styles,
|
8692 | encapsulation: values.encapsulation,
|
8693 | data: values.data
|
8694 | };
|
8695 | }
|
8696 | var _renderCompCount = 0;
|
8697 |
|
8698 |
|
8699 |
|
8700 |
|
8701 | function resolveRendererType2(type) {
|
8702 | if (type && type.id === UNDEFINED_RENDERER_TYPE_ID) {
|
8703 |
|
8704 | var isFilled = ((type.encapsulation != null && type.encapsulation !== ViewEncapsulation.None) ||
|
8705 | type.styles.length || Object.keys(type.data).length);
|
8706 | if (isFilled) {
|
8707 | type.id = "c" + _renderCompCount++;
|
8708 | }
|
8709 | else {
|
8710 | type.id = EMPTY_RENDERER_TYPE_ID;
|
8711 | }
|
8712 | }
|
8713 | if (type && type.id === EMPTY_RENDERER_TYPE_ID) {
|
8714 | type = null;
|
8715 | }
|
8716 | return type || null;
|
8717 | }
|
8718 |
|
8719 |
|
8720 |
|
8721 |
|
8722 |
|
8723 |
|
8724 |
|
8725 | function checkBinding(view, def, bindingIdx, value) {
|
8726 | var oldValues = view.oldValues;
|
8727 | if ((view.state & 2 ) ||
|
8728 | !looseIdentical(oldValues[def.bindingIndex + bindingIdx], value)) {
|
8729 | return true;
|
8730 | }
|
8731 | return false;
|
8732 | }
|
8733 |
|
8734 |
|
8735 |
|
8736 |
|
8737 |
|
8738 |
|
8739 |
|
8740 | function checkAndUpdateBinding(view, def, bindingIdx, value) {
|
8741 | if (checkBinding(view, def, bindingIdx, value)) {
|
8742 | view.oldValues[def.bindingIndex + bindingIdx] = value;
|
8743 | return true;
|
8744 | }
|
8745 | return false;
|
8746 | }
|
8747 |
|
8748 |
|
8749 |
|
8750 |
|
8751 |
|
8752 |
|
8753 |
|
8754 | function checkBindingNoChanges(view, def, bindingIdx, value) {
|
8755 | var oldValue = view.oldValues[def.bindingIndex + bindingIdx];
|
8756 | if ((view.state & 1 ) || !devModeEqual(oldValue, value)) {
|
8757 | throw expressionChangedAfterItHasBeenCheckedError(Services.createDebugContext(view, def.index), oldValue, value, (view.state & 1 ) !== 0);
|
8758 | }
|
8759 | }
|
8760 |
|
8761 |
|
8762 |
|
8763 |
|
8764 | function markParentViewsForCheck(view) {
|
8765 | var currView = view;
|
8766 | while (currView) {
|
8767 | if (currView.def.flags & 2 ) {
|
8768 | currView.state |= 8 ;
|
8769 | }
|
8770 | currView = currView.viewContainerParent || currView.parent;
|
8771 | }
|
8772 | }
|
8773 |
|
8774 |
|
8775 |
|
8776 |
|
8777 |
|
8778 |
|
8779 |
|
8780 | function dispatchEvent(view, nodeIndex, eventName, event) {
|
8781 | var nodeDef = view.def.nodes[nodeIndex];
|
8782 | var startView = nodeDef.flags & 16777216 ? asElementData(view, nodeIndex).componentView : view;
|
8783 | markParentViewsForCheck(startView);
|
8784 | return Services.handleEvent(view, nodeIndex, eventName, event);
|
8785 | }
|
8786 |
|
8787 |
|
8788 |
|
8789 |
|
8790 | function declaredViewContainer(view) {
|
8791 | if (view.parent) {
|
8792 | var parentView = view.parent;
|
8793 | return asElementData(parentView, ((view.parentNodeDef)).index);
|
8794 | }
|
8795 | return null;
|
8796 | }
|
8797 |
|
8798 |
|
8799 |
|
8800 |
|
8801 |
|
8802 |
|
8803 |
|
8804 | function viewParentEl(view) {
|
8805 | var parentView = view.parent;
|
8806 | if (parentView) {
|
8807 | return ((view.parentNodeDef)).parent;
|
8808 | }
|
8809 | else {
|
8810 | return null;
|
8811 | }
|
8812 | }
|
8813 |
|
8814 |
|
8815 |
|
8816 |
|
8817 |
|
8818 | function renderNode(view, def) {
|
8819 | switch (def.flags & 100673535 ) {
|
8820 | case 1 :
|
8821 | return asElementData(view, def.index).renderElement;
|
8822 | case 2 :
|
8823 | return asTextData(view, def.index).renderText;
|
8824 | }
|
8825 | }
|
8826 |
|
8827 |
|
8828 |
|
8829 |
|
8830 |
|
8831 | function elementEventFullName(target, name) {
|
8832 | return target ? target + ":" + name : name;
|
8833 | }
|
8834 |
|
8835 |
|
8836 |
|
8837 |
|
8838 | function isComponentView(view) {
|
8839 | return !!view.parent && !!(((view.parentNodeDef)).flags & 16384 );
|
8840 | }
|
8841 |
|
8842 |
|
8843 |
|
8844 |
|
8845 | function isEmbeddedView(view) {
|
8846 | return !!view.parent && !(((view.parentNodeDef)).flags & 16384 );
|
8847 | }
|
8848 |
|
8849 |
|
8850 |
|
8851 |
|
8852 | function filterQueryId(queryId) {
|
8853 | return 1 << (queryId % 32);
|
8854 | }
|
8855 |
|
8856 |
|
8857 |
|
8858 |
|
8859 | function splitMatchedQueriesDsl(matchedQueriesDsl) {
|
8860 | var matchedQueries = {};
|
8861 | var matchedQueryIds = 0;
|
8862 | var references = {};
|
8863 | if (matchedQueriesDsl) {
|
8864 | matchedQueriesDsl.forEach(function (_a) {
|
8865 | var queryId = _a[0], valueType = _a[1];
|
8866 | if (typeof queryId === 'number') {
|
8867 | matchedQueries[queryId] = valueType;
|
8868 | matchedQueryIds |= filterQueryId(queryId);
|
8869 | }
|
8870 | else {
|
8871 | references[queryId] = valueType;
|
8872 | }
|
8873 | });
|
8874 | }
|
8875 | return { matchedQueries: matchedQueries, references: references, matchedQueryIds: matchedQueryIds };
|
8876 | }
|
8877 |
|
8878 |
|
8879 |
|
8880 |
|
8881 |
|
8882 |
|
8883 | function getParentRenderElement(view, renderHost, def) {
|
8884 | var renderParent = def.renderParent;
|
8885 | if (renderParent) {
|
8886 | if ((renderParent.flags & 1 ) === 0 ||
|
8887 | (renderParent.flags & 16777216 ) === 0 ||
|
8888 | (((renderParent.element)).componentRendererType && ((((renderParent.element)).componentRendererType)).encapsulation ===
|
8889 | ViewEncapsulation.Native)) {
|
8890 |
|
8891 |
|
8892 | return asElementData(view, ((def.renderParent)).index).renderElement;
|
8893 | }
|
8894 | }
|
8895 | else {
|
8896 | return renderHost;
|
8897 | }
|
8898 | }
|
8899 | var VIEW_DEFINITION_CACHE = new WeakMap();
|
8900 |
|
8901 |
|
8902 |
|
8903 |
|
8904 | function resolveViewDefinition(factory) {
|
8905 | var value = ((VIEW_DEFINITION_CACHE.get(factory)));
|
8906 | if (!value) {
|
8907 | value = factory(function () { return NOOP; });
|
8908 | value.factory = factory;
|
8909 | VIEW_DEFINITION_CACHE.set(factory, value);
|
8910 | }
|
8911 | return value;
|
8912 | }
|
8913 |
|
8914 |
|
8915 |
|
8916 |
|
8917 | function rootRenderNodes(view) {
|
8918 | var renderNodes = [];
|
8919 | visitRootRenderNodes(view, 0 , undefined, undefined, renderNodes);
|
8920 | return renderNodes;
|
8921 | }
|
8922 |
|
8923 |
|
8924 |
|
8925 |
|
8926 |
|
8927 |
|
8928 |
|
8929 |
|
8930 | function visitRootRenderNodes(view, action, parentNode, nextSibling, target) {
|
8931 |
|
8932 | if (action === 3 ) {
|
8933 | parentNode = view.renderer.parentNode(renderNode(view, ((view.def.lastRenderRootNode))));
|
8934 | }
|
8935 | visitSiblingRenderNodes(view, action, 0, view.def.nodes.length - 1, parentNode, nextSibling, target);
|
8936 | }
|
8937 |
|
8938 |
|
8939 |
|
8940 |
|
8941 |
|
8942 |
|
8943 |
|
8944 |
|
8945 |
|
8946 |
|
8947 | function visitSiblingRenderNodes(view, action, startIndex, endIndex, parentNode, nextSibling, target) {
|
8948 | for (var i = startIndex; i <= endIndex; i++) {
|
8949 | var nodeDef = view.def.nodes[i];
|
8950 | if (nodeDef.flags & (1 | 2 | 4 )) {
|
8951 | visitRenderNode(view, nodeDef, action, parentNode, nextSibling, target);
|
8952 | }
|
8953 |
|
8954 | i += nodeDef.childCount;
|
8955 | }
|
8956 | }
|
8957 |
|
8958 |
|
8959 |
|
8960 |
|
8961 |
|
8962 |
|
8963 |
|
8964 |
|
8965 |
|
8966 | function visitProjectedRenderNodes(view, ngContentIndex, action, parentNode, nextSibling, target) {
|
8967 | var compView = view;
|
8968 | while (compView && !isComponentView(compView)) {
|
8969 | compView = compView.parent;
|
8970 | }
|
8971 | var hostView = ((compView)).parent;
|
8972 | var hostElDef = viewParentEl( ((compView)));
|
8973 | var startIndex = ((hostElDef)).index + 1;
|
8974 | var endIndex = ((hostElDef)).index + ((hostElDef)).childCount;
|
8975 | for (var i = startIndex; i <= endIndex; i++) {
|
8976 | var nodeDef = ((hostView)).def.nodes[i];
|
8977 | if (nodeDef.ngContentIndex === ngContentIndex) {
|
8978 | visitRenderNode( ((hostView)), nodeDef, action, parentNode, nextSibling, target);
|
8979 | }
|
8980 |
|
8981 | i += nodeDef.childCount;
|
8982 | }
|
8983 | if (!((hostView)).parent) {
|
8984 |
|
8985 | var projectedNodes = view.root.projectableNodes[ngContentIndex];
|
8986 | if (projectedNodes) {
|
8987 | for (var i = 0; i < projectedNodes.length; i++) {
|
8988 | execRenderNodeAction(view, projectedNodes[i], action, parentNode, nextSibling, target);
|
8989 | }
|
8990 | }
|
8991 | }
|
8992 | }
|
8993 |
|
8994 |
|
8995 |
|
8996 |
|
8997 |
|
8998 |
|
8999 |
|
9000 |
|
9001 |
|
9002 | function visitRenderNode(view, nodeDef, action, parentNode, nextSibling, target) {
|
9003 | if (nodeDef.flags & 4 ) {
|
9004 | visitProjectedRenderNodes(view, ((nodeDef.ngContent)).index, action, parentNode, nextSibling, target);
|
9005 | }
|
9006 | else {
|
9007 | var rn = renderNode(view, nodeDef);
|
9008 | if (action === 3 && (nodeDef.flags & 16777216 ) &&
|
9009 | (nodeDef.bindingFlags & 48 )) {
|
9010 |
|
9011 | if (nodeDef.bindingFlags & (16 )) {
|
9012 | execRenderNodeAction(view, rn, action, parentNode, nextSibling, target);
|
9013 | }
|
9014 | if (nodeDef.bindingFlags & (32 )) {
|
9015 | var compView = asElementData(view, nodeDef.index).componentView;
|
9016 | execRenderNodeAction(compView, rn, action, parentNode, nextSibling, target);
|
9017 | }
|
9018 | }
|
9019 | else {
|
9020 | execRenderNodeAction(view, rn, action, parentNode, nextSibling, target);
|
9021 | }
|
9022 | if (nodeDef.flags & 8388608 ) {
|
9023 | var embeddedViews = ((asElementData(view, nodeDef.index).viewContainer))._embeddedViews;
|
9024 | for (var k = 0; k < embeddedViews.length; k++) {
|
9025 | visitRootRenderNodes(embeddedViews[k], action, parentNode, nextSibling, target);
|
9026 | }
|
9027 | }
|
9028 | if (nodeDef.flags & 1 && !((nodeDef.element)).name) {
|
9029 | visitSiblingRenderNodes(view, action, nodeDef.index + 1, nodeDef.index + nodeDef.childCount, parentNode, nextSibling, target);
|
9030 | }
|
9031 | }
|
9032 | }
|
9033 |
|
9034 |
|
9035 |
|
9036 |
|
9037 |
|
9038 |
|
9039 |
|
9040 |
|
9041 |
|
9042 | function execRenderNodeAction(view, renderNode, action, parentNode, nextSibling, target) {
|
9043 | var renderer = view.renderer;
|
9044 | switch (action) {
|
9045 | case 1 :
|
9046 | renderer.appendChild(parentNode, renderNode);
|
9047 | break;
|
9048 | case 2 :
|
9049 | renderer.insertBefore(parentNode, renderNode, nextSibling);
|
9050 | break;
|
9051 | case 3 :
|
9052 | renderer.removeChild(parentNode, renderNode);
|
9053 | break;
|
9054 | case 0 :
|
9055 | ((target)).push(renderNode);
|
9056 | break;
|
9057 | }
|
9058 | }
|
9059 | var NS_PREFIX_RE = /^:([^:]+):(.+)$/;
|
9060 |
|
9061 |
|
9062 |
|
9063 |
|
9064 | function splitNamespace(name) {
|
9065 | if (name[0] === ':') {
|
9066 | var match = ((name.match(NS_PREFIX_RE)));
|
9067 | return [match[1], match[2]];
|
9068 | }
|
9069 | return ['', name];
|
9070 | }
|
9071 |
|
9072 |
|
9073 |
|
9074 |
|
9075 | function calcBindingFlags(bindings) {
|
9076 | var flags = 0;
|
9077 | for (var i = 0; i < bindings.length; i++) {
|
9078 | flags |= bindings[i].flags;
|
9079 | }
|
9080 | return flags;
|
9081 | }
|
9082 |
|
9083 |
|
9084 |
|
9085 |
|
9086 |
|
9087 | function interpolate(valueCount, constAndInterp) {
|
9088 | var result = '';
|
9089 | for (var i = 0; i < valueCount * 2; i = i + 2) {
|
9090 | result = result + constAndInterp[i] + _toStringWithNull(constAndInterp[i + 1]);
|
9091 | }
|
9092 | return result + constAndInterp[valueCount * 2];
|
9093 | }
|
9094 |
|
9095 |
|
9096 |
|
9097 |
|
9098 |
|
9099 |
|
9100 |
|
9101 |
|
9102 |
|
9103 |
|
9104 |
|
9105 |
|
9106 |
|
9107 |
|
9108 |
|
9109 |
|
9110 |
|
9111 |
|
9112 |
|
9113 |
|
9114 |
|
9115 |
|
9116 |
|
9117 | function inlineInterpolate(valueCount, c0, a1, c1, a2, c2, a3, c3, a4, c4, a5, c5, a6, c6, a7, c7, a8, c8, a9, c9) {
|
9118 | switch (valueCount) {
|
9119 | case 1:
|
9120 | return c0 + _toStringWithNull(a1) + c1;
|
9121 | case 2:
|
9122 | return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2;
|
9123 | case 3:
|
9124 | return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
|
9125 | c3;
|
9126 | case 4:
|
9127 | return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
|
9128 | c3 + _toStringWithNull(a4) + c4;
|
9129 | case 5:
|
9130 | return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
|
9131 | c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5;
|
9132 | case 6:
|
9133 | return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
|
9134 | c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) + c6;
|
9135 | case 7:
|
9136 | return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
|
9137 | c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) +
|
9138 | c6 + _toStringWithNull(a7) + c7;
|
9139 | case 8:
|
9140 | return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
|
9141 | c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) +
|
9142 | c6 + _toStringWithNull(a7) + c7 + _toStringWithNull(a8) + c8;
|
9143 | case 9:
|
9144 | return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
|
9145 | c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) +
|
9146 | c6 + _toStringWithNull(a7) + c7 + _toStringWithNull(a8) + c8 + _toStringWithNull(a9) + c9;
|
9147 | default:
|
9148 | throw new Error("Does not support more than 9 expressions");
|
9149 | }
|
9150 | }
|
9151 |
|
9152 |
|
9153 |
|
9154 |
|
9155 | function _toStringWithNull(v) {
|
9156 | return v != null ? v.toString() : '';
|
9157 | }
|
9158 | var EMPTY_ARRAY = [];
|
9159 | var EMPTY_MAP = {};
|
9160 |
|
9161 |
|
9162 |
|
9163 |
|
9164 |
|
9165 |
|
9166 |
|
9167 |
|
9168 |
|
9169 |
|
9170 |
|
9171 |
|
9172 |
|
9173 |
|
9174 |
|
9175 |
|
9176 | function anchorDef(flags, matchedQueriesDsl, ngContentIndex, childCount, handleEvent, templateFactory) {
|
9177 | flags |= 1 ;
|
9178 | var _a = splitMatchedQueriesDsl(matchedQueriesDsl), matchedQueries = _a.matchedQueries, references = _a.references, matchedQueryIds = _a.matchedQueryIds;
|
9179 | var template = templateFactory ? resolveViewDefinition(templateFactory) : null;
|
9180 | return {
|
9181 |
|
9182 | index: -1,
|
9183 | parent: null,
|
9184 | renderParent: null,
|
9185 | bindingIndex: -1,
|
9186 | outputIndex: -1,
|
9187 |
|
9188 | flags: flags,
|
9189 | childFlags: 0,
|
9190 | directChildFlags: 0,
|
9191 | childMatchedQueries: 0, matchedQueries: matchedQueries, matchedQueryIds: matchedQueryIds, references: references, ngContentIndex: ngContentIndex, childCount: childCount,
|
9192 | bindings: [],
|
9193 | bindingFlags: 0,
|
9194 | outputs: [],
|
9195 | element: {
|
9196 | ns: null,
|
9197 | name: null,
|
9198 | attrs: null, template: template,
|
9199 | componentProvider: null,
|
9200 | componentView: null,
|
9201 | componentRendererType: null,
|
9202 | publicProviders: null,
|
9203 | allProviders: null,
|
9204 | handleEvent: handleEvent || NOOP
|
9205 | },
|
9206 | provider: null,
|
9207 | text: null,
|
9208 | query: null,
|
9209 | ngContent: null
|
9210 | };
|
9211 | }
|
9212 |
|
9213 |
|
9214 |
|
9215 |
|
9216 |
|
9217 |
|
9218 |
|
9219 |
|
9220 |
|
9221 |
|
9222 |
|
9223 |
|
9224 |
|
9225 |
|
9226 | function elementDef(flags, matchedQueriesDsl, ngContentIndex, childCount, namespaceAndName, fixedAttrs, bindings, outputs, handleEvent, componentView, componentRendererType) {
|
9227 | if (fixedAttrs === void 0) { fixedAttrs = []; }
|
9228 | if (!handleEvent) {
|
9229 | handleEvent = NOOP;
|
9230 | }
|
9231 | var _a = splitMatchedQueriesDsl(matchedQueriesDsl), matchedQueries = _a.matchedQueries, references = _a.references, matchedQueryIds = _a.matchedQueryIds;
|
9232 | var ns = ((null));
|
9233 | var name = ((null));
|
9234 | if (namespaceAndName) {
|
9235 | _b = splitNamespace(namespaceAndName), ns = _b[0], name = _b[1];
|
9236 | }
|
9237 | bindings = bindings || [];
|
9238 | var bindingDefs = new Array(bindings.length);
|
9239 | for (var i = 0; i < bindings.length; i++) {
|
9240 | var _c = bindings[i], bindingFlags = _c[0], namespaceAndName_1 = _c[1], suffixOrSecurityContext = _c[2];
|
9241 | var _d = splitNamespace(namespaceAndName_1), ns_1 = _d[0], name_1 = _d[1];
|
9242 | var securityContext = ((undefined));
|
9243 | var suffix = ((undefined));
|
9244 | switch (bindingFlags & 15 ) {
|
9245 | case 4 :
|
9246 | suffix = (suffixOrSecurityContext);
|
9247 | break;
|
9248 | case 1 :
|
9249 | case 8 :
|
9250 | securityContext = (suffixOrSecurityContext);
|
9251 | break;
|
9252 | }
|
9253 | bindingDefs[i] =
|
9254 | { flags: bindingFlags, ns: ns_1, name: name_1, nonMinifiedName: name_1, securityContext: securityContext, suffix: suffix };
|
9255 | }
|
9256 | outputs = outputs || [];
|
9257 | var outputDefs = new Array(outputs.length);
|
9258 | for (var i = 0; i < outputs.length; i++) {
|
9259 | var _e = outputs[i], target = _e[0], eventName = _e[1];
|
9260 | outputDefs[i] = {
|
9261 | type: 0 ,
|
9262 | target: (target), eventName: eventName,
|
9263 | propName: null
|
9264 | };
|
9265 | }
|
9266 | fixedAttrs = fixedAttrs || [];
|
9267 | var attrs = (fixedAttrs.map(function (_a) {
|
9268 | var namespaceAndName = _a[0], value = _a[1];
|
9269 | var _b = splitNamespace(namespaceAndName), ns = _b[0], name = _b[1];
|
9270 | return [ns, name, value];
|
9271 | }));
|
9272 | componentRendererType = resolveRendererType2(componentRendererType);
|
9273 | if (componentView) {
|
9274 | flags |= 16777216 ;
|
9275 | }
|
9276 | flags |= 1 ;
|
9277 | return {
|
9278 |
|
9279 | index: -1,
|
9280 | parent: null,
|
9281 | renderParent: null,
|
9282 | bindingIndex: -1,
|
9283 | outputIndex: -1,
|
9284 |
|
9285 | flags: flags,
|
9286 | childFlags: 0,
|
9287 | directChildFlags: 0,
|
9288 | childMatchedQueries: 0, matchedQueries: matchedQueries, matchedQueryIds: matchedQueryIds, references: references, ngContentIndex: ngContentIndex, childCount: childCount,
|
9289 | bindings: bindingDefs,
|
9290 | bindingFlags: calcBindingFlags(bindingDefs),
|
9291 | outputs: outputDefs,
|
9292 | element: {
|
9293 | ns: ns,
|
9294 | name: name,
|
9295 | attrs: attrs,
|
9296 | template: null,
|
9297 |
|
9298 | componentProvider: null,
|
9299 | componentView: componentView || null,
|
9300 | componentRendererType: componentRendererType,
|
9301 | publicProviders: null,
|
9302 | allProviders: null,
|
9303 | handleEvent: handleEvent || NOOP,
|
9304 | },
|
9305 | provider: null,
|
9306 | text: null,
|
9307 | query: null,
|
9308 | ngContent: null
|
9309 | };
|
9310 | var _b;
|
9311 | }
|
9312 |
|
9313 |
|
9314 |
|
9315 |
|
9316 |
|
9317 |
|
9318 | function createElement(view, renderHost, def) {
|
9319 | var elDef = ((def.element));
|
9320 | var rootSelectorOrNode = view.root.selectorOrNode;
|
9321 | var renderer = view.renderer;
|
9322 | var el;
|
9323 | if (view.parent || !rootSelectorOrNode) {
|
9324 | if (elDef.name) {
|
9325 | el = renderer.createElement(elDef.name, elDef.ns);
|
9326 | }
|
9327 | else {
|
9328 | el = renderer.createComment('');
|
9329 | }
|
9330 | var parentEl = getParentRenderElement(view, renderHost, def);
|
9331 | if (parentEl) {
|
9332 | renderer.appendChild(parentEl, el);
|
9333 | }
|
9334 | }
|
9335 | else {
|
9336 | el = renderer.selectRootElement(rootSelectorOrNode);
|
9337 | }
|
9338 | if (elDef.attrs) {
|
9339 | for (var i = 0; i < elDef.attrs.length; i++) {
|
9340 | var _a = elDef.attrs[i], ns = _a[0], name = _a[1], value = _a[2];
|
9341 | renderer.setAttribute(el, name, value, ns);
|
9342 | }
|
9343 | }
|
9344 | return el;
|
9345 | }
|
9346 |
|
9347 |
|
9348 |
|
9349 |
|
9350 |
|
9351 |
|
9352 |
|
9353 | function listenToElementOutputs(view, compView, def, el) {
|
9354 | for (var i = 0; i < def.outputs.length; i++) {
|
9355 | var output = def.outputs[i];
|
9356 | var handleEventClosure = renderEventHandlerClosure(view, def.index, elementEventFullName(output.target, output.eventName));
|
9357 | var listenTarget = output.target;
|
9358 | var listenerView = view;
|
9359 | if (output.target === 'component') {
|
9360 | listenTarget = null;
|
9361 | listenerView = compView;
|
9362 | }
|
9363 | var disposable = (listenerView.renderer.listen(listenTarget || el, output.eventName, handleEventClosure));
|
9364 | ((view.disposables))[def.outputIndex + i] = disposable;
|
9365 | }
|
9366 | }
|
9367 |
|
9368 |
|
9369 |
|
9370 |
|
9371 |
|
9372 |
|
9373 | function renderEventHandlerClosure(view, index, eventName) {
|
9374 | return function (event) {
|
9375 | try {
|
9376 | return dispatchEvent(view, index, eventName, event);
|
9377 | }
|
9378 | catch (e) {
|
9379 |
|
9380 | view.root.errorHandler.handleError(e);
|
9381 | }
|
9382 | };
|
9383 | }
|
9384 |
|
9385 |
|
9386 |
|
9387 |
|
9388 |
|
9389 |
|
9390 |
|
9391 |
|
9392 |
|
9393 |
|
9394 |
|
9395 |
|
9396 |
|
9397 |
|
9398 |
|
9399 | function checkAndUpdateElementInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
9400 | var bindLen = def.bindings.length;
|
9401 | var changed = false;
|
9402 | if (bindLen > 0 && checkAndUpdateElementValue(view, def, 0, v0))
|
9403 | changed = true;
|
9404 | if (bindLen > 1 && checkAndUpdateElementValue(view, def, 1, v1))
|
9405 | changed = true;
|
9406 | if (bindLen > 2 && checkAndUpdateElementValue(view, def, 2, v2))
|
9407 | changed = true;
|
9408 | if (bindLen > 3 && checkAndUpdateElementValue(view, def, 3, v3))
|
9409 | changed = true;
|
9410 | if (bindLen > 4 && checkAndUpdateElementValue(view, def, 4, v4))
|
9411 | changed = true;
|
9412 | if (bindLen > 5 && checkAndUpdateElementValue(view, def, 5, v5))
|
9413 | changed = true;
|
9414 | if (bindLen > 6 && checkAndUpdateElementValue(view, def, 6, v6))
|
9415 | changed = true;
|
9416 | if (bindLen > 7 && checkAndUpdateElementValue(view, def, 7, v7))
|
9417 | changed = true;
|
9418 | if (bindLen > 8 && checkAndUpdateElementValue(view, def, 8, v8))
|
9419 | changed = true;
|
9420 | if (bindLen > 9 && checkAndUpdateElementValue(view, def, 9, v9))
|
9421 | changed = true;
|
9422 | return changed;
|
9423 | }
|
9424 |
|
9425 |
|
9426 |
|
9427 |
|
9428 |
|
9429 |
|
9430 | function checkAndUpdateElementDynamic(view, def, values) {
|
9431 | var changed = false;
|
9432 | for (var i = 0; i < values.length; i++) {
|
9433 | if (checkAndUpdateElementValue(view, def, i, values[i]))
|
9434 | changed = true;
|
9435 | }
|
9436 | return changed;
|
9437 | }
|
9438 |
|
9439 |
|
9440 |
|
9441 |
|
9442 |
|
9443 |
|
9444 |
|
9445 | function checkAndUpdateElementValue(view, def, bindingIdx, value) {
|
9446 | if (!checkAndUpdateBinding(view, def, bindingIdx, value)) {
|
9447 | return false;
|
9448 | }
|
9449 | var binding = def.bindings[bindingIdx];
|
9450 | var elData = asElementData(view, def.index);
|
9451 | var renderNode$$1 = elData.renderElement;
|
9452 | var name = ((binding.name));
|
9453 | switch (binding.flags & 15 ) {
|
9454 | case 1 :
|
9455 | setElementAttribute(view, binding, renderNode$$1, binding.ns, name, value);
|
9456 | break;
|
9457 | case 2 :
|
9458 | setElementClass(view, renderNode$$1, name, value);
|
9459 | break;
|
9460 | case 4 :
|
9461 | setElementStyle(view, binding, renderNode$$1, name, value);
|
9462 | break;
|
9463 | case 8 :
|
9464 | var bindView = (def.flags & 16777216 &&
|
9465 | binding.flags & 32 ) ?
|
9466 | elData.componentView :
|
9467 | view;
|
9468 | setElementProperty(bindView, binding, renderNode$$1, name, value);
|
9469 | break;
|
9470 | }
|
9471 | return true;
|
9472 | }
|
9473 |
|
9474 |
|
9475 |
|
9476 |
|
9477 |
|
9478 |
|
9479 |
|
9480 |
|
9481 |
|
9482 | function setElementAttribute(view, binding, renderNode$$1, ns, name, value) {
|
9483 | var securityContext = binding.securityContext;
|
9484 | var renderValue = securityContext ? view.root.sanitizer.sanitize(securityContext, value) : value;
|
9485 | renderValue = renderValue != null ? renderValue.toString() : null;
|
9486 | var renderer = view.renderer;
|
9487 | if (value != null) {
|
9488 | renderer.setAttribute(renderNode$$1, name, renderValue, ns);
|
9489 | }
|
9490 | else {
|
9491 | renderer.removeAttribute(renderNode$$1, name, ns);
|
9492 | }
|
9493 | }
|
9494 |
|
9495 |
|
9496 |
|
9497 |
|
9498 |
|
9499 |
|
9500 |
|
9501 | function setElementClass(view, renderNode$$1, name, value) {
|
9502 | var renderer = view.renderer;
|
9503 | if (value) {
|
9504 | renderer.addClass(renderNode$$1, name);
|
9505 | }
|
9506 | else {
|
9507 | renderer.removeClass(renderNode$$1, name);
|
9508 | }
|
9509 | }
|
9510 |
|
9511 |
|
9512 |
|
9513 |
|
9514 |
|
9515 |
|
9516 |
|
9517 |
|
9518 | function setElementStyle(view, binding, renderNode$$1, name, value) {
|
9519 | var renderValue = view.root.sanitizer.sanitize(SecurityContext.STYLE, (value));
|
9520 | if (renderValue != null) {
|
9521 | renderValue = renderValue.toString();
|
9522 | var unit = binding.suffix;
|
9523 | if (unit != null) {
|
9524 | renderValue = renderValue + unit;
|
9525 | }
|
9526 | }
|
9527 | else {
|
9528 | renderValue = null;
|
9529 | }
|
9530 | var renderer = view.renderer;
|
9531 | if (renderValue != null) {
|
9532 | renderer.setStyle(renderNode$$1, name, renderValue);
|
9533 | }
|
9534 | else {
|
9535 | renderer.removeStyle(renderNode$$1, name);
|
9536 | }
|
9537 | }
|
9538 |
|
9539 |
|
9540 |
|
9541 |
|
9542 |
|
9543 |
|
9544 |
|
9545 |
|
9546 | function setElementProperty(view, binding, renderNode$$1, name, value) {
|
9547 | var securityContext = binding.securityContext;
|
9548 | var renderValue = securityContext ? view.root.sanitizer.sanitize(securityContext, value) : value;
|
9549 | view.renderer.setProperty(renderNode$$1, name, renderValue);
|
9550 | }
|
9551 |
|
9552 |
|
9553 |
|
9554 |
|
9555 |
|
9556 |
|
9557 |
|
9558 |
|
9559 |
|
9560 |
|
9561 |
|
9562 |
|
9563 | function ngContentDef(ngContentIndex, index) {
|
9564 | return {
|
9565 |
|
9566 | index: -1,
|
9567 | parent: null,
|
9568 | renderParent: null,
|
9569 | bindingIndex: -1,
|
9570 | outputIndex: -1,
|
9571 |
|
9572 | flags: 4 ,
|
9573 | childFlags: 0,
|
9574 | directChildFlags: 0,
|
9575 | childMatchedQueries: 0,
|
9576 | matchedQueries: {},
|
9577 | matchedQueryIds: 0,
|
9578 | references: {}, ngContentIndex: ngContentIndex,
|
9579 | childCount: 0,
|
9580 | bindings: [],
|
9581 | bindingFlags: 0,
|
9582 | outputs: [],
|
9583 | element: null,
|
9584 | provider: null,
|
9585 | text: null,
|
9586 | query: null,
|
9587 | ngContent: { index: index }
|
9588 | };
|
9589 | }
|
9590 |
|
9591 |
|
9592 |
|
9593 |
|
9594 |
|
9595 |
|
9596 | function appendNgContent(view, renderHost, def) {
|
9597 | var parentEl = getParentRenderElement(view, renderHost, def);
|
9598 | if (!parentEl) {
|
9599 |
|
9600 | return;
|
9601 | }
|
9602 | var ngContentIndex = ((def.ngContent)).index;
|
9603 | visitProjectedRenderNodes(view, ngContentIndex, 1 , parentEl, null, undefined);
|
9604 | }
|
9605 |
|
9606 |
|
9607 |
|
9608 |
|
9609 |
|
9610 |
|
9611 |
|
9612 |
|
9613 |
|
9614 |
|
9615 |
|
9616 |
|
9617 |
|
9618 |
|
9619 | function attachEmbeddedView(parentView, elementData, viewIndex, view) {
|
9620 | var embeddedViews = ((elementData.viewContainer))._embeddedViews;
|
9621 | if (viewIndex === null || viewIndex === undefined) {
|
9622 | viewIndex = embeddedViews.length;
|
9623 | }
|
9624 | view.viewContainerParent = parentView;
|
9625 | addToArray(embeddedViews, ((viewIndex)), view);
|
9626 | var dvcElementData = declaredViewContainer(view);
|
9627 | if (dvcElementData && dvcElementData !== elementData) {
|
9628 | var projectedViews = dvcElementData.template._projectedViews;
|
9629 | if (!projectedViews) {
|
9630 | projectedViews = dvcElementData.template._projectedViews = [];
|
9631 | }
|
9632 | projectedViews.push(view);
|
9633 | }
|
9634 | Services.dirtyParentQueries(view);
|
9635 | var prevView = ((viewIndex)) > 0 ? embeddedViews[((viewIndex)) - 1] : null;
|
9636 | renderAttachEmbeddedView(elementData, prevView, view);
|
9637 | }
|
9638 |
|
9639 |
|
9640 |
|
9641 |
|
9642 |
|
9643 | function detachEmbeddedView(elementData, viewIndex) {
|
9644 | var embeddedViews = ((elementData.viewContainer))._embeddedViews;
|
9645 | if (viewIndex == null || viewIndex >= embeddedViews.length) {
|
9646 | viewIndex = embeddedViews.length - 1;
|
9647 | }
|
9648 | if (viewIndex < 0) {
|
9649 | return null;
|
9650 | }
|
9651 | var view = embeddedViews[viewIndex];
|
9652 | view.viewContainerParent = null;
|
9653 | removeFromArray(embeddedViews, viewIndex);
|
9654 | var dvcElementData = declaredViewContainer(view);
|
9655 | if (dvcElementData && dvcElementData !== elementData) {
|
9656 | var projectedViews = dvcElementData.template._projectedViews;
|
9657 | removeFromArray(projectedViews, projectedViews.indexOf(view));
|
9658 | }
|
9659 | Services.dirtyParentQueries(view);
|
9660 | renderDetachView(view);
|
9661 | return view;
|
9662 | }
|
9663 |
|
9664 |
|
9665 |
|
9666 |
|
9667 |
|
9668 |
|
9669 | function moveEmbeddedView(elementData, oldViewIndex, newViewIndex) {
|
9670 | var embeddedViews = ((elementData.viewContainer))._embeddedViews;
|
9671 | var view = embeddedViews[oldViewIndex];
|
9672 | removeFromArray(embeddedViews, oldViewIndex);
|
9673 | if (newViewIndex == null) {
|
9674 | newViewIndex = embeddedViews.length;
|
9675 | }
|
9676 | addToArray(embeddedViews, newViewIndex, view);
|
9677 |
|
9678 |
|
9679 | Services.dirtyParentQueries(view);
|
9680 | renderDetachView(view);
|
9681 | var prevView = newViewIndex > 0 ? embeddedViews[newViewIndex - 1] : null;
|
9682 | renderAttachEmbeddedView(elementData, prevView, view);
|
9683 | return view;
|
9684 | }
|
9685 |
|
9686 |
|
9687 |
|
9688 |
|
9689 |
|
9690 |
|
9691 | function renderAttachEmbeddedView(elementData, prevView, view) {
|
9692 | var prevRenderNode = prevView ? renderNode(prevView, ((prevView.def.lastRenderRootNode))) :
|
9693 | elementData.renderElement;
|
9694 | var parentNode = view.renderer.parentNode(prevRenderNode);
|
9695 | var nextSibling = view.renderer.nextSibling(prevRenderNode);
|
9696 |
|
9697 |
|
9698 | visitRootRenderNodes(view, 2 , parentNode, nextSibling, undefined);
|
9699 | }
|
9700 |
|
9701 |
|
9702 |
|
9703 |
|
9704 | function renderDetachView(view) {
|
9705 | visitRootRenderNodes(view, 3 , null, null, undefined);
|
9706 | }
|
9707 |
|
9708 |
|
9709 |
|
9710 |
|
9711 |
|
9712 |
|
9713 | function addToArray(arr, index, value) {
|
9714 |
|
9715 | if (index >= arr.length) {
|
9716 | arr.push(value);
|
9717 | }
|
9718 | else {
|
9719 | arr.splice(index, 0, value);
|
9720 | }
|
9721 | }
|
9722 |
|
9723 |
|
9724 |
|
9725 |
|
9726 |
|
9727 | function removeFromArray(arr, index) {
|
9728 |
|
9729 | if (index >= arr.length - 1) {
|
9730 | arr.pop();
|
9731 | }
|
9732 | else {
|
9733 | arr.splice(index, 1);
|
9734 | }
|
9735 | }
|
9736 |
|
9737 |
|
9738 |
|
9739 |
|
9740 |
|
9741 |
|
9742 |
|
9743 | var EMPTY_CONTEXT = new Object();
|
9744 |
|
9745 |
|
9746 |
|
9747 |
|
9748 |
|
9749 |
|
9750 |
|
9751 |
|
9752 |
|
9753 | function createComponentFactory(selector, componentType, viewDefFactory, inputs, outputs, ngContentSelectors) {
|
9754 | return new ComponentFactory_(selector, componentType, viewDefFactory, inputs, outputs, ngContentSelectors);
|
9755 | }
|
9756 |
|
9757 |
|
9758 |
|
9759 |
|
9760 | function getComponentViewDefinitionFactory(componentFactory) {
|
9761 | return ((componentFactory)).viewDefFactory;
|
9762 | }
|
9763 | var ComponentFactory_ = (function (_super) {
|
9764 | __extends(ComponentFactory_, _super);
|
9765 | |
9766 |
|
9767 |
|
9768 |
|
9769 |
|
9770 |
|
9771 |
|
9772 |
|
9773 | function ComponentFactory_(selector, componentType, viewDefFactory, _inputs, _outputs, ngContentSelectors) {
|
9774 | var _this =
|
9775 |
|
9776 |
|
9777 | _super.call(this) || this;
|
9778 | _this.selector = selector;
|
9779 | _this.componentType = componentType;
|
9780 | _this._inputs = _inputs;
|
9781 | _this._outputs = _outputs;
|
9782 | _this.ngContentSelectors = ngContentSelectors;
|
9783 | _this.viewDefFactory = viewDefFactory;
|
9784 | return _this;
|
9785 | }
|
9786 | Object.defineProperty(ComponentFactory_.prototype, "inputs", {
|
9787 | |
9788 |
|
9789 |
|
9790 | get: function () {
|
9791 | var inputsArr = [];
|
9792 | var inputs = ((this._inputs));
|
9793 | for (var propName in inputs) {
|
9794 | var templateName = inputs[propName];
|
9795 | inputsArr.push({ propName: propName, templateName: templateName });
|
9796 | }
|
9797 | return inputsArr;
|
9798 | },
|
9799 | enumerable: true,
|
9800 | configurable: true
|
9801 | });
|
9802 | Object.defineProperty(ComponentFactory_.prototype, "outputs", {
|
9803 | |
9804 |
|
9805 |
|
9806 | get: function () {
|
9807 | var outputsArr = [];
|
9808 | for (var propName in this._outputs) {
|
9809 | var templateName = this._outputs[propName];
|
9810 | outputsArr.push({ propName: propName, templateName: templateName });
|
9811 | }
|
9812 | return outputsArr;
|
9813 | },
|
9814 | enumerable: true,
|
9815 | configurable: true
|
9816 | });
|
9817 | |
9818 |
|
9819 |
|
9820 |
|
9821 |
|
9822 |
|
9823 |
|
9824 |
|
9825 | ComponentFactory_.prototype.create = function (injector, projectableNodes, rootSelectorOrNode, ngModule) {
|
9826 | if (!ngModule) {
|
9827 | throw new Error('ngModule should be provided');
|
9828 | }
|
9829 | var viewDef = resolveViewDefinition(this.viewDefFactory);
|
9830 | var componentNodeIndex = ((((viewDef.nodes[0].element)).componentProvider)).index;
|
9831 | var view = Services.createRootView(injector, projectableNodes || [], rootSelectorOrNode, viewDef, ngModule, EMPTY_CONTEXT);
|
9832 | var component = asProviderData(view, componentNodeIndex).instance;
|
9833 | if (rootSelectorOrNode) {
|
9834 | view.renderer.setAttribute(asElementData(view, 0).renderElement, 'ng-version', VERSION.full);
|
9835 | }
|
9836 | return new ComponentRef_(view, new ViewRef_(view), component);
|
9837 | };
|
9838 | return ComponentFactory_;
|
9839 | }(ComponentFactory));
|
9840 | var ComponentRef_ = (function (_super) {
|
9841 | __extends(ComponentRef_, _super);
|
9842 | |
9843 |
|
9844 |
|
9845 |
|
9846 |
|
9847 | function ComponentRef_(_view, _viewRef, _component) {
|
9848 | var _this = _super.call(this) || this;
|
9849 | _this._view = _view;
|
9850 | _this._viewRef = _viewRef;
|
9851 | _this._component = _component;
|
9852 | _this._elDef = _this._view.def.nodes[0];
|
9853 | return _this;
|
9854 | }
|
9855 | Object.defineProperty(ComponentRef_.prototype, "location", {
|
9856 | |
9857 |
|
9858 |
|
9859 | get: function () {
|
9860 | return new ElementRef(asElementData(this._view, this._elDef.index).renderElement);
|
9861 | },
|
9862 | enumerable: true,
|
9863 | configurable: true
|
9864 | });
|
9865 | Object.defineProperty(ComponentRef_.prototype, "injector", {
|
9866 | |
9867 |
|
9868 |
|
9869 | get: function () { return new Injector_(this._view, this._elDef); },
|
9870 | enumerable: true,
|
9871 | configurable: true
|
9872 | });
|
9873 | Object.defineProperty(ComponentRef_.prototype, "instance", {
|
9874 | |
9875 |
|
9876 |
|
9877 | get: function () { return this._component; },
|
9878 | enumerable: true,
|
9879 | configurable: true
|
9880 | });
|
9881 |
|
9882 | Object.defineProperty(ComponentRef_.prototype, "hostView", {
|
9883 | |
9884 |
|
9885 |
|
9886 | get: function () { return this._viewRef; },
|
9887 | enumerable: true,
|
9888 | configurable: true
|
9889 | });
|
9890 |
|
9891 | Object.defineProperty(ComponentRef_.prototype, "changeDetectorRef", {
|
9892 | |
9893 |
|
9894 |
|
9895 | get: function () { return this._viewRef; },
|
9896 | enumerable: true,
|
9897 | configurable: true
|
9898 | });
|
9899 |
|
9900 | Object.defineProperty(ComponentRef_.prototype, "componentType", {
|
9901 | |
9902 |
|
9903 |
|
9904 | get: function () { return (this._component.constructor); },
|
9905 | enumerable: true,
|
9906 | configurable: true
|
9907 | });
|
9908 | |
9909 |
|
9910 |
|
9911 | ComponentRef_.prototype.destroy = function () { this._viewRef.destroy(); };
|
9912 | |
9913 |
|
9914 |
|
9915 |
|
9916 | ComponentRef_.prototype.onDestroy = function (callback) { this._viewRef.onDestroy(callback); };
|
9917 | return ComponentRef_;
|
9918 | }(ComponentRef));
|
9919 |
|
9920 |
|
9921 |
|
9922 |
|
9923 |
|
9924 |
|
9925 | function createViewContainerData(view, elDef, elData) {
|
9926 | return new ViewContainerRef_(view, elDef, elData);
|
9927 | }
|
9928 | var ViewContainerRef_ = (function () {
|
9929 | |
9930 |
|
9931 |
|
9932 |
|
9933 |
|
9934 | function ViewContainerRef_(_view, _elDef, _data) {
|
9935 | this._view = _view;
|
9936 | this._elDef = _elDef;
|
9937 | this._data = _data;
|
9938 | |
9939 |
|
9940 |
|
9941 | this._embeddedViews = [];
|
9942 | }
|
9943 | Object.defineProperty(ViewContainerRef_.prototype, "element", {
|
9944 | |
9945 |
|
9946 |
|
9947 | get: function () { return new ElementRef(this._data.renderElement); },
|
9948 | enumerable: true,
|
9949 | configurable: true
|
9950 | });
|
9951 | Object.defineProperty(ViewContainerRef_.prototype, "injector", {
|
9952 | |
9953 |
|
9954 |
|
9955 | get: function () { return new Injector_(this._view, this._elDef); },
|
9956 | enumerable: true,
|
9957 | configurable: true
|
9958 | });
|
9959 | Object.defineProperty(ViewContainerRef_.prototype, "parentInjector", {
|
9960 | |
9961 |
|
9962 |
|
9963 | get: function () {
|
9964 | var view = this._view;
|
9965 | var elDef = this._elDef.parent;
|
9966 | while (!elDef && view) {
|
9967 | elDef = viewParentEl(view);
|
9968 | view = ((view.parent));
|
9969 | }
|
9970 | return view ? new Injector_(view, elDef) : new Injector_(this._view, null);
|
9971 | },
|
9972 | enumerable: true,
|
9973 | configurable: true
|
9974 | });
|
9975 | |
9976 |
|
9977 |
|
9978 | ViewContainerRef_.prototype.clear = function () {
|
9979 | var len = this._embeddedViews.length;
|
9980 | for (var i = len - 1; i >= 0; i--) {
|
9981 | var view = ((detachEmbeddedView(this._data, i)));
|
9982 | Services.destroyView(view);
|
9983 | }
|
9984 | };
|
9985 | |
9986 |
|
9987 |
|
9988 |
|
9989 | ViewContainerRef_.prototype.get = function (index) {
|
9990 | var view = this._embeddedViews[index];
|
9991 | if (view) {
|
9992 | var ref = new ViewRef_(view);
|
9993 | ref.attachToViewContainerRef(this);
|
9994 | return ref;
|
9995 | }
|
9996 | return null;
|
9997 | };
|
9998 | Object.defineProperty(ViewContainerRef_.prototype, "length", {
|
9999 | |
10000 |
|
10001 |
|
10002 | get: function () { return this._embeddedViews.length; },
|
10003 | enumerable: true,
|
10004 | configurable: true
|
10005 | });
|
10006 |
|
10007 | |
10008 |
|
10009 |
|
10010 |
|
10011 |
|
10012 |
|
10013 |
|
10014 | ViewContainerRef_.prototype.createEmbeddedView = function (templateRef, context, index) {
|
10015 | var viewRef = templateRef.createEmbeddedView(context || ({}));
|
10016 | this.insert(viewRef, index);
|
10017 | return viewRef;
|
10018 | };
|
10019 | |
10020 |
|
10021 |
|
10022 |
|
10023 |
|
10024 |
|
10025 |
|
10026 |
|
10027 |
|
10028 | ViewContainerRef_.prototype.createComponent = function (componentFactory, index, injector, projectableNodes, ngModuleRef) {
|
10029 | var contextInjector = injector || this.parentInjector;
|
10030 | if (!ngModuleRef && !(componentFactory instanceof ComponentFactoryBoundToModule)) {
|
10031 | ngModuleRef = contextInjector.get(NgModuleRef);
|
10032 | }
|
10033 | var componentRef = componentFactory.create(contextInjector, projectableNodes, undefined, ngModuleRef);
|
10034 | this.insert(componentRef.hostView, index);
|
10035 | return componentRef;
|
10036 | };
|
10037 | |
10038 |
|
10039 |
|
10040 |
|
10041 |
|
10042 | ViewContainerRef_.prototype.insert = function (viewRef, index) {
|
10043 | var viewRef_ = (viewRef);
|
10044 | var viewData = viewRef_._view;
|
10045 | attachEmbeddedView(this._view, this._data, index, viewData);
|
10046 | viewRef_.attachToViewContainerRef(this);
|
10047 | return viewRef;
|
10048 | };
|
10049 | |
10050 |
|
10051 |
|
10052 |
|
10053 |
|
10054 | ViewContainerRef_.prototype.move = function (viewRef, currentIndex) {
|
10055 | var previousIndex = this._embeddedViews.indexOf(viewRef._view);
|
10056 | moveEmbeddedView(this._data, previousIndex, currentIndex);
|
10057 | return viewRef;
|
10058 | };
|
10059 | |
10060 |
|
10061 |
|
10062 |
|
10063 | ViewContainerRef_.prototype.indexOf = function (viewRef) {
|
10064 | return this._embeddedViews.indexOf(((viewRef))._view);
|
10065 | };
|
10066 | |
10067 |
|
10068 |
|
10069 |
|
10070 | ViewContainerRef_.prototype.remove = function (index) {
|
10071 | var viewData = detachEmbeddedView(this._data, index);
|
10072 | if (viewData) {
|
10073 | Services.destroyView(viewData);
|
10074 | }
|
10075 | };
|
10076 | |
10077 |
|
10078 |
|
10079 |
|
10080 | ViewContainerRef_.prototype.detach = function (index) {
|
10081 | var view = detachEmbeddedView(this._data, index);
|
10082 | return view ? new ViewRef_(view) : null;
|
10083 | };
|
10084 | return ViewContainerRef_;
|
10085 | }());
|
10086 |
|
10087 |
|
10088 |
|
10089 |
|
10090 | function createChangeDetectorRef(view) {
|
10091 | return new ViewRef_(view);
|
10092 | }
|
10093 | var ViewRef_ = (function () {
|
10094 | |
10095 |
|
10096 |
|
10097 | function ViewRef_(_view) {
|
10098 | this._view = _view;
|
10099 | this._viewContainerRef = null;
|
10100 | this._appRef = null;
|
10101 | }
|
10102 | Object.defineProperty(ViewRef_.prototype, "rootNodes", {
|
10103 | |
10104 |
|
10105 |
|
10106 | get: function () { return rootRenderNodes(this._view); },
|
10107 | enumerable: true,
|
10108 | configurable: true
|
10109 | });
|
10110 | Object.defineProperty(ViewRef_.prototype, "context", {
|
10111 | |
10112 |
|
10113 |
|
10114 | get: function () { return this._view.context; },
|
10115 | enumerable: true,
|
10116 | configurable: true
|
10117 | });
|
10118 | Object.defineProperty(ViewRef_.prototype, "destroyed", {
|
10119 | |
10120 |
|
10121 |
|
10122 | get: function () { return (this._view.state & 16 ) !== 0; },
|
10123 | enumerable: true,
|
10124 | configurable: true
|
10125 | });
|
10126 | |
10127 |
|
10128 |
|
10129 | ViewRef_.prototype.markForCheck = function () { markParentViewsForCheck(this._view); };
|
10130 | |
10131 |
|
10132 |
|
10133 | ViewRef_.prototype.detach = function () { this._view.state &= ~4 ; };
|
10134 | |
10135 |
|
10136 |
|
10137 | ViewRef_.prototype.detectChanges = function () { Services.checkAndUpdateView(this._view); };
|
10138 | |
10139 |
|
10140 |
|
10141 | ViewRef_.prototype.checkNoChanges = function () { Services.checkNoChangesView(this._view); };
|
10142 | |
10143 |
|
10144 |
|
10145 | ViewRef_.prototype.reattach = function () { this._view.state |= 4 ; };
|
10146 | |
10147 |
|
10148 |
|
10149 |
|
10150 | ViewRef_.prototype.onDestroy = function (callback) {
|
10151 | if (!this._view.disposables) {
|
10152 | this._view.disposables = [];
|
10153 | }
|
10154 | this._view.disposables.push( (callback));
|
10155 | };
|
10156 | |
10157 |
|
10158 |
|
10159 | ViewRef_.prototype.destroy = function () {
|
10160 | if (this._appRef) {
|
10161 | this._appRef.detachView(this);
|
10162 | }
|
10163 | else if (this._viewContainerRef) {
|
10164 | this._viewContainerRef.detach(this._viewContainerRef.indexOf(this));
|
10165 | }
|
10166 | Services.destroyView(this._view);
|
10167 | };
|
10168 | |
10169 |
|
10170 |
|
10171 | ViewRef_.prototype.detachFromAppRef = function () {
|
10172 | this._appRef = null;
|
10173 | renderDetachView(this._view);
|
10174 | Services.dirtyParentQueries(this._view);
|
10175 | };
|
10176 | |
10177 |
|
10178 |
|
10179 |
|
10180 | ViewRef_.prototype.attachToAppRef = function (appRef) {
|
10181 | if (this._viewContainerRef) {
|
10182 | throw new Error('This view is already attached to a ViewContainer!');
|
10183 | }
|
10184 | this._appRef = appRef;
|
10185 | };
|
10186 | |
10187 |
|
10188 |
|
10189 |
|
10190 | ViewRef_.prototype.attachToViewContainerRef = function (vcRef) {
|
10191 | if (this._appRef) {
|
10192 | throw new Error('This view is already attached directly to the ApplicationRef!');
|
10193 | }
|
10194 | this._viewContainerRef = vcRef;
|
10195 | };
|
10196 | return ViewRef_;
|
10197 | }());
|
10198 |
|
10199 |
|
10200 |
|
10201 |
|
10202 |
|
10203 | function createTemplateData(view, def) {
|
10204 | return new TemplateRef_(view, def);
|
10205 | }
|
10206 | var TemplateRef_ = (function (_super) {
|
10207 | __extends(TemplateRef_, _super);
|
10208 | |
10209 |
|
10210 |
|
10211 |
|
10212 | function TemplateRef_(_parentView, _def) {
|
10213 | var _this = _super.call(this) || this;
|
10214 | _this._parentView = _parentView;
|
10215 | _this._def = _def;
|
10216 | return _this;
|
10217 | }
|
10218 | |
10219 |
|
10220 |
|
10221 |
|
10222 | TemplateRef_.prototype.createEmbeddedView = function (context) {
|
10223 | return new ViewRef_(Services.createEmbeddedView(this._parentView, this._def, context));
|
10224 | };
|
10225 | Object.defineProperty(TemplateRef_.prototype, "elementRef", {
|
10226 | |
10227 |
|
10228 |
|
10229 | get: function () {
|
10230 | return new ElementRef(asElementData(this._parentView, this._def.index).renderElement);
|
10231 | },
|
10232 | enumerable: true,
|
10233 | configurable: true
|
10234 | });
|
10235 | return TemplateRef_;
|
10236 | }(TemplateRef));
|
10237 |
|
10238 |
|
10239 |
|
10240 |
|
10241 |
|
10242 | function createInjector(view, elDef) {
|
10243 | return new Injector_(view, elDef);
|
10244 | }
|
10245 | var Injector_ = (function () {
|
10246 | |
10247 |
|
10248 |
|
10249 |
|
10250 | function Injector_(view, elDef) {
|
10251 | this.view = view;
|
10252 | this.elDef = elDef;
|
10253 | }
|
10254 | |
10255 |
|
10256 |
|
10257 |
|
10258 |
|
10259 | Injector_.prototype.get = function (token, notFoundValue) {
|
10260 | if (notFoundValue === void 0) { notFoundValue = Injector.THROW_IF_NOT_FOUND; }
|
10261 | var allowPrivateServices = this.elDef ? (this.elDef.flags & 16777216 ) !== 0 : false;
|
10262 | return Services.resolveDep(this.view, this.elDef, allowPrivateServices, { flags: 0 , token: token, tokenKey: tokenKey(token) }, notFoundValue);
|
10263 | };
|
10264 | return Injector_;
|
10265 | }());
|
10266 |
|
10267 |
|
10268 |
|
10269 |
|
10270 |
|
10271 | function nodeValue(view, index) {
|
10272 | var def = view.def.nodes[index];
|
10273 | if (def.flags & 1 ) {
|
10274 | var elData = asElementData(view, def.index);
|
10275 | return ((def.element)).template ? elData.template : elData.renderElement;
|
10276 | }
|
10277 | else if (def.flags & 2 ) {
|
10278 | return asTextData(view, def.index).renderText;
|
10279 | }
|
10280 | else if (def.flags & (10112 | 8 )) {
|
10281 | return asProviderData(view, def.index).instance;
|
10282 | }
|
10283 | throw new Error("Illegal state: read nodeValue for node index " + index);
|
10284 | }
|
10285 |
|
10286 |
|
10287 |
|
10288 |
|
10289 | function createRendererV1(view) {
|
10290 | return new RendererAdapter(view.renderer);
|
10291 | }
|
10292 | var RendererAdapter = (function () {
|
10293 | |
10294 |
|
10295 |
|
10296 | function RendererAdapter(delegate) {
|
10297 | this.delegate = delegate;
|
10298 | }
|
10299 | |
10300 |
|
10301 |
|
10302 |
|
10303 | RendererAdapter.prototype.selectRootElement = function (selectorOrNode) {
|
10304 | return this.delegate.selectRootElement(selectorOrNode);
|
10305 | };
|
10306 | |
10307 |
|
10308 |
|
10309 |
|
10310 |
|
10311 | RendererAdapter.prototype.createElement = function (parent, namespaceAndName) {
|
10312 | var _a = splitNamespace(namespaceAndName), ns = _a[0], name = _a[1];
|
10313 | var el = this.delegate.createElement(name, ns);
|
10314 | if (parent) {
|
10315 | this.delegate.appendChild(parent, el);
|
10316 | }
|
10317 | return el;
|
10318 | };
|
10319 | |
10320 |
|
10321 |
|
10322 |
|
10323 | RendererAdapter.prototype.createViewRoot = function (hostElement) { return hostElement; };
|
10324 | |
10325 |
|
10326 |
|
10327 |
|
10328 | RendererAdapter.prototype.createTemplateAnchor = function (parentElement) {
|
10329 | var comment = this.delegate.createComment('');
|
10330 | if (parentElement) {
|
10331 | this.delegate.appendChild(parentElement, comment);
|
10332 | }
|
10333 | return comment;
|
10334 | };
|
10335 | |
10336 |
|
10337 |
|
10338 |
|
10339 |
|
10340 | RendererAdapter.prototype.createText = function (parentElement, value) {
|
10341 | var node = this.delegate.createText(value);
|
10342 | if (parentElement) {
|
10343 | this.delegate.appendChild(parentElement, node);
|
10344 | }
|
10345 | return node;
|
10346 | };
|
10347 | |
10348 |
|
10349 |
|
10350 |
|
10351 |
|
10352 | RendererAdapter.prototype.projectNodes = function (parentElement, nodes) {
|
10353 | for (var i = 0; i < nodes.length; i++) {
|
10354 | this.delegate.appendChild(parentElement, nodes[i]);
|
10355 | }
|
10356 | };
|
10357 | |
10358 |
|
10359 |
|
10360 |
|
10361 |
|
10362 | RendererAdapter.prototype.attachViewAfter = function (node, viewRootNodes) {
|
10363 | var parentElement = this.delegate.parentNode(node);
|
10364 | var nextSibling = this.delegate.nextSibling(node);
|
10365 | for (var i = 0; i < viewRootNodes.length; i++) {
|
10366 | this.delegate.insertBefore(parentElement, viewRootNodes[i], nextSibling);
|
10367 | }
|
10368 | };
|
10369 | |
10370 |
|
10371 |
|
10372 |
|
10373 | RendererAdapter.prototype.detachView = function (viewRootNodes) {
|
10374 | for (var i = 0; i < viewRootNodes.length; i++) {
|
10375 | var node = viewRootNodes[i];
|
10376 | var parentElement = this.delegate.parentNode(node);
|
10377 | this.delegate.removeChild(parentElement, node);
|
10378 | }
|
10379 | };
|
10380 | |
10381 |
|
10382 |
|
10383 |
|
10384 |
|
10385 | RendererAdapter.prototype.destroyView = function (hostElement, viewAllNodes) {
|
10386 | for (var i = 0; i < viewAllNodes.length; i++) {
|
10387 | ((this.delegate.destroyNode))(viewAllNodes[i]);
|
10388 | }
|
10389 | };
|
10390 | |
10391 |
|
10392 |
|
10393 |
|
10394 |
|
10395 |
|
10396 | RendererAdapter.prototype.listen = function (renderElement, name, callback) {
|
10397 | return this.delegate.listen(renderElement, name, (callback));
|
10398 | };
|
10399 | |
10400 |
|
10401 |
|
10402 |
|
10403 |
|
10404 |
|
10405 | RendererAdapter.prototype.listenGlobal = function (target, name, callback) {
|
10406 | return this.delegate.listen(target, name, (callback));
|
10407 | };
|
10408 | |
10409 |
|
10410 |
|
10411 |
|
10412 |
|
10413 |
|
10414 | RendererAdapter.prototype.setElementProperty = function (renderElement, propertyName, propertyValue) {
|
10415 | this.delegate.setProperty(renderElement, propertyName, propertyValue);
|
10416 | };
|
10417 | |
10418 |
|
10419 |
|
10420 |
|
10421 |
|
10422 |
|
10423 | RendererAdapter.prototype.setElementAttribute = function (renderElement, namespaceAndName, attributeValue) {
|
10424 | var _a = splitNamespace(namespaceAndName), ns = _a[0], name = _a[1];
|
10425 | if (attributeValue != null) {
|
10426 | this.delegate.setAttribute(renderElement, name, attributeValue, ns);
|
10427 | }
|
10428 | else {
|
10429 | this.delegate.removeAttribute(renderElement, name, ns);
|
10430 | }
|
10431 | };
|
10432 | |
10433 |
|
10434 |
|
10435 |
|
10436 |
|
10437 |
|
10438 | RendererAdapter.prototype.setBindingDebugInfo = function (renderElement, propertyName, propertyValue) { };
|
10439 | |
10440 |
|
10441 |
|
10442 |
|
10443 |
|
10444 |
|
10445 | RendererAdapter.prototype.setElementClass = function (renderElement, className, isAdd) {
|
10446 | if (isAdd) {
|
10447 | this.delegate.addClass(renderElement, className);
|
10448 | }
|
10449 | else {
|
10450 | this.delegate.removeClass(renderElement, className);
|
10451 | }
|
10452 | };
|
10453 | |
10454 |
|
10455 |
|
10456 |
|
10457 |
|
10458 |
|
10459 | RendererAdapter.prototype.setElementStyle = function (renderElement, styleName, styleValue) {
|
10460 | if (styleValue != null) {
|
10461 | this.delegate.setStyle(renderElement, styleName, styleValue);
|
10462 | }
|
10463 | else {
|
10464 | this.delegate.removeStyle(renderElement, styleName);
|
10465 | }
|
10466 | };
|
10467 | |
10468 |
|
10469 |
|
10470 |
|
10471 |
|
10472 |
|
10473 | RendererAdapter.prototype.invokeElementMethod = function (renderElement, methodName, args) {
|
10474 | ((renderElement))[methodName].apply(renderElement, args);
|
10475 | };
|
10476 | |
10477 |
|
10478 |
|
10479 |
|
10480 |
|
10481 | RendererAdapter.prototype.setText = function (renderNode$$1, text) { this.delegate.setValue(renderNode$$1, text); };
|
10482 | |
10483 |
|
10484 |
|
10485 | RendererAdapter.prototype.animate = function () { throw new Error('Renderer.animate is no longer supported!'); };
|
10486 | return RendererAdapter;
|
10487 | }());
|
10488 |
|
10489 |
|
10490 |
|
10491 |
|
10492 |
|
10493 |
|
10494 |
|
10495 | var RendererV1TokenKey = tokenKey(Renderer);
|
10496 | var Renderer2TokenKey = tokenKey(Renderer2);
|
10497 | var ElementRefTokenKey = tokenKey(ElementRef);
|
10498 | var ViewContainerRefTokenKey = tokenKey(ViewContainerRef);
|
10499 | var TemplateRefTokenKey = tokenKey(TemplateRef);
|
10500 | var ChangeDetectorRefTokenKey = tokenKey(ChangeDetectorRef);
|
10501 | var InjectorRefTokenKey = tokenKey(Injector);
|
10502 | var NOT_CREATED = new Object();
|
10503 |
|
10504 |
|
10505 |
|
10506 |
|
10507 |
|
10508 |
|
10509 |
|
10510 |
|
10511 |
|
10512 |
|
10513 | function directiveDef(flags, matchedQueries, childCount, ctor, deps, props, outputs) {
|
10514 | var bindings = [];
|
10515 | if (props) {
|
10516 | for (var prop in props) {
|
10517 | var _a = props[prop], bindingIndex = _a[0], nonMinifiedName = _a[1];
|
10518 | bindings[bindingIndex] = {
|
10519 | flags: 8 ,
|
10520 | name: prop, nonMinifiedName: nonMinifiedName,
|
10521 | ns: null,
|
10522 | securityContext: null,
|
10523 | suffix: null
|
10524 | };
|
10525 | }
|
10526 | }
|
10527 | var outputDefs = [];
|
10528 | if (outputs) {
|
10529 | for (var propName in outputs) {
|
10530 | outputDefs.push({ type: 1 , propName: propName, target: null, eventName: outputs[propName] });
|
10531 | }
|
10532 | }
|
10533 | flags |= 8192 ;
|
10534 | return _def(flags, matchedQueries, childCount, ctor, ctor, deps, bindings, outputDefs);
|
10535 | }
|
10536 |
|
10537 |
|
10538 |
|
10539 |
|
10540 |
|
10541 |
|
10542 | function pipeDef(flags, ctor, deps) {
|
10543 | flags |= 8 ;
|
10544 | return _def(flags, null, 0, ctor, ctor, deps);
|
10545 | }
|
10546 |
|
10547 |
|
10548 |
|
10549 |
|
10550 |
|
10551 |
|
10552 |
|
10553 |
|
10554 | function providerDef(flags, matchedQueries, token, value, deps) {
|
10555 | return _def(flags, matchedQueries, 0, token, value, deps);
|
10556 | }
|
10557 |
|
10558 |
|
10559 |
|
10560 |
|
10561 |
|
10562 |
|
10563 |
|
10564 |
|
10565 |
|
10566 |
|
10567 |
|
10568 | function _def(flags, matchedQueriesDsl, childCount, token, value, deps, bindings, outputs) {
|
10569 | var _a = splitMatchedQueriesDsl(matchedQueriesDsl), matchedQueries = _a.matchedQueries, references = _a.references, matchedQueryIds = _a.matchedQueryIds;
|
10570 | if (!outputs) {
|
10571 | outputs = [];
|
10572 | }
|
10573 | if (!bindings) {
|
10574 | bindings = [];
|
10575 | }
|
10576 | var depDefs = deps.map(function (value) {
|
10577 | var token;
|
10578 | var flags;
|
10579 | if (Array.isArray(value)) {
|
10580 | flags = value[0], token = value[1];
|
10581 | }
|
10582 | else {
|
10583 | flags = 0 ;
|
10584 | token = value;
|
10585 | }
|
10586 | return { flags: flags, token: token, tokenKey: tokenKey(token) };
|
10587 | });
|
10588 | return {
|
10589 |
|
10590 | index: -1,
|
10591 | parent: null,
|
10592 | renderParent: null,
|
10593 | bindingIndex: -1,
|
10594 | outputIndex: -1,
|
10595 |
|
10596 | flags: flags,
|
10597 | childFlags: 0,
|
10598 | directChildFlags: 0,
|
10599 | childMatchedQueries: 0, matchedQueries: matchedQueries, matchedQueryIds: matchedQueryIds, references: references,
|
10600 | ngContentIndex: -1, childCount: childCount, bindings: bindings,
|
10601 | bindingFlags: calcBindingFlags(bindings), outputs: outputs,
|
10602 | element: null,
|
10603 | provider: { token: token, tokenKey: tokenKey(token), value: value, deps: depDefs },
|
10604 | text: null,
|
10605 | query: null,
|
10606 | ngContent: null
|
10607 | };
|
10608 | }
|
10609 |
|
10610 |
|
10611 |
|
10612 |
|
10613 |
|
10614 | function createProviderInstance(view, def) {
|
10615 | return def.flags & 2048 ? NOT_CREATED : _createProviderInstance(view, def);
|
10616 | }
|
10617 |
|
10618 |
|
10619 |
|
10620 |
|
10621 |
|
10622 | function createPipeInstance(view, def) {
|
10623 |
|
10624 | var compView = view;
|
10625 | while (compView.parent && !isComponentView(compView)) {
|
10626 | compView = compView.parent;
|
10627 | }
|
10628 |
|
10629 | var allowPrivateServices = true;
|
10630 |
|
10631 | return createClass( ((compView.parent)), ((viewParentEl(compView))), allowPrivateServices, ((def.provider)).value, ((def.provider)).deps);
|
10632 | }
|
10633 |
|
10634 |
|
10635 |
|
10636 |
|
10637 |
|
10638 | function createDirectiveInstance(view, def) {
|
10639 |
|
10640 | var allowPrivateServices = (def.flags & 16384 ) > 0;
|
10641 |
|
10642 | var instance = createClass(view, ((def.parent)), allowPrivateServices, ((def.provider)).value, ((def.provider)).deps);
|
10643 | if (def.outputs.length) {
|
10644 | for (var i = 0; i < def.outputs.length; i++) {
|
10645 | var output = def.outputs[i];
|
10646 | var subscription = instance[((output.propName))].subscribe(eventHandlerClosure(view, ((def.parent)).index, output.eventName));
|
10647 | ((view.disposables))[def.outputIndex + i] = subscription.unsubscribe.bind(subscription);
|
10648 | }
|
10649 | }
|
10650 | return instance;
|
10651 | }
|
10652 |
|
10653 |
|
10654 |
|
10655 |
|
10656 |
|
10657 |
|
10658 | function eventHandlerClosure(view, index, eventName) {
|
10659 | return function (event) {
|
10660 | try {
|
10661 | return dispatchEvent(view, index, eventName, event);
|
10662 | }
|
10663 | catch (e) {
|
10664 |
|
10665 | view.root.errorHandler.handleError(e);
|
10666 | }
|
10667 | };
|
10668 | }
|
10669 |
|
10670 |
|
10671 |
|
10672 |
|
10673 |
|
10674 |
|
10675 |
|
10676 |
|
10677 |
|
10678 |
|
10679 |
|
10680 |
|
10681 |
|
10682 |
|
10683 |
|
10684 | function checkAndUpdateDirectiveInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
10685 | var providerData = asProviderData(view, def.index);
|
10686 | var directive = providerData.instance;
|
10687 | var changed = false;
|
10688 | var changes = ((undefined));
|
10689 | var bindLen = def.bindings.length;
|
10690 | if (bindLen > 0 && checkBinding(view, def, 0, v0)) {
|
10691 | changed = true;
|
10692 | changes = updateProp(view, providerData, def, 0, v0, changes);
|
10693 | }
|
10694 | if (bindLen > 1 && checkBinding(view, def, 1, v1)) {
|
10695 | changed = true;
|
10696 | changes = updateProp(view, providerData, def, 1, v1, changes);
|
10697 | }
|
10698 | if (bindLen > 2 && checkBinding(view, def, 2, v2)) {
|
10699 | changed = true;
|
10700 | changes = updateProp(view, providerData, def, 2, v2, changes);
|
10701 | }
|
10702 | if (bindLen > 3 && checkBinding(view, def, 3, v3)) {
|
10703 | changed = true;
|
10704 | changes = updateProp(view, providerData, def, 3, v3, changes);
|
10705 | }
|
10706 | if (bindLen > 4 && checkBinding(view, def, 4, v4)) {
|
10707 | changed = true;
|
10708 | changes = updateProp(view, providerData, def, 4, v4, changes);
|
10709 | }
|
10710 | if (bindLen > 5 && checkBinding(view, def, 5, v5)) {
|
10711 | changed = true;
|
10712 | changes = updateProp(view, providerData, def, 5, v5, changes);
|
10713 | }
|
10714 | if (bindLen > 6 && checkBinding(view, def, 6, v6)) {
|
10715 | changed = true;
|
10716 | changes = updateProp(view, providerData, def, 6, v6, changes);
|
10717 | }
|
10718 | if (bindLen > 7 && checkBinding(view, def, 7, v7)) {
|
10719 | changed = true;
|
10720 | changes = updateProp(view, providerData, def, 7, v7, changes);
|
10721 | }
|
10722 | if (bindLen > 8 && checkBinding(view, def, 8, v8)) {
|
10723 | changed = true;
|
10724 | changes = updateProp(view, providerData, def, 8, v8, changes);
|
10725 | }
|
10726 | if (bindLen > 9 && checkBinding(view, def, 9, v9)) {
|
10727 | changed = true;
|
10728 | changes = updateProp(view, providerData, def, 9, v9, changes);
|
10729 | }
|
10730 | if (changes) {
|
10731 | directive.ngOnChanges(changes);
|
10732 | }
|
10733 | if ((view.state & 2 ) && (def.flags & 32768 )) {
|
10734 | directive.ngOnInit();
|
10735 | }
|
10736 | if (def.flags & 131072 ) {
|
10737 | directive.ngDoCheck();
|
10738 | }
|
10739 | return changed;
|
10740 | }
|
10741 |
|
10742 |
|
10743 |
|
10744 |
|
10745 |
|
10746 |
|
10747 | function checkAndUpdateDirectiveDynamic(view, def, values) {
|
10748 | var providerData = asProviderData(view, def.index);
|
10749 | var directive = providerData.instance;
|
10750 | var changed = false;
|
10751 | var changes = ((undefined));
|
10752 | for (var i = 0; i < values.length; i++) {
|
10753 | if (checkBinding(view, def, i, values[i])) {
|
10754 | changed = true;
|
10755 | changes = updateProp(view, providerData, def, i, values[i], changes);
|
10756 | }
|
10757 | }
|
10758 | if (changes) {
|
10759 | directive.ngOnChanges(changes);
|
10760 | }
|
10761 | if ((view.state & 2 ) && (def.flags & 32768 )) {
|
10762 | directive.ngOnInit();
|
10763 | }
|
10764 | if (def.flags & 131072 ) {
|
10765 | directive.ngDoCheck();
|
10766 | }
|
10767 | return changed;
|
10768 | }
|
10769 |
|
10770 |
|
10771 |
|
10772 |
|
10773 |
|
10774 | function _createProviderInstance(view, def) {
|
10775 |
|
10776 | var allowPrivateServices = (def.flags & 4096 ) > 0;
|
10777 | var providerDef = def.provider;
|
10778 | var injectable;
|
10779 | switch (def.flags & 100673535 ) {
|
10780 | case 256 :
|
10781 | injectable = createClass(view, ((def.parent)), allowPrivateServices, ((providerDef)).value, ((providerDef)).deps);
|
10782 | break;
|
10783 | case 512 :
|
10784 | injectable = callFactory(view, ((def.parent)), allowPrivateServices, ((providerDef)).value, ((providerDef)).deps);
|
10785 | break;
|
10786 | case 1024 :
|
10787 | injectable = resolveDep(view, ((def.parent)), allowPrivateServices, ((providerDef)).deps[0]);
|
10788 | break;
|
10789 | case 128 :
|
10790 | injectable = ((providerDef)).value;
|
10791 | break;
|
10792 | }
|
10793 | return injectable;
|
10794 | }
|
10795 |
|
10796 |
|
10797 |
|
10798 |
|
10799 |
|
10800 |
|
10801 |
|
10802 |
|
10803 | function createClass(view, elDef, allowPrivateServices, ctor, deps) {
|
10804 | var len = deps.length;
|
10805 | var injectable;
|
10806 | switch (len) {
|
10807 | case 0:
|
10808 | injectable = new ctor();
|
10809 | break;
|
10810 | case 1:
|
10811 | injectable = new ctor(resolveDep(view, elDef, allowPrivateServices, deps[0]));
|
10812 | break;
|
10813 | case 2:
|
10814 | injectable = new ctor(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]));
|
10815 | break;
|
10816 | case 3:
|
10817 | injectable = new ctor(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]), resolveDep(view, elDef, allowPrivateServices, deps[2]));
|
10818 | break;
|
10819 | default:
|
10820 | var depValues = new Array(len);
|
10821 | for (var i = 0; i < len; i++) {
|
10822 | depValues[i] = resolveDep(view, elDef, allowPrivateServices, deps[i]);
|
10823 | }
|
10824 | injectable = new (ctor.bind.apply(ctor, [void 0].concat(depValues)))();
|
10825 | }
|
10826 | return injectable;
|
10827 | }
|
10828 |
|
10829 |
|
10830 |
|
10831 |
|
10832 |
|
10833 |
|
10834 |
|
10835 |
|
10836 | function callFactory(view, elDef, allowPrivateServices, factory, deps) {
|
10837 | var len = deps.length;
|
10838 | var injectable;
|
10839 | switch (len) {
|
10840 | case 0:
|
10841 | injectable = factory();
|
10842 | break;
|
10843 | case 1:
|
10844 | injectable = factory(resolveDep(view, elDef, allowPrivateServices, deps[0]));
|
10845 | break;
|
10846 | case 2:
|
10847 | injectable = factory(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]));
|
10848 | break;
|
10849 | case 3:
|
10850 | injectable = factory(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]), resolveDep(view, elDef, allowPrivateServices, deps[2]));
|
10851 | break;
|
10852 | default:
|
10853 | var depValues = Array(len);
|
10854 | for (var i = 0; i < len; i++) {
|
10855 | depValues[i] = resolveDep(view, elDef, allowPrivateServices, deps[i]);
|
10856 | }
|
10857 | injectable = factory.apply(void 0, depValues);
|
10858 | }
|
10859 | return injectable;
|
10860 | }
|
10861 |
|
10862 |
|
10863 |
|
10864 |
|
10865 |
|
10866 |
|
10867 |
|
10868 |
|
10869 |
|
10870 |
|
10871 |
|
10872 |
|
10873 |
|
10874 |
|
10875 |
|
10876 |
|
10877 |
|
10878 | var NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR = {};
|
10879 |
|
10880 |
|
10881 |
|
10882 |
|
10883 |
|
10884 |
|
10885 |
|
10886 |
|
10887 | function resolveDep(view, elDef, allowPrivateServices, depDef, notFoundValue) {
|
10888 | if (notFoundValue === void 0) { notFoundValue = Injector.THROW_IF_NOT_FOUND; }
|
10889 | if (depDef.flags & 8 ) {
|
10890 | return depDef.token;
|
10891 | }
|
10892 | var startView = view;
|
10893 | if (depDef.flags & 2 ) {
|
10894 | notFoundValue = null;
|
10895 | }
|
10896 | var tokenKey$$1 = depDef.tokenKey;
|
10897 | if (tokenKey$$1 === ChangeDetectorRefTokenKey) {
|
10898 |
|
10899 |
|
10900 | allowPrivateServices = !!(elDef && ((elDef.element)).componentView);
|
10901 | }
|
10902 | if (elDef && (depDef.flags & 1 )) {
|
10903 | allowPrivateServices = false;
|
10904 | elDef = ((elDef.parent));
|
10905 | }
|
10906 | while (view) {
|
10907 | if (elDef) {
|
10908 | switch (tokenKey$$1) {
|
10909 | case RendererV1TokenKey: {
|
10910 | var compView = findCompView(view, elDef, allowPrivateServices);
|
10911 | return createRendererV1(compView);
|
10912 | }
|
10913 | case Renderer2TokenKey: {
|
10914 | var compView = findCompView(view, elDef, allowPrivateServices);
|
10915 | return compView.renderer;
|
10916 | }
|
10917 | case ElementRefTokenKey:
|
10918 | return new ElementRef(asElementData(view, elDef.index).renderElement);
|
10919 | case ViewContainerRefTokenKey:
|
10920 | return asElementData(view, elDef.index).viewContainer;
|
10921 | case TemplateRefTokenKey: {
|
10922 | if (((elDef.element)).template) {
|
10923 | return asElementData(view, elDef.index).template;
|
10924 | }
|
10925 | break;
|
10926 | }
|
10927 | case ChangeDetectorRefTokenKey: {
|
10928 | var cdView = findCompView(view, elDef, allowPrivateServices);
|
10929 | return createChangeDetectorRef(cdView);
|
10930 | }
|
10931 | case InjectorRefTokenKey:
|
10932 | return createInjector(view, elDef);
|
10933 | default:
|
10934 | var providerDef_1 = (((allowPrivateServices ? ((elDef.element)).allProviders : ((elDef.element)).publicProviders)))[tokenKey$$1];
|
10935 | if (providerDef_1) {
|
10936 | var providerData = asProviderData(view, providerDef_1.index);
|
10937 | if (providerData.instance === NOT_CREATED) {
|
10938 | providerData.instance = _createProviderInstance(view, providerDef_1);
|
10939 | }
|
10940 | return providerData.instance;
|
10941 | }
|
10942 | }
|
10943 | }
|
10944 | allowPrivateServices = isComponentView(view);
|
10945 | elDef = ((viewParentEl(view)));
|
10946 | view = ((view.parent));
|
10947 | }
|
10948 | var value = startView.root.injector.get(depDef.token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR);
|
10949 | if (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR ||
|
10950 | notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) {
|
10951 |
|
10952 |
|
10953 |
|
10954 |
|
10955 |
|
10956 | return value;
|
10957 | }
|
10958 | return startView.root.ngModule.injector.get(depDef.token, notFoundValue);
|
10959 | }
|
10960 |
|
10961 |
|
10962 |
|
10963 |
|
10964 |
|
10965 |
|
10966 | function findCompView(view, elDef, allowPrivateServices) {
|
10967 | var compView;
|
10968 | if (allowPrivateServices) {
|
10969 | compView = asElementData(view, elDef.index).componentView;
|
10970 | }
|
10971 | else {
|
10972 | compView = view;
|
10973 | while (compView.parent && !isComponentView(compView)) {
|
10974 | compView = compView.parent;
|
10975 | }
|
10976 | }
|
10977 | return compView;
|
10978 | }
|
10979 |
|
10980 |
|
10981 |
|
10982 |
|
10983 |
|
10984 |
|
10985 |
|
10986 |
|
10987 |
|
10988 | function updateProp(view, providerData, def, bindingIdx, value, changes) {
|
10989 | if (def.flags & 16384 ) {
|
10990 | var compView = asElementData(view, ((def.parent)).index).componentView;
|
10991 | if (compView.def.flags & 2 ) {
|
10992 | compView.state |= 8 ;
|
10993 | }
|
10994 | }
|
10995 | var binding = def.bindings[bindingIdx];
|
10996 | var propName = ((binding.name));
|
10997 |
|
10998 |
|
10999 |
|
11000 | providerData.instance[propName] = value;
|
11001 | if (def.flags & 262144 ) {
|
11002 | changes = changes || {};
|
11003 | var oldValue = view.oldValues[def.bindingIndex + bindingIdx];
|
11004 | if (oldValue instanceof WrappedValue) {
|
11005 | oldValue = oldValue.wrapped;
|
11006 | }
|
11007 | var binding_1 = def.bindings[bindingIdx];
|
11008 | changes[((binding_1.nonMinifiedName))] =
|
11009 | new SimpleChange(oldValue, value, (view.state & 2 ) !== 0);
|
11010 | }
|
11011 | view.oldValues[def.bindingIndex + bindingIdx] = value;
|
11012 | return changes;
|
11013 | }
|
11014 |
|
11015 |
|
11016 |
|
11017 |
|
11018 |
|
11019 | function callLifecycleHooksChildrenFirst(view, lifecycles) {
|
11020 | if (!(view.def.nodeFlags & lifecycles)) {
|
11021 | return;
|
11022 | }
|
11023 | var nodes = view.def.nodes;
|
11024 | for (var i = 0; i < nodes.length; i++) {
|
11025 | var nodeDef = nodes[i];
|
11026 | var parent = nodeDef.parent;
|
11027 | if (!parent && nodeDef.flags & lifecycles) {
|
11028 |
|
11029 | callProviderLifecycles(view, i, nodeDef.flags & lifecycles);
|
11030 | }
|
11031 | if ((nodeDef.childFlags & lifecycles) === 0) {
|
11032 |
|
11033 | i += nodeDef.childCount;
|
11034 | }
|
11035 | while (parent && (parent.flags & 1 ) &&
|
11036 | i === parent.index + parent.childCount) {
|
11037 |
|
11038 | if (parent.directChildFlags & lifecycles) {
|
11039 | callElementProvidersLifecycles(view, parent, lifecycles);
|
11040 | }
|
11041 | parent = parent.parent;
|
11042 | }
|
11043 | }
|
11044 | }
|
11045 |
|
11046 |
|
11047 |
|
11048 |
|
11049 |
|
11050 |
|
11051 | function callElementProvidersLifecycles(view, elDef, lifecycles) {
|
11052 | for (var i = elDef.index + 1; i <= elDef.index + elDef.childCount; i++) {
|
11053 | var nodeDef = view.def.nodes[i];
|
11054 | if (nodeDef.flags & lifecycles) {
|
11055 | callProviderLifecycles(view, i, nodeDef.flags & lifecycles);
|
11056 | }
|
11057 |
|
11058 | i += nodeDef.childCount;
|
11059 | }
|
11060 | }
|
11061 |
|
11062 |
|
11063 |
|
11064 |
|
11065 |
|
11066 |
|
11067 | function callProviderLifecycles(view, index, lifecycles) {
|
11068 | var provider = asProviderData(view, index).instance;
|
11069 | if (provider === NOT_CREATED) {
|
11070 | return;
|
11071 | }
|
11072 | Services.setCurrentNode(view, index);
|
11073 | if (lifecycles & 524288 ) {
|
11074 | provider.ngAfterContentInit();
|
11075 | }
|
11076 | if (lifecycles & 1048576 ) {
|
11077 | provider.ngAfterContentChecked();
|
11078 | }
|
11079 | if (lifecycles & 2097152 ) {
|
11080 | provider.ngAfterViewInit();
|
11081 | }
|
11082 | if (lifecycles & 4194304 ) {
|
11083 | provider.ngAfterViewChecked();
|
11084 | }
|
11085 | if (lifecycles & 65536 ) {
|
11086 | provider.ngOnDestroy();
|
11087 | }
|
11088 | }
|
11089 |
|
11090 |
|
11091 |
|
11092 |
|
11093 |
|
11094 |
|
11095 |
|
11096 |
|
11097 |
|
11098 |
|
11099 |
|
11100 | function purePipeDef(argCount) {
|
11101 |
|
11102 | return _pureExpressionDef(64 , new Array(argCount + 1));
|
11103 | }
|
11104 |
|
11105 |
|
11106 |
|
11107 |
|
11108 | function pureArrayDef(argCount) {
|
11109 | return _pureExpressionDef(16 , new Array(argCount));
|
11110 | }
|
11111 |
|
11112 |
|
11113 |
|
11114 |
|
11115 | function pureObjectDef(propertyNames) {
|
11116 | return _pureExpressionDef(32 , propertyNames);
|
11117 | }
|
11118 |
|
11119 |
|
11120 |
|
11121 |
|
11122 |
|
11123 | function _pureExpressionDef(flags, propertyNames) {
|
11124 | var bindings = new Array(propertyNames.length);
|
11125 | for (var i = 0; i < propertyNames.length; i++) {
|
11126 | var prop = propertyNames[i];
|
11127 | bindings[i] = {
|
11128 | flags: 8 ,
|
11129 | name: prop,
|
11130 | ns: null,
|
11131 | nonMinifiedName: prop,
|
11132 | securityContext: null,
|
11133 | suffix: null
|
11134 | };
|
11135 | }
|
11136 | return {
|
11137 |
|
11138 | index: -1,
|
11139 | parent: null,
|
11140 | renderParent: null,
|
11141 | bindingIndex: -1,
|
11142 | outputIndex: -1,
|
11143 |
|
11144 | flags: flags,
|
11145 | childFlags: 0,
|
11146 | directChildFlags: 0,
|
11147 | childMatchedQueries: 0,
|
11148 | matchedQueries: {},
|
11149 | matchedQueryIds: 0,
|
11150 | references: {},
|
11151 | ngContentIndex: -1,
|
11152 | childCount: 0, bindings: bindings,
|
11153 | bindingFlags: calcBindingFlags(bindings),
|
11154 | outputs: [],
|
11155 | element: null,
|
11156 | provider: null,
|
11157 | text: null,
|
11158 | query: null,
|
11159 | ngContent: null
|
11160 | };
|
11161 | }
|
11162 |
|
11163 |
|
11164 |
|
11165 |
|
11166 |
|
11167 | function createPureExpression(view, def) {
|
11168 | return { value: undefined };
|
11169 | }
|
11170 |
|
11171 |
|
11172 |
|
11173 |
|
11174 |
|
11175 |
|
11176 |
|
11177 |
|
11178 |
|
11179 |
|
11180 |
|
11181 |
|
11182 |
|
11183 |
|
11184 |
|
11185 | function checkAndUpdatePureExpressionInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
11186 | var bindings = def.bindings;
|
11187 | var changed = false;
|
11188 | var bindLen = bindings.length;
|
11189 | if (bindLen > 0 && checkAndUpdateBinding(view, def, 0, v0))
|
11190 | changed = true;
|
11191 | if (bindLen > 1 && checkAndUpdateBinding(view, def, 1, v1))
|
11192 | changed = true;
|
11193 | if (bindLen > 2 && checkAndUpdateBinding(view, def, 2, v2))
|
11194 | changed = true;
|
11195 | if (bindLen > 3 && checkAndUpdateBinding(view, def, 3, v3))
|
11196 | changed = true;
|
11197 | if (bindLen > 4 && checkAndUpdateBinding(view, def, 4, v4))
|
11198 | changed = true;
|
11199 | if (bindLen > 5 && checkAndUpdateBinding(view, def, 5, v5))
|
11200 | changed = true;
|
11201 | if (bindLen > 6 && checkAndUpdateBinding(view, def, 6, v6))
|
11202 | changed = true;
|
11203 | if (bindLen > 7 && checkAndUpdateBinding(view, def, 7, v7))
|
11204 | changed = true;
|
11205 | if (bindLen > 8 && checkAndUpdateBinding(view, def, 8, v8))
|
11206 | changed = true;
|
11207 | if (bindLen > 9 && checkAndUpdateBinding(view, def, 9, v9))
|
11208 | changed = true;
|
11209 | if (changed) {
|
11210 | var data = asPureExpressionData(view, def.index);
|
11211 | var value = void 0;
|
11212 | switch (def.flags & 100673535 ) {
|
11213 | case 16 :
|
11214 | value = new Array(bindings.length);
|
11215 | if (bindLen > 0)
|
11216 | value[0] = v0;
|
11217 | if (bindLen > 1)
|
11218 | value[1] = v1;
|
11219 | if (bindLen > 2)
|
11220 | value[2] = v2;
|
11221 | if (bindLen > 3)
|
11222 | value[3] = v3;
|
11223 | if (bindLen > 4)
|
11224 | value[4] = v4;
|
11225 | if (bindLen > 5)
|
11226 | value[5] = v5;
|
11227 | if (bindLen > 6)
|
11228 | value[6] = v6;
|
11229 | if (bindLen > 7)
|
11230 | value[7] = v7;
|
11231 | if (bindLen > 8)
|
11232 | value[8] = v8;
|
11233 | if (bindLen > 9)
|
11234 | value[9] = v9;
|
11235 | break;
|
11236 | case 32 :
|
11237 | value = {};
|
11238 | if (bindLen > 0)
|
11239 | value[((bindings[0].name))] = v0;
|
11240 | if (bindLen > 1)
|
11241 | value[((bindings[1].name))] = v1;
|
11242 | if (bindLen > 2)
|
11243 | value[((bindings[2].name))] = v2;
|
11244 | if (bindLen > 3)
|
11245 | value[((bindings[3].name))] = v3;
|
11246 | if (bindLen > 4)
|
11247 | value[((bindings[4].name))] = v4;
|
11248 | if (bindLen > 5)
|
11249 | value[((bindings[5].name))] = v5;
|
11250 | if (bindLen > 6)
|
11251 | value[((bindings[6].name))] = v6;
|
11252 | if (bindLen > 7)
|
11253 | value[((bindings[7].name))] = v7;
|
11254 | if (bindLen > 8)
|
11255 | value[((bindings[8].name))] = v8;
|
11256 | if (bindLen > 9)
|
11257 | value[((bindings[9].name))] = v9;
|
11258 | break;
|
11259 | case 64 :
|
11260 | var pipe = v0;
|
11261 | switch (bindLen) {
|
11262 | case 1:
|
11263 | value = pipe.transform(v0);
|
11264 | break;
|
11265 | case 2:
|
11266 | value = pipe.transform(v1);
|
11267 | break;
|
11268 | case 3:
|
11269 | value = pipe.transform(v1, v2);
|
11270 | break;
|
11271 | case 4:
|
11272 | value = pipe.transform(v1, v2, v3);
|
11273 | break;
|
11274 | case 5:
|
11275 | value = pipe.transform(v1, v2, v3, v4);
|
11276 | break;
|
11277 | case 6:
|
11278 | value = pipe.transform(v1, v2, v3, v4, v5);
|
11279 | break;
|
11280 | case 7:
|
11281 | value = pipe.transform(v1, v2, v3, v4, v5, v6);
|
11282 | break;
|
11283 | case 8:
|
11284 | value = pipe.transform(v1, v2, v3, v4, v5, v6, v7);
|
11285 | break;
|
11286 | case 9:
|
11287 | value = pipe.transform(v1, v2, v3, v4, v5, v6, v7, v8);
|
11288 | break;
|
11289 | case 10:
|
11290 | value = pipe.transform(v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
11291 | break;
|
11292 | }
|
11293 | break;
|
11294 | }
|
11295 | data.value = value;
|
11296 | }
|
11297 | return changed;
|
11298 | }
|
11299 |
|
11300 |
|
11301 |
|
11302 |
|
11303 |
|
11304 |
|
11305 | function checkAndUpdatePureExpressionDynamic(view, def, values) {
|
11306 | var bindings = def.bindings;
|
11307 | var changed = false;
|
11308 | for (var i = 0; i < values.length; i++) {
|
11309 |
|
11310 |
|
11311 | if (checkAndUpdateBinding(view, def, i, values[i])) {
|
11312 | changed = true;
|
11313 | }
|
11314 | }
|
11315 | if (changed) {
|
11316 | var data = asPureExpressionData(view, def.index);
|
11317 | var value = void 0;
|
11318 | switch (def.flags & 100673535 ) {
|
11319 | case 16 :
|
11320 | value = values;
|
11321 | break;
|
11322 | case 32 :
|
11323 | value = {};
|
11324 | for (var i = 0; i < values.length; i++) {
|
11325 | value[((bindings[i].name))] = values[i];
|
11326 | }
|
11327 | break;
|
11328 | case 64 :
|
11329 | var pipe = values[0];
|
11330 | var params = values.slice(1);
|
11331 | value = pipe.transform.apply(pipe, params);
|
11332 | break;
|
11333 | }
|
11334 | data.value = value;
|
11335 | }
|
11336 | return changed;
|
11337 | }
|
11338 |
|
11339 |
|
11340 |
|
11341 |
|
11342 |
|
11343 |
|
11344 |
|
11345 |
|
11346 |
|
11347 |
|
11348 |
|
11349 |
|
11350 |
|
11351 | function queryDef(flags, id, bindings) {
|
11352 | var bindingDefs = [];
|
11353 | for (var propName in bindings) {
|
11354 | var bindingType = bindings[propName];
|
11355 | bindingDefs.push({ propName: propName, bindingType: bindingType });
|
11356 | }
|
11357 | return {
|
11358 |
|
11359 | index: -1,
|
11360 | parent: null,
|
11361 | renderParent: null,
|
11362 | bindingIndex: -1,
|
11363 | outputIndex: -1,
|
11364 |
|
11365 | flags: flags,
|
11366 | childFlags: 0,
|
11367 | directChildFlags: 0,
|
11368 | childMatchedQueries: 0,
|
11369 | ngContentIndex: -1,
|
11370 | matchedQueries: {},
|
11371 | matchedQueryIds: 0,
|
11372 | references: {},
|
11373 | childCount: 0,
|
11374 | bindings: [],
|
11375 | bindingFlags: 0,
|
11376 | outputs: [],
|
11377 | element: null,
|
11378 | provider: null,
|
11379 | text: null,
|
11380 | query: { id: id, filterId: filterQueryId(id), bindings: bindingDefs },
|
11381 | ngContent: null
|
11382 | };
|
11383 | }
|
11384 |
|
11385 |
|
11386 |
|
11387 | function createQuery() {
|
11388 | return new QueryList();
|
11389 | }
|
11390 |
|
11391 |
|
11392 |
|
11393 |
|
11394 | function dirtyParentQueries(view) {
|
11395 | var queryIds = view.def.nodeMatchedQueries;
|
11396 | while (view.parent && isEmbeddedView(view)) {
|
11397 | var tplDef = ((view.parentNodeDef));
|
11398 | view = view.parent;
|
11399 |
|
11400 | var end = tplDef.index + tplDef.childCount;
|
11401 | for (var i = 0; i <= end; i++) {
|
11402 | var nodeDef = view.def.nodes[i];
|
11403 | if ((nodeDef.flags & 33554432 ) &&
|
11404 | (nodeDef.flags & 268435456 ) &&
|
11405 | (((nodeDef.query)).filterId & queryIds) === ((nodeDef.query)).filterId) {
|
11406 | asQueryList(view, i).setDirty();
|
11407 | }
|
11408 | if ((nodeDef.flags & 1 && i + nodeDef.childCount < tplDef.index) ||
|
11409 | !(nodeDef.childFlags & 33554432 ) ||
|
11410 | !(nodeDef.childFlags & 268435456 )) {
|
11411 |
|
11412 | i += nodeDef.childCount;
|
11413 | }
|
11414 | }
|
11415 | }
|
11416 |
|
11417 | if (view.def.nodeFlags & 67108864 ) {
|
11418 | for (var i = 0; i < view.def.nodes.length; i++) {
|
11419 | var nodeDef = view.def.nodes[i];
|
11420 | if ((nodeDef.flags & 67108864 ) && (nodeDef.flags & 268435456 )) {
|
11421 | asQueryList(view, i).setDirty();
|
11422 | }
|
11423 |
|
11424 | i += nodeDef.childCount;
|
11425 | }
|
11426 | }
|
11427 | }
|
11428 |
|
11429 |
|
11430 |
|
11431 |
|
11432 |
|
11433 | function checkAndUpdateQuery(view, nodeDef) {
|
11434 | var queryList = asQueryList(view, nodeDef.index);
|
11435 | if (!queryList.dirty) {
|
11436 | return;
|
11437 | }
|
11438 | var directiveInstance;
|
11439 | var newValues = ((undefined));
|
11440 | if (nodeDef.flags & 33554432 ) {
|
11441 | var elementDef_1 = ((((nodeDef.parent)).parent));
|
11442 | newValues = calcQueryValues(view, elementDef_1.index, elementDef_1.index + elementDef_1.childCount, ((nodeDef.query)), []);
|
11443 | directiveInstance = asProviderData(view, ((nodeDef.parent)).index).instance;
|
11444 | }
|
11445 | else if (nodeDef.flags & 67108864 ) {
|
11446 | newValues = calcQueryValues(view, 0, view.def.nodes.length - 1, ((nodeDef.query)), []);
|
11447 | directiveInstance = view.component;
|
11448 | }
|
11449 | queryList.reset(newValues);
|
11450 | var bindings = ((nodeDef.query)).bindings;
|
11451 | var notify = false;
|
11452 | for (var i = 0; i < bindings.length; i++) {
|
11453 | var binding = bindings[i];
|
11454 | var boundValue = void 0;
|
11455 | switch (binding.bindingType) {
|
11456 | case 0 :
|
11457 | boundValue = queryList.first;
|
11458 | break;
|
11459 | case 1 :
|
11460 | boundValue = queryList;
|
11461 | notify = true;
|
11462 | break;
|
11463 | }
|
11464 | directiveInstance[binding.propName] = boundValue;
|
11465 | }
|
11466 | if (notify) {
|
11467 | queryList.notifyOnChanges();
|
11468 | }
|
11469 | }
|
11470 |
|
11471 |
|
11472 |
|
11473 |
|
11474 |
|
11475 |
|
11476 |
|
11477 |
|
11478 | function calcQueryValues(view, startIndex, endIndex, queryDef, values) {
|
11479 | for (var i = startIndex; i <= endIndex; i++) {
|
11480 | var nodeDef = view.def.nodes[i];
|
11481 | var valueType = nodeDef.matchedQueries[queryDef.id];
|
11482 | if (valueType != null) {
|
11483 | values.push(getQueryValue(view, nodeDef, valueType));
|
11484 | }
|
11485 | if (nodeDef.flags & 1 && ((nodeDef.element)).template &&
|
11486 | (((((nodeDef.element)).template)).nodeMatchedQueries & queryDef.filterId) ===
|
11487 | queryDef.filterId) {
|
11488 |
|
11489 | var elementData = asElementData(view, i);
|
11490 | if (nodeDef.flags & 8388608 ) {
|
11491 | var embeddedViews = ((elementData.viewContainer))._embeddedViews;
|
11492 | for (var k = 0; k < embeddedViews.length; k++) {
|
11493 | var embeddedView = embeddedViews[k];
|
11494 | var dvc = declaredViewContainer(embeddedView);
|
11495 | if (dvc && dvc === elementData) {
|
11496 | calcQueryValues(embeddedView, 0, embeddedView.def.nodes.length - 1, queryDef, values);
|
11497 | }
|
11498 | }
|
11499 | }
|
11500 | var projectedViews = elementData.template._projectedViews;
|
11501 | if (projectedViews) {
|
11502 | for (var k = 0; k < projectedViews.length; k++) {
|
11503 | var projectedView = projectedViews[k];
|
11504 | calcQueryValues(projectedView, 0, projectedView.def.nodes.length - 1, queryDef, values);
|
11505 | }
|
11506 | }
|
11507 | }
|
11508 | if ((nodeDef.childMatchedQueries & queryDef.filterId) !== queryDef.filterId) {
|
11509 |
|
11510 | i += nodeDef.childCount;
|
11511 | }
|
11512 | }
|
11513 | return values;
|
11514 | }
|
11515 |
|
11516 |
|
11517 |
|
11518 |
|
11519 |
|
11520 |
|
11521 | function getQueryValue(view, nodeDef, queryValueType) {
|
11522 | if (queryValueType != null) {
|
11523 |
|
11524 | var value = void 0;
|
11525 | switch (queryValueType) {
|
11526 | case 1 :
|
11527 | value = asElementData(view, nodeDef.index).renderElement;
|
11528 | break;
|
11529 | case 0 :
|
11530 | value = new ElementRef(asElementData(view, nodeDef.index).renderElement);
|
11531 | break;
|
11532 | case 2 :
|
11533 | value = asElementData(view, nodeDef.index).template;
|
11534 | break;
|
11535 | case 3 :
|
11536 | value = asElementData(view, nodeDef.index).viewContainer;
|
11537 | break;
|
11538 | case 4 :
|
11539 | value = asProviderData(view, nodeDef.index).instance;
|
11540 | break;
|
11541 | }
|
11542 | return value;
|
11543 | }
|
11544 | }
|
11545 |
|
11546 |
|
11547 |
|
11548 |
|
11549 |
|
11550 |
|
11551 |
|
11552 |
|
11553 |
|
11554 |
|
11555 |
|
11556 |
|
11557 | function textDef(ngContentIndex, constants) {
|
11558 | var bindings = new Array(constants.length - 1);
|
11559 | for (var i = 1; i < constants.length; i++) {
|
11560 | bindings[i - 1] = {
|
11561 | flags: 8 ,
|
11562 | name: null,
|
11563 | ns: null,
|
11564 | nonMinifiedName: null,
|
11565 | securityContext: null,
|
11566 | suffix: constants[i]
|
11567 | };
|
11568 | }
|
11569 | var flags = 2;
|
11570 | return {
|
11571 |
|
11572 | index: -1,
|
11573 | parent: null,
|
11574 | renderParent: null,
|
11575 | bindingIndex: -1,
|
11576 | outputIndex: -1,
|
11577 |
|
11578 | flags: flags,
|
11579 | childFlags: 0,
|
11580 | directChildFlags: 0,
|
11581 | childMatchedQueries: 0,
|
11582 | matchedQueries: {},
|
11583 | matchedQueryIds: 0,
|
11584 | references: {}, ngContentIndex: ngContentIndex,
|
11585 | childCount: 0, bindings: bindings,
|
11586 | bindingFlags: calcBindingFlags(bindings),
|
11587 | outputs: [],
|
11588 | element: null,
|
11589 | provider: null,
|
11590 | text: { prefix: constants[0] },
|
11591 | query: null,
|
11592 | ngContent: null
|
11593 | };
|
11594 | }
|
11595 |
|
11596 |
|
11597 |
|
11598 |
|
11599 |
|
11600 |
|
11601 | function createText(view, renderHost, def) {
|
11602 | var renderNode$$1;
|
11603 | var renderer = view.renderer;
|
11604 | renderNode$$1 = renderer.createText( ((def.text)).prefix);
|
11605 | var parentEl = getParentRenderElement(view, renderHost, def);
|
11606 | if (parentEl) {
|
11607 | renderer.appendChild(parentEl, renderNode$$1);
|
11608 | }
|
11609 | return { renderText: renderNode$$1 };
|
11610 | }
|
11611 |
|
11612 |
|
11613 |
|
11614 |
|
11615 |
|
11616 |
|
11617 |
|
11618 |
|
11619 |
|
11620 |
|
11621 |
|
11622 |
|
11623 |
|
11624 |
|
11625 |
|
11626 | function checkAndUpdateTextInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
11627 | var changed = false;
|
11628 | var bindings = def.bindings;
|
11629 | var bindLen = bindings.length;
|
11630 | if (bindLen > 0 && checkAndUpdateBinding(view, def, 0, v0))
|
11631 | changed = true;
|
11632 | if (bindLen > 1 && checkAndUpdateBinding(view, def, 1, v1))
|
11633 | changed = true;
|
11634 | if (bindLen > 2 && checkAndUpdateBinding(view, def, 2, v2))
|
11635 | changed = true;
|
11636 | if (bindLen > 3 && checkAndUpdateBinding(view, def, 3, v3))
|
11637 | changed = true;
|
11638 | if (bindLen > 4 && checkAndUpdateBinding(view, def, 4, v4))
|
11639 | changed = true;
|
11640 | if (bindLen > 5 && checkAndUpdateBinding(view, def, 5, v5))
|
11641 | changed = true;
|
11642 | if (bindLen > 6 && checkAndUpdateBinding(view, def, 6, v6))
|
11643 | changed = true;
|
11644 | if (bindLen > 7 && checkAndUpdateBinding(view, def, 7, v7))
|
11645 | changed = true;
|
11646 | if (bindLen > 8 && checkAndUpdateBinding(view, def, 8, v8))
|
11647 | changed = true;
|
11648 | if (bindLen > 9 && checkAndUpdateBinding(view, def, 9, v9))
|
11649 | changed = true;
|
11650 | if (changed) {
|
11651 | var value = ((def.text)).prefix;
|
11652 | if (bindLen > 0)
|
11653 | value += _addInterpolationPart(v0, bindings[0]);
|
11654 | if (bindLen > 1)
|
11655 | value += _addInterpolationPart(v1, bindings[1]);
|
11656 | if (bindLen > 2)
|
11657 | value += _addInterpolationPart(v2, bindings[2]);
|
11658 | if (bindLen > 3)
|
11659 | value += _addInterpolationPart(v3, bindings[3]);
|
11660 | if (bindLen > 4)
|
11661 | value += _addInterpolationPart(v4, bindings[4]);
|
11662 | if (bindLen > 5)
|
11663 | value += _addInterpolationPart(v5, bindings[5]);
|
11664 | if (bindLen > 6)
|
11665 | value += _addInterpolationPart(v6, bindings[6]);
|
11666 | if (bindLen > 7)
|
11667 | value += _addInterpolationPart(v7, bindings[7]);
|
11668 | if (bindLen > 8)
|
11669 | value += _addInterpolationPart(v8, bindings[8]);
|
11670 | if (bindLen > 9)
|
11671 | value += _addInterpolationPart(v9, bindings[9]);
|
11672 | var renderNode$$1 = asTextData(view, def.index).renderText;
|
11673 | view.renderer.setValue(renderNode$$1, value);
|
11674 | }
|
11675 | return changed;
|
11676 | }
|
11677 |
|
11678 |
|
11679 |
|
11680 |
|
11681 |
|
11682 |
|
11683 | function checkAndUpdateTextDynamic(view, def, values) {
|
11684 | var bindings = def.bindings;
|
11685 | var changed = false;
|
11686 | for (var i = 0; i < values.length; i++) {
|
11687 |
|
11688 |
|
11689 | if (checkAndUpdateBinding(view, def, i, values[i])) {
|
11690 | changed = true;
|
11691 | }
|
11692 | }
|
11693 | if (changed) {
|
11694 | var value = '';
|
11695 | for (var i = 0; i < values.length; i++) {
|
11696 | value = value + _addInterpolationPart(values[i], bindings[i]);
|
11697 | }
|
11698 | value = ((def.text)).prefix + value;
|
11699 | var renderNode$$1 = asTextData(view, def.index).renderText;
|
11700 | view.renderer.setValue(renderNode$$1, value);
|
11701 | }
|
11702 | return changed;
|
11703 | }
|
11704 |
|
11705 |
|
11706 |
|
11707 |
|
11708 |
|
11709 | function _addInterpolationPart(value, binding) {
|
11710 | var valueStr = value != null ? value.toString() : '';
|
11711 | return valueStr + binding.suffix;
|
11712 | }
|
11713 |
|
11714 |
|
11715 |
|
11716 |
|
11717 |
|
11718 |
|
11719 |
|
11720 |
|
11721 |
|
11722 |
|
11723 |
|
11724 |
|
11725 |
|
11726 |
|
11727 | function viewDef(flags, nodes, updateDirectives, updateRenderer) {
|
11728 |
|
11729 | var viewBindingCount = 0;
|
11730 | var viewDisposableCount = 0;
|
11731 | var viewNodeFlags = 0;
|
11732 | var viewRootNodeFlags = 0;
|
11733 | var viewMatchedQueries = 0;
|
11734 | var currentParent = null;
|
11735 | var currentElementHasPublicProviders = false;
|
11736 | var currentElementHasPrivateProviders = false;
|
11737 | var lastRenderRootNode = null;
|
11738 | for (var i = 0; i < nodes.length; i++) {
|
11739 | while (currentParent && i > currentParent.index + currentParent.childCount) {
|
11740 | var newParent = currentParent.parent;
|
11741 | if (newParent) {
|
11742 | newParent.childFlags |= ((currentParent.childFlags));
|
11743 | newParent.childMatchedQueries |= currentParent.childMatchedQueries;
|
11744 | }
|
11745 | currentParent = newParent;
|
11746 | }
|
11747 | var node = nodes[i];
|
11748 | node.index = i;
|
11749 | node.parent = currentParent;
|
11750 | node.bindingIndex = viewBindingCount;
|
11751 | node.outputIndex = viewDisposableCount;
|
11752 |
|
11753 | var currentRenderParent = void 0;
|
11754 | if (currentParent && currentParent.flags & 1 &&
|
11755 | !((currentParent.element)).name) {
|
11756 | currentRenderParent = currentParent.renderParent;
|
11757 | }
|
11758 | else {
|
11759 | currentRenderParent = currentParent;
|
11760 | }
|
11761 | node.renderParent = currentRenderParent;
|
11762 | if (node.element) {
|
11763 | var elDef = node.element;
|
11764 | elDef.publicProviders =
|
11765 | currentParent ? ((currentParent.element)).publicProviders : Object.create(null);
|
11766 | elDef.allProviders = elDef.publicProviders;
|
11767 |
|
11768 | currentElementHasPublicProviders = false;
|
11769 | currentElementHasPrivateProviders = false;
|
11770 | }
|
11771 | validateNode(currentParent, node, nodes.length);
|
11772 | viewNodeFlags |= node.flags;
|
11773 | viewMatchedQueries |= node.matchedQueryIds;
|
11774 | if (node.element && node.element.template) {
|
11775 | viewMatchedQueries |= node.element.template.nodeMatchedQueries;
|
11776 | }
|
11777 | if (currentParent) {
|
11778 | currentParent.childFlags |= node.flags;
|
11779 | currentParent.directChildFlags |= node.flags;
|
11780 | currentParent.childMatchedQueries |= node.matchedQueryIds;
|
11781 | if (node.element && node.element.template) {
|
11782 | currentParent.childMatchedQueries |= node.element.template.nodeMatchedQueries;
|
11783 | }
|
11784 | }
|
11785 | else {
|
11786 | viewRootNodeFlags |= node.flags;
|
11787 | }
|
11788 | viewBindingCount += node.bindings.length;
|
11789 | viewDisposableCount += node.outputs.length;
|
11790 | if (!currentRenderParent && (node.flags & 3 )) {
|
11791 | lastRenderRootNode = node;
|
11792 | }
|
11793 | if (node.flags & 10112 ) {
|
11794 | if (!currentElementHasPublicProviders) {
|
11795 | currentElementHasPublicProviders = true;
|
11796 | ((((
|
11797 |
|
11798 | currentParent)).element)).publicProviders =
|
11799 | Object.create( ((((currentParent)).element)).publicProviders);
|
11800 | ((((currentParent)).element)).allProviders = ((((currentParent)).element)).publicProviders;
|
11801 | }
|
11802 | var isPrivateService = (node.flags & 4096 ) !== 0;
|
11803 | var isComponent = (node.flags & 16384 ) !== 0;
|
11804 | if (!isPrivateService || isComponent) {
|
11805 | ((((((currentParent)).element)).publicProviders))[((node.provider)).tokenKey] = node;
|
11806 | }
|
11807 | else {
|
11808 | if (!currentElementHasPrivateProviders) {
|
11809 | currentElementHasPrivateProviders = true;
|
11810 | ((((
|
11811 |
|
11812 | currentParent)).element)).allProviders =
|
11813 | Object.create( ((((currentParent)).element)).publicProviders);
|
11814 | }
|
11815 | ((((((currentParent)).element)).allProviders))[((node.provider)).tokenKey] = node;
|
11816 | }
|
11817 | if (isComponent) {
|
11818 | ((((currentParent)).element)).componentProvider = node;
|
11819 | }
|
11820 | }
|
11821 | if (node.childCount) {
|
11822 | currentParent = node;
|
11823 | }
|
11824 | }
|
11825 | while (currentParent) {
|
11826 | var newParent = currentParent.parent;
|
11827 | if (newParent) {
|
11828 | newParent.childFlags |= currentParent.childFlags;
|
11829 | newParent.childMatchedQueries |= currentParent.childMatchedQueries;
|
11830 | }
|
11831 | currentParent = newParent;
|
11832 | }
|
11833 | var handleEvent = function (view, nodeIndex, eventName, event) { return ((((nodes[nodeIndex].element)).handleEvent))(view, eventName, event); };
|
11834 | return {
|
11835 |
|
11836 | factory: null,
|
11837 | nodeFlags: viewNodeFlags,
|
11838 | rootNodeFlags: viewRootNodeFlags,
|
11839 | nodeMatchedQueries: viewMatchedQueries, flags: flags,
|
11840 | nodes: nodes,
|
11841 | updateDirectives: updateDirectives || NOOP,
|
11842 | updateRenderer: updateRenderer || NOOP,
|
11843 | handleEvent: handleEvent || NOOP,
|
11844 | bindingCount: viewBindingCount,
|
11845 | outputCount: viewDisposableCount, lastRenderRootNode: lastRenderRootNode
|
11846 | };
|
11847 | }
|
11848 |
|
11849 |
|
11850 |
|
11851 |
|
11852 |
|
11853 |
|
11854 | function validateNode(parent, node, nodeCount) {
|
11855 | var template = node.element && node.element.template;
|
11856 | if (template) {
|
11857 | if (!template.lastRenderRootNode) {
|
11858 | throw new Error("Illegal State: Embedded templates without nodes are not allowed!");
|
11859 | }
|
11860 | if (template.lastRenderRootNode &&
|
11861 | template.lastRenderRootNode.flags & 8388608 ) {
|
11862 | throw new Error("Illegal State: Last root node of a template can't have embedded views, at index " + node.index + "!");
|
11863 | }
|
11864 | }
|
11865 | if (node.flags & 10112 ) {
|
11866 | var parentFlags = parent ? parent.flags : 0;
|
11867 | if ((parentFlags & 1 ) === 0) {
|
11868 | throw new Error("Illegal State: Provider/Directive nodes need to be children of elements or anchors, at index " + node.index + "!");
|
11869 | }
|
11870 | }
|
11871 | if (node.query) {
|
11872 | if (node.flags & 33554432 &&
|
11873 | (!parent || (parent.flags & 8192 ) === 0)) {
|
11874 | throw new Error("Illegal State: Content Query nodes need to be children of directives, at index " + node.index + "!");
|
11875 | }
|
11876 | if (node.flags & 67108864 && parent) {
|
11877 | throw new Error("Illegal State: View Query nodes have to be top level nodes, at index " + node.index + "!");
|
11878 | }
|
11879 | }
|
11880 | if (node.childCount) {
|
11881 | var parentEnd = parent ? parent.index + parent.childCount : nodeCount - 1;
|
11882 | if (node.index <= parentEnd && node.index + node.childCount > parentEnd) {
|
11883 | throw new Error("Illegal State: childCount of node leads outside of parent, at index " + node.index + "!");
|
11884 | }
|
11885 | }
|
11886 | }
|
11887 |
|
11888 |
|
11889 |
|
11890 |
|
11891 |
|
11892 |
|
11893 | function createEmbeddedView(parent, anchorDef$$1, context) {
|
11894 |
|
11895 |
|
11896 | var view = createView(parent.root, parent.renderer, parent, anchorDef$$1, ((((anchorDef$$1.element)).template)));
|
11897 | initView(view, parent.component, context);
|
11898 | createViewNodes(view);
|
11899 | return view;
|
11900 | }
|
11901 |
|
11902 |
|
11903 |
|
11904 |
|
11905 |
|
11906 |
|
11907 | function createRootView(root, def, context) {
|
11908 | var view = createView(root, root.renderer, null, null, def);
|
11909 | initView(view, context, context);
|
11910 | createViewNodes(view);
|
11911 | return view;
|
11912 | }
|
11913 |
|
11914 |
|
11915 |
|
11916 |
|
11917 |
|
11918 |
|
11919 |
|
11920 |
|
11921 | function createView(root, renderer, parent, parentNodeDef, def) {
|
11922 | var nodes = new Array(def.nodes.length);
|
11923 | var disposables = def.outputCount ? new Array(def.outputCount) : null;
|
11924 | var view = {
|
11925 | def: def,
|
11926 | parent: parent,
|
11927 | viewContainerParent: null, parentNodeDef: parentNodeDef,
|
11928 | context: null,
|
11929 | component: null, nodes: nodes,
|
11930 | state: 13 , root: root, renderer: renderer,
|
11931 | oldValues: new Array(def.bindingCount), disposables: disposables
|
11932 | };
|
11933 | return view;
|
11934 | }
|
11935 |
|
11936 |
|
11937 |
|
11938 |
|
11939 |
|
11940 |
|
11941 | function initView(view, component, context) {
|
11942 | view.component = component;
|
11943 | view.context = context;
|
11944 | }
|
11945 |
|
11946 |
|
11947 |
|
11948 |
|
11949 | function createViewNodes(view) {
|
11950 | var renderHost;
|
11951 | if (isComponentView(view)) {
|
11952 | var hostDef = view.parentNodeDef;
|
11953 | renderHost = asElementData( ((view.parent)), ((((hostDef)).parent)).index).renderElement;
|
11954 | }
|
11955 | var def = view.def;
|
11956 | var nodes = view.nodes;
|
11957 | for (var i = 0; i < def.nodes.length; i++) {
|
11958 | var nodeDef = def.nodes[i];
|
11959 | Services.setCurrentNode(view, i);
|
11960 | var nodeData = void 0;
|
11961 | switch (nodeDef.flags & 100673535 ) {
|
11962 | case 1 :
|
11963 | var el = (createElement(view, renderHost, nodeDef));
|
11964 | var componentView = ((undefined));
|
11965 | if (nodeDef.flags & 16777216 ) {
|
11966 | var compViewDef = resolveViewDefinition( ((((nodeDef.element)).componentView)));
|
11967 | var rendererType = ((nodeDef.element)).componentRendererType;
|
11968 | var compRenderer = void 0;
|
11969 | if (!rendererType) {
|
11970 | compRenderer = view.root.renderer;
|
11971 | }
|
11972 | else {
|
11973 | compRenderer = view.root.rendererFactory.createRenderer(el, rendererType);
|
11974 | }
|
11975 | componentView = createView(view.root, compRenderer, view, ((nodeDef.element)).componentProvider, compViewDef);
|
11976 | }
|
11977 | listenToElementOutputs(view, componentView, nodeDef, el);
|
11978 | nodeData = ({
|
11979 | renderElement: el,
|
11980 | componentView: componentView,
|
11981 | viewContainer: null,
|
11982 | template: ((nodeDef.element)).template ? createTemplateData(view, nodeDef) : undefined
|
11983 | });
|
11984 | if (nodeDef.flags & 8388608 ) {
|
11985 | nodeData.viewContainer = createViewContainerData(view, nodeDef, nodeData);
|
11986 | }
|
11987 | break;
|
11988 | case 2 :
|
11989 | nodeData = (createText(view, renderHost, nodeDef));
|
11990 | break;
|
11991 | case 256 :
|
11992 | case 512 :
|
11993 | case 1024 :
|
11994 | case 128 : {
|
11995 | var instance = createProviderInstance(view, nodeDef);
|
11996 | nodeData = ({ instance: instance });
|
11997 | break;
|
11998 | }
|
11999 | case 8 : {
|
12000 | var instance = createPipeInstance(view, nodeDef);
|
12001 | nodeData = ({ instance: instance });
|
12002 | break;
|
12003 | }
|
12004 | case 8192 : {
|
12005 | var instance = createDirectiveInstance(view, nodeDef);
|
12006 | nodeData = ({ instance: instance });
|
12007 | if (nodeDef.flags & 16384 ) {
|
12008 | var compView = asElementData(view, ((nodeDef.parent)).index).componentView;
|
12009 | initView(compView, instance, instance);
|
12010 | }
|
12011 | break;
|
12012 | }
|
12013 | case 16 :
|
12014 | case 32 :
|
12015 | case 64 :
|
12016 | nodeData = (createPureExpression(view, nodeDef));
|
12017 | break;
|
12018 | case 33554432 :
|
12019 | case 67108864 :
|
12020 | nodeData = (createQuery());
|
12021 | break;
|
12022 | case 4 :
|
12023 | appendNgContent(view, renderHost, nodeDef);
|
12024 |
|
12025 | nodeData = undefined;
|
12026 | break;
|
12027 | }
|
12028 | nodes[i] = nodeData;
|
12029 | }
|
12030 |
|
12031 |
|
12032 | execComponentViewsAction(view, ViewAction.CreateViewNodes);
|
12033 |
|
12034 | execQueriesAction(view, 33554432 | 67108864 , 134217728 , 0 );
|
12035 | }
|
12036 |
|
12037 |
|
12038 |
|
12039 |
|
12040 | function checkNoChangesView(view) {
|
12041 | Services.updateDirectives(view, 1 );
|
12042 | execEmbeddedViewsAction(view, ViewAction.CheckNoChanges);
|
12043 | Services.updateRenderer(view, 1 );
|
12044 | execComponentViewsAction(view, ViewAction.CheckNoChanges);
|
12045 |
|
12046 |
|
12047 | }
|
12048 |
|
12049 |
|
12050 |
|
12051 |
|
12052 | function checkAndUpdateView(view) {
|
12053 | if (view.state & 1 ) {
|
12054 | view.state &= ~1 ;
|
12055 | view.state |= 2 ;
|
12056 | }
|
12057 | else {
|
12058 | view.state &= ~2 ;
|
12059 | }
|
12060 | Services.updateDirectives(view, 0 );
|
12061 | execEmbeddedViewsAction(view, ViewAction.CheckAndUpdate);
|
12062 | execQueriesAction(view, 33554432 , 268435456 , 0 );
|
12063 | callLifecycleHooksChildrenFirst(view, 1048576 |
|
12064 | (view.state & 2 ? 524288 : 0));
|
12065 | Services.updateRenderer(view, 0 );
|
12066 | execComponentViewsAction(view, ViewAction.CheckAndUpdate);
|
12067 | execQueriesAction(view, 67108864 , 268435456 , 0 );
|
12068 | callLifecycleHooksChildrenFirst(view, 4194304 |
|
12069 | (view.state & 2 ? 2097152 : 0));
|
12070 | if (view.def.flags & 2 ) {
|
12071 | view.state &= ~8 ;
|
12072 | }
|
12073 | }
|
12074 |
|
12075 |
|
12076 |
|
12077 |
|
12078 |
|
12079 |
|
12080 |
|
12081 |
|
12082 |
|
12083 |
|
12084 |
|
12085 |
|
12086 |
|
12087 |
|
12088 |
|
12089 |
|
12090 | function checkAndUpdateNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
12091 | if (argStyle === 0 ) {
|
12092 | return checkAndUpdateNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
12093 | }
|
12094 | else {
|
12095 | return checkAndUpdateNodeDynamic(view, nodeDef, v0);
|
12096 | }
|
12097 | }
|
12098 |
|
12099 |
|
12100 |
|
12101 |
|
12102 |
|
12103 |
|
12104 |
|
12105 |
|
12106 |
|
12107 |
|
12108 |
|
12109 |
|
12110 |
|
12111 |
|
12112 |
|
12113 | function checkAndUpdateNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
12114 | var changed = false;
|
12115 | switch (nodeDef.flags & 100673535 ) {
|
12116 | case 1 :
|
12117 | changed = checkAndUpdateElementInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
12118 | break;
|
12119 | case 2 :
|
12120 | changed = checkAndUpdateTextInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
12121 | break;
|
12122 | case 8192 :
|
12123 | changed =
|
12124 | checkAndUpdateDirectiveInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
12125 | break;
|
12126 | case 16 :
|
12127 | case 32 :
|
12128 | case 64 :
|
12129 | changed =
|
12130 | checkAndUpdatePureExpressionInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
12131 | break;
|
12132 | }
|
12133 | return changed;
|
12134 | }
|
12135 |
|
12136 |
|
12137 |
|
12138 |
|
12139 |
|
12140 |
|
12141 | function checkAndUpdateNodeDynamic(view, nodeDef, values) {
|
12142 | var changed = false;
|
12143 | switch (nodeDef.flags & 100673535 ) {
|
12144 | case 1 :
|
12145 | changed = checkAndUpdateElementDynamic(view, nodeDef, values);
|
12146 | break;
|
12147 | case 2 :
|
12148 | changed = checkAndUpdateTextDynamic(view, nodeDef, values);
|
12149 | break;
|
12150 | case 8192 :
|
12151 | changed = checkAndUpdateDirectiveDynamic(view, nodeDef, values);
|
12152 | break;
|
12153 | case 16 :
|
12154 | case 32 :
|
12155 | case 64 :
|
12156 | changed = checkAndUpdatePureExpressionDynamic(view, nodeDef, values);
|
12157 | break;
|
12158 | }
|
12159 | if (changed) {
|
12160 |
|
12161 |
|
12162 | var bindLen = nodeDef.bindings.length;
|
12163 | var bindingStart = nodeDef.bindingIndex;
|
12164 | var oldValues = view.oldValues;
|
12165 | for (var i = 0; i < bindLen; i++) {
|
12166 | oldValues[bindingStart + i] = values[i];
|
12167 | }
|
12168 | }
|
12169 | return changed;
|
12170 | }
|
12171 |
|
12172 |
|
12173 |
|
12174 |
|
12175 |
|
12176 |
|
12177 |
|
12178 |
|
12179 |
|
12180 |
|
12181 |
|
12182 |
|
12183 |
|
12184 |
|
12185 |
|
12186 |
|
12187 | function checkNoChangesNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
12188 | if (argStyle === 0 ) {
|
12189 | checkNoChangesNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
12190 | }
|
12191 | else {
|
12192 | checkNoChangesNodeDynamic(view, nodeDef, v0);
|
12193 | }
|
12194 |
|
12195 | return false;
|
12196 | }
|
12197 |
|
12198 |
|
12199 |
|
12200 |
|
12201 |
|
12202 |
|
12203 |
|
12204 |
|
12205 |
|
12206 |
|
12207 |
|
12208 |
|
12209 |
|
12210 |
|
12211 |
|
12212 | function checkNoChangesNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
12213 | var bindLen = nodeDef.bindings.length;
|
12214 | if (bindLen > 0)
|
12215 | checkBindingNoChanges(view, nodeDef, 0, v0);
|
12216 | if (bindLen > 1)
|
12217 | checkBindingNoChanges(view, nodeDef, 1, v1);
|
12218 | if (bindLen > 2)
|
12219 | checkBindingNoChanges(view, nodeDef, 2, v2);
|
12220 | if (bindLen > 3)
|
12221 | checkBindingNoChanges(view, nodeDef, 3, v3);
|
12222 | if (bindLen > 4)
|
12223 | checkBindingNoChanges(view, nodeDef, 4, v4);
|
12224 | if (bindLen > 5)
|
12225 | checkBindingNoChanges(view, nodeDef, 5, v5);
|
12226 | if (bindLen > 6)
|
12227 | checkBindingNoChanges(view, nodeDef, 6, v6);
|
12228 | if (bindLen > 7)
|
12229 | checkBindingNoChanges(view, nodeDef, 7, v7);
|
12230 | if (bindLen > 8)
|
12231 | checkBindingNoChanges(view, nodeDef, 8, v8);
|
12232 | if (bindLen > 9)
|
12233 | checkBindingNoChanges(view, nodeDef, 9, v9);
|
12234 | }
|
12235 |
|
12236 |
|
12237 |
|
12238 |
|
12239 |
|
12240 |
|
12241 | function checkNoChangesNodeDynamic(view, nodeDef, values) {
|
12242 | for (var i = 0; i < values.length; i++) {
|
12243 | checkBindingNoChanges(view, nodeDef, i, values[i]);
|
12244 | }
|
12245 | }
|
12246 |
|
12247 |
|
12248 |
|
12249 |
|
12250 |
|
12251 | function checkNoChangesQuery(view, nodeDef) {
|
12252 | var queryList = asQueryList(view, nodeDef.index);
|
12253 | if (queryList.dirty) {
|
12254 | throw expressionChangedAfterItHasBeenCheckedError(Services.createDebugContext(view, nodeDef.index), "Query " + ((nodeDef.query)).id + " not dirty", "Query " + ((nodeDef.query)).id + " dirty", (view.state & 1 ) !== 0);
|
12255 | }
|
12256 | }
|
12257 |
|
12258 |
|
12259 |
|
12260 |
|
12261 | function destroyView(view) {
|
12262 | if (view.state & 16 ) {
|
12263 | return;
|
12264 | }
|
12265 | execEmbeddedViewsAction(view, ViewAction.Destroy);
|
12266 | execComponentViewsAction(view, ViewAction.Destroy);
|
12267 | callLifecycleHooksChildrenFirst(view, 65536 );
|
12268 | if (view.disposables) {
|
12269 | for (var i = 0; i < view.disposables.length; i++) {
|
12270 | view.disposables[i]();
|
12271 | }
|
12272 | }
|
12273 | if (view.renderer.destroyNode) {
|
12274 | destroyViewNodes(view);
|
12275 | }
|
12276 | if (isComponentView(view)) {
|
12277 | view.renderer.destroy();
|
12278 | }
|
12279 | view.state |= 16 ;
|
12280 | }
|
12281 |
|
12282 |
|
12283 |
|
12284 |
|
12285 | function destroyViewNodes(view) {
|
12286 | var len = view.def.nodes.length;
|
12287 | for (var i = 0; i < len; i++) {
|
12288 | var def = view.def.nodes[i];
|
12289 | if (def.flags & 1 ) {
|
12290 | ((view.renderer.destroyNode))(asElementData(view, i).renderElement);
|
12291 | }
|
12292 | else if (def.flags & 2 ) {
|
12293 | ((view.renderer.destroyNode))(asTextData(view, i).renderText);
|
12294 | }
|
12295 | }
|
12296 | }
|
12297 | var ViewAction = {};
|
12298 | ViewAction.CreateViewNodes = 0;
|
12299 | ViewAction.CheckNoChanges = 1;
|
12300 | ViewAction.CheckAndUpdate = 2;
|
12301 | ViewAction.Destroy = 3;
|
12302 | ViewAction[ViewAction.CreateViewNodes] = "CreateViewNodes";
|
12303 | ViewAction[ViewAction.CheckNoChanges] = "CheckNoChanges";
|
12304 | ViewAction[ViewAction.CheckAndUpdate] = "CheckAndUpdate";
|
12305 | ViewAction[ViewAction.Destroy] = "Destroy";
|
12306 |
|
12307 |
|
12308 |
|
12309 |
|
12310 |
|
12311 | function execComponentViewsAction(view, action) {
|
12312 | var def = view.def;
|
12313 | if (!(def.nodeFlags & 16777216 )) {
|
12314 | return;
|
12315 | }
|
12316 | for (var i = 0; i < def.nodes.length; i++) {
|
12317 | var nodeDef = def.nodes[i];
|
12318 | if (nodeDef.flags & 16777216 ) {
|
12319 |
|
12320 | callViewAction(asElementData(view, i).componentView, action);
|
12321 | }
|
12322 | else if ((nodeDef.childFlags & 16777216 ) === 0) {
|
12323 |
|
12324 |
|
12325 |
|
12326 | i += nodeDef.childCount;
|
12327 | }
|
12328 | }
|
12329 | }
|
12330 |
|
12331 |
|
12332 |
|
12333 |
|
12334 |
|
12335 | function execEmbeddedViewsAction(view, action) {
|
12336 | var def = view.def;
|
12337 | if (!(def.nodeFlags & 8388608 )) {
|
12338 | return;
|
12339 | }
|
12340 | for (var i = 0; i < def.nodes.length; i++) {
|
12341 | var nodeDef = def.nodes[i];
|
12342 | if (nodeDef.flags & 8388608 ) {
|
12343 |
|
12344 | var embeddedViews = ((asElementData(view, i).viewContainer))._embeddedViews;
|
12345 | for (var k = 0; k < embeddedViews.length; k++) {
|
12346 | callViewAction(embeddedViews[k], action);
|
12347 | }
|
12348 | }
|
12349 | else if ((nodeDef.childFlags & 8388608 ) === 0) {
|
12350 |
|
12351 |
|
12352 |
|
12353 | i += nodeDef.childCount;
|
12354 | }
|
12355 | }
|
12356 | }
|
12357 |
|
12358 |
|
12359 |
|
12360 |
|
12361 |
|
12362 | function callViewAction(view, action) {
|
12363 | var viewState = view.state;
|
12364 | switch (action) {
|
12365 | case ViewAction.CheckNoChanges:
|
12366 | if ((viewState & 12 ) === 12 &&
|
12367 | (viewState & 16 ) === 0) {
|
12368 | checkNoChangesView(view);
|
12369 | }
|
12370 | break;
|
12371 | case ViewAction.CheckAndUpdate:
|
12372 | if ((viewState & 12 ) === 12 &&
|
12373 | (viewState & 16 ) === 0) {
|
12374 | checkAndUpdateView(view);
|
12375 | }
|
12376 | break;
|
12377 | case ViewAction.Destroy:
|
12378 | destroyView(view);
|
12379 | break;
|
12380 | case ViewAction.CreateViewNodes:
|
12381 | createViewNodes(view);
|
12382 | break;
|
12383 | }
|
12384 | }
|
12385 |
|
12386 |
|
12387 |
|
12388 |
|
12389 |
|
12390 |
|
12391 |
|
12392 | function execQueriesAction(view, queryFlags, staticDynamicQueryFlag, checkType) {
|
12393 | if (!(view.def.nodeFlags & queryFlags) || !(view.def.nodeFlags & staticDynamicQueryFlag)) {
|
12394 | return;
|
12395 | }
|
12396 | var nodeCount = view.def.nodes.length;
|
12397 | for (var i = 0; i < nodeCount; i++) {
|
12398 | var nodeDef = view.def.nodes[i];
|
12399 | if ((nodeDef.flags & queryFlags) && (nodeDef.flags & staticDynamicQueryFlag)) {
|
12400 | Services.setCurrentNode(view, nodeDef.index);
|
12401 | switch (checkType) {
|
12402 | case 0 :
|
12403 | checkAndUpdateQuery(view, nodeDef);
|
12404 | break;
|
12405 | case 1 :
|
12406 | checkNoChangesQuery(view, nodeDef);
|
12407 | break;
|
12408 | }
|
12409 | }
|
12410 | if (!(nodeDef.childFlags & queryFlags) || !(nodeDef.childFlags & staticDynamicQueryFlag)) {
|
12411 |
|
12412 |
|
12413 | i += nodeDef.childCount;
|
12414 | }
|
12415 | }
|
12416 | }
|
12417 |
|
12418 |
|
12419 |
|
12420 |
|
12421 |
|
12422 |
|
12423 |
|
12424 | var initialized = false;
|
12425 |
|
12426 |
|
12427 |
|
12428 | function initServicesIfNeeded() {
|
12429 | if (initialized) {
|
12430 | return;
|
12431 | }
|
12432 | initialized = true;
|
12433 | var services = isDevMode() ? createDebugServices() : createProdServices();
|
12434 | Services.setCurrentNode = services.setCurrentNode;
|
12435 | Services.createRootView = services.createRootView;
|
12436 | Services.createEmbeddedView = services.createEmbeddedView;
|
12437 | Services.checkAndUpdateView = services.checkAndUpdateView;
|
12438 | Services.checkNoChangesView = services.checkNoChangesView;
|
12439 | Services.destroyView = services.destroyView;
|
12440 | Services.resolveDep = resolveDep;
|
12441 | Services.createDebugContext = services.createDebugContext;
|
12442 | Services.handleEvent = services.handleEvent;
|
12443 | Services.updateDirectives = services.updateDirectives;
|
12444 | Services.updateRenderer = services.updateRenderer;
|
12445 | Services.dirtyParentQueries = dirtyParentQueries;
|
12446 | }
|
12447 |
|
12448 |
|
12449 |
|
12450 | function createProdServices() {
|
12451 | return {
|
12452 | setCurrentNode: function () { },
|
12453 | createRootView: createProdRootView,
|
12454 | createEmbeddedView: createEmbeddedView,
|
12455 | checkAndUpdateView: checkAndUpdateView,
|
12456 | checkNoChangesView: checkNoChangesView,
|
12457 | destroyView: destroyView,
|
12458 | createDebugContext: function (view, nodeIndex) { return new DebugContext_(view, nodeIndex); },
|
12459 | handleEvent: function (view, nodeIndex, eventName, event) { return view.def.handleEvent(view, nodeIndex, eventName, event); },
|
12460 | updateDirectives: function (view, checkType) { return view.def.updateDirectives(checkType === 0 ? prodCheckAndUpdateNode :
|
12461 | prodCheckNoChangesNode, view); },
|
12462 | updateRenderer: function (view, checkType) { return view.def.updateRenderer(checkType === 0 ? prodCheckAndUpdateNode :
|
12463 | prodCheckNoChangesNode, view); },
|
12464 | };
|
12465 | }
|
12466 |
|
12467 |
|
12468 |
|
12469 | function createDebugServices() {
|
12470 | return {
|
12471 | setCurrentNode: debugSetCurrentNode,
|
12472 | createRootView: debugCreateRootView,
|
12473 | createEmbeddedView: debugCreateEmbeddedView,
|
12474 | checkAndUpdateView: debugCheckAndUpdateView,
|
12475 | checkNoChangesView: debugCheckNoChangesView,
|
12476 | destroyView: debugDestroyView,
|
12477 | createDebugContext: function (view, nodeIndex) { return new DebugContext_(view, nodeIndex); },
|
12478 | handleEvent: debugHandleEvent,
|
12479 | updateDirectives: debugUpdateDirectives,
|
12480 | updateRenderer: debugUpdateRenderer
|
12481 | };
|
12482 | }
|
12483 |
|
12484 |
|
12485 |
|
12486 |
|
12487 |
|
12488 |
|
12489 |
|
12490 |
|
12491 |
|
12492 | function createProdRootView(elInjector, projectableNodes, rootSelectorOrNode, def, ngModule, context) {
|
12493 | var rendererFactory = ngModule.injector.get(RendererFactory2);
|
12494 | return createRootView(createRootData(elInjector, ngModule, rendererFactory, projectableNodes, rootSelectorOrNode), def, context);
|
12495 | }
|
12496 |
|
12497 |
|
12498 |
|
12499 |
|
12500 |
|
12501 |
|
12502 |
|
12503 |
|
12504 |
|
12505 | function debugCreateRootView(elInjector, projectableNodes, rootSelectorOrNode, def, ngModule, context) {
|
12506 | var rendererFactory = ngModule.injector.get(RendererFactory2);
|
12507 | var root = createRootData(elInjector, ngModule, new DebugRendererFactory2(rendererFactory), projectableNodes, rootSelectorOrNode);
|
12508 | return callWithDebugContext(DebugAction.create, createRootView, null, [root, def, context]);
|
12509 | }
|
12510 |
|
12511 |
|
12512 |
|
12513 |
|
12514 |
|
12515 |
|
12516 |
|
12517 |
|
12518 | function createRootData(elInjector, ngModule, rendererFactory, projectableNodes, rootSelectorOrNode) {
|
12519 | var sanitizer = ngModule.injector.get(Sanitizer);
|
12520 | var errorHandler = ngModule.injector.get(ErrorHandler);
|
12521 | var renderer = rendererFactory.createRenderer(null, null);
|
12522 | return {
|
12523 | ngModule: ngModule,
|
12524 | injector: elInjector, projectableNodes: projectableNodes,
|
12525 | selectorOrNode: rootSelectorOrNode, sanitizer: sanitizer, rendererFactory: rendererFactory, renderer: renderer, errorHandler: errorHandler
|
12526 | };
|
12527 | }
|
12528 |
|
12529 |
|
12530 |
|
12531 |
|
12532 |
|
12533 |
|
12534 |
|
12535 |
|
12536 |
|
12537 |
|
12538 |
|
12539 |
|
12540 |
|
12541 |
|
12542 |
|
12543 |
|
12544 | function prodCheckAndUpdateNode(view, nodeIndex, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
12545 | var nodeDef = view.def.nodes[nodeIndex];
|
12546 | checkAndUpdateNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
12547 | return (nodeDef.flags & 112 ) ?
|
12548 | asPureExpressionData(view, nodeIndex).value :
|
12549 | undefined;
|
12550 | }
|
12551 |
|
12552 |
|
12553 |
|
12554 |
|
12555 |
|
12556 |
|
12557 |
|
12558 |
|
12559 |
|
12560 |
|
12561 |
|
12562 |
|
12563 |
|
12564 |
|
12565 |
|
12566 |
|
12567 | function prodCheckNoChangesNode(view, nodeIndex, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
12568 | var nodeDef = view.def.nodes[nodeIndex];
|
12569 | checkNoChangesNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
12570 | return (nodeDef.flags & 112 ) ?
|
12571 | asPureExpressionData(view, nodeIndex).value :
|
12572 | undefined;
|
12573 | }
|
12574 |
|
12575 |
|
12576 |
|
12577 |
|
12578 |
|
12579 |
|
12580 | function debugCreateEmbeddedView(parent, anchorDef, context) {
|
12581 | return callWithDebugContext(DebugAction.create, createEmbeddedView, null, [parent, anchorDef, context]);
|
12582 | }
|
12583 |
|
12584 |
|
12585 |
|
12586 |
|
12587 | function debugCheckAndUpdateView(view) {
|
12588 | return callWithDebugContext(DebugAction.detectChanges, checkAndUpdateView, null, [view]);
|
12589 | }
|
12590 |
|
12591 |
|
12592 |
|
12593 |
|
12594 | function debugCheckNoChangesView(view) {
|
12595 | return callWithDebugContext(DebugAction.checkNoChanges, checkNoChangesView, null, [view]);
|
12596 | }
|
12597 |
|
12598 |
|
12599 |
|
12600 |
|
12601 | function debugDestroyView(view) {
|
12602 | return callWithDebugContext(DebugAction.destroy, destroyView, null, [view]);
|
12603 | }
|
12604 | var DebugAction = {};
|
12605 | DebugAction.create = 0;
|
12606 | DebugAction.detectChanges = 1;
|
12607 | DebugAction.checkNoChanges = 2;
|
12608 | DebugAction.destroy = 3;
|
12609 | DebugAction.handleEvent = 4;
|
12610 | DebugAction[DebugAction.create] = "create";
|
12611 | DebugAction[DebugAction.detectChanges] = "detectChanges";
|
12612 | DebugAction[DebugAction.checkNoChanges] = "checkNoChanges";
|
12613 | DebugAction[DebugAction.destroy] = "destroy";
|
12614 | DebugAction[DebugAction.handleEvent] = "handleEvent";
|
12615 | var _currentAction;
|
12616 | var _currentView;
|
12617 | var _currentNodeIndex;
|
12618 |
|
12619 |
|
12620 |
|
12621 |
|
12622 |
|
12623 | function debugSetCurrentNode(view, nodeIndex) {
|
12624 | _currentView = view;
|
12625 | _currentNodeIndex = nodeIndex;
|
12626 | }
|
12627 |
|
12628 |
|
12629 |
|
12630 |
|
12631 |
|
12632 |
|
12633 |
|
12634 | function debugHandleEvent(view, nodeIndex, eventName, event) {
|
12635 | debugSetCurrentNode(view, nodeIndex);
|
12636 | return callWithDebugContext(DebugAction.handleEvent, view.def.handleEvent, null, [view, nodeIndex, eventName, event]);
|
12637 | }
|
12638 |
|
12639 |
|
12640 |
|
12641 |
|
12642 |
|
12643 | function debugUpdateDirectives(view, checkType) {
|
12644 | if (view.state & 16 ) {
|
12645 | throw viewDestroyedError(DebugAction[_currentAction]);
|
12646 | }
|
12647 | debugSetCurrentNode(view, nextDirectiveWithBinding(view, 0));
|
12648 | return view.def.updateDirectives(debugCheckDirectivesFn, view);
|
12649 | |
12650 |
|
12651 |
|
12652 |
|
12653 |
|
12654 |
|
12655 |
|
12656 | function debugCheckDirectivesFn(view, nodeIndex, argStyle) {
|
12657 | var values = [];
|
12658 | for (var _i = 3; _i < arguments.length; _i++) {
|
12659 | values[_i - 3] = arguments[_i];
|
12660 | }
|
12661 | var nodeDef = view.def.nodes[nodeIndex];
|
12662 | if (checkType === 0 ) {
|
12663 | debugCheckAndUpdateNode(view, nodeDef, argStyle, values);
|
12664 | }
|
12665 | else {
|
12666 | debugCheckNoChangesNode(view, nodeDef, argStyle, values);
|
12667 | }
|
12668 | if (nodeDef.flags & 8192 ) {
|
12669 | debugSetCurrentNode(view, nextDirectiveWithBinding(view, nodeIndex));
|
12670 | }
|
12671 | return (nodeDef.flags & 112 ) ?
|
12672 | asPureExpressionData(view, nodeDef.index).value :
|
12673 | undefined;
|
12674 | }
|
12675 | }
|
12676 |
|
12677 |
|
12678 |
|
12679 |
|
12680 |
|
12681 | function debugUpdateRenderer(view, checkType) {
|
12682 | if (view.state & 16 ) {
|
12683 | throw viewDestroyedError(DebugAction[_currentAction]);
|
12684 | }
|
12685 | debugSetCurrentNode(view, nextRenderNodeWithBinding(view, 0));
|
12686 | return view.def.updateRenderer(debugCheckRenderNodeFn, view);
|
12687 | |
12688 |
|
12689 |
|
12690 |
|
12691 |
|
12692 |
|
12693 |
|
12694 | function debugCheckRenderNodeFn(view, nodeIndex, argStyle) {
|
12695 | var values = [];
|
12696 | for (var _i = 3; _i < arguments.length; _i++) {
|
12697 | values[_i - 3] = arguments[_i];
|
12698 | }
|
12699 | var nodeDef = view.def.nodes[nodeIndex];
|
12700 | if (checkType === 0 ) {
|
12701 | debugCheckAndUpdateNode(view, nodeDef, argStyle, values);
|
12702 | }
|
12703 | else {
|
12704 | debugCheckNoChangesNode(view, nodeDef, argStyle, values);
|
12705 | }
|
12706 | if (nodeDef.flags & 3 ) {
|
12707 | debugSetCurrentNode(view, nextRenderNodeWithBinding(view, nodeIndex));
|
12708 | }
|
12709 | return (nodeDef.flags & 112 ) ?
|
12710 | asPureExpressionData(view, nodeDef.index).value :
|
12711 | undefined;
|
12712 | }
|
12713 | }
|
12714 |
|
12715 |
|
12716 |
|
12717 |
|
12718 |
|
12719 |
|
12720 |
|
12721 | function debugCheckAndUpdateNode(view, nodeDef, argStyle, givenValues) {
|
12722 | var changed = ((checkAndUpdateNode)).apply(void 0, [view, nodeDef, argStyle].concat(givenValues));
|
12723 | if (changed) {
|
12724 | var values = argStyle === 1 ? givenValues[0] : givenValues;
|
12725 | if (nodeDef.flags & 8192 ) {
|
12726 | var bindingValues = {};
|
12727 | for (var i = 0; i < nodeDef.bindings.length; i++) {
|
12728 | var binding = nodeDef.bindings[i];
|
12729 | var value = values[i];
|
12730 | if (binding.flags & 8 ) {
|
12731 | bindingValues[normalizeDebugBindingName( ((binding.nonMinifiedName)))] =
|
12732 | normalizeDebugBindingValue(value);
|
12733 | }
|
12734 | }
|
12735 | var elDef = ((nodeDef.parent));
|
12736 | var el = asElementData(view, elDef.index).renderElement;
|
12737 | if (!((elDef.element)).name) {
|
12738 |
|
12739 | view.renderer.setValue(el, "bindings=" + JSON.stringify(bindingValues, null, 2));
|
12740 | }
|
12741 | else {
|
12742 |
|
12743 | for (var attr in bindingValues) {
|
12744 | var value = bindingValues[attr];
|
12745 | if (value != null) {
|
12746 | view.renderer.setAttribute(el, attr, value);
|
12747 | }
|
12748 | else {
|
12749 | view.renderer.removeAttribute(el, attr);
|
12750 | }
|
12751 | }
|
12752 | }
|
12753 | }
|
12754 | }
|
12755 | }
|
12756 |
|
12757 |
|
12758 |
|
12759 |
|
12760 |
|
12761 |
|
12762 |
|
12763 | function debugCheckNoChangesNode(view, nodeDef, argStyle, values) {
|
12764 | ((checkNoChangesNode)).apply(void 0, [view, nodeDef, argStyle].concat(values));
|
12765 | }
|
12766 |
|
12767 |
|
12768 |
|
12769 |
|
12770 | function normalizeDebugBindingName(name) {
|
12771 |
|
12772 | name = camelCaseToDashCase(name.replace(/[$@]/g, '_'));
|
12773 | return "ng-reflect-" + name;
|
12774 | }
|
12775 | var CAMEL_CASE_REGEXP = /([A-Z])/g;
|
12776 |
|
12777 |
|
12778 |
|
12779 |
|
12780 | function camelCaseToDashCase(input) {
|
12781 | return input.replace(CAMEL_CASE_REGEXP, function () {
|
12782 | var m = [];
|
12783 | for (var _i = 0; _i < arguments.length; _i++) {
|
12784 | m[_i] = arguments[_i];
|
12785 | }
|
12786 | return '-' + m[1].toLowerCase();
|
12787 | });
|
12788 | }
|
12789 |
|
12790 |
|
12791 |
|
12792 |
|
12793 | function normalizeDebugBindingValue(value) {
|
12794 | try {
|
12795 |
|
12796 | return value != null ? value.toString().slice(0, 30) : value;
|
12797 | }
|
12798 | catch (e) {
|
12799 | return '[ERROR] Exception while trying to serialize the value';
|
12800 | }
|
12801 | }
|
12802 |
|
12803 |
|
12804 |
|
12805 |
|
12806 |
|
12807 | function nextDirectiveWithBinding(view, nodeIndex) {
|
12808 | for (var i = nodeIndex; i < view.def.nodes.length; i++) {
|
12809 | var nodeDef = view.def.nodes[i];
|
12810 | if (nodeDef.flags & 8192 && nodeDef.bindings && nodeDef.bindings.length) {
|
12811 | return i;
|
12812 | }
|
12813 | }
|
12814 | return null;
|
12815 | }
|
12816 |
|
12817 |
|
12818 |
|
12819 |
|
12820 |
|
12821 | function nextRenderNodeWithBinding(view, nodeIndex) {
|
12822 | for (var i = nodeIndex; i < view.def.nodes.length; i++) {
|
12823 | var nodeDef = view.def.nodes[i];
|
12824 | if ((nodeDef.flags & 3 ) && nodeDef.bindings && nodeDef.bindings.length) {
|
12825 | return i;
|
12826 | }
|
12827 | }
|
12828 | return null;
|
12829 | }
|
12830 | var DebugContext_ = (function () {
|
12831 | |
12832 |
|
12833 |
|
12834 |
|
12835 | function DebugContext_(view, nodeIndex) {
|
12836 | this.view = view;
|
12837 | this.nodeIndex = nodeIndex;
|
12838 | if (nodeIndex == null) {
|
12839 | this.nodeIndex = nodeIndex = 0;
|
12840 | }
|
12841 | this.nodeDef = view.def.nodes[nodeIndex];
|
12842 | var elDef = this.nodeDef;
|
12843 | var elView = view;
|
12844 | while (elDef && (elDef.flags & 1 ) === 0) {
|
12845 | elDef = elDef.parent;
|
12846 | }
|
12847 | if (!elDef) {
|
12848 | while (!elDef && elView) {
|
12849 | elDef = viewParentEl(elView);
|
12850 | elView = elView.parent;
|
12851 | }
|
12852 | }
|
12853 | this.elDef = elDef;
|
12854 | this.elView = elView;
|
12855 | }
|
12856 | Object.defineProperty(DebugContext_.prototype, "elOrCompView", {
|
12857 | |
12858 |
|
12859 |
|
12860 | get: function () {
|
12861 |
|
12862 | return asElementData(this.elView, this.elDef.index).componentView || this.view;
|
12863 | },
|
12864 | enumerable: true,
|
12865 | configurable: true
|
12866 | });
|
12867 | Object.defineProperty(DebugContext_.prototype, "injector", {
|
12868 | |
12869 |
|
12870 |
|
12871 | get: function () { return createInjector(this.elView, this.elDef); },
|
12872 | enumerable: true,
|
12873 | configurable: true
|
12874 | });
|
12875 | Object.defineProperty(DebugContext_.prototype, "component", {
|
12876 | |
12877 |
|
12878 |
|
12879 | get: function () { return this.elOrCompView.component; },
|
12880 | enumerable: true,
|
12881 | configurable: true
|
12882 | });
|
12883 | Object.defineProperty(DebugContext_.prototype, "context", {
|
12884 | |
12885 |
|
12886 |
|
12887 | get: function () { return this.elOrCompView.context; },
|
12888 | enumerable: true,
|
12889 | configurable: true
|
12890 | });
|
12891 | Object.defineProperty(DebugContext_.prototype, "providerTokens", {
|
12892 | |
12893 |
|
12894 |
|
12895 | get: function () {
|
12896 | var tokens = [];
|
12897 | if (this.elDef) {
|
12898 | for (var i = this.elDef.index + 1; i <= this.elDef.index + this.elDef.childCount; i++) {
|
12899 | var childDef = this.elView.def.nodes[i];
|
12900 | if (childDef.flags & 10112 ) {
|
12901 | tokens.push( ((childDef.provider)).token);
|
12902 | }
|
12903 | i += childDef.childCount;
|
12904 | }
|
12905 | }
|
12906 | return tokens;
|
12907 | },
|
12908 | enumerable: true,
|
12909 | configurable: true
|
12910 | });
|
12911 | Object.defineProperty(DebugContext_.prototype, "references", {
|
12912 | |
12913 |
|
12914 |
|
12915 | get: function () {
|
12916 | var references = {};
|
12917 | if (this.elDef) {
|
12918 | collectReferences(this.elView, this.elDef, references);
|
12919 | for (var i = this.elDef.index + 1; i <= this.elDef.index + this.elDef.childCount; i++) {
|
12920 | var childDef = this.elView.def.nodes[i];
|
12921 | if (childDef.flags & 10112 ) {
|
12922 | collectReferences(this.elView, childDef, references);
|
12923 | }
|
12924 | i += childDef.childCount;
|
12925 | }
|
12926 | }
|
12927 | return references;
|
12928 | },
|
12929 | enumerable: true,
|
12930 | configurable: true
|
12931 | });
|
12932 | Object.defineProperty(DebugContext_.prototype, "componentRenderElement", {
|
12933 | |
12934 |
|
12935 |
|
12936 | get: function () {
|
12937 | var elData = findHostElement(this.elOrCompView);
|
12938 | return elData ? elData.renderElement : undefined;
|
12939 | },
|
12940 | enumerable: true,
|
12941 | configurable: true
|
12942 | });
|
12943 | Object.defineProperty(DebugContext_.prototype, "renderNode", {
|
12944 | |
12945 |
|
12946 |
|
12947 | get: function () {
|
12948 | return this.nodeDef.flags & 2 ? renderNode(this.view, this.nodeDef) :
|
12949 | renderNode(this.elView, this.elDef);
|
12950 | },
|
12951 | enumerable: true,
|
12952 | configurable: true
|
12953 | });
|
12954 | |
12955 |
|
12956 |
|
12957 |
|
12958 |
|
12959 | DebugContext_.prototype.logError = function (console) {
|
12960 | var values = [];
|
12961 | for (var _i = 1; _i < arguments.length; _i++) {
|
12962 | values[_i - 1] = arguments[_i];
|
12963 | }
|
12964 | var logViewDef;
|
12965 | var logNodeIndex;
|
12966 | if (this.nodeDef.flags & 2 ) {
|
12967 | logViewDef = this.view.def;
|
12968 | logNodeIndex = this.nodeDef.index;
|
12969 | }
|
12970 | else {
|
12971 | logViewDef = this.elView.def;
|
12972 | logNodeIndex = this.elDef.index;
|
12973 | }
|
12974 |
|
12975 |
|
12976 | var renderNodeIndex = getRenderNodeIndex(logViewDef, logNodeIndex);
|
12977 | var currRenderNodeIndex = -1;
|
12978 | var nodeLogger = function () {
|
12979 | currRenderNodeIndex++;
|
12980 | if (currRenderNodeIndex === renderNodeIndex) {
|
12981 | return (_a = console.error).bind.apply(_a, [console].concat(values));
|
12982 | }
|
12983 | else {
|
12984 | return NOOP;
|
12985 | }
|
12986 | var _a;
|
12987 | };
|
12988 | ((logViewDef.factory))(nodeLogger);
|
12989 | if (currRenderNodeIndex < renderNodeIndex) {
|
12990 | console.error('Illegal state: the ViewDefinitionFactory did not call the logger!');
|
12991 | console.error.apply(console, values);
|
12992 | }
|
12993 | };
|
12994 | return DebugContext_;
|
12995 | }());
|
12996 |
|
12997 |
|
12998 |
|
12999 |
|
13000 |
|
13001 | function getRenderNodeIndex(viewDef$$1, nodeIndex) {
|
13002 | var renderNodeIndex = -1;
|
13003 | for (var i = 0; i <= nodeIndex; i++) {
|
13004 | var nodeDef = viewDef$$1.nodes[i];
|
13005 | if (nodeDef.flags & 3 ) {
|
13006 | renderNodeIndex++;
|
13007 | }
|
13008 | }
|
13009 | return renderNodeIndex;
|
13010 | }
|
13011 |
|
13012 |
|
13013 |
|
13014 |
|
13015 | function findHostElement(view) {
|
13016 | while (view && !isComponentView(view)) {
|
13017 | view = ((view.parent));
|
13018 | }
|
13019 | if (view.parent) {
|
13020 | return asElementData(view.parent, ((viewParentEl(view))).index);
|
13021 | }
|
13022 | return null;
|
13023 | }
|
13024 |
|
13025 |
|
13026 |
|
13027 |
|
13028 |
|
13029 |
|
13030 | function collectReferences(view, nodeDef, references) {
|
13031 | for (var refName in nodeDef.references) {
|
13032 | references[refName] = getQueryValue(view, nodeDef, nodeDef.references[refName]);
|
13033 | }
|
13034 | }
|
13035 |
|
13036 |
|
13037 |
|
13038 |
|
13039 |
|
13040 |
|
13041 |
|
13042 | function callWithDebugContext(action, fn, self, args) {
|
13043 | var oldAction = _currentAction;
|
13044 | var oldView = _currentView;
|
13045 | var oldNodeIndex = _currentNodeIndex;
|
13046 | try {
|
13047 | _currentAction = action;
|
13048 | var result = fn.apply(self, args);
|
13049 | _currentView = oldView;
|
13050 | _currentNodeIndex = oldNodeIndex;
|
13051 | _currentAction = oldAction;
|
13052 | return result;
|
13053 | }
|
13054 | catch (e) {
|
13055 | if (isViewDebugError(e) || !_currentView) {
|
13056 | throw e;
|
13057 | }
|
13058 | throw viewWrappedDebugError(e, ((getCurrentDebugContext())));
|
13059 | }
|
13060 | }
|
13061 |
|
13062 |
|
13063 |
|
13064 | function getCurrentDebugContext() {
|
13065 | return _currentView ? new DebugContext_(_currentView, _currentNodeIndex) : null;
|
13066 | }
|
13067 | var DebugRendererFactory2 = (function () {
|
13068 | |
13069 |
|
13070 |
|
13071 | function DebugRendererFactory2(delegate) {
|
13072 | this.delegate = delegate;
|
13073 | }
|
13074 | |
13075 |
|
13076 |
|
13077 |
|
13078 |
|
13079 | DebugRendererFactory2.prototype.createRenderer = function (element, renderData) {
|
13080 | return new DebugRenderer2(this.delegate.createRenderer(element, renderData));
|
13081 | };
|
13082 | return DebugRendererFactory2;
|
13083 | }());
|
13084 | var DebugRenderer2 = (function () {
|
13085 | |
13086 |
|
13087 |
|
13088 | function DebugRenderer2(delegate) {
|
13089 | this.delegate = delegate;
|
13090 | }
|
13091 | Object.defineProperty(DebugRenderer2.prototype, "data", {
|
13092 | |
13093 |
|
13094 |
|
13095 | get: function () { return this.delegate.data; },
|
13096 | enumerable: true,
|
13097 | configurable: true
|
13098 | });
|
13099 | |
13100 |
|
13101 |
|
13102 |
|
13103 | DebugRenderer2.prototype.destroyNode = function (node) {
|
13104 | removeDebugNodeFromIndex( ((getDebugNode(node))));
|
13105 | if (this.delegate.destroyNode) {
|
13106 | this.delegate.destroyNode(node);
|
13107 | }
|
13108 | };
|
13109 | |
13110 |
|
13111 |
|
13112 | DebugRenderer2.prototype.destroy = function () { this.delegate.destroy(); };
|
13113 | |
13114 |
|
13115 |
|
13116 |
|
13117 |
|
13118 | DebugRenderer2.prototype.createElement = function (name, namespace) {
|
13119 | var el = this.delegate.createElement(name, namespace);
|
13120 | var debugCtx = getCurrentDebugContext();
|
13121 | if (debugCtx) {
|
13122 | var debugEl = new DebugElement(el, null, debugCtx);
|
13123 | debugEl.name = name;
|
13124 | indexDebugNode(debugEl);
|
13125 | }
|
13126 | return el;
|
13127 | };
|
13128 | |
13129 |
|
13130 |
|
13131 |
|
13132 | DebugRenderer2.prototype.createComment = function (value) {
|
13133 | var comment = this.delegate.createComment(value);
|
13134 | var debugCtx = getCurrentDebugContext();
|
13135 | if (debugCtx) {
|
13136 | indexDebugNode(new DebugNode(comment, null, debugCtx));
|
13137 | }
|
13138 | return comment;
|
13139 | };
|
13140 | |
13141 |
|
13142 |
|
13143 |
|
13144 | DebugRenderer2.prototype.createText = function (value) {
|
13145 | var text = this.delegate.createText(value);
|
13146 | var debugCtx = getCurrentDebugContext();
|
13147 | if (debugCtx) {
|
13148 | indexDebugNode(new DebugNode(text, null, debugCtx));
|
13149 | }
|
13150 | return text;
|
13151 | };
|
13152 | |
13153 |
|
13154 |
|
13155 |
|
13156 |
|
13157 | DebugRenderer2.prototype.appendChild = function (parent, newChild) {
|
13158 | var debugEl = getDebugNode(parent);
|
13159 | var debugChildEl = getDebugNode(newChild);
|
13160 | if (debugEl && debugChildEl && debugEl instanceof DebugElement) {
|
13161 | debugEl.addChild(debugChildEl);
|
13162 | }
|
13163 | this.delegate.appendChild(parent, newChild);
|
13164 | };
|
13165 | |
13166 |
|
13167 |
|
13168 |
|
13169 |
|
13170 |
|
13171 | DebugRenderer2.prototype.insertBefore = function (parent, newChild, refChild) {
|
13172 | var debugEl = getDebugNode(parent);
|
13173 | var debugChildEl = getDebugNode(newChild);
|
13174 | var debugRefEl = ((getDebugNode(refChild)));
|
13175 | if (debugEl && debugChildEl && debugEl instanceof DebugElement) {
|
13176 | debugEl.insertBefore(debugRefEl, debugChildEl);
|
13177 | }
|
13178 | this.delegate.insertBefore(parent, newChild, refChild);
|
13179 | };
|
13180 | |
13181 |
|
13182 |
|
13183 |
|
13184 |
|
13185 | DebugRenderer2.prototype.removeChild = function (parent, oldChild) {
|
13186 | var debugEl = getDebugNode(parent);
|
13187 | var debugChildEl = getDebugNode(oldChild);
|
13188 | if (debugEl && debugChildEl && debugEl instanceof DebugElement) {
|
13189 | debugEl.removeChild(debugChildEl);
|
13190 | }
|
13191 | this.delegate.removeChild(parent, oldChild);
|
13192 | };
|
13193 | |
13194 |
|
13195 |
|
13196 |
|
13197 | DebugRenderer2.prototype.selectRootElement = function (selectorOrNode) {
|
13198 | var el = this.delegate.selectRootElement(selectorOrNode);
|
13199 | var debugCtx = getCurrentDebugContext();
|
13200 | if (debugCtx) {
|
13201 | indexDebugNode(new DebugElement(el, null, debugCtx));
|
13202 | }
|
13203 | return el;
|
13204 | };
|
13205 | |
13206 |
|
13207 |
|
13208 |
|
13209 |
|
13210 |
|
13211 |
|
13212 | DebugRenderer2.prototype.setAttribute = function (el, name, value, namespace) {
|
13213 | var debugEl = getDebugNode(el);
|
13214 | if (debugEl && debugEl instanceof DebugElement) {
|
13215 | var fullName = namespace ? namespace + ':' + name : name;
|
13216 | debugEl.attributes[fullName] = value;
|
13217 | }
|
13218 | this.delegate.setAttribute(el, name, value, namespace);
|
13219 | };
|
13220 | |
13221 |
|
13222 |
|
13223 |
|
13224 |
|
13225 |
|
13226 | DebugRenderer2.prototype.removeAttribute = function (el, name, namespace) {
|
13227 | var debugEl = getDebugNode(el);
|
13228 | if (debugEl && debugEl instanceof DebugElement) {
|
13229 | var fullName = namespace ? namespace + ':' + name : name;
|
13230 | debugEl.attributes[fullName] = null;
|
13231 | }
|
13232 | this.delegate.removeAttribute(el, name, namespace);
|
13233 | };
|
13234 | |
13235 |
|
13236 |
|
13237 |
|
13238 |
|
13239 | DebugRenderer2.prototype.addClass = function (el, name) {
|
13240 | var debugEl = getDebugNode(el);
|
13241 | if (debugEl && debugEl instanceof DebugElement) {
|
13242 | debugEl.classes[name] = true;
|
13243 | }
|
13244 | this.delegate.addClass(el, name);
|
13245 | };
|
13246 | |
13247 |
|
13248 |
|
13249 |
|
13250 |
|
13251 | DebugRenderer2.prototype.removeClass = function (el, name) {
|
13252 | var debugEl = getDebugNode(el);
|
13253 | if (debugEl && debugEl instanceof DebugElement) {
|
13254 | debugEl.classes[name] = false;
|
13255 | }
|
13256 | this.delegate.removeClass(el, name);
|
13257 | };
|
13258 | |
13259 |
|
13260 |
|
13261 |
|
13262 |
|
13263 |
|
13264 |
|
13265 | DebugRenderer2.prototype.setStyle = function (el, style, value, flags) {
|
13266 | var debugEl = getDebugNode(el);
|
13267 | if (debugEl && debugEl instanceof DebugElement) {
|
13268 | debugEl.styles[style] = value;
|
13269 | }
|
13270 | this.delegate.setStyle(el, style, value, flags);
|
13271 | };
|
13272 | |
13273 |
|
13274 |
|
13275 |
|
13276 |
|
13277 |
|
13278 | DebugRenderer2.prototype.removeStyle = function (el, style, flags) {
|
13279 | var debugEl = getDebugNode(el);
|
13280 | if (debugEl && debugEl instanceof DebugElement) {
|
13281 | debugEl.styles[style] = null;
|
13282 | }
|
13283 | this.delegate.removeStyle(el, style, flags);
|
13284 | };
|
13285 | |
13286 |
|
13287 |
|
13288 |
|
13289 |
|
13290 |
|
13291 | DebugRenderer2.prototype.setProperty = function (el, name, value) {
|
13292 | var debugEl = getDebugNode(el);
|
13293 | if (debugEl && debugEl instanceof DebugElement) {
|
13294 | debugEl.properties[name] = value;
|
13295 | }
|
13296 | this.delegate.setProperty(el, name, value);
|
13297 | };
|
13298 | |
13299 |
|
13300 |
|
13301 |
|
13302 |
|
13303 |
|
13304 | DebugRenderer2.prototype.listen = function (target, eventName, callback) {
|
13305 | if (typeof target !== 'string') {
|
13306 | var debugEl = getDebugNode(target);
|
13307 | if (debugEl) {
|
13308 | debugEl.listeners.push(new EventListener(eventName, callback));
|
13309 | }
|
13310 | }
|
13311 | return this.delegate.listen(target, eventName, callback);
|
13312 | };
|
13313 | |
13314 |
|
13315 |
|
13316 |
|
13317 | DebugRenderer2.prototype.parentNode = function (node) { return this.delegate.parentNode(node); };
|
13318 | |
13319 |
|
13320 |
|
13321 |
|
13322 | DebugRenderer2.prototype.nextSibling = function (node) { return this.delegate.nextSibling(node); };
|
13323 | |
13324 |
|
13325 |
|
13326 |
|
13327 |
|
13328 | DebugRenderer2.prototype.setValue = function (node, value) { return this.delegate.setValue(node, value); };
|
13329 | return DebugRenderer2;
|
13330 | }());
|
13331 |
|
13332 |
|
13333 |
|
13334 |
|
13335 |
|
13336 |
|
13337 |
|
13338 |
|
13339 |
|
13340 |
|
13341 |
|
13342 |
|
13343 |
|
13344 |
|
13345 |
|
13346 |
|
13347 |
|
13348 | function _iterableDiffersFactory() {
|
13349 | return defaultIterableDiffers;
|
13350 | }
|
13351 |
|
13352 |
|
13353 |
|
13354 | function _keyValueDiffersFactory() {
|
13355 | return defaultKeyValueDiffers;
|
13356 | }
|
13357 |
|
13358 |
|
13359 |
|
13360 |
|
13361 | function _localeFactory(locale) {
|
13362 | return locale || 'en-US';
|
13363 | }
|
13364 |
|
13365 |
|
13366 |
|
13367 | function _initViewEngine() {
|
13368 | initServicesIfNeeded();
|
13369 | }
|
13370 |
|
13371 |
|
13372 |
|
13373 |
|
13374 |
|
13375 |
|
13376 | var ApplicationModule = (function () {
|
13377 | |
13378 |
|
13379 |
|
13380 | function ApplicationModule(appRef) {
|
13381 | }
|
13382 | return ApplicationModule;
|
13383 | }());
|
13384 | ApplicationModule.decorators = [
|
13385 | { type: NgModule, args: [{
|
13386 | providers: [
|
13387 | ApplicationRef_,
|
13388 | { provide: ApplicationRef, useExisting: ApplicationRef_ },
|
13389 | ApplicationInitStatus,
|
13390 | Compiler,
|
13391 | APP_ID_RANDOM_PROVIDER,
|
13392 | { provide: IterableDiffers, useFactory: _iterableDiffersFactory },
|
13393 | { provide: KeyValueDiffers, useFactory: _keyValueDiffersFactory },
|
13394 | {
|
13395 | provide: LOCALE_ID,
|
13396 | useFactory: _localeFactory,
|
13397 | deps: [[new Inject(LOCALE_ID), new Optional(), new SkipSelf()]]
|
13398 | },
|
13399 | { provide: APP_INITIALIZER, useValue: _initViewEngine, multi: true },
|
13400 | ]
|
13401 | },] },
|
13402 | ];
|
13403 |
|
13404 |
|
13405 |
|
13406 | ApplicationModule.ctorParameters = function () { return [
|
13407 | { type: ApplicationRef, },
|
13408 | ]; };
|
13409 |
|
13410 |
|
13411 |
|
13412 |
|
13413 |
|
13414 |
|
13415 |
|
13416 | var LifecycleHooks = {};
|
13417 | LifecycleHooks.OnInit = 0;
|
13418 | LifecycleHooks.OnDestroy = 1;
|
13419 | LifecycleHooks.DoCheck = 2;
|
13420 | LifecycleHooks.OnChanges = 3;
|
13421 | LifecycleHooks.AfterContentInit = 4;
|
13422 | LifecycleHooks.AfterContentChecked = 5;
|
13423 | LifecycleHooks.AfterViewInit = 6;
|
13424 | LifecycleHooks.AfterViewChecked = 7;
|
13425 | LifecycleHooks[LifecycleHooks.OnInit] = "OnInit";
|
13426 | LifecycleHooks[LifecycleHooks.OnDestroy] = "OnDestroy";
|
13427 | LifecycleHooks[LifecycleHooks.DoCheck] = "DoCheck";
|
13428 | LifecycleHooks[LifecycleHooks.OnChanges] = "OnChanges";
|
13429 | LifecycleHooks[LifecycleHooks.AfterContentInit] = "AfterContentInit";
|
13430 | LifecycleHooks[LifecycleHooks.AfterContentChecked] = "AfterContentChecked";
|
13431 | LifecycleHooks[LifecycleHooks.AfterViewInit] = "AfterViewInit";
|
13432 | LifecycleHooks[LifecycleHooks.AfterViewChecked] = "AfterViewChecked";
|
13433 | var LIFECYCLE_HOOKS_VALUES = [
|
13434 | LifecycleHooks.OnInit, LifecycleHooks.OnDestroy, LifecycleHooks.DoCheck, LifecycleHooks.OnChanges,
|
13435 | LifecycleHooks.AfterContentInit, LifecycleHooks.AfterContentChecked, LifecycleHooks.AfterViewInit,
|
13436 | LifecycleHooks.AfterViewChecked
|
13437 | ];
|
13438 |
|
13439 |
|
13440 |
|
13441 |
|
13442 |
|
13443 |
|
13444 |
|
13445 |
|
13446 |
|
13447 |
|
13448 |
|
13449 |
|
13450 |
|
13451 |
|
13452 |
|
13453 |
|
13454 |
|
13455 |
|
13456 |
|
13457 |
|
13458 |
|
13459 |
|
13460 |
|
13461 |
|
13462 |
|
13463 |
|
13464 |
|
13465 |
|
13466 |
|
13467 |
|
13468 |
|
13469 |
|
13470 |
|
13471 |
|
13472 |
|
13473 |
|
13474 |
|
13475 |
|
13476 |
|
13477 |
|
13478 |
|
13479 |
|
13480 |
|
13481 |
|
13482 |
|
13483 |
|
13484 |
|
13485 |
|
13486 |
|
13487 |
|
13488 |
|
13489 |
|
13490 |
|
13491 |
|
13492 |
|
13493 |
|
13494 |
|
13495 |
|
13496 |
|
13497 |
|
13498 |
|
13499 |
|
13500 |
|
13501 |
|
13502 |
|
13503 |
|
13504 |
|
13505 |
|
13506 |
|
13507 |
|
13508 |
|
13509 | function trigger$1(name, definitions) {
|
13510 | return { name: name, definitions: definitions };
|
13511 | }
|
13512 |
|
13513 |
|
13514 |
|
13515 |
|
13516 |
|
13517 |
|
13518 |
|
13519 |
|
13520 |
|
13521 |
|
13522 |
|
13523 |
|
13524 |
|
13525 |
|
13526 |
|
13527 |
|
13528 |
|
13529 |
|
13530 |
|
13531 |
|
13532 |
|
13533 |
|
13534 |
|
13535 |
|
13536 |
|
13537 |
|
13538 |
|
13539 |
|
13540 |
|
13541 |
|
13542 |
|
13543 |
|
13544 |
|
13545 |
|
13546 |
|
13547 |
|
13548 |
|
13549 |
|
13550 |
|
13551 |
|
13552 |
|
13553 |
|
13554 |
|
13555 |
|
13556 |
|
13557 |
|
13558 |
|
13559 |
|
13560 | function animate$1(timings, styles) {
|
13561 | if (styles === void 0) { styles = null; }
|
13562 | return { type: 4 , styles: styles, timings: timings };
|
13563 | }
|
13564 |
|
13565 |
|
13566 |
|
13567 |
|
13568 |
|
13569 |
|
13570 |
|
13571 |
|
13572 |
|
13573 |
|
13574 |
|
13575 |
|
13576 |
|
13577 |
|
13578 |
|
13579 |
|
13580 |
|
13581 |
|
13582 |
|
13583 |
|
13584 |
|
13585 |
|
13586 |
|
13587 |
|
13588 |
|
13589 |
|
13590 |
|
13591 |
|
13592 |
|
13593 |
|
13594 |
|
13595 |
|
13596 |
|
13597 | function group$1(steps) {
|
13598 | return { type: 3 , steps: steps };
|
13599 | }
|
13600 |
|
13601 |
|
13602 |
|
13603 |
|
13604 |
|
13605 |
|
13606 |
|
13607 |
|
13608 |
|
13609 |
|
13610 |
|
13611 |
|
13612 |
|
13613 |
|
13614 |
|
13615 |
|
13616 |
|
13617 |
|
13618 |
|
13619 |
|
13620 |
|
13621 |
|
13622 |
|
13623 |
|
13624 |
|
13625 |
|
13626 |
|
13627 |
|
13628 |
|
13629 |
|
13630 |
|
13631 |
|
13632 |
|
13633 |
|
13634 |
|
13635 |
|
13636 | function sequence$1(steps) {
|
13637 | return { type: 2 , steps: steps };
|
13638 | }
|
13639 |
|
13640 |
|
13641 |
|
13642 |
|
13643 |
|
13644 |
|
13645 |
|
13646 |
|
13647 |
|
13648 |
|
13649 |
|
13650 |
|
13651 |
|
13652 |
|
13653 |
|
13654 |
|
13655 |
|
13656 |
|
13657 |
|
13658 |
|
13659 |
|
13660 |
|
13661 |
|
13662 |
|
13663 |
|
13664 |
|
13665 |
|
13666 |
|
13667 |
|
13668 |
|
13669 |
|
13670 |
|
13671 |
|
13672 |
|
13673 |
|
13674 |
|
13675 |
|
13676 |
|
13677 |
|
13678 |
|
13679 |
|
13680 |
|
13681 |
|
13682 |
|
13683 | function style$1(tokens) {
|
13684 | return { type: 6 , styles: tokens };
|
13685 | }
|
13686 |
|
13687 |
|
13688 |
|
13689 |
|
13690 |
|
13691 |
|
13692 |
|
13693 |
|
13694 |
|
13695 |
|
13696 |
|
13697 |
|
13698 |
|
13699 |
|
13700 |
|
13701 |
|
13702 |
|
13703 |
|
13704 |
|
13705 |
|
13706 |
|
13707 |
|
13708 |
|
13709 |
|
13710 |
|
13711 |
|
13712 |
|
13713 |
|
13714 |
|
13715 |
|
13716 |
|
13717 |
|
13718 |
|
13719 |
|
13720 |
|
13721 |
|
13722 |
|
13723 |
|
13724 |
|
13725 |
|
13726 |
|
13727 |
|
13728 |
|
13729 |
|
13730 |
|
13731 |
|
13732 |
|
13733 |
|
13734 |
|
13735 |
|
13736 |
|
13737 | function state$1(name, styles) {
|
13738 | return { type: 0 , name: name, styles: styles };
|
13739 | }
|
13740 |
|
13741 |
|
13742 |
|
13743 |
|
13744 |
|
13745 |
|
13746 |
|
13747 |
|
13748 |
|
13749 |
|
13750 |
|
13751 |
|
13752 |
|
13753 |
|
13754 |
|
13755 |
|
13756 |
|
13757 |
|
13758 |
|
13759 |
|
13760 |
|
13761 |
|
13762 |
|
13763 |
|
13764 |
|
13765 |
|
13766 |
|
13767 |
|
13768 |
|
13769 |
|
13770 |
|
13771 |
|
13772 |
|
13773 |
|
13774 |
|
13775 |
|
13776 |
|
13777 |
|
13778 |
|
13779 |
|
13780 |
|
13781 |
|
13782 |
|
13783 |
|
13784 |
|
13785 |
|
13786 |
|
13787 | function keyframes$1(steps) {
|
13788 | return { type: 5 , steps: steps };
|
13789 | }
|
13790 |
|
13791 |
|
13792 |
|
13793 |
|
13794 |
|
13795 |
|
13796 |
|
13797 |
|
13798 |
|
13799 |
|
13800 |
|
13801 |
|
13802 |
|
13803 |
|
13804 |
|
13805 |
|
13806 |
|
13807 |
|
13808 |
|
13809 |
|
13810 |
|
13811 |
|
13812 |
|
13813 |
|
13814 |
|
13815 |
|
13816 |
|
13817 |
|
13818 |
|
13819 |
|
13820 |
|
13821 |
|
13822 |
|
13823 |
|
13824 |
|
13825 |
|
13826 |
|
13827 |
|
13828 |
|
13829 |
|
13830 |
|
13831 |
|
13832 |
|
13833 |
|
13834 |
|
13835 |
|
13836 |
|
13837 |
|
13838 |
|
13839 |
|
13840 |
|
13841 |
|
13842 |
|
13843 |
|
13844 |
|
13845 |
|
13846 |
|
13847 |
|
13848 |
|
13849 |
|
13850 |
|
13851 |
|
13852 |
|
13853 |
|
13854 |
|
13855 |
|
13856 |
|
13857 |
|
13858 |
|
13859 |
|
13860 |
|
13861 |
|
13862 |
|
13863 |
|
13864 |
|
13865 |
|
13866 |
|
13867 |
|
13868 |
|
13869 |
|
13870 |
|
13871 |
|
13872 |
|
13873 |
|
13874 |
|
13875 |
|
13876 |
|
13877 |
|
13878 |
|
13879 |
|
13880 |
|
13881 |
|
13882 |
|
13883 |
|
13884 |
|
13885 |
|
13886 |
|
13887 |
|
13888 |
|
13889 |
|
13890 |
|
13891 |
|
13892 |
|
13893 |
|
13894 |
|
13895 |
|
13896 |
|
13897 |
|
13898 |
|
13899 |
|
13900 | function transition$1(stateChangeExpr, steps) {
|
13901 | return { type: 1 , expr: stateChangeExpr, animation: steps };
|
13902 | }
|
13903 |
|
13904 |
|
13905 |
|
13906 |
|
13907 |
|
13908 |
|
13909 |
|
13910 |
|
13911 |
|
13912 |
|
13913 | var AUTO_STYLE$$1 = '*';
|
13914 |
|
13915 |
|
13916 |
|
13917 |
|
13918 |
|
13919 |
|
13920 | function trigger$$1(name, definitions) {
|
13921 | return trigger$1(name, definitions);
|
13922 | }
|
13923 |
|
13924 |
|
13925 |
|
13926 |
|
13927 |
|
13928 |
|
13929 | function animate$$1(timings, styles) {
|
13930 | return animate$1(timings, styles);
|
13931 | }
|
13932 |
|
13933 |
|
13934 |
|
13935 |
|
13936 |
|
13937 | function group$$1(steps) {
|
13938 | return group$1(steps);
|
13939 | }
|
13940 |
|
13941 |
|
13942 |
|
13943 |
|
13944 |
|
13945 | function sequence$$1(steps) {
|
13946 | return sequence$1(steps);
|
13947 | }
|
13948 |
|
13949 |
|
13950 |
|
13951 |
|
13952 |
|
13953 | function style$$1(tokens) {
|
13954 | return style$1(tokens);
|
13955 | }
|
13956 |
|
13957 |
|
13958 |
|
13959 |
|
13960 |
|
13961 |
|
13962 | function state$$1(name, styles) {
|
13963 | return state$1(name, styles);
|
13964 | }
|
13965 |
|
13966 |
|
13967 |
|
13968 |
|
13969 |
|
13970 | function keyframes$$1(steps) {
|
13971 | return keyframes$1(steps);
|
13972 | }
|
13973 |
|
13974 |
|
13975 |
|
13976 |
|
13977 |
|
13978 |
|
13979 | function transition$$1(stateChangeExpr, steps) {
|
13980 | return transition$1(stateChangeExpr, steps);
|
13981 | }
|
13982 |
|
13983 | exports.Class = Class;
|
13984 | exports.createPlatform = createPlatform;
|
13985 | exports.assertPlatform = assertPlatform;
|
13986 | exports.destroyPlatform = destroyPlatform;
|
13987 | exports.getPlatform = getPlatform;
|
13988 | exports.PlatformRef = PlatformRef;
|
13989 | exports.ApplicationRef = ApplicationRef;
|
13990 | exports.enableProdMode = enableProdMode;
|
13991 | exports.isDevMode = isDevMode;
|
13992 | exports.createPlatformFactory = createPlatformFactory;
|
13993 | exports.NgProbeToken = NgProbeToken;
|
13994 | exports.APP_ID = APP_ID;
|
13995 | exports.PACKAGE_ROOT_URL = PACKAGE_ROOT_URL;
|
13996 | exports.PLATFORM_INITIALIZER = PLATFORM_INITIALIZER;
|
13997 | exports.PLATFORM_ID = PLATFORM_ID;
|
13998 | exports.APP_BOOTSTRAP_LISTENER = APP_BOOTSTRAP_LISTENER;
|
13999 | exports.APP_INITIALIZER = APP_INITIALIZER;
|
14000 | exports.ApplicationInitStatus = ApplicationInitStatus;
|
14001 | exports.DebugElement = DebugElement;
|
14002 | exports.DebugNode = DebugNode;
|
14003 | exports.asNativeElements = asNativeElements;
|
14004 | exports.getDebugNode = getDebugNode;
|
14005 | exports.Testability = Testability;
|
14006 | exports.TestabilityRegistry = TestabilityRegistry;
|
14007 | exports.setTestabilityGetter = setTestabilityGetter;
|
14008 | exports.TRANSLATIONS = TRANSLATIONS;
|
14009 | exports.TRANSLATIONS_FORMAT = TRANSLATIONS_FORMAT;
|
14010 | exports.LOCALE_ID = LOCALE_ID;
|
14011 | exports.MissingTranslationStrategy = MissingTranslationStrategy;
|
14012 | exports.ApplicationModule = ApplicationModule;
|
14013 | exports.wtfCreateScope = wtfCreateScope;
|
14014 | exports.wtfLeave = wtfLeave;
|
14015 | exports.wtfStartTimeRange = wtfStartTimeRange;
|
14016 | exports.wtfEndTimeRange = wtfEndTimeRange;
|
14017 | exports.Type = Type;
|
14018 | exports.EventEmitter = EventEmitter;
|
14019 | exports.ErrorHandler = ErrorHandler;
|
14020 | exports.Sanitizer = Sanitizer;
|
14021 | exports.SecurityContext = SecurityContext;
|
14022 | exports.ANALYZE_FOR_ENTRY_COMPONENTS = ANALYZE_FOR_ENTRY_COMPONENTS;
|
14023 | exports.Attribute = Attribute;
|
14024 | exports.ContentChild = ContentChild;
|
14025 | exports.ContentChildren = ContentChildren;
|
14026 | exports.Query = Query;
|
14027 | exports.ViewChild = ViewChild;
|
14028 | exports.ViewChildren = ViewChildren;
|
14029 | exports.Component = Component;
|
14030 | exports.Directive = Directive;
|
14031 | exports.HostBinding = HostBinding;
|
14032 | exports.HostListener = HostListener;
|
14033 | exports.Input = Input;
|
14034 | exports.Output = Output;
|
14035 | exports.Pipe = Pipe;
|
14036 | exports.CUSTOM_ELEMENTS_SCHEMA = CUSTOM_ELEMENTS_SCHEMA;
|
14037 | exports.NO_ERRORS_SCHEMA = NO_ERRORS_SCHEMA;
|
14038 | exports.NgModule = NgModule;
|
14039 | exports.ViewEncapsulation = ViewEncapsulation;
|
14040 | exports.Version = Version;
|
14041 | exports.VERSION = VERSION;
|
14042 | exports.forwardRef = forwardRef;
|
14043 | exports.resolveForwardRef = resolveForwardRef;
|
14044 | exports.Injector = Injector;
|
14045 | exports.ReflectiveInjector = ReflectiveInjector;
|
14046 | exports.ResolvedReflectiveFactory = ResolvedReflectiveFactory;
|
14047 | exports.ReflectiveKey = ReflectiveKey;
|
14048 | exports.InjectionToken = InjectionToken;
|
14049 | exports.OpaqueToken = OpaqueToken;
|
14050 | exports.Inject = Inject;
|
14051 | exports.Optional = Optional;
|
14052 | exports.Injectable = Injectable;
|
14053 | exports.Self = Self;
|
14054 | exports.SkipSelf = SkipSelf;
|
14055 | exports.Host = Host;
|
14056 | exports.NgZone = NgZone;
|
14057 | exports.RenderComponentType = RenderComponentType;
|
14058 | exports.Renderer = Renderer;
|
14059 | exports.Renderer2 = Renderer2;
|
14060 | exports.RendererFactory2 = RendererFactory2;
|
14061 | exports.RendererStyleFlags2 = RendererStyleFlags2;
|
14062 | exports.RootRenderer = RootRenderer;
|
14063 | exports.COMPILER_OPTIONS = COMPILER_OPTIONS;
|
14064 | exports.Compiler = Compiler;
|
14065 | exports.CompilerFactory = CompilerFactory;
|
14066 | exports.ModuleWithComponentFactories = ModuleWithComponentFactories;
|
14067 | exports.ComponentFactory = ComponentFactory;
|
14068 | exports.ComponentRef = ComponentRef;
|
14069 | exports.ComponentFactoryResolver = ComponentFactoryResolver;
|
14070 | exports.ElementRef = ElementRef;
|
14071 | exports.NgModuleFactory = NgModuleFactory;
|
14072 | exports.NgModuleRef = NgModuleRef;
|
14073 | exports.NgModuleFactoryLoader = NgModuleFactoryLoader;
|
14074 | exports.getModuleFactory = getModuleFactory;
|
14075 | exports.QueryList = QueryList;
|
14076 | exports.SystemJsNgModuleLoader = SystemJsNgModuleLoader;
|
14077 | exports.SystemJsNgModuleLoaderConfig = SystemJsNgModuleLoaderConfig;
|
14078 | exports.TemplateRef = TemplateRef;
|
14079 | exports.ViewContainerRef = ViewContainerRef;
|
14080 | exports.EmbeddedViewRef = EmbeddedViewRef;
|
14081 | exports.ViewRef = ViewRef;
|
14082 | exports.ChangeDetectionStrategy = ChangeDetectionStrategy;
|
14083 | exports.ChangeDetectorRef = ChangeDetectorRef;
|
14084 | exports.DefaultIterableDiffer = DefaultIterableDiffer;
|
14085 | exports.IterableDiffers = IterableDiffers;
|
14086 | exports.KeyValueDiffers = KeyValueDiffers;
|
14087 | exports.SimpleChange = SimpleChange;
|
14088 | exports.WrappedValue = WrappedValue;
|
14089 | exports.platformCore = platformCore;
|
14090 | exports.ɵALLOW_MULTIPLE_PLATFORMS = ALLOW_MULTIPLE_PLATFORMS;
|
14091 | exports.ɵAPP_ID_RANDOM_PROVIDER = APP_ID_RANDOM_PROVIDER;
|
14092 | exports.ɵValueUnwrapper = ValueUnwrapper;
|
14093 | exports.ɵdevModeEqual = devModeEqual;
|
14094 | exports.ɵisListLikeIterable = isListLikeIterable;
|
14095 | exports.ɵChangeDetectorStatus = ChangeDetectorStatus;
|
14096 | exports.ɵisDefaultChangeDetectionStrategy = isDefaultChangeDetectionStrategy;
|
14097 | exports.ɵConsole = Console;
|
14098 | exports.ɵERROR_COMPONENT_TYPE = ERROR_COMPONENT_TYPE;
|
14099 | exports.ɵComponentFactory = ComponentFactory;
|
14100 | exports.ɵCodegenComponentFactoryResolver = CodegenComponentFactoryResolver;
|
14101 | exports.ɵLIFECYCLE_HOOKS_VALUES = LIFECYCLE_HOOKS_VALUES;
|
14102 | exports.ɵLifecycleHooks = LifecycleHooks;
|
14103 | exports.ɵViewMetadata = ViewMetadata;
|
14104 | exports.ɵReflector = Reflector;
|
14105 | exports.ɵreflector = reflector;
|
14106 | exports.ɵReflectionCapabilities = ReflectionCapabilities;
|
14107 | exports.ɵReflectorReader = ReflectorReader;
|
14108 | exports.ɵRenderDebugInfo = RenderDebugInfo;
|
14109 | exports.ɵglobal = _global;
|
14110 | exports.ɵlooseIdentical = looseIdentical;
|
14111 | exports.ɵstringify = stringify;
|
14112 | exports.ɵmakeDecorator = makeDecorator;
|
14113 | exports.ɵisObservable = isObservable;
|
14114 | exports.ɵisPromise = isPromise;
|
14115 | exports.ɵNOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR = NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR;
|
14116 | exports.ɵNgModuleInjector = NgModuleInjector;
|
14117 | exports.ɵregisterModuleFactory = registerModuleFactory;
|
14118 | exports.ɵEMPTY_ARRAY = EMPTY_ARRAY;
|
14119 | exports.ɵEMPTY_MAP = EMPTY_MAP;
|
14120 | exports.ɵand = anchorDef;
|
14121 | exports.ɵccf = createComponentFactory;
|
14122 | exports.ɵcrt = createRendererType2;
|
14123 | exports.ɵdid = directiveDef;
|
14124 | exports.ɵeld = elementDef;
|
14125 | exports.ɵelementEventFullName = elementEventFullName;
|
14126 | exports.ɵgetComponentViewDefinitionFactory = getComponentViewDefinitionFactory;
|
14127 | exports.ɵinlineInterpolate = inlineInterpolate;
|
14128 | exports.ɵinterpolate = interpolate;
|
14129 | exports.ɵncd = ngContentDef;
|
14130 | exports.ɵnov = nodeValue;
|
14131 | exports.ɵpid = pipeDef;
|
14132 | exports.ɵprd = providerDef;
|
14133 | exports.ɵpad = pureArrayDef;
|
14134 | exports.ɵpod = pureObjectDef;
|
14135 | exports.ɵppd = purePipeDef;
|
14136 | exports.ɵqud = queryDef;
|
14137 | exports.ɵted = textDef;
|
14138 | exports.ɵunv = unwrapValue;
|
14139 | exports.ɵvid = viewDef;
|
14140 | exports.AUTO_STYLE = AUTO_STYLE$$1;
|
14141 | exports.trigger = trigger$$1;
|
14142 | exports.animate = animate$$1;
|
14143 | exports.group = group$$1;
|
14144 | exports.sequence = sequence$$1;
|
14145 | exports.style = style$$1;
|
14146 | exports.state = state$$1;
|
14147 | exports.keyframes = keyframes$$1;
|
14148 | exports.transition = transition$$1;
|
14149 | exports.ɵba = animate$1;
|
14150 | exports.ɵbb = group$1;
|
14151 | exports.ɵbf = keyframes$1;
|
14152 | exports.ɵbc = sequence$1;
|
14153 | exports.ɵbe = state$1;
|
14154 | exports.ɵbd = style$1;
|
14155 | exports.ɵbg = transition$1;
|
14156 | exports.ɵz = trigger$1;
|
14157 | exports.ɵo = _initViewEngine;
|
14158 | exports.ɵl = _iterableDiffersFactory;
|
14159 | exports.ɵm = _keyValueDiffersFactory;
|
14160 | exports.ɵn = _localeFactory;
|
14161 | exports.ɵf = ApplicationRef_;
|
14162 | exports.ɵg = _appIdRandomProviderFactory;
|
14163 | exports.ɵh = defaultIterableDiffers;
|
14164 | exports.ɵi = defaultKeyValueDiffers;
|
14165 | exports.ɵj = DefaultIterableDifferFactory;
|
14166 | exports.ɵk = DefaultKeyValueDifferFactory;
|
14167 | exports.ɵc = ReflectiveInjector_;
|
14168 | exports.ɵd = ReflectiveDependency;
|
14169 | exports.ɵe = resolveReflectiveProviders;
|
14170 | exports.ɵp = wtfEnabled;
|
14171 | exports.ɵr = createScope$1;
|
14172 | exports.ɵq = detectWTF;
|
14173 | exports.ɵu = endTimeRange;
|
14174 | exports.ɵs = leave;
|
14175 | exports.ɵt = startTimeRange;
|
14176 | exports.ɵa = makeParamDecorator;
|
14177 | exports.ɵb = makePropDecorator;
|
14178 | exports.ɵw = _def;
|
14179 | exports.ɵx = DebugContext;
|
14180 |
|
14181 | Object.defineProperty(exports, '__esModule', { value: true });
|
14182 |
|
14183 | })));
|
14184 |
|