提交 cf374930 编写于 作者: P pissang

fix(tree): fix unexpected highlight when focus descendant.

上级 fe0d94a2
......@@ -36,7 +36,7 @@ import ExtensionAPI from '../../ExtensionAPI';
import { TreeNode } from '../../data/Tree';
import List from '../../data/List';
import { getLabelStatesModels } from '../../label/labelStyle';
import { setStatesStylesFromModel, setStatesFlag, setDefaultStateProxy } from '../../util/states';
import { setStatesStylesFromModel, setStatesFlag, setDefaultStateProxy, HOVER_STATE_BLUR } from '../../util/states';
import { ECElement } from '../../util/types';
type TreeSymbol = SymbolClz & {
......@@ -498,7 +498,16 @@ function updateNode(
if (symbolEl.__edge) {
(symbolEl as ECElement).onStateChange = function (toState) {
setStatesFlag(symbolEl.__edge, toState);
if (toState !== 'blur') {
// NOTE: Ensure the parent elements will been blurred firstly.
// According to the return of getAncestorsIndices and getDescendantIndices
// TODO: A bit tricky.
const parentEl = node.parentNode
&& data.getItemGraphicEl(node.parentNode.dataIndex);
if (!(parentEl && (parentEl as ECElement).hoverState === HOVER_STATE_BLUR)) {
setStatesFlag(symbolEl.__edge, toState);
}
}
};
}
}
......
......@@ -194,6 +194,7 @@ export class TreeNode {
indices.push(currNode.dataIndex);
currNode = currNode.parentNode;
}
indices.reverse();
return indices;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册