"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),C=require("@aplus-frontend/antdv"),N=require("@aplus-frontend/icon");require("../../ap-field/index.js");require("../../config-provider/index.js");const T=require("./style/index.js"),q=require("../../config-provider/hooks/use-namespace.js"),w=require("../../ap-field/text/index.js"),b=["onClick"],g=e.defineComponent({__name:"select-layout",props:{title:{},request:{},onSearch:{},defaultFold:{type:Boolean,default:!1},defaultValue:{default:""}},emits:["onSelect","afterEnter","afterLeave"],setup(E,{emit:y}){const{b:u,be:d,bem:o}=q.useNamespace("ap-select-layout"),k=T.default("ap-select-layout"),a=E,i=y,c=e.ref(),s=e.ref(a.defaultFold),f=e.ref(!a.defaultFold),v=e.ref(),m=e.ref(),p=e.ref(),r=e.ref(a.defaultValue),V=()=>{s.value=!s.value,v.value=!1,m.value=!1},h=t=>{p.value=t,i("onSelect",t)},S=e.computed(()=>c.value?.filter(t=>a?.onSearch?a.onSearch?.(t,r.value):t?.name?.includes(r.value))),z=t=>{f.value=!0,i("afterEnter",t)},x=t=>{f.value=!1,i("afterLeave",t)};return e.onMounted(()=>{a.request().then(t=>{c.value=t;let n=c.value?.filter(l=>l.name.includes(r.value));h(n?.[0])})}),(t,n)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([e.unref(u)(),e.unref(k)])},[e.createVNode(e.Transition,{mode:"out-in",onAfterEnter:z,onAfterLeave:x},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(e.unref(u)("side"))},[e.createElementVNode("div",{class:e.normalizeClass(e.unref(d)("side","header"))},[e.createElementVNode("h3",null,e.toDisplayString(a.title),1),e.createElementVNode("div",{class:e.normalizeClass(e.unref(o)("side","header","imgWrap"))},[e.createVNode(e.unref(C.Tooltip),{open:v.value,"onUpdate:open":n[0]||(n[0]=l=>v.value=l)},{title:e.withCtx(()=>[...n[3]||(n[3]=[e.createTextVNode("收起",-1)])]),default:e.withCtx(()=>[e.createVNode(e.unref(N.IconApLeftarrow),{onClick:V})]),_:1},8,["open"])],2)],2),e.createElementVNode("div",{class:e.normalizeClass(e.unref(d)("side","body"))},[e.createElementVNode("div",{class:e.normalizeClass(e.unref(o)("side","body","search"))},[e.createVNode(e.unref(w.ApFieldText),{value:r.value,"onUpdate:value":n[1]||(n[1]=l=>r.value=l),placeholder:"请输入"},null,8,["value"])],2),e.createElementVNode("div",{class:e.normalizeClass(e.unref(o)("side","body","scroll"))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(S.value,l=>e.withDirectives((e.openBlock(),e.createElementBlock("div",{key:l.value,class:e.normalizeClass(`${e.unref(o)("side","body","scroll-item")} ${p.value===l?"active":""}`),onClick:B=>h(l)},[e.renderSlot(t.$slots,"itemRender",{item:l},()=>[e.createVNode(e.unref(C.TypographyText),{ellipsis:{tooltip:l.name},content:`${l.name}`},null,8,["ellipsis","content"])])],10,b)),[[e.vShow,f.value]])),128))],2)],2)],2),[[e.vShow,!s.value]])]),_:3}),e.createElementVNode("div",{class:e.normalizeClass(e.unref(u)("content"))},[e.createElementVNode("div",{class:e.normalizeClass(e.unref(d)("content","header"))},[s.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(o)("content","header","imgWrap"))},[e.createVNode(e.unref(C.Tooltip),{open:m.value,"onUpdate:open":n[2]||(n[2]=l=>m.value=l)},{title:e.withCtx(()=>[...n[4]||(n[4]=[e.createTextVNode("展开",-1)])]),default:e.withCtx(()=>[e.createVNode(e.unref(N.IconApMenu),{onClick:V})]),_:1},8,["open"])],2)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(e.unref(o)("content","header","title"))},e.toDisplayString(p.value?.name),3)],2),e.renderSlot(t.$slots,"default")],2)],2))}});exports.default=g;
