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,190 @@
|
|
|
1
|
+
# JhWaterMark 水印
|
|
2
|
+
|
|
3
|
+
水印组件,参考 Ant Design WaterMark 设计规范。给页面的某个区域加上水印,适用于防止信息盗用。
|
|
4
|
+
|
|
5
|
+
## 何时使用
|
|
6
|
+
|
|
7
|
+
- 页面需要添加水印标识版权时
|
|
8
|
+
- 适用于防止信息盗用的场景
|
|
9
|
+
- 保护敏感数据和机密文档
|
|
10
|
+
|
|
11
|
+
## 基本用法
|
|
12
|
+
|
|
13
|
+
```vue
|
|
14
|
+
<template>
|
|
15
|
+
<jh-water-mark content="江湖 JiangHu">
|
|
16
|
+
<div style="height: 400px;">
|
|
17
|
+
<!-- 你的内容 -->
|
|
18
|
+
</div>
|
|
19
|
+
</jh-water-mark>
|
|
20
|
+
</template>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## 多行文本
|
|
24
|
+
|
|
25
|
+
```vue
|
|
26
|
+
<template>
|
|
27
|
+
<jh-water-mark :content="['江湖 JiangHu', 'Watermark Demo']">
|
|
28
|
+
<div style="height: 400px;">
|
|
29
|
+
<!-- 你的内容 -->
|
|
30
|
+
</div>
|
|
31
|
+
</jh-water-mark>
|
|
32
|
+
</template>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## 图片水印
|
|
36
|
+
|
|
37
|
+
```vue
|
|
38
|
+
<template>
|
|
39
|
+
<jh-water-mark
|
|
40
|
+
:width="130"
|
|
41
|
+
:height="30"
|
|
42
|
+
image="https://example.com/logo.png"
|
|
43
|
+
>
|
|
44
|
+
<div style="height: 400px;">
|
|
45
|
+
<!-- 你的内容 -->
|
|
46
|
+
</div>
|
|
47
|
+
</jh-water-mark>
|
|
48
|
+
</template>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## 自定义配置
|
|
52
|
+
|
|
53
|
+
```vue
|
|
54
|
+
<template>
|
|
55
|
+
<jh-water-mark
|
|
56
|
+
content="江湖 JiangHu"
|
|
57
|
+
:width="150"
|
|
58
|
+
:height="80"
|
|
59
|
+
:rotate="-30"
|
|
60
|
+
:gap-x="100"
|
|
61
|
+
:gap-y="100"
|
|
62
|
+
:font="{
|
|
63
|
+
color: 'rgba(0, 0, 0, 0.25)',
|
|
64
|
+
fontSize: 20,
|
|
65
|
+
fontWeight: 'bold'
|
|
66
|
+
}"
|
|
67
|
+
>
|
|
68
|
+
<div style="height: 400px;">
|
|
69
|
+
<!-- 你的内容 -->
|
|
70
|
+
</div>
|
|
71
|
+
</jh-water-mark>
|
|
72
|
+
</template>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## API
|
|
76
|
+
|
|
77
|
+
### Props
|
|
78
|
+
|
|
79
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
80
|
+
| --- | --- | --- | --- |
|
|
81
|
+
| content | 水印文字内容,支持字符串数组实现多行文本 | `string \| string[]` | `''` |
|
|
82
|
+
| image | 图片源,建议导出 2 倍或 3 倍图,优先级高于文字 | `string` | `''` |
|
|
83
|
+
| width | 水印整体宽度 | `number` | `120` |
|
|
84
|
+
| height | 水印整体高度 | `number` | `64` |
|
|
85
|
+
| rotate | 水印旋转角度 | `number` | `-22` |
|
|
86
|
+
| gapX | 水印之间的水平间距 | `number` | `212` |
|
|
87
|
+
| gapY | 水印之间的垂直间距 | `number` | `222` |
|
|
88
|
+
| offsetX | 水印在 canvas 画布上绘制的水平偏移量,正常情况下,水印绘制在中间位置,即 offsetX = gapX / 2 | `number` | `gapX / 2` |
|
|
89
|
+
| offsetY | 水印在 canvas 画布上绘制的垂直偏移量,正常情况下,水印绘制在中间位置,即 offsetY = gapY / 2 | `number` | `gapY / 2` |
|
|
90
|
+
| font | 字体配置,详见下方 Font 配置 | `object` | 见下方 |
|
|
91
|
+
| zIndex | 水印层的 z-index | `number` | `9` |
|
|
92
|
+
| getContainer | 追加的水印元素的根节点 | `() => HTMLElement` | `undefined` |
|
|
93
|
+
|
|
94
|
+
### Font 配置
|
|
95
|
+
|
|
96
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
97
|
+
| --- | --- | --- | --- |
|
|
98
|
+
| color | 字体颜色 | `string` | `'rgba(0, 0, 0, 0.15)'` |
|
|
99
|
+
| fontSize | 字体大小 | `number` | `16` |
|
|
100
|
+
| fontWeight | 字体粗细 | `string \| number` | `'normal'` |
|
|
101
|
+
| fontFamily | 字体类型 | `string` | `'sans-serif'` |
|
|
102
|
+
| fontStyle | 字体样式 | `'none' \| 'normal' \| 'italic' \| 'oblique'` | `'normal'` |
|
|
103
|
+
| textAlign | 文字对齐 | `string` | `'center'` |
|
|
104
|
+
|
|
105
|
+
## 特性
|
|
106
|
+
|
|
107
|
+
### 防删除保护
|
|
108
|
+
|
|
109
|
+
水印组件内置了防删除和防修改机制,使用 `MutationObserver` 监听 DOM 变化:
|
|
110
|
+
|
|
111
|
+
- 即使通过开发者工具删除水印元素,也会自动恢复
|
|
112
|
+
- 即使修改水印元素的样式,也会自动恢复
|
|
113
|
+
- 保证水印始终存在,有效防止信息泄露
|
|
114
|
+
|
|
115
|
+
### Canvas 渲染
|
|
116
|
+
|
|
117
|
+
使用 Canvas 绘制水印,具有以下优势:
|
|
118
|
+
|
|
119
|
+
- 性能优秀,不影响页面渲染
|
|
120
|
+
- 支持文字和图片两种水印类型
|
|
121
|
+
- 支持自定义旋转角度和间距
|
|
122
|
+
- 生成 base64 图片作为背景,浏览器兼容性好
|
|
123
|
+
|
|
124
|
+
### 响应式
|
|
125
|
+
|
|
126
|
+
水印会自动填充整个容器区域,适应不同尺寸的容器。
|
|
127
|
+
|
|
128
|
+
## 使用场景
|
|
129
|
+
|
|
130
|
+
### 文档保护
|
|
131
|
+
|
|
132
|
+
```vue
|
|
133
|
+
<template>
|
|
134
|
+
<jh-water-mark content="机密文档">
|
|
135
|
+
<div class="document">
|
|
136
|
+
<h3>机密文档</h3>
|
|
137
|
+
<p>文档内容...</p>
|
|
138
|
+
</div>
|
|
139
|
+
</jh-water-mark>
|
|
140
|
+
</template>
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### 数据表格
|
|
144
|
+
|
|
145
|
+
```vue
|
|
146
|
+
<template>
|
|
147
|
+
<jh-water-mark content="内部数据" :font="{ color: 'rgba(0, 0, 0, 0.1)' }">
|
|
148
|
+
<v-data-table :items="items" :headers="headers" />
|
|
149
|
+
</jh-water-mark>
|
|
150
|
+
</template>
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### 图片预览
|
|
154
|
+
|
|
155
|
+
```vue
|
|
156
|
+
<template>
|
|
157
|
+
<jh-water-mark :content="['设计稿', '仅供预览']">
|
|
158
|
+
<img src="design.png" style="width: 100%;" />
|
|
159
|
+
</jh-water-mark>
|
|
160
|
+
</template>
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## 注意事项
|
|
164
|
+
|
|
165
|
+
1. **图片水印**:建议使用 2 倍或 3 倍图以保证清晰度
|
|
166
|
+
2. **颜色选择**:建议使用半透明颜色,避免影响内容阅读
|
|
167
|
+
3. **尺寸调整**:较大的字体需要相应增加 width 和 height
|
|
168
|
+
4. **性能考虑**:水印使用 Canvas 渲染,性能优秀,但在极大容器中可能需要注意
|
|
169
|
+
5. **跨域图片**:使用图片水印时,如果图片跨域,需要服务器配置 CORS
|
|
170
|
+
|
|
171
|
+
## 设计规范
|
|
172
|
+
|
|
173
|
+
本组件完全参考 Ant Design WaterMark 设计规范:
|
|
174
|
+
|
|
175
|
+
- 默认旋转角度:-22°
|
|
176
|
+
- 默认水平间距:212px
|
|
177
|
+
- 默认垂直间距:222px
|
|
178
|
+
- 默认字体颜色:rgba(0, 0, 0, 0.15)
|
|
179
|
+
- 默认字体大小:16px
|
|
180
|
+
- 水印层级:z-index: 9
|
|
181
|
+
|
|
182
|
+
## 浏览器兼容性
|
|
183
|
+
|
|
184
|
+
- 现代浏览器(Chrome、Firefox、Safari、Edge)
|
|
185
|
+
- IE 11+(需要 MutationObserver polyfill)
|
|
186
|
+
|
|
187
|
+
## 相关链接
|
|
188
|
+
|
|
189
|
+
- [Ant Design WaterMark](https://ant.design/components/watermark/)
|
|
190
|
+
- [Ant Design ProComponents](https://procomponents.ant.design/)
|