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,492 @@
1
+ import JhDrawerForm from './JhDrawerForm.vue';
2
+
3
+ // 示例字段配置
4
+ const sampleFields = [
5
+ {
6
+ key: 'username',
7
+ label: '用户名',
8
+ type: 'text',
9
+ rules: 'require',
10
+ placeholder: '请输入用户名',
11
+ cols: 12,
12
+ },
13
+ {
14
+ key: 'email',
15
+ label: '邮箱',
16
+ type: 'text',
17
+ rules: 'require|email',
18
+ placeholder: '请输入邮箱',
19
+ cols: 12,
20
+ },
21
+ {
22
+ key: 'phone',
23
+ label: '手机号',
24
+ type: 'text',
25
+ rules: 'phone',
26
+ placeholder: '请输入手机号',
27
+ cols: 12,
28
+ },
29
+ {
30
+ key: 'role',
31
+ label: '角色',
32
+ type: 'select',
33
+ rules: 'require',
34
+ options: [
35
+ { text: '管理员', value: 'admin' },
36
+ { text: '普通用户', value: 'user' },
37
+ { text: '访客', value: 'guest' },
38
+ ],
39
+ cols: 12,
40
+ },
41
+ {
42
+ key: 'remark',
43
+ label: '备注',
44
+ type: 'textarea',
45
+ placeholder: '请输入备注',
46
+ rows: 3,
47
+ cols: 12,
48
+ },
49
+ ];
50
+
51
+ export default {
52
+ title: '数据录入/JhDrawerForm - 抽屉表单',
53
+ component: JhDrawerForm,
54
+ tags: ['autodocs'],
55
+ argTypes: {
56
+ value: {
57
+ control: 'boolean',
58
+ description: '控制抽屉显示/隐藏 (v-model)',
59
+ },
60
+ title: {
61
+ control: 'text',
62
+ description: '抽屉标题',
63
+ },
64
+ position: {
65
+ control: 'select',
66
+ options: ['left', 'right'],
67
+ description: '抽屉位置',
68
+ },
69
+ width: {
70
+ control: 'text',
71
+ description: '抽屉宽度',
72
+ },
73
+ showConfirmButton: {
74
+ control: 'boolean',
75
+ description: '是否显示确认按钮',
76
+ },
77
+ confirmText: {
78
+ control: 'text',
79
+ description: '确认按钮文本',
80
+ },
81
+ cancelText: {
82
+ control: 'text',
83
+ description: '取消按钮文本',
84
+ },
85
+ validateBeforeConfirm: {
86
+ control: 'boolean',
87
+ description: '确认前是否验证表单',
88
+ },
89
+ },
90
+ parameters: {
91
+ docs: {
92
+ description: {
93
+ component: `
94
+
95
+ 抽屉表单组件,支持 JSON 配置和自定义内容。基于 JhDrawerFormBasic 重写,移除了 JhProForm 依赖。
96
+
97
+ ## 功能特性
98
+
99
+ - JSON 配置表单字段
100
+ - 支持多种字段类型(text、textarea、number、select、autocomplete、date、time、switch、checkbox、radio)
101
+ - 表单验证
102
+ - 自定义插槽
103
+ - 左右两侧位置
104
+ - 响应式宽度
105
+
106
+ ## 支持的字段类型
107
+
108
+ - \`text\`: 文本输入框
109
+ - \`textarea\`: 多行文本
110
+ - \`number\`: 数字输入框
111
+ - \`select\`: 下拉选择框
112
+ - \`autocomplete\`: 自动完成
113
+ - \`date\`: 日期选择器
114
+ - \`time\`: 时间选择器
115
+ - \`switch\`: 开关
116
+ - \`checkbox\`: 复选框
117
+ - \`radio\`: 单选按钮组
118
+ - \`slot\`: 自定义插槽
119
+
120
+ ## 事件
121
+
122
+ - \`confirm\`: 点击确认按钮时触发,参数为表单数据
123
+ - \`cancel\`: 点击取消按钮时触发
124
+ - \`close\`: 抽屉关闭时触发
125
+ - \`input\`: v-model 绑定值变化时触发
126
+
127
+ ## 插槽
128
+
129
+ - \`content\`: 自定义抽屉内容(完全自定义)
130
+ - \`actions\`: 自定义操作按钮
131
+ - \`field-{key}\`: 自定义字段(当字段类型为 slot 时)
132
+
133
+ ## 方法
134
+
135
+ - \`getForm()\`: 获取表单引用
136
+ - \`getFormData()\`: 获取表单数据
137
+ - \`setFieldsValue(values)\`: 设置表单数据
138
+ - \`resetForm()\`: 重置表单
139
+ - \`resetValidation()\`: 重置验证状态
140
+ - \`validate()\`: 验证表单
141
+ `,
142
+ },
143
+ },
144
+ },
145
+ };
146
+
147
+ // 基础示例
148
+ export const 基础示例 = {
149
+ render: () => ({
150
+ components: { JhDrawerForm },
151
+ data() {
152
+ return {
153
+ visible: false,
154
+ fields: sampleFields,
155
+ };
156
+ },
157
+ template: `
158
+ <div>
159
+ <v-btn color="primary" @click="visible = true">
160
+ 打开抽屉表单
161
+ </v-btn>
162
+ <jh-drawer-form
163
+ v-model="visible"
164
+ title="用户信息"
165
+ :fields="fields"
166
+ @confirm="handleConfirm"
167
+ @cancel="handleCancel"
168
+ />
169
+ </div>
170
+ `,
171
+ methods: {
172
+ handleConfirm(data) {
173
+ console.log('表单数据:', data);
174
+ alert('提交成功!\n' + JSON.stringify(data, null, 2));
175
+ this.visible = false;
176
+ },
177
+ handleCancel() {
178
+ console.log('取消操作');
179
+ },
180
+ },
181
+ }),
182
+ };
183
+
184
+ // 左侧抽屉
185
+ export const 左侧抽屉 = {
186
+ render: () => ({
187
+ components: { JhDrawerForm },
188
+ data() {
189
+ return {
190
+ visible: false,
191
+ fields: [
192
+ {
193
+ key: 'keyword',
194
+ label: '关键词',
195
+ type: 'text',
196
+ placeholder: '请输入搜索关键词',
197
+ cols: 12,
198
+ },
199
+ {
200
+ key: 'category',
201
+ label: '分类',
202
+ type: 'select',
203
+ options: [
204
+ { text: '全部', value: '' },
205
+ { text: '电子产品', value: 'electronics' },
206
+ { text: '服装鞋包', value: 'clothing' },
207
+ ],
208
+ cols: 12,
209
+ },
210
+ ],
211
+ };
212
+ },
213
+ template: `
214
+ <div>
215
+ <v-btn color="primary" @click="visible = true">
216
+ 打开左侧筛选
217
+ </v-btn>
218
+ <jh-drawer-form
219
+ v-model="visible"
220
+ title="筛选条件"
221
+ position="left"
222
+ width="400px"
223
+ :fields="fields"
224
+ confirm-text="应用"
225
+ @confirm="handleConfirm"
226
+ />
227
+ </div>
228
+ `,
229
+ methods: {
230
+ handleConfirm(data) {
231
+ console.log('筛选条件:', data);
232
+ alert('应用筛选成功!');
233
+ this.visible = false;
234
+ },
235
+ },
236
+ }),
237
+ };
238
+
239
+ // 自定义内容
240
+ export const 自定义内容 = {
241
+ render: () => ({
242
+ components: { JhDrawerForm },
243
+ data() {
244
+ return {
245
+ visible: false,
246
+ customData: {
247
+ title: '',
248
+ content: '',
249
+ },
250
+ };
251
+ },
252
+ template: `
253
+ <div>
254
+ <v-btn color="primary" @click="visible = true">
255
+ 打开自定义内容抽屉
256
+ </v-btn>
257
+ <jh-drawer-form
258
+ v-model="visible"
259
+ title="自定义表单"
260
+ width="600px"
261
+ >
262
+ <template #content>
263
+ <div class="pa-4">
264
+ <v-text-field
265
+ v-model="customData.title"
266
+ label="标题"
267
+ outlined
268
+ dense
269
+ />
270
+ <v-textarea
271
+ v-model="customData.content"
272
+ label="内容"
273
+ outlined
274
+ dense
275
+ rows="5"
276
+ />
277
+ </div>
278
+ </template>
279
+ <template #actions>
280
+ <v-btn
281
+ color="success"
282
+ small
283
+ @click="handleSave"
284
+ >
285
+ 保存
286
+ </v-btn>
287
+ </template>
288
+ </jh-drawer-form>
289
+ </div>
290
+ `,
291
+ methods: {
292
+ handleSave() {
293
+ console.log('保存数据:', this.customData);
294
+ alert('保存成功!');
295
+ this.visible = false;
296
+ },
297
+ },
298
+ }),
299
+ };
300
+
301
+ // 复杂表单
302
+ export const 复杂表单 = {
303
+ render: () => ({
304
+ components: { JhDrawerForm },
305
+ data() {
306
+ return {
307
+ visible: false,
308
+ fields: [
309
+ {
310
+ key: 'name',
311
+ label: '姓名',
312
+ type: 'text',
313
+ rules: 'require',
314
+ placeholder: '请输入姓名',
315
+ cols: 12,
316
+ md: 6,
317
+ },
318
+ {
319
+ key: 'gender',
320
+ label: '性别',
321
+ type: 'radio',
322
+ options: [
323
+ { text: '男', value: 'male' },
324
+ { text: '女', value: 'female' },
325
+ ],
326
+ cols: 12,
327
+ md: 6,
328
+ },
329
+ {
330
+ key: 'birthdate',
331
+ label: '出生日期',
332
+ type: 'date',
333
+ cols: 12,
334
+ md: 6,
335
+ },
336
+ {
337
+ key: 'skills',
338
+ label: '技能',
339
+ type: 'select',
340
+ multiple: true,
341
+ chips: true,
342
+ options: [
343
+ { text: 'Vue.js', value: 'vue' },
344
+ { text: 'React', value: 'react' },
345
+ { text: 'Node.js', value: 'node' },
346
+ ],
347
+ cols: 12,
348
+ },
349
+ {
350
+ key: 'active',
351
+ label: '启用状态',
352
+ type: 'switch',
353
+ switchLabel: '启用',
354
+ cols: 12,
355
+ },
356
+ {
357
+ key: 'bio',
358
+ label: '个人简介',
359
+ type: 'textarea',
360
+ rows: 4,
361
+ placeholder: '请输入个人简介',
362
+ cols: 12,
363
+ },
364
+ ],
365
+ };
366
+ },
367
+ template: `
368
+ <div>
369
+ <v-btn color="primary" @click="visible = true">
370
+ 打开复杂表单
371
+ </v-btn>
372
+ <jh-drawer-form
373
+ v-model="visible"
374
+ title="员工信息"
375
+ width="800px"
376
+ :fields="fields"
377
+ @confirm="handleConfirm"
378
+ />
379
+ </div>
380
+ `,
381
+ methods: {
382
+ handleConfirm(data) {
383
+ console.log('表单数据:', data);
384
+ alert('提交成功!');
385
+ this.visible = false;
386
+ },
387
+ },
388
+ }),
389
+ };
390
+
391
+ // 编辑模式
392
+ export const 编辑模式 = {
393
+ render: () => ({
394
+ components: { JhDrawerForm },
395
+ data() {
396
+ return {
397
+ visible: false,
398
+ fields: sampleFields,
399
+ };
400
+ },
401
+ template: `
402
+ <div>
403
+ <v-btn color="primary" @click="openDrawer">
404
+ 编辑用户
405
+ </v-btn>
406
+ <jh-drawer-form
407
+ ref="drawerForm"
408
+ v-model="visible"
409
+ title="编辑用户"
410
+ :fields="fields"
411
+ @confirm="handleConfirm"
412
+ />
413
+ </div>
414
+ `,
415
+ methods: {
416
+ openDrawer() {
417
+ this.visible = true;
418
+ // 等待抽屉打开后设置数据
419
+ this.$nextTick(() => {
420
+ this.$refs.drawerForm.setFieldsValue({
421
+ username: 'zhangsan',
422
+ email: 'zhangsan@example.com',
423
+ phone: '13800138000',
424
+ role: 'admin',
425
+ remark: '这是一个测试用户',
426
+ });
427
+ });
428
+ },
429
+ handleConfirm(data) {
430
+ console.log('更新数据:', data);
431
+ alert('更新成功!');
432
+ this.visible = false;
433
+ },
434
+ },
435
+ }),
436
+ };
437
+
438
+ // 自定义验证
439
+ export const 自定义验证 = {
440
+ render: () => ({
441
+ components: { JhDrawerForm },
442
+ data() {
443
+ return {
444
+ visible: false,
445
+ fields: [
446
+ {
447
+ key: 'username',
448
+ label: '用户名',
449
+ type: 'text',
450
+ rules: [
451
+ v => !!v || '用户名不能为空',
452
+ v => (v && v.length >= 3) || '用户名至少3个字符',
453
+ ],
454
+ placeholder: '请输入用户名(至少3个字符)',
455
+ cols: 12,
456
+ },
457
+ {
458
+ key: 'age',
459
+ label: '年龄',
460
+ type: 'number',
461
+ rules: [
462
+ v => !!v || '年龄不能为空',
463
+ v => (v >= 18 && v <= 60) || '年龄必须在18-60之间',
464
+ ],
465
+ placeholder: '请输入年龄',
466
+ cols: 12,
467
+ },
468
+ ],
469
+ };
470
+ },
471
+ template: `
472
+ <div>
473
+ <v-btn color="primary" @click="visible = true">
474
+ 打开表单(自定义验证)
475
+ </v-btn>
476
+ <jh-drawer-form
477
+ v-model="visible"
478
+ title="用户注册"
479
+ :fields="fields"
480
+ @confirm="handleConfirm"
481
+ />
482
+ </div>
483
+ `,
484
+ methods: {
485
+ handleConfirm(data) {
486
+ console.log('表单数据:', data);
487
+ alert('注册成功!');
488
+ this.visible = false;
489
+ },
490
+ },
491
+ }),
492
+ };