refactor(grid): 提取 cellValue 格式化到共享模块并增加测试 (#218)

将 CellValue 类型和 displayCellValue(原 formatCell)提取到
src/lib/cellValue.ts,DataGrid.vue 和 useDataGridExport.ts 统一引用,
移除 composable 中冗余的 formatCell 参数传递。
This commit is contained in:
Abeautifulsnow
2026-05-11 18:56:08 +08:00
committed by GitHub
parent e4c1d6639b
commit dddb813fc6
4 changed files with 74 additions and 13 deletions
+8
View File
@@ -0,0 +1,8 @@
export type CellValue = string | number | boolean | null;
export function displayCellValue(value: CellValue): string {
if (value === null) return "NULL";
if (typeof value === "boolean") return value ? "true" : "false";
if (typeof value === "object") return JSON.stringify(value);
return String(value);
}