@sitecore-jss/sitecore-jss-angular 16.0.3-canary.0 → 16.0.3

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 (56) 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 +1389 -1389
  5. package/dist/components/date.directive.d.ts +17 -17
  6. package/dist/components/file.directive.d.ts +14 -14
  7. package/dist/components/generic-link.directive.d.ts +14 -14
  8. package/dist/components/image.directive.d.ts +28 -28
  9. package/dist/components/link.directive.d.ts +18 -18
  10. package/dist/components/missing-component.component.d.ts +3 -3
  11. package/dist/components/placeholder-loading.directive.d.ts +5 -5
  12. package/dist/components/placeholder.component.d.ts +45 -45
  13. package/dist/components/placeholder.token.d.ts +30 -30
  14. package/dist/components/raw.component.d.ts +9 -9
  15. package/dist/components/render-component.component.d.ts +29 -29
  16. package/dist/components/render-each.directive.d.ts +5 -5
  17. package/dist/components/render-empty.directive.d.ts +5 -5
  18. package/dist/components/rendering-field.d.ts +20 -20
  19. package/dist/components/rendering.d.ts +5 -5
  20. package/dist/components/rich-text.directive.d.ts +12 -12
  21. package/dist/components/router-link.directive.d.ts +12 -12
  22. package/dist/components/text.directive.d.ts +13 -13
  23. package/dist/esm2015/components/date.directive.js +53 -53
  24. package/dist/esm2015/components/file.directive.js +43 -43
  25. package/dist/esm2015/components/generic-link.directive.js +58 -58
  26. package/dist/esm2015/components/image.directive.js +125 -125
  27. package/dist/esm2015/components/link.directive.js +101 -101
  28. package/dist/esm2015/components/missing-component.component.js +13 -13
  29. package/dist/esm2015/components/placeholder-loading.directive.js +15 -15
  30. package/dist/esm2015/components/placeholder.component.js +192 -192
  31. package/dist/esm2015/components/placeholder.token.js +21 -21
  32. package/dist/esm2015/components/raw.component.js +37 -37
  33. package/dist/esm2015/components/render-component.component.js +89 -89
  34. package/dist/esm2015/components/render-each.directive.js +15 -15
  35. package/dist/esm2015/components/render-empty.directive.js +15 -15
  36. package/dist/esm2015/components/rendering-field.js +1 -1
  37. package/dist/esm2015/components/rendering.js +8 -8
  38. package/dist/esm2015/components/rich-text.directive.js +41 -41
  39. package/dist/esm2015/components/router-link.directive.js +44 -44
  40. package/dist/esm2015/components/text.directive.js +54 -54
  41. package/dist/esm2015/jss-component-factory.service.js +87 -87
  42. package/dist/esm2015/layout-service-error.js +3 -3
  43. package/dist/esm2015/layout.service.js +28 -28
  44. package/dist/esm2015/lib.module.js +112 -112
  45. package/dist/esm2015/public_api.js +16 -16
  46. package/dist/esm2015/sitecore-jss-sitecore-jss-angular.js +13 -13
  47. package/dist/fesm2015/sitecore-jss-sitecore-jss-angular.js +1047 -1047
  48. package/dist/jss-component-factory.service.d.ts +21 -21
  49. package/dist/layout-service-error.d.ts +8 -8
  50. package/dist/layout.service.d.ts +8 -8
  51. package/dist/lib.module.d.ts +24 -24
  52. package/dist/package.json +2 -2
  53. package/dist/public_api.d.ts +16 -16
  54. package/dist/sitecore-jss-sitecore-jss-angular.d.ts +12 -12
  55. package/package.json +3 -3
  56. package/typings/README.md +2 -2
@@ -4,1439 +4,1439 @@
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
- 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
- view.destroy();
411
- return {};
412
- }
413
- var attrs = {};
414
- for (var i = 0; i < element.attributes.length; i++) {
415
- var attr = element.attributes.item(i);
416
- if (attr) {
417
- attrs[attr.name] = attr.value;
418
- }
419
- }
420
- view.destroy();
421
- return attrs;
422
- };
423
- ImageDirective.prototype.renderInlineWrapper = function (editable) {
424
- var span = this.renderer.createElement('span');
425
- span.className = 'sc-image-wrapper';
426
- span.innerHTML = editable;
427
- var parentNode = this.renderer.parentNode(this.elementRef.nativeElement);
428
- this.renderer.insertBefore(parentNode, span, this.elementRef.nativeElement);
429
- parentNode.removeChild(this.elementRef.nativeElement);
430
- this.inlineRef = span;
431
- };
432
- return ImageDirective;
433
- }());
434
- ImageDirective.decorators = [
435
- { type: core.Directive, args: [{ selector: '[scImage]' },] }
436
- ];
437
- ImageDirective.ctorParameters = function () { return [
438
- { type: core.ViewContainerRef },
439
- { type: core.TemplateRef },
440
- { type: core.Renderer2 },
441
- { type: core.ElementRef }
442
- ]; };
443
- ImageDirective.propDecorators = {
444
- field: [{ type: core.Input, args: ['scImage',] }],
445
- editable: [{ type: core.Input, args: ['scImageEditable',] }],
446
- mediaUrlPrefix: [{ type: core.Input, args: ['scImageMediaUrlPrefix',] }],
447
- urlParams: [{ type: core.Input, args: ['scImageUrlParams',] }],
448
- 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
+ view.destroy();
411
+ return {};
412
+ }
413
+ var attrs = {};
414
+ for (var i = 0; i < element.attributes.length; i++) {
415
+ var attr = element.attributes.item(i);
416
+ if (attr) {
417
+ attrs[attr.name] = attr.value;
418
+ }
419
+ }
420
+ view.destroy();
421
+ return attrs;
422
+ };
423
+ ImageDirective.prototype.renderInlineWrapper = function (editable) {
424
+ var span = this.renderer.createElement('span');
425
+ span.className = 'sc-image-wrapper';
426
+ span.innerHTML = editable;
427
+ var parentNode = this.renderer.parentNode(this.elementRef.nativeElement);
428
+ this.renderer.insertBefore(parentNode, span, this.elementRef.nativeElement);
429
+ parentNode.removeChild(this.elementRef.nativeElement);
430
+ this.inlineRef = span;
431
+ };
432
+ return ImageDirective;
433
+ }());
434
+ ImageDirective.decorators = [
435
+ { type: core.Directive, args: [{ selector: '[scImage]' },] }
436
+ ];
437
+ ImageDirective.ctorParameters = function () { return [
438
+ { type: core.ViewContainerRef },
439
+ { type: core.TemplateRef },
440
+ { type: core.Renderer2 },
441
+ { type: core.ElementRef }
442
+ ]; };
443
+ ImageDirective.propDecorators = {
444
+ field: [{ type: core.Input, args: ['scImage',] }],
445
+ editable: [{ type: core.Input, args: ['scImageEditable',] }],
446
+ mediaUrlPrefix: [{ type: core.Input, args: ['scImageMediaUrlPrefix',] }],
447
+ urlParams: [{ type: core.Input, args: ['scImageUrlParams',] }],
448
+ attrs: [{ type: core.Input, args: ['scImageAttrs',] }]
449
449
  };
450
450
 
