mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-07 02:47:12 +00:00
feat: enhance-tree modified
This commit is contained in:
parent
b40892346a
commit
13e7ad0b69
@ -120,6 +120,7 @@ export class NodeChildren {
|
||||
* 删除一个节点
|
||||
*/
|
||||
delete(node: Node, purge = false, useMutator = true): boolean {
|
||||
node.internalPurgeStart();
|
||||
if (node.isParental()) {
|
||||
foreachReverse(node.children, (subNode: Node) => {
|
||||
subNode.remove(useMutator, purge);
|
||||
@ -145,7 +146,7 @@ export class NodeChildren {
|
||||
document.destroyNode(node);
|
||||
this.emitter.emit('change');
|
||||
if (useMutator) {
|
||||
this.reportModified(node, this.owner, { type: 'remove', removeIndex: i, removeNode: node });
|
||||
this.reportModified(node, this.owner, { type: 'remove', propagated: false, isSubDeleting: this.owner.inPurging, removeIndex: i, removeNode: node });
|
||||
}
|
||||
// purge 为 true 时,已在 internalSetParent 中删除了子节点
|
||||
if (i > -1 && !purge) {
|
||||
|
||||
@ -773,6 +773,18 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
|
||||
// this.document.destroyNode(this);
|
||||
}
|
||||
|
||||
private purging: boolean = false;
|
||||
internalPurgeStart() {
|
||||
this.purging = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否已销毁
|
||||
*/
|
||||
get inPurging() {
|
||||
return this.purging;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否可执行某action
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user