@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
@@ -1,330 +0,0 @@
1
- import React, {useEffect, useRef, useState} from 'react'
2
- import {useLocation, useNavigate} from 'react-router-dom'
3
- import {Avatar, Cascader, Divider, Dropdown, Layout as AntLayout, Menu, Space, Typography,} from 'antd'
4
- import {
5
- AppstoreOutlined,
6
- AuditOutlined,
7
- CloudOutlined,
8
- ClusterOutlined,
9
- CodeOutlined,
10
- DownOutlined,
11
- LinkOutlined,
12
- LogoutOutlined,
13
- MenuFoldOutlined,
14
- MenuUnfoldOutlined,
15
- RobotOutlined,
16
- SafetyCertificateOutlined,
17
- SafetyOutlined,
18
- SettingOutlined,
19
- TeamOutlined,
20
- UserOutlined,
21
- } from '@ant-design/icons'
22
- import styles from './Layout.module.css'
23
- import {getCurrentUser} from '../../services/api'
24
-
25
- const {Header, Sider, Content} = AntLayout
26
- const {Text} = Typography
27
-
28
- const Layout = ({compact = false, children} = {}) => {
29
- const location = useLocation()
30
- const navigate = useNavigate()
31
- const [collapsed, setCollapsed] = useState(false)
32
- const [userName, setUserName] = useState('管理员')
33
- const [userInfo, setUserInfo] = useState(null)
34
- const [tenantOptions, setTenantOptions] = useState([])
35
- const [selectedTenant, setSelectedTenant] = useState([])
36
-
37
- const navigateRef = useRef(navigate)
38
- navigateRef.current = navigate
39
-
40
- useEffect(() => {
41
- const token = localStorage.getItem('token')
42
- if (!token) {
43
- navigateRef.current('/login')
44
- return
45
- }
46
-
47
- const userInfoStr = localStorage.getItem('userInfo')
48
- if (userInfoStr) {
49
- try {
50
- const user = JSON.parse(userInfoStr)
51
- setUserName(user.userName || '管理员')
52
- setUserInfo(user)
53
- if (user.tenantCode) {
54
- setSelectedTenant([user.tenantCode])
55
- }
56
- } catch (e) {
57
- }
58
- }
59
- getCurrentUser().then(res => {
60
- if (res) {
61
- setUserInfo(res)
62
- setUserName(res.userName || '管理员')
63
- localStorage.setItem('userInfo', JSON.stringify(res))
64
- }
65
- }).catch(() => {
66
- })
67
- setTenantOptions([
68
- {
69
- value: 'tenant1',
70
- label: '租户1',
71
- children: [
72
- {value: 'domain1-1', label: '域1-1'},
73
- {value: 'domain1-2', label: '域1-2'},
74
- ],
75
- },
76
- {
77
- value: 'tenant2',
78
- label: '租户2',
79
- children: [
80
- {value: 'domain2-1', label: '域2-1'},
81
- {value: 'domain2-2', label: '域2-2'},
82
- ],
83
- },
84
- ])
85
- }, [])
86
-
87
- // 获取当前选中的菜单项
88
- const getSelectedKeys = () => {
89
- const path = location.pathname
90
- if (path.includes('/user')) return ['user']
91
- if (path.includes('/role')) return ['role']
92
- if (path.includes('/permission')) return ['permission']
93
- if (path.includes('/app')) return ['app']
94
- if (path.includes('/dict')) return ['dict']
95
- if (path.includes('/audit')) return ['audit']
96
- if (path.includes('/tenant')) return ['tenant']
97
- if (path.includes('/domain')) return ['domain']
98
- if (path.includes('/org')) return ['org']
99
- if (path.includes('/dept')) return ['dept']
100
- if (path.includes('/group')) return ['group']
101
- // 4A 域 (合并后菜单项直接是 4a/* 作为顶级 key)
102
- if (path.includes('/4a/')) {
103
- const parts = path.split('/4a/')[1]?.split('/') || []
104
- if (parts.length > 0) return [`4a/${parts[0]}`]
105
- }
106
- // z-webide
107
- if (path.includes('/webide')) return ['webide']
108
- // z-agent-team
109
- if (path.includes('/agent-team')) return ['agent-team']
110
- return ['4a/account']
111
- }
112
-
113
- // 菜单项
114
- const menuItems = [
115
- // ===== FEATURE015: 合并 4A 到顶层, 一套菜单 =====
116
- {
117
- key: '4a/account',
118
- icon: <TeamOutlined/>,
119
- label: '账号管理',
120
- },
121
- {
122
- key: '4a/role',
123
- icon: <SafetyOutlined/>,
124
- label: '角色管理',
125
- },
126
- {
127
- key: '4a/application',
128
- icon: <AppstoreOutlined/>,
129
- label: '应用管理',
130
- },
131
- {
132
- key: '4a/tenant',
133
- icon: <TeamOutlined/>,
134
- label: '租户管理',
135
- },
136
- {
137
- key: '4a/org',
138
- icon: <ClusterOutlined/>,
139
- label: '组织管理',
140
- },
141
- {
142
- key: '4a/permission',
143
- icon: <SafetyCertificateOutlined/>,
144
- label: '权限管理',
145
- },
146
- {
147
- key: '4a/surl',
148
- icon: <LinkOutlined/>,
149
- label: '短链管理',
150
- },
151
-
152
- {
153
- key: 'webide',
154
- icon: <CodeOutlined/>,
155
- label: 'WebIDE 容器',
156
- },
157
- {
158
- key: 'agent-team',
159
- icon: <RobotOutlined/>,
160
- label: 'Agent 群组 IM',
161
- },
162
- {
163
- type: 'divider',
164
- },
165
- {
166
- key: 'settings',
167
- icon: <SettingOutlined/>,
168
- label: '系统设置',
169
- },
170
- ]
171
-
172
- // 处理菜单点击
173
- const handleMenuClick = ({key}) => {
174
- navigate(`/ctc/${key}`)
175
- }
176
-
177
- // compact=true: 由主壳 App.jsx 提供 Layout, 这里只渲染 children (passthrough)
178
- // compact=false: 独立运行时, 自己提供完整 Layout (Header + Sider + Content)
179
- if (compact) {
180
- return <>{children}</>
181
- }
182
-
183
- return (
184
- <AntLayout className={styles.layout}>
185
- {/* 顶部导航栏 */}
186
- <Header className={styles.header}>
187
- <div className={styles.logo}>
188
- <span className={styles.logoText}>Z-CTC 统一用户中心</span>
189
- </div>
190
- <div className={styles.headerRight}>
191
- <Space size={24}>
192
- <Dropdown
193
- overlay={
194
- <div style={{
195
- background: '#fff',
196
- borderRadius: '8px',
197
- boxShadow: '0 6px 16px rgba(0, 0, 0, 0.12)',
198
- padding: '16px',
199
- width: '360px'
200
- }}>
201
- <div style={{
202
- display: 'flex',
203
- alignItems: 'center',
204
- gap: '12px',
205
- marginBottom: '12px'
206
- }}>
207
- <span style={{fontSize: '14px', color: '#666'}}>租户域</span>
208
- <Cascader
209
- value={selectedTenant}
210
- onChange={(value) => setSelectedTenant(value)}
211
- options={tenantOptions}
212
- placeholder="请选择租户域"
213
- style={{flex: 1}}
214
- />
215
- </div>
216
- <Divider style={{margin: '12px 0'}}/>
217
- <div style={{display: 'flex', flexDirection: 'column', gap: '8px'}}>
218
- <div style={{display: 'flex', fontSize: '14px'}}>
219
- <span style={{color: '#999', width: '70px'}}>用户名:</span>
220
- <span>{userInfo?.userName || '-'}</span>
221
- </div>
222
- <div style={{display: 'flex', fontSize: '14px'}}>
223
- <span style={{color: '#999', width: '70px'}}>真实姓名:</span>
224
- <span>{userInfo?.realName || '-'}</span>
225
- </div>
226
- <div style={{display: 'flex', fontSize: '14px'}}>
227
- <span style={{color: '#999', width: '70px'}}>邮箱:</span>
228
- <span>{userInfo?.email || '-'}</span>
229
- </div>
230
- <div style={{display: 'flex', fontSize: '14px'}}>
231
- <span style={{color: '#999', width: '70px'}}>手机号:</span>
232
- <span>{userInfo?.phone || '-'}</span>
233
- </div>
234
- <div style={{display: 'flex', fontSize: '14px'}}>
235
- <span style={{color: '#999', width: '70px'}}>状态:</span>
236
- <span>{userInfo?.status === 1 ? '正常' : '停用'}</span>
237
- </div>
238
- </div>
239
- <Divider style={{margin: '12px 0'}}/>
240
- <div style={{display: 'flex', flexDirection: 'column'}}>
241
- <div style={{
242
- display: 'flex',
243
- alignItems: 'center',
244
- gap: '8px',
245
- padding: '8px 12px',
246
- cursor: 'pointer',
247
- borderRadius: '4px',
248
- fontSize: '14px'
249
- }} onClick={() => {
250
- }}>
251
- <UserOutlined/> 个人中心
252
- </div>
253
- <div style={{
254
- display: 'flex',
255
- alignItems: 'center',
256
- gap: '8px',
257
- padding: '8px 12px',
258
- cursor: 'pointer',
259
- borderRadius: '4px',
260
- fontSize: '14px'
261
- }} onClick={() => {
262
- }}>
263
- <SettingOutlined/> 系统设置
264
- </div>
265
- <div style={{
266
- display: 'flex',
267
- alignItems: 'center',
268
- gap: '8px',
269
- padding: '8px 12px',
270
- cursor: 'pointer',
271
- borderRadius: '4px',
272
- fontSize: '14px'
273
- }} onClick={() => {
274
- localStorage.removeItem('token')
275
- localStorage.removeItem('userInfo')
276
- navigate('/ctc/login')
277
- }}>
278
- <LogoutOutlined/> 退出登录
279
- </div>
280
- </div>
281
- </div>
282
- }
283
- placement="bottomRight"
284
- trigger={['click']}
285
- >
286
- <div className={styles.userInfo}>
287
- <Avatar icon={<UserOutlined/>} size="small"/>
288
- <Text className={styles.userName}>{userName}</Text>
289
- <DownOutlined/>
290
- </div>
291
- </Dropdown>
292
- </Space>
293
- </div>
294
- </Header>
295
-
296
- <AntLayout className={styles.mainLayout}>
297
- {/* 侧边菜单 */}
298
- <Sider
299
- trigger={null}
300
- collapsible
301
- collapsed={collapsed}
302
- className={styles.sider}
303
- width={200}
304
- >
305
- <Menu
306
- mode="inline"
307
- selectedKeys={getSelectedKeys()}
308
- defaultOpenKeys={['user', 'role', 'permission', 'audit', 'tenant', 'domain', 'org', 'dept', 'group']}
309
- className={styles.menu}
310
- items={menuItems}
311
- onClick={handleMenuClick}
312
- />
313
- <div
314
- className={styles.collapsedBtn}
315
- onClick={() => setCollapsed(!collapsed)}
316
- >
317
- {collapsed ? <MenuUnfoldOutlined/> : <MenuFoldOutlined/>}
318
- </div>
319
- </Sider>
320
-
321
- {/* 主内容区 */}
322
- <Content className={styles.content}>
323
- {children}
324
- </Content>
325
- </AntLayout>
326
- </AntLayout>
327
- )
328
- }
329
-
330
- export default Layout
@@ -1,145 +0,0 @@
1
- .layout {
2
- min-height: 100vh;
3
- }
4
-
5
- .header {
6
- display: flex;
7
- justify-content: space-between;
8
- align-items: center;
9
- padding: 0 24px;
10
- background: #001529;
11
- height: 48px;
12
- line-height: 48px;
13
- }
14
-
15
- .logo {
16
- display: flex;
17
- align-items: center;
18
- }
19
-
20
- .logoText {
21
- color: #fff;
22
- font-size: 16px;
23
- font-weight: 600;
24
- }
25
-
26
- .headerRight {
27
- display: flex;
28
- align-items: center;
29
- }
30
-
31
- .userInfo {
32
- display: flex;
33
- align-items: center;
34
- cursor: pointer;
35
- color: #fff;
36
- }
37
-
38
- .userName {
39
- margin-left: 8px;
40
- color: #fff;
41
- }
42
-
43
- .mainLayout {
44
- margin-top: 0;
45
- min-height: calc(100vh - 48px);
46
- }
47
-
48
- .sider {
49
- background: #fff;
50
- min-height: calc(100vh - 48px);
51
- }
52
-
53
- .menu {
54
- border-right: none;
55
- }
56
-
57
- .collapsedBtn {
58
- position: absolute;
59
- bottom: 16px;
60
- left: 50%;
61
- transform: translateX(-50%);
62
- cursor: pointer;
63
- padding: 8px 16px;
64
- background: #f5f5f5;
65
- border-radius: 4px;
66
- color: #666;
67
- }
68
-
69
- .collapsedBtn:hover {
70
- background: #e6f7ff;
71
- color: #1890ff;
72
- }
73
-
74
- .content {
75
- padding: 24px;
76
- background: #f5f5f5;
77
- min-height: calc(100vh - 48px);
78
- overflow: auto;
79
- }
80
-
81
- .userDropdownPanel {
82
- background: #fff;
83
- border-radius: 8px;
84
- box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
85
- padding: 16px;
86
- width: 360px;
87
- }
88
-
89
- .tenantSection {
90
- display: flex;
91
- align-items: center;
92
- gap: 12px;
93
- }
94
-
95
- .tenantLabel {
96
- font-size: 14px;
97
- color: #666;
98
- white-space: nowrap;
99
- }
100
-
101
- .tenantCascader {
102
- flex: 1;
103
- }
104
-
105
- .panelDivider {
106
- margin: 12px 0;
107
- }
108
-
109
- .userSection {
110
- display: flex;
111
- flex-direction: column;
112
- gap: 8px;
113
- }
114
-
115
- .userInfoRow {
116
- display: flex;
117
- font-size: 14px;
118
- line-height: 1.6;
119
- }
120
-
121
- .userInfoLabel {
122
- color: #999;
123
- width: 70px;
124
- flex-shrink: 0;
125
- }
126
-
127
- .menuSection {
128
- display: flex;
129
- flex-direction: column;
130
- }
131
-
132
- .menuItem {
133
- display: flex;
134
- align-items: center;
135
- gap: 8px;
136
- padding: 8px 12px;
137
- cursor: pointer;
138
- border-radius: 4px;
139
- font-size: 14px;
140
- color: #333;
141
- }
142
-
143
- .menuItem:hover {
144
- background: #f5f5f5;
145
- }