I am trying to set the ellipsis based on the width of the container, I can do this but when text is ellipsed I wanted to show complete label in tooltip[here eg-tooltip] my costume lit component
labelRendererWithExoTooltip(node: TreeNode) {
const purifyLabel = DOMPurify.sanitize(node.label);
const labelElement = html`<span>${purifyLabel}</span>`;
const container = this.shadowRoot?.querySelector(".main__tree-class");
const containerWidth = container
? container.getBoundingClientRect().width
: 0;
if (containerWidth && labelElement instanceof HTMLElement) {
const labelWidth = labelElement.getBoundingClientRect().width;
if (labelWidth > containerWidth) {
return html`
<ex-tooltip>
<span
style="white-space: initial; word-break: break-word; display: flex; width: ${containerWidth}px;"
>
${purifyLabel}
</span>
<span slot="anchor">${purifyLabel}</span>
</ex-tooltip>
`;
}
}
return labelElement;
}
show the complete label in tooltip when label is truncated based on width of the container