import{d as C,k as v,l as J,w as M,r as N,o as n,c as y,a as d,z as g,x as f,F as $,u as s,b as _,M as S,t as h,A as b,B as w,L as z,j as F,D as I}from"./vue.1703796278973.js";import{a0 as O,aL as U,a as R,C as q}from"./index.17037962789732.js";import"./index.170379627897332.js";import"./index.170379627897315.js";import"./index.170379627897317.js";import"./index.1703796278973304.js";import"./index.170379627897336.js";import{g as G,D as H}from"./Menus.17037962789732.js";import{_ as P}from"./Time.vue_vue_type_style_index_0_lang.17037962789732.js";import{b as Q}from"./comm.1703796278973.js";const W={class:"scene-select-content"},X={key:1,style:{"min-width":"400px"}},Y={key:0,class:"tree-title-description"},Z={key:2,class:"scene-select-empty"},ee=C({name:"DropdownButton"}),re=C({...ee,props:{icon:{type:String,default:""},placeholder:{type:String,default:void 0},value:{type:[String,Number,Boolean],default:void 0},valueName:{type:String,default:"value"},labelName:{type:String,default:"label"},options:{type:Array,default:()=>[]},type:{type:String,default:"column"},component:{type:String,default:"select"}},emits:["update:value","select"],setup(a,{emit:c}){const e=a,r=v(e.placeholder),u=v(e.value),o=v(!1),m=v([]),x=t=>{o.value=t},B=J(()=>({"dropdown-button":!0,column:e.type==="column",termType:e.type==="termType",value:e.type==="value",type:e.type==="type"})),D=(t,l)=>{const i=l.node;o.value=!1,r.value=i.fullname||i.name,u.value=t[0],c("update:value",i[e.valueName]),c("select",i)},K=t=>{u.value=t,o.value=!1,c("update:value",t),c("select",t)},V=(t,l)=>{u.value=t,o.value=!1,c("update:value",t),c("select",l)};return M(()=>{const t=G(e.options,e.value,e.valueName);u.value=e.value,t?(r.value=t[e.labelName]||t.name,m.value=Q(e.options,e.value,e.valueName)):r.value=e.value!==void 0?e.value:e.placeholder}),(t,l)=>{const i=N("AIcon"),j=N("Ellipsis"),E=O,T=U,A=R,L=q;return n(),y(L,{class:"scene-select",trigger:"click",visible:s(o),"onUpdate:visible":l[2]||(l[2]=p=>S(o)?o.value=p:null),onVisibleChange:x},{overlay:d(()=>[g("div",W,[["date","time"].includes(a.component)?(n(),y(P,{key:0,type:a.component,onChange:K},null,8,["type"])):a.options.length?(n(),f($,{key:1},[a.component==="select"?(n(),y(H,{key:0,value:s(u),options:a.options,valueName:a.valueName,onClick:V},null,8,["value","options","valueName"])):(n(),f("div",X,[_(T,{expandedKeys:s(m),"onUpdate:expandedKeys":l[1]||(l[1]=p=>S(m)?m.value=p:null),selectedKeys:s(u)?[s(u)]:[],treeData:a.options,height:450,virtual:!0,onSelect:D},{title:d(({name:p,description:k})=>[_(E,null,{default:d(()=>[h(b(p)+" ",1),k?(n(),f("span",Y,b(k),1)):w("",!0)]),_:2},1024)]),_:1},8,["expandedKeys","selectedKeys","treeData"])]))],64)):(n(),f("div",Z,[_(A)]))])]),default:d(()=>[g("div",{onClick:l[0]||(l[0]=z(p=>o.value=!0,["prevent"]))},[F(t.$slots,"default",{label:s(r)},()=>[g("div",{class:I(s(B))},[a.icon?(n(),y(i,{key:0,type:a.icon},null,8,["type"])):w("",!0),_(j,{style:{"max-width":"220px"}},{default:d(()=>[h(b(s(r)),1)]),_:1})],2)],!0)])]),_:3},8,["visible"])}}});export{re as _};
