@sitecore-jss/sitecore-jss-angular 21.0.0-canary.13 → 21.0.0-canary.130
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/dist/bundles/sitecore-jss-sitecore-jss-angular.umd.js +74 -55
- package/dist/bundles/sitecore-jss-sitecore-jss-angular.umd.js.map +1 -1
- package/dist/bundles/sitecore-jss-sitecore-jss-angular.umd.min.js +2 -2
- package/dist/bundles/sitecore-jss-sitecore-jss-angular.umd.min.js.map +1 -1
- package/dist/components/generic-link.directive.d.ts +0 -1
- package/dist/components/link.directive.d.ts +1 -0
- package/dist/components/rich-text.directive.d.ts +5 -2
- package/dist/esm2015/components/generic-link.directive.js +5 -13
- package/dist/esm2015/components/link.directive.js +24 -17
- package/dist/esm2015/components/rich-text.directive.js +26 -4
- package/dist/esm2015/components/router-link.directive.js +2 -2
- package/dist/esm2015/public_api.js +4 -3
- package/dist/fesm2015/sitecore-jss-sitecore-jss-angular.js +53 -33
- package/dist/fesm2015/sitecore-jss-sitecore-jss-angular.js.map +1 -1
- package/dist/package.json +14 -3
- package/dist/public_api.d.ts +3 -2
- package/dist/sitecore-jss-sitecore-jss-angular.metadata.json +1 -1
- package/karma.conf.js +69 -0
- package/ng-package.json +13 -0
- package/package.json +14 -3
- package/tsconfig.json +9 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@sitecore-jss/sitecore-jss/media'), require('@angular/router'), require('rxjs'), require('rxjs/operators'), require('@angular/common'), require('@sitecore-jss/sitecore-jss/i18n'), require('@sitecore-jss/sitecore-jss/layout'), require('@sitecore-jss/sitecore-jss'), require('@sitecore-jss/sitecore-jss/
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@sitecore-jss/sitecore-jss-angular', ['exports', '@angular/core', '@sitecore-jss/sitecore-jss/media', '@angular/router', 'rxjs', 'rxjs/operators', '@angular/common', '@sitecore-jss/sitecore-jss/i18n', '@sitecore-jss/sitecore-jss/layout', '@sitecore-jss/sitecore-jss', '@sitecore-jss/sitecore-jss/
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global["sitecore-jss"] = global["sitecore-jss"] || {}, global["sitecore-jss"]["sitecore-jss-angular"] = {}), global.ng.core, global.media, global.ng.router, global.rxjs, global.rxjs.operators, global.ng.common, global.i18n, global.layout, global["@sitecore-jss/sitecore-jss"], global.
|
|
5
|
-
})(this, (function (exports, core, media, router, rxjs, operators, common, i18n, layout, sitecoreJss,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@sitecore-jss/sitecore-jss/media'), require('@angular/router'), require('@sitecore-jss/sitecore-jss/utils'), require('rxjs'), require('rxjs/operators'), require('@angular/common'), require('@sitecore-jss/sitecore-jss/i18n'), require('@sitecore-jss/sitecore-jss/layout'), require('@sitecore-jss/sitecore-jss'), require('@sitecore-jss/sitecore-jss/tracking')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@sitecore-jss/sitecore-jss-angular', ['exports', '@angular/core', '@sitecore-jss/sitecore-jss/media', '@angular/router', '@sitecore-jss/sitecore-jss/utils', 'rxjs', 'rxjs/operators', '@angular/common', '@sitecore-jss/sitecore-jss/i18n', '@sitecore-jss/sitecore-jss/layout', '@sitecore-jss/sitecore-jss', '@sitecore-jss/sitecore-jss/tracking'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global["sitecore-jss"] = global["sitecore-jss"] || {}, global["sitecore-jss"]["sitecore-jss-angular"] = {}), global.ng.core, global.media, global.ng.router, global.utils, global.rxjs, global.rxjs.operators, global.ng.common, global.i18n, global.layout, global["@sitecore-jss/sitecore-jss"], global.tracking));
|
|
5
|
+
})(this, (function (exports, core, media, router, utils, rxjs, operators, common, i18n, layout, sitecoreJss, tracking) { 'use strict';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* File fields cannot be managed via the EE. We never output "editable."
|
|
@@ -534,21 +534,7 @@
|
|
|
534
534
|
viewRef.rootNodes.forEach(function (node) {
|
|
535
535
|
Object.entries(props).forEach(function (_c) {
|
|
536
536
|
var _d = __read(_c, 2), key = _d[0], propValue = _d[1];
|
|
537
|
-
|
|
538
|
-
return;
|
|
539
|
-
if (key === 'href') {
|
|
540
|
-
var isInvalidLink = !propValue || /^https?:\/\/$/.test(propValue);
|
|
541
|
-
if (isInvalidLink) {
|
|
542
|
-
if (!node.href) {
|
|
543
|
-
return;
|
|
544
|
-
}
|
|
545
|
-
propValue = node.href;
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
if (key === 'class' && node.className) {
|
|
549
|
-
propValue += " " + node.className;
|
|
550
|
-
}
|
|
551
|
-
_this.renderer.setAttribute(node, key, propValue);
|
|
537
|
+
_this.updateAttribute(node, key, propValue);
|
|
552
538
|
});
|
|
553
539
|
if (node.childNodes && node.childNodes.length === 0 && linkText) {
|
|
554
540
|
node.textContent = linkText;
|
|
@@ -564,7 +550,7 @@
|
|
|
564
550
|
var attrs = Object.assign(Object.assign({}, this.getElementAttrs()), this.attrs);
|
|
565
551
|
Object.entries(attrs).forEach(function (_c) {
|
|
566
552
|
var _d = __read(_c, 2), key = _d[0], attrValue = _d[1];
|
|
567
|
-
return _this.
|
|
553
|
+
return _this.updateAttribute(span, key, attrValue);
|
|
568
554
|
});
|
|
569
555
|
this.viewContainer.createEmbeddedView(this.templateRef);
|
|
570
556
|
var parentNode = this.renderer.parentNode(this.elementRef.nativeElement);
|
|
@@ -586,6 +572,27 @@
|
|
|
586
572
|
}
|
|
587
573
|
return attrs;
|
|
588
574
|
};
|
|
575
|
+
LinkDirective.prototype.updateAttribute = function (node, key, propValue) {
|
|
576
|
+
if (typeof propValue !== 'string' || !propValue || propValue === '') {
|
|
577
|
+
return;
|
|
578
|
+
}
|
|
579
|
+
if (key === 'href') {
|
|
580
|
+
var isInvalidLink = !propValue || /^https?:\/\/$/.test(propValue);
|
|
581
|
+
if (isInvalidLink) {
|
|
582
|
+
if (!node.href) {
|
|
583
|
+
return;
|
|
584
|
+
}
|
|
585
|
+
propValue = node.href;
|
|
586
|
+
}
|
|
587
|
+
this.renderer.setAttribute(node, key, propValue);
|
|
588
|
+
}
|
|
589
|
+
else if (key === 'class' && node.className !== '') {
|
|
590
|
+
this.renderer.setAttribute(node, key, node.className + " " + propValue);
|
|
591
|
+
}
|
|
592
|
+
else {
|
|
593
|
+
this.renderer.setAttribute(node, key, propValue);
|
|
594
|
+
}
|
|
595
|
+
};
|
|
589
596
|
return LinkDirective;
|
|
590
597
|
}());
|
|
591
598
|
LinkDirective.decorators = [
|
|
@@ -618,7 +625,7 @@
|
|
|
618
625
|
viewRef.rootNodes.forEach(function (node) {
|
|
619
626
|
Object.entries(props).forEach(function (_a) {
|
|
620
627
|
var _b = __read(_a, 2), key = _b[0], propValue = _b[1];
|
|
621
|
-
_this.
|
|
628
|
+
_this.updateAttribute(node, key, propValue);
|
|
622
629
|
if (key === 'href') {
|
|
623
630
|
_this.renderer.listen(node, 'click', function (event) {
|
|
624
631
|
_this.router.navigateByUrl(propValue);
|
|
@@ -664,16 +671,16 @@
|
|
|
664
671
|
viewRef.rootNodes.forEach(function (node) {
|
|
665
672
|
Object.entries(props).forEach(function (_a) {
|
|
666
673
|
var _b = __read(_a, 2), key = _b[0], propValue = _b[1];
|
|
667
|
-
if (key === 'href' && !
|
|
674
|
+
if (key === 'href' && !utils.isAbsoluteUrl(propValue)) {
|
|
668
675
|
var urlTree = _this.router.createUrlTree([propValue], _this.extras);
|
|
669
|
-
_this.
|
|
676
|
+
_this.updateAttribute(node, key, _this.router.serializeUrl(urlTree));
|
|
670
677
|
_this.renderer.listen(node, 'click', function (event) {
|
|
671
678
|
_this.router.navigate([propValue], _this.extras);
|
|
672
679
|
event.preventDefault();
|
|
673
680
|
});
|
|
674
681
|
}
|
|
675
682
|
else {
|
|
676
|
-
_this.
|
|
683
|
+
_this.updateAttribute(node, key, propValue);
|
|
677
684
|
}
|
|
678
685
|
});
|
|
679
686
|
if (node.childNodes && node.childNodes.length === 0 && linkText) {
|
|
@@ -681,15 +688,6 @@
|
|
|
681
688
|
}
|
|
682
689
|
});
|
|
683
690
|
};
|
|
684
|
-
GenericLinkDirective.prototype.isAbsoluteUrl = function (url) {
|
|
685
|
-
if (url === null) {
|
|
686
|
-
return false;
|
|
687
|
-
}
|
|
688
|
-
if (typeof url !== 'string') {
|
|
689
|
-
throw new TypeError('Expected a string');
|
|
690
|
-
}
|
|
691
|
-
return /^[a-z][a-z0-9+.-]*:/.test(url);
|
|
692
|
-
};
|
|
693
691
|
return GenericLinkDirective;
|
|
694
692
|
}(LinkDirective));
|
|
695
693
|
GenericLinkDirective.decorators = [
|
|
@@ -1134,9 +1132,11 @@
|
|
|
1134
1132
|
};
|
|
1135
1133
|
|
|
1136
1134
|
var RichTextDirective = /** @class */ (function () {
|
|
1137
|
-
function RichTextDirective(viewContainer, templateRef) {
|
|
1135
|
+
function RichTextDirective(viewContainer, templateRef, renderer, router) {
|
|
1138
1136
|
this.viewContainer = viewContainer;
|
|
1139
1137
|
this.templateRef = templateRef;
|
|
1138
|
+
this.renderer = renderer;
|
|
1139
|
+
this.router = router;
|
|
1140
1140
|
this.editable = true;
|
|
1141
1141
|
}
|
|
1142
1142
|
RichTextDirective.prototype.ngOnChanges = function (changes) {
|
|
@@ -1149,6 +1149,7 @@
|
|
|
1149
1149
|
}
|
|
1150
1150
|
};
|
|
1151
1151
|
RichTextDirective.prototype.updateView = function () {
|
|
1152
|
+
var _this = this;
|
|
1152
1153
|
var field = this.field;
|
|
1153
1154
|
if (!field || (!field.editable && !field.value)) {
|
|
1154
1155
|
return;
|
|
@@ -1156,6 +1157,22 @@
|
|
|
1156
1157
|
var html = field.editable && this.editable ? field.editable : field.value;
|
|
1157
1158
|
this.viewRef.rootNodes.forEach(function (node) {
|
|
1158
1159
|
node.innerHTML = html;
|
|
1160
|
+
if (!node.querySelectorAll) {
|
|
1161
|
+
return;
|
|
1162
|
+
}
|
|
1163
|
+
var links = node.querySelectorAll('a[href]');
|
|
1164
|
+
var linksArray = [].slice.call(links);
|
|
1165
|
+
linksArray.forEach(function (link) {
|
|
1166
|
+
var href = link.getAttribute('href');
|
|
1167
|
+
var target = link.getAttribute('target');
|
|
1168
|
+
if (!href || utils.isAbsoluteUrl(href) || target === '_blank' || target === '_top') {
|
|
1169
|
+
return;
|
|
1170
|
+
}
|
|
1171
|
+
_this.renderer.listen(link, 'click', function (event) {
|
|
1172
|
+
_this.router.navigateByUrl(href);
|
|
1173
|
+
event.preventDefault();
|
|
1174
|
+
});
|
|
1175
|
+
});
|
|
1159
1176
|
});
|
|
1160
1177
|
};
|
|
1161
1178
|
return RichTextDirective;
|
|
@@ -1167,7 +1184,9 @@
|
|
|
1167
1184
|
];
|
|
1168
1185
|
RichTextDirective.ctorParameters = function () { return [
|
|
1169
1186
|
{ type: core.ViewContainerRef },
|
|
1170
|
-
{ type: core.TemplateRef }
|
|
1187
|
+
{ type: core.TemplateRef },
|
|
1188
|
+
{ type: core.Renderer2 },
|
|
1189
|
+
{ type: router.Router }
|
|
1171
1190
|
]; };
|
|
1172
1191
|
RichTextDirective.propDecorators = {
|
|
1173
1192
|
editable: [{ type: core.Input, args: ['scRichTextEditable',] }],
|
|
@@ -1492,6 +1511,22 @@
|
|
|
1492
1511
|
enumerable: true,
|
|
1493
1512
|
get: function () { return media.mediaApi; }
|
|
1494
1513
|
});
|
|
1514
|
+
Object.defineProperty(exports, 'handleEditorAnchors', {
|
|
1515
|
+
enumerable: true,
|
|
1516
|
+
get: function () { return utils.handleEditorAnchors; }
|
|
1517
|
+
});
|
|
1518
|
+
Object.defineProperty(exports, 'isEditorActive', {
|
|
1519
|
+
enumerable: true,
|
|
1520
|
+
get: function () { return utils.isEditorActive; }
|
|
1521
|
+
});
|
|
1522
|
+
Object.defineProperty(exports, 'isServer', {
|
|
1523
|
+
enumerable: true,
|
|
1524
|
+
get: function () { return utils.isServer; }
|
|
1525
|
+
});
|
|
1526
|
+
Object.defineProperty(exports, 'resetEditorChromes', {
|
|
1527
|
+
enumerable: true,
|
|
1528
|
+
get: function () { return utils.resetEditorChromes; }
|
|
1529
|
+
});
|
|
1495
1530
|
Object.defineProperty(exports, 'GraphQLDictionaryService', {
|
|
1496
1531
|
enumerable: true,
|
|
1497
1532
|
get: function () { return i18n.GraphQLDictionaryService; }
|
|
@@ -1520,29 +1555,13 @@
|
|
|
1520
1555
|
enumerable: true,
|
|
1521
1556
|
get: function () { return sitecoreJss.constants; }
|
|
1522
1557
|
});
|
|
1523
|
-
Object.defineProperty(exports, '
|
|
1558
|
+
Object.defineProperty(exports, 'enableDebug', {
|
|
1524
1559
|
enumerable: true,
|
|
1525
|
-
get: function () { return
|
|
1526
|
-
});
|
|
1527
|
-
Object.defineProperty(exports, 'isEditorActive', {
|
|
1528
|
-
enumerable: true,
|
|
1529
|
-
get: function () { return utils.isEditorActive; }
|
|
1530
|
-
});
|
|
1531
|
-
Object.defineProperty(exports, 'isExperienceEditorActive', {
|
|
1532
|
-
enumerable: true,
|
|
1533
|
-
get: function () { return utils.isExperienceEditorActive; }
|
|
1534
|
-
});
|
|
1535
|
-
Object.defineProperty(exports, 'isServer', {
|
|
1536
|
-
enumerable: true,
|
|
1537
|
-
get: function () { return utils.isServer; }
|
|
1538
|
-
});
|
|
1539
|
-
Object.defineProperty(exports, 'resetEditorChromes', {
|
|
1540
|
-
enumerable: true,
|
|
1541
|
-
get: function () { return utils.resetEditorChromes; }
|
|
1560
|
+
get: function () { return sitecoreJss.enableDebug; }
|
|
1542
1561
|
});
|
|
1543
|
-
Object.defineProperty(exports, '
|
|
1562
|
+
Object.defineProperty(exports, 'trackingApi', {
|
|
1544
1563
|
enumerable: true,
|
|
1545
|
-
get: function () { return
|
|
1564
|
+
get: function () { return tracking.trackingApi; }
|
|
1546
1565
|
});
|
|
1547
1566
|
exports.ComponentNameAndType = ComponentNameAndType;
|
|
1548
1567
|
exports.DYNAMIC_COMPONENT = DYNAMIC_COMPONENT;
|