@sitecore-jss/sitecore-jss-angular 21.5.0 → 21.6.0-beta.1

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