"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("vue"),a=require("lodash"),E=require("../../commons/plugins/datasource/index.js"),_=require("../../commons/core/useChart.js"),x=require("../../commons/utils/parseDataset.js"),l=require("../../commons/plugins/event/index.js"),D={class:"zerov-widget"},O=["id"],g=c.defineComponent({name:"zv-chart-bar-contrast"}),y=c.defineComponent({...g,props:{basicOption:{},sources:{},useEvents:{},uuid:{}},emits:["chart-click","chart-dblclick","chart-mousedown","chart-mouseover","chart-mouseout","chart-contextmenu"],setup(h,{expose:p,emit:d}){const e=h,f=d,{id:v,setOption:o,chart:m,renderChart:n,renderData:i}=_.useChart({basicOption:a.cloneDeep(e.basicOption),useEvents:a.cloneDeep(e.useEvents),customRenderData:s=>{s=a.cloneDeep(s),E.SHJDatasourceV2.parse({tId:e.uuid,sources:e.sources,callback:({data:r})=>{try{l.SHJParseEvent.parseEvents(e.useEvents,"dataListener",r),s.dataset=x.parseDataset(a.cloneDeep(r)),b(s),o(s)}catch{l.SHJParseEvent.parseEvents(e.useEvents,"dataListener",null),o(s)}}})},emit:f}),b=s=>{try{s.series.forEach(r=>{r.label.formatter=t=>{for(const u in t.value)if(typeof t.value[u]=="number"&&t.value[u]<0)return-t.value[u]}}),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}),p({getEchartsInstance:()=>m.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",D,[c.createElementVNode("div",{id:c.unref(v),class:"widget"},null,8,O)]))}});exports.default=y;
