mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-11 18:42:56 +00:00
fix: fix node parent assignment and update settings check
This commit is contained in:
parent
0d7ae43b79
commit
d2138d7edb
@ -310,6 +310,7 @@ export class NodeChildren implements Omit<IPublicModelNodeChildren<INode>,
|
||||
let removedNode;
|
||||
if (node) {
|
||||
removedNode = this.children.splice(start, deleteCount, node);
|
||||
node.internalSetParent(this.owner);
|
||||
} else {
|
||||
removedNode = this.children.splice(start, deleteCount);
|
||||
}
|
||||
|
||||
@ -197,7 +197,7 @@ export class Node<Schema extends IPublicTypeNodeSchema = IPublicTypeNodeSchema>
|
||||
|
||||
isInited = false;
|
||||
|
||||
_settingEntry: ISettingTopEntry;
|
||||
_settingEntry?: ISettingTopEntry;
|
||||
|
||||
get settingEntry(): ISettingTopEntry {
|
||||
if (this._settingEntry) return this._settingEntry;
|
||||
@ -988,6 +988,7 @@ export class Node<Schema extends IPublicTypeNodeSchema = IPublicTypeNodeSchema>
|
||||
this.props.purge();
|
||||
this.settingEntry?.purge();
|
||||
this.children?.purge();
|
||||
this._settingEntry = undefined;
|
||||
}
|
||||
|
||||
internalPurgeStart() {
|
||||
|
||||
@ -111,6 +111,16 @@ describe('NodeChildren 方法测试', () => {
|
||||
expect(children.length).toBe(2);
|
||||
});
|
||||
|
||||
it('split add node and update node parent', () => {
|
||||
const firstBtn = doc.getNode('node_k1ow3cbn')!;
|
||||
const { children } = firstBtn.parent!;
|
||||
const node = doc.createNode({ componentName: 'Button' });
|
||||
|
||||
children.splice(0, 0, node);
|
||||
|
||||
expect(node.parent).toBe(firstBtn.parent);
|
||||
})
|
||||
|
||||
it('map', () => {
|
||||
const firstBtn = doc.getNode('node_k1ow3cbn')!;
|
||||
const { children } = firstBtn.parent!;
|
||||
|
||||
@ -134,7 +134,7 @@ export class SettingsPrimaryPane extends Component<ISettingsPrimaryPaneProps, {
|
||||
render() {
|
||||
const { settings } = this.main;
|
||||
const editor = this.props.engineEditor;
|
||||
if (!settings) {
|
||||
if (!settings || !settings.first) {
|
||||
// 未选中节点,提示选中 或者 显示根节点设置
|
||||
return (
|
||||
<div className="lc-settings-main">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user