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,459 @@
1
+ <template>
2
+ <div :class="cardClasses" :style="cardStyles">
3
+ <!-- 标题区域 -->
4
+ <div v-if="title || $slots.title" class="jh-statistic-card-header">
5
+ <slot name="title">
6
+ <div class="jh-statistic-card-title">{{ title }}</div>
7
+ </slot>
8
+ <div v-if="tooltip" class="jh-statistic-card-tooltip">
9
+ <v-tooltip bottom>
10
+ <template v-slot:activator="{ on, attrs }">
11
+ <v-icon small v-bind="attrs" v-on="on">mdi-help-circle-outline</v-icon>
12
+ </template>
13
+ <span>{{ tooltip }}</span>
14
+ </v-tooltip>
15
+ </div>
16
+ </div>
17
+
18
+ <!-- 主要内容区域 -->
19
+ <div class="jh-statistic-card-content">
20
+ <!-- 左侧统计数据 -->
21
+ <div class="jh-statistic-card-statistic">
22
+ <!-- 数值 -->
23
+ <div class="jh-statistic-card-value-wrapper">
24
+ <span v-if="prefix" class="jh-statistic-card-prefix">{{ prefix }}</span>
25
+ <span :class="valueClasses" :style="valueStyles">
26
+ <slot name="value">{{ formattedValue }}</slot>
27
+ </span>
28
+ <span v-if="suffix" class="jh-statistic-card-suffix">{{ suffix }}</span>
29
+ </div>
30
+
31
+ <!-- 趋势指标 -->
32
+ <div v-if="trend || $slots.trend" class="jh-statistic-card-trend">
33
+ <slot name="trend">
34
+ <v-icon
35
+ small
36
+ :color="trendColor"
37
+ class="jh-statistic-card-trend-icon"
38
+ >
39
+ {{ trendIcon }}
40
+ </v-icon>
41
+ <span :style="{ color: trendColor }">{{ trend }}</span>
42
+ </slot>
43
+ </div>
44
+
45
+ <!-- 描述信息 -->
46
+ <div v-if="description || $slots.description" class="jh-statistic-card-description">
47
+ <slot name="description">{{ description }}</slot>
48
+ </div>
49
+ </div>
50
+
51
+ <!-- 右侧图表区域 -->
52
+ <div v-if="hasChart" class="jh-statistic-card-chart">
53
+ <slot name="chart">
54
+ <v-chart
55
+ v-if="chartOption"
56
+ :option="chartOption"
57
+ :style="chartStyles"
58
+ autoresize
59
+ />
60
+ </slot>
61
+ </div>
62
+ </div>
63
+
64
+ <!-- 底部操作区 -->
65
+ <div v-if="$slots.footer || footer" class="jh-statistic-card-footer">
66
+ <slot name="footer">{{ footer }}</slot>
67
+ </div>
68
+ </div>
69
+ </template>
70
+
71
+ <script>
72
+ // CDN 方式引入 echarts 和 vue-echarts
73
+ // 在 HTML 中添加以下 CDN 链接:
74
+
75
+ // 检查全局 echarts 和 VueECharts 是否可用
76
+ const isEChartsAvailable = () => {
77
+ return typeof window !== 'undefined' && window.echarts;
78
+ };
79
+
80
+ const isVueEChartsAvailable = () => {
81
+ return typeof window !== 'undefined' && window.VueECharts;
82
+ };
83
+
84
+ // 动态组件定义
85
+ const VChart = {
86
+ name: 'VChart',
87
+ props: {
88
+ // ECharts 的 option 配置
89
+ option: Object,
90
+ // 是否在容器尺寸变化时自动 resize
91
+ autoresize: {
92
+ type: Boolean,
93
+ default: true,
94
+ },
95
+ },
96
+ data() {
97
+ return {
98
+ chart: null,
99
+ };
100
+ },
101
+ mounted() {
102
+ this.initChart();
103
+ if (this.autoresize) {
104
+ window.addEventListener('resize', this.handleResize);
105
+ }
106
+ },
107
+ beforeDestroy() {
108
+ if (this.chart) {
109
+ this.chart.dispose();
110
+ }
111
+ if (this.autoresize) {
112
+ window.removeEventListener('resize', this.handleResize);
113
+ }
114
+ },
115
+ watch: {
116
+ option: {
117
+ handler() {
118
+ this.updateChart();
119
+ },
120
+ deep: true,
121
+ },
122
+ },
123
+ methods: {
124
+ initChart() {
125
+ if (!isEChartsAvailable()) {
126
+ console.warn('ECharts is not available. Please include ECharts CDN.');
127
+ return;
128
+ }
129
+
130
+ this.chart = window.echarts.init(this.$el);
131
+ this.updateChart();
132
+ },
133
+ updateChart() {
134
+ if (this.chart && this.option) {
135
+ this.chart.setOption(this.option, true);
136
+ }
137
+ },
138
+ handleResize() {
139
+ if (this.chart) {
140
+ this.chart.resize();
141
+ }
142
+ },
143
+ },
144
+ render(h) {
145
+ return h('div', {
146
+ style: {
147
+ width: '100%',
148
+ height: '100%',
149
+ },
150
+ });
151
+ },
152
+ };
153
+
154
+ export default {
155
+ name: 'JhStatisticCard',
156
+
157
+ components: {
158
+ VChart,
159
+ },
160
+
161
+ props: {
162
+ // 标题
163
+ title: {
164
+ type: String,
165
+ default: '',
166
+ },
167
+
168
+ // 提示信息
169
+ tooltip: {
170
+ type: String,
171
+ default: '',
172
+ },
173
+
174
+ // 数值
175
+ value: {
176
+ type: [Number, String],
177
+ default: 0,
178
+ },
179
+
180
+ // 前缀
181
+ prefix: {
182
+ type: String,
183
+ default: '',
184
+ },
185
+
186
+ // 后缀
187
+ suffix: {
188
+ type: String,
189
+ default: '',
190
+ },
191
+
192
+ // 精度(小数位数)
193
+ precision: {
194
+ type: Number,
195
+ default: 0,
196
+ },
197
+
198
+ // 数值颜色
199
+ valueColor: {
200
+ type: String,
201
+ default: '',
202
+ },
203
+
204
+ // 趋势文本
205
+ trend: {
206
+ type: String,
207
+ default: '',
208
+ },
209
+
210
+ // 趋势类型 up | down
211
+ trendType: {
212
+ type: String,
213
+ default: 'up',
214
+ validator: (value) => ['up', 'down'].includes(value),
215
+ },
216
+
217
+ // 描述信息
218
+ description: {
219
+ type: String,
220
+ default: '',
221
+ },
222
+
223
+ // 底部信息
224
+ footer: {
225
+ type: String,
226
+ default: '',
227
+ },
228
+
229
+ // 图表配置
230
+ chartOption: {
231
+ type: Object,
232
+ default: null,
233
+ },
234
+
235
+ // 图表高度
236
+ chartHeight: {
237
+ type: [Number, String],
238
+ default: 46,
239
+ },
240
+
241
+ // 图表宽度
242
+ chartWidth: {
243
+ type: [Number, String],
244
+ default: 100,
245
+ },
246
+
247
+ // 是否有边框
248
+ bordered: {
249
+ type: Boolean,
250
+ default: true,
251
+ },
252
+
253
+ // 加载状态
254
+ loading: {
255
+ type: Boolean,
256
+ default: false,
257
+ },
258
+
259
+ // 布局方向 vertical | horizontal
260
+ layout: {
261
+ type: String,
262
+ default: 'horizontal',
263
+ validator: (value) => ['horizontal', 'vertical'].includes(value),
264
+ },
265
+ },
266
+
267
+ computed: {
268
+ // 格式化数值
269
+ formattedValue() {
270
+ if (typeof this.value === 'number') {
271
+ return this.value.toFixed(this.precision);
272
+ }
273
+ return this.value;
274
+ },
275
+
276
+ // 趋势图标
277
+ trendIcon() {
278
+ return this.trendType === 'up' ? 'mdi-trending-up' : 'mdi-trending-down';
279
+ },
280
+
281
+ // 趋势颜色
282
+ trendColor() {
283
+ return this.trendType === 'up' ? '#52c41a' : '#f5222d';
284
+ },
285
+
286
+ // 是否有图表
287
+ hasChart() {
288
+ return (this.$slots.chart || this.chartOption) && isEChartsAvailable();
289
+ },
290
+
291
+ // 卡片样式类
292
+ cardClasses() {
293
+ return [
294
+ 'jh-statistic-card',
295
+ {
296
+ 'jh-statistic-card--bordered': this.bordered,
297
+ 'jh-statistic-card--loading': this.loading,
298
+ 'jh-statistic-card--vertical': this.layout === 'vertical',
299
+ },
300
+ ];
301
+ },
302
+
303
+ // 卡片样式
304
+ cardStyles() {
305
+ return {};
306
+ },
307
+
308
+ // 数值样式类
309
+ valueClasses() {
310
+ return ['jh-statistic-card-value'];
311
+ },
312
+
313
+ // 数值样式
314
+ valueStyles() {
315
+ const styles = {};
316
+ if (this.valueColor) {
317
+ styles.color = this.valueColor;
318
+ }
319
+ return styles;
320
+ },
321
+
322
+ // 图表样式
323
+ chartStyles() {
324
+ const height = typeof this.chartHeight === 'number'
325
+ ? `${this.chartHeight}px`
326
+ : this.chartHeight;
327
+ const width = typeof this.chartWidth === 'number'
328
+ ? `${this.chartWidth}px`
329
+ : this.chartWidth;
330
+
331
+ return {
332
+ height,
333
+ width,
334
+ };
335
+ },
336
+ },
337
+ };
338
+ </script>
339
+
340
+ <style scoped>
341
+ /* 卡片容器 */
342
+ .jh-statistic-card {
343
+ background: #ffffff;
344
+ border-radius: 4px;
345
+ padding: 24px;
346
+ position: relative;
347
+ transition: box-shadow 0.3s;
348
+ }
349
+
350
+ .jh-statistic-card--bordered {
351
+ border: 1px solid #e8e8e8;
352
+ }
353
+
354
+ .jh-statistic-card:hover {
355
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.09);
356
+ }
357
+
358
+ /* 标题区域 */
359
+ .jh-statistic-card-header {
360
+ display: flex;
361
+ align-items: center;
362
+ margin-bottom: 12px;
363
+ }
364
+
365
+ .jh-statistic-card-title {
366
+ color: rgba(0, 0, 0, 0.65);
367
+ font-size: 14px;
368
+ line-height: 22px;
369
+ }
370
+
371
+ .jh-statistic-card-tooltip {
372
+ margin-left: 4px;
373
+ color: rgba(0, 0, 0, 0.45);
374
+ }
375
+
376
+ /* 内容区域 */
377
+ .jh-statistic-card-content {
378
+ display: flex;
379
+ align-items: flex-start;
380
+ justify-content: space-between;
381
+ }
382
+
383
+ .jh-statistic-card--vertical .jh-statistic-card-content {
384
+ flex-direction: column;
385
+ }
386
+
387
+ /* 统计数据区域 */
388
+ .jh-statistic-card-statistic {
389
+ flex: 1;
390
+ }
391
+
392
+ /* 数值区域 */
393
+ .jh-statistic-card-value-wrapper {
394
+ display: flex;
395
+ align-items: baseline;
396
+ margin-bottom: 8px;
397
+ }
398
+
399
+ .jh-statistic-card-value {
400
+ font-size: 30px;
401
+ font-weight: 500;
402
+ color: rgba(0, 0, 0, 0.85);
403
+ line-height: 38px;
404
+ }
405
+
406
+ .jh-statistic-card-prefix,
407
+ .jh-statistic-card-suffix {
408
+ font-size: 16px;
409
+ color: rgba(0, 0, 0, 0.65);
410
+ margin: 0 4px;
411
+ }
412
+
413
+ /* 趋势指标 */
414
+ .jh-statistic-card-trend {
415
+ display: flex;
416
+ align-items: center;
417
+ font-size: 14px;
418
+ margin-bottom: 4px;
419
+ }
420
+
421
+ .jh-statistic-card-trend-icon {
422
+ margin-right: 4px;
423
+ }
424
+
425
+ /* 描述信息 */
426
+ .jh-statistic-card-description {
427
+ color: rgba(0, 0, 0, 0.45);
428
+ font-size: 14px;
429
+ line-height: 22px;
430
+ }
431
+
432
+ /* 图表区域 */
433
+ .jh-statistic-card-chart {
434
+ margin-left: 16px;
435
+ display: flex;
436
+ align-items: center;
437
+ }
438
+
439
+ .jh-statistic-card--vertical .jh-statistic-card-chart {
440
+ margin-left: 0;
441
+ margin-top: 16px;
442
+ width: 100%;
443
+ }
444
+
445
+ /* 底部区域 */
446
+ .jh-statistic-card-footer {
447
+ margin-top: 16px;
448
+ padding-top: 12px;
449
+ border-top: 1px solid #e8e8e8;
450
+ color: rgba(0, 0, 0, 0.65);
451
+ font-size: 14px;
452
+ }
453
+
454
+ /* 加载状态 */
455
+ .jh-statistic-card--loading {
456
+ opacity: 0.6;
457
+ pointer-events: none;
458
+ }
459
+ </style>