@zdigambar/ngx-element 1.0.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,579 +1,810 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/elements'), require('rxjs'), require('rxjs/operators')) :
3
- typeof define === 'function' && define.amd ? define('@zdigambar/ngx-element', ['exports', '@angular/core', '@angular/elements', 'rxjs', 'rxjs/operators'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.zdigambar = global.zdigambar || {}, global.zdigambar['ngx-element'] = {}), global.ng.core, global.ng.elements, global.rxjs, global.rxjs.operators));
5
- }(this, (function (exports, i0, elements, rxjs, operators) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/elements'), require('rxjs'), require('rxjs/operators')) :
3
+ typeof define === 'function' && define.amd ? define('@zdigambar/ngx-element', ['exports', '@angular/core', '@angular/elements', 'rxjs', 'rxjs/operators'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.zdigambar = global.zdigambar || {}, global.zdigambar["ngx-element"] = {}), global.ng.core, global.ng.elements, global.rxjs, global.rxjs.operators));
5
+ })(this, (function (exports, i0, elements, rxjs, operators) { 'use strict';
6
6
 
7
- /*! *****************************************************************************
8
- Copyright (c) Microsoft Corporation. All rights reserved.
9
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
10
- this file except in compliance with the License. You may obtain a copy of the
11
- License at http://www.apache.org/licenses/LICENSE-2.0
7
+ function _interopNamespace(e) {
8
+ if (e && e.__esModule) return e;
9
+ var n = Object.create(null);
10
+ if (e) {
11
+ Object.keys(e).forEach(function (k) {
12
+ if (k !== 'default') {
13
+ var d = Object.getOwnPropertyDescriptor(e, k);
14
+ Object.defineProperty(n, k, d.get ? d : {
15
+ enumerable: true,
16
+ get: function () { return e[k]; }
17
+ });
18
+ }
19
+ });
20
+ }
21
+ n["default"] = e;
22
+ return Object.freeze(n);
23
+ }
24
+
25
+ var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
26
+
27
+ /******************************************************************************
28
+ Copyright (c) Microsoft Corporation.
12
29
 
13
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
15
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
16
- MERCHANTABLITY OR NON-INFRINGEMENT.
30
+ Permission to use, copy, modify, and/or distribute this software for any
31
+ purpose with or without fee is hereby granted.
17
32
 
18
- See the Apache Version 2.0 License for specific language governing permissions
19
- and limitations under the License.
20
- ***************************************************************************** */
21
- /* global Reflect, Promise */
22
- var extendStatics = function (d, b) {
23
- extendStatics = Object.setPrototypeOf ||
24
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
25
- function (d, b) { for (var p in b)
26
- if (b.hasOwnProperty(p))
27
- d[p] = b[p]; };
28
- return extendStatics(d, b);
29
- };
30
- function __extends(d, b) {
31
- extendStatics(d, b);
32
- function __() { this.constructor = d; }
33
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
34
- }
35
- var __assign = function () {
36
- __assign = Object.assign || function __assign(t) {
37
- for (var s, i = 1, n = arguments.length; i < n; i++) {
38
- s = arguments[i];
39
- for (var p in s)
40
- if (Object.prototype.hasOwnProperty.call(s, p))
41
- t[p] = s[p];
42
- }
43
- return t;
44
- };
45
- return __assign.apply(this, arguments);
46
- };
47
- function __rest(s, e) {
48
- var t = {};
49
- for (var p in s)
50
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
51
- t[p] = s[p];
52
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
53
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
54
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
55
- t[p[i]] = s[p[i]];
56
- }
57
- return t;
58
- }
59
- function __decorate(decorators, target, key, desc) {
60
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
61
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
62
- r = Reflect.decorate(decorators, target, key, desc);
63
- else
64
- for (var i = decorators.length - 1; i >= 0; i--)
65
- if (d = decorators[i])
66
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
67
- return c > 3 && r && Object.defineProperty(target, key, r), r;
68
- }
69
- function __param(paramIndex, decorator) {
70
- return function (target, key) { decorator(target, key, paramIndex); };
71
- }
72
- function __metadata(metadataKey, metadataValue) {
73
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
74
- return Reflect.metadata(metadataKey, metadataValue);
75
- }
76
- function __awaiter(thisArg, _arguments, P, generator) {
77
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
78
- return new (P || (P = Promise))(function (resolve, reject) {
79
- function fulfilled(value) { try {
80
- step(generator.next(value));
81
- }
82
- catch (e) {
83
- reject(e);
84
- } }
85
- function rejected(value) { try {
86
- step(generator["throw"](value));
87
- }
88
- catch (e) {
89
- reject(e);
90
- } }
91
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
92
- step((generator = generator.apply(thisArg, _arguments || [])).next());
93
- });
94
- }
95
- function __generator(thisArg, body) {
96
- var _ = { label: 0, sent: function () { if (t[0] & 1)
97
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
98
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
99
- function verb(n) { return function (v) { return step([n, v]); }; }
100
- function step(op) {
101
- if (f)
102
- throw new TypeError("Generator is already executing.");
103
- while (_)
104
- try {
105
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
106
- return t;
107
- if (y = 0, t)
108
- op = [op[0] & 2, t.value];
109
- switch (op[0]) {
110
- case 0:
111
- case 1:
112
- t = op;
113
- break;
114
- case 4:
115
- _.label++;
116
- return { value: op[1], done: false };
117
- case 5:
118
- _.label++;
119
- y = op[1];
120
- op = [0];
121
- continue;
122
- case 7:
123
- op = _.ops.pop();
124
- _.trys.pop();
125
- continue;
126
- default:
127
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
128
- _ = 0;
129
- continue;
130
- }
131
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
132
- _.label = op[1];
133
- break;
134
- }
135
- if (op[0] === 6 && _.label < t[1]) {
136
- _.label = t[1];
137
- t = op;
138
- break;
139
- }
140
- if (t && _.label < t[2]) {
141
- _.label = t[2];
142
- _.ops.push(op);
143
- break;
144
- }
145
- if (t[2])
146
- _.ops.pop();
147
- _.trys.pop();
148
- continue;
149
- }
150
- op = body.call(thisArg, _);
151
- }
152
- catch (e) {
153
- op = [6, e];
154
- y = 0;
155
- }
156
- finally {
157
- f = t = 0;
158
- }
159
- if (op[0] & 5)
160
- throw op[1];
161
- return { value: op[0] ? op[1] : void 0, done: true };
162
- }
163
- }
164
- function __exportStar(m, exports) {
165
- for (var p in m)
166
- if (!exports.hasOwnProperty(p))
167
- exports[p] = m[p];
168
- }
169
- function __values(o) {
170
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
171
- if (m)
172
- return m.call(o);
173
- if (o && typeof o.length === "number")
174
- return {
175
- next: function () {
176
- if (o && i >= o.length)
177
- o = void 0;
178
- return { value: o && o[i++], done: !o };
179
- }
180
- };
181
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
182
- }
183
- function __read(o, n) {
184
- var m = typeof Symbol === "function" && o[Symbol.iterator];
185
- if (!m)
186
- return o;
187
- var i = m.call(o), r, ar = [], e;
188
- try {
189
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
190
- ar.push(r.value);
191
- }
192
- catch (error) {
193
- e = { error: error };
194
- }
195
- finally {
196
- try {
197
- if (r && !r.done && (m = i["return"]))
198
- m.call(i);
199
- }
200
- finally {
201
- if (e)
202
- throw e.error;
203
- }
204
- }
205
- return ar;
206
- }
207
- function __spread() {
208
- for (var ar = [], i = 0; i < arguments.length; i++)
209
- ar = ar.concat(__read(arguments[i]));
210
- return ar;
211
- }
212
- function __spreadArrays() {
213
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
214
- s += arguments[i].length;
215
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
216
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
217
- r[k] = a[j];
218
- return r;
219
- }
220
- ;
221
- function __await(v) {
222
- return this instanceof __await ? (this.v = v, this) : new __await(v);
223
- }
224
- function __asyncGenerator(thisArg, _arguments, generator) {
225
- if (!Symbol.asyncIterator)
226
- throw new TypeError("Symbol.asyncIterator is not defined.");
227
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
228
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
229
- function verb(n) { if (g[n])
230
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
231
- function resume(n, v) { try {
232
- step(g[n](v));
233
- }
234
- catch (e) {
235
- settle(q[0][3], e);
236
- } }
237
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
238
- function fulfill(value) { resume("next", value); }
239
- function reject(value) { resume("throw", value); }
240
- function settle(f, v) { if (f(v), q.shift(), q.length)
241
- resume(q[0][0], q[0][1]); }
242
- }
243
- function __asyncDelegator(o) {
244
- var i, p;
245
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
246
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
247
- }
248
- function __asyncValues(o) {
249
- if (!Symbol.asyncIterator)
250
- throw new TypeError("Symbol.asyncIterator is not defined.");
251
- var m = o[Symbol.asyncIterator], i;
252
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
253
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
254
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
255
- }
256
- function __makeTemplateObject(cooked, raw) {
257
- if (Object.defineProperty) {
258
- Object.defineProperty(cooked, "raw", { value: raw });
259
- }
260
- else {
261
- cooked.raw = raw;
262
- }
263
- return cooked;
264
- }
265
- ;
266
- function __importStar(mod) {
267
- if (mod && mod.__esModule)
268
- return mod;
269
- var result = {};
270
- if (mod != null)
271
- for (var k in mod)
272
- if (Object.hasOwnProperty.call(mod, k))
273
- result[k] = mod[k];
274
- result.default = mod;
275
- return result;
276
- }
277
- function __importDefault(mod) {
278
- return (mod && mod.__esModule) ? mod : { default: mod };
279
- }
280
- function __classPrivateFieldGet(receiver, privateMap) {
281
- if (!privateMap.has(receiver)) {
282
- throw new TypeError("attempted to get private field on non-instance");
283
- }
284
- return privateMap.get(receiver);
285
- }
286
- function __classPrivateFieldSet(receiver, privateMap, value) {
287
- if (!privateMap.has(receiver)) {
288
- throw new TypeError("attempted to set private field on non-instance");
289
- }
290
- privateMap.set(receiver, value);
291
- return value;
292
- }
33
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
34
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
35
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
36
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
37
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
38
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39
+ PERFORMANCE OF THIS SOFTWARE.
40
+ ***************************************************************************** */
41
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
42
+ var extendStatics = function (d, b) {
43
+ extendStatics = Object.setPrototypeOf ||
44
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
45
+ function (d, b) { for (var p in b)
46
+ if (Object.prototype.hasOwnProperty.call(b, p))
47
+ d[p] = b[p]; };
48
+ return extendStatics(d, b);
49
+ };
50
+ function __extends(d, b) {
51
+ if (typeof b !== "function" && b !== null)
52
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
53
+ extendStatics(d, b);
54
+ function __() { this.constructor = d; }
55
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
56
+ }
57
+ var __assign = function () {
58
+ __assign = Object.assign || function __assign(t) {
59
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
60
+ s = arguments[i];
61
+ for (var p in s)
62
+ if (Object.prototype.hasOwnProperty.call(s, p))
63
+ t[p] = s[p];
64
+ }
65
+ return t;
66
+ };
67
+ return __assign.apply(this, arguments);
68
+ };
69
+ function __rest(s, e) {
70
+ var t = {};
71
+ for (var p in s)
72
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
73
+ t[p] = s[p];
74
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
75
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
76
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
77
+ t[p[i]] = s[p[i]];
78
+ }
79
+ return t;
80
+ }
81
+ function __decorate(decorators, target, key, desc) {
82
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
83
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
84
+ r = Reflect.decorate(decorators, target, key, desc);
85
+ else
86
+ for (var i = decorators.length - 1; i >= 0; i--)
87
+ if (d = decorators[i])
88
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
89
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
90
+ }
91
+ function __param(paramIndex, decorator) {
92
+ return function (target, key) { decorator(target, key, paramIndex); };
93
+ }
94
+ function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
95
+ function accept(f) { if (f !== void 0 && typeof f !== "function")
96
+ throw new TypeError("Function expected"); return f; }
97
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
98
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
99
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
100
+ var _, done = false;
101
+ for (var i = decorators.length - 1; i >= 0; i--) {
102
+ var context = {};
103
+ for (var p in contextIn)
104
+ context[p] = p === "access" ? {} : contextIn[p];
105
+ for (var p in contextIn.access)
106
+ context.access[p] = contextIn.access[p];
107
+ context.addInitializer = function (f) { if (done)
108
+ throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
109
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
110
+ if (kind === "accessor") {
111
+ if (result === void 0)
112
+ continue;
113
+ if (result === null || typeof result !== "object")
114
+ throw new TypeError("Object expected");
115
+ if (_ = accept(result.get))
116
+ descriptor.get = _;
117
+ if (_ = accept(result.set))
118
+ descriptor.set = _;
119
+ if (_ = accept(result.init))
120
+ initializers.unshift(_);
121
+ }
122
+ else if (_ = accept(result)) {
123
+ if (kind === "field")
124
+ initializers.unshift(_);
125
+ else
126
+ descriptor[key] = _;
127
+ }
128
+ }
129
+ if (target)
130
+ Object.defineProperty(target, contextIn.name, descriptor);
131
+ done = true;
132
+ }
133
+ ;
134
+ function __runInitializers(thisArg, initializers, value) {
135
+ var useValue = arguments.length > 2;
136
+ for (var i = 0; i < initializers.length; i++) {
137
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
138
+ }
139
+ return useValue ? value : void 0;
140
+ }
141
+ ;
142
+ function __propKey(x) {
143
+ return typeof x === "symbol" ? x : "".concat(x);
144
+ }
145
+ ;
146
+ function __setFunctionName(f, name, prefix) {
147
+ if (typeof name === "symbol")
148
+ name = name.description ? "[".concat(name.description, "]") : "";
149
+ return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
150
+ }
151
+ ;
152
+ function __metadata(metadataKey, metadataValue) {
153
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
154
+ return Reflect.metadata(metadataKey, metadataValue);
155
+ }
156
+ function __awaiter(thisArg, _arguments, P, generator) {
157
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
158
+ return new (P || (P = Promise))(function (resolve, reject) {
159
+ function fulfilled(value) { try {
160
+ step(generator.next(value));
161
+ }
162
+ catch (e) {
163
+ reject(e);
164
+ } }
165
+ function rejected(value) { try {
166
+ step(generator["throw"](value));
167
+ }
168
+ catch (e) {
169
+ reject(e);
170
+ } }
171
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
172
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
173
+ });
174
+ }
175
+ function __generator(thisArg, body) {
176
+ var _ = { label: 0, sent: function () { if (t[0] & 1)
177
+ throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
178
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
179
+ function verb(n) { return function (v) { return step([n, v]); }; }
180
+ function step(op) {
181
+ if (f)
182
+ throw new TypeError("Generator is already executing.");
183
+ while (g && (g = 0, op[0] && (_ = 0)), _)
184
+ try {
185
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
186
+ return t;
187
+ if (y = 0, t)
188
+ op = [op[0] & 2, t.value];
189
+ switch (op[0]) {
190
+ case 0:
191
+ case 1:
192
+ t = op;
193
+ break;
194
+ case 4:
195
+ _.label++;
196
+ return { value: op[1], done: false };
197
+ case 5:
198
+ _.label++;
199
+ y = op[1];
200
+ op = [0];
201
+ continue;
202
+ case 7:
203
+ op = _.ops.pop();
204
+ _.trys.pop();
205
+ continue;
206
+ default:
207
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
208
+ _ = 0;
209
+ continue;
210
+ }
211
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
212
+ _.label = op[1];
213
+ break;
214
+ }
215
+ if (op[0] === 6 && _.label < t[1]) {
216
+ _.label = t[1];
217
+ t = op;
218
+ break;
219
+ }
220
+ if (t && _.label < t[2]) {
221
+ _.label = t[2];
222
+ _.ops.push(op);
223
+ break;
224
+ }
225
+ if (t[2])
226
+ _.ops.pop();
227
+ _.trys.pop();
228
+ continue;
229
+ }
230
+ op = body.call(thisArg, _);
231
+ }
232
+ catch (e) {
233
+ op = [6, e];
234
+ y = 0;
235
+ }
236
+ finally {
237
+ f = t = 0;
238
+ }
239
+ if (op[0] & 5)
240
+ throw op[1];
241
+ return { value: op[0] ? op[1] : void 0, done: true };
242
+ }
243
+ }
244
+ var __createBinding = Object.create ? (function (o, m, k, k2) {
245
+ if (k2 === undefined)
246
+ k2 = k;
247
+ var desc = Object.getOwnPropertyDescriptor(m, k);
248
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
249
+ desc = { enumerable: true, get: function () { return m[k]; } };
250
+ }
251
+ Object.defineProperty(o, k2, desc);
252
+ }) : (function (o, m, k, k2) {
253
+ if (k2 === undefined)
254
+ k2 = k;
255
+ o[k2] = m[k];
256
+ });
257
+ function __exportStar(m, o) {
258
+ for (var p in m)
259
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
260
+ __createBinding(o, m, p);
261
+ }
262
+ function __values(o) {
263
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
264
+ if (m)
265
+ return m.call(o);
266
+ if (o && typeof o.length === "number")
267
+ return {
268
+ next: function () {
269
+ if (o && i >= o.length)
270
+ o = void 0;
271
+ return { value: o && o[i++], done: !o };
272
+ }
273
+ };
274
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
275
+ }
276
+ function __read(o, n) {
277
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
278
+ if (!m)
279
+ return o;
280
+ var i = m.call(o), r, ar = [], e;
281
+ try {
282
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
283
+ ar.push(r.value);
284
+ }
285
+ catch (error) {
286
+ e = { error: error };
287
+ }
288
+ finally {
289
+ try {
290
+ if (r && !r.done && (m = i["return"]))
291
+ m.call(i);
292
+ }
293
+ finally {
294
+ if (e)
295
+ throw e.error;
296
+ }
297
+ }
298
+ return ar;
299
+ }
300
+ /** @deprecated */
301
+ function __spread() {
302
+ for (var ar = [], i = 0; i < arguments.length; i++)
303
+ ar = ar.concat(__read(arguments[i]));
304
+ return ar;
305
+ }
306
+ /** @deprecated */
307
+ function __spreadArrays() {
308
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++)
309
+ s += arguments[i].length;
310
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
311
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
312
+ r[k] = a[j];
313
+ return r;
314
+ }
315
+ function __spreadArray(to, from, pack) {
316
+ if (pack || arguments.length === 2)
317
+ for (var i = 0, l = from.length, ar; i < l; i++) {
318
+ if (ar || !(i in from)) {
319
+ if (!ar)
320
+ ar = Array.prototype.slice.call(from, 0, i);
321
+ ar[i] = from[i];
322
+ }
323
+ }
324
+ return to.concat(ar || Array.prototype.slice.call(from));
325
+ }
326
+ function __await(v) {
327
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
328
+ }
329
+ function __asyncGenerator(thisArg, _arguments, generator) {
330
+ if (!Symbol.asyncIterator)
331
+ throw new TypeError("Symbol.asyncIterator is not defined.");
332
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
333
+ return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
334
+ function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
335
+ function verb(n, f) { if (g[n]) {
336
+ i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); };
337
+ if (f)
338
+ i[n] = f(i[n]);
339
+ } }
340
+ function resume(n, v) { try {
341
+ step(g[n](v));
342
+ }
343
+ catch (e) {
344
+ settle(q[0][3], e);
345
+ } }
346
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
347
+ function fulfill(value) { resume("next", value); }
348
+ function reject(value) { resume("throw", value); }
349
+ function settle(f, v) { if (f(v), q.shift(), q.length)
350
+ resume(q[0][0], q[0][1]); }
351
+ }
352
+ function __asyncDelegator(o) {
353
+ var i, p;
354
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
355
+ function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
356
+ }
357
+ function __asyncValues(o) {
358
+ if (!Symbol.asyncIterator)
359
+ throw new TypeError("Symbol.asyncIterator is not defined.");
360
+ var m = o[Symbol.asyncIterator], i;
361
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
362
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
363
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
364
+ }
365
+ function __makeTemplateObject(cooked, raw) {
366
+ if (Object.defineProperty) {
367
+ Object.defineProperty(cooked, "raw", { value: raw });
368
+ }
369
+ else {
370
+ cooked.raw = raw;
371
+ }
372
+ return cooked;
373
+ }
374
+ ;
375
+ var __setModuleDefault = Object.create ? (function (o, v) {
376
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
377
+ }) : function (o, v) {
378
+ o["default"] = v;
379
+ };
380
+ function __importStar(mod) {
381
+ if (mod && mod.__esModule)
382
+ return mod;
383
+ var result = {};
384
+ if (mod != null)
385
+ for (var k in mod)
386
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
387
+ __createBinding(result, mod, k);
388
+ __setModuleDefault(result, mod);
389
+ return result;
390
+ }
391
+ function __importDefault(mod) {
392
+ return (mod && mod.__esModule) ? mod : { default: mod };
393
+ }
394
+ function __classPrivateFieldGet(receiver, state, kind, f) {
395
+ if (kind === "a" && !f)
396
+ throw new TypeError("Private accessor was defined without a getter");
397
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
398
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
399
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
400
+ }
401
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
402
+ if (kind === "m")
403
+ throw new TypeError("Private method is not writable");
404
+ if (kind === "a" && !f)
405
+ throw new TypeError("Private accessor was defined without a setter");
406
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
407
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
408
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
409
+ }
410
+ function __classPrivateFieldIn(state, receiver) {
411
+ if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function"))
412
+ throw new TypeError("Cannot use 'in' operator on non-object");
413
+ return typeof state === "function" ? receiver === state : state.has(receiver);
414
+ }
415
+ function __addDisposableResource(env, value, async) {
416
+ if (value !== null && value !== void 0) {
417
+ if (typeof value !== "object" && typeof value !== "function")
418
+ throw new TypeError("Object expected.");
419
+ var dispose, inner;
420
+ if (async) {
421
+ if (!Symbol.asyncDispose)
422
+ throw new TypeError("Symbol.asyncDispose is not defined.");
423
+ dispose = value[Symbol.asyncDispose];
424
+ }
425
+ if (dispose === void 0) {
426
+ if (!Symbol.dispose)
427
+ throw new TypeError("Symbol.dispose is not defined.");
428
+ dispose = value[Symbol.dispose];
429
+ if (async)
430
+ inner = dispose;
431
+ }
432
+ if (typeof dispose !== "function")
433
+ throw new TypeError("Object not disposable.");
434
+ if (inner)
435
+ dispose = function () { try {
436
+ inner.call(this);
437
+ }
438
+ catch (e) {
439
+ return Promise.reject(e);
440
+ } };
441
+ env.stack.push({ value: value, dispose: dispose, async: async });
442
+ }
443
+ else if (async) {
444
+ env.stack.push({ async: true });
445
+ }
446
+ return value;
447
+ }
448
+ var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
449
+ var e = new Error(message);
450
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
451
+ };
452
+ function __disposeResources(env) {
453
+ function fail(e) {
454
+ env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
455
+ env.hasError = true;
456
+ }
457
+ var r, s = 0;
458
+ function next() {
459
+ while (r = env.stack.pop()) {
460
+ try {
461
+ if (!r.async && s === 1)
462
+ return s = 0, env.stack.push(r), Promise.resolve().then(next);
463
+ if (r.dispose) {
464
+ var result = r.dispose.call(r.value);
465
+ if (r.async)
466
+ return s |= 2, Promise.resolve(result).then(next, function (e) { fail(e); return next(); });
467
+ }
468
+ else
469
+ s |= 1;
470
+ }
471
+ catch (e) {
472
+ fail(e);
473
+ }
474
+ }
475
+ if (s === 1)
476
+ return env.hasError ? Promise.reject(env.error) : Promise.resolve();
477
+ if (env.hasError)
478
+ throw env.error;
479
+ }
480
+ return next();
481
+ }
482
+ function __rewriteRelativeImportExtension(path, preserveJsx) {
483
+ if (typeof path === "string" && /^\.\.?\//.test(path)) {
484
+ return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
485
+ return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
486
+ });
487
+ }
488
+ return path;
489
+ }
490
+ var tslib_es6 = {
491
+ __extends: __extends,
492
+ __assign: __assign,
493
+ __rest: __rest,
494
+ __decorate: __decorate,
495
+ __param: __param,
496
+ __esDecorate: __esDecorate,
497
+ __runInitializers: __runInitializers,
498
+ __propKey: __propKey,
499
+ __setFunctionName: __setFunctionName,
500
+ __metadata: __metadata,
501
+ __awaiter: __awaiter,
502
+ __generator: __generator,
503
+ __createBinding: __createBinding,
504
+ __exportStar: __exportStar,
505
+ __values: __values,
506
+ __read: __read,
507
+ __spread: __spread,
508
+ __spreadArrays: __spreadArrays,
509
+ __spreadArray: __spreadArray,
510
+ __await: __await,
511
+ __asyncGenerator: __asyncGenerator,
512
+ __asyncDelegator: __asyncDelegator,
513
+ __asyncValues: __asyncValues,
514
+ __makeTemplateObject: __makeTemplateObject,
515
+ __importStar: __importStar,
516
+ __importDefault: __importDefault,
517
+ __classPrivateFieldGet: __classPrivateFieldGet,
518
+ __classPrivateFieldSet: __classPrivateFieldSet,
519
+ __classPrivateFieldIn: __classPrivateFieldIn,
520
+ __addDisposableResource: __addDisposableResource,
521
+ __disposeResources: __disposeResources,
522
+ __rewriteRelativeImportExtension: __rewriteRelativeImportExtension,
523
+ };
293
524
 
