"use strict";const t=require("vue"),m=require("../Shared/base-iCmnU-fv.js"),h=require("../Web/__directive__/Tooltip.cjs"),P=["title"],v=t.defineComponent({name:"ClEllipsis",directives:{cltooltip:h.tooltipDirectives},__name:"Index",props:{className:{},text:{},isUseTooltip:{type:Boolean},tooltipTheme:{},tooltipPosition:{},tooltipTrigger:{},tooltipIsHtml:{type:Boolean},tooltipHtml:{},isAutoTooltip:{type:Boolean},isShowTitle:{type:Boolean}},setup(e){const i=e,c=t.ref(null),a=t.ref(null),l=t.reactive({isPosParent:!1,isPosSpan:!1,isUseTooltip:!1}),u=t.computed(()=>{let o="";return i.isUseTooltip||l.isUseTooltip?o="":o=i.isShowTitle&&i.text||"",o}),T=t.computed(()=>{const o={"panel-ellipsis":!0,"ellipsis-txt-title":!0};return i.className&&!m.CommonBase.isEmpty(i.className)&&i.className.split(" ").forEach(s=>{m.CommonBase.isEmpty(s)||(o[s]=!0)}),o}),r=()=>{if(i.isUseTooltip&&i.text&&i.text.length>0&&c.value&&a.value){const o=c.value.clientWidth,s=a.value.offsetWidth;if(o>0&&s>0){const n=o>=s,p=o<s;i.isAutoTooltip?l.isUseTooltip=p:l.isUseTooltip=!0,l.isPosSpan=n,l.isPosParent=p}}},f=()=>{r()};return t.watch(()=>i.text,()=>{t.nextTick(()=>{r()})}),t.onMounted(()=>{t.nextTick(()=>{f()})}),(o,s)=>{const n=t.resolveDirective("cltooltip");return t.withDirectives((t.openBlock(),t.createElementBlock("div",{ref_key:"refElParent",ref:c,class:t.normalizeClass(T.value)},[t.withDirectives((t.openBlock(),t.createElementBlock("span",{ref_key:"refElSpan",ref:a,title:u.value},[t.createTextVNode(t.toDisplayString(e.text),1)],8,P)),[[n,{init:e.isShowTitle&&l.isUseTooltip&&l.isPosSpan,html:e.tooltipHtml||e.text,theme:e.tooltipTheme,position:e.tooltipPosition,trigger:e.tooltipTrigger,isHtml:e.tooltipIsHtml}]])],2)),[[n,{init:e.isShowTitle&&l.isUseTooltip&&l.isPosParent,html:e.tooltipHtml||e.text,theme:e.tooltipTheme,position:e.tooltipPosition,trigger:e.tooltipTrigger,isHtml:e.tooltipIsHtml}]])}}});module.exports=v;
//# sourceMappingURL=ClEllipsis.cjs.map
