diff --git a/projects/demo/src/app/demo/demo.component.html b/projects/demo/src/app/demo/demo.component.html index 2c84152..23c44fc 100644 --- a/projects/demo/src/app/demo/demo.component.html +++ b/projects/demo/src/app/demo/demo.component.html @@ -68,7 +68,7 @@ -
I am a small bit of text
+
I am a small bit of text
diff --git a/projects/klippa/ngx-enhancy-forms/package.json b/projects/klippa/ngx-enhancy-forms/package.json index 1bf9403..800b2e0 100644 --- a/projects/klippa/ngx-enhancy-forms/package.json +++ b/projects/klippa/ngx-enhancy-forms/package.json @@ -1,6 +1,6 @@ { "name": "@klippa/ngx-enhancy-forms", - "version": "14.19.2", + "version": "14.19.3", "publishConfig": { "access": "public" }, diff --git a/projects/klippa/ngx-enhancy-forms/src/lib/withTooltip.component.ts b/projects/klippa/ngx-enhancy-forms/src/lib/withTooltip.component.ts index 7d361ab..f8a6321 100644 --- a/projects/klippa/ngx-enhancy-forms/src/lib/withTooltip.component.ts +++ b/projects/klippa/ngx-enhancy-forms/src/lib/withTooltip.component.ts @@ -16,12 +16,14 @@ export class WithTooltipDirective { private triangle: HTMLElement; private triangleWhite: HTMLElement; @Input() klpWithTooltip: 'orange'| 'black' = 'orange'; + @Input() tooltipText: string; constructor(el: ElementRef) { el.nativeElement.addEventListener('mouseenter', () => { + const textToDisplay = this.tooltipText || el.nativeElement.innerText.trim(); if (!stringIsSetAndFilled(this.klpWithTooltip)) { return; } - if (el.nativeElement.innerText.trim().length < 1) { + if (textToDisplay.length < 1) { return; } if (el.nativeElement.offsetWidth >= el.nativeElement.scrollWidth) { @@ -46,7 +48,7 @@ export class WithTooltipDirective { this.div.style.padding = '0.3rem 0.5rem'; this.div.style.boxSizing = 'border-box'; this.div.style.borderRadius = '3px'; - this.div.textContent = el.nativeElement.innerText; + this.div.textContent = textToDisplay; el.nativeElement.prepend(this.div); this.triangle = document.createElement('div');