mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-12 19:52:51 +00:00
Compare commits
2 Commits
v1.3.3-bet
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f6305c2284 | ||
|
|
2892a01d29 |
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# These owners will be the default owners for everything in
|
# These owners will be the default owners for everything in
|
||||||
# the repo. Unless a later match takes precedence
|
# the repo. Unless a later match takes precedence
|
||||||
* @liujuping @JackLian
|
* @liujuping @1ncounter
|
||||||
|
|
||||||
/modules/material-parser @akirakai
|
/modules/material-parser @akirakai
|
||||||
/modules/code-generator @qingniaotonghua
|
/modules/code-generator @qingniaotonghua
|
||||||
|
|||||||
2
.github/workflows/publish engine.yml
vendored
2
.github/workflows/publish engine.yml
vendored
@ -12,7 +12,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: >-
|
if: >-
|
||||||
contains(github.ref, 'refs/heads/release/') &&
|
contains(github.ref, 'refs/heads/release/') &&
|
||||||
(github.actor == 'JackLian' || github.actor == 'liujuping')
|
(github.actor == '1ncounter' || github.actor == 'liujuping')
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
|
|||||||
@ -36,7 +36,7 @@ $ yarn build
|
|||||||
|
|
||||||
|
|
||||||
## 功能
|
## 功能
|
||||||
- [x] 支持本地离线搜索
|
- [x] 支持本地离线搜搜
|
||||||
- [x] 版本化文档管理
|
- [x] 版本化文档管理
|
||||||
- [x] 离线静态部署
|
- [x] 离线静态部署
|
||||||
- [x] 主题(fork 宜搭开发者中心)
|
- [x] 主题(fork 宜搭开发者中心)
|
||||||
|
|||||||
@ -25,7 +25,8 @@ sidebar_position: 10
|
|||||||
|
|
||||||
注册一个新命令及其处理函数。
|
注册一个新命令及其处理函数。
|
||||||
|
|
||||||
```typescript
|
```
|
||||||
|
typescriptCopy code
|
||||||
/**
|
/**
|
||||||
* 注册一个新的命令及其处理程序。
|
* 注册一个新的命令及其处理程序。
|
||||||
* @param command {IPublicTypeCommand} - 要注册的命令。
|
* @param command {IPublicTypeCommand} - 要注册的命令。
|
||||||
@ -37,7 +38,8 @@ registerCommand(command: IPublicTypeCommand): void;
|
|||||||
|
|
||||||
注销一个已存在的命令。
|
注销一个已存在的命令。
|
||||||
|
|
||||||
```typescript
|
```
|
||||||
|
typescriptCopy code
|
||||||
/**
|
/**
|
||||||
* 注销一个已存在的命令。
|
* 注销一个已存在的命令。
|
||||||
* @param name {string} - 要注销的命令的名称。
|
* @param name {string} - 要注销的命令的名称。
|
||||||
@ -49,7 +51,8 @@ unregisterCommand(name: string): void;
|
|||||||
|
|
||||||
根据名称和提供的参数执行命令,确保参数符合命令的定义。
|
根据名称和提供的参数执行命令,确保参数符合命令的定义。
|
||||||
|
|
||||||
```typescript
|
```
|
||||||
|
typescriptCopy code
|
||||||
/**
|
/**
|
||||||
* 根据名称和提供的参数执行命令。
|
* 根据名称和提供的参数执行命令。
|
||||||
* @param name {string} - 要执行的命令的名称。
|
* @param name {string} - 要执行的命令的名称。
|
||||||
@ -62,7 +65,8 @@ executeCommand(name: string, args?: IPublicTypeCommandHandlerArgs): void;
|
|||||||
|
|
||||||
批量执行命令,在所有命令执行后进行重绘,历史记录中只记录一次。
|
批量执行命令,在所有命令执行后进行重绘,历史记录中只记录一次。
|
||||||
|
|
||||||
```typescript
|
```
|
||||||
|
typescriptCopy code
|
||||||
/**
|
/**
|
||||||
* 批量执行命令,随后进行重绘,历史记录中只记录一次。
|
* 批量执行命令,随后进行重绘,历史记录中只记录一次。
|
||||||
* @param commands {Array} - 命令对象的数组,包含名称和可选参数。
|
* @param commands {Array} - 命令对象的数组,包含名称和可选参数。
|
||||||
@ -74,7 +78,8 @@ batchExecuteCommand(commands: { name: string; args?: IPublicTypeCommandHandlerAr
|
|||||||
|
|
||||||
列出所有已注册的命令。
|
列出所有已注册的命令。
|
||||||
|
|
||||||
```typescript
|
```
|
||||||
|
typescriptCopy code
|
||||||
/**
|
/**
|
||||||
* 列出所有已注册的命令。
|
* 列出所有已注册的命令。
|
||||||
* @returns {IPublicTypeListCommand[]} - 已注册命令的数组。
|
* @returns {IPublicTypeListCommand[]} - 已注册命令的数组。
|
||||||
@ -86,7 +91,8 @@ listCommands(): IPublicTypeListCommand[];
|
|||||||
|
|
||||||
为命令执行过程中的错误注册错误处理回调函数。
|
为命令执行过程中的错误注册错误处理回调函数。
|
||||||
|
|
||||||
```typescript
|
```
|
||||||
|
typescriptCopy code
|
||||||
/**
|
/**
|
||||||
* 为命令执行过程中的错误注册一个回调函数。
|
* 为命令执行过程中的错误注册一个回调函数。
|
||||||
* @param callback {(name: string, error: Error) => void} - 错误处理的回调函数。
|
* @param callback {(name: string, error: Error) => void} - 错误处理的回调函数。
|
||||||
|
|||||||
@ -3,8 +3,6 @@ title: commonUI - UI 组件库
|
|||||||
sidebar_position: 10
|
sidebar_position: 10
|
||||||
---
|
---
|
||||||
|
|
||||||
> **@since** v1.3.0
|
|
||||||
|
|
||||||
## 简介
|
## 简介
|
||||||
CommonUI API 是一个专为低代码引擎设计的组件 UI 库,使用它开发的插件,可以保证在不同项目和主题切换中能够保持一致性和兼容性。
|
CommonUI API 是一个专为低代码引擎设计的组件 UI 库,使用它开发的插件,可以保证在不同项目和主题切换中能够保持一致性和兼容性。
|
||||||
|
|
||||||
|
|||||||
@ -32,19 +32,6 @@ bind(
|
|||||||
- [IPublicTypeHotkeyCallback](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/hotkey-callback.ts)
|
- [IPublicTypeHotkeyCallback](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/hotkey-callback.ts)
|
||||||
- [IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts)
|
- [IPublicTypeDisposable](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/disposable.ts)
|
||||||
|
|
||||||
### mount
|
|
||||||
|
|
||||||
给指定窗口绑定快捷键
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
/**
|
|
||||||
* 给指定窗口绑定快捷键
|
|
||||||
* @param window 窗口的 window 对象
|
|
||||||
*/
|
|
||||||
mount(window: Window): IPublicTypeDisposable;
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
## 使用示例
|
## 使用示例
|
||||||
### 基础示例
|
### 基础示例
|
||||||
|
|||||||
@ -20,7 +20,7 @@ sidebar_position: 1
|
|||||||
[在 Demo 中](https://lowcode-engine.cn/demo/demo-general/index.html),右上角有渲染模块的示例使用方式:
|
[在 Demo 中](https://lowcode-engine.cn/demo/demo-general/index.html),右上角有渲染模块的示例使用方式:
|
||||||

|

|
||||||
|
|
||||||
基于官方提供的渲染模块 [@alilc/lowcode-react-renderer](https://github.com/alibaba/lowcode-engine/tree/main/packages/react-renderer),你可以在 React 上下文渲染低代码编辑器产出的页面。
|
基于官方提供的渲染模块 [@alifd/lowcode-react-renderer](https://github.com/alibaba/lowcode-engine/tree/main/packages/react-renderer),你可以在 React 上下文渲染低代码编辑器产出的页面。
|
||||||
|
|
||||||
### 构造渲染模块所需数据
|
### 构造渲染模块所需数据
|
||||||
|
|
||||||
|
|||||||
@ -70,7 +70,7 @@ npm start
|
|||||||
在 lowcode-engine 目录下执行下面命令
|
在 lowcode-engine 目录下执行下面命令
|
||||||
```
|
```
|
||||||
cd docs
|
cd docs
|
||||||
npm install
|
|
||||||
npm start
|
npm start
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,7 @@ sidebar_position: 0
|
|||||||
### 1.2 协议草案起草人
|
### 1.2 协议草案起草人
|
||||||
|
|
||||||
- 撰写:月飞、康为、林熠
|
- 撰写:月飞、康为、林熠
|
||||||
- 审阅:大果、潕量、九神、元彦、戊子、屹凡、金禅、前道、天晟、游鹿、光弘、力皓
|
- 审阅:大果、潕量、九神、元彦、戊子、屹凡、金禅、前道、天晟、戊子、游鹿、光弘、力皓
|
||||||
|
|
||||||
|
|
||||||
### 1.3 版本号
|
### 1.3 版本号
|
||||||
@ -94,7 +94,7 @@ sidebar_position: 0
|
|||||||
|
|
||||||
### 1.9 使用范围
|
### 1.9 使用范围
|
||||||
|
|
||||||
本协议描述的是低代码搭建平台产物(应用、页面、区块、组件)的 schema 结构,以及实现其数据状态更新(内置 api)、能力扩展、国际化等方面完整,只在低代码搭建场景下可用;
|
本协议描述的是低代码搭建平台产物(应用、页面、区块、组件)的 schema 结构,以及实现其数据状态更新(内置 api)、能力扩展、国际化等方面完整,只在低代码搭建场景下可用;
|
||||||
|
|
||||||
### 1.10 协议目标
|
### 1.10 协议目标
|
||||||
|
|
||||||
@ -430,7 +430,7 @@ import { Input as CustomInput } from '@ali/custom/lib/input';
|
|||||||
| 参数 | 说明 | 类型 | 支持变量 | 默认值 | 备注 |
|
| 参数 | 说明 | 类型 | 支持变量 | 默认值 | 备注 |
|
||||||
| ----------- | ---------------------- | -------------------------------------- | -------- | ------ | ----------------------------------------------------------------------------------------------------------- |
|
| ----------- | ---------------------- | -------------------------------------- | -------- | ------ | ----------------------------------------------------------------------------------------------------------- |
|
||||||
| list[] | 数据源列表 | **ComponentDataSourceItem**[] | - | - | 成为为单个请求配置, 内容定义详见 [ComponentDataSourceItem 对象描述](#2314-componentdatasourceitem-对象描述) |
|
| list[] | 数据源列表 | **ComponentDataSourceItem**[] | - | - | 成为为单个请求配置, 内容定义详见 [ComponentDataSourceItem 对象描述](#2314-componentdatasourceitem-对象描述) |
|
||||||
| dataHandler | 所有请求数据的处理函数 | Function | - | - | 详见 [dataHandler Function 描述](#2317-datahandler-function-描述) |
|
| dataHandler | 所有请求数据的处理函数 | Function | - | - | 详见 [dataHandler Function 描述](#2317-datahandler-function 描述) |
|
||||||
|
|
||||||
##### 2.3.1.4 ComponentDataSourceItem 对象描述
|
##### 2.3.1.4 ComponentDataSourceItem 对象描述
|
||||||
|
|
||||||
@ -447,7 +447,7 @@ import { Input as CustomInput } from '@ali/custom/lib/input';
|
|||||||
| errorHandler | request 失败后的回调函数 | Function | - | - | 参数:请求出错 promise 的 error 内容 |
|
| errorHandler | request 失败后的回调函数 | Function | - | - | 参数:请求出错 promise 的 error 内容 |
|
||||||
| options {} | 请求参数 | **ComponentDataSourceItemOptions**| - | - | 每种请求类型对应不同参数,详见 | 每种请求类型对应不同参数,详见 [ComponentDataSourceItemOptions 对象描述](#2315-componentdatasourceitemoptions-对象描述) |
|
| options {} | 请求参数 | **ComponentDataSourceItemOptions**| - | - | 每种请求类型对应不同参数,详见 | 每种请求类型对应不同参数,详见 [ComponentDataSourceItemOptions 对象描述](#2315-componentdatasourceitemoptions-对象描述) |
|
||||||
|
|
||||||
**关于 dataHandler 与 errorHandler 的细节说明:**
|
**关于 dataHandler 于 errorHandler 的细节说明:**
|
||||||
|
|
||||||
request 返回的是一个 promise,dataHandler 和 errorHandler 遵循 Promise 对象的 then 方法,实际使用方式如下:
|
request 返回的是一个 promise,dataHandler 和 errorHandler 遵循 Promise 对象的 then 方法,实际使用方式如下:
|
||||||
|
|
||||||
@ -560,7 +560,7 @@ try {
|
|||||||
| 参数 | 说明 | 类型 | 支持变量 | 默认值 | 备注 |
|
| 参数 | 说明 | 类型 | 支持变量 | 默认值 | 备注 |
|
||||||
| ------------- | ---------------------- | ---------------- | -------- | ----------------- | ---------------------------------------------------------------------------------------------------------- |
|
| ------------- | ---------------------- | ---------------- | -------- | ----------------- | ---------------------------------------------------------------------------------------------------------- |
|
||||||
| id | 组件唯一标识 | String | - | | 可选,组件 id 由引擎随机生成(UUID),并保证唯一性,消费方为上层应用平台,在组件发生移动等场景需保持 id 不变 |
|
| id | 组件唯一标识 | String | - | | 可选,组件 id 由引擎随机生成(UUID),并保证唯一性,消费方为上层应用平台,在组件发生移动等场景需保持 id 不变 |
|
||||||
| componentName | 组件名称 | String | - | Div | 必填,首字母大写,同 [componentsMap](#22-组件映射关系a) 中的要求 |
|
| componentName | 组件名称 | String | - | Div | 必填,首字母大写,同 [componentsMap](#22-组件映射关系 a) 中的要求 |
|
||||||
| props {} | 组件属性对象 | **Props**| - | {} | 必填,详见 | 必填,详见 [Props 结构描述](#2311-props-结构描述) |
|
| props {} | 组件属性对象 | **Props**| - | {} | 必填,详见 | 必填,详见 [Props 结构描述](#2311-props-结构描述) |
|
||||||
| condition | 渲染条件 | Boolean | ✅ | true | 选填,根据表达式结果判断是否渲染物料;支持变量表达式 |
|
| condition | 渲染条件 | Boolean | ✅ | true | 选填,根据表达式结果判断是否渲染物料;支持变量表达式 |
|
||||||
| loop | 循环数据 | Array | ✅ | - | 选填,默认不进行循环渲染;支持变量表达式 |
|
| loop | 循环数据 | Array | ✅ | - | 选填,默认不进行循环渲染;支持变量表达式 |
|
||||||
@ -797,7 +797,7 @@ try {
|
|||||||
| 参数 | 说明 | 值类型 | 默认值 | 备注 |
|
| 参数 | 说明 | 值类型 | 默认值 | 备注 |
|
||||||
| ------ | ---------- | --------------------- | -------- | -------------------------------------------------------------- |
|
| ------ | ---------- | --------------------- | -------- | -------------------------------------------------------------- |
|
||||||
| type | 值类型描述 | String | 'JSSlot' | 固定值 |
|
| type | 值类型描述 | String | 'JSSlot' | 固定值 |
|
||||||
| value | 具体的值 | NodeSchema \| NodeSchema[] | null | 内容为 NodeSchema 类型,详见[组件结构描述](#232-组件结构描述(A)) |
|
| value | 具体的值 | NodeSchema \| NodeSchema[] | null | 内容为 NodeSchema 类型,详见[组件结构描述](#232-组件结构描述 a) |
|
||||||
| params | 函数的参数 | String[] | null | 函数的入参,其子节点可以通过 `this[参数名]` 来获取对应的参数。 |
|
| params | 函数的参数 | String[] | null | 函数的入参,其子节点可以通过 `this[参数名]` 来获取对应的参数。 |
|
||||||
|
|
||||||
|
|
||||||
@ -1124,7 +1124,7 @@ this.setState((prevState) => ({ count: prevState.count + 1 }));
|
|||||||
| utils[] | 工具类扩展映射关系 | **UtilItem**[] | - | |
|
| utils[] | 工具类扩展映射关系 | **UtilItem**[] | - | |
|
||||||
| *UtilItem*.name | 工具类扩展项名称 | String | - | |
|
| *UtilItem*.name | 工具类扩展项名称 | String | - | |
|
||||||
| *UtilItem*.type | 工具类扩展项类型 | 枚举, `'npm'` (代表公网 npm 类型) / `'tnpm'` (代表阿里巴巴内部 npm 类型) / `'function'` (代表 Javascript 函数类型) | - | |
|
| *UtilItem*.type | 工具类扩展项类型 | 枚举, `'npm'` (代表公网 npm 类型) / `'tnpm'` (代表阿里巴巴内部 npm 类型) / `'function'` (代表 Javascript 函数类型) | - | |
|
||||||
| *UtilItem*.content | 工具类扩展项内容 | [ComponentMap 类型](#22-组件映射关系a) 或 [JSFunction](#2342事件函数类型a) | - | |
|
| *UtilItem*.content | 工具类扩展项内容 | [ComponentMap 类型](#22-组件映射关系 a) 或 [JSFunction](#2432事件函数类型 a) | - | |
|
||||||
|
|
||||||
描述示例:
|
描述示例:
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-engine-docs",
|
"name": "@alilc/lowcode-engine-docs",
|
||||||
"version": "1.2.34",
|
"version": "1.2.31",
|
||||||
"description": "低代码引擎版本化文档",
|
"description": "低代码引擎版本化文档",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"files": [
|
"files": [
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"lerna": "4.0.0",
|
"lerna": "4.0.0",
|
||||||
"version": "1.3.3-beta.1",
|
"version": "1.3.2",
|
||||||
"npmClient": "yarn",
|
"npmClient": "yarn",
|
||||||
"useWorkspaces": true,
|
"useWorkspaces": true,
|
||||||
"packages": [
|
"packages": [
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-designer",
|
"name": "@alilc/lowcode-designer",
|
||||||
"version": "1.3.3-beta.1",
|
"version": "1.3.2",
|
||||||
"description": "Designer for Ali LowCode Engine",
|
"description": "Designer for Ali LowCode Engine",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"module": "es/index.js",
|
"module": "es/index.js",
|
||||||
@ -15,9 +15,9 @@
|
|||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alilc/lowcode-editor-core": "1.3.3-beta.1",
|
"@alilc/lowcode-editor-core": "1.3.2",
|
||||||
"@alilc/lowcode-types": "1.3.3-beta.1",
|
"@alilc/lowcode-types": "1.3.2",
|
||||||
"@alilc/lowcode-utils": "1.3.3-beta.1",
|
"@alilc/lowcode-utils": "1.3.2",
|
||||||
"classnames": "^2.2.6",
|
"classnames": "^2.2.6",
|
||||||
"react": "^16",
|
"react": "^16",
|
||||||
"react-dom": "^16.7.0",
|
"react-dom": "^16.7.0",
|
||||||
|
|||||||
@ -5,6 +5,18 @@ import { Menu } from '@alifd/next';
|
|||||||
import { engineConfig } from '@alilc/lowcode-editor-core';
|
import { engineConfig } from '@alilc/lowcode-editor-core';
|
||||||
import './context-menu-actions.scss';
|
import './context-menu-actions.scss';
|
||||||
|
|
||||||
|
export interface IContextMenuActions {
|
||||||
|
actions: IPublicTypeContextMenuAction[];
|
||||||
|
|
||||||
|
adjustMenuLayoutFn: (actions: IPublicTypeContextMenuItem[]) => IPublicTypeContextMenuItem[];
|
||||||
|
|
||||||
|
addMenuAction: IPublicApiMaterial['addContextMenuOption'];
|
||||||
|
|
||||||
|
removeMenuAction: IPublicApiMaterial['removeContextMenuOption'];
|
||||||
|
|
||||||
|
adjustMenuLayout: IPublicApiMaterial['adjustContextMenuLayout'];
|
||||||
|
}
|
||||||
|
|
||||||
let adjustMenuLayoutFn: Function = (actions: IPublicTypeContextMenuAction[]) => actions;
|
let adjustMenuLayoutFn: Function = (actions: IPublicTypeContextMenuAction[]) => actions;
|
||||||
|
|
||||||
export class GlobalContextMenuActions {
|
export class GlobalContextMenuActions {
|
||||||
@ -104,7 +116,7 @@ export class GlobalContextMenuActions {
|
|||||||
|
|
||||||
const globalContextMenuActions = new GlobalContextMenuActions();
|
const globalContextMenuActions = new GlobalContextMenuActions();
|
||||||
|
|
||||||
export class ContextMenuActions {
|
export class ContextMenuActions implements IContextMenuActions {
|
||||||
actions: IPublicTypeContextMenuAction[] = [];
|
actions: IPublicTypeContextMenuAction[] = [];
|
||||||
|
|
||||||
designer: IDesigner;
|
designer: IDesigner;
|
||||||
@ -192,32 +204,30 @@ export class ContextMenuActions {
|
|||||||
originalEvent.stopPropagation();
|
originalEvent.stopPropagation();
|
||||||
originalEvent.preventDefault();
|
originalEvent.preventDefault();
|
||||||
// 如果右键的节点不在 当前选中的节点中,选中该节点
|
// 如果右键的节点不在 当前选中的节点中,选中该节点
|
||||||
if (!designer.currentSelection?.has(node.id)) {
|
if (!designer.currentSelection.has(node.id)) {
|
||||||
designer.currentSelection?.select(node.id);
|
designer.currentSelection.select(node.id);
|
||||||
}
|
}
|
||||||
const nodes = designer.currentSelection?.getNodes();
|
const nodes = designer.currentSelection.getNodes();
|
||||||
this.handleContextMenu(nodes, originalEvent);
|
this.handleContextMenu(nodes, originalEvent);
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
addMenuAction: IPublicApiMaterial['addContextMenuOption'] = (action: IPublicTypeContextMenuAction) => {
|
addMenuAction(action: IPublicTypeContextMenuAction) {
|
||||||
this.actions.push({
|
this.actions.push({
|
||||||
type: IPublicEnumContextMenuType.MENU_ITEM,
|
type: IPublicEnumContextMenuType.MENU_ITEM,
|
||||||
...action,
|
...action,
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
removeMenuAction: IPublicApiMaterial['removeContextMenuOption'] = (name: string) => {
|
removeMenuAction(name: string) {
|
||||||
const i = this.actions.findIndex((action) => action.name === name);
|
const i = this.actions.findIndex((action) => action.name === name);
|
||||||
if (i > -1) {
|
if (i > -1) {
|
||||||
this.actions.splice(i, 1);
|
this.actions.splice(i, 1);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
adjustMenuLayout: IPublicApiMaterial['adjustContextMenuLayout'] = (fn: (actions: IPublicTypeContextMenuItem[]) => IPublicTypeContextMenuItem[]) => {
|
adjustMenuLayout(fn: (actions: IPublicTypeContextMenuItem[]) => IPublicTypeContextMenuItem[]) {
|
||||||
adjustMenuLayoutFn = fn;
|
adjustMenuLayoutFn = fn;
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IContextMenuActions extends ContextMenuActions {}
|
|
||||||
@ -1,16 +1,16 @@
|
|||||||
import { Component } from 'react';
|
import { Component } from 'react';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import BuiltinDragGhostComponent from './drag-ghost';
|
import BuiltinDragGhostComponent from './drag-ghost';
|
||||||
import { Designer, DesignerProps, IDesigner } from './designer';
|
import { Designer, DesignerProps } from './designer';
|
||||||
import { ProjectView } from '../project';
|
import { ProjectView } from '../project';
|
||||||
import './designer.less';
|
import './designer.less';
|
||||||
|
|
||||||
type IProps = DesignerProps & {
|
type IProps = DesignerProps & {
|
||||||
designer?: IDesigner;
|
designer?: Designer;
|
||||||
};
|
};
|
||||||
|
|
||||||
export class DesignerView extends Component<IProps> {
|
export class DesignerView extends Component<IProps> {
|
||||||
readonly designer: IDesigner;
|
readonly designer: Designer;
|
||||||
readonly viewName: string | undefined;
|
readonly viewName: string | undefined;
|
||||||
|
|
||||||
constructor(props: IProps) {
|
constructor(props: IProps) {
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import {
|
|||||||
IPublicTypeComponentAction,
|
IPublicTypeComponentAction,
|
||||||
IPublicTypeNpmInfo,
|
IPublicTypeNpmInfo,
|
||||||
IPublicModelEditor,
|
IPublicModelEditor,
|
||||||
|
IPublicTypeCompositeObject,
|
||||||
IPublicTypePropsList,
|
IPublicTypePropsList,
|
||||||
IPublicTypeNodeSchema,
|
IPublicTypeNodeSchema,
|
||||||
IPublicTypePropsTransducer,
|
IPublicTypePropsTransducer,
|
||||||
@ -16,16 +17,15 @@ import {
|
|||||||
IPublicTypeLocationData,
|
IPublicTypeLocationData,
|
||||||
IPublicEnumTransformStage,
|
IPublicEnumTransformStage,
|
||||||
IPublicModelLocateEvent,
|
IPublicModelLocateEvent,
|
||||||
IPublicTypePropsMap,
|
|
||||||
} from '@alilc/lowcode-types';
|
} from '@alilc/lowcode-types';
|
||||||
import { mergeAssets, IPublicTypeAssetsJson, isNodeSchema, isDragNodeObject, isDragNodeDataObject, isLocationChildrenDetail, Logger } from '@alilc/lowcode-utils';
|
import { mergeAssets, IPublicTypeAssetsJson, isNodeSchema, isDragNodeObject, isDragNodeDataObject, isLocationChildrenDetail, Logger } from '@alilc/lowcode-utils';
|
||||||
import { IProject, Project } from '../project';
|
import { IProject, Project } from '../project';
|
||||||
import { Node, DocumentModel, insertChildren, INode } from '../document';
|
import { Node, DocumentModel, insertChildren, INode, ISelection } from '../document';
|
||||||
import { ComponentMeta, IComponentMeta } from '../component-meta';
|
import { ComponentMeta, IComponentMeta } from '../component-meta';
|
||||||
import { INodeSelector, Component } from '../simulator';
|
import { INodeSelector, Component } from '../simulator';
|
||||||
import { Scroller } from './scroller';
|
import { Scroller } from './scroller';
|
||||||
import { Dragon, IDragon } from './dragon';
|
import { Dragon, IDragon } from './dragon';
|
||||||
import { ActiveTracker } from './active-tracker';
|
import { ActiveTracker, IActiveTracker } from './active-tracker';
|
||||||
import { Detecting } from './detecting';
|
import { Detecting } from './detecting';
|
||||||
import { DropLocation } from './location';
|
import { DropLocation } from './location';
|
||||||
import { OffsetObserver, createOffsetObserver } from './offset-observer';
|
import { OffsetObserver, createOffsetObserver } from './offset-observer';
|
||||||
@ -47,7 +47,7 @@ export interface DesignerProps {
|
|||||||
viewName?: string;
|
viewName?: string;
|
||||||
simulatorProps?: Record<string, any> | ((document: DocumentModel) => object);
|
simulatorProps?: Record<string, any> | ((document: DocumentModel) => object);
|
||||||
simulatorComponent?: ComponentType<any>;
|
simulatorComponent?: ComponentType<any>;
|
||||||
dragGhostComponent?: ComponentType<{ designer: IDesigner }>;
|
dragGhostComponent?: ComponentType<any>;
|
||||||
suspensed?: boolean;
|
suspensed?: boolean;
|
||||||
componentMetadatas?: IPublicTypeComponentMetadata[];
|
componentMetadatas?: IPublicTypeComponentMetadata[];
|
||||||
globalComponentActions?: IPublicTypeComponentAction[];
|
globalComponentActions?: IPublicTypeComponentAction[];
|
||||||
@ -60,10 +60,70 @@ export interface DesignerProps {
|
|||||||
) => void;
|
) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Designer {
|
export interface IDesigner {
|
||||||
|
readonly shellModelFactory: IShellModelFactory;
|
||||||
|
|
||||||
|
viewName: string | undefined;
|
||||||
|
|
||||||
|
readonly project: IProject;
|
||||||
|
|
||||||
|
get dragon(): IDragon;
|
||||||
|
|
||||||
|
get activeTracker(): IActiveTracker;
|
||||||
|
|
||||||
|
get componentActions(): ComponentActions;
|
||||||
|
|
||||||
|
get contextMenuActions(): ContextMenuActions;
|
||||||
|
|
||||||
|
get editor(): IPublicModelEditor;
|
||||||
|
|
||||||
|
get detecting(): Detecting;
|
||||||
|
|
||||||
|
get simulatorComponent(): ComponentType<any> | undefined;
|
||||||
|
|
||||||
|
get currentSelection(): ISelection;
|
||||||
|
|
||||||
|
createScroller(scrollable: IPublicTypeScrollable): IPublicModelScroller;
|
||||||
|
|
||||||
|
refreshComponentMetasMap(): void;
|
||||||
|
|
||||||
|
createOffsetObserver(nodeInstance: INodeSelector): OffsetObserver | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建插入位置,考虑放到 dragon 中
|
||||||
|
*/
|
||||||
|
createLocation(locationData: IPublicTypeLocationData<INode>): DropLocation;
|
||||||
|
|
||||||
|
get componentsMap(): { [key: string]: IPublicTypeNpmInfo | Component };
|
||||||
|
|
||||||
|
loadIncrementalAssets(incrementalAssets: IPublicTypeAssetsJson): Promise<void>;
|
||||||
|
|
||||||
|
getComponentMeta(
|
||||||
|
componentName: string,
|
||||||
|
generateMetadata?: () => IPublicTypeComponentMetadata | null,
|
||||||
|
): IComponentMeta;
|
||||||
|
|
||||||
|
clearLocation(): void;
|
||||||
|
|
||||||
|
createComponentMeta(data: IPublicTypeComponentMetadata): IComponentMeta | null;
|
||||||
|
|
||||||
|
getComponentMetasMap(): Map<string, IComponentMeta>;
|
||||||
|
|
||||||
|
addPropsReducer(reducer: IPublicTypePropsTransducer, stage: IPublicEnumTransformStage): void;
|
||||||
|
|
||||||
|
postEvent(event: string, ...args: any[]): void;
|
||||||
|
|
||||||
|
transformProps(props: IPublicTypeCompositeObject | IPublicTypePropsList, node: Node, stage: IPublicEnumTransformStage): IPublicTypeCompositeObject | IPublicTypePropsList;
|
||||||
|
|
||||||
|
createSettingEntry(nodes: INode[]): ISettingTopEntry;
|
||||||
|
|
||||||
|
autorun(effect: (reaction: IReactionPublic) => void, options?: IReactionOptions<any, any>): IReactionDisposer;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class Designer implements IDesigner {
|
||||||
dragon: IDragon;
|
dragon: IDragon;
|
||||||
|
|
||||||
readonly viewName: string | undefined;
|
viewName: string | undefined;
|
||||||
|
|
||||||
readonly componentActions = new ComponentActions();
|
readonly componentActions = new ComponentActions();
|
||||||
|
|
||||||
@ -363,7 +423,7 @@ export class Designer {
|
|||||||
if (props.simulatorProps !== this.props.simulatorProps) {
|
if (props.simulatorProps !== this.props.simulatorProps) {
|
||||||
this._simulatorProps = props.simulatorProps;
|
this._simulatorProps = props.simulatorProps;
|
||||||
// 重新 setupSelection
|
// 重新 setupSelection
|
||||||
if ((props.simulatorProps as any)?.designMode !== (this.props.simulatorProps as any)?.designMode) {
|
if (props.simulatorProps?.designMode !== this.props.simulatorProps?.designMode) {
|
||||||
this.setupSelection();
|
this.setupSelection();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -552,7 +612,7 @@ export class Designer {
|
|||||||
return maps;
|
return maps;
|
||||||
}
|
}
|
||||||
|
|
||||||
transformProps(props: IPublicTypePropsMap | IPublicTypePropsList, node: Node, stage: IPublicEnumTransformStage): IPublicTypePropsMap | IPublicTypePropsList {
|
transformProps(props: IPublicTypeCompositeObject | IPublicTypePropsList, node: Node, stage: IPublicEnumTransformStage) {
|
||||||
if (Array.isArray(props)) {
|
if (Array.isArray(props)) {
|
||||||
// current not support, make this future
|
// current not support, make this future
|
||||||
return props;
|
return props;
|
||||||
@ -563,7 +623,7 @@ export class Designer {
|
|||||||
return props;
|
return props;
|
||||||
}
|
}
|
||||||
|
|
||||||
return reducers.reduce((xprops, reducer: IPublicTypePropsTransducer) => {
|
return reducers.reduce((xprops, reducer) => {
|
||||||
try {
|
try {
|
||||||
return reducer(xprops, node.internalToShellNode() as any, { stage });
|
return reducer(xprops, node.internalToShellNode() as any, { stage });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -595,5 +655,3 @@ export class Designer {
|
|||||||
// TODO:
|
// TODO:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IDesigner extends Designer {}
|
|
||||||
|
|||||||
@ -95,13 +95,17 @@ function isDragEvent(e: any): e is DragEvent {
|
|||||||
return e?.type?.startsWith('drag');
|
return e?.type?.startsWith('drag');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
export interface IDragon extends IPublicModelDragon<
|
||||||
* Drag-on 拖拽引擎
|
|
||||||
*/
|
|
||||||
export class Dragon implements IPublicModelDragon<
|
|
||||||
INode,
|
INode,
|
||||||
ILocateEvent
|
ILocateEvent
|
||||||
> {
|
> {
|
||||||
|
emitter: IEventBus;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Drag-on 拖拽引擎
|
||||||
|
*/
|
||||||
|
export class Dragon implements IDragon {
|
||||||
private sensors: IPublicModelSensor[] = [];
|
private sensors: IPublicModelSensor[] = [];
|
||||||
|
|
||||||
private nodeInstPointerEvents: boolean;
|
private nodeInstPointerEvents: boolean;
|
||||||
@ -633,5 +637,3 @@ export class Dragon implements IPublicModelDragon<
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IDragon extends Dragon { }
|
|
||||||
|
|||||||
@ -28,11 +28,11 @@ export class OffsetObserver {
|
|||||||
@obx private _bottom = 0;
|
@obx private _bottom = 0;
|
||||||
|
|
||||||
@computed get height() {
|
@computed get height() {
|
||||||
return this.isRoot ? this.viewport?.height : this._height * this.scale;
|
return this.isRoot ? this.viewport.height : this._height * this.scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
@computed get width() {
|
@computed get width() {
|
||||||
return this.isRoot ? this.viewport?.width : this._width * this.scale;
|
return this.isRoot ? this.viewport.width : this._width * this.scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
@computed get top() {
|
@computed get top() {
|
||||||
@ -44,51 +44,51 @@ export class OffsetObserver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@computed get bottom() {
|
@computed get bottom() {
|
||||||
return this.isRoot ? this.viewport?.height : this._bottom * this.scale;
|
return this.isRoot ? this.viewport.height : this._bottom * this.scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
@computed get right() {
|
@computed get right() {
|
||||||
return this.isRoot ? this.viewport?.width : this._right * this.scale;
|
return this.isRoot ? this.viewport.width : this._right * this.scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
@obx hasOffset = false;
|
@obx hasOffset = false;
|
||||||
|
|
||||||
@computed get offsetLeft() {
|
@computed get offsetLeft() {
|
||||||
if (this.isRoot) {
|
if (this.isRoot) {
|
||||||
return (this.viewport?.scrollX || 0) * this.scale;
|
return this.viewport.scrollX * this.scale;
|
||||||
}
|
}
|
||||||
if (!this.viewport?.scrolling || this.lastOffsetLeft == null) {
|
if (!this.viewport.scrolling || this.lastOffsetLeft == null) {
|
||||||
this.lastOffsetLeft = this.left + (this.viewport?.scrollX || 0) * this.scale;
|
this.lastOffsetLeft = this.left + this.viewport.scrollX * this.scale;
|
||||||
}
|
}
|
||||||
return this.lastOffsetLeft;
|
return this.lastOffsetLeft;
|
||||||
}
|
}
|
||||||
|
|
||||||
@computed get offsetTop() {
|
@computed get offsetTop() {
|
||||||
if (this.isRoot) {
|
if (this.isRoot) {
|
||||||
return (this.viewport?.scrollY || 0) * this.scale;
|
return this.viewport.scrollY * this.scale;
|
||||||
}
|
}
|
||||||
if (!this.viewport?.scrolling || this.lastOffsetTop == null) {
|
if (!this.viewport.scrolling || this.lastOffsetTop == null) {
|
||||||
this.lastOffsetTop = this.top + (this.viewport?.scrollY || 0) * this.scale;
|
this.lastOffsetTop = this.top + this.viewport.scrollY * this.scale;
|
||||||
}
|
}
|
||||||
return this.lastOffsetTop;
|
return this.lastOffsetTop;
|
||||||
}
|
}
|
||||||
|
|
||||||
@computed get offsetHeight() {
|
@computed get offsetHeight() {
|
||||||
if (!this.viewport?.scrolling || this.lastOffsetHeight == null) {
|
if (!this.viewport.scrolling || this.lastOffsetHeight == null) {
|
||||||
this.lastOffsetHeight = this.isRoot ? (this.viewport?.height || 0) : this.height;
|
this.lastOffsetHeight = this.isRoot ? this.viewport.height : this.height;
|
||||||
}
|
}
|
||||||
return this.lastOffsetHeight;
|
return this.lastOffsetHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
@computed get offsetWidth() {
|
@computed get offsetWidth() {
|
||||||
if (!(this.viewport?.scrolling || 0) || this.lastOffsetWidth == null) {
|
if (!this.viewport.scrolling || this.lastOffsetWidth == null) {
|
||||||
this.lastOffsetWidth = this.isRoot ? (this.viewport?.width || 0) : this.width;
|
this.lastOffsetWidth = this.isRoot ? this.viewport.width : this.width;
|
||||||
}
|
}
|
||||||
return this.lastOffsetWidth;
|
return this.lastOffsetWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
@computed get scale() {
|
@computed get scale() {
|
||||||
return this.viewport?.scale || 0;
|
return this.viewport.scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
private pid: number | undefined;
|
private pid: number | undefined;
|
||||||
@ -124,11 +124,11 @@ export class OffsetObserver {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const rect = host?.computeComponentInstanceRect(instance!, node.componentMeta.rootSelector);
|
const rect = host.computeComponentInstanceRect(instance!, node.componentMeta.rootSelector);
|
||||||
|
|
||||||
if (!rect) {
|
if (!rect) {
|
||||||
this.hasOffset = false;
|
this.hasOffset = false;
|
||||||
} else if (!this.viewport?.scrolling || !this.hasOffset) {
|
} else if (!this.viewport.scrolling || !this.hasOffset) {
|
||||||
this._height = rect.height;
|
this._height = rect.height;
|
||||||
this._width = rect.width;
|
this._width = rect.width;
|
||||||
this._left = rect.left;
|
this._left = rect.left;
|
||||||
|
|||||||
@ -56,30 +56,104 @@ export type GetDataType<T, NodeType> = T extends undefined
|
|||||||
: any
|
: any
|
||||||
: T;
|
: T;
|
||||||
|
|
||||||
export class DocumentModel implements Omit<IPublicModelDocumentModel<
|
export interface IDocumentModel extends Omit<IPublicModelDocumentModel<
|
||||||
ISelection,
|
ISelection,
|
||||||
IHistory,
|
IHistory,
|
||||||
INode,
|
INode,
|
||||||
IDropLocation,
|
IDropLocation,
|
||||||
IModalNodesManager,
|
IModalNodesManager,
|
||||||
IProject
|
IProject
|
||||||
>,
|
>,
|
||||||
'detecting' |
|
'detecting' |
|
||||||
'checkNesting' |
|
'checkNesting' |
|
||||||
'getNodeById' |
|
'getNodeById' |
|
||||||
// 以下属性在内部的 document 中不存在
|
// 以下属性在内部的 document 中不存在
|
||||||
'exportSchema' |
|
'exportSchema' |
|
||||||
'importSchema' |
|
'importSchema' |
|
||||||
'onAddNode' |
|
'onAddNode' |
|
||||||
'onRemoveNode' |
|
'onRemoveNode' |
|
||||||
'onChangeDetecting' |
|
'onChangeDetecting' |
|
||||||
'onChangeSelection' |
|
'onChangeSelection' |
|
||||||
'onChangeNodeProp' |
|
'onChangeNodeProp' |
|
||||||
'onImportSchema' |
|
'onImportSchema' |
|
||||||
'isDetectingNode' |
|
'isDetectingNode' |
|
||||||
'onFocusNodeChanged' |
|
'onFocusNodeChanged' |
|
||||||
'onDropLocationChanged'
|
'onDropLocationChanged'
|
||||||
> {
|
> {
|
||||||
|
|
||||||
|
readonly designer: IDesigner;
|
||||||
|
|
||||||
|
selection: ISelection;
|
||||||
|
|
||||||
|
get rootNode(): INode | null;
|
||||||
|
|
||||||
|
get simulator(): ISimulatorHost | null;
|
||||||
|
|
||||||
|
get active(): boolean;
|
||||||
|
|
||||||
|
get nodesMap(): Map<string, INode>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否为非激活状态
|
||||||
|
*/
|
||||||
|
get suspensed(): boolean;
|
||||||
|
|
||||||
|
get fileName(): string;
|
||||||
|
|
||||||
|
get currentRoot(): INode | null;
|
||||||
|
|
||||||
|
isBlank(): boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据 id 获取节点
|
||||||
|
*/
|
||||||
|
getNode(id: string): INode | null;
|
||||||
|
|
||||||
|
getRoot(): INode | null;
|
||||||
|
|
||||||
|
getHistory(): IHistory;
|
||||||
|
|
||||||
|
checkNesting(
|
||||||
|
dropTarget: INode,
|
||||||
|
dragObject: IPublicTypeDragNodeObject | IPublicTypeNodeSchema | INode | IPublicTypeDragNodeDataObject,
|
||||||
|
): boolean;
|
||||||
|
|
||||||
|
getNodeCount(): number;
|
||||||
|
|
||||||
|
nextId(possibleId: string | undefined): string;
|
||||||
|
|
||||||
|
import(schema: IPublicTypeRootSchema, checkId?: boolean): void;
|
||||||
|
|
||||||
|
export(stage: IPublicEnumTransformStage): IPublicTypeRootSchema | undefined;
|
||||||
|
|
||||||
|
onNodeCreate(func: (node: INode) => void): IPublicTypeDisposable;
|
||||||
|
|
||||||
|
onNodeDestroy(func: (node: INode) => void): IPublicTypeDisposable;
|
||||||
|
|
||||||
|
onChangeNodeVisible(fn: (node: INode, visible: boolean) => void): IPublicTypeDisposable;
|
||||||
|
|
||||||
|
addWillPurge(node: INode): void;
|
||||||
|
|
||||||
|
removeWillPurge(node: INode): void;
|
||||||
|
|
||||||
|
getComponentMeta(componentName: string): IComponentMeta;
|
||||||
|
|
||||||
|
insertNodes(parent: INode, thing: INode[] | IPublicTypeNodeData[], at?: number | null, copy?: boolean): INode[];
|
||||||
|
|
||||||
|
open(): IDocumentModel;
|
||||||
|
|
||||||
|
remove(): void;
|
||||||
|
|
||||||
|
suspense(): void;
|
||||||
|
|
||||||
|
close(): void;
|
||||||
|
|
||||||
|
unlinkNode(node: INode): void;
|
||||||
|
|
||||||
|
destroyNode(node: INode): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class DocumentModel implements IDocumentModel {
|
||||||
/**
|
/**
|
||||||
* 根节点 类型有:Page/Component/Block
|
* 根节点 类型有:Page/Component/Block
|
||||||
*/
|
*/
|
||||||
@ -248,7 +322,7 @@ IProject
|
|||||||
// 兼容 vision
|
// 兼容 vision
|
||||||
this.id = project.getSchema()?.id || this.id;
|
this.id = project.getSchema()?.id || this.id;
|
||||||
|
|
||||||
this.rootNode = this.createNode<IRootNode, IPublicTypeRootSchema>(
|
this.rootNode = this.createNode(
|
||||||
schema || {
|
schema || {
|
||||||
componentName: 'Page',
|
componentName: 'Page',
|
||||||
id: 'root',
|
id: 'root',
|
||||||
@ -351,7 +425,7 @@ IProject
|
|||||||
* 根据 schema 创建一个节点
|
* 根据 schema 创建一个节点
|
||||||
*/
|
*/
|
||||||
@action
|
@action
|
||||||
createNode<T = INode, S = IPublicTypeNodeSchema>(data: S): T {
|
createNode<T extends INode = INode, C = undefined>(data: GetDataType<C, T>): T {
|
||||||
let schema: any;
|
let schema: any;
|
||||||
if (isDOMText(data) || isJSExpression(data)) {
|
if (isDOMText(data) || isJSExpression(data)) {
|
||||||
schema = {
|
schema = {
|
||||||
@ -455,7 +529,7 @@ IProject
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const wrapper = this.createNode(schema);
|
const wrapper = this.createNode(schema);
|
||||||
if (wrapper?.isParental()) {
|
if (wrapper.isParental()) {
|
||||||
const first = nodes[0];
|
const first = nodes[0];
|
||||||
// TODO: check nesting rules x 2
|
// TODO: check nesting rules x 2
|
||||||
insertChild(first.parent!, wrapper, first.index);
|
insertChild(first.parent!, wrapper, first.index);
|
||||||
@ -464,7 +538,7 @@ IProject
|
|||||||
return wrapper;
|
return wrapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
wrapper && this.removeNode(wrapper);
|
this.removeNode(wrapper);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -854,5 +928,3 @@ export function isDocumentModel(obj: any): obj is IDocumentModel {
|
|||||||
export function isPageSchema(obj: any): obj is IPublicTypePageSchema {
|
export function isPageSchema(obj: any): obj is IPublicTypePageSchema {
|
||||||
return obj?.componentName === 'Page';
|
return obj?.componentName === 'Page';
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IDocumentModel extends DocumentModel {}
|
|
||||||
@ -10,12 +10,63 @@ export interface IOnChangeOptions {
|
|||||||
node: Node;
|
node: Node;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class NodeChildren implements Omit<IPublicModelNodeChildren<INode>,
|
export interface INodeChildren extends Omit<IPublicModelNodeChildren<INode>,
|
||||||
'importSchema' |
|
'importSchema' |
|
||||||
'exportSchema' |
|
'exportSchema' |
|
||||||
'isEmpty' |
|
'isEmpty' |
|
||||||
'notEmpty'
|
'notEmpty'
|
||||||
> {
|
> {
|
||||||
|
children: INode[];
|
||||||
|
|
||||||
|
get owner(): INode;
|
||||||
|
|
||||||
|
get length(): number;
|
||||||
|
|
||||||
|
unlinkChild(node: INode): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除一个节点
|
||||||
|
*/
|
||||||
|
internalDelete(
|
||||||
|
node: INode,
|
||||||
|
purge: boolean,
|
||||||
|
useMutator: boolean,
|
||||||
|
options: NodeRemoveOptions
|
||||||
|
): boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 插入一个节点,返回新长度
|
||||||
|
*/
|
||||||
|
internalInsert(node: INode, at?: number | null, useMutator?: boolean): void;
|
||||||
|
|
||||||
|
import(data?: IPublicTypeNodeData | IPublicTypeNodeData[], checkId?: boolean): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出 schema
|
||||||
|
*/
|
||||||
|
export(stage: IPublicEnumTransformStage): IPublicTypeNodeData[];
|
||||||
|
|
||||||
|
/** following methods are overriding super interface, using different param types */
|
||||||
|
/** overriding methods start */
|
||||||
|
|
||||||
|
forEach(fn: (item: INode, index: number) => void): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据索引获得节点
|
||||||
|
*/
|
||||||
|
get(index: number): INode | null;
|
||||||
|
|
||||||
|
isEmpty(): boolean;
|
||||||
|
|
||||||
|
notEmpty(): boolean;
|
||||||
|
|
||||||
|
internalInitParent(): void;
|
||||||
|
|
||||||
|
onChange(fn: (info?: IOnChangeOptions) => void): IPublicTypeDisposable;
|
||||||
|
|
||||||
|
/** overriding methods end */
|
||||||
|
}
|
||||||
|
export class NodeChildren implements INodeChildren {
|
||||||
@obx.shallow children: INode[];
|
@obx.shallow children: INode[];
|
||||||
|
|
||||||
private emitter: IEventBus = createModuleEventBus('NodeChildren');
|
private emitter: IEventBus = createModuleEventBus('NodeChildren');
|
||||||
@ -48,10 +99,11 @@ export class NodeChildren implements Omit<IPublicModelNodeChildren<INode>,
|
|||||||
constructor(
|
constructor(
|
||||||
readonly owner: INode,
|
readonly owner: INode,
|
||||||
data: IPublicTypeNodeData | IPublicTypeNodeData[],
|
data: IPublicTypeNodeData | IPublicTypeNodeData[],
|
||||||
|
options: any = {},
|
||||||
) {
|
) {
|
||||||
makeObservable(this);
|
makeObservable(this);
|
||||||
this.children = (Array.isArray(data) ? data : [data]).filter(child => !!child).map((child) => {
|
this.children = (Array.isArray(data) ? data : [data]).filter(child => !!child).map((child) => {
|
||||||
return this.owner.document?.createNode(child);
|
return this.owner.document?.createNode(child, options.checkId);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,12 +142,9 @@ export class NodeChildren implements Omit<IPublicModelNodeChildren<INode>,
|
|||||||
node = child;
|
node = child;
|
||||||
node.import(item);
|
node.import(item);
|
||||||
} else {
|
} else {
|
||||||
node = this.owner.document?.createNode(item);
|
node = this.owner.document?.createNode(item, checkId);
|
||||||
}
|
|
||||||
|
|
||||||
if (node) {
|
|
||||||
children[i] = node;
|
|
||||||
}
|
}
|
||||||
|
children[i] = node;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.children = children;
|
this.children = children;
|
||||||
@ -127,13 +176,13 @@ export class NodeChildren implements Omit<IPublicModelNodeChildren<INode>,
|
|||||||
/**
|
/**
|
||||||
* 回收销毁
|
* 回收销毁
|
||||||
*/
|
*/
|
||||||
purge() {
|
purge(useMutator = true) {
|
||||||
if (this.purged) {
|
if (this.purged) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.purged = true;
|
this.purged = true;
|
||||||
this.children.forEach((child) => {
|
this.children.forEach((child) => {
|
||||||
child.purge();
|
child.purge(useMutator);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +212,7 @@ export class NodeChildren implements Omit<IPublicModelNodeChildren<INode>,
|
|||||||
node.internalPurgeStart();
|
node.internalPurgeStart();
|
||||||
if (node.isParentalNode) {
|
if (node.isParentalNode) {
|
||||||
foreachReverse(
|
foreachReverse(
|
||||||
node.children!,
|
node.children,
|
||||||
(subNode: Node) => {
|
(subNode: Node) => {
|
||||||
subNode.remove(useMutator, purge, options);
|
subNode.remove(useMutator, purge, options);
|
||||||
},
|
},
|
||||||
@ -410,11 +459,11 @@ export class NodeChildren implements Omit<IPublicModelNodeChildren<INode>,
|
|||||||
const items = adder(this.children);
|
const items = adder(this.children);
|
||||||
if (items && items.length > 0) {
|
if (items && items.length > 0) {
|
||||||
items.forEach((child: IPublicTypeNodeData) => {
|
items.forEach((child: IPublicTypeNodeData) => {
|
||||||
const node: INode | null = this.owner.document?.createNode(child);
|
const node: INode = this.owner.document?.createNode(child);
|
||||||
node && this.children.push(node);
|
this.children.push(node);
|
||||||
node?.internalSetParent(this.owner);
|
node.internalSetParent(this.owner);
|
||||||
/* istanbul ignore next */
|
/* istanbul ignore next */
|
||||||
const editor = node?.document?.designer.editor;
|
const editor = node.document?.designer.editor;
|
||||||
editor?.eventBus.emit('node.add', { node });
|
editor?.eventBus.emit('node.add', { node });
|
||||||
});
|
});
|
||||||
changed = true;
|
changed = true;
|
||||||
@ -455,7 +504,7 @@ export class NodeChildren implements Omit<IPublicModelNodeChildren<INode>,
|
|||||||
try {
|
try {
|
||||||
callbacks?.onSubtreeModified.call(
|
callbacks?.onSubtreeModified.call(
|
||||||
node.internalToShellNode(),
|
node.internalToShellNode(),
|
||||||
owner.internalToShellNode()!,
|
owner.internalToShellNode(),
|
||||||
options,
|
options,
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -468,5 +517,3 @@ export class NodeChildren implements Omit<IPublicModelNodeChildren<INode>,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface INodeChildren extends NodeChildren {}
|
|
||||||
@ -13,6 +13,7 @@ import {
|
|||||||
GlobalEvent,
|
GlobalEvent,
|
||||||
IPublicTypeComponentAction,
|
IPublicTypeComponentAction,
|
||||||
IPublicModelNode,
|
IPublicModelNode,
|
||||||
|
IPublicModelExclusiveGroup,
|
||||||
IPublicEnumTransformStage,
|
IPublicEnumTransformStage,
|
||||||
IPublicTypeDisposable,
|
IPublicTypeDisposable,
|
||||||
IBaseModelNode,
|
IBaseModelNode,
|
||||||
@ -36,7 +37,132 @@ export interface NodeStatus {
|
|||||||
inPlaceEditing: boolean;
|
inPlaceEditing: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IBaseNode extends Node {}
|
export interface IBaseNode<Schema extends IPublicTypeNodeSchema = IPublicTypeNodeSchema> extends Omit<IBaseModelNode<
|
||||||
|
IDocumentModel,
|
||||||
|
IBaseNode,
|
||||||
|
INodeChildren,
|
||||||
|
IComponentMeta,
|
||||||
|
ISettingTopEntry,
|
||||||
|
IProps,
|
||||||
|
IProp,
|
||||||
|
IExclusiveGroup
|
||||||
|
>,
|
||||||
|
'isRoot' |
|
||||||
|
'isPage' |
|
||||||
|
'isComponent' |
|
||||||
|
'isModal' |
|
||||||
|
'isSlot' |
|
||||||
|
'isParental' |
|
||||||
|
'isLeaf' |
|
||||||
|
'settingEntry' |
|
||||||
|
// 在内部的 node 模型中不存在
|
||||||
|
'getExtraPropValue' |
|
||||||
|
'setExtraPropValue' |
|
||||||
|
'exportSchema' |
|
||||||
|
'visible' |
|
||||||
|
'importSchema' |
|
||||||
|
// 内外实现有差异
|
||||||
|
'isContainer' |
|
||||||
|
'isEmpty'
|
||||||
|
> {
|
||||||
|
isNode: boolean;
|
||||||
|
|
||||||
|
get componentMeta(): IComponentMeta;
|
||||||
|
|
||||||
|
get settingEntry(): ISettingTopEntry;
|
||||||
|
|
||||||
|
get isPurged(): boolean;
|
||||||
|
|
||||||
|
get index(): number | undefined;
|
||||||
|
|
||||||
|
get isPurging(): boolean;
|
||||||
|
|
||||||
|
getId(): string;
|
||||||
|
|
||||||
|
getParent(): INode | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内部方法,请勿使用
|
||||||
|
* @param useMutator 是否触发联动逻辑
|
||||||
|
*/
|
||||||
|
internalSetParent(parent: INode | null, useMutator?: boolean): void;
|
||||||
|
|
||||||
|
setConditionGroup(grp: IPublicModelExclusiveGroup | string | null): void;
|
||||||
|
|
||||||
|
internalToShellNode(): IPublicModelNode | null;
|
||||||
|
|
||||||
|
internalPurgeStart(): void;
|
||||||
|
|
||||||
|
unlinkSlot(slotNode: INode): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出 schema
|
||||||
|
*/
|
||||||
|
export<T = Schema>(stage: IPublicEnumTransformStage, options?: any): T;
|
||||||
|
|
||||||
|
emitPropChange(val: IPublicTypePropChangeOptions): void;
|
||||||
|
|
||||||
|
import(data: Schema, checkId?: boolean): void;
|
||||||
|
|
||||||
|
internalSetSlotFor(slotFor: Prop | null | undefined): void;
|
||||||
|
|
||||||
|
addSlot(slotNode: INode): void;
|
||||||
|
|
||||||
|
onVisibleChange(func: (flag: boolean) => any): () => void;
|
||||||
|
|
||||||
|
getSuitablePlace(node: INode, ref: any): any;
|
||||||
|
|
||||||
|
onChildrenChange(fn: (param?: { type: string; node: INode }) => void): IPublicTypeDisposable | undefined;
|
||||||
|
|
||||||
|
onPropChange(func: (info: IPublicTypePropChangeOptions) => void): IPublicTypeDisposable;
|
||||||
|
|
||||||
|
isModal(): boolean;
|
||||||
|
|
||||||
|
isRoot(): boolean;
|
||||||
|
|
||||||
|
isPage(): boolean;
|
||||||
|
|
||||||
|
isComponent(): boolean;
|
||||||
|
|
||||||
|
isSlot(): boolean;
|
||||||
|
|
||||||
|
isParental(): boolean;
|
||||||
|
|
||||||
|
isLeaf(): boolean;
|
||||||
|
|
||||||
|
isContainer(): boolean;
|
||||||
|
|
||||||
|
isEmpty(): boolean;
|
||||||
|
|
||||||
|
remove(
|
||||||
|
useMutator?: boolean,
|
||||||
|
purge?: boolean,
|
||||||
|
options?: NodeRemoveOptions,
|
||||||
|
): void;
|
||||||
|
|
||||||
|
didDropIn(dragment: INode): void;
|
||||||
|
|
||||||
|
didDropOut(dragment: INode): void;
|
||||||
|
|
||||||
|
purge(): void;
|
||||||
|
|
||||||
|
removeSlot(slotNode: INode): boolean;
|
||||||
|
|
||||||
|
setVisible(flag: boolean): void;
|
||||||
|
|
||||||
|
getVisible(): boolean;
|
||||||
|
|
||||||
|
getChildren(): INodeChildren | null;
|
||||||
|
|
||||||
|
clearPropValue(path: string | number): void;
|
||||||
|
|
||||||
|
setProps(props?: IPublicTypePropsMap | IPublicTypePropsList | Props | null): void;
|
||||||
|
|
||||||
|
mergeProps(props: IPublicTypePropsMap): void;
|
||||||
|
|
||||||
|
/** 是否可以选中 */
|
||||||
|
canSelect(): boolean;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 基础节点
|
* 基础节点
|
||||||
@ -86,34 +212,7 @@ export interface IBaseNode extends Node {}
|
|||||||
* isLocked
|
* isLocked
|
||||||
* hidden
|
* hidden
|
||||||
*/
|
*/
|
||||||
export class Node<Schema extends IPublicTypeNodeSchema = IPublicTypeNodeSchema> implements Omit<IBaseModelNode<
|
export class Node<Schema extends IPublicTypeNodeSchema = IPublicTypeNodeSchema> implements IBaseNode {
|
||||||
IDocumentModel,
|
|
||||||
IBaseNode,
|
|
||||||
INodeChildren,
|
|
||||||
IComponentMeta,
|
|
||||||
ISettingTopEntry,
|
|
||||||
IProps,
|
|
||||||
IProp,
|
|
||||||
IExclusiveGroup
|
|
||||||
>,
|
|
||||||
'isRoot' |
|
|
||||||
'isPage' |
|
|
||||||
'isComponent' |
|
|
||||||
'isModal' |
|
|
||||||
'isSlot' |
|
|
||||||
'isParental' |
|
|
||||||
'isLeaf' |
|
|
||||||
'settingEntry' |
|
|
||||||
// 在内部的 node 模型中不存在
|
|
||||||
'getExtraPropValue' |
|
|
||||||
'setExtraPropValue' |
|
|
||||||
'exportSchema' |
|
|
||||||
'visible' |
|
|
||||||
'importSchema' |
|
|
||||||
// 内外实现有差异
|
|
||||||
'isContainer' |
|
|
||||||
'isEmpty'
|
|
||||||
> {
|
|
||||||
private emitter: IEventBus;
|
private emitter: IEventBus;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -591,7 +690,7 @@ export class Node<Schema extends IPublicTypeNodeSchema = IPublicTypeNodeSchema>
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* istanbul ignore next */
|
/* istanbul ignore next */
|
||||||
setConditionGroup(grp: IExclusiveGroup | string | null) {
|
setConditionGroup(grp: IPublicModelExclusiveGroup | string | null) {
|
||||||
let _grp: IExclusiveGroup | null = null;
|
let _grp: IExclusiveGroup | null = null;
|
||||||
if (!grp) {
|
if (!grp) {
|
||||||
this.getExtraProp('conditionGroup', false)?.remove();
|
this.getExtraProp('conditionGroup', false)?.remove();
|
||||||
@ -1290,11 +1389,11 @@ export interface LeafNode extends Node {
|
|||||||
|
|
||||||
export type IPublicTypePropChangeOptions = Omit<GlobalEvent.Node.Prop.ChangeOptions, 'node'>;
|
export type IPublicTypePropChangeOptions = Omit<GlobalEvent.Node.Prop.ChangeOptions, 'node'>;
|
||||||
|
|
||||||
export interface ISlotNode extends Node<IPublicTypeSlotSchema> {}
|
export type ISlotNode = IBaseNode<IPublicTypeSlotSchema>;
|
||||||
export interface IPageNode extends Node<IPublicTypePageSchema> {}
|
export type IPageNode = IBaseNode<IPublicTypePageSchema>;
|
||||||
export interface IComponentNode extends Node<IPublicTypeComponentSchema> {}
|
export type IComponentNode = IBaseNode<IPublicTypeComponentSchema>;
|
||||||
export interface IRootNode extends Node<IPublicTypePageSchema | IPublicTypeComponentSchema> {}
|
export type IRootNode = IPageNode | IComponentNode;
|
||||||
export interface INode extends Node<IPublicTypePageSchema | IPublicTypeSlotSchema | IPublicTypeComponentSchema | IPublicTypeNodeSchema> {}
|
export type INode = IPageNode | ISlotNode | IComponentNode | IRootNode;
|
||||||
|
|
||||||
export function isRootNode(node: INode): node is IRootNode {
|
export function isRootNode(node: INode): node is IRootNode {
|
||||||
return node && node.isRootNode;
|
return node && node.isRootNode;
|
||||||
@ -1406,7 +1505,7 @@ export function insertChild(
|
|||||||
|
|
||||||
export function insertChildren(
|
export function insertChildren(
|
||||||
container: INode,
|
container: INode,
|
||||||
nodes: INode[] | IPublicTypeNodeData[] | IPublicModelNode[],
|
nodes: INode[] | IPublicTypeNodeData[],
|
||||||
at?: number | null,
|
at?: number | null,
|
||||||
copy?: boolean,
|
copy?: boolean,
|
||||||
): INode[] {
|
): INode[] {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { untracked, computed, obx, engineConfig, action, makeObservable, mobx, runInAction } from '@alilc/lowcode-editor-core';
|
import { untracked, computed, obx, engineConfig, action, makeObservable, mobx, runInAction } from '@alilc/lowcode-editor-core';
|
||||||
import { GlobalEvent, IPublicEnumTransformStage } from '@alilc/lowcode-types';
|
import { GlobalEvent, IPublicEnumTransformStage } from '@alilc/lowcode-types';
|
||||||
import type { IPublicTypeCompositeValue, IPublicTypeJSSlot, IPublicTypeSlotSchema, IPublicModelProp, IPublicTypeNodeData } from '@alilc/lowcode-types';
|
import type { IPublicTypeCompositeValue, IPublicTypeJSSlot, IPublicTypeSlotSchema, IPublicModelProp } from '@alilc/lowcode-types';
|
||||||
import { uniqueId, isPlainObject, hasOwnProperty, compatStage, isJSExpression, isJSSlot, isNodeSchema } from '@alilc/lowcode-utils';
|
import { uniqueId, isPlainObject, hasOwnProperty, compatStage, isJSExpression, isJSSlot, isNodeSchema } from '@alilc/lowcode-utils';
|
||||||
import { valueToSource } from './value-to-source';
|
import { valueToSource } from './value-to-source';
|
||||||
import { IPropParent } from './props';
|
import { IPropParent } from './props';
|
||||||
@ -227,7 +227,7 @@ export class Prop implements IProp, IPropParent {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public parent: IPropParent,
|
public parent: IPropParent,
|
||||||
value: IPublicTypeCompositeValue | IPublicTypeNodeData | IPublicTypeNodeData[] | UNSET = UNSET,
|
value: IPublicTypeCompositeValue | UNSET = UNSET,
|
||||||
key?: string | number,
|
key?: string | number,
|
||||||
spread = false,
|
spread = false,
|
||||||
options = {},
|
options = {},
|
||||||
@ -351,7 +351,7 @@ export class Prop implements IProp, IPropParent {
|
|||||||
* set value, val should be JSON Object
|
* set value, val should be JSON Object
|
||||||
*/
|
*/
|
||||||
@action
|
@action
|
||||||
setValue(val: IPublicTypeCompositeValue | IPublicTypeNodeData | IPublicTypeNodeData[]) {
|
setValue(val: IPublicTypeCompositeValue) {
|
||||||
if (val === this._value) return;
|
if (val === this._value) return;
|
||||||
const oldValue = this._value;
|
const oldValue = this._value;
|
||||||
this._value = val;
|
this._value = val;
|
||||||
|
|||||||
@ -37,9 +37,30 @@ export interface IPropParent {
|
|||||||
delete(prop: IProp): void;
|
delete(prop: IProp): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IProps extends Props {}
|
export interface IProps extends Omit<IBaseModelProps<IProp>, | 'getExtraProp' | 'getExtraPropValue' | 'setExtraPropValue' | 'node'>, IPropParent {
|
||||||
|
|
||||||
export class Props implements Omit<IBaseModelProps<IProp>, | 'getExtraProp' | 'getExtraPropValue' | 'setExtraPropValue' | 'node'>, IPropParent {
|
/**
|
||||||
|
* 获取 props 对应的 node
|
||||||
|
*/
|
||||||
|
getNode(): INode;
|
||||||
|
|
||||||
|
get(path: string, createIfNone?: boolean): IProp | null;
|
||||||
|
|
||||||
|
export(stage?: IPublicEnumTransformStage): {
|
||||||
|
props?: IPublicTypePropsMap | IPublicTypePropsList;
|
||||||
|
extras?: ExtrasObject;
|
||||||
|
};
|
||||||
|
|
||||||
|
merge(value: IPublicTypePropsMap, extras?: IPublicTypePropsMap): void;
|
||||||
|
|
||||||
|
purge(): void;
|
||||||
|
|
||||||
|
query(path: string, createIfNone: boolean): IProp | null;
|
||||||
|
|
||||||
|
import(value?: IPublicTypePropsMap | IPublicTypePropsList | null, extras?: ExtrasObject): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class Props implements IProps, IPropParent {
|
||||||
readonly id = uniqueId('props');
|
readonly id = uniqueId('props');
|
||||||
|
|
||||||
@obx.shallow private items: IProp[] = [];
|
@obx.shallow private items: IProp[] = [];
|
||||||
|
|||||||
@ -20,7 +20,6 @@ import {
|
|||||||
IPublicEnumPluginRegisterLevel,
|
IPublicEnumPluginRegisterLevel,
|
||||||
IPublicModelWindow,
|
IPublicModelWindow,
|
||||||
IPublicApiCommonUI,
|
IPublicApiCommonUI,
|
||||||
IPublicApiCommand,
|
|
||||||
} from '@alilc/lowcode-types';
|
} from '@alilc/lowcode-types';
|
||||||
import {
|
import {
|
||||||
IPluginContextOptions,
|
IPluginContextOptions,
|
||||||
@ -49,7 +48,6 @@ export default class PluginContext implements
|
|||||||
editorWindow: IPublicModelWindow;
|
editorWindow: IPublicModelWindow;
|
||||||
commonUI: IPublicApiCommonUI;
|
commonUI: IPublicApiCommonUI;
|
||||||
isPluginRegisteredInWorkspace: false;
|
isPluginRegisteredInWorkspace: false;
|
||||||
command: IPublicApiCommand;
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
options: IPluginContextOptions,
|
options: IPluginContextOptions,
|
||||||
|
|||||||
@ -68,7 +68,7 @@ export interface IProject extends Omit<IBaseApiProject<
|
|||||||
|
|
||||||
onCurrentDocumentChange(fn: (doc: IDocumentModel) => void): () => void;
|
onCurrentDocumentChange(fn: (doc: IDocumentModel) => void): () => void;
|
||||||
|
|
||||||
onSimulatorReady(fn: (simulator: ISimulatorHost) => void): () => void;
|
onSimulatorReady(fn: (args: any) => void): () => void;
|
||||||
|
|
||||||
onRendererReady(fn: () => void): () => void;
|
onRendererReady(fn: () => void): () => void;
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-editor-core",
|
"name": "@alilc/lowcode-editor-core",
|
||||||
"version": "1.3.3-beta.1",
|
"version": "1.3.2",
|
||||||
"description": "Core Api for Ali lowCode engine",
|
"description": "Core Api for Ali lowCode engine",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
@ -16,8 +16,8 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alifd/next": "^1.19.16",
|
"@alifd/next": "^1.19.16",
|
||||||
"@alilc/lowcode-types": "1.3.3-beta.1",
|
"@alilc/lowcode-types": "1.3.2",
|
||||||
"@alilc/lowcode-utils": "1.3.3-beta.1",
|
"@alilc/lowcode-utils": "1.3.2",
|
||||||
"classnames": "^2.2.6",
|
"classnames": "^2.2.6",
|
||||||
"debug": "^4.1.1",
|
"debug": "^4.1.1",
|
||||||
"intl-messageformat": "^9.3.1",
|
"intl-messageformat": "^9.3.1",
|
||||||
|
|||||||
@ -1,12 +1,18 @@
|
|||||||
import { IPublicApiCommand, IPublicEnumTransitionType, IPublicModelPluginContext, IPublicTypeCommand, IPublicTypeCommandHandlerArgs, IPublicTypeListCommand } from '@alilc/lowcode-types';
|
import { IPublicApiCommand, IPublicEnumTransitionType, IPublicModelPluginContext, IPublicTypeCommand, IPublicTypeCommandHandlerArgs, IPublicTypeListCommand } from '@alilc/lowcode-types';
|
||||||
import { checkPropTypes } from '@alilc/lowcode-utils';
|
import { checkPropTypes } from '@alilc/lowcode-utils';
|
||||||
export interface ICommand extends Command {}
|
export interface ICommand extends Omit<IPublicApiCommand, 'registerCommand' | 'batchExecuteCommand'> {
|
||||||
|
registerCommand(command: IPublicTypeCommand, options?: {
|
||||||
|
commandScope?: string;
|
||||||
|
}): void;
|
||||||
|
|
||||||
|
batchExecuteCommand(commands: { name: string; args: IPublicTypeCommandHandlerArgs }[], pluginContext?: IPublicModelPluginContext): void;
|
||||||
|
}
|
||||||
|
|
||||||
export interface ICommandOptions {
|
export interface ICommandOptions {
|
||||||
commandScope?: string;
|
commandScope?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Command implements Omit<IPublicApiCommand, 'registerCommand' | 'batchExecuteCommand'> {
|
export class Command implements ICommand {
|
||||||
private commands: Map<string, IPublicTypeCommand> = new Map();
|
private commands: Map<string, IPublicTypeCommand> = new Map();
|
||||||
private commandErrors: Function[] = [];
|
private commandErrors: Function[] = [];
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { isEqual } from 'lodash';
|
import { isEqual } from 'lodash';
|
||||||
import { globalContext } from './di';
|
import { globalContext } from './di';
|
||||||
import { IPublicTypeHotkeyCallback, IPublicTypeHotkeyCallbackConfig, IPublicTypeHotkeyCallbacks, IPublicApiHotkey, IPublicTypeDisposable } from '@alilc/lowcode-types';
|
import { IPublicTypeHotkeyCallback, IPublicTypeHotkeyCallbackConfig, IPublicTypeHotkeyCallbacks, IPublicApiHotkey } from '@alilc/lowcode-types';
|
||||||
|
|
||||||
interface KeyMap {
|
interface KeyMap {
|
||||||
[key: number]: string;
|
[key: number]: string;
|
||||||
@ -339,10 +339,11 @@ function fireCallback(callback: IPublicTypeHotkeyCallback, e: KeyboardEvent, com
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IHotKey extends Hotkey {
|
export interface IHotKey extends Omit<IPublicApiHotkey, 'bind' | 'callbacks'> {
|
||||||
|
activate(activate: boolean): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Hotkey implements Omit<IPublicApiHotkey, 'bind' | 'callbacks'> {
|
export class Hotkey implements IHotKey {
|
||||||
callBacks: IPublicTypeHotkeyCallbacks = {};
|
callBacks: IPublicTypeHotkeyCallbacks = {};
|
||||||
|
|
||||||
private directMap: HotkeyDirectMap = {};
|
private directMap: HotkeyDirectMap = {};
|
||||||
@ -367,7 +368,7 @@ export class Hotkey implements Omit<IPublicApiHotkey, 'bind' | 'callbacks'> {
|
|||||||
this.isActivate = activate;
|
this.isActivate = activate;
|
||||||
}
|
}
|
||||||
|
|
||||||
mount(window: Window): IPublicTypeDisposable {
|
mount(window: Window) {
|
||||||
const { document } = window;
|
const { document } = window;
|
||||||
const handleKeyEvent = this.handleKeyEvent.bind(this);
|
const handleKeyEvent = this.handleKeyEvent.bind(this);
|
||||||
document.addEventListener('keypress', handleKeyEvent, false);
|
document.addEventListener('keypress', handleKeyEvent, false);
|
||||||
@ -541,8 +542,6 @@ export class Hotkey implements Omit<IPublicApiHotkey, 'bind' | 'callbacks'> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private handleKeyEvent(e: KeyboardEvent): void {
|
private handleKeyEvent(e: KeyboardEvent): void {
|
||||||
console.log(e);
|
|
||||||
// debugger;
|
|
||||||
if (!this.isActivate) {
|
if (!this.isActivate) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-editor-skeleton",
|
"name": "@alilc/lowcode-editor-skeleton",
|
||||||
"version": "1.3.3-beta.1",
|
"version": "1.3.2",
|
||||||
"description": "alibaba lowcode editor skeleton",
|
"description": "alibaba lowcode editor skeleton",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"module": "es/index.js",
|
"module": "es/index.js",
|
||||||
@ -19,10 +19,10 @@
|
|||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alifd/next": "^1.20.12",
|
"@alifd/next": "^1.20.12",
|
||||||
"@alilc/lowcode-designer": "1.3.3-beta.1",
|
"@alilc/lowcode-designer": "1.3.2",
|
||||||
"@alilc/lowcode-editor-core": "1.3.3-beta.1",
|
"@alilc/lowcode-editor-core": "1.3.2",
|
||||||
"@alilc/lowcode-types": "1.3.3-beta.1",
|
"@alilc/lowcode-types": "1.3.2",
|
||||||
"@alilc/lowcode-utils": "1.3.3-beta.1",
|
"@alilc/lowcode-utils": "1.3.2",
|
||||||
"classnames": "^2.2.6",
|
"classnames": "^2.2.6",
|
||||||
"react": "^16.8.1",
|
"react": "^16.8.1",
|
||||||
"react-dom": "^16.8.1"
|
"react-dom": "^16.8.1"
|
||||||
|
|||||||
@ -44,27 +44,72 @@ export enum SkeletonEvents {
|
|||||||
WIDGET_ENABLE = 'skeleton.widget.enable',
|
WIDGET_ENABLE = 'skeleton.widget.enable',
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ISkeleton extends Skeleton {}
|
export interface ISkeleton extends Omit<IPublicApiSkeleton,
|
||||||
|
'showPanel' |
|
||||||
export class Skeleton implements Omit<IPublicApiSkeleton,
|
'hidePanel' |
|
||||||
'showPanel' |
|
'showWidget' |
|
||||||
'hidePanel' |
|
'enableWidget' |
|
||||||
'showWidget' |
|
'hideWidget' |
|
||||||
'enableWidget' |
|
'disableWidget' |
|
||||||
'hideWidget' |
|
'showArea' |
|
||||||
'disableWidget' |
|
'onShowPanel' |
|
||||||
'showArea' |
|
'onHidePanel' |
|
||||||
'onShowPanel' |
|
'onShowWidget' |
|
||||||
'onHidePanel' |
|
'onHideWidget' |
|
||||||
'onShowWidget' |
|
'remove' |
|
||||||
'onHideWidget' |
|
'hideArea' |
|
||||||
'remove' |
|
'add'
|
||||||
'hideArea' |
|
|
||||||
'add' |
|
|
||||||
'getAreaItems' |
|
|
||||||
'onDisableWidget' |
|
|
||||||
'onEnableWidget'
|
|
||||||
> {
|
> {
|
||||||
|
editor: IEditor;
|
||||||
|
|
||||||
|
readonly leftArea: Area<DockConfig | PanelDockConfig | DialogDockConfig>;
|
||||||
|
|
||||||
|
readonly topArea: Area<DockConfig | DividerConfig | PanelDockConfig | DialogDockConfig>;
|
||||||
|
|
||||||
|
readonly subTopArea: Area<DockConfig | DividerConfig | PanelDockConfig | DialogDockConfig>;
|
||||||
|
|
||||||
|
readonly toolbar: Area<DockConfig | DividerConfig | PanelDockConfig | DialogDockConfig>;
|
||||||
|
|
||||||
|
readonly leftFixedArea: Area<IPublicTypePanelConfig, Panel>;
|
||||||
|
|
||||||
|
readonly leftFloatArea: Area<IPublicTypePanelConfig, Panel>;
|
||||||
|
|
||||||
|
readonly rightArea: Area<IPublicTypePanelConfig, Panel>;
|
||||||
|
|
||||||
|
readonly mainArea: Area<WidgetConfig | IPublicTypePanelConfig, Widget | Panel>;
|
||||||
|
|
||||||
|
readonly bottomArea: Area<IPublicTypePanelConfig, Panel>;
|
||||||
|
|
||||||
|
readonly stages: Area<StageConfig, Stage>;
|
||||||
|
|
||||||
|
readonly widgets: IWidget[];
|
||||||
|
|
||||||
|
readonly focusTracker: FocusTracker;
|
||||||
|
|
||||||
|
getPanel(name: string): Panel | undefined;
|
||||||
|
|
||||||
|
getWidget(name: string): IWidget | undefined;
|
||||||
|
|
||||||
|
buildFromConfig(config?: EditorConfig, components?: PluginClassSet): void;
|
||||||
|
|
||||||
|
createStage(config: any): string | undefined;
|
||||||
|
|
||||||
|
getStage(name: string): Stage | null;
|
||||||
|
|
||||||
|
createContainer(
|
||||||
|
name: string,
|
||||||
|
handle: (item: any) => any,
|
||||||
|
exclusive?: boolean,
|
||||||
|
checkVisible?: () => boolean,
|
||||||
|
defaultSetCurrent?: boolean,
|
||||||
|
): WidgetContainer;
|
||||||
|
|
||||||
|
createPanel(config: IPublicTypePanelConfig): Panel;
|
||||||
|
|
||||||
|
add(config: IPublicTypeSkeletonConfig, extraConfig?: Record<string, any>): IWidget | Widget | Panel | Stage | Dock | PanelDock | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class Skeleton implements ISkeleton {
|
||||||
private panels = new Map<string, Panel>();
|
private panels = new Map<string, Panel>();
|
||||||
|
|
||||||
private configTransducers: IPublicTypeConfigTransducer[] = [];
|
private configTransducers: IPublicTypeConfigTransducer[] = [];
|
||||||
@ -386,7 +431,7 @@ export class Skeleton implements Omit<IPublicApiSkeleton,
|
|||||||
}
|
}
|
||||||
const { content, ...restConfig } = config;
|
const { content, ...restConfig } = config;
|
||||||
if (content) {
|
if (content) {
|
||||||
if (isPlainObject<IPublicTypePanelConfig>(content) && !isValidElement(content)) {
|
if (isPlainObject(content) && !isValidElement(content)) {
|
||||||
Object.keys(content).forEach((key) => {
|
Object.keys(content).forEach((key) => {
|
||||||
if (/props$/i.test(key) && restConfig[key]) {
|
if (/props$/i.test(key) && restConfig[key]) {
|
||||||
restConfig[key] = {
|
restConfig[key] = {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-engine",
|
"name": "@alilc/lowcode-engine",
|
||||||
"version": "1.3.3-beta.1",
|
"version": "1.3.2",
|
||||||
"description": "An enterprise-class low-code technology stack with scale-out design / 一套面向扩展设计的企业级低代码技术体系",
|
"description": "An enterprise-class low-code technology stack with scale-out design / 一套面向扩展设计的企业级低代码技术体系",
|
||||||
"main": "lib/engine-core.js",
|
"main": "lib/engine-core.js",
|
||||||
"module": "es/engine-core.js",
|
"module": "es/engine-core.js",
|
||||||
@ -19,16 +19,16 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alifd/next": "^1.19.12",
|
"@alifd/next": "^1.19.12",
|
||||||
"@alilc/lowcode-designer": "1.3.3-beta.1",
|
"@alilc/lowcode-designer": "1.3.2",
|
||||||
"@alilc/lowcode-editor-core": "1.3.3-beta.1",
|
"@alilc/lowcode-editor-core": "1.3.2",
|
||||||
"@alilc/lowcode-editor-skeleton": "1.3.3-beta.1",
|
"@alilc/lowcode-editor-skeleton": "1.3.2",
|
||||||
"@alilc/lowcode-engine-ext": "^1.0.0",
|
"@alilc/lowcode-engine-ext": "^1.0.0",
|
||||||
"@alilc/lowcode-plugin-command": "1.3.3-beta.1",
|
"@alilc/lowcode-plugin-command": "1.3.2",
|
||||||
"@alilc/lowcode-plugin-designer": "1.3.3-beta.1",
|
"@alilc/lowcode-plugin-designer": "1.3.2",
|
||||||
"@alilc/lowcode-plugin-outline-pane": "1.3.3-beta.1",
|
"@alilc/lowcode-plugin-outline-pane": "1.3.2",
|
||||||
"@alilc/lowcode-shell": "1.3.3-beta.1",
|
"@alilc/lowcode-shell": "1.3.2",
|
||||||
"@alilc/lowcode-utils": "1.3.3-beta.1",
|
"@alilc/lowcode-utils": "1.3.2",
|
||||||
"@alilc/lowcode-workspace": "1.3.3-beta.1",
|
"@alilc/lowcode-workspace": "1.3.2",
|
||||||
"react": "^16.8.1",
|
"react": "^16.8.1",
|
||||||
"react-dom": "^16.8.1"
|
"react-dom": "^16.8.1"
|
||||||
},
|
},
|
||||||
|
|||||||
@ -229,7 +229,7 @@ export async function init(
|
|||||||
document.body.appendChild(engineContainer);
|
document.body.appendChild(engineContainer);
|
||||||
} else {
|
} else {
|
||||||
engineOptions = options;
|
engineOptions = options;
|
||||||
engineContainer = container!;
|
engineContainer = container;
|
||||||
if (!container) {
|
if (!container) {
|
||||||
engineContainer = document.createElement('div');
|
engineContainer = document.createElement('div');
|
||||||
engineContainer.id = 'engine';
|
engineContainer.id = 'engine';
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-ignitor",
|
"name": "@alilc/lowcode-ignitor",
|
||||||
"version": "1.3.3-beta.1",
|
"version": "1.3.2",
|
||||||
"description": "点火器,bootstrap lce project",
|
"description": "点火器,bootstrap lce project",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-plugin-command",
|
"name": "@alilc/lowcode-plugin-command",
|
||||||
"version": "1.3.3-beta.1",
|
"version": "1.3.2",
|
||||||
"description": "> TODO: description",
|
"description": "> TODO: description",
|
||||||
"author": "liujuping <liujup@foxmail.com>",
|
"author": "liujuping <liujup@foxmail.com>",
|
||||||
"homepage": "https://github.com/alibaba/lowcode-engine#readme",
|
"homepage": "https://github.com/alibaba/lowcode-engine#readme",
|
||||||
@ -30,8 +30,8 @@
|
|||||||
"url": "https://github.com/alibaba/lowcode-engine/issues"
|
"url": "https://github.com/alibaba/lowcode-engine/issues"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alilc/lowcode-types": "1.3.3-beta.1",
|
"@alilc/lowcode-types": "1.3.2",
|
||||||
"@alilc/lowcode-utils": "1.3.3-beta.1"
|
"@alilc/lowcode-utils": "1.3.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@alib/build-scripts": "^0.1.18"
|
"@alib/build-scripts": "^0.1.18"
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-plugin-designer",
|
"name": "@alilc/lowcode-plugin-designer",
|
||||||
"version": "1.3.3-beta.1",
|
"version": "1.3.2",
|
||||||
"description": "alibaba lowcode editor designer plugin",
|
"description": "alibaba lowcode editor designer plugin",
|
||||||
"files": [
|
"files": [
|
||||||
"es",
|
"es",
|
||||||
@ -18,9 +18,9 @@
|
|||||||
],
|
],
|
||||||
"author": "xiayang.xy",
|
"author": "xiayang.xy",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alilc/lowcode-designer": "1.3.3-beta.1",
|
"@alilc/lowcode-designer": "1.3.2",
|
||||||
"@alilc/lowcode-editor-core": "1.3.3-beta.1",
|
"@alilc/lowcode-editor-core": "1.3.2",
|
||||||
"@alilc/lowcode-utils": "1.3.3-beta.1",
|
"@alilc/lowcode-utils": "1.3.2",
|
||||||
"react": "^16.8.1",
|
"react": "^16.8.1",
|
||||||
"react-dom": "^16.8.1"
|
"react-dom": "^16.8.1"
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-plugin-outline-pane",
|
"name": "@alilc/lowcode-plugin-outline-pane",
|
||||||
"version": "1.3.3-beta.1",
|
"version": "1.3.2",
|
||||||
"description": "Outline pane for Ali lowCode engine",
|
"description": "Outline pane for Ali lowCode engine",
|
||||||
"files": [
|
"files": [
|
||||||
"es",
|
"es",
|
||||||
@ -13,8 +13,8 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alifd/next": "^1.19.16",
|
"@alifd/next": "^1.19.16",
|
||||||
"@alilc/lowcode-types": "1.3.3-beta.1",
|
"@alilc/lowcode-types": "1.3.2",
|
||||||
"@alilc/lowcode-utils": "1.3.3-beta.1",
|
"@alilc/lowcode-utils": "1.3.2",
|
||||||
"classnames": "^2.2.6",
|
"classnames": "^2.2.6",
|
||||||
"react": "^16",
|
"react": "^16",
|
||||||
"react-dom": "^16.7.0",
|
"react-dom": "^16.7.0",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-react-renderer",
|
"name": "@alilc/lowcode-react-renderer",
|
||||||
"version": "1.3.3-beta.1",
|
"version": "1.3.2",
|
||||||
"description": "react renderer for ali lowcode engine",
|
"description": "react renderer for ali lowcode engine",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"module": "es/index.js",
|
"module": "es/index.js",
|
||||||
@ -22,7 +22,7 @@
|
|||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alifd/next": "^1.21.16",
|
"@alifd/next": "^1.21.16",
|
||||||
"@alilc/lowcode-renderer-core": "1.3.3-beta.1"
|
"@alilc/lowcode-renderer-core": "1.3.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@alib/build-scripts": "^0.1.18",
|
"@alib/build-scripts": "^0.1.18",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-react-simulator-renderer",
|
"name": "@alilc/lowcode-react-simulator-renderer",
|
||||||
"version": "1.3.3-beta.1",
|
"version": "1.3.2",
|
||||||
"description": "react simulator renderer for alibaba lowcode designer",
|
"description": "react simulator renderer for alibaba lowcode designer",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"module": "es/index.js",
|
"module": "es/index.js",
|
||||||
@ -17,10 +17,10 @@
|
|||||||
"test:cov": "build-scripts test --config build.test.json --jest-coverage"
|
"test:cov": "build-scripts test --config build.test.json --jest-coverage"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alilc/lowcode-designer": "1.3.3-beta.1",
|
"@alilc/lowcode-designer": "1.3.2",
|
||||||
"@alilc/lowcode-react-renderer": "1.3.3-beta.1",
|
"@alilc/lowcode-react-renderer": "1.3.2",
|
||||||
"@alilc/lowcode-types": "1.3.3-beta.1",
|
"@alilc/lowcode-types": "1.3.2",
|
||||||
"@alilc/lowcode-utils": "1.3.3-beta.1",
|
"@alilc/lowcode-utils": "1.3.2",
|
||||||
"classnames": "^2.2.6",
|
"classnames": "^2.2.6",
|
||||||
"mobx": "^6.3.0",
|
"mobx": "^6.3.0",
|
||||||
"mobx-react": "^7.2.0",
|
"mobx-react": "^7.2.0",
|
||||||
|
|||||||
@ -1,32 +1,29 @@
|
|||||||
// interface UtilsMetadata {
|
interface UtilsMetadata {
|
||||||
// name: string;
|
name: string;
|
||||||
// npm: {
|
npm: {
|
||||||
// package: string;
|
package: string;
|
||||||
// version?: string;
|
version?: string;
|
||||||
// exportName: string;
|
exportName: string;
|
||||||
// subName?: string;
|
subName?: string;
|
||||||
// destructuring?: boolean;
|
destructuring?: boolean;
|
||||||
// main?: string;
|
main?: string;
|
||||||
// };
|
};
|
||||||
// }
|
}
|
||||||
|
|
||||||
// invalid code
|
interface LibrayMap {
|
||||||
|
[key: string]: string;
|
||||||
|
}
|
||||||
|
|
||||||
// interface LibrayMap {
|
export function getProjectUtils(librayMap: LibrayMap, utilsMetadata: UtilsMetadata[]) {
|
||||||
// [key: string]: string;
|
const projectUtils: { [packageName: string]: any } = {};
|
||||||
// }
|
if (utilsMetadata) {
|
||||||
|
utilsMetadata.forEach(meta => {
|
||||||
// export function getProjectUtils(librayMap: LibrayMap, utilsMetadata: UtilsMetadata[]) {
|
if (librayMap[meta?.npm.package]) {
|
||||||
|
const lib = window[librayMap[meta?.npm.package]];
|
||||||
// const projectUtils: { [packageName: string]: any } = {};
|
}
|
||||||
// if (utilsMetadata) {
|
});
|
||||||
// utilsMetadata.forEach(meta => {
|
}
|
||||||
// if (librayMap[meta?.npm.package]) {
|
}
|
||||||
// const lib = window[librayMap[meta?.npm.package] as any];
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* judges if current simulator renderer deteched or not
|
* judges if current simulator renderer deteched or not
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-renderer-core",
|
"name": "@alilc/lowcode-renderer-core",
|
||||||
"version": "1.3.3-beta.1",
|
"version": "1.3.2",
|
||||||
"description": "renderer core",
|
"description": "renderer core",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
@ -16,8 +16,8 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alilc/lowcode-datasource-engine": "^1.0.0",
|
"@alilc/lowcode-datasource-engine": "^1.0.0",
|
||||||
"@alilc/lowcode-types": "1.3.3-beta.1",
|
"@alilc/lowcode-types": "1.3.2",
|
||||||
"@alilc/lowcode-utils": "1.3.3-beta.1",
|
"@alilc/lowcode-utils": "1.3.2",
|
||||||
"classnames": "^2.2.6",
|
"classnames": "^2.2.6",
|
||||||
"debug": "^4.1.1",
|
"debug": "^4.1.1",
|
||||||
"fetch-jsonp": "^1.1.3",
|
"fetch-jsonp": "^1.1.3",
|
||||||
@ -32,7 +32,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@alib/build-scripts": "^0.1.18",
|
"@alib/build-scripts": "^0.1.18",
|
||||||
"@alifd/next": "^1.26.0",
|
"@alifd/next": "^1.26.0",
|
||||||
"@alilc/lowcode-designer": "1.3.3-beta.1",
|
"@alilc/lowcode-designer": "1.3.2",
|
||||||
"@babel/plugin-transform-typescript": "^7.16.8",
|
"@babel/plugin-transform-typescript": "^7.16.8",
|
||||||
"@testing-library/react": "^11.2.2",
|
"@testing-library/react": "^11.2.2",
|
||||||
"@types/classnames": "^2.2.11",
|
"@types/classnames": "^2.2.11",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-shell",
|
"name": "@alilc/lowcode-shell",
|
||||||
"version": "1.3.3-beta.1",
|
"version": "1.3.2",
|
||||||
"description": "Shell Layer for AliLowCodeEngine",
|
"description": "Shell Layer for AliLowCodeEngine",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"module": "es/index.js",
|
"module": "es/index.js",
|
||||||
@ -13,12 +13,12 @@
|
|||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alilc/lowcode-designer": "1.3.3-beta.1",
|
"@alilc/lowcode-designer": "1.3.2",
|
||||||
"@alilc/lowcode-editor-core": "1.3.3-beta.1",
|
"@alilc/lowcode-editor-core": "1.3.2",
|
||||||
"@alilc/lowcode-editor-skeleton": "1.3.3-beta.1",
|
"@alilc/lowcode-editor-skeleton": "1.3.2",
|
||||||
"@alilc/lowcode-types": "1.3.3-beta.1",
|
"@alilc/lowcode-types": "1.3.2",
|
||||||
"@alilc/lowcode-utils": "1.3.3-beta.1",
|
"@alilc/lowcode-utils": "1.3.2",
|
||||||
"@alilc/lowcode-workspace": "1.3.3-beta.1",
|
"@alilc/lowcode-workspace": "1.3.2",
|
||||||
"classnames": "^2.2.6",
|
"classnames": "^2.2.6",
|
||||||
"enzyme": "^3.11.0",
|
"enzyme": "^3.11.0",
|
||||||
"enzyme-adapter-react-16": "^1.15.5",
|
"enzyme-adapter-react-16": "^1.15.5",
|
||||||
|
|||||||
@ -50,12 +50,4 @@ export class Hotkey implements IPublicApiHotkey {
|
|||||||
this[hotkeySymbol].unbind(combos, callback, action);
|
this[hotkeySymbol].unbind(combos, callback, action);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 给指定窗口绑定快捷键
|
|
||||||
* @param window 窗口的 window 对象
|
|
||||||
*/
|
|
||||||
mount(window: Window) {
|
|
||||||
return this[hotkeySymbol].mount(window);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
import { IPublicApiWorkspace, IPublicModelResource, 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 { resourceSymbol, workspaceSymbol } from '../symbols';
|
import { resourceSymbol, workspaceSymbol } from '../symbols';
|
||||||
import { Resource as ShellResource, Window as ShellWindow } from '../model';
|
import { Resource as ShellResource, Window as ShellWindow } from '../model';
|
||||||
@ -13,7 +13,7 @@ export class Workspace implements IPublicApiWorkspace {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get resourceList() {
|
get resourceList() {
|
||||||
return this[workspaceSymbol].getResourceList().map((d) => new ShellResource(d) as IPublicModelResource);
|
return this[workspaceSymbol].getResourceList().map((d) => new ShellResource(d));
|
||||||
}
|
}
|
||||||
|
|
||||||
setResourceList(resourceList: IPublicResourceList) {
|
setResourceList(resourceList: IPublicResourceList) {
|
||||||
|
|||||||
@ -46,7 +46,7 @@ export class Resource implements IPublicModelResource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get children() {
|
get children() {
|
||||||
return this[resourceSymbol].children.map((child) => new Resource(child) as IPublicModelResource);
|
return this[resourceSymbol].children.map((child) => new Resource(child));
|
||||||
}
|
}
|
||||||
|
|
||||||
get viewName() {
|
get viewName() {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-types",
|
"name": "@alilc/lowcode-types",
|
||||||
"version": "1.3.3-beta.1",
|
"version": "1.3.2",
|
||||||
"description": "Types for Ali lowCode engine",
|
"description": "Types for Ali lowCode engine",
|
||||||
"files": [
|
"files": [
|
||||||
"es",
|
"es",
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
import { Component, ReactElement, ReactNode } from 'react';
|
import { Component, ReactNode } from 'react';
|
||||||
import { IPublicTypeI18nData, IPublicTypeNodeSchema, IPublicTypeTitleContent } from '../type';
|
import { IPublicTypeI18nData, IPublicTypeNodeSchema, IPublicTypeTitleContent } from '../type';
|
||||||
import { IPublicEnumTransitionType } from '../enum';
|
import { IPublicEnumTransitionType } from '../enum';
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ export interface IPublicApiCommonUtils {
|
|||||||
/**
|
/**
|
||||||
* i18n 转换方法
|
* i18n 转换方法
|
||||||
*/
|
*/
|
||||||
intl(data: IPublicTypeI18nData | string | undefined | ReactElement, params?: object): string;
|
intl(data: IPublicTypeI18nData | string, params?: object): string;
|
||||||
}
|
}
|
||||||
export interface IPublicApiCommonSkeletonCabin {
|
export interface IPublicApiCommonSkeletonCabin {
|
||||||
|
|
||||||
|
|||||||
@ -22,10 +22,4 @@ export interface IPublicApiHotkey {
|
|||||||
callback: IPublicTypeHotkeyCallback,
|
callback: IPublicTypeHotkeyCallback,
|
||||||
action?: string,
|
action?: string,
|
||||||
): IPublicTypeDisposable;
|
): IPublicTypeDisposable;
|
||||||
|
|
||||||
/**
|
|
||||||
* 给指定窗口绑定快捷键
|
|
||||||
* @param window 窗口的 window 对象
|
|
||||||
*/
|
|
||||||
mount(window: Window): IPublicTypeDisposable;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -108,7 +108,7 @@ export interface IPublicModelDocumentModel<
|
|||||||
* @param data
|
* @param data
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
createNode<T = Node, S = IPublicTypeNodeSchema>(data: S): T | null;
|
createNode<T = Node>(data: IPublicTypeNodeSchema): T | null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 移除指定节点/节点id
|
* 移除指定节点/节点id
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { IPublicEnumTransformStage } from '../enum';
|
import { IPublicEnumTransformStage } from '../enum';
|
||||||
import { IPublicTypeCompositeValue, IPublicTypeNodeData } from '../type';
|
import { IPublicTypeCompositeValue } from '../type';
|
||||||
import { IPublicModelNode } from './';
|
import { IPublicModelNode } from './';
|
||||||
|
|
||||||
export interface IPublicModelProp<
|
export interface IPublicModelProp<
|
||||||
@ -48,7 +48,7 @@ export interface IPublicModelProp<
|
|||||||
* set value for this prop
|
* set value for this prop
|
||||||
* @param val
|
* @param val
|
||||||
*/
|
*/
|
||||||
setValue(val: IPublicTypeCompositeValue | IPublicTypeNodeData | IPublicTypeNodeData[]): void;
|
setValue(val: IPublicTypeCompositeValue): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取值
|
* 获取值
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { ComponentType, ReactElement } from 'react';
|
import { ReactElement } from 'react';
|
||||||
|
|
||||||
export interface IBaseModelResource<
|
export interface IBaseModelResource<
|
||||||
Resource
|
Resource
|
||||||
@ -7,7 +7,7 @@ export interface IBaseModelResource<
|
|||||||
|
|
||||||
get id(): string | undefined;
|
get id(): string | undefined;
|
||||||
|
|
||||||
get icon(): ReactElement | undefined | ComponentType;
|
get icon(): ReactElement | undefined;
|
||||||
|
|
||||||
get options(): Record<string, any>;
|
get options(): Record<string, any>;
|
||||||
|
|
||||||
|
|||||||
@ -102,7 +102,7 @@ export interface IPublicTypeFilterItem {
|
|||||||
}
|
}
|
||||||
export interface IPublicTypeAutorunItem {
|
export interface IPublicTypeAutorunItem {
|
||||||
name: string;
|
name: string;
|
||||||
autorun: (target: IPublicModelSettingField | null | undefined) => any;
|
autorun: (target: IPublicModelSettingField | null) => any;
|
||||||
}
|
}
|
||||||
|
|
||||||
// thinkof Array
|
// thinkof Array
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
import { IPublicEnumTransformStage } from '../enum';
|
import { IPublicEnumTransformStage } from '../enum';
|
||||||
import { IPublicModelNode } from '../model';
|
import { IPublicModelNode } from '../model';
|
||||||
import { IPublicTypePropsMap } from './';
|
import { IPublicTypeCompositeObject } from './';
|
||||||
|
|
||||||
export type IPublicTypePropsTransducer = (
|
export type IPublicTypePropsTransducer = (
|
||||||
props: IPublicTypePropsMap,
|
props: IPublicTypeCompositeObject,
|
||||||
node: IPublicModelNode,
|
node: IPublicModelNode,
|
||||||
ctx?: {
|
ctx?: {
|
||||||
stage: IPublicEnumTransformStage;
|
stage: IPublicEnumTransformStage;
|
||||||
},
|
},
|
||||||
) => IPublicTypePropsMap;
|
) => IPublicTypeCompositeObject;
|
||||||
|
|||||||
@ -36,7 +36,7 @@ export interface IPublicTypeWidgetBaseConfig {
|
|||||||
*/
|
*/
|
||||||
area?: IPublicTypeWidgetConfigArea;
|
area?: IPublicTypeWidgetConfigArea;
|
||||||
props?: Record<string, any>;
|
props?: Record<string, any>;
|
||||||
content?: string | ReactElement | ComponentType<any> | IPublicTypePanelConfig[] | IPublicTypePanelConfig;
|
content?: string | ReactElement | ComponentType<any> | IPublicTypePanelConfig[];
|
||||||
contentProps?: Record<string, any>;
|
contentProps?: Record<string, any>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-utils",
|
"name": "@alilc/lowcode-utils",
|
||||||
"version": "1.3.3-beta.1",
|
"version": "1.3.2",
|
||||||
"description": "Utils for Ali lowCode engine",
|
"description": "Utils for Ali lowCode engine",
|
||||||
"files": [
|
"files": [
|
||||||
"lib",
|
"lib",
|
||||||
@ -14,7 +14,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alifd/next": "^1.19.16",
|
"@alifd/next": "^1.19.16",
|
||||||
"@alilc/lowcode-types": "1.3.3-beta.1",
|
"@alilc/lowcode-types": "1.3.2",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"mobx": "^6.3.0",
|
"mobx": "^6.3.0",
|
||||||
"prop-types": "^15.8.1",
|
"prop-types": "^15.8.1",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { isObject } from './is-object';
|
import { isObject } from './is-object';
|
||||||
|
|
||||||
export function isPlainObject<T extends object = object>(value: any): value is T {
|
export function isPlainObject(value: any): value is any {
|
||||||
if (!isObject(value)) {
|
if (!isObject(value)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-workspace",
|
"name": "@alilc/lowcode-workspace",
|
||||||
"version": "1.3.3-beta.1",
|
"version": "1.3.2",
|
||||||
"description": "Shell Layer for AliLowCodeEngine",
|
"description": "Shell Layer for AliLowCodeEngine",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"module": "es/index.js",
|
"module": "es/index.js",
|
||||||
@ -15,11 +15,11 @@
|
|||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alilc/lowcode-designer": "1.3.3-beta.1",
|
"@alilc/lowcode-designer": "1.3.2",
|
||||||
"@alilc/lowcode-editor-core": "1.3.3-beta.1",
|
"@alilc/lowcode-editor-core": "1.3.2",
|
||||||
"@alilc/lowcode-editor-skeleton": "1.3.3-beta.1",
|
"@alilc/lowcode-editor-skeleton": "1.3.2",
|
||||||
"@alilc/lowcode-types": "1.3.3-beta.1",
|
"@alilc/lowcode-types": "1.3.2",
|
||||||
"@alilc/lowcode-utils": "1.3.3-beta.1",
|
"@alilc/lowcode-utils": "1.3.2",
|
||||||
"classnames": "^2.2.6",
|
"classnames": "^2.2.6",
|
||||||
"enzyme": "^3.11.0",
|
"enzyme": "^3.11.0",
|
||||||
"enzyme-adapter-react-16": "^1.15.5",
|
"enzyme-adapter-react-16": "^1.15.5",
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user