/**
* @file report-renderer.ts — HTML 报告模板渲染器
* @description 将结构化 ReportData 渲染为完整 HTML 报表(ECharts + 指标卡 + 表格 + 标签)
* 移植自 html-renderer.cjs,新增 radar / gauge 图表类型和 kv-list block 类型
*/
export interface ReportMetricItem {
icon?: string;
label: string;
value: string | number;
sub?: string;
}
export interface ReportChartData {
type: 'bar' | 'bar-horizontal' | 'line' | 'pie' | 'doughnut' | 'radar' | 'gauge';
data: Array<{
name: string;
value: number;
}>;
/** chart title (markdown-parser 将其提升为 block.title 渲染为图表标题) */
title?: string;
/** bar chart Y axis name */
yName?: string;
/** bar chart label rotation */
rotate?: number;
/** line chart multi-series */
datasets?: Array<{
name: string;
data: number[];
}>;
/** radar chart indicators */
indicators?: Array<{
name: string;
max: number;
}>;
/** gauge chart max value */
max?: number;
/** chart height override */
height?: number;
}
export interface ReportTableData {
headers: string[];
rows: (string | number)[][];
ranked?: boolean;
}
export interface ReportTagGroup {
label?: string;
items: string[];
style?: 'accent' | 'accent2' | 'purple' | 'warning' | 'success' | 'info' | '';
}
export interface ReportKvItem {
label: string;
value: string | number;
highlight?: boolean;
}
export interface ReportBlock {
type: 'chart' | 'table' | 'tags' | 'text' | 'alerts' | 'kv-list';
id?: string;
title?: string;
chart?: ReportChartData;
table?: ReportTableData;
groups?: ReportTagGroup[];
content?: string;
items?: string[];
kvItems?: ReportKvItem[];
}
export interface ReportSection {
title?: string;
layout?: 'grid-2' | 'full';
blocks: ReportBlock[];
}
export interface ReportAction {
label: string;
prompt?: string;
primary?: boolean;
}
export interface ReportData {
title: string;
subtitle?: string;
theme?: 'dark' | 'light';
date?: string;
lang?: string;
metrics?: ReportMetricItem[];
sections?: ReportSection[];
actions?: ReportAction[];
footer?: string;
}
/**
* 将 ReportData 渲染为完整 HTML 字符串
*/
export declare function renderReport(data: ReportData, templatesDir?: string): Promise;
//# sourceMappingURL=report-renderer.d.ts.map