@yuku123/z-frontend-common 0.2.9 → 1.1.0

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.
Files changed (75) hide show
  1. package/LICENSE +25 -0
  2. package/README.md +55 -42
  3. package/dist/PagedTable-DyjNokXN.js +1211 -0
  4. package/dist/index.js +310 -0
  5. package/dist/ui.js +27 -0
  6. package/package.json +52 -44
  7. package/src/components/ErrorBoundary/index.jsx +24 -77
  8. package/src/components/Layout/index.jsx +141 -38
  9. package/src/components/LoginPage/index.jsx +47 -21
  10. package/src/components/StatusTag/index.jsx +14 -12
  11. package/src/components/ui/CategoryDot.jsx +38 -0
  12. package/src/components/ui/DarkBanner.jsx +142 -0
  13. package/src/components/ui/EChartsChart.jsx +82 -0
  14. package/src/components/ui/EmptyState.jsx +94 -0
  15. package/src/components/ui/ErrorState.jsx +114 -0
  16. package/src/components/ui/FeatureCard.jsx +205 -0
  17. package/src/components/ui/GradientStatCard.jsx +196 -0
  18. package/src/components/ui/LoadingState.jsx +116 -0
  19. package/src/components/ui/PageHeader.jsx +143 -0
  20. package/src/components/ui/PagedTable.jsx +83 -0
  21. package/src/components/ui/SearchInput.jsx +111 -0
  22. package/src/components/ui/SectionHeader.jsx +76 -0
  23. package/src/components/ui/StatusBadge.jsx +66 -0
  24. package/src/components/ui/TableToolbar.jsx +58 -0
  25. package/src/components/ui/index.js +36 -0
  26. package/src/components/ui/tokens.js +224 -0
  27. package/src/index.js +33 -37
  28. package/src/services/request.js +74 -4
  29. package/dist/z-frontend-common.css +0 -1
  30. package/dist/z-frontend-common.es.js +0 -51275
  31. package/dist/z-frontend-common.umd.js +0 -459
  32. package/src/components/Ctc/Layout.jsx +0 -330
  33. package/src/components/Ctc/Layout.module.css +0 -145
  34. package/src/components/Ctc/agentTeam/index.tsx +0 -308
  35. package/src/components/Ctc/login/AuthPage.module.css +0 -26
  36. package/src/components/Ctc/login/AuthPage.tsx +0 -235
  37. package/src/components/Ctc/login/index.less +0 -49
  38. package/src/components/Ctc/login/index.tsx +0 -142
  39. package/src/components/Ctc/uc/UCLogin.tsx +0 -31
  40. package/src/components/Ctc/uc/UCPhoneLogin.tsx +0 -62
  41. package/src/components/Ctc/uc/UCRegister.tsx +0 -37
  42. package/src/components/Ctc/uc/UCResetPassword.tsx +0 -69
  43. package/src/components/Ctc/uc/index.tsx +0 -15
  44. package/src/components/Ctc/userPanel/index.tsx +0 -999
  45. package/src/components/Ctc/webide/index.tsx +0 -272
  46. package/src/components/LowCode/LowCodeModel.jsx +0 -962
  47. package/src/components/LowCode/LowCodePage.jsx +0 -31
  48. package/src/components/LowCode/LowCodeRuntime.jsx +0 -335
  49. package/src/components/LowCode/MaterializePage.jsx +0 -235
  50. package/src/components/LowCode/index.js +0 -1
  51. package/src/components/MockPlatform/CurlImportModal.jsx +0 -362
  52. package/src/components/MockPlatform/EndpointsTab.jsx +0 -509
  53. package/src/components/MockPlatform/EnvironmentsTab.jsx +0 -212
  54. package/src/components/MockPlatform/MockTemplateHelper.jsx +0 -200
  55. package/src/components/MockPlatform/OpenApiImportModal.jsx +0 -305
  56. package/src/components/MockPlatform/RecordingsTab.jsx +0 -397
  57. package/src/components/MockPlatform/RequestLogsTab.jsx +0 -239
  58. package/src/components/MockPlatform/ScenariosTab.jsx +0 -236
  59. package/src/components/MockPlatform/TestCasesTab.jsx +0 -462
  60. package/src/components/MockPlatform/index.jsx +0 -127
  61. package/src/components/Overview.jsx +0 -74
  62. package/src/dev.jsx +0 -28
  63. package/src/services/agentTeam.js +0 -7
  64. package/src/services/api.js +0 -84
  65. package/src/services/ctcAc.js +0 -7
  66. package/src/services/ctcAcDomain.js +0 -7
  67. package/src/services/ctcAuthorization.js +0 -7
  68. package/src/services/ctcSurl.js +0 -7
  69. package/src/services/ctcUser.js +0 -7
  70. package/src/services/job.js +0 -7
  71. package/src/services/metaApp.js +0 -7
  72. package/src/services/privateConfig.js +0 -7
  73. package/src/services/webide.js +0 -6
  74. package/src/services/workspace.js +0 -21
  75. package/src/utils/request.ts +0 -102
