mirror of
https://github.com/NetEase/tango.git
synced 2026-08-29 02:01:34 +08:00
fix: nodeTree defaultExpandAll rerender bug (#24)
* fix: fix: nodeTree defaultExpandAll rerender bug * chore: tsconfig add tango-ui path
This commit is contained in:
@@ -40,6 +40,17 @@ const filedNames = {
|
||||
children: 'children',
|
||||
};
|
||||
|
||||
const getNodeKeys = (data: TangoViewNodeDataType[]) => {
|
||||
const ids: string[] = [];
|
||||
data?.forEach((node) => {
|
||||
ids.push(node.id);
|
||||
if (node.children) {
|
||||
ids.push(...getNodeKeys(node.children));
|
||||
}
|
||||
});
|
||||
return ids;
|
||||
};
|
||||
|
||||
const OutlineTreeNode: React.FC<any> = observer(({ node }: { node: TangoViewNodeDataType }) => {
|
||||
const workspace = useWorkspace();
|
||||
const sandboxQuery = useSandboxQuery();
|
||||
@@ -124,7 +135,7 @@ export const ComponentsTree = observer(() => {
|
||||
}}
|
||||
blockNode
|
||||
autoExpandParent
|
||||
defaultExpandAll
|
||||
expandedKeys={getNodeKeys(nodesTree)}
|
||||
draggable
|
||||
onDragStart={(data) => {
|
||||
const prototype = workspace.componentPrototypes.get(data.node.component);
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
"@music163/tango-setting-form": ["packages/setting-form/src/index.ts"],
|
||||
"@music163/tango-helpers": ["packages/helpers/src/index.ts"],
|
||||
"@music163/tango": ["packages/designer/src/index.ts"],
|
||||
"@music163/tango-ui": ["packages/ui/src/index.ts"],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user