leafer-x-tooltip-canvas 1.0.0 → 1.0.2
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.en.md +39 -11
- package/README.md +48 -18
- package/dev/bundle.js +191 -12192
- package/dist/index.cjs +181 -10677
- package/dist/index.esm.js +181 -10677
- package/dist/index.esm.min.js +1 -1
- package/dist/index.js +183 -10677
- package/dist/index.min.cjs +1 -1
- package/dist/index.min.js +1 -1
- package/package.json +62 -51
- package/src/Tooltip.ts +12 -10
- package/src/TooltipPlugin.ts +156 -56
- package/src/constants.ts +21 -0
- package/src/defaultConfig.ts +2 -0
- package/src/interface/config.ts +2 -0
- package/src/utils.ts +86 -25
- package/types/index.d.ts +8 -0
package/README.en.md
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
# leafer-x-tooltip-
|
|
1
|
+
# leafer-x-tooltip-canvass
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
English | <a href="./README.md">简体中文</a>
|
|
5
|
-
</p>
|
|
3
|
+
English | [简体中文](./README.md)
|
|
6
4
|
|
|
7
5
|
## Introduction
|
|
8
6
|
|
|
@@ -99,6 +97,18 @@ The specific config options are as follows. Click on the field name to jump to [
|
|
|
99
97
|
<td>[]</td>
|
|
100
98
|
<td>The tags of elements that should not display the tooltip</td>
|
|
101
99
|
</tr>
|
|
100
|
+
<tr>
|
|
101
|
+
<td>throughExcludes</td>
|
|
102
|
+
<td>boolean</td>
|
|
103
|
+
<td>false</td>
|
|
104
|
+
<td>If the plugin while passing through excludesType to pick elements</td>
|
|
105
|
+
</tr>
|
|
106
|
+
<tr>
|
|
107
|
+
<td>ignoreType</td>
|
|
108
|
+
<td>Array<string></td>
|
|
109
|
+
<td>['App','Leafer','Flow']</td>
|
|
110
|
+
<td>Where the tag of the passed elements generally doesn't need modification; the difference from excludesType is that it won't be affected by throughExcludes.</td>
|
|
111
|
+
</tr>
|
|
102
112
|
<tr>
|
|
103
113
|
<td><a href="#offset">offset</a></td>
|
|
104
114
|
<td>Array<number></td>
|
|
@@ -120,9 +130,8 @@ The specific config options are as follows. Click on the field name to jump to [
|
|
|
120
130
|
</tbody>
|
|
121
131
|
</table>
|
|
122
132
|
|
|
123
|
-
|
|
124
|
-
|
|
125
133
|
IStyle Properties
|
|
134
|
+
|
|
126
135
|
<table class="styled-table">
|
|
127
136
|
<tr>
|
|
128
137
|
<th>Field</th>
|
|
@@ -203,11 +212,15 @@ IStyle Properties
|
|
|
203
212
|
- [ ] Virtual Trigger
|
|
204
213
|
|
|
205
214
|
### Config details
|
|
215
|
+
|
|
206
216
|
<a href="#config-overview" class="fixed-right">:dizzy:Config Overview</a>
|
|
207
217
|
|
|
208
218
|
#### Content
|
|
219
|
+
|
|
209
220
|
##### Display Information
|
|
221
|
+
|
|
210
222
|
Configure the displayed attribute fields by passing in the `info` field.
|
|
223
|
+
|
|
211
224
|
<table class="center-table">
|
|
212
225
|
<tr>
|
|
213
226
|
<td>
|
|
@@ -220,7 +233,9 @@ Configure the displayed attribute fields by passing in the `info` field.
|
|
|
220
233
|
</table>
|
|
221
234
|
|
|
222
235
|
##### Display Type
|
|
236
|
+
|
|
223
237
|
Configure the display method of the information, there are two types: `value`,`key-value`.
|
|
238
|
+
|
|
224
239
|
<table class="center-table">
|
|
225
240
|
<tr>
|
|
226
241
|
<td>
|
|
@@ -240,19 +255,24 @@ Configure the display method of the information, there are two types: `value`,`k
|
|
|
240
255
|
</tr>
|
|
241
256
|
</table>
|
|
242
257
|
|
|
243
|
-
##### Formatter
|
|
258
|
+
##### Formatter
|
|
259
|
+
|
|
244
260
|
Configure the formatting function for the information, the parameter is the attribute collection of the element being acted upon. The returned value serves as the text for the tooltip.
|
|
245
261
|
|
|
246
262
|
```js
|
|
247
263
|
formatter: (item) => {
|
|
248
|
-
|
|
264
|
+
return `${item.tag}(${item.innerId})`
|
|
249
265
|
}
|
|
250
266
|
```
|
|
267
|
+
|
|
251
268
|
<img src="./.github/assets/formatter.png">
|
|
252
269
|
|
|
253
270
|
#### Display/Hide
|
|
271
|
+
|
|
254
272
|
##### Delayed Display/Hide
|
|
273
|
+
|
|
255
274
|
Configure the delay time for display and the delay time for hiding.
|
|
275
|
+
|
|
256
276
|
<table class="center-table">
|
|
257
277
|
<tr>
|
|
258
278
|
<td>
|
|
@@ -273,7 +293,9 @@ Configure the delay time for display and the delay time for hiding.
|
|
|
273
293
|
</table>
|
|
274
294
|
|
|
275
295
|
#### Interaction
|
|
296
|
+
|
|
276
297
|
##### Include/Exclude Types
|
|
298
|
+
|
|
277
299
|
Configure the element tags to be displayed/hidden by setting the `includesType` and `excludesType` property.
|
|
278
300
|
|
|
279
301
|
- When only `includesType` is configured, only the elements configured in `includesType` are displayed.
|
|
@@ -291,10 +313,12 @@ Configure the element tags to be displayed/hidden by setting the `includesType`
|
|
|
291
313
|
</tr>
|
|
292
314
|
</table>
|
|
293
315
|
|
|
294
|
-
|
|
295
316
|
#### Style
|
|
317
|
+
|
|
296
318
|
##### Light/Dark Themes
|
|
319
|
+
|
|
297
320
|
The plugin provides two themes by default, `light` and `dark`, which can be switched by configuring the theme field. The default theme is light.
|
|
321
|
+
|
|
298
322
|
<table class="center-table">
|
|
299
323
|
<tr>
|
|
300
324
|
<td>
|
|
@@ -315,8 +339,11 @@ The plugin provides two themes by default, `light` and `dark`, which can be swit
|
|
|
315
339
|
</table>
|
|
316
340
|
|
|
317
341
|
#### Position
|
|
342
|
+
|
|
318
343
|
##### Offset
|
|
344
|
+
|
|
319
345
|
Configure the offset of the tooltip relative to the mouse position, the first parameter is the offset on the x-axis, and the second parameter is the offset on the y-axis.
|
|
346
|
+
|
|
320
347
|
<table class="center-table">
|
|
321
348
|
<tr>
|
|
322
349
|
<td>
|
|
@@ -329,7 +356,9 @@ Configure the offset of the tooltip relative to the mouse position, the first pa
|
|
|
329
356
|
</table>
|
|
330
357
|
|
|
331
358
|
##### Custom Style
|
|
359
|
+
|
|
332
360
|
Users can customize the style by configuring the `style` field.
|
|
361
|
+
|
|
333
362
|
<table class="center-table">
|
|
334
363
|
</table>
|
|
335
364
|
<tr>
|
|
@@ -345,6 +374,7 @@ Users can customize the style by configuring the `style` field.
|
|
|
345
374
|
fontSize: 16,
|
|
346
375
|
fontWeight: 400,
|
|
347
376
|
}
|
|
377
|
+
|
|
348
378
|
</span>
|
|
349
379
|
</td>
|
|
350
380
|
<td>
|
|
@@ -353,10 +383,8 @@ Users can customize the style by configuring the `style` field.
|
|
|
353
383
|
</tr>
|
|
354
384
|
</table>
|
|
355
385
|
|
|
356
|
-
|
|
357
386
|
[Github](https://github.com/214L/leafer-x-popup-canvas)
|
|
358
387
|
|
|
359
|
-
|
|
360
388
|
<style>
|
|
361
389
|
.center-table {
|
|
362
390
|
margin-left: auto;
|
package/README.md
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
# leafer-x-tooltip-canvas
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
<a href='./README.en.md'>English</a> | 简体中文
|
|
5
|
-
</p>
|
|
3
|
+
[English](./README.en.md) | 简体中文
|
|
6
4
|
|
|
7
5
|
## 插件简介
|
|
8
6
|
|
|
@@ -46,6 +44,7 @@ new TooltipPlugin(app, {
|
|
|
46
44
|
```
|
|
47
45
|
|
|
48
46
|
具体配置项如下,点击字段名可转跳至[详细配置](#详细配置)
|
|
47
|
+
|
|
49
48
|
<table class="styled-table jump-table">
|
|
50
49
|
<thead>
|
|
51
50
|
<tr>
|
|
@@ -87,17 +86,29 @@ new TooltipPlugin(app, {
|
|
|
87
86
|
<td>延迟隐藏的时间</td>
|
|
88
87
|
</tr>
|
|
89
88
|
<tr>
|
|
90
|
-
<td><a href="
|
|
89
|
+
<td><a href="#包括排除类型">includesType</a></td>
|
|
91
90
|
<td>Array<string></td>
|
|
92
|
-
<td>[]</td>
|
|
91
|
+
<td>[ ]</td>
|
|
93
92
|
<td>需要显示 tooltip 的元素,传入元素的 tag</td>
|
|
94
93
|
</tr>
|
|
95
94
|
<tr>
|
|
96
|
-
<td><a href="
|
|
95
|
+
<td><a href="#包括排除类型">excludesType</a></td>
|
|
97
96
|
<td>Array<string></td>
|
|
98
|
-
<td>[]</td>
|
|
97
|
+
<td>[ ]</td>
|
|
99
98
|
<td>不需要显示 tooltip 的元素,传入元素的 tag</td>
|
|
100
99
|
</tr>
|
|
100
|
+
<tr>
|
|
101
|
+
<td>throughExcludes</td>
|
|
102
|
+
<td>boolean</td>
|
|
103
|
+
<td>false</td>
|
|
104
|
+
<td>是否穿过excludesType拾取下面的元素</td>
|
|
105
|
+
</tr>
|
|
106
|
+
<tr>
|
|
107
|
+
<td>ignoreType</td>
|
|
108
|
+
<td>Array<string></td>
|
|
109
|
+
<td>['App','Leafer','Flow']</td>
|
|
110
|
+
<td>被忽略的元素,传入元素的 tag,一般不需要修改,与excludesType的区别在于不会被throughExcludes影响。</td>
|
|
111
|
+
</tr>
|
|
101
112
|
<tr>
|
|
102
113
|
<td><a href="#offset">offset</a></td>
|
|
103
114
|
<td>Array<number></td>
|
|
@@ -119,9 +130,8 @@ new TooltipPlugin(app, {
|
|
|
119
130
|
</tbody>
|
|
120
131
|
</table>
|
|
121
132
|
|
|
122
|
-
|
|
123
|
-
|
|
124
133
|
IStyle 属性
|
|
134
|
+
|
|
125
135
|
<table class="styled-table"">
|
|
126
136
|
<tr>
|
|
127
137
|
<th>字段</th>
|
|
@@ -202,11 +212,15 @@ IStyle 属性
|
|
|
202
212
|
- [ ] 虚拟触发
|
|
203
213
|
|
|
204
214
|
### 详细配置
|
|
215
|
+
|
|
205
216
|
<a href="#配置项" class="fixed-right">:dizzy:配置项</a>
|
|
206
217
|
|
|
207
218
|
#### 内容 <a href="#配置项" style="position:relative;right:0">:arrow_up:</a>
|
|
208
|
-
|
|
219
|
+
|
|
220
|
+
##### 显示信息
|
|
221
|
+
|
|
209
222
|
通过传入`info`字段,可配置显示的属性字段。
|
|
223
|
+
|
|
210
224
|
<table class="center-table">
|
|
211
225
|
<tr>
|
|
212
226
|
<td>
|
|
@@ -219,7 +233,9 @@ IStyle 属性
|
|
|
219
233
|
</table>
|
|
220
234
|
|
|
221
235
|
##### 显示类型
|
|
236
|
+
|
|
222
237
|
可配置显示信息的方式,有两种:`value`、`key-value`。
|
|
238
|
+
|
|
223
239
|
<table class="center-table">
|
|
224
240
|
<tr>
|
|
225
241
|
<td>
|
|
@@ -239,18 +255,24 @@ IStyle 属性
|
|
|
239
255
|
</tr>
|
|
240
256
|
</table>
|
|
241
257
|
|
|
242
|
-
##### 格式化
|
|
243
|
-
|
|
258
|
+
##### 格式化
|
|
259
|
+
|
|
260
|
+
可配置显示信息的格式化函数,参数为被作用的元素属性集合。返回的值作为 tooltip 的文本。
|
|
261
|
+
|
|
244
262
|
```js
|
|
245
263
|
formatter: (item) => {
|
|
246
|
-
|
|
264
|
+
return `${item.tag}(${item.innerId})`
|
|
247
265
|
}
|
|
248
266
|
```
|
|
267
|
+
|
|
249
268
|
<img src="./.github/assets/formatter.png">
|
|
250
269
|
|
|
251
270
|
#### 显示隐藏
|
|
271
|
+
|
|
252
272
|
##### 延迟显示隐藏
|
|
273
|
+
|
|
253
274
|
可配置显示的延迟时间和隐藏的延迟时间。
|
|
275
|
+
|
|
254
276
|
<table class="center-table">
|
|
255
277
|
<tr>
|
|
256
278
|
<td>
|
|
@@ -271,8 +293,10 @@ formatter: (item) => {
|
|
|
271
293
|
</table>
|
|
272
294
|
|
|
273
295
|
#### 交互
|
|
296
|
+
|
|
274
297
|
##### 包括/忽略类型
|
|
275
|
-
|
|
298
|
+
|
|
299
|
+
通过配置`includesType`和`excludesType`字段,可设置需要展示/隐藏 tooltip 的元素类型。
|
|
276
300
|
|
|
277
301
|
- 当只配置`includesType`时,只显示`includesType`中配置的元素。
|
|
278
302
|
- 当只配置`excludesType`时,只不显示`excludesType`中配置的元素。
|
|
@@ -289,10 +313,12 @@ formatter: (item) => {
|
|
|
289
313
|
</tr>
|
|
290
314
|
</table>
|
|
291
315
|
|
|
292
|
-
|
|
293
316
|
#### 样式
|
|
317
|
+
|
|
294
318
|
##### 黑白主题
|
|
319
|
+
|
|
295
320
|
插件默认提供两种主题,分别为`light`和`dark`,可以通过配置`theme`字段来切换主题。默认主题为`light`
|
|
321
|
+
|
|
296
322
|
<table class="center-table">
|
|
297
323
|
<tr>
|
|
298
324
|
<td>
|
|
@@ -313,8 +339,11 @@ formatter: (item) => {
|
|
|
313
339
|
</table>
|
|
314
340
|
|
|
315
341
|
#### 位置
|
|
342
|
+
|
|
316
343
|
##### offset
|
|
317
|
-
|
|
344
|
+
|
|
345
|
+
可配置 tooltip 相对于鼠标位置的偏移量,第一个参数为 x 轴偏移量,第二个参数为 y 轴偏移量。
|
|
346
|
+
|
|
318
347
|
<table class="center-table">
|
|
319
348
|
<tr>
|
|
320
349
|
<td>
|
|
@@ -327,7 +356,9 @@ formatter: (item) => {
|
|
|
327
356
|
</table>
|
|
328
357
|
|
|
329
358
|
##### 自定义样式
|
|
359
|
+
|
|
330
360
|
用户通过配置`style`字段来自定义样式。
|
|
361
|
+
|
|
331
362
|
<table class="center-table">
|
|
332
363
|
</table>
|
|
333
364
|
<tr>
|
|
@@ -343,6 +374,7 @@ formatter: (item) => {
|
|
|
343
374
|
fontSize: 16,
|
|
344
375
|
fontWeight: 400,
|
|
345
376
|
}
|
|
377
|
+
|
|
346
378
|
</span>
|
|
347
379
|
</td>
|
|
348
380
|
<td>
|
|
@@ -351,10 +383,8 @@ formatter: (item) => {
|
|
|
351
383
|
</tr>
|
|
352
384
|
</table>
|
|
353
385
|
|
|
354
|
-
|
|
355
386
|
[Github](https://github.com/214L/leafer-x-popup-canvas)
|
|
356
387
|
|
|
357
|
-
|
|
358
388
|
<style>
|
|
359
389
|
.center-table {
|
|
360
390
|
margin-left: auto;
|