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,209 @@
1
+ import JhPageContainer from './JhPageContainer.vue';
2
+ import JhQueryFilter from '../JhQueryFilter/JhQueryFilter.vue';
3
+ import JhTable from '../JhTable/JhTable.vue';
4
+ import JhMenu from '../JhMenu/JhMenu.vue';
5
+
6
+ // 示例数据
7
+ const sampleHeaders = [
8
+ { text: 'ID', value: 'id' },
9
+ { text: '用户名', value: 'username' },
10
+ { text: '邮箱', value: 'email' },
11
+ { text: '状态', value: 'status' },
12
+ { text: '创建时间', value: 'createdAt' },
13
+ { text: '操作', value: 'action', width: '150px', sortable: false },
14
+ ];
15
+
16
+ const sampleItems = [
17
+ { id: 1, username: '张三', email: 'zhangsan@example.com', status: '启用', createdAt: '2024-01-01' },
18
+ { id: 2, username: '李四', email: 'lisi@example.com', status: '启用', createdAt: '2024-01-02' },
19
+ { id: 3, username: '王五', email: 'wangwu@example.com', status: '禁用', createdAt: '2024-01-03' },
20
+ ];
21
+
22
+ export default {
23
+ title: '布局/JhPageContainer - 页容器',
24
+ component: JhPageContainer,
25
+ tags: ['autodocs'],
26
+ argTypes: {
27
+ pageName: {
28
+ control: 'text',
29
+ description: '页面标题',
30
+ },
31
+ showHelpButton: {
32
+ control: 'boolean',
33
+ description: '是否显示帮助按钮',
34
+ },
35
+ },
36
+ parameters: {
37
+ docs: {
38
+ description: {
39
+ component: `
40
+
41
+ 页面容器组件,提供统一的页面布局结构。这是与 test 目录中组件样式和功能保持一致的基础版本。
42
+
43
+ ## 功能特性
44
+
45
+ - 统一的页面头部布局
46
+ - 页面标题显示
47
+ - 帮助按钮
48
+ - 搜索栏插槽
49
+ - 内容区域插槽
50
+ - 响应式布局
51
+
52
+ ## 使用场景
53
+
54
+ 适用于所有标准页面布局,提供统一的外观和体验:
55
+ - 列表页面
56
+ - 详情页面
57
+ - 表单页面
58
+
59
+ ## 事件
60
+
61
+ - \`help-click\`: 点击帮助按钮时触发
62
+
63
+ ## 插槽
64
+
65
+ - \`search-bar\`: 搜索栏区域
66
+ - \`content\`: 主要内容区域
67
+ - \`default\`: 其他内容(如抽屉、对话框等)
68
+ `,
69
+ },
70
+ },
71
+ },
72
+ };
73
+
74
+
75
+ // 基础示例
76
+ export const 基础示例 = {
77
+ args: {
78
+ pageName: '用户管理',
79
+ showHelpButton: true,
80
+ },
81
+ render: (args) => ({
82
+ components: { JhPageContainer, JhQueryFilter, JhTable, JhMenu },
83
+ data() {
84
+ return {
85
+ args,
86
+ keyword: '',
87
+ keywordFieldList: ['username', 'email'],
88
+ headers: sampleHeaders,
89
+ items: sampleItems,
90
+ loading: false,
91
+ menuItems: [
92
+ { text: '用户管理', value: 'user', icon: 'mdi-account' },
93
+ { text: '角色管理', value: 'role', icon: 'mdi-shield-account' },
94
+ { text: '权限管理', value: 'permission', icon: 'mdi-key' },
95
+ ],
96
+ };
97
+ },
98
+ template: `
99
+ <jh-page-container
100
+ v-bind="args"
101
+ @help-click="handleHelpClick"
102
+ >
103
+ <template v-slot:menu>
104
+ <jh-menu
105
+ :items="menuItems"
106
+ @select="handleMenuSelect"
107
+ />
108
+ </template>
109
+ <template v-slot:search-bar>
110
+ <jh-query-filter
111
+ class="pa-0"
112
+ :keyword.sync="keyword"
113
+ :keywordFieldList.sync="keywordFieldList"
114
+ :headers="headers"
115
+ @search="handleSearch"
116
+ />
117
+ </template>
118
+
119
+ <template v-slot:content>
120
+ <jh-table
121
+ :headers="headers"
122
+ :items="items"
123
+ :loading="loading"
124
+ @create-click="handleCreate"
125
+ @update-click="handleUpdate"
126
+ @delete-click="handleDelete"
127
+ />
128
+ </template>
129
+ </jh-page-container>
130
+ `,
131
+ methods: {
132
+ handleHelpClick() {
133
+ alert('帮助按钮被点击');
134
+ },
135
+ handleMenuSelect(item) {
136
+ alert('切换菜单:' + item.text);
137
+ },
138
+ handleSearch() {
139
+ this.loading = true;
140
+ setTimeout(() => {
141
+ this.loading = false;
142
+ }, 1000);
143
+ },
144
+ handleCreate() {
145
+ alert('新增用户');
146
+ },
147
+ handleUpdate(item) {
148
+ alert('详情:' + item.username);
149
+ },
150
+ handleDelete(item) {
151
+ alert('删除:' + item.username);
152
+ },
153
+ },
154
+ }),
155
+ };
156
+
157
+ // 无帮助按钮
158
+ export const 无帮助按钮 = {
159
+ args: {
160
+ ...基础示例.args,
161
+ showHelpButton: false,
162
+ },
163
+ render: 基础示例.render,
164
+ };
165
+
166
+ // 自定义标题
167
+ export const 自定义标题 = {
168
+ args: {
169
+ ...基础示例.args,
170
+ pageName: '订单管理系统',
171
+ },
172
+ render: 基础示例.render,
173
+ };
174
+
175
+ // 空内容
176
+ export const 空内容 = {
177
+ args: {
178
+ ...基础示例.args,
179
+ },
180
+ render: (args) => ({
181
+ components: { JhPageContainer },
182
+ data() {
183
+ return {
184
+ args,
185
+ };
186
+ },
187
+ template: `
188
+ <jh-page-container
189
+ v-bind="args"
190
+ @help-click="handleHelpClick"
191
+ >
192
+ <template v-slot:content>
193
+ <v-card outlined>
194
+ <v-card-text class="text-center pa-8">
195
+ <v-icon size="64" color="grey lighten-1">mdi-inbox</v-icon>
196
+ <div class="text-h6 grey--text mt-4">暂无数据</div>
197
+ <div class="grey--text text--lighten-1 mt-2">请点击"新增"按钮添加数据</div>
198
+ </v-card-text>
199
+ </v-card>
200
+ </template>
201
+ </jh-page-container>
202
+ `,
203
+ methods: {
204
+ handleHelpClick() {
205
+ alert('帮助按钮被点击');
206
+ },
207
+ },
208
+ }),
209
+ };
@@ -0,0 +1,72 @@
1
+ <template>
2
+ <div>
3
+ <v-app mobile-breakpoint="sm">
4
+ <slot name="menu"></slot>
5
+ <v-main class="mt-15">
6
+ <!-- 头部内容 -->
7
+ <div class="jh-page-second-bar px-3 px-sm-8">
8
+ <v-row class="align-center" no-gutters>
9
+ <!-- 页面标题 -->
10
+ <v-col cols="12" sm="12" md="4" xl="3">
11
+ <div class="py-4 text-body-1 font-weight-bold align-center d-flex align-center">
12
+ {{ pageName }}
13
+ <!-- 帮助页按钮 -->
14
+ <v-icon
15
+ v-if="showHelpButton"
16
+ size="15"
17
+ class="black--text ml-1"
18
+ @click="$emit('help-click')"
19
+ >
20
+ mdi-help-circle
21
+ </v-icon>
22
+ </div>
23
+ </v-col>
24
+
25
+ <!-- 搜索栏插槽 -->
26
+ <v-spacer></v-spacer>
27
+ <v-col cols="12" xs="12" sm="12" md="8" xl="9" class="pl-md-2 mb-2 mb-md-0 flex justify-end">
28
+ <slot name="search-bar"></slot>
29
+ </v-col>
30
+ </v-row>
31
+ </div>
32
+
33
+ <!-- 页面内容 -->
34
+ <div class="jh-page-body-container px-sm-8">
35
+ <v-row class="pa-0 ma-0">
36
+ <v-col class="pa-0" :cols="12">
37
+ <slot name="content"></slot>
38
+ </v-col>
39
+ </v-row>
40
+ </div>
41
+
42
+ <!-- 其他插槽(如抽屉等) -->
43
+ <slot></slot>
44
+
45
+
46
+ </v-main>
47
+ </v-app>
48
+
49
+ <jh-toast />
50
+ <jh-mask />
51
+ <jh-confirm-dialog />
52
+ </div>
53
+ </template>
54
+
55
+ <script>
56
+ export default {
57
+ name: 'JhPageContainer',
58
+ props: {
59
+ // 页面主标题,显示在顶部 Title 区域
60
+ pageName: {
61
+ type: String,
62
+ required: true,
63
+ default: '页面标题'
64
+ },
65
+ // 是否展示右上角的帮助按钮
66
+ showHelpButton: {
67
+ type: Boolean,
68
+ default: true
69
+ }
70
+ }
71
+ };
72
+ </script>
@@ -0,0 +1,77 @@
1
+ # JhQueryFilter - 查询过滤器
2
+
3
+ JhQueryFilter 用于在列表/报表场景中快速搭建多字段筛选区域,内置折叠、查询/重置按钮及字段联动逻辑。
4
+
5
+ ## 功能特性
6
+
7
+ - 🧱 **配置化字段**:复用 JhFormFields,支持 JSON 配置与自定义插槽
8
+ - 🔁 **折叠/展开**:根据 `defaultVisibleCount` 决定初始展示字段,支持展开全部
9
+ - ⚡ **一键查询/重置**:内置按钮区,可插槽重写,也可在字段上配置 `realtime`
10
+ - 🎯 **响应式布局**:`colSpan` 控制 xs/sm/md/lg 列宽,自动适配
11
+ - 🧽 **数据清洗**:查询前自动过滤空值,并抛出 `search` 事件
12
+
13
+ ## 基础用法
14
+
15
+ ```vue
16
+ <template>
17
+ <jh-query-filter
18
+ :fields="fields"
19
+ :initial-values="query"
20
+ :default-visible-count="4"
21
+ @search="handleSearch"
22
+ @reset="handleReset"
23
+ />
24
+ </template>
25
+ ```
26
+
27
+ ## API
28
+
29
+ ### Props
30
+
31
+ | 参数 | 说明 | 类型 | 默认值 |
32
+ | --- | --- | --- | --- |
33
+ | fields | 查询字段配置 | Array | [] |
34
+ | initialValues | 初始查询数据 | Object | `{}` |
35
+ | collapsible | 是否开启折叠 | boolean | true |
36
+ | defaultCollapsed | 默认是否折叠 | boolean | true |
37
+ | defaultVisibleCount | 折叠时展示的字段数 | number | 3 |
38
+ | colSpan | 各断点的列宽设置 | Object | `{ xs:24, sm:12, md:6, lg:4 }` |
39
+ | showLabels | 是否显示字段标签 | boolean | true |
40
+ | dense | 输入框是否紧凑 | boolean | true |
41
+ | filled | 输入框是否 filled | boolean | true |
42
+ | outlined | 输入框是否 outlined | boolean | false |
43
+ | singleLine | 标签是否单行显示 | boolean | true |
44
+ | searchText | 查询按钮文案 | string | `查询` |
45
+ | resetText | 重置按钮文案 | string | `重置` |
46
+ | expandText | 折叠状态下按钮文案 | string | `展开` |
47
+ | collapseText | 展开状态下按钮文案 | string | `收起` |
48
+ | buttonSize | 按钮尺寸 `small/default/large` | string | `small` |
49
+ | buttonAlign | 按钮对齐方式 | string | `left` |
50
+ | loading | 外部 loading 状态 | boolean | false |
51
+ | labelClass | 标签 class | string | `jh-input-label` |
52
+ | inputClass | 输入框 class | string | `jh-v-input` |
53
+ | rowClass | 整体行 class | string | `ma-0` |
54
+ | buttonClass | 按钮容器 class | string | `gap-2` |
55
+ | buttonColumnClass | 操作列 class | string | `''` |
56
+
57
+ ### Events
58
+
59
+ | 事件名 | 说明 | 回调参数 |
60
+ | --- | --- | --- |
61
+ | search | 点击查询或重置后触发,返回过滤后的数据 | (query: object) |
62
+ | reset | 点击重置后触发 | - |
63
+ | field-change | 字段值变化时触发 | ({ key, value, formData }) |
64
+ | collapse-change | 折叠状态切换时触发 | (collapsed: boolean) |
65
+
66
+ ### Slots
67
+
68
+ | 名称 | 说明 |
69
+ | --- | --- |
70
+ | field-`key` | 自定义某个字段的渲染 |
71
+ | buttons | 自定义操作区,参数 `{ formData, search, reset }` |
72
+
73
+ ## 使用建议
74
+
75
+ - 想要实时查询的字段可配置 `realtime: true`,组件会在 `field-change` 内自动触发查询
76
+ - 对于日期范围等复杂字段,可将 `type` 设置为 `slot` 并配合插槽自定义
77
+ - 若需要和表格联动,可在 `@search` 中直接触发 `loadTableData(query)`