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