mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-12 19:52:51 +00:00
docs: update SettingField and SettingTopEntry docs
This commit is contained in:
parent
a0b51d7407
commit
e0ed17a16a
@ -29,12 +29,17 @@ sidebar_position: 0
|
|||||||
- node-children 节点孩子
|
- node-children 节点孩子
|
||||||
- props 属性集
|
- props 属性集
|
||||||
- prop 属性
|
- prop 属性
|
||||||
- setting-prop-entry 设置属性
|
- setting-field 设置属性
|
||||||
- setting-top-entry 设置属性集
|
- setting-top-entry 设置属性集
|
||||||
- component-meta 物料元数据
|
- component-meta 物料元数据
|
||||||
- selection 画布选中
|
- selection 画布选中
|
||||||
- detecting 画布 hover
|
- detecting 画布 hover
|
||||||
- history 操作历史
|
- history 操作历史
|
||||||
|
- window 低代码设计器窗口模型
|
||||||
|
- detecting 画布节点悬停模型
|
||||||
|
- modal-nodes-manager 模态节点管理器模型
|
||||||
|
- plugin-instance 插件实例
|
||||||
|
- drop-location 拖拽放置位置模型
|
||||||
|
|
||||||
|
|
||||||
## API 设计约定
|
## API 设计约定
|
||||||
|
|||||||
@ -9,7 +9,7 @@ sidebar_position: 10
|
|||||||
## 模块简介
|
## 模块简介
|
||||||
提供 init 等方法
|
提供 init 等方法
|
||||||
## 方法
|
## 方法
|
||||||
#### 1. init
|
#### init
|
||||||
初始化引擎
|
初始化引擎
|
||||||
|
|
||||||
**方法定义**
|
**方法定义**
|
||||||
|
|||||||
@ -1,113 +0,0 @@
|
|||||||
---
|
|
||||||
title: Config
|
|
||||||
sidebar_position: 16
|
|
||||||
---
|
|
||||||
> **@types** [IPublicModelEngineConfig](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/engine-config.ts)<br/>
|
|
||||||
> **@since** v1.1.3
|
|
||||||
|
|
||||||
## 方法
|
|
||||||
### has
|
|
||||||
|
|
||||||
判断指定 key 是否有值
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
/**
|
|
||||||
* 判断指定 key 是否有值
|
|
||||||
* check if config has certain key configed
|
|
||||||
* @param key
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
has(key: string): boolean;
|
|
||||||
```
|
|
||||||
|
|
||||||
### get
|
|
||||||
|
|
||||||
获取指定 key 的值
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
/**
|
|
||||||
* 获取指定 key 的值
|
|
||||||
* get value by key
|
|
||||||
* @param key
|
|
||||||
* @param defaultValue
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
get(key: string, defaultValue?: any): any;
|
|
||||||
```
|
|
||||||
|
|
||||||
### set
|
|
||||||
|
|
||||||
设置指定 key 的值
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
/**
|
|
||||||
* 设置指定 key 的值
|
|
||||||
* set value for certain key
|
|
||||||
* @param key
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
set(key: string, value: any): void;
|
|
||||||
```
|
|
||||||
|
|
||||||
### setConfig
|
|
||||||
批量设值,set 的对象版本
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
/**
|
|
||||||
* 批量设值,set 的对象版本
|
|
||||||
* set multiple config key-values
|
|
||||||
* @param config
|
|
||||||
*/
|
|
||||||
setConfig(config: { [key: string]: any }): void;
|
|
||||||
```
|
|
||||||
|
|
||||||
### getPreference
|
|
||||||
获取全局 Preference, 用于管理全局浏览器侧用户 Preference,如 Panel 是否钉住
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
/**
|
|
||||||
* 获取全局 Preference, 用于管理全局浏览器侧用户 Preference,如 Panel 是否钉住
|
|
||||||
* get global user preference manager, which can be use to store
|
|
||||||
* user`s preference in user localstorage, such as a panel is pinned or not.
|
|
||||||
* @returns {IPublicModelPreference}
|
|
||||||
* @since v1.1.0
|
|
||||||
*/
|
|
||||||
getPreference(): IPublicModelPreference;
|
|
||||||
```
|
|
||||||
|
|
||||||
相关类型:[IPublicModelPreference](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/preference.ts)
|
|
||||||
|
|
||||||
## 事件
|
|
||||||
|
|
||||||
### onGot
|
|
||||||
获取指定 key 的值,函数回调模式,若多次被赋值,回调会被多次调用
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
/**
|
|
||||||
* 获取指定 key 的值,函数回调模式,若多次被赋值,回调会被多次调用
|
|
||||||
* set callback for event of value set for some key
|
|
||||||
* this will be called each time the value is set
|
|
||||||
* @param key
|
|
||||||
* @param fn
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
onGot(key: string, fn: (data: any) => void): IPublicTypeDisposable;
|
|
||||||
```
|
|
||||||
|
|
||||||
相关类型:[IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts)
|
|
||||||
|
|
||||||
### onceGot
|
|
||||||
获取指定 key 的值,若此时还未赋值,则等待,若已有值,则直接返回值
|
|
||||||
> 注:此函数返回 Promise 实例,只会执行(fullfill)一次
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
/**
|
|
||||||
* 获取指定 key 的值,若此时还未赋值,则等待,若已有值,则直接返回值
|
|
||||||
* 注:此函数返回 Promise 实例,只会执行(fullfill)一次
|
|
||||||
* wait until value of certain key is set, will only be
|
|
||||||
* triggered once.
|
|
||||||
* @param key
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
onceGot(key: string): Promise<any>;
|
|
||||||
```
|
|
||||||
@ -4,68 +4,68 @@ sidebar_position: 6
|
|||||||
---
|
---
|
||||||
> **@types** [IPublicModelSettingField](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/setting-field.ts)<br/>
|
> **@types** [IPublicModelSettingField](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/setting-field.ts)<br/>
|
||||||
|
|
||||||
# 基本介绍
|
## 基本介绍
|
||||||
|
|
||||||
setter 设置器操作对象
|
setter 设置器操作对象
|
||||||
|
|
||||||
# 属性
|
## 属性
|
||||||
|
|
||||||
## isGroup
|
#### isGroup
|
||||||
|
|
||||||
获取设置属性的 isGroup
|
获取设置属性的 isGroup
|
||||||
|
|
||||||
`@type {boolean}`
|
`@type {boolean}`
|
||||||
|
|
||||||
|
|
||||||
## id
|
#### id
|
||||||
|
|
||||||
获取设置属性的 id
|
获取设置属性的 id
|
||||||
|
|
||||||
`@type {string}`
|
`@type {string}`
|
||||||
|
|
||||||
## name
|
#### name
|
||||||
|
|
||||||
获取设置属性的 name
|
获取设置属性的 name
|
||||||
|
|
||||||
`@type {string | number | undefined}`
|
`@type {string | number | undefined}`
|
||||||
|
|
||||||
## key
|
#### key
|
||||||
|
|
||||||
获取设置属性的 key
|
获取设置属性的 key
|
||||||
|
|
||||||
`@type {string | number | undefined}`
|
`@type {string | number | undefined}`
|
||||||
|
|
||||||
## path
|
#### path
|
||||||
|
|
||||||
获取设置属性的 path
|
获取设置属性的 path
|
||||||
|
|
||||||
`@type {(string | number)[]}`
|
`@type {(string | number)[]}`
|
||||||
|
|
||||||
## title
|
#### title
|
||||||
|
|
||||||
获取设置属性的 title
|
获取设置属性的 title
|
||||||
|
|
||||||
`@type {string}`
|
`@type {string}`
|
||||||
|
|
||||||
## setter
|
#### setter
|
||||||
|
|
||||||
获取设置属性的 setter
|
获取设置属性的 setter
|
||||||
|
|
||||||
`@type {IPublicTypeSetterType | null}`
|
`@type {IPublicTypeSetterType | null}`
|
||||||
|
|
||||||
## expanded
|
#### expanded
|
||||||
|
|
||||||
获取设置属性的 expanded
|
获取设置属性的 expanded
|
||||||
|
|
||||||
`@type {boolean}`
|
`@type {boolean}`
|
||||||
|
|
||||||
## extraProps
|
#### extraProps
|
||||||
|
|
||||||
获取设置属性的 extraProps
|
获取设置属性的 extraProps
|
||||||
|
|
||||||
`@type {IPublicTypeFieldExtraProps}`
|
`@type {IPublicTypeFieldExtraProps}`
|
||||||
|
|
||||||
## props
|
#### props
|
||||||
|
|
||||||
`@type {IPublicModelSettingTopEntry}`
|
`@type {IPublicModelSettingTopEntry}`
|
||||||
|
|
||||||
@ -73,14 +73,14 @@ setter 设置器操作对象
|
|||||||
|
|
||||||
相关类型:[IPublicModelSettingTopEntry](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/setting-top-entry.ts)
|
相关类型:[IPublicModelSettingTopEntry](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/setting-top-entry.ts)
|
||||||
|
|
||||||
## node
|
#### node
|
||||||
|
|
||||||
获取设置属性对应的节点实例
|
获取设置属性对应的节点实例
|
||||||
|
|
||||||
`@type {IPublicModelNode | null}`
|
`@type {IPublicModelNode | null}`
|
||||||
|
|
||||||
|
|
||||||
## parent
|
#### parent
|
||||||
|
|
||||||
获取设置属性的父设置属性
|
获取设置属性的父设置属性
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ setter 设置器操作对象
|
|||||||
|
|
||||||
相关类型:[IPublicModelSettingTopEntry](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/setting-top-entry.ts)
|
相关类型:[IPublicModelSettingTopEntry](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/setting-top-entry.ts)
|
||||||
|
|
||||||
## top
|
#### top
|
||||||
|
|
||||||
获取顶级设置属性
|
获取顶级设置属性
|
||||||
|
|
||||||
@ -100,19 +100,19 @@ setter 设置器操作对象
|
|||||||
|
|
||||||
相关类型:[IPublicModelSettingTopEntry](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/setting-top-entry.ts)
|
相关类型:[IPublicModelSettingTopEntry](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/setting-top-entry.ts)
|
||||||
|
|
||||||
## isSettingField
|
#### isSettingField
|
||||||
|
|
||||||
是否是 SettingField 实例
|
是否是 SettingField 实例
|
||||||
|
|
||||||
`@type {boolean}`
|
`@type {boolean}`
|
||||||
|
|
||||||
## componentMeta
|
#### componentMeta
|
||||||
|
|
||||||
`@type {IPublicModelComponentMeta}`
|
`@type {IPublicModelComponentMeta}`
|
||||||
|
|
||||||
相关类型:[IPublicModelComponentMeta](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/component-meta.ts)
|
相关类型:[IPublicModelComponentMeta](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/component-meta.ts)
|
||||||
|
|
||||||
## items
|
#### items
|
||||||
|
|
||||||
获取设置属性的 items
|
获取设置属性的 items
|
||||||
|
|
||||||
@ -120,9 +120,9 @@ setter 设置器操作对象
|
|||||||
|
|
||||||
相关类型:[IPublicTypeCustomView](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/custom-view.ts)
|
相关类型:[IPublicTypeCustomView](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/custom-view.ts)
|
||||||
|
|
||||||
# 方法
|
## 方法
|
||||||
|
|
||||||
## setKey
|
#### setKey
|
||||||
|
|
||||||
设置 key 值
|
设置 key 值
|
||||||
|
|
||||||
@ -134,7 +134,7 @@ setter 设置器操作对象
|
|||||||
setKey(key: string | number): void;
|
setKey(key: string | number): void;
|
||||||
```
|
```
|
||||||
|
|
||||||
## setValue
|
#### setValue
|
||||||
|
|
||||||
设置值
|
设置值
|
||||||
|
|
||||||
@ -150,7 +150,7 @@ setValue(val: IPublicTypeCompositeValue, extraOptions?: IPublicTypeSetValueOptio
|
|||||||
- [IPublicTypeCompositeValue](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/composite-value.ts)
|
- [IPublicTypeCompositeValue](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/composite-value.ts)
|
||||||
- [IPublicTypeSetValueOptions](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/set-value-options.ts)
|
- [IPublicTypeSetValueOptions](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/set-value-options.ts)
|
||||||
|
|
||||||
## setPropValue
|
#### setPropValue
|
||||||
|
|
||||||
设置子级属性值
|
设置子级属性值
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ setValue(val: IPublicTypeCompositeValue, extraOptions?: IPublicTypeSetValueOptio
|
|||||||
setPropValue(propName: string | number, value: any): void;
|
setPropValue(propName: string | number, value: any): void;
|
||||||
```
|
```
|
||||||
|
|
||||||
## clearPropValue
|
#### clearPropValue
|
||||||
|
|
||||||
清空指定属性值
|
清空指定属性值
|
||||||
|
|
||||||
@ -175,7 +175,7 @@ setPropValue(propName: string | number, value: any): void;
|
|||||||
clearPropValue(propName: string | number): void;
|
clearPropValue(propName: string | number): void;
|
||||||
```
|
```
|
||||||
|
|
||||||
## getDefaultValue
|
#### getDefaultValue
|
||||||
|
|
||||||
获取配置的默认值
|
获取配置的默认值
|
||||||
|
|
||||||
@ -187,7 +187,7 @@ clearPropValue(propName: string | number): void;
|
|||||||
getDefaultValue(): any;
|
getDefaultValue(): any;
|
||||||
```
|
```
|
||||||
|
|
||||||
## getValue
|
#### getValue
|
||||||
|
|
||||||
获取值
|
获取值
|
||||||
|
|
||||||
@ -199,7 +199,7 @@ getDefaultValue(): any;
|
|||||||
getValue(): any;
|
getValue(): any;
|
||||||
```
|
```
|
||||||
|
|
||||||
## getPropValue
|
#### getPropValue
|
||||||
|
|
||||||
获取子级属性值
|
获取子级属性值
|
||||||
|
|
||||||
@ -212,7 +212,7 @@ getValue(): any;
|
|||||||
getPropValue(propName: string | number): any;
|
getPropValue(propName: string | number): any;
|
||||||
```
|
```
|
||||||
|
|
||||||
## getExtraPropValue
|
#### getExtraPropValue
|
||||||
|
|
||||||
获取顶层附属属性值
|
获取顶层附属属性值
|
||||||
|
|
||||||
@ -223,7 +223,7 @@ getPropValue(propName: string | number): any;
|
|||||||
getExtraPropValue(propName: string): any;
|
getExtraPropValue(propName: string): any;
|
||||||
```
|
```
|
||||||
|
|
||||||
## setExtraPropValue
|
#### setExtraPropValue
|
||||||
|
|
||||||
设置顶层附属属性值
|
设置顶层附属属性值
|
||||||
|
|
||||||
@ -234,7 +234,7 @@ getExtraPropValue(propName: string): any;
|
|||||||
setExtraPropValue(propName: string, value: any): void;
|
setExtraPropValue(propName: string, value: any): void;
|
||||||
```
|
```
|
||||||
|
|
||||||
## getProps
|
#### getProps
|
||||||
|
|
||||||
获取设置属性集
|
获取设置属性集
|
||||||
|
|
||||||
@ -250,7 +250,7 @@ getProps(): IPublicModelSettingTopEntry;
|
|||||||
|
|
||||||
相关类型:[IPublicModelSettingTopEntry](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/setting-top-entry.ts)
|
相关类型:[IPublicModelSettingTopEntry](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/setting-top-entry.ts)
|
||||||
|
|
||||||
## isUseVariable
|
#### isUseVariable
|
||||||
|
|
||||||
是否绑定了变量
|
是否绑定了变量
|
||||||
|
|
||||||
@ -262,7 +262,7 @@ getProps(): IPublicModelSettingTopEntry;
|
|||||||
isUseVariable(): boolean;
|
isUseVariable(): boolean;
|
||||||
```
|
```
|
||||||
|
|
||||||
## setUseVariable
|
#### setUseVariable
|
||||||
|
|
||||||
设置绑定变量
|
设置绑定变量
|
||||||
|
|
||||||
@ -274,7 +274,7 @@ isUseVariable(): boolean;
|
|||||||
setUseVariable(flag: boolean): void;
|
setUseVariable(flag: boolean): void;
|
||||||
```
|
```
|
||||||
|
|
||||||
## createField
|
#### createField
|
||||||
|
|
||||||
创建一个设置 field 实例
|
创建一个设置 field 实例
|
||||||
|
|
||||||
@ -289,7 +289,7 @@ createField(config: IPublicTypeFieldConfig): IPublicModelSettingField;
|
|||||||
|
|
||||||
相关类型:[IPublicTypeFieldConfig](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/field-config.ts)
|
相关类型:[IPublicTypeFieldConfig](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/field-config.ts)
|
||||||
|
|
||||||
## getMockOrValue
|
#### getMockOrValue
|
||||||
|
|
||||||
获取值,当为变量时,返回 mock
|
获取值,当为变量时,返回 mock
|
||||||
|
|
||||||
@ -302,7 +302,7 @@ getMockOrValue(): any;
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## purge
|
#### purge
|
||||||
|
|
||||||
销毁当前 field 实例
|
销毁当前 field 实例
|
||||||
|
|
||||||
@ -313,7 +313,7 @@ getMockOrValue(): any;
|
|||||||
purge(): void;
|
purge(): void;
|
||||||
```
|
```
|
||||||
|
|
||||||
## remove
|
#### remove
|
||||||
|
|
||||||
移除当前 field 实例
|
移除当前 field 实例
|
||||||
|
|
||||||
@ -324,7 +324,9 @@ purge(): void;
|
|||||||
remove(): void;
|
remove(): void;
|
||||||
```
|
```
|
||||||
|
|
||||||
## onEffect
|
## 事件
|
||||||
|
|
||||||
|
#### onEffect
|
||||||
|
|
||||||
设置 autorun
|
设置 autorun
|
||||||
|
|
||||||
|
|||||||
@ -4,21 +4,21 @@ sidebar_position: 6
|
|||||||
---
|
---
|
||||||
> **@types** [IPublicModelSettingTopEntry](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/setting-top-entry.ts)<br/>
|
> **@types** [IPublicModelSettingTopEntry](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/setting-top-entry.ts)<br/>
|
||||||
|
|
||||||
# 基本介绍
|
## 基本介绍
|
||||||
|
|
||||||
setter 设置器顶层操作对象
|
setter 设置器顶层操作对象
|
||||||
|
|
||||||
# 属性
|
## 属性
|
||||||
|
|
||||||
## node
|
#### node
|
||||||
|
|
||||||
返回所属的节点实例
|
返回所属的节点实例
|
||||||
|
|
||||||
`@type {IPublicModelNode | null}`
|
`@type {IPublicModelNode | null}`
|
||||||
|
|
||||||
# 方法
|
## 方法
|
||||||
|
|
||||||
## get
|
#### get
|
||||||
|
|
||||||
获取子级属性对象
|
获取子级属性对象
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ get(propName: string | number): IPublicModelSettingField | null;
|
|||||||
相关类型:[IPublicModelSettingField](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/setting-field.ts)
|
相关类型:[IPublicModelSettingField](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/setting-field.ts)
|
||||||
|
|
||||||
|
|
||||||
## getPropValue
|
#### getPropValue
|
||||||
|
|
||||||
获取指定 propName 的值
|
获取指定 propName 的值
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ get(propName: string | number): IPublicModelSettingField | null;
|
|||||||
getPropValue(propName: string | number): any;
|
getPropValue(propName: string | number): any;
|
||||||
```
|
```
|
||||||
|
|
||||||
## setPropValue
|
#### setPropValue
|
||||||
|
|
||||||
设置指定 propName 的值
|
设置指定 propName 的值
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ getPropValue(propName: string | number): any;
|
|||||||
setPropValue(propName: string | number, value: any): void;
|
setPropValue(propName: string | number, value: any): void;
|
||||||
```
|
```
|
||||||
|
|
||||||
## clearPropValue
|
#### clearPropValue
|
||||||
|
|
||||||
清除指定 propName 的值
|
清除指定 propName 的值
|
||||||
|
|
||||||
|
|||||||
@ -20,6 +20,7 @@ import {
|
|||||||
DropLocation as ShellDropLocation,
|
DropLocation as ShellDropLocation,
|
||||||
ActiveTracker as ShellActiveTracker,
|
ActiveTracker as ShellActiveTracker,
|
||||||
Clipboard as ShellClipboard,
|
Clipboard as ShellClipboard,
|
||||||
|
DropLocation,
|
||||||
} from '../model';
|
} from '../model';
|
||||||
|
|
||||||
const clipboardInstanceSymbol = Symbol('clipboardInstace');
|
const clipboardInstanceSymbol = Symbol('clipboardInstace');
|
||||||
@ -66,10 +67,10 @@ export class Canvas implements IPublicApiCanvas {
|
|||||||
* 创建插入位置,考虑放到 dragon 中
|
* 创建插入位置,考虑放到 dragon 中
|
||||||
*/
|
*/
|
||||||
createLocation(locationData: IPublicTypeLocationData): IPublicModelDropLocation {
|
createLocation(locationData: IPublicTypeLocationData): IPublicModelDropLocation {
|
||||||
return this[designerSymbol].createLocation({
|
return new DropLocation(this[designerSymbol].createLocation({
|
||||||
...locationData,
|
...locationData,
|
||||||
target: (locationData.target as any)[nodeSymbol],
|
target: (locationData.target as any)[nodeSymbol],
|
||||||
});
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -59,7 +59,7 @@ import {
|
|||||||
observer as innerObserver,
|
observer as innerObserver,
|
||||||
} from '@alilc/lowcode-editor-core';
|
} from '@alilc/lowcode-editor-core';
|
||||||
import { Dragon as ShellDragon } from '../model';
|
import { Dragon as ShellDragon } from '../model';
|
||||||
import { ReactNode, Component } from 'react';
|
import { ReactNode } from 'react';
|
||||||
|
|
||||||
class DesignerCabin implements IPublicApiCommonDesignerCabin {
|
class DesignerCabin implements IPublicApiCommonDesignerCabin {
|
||||||
private readonly [editorSymbol]: Editor;
|
private readonly [editorSymbol]: Editor;
|
||||||
@ -246,7 +246,7 @@ class EditorCabin implements IPublicApiCommonEditorCabin {
|
|||||||
* Title 组件
|
* Title 组件
|
||||||
* @experimental unstable API, pay extra caution when trying to use this
|
* @experimental unstable API, pay extra caution when trying to use this
|
||||||
*/
|
*/
|
||||||
get Title(): Component {
|
get Title() {
|
||||||
return InnerTitle;
|
return InnerTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -254,7 +254,7 @@ class EditorCabin implements IPublicApiCommonEditorCabin {
|
|||||||
* Tip 组件
|
* Tip 组件
|
||||||
* @experimental unstable API, pay extra caution when trying to use this
|
* @experimental unstable API, pay extra caution when trying to use this
|
||||||
*/
|
*/
|
||||||
get Tip(): Component {
|
get Tip() {
|
||||||
return InnerTip;
|
return InnerTip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,3 +10,4 @@ export * from './simulator-host';
|
|||||||
export * from './skeleton';
|
export * from './skeleton';
|
||||||
export * from './canvas';
|
export * from './canvas';
|
||||||
export * from './workspace';
|
export * from './workspace';
|
||||||
|
export * from './config';
|
||||||
@ -1,8 +1,8 @@
|
|||||||
import { IPublicApiWorkspace, IPublicResourceList, IPublicTypeDisposable, IPublicTypeResourceType } from '@alilc/lowcode-types';
|
import { IPublicApiWorkspace, IPublicResourceList, IPublicTypeDisposable, IPublicTypeResourceType } from '@alilc/lowcode-types';
|
||||||
import { IWorkspace } from '@alilc/lowcode-workspace';
|
import { IWorkspace } from '@alilc/lowcode-workspace';
|
||||||
import { Plugins } from '@alilc/lowcode-shell';
|
|
||||||
import { workspaceSymbol } from '../symbols';
|
import { workspaceSymbol } from '../symbols';
|
||||||
import { Resource as ShellResource, Window as ShellWindow } from '../model';
|
import { Resource as ShellResource, Window as ShellWindow } from '../model';
|
||||||
|
import { Plugins } from './plugins';
|
||||||
|
|
||||||
export class Workspace implements IPublicApiWorkspace {
|
export class Workspace implements IPublicApiWorkspace {
|
||||||
readonly [workspaceSymbol]: IWorkspace;
|
readonly [workspaceSymbol]: IWorkspace;
|
||||||
|
|||||||
@ -9,7 +9,6 @@ import {
|
|||||||
Dragon,
|
Dragon,
|
||||||
SettingTopEntry,
|
SettingTopEntry,
|
||||||
Clipboard,
|
Clipboard,
|
||||||
Config,
|
|
||||||
SettingField,
|
SettingField,
|
||||||
} from './model';
|
} from './model';
|
||||||
import {
|
import {
|
||||||
@ -26,6 +25,7 @@ import {
|
|||||||
Canvas,
|
Canvas,
|
||||||
Workspace,
|
Workspace,
|
||||||
SimulatorHost,
|
SimulatorHost,
|
||||||
|
Config,
|
||||||
} from './api';
|
} from './api';
|
||||||
|
|
||||||
export * from './symbols';
|
export * from './symbols';
|
||||||
|
|||||||
@ -196,7 +196,7 @@ export class DocumentModel implements IPublicModelDocumentModel {
|
|||||||
* @param data
|
* @param data
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
createNode(data: IPublicTypeNodeSchema): IPublicModelNode | null {
|
createNode<IPublicModelNode>(data: IPublicTypeNodeSchema): IPublicModelNode | null {
|
||||||
return ShellNode.create(this[documentSymbol].createNode(data));
|
return ShellNode.create(this[documentSymbol].createNode(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { dragObjectSymbol } from '../symbols';
|
import { dragObjectSymbol } from '../symbols';
|
||||||
import { IPublicModelDragObject, IPublicModelDragObject as InnerDragObject, IPublicTypeDragNodeDataObject } from '@alilc/lowcode-types';
|
import { IPublicModelDragObject, IPublicModelDragObject as InnerDragObject, IPublicTypeDragNodeDataObject, IPublicTypeNodeSchema } from '@alilc/lowcode-types';
|
||||||
import { Node } from './node';
|
import { Node } from './node';
|
||||||
|
|
||||||
export class DragObject implements IPublicModelDragObject {
|
export class DragObject implements IPublicModelDragObject {
|
||||||
@ -16,11 +16,11 @@ export class DragObject implements IPublicModelDragObject {
|
|||||||
return new DragObject(dragObject);
|
return new DragObject(dragObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
get type(): any {
|
get type() {
|
||||||
return this[dragObjectSymbol].type;
|
return this[dragObjectSymbol].type;
|
||||||
}
|
}
|
||||||
|
|
||||||
get nodes(): any {
|
get nodes() {
|
||||||
const { nodes } = this[dragObjectSymbol];
|
const { nodes } = this[dragObjectSymbol];
|
||||||
if (!nodes) {
|
if (!nodes) {
|
||||||
return null;
|
return null;
|
||||||
@ -28,7 +28,7 @@ export class DragObject implements IPublicModelDragObject {
|
|||||||
return nodes.map(Node.create);
|
return nodes.map(Node.create);
|
||||||
}
|
}
|
||||||
|
|
||||||
get data(): any {
|
get data(): IPublicTypeNodeSchema | IPublicTypeNodeSchema[] {
|
||||||
return (this[dragObjectSymbol] as IPublicTypeDragNodeDataObject).data;
|
return (this[dragObjectSymbol] as IPublicTypeDragNodeDataObject).data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -19,4 +19,3 @@ export * from './active-tracker';
|
|||||||
export * from './plugin-instance';
|
export * from './plugin-instance';
|
||||||
export * from './window';
|
export * from './window';
|
||||||
export * from './clipboard';
|
export * from './clipboard';
|
||||||
export * from './config';
|
|
||||||
|
|||||||
@ -142,8 +142,8 @@ export class NodeChildren implements IPublicModelNodeChildren {
|
|||||||
* 类似数组的 map
|
* 类似数组的 map
|
||||||
* @param fn
|
* @param fn
|
||||||
*/
|
*/
|
||||||
map<T>(fn: (node: IPublicModelNode, index: number) => T[]): any[] | null {
|
map<T = any>(fn: (node: IPublicModelNode, index: number) => T): T[] | null {
|
||||||
return this[nodeChildrenSymbol].map((item: InnerNode, index: number) => {
|
return this[nodeChildrenSymbol].map<T>((item: InnerNode, index: number): T => {
|
||||||
return fn(ShellNode.create(item)!, index);
|
return fn(ShellNode.create(item)!, index);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,6 +31,10 @@ import { ConditionGroup } from './condition-group';
|
|||||||
|
|
||||||
const shellNodeSymbol = Symbol('shellNodeSymbol');
|
const shellNodeSymbol = Symbol('shellNodeSymbol');
|
||||||
|
|
||||||
|
function isShellNode(node: any): node is IPublicModelNode {
|
||||||
|
return node[shellNodeSymbol];
|
||||||
|
}
|
||||||
|
|
||||||
export class Node implements IPublicModelNode {
|
export class Node implements IPublicModelNode {
|
||||||
private readonly [documentSymbol]: InnerDocumentModel | null;
|
private readonly [documentSymbol]: InnerDocumentModel | null;
|
||||||
private readonly [nodeSymbol]: InnerNode;
|
private readonly [nodeSymbol]: InnerNode;
|
||||||
@ -326,12 +330,12 @@ export class Node implements IPublicModelNode {
|
|||||||
this._id = this[nodeSymbol].id;
|
this._id = this[nodeSymbol].id;
|
||||||
}
|
}
|
||||||
|
|
||||||
static create(node: InnerNode | null | undefined): IPublicModelNode | null {
|
static create(node: InnerNode | IPublicModelNode | null | undefined): IPublicModelNode | null {
|
||||||
if (!node) {
|
if (!node) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// @ts-ignore 直接返回已挂载的 shell node 实例
|
// @ts-ignore 直接返回已挂载的 shell node 实例
|
||||||
if (node[shellNodeSymbol]) {
|
if (isShellNode(node)) {
|
||||||
return (node as any)[shellNodeSymbol];
|
return (node as any)[shellNodeSymbol];
|
||||||
}
|
}
|
||||||
const shellNode = new Node(node);
|
const shellNode = new Node(node);
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import { IPublicTypeNodeSchema, IPublicTypeTitleContent } from '../type';
|
|||||||
import { IPublicEnumTransitionType } from '../enum';
|
import { IPublicEnumTransitionType } from '../enum';
|
||||||
|
|
||||||
export interface IPublicApiCommonUtils {
|
export interface IPublicApiCommonUtils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否为合法的 schema 结构
|
* 是否为合法的 schema 结构
|
||||||
* check if data is valid NodeSchema
|
* check if data is valid NodeSchema
|
||||||
@ -70,6 +71,7 @@ export interface IPublicApiCommonUtils {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
export interface IPublicApiCommonSkeletonCabin {
|
export interface IPublicApiCommonSkeletonCabin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑器框架 View
|
* 编辑器框架 View
|
||||||
* get Workbench Component
|
* get Workbench Component
|
||||||
@ -78,16 +80,18 @@ export interface IPublicApiCommonSkeletonCabin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface IPublicApiCommonEditorCabin {
|
export interface IPublicApiCommonEditorCabin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Title 组件
|
* Title 组件
|
||||||
* @experimental unstable API, pay extra caution when trying to use this
|
* @experimental unstable API, pay extra caution when trying to use this
|
||||||
*/
|
*/
|
||||||
get Tip(): React.FC<{}>;
|
get Tip(): React.ComponentClass<{}>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tip 组件
|
* Tip 组件
|
||||||
* @experimental unstable API, pay extra caution when trying to use this
|
* @experimental unstable API, pay extra caution when trying to use this
|
||||||
*/
|
*/
|
||||||
get Title(): React.FC<{
|
get Title(): React.ComponentClass<{
|
||||||
title: IPublicTypeTitleContent | undefined;
|
title: IPublicTypeTitleContent | undefined;
|
||||||
match?: boolean;
|
match?: boolean;
|
||||||
keywords?: string | null;
|
keywords?: string | null;
|
||||||
|
|||||||
@ -1,3 +1,11 @@
|
|||||||
import { IPublicTypeDragNodeDataObject, IPublicTypeDragNodeObject } from '../type';
|
import { IPublicEnumDragObjectType } from '../enum';
|
||||||
|
import { IPublicTypeNodeSchema } from '../type';
|
||||||
|
import { IPublicModelNode } from './node';
|
||||||
|
|
||||||
export type IPublicModelDragObject = Readonly<IPublicTypeDragNodeObject> | Readonly<IPublicTypeDragNodeDataObject>;
|
export class IPublicModelDragObject {
|
||||||
|
type: IPublicEnumDragObjectType.Node | IPublicEnumDragObjectType.NodeData;
|
||||||
|
|
||||||
|
data: IPublicTypeNodeSchema | IPublicTypeNodeSchema[] | null;
|
||||||
|
|
||||||
|
nodes: (IPublicModelNode | null)[] | null;
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user