import{bz as e,aK as i,cp as t,aE as l,aW as n,aG as s,bM as o,aN as a,bt as r}from"./index.js?v=1723125373998";import{l as c,r as p,k as u,G as d,p as g,L as v}from"./vue.js?v=1723125373998";const m=e({name:"Ellipsis",common:i,peers:{Tooltip:t}}),f=l("ellipsis",{overflow:"hidden"},[n("line-clamp","\n white-space: nowrap;\n display: inline-block;\n vertical-align: bottom;\n max-width: 100%;\n "),s("line-clamp","\n display: -webkit-inline-box;\n -webkit-box-orient: vertical;\n "),s("cursor-pointer","\n cursor: pointer;\n ")]);function b(e){return"".concat(e,"-ellipsis--line-clamp")}function h(e,i){return"".concat(e,"-ellipsis--cursor-").concat(i)}const w=Object.assign(Object.assign({},a.props),{expandTrigger:String,lineClamp:[Number,String],tooltip:{type:[Boolean,Object],default:!0}}),T=c({name:"Ellipsis",inheritAttrs:!1,props:w,setup(e,{slots:i,attrs:t}){const l=o(),n=a("Ellipsis","-ellipsis",f,m,e,l),s=p(null),r=p(null),c=p(null),w=p(!1),T=u((()=>{const{lineClamp:i}=e,{value:t}=w;return void 0!==i?{textOverflow:"","-webkit-line-clamp":t?"":i}:{textOverflow:t?"":"ellipsis","-webkit-line-clamp":""}}));function k(){let i=!1;const{value:t}=w;if(t)return!0;const{value:n}=s;if(n){const{lineClamp:t}=e;if(function(i){if(!i)return;const t=T.value,n=b(l.value);void 0!==e.lineClamp?C(i,n,"add"):C(i,n,"remove");for(const e in t)i.style[e]!==t[e]&&(i.style[e]=t[e])}(n),void 0!==t)i=n.scrollHeight<=n.offsetHeight;else{const{value:e}=r;e&&(i=e.getBoundingClientRect().width<=n.getBoundingClientRect().width)}!function(i,t){const n=h(l.value,"pointer");"click"!==e.expandTrigger||t?C(i,n,"remove"):C(i,n,"add")}(n,i)}return i}const x=u((()=>"click"===e.expandTrigger?()=>{var e;const{value:i}=w;i&&(null===(e=c.value)||void 0===e||e.setShow(!1)),w.value=!i}:void 0));d((()=>{var i;e.tooltip&&(null===(i=c.value)||void 0===i||i.setShow(!1))}));function C(e,i,t){"add"===t?e.classList.contains(i)||e.classList.add(i):e.classList.contains(i)&&e.classList.remove(i)}return{mergedTheme:n,triggerRef:s,triggerInnerRef:r,tooltipRef:c,handleClick:x,renderTrigger:()=>g("span",Object.assign({},v(t,{class:["".concat(l.value,"-ellipsis"),void 0!==e.lineClamp?b(l.value):void 0,"click"===e.expandTrigger?h(l.value,"pointer"):void 0],style:T.value}),{ref:"triggerRef",onClick:x.value,onMouseenter:"click"===e.expandTrigger?k:void 0}),e.lineClamp?i:g("span",{ref:"triggerInnerRef"},i)),getTooltipDisabled:k}},render(){var e;const{tooltip:i,renderTrigger:t,$slots:l}=this;if(i){const{mergedTheme:n}=this;return g(r,Object.assign({ref:"tooltipRef",placement:"top"},i,{getDisabled:this.getTooltipDisabled,theme:n.peers.Tooltip,themeOverrides:n.peerOverrides.Tooltip}),{trigger:t,default:null!==(e=l.tooltip)&&void 0!==e?e:l.default})}return t()}});export{T as _,w as a,h as b,b as c,m as e,f as s};
