docs: optimize api doc for model/modal-node-manager, and fix related lint issues

This commit is contained in:
JackLian 2023-01-11 10:06:42 +08:00 committed by 刘菊萍(絮黎)
parent 7d526d1e83
commit e5bfc58be8
32 changed files with 231 additions and 171 deletions

View File

@ -42,7 +42,7 @@ get dragon(): IPublicModelDragon | null;
get activeTracker(): IPublicModelActiveTracker | null; get activeTracker(): IPublicModelActiveTracker | null;
``` ```
## 方法签名 ## 方法
### createLocation ### createLocation
创建一个文档插入位置对象,该对象用来描述一个即将插入的节点在文档中的位置 创建一个文档插入位置对象,该对象用来描述一个即将插入的节点在文档中的位置

View File

@ -20,7 +20,7 @@ sidebar_position: 11
#### skeletonCabin #### skeletonCabin
面板扩展相关,详见下方方法签名 面板扩展相关,详见下方方法签名
## 方法签名 ## 方法
### utils ### utils
#### isNodeSchema #### isNodeSchema
是否为合法的 schema 结构 是否为合法的 schema 结构

View File

@ -10,7 +10,7 @@ sidebar_position: 8
## 模块简介 ## 模块简介
配置模块,负责配置的读、写等操作。 配置模块,负责配置的读、写等操作。
## 方法签名 ## 方法
### get ### get
获取指定 key 的值 获取指定 key 的值

View File

@ -10,7 +10,7 @@ sidebar_position: 7
## 模块简介 ## 模块简介
负责事件处理 API支持自定义监听事件、触发事件。 负责事件处理 API支持自定义监听事件、触发事件。
## 方法签名 ## 方法
### on ### on
监听事件 监听事件

View File

@ -9,7 +9,7 @@ sidebar_position: 5
## 模块简介 ## 模块简介
绑定快捷键 API可以自定义项目快捷键使用。 绑定快捷键 API可以自定义项目快捷键使用。
## 方法签名 ## 方法
### bind ### bind
绑定快捷键 绑定快捷键

View File

@ -8,7 +8,7 @@ sidebar_position: 10
## 模块简介 ## 模块简介
提供 init 等方法 提供 init 等方法
## 方法签名 ## 方法
#### 1. init #### 1. init
初始化引擎 初始化引擎

View File

