@seniorsistemas/angular-components 17.10.9 → 17.10.10

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.
@@ -498,12 +498,12 @@ var TooltipDirective = /** @class */ (function () {
498
498
  var inputFocus = this.focusedInputRef;
499
499
  var icon_1 = this.getIconFromFocusedInput();
500
500
  this.renderer.listen(this.focusedInputRef, "focus", function () {
501
- if (icon_1 && _this.isMatchingTooltip(icon_1)) {
501
+ if (icon_1) {
502
502
  _this.createTootipByFocus(icon_1);
503
503
  }
504
504
  });
505
505
  this.renderer.listen(inputFocus, "blur", function () {
506
- if (icon_1 && _this.isMatchingTooltip(icon_1)) {
506
+ if (icon_1) {
507
507
  _this.removeTooltip(icon_1);
508
508
  _this.destroy();
509
509
  }
@@ -517,15 +517,6 @@ var TooltipDirective = /** @class */ (function () {
517
517
  TooltipDirective.prototype.getIconFromFocusedInput = function () {
518
518
  return this.elementRef.nativeElement;
519
519
  };
520
- /**
521
- * Verifica se o ícone tem o tooltip correspondente ao atual.
522
- * @param icon O ícone do input em focus.
523
- * @returns true se o tooltip corresponde; caso contrário, false.
524
- */
525
- TooltipDirective.prototype.isMatchingTooltip = function (icon) {
526
- var tooltipText = icon.getAttribute("ng-reflect-tooltip");
527
- return this.tooltip === tooltipText;
528
- };
529
520
  /**
530
521
  * Remove o tooltip associado ao ícone do input em focus.
531
522
  * @param icon O ícone do input em focus.
@@ -622,9 +613,10 @@ var TooltipDirective = /** @class */ (function () {
622
613
  var tooltip_1 = domElem.querySelector(".tooltip");
623
614
  icon.appendChild(tooltip_1);
624
615
  this.setTooltipComponentProperties();
616
+ this.setTooltipPositionProperty(icon);
625
617
  setTimeout(function () { return tooltip_1.classList.add("tooltip--visible"); }, 0);
626
618
  this.renderer.listen(window, "scroll", function () {
627
- _this.setTooltipPositionProperty();
619
+ _this.setTooltipPositionProperty(icon);
628
620
  });
629
621
  }
630
622
  };
@@ -635,11 +627,11 @@ var TooltipDirective = /** @class */ (function () {
635
627
  window.addEventListener("mousemove", this.boundOnWindowMouseMoveFunction);
636
628
  }
637
629
  };
638
- TooltipDirective.prototype.setTooltipPositionProperty = function () {
630
+ TooltipDirective.prototype.setTooltipPositionProperty = function (element) {
639
631
  var e_1, _a;
640
632
  var margin = 20;
641
633
  var anchorSize = 5;
642
- var domElem = this.componentRef.hostView.rootNodes[0].querySelector("#tooltip");
634
+ var domElem = element || this.componentRef.hostView.rootNodes[0].querySelector("#tooltip");
643
635
  var _b = domElem.getBoundingClientRect(), height = _b.height, width = _b.width;
644
636
  var _c = this.elementRef.nativeElement.getBoundingClientRect(), left = _c.left, right = _c.right, top = _c.top, bottom = _c.bottom;
645
637
  var positions = [
@@ -664,31 +656,33 @@ var TooltipDirective = /** @class */ (function () {
664
656
  set: function () { return ({ left: right + margin, top: top + height / 2 - anchorSize }); },
665
657
  },
666
658
  ];
667
- try {
668
- for (var positions_1 = __values(positions), positions_1_1 = positions_1.next(); !positions_1_1.done; positions_1_1 = positions_1.next()) {
669
- var _d = positions_1_1.value, pos = _d.pos, check = _d.check, set = _d.set;
670
- if (check()) {
671
- this.position = pos;
672
- var _e = set(), left_1 = _e.left, top_1 = _e.top;
673
- this.componentRef.instance.left = Math.round(left_1);
674
- this.componentRef.instance.top = Math.round(top_1);
675
- this.componentRef.instance.position = this.position;
676
- return;
659
+ if (this.componentRef) {
660
+ try {
661
+ for (var positions_1 = __values(positions), positions_1_1 = positions_1.next(); !positions_1_1.done; positions_1_1 = positions_1.next()) {
662
+ var _d = positions_1_1.value, pos = _d.pos, check = _d.check, set = _d.set;
663
+ if (check()) {
664
+ this.position = pos;
665
+ var _e = set(), left_1 = _e.left, top_1 = _e.top;
666
+ this.componentRef.instance.left = Math.round(left_1);
667
+ this.componentRef.instance.top = Math.round(top_1);
668
+ this.componentRef.instance.position = this.position;
669
+ return;
670
+ }
677
671
  }
678
672
  }
679
- }
680
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
681
- finally {
682
- try {
683
- if (positions_1_1 && !positions_1_1.done && (_a = positions_1.return)) _a.call(positions_1);
673
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
674
+ finally {
675
+ try {
676
+ if (positions_1_1 && !positions_1_1.done && (_a = positions_1.return)) _a.call(positions_1);
677
+ }
678
+ finally { if (e_1) throw e_1.error; }
684
679
  }
685
- finally { if (e_1) throw e_1.error; }
680
+ // Se não conseguir posicionar, mostrar abaixo
681
+ this.position = TooltipPosition.Bottom;
682
+ this.componentRef.instance.left = Math.round(left + (right - left) / 2);
683
+ this.componentRef.instance.top = Math.round(bottom + margin);
684
+ this.componentRef.instance.position = this.position;
686
685
  }
687
- // Se não conseguir posicionar, mostrar abaixo
688
- this.position = TooltipPosition.Bottom;
689
- this.componentRef.instance.left = Math.round(left + (right - left) / 2);
690
- this.componentRef.instance.top = Math.round(bottom + margin);
691
- this.componentRef.instance.position = this.position;
692
686
  };
693
687
  TooltipDirective.prototype.setTooltipComponentProperties = function () {
694
688
  if (this.componentRef !== null) {
@@ -6934,7 +6928,7 @@ var EmptyStateComponent = /** @class */ (function () {
6934
6928
  EmptyStateComponent = EmptyStateComponent_1 = __decorate([
6935
6929
  Component({
6936
6930
  selector: "s-empty-state",
6937
- template: "<div [id]=\"id\" class=\"container\">\n <div [id]=\"id + '-icon'\" class=\"icon\">\n <i [attr.class]=\"iconClass ? iconClass : 'fa fa-cogs'\" aria-hidden=\"true\"></i>\n </div>\n <div [id]=\"id + '-title'\" class=\"title\">{{title}}</div>\n <div [id]=\"id + '-description'\" class=\"description\" *ngIf=\"description\">\n <p>{{description}}</p>\n </div>\n <div [id]=\"id + '-actions'\" class=\"actions\" *ngIf=\"showPrimaryAction && primaryActionLabel\">\n <s-button [id]=\"id + '-primary-action'\" type=\"button\" [label]=\"primaryActionLabel\"\n [model]=\"primaryModel\" (click)=\"primaryAction.next()\"></s-button>\n <s-button [id]=\"id + '-secondary-action'\" *ngIf=\"showSecondaryAction && secondaryActionLabel\" id=\"secondaryAction\" type=\"button\"\n [label]=\"secondaryActionLabel\" priority=\"link\" (click)=\"secondaryAction.next()\"></s-button>\n </div>\n</div>",
6931
+ template: "<div [id]=\"id\" class=\"container\">\n <div [id]=\"id + '-icon'\" class=\"icon\">\n <i [attr.class]=\"iconClass ? iconClass : 'fa fa-cogs'\" aria-hidden=\"true\"></i>\n </div>\n <div [id]=\"id + '-title'\" class=\"title\">{{title}}</div>\n <div [id]=\"id + '-description'\" class=\"description\" *ngIf=\"description\">\n <p>{{description}}</p>\n </div>\n <div [id]=\"id + '-actions'\" class=\"actions\" *ngIf=\"showPrimaryAction && primaryActionLabel\">\n <s-button [id]=\"id + '-primary-action'\" type=\"button\" [label]=\"primaryActionLabel\"\n [model]=\"primaryModel\" (onClick)=\"primaryAction.next()\"></s-button>\n <s-button [id]=\"id + '-secondary-action'\" *ngIf=\"showSecondaryAction && secondaryActionLabel\" id=\"secondaryAction\" type=\"button\"\n [label]=\"secondaryActionLabel\" priority=\"link\" (onClick)=\"secondaryAction.next()\"></s-button>\n </div>\n</div>",
6938
6932
  styles: [".container{width:100%;text-align:center}.title{font-weight:700;margin-bottom:10px}.description{margin-bottom:15px;color:#999;padding:0 20px;text-align:center}.description>p{margin:auto;max-width:400px;max-height:80px;overflow:hidden}.icon{color:#d8d8d8;font-size:6em}.actions{text-align:center;width:100%}"]
6939
6933
  })
6940
6934
  ], EmptyStateComponent);