jianghu-ui 1.0.1

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 (112) hide show
  1. package/README.md +376 -0
  2. package/dist/jianghu-ui.css +2318 -0
  3. package/dist/jianghu-ui.js +2 -0
  4. package/dist/jianghu-ui.js.LICENSE.txt +1 -0
  5. package/package.json +56 -0
  6. package/src/Design.stories.mdx +195 -0
  7. package/src/Introduction.stories.mdx +148 -0
  8. package/src/components/JhAddressSelect/JhAddressSelect.md +250 -0
  9. package/src/components/JhAddressSelect/JhAddressSelect.stories.js +282 -0
  10. package/src/components/JhAddressSelect/JhAddressSelect.vue +261 -0
  11. package/src/components/JhCard/JhCard.md +246 -0
  12. package/src/components/JhCard/JhCard.stories.js +688 -0
  13. package/src/components/JhCard/JhCard.vue +604 -0
  14. package/src/components/JhCheckCard/JhCheckCard.md +245 -0
  15. package/src/components/JhCheckCard/JhCheckCard.stories.js +750 -0
  16. package/src/components/JhCheckCard/JhCheckCard.vue +476 -0
  17. package/src/components/JhConfirmDialog/JhConfirmDialog.md +70 -0
  18. package/src/components/JhConfirmDialog/JhConfirmDialog.stories.js +550 -0
  19. package/src/components/JhConfirmDialog/JhConfirmDialog.vue +181 -0
  20. package/src/components/JhDateRangePicker/JhDateRangePicker.md +56 -0
  21. package/src/components/JhDateRangePicker/JhDateRangePicker.stories.js +320 -0
  22. package/src/components/JhDateRangePicker/JhDateRangePicker.vue +307 -0
  23. package/src/components/JhDescriptions/JhDescriptions.md +724 -0
  24. package/src/components/JhDescriptions/JhDescriptions.stories.js +858 -0
  25. package/src/components/JhDescriptions/JhDescriptions.vue +933 -0
  26. package/src/components/JhDraggable/JhDraggable.md +66 -0
  27. package/src/components/JhDraggable/JhDraggable.stories.js +161 -0
  28. package/src/components/JhDraggable/JhDraggable.vue +254 -0
  29. package/src/components/JhDrawer/JhDrawer.md +68 -0
  30. package/src/components/JhDrawer/JhDrawer.stories.js +478 -0
  31. package/src/components/JhDrawer/JhDrawer.vue +281 -0
  32. package/src/components/JhDrawerForm/JhDrawerForm.md +69 -0
  33. package/src/components/JhDrawerForm/JhDrawerForm.stories.js +492 -0
  34. package/src/components/JhDrawerForm/JhDrawerForm.vue +297 -0
  35. package/src/components/JhEditableTable/JhEditableTable.md +507 -0
  36. package/src/components/JhEditableTable/JhEditableTable.stories.js +615 -0
  37. package/src/components/JhEditableTable/JhEditableTable.vue +685 -0
  38. package/src/components/JhFileInput/JhFileInput.md +56 -0
  39. package/src/components/JhFileInput/JhFileInput.stories.js +103 -0
  40. package/src/components/JhFileInput/JhFileInput.vue +253 -0
  41. package/src/components/JhForm/JhForm.md +676 -0
  42. package/src/components/JhForm/JhForm.stories.js +1375 -0
  43. package/src/components/JhForm/JhForm.vue +657 -0
  44. package/src/components/JhFormField/JhFormField.stories.js +217 -0
  45. package/src/components/JhFormField/JhFormField.vue +439 -0
  46. package/src/components/JhFormFields/JhFormFields.md +647 -0
  47. package/src/components/JhFormFields/JhFormFields.stories.js +922 -0
  48. package/src/components/JhFormFields/JhFormFields.vue +998 -0
  49. package/src/components/JhFormList/JhFormList.md +303 -0
  50. package/src/components/JhFormList/JhFormList.stories.js +661 -0
  51. package/src/components/JhFormList/JhFormList.vue +1127 -0
  52. package/src/components/JhJsonEditor/JhJsonEditor.md +54 -0
  53. package/src/components/JhJsonEditor/JhJsonEditor.stories.js +157 -0
  54. package/src/components/JhJsonEditor/JhJsonEditor.vue +178 -0
  55. package/src/components/JhLayout/JhLayout.md +580 -0
  56. package/src/components/JhLayout/JhLayout.stories.js +414 -0
  57. package/src/components/JhLayout/JhLayout.vue +387 -0
  58. package/src/components/JhList/JhList.md +441 -0
  59. package/src/components/JhList/JhList.stories.js +524 -0
  60. package/src/components/JhList/JhList.vue +571 -0
  61. package/src/components/JhMarkdownEditor/JhMarkdownEditor.md +56 -0
  62. package/src/components/JhMarkdownEditor/JhMarkdownEditor.stories.js +191 -0
  63. package/src/components/JhMarkdownEditor/JhMarkdownEditor.vue +188 -0
  64. package/src/components/JhMask/JhMask.md +62 -0
  65. package/src/components/JhMask/JhMask.stories.js +270 -0
  66. package/src/components/JhMask/JhMask.vue +123 -0
  67. package/src/components/JhMenu/JhMenu.md +85 -0
  68. package/src/components/JhMenu/JhMenu.stories.js +384 -0
  69. package/src/components/JhMenu/JhMenu.vue +545 -0
  70. package/src/components/JhModal/JhModal.md +68 -0
  71. package/src/components/JhModal/JhModal.stories.js +562 -0
  72. package/src/components/JhModal/JhModal.vue +235 -0
  73. package/src/components/JhModalForm/JhModalForm.md +69 -0
  74. package/src/components/JhModalForm/JhModalForm.stories.js +592 -0
  75. package/src/components/JhModalForm/JhModalForm.vue +298 -0
  76. package/src/components/JhPageContainer/JhPageContainer.md +409 -0
  77. package/src/components/JhPageContainer/JhPageContainer.stories.js +209 -0
  78. package/src/components/JhPageContainer/JhPageContainer.vue +72 -0
  79. package/src/components/JhQueryFilter/JhQueryFilter.md +77 -0
  80. package/src/components/JhQueryFilter/JhQueryFilter.stories.js +684 -0
  81. package/src/components/JhQueryFilter/JhQueryFilter.vue +429 -0
  82. package/src/components/JhScene/JhScene.md +64 -0
  83. package/src/components/JhScene/JhScene.stories.js +317 -0
  84. package/src/components/JhScene/JhScene.vue +376 -0
  85. package/src/components/JhStatisticCard/JhStatisticCard.md +363 -0
  86. package/src/components/JhStatisticCard/JhStatisticCard.stories.js +847 -0
  87. package/src/components/JhStatisticCard/JhStatisticCard.vue +459 -0
  88. package/src/components/JhStepsForm/JhStepsForm.md +666 -0
  89. package/src/components/JhStepsForm/JhStepsForm.stories.js +1224 -0
  90. package/src/components/JhStepsForm/JhStepsForm.vue +749 -0
  91. package/src/components/JhTable/JhTable.md +730 -0
  92. package/src/components/JhTable/JhTable.stories.js +1444 -0
  93. package/src/components/JhTable/JhTable.vue +2298 -0
  94. package/src/components/JhTableAttachment/JhTableAttachment.md +70 -0
  95. package/src/components/JhTableAttachment/JhTableAttachment.stories.js +198 -0
  96. package/src/components/JhTableAttachment/JhTableAttachment.vue +264 -0
  97. package/src/components/JhToast/JhToast.md +67 -0
  98. package/src/components/JhToast/JhToast.stories.js +386 -0
  99. package/src/components/JhToast/JhToast.vue +239 -0
  100. package/src/components/JhTreeSelect/JhTreeSelect.md +82 -0
  101. package/src/components/JhTreeSelect/JhTreeSelect.stories.js +391 -0
  102. package/src/components/JhTreeSelect/JhTreeSelect.vue +727 -0
  103. package/src/components/JhWaterMark/JhWaterMark.md +190 -0
  104. package/src/components/JhWaterMark/JhWaterMark.stories.js +675 -0
  105. package/src/components/JhWaterMark/JhWaterMark.vue +351 -0
  106. package/src/components/README.md +52 -0
  107. package/src/index.js +135 -0
  108. package/src/style/globalCSSJHV4.css +348 -0
  109. package/src/style/globalCSSVuetifyV4.css +637 -0
  110. package/src/style/storybook.css +4 -0
  111. package/src/tailwind.css +3 -0
  112. package/src/utils/vuetify.js +31 -0
