mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-19 22:58:15 +00:00
fix: 补充documnet-model中addonData 相关方法
This commit is contained in:
parent
4886624c15
commit
cbc70eaa78
@ -49,6 +49,11 @@ export class DocumentModel {
|
|||||||
private emitter: EventEmitter;
|
private emitter: EventEmitter;
|
||||||
private rootNodeVisitorMap: { [visitorName: string]: any } = {};
|
private rootNodeVisitorMap: { [visitorName: string]: any } = {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
private _addons: { [key: string]: { exportData: () => any; isProp: boolean;} } = {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模拟器
|
* 模拟器
|
||||||
*/
|
*/
|
||||||
@ -512,6 +517,32 @@ export class DocumentModel {
|
|||||||
this.emitter.emit('lowcode_engine_renderer_ready', renderer);
|
this.emitter.emit('lowcode_engine_renderer_ready', renderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
getAddonData(name: string) {
|
||||||
|
const addon = this._addons[name];
|
||||||
|
return addon?.exportData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
registerAddon(name: string, exportData: any) {
|
||||||
|
if (['id', 'params', 'layout'].indexOf(name) > -1) {
|
||||||
|
throw new Error('addon name cannot be id, params, layout');
|
||||||
|
}
|
||||||
|
const i = this._addons?.findIndex((item) => item.name === name);
|
||||||
|
if (i > -1) {
|
||||||
|
this._addons?.splice(i, 1);
|
||||||
|
}
|
||||||
|
this._addons?.push({
|
||||||
|
exportData,
|
||||||
|
name,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
acceptRootNodeVisitor(
|
acceptRootNodeVisitor(
|
||||||
visitorName: string = 'default',
|
visitorName: string = 'default',
|
||||||
visitorFn: (node: RootNode) => any ) {
|
visitorFn: (node: RootNode) => any ) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user