Skip to content

Commit

Permalink
fix(core): fix drag source childtree is not work
Browse files Browse the repository at this point in the history
  • Loading branch information
janryWang committed Aug 23, 2021
1 parent 4171ec0 commit 7ac1d84
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/core/src/models/TreeNode.ts
Expand Up @@ -69,9 +69,9 @@ const resetNodesParent = (nodes: TreeNode[], parent: TreeNode) => {
if (!parent.isSourceNode) {
if (node.isSourceNode) {
node = node.clone(parent)
deepReset(node)
resetDepth(node)
} else if (!node.isRoot && node.isInOperation) {
node.root.operation.selection?.remove?.(node)
node.root.operation.selection.remove(node)
removeNode(node)
shallowReset(node)
} else {
Expand Down Expand Up @@ -642,8 +642,8 @@ export class TreeNode {
parent ? parent : this.parent
)
newNode.children = resetNodesParent(
this.children.map((treeNode) => {
return treeNode.clone(newNode)
this.children.map((child) => {
return child.clone(newNode)
}),
newNode
)
Expand Down
11 changes: 11 additions & 0 deletions packages/playground/src/main.tsx
Expand Up @@ -148,6 +148,17 @@ GlobalDragSource.setSourcesByGroup('form', [
'x-decorator': 'FormItem',
'x-component': 'Card',
},
children: [
{
componentName: 'Field',
props: {
title: '输入框',
type: 'string',
'x-decorator': 'FormItem',
'x-component': 'Input',
},
},
],
},
])

Expand Down

0 comments on commit 7ac1d84

Please sign in to comment.