import{_ as T}from"./index-M_JNBppB.js";/* empty css                  *//* empty css                 */import{u as y,g as v}from"./partRequest-DNeIWx7q.js";import{c as E,f as B,q as p}from"./element-3_pOinej.js";import{ao as g,B as u,z as o,D as s,M as V,a7 as q,H as h,G as k,y as f,L as b,O as _,F as C,K as D}from"./vue-BJk78QHK.js";import"./threejs-BafxXW5-.js";import"./utils-YI6ye1sf.js";import"./vxe-Dx3zSILm.js";const R={directives:{focus:{inserted(e){e.querySelector("input").focus()}}},data(){return{curProperty:"",curTd:"",canEdit:!1,col:"",preCurTd:"",methodOptions:["GET","POST","PUT","DELETE"],dataOptions:["object","array","string"]}},computed:{tableData(){return this.$store.state.curComponent.propValue.config.data}},watch:{},methods:{onDblclick(){this.canEdit=!0},onClick(e,a){this.col=a,this.curTd=e,this.preCurTd=this.curTd,this.curTd,this.canEdit},onBlur(){this.canEdit=!1,this.curTd=""},deleteRow(){if(!this.preCurTd&&this.preCurTd!==0){p.error("请先选择要删除的行");return}const e=this.preCurTd;this.tableData.splice(e,1)},addRow(){this.tableData.push({value:"",name:""})},addArrayData(){this.request.data.push("")},addData(){this.request.data.push(["",""])},deleteData(e){this.request.data.splice(e,1)},onChnage(){this.request.paramType==="array"?this.request.data=[""]:this.request.data=[["",""]]},validateURL(){const e=this.request.url;(e&&/^\d+$/.test(e)||!y.test(v(e)))&&p.error("请输入正确的 URL")}}},U={class:"edit-table"},x=["onClick"],L={key:1},z=["onClick"],O={key:1};function S(e,a,N,P,r,t){const d=E,c=B,m=g("focus");return o(),u("div",U,[a[4]||(a[4]=s("h4",{style:{color:"blue","margin-bottom":"10px"}},"数据",-1)),s("table",{onDblclick:a[0]||(a[0]=(...i)=>t.onDblclick&&t.onDblclick(...i))},[s("tbody",null,[a[1]||(a[1]=s("tr",{style:{color:"blue"}},[s("th",null,"name"),s("th",null,"value")],-1)),(o(!0),u(V,null,q(t.tableData,(i,l)=>(o(),u("tr",{key:l},[s("td",{class:h({selected:r.curTd===l}),onClick:n=>t.onClick(l,"name")},[r.canEdit&&r.curTd===l&&r.col==="name"?k((o(),f(d,{key:0,modelValue:t.tableData[l].name,"onUpdate:modelValue":n=>t.tableData[l].name=n,onBlur:t.onBlur},null,8,["modelValue","onUpdate:modelValue","onBlur"])),[[m]]):(o(),u("span",L,b(i.name),1))],10,x),s("td",{class:h({selected:r.curTd===l}),onClick:n=>t.onClick(l,"value")},[r.canEdit&&r.curTd===l&&r.col==="value"?k((o(),f(d,{key:0,modelValue:t.tableData[l].value,"onUpdate:modelValue":n=>t.tableData[l].value=n,onBlur:t.onBlur},null,8,["modelValue","onUpdate:modelValue","onBlur"])),[[m]]):(o(),u("span",O,b(i.value),1))],10,z)]))),128))])],32),s("div",null,[_(c,{type:"primary",size:"small",onClick:t.addRow},{default:C(()=>a[2]||(a[2]=[D("添加")])),_:1},8,["onClick"]),_(c,{type:"danger",size:"small",onClick:t.deleteRow},{default:C(()=>a[3]||(a[3]=[D("删除")])),_:1},8,["onClick"])])])}const Q=T(R,[["render",S],["__scopeId","data-v-8bcfae0b"]]);export{Q as default};
