hy-virtual-tree 1.1.65 → 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 CHANGED
@@ -1,5 +1,12 @@
1
1
  ## Changelog
2
2
 
3
+ ### 1.1.66
4
+
5
+ _2026-01-23_
6
+
7
+ - 扩展[VirtualTree] 功能
8
+ (1)优化 Tooltip 交互效果
9
+
3
10
  ### 1.1.65
4
11
 
5
12
  _2026-01-23_
package/dist/index.js CHANGED
@@ -171,6 +171,7 @@ class Tooltip {
171
171
  _focus;
172
172
  _timer;
173
173
  _openTimer;
174
+ _closeTimer;
174
175
  constructor(props) {
175
176
  if (!props.bind || !isElement(props.bind))
176
177
  throw Error('【bind参数错误】:请传入元素节点');
@@ -203,6 +204,12 @@ class Tooltip {
203
204
  arrow.classList.add('hy-popper__arrow');
204
205
  el.appendChild(arrow);
205
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
+ });
206
213
  this._focus = setElementFocus({
207
214
  container: bind,
208
215
  trigger: this._config.trigger === 'click' ? 'click' : 'hover',
@@ -213,6 +220,7 @@ class Tooltip {
213
220
  if (this._config?.trigger === 'hover-overflow' && !isOverflowing(this._config.bind))
214
221
  return;
215
222
  this._openTimer && clearTimeout(this._openTimer);
223
+ this._closeTimer && clearTimeout(this._closeTimer);
216
224
  this._openTimer = setTimeout(() => {
217
225
  if (!this._config || !this._el)
218
226
  return;
@@ -233,6 +241,8 @@ class Tooltip {
233
241
  }, this._config.openDelay || 0);
234
242
  },
235
243
  onBlur: () => {
244
+ this._openTimer && clearTimeout(this._openTimer);
245
+ this._closeTimer && clearTimeout(this._closeTimer);
236
246
  this._timer && clearTimeout(this._timer);
237
247
  this.hide();
238
248
  }
@@ -268,10 +278,20 @@ class Tooltip {
268
278
  this._openTimer && clearTimeout(this._openTimer);
269
279
  if (!this._el || !this._el.parentElement)
270
280
  return;
271
- this._el.style.setProperty('top', '-10000px');
272
- this._el.style.setProperty('left', '-10000px');
273
- this._el.parentElement.removeChild(this._el);
274
- this._el.classList.remove('hy-tooltip-show');
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);
275
295
  }
276
296
  destroy() {
277
297
  this._timer && clearTimeout(this._timer);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hy-virtual-tree",
3
- "version": "1.1.65",
3
+ "version": "1.1.66",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite",