@klippa/ngx-enhancy-forms 20.0.11 → 20.0.13

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.
@@ -2946,7 +2946,7 @@ class WithTooltipDirective {
2946
2946
  this.hookDiv = document.createElement('div');
2947
2947
  const top = el.nativeElement.getBoundingClientRect().top;
2948
2948
  const left = el.nativeElement.getBoundingClientRect().left;
2949
- el.nativeElement.prepend(this.hookDiv);
2949
+ document.body.appendChild(this.hookDiv);
2950
2950
  this.div = document.createElement('div');
2951
2951
  this.div.style.zIndex = `${zIndexStart + 2}`;
2952
2952
  this.div.style.color = `${colors[this.klpWithTooltip].noAlpha}`;
@@ -3019,7 +3019,6 @@ class WithTooltipDirective {
3019
3019
  this.triangleWhite.style.top = `${top + el.nativeElement.getBoundingClientRect().height}px`;
3020
3020
  this.triangleWhite.style.left = `${left}px`;
3021
3021
  this.triangleWhite.style.transform = `translate(calc(-100% + ${el.nativeElement.getBoundingClientRect().width}px), calc(0% - 0.15rem + 2px)) rotate(180deg)`;
3022
- // this.triangleWhite.style.transform = `translate(${el.nativeElement.getBoundingClientRect().width}px) translateY(${el.nativeElement.getBoundingClientRect().height}px) translate(-100%, -2px) rotate(180deg)`;
3023
3022
  }
3024
3023
  this.triangleWhite.style.width = '0';
3025
3024
  this.triangleWhite.style.height = '0';
@@ -3039,34 +3038,32 @@ class WithTooltipDirective {
3039
3038
  this.hookDiv.prepend(this.triangleWhite);
3040
3039
  });
3041
3040
  el.nativeElement.addEventListener('mouseleave', () => {
3042
- if (this.tooltipTemplate) {
3043
- this.cleanUpTemplate();
3044
- }
3045
- try {
3046
- el.nativeElement.removeChild(this.div);
3047
- }
3048
- catch (ex) { }
3049
- try {
3050
- el.nativeElement.removeChild(this.triangle);
3051
- }
3052
- catch (ex) { }
3053
- try {
3054
- el.nativeElement.removeChild(this.triangleWhite);
3055
- }
3056
- catch (ex) { }
3057
- try {
3058
- el.nativeElement.removeChild(this.hookDiv);
3059
- }
3060
- catch (ex) { }
3041
+ this.cleanUpTooltipFromDom();
3061
3042
  });
3062
3043
  });
3063
3044
  }
3045
+ cleanUpTooltipFromDom() {
3046
+ if (this.tooltipTemplate) {
3047
+ this.cleanUpTemplate();
3048
+ }
3049
+ try {
3050
+ document.body.removeChild(this.hookDiv);
3051
+ }
3052
+ catch (ex) {
3053
+ }
3054
+ }
3055
+ ngOnDestroy() {
3056
+ this.cleanUpTooltipFromDom();
3057
+ }
3064
3058
  hookUpTemplate() {
3065
3059
  this.viewRefForTemplate = this.tooltipTemplate.createEmbeddedView(null);
3066
3060
  this.appRef.attachView(this.viewRefForTemplate);
3067
3061
  this.templateInstance = this.viewRefForTemplate.rootNodes[0];
3068
3062
  }
3069
3063
  cleanUpTemplate() {
3064
+ if (!isValueSet(this.viewRefForTemplate)) {
3065
+ return;
3066
+ }
3070
3067
  this.appRef.detachView(this.viewRefForTemplate);
3071
3068
  this.viewRefForTemplate.destroy();
3072
3069
  }