@energycap/components 0.31.3 → 0.31.4-ECAP-12451-Readonly-Pageview.20220916-0845

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.
@@ -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, overlay, common, i0, forms, i1$1, i1, ngxClipboard, rxjs, operators, moment, Popper, lodash, portal) { 'use strict';
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 overlay.OverlayConfig({
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: overlay.Overlay },
4602
+ { type: i1$2.Overlay },
4603
4603
  { type: i0.ViewContainerRef },
4604
4604
  { type: i0.ElementRef }
4605
4605
  ]; };
@@ -8412,6 +8412,10 @@
8412
8412
  * Set to true when page-view is inside a dialog to adjust styles and hide breadcrumbs.
8413
8413
  */
8414
8414
  this.isDialog = false;
8415
+ /**
8416
+ * Set to true to enable read only mode. Only a single secondary action will be available
8417
+ */
8418
+ this.readonly = false;
8415
8419
  /**
8416
8420
  * Controls Overlay that masks the page view content. Only the header is not masked when the overlay is visible. Default is pending Overlay with no message
8417
8421
  */
@@ -8460,7 +8464,7 @@
8460
8464
  PageViewComponent.decorators = [
8461
8465
  { type: i0.Component, args: [{
8462
8466
  selector: 'ec-page-view',
8463
- template: "<div ecOverlay\r\n [status]=\"status?.status\"\r\n [message]=\"status?.message\"\r\n [displayAsMask]=\"true\"\r\n class=\"bg-body flex-grow d-flex\">\r\n <div id=\"PageViewScrollContainer\" \r\n class=\"d-flex flex-column flex-grow scroll-y\" \r\n [class.is-dialog]=\"isDialog\"\r\n [class.fit-content]=\"fitContent\"\r\n [class.sticky-footer]=\"stickyFooter && !!footerTemplate\"\r\n [class.overlay-visible]=\"status?.status !== 'hasData'\"\r\n [class.footer-visible]=\"!!footerTemplate\">\r\n <section>\r\n <ng-content></ng-content> \r\n </section>\r\n \r\n <footer *ngIf=\"footerTemplate\">\r\n <ng-container *ngTemplateOutlet=\"footerTemplate\"></ng-container>\r\n </footer>\r\n\r\n <header *ngIf=\"showHeader\">\r\n \r\n <ol id=\"breadcrumbs\"\r\n *ngIf=\"breadcrumbs?.length && !isDialog\">\r\n <li *ngFor=\"let crumb of breadcrumbs; last as isLast\">\r\n <a *ngIf=\"crumb.url; else label\"\r\n [routerLink]=\"crumb.url\">\r\n <ng-container *ngTemplateOutlet=\"label\"></ng-container>\r\n </a>\r\n <ng-template #label>{{crumb.label}}</ng-template>\r\n </li>\r\n </ol>\r\n \r\n <div *ngIf=\"!customHeaderTemplate; else customHeaderOutlet\" class=\"titlebar\">\r\n <app-page-title *ngIf=\"!customTitleTemplate; else customTitle\" \r\n [title]=\"title\"\r\n [subTitle]=\"subTitle\"\r\n [subTitleUrl]=\"subTitleUrl\"\r\n [titleIcon]=\"titleIcon\"\r\n class=\"title text-truncate\">\r\n </app-page-title>\r\n \r\n <ng-template #customTitle>\r\n <div class=\"title\">\r\n <ng-container *ngTemplateOutlet=\"customTitleTemplate\"></ng-container>\r\n </div>\r\n </ng-template>\r\n \r\n <div class=\"actions\">\r\n <ec-button id=\"primaryAction\"\r\n class=\"ml-2\"\r\n *ngIf=\"!hidePrimaryAction && onPrimaryAction.observers?.length\"\r\n [disabled]=\"status?.status === 'pending'\"\r\n type=\"primary\"\r\n [label]=\"primaryActionLabel\"\r\n (clicked)=\"primaryAction($event)\">\r\n </ec-button>\r\n <ec-button id=\"secondaryAction\"\r\n class=\"ml-2\"\r\n *ngIf=\"!hideSecondaryAction && onSecondaryAction.observers?.length\"\r\n type=\"secondary\"\r\n [label]=\"secondaryActionLabel\"\r\n (clicked)=\"secondaryAction($event)\">\r\n </ec-button>\r\n <ec-dropdown id=\"moreActions\"\r\n *ngIf=\"moreActions?.length\"\r\n [disabled]=\"status?.status === 'pending'\"\r\n class=\"ml-2\"\r\n buttonType=\"secondary\"\r\n [label]=\"moreActionsLabel\"\r\n [items]=\"moreActions\">\r\n </ec-dropdown>\r\n <ng-container *ngTemplateOutlet=\"customActionsTemplate\"></ng-container>\r\n </div>\r\n </div>\r\n \r\n <ng-template #customHeaderOutlet> \r\n <div class=\"page-header\">\r\n <ng-container *ngTemplateOutlet=\"customHeaderTemplate\"></ng-container>\r\n </div>\r\n </ng-template>\r\n \r\n <ec-banner *ngIf=\"errors\"\r\n id=\"pageViewErrors\"\r\n [class.border-bottom-0]=\"!isDialog\">\r\n <div [innerHtml]=\"errors\"></div>\r\n </ec-banner>\r\n </header>\r\n </div>\r\n</div>\r\n\r\n",
8467
+ template: "<div ecOverlay\r\n [status]=\"status?.status\"\r\n [message]=\"status?.message\"\r\n [displayAsMask]=\"true\"\r\n class=\"bg-body flex-grow d-flex\">\r\n <div id=\"PageViewScrollContainer\" \r\n class=\"d-flex flex-column flex-grow scroll-y\" \r\n [class.is-dialog]=\"isDialog\"\r\n [class.fit-content]=\"fitContent\"\r\n [class.sticky-footer]=\"stickyFooter && !!footerTemplate\"\r\n [class.overlay-visible]=\"status?.status !== 'hasData'\"\r\n [class.footer-visible]=\"!!footerTemplate\">\r\n <section>\r\n <ng-content></ng-content> \r\n </section>\r\n \r\n <footer *ngIf=\"footerTemplate\">\r\n <ng-container *ngTemplateOutlet=\"footerTemplate\"></ng-container>\r\n </footer>\r\n\r\n <header *ngIf=\"showHeader\">\r\n \r\n <ol id=\"breadcrumbs\"\r\n *ngIf=\"breadcrumbs?.length && !isDialog\">\r\n <li *ngFor=\"let crumb of breadcrumbs; last as isLast\">\r\n <a *ngIf=\"crumb.url; else label\"\r\n [routerLink]=\"crumb.url\">\r\n <ng-container *ngTemplateOutlet=\"label\"></ng-container>\r\n </a>\r\n <ng-template #label>{{crumb.label}}</ng-template>\r\n </li>\r\n </ol>\r\n \r\n <div *ngIf=\"!customHeaderTemplate; else customHeaderOutlet\" class=\"titlebar\">\r\n <app-page-title *ngIf=\"!customTitleTemplate; else customTitle\" \r\n [title]=\"title\"\r\n [subTitle]=\"subTitle\"\r\n [subTitleUrl]=\"subTitleUrl\"\r\n [titleIcon]=\"titleIcon\"\r\n class=\"title text-truncate\">\r\n </app-page-title>\r\n \r\n <ng-template #customTitle>\r\n <div class=\"title\">\r\n <ng-container *ngTemplateOutlet=\"customTitleTemplate\"></ng-container>\r\n </div>\r\n </ng-template>\r\n \r\n <div class=\"actions\">\r\n <ec-button id=\"primaryAction\"\r\n class=\"ml-2\"\r\n *ngIf=\"!hidePrimaryAction && onPrimaryAction.observers?.length && !readonly\"\r\n [disabled]=\"status?.status === 'pending'\"\r\n type=\"primary\"\r\n [label]=\"primaryActionLabel\"\r\n (clicked)=\"primaryAction($event)\">\r\n </ec-button>\r\n <ec-button id=\"secondaryAction\"\r\n class=\"ml-2\"\r\n *ngIf=\"!hideSecondaryAction && onSecondaryAction.observers?.length\"\r\n type=\"secondary\"\r\n [label]=\"readonly ? 'Close' : secondaryActionLabel\"\r\n (clicked)=\"secondaryAction($event)\">\r\n </ec-button>\r\n <ec-dropdown id=\"moreActions\"\r\n *ngIf=\"moreActions?.length && !readonly\"\r\n [disabled]=\"status?.status === 'pending'\"\r\n class=\"ml-2\"\r\n buttonType=\"secondary\"\r\n [label]=\"moreActionsLabel\"\r\n [items]=\"moreActions\">\r\n </ec-dropdown>\r\n <ng-container *ngTemplateOutlet=\"customActionsTemplate\"></ng-container>\r\n </div>\r\n </div>\r\n \r\n <ng-template #customHeaderOutlet> \r\n <div class=\"page-header\">\r\n <ng-container *ngTemplateOutlet=\"customHeaderTemplate\"></ng-container>\r\n </div>\r\n </ng-template>\r\n \r\n <ec-banner *ngIf=\"errors\"\r\n id=\"pageViewErrors\"\r\n [class.border-bottom-0]=\"!isDialog\">\r\n <div [innerHtml]=\"errors\"></div>\r\n </ec-banner>\r\n </header>\r\n </div>\r\n</div>\r\n\r\n",
8464
8468
  host: {
8465
8469
  class: "flex-grow"
8466
8470
  },
@@ -8470,6 +8474,7 @@
8470
8474
  PageViewComponent.ctorParameters = function () { return []; };
8471
8475
  PageViewComponent.propDecorators = {
8472
8476
  isDialog: [{ type: i0.Input }],
8477
+ readonly: [{ type: i0.Input }],
8473
8478
  status: [{ type: i0.Input }],
8474
8479
  showHeader: [{ type: i0.Input }],
8475
8480
  errors: [{ type: i0.Input }],
@@ -9119,6 +9124,30 @@
9119
9124
  },] }
9120
9125
  ];
9121
9126
 
9127
+ var TooltipComponent = /** @class */ (function () {
9128
+ function TooltipComponent() {
9129
+ this.position = 'top-center';
9130
+ this.dismissible = false;
9131
+ this.onHide = new i0.EventEmitter();
9132
+ }
9133
+ TooltipComponent.prototype.hide = function () {
9134
+ var _a;
9135
+ this.onHide.next();
9136
+ (_a = this.overlayRef) === null || _a === void 0 ? void 0 : _a.dispose();
9137
+ };
9138
+ return TooltipComponent;
9139
+ }());
9140
+ TooltipComponent.decorators = [
9141
+ { type: i0.Component, args: [{
9142
+ selector: 'ec-tooltip',
9143
+ 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>",
9144
+ 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}"]
9145
+ },] }
9146
+ ];
9147
+ TooltipComponent.propDecorators = {
9148
+ backgroundColor: [{ type: i0.HostBinding, args: ['style.--ec-tooltip-background-color',] }]
9149
+ };
9150
+
9122
9151
  var ComponentsModule = /** @class */ (function () {
9123
9152
  function ComponentsModule() {
9124
9153
  }
@@ -9203,7 +9232,8 @@
9203
9232
  FormControlLabelComponent,
9204
9233
  ItemPickerComponent,
9205
9234
  HelpPopoverComponent,
9206
- LinkButtonComponent
9235
+ LinkButtonComponent,
9236
+ TooltipComponent
9207
9237
  ],
9208
9238
  imports: [
9209
9239
  common.CommonModule,
@@ -9212,7 +9242,7 @@
9212
9242
  i1$1.RouterModule,
9213
9243
  i1.TranslateModule,
9214
9244
  a11y.A11yModule,
9215
- overlay.OverlayModule
9245
+ i1$2.OverlayModule
9216
9246
  ],
9217
9247
  providers: [
9218
9248
  FormGroupHelper,
@@ -9282,7 +9312,8 @@
9282
9312
  FormControlLabelComponent,
9283
9313
  ItemPickerComponent,
9284
9314
  HelpPopoverComponent,
9285
- LinkButtonComponent
9315
+ LinkButtonComponent,
9316
+ TooltipComponent
9286
9317
  ]
9287
9318
  },] }
