mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-13 20:36:34 +00:00
fix: fix that the outline tree does not respond to modal addition/deletion related operations
This commit is contained in:
parent
33fd6bf642
commit
f1ff1a0706
@ -9,6 +9,8 @@ import { IPublicModelPluginContext, IPublicModelModalNodesManager, IPublicTypeDi
|
|||||||
class ModalTreeNodeView extends PureComponent<{
|
class ModalTreeNodeView extends PureComponent<{
|
||||||
treeNode: TreeNode;
|
treeNode: TreeNode;
|
||||||
pluginContext: IPublicModelPluginContext;
|
pluginContext: IPublicModelPluginContext;
|
||||||
|
}, {
|
||||||
|
treeChildren: TreeNode[] | null;
|
||||||
}> {
|
}> {
|
||||||
private modalNodesManager: IPublicModelModalNodesManager | undefined | null;
|
private modalNodesManager: IPublicModelModalNodesManager | undefined | null;
|
||||||
readonly pluginContext: IPublicModelPluginContext;
|
readonly pluginContext: IPublicModelPluginContext;
|
||||||
@ -20,18 +22,36 @@ class ModalTreeNodeView extends PureComponent<{
|
|||||||
this.pluginContext = props.pluginContext;
|
this.pluginContext = props.pluginContext;
|
||||||
const { project } = this.pluginContext;
|
const { project } = this.pluginContext;
|
||||||
this.modalNodesManager = project.currentDocument?.modalNodesManager;
|
this.modalNodesManager = project.currentDocument?.modalNodesManager;
|
||||||
|
this.state = {
|
||||||
|
treeChildren: this.rootTreeNode.children,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
hideAllNodes() {
|
hideAllNodes() {
|
||||||
this.modalNodesManager?.hideModalNodes();
|
this.modalNodesManager?.hideModalNodes();
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
componentDidMount(): void {
|
||||||
|
const rootTreeNode = this.rootTreeNode;
|
||||||
|
rootTreeNode.onExpandableChanged(() => {
|
||||||
|
this.setState({
|
||||||
|
treeChildren: rootTreeNode.children,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
get rootTreeNode() {
|
||||||
const { treeNode } = this.props;
|
const { treeNode } = this.props;
|
||||||
// 当指定了新的根节点时,要从原始的根节点去获取模态节点
|
// 当指定了新的根节点时,要从原始的根节点去获取模态节点
|
||||||
const { project } = this.pluginContext;
|
const { project } = this.pluginContext;
|
||||||
const rootNode = project.currentDocument?.root;
|
const rootNode = project.currentDocument?.root;
|
||||||
const rootTreeNode = treeNode.tree.getTreeNode(rootNode!);
|
const rootTreeNode = treeNode.tree.getTreeNode(rootNode!);
|
||||||
|
|
||||||
|
return rootTreeNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const rootTreeNode = this.rootTreeNode;
|
||||||
const { expanded } = rootTreeNode;
|
const { expanded } = rootTreeNode;
|
||||||
|
|
||||||
const hasVisibleModalNode = !!this.modalNodesManager?.getVisibleModalNode();
|
const hasVisibleModalNode = !!this.modalNodesManager?.getVisibleModalNode();
|
||||||
@ -49,7 +69,7 @@ class ModalTreeNodeView extends PureComponent<{
|
|||||||
<div className="tree-pane-modal-content">
|
<div className="tree-pane-modal-content">
|
||||||
<TreeBranches
|
<TreeBranches
|
||||||
treeNode={rootTreeNode}
|
treeNode={rootTreeNode}
|
||||||
treeChildren={rootTreeNode.children}
|
treeChildren={this.state.treeChildren}
|
||||||
expanded={expanded}
|
expanded={expanded}
|
||||||
isModal
|
isModal
|
||||||
pluginContext={this.pluginContext}
|
pluginContext={this.pluginContext}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user