-
Notifications
You must be signed in to change notification settings - Fork 5
Add ObjectStack protocol component evaluation and 2026 roadmap with dual component system architecture #160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 10 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
116434a
Initial plan
Copilot a300fe6
Add comprehensive ObjectStack component evaluation documentation
Copilot d2e055d
Add English summary and documentation index
Copilot a9dfaae
Update docs README with component evaluation links
Copilot a8e59a8
Clarify CRUD is ObjectUI extension, not ObjectStack protocol
Copilot 8be7248
Add component naming conventions documentation
Copilot 7ce8547
Standardize Object protocol component naming with object- prefix
Copilot 3d19b17
Restructure evaluation to clarify dual component system architecture
Copilot fd039bc
Translate 4 Chinese documentation files to English
Copilot cd6462d
Remove all CRUD references from documentation per ObjectStack protocol
Copilot 151588e
docs: fix language inconsistencies - translate COMPONENT_MAPPING_GUID…
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,272 @@ | ||
| # ObjectUI vs Shadcn: 组件对照表 | ||
|
|
||
| **快速参考**: 了解ObjectUI渲染器与Shadcn UI组件的关系 | ||
|
|
||
| --- | ||
|
|
||
| ## 概念区分 | ||
|
|
||
| ### Shadcn UI组件 | ||
| - 📦 **纯UI组件库** | ||
| - 🎨 基于Radix UI + Tailwind CSS | ||
| - 💻 需要编写React代码 | ||
| - 🔧 通过Props控制 | ||
|
|
||
| ### ObjectUI渲染器 | ||
| - 🔄 **Schema解释器** | ||
| - 📋 基于JSON配置驱动 | ||
| - 🚀 零代码即可使用 | ||
| - 🔗 自动数据绑定和验证 | ||
|
|
||
| --- | ||
|
|
||
| ## 一对一映射关系 | ||
|
|
||
| | Shadcn UI | ObjectUI渲染器 | 增强功能 | | ||
| |-----------|---------------|---------| | ||
| | `<Input />` | `{ type: "input" }` | ✅ 表达式, ✅ 验证, ✅ 数据绑定 | | ||
| | `<Button />` | `{ type: "button" }` | ✅ 动作映射, ✅ 加载状态 | | ||
| | `<Select />` | `{ type: "select" }` | ✅ 动态选项, ✅ 远程搜索 | | ||
| | `<Dialog />` | `{ type: "dialog" }` | ✅ 条件显示, ✅ 表单集成 | | ||
| | `<Table />` | `{ type: "table" }` | ✅ 基础表格渲染 | | ||
| | `<Card />` | `{ type: "card" }` | ✅ 动态内容, ✅ 操作按钮 | | ||
| | `<Form />` | `{ type: "form" }` | ✅ 验证引擎, ✅ 提交处理 | | ||
| | `<Tabs />` | `{ type: "tabs" }` | ✅ 动态标签, ✅ 懒加载 | | ||
| | `<Badge />` | `{ type: "badge" }` | ✅ 状态映射, ✅ 颜色规则 | | ||
| | `<Alert />` | `{ type: "alert" }` | ✅ 条件显示, ✅ 自动关闭 | | ||
|
|
||
| --- | ||
|
|
||
| ## ObjectUI独有组件 | ||
|
|
||
| 这些组件没有直接对应的Shadcn组件,是ObjectUI的高级业务组件: | ||
|
|
||
| | 组件 | 类型 | 用途 | | ||
| |------|------|------| | ||
| | **data-table** | 复杂组件 | 带排序/过滤/分页的高级表格 | | ||
| | **timeline** | 复杂组件 | 时间线/甘特图 | | ||
| | **filter-builder** | 复杂组件 | 可视化查询构建器 | | ||
| | **chatbot** | 复杂组件 | 对话机器人界面 | | ||
| | **tree-view** | 数据展示 | 树形结构 | | ||
| | **statistic** | 数据展示 | 统计数值卡片 | | ||
|
|
||
| --- | ||
|
|
||
| ## 使用场景对比 | ||
|
|
||
| ### 场景1: 简单表单 | ||
|
|
||
| #### Shadcn方式 (React代码) | ||
| ```tsx | ||
| import { Input } from '@/ui/input'; | ||
| import { Button } from '@/ui/button'; | ||
|
|
||
| function LoginForm() { | ||
| const [email, setEmail] = useState(''); | ||
| const [password, setPassword] = useState(''); | ||
|
|
||
| const handleSubmit = async (e) => { | ||
| e.preventDefault(); | ||
| await fetch('/api/login', { | ||
| method: 'POST', | ||
| body: JSON.stringify({ email, password }) | ||
| }); | ||
| }; | ||
|
|
||
| return ( | ||
| <form onSubmit={handleSubmit}> | ||
| <Input | ||
| value={email} | ||
| onChange={e => setEmail(e.target.value)} | ||
| placeholder="Email" | ||
| /> | ||
| <Input | ||
| type="password" | ||
| value={password} | ||
| onChange={e => setPassword(e.target.value)} | ||
| placeholder="Password" | ||
| /> | ||
| <Button type="submit">Login</Button> | ||
| </form> | ||
| ); | ||
| } | ||
| ``` | ||
|
|
||
| #### ObjectUI方式 (JSON Schema) | ||
| ```json | ||
| { | ||
| "type": "form", | ||
| "api": "/api/login", | ||
| "fields": [ | ||
| { | ||
| "name": "email", | ||
| "type": "input", | ||
| "inputType": "email", | ||
| "placeholder": "Email", | ||
| "required": true | ||
| }, | ||
| { | ||
| "name": "password", | ||
| "type": "input", | ||
| "inputType": "password", | ||
| "placeholder": "Password", | ||
| "required": true | ||
| } | ||
| ], | ||
| "actions": [ | ||
| { | ||
| "type": "button", | ||
| "label": "Login", | ||
| "actionType": "submit" | ||
| } | ||
| ] | ||
| } | ||
| ``` | ||
|
|
||
| ### 场景2: 数据表格 | ||
|
|
||
| #### Shadcn方式 | ||
| ```tsx | ||
| import { Table } from '@/ui/table'; | ||
|
|
||
| function UserTable() { | ||
| const [users, setUsers] = useState([]); | ||
| const [page, setPage] = useState(1); | ||
| const [sort, setSort] = useState('name'); | ||
|
|
||
| useEffect(() => { | ||
| fetchUsers(page, sort).then(setUsers); | ||
| }, [page, sort]); | ||
|
|
||
| return ( | ||
| <div> | ||
| <Table> | ||
| <TableHeader> | ||
| <TableRow> | ||
| <TableHead onClick={() => setSort('name')}>Name</TableHead> | ||
| <TableHead onClick={() => setSort('email')}>Email</TableHead> | ||
| </TableRow> | ||
| </TableHeader> | ||
| <TableBody> | ||
| {users.map(user => ( | ||
| <TableRow key={user.id}> | ||
| <TableCell>{user.name}</TableCell> | ||
| <TableCell>{user.email}</TableCell> | ||
| </TableRow> | ||
| ))} | ||
| </TableBody> | ||
| </Table> | ||
| <Pagination page={page} onChange={setPage} /> | ||
| </div> | ||
| ); | ||
| } | ||
| ``` | ||
|
|
||
| #### ObjectUI方式 | ||
| ```json | ||
| { | ||
| "type": "data-table", | ||
| "api": "/api/users", | ||
| "columns": [ | ||
| { | ||
| "name": "name", | ||
| "label": "Name", | ||
| "sortable": true | ||
| }, | ||
| { | ||
| "name": "email", | ||
| "label": "Email", | ||
| "sortable": true | ||
| } | ||
| ], | ||
| "pagination": { | ||
| "pageSize": 20 | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## 选择指南 | ||
|
|
||
| ### 使用Shadcn UI(直接使用原生组件) | ||
| ✅ 需要高度定制化的交互逻辑 | ||
| ✅ 组件行为复杂,难以用Schema表达 | ||
| ✅ 性能极致优化(避免Schema解析开销) | ||
| ✅ 已有大量React组件代码 | ||
|
|
||
| ### 使用ObjectUI渲染器(推荐) | ||
| ✅ 快速构建数据管理界面 | ||
| ✅ 配置驱动,易于维护 | ||
| ✅ 需要动态UI(从服务端获取配置) | ||
| ✅ 低代码/无代码平台 | ||
| ✅ 需要AI生成UI | ||
|
|
||
| --- | ||
|
|
||
| ## 混合使用 | ||
|
|
||
| ObjectUI支持在Schema中嵌入自定义React组件: | ||
|
|
||
| ```json | ||
| { | ||
| "type": "page", | ||
| "body": [ | ||
| { | ||
| "type": "card", | ||
| "title": "用户统计", | ||
| "body": { | ||
| "type": "custom", | ||
| "component": "CustomChart", | ||
| "props": { | ||
| "data": "${chartData}" | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "type": "data-table", | ||
| "api": "/api/users" | ||
| } | ||
| ] | ||
| } | ||
| ``` | ||
|
|
||
| ```tsx | ||
| // 注册自定义组件 | ||
| import { registerRenderer } from '@object-ui/react'; | ||
| import CustomChart from './CustomChart'; | ||
|
|
||
| registerRenderer('custom', ({ schema }) => { | ||
| const Component = schema.component; // "CustomChart" | ||
| return <CustomChart {...schema.props} />; | ||
| }); | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## 常见问题 | ||
|
|
||
| ### Q: ObjectUI渲染器性能如何? | ||
| A: 相比直接使用Shadcn有轻微开销(<10%),但通过虚拟化和缓存优化,在实际应用中差异不明显。 | ||
|
|
||
| ### Q: 可以覆盖ObjectUI渲染器的样式吗? | ||
| A: 可以!通过`className`属性传入Tailwind类名即可覆盖。 | ||
|
|
||
| ### Q: 如何扩展ObjectUI不支持的组件? | ||
| A: 使用`registerRenderer`注册自定义渲染器,或使用`type: "custom"`嵌入React组件。 | ||
|
|
||
| ### Q: ObjectUI渲染器支持TypeScript吗? | ||
| A: 完全支持!所有Schema都有完整的TypeScript类型定义。 | ||
|
|
||
| --- | ||
|
|
||
| ## 更多资源 | ||
|
|
||
| - 📚 [组件API文档](./components/) | ||
| - 🎨 [Storybook示例](https://storybook.objectui.org) | ||
| - 🔧 [自定义渲染器指南](./guide/custom-renderers.md) | ||
| - 💡 [最佳实践](./community/best-practices.md) | ||
|
|
||
| --- | ||
|
|
||
| *最后更新: 2026-01-23* | ||
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The document title is in Chinese (组件对照表 means "Component Mapping Table"), which contradicts the PR's emphasis on "All documentation provided in English for international accessibility." The entire COMPONENT_MAPPING_GUIDE.md appears to be in Chinese despite being listed as an English documentation deliverable.