import{b as m}from"./data-3da52ac2.js";import{m as h}from"./message-5a54ef00.js";import{e as d,I as b}from"./index-5df52834.js";import{d as g}from"./edit-pen-37b5ced2.js";import{C}from"./check-f53d8364.js";function y(){const a=Vue.ref({}),t=Vue.ref({}),o=Vue.ref(-1),r=Vue.ref(d(m,!0)),s=Vue.computed(()=>u=>{var e;return(e=a.value[u])==null?void 0:e.value}),l=Vue.computed(()=>u=>{var e;return(e=t.value[u])==null?void 0:e.editing}),n=Vue.computed(()=>(u,e=!1)=>["cursor-pointer","ml-2","transition","delay-100",e?["hover:scale-110","hover:text-red-500"]:l.value(u)&&["scale-150","text-red-500"]]),c=[{label:"ID（可编辑）",prop:"id",cellRenderer:({row:u,index:e})=>Vue.createVNode("div",{class:"flex-bc w-full h-[32px]",onMouseenter:()=>o.value=e,onMouseleave:()=>i(e)},[Vue.withDirectives(Vue.createVNode("p",null,[u.id]),[[Vue.vShow,!l.value(e)]]),Vue.createVNode(Vue.Transition,{"enter-active-class":"animate__animated animate__fadeInUp animate__faster"},{default:()=>[Vue.withDirectives(Vue.createVNode(Vue.resolveComponent("el-input"),{modelValue:s.value(e),onInput:f=>V(f,e)},null),[[Vue.vShow,l.value(e)]])]}),Vue.withDirectives(Vue.createVNode(Vue.resolveComponent("iconify-icon-offline"),{icon:C,class:n.value(e),onClick:()=>p(e)},null),[[Vue.vShow,l.value(e)]]),Vue.withDirectives(Vue.createVNode(Vue.resolveComponent("iconify-icon-offline"),{icon:g,class:n.value(e,!0),onClick:()=>v(u,e)},null),[[Vue.vShow,o.value===e&&!l.value(e)]])])},{label:"日期",prop:"date"},{label:"姓名",prop:"name"},{label:"地址",prop:"address"}];function v({id:u},e){a.value[e]=Object.assign({},a.value[e],{value:u}),t.value[e]=Object.assign({},t.value[e],{editing:!0})}function i(u){var e;(e=a.value[u])!=null&&e.value?o.value=u:o.value=-1}function V(u,e){a.value[e].value=u}function p(u){r.value[u].id=a.value[u].value,h(`您编辑了第 ${u+1} 行，编辑后数据为：${JSON.stringify(r.value[u])}`,{type:"success"}),t.value[u]=Object.assign({},t.value[u],{editing:!1}),b().then(()=>a.value[u].value=null)}return{columns:c,dataList:r}}export{y as useColumns};
