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

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 (54) hide show
  1. package/dist/bundles/sitecore-jss-sitecore-jss-angular.umd.js +1421 -1421
  2. package/dist/components/date.directive.d.ts +17 -17
  3. package/dist/components/file.directive.d.ts +14 -14
  4. package/dist/components/generic-link.directive.d.ts +14 -14
  5. package/dist/components/image.directive.d.ts +28 -28
  6. package/dist/components/link.directive.d.ts +18 -18
  7. package/dist/components/missing-component.component.d.ts +3 -3
  8. package/dist/components/placeholder-loading.directive.d.ts +5 -5
  9. package/dist/components/placeholder.component.d.ts +45 -45
  10. package/dist/components/placeholder.token.d.ts +30 -30
  11. package/dist/components/raw.component.d.ts +9 -9
  12. package/dist/components/render-component.component.d.ts +29 -29
  13. package/dist/components/render-each.directive.d.ts +5 -5
  14. package/dist/components/render-empty.directive.d.ts +5 -5
  15. package/dist/components/rendering-field.d.ts +20 -20
  16. package/dist/components/rendering.d.ts +5 -5
  17. package/dist/components/rich-text.directive.d.ts +12 -12
  18. package/dist/components/router-link.directive.d.ts +12 -12
  19. package/dist/components/text.directive.d.ts +13 -13
  20. package/dist/esm2015/components/date.directive.js +52 -52
  21. package/dist/esm2015/components/file.directive.js +42 -42
  22. package/dist/esm2015/components/generic-link.directive.js +57 -57
  23. package/dist/esm2015/components/image.directive.js +122 -122
  24. package/dist/esm2015/components/link.directive.js +98 -98
  25. package/dist/esm2015/components/missing-component.component.js +12 -12
  26. package/dist/esm2015/components/placeholder-loading.directive.js +14 -14
  27. package/dist/esm2015/components/placeholder.component.js +191 -191
  28. package/dist/esm2015/components/placeholder.token.js +20 -20
  29. package/dist/esm2015/components/raw.component.js +36 -36
  30. package/dist/esm2015/components/render-component.component.js +88 -88
  31. package/dist/esm2015/components/render-each.directive.js +14 -14
  32. package/dist/esm2015/components/render-empty.directive.js +14 -14
  33. package/dist/esm2015/components/rendering-field.js +1 -1
  34. package/dist/esm2015/components/rendering.js +7 -7
  35. package/dist/esm2015/components/rich-text.directive.js +40 -40
  36. package/dist/esm2015/components/router-link.directive.js +43 -43
  37. package/dist/esm2015/components/text.directive.js +53 -53
  38. package/dist/esm2015/jss-component-factory.service.js +86 -86
  39. package/dist/esm2015/layout-service-error.js +2 -2
  40. package/dist/esm2015/layout.service.js +28 -28
  41. package/dist/esm2015/lib.module.js +111 -111
  42. package/dist/esm2015/public_api.js +16 -16
  43. package/dist/esm2015/sitecore-jss-sitecore-jss-angular.js +12 -12
  44. package/dist/esm2015/utils.js +37 -37
  45. package/dist/fesm2015/sitecore-jss-sitecore-jss-angular.js +1079 -1079
  46. package/dist/jss-component-factory.service.d.ts +21 -21
  47. package/dist/layout-service-error.d.ts +8 -8
  48. package/dist/layout.service.d.ts +8 -8
  49. package/dist/lib.module.d.ts +24 -24
  50. package/dist/package.json +2 -2
  51. package/dist/public_api.d.ts +17 -17
  52. package/dist/sitecore-jss-sitecore-jss-angular.d.ts +12 -12
  53. package/dist/utils.d.ts +10 -10
  54. package/package.json +3 -3
