import{_ as w}from"./index-M_JNBppB.js";/* empty css                  *//* empty css                 */import{ax as F,r as S,c,B as u,z as a,D as n,M as _,a7 as h,O as v,y as B,V as U,L as K,F as f,K as y,I as L}from"./vue-BJk78QHK.js";import{c as R,f as T,q as C}from"./element-3_pOinej.js";import"./threejs-BafxXW5-.js";import"./utils-YI6ye1sf.js";import"./vxe-Dx3zSILm.js";const j={class:"edit-table"},q={class:"table-container"},A={style:{color:"#66b1ff",height:"40px"}},W=["onDblclick"],X={key:1},G=["onDblclick"],H={key:1},J={class:"actions"},P=Object.assign({name:"EditBar2"},{__name:"EditBar2",setup(Q){const M=F(),p=S(!1),i=S({rowIndex:-1,colKey:""}),k=c(()=>M.state.curComponent.propValue),r=c(()=>k.value.data.xData),s=c(()=>k.value.data.series),b=c(()=>k.value.option.series);function D(l,e){p.value=!0,i.value={rowIndex:l,colKey:e}}function E(){p.value=!1,i.value={rowIndex:-1,colKey:""}}function N(){r.value.push("新分类"),s.value.forEach(l=>{l.data.push(0)})}function $(l){if(r.value.length<=1){C.warning("至少保留一行数据");return}r.value.splice(l,1),s.value.forEach(e=>{e.data.splice(l,1)})}function x(){const l=`新系列${s.value.length+1}`;s.value.push({name:l,data:Array.from({length:r.value.length}).fill(0)});const e={name:l,type:"bar",stack:"总量",barMaxWidth:35,itemStyle:{color:{type:"linear",x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:"rgba(255, 0, 0, 1)"},{offset:1,color:"rgba(255, 0, 0, 0)"}]}},data:[]};b.value.push(e),C.success("已添加新系列，请在下方配置其样式")}function O(l){if(s.value.length<=1){C.warning("至少保留一个数据系列");return}s.value.splice(l,1),b.value.splice(l,1)}return(l,e)=>{const g=R,m=T;return a(),u("div",j,[e[9]||(e[9]=n("h4",{style:{color:"#66b1ff","margin-bottom":"10px"}}," 数据编辑 ",-1)),n("div",q,[n("table",null,[n("thead",null,[n("tr",A,[e[3]||(e[3]=n("th",null,"分类(X轴)",-1)),(a(!0),u(_,null,h(s.value,(d,t)=>(a(),u("th",{key:t},[v(g,{modelValue:d.name,"onUpdate:modelValue":o=>d.name=o,onInput:o=>b.value[t].name=o,size:"small",placeholder:"系列名"},null,8,["modelValue","onUpdate:modelValue","onInput"])]))),128)),e[4]||(e[4]=n("th",null,"操作",-1))])]),n("tbody",null,[(a(!0),u(_,null,h(r.value,(d,t)=>(a(),u("tr",{key:t},[n("td",{onDblclick:o=>D(t,"xData")},[p.value&&i.value.rowIndex===t&&i.value.colKey==="xData"?(a(),B(g,{key:0,modelValue:r.value[t],"onUpdate:modelValue":o=>r.value[t]=o,onBlur:E,onClick:e[0]||(e[0]=U(()=>{},["stop"])),size:"small"},null,8,["modelValue","onUpdate:modelValue"])):(a(),u("span",X,K(d),1))],40,W),(a(!0),u(_,null,h(s.value,(o,V)=>(a(),u("td",{key:V,onDblclick:z=>D(t,V)},[p.value&&i.value.rowIndex===t&&i.value.colKey===V?(a(),B(g,{key:0,modelValue:o.data[t],"onUpdate:modelValue":z=>o.data[t]=z,modelModifiers:{number:!0},type:"number",onBlur:E,onClick:e[1]||(e[1]=U(()=>{},["stop"])),size:"small"},null,8,["modelValue","onUpdate:modelValue"])):(a(),u("span",H,K(o.data[t]),1))],40,G))),128)),n("td",null,[v(m,{type:"danger",link:"",onClick:o=>$(t)},{default:f(()=>e[5]||(e[5]=[y(" 删除行 ")])),_:2},1032,["onClick"])])]))),128))])])]),n("div",J,[v(m,{type:"primary",size:"small",onClick:N},{default:f(()=>e[6]||(e[6]=[y(" 添加行 (分类) ")])),_:1}),v(m,{type:"success",size:"small",onClick:x},{default:f(()=>e[7]||(e[7]=[y(" 添加列 (系列) ")])),_:1}),s.value.length>1?(a(),B(m,{key:0,type:"danger",size:"small",onClick:e[2]||(e[2]=d=>O(s.value.length-1))},{default:f(()=>e[8]||(e[8]=[y(" 删除最后一列 ")])),_:1})):L("",!0)])])}}}),ne=w(P,[["__scopeId","data-v-efbbbff1"]]);export{ne as default};
