import{defineComponent as se,ref as ue,computed as r,createVNode as S}from"vue";import w from"../_util/classNames.mjs";import N from"../_util/omit.mjs";import de from"../_util/props-util/initDefaultProps.mjs";import{getMergedStatus as pe,getStatusClassNames as fe}from"../_util/statusUtils.mjs";import{getTransitionName as ve,getTransitionDirection as ge}from"../_util/transition.mjs";import{functionType as he,stringType as m,booleanType as Ce,someType as O}from"../_util/type.mjs";import f from"../_util/vue-types/index.mjs";import{useInjectDisabled as Ie}from"../config-provider/DisabledContext.mjs";import be from"../config-provider/hooks/useConfigInject.mjs";import{DefaultRenderEmpty as Se}from"../config-provider/renderEmpty.mjs";import{useInjectFormItemContext as we,FormItemInputContext as Oe}from"../form/FormItemContext.mjs";import{useCompactItemContext as xe}from"../space/Compact.mjs";import"../vc-select/BaseSelect.mjs";import Ne from"../vc-select/OptGroup.mjs";import Te from"../vc-select/Option.mjs";import ye,{selectProps as Re}from"../vc-select/Select.mjs";import Ee from"./style/index.mjs";import Fe from"./utils/iconUtil.mjs";const Pe=()=>({...N(Re(),["inputIcon","mode","getInputElement","getRawInputElement","backfill"]),value:O([Array,Object,String,Number]),defaultValue:O([Array,Object,String,Number]),notFoundContent:f.any,suffixIcon:f.any,itemIcon:f.any,size:m(),mode:m(),bordered:Ce(!0),transitionName:String,choiceTransitionName:m(""),popupClassName:String,dropdownClassName:String,placement:m(),status:m(),"onUpdate:value":he()}),x="SECRET_COMBOBOX_MODE_DO_NOT_USE",a=se({compatConfig:{MODE:3},name:"ASelect",Option:Te,OptGroup:Ne,inheritAttrs:!1,props:de(Pe(),{listHeight:256,listItemHeight:24}),SECRET_COMBOBOX_MODE_DO_NOT_USE:x,slots:Object,setup(e,{attrs:v,emit:d,slots:n,expose:T}){const s=ue(),p=we(),u=Oe.useInject(),y=r(()=>pe(u.status,e.status)),R=()=>{s.value?.focus()},E=()=>{s.value?.blur()},F=t=>{s.value?.scrollTo(t)},i=r(()=>{const{mode:t}=e;if(t!=="combobox")return t===x?"combobox":t}),{prefixCls:o,direction:l,renderEmpty:P,size:D,getPrefixCls:A,getPopupContainer:_,disabled:M,select:$}=be("select",e),{compactSize:j,compactItemClassnames:B}=xe(o,l),g=r(()=>j.value||D.value),z=Ie(),H=r(()=>M.value??z.value),[G,h]=Ee(o),k=r(()=>A()),L=r(()=>e.placement!==void 0?e.placement:l.value==="rtl"?"bottomRight":"bottomLeft"),U=r(()=>ve(k.value,ge(L.value),e.transitionName)),V=r(()=>w({[`${o.value}-lg`]:g.value==="large",[`${o.value}-sm`]:g.value==="small",[`${o.value}-rtl`]:l.value==="rtl",[`${o.value}-borderless`]:!e.bordered,[`${o.value}-in-form-item`]:u.isFormItemInput},fe(o.value,y.value,u.hasFeedback),B.value,h.value)),W=(...t)=>{d("update:value",t[0]),d("change",...t),p.onFieldChange()},X=t=>{d("blur",t),p.onFieldBlur()};T({blur:E,focus:R,scrollTo:F});const C=r(()=>i.value==="multiple"||i.value==="tags"),q=r(()=>e.showArrow!==void 0?e.showArrow:e.loading||!(C.value||i.value==="combobox"));return()=>{const{notFoundContent:t,listHeight:J=256,listItemHeight:K=24,popupClassName:Q,dropdownClassName:Y,virtual:Z,dropdownMatchSelectWidth:ee,id:te=p.id.value,placeholder:oe=n.placeholder?.(),showArrow:ne}=e,{hasFeedback:I,feedbackIcon:re}=u;let c;t!==void 0?c=t:n.notFoundContent?c=n.notFoundContent():i.value==="combobox"?c=null:c=P?.("Select")||S(Se,{componentName:"Select"},null);const{suffixIcon:ae,itemIcon:le,removeIcon:ie,clearIcon:ce}=Fe({...e,multiple:C.value,prefixCls:o.value,hasFeedback:I,feedbackIcon:re,showArrow:q.value},n),b=N(e,["prefixCls","suffixIcon","itemIcon","removeIcon","clearIcon","size","bordered","status"]),me=w(Q||Y,{[`${o.value}-dropdown-${l.value}`]:l.value==="rtl"},h.value);return G(S(ye,{ref:s,virtual:Z,dropdownMatchSelectWidth:ee,...b,...v,showSearch:e.showSearch??$?.value?.showSearch,placeholder:oe,listHeight:J,listItemHeight:K,mode:i.value,prefixCls:o.value,direction:l.value,inputIcon:ae,menuItemSelectedIcon:le,removeIcon:ie,clearIcon:ce,notFoundContent:c,class:[V.value,v.class],getPopupContainer:_?.value,dropdownClassName:me,onChange:W,onBlur:X,id:te,dropdownRender:b.dropdownRender||n.dropdownRender,transitionName:U.value,children:n.default?.(),tagRender:e.tagRender||n.tagRender,optionLabelRender:n.optionLabel,maxTagPlaceholder:e.maxTagPlaceholder||n.maxTagPlaceholder,showArrow:I||ne,disabled:H.value},{option:n.option}))}}});a.install=function(e){return e.component(a.name,a),e.component(a.Option.displayName,a.Option),e.component(a.OptGroup.displayName,a.OptGroup),e};const Qe=a.Option,Ye=a.OptGroup;export{Ye as SelectOptGroup,Qe as SelectOption,a as default,Pe as selectProps};
