import{createVNode as a}from"vue";import{cloneElement as $}from"../../_util/vnode.mjs";import{useInjectCascader as F}from"../context.mjs";import{SEARCH_MARK as H}from"../hooks/useSearchOptions.mjs";import{isLeaf as X,toPathKey as q}from"../utils/commonUtil.mjs";import z from"./Checkbox.mjs";const G="__cascader_fix_label__";function m({prefixCls:s,multiple:h,options:S,activeValue:P,prevValuePath:_,onToggleOpen:A,onSelect:L,onActive:M,checkedSet:O,halfCheckedSet:K,loadingKeys:R,isSelectable:E}){const N=`${s}-menu`,l=`${s}-menu-item`,{fieldNames:c,changeOnSelect:V,expandTrigger:w,expandIcon:D,loadingIcon:T,dropdownMenuColumnStyle:j,customSlots:p}=F(),v=D.value??p.value.expandIcon?.(),g=T.value??p.value.loadingIcon?.(),k=w.value==="hover";return a("ul",{class:N,role:"menu"},[S.map(e=>{const{disabled:i}=e,x=e[H],r=e[G]??e[c.value.label],C=e[c.value.value],n=X(e,c.value),d=x?x.map(o=>o[c.value.value]):[..._,C],t=q(d),u=R.includes(t),b=O.has(t),B=K.has(t),I=()=>{!i&&(!k||!n)&&M(d)},y=()=>{E(e)&&L(d,n)};let f;return typeof e.title=="string"?f=e.title:typeof r=="string"&&(f=r),a("li",{key:t,class:[l,{[`${l}-expand`]:!n,[`${l}-active`]:P===C,[`${l}-disabled`]:i,[`${l}-loading`]:u}],style:j.value,role:"menuitemcheckbox",title:f,"aria-checked":b,"data-path-key":t,onClick:()=>{I(),(!h||n)&&y()},onDblclick:()=>{V.value&&A(!1)},onMouseenter:()=>{k&&I()},onMousedown:o=>{o.preventDefault()}},[h&&a(z,{prefixCls:`${s}-checkbox`,checked:b,halfChecked:B,disabled:i,onClick:o=>{o.stopPropagation(),y()}},null),a("div",{class:`${l}-content`},[r]),!u&&v&&!n&&a("div",{class:`${l}-expand-icon`},[$(v)]),u&&g&&a("div",{class:`${l}-loading-icon`},[$(g)])])})])}m.props=["prefixCls","multiple","options","activeValue","prevValuePath","onToggleOpen","onSelect","onActive","checkedSet","halfCheckedSet","loadingKeys","isSelectable"];m.displayName="Column";m.inheritAttrs=!1;export{G as FIX_LABEL,m as default};
