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