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