hy-virtual-tree 1.1.19 → 1.1.21

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,19 @@
1
1
  ## Changelog
2
2
 
3
+ ### 1.1.21
4
+
5
+ _2025-09-11_
6
+
7
+ - 扩展[VirtualTree] 功能
8
+ (1)修复树节点无法选中复制问题
9
+
10
+ ### 1.1.20
11
+
12
+ _2025-09-11_
13
+
14
+ - 扩展[VirtualTree] 功能
15
+ (1)修复 CustomRenderFn 函数类型返回对象类型没有内置一层dom元素bug
16
+
3
17
  ### 1.1.19
4
18
 
5
19
  _2025-09-10_
package/dist/index.js CHANGED
@@ -1680,7 +1680,11 @@ class VirtualTree {
1680
1680
  value = defaultFn && isFunction(defaultFn) && defaultFn(node.data, node);
1681
1681
  }
1682
1682
  else {
1683
- const dom = fn(node.data, node);
1683
+ let dom = fn(node.data, node);
1684
+ if (isObject(dom) && dom.el) {
1685
+ $destroy = dom.$destroy;
1686
+ dom = dom.el;
1687
+ }
1684
1688
  if (isBoolean(dom) && dom) {
1685
1689
  value = defaultFn && isFunction(defaultFn) && defaultFn(node.data, node);
1686
1690
  }
@@ -1925,6 +1929,8 @@ class VirtualTree {
1925
1929
  nodeContainer.appendChild(content);
1926
1930
  let nodeClickTimer;
1927
1931
  let nodeClickCount = 0;
1932
+ let isSelecting = false;
1933
+ let isMouseDown = false;
1928
1934
  const nodeClickHandle = (e) => {
1929
1935
  if (!getDisabled(config, item) && (isBoolean(showSelect)
1930
1936
  ? showSelect
@@ -1948,8 +1954,20 @@ class VirtualTree {
1948
1954
  }
1949
1955
  config.onNodeClick && config.onNodeClick(item.data, item, e);
1950
1956
  };
1957
+ nodeContainer.addEventListener('mousedown', (e) => {
1958
+ isSelecting = false;
1959
+ isMouseDown = true;
1960
+ });
1961
+ nodeContainer.addEventListener('mousemove', () => {
1962
+ if (isSelecting || !isMouseDown)
1963
+ return;
1964
+ isSelecting = true;
1965
+ });
1951
1966
  // 鼠标左键点击事件
1952
1967
  nodeContainer.addEventListener('click', (e) => {
1968
+ if (isSelecting)
1969
+ return;
1970
+ e.stopPropagation();
1953
1971
  if (getDisabled(config, item) ||
1954
1972
  item.isLeaf ||
1955
1973
  !config.checkOnDblclickParentNode) {
@@ -1970,6 +1988,9 @@ class VirtualTree {
1970
1988
  });
1971
1989
  // 鼠标左键双击事件
1972
1990
  nodeContainer.addEventListener('dblclick', (e) => {
1991
+ if (isSelecting)
1992
+ return;
1993
+ e.stopPropagation();
1973
1994
  if (getDisabled(config, item) ||
1974
1995
  item.isLeaf ||
1975
1996
  !config.checkOnDblclickParentNode ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hy-virtual-tree",
3
- "version": "1.1.19",
3
+ "version": "1.1.21",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite",