hy-virtual-tree 1.1.20 → 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,12 @@
1
1
  ## Changelog
2
2
 
3
+ ### 1.1.21
4
+
5
+ _2025-09-11_
6
+
7
+ - 扩展[VirtualTree] 功能
8
+ (1)修复树节点无法选中复制问题
9
+
3
10
  ### 1.1.20
4
11
 
5
12
  _2025-09-11_
package/dist/index.js CHANGED
@@ -1929,6 +1929,8 @@ class VirtualTree {
1929
1929
  nodeContainer.appendChild(content);
1930
1930
  let nodeClickTimer;
1931
1931
  let nodeClickCount = 0;
1932
+ let isSelecting = false;
1933
+ let isMouseDown = false;
1932
1934
  const nodeClickHandle = (e) => {
1933
1935
  if (!getDisabled(config, item) && (isBoolean(showSelect)
1934
1936
  ? showSelect
@@ -1952,8 +1954,20 @@ class VirtualTree {
1952
1954
  }
1953
1955
  config.onNodeClick && config.onNodeClick(item.data, item, e);
1954
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
+ });
1955
1966
  // 鼠标左键点击事件
1956
1967
  nodeContainer.addEventListener('click', (e) => {
1968
+ if (isSelecting)
1969
+ return;
1970
+ e.stopPropagation();
1957
1971
  if (getDisabled(config, item) ||
1958
1972
  item.isLeaf ||
1959
1973
  !config.checkOnDblclickParentNode) {
@@ -1974,6 +1988,9 @@ class VirtualTree {
1974
1988
  });
1975
1989
  // 鼠标左键双击事件
1976
1990
  nodeContainer.addEventListener('dblclick', (e) => {
1991
+ if (isSelecting)
1992
+ return;
1993
+ e.stopPropagation();
1977
1994
  if (getDisabled(config, item) ||
1978
1995
  item.isLeaf ||
1979
1996
  !config.checkOnDblclickParentNode ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hy-virtual-tree",
3
- "version": "1.1.20",
3
+ "version": "1.1.21",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite",