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