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,
entity,
labelField,
searchFields,
searchFields: _searchFields,
value,
onChange,
cascadeFrom,

View File

@@ -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<string, React.ReactNode> = {
line_chart: <LineChartOutlined />,
};
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}
/>
))}

View File

@@ -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';

View File

@@ -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[];