"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("vue"),s=require("lodash"),f=require("../../commons/core/useChart.js"),i=require("../../commons/utils/parseDataset.js"),b=require("../../commons/plugins/datasource/index.js"),l=require("../../commons/plugins/event/index.js"),_={class:"zerov-widget"},E=["id"],O=r.defineComponent({name:"zv-chart-pie-index"}),g=r.defineComponent({...O,props:{basicOption:{},sources:{},useEvents:{},uuid:{}},emits:["chart-click","chart-dblclick","chart-mousedown","chart-mouseover","chart-mouseout","chart-contextmenu"],setup(p,{expose:d,emit:h}){const e=p,v=h,{id:m,setOption:u,chart:D,renderChart:a,renderData:o}=f.useChart({basicOption:s.cloneDeep(e.basicOption),useEvents:s.cloneDeep(e.useEvents),customRenderData:t=>{t=s.cloneDeep(t);const c=s.cloneDeep(e.basicOption.title.text);b.SHJDatasourceV2.parse({tId:e.uuid,sources:e.sources,callback:({data:n})=>{try{l.SHJParseEvent.parseEvents(e.useEvents,"dataListener",n),t.dataset=i.parseDataset(s.cloneDeep(n)),t.title.text=(i.parseDataset(s.cloneDeep(n)).source[0][i.parseDataset(s.cloneDeep(n)).dimensions[1]]||0)+c,u(t)}catch{l.SHJParseEvent.parseEvents(e.useEvents,"dataListener",null),u(t)}}})},emit:v});return r.watch(()=>e.sources,()=>{e.sources&&e.sources.length>0&&o(e.basicOption)},{deep:!0}),r.watch(()=>s.cloneDeep(e.basicOption),(t,c)=>{s.isEqual(t,c)||a(t)},{deep:!0}),d({getEchartsInstance:()=>D.value,refresh:()=>{e.sources&&e.sources.length>0&&a(e.basicOption),o(e.basicOption)},refreshView:()=>{e.sources&&e.sources.length>0&&a(e.basicOption)},refreshData:()=>{o(e.basicOption)}}),(t,c)=>(r.openBlock(),r.createElementBlock("div",_,[r.createElementVNode("div",{id:r.unref(m),class:"widget"},null,8,E)]))}});exports.default=g;
