GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: expandable state not changed when node added/removed · xukui/lowcode-engine@37dffae

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • docs/docs/api
    • project.md
  • packages/plugin-outline-pane/src
    • controllers
      • tree-node.ts
      • tree.ts
    • views
      • tree-node.tsx
  • scripts
    • sync-oss.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎docs/docs/api/project.md‎

Copy file name to clipboardExpand all lines: docs/docs/api/project.md
+1-1Lines changed: 1 addition & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ sidebar_position: 3
55
## 模块简介
66

77
引擎编排模块中包含多种模型,包括:
8-
- [文档模型 DocumentModel)](./model/document-model)
8+
- [文档模型 DocumentModel](./model/document-model)
99
- [节点模型 Node](./model/node)
1010
- [节点孩子模型 NodeChildren](./model/node-children)
1111
- [属性模型 Prop](./model/prop)
Collapse file

‎packages/plugin-outline-pane/src/controllers/tree-node.ts‎

Copy file name to clipboardExpand all lines: packages/plugin-outline-pane/src/controllers/tree-node.ts
+9-1Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export default class TreeNode {
2828
onHiddenChanged: (hidden: boolean) => void;
2929
onLockedChanged: (locked: boolean) => void;
3030
onTitleLabelChanged: (treeNode: TreeNode) => void;
31+
onExpandableChanged: (expandable: boolean) => void;
3132

3233
get id(): string {
3334
return this.node.id;
@@ -41,6 +42,13 @@ export default class TreeNode {
4142
return this.hasChildren() || this.hasSlots() || this.dropDetail?.index != null;
4243
}
4344

45+
/**
46+
* 触发 onExpandableChanged 回调
47+
*/
48+
notifyExpandableChanged(): void {
49+
this.onExpandableChanged && this.onExpandableChanged(this.expandable);
50+
}
51+
4452
/**
4553
* 插入"线"位置信息
4654
*/
@@ -96,7 +104,7 @@ export default class TreeNode {
96104

97105
get detecting() {
98106
const doc = this.pluginContext.project.currentDocument;
99-
return doc?.isDetectingNode(this.node);
107+
return !!(doc?.isDetectingNode(this.node));
100108
}
101109

102110
get hidden(): boolean {
Collapse file

‎packages/plugin-outline-pane/src/controllers/tree.ts‎

Copy file name to clipboardExpand all lines: packages/plugin-outline-pane/src/controllers/tree.ts
+21-1Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,27 @@ export class Tree {
1717

1818
constructor(pluginContext: IPublicModelPluginContext) {
1919
this.pluginContext = pluginContext;
20-
this.id = this.pluginContext.project.currentDocument?.id;
20+
const doc = this.pluginContext.project.currentDocument;
21+
this.id = doc?.id;
22+
23+
doc?.onMountNode((payload: {node: IPublicModelNode }) => {
24+
const { node } = payload;
25+
const parentNode = node.parent;
26+
if (!parentNode) {
27+
return;
28+
}
29+
const parentTreeNode = this.getTreeNodeById(parentNode.id);
30+
parentTreeNode?.notifyExpandableChanged();
31+
});
32+
33+
doc?.onRemoveNode((node: IPublicModelNode) => {
34+
const parentNode = node.parent;
35+
if (!parentNode) {
36+
return;
37+
}
38+
const parentTreeNode = this.getTreeNodeById(parentNode.id);
39+
parentTreeNode?.notifyExpandableChanged();
40+
});
2141
}
2242

2343
setNodeSelected(nodeId: string): void {
Collapse file

‎packages/plugin-outline-pane/src/views/tree-node.tsx‎

Copy file name to clipboardExpand all lines: packages/plugin-outline-pane/src/views/tree-node.tsx
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class ModalTreeNodeView extends Component<{
3232
const { project } = this.pluginContext;
3333
const rootNode = project.currentDocument?.root;
3434
const rootTreeNode = treeNode.tree.getTreeNode(rootNode!);
35-
const expanded = rootTreeNode.expanded;
35+
const { expanded } = rootTreeNode;
3636

3737
const hasVisibleModalNode = !!this.modalNodesManager?.getVisibleModalNode();
3838
return (
@@ -100,7 +100,7 @@ export default class TreeNodeView extends Component<{
100100

101101
componentDidMount() {
102102
const { treeNode, pluginContext } = this.props;
103-
const { event, project } = pluginContext;
103+
const { project } = pluginContext;
104104

105105
const doc = project.currentDocument;
106106

@@ -113,6 +113,9 @@ export default class TreeNodeView extends Component<{
113113
treeNode.onLockedChanged = (locked: boolean) => {
114114
this.setState({ locked });
115115
};
116+
treeNode.onExpandableChanged = (expandable: boolean) => {
117+
this.setState({ expandable });
118+
};
116119

117120
this.eventOffCallbacks.push(
118121
doc?.onDropLocationChanged((document: IPublicModelDocumentModel) => {
Collapse file

‎scripts/sync-oss.js‎

Copy file name to clipboardExpand all lines: scripts/sync-oss.js
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ const package = require('../packages/engine/package.json');
44
const { version, name } = package;
55
const options = {
66
method: 'PUT',
7-
// 暂时使用 日常环境的 uipaas-node,上线后可切换成线上环境 https://uipaas-node.alibaba-inc.com
87
hostname: 'uipaas-node.alibaba-inc.com',
98
path: '/staticAssets/cdn/packages',
109
headers: {

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.