294
- /* Injection token to provide the element path modules. */
295
- var LAZY_CMPS_PATH_TOKEN = new i0.InjectionToken('ngx-lazy-cmp-registry');
525
+ /* Injection token to provide the element path modules. */
526
+ var LAZY_CMPS_PATH_TOKEN = new i0.InjectionToken('ngx-lazy-cmp-registry');
296
527
 
297
- var NgxElementService = /** @class */ (function () {
298
- function NgxElementService(modulePaths, compiler, injector) {
299
- this.compiler = compiler;
300
- this.injector = injector;
301
- this.loadedComponents = new Map();
302
- this.elementsLoading = new Map();
303
- this.injectors = new Map();
304
- this.componentFactoryResolvers = new Map();
305
- var ELEMENT_MODULE_PATHS = new Map();
306
- modulePaths.forEach(function (route) {
307
- ELEMENT_MODULE_PATHS.set(route.selector, route);
308
- });
309
- this.componentsToLoad = ELEMENT_MODULE_PATHS;
310
- }
311
- NgxElementService.prototype.receiveContext = function (component, injector) {
312
- this.injectors.set(component, injector);
313
- this.componentFactoryResolvers.set(component, injector.get(i0.ComponentFactoryResolver));
314
- };
315
- NgxElementService.prototype.getInjector = function (component) {
316
- return this.injectors.get(component);
317
- };
318
- NgxElementService.prototype.getComponentFactoryResolver = function (component) {
319
- return this.componentFactoryResolvers.get(component);
320
- };
321
- NgxElementService.prototype.getComponentsToLoad = function () {
322
- return this.componentsToLoad;
323
- };
324
- NgxElementService.prototype.getComponentToLoad = function (selector) {
325
- // Returns observable that completes when the lazy module has been loaded.
326
- var registered = this.loadComponent(selector);
327
- return rxjs.from(registered);
328
- };
329
- /**
330
- * Allows to lazy load a component given its selector.
331
- * If the component selector has been registered, it's according module
332
- * will be fetched lazily
333
- * @param componentTag selector of the component to load
334
- */
335
- NgxElementService.prototype.loadComponent = function (componentSelector) {
336
- var _this = this;
337
- if (this.elementsLoading.has(componentSelector)) {
338
- return this.elementsLoading.get(componentSelector);
339
- }
340
- if (this.componentsToLoad.has(componentSelector)) {
341
- var cmpRegistryEntry = this.componentsToLoad.get(componentSelector);
342
- var path_1 = cmpRegistryEntry.loadChildren;
343
- var loadPromise = new Promise(function (resolve, reject) {
344
- path_1()
345
- .then(function (elementModuleOrFactory) {
346
- /**
347
- * With View Engine, the NgModule factory is created and provided when loaded.
348
- * With Ivy, only the NgModule class is provided loaded and must be compiled.
349
- * This uses the same mechanism as the deprecated `SystemJsNgModuleLoader` in
350
- * in `packages/core/src/linker/system_js_ng_module_factory_loader.ts`
351
- * to pass on the NgModuleFactory, or compile the NgModule and return its NgModuleFactory.
352
- */
353
- if (elementModuleOrFactory instanceof i0.NgModuleFactory) {
354
- return elementModuleOrFactory;
355
- }
356
- else {
357
- try {
358
- return _this.compiler.compileModuleAsync(elementModuleOrFactory);
359
- }
360
- catch (err) {
361
- // return the error
362
- reject(err);
363
- // break the promise chain
364
- throw err;
365
- }
366
- }
367
- })
368
- .then(function (moduleFactory) {
369
- var elementModuleRef = moduleFactory.create(_this.injector);
370
- var componentClass;
371
- if (typeof elementModuleRef.instance.customElementComponent === 'object') {
372
- componentClass = elementModuleRef.instance.customElementComponent[componentSelector];
373
- if (!componentClass) {
374
- // tslint:disable-next-line: no-string-throw
375
- throw "You specified multiple component elements in module " + elementModuleRef + " but there was no match for tag\n " + componentSelector + " in " + JSON.stringify(elementModuleRef.instance.customElementComponent) + ".\n Make sure the selector in the module is aligned with the one specified in the lazy module definition.";
376
- }
377
- }
378
- else {
379
- componentClass = elementModuleRef.instance.customElementComponent;
380
- }
381
- // Register injector of the lazy module.
382
- // This is needed to share the entryComponents between the lazy module and the application
383
- var moduleInjector = elementModuleRef.injector;
384
- _this.receiveContext(componentClass, moduleInjector);
385
- _this.loadedComponents.set(componentSelector, componentClass);
386
- _this.elementsLoading.delete(componentSelector);
387
- _this.componentsToLoad.delete(componentSelector);
388
- resolve({
389
- selector: componentSelector,
390
- componentClass: componentClass
391
- });
392
- })
393
- .catch(function (err) {
394
- _this.elementsLoading.delete(componentSelector);
395
- return Promise.reject(err);
396
- });
397
- });
398
- this.elementsLoading.set(componentSelector, loadPromise);
399
- return loadPromise;
400
- }
401
- else if (this.loadedComponents.has(componentSelector)) {
402
- // component already loaded
403
- return new Promise(function (resolve) {
404
- resolve({
405
- selector: componentSelector,
406
- componentClass: _this.loadedComponents.get(componentSelector)
407
- });
408
- });
409
- }
410
- else {
411
- throw new Error("Unrecognized component \"" + componentSelector + "\". Make sure it is registered in the component registry");
412
- }
413
- };
414
- return NgxElementService;
415
- }());
416
- NgxElementService.ɵprov = i0.ɵɵdefineInjectable({ factory: function NgxElementService_Factory() { return new NgxElementService(i0.ɵɵinject(LAZY_CMPS_PATH_TOKEN), i0.ɵɵinject(i0.Compiler), i0.ɵɵinject(i0.INJECTOR)); }, token: NgxElementService, providedIn: "root" });
417
- NgxElementService.decorators = [
418
- { type: i0.Injectable, args: [{
419
- providedIn: 'root'
420
- },] }
421
- ];
422
- NgxElementService.ctorParameters = function () { return [
423
- { type: Array, decorators: [{ type: i0.Inject, args: [LAZY_CMPS_PATH_TOKEN,] }] },
424
- { type: i0.Compiler },
425
- { type: i0.Injector }
426
- ]; };
528
+ var NgxElementService = /** @class */ (function () {
529
+ function NgxElementService(modulePaths, compiler, injector) {
530
+ this.compiler = compiler;
531
+ this.injector = injector;
532
+ this.loadedComponents = new Map();
533
+ this.elementsLoading = new Map();
534
+ this.injectors = new Map();
535
+ this.componentFactoryResolvers = new Map();
536
+ var ELEMENT_MODULE_PATHS = new Map();
537
+ modulePaths.forEach(function (route) {
538
+ ELEMENT_MODULE_PATHS.set(route.selector, route);
539
+ });
540
+ this.componentsToLoad = ELEMENT_MODULE_PATHS;
541
+ }
542
+ NgxElementService.prototype.receiveContext = function (component, injector) {
543
+ this.injectors.set(component, injector);
544
+ this.componentFactoryResolvers.set(component, injector.get(i0.ComponentFactoryResolver));
545
+ };
546
+ NgxElementService.prototype.getInjector = function (component) {
547
+ return this.injectors.get(component);
548
+ };
549
+ NgxElementService.prototype.getComponentFactoryResolver = function (component) {
550
+ return this.componentFactoryResolvers.get(component);
551
+ };
552
+ NgxElementService.prototype.getComponentsToLoad = function () {
553
+ return this.componentsToLoad;
554
+ };
555
+ NgxElementService.prototype.getComponentToLoad = function (selector) {
556
+ // Returns observable that completes when the lazy module has been loaded.
557
+ var registered = this.loadComponent(selector);
558
+ return rxjs.from(registered);
559
+ };
560
+ /**
561
+ * Allows to lazy load a component given its selector.
562
+ * If the component selector has been registered, it's according module
563
+ * will be fetched lazily
564
+ * @param componentTag selector of the component to load
565
+ */
566
+ NgxElementService.prototype.loadComponent = function (componentSelector) {
567
+ var _this = this;
568
+ if (this.elementsLoading.has(componentSelector)) {
569
+ return this.elementsLoading.get(componentSelector);
570
+ }
571
+ if (this.componentsToLoad.has(componentSelector)) {
572
+ var cmpRegistryEntry = this.componentsToLoad.get(componentSelector);
573
+ var path_1 = cmpRegistryEntry.loadChildren;
574
+ var loadPromise = new Promise(function (resolve, reject) {
575
+ path_1()
576
+ .then(function (elementModuleOrFactory) {
577
+ /**
578
+ * With View Engine, the NgModule factory is created and provided when loaded.
579
+ * With Ivy, only the NgModule class is provided loaded and must be compiled.
580
+ * This uses the same mechanism as the deprecated `SystemJsNgModuleLoader` in
581
+ * in `packages/core/src/linker/system_js_ng_module_factory_loader.ts`
582
+ * to pass on the NgModuleFactory, or compile the NgModule and return its NgModuleFactory.
583
+ */
584
+ if (elementModuleOrFactory instanceof i0.NgModuleFactory) {
585
+ return elementModuleOrFactory;
586
+ }
587
+ else {
588
+ try {
589
+ return _this.compiler.compileModuleAsync(elementModuleOrFactory);
590
+ }
591
+ catch (err) {
592
+ // return the error
593
+ reject(err);
594
+ // break the promise chain
595
+ throw err;
596
+ }
597
+ }
598
+ })
599
+ .then(function (moduleFactory) {
600
+ var elementModuleRef = moduleFactory.create(_this.injector);
601
+ var componentClass;
602
+ if (typeof elementModuleRef.instance.customElementComponent === 'object') {
603
+ componentClass = elementModuleRef.instance.customElementComponent[componentSelector];
604
+ if (!componentClass) {
605
+ // tslint:disable-next-line: no-string-throw
606
+ throw "You specified multiple component elements in module " + elementModuleRef + " but there was no match for tag\n " + componentSelector + " in " + JSON.stringify(elementModuleRef.instance.customElementComponent) + ".\n Make sure the selector in the module is aligned with the one specified in the lazy module definition.";
607
+ }
608
+ }
609
+ else {
610
+ componentClass = elementModuleRef.instance.customElementComponent;
611
+ }
612
+ // Register injector of the lazy module.
613
+ // This is needed to share the entryComponents between the lazy module and the application
614
+ var moduleInjector = elementModuleRef.injector;
615
+ _this.receiveContext(componentClass, moduleInjector);
616
+ _this.loadedComponents.set(componentSelector, componentClass);
617
+ _this.elementsLoading.delete(componentSelector);
618
+ _this.componentsToLoad.delete(componentSelector);
619
+ resolve({
620
+ selector: componentSelector,
621
+ componentClass: componentClass
622
+ });
623
+ })
624
+ .catch(function (err) {
625
+ _this.elementsLoading.delete(componentSelector);
626
+ return Promise.reject(err);
627
+ });
628
+ });
629
+ this.elementsLoading.set(componentSelector, loadPromise);
630
+ return loadPromise;
631
+ }
632
+ else if (this.loadedComponents.has(componentSelector)) {
633
+ // component already loaded
634
+ return new Promise(function (resolve) {
635
+ resolve({
636
+ selector: componentSelector,
637
+ componentClass: _this.loadedComponents.get(componentSelector)
638
+ });
639
+ });
640
+ }
641
+ else {
642
+ throw new Error("Unrecognized component \"" + componentSelector + "\". Make sure it is registered in the component registry");
643
+ }
644
+ };
645
+ return NgxElementService;
646
+ }());
647
+ NgxElementService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function NgxElementService_Factory() { return new NgxElementService(i0__namespace.ɵɵinject(LAZY_CMPS_PATH_TOKEN), i0__namespace.ɵɵinject(i0__namespace.Compiler), i0__namespace.ɵɵinject(i0__namespace.INJECTOR)); }, token: NgxElementService, providedIn: "root" });
648
+ NgxElementService.decorators = [
649
+ { type: i0.Injectable, args: [{
650
+ providedIn: 'root'
651
+ },] }
652
+ ];
653
+ NgxElementService.ctorParameters = function () { return [
654
+ { type: Array, decorators: [{ type: i0.Inject, args: [LAZY_CMPS_PATH_TOKEN,] }] },
655
+ { type: i0.Compiler },
656
+ { type: i0.Injector }
657
+ ]; };
427
658
 
