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 +7 -0
- package/dist/index.js +17 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
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 ||
|