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,391 @@
1
+ import JhTreeSelect from './JhTreeSelect.vue';
2
+
3
+ // 示例树形数据
4
+ const sampleTreeData = [
5
+ {
6
+ id: '1',
7
+ label: '技术部',
8
+ children: [
9
+ {
10
+ id: '1-1',
11
+ label: '前端组',
12
+ children: [
13
+ { id: '1-1-1', label: 'Vue开发组' },
14
+ { id: '1-1-2', label: 'React开发组' },
15
+ ]
16
+ },
17
+ {
18
+ id: '1-2',
19
+ label: '后端组',
20
+ children: [
21
+ { id: '1-2-1', label: 'Java开发组' },
22
+ { id: '1-2-2', label: 'Node.js开发组' },
23
+ ]
24
+ },
25
+ { id: '1-3', label: '测试组' },
26
+ ]
27
+ },
28
+ {
29
+ id: '2',
30
+ label: '产品部',
31
+ children: [
32
+ { id: '2-1', label: '产品设计' },
33
+ { id: '2-2', label: '用户体验' },
34
+ ]
35
+ },
36
+ {
37
+ id: '3',
38
+ label: '运营部',
39
+ children: [
40
+ { id: '3-1', label: '内容运营' },
41
+ { id: '3-2', label: '活动运营' },
42
+ { id: '3-3', label: '用户运营' },
43
+ ]
44
+ },
45
+ {
46
+ id: '4',
47
+ label: '市场部',
48
+ children: [
49
+ { id: '4-1', label: '市场推广' },
50
+ { id: '4-2', label: '品牌营销' },
51
+ ]
52
+ }
53
+ ];
54
+
55
+ // 扁平化树形数据(用于全选功能测试)
56
+ const flatTreeData = [
57
+ { id: '1', label: '节点1' },
58
+ { id: '2', label: '节点2' },
59
+ { id: '3', label: '节点3' },
60
+ { id: '4', label: '节点4' },
61
+ { id: '5', label: '节点5' },
62
+ ];
63
+
64
+ export default {
65
+ title: '基础组件/JhTreeSelect - 树形选择',
66
+ component: JhTreeSelect,
67
+ tags: ['autodocs'],
68
+ argTypes: {
69
+ value: {
70
+ control: 'object',
71
+ description: 'v-model 绑定的已选节点列表',
72
+ },
73
+ visible: {
74
+ control: 'boolean',
75
+ description: '是否显示对话框',
76
+ },
77
+ mode: {
78
+ control: { type: 'select' },
79
+ options: ['multiple', 'single'],
80
+ description: '选择模式:multiple(多选) 或 single(单选)',
81
+ },
82
+ title: {
83
+ control: 'text',
84
+ description: '对话框标题',
85
+ },
86
+ placeholder: {
87
+ control: 'text',
88
+ description: '搜索框占位符',
89
+ },
90
+ maxWidth: {
91
+ control: 'text',
92
+ description: '对话框最大宽度',
93
+ },
94
+ data: {
95
+ control: 'object',
96
+ description: '树形数据数组',
97
+ },
98
+ nodeKey: {
99
+ control: 'text',
100
+ description: '节点唯一标识字段名',
101
+ },
102
+ nodeLabel: {
103
+ control: 'text',
104
+ description: '节点显示文本字段名',
105
+ },
106
+ nodeChildren: {
107
+ control: 'text',
108
+ description: '子节点字段名',
109
+ },
110
+ allowSelectNode: {
111
+ control: 'boolean',
112
+ description: '是否允许选择节点本身',
113
+ },
114
+ showSearch: {
115
+ control: 'boolean',
116
+ description: '是否显示搜索框',
117
+ },
118
+ showSelectAll: {
119
+ control: 'boolean',
120
+ description: '是否显示全选按钮(仅多选模式)',
121
+ },
122
+ loading: {
123
+ control: 'boolean',
124
+ description: '是否显示加载状态',
125
+ },
126
+ onInput: { action: 'input' },
127
+ onConfirm: { action: 'confirm' },
128
+ onCancel: { action: 'cancel' },
129
+ onUpdateVisible: { action: 'update:visible' },
130
+ },
131
+ parameters: {
132
+ docs: {
133
+ description: {
134
+ component: `
135
+
136
+ 通用的树形选择组件,支持单选和多选模式。
137
+
138
+ ## 功能特性
139
+
140
+ - ✅ 支持单选和多选模式
141
+ - ✅ 支持搜索过滤
142
+ - ✅ 支持展开/折叠节点
143
+ - ✅ 支持选择节点本身(可选)
144
+ - ✅ 支持全选功能(多选模式)
145
+ - ✅ 响应式设计(移动端适配)
146
+ - ✅ 自定义节点字段映射
147
+
148
+ ## 数据结构
149
+
150
+ \`\`\`javascript
151
+ // 树形节点数据结构
152
+ {
153
+ id: String, // 节点唯一标识(可通过 nodeKey 自定义)
154
+ label: String, // 节点显示文本(可通过 nodeLabel 自定义)
155
+ children: Array, // 子节点数组(可通过 nodeChildren 自定义)
156
+ [其他自定义字段]
157
+ }
158
+ \`\`\`
159
+
160
+ ## 使用示例
161
+
162
+ \`\`\`vue
163
+ <jh-tree-select
164
+ v-model="selectedNodes"
165
+ :visible.sync="isDialogShown"
166
+ :data="treeData"
167
+ mode="multiple"
168
+ title="选择节点"
169
+ @confirm="handleConfirm"
170
+ />
171
+ \`\`\`
172
+
173
+ ## 事件
174
+
175
+ - \`@input\` - v-model 更新事件,参数为选中的节点数组
176
+ - \`@confirm\` - 确认选择事件,参数为选中的节点数组
177
+ - \`@cancel\` - 取消选择事件
178
+ - \`@update:visible\` - 显示状态更新事件
179
+ `,
180
+ },
181
+ },
182
+ },
183
+ };
184
+
185
+ // 基础示例 - 多选模式
186
+ export const 多选模式 = {
187
+ args: {
188
+ value: [],
189
+ visible: true,
190
+ mode: 'multiple',
191
+ title: '选择节点(多选)',
192
+ placeholder: '搜索节点',
193
+ maxWidth: '1000px',
194
+ data: sampleTreeData,
195
+ nodeKey: 'id',
196
+ nodeLabel: 'label',
197
+ nodeChildren: 'children',
198
+ allowSelectNode: false,
199
+ showSearch: true,
200
+ showSelectAll: true,
201
+ loading: false,
202
+ },
203
+ render: (args) => ({
204
+ components: { JhTreeSelect },
205
+ data() {
206
+ return {
207
+ selectedNodes: args.value || [],
208
+ isDialogShown: args.visible,
209
+ args
210
+ };
211
+ },
212
+ watch: {
213
+ 'args.visible'(val) {
214
+ this.isDialogShown = val;
215
+ }
216
+ },
217
+ template: `
218
+ <div>
219
+ <v-btn color="primary" @click="isDialogShown = true">打开树形选择</v-btn>
220
+ <jh-tree-select
221
+ v-model="selectedNodes"
222
+ :visible.sync="isDialogShown"
223
+ :mode="args.mode"
224
+ :title="args.title"
225
+ :placeholder="args.placeholder"
226
+ :max-width="args.maxWidth"
227
+ :data="args.data"
228
+ :node-key="args.nodeKey"
229
+ :node-label="args.nodeLabel"
230
+ :node-children="args.nodeChildren"
231
+ :allow-select-node="args.allowSelectNode"
232
+ :show-search="args.showSearch"
233
+ :show-select-all="args.showSelectAll"
234
+ :loading="args.loading"
235
+ @confirm="handleConfirm"
236
+ @cancel="handleCancel"
237
+ />
238
+ <v-container class="mt-4">
239
+ <v-card>
240
+ <v-card-title>已选节点</v-card-title>
241
+ <v-card-text>
242
+ <div v-if="selectedNodes.length === 0" class="grey--text">
243
+ 暂无选中节点
244
+ </div>
245
+ <v-chip
246
+ v-for="node in selectedNodes"
247
+ :key="node.id"
248
+ class="ma-1"
249
+ small
250
+ >
251
+ {{ node.label }}
252
+ </v-chip>
253
+ </v-card-text>
254
+ </v-card>
255
+ </v-container>
256
+ </div>
257
+ `,
258
+ methods: {
259
+ handleConfirm(nodes) {
260
+ console.log('确认选择:', nodes);
261
+ this.selectedNodes = nodes;
262
+ },
263
+ handleCancel() {
264
+ console.log('取消选择');
265
+ }
266
+ }
267
+ }),
268
+ };
269
+
270
+ // 单选模式
271
+ export const 单选模式 = {
272
+ args: {
273
+ ...多选模式.args,
274
+ mode: 'single',
275
+ title: '选择节点(单选)',
276
+ showSelectAll: false,
277
+ },
278
+ render: 多选模式.render,
279
+ };
280
+
281
+ // 允许选择节点本身
282
+ export const 允许选择节点 = {
283
+ args: {
284
+ ...多选模式.args,
285
+ allowSelectNode: true,
286
+ title: '选择节点(可选择节点本身)',
287
+ },
288
+ render: 多选模式.render,
289
+ };
290
+
291
+ // 无搜索框
292
+ export const 无搜索框 = {
293
+ args: {
294
+ ...多选模式.args,
295
+ showSearch: false,
296
+ title: '选择节点(无搜索)',
297
+ },
298
+ render: 多选模式.render,
299
+ };
300
+
301
+ // 无全选按钮
302
+ export const 无全选按钮 = {
303
+ args: {
304
+ ...多选模式.args,
305
+ showSelectAll: false,
306
+ title: '选择节点(无全选)',
307
+ },
308
+ render: 多选模式.render,
309
+ };
310
+
311
+ // 扁平化数据
312
+ export const 扁平化数据 = {
313
+ args: {
314
+ ...多选模式.args,
315
+ data: flatTreeData,
316
+ title: '选择节点(扁平化数据)',
317
+ },
318
+ render: 多选模式.render,
319
+ };
320
+
321
+ // 加载状态
322
+ export const 加载状态 = {
323
+ args: {
324
+ ...多选模式.args,
325
+ loading: true,
326
+ title: '选择节点(加载中)',
327
+ },
328
+ render: 多选模式.render,
329
+ };
330
+
331
+ // 自定义字段映射
332
+ export const 自定义字段映射 = {
333
+ args: {
334
+ ...多选模式.args,
335
+ data: [
336
+ {
337
+ code: 'A',
338
+ name: '部门A',
339
+ items: [
340
+ { code: 'A-1', name: '小组A1' },
341
+ { code: 'A-2', name: '小组A2' },
342
+ ]
343
+ },
344
+ {
345
+ code: 'B',
346
+ name: '部门B',
347
+ items: [
348
+ { code: 'B-1', name: '小组B1' },
349
+ ]
350
+ }
351
+ ],
352
+ nodeKey: 'code',
353
+ nodeLabel: 'name',
354
+ nodeChildren: 'items',
355
+ title: '选择节点(自定义字段)',
356
+ },
357
+ render: 多选模式.render,
358
+ };
359
+
360
+ // 大型树形数据
361
+ export const 大型树形数据 = {
362
+ args: {
363
+ ...多选模式.args,
364
+ data: (() => {
365
+ const generateTree = (depth, breadth, prefix = '') => {
366
+ if (depth === 0) return null;
367
+ const nodes = [];
368
+ for (let i = 1; i <= breadth; i++) {
369
+ const id = prefix ? `${prefix}-${i}` : `${i}`;
370
+ const node = {
371
+ id,
372
+ label: `节点${id}`,
373
+ children: []
374
+ };
375
+ if (depth > 1) {
376
+ const children = generateTree(depth - 1, breadth, id);
377
+ if (children) node.children = children;
378
+ }
379
+ nodes.push(node);
380
+ }
381
+ return nodes;
382
+ };
383
+ return generateTree(4, 3);
384
+ })(),
385
+ title: '选择节点(大型树形数据)',
386
+ },
387
+ render: 多选模式.render,
388
+ };
389
+
390
+
391
+