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,441 @@
1
+ # JhList 高级列表
2
+
3
+ 基于 Ant Design ProList 设计的高级列表组件,提供了丰富的数据展示和交互功能。
4
+
5
+ ## 特性
6
+
7
+ - 📋 **多种布局** - 支持列表、网格等多种布局方式
8
+ - 🎨 **灵活配置** - 通过 metas 配置快速定义数据展示
9
+ - 🔍 **搜索过滤** - 内置搜索功能,支持客户端和服务端搜索
10
+ - 📄 **分页支持** - 支持客户端和服务端分页
11
+ - ✅ **行选择** - 支持单选和多选
12
+ - 🎯 **操作按钮** - 灵活的操作按钮配置
13
+ - 🔄 **数据刷新** - 支持手动刷新和轮询
14
+ - 📱 **响应式** - 完美适配移动端
15
+ - 🎭 **自定义渲染** - 支持完全自定义列表项渲染
16
+
17
+ ## 基础用法
18
+
19
+ ```vue
20
+ <template>
21
+ <jh-list
22
+ :data-source="dataSource"
23
+ :metas="metas"
24
+ header-title="用户列表"
25
+ />
26
+ </template>
27
+
28
+ <script>
29
+ export default {
30
+ data() {
31
+ return {
32
+ dataSource: [
33
+ {
34
+ id: 1,
35
+ name: '张三',
36
+ email: 'zhangsan@example.com',
37
+ avatar: 'https://example.com/avatar1.jpg',
38
+ },
39
+ // ...
40
+ ],
41
+ metas: {
42
+ title: 'name',
43
+ description: 'email',
44
+ avatar: 'avatar',
45
+ },
46
+ };
47
+ },
48
+ };
49
+ </script>
50
+ ```
51
+
52
+ ## Metas 配置
53
+
54
+ Metas 用于定义列表项的数据映射关系:
55
+
56
+ ```javascript
57
+ {
58
+ // 标题
59
+ title: 'name', // 字符串:直接映射字段
60
+ // 或
61
+ title: { dataIndex: 'name' }, // 对象:使用 dataIndex
62
+ // 或
63
+ title: (item) => item.firstName + ' ' + item.lastName, // 函数:自定义处理
64
+
65
+ // 副标题
66
+ subTitle: 'role',
67
+
68
+ // 描述
69
+ description: 'email',
70
+
71
+ // 头像
72
+ avatar: 'avatarUrl',
73
+
74
+ // 额外内容
75
+ extra: 'status',
76
+
77
+ // 内容区
78
+ content: 'bio',
79
+
80
+ // 操作按钮
81
+ actions: (item) => [
82
+ { text: '编辑', icon: 'mdi-pencil', color: 'primary' },
83
+ { text: '删除', icon: 'mdi-delete', color: 'error' },
84
+ ],
85
+ }
86
+ ```
87
+
88
+ ## 网格布局
89
+
90
+ ```vue
91
+ <template>
92
+ <jh-list
93
+ :data-source="dataSource"
94
+ :metas="metas"
95
+ :grid="grid"
96
+ layout="grid"
97
+ header-title="项目列表"
98
+ />
99
+ </template>
100
+
101
+ <script>
102
+ export default {
103
+ data() {
104
+ return {
105
+ grid: {
106
+ column: 12, // 总列数
107
+ xs: 12, // 超小屏:1列
108
+ sm: 6, // 小屏:2列
109
+ md: 4, // 中屏:3列
110
+ lg: 3, // 大屏:4列
111
+ xl: 3, // 超大屏:4列
112
+ },
113
+ };
114
+ },
115
+ };
116
+ </script>
117
+ ```
118
+
119
+ ## 服务端分页
120
+
121
+ ```vue
122
+ <template>
123
+ <jh-list
124
+ :request="request"
125
+ :metas="metas"
126
+ header-title="用户列表"
127
+ />
128
+ </template>
129
+
130
+ <script>
131
+ export default {
132
+ data() {
133
+ return {
134
+ metas: {
135
+ title: 'name',
136
+ description: 'email',
137
+ avatar: 'avatar',
138
+ },
139
+ };
140
+ },
141
+ methods: {
142
+ async request(params) {
143
+ // params: { current, pageSize, search }
144
+ const response = await fetch('/api/users', {
145
+ method: 'POST',
146
+ body: JSON.stringify(params),
147
+ });
148
+ const data = await response.json();
149
+
150
+ return {
151
+ success: true,
152
+ data: data.list,
153
+ total: data.total,
154
+ };
155
+ },
156
+ },
157
+ };
158
+ </script>
159
+ ```
160
+
161
+ ## 行选择
162
+
163
+ ```vue
164
+ <template>
165
+ <jh-list
166
+ :data-source="dataSource"
167
+ :metas="metas"
168
+ :row-selection="rowSelection"
169
+ header-title="可选择列表"
170
+ >
171
+ <template #alert-actions="{ selectedRows }">
172
+ <v-btn small color="primary" @click="handleBatchEdit(selectedRows)">
173
+ 批量编辑
174
+ </v-btn>
175
+ <v-btn small color="error" @click="handleBatchDelete(selectedRows)">
176
+ 批量删除
177
+ </v-btn>
178
+ </template>
179
+ </jh-list>
180
+ </template>
181
+
182
+ <script>
183
+ export default {
184
+ data() {
185
+ return {
186
+ rowSelection: {
187
+ onChange: (selectedRowKeys, selectedRows) => {
188
+ console.log('选中的行:', selectedRowKeys, selectedRows);
189
+ },
190
+ },
191
+ };
192
+ },
193
+ methods: {
194
+ handleBatchEdit(rows) {
195
+ console.log('批量编辑:', rows);
196
+ },
197
+ handleBatchDelete(rows) {
198
+ console.log('批量删除:', rows);
199
+ },
200
+ },
201
+ };
202
+ </script>
203
+ ```
204
+
205
+ ## 自定义渲染
206
+
207
+ ```vue
208
+ <template>
209
+ <jh-list
210
+ :data-source="dataSource"
211
+ :metas="metas"
212
+ header-title="自定义列表"
213
+ >
214
+ <template #renderItem="{ item, index }">
215
+ <v-card class="pa-4">
216
+ <div class="d-flex align-center">
217
+ <v-avatar size="60" color="primary">
218
+ <span class="white--text">{{ index + 1 }}</span>
219
+ </v-avatar>
220
+ <div class="ml-4 flex-grow-1">
221
+ <div class="text-h6">{{ item.title }}</div>
222
+ <div class="text-body-2 grey--text">{{ item.description }}</div>
223
+ </div>
224
+ <v-chip :color="item.status === 'active' ? 'success' : 'grey'">
225
+ {{ item.status }}
226
+ </v-chip>
227
+ </div>
228
+ </v-card>
229
+ </template>
230
+ </jh-list>
231
+ </template>
232
+ ```
233
+
234
+ ## 插槽自定义
235
+
236
+ ```vue
237
+ <template>
238
+ <jh-list
239
+ :data-source="dataSource"
240
+ :metas="metas"
241
+ header-title="项目列表"
242
+ >
243
+ <!-- 自定义标题 -->
244
+ <template #title="{ item }">
245
+ <span style="color: #1890ff; font-weight: bold;">{{ item.name }}</span>
246
+ </template>
247
+
248
+ <!-- 自定义描述 -->
249
+ <template #description="{ item }">
250
+ <div>
251
+ <v-chip x-small>{{ item.category }}</v-chip>
252
+ <span class="ml-2">{{ item.description }}</span>
253
+ </div>
254
+ </template>
255
+
256
+ <!-- 自定义额外内容 -->
257
+ <template #extra="{ item }">
258
+ <div style="text-align: right;">
259
+ <div style="font-size: 20px; font-weight: bold;">{{ item.progress }}%</div>
260
+ <v-progress-linear :value="item.progress" height="4" class="mt-1" />
261
+ </div>
262
+ </template>
263
+
264
+ <!-- 自定义操作按钮 -->
265
+ <template #actions="{ item }">
266
+ <v-btn text x-small color="primary" @click="handleView(item)">查看</v-btn>
267
+ <v-btn text x-small color="success" @click="handleEdit(item)">编辑</v-btn>
268
+ <v-btn text x-small color="error" @click="handleDelete(item)">删除</v-btn>
269
+ </template>
270
+
271
+ <!-- 工具栏左侧按钮 -->
272
+ <template #toolbar-actions>
273
+ <v-btn color="success" small>
274
+ <v-icon left small>mdi-plus</v-icon>
275
+ 新增项目
276
+ </v-btn>
277
+ </template>
278
+
279
+ <!-- 工具栏右侧额外内容 -->
280
+ <template #toolbar-extra>
281
+ <v-btn icon small>
282
+ <v-icon>mdi-filter</v-icon>
283
+ </v-btn>
284
+ <v-btn icon small>
285
+ <v-icon>mdi-download</v-icon>
286
+ </v-btn>
287
+ </template>
288
+ </jh-list>
289
+ </template>
290
+ ```
291
+
292
+ ## API
293
+
294
+ ### Props
295
+
296
+ | 参数 | 说明 | 类型 | 默认值 |
297
+ |------|------|------|--------|
298
+ | dataSource | 数据源(客户端分页) | Array | [] |
299
+ | request | 数据请求函数(服务端分页) | Function | null |
300
+ | rowKey | 数据项的唯一标识字段 | String \| Function | 'id' |
301
+ | metas | 列表项元数据配置 | Object | {} |
302
+ | layout | 布局类型 | 'list' \| 'grid' \| 'card' | 'list' |
303
+ | grid | 网格配置 | Object | null |
304
+ | size | 列表尺寸 | 'small' \| 'default' \| 'large' | 'default' |
305
+ | split | 是否显示分割线 | Boolean | true |
306
+ | pagination | 分页配置 | Object \| Boolean | { current: 1, pageSize: 10 } |
307
+ | rowSelection | 行选择配置 | Object \| Boolean | null |
308
+ | checkboxColor | 复选框颜色 | String | 'primary' |
309
+ | expandable | 展开配置 | Object \| Boolean | null |
310
+ | headerTitle | 列表标题 | String | '' |
311
+ | tooltip | 标题提示信息 | String | '' |
312
+ | cardBordered | 是否显示卡片边框 | Boolean | true |
313
+ | ghost | 幽灵模式(无边框无背景) | Boolean | false |
314
+ | toolbar | 工具栏配置 | Object \| Boolean | { search: true, refresh: true, layout: true, size: true } |
315
+ | search | 搜索配置 | Object \| Boolean | false |
316
+ | loading | 加载状态 | Boolean | false |
317
+ | polling | 轮询间隔(毫秒) | Number | 0 |
318
+ | debounceTime | 搜索防抖时间(毫秒) | Number | 300 |
319
+
320
+ ### Metas 配置
321
+
322
+ | 参数 | 说明 | 类型 |
323
+ |------|------|------|
324
+ | title | 标题 | String \| Object \| Function |
325
+ | subTitle | 副标题 | String \| Object \| Function |
326
+ | description | 描述 | String \| Object \| Function |
327
+ | avatar | 头像 | String \| Object \| Function |
328
+ | content | 内容区 | String \| Object \| Function |
329
+ | extra | 额外内容 | String \| Object \| Function |
330
+ | actions | 操作按钮 | String \| Object \| Function |
331
+
332
+ ### Grid 配置
333
+
334
+ | 参数 | 说明 | 类型 | 默认值 |
335
+ |------|------|------|--------|
336
+ | column | 总列数 | Number | 12 |
337
+ | xs | 超小屏列数 | Number | - |
338
+ | sm | 小屏列数 | Number | - |
339
+ | md | 中屏列数 | Number | - |
340
+ | lg | 大屏列数 | Number | - |
341
+ | xl | 超大屏列数 | Number | - |
342
+
343
+ ### Events
344
+
345
+ | 事件名 | 说明 | 回调参数 |
346
+ |--------|------|----------|
347
+ | item-click | 列表项点击 | (item, index) |
348
+ | action-click | 操作按钮点击 | (action, item) |
349
+ | selection-change | 选择改变 | ({ selectedRowKeys, selectedRows }) |
350
+ | page-change | 页码改变 | (page) |
351
+ | page-size-change | 每页条数改变 | (pageSize) |
352
+ | refresh | 刷新 | - |
353
+ | request-error | 请求错误 | (error) |
354
+
355
+ ### Slots
356
+
357
+ | 插槽名 | 说明 | 参数 |
358
+ |--------|------|------|
359
+ | header-title | 自定义标题 | - |
360
+ | toolbar-actions | 工具栏左侧操作按钮 | - |
361
+ | toolbar-extra | 工具栏右侧额外内容 | - |
362
+ | alert | 自定义批量操作提示 | { selectedRowKeys, selectedRows } |
363
+ | alert-actions | 批量操作按钮 | { selectedRowKeys, selectedRows } |
364
+ | renderItem | 自定义列表项渲染 | { item, index } |
365
+ | title | 自定义标题 | { item } |
366
+ | subTitle | 自定义副标题 | { item } |
367
+ | description | 自定义描述 | { item } |
368
+ | content | 自定义内容区 | { item } |
369
+ | extra | 自定义额外内容 | { item } |
370
+ | actions | 自定义操作按钮 | { item } |
371
+ | expandedRowRender | 自定义展开内容 | { item, index } |
372
+
373
+ ## 高级用法
374
+
375
+ ### 轮询
376
+
377
+ ```vue
378
+ <jh-list
379
+ :request="request"
380
+ :metas="metas"
381
+ :polling="5000"
382
+ header-title="实时监控列表"
383
+ />
384
+ ```
385
+
386
+ ### 搜索防抖
387
+
388
+ ```vue
389
+ <jh-list
390
+ :request="request"
391
+ :metas="metas"
392
+ :debounce-time="500"
393
+ header-title="搜索列表"
394
+ />
395
+ ```
396
+
397
+ ### 不同尺寸
398
+
399
+ ```vue
400
+ <!-- 小尺寸 -->
401
+ <jh-list :data-source="dataSource" :metas="metas" size="small" />
402
+
403
+ <!-- 默认尺寸 -->
404
+ <jh-list :data-source="dataSource" :metas="metas" size="default" />
405
+
406
+ <!-- 大尺寸 -->
407
+ <jh-list :data-source="dataSource" :metas="metas" size="large" />
408
+ ```
409
+
410
+ ### 幽灵模式
411
+
412
+ ```vue
413
+ <jh-list
414
+ :data-source="dataSource"
415
+ :metas="metas"
416
+ ghost
417
+ header-title="幽灵模式列表"
418
+ />
419
+ ```
420
+
421
+ ## 最佳实践
422
+
423
+ 1. **使用 metas 配置** - 优先使用 metas 配置来定义数据映射,保持代码简洁
424
+ 2. **服务端分页** - 大数据量时使用 request 函数实现服务端分页
425
+ 3. **合理使用插槽** - 对于复杂的自定义需求,使用插槽而不是完全自定义渲染
426
+ 4. **响应式布局** - 使用 grid 配置实现响应式网格布局
427
+ 5. **防抖优化** - 搜索功能使用 debounceTime 避免频繁请求
428
+
429
+ ## 注意事项
430
+
431
+ - `dataSource` 和 `request` 二选一,优先使用 `request`
432
+ - 使用 `rowKey` 确保每个列表项有唯一标识
433
+ - 网格布局需要配置 `grid` 属性并设置 `layout="grid"`
434
+ - 自定义渲染时注意保持样式一致性
435
+
436
+ ## 与 JhTable 的区别
437
+
438
+ - **JhList** 适合卡片式、图文混排的数据展示
439
+ - **JhTable** 适合表格式、结构化的数据展示
440
+ - JhList 基于 ProTable 实现,支持大部分 ProTable 的 API
441
+ - 两者可以通过配置轻松切换