feat(theme): support configuring the default table theme - #5309
Merged
Conversation
Contributor
Author
|
@fangsmile 您好,看到您维护过主题入口,也在近期处理了 #5301 等核心 API 改动,想请您帮忙审查这个默认主题配置 PR。 这里新增 目前 Unit test CI 和 Bug Server CI 显示 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤔 This is a ...
🔗 Related issue link
No existing issue. This PR proposes a public default-theme configuration API for applications and component libraries.
💡 Background and solution
Applications currently have to pass a theme to every table. Registering a theme named DEFAULT only affects name lookup, while construction and update fallbacks still use a separate default reference. Mutating the existing default object also risks stale resolved-style caches.
Add
VTable.themes.setDefaultTheme(theme: ITableThemeDefine): void. It installs a new TableTheme and synchronizes the named DEFAULT export, the internal fallback and the built-in name lookup. A supplied TableTheme is copied through its existing extends() API to preserve inherited styles without sharing resolved caches.The supplied theme replaces the previous default; explicit extends() is used for merging. Existing instances and previously extended themes retain their theme objects. Future updateOption() calls without a theme use the configured default. Explicit themes, other built-in themes, registered-name precedence, updateTheme(), and property assignment keep their existing semantics. Standalone partial themes do not inherit the configured default. The setting is shared by callers using the same VTable runtime and is intended for initialization.
Validation (Node.js 22.23.2, macOS):
tsc --emitDeclarationOnly).rushx compilein packages/vtable: passed.rushx test --runInBand --runTestsByPath __tests__/default-theme.test.ts __tests__/default-theme-table.test.ts __tests__/functional-icons-theme.test.ts: 3 suites / 11 tests passed. Jest printed an open-handles warning, then exited successfully.git diff --cached --check: passed.rush change --verify --target-branch origin/develop --no-fetch: passed.rush build --to @visactor/vtableblocked before the core build: the existing bundler requires an unavailable vue peer through @vitejs/plugin-vue after selective install. No unrelated dependency changes are included. Full bundle validation remains for CI / a complete development environment.📝 Changelog
The existing default and all current behavior remain unchanged unless the new API is called. Calls affect the shared runtime's default for subsequent operations; existing instances are not automatically updated.
☑️ Self-Check before Merge
🚀 Summary
copilot:summary
🔍 Walkthrough
copilot:walkthrough