orbcafe-ui 1.0.7 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,6 +10,37 @@
10
10
 
11
11
  ---
12
12
 
13
+ ## 组件总目录(先看这里)
14
+
15
+ 下表用于快速判断“该用哪个组件、去哪个目录、看哪份细节文档”。
16
+
17
+ | 模块 | 典型用途 | 代码目录 | 先看文档 |
18
+ | --- | --- | --- | --- |
19
+ | `Atoms` | 基础输入/按钮/文本等原子能力,作为上层组件基础件 | `src/components/Atoms` | `src/components/Atoms/README.md` |
20
+ | `Molecules` | 组合型基础组件(如统一消息框) | `src/components/Molecules` | `src/components/Molecules/README.md` |
21
+ | `Navigation-Island` | 左侧导航树、折叠导航、菜单路由入口 | `src/components/Navigation-Island` | `src/components/Navigation-Island/README.md` |
22
+ | `StdReport` | 标准报表主容器(筛选、表格、分页、变体、布局) | `src/components/StdReport` | `src/components/StdReport/README.md` |
23
+ | `GraphReport` | 图形报表弹窗(KPI、图表、联动、AI 输入区) | `src/components/GraphReport` | `src/components/GraphReport/README.md` |
24
+ | `CustomizeAgent` | AI 参数与 Prompt 模板设置弹窗 | `src/components/CustomizeAgent` | `src/components/CustomizeAgent/README.md` |
25
+ | `DetailInfo` | 标准详情页容器(信息块 + Tabs + 底部表格 + AI/搜索) | `src/components/DetailInfo` | `src/components/DetailInfo/README.md` |
26
+ | `PageLayout` | 页面壳层(Header + Navigation + Content) | `src/components/PageLayout` | `src/components/PageLayout/README.md` |
27
+
28
+ ### 文档查阅顺序(推荐)
29
+
30
+ 1. 先看模块根 README:了解能力边界、最小接入示例。
31
+ 2. 再看模块 `Hooks/README.md`:确认状态管理、参数、返回值与联动方式。
32
+ 3. 最后看模块详细设计文档(如 `graphreport.md`):理解内部结构与扩展点。
33
+
34
+ ### 常用文档索引
35
+
36
+ - `GraphReport` 详细设计:`src/components/GraphReport/graphreport.md`
37
+ - `GraphReport Hooks`:`src/components/GraphReport/Hooks/README.md`
38
+ - `StdReport Hooks`:`src/components/StdReport/Hooks/README.md`
39
+ - `PageLayout Hooks`:`src/components/PageLayout/Hooks/README.md`
40
+ - `DetailInfo` 模块文档:`src/components/DetailInfo/README.md`
41
+
42
+ ---
43
+
13
44
  ## 重点组件:CMessageBox(请优先使用)
14
45
 
15
46
  `CMessageBox` 是标准体系里用于统一提示/确认交互的基础分子组件,适用于:
@@ -76,6 +107,101 @@ module.exports = {
76
107
  }
77
108
  ```
78
109
 
110
+ ### Next.js App Router 最小接入(推荐)
111
+
112
+ ```tsx
113
+ // app/page.tsx (Server Component)
114
+ import HomeClientPage from './HomeClientPage';
115
+
116
+ export default function Page() {
117
+ return <HomeClientPage />;
118
+ }
119
+ ```
120
+
121
+ ```tsx
122
+ // app/HomeClientPage.tsx (Client Component)
123
+ 'use client';
124
+
125
+ import { CAppPageLayout } from 'orbcafe-ui';
126
+
127
+ export default function HomeClientPage() {
128
+ return <CAppPageLayout appTitle="ORBCAFE" menuData={[]} />;
129
+ }
130
+ ```
131
+
132
+ ---
133
+
134
+ ## Next.js 16 兼容性说明(务必阅读)
135
+
136
+ 官方 example 已按 Next.js `16.1.6` 调整,接入时请遵循以下规则:
137
+
138
+ ### 1. 动态路由参数必须在 Server Page 解包
139
+
140
+ 在 Next 16 中,`params` / `searchParams` 是 Promise 语义。
141
+ 不要在 Client Page 里直接把它当普通对象枚举或访问属性。
142
+
143
+ 推荐写法:
144
+
145
+ ```tsx
146
+ // app/detail/[id]/page.tsx (Server Component)
147
+ import DetailClientPage from './DetailClientPage';
148
+
149
+ interface PageProps {
150
+ params: Promise<{ id: string }>;
151
+ }
152
+
153
+ export default async function Page({ params }: PageProps) {
154
+ const { id } = await params;
155
+ return <DetailClientPage rowId={id} />;
156
+ }
157
+ ```
158
+
159
+ ### 2. Client Component 避免首屏依赖不稳定值
160
+
161
+ Hydration mismatch 常见来源:
162
+
163
+ - 首屏直接使用 `usePathname()` 结果做高亮
164
+ - `Date.now()` / `Math.random()` 直接参与首屏渲染
165
+ - 仅在浏览器可用的数据(`window` / `localStorage`)首屏参与结构分支
166
+
167
+ 建议:
168
+
169
+ - 用 `mounted`(`useEffect` 后置为 `true`)再启用这类 UI 高亮/分支
170
+ - 浏览器侧状态在 `useEffect` 中读取
171
+ - 保持 SSR 首屏与 CSR 首帧 DOM 结构一致
172
+
173
+ ### 3. 常见报错对照
174
+
175
+ - `searchParams is a Promise and must be unwrapped with React.use()`
176
+ 根因:在错误层级直接同步访问了 `searchParams`。
177
+ - `params are being enumerated`
178
+ 根因:对 `params` 做了 `Object.keys/entries` 或扩展操作。
179
+ - `Hydration failed because the server rendered HTML didn't match the client`
180
+ 根因:SSR 与 CSR 首屏输出不一致(通常由路由状态或浏览器变量引起)。
181
+
182
+ ---
183
+
184
+ ## 官方 Example 验证命令
185
+
186
+ 提交前建议至少执行:
187
+
188
+ ```bash
189
+ # 1) 构建组件库
190
+ npm run build
191
+
192
+ # 2) 校验 examples
193
+ cd examples
194
+ npm run lint
195
+ npx tsc --noEmit
196
+ ```
197
+
198
+ 如果只想快速看运行效果:
199
+
200
+ ```bash
201
+ cd examples
202
+ npm run dev
203
+ ```
204
+
79
205
  ---
80
206
 
81
207
  ## Internationalization (i18n)