"use strict";(globalThis.webpackChunksuperset=globalThis.webpackChunksuperset||[]).push([[4790],{64790:(e,t,r)=>{r.r(t),r.d(t,{default:()=>d});var n=r(751115),l=r(767190),a=r(310581),c=r(667294),s=r(263475),u=r(849239),i=r(92638),o=r(806915),h=r(135944);function d({echartOptions:e,emitCrossFilters:t,groupby:r,height:d,labelMap:f,onContextMenu:p,refs:g,setDataMask:N,selectedValues:v,width:m,formData:b,coltypeMapping:w}){const k=(0,c.useCallback)(((e,t)=>{if(null!=e&&e.children)return;const{treePath:n}=(0,i.Im)(t),l=n.join(","),a=Object.values(v);let c;c=a.includes(l)?a.filter((e=>e!==l)):[l];const s=c.map((e=>f[e]));return{dataMask:{extraFormData:{filters:0===c.length?[]:r.map(((e,t)=>{const r=s.map((e=>e[t]));return null==r?{col:e,op:"IS NULL"}:{col:e,op:"IN",val:r}}))},filterState:{value:s.length?s:null,selectedValues:c.length?c:null}},isCurrentValueSelected:a.includes(l)}}),[r,f,v]),y=(0,c.useCallback)(((e,n)=>{var l;if(!t||0===r.length)return;const a=null==(l=k(e,n))?void 0:l.dataMask;a&&N(a)}),[t,k,N]),I={click:e=>{const{data:t,treePathInfo:r}=e;y(t,r)},contextmenu:async e=>{if(p){e.event.stop();const{data:t,treePathInfo:c}=e,{treePath:s}=(0,i.Im)(c);if(s.length>0){const i=e.event.event,h=[],d=[];s.forEach(((e,t)=>{const c="null"===e?u.li:e;h.push({col:r[t],op:"==",val:c,formattedVal:e}),d.push({col:r[t],op:"==",val:c,formattedVal:(0,o.mj)(c,{timeFormatter:(0,n.bt)(b.dateFormat),numberFormatter:(0,l.JB)(b.numberFormat),coltype:null==w?void 0:w[(0,a.Z)(r[t])]})})})),p(i.clientX,i.clientY,{drillToDetail:h,crossFilter:r.length>0?k(t,c):void 0,drillBy:{filters:d,groupbyFieldName:"groupby"}})}}}};return(0,h.tZ)(s.Z,{refs:g,height:d,width:m,echartOptions:e,eventHandlers:I,selectedValues:v})}},263475:(e,t,r)=>{r.d(t,{Z:()=>P});var n=r(667294),l=r(751995),a=r(768023),c=r(281615),s=r(967021),u=r(358062),i=r(781836),o=r(873463),h=r(216026),d=r(259048),f=r(15746),p=r(126947),g=r(302907),N=r(516049),v=r(541969),m=r(938198),b=r(548785),w=r(557494),k=r(570012),y=r(730322),I=r(655958),E=r(603174),C=r(731281),F=r(210680),O=r(347106),M=r(693450),V=r(499326),Z=r(617813),j=r(129167),x=r(787164),D=r(135944);const R=l.iK.div`
  height: ${({height:e})=>e};
  width: ${({width:e})=>e};
`;function H({width:e,height:t,echartOptions:r,eventHandlers:l,zrEventHandlers:a,selectedValues:s={},refs:u},i){const o=(0,n.useRef)(null);u&&(u.divRef=o);const h=(0,n.useRef)(),d=(0,n.useMemo)((()=>Object.keys(s)||[]),[s]),f=(0,n.useRef)([]);(0,n.useImperativeHandle)(i,(()=>({getEchartInstance:()=>h.current}))),(0,n.useEffect)((()=>{o.current&&(h.current||(h.current=(0,c.S1)(o.current)),Object.entries(l||{}).forEach((([e,t])=>{var r,n;null==(r=h.current)||r.off(e),null==(n=h.current)||n.on(e,t)})),Object.entries(a||{}).forEach((([e,t])=>{var r,n;null==(r=h.current)||r.getZr().off(e),null==(n=h.current)||n.getZr().on(e,t)})),h.current.setOption(r,!0))}),[r,l,a]),(0,n.useEffect)((()=>{h.current&&(h.current.dispatchAction({type:"downplay",dataIndex:f.current.filter((e=>!d.includes(e)))}),d.length&&h.current.dispatchAction({type:"highlight",dataIndex:d}),f.current=d)}),[d]);const p=(0,n.useCallback)((({width:e,height:t})=>{h.current&&h.current.resize({width:e,height:t})}),[]);return(0,n.useEffect)((()=>(p({width:e,height:t}),()=>{var e;return null==(e=h.current)?void 0:e.dispose()})),[]),(0,n.useLayoutEffect)((()=>{p({width:e,height:t})}),[e,t,p]),(0,D.tZ)(R,{ref:o,height:t,width:e})}(0,a.D)([k.N,s.N,u.N,i.N,o.N,h.N,d.N,f.N,p.N,g.N,N.N,v.N,m.N,b.N,w.N,y.N,I.N,E.N,C.N,F.N,O.N,M.N,V.N,Z.N,j.N,x.T]);const P=(0,n.forwardRef)(H)}}]);
//# sourceMappingURL=10af76c46d5eda43b7fd.chunk.js.map