|
|
|
@ -323,22 +323,30 @@ export class TemplateParamPanelStore
|
|
|
|
|
//计算可见的节点个数
|
|
|
|
|
const ForeachTreeNode = (nodes: ITreeNode[], callback: (node: ITreeNode) => void) =>
|
|
|
|
|
{
|
|
|
|
|
if (nodes === null)
|
|
|
|
|
return;
|
|
|
|
|
if (nodes)
|
|
|
|
|
for (const node of nodes)
|
|
|
|
|
{
|
|
|
|
|
callback(node);
|
|
|
|
|
if (node.isExpanded)
|
|
|
|
|
ForeachTreeNode(node.childNodes, callback);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
for (const node of nodes)
|
|
|
|
|
{
|
|
|
|
|
callback(node);
|
|
|
|
|
if (node.isExpanded)
|
|
|
|
|
ForeachTreeNode(node.childNodes, callback);
|
|
|
|
|
}
|
|
|
|
|
// 为了即时更新,该遍历不做展开判断
|
|
|
|
|
const ForeachAllTreeNode = (nodes: ITreeNode[], callback: (node: ITreeNode) => void) =>
|
|
|
|
|
{
|
|
|
|
|
if (nodes)
|
|
|
|
|
for (const node of nodes)
|
|
|
|
|
{
|
|
|
|
|
callback(node);
|
|
|
|
|
ForeachAllTreeNode(node.childNodes, callback);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
let height = Math.max(200, this.scrollCard ? this.scrollCard.clientHeight : 200);
|
|
|
|
|
|
|
|
|
|
ForeachTreeNode(nodes, n =>
|
|
|
|
|
{
|
|
|
|
|
templateIdSet.add(n.id as number);
|
|
|
|
|
n.isSelected = n.nodeData === template;
|
|
|
|
|
if (n.isSelected)
|
|
|
|
|
{
|
|
|
|
@ -354,6 +362,8 @@ export class TemplateParamPanelStore
|
|
|
|
|
displayNodeCount++;//当前显示的节点个数
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
ForeachAllTreeNode(nodes, n => templateIdSet.add(n.id as number));
|
|
|
|
|
|
|
|
|
|
//还得判断名字是不是被改了,如果被改了,我们是不是应该刷新节点树? 现在把折叠信息放在模块内,我们记住了折叠信息,这样我们就可以始终刷新这棵树了
|
|
|
|
|
|
|
|
|
|
//如果顶层发生改变,或者节点树发生改变,那么就要刷新节点树
|
|
|
|
|