1
0

refactor: 迁移 UI 组件库从 Ant Design 至 TDesign

- 替换 antd 为 tdesign-react 作为主要 UI 组件库
- 引入 Recharts 替代 @ant-design/charts 实现图表功能
- 移除主题系统相关代码(ThemeContext、themes 目录)
- 更新所有组件以适配 TDesign 组件 API
- 更新测试用例以匹配新的组件实现
- 新增 TDesign 和 Recharts 集成规范文档
This commit is contained in:
2026-04-17 18:22:13 +08:00
parent 6eeb38c15e
commit 2b1c5e96c3
55 changed files with 1622 additions and 2541 deletions

View File

@@ -5,7 +5,7 @@ if (typeof window === 'undefined' || typeof document === 'undefined') {
throw new Error('jsdom environment not initialized. Check vitest config.');
}
// Polyfill window.matchMedia for jsdom (required by antd)
// Polyfill window.matchMedia for jsdom (required by TDesign)
Object.defineProperty(window, 'matchMedia', {
writable: true,
value: (query: string) => ({
@@ -30,10 +30,26 @@ window.getComputedStyle = (elt: Element, pseudoElt?: string | null) => {
}
};
// Polyfill ResizeObserver for antd
// Polyfill ResizeObserver for TDesign
global.ResizeObserver = class ResizeObserver {
observe() {}
unobserve() {}
disconnect() {}
};
// Suppress TDesign Form internal act() warnings
// These warnings come from TDesign's FormItem component internal async state updates
// They don't affect test reliability - all tests pass successfully
const originalError = console.error;
console.error = (...args: unknown[]) => {
const message = args[0];
// Filter out TDesign FormItem act() warnings
if (
typeof message === 'string' &&
message.includes('An update to FormItem inside a test was not wrapped in act(...)')
) {
return;
}
originalError(...args);
};