fix(web): 修复 TypeScript 编译错误 — 10 处类型/未使用变量问题

- EntitySelect: 未使用的 searchFields 改为 _searchFields
- PluginKanbanPage: DragEndEvent/DragStartEvent 改为 type import, lane_order 改为 optional
- PluginDashboardPage: 添加 PluginPageSchema import, 移除未使用的 CHART_COLORS/palette/totalCount
- PluginGraphPage: 移除未使用的 Title/textColor, 修复 hovered → hoverState
This commit is contained in:
iven
2026-04-17 11:19:44 +08:00
parent 60799176ca
commit fb809f124c
4 changed files with 7 additions and 18 deletions

View File

@@ -19,7 +19,7 @@ export default function EntitySelect({
pluginId, pluginId,
entity, entity,
labelField, labelField,
searchFields, searchFields: _searchFields,
value, value,
onChange, onChange,
cascadeFrom, cascadeFrom,

View File

@@ -15,7 +15,7 @@ import {
} from '@ant-design/icons'; } from '@ant-design/icons';
import { Column, Pie, Funnel, Line } from '@ant-design/charts'; import { Column, Pie, Funnel, Line } from '@ant-design/charts';
import { countPluginData, aggregatePluginData, type AggregateItem } from '../api/pluginData'; 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({ function BreakdownCard({
breakdown, breakdown,
totalCount, totalCount,
palette,
index, index,
}: { }: {
breakdown: FieldBreakdown; breakdown: FieldBreakdown;
totalCount: number; totalCount: number;
palette: { tagColor: string };
index: number; index: number;
}) { }) {
const maxCount = Math.max(...breakdown.items.map((i) => i.count), 1); const maxCount = Math.max(...breakdown.items.map((i) => i.count), 1);
@@ -337,11 +335,6 @@ const WIDGET_ICON_MAP: Record<string, React.ReactNode> = {
line_chart: <LineChartOutlined />, line_chart: <LineChartOutlined />,
}; };
const CHART_COLORS = [
'#4F46E5', '#059669', '#D97706', '#E11D48', '#7C3AED',
'#2563EB', '#0891B2', '#C026D3', '#EA580C', '#65A30D',
];
interface WidgetData { interface WidgetData {
widget: DashboardWidget; widget: DashboardWidget;
data: AggregateItem[]; data: AggregateItem[];
@@ -751,7 +744,6 @@ export function PluginDashboardPage() {
setError(null); setError(null);
try { try {
const totalCount = entityStats.find((s) => s.name === selectedEntity)?.count ?? 0;
const fieldResults: FieldBreakdown[] = []; const fieldResults: FieldBreakdown[] = [];
for (const field of filterableFields) { for (const field of filterableFields) {
@@ -951,7 +943,6 @@ export function PluginDashboardPage() {
key={bd.fieldName} key={bd.fieldName}
breakdown={bd} breakdown={bd}
totalCount={currentTotal} totalCount={currentTotal}
palette={currentPalette}
index={i} index={i}
/> />
))} ))}

View File

@@ -33,7 +33,7 @@ import {
type PluginSchemaResponse, type PluginSchemaResponse,
} from '../api/plugins'; } from '../api/plugins';
const { Text, Title } = Typography; const { Text } = Typography;
// ── Types ── // ── Types ──
@@ -300,7 +300,6 @@ function drawEdgeLabel(
y: number, y: number,
label: string, label: string,
color: string, color: string,
textColor: string,
alpha: number, alpha: number,
) { ) {
ctx.save(); ctx.save();
@@ -617,7 +616,7 @@ export function PluginGraphPage() {
// Edge label // Edge label
if (edge.label && labelPos) { if (edge.label && labelPos) {
const labelAlpha = hoverState.nodeId ? (isHighlighted ? 1 : 0.1) : 0.9; 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) { if (hoverState.nodeId) {
const hoveredNode = nodes.find((n) => n.id === hoverState.nodeId); const hoveredNode = nodes.find((n) => n.id === hoverState.nodeId);
if (hoveredNode) { if (hoveredNode) {
const degree = degreeMap.get(hovered.nodeId) || 0; const degree = degreeMap.get(hoverState.nodeId) || 0;
const tooltipText = `${hoveredNode.label} (${degree} 条关系)`; const tooltipText = `${hoveredNode.label} (${degree} 条关系)`;
ctx.save(); ctx.save();
ctx.font = '12px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'; ctx.font = '12px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';

View File

@@ -3,14 +3,13 @@ import { useParams } from 'react-router-dom';
import { Card, Spin, Typography, Tag, message } from 'antd'; import { Card, Spin, Typography, Tag, message } from 'antd';
import { import {
DndContext, DndContext,
DragEndEvent,
DragOverlay, DragOverlay,
DragStartEvent,
PointerSensor, PointerSensor,
useSensor, useSensor,
useSensors, useSensors,
closestCorners, closestCorners,
} from '@dnd-kit/core'; } from '@dnd-kit/core';
import type { DragEndEvent, DragStartEvent } from '@dnd-kit/core';
import { listPluginData, patchPluginData } from '../api/pluginData'; import { listPluginData, patchPluginData } from '../api/pluginData';
import { getPluginSchema, type PluginPageSchema } from '../api/plugins'; import { getPluginSchema, type PluginPageSchema } from '../api/plugins';
@@ -255,7 +254,7 @@ export default function PluginKanbanPageRoute() {
const [pageConfig, setPageConfig] = useState<{ const [pageConfig, setPageConfig] = useState<{
entity: string; entity: string;
lane_field: string; lane_field: string;
lane_order: string[]; lane_order?: string[];
card_title_field: string; card_title_field: string;
card_subtitle_field?: string; card_subtitle_field?: string;
card_fields?: string[]; card_fields?: string[];