hy-virtual-tree 1.1.64 → 1.1.66
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/CHANGELOG.md +15 -0
- package/dist/index.css +5 -0
- package/dist/index.js +53 -21
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
## Changelog
|
|
2
2
|
|
|
3
|
+
### 1.1.66
|
|
4
|
+
|
|
5
|
+
_2026-01-23_
|
|
6
|
+
|
|
7
|
+
- 扩展[VirtualTree] 功能
|
|
8
|
+
(1)优化 Tooltip 交互效果
|
|
9
|
+
|
|
10
|
+
### 1.1.65
|
|
11
|
+
|
|
12
|
+
_2026-01-23_
|
|
13
|
+
|
|
14
|
+
- 扩展[VirtualTree] 功能
|
|
15
|
+
(1)修复树形节点内容添加溢出省略时,移入显示tooltip后,在节点刷新时出现问题
|
|
16
|
+
(2)优化 Tooltip 交互效果
|
|
17
|
+
|
|
3
18
|
### 1.1.64
|
|
4
19
|
|
|
5
20
|
_2026-01-23_
|
package/dist/index.css
CHANGED
|
@@ -14,6 +14,11 @@
|
|
|
14
14
|
background: var(--hy-tooltip-bg);
|
|
15
15
|
border: 1px solid #375C86;
|
|
16
16
|
transform: translateX(-50%) translateY(calc(-100% - 10px));
|
|
17
|
+
opacity: 0;
|
|
18
|
+
transition: opacity 0.2s linear;
|
|
19
|
+
}
|
|
20
|
+
.hy-tooltip.hy-tooltip-show {
|
|
21
|
+
opacity: 1;
|
|
17
22
|
}
|
|
18
23
|
.hy-tooltip.top .hy-popper__arrow {
|
|
19
24
|
left: 50%;
|
package/dist/index.js
CHANGED
|
@@ -170,6 +170,8 @@ class Tooltip {
|
|
|
170
170
|
_config;
|
|
171
171
|
_focus;
|
|
172
172
|
_timer;
|
|
173
|
+
_openTimer;
|
|
174
|
+
_closeTimer;
|
|
173
175
|
constructor(props) {
|
|
174
176
|
if (!props.bind || !isElement(props.bind))
|
|
175
177
|
throw Error('【bind参数错误】:请传入元素节点');
|
|
@@ -181,6 +183,7 @@ class Tooltip {
|
|
|
181
183
|
placement: "top",
|
|
182
184
|
offset: 0,
|
|
183
185
|
trigger: "hover",
|
|
186
|
+
openDelay: 200,
|
|
184
187
|
autoClose: 0,
|
|
185
188
|
...config
|
|
186
189
|
};
|
|
@@ -201,26 +204,45 @@ class Tooltip {
|
|
|
201
204
|
arrow.classList.add('hy-popper__arrow');
|
|
202
205
|
el.appendChild(arrow);
|
|
203
206
|
this._el = el;
|
|
207
|
+
el.addEventListener('mouseenter', () => {
|
|
208
|
+
this._focus && this._focus.focus();
|
|
209
|
+
});
|
|
210
|
+
el.addEventListener('mouseleave', () => {
|
|
211
|
+
this._focus && this._focus.blur();
|
|
212
|
+
});
|
|
204
213
|
this._focus = setElementFocus({
|
|
205
214
|
container: bind,
|
|
206
215
|
trigger: this._config.trigger === 'click' ? 'click' : 'hover',
|
|
207
216
|
onFocus: () => {
|
|
208
217
|
closeActiveTooltip && closeActiveTooltip();
|
|
209
|
-
if (!this._el)
|
|
218
|
+
if (!this._el || !this._config)
|
|
210
219
|
return;
|
|
211
220
|
if (this._config?.trigger === 'hover-overflow' && !isOverflowing(this._config.bind))
|
|
212
221
|
return;
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
this.
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
+
this._openTimer && clearTimeout(this._openTimer);
|
|
223
|
+
this._closeTimer && clearTimeout(this._closeTimer);
|
|
224
|
+
this._openTimer = setTimeout(() => {
|
|
225
|
+
if (!this._config || !this._el)
|
|
226
|
+
return;
|
|
227
|
+
const container = getContainer$1();
|
|
228
|
+
container.appendChild(this._el);
|
|
229
|
+
setTimeout(() => {
|
|
230
|
+
if (!this._el)
|
|
231
|
+
return;
|
|
232
|
+
this._el.classList.add('hy-tooltip-show');
|
|
233
|
+
});
|
|
234
|
+
this.setPopper();
|
|
235
|
+
if (this._config?.autoClose && isNumber(this._config.autoClose)) {
|
|
236
|
+
this._timer && clearTimeout(this._timer);
|
|
237
|
+
this._timer = setTimeout(() => {
|
|
238
|
+
this._focus && this._focus.blur();
|
|
239
|
+
}, this._config?.autoClose);
|
|
240
|
+
}
|
|
241
|
+
}, this._config.openDelay || 0);
|
|
222
242
|
},
|
|
223
243
|
onBlur: () => {
|
|
244
|
+
this._openTimer && clearTimeout(this._openTimer);
|
|
245
|
+
this._closeTimer && clearTimeout(this._closeTimer);
|
|
224
246
|
this._timer && clearTimeout(this._timer);
|
|
225
247
|
this.hide();
|
|
226
248
|
}
|
|
@@ -253,11 +275,23 @@ class Tooltip {
|
|
|
253
275
|
closeActiveTooltip = this.hide.bind(this);
|
|
254
276
|
}
|
|
255
277
|
hide() {
|
|
278
|
+
this._openTimer && clearTimeout(this._openTimer);
|
|
256
279
|
if (!this._el || !this._el.parentElement)
|
|
257
280
|
return;
|
|
258
|
-
this.
|
|
259
|
-
this.
|
|
260
|
-
|
|
281
|
+
this._closeTimer && clearTimeout(this._closeTimer);
|
|
282
|
+
this._closeTimer = setTimeout(() => {
|
|
283
|
+
if (!this._el || !this._el.parentElement)
|
|
284
|
+
return;
|
|
285
|
+
this._el.classList.remove('hy-tooltip-show');
|
|
286
|
+
this._closeTimer && clearTimeout(this._closeTimer);
|
|
287
|
+
this._closeTimer = setTimeout(() => {
|
|
288
|
+
if (!this._el || !this._el.parentElement)
|
|
289
|
+
return;
|
|
290
|
+
this._el.style.setProperty('top', '-10000px');
|
|
291
|
+
this._el.style.setProperty('left', '-10000px');
|
|
292
|
+
this._el.parentElement.removeChild(this._el);
|
|
293
|
+
}, 200);
|
|
294
|
+
}, 200);
|
|
261
295
|
}
|
|
262
296
|
destroy() {
|
|
263
297
|
this._timer && clearTimeout(this._timer);
|
|
@@ -1962,16 +1996,17 @@ const useContent = (data, node) => {
|
|
|
1962
1996
|
const el = document.createElement('div');
|
|
1963
1997
|
el.innerHTML = node.label || '';
|
|
1964
1998
|
if (node.label) {
|
|
1965
|
-
|
|
1999
|
+
new Tooltip({
|
|
1966
2000
|
bind: el,
|
|
1967
2001
|
content: node.label,
|
|
1968
2002
|
placement: 'top',
|
|
1969
2003
|
trigger: 'hover-overflow'
|
|
1970
2004
|
});
|
|
1971
|
-
// @ts-ignore
|
|
1972
|
-
el.$destroy = () => {
|
|
1973
|
-
|
|
1974
|
-
|
|
2005
|
+
// // @ts-ignore
|
|
2006
|
+
// el.$destroy = () => {
|
|
2007
|
+
// tooltip.hide()
|
|
2008
|
+
// tooltip && tooltip.destroy()
|
|
2009
|
+
// }
|
|
1975
2010
|
}
|
|
1976
2011
|
return el;
|
|
1977
2012
|
};
|
|
@@ -9163,9 +9198,6 @@ class VirtualTree {
|
|
|
9163
9198
|
let value, el, $destroy;
|
|
9164
9199
|
if (!fn || !isFunction(fn)) {
|
|
9165
9200
|
value = defaultFn && isFunction(defaultFn) && defaultFn(node.data, node);
|
|
9166
|
-
if (value) {
|
|
9167
|
-
$destroy = value.$destroy;
|
|
9168
|
-
}
|
|
9169
9201
|
}
|
|
9170
9202
|
else {
|
|
9171
9203
|
let dom = fn(node.data, node);
|