import{cN as f,cG as I,I as b,K as C,aK as g}from"./index.17037962789732.js";import"./index.1703796278973305.js";import"./index.170379627897315.js";import"./index.170379627897317.js";import"./index.1703796278973301.js";import"./index.1703796278973302.js";import"./index.170379627897332.js";import"./index.1703796278973303.js";import"./index.170379627897339.js";import"./index.170379627897316.js";import"./index.170379627897314.js";import"./index.1703796278973304.js";import{d as B,l as w,o as i,x as E,b as o,a as n,c as u,u as l,B as N,t as V}from"./vue.1703796278973.js";const j={class:"table-wrapper"},z=B({__name:"EditTable",props:{headers:{type:Array,default:()=>[]}},emits:["update:headers"],setup(m,{emit:_}){const x=m,h=[{title:"KEY",dataIndex:"key"},{title:"VALUE",dataIndex:"value"},{title:"操作",dataIndex:"operation",width:80,fixed:"right"}],e=w({get:()=>x.headers,set:t=>_("update:headers",t)}),v=t=>{const p=e.value.findIndex(d=>d.id===t);e.value.splice(p,1)},k=()=>{e.value.push({id:e.value.length,key:"",value:""})};return(t,p)=>{const d=b,r=C,y=g;return i(),E("div",j,[o(y,{columns:h,"data-source":l(e),bordered:"",pagination:!1},{bodyCell:n(({column:a,text:A,record:s})=>[["key","value"].includes(a.dataIndex)?(i(),u(d,{key:0,value:s[a.dataIndex],"onUpdate:value":c=>s[a.dataIndex]=c},null,8,["value","onUpdate:value"])):a.dataIndex==="operation"?(i(),u(r,{key:1,type:"text"},{icon:n(()=>[o(l(f),{onClick:c=>v(s.id)},null,8,["onClick"])]),_:2},1024)):N("",!0)]),_:1},8,["data-source"]),o(r,{type:"dashed",onClick:k,style:{width:"100%","margin-top":"5px"}},{icon:n(()=>[o(l(I))]),default:n(()=>[V(" 添加 ")]),_:1})])}}});export{z as _};
