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