package/LICENSE ADDED
@@ -0,0 +1,25 @@
1
+ MIT License
2
+
3
+ <<<<<<< HEAD
4
+ Copyright (c) 2026 z-opc-foundation‌
5
+ =======
6
+ Copyright (c) 2026 z-opc-foundation
7
+ >>>>>>> 037d896 (feat: z-frontend-common 独立仓首版 1.0.0(lead 008 §1-§16 唯一承载仓))
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
package/README.md CHANGED
@@ -1,59 +1,72 @@
1
- # @yuku123/z-frontend-common
1
+ # z-frontend-common
2
2
 
3
- > z-opc 共享前端组件库 · React 19 + Ant Design 6
3
+ > z-opc-foundation 全仓共享前端基座 —— lead 008《前端开发规范》§1-§16 的唯一承载仓。
4
4
 
5
- ## 安装
5
+ 40+ 个 `z-*` 产品仓的 suit 通过同一份 AppLayout / LoginPage 获得一致的
6
+ 左菜单架子、登录流程与右上角用户组件;21 个 `<repo>-component` 的 services
7
+ 层消费同一份 axios 拦截器工厂。**改一处,全仓同步**。
6
8
 
7
- ```bash
8
- npm install @yuku123/z-frontend-common
9
- # 国内用户加速
10
- # .npmrc: @yuku1231:registry=https://registry.npmmirror.com/
11
- ```
12
-
13
- ## 导出能力
9
+ ---
14
10
 
15
- ### 组件
16
- - `AppLayout` — 统一布局(Sider + Header + Content)
17
- - `StatusTag` — 状态标签
18
- - `LoginPage` — 统一登录页
19
- - `ErrorBoundary` — React 错误边界
11
+ ## 基本信息
20
12
 
21
- ### 请求工具
22
- - `request` — 默认实例(`baseURL=/api`,识别 `{code, data, message}` 后端响应)
23
- - `authRequest` — 同上(语义区分)
24
- - `createRequest({baseURL, tokenKey, userInfoKey, unauthorizedRedirect, timeout})` — 工厂
25
- - `setupInterceptors(instance, options)` — 自定义拦截器
13
+ | 字段 | 值 |
14
+ |------|-----|
15
+ | 仓 | `z-opc-foundation/z-frontend-common`(本仓) |
16
+ | npm 包 | `@yuku123/z-frontend-common`(scope 沿用 yuku123,与 0.1.x/0.2.x 旧线连续) |
17
+ | 当前版本 | `1.0.0` —— 1.0 语义:§1-§16 规范化起点。0.1.x 是 pre-§16 形态;0.2.x 内嵌 react-dom 已废弃 |
18
+ | 技术栈 | React 19 + antd 6 + react-router-dom 7 + Vite 6(lead 005 §3.0 版本线单一尺子) |
19
+ | 产物 | ESM 单文件 `dist/index.js`;react / antd / @ant-design/icons / react-router-dom 全部 external |
20
+ | axios | `dependencies` 内联(`_shared/` vendoring 时期的决策保留:避免消费方从无 node_modules 的目录解析 axios) |
26
21
 
