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