hy-virtual-tree 2.0.9 → 2.0.10

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,11 @@
1
1
  ## Changelog
2
2
 
3
+ ### 2.0.10
4
+
5
+ _2026-03-20_
6
+
7
+ (1)优化Tooltip销毁逻辑
8
+
3
9
  ### 2.0.9
4
10
 
5
11
  _2026-03-20_
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /* hy-virtual-tree v2.0.9 */
1
+ /* hy-virtual-tree v2.0.10 */
2
2
  import './svg_bundle.js';
3
3
  const isString = (e) => typeof e === 'string';
4
4
  const isNumber = (e) => typeof e === 'number';
@@ -7028,7 +7028,6 @@ class Tooltip {
7028
7028
  _closeTimer;
7029
7029
  _style = getGlobalTooltipConfig().style;
7030
7030
  _isHover = false;
7031
- _isDestroy = false;
7032
7031
  constructor(props) {
7033
7032
  if (!props.bind || !isElement(props.bind))
7034
7033
  throw Error('【bind参数错误】:请传入元素节点');
@@ -7065,7 +7064,7 @@ class Tooltip {
7065
7064
  el.appendChild(arrow);
7066
7065
  this._el = el;
7067
7066
  el.addEventListener('mouseenter', (e) => {
7068
- if (this._isDestroy || this.isHover)
7067
+ if (this.isHover)
7069
7068
  return;
7070
7069
  this.setIsHover(true);
7071
7070
  this._closeTimer && clearTimeout(this._closeTimer);
@@ -7074,7 +7073,7 @@ class Tooltip {
7074
7073
  el.addEventListener('mouseleave', (e) => {
7075
7074
  this._openTimer && clearTimeout(this._openTimer);
7076
7075
  this.setIsHover(false);
7077
- this.hide();
7076
+ this.hide(e.target);
7078
7077
  });
7079
7078
  this._trigger = new Trigger({
7080
7079
  el: this._el,
@@ -7082,7 +7081,7 @@ class Tooltip {
7082
7081
  trigger: this._config.trigger === 'click' ? 'click' : 'hover',
7083
7082
  openDelay: this._config.openDelay || 0,
7084
7083
  onFocus: () => {
7085
- if (this._isDestroy || this.isHover)
7084
+ if (this.isHover)
7086
7085
  return;
7087
7086
  if (!this._el || !this._config)
7088
7087
  return;
@@ -7110,7 +7109,7 @@ class Tooltip {
7110
7109
  }, 200);
7111
7110
  },
7112
7111
  onBlur: () => {
7113
- if (!this._isDestroy && this.isHover)
7112
+ if (this.isHover)
7114
7113
  return;
7115
7114
  this._openTimer && clearTimeout(this._openTimer);
7116
7115
  this._closeTimer && clearTimeout(this._closeTimer);
@@ -7163,12 +7162,14 @@ class Tooltip {
7163
7162
  break;
7164
7163
  }
7165
7164
  }
7166
- hide() {
7165
+ hide(el) {
7167
7166
  this._openTimer && clearTimeout(this._openTimer);
7168
7167
  this._closeTimer && clearTimeout(this._closeTimer);
7169
- if (!this._el)
7168
+ if (!el) {
7169
+ el = this._el;
7170
+ }
7171
+ if (!el)
7170
7172
  return;
7171
- const el = this._el;
7172
7173
  this._closeTimer = setTimeout(() => {
7173
7174
  el.classList.remove('hy-tooltip-show');
7174
7175
  this._closeTimer && clearTimeout(this._closeTimer);
@@ -7182,8 +7183,9 @@ class Tooltip {
7182
7183
  }, 200);
7183
7184
  }
7184
7185
  destroy() {
7185
- this._isDestroy = true;
7186
- this.hide();
7186
+ if (!this.isHover) {
7187
+ this.hide();
7188
+ }
7187
7189
  this._timer && clearTimeout(this._timer);
7188
7190
  this._trigger && this._trigger.destroy();
7189
7191
  this._el = undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hy-virtual-tree",
3
- "version": "2.0.9",
3
+ "version": "2.0.10",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite",