mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-07 19:17:07 +00:00
fix: 🐛 修复编辑面板
This commit is contained in:
parent
73699ffe67
commit
a0bad7742d
@ -1,3 +1,4 @@
|
|||||||
|
import { EventEmitter } from 'events';
|
||||||
import { createElement, ReactNode } from 'react';
|
import { createElement, ReactNode } from 'react';
|
||||||
import { obx } from '@ali/lowcode-editor-core';
|
import { obx } from '@ali/lowcode-editor-core';
|
||||||
import { uniqueId, createContent } from '@ali/lowcode-utils';
|
import { uniqueId, createContent } from '@ali/lowcode-utils';
|
||||||
@ -13,8 +14,9 @@ export default class Panel implements IWidget {
|
|||||||
readonly isWidget = true;
|
readonly isWidget = true;
|
||||||
readonly name: string;
|
readonly name: string;
|
||||||
readonly id: string;
|
readonly id: string;
|
||||||
@obx.ref inited: boolean = false;
|
@obx.ref inited = false;
|
||||||
@obx.ref private _actived: boolean = false;
|
@obx.ref private _actived = false;
|
||||||
|
private emitter = new EventEmitter();
|
||||||
get actived(): boolean {
|
get actived(): boolean {
|
||||||
return this._actived;
|
return this._actived;
|
||||||
}
|
}
|
||||||
@ -46,7 +48,7 @@ export default class Panel implements IWidget {
|
|||||||
|
|
||||||
readonly title: TitleContent;
|
readonly title: TitleContent;
|
||||||
readonly help?: HelpTipConfig;
|
readonly help?: HelpTipConfig;
|
||||||
private plain: boolean = false;
|
private plain = false;
|
||||||
|
|
||||||
private container?: WidgetContainer<Panel, PanelConfig>;
|
private container?: WidgetContainer<Panel, PanelConfig>;
|
||||||
private parent?: WidgetContainer;
|
private parent?: WidgetContainer;
|
||||||
@ -143,9 +145,11 @@ export default class Panel implements IWidget {
|
|||||||
}
|
}
|
||||||
this._actived = true;
|
this._actived = true;
|
||||||
this.parent?.active(this);
|
this.parent?.active(this);
|
||||||
|
this.emitter.emit('activechange', true);
|
||||||
} else if (this.inited) {
|
} else if (this.inited) {
|
||||||
this._actived = false;
|
this._actived = false;
|
||||||
this.parent?.unactive(this);
|
this.parent?.unactive(this);
|
||||||
|
this.emitter.emit('activechange', false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,6 +183,16 @@ export default class Panel implements IWidget {
|
|||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
setPosition(position: string) {
|
setPosition(position: string) {
|
||||||
|
// noop
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
onActiveChange(fn: (flag: boolean) => void): () => void {
|
||||||
|
this.emitter.on('activechange', fn);
|
||||||
|
return () => {
|
||||||
|
this.emitter.removeListener('activechange', fn);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user