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
package/README.md ADDED
@@ -0,0 +1,376 @@
1
+ # JianghuJS UI
2
+
3
+ > 基于 Vue 2 + Vuetify 2 的现代化 UI 组件库,使用 Storybook 提供交互式文档和在线预览
4
+
5
+ ## 特性
6
+
7
+ - 🚀 **开箱即用** - 通过 CDN 引入,无需复杂配置
8
+ - 🎨 **Material Design** - 基于 Vuetify 2,遵循 Material Design 规范
9
+ - 📱 **响应式设计** - 完美适配各种屏幕尺寸
10
+ - 🔧 **高度可定制** - 丰富的 props 和插槽支持
11
+ - 📖 **完善的文档** - Storybook 交互式文档
12
+ - ⚡ **性能优化** - CDN 加速,按需加载
13
+
14
+ ## 在线预览
15
+
16
+ ### 在线文档
17
+
18
+ 访问在线 Storybook 文档:**https://jianghujs.github.io/jianghu-ui/**
19
+
20
+ ### 本地预览
21
+
22
+ 启动 Storybook 查看组件文档和示例:
23
+
24
+ ```bash
25
+ npm run storybook
26
+ ```
27
+
28
+ 访问 http://localhost:6006 查看完整文档
29
+
30
+ ## 快速开始
31
+
32
+ ### 1. 安装依赖
33
+
34
+ ```bash
35
+ npm install
36
+ ```
37
+
38
+ ### 2. 启动开发服务器
39
+
40
+ ```bash
41
+ npm run storybook
42
+ ```
43
+
44
+ ### 3. 构建文档站点
45
+
46
+ ```bash
47
+ npm run build-storybook
48
+ ```
49
+
50
+ 构建完成后,可以使用以下命令预览静态站点:
51
+
52
+ ```bash
53
+ npm run serve-storybook
54
+ ```
55
+
56
+ ## CDN 使用方式
57
+
58
+ 在你的 HTML 文件中引入必要的资源:
59
+
60
+ ```html
61
+ <!DOCTYPE html>
62
+ <html>
63
+ <head>
64
+ <meta charset="utf-8">
65
+ <meta name="viewport" content="width=device-width,initial-scale=1.0">
66
+ <title>JianghuJS UI Demo</title>
67
+
68
+ <!-- Vuetify CSS -->
69
+ <link href="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.min.css" rel="stylesheet">
70
+ <!-- Material Design Icons -->
71
+ <link href="https://cdn.jsdelivr.net/npm/@mdi/font@6.x/css/materialdesignicons.min.css" rel="stylesheet">
72
+ <!-- Roboto 字体 -->
73
+ <link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900" rel="stylesheet">
74
+ <!-- JianghuJS UI 核心样式(锁定具体版本号,如 1.0.0) -->
75
+ <link href="https://jianghujs.github.io/jianghu-ui/cdn/<版本号>/jianghu-ui.css" rel="stylesheet">
76
+ </head>
77
+ <body>
78
+ <div id="app">
79
+ <v-app>
80
+ <v-container>
81
+ <jh-button label="点击我" color="primary" @click="handleClick" />
82
+ </v-container>
83
+ </v-app>
84
+ </div>
85
+
86
+ <!-- Vue 2 -->
87
+ <script src="https://cdn.jsdelivr.net/npm/vue@2.7/dist/vue.js"></script>
88
+ <!-- Vuetify -->
89
+ <script src="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.min.js"></script>
90
+ <!-- JianghuJS UI 运行时代码 -->
91
+ <script src="https://jianghujs.github.io/jianghu-ui/cdn/<版本号>/jianghu-ui.js"></script>
92
+
93
+ <script>
94
+ Vue.component('jh-button', {
95
+ // 引入你的组件定义
96
+ });
97
+
98
+ new Vue({
99
+ el: '#app',
100
+ vuetify: new Vuetify(),
101
+ methods: {
102
+ handleClick() {
103
+ alert('按钮被点击了!');
104
+ }
105
+ }
106
+ });
107
+ </script>
108
+ </body>
109
+ </html>
110
+ ```
111
+
112
+ > ✅ CDN 产物会被发布到 `https://jianghujs.github.io/jianghu-ui/cdn/<版本号>/` 目录中,示例:`cdn/1.0.0/jianghu-ui.js`。生产环境务必固定具体版本,若仅需查看最新构建可临时使用 `cdn/latest/`。
113
+
114
+ ## 组件列表
115
+
116
+ ### 基础组件
117
+
118
+ #### JhButton - 按钮组件
119
+ 支持多种样式、尺寸和状态的按钮组件。
120
+
121
+ ```vue
122
+ <jh-button
123
+ label="点击我"
124
+ color="primary"
125
+ size="large"
126
+ @click="handleClick"
127
+ />
128
+ ```
129
+
130
+ #### JhCard - 卡片组件
131
+ 用于展示内容块的卡片容器组件。
132
+
133
+ ```vue
134
+ <jh-card title="卡片标题" subtitle="副标题">
135
+ 卡片内容
136
+ <template v-slot:actions>
137
+ <jh-button label="操作" />
138
+ </template>
139
+ </jh-card>
140
+ ```
141
+
142
+ ### 数据展示
143
+
144
+ #### JhTable - 数据表格
145
+ 功能丰富的数据表格组件,支持排序、搜索、分页等。
146
+
147
+ ```vue
148
+ <jh-table
149
+ :headers="headers"
150
+ :items="items"
151
+ :loading="loading"
152
+ @row-click="handleRowClick"
153
+ />
154
+ ```
155
+
156
+ ### 表单组件
157
+
158
+ #### JhForm - 表单组件
159
+ 强大的表单组件,支持多种输入类型和验证。
160
+
161
+ ```vue
162
+ <jh-form
163
+ :fields="formFields"
164
+ @submit="handleSubmit"
165
+ />
166
+ ```
167
+
168
+ ## 项目结构
169
+
170
+ ```
171
+ jianghu-ui/
172
+ ├── .storybook/ # Storybook 配置
173
+ │ ├── main.js # 主配置文件
174
+ │ ├── preview.js # 预览配置
175
+ │ ├── preview-head.html # CDN 资源引入
176
+ │ └── manager.js # 管理界面配置
177
+ ├── src/
178
+ │ ├── components/ # UI 组件
179
+ │ │ ├── JhButton/ # 按钮组件
180
+ │ │ │ ├── JhButton.vue
181
+ │ │ │ └── JhButton.stories.js
182
+ │ │ ├── JhCard/ # 卡片组件
183
+ │ │ ├── JhTable/ # 表格组件
184
+ │ │ └── JhForm/ # 表单组件
185
+ │ ├── utils/ # 工具函数
186
+ │ │ └── vuetify.js # Vuetify 实例创建
187
+ │ ├── Introduction.stories.mdx # 介绍文档
188
+ │ ├── Design.stories.mdx # 设计规范
189
+ │ └── index.js # 入口文件
190
+ ├── package.json
191
+ └── README.md
192
+ ```
193
+
194
+ ## 部署
195
+
196
+ ### 自动部署
197
+
198
+ 推送到 `main` 分支时,GitHub Actions 会自动构建并部署 Storybook 到 GitHub Pages。
199
+
200
+ ```bash
201
+ git push origin main
202
+ ```
203
+
204
+ ### 手动部署
205
+
206
+ ```bash
207
+ npm run deploy
208
+ ```
209
+
210
+ 查看详细部署文档:[DEPLOY.md](./DEPLOY.md)
211
+
212
+ ## 开发指南
213
+
214
+ ### 添加新组件
215
+
216
+ 1. 在 `src/components/` 下创建组件目录
217
+ 2. 创建 `.vue` 组件文件
218
+ 3. 创建 `.stories.js` 故事文件
219
+ 4. 在 `src/index.js` 中导出组件
220
+
221
+ 示例:
222
+
223
+ ```javascript
224
+ // src/components/JhNewComponent/JhNewComponent.vue
225
+ <template>
226
+ <v-app>
227
+ <!-- 组件实现 -->
228
+ </v-app>
229
+ </template>
230
+
231
+ <script>
232
+ export default {
233
+ name: 'JhNewComponent',
234
+ props: {
235
+ // props 定义
236
+ }
237
+ }
238
+ </script>
239
+ ```
240
+
241
+ ```javascript
242
+ // src/components/JhNewComponent/JhNewComponent.stories.js
243
+ import JhNewComponent from './JhNewComponent.vue';
244
+
245
+ export default {
246
+ title: '基础组件/JhNewComponent',
247
+ component: JhNewComponent,
248
+ tags: ['autodocs'],
249
+ };
250
+
251
+ export const Default = {
252
+ args: {
253
+ // 默认 props
254
+ },
255
+ };
256
+ ```
257
+
258
+ ### 编写文档
259
+
260
+ 使用 MDX 格式编写文档页面:
261
+
262
+ ```mdx
263
+ import { Meta } from '@storybook/blocks';
264
+
265
+ <Meta title="介绍/新页面" />
266
+
267
+ # 页面标题
268
+
269
+ 页面内容...
270
+ ```
271
+
272
+ ## 技术栈
273
+
274
+ - **Vue 2.7** - 渐进式 JavaScript 框架
275
+ - **Vuetify 2.x** - Material Design 组件框架
276
+ - **Storybook 7.x** - UI 组件开发和文档工具
277
+ - **CDN** - 通过 CDN 引入依赖,简化部署
278
+
279
+ ## 浏览器支持
280
+
281
+ - Chrome (最新版)
282
+ - Firefox (最新版)
283
+ - Safari (最新版)
284
+ - Edge (最新版)
285
+
286
+ ## 贡献
287
+
288
+ 欢迎提交 Issue 和 Pull Request!
289
+
290
+ ### 开发流程
291
+
292
+ 1. Fork 本仓库
293
+ 2. 创建新分支 (`git checkout -b feature/your-feature`)
294
+ 3. 提交更改 (`git commit -am 'Add some feature'`)
295
+ 4. 推送到分支 (`git push origin feature/your-feature`)
296
+ 5. 创建 Pull Request
297
+
298
+ ## 许可证
299
+
300
+ MIT License
301
+
302
+ ## 相关链接
303
+
304
+ - [Vue 2 官方文档](https://v2.vuejs.org/)
305
+ - [Vuetify 2 官方文档](https://v2.vuetifyjs.com/)
306
+ - [Storybook 官方文档](https://storybook.js.org/)
307
+ - [Material Design Icons](https://materialdesignicons.com/)
308
+
309
+ ## AI 代码助手支持
310
+
311
+ 本项目为 AI 代码助手(如 Cursor、GitHub Copilot)提供了专门的知识库文档:
312
+
313
+ ### 📚 AI 知识库文件
314
+
315
+ | 文件 | 说明 | 使用场景 |
316
+ |------|------|----------|
317
+ | [AI_KNOWLEDGE_BASE.md](./AI_KNOWLEDGE_BASE.md) | 完整的组件库知识库 | 详细了解组件 API 和使用方法 |
318
+ | [QUICK_REFERENCE.md](./QUICK_REFERENCE.md) | 快速参考手册 | 快速查找组件用法和代码模板 |
319
+ | [AI_USAGE_GUIDE.md](./AI_USAGE_GUIDE.md) | AI 工具使用指南 | 了解如何在 AI 工具中使用知识库 |
320
+
321
+ ### 🚀 快速开始使用
322
+
323
+ #### 在 Cursor 中使用
324
+
325
+ 1. 打开项目根目录,Cursor 会自动读取 `.cursorrules` 文件
326
+ 2. 在对话中直接引用知识库文件:
327
+ ```
328
+ @AI_KNOWLEDGE_BASE.md 如何使用 JhTable 实现服务端分页?
329
+ ```
330
+
331
+ #### 在 GitHub Copilot 中使用
332
+
333
+ 1. 打开 `AI_KNOWLEDGE_BASE.md` 或 `QUICK_REFERENCE.md` 文件
334
+ 2. 开始编写代码,Copilot 会根据知识库提供更准确的建议
335
+
336
+ 详细使用方法请查看 [AI_USAGE_GUIDE.md](./AI_USAGE_GUIDE.md)
337
+
338
+ ---
339
+
340
+ ## 常见问题
341
+
342
+ ### Vuetify 样式不生效?
343
+
344
+ 确保在 HTML 的 `<head>` 中正确引入了 Vuetify CSS 和字体资源。
345
+
346
+ ### 组件无法显示?
347
+
348
+ 检查是否正确创建了 Vuetify 实例并传递给 Vue:
349
+
350
+ ```javascript
351
+ new Vue({
352
+ el: '#app',
353
+ vuetify: new Vuetify(),
354
+ // ...
355
+ });
356
+ ```
357
+
358
+ ### Storybook 启动失败?
359
+
360
+ 尝试删除 `node_modules` 和 `package-lock.json`,重新安装依赖:
361
+
362
+ ```bash
363
+ rm -rf node_modules package-lock.json
364
+ npm install
365
+ npm run storybook
366
+ ```
367
+
368
+ ## 更新日志
369
+
370
+ ### v1.0.0 (2025-01-19)
371
+
372
+ - 初始版本发布
373
+ - 基础组件:JhButton, JhCard
374
+ - 数据展示:JhTable
375
+ - 表单组件:JhForm
376
+ - Storybook 文档和示例