428
- var NgxElementComponent = /** @class */ (function () {
429
- function NgxElementComponent(ngxElementService, elementRef) {
430
- this.ngxElementService = ngxElementService;
431
- this.elementRef = elementRef;
432
- }
433
- /**
434
- * Subscribe to event emitters of a lazy loaded and dynamically instantiated Angular component
435
- * and dispatch them as Custom Events on the NgxElementComponent that is used in a template.
436
- */
437
- NgxElementComponent.prototype.setProxiedOutputs = function (factory) {
438
- var _this = this;
439
- var eventEmitters = factory.outputs.map(function (_a) {
440
- var propName = _a.propName, templateName = _a.templateName;
441
- var emitter = _this.componentRef.instance[propName];
442
- return emitter.pipe(operators.map(function (value) { return ({ name: templateName, value: value }); }));
443
- });
444
- var outputEvents = rxjs.merge.apply(void 0, __spread(eventEmitters));
445
- this.ngElementEventsSubscription = outputEvents.subscribe(function (subscription) {
446
- var customEvent = document.createEvent('CustomEvent');
447
- customEvent.initCustomEvent(subscription.name, false, false, subscription.value);
448
- _this.elementRef.nativeElement.dispatchEvent(customEvent);
449
- });
450
- };
451
- NgxElementComponent.prototype.ngOnInit = function () {
452
- var _this = this;
453
- this.ngxElementService.getComponentToLoad(this.selector).subscribe(function (event) {
454
- _this.componentToLoad = event.componentClass;
455
- _this.componentFactoryResolver = _this.ngxElementService.getComponentFactoryResolver(_this.componentToLoad);
456
- _this.injector = _this.ngxElementService.getInjector(_this.componentToLoad);
457
- var attributes = _this.getElementAttributes();
458
- _this.createComponent(attributes);
459
- });
460
- };
461
- NgxElementComponent.prototype.createComponent = function (attributes) {
462
- this.container.clear();
463
- var factory = this.componentFactoryResolver.resolveComponentFactory(this.componentToLoad);
464
- this.refInjector = i0.ReflectiveInjector.resolveAndCreate([{ provide: this.componentToLoad, useValue: this.componentToLoad }], this.injector);
465
- this.componentRef = this.container.createComponent(factory, 0, this.refInjector);
466
- this.setAttributes(attributes);
467
- this.listenToAttributeChanges();
468
- this.setProxiedOutputs(factory);
469
- };
470
- NgxElementComponent.prototype.setAttributes = function (attributes) {
471
- var _this = this;
472
- attributes.forEach(function (attr) {
473
- _this.componentRef.instance[attr.name] = attr.value;
474
- });
475
- };
476
- NgxElementComponent.prototype.getElementAttributes = function () {
477
- var attrs = this.elementRef.nativeElement.attributes;
478
- var attributes = [];
479
- for (var attr = void 0, i = 0; i < attrs.length; i++) {
480
- attr = attrs[i];
481
- if (attr.nodeName.match('^data-')) {
482
- attributes.push({
483
- name: this.camelCaseAttribute(attr.nodeName),
484
- value: attr.nodeValue
485
- });
486
- }
487
- }
488
- return attributes;
489
- };
490
- NgxElementComponent.prototype.camelCaseAttribute = function (attribute) {
491
- var attr = attribute.replace('data-', '');
492
- var chunks = attr.split('-');
493
- if (chunks.length > 1) {
494
- return chunks[0] + chunks.slice(1).map(function (chunk) { return chunk.replace(/^\w/, function (c) { return c.toUpperCase(); }); }).join('');
495
- }
496
- return attr;
497
- };
498
- NgxElementComponent.prototype.listenToAttributeChanges = function () {
499
- var _this = this;
500
- var observer = new MutationObserver(function (mutations) {
501
- mutations.forEach(function (mutation) {
502
- if (mutation.type === 'attributes') {
503
- var attributes = _this.getElementAttributes();
504
- _this.setAttributes(attributes);
505
- }
506
- });
507
- });
508
- observer.observe(this.elementRef.nativeElement, {
509
- attributes: true
510
- });
511
- };
512
- NgxElementComponent.prototype.ngOnDestroy = function () {
513
- this.componentRef.destroy();
514
- this.ngElementEventsSubscription.unsubscribe();
515
- };
516
- return NgxElementComponent;
517
- }());
518
- NgxElementComponent.decorators = [
519
- { type: i0.Component, args: [{
520
- selector: 'lib-ngx-element',
521
- template: "\n <ng-template #container></ng-template>\n "
522
- },] }
523
- ];
524
- NgxElementComponent.ctorParameters = function () { return [
525
- { type: NgxElementService },
526
- { type: i0.ElementRef }
527
- ]; };
528
- NgxElementComponent.propDecorators = {
529
- selector: [{ type: i0.Input }],
530
- container: [{ type: i0.ViewChild, args: ['container', { read: i0.ViewContainerRef },] }]
531
- };
659
+ var NgxElementComponent = /** @class */ (function () {
660
+ function NgxElementComponent(ngxElementService, elementRef) {
661
+ this.ngxElementService = ngxElementService;
662
+ this.elementRef = elementRef;
663
+ }
664
+ /**
665
+ * Subscribe to event emitters of a lazy loaded and dynamically instantiated Angular component
666
+ * and dispatch them as Custom Events on the NgxElementComponent that is used in a template.
667
+ */
668
+ NgxElementComponent.prototype.setProxiedOutputs = function (factory) {
669
+ var _this = this;
670
+ var eventEmitters = factory.outputs.map(function (_a) {
671
+ var propName = _a.propName, templateName = _a.templateName;
672
+ var emitter = _this.componentRef.instance[propName];
673
+ return emitter.pipe(operators.map(function (value) { return ({ name: templateName, value: value }); }));
674
+ });
675
+ var outputEvents = rxjs.merge.apply(void 0, __spreadArray([], __read(eventEmitters)));
676
+ this.ngElementEventsSubscription = outputEvents.subscribe(function (subscription) {
677
+ var customEvent = document.createEvent('CustomEvent');
678
+ customEvent.initCustomEvent(subscription.name, false, false, subscription.value);
679
+ _this.elementRef.nativeElement.dispatchEvent(customEvent);
680
+ });
681
+ };
682
+ NgxElementComponent.prototype.ngOnInit = function () {
683
+ var _this = this;
684
+ this.ngxElementService.getComponentToLoad(this.selector).subscribe(function (event) {
685
+ _this.componentToLoad = event.componentClass;
686
+ _this.componentFactoryResolver = _this.ngxElementService.getComponentFactoryResolver(_this.componentToLoad);
687
+ _this.injector = _this.ngxElementService.getInjector(_this.componentToLoad);
688
+ var attributes = _this.getElementAttributes();
689
+ _this.createComponent(attributes);
690
+ });
691
+ };
692
+ NgxElementComponent.prototype.createComponent = function (attributes) {
693
+ this.container.clear();
694
+ var factory = this.componentFactoryResolver.resolveComponentFactory(this.componentToLoad);
695
+ this.refInjector = i0.ReflectiveInjector.resolveAndCreate([{ provide: this.componentToLoad, useValue: this.componentToLoad }], this.injector);
696
+ this.componentRef = this.container.createComponent(factory, 0, this.refInjector);
697
+ this.setAttributes(attributes);
698
+ this.listenToAttributeChanges();
699
+ this.setProxiedOutputs(factory);
700
+ };
701
+ NgxElementComponent.prototype.setAttributes = function (attributes) {
702
+ var _this = this;
703
+ attributes.forEach(function (attr) {
704
+ _this.componentRef.instance[attr.name] = attr.value;
705
+ });
706
+ };
707
+ NgxElementComponent.prototype.getElementAttributes = function () {
708
+ var attrs = this.elementRef.nativeElement.attributes;
709
+ var attributes = [];
710
+ for (var attr = void 0, i = 0; i < attrs.length; i++) {
711
+ attr = attrs[i];
712
+ if (attr.nodeName.match('^data-')) {
713
+ attributes.push({
714
+ name: this.camelCaseAttribute(attr.nodeName),
715
+ value: attr.nodeValue
716
+ });
717
+ }
718
+ }
719
+ return attributes;
720
+ };
721
+ NgxElementComponent.prototype.camelCaseAttribute = function (attribute) {
722
+ var attr = attribute.replace('data-', '');
723
+ var chunks = attr.split('-');
724
+ if (chunks.length > 1) {
725
+ return chunks[0] + chunks.slice(1).map(function (chunk) { return chunk.replace(/^\w/, function (c) { return c.toUpperCase(); }); }).join('');
726
+ }
727
+ return attr;
728
+ };
729
+ NgxElementComponent.prototype.listenToAttributeChanges = function () {
730
+ var _this = this;
731
+ var observer = new MutationObserver(function (mutations) {
732
+ mutations.forEach(function (mutation) {
733
+ if (mutation.type === 'attributes') {
734
+ var attributes = _this.getElementAttributes();
735
+ _this.setAttributes(attributes);
736
+ }
737
+ });
738
+ });
739
+ observer.observe(this.elementRef.nativeElement, {
740
+ attributes: true
741
+ });
742
+ };
743
+ NgxElementComponent.prototype.ngOnDestroy = function () {
744
+ this.componentRef.destroy();
745
+ this.ngElementEventsSubscription.unsubscribe();
746
+ };
747
+ return NgxElementComponent;
748
+ }());
749
+ NgxElementComponent.decorators = [
750
+ { type: i0.Component, args: [{
751
+ selector: 'lib-ngx-element',
752
+ template: "\n <ng-template #container></ng-template>\n "
753
+ },] }
754
+ ];
755
+ NgxElementComponent.ctorParameters = function () { return [
756
+ { type: NgxElementService },
757
+ { type: i0.ElementRef }
758
+ ]; };
759
+ NgxElementComponent.propDecorators = {
760
+ selector: [{ type: i0.Input }],
761
+ container: [{ type: i0.ViewChild, args: ['container', { read: i0.ViewContainerRef },] }]
762
+ };
532
763
 
