import{defineComponent as W,computed as B,ref as E,createVNode as m}from"vue";import O from"../_util/classNames.mjs";import u from"../_util/vue-types/index.mjs";import V from"../vc-trigger/Trigger.mjs";const Y=e=>{const o=e===!0?0:1;return{bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:o,adjustY:1}},bottomRight:{points:["tr","br"],offset:[0,4],overflow:{adjustX:o,adjustY:1}},topLeft:{points:["bl","tl"],offset:[0,-4],overflow:{adjustX:o,adjustY:1}},topRight:{points:["br","tr"],offset:[0,-4],overflow:{adjustX:o,adjustY:1}}}},X=W({name:"SelectTrigger",inheritAttrs:!1,props:{dropdownAlign:Object,visible:{type:Boolean,default:void 0},disabled:{type:Boolean,default:void 0},dropdownClassName:String,dropdownStyle:u.object,placement:String,empty:{type:Boolean,default:void 0},prefixCls:String,popupClassName:String,animation:String,transitionName:String,getPopupContainer:Function,dropdownRender:Function,containerWidth:Number,dropdownMatchSelectWidth:u.oneOfType([Number,Boolean]).def(!0),popupElement:u.any,direction:String,getTriggerDOMNode:Function,onPopupVisibleChange:Function,onPopupMouseEnter:Function,onPopupFocusin:Function,onPopupFocusout:Function},setup(e,{slots:o,attrs:g,expose:b}){const h=B(()=>{const{dropdownMatchSelectWidth:t}=e;return Y(t)}),s=E();return b({getPopupElement:()=>s.value}),()=>{const{empty:t=!1,...w}={...e,...g},{visible:P,dropdownAlign:N,prefixCls:S,popupElement:d,dropdownClassName:C,dropdownStyle:y,direction:F="ltr",placement:T,dropdownMatchSelectWidth:n,containerWidth:l,dropdownRender:a,animation:c,transitionName:v,getPopupContainer:M,getTriggerDOMNode:x,onPopupVisibleChange:p,onPopupMouseEnter:j,onPopupFocusin:$,onPopupFocusout:A}=w,i=`${S}-dropdown`;let f=d;a&&(f=a({menuNode:d,props:e}));const R=c?`${i}-${c}`:v,r={minWidth:`${l}px`,...y};return typeof n=="number"?r.width=`${n}px`:n&&(r.width=`${l}px`),m(V,{...e,showAction:p?["click"]:[],hideAction:p?["click"]:[],popupPlacement:T||(F==="rtl"?"bottomRight":"bottomLeft"),builtinPlacements:h.value,prefixCls:i,popupTransitionName:R,popupAlign:N,popupVisible:P,getPopupContainer:M,popupClassName:O(C,{[`${i}-empty`]:t}),popupStyle:r,getTriggerDOMNode:x,onPopupVisibleChange:p},{default:o.default,popup:()=>m("div",{ref:s,onMouseenter:j,onFocusin:$,onFocusout:A},[f])})}}});export{X as default};
