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,675 @@
1
+ import JhWaterMark from './JhWaterMark.vue';
2
+
3
+ export default {
4
+ title: '布局/JhWaterMark - 水印',
5
+ component: JhWaterMark,
6
+ tags: ['autodocs'],
7
+ parameters: {
8
+ docs: {
9
+ description: {
10
+ component: '水印组件,参考 Ant Design WaterMark 设计规范。给页面的某个区域加上水印,适用于防止信息盗用。',
11
+ },
12
+ },
13
+ },
14
+ argTypes: {
15
+ content: {
16
+ control: 'text',
17
+ description: '水印文字内容,支持字符串数组实现多行文本',
18
+ table: {
19
+ type: { summary: 'string | string[]' },
20
+ defaultValue: { summary: '' },
21
+ },
22
+ },
23
+ image: {
24
+ control: 'text',
25
+ description: '图片源,建议导出 2 倍或 3 倍图,优先级高于文字',
26
+ table: {
27
+ type: { summary: 'string' },
28
+ defaultValue: { summary: '' },
29
+ },
30
+ },
31
+ width: {
32
+ control: 'number',
33
+ description: '水印整体宽度',
34
+ table: {
35
+ type: { summary: 'number' },
36
+ defaultValue: { summary: '120' },
37
+ },
38
+ },
39
+ height: {
40
+ control: 'number',
41
+ description: '水印整体高度',
42
+ table: {
43
+ type: { summary: 'number' },
44
+ defaultValue: { summary: '64' },
45
+ },
46
+ },
47
+ rotate: {
48
+ control: 'number',
49
+ description: '水印旋转角度',
50
+ table: {
51
+ type: { summary: 'number' },
52
+ defaultValue: { summary: '-22' },
53
+ },
54
+ },
55
+ gapX: {
56
+ control: 'number',
57
+ description: '水印之间的水平间距',
58
+ table: {
59
+ type: { summary: 'number' },
60
+ defaultValue: { summary: '212' },
61
+ },
62
+ },
63
+ gapY: {
64
+ control: 'number',
65
+ description: '水印之间的垂直间距',
66
+ table: {
67
+ type: { summary: 'number' },
68
+ defaultValue: { summary: '222' },
69
+ },
70
+ },
71
+ offsetX: {
72
+ control: 'number',
73
+ description: '水印在 canvas 画布上绘制的水平偏移量,正常情况下,水印绘制在中间位置,即 offsetX = gapX / 2',
74
+ table: {
75
+ type: { summary: 'number' },
76
+ defaultValue: { summary: 'gapX / 2' },
77
+ },
78
+ },
79
+ offsetY: {
80
+ control: 'number',
81
+ description: '水印在 canvas 画布上绘制的垂直偏移量,正常情况下,水印绘制在中间位置,即 offsetY = gapY / 2',
82
+ table: {
83
+ type: { summary: 'number' },
84
+ defaultValue: { summary: 'gapY / 2' },
85
+ },
86
+ },
87
+ font: {
88
+ control: 'object',
89
+ description: '字体配置',
90
+ table: {
91
+ type: { summary: 'object' },
92
+ defaultValue: {
93
+ summary: `{
94
+ color: 'rgba(0, 0, 0, 0.15)',
95
+ fontSize: 16,
96
+ fontWeight: 'normal',
97
+ fontFamily: 'sans-serif',
98
+ fontStyle: 'normal',
99
+ textAlign: 'center'
100
+ }`
101
+ },
102
+ },
103
+ },
104
+ zIndex: {
105
+ control: 'number',
106
+ description: '水印层的 z-index',
107
+ table: {
108
+ type: { summary: 'number' },
109
+ defaultValue: { summary: '9' },
110
+ },
111
+ },
112
+ },
113
+ };
114
+
115
+ // 基础用法
116
+ export const Basic = {
117
+ render: (args) => ({
118
+ components: { JhWaterMark },
119
+ setup() {
120
+ return { args };
121
+ },
122
+ template: `
123
+ <div style="height: 400px;">
124
+ <jh-water-mark v-bind="args" content="江湖 JiangHu">
125
+ <div style="padding: 40px; height: 100%;">
126
+ <h3>基础水印</h3>
127
+ <p>最简单的用法,为页面添加文字水印。</p>
128
+ <p>水印会自动平铺在容器内,并且会防止被删除或修改。</p>
129
+ </div>
130
+ </jh-water-mark>
131
+ </div>
132
+ `,
133
+ }),
134
+ parameters: {
135
+ docs: {
136
+ description: {
137
+ story: '最简单的用法,为页面添加文字水印。',
138
+ },
139
+ },
140
+ },
141
+ };
142
+
143
+ // 多行文本水印
144
+ export const MultiLine = {
145
+ render: () => ({
146
+ components: { JhWaterMark },
147
+ data() {
148
+ return {
149
+ content: ['江湖 JiangHu', 'Watermark Demo'],
150
+ };
151
+ },
152
+ template: `
153
+ <div style="height: 400px;">
154
+ <jh-water-mark :content="content">
155
+ <div style="padding: 40px; height: 100%;">
156
+ <h3>多行文本水印</h3>
157
+ <p>通过设置 content 为字符串数组,可以实现多行文本水印。</p>
158
+ <p>每个数组元素会显示为一行。</p>
159
+ </div>
160
+ </jh-water-mark>
161
+ </div>
162
+ `,
163
+ }),
164
+ parameters: {
165
+ docs: {
166
+ description: {
167
+ story: '通过设置 content 为字符串数组,可以实现多行文本水印。',
168
+ },
169
+ },
170
+ },
171
+ };
172
+
173
+ // 图片水印
174
+ export const ImageWatermark = {
175
+ render: () => ({
176
+ components: { JhWaterMark },
177
+ template: `
178
+ <div style="height: 400px;">
179
+ <jh-water-mark
180
+ :width="130"
181
+ :height="30"
182
+ image="https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*lkAoRbywo0oAAAAAAAAAAAAADrJ8AQ/original"
183
+ >
184
+ <div style="padding: 40px; height: 100%;">
185
+ <h3>图片水印</h3>
186
+ <p>通过 image 属性设置图片水印。</p>
187
+ <p>图片水印的优先级高于文字水印。</p>
188
+ <p>建议使用 2 倍或 3 倍图以保证清晰度。</p>
189
+ </div>
190
+ </jh-water-mark>
191
+ </div>
192
+ `,
193
+ }),
194
+ parameters: {
195
+ docs: {
196
+ description: {
197
+ story: '通过 image 属性设置图片水印,优先级高于文字水印。',
198
+ },
199
+ },
200
+ },
201
+ };
202
+
203
+ // 自定义配置
204
+ export const CustomConfig = {
205
+ render: () => ({
206
+ components: { JhWaterMark },
207
+ data() {
208
+ return {
209
+ font: {
210
+ color: 'rgba(0, 0, 0, 0.25)',
211
+ fontSize: 20,
212
+ fontWeight: 'bold',
213
+ },
214
+ };
215
+ },
216
+ template: `
217
+ <div style="height: 400px;">
218
+ <jh-water-mark
219
+ content="江湖 JiangHu"
220
+ :width="150"
221
+ :height="80"
222
+ :rotate="-30"
223
+ :gap-x="100"
224
+ :gap-y="100"
225
+ :font="font"
226
+ >
227
+ <div style="padding: 40px; height: 100%;">
228
+ <h3>自定义配置</h3>
229
+ <p>可以自定义水印的宽度、高度、旋转角度、间距等。</p>
230
+ <p>也可以通过 font 属性自定义字体样式。</p>
231
+ </div>
232
+ </jh-water-mark>
233
+ </div>
234
+ `,
235
+ }),
236
+ parameters: {
237
+ docs: {
238
+ description: {
239
+ story: '自定义水印的各种配置参数,包括尺寸、旋转角度、间距和字体样式。',
240
+ },
241
+ },
242
+ },
243
+ };
244
+
245
+ // 自定义间距
246
+ export const CustomGap = {
247
+ render: () => ({
248
+ components: { JhWaterMark },
249
+ template: `
250
+ <div style="height: 400px;">
251
+ <jh-water-mark
252
+ content="江湖"
253
+ :gap-x="30"
254
+ :gap-y="30"
255
+ >
256
+ <div style="padding: 40px; height: 100%;">
257
+ <h3>自定义间距</h3>
258
+ <p>通过 gapX 和 gapY 属性可以调整水印之间的间距。</p>
259
+ <p>较小的间距会让水印更密集。</p>
260
+ </div>
261
+ </jh-water-mark>
262
+ </div>
263
+ `,
264
+ }),
265
+ parameters: {
266
+ docs: {
267
+ description: {
268
+ story: '通过 gapX 和 gapY 调整水印之间的水平和垂直间距。',
269
+ },
270
+ },
271
+ },
272
+ };
273
+
274
+ // 自定义偏移量
275
+ export const CustomOffset = {
276
+ render: () => ({
277
+ components: { JhWaterMark },
278
+ template: `
279
+ <div style="height: 400px;">
280
+ <jh-water-mark
281
+ content="江湖 JiangHu"
282
+ :offset-x="50"
283
+ :offset-y="50"
284
+ >
285
+ <div style="padding: 40px; height: 100%;">
286
+ <h3>自定义偏移量</h3>
287
+ <p>通过 offsetX 和 offsetY 可以调整水印的起始位置。</p>
288
+ <p>默认情况下,水印会从容器中心开始绘制。</p>
289
+ </div>
290
+ </jh-water-mark>
291
+ </div>
292
+ `,
293
+ }),
294
+ parameters: {
295
+ docs: {
296
+ description: {
297
+ story: '通过 offsetX 和 offsetY 调整水印的起始绘制位置。',
298
+ },
299
+ },
300
+ },
301
+ };
302
+
303
+ // 自定义旋转角度
304
+ export const CustomRotate = {
305
+ render: () => ({
306
+ components: { JhWaterMark },
307
+ template: `
308
+ <div style="height: 400px;">
309
+ <jh-water-mark
310
+ content="江湖 JiangHu"
311
+ :rotate="0"
312
+ >
313
+ <div style="padding: 40px; height: 100%;">
314
+ <h3>自定义旋转角度</h3>
315
+ <p>通过 rotate 属性可以调整水印的旋转角度。</p>
316
+ <p>此示例设置为 0 度,水印不旋转。</p>
317
+ </div>
318
+ </jh-water-mark>
319
+ </div>
320
+ `,
321
+ }),
322
+ parameters: {
323
+ docs: {
324
+ description: {
325
+ story: '通过 rotate 属性调整水印的旋转角度,默认为 -22 度。',
326
+ },
327
+ },
328
+ },
329
+ };
330
+
331
+ // 自定义字体颜色
332
+ export const CustomColor = {
333
+ render: () => ({
334
+ components: { JhWaterMark },
335
+ data() {
336
+ return {
337
+ font: {
338
+ color: 'rgba(255, 0, 0, 0.2)',
339
+ },
340
+ };
341
+ },
342
+ template: `
343
+ <div style="height: 400px;">
344
+ <jh-water-mark
345
+ content="江湖 JiangHu"
346
+ :font="font"
347
+ >
348
+ <div style="padding: 40px; height: 100%;">
349
+ <h3>自定义字体颜色</h3>
350
+ <p>通过 font.color 属性可以自定义水印的颜色。</p>
351
+ <p>建议使用半透明颜色,避免影响内容阅读。</p>
352
+ </div>
353
+ </jh-water-mark>
354
+ </div>
355
+ `,
356
+ }),
357
+ parameters: {
358
+ docs: {
359
+ description: {
360
+ story: '通过 font.color 自定义水印文字颜色。',
361
+ },
362
+ },
363
+ },
364
+ };
365
+
366
+ // 自定义字体大小
367
+ export const CustomFontSize = {
368
+ render: () => ({
369
+ components: { JhWaterMark },
370
+ data() {
371
+ return {
372
+ font: {
373
+ fontSize: 24,
374
+ fontWeight: 'bold',
375
+ },
376
+ };
377
+ },
378
+ template: `
379
+ <div style="height: 400px;">
380
+ <jh-water-mark
381
+ content="江湖"
382
+ :font="font"
383
+ :width="180"
384
+ :height="100"
385
+ >
386
+ <div style="padding: 40px; height: 100%;">
387
+ <h3>自定义字体大小</h3>
388
+ <p>通过 font.fontSize 和 font.fontWeight 可以调整字体大小和粗细。</p>
389
+ <p>较大的字体需要相应增加 width 和 height。</p>
390
+ </div>
391
+ </jh-water-mark>
392
+ </div>
393
+ `,
394
+ }),
395
+ parameters: {
396
+ docs: {
397
+ description: {
398
+ story: '通过 font.fontSize 和 font.fontWeight 自定义字体大小和粗细。',
399
+ },
400
+ },
401
+ },
402
+ };
403
+
404
+ // 全屏水印
405
+ export const FullScreen = {
406
+ render: () => ({
407
+ components: { JhWaterMark },
408
+ template: `
409
+ <div style="height: 600px; background: #f0f2f5;">
410
+ <jh-water-mark content="江湖 JiangHu">
411
+ <div style="padding: 40px; height: 100%;">
412
+ <h3>全屏水印</h3>
413
+ <p>水印会自动填充整个容器区域。</p>
414
+ <p>适用于需要保护整个页面内容的场景。</p>
415
+ <div style="margin-top: 40px; padding: 20px; background: white; border-radius: 4px;">
416
+ <h4>内容区域 1</h4>
417
+ <p>这是一些需要保护的内容。</p>
418
+ </div>
419
+ <div style="margin-top: 20px; padding: 20px; background: white; border-radius: 4px;">
420
+ <h4>内容区域 2</h4>
421
+ <p>水印会覆盖在所有内容之上。</p>
422
+ </div>
423
+ </div>
424
+ </jh-water-mark>
425
+ </div>
426
+ `,
427
+ }),
428
+ parameters: {
429
+ docs: {
430
+ description: {
431
+ story: '水印会自动填充整个容器区域,适用于全屏保护场景。',
432
+ },
433
+ },
434
+ },
435
+ };
436
+
437
+ // 卡片水印
438
+ export const CardWatermark = {
439
+ render: () => ({
440
+ components: { JhWaterMark },
441
+ template: `
442
+ <div style="background: #f0f2f5; padding: 20px;">
443
+ <div style="background: white; border-radius: 8px; overflow: hidden; max-width: 600px; margin: 0 auto;">
444
+ <jh-water-mark content="机密文档">
445
+ <div style="padding: 40px; min-height: 400px;">
446
+ <h3>机密文档</h3>
447
+ <p><strong>文档编号:</strong>JH-2024-001</p>
448
+ <p><strong>创建时间:</strong>2024年11月9日</p>
449
+ <p><strong>创建人:</strong>张三</p>
450
+ <hr style="margin: 20px 0; border: none; border-top: 1px solid #e8e8e8;">
451
+ <h4>文档内容</h4>
452
+ <p>这是一份需要保护的机密文档内容。</p>
453
+ <p>通过添加水印可以有效防止信息泄露和盗用。</p>
454
+ <p>水印会自动覆盖在内容之上,但不会影响内容的正常阅读。</p>
455
+ </div>
456
+ </jh-water-mark>
457
+ </div>
458
+ </div>
459
+ `,
460
+ }),
461
+ parameters: {
462
+ docs: {
463
+ description: {
464
+ story: '在卡片或特定区域添加水印,适用于文档保护场景。',
465
+ },
466
+ },
467
+ },
468
+ };
469
+
470
+ // 表格水印
471
+ export const TableWatermark = {
472
+ render: () => ({
473
+ components: { JhWaterMark },
474
+ template: `
475
+ <div style="height: 500px;">
476
+ <jh-water-mark content="内部数据" :font="{ color: 'rgba(0, 0, 0, 0.1)' }">
477
+ <div style="padding: 20px; height: 100%;">
478
+ <h3>数据表格</h3>
479
+ <table style="width: 100%; border-collapse: collapse; margin-top: 20px;">
480
+ <thead>
481
+ <tr style="background: #fafafa;">
482
+ <th style="padding: 12px; border: 1px solid #e8e8e8; text-align: left;">姓名</th>
483
+ <th style="padding: 12px; border: 1px solid #e8e8e8; text-align: left;">部门</th>
484
+ <th style="padding: 12px; border: 1px solid #e8e8e8; text-align: left;">职位</th>
485
+ <th style="padding: 12px; border: 1px solid #e8e8e8; text-align: right;">薪资</th>
486
+ </tr>
487
+ </thead>
488
+ <tbody>
489
+ <tr>
490
+ <td style="padding: 12px; border: 1px solid #e8e8e8;">张三</td>
491
+ <td style="padding: 12px; border: 1px solid #e8e8e8;">技术部</td>
492
+ <td style="padding: 12px; border: 1px solid #e8e8e8;">高级工程师</td>
493
+ <td style="padding: 12px; border: 1px solid #e8e8e8; text-align: right;">¥25,000</td>
494
+ </tr>
495
+ <tr>
496
+ <td style="padding: 12px; border: 1px solid #e8e8e8;">李四</td>
497
+ <td style="padding: 12px; border: 1px solid #e8e8e8;">产品部</td>
498
+ <td style="padding: 12px; border: 1px solid #e8e8e8;">产品经理</td>
499
+ <td style="padding: 12px; border: 1px solid #e8e8e8; text-align: right;">¥22,000</td>
500
+ </tr>
501
+ <tr>
502
+ <td style="padding: 12px; border: 1px solid #e8e8e8;">王五</td>
503
+ <td style="padding: 12px; border: 1px solid #e8e8e8;">设计部</td>
504
+ <td style="padding: 12px; border: 1px solid #e8e8e8;">UI设计师</td>
505
+ <td style="padding: 12px; border: 1px solid #e8e8e8; text-align: right;">¥18,000</td>
506
+ </tr>
507
+ </tbody>
508
+ </table>
509
+ </div>
510
+ </jh-water-mark>
511
+ </div>
512
+ `,
513
+ }),
514
+ parameters: {
515
+ docs: {
516
+ description: {
517
+ story: '在表格数据上添加水印,保护敏感数据不被截图泄露。',
518
+ },
519
+ },
520
+ },
521
+ };
522
+
523
+ // 防删除演示
524
+ export const MutationProtection = {
525
+ render: () => ({
526
+ components: { JhWaterMark },
527
+ methods: {
528
+ tryRemoveWatermark() {
529
+ const watermarkLayer = document.querySelector('.jh-watermark-layer');
530
+ if (watermarkLayer) {
531
+ watermarkLayer.remove();
532
+ this.$nextTick(() => {
533
+ alert('水印已被删除,但会自动恢复!请观察页面变化。');
534
+ });
535
+ }
536
+ },
537
+ tryModifyWatermark() {
538
+ const watermarkLayer = document.querySelector('.jh-watermark-layer');
539
+ if (watermarkLayer) {
540
+ watermarkLayer.style.display = 'none';
541
+ this.$nextTick(() => {
542
+ alert('水印已被隐藏,但会自动恢复!请观察页面变化。');
543
+ });
544
+ }
545
+ },
546
+ },
547
+ template: `
548
+ <div style="height: 400px;">
549
+ <jh-water-mark content="防删除保护">
550
+ <div style="padding: 40px; height: 100%;">
551
+ <h3>防删除保护</h3>
552
+ <p>水印组件内置了防删除和防修改机制。</p>
553
+ <p>即使通过开发者工具删除或修改水印元素,也会自动恢复。</p>
554
+ <div style="margin-top: 20px;">
555
+ <button
556
+ @click="tryRemoveWatermark"
557
+ style="padding: 8px 16px; margin-right: 10px; background: #1890ff; color: white; border: none; border-radius: 4px; cursor: pointer;"
558
+ >
559
+ 尝试删除水印
560
+ </button>
561
+ <button
562
+ @click="tryModifyWatermark"
563
+ style="padding: 8px 16px; background: #52c41a; color: white; border: none; border-radius: 4px; cursor: pointer;"
564
+ >
565
+ 尝试隐藏水印
566
+ </button>
567
+ </div>
568
+ <p style="margin-top: 20px; color: #999; font-size: 12px;">
569
+ 提示:点击按钮后,水印会被删除或隐藏,但会立即自动恢复。
570
+ </p>
571
+ </div>
572
+ </jh-water-mark>
573
+ </div>
574
+ `,
575
+ }),
576
+ parameters: {
577
+ docs: {
578
+ description: {
579
+ story: '演示水印的防删除和防修改保护机制,即使被删除也会自动恢复。',
580
+ },
581
+ },
582
+ },
583
+ };
584
+
585
+ // 自定义 z-index
586
+ export const CustomZIndex = {
587
+ render: () => ({
588
+ components: { JhWaterMark },
589
+ template: `
590
+ <div style="height: 400px; position: relative;">
591
+ <jh-water-mark content="背景水印" :z-index="1">
592
+ <div style="padding: 40px; height: 100%; position: relative;">
593
+ <h3>自定义 z-index</h3>
594
+ <p>通过 zIndex 属性可以控制水印的层级。</p>
595
+ <div style="position: relative; z-index: 10; background: white; padding: 20px; margin-top: 20px; border-radius: 4px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">
596
+ <h4>高层级内容</h4>
597
+ <p>这个区域的 z-index 为 10,高于水印层级,所以不会被水印覆盖。</p>
598
+ </div>
599
+ </div>
600
+ </jh-water-mark>
601
+ </div>
602
+ `,
603
+ }),
604
+ parameters: {
605
+ docs: {
606
+ description: {
607
+ story: '通过 zIndex 属性控制水印的层级关系。',
608
+ },
609
+ },
610
+ },
611
+ };
612
+
613
+ // 所有功能组合
614
+ export const AllFeatures = {
615
+ render: () => ({
616
+ components: { JhWaterMark },
617
+ data() {
618
+ return {
619
+ content: ['江湖 JiangHu'],
620
+ font: {
621
+ color: 'rgba(0, 0, 0, 0.2)',
622
+ fontSize: 18,
623
+ fontWeight: 'bold',
624
+ },
625
+ };
626
+ },
627
+ template: `
628
+ <div style="height: 600px; background: #f0f2f5;">
629
+ <jh-water-mark
630
+ :content="content"
631
+ :width="200"
632
+ :height="100"
633
+ :rotate="-25"
634
+ :gap-x="150"
635
+ :gap-y="150"
636
+ :font="font"
637
+ :z-index="9"
638
+ >
639
+ <div style="padding: 40px; height: 100%;">
640
+ <div style="background: white; padding: 30px; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">
641
+ <h3>完整功能演示</h3>
642
+ <p>这是一个包含所有配置选项的完整示例:</p>
643
+ <ul style="margin-top: 20px; line-height: 2;">
644
+ <li>✓ 多行文本水印</li>
645
+ <li>✓ 自定义宽度和高度</li>
646
+ <li>✓ 自定义旋转角度</li>
647
+ <li>✓ 自定义水平和垂直间距</li>
648
+ <li>✓ 自定义字体样式(颜色、大小、粗细)</li>
649
+ <li>✓ 自定义层级</li>
650
+ <li>✓ 防删除和防修改保护</li>
651
+ </ul>
652
+ <div style="margin-top: 30px; padding: 20px; background: #f9f9f9; border-radius: 4px;">
653
+ <h4>使用场景</h4>
654
+ <p>适用于需要版权保护、防止信息泄露的场景,如:</p>
655
+ <ul>
656
+ <li>机密文档</li>
657
+ <li>内部数据报表</li>
658
+ <li>设计稿预览</li>
659
+ <li>敏感信息展示</li>
660
+ </ul>
661
+ </div>
662
+ </div>
663
+ </div>
664
+ </jh-water-mark>
665
+ </div>
666
+ `,
667
+ }),
668
+ parameters: {
669
+ docs: {
670
+ description: {
671
+ story: '包含所有配置选项的完整示例,展示水印组件的全部功能。',
672
+ },
673
+ },
674
+ },
675
+ };