@sitecore-jss/sitecore-jss-angular 21.6.2 → 21.6.3-canary.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 +273 -272
- 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 +89 -88
- 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 +1509 -1507
- package/dist/fesm2022/sitecore-jss-sitecore-jss-angular.mjs.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/jss-component-factory.service.d.ts +26 -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,1130 @@ 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
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
static
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
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
|
+
componentModuleRef: moduleRef,
|
|
631
|
+
canActivate: lazyComponent.canActivate,
|
|
632
|
+
resolve: lazyComponent.resolve,
|
|
633
|
+
};
|
|
634
|
+
});
|
|
635
|
+
}
|
|
636
|
+
return Promise.resolve({
|
|
637
|
+
componentDefinition: component,
|
|
638
|
+
});
|
|
639
|
+
}
|
|
640
|
+
getComponents(components) {
|
|
641
|
+
// acquire all components and keep them in order while handling their potential async-ness
|
|
642
|
+
return Promise.all(components.map((component) => isRawRendering(component) ? this.getRawComponent(component) : this.getComponent(component)));
|
|
643
|
+
}
|
|
644
|
+
getRawComponent(component) {
|
|
645
|
+
return Promise.resolve({
|
|
646
|
+
componentImplementation: RawComponent,
|
|
647
|
+
componentDefinition: component,
|
|
648
|
+
});
|
|
649
|
+
}
|
|
650
|
+
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 });
|
|
651
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: JssComponentFactoryService });
|
|
652
|
+
}
|
|
653
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: JssComponentFactoryService, decorators: [{
|
|
654
|
+
type: Injectable
|
|
655
|
+
}], ctorParameters: function () { return [{ type: i0.Injector }, { type: undefined, decorators: [{
|
|
656
|
+
type: Inject,
|
|
657
|
+
args: [PLACEHOLDER_COMPONENTS]
|
|
658
|
+
}] }, { type: undefined, decorators: [{
|
|
659
|
+
type: Inject,
|
|
660
|
+
args: [PLACEHOLDER_LAZY_COMPONENTS]
|
|
660
661
|
}] }]; } });
|
|
661
662
|
|
|
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;
|
|
663
|
+
/* eslint-disable @angular-eslint/no-conflicting-lifecycle */
|
|
664
|
+
/**
|
|
665
|
+
* @param {ComponentRendering} rendering
|
|
666
|
+
* @param {string} name
|
|
667
|
+
*/
|
|
668
|
+
function getPlaceholder(rendering, name) {
|
|
669
|
+
if (rendering && rendering.placeholders && Object.keys(rendering.placeholders).length > 0) {
|
|
670
|
+
return rendering.placeholders[name];
|
|
671
|
+
}
|
|
672
|
+
return null;
|
|
673
|
+
}
|
|
674
|
+
class PlaceholderComponent {
|
|
675
|
+
differs;
|
|
676
|
+
componentFactory;
|
|
677
|
+
changeDetectorRef;
|
|
678
|
+
elementRef;
|
|
679
|
+
renderer;
|
|
680
|
+
router;
|
|
681
|
+
missingComponentComponent;
|
|
682
|
+
hiddenRenderingComponent;
|
|
683
|
+
guardResolver;
|
|
684
|
+
dataResolver;
|
|
685
|
+
platformId;
|
|
686
|
+
name;
|
|
687
|
+
rendering;
|
|
688
|
+
renderings;
|
|
689
|
+
outputs;
|
|
690
|
+
clientOnly = false;
|
|
691
|
+
loaded = new EventEmitter();
|
|
692
|
+
renderEachTemplate;
|
|
693
|
+
renderEmptyTemplate;
|
|
694
|
+
placeholderLoading;
|
|
695
|
+
view;
|
|
696
|
+
isLoading = true;
|
|
697
|
+
_inputs;
|
|
698
|
+
_differ;
|
|
699
|
+
_componentInstances = [];
|
|
700
|
+
destroyed = false;
|
|
701
|
+
parentStyleAttribute = '';
|
|
702
|
+
constructor(differs, componentFactory, changeDetectorRef, elementRef, renderer, router, missingComponentComponent, hiddenRenderingComponent, guardResolver, dataResolver,
|
|
703
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
704
|
+
platformId) {
|
|
705
|
+
this.differs = differs;
|
|
706
|
+
this.componentFactory = componentFactory;
|
|
707
|
+
this.changeDetectorRef = changeDetectorRef;
|
|
708
|
+
this.elementRef = elementRef;
|
|
709
|
+
this.renderer = renderer;
|
|
710
|
+
this.router = router;
|
|
711
|
+
this.missingComponentComponent = missingComponentComponent;
|
|
712
|
+
this.hiddenRenderingComponent = hiddenRenderingComponent;
|
|
713
|
+
this.guardResolver = guardResolver;
|
|
714
|
+
this.dataResolver = dataResolver;
|
|
715
|
+
this.platformId = platformId;
|
|
716
|
+
}
|
|
717
|
+
set inputs(value) {
|
|
718
|
+
this._inputs = value;
|
|
719
|
+
if (!this._differ && value) {
|
|
720
|
+
this._differ = this.differs.find(value).create();
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
ngOnInit() {
|
|
724
|
+
// just to ensure the element exists
|
|
725
|
+
const elem = this.elementRef.nativeElement;
|
|
726
|
+
if (elem) {
|
|
727
|
+
const attributes = elem.attributes;
|
|
728
|
+
for (let i = 0; i < attributes.length; i++) {
|
|
729
|
+
const attr = attributes.item(i);
|
|
730
|
+
if (attr && attr.name.indexOf('_ngcontent') !== -1) {
|
|
731
|
+
this.parentStyleAttribute = attr.name;
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
ngOnDestroy() {
|
|
737
|
+
this.destroyed = true;
|
|
738
|
+
this._componentInstances = [];
|
|
739
|
+
}
|
|
740
|
+
ngOnChanges(changes) {
|
|
741
|
+
if (changes.rendering || changes.renderings) {
|
|
742
|
+
this._render();
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
ngDoCheck() {
|
|
746
|
+
if (!this._differ || !this._inputs || this._componentInstances.length === 0) {
|
|
747
|
+
return;
|
|
748
|
+
}
|
|
749
|
+
const changes = this._differ.diff(this._inputs);
|
|
750
|
+
if (!changes) {
|
|
751
|
+
return;
|
|
752
|
+
}
|
|
753
|
+
const updates = {};
|
|
754
|
+
changes.forEachRemovedItem((change) => (updates[change.key] = null));
|
|
755
|
+
changes.forEachAddedItem((change) => (updates[change.key] = change.currentValue));
|
|
756
|
+
changes.forEachChangedItem((change) => (updates[change.key] = change.currentValue));
|
|
757
|
+
this._componentInstances.forEach((componentInstance) => this._setComponentInputs(componentInstance, updates));
|
|
758
|
+
}
|
|
759
|
+
_setComponentInputs(componentInstance, inputs) {
|
|
760
|
+
Object.entries(inputs).forEach(([input, inputValue]) => (componentInstance[input] = inputValue));
|
|
761
|
+
}
|
|
762
|
+
_subscribeComponentOutputs(componentInstance, outputs) {
|
|
763
|
+
Object.keys(outputs)
|
|
764
|
+
.filter((output) => componentInstance[output] && componentInstance[output] instanceof Observable)
|
|
765
|
+
.forEach((output) => componentInstance[output]
|
|
766
|
+
.pipe(takeWhile(() => !this.destroyed))
|
|
767
|
+
.subscribe(outputs[output]));
|
|
768
|
+
}
|
|
769
|
+
async _render() {
|
|
770
|
+
if (this.clientOnly && isPlatformServer(this.platformId)) {
|
|
771
|
+
return;
|
|
772
|
+
}
|
|
773
|
+
this._componentInstances = [];
|
|
774
|
+
this.view.clear();
|
|
775
|
+
if (!this.rendering && !this.renderings) {
|
|
776
|
+
return;
|
|
777
|
+
}
|
|
778
|
+
if (!this.name && !this.renderings) {
|
|
779
|
+
console.warn('Placeholder name was not specified, and explicit renderings array was not passed. Placeholder requires either name and rendering, or renderings.');
|
|
780
|
+
this.isLoading = false;
|
|
781
|
+
return;
|
|
782
|
+
}
|
|
783
|
+
const placeholder = this.renderings || getPlaceholder(this.rendering, this.name || '');
|
|
784
|
+
if (!placeholder) {
|
|
785
|
+
console.warn(`Placeholder '${this.name}' was not found in the current rendering data`, JSON.stringify(this.rendering, null, 2));
|
|
786
|
+
this.isLoading = false;
|
|
787
|
+
return;
|
|
788
|
+
}
|
|
789
|
+
// if the placeholder is empty (contains only raw renderings), then we may need to use the empty template if it's defined
|
|
790
|
+
const placeholderIsEmpty = placeholder.every((rendering) => isRawRendering(rendering));
|
|
791
|
+
if (this.renderEmptyTemplate && placeholderIsEmpty) {
|
|
792
|
+
this.view.createEmbeddedView(this.renderEmptyTemplate.templateRef, {
|
|
793
|
+
renderings: placeholder,
|
|
794
|
+
});
|
|
795
|
+
this.isLoading = false;
|
|
796
|
+
}
|
|
797
|
+
else {
|
|
798
|
+
const factories = await this.componentFactory.getComponents(placeholder);
|
|
799
|
+
try {
|
|
800
|
+
const nonGuarded = await this.guardResolver(factories);
|
|
801
|
+
const withData = await this.dataResolver(nonGuarded);
|
|
802
|
+
withData.forEach((rendering, index) => {
|
|
803
|
+
if (this.renderEachTemplate && !isRawRendering(rendering.factory.componentDefinition)) {
|
|
804
|
+
this._renderTemplatedComponent(rendering.factory.componentDefinition, index);
|
|
805
|
+
}
|
|
806
|
+
else {
|
|
807
|
+
this._renderEmbeddedComponent(rendering.factory, rendering.data, index);
|
|
808
|
+
}
|
|
809
|
+
});
|
|
810
|
+
this.isLoading = false;
|
|
811
|
+
this.changeDetectorRef.markForCheck();
|
|
812
|
+
this.loaded.emit(this.name);
|
|
813
|
+
}
|
|
814
|
+
catch (e) {
|
|
815
|
+
this.isLoading = false;
|
|
816
|
+
if (e instanceof UrlTree) {
|
|
817
|
+
this.router.navigateByUrl(e);
|
|
818
|
+
}
|
|
819
|
+
else if (typeof e === 'string') {
|
|
820
|
+
this.router.navigate([e]);
|
|
821
|
+
}
|
|
822
|
+
else if (Array.isArray(e)) {
|
|
823
|
+
this.router.navigate(e);
|
|
824
|
+
}
|
|
825
|
+
else {
|
|
826
|
+
throw e;
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
_renderTemplatedComponent(rendering, index) {
|
|
832
|
+
// the render-each template takes care of all component mapping etc
|
|
833
|
+
// generally using <sc-render-component> which is about like _renderEmbeddedComponent()
|
|
834
|
+
// as a separate component
|
|
835
|
+
this.view.createEmbeddedView(this.renderEachTemplate.templateRef, {
|
|
836
|
+
rendering,
|
|
837
|
+
index,
|
|
838
|
+
});
|
|
839
|
+
}
|
|
840
|
+
_renderEmbeddedComponent(rendering, data, index) {
|
|
841
|
+
if (rendering.componentDefinition.componentName === HIDDEN_RENDERING_NAME) {
|
|
842
|
+
rendering.componentImplementation = this.hiddenRenderingComponent;
|
|
843
|
+
}
|
|
844
|
+
if (!rendering.componentImplementation) {
|
|
845
|
+
const componentName = rendering.componentDefinition.componentName;
|
|
845
846
|
console.error(`Placeholder ${this.name} contains unknown component ${componentName}.`, `Ensure component is mapped, like:
|
|
846
847
|
JssModule.withComponents([
|
|
847
848
|
{ 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
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
componentInstance
|
|
861
|
-
componentInstance.
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
849
|
+
])`);
|
|
850
|
+
rendering.componentImplementation = this.missingComponentComponent;
|
|
851
|
+
}
|
|
852
|
+
// apply the parent style attribute _ngcontent
|
|
853
|
+
// work-around for https://github.com/angular/angular/issues/12215
|
|
854
|
+
const createdComponentRef = this.view.createComponent(rendering.componentImplementation, {
|
|
855
|
+
index: index,
|
|
856
|
+
ngModuleRef: rendering.componentModuleRef,
|
|
857
|
+
});
|
|
858
|
+
if (this.parentStyleAttribute) {
|
|
859
|
+
this.renderer.setAttribute(createdComponentRef.location.nativeElement, this.parentStyleAttribute, '');
|
|
860
|
+
}
|
|
861
|
+
const componentInstance = createdComponentRef.instance;
|
|
862
|
+
componentInstance.rendering = rendering.componentDefinition;
|
|
863
|
+
componentInstance.data = data;
|
|
864
|
+
if (this._inputs) {
|
|
865
|
+
this._setComponentInputs(componentInstance, this._inputs);
|
|
866
|
+
}
|
|
867
|
+
if (this.outputs) {
|
|
868
|
+
this._subscribeComponentOutputs(componentInstance, this.outputs);
|
|
869
|
+
}
|
|
870
|
+
this._componentInstances.push(componentInstance);
|
|
871
|
+
}
|
|
872
|
+
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
873
|
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
874
|
<ng-template
|
|
873
875
|
*ngIf="isLoading"
|
|
874
876
|
[ngTemplateOutlet]="placeholderLoading?.templateRef"
|
|
875
877
|
></ng-template>
|
|
876
878
|
<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]',
|
|
879
|
+
`, 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"] }] });
|
|
880
|
+
}
|
|
881
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PlaceholderComponent, decorators: [{
|
|
882
|
+
type: Component,
|
|
883
|
+
args: [{
|
|
884
|
+
selector: 'sc-placeholder,[sc-placeholder]',
|
|
883
885
|
template: `
|
|
884
886
|
<ng-template
|
|
885
887
|
*ngIf="isLoading"
|
|
886
888
|
[ngTemplateOutlet]="placeholderLoading?.templateRef"
|
|
887
889
|
></ng-template>
|
|
888
890
|
<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
|
|
891
|
+
`,
|
|
892
|
+
}]
|
|
893
|
+
}], ctorParameters: function () { return [{ type: i0.KeyValueDiffers }, { type: JssComponentFactoryService }, { type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i1.Router }, { type: i0.Type, decorators: [{
|
|
894
|
+
type: Inject,
|
|
895
|
+
args: [PLACEHOLDER_MISSING_COMPONENT_COMPONENT]
|
|
896
|
+
}] }, { type: i0.Type, decorators: [{
|
|
897
|
+
type: Inject,
|
|
898
|
+
args: [PLACEHOLDER_HIDDEN_RENDERING_COMPONENT]
|
|
899
|
+
}] }, { type: undefined, decorators: [{
|
|
900
|
+
type: Inject,
|
|
901
|
+
args: [GUARD_RESOLVER]
|
|
902
|
+
}] }, { type: undefined, decorators: [{
|
|
903
|
+
type: Inject,
|
|
904
|
+
args: [DATA_RESOLVER]
|
|
905
|
+
}] }, { type: Object, decorators: [{
|
|
906
|
+
type: Inject,
|
|
907
|
+
args: [PLATFORM_ID]
|
|
908
|
+
}] }]; }, propDecorators: { name: [{
|
|
909
|
+
type: Input
|
|
910
|
+
}], rendering: [{
|
|
911
|
+
type: Input
|
|
912
|
+
}], renderings: [{
|
|
913
|
+
type: Input
|
|
914
|
+
}], outputs: [{
|
|
915
|
+
type: Input
|
|
916
|
+
}], clientOnly: [{
|
|
917
|
+
type: Input
|
|
918
|
+
}], loaded: [{
|
|
919
|
+
type: Output
|
|
920
|
+
}], renderEachTemplate: [{
|
|
921
|
+
type: ContentChild,
|
|
922
|
+
args: [RenderEachDirective, { static: true }]
|
|
923
|
+
}], renderEmptyTemplate: [{
|
|
924
|
+
type: ContentChild,
|
|
925
|
+
args: [RenderEmptyDirective, { static: true }]
|
|
926
|
+
}], placeholderLoading: [{
|
|
927
|
+
type: ContentChild,
|
|
928
|
+
args: [PlaceholderLoadingDirective, { static: true }]
|
|
929
|
+
}], view: [{
|
|
930
|
+
type: ViewChild,
|
|
931
|
+
args: ['view', { read: ViewContainerRef, static: true }]
|
|
932
|
+
}], inputs: [{
|
|
933
|
+
type: Input
|
|
932
934
|
}] } });
|
|
933
935
|
|
|
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;
|
|
936
|
+
/**
|
|
937
|
+
* Renders a single JSS component given a rendering definition.
|
|
938
|
+
* Useful inside templated placeholders.
|
|
939
|
+
*/
|
|
940
|
+
class RenderComponentComponent {
|
|
941
|
+
differs;
|
|
942
|
+
componentFactory;
|
|
943
|
+
missingComponentComponent;
|
|
944
|
+
rendering;
|
|
945
|
+
outputs;
|
|
946
|
+
view;
|
|
947
|
+
_inputs;
|
|
948
|
+
_differ;
|
|
949
|
+
destroyed = false;
|
|
950
|
+
constructor(differs, componentFactory, missingComponentComponent) {
|
|
951
|
+
this.differs = differs;
|
|
952
|
+
this.componentFactory = componentFactory;
|
|
953
|
+
this.missingComponentComponent = missingComponentComponent;
|
|
954
|
+
}
|
|
955
|
+
set inputs(value) {
|
|
956
|
+
this._inputs = value;
|
|
957
|
+
if (!this._differ && value) {
|
|
958
|
+
this._differ = this.differs.find(value).create();
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
ngOnChanges(changes) {
|
|
962
|
+
if (changes.rendering) {
|
|
963
|
+
this._render();
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
_setComponentInputs(componentInstance, inputs) {
|
|
967
|
+
Object.entries(inputs).forEach(([input, inputValue]) => (componentInstance[input] = inputValue));
|
|
968
|
+
}
|
|
969
|
+
_subscribeComponentOutputs(componentInstance, outputs) {
|
|
970
|
+
Object.keys(outputs)
|
|
971
|
+
.filter((output) => componentInstance[output] && componentInstance[output] instanceof Observable)
|
|
972
|
+
.forEach((output) => componentInstance[output]
|
|
973
|
+
.pipe(takeWhile(() => !this.destroyed))
|
|
974
|
+
.subscribe(outputs[output]));
|
|
975
|
+
}
|
|
976
|
+
_render() {
|
|
977
|
+
this.view.clear();
|
|
978
|
+
if (!this.rendering) {
|
|
979
|
+
return;
|
|
980
|
+
}
|
|
981
|
+
const resolveComponent = isRawRendering(this.rendering)
|
|
982
|
+
? Promise.resolve({
|
|
983
|
+
componentImplementation: RawComponent,
|
|
984
|
+
componentDefinition: this.rendering,
|
|
985
|
+
})
|
|
986
|
+
: this.componentFactory.getComponent(this.rendering);
|
|
987
|
+
resolveComponent.then((rendering) => {
|
|
988
|
+
if (!rendering.componentImplementation) {
|
|
989
|
+
const componentName = rendering.componentDefinition.componentName;
|
|
988
990
|
console.error(`Attempted to render unknown component ${componentName}.`, `Ensure component is mapped, like:
|
|
989
991
|
JssModule.withComponents([
|
|
990
992
|
{ 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 });
|
|
993
|
+
])`);
|
|
994
|
+
rendering.componentImplementation = this.missingComponentComponent;
|
|
995
|
+
}
|
|
996
|
+
const componentInstance = this.view.createComponent(rendering.componentImplementation)
|
|
997
|
+
.instance;
|
|
998
|
+
componentInstance.rendering = rendering.componentDefinition;
|
|
999
|
+
if (this._inputs) {
|
|
1000
|
+
this._setComponentInputs(componentInstance, this._inputs);
|
|
1001
|
+
}
|
|
1002
|
+
if (this.outputs) {
|
|
1003
|
+
this._subscribeComponentOutputs(componentInstance, this.outputs);
|
|
1004
|
+
}
|
|
1005
|
+
});
|
|
1006
|
+
}
|
|
1007
|
+
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
1008
|
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
1009
|
<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',
|
|
1010
|
+
`, isInline: true });
|
|
1011
|
+
}
|
|
1012
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RenderComponentComponent, decorators: [{
|
|
1013
|
+
type: Component,
|
|
1014
|
+
args: [{
|
|
1015
|
+
selector: 'sc-render-component',
|
|
1014
1016
|
template: `
|
|
1015
1017
|
<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
|
|
1018
|
+
`,
|
|
1019
|
+
}]
|
|
1020
|
+
}], ctorParameters: function () { return [{ type: i0.KeyValueDiffers }, { type: JssComponentFactoryService }, { type: i0.Type, decorators: [{
|
|
1021
|
+
type: Inject,
|
|
1022
|
+
args: [PLACEHOLDER_MISSING_COMPONENT_COMPONENT]
|
|
1023
|
+
}] }]; }, propDecorators: { rendering: [{
|
|
1024
|
+
type: Input
|
|
1025
|
+
}], outputs: [{
|
|
1026
|
+
type: Input
|
|
1027
|
+
}], view: [{
|
|
1028
|
+
type: ViewChild,
|
|
1029
|
+
args: ['view', { read: ViewContainerRef, static: true }]
|
|
1030
|
+
}], inputs: [{
|
|
1031
|
+
type: Input
|
|
1030
1032
|
}] } });
|
|
1031
1033
|
|
|
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']
|
|
1034
|
+
class DateDirective {
|
|
1035
|
+
viewContainer;
|
|
1036
|
+
templateRef;
|
|
1037
|
+
datePipe;
|
|
1038
|
+
format;
|
|
1039
|
+
timezone;
|
|
1040
|
+
locale;
|
|
1041
|
+
editable = true;
|
|
1042
|
+
field;
|
|
1043
|
+
viewRef;
|
|
1044
|
+
constructor(viewContainer, templateRef, datePipe) {
|
|
1045
|
+
this.viewContainer = viewContainer;
|
|
1046
|
+
this.templateRef = templateRef;
|
|
1047
|
+
this.datePipe = datePipe;
|
|
1048
|
+
}
|
|
1049
|
+
ngOnChanges(changes) {
|
|
1050
|
+
if (changes.field || changes.format) {
|
|
1051
|
+
if (!this.viewRef) {
|
|
1052
|
+
this.viewContainer.clear();
|
|
1053
|
+
this.viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
|
|
1054
|
+
}
|
|
1055
|
+
this.updateView();
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
updateView() {
|
|
1059
|
+
const field = this.field;
|
|
1060
|
+
if (!field || (!field.editable && !field.value)) {
|
|
1061
|
+
return;
|
|
1062
|
+
}
|
|
1063
|
+
const html = field.editable && this.editable ? field.editable : field.value;
|
|
1064
|
+
const setDangerously = field.editable && this.editable;
|
|
1065
|
+
this.viewRef.rootNodes.forEach((node) => {
|
|
1066
|
+
if (setDangerously) {
|
|
1067
|
+
node.innerHTML = html;
|
|
1068
|
+
}
|
|
1069
|
+
else {
|
|
1070
|
+
node.textContent = this.datePipe.transform(html, this.format, this.timezone, this.locale);
|
|
1071
|
+
}
|
|
1072
|
+
});
|
|
1073
|
+
}
|
|
1074
|
+
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 });
|
|
1075
|
+
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 });
|
|
1076
|
+
}
|
|
1077
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DateDirective, decorators: [{
|
|
1078
|
+
type: Directive,
|
|
1079
|
+
args: [{
|
|
1080
|
+
selector: '[scDate]',
|
|
1081
|
+
}]
|
|
1082
|
+
}], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.TemplateRef }, { type: i1$1.DatePipe }]; }, propDecorators: { format: [{
|
|
1083
|
+
type: Input,
|
|
1084
|
+
args: ['scDateFormat']
|
|
1085
|
+
}], timezone: [{
|
|
1086
|
+
type: Input,
|
|
1087
|
+
args: ['scDateTimezone']
|
|
1088
|
+
}], locale: [{
|
|
1089
|
+
type: Input,
|
|
1090
|
+
args: ['scDateLocale']
|
|
1091
|
+
}], editable: [{
|
|
1092
|
+
type: Input,
|
|
1093
|
+
args: ['scDateEditable']
|
|
1094
|
+
}], field: [{
|
|
1095
|
+
type: Input,
|
|
1096
|
+
args: ['scDate']
|
|
1095
1097
|
}] } });
|
|
1096
1098
|
|
|
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 });
|
|
1099
|
+
class EditFrameComponent {
|
|
1100
|
+
dataSource;
|
|
1101
|
+
buttons;
|
|
1102
|
+
title;
|
|
1103
|
+
tooltip;
|
|
1104
|
+
cssClass;
|
|
1105
|
+
parameters;
|
|
1106
|
+
sitecore;
|
|
1107
|
+
isEditing = false;
|
|
1108
|
+
frameProps = {};
|
|
1109
|
+
chromeData = '';
|
|
1110
|
+
ngOnChanges() {
|
|
1111
|
+
this.isEditing = this.sitecore.context.pageEditing || false;
|
|
1112
|
+
if (!this.isEditing) {
|
|
1113
|
+
return;
|
|
1114
|
+
}
|
|
1115
|
+
this.frameProps.class = 'scLooseFrameZone';
|
|
1116
|
+
if (this.cssClass) {
|
|
1117
|
+
this.frameProps.class = `${this.frameProps.class} ${this.cssClass}`;
|
|
1118
|
+
}
|
|
1119
|
+
// item uri for edit frame target
|
|
1120
|
+
if (this.dataSource) {
|
|
1121
|
+
const route = this.sitecore.route;
|
|
1122
|
+
const databaseName = this.dataSource.databaseName || route?.databaseName;
|
|
1123
|
+
const language = this.dataSource.language || this.sitecore.context.language;
|
|
1124
|
+
this.frameProps.sc_item = `sitecore://${databaseName}/${this.dataSource.itemId}?lang=${language}`;
|
|
1125
|
+
}
|
|
1126
|
+
this.chromeData = this.buildChromeData();
|
|
1127
|
+
}
|
|
1128
|
+
buildChromeData() {
|
|
1129
|
+
const chromeData = {
|
|
1130
|
+
displayName: this.title,
|
|
1131
|
+
expandedDisplayName: this.tooltip,
|
|
1132
|
+
};
|
|
1133
|
+
if (this.dataSource) {
|
|
1134
|
+
chromeData.contextItemUri = this.frameProps.sc_item;
|
|
1135
|
+
}
|
|
1136
|
+
chromeData.commands = this.buttons?.map((value) => {
|
|
1137
|
+
return mapButtonToCommand(value, this.dataSource?.itemId, this.parameters);
|
|
1138
|
+
});
|
|
1139
|
+
return JSON.stringify(chromeData);
|
|
1140
|
+
}
|
|
1141
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EditFrameComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1140
1142
|
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
1143
|
<ng-template #childContent>
|
|
1142
1144
|
<ng-content></ng-content>
|
|
@@ -1152,12 +1154,12 @@ class EditFrameComponent {
|
|
|
1152
1154
|
<ng-template #elseBlock>
|
|
1153
1155
|
<ng-container *ngTemplateOutlet="childContent"></ng-container>
|
|
1154
1156
|
</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]',
|
|
1157
|
+
`, 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"] }] });
|
|
1158
|
+
}
|
|
1159
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EditFrameComponent, decorators: [{
|
|
1160
|
+
type: Component,
|
|
1161
|
+
args: [{
|
|
1162
|
+
selector: 'sc-edit-frame,[sc-edit-frame]',
|
|
1161
1163
|
template: `
|
|
1162
1164
|
<ng-template #childContent>
|
|
1163
1165
|
<ng-content></ng-content>
|
|
@@ -1173,305 +1175,305 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
1173
1175
|
<ng-template #elseBlock>
|
|
1174
1176
|
<ng-container *ngTemplateOutlet="childContent"></ng-container>
|
|
1175
1177
|
</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
|
|
1178
|
+
`,
|
|
1179
|
+
}]
|
|
1180
|
+
}], propDecorators: { dataSource: [{
|
|
1181
|
+
type: Input
|
|
1182
|
+
}], buttons: [{
|
|
1183
|
+
type: Input
|
|
1184
|
+
}], title: [{
|
|
1185
|
+
type: Input
|
|
1186
|
+
}], tooltip: [{
|
|
1187
|
+
type: Input
|
|
1188
|
+
}], cssClass: [{
|
|
1189
|
+
type: Input
|
|
1190
|
+
}], parameters: [{
|
|
1191
|
+
type: Input
|
|
1192
|
+
}], sitecore: [{
|
|
1193
|
+
type: Input
|
|
1192
1194
|
}] } });
|
|
1193
1195
|
|
|
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']
|
|
1196
|
+
class RichTextDirective {
|
|
1197
|
+
viewContainer;
|
|
1198
|
+
templateRef;
|
|
1199
|
+
renderer;
|
|
1200
|
+
router;
|
|
1201
|
+
editable = true;
|
|
1202
|
+
field;
|
|
1203
|
+
viewRef;
|
|
1204
|
+
constructor(viewContainer, templateRef, renderer, router) {
|
|
1205
|
+
this.viewContainer = viewContainer;
|
|
1206
|
+
this.templateRef = templateRef;
|
|
1207
|
+
this.renderer = renderer;
|
|
1208
|
+
this.router = router;
|
|
1209
|
+
}
|
|
1210
|
+
ngOnChanges(changes) {
|
|
1211
|
+
if (changes.field || changes.editable) {
|
|
1212
|
+
if (!this.viewRef) {
|
|
1213
|
+
this.viewContainer.clear();
|
|
1214
|
+
this.viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
|
|
1215
|
+
}
|
|
1216
|
+
this.updateView();
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
updateView() {
|
|
1220
|
+
const field = this.field;
|
|
1221
|
+
if (!field || (!field.editable && !field.value)) {
|
|
1222
|
+
return;
|
|
1223
|
+
}
|
|
1224
|
+
const html = field.editable && this.editable ? field.editable : field.value;
|
|
1225
|
+
this.viewRef.rootNodes.forEach((node) => {
|
|
1226
|
+
node.innerHTML = html;
|
|
1227
|
+
if (!node.querySelectorAll) {
|
|
1228
|
+
return;
|
|
1229
|
+
}
|
|
1230
|
+
const links = node.querySelectorAll('a[href]');
|
|
1231
|
+
const linksArray = [].slice.call(links);
|
|
1232
|
+
linksArray.forEach((link) => {
|
|
1233
|
+
const href = link.getAttribute('href');
|
|
1234
|
+
const target = link.getAttribute('target');
|
|
1235
|
+
if (!href || isAbsoluteUrl(href) || target === '_blank' || target === '_top') {
|
|
1236
|
+
return;
|
|
1237
|
+
}
|
|
1238
|
+
this.renderer.listen(link, 'click', (event) => {
|
|
1239
|
+
this.router.navigateByUrl(href);
|
|
1240
|
+
event.preventDefault();
|
|
1241
|
+
});
|
|
1242
|
+
});
|
|
1243
|
+
});
|
|
1244
|
+
}
|
|
1245
|
+
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 });
|
|
1246
|
+
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 });
|
|
1247
|
+
}
|
|
1248
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RichTextDirective, decorators: [{
|
|
1249
|
+
type: Directive,
|
|
1250
|
+
args: [{
|
|
1251
|
+
selector: '[scRichText]',
|
|
1252
|
+
}]
|
|
1253
|
+
}], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.TemplateRef }, { type: i0.Renderer2 }, { type: i1.Router }]; }, propDecorators: { editable: [{
|
|
1254
|
+
type: Input,
|
|
1255
|
+
args: ['scRichTextEditable']
|
|
1256
|
+
}], field: [{
|
|
1257
|
+
type: Input,
|
|
1258
|
+
args: ['scRichText']
|
|
1257
1259
|
}] } });
|
|
1258
1260
|
|
|
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']
|
|
1261
|
+
class TextDirective {
|
|
1262
|
+
viewContainer;
|
|
1263
|
+
templateRef;
|
|
1264
|
+
editable = true;
|
|
1265
|
+
encode = true;
|
|
1266
|
+
field;
|
|
1267
|
+
viewRef;
|
|
1268
|
+
constructor(viewContainer, templateRef) {
|
|
1269
|
+
this.viewContainer = viewContainer;
|
|
1270
|
+
this.templateRef = templateRef;
|
|
1271
|
+
}
|
|
1272
|
+
ngOnChanges(changes) {
|
|
1273
|
+
if (changes.field || changes.editable || changes.encode) {
|
|
1274
|
+
if (!this.viewRef) {
|
|
1275
|
+
this.viewContainer.clear();
|
|
1276
|
+
this.viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
|
|
1277
|
+
}
|
|
1278
|
+
this.updateView();
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
updateView() {
|
|
1282
|
+
const field = this.field;
|
|
1283
|
+
let editable = this.editable;
|
|
1284
|
+
if (!field || (!field.editable && (field.value === undefined || field.value === ''))) {
|
|
1285
|
+
return;
|
|
1286
|
+
}
|
|
1287
|
+
// can't use editable value if we want to output unencoded
|
|
1288
|
+
if (!this.encode) {
|
|
1289
|
+
editable = false;
|
|
1290
|
+
}
|
|
1291
|
+
const html = field.editable && editable ? field.editable : field.value;
|
|
1292
|
+
const setDangerously = (field.editable && editable) || !this.encode;
|
|
1293
|
+
this.viewRef.rootNodes.forEach((node) => {
|
|
1294
|
+
if (setDangerously) {
|
|
1295
|
+
node.innerHTML = html;
|
|
1296
|
+
}
|
|
1297
|
+
else {
|
|
1298
|
+
node.textContent = html;
|
|
1299
|
+
}
|
|
1300
|
+
});
|
|
1301
|
+
}
|
|
1302
|
+
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 });
|
|
1303
|
+
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 });
|
|
1304
|
+
}
|
|
1305
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TextDirective, decorators: [{
|
|
1306
|
+
type: Directive,
|
|
1307
|
+
args: [{
|
|
1308
|
+
selector: '[scText]',
|
|
1309
|
+
}]
|
|
1310
|
+
}], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.TemplateRef }]; }, propDecorators: { editable: [{
|
|
1311
|
+
type: Input,
|
|
1312
|
+
args: ['scTextEditable']
|
|
1313
|
+
}], encode: [{
|
|
1314
|
+
type: Input,
|
|
1315
|
+
args: ['scTextEncode']
|
|
1316
|
+
}], field: [{
|
|
1317
|
+
type: Input,
|
|
1318
|
+
args: ['scText']
|
|
1317
1319
|
}] } });
|
|
1318
1320
|
|
|
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);
|
|
1321
|
+
/**
|
|
1322
|
+
* @param {T} value
|
|
1323
|
+
* @returns {Promise | Observable | any} resolved value
|
|
1324
|
+
*/
|
|
1325
|
+
function wrapIntoObservable(value) {
|
|
1326
|
+
if (isObservable(value)) {
|
|
1327
|
+
return value;
|
|
1328
|
+
}
|
|
1329
|
+
if (ɵisPromise(value)) {
|
|
1330
|
+
return from(Promise.resolve(value));
|
|
1331
|
+
}
|
|
1332
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1333
|
+
return of(value);
|
|
1332
1334
|
}
|
|
1333
1335
|
|
|
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
|
-
};
|
|
1336
|
+
/**
|
|
1337
|
+
* @param {Injector} injector
|
|
1338
|
+
* @param {ActivatedRoute} activatedRoute
|
|
1339
|
+
* @param {Router} router
|
|
1340
|
+
* @returns resolved data
|
|
1341
|
+
*/
|
|
1342
|
+
function dataResolverFactory(injector, activatedRoute, router) {
|
|
1343
|
+
/**
|
|
1344
|
+
* @param {JssResolve<unknown> | Type<JssResolve<unknown>>} resolver
|
|
1345
|
+
* @returns resolver instance
|
|
1346
|
+
*/
|
|
1347
|
+
function getResolverInstance(resolver) {
|
|
1348
|
+
return 'resolve' in resolver ? resolver : injector.get(resolver);
|
|
1349
|
+
}
|
|
1350
|
+
/**
|
|
1351
|
+
* @param {ComponentFactoryResult} factory
|
|
1352
|
+
* @returns {Array<[string, JssResolve<unknown>]>} resolver instances
|
|
1353
|
+
*/
|
|
1354
|
+
function collectResolverInstances(factory) {
|
|
1355
|
+
if (factory.resolve) {
|
|
1356
|
+
const resolve = factory.resolve;
|
|
1357
|
+
return Object.keys(factory.resolve).map((key) => [
|
|
1358
|
+
key,
|
|
1359
|
+
getResolverInstance(resolve[key]),
|
|
1360
|
+
]);
|
|
1361
|
+
}
|
|
1362
|
+
return [];
|
|
1363
|
+
}
|
|
1364
|
+
/**
|
|
1365
|
+
* @param {JssResolve<unknown>} resolver
|
|
1366
|
+
* @param {ComponentFactoryResult} factory
|
|
1367
|
+
* @returns data
|
|
1368
|
+
*/
|
|
1369
|
+
function _resolveData(resolver, factory) {
|
|
1370
|
+
const data = resolver.resolve({
|
|
1371
|
+
activatedRoute: activatedRoute.snapshot,
|
|
1372
|
+
routerState: router.routerState.snapshot,
|
|
1373
|
+
rendering: factory.componentDefinition,
|
|
1374
|
+
});
|
|
1375
|
+
const data$ = wrapIntoObservable(data);
|
|
1376
|
+
return lastValueFrom(data$.pipe(take(1)));
|
|
1377
|
+
}
|
|
1378
|
+
return function resolveData(factories) {
|
|
1379
|
+
return Promise.all(factories.map((factory) => {
|
|
1380
|
+
const resolvers = collectResolverInstances(factory);
|
|
1381
|
+
const pendingData = resolvers.map(([key, resolver]) => _resolveData(resolver, factory).then((data) => [key, data]));
|
|
1382
|
+
return Promise.all(pendingData)
|
|
1383
|
+
.then((allData) => allData.reduce((acc, [key, data]) => {
|
|
1384
|
+
acc[key] = data;
|
|
1385
|
+
return acc;
|
|
1386
|
+
}, {}))
|
|
1387
|
+
.then((data) => ({ factory, data }));
|
|
1388
|
+
}));
|
|
1389
|
+
};
|
|
1388
1390
|
}
|
|
1389
1391
|
|
|
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
|
-
};
|
|
1392
|
+
/**
|
|
1393
|
+
* @param {boolean | string | string[] | UrlTree} value
|
|
1394
|
+
* @returns instance of value
|
|
1395
|
+
*/
|
|
1396
|
+
function isRedirectValue(value) {
|
|
1397
|
+
return value instanceof UrlTree || typeof value === 'string' || Array.isArray(value);
|
|
1398
|
+
}
|
|
1399
|
+
/**
|
|
1400
|
+
* Resolves components based on provided guards
|
|
1401
|
+
* @param {Injector} injector
|
|
1402
|
+
* @param {ActivatedRoute} activatedRoute
|
|
1403
|
+
* @param {Router} router
|
|
1404
|
+
* @returns {(factories: ComponentFactoryResult[]) => Promise<ComponentFactoryResult[]>} factory
|
|
1405
|
+
*/
|
|
1406
|
+
function guardResolverFactory(injector, activatedRoute, router) {
|
|
1407
|
+
/**
|
|
1408
|
+
* @param {JssCanActivate | Type<JssCanActivate> | JssCanActivateFn} guard
|
|
1409
|
+
* @returns resolved guard
|
|
1410
|
+
*/
|
|
1411
|
+
function getGuardInstance(guard) {
|
|
1412
|
+
if ('canActivate' in guard) {
|
|
1413
|
+
return guard;
|
|
1414
|
+
}
|
|
1415
|
+
try {
|
|
1416
|
+
// Class is provided
|
|
1417
|
+
return injector.get(guard);
|
|
1418
|
+
}
|
|
1419
|
+
catch {
|
|
1420
|
+
// Function is provided
|
|
1421
|
+
return guard;
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
/**
|
|
1425
|
+
* @param {ComponentFactoryResult} factory
|
|
1426
|
+
* @returns {(JssCanActivate | JssCanActivateFn)[]} guard instances
|
|
1427
|
+
*/
|
|
1428
|
+
function collectGuardInstances(factory) {
|
|
1429
|
+
if (factory.canActivate) {
|
|
1430
|
+
return Array.isArray(factory.canActivate)
|
|
1431
|
+
? factory.canActivate.map(getGuardInstance)
|
|
1432
|
+
: [getGuardInstance(factory.canActivate)];
|
|
1433
|
+
}
|
|
1434
|
+
return [];
|
|
1435
|
+
}
|
|
1436
|
+
/**
|
|
1437
|
+
*
|
|
1438
|
+
* @param {JssCanActivate | JssCanActivateFn} guard
|
|
1439
|
+
* @param {ComponentFactoryResult} factory
|
|
1440
|
+
* @returns canActivate
|
|
1441
|
+
*/
|
|
1442
|
+
function resolveGuard(guard, factory) {
|
|
1443
|
+
const canActivate = 'canActivate' in guard ? guard.canActivate : guard;
|
|
1444
|
+
const guardValue = canActivate({
|
|
1445
|
+
activatedRoute: activatedRoute.snapshot,
|
|
1446
|
+
routerState: router.routerState.snapshot,
|
|
1447
|
+
rendering: factory.componentDefinition,
|
|
1448
|
+
});
|
|
1449
|
+
const canActivate$ = wrapIntoObservable(guardValue);
|
|
1450
|
+
return lastValueFrom(canActivate$.pipe(take(1), mergeMap((value) => {
|
|
1451
|
+
if (isRedirectValue(value)) {
|
|
1452
|
+
return throwError(() => new Error(value.toString()));
|
|
1453
|
+
}
|
|
1454
|
+
else {
|
|
1455
|
+
return of(value);
|
|
1456
|
+
}
|
|
1457
|
+
})));
|
|
1458
|
+
}
|
|
1459
|
+
return function resolveGuards(factories) {
|
|
1460
|
+
const resolved = factories.map((factory) => {
|
|
1461
|
+
const guards = collectGuardInstances(factory);
|
|
1462
|
+
const pending = guards.map((guard) => resolveGuard(guard, factory));
|
|
1463
|
+
return Promise.all(pending)
|
|
1464
|
+
.then((canActive) => canActive.every((v) => v))
|
|
1465
|
+
.then((canActivate) => ({
|
|
1466
|
+
factory,
|
|
1467
|
+
canActivate,
|
|
1468
|
+
}));
|
|
1469
|
+
});
|
|
1470
|
+
return Promise.all(resolved).then((mapped) => mapped.filter((m) => m.canActivate).map((m) => m.factory));
|
|
1471
|
+
};
|
|
1470
1472
|
}
|
|
1471
1473
|
|
|
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 });
|
|
1474
|
+
class MissingComponentComponent {
|
|
1475
|
+
rendering;
|
|
1476
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MissingComponentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1475
1477
|
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
1478
|
<div
|
|
1477
1479
|
style="background: darkorange; outline: 5px solid orange; padding: 10px; color: white; max-width: 500px;"
|
|
@@ -1479,12 +1481,12 @@ class MissingComponentComponent {
|
|
|
1479
1481
|
<h2>{{ rendering.componentName }}</h2>
|
|
1480
1482
|
<p>JSS component is missing Angular component implementation.</p>
|
|
1481
1483
|
</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',
|
|
1484
|
+
`, isInline: true });
|
|
1485
|
+
}
|
|
1486
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MissingComponentComponent, decorators: [{
|
|
1487
|
+
type: Component,
|
|
1488
|
+
args: [{
|
|
1489
|
+
selector: 'sc-missing-component',
|
|
1488
1490
|
template: `
|
|
1489
1491
|
<div
|
|
1490
1492
|
style="background: darkorange; outline: 5px solid orange; padding: 10px; color: white; max-width: 500px;"
|
|
@@ -1492,150 +1494,150 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
1492
1494
|
<h2>{{ rendering.componentName }}</h2>
|
|
1493
1495
|
<p>JSS component is missing Angular component implementation.</p>
|
|
1494
1496
|
</div>
|
|
1495
|
-
`,
|
|
1496
|
-
}]
|
|
1497
|
-
}], propDecorators: { rendering: [{
|
|
1498
|
-
type: Input
|
|
1497
|
+
`,
|
|
1498
|
+
}]
|
|
1499
|
+
}], propDecorators: { rendering: [{
|
|
1500
|
+
type: Input
|
|
1499
1501
|
}] } });
|
|
1500
1502
|
|
|
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
|
-
}]
|
|
1503
|
+
class JssModule {
|
|
1504
|
+
/**
|
|
1505
|
+
* Instantiates the JSS module with no component factory.
|
|
1506
|
+
* Useful for using it from libraries. Most of the time you'd want withComponents()
|
|
1507
|
+
* @returns {ModuleWithProviders<JssModule>} module
|
|
1508
|
+
*/
|
|
1509
|
+
static forRoot() {
|
|
1510
|
+
return {
|
|
1511
|
+
ngModule: JssModule,
|
|
1512
|
+
providers: [
|
|
1513
|
+
DatePipe,
|
|
1514
|
+
JssComponentFactoryService,
|
|
1515
|
+
{
|
|
1516
|
+
provide: GUARD_RESOLVER,
|
|
1517
|
+
useFactory: guardResolverFactory,
|
|
1518
|
+
deps: [Injector, ActivatedRoute, Router],
|
|
1519
|
+
},
|
|
1520
|
+
{
|
|
1521
|
+
provide: DATA_RESOLVER,
|
|
1522
|
+
useFactory: dataResolverFactory,
|
|
1523
|
+
deps: [Injector, ActivatedRoute, Router],
|
|
1524
|
+
},
|
|
1525
|
+
],
|
|
1526
|
+
};
|
|
1527
|
+
}
|
|
1528
|
+
/**
|
|
1529
|
+
* Instantiates a module for a lazy-loaded JSS component
|
|
1530
|
+
* @param {Type<unknown>} component
|
|
1531
|
+
* @returns {ModuleWithProviders<JssModule>} module
|
|
1532
|
+
*/
|
|
1533
|
+
static forChild(component) {
|
|
1534
|
+
return {
|
|
1535
|
+
ngModule: JssModule,
|
|
1536
|
+
providers: [
|
|
1537
|
+
{ provide: ROUTES, useValue: [], multi: true },
|
|
1538
|
+
{ provide: DYNAMIC_COMPONENT, useValue: component },
|
|
1539
|
+
],
|
|
1540
|
+
};
|
|
1541
|
+
}
|
|
1542
|
+
/**
|
|
1543
|
+
* Instantiates the JSS module and specifies the mapping from component name to component implementation.
|
|
1544
|
+
* Appropriate when defining the set of JSS components that your app is aware of.
|
|
1545
|
+
* @param {ComponentNameAndType[]} components
|
|
1546
|
+
* @param {ComponentNameAndModule[]} [lazyComponents]
|
|
1547
|
+
* @returns {ModuleWithProviders<JssModule>} module
|
|
1548
|
+
*/
|
|
1549
|
+
static withComponents(components, lazyComponents) {
|
|
1550
|
+
return {
|
|
1551
|
+
ngModule: JssModule,
|
|
1552
|
+
providers: [
|
|
1553
|
+
{ provide: PLACEHOLDER_COMPONENTS, useValue: components },
|
|
1554
|
+
{ provide: PLACEHOLDER_LAZY_COMPONENTS, useValue: lazyComponents || [] },
|
|
1555
|
+
{ provide: ROUTES, useValue: lazyComponents || [], multi: true },
|
|
1556
|
+
{ provide: PLACEHOLDER_MISSING_COMPONENT_COMPONENT, useValue: MissingComponentComponent },
|
|
1557
|
+
{ provide: PLACEHOLDER_HIDDEN_RENDERING_COMPONENT, useValue: HiddenRenderingComponent },
|
|
1558
|
+
...JssModule.forRoot().providers,
|
|
1559
|
+
],
|
|
1560
|
+
};
|
|
1561
|
+
}
|
|
1562
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: JssModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1563
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: JssModule, declarations: [FileDirective,
|
|
1564
|
+
ImageDirective,
|
|
1565
|
+
LinkDirective,
|
|
1566
|
+
RouterLinkDirective,
|
|
1567
|
+
GenericLinkDirective,
|
|
1568
|
+
DateDirective,
|
|
1569
|
+
RenderEachDirective,
|
|
1570
|
+
RenderEmptyDirective,
|
|
1571
|
+
PlaceholderLoadingDirective,
|
|
1572
|
+
RenderComponentComponent,
|
|
1573
|
+
PlaceholderComponent,
|
|
1574
|
+
RawComponent,
|
|
1575
|
+
RichTextDirective,
|
|
1576
|
+
TextDirective,
|
|
1577
|
+
MissingComponentComponent,
|
|
1578
|
+
HiddenRenderingComponent,
|
|
1579
|
+
EditFrameComponent], imports: [CommonModule], exports: [FileDirective,
|
|
1580
|
+
ImageDirective,
|
|
1581
|
+
DateDirective,
|
|
1582
|
+
LinkDirective,
|
|
1583
|
+
RouterLinkDirective,
|
|
1584
|
+
GenericLinkDirective,
|
|
1585
|
+
RenderEachDirective,
|
|
1586
|
+
RenderEmptyDirective,
|
|
1587
|
+
RenderComponentComponent,
|
|
1588
|
+
PlaceholderComponent,
|
|
1589
|
+
HiddenRenderingComponent,
|
|
1590
|
+
PlaceholderLoadingDirective,
|
|
1591
|
+
RichTextDirective,
|
|
1592
|
+
TextDirective,
|
|
1593
|
+
EditFrameComponent] });
|
|
1594
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: JssModule, imports: [CommonModule] });
|
|
1595
|
+
}
|
|
1596
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: JssModule, decorators: [{
|
|
1597
|
+
type: NgModule,
|
|
1598
|
+
args: [{
|
|
1599
|
+
imports: [CommonModule],
|
|
1600
|
+
declarations: [
|
|
1601
|
+
FileDirective,
|
|
1602
|
+
ImageDirective,
|
|
1603
|
+
LinkDirective,
|
|
1604
|
+
RouterLinkDirective,
|
|
1605
|
+
GenericLinkDirective,
|
|
1606
|
+
DateDirective,
|
|
1607
|
+
RenderEachDirective,
|
|
1608
|
+
RenderEmptyDirective,
|
|
1609
|
+
PlaceholderLoadingDirective,
|
|
1610
|
+
RenderComponentComponent,
|
|
1611
|
+
PlaceholderComponent,
|
|
1612
|
+
RawComponent,
|
|
1613
|
+
RichTextDirective,
|
|
1614
|
+
TextDirective,
|
|
1615
|
+
MissingComponentComponent,
|
|
1616
|
+
HiddenRenderingComponent,
|
|
1617
|
+
EditFrameComponent,
|
|
1618
|
+
],
|
|
1619
|
+
exports: [
|
|
1620
|
+
FileDirective,
|
|
1621
|
+
ImageDirective,
|
|
1622
|
+
DateDirective,
|
|
1623
|
+
LinkDirective,
|
|
1624
|
+
RouterLinkDirective,
|
|
1625
|
+
GenericLinkDirective,
|
|
1626
|
+
RenderEachDirective,
|
|
1627
|
+
RenderEmptyDirective,
|
|
1628
|
+
RenderComponentComponent,
|
|
1629
|
+
PlaceholderComponent,
|
|
1630
|
+
HiddenRenderingComponent,
|
|
1631
|
+
PlaceholderLoadingDirective,
|
|
1632
|
+
RichTextDirective,
|
|
1633
|
+
TextDirective,
|
|
1634
|
+
EditFrameComponent,
|
|
1635
|
+
],
|
|
1636
|
+
}]
|
|
1635
1637
|
}] });
|
|
1636
1638
|
|
|
1637
|
-
/**
|
|
1638
|
-
* Generated bundle index. Do not edit.
|
|
1639
|
+
/**
|
|
1640
|
+
* Generated bundle index. Do not edit.
|
|
1639
1641
|
*/
|
|
1640
1642
|
|
|
1641
1643
|
export { ComponentNameAndType, DYNAMIC_COMPONENT, DateDirective, EditFrameComponent, FileDirective, GenericLinkDirective, HiddenRenderingComponent, ImageDirective, JssModule, LinkDirective, PlaceholderComponent, PlaceholderLoadingDirective, RenderComponentComponent, RenderEachDirective, RenderEmptyDirective, RichTextDirective, RouterLinkDirective, TextDirective, isRawRendering };
|