source: trip-planner-front/node_modules/@angular/compiler/src/directive_resolver.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 26.1 KB
RevLine 
[6a3a178]1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8(function (factory) {
9 if (typeof module === "object" && typeof module.exports === "object") {
10 var v = factory(require, exports);
11 if (v !== undefined) module.exports = v;
12 }
13 else if (typeof define === "function" && define.amd) {
14 define("@angular/compiler/src/directive_resolver", ["require", "exports", "tslib", "@angular/compiler/src/core", "@angular/compiler/src/util"], factory);
15 }
16})(function (require, exports) {
17 "use strict";
18 Object.defineProperty(exports, "__esModule", { value: true });
19 exports.findLast = exports.DirectiveResolver = void 0;
20 var tslib_1 = require("tslib");
21 var core_1 = require("@angular/compiler/src/core");
22 var util_1 = require("@angular/compiler/src/util");
23 var QUERY_METADATA_IDENTIFIERS = [
24 core_1.createViewChild,
25 core_1.createViewChildren,
26 core_1.createContentChild,
27 core_1.createContentChildren,
28 ];
29 /*
30 * Resolve a `Type` for {@link Directive}.
31 *
32 * This interface can be overridden by the application developer to create custom behavior.
33 *
34 * See {@link Compiler}
35 */
36 var DirectiveResolver = /** @class */ (function () {
37 function DirectiveResolver(_reflector) {
38 this._reflector = _reflector;
39 }
40 DirectiveResolver.prototype.isDirective = function (type) {
41 var typeMetadata = this._reflector.annotations(util_1.resolveForwardRef(type));
42 return typeMetadata && typeMetadata.some(isDirectiveMetadata);
43 };
44 DirectiveResolver.prototype.resolve = function (type, throwIfNotFound) {
45 if (throwIfNotFound === void 0) { throwIfNotFound = true; }
46 var typeMetadata = this._reflector.annotations(util_1.resolveForwardRef(type));
47 if (typeMetadata) {
48 var metadata = findLast(typeMetadata, isDirectiveMetadata);
49 if (metadata) {
50 var propertyMetadata = this._reflector.propMetadata(type);
51 var guards = this._reflector.guards(type);
52 return this._mergeWithPropertyMetadata(metadata, propertyMetadata, guards, type);
53 }
54 }
55 if (throwIfNotFound) {
56 throw new Error("No Directive annotation found on " + util_1.stringify(type));
57 }
58 return null;
59 };
60 DirectiveResolver.prototype._mergeWithPropertyMetadata = function (dm, propertyMetadata, guards, directiveType) {
61 var inputs = [];
62 var outputs = [];
63 var host = {};
64 var queries = {};
65 Object.keys(propertyMetadata).forEach(function (propName) {
66 var input = findLast(propertyMetadata[propName], function (a) { return core_1.createInput.isTypeOf(a); });
67 if (input) {
68 if (input.bindingPropertyName) {
69 inputs.push(propName + ": " + input.bindingPropertyName);
70 }
71 else {
72 inputs.push(propName);
73 }
74 }
75 var output = findLast(propertyMetadata[propName], function (a) { return core_1.createOutput.isTypeOf(a); });
76 if (output) {
77 if (output.bindingPropertyName) {
78 outputs.push(propName + ": " + output.bindingPropertyName);
79 }
80 else {
81 outputs.push(propName);
82 }
83 }
84 var hostBindings = propertyMetadata[propName].filter(function (a) { return core_1.createHostBinding.isTypeOf(a); });
85 hostBindings.forEach(function (hostBinding) {
86 if (hostBinding.hostPropertyName) {
87 var startWith = hostBinding.hostPropertyName[0];
88 if (startWith === '(') {
89 throw new Error("@HostBinding can not bind to events. Use @HostListener instead.");
90 }
91 else if (startWith === '[') {
92 throw new Error("@HostBinding parameter should be a property name, 'class.<name>', or 'attr.<name>'.");
93 }
94 host["[" + hostBinding.hostPropertyName + "]"] = propName;
95 }
96 else {
97 host["[" + propName + "]"] = propName;
98 }
99 });
100 var hostListeners = propertyMetadata[propName].filter(function (a) { return core_1.createHostListener.isTypeOf(a); });
101 hostListeners.forEach(function (hostListener) {
102 var args = hostListener.args || [];
103 host["(" + hostListener.eventName + ")"] = propName + "(" + args.join(',') + ")";
104 });
105 var query = findLast(propertyMetadata[propName], function (a) { return QUERY_METADATA_IDENTIFIERS.some(function (i) { return i.isTypeOf(a); }); });
106 if (query) {
107 queries[propName] = query;
108 }
109 });
110 return this._merge(dm, inputs, outputs, host, queries, guards, directiveType);
111 };
112 DirectiveResolver.prototype._extractPublicName = function (def) {
113 return util_1.splitAtColon(def, [null, def])[1].trim();
114 };
115 DirectiveResolver.prototype._dedupeBindings = function (bindings) {
116 var names = new Set();
117 var publicNames = new Set();
118 var reversedResult = [];
119 // go last to first to allow later entries to overwrite previous entries
120 for (var i = bindings.length - 1; i >= 0; i--) {
121 var binding = bindings[i];
122 var name_1 = this._extractPublicName(binding);
123 publicNames.add(name_1);
124 if (!names.has(name_1)) {
125 names.add(name_1);
126 reversedResult.push(binding);
127 }
128 }
129 return reversedResult.reverse();
130 };
131 DirectiveResolver.prototype._merge = function (directive, inputs, outputs, host, queries, guards, directiveType) {
132 var mergedInputs = this._dedupeBindings(directive.inputs ? directive.inputs.concat(inputs) : inputs);
133 var mergedOutputs = this._dedupeBindings(directive.outputs ? directive.outputs.concat(outputs) : outputs);
134 var mergedHost = directive.host ? tslib_1.__assign(tslib_1.__assign({}, directive.host), host) : host;
135 var mergedQueries = directive.queries ? tslib_1.__assign(tslib_1.__assign({}, directive.queries), queries) : queries;
136 if (core_1.createComponent.isTypeOf(directive)) {
137 var comp = directive;
138 return core_1.createComponent({
139 selector: comp.selector,
140 inputs: mergedInputs,
141 outputs: mergedOutputs,
142 host: mergedHost,
143 exportAs: comp.exportAs,
144 moduleId: comp.moduleId,
145 queries: mergedQueries,
146 changeDetection: comp.changeDetection,
147 providers: comp.providers,
148 viewProviders: comp.viewProviders,
149 entryComponents: comp.entryComponents,
150 template: comp.template,
151 templateUrl: comp.templateUrl,
152 styles: comp.styles,
153 styleUrls: comp.styleUrls,
154 encapsulation: comp.encapsulation,
155 animations: comp.animations,
156 interpolation: comp.interpolation,
157 preserveWhitespaces: directive.preserveWhitespaces,
158 });
159 }
160 else {
161 return core_1.createDirective({
162 selector: directive.selector,
163 inputs: mergedInputs,
164 outputs: mergedOutputs,
165 host: mergedHost,
166 exportAs: directive.exportAs,
167 queries: mergedQueries,
168 providers: directive.providers,
169 guards: guards
170 });
171 }
172 };
173 return DirectiveResolver;
174 }());
175 exports.DirectiveResolver = DirectiveResolver;
176 function isDirectiveMetadata(type) {
177 return core_1.createDirective.isTypeOf(type) || core_1.createComponent.isTypeOf(type);
178 }
179 function findLast(arr, condition) {
180 for (var i = arr.length - 1; i >= 0; i--) {
181 if (condition(arr[i])) {
182 return arr[i];
183 }
184 }
185 return null;
186 }
187 exports.findLast = findLast;
188});
189//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGlyZWN0aXZlX3Jlc29sdmVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvY29tcGlsZXIvc3JjL2RpcmVjdGl2ZV9yZXNvbHZlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7Ozs7Ozs7Ozs7Ozs7O0lBR0gsbURBQXNPO0lBQ3RPLG1EQUFrRTtJQUVsRSxJQUFNLDBCQUEwQixHQUFHO1FBQ2pDLHNCQUFlO1FBQ2YseUJBQWtCO1FBQ2xCLHlCQUFrQjtRQUNsQiw0QkFBcUI7S0FDdEIsQ0FBQztJQUVGOzs7Ozs7T0FNRztJQUNIO1FBQ0UsMkJBQW9CLFVBQTRCO1lBQTVCLGVBQVUsR0FBVixVQUFVLENBQWtCO1FBQUcsQ0FBQztRQUVwRCx1Q0FBVyxHQUFYLFVBQVksSUFBVTtZQUNwQixJQUFNLFlBQVksR0FBRyxJQUFJLENBQUMsVUFBVSxDQUFDLFdBQVcsQ0FBQyx3QkFBaUIsQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDO1lBQzFFLE9BQU8sWUFBWSxJQUFJLFlBQVksQ0FBQyxJQUFJLENBQUMsbUJBQW1CLENBQUMsQ0FBQztRQUNoRSxDQUFDO1FBUUQsbUNBQU8sR0FBUCxVQUFRLElBQVUsRUFBRSxlQUFzQjtZQUF0QixnQ0FBQSxFQUFBLHNCQUFzQjtZ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lRGlyZWN0aXZlKHtcbiAgICAgICAgc2VsZWN0b3I6IGRpcmVjdGl2ZS5zZWxlY3RvcixcbiAgICAgICAgaW5wdXRzOiBtZXJnZWRJbnB1dHMsXG4gICAgICAgIG91dHB1dHM6IG1lcmdlZE91dHB1dHMsXG4gICAgICAgIGhvc3Q6IG1lcmdlZEhvc3QsXG4gICAgICAgIGV4cG9ydEFzOiBkaXJlY3RpdmUuZXhwb3J0QXMsXG4gICAgICAgIHF1ZXJpZXM6IG1lcmdlZFF1ZXJpZXMsXG4gICAgICAgIHByb3ZpZGVyczogZGlyZWN0aXZlLnByb3ZpZGVycyxcbiAgICAgICAgZ3VhcmRzXG4gICAgICB9KTtcbiAgICB9XG4gIH1cbn1cblxuZnVuY3Rpb24gaXNEaXJlY3RpdmVNZXRhZGF0YSh0eXBlOiBhbnkpOiB0eXBlIGlzIERpcmVjdGl2ZSB7XG4gIHJldHVybiBjcmVhdGVEaXJlY3RpdmUuaXNUeXBlT2YodHlwZSkgfHwgY3JlYXRlQ29tcG9uZW50LmlzVHlwZU9mKHR5cGUpO1xufVxuXG5leHBvcnQgZnVuY3Rpb24gZmluZExhc3Q8VD4oYXJyOiBUW10sIGNvbmRpdGlvbjogKHZhbHVlOiBUKSA9PiBib29sZWFuKTogVHxudWxsIHtcbiAgZm9yIChsZXQgaSA9IGFyci5sZW5ndGggLSAxOyBpID49IDA7IGktLSkge1xuICAgIGlmIChjb25kaXRpb24oYXJyW2ldKSkge1xuICAgICAgcmV0dXJuIGFycltpXTtcbiAgICB9XG4gIH1cbiAgcmV0dXJuIG51bGw7XG59XG4iXX0=
Note: See TracBrowser for help on using the repository browser.