Skip to content

Commit 416fb69

Browse files
committed
fix: some bugfix
1 parent ed50470 commit 416fb69

4 files changed

Lines changed: 37 additions & 11 deletions

File tree

src/frontend/platform/src/pages/Dashboard/components/charts/BaseChart.tsx

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export function BaseChart({ isDark, data, chartType, dataConfig, styleConfig }:
6161
}, [])
6262

6363
// Initialize and update the chart.
64+
const [screenFull, setScreenFull] = useState(false)
6465
useEffect(() => {
6566
if (!echartsLibRef.current || !domRef.current || isLoading) return
6667

@@ -94,7 +95,7 @@ export function BaseChart({ isDark, data, chartType, dataConfig, styleConfig }:
9495
chartRef.current = null
9596
}
9697
}
97-
}, [echartsLibRef.current, data, chartType, dataConfig, styleConfig, isLoading, isDark])
98+
}, [screenFull, echartsLibRef.current, data, chartType, dataConfig, styleConfig, isLoading, isDark])
9899

99100
// resize
100101
useEffect(() => {
@@ -119,6 +120,21 @@ export function BaseChart({ isDark, data, chartType, dataConfig, styleConfig }:
119120
}
120121
}, [chartRef.current])
121122

123+
// screen full
124+
useEffect(() => {
125+
const handleFullscreenChange = () => {
126+
setScreenFull(!screenFull)
127+
};
128+
129+
document.addEventListener('fullscreenchange', handleFullscreenChange);
130+
document.addEventListener('webkitfullscreenchange', handleFullscreenChange);
131+
132+
return () => {
133+
document.removeEventListener('fullscreenchange', handleFullscreenChange);
134+
document.removeEventListener('webkitfullscreenchange', handleFullscreenChange);
135+
};
136+
}, []);
137+
122138
if (isLoading) {
123139
return (
124140
<div className="w-full h-full flex items-center justify-center">
@@ -201,7 +217,7 @@ const getCartesianChartOption = (
201217
const isHorizontal = chartType.includes('horizontal');
202218
const isStacked = chartType.includes('stacked');
203219
const isLineOrArea = chartType.includes('line') || chartType.includes('area');
204-
const isArea = chartType.includes('area') || chartType === 'stacked-line'; // Depending on logic
220+
const isArea = chartType.includes('area')
205221

206222
// Tooltip
207223
const tooltipFormatter = (params: any[]) => {
@@ -299,7 +315,8 @@ const getCartesianChartOption = (
299315
name: s.name,
300316
data: processedData,
301317
type: isLineOrArea ? 'line' : 'bar',
302-
symbol: 'none',
318+
symbol: 'circle',
319+
symbolSize: 0,
303320
itemStyle: {
304321
borderRadius: (!isLineOrArea && !isStacked)
305322
? (isHorizontal ? [0, 4, 4, 0] : [4, 4, 0, 0])
@@ -308,7 +325,12 @@ const getCartesianChartOption = (
308325
};
309326

310327
if (styleConfig.showDataLabel) {
311-
item.label = { show: true, position: isLineOrArea ? 'top' : 'inside' };
328+
item.label = {
329+
show: true,
330+
position: 'top',
331+
fontSize: 10,
332+
color: "#666",
333+
};
312334
}
313335
if (isStacked) item.stack = 'total';
314336
if (isArea) item.areaStyle = {};
@@ -407,11 +429,12 @@ const buildLegendOption = (styleConfig: ComponentStyleConfig, seriesNames?: stri
407429
const buildTooltipOption = (type: 'axis' | 'item', formatter: (params: any) => string) => {
408430
return {
409431
trigger: type,
410-
axisPointer: type === 'axis' ? { type: 'shadow' } : undefined,
411-
appendToBody: true,
412432
confine: true,
433+
axisPointer: type === 'axis' ? { type: 'shadow' } : undefined,
413434
enterable: true,
414435
extraCssText: 'max-height: 500px; overflow-y: auto;',
415-
formatter,
436+
appendToBody: !document.fullscreenElement,
437+
// renderMode: 'html',
438+
formatter
416439
};
417440
};

src/frontend/platform/src/pages/Dashboard/components/editor/ComponentPicker.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ const ComponentPicker = ({ children, className, onSelect, maxHeight = 500 }: Com
6464
const [open, setOpen] = useState(false);
6565

6666
const handleItemClick = (item) => {
67-
onSelect({ ...item, title: t(`chart.${item.label}`) });
67+
onSelect({ ...item, title: item.type === ChartType.Metric ? '' : t(`chart.${item.label}`) });
6868
setOpen(false);
6969
};
7070

src/frontend/platform/src/pages/Dashboard/components/editor/ComponentWrapper.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export function ComponentWrapper({
8383

8484
if (trimmedTitle !== component.title) {
8585
setTitle(trimmedTitle)
86-
onRename(component.id, trimmedTitle)
86+
// onRename(component.id, trimmedTitle)
8787
updateEditingComponent({ title: trimmedTitle })
8888
}
8989
}
@@ -130,6 +130,7 @@ export function ComponentWrapper({
130130

131131
return (
132132
<div
133+
id={component.id}
133134
className={cn(`relative w-full h-full rounded-md overflow-visible transition-all border ${!isPreviewMode && isSelected ? 'component-select border border-primary' : ''
134135
}`,
135136
!componentData.style_config.bgColor && 'dark:bg-gray-900',

src/frontend/platform/src/pages/Dashboard/components/editor/EditorCanvas.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,9 @@ export function EditorCanvas({ isLoading, isPreviewMode }: EditorCanvasProps) {
113113
const isInsideContainer = containerRef.current?.contains(target);
114114
const isDragHandle = target.closest('.drag-handle');
115115
if (isInsideContainer && !isDragHandle) {
116-
clearComponentEditorStore();
116+
setTimeout(() => {
117+
clearComponentEditorStore();
118+
}, 0);
117119
}
118120
};
119121

@@ -232,7 +234,7 @@ export function EditorCanvas({ isLoading, isPreviewMode }: EditorCanvasProps) {
232234
<div className="flex h-full">
233235
<div
234236
id="edit-charts-panne"
235-
className={cn("flex-1 overflow-auto no-scrollbar", theme)}
237+
className={cn("flex-1 relative overflow-auto no-scrollbar", theme)}
236238
style={{
237239
backgroundColor: theme === 'dark' ? '#1a1a1a' : '#f5f5f5',
238240
}}

0 commit comments

Comments
 (0)