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

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