@energycap/components 0.31.3 → 0.31.4
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/bundles/energycap-components.umd.js +94 -6
- package/bundles/energycap-components.umd.js.map +1 -1
- package/bundles/energycap-components.umd.min.js +1 -1
- package/bundles/energycap-components.umd.min.js.map +1 -1
- package/energycap-components.metadata.json +1 -1
- package/energycap-components.min.css +2 -2
- package/esm2015/lib/components.module.js +6 -3
- package/esm2015/lib/display/tooltip/tooltip.component.js +24 -0
- package/esm2015/lib/display/tooltip/tooltip.service.js +64 -0
- package/esm2015/public-api.js +3 -1
- package/fesm2015/energycap-components.js +87 -4
- package/fesm2015/energycap-components.js.map +1 -1
- package/lib/display/tooltip/tooltip.component.d.ts +53 -0
- package/lib/display/tooltip/tooltip.service.d.ts +12 -0
- package/package.json +1 -1
- package/public-api.d.ts +2 -0
- package/src/styles/_base.scss +4 -0
- package/src/styles/_global-variables.scss +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/cdk/a11y'), require('@angular/cdk/overlay'), require('@angular/common'), require('@angular/core'), require('@angular/forms'), require('@angular/router'), require('@ngx-translate/core'), require('ngx-clipboard'), require('rxjs'), require('rxjs/operators'), require('moment'), require('popper.js'), require('lodash'), require('@angular/cdk/portal')) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define('@energycap/components', ['exports', '@angular/cdk/a11y', '@angular/cdk/overlay', '@angular/common', '@angular/core', '@angular/forms', '@angular/router', '@ngx-translate/core', 'ngx-clipboard', 'rxjs', 'rxjs/operators', 'moment', 'popper.js', 'lodash', '@angular/cdk/portal'], factory) :
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.energycap = global.energycap || {}, global.energycap.components = {}), global.ng.cdk.a11y, global.ng.cdk.overlay, global.ng.common, global.ng.core, global.ng.forms, global.ng.router, global.i1, global.ngxClipboard, global.rxjs, global.rxjs.operators, global.moment, global.Popper, global.lodash, global.ng.cdk.portal));
|
|
5
|
-
}(this, (function (exports, a11y,
|
|
5
|
+
}(this, (function (exports, a11y, i1$2, common, i0, forms, i1$1, i1, ngxClipboard, rxjs, operators, moment, Popper, lodash, portal) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -4578,7 +4578,7 @@
|
|
|
4578
4578
|
var positionStrategy = this.overlay.position()
|
|
4579
4579
|
.flexibleConnectedTo(this.elementRef)
|
|
4580
4580
|
.withPositions([position]);
|
|
4581
|
-
var config = new
|
|
4581
|
+
var config = new i1$2.OverlayConfig({
|
|
4582
4582
|
positionStrategy: positionStrategy
|
|
4583
4583
|
});
|
|
4584
4584
|
return config;
|
|
@@ -4599,7 +4599,7 @@
|
|
|
4599
4599
|
},] }
|
|
4600
4600
|
];
|
|
4601
4601
|
PopoverComponent.ctorParameters = function () { return [
|
|
4602
|
-
{ type:
|
|
4602
|
+
{ type: i1$2.Overlay },
|
|
4603
4603
|
{ type: i0.ViewContainerRef },
|
|
4604
4604
|
{ type: i0.ElementRef }
|
|
4605
4605
|
]; };
|
|
@@ -9119,6 +9119,30 @@
|
|
|
9119
9119
|
},] }
|
|
9120
9120
|
];
|
|
9121
9121
|
|
|
9122
|
+
var TooltipComponent = /** @class */ (function () {
|
|
9123
|
+
function TooltipComponent() {
|
|
9124
|
+
this.position = 'top-center';
|
|
9125
|
+
this.dismissible = false;
|
|
9126
|
+
this.onHide = new i0.EventEmitter();
|
|
9127
|
+
}
|
|
9128
|
+
TooltipComponent.prototype.hide = function () {
|
|
9129
|
+
var _a;
|
|
9130
|
+
this.onHide.next();
|
|
9131
|
+
(_a = this.overlayRef) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
9132
|
+
};
|
|
9133
|
+
return TooltipComponent;
|
|
9134
|
+
}());
|
|
9135
|
+
TooltipComponent.decorators = [
|
|
9136
|
+
{ type: i0.Component, args: [{
|
|
9137
|
+
selector: 'ec-tooltip',
|
|
9138
|
+
template: "<article id=\"{{id}}\" class=\"py-3 position-{{position}}\">\r\n <header *ngIf=\"title || subtitle\" class=\"mb-3\">\r\n <h1 class=\"text-heading-2 px-3 mb-0\">{{title}}</h1>\r\n <p class=\"text-caption-1 px-3 mb-0\">{{subtitle}}</p>\r\n </header>\r\n \r\n <ng-container *ngIf=\"customContent; else textTemplate\">\r\n <ng-container *ngTemplateOutlet=\"customContent\"></ng-container>\r\n </ng-container>\r\n\r\n <ng-template #textTemplate>\r\n <div class=\"text-body-1 px-3\" [innerHTML]=\"text\"></div>\r\n </ng-template>\r\n \r\n <ec-button *ngIf=\"dismissible\" id=\"tooltipDismiss\" type=\"icon\" icon=\"icon-cancel\" (clicked)=\"hide()\" style=\"--ec-button-color-icon: var(--ec-color-secondary-light);\"></ec-button>\r\n</article>",
|
|
9139
|
+
styles: [":root{--ec-color-icon:rgba(26,26,35,0.66);--ec-font-size-icon:1rem}@-webkit-keyframes spin{0%{transform:rotate(0)}to{transform:rotate(1turn)}}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(1turn)}}:host{display:block;padding:.75rem}article{background-color:var(--ec-tooltip-background-color,#162f3b);border-radius:var(--ec-border-radius-card);box-shadow:var(--ec-box-shadow-overlay);color:var(--ec-tooltip-color,var(--ec-color-primary-light));position:relative}article:after{border:.625rem solid transparent;content:\"\";display:block;height:0;position:absolute;width:0}article.position-top-center:after,article.position-top-left:after,article.position-top-right:after{border-top-color:var(--ec-tooltip-background-color,#162f3b);bottom:-1.25rem}article.position-bottom-center:after,article.position-bottom-left:after,article.position-bottom-right:after{border-bottom-color:var(--ec-tooltip-background-color,#162f3b);top:-1.25rem}article.position-bottom-left:after,article.position-top-left:after{right:1rem}article.position-bottom-right:after,article.position-top-right:after{left:1rem}article.position-bottom-center:after,article.position-top-center:after{right:50%;transform:translateX(50%)}article.position-right-bottom:after,article.position-right-center:after,article.position-right-top:after{border-right-color:var(--ec-tooltip-background-color,#162f3b);left:-1.25rem}article.position-left-bottom:after,article.position-left-center:after,article.position-left-top:after{border-left-color:var(--ec-tooltip-background-color,#162f3b);right:-1.25rem}article.position-left-top:after,article.position-right-top:after{top:1rem}article.position-left-bottom:after,article.position-right-bottom:after{bottom:1rem}article.position-left-center:after,article.position-right-center:after{bottom:50%;transform:translateY(50%)}.text-body-1,.text-heading-2{color:var(--ec-color-primary-light)}.text-body-1 ::ng-deep p:last-child{margin-bottom:0}.text-body-1 ::ng-deep a{color:#82c0d3;font-weight:var(--ec-font-weight-bold)}.text-caption-1{color:var(--ec-color-secondary-light)}ec-button{position:absolute;right:.25rem;top:.25rem}"]
|
|
9140
|
+
},] }
|
|
9141
|
+
];
|
|
9142
|
+
TooltipComponent.propDecorators = {
|
|
9143
|
+
backgroundColor: [{ type: i0.HostBinding, args: ['style.--ec-tooltip-background-color',] }]
|
|
9144
|
+
};
|
|
9145
|
+
|
|
9122
9146
|
var ComponentsModule = /** @class */ (function () {
|
|
9123
9147
|
function ComponentsModule() {
|
|
9124
9148
|
}
|
|
@@ -9203,7 +9227,8 @@
|
|
|
9203
9227
|
FormControlLabelComponent,
|
|
9204
9228
|
ItemPickerComponent,
|
|
9205
9229
|
HelpPopoverComponent,
|
|
9206
|
-
LinkButtonComponent
|
|
9230
|
+
LinkButtonComponent,
|
|
9231
|
+
TooltipComponent
|
|
9207
9232
|
],
|
|
9208
9233
|
imports: [
|
|
9209
9234
|
common.CommonModule,
|
|
@@ -9212,7 +9237,7 @@
|
|
|
9212
9237
|
i1$1.RouterModule,
|
|
9213
9238
|
i1.TranslateModule,
|
|
9214
9239
|
a11y.A11yModule,
|
|
9215
|
-
|
|
9240
|
+
i1$2.OverlayModule
|
|
9216
9241
|
],
|
|
9217
9242
|
providers: [
|
|
9218
9243
|
FormGroupHelper,
|
|
@@ -9282,7 +9307,8 @@
|
|
|
9282
9307
|
FormControlLabelComponent,
|
|
9283
9308
|
ItemPickerComponent,
|
|
9284
9309
|
HelpPopoverComponent,
|
|
9285
|
-
LinkButtonComponent
|
|
9310
|
+
LinkButtonComponent,
|
|
9311
|
+
TooltipComponent
|
|
9286
9312
|
]
|
|
9287
9313
|
},] }
|
|
9288
9314
|
];
|
|
@@ -9397,6 +9423,66 @@
|
|
|
9397
9423
|
return (control.value && domainPattern.test(control.value) === false) ? { domain: true } : null;
|
|
9398
9424
|
};
|
|
9399
9425
|
|
|
9426
|
+
var TooltipService = /** @class */ (function () {
|
|
9427
|
+
function TooltipService(overlay) {
|
|
9428
|
+
this.overlay = overlay;
|
|
9429
|
+
this.positions = {
|
|
9430
|
+
'top-left': { originX: 'center', originY: 'top', overlayX: 'end', overlayY: 'bottom', offsetX: 38 },
|
|
9431
|
+
'top-center': { originX: 'center', originY: 'top', overlayX: 'center', overlayY: 'bottom' },
|
|
9432
|
+
'top-right': { originX: 'center', originY: 'top', overlayX: 'start', overlayY: 'bottom', offsetX: -38 },
|
|
9433
|
+
'bottom-left': { originX: 'center', originY: 'bottom', overlayX: 'end', overlayY: 'top', offsetX: 38 },
|
|
9434
|
+
'bottom-center': { originX: 'center', originY: 'bottom', overlayX: 'center', overlayY: 'top' },
|
|
9435
|
+
'bottom-right': { originX: 'center', originY: 'bottom', overlayX: 'start', overlayY: 'top', offsetX: -38 },
|
|
9436
|
+
'left-top': { originX: 'start', originY: 'center', overlayX: 'end', overlayY: 'top', offsetY: -38 },
|
|
9437
|
+
'left-center': { originX: 'start', originY: 'center', overlayX: 'end', overlayY: 'center' },
|
|
9438
|
+
'left-bottom': { originX: 'start', originY: 'center', overlayX: 'end', overlayY: 'bottom', offsetY: 38 },
|
|
9439
|
+
'right-top': { originX: 'end', originY: 'center', overlayX: 'start', overlayY: 'top', offsetY: -38 },
|
|
9440
|
+
'right-center': { originX: 'end', originY: 'center', overlayX: 'start', overlayY: 'center' },
|
|
9441
|
+
'right-bottom': { originX: 'end', originY: 'center', overlayX: 'start', overlayY: 'bottom', offsetY: 38 }
|
|
9442
|
+
};
|
|
9443
|
+
}
|
|
9444
|
+
/**
|
|
9445
|
+
* Show a tooltip attached to a specified element
|
|
9446
|
+
*/
|
|
9447
|
+
TooltipService.prototype.show = function (anchor, position, options) {
|
|
9448
|
+
if (position === void 0) { position = 'top-center'; }
|
|
9449
|
+
var overlayConfig = this.getOverlayConfig(anchor, this.positions[position], options === null || options === void 0 ? void 0 : options.width);
|
|
9450
|
+
var overlayRef = this.overlay.create(overlayConfig);
|
|
9451
|
+
var contentPortal = new portal.ComponentPortal(TooltipComponent);
|
|
9452
|
+
var contentViewRef = overlayRef.attach(contentPortal);
|
|
9453
|
+
contentViewRef.instance.position = position;
|
|
9454
|
+
contentViewRef.instance.id = options === null || options === void 0 ? void 0 : options.id;
|
|
9455
|
+
contentViewRef.instance.title = options === null || options === void 0 ? void 0 : options.title;
|
|
9456
|
+
contentViewRef.instance.subtitle = options === null || options === void 0 ? void 0 : options.subtitle;
|
|
9457
|
+
contentViewRef.instance.text = options === null || options === void 0 ? void 0 : options.text;
|
|
9458
|
+
contentViewRef.instance.customContent = options === null || options === void 0 ? void 0 : options.customContent;
|
|
9459
|
+
contentViewRef.instance.dismissible = (options === null || options === void 0 ? void 0 : options.dismissible) || false;
|
|
9460
|
+
contentViewRef.instance.backgroundColor = options === null || options === void 0 ? void 0 : options.backgroundColor;
|
|
9461
|
+
contentViewRef.instance.overlayRef = overlayRef;
|
|
9462
|
+
return contentViewRef.instance;
|
|
9463
|
+
};
|
|
9464
|
+
TooltipService.prototype.getOverlayConfig = function (element, position, width) {
|
|
9465
|
+
var positionStrategy = this.overlay.position()
|
|
9466
|
+
.flexibleConnectedTo(element)
|
|
9467
|
+
.withPositions([position]);
|
|
9468
|
+
var config = new i1$2.OverlayConfig({
|
|
9469
|
+
positionStrategy: positionStrategy,
|
|
9470
|
+
width: width
|
|
9471
|
+
});
|
|
9472
|
+
return config;
|
|
9473
|
+
};
|
|
9474
|
+
return TooltipService;
|
|
9475
|
+
}());
|
|
9476
|
+
TooltipService.ɵprov = i0.ɵɵdefineInjectable({ factory: function TooltipService_Factory() { return new TooltipService(i0.ɵɵinject(i1$2.Overlay)); }, token: TooltipService, providedIn: "root" });
|
|
9477
|
+
TooltipService.decorators = [
|
|
9478
|
+
{ type: i0.Injectable, args: [{
|
|
9479
|
+
providedIn: 'root'
|
|
9480
|
+
},] }
|
|
9481
|
+
];
|
|
9482
|
+
TooltipService.ctorParameters = function () { return [
|
|
9483
|
+
{ type: i1$2.Overlay }
|
|
9484
|
+
]; };
|
|
9485
|
+
|
|
9400
9486
|
(function (PageStatus) {
|
|
9401
9487
|
PageStatus["Loading"] = "loading";
|
|
9402
9488
|
PageStatus["Loaded"] = "loaded";
|
|
@@ -10512,6 +10598,8 @@
|
|
|
10512
10598
|
exports.ToastEvent = ToastEvent;
|
|
10513
10599
|
exports.ToastService = ToastService;
|
|
10514
10600
|
exports.ToasterComponent = ToasterComponent;
|
|
10601
|
+
exports.TooltipComponent = TooltipComponent;
|
|
10602
|
+
exports.TooltipService = TooltipService;
|
|
10515
10603
|
exports.TreeComponent = TreeComponent;
|
|
10516
10604
|
exports.UnicodeStrings = UnicodeStrings;
|
|
10517
10605
|
exports.UserPreferenceService = UserPreferenceService;
|