"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("vue"),a=require("lodash"),b=require("../../commons/core/datasource/index.js"),E=require("../../commons/core/useChart.js"),_=require("../../commons/utils/parseDataset.js"),x={class:"zerov-widget"},D=["id"],O=c.defineComponent({name:"zv-chart-bar-contrast"}),w=c.defineComponent({...O,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:i}=E.useChart({basicOption:a.cloneDeep(e.basicOption),useEvents:a.cloneDeep(e.useEvents),customRenderData:s=>{s=a.cloneDeep(s),b.SHJDatasourceV2.parse({tId:e.uuid,sources:e.sources,callback:({data:r})=>{try{window.SHJParseEvent(e.useEvents,"dataListener",r),s.dataset=_.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 o in t.value)if(typeof t.value[o]=="number"&&t.value[o]<0)return-t.value[o]}}),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&&i(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),i(e.basicOption)},refreshView:()=>{e.sources&&e.sources.length>0&&n(e.basicOption)},refreshData:()=>{i(e.basicOption)}}),(s,r)=>(c.openBlock(),c.createElementBlock("div",x,[c.createElementVNode("div",{id:c.unref(p),class:"widget"},null,8,D)]))}});exports.default=w;
