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