@@ -0,0 +1,414 @@
1
+ import JhLayout from './JhLayout.vue';
2
+ import JhPageContainer from '../JhPageContainer/JhPageContainer.vue';
3
+ import JhTable from '../JhTable/JhTable.vue';
4
+ import JhQueryFilter from '../JhQueryFilter/JhQueryFilter.vue';
5
+
6
+ // 示例菜单数据
7
+ const sampleMenuData = [
8
+ {
9
+ name: '工作台',
10
+ path: '/dashboard',
11
+ icon: 'mdi-view-dashboard'
12
+ },
13
+ {
14
+ name: '用户管理',
15
+ icon: 'mdi-account-group',
16
+ children: [
17
+ {
18
+ name: '用户列表',
19
+ path: '/users/list',
20
+ icon: 'mdi-account-multiple'
21
+ },
22
+ {
23
+ name: '角色管理',
24
+ path: '/users/roles',
25
+ icon: 'mdi-shield-account'
26
+ },
27
+ {
28
+ name: '权限管理',
29
+ path: '/users/permissions',
30
+ icon: 'mdi-key'
31
+ }
32
+ ]
33
+ },
34
+ {
35
+ name: '内容管理',
36
+ icon: 'mdi-file-document-multiple',
37
+ children: [
38
+ {
39
+ name: '文章管理',
40
+ icon: 'mdi-file-document',
41
+ children: [
42
+ {
43
+ name: '文章列表',
44
+ path: '/content/articles/list'
45
+ },
46
+ {
47
+ name: '分类管理',
48
+ path: '/content/articles/categories'
49
+ },
50
+ {
51
+ name: '标签管理',
52
+ path: '/content/articles/tags'
53
+ }
54
+ ]
55
+ },
56
+ {
57
+ name: '媒体库',
58
+ path: '/content/media',
59
+ icon: 'mdi-image-multiple'
60
+ }
61
+ ]
62
+ },
63
+ {
64
+ name: '系统设置',
65
+ icon: 'mdi-cog',
66
+ children: [
67
+ {
68
+ name: '基础设置',
69
+ path: '/settings/basic',
70
+ icon: 'mdi-cog-outline'
71
+ },
72
+ {
73
+ name: '安全设置',
74
+ path: '/settings/security',
75
+ icon: 'mdi-shield-check'
76
+ },
77
+ {
78
+ name: '日志管理',
79
+ path: '/settings/logs',
80
+ icon: 'mdi-text-box-multiple'
81
+ }
82
+ ]
83
+ }
84
+ ];
85
+
86
+ // 用户菜单数据
87
+ const avatarMenuData = [
88
+ {
89
+ name: '个人中心',
90
+ icon: 'mdi-account-circle',
91
+ path: '/profile'
92
+ },
93
+ {
94
+ name: '账户设置',
95
+ icon: 'mdi-cog',
96
+ path: '/account'
97
+ }
98
+ ];
99
+
100
+ export default {
101
+ title: '布局/JhLayout - 页面布局',
102
+ component: JhLayout,
103
+ tags: ['autodocs'],
104
+ argTypes: {
105
+ title: {
106
+ control: 'text',
107
+ description: '应用标题'
108
+ },
109
+ logo: {
110
+ control: 'text',
111
+ description: 'Logo 图标名称'
112
+ },
113
+ layout: {
114
+ control: 'select',
115
+ options: ['side', 'top', 'mix'],
116
+ description: '布局模式'
117
+ },
118
+ headerTheme: {
119
+ control: 'select',
120
+ options: ['light', 'dark'],
121
+ description: '头部主题'
122
+ },
123
+ sidebarTheme: {
124
+ control: 'select',
125
+ options: ['light', 'dark'],
126
+ description: '侧边栏主题'
127
+ },
128
+ showBreadcrumb: {
129
+ control: 'boolean',
130
+ description: '是否显示面包屑'
131
+ },
132
+ showPageHeader: {
133
+ control: 'boolean',
134
+ description: '是否显示页面头部'
135
+ },
136
+ showFooter: {
137
+ control: 'boolean',
138
+ description: '是否显示底部'
139
+ },
140
+ showSettings: {
141
+ control: 'boolean',
142
+ description: '是否显示设置按钮'
143
+ },
144
+ contentPadding: {
145
+ control: 'boolean',
146
+ description: '内容区域是否有内边距'
147
+ }
148
+ },
149
+ parameters: {
150
+ docs: {
151
+ description: {
152
+ component: `
153
+
154
+ 基于 Ant Design Pro 的 ProLayout 设计的企业级页面布局组件,提供完整的中后台布局解决方案。
155
+
156
+ ## 功能特性
157
+
158
+ ### 🎨 多种布局模式
159
+ - **侧边布局 (side)**: 经典的侧边栏导航布局
160
+ - **顶部布局 (top)**: 顶部导航栏布局
161
+ - **混合布局 (mix)**: 顶部 + 侧边栏混合布局
162
+
163
+ ### 🎯 核心功能
164
+ - **响应式设计**: 自动适配移动端和桌面端
165
+ - **可折叠侧边栏**: 支持侧边栏折叠/展开
166
+ - **自动面包屑**: 根据路由自动生成面包屑导航
167
+ - **多级菜单**: 支持三级菜单嵌套
168
+ - **主题切换**: 支持亮色/暗色主题
169
+ - **页面头部**: 可选的页面标题和描述区域
170
+ - **底部区域**: 可自定义的页脚内容
171
+ - **用户菜单**: 内置用户头像和下拉菜单
172
+ - **设置面板**: 实时调整布局配置
173
+
174
+ ### 📦 插槽支持
175
+ - \`logo\`: 自定义 Logo 区域
176
+ - \`headerRight\`: 自定义头部右侧内容
177
+ - \`pageHeader\`: 自定义页面头部
178
+ - \`pageHeaderExtra\`: 页面头部额外操作区
179
+ - \`default\`: 主内容区域
180
+ - \`footer\`: 自定义底部内容
181
+ - \`sidebarFooter\`: 侧边栏底部内容
182
+
183
+ ### 🎪 事件
184
+ - \`menu-click\`: 菜单点击事件
185
+ - \`breadcrumb-click\`: 面包屑点击事件
186
+ - \`avatar-menu-click\`: 用户菜单点击事件
187
+ - \`logout\`: 退出登录事件
188
+ - \`sidebar-toggle\`: 侧边栏切换事件
189
+ - \`update:layout\`: 布局模式更新
190
+ - \`update:headerTheme\`: 头部主题更新
191
+ - \`update:sidebarTheme\`: 侧边栏主题更新
192
+
193
+ ## 使用场景
194
+
195
+ 适用于所有中后台管理系统的页面布局:
196
+ - 企业管理系统
197
+ - 数据分析平台
198
+ - 内容管理系统
199
+ - 电商后台
200
+ - 任何需要统一布局的 Web 应用
201
+
202
+ ## 与 JhPageContainer 配合
203
+
204
+ 推荐在 JhLayout 的内容区域使用 JhPageContainer 组件:
205
+ - JhLayout 提供应用级布局(导航、头部、侧边栏)
206
+ - JhPageContainer 提供页面级容器(页面标题、搜索栏)
207
+ - 配合使用时,建议设置 \`content-padding="false"\` 和 \`show-page-header="false"\`
208
+ `
209
+ }
210
+ }
211
+ }
212
+ };
213
+
214
+ // 基础示例(默认)
215
+ export const 基础示例 = {
216
+ args: {
217
+ title: 'JianghuJS Admin',
218
+ logo: 'mdi-view-dashboard',
219
+ menuData: sampleMenuData,
220
+ currentPath: '/users/list',
221
+ contentBackground: '#f5f5f5',
222
+ userInfo: {
223
+ username: '管理员',
224
+ userId: 'admin',
225
+ roles: ['超级管理员', '系统管理员']
226
+ },
227
+ avatarMenuList: avatarMenuData,
228
+ showSettings: true,
229
+ showAvatar: true
230
+ },
231
+ render: (args) => ({
232
+ components: { JhLayout, JhPageContainer, JhTable, JhQueryFilter },
233
+ data() {
234
+ return {
235
+ args,
236
+ keyword: '',
237
+ keywordFieldList: ['username', 'email'],
238
+ headers: [
239
+ { text: 'ID', value: 'id', dataIndex: 'id', width: '80px' },
240
+ { text: '用户名', value: 'username', dataIndex: 'username', search: true },
241
+ { text: '邮箱', value: 'email', dataIndex: 'email' },
242
+ { text: '角色', value: 'role', dataIndex: 'role' },
243
+ { text: '状态', value: 'status', dataIndex: 'status', width: '100px' },
244
+ { text: '创建时间', value: 'createdAt', dataIndex: 'createdAt', width: '150px' }
245
+ ],
246
+ tableData: [
247
+ { id: 1, username: '张三', email: 'zhangsan@example.com', role: '管理员', status: '启用', createdAt: '2024-01-01' },
248
+ { id: 2, username: '李四', email: 'lisi@example.com', role: '编辑', status: '启用', createdAt: '2024-01-02' },
249
+ { id: 3, username: '王五', email: 'wangwu@example.com', role: '用户', status: '禁用', createdAt: '2024-01-03' },
250
+ { id: 4, username: '赵六', email: 'zhaoliu@example.com', role: '用户', status: '启用', createdAt: '2024-01-04' },
251
+ { id: 5, username: '孙七', email: 'sunqi@example.com', role: '编辑', status: '启用', createdAt: '2024-01-05' },
252
+ { id: 6, username: '周八', email: 'zhouba@example.com', role: '用户', status: '启用', createdAt: '2024-01-06' },
253
+ { id: 7, username: '吴九', email: 'wujiu@example.com', role: '编辑', status: '禁用', createdAt: '2024-01-07' },
254
+ { id: 8, username: '郑十', email: 'zhengshi@example.com', role: '用户', status: '启用', createdAt: '2024-01-08' }
255
+ ],
256
+ loading: false
257
+ };
258
+ },
259
+ template: `
260
+ <jh-layout
261
+ v-bind="args"
262
+ @menu-click="handleMenuClick"
263
+ @logout="handleLogout"
264
+ >
265
+ <jh-page-container
266
+ page-name="用户管理"
267
+ :show-help-button="true"
268
+ @help-click="handleHelpClick"
269
+ >
270
+ <template v-slot:search-bar>
271
+ <jh-query-filter
272
+ class="pa-0"
273
+ :keyword.sync="keyword"
274
+ :keywordFieldList.sync="keywordFieldList"
275
+ :fields="headers"
276
+ @search="handleSearch"
277
+ />
278
+ </template>
279
+
280
+ <template v-slot:content>
281
+ <jh-table
282
+ :headers="headers"
283
+ :items="tableData"
284
+ :loading="loading"
285
+ show-index
286
+ header-title="用户列表"
287
+ tooltip="管理系统中的所有用户信息"
288
+ @create-click="handleCreate"
289
+ @update-click="handleUpdate"
290
+ @delete-click="handleDelete"
291
+ >
292
+ <template v-slot:item.status="{ item }">
293
+ <v-chip
294
+ small
295
+ :color="item.status === '启用' ? 'success' : 'error'"
296
+ text-color="white"
297
+ >
298
+ {{ item.status }}
299
+ </v-chip>
300
+ </template>
301
+ </jh-table>
302
+ </template>
303
+ </jh-page-container>
304
+ </jh-layout>
305
+ `,
306
+ methods: {
307
+ handleMenuClick(item) {
308
+ console.log('菜单点击:', item);
309
+ this.args.currentPath = item.path || item.id;
310
+ },
311
+ handleLogout() {
312
+ alert('退出登录');
313
+ },
314
+ handleHelpClick() {
315
+ alert('帮助按钮被点击');
316
+ },
317
+ handleSearch() {
318
+ this.loading = true;
319
+ setTimeout(() => {
320
+ this.loading = false;
321
+ console.log('搜索:', this.keyword);
322
+ }, 1000);
323
+ },
324
+ handleCreate() {
325
+ alert('新增用户');
326
+ },
327
+ handleUpdate(item) {
328
+ alert('编辑用户: ' + item.username);
329
+ },
330
+ handleDelete(item) {
331
+ if (confirm('确定删除用户 ' + item.username + ' 吗?')) {
332
+ console.log('删除用户:', item);
333
+ }
334
+ }
335
+ }
336
+ })
337
+ };
338
+
339
+ // 暗色主题
340
+ export const 暗色主题 = {
341
+ args: {
342
+ ...基础示例.args,
343
+ contentBackground: '#1e1e1e'
344
+ },
345
+ render: 基础示例.render
346
+ };
347
+
348
+ // 无用户头像
349
+ export const 无用户头像 = {
350
+ args: {
351
+ ...基础示例.args,
352
+ showAvatar: false
353
+ },
354
+ render: 基础示例.render
355
+ };
356
+
357
+ // 无设置按钮
358
+ export const 无设置按钮 = {
359
+ args: {
360
+ ...基础示例.args,
361
+ showSettings: false
362
+ },
363
+ render: 基础示例.render
364
+ };
365
+
366
+ // 自定义 Logo
367
+ export const 自定义Logo = {
368
+ args: {
369
+ ...基础示例.args
370
+ },
371
+ render: (args) => ({
372
+ components: { JhLayout, JhPageContainer },
373
+ data() {
374
+ return {
375
+ args
376
+ };
377
+ },
378
+ template: `
379
+ <jh-layout v-bind="args">
380
+ <template v-slot:logo>
381
+ <div class="d-flex align-center">
382
+ <v-avatar color="primary" size="32" class="mr-2">
383
+ <span class="white--text font-weight-bold">JH</span>
384
+ </v-avatar>
385
+ <span class="text-h6 font-weight-bold primary--text">JianghuJS</span>
386
+ </div>
387
+ </template>
388
+
389
+ <jh-page-container page-name="自定义Logo示例">
390
+ <template v-slot:content>
391
+ <v-card>
392
+ <v-card-title>自定义 Logo 示例</v-card-title>
393
+ <v-card-text>
394
+ 通过 logo 插槽可以完全自定义 Logo 区域的内容。
395
+ </v-card-text>
396
+ </v-card>
397
+ </template>
398
+ </jh-page-container>
399
+ </jh-layout>
400
+ `
401
+ })
402
+ };
403
+
404
+ // 右侧菜单示例
405
+ export const 右侧菜单 = {
406
+ args: {
407
+ ...基础示例.args,
408
+ rightMenuList: [
409
+ { title: '帮助中心', icon: 'mdi-help-circle', id: 'help' },
410
+ { title: '消息通知', icon: 'mdi-bell', id: 'notification' }
411
+ ]
412
+ },
413
+ render: 基础示例.render
414
+ };