From fb809f124c1c4127fec43c84d16ae50d3785fc87 Mon Sep 17 00:00:00 2001 From: iven Date: Fri, 17 Apr 2026 11:19:44 +0800 Subject: [PATCH] =?UTF-8?q?fix(web):=20=E4=BF=AE=E5=A4=8D=20TypeScript=20?= =?UTF-8?q?=E7=BC=96=E8=AF=91=E9=94=99=E8=AF=AF=20=E2=80=94=2010=20?= =?UTF-8?q?=E5=A4=84=E7=B1=BB=E5=9E=8B/=E6=9C=AA=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E5=8F=98=E9=87=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - EntitySelect: 未使用的 searchFields 改为 _searchFields - PluginKanbanPage: DragEndEvent/DragStartEvent 改为 type import, lane_order 改为 optional - PluginDashboardPage: 添加 PluginPageSchema import, 移除未使用的 CHART_COLORS/palette/totalCount - PluginGraphPage: 移除未使用的 Title/textColor, 修复 hovered → hoverState --- apps/web/src/components/EntitySelect.tsx | 2 +- apps/web/src/pages/PluginDashboardPage.tsx | 11 +---------- apps/web/src/pages/PluginGraphPage.tsx | 7 +++---- apps/web/src/pages/PluginKanbanPage.tsx | 5 ++--- 4 files changed, 7 insertions(+), 18 deletions(-) diff --git a/apps/web/src/components/EntitySelect.tsx b/apps/web/src/components/EntitySelect.tsx index c485f35..636e998 100644 --- a/apps/web/src/components/EntitySelect.tsx +++ b/apps/web/src/components/EntitySelect.tsx @@ -19,7 +19,7 @@ export default function EntitySelect({ pluginId, entity, labelField, - searchFields, + searchFields: _searchFields, value, onChange, cascadeFrom, diff --git a/apps/web/src/pages/PluginDashboardPage.tsx b/apps/web/src/pages/PluginDashboardPage.tsx index 6dbf3b8..f5657f4 100644 --- a/apps/web/src/pages/PluginDashboardPage.tsx +++ b/apps/web/src/pages/PluginDashboardPage.tsx @@ -15,7 +15,7 @@ import { } from '@ant-design/icons'; import { Column, Pie, Funnel, Line } from '@ant-design/charts'; import { countPluginData, aggregatePluginData, type AggregateItem } from '../api/pluginData'; -import { getPluginSchema, type PluginEntitySchema, type PluginSchemaResponse, type DashboardWidget } from '../api/plugins'; +import { getPluginSchema, type PluginEntitySchema, type PluginSchemaResponse, type PluginPageSchema, type DashboardWidget } from '../api/plugins'; // ── 类型定义 ── @@ -188,12 +188,10 @@ function SkeletonStatCard({ delay }: { delay: string }) { function BreakdownCard({ breakdown, totalCount, - palette, index, }: { breakdown: FieldBreakdown; totalCount: number; - palette: { tagColor: string }; index: number; }) { const maxCount = Math.max(...breakdown.items.map((i) => i.count), 1); @@ -337,11 +335,6 @@ const WIDGET_ICON_MAP: Record = { line_chart: , }; -const CHART_COLORS = [ - '#4F46E5', '#059669', '#D97706', '#E11D48', '#7C3AED', - '#2563EB', '#0891B2', '#C026D3', '#EA580C', '#65A30D', -]; - interface WidgetData { widget: DashboardWidget; data: AggregateItem[]; @@ -751,7 +744,6 @@ export function PluginDashboardPage() { setError(null); try { - const totalCount = entityStats.find((s) => s.name === selectedEntity)?.count ?? 0; const fieldResults: FieldBreakdown[] = []; for (const field of filterableFields) { @@ -951,7 +943,6 @@ export function PluginDashboardPage() { key={bd.fieldName} breakdown={bd} totalCount={currentTotal} - palette={currentPalette} index={i} /> ))} diff --git a/apps/web/src/pages/PluginGraphPage.tsx b/apps/web/src/pages/PluginGraphPage.tsx index 25628e1..8639f6a 100644 --- a/apps/web/src/pages/PluginGraphPage.tsx +++ b/apps/web/src/pages/PluginGraphPage.tsx @@ -33,7 +33,7 @@ import { type PluginSchemaResponse, } from '../api/plugins'; -const { Text, Title } = Typography; +const { Text } = Typography; // ── Types ── @@ -300,7 +300,6 @@ function drawEdgeLabel( y: number, label: string, color: string, - textColor: string, alpha: number, ) { ctx.save(); @@ -617,7 +616,7 @@ export function PluginGraphPage() { // Edge label if (edge.label && labelPos) { const labelAlpha = hoverState.nodeId ? (isHighlighted ? 1 : 0.1) : 0.9; - drawEdgeLabel(ctx, labelPos.labelX, labelPos.labelY - 10, edge.label, colors.base, textColor, labelAlpha); + drawEdgeLabel(ctx, labelPos.labelX, labelPos.labelY - 10, edge.label, colors.base, labelAlpha); } } @@ -672,7 +671,7 @@ export function PluginGraphPage() { if (hoverState.nodeId) { const hoveredNode = nodes.find((n) => n.id === hoverState.nodeId); if (hoveredNode) { - const degree = degreeMap.get(hovered.nodeId) || 0; + const degree = degreeMap.get(hoverState.nodeId) || 0; const tooltipText = `${hoveredNode.label} (${degree} 条关系)`; ctx.save(); ctx.font = '12px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'; diff --git a/apps/web/src/pages/PluginKanbanPage.tsx b/apps/web/src/pages/PluginKanbanPage.tsx index 2de02cb..0b7ec64 100644 --- a/apps/web/src/pages/PluginKanbanPage.tsx +++ b/apps/web/src/pages/PluginKanbanPage.tsx @@ -3,14 +3,13 @@ import { useParams } from 'react-router-dom'; import { Card, Spin, Typography, Tag, message } from 'antd'; import { DndContext, - DragEndEvent, DragOverlay, - DragStartEvent, PointerSensor, useSensor, useSensors, closestCorners, } from '@dnd-kit/core'; +import type { DragEndEvent, DragStartEvent } from '@dnd-kit/core'; import { listPluginData, patchPluginData } from '../api/pluginData'; import { getPluginSchema, type PluginPageSchema } from '../api/plugins'; @@ -255,7 +254,7 @@ export default function PluginKanbanPageRoute() { const [pageConfig, setPageConfig] = useState<{ entity: string; lane_field: string; - lane_order: string[]; + lane_order?: string[]; card_title_field: string; card_subtitle_field?: string; card_fields?: string[];