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