@sitecore-jss/sitecore-jss-angular 16.0.0-canary.8 → 16.0.1

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.
Files changed (61) hide show
  1. package/LICENSE.txt +202 -202
  2. package/README.md +5 -5
  3. package/dist/README.md +5 -5
  4. package/dist/bundles/sitecore-jss-sitecore-jss-angular.umd.js +1385 -1389
  5. package/dist/bundles/sitecore-jss-sitecore-jss-angular.umd.js.map +1 -1
  6. package/dist/bundles/sitecore-jss-sitecore-jss-angular.umd.min.js +1 -1
  7. package/dist/bundles/sitecore-jss-sitecore-jss-angular.umd.min.js.map +1 -1
  8. package/dist/components/date.directive.d.ts +17 -17
  9. package/dist/components/file.directive.d.ts +14 -14
  10. package/dist/components/generic-link.directive.d.ts +14 -14
  11. package/dist/components/image.directive.d.ts +28 -28
  12. package/dist/components/link.directive.d.ts +18 -18
  13. package/dist/components/missing-component.component.d.ts +3 -3
  14. package/dist/components/placeholder-loading.directive.d.ts +5 -5
  15. package/dist/components/placeholder.component.d.ts +45 -45
  16. package/dist/components/placeholder.token.d.ts +30 -24
  17. package/dist/components/raw.component.d.ts +9 -9
  18. package/dist/components/render-component.component.d.ts +29 -29
  19. package/dist/components/render-each.directive.d.ts +5 -5
  20. package/dist/components/render-empty.directive.d.ts +5 -5
  21. package/dist/components/rendering-field.d.ts +20 -20
  22. package/dist/components/rendering.d.ts +5 -2
  23. package/dist/components/rich-text.directive.d.ts +12 -12
  24. package/dist/components/router-link.directive.d.ts +12 -12
  25. package/dist/components/text.directive.d.ts +13 -13
  26. package/dist/esm2015/components/date.directive.js +53 -54
  27. package/dist/esm2015/components/file.directive.js +43 -43
  28. package/dist/esm2015/components/generic-link.directive.js +58 -60
  29. package/dist/esm2015/components/image.directive.js +123 -126
  30. package/dist/esm2015/components/link.directive.js +99 -101
  31. package/dist/esm2015/components/missing-component.component.js +19 -16
  32. package/dist/esm2015/components/placeholder-loading.directive.js +15 -15
  33. package/dist/esm2015/components/placeholder.component.js +196 -186
  34. package/dist/esm2015/components/placeholder.token.js +21 -15
  35. package/dist/esm2015/components/raw.component.js +37 -36
  36. package/dist/esm2015/components/render-component.component.js +89 -85
  37. package/dist/esm2015/components/render-each.directive.js +15 -16
  38. package/dist/esm2015/components/render-empty.directive.js +15 -16
  39. package/dist/esm2015/components/rendering-field.js +1 -1
  40. package/dist/esm2015/components/rendering.js +8 -4
  41. package/dist/esm2015/components/rich-text.directive.js +41 -42
  42. package/dist/esm2015/components/router-link.directive.js +44 -46
  43. package/dist/esm2015/components/text.directive.js +54 -56
  44. package/dist/esm2015/jss-component-factory.service.js +87 -94
  45. package/dist/esm2015/layout-service-error.js +3 -3
  46. package/dist/esm2015/layout.service.js +28 -30
  47. package/dist/esm2015/lib.module.js +112 -113
  48. package/dist/esm2015/public_api.js +16 -16
  49. package/dist/esm2015/sitecore-jss-sitecore-jss-angular.js +13 -13
  50. package/dist/fesm2015/sitecore-jss-sitecore-jss-angular.js +1053 -1050
  51. package/dist/fesm2015/sitecore-jss-sitecore-jss-angular.js.map +1 -1
  52. package/dist/jss-component-factory.service.d.ts +21 -21
  53. package/dist/layout-service-error.d.ts +8 -8
  54. package/dist/layout.service.d.ts +8 -8
  55. package/dist/lib.module.d.ts +24 -16
  56. package/dist/package.json +2 -2
  57. package/dist/public_api.d.ts +16 -16
  58. package/dist/sitecore-jss-sitecore-jss-angular.d.ts +12 -12
  59. package/dist/sitecore-jss-sitecore-jss-angular.metadata.json +1 -1
  60. package/package.json +6 -4
  61. package/typings/README.md +2 -2
@@ -4,1439 +4,1435 @@
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global['sitecore-jss'] = global['sitecore-jss'] || {}, global['sitecore-jss']['sitecore-jss-angular'] = {}), global.ng.core, global['@sitecore-jss/sitecore-jss'], global.ng.router, global.rxjs, global.rxjs.operators, global.ng.common));
5
5
  }(this, (function (exports, core, sitecoreJss, router, rxjs, operators, common) { 'use strict';
6
6
 
7
- /**
8
- * File fields cannot be managed via the EE. We never output "editable."
9
- */
10
- var FileDirective = /** @class */ (function () {
11
- function FileDirective(viewContainer, templateRef) {
12
- this.viewContainer = viewContainer;
13
- this.templateRef = templateRef;
14
- }
15
- FileDirective.prototype.ngOnChanges = function (changes) {
16
- if (changes['field']) {
17
- if (!this.viewRef) {
18
- this.viewContainer.clear();
19
- this.viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
20
- }
21
- this.updateView();
22
- }
23
- };
24
- FileDirective.prototype.updateView = function () {
25
- var field = this.field;
26
- if (!field || (!field.value && !field.src)) {
27
- return;
28
- }
29
- var file = field.src ? field : field.value;
30
- this.viewRef.rootNodes.forEach(function (node) {
31
- node.href = file.src;
32
- if (node.innerHTML === '') {
33
- node.innerHTML = file.title || file.displayName;
34
- }
35
- });
36
- };
37
- return FileDirective;
38
- }());
39
- FileDirective.decorators = [
40
- { type: core.Directive, args: [{ selector: '[scFile]' },] }
41
- ];
42
- FileDirective.ctorParameters = function () { return [
43
- { type: core.ViewContainerRef },
44
- { type: core.TemplateRef }
45
- ]; };
46
- FileDirective.propDecorators = {
47
- field: [{ type: core.Input, args: ['scFile',] }]
7
+ /**
8
+ * File fields cannot be managed via the EE. We never output "editable."
9
+ */
10
+ var FileDirective = /** @class */ (function () {
11
+ function FileDirective(viewContainer, templateRef) {
12
+ this.viewContainer = viewContainer;
13
+ this.templateRef = templateRef;
14
+ }
15
+ FileDirective.prototype.ngOnChanges = function (changes) {
16
+ if (changes.field) {
17
+ if (!this.viewRef) {
18
+ this.viewContainer.clear();
19
+ this.viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
20
+ }
21
+ this.updateView();
22
+ }
23
+ };
24
+ FileDirective.prototype.updateView = function () {
25
+ var field = this.field;
26
+ if (!field || (!field.value && !field.src)) {
27
+ return;
28
+ }
29
+ var file = field.src ? field : field.value;
30
+ this.viewRef.rootNodes.forEach(function (node) {
31
+ node.href = file.src;
32
+ if (node.innerHTML === '') {
33
+ node.innerHTML = file.title || file.displayName;
34
+ }
35
+ });
36
+ };
37
+ return FileDirective;
38
+ }());
39
+ FileDirective.decorators = [
40
+ { type: core.Directive, args: [{ selector: '[scFile]' },] }
41
+ ];
42
+ FileDirective.ctorParameters = function () { return [
43
+ { type: core.ViewContainerRef },
44
+ { type: core.TemplateRef }
45
+ ]; };
46
+ FileDirective.propDecorators = {
47
+ field: [{ type: core.Input, args: ['scFile',] }]
48
48
  };
49
49
 
50
- /*! *****************************************************************************
51
- Copyright (c) Microsoft Corporation. All rights reserved.
52
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
53
- this file except in compliance with the License. You may obtain a copy of the
54
- License at http://www.apache.org/licenses/LICENSE-2.0
55
-
56
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
57
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
58
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
59
- MERCHANTABLITY OR NON-INFRINGEMENT.
60
-
61
- See the Apache Version 2.0 License for specific language governing permissions
62
- and limitations under the License.
63
- ***************************************************************************** */
64
- /* global Reflect, Promise */
65
- var extendStatics = function (d, b) {
66
- extendStatics = Object.setPrototypeOf ||
67
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
68
- function (d, b) { for (var p in b)
69
- if (b.hasOwnProperty(p))
70
- d[p] = b[p]; };
71
- return extendStatics(d, b);
72
- };
73
- function __extends(d, b) {
74
- extendStatics(d, b);
75
- function __() { this.constructor = d; }
76
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
77
- }
78
- var __assign = function () {
79
- __assign = Object.assign || function __assign(t) {
80
- for (var s, i = 1, n = arguments.length; i < n; i++) {
81
- s = arguments[i];
82
- for (var p in s)
83
- if (Object.prototype.hasOwnProperty.call(s, p))
84
- t[p] = s[p];
85
- }
86
- return t;
87
- };
88
- return __assign.apply(this, arguments);
89
- };
90
- function __rest(s, e) {
91
- var t = {};
92
- for (var p in s)
93
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
94
- t[p] = s[p];
95
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
96
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
97
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
98
- t[p[i]] = s[p[i]];
99
- }
100
- return t;
101
- }
102
- function __decorate(decorators, target, key, desc) {
103
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
104
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
105
- r = Reflect.decorate(decorators, target, key, desc);
106
- else
107
- for (var i = decorators.length - 1; i >= 0; i--)
108
- if (d = decorators[i])
109
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
110
- return c > 3 && r && Object.defineProperty(target, key, r), r;
111
- }
112
- function __param(paramIndex, decorator) {
113
- return function (target, key) { decorator(target, key, paramIndex); };
114
- }
115
- function __metadata(metadataKey, metadataValue) {
116
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
117
- return Reflect.metadata(metadataKey, metadataValue);
118
- }
119
- function __awaiter(thisArg, _arguments, P, generator) {
120
- return new (P || (P = Promise))(function (resolve, reject) {
121
- function fulfilled(value) { try {
122
- step(generator.next(value));
123
- }
124
- catch (e) {
125
- reject(e);
126
- } }
127
- function rejected(value) { try {
128
- step(generator["throw"](value));
129
- }
130
- catch (e) {
131
- reject(e);
132
- } }
133
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
134
- step((generator = generator.apply(thisArg, _arguments || [])).next());
135
- });
136
- }
137
- function __generator(thisArg, body) {
138
- var _ = { label: 0, sent: function () { if (t[0] & 1)
139
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
140
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
141
- function verb(n) { return function (v) { return step([n, v]); }; }
142
- function step(op) {
143
- if (f)
144
- throw new TypeError("Generator is already executing.");
145
- while (_)
146
- try {
147
- 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)
148
- return t;
149
- if (y = 0, t)
150
- op = [op[0] & 2, t.value];
151
- switch (op[0]) {
152
- case 0:
153
- case 1:
154
- t = op;
155
- break;
156
- case 4:
157
- _.label++;
158
- return { value: op[1], done: false };
159
- case 5:
160
- _.label++;
161
- y = op[1];
162
- op = [0];
163
- continue;
164
- case 7:
165
- op = _.ops.pop();
166
- _.trys.pop();
167
- continue;
168
- default:
169
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
170
- _ = 0;
171
- continue;
172
- }
173
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
174
- _.label = op[1];
175
- break;
176
- }
177
- if (op[0] === 6 && _.label < t[1]) {
178
- _.label = t[1];
179
- t = op;
180
- break;
181
- }
182
- if (t && _.label < t[2]) {
183
- _.label = t[2];
184
- _.ops.push(op);
185
- break;
186
- }
187
- if (t[2])
188
- _.ops.pop();
189
- _.trys.pop();
190
- continue;
191
- }
192
- op = body.call(thisArg, _);
193
- }
194
- catch (e) {
195
- op = [6, e];
196
- y = 0;
197
- }
198
- finally {
199
- f = t = 0;
200
- }
201
- if (op[0] & 5)
202
- throw op[1];
203
- return { value: op[0] ? op[1] : void 0, done: true };
204
- }
205
- }
206
- function __exportStar(m, exports) {
207
- for (var p in m)
208
- if (!exports.hasOwnProperty(p))
209
- exports[p] = m[p];
210
- }
211
- function __values(o) {
212
- var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
213
- if (m)
214
- return m.call(o);
215
- return {
216
- next: function () {
217
- if (o && i >= o.length)
218
- o = void 0;
219
- return { value: o && o[i++], done: !o };
220
- }
221
- };
222
- }
223
- function __read(o, n) {
224
- var m = typeof Symbol === "function" && o[Symbol.iterator];
225
- if (!m)
226
- return o;
227
- var i = m.call(o), r, ar = [], e;
228
- try {
229
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
230
- ar.push(r.value);
231
- }
232
- catch (error) {
233
- e = { error: error };
234
- }
235
- finally {
236
- try {
237
- if (r && !r.done && (m = i["return"]))
238
- m.call(i);
239
- }
240
- finally {
241
- if (e)
242
- throw e.error;
243
- }
244
- }
245
- return ar;
246
- }
247
- function __spread() {
248
- for (var ar = [], i = 0; i < arguments.length; i++)
249
- ar = ar.concat(__read(arguments[i]));
250
- return ar;
251
- }
252
- function __spreadArrays() {
253
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
254
- s += arguments[i].length;
255
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
256
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
257
- r[k] = a[j];
258
- return r;
259
- }
260
- ;
261
- function __await(v) {
262
- return this instanceof __await ? (this.v = v, this) : new __await(v);
263
- }
264
- function __asyncGenerator(thisArg, _arguments, generator) {
265
- if (!Symbol.asyncIterator)
266
- throw new TypeError("Symbol.asyncIterator is not defined.");
267
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
268
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
269
- function verb(n) { if (g[n])
270
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
271
- function resume(n, v) { try {
272
- step(g[n](v));
273
- }
274
- catch (e) {
275
- settle(q[0][3], e);
276
- } }
277
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
278
- function fulfill(value) { resume("next", value); }
279
- function reject(value) { resume("throw", value); }
280
- function settle(f, v) { if (f(v), q.shift(), q.length)
281
- resume(q[0][0], q[0][1]); }
282
- }
283
- function __asyncDelegator(o) {
284
- var i, p;
285
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
286
- 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; }
287
- }
288
- function __asyncValues(o) {
289
- if (!Symbol.asyncIterator)
290
- throw new TypeError("Symbol.asyncIterator is not defined.");
291
- var m = o[Symbol.asyncIterator], i;
292
- 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);
293
- 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); }); }; }
294
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
295
- }
296
- function __makeTemplateObject(cooked, raw) {
297
- if (Object.defineProperty) {
298
- Object.defineProperty(cooked, "raw", { value: raw });
299
- }
300
- else {
301
- cooked.raw = raw;
302
- }
303
- return cooked;
304
- }
305
- ;
306
- function __importStar(mod) {
307
- if (mod && mod.__esModule)
308
- return mod;
309
- var result = {};
310
- if (mod != null)
311
- for (var k in mod)
312
- if (Object.hasOwnProperty.call(mod, k))
313
- result[k] = mod[k];
314
- result.default = mod;
315
- return result;
316
- }
317
- function __importDefault(mod) {
318
- return (mod && mod.__esModule) ? mod : { default: mod };
50
+ /*! *****************************************************************************
51
+ Copyright (c) Microsoft Corporation. All rights reserved.
52
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
53
+ this file except in compliance with the License. You may obtain a copy of the
54
+ License at http://www.apache.org/licenses/LICENSE-2.0
55
+
56
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
57
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
58
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
59
+ MERCHANTABLITY OR NON-INFRINGEMENT.
60
+
61
+ See the Apache Version 2.0 License for specific language governing permissions
62
+ and limitations under the License.
63
+ ***************************************************************************** */
64
+ /* global Reflect, Promise */
65
+ var extendStatics = function (d, b) {
66
+ extendStatics = Object.setPrototypeOf ||
67
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
68
+ function (d, b) { for (var p in b)
69
+ if (b.hasOwnProperty(p))
70
+ d[p] = b[p]; };
71
+ return extendStatics(d, b);
72
+ };
73
+ function __extends(d, b) {
74
+ extendStatics(d, b);
75
+ function __() { this.constructor = d; }
76
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
77
+ }
78
+ var __assign = function () {
79
+ __assign = Object.assign || function __assign(t) {
80
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
81
+ s = arguments[i];
82
+ for (var p in s)
83
+ if (Object.prototype.hasOwnProperty.call(s, p))
84
+ t[p] = s[p];
85
+ }
86
+ return t;
87
+ };
88
+ return __assign.apply(this, arguments);
89
+ };
90
+ function __rest(s, e) {
91
+ var t = {};
92
+ for (var p in s)
93
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
94
+ t[p] = s[p];
95
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
96
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
97
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
98
+ t[p[i]] = s[p[i]];
99
+ }
100
+ return t;
101
+ }
102
+ function __decorate(decorators, target, key, desc) {
103
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
104
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
105
+ r = Reflect.decorate(decorators, target, key, desc);
106
+ else
107
+ for (var i = decorators.length - 1; i >= 0; i--)
108
+ if (d = decorators[i])
109
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
110
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
111
+ }
112
+ function __param(paramIndex, decorator) {
113
+ return function (target, key) { decorator(target, key, paramIndex); };
114
+ }
115
+ function __metadata(metadataKey, metadataValue) {
116
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
117
+ return Reflect.metadata(metadataKey, metadataValue);
118
+ }
119
+ function __awaiter(thisArg, _arguments, P, generator) {
120
+ return new (P || (P = Promise))(function (resolve, reject) {
121
+ function fulfilled(value) { try {
122
+ step(generator.next(value));
123
+ }
124
+ catch (e) {
125
+ reject(e);
126
+ } }
127
+ function rejected(value) { try {
128
+ step(generator["throw"](value));
129
+ }
130
+ catch (e) {
131
+ reject(e);
132
+ } }
133
+ function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
134
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
135
+ });
136
+ }
137
+ function __generator(thisArg, body) {
138
+ var _ = { label: 0, sent: function () { if (t[0] & 1)
139
+ throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
140
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
141
+ function verb(n) { return function (v) { return step([n, v]); }; }
142
+ function step(op) {
143
+ if (f)
144
+ throw new TypeError("Generator is already executing.");
145
+ while (_)
146
+ try {
147
+ 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)
148
+ return t;
149
+ if (y = 0, t)
150
+ op = [op[0] & 2, t.value];
151
+ switch (op[0]) {
152
+ case 0:
153
+ case 1:
154
+ t = op;
155
+ break;
156
+ case 4:
157
+ _.label++;
158
+ return { value: op[1], done: false };
159
+ case 5:
160
+ _.label++;
161
+ y = op[1];
162
+ op = [0];
163
+ continue;
164
+ case 7:
165
+ op = _.ops.pop();
166
+ _.trys.pop();
167
+ continue;
168
+ default:
169
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
170
+ _ = 0;
171
+ continue;
172
+ }
173
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
174
+ _.label = op[1];
175
+ break;
176
+ }
177
+ if (op[0] === 6 && _.label < t[1]) {
178
+ _.label = t[1];
179
+ t = op;
180
+ break;
181
+ }
182
+ if (t && _.label < t[2]) {
183
+ _.label = t[2];
184
+ _.ops.push(op);
185
+ break;
186
+ }
187
+ if (t[2])
188
+ _.ops.pop();
189
+ _.trys.pop();
190
+ continue;
191
+ }
192
+ op = body.call(thisArg, _);
193
+ }
194
+ catch (e) {
195
+ op = [6, e];
196
+ y = 0;
197
+ }
198
+ finally {
199
+ f = t = 0;
200
+ }
201
+ if (op[0] & 5)
202
+ throw op[1];
203
+ return { value: op[0] ? op[1] : void 0, done: true };
204
+ }
205
+ }
206
+ function __exportStar(m, exports) {
207
+ for (var p in m)
208
+ if (!exports.hasOwnProperty(p))
209
+ exports[p] = m[p];
210
+ }
211
+ function __values(o) {
212
+ var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
213
+ if (m)
214
+ return m.call(o);
215
+ return {
216
+ next: function () {
217
+ if (o && i >= o.length)
218
+ o = void 0;
219
+ return { value: o && o[i++], done: !o };
220
+ }
221
+ };
222
+ }
223
+ function __read(o, n) {
224
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
225
+ if (!m)
226
+ return o;
227
+ var i = m.call(o), r, ar = [], e;
228
+ try {
229
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
230
+ ar.push(r.value);
231
+ }
232
+ catch (error) {
233
+ e = { error: error };
234
+ }
235
+ finally {
236
+ try {
237
+ if (r && !r.done && (m = i["return"]))
238
+ m.call(i);
239
+ }
240
+ finally {
241
+ if (e)
242
+ throw e.error;
243
+ }
244
+ }
245
+ return ar;
246
+ }
247
+ function __spread() {
248
+ for (var ar = [], i = 0; i < arguments.length; i++)
249
+ ar = ar.concat(__read(arguments[i]));
250
+ return ar;
251
+ }
252
+ function __spreadArrays() {
253
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++)
254
+ s += arguments[i].length;
255
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
256
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
257
+ r[k] = a[j];
258
+ return r;
259
+ }
260
+ ;
261
+ function __await(v) {
262
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
263
+ }
264
+ function __asyncGenerator(thisArg, _arguments, generator) {
265
+ if (!Symbol.asyncIterator)
266
+ throw new TypeError("Symbol.asyncIterator is not defined.");
267
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
268
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
269
+ function verb(n) { if (g[n])
270
+ i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
271
+ function resume(n, v) { try {
272
+ step(g[n](v));
273
+ }
274
+ catch (e) {
275
+ settle(q[0][3], e);
276
+ } }
277
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
278
+ function fulfill(value) { resume("next", value); }
279
+ function reject(value) { resume("throw", value); }
280
+ function settle(f, v) { if (f(v), q.shift(), q.length)
281
+ resume(q[0][0], q[0][1]); }
282
+ }
283
+ function __asyncDelegator(o) {
284
+ var i, p;
285
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
286
+ 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; }
287
+ }
288
+ function __asyncValues(o) {
289
+ if (!Symbol.asyncIterator)
290
+ throw new TypeError("Symbol.asyncIterator is not defined.");
291
+ var m = o[Symbol.asyncIterator], i;
292
+ 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);
293
+ 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); }); }; }
294
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
295
+ }
296
+ function __makeTemplateObject(cooked, raw) {
297
+ if (Object.defineProperty) {
298
+ Object.defineProperty(cooked, "raw", { value: raw });
299
+ }
300
+ else {
301
+ cooked.raw = raw;
302
+ }
303
+ return cooked;
304
+ }
305
+ ;
306
+ function __importStar(mod) {
307
+ if (mod && mod.__esModule)
308
+ return mod;
309
+ var result = {};
310
+ if (mod != null)
311
+ for (var k in mod)
312
+ if (Object.hasOwnProperty.call(mod, k))
313
+ result[k] = mod[k];
314
+ result.default = mod;
315
+ return result;
316
+ }
317
+ function __importDefault(mod) {
318
+ return (mod && mod.__esModule) ? mod : { default: mod };
319
319
  }
