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