"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("vue"),a=require("lodash"),b=require("../../core/useChart.js"),E=require("../../utils/parseDataset.js"),_={class:"zerov-widget"},w=["id"],x=c.defineComponent({name:"zv-chart-bar-contrast"}),D=c.defineComponent({...x,props:{basicOption:{},sources:{},useEvents:{},uuid:{}},emits:["chart-click","chart-dblclick","chart-mousedown","chart-mouseover","chart-mouseout","chart-contextmenu"],setup(l,{expose:h,emit:d}){const e=l,f=d,{id:p,setOption:u,chart:v,renderChart:n,renderData:o}=b.useChart({basicOption:a.cloneDeep(e.basicOption),useEvents:a.cloneDeep(e.useEvents),customRenderData:s=>{s=a.cloneDeep(s),window.SHJDatasourceV2({tId:e.uuid,sources:e.sources,callback:({data:r})=>{try{window.SHJParseEvent(e.useEvents,"dataListener",r),s.dataset=E.parseDataset(a.cloneDeep(r)),m(s),u(s)}catch{window.SHJParseEvent(e.useEvents,"dataListener",null),u(s)}}})},emit:f}),m=s=>{try{s.series.forEach(r=>{r.label.formatter=t=>{for(const i in t.value)if(typeof t.value[i]=="number"&&t.value[i]<0)return-t.value[i]}}),s.xAxis[0].type==="value"&&s.xAxis.forEach(r=>{r.axisLabel.formatter=t=>t<0?-t:t}),s.yAxis[0].type==="value"&&s.yAxis.forEach(r=>{r.axisLabel.formatter=t=>t<0?-t:t})}catch{}};return c.watch(()=>e.sources,()=>{e.sources&&e.sources.length>0&&o(e.basicOption)},{deep:!0}),c.watch(()=>a.cloneDeep(e.basicOption),(s,r)=>{a.isEqual(s,r)||n(s)},{deep:!0}),h({getEchartsInstance:()=>v.value,refresh:()=>{e.sources&&e.sources.length>0&&n(e.basicOption),o(e.basicOption)},refreshView:()=>{e.sources&&e.sources.length>0&&n(e.basicOption)},refreshData:()=>{o(e.basicOption)}}),(s,r)=>(c.openBlock(),c.createElementBlock("div",_,[c.createElementVNode("div",{id:c.unref(p),class:"widget"},null,8,w)]))}});exports.default=D;
