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