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.
- package/README.md +376 -0
- package/dist/jianghu-ui.css +2318 -0
- package/dist/jianghu-ui.js +2 -0
- package/dist/jianghu-ui.js.LICENSE.txt +1 -0
- package/package.json +56 -0
- package/src/Design.stories.mdx +195 -0
- package/src/Introduction.stories.mdx +148 -0
- package/src/components/JhAddressSelect/JhAddressSelect.md +250 -0
- package/src/components/JhAddressSelect/JhAddressSelect.stories.js +282 -0
- package/src/components/JhAddressSelect/JhAddressSelect.vue +261 -0
- package/src/components/JhCard/JhCard.md +246 -0
- package/src/components/JhCard/JhCard.stories.js +688 -0
- package/src/components/JhCard/JhCard.vue +604 -0
- package/src/components/JhCheckCard/JhCheckCard.md +245 -0
- package/src/components/JhCheckCard/JhCheckCard.stories.js +750 -0
- package/src/components/JhCheckCard/JhCheckCard.vue +476 -0
- package/src/components/JhConfirmDialog/JhConfirmDialog.md +70 -0
- package/src/components/JhConfirmDialog/JhConfirmDialog.stories.js +550 -0
- package/src/components/JhConfirmDialog/JhConfirmDialog.vue +181 -0
- package/src/components/JhDateRangePicker/JhDateRangePicker.md +56 -0
- package/src/components/JhDateRangePicker/JhDateRangePicker.stories.js +320 -0
- package/src/components/JhDateRangePicker/JhDateRangePicker.vue +307 -0
- package/src/components/JhDescriptions/JhDescriptions.md +724 -0
- package/src/components/JhDescriptions/JhDescriptions.stories.js +858 -0
- package/src/components/JhDescriptions/JhDescriptions.vue +933 -0
- package/src/components/JhDraggable/JhDraggable.md +66 -0
- package/src/components/JhDraggable/JhDraggable.stories.js +161 -0
- package/src/components/JhDraggable/JhDraggable.vue +254 -0
- package/src/components/JhDrawer/JhDrawer.md +68 -0
- package/src/components/JhDrawer/JhDrawer.stories.js +478 -0
- package/src/components/JhDrawer/JhDrawer.vue +281 -0
- package/src/components/JhDrawerForm/JhDrawerForm.md +69 -0
- package/src/components/JhDrawerForm/JhDrawerForm.stories.js +492 -0
- package/src/components/JhDrawerForm/JhDrawerForm.vue +297 -0
- package/src/components/JhEditableTable/JhEditableTable.md +507 -0
- package/src/components/JhEditableTable/JhEditableTable.stories.js +615 -0
- package/src/components/JhEditableTable/JhEditableTable.vue +685 -0
- package/src/components/JhFileInput/JhFileInput.md +56 -0
- package/src/components/JhFileInput/JhFileInput.stories.js +103 -0
- package/src/components/JhFileInput/JhFileInput.vue +253 -0
- package/src/components/JhForm/JhForm.md +676 -0
- package/src/components/JhForm/JhForm.stories.js +1375 -0
- package/src/components/JhForm/JhForm.vue +657 -0
- package/src/components/JhFormField/JhFormField.stories.js +217 -0
- package/src/components/JhFormField/JhFormField.vue +439 -0
- package/src/components/JhFormFields/JhFormFields.md +647 -0
- package/src/components/JhFormFields/JhFormFields.stories.js +922 -0
- package/src/components/JhFormFields/JhFormFields.vue +998 -0
- package/src/components/JhFormList/JhFormList.md +303 -0
- package/src/components/JhFormList/JhFormList.stories.js +661 -0
- package/src/components/JhFormList/JhFormList.vue +1127 -0
- package/src/components/JhJsonEditor/JhJsonEditor.md +54 -0
- package/src/components/JhJsonEditor/JhJsonEditor.stories.js +157 -0
- package/src/components/JhJsonEditor/JhJsonEditor.vue +178 -0
- package/src/components/JhLayout/JhLayout.md +580 -0
- package/src/components/JhLayout/JhLayout.stories.js +414 -0
- package/src/components/JhLayout/JhLayout.vue +387 -0
- package/src/components/JhList/JhList.md +441 -0
- package/src/components/JhList/JhList.stories.js +524 -0
- package/src/components/JhList/JhList.vue +571 -0
- package/src/components/JhMarkdownEditor/JhMarkdownEditor.md +56 -0
- package/src/components/JhMarkdownEditor/JhMarkdownEditor.stories.js +191 -0
- package/src/components/JhMarkdownEditor/JhMarkdownEditor.vue +188 -0
- package/src/components/JhMask/JhMask.md +62 -0
- package/src/components/JhMask/JhMask.stories.js +270 -0
- package/src/components/JhMask/JhMask.vue +123 -0
- package/src/components/JhMenu/JhMenu.md +85 -0
- package/src/components/JhMenu/JhMenu.stories.js +384 -0
- package/src/components/JhMenu/JhMenu.vue +545 -0
- package/src/components/JhModal/JhModal.md +68 -0
- package/src/components/JhModal/JhModal.stories.js +562 -0
- package/src/components/JhModal/JhModal.vue +235 -0
- package/src/components/JhModalForm/JhModalForm.md +69 -0
- package/src/components/JhModalForm/JhModalForm.stories.js +592 -0
- package/src/components/JhModalForm/JhModalForm.vue +298 -0
- package/src/components/JhPageContainer/JhPageContainer.md +409 -0
- package/src/components/JhPageContainer/JhPageContainer.stories.js +209 -0
- package/src/components/JhPageContainer/JhPageContainer.vue +72 -0
- package/src/components/JhQueryFilter/JhQueryFilter.md +77 -0
- package/src/components/JhQueryFilter/JhQueryFilter.stories.js +684 -0
- package/src/components/JhQueryFilter/JhQueryFilter.vue +429 -0
- package/src/components/JhScene/JhScene.md +64 -0
- package/src/components/JhScene/JhScene.stories.js +317 -0
- package/src/components/JhScene/JhScene.vue +376 -0
- package/src/components/JhStatisticCard/JhStatisticCard.md +363 -0
- package/src/components/JhStatisticCard/JhStatisticCard.stories.js +847 -0
- package/src/components/JhStatisticCard/JhStatisticCard.vue +459 -0
- package/src/components/JhStepsForm/JhStepsForm.md +666 -0
- package/src/components/JhStepsForm/JhStepsForm.stories.js +1224 -0
- package/src/components/JhStepsForm/JhStepsForm.vue +749 -0
- package/src/components/JhTable/JhTable.md +730 -0
- package/src/components/JhTable/JhTable.stories.js +1444 -0
- package/src/components/JhTable/JhTable.vue +2298 -0
- package/src/components/JhTableAttachment/JhTableAttachment.md +70 -0
- package/src/components/JhTableAttachment/JhTableAttachment.stories.js +198 -0
- package/src/components/JhTableAttachment/JhTableAttachment.vue +264 -0
- package/src/components/JhToast/JhToast.md +67 -0
- package/src/components/JhToast/JhToast.stories.js +386 -0
- package/src/components/JhToast/JhToast.vue +239 -0
- package/src/components/JhTreeSelect/JhTreeSelect.md +82 -0
- package/src/components/JhTreeSelect/JhTreeSelect.stories.js +391 -0
- package/src/components/JhTreeSelect/JhTreeSelect.vue +727 -0
- package/src/components/JhWaterMark/JhWaterMark.md +190 -0
- package/src/components/JhWaterMark/JhWaterMark.stories.js +675 -0
- package/src/components/JhWaterMark/JhWaterMark.vue +351 -0
- package/src/components/README.md +52 -0
- package/src/index.js +135 -0
- package/src/style/globalCSSJHV4.css +348 -0
- package/src/style/globalCSSVuetifyV4.css +637 -0
- package/src/style/storybook.css +4 -0
- package/src/tailwind.css +3 -0
- package/src/utils/vuetify.js +31 -0
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
# JhCheckCard 多选卡片
|
|
2
|
+
|
|
3
|
+
多选卡片组件,参考 Ant Design ProComponents CheckCard 设计规范。支持单选、多选、不同尺寸、自定义内容等功能。
|
|
4
|
+
|
|
5
|
+
## 基础用法
|
|
6
|
+
|
|
7
|
+
```vue
|
|
8
|
+
<template>
|
|
9
|
+
<jh-check-card
|
|
10
|
+
title="基础卡片"
|
|
11
|
+
description="这是一个基础的多选卡片"
|
|
12
|
+
@change="handleChange"
|
|
13
|
+
>
|
|
14
|
+
<div>卡片内容</div>
|
|
15
|
+
</jh-check-card>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script>
|
|
19
|
+
export default {
|
|
20
|
+
methods: {
|
|
21
|
+
handleChange(checked, value) {
|
|
22
|
+
console.log('选中状态:', checked, '值:', value);
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
</script>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## 多选模式
|
|
30
|
+
|
|
31
|
+
```vue
|
|
32
|
+
<template>
|
|
33
|
+
<div>
|
|
34
|
+
<jh-check-card
|
|
35
|
+
v-for="option in options"
|
|
36
|
+
:key="option.value"
|
|
37
|
+
:title="option.title"
|
|
38
|
+
:description="option.description"
|
|
39
|
+
:value="option.value"
|
|
40
|
+
:checked="selectedValues.includes(option.value)"
|
|
41
|
+
@change="handleMultipleChange"
|
|
42
|
+
>
|
|
43
|
+
{{ option.content }}
|
|
44
|
+
</jh-check-card>
|
|
45
|
+
</div>
|
|
46
|
+
</template>
|
|
47
|
+
|
|
48
|
+
<script>
|
|
49
|
+
export default {
|
|
50
|
+
data() {
|
|
51
|
+
return {
|
|
52
|
+
selectedValues: ['option1'],
|
|
53
|
+
options: [
|
|
54
|
+
{ value: 'option1', title: '选项一', description: '描述一', content: '内容一' },
|
|
55
|
+
{ value: 'option2', title: '选项二', description: '描述二', content: '内容二' },
|
|
56
|
+
{ value: 'option3', title: '选项三', description: '描述三', content: '内容三' },
|
|
57
|
+
],
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
methods: {
|
|
61
|
+
handleMultipleChange(checked, value) {
|
|
62
|
+
if (checked) {
|
|
63
|
+
if (!this.selectedValues.includes(value)) {
|
|
64
|
+
this.selectedValues.push(value);
|
|
65
|
+
}
|
|
66
|
+
} else {
|
|
67
|
+
const index = this.selectedValues.indexOf(value);
|
|
68
|
+
if (index > -1) {
|
|
69
|
+
this.selectedValues.splice(index, 1);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
</script>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## 单选模式
|
|
79
|
+
|
|
80
|
+
```vue
|
|
81
|
+
<template>
|
|
82
|
+
<div>
|
|
83
|
+
<jh-check-card
|
|
84
|
+
v-for="option in options"
|
|
85
|
+
:key="option.value"
|
|
86
|
+
:title="option.title"
|
|
87
|
+
:value="option.value"
|
|
88
|
+
:checked="selectedValue === option.value"
|
|
89
|
+
@change="handleSingleChange"
|
|
90
|
+
>
|
|
91
|
+
{{ option.content }}
|
|
92
|
+
</jh-check-card>
|
|
93
|
+
</div>
|
|
94
|
+
</template>
|
|
95
|
+
|
|
96
|
+
<script>
|
|
97
|
+
export default {
|
|
98
|
+
data() {
|
|
99
|
+
return {
|
|
100
|
+
selectedValue: 'option1',
|
|
101
|
+
options: [
|
|
102
|
+
{ value: 'option1', title: '选项一', content: '内容一' },
|
|
103
|
+
{ value: 'option2', title: '选项二', content: '内容二' },
|
|
104
|
+
{ value: 'option3', title: '选项三', content: '内容三' },
|
|
105
|
+
],
|
|
106
|
+
};
|
|
107
|
+
},
|
|
108
|
+
methods: {
|
|
109
|
+
handleSingleChange(checked, value) {
|
|
110
|
+
if (checked) {
|
|
111
|
+
this.selectedValue = value;
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
</script>
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## 带封面图片
|
|
120
|
+
|
|
121
|
+
```vue
|
|
122
|
+
<template>
|
|
123
|
+
<jh-check-card
|
|
124
|
+
title="产品名称"
|
|
125
|
+
description="产品描述"
|
|
126
|
+
cover="https://example.com/image.jpg"
|
|
127
|
+
extra="¥299"
|
|
128
|
+
@change="handleChange"
|
|
129
|
+
>
|
|
130
|
+
<div>产品详细信息</div>
|
|
131
|
+
</jh-check-card>
|
|
132
|
+
</template>
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## 自定义内容
|
|
136
|
+
|
|
137
|
+
```vue
|
|
138
|
+
<template>
|
|
139
|
+
<jh-check-card @change="handleChange">
|
|
140
|
+
<template #title>
|
|
141
|
+
<div style="display: flex; align-items: center;">
|
|
142
|
+
<v-icon color="primary" class="mr-2">mdi-rocket</v-icon>
|
|
143
|
+
自定义标题
|
|
144
|
+
</div>
|
|
145
|
+
</template>
|
|
146
|
+
|
|
147
|
+
<template #description>
|
|
148
|
+
<div style="color: #52c41a;">自定义描述样式</div>
|
|
149
|
+
</template>
|
|
150
|
+
|
|
151
|
+
<div style="text-align: center; padding: 20px;">
|
|
152
|
+
<div style="font-size: 32px; margin-bottom: 8px;">⚡</div>
|
|
153
|
+
<div>自定义内容区域</div>
|
|
154
|
+
</div>
|
|
155
|
+
</jh-check-card>
|
|
156
|
+
</template>
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## API
|
|
160
|
+
|
|
161
|
+
### Props
|
|
162
|
+
|
|
163
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
164
|
+
| --- | --- | --- | --- |
|
|
165
|
+
| title | 卡片标题 | `string` | `''` |
|
|
166
|
+
| description | 卡片描述 | `string` | `''` |
|
|
167
|
+
| cover | 卡片封面图片URL | `string` | `''` |
|
|
168
|
+
| extra | 右下角额外内容 | `string` | `''` |
|
|
169
|
+
| value | 卡片值,用于多选时的标识 | `string \| number \| boolean` | `null` |
|
|
170
|
+
| checked | 是否选中(受控) | `boolean` | `false` |
|
|
171
|
+
| defaultChecked | 默认选中状态(非受控) | `boolean` | `false` |
|
|
172
|
+
| disabled | 是否禁用 | `boolean` | `false` |
|
|
173
|
+
| loading | 是否加载中 | `boolean` | `false` |
|
|
174
|
+
| size | 卡片尺寸 | `'small' \| 'default' \| 'large'` | `'default'` |
|
|
175
|
+
| bordered | 是否显示边框 | `boolean` | `true` |
|
|
176
|
+
| hideCheckbox | 是否隐藏选择框 | `boolean` | `false` |
|
|
177
|
+
| checkboxPosition | 选择框位置 | `'top-left' \| 'top-right' \| 'bottom-left' \| 'bottom-right'` | `'top-right'` |
|
|
178
|
+
| hoverable | 是否可悬浮 | `boolean` | `true` |
|
|
179
|
+
| width | 卡片宽度 | `string \| number` | `''` |
|
|
180
|
+
| height | 卡片高度 | `string \| number` | `''` |
|
|
181
|
+
| bodyStyle | 自定义样式 | `object` | `{}` |
|
|
182
|
+
| headStyle | 自定义头部样式 | `object` | `{}` |
|
|
183
|
+
|
|
184
|
+
### Events
|
|
185
|
+
|
|
186
|
+
| 事件名 | 说明 | 回调参数 |
|
|
187
|
+
| --- | --- | --- |
|
|
188
|
+
| change | 选中状态改变时触发 | `(checked: boolean, value: any) => void` |
|
|
189
|
+
| click | 点击卡片时触发 | `(event: Event) => void` |
|
|
190
|
+
| input | 兼容 v-model,选中状态改变时触发 | `(checked: boolean) => void` |
|
|
191
|
+
|
|
192
|
+
### Slots
|
|
193
|
+
|
|
194
|
+
| 插槽名 | 说明 | 参数 |
|
|
195
|
+
| --- | --- | --- |
|
|
196
|
+
| default | 默认内容 | - |
|
|
197
|
+
| title | 自定义标题 | - |
|
|
198
|
+
| description | 自定义描述 | - |
|
|
199
|
+
| cover | 自定义封面 | - |
|
|
200
|
+
| extra | 自定义额外内容 | - |
|
|
201
|
+
|
|
202
|
+
## 设计规范
|
|
203
|
+
|
|
204
|
+
### 尺寸规格
|
|
205
|
+
|
|
206
|
+
- **小尺寸 (small)**: 最小高度 80px,内边距 12px,标题字号 14px
|
|
207
|
+
- **默认尺寸 (default)**: 最小高度 100px,内边距 16px,标题字号 16px
|
|
208
|
+
- **大尺寸 (large)**: 最小高度 120px,内边距 20px,标题字号 18px
|
|
209
|
+
|
|
210
|
+
### 状态样式
|
|
211
|
+
|
|
212
|
+
- **默认状态**: 灰色边框 `#d9d9d9`,白色背景
|
|
213
|
+
- **悬浮状态**: 蓝色边框 `#1890ff`,轻微阴影
|
|
214
|
+
- **选中状态**: 蓝色边框 `#1890ff`,蓝色阴影 `rgba(24, 144, 255, 0.2)`
|
|
215
|
+
- **禁用状态**: 透明度 50%,不可交互
|
|
216
|
+
- **加载状态**: 显示加载指示器,不可交互
|
|
217
|
+
|
|
218
|
+
### 选择框位置
|
|
219
|
+
|
|
220
|
+
选择框可以放置在卡片的四个角落:
|
|
221
|
+
- `top-left`: 左上角
|
|
222
|
+
- `top-right`: 右上角(默认)
|
|
223
|
+
- `bottom-left`: 左下角
|
|
224
|
+
- `bottom-right`: 右下角
|
|
225
|
+
|
|
226
|
+
### 响应式设计
|
|
227
|
+
|
|
228
|
+
组件支持响应式布局,在小屏幕设备上会自动调整内边距和字号:
|
|
229
|
+
- 屏幕宽度 ≤ 768px 时,内边距调整为 12px,标题字号调整为 14px
|
|
230
|
+
|
|
231
|
+
## 使用场景
|
|
232
|
+
|
|
233
|
+
1. **商品选择**: 电商场景中的商品多选
|
|
234
|
+
2. **套餐选择**: 会员套餐、服务套餐等单选场景
|
|
235
|
+
3. **功能选择**: 产品功能、权限等多选场景
|
|
236
|
+
4. **配置选择**: 系统配置项、参数设置等
|
|
237
|
+
5. **内容分类**: 文章分类、标签选择等
|
|
238
|
+
|
|
239
|
+
## 注意事项
|
|
240
|
+
|
|
241
|
+
1. 当使用 `checked` 属性时,组件为受控模式,需要通过 `change` 事件更新状态
|
|
242
|
+
2. 当不传入 `checked` 属性时,组件为非受控模式,使用内部状态管理
|
|
243
|
+
3. `value` 属性用于标识卡片,在多选场景中特别重要
|
|
244
|
+
4. 禁用和加载状态下,卡片不响应点击事件
|
|
245
|
+
5. 建议为每个卡片设置合适的宽度,避免内容溢出
|