import{_ as I}from"./index-M_JNBppB.js";/* empty css                  *//* empty css                 */import{ax as M,r as p,c as U,B as d,z as n,D as a,M as N,a7 as T,H as b,y,V as C,L as V,O as B,F as x,K as E}from"./vue-BJk78QHK.js";import{c as h,f as F,q as L}from"./element-3_pOinej.js";import"./threejs-BafxXW5-.js";import"./utils-YI6ye1sf.js";import"./vxe-Dx3zSILm.js";const O={class:"edit-table"},R=["onClick"],S={key:1},$=["onClick"],j={key:1},q=Object.assign({name:"EditBar4"},{__name:"EditBar4",setup(H){const v=M(),o=p(""),i=p(!1),m=p(""),s=p(""),c=U(()=>{var t,e,u;return(u=(e=(t=v.state.curComponent)==null?void 0:t.propValue)==null?void 0:e.data)!=null&&u.data?v.state.curComponent.propValue.data.data:[]});function g(){i.value=!0}function f(t,e){m.value=e,o.value=t,s.value=o.value}function k(){i.value=!1,o.value=""}function z(){if(!s.value&&s.value!==0){L.error("请先选择要删除的行");return}const t=c.value.findIndex(e=>e===s.value);t!==-1&&(c.value.splice(t,1),s.value="")}function w(){c.value.push({value:100,name:"新类别"})}return(t,e)=>{const u=h,_=F;return n(),d("div",O,[e[5]||(e[5]=a("h4",{style:{color:"#66b1ff","margin-bottom":"10px"}}," 数据源 ",-1)),a("table",{onDblclick:g},[a("tbody",null,[e[2]||(e[2]=a("tr",{style:{color:"#66b1ff",height:"40px"}},[a("th",null,"类别(name)"),a("th",null,"值(value)")],-1)),(n(!0),d(N,null,T(c.value,(l,D)=>(n(),d("tr",{key:D},[a("td",{class:b({selected:o.value===l}),onClick:r=>f(l,"name")},[i.value&&o.value===l&&m.value==="name"?(n(),y(u,{key:0,modelValue:l.name,"onUpdate:modelValue":r=>l.name=r,onBlur:k,onClick:e[0]||(e[0]=C(()=>{},["stop"])),size:"small"},null,8,["modelValue","onUpdate:modelValue"])):(n(),d("span",S,V(l.name),1))],10,R),a("td",{class:b({selected:o.value===l}),onClick:r=>f(l,"value")},[i.value&&o.value===l&&m.value==="value"?(n(),y(u,{key:0,modelValue:l.value,"onUpdate:modelValue":r=>l.value=r,modelModifiers:{number:!0},type:"number",onBlur:k,onClick:e[1]||(e[1]=C(()=>{},["stop"])),size:"small"},null,8,["modelValue","onUpdate:modelValue"])):(n(),d("span",j,V(l.value),1))],10,$)]))),128))])],32),a("div",null,[B(_,{type:"primary",size:"small",onClick:w},{default:x(()=>e[3]||(e[3]=[E(" 添加 ")])),_:1}),B(_,{type:"danger",size:"small",onClick:z},{default:x(()=>e[4]||(e[4]=[E(" 删除 ")])),_:1})])])}}}),Y=I(q,[["__scopeId","data-v-e2bf3c10"]]);export{Y as default};
