Files
kefu/deploy/knowledge-batch-20261007/baseline-snapshot/web-dist/js/tooltip-BAmtBahr.js
T
2026-11-16 09:39:42 +08:00

1 line
14 KiB
JavaScript

import{D as e,Ht as t,Ut as n,g as r,k as i,vn as a,xn as o}from"./runtime-core.esm-bundler-DkysjgTd.js";import{r as s}from"./en_US-Cv9hrLhb.js";import{$ as c,J as l,ct as u,et as d,l as f,m as p,mt as m,pt as h,t as g,u as _,ut as v,vt as y}from"./useConfigInject-DomGmy3z.js";import{t as b}from"./initDefaultProps-D8Mki4gM.js";import{t as x}from"./raf-CR9Bw2Uc.js";import{i as S,r as C,t as w}from"./colors-C2RrYxlT.js";import{t as T}from"./vue-types-CEi2nPn2.js";import{t as E}from"./vc-trigger-DaL-SGhM.js";import{t as D}from"./vnode-_2fZS--9.js";import{a as O}from"./Portal-pBogH1MM.js";import{t as k}from"./zoom-CBWJFr0a.js";var A={adjustX:1,adjustY:1},j=[0,0],M={left:{points:[`cr`,`cl`],overflow:A,offset:[-4,0],targetOffset:j},right:{points:[`cl`,`cr`],overflow:A,offset:[4,0],targetOffset:j},top:{points:[`bc`,`tc`],overflow:A,offset:[0,-4],targetOffset:j},bottom:{points:[`tc`,`bc`],overflow:A,offset:[0,4],targetOffset:j},topLeft:{points:[`bl`,`tl`],overflow:A,offset:[0,-4],targetOffset:j},leftTop:{points:[`tr`,`tl`],overflow:A,offset:[-4,0],targetOffset:j},topRight:{points:[`br`,`tr`],overflow:A,offset:[0,-4],targetOffset:j},rightTop:{points:[`tl`,`tr`],overflow:A,offset:[4,0],targetOffset:j},bottomRight:{points:[`tr`,`br`],overflow:A,offset:[0,4],targetOffset:j},rightBottom:{points:[`bl`,`br`],overflow:A,offset:[4,0],targetOffset:j},bottomLeft:{points:[`tl`,`bl`],overflow:A,offset:[0,4],targetOffset:j},leftBottom:{points:[`br`,`bl`],overflow:A,offset:[-4,0],targetOffset:j}},N={prefixCls:String,id:String,overlayInnerStyle:T.any},P=i({compatConfig:{MODE:3},name:`TooltipContent`,props:N,setup(t,n){let{slots:r}=n;return()=>{var n;return e(`div`,{class:`${t.prefixCls}-inner`,id:t.id,role:`tooltip`,style:t.overlayInnerStyle},[(n=r.overlay)==null?void 0:n.call(r)])}}}),F=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};function I(){}var L=i({compatConfig:{MODE:3},name:`Tooltip`,inheritAttrs:!1,props:{trigger:T.any.def([`hover`]),defaultVisible:{type:Boolean,default:void 0},visible:{type:Boolean,default:void 0},placement:T.string.def(`right`),transitionName:String,animation:T.any,afterVisibleChange:T.func.def(()=>{}),overlayStyle:{type:Object,default:void 0},overlayClassName:String,prefixCls:T.string.def(`rc-tooltip`),mouseEnterDelay:T.number.def(.1),mouseLeaveDelay:T.number.def(.1),getPopupContainer:Function,destroyTooltipOnHide:{type:Boolean,default:!1},align:T.object.def(()=>({})),arrowContent:T.any.def(null),tipId:String,builtinPlacements:T.object,overlayInnerStyle:{type:Object,default:void 0},popupVisible:{type:Boolean,default:void 0},onVisibleChange:Function,onPopupAlign:Function,arrow:{type:Boolean,default:!0}},setup(t,r){let{slots:i,attrs:a,expose:c}=r,l=o(),d=()=>{let{prefixCls:n,tipId:r,overlayInnerStyle:a}=t;return[t.arrow?e(`div`,{class:`${n}-arrow`,key:`arrow`},[u(i,t,`arrowContent`)]):null,e(P,{key:`content`,prefixCls:n,id:r,overlayInnerStyle:a},{overlay:i.overlay})]};c({getPopupDomNode:()=>l.value.getPopupDomNode(),triggerDOM:l,forcePopupAlign:()=>{var e;return(e=l.value)==null?void 0:e.forcePopupAlign()}});let f=o(!1),p=o(!1);return n(()=>{let{destroyTooltipOnHide:e}=t;if(typeof e==`boolean`)f.value=e;else if(e&&typeof e==`object`){let{keepParent:t}=e;f.value=t===!0,p.value=t===!1}}),()=>{let{overlayClassName:n,trigger:r,mouseEnterDelay:o,mouseLeaveDelay:c,overlayStyle:u,prefixCls:m,afterVisibleChange:h,transitionName:g,animation:_,placement:v,align:y,destroyTooltipOnHide:b,defaultVisible:x}=t,S=F(t,[`overlayClassName`,`trigger`,`mouseEnterDelay`,`mouseLeaveDelay`,`overlayStyle`,`prefixCls`,`afterVisibleChange`,`transitionName`,`animation`,`placement`,`align`,`destroyTooltipOnHide`,`defaultVisible`]),C=s({},S);t.visible!==void 0&&(C.popupVisible=t.visible);let w=s(s(s({popupClassName:n,prefixCls:m,action:r,builtinPlacements:M,popupPlacement:v,popupAlign:y,afterPopupVisibleChange:h,popupTransitionName:g,popupAnimation:_,defaultPopupVisible:x,destroyPopupOnHide:f.value,autoDestroy:p.value,mouseLeaveDelay:c,popupStyle:u,mouseEnterDelay:o},C),a),{onPopupVisibleChange:t.onVisibleChange||I,onPopupAlign:t.onPopupAlign||I,ref:l,arrow:!!t.arrow,popup:d()});return e(E,w,{default:i.default})}}}),R=(()=>({trigger:[String,Array],open:{type:Boolean,default:void 0},visible:{type:Boolean,default:void 0},placement:String,color:String,transitionName:String,overlayStyle:l(),overlayInnerStyle:l(),overlayClassName:String,openClassName:String,prefixCls:String,mouseEnterDelay:Number,mouseLeaveDelay:Number,getPopupContainer:Function,arrowPointAtCenter:{type:Boolean,default:void 0},arrow:{type:[Boolean,Object],default:!0},autoAdjustOverflow:{type:[Boolean,Object],default:void 0},destroyTooltipOnHide:{type:Boolean,default:void 0},align:l(),builtinPlacements:l(),children:Array,onVisibleChange:Function,"onUpdate:visible":Function,onOpenChange:Function,"onUpdate:open":Function})),z={adjustX:1,adjustY:1},B={adjustX:0,adjustY:0},V=[0,0];function H(e){return typeof e==`boolean`?e?z:B:s(s({},B),e)}function U(e){let{arrowWidth:t=4,horizontalArrowShift:n=16,verticalArrowShift:r=8,autoAdjustOverflow:i,arrowPointAtCenter:a}=e,o={left:{points:[`cr`,`cl`],offset:[-4,0]},right:{points:[`cl`,`cr`],offset:[4,0]},top:{points:[`bc`,`tc`],offset:[0,-4]},bottom:{points:[`tc`,`bc`],offset:[0,4]},topLeft:{points:[`bl`,`tc`],offset:[-(n+t),-4]},leftTop:{points:[`tr`,`cl`],offset:[-4,-(r+t)]},topRight:{points:[`br`,`tc`],offset:[n+t,-4]},rightTop:{points:[`tl`,`cr`],offset:[4,-(r+t)]},bottomRight:{points:[`tr`,`bc`],offset:[n+t,4]},rightBottom:{points:[`bl`,`cr`],offset:[4,r+t]},bottomLeft:{points:[`tl`,`bc`],offset:[-(n+t),4]},leftBottom:{points:[`br`,`cl`],offset:[-4,r+t]}};return Object.keys(o).forEach(e=>{o[e]=a?s(s({},o[e]),{overflow:H(i),targetOffset:V}):s(s({},M[e]),{overflow:H(i)}),o[e].ignoreShake=!0}),o}function W(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];for(let t=0,n=e.length;t<n;t++)if(e[t]!==void 0)return e[t]}function G(e,t){let n=w(t),r=y({[`${e}-${t}`]:t&&n}),i={},a={};return t&&!n&&(i.background=t,a[`--antd-arrow-background-color`]=t),{className:r,overlayStyle:i,arrowStyle:a}}function K(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:``;return e.map(e=>`${t}${e}`).join(`,`)}function q(e){let{sizePopupArrow:t,contentRadius:n,borderRadiusOuter:r,limitVerticalRadius:i}=e,a=t/2-Math.ceil(r*(Math.sqrt(2)-1)),o=(n>12?n+2:12)-a;return{dropdownArrowOffset:o,dropdownArrowOffsetVertical:i?8-a:o}}function J(e,t){let{componentCls:n,sizePopupArrow:r,marginXXS:i,borderRadiusXS:a,borderRadiusOuter:o,boxShadowPopoverArrow:c}=e,{colorBg:l,showArrowCls:u,contentRadius:d=e.borderRadiusLG,limitVerticalRadius:f}=t,{dropdownArrowOffsetVertical:p,dropdownArrowOffset:m}=q({sizePopupArrow:r,contentRadius:d,borderRadiusOuter:o,limitVerticalRadius:f}),h=r/2+i;return{[n]:{[`${n}-arrow`]:[s(s({position:`absolute`,zIndex:1,display:`block`},S(r,a,o,l,c)),{"&:before":{background:l}})],[[`&-placement-top ${n}-arrow`,`&-placement-topLeft ${n}-arrow`,`&-placement-topRight ${n}-arrow`].join(`,`)]:{bottom:0,transform:`translateY(100%) rotate(180deg)`},[`&-placement-top ${n}-arrow`]:{left:{_skip_check_:!0,value:`50%`},transform:`translateX(-50%) translateY(100%) rotate(180deg)`},[`&-placement-topLeft ${n}-arrow`]:{left:{_skip_check_:!0,value:m}},[`&-placement-topRight ${n}-arrow`]:{right:{_skip_check_:!0,value:m}},[[`&-placement-bottom ${n}-arrow`,`&-placement-bottomLeft ${n}-arrow`,`&-placement-bottomRight ${n}-arrow`].join(`,`)]:{top:0,transform:`translateY(-100%)`},[`&-placement-bottom ${n}-arrow`]:{left:{_skip_check_:!0,value:`50%`},transform:`translateX(-50%) translateY(-100%)`},[`&-placement-bottomLeft ${n}-arrow`]:{left:{_skip_check_:!0,value:m}},[`&-placement-bottomRight ${n}-arrow`]:{right:{_skip_check_:!0,value:m}},[[`&-placement-left ${n}-arrow`,`&-placement-leftTop ${n}-arrow`,`&-placement-leftBottom ${n}-arrow`].join(`,`)]:{right:{_skip_check_:!0,value:0},transform:`translateX(100%) rotate(90deg)`},[`&-placement-left ${n}-arrow`]:{top:{_skip_check_:!0,value:`50%`},transform:`translateY(-50%) translateX(100%) rotate(90deg)`},[`&-placement-leftTop ${n}-arrow`]:{top:p},[`&-placement-leftBottom ${n}-arrow`]:{bottom:p},[[`&-placement-right ${n}-arrow`,`&-placement-rightTop ${n}-arrow`,`&-placement-rightBottom ${n}-arrow`].join(`,`)]:{left:{_skip_check_:!0,value:0},transform:`translateX(-100%) rotate(-90deg)`},[`&-placement-right ${n}-arrow`]:{top:{_skip_check_:!0,value:`50%`},transform:`translateY(-50%) translateX(-100%) rotate(-90deg)`},[`&-placement-rightTop ${n}-arrow`]:{top:p},[`&-placement-rightBottom ${n}-arrow`]:{bottom:p},[K([`&-placement-topLeft`,`&-placement-top`,`&-placement-topRight`].map(e=>e+=`:not(&-arrow-hidden)`),u)]:{paddingBottom:h},[K([`&-placement-bottomLeft`,`&-placement-bottom`,`&-placement-bottomRight`].map(e=>e+=`:not(&-arrow-hidden)`),u)]:{paddingTop:h},[K([`&-placement-leftTop`,`&-placement-left`,`&-placement-leftBottom`].map(e=>e+=`:not(&-arrow-hidden)`),u)]:{paddingRight:{_skip_check_:!0,value:h}},[K([`&-placement-rightTop`,`&-placement-right`,`&-placement-rightBottom`].map(e=>e+=`:not(&-arrow-hidden)`),u)]:{paddingLeft:{_skip_check_:!0,value:h}}}}}var Y=e=>{let{componentCls:t,tooltipMaxWidth:n,tooltipColor:r,tooltipBg:i,tooltipBorderRadius:a,zIndexPopup:o,controlHeight:c,boxShadowSecondary:l,paddingSM:u,paddingXS:d,tooltipRadiusOuter:m}=e;return[{[t]:s(s(s(s({},p(e)),{position:`absolute`,zIndex:o,display:`block`,"&":[{width:`max-content`},{width:`intrinsic`}],maxWidth:n,visibility:`visible`,"&-hidden":{display:`none`},"--antd-arrow-background-color":i,[`${t}-inner`]:{minWidth:c,minHeight:c,padding:`${u/2}px ${d}px`,color:r,textAlign:`start`,textDecoration:`none`,wordWrap:`break-word`,backgroundColor:i,borderRadius:a,boxShadow:l},[[`&-placement-left`,`&-placement-leftTop`,`&-placement-leftBottom`,`&-placement-right`,`&-placement-rightTop`,`&-placement-rightBottom`].join(`,`)]:{[`${t}-inner`]:{borderRadius:Math.min(a,8)}},[`${t}-content`]:{position:`relative`}}),C(e,(e,n)=>{let{darkColor:r}=n;return{[`&${t}-${e}`]:{[`${t}-inner`]:{backgroundColor:r},[`${t}-arrow`]:{"--antd-arrow-background-color":r}}}})),{"&-rtl":{direction:`rtl`}})},J(f(e,{borderRadiusOuter:m}),{colorBg:`var(--antd-arrow-background-color)`,showArrowCls:``,contentRadius:a,limitVerticalRadius:!0}),{[`${t}-pure`]:{position:`relative`,maxWidth:`none`}}]},X=((e,t)=>_(`Tooltip`,e=>{if((t==null?void 0:t.value)===!1)return[];let{borderRadius:n,colorTextLightSolid:r,colorBgDefault:i,borderRadiusOuter:a}=e;return[Y(f(e,{tooltipMaxWidth:250,tooltipColor:r,tooltipBorderRadius:n,tooltipBg:i,tooltipRadiusOuter:a>4?4:a})),k(e,`zoom-big-fast`)]},e=>{let{zIndexPopupBase:t,colorBgSpotlight:n}=e;return{zIndexPopup:t+70,colorBgDefault:n}})(e)),Z=(e,t)=>{let n={},r=s({},e);return t.forEach(t=>{e&&t in e&&(n[t]=e[t],delete r[t])}),{picked:n,omitted:r}},Q=()=>s(s({},R()),{title:T.any}),$=()=>({trigger:`hover`,align:{},placement:`top`,mouseEnterDelay:.1,mouseLeaveDelay:.1,arrowPointAtCenter:!1,autoAdjustOverflow:!0}),ee=i({compatConfig:{MODE:3},name:`ATooltip`,inheritAttrs:!1,props:b(Q(),{trigger:`hover`,align:{},placement:`top`,mouseEnterDelay:.1,mouseLeaveDelay:.1,arrowPointAtCenter:!1,autoAdjustOverflow:!0}),slots:Object,setup(n,i){let{slots:o,emit:c,attrs:l,expose:u}=i,{prefixCls:f,getPopupContainer:p,direction:_,rootPrefixCls:b}=g(`tooltip`,n),S=r(()=>{var e;return(e=n.open)==null?n.visible:e}),C=a(W([n.open,n.visible])),w=a(),T;t(S,e=>{x.cancel(T),T=x(()=>{C.value=!!e})});let E=()=>{var e;let t=(e=n.title)==null?o.title:e;return!t&&t!==0},k=e=>{let t=E();S.value===void 0&&(C.value=!t&&e),t||(c(`update:visible`,e),c(`visibleChange`,e),c(`update:open`,e),c(`openChange`,e))};u({getPopupDomNode:()=>w.value.getPopupDomNode(),open:C,forcePopupAlign:()=>{var e;return(e=w.value)==null?void 0:e.forcePopupAlign()}});let A=r(()=>{var e;let{builtinPlacements:t,autoAdjustOverflow:r,arrow:i,arrowPointAtCenter:a}=n,o=a;return typeof i==`object`&&(o=(e=i.pointAtCenter)==null?a:e),t||U({arrowPointAtCenter:o,autoAdjustOverflow:r})}),j=e=>e||e===``,M=t=>{let n=t.type;if(typeof n==`object`&&t.props&&((n.__ANT_BUTTON===!0||n===`button`)&&j(t.props.disabled)||n.__ANT_SWITCH===!0&&(j(t.props.disabled)||j(t.props.loading))||n.__ANT_RADIO===!0&&j(t.props.disabled))){let{picked:n,omitted:r}=Z(v(t),[`position`,`left`,`right`,`top`,`bottom`,`float`,`display`,`zIndex`]),i=s(s({display:`inline-block`},n),{cursor:`not-allowed`,lineHeight:1,width:t.props&&t.props.block?`100%`:void 0}),a=s(s({},r),{pointerEvents:`none`}),o=D(t,{style:a},!0);return e(`span`,{style:i,class:`${f.value}-disabled-compatible-wrapper`},[o])}return t},N=()=>{var e,t;return(e=n.title)==null?(t=o.title)==null?void 0:t.call(o):e},P=(e,t)=>{let n=A.value,r=Object.keys(n).find(e=>{var r,i;return n[e].points[0]===((r=t.points)==null?void 0:r[0])&&n[e].points[1]===((i=t.points)==null?void 0:i[1])});if(r){let n=e.getBoundingClientRect(),i={top:`50%`,left:`50%`};r.indexOf(`top`)>=0||r.indexOf(`Bottom`)>=0?i.top=`${n.height-t.offset[1]}px`:(r.indexOf(`Top`)>=0||r.indexOf(`bottom`)>=0)&&(i.top=`${-t.offset[1]}px`),r.indexOf(`left`)>=0||r.indexOf(`Right`)>=0?i.left=`${n.width-t.offset[0]}px`:(r.indexOf(`right`)>=0||r.indexOf(`Left`)>=0)&&(i.left=`${-t.offset[0]}px`),e.style.transformOrigin=`${i.left} ${i.top}`}},F=r(()=>G(f.value,n.color)),I=r(()=>l[`data-popover-inject`]),[R,z]=X(f,r(()=>!I.value));return()=>{var t,r;let{openClassName:i,overlayClassName:a,overlayStyle:c,overlayInnerStyle:u}=n,g=(r=d((t=o.default)==null?void 0:t.call(o)))==null?null:r;g=g.length===1?g[0]:g;let v=C.value;if(S.value===void 0&&E()&&(v=!1),!g)return null;let x=M(m(g)&&!h(g)?g:e(`span`,null,[g])),T=y({[i||`${f.value}-open`]:!0,[x.props&&x.props.class]:x.props&&x.props.class}),j=y(a,{[`${f.value}-rtl`]:_.value===`rtl`},F.value.className,z.value),I=s(s({},F.value.overlayStyle),u),B=F.value.arrowStyle,V=s(s(s({},l),n),{prefixCls:f.value,arrow:!!n.arrow,getPopupContainer:p==null?void 0:p.value,builtinPlacements:A.value,visible:v,ref:w,overlayClassName:j,overlayStyle:s(s({},B),c),overlayInnerStyle:I,onVisibleChange:k,onPopupAlign:P,transitionName:O(b.value,`zoom-big-fast`,n.transitionName)});return R(e(L,V,{default:()=>[C.value?D(x,{class:T}):x],arrowContent:()=>e(`span`,{class:`${f.value}-arrow-content`},null),overlay:N}))}}}),te=c(ee);export{W as a,J as i,$ as n,U as o,q as r,R as s,te as t};