/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE  AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE:  you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import { TypeRegistrar } from "igniteui-webcomponents-core/ES2015/type";
import { html, render } from "igniteui-webcomponents-core/ES2015/template";
export class IgcSimpleDefaultTooltipComponent extends HTMLElement {
    constructor() {
        super();
        this.tooltip = (context) => context ? html `
    <div class='ui-simple-default-tooltip-content'>
        <span  style="white-space: nowrap;font-weight: bold;" >${this.getLabel(context)}</span>
    </div>
` : html ``;
    }
    ensureDefaultTooltip(gauge) {
        if (gauge.showToolTip) {
            gauge.tooltipTemplate = this.tooltip;
        }
        else {
            gauge.tooltipTemplate = null;
        }
    }
    getLabel(context) {
        if (context.itemName == null) {
            let label = context.label.split(":");
            return label.length < 2 ? context.label : label[1].trim();
        }
        return context.label;
    }
    connectedCallback() {
        this.attachedCallback();
    }
    render(context) {
        if (this.tooltip) {
            let templ = this.tooltip(context);
            render(templ, this);
        }
    }
    attachedCallback() {
        if (this.onContentReady) {
            this.onContentReady();
        }
    }
    static register() {
        if (!IgcSimpleDefaultTooltipComponent._registered) {
            IgcSimpleDefaultTooltipComponent._registered = true;
            if (window.customElements) {
                window.customElements.define(IgcSimpleDefaultTooltipComponent.htmlTagName, IgcSimpleDefaultTooltipComponent);
            }
            else {
                document.registerElement(IgcSimpleDefaultTooltipComponent.htmlTagName, IgcSimpleDefaultTooltipComponent);
            }
            TypeRegistrar.registerCons("IgcSimpleDefaultTooltipComponent", IgcSimpleDefaultTooltipComponent);
        }
    }
}
IgcSimpleDefaultTooltipComponent._registered = false;
IgcSimpleDefaultTooltipComponent.htmlTagName = "igc-simple-default-tooltip";
