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