mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-30 15:28:18 +00:00
feat: optimize ts definition
This commit is contained in:
parent
aaedee159d
commit
88961aa640
@ -326,7 +326,7 @@ export class DocumentModel implements IDocumentModel {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
onChangeNodeChildren(fn: (info: IPublicTypeOnChangeOptions) => void): IPublicTypeDisposable {
|
onChangeNodeChildren(fn: (info: IPublicTypeOnChangeOptions<INode>) => void): IPublicTypeDisposable {
|
||||||
this.designer.editor?.eventBus.on(EDITOR_EVENT.NODE_VISIBLE_CHANGE, fn);
|
this.designer.editor?.eventBus.on(EDITOR_EVENT.NODE_VISIBLE_CHANGE, fn);
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
|
|||||||
@ -83,7 +83,7 @@ export class ModalNodesManager implements IModalNodesManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private addNode(node: INode) {
|
private addNode(node: INode) {
|
||||||
if (node.componentMeta.isModal) {
|
if (node?.componentMeta.isModal) {
|
||||||
this.hideModalNodes();
|
this.hideModalNodes();
|
||||||
this.modalNodes.push(node);
|
this.modalNodes.push(node);
|
||||||
this.addNodeEvent(node);
|
this.addNodeEvent(node);
|
||||||
|
|||||||
@ -119,6 +119,7 @@ const pluginContextApiAssembler: ILowCodePluginContextApiAssembler = {
|
|||||||
context.canvas = canvas;
|
context.canvas = canvas;
|
||||||
context.plugins = plugins;
|
context.plugins = plugins;
|
||||||
context.logger = new Logger({ level: 'warn', bizName: `plugin:${pluginName}` });
|
context.logger = new Logger({ level: 'warn', bizName: `plugin:${pluginName}` });
|
||||||
|
context.workspace = workspace;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -37,7 +37,7 @@ export class Resource implements IPublicModelResource {
|
|||||||
return this[resourceSymbol].children.map((child) => new Resource(child));
|
return this[resourceSymbol].children.map((child) => new Resource(child));
|
||||||
}
|
}
|
||||||
|
|
||||||
get viewType() {
|
get viewName() {
|
||||||
return this[resourceSymbol].viewType;
|
return this[resourceSymbol].viewName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -179,13 +179,13 @@ export interface IPublicModelDocumentModel<
|
|||||||
* 当前 document 的节点 children 变更事件
|
* 当前 document 的节点 children 变更事件
|
||||||
* @param fn
|
* @param fn
|
||||||
*/
|
*/
|
||||||
onChangeNodeChildren(fn: (info: IPublicTypeOnChangeOptions) => void): IPublicTypeDisposable;
|
onChangeNodeChildren(fn: (info: IPublicTypeOnChangeOptions<Node>) => void): IPublicTypeDisposable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 当前 document 节点属性修改事件
|
* 当前 document 节点属性修改事件
|
||||||
* @param fn
|
* @param fn
|
||||||
*/
|
*/
|
||||||
onChangeNodeProp(fn: (info: IPublicTypePropChangeOptions) => void): IPublicTypeDisposable;
|
onChangeNodeProp(fn: (info: IPublicTypePropChangeOptions<Node>) => void): IPublicTypeDisposable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* import schema event
|
* import schema event
|
||||||
|
|||||||
@ -5,11 +5,15 @@ export interface IPublicModelResource {
|
|||||||
|
|
||||||
get icon(): ReactElement | undefined;
|
get icon(): ReactElement | undefined;
|
||||||
|
|
||||||
get options(): Object;
|
get options(): Record<string, any>;
|
||||||
|
|
||||||
get name(): string | undefined;
|
get name(): string | undefined;
|
||||||
|
|
||||||
get type(): string | undefined;
|
get type(): string | undefined;
|
||||||
|
|
||||||
get category(): string | undefined;
|
get category(): string | undefined;
|
||||||
|
|
||||||
|
get children(): IPublicModelResource[];
|
||||||
|
|
||||||
|
get viewName(): string | undefined;
|
||||||
}
|
}
|
||||||
@ -1,6 +1,8 @@
|
|||||||
import { IPublicModelNode } from '..';
|
import { IPublicModelNode } from '..';
|
||||||
|
|
||||||
export interface IPublicTypeOnChangeOptions {
|
export interface IPublicTypeOnChangeOptions<
|
||||||
|
Node = IPublicModelNode
|
||||||
|
> {
|
||||||
type: string;
|
type: string;
|
||||||
node: IPublicModelNode;
|
node: Node;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,10 +3,12 @@ import {
|
|||||||
IPublicModelProp,
|
IPublicModelProp,
|
||||||
} from '../model';
|
} from '../model';
|
||||||
|
|
||||||
export interface IPublicTypePropChangeOptions {
|
export interface IPublicTypePropChangeOptions<
|
||||||
|
Node = IPublicModelNode
|
||||||
|
> {
|
||||||
key?: string | number;
|
key?: string | number;
|
||||||
prop?: IPublicModelProp;
|
prop?: IPublicModelProp;
|
||||||
node: IPublicModelNode;
|
node: Node;
|
||||||
newValue: any;
|
newValue: any;
|
||||||
oldValue: any;
|
oldValue: any;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,14 +1,21 @@
|
|||||||
import { ReactElement } from 'react';
|
import { ReactElement } from 'react';
|
||||||
|
|
||||||
export interface IPublicResourceData {
|
export interface IPublicResourceData {
|
||||||
|
/** 资源名字 */
|
||||||
resourceName: string;
|
resourceName: string;
|
||||||
|
/** 资源标题 */
|
||||||
title: string;
|
title: string;
|
||||||
|
/** 分类 */
|
||||||
category?: string;
|
category?: string;
|
||||||
viewType?: string;
|
/** 资源视图 */
|
||||||
|
viewName?: string;
|
||||||
|
/** 资源 icon */
|
||||||
icon?: ReactElement;
|
icon?: ReactElement;
|
||||||
|
/** 资源其他配置 */
|
||||||
options: {
|
options: {
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
};
|
};
|
||||||
|
/** 资源子元素 */
|
||||||
children?: IPublicResourceData[];
|
children?: IPublicResourceData[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -17,8 +17,8 @@ export class Resource implements IPublicModelResource {
|
|||||||
return this.resourceType.name;
|
return this.resourceType.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
get viewType() {
|
get viewName() {
|
||||||
return this.resourceData.viewType;
|
return this.resourceData.viewName || (this.resourceData as any).viewType;
|
||||||
}
|
}
|
||||||
|
|
||||||
get description() {
|
get description() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user