@sitecore-jss/sitecore-jss-angular 16.0.0-canary.8 → 16.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +202 -202
- package/README.md +5 -5
- package/dist/README.md +5 -5
- package/dist/bundles/sitecore-jss-sitecore-jss-angular.umd.js +1385 -1389
- package/dist/bundles/sitecore-jss-sitecore-jss-angular.umd.js.map +1 -1
- package/dist/bundles/sitecore-jss-sitecore-jss-angular.umd.min.js +1 -1
- package/dist/bundles/sitecore-jss-sitecore-jss-angular.umd.min.js.map +1 -1
- package/dist/components/date.directive.d.ts +17 -17
- package/dist/components/file.directive.d.ts +14 -14
- package/dist/components/generic-link.directive.d.ts +14 -14
- package/dist/components/image.directive.d.ts +28 -28
- package/dist/components/link.directive.d.ts +18 -18
- package/dist/components/missing-component.component.d.ts +3 -3
- package/dist/components/placeholder-loading.directive.d.ts +5 -5
- package/dist/components/placeholder.component.d.ts +45 -45
- package/dist/components/placeholder.token.d.ts +30 -24
- package/dist/components/raw.component.d.ts +9 -9
- package/dist/components/render-component.component.d.ts +29 -29
- package/dist/components/render-each.directive.d.ts +5 -5
- package/dist/components/render-empty.directive.d.ts +5 -5
- package/dist/components/rendering-field.d.ts +20 -20
- package/dist/components/rendering.d.ts +5 -2
- package/dist/components/rich-text.directive.d.ts +12 -12
- package/dist/components/router-link.directive.d.ts +12 -12
- package/dist/components/text.directive.d.ts +13 -13
- package/dist/esm2015/components/date.directive.js +53 -54
- package/dist/esm2015/components/file.directive.js +43 -43
- package/dist/esm2015/components/generic-link.directive.js +58 -60
- package/dist/esm2015/components/image.directive.js +123 -126
- package/dist/esm2015/components/link.directive.js +99 -101
- package/dist/esm2015/components/missing-component.component.js +19 -16
- package/dist/esm2015/components/placeholder-loading.directive.js +15 -15
- package/dist/esm2015/components/placeholder.component.js +196 -186
- package/dist/esm2015/components/placeholder.token.js +21 -15
- package/dist/esm2015/components/raw.component.js +37 -36
- package/dist/esm2015/components/render-component.component.js +89 -85
- package/dist/esm2015/components/render-each.directive.js +15 -16
- package/dist/esm2015/components/render-empty.directive.js +15 -16
- package/dist/esm2015/components/rendering-field.js +1 -1
- package/dist/esm2015/components/rendering.js +8 -4
- package/dist/esm2015/components/rich-text.directive.js +41 -42
- package/dist/esm2015/components/router-link.directive.js +44 -46
- package/dist/esm2015/components/text.directive.js +54 -56
- package/dist/esm2015/jss-component-factory.service.js +87 -94
- package/dist/esm2015/layout-service-error.js +3 -3
- package/dist/esm2015/layout.service.js +28 -30
- package/dist/esm2015/lib.module.js +112 -113
- package/dist/esm2015/public_api.js +16 -16
- package/dist/esm2015/sitecore-jss-sitecore-jss-angular.js +13 -13
- package/dist/fesm2015/sitecore-jss-sitecore-jss-angular.js +1053 -1050
- package/dist/fesm2015/sitecore-jss-sitecore-jss-angular.js.map +1 -1
- package/dist/jss-component-factory.service.d.ts +21 -21
- package/dist/layout-service-error.d.ts +8 -8
- package/dist/layout.service.d.ts +8 -8
- package/dist/lib.module.d.ts +24 -16
- package/dist/package.json +2 -2
- package/dist/public_api.d.ts +16 -16
- package/dist/sitecore-jss-sitecore-jss-angular.d.ts +12 -12
- package/dist/sitecore-jss-sitecore-jss-angular.metadata.json +1 -1
- package/package.json +6 -4
- package/typings/README.md +2 -2
|
@@ -7,1109 +7,1112 @@ import { Observable, throwError, from } from 'rxjs';
|
|
|
7
7
|
import { takeWhile, catchError } from 'rxjs/operators';
|
|
8
8
|
import { DatePipe, CommonModule } from '@angular/common';
|
|
9
9
|
|
|
10
|
-
/**
|
|
11
|
-
* File fields cannot be managed via the EE. We never output "editable."
|
|
12
|
-
*/
|
|
13
|
-
class FileDirective {
|
|
14
|
-
constructor(viewContainer, templateRef) {
|
|
15
|
-
this.viewContainer = viewContainer;
|
|
16
|
-
this.templateRef = templateRef;
|
|
17
|
-
}
|
|
18
|
-
ngOnChanges(changes) {
|
|
19
|
-
if (changes
|
|
20
|
-
if (!this.viewRef) {
|
|
21
|
-
this.viewContainer.clear();
|
|
22
|
-
this.viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
|
|
23
|
-
}
|
|
24
|
-
this.updateView();
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
updateView() {
|
|
28
|
-
const field = this.field;
|
|
29
|
-
if (!field || (!field.value && !field.src)) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
const file = field.src ? field : field.value;
|
|
33
|
-
this.viewRef.rootNodes.forEach((node) => {
|
|
34
|
-
node.href = file.src;
|
|
35
|
-
if (node.innerHTML === '') {
|
|
36
|
-
node.innerHTML = file.title || file.displayName;
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
FileDirective.decorators = [
|
|
42
|
-
{ type: Directive, args: [{ selector: '[scFile]' },] }
|
|
43
|
-
];
|
|
44
|
-
FileDirective.ctorParameters = () => [
|
|
45
|
-
{ type: ViewContainerRef },
|
|
46
|
-
{ type: TemplateRef }
|
|
47
|
-
];
|
|
48
|
-
FileDirective.propDecorators = {
|
|
49
|
-
field: [{ type: Input, args: ['scFile',] }]
|
|
10
|
+
/**
|
|
11
|
+
* File fields cannot be managed via the EE. We never output "editable."
|
|
12
|
+
*/
|
|
13
|
+
class FileDirective {
|
|
14
|
+
constructor(viewContainer, templateRef) {
|
|
15
|
+
this.viewContainer = viewContainer;
|
|
16
|
+
this.templateRef = templateRef;
|
|
17
|
+
}
|
|
18
|
+
ngOnChanges(changes) {
|
|
19
|
+
if (changes.field) {
|
|
20
|
+
if (!this.viewRef) {
|
|
21
|
+
this.viewContainer.clear();
|
|
22
|
+
this.viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
|
|
23
|
+
}
|
|
24
|
+
this.updateView();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
updateView() {
|
|
28
|
+
const field = this.field;
|
|
29
|
+
if (!field || (!field.value && !field.src)) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const file = field.src ? field : field.value;
|
|
33
|
+
this.viewRef.rootNodes.forEach((node) => {
|
|
34
|
+
node.href = file.src;
|
|
35
|
+
if (node.innerHTML === '') {
|
|
36
|
+
node.innerHTML = file.title || file.displayName;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
FileDirective.decorators = [
|
|
42
|
+
{ type: Directive, args: [{ selector: '[scFile]' },] }
|
|
43
|
+
];
|
|
44
|
+
FileDirective.ctorParameters = () => [
|
|
45
|
+
{ type: ViewContainerRef },
|
|
46
|
+
{ type: TemplateRef }
|
|
47
|
+
];
|
|
48
|
+
FileDirective.propDecorators = {
|
|
49
|
+
field: [{ type: Input, args: ['scFile',] }]
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
-
class ImageDirective {
|
|
53
|
-
constructor(viewContainer, templateRef, renderer, elementRef) {
|
|
54
|
-
this.viewContainer = viewContainer;
|
|
55
|
-
this.templateRef = templateRef;
|
|
56
|
-
this.renderer = renderer;
|
|
57
|
-
this.elementRef = elementRef;
|
|
58
|
-
this.inlineRef = null;
|
|
59
|
-
|
|
60
|
-
this.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
newAttrs.
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
ImageDirective.
|
|
159
|
-
{ type:
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
{ type:
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
{ type:
|
|
166
|
-
]
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
mediaUrlPrefix: [{ type: Input, args: ['scImageMediaUrlPrefix',] }],
|
|
171
|
-
urlParams: [{ type: Input, args: ['scImageUrlParams',] }],
|
|
172
|
-
attrs: [{ type: Input, args: ['scImageAttrs',] }]
|
|
52
|
+
class ImageDirective {
|
|
53
|
+
constructor(viewContainer, templateRef, renderer, elementRef) {
|
|
54
|
+
this.viewContainer = viewContainer;
|
|
55
|
+
this.templateRef = templateRef;
|
|
56
|
+
this.renderer = renderer;
|
|
57
|
+
this.elementRef = elementRef;
|
|
58
|
+
this.inlineRef = null;
|
|
59
|
+
this.editable = true;
|
|
60
|
+
this.urlParams = {};
|
|
61
|
+
this.attrs = {};
|
|
62
|
+
}
|
|
63
|
+
ngOnChanges(changes) {
|
|
64
|
+
if (changes.field || changes.editable || changes.urlParams || changes.attrs) {
|
|
65
|
+
this.viewContainer.clear();
|
|
66
|
+
if (this.inlineRef) {
|
|
67
|
+
this.inlineRef.remove();
|
|
68
|
+
this.inlineRef = null;
|
|
69
|
+
}
|
|
70
|
+
this.updateView();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
updateView() {
|
|
74
|
+
const overrideAttrs = Object.assign(Object.assign({}, this.getElementAttrs()), this.attrs);
|
|
75
|
+
const media = this.field;
|
|
76
|
+
if (!media || (!media.editable && !media.value && !media.src)) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
let attrs = {};
|
|
80
|
+
// we likely have an experience editor value, should be a string
|
|
81
|
+
if (this.editable && media.editable) {
|
|
82
|
+
const foundImg = mediaApi.findEditorImageTag(media.editable);
|
|
83
|
+
if (!foundImg) {
|
|
84
|
+
return this.renderInlineWrapper(media.editable);
|
|
85
|
+
}
|
|
86
|
+
attrs = this.getImageAttrs(foundImg.attrs, overrideAttrs, this.urlParams);
|
|
87
|
+
if (!attrs) {
|
|
88
|
+
return this.renderInlineWrapper(media.editable);
|
|
89
|
+
}
|
|
90
|
+
const tempImg = this.renderer.createElement('img');
|
|
91
|
+
Object.entries(attrs).forEach(([key, attrValue]) => tempImg.setAttribute(key, attrValue));
|
|
92
|
+
const editableMarkup = media.editable.replace(foundImg.imgTag, tempImg.outerHTML);
|
|
93
|
+
return this.renderInlineWrapper(editableMarkup);
|
|
94
|
+
}
|
|
95
|
+
// some wise-guy/gal is passing in a 'raw' image object value
|
|
96
|
+
const img = media.src ? media : media.value;
|
|
97
|
+
if (!img) {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
attrs = this.getImageAttrs(img, overrideAttrs, this.urlParams);
|
|
101
|
+
if (attrs) {
|
|
102
|
+
this.renderTemplate(attrs);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
getImageAttrs(fieldAttrs, parsedAttrs, imageParams) {
|
|
106
|
+
const combinedAttrs = Object.assign(Object.assign({}, fieldAttrs), parsedAttrs);
|
|
107
|
+
// eslint-disable-next-line prefer-const
|
|
108
|
+
let { src, srcSet } = combinedAttrs, otherAttrs = __rest(combinedAttrs, ["src", "srcSet"]);
|
|
109
|
+
if (!src) {
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
const newAttrs = Object.assign({}, otherAttrs);
|
|
113
|
+
// update image URL for jss handler and image rendering params
|
|
114
|
+
src = mediaApi.updateImageUrl(src, imageParams, this.mediaUrlPrefix);
|
|
115
|
+
if (srcSet) {
|
|
116
|
+
// replace with HTML-formatted srcset, including updated image URLs
|
|
117
|
+
newAttrs.srcSet = mediaApi.getSrcSet(src, srcSet, imageParams, this.mediaUrlPrefix);
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
newAttrs.src = src;
|
|
121
|
+
}
|
|
122
|
+
return newAttrs;
|
|
123
|
+
}
|
|
124
|
+
renderTemplate(imageProps) {
|
|
125
|
+
const viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
|
|
126
|
+
viewRef.rootNodes.forEach((node) => {
|
|
127
|
+
Object.entries(imageProps).forEach(([key, imgPropVal]) => this.renderer.setAttribute(node, key, imgPropVal));
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
getElementAttrs() {
|
|
131
|
+
const view = this.templateRef.createEmbeddedView(null);
|
|
132
|
+
const element = view.rootNodes[0];
|
|
133
|
+
if (!element) {
|
|
134
|
+
return {};
|
|
135
|
+
}
|
|
136
|
+
const attrs = {};
|
|
137
|
+
for (let i = 0; i < element.attributes.length; i++) {
|
|
138
|
+
const attr = element.attributes.item(i);
|
|
139
|
+
if (attr) {
|
|
140
|
+
attrs[attr.name] = attr.value;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return attrs;
|
|
144
|
+
}
|
|
145
|
+
renderInlineWrapper(editable) {
|
|
146
|
+
const span = this.renderer.createElement('span');
|
|
147
|
+
span.className = 'sc-image-wrapper';
|
|
148
|
+
span.innerHTML = editable;
|
|
149
|
+
const parentNode = this.renderer.parentNode(this.elementRef.nativeElement);
|
|
150
|
+
this.renderer.insertBefore(parentNode, span, this.elementRef.nativeElement);
|
|
151
|
+
parentNode.removeChild(this.elementRef.nativeElement);
|
|
152
|
+
this.inlineRef = span;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
ImageDirective.decorators = [
|
|
156
|
+
{ type: Directive, args: [{ selector: '[scImage]' },] }
|
|
157
|
+
];
|
|
158
|
+
ImageDirective.ctorParameters = () => [
|
|
159
|
+
{ type: ViewContainerRef },
|
|
160
|
+
{ type: TemplateRef },
|
|
161
|
+
{ type: Renderer2 },
|
|
162
|
+
{ type: ElementRef }
|
|
163
|
+
];
|
|
164
|
+
ImageDirective.propDecorators = {
|
|
165
|
+
field: [{ type: Input, args: ['scImage',] }],
|
|
166
|
+
editable: [{ type: Input, args: ['scImageEditable',] }],
|
|
167
|
+
mediaUrlPrefix: [{ type: Input, args: ['scImageMediaUrlPrefix',] }],
|
|
168
|
+
urlParams: [{ type: Input, args: ['scImageUrlParams',] }],
|
|
169
|
+
attrs: [{ type: Input, args: ['scImageAttrs',] }]
|
|
173
170
|
};
|
|
174
171
|
|
|
175
|
-
class LinkDirective {
|
|
176
|
-
constructor(viewContainer, templateRef, renderer, elementRef) {
|
|
177
|
-
this.viewContainer = viewContainer;
|
|
178
|
-
this.templateRef = templateRef;
|
|
179
|
-
this.renderer = renderer;
|
|
180
|
-
this.elementRef = elementRef;
|
|
181
|
-
this.inlineRef = null;
|
|
182
|
-
|
|
183
|
-
this.
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
const
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
this.
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
{ type:
|
|
265
|
-
{ type:
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
]
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
attrs: [{ type: Input, args: ['scLinkAttrs',] }],
|
|
272
|
-
field: [{ type: Input, args: ['scLink',] }]
|
|
172
|
+
class LinkDirective {
|
|
173
|
+
constructor(viewContainer, templateRef, renderer, elementRef) {
|
|
174
|
+
this.viewContainer = viewContainer;
|
|
175
|
+
this.templateRef = templateRef;
|
|
176
|
+
this.renderer = renderer;
|
|
177
|
+
this.elementRef = elementRef;
|
|
178
|
+
this.inlineRef = null;
|
|
179
|
+
this.editable = true;
|
|
180
|
+
this.attrs = {};
|
|
181
|
+
}
|
|
182
|
+
ngOnChanges(changes) {
|
|
183
|
+
if (changes.field || changes.editable || changes.attrs) {
|
|
184
|
+
this.viewContainer.clear();
|
|
185
|
+
if (this.inlineRef) {
|
|
186
|
+
this.inlineRef.remove();
|
|
187
|
+
this.inlineRef = null;
|
|
188
|
+
}
|
|
189
|
+
this.updateView();
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
updateView() {
|
|
193
|
+
const field = this.field;
|
|
194
|
+
if (this.editable && field && field.editableFirstPart && field.editableLastPart) {
|
|
195
|
+
this.renderInlineWrapper(field.editableFirstPart, field.editableLastPart);
|
|
196
|
+
}
|
|
197
|
+
else if (field && (field.href || field.value)) {
|
|
198
|
+
const props = field.href ? field : field.value;
|
|
199
|
+
const linkText = field.text || field.value.text || field.href || field.value.href;
|
|
200
|
+
const mergedAttrs = Object.assign(Object.assign({}, props), this.attrs);
|
|
201
|
+
this.renderTemplate(mergedAttrs, linkText);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
renderTemplate(props, linkText) {
|
|
205
|
+
const viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
|
|
206
|
+
viewRef.rootNodes.forEach((node) => {
|
|
207
|
+
Object.entries(props).forEach(([key, propValue]) => {
|
|
208
|
+
if (key === 'href') {
|
|
209
|
+
const isInvalidLink = !propValue || /^https?:\/\/$/.test(propValue);
|
|
210
|
+
if (isInvalidLink) {
|
|
211
|
+
if (!node.href) {
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
propValue = node.href;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
if (key === 'class' && node.className) {
|
|
218
|
+
propValue += ` ${node.className}`;
|
|
219
|
+
}
|
|
220
|
+
this.renderer.setAttribute(node, key, propValue);
|
|
221
|
+
});
|
|
222
|
+
if (node.childNodes && node.childNodes.length === 0 && linkText) {
|
|
223
|
+
node.textContent = linkText;
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
renderInlineWrapper(editableFirstPart, editableLastPart) {
|
|
228
|
+
const span = this.renderer.createElement('span');
|
|
229
|
+
span.className = 'sc-link-wrapper';
|
|
230
|
+
span.innerHTML = editableFirstPart + editableLastPart;
|
|
231
|
+
// assign attributes from template to inline wrapper
|
|
232
|
+
const attrs = Object.assign(Object.assign({}, this.getElementAttrs()), this.attrs);
|
|
233
|
+
Object.entries(attrs).forEach(([key, attrValue]) => this.renderer.setAttribute(span, key, attrValue));
|
|
234
|
+
this.viewContainer.createEmbeddedView(this.templateRef);
|
|
235
|
+
const parentNode = this.renderer.parentNode(this.elementRef.nativeElement);
|
|
236
|
+
this.renderer.insertBefore(parentNode, span, this.elementRef.nativeElement);
|
|
237
|
+
this.inlineRef = span;
|
|
238
|
+
}
|
|
239
|
+
getElementAttrs() {
|
|
240
|
+
const view = this.templateRef.createEmbeddedView(null);
|
|
241
|
+
const element = view.rootNodes[0];
|
|
242
|
+
if (!element) {
|
|
243
|
+
return {};
|
|
244
|
+
}
|
|
245
|
+
const attrs = {};
|
|
246
|
+
for (let i = 0; i < element.attributes.length; i++) {
|
|
247
|
+
const attr = element.attributes.item(i);
|
|
248
|
+
if (attr) {
|
|
249
|
+
attrs[attr.name] = attr.value;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return attrs;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
LinkDirective.decorators = [
|
|
256
|
+
{ type: Directive, args: [{ selector: '[scLink]' },] }
|
|
257
|
+
];
|
|
258
|
+
LinkDirective.ctorParameters = () => [
|
|
259
|
+
{ type: ViewContainerRef },
|
|
260
|
+
{ type: TemplateRef },
|
|
261
|
+
{ type: Renderer2 },
|
|
262
|
+
{ type: ElementRef }
|
|
263
|
+
];
|
|
264
|
+
LinkDirective.propDecorators = {
|
|
265
|
+
editable: [{ type: Input, args: ['scLinkEditable',] }],
|
|
266
|
+
attrs: [{ type: Input, args: ['scLinkAttrs',] }],
|
|
267
|
+
field: [{ type: Input, args: ['scLink',] }]
|
|
273
268
|
};
|
|
274
269
|
|
|
275
|
-
class RouterLinkDirective extends LinkDirective {
|
|
276
|
-
constructor(viewContainer, templateRef, renderer, elementRef, router) {
|
|
277
|
-
super(viewContainer, templateRef, renderer, elementRef);
|
|
278
|
-
this.router = router;
|
|
279
|
-
|
|
280
|
-
this.
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
{ type:
|
|
307
|
-
{ type:
|
|
308
|
-
{ type:
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
]
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
attrs: [{ type: Input, args: ['scRouterLinkAttrs',] }],
|
|
315
|
-
field: [{ type: Input, args: ['scRouterLink',] }]
|
|
270
|
+
class RouterLinkDirective extends LinkDirective {
|
|
271
|
+
constructor(viewContainer, templateRef, renderer, elementRef, router) {
|
|
272
|
+
super(viewContainer, templateRef, renderer, elementRef);
|
|
273
|
+
this.router = router;
|
|
274
|
+
this.editable = true;
|
|
275
|
+
this.attrs = {};
|
|
276
|
+
}
|
|
277
|
+
renderTemplate(props, linkText) {
|
|
278
|
+
const viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
|
|
279
|
+
viewRef.rootNodes.forEach((node) => {
|
|
280
|
+
Object.entries(props).forEach(([key, propValue]) => {
|
|
281
|
+
this.renderer.setAttribute(node, key, propValue);
|
|
282
|
+
if (key === 'href') {
|
|
283
|
+
this.renderer.listen(node, 'click', (event) => {
|
|
284
|
+
this.router.navigate([propValue]);
|
|
285
|
+
event.preventDefault();
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
if (node.childNodes && node.childNodes.length === 0 && linkText) {
|
|
290
|
+
node.textContent = linkText;
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
RouterLinkDirective.decorators = [
|
|
296
|
+
{ type: Directive, args: [{ selector: '[scRouterLink]' },] }
|
|
297
|
+
];
|
|
298
|
+
RouterLinkDirective.ctorParameters = () => [
|
|
299
|
+
{ type: ViewContainerRef },
|
|
300
|
+
{ type: TemplateRef },
|
|
301
|
+
{ type: Renderer2 },
|
|
302
|
+
{ type: ElementRef },
|
|
303
|
+
{ type: Router }
|
|
304
|
+
];
|
|
305
|
+
RouterLinkDirective.propDecorators = {
|
|
306
|
+
editable: [{ type: Input, args: ['scRouterLinkEditable',] }],
|
|
307
|
+
attrs: [{ type: Input, args: ['scRouterLinkAttrs',] }],
|
|
308
|
+
field: [{ type: Input, args: ['scRouterLink',] }]
|
|
316
309
|
};
|
|
317
310
|
|
|
318
|
-
class GenericLinkDirective extends LinkDirective {
|
|
319
|
-
constructor(viewContainer, templateRef, renderer, elementRef, router) {
|
|
320
|
-
super(viewContainer, templateRef, renderer, elementRef);
|
|
321
|
-
this.router = router;
|
|
322
|
-
|
|
323
|
-
this.
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
{ type:
|
|
363
|
-
{ type:
|
|
364
|
-
{ type:
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
]
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
field: [{ type: Input, args: ['scGenericLink',] }],
|
|
372
|
-
extras: [{ type: Input, args: ['scGenericLinkExtras',] }]
|
|
311
|
+
class GenericLinkDirective extends LinkDirective {
|
|
312
|
+
constructor(viewContainer, templateRef, renderer, elementRef, router) {
|
|
313
|
+
super(viewContainer, templateRef, renderer, elementRef);
|
|
314
|
+
this.router = router;
|
|
315
|
+
this.editable = true;
|
|
316
|
+
this.attrs = {};
|
|
317
|
+
}
|
|
318
|
+
renderTemplate(props, linkText) {
|
|
319
|
+
const viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
|
|
320
|
+
viewRef.rootNodes.forEach((node) => {
|
|
321
|
+
Object.entries(props).forEach(([key, propValue]) => {
|
|
322
|
+
if (key === 'href' && !this.isAbsoluteUrl(propValue)) {
|
|
323
|
+
const urlTree = this.router.createUrlTree([propValue], this.extras);
|
|
324
|
+
this.renderer.setAttribute(node, key, this.router.serializeUrl(urlTree));
|
|
325
|
+
this.renderer.listen(node, 'click', (event) => {
|
|
326
|
+
this.router.navigate([propValue], this.extras);
|
|
327
|
+
event.preventDefault();
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
else {
|
|
331
|
+
this.renderer.setAttribute(node, key, propValue);
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
if (node.childNodes && node.childNodes.length === 0 && linkText) {
|
|
335
|
+
node.textContent = linkText;
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
isAbsoluteUrl(url) {
|
|
340
|
+
if (url === null) {
|
|
341
|
+
return false;
|
|
342
|
+
}
|
|
343
|
+
if (typeof url !== 'string') {
|
|
344
|
+
throw new TypeError('Expected a string');
|
|
345
|
+
}
|
|
346
|
+
return /^[a-z][a-z0-9+.-]*:/.test(url);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
GenericLinkDirective.decorators = [
|
|
350
|
+
{ type: Directive, args: [{ selector: '[scGenericLink]' },] }
|
|
351
|
+
];
|
|
352
|
+
GenericLinkDirective.ctorParameters = () => [
|
|
353
|
+
{ type: ViewContainerRef },
|
|
354
|
+
{ type: TemplateRef },
|
|
355
|
+
{ type: Renderer2 },
|
|
356
|
+
{ type: ElementRef },
|
|
357
|
+
{ type: Router }
|
|
358
|
+
];
|
|
359
|
+
GenericLinkDirective.propDecorators = {
|
|
360
|
+
editable: [{ type: Input, args: ['scGenericLinkEditable',] }],
|
|
361
|
+
attrs: [{ type: Input, args: ['scGenericLinkAttrs',] }],
|
|
362
|
+
field: [{ type: Input, args: ['scGenericLink',] }],
|
|
363
|
+
extras: [{ type: Input, args: ['scGenericLinkExtras',] }]
|
|
373
364
|
};
|
|
374
365
|
|
|
375
|
-
/** Registers a statically loaded component */
|
|
376
|
-
class ComponentNameAndType {
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
function
|
|
382
|
-
return '
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
366
|
+
/** Registers a statically loaded component */
|
|
367
|
+
class ComponentNameAndType {
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* @param {any} object
|
|
371
|
+
*/
|
|
372
|
+
function instanceOfComponentNameAndType(object) {
|
|
373
|
+
return 'type' in object;
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* @param {any} object
|
|
377
|
+
*/
|
|
378
|
+
function instanceOfComponentNameAndModule(object) {
|
|
379
|
+
return 'module' in object;
|
|
380
|
+
}
|
|
381
|
+
const PLACEHOLDER_COMPONENTS = new InjectionToken('Sc.placeholder.components');
|
|
382
|
+
const PLACEHOLDER_LAZY_COMPONENTS = new InjectionToken('Sc.placeholder.lazyComponents');
|
|
383
|
+
const PLACEHOLDER_MISSING_COMPONENT_COMPONENT = new InjectionToken('Sc.placeholder.missingComponentComponent');
|
|
387
384
|
const DYNAMIC_COMPONENT = new InjectionToken('Sc.placeholder.dynamicComponent');
|
|
388
385
|
|
|
389
|
-
class RawComponent {
|
|
390
|
-
constructor(renderer, elementRef) {
|
|
391
|
-
this.renderer = renderer;
|
|
392
|
-
this.elementRef = elementRef;
|
|
393
|
-
}
|
|
394
|
-
ngOnInit() {
|
|
395
|
-
const el = this.renderer.createElement(this.rendering.name);
|
|
396
|
-
const contents = this.renderer.createText(this.rendering.contents || '');
|
|
397
|
-
const attributes = this.rendering.attributes;
|
|
398
|
-
for (const attr in attributes) {
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
this.renderer.
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
]
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
{ type:
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
386
|
+
class RawComponent {
|
|
387
|
+
constructor(renderer, elementRef) {
|
|
388
|
+
this.renderer = renderer;
|
|
389
|
+
this.elementRef = elementRef;
|
|
390
|
+
}
|
|
391
|
+
ngOnInit() {
|
|
392
|
+
const el = this.renderer.createElement(this.rendering.name);
|
|
393
|
+
const contents = this.renderer.createText(this.rendering.contents || '');
|
|
394
|
+
const attributes = this.rendering.attributes;
|
|
395
|
+
for (const attr in attributes) {
|
|
396
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
397
|
+
if (attributes.hasOwnProperty(attr)) {
|
|
398
|
+
const value = attributes[attr];
|
|
399
|
+
this.renderer.setAttribute(el, attr, value || '');
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
this.renderer.appendChild(el, contents);
|
|
403
|
+
const parentNode = this.renderer.parentNode(this.elementRef.nativeElement);
|
|
404
|
+
this.renderer.insertBefore(parentNode, el, this.elementRef.nativeElement);
|
|
405
|
+
parentNode.removeChild(this.elementRef.nativeElement);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
RawComponent.decorators = [
|
|
409
|
+
{ type: Component, args: [{
|
|
410
|
+
selector: 'sc-raw',
|
|
411
|
+
template: ''
|
|
412
|
+
},] }
|
|
413
|
+
];
|
|
414
|
+
RawComponent.ctorParameters = () => [
|
|
415
|
+
{ type: Renderer2 },
|
|
416
|
+
{ type: ElementRef }
|
|
417
|
+
];
|
|
418
|
+
RawComponent.propDecorators = {
|
|
419
|
+
rendering: [{ type: Input }]
|
|
422
420
|
};
|
|
423
421
|
|
|
424
|
-
|
|
425
|
-
|
|
422
|
+
/**
|
|
423
|
+
* @param {HtmlElementRendering | ComponentRendering} rendering
|
|
424
|
+
*/
|
|
425
|
+
function isRawRendering(rendering) {
|
|
426
|
+
return (!rendering.componentName &&
|
|
427
|
+
rendering.name !== undefined);
|
|
426
428
|
}
|
|
427
429
|
|
|
428
|
-
class JssComponentFactoryService {
|
|
429
|
-
constructor(injector, compiler, components, lazyComponents) {
|
|
430
|
-
this.injector = injector;
|
|
431
|
-
this.compiler = compiler;
|
|
432
|
-
this.components = components;
|
|
433
|
-
this.lazyComponents = lazyComponents;
|
|
434
|
-
this.componentMap = new Map();
|
|
435
|
-
this.lazyComponentMap = new Map();
|
|
436
|
-
this.components.forEach((c) => this.componentMap.set(c.name, c.type));
|
|
437
|
-
if (this.lazyComponents) {
|
|
438
|
-
this.lazyComponents.forEach((c) => this.lazyComponentMap.set(c.path, c));
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
loadModuleFactory(lazyComponent) {
|
|
442
|
-
return lazyComponent.loadChildren().then(loaded => {
|
|
443
|
-
if (loaded instanceof NgModuleFactory) {
|
|
444
|
-
return loaded;
|
|
445
|
-
}
|
|
446
|
-
else {
|
|
447
|
-
return this.compiler.compileModuleAsync(loaded);
|
|
448
|
-
}
|
|
449
|
-
});
|
|
450
|
-
}
|
|
451
|
-
getComponent(component) {
|
|
452
|
-
const loadedComponent = this.componentMap.get(component.componentName);
|
|
453
|
-
if (loadedComponent) {
|
|
454
|
-
return Promise.resolve({
|
|
455
|
-
componentDefinition: component,
|
|
456
|
-
componentImplementation: this.componentMap.get(component.componentName),
|
|
457
|
-
});
|
|
458
|
-
}
|
|
459
|
-
const lazyComponent = this.lazyComponentMap.get(component.componentName);
|
|
460
|
-
if (lazyComponent) {
|
|
461
|
-
return this.loadModuleFactory(lazyComponent)
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
const
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
{ type: Injectable }
|
|
510
|
-
];
|
|
511
|
-
JssComponentFactoryService.ctorParameters = () => [
|
|
512
|
-
{ type: Injector },
|
|
513
|
-
{ type: Compiler },
|
|
514
|
-
{ type: Array, decorators: [{ type: Inject, args: [PLACEHOLDER_COMPONENTS,] }] },
|
|
515
|
-
{ type: Array, decorators: [{ type: Inject, args: [PLACEHOLDER_LAZY_COMPONENTS,] }] }
|
|
430
|
+
class JssComponentFactoryService {
|
|
431
|
+
constructor(injector, compiler, components, lazyComponents) {
|
|
432
|
+
this.injector = injector;
|
|
433
|
+
this.compiler = compiler;
|
|
434
|
+
this.components = components;
|
|
435
|
+
this.lazyComponents = lazyComponents;
|
|
436
|
+
this.componentMap = new Map();
|
|
437
|
+
this.lazyComponentMap = new Map();
|
|
438
|
+
this.components.forEach((c) => this.componentMap.set(c.name, c.type));
|
|
439
|
+
if (this.lazyComponents) {
|
|
440
|
+
this.lazyComponents.forEach((c) => this.lazyComponentMap.set(c.path, c));
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
loadModuleFactory(lazyComponent) {
|
|
444
|
+
return lazyComponent.loadChildren().then((loaded) => {
|
|
445
|
+
if (loaded instanceof NgModuleFactory) {
|
|
446
|
+
return loaded;
|
|
447
|
+
}
|
|
448
|
+
else {
|
|
449
|
+
return this.compiler.compileModuleAsync(loaded);
|
|
450
|
+
}
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
getComponent(component) {
|
|
454
|
+
const loadedComponent = this.componentMap.get(component.componentName);
|
|
455
|
+
if (loadedComponent) {
|
|
456
|
+
return Promise.resolve({
|
|
457
|
+
componentDefinition: component,
|
|
458
|
+
componentImplementation: this.componentMap.get(component.componentName),
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
const lazyComponent = this.lazyComponentMap.get(component.componentName);
|
|
462
|
+
if (lazyComponent) {
|
|
463
|
+
return this.loadModuleFactory(lazyComponent).then((ngModuleFactory) => {
|
|
464
|
+
let componentType = null;
|
|
465
|
+
const moduleRef = ngModuleFactory.create(this.injector);
|
|
466
|
+
const dynamicComponentType = moduleRef.injector.get(DYNAMIC_COMPONENT);
|
|
467
|
+
if (!dynamicComponentType) {
|
|
468
|
+
throw new Error(`JssComponentFactoryService: Lazy load module for component "${lazyComponent.path}" missing DYNAMIC_COMPONENT provider. Missing JssModule.forChild()?`);
|
|
469
|
+
}
|
|
470
|
+
if (component.componentName in dynamicComponentType) {
|
|
471
|
+
componentType = dynamicComponentType[component.componentName];
|
|
472
|
+
}
|
|
473
|
+
else {
|
|
474
|
+
if (typeof dynamicComponentType === 'function') {
|
|
475
|
+
componentType = dynamicComponentType;
|
|
476
|
+
}
|
|
477
|
+
else {
|
|
478
|
+
throw new Error(`JssComponentFactoryService: Lazy load module for component "${lazyComponent.path}" missing DYNAMIC_COMPONENT provider. Missing JssModule.forChild()?`);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
return {
|
|
482
|
+
componentDefinition: component,
|
|
483
|
+
componentImplementation: componentType,
|
|
484
|
+
componentFactory: moduleRef.componentFactoryResolver.resolveComponentFactory(componentType),
|
|
485
|
+
};
|
|
486
|
+
});
|
|
487
|
+
}
|
|
488
|
+
return Promise.resolve({
|
|
489
|
+
componentDefinition: component,
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
getComponents(components) {
|
|
493
|
+
// acquire all components and keep them in order while handling their potential async-ness
|
|
494
|
+
return Promise.all(components.map((component) => isRawRendering(component) ? this.getRawComponent(component) : this.getComponent(component)));
|
|
495
|
+
}
|
|
496
|
+
getRawComponent(component) {
|
|
497
|
+
return Promise.resolve({
|
|
498
|
+
componentImplementation: RawComponent,
|
|
499
|
+
componentDefinition: component,
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
JssComponentFactoryService.decorators = [
|
|
504
|
+
{ type: Injectable }
|
|
505
|
+
];
|
|
506
|
+
JssComponentFactoryService.ctorParameters = () => [
|
|
507
|
+
{ type: Injector },
|
|
508
|
+
{ type: Compiler },
|
|
509
|
+
{ type: Array, decorators: [{ type: Inject, args: [PLACEHOLDER_COMPONENTS,] }] },
|
|
510
|
+
{ type: Array, decorators: [{ type: Inject, args: [PLACEHOLDER_LAZY_COMPONENTS,] }] }
|
|
516
511
|
];
|
|
517
512
|
|
|
518
|
-
class PlaceholderLoadingDirective {
|
|
519
|
-
constructor(templateRef) {
|
|
520
|
-
this.templateRef = templateRef;
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
PlaceholderLoadingDirective.decorators = [
|
|
524
|
-
{ type: Directive, args: [{
|
|
525
|
-
selector: '[scPlaceholderLoading]',
|
|
526
|
-
},] }
|
|
527
|
-
];
|
|
528
|
-
PlaceholderLoadingDirective.ctorParameters = () => [
|
|
529
|
-
{ type: TemplateRef }
|
|
513
|
+
class PlaceholderLoadingDirective {
|
|
514
|
+
constructor(templateRef) {
|
|
515
|
+
this.templateRef = templateRef;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
PlaceholderLoadingDirective.decorators = [
|
|
519
|
+
{ type: Directive, args: [{
|
|
520
|
+
selector: '[scPlaceholderLoading]',
|
|
521
|
+
},] }
|
|
522
|
+
];
|
|
523
|
+
PlaceholderLoadingDirective.ctorParameters = () => [
|
|
524
|
+
{ type: TemplateRef }
|
|
530
525
|
];
|
|
531
526
|
|
|
532
|
-
class RenderEachDirective {
|
|
533
|
-
constructor(templateRef) {
|
|
534
|
-
this.templateRef = templateRef;
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
RenderEachDirective.decorators = [
|
|
538
|
-
{ type: Directive, args: [{
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
{ type: TemplateRef }
|
|
527
|
+
class RenderEachDirective {
|
|
528
|
+
constructor(templateRef) {
|
|
529
|
+
this.templateRef = templateRef;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
RenderEachDirective.decorators = [
|
|
533
|
+
{ type: Directive, args: [{
|
|
534
|
+
selector: '[renderEach]',
|
|
535
|
+
},] }
|
|
536
|
+
];
|
|
537
|
+
RenderEachDirective.ctorParameters = () => [
|
|
538
|
+
{ type: TemplateRef }
|
|
545
539
|
];
|
|
546
540
|
|
|
547
|
-
class RenderEmptyDirective {
|
|
548
|
-
constructor(templateRef) {
|
|
549
|
-
this.templateRef = templateRef;
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
RenderEmptyDirective.decorators = [
|
|
553
|
-
{ type: Directive, args: [{
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
{ type: TemplateRef }
|
|
541
|
+
class RenderEmptyDirective {
|
|
542
|
+
constructor(templateRef) {
|
|
543
|
+
this.templateRef = templateRef;
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
RenderEmptyDirective.decorators = [
|
|
547
|
+
{ type: Directive, args: [{
|
|
548
|
+
selector: '[renderEmpty]',
|
|
549
|
+
},] }
|
|
550
|
+
];
|
|
551
|
+
RenderEmptyDirective.ctorParameters = () => [
|
|
552
|
+
{ type: TemplateRef }
|
|
560
553
|
];
|
|
561
554
|
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
this.
|
|
576
|
-
this.
|
|
577
|
-
this.
|
|
578
|
-
this.
|
|
579
|
-
this.
|
|
580
|
-
this.
|
|
581
|
-
this.
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
this.
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
if (
|
|
613
|
-
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
changes
|
|
621
|
-
changes
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
555
|
+
/* eslint-disable @angular-eslint/no-conflicting-lifecycle */
|
|
556
|
+
/**
|
|
557
|
+
* @param {ComponentRendering} rendering
|
|
558
|
+
* @param {string} name
|
|
559
|
+
*/
|
|
560
|
+
function getPlaceholder(rendering, name) {
|
|
561
|
+
if (rendering && rendering.placeholders && Object.keys(rendering.placeholders).length > 0) {
|
|
562
|
+
return rendering.placeholders[name];
|
|
563
|
+
}
|
|
564
|
+
return null;
|
|
565
|
+
}
|
|
566
|
+
class PlaceholderComponent {
|
|
567
|
+
constructor(componentFactoryResolver, differs, componentFactory, changeDetectorRef, elementRef, renderer, missingComponentComponent) {
|
|
568
|
+
this.componentFactoryResolver = componentFactoryResolver;
|
|
569
|
+
this.differs = differs;
|
|
570
|
+
this.componentFactory = componentFactory;
|
|
571
|
+
this.changeDetectorRef = changeDetectorRef;
|
|
572
|
+
this.elementRef = elementRef;
|
|
573
|
+
this.renderer = renderer;
|
|
574
|
+
this.missingComponentComponent = missingComponentComponent;
|
|
575
|
+
this._componentInstances = [];
|
|
576
|
+
this.destroyed = false;
|
|
577
|
+
this.parentStyleAttribute = '';
|
|
578
|
+
this.isLoading = true;
|
|
579
|
+
this.loaded = new EventEmitter();
|
|
580
|
+
}
|
|
581
|
+
set inputs(value) {
|
|
582
|
+
this._inputs = value;
|
|
583
|
+
if (!this._differ && value) {
|
|
584
|
+
this._differ = this.differs.find(value).create();
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
ngOnInit() {
|
|
588
|
+
// just to ensure the element exists
|
|
589
|
+
const elem = this.elementRef.nativeElement;
|
|
590
|
+
if (elem) {
|
|
591
|
+
const attributes = elem.attributes;
|
|
592
|
+
for (let i = 0; i < attributes.length; i++) {
|
|
593
|
+
const attr = attributes.item(i);
|
|
594
|
+
if (attr && attr.name.indexOf('_ngcontent') !== -1) {
|
|
595
|
+
this.parentStyleAttribute = attr.name;
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
ngOnDestroy() {
|
|
601
|
+
this.destroyed = true;
|
|
602
|
+
this._componentInstances = [];
|
|
603
|
+
}
|
|
604
|
+
ngOnChanges(changes) {
|
|
605
|
+
if (changes.rendering || changes.renderings) {
|
|
606
|
+
this._render();
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
ngDoCheck() {
|
|
610
|
+
if (!this._differ || !this._inputs || this._componentInstances.length === 0) {
|
|
611
|
+
return;
|
|
612
|
+
}
|
|
613
|
+
const changes = this._differ.diff(this._inputs);
|
|
614
|
+
if (!changes) {
|
|
615
|
+
return;
|
|
616
|
+
}
|
|
617
|
+
const updates = {};
|
|
618
|
+
changes.forEachRemovedItem((change) => (updates[change.key] = null));
|
|
619
|
+
changes.forEachAddedItem((change) => (updates[change.key] = change.currentValue));
|
|
620
|
+
changes.forEachChangedItem((change) => (updates[change.key] = change.currentValue));
|
|
621
|
+
this._componentInstances.forEach((componentInstance) => this._setComponentInputs(componentInstance, updates));
|
|
622
|
+
}
|
|
623
|
+
_setComponentInputs(componentInstance, inputs) {
|
|
624
|
+
Object.entries(inputs).forEach(([input, inputValue]) => (componentInstance[input] = inputValue));
|
|
625
|
+
}
|
|
626
|
+
_subscribeComponentOutputs(componentInstance, outputs) {
|
|
627
|
+
Object.keys(outputs)
|
|
628
|
+
.filter((output) => componentInstance[output] && componentInstance[output] instanceof Observable)
|
|
629
|
+
.forEach((output) => componentInstance[output]
|
|
630
|
+
.pipe(takeWhile(() => !this.destroyed))
|
|
631
|
+
.subscribe(outputs[output]));
|
|
632
|
+
}
|
|
633
|
+
_render() {
|
|
634
|
+
this._componentInstances = [];
|
|
635
|
+
this.view.clear();
|
|
636
|
+
if (!this.rendering && !this.renderings) {
|
|
637
|
+
return;
|
|
638
|
+
}
|
|
639
|
+
if (!this.name && !this.renderings) {
|
|
640
|
+
console.warn('Placeholder name was not specified, and explicit renderings array was not passed. Placeholder requires either name and rendering, or renderings.');
|
|
641
|
+
this.isLoading = false;
|
|
642
|
+
return;
|
|
643
|
+
}
|
|
644
|
+
const placeholder = this.renderings || getPlaceholder(this.rendering, this.name || '');
|
|
645
|
+
if (!placeholder) {
|
|
646
|
+
console.warn(`Placeholder '${this.name}' was not found in the current rendering data`, JSON.stringify(this.rendering, null, 2));
|
|
647
|
+
this.isLoading = false;
|
|
648
|
+
return;
|
|
649
|
+
}
|
|
650
|
+
// if the placeholder is empty (contains only raw renderings), then we may need to use the empty template if it's defined
|
|
651
|
+
const placeholderIsEmpty = placeholder.every((rendering) => isRawRendering(rendering));
|
|
652
|
+
if (this.renderEmptyTemplate && placeholderIsEmpty) {
|
|
653
|
+
this.view.createEmbeddedView(this.renderEmptyTemplate.templateRef, {
|
|
654
|
+
renderings: placeholder,
|
|
655
|
+
});
|
|
656
|
+
this.isLoading = false;
|
|
657
|
+
}
|
|
658
|
+
else {
|
|
659
|
+
this.componentFactory
|
|
660
|
+
.getComponents(placeholder)
|
|
661
|
+
.then((components) => components.forEach((rendering, index) => {
|
|
662
|
+
if (this.renderEachTemplate && !isRawRendering(rendering.componentDefinition)) {
|
|
663
|
+
this._renderTemplatedComponent(rendering.componentDefinition, index);
|
|
664
|
+
}
|
|
665
|
+
else {
|
|
666
|
+
this._renderEmbeddedComponent(rendering, index);
|
|
667
|
+
}
|
|
668
|
+
this.isLoading = false;
|
|
669
|
+
}))
|
|
670
|
+
.then(() => {
|
|
671
|
+
this.changeDetectorRef.markForCheck();
|
|
672
|
+
this.loaded.emit(this.name);
|
|
673
|
+
});
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
_renderTemplatedComponent(rendering, index) {
|
|
677
|
+
// the render-each template takes care of all component mapping etc
|
|
678
|
+
// generally using <sc-render-component> which is about like _renderEmbeddedComponent()
|
|
679
|
+
// as a separate component
|
|
680
|
+
this.view.createEmbeddedView(this.renderEachTemplate.templateRef, {
|
|
681
|
+
rendering,
|
|
682
|
+
index,
|
|
683
|
+
});
|
|
684
|
+
}
|
|
685
|
+
_renderEmbeddedComponent(rendering, index) {
|
|
686
|
+
if (!rendering.componentImplementation) {
|
|
687
|
+
const componentName = rendering.componentDefinition.componentName;
|
|
689
688
|
console.error(`Placeholder ${this.name} contains unknown component ${componentName}.`, `Ensure component is mapped, like:
|
|
690
689
|
JssModule.withComponents([
|
|
691
690
|
{ name: '${componentName}', type: ${componentName}Component }
|
|
692
|
-
])`);
|
|
693
|
-
rendering.componentImplementation = this.missingComponentComponent;
|
|
694
|
-
}
|
|
695
|
-
const componentFactory = rendering.componentFactory ||
|
|
696
|
-
|
|
697
|
-
//
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
componentInstance
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
}
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
691
|
+
])`);
|
|
692
|
+
rendering.componentImplementation = this.missingComponentComponent;
|
|
693
|
+
}
|
|
694
|
+
const componentFactory = rendering.componentFactory ||
|
|
695
|
+
this.componentFactoryResolver.resolveComponentFactory(rendering.componentImplementation);
|
|
696
|
+
// apply the parent style attribute _ngcontent
|
|
697
|
+
// work-around for https://github.com/angular/angular/issues/12215
|
|
698
|
+
const createdComponentRef = this.view.createComponent(componentFactory, index);
|
|
699
|
+
if (this.parentStyleAttribute) {
|
|
700
|
+
this.renderer.setAttribute(createdComponentRef.location.nativeElement, this.parentStyleAttribute, '');
|
|
701
|
+
}
|
|
702
|
+
const componentInstance = createdComponentRef.instance;
|
|
703
|
+
componentInstance.rendering = rendering.componentDefinition;
|
|
704
|
+
if (this._inputs) {
|
|
705
|
+
this._setComponentInputs(componentInstance, this._inputs);
|
|
706
|
+
}
|
|
707
|
+
if (this.outputs) {
|
|
708
|
+
this._subscribeComponentOutputs(componentInstance, this.outputs);
|
|
709
|
+
}
|
|
710
|
+
this._componentInstances.push(componentInstance);
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
PlaceholderComponent.decorators = [
|
|
714
|
+
{ type: Component, args: [{
|
|
715
|
+
selector: 'sc-placeholder,[sc-placeholder]',
|
|
716
716
|
template: `
|
|
717
|
-
<ng-template
|
|
717
|
+
<ng-template
|
|
718
|
+
*ngIf="isLoading"
|
|
719
|
+
[ngTemplateOutlet]="placeholderLoading?.templateRef"
|
|
720
|
+
></ng-template>
|
|
718
721
|
<ng-template #view></ng-template>
|
|
719
|
-
`
|
|
720
|
-
},] }
|
|
721
|
-
];
|
|
722
|
-
PlaceholderComponent.ctorParameters = () => [
|
|
723
|
-
{ type: ComponentFactoryResolver },
|
|
724
|
-
{ type: KeyValueDiffers },
|
|
725
|
-
{ type: JssComponentFactoryService },
|
|
726
|
-
{ type: ChangeDetectorRef },
|
|
727
|
-
{ type: ElementRef },
|
|
728
|
-
{ type: Renderer2 },
|
|
729
|
-
{ type: Type, decorators: [{ type: Inject, args: [PLACEHOLDER_MISSING_COMPONENT_COMPONENT,] }] }
|
|
730
|
-
];
|
|
731
|
-
PlaceholderComponent.propDecorators = {
|
|
732
|
-
name: [{ type: Input }],
|
|
733
|
-
rendering: [{ type: Input }],
|
|
734
|
-
renderings: [{ type: Input }],
|
|
735
|
-
outputs: [{ type: Input }],
|
|
736
|
-
loaded: [{ type: Output }],
|
|
737
|
-
view: [{ type: ViewChild, args: ['view', { read: ViewContainerRef, static: true },] }],
|
|
738
|
-
renderEachTemplate: [{ type: ContentChild, args: [RenderEachDirective, { static: true },] }],
|
|
739
|
-
renderEmptyTemplate: [{ type: ContentChild, args: [RenderEmptyDirective, { static: true },] }],
|
|
740
|
-
placeholderLoading: [{ type: ContentChild, args: [PlaceholderLoadingDirective, { static: true },] }],
|
|
741
|
-
inputs: [{ type: Input }]
|
|
722
|
+
`
|
|
723
|
+
},] }
|
|
724
|
+
];
|
|
725
|
+
PlaceholderComponent.ctorParameters = () => [
|
|
726
|
+
{ type: ComponentFactoryResolver },
|
|
727
|
+
{ type: KeyValueDiffers },
|
|
728
|
+
{ type: JssComponentFactoryService },
|
|
729
|
+
{ type: ChangeDetectorRef },
|
|
730
|
+
{ type: ElementRef },
|
|
731
|
+
{ type: Renderer2 },
|
|
732
|
+
{ type: Type, decorators: [{ type: Inject, args: [PLACEHOLDER_MISSING_COMPONENT_COMPONENT,] }] }
|
|
733
|
+
];
|
|
734
|
+
PlaceholderComponent.propDecorators = {
|
|
735
|
+
name: [{ type: Input }],
|
|
736
|
+
rendering: [{ type: Input }],
|
|
737
|
+
renderings: [{ type: Input }],
|
|
738
|
+
outputs: [{ type: Input }],
|
|
739
|
+
loaded: [{ type: Output }],
|
|
740
|
+
view: [{ type: ViewChild, args: ['view', { read: ViewContainerRef, static: true },] }],
|
|
741
|
+
renderEachTemplate: [{ type: ContentChild, args: [RenderEachDirective, { static: true },] }],
|
|
742
|
+
renderEmptyTemplate: [{ type: ContentChild, args: [RenderEmptyDirective, { static: true },] }],
|
|
743
|
+
placeholderLoading: [{ type: ContentChild, args: [PlaceholderLoadingDirective, { static: true },] }],
|
|
744
|
+
inputs: [{ type: Input }]
|
|
742
745
|
};
|
|
743
746
|
|
|
744
|
-
class RichTextDirective {
|
|
745
|
-
constructor(viewContainer, templateRef) {
|
|
746
|
-
this.viewContainer = viewContainer;
|
|
747
|
-
this.templateRef = templateRef;
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
this.viewContainer.
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
{ type:
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
field: [{ type: Input, args: ['scRichText',] }]
|
|
747
|
+
class RichTextDirective {
|
|
748
|
+
constructor(viewContainer, templateRef) {
|
|
749
|
+
this.viewContainer = viewContainer;
|
|
750
|
+
this.templateRef = templateRef;
|
|
751
|
+
this.editable = true;
|
|
752
|
+
}
|
|
753
|
+
ngOnChanges(changes) {
|
|
754
|
+
if (changes.field || changes.editable) {
|
|
755
|
+
if (!this.viewRef) {
|
|
756
|
+
this.viewContainer.clear();
|
|
757
|
+
this.viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
|
|
758
|
+
}
|
|
759
|
+
this.updateView();
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
updateView() {
|
|
763
|
+
const field = this.field;
|
|
764
|
+
if (!field || (!field.editable && !field.value)) {
|
|
765
|
+
return;
|
|
766
|
+
}
|
|
767
|
+
const html = field.editable && this.editable ? field.editable : field.value;
|
|
768
|
+
this.viewRef.rootNodes.forEach((node) => {
|
|
769
|
+
node.innerHTML = html;
|
|
770
|
+
});
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
RichTextDirective.decorators = [
|
|
774
|
+
{ type: Directive, args: [{
|
|
775
|
+
selector: '[scRichText]',
|
|
776
|
+
},] }
|
|
777
|
+
];
|
|
778
|
+
RichTextDirective.ctorParameters = () => [
|
|
779
|
+
{ type: ViewContainerRef },
|
|
780
|
+
{ type: TemplateRef }
|
|
781
|
+
];
|
|
782
|
+
RichTextDirective.propDecorators = {
|
|
783
|
+
editable: [{ type: Input, args: ['scRichTextEditable',] }],
|
|
784
|
+
field: [{ type: Input, args: ['scRichText',] }]
|
|
783
785
|
};
|
|
784
786
|
|
|
785
|
-
class TextDirective {
|
|
786
|
-
constructor(viewContainer, templateRef) {
|
|
787
|
-
this.viewContainer = viewContainer;
|
|
788
|
-
this.templateRef = templateRef;
|
|
789
|
-
|
|
790
|
-
this.
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
]
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
encode: [{ type: Input, args: ['scTextEncode',] }],
|
|
837
|
-
field: [{ type: Input, args: ['scText',] }]
|
|
787
|
+
class TextDirective {
|
|
788
|
+
constructor(viewContainer, templateRef) {
|
|
789
|
+
this.viewContainer = viewContainer;
|
|
790
|
+
this.templateRef = templateRef;
|
|
791
|
+
this.editable = true;
|
|
792
|
+
this.encode = true;
|
|
793
|
+
}
|
|
794
|
+
ngOnChanges(changes) {
|
|
795
|
+
if (changes.field || changes.editable || changes.encode) {
|
|
796
|
+
if (!this.viewRef) {
|
|
797
|
+
this.viewContainer.clear();
|
|
798
|
+
this.viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
|
|
799
|
+
}
|
|
800
|
+
this.updateView();
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
updateView() {
|
|
804
|
+
const field = this.field;
|
|
805
|
+
let editable = this.editable;
|
|
806
|
+
if (!field || (!field.editable && !field.value)) {
|
|
807
|
+
return;
|
|
808
|
+
}
|
|
809
|
+
// can't use editable value if we want to output unencoded
|
|
810
|
+
if (!this.encode) {
|
|
811
|
+
editable = false;
|
|
812
|
+
}
|
|
813
|
+
const html = field.editable && editable ? field.editable : field.value;
|
|
814
|
+
const setDangerously = (field.editable && editable) || !this.encode;
|
|
815
|
+
this.viewRef.rootNodes.forEach((node) => {
|
|
816
|
+
if (setDangerously) {
|
|
817
|
+
node.innerHTML = html;
|
|
818
|
+
}
|
|
819
|
+
else {
|
|
820
|
+
node.textContent = html;
|
|
821
|
+
}
|
|
822
|
+
});
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
TextDirective.decorators = [
|
|
826
|
+
{ type: Directive, args: [{
|
|
827
|
+
selector: '[scText]',
|
|
828
|
+
},] }
|
|
829
|
+
];
|
|
830
|
+
TextDirective.ctorParameters = () => [
|
|
831
|
+
{ type: ViewContainerRef },
|
|
832
|
+
{ type: TemplateRef }
|
|
833
|
+
];
|
|
834
|
+
TextDirective.propDecorators = {
|
|
835
|
+
editable: [{ type: Input, args: ['scTextEditable',] }],
|
|
836
|
+
encode: [{ type: Input, args: ['scTextEncode',] }],
|
|
837
|
+
field: [{ type: Input, args: ['scText',] }]
|
|
838
838
|
};
|
|
839
839
|
|
|
840
|
-
class LayoutServiceError {
|
|
840
|
+
class LayoutServiceError {
|
|
841
841
|
}
|
|
842
842
|
|
|
843
|
-
const { fetchRouteData, fetchPlaceholderData } = dataApi;
|
|
844
|
-
class LayoutService {
|
|
845
|
-
static getLayoutServiceError(error) {
|
|
846
|
-
const layoutServiceError = new LayoutServiceError();
|
|
847
|
-
const response = error.response;
|
|
848
|
-
if (response) {
|
|
849
|
-
layoutServiceError.status = response.status;
|
|
850
|
-
layoutServiceError.statusText = response.statusText;
|
|
851
|
-
layoutServiceError.data = response.data;
|
|
852
|
-
}
|
|
853
|
-
return throwError(layoutServiceError);
|
|
854
|
-
}
|
|
855
|
-
getRouteData(route, options) {
|
|
856
|
-
return from(fetchRouteData(route, options))
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
}
|
|
864
|
-
LayoutService.decorators = [
|
|
865
|
-
{ type: Injectable }
|
|
843
|
+
const { fetchRouteData, fetchPlaceholderData } = dataApi;
|
|
844
|
+
class LayoutService {
|
|
845
|
+
static getLayoutServiceError(error) {
|
|
846
|
+
const layoutServiceError = new LayoutServiceError();
|
|
847
|
+
const response = error.response;
|
|
848
|
+
if (response) {
|
|
849
|
+
layoutServiceError.status = response.status;
|
|
850
|
+
layoutServiceError.statusText = response.statusText;
|
|
851
|
+
layoutServiceError.data = response.data;
|
|
852
|
+
}
|
|
853
|
+
return throwError(layoutServiceError);
|
|
854
|
+
}
|
|
855
|
+
getRouteData(route, options) {
|
|
856
|
+
return from(fetchRouteData(route, options)).pipe(catchError(LayoutService.getLayoutServiceError));
|
|
857
|
+
}
|
|
858
|
+
getPlaceholderData(route, placeholderName, options) {
|
|
859
|
+
return from(fetchPlaceholderData(placeholderName, route, options)).pipe(catchError(LayoutService.getLayoutServiceError));
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
LayoutService.decorators = [
|
|
863
|
+
{ type: Injectable }
|
|
866
864
|
];
|
|
867
865
|
|
|
868
|
-
class DateDirective {
|
|
869
|
-
constructor(viewContainer, templateRef, datePipe) {
|
|
870
|
-
this.viewContainer = viewContainer;
|
|
871
|
-
this.templateRef = templateRef;
|
|
872
|
-
this.datePipe = datePipe;
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
this.viewContainer.
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
const
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
{ type:
|
|
909
|
-
{ type:
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
field: [{ type: Input, args: ['scDate',] }]
|
|
866
|
+
class DateDirective {
|
|
867
|
+
constructor(viewContainer, templateRef, datePipe) {
|
|
868
|
+
this.viewContainer = viewContainer;
|
|
869
|
+
this.templateRef = templateRef;
|
|
870
|
+
this.datePipe = datePipe;
|
|
871
|
+
this.editable = true;
|
|
872
|
+
}
|
|
873
|
+
ngOnChanges(changes) {
|
|
874
|
+
if (changes.field || changes.format) {
|
|
875
|
+
if (!this.viewRef) {
|
|
876
|
+
this.viewContainer.clear();
|
|
877
|
+
this.viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
|
|
878
|
+
}
|
|
879
|
+
this.updateView();
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
updateView() {
|
|
883
|
+
const field = this.field;
|
|
884
|
+
if (!field || (!field.editable && !field.value)) {
|
|
885
|
+
return;
|
|
886
|
+
}
|
|
887
|
+
const html = field.editable && this.editable ? field.editable : field.value;
|
|
888
|
+
const setDangerously = field.editable && this.editable;
|
|
889
|
+
this.viewRef.rootNodes.forEach((node) => {
|
|
890
|
+
if (setDangerously) {
|
|
891
|
+
node.innerHTML = html;
|
|
892
|
+
}
|
|
893
|
+
else {
|
|
894
|
+
node.textContent = this.datePipe.transform(html, this.format, this.timezone, this.locale);
|
|
895
|
+
}
|
|
896
|
+
});
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
DateDirective.decorators = [
|
|
900
|
+
{ type: Directive, args: [{
|
|
901
|
+
selector: '[scDate]',
|
|
902
|
+
},] }
|
|
903
|
+
];
|
|
904
|
+
DateDirective.ctorParameters = () => [
|
|
905
|
+
{ type: ViewContainerRef },
|
|
906
|
+
{ type: TemplateRef },
|
|
907
|
+
{ type: DatePipe }
|
|
908
|
+
];
|
|
909
|
+
DateDirective.propDecorators = {
|
|
910
|
+
format: [{ type: Input, args: ['scDateFormat',] }],
|
|
911
|
+
timezone: [{ type: Input, args: ['scDateTimezone',] }],
|
|
912
|
+
locale: [{ type: Input, args: ['scDateLocale',] }],
|
|
913
|
+
editable: [{ type: Input, args: ['scDateEditable',] }],
|
|
914
|
+
field: [{ type: Input, args: ['scDate',] }]
|
|
918
915
|
};
|
|
919
916
|
|
|
920
|
-
class MissingComponentComponent {
|
|
921
|
-
}
|
|
922
|
-
MissingComponentComponent.decorators = [
|
|
923
|
-
{ type: Component, args: [{
|
|
924
|
-
selector: 'sc-missing-component',
|
|
917
|
+
class MissingComponentComponent {
|
|
918
|
+
}
|
|
919
|
+
MissingComponentComponent.decorators = [
|
|
920
|
+
{ type: Component, args: [{
|
|
921
|
+
selector: 'sc-missing-component',
|
|
925
922
|
template: `
|
|
926
|
-
<div
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
</
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
923
|
+
<div
|
|
924
|
+
style="background: darkorange; outline: 5px solid orange; padding: 10px; color: white; max-width: 500px;"
|
|
925
|
+
>
|
|
926
|
+
<h2>{{ rendering.componentName }}</h2>
|
|
927
|
+
<p>JSS component is missing Angular component implementation.</p>
|
|
928
|
+
</div>
|
|
929
|
+
`
|
|
930
|
+
},] }
|
|
931
|
+
];
|
|
932
|
+
MissingComponentComponent.propDecorators = {
|
|
933
|
+
rendering: [{ type: Input }]
|
|
934
934
|
};
|
|
935
935
|
|
|
936
|
-
/**
|
|
937
|
-
* Renders a single JSS component given a rendering definition.
|
|
938
|
-
* Useful inside templated placeholders.
|
|
939
|
-
*/
|
|
940
|
-
class RenderComponentComponent {
|
|
941
|
-
constructor(componentFactoryResolver, differs, componentFactory, missingComponentComponent) {
|
|
942
|
-
this.componentFactoryResolver = componentFactoryResolver;
|
|
943
|
-
this.differs = differs;
|
|
944
|
-
this.componentFactory = componentFactory;
|
|
945
|
-
this.missingComponentComponent = missingComponentComponent;
|
|
946
|
-
this.destroyed = false;
|
|
947
|
-
}
|
|
948
|
-
set inputs(value) {
|
|
949
|
-
this._inputs = value;
|
|
950
|
-
if (!this._differ && value) {
|
|
951
|
-
this._differ = this.differs.find(value).create();
|
|
952
|
-
}
|
|
953
|
-
}
|
|
954
|
-
ngOnChanges(changes) {
|
|
955
|
-
if (changes
|
|
956
|
-
this._render();
|
|
957
|
-
}
|
|
958
|
-
}
|
|
959
|
-
_setComponentInputs(componentInstance, inputs) {
|
|
960
|
-
Object.entries(inputs).forEach(([input, inputValue]) => componentInstance[input] = inputValue);
|
|
961
|
-
}
|
|
962
|
-
_subscribeComponentOutputs(componentInstance, outputs) {
|
|
963
|
-
Object.keys(outputs)
|
|
964
|
-
.filter((output) => componentInstance[output] && componentInstance[output] instanceof Observable)
|
|
965
|
-
.forEach((output) => componentInstance[output]
|
|
966
|
-
.pipe(takeWhile(() => !this.destroyed))
|
|
967
|
-
.subscribe(outputs[output]));
|
|
968
|
-
}
|
|
969
|
-
_render() {
|
|
970
|
-
this.view.clear();
|
|
971
|
-
if (!this.rendering) {
|
|
972
|
-
return;
|
|
973
|
-
}
|
|
974
|
-
const resolveComponent = isRawRendering(this.rendering)
|
|
975
|
-
? Promise.resolve({
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
936
|
+
/**
|
|
937
|
+
* Renders a single JSS component given a rendering definition.
|
|
938
|
+
* Useful inside templated placeholders.
|
|
939
|
+
*/
|
|
940
|
+
class RenderComponentComponent {
|
|
941
|
+
constructor(componentFactoryResolver, differs, componentFactory, missingComponentComponent) {
|
|
942
|
+
this.componentFactoryResolver = componentFactoryResolver;
|
|
943
|
+
this.differs = differs;
|
|
944
|
+
this.componentFactory = componentFactory;
|
|
945
|
+
this.missingComponentComponent = missingComponentComponent;
|
|
946
|
+
this.destroyed = false;
|
|
947
|
+
}
|
|
948
|
+
set inputs(value) {
|
|
949
|
+
this._inputs = value;
|
|
950
|
+
if (!this._differ && value) {
|
|
951
|
+
this._differ = this.differs.find(value).create();
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
ngOnChanges(changes) {
|
|
955
|
+
if (changes.rendering) {
|
|
956
|
+
this._render();
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
_setComponentInputs(componentInstance, inputs) {
|
|
960
|
+
Object.entries(inputs).forEach(([input, inputValue]) => (componentInstance[input] = inputValue));
|
|
961
|
+
}
|
|
962
|
+
_subscribeComponentOutputs(componentInstance, outputs) {
|
|
963
|
+
Object.keys(outputs)
|
|
964
|
+
.filter((output) => componentInstance[output] && componentInstance[output] instanceof Observable)
|
|
965
|
+
.forEach((output) => componentInstance[output]
|
|
966
|
+
.pipe(takeWhile(() => !this.destroyed))
|
|
967
|
+
.subscribe(outputs[output]));
|
|
968
|
+
}
|
|
969
|
+
_render() {
|
|
970
|
+
this.view.clear();
|
|
971
|
+
if (!this.rendering) {
|
|
972
|
+
return;
|
|
973
|
+
}
|
|
974
|
+
const resolveComponent = isRawRendering(this.rendering)
|
|
975
|
+
? Promise.resolve({
|
|
976
|
+
componentImplementation: RawComponent,
|
|
977
|
+
componentDefinition: this.rendering,
|
|
978
|
+
})
|
|
979
|
+
: this.componentFactory.getComponent(this.rendering);
|
|
980
|
+
resolveComponent.then((rendering) => {
|
|
981
|
+
if (!rendering.componentImplementation) {
|
|
982
|
+
const componentName = rendering.componentDefinition.componentName;
|
|
980
983
|
console.error(`Attempted to render unknown component ${componentName}.`, `Ensure component is mapped, like:
|
|
981
984
|
JssModule.withComponents([
|
|
982
985
|
{ name: '${componentName}', type: ${componentName}Component }
|
|
983
|
-
])`);
|
|
984
|
-
rendering.componentImplementation = this.missingComponentComponent;
|
|
985
|
-
}
|
|
986
|
-
const componentFactory = rendering.componentFactory ||
|
|
987
|
-
|
|
988
|
-
componentInstance
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
}
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
986
|
+
])`);
|
|
987
|
+
rendering.componentImplementation = this.missingComponentComponent;
|
|
988
|
+
}
|
|
989
|
+
const componentFactory = rendering.componentFactory ||
|
|
990
|
+
this.componentFactoryResolver.resolveComponentFactory(rendering.componentImplementation);
|
|
991
|
+
const componentInstance = this.view.createComponent(componentFactory, 0).instance;
|
|
992
|
+
componentInstance.rendering = rendering.componentDefinition;
|
|
993
|
+
if (this._inputs) {
|
|
994
|
+
this._setComponentInputs(componentInstance, this._inputs);
|
|
995
|
+
}
|
|
996
|
+
if (this.outputs) {
|
|
997
|
+
this._subscribeComponentOutputs(componentInstance, this.outputs);
|
|
998
|
+
}
|
|
999
|
+
});
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
RenderComponentComponent.decorators = [
|
|
1003
|
+
{ type: Component, args: [{
|
|
1004
|
+
selector: 'sc-render-component',
|
|
1001
1005
|
template: `
|
|
1002
1006
|
<ng-template #view></ng-template>
|
|
1003
|
-
`
|
|
1004
|
-
},] }
|
|
1005
|
-
];
|
|
1006
|
-
RenderComponentComponent.ctorParameters = () => [
|
|
1007
|
-
{ type: ComponentFactoryResolver },
|
|
1008
|
-
{ type: KeyValueDiffers },
|
|
1009
|
-
{ type: JssComponentFactoryService },
|
|
1010
|
-
{ type: Type, decorators: [{ type: Inject, args: [PLACEHOLDER_MISSING_COMPONENT_COMPONENT,] }] }
|
|
1011
|
-
];
|
|
1012
|
-
RenderComponentComponent.propDecorators = {
|
|
1013
|
-
rendering: [{ type: Input }],
|
|
1014
|
-
outputs: [{ type: Input }],
|
|
1015
|
-
view: [{ type: ViewChild, args: ['view', { read: ViewContainerRef, static: true },] }],
|
|
1016
|
-
inputs: [{ type: Input }]
|
|
1007
|
+
`
|
|
1008
|
+
},] }
|
|
1009
|
+
];
|
|
1010
|
+
RenderComponentComponent.ctorParameters = () => [
|
|
1011
|
+
{ type: ComponentFactoryResolver },
|
|
1012
|
+
{ type: KeyValueDiffers },
|
|
1013
|
+
{ type: JssComponentFactoryService },
|
|
1014
|
+
{ type: Type, decorators: [{ type: Inject, args: [PLACEHOLDER_MISSING_COMPONENT_COMPONENT,] }] }
|
|
1015
|
+
];
|
|
1016
|
+
RenderComponentComponent.propDecorators = {
|
|
1017
|
+
rendering: [{ type: Input }],
|
|
1018
|
+
outputs: [{ type: Input }],
|
|
1019
|
+
view: [{ type: ViewChild, args: ['view', { read: ViewContainerRef, static: true },] }],
|
|
1020
|
+
inputs: [{ type: Input }]
|
|
1017
1021
|
};
|
|
1018
1022
|
|
|
1019
|
-
class JssModule {
|
|
1020
|
-
/**
|
|
1021
|
-
* Instantiates the JSS module with no component factory.
|
|
1022
|
-
* Useful for using it from libraries. Most of the time you'd want withComponents()
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
{ provide:
|
|
1041
|
-
{ provide:
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
*
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
},] }
|
|
1023
|
+
class JssModule {
|
|
1024
|
+
/**
|
|
1025
|
+
* Instantiates the JSS module with no component factory.
|
|
1026
|
+
* Useful for using it from libraries. Most of the time you'd want withComponents()
|
|
1027
|
+
* @returns {ModuleWithProviders<JssModule>} module
|
|
1028
|
+
*/
|
|
1029
|
+
static forRoot() {
|
|
1030
|
+
return {
|
|
1031
|
+
ngModule: JssModule,
|
|
1032
|
+
providers: [LayoutService, DatePipe, JssComponentFactoryService],
|
|
1033
|
+
};
|
|
1034
|
+
}
|
|
1035
|
+
/**
|
|
1036
|
+
* Instantiates a module for a lazy-loaded JSS component
|
|
1037
|
+
* @param {Type<any>} component
|
|
1038
|
+
* @returns {ModuleWithProviders<JssModule>} module
|
|
1039
|
+
*/
|
|
1040
|
+
static forChild(component) {
|
|
1041
|
+
return {
|
|
1042
|
+
ngModule: JssModule,
|
|
1043
|
+
providers: [
|
|
1044
|
+
{ provide: ANALYZE_FOR_ENTRY_COMPONENTS, useValue: component, multi: true },
|
|
1045
|
+
{ provide: ROUTES, useValue: [], multi: true },
|
|
1046
|
+
{ provide: DYNAMIC_COMPONENT, useValue: component },
|
|
1047
|
+
],
|
|
1048
|
+
};
|
|
1049
|
+
}
|
|
1050
|
+
/**
|
|
1051
|
+
* Instantiates the JSS module and specifies the mapping from component name to component implementation.
|
|
1052
|
+
* Appropriate when defining the set of JSS components that your app is aware of.
|
|
1053
|
+
* @param {ComponentNameAndType[]} components
|
|
1054
|
+
* @param {ComponentNameAndModule[]} [lazyComponents]
|
|
1055
|
+
* @returns {ModuleWithProviders<JssModule>} module
|
|
1056
|
+
*/
|
|
1057
|
+
static withComponents(components, lazyComponents) {
|
|
1058
|
+
return {
|
|
1059
|
+
ngModule: JssModule,
|
|
1060
|
+
providers: [
|
|
1061
|
+
{
|
|
1062
|
+
provide: ANALYZE_FOR_ENTRY_COMPONENTS,
|
|
1063
|
+
useValue: components,
|
|
1064
|
+
multi: true,
|
|
1065
|
+
},
|
|
1066
|
+
{ provide: PLACEHOLDER_COMPONENTS, useValue: components },
|
|
1067
|
+
{ provide: PLACEHOLDER_LAZY_COMPONENTS, useValue: lazyComponents || [] },
|
|
1068
|
+
{ provide: ROUTES, useValue: lazyComponents || [], multi: true },
|
|
1069
|
+
{ provide: PLACEHOLDER_MISSING_COMPONENT_COMPONENT, useValue: MissingComponentComponent },
|
|
1070
|
+
...JssModule.forRoot().providers,
|
|
1071
|
+
],
|
|
1072
|
+
};
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
JssModule.decorators = [
|
|
1076
|
+
{ type: NgModule, args: [{
|
|
1077
|
+
imports: [CommonModule],
|
|
1078
|
+
declarations: [
|
|
1079
|
+
FileDirective,
|
|
1080
|
+
ImageDirective,
|
|
1081
|
+
LinkDirective,
|
|
1082
|
+
RouterLinkDirective,
|
|
1083
|
+
GenericLinkDirective,
|
|
1084
|
+
DateDirective,
|
|
1085
|
+
RenderEachDirective,
|
|
1086
|
+
RenderEmptyDirective,
|
|
1087
|
+
PlaceholderLoadingDirective,
|
|
1088
|
+
RenderComponentComponent,
|
|
1089
|
+
PlaceholderComponent,
|
|
1090
|
+
RawComponent,
|
|
1091
|
+
RichTextDirective,
|
|
1092
|
+
TextDirective,
|
|
1093
|
+
MissingComponentComponent,
|
|
1094
|
+
],
|
|
1095
|
+
exports: [
|
|
1096
|
+
FileDirective,
|
|
1097
|
+
ImageDirective,
|
|
1098
|
+
DateDirective,
|
|
1099
|
+
LinkDirective,
|
|
1100
|
+
RouterLinkDirective,
|
|
1101
|
+
GenericLinkDirective,
|
|
1102
|
+
RenderEachDirective,
|
|
1103
|
+
RenderEmptyDirective,
|
|
1104
|
+
RenderComponentComponent,
|
|
1105
|
+
PlaceholderComponent,
|
|
1106
|
+
PlaceholderLoadingDirective,
|
|
1107
|
+
RichTextDirective,
|
|
1108
|
+
TextDirective,
|
|
1109
|
+
],
|
|
1110
|
+
entryComponents: [RawComponent, MissingComponentComponent],
|
|
1111
|
+
},] }
|
|
1109
1112
|
];
|
|
1110
1113
|
|
|
1111
|
-
/**
|
|
1112
|
-
* Generated bundle index. Do not edit.
|
|
1114
|
+
/**
|
|
1115
|
+
* Generated bundle index. Do not edit.
|
|
1113
1116
|
*/
|
|
1114
1117
|
|
|
1115
1118
|
export { ComponentNameAndType, DYNAMIC_COMPONENT, FileDirective, GenericLinkDirective, ImageDirective, JssModule, LayoutService, LayoutServiceError, LinkDirective, PlaceholderComponent, PlaceholderLoadingDirective, RichTextDirective, RouterLinkDirective, TextDirective, isRawRendering, PLACEHOLDER_COMPONENTS as ɵb, PLACEHOLDER_LAZY_COMPONENTS as ɵc, PLACEHOLDER_MISSING_COMPONENT_COMPONENT as ɵd, RenderEachDirective as ɵe, RenderEmptyDirective as ɵf, JssComponentFactoryService as ɵg, DateDirective as ɵh, RenderComponentComponent as ɵi, RawComponent as ɵj, MissingComponentComponent as ɵk };
|