@ -12,7 +12,7 @@ sidebar_position: 9
> 注:日志级别可以通过 url query 动态调整,详见下方[查看示例](#查看示例)。<br/> > 注:日志级别可以通过 url query 动态调整,详见下方[查看示例](#查看示例)。<br/>
> 参考 [zen-logger](https://web.npm.alibaba-inc.com/package/zen-logger) 实现进行封装 > 参考 [zen-logger](https://web.npm.alibaba-inc.com/package/zen-logger) 实现进行封装
## 方法签名 ## 方法
日志记录方法 日志记录方法

View File

@ -22,7 +22,7 @@ get componentsMap(): { [key: string]: IPublicTypeNpmInfo | ComponentType<any> |
``` ```
相关类型:[IPublicTypeNpmInfo](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/npm-info.ts) 相关类型:[IPublicTypeNpmInfo](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/npm-info.ts)
## 方法签名 ## 方法
### 资产包 ### 资产包
#### setAssets #### setAssets

View File

@ -9,7 +9,7 @@ sidebar_position: 6
画布节点悬停模型 画布节点悬停模型
## 变量 ## 属性
### current ### current
@ -28,7 +28,7 @@ sidebar_position: 6
`@type {boolean}` `@type {boolean}`
## 方法签名 ## 方法
### capture ### capture
hover 指定节点 hover 指定节点

View File

@ -9,7 +9,7 @@ sidebar_position: 0
文档模型 文档模型
## 变量 ## 属性
### id ### id
@ -95,7 +95,7 @@ sidebar_position: 0
**@since v1.1.0** **@since v1.1.0**
## 方法签名 ## 方法
### getNodeById ### getNodeById
根据 nodeId 返回 [Node](./node) 实例 根据 nodeId 返回 [Node](./node) 实例

View File

@ -18,7 +18,7 @@ import { IPublicModelDragon } from '@alilc/lowcode-types';
**@since** v1.1.0 **@since** v1.1.0
## 变量 ## 属性
### dragging ### dragging
@ -31,7 +31,7 @@ import { IPublicModelDragon } from '@alilc/lowcode-types';
get dragging(): boolean; get dragging(): boolean;
``` ```
## 方法签名 ## 方法
### onDragstart ### onDragstart

View File

@ -11,7 +11,7 @@ sidebar_position: 13
拖拽放置位置模型 拖拽放置位置模型
## 变量 ## 属性
### target ### target
@ -37,7 +37,7 @@ sidebar_position: 13
相关类型:[IPublicModelLocateEvent](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/location-event.ts) 相关类型:[IPublicModelLocateEvent](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/location-event.ts)
## 方法签名 ## 方法
### clone ### clone

View File

@ -9,7 +9,7 @@ sidebar_position: 5
操作历史记录模型 操作历史记录模型
## 方法签名 ## 方法
### go ### go
历史记录跳转到指定位置 历史记录跳转到指定位置

View File

@ -9,40 +9,86 @@ sidebar_position: 7
模态节点管理器模型 模态节点管理器模型
## 方法签名 ## 方法
### setNodes ### setNodes
setNodes()
设置模态节点,触发内部事件 设置模态节点,触发内部事件
```typescript
/**
* 设置模态节点,触发内部事件
* set modal nodes, trigger internal events
*/
setNodes(): void;
```
### getModalNodes ### getModalNodes
getModalNodes()
获取模态节点(们) 获取模态节点(们)
```typescript
/**
* 获取模态节点(们)
* get modal nodes
*/
getModalNodes(): IPublicModelNode[];
```
相关类型:[IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts)
### getVisibleModalNode ### getVisibleModalNode
getVisibleModalNode()
获取当前可见的模态节点 获取当前可见的模态节点
```typescript
/**
* 获取当前可见的模态节点
* get current visible modal node
*/
getVisibleModalNode(): IPublicModelNode | null;
```
相关类型:[IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts)
### hideModalNodes ### hideModalNodes
hideModalNodes()
隐藏模态节点(们) 隐藏模态节点(们)
```typescript
/**
* 隐藏模态节点(们)
* hide modal nodes
*/
hideModalNodes(): void;
```
### setVisible ### setVisible
setVisible(node: Node)
设置指定节点为可见态 设置指定节点为可见态
```typescript
/**
* 设置指定节点为可见态
* set specfic model node as visible
* @param node Node
*/
setVisible(node: IPublicModelNode): void;
```
相关类型:[IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts)
### setInvisible ### setInvisible
setInvisible(node: Node)
设置指定节点为不可见态 设置指定节点为不可见态
```typescript
/**
* 设置指定节点为不可见态
* set specfic model node as invisible
* @param node Node
*/
setInvisible(node: IPublicModelNode): void;
```
相关类型:[IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts)

View File

@ -8,7 +8,7 @@ sidebar_position: 2
## 基本介绍 ## 基本介绍
节点孩子模型 节点孩子模型
## 变量 ## 属性
### owner ### owner
返回当前 children 实例所属的节点实例 返回当前 children 实例所属的节点实例
@ -41,7 +41,7 @@ children 内的节点实例数
**@since v1.1.0** **@since v1.1.0**
## 方法签名 ## 方法
### delete ### delete
删除指定节点 删除指定节点

View File

@ -9,7 +9,7 @@ sidebar_position: 1
节点模型 节点模型
## 变量 ## 属性
### id ### id
节点 id 节点 id
@ -263,7 +263,7 @@ sidebar_position: 1
**@since v1.1.0** **@since v1.1.0**
## 方法签名 ## 方法
### getRect ### getRect

View File

@ -17,38 +17,24 @@ sidebar_position: 12
插件名字 插件名字
```typescript `@type {string}`
get name(): string;
```
### dep ### dep
插件依赖 插件依赖
```typescript `@type {string[]}`
get dep(): string[];
```
### disabled ### disabled
插件是否禁用 插件是否禁用
```typescript `@type {boolean}`
get disabled(): boolean
set disabled(disabled: boolean): void;
```
### meta ### meta
插件 meta 信息 插件 meta 信息
```typescript `@type {IPublicTypePluginMeta}`
get meta(): IPublicTypePluginMeta
```
- [IPublicTypePluginMeta](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/plugin-meta.ts)
相关类型:[IPublicTypePluginMeta](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/plugin-meta.ts)

View File

@ -9,7 +9,7 @@ sidebar_position: 3
属性模型 属性模型
## 变量 ## 属性
### id ### id
@ -46,7 +46,7 @@ key 值
相关类型:[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)
## 方法签名 ## 方法
### setValue ### setValue

View File

@ -9,7 +9,7 @@ sidebar_position: 4
属性集模型 属性集模型
## 变量 ## 属性
### id ### id
id id
@ -32,7 +32,7 @@ id
相关类型:[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)
## 方法签名 ## 方法
### getProp ### getProp
获取指定 path 的属性模型实例 获取指定 path 的属性模型实例

View File

@ -7,7 +7,7 @@ sidebar_position: 12
> **@types** [IPublicModelWindow](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/resource.ts)<br/> > **@types** [IPublicModelWindow](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/resource.ts)<br/>
> **@since** v1.1.0 > **@since** v1.1.0
## 变量 ## 属性
### title ### title

View File

@ -9,7 +9,7 @@ sidebar_position: 6
画布节点选中模型 画布节点选中模型
## 变量 ## 属性
### selected ### selected
返回选中的节点 id 返回选中的节点 id
@ -25,7 +25,7 @@ sidebar_position: 6
**@since v1.1.0** **@since v1.1.0**
## 方法签名 ## 方法
### select ### select
选中指定节点(覆盖方式) 选中指定节点(覆盖方式)

View File

@ -12,7 +12,7 @@ sidebar_position: 12
低代码设计器窗口模型 低代码设计器窗口模型
## 变量 ## 属性
### id ### id
@ -38,7 +38,7 @@ sidebar_position: 12
关联模型 [IPublicModelResource](./resource) 关联模型 [IPublicModelResource](./resource)
## 方法签名 ## 方法
### importSchema ### importSchema
当前窗口导入 schema, 会调用当前窗口对应资源的 import 钩子 当前窗口导入 schema, 会调用当前窗口对应资源的 import 钩子

View File

@ -8,7 +8,7 @@ sidebar_position: 4
## 模块简介 ## 模块简介
插件管理器,提供编排模块中管理插件的能力。 插件管理器,提供编排模块中管理插件的能力。
## 方法签名 ## 方法
### register ### register
注册插件 注册插件

View File

@ -69,7 +69,7 @@ get simulatorHost(): IPublicApiSimulatorHost | null;
相关类型:[IPublicApiSimulatorHost](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/simulator-host.ts) 相关类型:[IPublicApiSimulatorHost](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/simulator-host.ts)
## 方法签名 ## 方法
### openDocument ### openDocument
打开一个 document 打开一个 document

View File

@ -8,7 +8,7 @@ sidebar_position: 6
## 模块简介 ## 模块简介
负责注册设置器、管理设置器的 API。注册自定义设置器之后可以在物料中进行使用。 负责注册设置器、管理设置器的 API。注册自定义设置器之后可以在物料中进行使用。
## 方法签名 ## 方法
### getSetter ### getSetter
获取指定 setter 获取指定 setter

View File

@ -135,7 +135,7 @@ skeleton.add({
}); });
``` ```
## 方法签名 ## 方法
### add ### add

View File

@ -57,7 +57,7 @@ get resourceList(): IPublicModelResource;
关联模型 [IPublicModelResource](./model/resource) 关联模型 [IPublicModelResource](./model/resource)
## 方法签名 ## 方法
### registerResourceType ### registerResourceType
注册资源 注册资源

View File

@ -753,7 +753,7 @@ export class DocumentModel implements IDocumentModel {
})); }));
} }
onNodeCreate(func: (node: Node) => void) { onNodeCreate(func: (node: INode) => void) {
const wrappedFunc = wrapWithEventSwitch(func); const wrappedFunc = wrapWithEventSwitch(func);
this.emitter.on('nodecreate', wrappedFunc); this.emitter.on('nodecreate', wrappedFunc);
return () => { return () => {
@ -761,7 +761,7 @@ export class DocumentModel implements IDocumentModel {
}; };
} }
onNodeDestroy(func: (node: Node) => void) { onNodeDestroy(func: (node: INode) => void) {
const wrappedFunc = wrapWithEventSwitch(func); const wrappedFunc = wrapWithEventSwitch(func);
this.emitter.on('nodedestroy', wrappedFunc); this.emitter.on('nodedestroy', wrappedFunc);
return () => { return () => {

View File

@ -1,15 +1,15 @@
import { Node } from './node'; import { INode, Node } from './node';
import { DocumentModel } from '../document-model'; import { DocumentModel } from '../document-model';
import { IPublicModelModalNodesManager } from '@alilc/lowcode-types'; import { IPublicModelModalNodesManager } from '@alilc/lowcode-types';
import { createModuleEventBus, IEventBus } from '@alilc/lowcode-editor-core'; import { createModuleEventBus, IEventBus } from '@alilc/lowcode-editor-core';
export function getModalNodes(node: Node) { export function getModalNodes(node: INode | Node) {
if (!node) return []; if (!node) return [];
let nodes: any = []; let nodes: any = [];
if (node.componentMeta.isModal) { if (node.componentMeta.isModal) {
nodes.push(node); nodes.push(node);
} }
const children = node.getChildren(); const { children } = node;
if (children) { if (children) {
children.forEach((child) => { children.forEach((child) => {
nodes = nodes.concat(getModalNodes(child)); nodes = nodes.concat(getModalNodes(child));
@ -20,14 +20,17 @@ export function getModalNodes(node: Node) {
export interface IModalNodesManager extends IPublicModelModalNodesManager { export interface IModalNodesManager extends IPublicModelModalNodesManager {
getModalNodes(): INode[];
getVisibleModalNode(): INode | null;
} }
export class ModalNodesManager implements IModalNodesManager { export class ModalNodesManager implements IModalNodesManager {
public willDestroy: any; willDestroy: any;
private page: DocumentModel; private page: DocumentModel;
private modalNodes: Node[]; private modalNodes: INode[];
private nodeRemoveEvents: any; private nodeRemoveEvents: any;
@ -45,26 +48,27 @@ export class ModalNodesManager implements IModalNodesManager {
]; ];
} }
getModalNodes() { getModalNodes(): INode[] {
return this.modalNodes; return this.modalNodes;
} }
getVisibleModalNode() { getVisibleModalNode(): INode | null {
return this.getModalNodes().find((node: Node) => node.getVisible()); const visibleNode = this.getModalNodes().find((node: INode) => node.getVisible());
return visibleNode || null;
} }
hideModalNodes() { hideModalNodes() {
this.modalNodes.forEach((node: Node) => { this.modalNodes.forEach((node: INode) => {
node.setVisible(false); node.setVisible(false);
}); });
} }
setVisible(node: Node) { setVisible(node: INode) {
this.hideModalNodes(); this.hideModalNodes();
node.setVisible(true); node.setVisible(true);
} }
setInvisible(node: Node) { setInvisible(node: INode) {
node.setVisible(false); node.setVisible(false);
} }
@ -82,7 +86,7 @@ export class ModalNodesManager implements IModalNodesManager {
}; };
} }
private addNode(node: Node) { private addNode(node: INode) {
if (node.componentMeta.isModal) { if (node.componentMeta.isModal) {
this.hideModalNodes(); this.hideModalNodes();
this.modalNodes.push(node); this.modalNodes.push(node);
@ -92,7 +96,7 @@ export class ModalNodesManager implements IModalNodesManager {
} }
} }
private removeNode(node: Node) { private removeNode(node: INode) {
if (node.componentMeta.isModal) { if (node.componentMeta.isModal) {
const index = this.modalNodes.indexOf(node); const index = this.modalNodes.indexOf(node);
if (index >= 0) { if (index >= 0) {
@ -106,24 +110,24 @@ export class ModalNodesManager implements IModalNodesManager {
} }
} }
private addNodeEvent(node: Node) { private addNodeEvent(node: INode) {
this.nodeRemoveEvents[node.getId()] = this.nodeRemoveEvents[node.id] =
node.onVisibleChange(() => { node.onVisibleChange(() => {
this.emitter.emit('visibleChange'); this.emitter.emit('visibleChange');
}); });
} }
private removeNodeEvent(node: Node) { private removeNodeEvent(node: INode) {
if (this.nodeRemoveEvents[node.getId()]) { if (this.nodeRemoveEvents[node.id]) {
this.nodeRemoveEvents[node.getId()](); this.nodeRemoveEvents[node.id]();
delete this.nodeRemoveEvents[node.getId()]; delete this.nodeRemoveEvents[node.id];
} }
} }
setNodes() { setNodes() {
const nodes = getModalNodes(this.page.getRoot()!); const nodes = getModalNodes(this.page.rootNode!);
this.modalNodes = nodes; this.modalNodes = nodes;
this.modalNodes.forEach((node: Node) => { this.modalNodes.forEach((node: INode) => {
this.addNodeEvent(node); this.addNodeEvent(node);
}); });

View File

@ -36,6 +36,11 @@ export interface NodeStatus {
export interface INode extends IPublicModelNode { export interface INode extends IPublicModelNode {
/**
*
*/
get children(): INodeChildren | null;
setVisible(flag: boolean): void; setVisible(flag: boolean): void;
getVisible(): boolean; getVisible(): boolean;
@ -70,6 +75,10 @@ export interface INode extends IPublicModelNode {
internalSetSlotFor(slotFor: Prop | null | undefined): void; internalSetSlotFor(slotFor: Prop | null | undefined): void;
addSlot(slotNode: INode): void; addSlot(slotNode: INode): void;
get componentMeta(): ComponentMeta;
onVisibleChange(func: (flag: boolean) => any): () => void;
} }
/** /**
@ -204,6 +213,74 @@ export class Node<Schema extends IPublicTypeNodeSchema = IPublicTypeNodeSchema>
isInited = false; isInited = false;
_settingEntry: SettingTopEntry;
get settingEntry(): SettingTopEntry {
if (this._settingEntry) return this._settingEntry;
this._settingEntry = this.document.designer.createSettingEntry([this]);
return this._settingEntry;
}
private autoruns?: Array<() => void>;
private _isRGLContainer = false;
set isRGLContainer(status: boolean) {
this._isRGLContainer = status;
}
get isRGLContainer(): boolean {
return !!this._isRGLContainer;
}
set isRGLContainerNode(status: boolean) {
this._isRGLContainer = status;
}
get isRGLContainerNode(): boolean {
return !!this._isRGLContainer;
}
private _slotFor?: Prop | null = null;
@obx.shallow _slots: INode[] = [];
get slots() {
return this._slots;
}
/* istanbul ignore next */
@obx.ref private _conditionGroup: IPublicModelExclusiveGroup | null = null;
/* istanbul ignore next */
get conditionGroup(): IPublicModelExclusiveGroup | null {
return this._conditionGroup;
}
private purged = false;
/**
*
*/
get isPurged() {
return this.purged;
}
private purging: boolean = false;
/**
*
*/
get isPurging() {
return this.purging;
}
@obx.shallow status: NodeStatus = {
inPlaceEditing: false,
locking: false,
pseudo: false,
};
constructor(readonly document: IDocumentModel, nodeSchema: Schema, options: any = {}) { constructor(readonly document: IDocumentModel, nodeSchema: Schema, options: any = {}) {
makeObservable(this); makeObservable(this);
const { componentName, id, children, props, ...extras } = nodeSchema; const { componentName, id, children, props, ...extras } = nodeSchema;
@ -237,14 +314,6 @@ export class Node<Schema extends IPublicTypeNodeSchema = IPublicTypeNodeSchema>
}); });
} }
_settingEntry: SettingTopEntry;
get settingEntry(): SettingTopEntry {
if (this._settingEntry) return this._settingEntry;
this._settingEntry = this.document.designer.createSettingEntry([this]);
return this._settingEntry;
}
/** /**
* prop reaction * prop reaction
*/ */
@ -268,8 +337,6 @@ export class Node<Schema extends IPublicTypeNodeSchema = IPublicTypeNodeSchema>
return this.document.designer.transformProps(props, this, IPublicEnumTransformStage.Upgrade); return this.document.designer.transformProps(props, this, IPublicEnumTransformStage.Upgrade);
} }
private autoruns?: Array<() => void>;
private setupAutoruns() { private setupAutoruns() {
const autoruns = this.componentMeta.getMetadata().configure.advanced?.autoruns; const autoruns = this.componentMeta.getMetadata().configure.advanced?.autoruns;
if (!autoruns || autoruns.length < 1) { if (!autoruns || autoruns.length < 1) {
@ -296,24 +363,6 @@ export class Node<Schema extends IPublicTypeNodeSchema = IPublicTypeNodeSchema>
return children || []; return children || [];
} }
private _isRGLContainer = false;
set isRGLContainer(status: boolean) {
this._isRGLContainer = status;
}
get isRGLContainer(): boolean {
return !!this._isRGLContainer;
}
set isRGLContainerNode(status: boolean) {
this._isRGLContainer = status;
}
get isRGLContainerNode(): boolean {
return !!this._isRGLContainer;
}
isContainer(): boolean { isContainer(): boolean {
return this.isContainerNode; return this.isContainerNode;
} }
@ -449,8 +498,6 @@ export class Node<Schema extends IPublicTypeNodeSchema = IPublicTypeNodeSchema>
} }
} }
private _slotFor?: Prop | null = null;
internalSetSlotFor(slotFor: Prop | null | undefined) { internalSetSlotFor(slotFor: Prop | null | undefined) {
this._slotFor = slotFor; this._slotFor = slotFor;
} }
@ -536,24 +583,10 @@ export class Node<Schema extends IPublicTypeNodeSchema = IPublicTypeNodeSchema>
return this.props.export(IPublicEnumTransformStage.Serilize).props || null; return this.props.export(IPublicEnumTransformStage.Serilize).props || null;
} }
@obx.shallow _slots: INode[] = [];
hasSlots() { hasSlots() {
return this._slots.length > 0; return this._slots.length > 0;
} }
get slots() {
return this._slots;
}
/* istanbul ignore next */
@obx.ref private _conditionGroup: IPublicModelExclusiveGroup | null = null;
/* istanbul ignore next */
get conditionGroup(): IPublicModelExclusiveGroup | null {
return this._conditionGroup;
}
/* istanbul ignore next */ /* istanbul ignore next */
setConditionGroup(grp: IPublicModelExclusiveGroup | string | null) { setConditionGroup(grp: IPublicModelExclusiveGroup | string | null) {
if (!grp) { if (!grp) {
@ -929,15 +962,6 @@ export class Node<Schema extends IPublicTypeNodeSchema = IPublicTypeNodeSchema>
this.children?.delete(node); this.children?.delete(node);
} }
private purged = false;
/**
*
*/
get isPurged() {
return this.purged;
}
/** /**
* *
*/ */
@ -952,18 +976,10 @@ export class Node<Schema extends IPublicTypeNodeSchema = IPublicTypeNodeSchema>
// this.document.destroyNode(this); // this.document.destroyNode(this);
} }
private purging: boolean = false;
internalPurgeStart() { internalPurgeStart() {
this.purging = true; this.purging = true;
} }
/**
*
*/
get isPurging() {
return this.purging;
}
/** /**
* action * action
*/ */
@ -1044,12 +1060,6 @@ export class Node<Schema extends IPublicTypeNodeSchema = IPublicTypeNodeSchema>
this.children?.mergeChildren(remover, adder, sorter); this.children?.mergeChildren(remover, adder, sorter);
} }
@obx.shallow status: NodeStatus = {
inPlaceEditing: false,
locking: false,
pseudo: false,
};
/** /**
* @deprecated * @deprecated
*/ */

View File

@ -1,6 +1,9 @@
import { ModalNodesManager as InnerModalNodesManager } from '@alilc/lowcode-designer'; import {
IModalNodesManager as InnerModalNodesManager,
INode as InnerNode,
} from '@alilc/lowcode-designer';
import { IPublicModelModalNodesManager, IPublicModelNode } from '@alilc/lowcode-types'; import { IPublicModelModalNodesManager, IPublicModelNode } from '@alilc/lowcode-types';
import { Node } from './node'; import { Node as ShellNode } from './node';
import { nodeSymbol, modalNodesManagerSymbol } from '../symbols'; import { nodeSymbol, modalNodesManagerSymbol } from '../symbols';
export class ModalNodesManager implements IPublicModelModalNodesManager { export class ModalNodesManager implements IPublicModelModalNodesManager {
@ -28,18 +31,24 @@ export class ModalNodesManager implements IPublicModelModalNodesManager {
/** /**
* *
* @returns
*/ */
getModalNodes(): any { getModalNodes(): IPublicModelNode[] {
return this[modalNodesManagerSymbol].getModalNodes().map((node) => Node.create(node)); const innerNodes = this[modalNodesManagerSymbol].getModalNodes();
const shellNodes: IPublicModelNode[] = [];
innerNodes?.forEach((node: InnerNode) => {
const shellNode = ShellNode.create(node);
if (shellNode) {
shellNodes.push(shellNode);
}
});
return shellNodes;
} }
/** /**
* *
* @returns
*/ */
getVisibleModalNode(): any { getVisibleModalNode(): IPublicModelNode | null {
return Node.create(this[modalNodesManagerSymbol].getVisibleModalNode()); return ShellNode.create(this[modalNodesManagerSymbol].getVisibleModalNode());
} }
/** /**
@ -54,7 +63,7 @@ export class ModalNodesManager implements IPublicModelModalNodesManager {
* @param node Node * @param node Node
*/ */
setVisible(node: IPublicModelNode): void { setVisible(node: IPublicModelNode): void {
this[modalNodesManagerSymbol].setVisible(node[nodeSymbol]); this[modalNodesManagerSymbol].setVisible((node as any)[nodeSymbol]);
} }
/** /**
@ -62,6 +71,6 @@ export class ModalNodesManager implements IPublicModelModalNodesManager {
* @param node Node * @param node Node
*/ */
setInvisible(node: IPublicModelNode): void { setInvisible(node: IPublicModelNode): void {
this[modalNodesManagerSymbol].setInvisible(node[nodeSymbol]); this[modalNodesManagerSymbol].setInvisible((node as any)[nodeSymbol]);
} }
} }

View File

@ -1,36 +1,41 @@
import { IPublicModelNode } from './'; import { IPublicModelNode } from './';
export interface IPublicModelModalNodesManager { export interface IPublicModelModalNodesManager {
/** /**
* *
* set modal nodes, trigger internal events
*/ */
setNodes(): void; setNodes(): void;
/** /**
* *
* @returns * get modal nodes
*/ */
getModalNodes(): any; getModalNodes(): IPublicModelNode[];
/** /**
* *
* @returns * get current visible modal node
*/ */
getVisibleModalNode(): any; getVisibleModalNode(): IPublicModelNode | null;
/** /**
* *
* hide modal nodes
*/ */
hideModalNodes(): void; hideModalNodes(): void;
/** /**
* *
* set specfic model node as visible
* @param node Node * @param node Node
*/ */
setVisible(node: IPublicModelNode): void; setVisible(node: IPublicModelNode): void;
/** /**
* *
* set specfic model node as invisible
* @param node Node * @param node Node
*/ */
setInvisible(node: IPublicModelNode): void; setInvisible(node: IPublicModelNode): void;