@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.
@@ -466,12 +466,12 @@ let TooltipDirective = class TooltipDirective {
466
466
  const inputFocus = this.focusedInputRef;
467
467
  const icon = this.getIconFromFocusedInput();
468
468
  this.renderer.listen(this.focusedInputRef, "focus", () => {
469
- if (icon && this.isMatchingTooltip(icon)) {
469
+ if (icon) {
470
470
  this.createTootipByFocus(icon);
471
471
  }
472
472
  });
473
473
  this.renderer.listen(inputFocus, "blur", () => {
474
- if (icon && this.isMatchingTooltip(icon)) {
474
+ if (icon) {
475
475
  this.removeTooltip(icon);
476
476
  this.destroy();
477
477
  }
@@ -485,15 +485,6 @@ let TooltipDirective = class TooltipDirective {
485
485
  getIconFromFocusedInput() {
486
486
  return this.elementRef.nativeElement;
487
487
  }
488
- /**
489
- * Verifica se o ícone tem o tooltip correspondente ao atual.
490
- * @param icon O ícone do input em focus.
491
- * @returns true se o tooltip corresponde; caso contrário, false.
492
- */
493
- isMatchingTooltip(icon) {
494
- const tooltipText = icon.getAttribute("ng-reflect-tooltip");
495
- return this.tooltip === tooltipText;
496
- }
497
488
  /**
498
489
  * Remove o tooltip associado ao ícone do input em focus.
499
490
  * @param icon O ícone do input em focus.
@@ -589,9 +580,10 @@ let TooltipDirective = class TooltipDirective {
589
580
  const tooltip = domElem.querySelector(".tooltip");
590
581
  icon.appendChild(tooltip);
591
582
  this.setTooltipComponentProperties();
583
+ this.setTooltipPositionProperty(icon);
592
584
  setTimeout(() => tooltip.classList.add("tooltip--visible"), 0);
593
585
  this.renderer.listen(window, "scroll", () => {
594
- this.setTooltipPositionProperty();
586
+ this.setTooltipPositionProperty(icon);
595
587
  });
596
588
  }
597
589
  }
@@ -602,10 +594,10 @@ let TooltipDirective = class TooltipDirective {
602
594
  window.addEventListener("mousemove", this.boundOnWindowMouseMoveFunction);
603
595
  }
604
596
  }
605
- setTooltipPositionProperty() {
597
+ setTooltipPositionProperty(element) {
606
598
  const margin = 20;
607
599
  const anchorSize = 5;
608
- const domElem = this.componentRef.hostView.rootNodes[0].querySelector("#tooltip");
600
+ const domElem = element || this.componentRef.hostView.rootNodes[0].querySelector("#tooltip");
609
601
  const { height, width } = domElem.getBoundingClientRect();
610
602
  const { left, right, top, bottom } = this.elementRef.nativeElement.getBoundingClientRect();
611
603
  const positions = [
@@ -630,21 +622,23 @@ let TooltipDirective = class TooltipDirective {
630
622
  set: () => ({ left: right + margin, top: top + height / 2 - anchorSize }),
631
623
  },
632
624
  ];
633
- for (const { pos, check, set } of positions) {
634
- if (check()) {
635
- this.position = pos;
636
- const { left, top } = set();
637
- this.componentRef.instance.left = Math.round(left);
638
- this.componentRef.instance.top = Math.round(top);
639
- this.componentRef.instance.position = this.position;
640
- return;
625
+ if (this.componentRef) {
626
+ for (const { pos, check, set } of positions) {
627
+ if (check()) {
628
+ this.position = pos;
629
+ const { left, top } = set();
630
+ this.componentRef.instance.left = Math.round(left);
631
+ this.componentRef.instance.top = Math.round(top);
632
+ this.componentRef.instance.position = this.position;
633
+ return;
634
+ }
641
635
  }
636
+ // Se não conseguir posicionar, mostrar abaixo
637
+ this.position = TooltipPosition.Bottom;
638
+ this.componentRef.instance.left = Math.round(left + (right - left) / 2);
639
+ this.componentRef.instance.top = Math.round(bottom + margin);
640
+ this.componentRef.instance.position = this.position;
642
641
  }
643
- // Se não conseguir posicionar, mostrar abaixo
644
- this.position = TooltipPosition.Bottom;
645
- this.componentRef.instance.left = Math.round(left + (right - left) / 2);
646
- this.componentRef.instance.top = Math.round(bottom + margin);
647
- this.componentRef.instance.position = this.position;
648
642
  }
649
643
  setTooltipComponentProperties() {
650
644
  if (this.componentRef !== null) {
@@ -6535,7 +6529,7 @@ __decorate([
6535
6529
  EmptyStateComponent = EmptyStateComponent_1 = __decorate([
6536
6530
  Component({
6537
6531
  selector: `s-empty-state`,
6538
- 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>",
6532
+ 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>",
6539
6533
  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%}"]
6540
6534
  })
6541
6535
  ], EmptyStateComponent);