mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-12 03:01:16 +00:00
feat: the event supplements the dispose function as the return value
This commit is contained in:
parent
83562989d5
commit
69ab81a147
@ -358,8 +358,11 @@ material.getRegisteredMetadataTransducers();
|
|||||||
* add callback for assets changed event
|
* add callback for assets changed event
|
||||||
* @param fn
|
* @param fn
|
||||||
*/
|
*/
|
||||||
onChangeAssets(fn: () => void): void;
|
onChangeAssets(fn: () => void): IPublicTypeDisposable;
|
||||||
```
|
```
|
||||||
|
|
||||||
|
相关类型:[IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts)
|
||||||
|
|
||||||
##### 示例
|
##### 示例
|
||||||
```typescript
|
```typescript
|
||||||
import { material } from '@alilc/lowcode-engine';
|
import { material } from '@alilc/lowcode-engine';
|
||||||
|
|||||||
@ -327,27 +327,31 @@ onChangeSelection(fn: (ids: string[]) => void): IPublicTypeDisposable;
|
|||||||
* set callback for event on visibility changed for certain node
|
* set callback for event on visibility changed for certain node
|
||||||
* @param fn
|
* @param fn
|
||||||
*/
|
*/
|
||||||
onChangeNodeVisible(fn: (node: IPublicModelNode, visible: boolean) => void): void;
|
onChangeNodeVisible(fn: (node: IPublicModelNode, visible: boolean) => void): IPublicTypeDisposable;
|
||||||
```
|
```
|
||||||
|
|
||||||
相关类型:[IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts)
|
- 相关类型:[IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts)
|
||||||
|
- 相关类型:[IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts)
|
||||||
|
|
||||||
### onChangeNodeChildren
|
### onChangeNodeChildren
|
||||||
|
|
||||||
onChangeNodeChildren(fn: (info?: IPublicTypeOnChangeOptions) => void)
|
|
||||||
|
|
||||||
当前 document 的节点 children 变更事件
|
当前 document 的节点 children 变更事件
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
|
onChangeNodeChildren(fn: (info?: IPublicTypeOnChangeOptions) => void): IPublicTypeDisposable;
|
||||||
```
|
```
|
||||||
|
|
||||||
|
相关类型:[IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts)
|
||||||
|
|
||||||
### onChangeNodeProp
|
### onChangeNodeProp
|
||||||
当前 document 节点属性修改事件
|
当前 document 节点属性修改事件
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
onChangeNodeProp(fn: (info: IPublicTypePropChangeOptions) => void)
|
onChangeNodeProp(fn: (info: IPublicTypePropChangeOptions) => void): IPublicTypeDisposable;
|
||||||
```
|
```
|
||||||
|
|
||||||
|
相关类型:[IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts)
|
||||||
|
|
||||||
### onImportSchema
|
### onImportSchema
|
||||||
当前 document 导入新的 schema 事件
|
当前 document 导入新的 schema 事件
|
||||||
```typescript
|
```typescript
|
||||||
|
|||||||
@ -295,9 +295,11 @@ hideArea(areaName: string): void;
|
|||||||
* @param listener
|
* @param listener
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
onShowPanel(listener: (...args: any[]) => void): () => void;
|
onShowPanel(listener: (...args: any[]) => void): IPublicTypeDisposable;
|
||||||
```
|
```
|
||||||
|
|
||||||
|
相关类型:[IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts)
|
||||||
|
|
||||||
### onHidePanel
|
### onHidePanel
|
||||||
|
|
||||||
监听 Panel 实例隐藏事件
|
监听 Panel 实例隐藏事件
|
||||||
@ -309,9 +311,11 @@ onShowPanel(listener: (...args: any[]) => void): () => void;
|
|||||||
* @param listener
|
* @param listener
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
onHidePanel(listener: (...args: any[]) => void): () => void;
|
onHidePanel(listener: (...args: any[]) => void): IPublicTypeDisposable;
|
||||||
```
|
```
|
||||||
|
|
||||||
|
相关类型:[IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts)
|
||||||
|
|
||||||
|
|
||||||
### onShowWidget
|
### onShowWidget
|
||||||
|
|
||||||
@ -324,9 +328,10 @@ onHidePanel(listener: (...args: any[]) => void): () => void;
|
|||||||
* @param listener
|
* @param listener
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
onShowWidget(listener: (...args: any[]) => void): () => void;
|
onShowWidget(listener: (...args: any[]) => void): IPublicTypeDisposable;
|
||||||
```
|
```
|
||||||
|
|
||||||
|
相关类型:[IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts)
|
||||||
|
|
||||||
### onHideWidget
|
### onHideWidget
|
||||||
|
|
||||||
@ -339,9 +344,11 @@ onShowWidget(listener: (...args: any[]) => void): () => void;
|
|||||||
* @param listener
|
* @param listener
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
onHideWidget(listener: (...args: any[]) => void): () => void;
|
onHideWidget(listener: (...args: any[]) => void): IPublicTypeDisposable;
|
||||||
```
|
```
|
||||||
|
|
||||||
|
相关类型:[IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts)
|
||||||
|
|
||||||
## 使用示例
|
## 使用示例
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
|
|||||||
@ -69,22 +69,6 @@ registerResourceType(resourceTypeModel: IPublicTypeResourceType): void;
|
|||||||
|
|
||||||
相关类型:[IPublicTypeResourceType](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/resource-type.ts)
|
相关类型:[IPublicTypeResourceType](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/resource-type.ts)
|
||||||
|
|
||||||
### onChangeWindows
|
|
||||||
|
|
||||||
窗口新增/删除的事件
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
function onChangeWindows(fn: () => void): void;
|
|
||||||
```
|
|
||||||
|
|
||||||
### onChangeActiveWindow
|
|
||||||
|
|
||||||
active 窗口变更事件
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
function onChangeActiveWindow(fn: () => void): void;
|
|
||||||
```
|
|
||||||
|
|
||||||
### setResourceList
|
### setResourceList
|
||||||
|
|
||||||
设置设计器资源列表数据
|
设置设计器资源列表数据
|
||||||
@ -95,16 +79,6 @@ setResourceList(resourceList: IPublicResourceList) {}
|
|||||||
|
|
||||||
相关类型:[IPublicResourceOptions](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/resource-options.ts)
|
相关类型:[IPublicResourceOptions](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/resource-options.ts)
|
||||||
|
|
||||||
### onResourceListChange
|
|
||||||
|
|
||||||
设计器资源列表数据变更事件
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
onResourceListChange(fn: (resourceList: IPublicResourceList): void): (): void;
|
|
||||||
```
|
|
||||||
|
|
||||||
相关类型:[IPublicResourceOptions](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/resource-options.ts)
|
|
||||||
|
|
||||||
### openEditorWindow
|
### openEditorWindow
|
||||||
|
|
||||||
打开视图窗口
|
打开视图窗口
|
||||||
@ -136,3 +110,37 @@ removeEditorWindow(resourceName: string, title: string): void;
|
|||||||
```typescript
|
```typescript
|
||||||
removeEditorWindowById(id: string): void;
|
removeEditorWindowById(id: string): void;
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## 事件
|
||||||
|
|
||||||
|
### onChangeWindows
|
||||||
|
|
||||||
|
窗口新增/删除的事件
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
function onChangeWindows(fn: () => void): IPublicTypeDisposable;
|
||||||
|
```
|
||||||
|
|
||||||
|
相关类型:[IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts)
|
||||||
|
|
||||||
|
### onChangeActiveWindow
|
||||||
|
|
||||||
|
active 窗口变更事件
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
function onChangeActiveWindow(fn: () => void): IPublicTypeDisposable;
|
||||||
|
```
|
||||||
|
|
||||||
|
相关类型:[IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts)
|
||||||
|
|
||||||
|
|
||||||
|
### onResourceListChange
|
||||||
|
|
||||||
|
设计器资源列表数据变更事件
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
onResourceListChange(fn: (resourceList: IPublicResourceList): void): (): IPublicTypeDisposable;
|
||||||
|
```
|
||||||
|
|
||||||
|
- 相关类型:[IPublicResourceOptions](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/resource-options.ts)
|
||||||
|
- 相关类型:[IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts)
|
||||||
|
|||||||
@ -85,8 +85,6 @@ export class Project implements IProject {
|
|||||||
return this._simulator || null;
|
return this._simulator || null;
|
||||||
}
|
}
|
||||||
|
|
||||||
key = Math.random();
|
|
||||||
|
|
||||||
@computed get currentDocument(): IDocumentModel | null {
|
@computed get currentDocument(): IDocumentModel | null {
|
||||||
return this.documents.find((doc) => doc.active);
|
return this.documents.find((doc) => doc.active);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import {
|
|||||||
IPublicModelComponentMeta,
|
IPublicModelComponentMeta,
|
||||||
IPublicTypeNpmInfo,
|
IPublicTypeNpmInfo,
|
||||||
IPublicModelEditor,
|
IPublicModelEditor,
|
||||||
|
IPublicTypeDisposable,
|
||||||
} from '@alilc/lowcode-types';
|
} from '@alilc/lowcode-types';
|
||||||
import { Workspace as InnerWorkspace } from '@alilc/lowcode-workspace';
|
import { Workspace as InnerWorkspace } from '@alilc/lowcode-workspace';
|
||||||
import { editorSymbol, designerSymbol } from '../symbols';
|
import { editorSymbol, designerSymbol } from '../symbols';
|
||||||
@ -170,7 +171,7 @@ export class Material implements IPublicApiMaterial {
|
|||||||
* 监听 assets 变化的事件
|
* 监听 assets 变化的事件
|
||||||
* @param fn
|
* @param fn
|
||||||
*/
|
*/
|
||||||
onChangeAssets(fn: () => void): Function {
|
onChangeAssets(fn: () => void): IPublicTypeDisposable {
|
||||||
const dispose = [
|
const dispose = [
|
||||||
// 设置 assets,经过 setAssets 赋值
|
// 设置 assets,经过 setAssets 赋值
|
||||||
this[editorSymbol].onGot('assets', fn),
|
this[editorSymbol].onGot('assets', fn),
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import {
|
|||||||
SkeletonEvents,
|
SkeletonEvents,
|
||||||
} from '@alilc/lowcode-editor-skeleton';
|
} from '@alilc/lowcode-editor-skeleton';
|
||||||
import { skeletonSymbol } from '../symbols';
|
import { skeletonSymbol } from '../symbols';
|
||||||
import { IPublicApiSkeleton, IPublicTypeWidgetBaseConfig, IPublicTypeWidgetConfigArea } from '@alilc/lowcode-types';
|
import { IPublicApiSkeleton, IPublicTypeDisposable, IPublicTypeWidgetBaseConfig, IPublicTypeWidgetConfigArea } from '@alilc/lowcode-types';
|
||||||
|
|
||||||
const innerSkeletonSymbol = Symbol('skeleton');
|
const innerSkeletonSymbol = Symbol('skeleton');
|
||||||
export class Skeleton implements IPublicApiSkeleton {
|
export class Skeleton implements IPublicApiSkeleton {
|
||||||
@ -129,7 +129,7 @@ export class Skeleton implements IPublicApiSkeleton {
|
|||||||
* @param listener
|
* @param listener
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
onShowPanel(listener: (...args: any[]) => void) {
|
onShowPanel(listener: (...args: any[]) => void): IPublicTypeDisposable {
|
||||||
const { editor } = this[skeletonSymbol];
|
const { editor } = this[skeletonSymbol];
|
||||||
editor.eventBus.on(SkeletonEvents.PANEL_SHOW, (name: any, panel: any) => {
|
editor.eventBus.on(SkeletonEvents.PANEL_SHOW, (name: any, panel: any) => {
|
||||||
// 不泄漏 skeleton
|
// 不泄漏 skeleton
|
||||||
@ -144,7 +144,7 @@ export class Skeleton implements IPublicApiSkeleton {
|
|||||||
* @param listener
|
* @param listener
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
onHidePanel(listener: (...args: any[]) => void) {
|
onHidePanel(listener: (...args: any[]) => void): IPublicTypeDisposable {
|
||||||
const { editor } = this[skeletonSymbol];
|
const { editor } = this[skeletonSymbol];
|
||||||
editor.eventBus.on(SkeletonEvents.PANEL_HIDE, (name: any, panel: any) => {
|
editor.eventBus.on(SkeletonEvents.PANEL_HIDE, (name: any, panel: any) => {
|
||||||
// 不泄漏 skeleton
|
// 不泄漏 skeleton
|
||||||
@ -159,7 +159,7 @@ export class Skeleton implements IPublicApiSkeleton {
|
|||||||
* @param listener
|
* @param listener
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
onShowWidget(listener: (...args: any[]) => void) {
|
onShowWidget(listener: (...args: any[]) => void): IPublicTypeDisposable {
|
||||||
const { editor } = this[skeletonSymbol];
|
const { editor } = this[skeletonSymbol];
|
||||||
editor.eventBus.on(SkeletonEvents.WIDGET_SHOW, (name: any, panel: any) => {
|
editor.eventBus.on(SkeletonEvents.WIDGET_SHOW, (name: any, panel: any) => {
|
||||||
// 不泄漏 skeleton
|
// 不泄漏 skeleton
|
||||||
@ -174,7 +174,7 @@ export class Skeleton implements IPublicApiSkeleton {
|
|||||||
* @param listener
|
* @param listener
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
onHideWidget(listener: (...args: any[]) => void) {
|
onHideWidget(listener: (...args: any[]) => void): IPublicTypeDisposable {
|
||||||
const { editor } = this[skeletonSymbol];
|
const { editor } = this[skeletonSymbol];
|
||||||
editor.eventBus.on(SkeletonEvents.WIDGET_HIDE, (name: any, panel: any) => {
|
editor.eventBus.on(SkeletonEvents.WIDGET_HIDE, (name: any, panel: any) => {
|
||||||
// 不泄漏 skeleton
|
// 不泄漏 skeleton
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { IPublicApiWorkspace, IPublicResourceList, IPublicTypeResourceType } from '@alilc/lowcode-types';
|
import { IPublicApiWorkspace, IPublicResourceList, IPublicTypeDisposable, IPublicTypeResourceType } from '@alilc/lowcode-types';
|
||||||
import { Workspace as InnerWorkSpace } from '@alilc/lowcode-workspace';
|
import { Workspace as InnerWorkSpace } from '@alilc/lowcode-workspace';
|
||||||
import { Plugins } from '@alilc/lowcode-shell';
|
import { Plugins } from '@alilc/lowcode-shell';
|
||||||
import { workspaceSymbol } from '../symbols';
|
import { workspaceSymbol } from '../symbols';
|
||||||
@ -19,7 +19,7 @@ export class Workspace implements IPublicApiWorkspace {
|
|||||||
this[workspaceSymbol].setResourceList(resourceList);
|
this[workspaceSymbol].setResourceList(resourceList);
|
||||||
}
|
}
|
||||||
|
|
||||||
onResourceListChange(fn: (resourceList: IPublicResourceList) => void): () => void {
|
onResourceListChange(fn: (resourceList: IPublicResourceList) => void): IPublicTypeDisposable {
|
||||||
return this[workspaceSymbol].onResourceListChange(fn);
|
return this[workspaceSymbol].onResourceListChange(fn);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,11 +59,11 @@ export class Workspace implements IPublicApiWorkspace {
|
|||||||
return this[workspaceSymbol].windows.map((d) => new ShellWindow(d));
|
return this[workspaceSymbol].windows.map((d) => new ShellWindow(d));
|
||||||
}
|
}
|
||||||
|
|
||||||
onChangeWindows(fn: () => void) {
|
onChangeWindows(fn: () => void): IPublicTypeDisposable {
|
||||||
return this[workspaceSymbol].onChangeWindows(fn);
|
return this[workspaceSymbol].onChangeWindows(fn);
|
||||||
}
|
}
|
||||||
|
|
||||||
onChangeActiveWindow(fn: () => void) {
|
onChangeActiveWindow(fn: () => void): IPublicTypeDisposable {
|
||||||
return this[workspaceSymbol].onChangeActiveWindow(fn);
|
return this[workspaceSymbol].onChangeActiveWindow(fn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -288,8 +288,8 @@ export class DocumentModel implements IPublicModelDocumentModel {
|
|||||||
* 当前 document 的节点显隐状态变更事件
|
* 当前 document 的节点显隐状态变更事件
|
||||||
* @param fn
|
* @param fn
|
||||||
*/
|
*/
|
||||||
onChangeNodeVisible(fn: (node: IPublicModelNode, visible: boolean) => void): void {
|
onChangeNodeVisible(fn: (node: IPublicModelNode, visible: boolean) => void): IPublicTypeDisposable {
|
||||||
this[documentSymbol].onChangeNodeVisible((node: IPublicModelNode, visible: boolean) => {
|
return this[documentSymbol].onChangeNodeVisible((node: IPublicModelNode, visible: boolean) => {
|
||||||
fn(ShellNode.create(node)!, visible);
|
fn(ShellNode.create(node)!, visible);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -298,8 +298,8 @@ export class DocumentModel implements IPublicModelDocumentModel {
|
|||||||
* 当前 document 的节点 children 变更事件
|
* 当前 document 的节点 children 变更事件
|
||||||
* @param fn
|
* @param fn
|
||||||
*/
|
*/
|
||||||
onChangeNodeChildren(fn: (info: IPublicTypeOnChangeOptions) => void): void {
|
onChangeNodeChildren(fn: (info: IPublicTypeOnChangeOptions) => void): IPublicTypeDisposable {
|
||||||
this[documentSymbol].onChangeNodeChildren((info?: IPublicTypeOnChangeOptions) => {
|
return this[documentSymbol].onChangeNodeChildren((info?: IPublicTypeOnChangeOptions) => {
|
||||||
if (!info) {
|
if (!info) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -314,19 +314,27 @@ export class DocumentModel implements IPublicModelDocumentModel {
|
|||||||
* 当前 document 节点属性修改事件
|
* 当前 document 节点属性修改事件
|
||||||
* @param fn
|
* @param fn
|
||||||
*/
|
*/
|
||||||
onChangeNodeProp(fn: (info: IPublicTypePropChangeOptions) => void): void {
|
onChangeNodeProp(fn: (info: IPublicTypePropChangeOptions) => void): IPublicTypeDisposable {
|
||||||
|
const callback = (info: GlobalEvent.Node.Prop.ChangeOptions) => {
|
||||||
|
fn({
|
||||||
|
key: info.key,
|
||||||
|
oldValue: info.oldValue,
|
||||||
|
newValue: info.newValue,
|
||||||
|
prop: ShellProp.create(info.prop)!,
|
||||||
|
node: ShellNode.create(info.node as any)!,
|
||||||
|
});
|
||||||
|
};
|
||||||
this[editorSymbol].on(
|
this[editorSymbol].on(
|
||||||
GlobalEvent.Node.Prop.InnerChange,
|
GlobalEvent.Node.Prop.InnerChange,
|
||||||
(info: GlobalEvent.Node.Prop.ChangeOptions) => {
|
callback,
|
||||||
fn({
|
|
||||||
key: info.key,
|
|
||||||
oldValue: info.oldValue,
|
|
||||||
newValue: info.newValue,
|
|
||||||
prop: ShellProp.create(info.prop)!,
|
|
||||||
node: ShellNode.create(info.node as any)!,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
this[editorSymbol].off(
|
||||||
|
GlobalEvent.Node.Prop.InnerChange,
|
||||||
|
callback,
|
||||||
|
);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { IPublicTypeAssetsJson, IPublicTypeMetadataTransducer, IPublicTypeComponentAction, IPublicTypeNpmInfo } from '../type';
|
import { IPublicTypeAssetsJson, IPublicTypeMetadataTransducer, IPublicTypeComponentAction, IPublicTypeNpmInfo, IPublicTypeDisposable } from '../type';
|
||||||
import { IPublicModelComponentMeta } from '../model';
|
import { IPublicModelComponentMeta } from '../model';
|
||||||
import { ComponentType } from 'react';
|
import { ComponentType } from 'react';
|
||||||
|
|
||||||
@ -104,5 +104,5 @@ export interface IPublicApiMaterial {
|
|||||||
* add callback for assets changed event
|
* add callback for assets changed event
|
||||||
* @param fn
|
* @param fn
|
||||||
*/
|
*/
|
||||||
onChangeAssets(fn: () => void): Function;
|
onChangeAssets(fn: () => void): IPublicTypeDisposable;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import { IPublicTypeWidgetBaseConfig } from '../type';
|
import { IPublicTypeDisposable, IPublicTypeWidgetBaseConfig } from '../type';
|
||||||
|
|
||||||
export interface IPublicApiSkeleton {
|
export interface IPublicApiSkeleton {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 增加一个面板实例
|
* 增加一个面板实例
|
||||||
* add a new panel
|
* add a new panel
|
||||||
@ -80,7 +81,7 @@ export interface IPublicApiSkeleton {
|
|||||||
* @param listener
|
* @param listener
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
onShowPanel(listener: (...args: any[]) => void): () => void;
|
onShowPanel(listener: (...args: any[]) => void): IPublicTypeDisposable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 监听 Panel 实例隐藏事件
|
* 监听 Panel 实例隐藏事件
|
||||||
@ -88,7 +89,7 @@ export interface IPublicApiSkeleton {
|
|||||||
* @param listener
|
* @param listener
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
onHidePanel(listener: (...args: any[]) => void): () => void;
|
onHidePanel(listener: (...args: any[]) => void): IPublicTypeDisposable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 监听 Widget 显示事件
|
* 监听 Widget 显示事件
|
||||||
@ -96,7 +97,7 @@ export interface IPublicApiSkeleton {
|
|||||||
* @param listener
|
* @param listener
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
onShowWidget(listener: (...args: any[]) => void): () => void;
|
onShowWidget(listener: (...args: any[]) => void): IPublicTypeDisposable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 监听 Widget 隐藏事件
|
* 监听 Widget 隐藏事件
|
||||||
@ -104,5 +105,5 @@ export interface IPublicApiSkeleton {
|
|||||||
* @param listener
|
* @param listener
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
onHideWidget(listener: (...args: any[]) => void): () => void;
|
onHideWidget(listener: (...args: any[]) => void): IPublicTypeDisposable;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { IPublicModelWindow } from '../model';
|
import { IPublicModelWindow } from '../model';
|
||||||
import { IPublicApiPlugins, IPublicModelResource, IPublicResourceList, IPublicTypeResourceType } from '@alilc/lowcode-types';
|
import { IPublicApiPlugins, IPublicModelResource, IPublicResourceList, IPublicTypeDisposable, IPublicTypeResourceType } from '@alilc/lowcode-types';
|
||||||
|
|
||||||
export interface IPublicApiWorkspace {
|
export interface IPublicApiWorkspace {
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ export interface IPublicApiWorkspace {
|
|||||||
setResourceList(resourceList: IPublicResourceList): void;
|
setResourceList(resourceList: IPublicResourceList): void;
|
||||||
|
|
||||||
/** 资源树列表更新事件 */
|
/** 资源树列表更新事件 */
|
||||||
onResourceListChange(fn: (resourceList: IPublicResourceList) => void): () => void;
|
onResourceListChange(fn: (resourceList: IPublicResourceList) => void): () => IPublicTypeDisposable;
|
||||||
|
|
||||||
/** 注册资源 */
|
/** 注册资源 */
|
||||||
registerResourceType(resourceTypeModel: IPublicTypeResourceType): void;
|
registerResourceType(resourceTypeModel: IPublicTypeResourceType): void;
|
||||||
@ -39,8 +39,8 @@ export interface IPublicApiWorkspace {
|
|||||||
removeEditorWindowById(id: string): void;
|
removeEditorWindowById(id: string): void;
|
||||||
|
|
||||||
/** 窗口新增/删除的事件 */
|
/** 窗口新增/删除的事件 */
|
||||||
onChangeWindows(fn: () => void): void;
|
onChangeWindows(fn: () => void): IPublicTypeDisposable;
|
||||||
|
|
||||||
/** active 窗口变更事件 */
|
/** active 窗口变更事件 */
|
||||||
onChangeActiveWindow(fn: () => void): void;
|
onChangeActiveWindow(fn: () => void): IPublicTypeDisposable;
|
||||||
}
|
}
|
||||||
@ -7,16 +7,9 @@ import { IPublicTypeOnChangeOptions } from '@alilc/lowcode-types';
|
|||||||
export interface IPublicModelDocumentModel {
|
export interface IPublicModelDocumentModel {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* id
|
* 节点选中区模型实例
|
||||||
*/
|
* instance of selection
|
||||||
get id(): string;
|
*/
|
||||||
|
|
||||||
set id(id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 节点选中区模型实例
|
|
||||||
* instance of selection
|
|
||||||
*/
|
|
||||||
selection: IPublicModelSelection;
|
selection: IPublicModelSelection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -31,6 +24,13 @@ export interface IPublicModelDocumentModel {
|
|||||||
*/
|
*/
|
||||||
history: IPublicModelHistory;
|
history: IPublicModelHistory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
get id(): string;
|
||||||
|
|
||||||
|
set id(id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取当前文档所属的 project
|
* 获取当前文档所属的 project
|
||||||
* get project which this documentModel belongs to
|
* get project which this documentModel belongs to
|
||||||
@ -166,19 +166,19 @@ export interface IPublicModelDocumentModel {
|
|||||||
* set callback for event on visibility changed for certain node
|
* set callback for event on visibility changed for certain node
|
||||||
* @param fn
|
* @param fn
|
||||||
*/
|
*/
|
||||||
onChangeNodeVisible(fn: (node: IPublicModelNode, visible: boolean) => void): void;
|
onChangeNodeVisible(fn: (node: IPublicModelNode, visible: boolean) => void): IPublicTypeDisposable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 当前 document 的节点 children 变更事件
|
* 当前 document 的节点 children 变更事件
|
||||||
* @param fn
|
* @param fn
|
||||||
*/
|
*/
|
||||||
onChangeNodeChildren(fn: (info: IPublicTypeOnChangeOptions) => void): void;
|
onChangeNodeChildren(fn: (info: IPublicTypeOnChangeOptions) => void): IPublicTypeDisposable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 当前 document 节点属性修改事件
|
* 当前 document 节点属性修改事件
|
||||||
* @param fn
|
* @param fn
|
||||||
*/
|
*/
|
||||||
onChangeNodeProp(fn: (info: IPublicTypePropChangeOptions) => void): void;
|
onChangeNodeProp(fn: (info: IPublicTypePropChangeOptions) => void): IPublicTypeDisposable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* import schema event
|
* import schema event
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user