27
- ## 使用示例
28
-
29
- ```jsx
30
- import { AppLayout, LoginPage, request } from '@yuku123/z-frontend-common'
22
+ ## 对外 API(与 0.1.1 完全兼容 + 三处升级)
31
23
 
32
- // 业务模块推荐:在 src/utils/request.js 写 2-10 行适配层
33
- import { createRequest } from '@yuku123/z-frontend-common'
34
- const request = createRequest({ baseURL: '/meta', tokenKey: 'token' })
35
- export default request
36
- ```
24
+ | 导出 | 说明 |
25
+ |------|------|
26
+ | `AppLayout` | **升级**:§1 sider 双模式品牌区(暗主题显式白字 / 折叠 36×36 圆角图标 + Tooltip)、§11 selectedKey 最长菜单前缀、§12 sider 顶 `产品名@版本`、§15 Header 48px + 1px 下边线、§16 `appUser` 右上角下拉(profile + 退出登录,`loginPath` 按 `menuItems[0].key` 自动推导可覆盖) |
27
+ | `LoginPage` | **升级**:`mockAuth` 双模式 —— 传 `{username, password, user}` 走纯前端校验(CTC/SSO 接入前短期形态);缺省走 `loginApi` 真实端点 |
28
+ | `EmptyState`(占位) | 目录已建,组件下一波随 §2 列表页规范收口时进 |
29
+ | `StatusTag` / `defaultStatusMap` | 0.1.1 契约原样保留 |
30
+ | `ErrorBoundary` | 0.1.1 契约原样保留(antd Result 形态重绘) |
31
+ | `createRequest(options)` | axios 实例工厂:`{baseURL='/api', timeout=10000, tokenKey, userInfoKey, unauthorizedRedirect}`;21 个 component 仓 services 层消费 |
32
+ | `request` / `authRequest` | 预建实例(`createRequest()` 双份,0.1.1 契约) |
33
+ | `setupInterceptors` | 拦截器装配(Bearer token 注入 + 401 清凭跳登录 + 响应解包) |
34
+ | `unwrapResponse` | **新增显式导出**:`{code, data}` 包装解包 / 裸数据透传(z-opc Spring MVC 统一返回体兼容) |
35
+ | `default`(桶) | `{AppLayout, StatusTag, defaultStatusMap, LoginPage, ErrorBoundary, request, authRequest, createRequest}` —— 0.1.1 形状原样 |
37
36
 
38
- ## 统一后端响应格式
37
+ ## AppLayout props
39
38
 
40
- ```json
41
- { "code": 200, "data": T, "message": "ok" }
39
+ ```jsx
40
+ <AppLayout
41
+ menuItems={menuConfig} // antd Menu items,每项必须带 icon(§10)
42
+ appTitle="z-vector" // sider 展开态文字
43
+ appShort="ZV" // 无 appIcon 时折叠态缩写
44
+ appVersion="1.0.5" // §12:展开态渲染 z-vector@1.0.5(不要 "v" 前缀)
45
+ appIcon={{icon, color, label}} // §1:折叠态 36×36 圆角色板 + Tooltip
46
+ appUser={{name, role}} // §16:右上角 Avatar+name+DownOutlined 下拉
47
+ loginPath="/z-vector/login" // 可选,缺省按 menuItems[0].key 自动推导 /<产品>/login
48
+ headerExtra={<.../>} // Header 右侧追加内容(版本号别放这,§12)
49
+ loading={false} // 菜单区 loading 占位
50
+ />
42
51
  ```
43
52
 
44
- - `code=200` → 自动返回 `data`
45
- - 其他 code → reject
46
- - 响应无 `code` 字段 → pass-through 透传
53
+ ## suit 接入模板(lead 008 §16)
47
54
 
48
- ## 长期方案
55
+ ```jsx
56
+ import { AppLayout, LoginPage, ErrorBoundary } from '@yuku123/z-frontend-common'
57
+ import { menuConfig, routes, appMeta } from '@yuku123/<repo>-component/pages'
49
58
 
50
- - 模板从 z-meta 拉取(数据库驱动)
51
- - 业务侧 `res.data.xxx` 写法统一
59
+ const MOCK_AUTH = { username: 'admin', password: '123456', user: { name: 'admin', role: '管理员' } }
52
60
 
53
- ## 仓库
61
+ // <Route path="/<repo>/login" element={<LoginPage title="<repo> 管理台" mockAuth={MOCK_AUTH} redirectUrl="/<repo>/home" />} />
62
+ // <Route element={<ProtectedShell/>}> 内挂 <AppLayout menuItems={menuConfig} appTitle={appMeta.title} appVersion="…" appUser={user} />
63
+ ```
54
64
 
55
- https://github.com/yuku123/z-opc/tree/main/z-frontend-common
65
+ 完整模板见 lead 008 §16;出厂自检清单见 §9。
56
66
 
57
- ## License
67
+ ## 历史
58
68
 
59
- MIT
69
+ - `0.1.0 – 0.1.6`:早期形态(pre-§16),源码曾位于 `yuku123/z-opc` 仓的 `z-frontend-common/` 子目录
70
+ - `0.2.x`:内嵌 react-dom 的失败尝试线,已废弃
71
+ - 应急过渡:`z-opc-foundation/_shared/z-frontend-common-local/` vendoring(不入 git,1.0.0 发版后退役)
72
+ - `1.0.0`:独立仓首版 —— 源码自 vendoring 迁入,API 契约兼容 0.1.1,AppLayout/LoginPage 升级 §1-§16 规范版