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,235 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-dialog
|
|
3
|
+
v-model="isShownInternal"
|
|
4
|
+
:max-width="width"
|
|
5
|
+
:persistent="persistent"
|
|
6
|
+
:fullscreen="fullscreen"
|
|
7
|
+
v-bind="mergedDialogProps"
|
|
8
|
+
v-on="dialogListeners"
|
|
9
|
+
@keydown.esc="handleCancel"
|
|
10
|
+
>
|
|
11
|
+
<v-card>
|
|
12
|
+
<!-- 标题栏 -->
|
|
13
|
+
<v-card-title class="d-flex align-center justify-space-between pa-4 sticky top-0 z-10 bg-white darken-1">
|
|
14
|
+
<span class="text-h6">{{ title }}</span>
|
|
15
|
+
<v-btn
|
|
16
|
+
v-if="closable"
|
|
17
|
+
icon
|
|
18
|
+
small
|
|
19
|
+
@click="handleCancel"
|
|
20
|
+
>
|
|
21
|
+
<v-icon>mdi-close</v-icon>
|
|
22
|
+
</v-btn>
|
|
23
|
+
</v-card-title>
|
|
24
|
+
|
|
25
|
+
<v-divider />
|
|
26
|
+
|
|
27
|
+
<!-- 弹窗内容 -->
|
|
28
|
+
<v-card-text class="pa-6">
|
|
29
|
+
<!-- 完全自定义内容插槽 -->
|
|
30
|
+
<slot></slot>
|
|
31
|
+
</v-card-text>
|
|
32
|
+
|
|
33
|
+
<!-- 底部按钮 -->
|
|
34
|
+
<template v-if="showActions">
|
|
35
|
+
<v-divider />
|
|
36
|
+
<v-card-actions class="pa-4">
|
|
37
|
+
<!-- 自定义操作按钮插槽 -->
|
|
38
|
+
<slot name="actions">
|
|
39
|
+
<!-- 默认按钮组 -->
|
|
40
|
+
<v-spacer />
|
|
41
|
+
<v-btn
|
|
42
|
+
v-if="showCancelButton"
|
|
43
|
+
text
|
|
44
|
+
@click="handleCancel"
|
|
45
|
+
>
|
|
46
|
+
{{ cancelText }}
|
|
47
|
+
</v-btn>
|
|
48
|
+
<v-btn
|
|
49
|
+
v-if="showConfirmButton"
|
|
50
|
+
color="success"
|
|
51
|
+
@click="handleConfirm"
|
|
52
|
+
>
|
|
53
|
+
{{ confirmText }}
|
|
54
|
+
</v-btn>
|
|
55
|
+
</slot>
|
|
56
|
+
</v-card-actions>
|
|
57
|
+
</template>
|
|
58
|
+
</v-card>
|
|
59
|
+
</v-dialog>
|
|
60
|
+
</template>
|
|
61
|
+
|
|
62
|
+
<script>
|
|
63
|
+
export default {
|
|
64
|
+
name: 'JhModal',
|
|
65
|
+
inheritAttrs: false,
|
|
66
|
+
|
|
67
|
+
props: {
|
|
68
|
+
// v-model 控制显示/隐藏
|
|
69
|
+
value: {
|
|
70
|
+
type: Boolean,
|
|
71
|
+
default: false,
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
// 标题
|
|
75
|
+
title: {
|
|
76
|
+
type: String,
|
|
77
|
+
default: '弹窗',
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
// 弹窗宽度
|
|
81
|
+
width: {
|
|
82
|
+
type: [Number, String],
|
|
83
|
+
default: 600,
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
// 是否全屏
|
|
87
|
+
fullscreen: {
|
|
88
|
+
type: Boolean,
|
|
89
|
+
default: false,
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
// 是否持久化(点击外部不关闭)
|
|
93
|
+
persistent: {
|
|
94
|
+
type: Boolean,
|
|
95
|
+
default: true,
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
// 是否显示关闭按钮
|
|
99
|
+
closable: {
|
|
100
|
+
type: Boolean,
|
|
101
|
+
default: true,
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
// 是否显示底部操作区域
|
|
105
|
+
showActions: {
|
|
106
|
+
type: Boolean,
|
|
107
|
+
default: true,
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
// 按钮配置
|
|
111
|
+
showConfirmButton: {
|
|
112
|
+
type: Boolean,
|
|
113
|
+
default: true
|
|
114
|
+
},
|
|
115
|
+
showCancelButton: {
|
|
116
|
+
type: Boolean,
|
|
117
|
+
default: true
|
|
118
|
+
},
|
|
119
|
+
confirmText: {
|
|
120
|
+
type: String,
|
|
121
|
+
default: '确认'
|
|
122
|
+
},
|
|
123
|
+
cancelText: {
|
|
124
|
+
type: String,
|
|
125
|
+
default: '取消'
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
data() {
|
|
130
|
+
return {
|
|
131
|
+
isShownInternal: this.value,
|
|
132
|
+
};
|
|
133
|
+
},
|
|
134
|
+
computed: {
|
|
135
|
+
// 合并透传属性,只排除组件内部明确处理的属性
|
|
136
|
+
mergedDialogProps() {
|
|
137
|
+
// 只排除组件内部明确处理的属性,其他所有属性都透传给 v-dialog
|
|
138
|
+
const excludedAttrs = [
|
|
139
|
+
'class', 'style',
|
|
140
|
+
// 这些属性在组件内部有特殊处理
|
|
141
|
+
'value', 'modelValue', 'max-width', 'maxWidth', 'persistent', 'fullscreen',
|
|
142
|
+
// JhModal 特有的 props(不在 v-dialog 中)
|
|
143
|
+
'title', 'width', 'closable', 'showActions', 'showConfirmButton',
|
|
144
|
+
'showCancelButton', 'confirmText', 'cancelText'
|
|
145
|
+
];
|
|
146
|
+
|
|
147
|
+
const { class: cls, style, ...rest } = this.$attrs || {};
|
|
148
|
+
const filteredAttrs = {};
|
|
149
|
+
|
|
150
|
+
Object.keys(rest).forEach(key => {
|
|
151
|
+
const keyKebab = key.replace(/([A-Z])/g, '-$1').toLowerCase();
|
|
152
|
+
// 只排除明确处理的属性,其他都透传
|
|
153
|
+
if (!excludedAttrs.includes(key) && !excludedAttrs.includes(keyKebab)) {
|
|
154
|
+
filteredAttrs[key] = rest[key];
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
return filteredAttrs;
|
|
159
|
+
},
|
|
160
|
+
// 透传所有事件,只排除组件内部明确处理的事件
|
|
161
|
+
dialogListeners() {
|
|
162
|
+
// 只排除组件内部明确处理的事件,其他所有事件都透传给 v-dialog
|
|
163
|
+
const excludedEvents = [
|
|
164
|
+
// JhModal 特有的事件(不在 v-dialog 中)
|
|
165
|
+
'open', 'close', 'confirm', 'cancel'
|
|
166
|
+
];
|
|
167
|
+
|
|
168
|
+
const listeners = { ...this.$listeners || {} };
|
|
169
|
+
const filteredListeners = {};
|
|
170
|
+
|
|
171
|
+
Object.keys(listeners).forEach(key => {
|
|
172
|
+
// 只排除明确处理的事件,其他都透传
|
|
173
|
+
if (!excludedEvents.includes(key)) {
|
|
174
|
+
filteredListeners[key] = listeners[key];
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
return filteredListeners;
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
|
|
182
|
+
watch: {
|
|
183
|
+
value(val) {
|
|
184
|
+
this.isShownInternal = val;
|
|
185
|
+
if (val) {
|
|
186
|
+
this.$emit('open');
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
isShownInternal(val) {
|
|
190
|
+
if (!val) {
|
|
191
|
+
this.$emit('input', false);
|
|
192
|
+
this.$emit('close');
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
|
|
197
|
+
methods: {
|
|
198
|
+
// 处理取消
|
|
199
|
+
handleCancel() {
|
|
200
|
+
this.$emit('cancel');
|
|
201
|
+
this.isShownInternal = false;
|
|
202
|
+
},
|
|
203
|
+
|
|
204
|
+
// 处理确认
|
|
205
|
+
handleConfirm() {
|
|
206
|
+
this.$emit('confirm');
|
|
207
|
+
},
|
|
208
|
+
|
|
209
|
+
// 打开弹窗
|
|
210
|
+
open() {
|
|
211
|
+
this.isShownInternal = true;
|
|
212
|
+
},
|
|
213
|
+
|
|
214
|
+
// 关闭弹窗
|
|
215
|
+
close() {
|
|
216
|
+
this.isShownInternal = false;
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
};
|
|
220
|
+
</script>
|
|
221
|
+
|
|
222
|
+
<style scoped>
|
|
223
|
+
/* 输入标签 */
|
|
224
|
+
.jh-input-label {
|
|
225
|
+
display: block;
|
|
226
|
+
font-size: 14px;
|
|
227
|
+
color: rgba(0, 0, 0, 0.6);
|
|
228
|
+
margin-bottom: 4px;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/* 输入框样式 */
|
|
232
|
+
.jh-v-input {
|
|
233
|
+
margin-top: 0;
|
|
234
|
+
}
|
|
235
|
+
</style>
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# JhModalForm - 模态框表单组件
|
|
2
|
+
|
|
3
|
+
JhModalForm 结合 JhForm 与模态框交互,适用于弹出式创建、编辑流程,可通过配置快速生成表单布局。
|
|
4
|
+
|
|
5
|
+
## 功能特性
|
|
6
|
+
|
|
7
|
+
- 🧱 **模态承载**:继承 JhModal 行为,支持宽度、全屏、粘性标题等
|
|
8
|
+
- 🧩 **配置化表单**:`fields` 描述表单结构,支持多 ValueType 与联动
|
|
9
|
+
- 🧽 **自动重置**:模态框打开时会重置表单值和验证状态
|
|
10
|
+
- 🧯 **校验守卫**:`validateBeforeConfirm` 控制确认前是否校验
|
|
11
|
+
- 🎛️ **插槽扩展**:`content` 自定义整块内容,`field-xxx` 精准覆盖单个字段
|
|
12
|
+
|
|
13
|
+
## 基础用法
|
|
14
|
+
|
|
15
|
+
```vue
|
|
16
|
+
<template>
|
|
17
|
+
<jh-modal-form
|
|
18
|
+
v-model="dialogVisible"
|
|
19
|
+
title="新增成员"
|
|
20
|
+
:fields="fields"
|
|
21
|
+
:initial-data="form"
|
|
22
|
+
@confirm="handleSubmit"
|
|
23
|
+
/>
|
|
24
|
+
</template>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## API
|
|
28
|
+
|
|
29
|
+
### Props
|
|
30
|
+
|
|
31
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
32
|
+
| --- | --- | --- | --- |
|
|
33
|
+
| value | `v-model`,控制显隐 | boolean | false |
|
|
34
|
+
| title | 弹窗标题 | string | `表单` |
|
|
35
|
+
| fields | JhForm 字段配置数组 | Array | [] |
|
|
36
|
+
| initialData | 表单初始值 | Object | `{}` |
|
|
37
|
+
| width | 最大宽度 | number \| string | 600 |
|
|
38
|
+
| fullscreen | 是否全屏 | boolean | false |
|
|
39
|
+
| persistent | 是否禁止点击遮罩关闭 | boolean | true |
|
|
40
|
+
| closable | 是否显示右上角关闭按钮 | boolean | true |
|
|
41
|
+
| showConfirmButton | 是否显示确认按钮 | boolean | true |
|
|
42
|
+
| confirmText | 确认按钮文本 | string | `确认` |
|
|
43
|
+
| cancelText | 取消按钮文本 | string | `取消` |
|
|
44
|
+
| formRef | 内部 JhForm ref 名称 | string | `modalForm` |
|
|
45
|
+
| validateBeforeConfirm | 确认前是否自动校验 | boolean | true |
|
|
46
|
+
| validationRules | 通用验证规则 | Object | 预置常用校验 |
|
|
47
|
+
|
|
48
|
+
### Events
|
|
49
|
+
|
|
50
|
+
| 事件名 | 说明 | 回调参数 |
|
|
51
|
+
| --- | --- | --- |
|
|
52
|
+
| input | `v-model` 更新 | (visible: boolean) |
|
|
53
|
+
| close | 弹窗关闭后触发 | - |
|
|
54
|
+
| cancel | 点击取消或关闭按钮触发 | - |
|
|
55
|
+
| confirm | 校验通过后触发 | (formData: object) |
|
|
56
|
+
| field-change | 字段变化时触发 | ({ key, value, formData }) |
|
|
57
|
+
|
|
58
|
+
### Slots
|
|
59
|
+
|
|
60
|
+
| 名称 | 说明 |
|
|
61
|
+
| --- | --- |
|
|
62
|
+
| content | 完全自定义表单区域,默认渲染 JhForm |
|
|
63
|
+
| field-`key` | 针对特定字段自定义渲染 |
|
|
64
|
+
|
|
65
|
+
## 使用建议
|
|
66
|
+
|
|
67
|
+
- 如果需在关闭后保留数据,可监听 `close` 事件并阻止 `resetForm`
|
|
68
|
+
- 复杂布局可直接在 `content` 插槽内放置任意组件,自行控制 JhForm
|
|
69
|
+
- 通过 `this.$refs.modalForm.getFormData()` 可以手动读取当前表单数据
|