@energycap/components 0.32.24 → 0.32.25

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.
@@ -9531,9 +9531,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
9531
9531
  }] } });
9532
9532
 
9533
9533
  class TooltipDirective {
9534
- constructor(tooltipService, element) {
9534
+ constructor(tooltipService, element, renderer2) {
9535
9535
  this.tooltipService = tooltipService;
9536
9536
  this.element = element;
9537
+ this.renderer2 = renderer2;
9537
9538
  //TooltipConfig: receives all the tooltip options to overwrite the
9538
9539
  //default configuration of the tooltip
9539
9540
  this.tooltipConfig = undefined;
@@ -9553,6 +9554,10 @@ class TooltipDirective {
9553
9554
  //Object with the tooltip options builded with the Input parameters
9554
9555
  //and use it in tooltipService - show()
9555
9556
  this.tooltipOptions = {};
9557
+ /**Set when we show a tooltip, to allow us to unsubscribe to mouse move when hide fires.
9558
+ * if we never showed the tooltip this will remain null and we won't have an event to unsubscribe to
9559
+ */
9560
+ this.mouseMoveUnsubscribe = null;
9556
9561
  }
9557
9562
  ngOnInit() {
9558
9563
  //checkInputsValue(): if there is an error it will prevent to execute
@@ -9573,7 +9578,9 @@ class TooltipDirective {
9573
9578
  console.error('There are too many parameters or none parameter to config the tooltip options');
9574
9579
  }
9575
9580
  }
9576
- //Detects where the mouse is to trigger the leave/hide process
9581
+ /**Detects where the mouse is to trigger the leave/hide process
9582
+ * This is a backstop protection against us missing the mouseleave event and leaving a hanging chad.
9583
+ * On some browsers, and on some actions (especially scroll) the mouseLeave seems to never fire */
9577
9584
  onMouseMove(event) {
9578
9585
  let callCallback = false;
9579
9586
  if (this.contentRect) {
@@ -9641,6 +9648,7 @@ class TooltipDirective {
9641
9648
  //tooltipPosition is never undefined, default value = "top-center"
9642
9649
  if (!this.tooltip) {
9643
9650
  this.tooltip = this.tooltipService.show(element, this.tooltipPosition, this.tooltipOptions);
9651
+ this.mouseMoveUnsubscribe = this.renderer2.listen(document, 'mousemove', this.onMouseMove.bind(this));
9644
9652
  }
9645
9653
  }
9646
9654
  hide() {
@@ -9651,6 +9659,9 @@ class TooltipDirective {
9651
9659
  //Call the hide() from the tooltip component
9652
9660
  this.tooltip.hide();
9653
9661
  this.tooltip = undefined;
9662
+ if (this.mouseMoveUnsubscribe) {
9663
+ this.mouseMoveUnsubscribe();
9664
+ }
9654
9665
  }
9655
9666
  //Interrupt the flow of mouseover with a delay and triggers the
9656
9667
  //flow to hide the tooltip with a delay
@@ -9664,14 +9675,14 @@ class TooltipDirective {
9664
9675
  this.interrupt.next();
9665
9676
  }
9666
9677
  }
9667
- TooltipDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: TooltipDirective, deps: [{ token: TooltipService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
9668
- TooltipDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0", type: TooltipDirective, selector: "[ecTooltip]", inputs: { tooltipConfig: "tooltipConfig", tooltipText: "tooltipText", tooltipCustomContent: "tooltipCustomContent", tooltipPosition: "tooltipPosition" }, host: { listeners: { "document:mousemove": "onMouseMove($event)", "mouseover": "onMouseOver()", "mouseleave": "onLeave()" } }, ngImport: i0 });
9678
+ TooltipDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: TooltipDirective, deps: [{ token: TooltipService }, { token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
9679
+ TooltipDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0", type: TooltipDirective, selector: "[ecTooltip]", inputs: { tooltipConfig: "tooltipConfig", tooltipText: "tooltipText", tooltipCustomContent: "tooltipCustomContent", tooltipPosition: "tooltipPosition" }, host: { listeners: { "mouseover": "onMouseOver()", "mouseleave": "onLeave()" } }, ngImport: i0 });
9669
9680
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: TooltipDirective, decorators: [{
9670
9681
  type: Directive,
9671
9682
  args: [{
9672
9683
  selector: '[ecTooltip]'
9673
9684
  }]
9674
- }], ctorParameters: function () { return [{ type: TooltipService }, { type: i0.ElementRef }]; }, propDecorators: { tooltipConfig: [{
9685
+ }], ctorParameters: function () { return [{ type: TooltipService }, { type: i0.ElementRef }, { type: i0.Renderer2 }]; }, propDecorators: { tooltipConfig: [{
9675
9686
  type: Input
9676
9687
  }], tooltipText: [{
9677
9688
  type: Input
@@ -9679,9 +9690,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
9679
9690
  type: Input
9680
9691
  }], tooltipPosition: [{
9681
9692
  type: Input
9682
- }], onMouseMove: [{
9683
- type: HostListener,
9684
- args: ['document:mousemove', ['$event']]
9685
9693
  }], onMouseOver: [{
9686
9694
  type: HostListener,
9687
9695
  args: ['mouseover']