Skip to content

Commit e4fa2f2

Browse files
committed
refactor:widget ChartDrillPaths position
1 parent 2c1bebc commit e4fa2f2

File tree

1 file changed

+19
-29
lines changed

1 file changed

+19
-29
lines changed

frontend/src/app/pages/DashBoardPage/components/Widgets/DataChartWidget/DataChartWidgetCore.tsx

Lines changed: 19 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export const DataChartWidgetCore: React.FC<{}> = memo(() => {
6969
return `${wid}_${uuidv4()}`;
7070
}, [wid]);
7171
const { onWidgetChartClick } = useContext(WidgetActionContext);
72-
const { cacheWhRef: ref, cacheW, cacheH } = useCacheWidthHeight();
72+
const { cacheWhRef, cacheW, cacheH } = useCacheWidthHeight();
7373
const { onWidgetGetData } = useContext(WidgetActionContext);
7474
const widgetRef = useRef<Widget>(widget);
7575
const drillOptionRef = useRef<IChartDrillOption>();
@@ -229,45 +229,35 @@ export const DataChartWidgetCore: React.FC<{}> = memo(() => {
229229
widgetSpecialConfig,
230230
scale,
231231
]);
232-
232+
const drillContextVal = {
233+
drillOption: drillOptionRef.current,
234+
onDrillOptionChange: handleDrillOptionChange,
235+
};
233236
return (
234-
<Wrapper className="widget-chart" ref={ref}>
235-
<ChartFrameBox>
236-
<ChartDrillContext.Provider
237-
value={{
238-
drillOption: drillOptionRef.current,
239-
onDrillOptionChange: handleDrillOptionChange,
240-
}}
241-
>
242-
<ChartWrapper>
243-
<ChartDrillContextMenu>{chartFrame}</ChartDrillContextMenu>
244-
</ChartWrapper>
245-
237+
<ChartDrillContext.Provider value={drillContextVal}>
238+
<ChartDrillContextMenu>
239+
<StyledWrapper>
240+
<ChartFrameBox ref={cacheWhRef}>{chartFrame}</ChartFrameBox>
246241
<ChartDrillPaths />
247-
</ChartDrillContext.Provider>
248-
</ChartFrameBox>
249-
</Wrapper>
242+
</StyledWrapper>
243+
</ChartDrillContextMenu>
244+
</ChartDrillContext.Provider>
250245
);
251246
});
252-
const Wrapper = styled.div`
247+
const StyledWrapper = styled.div`
253248
position: relative;
254249
display: flex;
255250
flex: 1;
256-
`;
257-
const ChartFrameBox = styled.div`
258-
position: absolute;
259-
display: flex;
260-
flex: 1;
261251
flex-direction: column;
262252
width: 100%;
263253
height: 100%;
264-
overflow: hidden;
265-
`;
266-
const ChartWrapper = styled.div`
267-
position: relative;
268-
display: flex;
269-
flex: 1;
270254
.chart-drill-menu-container {
271255
height: 100%;
272256
}
273257
`;
258+
const ChartFrameBox = styled.div`
259+
display: flex;
260+
flex: 1;
261+
flex-direction: column;
262+
overflow: hidden;
263+
`;

0 commit comments

Comments
 (0)