@sitecore-jss/sitecore-jss-angular 16.0.0-canary.8 → 16.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +202 -202
- package/README.md +5 -5
- package/dist/README.md +5 -5
- package/dist/bundles/sitecore-jss-sitecore-jss-angular.umd.js +1385 -1389
- package/dist/bundles/sitecore-jss-sitecore-jss-angular.umd.js.map +1 -1
- package/dist/bundles/sitecore-jss-sitecore-jss-angular.umd.min.js +1 -1
- package/dist/bundles/sitecore-jss-sitecore-jss-angular.umd.min.js.map +1 -1
- package/dist/components/date.directive.d.ts +17 -17
- package/dist/components/file.directive.d.ts +14 -14
- package/dist/components/generic-link.directive.d.ts +14 -14
- package/dist/components/image.directive.d.ts +28 -28
- package/dist/components/link.directive.d.ts +18 -18
- package/dist/components/missing-component.component.d.ts +3 -3
- package/dist/components/placeholder-loading.directive.d.ts +5 -5
- package/dist/components/placeholder.component.d.ts +45 -45
- package/dist/components/placeholder.token.d.ts +30 -24
- package/dist/components/raw.component.d.ts +9 -9
- package/dist/components/render-component.component.d.ts +29 -29
- package/dist/components/render-each.directive.d.ts +5 -5
- package/dist/components/render-empty.directive.d.ts +5 -5
- package/dist/components/rendering-field.d.ts +20 -20
- package/dist/components/rendering.d.ts +5 -2
- package/dist/components/rich-text.directive.d.ts +12 -12
- package/dist/components/router-link.directive.d.ts +12 -12
- package/dist/components/text.directive.d.ts +13 -13
- package/dist/esm2015/components/date.directive.js +53 -54
- package/dist/esm2015/components/file.directive.js +43 -43
- package/dist/esm2015/components/generic-link.directive.js +58 -60
- package/dist/esm2015/components/image.directive.js +123 -126
- package/dist/esm2015/components/link.directive.js +99 -101
- package/dist/esm2015/components/missing-component.component.js +19 -16
- package/dist/esm2015/components/placeholder-loading.directive.js +15 -15
- package/dist/esm2015/components/placeholder.component.js +196 -186
- package/dist/esm2015/components/placeholder.token.js +21 -15
- package/dist/esm2015/components/raw.component.js +37 -36
- package/dist/esm2015/components/render-component.component.js +89 -85
- package/dist/esm2015/components/render-each.directive.js +15 -16
- package/dist/esm2015/components/render-empty.directive.js +15 -16
- package/dist/esm2015/components/rendering-field.js +1 -1
- package/dist/esm2015/components/rendering.js +8 -4
- package/dist/esm2015/components/rich-text.directive.js +41 -42
- package/dist/esm2015/components/router-link.directive.js +44 -46
- package/dist/esm2015/components/text.directive.js +54 -56
- package/dist/esm2015/jss-component-factory.service.js +87 -94
- package/dist/esm2015/layout-service-error.js +3 -3
- package/dist/esm2015/layout.service.js +28 -30
- package/dist/esm2015/lib.module.js +112 -113
- package/dist/esm2015/public_api.js +16 -16
- package/dist/esm2015/sitecore-jss-sitecore-jss-angular.js +13 -13
- package/dist/fesm2015/sitecore-jss-sitecore-jss-angular.js +1053 -1050
- package/dist/fesm2015/sitecore-jss-sitecore-jss-angular.js.map +1 -1
- package/dist/jss-component-factory.service.d.ts +21 -21
- package/dist/layout-service-error.d.ts +8 -8
- package/dist/layout.service.d.ts +8 -8
- package/dist/lib.module.d.ts +24 -16
- package/dist/package.json +2 -2
- package/dist/public_api.d.ts +16 -16
- package/dist/sitecore-jss-sitecore-jss-angular.d.ts +12 -12
- package/dist/sitecore-jss-sitecore-jss-angular.metadata.json +1 -1
- package/package.json +6 -4
- package/typings/README.md +2 -2
|
@@ -4,1439 +4,1435 @@
|
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global['sitecore-jss'] = global['sitecore-jss'] || {}, global['sitecore-jss']['sitecore-jss-angular'] = {}), global.ng.core, global['@sitecore-jss/sitecore-jss'], global.ng.router, global.rxjs, global.rxjs.operators, global.ng.common));
|
|
5
5
|
}(this, (function (exports, core, sitecoreJss, router, rxjs, operators, common) { 'use strict';
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
* File fields cannot be managed via the EE. We never output "editable."
|
|
9
|
-
*/
|
|
10
|
-
var FileDirective = /** @class */ (function () {
|
|
11
|
-
function FileDirective(viewContainer, templateRef) {
|
|
12
|
-
this.viewContainer = viewContainer;
|
|
13
|
-
this.templateRef = templateRef;
|
|
14
|
-
}
|
|
15
|
-
FileDirective.prototype.ngOnChanges = function (changes) {
|
|
16
|
-
if (changes
|
|
17
|
-
if (!this.viewRef) {
|
|
18
|
-
this.viewContainer.clear();
|
|
19
|
-
this.viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
|
|
20
|
-
}
|
|
21
|
-
this.updateView();
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
FileDirective.prototype.updateView = function () {
|
|
25
|
-
var field = this.field;
|
|
26
|
-
if (!field || (!field.value && !field.src)) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
var file = field.src ? field : field.value;
|
|
30
|
-
this.viewRef.rootNodes.forEach(function (node) {
|
|
31
|
-
node.href = file.src;
|
|
32
|
-
if (node.innerHTML === '') {
|
|
33
|
-
node.innerHTML = file.title || file.displayName;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
|
-
return FileDirective;
|
|
38
|
-
}());
|
|
39
|
-
FileDirective.decorators = [
|
|
40
|
-
{ type: core.Directive, args: [{ selector: '[scFile]' },] }
|
|
41
|
-
];
|
|
42
|
-
FileDirective.ctorParameters = function () { return [
|
|
43
|
-
{ type: core.ViewContainerRef },
|
|
44
|
-
{ type: core.TemplateRef }
|
|
45
|
-
]; };
|
|
46
|
-
FileDirective.propDecorators = {
|
|
47
|
-
field: [{ type: core.Input, args: ['scFile',] }]
|
|
7
|
+
/**
|
|
8
|
+
* File fields cannot be managed via the EE. We never output "editable."
|
|
9
|
+
*/
|
|
10
|
+
var FileDirective = /** @class */ (function () {
|
|
11
|
+
function FileDirective(viewContainer, templateRef) {
|
|
12
|
+
this.viewContainer = viewContainer;
|
|
13
|
+
this.templateRef = templateRef;
|
|
14
|
+
}
|
|
15
|
+
FileDirective.prototype.ngOnChanges = function (changes) {
|
|
16
|
+
if (changes.field) {
|
|
17
|
+
if (!this.viewRef) {
|
|
18
|
+
this.viewContainer.clear();
|
|
19
|
+
this.viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
|
|
20
|
+
}
|
|
21
|
+
this.updateView();
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
FileDirective.prototype.updateView = function () {
|
|
25
|
+
var field = this.field;
|
|
26
|
+
if (!field || (!field.value && !field.src)) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
var file = field.src ? field : field.value;
|
|
30
|
+
this.viewRef.rootNodes.forEach(function (node) {
|
|
31
|
+
node.href = file.src;
|
|
32
|
+
if (node.innerHTML === '') {
|
|
33
|
+
node.innerHTML = file.title || file.displayName;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
return FileDirective;
|
|
38
|
+
}());
|
|
39
|
+
FileDirective.decorators = [
|
|
40
|
+
{ type: core.Directive, args: [{ selector: '[scFile]' },] }
|
|
41
|
+
];
|
|
42
|
+
FileDirective.ctorParameters = function () { return [
|
|
43
|
+
{ type: core.ViewContainerRef },
|
|
44
|
+
{ type: core.TemplateRef }
|
|
45
|
+
]; };
|
|
46
|
+
FileDirective.propDecorators = {
|
|
47
|
+
field: [{ type: core.Input, args: ['scFile',] }]
|
|
48
48
|
};
|
|
49
49
|
|
|
50
|
-
/*! *****************************************************************************
|
|
51
|
-
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
52
|
-
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
53
|
-
this file except in compliance with the License. You may obtain a copy of the
|
|
54
|
-
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
55
|
-
|
|
56
|
-
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
57
|
-
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
58
|
-
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
59
|
-
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
60
|
-
|
|
61
|
-
See the Apache Version 2.0 License for specific language governing permissions
|
|
62
|
-
and limitations under the License.
|
|
63
|
-
***************************************************************************** */
|
|
64
|
-
/* global Reflect, Promise */
|
|
65
|
-
var extendStatics = function (d, b) {
|
|
66
|
-
extendStatics = Object.setPrototypeOf ||
|
|
67
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
68
|
-
function (d, b) { for (var p in b)
|
|
69
|
-
if (b.hasOwnProperty(p))
|
|
70
|
-
d[p] = b[p]; };
|
|
71
|
-
return extendStatics(d, b);
|
|
72
|
-
};
|
|
73
|
-
function __extends(d, b) {
|
|
74
|
-
extendStatics(d, b);
|
|
75
|
-
function __() { this.constructor = d; }
|
|
76
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
77
|
-
}
|
|
78
|
-
var __assign = function () {
|
|
79
|
-
__assign = Object.assign || function __assign(t) {
|
|
80
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
81
|
-
s = arguments[i];
|
|
82
|
-
for (var p in s)
|
|
83
|
-
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
84
|
-
t[p] = s[p];
|
|
85
|
-
}
|
|
86
|
-
return t;
|
|
87
|
-
};
|
|
88
|
-
return __assign.apply(this, arguments);
|
|
89
|
-
};
|
|
90
|
-
function __rest(s, e) {
|
|
91
|
-
var t = {};
|
|
92
|
-
for (var p in s)
|
|
93
|
-
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
94
|
-
t[p] = s[p];
|
|
95
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
96
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
97
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
98
|
-
t[p[i]] = s[p[i]];
|
|
99
|
-
}
|
|
100
|
-
return t;
|
|
101
|
-
}
|
|
102
|
-
function __decorate(decorators, target, key, desc) {
|
|
103
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
104
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
105
|
-
r = Reflect.decorate(decorators, target, key, desc);
|
|
106
|
-
else
|
|
107
|
-
for (var i = decorators.length - 1; i >= 0; i--)
|
|
108
|
-
if (d = decorators[i])
|
|
109
|
-
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
110
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
111
|
-
}
|
|
112
|
-
function __param(paramIndex, decorator) {
|
|
113
|
-
return function (target, key) { decorator(target, key, paramIndex); };
|
|
114
|
-
}
|
|
115
|
-
function __metadata(metadataKey, metadataValue) {
|
|
116
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
117
|
-
return Reflect.metadata(metadataKey, metadataValue);
|
|
118
|
-
}
|
|
119
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
120
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
121
|
-
function fulfilled(value) { try {
|
|
122
|
-
step(generator.next(value));
|
|
123
|
-
}
|
|
124
|
-
catch (e) {
|
|
125
|
-
reject(e);
|
|
126
|
-
} }
|
|
127
|
-
function rejected(value) { try {
|
|
128
|
-
step(generator["throw"](value));
|
|
129
|
-
}
|
|
130
|
-
catch (e) {
|
|
131
|
-
reject(e);
|
|
132
|
-
} }
|
|
133
|
-
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
|
134
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
function __generator(thisArg, body) {
|
|
138
|
-
var _ = { label: 0, sent: function () { if (t[0] & 1)
|
|
139
|
-
throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
140
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
|
|
141
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
142
|
-
function step(op) {
|
|
143
|
-
if (f)
|
|
144
|
-
throw new TypeError("Generator is already executing.");
|
|
145
|
-
while (_)
|
|
146
|
-
try {
|
|
147
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
|
|
148
|
-
return t;
|
|
149
|
-
if (y = 0, t)
|
|
150
|
-
op = [op[0] & 2, t.value];
|
|
151
|
-
switch (op[0]) {
|
|
152
|
-
case 0:
|
|
153
|
-
case 1:
|
|
154
|
-
t = op;
|
|
155
|
-
break;
|
|
156
|
-
case 4:
|
|
157
|
-
_.label++;
|
|
158
|
-
return { value: op[1], done: false };
|
|
159
|
-
case 5:
|
|
160
|
-
_.label++;
|
|
161
|
-
y = op[1];
|
|
162
|
-
op = [0];
|
|
163
|
-
continue;
|
|
164
|
-
case 7:
|
|
165
|
-
op = _.ops.pop();
|
|
166
|
-
_.trys.pop();
|
|
167
|
-
continue;
|
|
168
|
-
default:
|
|
169
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
170
|
-
_ = 0;
|
|
171
|
-
continue;
|
|
172
|
-
}
|
|
173
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
|
|
174
|
-
_.label = op[1];
|
|
175
|
-
break;
|
|
176
|
-
}
|
|
177
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
178
|
-
_.label = t[1];
|
|
179
|
-
t = op;
|
|
180
|
-
break;
|
|
181
|
-
}
|
|
182
|
-
if (t && _.label < t[2]) {
|
|
183
|
-
_.label = t[2];
|
|
184
|
-
_.ops.push(op);
|
|
185
|
-
break;
|
|
186
|
-
}
|
|
187
|
-
if (t[2])
|
|
188
|
-
_.ops.pop();
|
|
189
|
-
_.trys.pop();
|
|
190
|
-
continue;
|
|
191
|
-
}
|
|
192
|
-
op = body.call(thisArg, _);
|
|
193
|
-
}
|
|
194
|
-
catch (e) {
|
|
195
|
-
op = [6, e];
|
|
196
|
-
y = 0;
|
|
197
|
-
}
|
|
198
|
-
finally {
|
|
199
|
-
f = t = 0;
|
|
200
|
-
}
|
|
201
|
-
if (op[0] & 5)
|
|
202
|
-
throw op[1];
|
|
203
|
-
return { value: op[0] ? op[1] : void 0, done: true };
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
function __exportStar(m, exports) {
|
|
207
|
-
for (var p in m)
|
|
208
|
-
if (!exports.hasOwnProperty(p))
|
|
209
|
-
exports[p] = m[p];
|
|
210
|
-
}
|
|
211
|
-
function __values(o) {
|
|
212
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
|
|
213
|
-
if (m)
|
|
214
|
-
return m.call(o);
|
|
215
|
-
return {
|
|
216
|
-
next: function () {
|
|
217
|
-
if (o && i >= o.length)
|
|
218
|
-
o = void 0;
|
|
219
|
-
return { value: o && o[i++], done: !o };
|
|
220
|
-
}
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
function __read(o, n) {
|
|
224
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
225
|
-
if (!m)
|
|
226
|
-
return o;
|
|
227
|
-
var i = m.call(o), r, ar = [], e;
|
|
228
|
-
try {
|
|
229
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
|
230
|
-
ar.push(r.value);
|
|
231
|
-
}
|
|
232
|
-
catch (error) {
|
|
233
|
-
e = { error: error };
|
|
234
|
-
}
|
|
235
|
-
finally {
|
|
236
|
-
try {
|
|
237
|
-
if (r && !r.done && (m = i["return"]))
|
|
238
|
-
m.call(i);
|
|
239
|
-
}
|
|
240
|
-
finally {
|
|
241
|
-
if (e)
|
|
242
|
-
throw e.error;
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
return ar;
|
|
246
|
-
}
|
|
247
|
-
function __spread() {
|
|
248
|
-
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
249
|
-
ar = ar.concat(__read(arguments[i]));
|
|
250
|
-
return ar;
|
|
251
|
-
}
|
|
252
|
-
function __spreadArrays() {
|
|
253
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
|
|
254
|
-
s += arguments[i].length;
|
|
255
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
256
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
257
|
-
r[k] = a[j];
|
|
258
|
-
return r;
|
|
259
|
-
}
|
|
260
|
-
;
|
|
261
|
-
function __await(v) {
|
|
262
|
-
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
263
|
-
}
|
|
264
|
-
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
265
|
-
if (!Symbol.asyncIterator)
|
|
266
|
-
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
267
|
-
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
268
|
-
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
269
|
-
function verb(n) { if (g[n])
|
|
270
|
-
i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
271
|
-
function resume(n, v) { try {
|
|
272
|
-
step(g[n](v));
|
|
273
|
-
}
|
|
274
|
-
catch (e) {
|
|
275
|
-
settle(q[0][3], e);
|
|
276
|
-
} }
|
|
277
|
-
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
278
|
-
function fulfill(value) { resume("next", value); }
|
|
279
|
-
function reject(value) { resume("throw", value); }
|
|
280
|
-
function settle(f, v) { if (f(v), q.shift(), q.length)
|
|
281
|
-
resume(q[0][0], q[0][1]); }
|
|
282
|
-
}
|
|
283
|
-
function __asyncDelegator(o) {
|
|
284
|
-
var i, p;
|
|
285
|
-
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
286
|
-
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
|
287
|
-
}
|
|
288
|
-
function __asyncValues(o) {
|
|
289
|
-
if (!Symbol.asyncIterator)
|
|
290
|
-
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
291
|
-
var m = o[Symbol.asyncIterator], i;
|
|
292
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
293
|
-
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
294
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
|
295
|
-
}
|
|
296
|
-
function __makeTemplateObject(cooked, raw) {
|
|
297
|
-
if (Object.defineProperty) {
|
|
298
|
-
Object.defineProperty(cooked, "raw", { value: raw });
|
|
299
|
-
}
|
|
300
|
-
else {
|
|
301
|
-
cooked.raw = raw;
|
|
302
|
-
}
|
|
303
|
-
return cooked;
|
|
304
|
-
}
|
|
305
|
-
;
|
|
306
|
-
function __importStar(mod) {
|
|
307
|
-
if (mod && mod.__esModule)
|
|
308
|
-
return mod;
|
|
309
|
-
var result = {};
|
|
310
|
-
if (mod != null)
|
|
311
|
-
for (var k in mod)
|
|
312
|
-
if (Object.hasOwnProperty.call(mod, k))
|
|
313
|
-
result[k] = mod[k];
|
|
314
|
-
result.default = mod;
|
|
315
|
-
return result;
|
|
316
|
-
}
|
|
317
|
-
function __importDefault(mod) {
|
|
318
|
-
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
50
|
+
/*! *****************************************************************************
|
|
51
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
52
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
53
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
54
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
55
|
+
|
|
56
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
57
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
58
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
59
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
60
|
+
|
|
61
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
62
|
+
and limitations under the License.
|
|
63
|
+
***************************************************************************** */
|
|
64
|
+
/* global Reflect, Promise */
|
|
65
|
+
var extendStatics = function (d, b) {
|
|
66
|
+
extendStatics = Object.setPrototypeOf ||
|
|
67
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
68
|
+
function (d, b) { for (var p in b)
|
|
69
|
+
if (b.hasOwnProperty(p))
|
|
70
|
+
d[p] = b[p]; };
|
|
71
|
+
return extendStatics(d, b);
|
|
72
|
+
};
|
|
73
|
+
function __extends(d, b) {
|
|
74
|
+
extendStatics(d, b);
|
|
75
|
+
function __() { this.constructor = d; }
|
|
76
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
77
|
+
}
|
|
78
|
+
var __assign = function () {
|
|
79
|
+
__assign = Object.assign || function __assign(t) {
|
|
80
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
81
|
+
s = arguments[i];
|
|
82
|
+
for (var p in s)
|
|
83
|
+
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
84
|
+
t[p] = s[p];
|
|
85
|
+
}
|
|
86
|
+
return t;
|
|
87
|
+
};
|
|
88
|
+
return __assign.apply(this, arguments);
|
|
89
|
+
};
|
|
90
|
+
function __rest(s, e) {
|
|
91
|
+
var t = {};
|
|
92
|
+
for (var p in s)
|
|
93
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
94
|
+
t[p] = s[p];
|
|
95
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
96
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
97
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
98
|
+
t[p[i]] = s[p[i]];
|
|
99
|
+
}
|
|
100
|
+
return t;
|
|
101
|
+
}
|
|
102
|
+
function __decorate(decorators, target, key, desc) {
|
|
103
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
104
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
105
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
106
|
+
else
|
|
107
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
108
|
+
if (d = decorators[i])
|
|
109
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
110
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
111
|
+
}
|
|
112
|
+
function __param(paramIndex, decorator) {
|
|
113
|
+
return function (target, key) { decorator(target, key, paramIndex); };
|
|
114
|
+
}
|
|
115
|
+
function __metadata(metadataKey, metadataValue) {
|
|
116
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
117
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
118
|
+
}
|
|
119
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
120
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
121
|
+
function fulfilled(value) { try {
|
|
122
|
+
step(generator.next(value));
|
|
123
|
+
}
|
|
124
|
+
catch (e) {
|
|
125
|
+
reject(e);
|
|
126
|
+
} }
|
|
127
|
+
function rejected(value) { try {
|
|
128
|
+
step(generator["throw"](value));
|
|
129
|
+
}
|
|
130
|
+
catch (e) {
|
|
131
|
+
reject(e);
|
|
132
|
+
} }
|
|
133
|
+
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
|
134
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
function __generator(thisArg, body) {
|
|
138
|
+
var _ = { label: 0, sent: function () { if (t[0] & 1)
|
|
139
|
+
throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
140
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
|
|
141
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
142
|
+
function step(op) {
|
|
143
|
+
if (f)
|
|
144
|
+
throw new TypeError("Generator is already executing.");
|
|
145
|
+
while (_)
|
|
146
|
+
try {
|
|
147
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
|
|
148
|
+
return t;
|
|
149
|
+
if (y = 0, t)
|
|
150
|
+
op = [op[0] & 2, t.value];
|
|
151
|
+
switch (op[0]) {
|
|
152
|
+
case 0:
|
|
153
|
+
case 1:
|
|
154
|
+
t = op;
|
|
155
|
+
break;
|
|
156
|
+
case 4:
|
|
157
|
+
_.label++;
|
|
158
|
+
return { value: op[1], done: false };
|
|
159
|
+
case 5:
|
|
160
|
+
_.label++;
|
|
161
|
+
y = op[1];
|
|
162
|
+
op = [0];
|
|
163
|
+
continue;
|
|
164
|
+
case 7:
|
|
165
|
+
op = _.ops.pop();
|
|
166
|
+
_.trys.pop();
|
|
167
|
+
continue;
|
|
168
|
+
default:
|
|
169
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
170
|
+
_ = 0;
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
|
|
174
|
+
_.label = op[1];
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
177
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
178
|
+
_.label = t[1];
|
|
179
|
+
t = op;
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
182
|
+
if (t && _.label < t[2]) {
|
|
183
|
+
_.label = t[2];
|
|
184
|
+
_.ops.push(op);
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
if (t[2])
|
|
188
|
+
_.ops.pop();
|
|
189
|
+
_.trys.pop();
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
op = body.call(thisArg, _);
|
|
193
|
+
}
|
|
194
|
+
catch (e) {
|
|
195
|
+
op = [6, e];
|
|
196
|
+
y = 0;
|
|
197
|
+
}
|
|
198
|
+
finally {
|
|
199
|
+
f = t = 0;
|
|
200
|
+
}
|
|
201
|
+
if (op[0] & 5)
|
|
202
|
+
throw op[1];
|
|
203
|
+
return { value: op[0] ? op[1] : void 0, done: true };
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
function __exportStar(m, exports) {
|
|
207
|
+
for (var p in m)
|
|
208
|
+
if (!exports.hasOwnProperty(p))
|
|
209
|
+
exports[p] = m[p];
|
|
210
|
+
}
|
|
211
|
+
function __values(o) {
|
|
212
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
|
|
213
|
+
if (m)
|
|
214
|
+
return m.call(o);
|
|
215
|
+
return {
|
|
216
|
+
next: function () {
|
|
217
|
+
if (o && i >= o.length)
|
|
218
|
+
o = void 0;
|
|
219
|
+
return { value: o && o[i++], done: !o };
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
function __read(o, n) {
|
|
224
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
225
|
+
if (!m)
|
|
226
|
+
return o;
|
|
227
|
+
var i = m.call(o), r, ar = [], e;
|
|
228
|
+
try {
|
|
229
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
|
230
|
+
ar.push(r.value);
|
|
231
|
+
}
|
|
232
|
+
catch (error) {
|
|
233
|
+
e = { error: error };
|
|
234
|
+
}
|
|
235
|
+
finally {
|
|
236
|
+
try {
|
|
237
|
+
if (r && !r.done && (m = i["return"]))
|
|
238
|
+
m.call(i);
|
|
239
|
+
}
|
|
240
|
+
finally {
|
|
241
|
+
if (e)
|
|
242
|
+
throw e.error;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
return ar;
|
|
246
|
+
}
|
|
247
|
+
function __spread() {
|
|
248
|
+
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
249
|
+
ar = ar.concat(__read(arguments[i]));
|
|
250
|
+
return ar;
|
|
251
|
+
}
|
|
252
|
+
function __spreadArrays() {
|
|
253
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
|
|
254
|
+
s += arguments[i].length;
|
|
255
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
256
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
257
|
+
r[k] = a[j];
|
|
258
|
+
return r;
|
|
259
|
+
}
|
|
260
|
+
;
|
|
261
|
+
function __await(v) {
|
|
262
|
+
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
263
|
+
}
|
|
264
|
+
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
265
|
+
if (!Symbol.asyncIterator)
|
|
266
|
+
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
267
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
268
|
+
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
269
|
+
function verb(n) { if (g[n])
|
|
270
|
+
i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
271
|
+
function resume(n, v) { try {
|
|
272
|
+
step(g[n](v));
|
|
273
|
+
}
|
|
274
|
+
catch (e) {
|
|
275
|
+
settle(q[0][3], e);
|
|
276
|
+
} }
|
|
277
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
278
|
+
function fulfill(value) { resume("next", value); }
|
|
279
|
+
function reject(value) { resume("throw", value); }
|
|
280
|
+
function settle(f, v) { if (f(v), q.shift(), q.length)
|
|
281
|
+
resume(q[0][0], q[0][1]); }
|
|
282
|
+
}
|
|
283
|
+
function __asyncDelegator(o) {
|
|
284
|
+
var i, p;
|
|
285
|
+
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
286
|
+
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
|
287
|
+
}
|
|
288
|
+
function __asyncValues(o) {
|
|
289
|
+
if (!Symbol.asyncIterator)
|
|
290
|
+
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
291
|
+
var m = o[Symbol.asyncIterator], i;
|
|
292
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
293
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
294
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
|
295
|
+
}
|
|
296
|
+
function __makeTemplateObject(cooked, raw) {
|
|
297
|
+
if (Object.defineProperty) {
|
|
298
|
+
Object.defineProperty(cooked, "raw", { value: raw });
|
|
299
|
+
}
|
|
300
|
+
else {
|
|
301
|
+
cooked.raw = raw;
|
|
302
|
+
}
|
|
303
|
+
return cooked;
|
|
304
|
+
}
|
|
305
|
+
;
|
|
306
|
+
function __importStar(mod) {
|
|
307
|
+
if (mod && mod.__esModule)
|
|
308
|
+
return mod;
|
|
309
|
+
var result = {};
|
|
310
|
+
if (mod != null)
|
|
311
|
+
for (var k in mod)
|
|
312
|
+
if (Object.hasOwnProperty.call(mod, k))
|
|
313
|
+
result[k] = mod[k];
|
|
314
|
+
result.default = mod;
|
|
315
|
+
return result;
|
|
316
|
+
}
|
|
317
|
+
function __importDefault(mod) {
|
|
318
|
+
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
319
319
|
}
|
|
320
320
|
|
|
321
|
-
var ImageDirective = /** @class */ (function () {
|
|
322
|
-
function ImageDirective(viewContainer, templateRef, renderer, elementRef) {
|
|
323
|
-
this.viewContainer = viewContainer;
|
|
324
|
-
this.templateRef = templateRef;
|
|
325
|
-
this.renderer = renderer;
|
|
326
|
-
this.elementRef = elementRef;
|
|
327
|
-
this.inlineRef = null;
|
|
328
|
-
|
|
329
|
-
this.
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
newAttrs.
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
var
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
ImageDirective.
|
|
436
|
-
{ type: core.
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
{ type: core.
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
{ type: core.
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
mediaUrlPrefix: [{ type: core.Input, args: ['scImageMediaUrlPrefix',] }],
|
|
448
|
-
urlParams: [{ type: core.Input, args: ['scImageUrlParams',] }],
|
|
449
|
-
attrs: [{ type: core.Input, args: ['scImageAttrs',] }]
|
|
321
|
+
var ImageDirective = /** @class */ (function () {
|
|
322
|
+
function ImageDirective(viewContainer, templateRef, renderer, elementRef) {
|
|
323
|
+
this.viewContainer = viewContainer;
|
|
324
|
+
this.templateRef = templateRef;
|
|
325
|
+
this.renderer = renderer;
|
|
326
|
+
this.elementRef = elementRef;
|
|
327
|
+
this.inlineRef = null;
|
|
328
|
+
this.editable = true;
|
|
329
|
+
this.urlParams = {};
|
|
330
|
+
this.attrs = {};
|
|
331
|
+
}
|
|
332
|
+
ImageDirective.prototype.ngOnChanges = function (changes) {
|
|
333
|
+
if (changes.field || changes.editable || changes.urlParams || changes.attrs) {
|
|
334
|
+
this.viewContainer.clear();
|
|
335
|
+
if (this.inlineRef) {
|
|
336
|
+
this.inlineRef.remove();
|
|
337
|
+
this.inlineRef = null;
|
|
338
|
+
}
|
|
339
|
+
this.updateView();
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
ImageDirective.prototype.updateView = function () {
|
|
343
|
+
var overrideAttrs = Object.assign(Object.assign({}, this.getElementAttrs()), this.attrs);
|
|
344
|
+
var media = this.field;
|
|
345
|
+
if (!media || (!media.editable && !media.value && !media.src)) {
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
var attrs = {};
|
|
349
|
+
// we likely have an experience editor value, should be a string
|
|
350
|
+
if (this.editable && media.editable) {
|
|
351
|
+
var foundImg = sitecoreJss.mediaApi.findEditorImageTag(media.editable);
|
|
352
|
+
if (!foundImg) {
|
|
353
|
+
return this.renderInlineWrapper(media.editable);
|
|
354
|
+
}
|
|
355
|
+
attrs = this.getImageAttrs(foundImg.attrs, overrideAttrs, this.urlParams);
|
|
356
|
+
if (!attrs) {
|
|
357
|
+
return this.renderInlineWrapper(media.editable);
|
|
358
|
+
}
|
|
359
|
+
var tempImg_1 = this.renderer.createElement('img');
|
|
360
|
+
Object.entries(attrs).forEach(function (_a) {
|
|
361
|
+
var _b = __read(_a, 2), key = _b[0], attrValue = _b[1];
|
|
362
|
+
return tempImg_1.setAttribute(key, attrValue);
|
|
363
|
+
});
|
|
364
|
+
var editableMarkup = media.editable.replace(foundImg.imgTag, tempImg_1.outerHTML);
|
|
365
|
+
return this.renderInlineWrapper(editableMarkup);
|
|
366
|
+
}
|
|
367
|
+
// some wise-guy/gal is passing in a 'raw' image object value
|
|
368
|
+
var img = media.src ? media : media.value;
|
|
369
|
+
if (!img) {
|
|
370
|
+
return null;
|
|
371
|
+
}
|
|
372
|
+
attrs = this.getImageAttrs(img, overrideAttrs, this.urlParams);
|
|
373
|
+
if (attrs) {
|
|
374
|
+
this.renderTemplate(attrs);
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
ImageDirective.prototype.getImageAttrs = function (fieldAttrs, parsedAttrs, imageParams) {
|
|
378
|
+
var combinedAttrs = Object.assign(Object.assign({}, fieldAttrs), parsedAttrs);
|
|
379
|
+
// eslint-disable-next-line prefer-const
|
|
380
|
+
var src = combinedAttrs.src, srcSet = combinedAttrs.srcSet, otherAttrs = __rest(combinedAttrs, ["src", "srcSet"]);
|
|
381
|
+
if (!src) {
|
|
382
|
+
return null;
|
|
383
|
+
}
|
|
384
|
+
var newAttrs = Object.assign({}, otherAttrs);
|
|
385
|
+
// update image URL for jss handler and image rendering params
|
|
386
|
+
src = sitecoreJss.mediaApi.updateImageUrl(src, imageParams, this.mediaUrlPrefix);
|
|
387
|
+
if (srcSet) {
|
|
388
|
+
// replace with HTML-formatted srcset, including updated image URLs
|
|
389
|
+
newAttrs.srcSet = sitecoreJss.mediaApi.getSrcSet(src, srcSet, imageParams, this.mediaUrlPrefix);
|
|
390
|
+
}
|
|
391
|
+
else {
|
|
392
|
+
newAttrs.src = src;
|
|
393
|
+
}
|
|
394
|
+
return newAttrs;
|
|
395
|
+
};
|
|
396
|
+
ImageDirective.prototype.renderTemplate = function (imageProps) {
|
|
397
|
+
var _this = this;
|
|
398
|
+
var viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
|
|
399
|
+
viewRef.rootNodes.forEach(function (node) {
|
|
400
|
+
Object.entries(imageProps).forEach(function (_a) {
|
|
401
|
+
var _b = __read(_a, 2), key = _b[0], imgPropVal = _b[1];
|
|
402
|
+
return _this.renderer.setAttribute(node, key, imgPropVal);
|
|
403
|
+
});
|
|
404
|
+
});
|
|
405
|
+
};
|
|
406
|
+
ImageDirective.prototype.getElementAttrs = function () {
|
|
407
|
+
var view = this.templateRef.createEmbeddedView(null);
|
|
408
|
+
var element = view.rootNodes[0];
|
|
409
|
+
if (!element) {
|
|
410
|
+
return {};
|
|
411
|
+
}
|
|
412
|
+
var attrs = {};
|
|
413
|
+
for (var i = 0; i < element.attributes.length; i++) {
|
|
414
|
+
var attr = element.attributes.item(i);
|
|
415
|
+
if (attr) {
|
|
416
|
+
attrs[attr.name] = attr.value;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
return attrs;
|
|
420
|
+
};
|
|
421
|
+
ImageDirective.prototype.renderInlineWrapper = function (editable) {
|
|
422
|
+
var span = this.renderer.createElement('span');
|
|
423
|
+
span.className = 'sc-image-wrapper';
|
|
424
|
+
span.innerHTML = editable;
|
|
425
|
+
var parentNode = this.renderer.parentNode(this.elementRef.nativeElement);
|
|
426
|
+
this.renderer.insertBefore(parentNode, span, this.elementRef.nativeElement);
|
|
427
|
+
parentNode.removeChild(this.elementRef.nativeElement);
|
|
428
|
+
this.inlineRef = span;
|
|
429
|
+
};
|
|
430
|
+
return ImageDirective;
|
|
431
|
+
}());
|
|
432
|
+
ImageDirective.decorators = [
|
|
433
|
+
{ type: core.Directive, args: [{ selector: '[scImage]' },] }
|
|
434
|
+
];
|
|
435
|
+
ImageDirective.ctorParameters = function () { return [
|
|
436
|
+
{ type: core.ViewContainerRef },
|
|
437
|
+
{ type: core.TemplateRef },
|
|
438
|
+
{ type: core.Renderer2 },
|
|
439
|
+
{ type: core.ElementRef }
|
|
440
|
+
]; };
|
|
441
|
+
ImageDirective.propDecorators = {
|
|
442
|
+
field: [{ type: core.Input, args: ['scImage',] }],
|
|
443
|
+
editable: [{ type: core.Input, args: ['scImageEditable',] }],
|
|
444
|
+
mediaUrlPrefix: [{ type: core.Input, args: ['scImageMediaUrlPrefix',] }],
|
|
445
|
+
urlParams: [{ type: core.Input, args: ['scImageUrlParams',] }],
|
|
446
|
+
attrs: [{ type: core.Input, args: ['scImageAttrs',] }]
|
|
450
447
|
};
|
|
451
448
|
|
|
452
|
-
var LinkDirective = /** @class */ (function () {
|
|
453
|
-
function LinkDirective(viewContainer, templateRef, renderer, elementRef) {
|
|
454
|
-
this.viewContainer = viewContainer;
|
|
455
|
-
this.templateRef = templateRef;
|
|
456
|
-
this.renderer = renderer;
|
|
457
|
-
this.elementRef = elementRef;
|
|
458
|
-
this.inlineRef = null;
|
|
459
|
-
|
|
460
|
-
this.
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
var
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
this.
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
{ type: core.
|
|
549
|
-
{ type: core.
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
attrs: [{ type: core.Input, args: ['scLinkAttrs',] }],
|
|
556
|
-
field: [{ type: core.Input, args: ['scLink',] }]
|
|
449
|
+
var LinkDirective = /** @class */ (function () {
|
|
450
|
+
function LinkDirective(viewContainer, templateRef, renderer, elementRef) {
|
|
451
|
+
this.viewContainer = viewContainer;
|
|
452
|
+
this.templateRef = templateRef;
|
|
453
|
+
this.renderer = renderer;
|
|
454
|
+
this.elementRef = elementRef;
|
|
455
|
+
this.inlineRef = null;
|
|
456
|
+
this.editable = true;
|
|
457
|
+
this.attrs = {};
|
|
458
|
+
}
|
|
459
|
+
LinkDirective.prototype.ngOnChanges = function (changes) {
|
|
460
|
+
if (changes.field || changes.editable || changes.attrs) {
|
|
461
|
+
this.viewContainer.clear();
|
|
462
|
+
if (this.inlineRef) {
|
|
463
|
+
this.inlineRef.remove();
|
|
464
|
+
this.inlineRef = null;
|
|
465
|
+
}
|
|
466
|
+
this.updateView();
|
|
467
|
+
}
|
|
468
|
+
};
|
|
469
|
+
LinkDirective.prototype.updateView = function () {
|
|
470
|
+
var field = this.field;
|
|
471
|
+
if (this.editable && field && field.editableFirstPart && field.editableLastPart) {
|
|
472
|
+
this.renderInlineWrapper(field.editableFirstPart, field.editableLastPart);
|
|
473
|
+
}
|
|
474
|
+
else if (field && (field.href || field.value)) {
|
|
475
|
+
var props = field.href ? field : field.value;
|
|
476
|
+
var linkText = field.text || field.value.text || field.href || field.value.href;
|
|
477
|
+
var mergedAttrs = Object.assign(Object.assign({}, props), this.attrs);
|
|
478
|
+
this.renderTemplate(mergedAttrs, linkText);
|
|
479
|
+
}
|
|
480
|
+
};
|
|
481
|
+
LinkDirective.prototype.renderTemplate = function (props, linkText) {
|
|
482
|
+
var _this = this;
|
|
483
|
+
var viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
|
|
484
|
+
viewRef.rootNodes.forEach(function (node) {
|
|
485
|
+
Object.entries(props).forEach(function (_a) {
|
|
486
|
+
var _b = __read(_a, 2), key = _b[0], propValue = _b[1];
|
|
487
|
+
if (key === 'href') {
|
|
488
|
+
var isInvalidLink = !propValue || /^https?:\/\/$/.test(propValue);
|
|
489
|
+
if (isInvalidLink) {
|
|
490
|
+
if (!node.href) {
|
|
491
|
+
return;
|
|
492
|
+
}
|
|
493
|
+
propValue = node.href;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
if (key === 'class' && node.className) {
|
|
497
|
+
propValue += " " + node.className;
|
|
498
|
+
}
|
|
499
|
+
_this.renderer.setAttribute(node, key, propValue);
|
|
500
|
+
});
|
|
501
|
+
if (node.childNodes && node.childNodes.length === 0 && linkText) {
|
|
502
|
+
node.textContent = linkText;
|
|
503
|
+
}
|
|
504
|
+
});
|
|
505
|
+
};
|
|
506
|
+
LinkDirective.prototype.renderInlineWrapper = function (editableFirstPart, editableLastPart) {
|
|
507
|
+
var _this = this;
|
|
508
|
+
var span = this.renderer.createElement('span');
|
|
509
|
+
span.className = 'sc-link-wrapper';
|
|
510
|
+
span.innerHTML = editableFirstPart + editableLastPart;
|
|
511
|
+
// assign attributes from template to inline wrapper
|
|
512
|
+
var attrs = Object.assign(Object.assign({}, this.getElementAttrs()), this.attrs);
|
|
513
|
+
Object.entries(attrs).forEach(function (_a) {
|
|
514
|
+
var _b = __read(_a, 2), key = _b[0], attrValue = _b[1];
|
|
515
|
+
return _this.renderer.setAttribute(span, key, attrValue);
|
|
516
|
+
});
|
|
517
|
+
this.viewContainer.createEmbeddedView(this.templateRef);
|
|
518
|
+
var parentNode = this.renderer.parentNode(this.elementRef.nativeElement);
|
|
519
|
+
this.renderer.insertBefore(parentNode, span, this.elementRef.nativeElement);
|
|
520
|
+
this.inlineRef = span;
|
|
521
|
+
};
|
|
522
|
+
LinkDirective.prototype.getElementAttrs = function () {
|
|
523
|
+
var view = this.templateRef.createEmbeddedView(null);
|
|
524
|
+
var element = view.rootNodes[0];
|
|
525
|
+
if (!element) {
|
|
526
|
+
return {};
|
|
527
|
+
}
|
|
528
|
+
var attrs = {};
|
|
529
|
+
for (var i = 0; i < element.attributes.length; i++) {
|
|
530
|
+
var attr = element.attributes.item(i);
|
|
531
|
+
if (attr) {
|
|
532
|
+
attrs[attr.name] = attr.value;
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
return attrs;
|
|
536
|
+
};
|
|
537
|
+
return LinkDirective;
|
|
538
|
+
}());
|
|
539
|
+
LinkDirective.decorators = [
|
|
540
|
+
{ type: core.Directive, args: [{ selector: '[scLink]' },] }
|
|
541
|
+
];
|
|
542
|
+
LinkDirective.ctorParameters = function () { return [
|
|
543
|
+
{ type: core.ViewContainerRef },
|
|
544
|
+
{ type: core.TemplateRef },
|
|
545
|
+
{ type: core.Renderer2 },
|
|
546
|
+
{ type: core.ElementRef }
|
|
547
|
+
]; };
|
|
548
|
+
LinkDirective.propDecorators = {
|
|
549
|
+
editable: [{ type: core.Input, args: ['scLinkEditable',] }],
|
|
550
|
+
attrs: [{ type: core.Input, args: ['scLinkAttrs',] }],
|
|
551
|
+
field: [{ type: core.Input, args: ['scLink',] }]
|
|
557
552
|
};
|
|
558
553
|
|
|
559
|
-
var RouterLinkDirective = /** @class */ (function (_super) {
|
|
560
|
-
__extends(RouterLinkDirective, _super);
|
|
561
|
-
function RouterLinkDirective(viewContainer, templateRef, renderer, elementRef, router) {
|
|
562
|
-
var _this = _super.call(this, viewContainer, templateRef, renderer, elementRef) || this;
|
|
563
|
-
_this.router = router;
|
|
564
|
-
|
|
565
|
-
_this.
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
{ type: core.
|
|
596
|
-
{ type: core.
|
|
597
|
-
{ type:
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
attrs: [{ type: core.Input, args: ['scRouterLinkAttrs',] }],
|
|
604
|
-
field: [{ type: core.Input, args: ['scRouterLink',] }]
|
|
554
|
+
var RouterLinkDirective = /** @class */ (function (_super) {
|
|
555
|
+
__extends(RouterLinkDirective, _super);
|
|
556
|
+
function RouterLinkDirective(viewContainer, templateRef, renderer, elementRef, router) {
|
|
557
|
+
var _this = _super.call(this, viewContainer, templateRef, renderer, elementRef) || this;
|
|
558
|
+
_this.router = router;
|
|
559
|
+
_this.editable = true;
|
|
560
|
+
_this.attrs = {};
|
|
561
|
+
return _this;
|
|
562
|
+
}
|
|
563
|
+
RouterLinkDirective.prototype.renderTemplate = function (props, linkText) {
|
|
564
|
+
var _this = this;
|
|
565
|
+
var viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
|
|
566
|
+
viewRef.rootNodes.forEach(function (node) {
|
|
567
|
+
Object.entries(props).forEach(function (_a) {
|
|
568
|
+
var _b = __read(_a, 2), key = _b[0], propValue = _b[1];
|
|
569
|
+
_this.renderer.setAttribute(node, key, propValue);
|
|
570
|
+
if (key === 'href') {
|
|
571
|
+
_this.renderer.listen(node, 'click', function (event) {
|
|
572
|
+
_this.router.navigate([propValue]);
|
|
573
|
+
event.preventDefault();
|
|
574
|
+
});
|
|
575
|
+
}
|
|
576
|
+
});
|
|
577
|
+
if (node.childNodes && node.childNodes.length === 0 && linkText) {
|
|
578
|
+
node.textContent = linkText;
|
|
579
|
+
}
|
|
580
|
+
});
|
|
581
|
+
};
|
|
582
|
+
return RouterLinkDirective;
|
|
583
|
+
}(LinkDirective));
|
|
584
|
+
RouterLinkDirective.decorators = [
|
|
585
|
+
{ type: core.Directive, args: [{ selector: '[scRouterLink]' },] }
|
|
586
|
+
];
|
|
587
|
+
RouterLinkDirective.ctorParameters = function () { return [
|
|
588
|
+
{ type: core.ViewContainerRef },
|
|
589
|
+
{ type: core.TemplateRef },
|
|
590
|
+
{ type: core.Renderer2 },
|
|
591
|
+
{ type: core.ElementRef },
|
|
592
|
+
{ type: router.Router }
|
|
593
|
+
]; };
|
|
594
|
+
RouterLinkDirective.propDecorators = {
|
|
595
|
+
editable: [{ type: core.Input, args: ['scRouterLinkEditable',] }],
|
|
596
|
+
attrs: [{ type: core.Input, args: ['scRouterLinkAttrs',] }],
|
|
597
|
+
field: [{ type: core.Input, args: ['scRouterLink',] }]
|
|
605
598
|
};
|
|
606
599
|
|
|
607
|
-
var GenericLinkDirective = /** @class */ (function (_super) {
|
|
608
|
-
__extends(GenericLinkDirective, _super);
|
|
609
|
-
function GenericLinkDirective(viewContainer, templateRef, renderer, elementRef, router) {
|
|
610
|
-
var _this = _super.call(this, viewContainer, templateRef, renderer, elementRef) || this;
|
|
611
|
-
_this.router = router;
|
|
612
|
-
|
|
613
|
-
_this.
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
{ type: core.
|
|
657
|
-
{ type: core.
|
|
658
|
-
{ type:
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
field: [{ type: core.Input, args: ['scGenericLink',] }],
|
|
666
|
-
extras: [{ type: core.Input, args: ['scGenericLinkExtras',] }]
|
|
600
|
+
var GenericLinkDirective = /** @class */ (function (_super) {
|
|
601
|
+
__extends(GenericLinkDirective, _super);
|
|
602
|
+
function GenericLinkDirective(viewContainer, templateRef, renderer, elementRef, router) {
|
|
603
|
+
var _this = _super.call(this, viewContainer, templateRef, renderer, elementRef) || this;
|
|
604
|
+
_this.router = router;
|
|
605
|
+
_this.editable = true;
|
|
606
|
+
_this.attrs = {};
|
|
607
|
+
return _this;
|
|
608
|
+
}
|
|
609
|
+
GenericLinkDirective.prototype.renderTemplate = function (props, linkText) {
|
|
610
|
+
var _this = this;
|
|
611
|
+
var viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
|
|
612
|
+
viewRef.rootNodes.forEach(function (node) {
|
|
613
|
+
Object.entries(props).forEach(function (_a) {
|
|
614
|
+
var _b = __read(_a, 2), key = _b[0], propValue = _b[1];
|
|
615
|
+
if (key === 'href' && !_this.isAbsoluteUrl(propValue)) {
|
|
616
|
+
var urlTree = _this.router.createUrlTree([propValue], _this.extras);
|
|
617
|
+
_this.renderer.setAttribute(node, key, _this.router.serializeUrl(urlTree));
|
|
618
|
+
_this.renderer.listen(node, 'click', function (event) {
|
|
619
|
+
_this.router.navigate([propValue], _this.extras);
|
|
620
|
+
event.preventDefault();
|
|
621
|
+
});
|
|
622
|
+
}
|
|
623
|
+
else {
|
|
624
|
+
_this.renderer.setAttribute(node, key, propValue);
|
|
625
|
+
}
|
|
626
|
+
});
|
|
627
|
+
if (node.childNodes && node.childNodes.length === 0 && linkText) {
|
|
628
|
+
node.textContent = linkText;
|
|
629
|
+
}
|
|
630
|
+
});
|
|
631
|
+
};
|
|
632
|
+
GenericLinkDirective.prototype.isAbsoluteUrl = function (url) {
|
|
633
|
+
if (url === null) {
|
|
634
|
+
return false;
|
|
635
|
+
}
|
|
636
|
+
if (typeof url !== 'string') {
|
|
637
|
+
throw new TypeError('Expected a string');
|
|
638
|
+
}
|
|
639
|
+
return /^[a-z][a-z0-9+.-]*:/.test(url);
|
|
640
|
+
};
|
|
641
|
+
return GenericLinkDirective;
|
|
642
|
+
}(LinkDirective));
|
|
643
|
+
GenericLinkDirective.decorators = [
|
|
644
|
+
{ type: core.Directive, args: [{ selector: '[scGenericLink]' },] }
|
|
645
|
+
];
|
|
646
|
+
GenericLinkDirective.ctorParameters = function () { return [
|
|
647
|
+
{ type: core.ViewContainerRef },
|
|
648
|
+
{ type: core.TemplateRef },
|
|
649
|
+
{ type: core.Renderer2 },
|
|
650
|
+
{ type: core.ElementRef },
|
|
651
|
+
{ type: router.Router }
|
|
652
|
+
]; };
|
|
653
|
+
GenericLinkDirective.propDecorators = {
|
|
654
|
+
editable: [{ type: core.Input, args: ['scGenericLinkEditable',] }],
|
|
655
|
+
attrs: [{ type: core.Input, args: ['scGenericLinkAttrs',] }],
|
|
656
|
+
field: [{ type: core.Input, args: ['scGenericLink',] }],
|
|
657
|
+
extras: [{ type: core.Input, args: ['scGenericLinkExtras',] }]
|
|
667
658
|
};
|
|
668
659
|
|
|
669
|
-
/** Registers a statically loaded component */
|
|
670
|
-
var ComponentNameAndType = /** @class */ (function () {
|
|
671
|
-
function ComponentNameAndType() {
|
|
672
|
-
}
|
|
673
|
-
return ComponentNameAndType;
|
|
674
|
-
}());
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
function
|
|
679
|
-
return '
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
660
|
+
/** Registers a statically loaded component */
|
|
661
|
+
var ComponentNameAndType = /** @class */ (function () {
|
|
662
|
+
function ComponentNameAndType() {
|
|
663
|
+
}
|
|
664
|
+
return ComponentNameAndType;
|
|
665
|
+
}());
|
|
666
|
+
/**
|
|
667
|
+
* @param {any} object
|
|
668
|
+
*/
|
|
669
|
+
function instanceOfComponentNameAndType(object) {
|
|
670
|
+
return 'type' in object;
|
|
671
|
+
}
|
|
672
|
+
/**
|
|
673
|
+
* @param {any} object
|
|
674
|
+
*/
|
|
675
|
+
function instanceOfComponentNameAndModule(object) {
|
|
676
|
+
return 'module' in object;
|
|
677
|
+
}
|
|
678
|
+
var PLACEHOLDER_COMPONENTS = new core.InjectionToken('Sc.placeholder.components');
|
|
679
|
+
var PLACEHOLDER_LAZY_COMPONENTS = new core.InjectionToken('Sc.placeholder.lazyComponents');
|
|
680
|
+
var PLACEHOLDER_MISSING_COMPONENT_COMPONENT = new core.InjectionToken('Sc.placeholder.missingComponentComponent');
|
|
684
681
|
var DYNAMIC_COMPONENT = new core.InjectionToken('Sc.placeholder.dynamicComponent');
|
|
685
682
|
|
|
686
|
-
var RawComponent = /** @class */ (function () {
|
|
687
|
-
function RawComponent(renderer, elementRef) {
|
|
688
|
-
this.renderer = renderer;
|
|
689
|
-
this.elementRef = elementRef;
|
|
690
|
-
}
|
|
691
|
-
RawComponent.prototype.ngOnInit = function () {
|
|
692
|
-
var el = this.renderer.createElement(this.rendering.name);
|
|
693
|
-
var contents = this.renderer.createText(this.rendering.contents || '');
|
|
694
|
-
var attributes = this.rendering.attributes;
|
|
695
|
-
for (var attr in attributes) {
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
this.renderer.
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
{ type: core.
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
683
|
+
var RawComponent = /** @class */ (function () {
|
|
684
|
+
function RawComponent(renderer, elementRef) {
|
|
685
|
+
this.renderer = renderer;
|
|
686
|
+
this.elementRef = elementRef;
|
|
687
|
+
}
|
|
688
|
+
RawComponent.prototype.ngOnInit = function () {
|
|
689
|
+
var el = this.renderer.createElement(this.rendering.name);
|
|
690
|
+
var contents = this.renderer.createText(this.rendering.contents || '');
|
|
691
|
+
var attributes = this.rendering.attributes;
|
|
692
|
+
for (var attr in attributes) {
|
|
693
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
694
|
+
if (attributes.hasOwnProperty(attr)) {
|
|
695
|
+
var value = attributes[attr];
|
|
696
|
+
this.renderer.setAttribute(el, attr, value || '');
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
this.renderer.appendChild(el, contents);
|
|
700
|
+
var parentNode = this.renderer.parentNode(this.elementRef.nativeElement);
|
|
701
|
+
this.renderer.insertBefore(parentNode, el, this.elementRef.nativeElement);
|
|
702
|
+
parentNode.removeChild(this.elementRef.nativeElement);
|
|
703
|
+
};
|
|
704
|
+
return RawComponent;
|
|
705
|
+
}());
|
|
706
|
+
RawComponent.decorators = [
|
|
707
|
+
{ type: core.Component, args: [{
|
|
708
|
+
selector: 'sc-raw',
|
|
709
|
+
template: ''
|
|
710
|
+
},] }
|
|
711
|
+
];
|
|
712
|
+
RawComponent.ctorParameters = function () { return [
|
|
713
|
+
{ type: core.Renderer2 },
|
|
714
|
+
{ type: core.ElementRef }
|
|
715
|
+
]; };
|
|
716
|
+
RawComponent.propDecorators = {
|
|
717
|
+
rendering: [{ type: core.Input }]
|
|
720
718
|
};
|
|
721
719
|
|
|
722
|
-
|
|
723
|
-
|
|
720
|
+
/**
|
|
721
|
+
* @param {HtmlElementRendering | ComponentRendering} rendering
|
|
722
|
+
*/
|
|
723
|
+
function isRawRendering(rendering) {
|
|
724
|
+
return (!rendering.componentName &&
|
|
725
|
+
rendering.name !== undefined);
|
|
724
726
|
}
|
|
725
727
|
|
|
726
|
-
var JssComponentFactoryService = /** @class */ (function () {
|
|
727
|
-
function JssComponentFactoryService(injector, compiler, components, lazyComponents) {
|
|
728
|
-
var _this = this;
|
|
729
|
-
this.injector = injector;
|
|
730
|
-
this.compiler = compiler;
|
|
731
|
-
this.components = components;
|
|
732
|
-
this.lazyComponents = lazyComponents;
|
|
733
|
-
this.componentMap = new Map();
|
|
734
|
-
this.lazyComponentMap = new Map();
|
|
735
|
-
this.components.forEach(function (c) { return _this.componentMap.set(c.name, c.type); });
|
|
736
|
-
if (this.lazyComponents) {
|
|
737
|
-
this.lazyComponents.forEach(function (c) { return _this.lazyComponentMap.set(c.path, c); });
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
JssComponentFactoryService.prototype.loadModuleFactory = function (lazyComponent) {
|
|
741
|
-
var _this = this;
|
|
742
|
-
return lazyComponent.loadChildren().then(function (loaded) {
|
|
743
|
-
if (loaded instanceof core.NgModuleFactory) {
|
|
744
|
-
return loaded;
|
|
745
|
-
}
|
|
746
|
-
else {
|
|
747
|
-
return _this.compiler.compileModuleAsync(loaded);
|
|
748
|
-
}
|
|
749
|
-
});
|
|
750
|
-
};
|
|
751
|
-
JssComponentFactoryService.prototype.getComponent = function (component) {
|
|
752
|
-
var _this = this;
|
|
753
|
-
var loadedComponent = this.componentMap.get(component.componentName);
|
|
754
|
-
if (loadedComponent) {
|
|
755
|
-
return Promise.resolve({
|
|
756
|
-
componentDefinition: component,
|
|
757
|
-
componentImplementation: this.componentMap.get(component.componentName),
|
|
758
|
-
});
|
|
759
|
-
}
|
|
760
|
-
var lazyComponent = this.lazyComponentMap.get(component.componentName);
|
|
761
|
-
if (lazyComponent) {
|
|
762
|
-
return this.loadModuleFactory(lazyComponent)
|
|
763
|
-
|
|
764
|
-
var
|
|
765
|
-
var
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
}
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
}
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
});
|
|
795
|
-
};
|
|
796
|
-
JssComponentFactoryService.prototype.
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
}
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
{ type: core.Injectable }
|
|
813
|
-
];
|
|
814
|
-
JssComponentFactoryService.ctorParameters = function () { return [
|
|
815
|
-
{ type: core.Injector },
|
|
816
|
-
{ type: core.Compiler },
|
|
817
|
-
{ type: Array, decorators: [{ type: core.Inject, args: [PLACEHOLDER_COMPONENTS,] }] },
|
|
818
|
-
{ type: Array, decorators: [{ type: core.Inject, args: [PLACEHOLDER_LAZY_COMPONENTS,] }] }
|
|
728
|
+
var JssComponentFactoryService = /** @class */ (function () {
|
|
729
|
+
function JssComponentFactoryService(injector, compiler, components, lazyComponents) {
|
|
730
|
+
var _this = this;
|
|
731
|
+
this.injector = injector;
|
|
732
|
+
this.compiler = compiler;
|
|
733
|
+
this.components = components;
|
|
734
|
+
this.lazyComponents = lazyComponents;
|
|
735
|
+
this.componentMap = new Map();
|
|
736
|
+
this.lazyComponentMap = new Map();
|
|
737
|
+
this.components.forEach(function (c) { return _this.componentMap.set(c.name, c.type); });
|
|
738
|
+
if (this.lazyComponents) {
|
|
739
|
+
this.lazyComponents.forEach(function (c) { return _this.lazyComponentMap.set(c.path, c); });
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
JssComponentFactoryService.prototype.loadModuleFactory = function (lazyComponent) {
|
|
743
|
+
var _this = this;
|
|
744
|
+
return lazyComponent.loadChildren().then(function (loaded) {
|
|
745
|
+
if (loaded instanceof core.NgModuleFactory) {
|
|
746
|
+
return loaded;
|
|
747
|
+
}
|
|
748
|
+
else {
|
|
749
|
+
return _this.compiler.compileModuleAsync(loaded);
|
|
750
|
+
}
|
|
751
|
+
});
|
|
752
|
+
};
|
|
753
|
+
JssComponentFactoryService.prototype.getComponent = function (component) {
|
|
754
|
+
var _this = this;
|
|
755
|
+
var loadedComponent = this.componentMap.get(component.componentName);
|
|
756
|
+
if (loadedComponent) {
|
|
757
|
+
return Promise.resolve({
|
|
758
|
+
componentDefinition: component,
|
|
759
|
+
componentImplementation: this.componentMap.get(component.componentName),
|
|
760
|
+
});
|
|
761
|
+
}
|
|
762
|
+
var lazyComponent = this.lazyComponentMap.get(component.componentName);
|
|
763
|
+
if (lazyComponent) {
|
|
764
|
+
return this.loadModuleFactory(lazyComponent).then(function (ngModuleFactory) {
|
|
765
|
+
var componentType = null;
|
|
766
|
+
var moduleRef = ngModuleFactory.create(_this.injector);
|
|
767
|
+
var dynamicComponentType = moduleRef.injector.get(DYNAMIC_COMPONENT);
|
|
768
|
+
if (!dynamicComponentType) {
|
|
769
|
+
throw new Error("JssComponentFactoryService: Lazy load module for component \"" + lazyComponent.path + "\" missing DYNAMIC_COMPONENT provider. Missing JssModule.forChild()?");
|
|
770
|
+
}
|
|
771
|
+
if (component.componentName in dynamicComponentType) {
|
|
772
|
+
componentType = dynamicComponentType[component.componentName];
|
|
773
|
+
}
|
|
774
|
+
else {
|
|
775
|
+
if (typeof dynamicComponentType === 'function') {
|
|
776
|
+
componentType = dynamicComponentType;
|
|
777
|
+
}
|
|
778
|
+
else {
|
|
779
|
+
throw new Error("JssComponentFactoryService: Lazy load module for component \"" + lazyComponent.path + "\" missing DYNAMIC_COMPONENT provider. Missing JssModule.forChild()?");
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
return {
|
|
783
|
+
componentDefinition: component,
|
|
784
|
+
componentImplementation: componentType,
|
|
785
|
+
componentFactory: moduleRef.componentFactoryResolver.resolveComponentFactory(componentType),
|
|
786
|
+
};
|
|
787
|
+
});
|
|
788
|
+
}
|
|
789
|
+
return Promise.resolve({
|
|
790
|
+
componentDefinition: component,
|
|
791
|
+
});
|
|
792
|
+
};
|
|
793
|
+
JssComponentFactoryService.prototype.getComponents = function (components) {
|
|
794
|
+
var _this = this;
|
|
795
|
+
// acquire all components and keep them in order while handling their potential async-ness
|
|
796
|
+
return Promise.all(components.map(function (component) { return isRawRendering(component) ? _this.getRawComponent(component) : _this.getComponent(component); }));
|
|
797
|
+
};
|
|
798
|
+
JssComponentFactoryService.prototype.getRawComponent = function (component) {
|
|
799
|
+
return Promise.resolve({
|
|
800
|
+
componentImplementation: RawComponent,
|
|
801
|
+
componentDefinition: component,
|
|
802
|
+
});
|
|
803
|
+
};
|
|
804
|
+
return JssComponentFactoryService;
|
|
805
|
+
}());
|
|
806
|
+
JssComponentFactoryService.decorators = [
|
|
807
|
+
{ type: core.Injectable }
|
|
808
|
+
];
|
|
809
|
+
JssComponentFactoryService.ctorParameters = function () { return [
|
|
810
|
+
{ type: core.Injector },
|
|
811
|
+
{ type: core.Compiler },
|
|
812
|
+
{ type: Array, decorators: [{ type: core.Inject, args: [PLACEHOLDER_COMPONENTS,] }] },
|
|
813
|
+
{ type: Array, decorators: [{ type: core.Inject, args: [PLACEHOLDER_LAZY_COMPONENTS,] }] }
|
|
819
814
|
]; };
|
|
820
815
|
|
|
821
|
-
var PlaceholderLoadingDirective = /** @class */ (function () {
|
|
822
|
-
function PlaceholderLoadingDirective(templateRef) {
|
|
823
|
-
this.templateRef = templateRef;
|
|
824
|
-
}
|
|
825
|
-
return PlaceholderLoadingDirective;
|
|
826
|
-
}());
|
|
827
|
-
PlaceholderLoadingDirective.decorators = [
|
|
828
|
-
{ type: core.Directive, args: [{
|
|
829
|
-
selector: '[scPlaceholderLoading]',
|
|
830
|
-
},] }
|
|
831
|
-
];
|
|
832
|
-
PlaceholderLoadingDirective.ctorParameters = function () { return [
|
|
833
|
-
{ type: core.TemplateRef }
|
|
816
|
+
var PlaceholderLoadingDirective = /** @class */ (function () {
|
|
817
|
+
function PlaceholderLoadingDirective(templateRef) {
|
|
818
|
+
this.templateRef = templateRef;
|
|
819
|
+
}
|
|
820
|
+
return PlaceholderLoadingDirective;
|
|
821
|
+
}());
|
|
822
|
+
PlaceholderLoadingDirective.decorators = [
|
|
823
|
+
{ type: core.Directive, args: [{
|
|
824
|
+
selector: '[scPlaceholderLoading]',
|
|
825
|
+
},] }
|
|
826
|
+
];
|
|
827
|
+
PlaceholderLoadingDirective.ctorParameters = function () { return [
|
|
828
|
+
{ type: core.TemplateRef }
|
|
834
829
|
]; };
|
|
835
830
|
|
|
836
|
-
var RenderEachDirective = /** @class */ (function () {
|
|
837
|
-
function RenderEachDirective(templateRef) {
|
|
838
|
-
this.templateRef = templateRef;
|
|
839
|
-
}
|
|
840
|
-
return RenderEachDirective;
|
|
841
|
-
}());
|
|
842
|
-
RenderEachDirective.decorators = [
|
|
843
|
-
{ type: core.Directive, args: [{
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
{ type: core.TemplateRef }
|
|
831
|
+
var RenderEachDirective = /** @class */ (function () {
|
|
832
|
+
function RenderEachDirective(templateRef) {
|
|
833
|
+
this.templateRef = templateRef;
|
|
834
|
+
}
|
|
835
|
+
return RenderEachDirective;
|
|
836
|
+
}());
|
|
837
|
+
RenderEachDirective.decorators = [
|
|
838
|
+
{ type: core.Directive, args: [{
|
|
839
|
+
selector: '[renderEach]',
|
|
840
|
+
},] }
|
|
841
|
+
];
|
|
842
|
+
RenderEachDirective.ctorParameters = function () { return [
|
|
843
|
+
{ type: core.TemplateRef }
|
|
850
844
|
]; };
|
|
851
845
|
|
|
852
|
-
var RenderEmptyDirective = /** @class */ (function () {
|
|
853
|
-
function RenderEmptyDirective(templateRef) {
|
|
854
|
-
this.templateRef = templateRef;
|
|
855
|
-
}
|
|
856
|
-
return RenderEmptyDirective;
|
|
857
|
-
}());
|
|
858
|
-
RenderEmptyDirective.decorators = [
|
|
859
|
-
{ type: core.Directive, args: [{
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
{ type: core.TemplateRef }
|
|
846
|
+
var RenderEmptyDirective = /** @class */ (function () {
|
|
847
|
+
function RenderEmptyDirective(templateRef) {
|
|
848
|
+
this.templateRef = templateRef;
|
|
849
|
+
}
|
|
850
|
+
return RenderEmptyDirective;
|
|
851
|
+
}());
|
|
852
|
+
RenderEmptyDirective.decorators = [
|
|
853
|
+
{ type: core.Directive, args: [{
|
|
854
|
+
selector: '[renderEmpty]',
|
|
855
|
+
},] }
|
|
856
|
+
];
|
|
857
|
+
RenderEmptyDirective.ctorParameters = function () { return [
|
|
858
|
+
{ type: core.TemplateRef }
|
|
866
859
|
]; };
|
|
867
860
|
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
this.
|
|
881
|
-
this.
|
|
882
|
-
this.
|
|
883
|
-
this.
|
|
884
|
-
this.
|
|
885
|
-
this.
|
|
886
|
-
this.
|
|
887
|
-
this.
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
};
|
|
916
|
-
PlaceholderComponent.prototype.
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
var
|
|
927
|
-
if (!
|
|
928
|
-
return;
|
|
929
|
-
}
|
|
930
|
-
var
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
this.
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
this.
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
this.
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
PlaceholderComponent.
|
|
1034
|
-
{ type: core.
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
{ type: core.
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
861
|
+
/**
|
|
862
|
+
* @param {ComponentRendering} rendering
|
|
863
|
+
* @param {string} name
|
|
864
|
+
*/
|
|
865
|
+
function getPlaceholder(rendering, name) {
|
|
866
|
+
if (rendering && rendering.placeholders && Object.keys(rendering.placeholders).length > 0) {
|
|
867
|
+
return rendering.placeholders[name];
|
|
868
|
+
}
|
|
869
|
+
return null;
|
|
870
|
+
}
|
|
871
|
+
var PlaceholderComponent = /** @class */ (function () {
|
|
872
|
+
function PlaceholderComponent(componentFactoryResolver, differs, componentFactory, changeDetectorRef, elementRef, renderer, missingComponentComponent) {
|
|
873
|
+
this.componentFactoryResolver = componentFactoryResolver;
|
|
874
|
+
this.differs = differs;
|
|
875
|
+
this.componentFactory = componentFactory;
|
|
876
|
+
this.changeDetectorRef = changeDetectorRef;
|
|
877
|
+
this.elementRef = elementRef;
|
|
878
|
+
this.renderer = renderer;
|
|
879
|
+
this.missingComponentComponent = missingComponentComponent;
|
|
880
|
+
this._componentInstances = [];
|
|
881
|
+
this.destroyed = false;
|
|
882
|
+
this.parentStyleAttribute = '';
|
|
883
|
+
this.isLoading = true;
|
|
884
|
+
this.loaded = new core.EventEmitter();
|
|
885
|
+
}
|
|
886
|
+
Object.defineProperty(PlaceholderComponent.prototype, "inputs", {
|
|
887
|
+
set: function (value) {
|
|
888
|
+
this._inputs = value;
|
|
889
|
+
if (!this._differ && value) {
|
|
890
|
+
this._differ = this.differs.find(value).create();
|
|
891
|
+
}
|
|
892
|
+
},
|
|
893
|
+
enumerable: false,
|
|
894
|
+
configurable: true
|
|
895
|
+
});
|
|
896
|
+
PlaceholderComponent.prototype.ngOnInit = function () {
|
|
897
|
+
// just to ensure the element exists
|
|
898
|
+
var elem = this.elementRef.nativeElement;
|
|
899
|
+
if (elem) {
|
|
900
|
+
var attributes = elem.attributes;
|
|
901
|
+
for (var i = 0; i < attributes.length; i++) {
|
|
902
|
+
var attr = attributes.item(i);
|
|
903
|
+
if (attr && attr.name.indexOf('_ngcontent') !== -1) {
|
|
904
|
+
this.parentStyleAttribute = attr.name;
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
};
|
|
909
|
+
PlaceholderComponent.prototype.ngOnDestroy = function () {
|
|
910
|
+
this.destroyed = true;
|
|
911
|
+
this._componentInstances = [];
|
|
912
|
+
};
|
|
913
|
+
PlaceholderComponent.prototype.ngOnChanges = function (changes) {
|
|
914
|
+
if (changes.rendering || changes.renderings) {
|
|
915
|
+
this._render();
|
|
916
|
+
}
|
|
917
|
+
};
|
|
918
|
+
PlaceholderComponent.prototype.ngDoCheck = function () {
|
|
919
|
+
var _this = this;
|
|
920
|
+
if (!this._differ || !this._inputs || this._componentInstances.length === 0) {
|
|
921
|
+
return;
|
|
922
|
+
}
|
|
923
|
+
var changes = this._differ.diff(this._inputs);
|
|
924
|
+
if (!changes) {
|
|
925
|
+
return;
|
|
926
|
+
}
|
|
927
|
+
var updates = {};
|
|
928
|
+
changes.forEachRemovedItem(function (change) { return (updates[change.key] = null); });
|
|
929
|
+
changes.forEachAddedItem(function (change) { return (updates[change.key] = change.currentValue); });
|
|
930
|
+
changes.forEachChangedItem(function (change) { return (updates[change.key] = change.currentValue); });
|
|
931
|
+
this._componentInstances.forEach(function (componentInstance) { return _this._setComponentInputs(componentInstance, updates); });
|
|
932
|
+
};
|
|
933
|
+
PlaceholderComponent.prototype._setComponentInputs = function (componentInstance, inputs) {
|
|
934
|
+
Object.entries(inputs).forEach(function (_a) {
|
|
935
|
+
var _b = __read(_a, 2), input = _b[0], inputValue = _b[1];
|
|
936
|
+
return (componentInstance[input] = inputValue);
|
|
937
|
+
});
|
|
938
|
+
};
|
|
939
|
+
PlaceholderComponent.prototype._subscribeComponentOutputs = function (componentInstance, outputs) {
|
|
940
|
+
var _this = this;
|
|
941
|
+
Object.keys(outputs)
|
|
942
|
+
.filter(function (output) { return componentInstance[output] && componentInstance[output] instanceof rxjs.Observable; })
|
|
943
|
+
.forEach(function (output) { return componentInstance[output]
|
|
944
|
+
.pipe(operators.takeWhile(function () { return !_this.destroyed; }))
|
|
945
|
+
.subscribe(outputs[output]); });
|
|
946
|
+
};
|
|
947
|
+
PlaceholderComponent.prototype._render = function () {
|
|
948
|
+
var _this = this;
|
|
949
|
+
this._componentInstances = [];
|
|
950
|
+
this.view.clear();
|
|
951
|
+
if (!this.rendering && !this.renderings) {
|
|
952
|
+
return;
|
|
953
|
+
}
|
|
954
|
+
if (!this.name && !this.renderings) {
|
|
955
|
+
console.warn('Placeholder name was not specified, and explicit renderings array was not passed. Placeholder requires either name and rendering, or renderings.');
|
|
956
|
+
this.isLoading = false;
|
|
957
|
+
return;
|
|
958
|
+
}
|
|
959
|
+
var placeholder = this.renderings || getPlaceholder(this.rendering, this.name || '');
|
|
960
|
+
if (!placeholder) {
|
|
961
|
+
console.warn("Placeholder '" + this.name + "' was not found in the current rendering data", JSON.stringify(this.rendering, null, 2));
|
|
962
|
+
this.isLoading = false;
|
|
963
|
+
return;
|
|
964
|
+
}
|
|
965
|
+
// if the placeholder is empty (contains only raw renderings), then we may need to use the empty template if it's defined
|
|
966
|
+
var placeholderIsEmpty = placeholder.every(function (rendering) { return isRawRendering(rendering); });
|
|
967
|
+
if (this.renderEmptyTemplate && placeholderIsEmpty) {
|
|
968
|
+
this.view.createEmbeddedView(this.renderEmptyTemplate.templateRef, {
|
|
969
|
+
renderings: placeholder,
|
|
970
|
+
});
|
|
971
|
+
this.isLoading = false;
|
|
972
|
+
}
|
|
973
|
+
else {
|
|
974
|
+
this.componentFactory
|
|
975
|
+
.getComponents(placeholder)
|
|
976
|
+
.then(function (components) { return components.forEach(function (rendering, index) {
|
|
977
|
+
if (_this.renderEachTemplate && !isRawRendering(rendering.componentDefinition)) {
|
|
978
|
+
_this._renderTemplatedComponent(rendering.componentDefinition, index);
|
|
979
|
+
}
|
|
980
|
+
else {
|
|
981
|
+
_this._renderEmbeddedComponent(rendering, index);
|
|
982
|
+
}
|
|
983
|
+
_this.isLoading = false;
|
|
984
|
+
}); })
|
|
985
|
+
.then(function () {
|
|
986
|
+
_this.changeDetectorRef.markForCheck();
|
|
987
|
+
_this.loaded.emit(_this.name);
|
|
988
|
+
});
|
|
989
|
+
}
|
|
990
|
+
};
|
|
991
|
+
PlaceholderComponent.prototype._renderTemplatedComponent = function (rendering, index) {
|
|
992
|
+
// the render-each template takes care of all component mapping etc
|
|
993
|
+
// generally using <sc-render-component> which is about like _renderEmbeddedComponent()
|
|
994
|
+
// as a separate component
|
|
995
|
+
this.view.createEmbeddedView(this.renderEachTemplate.templateRef, {
|
|
996
|
+
rendering: rendering,
|
|
997
|
+
index: index,
|
|
998
|
+
});
|
|
999
|
+
};
|
|
1000
|
+
PlaceholderComponent.prototype._renderEmbeddedComponent = function (rendering, index) {
|
|
1001
|
+
if (!rendering.componentImplementation) {
|
|
1002
|
+
var componentName = rendering.componentDefinition.componentName;
|
|
1003
|
+
console.error("Placeholder " + this.name + " contains unknown component " + componentName + ".", "Ensure component is mapped, like:\n JssModule.withComponents([\n { name: '" + componentName + "', type: " + componentName + "Component }\n ])");
|
|
1004
|
+
rendering.componentImplementation = this.missingComponentComponent;
|
|
1005
|
+
}
|
|
1006
|
+
var componentFactory = rendering.componentFactory ||
|
|
1007
|
+
this.componentFactoryResolver.resolveComponentFactory(rendering.componentImplementation);
|
|
1008
|
+
// apply the parent style attribute _ngcontent
|
|
1009
|
+
// work-around for https://github.com/angular/angular/issues/12215
|
|
1010
|
+
var createdComponentRef = this.view.createComponent(componentFactory, index);
|
|
1011
|
+
if (this.parentStyleAttribute) {
|
|
1012
|
+
this.renderer.setAttribute(createdComponentRef.location.nativeElement, this.parentStyleAttribute, '');
|
|
1013
|
+
}
|
|
1014
|
+
var componentInstance = createdComponentRef.instance;
|
|
1015
|
+
componentInstance.rendering = rendering.componentDefinition;
|
|
1016
|
+
if (this._inputs) {
|
|
1017
|
+
this._setComponentInputs(componentInstance, this._inputs);
|
|
1018
|
+
}
|
|
1019
|
+
if (this.outputs) {
|
|
1020
|
+
this._subscribeComponentOutputs(componentInstance, this.outputs);
|
|
1021
|
+
}
|
|
1022
|
+
this._componentInstances.push(componentInstance);
|
|
1023
|
+
};
|
|
1024
|
+
return PlaceholderComponent;
|
|
1025
|
+
}());
|
|
1026
|
+
PlaceholderComponent.decorators = [
|
|
1027
|
+
{ type: core.Component, args: [{
|
|
1028
|
+
selector: 'sc-placeholder,[sc-placeholder]',
|
|
1029
|
+
template: "\n <ng-template\n *ngIf=\"isLoading\"\n [ngTemplateOutlet]=\"placeholderLoading?.templateRef\"\n ></ng-template>\n <ng-template #view></ng-template>\n "
|
|
1030
|
+
},] }
|
|
1031
|
+
];
|
|
1032
|
+
PlaceholderComponent.ctorParameters = function () { return [
|
|
1033
|
+
{ type: core.ComponentFactoryResolver },
|
|
1034
|
+
{ type: core.KeyValueDiffers },
|
|
1035
|
+
{ type: JssComponentFactoryService },
|
|
1036
|
+
{ type: core.ChangeDetectorRef },
|
|
1037
|
+
{ type: core.ElementRef },
|
|
1038
|
+
{ type: core.Renderer2 },
|
|
1039
|
+
{ type: core.Type, decorators: [{ type: core.Inject, args: [PLACEHOLDER_MISSING_COMPONENT_COMPONENT,] }] }
|
|
1040
|
+
]; };
|
|
1041
|
+
PlaceholderComponent.propDecorators = {
|
|
1042
|
+
name: [{ type: core.Input }],
|
|
1043
|
+
rendering: [{ type: core.Input }],
|
|
1044
|
+
renderings: [{ type: core.Input }],
|
|
1045
|
+
outputs: [{ type: core.Input }],
|
|
1046
|
+
loaded: [{ type: core.Output }],
|
|
1047
|
+
view: [{ type: core.ViewChild, args: ['view', { read: core.ViewContainerRef, static: true },] }],
|
|
1048
|
+
renderEachTemplate: [{ type: core.ContentChild, args: [RenderEachDirective, { static: true },] }],
|
|
1049
|
+
renderEmptyTemplate: [{ type: core.ContentChild, args: [RenderEmptyDirective, { static: true },] }],
|
|
1050
|
+
placeholderLoading: [{ type: core.ContentChild, args: [PlaceholderLoadingDirective, { static: true },] }],
|
|
1051
|
+
inputs: [{ type: core.Input }]
|
|
1053
1052
|
};
|
|
1054
1053
|
|
|
1055
|
-
var RichTextDirective = /** @class */ (function () {
|
|
1056
|
-
function RichTextDirective(viewContainer, templateRef) {
|
|
1057
|
-
this.viewContainer = viewContainer;
|
|
1058
|
-
this.templateRef = templateRef;
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
this.viewContainer.
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
{ type: core.
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
field: [{ type: core.Input, args: ['scRichText',] }]
|
|
1054
|
+
var RichTextDirective = /** @class */ (function () {
|
|
1055
|
+
function RichTextDirective(viewContainer, templateRef) {
|
|
1056
|
+
this.viewContainer = viewContainer;
|
|
1057
|
+
this.templateRef = templateRef;
|
|
1058
|
+
this.editable = true;
|
|
1059
|
+
}
|
|
1060
|
+
RichTextDirective.prototype.ngOnChanges = function (changes) {
|
|
1061
|
+
if (changes.field || changes.editable) {
|
|
1062
|
+
if (!this.viewRef) {
|
|
1063
|
+
this.viewContainer.clear();
|
|
1064
|
+
this.viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
|
|
1065
|
+
}
|
|
1066
|
+
this.updateView();
|
|
1067
|
+
}
|
|
1068
|
+
};
|
|
1069
|
+
RichTextDirective.prototype.updateView = function () {
|
|
1070
|
+
var field = this.field;
|
|
1071
|
+
if (!field || (!field.editable && !field.value)) {
|
|
1072
|
+
return;
|
|
1073
|
+
}
|
|
1074
|
+
var html = field.editable && this.editable ? field.editable : field.value;
|
|
1075
|
+
this.viewRef.rootNodes.forEach(function (node) {
|
|
1076
|
+
node.innerHTML = html;
|
|
1077
|
+
});
|
|
1078
|
+
};
|
|
1079
|
+
return RichTextDirective;
|
|
1080
|
+
}());
|
|
1081
|
+
RichTextDirective.decorators = [
|
|
1082
|
+
{ type: core.Directive, args: [{
|
|
1083
|
+
selector: '[scRichText]',
|
|
1084
|
+
},] }
|
|
1085
|
+
];
|
|
1086
|
+
RichTextDirective.ctorParameters = function () { return [
|
|
1087
|
+
{ type: core.ViewContainerRef },
|
|
1088
|
+
{ type: core.TemplateRef }
|
|
1089
|
+
]; };
|
|
1090
|
+
RichTextDirective.propDecorators = {
|
|
1091
|
+
editable: [{ type: core.Input, args: ['scRichTextEditable',] }],
|
|
1092
|
+
field: [{ type: core.Input, args: ['scRichText',] }]
|
|
1095
1093
|
};
|
|
1096
1094
|
|
|
1097
|
-
var TextDirective = /** @class */ (function () {
|
|
1098
|
-
function TextDirective(viewContainer, templateRef) {
|
|
1099
|
-
this.viewContainer = viewContainer;
|
|
1100
|
-
this.templateRef = templateRef;
|
|
1101
|
-
|
|
1102
|
-
this.
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
encode: [{ type: core.Input, args: ['scTextEncode',] }],
|
|
1150
|
-
field: [{ type: core.Input, args: ['scText',] }]
|
|
1095
|
+
var TextDirective = /** @class */ (function () {
|
|
1096
|
+
function TextDirective(viewContainer, templateRef) {
|
|
1097
|
+
this.viewContainer = viewContainer;
|
|
1098
|
+
this.templateRef = templateRef;
|
|
1099
|
+
this.editable = true;
|
|
1100
|
+
this.encode = true;
|
|
1101
|
+
}
|
|
1102
|
+
TextDirective.prototype.ngOnChanges = function (changes) {
|
|
1103
|
+
if (changes.field || changes.editable || changes.encode) {
|
|
1104
|
+
if (!this.viewRef) {
|
|
1105
|
+
this.viewContainer.clear();
|
|
1106
|
+
this.viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
|
|
1107
|
+
}
|
|
1108
|
+
this.updateView();
|
|
1109
|
+
}
|
|
1110
|
+
};
|
|
1111
|
+
TextDirective.prototype.updateView = function () {
|
|
1112
|
+
var field = this.field;
|
|
1113
|
+
var editable = this.editable;
|
|
1114
|
+
if (!field || (!field.editable && !field.value)) {
|
|
1115
|
+
return;
|
|
1116
|
+
}
|
|
1117
|
+
// can't use editable value if we want to output unencoded
|
|
1118
|
+
if (!this.encode) {
|
|
1119
|
+
editable = false;
|
|
1120
|
+
}
|
|
1121
|
+
var html = field.editable && editable ? field.editable : field.value;
|
|
1122
|
+
var setDangerously = (field.editable && editable) || !this.encode;
|
|
1123
|
+
this.viewRef.rootNodes.forEach(function (node) {
|
|
1124
|
+
if (setDangerously) {
|
|
1125
|
+
node.innerHTML = html;
|
|
1126
|
+
}
|
|
1127
|
+
else {
|
|
1128
|
+
node.textContent = html;
|
|
1129
|
+
}
|
|
1130
|
+
});
|
|
1131
|
+
};
|
|
1132
|
+
return TextDirective;
|
|
1133
|
+
}());
|
|
1134
|
+
TextDirective.decorators = [
|
|
1135
|
+
{ type: core.Directive, args: [{
|
|
1136
|
+
selector: '[scText]',
|
|
1137
|
+
},] }
|
|
1138
|
+
];
|
|
1139
|
+
TextDirective.ctorParameters = function () { return [
|
|
1140
|
+
{ type: core.ViewContainerRef },
|
|
1141
|
+
{ type: core.TemplateRef }
|
|
1142
|
+
]; };
|
|
1143
|
+
TextDirective.propDecorators = {
|
|
1144
|
+
editable: [{ type: core.Input, args: ['scTextEditable',] }],
|
|
1145
|
+
encode: [{ type: core.Input, args: ['scTextEncode',] }],
|
|
1146
|
+
field: [{ type: core.Input, args: ['scText',] }]
|
|
1151
1147
|
};
|
|
1152
1148
|
|
|
1153
|
-
var LayoutServiceError = /** @class */ (function () {
|
|
1154
|
-
function LayoutServiceError() {
|
|
1155
|
-
}
|
|
1156
|
-
return LayoutServiceError;
|
|
1149
|
+
var LayoutServiceError = /** @class */ (function () {
|
|
1150
|
+
function LayoutServiceError() {
|
|
1151
|
+
}
|
|
1152
|
+
return LayoutServiceError;
|
|
1157
1153
|
}());
|
|
1158
1154
|
|
|
1159
|
-
var fetchRouteData = sitecoreJss.dataApi.fetchRouteData, fetchPlaceholderData = sitecoreJss.dataApi.fetchPlaceholderData;
|
|
1160
|
-
var LayoutService = /** @class */ (function () {
|
|
1161
|
-
function LayoutService() {
|
|
1162
|
-
}
|
|
1163
|
-
LayoutService.getLayoutServiceError = function (error) {
|
|
1164
|
-
var layoutServiceError = new LayoutServiceError();
|
|
1165
|
-
var response = error.response;
|
|
1166
|
-
if (response) {
|
|
1167
|
-
layoutServiceError.status = response.status;
|
|
1168
|
-
layoutServiceError.statusText = response.statusText;
|
|
1169
|
-
layoutServiceError.data = response.data;
|
|
1170
|
-
}
|
|
1171
|
-
return rxjs.throwError(layoutServiceError);
|
|
1172
|
-
};
|
|
1173
|
-
LayoutService.prototype.getRouteData = function (route, options) {
|
|
1174
|
-
return rxjs.from(fetchRouteData(route, options))
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
LayoutService.decorators = [
|
|
1184
|
-
{ type: core.Injectable }
|
|
1155
|
+
var fetchRouteData = sitecoreJss.dataApi.fetchRouteData, fetchPlaceholderData = sitecoreJss.dataApi.fetchPlaceholderData;
|
|
1156
|
+
var LayoutService = /** @class */ (function () {
|
|
1157
|
+
function LayoutService() {
|
|
1158
|
+
}
|
|
1159
|
+
LayoutService.getLayoutServiceError = function (error) {
|
|
1160
|
+
var layoutServiceError = new LayoutServiceError();
|
|
1161
|
+
var response = error.response;
|
|
1162
|
+
if (response) {
|
|
1163
|
+
layoutServiceError.status = response.status;
|
|
1164
|
+
layoutServiceError.statusText = response.statusText;
|
|
1165
|
+
layoutServiceError.data = response.data;
|
|
1166
|
+
}
|
|
1167
|
+
return rxjs.throwError(layoutServiceError);
|
|
1168
|
+
};
|
|
1169
|
+
LayoutService.prototype.getRouteData = function (route, options) {
|
|
1170
|
+
return rxjs.from(fetchRouteData(route, options)).pipe(operators.catchError(LayoutService.getLayoutServiceError));
|
|
1171
|
+
};
|
|
1172
|
+
LayoutService.prototype.getPlaceholderData = function (route, placeholderName, options) {
|
|
1173
|
+
return rxjs.from(fetchPlaceholderData(placeholderName, route, options)).pipe(operators.catchError(LayoutService.getLayoutServiceError));
|
|
1174
|
+
};
|
|
1175
|
+
return LayoutService;
|
|
1176
|
+
}());
|
|
1177
|
+
LayoutService.decorators = [
|
|
1178
|
+
{ type: core.Injectable }
|
|
1185
1179
|
];
|
|
1186
1180
|
|
|
1187
|
-
var DateDirective = /** @class */ (function () {
|
|
1188
|
-
function DateDirective(viewContainer, templateRef, datePipe) {
|
|
1189
|
-
this.viewContainer = viewContainer;
|
|
1190
|
-
this.templateRef = templateRef;
|
|
1191
|
-
this.datePipe = datePipe;
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
this.viewContainer.
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
var
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
var
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
{ type: core.
|
|
1230
|
-
{ type:
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
field: [{ type: core.Input, args: ['scDate',] }]
|
|
1181
|
+
var DateDirective = /** @class */ (function () {
|
|
1182
|
+
function DateDirective(viewContainer, templateRef, datePipe) {
|
|
1183
|
+
this.viewContainer = viewContainer;
|
|
1184
|
+
this.templateRef = templateRef;
|
|
1185
|
+
this.datePipe = datePipe;
|
|
1186
|
+
this.editable = true;
|
|
1187
|
+
}
|
|
1188
|
+
DateDirective.prototype.ngOnChanges = function (changes) {
|
|
1189
|
+
if (changes.field || changes.format) {
|
|
1190
|
+
if (!this.viewRef) {
|
|
1191
|
+
this.viewContainer.clear();
|
|
1192
|
+
this.viewRef = this.viewContainer.createEmbeddedView(this.templateRef);
|
|
1193
|
+
}
|
|
1194
|
+
this.updateView();
|
|
1195
|
+
}
|
|
1196
|
+
};
|
|
1197
|
+
DateDirective.prototype.updateView = function () {
|
|
1198
|
+
var _this = this;
|
|
1199
|
+
var field = this.field;
|
|
1200
|
+
if (!field || (!field.editable && !field.value)) {
|
|
1201
|
+
return;
|
|
1202
|
+
}
|
|
1203
|
+
var html = field.editable && this.editable ? field.editable : field.value;
|
|
1204
|
+
var setDangerously = field.editable && this.editable;
|
|
1205
|
+
this.viewRef.rootNodes.forEach(function (node) {
|
|
1206
|
+
if (setDangerously) {
|
|
1207
|
+
node.innerHTML = html;
|
|
1208
|
+
}
|
|
1209
|
+
else {
|
|
1210
|
+
node.textContent = _this.datePipe.transform(html, _this.format, _this.timezone, _this.locale);
|
|
1211
|
+
}
|
|
1212
|
+
});
|
|
1213
|
+
};
|
|
1214
|
+
return DateDirective;
|
|
1215
|
+
}());
|
|
1216
|
+
DateDirective.decorators = [
|
|
1217
|
+
{ type: core.Directive, args: [{
|
|
1218
|
+
selector: '[scDate]',
|
|
1219
|
+
},] }
|
|
1220
|
+
];
|
|
1221
|
+
DateDirective.ctorParameters = function () { return [
|
|
1222
|
+
{ type: core.ViewContainerRef },
|
|
1223
|
+
{ type: core.TemplateRef },
|
|
1224
|
+
{ type: common.DatePipe }
|
|
1225
|
+
]; };
|
|
1226
|
+
DateDirective.propDecorators = {
|
|
1227
|
+
format: [{ type: core.Input, args: ['scDateFormat',] }],
|
|
1228
|
+
timezone: [{ type: core.Input, args: ['scDateTimezone',] }],
|
|
1229
|
+
locale: [{ type: core.Input, args: ['scDateLocale',] }],
|
|
1230
|
+
editable: [{ type: core.Input, args: ['scDateEditable',] }],
|
|
1231
|
+
field: [{ type: core.Input, args: ['scDate',] }]
|
|
1239
1232
|
};
|
|
1240
1233
|
|
|
1241
|
-
var MissingComponentComponent = /** @class */ (function () {
|
|
1242
|
-
function MissingComponentComponent() {
|
|
1243
|
-
}
|
|
1244
|
-
return MissingComponentComponent;
|
|
1245
|
-
}());
|
|
1246
|
-
MissingComponentComponent.decorators = [
|
|
1247
|
-
{ type: core.Component, args: [{
|
|
1248
|
-
selector: 'sc-missing-component',
|
|
1249
|
-
template: "\n<div
|
|
1250
|
-
},] }
|
|
1251
|
-
];
|
|
1252
|
-
MissingComponentComponent.propDecorators = {
|
|
1253
|
-
rendering: [{ type: core.Input }]
|
|
1234
|
+
var MissingComponentComponent = /** @class */ (function () {
|
|
1235
|
+
function MissingComponentComponent() {
|
|
1236
|
+
}
|
|
1237
|
+
return MissingComponentComponent;
|
|
1238
|
+
}());
|
|
1239
|
+
MissingComponentComponent.decorators = [
|
|
1240
|
+
{ type: core.Component, args: [{
|
|
1241
|
+
selector: 'sc-missing-component',
|
|
1242
|
+
template: "\n <div\n style=\"background: darkorange; outline: 5px solid orange; padding: 10px; color: white; max-width: 500px;\"\n >\n <h2>{{ rendering.componentName }}</h2>\n <p>JSS component is missing Angular component implementation.</p>\n </div>\n "
|
|
1243
|
+
},] }
|
|
1244
|
+
];
|
|
1245
|
+
MissingComponentComponent.propDecorators = {
|
|
1246
|
+
rendering: [{ type: core.Input }]
|
|
1254
1247
|
};
|
|
1255
1248
|
|
|
1256
|
-
/**
|
|
1257
|
-
* Renders a single JSS component given a rendering definition.
|
|
1258
|
-
* Useful inside templated placeholders.
|
|
1259
|
-
*/
|
|
1260
|
-
var RenderComponentComponent = /** @class */ (function () {
|
|
1261
|
-
function RenderComponentComponent(componentFactoryResolver, differs, componentFactory, missingComponentComponent) {
|
|
1262
|
-
this.componentFactoryResolver = componentFactoryResolver;
|
|
1263
|
-
this.differs = differs;
|
|
1264
|
-
this.componentFactory = componentFactory;
|
|
1265
|
-
this.missingComponentComponent = missingComponentComponent;
|
|
1266
|
-
this.destroyed = false;
|
|
1267
|
-
}
|
|
1268
|
-
Object.defineProperty(RenderComponentComponent.prototype, "inputs", {
|
|
1269
|
-
set: function (value) {
|
|
1270
|
-
this._inputs = value;
|
|
1271
|
-
if (!this._differ && value) {
|
|
1272
|
-
this._differ = this.differs.find(value).create();
|
|
1273
|
-
}
|
|
1274
|
-
},
|
|
1275
|
-
enumerable: false,
|
|
1276
|
-
configurable: true
|
|
1277
|
-
});
|
|
1278
|
-
RenderComponentComponent.prototype.ngOnChanges = function (changes) {
|
|
1279
|
-
if (changes
|
|
1280
|
-
this._render();
|
|
1281
|
-
}
|
|
1282
|
-
};
|
|
1283
|
-
RenderComponentComponent.prototype._setComponentInputs = function (componentInstance, inputs) {
|
|
1284
|
-
Object.entries(inputs).forEach(function (_a) {
|
|
1285
|
-
var _b = __read(_a, 2), input = _b[0], inputValue = _b[1];
|
|
1286
|
-
return componentInstance[input] = inputValue;
|
|
1287
|
-
});
|
|
1288
|
-
};
|
|
1289
|
-
RenderComponentComponent.prototype._subscribeComponentOutputs = function (componentInstance, outputs) {
|
|
1290
|
-
var _this = this;
|
|
1291
|
-
Object.keys(outputs)
|
|
1292
|
-
.filter(function (output) { return componentInstance[output] && componentInstance[output] instanceof rxjs.Observable; })
|
|
1293
|
-
.forEach(function (output) { return componentInstance[output]
|
|
1294
|
-
.pipe(operators.takeWhile(function () { return !_this.destroyed; }))
|
|
1295
|
-
.subscribe(outputs[output]); });
|
|
1296
|
-
};
|
|
1297
|
-
RenderComponentComponent.prototype._render = function () {
|
|
1298
|
-
var _this = this;
|
|
1299
|
-
this.view.clear();
|
|
1300
|
-
if (!this.rendering) {
|
|
1301
|
-
return;
|
|
1302
|
-
}
|
|
1303
|
-
var resolveComponent = isRawRendering(this.rendering)
|
|
1304
|
-
? Promise.resolve({
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
_this.
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1249
|
+
/**
|
|
1250
|
+
* Renders a single JSS component given a rendering definition.
|
|
1251
|
+
* Useful inside templated placeholders.
|
|
1252
|
+
*/
|
|
1253
|
+
var RenderComponentComponent = /** @class */ (function () {
|
|
1254
|
+
function RenderComponentComponent(componentFactoryResolver, differs, componentFactory, missingComponentComponent) {
|
|
1255
|
+
this.componentFactoryResolver = componentFactoryResolver;
|
|
1256
|
+
this.differs = differs;
|
|
1257
|
+
this.componentFactory = componentFactory;
|
|
1258
|
+
this.missingComponentComponent = missingComponentComponent;
|
|
1259
|
+
this.destroyed = false;
|
|
1260
|
+
}
|
|
1261
|
+
Object.defineProperty(RenderComponentComponent.prototype, "inputs", {
|
|
1262
|
+
set: function (value) {
|
|
1263
|
+
this._inputs = value;
|
|
1264
|
+
if (!this._differ && value) {
|
|
1265
|
+
this._differ = this.differs.find(value).create();
|
|
1266
|
+
}
|
|
1267
|
+
},
|
|
1268
|
+
enumerable: false,
|
|
1269
|
+
configurable: true
|
|
1270
|
+
});
|
|
1271
|
+
RenderComponentComponent.prototype.ngOnChanges = function (changes) {
|
|
1272
|
+
if (changes.rendering) {
|
|
1273
|
+
this._render();
|
|
1274
|
+
}
|
|
1275
|
+
};
|
|
1276
|
+
RenderComponentComponent.prototype._setComponentInputs = function (componentInstance, inputs) {
|
|
1277
|
+
Object.entries(inputs).forEach(function (_a) {
|
|
1278
|
+
var _b = __read(_a, 2), input = _b[0], inputValue = _b[1];
|
|
1279
|
+
return (componentInstance[input] = inputValue);
|
|
1280
|
+
});
|
|
1281
|
+
};
|
|
1282
|
+
RenderComponentComponent.prototype._subscribeComponentOutputs = function (componentInstance, outputs) {
|
|
1283
|
+
var _this = this;
|
|
1284
|
+
Object.keys(outputs)
|
|
1285
|
+
.filter(function (output) { return componentInstance[output] && componentInstance[output] instanceof rxjs.Observable; })
|
|
1286
|
+
.forEach(function (output) { return componentInstance[output]
|
|
1287
|
+
.pipe(operators.takeWhile(function () { return !_this.destroyed; }))
|
|
1288
|
+
.subscribe(outputs[output]); });
|
|
1289
|
+
};
|
|
1290
|
+
RenderComponentComponent.prototype._render = function () {
|
|
1291
|
+
var _this = this;
|
|
1292
|
+
this.view.clear();
|
|
1293
|
+
if (!this.rendering) {
|
|
1294
|
+
return;
|
|
1295
|
+
}
|
|
1296
|
+
var resolveComponent = isRawRendering(this.rendering)
|
|
1297
|
+
? Promise.resolve({
|
|
1298
|
+
componentImplementation: RawComponent,
|
|
1299
|
+
componentDefinition: this.rendering,
|
|
1300
|
+
})
|
|
1301
|
+
: this.componentFactory.getComponent(this.rendering);
|
|
1302
|
+
resolveComponent.then(function (rendering) {
|
|
1303
|
+
if (!rendering.componentImplementation) {
|
|
1304
|
+
var componentName = rendering.componentDefinition.componentName;
|
|
1305
|
+
console.error("Attempted to render unknown component " + componentName + ".", "Ensure component is mapped, like:\n JssModule.withComponents([\n { name: '" + componentName + "', type: " + componentName + "Component }\n ])");
|
|
1306
|
+
rendering.componentImplementation = _this.missingComponentComponent;
|
|
1307
|
+
}
|
|
1308
|
+
var componentFactory = rendering.componentFactory ||
|
|
1309
|
+
_this.componentFactoryResolver.resolveComponentFactory(rendering.componentImplementation);
|
|
1310
|
+
var componentInstance = _this.view.createComponent(componentFactory, 0).instance;
|
|
1311
|
+
componentInstance.rendering = rendering.componentDefinition;
|
|
1312
|
+
if (_this._inputs) {
|
|
1313
|
+
_this._setComponentInputs(componentInstance, _this._inputs);
|
|
1314
|
+
}
|
|
1315
|
+
if (_this.outputs) {
|
|
1316
|
+
_this._subscribeComponentOutputs(componentInstance, _this.outputs);
|
|
1317
|
+
}
|
|
1318
|
+
});
|
|
1319
|
+
};
|
|
1320
|
+
return RenderComponentComponent;
|
|
1321
|
+
}());
|
|
1322
|
+
RenderComponentComponent.decorators = [
|
|
1323
|
+
{ type: core.Component, args: [{
|
|
1324
|
+
selector: 'sc-render-component',
|
|
1325
|
+
template: "\n <ng-template #view></ng-template>\n "
|
|
1326
|
+
},] }
|
|
1327
|
+
];
|
|
1328
|
+
RenderComponentComponent.ctorParameters = function () { return [
|
|
1329
|
+
{ type: core.ComponentFactoryResolver },
|
|
1330
|
+
{ type: core.KeyValueDiffers },
|
|
1331
|
+
{ type: JssComponentFactoryService },
|
|
1332
|
+
{ type: core.Type, decorators: [{ type: core.Inject, args: [PLACEHOLDER_MISSING_COMPONENT_COMPONENT,] }] }
|
|
1333
|
+
]; };
|
|
1334
|
+
RenderComponentComponent.propDecorators = {
|
|
1335
|
+
rendering: [{ type: core.Input }],
|
|
1336
|
+
outputs: [{ type: core.Input }],
|
|
1337
|
+
view: [{ type: core.ViewChild, args: ['view', { read: core.ViewContainerRef, static: true },] }],
|
|
1338
|
+
inputs: [{ type: core.Input }]
|
|
1342
1339
|
};
|
|
1343
1340
|
|
|
1344
|
-
var JssModule = /** @class */ (function () {
|
|
1345
|
-
function JssModule() {
|
|
1346
|
-
}
|
|
1347
|
-
/**
|
|
1348
|
-
* Instantiates the JSS module with no component factory.
|
|
1349
|
-
* Useful for using it from libraries. Most of the time you'd want withComponents()
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
{ provide:
|
|
1368
|
-
{ provide:
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
*
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
},] }
|
|
1341
|
+
var JssModule = /** @class */ (function () {
|
|
1342
|
+
function JssModule() {
|
|
1343
|
+
}
|
|
1344
|
+
/**
|
|
1345
|
+
* Instantiates the JSS module with no component factory.
|
|
1346
|
+
* Useful for using it from libraries. Most of the time you'd want withComponents()
|
|
1347
|
+
* @returns {ModuleWithProviders<JssModule>} module
|
|
1348
|
+
*/
|
|
1349
|
+
JssModule.forRoot = function () {
|
|
1350
|
+
return {
|
|
1351
|
+
ngModule: JssModule,
|
|
1352
|
+
providers: [LayoutService, common.DatePipe, JssComponentFactoryService],
|
|
1353
|
+
};
|
|
1354
|
+
};
|
|
1355
|
+
/**
|
|
1356
|
+
* Instantiates a module for a lazy-loaded JSS component
|
|
1357
|
+
* @param {Type<any>} component
|
|
1358
|
+
* @returns {ModuleWithProviders<JssModule>} module
|
|
1359
|
+
*/
|
|
1360
|
+
JssModule.forChild = function (component) {
|
|
1361
|
+
return {
|
|
1362
|
+
ngModule: JssModule,
|
|
1363
|
+
providers: [
|
|
1364
|
+
{ provide: core.ANALYZE_FOR_ENTRY_COMPONENTS, useValue: component, multi: true },
|
|
1365
|
+
{ provide: router.ROUTES, useValue: [], multi: true },
|
|
1366
|
+
{ provide: DYNAMIC_COMPONENT, useValue: component },
|
|
1367
|
+
],
|
|
1368
|
+
};
|
|
1369
|
+
};
|
|
1370
|
+
/**
|
|
1371
|
+
* Instantiates the JSS module and specifies the mapping from component name to component implementation.
|
|
1372
|
+
* Appropriate when defining the set of JSS components that your app is aware of.
|
|
1373
|
+
* @param {ComponentNameAndType[]} components
|
|
1374
|
+
* @param {ComponentNameAndModule[]} [lazyComponents]
|
|
1375
|
+
* @returns {ModuleWithProviders<JssModule>} module
|
|
1376
|
+
*/
|
|
1377
|
+
JssModule.withComponents = function (components, lazyComponents) {
|
|
1378
|
+
return {
|
|
1379
|
+
ngModule: JssModule,
|
|
1380
|
+
providers: __spread([
|
|
1381
|
+
{
|
|
1382
|
+
provide: core.ANALYZE_FOR_ENTRY_COMPONENTS,
|
|
1383
|
+
useValue: components,
|
|
1384
|
+
multi: true,
|
|
1385
|
+
},
|
|
1386
|
+
{ provide: PLACEHOLDER_COMPONENTS, useValue: components },
|
|
1387
|
+
{ provide: PLACEHOLDER_LAZY_COMPONENTS, useValue: lazyComponents || [] },
|
|
1388
|
+
{ provide: router.ROUTES, useValue: lazyComponents || [], multi: true },
|
|
1389
|
+
{ provide: PLACEHOLDER_MISSING_COMPONENT_COMPONENT, useValue: MissingComponentComponent }
|
|
1390
|
+
], JssModule.forRoot().providers),
|
|
1391
|
+
};
|
|
1392
|
+
};
|
|
1393
|
+
return JssModule;
|
|
1394
|
+
}());
|
|
1395
|
+
JssModule.decorators = [
|
|
1396
|
+
{ type: core.NgModule, args: [{
|
|
1397
|
+
imports: [common.CommonModule],
|
|
1398
|
+
declarations: [
|
|
1399
|
+
FileDirective,
|
|
1400
|
+
ImageDirective,
|
|
1401
|
+
LinkDirective,
|
|
1402
|
+
RouterLinkDirective,
|
|
1403
|
+
GenericLinkDirective,
|
|
1404
|
+
DateDirective,
|
|
1405
|
+
RenderEachDirective,
|
|
1406
|
+
RenderEmptyDirective,
|
|
1407
|
+
PlaceholderLoadingDirective,
|
|
1408
|
+
RenderComponentComponent,
|
|
1409
|
+
PlaceholderComponent,
|
|
1410
|
+
RawComponent,
|
|
1411
|
+
RichTextDirective,
|
|
1412
|
+
TextDirective,
|
|
1413
|
+
MissingComponentComponent,
|
|
1414
|
+
],
|
|
1415
|
+
exports: [
|
|
1416
|
+
FileDirective,
|
|
1417
|
+
ImageDirective,
|
|
1418
|
+
DateDirective,
|
|
1419
|
+
LinkDirective,
|
|
1420
|
+
RouterLinkDirective,
|
|
1421
|
+
GenericLinkDirective,
|
|
1422
|
+
RenderEachDirective,
|
|
1423
|
+
RenderEmptyDirective,
|
|
1424
|
+
RenderComponentComponent,
|
|
1425
|
+
PlaceholderComponent,
|
|
1426
|
+
PlaceholderLoadingDirective,
|
|
1427
|
+
RichTextDirective,
|
|
1428
|
+
TextDirective,
|
|
1429
|
+
],
|
|
1430
|
+
entryComponents: [RawComponent, MissingComponentComponent],
|
|
1431
|
+
},] }
|
|
1436
1432
|
];
|
|
1437
1433
|
|
|
1438
|
-
/**
|
|
1439
|
-
* Generated bundle index. Do not edit.
|
|
1434
|
+
/**
|
|
1435
|
+
* Generated bundle index. Do not edit.
|
|
1440
1436
|
*/
|
|
1441
1437
|
|
|
1442
1438
|
Object.defineProperty(exports, 'dataApi', {
|