320
320
 
321
- var ImageDirective = /** @class */ (function () {
322
- function ImageDirective(viewContainer, templateRef, renderer, elementRef) {
323
- this.viewContainer = viewContainer;
324
- this.templateRef = templateRef;
325
- this.renderer = renderer;
326
- this.elementRef = elementRef;
327
- this.inlineRef = null;
328
- // tslint:disable-next-line:no-input-rename
329
- this.editable = true;
330
- // tslint:disable-next-line:no-input-rename
331
- this.urlParams = {};
332
- // tslint:disable-next-line:no-input-rename
333
- this.attrs = {};
334
- }
335
- ImageDirective.prototype.ngOnChanges = function (changes) {
336
- if (changes['field'] || changes['editable'] || changes['urlParams'] || changes['attrs']) {
337
- this.viewContainer.clear();
338
- if (this.inlineRef) {
339
- this.inlineRef.remove();
340
- this.inlineRef = null;
341
- }
342
- this.updateView();
343
- }
344
- };
345
- ImageDirective.prototype.updateView = function () {
346
- var overrideAttrs = Object.assign(Object.assign({}, this.getElementAttrs()), this.attrs);
347
- var media = this.field;
348
- if (!media || (!media.editable && !media.value && !media.src)) {
349
- return;
350
- }
351
- var attrs = {};
352
- // we likely have an experience editor value, should be a string
353
- if (this.editable && media.editable) {
354
- var foundImg = sitecoreJss.mediaApi.findEditorImageTag(media.editable);
355
- if (!foundImg) {
356
- return this.renderInlineWrapper(media.editable);
357
- }
358
- attrs = this.getImageAttrs(foundImg.attrs, overrideAttrs, this.urlParams);
359
- if (!attrs) {
360
- return this.renderInlineWrapper(media.editable);
361
- }
362
- var tempImg_1 = this.renderer.createElement('img');
363
- Object.entries(attrs).forEach(function (_a) {
364
- var _b = __read(_a, 2), key = _b[0], attrValue = _b[1];
365
- return tempImg_1.setAttribute(key, attrValue);
366
- });
367
- var editableMarkup = media.editable.replace(foundImg.imgTag, tempImg_1.outerHTML);
368
- return this.renderInlineWrapper(editableMarkup);
369
- }
370
- // some wise-guy/gal is passing in a 'raw' image object value
371
- var img = media.src ? media : media.value;
372
- if (!img) {
373
- return null;
374
- }
375
- attrs = this.getImageAttrs(img, overrideAttrs, this.urlParams);
376
- if (attrs) {
377
- this.renderTemplate(attrs);
378
- }
379
- };
380
- ImageDirective.prototype.getImageAttrs = function (fieldAttrs, parsedAttrs, imageParams) {
381
- var combinedAttrs = Object.assign(Object.assign({}, fieldAttrs), parsedAttrs);
382
- // tslint:disable-next-line:prefer-const
383
- var src = combinedAttrs.src, srcSet = combinedAttrs.srcSet, otherAttrs = __rest(combinedAttrs, ["src", "srcSet"]);
384
- if (!src) {
385
- return null;
386
- }
387
- var newAttrs = Object.assign({}, otherAttrs);
388
- // update image URL for jss handler and image rendering params
389
- src = sitecoreJss.mediaApi.updateImageUrl(src, imageParams, this.mediaUrlPrefix);
390
- if (srcSet) {
391
- // replace with HTML-formatted srcset, including updated image URLs
392
- newAttrs.srcSet = sitecoreJss.mediaApi.getSrcSet(src, srcSet, imageParams, this.mediaUrlPrefix);
393
- }
394
- else {
395
- newAttrs.src = src;
396
- }
397
- return newAttrs;
398
- };
399
- ImageDirective.prototype.renderTemplate = function (imageProps) {
400
- var _this = this;
401
- var viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
402
- viewRef.rootNodes.forEach(function (node) {
403
- Object.entries(imageProps).forEach(function (_a) {
404
- var _b = __read(_a, 2), key = _b[0], imgPropVal = _b[1];
405
- return _this.renderer.setAttribute(node, key, imgPropVal);
406
- });
407
- });
408
- };
409
- ImageDirective.prototype.getElementAttrs = function () {
410
- var view = this.templateRef.createEmbeddedView(null);
411
- var element = view.rootNodes[0];
412
- if (!element) {
413
- return {};
414
- }
415
- var attrs = {};
416
- for (var i = 0; i < element.attributes.length; i++) {
417
- var attr = element.attributes.item(i);
418
- if (attr) {
419
- attrs[attr.name] = attr.value;
420
- }
421
- }
422
- return attrs;
423
- };
424
- ImageDirective.prototype.renderInlineWrapper = function (editable) {
425
- var span = this.renderer.createElement('span');
426
- span.className = 'sc-image-wrapper';
427
- span.innerHTML = editable;
428
- var parentNode = this.renderer.parentNode(this.elementRef.nativeElement);
429
- this.renderer.insertBefore(parentNode, span, this.elementRef.nativeElement);
430
- parentNode.removeChild(this.elementRef.nativeElement);
431
- this.inlineRef = span;
432
- };
433
- return ImageDirective;
434
- }());
435
- ImageDirective.decorators = [
436
- { type: core.Directive, args: [{ selector: '[scImage]' },] }
437
- ];
438
- ImageDirective.ctorParameters = function () { return [
439
- { type: core.ViewContainerRef },
440
- { type: core.TemplateRef },
441
- { type: core.Renderer2 },
442
- { type: core.ElementRef }
443
- ]; };
444
- ImageDirective.propDecorators = {
445
- field: [{ type: core.Input, args: ['scImage',] }],
446
- editable: [{ type: core.Input, args: ['scImageEditable',] }],
447
- mediaUrlPrefix: [{ type: core.Input, args: ['scImageMediaUrlPrefix',] }],
448
- urlParams: [{ type: core.Input, args: ['scImageUrlParams',] }],
449
- attrs: [{ type: core.Input, args: ['scImageAttrs',] }]
321
+ var ImageDirective = /** @class */ (function () {
322
+ function ImageDirective(viewContainer, templateRef, renderer, elementRef) {
323
+ this.viewContainer = viewContainer;
324
+ this.templateRef = templateRef;
325
+ this.renderer = renderer;
326
+ this.elementRef = elementRef;
327
+ this.inlineRef = null;
328
+ this.editable = true;
329
+ this.urlParams = {};
330
+ this.attrs = {};
331
+ }
332
+ ImageDirective.prototype.ngOnChanges = function (changes) {
333
+ if (changes.field || changes.editable || changes.urlParams || changes.attrs) {
334
+ this.viewContainer.clear();
335
+ if (this.inlineRef) {
336
+ this.inlineRef.remove();
337
+ this.inlineRef = null;
338
+ }
339
+ this.updateView();
340
+ }
341
+ };
342
+ ImageDirective.prototype.updateView = function () {
343
+ var overrideAttrs = Object.assign(Object.assign({}, this.getElementAttrs()), this.attrs);
344
+ var media = this.field;
345
+ if (!media || (!media.editable && !media.value && !media.src)) {
346
+ return;
347
+ }
348
+ var attrs = {};
349
+ // we likely have an experience editor value, should be a string
350
+ if (this.editable && media.editable) {
351
+ var foundImg = sitecoreJss.mediaApi.findEditorImageTag(media.editable);
352
+ if (!foundImg) {
353
+ return this.renderInlineWrapper(media.editable);
354
+ }
355
+ attrs = this.getImageAttrs(foundImg.attrs, overrideAttrs, this.urlParams);
356
+ if (!attrs) {
357
+ return this.renderInlineWrapper(media.editable);
358
+ }
359
+ var tempImg_1 = this.renderer.createElement('img');
360
+ Object.entries(attrs).forEach(function (_a) {
361
+ var _b = __read(_a, 2), key = _b[0], attrValue = _b[1];
362
+ return tempImg_1.setAttribute(key, attrValue);
363
+ });
364
+ var editableMarkup = media.editable.replace(foundImg.imgTag, tempImg_1.outerHTML);
365
+ return this.renderInlineWrapper(editableMarkup);
366
+ }
367
+ // some wise-guy/gal is passing in a 'raw' image object value
368
+ var img = media.src ? media : media.value;
369
+ if (!img) {
370
+ return null;
371
+ }
372
+ attrs = this.getImageAttrs(img, overrideAttrs, this.urlParams);
373
+ if (attrs) {
374
+ this.renderTemplate(attrs);
375
+ }
376
+ };
377
+ ImageDirective.prototype.getImageAttrs = function (fieldAttrs, parsedAttrs, imageParams) {
378
+ var combinedAttrs = Object.assign(Object.assign({}, fieldAttrs), parsedAttrs);
379
+ // eslint-disable-next-line prefer-const
380
+ var src = combinedAttrs.src, srcSet = combinedAttrs.srcSet, otherAttrs = __rest(combinedAttrs, ["src", "srcSet"]);
381
+ if (!src) {
382
+ return null;
383
+ }
384
+ var newAttrs = Object.assign({}, otherAttrs);
385
+ // update image URL for jss handler and image rendering params
386
+ src = sitecoreJss.mediaApi.updateImageUrl(src, imageParams, this.mediaUrlPrefix);
387
+ if (srcSet) {
388
+ // replace with HTML-formatted srcset, including updated image URLs
389
+ newAttrs.srcSet = sitecoreJss.mediaApi.getSrcSet(src, srcSet, imageParams, this.mediaUrlPrefix);
390
+ }
391
+ else {
392
+ newAttrs.src = src;
393
+ }
394
+ return newAttrs;
395
+ };
396
+ ImageDirective.prototype.renderTemplate = function (imageProps) {
397
+ var _this = this;
398
+ var viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
399
+ viewRef.rootNodes.forEach(function (node) {
400
+ Object.entries(imageProps).forEach(function (_a) {
401
+ var _b = __read(_a, 2), key = _b[0], imgPropVal = _b[1];
402
+ return _this.renderer.setAttribute(node, key, imgPropVal);
403
+ });
404
+ });
405
+ };
406
+ ImageDirective.prototype.getElementAttrs = function () {
407
+ var view = this.templateRef.createEmbeddedView(null);
408
+ var element = view.rootNodes[0];
409
+ if (!element) {
410
+ return {};
411
+ }
412
+ var attrs = {};
413
+ for (var i = 0; i < element.attributes.length; i++) {
414
+ var attr = element.attributes.item(i);
415
+ if (attr) {
416
+ attrs[attr.name] = attr.value;
417
+ }
418
+ }
419
+ return attrs;
420
+ };
421
+ ImageDirective.prototype.renderInlineWrapper = function (editable) {
422
+ var span = this.renderer.createElement('span');
423
+ span.className = 'sc-image-wrapper';
424
+ span.innerHTML = editable;
425
+ var parentNode = this.renderer.parentNode(this.elementRef.nativeElement);
426
+ this.renderer.insertBefore(parentNode, span, this.elementRef.nativeElement);
427
+ parentNode.removeChild(this.elementRef.nativeElement);
428
+ this.inlineRef = span;
429
+ };
430
+ return ImageDirective;
431
+ }());
432
+ ImageDirective.decorators = [
433
+ { type: core.Directive, args: [{ selector: '[scImage]' },] }
434
+ ];
435
+ ImageDirective.ctorParameters = function () { return [
436
+ { type: core.ViewContainerRef },
437
+ { type: core.TemplateRef },
438
+ { type: core.Renderer2 },
439
+ { type: core.ElementRef }
440
+ ]; };
441
+ ImageDirective.propDecorators = {
442
+ field: [{ type: core.Input, args: ['scImage',] }],
443
+ editable: [{ type: core.Input, args: ['scImageEditable',] }],
444
+ mediaUrlPrefix: [{ type: core.Input, args: ['scImageMediaUrlPrefix',] }],
445
+ urlParams: [{ type: core.Input, args: ['scImageUrlParams',] }],
446
+ attrs: [{ type: core.Input, args: ['scImageAttrs',] }]
450
447
  };
451
448
 
452
- var LinkDirective = /** @class */ (function () {
453
- function LinkDirective(viewContainer, templateRef, renderer, elementRef) {
454
- this.viewContainer = viewContainer;
455
- this.templateRef = templateRef;
456
- this.renderer = renderer;
457
- this.elementRef = elementRef;
458
- this.inlineRef = null;
459
- // tslint:disable-next-line:no-input-rename
460
- this.editable = true;
461
- // tslint:disable-next-line:no-input-rename
462
- this.attrs = {};
463
- }
464
- LinkDirective.prototype.ngOnChanges = function (changes) {
465
- if (changes['field'] || changes['editable'] || changes['attrs']) {
466
- this.viewContainer.clear();
467
- if (this.inlineRef) {
468
- this.inlineRef.remove();
469
- this.inlineRef = null;
470
- }
471
- this.updateView();
472
- }
473
- };
474
- LinkDirective.prototype.updateView = function () {
475
- var field = this.field;
476
- if (this.editable && field && field.editableFirstPart && field.editableLastPart) {
477
- this.renderInlineWrapper(field.editableFirstPart, field.editableLastPart);
478
- }
479
- else if (field && (field.href || field.value)) {
480
- var props = field.href ? field : field.value;
481
- var linkText = field.text || field.value.text || field.href || field.value.href;
482
- var mergedAttrs = Object.assign(Object.assign({}, props), this.attrs);
483
- this.renderTemplate(mergedAttrs, linkText);
484
- }
485
- };
486
- LinkDirective.prototype.renderTemplate = function (props, linkText) {
487
- var _this = this;
488
- var viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
489
- viewRef.rootNodes.forEach(function (node) {
490
- Object.entries(props).forEach(function (_a) {
491
- var _b = __read(_a, 2), key = _b[0], propValue = _b[1];
492
- if (key === 'href') {
493
- var isInvalidLink = !propValue || /^https?:\/\/$/.test(propValue);
494
- if (isInvalidLink) {
495
- if (!node.href) {
496
- return;
497
- }
498
- propValue = node.href;
499
- }
500
- }
501
- if (key === 'class' && node.className) {
502
- propValue += " " + node.className;
503
- }
504
- _this.renderer.setAttribute(node, key, propValue);
505
- });
506
- if (node.childNodes && node.childNodes.length === 0 && linkText) {
507
- node.textContent = linkText;
508
- }
509
- });
510
- };
511
- LinkDirective.prototype.renderInlineWrapper = function (editableFirstPart, editableLastPart) {
512
- var _this = this;
513
- var span = this.renderer.createElement('span');
514
- span.className = 'sc-link-wrapper';
515
- span.innerHTML = editableFirstPart + editableLastPart;
516
- // assign attributes from template to inline wrapper
517
- var attrs = Object.assign(Object.assign({}, this.getElementAttrs()), this.attrs);
518
- Object.entries(attrs).forEach(function (_a) {
519
- var _b = __read(_a, 2), key = _b[0], attrValue = _b[1];
520
- return _this.renderer.setAttribute(span, key, attrValue);
521
- });
522
- this.viewContainer.createEmbeddedView(this.templateRef);
523
- var parentNode = this.renderer.parentNode(this.elementRef.nativeElement);
524
- this.renderer.insertBefore(parentNode, span, this.elementRef.nativeElement);
525
- this.inlineRef = span;
526
- };
527
- LinkDirective.prototype.getElementAttrs = function () {
528
- var view = this.templateRef.createEmbeddedView(null);
529
- var element = view.rootNodes[0];
530
- if (!element) {
531
- return {};
532
- }
533
- var attrs = {};
534
- for (var i = 0; i < element.attributes.length; i++) {
535
- var attr = element.attributes.item(i);
536
- if (attr) {
537
- attrs[attr.name] = attr.value;
538
- }
539
- }
540
- return attrs;
541
- };
542
- return LinkDirective;
543
- }());
544
- LinkDirective.decorators = [
545
- { type: core.Directive, args: [{ selector: '[scLink]' },] }
546
- ];
547
- LinkDirective.ctorParameters = function () { return [
548
- { type: core.ViewContainerRef },
549
- { type: core.TemplateRef },
550
- { type: core.Renderer2 },
551
- { type: core.ElementRef }
552
- ]; };
553
- LinkDirective.propDecorators = {
554
- editable: [{ type: core.Input, args: ['scLinkEditable',] }],
555
- attrs: [{ type: core.Input, args: ['scLinkAttrs',] }],
556
- field: [{ type: core.Input, args: ['scLink',] }]
449
+ var LinkDirective = /** @class */ (function () {
450
+ function LinkDirective(viewContainer, templateRef, renderer, elementRef) {
451
+ this.viewContainer = viewContainer;
452
+ this.templateRef = templateRef;
453
+ this.renderer = renderer;
454
+ this.elementRef = elementRef;
455
+ this.inlineRef = null;
456
+ this.editable = true;
457
+ this.attrs = {};
458
+ }
459
+ LinkDirective.prototype.ngOnChanges = function (changes) {
460
+ if (changes.field || changes.editable || changes.attrs) {
461
+ this.viewContainer.clear();
462
+ if (this.inlineRef) {
463
+ this.inlineRef.remove();
464
+ this.inlineRef = null;
465
+ }
466
+ this.updateView();
467
+ }
468
+ };
469
+ LinkDirective.prototype.updateView = function () {
470
+ var field = this.field;
471
+ if (this.editable && field && field.editableFirstPart && field.editableLastPart) {
472
+ this.renderInlineWrapper(field.editableFirstPart, field.editableLastPart);
473
+ }
474
+ else if (field && (field.href || field.value)) {
475
+ var props = field.href ? field : field.value;
476
+ var linkText = field.text || field.value.text || field.href || field.value.href;
477
+ var mergedAttrs = Object.assign(Object.assign({}, props), this.attrs);
478
+ this.renderTemplate(mergedAttrs, linkText);
479
+ }
480
+ };
481
+ LinkDirective.prototype.renderTemplate = function (props, linkText) {
482
+ var _this = this;
483
+ var viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
484
+ viewRef.rootNodes.forEach(function (node) {
485
+ Object.entries(props).forEach(function (_a) {
486
+ var _b = __read(_a, 2), key = _b[0], propValue = _b[1];
487
+ if (key === 'href') {
488
+ var isInvalidLink = !propValue || /^https?:\/\/$/.test(propValue);
489
+ if (isInvalidLink) {
490
+ if (!node.href) {
491
+ return;
492
+ }
493
+ propValue = node.href;
494
+ }
495
+ }
496
+ if (key === 'class' && node.className) {
497
+ propValue += " " + node.className;
498
+ }
499
+ _this.renderer.setAttribute(node, key, propValue);
500
+ });
501
+ if (node.childNodes && node.childNodes.length === 0 && linkText) {
502
+ node.textContent = linkText;
503
+ }
504
+ });
505
+ };
506
+ LinkDirective.prototype.renderInlineWrapper = function (editableFirstPart, editableLastPart) {
507
+ var _this = this;
508
+ var span = this.renderer.createElement('span');
509
+ span.className = 'sc-link-wrapper';
510
+ span.innerHTML = editableFirstPart + editableLastPart;
511
+ // assign attributes from template to inline wrapper
512
+ var attrs = Object.assign(Object.assign({}, this.getElementAttrs()), this.attrs);
513
+ Object.entries(attrs).forEach(function (_a) {
514
+ var _b = __read(_a, 2), key = _b[0], attrValue = _b[1];
515
+ return _this.renderer.setAttribute(span, key, attrValue);
516
+ });
517
+ this.viewContainer.createEmbeddedView(this.templateRef);
518
+ var parentNode = this.renderer.parentNode(this.elementRef.nativeElement);
519
+ this.renderer.insertBefore(parentNode, span, this.elementRef.nativeElement);
520
+ this.inlineRef = span;
521
+ };
522
+ LinkDirective.prototype.getElementAttrs = function () {
523
+ var view = this.templateRef.createEmbeddedView(null);
524
+ var element = view.rootNodes[0];
525
+ if (!element) {
526
+ return {};
527
+ }
528
+ var attrs = {};
529
+ for (var i = 0; i < element.attributes.length; i++) {
530
+ var attr = element.attributes.item(i);
531
+ if (attr) {
532
+ attrs[attr.name] = attr.value;
533
+ }
534
+ }
535
+ return attrs;
536
+ };
537
+ return LinkDirective;
538
+ }());
539
+ LinkDirective.decorators = [
540
+ { type: core.Directive, args: [{ selector: '[scLink]' },] }
541
+ ];
542
+ LinkDirective.ctorParameters = function () { return [
543
+ { type: core.ViewContainerRef },
544
+ { type: core.TemplateRef },
545
+ { type: core.Renderer2 },
546
+ { type: core.ElementRef }
547
+ ]; };
548
+ LinkDirective.propDecorators = {
549
+ editable: [{ type: core.Input, args: ['scLinkEditable',] }],
550
+ attrs: [{ type: core.Input, args: ['scLinkAttrs',] }],
551
+ field: [{ type: core.Input, args: ['scLink',] }]
557
552
  };
558
553
 
559
- var RouterLinkDirective = /** @class */ (function (_super) {
560
- __extends(RouterLinkDirective, _super);
561
- function RouterLinkDirective(viewContainer, templateRef, renderer, elementRef, router) {
562
- var _this = _super.call(this, viewContainer, templateRef, renderer, elementRef) || this;
563
- _this.router = router;
564
- // tslint:disable-next-line:no-input-rename
565
- _this.editable = true;
566
- // tslint:disable-next-line:no-input-rename
567
- _this.attrs = {};
568
- return _this;
569
- }
570
- RouterLinkDirective.prototype.renderTemplate = function (props, linkText) {
571
- var _this = this;
572
- var viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
573
- viewRef.rootNodes.forEach(function (node) {
574
- Object.entries(props).forEach(function (_a) {
575
- var _b = __read(_a, 2), key = _b[0], propValue = _b[1];
576
- _this.renderer.setAttribute(node, key, propValue);
577
- if (key === 'href') {
578
- _this.renderer.listen(node, 'click', function (event) {
579
- _this.router.navigate([propValue]);
580
- event.preventDefault();
581
- });
582
- }
583
- });
584
- if (node.childNodes && node.childNodes.length === 0 && linkText) {
585
- node.textContent = linkText;
586
- }
587
- });
588
- };
589
- return RouterLinkDirective;
590
- }(LinkDirective));
591
- RouterLinkDirective.decorators = [
592
- { type: core.Directive, args: [{ selector: '[scRouterLink]' },] }
593
- ];
594
- RouterLinkDirective.ctorParameters = function () { return [
595
- { type: core.ViewContainerRef },
596
- { type: core.TemplateRef },
597
- { type: core.Renderer2 },
598
- { type: core.ElementRef },
599
- { type: router.Router }
600
- ]; };
601
- RouterLinkDirective.propDecorators = {
602
- editable: [{ type: core.Input, args: ['scRouterLinkEditable',] }],
603
- attrs: [{ type: core.Input, args: ['scRouterLinkAttrs',] }],
604
- field: [{ type: core.Input, args: ['scRouterLink',] }]
554
+ var RouterLinkDirective = /** @class */ (function (_super) {
555
+ __extends(RouterLinkDirective, _super);
556
+ function RouterLinkDirective(viewContainer, templateRef, renderer, elementRef, router) {
557
+ var _this = _super.call(this, viewContainer, templateRef, renderer, elementRef) || this;
558
+ _this.router = router;
559
+ _this.editable = true;
560
+ _this.attrs = {};
561
+ return _this;
562
+ }
563
+ RouterLinkDirective.prototype.renderTemplate = function (props, linkText) {
564
+ var _this = this;
565
+ var viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
566
+ viewRef.rootNodes.forEach(function (node) {
567
+ Object.entries(props).forEach(function (_a) {
568
+ var _b = __read(_a, 2), key = _b[0], propValue = _b[1];
569
+ _this.renderer.setAttribute(node, key, propValue);
570
+ if (key === 'href') {
571
+ _this.renderer.listen(node, 'click', function (event) {
572
+ _this.router.navigate([propValue]);
573
+ event.preventDefault();
574
+ });
575
+ }
576
+ });
577
+ if (node.childNodes && node.childNodes.length === 0 && linkText) {
578
+ node.textContent = linkText;
579
+ }
580
+ });
581
+ };
582
+ return RouterLinkDirective;
583
+ }(LinkDirective));
584
+ RouterLinkDirective.decorators = [
585
+ { type: core.Directive, args: [{ selector: '[scRouterLink]' },] }
586
+ ];
587
+ RouterLinkDirective.ctorParameters = function () { return [
588
+ { type: core.ViewContainerRef },
589
+ { type: core.TemplateRef },
590
+ { type: core.Renderer2 },
591
+ { type: core.ElementRef },
592
+ { type: router.Router }
593
+ ]; };
594
+ RouterLinkDirective.propDecorators = {
595
+ editable: [{ type: core.Input, args: ['scRouterLinkEditable',] }],
596
+ attrs: [{ type: core.Input, args: ['scRouterLinkAttrs',] }],
597
+ field: [{ type: core.Input, args: ['scRouterLink',] }]
605
598
  };
606
599
 
607
- var GenericLinkDirective = /** @class */ (function (_super) {
608
- __extends(GenericLinkDirective, _super);
609
- function GenericLinkDirective(viewContainer, templateRef, renderer, elementRef, router) {
610
- var _this = _super.call(this, viewContainer, templateRef, renderer, elementRef) || this;
611
- _this.router = router;
612
- // tslint:disable-next-line:no-input-rename
613
- _this.editable = true;
614
- // tslint:disable-next-line:no-input-rename
615
- _this.attrs = {};
616
- return _this;
617
- }
618
- GenericLinkDirective.prototype.renderTemplate = function (props, linkText) {
619
- var _this = this;
620
- var viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
621
- viewRef.rootNodes.forEach(function (node) {
622
- Object.entries(props).forEach(function (_a) {
623
- var _b = __read(_a, 2), key = _b[0], propValue = _b[1];
624
- if (key === 'href' && !_this.isAbsoluteUrl(propValue)) {
625
- var urlTree = _this.router.createUrlTree([propValue], _this.extras);
626
- _this.renderer.setAttribute(node, key, _this.router.serializeUrl(urlTree));
627
- _this.renderer.listen(node, 'click', function (event) {
628
- _this.router.navigate([propValue], _this.extras);
629
- event.preventDefault();
630
- });
631
- }
632
- else {
633
- _this.renderer.setAttribute(node, key, propValue);
634
- }
635
- });
636
- if (node.childNodes && node.childNodes.length === 0 && linkText) {
637
- node.textContent = linkText;
638
- }
639
- });
640
- };
641
- GenericLinkDirective.prototype.isAbsoluteUrl = function (url) {
642
- if (url == null) {
643
- return false;
644
- }
645
- if (typeof url !== 'string') {
646
- throw new TypeError('Expected a string');
647
- }
648
- return /^[a-z][a-z0-9+.-]*:/.test(url);
649
- };
650
- return GenericLinkDirective;
651
- }(LinkDirective));
652
- GenericLinkDirective.decorators = [
653
- { type: core.Directive, args: [{ selector: '[scGenericLink]' },] }
654
- ];
655
- GenericLinkDirective.ctorParameters = function () { return [
656
- { type: core.ViewContainerRef },
657
- { type: core.TemplateRef },
658
- { type: core.Renderer2 },
659
- { type: core.ElementRef },
660
- { type: router.Router }
661
- ]; };
662
- GenericLinkDirective.propDecorators = {
663
- editable: [{ type: core.Input, args: ['scGenericLinkEditable',] }],
664
- attrs: [{ type: core.Input, args: ['scGenericLinkAttrs',] }],
665
- field: [{ type: core.Input, args: ['scGenericLink',] }],
666
- extras: [{ type: core.Input, args: ['scGenericLinkExtras',] }]
600
+ var GenericLinkDirective = /** @class */ (function (_super) {
601
+ __extends(GenericLinkDirective, _super);
602
+ function GenericLinkDirective(viewContainer, templateRef, renderer, elementRef, router) {
603
+ var _this = _super.call(this, viewContainer, templateRef, renderer, elementRef) || this;
604
+ _this.router = router;
605
+ _this.editable = true;
606
+ _this.attrs = {};
607
+ return _this;
608
+ }
609
+ GenericLinkDirective.prototype.renderTemplate = function (props, linkText) {
610
+ var _this = this;
611
+ var viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
612
+ viewRef.rootNodes.forEach(function (node) {
613
+ Object.entries(props).forEach(function (_a) {
614
+ var _b = __read(_a, 2), key = _b[0], propValue = _b[1];
615
+ if (key === 'href' && !_this.isAbsoluteUrl(propValue)) {
616
+ var urlTree = _this.router.createUrlTree([propValue], _this.extras);
617
+ _this.renderer.setAttribute(node, key, _this.router.serializeUrl(urlTree));
618
+ _this.renderer.listen(node, 'click', function (event) {
619
+ _this.router.navigate([propValue], _this.extras);
620
+ event.preventDefault();
621
+ });
622
+ }
623
+ else {
624
+ _this.renderer.setAttribute(node, key, propValue);
625
+ }
626
+ });
627
+ if (node.childNodes && node.childNodes.length === 0 && linkText) {
628
+ node.textContent = linkText;
629
+ }
630
+ });
631
+ };
632
+ GenericLinkDirective.prototype.isAbsoluteUrl = function (url) {
633
+ if (url === null) {
634
+ return false;
635
+ }
636
+ if (typeof url !== 'string') {
637
+ throw new TypeError('Expected a string');
638
+ }
639
+ return /^[a-z][a-z0-9+.-]*:/.test(url);
640
+ };
641
+ return GenericLinkDirective;
642
+ }(LinkDirective));
643
+ GenericLinkDirective.decorators = [
644
+ { type: core.Directive, args: [{ selector: '[scGenericLink]' },] }
645
+ ];
646
+ GenericLinkDirective.ctorParameters = function () { return [
647
+ { type: core.ViewContainerRef },
648
+ { type: core.TemplateRef },
649
+ { type: core.Renderer2 },
650
+ { type: core.ElementRef },
651
+ { type: router.Router }
652
+ ]; };
653
+ GenericLinkDirective.propDecorators = {
654
+ editable: [{ type: core.Input, args: ['scGenericLinkEditable',] }],
655
+ attrs: [{ type: core.Input, args: ['scGenericLinkAttrs',] }],
656
+ field: [{ type: core.Input, args: ['scGenericLink',] }],
657
+ extras: [{ type: core.Input, args: ['scGenericLinkExtras',] }]
667
658
  };
668
659
 
669
- /** Registers a statically loaded component */
670
- var ComponentNameAndType = /** @class */ (function () {
671
- function ComponentNameAndType() {
672
- }
673
- return ComponentNameAndType;
674
- }());
675
- function instanceOfComponentNameAndType(object) {
676
- return 'type' in object;
677
- }
678
- function instanceOfComponentNameAndModule(object) {
679
- return 'module' in object;
680
- }
681
- var PLACEHOLDER_COMPONENTS = new core.InjectionToken('Sc.placeholder.components');
682
- var PLACEHOLDER_LAZY_COMPONENTS = new core.InjectionToken('Sc.placeholder.lazyComponents');
683
- var PLACEHOLDER_MISSING_COMPONENT_COMPONENT = new core.InjectionToken('Sc.placeholder.missingComponentComponent');
660
+ /** Registers a statically loaded component */
661
+ var ComponentNameAndType = /** @class */ (function () {
662
+ function ComponentNameAndType() {
663
+ }
664
+ return ComponentNameAndType;
665
+ }());
666
+ /**
667
+ * @param {any} object
668
+ */
669
+ function instanceOfComponentNameAndType(object) {
670
+ return 'type' in object;
671
+ }
672
+ /**
673
+ * @param {any} object
674
+ */
675
+ function instanceOfComponentNameAndModule(object) {
676
+ return 'module' in object;
677
+ }
678
+ var PLACEHOLDER_COMPONENTS = new core.InjectionToken('Sc.placeholder.components');
679
+ var PLACEHOLDER_LAZY_COMPONENTS = new core.InjectionToken('Sc.placeholder.lazyComponents');
680
+ var PLACEHOLDER_MISSING_COMPONENT_COMPONENT = new core.InjectionToken('Sc.placeholder.missingComponentComponent');
684
681
  var DYNAMIC_COMPONENT = new core.InjectionToken('Sc.placeholder.dynamicComponent');
685
682
 
686
- var RawComponent = /** @class */ (function () {
687
- function RawComponent(renderer, elementRef) {
688
- this.renderer = renderer;
689
- this.elementRef = elementRef;
690
- }
691
- RawComponent.prototype.ngOnInit = function () {
692
- var el = this.renderer.createElement(this.rendering.name);
693
- var contents = this.renderer.createText(this.rendering.contents || '');
694
- var attributes = this.rendering.attributes;
695
- for (var attr in attributes) {
696
- if (attributes.hasOwnProperty(attr)) {
697
- var value = attributes[attr];
698
- this.renderer.setAttribute(el, attr, value || '');
699
- }
700
- }
701
- this.renderer.appendChild(el, contents);
702
- var parentNode = this.renderer.parentNode(this.elementRef.nativeElement);
703
- this.renderer.insertBefore(parentNode, el, this.elementRef.nativeElement);
704
- parentNode.removeChild(this.elementRef.nativeElement);
705
- };
706
- return RawComponent;
707
- }());
708
- RawComponent.decorators = [
709
- { type: core.Component, args: [{
710
- selector: 'sc-raw',
711
- template: ""
712
- },] }
713
- ];
714
- RawComponent.ctorParameters = function () { return [
715
- { type: core.Renderer2 },
716
- { type: core.ElementRef }
717
- ]; };
718
- RawComponent.propDecorators = {
719
- rendering: [{ type: core.Input }]
683
+ var RawComponent = /** @class */ (function () {
684
+ function RawComponent(renderer, elementRef) {
685
+ this.renderer = renderer;
686
+ this.elementRef = elementRef;
687
+ }
688
+ RawComponent.prototype.ngOnInit = function () {
689
+ var el = this.renderer.createElement(this.rendering.name);
690
+ var contents = this.renderer.createText(this.rendering.contents || '');
691
+ var attributes = this.rendering.attributes;
692
+ for (var attr in attributes) {
693
+ // eslint-disable-next-line no-prototype-builtins
694
+ if (attributes.hasOwnProperty(attr)) {
695
+ var value = attributes[attr];
696
+ this.renderer.setAttribute(el, attr, value || '');
697
+ }
698
+ }
699
+ this.renderer.appendChild(el, contents);
700
+ var parentNode = this.renderer.parentNode(this.elementRef.nativeElement);
701
+ this.renderer.insertBefore(parentNode, el, this.elementRef.nativeElement);
702
+ parentNode.removeChild(this.elementRef.nativeElement);
703
+ };
704
+ return RawComponent;
705
+ }());
706
+ RawComponent.decorators = [
707
+ { type: core.Component, args: [{
708
+ selector: 'sc-raw',
709
+ template: ''
710
+ },] }
711
+ ];
712
+ RawComponent.ctorParameters = function () { return [
713
+ { type: core.Renderer2 },
714
+ { type: core.ElementRef }
715
+ ]; };
716
+ RawComponent.propDecorators = {
717
+ rendering: [{ type: core.Input }]
720
718
  };
721
719
 
722
- function isRawRendering(rendering) {
723
- return !rendering.componentName && rendering.name !== undefined;
720
+ /**
721
+ * @param {HtmlElementRendering | ComponentRendering} rendering
722
+ */
723
+ function isRawRendering(rendering) {
724
+ return (!rendering.componentName &&
725
+ rendering.name !== undefined);
724
726
  }
725
727
 
726
- var JssComponentFactoryService = /** @class */ (function () {
727
- function JssComponentFactoryService(injector, compiler, components, lazyComponents) {
728
- var _this = this;
729
- this.injector = injector;
730
- this.compiler = compiler;
731
- this.components = components;
732
- this.lazyComponents = lazyComponents;
733
- this.componentMap = new Map();
734
- this.lazyComponentMap = new Map();
735
- this.components.forEach(function (c) { return _this.componentMap.set(c.name, c.type); });
736
- if (this.lazyComponents) {
737
- this.lazyComponents.forEach(function (c) { return _this.lazyComponentMap.set(c.path, c); });
738
- }
739
- }
740
- JssComponentFactoryService.prototype.loadModuleFactory = function (lazyComponent) {
741
- var _this = this;
742
- return lazyComponent.loadChildren().then(function (loaded) {
743
- if (loaded instanceof core.NgModuleFactory) {
744
- return loaded;
745
- }
746
- else {
747
- return _this.compiler.compileModuleAsync(loaded);
748
- }
749
- });
750
- };
751
- JssComponentFactoryService.prototype.getComponent = function (component) {
752
- var _this = this;
753
- var loadedComponent = this.componentMap.get(component.componentName);
754
- if (loadedComponent) {
755
- return Promise.resolve({
756
- componentDefinition: component,
757
- componentImplementation: this.componentMap.get(component.componentName),
758
- });
759
- }
760
- var lazyComponent = this.lazyComponentMap.get(component.componentName);
761
- if (lazyComponent) {
762
- return this.loadModuleFactory(lazyComponent)
763
- .then(function (ngModuleFactory) {
764
- var componentType = null;
765
- var moduleRef = ngModuleFactory.create(_this.injector);
766
- var dynamicComponentType = moduleRef.injector.get(DYNAMIC_COMPONENT);
767
- if (!dynamicComponentType) {
768
- throw new Error(
769
- // tslint:disable-next-line:max-line-length
770
- "JssComponentFactoryService: Lazy load module for component \"" + lazyComponent.path + "\" missing DYNAMIC_COMPONENT provider. Missing JssModule.forChild()?");
771
- }
772
- if (component.componentName in dynamicComponentType) {
773
- componentType = dynamicComponentType[component.componentName];
774
- }
775
- else {
776
- if (typeof dynamicComponentType === 'function') {
777
- componentType = dynamicComponentType;
778
- }
779
- else {
780
- throw new Error(
781
- // tslint:disable-next-line:max-line-length
782
- "JssComponentFactoryService: Lazy load module for component \"" + lazyComponent.path + "\" missing DYNAMIC_COMPONENT provider. Missing JssModule.forChild()?");
783
- }
784
- }
785
- return {
786
- componentDefinition: component,
787
- componentImplementation: componentType,
788
- componentFactory: moduleRef.componentFactoryResolver.resolveComponentFactory(componentType),
789
- };
790
- });
791
- }
792
- return Promise.resolve({
793
- componentDefinition: component,
794
- });
795
- };
796
- JssComponentFactoryService.prototype.getComponents = function (components) {
797
- var _this = this;
798
- // acquire all components and keep them in order while handling their potential async-ness
799
- return Promise.all(components.map(function (component) { return isRawRendering(component)
800
- ? _this.getRawComponent(component)
801
- : _this.getComponent(component); }));
802
- };
803
- JssComponentFactoryService.prototype.getRawComponent = function (component) {
804
- return Promise.resolve({
805
- componentImplementation: RawComponent,
806
- componentDefinition: component,
807
- });
808
- };
809
- return JssComponentFactoryService;
810
- }());
811
- JssComponentFactoryService.decorators = [
812
- { type: core.Injectable }
813
- ];
814
- JssComponentFactoryService.ctorParameters = function () { return [
815
- { type: core.Injector },
816
- { type: core.Compiler },
817
- { type: Array, decorators: [{ type: core.Inject, args: [PLACEHOLDER_COMPONENTS,] }] },
818
- { type: Array, decorators: [{ type: core.Inject, args: [PLACEHOLDER_LAZY_COMPONENTS,] }] }
728
+ var JssComponentFactoryService = /** @class */ (function () {
729
+ function JssComponentFactoryService(injector, compiler, components, lazyComponents) {
730
+ var _this = this;
731
+ this.injector = injector;
732
+ this.compiler = compiler;
733
+ this.components = components;
734
+ this.lazyComponents = lazyComponents;
735
+ this.componentMap = new Map();
736
+ this.lazyComponentMap = new Map();
737
+ this.components.forEach(function (c) { return _this.componentMap.set(c.name, c.type); });
738
+ if (this.lazyComponents) {
739
+ this.lazyComponents.forEach(function (c) { return _this.lazyComponentMap.set(c.path, c); });
740
+ }
741
+ }
742
+ JssComponentFactoryService.prototype.loadModuleFactory = function (lazyComponent) {
743
+ var _this = this;
744
+ return lazyComponent.loadChildren().then(function (loaded) {
745
+ if (loaded instanceof core.NgModuleFactory) {
746
+ return loaded;
747
+ }
748
+ else {
749
+ return _this.compiler.compileModuleAsync(loaded);
750
+ }
751
+ });
752
+ };
753
+ JssComponentFactoryService.prototype.getComponent = function (component) {
754
+ var _this = this;
755
+ var loadedComponent = this.componentMap.get(component.componentName);
756
+ if (loadedComponent) {
757
+ return Promise.resolve({
758
+ componentDefinition: component,
759
+ componentImplementation: this.componentMap.get(component.componentName),
760
+ });
761
+ }
762
+ var lazyComponent = this.lazyComponentMap.get(component.componentName);
763
+ if (lazyComponent) {
764
+ return this.loadModuleFactory(lazyComponent).then(function (ngModuleFactory) {
765
+ var componentType = null;
766
+ var moduleRef = ngModuleFactory.create(_this.injector);
767
+ var dynamicComponentType = moduleRef.injector.get(DYNAMIC_COMPONENT);
768
+ if (!dynamicComponentType) {
769
+ throw new Error("JssComponentFactoryService: Lazy load module for component \"" + lazyComponent.path + "\" missing DYNAMIC_COMPONENT provider. Missing JssModule.forChild()?");
770
+ }
771
+ if (component.componentName in dynamicComponentType) {
772
+ componentType = dynamicComponentType[component.componentName];
773
+ }
774
+ else {
775
+ if (typeof dynamicComponentType === 'function') {
776
+ componentType = dynamicComponentType;
777
+ }
778
+ else {
779
+ throw new Error("JssComponentFactoryService: Lazy load module for component \"" + lazyComponent.path + "\" missing DYNAMIC_COMPONENT provider. Missing JssModule.forChild()?");
780
+ }
781
+ }
782
+ return {
783
+ componentDefinition: component,
784
+ componentImplementation: componentType,
785
+ componentFactory: moduleRef.componentFactoryResolver.resolveComponentFactory(componentType),
786
+ };
787
+ });
788
+ }
789
+ return Promise.resolve({
790
+ componentDefinition: component,
791
+ });
792
+ };
793
+ JssComponentFactoryService.prototype.getComponents = function (components) {
794
+ var _this = this;
795
+ // acquire all components and keep them in order while handling their potential async-ness
796
+ return Promise.all(components.map(function (component) { return isRawRendering(component) ? _this.getRawComponent(component) : _this.getComponent(component); }));
797
+ };
798
+ JssComponentFactoryService.prototype.getRawComponent = function (component) {
799
+ return Promise.resolve({
800
+ componentImplementation: RawComponent,
801
+ componentDefinition: component,
802
+ });
803
+ };
804
+ return JssComponentFactoryService;
805
+ }());
806
+ JssComponentFactoryService.decorators = [
807
+ { type: core.Injectable }
808
+ ];
809
+ JssComponentFactoryService.ctorParameters = function () { return [
810
+ { type: core.Injector },
811
+ { type: core.Compiler },
812
+ { type: Array, decorators: [{ type: core.Inject, args: [PLACEHOLDER_COMPONENTS,] }] },
813
+ { type: Array, decorators: [{ type: core.Inject, args: [PLACEHOLDER_LAZY_COMPONENTS,] }] }
819
814
  ]; };
820
815
 
821
- var PlaceholderLoadingDirective = /** @class */ (function () {
822
- function PlaceholderLoadingDirective(templateRef) {
823
- this.templateRef = templateRef;
824
- }
825
- return PlaceholderLoadingDirective;
826
- }());
827
- PlaceholderLoadingDirective.decorators = [
828
- { type: core.Directive, args: [{
829
- selector: '[scPlaceholderLoading]',
830
- },] }
831
- ];
832
- PlaceholderLoadingDirective.ctorParameters = function () { return [
833
- { type: core.TemplateRef }
816
+ var PlaceholderLoadingDirective = /** @class */ (function () {
817
+ function PlaceholderLoadingDirective(templateRef) {
818
+ this.templateRef = templateRef;
819
+ }
820
+ return PlaceholderLoadingDirective;
821
+ }());
822
+ PlaceholderLoadingDirective.decorators = [
823
+ { type: core.Directive, args: [{
824
+ selector: '[scPlaceholderLoading]',
825
+ },] }
826
+ ];
827
+ PlaceholderLoadingDirective.ctorParameters = function () { return [
828
+ { type: core.TemplateRef }
834
829
  ]; };
835
830
 
836
- var RenderEachDirective = /** @class */ (function () {
837
- function RenderEachDirective(templateRef) {
838
- this.templateRef = templateRef;
839
- }
840
- return RenderEachDirective;
841
- }());
842
- RenderEachDirective.decorators = [
843
- { type: core.Directive, args: [{
844
- // tslint:disable-next-line:directive-selector
845
- selector: '[renderEach]',
846
- },] }
847
- ];
848
- RenderEachDirective.ctorParameters = function () { return [
849
- { type: core.TemplateRef }
831
+ var RenderEachDirective = /** @class */ (function () {
832
+ function RenderEachDirective(templateRef) {
833
+ this.templateRef = templateRef;
834
+ }
835
+ return RenderEachDirective;
836
+ }());
837
+ RenderEachDirective.decorators = [
838
+ { type: core.Directive, args: [{
839
+ selector: '[renderEach]',
840
+ },] }
841
+ ];
842
+ RenderEachDirective.ctorParameters = function () { return [
843
+ { type: core.TemplateRef }
850
844
  ]; };
851
845
 
852
- var RenderEmptyDirective = /** @class */ (function () {
853
- function RenderEmptyDirective(templateRef) {
854
- this.templateRef = templateRef;
855
- }
856
- return RenderEmptyDirective;
857
- }());
858
- RenderEmptyDirective.decorators = [
859
- { type: core.Directive, args: [{
860
- // tslint:disable-next-line:directive-selector
861
- selector: '[renderEmpty]',
862
- },] }
863
- ];
864
- RenderEmptyDirective.ctorParameters = function () { return [
865
- { type: core.TemplateRef }
846
+ var RenderEmptyDirective = /** @class */ (function () {
847
+ function RenderEmptyDirective(templateRef) {
848
+ this.templateRef = templateRef;
849
+ }
850
+ return RenderEmptyDirective;
851
+ }());
852
+ RenderEmptyDirective.decorators = [
853
+ { type: core.Directive, args: [{
854
+ selector: '[renderEmpty]',
855
+ },] }
856
+ ];
857
+ RenderEmptyDirective.ctorParameters = function () { return [
858
+ { type: core.TemplateRef }
866
859
  ]; };
867
860
 
868
- function getPlaceholder(rendering, name) {
869
- if (rendering && rendering.placeholders && Object.keys(rendering.placeholders).length > 0) {
870
- return rendering.placeholders[name];
871
- }
872
- return null;
873
- }
874
- var PlaceholderComponent = /** @class */ (function () {
875
- function PlaceholderComponent(componentFactoryResolver, differs, componentFactory, changeDetectorRef, elementRef, renderer, missingComponentComponent) {
876
- this.componentFactoryResolver = componentFactoryResolver;
877
- this.differs = differs;
878
- this.componentFactory = componentFactory;
879
- this.changeDetectorRef = changeDetectorRef;
880
- this.elementRef = elementRef;
881
- this.renderer = renderer;
882
- this.missingComponentComponent = missingComponentComponent;
883
- this._componentInstances = [];
884
- this.destroyed = false;
885
- this.parentStyleAttribute = '';
886
- this.isLoading = true;
887
- this.loaded = new core.EventEmitter();
888
- }
889
- Object.defineProperty(PlaceholderComponent.prototype, "inputs", {
890
- set: function (value) {
891
- this._inputs = value;
892
- if (!this._differ && value) {
893
- this._differ = this.differs.find(value).create();
894
- }
895
- },
896
- enumerable: false,
897
- configurable: true
898
- });
899
- PlaceholderComponent.prototype.ngOnInit = function () {
900
- // just to ensure the element exists
901
- var elem = this.elementRef.nativeElement;
902
- if (elem) {
903
- var attributes = elem.attributes;
904
- for (var i = 0; i < attributes.length; i++) {
905
- var attr = attributes.item(i);
906
- if (attr && attr.name.indexOf('_ngcontent') !== -1) {
907
- this.parentStyleAttribute = attr.name;
908
- }
909
- }
910
- }
911
- };
912
- PlaceholderComponent.prototype.ngOnDestroy = function () {
913
- this.destroyed = true;
914
- this._componentInstances = [];
915
- };
916
- PlaceholderComponent.prototype.ngOnChanges = function (changes) {
917
- if (changes['rendering'] || changes['renderings']) {
918
- this._render();
919
- }
920
- };
921
- PlaceholderComponent.prototype.ngDoCheck = function () {
922
- var _this = this;
923
- if (!this._differ || !this._inputs || this._componentInstances.length === 0) {
924
- return;
925
- }
926
- var changes = this._differ.diff(this._inputs);
927
- if (!changes) {
928
- return;
929
- }
930
- var updates = {};
931
- changes.forEachRemovedItem(function (change) { return updates[change.key] = null; });
932
- changes.forEachAddedItem(function (change) { return updates[change.key] = change.currentValue; });
933
- changes.forEachChangedItem(function (change) { return updates[change.key] = change.currentValue; });
934
- this._componentInstances.forEach(function (componentInstance) { return _this._setComponentInputs(componentInstance, updates); });
935
- };
936
- PlaceholderComponent.prototype._setComponentInputs = function (componentInstance, inputs) {
937
- Object.entries(inputs).forEach(function (_a) {
938
- var _b = __read(_a, 2), input = _b[0], inputValue = _b[1];
939
- return componentInstance[input] = inputValue;
940
- });
941
- };
942
- PlaceholderComponent.prototype._subscribeComponentOutputs = function (componentInstance, outputs) {
943
- var _this = this;
944
- Object.keys(outputs)
945
- .filter(function (output) { return componentInstance[output] && componentInstance[output] instanceof rxjs.Observable; })
946
- .forEach(function (output) { return componentInstance[output]
947
- .pipe(operators.takeWhile(function () { return !_this.destroyed; }))
948
- .subscribe(outputs[output]); });
949
- };
950
- PlaceholderComponent.prototype._render = function () {
951
- var _this = this;
952
- this._componentInstances = [];
953
- this.view.clear();
954
- if (!this.rendering && !this.renderings) {
955
- return;
956
- }
957
- if (!this.name && !this.renderings) {
958
- // tslint:disable-next-line:max-line-length
959
- console.warn("Placeholder name was not specified, and explicit renderings array was not passed. Placeholder requires either name and rendering, or renderings.");
960
- this.isLoading = false;
961
- return;
962
- }
963
- var placeholder = this.renderings || getPlaceholder(this.rendering, this.name || '');
964
- if (!placeholder) {
965
- console.warn("Placeholder '" + this.name + "' was not found in the current rendering data", JSON.stringify(this.rendering, null, 2));
966
- this.isLoading = false;
967
- return;
968
- }
969
- // if the placeholder is empty (contains only raw renderings), then we may need to use the empty template if it's defined
970
- var placeholderIsEmpty = placeholder.every(function (rendering) { return isRawRendering(rendering); });
971
- if (this.renderEmptyTemplate && placeholderIsEmpty) {
972
- this.view.createEmbeddedView(this.renderEmptyTemplate.templateRef, {
973
- renderings: placeholder,
974
- });
975
- this.isLoading = false;
976
- }
977
- else {
978
- this.componentFactory.getComponents(placeholder)
979
- .then(function (components) { return components.forEach(function (rendering, index) {
980
- if (_this.renderEachTemplate && !isRawRendering(rendering.componentDefinition)) {
981
- _this._renderTemplatedComponent(rendering.componentDefinition, index);
982
- }
983
- else {
984
- _this._renderEmbeddedComponent(rendering, index);
985
- }
986
- _this.isLoading = false;
987
- }); }).then(function () {
988
- _this.changeDetectorRef.markForCheck();
989
- _this.loaded.emit(_this.name);
990
- });
991
- }
992
- };
993
- PlaceholderComponent.prototype._renderTemplatedComponent = function (rendering, index) {
994
- // the render-each template takes care of all component mapping etc
995
- // generally using <sc-render-component> which is about like _renderEmbeddedComponent()
996
- // as a separate component
997
- this.view.createEmbeddedView(this.renderEachTemplate.templateRef, {
998
- rendering: rendering,
999
- index: index,
1000
- });
1001
- };
1002
- PlaceholderComponent.prototype._renderEmbeddedComponent = function (rendering, index) {
1003
- if (!rendering.componentImplementation) {
1004
- var componentName = rendering.componentDefinition.componentName;
1005
- console.error("Placeholder " + this.name + " contains unknown component " + componentName + ".", "Ensure component is mapped, like:\n JssModule.withComponents([\n { name: '" + componentName + "', type: " + componentName + "Component }\n ])");
1006
- rendering.componentImplementation = this.missingComponentComponent;
1007
- }
1008
- var componentFactory = rendering.componentFactory || this.componentFactoryResolver.resolveComponentFactory(rendering.componentImplementation);
1009
- // apply the parent style attribute _ngcontent
1010
- // work-around for https://github.com/angular/angular/issues/12215
1011
- var createdComponentRef = this.view.createComponent(componentFactory, index);
1012
- if (this.parentStyleAttribute) {
1013
- this.renderer.setAttribute(createdComponentRef.location.nativeElement, this.parentStyleAttribute, '');
1014
- }
1015
- var componentInstance = createdComponentRef.instance;
1016
- componentInstance.rendering = rendering.componentDefinition;
1017
- if (this._inputs) {
1018
- this._setComponentInputs(componentInstance, this._inputs);
1019
- }
1020
- if (this.outputs) {
1021
- this._subscribeComponentOutputs(componentInstance, this.outputs);
1022
- }
1023
- this._componentInstances.push(componentInstance);
1024
- };
1025
- return PlaceholderComponent;
1026
- }());
1027
- PlaceholderComponent.decorators = [
1028
- { type: core.Component, args: [{
1029
- selector: 'sc-placeholder,[sc-placeholder]',
1030
- template: "\n <ng-template *ngIf=\"isLoading\" [ngTemplateOutlet]=\"placeholderLoading?.templateRef\"></ng-template>\n <ng-template #view></ng-template>\n "
1031
- },] }
1032
- ];
1033
- PlaceholderComponent.ctorParameters = function () { return [
1034
- { type: core.ComponentFactoryResolver },
1035
- { type: core.KeyValueDiffers },
1036
- { type: JssComponentFactoryService },
1037
- { type: core.ChangeDetectorRef },
1038
- { type: core.ElementRef },
1039
- { type: core.Renderer2 },
1040
- { type: core.Type, decorators: [{ type: core.Inject, args: [PLACEHOLDER_MISSING_COMPONENT_COMPONENT,] }] }
1041
- ]; };
1042
- PlaceholderComponent.propDecorators = {
1043
- name: [{ type: core.Input }],
1044
- rendering: [{ type: core.Input }],
1045
- renderings: [{ type: core.Input }],
1046
- outputs: [{ type: core.Input }],
1047
- loaded: [{ type: core.Output }],
1048
- view: [{ type: core.ViewChild, args: ['view', { read: core.ViewContainerRef, static: true },] }],
1049
- renderEachTemplate: [{ type: core.ContentChild, args: [RenderEachDirective, { static: true },] }],
1050
- renderEmptyTemplate: [{ type: core.ContentChild, args: [RenderEmptyDirective, { static: true },] }],
1051
- placeholderLoading: [{ type: core.ContentChild, args: [PlaceholderLoadingDirective, { static: true },] }],
1052
- inputs: [{ type: core.Input }]
861
+ /**
862
+ * @param {ComponentRendering} rendering
863
+ * @param {string} name
864
+ */
865
+ function getPlaceholder(rendering, name) {
866
+ if (rendering && rendering.placeholders && Object.keys(rendering.placeholders).length > 0) {
867
+ return rendering.placeholders[name];
868
+ }
869
+ return null;
870
+ }
871
+ var PlaceholderComponent = /** @class */ (function () {
872
+ function PlaceholderComponent(componentFactoryResolver, differs, componentFactory, changeDetectorRef, elementRef, renderer, missingComponentComponent) {
873
+ this.componentFactoryResolver = componentFactoryResolver;
874
+ this.differs = differs;
875
+ this.componentFactory = componentFactory;
876
+ this.changeDetectorRef = changeDetectorRef;
877
+ this.elementRef = elementRef;
878
+ this.renderer = renderer;
879
+ this.missingComponentComponent = missingComponentComponent;
880
+ this._componentInstances = [];
881
+ this.destroyed = false;
882
+ this.parentStyleAttribute = '';
883
+ this.isLoading = true;
884
+ this.loaded = new core.EventEmitter();
885
+ }
886
+ Object.defineProperty(PlaceholderComponent.prototype, "inputs", {
887
+ set: function (value) {
888
+ this._inputs = value;
889
+ if (!this._differ && value) {
890
+ this._differ = this.differs.find(value).create();
891
+ }
892
+ },
893
+ enumerable: false,
894
+ configurable: true
895
+ });
896
+ PlaceholderComponent.prototype.ngOnInit = function () {
897
+ // just to ensure the element exists
898
+ var elem = this.elementRef.nativeElement;
899
+ if (elem) {
900
+ var attributes = elem.attributes;
901
+ for (var i = 0; i < attributes.length; i++) {
902
+ var attr = attributes.item(i);
903
+ if (attr && attr.name.indexOf('_ngcontent') !== -1) {
904
+ this.parentStyleAttribute = attr.name;
905
+ }
906
+ }
907
+ }
908
+ };
909
+ PlaceholderComponent.prototype.ngOnDestroy = function () {
910
+ this.destroyed = true;
911
+ this._componentInstances = [];
912
+ };
913
+ PlaceholderComponent.prototype.ngOnChanges = function (changes) {
914
+ if (changes.rendering || changes.renderings) {
915
+ this._render();
916
+ }
917
+ };
918
+ PlaceholderComponent.prototype.ngDoCheck = function () {
919
+ var _this = this;
920
+ if (!this._differ || !this._inputs || this._componentInstances.length === 0) {
921
+ return;
922
+ }
923
+ var changes = this._differ.diff(this._inputs);
924
+ if (!changes) {
925
+ return;
926
+ }
927
+ var updates = {};
928
+ changes.forEachRemovedItem(function (change) { return (updates[change.key] = null); });
929
+ changes.forEachAddedItem(function (change) { return (updates[change.key] = change.currentValue); });
930
+ changes.forEachChangedItem(function (change) { return (updates[change.key] = change.currentValue); });
931
+ this._componentInstances.forEach(function (componentInstance) { return _this._setComponentInputs(componentInstance, updates); });
932
+ };
933
+ PlaceholderComponent.prototype._setComponentInputs = function (componentInstance, inputs) {
934
+ Object.entries(inputs).forEach(function (_a) {
935
+ var _b = __read(_a, 2), input = _b[0], inputValue = _b[1];
936
+ return (componentInstance[input] = inputValue);
937
+ });
938
+ };
939
+ PlaceholderComponent.prototype._subscribeComponentOutputs = function (componentInstance, outputs) {
940
+ var _this = this;
941
+ Object.keys(outputs)
942
+ .filter(function (output) { return componentInstance[output] && componentInstance[output] instanceof rxjs.Observable; })
943
+ .forEach(function (output) { return componentInstance[output]
944
+ .pipe(operators.takeWhile(function () { return !_this.destroyed; }))
945
+ .subscribe(outputs[output]); });
946
+ };
947
+ PlaceholderComponent.prototype._render = function () {
948
+ var _this = this;
949
+ this._componentInstances = [];
950
+ this.view.clear();
951
+ if (!this.rendering && !this.renderings) {
952
+ return;
953
+ }
954
+ if (!this.name && !this.renderings) {
955
+ console.warn('Placeholder name was not specified, and explicit renderings array was not passed. Placeholder requires either name and rendering, or renderings.');
956
+ this.isLoading = false;
957
+ return;
958
+ }
959
+ var placeholder = this.renderings || getPlaceholder(this.rendering, this.name || '');
960
+ if (!placeholder) {
961
+ console.warn("Placeholder '" + this.name + "' was not found in the current rendering data", JSON.stringify(this.rendering, null, 2));
962
+ this.isLoading = false;
963
+ return;
964
+ }
965
+ // if the placeholder is empty (contains only raw renderings), then we may need to use the empty template if it's defined
966
+ var placeholderIsEmpty = placeholder.every(function (rendering) { return isRawRendering(rendering); });
967
+ if (this.renderEmptyTemplate && placeholderIsEmpty) {
968
+ this.view.createEmbeddedView(this.renderEmptyTemplate.templateRef, {
969
+ renderings: placeholder,
970
+ });
971
+ this.isLoading = false;
972
+ }
973
+ else {
974
+ this.componentFactory
975
+ .getComponents(placeholder)
976
+ .then(function (components) { return components.forEach(function (rendering, index) {
977
+ if (_this.renderEachTemplate && !isRawRendering(rendering.componentDefinition)) {
978
+ _this._renderTemplatedComponent(rendering.componentDefinition, index);
979
+ }
980
+ else {
981
+ _this._renderEmbeddedComponent(rendering, index);
982
+ }
983
+ _this.isLoading = false;
984
+ }); })
985
+ .then(function () {
986
+ _this.changeDetectorRef.markForCheck();
987
+ _this.loaded.emit(_this.name);
988
+ });
989
+ }
990
+ };
991
+ PlaceholderComponent.prototype._renderTemplatedComponent = function (rendering, index) {
992
+ // the render-each template takes care of all component mapping etc
993
+ // generally using <sc-render-component> which is about like _renderEmbeddedComponent()
994
+ // as a separate component
995
+ this.view.createEmbeddedView(this.renderEachTemplate.templateRef, {
996
+ rendering: rendering,
997
+ index: index,
998
+ });
999
+ };
1000
+ PlaceholderComponent.prototype._renderEmbeddedComponent = function (rendering, index) {
1001
+ if (!rendering.componentImplementation) {
1002
+ var componentName = rendering.componentDefinition.componentName;
1003
+ console.error("Placeholder " + this.name + " contains unknown component " + componentName + ".", "Ensure component is mapped, like:\n JssModule.withComponents([\n { name: '" + componentName + "', type: " + componentName + "Component }\n ])");
1004
+ rendering.componentImplementation = this.missingComponentComponent;
1005
+ }
1006
+ var componentFactory = rendering.componentFactory ||
1007
+ this.componentFactoryResolver.resolveComponentFactory(rendering.componentImplementation);
1008
+ // apply the parent style attribute _ngcontent
1009
+ // work-around for https://github.com/angular/angular/issues/12215
1010
+ var createdComponentRef = this.view.createComponent(componentFactory, index);
1011
+ if (this.parentStyleAttribute) {
1012
+ this.renderer.setAttribute(createdComponentRef.location.nativeElement, this.parentStyleAttribute, '');
1013
+ }
1014
+ var componentInstance = createdComponentRef.instance;
1015
+ componentInstance.rendering = rendering.componentDefinition;
1016
+ if (this._inputs) {
1017
+ this._setComponentInputs(componentInstance, this._inputs);
1018
+ }
1019
+ if (this.outputs) {
1020
+ this._subscribeComponentOutputs(componentInstance, this.outputs);
1021
+ }
1022
+ this._componentInstances.push(componentInstance);
1023
+ };
1024
+ return PlaceholderComponent;
1025
+ }());
1026
+ PlaceholderComponent.decorators = [
1027
+ { type: core.Component, args: [{
1028
+ selector: 'sc-placeholder,[sc-placeholder]',
1029
+ template: "\n <ng-template\n *ngIf=\"isLoading\"\n [ngTemplateOutlet]=\"placeholderLoading?.templateRef\"\n ></ng-template>\n <ng-template #view></ng-template>\n "
1030
+ },] }
1031
+ ];
1032
+ PlaceholderComponent.ctorParameters = function () { return [
1033
+ { type: core.ComponentFactoryResolver },
1034
+ { type: core.KeyValueDiffers },
1035
+ { type: JssComponentFactoryService },
1036
+ { type: core.ChangeDetectorRef },
1037
+ { type: core.ElementRef },
1038
+ { type: core.Renderer2 },
1039
+ { type: core.Type, decorators: [{ type: core.Inject, args: [PLACEHOLDER_MISSING_COMPONENT_COMPONENT,] }] }
1040
+ ]; };
1041
+ PlaceholderComponent.propDecorators = {
1042
+ name: [{ type: core.Input }],
1043
+ rendering: [{ type: core.Input }],
1044
+ renderings: [{ type: core.Input }],
1045
+ outputs: [{ type: core.Input }],
1046
+ loaded: [{ type: core.Output }],
1047
+ view: [{ type: core.ViewChild, args: ['view', { read: core.ViewContainerRef, static: true },] }],
1048
+ renderEachTemplate: [{ type: core.ContentChild, args: [RenderEachDirective, { static: true },] }],
1049
+ renderEmptyTemplate: [{ type: core.ContentChild, args: [RenderEmptyDirective, { static: true },] }],
1050
+ placeholderLoading: [{ type: core.ContentChild, args: [PlaceholderLoadingDirective, { static: true },] }],
1051
+ inputs: [{ type: core.Input }]
1053
1052
  };
1054
1053
 
1055
- var RichTextDirective = /** @class */ (function () {
1056
- function RichTextDirective(viewContainer, templateRef) {
1057
- this.viewContainer = viewContainer;
1058
- this.templateRef = templateRef;
1059
- // tslint:disable-next-line:no-input-rename
1060
- this.editable = true;
1061
- }
1062
- RichTextDirective.prototype.ngOnChanges = function (changes) {
1063
- if (changes['field'] || changes['editable']) {
1064
- if (!this.viewRef) {
1065
- this.viewContainer.clear();
1066
- this.viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
1067
- }
1068
- this.updateView();
1069
- }
1070
- };
1071
- RichTextDirective.prototype.updateView = function () {
1072
- var field = this.field;
1073
- if (!field || (!field.editable && !field.value)) {
1074
- return;
1075
- }
1076
- var html = (field.editable && this.editable ? field.editable : field.value);
1077
- this.viewRef.rootNodes.forEach(function (node) {
1078
- node.innerHTML = html;
1079
- });
1080
- };
1081
- return RichTextDirective;
1082
- }());
1083
- RichTextDirective.decorators = [
1084
- { type: core.Directive, args: [{
1085
- selector: '[scRichText]',
1086
- },] }
1087
- ];
1088
- RichTextDirective.ctorParameters = function () { return [
1089
- { type: core.ViewContainerRef },
1090
- { type: core.TemplateRef }
1091
- ]; };
1092
- RichTextDirective.propDecorators = {
1093
- editable: [{ type: core.Input, args: ['scRichTextEditable',] }],
1094
- field: [{ type: core.Input, args: ['scRichText',] }]
1054
+ var RichTextDirective = /** @class */ (function () {
1055
+ function RichTextDirective(viewContainer, templateRef) {
1056
+ this.viewContainer = viewContainer;
1057
+ this.templateRef = templateRef;
1058
+ this.editable = true;
1059
+ }
1060
+ RichTextDirective.prototype.ngOnChanges = function (changes) {
1061
+ if (changes.field || changes.editable) {
1062
+ if (!this.viewRef) {
1063
+ this.viewContainer.clear();
1064
+ this.viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
1065
+ }
1066
+ this.updateView();
1067
+ }
1068
+ };
1069
+ RichTextDirective.prototype.updateView = function () {
1070
+ var field = this.field;
1071
+ if (!field || (!field.editable && !field.value)) {
1072
+ return;
1073
+ }
1074
+ var html = field.editable && this.editable ? field.editable : field.value;
1075
+ this.viewRef.rootNodes.forEach(function (node) {
1076
+ node.innerHTML = html;
1077
+ });
1078
+ };
1079
+ return RichTextDirective;
1080
+ }());
1081
+ RichTextDirective.decorators = [
1082
+ { type: core.Directive, args: [{
1083
+ selector: '[scRichText]',
1084
+ },] }
1085
+ ];
1086
+ RichTextDirective.ctorParameters = function () { return [
1087
+ { type: core.ViewContainerRef },
1088
+ { type: core.TemplateRef }
1089
+ ]; };
1090
+ RichTextDirective.propDecorators = {
1091
+ editable: [{ type: core.Input, args: ['scRichTextEditable',] }],
1092
+ field: [{ type: core.Input, args: ['scRichText',] }]
1095
1093
  };
1096
1094
 
1097
- var TextDirective = /** @class */ (function () {
1098
- function TextDirective(viewContainer, templateRef) {
1099
- this.viewContainer = viewContainer;
1100
- this.templateRef = templateRef;
1101
- // tslint:disable-next-line:no-input-rename
1102
- this.editable = true;
1103
- // tslint:disable-next-line:no-input-rename
1104
- this.encode = true;
1105
- }
1106
- TextDirective.prototype.ngOnChanges = function (changes) {
1107
- if (changes['field'] || changes['editable'] || changes['encode']) {
1108
- if (!this.viewRef) {
1109
- this.viewContainer.clear();
1110
- this.viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
1111
- }
1112
- this.updateView();
1113
- }
1114
- };
1115
- TextDirective.prototype.updateView = function () {
1116
- var field = this.field;
1117
- var editable = this.editable;
1118
- if (!field || (!field.editable && !field.value)) {
1119
- return;
1120
- }
1121
- // can't use editable value if we want to output unencoded
1122
- if (!this.encode) {
1123
- editable = false;
1124
- }
1125
- var html = field.editable && editable ? field.editable : field.value;
1126
- var setDangerously = field.editable && editable || !this.encode;
1127
- this.viewRef.rootNodes.forEach(function (node) {
1128
- if (setDangerously) {
1129
- node.innerHTML = html;
1130
- }
1131
- else {
1132
- node.textContent = html;
1133
- }
1134
- });
1135
- };
1136
- return TextDirective;
1137
- }());
1138
- TextDirective.decorators = [
1139
- { type: core.Directive, args: [{
1140
- selector: '[scText]',
1141
- },] }
1142
- ];
1143
- TextDirective.ctorParameters = function () { return [
1144
- { type: core.ViewContainerRef },
1145
- { type: core.TemplateRef }
1146
- ]; };
1147
- TextDirective.propDecorators = {
1148
- editable: [{ type: core.Input, args: ['scTextEditable',] }],
1149
- encode: [{ type: core.Input, args: ['scTextEncode',] }],
1150
- field: [{ type: core.Input, args: ['scText',] }]
1095
+ var TextDirective = /** @class */ (function () {
1096
+ function TextDirective(viewContainer, templateRef) {
1097
+ this.viewContainer = viewContainer;
1098
+ this.templateRef = templateRef;
1099
+ this.editable = true;
1100
+ this.encode = true;
1101
+ }
1102
+ TextDirective.prototype.ngOnChanges = function (changes) {
1103
+ if (changes.field || changes.editable || changes.encode) {
1104
+ if (!this.viewRef) {
1105
+ this.viewContainer.clear();
1106
+ this.viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
1107
+ }
1108
+ this.updateView();
1109
+ }
1110
+ };
1111
+ TextDirective.prototype.updateView = function () {
1112
+ var field = this.field;
1113
+ var editable = this.editable;
1114
+ if (!field || (!field.editable && !field.value)) {
1115
+ return;
1116
+ }
1117
+ // can't use editable value if we want to output unencoded
1118
+ if (!this.encode) {
1119
+ editable = false;
1120
+ }
1121
+ var html = field.editable && editable ? field.editable : field.value;
1122
+ var setDangerously = (field.editable && editable) || !this.encode;
1123
+ this.viewRef.rootNodes.forEach(function (node) {
1124
+ if (setDangerously) {
1125
+ node.innerHTML = html;
1126
+ }
1127
+ else {
1128
+ node.textContent = html;
1129
+ }
1130
+ });
1131
+ };
1132
+ return TextDirective;
1133
+ }());
1134
+ TextDirective.decorators = [
1135
+ { type: core.Directive, args: [{
1136
+ selector: '[scText]',
1137
+ },] }
1138
+ ];
1139
+ TextDirective.ctorParameters = function () { return [
1140
+ { type: core.ViewContainerRef },
1141
+ { type: core.TemplateRef }
1142
+ ]; };
1143
+ TextDirective.propDecorators = {
1144
+ editable: [{ type: core.Input, args: ['scTextEditable',] }],
1145
+ encode: [{ type: core.Input, args: ['scTextEncode',] }],
1146
+ field: [{ type: core.Input, args: ['scText',] }]
1151
1147
  };
1152
1148
 
1153
- var LayoutServiceError = /** @class */ (function () {
1154
- function LayoutServiceError() {
1155
- }
1156
- return LayoutServiceError;
1149
+ var LayoutServiceError = /** @class */ (function () {
1150
+ function LayoutServiceError() {
1151
+ }
1152
+ return LayoutServiceError;
1157
1153
  }());
1158
1154
 
1159
- var fetchRouteData = sitecoreJss.dataApi.fetchRouteData, fetchPlaceholderData = sitecoreJss.dataApi.fetchPlaceholderData;
1160
- var LayoutService = /** @class */ (function () {
1161
- function LayoutService() {
1162
- }
1163
- LayoutService.getLayoutServiceError = function (error) {
1164
- var layoutServiceError = new LayoutServiceError();
1165
- var response = error.response;
1166
- if (response) {
1167
- layoutServiceError.status = response.status;
1168
- layoutServiceError.statusText = response.statusText;
1169
- layoutServiceError.data = response.data;
1170
- }
1171
- return rxjs.throwError(layoutServiceError);
1172
- };
1173
- LayoutService.prototype.getRouteData = function (route, options) {
1174
- return rxjs.from(fetchRouteData(route, options))
1175
- .pipe(operators.catchError(LayoutService.getLayoutServiceError));
1176
- };
1177
- LayoutService.prototype.getPlaceholderData = function (route, placeholderName, options) {
1178
- return rxjs.from(fetchPlaceholderData(placeholderName, route, options))
1179
- .pipe(operators.catchError(LayoutService.getLayoutServiceError));
1180
- };
1181
- return LayoutService;
1182
- }());
1183
- LayoutService.decorators = [
1184
- { type: core.Injectable }
1155
+ var fetchRouteData = sitecoreJss.dataApi.fetchRouteData, fetchPlaceholderData = sitecoreJss.dataApi.fetchPlaceholderData;
1156
+ var LayoutService = /** @class */ (function () {
1157
+ function LayoutService() {
1158
+ }
1159
+ LayoutService.getLayoutServiceError = function (error) {
1160
+ var layoutServiceError = new LayoutServiceError();
1161
+ var response = error.response;
1162
+ if (response) {
1163
+ layoutServiceError.status = response.status;
1164
+ layoutServiceError.statusText = response.statusText;
1165
+ layoutServiceError.data = response.data;
1166
+ }
1167
+ return rxjs.throwError(layoutServiceError);
1168
+ };
1169
+ LayoutService.prototype.getRouteData = function (route, options) {
1170
+ return rxjs.from(fetchRouteData(route, options)).pipe(operators.catchError(LayoutService.getLayoutServiceError));
1171
+ };
1172
+ LayoutService.prototype.getPlaceholderData = function (route, placeholderName, options) {
1173
+ return rxjs.from(fetchPlaceholderData(placeholderName, route, options)).pipe(operators.catchError(LayoutService.getLayoutServiceError));
1174
+ };
1175
+ return LayoutService;
1176
+ }());
1177
+ LayoutService.decorators = [
1178
+ { type: core.Injectable }
1185
1179
  ];
1186
1180
 
1187
- var DateDirective = /** @class */ (function () {
1188
- function DateDirective(viewContainer, templateRef, datePipe) {
1189
- this.viewContainer = viewContainer;
1190
- this.templateRef = templateRef;
1191
- this.datePipe = datePipe;
1192
- // tslint:disable-next-line:no-input-rename
1193
- this.editable = true;
1194
- }
1195
- DateDirective.prototype.ngOnChanges = function (changes) {
1196
- if (changes['field'] || changes['format']) {
1197
- if (!this.viewRef) {
1198
- this.viewContainer.clear();
1199
- this.viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
1200
- }
1201
- this.updateView();
1202
- }
1203
- };
1204
- DateDirective.prototype.updateView = function () {
1205
- var _this = this;
1206
- var field = this.field;
1207
- if (!field || (!field.editable && !field.value)) {
1208
- return;
1209
- }
1210
- var html = field.editable && this.editable ? field.editable : field.value;
1211
- var setDangerously = field.editable && this.editable;
1212
- this.viewRef.rootNodes.forEach(function (node) {
1213
- if (setDangerously) {
1214
- node.innerHTML = html;
1215
- }
1216
- else {
1217
- node.textContent = _this.datePipe.transform(html, _this.format, _this.timezone, _this.locale);
1218
- }
1219
- });
1220
- };
1221
- return DateDirective;
1222
- }());
1223
- DateDirective.decorators = [
1224
- { type: core.Directive, args: [{
1225
- selector: '[scDate]',
1226
- },] }
1227
- ];
1228
- DateDirective.ctorParameters = function () { return [
1229
- { type: core.ViewContainerRef },
1230
- { type: core.TemplateRef },
1231
- { type: common.DatePipe }
1232
- ]; };
1233
- DateDirective.propDecorators = {
1234
- format: [{ type: core.Input, args: ['scDateFormat',] }],
1235
- timezone: [{ type: core.Input, args: ['scDateTimezone',] }],
1236
- locale: [{ type: core.Input, args: ['scDateLocale',] }],
1237
- editable: [{ type: core.Input, args: ['scDateEditable',] }],
1238
- field: [{ type: core.Input, args: ['scDate',] }]
1181
+ var DateDirective = /** @class */ (function () {
1182
+ function DateDirective(viewContainer, templateRef, datePipe) {
1183
+ this.viewContainer = viewContainer;
1184
+ this.templateRef = templateRef;
1185
+ this.datePipe = datePipe;
1186
+ this.editable = true;
1187
+ }
1188
+ DateDirective.prototype.ngOnChanges = function (changes) {
1189
+ if (changes.field || changes.format) {
1190
+ if (!this.viewRef) {
1191
+ this.viewContainer.clear();
1192
+ this.viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
1193
+ }
1194
+ this.updateView();
1195
+ }
1196
+ };
1197
+ DateDirective.prototype.updateView = function () {
1198
+ var _this = this;
1199
+ var field = this.field;
1200
+ if (!field || (!field.editable && !field.value)) {
1201
+ return;
1202
+ }
1203
+ var html = field.editable && this.editable ? field.editable : field.value;
1204
+ var setDangerously = field.editable && this.editable;
1205
+ this.viewRef.rootNodes.forEach(function (node) {
1206
+ if (setDangerously) {
1207
+ node.innerHTML = html;
1208
+ }
1209
+ else {
1210
+ node.textContent = _this.datePipe.transform(html, _this.format, _this.timezone, _this.locale);
1211
+ }
1212
+ });
1213
+ };
1214
+ return DateDirective;
1215
+ }());
1216
+ DateDirective.decorators = [
1217
+ { type: core.Directive, args: [{
1218
+ selector: '[scDate]',
1219
+ },] }
1220
+ ];
1221
+ DateDirective.ctorParameters = function () { return [
1222
+ { type: core.ViewContainerRef },
1223
+ { type: core.TemplateRef },
1224
+ { type: common.DatePipe }
1225
+ ]; };
1226
+ DateDirective.propDecorators = {
1227
+ format: [{ type: core.Input, args: ['scDateFormat',] }],
1228
+ timezone: [{ type: core.Input, args: ['scDateTimezone',] }],
1229
+ locale: [{ type: core.Input, args: ['scDateLocale',] }],
1230
+ editable: [{ type: core.Input, args: ['scDateEditable',] }],
1231
+ field: [{ type: core.Input, args: ['scDate',] }]
1239
1232
  };
1240
1233
 
1241
- var MissingComponentComponent = /** @class */ (function () {
1242
- function MissingComponentComponent() {
1243
- }
1244
- return MissingComponentComponent;
1245
- }());
1246
- MissingComponentComponent.decorators = [
1247
- { type: core.Component, args: [{
1248
- selector: 'sc-missing-component',
1249
- template: "\n<div style=\"background: darkorange; outline: 5px solid orange; padding: 10px; color: white; max-width: 500px;\">\n <h2>{{ rendering.componentName }}</h2>\n <p>JSS component is missing Angular component implementation.</p>\n</div>"
1250
- },] }
1251
- ];
1252
- MissingComponentComponent.propDecorators = {
1253
- rendering: [{ type: core.Input }]
1234
+ var MissingComponentComponent = /** @class */ (function () {
1235
+ function MissingComponentComponent() {
1236
+ }
1237
+ return MissingComponentComponent;
1238
+ }());
1239
+ MissingComponentComponent.decorators = [
1240
+ { type: core.Component, args: [{
1241
+ selector: 'sc-missing-component',
1242
+ template: "\n <div\n style=\"background: darkorange; outline: 5px solid orange; padding: 10px; color: white; max-width: 500px;\"\n >\n <h2>{{ rendering.componentName }}</h2>\n <p>JSS component is missing Angular component implementation.</p>\n </div>\n "
1243
+ },] }
1244
+ ];
1245
+ MissingComponentComponent.propDecorators = {
1246
+ rendering: [{ type: core.Input }]
1254
1247
  };
1255
1248
 
1256
- /**
1257
- * Renders a single JSS component given a rendering definition.
1258
- * Useful inside templated placeholders.
1259
- */
1260
- var RenderComponentComponent = /** @class */ (function () {
1261
- function RenderComponentComponent(componentFactoryResolver, differs, componentFactory, missingComponentComponent) {
1262
- this.componentFactoryResolver = componentFactoryResolver;
1263
- this.differs = differs;
1264
- this.componentFactory = componentFactory;
1265
- this.missingComponentComponent = missingComponentComponent;
1266
- this.destroyed = false;
1267
- }
1268
- Object.defineProperty(RenderComponentComponent.prototype, "inputs", {
1269
- set: function (value) {
1270
- this._inputs = value;
1271
- if (!this._differ && value) {
1272
- this._differ = this.differs.find(value).create();
1273
- }
1274
- },
1275
- enumerable: false,
1276
- configurable: true
1277
- });
1278
- RenderComponentComponent.prototype.ngOnChanges = function (changes) {
1279
- if (changes['rendering']) {
1280
- this._render();
1281
- }
1282
- };
1283
- RenderComponentComponent.prototype._setComponentInputs = function (componentInstance, inputs) {
1284
- Object.entries(inputs).forEach(function (_a) {
1285
- var _b = __read(_a, 2), input = _b[0], inputValue = _b[1];
1286
- return componentInstance[input] = inputValue;
1287
- });
1288
- };
1289
- RenderComponentComponent.prototype._subscribeComponentOutputs = function (componentInstance, outputs) {
1290
- var _this = this;
1291
- Object.keys(outputs)
1292
- .filter(function (output) { return componentInstance[output] && componentInstance[output] instanceof rxjs.Observable; })
1293
- .forEach(function (output) { return componentInstance[output]
1294
- .pipe(operators.takeWhile(function () { return !_this.destroyed; }))
1295
- .subscribe(outputs[output]); });
1296
- };
1297
- RenderComponentComponent.prototype._render = function () {
1298
- var _this = this;
1299
- this.view.clear();
1300
- if (!this.rendering) {
1301
- return;
1302
- }
1303
- var resolveComponent = isRawRendering(this.rendering)
1304
- ? Promise.resolve({ componentImplementation: RawComponent, componentDefinition: this.rendering })
1305
- : this.componentFactory.getComponent(this.rendering);
1306
- resolveComponent.then(function (rendering) {
1307
- if (!rendering.componentImplementation) {
1308
- var componentName = rendering.componentDefinition.componentName;
1309
- console.error("Attempted to render unknown component " + componentName + ".", "Ensure component is mapped, like:\n JssModule.withComponents([\n { name: '" + componentName + "', type: " + componentName + "Component }\n ])");
1310
- rendering.componentImplementation = _this.missingComponentComponent;
1311
- }
1312
- var componentFactory = rendering.componentFactory || _this.componentFactoryResolver.resolveComponentFactory(rendering.componentImplementation);
1313
- var componentInstance = _this.view.createComponent(componentFactory, 0).instance;
1314
- componentInstance.rendering = rendering.componentDefinition;
1315
- if (_this._inputs) {
1316
- _this._setComponentInputs(componentInstance, _this._inputs);
1317
- }
1318
- if (_this.outputs) {
1319
- _this._subscribeComponentOutputs(componentInstance, _this.outputs);
1320
- }
1321
- });
1322
- };
1323
- return RenderComponentComponent;
1324
- }());
1325
- RenderComponentComponent.decorators = [
1326
- { type: core.Component, args: [{
1327
- selector: 'sc-render-component',
1328
- template: "\n <ng-template #view></ng-template>\n "
1329
- },] }
1330
- ];
1331
- RenderComponentComponent.ctorParameters = function () { return [
1332
- { type: core.ComponentFactoryResolver },
1333
- { type: core.KeyValueDiffers },
1334
- { type: JssComponentFactoryService },
1335
- { type: core.Type, decorators: [{ type: core.Inject, args: [PLACEHOLDER_MISSING_COMPONENT_COMPONENT,] }] }
1336
- ]; };
1337
- RenderComponentComponent.propDecorators = {
1338
- rendering: [{ type: core.Input }],
1339
- outputs: [{ type: core.Input }],
1340
- view: [{ type: core.ViewChild, args: ['view', { read: core.ViewContainerRef, static: true },] }],
1341
- inputs: [{ type: core.Input }]
1249
+ /**
1250
+ * Renders a single JSS component given a rendering definition.
1251
+ * Useful inside templated placeholders.
1252
+ */
1253
+ var RenderComponentComponent = /** @class */ (function () {
1254
+ function RenderComponentComponent(componentFactoryResolver, differs, componentFactory, missingComponentComponent) {
1255
+ this.componentFactoryResolver = componentFactoryResolver;
1256
+ this.differs = differs;
1257
+ this.componentFactory = componentFactory;
1258
+ this.missingComponentComponent = missingComponentComponent;
1259
+ this.destroyed = false;
1260
+ }
1261
+ Object.defineProperty(RenderComponentComponent.prototype, "inputs", {
1262
+ set: function (value) {
1263
+ this._inputs = value;
1264
+ if (!this._differ && value) {
1265
+ this._differ = this.differs.find(value).create();
1266
+ }
1267
+ },
1268
+ enumerable: false,
1269
+ configurable: true
1270
+ });
1271
+ RenderComponentComponent.prototype.ngOnChanges = function (changes) {
1272
+ if (changes.rendering) {
1273
+ this._render();
1274
+ }
1275
+ };
1276
+ RenderComponentComponent.prototype._setComponentInputs = function (componentInstance, inputs) {
1277
+ Object.entries(inputs).forEach(function (_a) {
1278
+ var _b = __read(_a, 2), input = _b[0], inputValue = _b[1];
1279
+ return (componentInstance[input] = inputValue);
1280
+ });
1281
+ };
1282
+ RenderComponentComponent.prototype._subscribeComponentOutputs = function (componentInstance, outputs) {
1283
+ var _this = this;
1284
+ Object.keys(outputs)
1285
+ .filter(function (output) { return componentInstance[output] && componentInstance[output] instanceof rxjs.Observable; })
1286
+ .forEach(function (output) { return componentInstance[output]
1287
+ .pipe(operators.takeWhile(function () { return !_this.destroyed; }))
1288
+ .subscribe(outputs[output]); });
1289
+ };
1290
+ RenderComponentComponent.prototype._render = function () {
1291
+ var _this = this;
1292
+ this.view.clear();
1293
+ if (!this.rendering) {
1294
+ return;
1295
+ }
1296
+ var resolveComponent = isRawRendering(this.rendering)
1297
+ ? Promise.resolve({
1298
+ componentImplementation: RawComponent,
1299
+ componentDefinition: this.rendering,
1300
+ })
1301
+ : this.componentFactory.getComponent(this.rendering);
1302
+ resolveComponent.then(function (rendering) {
1303
+ if (!rendering.componentImplementation) {
1304
+ var componentName = rendering.componentDefinition.componentName;
1305
+ console.error("Attempted to render unknown component " + componentName + ".", "Ensure component is mapped, like:\n JssModule.withComponents([\n { name: '" + componentName + "', type: " + componentName + "Component }\n ])");
1306
+ rendering.componentImplementation = _this.missingComponentComponent;
1307
+ }
1308
+ var componentFactory = rendering.componentFactory ||
1309
+ _this.componentFactoryResolver.resolveComponentFactory(rendering.componentImplementation);
1310
+ var componentInstance = _this.view.createComponent(componentFactory, 0).instance;
1311
+ componentInstance.rendering = rendering.componentDefinition;
1312
+ if (_this._inputs) {
1313
+ _this._setComponentInputs(componentInstance, _this._inputs);
1314
+ }
1315
+ if (_this.outputs) {
1316
+ _this._subscribeComponentOutputs(componentInstance, _this.outputs);
1317
+ }
1318
+ });
1319
+ };
1320
+ return RenderComponentComponent;
1321
+ }());
1322
+ RenderComponentComponent.decorators = [
1323
+ { type: core.Component, args: [{
1324
+ selector: 'sc-render-component',
1325
+ template: "\n <ng-template #view></ng-template>\n "
1326
+ },] }
1327
+ ];
1328
+ RenderComponentComponent.ctorParameters = function () { return [
1329
+ { type: core.ComponentFactoryResolver },
1330
+ { type: core.KeyValueDiffers },
1331
+ { type: JssComponentFactoryService },
1332
+ { type: core.Type, decorators: [{ type: core.Inject, args: [PLACEHOLDER_MISSING_COMPONENT_COMPONENT,] }] }
1333
+ ]; };
1334
+ RenderComponentComponent.propDecorators = {
1335
+ rendering: [{ type: core.Input }],
1336
+ outputs: [{ type: core.Input }],
1337
+ view: [{ type: core.ViewChild, args: ['view', { read: core.ViewContainerRef, static: true },] }],
1338
+ inputs: [{ type: core.Input }]
1342
1339
  };
1343
1340
 
1344
- var JssModule = /** @class */ (function () {
1345
- function JssModule() {
1346
- }
1347
- /**
1348
- * Instantiates the JSS module with no component factory.
1349
- * Useful for using it from libraries. Most of the time you'd want withComponents()
1350
- */
1351
- JssModule.forRoot = function () {
1352
- return {
1353
- ngModule: JssModule,
1354
- providers: [
1355
- LayoutService,
1356
- common.DatePipe,
1357
- JssComponentFactoryService,
1358
- ],
1359
- };
1360
- };
1361
- /** Instantiates a module for a lazy-loaded JSS component */
1362
- JssModule.forChild = function (component) {
1363
- return {
1364
- ngModule: JssModule,
1365
- providers: [
1366
- { provide: core.ANALYZE_FOR_ENTRY_COMPONENTS, useValue: component, multi: true },
1367
- { provide: router.ROUTES, useValue: [], multi: true },
1368
- { provide: DYNAMIC_COMPONENT, useValue: component },
1369
- ],
1370
- };
1371
- };
1372
- /**
1373
- * Instantiates the JSS module and specifies the mapping from component name to component implementation.
1374
- * Appropriate when defining the set of JSS components that your app is aware of.
1375
- */
1376
- JssModule.withComponents = function (components, lazyComponents) {
1377
- return {
1378
- ngModule: JssModule,
1379
- providers: __spread([
1380
- {
1381
- provide: core.ANALYZE_FOR_ENTRY_COMPONENTS,
1382
- useValue: components,
1383
- multi: true,
1384
- },
1385
- { provide: PLACEHOLDER_COMPONENTS, useValue: components },
1386
- { provide: PLACEHOLDER_LAZY_COMPONENTS, useValue: lazyComponents || [] },
1387
- { provide: router.ROUTES, useValue: lazyComponents || [], multi: true },
1388
- { provide: PLACEHOLDER_MISSING_COMPONENT_COMPONENT, useValue: MissingComponentComponent }
1389
- ], JssModule.forRoot().providers),
1390
- };
1391
- };
1392
- return JssModule;
1393
- }());
1394
- JssModule.decorators = [
1395
- { type: core.NgModule, args: [{
1396
- imports: [
1397
- common.CommonModule,
1398
- ],
1399
- declarations: [
1400
- FileDirective,
1401
- ImageDirective,
1402
- LinkDirective,
1403
- RouterLinkDirective,
1404
- GenericLinkDirective,
1405
- DateDirective,
1406
- RenderEachDirective,
1407
- RenderEmptyDirective,
1408
- PlaceholderLoadingDirective,
1409
- RenderComponentComponent,
1410
- PlaceholderComponent,
1411
- RawComponent,
1412
- RichTextDirective,
1413
- TextDirective,
1414
- MissingComponentComponent,
1415
- ],
1416
- exports: [
1417
- FileDirective,
1418
- ImageDirective,
1419
- DateDirective,
1420
- LinkDirective,
1421
- RouterLinkDirective,
1422
- GenericLinkDirective,
1423
- RenderEachDirective,
1424
- RenderEmptyDirective,
1425
- RenderComponentComponent,
1426
- PlaceholderComponent,
1427
- PlaceholderLoadingDirective,
1428
- RichTextDirective,
1429
- TextDirective,
1430
- ],
1431
- entryComponents: [
1432
- RawComponent,
1433
- MissingComponentComponent,
1434
- ],
1435
- },] }
1341
+ var JssModule = /** @class */ (function () {
1342
+ function JssModule() {
1343
+ }
1344
+ /**
1345
+ * Instantiates the JSS module with no component factory.
1346
+ * Useful for using it from libraries. Most of the time you'd want withComponents()
1347
+ * @returns {ModuleWithProviders<JssModule>} module
1348
+ */
1349
+ JssModule.forRoot = function () {
1350
+ return {
1351
+ ngModule: JssModule,
1352
+ providers: [LayoutService, common.DatePipe, JssComponentFactoryService],
1353
+ };
1354
+ };
1355
+ /**
1356
+ * Instantiates a module for a lazy-loaded JSS component
1357
+ * @param {Type<any>} component
1358
+ * @returns {ModuleWithProviders<JssModule>} module
1359
+ */
1360
+ JssModule.forChild = function (component) {
1361
+ return {
1362
+ ngModule: JssModule,
1363
+ providers: [
1364
+ { provide: core.ANALYZE_FOR_ENTRY_COMPONENTS, useValue: component, multi: true },
1365
+ { provide: router.ROUTES, useValue: [], multi: true },
1366
+ { provide: DYNAMIC_COMPONENT, useValue: component },
1367
+ ],
1368
+ };
1369
+ };
1370
+ /**
1371
+ * Instantiates the JSS module and specifies the mapping from component name to component implementation.
1372
+ * Appropriate when defining the set of JSS components that your app is aware of.
1373
+ * @param {ComponentNameAndType[]} components
1374
+ * @param {ComponentNameAndModule[]} [lazyComponents]
1375
+ * @returns {ModuleWithProviders<JssModule>} module
1376
+ */
1377
+ JssModule.withComponents = function (components, lazyComponents) {
1378
+ return {
1379
+ ngModule: JssModule,
1380
+ providers: __spread([
1381
+ {
1382
+ provide: core.ANALYZE_FOR_ENTRY_COMPONENTS,
1383
+ useValue: components,
1384
+ multi: true,
1385
+ },
1386
+ { provide: PLACEHOLDER_COMPONENTS, useValue: components },
1387
+ { provide: PLACEHOLDER_LAZY_COMPONENTS, useValue: lazyComponents || [] },
1388
+ { provide: router.ROUTES, useValue: lazyComponents || [], multi: true },
1389
+ { provide: PLACEHOLDER_MISSING_COMPONENT_COMPONENT, useValue: MissingComponentComponent }
1390
+ ], JssModule.forRoot().providers),
1391
+ };
1392
+ };
1393
+ return JssModule;
1394
+ }());
1395
+ JssModule.decorators = [
1396
+ { type: core.NgModule, args: [{
1397
+ imports: [common.CommonModule],
1398
+ declarations: [
1399
+ FileDirective,
1400
+ ImageDirective,
1401
+ LinkDirective,
1402
+ RouterLinkDirective,
1403
+ GenericLinkDirective,
1404
+ DateDirective,
1405
+ RenderEachDirective,
1406
+ RenderEmptyDirective,
1407
+ PlaceholderLoadingDirective,
1408
+ RenderComponentComponent,
1409
+ PlaceholderComponent,
1410
+ RawComponent,
1411
+ RichTextDirective,
1412
+ TextDirective,
1413
+ MissingComponentComponent,
1414
+ ],
1415
+ exports: [
1416
+ FileDirective,
1417
+ ImageDirective,
1418
+ DateDirective,
1419
+ LinkDirective,
1420
+ RouterLinkDirective,
1421
+ GenericLinkDirective,
1422
+ RenderEachDirective,
1423
+ RenderEmptyDirective,
1424
+ RenderComponentComponent,
1425
+ PlaceholderComponent,
1426
+ PlaceholderLoadingDirective,
1427
+ RichTextDirective,
1428
+ TextDirective,
1429
+ ],
1430
+ entryComponents: [RawComponent, MissingComponentComponent],
1431
+ },] }
1436
1432
  ];
1437
1433
 
1438
- /**
1439
- * Generated bundle index. Do not edit.
1434
+ /**
1435
+ * Generated bundle index. Do not edit.
1440
1436
  */
1441
1437
 
1442
1438
  Object.defineProperty(exports, 'dataApi', {