533
- var NgxElementModule = /** @class */ (function () {
534
- function NgxElementModule(injector) {
535
- this.injector = injector;
536
- var ngxElement = elements.createCustomElement(NgxElementComponent, { injector: injector });
537
- customElements.define('ngx-element', ngxElement);
538
- }
539
- NgxElementModule.forRoot = function (modulePaths) {
540
- return {
541
- ngModule: NgxElementModule,
542
- providers: [
543
- {
544
- provide: LAZY_CMPS_PATH_TOKEN,
545
- useValue: modulePaths
546
- }
547
- ]
548
- };
549
- };
550
- NgxElementModule.prototype.ngDoBootstrap = function () { };
551
- return NgxElementModule;
552
- }());
553
- NgxElementModule.decorators = [
554
- { type: i0.NgModule, args: [{
555
- declarations: [NgxElementComponent],
556
- entryComponents: [NgxElementComponent]
557
- },] }
558
- ];
559
- NgxElementModule.ctorParameters = function () { return [
560
- { type: i0.Injector }
561
- ]; };
764
+ var NgxElementModule = /** @class */ (function () {
765
+ function NgxElementModule(injector) {
766
+ this.injector = injector;
767
+ var ngxElement = elements.createCustomElement(NgxElementComponent, { injector: injector });
768
+ customElements.define('ngx-element', ngxElement);
769
+ }
770
+ NgxElementModule.forRoot = function (modulePaths) {
771
+ return {
772
+ ngModule: NgxElementModule,
773
+ providers: [
774
+ {
775
+ provide: LAZY_CMPS_PATH_TOKEN,
776
+ useValue: modulePaths
777
+ }
778
+ ]
779
+ };
780
+ };
781
+ NgxElementModule.prototype.ngDoBootstrap = function () { };
782
+ return NgxElementModule;
783
+ }());
784
+ NgxElementModule.decorators = [
785
+ { type: i0.NgModule, args: [{
786
+ declarations: [NgxElementComponent],
787
+ entryComponents: [NgxElementComponent]
788
+ },] }
789
+ ];
790
+ NgxElementModule.ctorParameters = function () { return [
791
+ { type: i0.Injector }
792
+ ]; };
562
793
 
563
- /*
564
- * Public API Surface of ngx-element
565
- */
794
+ /*
795
+ * Public API Surface of ngx-element
796
+ */
566
797
 
567
- /**
568
- * Generated bundle index. Do not edit.
569
- */
798
+ /**
799
+ * Generated bundle index. Do not edit.
800
+ */
570
801
 
571
- exports.NgxElementModule = NgxElementModule;
572
- exports.ɵa = NgxElementComponent;
573
- exports.ɵb = NgxElementService;
574
- exports.ɵc = LAZY_CMPS_PATH_TOKEN;
802
+ exports.NgxElementModule = NgxElementModule;
803
+ exports["ɵa"] = NgxElementComponent;
804
+ exports["ɵb"] = NgxElementService;
805
+ exports["ɵc"] = LAZY_CMPS_PATH_TOKEN;
575
806
 
576
- Object.defineProperty(exports, '__esModule', { value: true });
807
+ Object.defineProperty(exports, '__esModule', { value: true });
577
808
 
578
- })));
809
+ }));
579
810
  //# sourceMappingURL=zdigambar-ngx-element.umd.js.map