"use strict";(globalThis.webpackChunksuperset=globalThis.webpackChunksuperset||[]).push([[4790],{64790:(e,t,r)=>{r.r(t),r.d(t,{default:()=>d});var n=r(51115),l=r(67190),a=r(10581),c=r(67294),s=r(63475),u=r(49239),i=r(92638),o=r(6915),h=r(11965);function d({echartOptions:e,emitCrossFilters:t,groupby:r,height:d,labelMap:f,onContextMenu:p,refs:g,setDataMask:v,selectedValues:m,width:b,formData:w,coltypeMapping:k}){const y=(0,c.useCallback)(((e,t)=>{if(null!=e&&e.children)return;const{treePath:n}=(0,i.Im)(t),l=n.join(","),a=Object.values(m);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,m]),I=(0,c.useCallback)(((e,r)=>{var n;if(!t)return;const l=null==(n=y(e,r))?void 0:n.dataMask;l&&v(l)}),[t,y,v]),E={click:e=>{const{data:t,treePathInfo:r}=e;I(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)(w.dateFormat),numberFormatter:(0,l.JB)(w.numberFormat),coltype:null==k?void 0:k[(0,a.Z)(r[t])]})})})),p(i.clientX,i.clientY,{drillToDetail:h,crossFilter:y(t,c),drillBy:{filters:d,groupbyFieldName:"groupby"}})}}}};return(0,h.tZ)(s.Z,{refs:g,height:d,width:b,echartOptions:e,eventHandlers:E,selectedValues:m})}},63475:(e,t,r)=>{r.d(t,{Z:()=>i});var n=r(67294),l=r(51995),a=r(31431),c=r(11965);const s=l.iK.div`
  height: ${({height:e})=>e};
  width: ${({width:e})=>e};
`;function u({width:e,height:t,echartOptions:r,eventHandlers:l,zrEventHandlers:u,selectedValues:i={},refs:o},h){const d=(0,n.useRef)(null);o&&(o.divRef=d);const f=(0,n.useRef)(),p=(0,n.useMemo)((()=>Object.keys(i)||[]),[i]),g=(0,n.useRef)([]);(0,n.useImperativeHandle)(h,(()=>({getEchartInstance:()=>f.current}))),(0,n.useEffect)((()=>{d.current&&(f.current||(f.current=(0,a.S1)(d.current)),Object.entries(l||{}).forEach((([e,t])=>{var r,n;null==(r=f.current)||r.off(e),null==(n=f.current)||n.on(e,t)})),Object.entries(u||{}).forEach((([e,t])=>{var r,n;null==(r=f.current)||r.getZr().off(e),null==(n=f.current)||n.getZr().on(e,t)})),f.current.setOption(r,!0))}),[r,l,u]),(0,n.useEffect)((()=>{f.current&&(f.current.dispatchAction({type:"downplay",dataIndex:g.current.filter((e=>!p.includes(e)))}),p.length&&f.current.dispatchAction({type:"highlight",dataIndex:p}),g.current=p)}),[p]);const v=(0,n.useCallback)((({width:e,height:t})=>{f.current&&f.current.resize({width:e,height:t})}),[]);return(0,n.useEffect)((()=>(v({width:e,height:t}),()=>{var e;return null==(e=f.current)?void 0:e.dispose()})),[]),(0,n.useLayoutEffect)((()=>{v({width:e,height:t})}),[e,t,v]),(0,c.tZ)(s,{ref:d,height:t,width:e})}const i=(0,n.forwardRef)(u)}}]);
//# sourceMappingURL=810bd646fde6d6255ba4.chunk.js.map