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,191 @@
1
+ import JhMarkdownEditor from './JhMarkdownEditor.vue';
2
+
3
+ export default {
4
+ title: '基础组件/JhMarkdownEditor - Markdown编辑器',
5
+ component: JhMarkdownEditor,
6
+ tags: ['autodocs'],
7
+ argTypes: {
8
+ value: {
9
+ control: 'text',
10
+ description: 'Markdown 内容',
11
+ },
12
+ placeholder: {
13
+ control: 'text',
14
+ description: '占位符文本',
15
+ },
16
+ height: {
17
+ control: 'text',
18
+ description: '编辑器高度',
19
+ },
20
+ width: {
21
+ control: 'number',
22
+ description: '编辑器宽度百分比',
23
+ },
24
+ editorPath: {
25
+ control: 'text',
26
+ description: 'Editor.md 库文件路径',
27
+ },
28
+ readonly: {
29
+ control: 'boolean',
30
+ description: '是否只读模式',
31
+ },
32
+ // 定义事件处理器
33
+ onInput: { action: 'input' },
34
+ onChange: { action: 'change' },
35
+ onContentForSeo: { action: 'content-for-seo' },
36
+ },
37
+ parameters: {
38
+ docs: {
39
+ description: {
40
+ component: `
41
+
42
+ 基于 Editor.md 的 Markdown 编辑器组件。
43
+
44
+ ## 使用前提
45
+
46
+ 需要在 HTML 中引入 Editor.md 库:
47
+
48
+ \`\`\`html
49
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/editor.md@1.5.0/css/editormd.min.css">
50
+ <script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js"></script>
51
+ <script src="https://cdn.jsdelivr.net/npm/editor.md@1.5.0/editormd.min.js"></script>
52
+ \`\`\`
53
+
54
+ ## 功能特性
55
+
56
+ - 支持实时预览
57
+ - 支持代码高亮
58
+ - 支持表格、图片、链接等
59
+ - 支持撤销/重做
60
+ - 支持全屏编辑
61
+ - 支持只读模式
62
+
63
+ ## 事件
64
+
65
+ - \`@input\` - 内容变化时触发,返回 Markdown 文本
66
+ - \`@change\` - 内容变化时触发,返回 Markdown 文本
67
+ - \`@content-for-seo\` - 内容变化时触发,返回预览 HTML(用于 SEO)
68
+ `,
69
+ },
70
+ },
71
+ },
72
+ };
73
+
74
+ const sampleMarkdown = `# Markdown 编辑器示例
75
+
76
+ ## 功能特性
77
+
78
+ 这是一个基于 **Editor.md** 的 Markdown 编辑器组件。
79
+
80
+ ### 支持的功能
81
+
82
+ - **粗体文本**
83
+ - *斜体文本*
84
+ - ~~删除线~~
85
+ - \`行内代码\`
86
+
87
+ ### 代码块
88
+
89
+ \`\`\`javascript
90
+ function hello() {
91
+ console.log('Hello, JianghuJS!');
92
+ }
93
+ \`\`\`
94
+
95
+ ### 列表
96
+
97
+ 1. 有序列表项 1
98
+ 2. 有序列表项 2
99
+ 3. 有序列表项 3
100
+
101
+ - 无序列表项
102
+ - 无序列表项
103
+ - 无序列表项
104
+
105
+ ### 引用
106
+
107
+ > 这是一段引用文本
108
+ > 可以跨多行
109
+
110
+ ### 链接和图片
111
+
112
+ [JianghuJS](https://github.com/jianghujs)
113
+
114
+ ### 表格
115
+
116
+ | 列1 | 列2 | 列3 |
117
+ |-----|-----|-----|
118
+ | 数据1 | 数据2 | 数据3 |
119
+ | 数据4 | 数据5 | 数据6 |
120
+ `;
121
+
122
+ export const 基础示例 = {
123
+ args: {
124
+ value: sampleMarkdown,
125
+ placeholder: '请输入 Markdown 内容...',
126
+ height: '500px',
127
+ width: 100,
128
+ editorPath: '/public/plugins/editor.md/lib/',
129
+ readonly: false,
130
+ },
131
+ };
132
+
133
+ export const 空内容 = {
134
+ args: {
135
+ value: '',
136
+ placeholder: '开始编写你的文档...',
137
+ height: '400px',
138
+ width: 100,
139
+ editorPath: '/public/plugins/editor.md/lib/',
140
+ readonly: false,
141
+ },
142
+ };
143
+
144
+ export const 只读模式 = {
145
+ args: {
146
+ value: `# 只读模式示例
147
+
148
+ 这是一个只读的 Markdown 文档。
149
+
150
+ 你可以查看内容,但**无法编辑**。
151
+
152
+ \`\`\`javascript
153
+ // 代码示例
154
+ const readonly = true;
155
+ \`\`\`
156
+ `,
157
+ placeholder: '',
158
+ height: '400px',
159
+ width: 100,
160
+ editorPath: '/public/plugins/editor.md/lib/',
161
+ readonly: true,
162
+ },
163
+ };
164
+
165
+ export const 简化工具栏 = {
166
+ args: {
167
+ value: '# 简化工具栏\n\n这个编辑器使用了简化的工具栏。',
168
+ placeholder: '请输入内容...',
169
+ height: '400px',
170
+ width: 100,
171
+ editorPath: '/public/plugins/editor.md/lib/',
172
+ readonly: false,
173
+ toolbarIcons: [
174
+ "undo", "redo", "|",
175
+ "bold", "italic", "|",
176
+ "h1", "h2", "h3", "|",
177
+ "link", "image"
178
+ ],
179
+ },
180
+ };
181
+
182
+ export const 自定义高度 = {
183
+ args: {
184
+ value: '# 自定义高度\n\n这个编辑器的高度是 300px。',
185
+ placeholder: '请输入内容...',
186
+ height: '300px',
187
+ width: 100,
188
+ editorPath: '/public/plugins/editor.md/lib/',
189
+ readonly: false,
190
+ },
191
+ };
@@ -0,0 +1,188 @@
1
+ <template>
2
+ <v-app>
3
+ <v-container fluid class="pa-0">
4
+ <div>
5
+ <div :style="`overflow-y: auto; height: ${height}`">
6
+ <div :id="editorId">
7
+ <textarea style="display:none;">{{ value }}</textarea>
8
+ </div>
9
+ </div>
10
+ </div>
11
+ </v-container>
12
+ </v-app>
13
+ </template>
14
+
15
+ <script>
16
+ export default {
17
+ name: 'JhMarkdownEditor',
18
+ props: {
19
+ // 双向绑定的 Markdown 文本内容
20
+ value: {
21
+ type: String,
22
+ default: ""
23
+ },
24
+ // 编辑器空状态提示
25
+ placeholder: {
26
+ type: String,
27
+ default: "请输入内容..."
28
+ },
29
+ // 编辑器容器高度
30
+ height: {
31
+ type: String,
32
+ default: 'calc(100vh - 400px)'
33
+ },
34
+ // 编辑器容器宽度百分比
35
+ width: {
36
+ type: Number,
37
+ default: 100
38
+ },
39
+ // Editor.md 依赖库的静态资源路径
40
+ editorPath: {
41
+ type: String,
42
+ default: '/public/plugins/editor.md/lib/'
43
+ },
44
+ // 自定义工具栏按钮列表
45
+ toolbarIcons: {
46
+ type: Array,
47
+ default: () => [
48
+ "undo", "redo", "|",
49
+ "watch", "preview", "|",
50
+ "h1", "h2", "h3", "h4", "h5",
51
+ "bold", "del", "italic", "quote", "mark",
52
+ "list-ul", "list-ol", "hr", "link",
53
+ "|", "image", "code", "table"
54
+ ]
55
+ },
56
+ // 是否只读模式(禁用编辑)
57
+ readonly: {
58
+ type: Boolean,
59
+ default: false
60
+ }
61
+ },
62
+ data() {
63
+ return {
64
+ editor: null,
65
+ isMDChange: false,
66
+ editorId: `markdown-editor-${Math.random().toString(36).substr(2, 9)}`
67
+ };
68
+ },
69
+ mounted() {
70
+ this.$nextTick(() => {
71
+ this.initEditorMd();
72
+ });
73
+ },
74
+ beforeDestroy() {
75
+ if (this.editor) {
76
+ // 清理编辑器实例
77
+ this.editor = null;
78
+ }
79
+ },
80
+ watch: {
81
+ value(newVal) {
82
+ if (this.editor && !this.isMDChange) {
83
+ this.editor.setMarkdown(newVal);
84
+ }
85
+ this.isMDChange = false;
86
+ }
87
+ },
88
+ methods: {
89
+ initEditorMd() {
90
+ const that = this;
91
+ const editorElement = document.getElementById(this.editorId);
92
+
93
+ if (!editorElement) {
94
+ console.warn('Editor container not found');
95
+ return;
96
+ }
97
+
98
+ if (!window.editormd) {
99
+ console.warn('Editor.md is not loaded. Please include Editor.md library.');
100
+ return;
101
+ }
102
+
103
+ editorElement.innerHTML = `<textarea style="display:none;">${this.value || ""}</textarea>`;
104
+
105
+ that.editor = window.editormd(this.editorId, {
106
+ watch: !this.readonly,
107
+ saveHTMLToTextarea: true,
108
+ path: this.editorPath,
109
+ toolbarIcons: this.toolbarIcons,
110
+ placeholder: this.placeholder,
111
+ readOnly: this.readonly,
112
+ onchange: function () {
113
+ that.handleMDChange();
114
+ },
115
+ });
116
+ },
117
+
118
+ handleMDChange() {
119
+ this.isMDChange = true;
120
+ const content = this.editor.getMarkdown();
121
+ this.$emit('input', content);
122
+ this.$emit('change', content);
123
+
124
+ // 获取预览 HTML
125
+ if (this.editor.getPreviewedHTML) {
126
+ const contentForSeo = this.editor.getPreviewedHTML();
127
+ this.$emit('content-for-seo', contentForSeo);
128
+ }
129
+ },
130
+
131
+ // 公开方法
132
+ getMarkdown() {
133
+ return this.editor ? this.editor.getMarkdown() : this.value;
134
+ },
135
+
136
+ setMarkdown(content) {
137
+ if (this.editor) {
138
+ this.editor.setMarkdown(content);
139
+ }
140
+ },
141
+
142
+ insertValue(text) {
143
+ if (this.editor) {
144
+ this.editor.insertValue(text);
145
+ }
146
+ }
147
+ }
148
+ };
149
+ </script>
150
+
151
+ <style scoped>
152
+ :deep(.editormd),
153
+ :deep(.CodeMirror-gutters),
154
+ :deep(.editormd-toolbar),
155
+ :deep(.editormd .CodeMirror),
156
+ :deep(.editormd-menu > li.divider),
157
+ :deep(.editormd-menu > li > a:hover),
158
+ :deep(.editormd-menu > li > a.active) {
159
+ border-color: #eff2f5 !important;
160
+ }
161
+
162
+ :deep(.CodeMirror-gutter) {
163
+ background-color: #fff;
164
+ }
165
+
166
+ :deep(.CodeMirror-scroll) {
167
+ overflow-x: hidden !important;
168
+ }
169
+
170
+ :deep(.editormd-dialog-close) {
171
+ color: #3F4254 !important;
172
+ }
173
+
174
+ :deep(.editormd-preview-container ol.linenums li),
175
+ :deep(.editormd-html-preview ol.linenums li) {
176
+ list-style-type: none;
177
+ }
178
+
179
+ :deep(.editormd-preview-container ol.linenums),
180
+ :deep(.editormd-html-preview ol.linenums) {
181
+ color: #999;
182
+ padding-left: 0;
183
+ }
184
+
185
+ :deep(.editormd) {
186
+ margin-bottom: 0;
187
+ }
188
+ </style>
@@ -0,0 +1,62 @@
1
+ # JhMask - 遮罩层组件
2
+
3
+ JhMask 基于 Vuetify `v-overlay` 封装,可用于页面 loading、全屏提示或阻断操作等场景。
4
+
5
+ ## 功能特性
6
+
7
+ - 🌗 **背景可配**:颜色、透明度、zIndex 均可通过 props 设置
8
+ - ⏱️ **自动超时**:`timeout` 到期自动关闭并触发事件
9
+ - 🔁 **loading 集成**:内置进度环,也可通过插槽放置自定义内容
10
+ - 🖱️ **点击交互**:`closeOnClick` 允许点击遮罩直接关闭
11
+ - 🔒 **受控显示**:`v-model` 与父组件保持同步
12
+
13
+ ## 基础用法
14
+
15
+ ```vue
16
+ <template>
17
+ <jh-mask
18
+ v-model="maskVisible"
19
+ :show-loading="true"
20
+ loading-color="success"
21
+ :timeout="10000"
22
+ @timeout="handleTimeout"
23
+ />
24
+ </template>
25
+ ```
26
+
27
+ ## API
28
+
29
+ ### Props
30
+
31
+ | 参数 | 说明 | 类型 | 默认值 |
32
+ | --- | --- | --- | --- |
33
+ | value | `v-model`,控制是否显示 | boolean | false |
34
+ | color | 背景色 | string | `#e3e3e3` |
35
+ | opacity | 透明度 0-1 | number \| string | 0.8 |
36
+ | zIndex | 遮罩层层级 | number \| string | 300 |
37
+ | showLoading | 是否显示内置 loading | boolean | false |
38
+ | loadingSize | loading 直径 | number \| string | 64 |
39
+ | loadingWidth | loading 线宽 | number \| string | 7 |
40
+ | loadingColor | loading 颜色 | string | `primary` |
41
+ | closeOnClick | 点击遮罩是否关闭 | boolean | false |
42
+ | timeout | 自动关闭时间(ms),0 表示不自动关闭 | number | 0 |
43
+
44
+ ### Events
45
+
46
+ | 事件名 | 说明 | 回调参数 |
47
+ | --- | --- | --- |
48
+ | input | `v-model` 更新事件 | (visible: boolean) |
49
+ | click | 在 `closeOnClick`=true 且被点击时触发 | - |
50
+ | timeout | 达到超时时间自动触发 | - |
51
+
52
+ ### Slots
53
+
54
+ | 名称 | 说明 |
55
+ | --- | --- |
56
+ | default | 自定义遮罩内容,可放置提示文案或自定义 loading |
57
+
58
+ ## 使用建议
59
+
60
+ - 需要阻断用户操作时建议 `closeOnClick=false` 并增加提示文案
61
+ - 当与异步任务绑定时,可在任务完成后手动将 `value` 设为 false 以取消遮罩
62
+ - 通过插槽配合 `JhToast` 等组件可以快速实现“处理中”提示
@@ -0,0 +1,270 @@
1
+ import JhMask from './JhMask.vue';
2
+
3
+ export default {
4
+ title: '基础组件/JhMask - 遮罩层',
5
+ component: JhMask,
6
+ tags: ['autodocs'],
7
+ argTypes: {
8
+ value: {
9
+ control: 'boolean',
10
+ description: '是否显示遮罩层',
11
+ table: {
12
+ defaultValue: { summary: 'false' },
13
+ },
14
+ },
15
+ color: {
16
+ control: 'color',
17
+ description: '背景颜色',
18
+ table: {
19
+ defaultValue: { summary: '#e3e3e3' },
20
+ },
21
+ },
22
+ opacity: {
23
+ control: { type: 'range', min: 0, max: 1, step: 0.1 },
24
+ description: '透明度 (0-1)',
25
+ table: {
26
+ defaultValue: { summary: '0.8' },
27
+ },
28
+ },
29
+ zIndex: {
30
+ control: 'number',
31
+ description: 'z-index 层级',
32
+ table: {
33
+ defaultValue: { summary: '300' },
34
+ },
35
+ },
36
+ showLoading: {
37
+ control: 'boolean',
38
+ description: '是否显示 loading 动画',
39
+ table: {
40
+ defaultValue: { summary: 'false' },
41
+ },
42
+ },
43
+ loadingSize: {
44
+ control: 'number',
45
+ description: 'loading 动画大小',
46
+ table: {
47
+ defaultValue: { summary: '64' },
48
+ },
49
+ },
50
+ loadingWidth: {
51
+ control: 'number',
52
+ description: 'loading 动画线条宽度',
53
+ table: {
54
+ defaultValue: { summary: '7' },
55
+ },
56
+ },
57
+ loadingColor: {
58
+ control: 'select',
59
+ options: ['primary', 'secondary', 'success', 'error', 'warning', 'info', 'white'],
60
+ description: 'loading 动画颜色',
61
+ table: {
62
+ defaultValue: { summary: 'primary' },
63
+ },
64
+ },
65
+ closeOnClick: {
66
+ control: 'boolean',
67
+ description: '点击遮罩是否关闭',
68
+ table: {
69
+ defaultValue: { summary: 'false' },
70
+ },
71
+ },
72
+ timeout: {
73
+ control: 'number',
74
+ description: '自动关闭时间(毫秒), 0表示不自动关闭',
75
+ table: {
76
+ defaultValue: { summary: '0' },
77
+ },
78
+ },
79
+ },
80
+ };
81
+
82
+ // 基础示例
83
+ export const 基础示例 = {
84
+ args: {
85
+ value: true,
86
+ },
87
+ render: (args) => ({
88
+ components: { JhMask },
89
+ data() {
90
+ return {
91
+ isVisible: args.value,
92
+ };
93
+ },
94
+ template: `
95
+ <div>
96
+ <v-btn @click="isVisible = !isVisible">切换遮罩</v-btn>
97
+ <jh-mask
98
+ v-model="isVisible"
99
+ v-bind="$props"
100
+ />
101
+ </div>
102
+ `,
103
+ props: Object.keys(args),
104
+ }),
105
+ };
106
+
107
+ // 加载动画
108
+ export const 加载动画 = {
109
+ args: {
110
+ value: true,
111
+ showLoading: true,
112
+ },
113
+ render: (args) => ({
114
+ components: { JhMask },
115
+ data() {
116
+ return {
117
+ isVisible: args.value,
118
+ };
119
+ },
120
+ template: `
121
+ <div>
122
+ <v-btn @click="isVisible = !isVisible">切换遮罩</v-btn>
123
+ <jh-mask
124
+ v-model="isVisible"
125
+ v-bind="$props"
126
+ />
127
+ </div>
128
+ `,
129
+ props: Object.keys(args),
130
+ }),
131
+ };
132
+
133
+ // 点击关闭
134
+ export const 点击关闭 = {
135
+ args: {
136
+ value: true,
137
+ closeOnClick: true,
138
+ showLoading: true,
139
+ },
140
+ render: (args) => ({
141
+ components: { JhMask },
142
+ data() {
143
+ return {
144
+ isVisible: args.value,
145
+ };
146
+ },
147
+ template: `
148
+ <div>
149
+ <v-btn @click="isVisible = !isVisible">切换遮罩</v-btn>
150
+ <p class="mt-2 text-caption">点击遮罩可关闭</p>
151
+ <jh-mask
152
+ v-model="isVisible"
153
+ v-bind="$props"
154
+ />
155
+ </div>
156
+ `,
157
+ props: Object.keys(args),
158
+ }),
159
+ };
160
+
161
+ // 自动关闭
162
+ export const 自动关闭 = {
163
+ args: {
164
+ value: true,
165
+ showLoading: true,
166
+ timeout: 3000,
167
+ },
168
+ render: (args) => ({
169
+ components: { JhMask },
170
+ data() {
171
+ return {
172
+ isVisible: args.value,
173
+ };
174
+ },
175
+ template: `
176
+ <div>
177
+ <v-btn @click="isVisible = true">显示遮罩(3秒后自动关闭)</v-btn>
178
+ <jh-mask
179
+ v-model="isVisible"
180
+ v-bind="$props"
181
+ @timeout="handleTimeout"
182
+ />
183
+ </div>
184
+ `,
185
+ methods: {
186
+ handleTimeout() {
187
+ console.log('遮罩已自动关闭');
188
+ },
189
+ },
190
+ props: Object.keys(args),
191
+ }),
192
+ };
193
+
194
+ // 自定义内容
195
+ export const 自定义内容 = {
196
+ args: {
197
+ value: true,
198
+ },
199
+ render: (args) => ({
200
+ components: { JhMask },
201
+ data() {
202
+ return {
203
+ isVisible: args.value,
204
+ };
205
+ },
206
+ template: `
207
+ <div>
208
+ <v-btn @click="isVisible = !isVisible">切换遮罩</v-btn>
209
+ <jh-mask
210
+ v-model="isVisible"
211
+ v-bind="$props"
212
+ >
213
+ <v-card width="300">
214
+ <v-card-title>自定义内容</v-card-title>
215
+ <v-card-text>这是自定义的遮罩内容</v-card-text>
216
+ <v-card-actions>
217
+ <v-spacer></v-spacer>
218
+ <v-btn color="primary" @click="isVisible = false">关闭</v-btn>
219
+ </v-card-actions>
220
+ </v-card>
221
+ </jh-mask>
222
+ </div>
223
+ `,
224
+ props: Object.keys(args),
225
+ }),
226
+ };
227
+
228
+ // 不同颜色
229
+ export const 不同颜色 = {
230
+ render: () => ({
231
+ components: { JhMask },
232
+ data() {
233
+ return {
234
+ mask1: false,
235
+ mask2: false,
236
+ mask3: false,
237
+ };
238
+ },
239
+ template: `
240
+ <div>
241
+ <v-btn class="mr-2" @click="mask1 = !mask1">白色遮罩</v-btn>
242
+ <v-btn class="mr-2" @click="mask2 = !mask2">黑色遮罩</v-btn>
243
+ <v-btn @click="mask3 = !mask3">蓝色遮罩</v-btn>
244
+
245
+ <jh-mask
246
+ v-model="mask1"
247
+ color="white"
248
+ :opacity="0.9"
249
+ show-loading
250
+ />
251
+
252
+ <jh-mask
253
+ v-model="mask2"
254
+ color="black"
255
+ :opacity="0.7"
256
+ show-loading
257
+ loading-color="white"
258
+ />
259
+
260
+ <jh-mask
261
+ v-model="mask3"
262
+ color="primary"
263
+ :opacity="0.5"
264
+ show-loading
265
+ loading-color="white"
266
+ />
267
+ </div>
268
+ `,
269
+ }),
270
+ };