import{co as S,z as B,B as x}from"./index.17037962789732.js";import{i as _,a as M}from"./isUndefined.1703796278973.js";import{i as g}from"./isArray.1703796278973.js";import{d as h,l as O,k as w,m as V,r as j,o as f,c as k,a as m,x as C,F as D,h as E,u as b,z as K,b as z,t as A,A as F}from"./vue.1703796278973.js";import{_ as J}from"./_plugin-vue_export-helper.1703796278973.js";const N=(i,l,a="name")=>{let n;if(l===void 0&&l===null)return n;let s=_(l)?String(l):l;for(let o=0;o<i.length;o++){const c=i[o];if(S(c[a],s)){n=i[o];break}else if(c.children&&c.children.length&&(n=N(c.children,l,a),n))break}return n},T=h({name:"DropdownMenus"}),q=h({...T,props:{value:{type:[String,Number,Boolean],default:void 0},options:{type:Array,default:()=>[]},valueName:{type:String,default:"value"}},emits:["update:value","click"],setup(i,{emit:l}){const a=i,n=O(()=>a.options.map(t=>{let u=t.label||t.name,e=M(t.value)?t.id:t.value;return _(e)&&(u=e===!0?"是":"否",e=String(e)),g(e)&&(e=JSON.stringify(e)),{...t,label:u,value:e}})),s=w(a.value),o=t=>t!=="false",c=t=>{var r,v,y;let u=["true","false"].includes((r=t.item)==null?void 0:r.value)?o((v=t.item)==null?void 0:v.value):(y=t.item)==null?void 0:y.value;const e=t.key,d=["true","false"].includes(e)?o(e):e,p=N(n.value,d,a.valueName);s.value=e,l("update:value",u),l("click",u,{key:u,...p})};return V(()=>a.value,()=>{_(a.value)?s.value=_(a.value):g(a.value)?s.value=JSON.stringify(a.value):s.value=a.value},{immediate:!0}),(t,u)=>{const e=j("Ellipsis"),d=B,p=x;return f(),k(p,{class:"scene-dropdown-menus",onClick:c,selectedKeys:[b(s)]},{default:m(()=>[(f(!0),C(D,null,E(b(n),r=>(f(),k(d,{key:r[i.valueName],value:r.value,title:r.label},{default:m(()=>[K("div",null,[z(e,null,{default:m(()=>[A(F(r.label),1)]),_:2},1024)])]),_:2},1032,["value","title"]))),128))]),_:1},8,["selectedKeys"])}}});const I=J(q,[["__scopeId","data-v-27ac151e"]]),Q=Object.freeze(Object.defineProperty({__proto__:null,default:I},Symbol.toStringTag,{value:"Module"}));export{I as D,Q as M,N as g};
