@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.
@@ -644,12 +644,12 @@
644
644
  var inputFocus = this.focusedInputRef;
645
645
  var icon_1 = this.getIconFromFocusedInput();
646
646
  this.renderer.listen(this.focusedInputRef, "focus", function () {
647
- if (icon_1 && _this.isMatchingTooltip(icon_1)) {
647
+ if (icon_1) {
648
648
  _this.createTootipByFocus(icon_1);
649
649
  }
650
650
  });
651
651
  this.renderer.listen(inputFocus, "blur", function () {
652
- if (icon_1 && _this.isMatchingTooltip(icon_1)) {
652
+ if (icon_1) {
653
653
  _this.removeTooltip(icon_1);
654
654
  _this.destroy();
655
655
  }
@@ -663,15 +663,6 @@
663
663
  TooltipDirective.prototype.getIconFromFocusedInput = function () {
664
664
  return this.elementRef.nativeElement;
665
665
  };
666
- /**
667
- * Verifica se o ícone tem o tooltip correspondente ao atual.
668
- * @param icon O ícone do input em focus.
669
- * @returns true se o tooltip corresponde; caso contrário, false.
670
- */
671
- TooltipDirective.prototype.isMatchingTooltip = function (icon) {
672
- var tooltipText = icon.getAttribute("ng-reflect-tooltip");
673
- return this.tooltip === tooltipText;
674
- };
675
666
  /**
676
667
  * Remove o tooltip associado ao ícone do input em focus.
677
668
  * @param icon O ícone do input em focus.
@@ -768,9 +759,10 @@
768
759
  var tooltip_1 = domElem.querySelector(".tooltip");
769
760
  icon.appendChild(tooltip_1);
770
761
  this.setTooltipComponentProperties();
762
+ this.setTooltipPositionProperty(icon);
771
763
  setTimeout(function () { return tooltip_1.classList.add("tooltip--visible"); }, 0);
772
764
  this.renderer.listen(window, "scroll", function () {
773
- _this.setTooltipPositionProperty();
765
+ _this.setTooltipPositionProperty(icon);
774
766
  });
775
767
  }
776
768
  };
@@ -781,11 +773,11 @@
781
773
  window.addEventListener("mousemove", this.boundOnWindowMouseMoveFunction);
782
774
  }
783
775
  };
784
- TooltipDirective.prototype.setTooltipPositionProperty = function () {
776
+ TooltipDirective.prototype.setTooltipPositionProperty = function (element) {
785
777
  var e_1, _a;
786
778
  var margin = 20;
787
779
  var anchorSize = 5;
788
- var domElem = this.componentRef.hostView.rootNodes[0].querySelector("#tooltip");
780
+ var domElem = element || this.componentRef.hostView.rootNodes[0].querySelector("#tooltip");
789
781
  var _b = domElem.getBoundingClientRect(), height = _b.height, width = _b.width;
790
782
  var _c = this.elementRef.nativeElement.getBoundingClientRect(), left = _c.left, right = _c.right, top = _c.top, bottom = _c.bottom;
791
783
  var positions = [
@@ -810,31 +802,33 @@
810
802
  set: function () { return ({ left: right + margin, top: top + height / 2 - anchorSize }); },
811
803
  },
812
804
  ];
813
- try {
814
- for (var positions_1 = __values(positions), positions_1_1 = positions_1.next(); !positions_1_1.done; positions_1_1 = positions_1.next()) {
815
- var _d = positions_1_1.value, pos = _d.pos, check = _d.check, set = _d.set;
816
- if (check()) {
817
- this.position = pos;
818
- var _e = set(), left_1 = _e.left, top_1 = _e.top;
819
- this.componentRef.instance.left = Math.round(left_1);
820
- this.componentRef.instance.top = Math.round(top_1);
821
- this.componentRef.instance.position = this.position;
822
- return;
805
+ if (this.componentRef) {
806
+ try {
807
+ for (var positions_1 = __values(positions), positions_1_1 = positions_1.next(); !positions_1_1.done; positions_1_1 = positions_1.next()) {
808
+ var _d = positions_1_1.value, pos = _d.pos, check = _d.check, set = _d.set;
809
+ if (check()) {
810
+ this.position = pos;
811
+ var _e = set(), left_1 = _e.left, top_1 = _e.top;
812
+ this.componentRef.instance.left = Math.round(left_1);
813
+ this.componentRef.instance.top = Math.round(top_1);
814
+ this.componentRef.instance.position = this.position;
815
+ return;
816
+ }
823
817
  }
824
818
  }
825
- }
826
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
827
- finally {
828
- try {
829
- if (positions_1_1 && !positions_1_1.done && (_a = positions_1.return)) _a.call(positions_1);
819
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
820
+ finally {
821
+ try {
822
+ if (positions_1_1 && !positions_1_1.done && (_a = positions_1.return)) _a.call(positions_1);
823
+ }
824
+ finally { if (e_1) throw e_1.error; }
830
825
  }
831
- finally { if (e_1) throw e_1.error; }
826
+ // Se não conseguir posicionar, mostrar abaixo
827
+ this.position = exports.TooltipPosition.Bottom;
828
+ this.componentRef.instance.left = Math.round(left + (right - left) / 2);
829
+ this.componentRef.instance.top = Math.round(bottom + margin);
830
+ this.componentRef.instance.position = this.position;
832
831
  }
833
- // Se não conseguir posicionar, mostrar abaixo
834
- this.position = exports.TooltipPosition.Bottom;
835
- this.componentRef.instance.left = Math.round(left + (right - left) / 2);
836
- this.componentRef.instance.top = Math.round(bottom + margin);
837
- this.componentRef.instance.position = this.position;
838
832
  };
839
833
  TooltipDirective.prototype.setTooltipComponentProperties = function () {
840
834
  if (this.componentRef !== null) {
@@ -7080,7 +7074,7 @@
7080
7074
  EmptyStateComponent = EmptyStateComponent_1 = __decorate([
7081
7075
  core.Component({
7082
7076
  selector: "s-empty-state",
7083
- 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>",
7077
+ 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>",
7084
7078
  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%}"]
7085
7079
  })
7086
7080
  ], EmptyStateComponent);