var h=(i,c,t)=>new Promise((u,a)=>{var m=o=>{try{l(t.next(o))}catch(s){a(s)}},p=o=>{try{l(t.throw(o))}catch(s){a(s)}},l=o=>o.done?u(o.value):Promise.resolve(o.value).then(m,p);l((t=t.apply(i,c)).next())});import{u as P,F as w}from"./useForm-kq1sxERw.js";import{u as V}from"./useValidator-BN3tPovt.js";import{_ as x}from"./selectFriend.vue_vue_type_script_setup_true_lang-BzxfNWW1.js";import{_ as I}from"./selectRoom.vue_vue_type_script_setup_true_lang-C-AHDN4k.js";import{l as y,r as v,Z as F,w as R,m as U,M as S,u as _,U as n}from"./vue-chunks-DyZSmvoe.js";const q=y({__name:"Write",props:{currentRow:{type:Object,default:()=>null}},setup(i,{expose:c}){const{required:t}=V();v(null);const u=i,a=e=>{e!="contact"?d([{field:"roomList",path:"hidden",value:!1},{field:"friendList",path:"hidden",value:!0}]):d([{field:"roomList",path:"hidden",value:!0},{field:"friendList",path:"hidden",value:!1}])},m=v([{field:"name",label:"分组名",component:"Input",colProps:{span:24}},{field:"tags",label:"标签",component:"Input",colProps:{span:24}},{field:"type",label:"分类",component:"Select",value:"contact",colProps:{span:24},componentProps:{clearable:!1,on:{change:e=>{a(e)}},options:[{value:"contact",label:"好友"},{value:"room",label:"群组"}]}},{field:"roomList",label:"群名",colProps:{span:24},value:[],formItemProps:{slots:{default:e=>n("div",{class:"w-[100%]"},[n(I,{multiple:!0,modelValue:e.roomList,"onUpdate:modelValue":r=>e.roomList=r},null)])}},hidden:!0},{field:"friendList",label:"好友名称",colProps:{span:24},value:[],hidden:!1,formItemProps:{slots:{default:e=>n("div",{class:"w-[100%] flex"},[n(x,{multiple:!0,modelValue:e.friendList,"onUpdate:modelValue":r=>e.friendList=r},null)])}}},{field:"desc",label:"备注",component:"Input",colProps:{span:24}}]),p=F({description:[t()],name:[t()],thumbUrl:[t()],title:[t()],type:[t()],url:[t()]}),{formRegister:l,formMethods:o}=P(),{setValues:s,getFormData:b,getElFormExpose:L,setSchema:d}=o,g=()=>h(this,null,function*(){const e=yield L();if(yield e==null?void 0:e.validate().catch(f=>{}))return yield b()});return R(()=>u.currentRow,e=>{e&&s(e)},{deep:!0,immediate:!0}),c({submit:g,change:a}),(e,r)=>(U(),S(_(w),{rules:p,"auto-set-placeholder":!1,onRegister:_(l),schema:m.value},null,8,["rules","onRegister","schema"]))}});export{q as _};