9288
9319
  ];
@@ -9397,6 +9428,66 @@
9397
9428
  return (control.value && domainPattern.test(control.value) === false) ? { domain: true } : null;
9398
9429
  };
9399
9430
 
9431
+ var TooltipService = /** @class */ (function () {
9432
+ function TooltipService(overlay) {
9433
+ this.overlay = overlay;
9434
+ this.positions = {
9435
+ 'top-left': { originX: 'center', originY: 'top', overlayX: 'end', overlayY: 'bottom', offsetX: 38 },
9436
+ 'top-center': { originX: 'center', originY: 'top', overlayX: 'center', overlayY: 'bottom' },
9437
+ 'top-right': { originX: 'center', originY: 'top', overlayX: 'start', overlayY: 'bottom', offsetX: -38 },
9438
+ 'bottom-left': { originX: 'center', originY: 'bottom', overlayX: 'end', overlayY: 'top', offsetX: 38 },
9439
+ 'bottom-center': { originX: 'center', originY: 'bottom', overlayX: 'center', overlayY: 'top' },
9440
+ 'bottom-right': { originX: 'center', originY: 'bottom', overlayX: 'start', overlayY: 'top', offsetX: -38 },
9441
+ 'left-top': { originX: 'start', originY: 'center', overlayX: 'end', overlayY: 'top', offsetY: -38 },
9442
+ 'left-center': { originX: 'start', originY: 'center', overlayX: 'end', overlayY: 'center' },
9443
+ 'left-bottom': { originX: 'start', originY: 'center', overlayX: 'end', overlayY: 'bottom', offsetY: 38 },
9444
+ 'right-top': { originX: 'end', originY: 'center', overlayX: 'start', overlayY: 'top', offsetY: -38 },
9445
+ 'right-center': { originX: 'end', originY: 'center', overlayX: 'start', overlayY: 'center' },
9446
+ 'right-bottom': { originX: 'end', originY: 'center', overlayX: 'start', overlayY: 'bottom', offsetY: 38 }
9447
+ };
9448
+ }
9449
+ /**
9450
+ * Show a tooltip attached to a specified element
9451
+ */
9452
+ TooltipService.prototype.show = function (anchor, position, options) {
9453
+ if (position === void 0) { position = 'top-center'; }
9454
+ var overlayConfig = this.getOverlayConfig(anchor, this.positions[position], options === null || options === void 0 ? void 0 : options.width);
9455
+ var overlayRef = this.overlay.create(overlayConfig);
9456
+ var contentPortal = new portal.ComponentPortal(TooltipComponent);
9457
+ var contentViewRef = overlayRef.attach(contentPortal);
9458
+ contentViewRef.instance.position = position;
9459
+ contentViewRef.instance.id = options === null || options === void 0 ? void 0 : options.id;
9460
+ contentViewRef.instance.title = options === null || options === void 0 ? void 0 : options.title;
9461
+ contentViewRef.instance.subtitle = options === null || options === void 0 ? void 0 : options.subtitle;
9462
+ contentViewRef.instance.text = options === null || options === void 0 ? void 0 : options.text;
9463
+ contentViewRef.instance.customContent = options === null || options === void 0 ? void 0 : options.customContent;
9464
+ contentViewRef.instance.dismissible = (options === null || options === void 0 ? void 0 : options.dismissible) || false;
9465
+ contentViewRef.instance.backgroundColor = options === null || options === void 0 ? void 0 : options.backgroundColor;
9466
+ contentViewRef.instance.overlayRef = overlayRef;
9467
+ return contentViewRef.instance;
9468
+ };
9469
+ TooltipService.prototype.getOverlayConfig = function (element, position, width) {
9470
+ var positionStrategy = this.overlay.position()
9471
+ .flexibleConnectedTo(element)
9472
+ .withPositions([position]);
9473
+ var config = new i1$2.OverlayConfig({
9474
+ positionStrategy: positionStrategy,
9475
+ width: width
9476
+ });
9477
+ return config;
9478
+ };
9479
+ return TooltipService;
9480
+ }());
9481
+ TooltipService.ɵprov = i0.ɵɵdefineInjectable({ factory: function TooltipService_Factory() { return new TooltipService(i0.ɵɵinject(i1$2.Overlay)); }, token: TooltipService, providedIn: "root" });
9482
+ TooltipService.decorators = [
9483
+ { type: i0.Injectable, args: [{
9484
+ providedIn: 'root'
9485
+ },] }
9486
+ ];
9487
+ TooltipService.ctorParameters = function () { return [
9488
+ { type: i1$2.Overlay }
9489
+ ]; };
9490
+
9400
9491
  (function (PageStatus) {
9401
9492
  PageStatus["Loading"] = "loading";
9402
9493
  PageStatus["Loaded"] = "loaded";
@@ -10512,6 +10603,8 @@
10512
10603
  exports.ToastEvent = ToastEvent;
10513
10604
  exports.ToastService = ToastService;
10514
10605
  exports.ToasterComponent = ToasterComponent;
10606
+ exports.TooltipComponent = TooltipComponent;
10607
+ exports.TooltipService = TooltipService;
10515
10608
  exports.TreeComponent = TreeComponent;
10516
10609
  exports.UnicodeStrings = UnicodeStrings;
10517
10610
  exports.UserPreferenceService = UserPreferenceService;