@@ -4,1473 +4,1473 @@
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
- return {};
411
- }
412
- var attrs = {};
413
- for (var i = 0; i < element.attributes.length; i++) {
414
- var attr = element.attributes.item(i);
415
- if (attr) {
416
- attrs[attr.name] = attr.value;
417
- }
418
- }
419
- return attrs;
420
- };
421
- ImageDirective.prototype.renderInlineWrapper = function (editable) {
422
- var span = this.renderer.createElement('span');
423
- span.className = 'sc-image-wrapper';
424
- span.innerHTML = editable;
425
- var parentNode = this.renderer.parentNode(this.elementRef.nativeElement);
426
- this.renderer.insertBefore(parentNode, span, this.elementRef.nativeElement);
427
- parentNode.removeChild(this.elementRef.nativeElement);
428
- this.inlineRef = span;
429
- };
430
- return ImageDirective;
431
- }());
432
- ImageDirective.decorators = [
433
- { type: core.Directive, args: [{ selector: '[scImage]' },] }
434
- ];
435
- ImageDirective.ctorParameters = function () { return [
436
- { type: core.ViewContainerRef },
437
- { type: core.TemplateRef },
438
- { type: core.Renderer2 },
439
- { type: core.ElementRef }
440
- ]; };
441
- ImageDirective.propDecorators = {
442
- field: [{ type: core.Input, args: ['scImage',] }],
443
- editable: [{ type: core.Input, args: ['scImageEditable',] }],
444
- mediaUrlPrefix: [{ type: core.Input, args: ['scImageMediaUrlPrefix',] }],
445
- urlParams: [{ type: core.Input, args: ['scImageUrlParams',] }],
446
- attrs: [{ type: core.Input, args: ['scImageAttrs',] }]
321
+ var ImageDirective = /** @class */ (function () {
322
+ function ImageDirective(viewContainer, templateRef, renderer, elementRef) {
323
+ this.viewContainer = viewContainer;
324
+ this.templateRef = templateRef;
325
+ this.renderer = renderer;
326
+ this.elementRef = elementRef;
327
+ this.inlineRef = null;
328
+ this.editable = true;
329
+ this.urlParams = {};
330
+ this.attrs = {};
331
+ }
332
+ ImageDirective.prototype.ngOnChanges = function (changes) {
333
+ if (changes.field || changes.editable || changes.urlParams || changes.attrs) {
334
+ this.viewContainer.clear();
335
+ if (this.inlineRef) {
336
+ this.inlineRef.remove();
337
+ this.inlineRef = null;
338
+ }
339
+ this.updateView();
340
+ }
341
+ };
342
+ ImageDirective.prototype.updateView = function () {
343
+ var overrideAttrs = Object.assign(Object.assign({}, this.getElementAttrs()), this.attrs);
344
+ var media = this.field;
345
+ if (!media || (!media.editable && !media.value && !media.src)) {
346
+ return;
347
+ }
348
+ var attrs = {};
349
+ // we likely have an experience editor value, should be a string
350
+ if (this.editable && media.editable) {
351
+ var foundImg = sitecoreJss.mediaApi.findEditorImageTag(media.editable);
352
+ if (!foundImg) {
353
+ return this.renderInlineWrapper(media.editable);
354
+ }
355
+ attrs = this.getImageAttrs(foundImg.attrs, overrideAttrs, this.urlParams);
356
+ if (!attrs) {
357
+ return this.renderInlineWrapper(media.editable);
358
+ }
359
+ var tempImg_1 = this.renderer.createElement('img');
360
+ Object.entries(attrs).forEach(function (_a) {
361
+ var _b = __read(_a, 2), key = _b[0], attrValue = _b[1];
362
+ return tempImg_1.setAttribute(key, attrValue);
363
+ });
364
+ var editableMarkup = media.editable.replace(foundImg.imgTag, tempImg_1.outerHTML);
365
+ return this.renderInlineWrapper(editableMarkup);
366
+ }
367
+ // some wise-guy/gal is passing in a 'raw' image object value
368
+ var img = media.src ? media : media.value;
369
+ if (!img) {
370
+ return null;
371
+ }
372
+ attrs = this.getImageAttrs(img, overrideAttrs, this.urlParams);
373
+ if (attrs) {
374
+ this.renderTemplate(attrs);
375
+ }
376
+ };
377
+ ImageDirective.prototype.getImageAttrs = function (fieldAttrs, parsedAttrs, imageParams) {
378
+ var combinedAttrs = Object.assign(Object.assign({}, fieldAttrs), parsedAttrs);
379
+ // eslint-disable-next-line prefer-const
380
+ var src = combinedAttrs.src, srcSet = combinedAttrs.srcSet, otherAttrs = __rest(combinedAttrs, ["src", "srcSet"]);
381
+ if (!src) {
382
+ return null;
383
+ }
384
+ var newAttrs = Object.assign({}, otherAttrs);
385
+ // update image URL for jss handler and image rendering params
386
+ src = sitecoreJss.mediaApi.updateImageUrl(src, imageParams, this.mediaUrlPrefix);
387
+ if (srcSet) {
388
+ // replace with HTML-formatted srcset, including updated image URLs
389
+ newAttrs.srcSet = sitecoreJss.mediaApi.getSrcSet(src, srcSet, imageParams, this.mediaUrlPrefix);
390
+ }
391
+ else {
392
+ newAttrs.src = src;
393
+ }
394
+ return newAttrs;
395
+ };
396
+ ImageDirective.prototype.renderTemplate = function (imageProps) {
397
+ var _this = this;
398
+ var viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
399
+ viewRef.rootNodes.forEach(function (node) {
400
+ Object.entries(imageProps).forEach(function (_a) {
401
+ var _b = __read(_a, 2), key = _b[0], imgPropVal = _b[1];
402
+ return _this.renderer.setAttribute(node, key, imgPropVal);
403
+ });
404
+ });
405
+ };
406
+ ImageDirective.prototype.getElementAttrs = function () {
407
+ var view = this.templateRef.createEmbeddedView(null);
408
+ var element = view.rootNodes[0];
409
+ if (!element) {
410
+ return {};
411
+ }
412
+ var attrs = {};
413
+ for (var i = 0; i < element.attributes.length; i++) {
414
+ var attr = element.attributes.item(i);
415
+ if (attr) {
416
+ attrs[attr.name] = attr.value;
417
+ }
418
+ }
419
+ return attrs;
420
+ };
421
+ ImageDirective.prototype.renderInlineWrapper = function (editable) {
422
+ var span = this.renderer.createElement('span');
423
+ span.className = 'sc-image-wrapper';
424
+ span.innerHTML = editable;
425
+ var parentNode = this.renderer.parentNode(this.elementRef.nativeElement);
426
+ this.renderer.insertBefore(parentNode, span, this.elementRef.nativeElement);
427
+ parentNode.removeChild(this.elementRef.nativeElement);
428
+ this.inlineRef = span;
429
+ };
430
+ return ImageDirective;
431
+ }());
432
+ ImageDirective.decorators = [
433
+ { type: core.Directive, args: [{ selector: '[scImage]' },] }
434
+ ];
435
+ ImageDirective.ctorParameters = function () { return [
436
+ { type: core.ViewContainerRef },
437
+ { type: core.TemplateRef },
438
+ { type: core.Renderer2 },
439
+ { type: core.ElementRef }
440
+ ]; };
441
+ ImageDirective.propDecorators = {
442
+ field: [{ type: core.Input, args: ['scImage',] }],
443
+ editable: [{ type: core.Input, args: ['scImageEditable',] }],
444
+ mediaUrlPrefix: [{ type: core.Input, args: ['scImageMediaUrlPrefix',] }],
445
+ urlParams: [{ type: core.Input, args: ['scImageUrlParams',] }],
446
+ attrs: [{ type: core.Input, args: ['scImageAttrs',] }]
447
447
  };
448
448
 
449
- var LinkDirective = /** @class */ (function () {
450
- function LinkDirective(viewContainer, templateRef, renderer, elementRef) {
451
- this.viewContainer = viewContainer;
452
- this.templateRef = templateRef;
453
- this.renderer = renderer;
454
- this.elementRef = elementRef;
455
- this.inlineRef = null;
456
- this.editable = true;
457
- this.attrs = {};
458
- }
459
- LinkDirective.prototype.ngOnChanges = function (changes) {
460
- if (changes.field || changes.editable || changes.attrs) {
461
- this.viewContainer.clear();
462
- if (this.inlineRef) {
463
- this.inlineRef.remove();
464
- this.inlineRef = null;
465
- }
466
- this.updateView();
467
- }
468
- };
469
- LinkDirective.prototype.updateView = function () {
470
- var field = this.field;
471
- if (this.editable && field && field.editableFirstPart && field.editableLastPart) {
472
- this.renderInlineWrapper(field.editableFirstPart, field.editableLastPart);
473
- }
474
- else if (field && (field.href || field.value)) {
475
- var props = field.href ? field : field.value;
476
- var linkText = field.text || field.value.text || field.href || field.value.href;
477
- var mergedAttrs = Object.assign(Object.assign({}, props), this.attrs);
478
- this.renderTemplate(mergedAttrs, linkText);
479
- }
480
- };
481
- LinkDirective.prototype.renderTemplate = function (props, linkText) {
482
- var _this = this;
483
- var viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
484
- viewRef.rootNodes.forEach(function (node) {
485
- Object.entries(props).forEach(function (_a) {
486
- var _b = __read(_a, 2), key = _b[0], propValue = _b[1];
487
- if (key === 'href') {
488
- var isInvalidLink = !propValue || /^https?:\/\/$/.test(propValue);
489
- if (isInvalidLink) {
490
- if (!node.href) {
491
- return;
492
- }
493
- propValue = node.href;
494
- }
495
- }
496
- if (key === 'class' && node.className) {
497
- propValue += " " + node.className;
498
- }
499
- _this.renderer.setAttribute(node, key, propValue);
500
- });
501
- if (node.childNodes && node.childNodes.length === 0 && linkText) {
502
- node.textContent = linkText;
503
- }
504
- });
505
- };
506
- LinkDirective.prototype.renderInlineWrapper = function (editableFirstPart, editableLastPart) {
507
- var _this = this;
508
- var span = this.renderer.createElement('span');
509
- span.className = 'sc-link-wrapper';
510
- span.innerHTML = editableFirstPart + editableLastPart;
511
- // assign attributes from template to inline wrapper
512
- var attrs = Object.assign(Object.assign({}, this.getElementAttrs()), this.attrs);
513
- Object.entries(attrs).forEach(function (_a) {
514
- var _b = __read(_a, 2), key = _b[0], attrValue = _b[1];
515
- return _this.renderer.setAttribute(span, key, attrValue);
516
- });
517
- this.viewContainer.createEmbeddedView(this.templateRef);
518
- var parentNode = this.renderer.parentNode(this.elementRef.nativeElement);
519
- this.renderer.insertBefore(parentNode, span, this.elementRef.nativeElement);
520
- this.inlineRef = span;
521
- };
522
- LinkDirective.prototype.getElementAttrs = function () {
523
- var view = this.templateRef.createEmbeddedView(null);
524
- var element = view.rootNodes[0];
525
- if (!element) {
526
- return {};
527
- }
528
- var attrs = {};
529
- for (var i = 0; i < element.attributes.length; i++) {
530
- var attr = element.attributes.item(i);
531
- if (attr) {
532
- attrs[attr.name] = attr.value;
533
- }
534
- }
535
- return attrs;
536
- };
537
- return LinkDirective;
538
- }());
539
- LinkDirective.decorators = [
540
- { type: core.Directive, args: [{ selector: '[scLink]' },] }
541
- ];
542
- LinkDirective.ctorParameters = function () { return [
543
- { type: core.ViewContainerRef },
544
- { type: core.TemplateRef },
545
- { type: core.Renderer2 },
546
- { type: core.ElementRef }
547
- ]; };
548
- LinkDirective.propDecorators = {
549
- editable: [{ type: core.Input, args: ['scLinkEditable',] }],
550
- attrs: [{ type: core.Input, args: ['scLinkAttrs',] }],
551
- field: [{ type: core.Input, args: ['scLink',] }]
449
+ var LinkDirective = /** @class */ (function () {
450
+ function LinkDirective(viewContainer, templateRef, renderer, elementRef) {
451
+ this.viewContainer = viewContainer;
452
+ this.templateRef = templateRef;
453
+ this.renderer = renderer;
454
+ this.elementRef = elementRef;
455
+ this.inlineRef = null;
456
+ this.editable = true;
457
+ this.attrs = {};
458
+ }
459
+ LinkDirective.prototype.ngOnChanges = function (changes) {
460
+ if (changes.field || changes.editable || changes.attrs) {
461
+ this.viewContainer.clear();
462
+ if (this.inlineRef) {
463
+ this.inlineRef.remove();
464
+ this.inlineRef = null;
465
+ }
466
+ this.updateView();
467
+ }
468
+ };
469
+ LinkDirective.prototype.updateView = function () {
470
+ var field = this.field;
471
+ if (this.editable && field && field.editableFirstPart && field.editableLastPart) {
472
+ this.renderInlineWrapper(field.editableFirstPart, field.editableLastPart);
473
+ }
474
+ else if (field && (field.href || field.value)) {
475
+ var props = field.href ? field : field.value;
476
+ var linkText = field.text || field.value.text || field.href || field.value.href;
477
+ var mergedAttrs = Object.assign(Object.assign({}, props), this.attrs);
478
+ this.renderTemplate(mergedAttrs, linkText);
479
+ }
480
+ };
481
+ LinkDirective.prototype.renderTemplate = function (props, linkText) {
482
+ var _this = this;
483
+ var viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
484
+ viewRef.rootNodes.forEach(function (node) {
485
+ Object.entries(props).forEach(function (_a) {
486
+ var _b = __read(_a, 2), key = _b[0], propValue = _b[1];
487
+ if (key === 'href') {
488
+ var isInvalidLink = !propValue || /^https?:\/\/$/.test(propValue);
489
+ if (isInvalidLink) {
490
+ if (!node.href) {
491
+ return;
492
+ }
493
+ propValue = node.href;
494
+ }
495
+ }
496
+ if (key === 'class' && node.className) {
497
+ propValue += " " + node.className;
498
+ }
499
+ _this.renderer.setAttribute(node, key, propValue);
500
+ });
501
+ if (node.childNodes && node.childNodes.length === 0 && linkText) {
502
+ node.textContent = linkText;
503
+ }
504
+ });
505
+ };
506
+ LinkDirective.prototype.renderInlineWrapper = function (editableFirstPart, editableLastPart) {
507
+ var _this = this;
508
+ var span = this.renderer.createElement('span');
509
+ span.className = 'sc-link-wrapper';
510
+ span.innerHTML = editableFirstPart + editableLastPart;
511
+ // assign attributes from template to inline wrapper
512
+ var attrs = Object.assign(Object.assign({}, this.getElementAttrs()), this.attrs);
513
+ Object.entries(attrs).forEach(function (_a) {
514
+ var _b = __read(_a, 2), key = _b[0], attrValue = _b[1];
515
+ return _this.renderer.setAttribute(span, key, attrValue);
516
+ });
517
+ this.viewContainer.createEmbeddedView(this.templateRef);
518
+ var parentNode = this.renderer.parentNode(this.elementRef.nativeElement);
519
+ this.renderer.insertBefore(parentNode, span, this.elementRef.nativeElement);
520
+ this.inlineRef = span;
521
+ };
522
+ LinkDirective.prototype.getElementAttrs = function () {
523
+ var view = this.templateRef.createEmbeddedView(null);
524
+ var element = view.rootNodes[0];
525
+ if (!element) {
526
+ return {};
527
+ }
528
+ var attrs = {};
529
+ for (var i = 0; i < element.attributes.length; i++) {
530
+ var attr = element.attributes.item(i);
531
+ if (attr) {
532
+ attrs[attr.name] = attr.value;
533
+ }
534
+ }
535
+ return attrs;
536
+ };
537
+ return LinkDirective;
538
+ }());
539
+ LinkDirective.decorators = [
540
+ { type: core.Directive, args: [{ selector: '[scLink]' },] }
541
+ ];
542
+ LinkDirective.ctorParameters = function () { return [
543
+ { type: core.ViewContainerRef },
544
+ { type: core.TemplateRef },
545
+ { type: core.Renderer2 },
546
+ { type: core.ElementRef }
547
+ ]; };
548
+ LinkDirective.propDecorators = {
549
+ editable: [{ type: core.Input, args: ['scLinkEditable',] }],
550
+ attrs: [{ type: core.Input, args: ['scLinkAttrs',] }],
551
+ field: [{ type: core.Input, args: ['scLink',] }]
552
552
  };
553
553
 
554
- var RouterLinkDirective = /** @class */ (function (_super) {
555
- __extends(RouterLinkDirective, _super);
556
- function RouterLinkDirective(viewContainer, templateRef, renderer, elementRef, router) {
557
- var _this = _super.call(this, viewContainer, templateRef, renderer, elementRef) || this;
558
- _this.router = router;
559
- _this.editable = true;
560
- _this.attrs = {};
561
- return _this;
562
- }
563
- RouterLinkDirective.prototype.renderTemplate = function (props, linkText) {
564
- var _this = this;
565
- var viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
566
- viewRef.rootNodes.forEach(function (node) {
567
- Object.entries(props).forEach(function (_a) {
568
- var _b = __read(_a, 2), key = _b[0], propValue = _b[1];
569
- _this.renderer.setAttribute(node, key, propValue);
570
- if (key === 'href') {
571
- _this.renderer.listen(node, 'click', function (event) {
572
- _this.router.navigate([propValue]);
573
- event.preventDefault();
574
- });
575
- }
576
- });
577
- if (node.childNodes && node.childNodes.length === 0 && linkText) {
578
- node.textContent = linkText;
579
- }
580
- });
581
- };
582
- return RouterLinkDirective;
583
- }(LinkDirective));
584
- RouterLinkDirective.decorators = [
585
- { type: core.Directive, args: [{ selector: '[scRouterLink]' },] }
586
- ];
587
- RouterLinkDirective.ctorParameters = function () { return [
588
- { type: core.ViewContainerRef },
589
- { type: core.TemplateRef },
590
- { type: core.Renderer2 },
591
- { type: core.ElementRef },
592
- { type: router.Router }
593
- ]; };
594
- RouterLinkDirective.propDecorators = {
595
- editable: [{ type: core.Input, args: ['scRouterLinkEditable',] }],
596
- attrs: [{ type: core.Input, args: ['scRouterLinkAttrs',] }],
597
- field: [{ type: core.Input, args: ['scRouterLink',] }]
554
+ var RouterLinkDirective = /** @class */ (function (_super) {
555
+ __extends(RouterLinkDirective, _super);
556
+ function RouterLinkDirective(viewContainer, templateRef, renderer, elementRef, router) {
557
+ var _this = _super.call(this, viewContainer, templateRef, renderer, elementRef) || this;
558
+ _this.router = router;
559
+ _this.editable = true;
560
+ _this.attrs = {};
561
+ return _this;
562
+ }
563
+ RouterLinkDirective.prototype.renderTemplate = function (props, linkText) {
564
+ var _this = this;
565
+ var viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
566
+ viewRef.rootNodes.forEach(function (node) {
567
+ Object.entries(props).forEach(function (_a) {
568
+ var _b = __read(_a, 2), key = _b[0], propValue = _b[1];
569
+ _this.renderer.setAttribute(node, key, propValue);
570
+ if (key === 'href') {
571
+ _this.renderer.listen(node, 'click', function (event) {
572
+ _this.router.navigate([propValue]);
573
+ event.preventDefault();
574
+ });
575
+ }
576
+ });
577
+ if (node.childNodes && node.childNodes.length === 0 && linkText) {
578
+ node.textContent = linkText;
579
+ }
580
+ });
581
+ };
582
+ return RouterLinkDirective;
583
+ }(LinkDirective));
584
+ RouterLinkDirective.decorators = [
585
+ { type: core.Directive, args: [{ selector: '[scRouterLink]' },] }
586
+ ];
587
+ RouterLinkDirective.ctorParameters = function () { return [
588
+ { type: core.ViewContainerRef },
589
+ { type: core.TemplateRef },
590
+ { type: core.Renderer2 },
591
+ { type: core.ElementRef },
592
+ { type: router.Router }
593
+ ]; };
594
+ RouterLinkDirective.propDecorators = {
595
+ editable: [{ type: core.Input, args: ['scRouterLinkEditable',] }],
596
+ attrs: [{ type: core.Input, args: ['scRouterLinkAttrs',] }],
597
+ field: [{ type: core.Input, args: ['scRouterLink',] }]
598
598
  };
599
599
 
600
- var GenericLinkDirective = /** @class */ (function (_super) {
601
- __extends(GenericLinkDirective, _super);
602
- function GenericLinkDirective(viewContainer, templateRef, renderer, elementRef, router) {
603
- var _this = _super.call(this, viewContainer, templateRef, renderer, elementRef) || this;
604
- _this.router = router;
605
- _this.editable = true;
606
- _this.attrs = {};
607
- return _this;
608
- }
609
- GenericLinkDirective.prototype.renderTemplate = function (props, linkText) {
610
- var _this = this;
611
- var viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
612
- viewRef.rootNodes.forEach(function (node) {
613
- Object.entries(props).forEach(function (_a) {
614
- var _b = __read(_a, 2), key = _b[0], propValue = _b[1];
615
- if (key === 'href' && !_this.isAbsoluteUrl(propValue)) {
616
- var urlTree = _this.router.createUrlTree([propValue], _this.extras);
617
- _this.renderer.setAttribute(node, key, _this.router.serializeUrl(urlTree));
618
- _this.renderer.listen(node, 'click', function (event) {
619
- _this.router.navigate([propValue], _this.extras);
620
- event.preventDefault();
621
- });
622
- }
623
- else {
624
- _this.renderer.setAttribute(node, key, propValue);
625
- }
626
- });
627
- if (node.childNodes && node.childNodes.length === 0 && linkText) {
628
- node.textContent = linkText;
629
- }
630
- });
631
- };
632
- GenericLinkDirective.prototype.isAbsoluteUrl = function (url) {
633
- if (url === null) {
634
- return false;
635
- }
636
- if (typeof url !== 'string') {
637
- throw new TypeError('Expected a string');
638
- }
639
- return /^[a-z][a-z0-9+.-]*:/.test(url);
640
- };
641
- return GenericLinkDirective;
642
- }(LinkDirective));
643
- GenericLinkDirective.decorators = [
644
- { type: core.Directive, args: [{ selector: '[scGenericLink]' },] }
645
- ];
646
- GenericLinkDirective.ctorParameters = function () { return [
647
- { type: core.ViewContainerRef },
648
- { type: core.TemplateRef },
649
- { type: core.Renderer2 },
650
- { type: core.ElementRef },
651
- { type: router.Router }
652
- ]; };
653
- GenericLinkDirective.propDecorators = {
654
- editable: [{ type: core.Input, args: ['scGenericLinkEditable',] }],
655
- attrs: [{ type: core.Input, args: ['scGenericLinkAttrs',] }],
656
- field: [{ type: core.Input, args: ['scGenericLink',] }],
657
- extras: [{ type: core.Input, args: ['scGenericLinkExtras',] }]
600
+ var GenericLinkDirective = /** @class */ (function (_super) {
601
+ __extends(GenericLinkDirective, _super);
602
+ function GenericLinkDirective(viewContainer, templateRef, renderer, elementRef, router) {
603
+ var _this = _super.call(this, viewContainer, templateRef, renderer, elementRef) || this;
604
+ _this.router = router;
605
+ _this.editable = true;
606
+ _this.attrs = {};
607
+ return _this;
608
+ }
609
+ GenericLinkDirective.prototype.renderTemplate = function (props, linkText) {
610
+ var _this = this;
611
+ var viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
612
+ viewRef.rootNodes.forEach(function (node) {
613
+ Object.entries(props).forEach(function (_a) {
614
+ var _b = __read(_a, 2), key = _b[0], propValue = _b[1];
615
+ if (key === 'href' && !_this.isAbsoluteUrl(propValue)) {
616
+ var urlTree = _this.router.createUrlTree([propValue], _this.extras);
617
+ _this.renderer.setAttribute(node, key, _this.router.serializeUrl(urlTree));
618
+ _this.renderer.listen(node, 'click', function (event) {
619
+ _this.router.navigate([propValue], _this.extras);
620
+ event.preventDefault();
621
+ });
622
+ }
623
+ else {
624
+ _this.renderer.setAttribute(node, key, propValue);
625
+ }
626
+ });
627
+ if (node.childNodes && node.childNodes.length === 0 && linkText) {
628
+ node.textContent = linkText;
629
+ }
630
+ });
631
+ };
632
+ GenericLinkDirective.prototype.isAbsoluteUrl = function (url) {
633
+ if (url === null) {
634
+ return false;
635
+ }
636
+ if (typeof url !== 'string') {
637
+ throw new TypeError('Expected a string');
638
+ }
639
+ return /^[a-z][a-z0-9+.-]*:/.test(url);
640
+ };
641
+ return GenericLinkDirective;
642
+ }(LinkDirective));
643
+ GenericLinkDirective.decorators = [
644
+ { type: core.Directive, args: [{ selector: '[scGenericLink]' },] }
645
+ ];
646
+ GenericLinkDirective.ctorParameters = function () { return [
647
+ { type: core.ViewContainerRef },
648
+ { type: core.TemplateRef },
649
+ { type: core.Renderer2 },
650
+ { type: core.ElementRef },
651
+ { type: router.Router }
652
+ ]; };
653
+ GenericLinkDirective.propDecorators = {
654
+ editable: [{ type: core.Input, args: ['scGenericLinkEditable',] }],
655
+ attrs: [{ type: core.Input, args: ['scGenericLinkAttrs',] }],
656
+ field: [{ type: core.Input, args: ['scGenericLink',] }],
657
+ extras: [{ type: core.Input, args: ['scGenericLinkExtras',] }]
658
658
  };
659
659
 
660
- /** Registers a statically loaded component */
661
- var ComponentNameAndType = /** @class */ (function () {
662
- function ComponentNameAndType() {
663
- }
664
- return ComponentNameAndType;
665
- }());
666
- /**
667
- * @param {any} object
668
- */
669
- function instanceOfComponentNameAndType(object) {
670
- return 'type' in object;
671
- }
672
- /**
673
- * @param {any} object
674
- */
675
- function instanceOfComponentNameAndModule(object) {
676
- return 'module' in object;
677
- }
678
- var PLACEHOLDER_COMPONENTS = new core.InjectionToken('Sc.placeholder.components');
679
- var PLACEHOLDER_LAZY_COMPONENTS = new core.InjectionToken('Sc.placeholder.lazyComponents');
680
- var PLACEHOLDER_MISSING_COMPONENT_COMPONENT = new core.InjectionToken('Sc.placeholder.missingComponentComponent');
660
+ /** Registers a statically loaded component */
661
+ var ComponentNameAndType = /** @class */ (function () {
662
+ function ComponentNameAndType() {
663
+ }
664
+ return ComponentNameAndType;
665
+ }());
666
+ /**
667
+ * @param {any} object
668
+ */
669
+ function instanceOfComponentNameAndType(object) {
670
+ return 'type' in object;
671
+ }
672
+ /**
673
+ * @param {any} object
674
+ */
675
+ function instanceOfComponentNameAndModule(object) {
676
+ return 'module' in object;
677
+ }
678
+ var PLACEHOLDER_COMPONENTS = new core.InjectionToken('Sc.placeholder.components');
679
+ var PLACEHOLDER_LAZY_COMPONENTS = new core.InjectionToken('Sc.placeholder.lazyComponents');
680
+ var PLACEHOLDER_MISSING_COMPONENT_COMPONENT = new core.InjectionToken('Sc.placeholder.missingComponentComponent');
681
681
  var DYNAMIC_COMPONENT = new core.InjectionToken('Sc.placeholder.dynamicComponent');
682
682
 
683
- var RawComponent = /** @class */ (function () {
684
- function RawComponent(renderer, elementRef) {
685
- this.renderer = renderer;
686
- this.elementRef = elementRef;
687
- }
688
- RawComponent.prototype.ngOnInit = function () {
689
- var el = this.renderer.createElement(this.rendering.name);
690
- var contents = this.renderer.createText(this.rendering.contents || '');
691
- var attributes = this.rendering.attributes;
692
- for (var attr in attributes) {
693
- // eslint-disable-next-line no-prototype-builtins
694
- if (attributes.hasOwnProperty(attr)) {
695
- var value = attributes[attr];
696
- this.renderer.setAttribute(el, attr, value || '');
697
- }
698
- }
699
- this.renderer.appendChild(el, contents);
700
- var parentNode = this.renderer.parentNode(this.elementRef.nativeElement);
701
- this.renderer.insertBefore(parentNode, el, this.elementRef.nativeElement);
702
- parentNode.removeChild(this.elementRef.nativeElement);
703
- };
704
- return RawComponent;
705
- }());
706
- RawComponent.decorators = [
707
- { type: core.Component, args: [{
708
- selector: 'sc-raw',
709
- template: ''
710
- },] }
711
- ];
712
- RawComponent.ctorParameters = function () { return [
713
- { type: core.Renderer2 },
714
- { type: core.ElementRef }
715
- ]; };
716
- RawComponent.propDecorators = {
717
- rendering: [{ type: core.Input }]
683
+ var RawComponent = /** @class */ (function () {
684
+ function RawComponent(renderer, elementRef) {
685
+ this.renderer = renderer;
686
+ this.elementRef = elementRef;
687
+ }
688
+ RawComponent.prototype.ngOnInit = function () {
689
+ var el = this.renderer.createElement(this.rendering.name);
690
+ var contents = this.renderer.createText(this.rendering.contents || '');
691
+ var attributes = this.rendering.attributes;
692
+ for (var attr in attributes) {
693
+ // eslint-disable-next-line no-prototype-builtins
694
+ if (attributes.hasOwnProperty(attr)) {
695
+ var value = attributes[attr];
696
+ this.renderer.setAttribute(el, attr, value || '');
697
+ }
698
+ }
699
+ this.renderer.appendChild(el, contents);
700
+ var parentNode = this.renderer.parentNode(this.elementRef.nativeElement);
701
+ this.renderer.insertBefore(parentNode, el, this.elementRef.nativeElement);
702
+ parentNode.removeChild(this.elementRef.nativeElement);
703
+ };
704
+ return RawComponent;
705
+ }());
706
+ RawComponent.decorators = [
707
+ { type: core.Component, args: [{
708
+ selector: 'sc-raw',
709
+ template: ''
710
+ },] }
711
+ ];
712
+ RawComponent.ctorParameters = function () { return [
713
+ { type: core.Renderer2 },
714
+ { type: core.ElementRef }
715
+ ]; };
716
+ RawComponent.propDecorators = {
717
+ rendering: [{ type: core.Input }]
718
718
  };
719
719
 
720
- /**
721
- * @param {HtmlElementRendering | ComponentRendering} rendering
722
- */
723
- function isRawRendering(rendering) {
724
- return (!rendering.componentName &&
725
- rendering.name !== undefined);
720
+ /**
721
+ * @param {HtmlElementRendering | ComponentRendering} rendering
722
+ */
723
+ function isRawRendering(rendering) {
724
+ return (!rendering.componentName &&
725
+ rendering.name !== undefined);
726
726
  }
727
727
 
728
- var JssComponentFactoryService = /** @class */ (function () {
729
- function JssComponentFactoryService(injector, compiler, components, lazyComponents) {
730
- var _this = this;
731
- this.injector = injector;
732
- this.compiler = compiler;
733
- this.components = components;
734
- this.lazyComponents = lazyComponents;
735
- this.componentMap = new Map();
736
- this.lazyComponentMap = new Map();
737
- this.components.forEach(function (c) { return _this.componentMap.set(c.name, c.type); });
738
- if (this.lazyComponents) {
739
- this.lazyComponents.forEach(function (c) { return _this.lazyComponentMap.set(c.path, c); });
740
- }
741
- }
742
- JssComponentFactoryService.prototype.loadModuleFactory = function (lazyComponent) {
743
- var _this = this;
744
- return lazyComponent.loadChildren().then(function (loaded) {
745
- if (loaded instanceof core.NgModuleFactory) {
746
- return loaded;
747
- }
748
- else {
749
- return _this.compiler.compileModuleAsync(loaded);
750
- }
751
- });
752
- };
753
- JssComponentFactoryService.prototype.getComponent = function (component) {
754
- var _this = this;
755
- var loadedComponent = this.componentMap.get(component.componentName);
756
- if (loadedComponent) {
757
- return Promise.resolve({
758
- componentDefinition: component,
759
- componentImplementation: this.componentMap.get(component.componentName),
760
- });
761
- }
762
- var lazyComponent = this.lazyComponentMap.get(component.componentName);
763
- if (lazyComponent) {
764
- return this.loadModuleFactory(lazyComponent).then(function (ngModuleFactory) {
765
- var componentType = null;
766
- var moduleRef = ngModuleFactory.create(_this.injector);
767
- var dynamicComponentType = moduleRef.injector.get(DYNAMIC_COMPONENT);
768
- if (!dynamicComponentType) {
769
- throw new Error("JssComponentFactoryService: Lazy load module for component \"" + lazyComponent.path + "\" missing DYNAMIC_COMPONENT provider. Missing JssModule.forChild()?");
770
- }
771
- if (component.componentName in dynamicComponentType) {
772
- componentType = dynamicComponentType[component.componentName];
773
- }
774
- else {
775
- if (typeof dynamicComponentType === 'function') {
776
- componentType = dynamicComponentType;
777
- }
778
- else {
779
- throw new Error("JssComponentFactoryService: Lazy load module for component \"" + lazyComponent.path + "\" missing DYNAMIC_COMPONENT provider. Missing JssModule.forChild()?");
780
- }
781
- }
782
- return {
783
- componentDefinition: component,
784
- componentImplementation: componentType,
785
- componentFactory: moduleRef.componentFactoryResolver.resolveComponentFactory(componentType),
786
- };
787
- });
788
- }
789
- return Promise.resolve({
790
- componentDefinition: component,
791
- });
792
- };
793
- JssComponentFactoryService.prototype.getComponents = function (components) {
794
- var _this = this;
795
- // acquire all components and keep them in order while handling their potential async-ness
796
- return Promise.all(components.map(function (component) { return isRawRendering(component) ? _this.getRawComponent(component) : _this.getComponent(component); }));
797
- };
798
- JssComponentFactoryService.prototype.getRawComponent = function (component) {
799
- return Promise.resolve({
800
- componentImplementation: RawComponent,
801
- componentDefinition: component,
802
- });
803
- };
804
- return JssComponentFactoryService;
805
- }());
806
- JssComponentFactoryService.decorators = [
807
- { type: core.Injectable }
808
- ];
809
- JssComponentFactoryService.ctorParameters = function () { return [
810
- { type: core.Injector },
811
- { type: core.Compiler },
812
- { type: Array, decorators: [{ type: core.Inject, args: [PLACEHOLDER_COMPONENTS,] }] },
813
- { type: Array, decorators: [{ type: core.Inject, args: [PLACEHOLDER_LAZY_COMPONENTS,] }] }
728
+ var JssComponentFactoryService = /** @class */ (function () {
729
+ function JssComponentFactoryService(injector, compiler, components, lazyComponents) {
730
+ var _this = this;
731
+ this.injector = injector;
732
+ this.compiler = compiler;
733
+ this.components = components;
734
+ this.lazyComponents = lazyComponents;
735
+ this.componentMap = new Map();
736
+ this.lazyComponentMap = new Map();
737
+ this.components.forEach(function (c) { return _this.componentMap.set(c.name, c.type); });
738
+ if (this.lazyComponents) {
739
+ this.lazyComponents.forEach(function (c) { return _this.lazyComponentMap.set(c.path, c); });
740
+ }
741
+ }
742
+ JssComponentFactoryService.prototype.loadModuleFactory = function (lazyComponent) {
743
+ var _this = this;
744
+ return lazyComponent.loadChildren().then(function (loaded) {
745
+ if (loaded instanceof core.NgModuleFactory) {
746
+ return loaded;
747
+ }
748
+ else {
749
+ return _this.compiler.compileModuleAsync(loaded);
750
+ }
751
+ });
752
+ };
753
+ JssComponentFactoryService.prototype.getComponent = function (component) {
754
+ var _this = this;
755
+ var loadedComponent = this.componentMap.get(component.componentName);
756
+ if (loadedComponent) {
757
+ return Promise.resolve({
758
+ componentDefinition: component,
759
+ componentImplementation: this.componentMap.get(component.componentName),
760
+ });
761
+ }
762
+ var lazyComponent = this.lazyComponentMap.get(component.componentName);
763
+ if (lazyComponent) {
764
+ return this.loadModuleFactory(lazyComponent).then(function (ngModuleFactory) {
765
+ var componentType = null;
766
+ var moduleRef = ngModuleFactory.create(_this.injector);
767
+ var dynamicComponentType = moduleRef.injector.get(DYNAMIC_COMPONENT);
768
+ if (!dynamicComponentType) {
769
+ throw new Error("JssComponentFactoryService: Lazy load module for component \"" + lazyComponent.path + "\" missing DYNAMIC_COMPONENT provider. Missing JssModule.forChild()?");
770
+ }
771
+ if (component.componentName in dynamicComponentType) {
772
+ componentType = dynamicComponentType[component.componentName];
773
+ }
774
+ else {
775
+ if (typeof dynamicComponentType === 'function') {
776
+ componentType = dynamicComponentType;
777
+ }
778
+ else {
779
+ throw new Error("JssComponentFactoryService: Lazy load module for component \"" + lazyComponent.path + "\" missing DYNAMIC_COMPONENT provider. Missing JssModule.forChild()?");
780
+ }
781
+ }
782
+ return {
783
+ componentDefinition: component,
784
+ componentImplementation: componentType,
785
+ componentFactory: moduleRef.componentFactoryResolver.resolveComponentFactory(componentType),
786
+ };
787
+ });
788
+ }
789
+ return Promise.resolve({
790
+ componentDefinition: component,
791
+ });
792
+ };
793
+ JssComponentFactoryService.prototype.getComponents = function (components) {
794
+ var _this = this;
795
+ // acquire all components and keep them in order while handling their potential async-ness
796
+ return Promise.all(components.map(function (component) { return isRawRendering(component) ? _this.getRawComponent(component) : _this.getComponent(component); }));
797
+ };
798
+ JssComponentFactoryService.prototype.getRawComponent = function (component) {
799
+ return Promise.resolve({
800
+ componentImplementation: RawComponent,
801
+ componentDefinition: component,
802
+ });
803
+ };
804
+ return JssComponentFactoryService;
805
+ }());
806
+ JssComponentFactoryService.decorators = [
807
+ { type: core.Injectable }
808
+ ];
809
+ JssComponentFactoryService.ctorParameters = function () { return [
810
+ { type: core.Injector },
811
+ { type: core.Compiler },
812
+ { type: Array, decorators: [{ type: core.Inject, args: [PLACEHOLDER_COMPONENTS,] }] },
813
+ { type: Array, decorators: [{ type: core.Inject, args: [PLACEHOLDER_LAZY_COMPONENTS,] }] }
814
814
  ]; };
815
815
 
816
- var PlaceholderLoadingDirective = /** @class */ (function () {
817
- function PlaceholderLoadingDirective(templateRef) {
818
- this.templateRef = templateRef;
819
- }
820
- return PlaceholderLoadingDirective;
821
- }());
822
- PlaceholderLoadingDirective.decorators = [
823
- { type: core.Directive, args: [{
824
- selector: '[scPlaceholderLoading]',
825
- },] }
826
- ];
827
- PlaceholderLoadingDirective.ctorParameters = function () { return [
828
- { type: core.TemplateRef }
816
+ var PlaceholderLoadingDirective = /** @class */ (function () {
817
+ function PlaceholderLoadingDirective(templateRef) {
818
+ this.templateRef = templateRef;
819
+ }
820
+ return PlaceholderLoadingDirective;
821
+ }());
822
+ PlaceholderLoadingDirective.decorators = [
823
+ { type: core.Directive, args: [{
824
+ selector: '[scPlaceholderLoading]',
825
+ },] }
826
+ ];
827
+ PlaceholderLoadingDirective.ctorParameters = function () { return [
828
+ { type: core.TemplateRef }
829
829
  ]; };
830
830
 
831
- var RenderEachDirective = /** @class */ (function () {
832
- function RenderEachDirective(templateRef) {
833
- this.templateRef = templateRef;
834
- }
835
- return RenderEachDirective;
836
- }());
837
- RenderEachDirective.decorators = [
838
- { type: core.Directive, args: [{
839
- selector: '[renderEach]',
840
- },] }
841
- ];
842
- RenderEachDirective.ctorParameters = function () { return [
843
- { type: core.TemplateRef }
831
+ var RenderEachDirective = /** @class */ (function () {
832
+ function RenderEachDirective(templateRef) {
833
+ this.templateRef = templateRef;
834
+ }
835
+ return RenderEachDirective;
836
+ }());
837
+ RenderEachDirective.decorators = [
838
+ { type: core.Directive, args: [{
839
+ selector: '[renderEach]',
840
+ },] }
841
+ ];
842
+ RenderEachDirective.ctorParameters = function () { return [
843
+ { type: core.TemplateRef }
844
844
  ]; };
845
845
 
846
- var RenderEmptyDirective = /** @class */ (function () {
847
- function RenderEmptyDirective(templateRef) {
848
- this.templateRef = templateRef;
849
- }
850
- return RenderEmptyDirective;
851
- }());
852
- RenderEmptyDirective.decorators = [
853
- { type: core.Directive, args: [{
854
- selector: '[renderEmpty]',
855
- },] }
856
- ];
857
- RenderEmptyDirective.ctorParameters = function () { return [
858
- { type: core.TemplateRef }
846
+ var RenderEmptyDirective = /** @class */ (function () {
847
+ function RenderEmptyDirective(templateRef) {
848
+ this.templateRef = templateRef;
849
+ }
850
+ return RenderEmptyDirective;
851
+ }());
852
+ RenderEmptyDirective.decorators = [
853
+ { type: core.Directive, args: [{
854
+ selector: '[renderEmpty]',
855
+ },] }
856
+ ];
857
+ RenderEmptyDirective.ctorParameters = function () { return [
858
+ { type: core.TemplateRef }
859
859
  ]; };
860
860
 
861
- /**
862
- * @param {ComponentRendering} rendering
863
- * @param {string} name
864
- */
865
- function getPlaceholder(rendering, name) {
866
- if (rendering && rendering.placeholders && Object.keys(rendering.placeholders).length > 0) {
867
- return rendering.placeholders[name];
868
- }
869
- return null;
870
- }
871
- var PlaceholderComponent = /** @class */ (function () {
872
- function PlaceholderComponent(componentFactoryResolver, differs, componentFactory, changeDetectorRef, elementRef, renderer, missingComponentComponent) {
873
- this.componentFactoryResolver = componentFactoryResolver;
874
- this.differs = differs;
875
- this.componentFactory = componentFactory;
876
- this.changeDetectorRef = changeDetectorRef;
877
- this.elementRef = elementRef;
878
- this.renderer = renderer;
879
- this.missingComponentComponent = missingComponentComponent;
880
- this._componentInstances = [];
881
- this.destroyed = false;
882
- this.parentStyleAttribute = '';
883
- this.isLoading = true;
884
- this.loaded = new core.EventEmitter();
885
- }
886
- Object.defineProperty(PlaceholderComponent.prototype, "inputs", {
887
- set: function (value) {
888
- this._inputs = value;
889
- if (!this._differ && value) {
890
- this._differ = this.differs.find(value).create();
891
- }
892
- },
893
- enumerable: false,
894
- configurable: true
895
- });
896
- PlaceholderComponent.prototype.ngOnInit = function () {
897
- // just to ensure the element exists
898
- var elem = this.elementRef.nativeElement;
899
- if (elem) {
900
- var attributes = elem.attributes;
901
- for (var i = 0; i < attributes.length; i++) {
902
- var attr = attributes.item(i);
903
- if (attr && attr.name.indexOf('_ngcontent') !== -1) {
904
- this.parentStyleAttribute = attr.name;
905
- }
906
- }
907
- }
908
- };
909
- PlaceholderComponent.prototype.ngOnDestroy = function () {
910
- this.destroyed = true;
911
- this._componentInstances = [];
912
- };
913
- PlaceholderComponent.prototype.ngOnChanges = function (changes) {
914
- if (changes.rendering || changes.renderings) {
915
- this._render();
916
- }
917
- };
918
- PlaceholderComponent.prototype.ngDoCheck = function () {
919
- var _this = this;
920
- if (!this._differ || !this._inputs || this._componentInstances.length === 0) {
921
- return;
922
- }
923
- var changes = this._differ.diff(this._inputs);
924
- if (!changes) {
925
- return;
926
- }
927
- var updates = {};
928
- changes.forEachRemovedItem(function (change) { return (updates[change.key] = null); });
929
- changes.forEachAddedItem(function (change) { return (updates[change.key] = change.currentValue); });
930
- changes.forEachChangedItem(function (change) { return (updates[change.key] = change.currentValue); });
931
- this._componentInstances.forEach(function (componentInstance) { return _this._setComponentInputs(componentInstance, updates); });
932
- };
933
- PlaceholderComponent.prototype._setComponentInputs = function (componentInstance, inputs) {
934
- Object.entries(inputs).forEach(function (_a) {
935
- var _b = __read(_a, 2), input = _b[0], inputValue = _b[1];
936
- return (componentInstance[input] = inputValue);
937
- });
938
- };
939
- PlaceholderComponent.prototype._subscribeComponentOutputs = function (componentInstance, outputs) {
940
- var _this = this;
941
- Object.keys(outputs)
942
- .filter(function (output) { return componentInstance[output] && componentInstance[output] instanceof rxjs.Observable; })
943
- .forEach(function (output) { return componentInstance[output]
944
- .pipe(operators.takeWhile(function () { return !_this.destroyed; }))
945
- .subscribe(outputs[output]); });
946
- };
947
- PlaceholderComponent.prototype._render = function () {
948
- var _this = this;
949
- this._componentInstances = [];
950
- this.view.clear();
951
- if (!this.rendering && !this.renderings) {
952
- return;
953
- }
954
- if (!this.name && !this.renderings) {
955
- console.warn('Placeholder name was not specified, and explicit renderings array was not passed. Placeholder requires either name and rendering, or renderings.');
956
- this.isLoading = false;
957
- return;
958
- }
959
- var placeholder = this.renderings || getPlaceholder(this.rendering, this.name || '');
960
- if (!placeholder) {
961
- console.warn("Placeholder '" + this.name + "' was not found in the current rendering data", JSON.stringify(this.rendering, null, 2));
962
- this.isLoading = false;
963
- return;
964
- }
965
- // if the placeholder is empty (contains only raw renderings), then we may need to use the empty template if it's defined
966
- var placeholderIsEmpty = placeholder.every(function (rendering) { return isRawRendering(rendering); });
967
- if (this.renderEmptyTemplate && placeholderIsEmpty) {
968
- this.view.createEmbeddedView(this.renderEmptyTemplate.templateRef, {
969
- renderings: placeholder,
970
- });
971
- this.isLoading = false;
972
- }
973
- else {
974
- this.componentFactory
975
- .getComponents(placeholder)
976
- .then(function (components) { return components.forEach(function (rendering, index) {
977
- if (_this.renderEachTemplate && !isRawRendering(rendering.componentDefinition)) {
978
- _this._renderTemplatedComponent(rendering.componentDefinition, index);
979
- }
980
- else {
981
- _this._renderEmbeddedComponent(rendering, index);
982
- }
983
- _this.isLoading = false;
984
- }); })
985
- .then(function () {
986
- _this.changeDetectorRef.markForCheck();
987
- _this.loaded.emit(_this.name);
988
- });
989
- }
990
- };
991
- PlaceholderComponent.prototype._renderTemplatedComponent = function (rendering, index) {
992
- // the render-each template takes care of all component mapping etc
993
- // generally using <sc-render-component> which is about like _renderEmbeddedComponent()
994
- // as a separate component
995
- this.view.createEmbeddedView(this.renderEachTemplate.templateRef, {
996
- rendering: rendering,
997
- index: index,
998
- });
999
- };
1000
- PlaceholderComponent.prototype._renderEmbeddedComponent = function (rendering, index) {
1001
- if (!rendering.componentImplementation) {
1002
- var componentName = rendering.componentDefinition.componentName;
1003
- console.error("Placeholder " + this.name + " contains unknown component " + componentName + ".", "Ensure component is mapped, like:\n JssModule.withComponents([\n { name: '" + componentName + "', type: " + componentName + "Component }\n ])");
1004
- rendering.componentImplementation = this.missingComponentComponent;
1005
- }
1006
- var componentFactory = rendering.componentFactory ||
1007
- this.componentFactoryResolver.resolveComponentFactory(rendering.componentImplementation);
1008
- // apply the parent style attribute _ngcontent
1009
- // work-around for https://github.com/angular/angular/issues/12215
1010
- var createdComponentRef = this.view.createComponent(componentFactory, index);
1011
- if (this.parentStyleAttribute) {
1012
- this.renderer.setAttribute(createdComponentRef.location.nativeElement, this.parentStyleAttribute, '');
1013
- }
1014
- var componentInstance = createdComponentRef.instance;
1015
- componentInstance.rendering = rendering.componentDefinition;
1016
- if (this._inputs) {
1017
- this._setComponentInputs(componentInstance, this._inputs);
1018
- }
1019
- if (this.outputs) {
1020
- this._subscribeComponentOutputs(componentInstance, this.outputs);
1021
- }
1022
- this._componentInstances.push(componentInstance);
1023
- };
1024
- return PlaceholderComponent;
1025
- }());
1026
- PlaceholderComponent.decorators = [
1027
- { type: core.Component, args: [{
1028
- selector: 'sc-placeholder,[sc-placeholder]',
1029
- template: "\n <ng-template\n *ngIf=\"isLoading\"\n [ngTemplateOutlet]=\"placeholderLoading?.templateRef\"\n ></ng-template>\n <ng-template #view></ng-template>\n "
1030
- },] }
1031
- ];
1032
- PlaceholderComponent.ctorParameters = function () { return [
1033
- { type: core.ComponentFactoryResolver },
1034
- { type: core.KeyValueDiffers },
1035
- { type: JssComponentFactoryService },
1036
- { type: core.ChangeDetectorRef },
1037
- { type: core.ElementRef },
1038
- { type: core.Renderer2 },
1039
- { type: core.Type, decorators: [{ type: core.Inject, args: [PLACEHOLDER_MISSING_COMPONENT_COMPONENT,] }] }
1040
- ]; };
1041
- PlaceholderComponent.propDecorators = {
1042
- name: [{ type: core.Input }],
1043
- rendering: [{ type: core.Input }],
1044
- renderings: [{ type: core.Input }],
1045
- outputs: [{ type: core.Input }],
1046
- loaded: [{ type: core.Output }],
1047
- view: [{ type: core.ViewChild, args: ['view', { read: core.ViewContainerRef, static: true },] }],
1048
- renderEachTemplate: [{ type: core.ContentChild, args: [RenderEachDirective, { static: true },] }],
1049
- renderEmptyTemplate: [{ type: core.ContentChild, args: [RenderEmptyDirective, { static: true },] }],
1050
- placeholderLoading: [{ type: core.ContentChild, args: [PlaceholderLoadingDirective, { static: true },] }],
1051
- inputs: [{ type: core.Input }]
861
+ /**
862
+ * @param {ComponentRendering} rendering
863
+ * @param {string} name
864
+ */
865
+ function getPlaceholder(rendering, name) {
866
+ if (rendering && rendering.placeholders && Object.keys(rendering.placeholders).length > 0) {
867
+ return rendering.placeholders[name];
868
+ }
869
+ return null;
870
+ }
871
+ var PlaceholderComponent = /** @class */ (function () {
872
+ function PlaceholderComponent(componentFactoryResolver, differs, componentFactory, changeDetectorRef, elementRef, renderer, missingComponentComponent) {
873
+ this.componentFactoryResolver = componentFactoryResolver;
874
+ this.differs = differs;
875
+ this.componentFactory = componentFactory;
876
+ this.changeDetectorRef = changeDetectorRef;
877
+ this.elementRef = elementRef;
878
+ this.renderer = renderer;
879
+ this.missingComponentComponent = missingComponentComponent;
880
+ this._componentInstances = [];
881
+ this.destroyed = false;
882
+ this.parentStyleAttribute = '';
883
+ this.isLoading = true;
884
+ this.loaded = new core.EventEmitter();
885
+ }
886
+ Object.defineProperty(PlaceholderComponent.prototype, "inputs", {
887
+ set: function (value) {
888
+ this._inputs = value;
889
+ if (!this._differ && value) {
890
+ this._differ = this.differs.find(value).create();
891
+ }
892
+ },
893
+ enumerable: false,
894
+ configurable: true
895
+ });
896
+ PlaceholderComponent.prototype.ngOnInit = function () {
897
+ // just to ensure the element exists
898
+ var elem = this.elementRef.nativeElement;
899
+ if (elem) {
900
+ var attributes = elem.attributes;
901
+ for (var i = 0; i < attributes.length; i++) {
902
+ var attr = attributes.item(i);
903
+ if (attr && attr.name.indexOf('_ngcontent') !== -1) {
904
+ this.parentStyleAttribute = attr.name;
905
+ }
906
+ }
907
+ }
908
+ };
909
+ PlaceholderComponent.prototype.ngOnDestroy = function () {
910
+ this.destroyed = true;
911
+ this._componentInstances = [];
912
+ };
913
+ PlaceholderComponent.prototype.ngOnChanges = function (changes) {
914
+ if (changes.rendering || changes.renderings) {
915
+ this._render();
916
+ }
917
+ };
918
+ PlaceholderComponent.prototype.ngDoCheck = function () {
919
+ var _this = this;
920
+ if (!this._differ || !this._inputs || this._componentInstances.length === 0) {
921
+ return;
922
+ }
923
+ var changes = this._differ.diff(this._inputs);
924
+ if (!changes) {
925
+ return;
926
+ }
927
+ var updates = {};
928
+ changes.forEachRemovedItem(function (change) { return (updates[change.key] = null); });
929
+ changes.forEachAddedItem(function (change) { return (updates[change.key] = change.currentValue); });
930
+ changes.forEachChangedItem(function (change) { return (updates[change.key] = change.currentValue); });
931
+ this._componentInstances.forEach(function (componentInstance) { return _this._setComponentInputs(componentInstance, updates); });
932
+ };
933
+ PlaceholderComponent.prototype._setComponentInputs = function (componentInstance, inputs) {
934
+ Object.entries(inputs).forEach(function (_a) {
935
+ var _b = __read(_a, 2), input = _b[0], inputValue = _b[1];
936
+ return (componentInstance[input] = inputValue);
937
+ });
938
+ };
939
+ PlaceholderComponent.prototype._subscribeComponentOutputs = function (componentInstance, outputs) {
940
+ var _this = this;
941
+ Object.keys(outputs)
942
+ .filter(function (output) { return componentInstance[output] && componentInstance[output] instanceof rxjs.Observable; })
943
+ .forEach(function (output) { return componentInstance[output]
944
+ .pipe(operators.takeWhile(function () { return !_this.destroyed; }))
945
+ .subscribe(outputs[output]); });
946
+ };
947
+ PlaceholderComponent.prototype._render = function () {
948
+ var _this = this;
949
+ this._componentInstances = [];
950
+ this.view.clear();
951
+ if (!this.rendering && !this.renderings) {
952
+ return;
953
+ }
954
+ if (!this.name && !this.renderings) {
955
+ console.warn('Placeholder name was not specified, and explicit renderings array was not passed. Placeholder requires either name and rendering, or renderings.');
956
+ this.isLoading = false;
957
+ return;
958
+ }
959
+ var placeholder = this.renderings || getPlaceholder(this.rendering, this.name || '');
960
+ if (!placeholder) {
961
+ console.warn("Placeholder '" + this.name + "' was not found in the current rendering data", JSON.stringify(this.rendering, null, 2));
962
+ this.isLoading = false;
963
+ return;
964
+ }
965
+ // if the placeholder is empty (contains only raw renderings), then we may need to use the empty template if it's defined
966
+ var placeholderIsEmpty = placeholder.every(function (rendering) { return isRawRendering(rendering); });
967
+ if (this.renderEmptyTemplate && placeholderIsEmpty) {
968
+ this.view.createEmbeddedView(this.renderEmptyTemplate.templateRef, {
969
+ renderings: placeholder,
970
+ });
971
+ this.isLoading = false;
972
+ }
973
+ else {
974
+ this.componentFactory
975
+ .getComponents(placeholder)
976
+ .then(function (components) { return components.forEach(function (rendering, index) {
977
+ if (_this.renderEachTemplate && !isRawRendering(rendering.componentDefinition)) {
978
+ _this._renderTemplatedComponent(rendering.componentDefinition, index);
979
+ }
980
+ else {
981
+ _this._renderEmbeddedComponent(rendering, index);
982
+ }
983
+ _this.isLoading = false;
984
+ }); })
985
+ .then(function () {
986
+ _this.changeDetectorRef.markForCheck();
987
+ _this.loaded.emit(_this.name);
988
+ });
989
+ }
990
+ };
991
+ PlaceholderComponent.prototype._renderTemplatedComponent = function (rendering, index) {
992
+ // the render-each template takes care of all component mapping etc
993
+ // generally using <sc-render-component> which is about like _renderEmbeddedComponent()
994
+ // as a separate component
995
+ this.view.createEmbeddedView(this.renderEachTemplate.templateRef, {
996
+ rendering: rendering,
997
+ index: index,
998
+ });
999
+ };
1000
+ PlaceholderComponent.prototype._renderEmbeddedComponent = function (rendering, index) {
1001
+ if (!rendering.componentImplementation) {
1002
+ var componentName = rendering.componentDefinition.componentName;
1003
+ console.error("Placeholder " + this.name + " contains unknown component " + componentName + ".", "Ensure component is mapped, like:\n JssModule.withComponents([\n { name: '" + componentName + "', type: " + componentName + "Component }\n ])");
1004
+ rendering.componentImplementation = this.missingComponentComponent;
1005
+ }
1006
+ var componentFactory = rendering.componentFactory ||
1007
+ this.componentFactoryResolver.resolveComponentFactory(rendering.componentImplementation);
1008
+ // apply the parent style attribute _ngcontent
1009
+ // work-around for https://github.com/angular/angular/issues/12215
1010
+ var createdComponentRef = this.view.createComponent(componentFactory, index);
1011
+ if (this.parentStyleAttribute) {
1012
+ this.renderer.setAttribute(createdComponentRef.location.nativeElement, this.parentStyleAttribute, '');
1013
+ }
1014
+ var componentInstance = createdComponentRef.instance;
1015
+ componentInstance.rendering = rendering.componentDefinition;
1016
+ if (this._inputs) {
1017
+ this._setComponentInputs(componentInstance, this._inputs);
1018
+ }
1019
+ if (this.outputs) {
1020
+ this._subscribeComponentOutputs(componentInstance, this.outputs);
1021
+ }
1022
+ this._componentInstances.push(componentInstance);
1023
+ };
1024
+ return PlaceholderComponent;
1025
+ }());
1026
+ PlaceholderComponent.decorators = [
1027
+ { type: core.Component, args: [{
1028
+ selector: 'sc-placeholder,[sc-placeholder]',
1029
+ template: "\n <ng-template\n *ngIf=\"isLoading\"\n [ngTemplateOutlet]=\"placeholderLoading?.templateRef\"\n ></ng-template>\n <ng-template #view></ng-template>\n "
1030
+ },] }
1031
+ ];
1032
+ PlaceholderComponent.ctorParameters = function () { return [
1033
+ { type: core.ComponentFactoryResolver },
1034
+ { type: core.KeyValueDiffers },
1035
+ { type: JssComponentFactoryService },
1036
+ { type: core.ChangeDetectorRef },
1037
+ { type: core.ElementRef },
1038
+ { type: core.Renderer2 },
1039
+ { type: core.Type, decorators: [{ type: core.Inject, args: [PLACEHOLDER_MISSING_COMPONENT_COMPONENT,] }] }
1040
+ ]; };
1041
+ PlaceholderComponent.propDecorators = {
1042
+ name: [{ type: core.Input }],
1043
+ rendering: [{ type: core.Input }],
1044
+ renderings: [{ type: core.Input }],
1045
+ outputs: [{ type: core.Input }],
1046
+ loaded: [{ type: core.Output }],
1047
+ view: [{ type: core.ViewChild, args: ['view', { read: core.ViewContainerRef, static: true },] }],
1048
+ renderEachTemplate: [{ type: core.ContentChild, args: [RenderEachDirective, { static: true },] }],
1049
+ renderEmptyTemplate: [{ type: core.ContentChild, args: [RenderEmptyDirective, { static: true },] }],
1050
+ placeholderLoading: [{ type: core.ContentChild, args: [PlaceholderLoadingDirective, { static: true },] }],
1051
+ inputs: [{ type: core.Input }]
1052
1052
  };
1053
1053
 
1054
- var RichTextDirective = /** @class */ (function () {
1055
- function RichTextDirective(viewContainer, templateRef) {
1056
- this.viewContainer = viewContainer;
1057
- this.templateRef = templateRef;
1058
- this.editable = true;
1059
- }
1060
- RichTextDirective.prototype.ngOnChanges = function (changes) {
1061
- if (changes.field || changes.editable) {
1062
- if (!this.viewRef) {
1063
- this.viewContainer.clear();
1064
- this.viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
1065
- }
1066
- this.updateView();
1067
- }
1068
- };
1069
- RichTextDirective.prototype.updateView = function () {
1070
- var field = this.field;
1071
- if (!field || (!field.editable && !field.value)) {
1072
- return;
1073
- }
1074
- var html = field.editable && this.editable ? field.editable : field.value;
1075
- this.viewRef.rootNodes.forEach(function (node) {
1076
- node.innerHTML = html;
1077
- });
1078
- };
1079
- return RichTextDirective;
1080
- }());
1081
- RichTextDirective.decorators = [
1082
- { type: core.Directive, args: [{
1083
- selector: '[scRichText]',
1084
- },] }
1085
- ];
1086
- RichTextDirective.ctorParameters = function () { return [
1087
- { type: core.ViewContainerRef },
1088
- { type: core.TemplateRef }
1089
- ]; };
1090
- RichTextDirective.propDecorators = {
1091
- editable: [{ type: core.Input, args: ['scRichTextEditable',] }],
1092
- field: [{ type: core.Input, args: ['scRichText',] }]
1054
+ var RichTextDirective = /** @class */ (function () {
1055
+ function RichTextDirective(viewContainer, templateRef) {
1056
+ this.viewContainer = viewContainer;
1057
+ this.templateRef = templateRef;
1058
+ this.editable = true;
1059
+ }
1060
+ RichTextDirective.prototype.ngOnChanges = function (changes) {
1061
+ if (changes.field || changes.editable) {
1062
+ if (!this.viewRef) {
1063
+ this.viewContainer.clear();
1064
+ this.viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
1065
+ }
1066
+ this.updateView();
1067
+ }
1068
+ };
1069
+ RichTextDirective.prototype.updateView = function () {
1070
+ var field = this.field;
1071
+ if (!field || (!field.editable && !field.value)) {
1072
+ return;
1073
+ }
1074
+ var html = field.editable && this.editable ? field.editable : field.value;
1075
+ this.viewRef.rootNodes.forEach(function (node) {
1076
+ node.innerHTML = html;
1077
+ });
1078
+ };
1079
+ return RichTextDirective;
1080
+ }());
1081
+ RichTextDirective.decorators = [
1082
+ { type: core.Directive, args: [{
1083
+ selector: '[scRichText]',
1084
+ },] }
1085
+ ];
1086
+ RichTextDirective.ctorParameters = function () { return [
1087
+ { type: core.ViewContainerRef },
1088
+ { type: core.TemplateRef }
1089
+ ]; };
1090
+ RichTextDirective.propDecorators = {
1091
+ editable: [{ type: core.Input, args: ['scRichTextEditable',] }],
1092
+ field: [{ type: core.Input, args: ['scRichText',] }]
1093
1093
  };
1094
1094
 
1095
- var TextDirective = /** @class */ (function () {
1096
- function TextDirective(viewContainer, templateRef) {
1097
- this.viewContainer = viewContainer;
1098
- this.templateRef = templateRef;
1099
- this.editable = true;
1100
- this.encode = true;
1101
- }
1102
- TextDirective.prototype.ngOnChanges = function (changes) {
1103
- if (changes.field || changes.editable || changes.encode) {
1104
- if (!this.viewRef) {
1105
- this.viewContainer.clear();
1106
- this.viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
1107
- }
1108
- this.updateView();
1109
- }
1110
- };
1111
- TextDirective.prototype.updateView = function () {
1112
- var field = this.field;
1113
- var editable = this.editable;
1114
- if (!field || (!field.editable && (field.value === undefined || field.value === ''))) {
1115
- return;
1116
- }
1117
- // can't use editable value if we want to output unencoded
1118
- if (!this.encode) {
1119
- editable = false;
1120
- }
1121
- var html = field.editable && editable ? field.editable : field.value;
1122
- var setDangerously = (field.editable && editable) || !this.encode;
1123
- this.viewRef.rootNodes.forEach(function (node) {
1124
- if (setDangerously) {
1125
- node.innerHTML = html;
1126
- }
1127
- else {
1128
- node.textContent = html;
1129
- }
1130
- });
1131
- };
1132
- return TextDirective;
1133
- }());
1134
- TextDirective.decorators = [
1135
- { type: core.Directive, args: [{
1136
- selector: '[scText]',
1137
- },] }
1138
- ];
1139
- TextDirective.ctorParameters = function () { return [
1140
- { type: core.ViewContainerRef },
1141
- { type: core.TemplateRef }
1142
- ]; };
1143
- TextDirective.propDecorators = {
1144
- editable: [{ type: core.Input, args: ['scTextEditable',] }],
1145
- encode: [{ type: core.Input, args: ['scTextEncode',] }],
1146
- field: [{ type: core.Input, args: ['scText',] }]
1095
+ var TextDirective = /** @class */ (function () {
1096
+ function TextDirective(viewContainer, templateRef) {
1097
+ this.viewContainer = viewContainer;
1098
+ this.templateRef = templateRef;
1099
+ this.editable = true;
1100
+ this.encode = true;
1101
+ }
1102
+ TextDirective.prototype.ngOnChanges = function (changes) {
1103
+ if (changes.field || changes.editable || changes.encode) {
1104
+ if (!this.viewRef) {
1105
+ this.viewContainer.clear();
1106
+ this.viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
1107
+ }
1108
+ this.updateView();
1109
+ }
1110
+ };
1111
+ TextDirective.prototype.updateView = function () {
1112
+ var field = this.field;
1113
+ var editable = this.editable;
1114
+ if (!field || (!field.editable && (field.value === undefined || field.value === ''))) {
1115
+ return;
1116
+ }
1117
+ // can't use editable value if we want to output unencoded
1118
+ if (!this.encode) {
1119
+ editable = false;
1120
+ }
1121
+ var html = field.editable && editable ? field.editable : field.value;
1122
+ var setDangerously = (field.editable && editable) || !this.encode;
1123
+ this.viewRef.rootNodes.forEach(function (node) {
1124
+ if (setDangerously) {
1125
+ node.innerHTML = html;
1126
+ }
1127
+ else {
1128
+ node.textContent = html;
1129
+ }
1130
+ });
1131
+ };
1132
+ return TextDirective;
1133
+ }());
1134
+ TextDirective.decorators = [
1135
+ { type: core.Directive, args: [{
1136
+ selector: '[scText]',
1137
+ },] }
1138
+ ];
1139
+ TextDirective.ctorParameters = function () { return [
1140
+ { type: core.ViewContainerRef },
1141
+ { type: core.TemplateRef }
1142
+ ]; };
1143
+ TextDirective.propDecorators = {
1144
+ editable: [{ type: core.Input, args: ['scTextEditable',] }],
1145
+ encode: [{ type: core.Input, args: ['scTextEncode',] }],
1146
+ field: [{ type: core.Input, args: ['scText',] }]
1147
1147
  };
1148
1148
 
1149
- var LayoutServiceError = /** @class */ (function () {
1150
- function LayoutServiceError() {
1151
- }
1152
- return LayoutServiceError;
1149
+ var LayoutServiceError = /** @class */ (function () {
1150
+ function LayoutServiceError() {
1151
+ }
1152
+ return LayoutServiceError;
1153
1153
  }());
1154
1154
 
1155
- // TODO: these are deprecated and we should switch to using new methods
1156
- var fetchRouteData = sitecoreJss.dataApi.fetchRouteData, fetchPlaceholderData = sitecoreJss.dataApi.fetchPlaceholderData;
1157
- var LayoutService = /** @class */ (function () {
1158
- function LayoutService() {
1159
- }
1160
- LayoutService.getLayoutServiceError = function (error) {
1161
- var layoutServiceError = new LayoutServiceError();
1162
- var response = error.response;
1163
- if (response) {
1164
- layoutServiceError.status = response.status;
1165
- layoutServiceError.statusText = response.statusText;
1166
- layoutServiceError.data = response.data;
1167
- }
1168
- return rxjs.throwError(layoutServiceError);
1169
- };
1170
- LayoutService.prototype.getRouteData = function (route, options) {
1171
- return rxjs.from(fetchRouteData(route, options)).pipe(operators.catchError(LayoutService.getLayoutServiceError));
1172
- };
1173
- LayoutService.prototype.getPlaceholderData = function (route, placeholderName, options) {
1174
- return rxjs.from(fetchPlaceholderData(placeholderName, route, options)).pipe(operators.catchError(LayoutService.getLayoutServiceError));
1175
- };
1176
- return LayoutService;
1177
- }());
1178
- LayoutService.decorators = [
1179
- { type: core.Injectable }
1155
+ // TODO: these are deprecated and we should switch to using new methods
1156
+ var fetchRouteData = sitecoreJss.dataApi.fetchRouteData, fetchPlaceholderData = sitecoreJss.dataApi.fetchPlaceholderData;
1157
+ var LayoutService = /** @class */ (function () {
1158
+ function LayoutService() {
1159
+ }
1160
+ LayoutService.getLayoutServiceError = function (error) {
1161
+ var layoutServiceError = new LayoutServiceError();
1162
+ var response = error.response;
1163
+ if (response) {
1164
+ layoutServiceError.status = response.status;
1165
+ layoutServiceError.statusText = response.statusText;
1166
+ layoutServiceError.data = response.data;
1167
+ }
1168
+ return rxjs.throwError(layoutServiceError);
1169
+ };
1170
+ LayoutService.prototype.getRouteData = function (route, options) {
1171
+ return rxjs.from(fetchRouteData(route, options)).pipe(operators.catchError(LayoutService.getLayoutServiceError));
1172
+ };
1173
+ LayoutService.prototype.getPlaceholderData = function (route, placeholderName, options) {
1174
+ return rxjs.from(fetchPlaceholderData(placeholderName, route, options)).pipe(operators.catchError(LayoutService.getLayoutServiceError));
1175
+ };
1176
+ return LayoutService;
1177
+ }());
1178
+ LayoutService.decorators = [
1179
+ { type: core.Injectable }
1180
1180
  ];
1181
1181
 
1182
- var DateDirective = /** @class */ (function () {
1183
- function DateDirective(viewContainer, templateRef, datePipe) {
1184
- this.viewContainer = viewContainer;
1185
- this.templateRef = templateRef;
1186
- this.datePipe = datePipe;
1187
- this.editable = true;
1188
- }
1189
- DateDirective.prototype.ngOnChanges = function (changes) {
1190
- if (changes.field || changes.format) {
1191
- if (!this.viewRef) {
1192
- this.viewContainer.clear();
1193
- this.viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
1194
- }
1195
- this.updateView();
1196
- }
1197
- };
1198
- DateDirective.prototype.updateView = function () {
1199
- var _this = this;
1200
- var field = this.field;
1201
- if (!field || (!field.editable && !field.value)) {
1202
- return;
1203
- }
1204
- var html = field.editable && this.editable ? field.editable : field.value;
1205
- var setDangerously = field.editable && this.editable;
1206
- this.viewRef.rootNodes.forEach(function (node) {
1207
- if (setDangerously) {
1208
- node.innerHTML = html;
1209
- }
1210
- else {
1211
- node.textContent = _this.datePipe.transform(html, _this.format, _this.timezone, _this.locale);
1212
- }
1213
- });
1214
- };
1215
- return DateDirective;
1216
- }());
1217
- DateDirective.decorators = [
1218
- { type: core.Directive, args: [{
1219
- selector: '[scDate]',
1220
- },] }
1221
- ];
1222
- DateDirective.ctorParameters = function () { return [
1223
- { type: core.ViewContainerRef },
1224
- { type: core.TemplateRef },
1225
- { type: common.DatePipe }
1226
- ]; };
1227
- DateDirective.propDecorators = {
1228
- format: [{ type: core.Input, args: ['scDateFormat',] }],
1229
- timezone: [{ type: core.Input, args: ['scDateTimezone',] }],
1230
- locale: [{ type: core.Input, args: ['scDateLocale',] }],
1231
- editable: [{ type: core.Input, args: ['scDateEditable',] }],
1232
- field: [{ type: core.Input, args: ['scDate',] }]
1182
+ var DateDirective = /** @class */ (function () {
1183
+ function DateDirective(viewContainer, templateRef, datePipe) {
1184
+ this.viewContainer = viewContainer;
1185
+ this.templateRef = templateRef;
1186
+ this.datePipe = datePipe;
1187
+ this.editable = true;
1188
+ }
1189
+ DateDirective.prototype.ngOnChanges = function (changes) {
1190
+ if (changes.field || changes.format) {
1191
+ if (!this.viewRef) {
1192
+ this.viewContainer.clear();
1193
+ this.viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
1194
+ }
1195
+ this.updateView();
1196
+ }
1197
+ };
1198
+ DateDirective.prototype.updateView = function () {
1199
+ var _this = this;
1200
+ var field = this.field;
1201
+ if (!field || (!field.editable && !field.value)) {
1202
+ return;
1203
+ }
1204
+ var html = field.editable && this.editable ? field.editable : field.value;
1205
+ var setDangerously = field.editable && this.editable;
1206
+ this.viewRef.rootNodes.forEach(function (node) {
1207
+ if (setDangerously) {
1208
+ node.innerHTML = html;
1209
+ }
1210
+ else {
1211
+ node.textContent = _this.datePipe.transform(html, _this.format, _this.timezone, _this.locale);
1212
+ }
1213
+ });
1214
+ };
1215
+ return DateDirective;
1216
+ }());
1217
+ DateDirective.decorators = [
1218
+ { type: core.Directive, args: [{
1219
+ selector: '[scDate]',
1220
+ },] }
1221
+ ];
1222
+ DateDirective.ctorParameters = function () { return [
1223
+ { type: core.ViewContainerRef },
1224
+ { type: core.TemplateRef },
1225
+ { type: common.DatePipe }
1226
+ ]; };
1227
+ DateDirective.propDecorators = {
1228
+ format: [{ type: core.Input, args: ['scDateFormat',] }],
1229
+ timezone: [{ type: core.Input, args: ['scDateTimezone',] }],
1230
+ locale: [{ type: core.Input, args: ['scDateLocale',] }],
1231
+ editable: [{ type: core.Input, args: ['scDateEditable',] }],
1232
+ field: [{ type: core.Input, args: ['scDate',] }]
1233
1233
  };
1234
1234
 
1235
- var MissingComponentComponent = /** @class */ (function () {
1236
- function MissingComponentComponent() {
1237
- }
1238
- return MissingComponentComponent;
1239
- }());
1240
- MissingComponentComponent.decorators = [
1241
- { type: core.Component, args: [{
1242
- selector: 'sc-missing-component',
1243
- 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 "
1244
- },] }
1245
- ];
1246
- MissingComponentComponent.propDecorators = {
1247
- rendering: [{ type: core.Input }]
1235
+ var MissingComponentComponent = /** @class */ (function () {
1236
+ function MissingComponentComponent() {
1237
+ }
1238
+ return MissingComponentComponent;
1239
+ }());
1240
+ MissingComponentComponent.decorators = [
1241
+ { type: core.Component, args: [{
1242
+ selector: 'sc-missing-component',
1243
+ 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 "
1244
+ },] }
1245
+ ];
1246
+ MissingComponentComponent.propDecorators = {
1247
+ rendering: [{ type: core.Input }]
1248
1248
  };
1249
1249
 
1250
- /**
1251
- * Renders a single JSS component given a rendering definition.
1252
- * Useful inside templated placeholders.
1253
- */
1254
- var RenderComponentComponent = /** @class */ (function () {
1255
- function RenderComponentComponent(componentFactoryResolver, differs, componentFactory, missingComponentComponent) {
1256
- this.componentFactoryResolver = componentFactoryResolver;
1257
- this.differs = differs;
1258
- this.componentFactory = componentFactory;
1259
- this.missingComponentComponent = missingComponentComponent;
1260
- this.destroyed = false;
1261
- }
1262
- Object.defineProperty(RenderComponentComponent.prototype, "inputs", {
1263
- set: function (value) {
1264
- this._inputs = value;
1265
- if (!this._differ && value) {
1266
- this._differ = this.differs.find(value).create();
1267
- }
1268
- },
1269
- enumerable: false,
1270
- configurable: true
1271
- });
1272
- RenderComponentComponent.prototype.ngOnChanges = function (changes) {
1273
- if (changes.rendering) {
1274
- this._render();
1275
- }
1276
- };
1277
- RenderComponentComponent.prototype._setComponentInputs = function (componentInstance, inputs) {
1278
- Object.entries(inputs).forEach(function (_a) {
1279
- var _b = __read(_a, 2), input = _b[0], inputValue = _b[1];
1280
- return (componentInstance[input] = inputValue);
1281
- });
1282
- };
1283
- RenderComponentComponent.prototype._subscribeComponentOutputs = function (componentInstance, outputs) {
1284
- var _this = this;
1285
- Object.keys(outputs)
1286
- .filter(function (output) { return componentInstance[output] && componentInstance[output] instanceof rxjs.Observable; })
1287
- .forEach(function (output) { return componentInstance[output]
1288
- .pipe(operators.takeWhile(function () { return !_this.destroyed; }))
1289
- .subscribe(outputs[output]); });
1290
- };
1291
- RenderComponentComponent.prototype._render = function () {
1292
- var _this = this;
1293
- this.view.clear();
1294
- if (!this.rendering) {
1295
- return;
1296
- }
1297
- var resolveComponent = isRawRendering(this.rendering)
1298
- ? Promise.resolve({
1299
- componentImplementation: RawComponent,
1300
- componentDefinition: this.rendering,
1301
- })
1302
- : this.componentFactory.getComponent(this.rendering);
1303
- resolveComponent.then(function (rendering) {
1304
- if (!rendering.componentImplementation) {
1305
- var componentName = rendering.componentDefinition.componentName;
1306
- console.error("Attempted to render unknown component " + componentName + ".", "Ensure component is mapped, like:\n JssModule.withComponents([\n { name: '" + componentName + "', type: " + componentName + "Component }\n ])");
1307
- rendering.componentImplementation = _this.missingComponentComponent;
1308
- }
1309
- var componentFactory = rendering.componentFactory ||
1310
- _this.componentFactoryResolver.resolveComponentFactory(rendering.componentImplementation);
1311
- var componentInstance = _this.view.createComponent(componentFactory, 0).instance;
1312
- componentInstance.rendering = rendering.componentDefinition;
1313
- if (_this._inputs) {
1314
- _this._setComponentInputs(componentInstance, _this._inputs);
1315
- }
1316
- if (_this.outputs) {
1317
- _this._subscribeComponentOutputs(componentInstance, _this.outputs);
1318
- }
1319
- });
1320
- };
1321
- return RenderComponentComponent;
1322
- }());
1323
- RenderComponentComponent.decorators = [
1324
- { type: core.Component, args: [{
1325
- selector: 'sc-render-component',
1326
- template: "\n <ng-template #view></ng-template>\n "
1327
- },] }
1328
- ];
1329
- RenderComponentComponent.ctorParameters = function () { return [
1330
- { type: core.ComponentFactoryResolver },
1331
- { type: core.KeyValueDiffers },
1332
- { type: JssComponentFactoryService },
1333
- { type: core.Type, decorators: [{ type: core.Inject, args: [PLACEHOLDER_MISSING_COMPONENT_COMPONENT,] }] }
1334
- ]; };
1335
- RenderComponentComponent.propDecorators = {
1336
- rendering: [{ type: core.Input }],
1337
- outputs: [{ type: core.Input }],
1338
- view: [{ type: core.ViewChild, args: ['view', { read: core.ViewContainerRef, static: true },] }],
1339
- inputs: [{ type: core.Input }]
1250
+ /**
1251
+ * Renders a single JSS component given a rendering definition.
1252
+ * Useful inside templated placeholders.
1253
+ */
1254
+ var RenderComponentComponent = /** @class */ (function () {
1255
+ function RenderComponentComponent(componentFactoryResolver, differs, componentFactory, missingComponentComponent) {
1256
+ this.componentFactoryResolver = componentFactoryResolver;
1257
+ this.differs = differs;
1258
+ this.componentFactory = componentFactory;
1259
+ this.missingComponentComponent = missingComponentComponent;
1260
+ this.destroyed = false;
1261
+ }
1262
+ Object.defineProperty(RenderComponentComponent.prototype, "inputs", {
1263
+ set: function (value) {
1264
+ this._inputs = value;
1265
+ if (!this._differ && value) {
1266
+ this._differ = this.differs.find(value).create();
1267
+ }
1268
+ },
1269
+ enumerable: false,
1270
+ configurable: true
1271
+ });
1272
+ RenderComponentComponent.prototype.ngOnChanges = function (changes) {
1273
+ if (changes.rendering) {
1274
+ this._render();
1275
+ }
1276
+ };
1277
+ RenderComponentComponent.prototype._setComponentInputs = function (componentInstance, inputs) {
1278
+ Object.entries(inputs).forEach(function (_a) {
1279
+ var _b = __read(_a, 2), input = _b[0], inputValue = _b[1];
1280
+ return (componentInstance[input] = inputValue);
1281
+ });
1282
+ };
1283
+ RenderComponentComponent.prototype._subscribeComponentOutputs = function (componentInstance, outputs) {
1284
+ var _this = this;
1285
+ Object.keys(outputs)
1286
+ .filter(function (output) { return componentInstance[output] && componentInstance[output] instanceof rxjs.Observable; })
1287
+ .forEach(function (output) { return componentInstance[output]
1288
+ .pipe(operators.takeWhile(function () { return !_this.destroyed; }))
1289
+ .subscribe(outputs[output]); });
1290
+ };
1291
+ RenderComponentComponent.prototype._render = function () {
1292
+ var _this = this;
1293
+ this.view.clear();
1294
+ if (!this.rendering) {
1295
+ return;
1296
+ }
1297
+ var resolveComponent = isRawRendering(this.rendering)
1298
+ ? Promise.resolve({
1299
+ componentImplementation: RawComponent,
1300
+ componentDefinition: this.rendering,
1301
+ })
1302
+ : this.componentFactory.getComponent(this.rendering);
1303
+ resolveComponent.then(function (rendering) {
1304
+ if (!rendering.componentImplementation) {
1305
+ var componentName = rendering.componentDefinition.componentName;
1306
+ console.error("Attempted to render unknown component " + componentName + ".", "Ensure component is mapped, like:\n JssModule.withComponents([\n { name: '" + componentName + "', type: " + componentName + "Component }\n ])");
1307
+ rendering.componentImplementation = _this.missingComponentComponent;
1308
+ }
1309
+ var componentFactory = rendering.componentFactory ||
1310
+ _this.componentFactoryResolver.resolveComponentFactory(rendering.componentImplementation);
1311
+ var componentInstance = _this.view.createComponent(componentFactory, 0).instance;
1312
+ componentInstance.rendering = rendering.componentDefinition;
1313
+ if (_this._inputs) {
1314
+ _this._setComponentInputs(componentInstance, _this._inputs);
1315
+ }
1316
+ if (_this.outputs) {
1317
+ _this._subscribeComponentOutputs(componentInstance, _this.outputs);
1318
+ }
1319
+ });
1320
+ };
1321
+ return RenderComponentComponent;
1322
+ }());
1323
+ RenderComponentComponent.decorators = [
1324
+ { type: core.Component, args: [{
1325
+ selector: 'sc-render-component',
1326
+ template: "\n <ng-template #view></ng-template>\n "
1327
+ },] }
1328
+ ];
1329
+ RenderComponentComponent.ctorParameters = function () { return [
1330
+ { type: core.ComponentFactoryResolver },
1331
+ { type: core.KeyValueDiffers },
1332
+ { type: JssComponentFactoryService },
1333
+ { type: core.Type, decorators: [{ type: core.Inject, args: [PLACEHOLDER_MISSING_COMPONENT_COMPONENT,] }] }
1334
+ ]; };
1335
+ RenderComponentComponent.propDecorators = {
1336
+ rendering: [{ type: core.Input }],
1337
+ outputs: [{ type: core.Input }],
1338
+ view: [{ type: core.ViewChild, args: ['view', { read: core.ViewContainerRef, static: true },] }],
1339
+ inputs: [{ type: core.Input }]
1340
1340
  };
1341
1341
 
1342
- var JssModule = /** @class */ (function () {
1343
- function JssModule() {
1344
- }
1345
- /**
1346
- * Instantiates the JSS module with no component factory.
1347
- * Useful for using it from libraries. Most of the time you'd want withComponents()
1348
- * @returns {ModuleWithProviders<JssModule>} module
1349
- */
1350
- JssModule.forRoot = function () {
1351
- return {
1352
- ngModule: JssModule,
1353
- providers: [LayoutService, common.DatePipe, JssComponentFactoryService],
1354
- };
1355
- };
1356
- /**
1357
- * Instantiates a module for a lazy-loaded JSS component
1358
- * @param {Type<any>} component
1359
- * @returns {ModuleWithProviders<JssModule>} module
1360
- */
1361
- JssModule.forChild = function (component) {
1362
- return {
1363
- ngModule: JssModule,
1364
- providers: [
1365
- { provide: core.ANALYZE_FOR_ENTRY_COMPONENTS, useValue: component, multi: true },
1366
- { provide: router.ROUTES, useValue: [], multi: true },
1367
- { provide: DYNAMIC_COMPONENT, useValue: component },
1368
- ],
1369
- };
1370
- };
1371
- /**
1372
- * Instantiates the JSS module and specifies the mapping from component name to component implementation.
1373
- * Appropriate when defining the set of JSS components that your app is aware of.
1374
- * @param {ComponentNameAndType[]} components
1375
- * @param {ComponentNameAndModule[]} [lazyComponents]
1376
- * @returns {ModuleWithProviders<JssModule>} module
1377
- */
1378
- JssModule.withComponents = function (components, lazyComponents) {
1379
- return {
1380
- ngModule: JssModule,
1381
- providers: __spread([
1382
- {
1383
- provide: core.ANALYZE_FOR_ENTRY_COMPONENTS,
1384
- useValue: components,
1385
- multi: true,
1386
- },
1387
- { provide: PLACEHOLDER_COMPONENTS, useValue: components },
1388
- { provide: PLACEHOLDER_LAZY_COMPONENTS, useValue: lazyComponents || [] },
1389
- { provide: router.ROUTES, useValue: lazyComponents || [], multi: true },
1390
- { provide: PLACEHOLDER_MISSING_COMPONENT_COMPONENT, useValue: MissingComponentComponent }
1391
- ], JssModule.forRoot().providers),
1392
- };
1393
- };
1394
- return JssModule;
1395
- }());
1396
- JssModule.decorators = [
1397
- { type: core.NgModule, args: [{
1398
- imports: [common.CommonModule],
1399
- declarations: [
1400
- FileDirective,
1401
- ImageDirective,
1402
- LinkDirective,
1403
- RouterLinkDirective,
1404
- GenericLinkDirective,
1405
- DateDirective,
1406
- RenderEachDirective,
1407
- RenderEmptyDirective,
1408
- PlaceholderLoadingDirective,
1409
- RenderComponentComponent,
1410
- PlaceholderComponent,
1411
- RawComponent,
1412
- RichTextDirective,
1413
- TextDirective,
1414
- MissingComponentComponent,
1415
- ],
1416
- exports: [
1417
- FileDirective,
1418
- ImageDirective,
1419
- DateDirective,
1420
- LinkDirective,
1421
- RouterLinkDirective,
1422
- GenericLinkDirective,
1423
- RenderEachDirective,
1424
- RenderEmptyDirective,
1425
- RenderComponentComponent,
1426
- PlaceholderComponent,
1427
- PlaceholderLoadingDirective,
1428
- RichTextDirective,
1429
- TextDirective,
1430
- ],
1431
- entryComponents: [RawComponent, MissingComponentComponent],
1432
- },] }
1342
+ var JssModule = /** @class */ (function () {
1343
+ function JssModule() {
1344
+ }
1345
+ /**
1346
+ * Instantiates the JSS module with no component factory.
1347
+ * Useful for using it from libraries. Most of the time you'd want withComponents()
1348
+ * @returns {ModuleWithProviders<JssModule>} module
1349
+ */
1350
+ JssModule.forRoot = function () {
1351
+ return {
1352
+ ngModule: JssModule,
1353
+ providers: [LayoutService, common.DatePipe, JssComponentFactoryService],
1354
+ };
1355
+ };
1356
+ /**
1357
+ * Instantiates a module for a lazy-loaded JSS component
1358
+ * @param {Type<any>} component
1359
+ * @returns {ModuleWithProviders<JssModule>} module
1360
+ */
1361
+ JssModule.forChild = function (component) {
1362
+ return {
1363
+ ngModule: JssModule,
1364
+ providers: [
1365
+ { provide: core.ANALYZE_FOR_ENTRY_COMPONENTS, useValue: component, multi: true },
1366
+ { provide: router.ROUTES, useValue: [], multi: true },
1367
+ { provide: DYNAMIC_COMPONENT, useValue: component },
1368
+ ],
1369
+ };
1370
+ };
1371
+ /**
1372
+ * Instantiates the JSS module and specifies the mapping from component name to component implementation.
1373
+ * Appropriate when defining the set of JSS components that your app is aware of.
1374
+ * @param {ComponentNameAndType[]} components
1375
+ * @param {ComponentNameAndModule[]} [lazyComponents]
1376
+ * @returns {ModuleWithProviders<JssModule>} module
1377
+ */
1378
+ JssModule.withComponents = function (components, lazyComponents) {
1379
+ return {
1380
+ ngModule: JssModule,
1381
+ providers: __spread([
1382
+ {
1383
+ provide: core.ANALYZE_FOR_ENTRY_COMPONENTS,
1384
+ useValue: components,
1385
+ multi: true,
1386
+ },
1387
+ { provide: PLACEHOLDER_COMPONENTS, useValue: components },
1388
+ { provide: PLACEHOLDER_LAZY_COMPONENTS, useValue: lazyComponents || [] },
1389
+ { provide: router.ROUTES, useValue: lazyComponents || [], multi: true },
1390
+ { provide: PLACEHOLDER_MISSING_COMPONENT_COMPONENT, useValue: MissingComponentComponent }
1391
+ ], JssModule.forRoot().providers),
1392
+ };
1393
+ };
1394
+ return JssModule;
1395
+ }());
1396
+ JssModule.decorators = [
1397
+ { type: core.NgModule, args: [{
1398
+ imports: [common.CommonModule],
1399
+ declarations: [
1400
+ FileDirective,
1401
+ ImageDirective,
1402
+ LinkDirective,
1403
+ RouterLinkDirective,
1404
+ GenericLinkDirective,
1405
+ DateDirective,
1406
+ RenderEachDirective,
1407
+ RenderEmptyDirective,
1408
+ PlaceholderLoadingDirective,
1409
+ RenderComponentComponent,
1410
+ PlaceholderComponent,
1411
+ RawComponent,
1412
+ RichTextDirective,
1413
+ TextDirective,
1414
+ MissingComponentComponent,
1415
+ ],
1416
+ exports: [
1417
+ FileDirective,
1418
+ ImageDirective,
1419
+ DateDirective,
1420
+ LinkDirective,
1421
+ RouterLinkDirective,
1422
+ GenericLinkDirective,
1423
+ RenderEachDirective,
1424
+ RenderEmptyDirective,
1425
+ RenderComponentComponent,
1426
+ PlaceholderComponent,
1427
+ PlaceholderLoadingDirective,
1428
+ RichTextDirective,
1429
+ TextDirective,
1430
+ ],
1431
+ entryComponents: [RawComponent, MissingComponentComponent],
1432
+ },] }
1433
1433
  ];
1434
1434
 
1435
- /**
1436
- * @description in Experience Editor with an Angular sample app, anchor tags
1437
- * with both onclick and href attributes will use the href, blocking the onclick from firing.
1438
- * This function makes it so the anchor tags function as intended in an Angular sample when using Experience Editor
1439
- *
1440
- * The Mutation Observer API is used to observe changes to the body, then select all elements with href="#" and an onclick,
1441
- * and replaces the # value with javascript:void(0); which prevents the anchor tag from blocking the onclick event handler.
1442
- * @see Mutation Observer API: https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver/MutationObserver
1443
- */
1444
- var handleEditorAnchors = function () {
1445
- // Angular gives the href attribute priority over the onclick attribute if both are present, so we must replace
1446
- // the href attribute to avoid overriding the onclick in Experience Editor
1447
- if (!window || !sitecoreJss.isExperienceEditorActive()) {
1448
- return;
1449
- }
1450
- var targetNode = document.querySelector('body');
1451
- var callback = function (mutationList) {
1452
- mutationList.forEach(function (mutation) {
1453
- var btns = document.querySelectorAll('.scChromeDropDown > a[href="#"], a[onclick]');
1454
- if (mutation.type === 'childList') {
1455
- btns.forEach(function (link) {
1456
- link.href = 'javascript:void(0);';
1457
- });
1458
- }
1459
- return;
1460
- });
1461
- };
1462
- var observer = new MutationObserver(callback);
1463
- var observerOptions = {
1464
- childList: true,
1465
- subtree: true,
1466
- };
1467
- if (targetNode) {
1468
- observer.observe(targetNode, observerOptions);
1469
- }
1435
+ /**
1436
+ * @description in Experience Editor with an Angular sample app, anchor tags
1437
+ * with both onclick and href attributes will use the href, blocking the onclick from firing.
1438
+ * This function makes it so the anchor tags function as intended in an Angular sample when using Experience Editor
1439
+ *
1440
+ * The Mutation Observer API is used to observe changes to the body, then select all elements with href="#" and an onclick,
1441
+ * and replaces the # value with javascript:void(0); which prevents the anchor tag from blocking the onclick event handler.
1442
+ * @see Mutation Observer API: https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver/MutationObserver
1443
+ */
1444
+ var handleEditorAnchors = function () {
1445
+ // Angular gives the href attribute priority over the onclick attribute if both are present, so we must replace
1446
+ // the href attribute to avoid overriding the onclick in Experience Editor
1447
+ if (!window || !sitecoreJss.isExperienceEditorActive()) {
1448
+ return;
1449
+ }
1450
+ var targetNode = document.querySelector('body');
1451
+ var callback = function (mutationList) {
1452
+ mutationList.forEach(function (mutation) {
1453
+ var btns = document.querySelectorAll('.scChromeDropDown > a[href="#"], a[onclick]');
1454
+ if (mutation.type === 'childList') {
1455
+ btns.forEach(function (link) {
1456
+ link.href = 'javascript:void(0);';
1457
+ });
1458
+ }
1459
+ return;
1460
+ });
1461
+ };
1462
+ var observer = new MutationObserver(callback);
1463
+ var observerOptions = {
1464
+ childList: true,
1465
+ subtree: true,
1466
+ };
1467
+ if (targetNode) {
1468
+ observer.observe(targetNode, observerOptions);
1469
+ }
1470
1470
  };
1471
1471
 
1472
- /**
1473
- * Generated bundle index. Do not edit.
1472
+ /**
1473
+ * Generated bundle index. Do not edit.
1474
1474
  */
1475
1475
 
1476
1476
  Object.defineProperty(exports, 'dataApi', {