mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-02-28 04:40:32 +00:00
fix: 调整visionNode修改未知
This commit is contained in:
parent
444e25cf24
commit
da592355f4
@ -313,9 +313,10 @@ export class NodeChildren {
|
||||
return;
|
||||
}
|
||||
const callbacks = owner.componentMeta.getMetadata().experimental?.callbacks;
|
||||
if (callbacks?.onSubtreeModified) {
|
||||
if (callbacks?.onSubtreeModified && options?.type !== 'insert') {
|
||||
try {
|
||||
callbacks?.onSubtreeModified.call(node, owner, options);
|
||||
// 此处传入的 owner节点需要对getChildren进行处理,兼容老的数据结构
|
||||
callbacks?.onSubtreeModified.call(node, owner.getVisionCapabledNode(), options);
|
||||
} catch (e) {
|
||||
console.error('error when excute experimental.callbacks.onNodeAdd', e);
|
||||
}
|
||||
@ -323,7 +324,7 @@ export class NodeChildren {
|
||||
|
||||
if (callbacks?.onNodeAdd && options?.type === 'insert') {
|
||||
try {
|
||||
callbacks?.onNodeAdd.call(owner, node, owner);
|
||||
callbacks?.onNodeAdd.call(owner, node.getVisionCapabledNode(), owner);
|
||||
} catch (e) {
|
||||
console.error('error when excute experimental.callbacks.onNodeAdd', e);
|
||||
}
|
||||
|
||||
@ -818,6 +818,33 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
|
||||
toString() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 慎用,可能有极端未知后果
|
||||
* @deprecated
|
||||
*/
|
||||
getVisionCapabledNode() {
|
||||
// 判断是否已经是 nodeForVision
|
||||
if (!this.isVisionNode) {
|
||||
const children = this.getChildren();
|
||||
this.getChildren = () => {
|
||||
return children?.getChildrenArray() || [];
|
||||
};
|
||||
this.getProps = () => {
|
||||
const props = this.props.export();
|
||||
props.getPropValue = (key) => {
|
||||
return this.props.getPropValue(key);
|
||||
};
|
||||
props.getNode = () => {
|
||||
return this;
|
||||
};
|
||||
return props;
|
||||
};
|
||||
this.isVisionNode = true;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export interface ParentalNode<T extends NodeSchema = NodeSchema> extends Node<T> {
|
||||
|
||||
@ -335,15 +335,7 @@ export class Props implements IPropParent {
|
||||
* 兼容vision体系
|
||||
*/
|
||||
getNode() {
|
||||
const nodeForVision = this.owner;
|
||||
// 判断是否已经是 nodeForVision
|
||||
if (!nodeForVision.isVisionNode) {
|
||||
const children = nodeForVision.getChildren();
|
||||
nodeForVision.getChildren = () => {
|
||||
return children?.getChildrenArray() || [];
|
||||
};
|
||||
nodeForVision.isVisionNode = true;
|
||||
}
|
||||
const nodeForVision = this.owner?.getVisionCapabledNode();
|
||||
return nodeForVision;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user