@sitecore-jss/sitecore-jss-angular 21.2.0-canary.9 → 21.2.0

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