451
- var LinkDirective = /** @class */ (function () {
452
- function LinkDirective(viewContainer, templateRef, renderer, elementRef) {
453
- this.viewContainer = viewContainer;
454
- this.templateRef = templateRef;
455
- this.renderer = renderer;
456
- this.elementRef = elementRef;
457
- this.inlineRef = null;
458
- this.editable = true;
459
- this.attrs = {};
460
- }
461
- LinkDirective.prototype.ngOnChanges = function (changes) {
462
- if (changes.field || changes.editable || changes.attrs) {
463
- this.viewContainer.clear();
464
- if (this.inlineRef) {
465
- this.inlineRef.remove();
466
- this.inlineRef = null;
467
- }
468
- this.updateView();
469
- }
470
- };
471
- LinkDirective.prototype.updateView = function () {
472
- var field = this.field;
473
- if (this.editable && field && field.editableFirstPart && field.editableLastPart) {
474
- this.renderInlineWrapper(field.editableFirstPart, field.editableLastPart);
475
- }
476
- else if (field && (field.href || field.value)) {
477
- var props = field.href ? field : field.value;
478
- var linkText = field.text || field.value.text || field.href || field.value.href;
479
- var mergedAttrs = Object.assign(Object.assign({}, props), this.attrs);
480
- this.renderTemplate(mergedAttrs, linkText);
481
- }
482
- };
483
- LinkDirective.prototype.renderTemplate = function (props, linkText) {
484
- var _this = this;
485
- var viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
486
- viewRef.rootNodes.forEach(function (node) {
487
- Object.entries(props).forEach(function (_a) {
488
- var _b = __read(_a, 2), key = _b[0], propValue = _b[1];
489
- if (key === 'href') {
490
- var isInvalidLink = !propValue || /^https?:\/\/$/.test(propValue);
491
- if (isInvalidLink) {
492
- if (!node.href) {
493
- return;
494
- }
495
- propValue = node.href;
496
- }
497
- }
498
- if (key === 'class' && node.className) {
499
- propValue += " " + node.className;
500
- }
501
- _this.renderer.setAttribute(node, key, propValue);
502
- });
503
- if (node.childNodes && node.childNodes.length === 0 && linkText) {
504
- node.textContent = linkText;
505
- }
506
- });
507
- };
508
- LinkDirective.prototype.renderInlineWrapper = function (editableFirstPart, editableLastPart) {
509
- var _this = this;
510
- var span = this.renderer.createElement('span');
511
- span.className = 'sc-link-wrapper';
512
- span.innerHTML = editableFirstPart + editableLastPart;
513
- // assign attributes from template to inline wrapper
514
- var attrs = Object.assign(Object.assign({}, this.getElementAttrs()), this.attrs);
515
- Object.entries(attrs).forEach(function (_a) {
516
- var _b = __read(_a, 2), key = _b[0], attrValue = _b[1];
517
- return _this.renderer.setAttribute(span, key, attrValue);
518
- });
519
- this.viewContainer.createEmbeddedView(this.templateRef);
520
- var parentNode = this.renderer.parentNode(this.elementRef.nativeElement);
521
- this.renderer.insertBefore(parentNode, span, this.elementRef.nativeElement);
522
- this.inlineRef = span;
523
- };
524
- LinkDirective.prototype.getElementAttrs = function () {
525
- var view = this.templateRef.createEmbeddedView(null);
526
- var element = view.rootNodes[0];
527
- if (!element) {
528
- view.destroy();
529
- return {};
530
- }
531
- var attrs = {};
532
- for (var i = 0; i < element.attributes.length; i++) {
533
- var attr = element.attributes.item(i);
534
- if (attr) {
535
- attrs[attr.name] = attr.value;
536
- }
537
- }
538
- view.destroy();
539
- return attrs;
540
- };
541
- return LinkDirective;
542
- }());
543
- LinkDirective.decorators = [
544
- { type: core.Directive, args: [{ selector: '[scLink]' },] }
545
- ];
546
- LinkDirective.ctorParameters = function () { return [
547
- { type: core.ViewContainerRef },
548
- { type: core.TemplateRef },
549
- { type: core.Renderer2 },
550
- { type: core.ElementRef }
551
- ]; };
552
- LinkDirective.propDecorators = {
553
- editable: [{ type: core.Input, args: ['scLinkEditable',] }],
554
- attrs: [{ type: core.Input, args: ['scLinkAttrs',] }],
555
- field: [{ type: core.Input, args: ['scLink',] }]
451
+ var LinkDirective = /** @class */ (function () {
452
+ function LinkDirective(viewContainer, templateRef, renderer, elementRef) {
453
+ this.viewContainer = viewContainer;
454
+ this.templateRef = templateRef;
455
+ this.renderer = renderer;
456
+ this.elementRef = elementRef;
457
+ this.inlineRef = null;
458
+ this.editable = true;
459
+ this.attrs = {};
460
+ }
461
+ LinkDirective.prototype.ngOnChanges = function (changes) {
462
+ if (changes.field || changes.editable || changes.attrs) {
463
+ this.viewContainer.clear();
464
+ if (this.inlineRef) {
465
+ this.inlineRef.remove();
466
+ this.inlineRef = null;
467
+ }
468
+ this.updateView();
469
+ }
470
+ };
471
+ LinkDirective.prototype.updateView = function () {
472
+ var field = this.field;
473
+ if (this.editable && field && field.editableFirstPart && field.editableLastPart) {
474
+ this.renderInlineWrapper(field.editableFirstPart, field.editableLastPart);
475
+ }
476
+ else if (field && (field.href || field.value)) {
477
+ var props = field.href ? field : field.value;
478
+ var linkText = field.text || field.value.text || field.href || field.value.href;
479
+ var mergedAttrs = Object.assign(Object.assign({}, props), this.attrs);
480
+ this.renderTemplate(mergedAttrs, linkText);
481
+ }
482
+ };
483
+ LinkDirective.prototype.renderTemplate = function (props, linkText) {
484
+ var _this = this;
485
+ var viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
486
+ viewRef.rootNodes.forEach(function (node) {
487
+ Object.entries(props).forEach(function (_a) {
488
+ var _b = __read(_a, 2), key = _b[0], propValue = _b[1];
489
+ if (key === 'href') {
490
+ var isInvalidLink = !propValue || /^https?:\/\/$/.test(propValue);
491
+ if (isInvalidLink) {
492
+ if (!node.href) {
493
+ return;
494
+ }
495
+ propValue = node.href;
496
+ }
497
+ }
498
+ if (key === 'class' && node.className) {
499
+ propValue += " " + node.className;
500
+ }
501
+ _this.renderer.setAttribute(node, key, propValue);
502
+ });
503
+ if (node.childNodes && node.childNodes.length === 0 && linkText) {
504
+ node.textContent = linkText;
505
+ }
506
+ });
507
+ };
508
+ LinkDirective.prototype.renderInlineWrapper = function (editableFirstPart, editableLastPart) {
509
+ var _this = this;
510
+ var span = this.renderer.createElement('span');
511
+ span.className = 'sc-link-wrapper';
512
+ span.innerHTML = editableFirstPart + editableLastPart;
513
+ // assign attributes from template to inline wrapper
514
+ var attrs = Object.assign(Object.assign({}, this.getElementAttrs()), this.attrs);
515
+ Object.entries(attrs).forEach(function (_a) {
516
+ var _b = __read(_a, 2), key = _b[0], attrValue = _b[1];
517
+ return _this.renderer.setAttribute(span, key, attrValue);
518
+ });
519
+ this.viewContainer.createEmbeddedView(this.templateRef);
520
+ var parentNode = this.renderer.parentNode(this.elementRef.nativeElement);
521
+ this.renderer.insertBefore(parentNode, span, this.elementRef.nativeElement);
522
+ this.inlineRef = span;
523
+ };
524
+ LinkDirective.prototype.getElementAttrs = function () {
525
+ var view = this.templateRef.createEmbeddedView(null);
526
+ var element = view.rootNodes[0];
527
+ if (!element) {
528
+ view.destroy();
529
+ return {};
530
+ }
531
+ var attrs = {};
532
+ for (var i = 0; i < element.attributes.length; i++) {
533
+ var attr = element.attributes.item(i);
534
+ if (attr) {
535
+ attrs[attr.name] = attr.value;
536
+ }
537
+ }
538
+ view.destroy();
539
+ return attrs;
540
+ };
541
+ return LinkDirective;
542
+ }());
543
+ LinkDirective.decorators = [
544
+ { type: core.Directive, args: [{ selector: '[scLink]' },] }
545
+ ];
546
+ LinkDirective.ctorParameters = function () { return [
547
+ { type: core.ViewContainerRef },
548
+ { type: core.TemplateRef },
549
+ { type: core.Renderer2 },
550
+ { type: core.ElementRef }
551
+ ]; };
552
+ LinkDirective.propDecorators = {
553
+ editable: [{ type: core.Input, args: ['scLinkEditable',] }],
554
+ attrs: [{ type: core.Input, args: ['scLinkAttrs',] }],
555
+ field: [{ type: core.Input, args: ['scLink',] }]
556
556
  };
557
557
 
558
- var RouterLinkDirective = /** @class */ (function (_super) {
559
- __extends(RouterLinkDirective, _super);
560
- function RouterLinkDirective(viewContainer, templateRef, renderer, elementRef, router) {
561
- var _this = _super.call(this, viewContainer, templateRef, renderer, elementRef) || this;
562
- _this.router = router;
563
- _this.editable = true;
564
- _this.attrs = {};
565
- return _this;
566
- }
567
- RouterLinkDirective.prototype.renderTemplate = function (props, linkText) {
568
- var _this = this;
569
- var viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
570
- viewRef.rootNodes.forEach(function (node) {
571
- Object.entries(props).forEach(function (_a) {
572
- var _b = __read(_a, 2), key = _b[0], propValue = _b[1];
573
- _this.renderer.setAttribute(node, key, propValue);
574
- if (key === 'href') {
575
- _this.renderer.listen(node, 'click', function (event) {
576
- _this.router.navigate([propValue]);
577
- event.preventDefault();
578
- });
579
- }
580
- });
581
- if (node.childNodes && node.childNodes.length === 0 && linkText) {
582
- node.textContent = linkText;
583
- }
584
- });
585
- };
586
- return RouterLinkDirective;
587
- }(LinkDirective));
588
- RouterLinkDirective.decorators = [
589
- { type: core.Directive, args: [{ selector: '[scRouterLink]' },] }
590
- ];
591
- RouterLinkDirective.ctorParameters = function () { return [
592
- { type: core.ViewContainerRef },
593
- { type: core.TemplateRef },
594
- { type: core.Renderer2 },
595
- { type: core.ElementRef },
596
- { type: router.Router }
597
- ]; };
598
- RouterLinkDirective.propDecorators = {
599
- editable: [{ type: core.Input, args: ['scRouterLinkEditable',] }],
600
- attrs: [{ type: core.Input, args: ['scRouterLinkAttrs',] }],
601
- field: [{ type: core.Input, args: ['scRouterLink',] }]
558
+ var RouterLinkDirective = /** @class */ (function (_super) {
559
+ __extends(RouterLinkDirective, _super);
560
+ function RouterLinkDirective(viewContainer, templateRef, renderer, elementRef, router) {
561
+ var _this = _super.call(this, viewContainer, templateRef, renderer, elementRef) || this;
562
+ _this.router = router;
563
+ _this.editable = true;
564
+ _this.attrs = {};
565
+ return _this;
566
+ }
567
+ RouterLinkDirective.prototype.renderTemplate = function (props, linkText) {
568
+ var _this = this;
569
+ var viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
570
+ viewRef.rootNodes.forEach(function (node) {
571
+ Object.entries(props).forEach(function (_a) {
572
+ var _b = __read(_a, 2), key = _b[0], propValue = _b[1];
573
+ _this.renderer.setAttribute(node, key, propValue);
574
+ if (key === 'href') {
575
+ _this.renderer.listen(node, 'click', function (event) {
576
+ _this.router.navigate([propValue]);
577
+ event.preventDefault();
578
+ });
579
+ }
580
+ });
581
+ if (node.childNodes && node.childNodes.length === 0 && linkText) {
582
+ node.textContent = linkText;
583
+ }
584
+ });
585
+ };
586
+ return RouterLinkDirective;
587
+ }(LinkDirective));
588
+ RouterLinkDirective.decorators = [
589
+ { type: core.Directive, args: [{ selector: '[scRouterLink]' },] }
590
+ ];
591
+ RouterLinkDirective.ctorParameters = function () { return [
592
+ { type: core.ViewContainerRef },
593
+ { type: core.TemplateRef },
594
+ { type: core.Renderer2 },
595
+ { type: core.ElementRef },
596
+ { type: router.Router }
597
+ ]; };
598
+ RouterLinkDirective.propDecorators = {
599
+ editable: [{ type: core.Input, args: ['scRouterLinkEditable',] }],
600
+ attrs: [{ type: core.Input, args: ['scRouterLinkAttrs',] }],
601
+ field: [{ type: core.Input, args: ['scRouterLink',] }]
602
602
  };
603
603
 
604
- var GenericLinkDirective = /** @class */ (function (_super) {
605
- __extends(GenericLinkDirective, _super);
606
- function GenericLinkDirective(viewContainer, templateRef, renderer, elementRef, router) {
607
- var _this = _super.call(this, viewContainer, templateRef, renderer, elementRef) || this;
608
- _this.router = router;
609
- _this.editable = true;
610
- _this.attrs = {};
611
- return _this;
612
- }
613
- GenericLinkDirective.prototype.renderTemplate = function (props, linkText) {
614
- var _this = this;
615
- var viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
616
- viewRef.rootNodes.forEach(function (node) {
617
- Object.entries(props).forEach(function (_a) {
618
- var _b = __read(_a, 2), key = _b[0], propValue = _b[1];
619
- if (key === 'href' && !_this.isAbsoluteUrl(propValue)) {
620
- var urlTree = _this.router.createUrlTree([propValue], _this.extras);
621
- _this.renderer.setAttribute(node, key, _this.router.serializeUrl(urlTree));
622
- _this.renderer.listen(node, 'click', function (event) {
623
- _this.router.navigate([propValue], _this.extras);
624
- event.preventDefault();
625
- });
626
- }
627
- else {
628
- _this.renderer.setAttribute(node, key, propValue);
629
- }
630
- });
631
- if (node.childNodes && node.childNodes.length === 0 && linkText) {
632
- node.textContent = linkText;
633
- }
634
- });
635
- };
636
- GenericLinkDirective.prototype.isAbsoluteUrl = function (url) {
637
- if (url === null) {
638
- return false;
639
- }
640
- if (typeof url !== 'string') {
641
- throw new TypeError('Expected a string');
642
- }
643
- return /^[a-z][a-z0-9+.-]*:/.test(url);
644
- };
645
- return GenericLinkDirective;
646
- }(LinkDirective));
647
- GenericLinkDirective.decorators = [
648
- { type: core.Directive, args: [{ selector: '[scGenericLink]' },] }
649
- ];
650
- GenericLinkDirective.ctorParameters = function () { return [
651
- { type: core.ViewContainerRef },
652
- { type: core.TemplateRef },
653
- { type: core.Renderer2 },
654
- { type: core.ElementRef },
655
- { type: router.Router }
656
- ]; };
657
- GenericLinkDirective.propDecorators = {
658
- editable: [{ type: core.Input, args: ['scGenericLinkEditable',] }],
659
- attrs: [{ type: core.Input, args: ['scGenericLinkAttrs',] }],
660
- field: [{ type: core.Input, args: ['scGenericLink',] }],
661
- extras: [{ type: core.Input, args: ['scGenericLinkExtras',] }]
604
+ var GenericLinkDirective = /** @class */ (function (_super) {
605
+ __extends(GenericLinkDirective, _super);
606
+ function GenericLinkDirective(viewContainer, templateRef, renderer, elementRef, router) {
607
+ var _this = _super.call(this, viewContainer, templateRef, renderer, elementRef) || this;
608
+ _this.router = router;
609
+ _this.editable = true;
610
+ _this.attrs = {};
611
+ return _this;
612
+ }
613
+ GenericLinkDirective.prototype.renderTemplate = function (props, linkText) {
614
+ var _this = this;
615
+ var viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
616
+ viewRef.rootNodes.forEach(function (node) {
617
+ Object.entries(props).forEach(function (_a) {
618
+ var _b = __read(_a, 2), key = _b[0], propValue = _b[1];
619
+ if (key === 'href' && !_this.isAbsoluteUrl(propValue)) {
620
+ var urlTree = _this.router.createUrlTree([propValue], _this.extras);
621
+ _this.renderer.setAttribute(node, key, _this.router.serializeUrl(urlTree));
622
+ _this.renderer.listen(node, 'click', function (event) {
623
+ _this.router.navigate([propValue], _this.extras);
624
+ event.preventDefault();
625
+ });
626
+ }
627
+ else {
628
+ _this.renderer.setAttribute(node, key, propValue);
629
+ }
630
+ });
631
+ if (node.childNodes && node.childNodes.length === 0 && linkText) {
632
+ node.textContent = linkText;
633
+ }
634
+ });
635
+ };
636
+ GenericLinkDirective.prototype.isAbsoluteUrl = function (url) {
637
+ if (url === null) {
638
+ return false;
639
+ }
640
+ if (typeof url !== 'string') {
641
+ throw new TypeError('Expected a string');
642
+ }
643
+ return /^[a-z][a-z0-9+.-]*:/.test(url);
644
+ };
645
+ return GenericLinkDirective;
646
+ }(LinkDirective));
647
+ GenericLinkDirective.decorators = [
648
+ { type: core.Directive, args: [{ selector: '[scGenericLink]' },] }
649
+ ];
650
+ GenericLinkDirective.ctorParameters = function () { return [
651
+ { type: core.ViewContainerRef },
652
+ { type: core.TemplateRef },
653
+ { type: core.Renderer2 },
654
+ { type: core.ElementRef },
655
+ { type: router.Router }
656
+ ]; };
657
+ GenericLinkDirective.propDecorators = {
658
+ editable: [{ type: core.Input, args: ['scGenericLinkEditable',] }],
659
+ attrs: [{ type: core.Input, args: ['scGenericLinkAttrs',] }],
660
+ field: [{ type: core.Input, args: ['scGenericLink',] }],
661
+ extras: [{ type: core.Input, args: ['scGenericLinkExtras',] }]
662
662
  };
663
663
 
664
- /** Registers a statically loaded component */
665
- var ComponentNameAndType = /** @class */ (function () {
666
- function ComponentNameAndType() {
667
- }
668
- return ComponentNameAndType;
669
- }());
670
- /**
671
- * @param {any} object
672
- */
673
- function instanceOfComponentNameAndType(object) {
674
- return 'type' in object;
675
- }
676
- /**
677
- * @param {any} object
678
- */
679
- function instanceOfComponentNameAndModule(object) {
680
- return 'module' in object;
681
- }
682
- var PLACEHOLDER_COMPONENTS = new core.InjectionToken('Sc.placeholder.components');
683
- var PLACEHOLDER_LAZY_COMPONENTS = new core.InjectionToken('Sc.placeholder.lazyComponents');
684
- var PLACEHOLDER_MISSING_COMPONENT_COMPONENT = new core.InjectionToken('Sc.placeholder.missingComponentComponent');
664
+ /** Registers a statically loaded component */
665
+ var ComponentNameAndType = /** @class */ (function () {
666
+ function ComponentNameAndType() {
667
+ }
668
+ return ComponentNameAndType;
669
+ }());
670
+ /**
671
+ * @param {any} object
672
+ */
673
+ function instanceOfComponentNameAndType(object) {
674
+ return 'type' in object;
675
+ }
676
+ /**
677
+ * @param {any} object
678
+ */
679
+ function instanceOfComponentNameAndModule(object) {
680
+ return 'module' in object;
681
+ }
682
+ var PLACEHOLDER_COMPONENTS = new core.InjectionToken('Sc.placeholder.components');
683
+ var PLACEHOLDER_LAZY_COMPONENTS = new core.InjectionToken('Sc.placeholder.lazyComponents');
684
+ var PLACEHOLDER_MISSING_COMPONENT_COMPONENT = new core.InjectionToken('Sc.placeholder.missingComponentComponent');
685
685
  var DYNAMIC_COMPONENT = new core.InjectionToken('Sc.placeholder.dynamicComponent');
686
686
 
687
- var RawComponent = /** @class */ (function () {
688
- function RawComponent(renderer, elementRef) {
689
- this.renderer = renderer;
690
- this.elementRef = elementRef;
691
- }
692
- RawComponent.prototype.ngOnInit = function () {
693
- var el = this.renderer.createElement(this.rendering.name);
694
- var contents = this.renderer.createText(this.rendering.contents || '');
695
- var attributes = this.rendering.attributes;
696
- for (var attr in attributes) {
697
- // eslint-disable-next-line no-prototype-builtins
698
- if (attributes.hasOwnProperty(attr)) {
699
- var value = attributes[attr];
700
- this.renderer.setAttribute(el, attr, value || '');
701
- }
702
- }
703
- this.renderer.appendChild(el, contents);
704
- var parentNode = this.renderer.parentNode(this.elementRef.nativeElement);
705
- this.renderer.insertBefore(parentNode, el, this.elementRef.nativeElement);
706
- parentNode.removeChild(this.elementRef.nativeElement);
707
- };
708
- return RawComponent;
709
- }());
710
- RawComponent.decorators = [
711
- { type: core.Component, args: [{
712
- selector: 'sc-raw',
713
- template: ''
714
- },] }
715
- ];
716
- RawComponent.ctorParameters = function () { return [
717
- { type: core.Renderer2 },
718
- { type: core.ElementRef }
719
- ]; };
720
- RawComponent.propDecorators = {
721
- rendering: [{ type: core.Input }]
687
+ var RawComponent = /** @class */ (function () {
688
+ function RawComponent(renderer, elementRef) {
689
+ this.renderer = renderer;
690
+ this.elementRef = elementRef;
691
+ }
692
+ RawComponent.prototype.ngOnInit = function () {
693
+ var el = this.renderer.createElement(this.rendering.name);
694
+ var contents = this.renderer.createText(this.rendering.contents || '');
695
+ var attributes = this.rendering.attributes;
696
+ for (var attr in attributes) {
697
+ // eslint-disable-next-line no-prototype-builtins
698
+ if (attributes.hasOwnProperty(attr)) {
699
+ var value = attributes[attr];
700
+ this.renderer.setAttribute(el, attr, value || '');
701
+ }
702
+ }
703
+ this.renderer.appendChild(el, contents);
704
+ var parentNode = this.renderer.parentNode(this.elementRef.nativeElement);
705
+ this.renderer.insertBefore(parentNode, el, this.elementRef.nativeElement);
706
+ parentNode.removeChild(this.elementRef.nativeElement);
707
+ };
708
+ return RawComponent;
709
+ }());
710
+ RawComponent.decorators = [
711
+ { type: core.Component, args: [{
712
+ selector: 'sc-raw',
713
+ template: ''
714
+ },] }
715
+ ];
716
+ RawComponent.ctorParameters = function () { return [
717
+ { type: core.Renderer2 },
718
+ { type: core.ElementRef }
719
+ ]; };
720
+ RawComponent.propDecorators = {
721
+ rendering: [{ type: core.Input }]
722
722
  };
723
723
 
724
- /**
725
- * @param {HtmlElementRendering | ComponentRendering} rendering
726
- */
727
- function isRawRendering(rendering) {
728
- return (!rendering.componentName &&
729
- rendering.name !== undefined);
724
+ /**
725
+ * @param {HtmlElementRendering | ComponentRendering} rendering
726
+ */
727
+ function isRawRendering(rendering) {
728
+ return (!rendering.componentName &&
729
+ rendering.name !== undefined);
730
730
  }
731
731
 
732
- var JssComponentFactoryService = /** @class */ (function () {
733
- function JssComponentFactoryService(injector, compiler, components, lazyComponents) {
734
- var _this = this;
735
- this.injector = injector;
736
- this.compiler = compiler;
737
- this.components = components;
738
- this.lazyComponents = lazyComponents;
739
- this.componentMap = new Map();
740
- this.lazyComponentMap = new Map();
741
- this.components.forEach(function (c) { return _this.componentMap.set(c.name, c.type); });
742
- if (this.lazyComponents) {
743
- this.lazyComponents.forEach(function (c) { return _this.lazyComponentMap.set(c.path, c); });
744
- }
745
- }
746
- JssComponentFactoryService.prototype.loadModuleFactory = function (lazyComponent) {
747
- var _this = this;
748
- return lazyComponent.loadChildren().then(function (loaded) {
749
- if (loaded instanceof core.NgModuleFactory) {
750
- return loaded;
751
- }
752
- else {
753
- return _this.compiler.compileModuleAsync(loaded);
754
- }
755
- });
756
- };
757
- JssComponentFactoryService.prototype.getComponent = function (component) {
758
- var _this = this;
759
- var loadedComponent = this.componentMap.get(component.componentName);
760
- if (loadedComponent) {
761
- return Promise.resolve({
762
- componentDefinition: component,
763
- componentImplementation: this.componentMap.get(component.componentName),
764
- });
765
- }
766
- var lazyComponent = this.lazyComponentMap.get(component.componentName);
767
- if (lazyComponent) {
768
- return this.loadModuleFactory(lazyComponent).then(function (ngModuleFactory) {
769
- var componentType = null;
770
- var moduleRef = ngModuleFactory.create(_this.injector);
771
- var dynamicComponentType = moduleRef.injector.get(DYNAMIC_COMPONENT);
772
- if (!dynamicComponentType) {
773
- throw new Error("JssComponentFactoryService: Lazy load module for component \"" + lazyComponent.path + "\" missing DYNAMIC_COMPONENT provider. Missing JssModule.forChild()?");
774
- }
775
- if (component.componentName in dynamicComponentType) {
776
- componentType = dynamicComponentType[component.componentName];
777
- }
778
- else {
779
- if (typeof dynamicComponentType === 'function') {
780
- componentType = dynamicComponentType;
781
- }
782
- else {
783
- throw new Error("JssComponentFactoryService: Lazy load module for component \"" + lazyComponent.path + "\" missing DYNAMIC_COMPONENT provider. Missing JssModule.forChild()?");
784
- }
785
- }
786
- return {
787
- componentDefinition: component,
788
- componentImplementation: componentType,
789
- componentFactory: moduleRef.componentFactoryResolver.resolveComponentFactory(componentType),
790
- };
791
- });
792
- }
793
- return Promise.resolve({
794
- componentDefinition: component,
795
- });
796
- };
797
- JssComponentFactoryService.prototype.getComponents = function (components) {
798
- var _this = this;
799
- // acquire all components and keep them in order while handling their potential async-ness
800
- return Promise.all(components.map(function (component) { return isRawRendering(component) ? _this.getRawComponent(component) : _this.getComponent(component); }));
801
- };
802
- JssComponentFactoryService.prototype.getRawComponent = function (component) {
803
- return Promise.resolve({
804
- componentImplementation: RawComponent,
805
- componentDefinition: component,
806
- });
807
- };
808
- return JssComponentFactoryService;
809
- }());
810
- JssComponentFactoryService.decorators = [
811
- { type: core.Injectable }
812
- ];
813
- JssComponentFactoryService.ctorParameters = function () { return [
814
- { type: core.Injector },
815
- { type: core.Compiler },
816
- { type: Array, decorators: [{ type: core.Inject, args: [PLACEHOLDER_COMPONENTS,] }] },
817
- { type: Array, decorators: [{ type: core.Inject, args: [PLACEHOLDER_LAZY_COMPONENTS,] }] }
732
+ var JssComponentFactoryService = /** @class */ (function () {
733
+ function JssComponentFactoryService(injector, compiler, components, lazyComponents) {
734
+ var _this = this;
735
+ this.injector = injector;
736
+ this.compiler = compiler;
737
+ this.components = components;
738
+ this.lazyComponents = lazyComponents;
739
+ this.componentMap = new Map();
740
+ this.lazyComponentMap = new Map();
741
+ this.components.forEach(function (c) { return _this.componentMap.set(c.name, c.type); });
742
+ if (this.lazyComponents) {
743
+ this.lazyComponents.forEach(function (c) { return _this.lazyComponentMap.set(c.path, c); });
744
+ }
745
+ }
746
+ JssComponentFactoryService.prototype.loadModuleFactory = function (lazyComponent) {
747
+ var _this = this;
748
+ return lazyComponent.loadChildren().then(function (loaded) {
749
+ if (loaded instanceof core.NgModuleFactory) {
750
+ return loaded;
751
+ }
752
+ else {
753
+ return _this.compiler.compileModuleAsync(loaded);
754
+ }
755
+ });
756
+ };
757
+ JssComponentFactoryService.prototype.getComponent = function (component) {
758
+ var _this = this;
759
+ var loadedComponent = this.componentMap.get(component.componentName);
760
+ if (loadedComponent) {
761
+ return Promise.resolve({
762
+ componentDefinition: component,
763
+ componentImplementation: this.componentMap.get(component.componentName),
764
+ });
765
+ }
766
+ var lazyComponent = this.lazyComponentMap.get(component.componentName);
767
+ if (lazyComponent) {
768
+ return this.loadModuleFactory(lazyComponent).then(function (ngModuleFactory) {
769
+ var componentType = null;
770
+ var moduleRef = ngModuleFactory.create(_this.injector);
771
+ var dynamicComponentType = moduleRef.injector.get(DYNAMIC_COMPONENT);
772
+ if (!dynamicComponentType) {
773
+ throw new Error("JssComponentFactoryService: Lazy load module for component \"" + lazyComponent.path + "\" missing DYNAMIC_COMPONENT provider. Missing JssModule.forChild()?");
774
+ }
775
+ if (component.componentName in dynamicComponentType) {
776
+ componentType = dynamicComponentType[component.componentName];
777
+ }
778
+ else {
779
+ if (typeof dynamicComponentType === 'function') {
780
+ componentType = dynamicComponentType;
781
+ }
782
+ else {
783
+ throw new Error("JssComponentFactoryService: Lazy load module for component \"" + lazyComponent.path + "\" missing DYNAMIC_COMPONENT provider. Missing JssModule.forChild()?");
784
+ }
785
+ }
786
+ return {
787
+ componentDefinition: component,
788
+ componentImplementation: componentType,
789
+ componentFactory: moduleRef.componentFactoryResolver.resolveComponentFactory(componentType),
790
+ };
791
+ });
792
+ }
793
+ return Promise.resolve({
794
+ componentDefinition: component,
795
+ });
796
+ };
797
+ JssComponentFactoryService.prototype.getComponents = function (components) {
798
+ var _this = this;
799
+ // acquire all components and keep them in order while handling their potential async-ness
800
+ return Promise.all(components.map(function (component) { return isRawRendering(component) ? _this.getRawComponent(component) : _this.getComponent(component); }));
801
+ };
802
+ JssComponentFactoryService.prototype.getRawComponent = function (component) {
803
+ return Promise.resolve({
804
+ componentImplementation: RawComponent,
805
+ componentDefinition: component,
806
+ });
807
+ };
808
+ return JssComponentFactoryService;
809
+ }());
810
+ JssComponentFactoryService.decorators = [
811
+ { type: core.Injectable }
812
+ ];
813
+ JssComponentFactoryService.ctorParameters = function () { return [
814
+ { type: core.Injector },
815
+ { type: core.Compiler },
816
+ { type: Array, decorators: [{ type: core.Inject, args: [PLACEHOLDER_COMPONENTS,] }] },
817
+ { type: Array, decorators: [{ type: core.Inject, args: [PLACEHOLDER_LAZY_COMPONENTS,] }] }
818
818
  ]; };
819
819
 
820
- var PlaceholderLoadingDirective = /** @class */ (function () {
821
- function PlaceholderLoadingDirective(templateRef) {
822
- this.templateRef = templateRef;
823
- }
824
- return PlaceholderLoadingDirective;
825
- }());
826
- PlaceholderLoadingDirective.decorators = [
827
- { type: core.Directive, args: [{
828
- selector: '[scPlaceholderLoading]',
829
- },] }
830
- ];
831
- PlaceholderLoadingDirective.ctorParameters = function () { return [
832
- { type: core.TemplateRef }
820
+ var PlaceholderLoadingDirective = /** @class */ (function () {
821
+ function PlaceholderLoadingDirective(templateRef) {
822
+ this.templateRef = templateRef;
823
+ }
824
+ return PlaceholderLoadingDirective;
825
+ }());
826
+ PlaceholderLoadingDirective.decorators = [
827
+ { type: core.Directive, args: [{
828
+ selector: '[scPlaceholderLoading]',
829
+ },] }
830
+ ];
831
+ PlaceholderLoadingDirective.ctorParameters = function () { return [
832
+ { type: core.TemplateRef }
833
833
  ]; };
834
834
 
835
- var RenderEachDirective = /** @class */ (function () {
836
- function RenderEachDirective(templateRef) {
837
- this.templateRef = templateRef;
838
- }
839
- return RenderEachDirective;
840
- }());
841
- RenderEachDirective.decorators = [
842
- { type: core.Directive, args: [{
843
- selector: '[renderEach]',
844
- },] }
845
- ];
846
- RenderEachDirective.ctorParameters = function () { return [
847
- { type: core.TemplateRef }
835
+ var RenderEachDirective = /** @class */ (function () {
836
+ function RenderEachDirective(templateRef) {
837
+ this.templateRef = templateRef;
838
+ }
839
+ return RenderEachDirective;
840
+ }());
841
+ RenderEachDirective.decorators = [
842
+ { type: core.Directive, args: [{
843
+ selector: '[renderEach]',
844
+ },] }
845
+ ];
846
+ RenderEachDirective.ctorParameters = function () { return [
847
+ { type: core.TemplateRef }
848
848
  ]; };
849
849
 
850
- var RenderEmptyDirective = /** @class */ (function () {
851
- function RenderEmptyDirective(templateRef) {
852
- this.templateRef = templateRef;
853
- }
854
- return RenderEmptyDirective;
855
- }());
856
- RenderEmptyDirective.decorators = [
857
- { type: core.Directive, args: [{
858
- selector: '[renderEmpty]',
859
- },] }
860
- ];
861
- RenderEmptyDirective.ctorParameters = function () { return [
862
- { type: core.TemplateRef }
850
+ var RenderEmptyDirective = /** @class */ (function () {
851
+ function RenderEmptyDirective(templateRef) {
852
+ this.templateRef = templateRef;
853
+ }
854
+ return RenderEmptyDirective;
855
+ }());
856
+ RenderEmptyDirective.decorators = [
857
+ { type: core.Directive, args: [{
858
+ selector: '[renderEmpty]',
859
+ },] }
860
+ ];
861
+ RenderEmptyDirective.ctorParameters = function () { return [
862
+ { type: core.TemplateRef }
863
863
  ]; };
864
864
 
865
- /**
866
- * @param {ComponentRendering} rendering
867
- * @param {string} name
868
- */
869
- function getPlaceholder(rendering, name) {
870
- if (rendering && rendering.placeholders && Object.keys(rendering.placeholders).length > 0) {
871
- return rendering.placeholders[name];
872
- }
873
- return null;
874
- }
875
- var PlaceholderComponent = /** @class */ (function () {
876
- function PlaceholderComponent(componentFactoryResolver, differs, componentFactory, changeDetectorRef, elementRef, renderer, missingComponentComponent) {
877
- this.componentFactoryResolver = componentFactoryResolver;
878
- this.differs = differs;
879
- this.componentFactory = componentFactory;
880
- this.changeDetectorRef = changeDetectorRef;
881
- this.elementRef = elementRef;
882
- this.renderer = renderer;
883
- this.missingComponentComponent = missingComponentComponent;
884
- this._componentInstances = [];
885
- this.destroyed = false;
886
- this.parentStyleAttribute = '';
887
- this.isLoading = true;
888
- this.loaded = new core.EventEmitter();
889
- }
890
- Object.defineProperty(PlaceholderComponent.prototype, "inputs", {
891
- set: function (value) {
892
- this._inputs = value;
893
- if (!this._differ && value) {
894
- this._differ = this.differs.find(value).create();
895
- }
896
- },
897
- enumerable: false,
898
- configurable: true
899
- });
900
- PlaceholderComponent.prototype.ngOnInit = function () {
901
- // just to ensure the element exists
902
- var elem = this.elementRef.nativeElement;
903
- if (elem) {
904
- var attributes = elem.attributes;
905
- for (var i = 0; i < attributes.length; i++) {
906
- var attr = attributes.item(i);
907
- if (attr && attr.name.indexOf('_ngcontent') !== -1) {
908
- this.parentStyleAttribute = attr.name;
909
- }
910
- }
911
- }
912
- };
913
- PlaceholderComponent.prototype.ngOnDestroy = function () {
914
- this.destroyed = true;
915
- this._componentInstances = [];
916
- };
917
- PlaceholderComponent.prototype.ngOnChanges = function (changes) {
918
- if (changes.rendering || changes.renderings) {
919
- this._render();
920
- }
921
- };
922
- PlaceholderComponent.prototype.ngDoCheck = function () {
923
- var _this = this;
924
- if (!this._differ || !this._inputs || this._componentInstances.length === 0) {
925
- return;
926
- }
927
- var changes = this._differ.diff(this._inputs);
928
- if (!changes) {
929
- return;
930
- }
931
- var updates = {};
932
- changes.forEachRemovedItem(function (change) { return (updates[change.key] = null); });
933
- changes.forEachAddedItem(function (change) { return (updates[change.key] = change.currentValue); });
934
- changes.forEachChangedItem(function (change) { return (updates[change.key] = change.currentValue); });
935
- this._componentInstances.forEach(function (componentInstance) { return _this._setComponentInputs(componentInstance, updates); });
936
- };
937
- PlaceholderComponent.prototype._setComponentInputs = function (componentInstance, inputs) {
938
- Object.entries(inputs).forEach(function (_a) {
939
- var _b = __read(_a, 2), input = _b[0], inputValue = _b[1];
940
- return (componentInstance[input] = inputValue);
941
- });
942
- };
943
- PlaceholderComponent.prototype._subscribeComponentOutputs = function (componentInstance, outputs) {
944
- var _this = this;
945
- Object.keys(outputs)
946
- .filter(function (output) { return componentInstance[output] && componentInstance[output] instanceof rxjs.Observable; })
947
- .forEach(function (output) { return componentInstance[output]
948
- .pipe(operators.takeWhile(function () { return !_this.destroyed; }))
949
- .subscribe(outputs[output]); });
950
- };
951
- PlaceholderComponent.prototype._render = function () {
952
- var _this = this;
953
- this._componentInstances = [];
954
- this.view.clear();
955
- if (!this.rendering && !this.renderings) {
956
- return;
957
- }
958
- if (!this.name && !this.renderings) {
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
979
- .getComponents(placeholder)
980
- .then(function (components) { return components.forEach(function (rendering, index) {
981
- if (_this.renderEachTemplate && !isRawRendering(rendering.componentDefinition)) {
982
- _this._renderTemplatedComponent(rendering.componentDefinition, index);
983
- }
984
- else {
985
- _this._renderEmbeddedComponent(rendering, index);
986
- }
987
- _this.isLoading = false;
988
- }); })
989
- .then(function () {
990
- _this.changeDetectorRef.markForCheck();
991
- _this.loaded.emit(_this.name);
992
- });
993
- }
994
- };
995
- PlaceholderComponent.prototype._renderTemplatedComponent = function (rendering, index) {
996
- // the render-each template takes care of all component mapping etc
997
- // generally using <sc-render-component> which is about like _renderEmbeddedComponent()
998
- // as a separate component
999
- this.view.createEmbeddedView(this.renderEachTemplate.templateRef, {
1000
- rendering: rendering,
1001
- index: index,
1002
- });
1003
- };
1004
- PlaceholderComponent.prototype._renderEmbeddedComponent = function (rendering, index) {
1005
- if (!rendering.componentImplementation) {
1006
- var componentName = rendering.componentDefinition.componentName;
1007
- console.error("Placeholder " + this.name + " contains unknown component " + componentName + ".", "Ensure component is mapped, like:\n JssModule.withComponents([\n { name: '" + componentName + "', type: " + componentName + "Component }\n ])");
1008
- rendering.componentImplementation = this.missingComponentComponent;
1009
- }
1010
- var componentFactory = rendering.componentFactory ||
1011
- this.componentFactoryResolver.resolveComponentFactory(rendering.componentImplementation);
1012
- // apply the parent style attribute _ngcontent
1013
- // work-around for https://github.com/angular/angular/issues/12215
1014
- var createdComponentRef = this.view.createComponent(componentFactory, index);
1015
- if (this.parentStyleAttribute) {
1016
- this.renderer.setAttribute(createdComponentRef.location.nativeElement, this.parentStyleAttribute, '');
1017
- }
1018
- var componentInstance = createdComponentRef.instance;
1019
- componentInstance.rendering = rendering.componentDefinition;
1020
- if (this._inputs) {
1021
- this._setComponentInputs(componentInstance, this._inputs);
1022
- }
1023
- if (this.outputs) {
1024
- this._subscribeComponentOutputs(componentInstance, this.outputs);
1025
- }
1026
- this._componentInstances.push(componentInstance);
1027
- };
1028
- return PlaceholderComponent;
1029
- }());
1030
- PlaceholderComponent.decorators = [
1031
- { type: core.Component, args: [{
1032
- selector: 'sc-placeholder,[sc-placeholder]',
1033
- template: "\n <ng-template\n *ngIf=\"isLoading\"\n [ngTemplateOutlet]=\"placeholderLoading?.templateRef\"\n ></ng-template>\n <ng-template #view></ng-template>\n "
1034
- },] }
1035
- ];
1036
- PlaceholderComponent.ctorParameters = function () { return [
1037
- { type: core.ComponentFactoryResolver },
1038
- { type: core.KeyValueDiffers },
1039
- { type: JssComponentFactoryService },
1040
- { type: core.ChangeDetectorRef },
1041
- { type: core.ElementRef },
1042
- { type: core.Renderer2 },
1043
- { type: core.Type, decorators: [{ type: core.Inject, args: [PLACEHOLDER_MISSING_COMPONENT_COMPONENT,] }] }
1044
- ]; };
1045
- PlaceholderComponent.propDecorators = {
1046
- name: [{ type: core.Input }],
1047
- rendering: [{ type: core.Input }],
1048
- renderings: [{ type: core.Input }],
1049
- outputs: [{ type: core.Input }],
1050
- loaded: [{ type: core.Output }],
1051
- view: [{ type: core.ViewChild, args: ['view', { read: core.ViewContainerRef, static: true },] }],
1052
- renderEachTemplate: [{ type: core.ContentChild, args: [RenderEachDirective, { static: true },] }],
1053
- renderEmptyTemplate: [{ type: core.ContentChild, args: [RenderEmptyDirective, { static: true },] }],
1054
- placeholderLoading: [{ type: core.ContentChild, args: [PlaceholderLoadingDirective, { static: true },] }],
1055
- inputs: [{ type: core.Input }]
865
+ /**
866
+ * @param {ComponentRendering} rendering
867
+ * @param {string} name
868
+ */
869
+ function getPlaceholder(rendering, name) {
870
+ if (rendering && rendering.placeholders && Object.keys(rendering.placeholders).length > 0) {
871
+ return rendering.placeholders[name];
872
+ }
873
+ return null;
874
+ }
875
+ var PlaceholderComponent = /** @class */ (function () {
876
+ function PlaceholderComponent(componentFactoryResolver, differs, componentFactory, changeDetectorRef, elementRef, renderer, missingComponentComponent) {
877
+ this.componentFactoryResolver = componentFactoryResolver;
878
+ this.differs = differs;
879
+ this.componentFactory = componentFactory;
880
+ this.changeDetectorRef = changeDetectorRef;
881
+ this.elementRef = elementRef;
882
+ this.renderer = renderer;
883
+ this.missingComponentComponent = missingComponentComponent;
884
+ this._componentInstances = [];
885
+ this.destroyed = false;
886
+ this.parentStyleAttribute = '';
887
+ this.isLoading = true;
888
+ this.loaded = new core.EventEmitter();
889
+ }
890
+ Object.defineProperty(PlaceholderComponent.prototype, "inputs", {
891
+ set: function (value) {
892
+ this._inputs = value;
893
+ if (!this._differ && value) {
894
+ this._differ = this.differs.find(value).create();
895
+ }
896
+ },
897
+ enumerable: false,
898
+ configurable: true
899
+ });
900
+ PlaceholderComponent.prototype.ngOnInit = function () {
901
+ // just to ensure the element exists
902
+ var elem = this.elementRef.nativeElement;
903
+ if (elem) {
904
+ var attributes = elem.attributes;
905
+ for (var i = 0; i < attributes.length; i++) {
906
+ var attr = attributes.item(i);
907
+ if (attr && attr.name.indexOf('_ngcontent') !== -1) {
908
+ this.parentStyleAttribute = attr.name;
909
+ }
910
+ }
911
+ }
912
+ };
913
+ PlaceholderComponent.prototype.ngOnDestroy = function () {
914
+ this.destroyed = true;
915
+ this._componentInstances = [];
916
+ };
917
+ PlaceholderComponent.prototype.ngOnChanges = function (changes) {
918
+ if (changes.rendering || changes.renderings) {
919
+ this._render();
920
+ }
921
+ };
922
+ PlaceholderComponent.prototype.ngDoCheck = function () {
923
+ var _this = this;
924
+ if (!this._differ || !this._inputs || this._componentInstances.length === 0) {
925
+ return;
926
+ }
927
+ var changes = this._differ.diff(this._inputs);
928
+ if (!changes) {
929
+ return;
930
+ }
931
+ var updates = {};
932
+ changes.forEachRemovedItem(function (change) { return (updates[change.key] = null); });
933
+ changes.forEachAddedItem(function (change) { return (updates[change.key] = change.currentValue); });
934
+ changes.forEachChangedItem(function (change) { return (updates[change.key] = change.currentValue); });
935
+ this._componentInstances.forEach(function (componentInstance) { return _this._setComponentInputs(componentInstance, updates); });
936
+ };
937
+ PlaceholderComponent.prototype._setComponentInputs = function (componentInstance, inputs) {
938
+ Object.entries(inputs).forEach(function (_a) {
939
+ var _b = __read(_a, 2), input = _b[0], inputValue = _b[1];
940
+ return (componentInstance[input] = inputValue);
941
+ });
942
+ };
943
+ PlaceholderComponent.prototype._subscribeComponentOutputs = function (componentInstance, outputs) {
944
+ var _this = this;
945
+ Object.keys(outputs)
946
+ .filter(function (output) { return componentInstance[output] && componentInstance[output] instanceof rxjs.Observable; })
947
+ .forEach(function (output) { return componentInstance[output]
948
+ .pipe(operators.takeWhile(function () { return !_this.destroyed; }))
949
+ .subscribe(outputs[output]); });
950
+ };
951
+ PlaceholderComponent.prototype._render = function () {
952
+ var _this = this;
953
+ this._componentInstances = [];
954
+ this.view.clear();
955
+ if (!this.rendering && !this.renderings) {
956
+ return;
957
+ }
958
+ if (!this.name && !this.renderings) {
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
979
+ .getComponents(placeholder)
980
+ .then(function (components) { return components.forEach(function (rendering, index) {
981
+ if (_this.renderEachTemplate && !isRawRendering(rendering.componentDefinition)) {
982
+ _this._renderTemplatedComponent(rendering.componentDefinition, index);
983
+ }
984
+ else {
985
+ _this._renderEmbeddedComponent(rendering, index);
986
+ }
987
+ _this.isLoading = false;
988
+ }); })
989
+ .then(function () {
990
+ _this.changeDetectorRef.markForCheck();
991
+ _this.loaded.emit(_this.name);
992
+ });
993
+ }
994
+ };
995
+ PlaceholderComponent.prototype._renderTemplatedComponent = function (rendering, index) {
996
+ // the render-each template takes care of all component mapping etc
997
+ // generally using <sc-render-component> which is about like _renderEmbeddedComponent()
998
+ // as a separate component
999
+ this.view.createEmbeddedView(this.renderEachTemplate.templateRef, {
1000
+ rendering: rendering,
1001
+ index: index,
1002
+ });
1003
+ };
1004
+ PlaceholderComponent.prototype._renderEmbeddedComponent = function (rendering, index) {
1005
+ if (!rendering.componentImplementation) {
1006
+ var componentName = rendering.componentDefinition.componentName;
1007
+ console.error("Placeholder " + this.name + " contains unknown component " + componentName + ".", "Ensure component is mapped, like:\n JssModule.withComponents([\n { name: '" + componentName + "', type: " + componentName + "Component }\n ])");
1008
+ rendering.componentImplementation = this.missingComponentComponent;
1009
+ }
1010
+ var componentFactory = rendering.componentFactory ||
1011
+ this.componentFactoryResolver.resolveComponentFactory(rendering.componentImplementation);
1012
+ // apply the parent style attribute _ngcontent
1013
+ // work-around for https://github.com/angular/angular/issues/12215
1014
+ var createdComponentRef = this.view.createComponent(componentFactory, index);
1015
+ if (this.parentStyleAttribute) {
1016
+ this.renderer.setAttribute(createdComponentRef.location.nativeElement, this.parentStyleAttribute, '');
1017
+ }
1018
+ var componentInstance = createdComponentRef.instance;
1019
+ componentInstance.rendering = rendering.componentDefinition;
1020
+ if (this._inputs) {
1021
+ this._setComponentInputs(componentInstance, this._inputs);
1022
+ }
1023
+ if (this.outputs) {
1024
+ this._subscribeComponentOutputs(componentInstance, this.outputs);
1025
+ }
1026
+ this._componentInstances.push(componentInstance);
1027
+ };
1028
+ return PlaceholderComponent;
1029
+ }());
1030
+ PlaceholderComponent.decorators = [
1031
+ { type: core.Component, args: [{
1032
+ selector: 'sc-placeholder,[sc-placeholder]',
1033
+ template: "\n <ng-template\n *ngIf=\"isLoading\"\n [ngTemplateOutlet]=\"placeholderLoading?.templateRef\"\n ></ng-template>\n <ng-template #view></ng-template>\n "
1034
+ },] }
1035
+ ];
1036
+ PlaceholderComponent.ctorParameters = function () { return [
1037
+ { type: core.ComponentFactoryResolver },
1038
+ { type: core.KeyValueDiffers },
1039
+ { type: JssComponentFactoryService },
1040
+ { type: core.ChangeDetectorRef },
1041
+ { type: core.ElementRef },
1042
+ { type: core.Renderer2 },
1043
+ { type: core.Type, decorators: [{ type: core.Inject, args: [PLACEHOLDER_MISSING_COMPONENT_COMPONENT,] }] }
1044
+ ]; };
1045
+ PlaceholderComponent.propDecorators = {
1046
+ name: [{ type: core.Input }],
1047
+ rendering: [{ type: core.Input }],
1048
+ renderings: [{ type: core.Input }],
1049
+ outputs: [{ type: core.Input }],
1050
+ loaded: [{ type: core.Output }],
1051
+ view: [{ type: core.ViewChild, args: ['view', { read: core.ViewContainerRef, static: true },] }],
1052
+ renderEachTemplate: [{ type: core.ContentChild, args: [RenderEachDirective, { static: true },] }],
1053
+ renderEmptyTemplate: [{ type: core.ContentChild, args: [RenderEmptyDirective, { static: true },] }],
1054
+ placeholderLoading: [{ type: core.ContentChild, args: [PlaceholderLoadingDirective, { static: true },] }],
1055
+ inputs: [{ type: core.Input }]
1056
1056
  };
1057
1057
 
1058
- var RichTextDirective = /** @class */ (function () {
1059
- function RichTextDirective(viewContainer, templateRef) {
1060
- this.viewContainer = viewContainer;
1061
- this.templateRef = templateRef;
1062
- this.editable = true;
1063
- }
1064
- RichTextDirective.prototype.ngOnChanges = function (changes) {
1065
- if (changes.field || changes.editable) {
1066
- if (!this.viewRef) {
1067
- this.viewContainer.clear();
1068
- this.viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
1069
- }
1070
- this.updateView();
1071
- }
1072
- };
1073
- RichTextDirective.prototype.updateView = function () {
1074
- var field = this.field;
1075
- if (!field || (!field.editable && !field.value)) {
1076
- return;
1077
- }
1078
- var html = field.editable && this.editable ? field.editable : field.value;
1079
- this.viewRef.rootNodes.forEach(function (node) {
1080
- node.innerHTML = html;
1081
- });
1082
- };
1083
- return RichTextDirective;
1084
- }());
1085
- RichTextDirective.decorators = [
1086
- { type: core.Directive, args: [{
1087
- selector: '[scRichText]',
1088
- },] }
1089
- ];
1090
- RichTextDirective.ctorParameters = function () { return [
1091
- { type: core.ViewContainerRef },
1092
- { type: core.TemplateRef }
1093
- ]; };
1094
- RichTextDirective.propDecorators = {
1095
- editable: [{ type: core.Input, args: ['scRichTextEditable',] }],
1096
- field: [{ type: core.Input, args: ['scRichText',] }]
1058
+ var RichTextDirective = /** @class */ (function () {
1059
+ function RichTextDirective(viewContainer, templateRef) {
1060
+ this.viewContainer = viewContainer;
1061
+ this.templateRef = templateRef;
1062
+ this.editable = true;
1063
+ }
1064
+ RichTextDirective.prototype.ngOnChanges = function (changes) {
1065
+ if (changes.field || changes.editable) {
1066
+ if (!this.viewRef) {
1067
+ this.viewContainer.clear();
1068
+ this.viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
1069
+ }
1070
+ this.updateView();
1071
+ }
1072
+ };
1073
+ RichTextDirective.prototype.updateView = function () {
1074
+ var field = this.field;
1075
+ if (!field || (!field.editable && !field.value)) {
1076
+ return;
1077
+ }
1078
+ var html = field.editable && this.editable ? field.editable : field.value;
1079
+ this.viewRef.rootNodes.forEach(function (node) {
1080
+ node.innerHTML = html;
1081
+ });
1082
+ };
1083
+ return RichTextDirective;
1084
+ }());
1085
+ RichTextDirective.decorators = [
1086
+ { type: core.Directive, args: [{
1087
+ selector: '[scRichText]',
1088
+ },] }
1089
+ ];
1090
+ RichTextDirective.ctorParameters = function () { return [
1091
+ { type: core.ViewContainerRef },
1092
+ { type: core.TemplateRef }
1093
+ ]; };
1094
+ RichTextDirective.propDecorators = {
1095
+ editable: [{ type: core.Input, args: ['scRichTextEditable',] }],
1096
+ field: [{ type: core.Input, args: ['scRichText',] }]
1097
1097
  };
1098
1098
 
1099
- var TextDirective = /** @class */ (function () {
1100
- function TextDirective(viewContainer, templateRef) {
1101
- this.viewContainer = viewContainer;
1102
- this.templateRef = templateRef;
1103
- this.editable = true;
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',] }]
1099
+ var TextDirective = /** @class */ (function () {
1100
+ function TextDirective(viewContainer, templateRef) {
1101
+ this.viewContainer = viewContainer;
1102
+ this.templateRef = templateRef;
1103
+ this.editable = true;
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',] }]
1151
1151
  };
1152
1152
 
1153
- var LayoutServiceError = /** @class */ (function () {
1154
- function LayoutServiceError() {
1155
- }
1156
- return LayoutServiceError;
1153
+ var LayoutServiceError = /** @class */ (function () {
1154
+ function LayoutServiceError() {
1155
+ }
1156
+ return LayoutServiceError;
1157
1157
  }());
1158
1158
 
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)).pipe(operators.catchError(LayoutService.getLayoutServiceError));
1175
- };
1176
- LayoutService.prototype.getPlaceholderData = function (route, placeholderName, options) {
1177
- return rxjs.from(fetchPlaceholderData(placeholderName, route, options)).pipe(operators.catchError(LayoutService.getLayoutServiceError));
1178
- };
1179
- return LayoutService;
1180
- }());
1181
- LayoutService.decorators = [
1182
- { type: core.Injectable }
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)).pipe(operators.catchError(LayoutService.getLayoutServiceError));
1175
+ };
1176
+ LayoutService.prototype.getPlaceholderData = function (route, placeholderName, options) {
1177
+ return rxjs.from(fetchPlaceholderData(placeholderName, route, options)).pipe(operators.catchError(LayoutService.getLayoutServiceError));
1178
+ };
1179
+ return LayoutService;
1180
+ }());
1181
+ LayoutService.decorators = [
1182
+ { type: core.Injectable }
1183
1183
  ];
1184
1184
 
1185
- var DateDirective = /** @class */ (function () {
1186
- function DateDirective(viewContainer, templateRef, datePipe) {
1187
- this.viewContainer = viewContainer;
1188
- this.templateRef = templateRef;
1189
- this.datePipe = datePipe;
1190
- this.editable = true;
1191
- }
1192
- DateDirective.prototype.ngOnChanges = function (changes) {
1193
- if (changes.field || changes.format) {
1194
- if (!this.viewRef) {
1195
- this.viewContainer.clear();
1196
- this.viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
1197
- }
1198
- this.updateView();
1199
- }
1200
- };
1201
- DateDirective.prototype.updateView = function () {
1202
- var _this = this;
1203
- var field = this.field;
1204
- if (!field || (!field.editable && !field.value)) {
1205
- return;
1206
- }
1207
- var html = field.editable && this.editable ? field.editable : field.value;
1208
- var setDangerously = field.editable && this.editable;
1209
- this.viewRef.rootNodes.forEach(function (node) {
1210
- if (setDangerously) {
1211
- node.innerHTML = html;
1212
- }
1213
- else {
1214
- node.textContent = _this.datePipe.transform(html, _this.format, _this.timezone, _this.locale);
1215
- }
1216
- });
1217
- };
1218
- return DateDirective;
1219
- }());
1220
- DateDirective.decorators = [
1221
- { type: core.Directive, args: [{
1222
- selector: '[scDate]',
1223
- },] }
1224
- ];
1225
- DateDirective.ctorParameters = function () { return [
1226
- { type: core.ViewContainerRef },
1227
- { type: core.TemplateRef },
1228
- { type: common.DatePipe }
1229
- ]; };
1230
- DateDirective.propDecorators = {
1231
- format: [{ type: core.Input, args: ['scDateFormat',] }],
1232
- timezone: [{ type: core.Input, args: ['scDateTimezone',] }],
1233
- locale: [{ type: core.Input, args: ['scDateLocale',] }],
1234
- editable: [{ type: core.Input, args: ['scDateEditable',] }],
1235
- field: [{ type: core.Input, args: ['scDate',] }]
1185
+ var DateDirective = /** @class */ (function () {
1186
+ function DateDirective(viewContainer, templateRef, datePipe) {
1187
+ this.viewContainer = viewContainer;
1188
+ this.templateRef = templateRef;
1189
+ this.datePipe = datePipe;
1190
+ this.editable = true;
1191
+ }
1192
+ DateDirective.prototype.ngOnChanges = function (changes) {
1193
+ if (changes.field || changes.format) {
1194
+ if (!this.viewRef) {
1195
+ this.viewContainer.clear();
1196
+ this.viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
1197
+ }
1198
+ this.updateView();
1199
+ }
1200
+ };
1201
+ DateDirective.prototype.updateView = function () {
1202
+ var _this = this;
1203
+ var field = this.field;
1204
+ if (!field || (!field.editable && !field.value)) {
1205
+ return;
1206
+ }
1207
+ var html = field.editable && this.editable ? field.editable : field.value;
1208
+ var setDangerously = field.editable && this.editable;
1209
+ this.viewRef.rootNodes.forEach(function (node) {
1210
+ if (setDangerously) {
1211
+ node.innerHTML = html;
1212
+ }
1213
+ else {
1214
+ node.textContent = _this.datePipe.transform(html, _this.format, _this.timezone, _this.locale);
1215
+ }
1216
+ });
1217
+ };
1218
+ return DateDirective;
1219
+ }());
1220
+ DateDirective.decorators = [
1221
+ { type: core.Directive, args: [{
1222
+ selector: '[scDate]',
1223
+ },] }
1224
+ ];
1225
+ DateDirective.ctorParameters = function () { return [
1226
+ { type: core.ViewContainerRef },
1227
+ { type: core.TemplateRef },
1228
+ { type: common.DatePipe }
1229
+ ]; };
1230
+ DateDirective.propDecorators = {
1231
+ format: [{ type: core.Input, args: ['scDateFormat',] }],
1232
+ timezone: [{ type: core.Input, args: ['scDateTimezone',] }],
1233
+ locale: [{ type: core.Input, args: ['scDateLocale',] }],
1234
+ editable: [{ type: core.Input, args: ['scDateEditable',] }],
1235
+ field: [{ type: core.Input, args: ['scDate',] }]
1236
1236
  };
1237
1237
 
1238
- var MissingComponentComponent = /** @class */ (function () {
1239
- function MissingComponentComponent() {
1240
- }
1241
- return MissingComponentComponent;
1242
- }());
1243
- MissingComponentComponent.decorators = [
1244
- { type: core.Component, args: [{
1245
- selector: 'sc-missing-component',
1246
- 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 "
1247
- },] }
1248
- ];
1249
- MissingComponentComponent.propDecorators = {
1250
- rendering: [{ type: core.Input }]
1238
+ var MissingComponentComponent = /** @class */ (function () {
1239
+ function MissingComponentComponent() {
1240
+ }
1241
+ return MissingComponentComponent;
1242
+ }());
1243
+ MissingComponentComponent.decorators = [
1244
+ { type: core.Component, args: [{
1245
+ selector: 'sc-missing-component',
1246
+ 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 "
1247
+ },] }
1248
+ ];
1249
+ MissingComponentComponent.propDecorators = {
1250
+ rendering: [{ type: core.Input }]
1251
1251
  };
1252
1252
 
1253
- /**
1254
- * Renders a single JSS component given a rendering definition.
1255
- * Useful inside templated placeholders.
1256
- */
1257
- var RenderComponentComponent = /** @class */ (function () {
1258
- function RenderComponentComponent(componentFactoryResolver, differs, componentFactory, missingComponentComponent) {
1259
- this.componentFactoryResolver = componentFactoryResolver;
1260
- this.differs = differs;
1261
- this.componentFactory = componentFactory;
1262
- this.missingComponentComponent = missingComponentComponent;
1263
- this.destroyed = false;
1264
- }
1265
- Object.defineProperty(RenderComponentComponent.prototype, "inputs", {
1266
- set: function (value) {
1267
- this._inputs = value;
1268
- if (!this._differ && value) {
1269
- this._differ = this.differs.find(value).create();
1270
- }
1271
- },
1272
- enumerable: false,
1273
- configurable: true
1274
- });
1275
- RenderComponentComponent.prototype.ngOnChanges = function (changes) {
1276
- if (changes.rendering) {
1277
- this._render();
1278
- }
1279
- };
1280
- RenderComponentComponent.prototype._setComponentInputs = function (componentInstance, inputs) {
1281
- Object.entries(inputs).forEach(function (_a) {
1282
- var _b = __read(_a, 2), input = _b[0], inputValue = _b[1];
1283
- return (componentInstance[input] = inputValue);
1284
- });
1285
- };
1286
- RenderComponentComponent.prototype._subscribeComponentOutputs = function (componentInstance, outputs) {
1287
- var _this = this;
1288
- Object.keys(outputs)
1289
- .filter(function (output) { return componentInstance[output] && componentInstance[output] instanceof rxjs.Observable; })
1290
- .forEach(function (output) { return componentInstance[output]
1291
- .pipe(operators.takeWhile(function () { return !_this.destroyed; }))
1292
- .subscribe(outputs[output]); });
1293
- };
1294
- RenderComponentComponent.prototype._render = function () {
1295
- var _this = this;
1296
- this.view.clear();
1297
- if (!this.rendering) {
1298
- return;
1299
- }
1300
- var resolveComponent = isRawRendering(this.rendering)
1301
- ? Promise.resolve({
1302
- componentImplementation: RawComponent,
1303
- componentDefinition: this.rendering,
1304
- })
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 ||
1313
- _this.componentFactoryResolver.resolveComponentFactory(rendering.componentImplementation);
1314
- var componentInstance = _this.view.createComponent(componentFactory, 0).instance;
1315
- componentInstance.rendering = rendering.componentDefinition;
1316
- if (_this._inputs) {
1317
- _this._setComponentInputs(componentInstance, _this._inputs);
1318
- }
1319
- if (_this.outputs) {
1320
- _this._subscribeComponentOutputs(componentInstance, _this.outputs);
1321
- }
1322
- });
1323
- };
1324
- return RenderComponentComponent;
1325
- }());
1326
- RenderComponentComponent.decorators = [
1327
- { type: core.Component, args: [{
1328
- selector: 'sc-render-component',
1329
- template: "\n <ng-template #view></ng-template>\n "
1330
- },] }
1331
- ];
1332
- RenderComponentComponent.ctorParameters = function () { return [
1333
- { type: core.ComponentFactoryResolver },
1334
- { type: core.KeyValueDiffers },
1335
- { type: JssComponentFactoryService },
1336
- { type: core.Type, decorators: [{ type: core.Inject, args: [PLACEHOLDER_MISSING_COMPONENT_COMPONENT,] }] }
1337
- ]; };
1338
- RenderComponentComponent.propDecorators = {
1339
- rendering: [{ type: core.Input }],
1340
- outputs: [{ type: core.Input }],
1341
- view: [{ type: core.ViewChild, args: ['view', { read: core.ViewContainerRef, static: true },] }],
1342
- inputs: [{ type: core.Input }]
1253
+ /**
1254
+ * Renders a single JSS component given a rendering definition.
1255
+ * Useful inside templated placeholders.
1256
+ */
1257
+ var RenderComponentComponent = /** @class */ (function () {
1258
+ function RenderComponentComponent(componentFactoryResolver, differs, componentFactory, missingComponentComponent) {
1259
+ this.componentFactoryResolver = componentFactoryResolver;
1260
+ this.differs = differs;
1261
+ this.componentFactory = componentFactory;
1262
+ this.missingComponentComponent = missingComponentComponent;
1263
+ this.destroyed = false;
1264
+ }
1265
+ Object.defineProperty(RenderComponentComponent.prototype, "inputs", {
1266
+ set: function (value) {
1267
+ this._inputs = value;
1268
+ if (!this._differ && value) {
1269
+ this._differ = this.differs.find(value).create();
1270
+ }
1271
+ },
1272
+ enumerable: false,
1273
+ configurable: true
1274
+ });
1275
+ RenderComponentComponent.prototype.ngOnChanges = function (changes) {
1276
+ if (changes.rendering) {
1277
+ this._render();
1278
+ }
1279
+ };
1280
+ RenderComponentComponent.prototype._setComponentInputs = function (componentInstance, inputs) {
1281
+ Object.entries(inputs).forEach(function (_a) {
1282
+ var _b = __read(_a, 2), input = _b[0], inputValue = _b[1];
1283
+ return (componentInstance[input] = inputValue);
1284
+ });
1285
+ };
1286
+ RenderComponentComponent.prototype._subscribeComponentOutputs = function (componentInstance, outputs) {
1287
+ var _this = this;
1288
+ Object.keys(outputs)
1289
+ .filter(function (output) { return componentInstance[output] && componentInstance[output] instanceof rxjs.Observable; })
1290
+ .forEach(function (output) { return componentInstance[output]
1291
+ .pipe(operators.takeWhile(function () { return !_this.destroyed; }))
1292
+ .subscribe(outputs[output]); });
1293
+ };
1294
+ RenderComponentComponent.prototype._render = function () {
1295
+ var _this = this;
1296
+ this.view.clear();
1297
+ if (!this.rendering) {
1298
+ return;
1299
+ }
1300
+ var resolveComponent = isRawRendering(this.rendering)
1301
+ ? Promise.resolve({
1302
+ componentImplementation: RawComponent,
1303
+ componentDefinition: this.rendering,
1304
+ })
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 ||
1313
+ _this.componentFactoryResolver.resolveComponentFactory(rendering.componentImplementation);
1314
+ var componentInstance = _this.view.createComponent(componentFactory, 0).instance;
1315
+ componentInstance.rendering = rendering.componentDefinition;
1316
+ if (_this._inputs) {
1317
+ _this._setComponentInputs(componentInstance, _this._inputs);
1318
+ }
1319
+ if (_this.outputs) {
1320
+ _this._subscribeComponentOutputs(componentInstance, _this.outputs);
1321
+ }
1322
+ });
1323
+ };
1324
+ return RenderComponentComponent;
1325
+ }());
1326
+ RenderComponentComponent.decorators = [
1327
+ { type: core.Component, args: [{
1328
+ selector: 'sc-render-component',
1329
+ template: "\n <ng-template #view></ng-template>\n "
1330
+ },] }
1331
+ ];
1332
+ RenderComponentComponent.ctorParameters = function () { return [
1333
+ { type: core.ComponentFactoryResolver },
1334
+ { type: core.KeyValueDiffers },
1335
+ { type: JssComponentFactoryService },
1336
+ { type: core.Type, decorators: [{ type: core.Inject, args: [PLACEHOLDER_MISSING_COMPONENT_COMPONENT,] }] }
1337
+ ]; };
1338
+ RenderComponentComponent.propDecorators = {
1339
+ rendering: [{ type: core.Input }],
1340
+ outputs: [{ type: core.Input }],
1341
+ view: [{ type: core.ViewChild, args: ['view', { read: core.ViewContainerRef, static: true },] }],
1342
+ inputs: [{ type: core.Input }]
1343
1343
  };
1344
1344
 
1345
- var JssModule = /** @class */ (function () {
1346
- function JssModule() {
1347
- }
1348
- /**
1349
- * Instantiates the JSS module with no component factory.
1350
- * Useful for using it from libraries. Most of the time you'd want withComponents()
1351
- * @returns {ModuleWithProviders<JssModule>} module
1352
- */
1353
- JssModule.forRoot = function () {
1354
- return {
1355
- ngModule: JssModule,
1356
- providers: [LayoutService, common.DatePipe, JssComponentFactoryService],
1357
- };
1358
- };
1359
- /**
1360
- * Instantiates a module for a lazy-loaded JSS component
1361
- * @param {Type<any>} component
1362
- * @returns {ModuleWithProviders<JssModule>} module
1363
- */
1364
- JssModule.forChild = function (component) {
1365
- return {
1366
- ngModule: JssModule,
1367
- providers: [
1368
- { provide: core.ANALYZE_FOR_ENTRY_COMPONENTS, useValue: component, multi: true },
1369
- { provide: router.ROUTES, useValue: [], multi: true },
1370
- { provide: DYNAMIC_COMPONENT, useValue: component },
1371
- ],
1372
- };
1373
- };
1374
- /**
1375
- * Instantiates the JSS module and specifies the mapping from component name to component implementation.
1376
- * Appropriate when defining the set of JSS components that your app is aware of.
1377
- * @param {ComponentNameAndType[]} components
1378
- * @param {ComponentNameAndModule[]} [lazyComponents]
1379
- * @returns {ModuleWithProviders<JssModule>} module
1380
- */
1381
- JssModule.withComponents = function (components, lazyComponents) {
1382
- return {
1383
- ngModule: JssModule,
1384
- providers: __spread([
1385
- {
1386
- provide: core.ANALYZE_FOR_ENTRY_COMPONENTS,
1387
- useValue: components,
1388
- multi: true,
1389
- },
1390
- { provide: PLACEHOLDER_COMPONENTS, useValue: components },
1391
- { provide: PLACEHOLDER_LAZY_COMPONENTS, useValue: lazyComponents || [] },
1392
- { provide: router.ROUTES, useValue: lazyComponents || [], multi: true },
1393
- { provide: PLACEHOLDER_MISSING_COMPONENT_COMPONENT, useValue: MissingComponentComponent }
1394
- ], JssModule.forRoot().providers),
1395
- };
1396
- };
1397
- return JssModule;
1398
- }());
1399
- JssModule.decorators = [
1400
- { type: core.NgModule, args: [{
1401
- imports: [common.CommonModule],
1402
- declarations: [
1403
- FileDirective,
1404
- ImageDirective,
1405
- LinkDirective,
1406
- RouterLinkDirective,
1407
- GenericLinkDirective,
1408
- DateDirective,
1409
- RenderEachDirective,
1410
- RenderEmptyDirective,
1411
- PlaceholderLoadingDirective,
1412
- RenderComponentComponent,
1413
- PlaceholderComponent,
1414
- RawComponent,
1415
- RichTextDirective,
1416
- TextDirective,
1417
- MissingComponentComponent,
1418
- ],
1419
- exports: [
1420
- FileDirective,
1421
- ImageDirective,
1422
- DateDirective,
1423
- LinkDirective,
1424
- RouterLinkDirective,
1425
- GenericLinkDirective,
1426
- RenderEachDirective,
1427
- RenderEmptyDirective,
1428
- RenderComponentComponent,
1429
- PlaceholderComponent,
1430
- PlaceholderLoadingDirective,
1431
- RichTextDirective,
1432
- TextDirective,
1433
- ],
1434
- entryComponents: [RawComponent, MissingComponentComponent],
1435
- },] }
1345
+ var JssModule = /** @class */ (function () {
1346
+ function JssModule() {
1347
+ }
1348
+ /**
1349
+ * Instantiates the JSS module with no component factory.
1350
+ * Useful for using it from libraries. Most of the time you'd want withComponents()
1351
+ * @returns {ModuleWithProviders<JssModule>} module
1352
+ */
1353
+ JssModule.forRoot = function () {
1354
+ return {
1355
+ ngModule: JssModule,
1356
+ providers: [LayoutService, common.DatePipe, JssComponentFactoryService],
1357
+ };
1358
+ };
1359
+ /**
1360
+ * Instantiates a module for a lazy-loaded JSS component
1361
+ * @param {Type<any>} component
1362
+ * @returns {ModuleWithProviders<JssModule>} module
1363
+ */
1364
+ JssModule.forChild = function (component) {
1365
+ return {
1366
+ ngModule: JssModule,
1367
+ providers: [
1368
+ { provide: core.ANALYZE_FOR_ENTRY_COMPONENTS, useValue: component, multi: true },
1369
+ { provide: router.ROUTES, useValue: [], multi: true },
1370
+ { provide: DYNAMIC_COMPONENT, useValue: component },
1371
+ ],
1372
+ };
1373
+ };
1374
+ /**
1375
+ * Instantiates the JSS module and specifies the mapping from component name to component implementation.
1376
+ * Appropriate when defining the set of JSS components that your app is aware of.
1377
+ * @param {ComponentNameAndType[]} components
1378
+ * @param {ComponentNameAndModule[]} [lazyComponents]
1379
+ * @returns {ModuleWithProviders<JssModule>} module
1380
+ */
1381
+ JssModule.withComponents = function (components, lazyComponents) {
1382
+ return {
1383
+ ngModule: JssModule,
1384
+ providers: __spread([
1385
+ {
1386
+ provide: core.ANALYZE_FOR_ENTRY_COMPONENTS,
1387
+ useValue: components,
1388
+ multi: true,
1389
+ },
1390
+ { provide: PLACEHOLDER_COMPONENTS, useValue: components },
1391
+ { provide: PLACEHOLDER_LAZY_COMPONENTS, useValue: lazyComponents || [] },
1392
+ { provide: router.ROUTES, useValue: lazyComponents || [], multi: true },
1393
+ { provide: PLACEHOLDER_MISSING_COMPONENT_COMPONENT, useValue: MissingComponentComponent }
1394
+ ], JssModule.forRoot().providers),
1395
+ };
1396
+ };
1397
+ return JssModule;
1398
+ }());
1399
+ JssModule.decorators = [
1400
+ { type: core.NgModule, args: [{
1401
+ imports: [common.CommonModule],
1402
+ declarations: [
1403
+ FileDirective,
1404
+ ImageDirective,
1405
+ LinkDirective,
1406
+ RouterLinkDirective,
1407
+ GenericLinkDirective,
1408
+ DateDirective,
1409
+ RenderEachDirective,
1410
+ RenderEmptyDirective,
1411
+ PlaceholderLoadingDirective,
1412
+ RenderComponentComponent,
1413
+ PlaceholderComponent,
1414
+ RawComponent,
1415
+ RichTextDirective,
1416
+ TextDirective,
1417
+ MissingComponentComponent,
1418
+ ],
1419
+ exports: [
1420
+ FileDirective,
1421
+ ImageDirective,
1422
+ DateDirective,
1423
+ LinkDirective,
1424
+ RouterLinkDirective,
1425
+ GenericLinkDirective,
1426
+ RenderEachDirective,
1427
+ RenderEmptyDirective,
1428
+ RenderComponentComponent,
1429
+ PlaceholderComponent,
1430
+ PlaceholderLoadingDirective,
1431
+ RichTextDirective,
1432
+ TextDirective,
1433
+ ],
1434
+ entryComponents: [RawComponent, MissingComponentComponent],
1435
+ },] }
1436
1436
  ];
1437
1437
 
1438
- /**
1439
- * Generated bundle index. Do not edit.
1438
+ /**
1439
+ * Generated bundle index. Do not edit.
1440
1440
  */
1441
1441
 
1442
1442
  Object.defineProperty(exports, 'dataApi', {