"use strict";(globalThis.webpackChunksuperset=globalThis.webpackChunksuperset||[]).push([[3496],{33496:(e,t,r)=>{r.r(t),r.d(t,{default:()=>a}),r(67294);var n=r(63475),l=r(99381),s=r(11965);function a(e){const{height:t,width:r,echartOptions:a,selectedValues:c,refs:u}=e,i=(0,l.C0)(e);return(0,s.tZ)(n.Z,{refs:u,height:t,width:r,echartOptions:a,eventHandlers:i,selectedValues:c})}},63475:(e,t,r)=>{r.d(t,{Z:()=>i});var n=r(67294),l=r(51995),s=r(31431),a=r(11965);const c=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,s.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,a.tZ)(c,{ref:d,height:t,width:e})}const i=(0,n.forwardRef)(u)},99381:(e,t,r)=>{r.d(t,{C0:()=>o});var n=r(51115),l=r(67190),s=r(10581),a=r(6915);const c=(e,t,r)=>n=>{const l=Object.values(e);let s;s=l.includes(n)?l.filter((e=>e!==n)):[n];const a=s.map((e=>r[e]));return{dataMask:{extraFormData:{filters:0===s.length?[]:t.map(((e,t)=>{const r=a.map((e=>e[t]));return null==r?{col:e,op:"IS NULL"}:{col:e,op:"IN",val:r}}))},filterState:{value:a.length?a:null,selectedValues:s.length?s:null}},isCurrentValueSelected:l.includes(n)}},u=(e,t,r)=>({name:n})=>{var l;if(!r)return;const s=null==(l=e(n))?void 0:l.dataMask;s&&t(s)},i=(e,t,r,c,u,i)=>o=>{if(t){o.event.stop();const h=o.event.event,d=[];if(e.length>0){const t=r[o.name];e.forEach(((e,r)=>{d.push({col:e,op:"==",val:t[r],formattedVal:(0,a.mj)(t[r],{timeFormatter:(0,n.bt)(u.dateFormat),numberFormatter:(0,l.JB)(u.numberFormat),coltype:null==i?void 0:i[(0,s.Z)(e)]})})}))}t(h.clientX,h.clientY,{drillToDetail:d,crossFilter:c(o.name),drillBy:{filters:d,groupbyFieldName:"groupby"}})}},o=e=>{const{groupby:t,onContextMenu:r,setDataMask:n,labelMap:l,emitCrossFilters:s,selectedValues:a,coltypeMapping:o,formData:h}=e;return{click:u(c(a,t,l),n,s),contextmenu:i(t,r,l,c(a,t,l),h,o)}}}}]);
//# sourceMappingURL=9697ce31428032917cd4.chunk.js.map